@koobiq/components 18.20.0 → 18.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/badge/badge.component.d.ts +0 -1
- package/breadcrumbs/breadcrumbs-tokens.scss +1 -0
- package/breadcrumbs/breadcrumbs.d.ts +27 -19
- package/breadcrumbs/breadcrumbs.scss +81 -18
- package/breadcrumbs/breadcrumbs.types.d.ts +22 -0
- package/breadcrumbs/public-api.d.ts +1 -0
- package/button/button-tokens.scss +1 -1
- package/button/button.component.d.ts +11 -16
- package/button/button.scss +2 -15
- package/checkbox/checkbox-tokens.scss +2 -0
- package/checkbox/checkbox.d.ts +13 -18
- package/checkbox/checkbox.scss +4 -4
- package/core/common-behaviors/color.d.ts +11 -0
- package/core/common-behaviors/index.d.ts +1 -1
- package/core/formatters/date/formatter.d.ts +3 -2
- package/core/locales/locale-service.d.ts +5 -1
- package/core/option/action.d.ts +5 -7
- package/core/option/optgroup.d.ts +6 -7
- package/core/pop-up/pop-up-trigger.d.ts +2 -2
- package/core/pop-up/pop-up.d.ts +8 -2
- package/core/selection/pseudo-checkbox/pseudo-checkbox.d.ts +3 -12
- package/core/styles/theming/scrollbar-tokens.scss +10 -4
- package/core/utils/utils.d.ts +3 -0
- package/dropdown/dropdown-item.component.d.ts +6 -8
- package/dropdown/dropdown.scss +20 -5
- package/empty-state/_empty-state-theme.scss +15 -5
- package/empty-state/empty-state-tokens.scss +12 -2
- package/empty-state/empty-state.component.d.ts +7 -2
- package/empty-state/empty-state.scss +29 -0
- package/esm2022/accordion/accordion-trigger.component.mjs +1 -1
- package/esm2022/actions-panel/actions-panel-container.mjs +2 -2
- package/esm2022/badge/badge.component.mjs +2 -5
- package/esm2022/breadcrumbs/breadcrumbs.mjs +68 -24
- package/esm2022/breadcrumbs/breadcrumbs.types.mjs +2 -0
- package/esm2022/breadcrumbs/public-api.mjs +2 -1
- package/esm2022/button/button.component.mjs +25 -29
- package/esm2022/button-toggle/button-toggle.component.mjs +4 -3
- package/esm2022/checkbox/checkbox.mjs +23 -24
- package/esm2022/code-block/code-block.mjs +2 -2
- package/esm2022/core/common-behaviors/color.mjs +35 -1
- package/esm2022/core/common-behaviors/disabled.mjs +2 -1
- package/esm2022/core/common-behaviors/error-state.mjs +2 -1
- package/esm2022/core/common-behaviors/index.mjs +2 -2
- package/esm2022/core/common-behaviors/tabindex.mjs +2 -1
- package/esm2022/core/formatters/date/formatter.mjs +13 -4
- package/esm2022/core/locales/en-US.mjs +29 -29
- package/esm2022/core/locales/es-LA.mjs +29 -29
- package/esm2022/core/locales/fa-IR.mjs +29 -29
- package/esm2022/core/locales/locale-service.mjs +38 -3
- package/esm2022/core/locales/pt-BR.mjs +29 -29
- package/esm2022/core/locales/tk-TM.mjs +29 -29
- package/esm2022/core/locales/zh-CN.mjs +29 -29
- package/esm2022/core/option/action.mjs +17 -12
- package/esm2022/core/option/optgroup.mjs +18 -12
- package/esm2022/core/option/option.mjs +1 -1
- package/esm2022/core/pop-up/pop-up-trigger.mjs +8 -8
- package/esm2022/core/pop-up/pop-up.mjs +21 -5
- package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +10 -19
- package/esm2022/core/utils/utils.mjs +7 -1
- package/esm2022/core/version.mjs +2 -2
- package/esm2022/datepicker/calendar-header.component.mjs +1 -1
- package/esm2022/datepicker/datepicker-toggle.component.mjs +1 -1
- package/esm2022/dropdown/dropdown-item.component.mjs +19 -14
- package/esm2022/dropdown/dropdown.component.mjs +3 -3
- package/esm2022/empty-state/empty-state.component.mjs +13 -8
- package/esm2022/file-upload/multiple-file-upload.component.mjs +2 -2
- package/esm2022/file-upload/single-file-upload.component.mjs +2 -2
- package/esm2022/filter-bar/filter-bar.mjs +3 -3
- package/esm2022/filter-bar/filter-refresher.mjs +2 -2
- package/esm2022/filter-bar/filter-reset.mjs +1 -1
- package/esm2022/filter-bar/filter-search.mjs +2 -2
- package/esm2022/filter-bar/filters.mjs +2 -2
- package/esm2022/filter-bar/pipe-add.mjs +2 -2
- package/esm2022/filter-bar/pipes/pipe-button.mjs +2 -2
- package/esm2022/filter-bar/pipes/pipe-date.mjs +37 -22
- package/esm2022/filter-bar/pipes/pipe-datetime.mjs +38 -23
- package/esm2022/filter-bar/pipes/pipe-multi-select.mjs +2 -2
- package/esm2022/filter-bar/pipes/pipe-select.mjs +2 -2
- package/esm2022/filter-bar/pipes/pipe-text.mjs +4 -4
- package/esm2022/form-field/cleaner.mjs +1 -1
- package/esm2022/form-field/form-field.mjs +13 -22
- package/esm2022/form-field/hint.mjs +10 -18
- package/esm2022/form-field/password-hint.mjs +7 -7
- package/esm2022/form-field/password-toggle.mjs +1 -1
- package/esm2022/form-field/stepper.mjs +1 -1
- package/esm2022/form-field/validate.directive.mjs +19 -9
- package/esm2022/icon/icon-button.component.mjs +13 -21
- package/esm2022/icon/icon-item.component.mjs +8 -15
- package/esm2022/icon/icon.component.mjs +15 -27
- package/esm2022/input/input-number.mjs +2 -2
- package/esm2022/input/input-password.mjs +20 -5
- package/esm2022/input/input.mjs +21 -22
- package/esm2022/link/link.component.mjs +46 -14
- package/esm2022/list/list-selection.component.mjs +19 -15
- package/esm2022/loader-overlay/loader-overlay.component.mjs +14 -9
- package/esm2022/modal/modal.component.mjs +1 -1
- package/esm2022/modal/modal.directive.mjs +1 -1
- package/esm2022/navbar/navbar-item.component.mjs +8 -11
- package/esm2022/overflow-items/overflow-items.mjs +24 -3
- package/esm2022/popover/popover-confirm.component.mjs +2 -2
- package/esm2022/popover/popover.component.mjs +5 -4
- package/esm2022/progress-bar/progress-bar.component.mjs +14 -21
- package/esm2022/progress-spinner/progress-spinner.component.mjs +18 -25
- package/esm2022/radio/radio.component.mjs +25 -35
- package/esm2022/scrollbar/scrollbar.component.mjs +3 -3
- package/esm2022/select/select.component.mjs +56 -37
- package/esm2022/sidepanel/sidepanel-container.component.mjs +3 -3
- package/esm2022/sidepanel/sidepanel-directives.mjs +17 -6
- package/esm2022/tabs/paginated-tab-header.mjs +7 -4
- package/esm2022/tabs/tab-group.component.mjs +23 -19
- package/esm2022/tabs/tab-header.component.mjs +3 -3
- package/esm2022/tabs/tab-label-wrapper.directive.mjs +16 -13
- package/esm2022/tabs/tab-nav-bar.mjs +2 -2
- package/esm2022/tabs/tab.component.mjs +17 -12
- package/esm2022/tags/tag-list.component.mjs +27 -22
- package/esm2022/tags/tag.component.mjs +7 -14
- package/esm2022/textarea/textarea.component.mjs +53 -28
- package/esm2022/timezone/timezone-select.component.mjs +3 -3
- package/esm2022/toast/toast.component.mjs +2 -2
- package/esm2022/toggle/toggle.component.mjs +20 -19
- package/esm2022/top-bar/top-bar.mjs +2 -2
- package/esm2022/tree/toggle.mjs +19 -14
- package/esm2022/tree/tree-option.component.mjs +1 -1
- package/esm2022/tree/tree-selection.component.mjs +1 -1
- package/esm2022/tree-select/tree-select.component.mjs +58 -38
- package/fesm2022/koobiq-components-accordion.mjs +1 -1
- package/fesm2022/koobiq-components-accordion.mjs.map +1 -1
- package/fesm2022/koobiq-components-actions-panel.mjs +1 -1
- package/fesm2022/koobiq-components-actions-panel.mjs.map +1 -1
- package/fesm2022/koobiq-components-badge.mjs +2 -5
- package/fesm2022/koobiq-components-badge.mjs.map +1 -1
- package/fesm2022/koobiq-components-breadcrumbs.mjs +68 -24
- package/fesm2022/koobiq-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/koobiq-components-button-toggle.mjs +3 -3
- package/fesm2022/koobiq-components-button-toggle.mjs.map +1 -1
- package/fesm2022/koobiq-components-button.mjs +25 -29
- package/fesm2022/koobiq-components-button.mjs.map +1 -1
- package/fesm2022/koobiq-components-checkbox.mjs +23 -24
- package/fesm2022/koobiq-components-checkbox.mjs.map +1 -1
- package/fesm2022/koobiq-components-code-block.mjs +1 -1
- package/fesm2022/koobiq-components-code-block.mjs.map +1 -1
- package/fesm2022/koobiq-components-core.mjs +1246 -1143
- package/fesm2022/koobiq-components-core.mjs.map +1 -1
- package/fesm2022/koobiq-components-datepicker.mjs +2 -2
- package/fesm2022/koobiq-components-datepicker.mjs.map +1 -1
- package/fesm2022/koobiq-components-dropdown.mjs +20 -15
- package/fesm2022/koobiq-components-dropdown.mjs.map +1 -1
- package/fesm2022/koobiq-components-empty-state.mjs +12 -7
- package/fesm2022/koobiq-components-empty-state.mjs.map +1 -1
- package/fesm2022/koobiq-components-file-upload.mjs +2 -2
- package/fesm2022/koobiq-components-file-upload.mjs.map +1 -1
- package/fesm2022/koobiq-components-filter-bar.mjs +86 -56
- package/fesm2022/koobiq-components-filter-bar.mjs.map +1 -1
- package/fesm2022/koobiq-components-form-field.mjs +41 -49
- package/fesm2022/koobiq-components-form-field.mjs.map +1 -1
- package/fesm2022/koobiq-components-icon.mjs +33 -57
- package/fesm2022/koobiq-components-icon.mjs.map +1 -1
- package/fesm2022/koobiq-components-input.mjs +41 -26
- package/fesm2022/koobiq-components-input.mjs.map +1 -1
- package/fesm2022/koobiq-components-link.mjs +46 -14
- package/fesm2022/koobiq-components-link.mjs.map +1 -1
- package/fesm2022/koobiq-components-list.mjs +19 -15
- package/fesm2022/koobiq-components-list.mjs.map +1 -1
- package/fesm2022/koobiq-components-loader-overlay.mjs +13 -8
- package/fesm2022/koobiq-components-loader-overlay.mjs.map +1 -1
- package/fesm2022/koobiq-components-modal.mjs +2 -2
- package/fesm2022/koobiq-components-modal.mjs.map +1 -1
- package/fesm2022/koobiq-components-navbar.mjs +7 -10
- package/fesm2022/koobiq-components-navbar.mjs.map +1 -1
- package/fesm2022/koobiq-components-overflow-items.mjs +24 -3
- package/fesm2022/koobiq-components-overflow-items.mjs.map +1 -1
- package/fesm2022/koobiq-components-popover.mjs +5 -4
- package/fesm2022/koobiq-components-popover.mjs.map +1 -1
- package/fesm2022/koobiq-components-progress-bar.mjs +13 -20
- package/fesm2022/koobiq-components-progress-bar.mjs.map +1 -1
- package/fesm2022/koobiq-components-progress-spinner.mjs +17 -24
- package/fesm2022/koobiq-components-progress-spinner.mjs.map +1 -1
- package/fesm2022/koobiq-components-radio.mjs +25 -35
- package/fesm2022/koobiq-components-radio.mjs.map +1 -1
- package/fesm2022/koobiq-components-scrollbar.mjs +2 -2
- package/fesm2022/koobiq-components-scrollbar.mjs.map +1 -1
- package/fesm2022/koobiq-components-select.mjs +56 -37
- package/fesm2022/koobiq-components-select.mjs.map +1 -1
- package/fesm2022/koobiq-components-sidepanel.mjs +18 -7
- package/fesm2022/koobiq-components-sidepanel.mjs.map +1 -1
- package/fesm2022/koobiq-components-tabs.mjs +60 -44
- package/fesm2022/koobiq-components-tabs.mjs.map +1 -1
- package/fesm2022/koobiq-components-tags.mjs +32 -34
- package/fesm2022/koobiq-components-tags.mjs.map +1 -1
- package/fesm2022/koobiq-components-textarea.mjs +53 -28
- package/fesm2022/koobiq-components-textarea.mjs.map +1 -1
- package/fesm2022/koobiq-components-timezone.mjs +2 -2
- package/fesm2022/koobiq-components-timezone.mjs.map +1 -1
- package/fesm2022/koobiq-components-toast.mjs +1 -1
- package/fesm2022/koobiq-components-toast.mjs.map +1 -1
- package/fesm2022/koobiq-components-toggle.mjs +20 -19
- package/fesm2022/koobiq-components-toggle.mjs.map +1 -1
- package/fesm2022/koobiq-components-top-bar.mjs +2 -2
- package/fesm2022/koobiq-components-top-bar.mjs.map +1 -1
- package/fesm2022/koobiq-components-tree-select.mjs +57 -37
- package/fesm2022/koobiq-components-tree-select.mjs.map +1 -1
- package/fesm2022/koobiq-components-tree.mjs +21 -15
- package/fesm2022/koobiq-components-tree.mjs.map +1 -1
- package/file-upload/multiple-file-upload.component.d.ts +2 -2
- package/file-upload/single-file-upload.component.d.ts +2 -2
- package/filter-bar/filter-bar.scss +1 -0
- package/filter-bar/pipes/pipe-date.d.ts +3 -1
- package/filter-bar/pipes/pipe-date.scss +7 -0
- package/filter-bar/pipes/pipe-datetime.d.ts +3 -1
- package/form-field/_form-field-theme.scss +7 -3
- package/form-field/form-field.d.ts +4 -12
- package/form-field/hint.d.ts +3 -12
- package/form-field/password-hint.d.ts +3 -3
- package/form-field/validate.directive.d.ts +4 -2
- package/icon/icon-button.component.d.ts +5 -8
- package/icon/icon-item.component.d.ts +3 -7
- package/icon/icon.component.d.ts +7 -14
- package/input/input-password.d.ts +8 -2
- package/input/input.d.ts +9 -18
- package/link/_link-theme.scss +23 -24
- package/link/link.component.d.ts +13 -9
- package/list/list-selection.component.d.ts +8 -10
- package/loader-overlay/_loader-overlay-theme.scss +18 -8
- package/loader-overlay/loader-overlay-tokens.scss +6 -3
- package/loader-overlay/loader-overlay.component.d.ts +7 -2
- package/loader-overlay/loader-overlay.scss +19 -5
- package/navbar/navbar-item.component.d.ts +1 -2
- package/overflow-items/overflow-items.d.ts +17 -1
- package/package.json +5 -5
- package/prebuilt-themes/dark-theme.css +1 -1
- package/prebuilt-themes/light-theme.css +1 -1
- package/prebuilt-themes/theme.css +1 -1
- package/progress-bar/progress-bar.component.d.ts +4 -12
- package/progress-spinner/progress-spinner.component.d.ts +4 -12
- package/progress-spinner/progress-spinner.scss +10 -4
- package/radio/radio.component.d.ts +11 -25
- package/schematics/collection.json +10 -0
- package/schematics/migrations/css-selectors/README.md +19 -0
- package/schematics/migrations/deprecated-icons/README.md +21 -0
- package/schematics/migrations/empty-state-size-attr/README.md +62 -0
- package/schematics/migrations/empty-state-size-attr/index.js +74 -0
- package/schematics/migrations/empty-state-size-attr/schema.json +15 -0
- package/schematics/migrations/loader-overlay-size-attr/README.md +62 -0
- package/schematics/migrations/loader-overlay-size-attr/index.js +74 -0
- package/schematics/migrations/loader-overlay-size-attr/schema.json +15 -0
- package/schematics/migrations/new-icons-pack/README.md +21 -0
- package/schematics/ng-add/index.js +3 -3
- package/schematics/utils/angular-parsing.js +153 -0
- package/schematics/utils/ast.js +28 -0
- package/schematics/utils/package-config.js +46 -0
- package/schematics/utils/typescript.js +171 -0
- package/scrollbar/scrollbar-tokens.scss +10 -4
- package/select/_select-theme.scss +4 -1
- package/select/select.component.d.ts +26 -25
- package/sidepanel/sidepanel-directives.d.ts +6 -1
- package/sidepanel/sidepanel.scss +9 -3
- package/tabs/paginated-tab-header.d.ts +2 -1
- package/tabs/tab-group.component.d.ts +11 -13
- package/tabs/tab-header.component.d.ts +1 -1
- package/tabs/tab-label-wrapper.directive.d.ts +6 -8
- package/tabs/tab.component.d.ts +7 -8
- package/tags/tag-list.component.d.ts +15 -18
- package/tags/tag.component.d.ts +3 -10
- package/textarea/textarea.component.d.ts +24 -20
- package/textarea/textarea.scss +4 -0
- package/toggle/toggle.component.d.ts +8 -12
- package/top-bar/top-bar-tokens.scss +2 -2
- package/top-bar/top-bar.scss +1 -1
- package/tree/toggle.d.ts +7 -9
- package/tree/tree-selection.component.d.ts +2 -2
- package/tree-select/_tree-select-theme.scss +4 -1
- package/tree-select/tree-select.component.d.ts +24 -26
|
@@ -2,7 +2,7 @@ import { FocusMonitor } from '@angular/cdk/a11y';
|
|
|
2
2
|
import { UniqueSelectionDispatcher } from '@angular/cdk/collections';
|
|
3
3
|
import { AfterContentInit, AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit, QueryList } from '@angular/core';
|
|
4
4
|
import { ControlValueAccessor } from '@angular/forms';
|
|
5
|
-
import {
|
|
5
|
+
import { KbqColorDirective } from '@koobiq/components/core';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
/** Change event object emitted by KbqRadio. */
|
|
8
8
|
export declare class KbqRadioChange {
|
|
@@ -16,20 +16,13 @@ export declare class KbqRadioChange {
|
|
|
16
16
|
/** The value of the KbqRadioButton. */
|
|
17
17
|
value: any);
|
|
18
18
|
}
|
|
19
|
-
/** @docs-private */
|
|
20
|
-
export declare class KbqRadioGroupBase {
|
|
21
|
-
elementRef: ElementRef;
|
|
22
|
-
constructor(elementRef: ElementRef);
|
|
23
|
-
}
|
|
24
|
-
/** @docs-private */
|
|
25
|
-
export declare const KbqRadioGroupMixinBase: CanDisableCtor & typeof KbqRadioGroupBase;
|
|
26
19
|
/**
|
|
27
20
|
* Provider Expression that allows kbq-radio-group to register as a ControlValueAccessor. This
|
|
28
21
|
* allows it to support [(ngModel)] and ngControl.
|
|
29
22
|
* @docs-private
|
|
30
23
|
*/
|
|
31
24
|
export declare const KBQ_RADIO_GROUP_CONTROL_VALUE_ACCESSOR: any;
|
|
32
|
-
export declare class KbqRadioGroup
|
|
25
|
+
export declare class KbqRadioGroup implements AfterContentInit, ControlValueAccessor {
|
|
33
26
|
private readonly changeDetector;
|
|
34
27
|
big: boolean;
|
|
35
28
|
/** Name of the radio button group. All radio buttons inside this group will use this name. */
|
|
@@ -47,7 +40,6 @@ export declare class KbqRadioGroup extends KbqRadioGroupMixinBase implements Aft
|
|
|
47
40
|
/** Whether the radio group is disabled */
|
|
48
41
|
get disabled(): boolean;
|
|
49
42
|
set disabled(value: boolean);
|
|
50
|
-
/** Whether the radio group is disabled. */
|
|
51
43
|
private _disabled;
|
|
52
44
|
/** Whether the radio group is required */
|
|
53
45
|
get required(): boolean;
|
|
@@ -77,7 +69,7 @@ export declare class KbqRadioGroup extends KbqRadioGroupMixinBase implements Aft
|
|
|
77
69
|
private isInitialized;
|
|
78
70
|
/** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
|
|
79
71
|
private _labelPosition;
|
|
80
|
-
constructor(
|
|
72
|
+
constructor(changeDetector: ChangeDetectorRef);
|
|
81
73
|
/** The method to be called in order to update ngModel */
|
|
82
74
|
controlValueAccessorChangeFn: (value: any) => void;
|
|
83
75
|
/**
|
|
@@ -128,15 +120,7 @@ export declare class KbqRadioGroup extends KbqRadioGroupMixinBase implements Aft
|
|
|
128
120
|
static ngAcceptInputType_disabled: unknown;
|
|
129
121
|
static ngAcceptInputType_required: unknown;
|
|
130
122
|
}
|
|
131
|
-
|
|
132
|
-
declare abstract class KbqRadioButtonBase {
|
|
133
|
-
elementRef: ElementRef;
|
|
134
|
-
abstract disabled: boolean;
|
|
135
|
-
constructor(elementRef: ElementRef);
|
|
136
|
-
}
|
|
137
|
-
/** @docs-private */
|
|
138
|
-
export declare const KbqRadioButtonMixinBase: CanColorCtor & HasTabIndexCtor & typeof KbqRadioButtonBase;
|
|
139
|
-
export declare class KbqRadioButton extends KbqRadioButtonMixinBase implements OnInit, AfterViewInit, OnDestroy, CanColor, HasTabIndex {
|
|
123
|
+
export declare class KbqRadioButton extends KbqColorDirective implements OnInit, AfterViewInit, OnDestroy {
|
|
140
124
|
private readonly changeDetector;
|
|
141
125
|
private focusMonitor;
|
|
142
126
|
private readonly radioDispatcher;
|
|
@@ -149,8 +133,10 @@ export declare class KbqRadioButton extends KbqRadioButtonMixinBase implements O
|
|
|
149
133
|
/** Whether the radio button is disabled. */
|
|
150
134
|
get disabled(): boolean;
|
|
151
135
|
set disabled(value: boolean);
|
|
152
|
-
/** Whether this radio is disabled. */
|
|
153
136
|
private _disabled;
|
|
137
|
+
get tabIndex(): number;
|
|
138
|
+
set tabIndex(value: number);
|
|
139
|
+
private _tabIndex;
|
|
154
140
|
/** Whether the radio button is required. */
|
|
155
141
|
get required(): boolean;
|
|
156
142
|
set required(value: boolean);
|
|
@@ -182,7 +168,7 @@ export declare class KbqRadioButton extends KbqRadioButtonMixinBase implements O
|
|
|
182
168
|
private _checked;
|
|
183
169
|
/** Value assigned to this radio. */
|
|
184
170
|
private _value;
|
|
185
|
-
constructor(radioGroup: KbqRadioGroup,
|
|
171
|
+
constructor(radioGroup: KbqRadioGroup, changeDetector: ChangeDetectorRef, focusMonitor: FocusMonitor, radioDispatcher: UniqueSelectionDispatcher);
|
|
186
172
|
ngOnInit(): void;
|
|
187
173
|
ngAfterViewInit(): void;
|
|
188
174
|
ngOnDestroy(): void;
|
|
@@ -200,10 +186,10 @@ export declare class KbqRadioButton extends KbqRadioButtonMixinBase implements O
|
|
|
200
186
|
private readonly removeUniqueSelectionListener;
|
|
201
187
|
/** Dispatch change event with current value. */
|
|
202
188
|
private emitChangeEvent;
|
|
203
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<KbqRadioButton, [{ optional: true; }, null, null, null
|
|
204
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<KbqRadioButton, "kbq-radio-button", ["kbqRadioButton"], { "
|
|
189
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<KbqRadioButton, [{ optional: true; }, null, null, null]>;
|
|
190
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<KbqRadioButton, "kbq-radio-button", ["kbqRadioButton"], { "checked": { "alias": "checked"; "required": false; }; "value": { "alias": "value"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "required": { "alias": "required"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "name": { "alias": "name"; "required": false; }; "isFocused": { "alias": "isFocused"; "required": false; }; "id": { "alias": "id"; "required": false; }; }, { "change": "change"; }, never, ["*", "kbq-hint"], false, never>;
|
|
205
191
|
static ngAcceptInputType_checked: unknown;
|
|
206
192
|
static ngAcceptInputType_disabled: unknown;
|
|
193
|
+
static ngAcceptInputType_tabIndex: unknown;
|
|
207
194
|
static ngAcceptInputType_required: unknown;
|
|
208
195
|
}
|
|
209
|
-
export {};
|
|
@@ -21,6 +21,16 @@
|
|
|
21
21
|
"description": "Updates prefixes and names of changed/removed icons",
|
|
22
22
|
"factory": "./migrations/deprecated-icons/index",
|
|
23
23
|
"schema": "./migrations/deprecated-icons/schema.json"
|
|
24
|
+
},
|
|
25
|
+
"empty-state-size-attr": {
|
|
26
|
+
"description": "Updates attr name and value in ts and html",
|
|
27
|
+
"factory": "./migrations/empty-state-size-attr/index",
|
|
28
|
+
"schema": "./migrations/empty-state-size-attr/schema.json"
|
|
29
|
+
},
|
|
30
|
+
"loader-overlay-size-attr": {
|
|
31
|
+
"description": "Updates attr name and value in ts and html",
|
|
32
|
+
"factory": "./migrations/loader-overlay-size-attr/index",
|
|
33
|
+
"schema": "./migrations/loader-overlay-size-attr/schema.json"
|
|
24
34
|
}
|
|
25
35
|
}
|
|
26
36
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
### New Icons Pack schematics
|
|
2
|
+
|
|
3
|
+
This schematic provides migration for css-selectors of typography. It includes:
|
|
4
|
+
|
|
5
|
+
- Update css-classes for updated typography styles according to [mapping](data.ts)
|
|
6
|
+
|
|
7
|
+
[Params](schema.ts)
|
|
8
|
+
|
|
9
|
+
Usage for Angular Cli:
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
ng g @koobiq/components:css-selectors --fix=true --project <your project>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Usage for Nx:
|
|
16
|
+
|
|
17
|
+
```shell
|
|
18
|
+
nx g @koobiq/components:css-selectors --fix=true --project <your project>
|
|
19
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
### New Icons Pack schematics
|
|
2
|
+
|
|
3
|
+
This schematic provides migration for update icons pack. It includes:
|
|
4
|
+
|
|
5
|
+
- Change prefixes from `mc` to `kbq` for ts, html, styles
|
|
6
|
+
- Update icon names for updated/removed icons according to [mapping](data.ts)
|
|
7
|
+
- Fix icons package prefix in styles
|
|
8
|
+
|
|
9
|
+
[Params](schema.ts)
|
|
10
|
+
|
|
11
|
+
Usage for Angular Cli:
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
ng g @koobiq/components:deprecated-icons --fix=true --project <your project>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Usage for Nx:
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
nx g @koobiq/components:deprecated-icons --fix=true --project <your project>
|
|
21
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
### Empty State Size Attr schematics
|
|
2
|
+
|
|
3
|
+
This schematic provides migration for `KbqEmptyState` new `size` attribute. It includes:
|
|
4
|
+
|
|
5
|
+
- Removal of `big` attribute usage
|
|
6
|
+
- Replacement with `size` attribute
|
|
7
|
+
|
|
8
|
+
[Params](schema.ts)
|
|
9
|
+
|
|
10
|
+
Usage for Angular Cli:
|
|
11
|
+
|
|
12
|
+
```shell
|
|
13
|
+
ng g @koobiq/components:empty-state-size-attr --project <your project>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Usage for Nx:
|
|
17
|
+
|
|
18
|
+
```shell
|
|
19
|
+
nx g @koobiq/components:empty-state-size-attr --project <your project>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Run locally
|
|
23
|
+
|
|
24
|
+
Build package
|
|
25
|
+
|
|
26
|
+
```shell
|
|
27
|
+
yarn run build:schematics
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Run command (for example, `koobiq-docs project`)
|
|
31
|
+
|
|
32
|
+
```shell
|
|
33
|
+
ng g ./dist/components/schematics/collection.json:empty-state-size-attr --project koobiq-docs
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Result
|
|
37
|
+
|
|
38
|
+
#### Before
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { Component } from '@angular/core';
|
|
42
|
+
|
|
43
|
+
@Component({
|
|
44
|
+
template: `
|
|
45
|
+
<kbq-empty-state [big]="true">...</kbq-empty-state>
|
|
46
|
+
`
|
|
47
|
+
})
|
|
48
|
+
export class MyComp {}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### After
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { Component } from '@angular/core';
|
|
55
|
+
|
|
56
|
+
@Component({
|
|
57
|
+
template: `
|
|
58
|
+
<kbq-empty-state size="big">...</kbq-empty-state>
|
|
59
|
+
`
|
|
60
|
+
})
|
|
61
|
+
export class MyComp {}
|
|
62
|
+
```
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var node_path = require('node:path');
|
|
6
|
+
var process = require('node:process');
|
|
7
|
+
var ts = require('typescript');
|
|
8
|
+
var utils_angularParsing = require('../../utils/angular-parsing.js');
|
|
9
|
+
var utils_packageConfig = require('../../utils/package-config.js');
|
|
10
|
+
var utils_typescript = require('../../utils/typescript.js');
|
|
11
|
+
require('path');
|
|
12
|
+
require('../../utils/ast.js');
|
|
13
|
+
require('@angular-devkit/schematics');
|
|
14
|
+
require('@schematics/angular/utility');
|
|
15
|
+
require('../../utils/messages.js');
|
|
16
|
+
|
|
17
|
+
function _interopNamespaceDefault(e) {
|
|
18
|
+
var n = Object.create(null);
|
|
19
|
+
if (e) {
|
|
20
|
+
Object.keys(e).forEach(function (k) {
|
|
21
|
+
if (k !== 'default') {
|
|
22
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
23
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return e[k]; }
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
n.default = e;
|
|
31
|
+
return Object.freeze(n);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var process__namespace = /*#__PURE__*/_interopNamespaceDefault(process);
|
|
35
|
+
|
|
36
|
+
const migrationData = {
|
|
37
|
+
elementName: 'kbq-empty-state',
|
|
38
|
+
attrs: {
|
|
39
|
+
key: {
|
|
40
|
+
from: 'big',
|
|
41
|
+
to: 'size'
|
|
42
|
+
},
|
|
43
|
+
value: {
|
|
44
|
+
replacements: [
|
|
45
|
+
{ from: 'true', to: 'big' },
|
|
46
|
+
{ from: 'false', to: 'compact' }
|
|
47
|
+
],
|
|
48
|
+
default: 'normal'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function migrate(options) {
|
|
53
|
+
return async (tree, context) => {
|
|
54
|
+
const { project } = options;
|
|
55
|
+
const { tsPaths, templatePaths, projectDefinition } = await utils_packageConfig.getParsingInfo(project, tree);
|
|
56
|
+
const program = ts.createProgram(Array.from(tsPaths, (item) => node_path.resolve(projectDefinition.root, `.${item}`)), {
|
|
57
|
+
baseUrl: projectDefinition.root,
|
|
58
|
+
rootDir: projectDefinition.root,
|
|
59
|
+
_enableTemplateTypeChecker: true, // Required for the template type checker to work.
|
|
60
|
+
compileNonExportedClasses: true, // We want to migrate non-exported classes too.
|
|
61
|
+
// Avoid checking libraries to speed up the migration.
|
|
62
|
+
skipLibCheck: true,
|
|
63
|
+
skipDefaultLibCheck: true
|
|
64
|
+
});
|
|
65
|
+
// Update external html
|
|
66
|
+
await utils_angularParsing.migrateTemplate(tree, Array.from(templatePaths), context, migrationData);
|
|
67
|
+
// Update inline html
|
|
68
|
+
await utils_angularParsing.migrateTs(tree, program.getSourceFiles().filter((sourceFile) => utils_typescript.canMigrateFile(sourceFile, program)), process__namespace.cwd(), context, migrationData);
|
|
69
|
+
context.logger.warn('Warning! Run linter in updated files since line breaks or indents maybe be broken.');
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
exports.default = migrate;
|
|
74
|
+
exports.migrationData = migrationData;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "koobiq-components-empty-state-size-attr",
|
|
4
|
+
"title": "koobiq-components empty-state-size-attr schematic",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Name of the project",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "projectName"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
### Loader Overlay Size Attr schematics
|
|
2
|
+
|
|
3
|
+
This schematic provides migration for `KbqLoaderOverlay` new `size` attribute. It includes:
|
|
4
|
+
|
|
5
|
+
- Removal of `compact` attribute usage
|
|
6
|
+
- Replacement with `size` attribute
|
|
7
|
+
|
|
8
|
+
[Params](schema.ts)
|
|
9
|
+
|
|
10
|
+
Usage for Angular Cli:
|
|
11
|
+
|
|
12
|
+
```shell
|
|
13
|
+
ng g @koobiq/components:loader-overlay-size-attr --project <your project>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Usage for Nx:
|
|
17
|
+
|
|
18
|
+
```shell
|
|
19
|
+
nx g @koobiq/components:loader-overlay-size-attr --project <your project>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Run locally
|
|
23
|
+
|
|
24
|
+
Build package
|
|
25
|
+
|
|
26
|
+
```shell
|
|
27
|
+
yarn run build:schematics
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Run command (for example, for `koobiq-docs` project)
|
|
31
|
+
|
|
32
|
+
```shell
|
|
33
|
+
ng g ./dist/components/schematics/collection.json:loader-overlay-size-attr --project koobiq-docs
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Result
|
|
37
|
+
|
|
38
|
+
#### Before
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { Component } from '@angular/core';
|
|
42
|
+
|
|
43
|
+
@Component({
|
|
44
|
+
template: `
|
|
45
|
+
<kbq-loader-overlay [compact]="true">...</kbq-loader-overlay>
|
|
46
|
+
`
|
|
47
|
+
})
|
|
48
|
+
export class MyComp {}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### After
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { Component } from '@angular/core';
|
|
55
|
+
|
|
56
|
+
@Component({
|
|
57
|
+
template: `
|
|
58
|
+
<kbq-loader-overlay size="compact">...</kbq-loader-overlay>
|
|
59
|
+
`
|
|
60
|
+
})
|
|
61
|
+
export class MyComp {}
|
|
62
|
+
```
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var node_path = require('node:path');
|
|
6
|
+
var process = require('node:process');
|
|
7
|
+
var ts = require('typescript');
|
|
8
|
+
var utils_angularParsing = require('../../utils/angular-parsing.js');
|
|
9
|
+
var utils_packageConfig = require('../../utils/package-config.js');
|
|
10
|
+
var utils_typescript = require('../../utils/typescript.js');
|
|
11
|
+
require('path');
|
|
12
|
+
require('../../utils/ast.js');
|
|
13
|
+
require('@angular-devkit/schematics');
|
|
14
|
+
require('@schematics/angular/utility');
|
|
15
|
+
require('../../utils/messages.js');
|
|
16
|
+
|
|
17
|
+
function _interopNamespaceDefault(e) {
|
|
18
|
+
var n = Object.create(null);
|
|
19
|
+
if (e) {
|
|
20
|
+
Object.keys(e).forEach(function (k) {
|
|
21
|
+
if (k !== 'default') {
|
|
22
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
23
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return e[k]; }
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
n.default = e;
|
|
31
|
+
return Object.freeze(n);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var process__namespace = /*#__PURE__*/_interopNamespaceDefault(process);
|
|
35
|
+
|
|
36
|
+
const migrationData = {
|
|
37
|
+
elementName: 'kbq-loader-overlay',
|
|
38
|
+
attrs: {
|
|
39
|
+
key: {
|
|
40
|
+
from: 'compact',
|
|
41
|
+
to: 'size'
|
|
42
|
+
},
|
|
43
|
+
value: {
|
|
44
|
+
replacements: [
|
|
45
|
+
{ from: 'true', to: 'compact' },
|
|
46
|
+
{ from: 'false', to: 'big' }
|
|
47
|
+
],
|
|
48
|
+
default: 'big'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function migrate(options) {
|
|
53
|
+
return async (tree, context) => {
|
|
54
|
+
const { project } = options;
|
|
55
|
+
const { tsPaths, templatePaths, projectDefinition } = await utils_packageConfig.getParsingInfo(project, tree);
|
|
56
|
+
const program = ts.createProgram(Array.from(tsPaths, (item) => node_path.resolve(projectDefinition.root, `.${item}`)), {
|
|
57
|
+
baseUrl: projectDefinition.root,
|
|
58
|
+
rootDir: projectDefinition.root,
|
|
59
|
+
_enableTemplateTypeChecker: true, // Required for the template type checker to work.
|
|
60
|
+
compileNonExportedClasses: true, // We want to migrate non-exported classes too.
|
|
61
|
+
// Avoid checking libraries to speed up the migration.
|
|
62
|
+
skipLibCheck: true,
|
|
63
|
+
skipDefaultLibCheck: true
|
|
64
|
+
});
|
|
65
|
+
// Update external html
|
|
66
|
+
await utils_angularParsing.migrateTemplate(tree, Array.from(templatePaths), context, migrationData);
|
|
67
|
+
// Update inline html
|
|
68
|
+
await utils_angularParsing.migrateTs(tree, program.getSourceFiles().filter((sourceFile) => utils_typescript.canMigrateFile(sourceFile, program)), process__namespace.cwd(), context, migrationData);
|
|
69
|
+
context.logger.warn('Warning! Run linter in updated files since line breaks or indents maybe be broken.');
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
exports.default = migrate;
|
|
74
|
+
exports.migrationData = migrationData;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "koobiq-components-loader-overlay-size-attr",
|
|
4
|
+
"title": "koobiq-components loader-overlay-size-attr schematic",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Name of the project",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "projectName"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
### New Icons Pack schematics
|
|
2
|
+
|
|
3
|
+
This schematic provides migration for update icons pack. It includes:
|
|
4
|
+
|
|
5
|
+
- Change prefixes from `mc` to `kbq` for ts, html, styles
|
|
6
|
+
- Update icon names for updated/removed icons according to [mapping](data.ts)
|
|
7
|
+
- Fix icons package prefix in styles
|
|
8
|
+
|
|
9
|
+
[Params](schema.ts)
|
|
10
|
+
|
|
11
|
+
Usage for Angular Cli:
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
ng g @koobiq/components:new-icons-pack --fix=true --project <your project>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Usage for Nx:
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
nx g @koobiq/components:new-icons-pack --fix=true --project <your project>
|
|
21
|
+
```
|
|
@@ -27,11 +27,11 @@ function ngAdd(options) {
|
|
|
27
27
|
}
|
|
28
28
|
// Installing dependencies
|
|
29
29
|
utils_packageConfig.addPackageToPackageJson(tree, '@angular/cdk', "^18.2.6");
|
|
30
|
-
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/cdk', "^18.
|
|
31
|
-
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/angular-luxon-adapter', "^18.
|
|
30
|
+
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/cdk', "^18.22.0");
|
|
31
|
+
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/angular-luxon-adapter', "^18.22.0");
|
|
32
32
|
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/date-formatter', "^3.2.3");
|
|
33
33
|
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/date-adapter', "^3.2.3");
|
|
34
|
-
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/icons', "^9.
|
|
34
|
+
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/icons', "^9.4.0");
|
|
35
35
|
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/tokens-builder', "^3.11.0");
|
|
36
36
|
utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/design-tokens', "^3.12.1");
|
|
37
37
|
utils_packageConfig.addPackageToPackageJson(tree, '@messageformat/core', "^3.0.1");
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var path = require('path');
|
|
4
|
+
var ts = require('typescript');
|
|
5
|
+
var utils_ast = require('./ast.js');
|
|
6
|
+
var utils_typescript = require('./typescript.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Update separate html file
|
|
10
|
+
* @param tree
|
|
11
|
+
* @param filePaths
|
|
12
|
+
* @param context
|
|
13
|
+
* @param migrationData
|
|
14
|
+
*/
|
|
15
|
+
async function migrateTemplate(tree, filePaths, context, migrationData) {
|
|
16
|
+
for (const templatePath of filePaths) {
|
|
17
|
+
const parsedFilePath = `.${templatePath}`;
|
|
18
|
+
let res = Promise.resolve({
|
|
19
|
+
fileContent: '',
|
|
20
|
+
changed: false,
|
|
21
|
+
errors: []
|
|
22
|
+
});
|
|
23
|
+
const template = tree.read(parsedFilePath)?.toString();
|
|
24
|
+
if (!template) {
|
|
25
|
+
context.logger.error(`Cannot read "${parsedFilePath}" because it does not exist.`);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
res = transformTemplateAttributes(template, parsedFilePath, migrationData);
|
|
29
|
+
const { fileContent, changed, errors } = await res;
|
|
30
|
+
if (changed) {
|
|
31
|
+
tree.overwrite(templatePath, fileContent);
|
|
32
|
+
}
|
|
33
|
+
if (errors.length > 0) {
|
|
34
|
+
context.logger.error(errors.map(({ error }) => error.toString()).join('\n'));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Update typescript file if classes with @Component decorator and `template` property exists
|
|
40
|
+
* @param tree
|
|
41
|
+
* @param sourceFiles
|
|
42
|
+
* @param basePath
|
|
43
|
+
* @param context
|
|
44
|
+
* @param migrationData
|
|
45
|
+
*/
|
|
46
|
+
async function migrateTs(tree, sourceFiles, basePath, context, migrationData) {
|
|
47
|
+
// run and track changed components
|
|
48
|
+
const analysis = new Map();
|
|
49
|
+
for (const sourceFile of sourceFiles) {
|
|
50
|
+
utils_typescript.forEachClass(sourceFile, (node) => {
|
|
51
|
+
analyzeDecorators(node, sourceFile, analysis);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// update source file
|
|
55
|
+
for (const path$1 of analysis.keys()) {
|
|
56
|
+
const file = analysis.get(path$1);
|
|
57
|
+
const ranges = file.getSortedRanges();
|
|
58
|
+
const relativePath = path.relative(basePath, path$1);
|
|
59
|
+
const content = tree.readText(relativePath);
|
|
60
|
+
const update = tree.beginUpdate(relativePath);
|
|
61
|
+
for (const { start, end } of ranges) {
|
|
62
|
+
const template = content.slice(start, end);
|
|
63
|
+
const length = (end ?? content.length) - start;
|
|
64
|
+
const { fileContent, changed, errors } = await transformTemplateAttributes(template, relativePath, migrationData);
|
|
65
|
+
if (changed) {
|
|
66
|
+
update.remove(start, length);
|
|
67
|
+
update.insertLeft(start, fileContent);
|
|
68
|
+
}
|
|
69
|
+
if (errors.length > 0) {
|
|
70
|
+
context.logger.error(errors.map(({ error }) => error.toString()).join('\n'));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
tree.commitUpdate(update);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Analyzes the decorators of a given class declaration to find and save
|
|
78
|
+
* inline `template` metadata within `@Component` decorators.
|
|
79
|
+
*/
|
|
80
|
+
function analyzeDecorators(node, sourceFile, analyzedFiles) {
|
|
81
|
+
const decorator = ts.getDecorators(node)?.find((dec) => {
|
|
82
|
+
return (ts.isCallExpression(dec.expression) &&
|
|
83
|
+
ts.isIdentifier(dec.expression.expression) &&
|
|
84
|
+
dec.expression?.expression?.text === 'Component');
|
|
85
|
+
});
|
|
86
|
+
const metadata = decorator &&
|
|
87
|
+
decorator.expression.arguments.length > 0 &&
|
|
88
|
+
ts.isObjectLiteralExpression(decorator.expression.arguments[0])
|
|
89
|
+
? decorator.expression.arguments[0]
|
|
90
|
+
: null;
|
|
91
|
+
// Exit early if there's no metadata or it's not an object literal
|
|
92
|
+
if (!metadata) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
for (const prop of metadata.properties) {
|
|
96
|
+
// All the properties we care about should have static
|
|
97
|
+
// names and be initialized to a static string.
|
|
98
|
+
if (!ts.isPropertyAssignment(prop) || (!ts.isIdentifier(prop.name) && !ts.isStringLiteralLike(prop.name))) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
// check decorator 'template' property, check for text content parse
|
|
102
|
+
if (prop.name.text === 'template' && ts.isStringLiteralLike(prop.initializer) && prop.initializer.text) {
|
|
103
|
+
// +1/-1 to exclude the opening/closing characters from the range.
|
|
104
|
+
utils_typescript.AnalyzedFile.addRange(sourceFile.fileName, sourceFile, analyzedFiles, {
|
|
105
|
+
start: prop.initializer.getStart(sourceFile) + 1,
|
|
106
|
+
end: prop.initializer.getEnd() - 1,
|
|
107
|
+
node: prop,
|
|
108
|
+
type: 'template',
|
|
109
|
+
remove: true
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Migrates attribute values in an Angular template based on predefined cases.
|
|
116
|
+
*/
|
|
117
|
+
async function transformTemplateAttributes(template, fileName, migrationData) {
|
|
118
|
+
const parsed = await utils_typescript.parseTemplate(template);
|
|
119
|
+
let updatedTemplate = template;
|
|
120
|
+
// extra text offset as result of text replacement;
|
|
121
|
+
let offset = 0;
|
|
122
|
+
if (parsed.tree !== undefined) {
|
|
123
|
+
const visitor = new utils_typescript.ElementCollector(migrationData, fileName);
|
|
124
|
+
utils_ast.visitAll(visitor, parsed.tree.rootNodes);
|
|
125
|
+
for (const el of visitor.elementsToMigrate) {
|
|
126
|
+
const migrationAttr = el.attrs.find((attr) => utils_ast.getSimpleAttributeName(attr.name) === migrationData.attrs.key.from);
|
|
127
|
+
let updatedAttrValue;
|
|
128
|
+
if (migrationAttr) {
|
|
129
|
+
const cleanAttrValue = utils_ast.getSimpleAttributeValue(migrationAttr.value);
|
|
130
|
+
const replacement = migrationData.attrs.value.replacements.find(({ from }) => from === cleanAttrValue);
|
|
131
|
+
if (replacement) {
|
|
132
|
+
updatedAttrValue = replacement.to;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
console.warn(`Element is using dynamic value. Check the code and change value on your own.${(fileName && ' File: ' + fileName) || ''}`);
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
updatedTemplate =
|
|
139
|
+
updatedTemplate.slice(0, migrationAttr.keySpan.start.offset - offset) +
|
|
140
|
+
`${migrationData.attrs.key.to}="${updatedAttrValue}"` +
|
|
141
|
+
updatedTemplate.slice(migrationAttr.valueSpan.end.offset + 1 - offset, updatedTemplate.length);
|
|
142
|
+
offset += migrationAttr.name.length - migrationData.attrs.key.to.length;
|
|
143
|
+
offset += migrationAttr.value.length - updatedAttrValue.length;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return { fileContent: updatedTemplate, changed: visitor.elementsToMigrate.length > 0, errors: parsed.errors };
|
|
147
|
+
}
|
|
148
|
+
return { fileContent: updatedTemplate, changed: undefined, errors: parsed.errors };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
exports.analyzeDecorators = analyzeDecorators;
|
|
152
|
+
exports.migrateTemplate = migrateTemplate;
|
|
153
|
+
exports.migrateTs = migrateTs;
|