@taiga-ui/cdk 4.2.0 → 4.3.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/classes/control.d.ts +2 -1
- package/constants/version.d.ts +1 -1
- package/constants/version.js +1 -1
- package/directives/platform/platform.directive.d.ts +1 -1
- package/esm2022/classes/control.mjs +9 -11
- package/esm2022/constants/version.mjs +2 -2
- package/esm2022/directives/copy-processor/copy-processor.directive.mjs +5 -5
- package/esm2022/directives/focus-trap/focus-trap.directive.mjs +4 -6
- package/esm2022/directives/media/media.directive.mjs +14 -28
- package/esm2022/directives/native-validator/native-validator.directive.mjs +5 -5
- package/esm2022/directives/platform/platform.directive.mjs +7 -9
- package/esm2022/directives/resizer/resizer.directive.mjs +10 -16
- package/esm2022/observables/control-value.mjs +2 -13
- package/esm2022/tokens/fallback-value.mjs +3 -3
- package/esm2022/utils/miscellaneous/count-filled-controls.mjs +13 -0
- package/esm2022/utils/miscellaneous/index.mjs +3 -1
- package/esm2022/utils/miscellaneous/is-control-empty.mjs +4 -0
- package/fesm2022/taiga-ui-cdk-classes.mjs +9 -11
- package/fesm2022/taiga-ui-cdk-classes.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-constants.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-copy-processor.mjs +4 -4
- package/fesm2022/taiga-ui-cdk-directives-copy-processor.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-focus-trap.mjs +3 -5
- package/fesm2022/taiga-ui-cdk-directives-focus-trap.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-media.mjs +13 -27
- package/fesm2022/taiga-ui-cdk-directives-media.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-native-validator.mjs +4 -4
- package/fesm2022/taiga-ui-cdk-directives-native-validator.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-platform.mjs +6 -8
- package/fesm2022/taiga-ui-cdk-directives-platform.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-resizer.mjs +9 -15
- package/fesm2022/taiga-ui-cdk-directives-resizer.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-observables.mjs +2 -13
- package/fesm2022/taiga-ui-cdk-observables.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-tokens.mjs +3 -2
- package/fesm2022/taiga-ui-cdk-tokens.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs +17 -2
- package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs.map +1 -1
- package/observables/control-value.d.ts +0 -3
- package/package.json +2 -2
- package/schematics/ng-add/steps/add-taiga-modules.js +3 -1
- package/schematics/ng-add/steps/wrap-with-tui-root.js +11 -7
- package/schematics/ng-update/v4/index.js +1 -0
- package/schematics/ng-update/v4/steps/index.d.ts +1 -0
- package/schematics/ng-update/v4/steps/index.js +1 -0
- package/schematics/ng-update/v4/steps/migrate-alert-service.js +7 -9
- package/schematics/ng-update/v4/steps/migrate-destroy-service.js +5 -3
- package/schematics/ng-update/v4/steps/migrate-templates.js +3 -0
- package/schematics/ng-update/v4/steps/remove-duplicates.d.ts +2 -0
- package/schematics/ng-update/v4/steps/remove-duplicates.js +41 -0
- package/schematics/ng-update/v4/steps/templates/migrate-money.js +8 -3
- package/schematics/utils/add-import-to-closest-module.d.ts +1 -0
- package/schematics/utils/add-import-to-closest-module.js +24 -17
- package/schematics/utils/create-angular-json.d.ts +0 -1
- package/schematics/utils/create-angular-json.js +1 -27
- package/tokens/fallback-value.d.ts +1 -2
- package/utils/miscellaneous/count-filled-controls.d.ts +2 -0
- package/utils/miscellaneous/index.d.ts +2 -0
- package/utils/miscellaneous/is-control-empty.d.ts +2 -0
@@ -12,7 +12,7 @@ function migrateMoney({ resource, recorder, fileSystem, }) {
|
|
12
12
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
13
13
|
const elements = (0, elements_1.findElementsByTagName)(template, 'tui-money');
|
14
14
|
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
15
|
-
var _a, _b, _c;
|
15
|
+
var _a, _b, _c, _d, _e;
|
16
16
|
if (!sourceCodeLocation) {
|
17
17
|
return;
|
18
18
|
}
|
@@ -21,15 +21,16 @@ function migrateMoney({ resource, recorder, fileSystem, }) {
|
|
21
21
|
const decimalAttr = (0, inputs_1.findAttr)(attrs, 'decimal');
|
22
22
|
const precisionAttr = (0, inputs_1.findAttr)(attrs, 'precision');
|
23
23
|
const signAttr = (0, inputs_1.findAttr)(attrs, 'sign');
|
24
|
+
const selfClosing = !(sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.endTag);
|
24
25
|
if (!valueAttr) {
|
25
26
|
return;
|
26
27
|
}
|
27
|
-
const insertTo = (_b = (_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.
|
28
|
+
const insertTo = (_b = (_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.startTag) === null || _a === void 0 ? void 0 : _a.endOffset) !== null && _b !== void 0 ? _b : 0;
|
28
29
|
const value = (0, inputs_1.isBinding)(valueAttr) ? valueAttr.value : `'${valueAttr.value}'`;
|
29
30
|
const currency = currencyAttr && (0, inputs_1.isBinding)(currencyAttr)
|
30
31
|
? currencyAttr === null || currencyAttr === void 0 ? void 0 : currencyAttr.value
|
31
32
|
: `'${currencyAttr === null || currencyAttr === void 0 ? void 0 : currencyAttr.value}'`;
|
32
|
-
recorder.insertRight(templateOffset + insertTo, `{{ ${value} | tuiAmount ${currencyAttr ? `: ${currency}` : ': "RUB"'} | async }}`);
|
33
|
+
recorder.insertRight(templateOffset + insertTo, `{{ ${value} | tuiAmount ${currencyAttr ? `: ${currency}` : ': "RUB"'} | async }}${selfClosing ? '</span>' : ''}`);
|
33
34
|
if (decimalAttr || precisionAttr) {
|
34
35
|
(0, add_import_to_closest_module_1.addImportToClosestModule)(resource.componentPath, 'TuiNumberFormat', '@taiga-ui/core');
|
35
36
|
const format = JSON.stringify((0, clean_object_1.cleanObject)({
|
@@ -48,6 +49,10 @@ function migrateMoney({ resource, recorder, fileSystem, }) {
|
|
48
49
|
signAttr,
|
49
50
|
].filter((attr) => attr !== undefined);
|
50
51
|
(0, remove_attrs_1.removeAttrs)(attrsToRemove, sourceCodeLocation, recorder, templateOffset);
|
52
|
+
if (selfClosing) {
|
53
|
+
recorder.remove(templateOffset + ((_e = (_d = sourceCodeLocation.startTag) === null || _d === void 0 ? void 0 : _d.endOffset) !== null && _e !== void 0 ? _e : 2) - 2, 1);
|
54
|
+
}
|
55
|
+
(0, add_import_to_closest_module_1.addImportToClosestModule)(resource.componentPath, 'AsyncPipe', '@angular/common');
|
51
56
|
});
|
52
57
|
}
|
53
58
|
exports.migrateMoney = migrateMoney;
|
@@ -1,25 +1,32 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.addImportToClosestModule = void 0;
|
3
|
+
exports.saveAddedImports = exports.addImportToClosestModule = void 0;
|
4
4
|
const ng_morph_1 = require("ng-morph");
|
5
5
|
const file_globs_1 = require("../constants/file-globs");
|
6
6
|
const add_unique_import_1 = require("./add-unique-import");
|
7
|
+
const importsToAdd = [];
|
7
8
|
function addImportToClosestModule(componentPath, moduleName, moduleSpecifier) {
|
8
|
-
|
9
|
-
if (!ngComponent) {
|
10
|
-
return;
|
11
|
-
}
|
12
|
-
if ((0, ng_morph_1.isStandaloneComponent)(ngComponent)) {
|
13
|
-
(0, ng_morph_1.addImportToComponent)(ngComponent, moduleName, { unique: true });
|
14
|
-
(0, add_unique_import_1.addUniqueImport)(ngComponent.getSourceFile().getFilePath(), moduleName, moduleSpecifier);
|
15
|
-
return;
|
16
|
-
}
|
17
|
-
const ngModule = (0, ng_morph_1.findNgModule)(ngComponent, file_globs_1.ALL_TS_FILES);
|
18
|
-
if (ngModule) {
|
19
|
-
(0, ng_morph_1.addImportToNgModule)(ngModule, moduleName, {
|
20
|
-
unique: true,
|
21
|
-
});
|
22
|
-
(0, add_unique_import_1.addUniqueImport)(ngModule.getSourceFile().getFilePath(), moduleName, moduleSpecifier);
|
23
|
-
}
|
9
|
+
importsToAdd.push({ componentPath, moduleName, moduleSpecifier });
|
24
10
|
}
|
25
11
|
exports.addImportToClosestModule = addImportToClosestModule;
|
12
|
+
function saveAddedImports() {
|
13
|
+
importsToAdd.forEach(({ componentPath, moduleName, moduleSpecifier }) => {
|
14
|
+
const [ngComponent] = (0, ng_morph_1.getNgComponents)(componentPath);
|
15
|
+
if (!ngComponent) {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
if ((0, ng_morph_1.isStandaloneComponent)(ngComponent)) {
|
19
|
+
(0, ng_morph_1.addImportToComponent)(ngComponent, moduleName, { unique: true });
|
20
|
+
(0, add_unique_import_1.addUniqueImport)(ngComponent.getSourceFile().getFilePath(), moduleName, moduleSpecifier);
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
const ngModule = (0, ng_morph_1.findNgModule)(ngComponent, file_globs_1.ALL_TS_FILES);
|
24
|
+
if (ngModule) {
|
25
|
+
(0, ng_morph_1.addImportToNgModule)(ngModule, moduleName, {
|
26
|
+
unique: true,
|
27
|
+
});
|
28
|
+
(0, add_unique_import_1.addUniqueImport)(ngModule.getSourceFile().getFilePath(), moduleName, moduleSpecifier);
|
29
|
+
}
|
30
|
+
});
|
31
|
+
}
|
32
|
+
exports.saveAddedImports = saveAddedImports;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.createAngularJson = void 0;
|
4
4
|
const ng_morph_1 = require("ng-morph");
|
5
5
|
function createAngularJson({ stylesExist } = { stylesExist: false }) {
|
6
6
|
(0, ng_morph_1.createSourceFile)('angular.json', `
|
@@ -27,29 +27,3 @@ function createAngularJson({ stylesExist } = { stylesExist: false }) {
|
|
27
27
|
}`, { overwrite: true });
|
28
28
|
}
|
29
29
|
exports.createAngularJson = createAngularJson;
|
30
|
-
function createAngularJsonWithAssets() {
|
31
|
-
(0, ng_morph_1.createSourceFile)('angular.json', `
|
32
|
-
{
|
33
|
-
"version": 1,
|
34
|
-
"projects": {
|
35
|
-
"demo": {
|
36
|
-
"root": "",
|
37
|
-
"architect": {
|
38
|
-
"build": {
|
39
|
-
"options": {
|
40
|
-
"main": "test/main.ts",
|
41
|
-
"assets": [
|
42
|
-
{
|
43
|
-
"glob": "**/*",
|
44
|
-
"input": "node_modules/@taiga-ui/icons/src",
|
45
|
-
"output": "assets/taiga-ui/icons"
|
46
|
-
}
|
47
|
-
]
|
48
|
-
}
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}`, { overwrite: true });
|
54
|
-
}
|
55
|
-
exports.createAngularJsonWithAssets = createAngularJsonWithAssets;
|
@@ -1,4 +1,3 @@
|
|
1
1
|
import type { ValueProvider } from '@angular/core';
|
2
|
-
|
3
|
-
export declare const TUI_FALLBACK_VALUE: InjectionToken<unknown>;
|
2
|
+
export declare const TUI_FALLBACK_VALUE: import("@angular/core").InjectionToken<any>;
|
4
3
|
export declare function tuiFallbackValueProvider<T>(useValue: T): ValueProvider;
|
@@ -2,6 +2,7 @@ export * from './array-remove';
|
|
2
2
|
export * from './array-shallow-equals';
|
3
3
|
export * from './array-toggle';
|
4
4
|
export * from './change-date-separator';
|
5
|
+
export * from './count-filled-controls';
|
5
6
|
export * from './create-token';
|
6
7
|
export * from './default-sort';
|
7
8
|
export * from './directive-binding';
|
@@ -10,6 +11,7 @@ export * from './distance-between-touches';
|
|
10
11
|
export * from './ease-in-out-quad';
|
11
12
|
export * from './flat-length';
|
12
13
|
export * from './get-original-array-from-query-list';
|
14
|
+
export * from './is-control-empty';
|
13
15
|
export * from './is-falsy';
|
14
16
|
export * from './is-number';
|
15
17
|
export * from './is-object';
|