@taiga-ui/cdk 3.11.0 → 3.12.1
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/abstract/dialog.service.d.ts +1 -1
- package/bundles/taiga-ui-cdk-abstract.umd.js +1 -1
- package/bundles/taiga-ui-cdk-abstract.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-coercion.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-components-alert-host.umd.js +1 -1
- package/bundles/taiga-ui-cdk-components-alert-host.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-constants.umd.js +1 -1
- package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-date-time.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-auto-focus.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-checked.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-droppable.umd.js +3 -1
- package/bundles/taiga-ui-cdk-directives-droppable.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-element.umd.js +18 -332
- package/bundles/taiga-ui-cdk-directives-element.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-for-async.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.js +3 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-prevent-default.umd.js +3 -1
- package/bundles/taiga-ui-cdk-directives-prevent-default.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-observables.umd.js +16 -16
- package/bundles/taiga-ui-cdk-observables.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-services.umd.js +9 -3
- package/bundles/taiga-ui-cdk-services.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-dom.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-focus.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-math.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-svg.umd.js +5 -2
- package/bundles/taiga-ui-cdk-utils-svg.umd.js.map +1 -1
- package/coercion/coerce-boolean-property.d.ts +1 -1
- package/constants/version.d.ts +1 -1
- package/constants/version.js +1 -1
- package/date-time/time.d.ts +1 -1
- package/date-time/year.d.ts +1 -1
- package/directives/auto-focus/autofocus.directive.d.ts +1 -1
- package/directives/checked/checked.directive.d.ts +1 -1
- package/directives/droppable/droppable.directive.d.ts +1 -1
- package/directives/element/element.directive.d.ts +2 -1
- package/directives/for-async/for-async.directive.d.ts +1 -1
- package/directives/overscroll/overscroll.directive.d.ts +1 -1
- package/directives/prevent-default/prevent-default.directive.d.ts +1 -1
- package/esm2015/abstract/dialog.directive.js +3 -3
- package/esm2015/abstract/dialog.service.js +1 -1
- package/esm2015/coercion/coerce-boolean-property.js +1 -1
- package/esm2015/components/alert-host/alert-host.component.js +2 -2
- package/esm2015/constants/version.js +2 -2
- package/esm2015/date-time/time.js +1 -1
- package/esm2015/date-time/year.js +1 -1
- package/esm2015/directives/auto-focus/autofocus.directive.js +1 -1
- package/esm2015/directives/checked/checked.directive.js +1 -1
- package/esm2015/directives/droppable/droppable.directive.js +5 -3
- package/esm2015/directives/element/element.directive.js +18 -4
- package/esm2015/directives/for-async/for-async.directive.js +1 -1
- package/esm2015/directives/overscroll/overscroll.directive.js +5 -3
- package/esm2015/directives/prevent-default/prevent-default.directive.js +5 -3
- package/esm2015/interfaces/alert-context.js +1 -1
- package/esm2015/interfaces/swipe.js +1 -1
- package/esm2015/interfaces/zoom.js +1 -1
- package/esm2015/observables/control-value.js +15 -0
- package/esm2015/observables/index.js +2 -2
- package/esm2015/observables/must-be-present.js +1 -1
- package/esm2015/services/focus-visible.service.js +5 -3
- package/esm2015/services/obscured.service.js +4 -2
- package/esm2015/services/resize.service.js +5 -3
- package/esm2015/types/autocomplete.js +1 -1
- package/esm2015/types/dialog.js +1 -1
- package/esm2015/types/event-with.js +1 -1
- package/esm2015/types/input-mode.js +1 -1
- package/esm2015/types/input-type.js +1 -1
- package/esm2015/types/overscroll-mode.js +1 -1
- package/esm2015/types/time-mode.js +1 -1
- package/esm2015/utils/dom/element-checks.js +1 -1
- package/esm2015/utils/focus/set-native-mouse-focused.js +1 -1
- package/esm2015/utils/math/to-int.js +1 -1
- package/esm2015/utils/svg/svg-linear-gradient-processor.js +6 -3
- package/fesm2015/taiga-ui-cdk-abstract.js +2 -2
- package/fesm2015/taiga-ui-cdk-abstract.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-coercion.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-components-alert-host.js +1 -1
- package/fesm2015/taiga-ui-cdk-components-alert-host.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-constants.js +1 -1
- package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-date-time.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-auto-focus.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-checked.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-droppable.js +4 -2
- package/fesm2015/taiga-ui-cdk-directives-droppable.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-element.js +17 -3
- package/fesm2015/taiga-ui-cdk-directives-element.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-for-async.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-overscroll.js +4 -2
- package/fesm2015/taiga-ui-cdk-directives-overscroll.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-prevent-default.js +4 -2
- package/fesm2015/taiga-ui-cdk-directives-prevent-default.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-observables.js +15 -15
- package/fesm2015/taiga-ui-cdk-observables.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-services.js +10 -4
- package/fesm2015/taiga-ui-cdk-services.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-dom.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-focus.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-math.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-svg.js +5 -2
- package/fesm2015/taiga-ui-cdk-utils-svg.js.map +1 -1
- package/interfaces/alert-context.d.ts +1 -1
- package/interfaces/swipe.d.ts +1 -1
- package/interfaces/zoom.d.ts +1 -1
- package/observables/{replay-control-value-changes.d.ts → control-value.d.ts} +0 -0
- package/observables/index.d.ts +1 -1
- package/observables/must-be-present.d.ts +1 -1
- package/package.json +5 -5
- package/schematics/constants/file-globs.js +2 -2
- package/schematics/constants/taiga-styles.js +4 -4
- package/schematics/ng-add/constants/modules.d.ts +4 -4
- package/schematics/ng-add/constants/modules.js +12 -12
- package/schematics/ng-add/constants/packages.js +1 -1
- package/schematics/ng-add/constants/versions.js +3 -3
- package/schematics/ng-add/index.d.ts +2 -2
- package/schematics/ng-add/index.js +11 -12
- package/schematics/ng-add/schema.d.ts +9 -2
- package/schematics/ng-add/schema.json +1 -1
- package/schematics/ng-add/setup-project.d.ts +2 -2
- package/schematics/ng-add/steps/add-taiga-icons.d.ts +3 -3
- package/schematics/ng-add/steps/add-taiga-icons.js +8 -9
- package/schematics/ng-add/steps/add-taiga-modules.d.ts +2 -2
- package/schematics/ng-add/steps/add-taiga-modules.js +7 -7
- package/schematics/ng-add/steps/add-taiga-styles.d.ts +2 -2
- package/schematics/ng-add/steps/add-taiga-styles.js +3 -4
- package/schematics/ng-add/steps/wrap-with-tui-root.d.ts +2 -2
- package/schematics/ng-add/steps/wrap-with-tui-root.js +14 -14
- package/schematics/ng-update/constants/consts.d.ts +1 -1
- package/schematics/ng-update/constants/consts.js +177 -177
- package/schematics/ng-update/constants/deprecated-functions.js +410 -405
- package/schematics/ng-update/constants/enums.js +123 -123
- package/schematics/ng-update/constants/modules.js +4 -4
- package/schematics/ng-update/constants/services.d.ts +2 -2
- package/schematics/ng-update/constants/services.js +16 -16
- package/schematics/ng-update/constants/templates.d.ts +1 -1
- package/schematics/ng-update/constants/templates.js +276 -276
- package/schematics/ng-update/constants/tui-interactive-selectors.js +50 -50
- package/schematics/ng-update/constants/types.d.ts +1 -1
- package/schematics/ng-update/constants/types.js +87 -87
- package/schematics/ng-update/constants/warnings.js +62 -62
- package/schematics/ng-update/index.d.ts +3 -3
- package/schematics/ng-update/index.js +44 -40
- package/schematics/ng-update/interfaces/asset.d.ts +6 -0
- package/schematics/ng-update/interfaces/asset.js +2 -0
- package/schematics/ng-update/steps/migrate-date-time.d.ts +2 -1
- package/schematics/ng-update/steps/migrate-date-time.js +55 -49
- package/schematics/ng-update/steps/migrate-polymorpheus.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-polymorpheus.js +14 -14
- package/schematics/ng-update/steps/migrate-progress.d.ts +2 -1
- package/schematics/ng-update/steps/migrate-progress.js +16 -12
- package/schematics/ng-update/steps/migrate-sliders/index.d.ts +2 -1
- package/schematics/ng-update/steps/migrate-sliders/index.js +13 -9
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.d.ts +2 -1
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.js +35 -33
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.d.ts +2 -1
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.js +34 -33
- package/schematics/ng-update/steps/migrate-taiga-proprietary-icons.d.ts +2 -2
- package/schematics/ng-update/steps/migrate-taiga-proprietary-icons.js +29 -27
- package/schematics/ng-update/steps/migrate-templates.d.ts +2 -1
- package/schematics/ng-update/steps/migrate-templates.js +36 -32
- package/schematics/ng-update/steps/migrate-textfield-controller.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-textfield-controller.js +34 -34
- package/schematics/ng-update/steps/miscellaneous.d.ts +2 -1
- package/schematics/ng-update/steps/miscellaneous.js +21 -19
- package/schematics/ng-update/steps/remove-module.d.ts +2 -1
- package/schematics/ng-update/steps/remove-module.js +6 -4
- package/schematics/ng-update/steps/rename-types.d.ts +2 -1
- package/schematics/ng-update/steps/rename-types.js +10 -8
- package/schematics/ng-update/steps/replace-const.d.ts +2 -1
- package/schematics/ng-update/steps/replace-const.js +8 -6
- package/schematics/ng-update/steps/replace-deep-import.d.ts +2 -1
- package/schematics/ng-update/steps/replace-deep-import.js +10 -5
- package/schematics/ng-update/steps/replace-enums.d.ts +2 -1
- package/schematics/ng-update/steps/replace-enums.js +8 -6
- package/schematics/ng-update/steps/replace-functions.d.ts +2 -1
- package/schematics/ng-update/steps/replace-functions.js +17 -15
- package/schematics/ng-update/steps/replace-services.d.ts +2 -1
- package/schematics/ng-update/steps/replace-services.js +13 -11
- package/schematics/ng-update/steps/replace-styles.js +7 -5
- package/schematics/ng-update/steps/show-warnings.js +2 -2
- package/schematics/ng-update/v3-5/steps/migrate-expand-templates.d.ts +2 -1
- package/schematics/ng-update/v3-5/steps/migrate-expand-templates.js +12 -10
- package/schematics/utils/add-import-to-closest-module.js +2 -2
- package/schematics/utils/add-unique-import.js +1 -1
- package/schematics/utils/angular/ng-component.js +1 -1
- package/schematics/utils/angular/ng-module.js +1 -1
- package/schematics/utils/angular-json-manipulations.d.ts +3 -3
- package/schematics/utils/angular-json-manipulations.js +52 -37
- package/schematics/utils/colored-log.js +5 -5
- package/schematics/utils/create-angular-json.d.ts +1 -0
- package/schematics/utils/create-angular-json.js +28 -2
- package/schematics/utils/get-named-import-references.d.ts +1 -1
- package/schematics/utils/get-named-import-references.js +2 -2
- package/schematics/utils/get-project-target-options.d.ts +1 -1
- package/schematics/utils/get-project-target-options.js +1 -1
- package/schematics/utils/get-projects.d.ts +3 -0
- package/schematics/utils/get-projects.js +15 -0
- package/schematics/utils/progress.js +2 -2
- package/schematics/utils/replace-tag.d.ts +1 -1
- package/schematics/utils/replace-tag.js +4 -4
- package/schematics/utils/templates/elements.js +4 -4
- package/schematics/utils/templates/get-component-templates.js +6 -6
- package/schematics/utils/templates/ng-component-input-manipulations.d.ts +4 -4
- package/schematics/utils/templates/ng-component-input-manipulations.js +7 -7
- package/schematics/utils/templates/template-resource.d.ts +1 -1
- package/schematics/utils/templates/template-resource.js +3 -3
- package/services/focus-visible.service.d.ts +1 -1
- package/services/obscured.service.d.ts +2 -2
- package/services/resize.service.d.ts +1 -1
- package/types/autocomplete.d.ts +1 -1
- package/types/dialog.d.ts +2 -2
- package/types/event-with.d.ts +2 -2
- package/types/input-mode.d.ts +1 -1
- package/types/input-type.d.ts +1 -1
- package/types/overscroll-mode.d.ts +1 -1
- package/types/time-mode.d.ts +1 -1
- package/utils/dom/element-checks.d.ts +1 -1
- package/utils/focus/set-native-mouse-focused.d.ts +1 -1
- package/utils/math/to-int.d.ts +1 -1
- package/utils/svg/svg-linear-gradient-processor.d.ts +2 -1
- package/esm2015/observables/replay-control-value-changes.js +0 -15
- package/schematics/ng-update/constants/functions.d.ts +0 -0
- package/schematics/ng-update/constants/functions.js +0 -1
- package/schematics/utils/get-project.d.ts +0 -3
- package/schematics/utils/get-project.js +0 -13
|
@@ -1,55 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.migrateInputRange = void 0;
|
|
4
|
-
const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
|
|
5
|
-
const ng_component_input_manipulations_1 = require("../../../utils/templates/ng-component-input-manipulations");
|
|
6
4
|
const ng_morph_1 = require("ng-morph");
|
|
7
|
-
const ng_component_1 = require("../../../utils/angular/ng-component");
|
|
8
|
-
const add_unique_import_1 = require("../../../utils/add-unique-import");
|
|
9
5
|
const constants_1 = require("../../../constants");
|
|
6
|
+
const add_unique_import_1 = require("../../../utils/add-unique-import");
|
|
7
|
+
const ng_component_1 = require("../../../utils/angular/ng-component");
|
|
10
8
|
const progress_1 = require("../../../utils/progress");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
9
|
+
const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
|
|
10
|
+
const ng_component_input_manipulations_1 = require("../../../utils/templates/ng-component-input-manipulations");
|
|
11
|
+
const MIN_LABELS_MIGRATION_METHOD_NAME = `tuiMigrationInputRangeMinLabel`;
|
|
12
|
+
const MAX_LABELS_MIGRATION_METHOD_NAME = `tuiMigrationInputRangeMaxLabel`;
|
|
13
|
+
function migrateInputRange(fileSystem, options) {
|
|
14
14
|
const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
15
16
|
const COMPONENTS_WITH_MIN_LABELS = new Set();
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
18
|
const COMPONENTS_WITH_MAX_LABELS = new Set();
|
|
17
19
|
let progressLog = progress_1.setupProgressLogger({
|
|
18
20
|
total: templateResources.length,
|
|
19
|
-
prefix:
|
|
21
|
+
prefix: `[replaceMinMaxLabel]`,
|
|
20
22
|
});
|
|
21
23
|
for (const templateResource of templateResources) {
|
|
22
|
-
progressLog(templateResource.componentPath);
|
|
24
|
+
!options[`skip-logs`] && progressLog(templateResource.componentPath);
|
|
23
25
|
replaceMinLabel(templateResource, fileSystem, COMPONENTS_WITH_MIN_LABELS);
|
|
24
26
|
replaceMaxLabel(templateResource, fileSystem, COMPONENTS_WITH_MAX_LABELS);
|
|
25
27
|
}
|
|
26
28
|
save(fileSystem);
|
|
27
29
|
progressLog = progress_1.setupProgressLogger({
|
|
28
30
|
total: COMPONENTS_WITH_MIN_LABELS.size,
|
|
29
|
-
prefix:
|
|
31
|
+
prefix: `[COMPONENTS_WITH_MIN_LABELS]`,
|
|
30
32
|
});
|
|
31
33
|
for (const componentPath of Array.from(COMPONENTS_WITH_MIN_LABELS)) {
|
|
32
|
-
progressLog(componentPath);
|
|
34
|
+
!options[`skip-logs`] && progressLog(componentPath);
|
|
33
35
|
addMinMaxLabelMethod(componentPath, MIN_LABELS_MIGRATION_METHOD_NAME, [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
`const currentValue = context.$implicit;`,
|
|
37
|
+
`const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input-range`,
|
|
38
|
+
`const minLabelText = "Min"; // TODO: (Taiga UI migration) replace with the required label`,
|
|
39
|
+
`if (currentValue === minValue) return minLabelText;`,
|
|
40
|
+
`return String(currentValue);`,
|
|
39
41
|
]);
|
|
40
42
|
}
|
|
41
43
|
progressLog = progress_1.setupProgressLogger({
|
|
42
44
|
total: COMPONENTS_WITH_MAX_LABELS.size,
|
|
43
|
-
prefix:
|
|
45
|
+
prefix: `[COMPONENTS_WITH_MAX_LABELS]`,
|
|
44
46
|
});
|
|
45
47
|
for (const componentPath of Array.from(COMPONENTS_WITH_MAX_LABELS)) {
|
|
46
|
-
progressLog(componentPath);
|
|
48
|
+
!options[`skip-logs`] && progressLog(componentPath);
|
|
47
49
|
addMinMaxLabelMethod(componentPath, MAX_LABELS_MIGRATION_METHOD_NAME, [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
`const currentValue = context.$implicit;`,
|
|
51
|
+
`const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input`,
|
|
52
|
+
`const maxLabelText = "Max"; // TODO: (Taiga UI migration) replace with the required label`,
|
|
53
|
+
`if (currentValue === maxValue) return maxLabelText;`,
|
|
54
|
+
`return String(currentValue);`,
|
|
53
55
|
]);
|
|
54
56
|
}
|
|
55
57
|
}
|
|
@@ -58,9 +60,9 @@ function replaceMinLabel(templateResource, fileSystem, modifiedComponentStorage)
|
|
|
58
60
|
const wasModified = ng_component_input_manipulations_1.replaceInputProperty({
|
|
59
61
|
templateResource,
|
|
60
62
|
fileSystem,
|
|
61
|
-
componentSelector:
|
|
62
|
-
from:
|
|
63
|
-
to:
|
|
63
|
+
componentSelector: `tui-input-range`,
|
|
64
|
+
from: `minLabel`,
|
|
65
|
+
to: `[leftValueContent]`,
|
|
64
66
|
newValue: MIN_LABELS_MIGRATION_METHOD_NAME,
|
|
65
67
|
});
|
|
66
68
|
if (wasModified) {
|
|
@@ -71,9 +73,9 @@ function replaceMaxLabel(templateResource, fileSystem, modifiedComponentStorage)
|
|
|
71
73
|
const wasModified = ng_component_input_manipulations_1.replaceInputProperty({
|
|
72
74
|
templateResource,
|
|
73
75
|
fileSystem,
|
|
74
|
-
componentSelector:
|
|
75
|
-
from:
|
|
76
|
-
to:
|
|
76
|
+
componentSelector: `tui-input-range`,
|
|
77
|
+
from: `maxLabel`,
|
|
78
|
+
to: `[rightValueContent]`,
|
|
77
79
|
newValue: MAX_LABELS_MIGRATION_METHOD_NAME,
|
|
78
80
|
});
|
|
79
81
|
if (wasModified) {
|
|
@@ -83,11 +85,11 @@ function replaceMaxLabel(templateResource, fileSystem, modifiedComponentStorage)
|
|
|
83
85
|
function addMinMaxLabelMethod(componentPath, methodName, methodCode) {
|
|
84
86
|
const [ngComponent] = ng_component_1.getNgComponents(componentPath);
|
|
85
87
|
if (ngComponent) {
|
|
86
|
-
add_unique_import_1.addUniqueImport(ngComponent.getSourceFile().getFilePath(),
|
|
88
|
+
add_unique_import_1.addUniqueImport(ngComponent.getSourceFile().getFilePath(), `TuiContextWithImplicit`, `@taiga-ui/cdk`);
|
|
87
89
|
ng_morph_1.addMethods(ngComponent, {
|
|
88
90
|
name: methodName,
|
|
89
|
-
returnType:
|
|
90
|
-
parameters: [{ name:
|
|
91
|
+
returnType: `string`,
|
|
92
|
+
parameters: [{ name: `context`, type: `TuiContextWithImplicit<number>` }],
|
|
91
93
|
statements: methodCode,
|
|
92
94
|
});
|
|
93
95
|
}
|
|
@@ -99,5 +101,5 @@ function addMinMaxLabelMethod(componentPath, methodName, methodCode) {
|
|
|
99
101
|
function save(fileSystem) {
|
|
100
102
|
fileSystem.commitEdits();
|
|
101
103
|
ng_morph_1.saveActiveProject();
|
|
102
|
-
ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree,
|
|
104
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, `/`, constants_1.ALL_FILES));
|
|
103
105
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { DevkitFileSystem } from 'ng-morph';
|
|
2
|
-
|
|
2
|
+
import { TuiSchema } from '../../../ng-add/schema';
|
|
3
|
+
export declare function migrateInputSlider(fileSystem: DevkitFileSystem, options: TuiSchema): void;
|
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.migrateInputSlider = void 0;
|
|
4
4
|
const ng_morph_1 = require("ng-morph");
|
|
5
|
-
const ng_component_input_manipulations_1 = require("../../../utils/templates/ng-component-input-manipulations");
|
|
6
|
-
const ng_component_1 = require("../../../utils/angular/ng-component");
|
|
7
|
-
const add_unique_import_1 = require("../../../utils/add-unique-import");
|
|
8
|
-
const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
|
|
9
|
-
const elements_1 = require("../../../utils/templates/elements");
|
|
10
5
|
const constants_1 = require("../../../constants");
|
|
6
|
+
const add_unique_import_1 = require("../../../utils/add-unique-import");
|
|
7
|
+
const ng_component_1 = require("../../../utils/angular/ng-component");
|
|
11
8
|
const progress_1 = require("../../../utils/progress");
|
|
12
|
-
|
|
9
|
+
const elements_1 = require("../../../utils/templates/elements");
|
|
10
|
+
const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
|
|
11
|
+
const ng_component_input_manipulations_1 = require("../../../utils/templates/ng-component-input-manipulations");
|
|
12
|
+
function migrateInputSlider(fileSystem, options) {
|
|
13
13
|
const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
14
15
|
const COMPONENTS_WITH_MIN_MAX_LABELS = new Set();
|
|
15
16
|
let progressLog = progress_1.setupProgressLogger({
|
|
16
17
|
total: templateResources.length,
|
|
17
|
-
prefix:
|
|
18
|
+
prefix: `[replaceMinMaxLabels]`,
|
|
18
19
|
});
|
|
19
20
|
for (const templateResource of templateResources) {
|
|
20
|
-
progressLog(templateResource.componentPath);
|
|
21
|
+
!options[`skip-logs`] && progressLog(templateResource.componentPath);
|
|
21
22
|
replaceMinMaxLabels(templateResource, fileSystem, COMPONENTS_WITH_MIN_MAX_LABELS);
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
@@ -26,42 +27,42 @@ function migrateInputSlider(fileSystem) {
|
|
|
26
27
|
* */
|
|
27
28
|
fileSystem.commitEdits();
|
|
28
29
|
ng_morph_1.saveActiveProject();
|
|
29
|
-
ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree,
|
|
30
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, `/`, constants_1.ALL_FILES));
|
|
30
31
|
progressLog = progress_1.setupProgressLogger({
|
|
31
32
|
total: COMPONENTS_WITH_MIN_MAX_LABELS.size,
|
|
32
|
-
prefix:
|
|
33
|
+
prefix: `[addMinMaxLabelMethod]`,
|
|
33
34
|
});
|
|
34
35
|
for (const componentPath of Array.from(COMPONENTS_WITH_MIN_MAX_LABELS)) {
|
|
35
|
-
progressLog(componentPath);
|
|
36
|
+
!options[`skip-logs`] && progressLog(componentPath);
|
|
36
37
|
addMinMaxLabelMethod(componentPath);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
exports.migrateInputSlider = migrateInputSlider;
|
|
40
|
-
const MIN_MAX_LABELS_MIGRATION_METHOD_NAME =
|
|
41
|
+
const MIN_MAX_LABELS_MIGRATION_METHOD_NAME = `tuiMigrationMinMaxLabel`;
|
|
41
42
|
function replaceMinMaxLabels(templateResource, fileSystem, modifiedComponentStorage) {
|
|
42
43
|
const wasMaxLabelModified = ng_component_input_manipulations_1.replaceInputProperty({
|
|
43
44
|
templateResource,
|
|
44
45
|
fileSystem,
|
|
45
|
-
componentSelector:
|
|
46
|
-
from:
|
|
47
|
-
to:
|
|
46
|
+
componentSelector: `tui-input-slider`,
|
|
47
|
+
from: `maxLabel`,
|
|
48
|
+
to: `[valueContent]`,
|
|
48
49
|
newValue: MIN_MAX_LABELS_MIGRATION_METHOD_NAME,
|
|
49
50
|
});
|
|
50
51
|
const wasMinLabelModified = ng_component_input_manipulations_1.replaceInputProperty({
|
|
51
52
|
templateResource,
|
|
52
53
|
fileSystem,
|
|
53
|
-
componentSelector:
|
|
54
|
-
from:
|
|
55
|
-
to:
|
|
54
|
+
componentSelector: `tui-input-slider`,
|
|
55
|
+
from: `minLabel`,
|
|
56
|
+
to: `[valueContent]`,
|
|
56
57
|
newValue: MIN_MAX_LABELS_MIGRATION_METHOD_NAME,
|
|
57
|
-
filterFn: element => !elements_1.hasElementAttribute(element,
|
|
58
|
+
filterFn: element => !elements_1.hasElementAttribute(element, `maxLabel`),
|
|
58
59
|
});
|
|
59
60
|
ng_component_input_manipulations_1.removeInputProperty({
|
|
60
61
|
templateResource,
|
|
61
62
|
fileSystem,
|
|
62
|
-
componentSelector:
|
|
63
|
-
inputProperty:
|
|
64
|
-
filterFn: element => elements_1.hasElementAttribute(element,
|
|
63
|
+
componentSelector: `tui-input-slider`,
|
|
64
|
+
inputProperty: `minLabel`,
|
|
65
|
+
filterFn: element => elements_1.hasElementAttribute(element, `maxLabel`),
|
|
65
66
|
});
|
|
66
67
|
if (wasMaxLabelModified || wasMinLabelModified) {
|
|
67
68
|
modifiedComponentStorage.add(templateResource.componentPath);
|
|
@@ -70,20 +71,20 @@ function replaceMinMaxLabels(templateResource, fileSystem, modifiedComponentStor
|
|
|
70
71
|
function addMinMaxLabelMethod(componentPath) {
|
|
71
72
|
const [ngComponent] = ng_component_1.getNgComponents(componentPath);
|
|
72
73
|
if (ngComponent) {
|
|
73
|
-
add_unique_import_1.addUniqueImport(componentPath,
|
|
74
|
+
add_unique_import_1.addUniqueImport(componentPath, `TuiContextWithImplicit`, `@taiga-ui/cdk`);
|
|
74
75
|
ng_morph_1.addMethods(ngComponent, {
|
|
75
76
|
name: MIN_MAX_LABELS_MIGRATION_METHOD_NAME,
|
|
76
|
-
returnType:
|
|
77
|
-
parameters: [{ name:
|
|
77
|
+
returnType: `string`,
|
|
78
|
+
parameters: [{ name: `context`, type: `TuiContextWithImplicit<number>` }],
|
|
78
79
|
statements: [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
`const currentValue = context.$implicit;`,
|
|
81
|
+
`const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input`,
|
|
82
|
+
`const maxLabelText = "Max"; // TODO: (Taiga UI migration) replace with the required label`,
|
|
83
|
+
`const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input`,
|
|
84
|
+
`const minLabelText = "Min"; // TODO: (Taiga UI migration) replace with the required label`,
|
|
85
|
+
`if (currentValue === maxValue) return maxLabelText;`,
|
|
86
|
+
`if (currentValue === minValue) return minLabelText;`,
|
|
87
|
+
`return String(currentValue);`,
|
|
87
88
|
],
|
|
88
89
|
});
|
|
89
90
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
-
import {
|
|
3
|
-
export declare function migrateTaigaProprietaryIcons(options:
|
|
2
|
+
import { TuiSchema } from '../../ng-add/schema';
|
|
3
|
+
export declare function migrateTaigaProprietaryIcons(options: TuiSchema): Rule;
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.migrateTaigaProprietaryIcons = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
6
|
-
const get_project_target_options_1 = require("../../utils/get-project-target-options");
|
|
7
|
-
const get_project_1 = require("../../utils/get-project");
|
|
8
6
|
const ng_morph_1 = require("ng-morph");
|
|
9
7
|
const angular_json_manipulations_1 = require("../../utils/angular-json-manipulations");
|
|
8
|
+
const get_project_target_options_1 = require("../../utils/get-project-target-options");
|
|
9
|
+
const get_projects_1 = require("../../utils/get-projects");
|
|
10
10
|
const PROPRIETARY_TDS_ICON_ASSETS = {
|
|
11
|
-
glob:
|
|
12
|
-
input:
|
|
13
|
-
output:
|
|
11
|
+
glob: `**/*`,
|
|
12
|
+
input: `node_modules/@taiga-ui/proprietary-tds-icons/src`,
|
|
13
|
+
output: `assets/taiga-ui/icons`,
|
|
14
14
|
};
|
|
15
15
|
const MANUAL_MIGRATION_TIPS = `Add ${JSON.stringify(PROPRIETARY_TDS_ICON_ASSETS, null, 4)} to angular.json manually`;
|
|
16
16
|
function migrateTaigaProprietaryIcons(options) {
|
|
@@ -19,7 +19,7 @@ function migrateTaigaProprietaryIcons(options) {
|
|
|
19
19
|
let proprietaryIcons = null;
|
|
20
20
|
try {
|
|
21
21
|
proprietaryIcons =
|
|
22
|
-
((_a = ng_morph_1.getPackageJsonDependency(tree,
|
|
22
|
+
((_a = ng_morph_1.getPackageJsonDependency(tree, `@taiga-ui/proprietary-icons`)) === null || _a === void 0 ? void 0 : _a.version) ||
|
|
23
23
|
null;
|
|
24
24
|
}
|
|
25
25
|
catch (_b) {
|
|
@@ -29,36 +29,38 @@ function migrateTaigaProprietaryIcons(options) {
|
|
|
29
29
|
context.logger.warn(`[WARNING]: Schematics don't support this version of angular.json. ${MANUAL_MIGRATION_TIPS}`);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
return ng_morph_1.getSourceFiles(
|
|
32
|
+
return ng_morph_1.getSourceFiles(`**/angular.json`).length > 0
|
|
33
33
|
? workspace_1.updateWorkspace(workspace => {
|
|
34
34
|
if (proprietaryIcons === null) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
37
|
+
const projects = get_projects_1.getProjects(options, workspace);
|
|
38
|
+
if (!projects.length) {
|
|
39
39
|
context.logger.warn(`[WARNING]: Target project not found. ${MANUAL_MIGRATION_TIPS}`);
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
if (Array.isArray(targetOptions === null || targetOptions === void 0 ? void 0 : targetOptions.assets)) {
|
|
51
|
-
const tdsSrc = '@taiga-ui/proprietary-tds-icons/src';
|
|
52
|
-
const hasIcons = targetOptions.assets.find(asset => {
|
|
53
|
-
var _a;
|
|
54
|
-
return typeof asset === 'string'
|
|
55
|
-
? asset.includes(tdsSrc)
|
|
56
|
-
: (_a = asset === null || asset === void 0 ? void 0 : asset.input) === null || _a === void 0 ? void 0 : _a.includes(tdsSrc);
|
|
57
|
-
});
|
|
58
|
-
if (hasIcons) {
|
|
42
|
+
for (const project of projects) {
|
|
43
|
+
let targetOptions;
|
|
44
|
+
try {
|
|
45
|
+
targetOptions = get_project_target_options_1.getProjectTargetOptions(project, `build`);
|
|
46
|
+
}
|
|
47
|
+
catch (_a) {
|
|
48
|
+
context.logger.warn(`[WARNING]: No buildable project was found. ${MANUAL_MIGRATION_TIPS}`);
|
|
59
49
|
return;
|
|
60
50
|
}
|
|
61
|
-
targetOptions.assets
|
|
51
|
+
if (Array.isArray(targetOptions === null || targetOptions === void 0 ? void 0 : targetOptions.assets)) {
|
|
52
|
+
const tdsSrc = `@taiga-ui/proprietary-tds-icons/src`;
|
|
53
|
+
const hasIcons = targetOptions.assets.find(asset => {
|
|
54
|
+
var _a;
|
|
55
|
+
return typeof asset === `string`
|
|
56
|
+
? asset.includes(tdsSrc)
|
|
57
|
+
: (_a = asset === null || asset === void 0 ? void 0 : asset.input) === null || _a === void 0 ? void 0 : _a.includes(tdsSrc);
|
|
58
|
+
});
|
|
59
|
+
if (hasIcons) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
targetOptions.assets.push(PROPRIETARY_TDS_ICON_ASSETS);
|
|
63
|
+
}
|
|
62
64
|
}
|
|
63
65
|
})
|
|
64
66
|
: () => { };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { DevkitFileSystem } from 'ng-morph';
|
|
2
|
-
|
|
2
|
+
import { TuiSchema } from '../../ng-add/schema';
|
|
3
|
+
export declare function migrateTemplates(fileSystem: DevkitFileSystem, options: TuiSchema): void;
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.migrateTemplates = void 0;
|
|
4
|
-
const get_component_templates_1 = require("../../utils/templates/get-component-templates");
|
|
5
|
-
const templates_1 = require("../constants/templates");
|
|
6
|
-
const elements_1 = require("../../utils/templates/elements");
|
|
7
4
|
const ng_morph_1 = require("ng-morph");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const ng_component_1 = require("../../utils/angular/ng-component");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
const add_import_to_closest_module_1 = require("../../utils/add-import-to-closest-module");
|
|
11
7
|
const add_unique_import_1 = require("../../utils/add-unique-import");
|
|
8
|
+
const ng_component_1 = require("../../utils/angular/ng-component");
|
|
12
9
|
const colored_log_1 = require("../../utils/colored-log");
|
|
13
|
-
const
|
|
14
|
-
const replace_tag_1 = require("../../utils/replace-tag");
|
|
10
|
+
const insert_todo_1 = require("../../utils/insert-todo");
|
|
15
11
|
const progress_1 = require("../../utils/progress");
|
|
12
|
+
const replace_tag_1 = require("../../utils/replace-tag");
|
|
13
|
+
const elements_1 = require("../../utils/templates/elements");
|
|
14
|
+
const get_component_templates_1 = require("../../utils/templates/get-component-templates");
|
|
15
|
+
const ng_component_input_manipulations_1 = require("../../utils/templates/ng-component-input-manipulations");
|
|
16
|
+
const template_resource_1 = require("../../utils/templates/template-resource");
|
|
17
|
+
const templates_1 = require("../constants/templates");
|
|
16
18
|
const migrate_polymorpheus_1 = require("./migrate-polymorpheus");
|
|
17
|
-
const add_import_to_closest_module_1 = require("../../utils/add-import-to-closest-module");
|
|
18
|
-
const insert_todo_1 = require("../../utils/insert-todo");
|
|
19
19
|
const migrate_textfield_controller_1 = require("./migrate-textfield-controller");
|
|
20
|
-
function migrateTemplates(fileSystem) {
|
|
21
|
-
|
|
20
|
+
function migrateTemplates(fileSystem, options) {
|
|
21
|
+
!options[`skip-logs`] &&
|
|
22
|
+
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating templates...`);
|
|
22
23
|
const componentWithTemplatesPaths = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
|
|
23
24
|
const actions = [
|
|
24
25
|
replaceTags,
|
|
@@ -44,11 +45,12 @@ function migrateTemplates(fileSystem) {
|
|
|
44
45
|
const recorder = fileSystem.edit(path);
|
|
45
46
|
actions.forEach((action, actionIndex) => {
|
|
46
47
|
const isLastAction = actionIndex === actions.length - 1;
|
|
47
|
-
progressLog(action.name, isLastAction);
|
|
48
|
+
!options[`skip-logs`] && progressLog(action.name, isLastAction);
|
|
48
49
|
action({ resource, fileSystem, recorder });
|
|
49
50
|
});
|
|
50
51
|
});
|
|
51
|
-
|
|
52
|
+
!options[`skip-logs`] &&
|
|
53
|
+
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} templates migrated \n`);
|
|
52
54
|
}
|
|
53
55
|
exports.migrateTemplates = migrateTemplates;
|
|
54
56
|
function replaceAttrsByDirective({ resource, fileSystem, }) {
|
|
@@ -108,10 +110,10 @@ function addHTMLCommentTags({ resource, recorder, fileSystem, }) {
|
|
|
108
110
|
function replaceBreadcrumbs({ resource, recorder, fileSystem, }) {
|
|
109
111
|
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
|
110
112
|
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
|
111
|
-
const elements = elements_1.findElementsByTagName(template,
|
|
113
|
+
const elements = elements_1.findElementsByTagName(template, `tui-breadcrumbs`);
|
|
112
114
|
elements.forEach(element => {
|
|
113
115
|
var _a, _b, _c;
|
|
114
|
-
const itemsAttr = element.attrs.find(attr => attr.name ===
|
|
116
|
+
const itemsAttr = element.attrs.find(attr => attr.name === `[items]`);
|
|
115
117
|
const itemsValue = itemsAttr === null || itemsAttr === void 0 ? void 0 : itemsAttr.value;
|
|
116
118
|
const insertTo = (_a = element === null || element === void 0 ? void 0 : element.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.startTag.endOffset;
|
|
117
119
|
if (!itemsValue || !insertTo) {
|
|
@@ -127,32 +129,32 @@ function replaceBreadcrumbs({ resource, recorder, fileSystem, }) {
|
|
|
127
129
|
{{ item.caption }}
|
|
128
130
|
</a>
|
|
129
131
|
</ng-container>`);
|
|
130
|
-
const { startOffset = 0, endOffset = 0 } = ((_c = (_b = element.sourceCodeLocation) === null || _b === void 0 ? void 0 : _b.attrs) === null || _c === void 0 ? void 0 : _c[
|
|
132
|
+
const { startOffset = 0, endOffset = 0 } = ((_c = (_b = element.sourceCodeLocation) === null || _b === void 0 ? void 0 : _b.attrs) === null || _c === void 0 ? void 0 : _c[`[items]`]) || {};
|
|
131
133
|
recorder.remove(templateOffset + startOffset - 1, endOffset - startOffset + 1);
|
|
132
134
|
});
|
|
133
135
|
}
|
|
134
136
|
function replaceFieldError({ resource, recorder, fileSystem, }) {
|
|
135
137
|
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
|
136
138
|
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
|
137
|
-
const elements = elements_1.findElementsByTagName(template,
|
|
139
|
+
const elements = elements_1.findElementsByTagName(template, `tui-field-error`);
|
|
138
140
|
elements.forEach(element => {
|
|
139
141
|
var _a, _b;
|
|
140
|
-
const orderAttr = element.attrs.find(attr => attr.name ===
|
|
142
|
+
const orderAttr = element.attrs.find(attr => attr.name === `[order]`);
|
|
141
143
|
const orderVal = orderAttr === null || orderAttr === void 0 ? void 0 : orderAttr.value;
|
|
142
144
|
if (orderAttr) {
|
|
143
|
-
const { startOffset = 0, endOffset = 0 } = ((_b = (_a = element.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b[
|
|
145
|
+
const { startOffset = 0, endOffset = 0 } = ((_b = (_a = element.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b[`[order]`]) || {};
|
|
144
146
|
recorder.remove(templateOffset + startOffset - 1, endOffset - startOffset + 1);
|
|
145
147
|
}
|
|
146
|
-
const input = `[error]="${orderVal !== null && orderVal !== void 0 ? orderVal :
|
|
147
|
-
replace_tag_1.replaceTag(recorder, element.sourceCodeLocation,
|
|
148
|
+
const input = `[error]="${orderVal !== null && orderVal !== void 0 ? orderVal : `[]`} | tuiFieldError | async"`;
|
|
149
|
+
replace_tag_1.replaceTag(recorder, element.sourceCodeLocation, `tui-field-error`, `tui-error`, templateOffset, [input]);
|
|
148
150
|
});
|
|
149
151
|
if (elements.length) {
|
|
150
|
-
add_import_to_closest_module_1.addImportToClosestModule(resource.componentPath,
|
|
152
|
+
add_import_to_closest_module_1.addImportToClosestModule(resource.componentPath, `TuiErrorModule`, `@taiga-ui/core`);
|
|
151
153
|
}
|
|
152
154
|
}
|
|
153
155
|
function addEditorProviders({ resource, fileSystem, }) {
|
|
154
156
|
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
|
155
|
-
const elements = elements_1.findElementsByTagName(template,
|
|
157
|
+
const elements = elements_1.findElementsByTagName(template, `tui-editor`).filter(element => !elements_1.hasElementAttribute(element, `new`));
|
|
156
158
|
if (elements.length) {
|
|
157
159
|
const componentPath = resource.componentPath;
|
|
158
160
|
const componentClass = ng_component_1.getNgComponents(componentPath);
|
|
@@ -160,10 +162,11 @@ function addEditorProviders({ resource, fileSystem, }) {
|
|
|
160
162
|
provide: TUI_EDITOR_EXTENSIONS,
|
|
161
163
|
useValue: defaultEditorExtensions
|
|
162
164
|
}`, { unique: true });
|
|
163
|
-
add_unique_import_1.addUniqueImport(componentPath,
|
|
164
|
-
add_unique_import_1.addUniqueImport(componentPath,
|
|
165
|
+
add_unique_import_1.addUniqueImport(componentPath, `TUI_EDITOR_EXTENSIONS`, `@taiga-ui/addon-editor`);
|
|
166
|
+
add_unique_import_1.addUniqueImport(componentPath, `defaultEditorExtensions`, `@taiga-ui/addon-editor`);
|
|
165
167
|
}
|
|
166
168
|
}
|
|
169
|
+
// eslint-disable-next-line unicorn/no-unsafe-regex
|
|
167
170
|
const HIDE_SELECTED_PIPE_WITH_ARGS_REG = /\|\s*tuiHideSelected(\s*:\s*[^|'"]*)?/gi;
|
|
168
171
|
function migrateTuiHideSelectedPipe({ resource, fileSystem, recorder, }) {
|
|
169
172
|
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
|
@@ -177,9 +180,9 @@ function migrateTuiHideSelectedPipe({ resource, fileSystem, recorder, }) {
|
|
|
177
180
|
if (!name || !oldValue || !attrLocations) {
|
|
178
181
|
return;
|
|
179
182
|
}
|
|
180
|
-
const newValue = oldValue.replace(HIDE_SELECTED_PIPE_WITH_ARGS_REG,
|
|
183
|
+
const newValue = oldValue.replace(HIDE_SELECTED_PIPE_WITH_ARGS_REG, `| tuiHideSelected`);
|
|
181
184
|
const { startOffset } = attrLocations[name];
|
|
182
|
-
const valueOffset = templateOffset + startOffset + name.length +
|
|
185
|
+
const valueOffset = templateOffset + startOffset + name.length + `="`.length;
|
|
183
186
|
recorder.remove(valueOffset, oldValue.length);
|
|
184
187
|
recorder.insertRight(valueOffset, newValue);
|
|
185
188
|
});
|
|
@@ -190,7 +193,7 @@ function migrateBinaryAttributes({ resource, fileSystem, recorder, }) {
|
|
|
190
193
|
templates_1.TRUTHY_BOOLEAN_INPUT_TO_HTML_BINARY_ATTRIBUTE.forEach(attrName => {
|
|
191
194
|
const elements = elements_1.findElementsInTemplateByFn(template, el => {
|
|
192
195
|
var _a;
|
|
193
|
-
return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some(attr => attr.value ===
|
|
196
|
+
return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some(attr => attr.value === `true` && attr.name.includes(attrName.toLowerCase()));
|
|
194
197
|
});
|
|
195
198
|
elements.forEach(el => {
|
|
196
199
|
var _a;
|
|
@@ -215,12 +218,13 @@ function addWarningForFormatNumberPipe({ resource, fileSystem, recorder, }) {
|
|
|
215
218
|
function replaceInputValues({ resource, recorder, fileSystem, }) {
|
|
216
219
|
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
|
217
220
|
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
|
221
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
218
222
|
const ATTR_VALUES = [
|
|
219
223
|
{
|
|
220
|
-
attrName:
|
|
224
|
+
attrName: `tuiHintDirection`,
|
|
221
225
|
values: [
|
|
222
|
-
{ from:
|
|
223
|
-
{ from:
|
|
226
|
+
{ from: `bottom-middle`, to: `bottom` },
|
|
227
|
+
{ from: `top-middle`, to: `top` },
|
|
224
228
|
],
|
|
225
229
|
},
|
|
226
230
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TemplateResource } from '../interfaces/template-resourse';
|
|
2
1
|
import { UpdateRecorder } from '@angular-devkit/schematics';
|
|
3
2
|
import { DevkitFileSystem } from 'ng-morph/project/classes/devkit-file-system';
|
|
3
|
+
import { TemplateResource } from '../interfaces/template-resourse';
|
|
4
4
|
export declare function migrateTextfieldController({ resource, fileSystem, recorder, }: {
|
|
5
5
|
resource: TemplateResource;
|
|
6
6
|
recorder: UpdateRecorder;
|