Skip to content

Commit

Permalink
refactor!: remove tui-wrapper, tui-group, table-mode, field-error com…
Browse files Browse the repository at this point in the history
…ponent, tui-breadcrumb items (#2121)

* refactor!: remove tui-wrapper, tui-group, table-mode, field-error component, tui-breadcrumb items
  • Loading branch information
vladimirpotekhin authored and actions-user committed Jul 21, 2022
1 parent 60eaf63 commit 6204d07
Show file tree
Hide file tree
Showing 280 changed files with 579 additions and 2,280 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<tui-wrapper
<div
*ngIf="cardGroupedTexts$ | async as texts"
tuiWrapper
class="t-common-wrapper"
[appearance]="appearance"
[readOnly]="readOnly"
[disabled]="computedDisabled"
[focused]="computedFocused"
[hovered]="computedHovered"
[hover]="computedHovered"
[invalid]="computedInvalid"
[tuiDropdown]="open"
[tuiDropdownContent]="dropdown || ''"
Expand Down Expand Up @@ -154,4 +155,4 @@
(click)="toggle()"
></tui-svg>
</div>
</tui-wrapper>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';

import {generateRoutes, TuiAddonDocModule,
import {tuiGenerateRoutes, TuiAddonDocModule,
TuiDocExampleModule,
TuiDocPageModule,
TuiDocDocumentationModule,
Expand All @@ -22,7 +22,7 @@ import {<%= classify(name) %>Example<%=i%>} from './examples/<%=i%>'; <%}%>
TuiDocDocumentationModule,
TuiDocCodeModule,
TuiDocDemoModule,
RouterModule.forChild(generateRoutes(Example<%= classify(name) %>Component)),
RouterModule.forChild(tuiGenerateRoutes(Example<%= classify(name) %>Component)),
],
declarations: [Example<%= classify(name) %>Component, <% for(let i=1; i<=samples; i++) {%>
<%= classify(name) %>Example<%=i%>,<%}%>
Expand Down
9 changes: 1 addition & 8 deletions projects/addon-doc/src/utils/generate-routes.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import {Type} from '@angular/core';
import {Routes} from '@angular/router';

/**
* @deprecated: use {@link tuiGenerateRoutes} instead
* Generates typical page routing structure
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
export function generateRoutes(type: Type<unknown>): Routes {
export function tuiGenerateRoutes(type: Type<unknown>): Routes {
return [
{
path: '',
Expand All @@ -20,5 +15,3 @@ export function generateRoutes(type: Type<unknown>): Routes {
},
];
}

export const tuiGenerateRoutes = generateRoutes;
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<tui-wrapper
<div
tuiWrapper
appearance="textfield"
class="t-outline"
[readOnly]="readOnly"
[disabled]="disabled"
[focused]="computedFocused"
[hovered]="computedHovered"
[hover]="computedHovered"
[invalid]="computedInvalid"
>
<div
Expand Down Expand Up @@ -70,4 +71,4 @@
<tui-editor-portal-host></tui-editor-portal-host>
</tui-scrollbar>
</div>
</tui-wrapper>
</div>
7 changes: 4 additions & 3 deletions projects/addon-editor/components/editor/editor.template.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<tui-wrapper
<div
tuiWrapper
appearance="textfield"
class="t-outline"
[readOnly]="readOnly"
[disabled]="disabled"
[focused]="computedFocused"
[hovered]="computedHovered"
[hover]="computedHovered"
[invalid]="computedInvalid"
></tui-wrapper>
></div>
<div
class="t-wrapper"
(tuiHoveredChange)="onHovered($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
height: 100%;
}

tui-wrapper[data-appearance='preview-action'] {
[tuiWrapper][data-appearance='preview-action'] {
background: rgba(104, 104, 104, 0.96);
color: var(--tui-text-01-night);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const TEMPLATE_BEFORE = `
</tui-primitive-textfield>
<div tuiWrapper
[hovered]="computedHovered"
[hover]="computedHovered"
>any</div>
<tui-select (hoveredChange)="onHoverChange(event$)"></tui-select>
Expand Down
6 changes: 1 addition & 5 deletions projects/cdk/utils/miscellaneous/nullable-same.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import {TuiIdentityMatcher} from '@taiga-ui/cdk/types';

/**
* @deprecated: use {@link tuiNullableSame} instead
* Checks identity for nullable elements.
*
* @param a element a
* @param b element b
* @param handler called if both elements are not null
* @return true if either both are null or they pass identity handler
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
export function nullableSame<T>(
export function tuiNullableSame<T>(
a: T | null,
b: T | null,
handler: TuiIdentityMatcher<T>,
Expand All @@ -25,5 +23,3 @@ export function nullableSame<T>(

return handler(a, b);
}

export const tuiNullableSame = nullableSame;
12 changes: 6 additions & 6 deletions projects/cdk/utils/miscellaneous/test/nullable-same.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {nullableSame} from '../nullable-same';
import {tuiNullableSame} from '../nullable-same';

describe('nullableSame', () => {
interface Test {
Expand All @@ -14,25 +14,25 @@ describe('nullableSame', () => {

describe('returns true if', () => {
it('a = null, b = null', () => {
expect(nullableSame(null, null, testMather)).toBe(true);
expect(tuiNullableSame(null, null, testMather)).toBe(true);
});

it('a = {id: 1}, b = {id: 1}', () => {
expect(nullableSame(value1, value1, testMather)).toBe(true);
expect(tuiNullableSame(value1, value1, testMather)).toBe(true);
});
});

describe('returns false if', () => {
it('a = {id: 1}, b = null', () => {
expect(nullableSame(value1, null, testMather)).toBe(false);
expect(tuiNullableSame(value1, null, testMather)).toBe(false);
});

it('a = null, b = {id: 1}', () => {
expect(nullableSame(null, value1, testMather)).toBe(false);
expect(tuiNullableSame(null, value1, testMather)).toBe(false);
});

it('a = {id: 1}, b = {id: 2}', () => {
expect(nullableSame(value1, value2, testMather)).toBe(false);
expect(tuiNullableSame(value1, value2, testMather)).toBe(false);
});
});
});
9 changes: 5 additions & 4 deletions projects/core/components/button/button.template.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<tui-wrapper
<div
tuiWrapper
class="t-wrapper"
[appearance]="appearance"
[hovered]="computedHovered"
[pressed]="computedPressed"
[hover]="computedHovered"
[active]="computedPressed"
[disabled]="computedDisabled"
[focused]="computedFocusVisible"
>
Expand Down Expand Up @@ -41,4 +42,4 @@
[size]="loaderSize"
[inheritColor]="true"
></tui-loader>
</tui-wrapper>
</div>
4 changes: 2 additions & 2 deletions projects/core/components/calendar/calendar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
} from '@angular/core';
import {
ALWAYS_FALSE_HANDLER,
nullableSame,
TUI_FIRST_DAY,
TUI_LAST_DAY,
TuiBooleanHandler,
Expand All @@ -16,6 +15,7 @@ import {
tuiDefaultProp,
TuiMapper,
TuiMonth,
tuiNullableSame,
TuiYear,
} from '@taiga-ui/cdk';
import {TUI_DEFAULT_MARKER_HANDLER} from '@taiga-ui/core/constants';
Expand Down Expand Up @@ -130,7 +130,7 @@ export class TuiCalendarComponent implements TuiWithOptionalMinMax<TuiDay> {
}

private updateHoveredDay(day: TuiDay | null): void {
if (nullableSame(this.hoveredItem, day, (a, b) => a.daySame(b))) {
if (tuiNullableSame(this.hoveredItem, day, (a, b) => a.daySame(b))) {
return;
}

Expand Down
15 changes: 0 additions & 15 deletions projects/core/components/group/group.component.ts

This file was deleted.

5 changes: 2 additions & 3 deletions projects/core/components/group/group.module.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';

import {TuiGroupComponent} from './group.component';
import {TuiGroupDirective} from './group.directive';
import {TuiGroupStylesComponent} from './group-styles.component';

@NgModule({
imports: [CommonModule],
entryComponents: [TuiGroupStylesComponent],
declarations: [TuiGroupComponent, TuiGroupDirective, TuiGroupStylesComponent],
exports: [TuiGroupComponent, TuiGroupDirective, TuiGroupStylesComponent],
declarations: [TuiGroupDirective, TuiGroupStylesComponent],
exports: [TuiGroupDirective, TuiGroupStylesComponent],
})
export class TuiGroupModule {}
1 change: 0 additions & 1 deletion projects/core/components/group/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './group.component';
export * from './group.directive';
export * from './group.module';
export * from './group-styles.component';
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {
} from '@angular/core';
import {
ALWAYS_FALSE_HANDLER,
nullableSame,
TuiBooleanHandler,
TuiDay,
TuiDayRange,
tuiDefaultProp,
TuiMonth,
tuiNullableSame,
} from '@taiga-ui/cdk';
import {TUI_DEFAULT_MARKER_HANDLER} from '@taiga-ui/core/constants';
import {TuiInteractiveState, TuiRangeState} from '@taiga-ui/core/enums';
Expand Down Expand Up @@ -189,7 +189,7 @@ export class TuiPrimitiveCalendarComponent {
}

private updateHoveredItem(day: TuiDay | null): void {
if (nullableSame(this.hoveredItem, day, (a, b) => a.daySame(b))) {
if (tuiNullableSame(this.hoveredItem, day, (a, b) => a.daySame(b))) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ export interface TuiCheckboxOptions {
}>;
}

/**
* @deprecated: use TuiCheckboxOptions instead
* todo: remove in 3.0
*/
export type CheckboxOptions = TuiCheckboxOptions;

/** Default values for the checkbox options. */
export const TUI_CHECKBOX_DEFAULT_OPTIONS: TuiCheckboxOptions = {
size: 'm',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<tui-wrapper
<div
tuiWrapper
[appearance]="appearance"
[disabled]="disabled"
[focused]="focused"
[hovered]="hovered"
[pressed]="pressed"
[hover]="hovered"
[active]="pressed"
[invalid]="invalid"
>
<span
Expand All @@ -20,4 +21,4 @@
</ng-template>
</span>
<ng-content></ng-content>
</tui-wrapper>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ export class TuiPrimitiveTextfieldComponent
@Output()
readonly valueChange = new EventEmitter<string>();

/**
* @deprecated TODO: 3.0 remove
*/
@Output()
readonly autofilledChange = new EventEmitter<boolean>();

@ContentChildren(PolymorpheusOutletComponent)
readonly content?: QueryList<unknown>;

Expand Down Expand Up @@ -304,7 +298,6 @@ export class TuiPrimitiveTextfieldComponent
}

this.autofilled = autofilled;
this.autofilledChange.emit(autofilled);
}

private updateValue(value: string): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<ng-container *ngIf="content?.changes | async"></ng-container>
<tui-wrapper
<div
tuiWrapper
automation-id="tui-primitive-textfield__wrapper"
[appearance]="appearance"
[readOnly]="readOnly"
[disabled]="disabled"
[focused]="computedFocused"
[hovered]="computedHovered"
[pressed]="computedPressed"
[hover]="computedHovered"
[active]="computedPressed"
[invalid]="computedInvalid"
[style.--text-indent.px]="decor.pre$ | async"
(mousedown)="onMouseDown($event)"
Expand Down Expand Up @@ -122,4 +123,4 @@
</ng-template>
</div>
</div>
</tui-wrapper>
</div>
Loading

0 comments on commit 6204d07

Please sign in to comment.