@taiga-ui/cdk 2.50.1 → 2.51.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/bundles/taiga-ui-cdk-directives-copy-processor.umd.js +7 -7
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-directives-copy-processor.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.js +4 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-exceptions.umd.js +39 -0
- package/bundles/taiga-ui-cdk-exceptions.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-exceptions.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-exceptions.umd.min.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-dom.umd.js +18 -38
- package/bundles/taiga-ui-cdk-utils-dom.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-dom.umd.min.js +1 -1
- package/bundles/taiga-ui-cdk-utils-dom.umd.min.js.map +1 -1
- package/directives/copy-processor/taiga-ui-cdk-directives-copy-processor.metadata.json +1 -1
- package/esm2015/directives/copy-processor/copy-processor.directive.js +5 -4
- package/esm2015/directives/overscroll/overscroll.directive.js +5 -2
- package/esm2015/exceptions/invalid-day.exception.js +8 -1
- package/esm2015/exceptions/invalid-month.exception.js +8 -1
- package/esm2015/exceptions/invalid-year.exception.js +8 -1
- package/esm2015/utils/dom/get-selected-text.js +16 -0
- package/esm2015/utils/dom/index.js +3 -3
- package/esm2015/utils/dom/is-form-field.js +8 -0
- package/esm5/directives/copy-processor/copy-processor.directive.js +5 -4
- package/esm5/directives/overscroll/overscroll.directive.js +5 -2
- package/esm5/exceptions/invalid-day.exception.js +14 -1
- package/esm5/exceptions/invalid-month.exception.js +14 -1
- package/esm5/exceptions/invalid-year.exception.js +14 -1
- package/esm5/utils/dom/get-selected-text.js +17 -0
- package/esm5/utils/dom/index.js +3 -3
- package/esm5/utils/dom/is-form-field.js +8 -0
- package/exceptions/invalid-day.exception.d.ts +6 -0
- package/exceptions/invalid-month.exception.d.ts +6 -0
- package/exceptions/invalid-year.exception.d.ts +6 -0
- package/exceptions/taiga-ui-cdk-exceptions.metadata.json +1 -1
- package/fesm2015/taiga-ui-cdk-directives-copy-processor.js +4 -3
- package/fesm2015/taiga-ui-cdk-directives-copy-processor.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-overscroll.js +4 -1
- package/fesm2015/taiga-ui-cdk-directives-overscroll.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-exceptions.js +22 -1
- package/fesm2015/taiga-ui-cdk-exceptions.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-dom.js +16 -35
- package/fesm2015/taiga-ui-cdk-utils-dom.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-copy-processor.js +4 -3
- package/fesm5/taiga-ui-cdk-directives-copy-processor.js.map +1 -1
- package/fesm5/taiga-ui-cdk-directives-overscroll.js +4 -1
- package/fesm5/taiga-ui-cdk-directives-overscroll.js.map +1 -1
- package/fesm5/taiga-ui-cdk-exceptions.js +37 -1
- package/fesm5/taiga-ui-cdk-exceptions.js.map +1 -1
- package/fesm5/taiga-ui-cdk-utils-dom.js +17 -37
- package/fesm5/taiga-ui-cdk-utils-dom.js.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-update/constants/consts.js +10 -0
- package/schematics/ng-update/constants/modules.js +1 -0
- package/schematics/ng-update/constants/services.js +9 -0
- package/schematics/ng-update/constants/templates.d.ts +17 -0
- package/schematics/ng-update/constants/templates.js +32 -0
- package/schematics/ng-update/constants/types.js +30 -0
- package/schematics/ng-update/index.js +35 -4
- package/schematics/ng-update/steps/migrate-progress.d.ts +3 -0
- package/schematics/ng-update/steps/migrate-progress.js +41 -0
- package/schematics/ng-update/steps/migrate-sliders/index.d.ts +2 -2
- package/schematics/ng-update/steps/migrate-sliders/index.js +4 -2
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.d.ts +2 -0
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.js +85 -0
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.d.ts +2 -2
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.js +30 -22
- package/schematics/ng-update/steps/migrate-templates.d.ts +2 -2
- package/schematics/ng-update/steps/migrate-templates.js +69 -30
- package/schematics/ng-update/steps/replace-services.js +4 -1
- package/schematics/ng-update/steps/show-warnings.js +1 -1
- package/schematics/utils/colored-log.d.ts +2 -0
- package/schematics/utils/colored-log.js +10 -0
- package/schematics/utils/templates/elements.js +2 -1
- package/schematics/utils/templates/ng-component-input-manipulations.js +2 -1
- package/utils/dom/get-selected-text.d.ts +9 -0
- package/utils/dom/index.d.ts +2 -2
- package/utils/dom/is-form-field.d.ts +1 -0
- package/utils/dom/taiga-ui-cdk-utils-dom.metadata.json +1 -1
- package/esm2015/utils/dom/get-viewport-height.js +0 -21
- package/esm2015/utils/dom/get-viewport-width.js +0 -21
- package/esm5/utils/dom/get-viewport-height.js +0 -22
- package/esm5/utils/dom/get-viewport-width.js +0 -22
- package/utils/dom/get-viewport-height.d.ts +0 -18
- package/utils/dom/get-viewport-width.d.ts +0 -18
|
@@ -16,6 +16,11 @@ var TuiDocumentSelectionException = /** @class */ (function (_super) {
|
|
|
16
16
|
return TuiDocumentSelectionException;
|
|
17
17
|
}(Error));
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated: use {@link TuiInvalidDayException}
|
|
21
|
+
* TODO: remove in v3.0
|
|
22
|
+
*/
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
19
24
|
var InvalidDayException = /** @class */ (function (_super) {
|
|
20
25
|
__extends(InvalidDayException, _super);
|
|
21
26
|
function InvalidDayException(day) {
|
|
@@ -23,7 +28,19 @@ var InvalidDayException = /** @class */ (function (_super) {
|
|
|
23
28
|
}
|
|
24
29
|
return InvalidDayException;
|
|
25
30
|
}(Error));
|
|
31
|
+
var TuiInvalidDayException = /** @class */ (function (_super) {
|
|
32
|
+
__extends(TuiInvalidDayException, _super);
|
|
33
|
+
function TuiInvalidDayException() {
|
|
34
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
35
|
+
}
|
|
36
|
+
return TuiInvalidDayException;
|
|
37
|
+
}(InvalidDayException));
|
|
26
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated: use {@link TuiInvalidMonthException}
|
|
41
|
+
* TODO: remove in v3.0
|
|
42
|
+
*/
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
27
44
|
var InvalidMonthException = /** @class */ (function (_super) {
|
|
28
45
|
__extends(InvalidMonthException, _super);
|
|
29
46
|
function InvalidMonthException(month) {
|
|
@@ -31,7 +48,19 @@ var InvalidMonthException = /** @class */ (function (_super) {
|
|
|
31
48
|
}
|
|
32
49
|
return InvalidMonthException;
|
|
33
50
|
}(Error));
|
|
51
|
+
var TuiInvalidMonthException = /** @class */ (function (_super) {
|
|
52
|
+
__extends(TuiInvalidMonthException, _super);
|
|
53
|
+
function TuiInvalidMonthException() {
|
|
54
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
55
|
+
}
|
|
56
|
+
return TuiInvalidMonthException;
|
|
57
|
+
}(InvalidMonthException));
|
|
34
58
|
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated: use {@link TuiInvalidYearException}
|
|
61
|
+
* TODO: remove in v3.0
|
|
62
|
+
*/
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
35
64
|
var InvalidYearException = /** @class */ (function (_super) {
|
|
36
65
|
__extends(InvalidYearException, _super);
|
|
37
66
|
function InvalidYearException(year) {
|
|
@@ -39,6 +68,13 @@ var InvalidYearException = /** @class */ (function (_super) {
|
|
|
39
68
|
}
|
|
40
69
|
return InvalidYearException;
|
|
41
70
|
}(Error));
|
|
71
|
+
var TuiInvalidYearException = /** @class */ (function (_super) {
|
|
72
|
+
__extends(TuiInvalidYearException, _super);
|
|
73
|
+
function TuiInvalidYearException() {
|
|
74
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
75
|
+
}
|
|
76
|
+
return TuiInvalidYearException;
|
|
77
|
+
}(InvalidYearException));
|
|
42
78
|
|
|
43
79
|
var TuiNoHostException = /** @class */ (function (_super) {
|
|
44
80
|
__extends(TuiNoHostException, _super);
|
|
@@ -108,5 +144,5 @@ var TuiXmlParsingException = /** @class */ (function (_super) {
|
|
|
108
144
|
* Generated bundle index. Do not edit.
|
|
109
145
|
*/
|
|
110
146
|
|
|
111
|
-
export { InvalidDayException, InvalidMonthException, InvalidYearException, TuiComputedDocumentException, TuiDocumentSelectionException, TuiNoHostException, TuiOwnerDocumentException, TuiPureException, TuiTableSortKeyException, TuiTsParserException, TuiValueChangesException, TuiValuePresentException, TuiXmlParsingException };
|
|
147
|
+
export { InvalidDayException, InvalidMonthException, InvalidYearException, TuiComputedDocumentException, TuiDocumentSelectionException, TuiInvalidDayException, TuiInvalidMonthException, TuiInvalidYearException, TuiNoHostException, TuiOwnerDocumentException, TuiPureException, TuiTableSortKeyException, TuiTsParserException, TuiValueChangesException, TuiValuePresentException, TuiXmlParsingException };
|
|
112
148
|
//# sourceMappingURL=taiga-ui-cdk-exceptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-exceptions.js","sources":["ng://@taiga-ui/cdk/exceptions/computed-document.exception.ts","ng://@taiga-ui/cdk/exceptions/document-selection.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-day.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-month.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-year.exception.ts","ng://@taiga-ui/cdk/exceptions/no-host.exception.ts","ng://@taiga-ui/cdk/exceptions/owner-document.exception.ts","ng://@taiga-ui/cdk/exceptions/pure.exception.ts","ng://@taiga-ui/cdk/exceptions/table-sort-key.exception.ts","ng://@taiga-ui/cdk/exceptions/ts-parser.exception.ts","ng://@taiga-ui/cdk/exceptions/value-changes.exception.ts","ng://@taiga-ui/cdk/exceptions/value-present.exception.ts","ng://@taiga-ui/cdk/exceptions/xml-parsing.exception.ts","ng://@taiga-ui/cdk/exceptions/taiga-ui-cdk-exceptions.ts"],"sourcesContent":["export class TuiComputedDocumentException extends Error {\n constructor() {\n super('Only use computedDocument after load event');\n }\n}\n","export class TuiDocumentSelectionException extends Error {\n constructor() {\n super('Failed to get document selection');\n }\n}\n","
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-exceptions.js","sources":["ng://@taiga-ui/cdk/exceptions/computed-document.exception.ts","ng://@taiga-ui/cdk/exceptions/document-selection.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-day.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-month.exception.ts","ng://@taiga-ui/cdk/exceptions/invalid-year.exception.ts","ng://@taiga-ui/cdk/exceptions/no-host.exception.ts","ng://@taiga-ui/cdk/exceptions/owner-document.exception.ts","ng://@taiga-ui/cdk/exceptions/pure.exception.ts","ng://@taiga-ui/cdk/exceptions/table-sort-key.exception.ts","ng://@taiga-ui/cdk/exceptions/ts-parser.exception.ts","ng://@taiga-ui/cdk/exceptions/value-changes.exception.ts","ng://@taiga-ui/cdk/exceptions/value-present.exception.ts","ng://@taiga-ui/cdk/exceptions/xml-parsing.exception.ts","ng://@taiga-ui/cdk/exceptions/taiga-ui-cdk-exceptions.ts"],"sourcesContent":["export class TuiComputedDocumentException extends Error {\n constructor() {\n super('Only use computedDocument after load event');\n }\n}\n","export class TuiDocumentSelectionException extends Error {\n constructor() {\n super('Failed to get document selection');\n }\n}\n","/**\n * @deprecated: use {@link TuiInvalidDayException}\n * TODO: remove in v3.0\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class InvalidDayException extends Error {\n constructor(day: number) {\n super(`Invalid day: ${day}`);\n }\n}\n\nexport class TuiInvalidDayException extends InvalidDayException {}\n","/**\n * @deprecated: use {@link TuiInvalidMonthException}\n * TODO: remove in v3.0\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class InvalidMonthException extends Error {\n constructor(month: number) {\n super(`Invalid month: ${month}`);\n }\n}\n\nexport class TuiInvalidMonthException extends InvalidMonthException {}\n","/**\n * @deprecated: use {@link TuiInvalidYearException}\n * TODO: remove in v3.0\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class InvalidYearException extends Error {\n constructor(year: number) {\n super(`Invalid year: ${year}`);\n }\n}\n\nexport class TuiInvalidYearException extends InvalidYearException {}\n","export class TuiNoHostException extends Error {\n constructor() {\n super('Portals cannot be used without TuiPortalHostComponent');\n }\n}\n","export class TuiOwnerDocumentException extends Error {\n constructor() {\n super('Element does not have ownerDocument');\n }\n}\n","export class TuiPureException extends Error {\n constructor() {\n super('tuiPure can only be used with functions or getters');\n }\n}\n","export class TuiTableSortKeyException extends Error {\n constructor() {\n super('Trying to sort with no key');\n }\n}\n","export class TuiTsParserException extends Error {\n constructor() {\n super('TsFileParser: 1 component/module per ts-file');\n }\n}\n","export class TuiValueChangesException extends Error {\n constructor() {\n super('Control does not have valueChanges');\n }\n}\n","export class TuiValuePresentException extends Error {\n constructor() {\n super('Value must present');\n }\n}\n","export class TuiXmlParsingException extends Error {\n constructor() {\n super('Error parsing XML string');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;IAAkD,gDAAK;IACnD;eACI,kBAAM,4CAA4C,CAAC;KACtD;IACL,mCAAC;AAAD,CAJA,CAAkD,KAAK;;;ICAJ,iDAAK;IACpD;eACI,kBAAM,kCAAkC,CAAC;KAC5C;IACL,oCAAC;AAAD,CAJA,CAAmD,KAAK;;ACAxD;;;;AAI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9B;IACL,+BAAC;AAAD,CAJA,CAA8C,KAAK;;;ICAP,0CAAK;IAC7C;eACI,kBAAM,0BAA0B,CAAC;KACpC;IACL,6BAAC;AAAD,CAJA,CAA4C,KAAK;;ACAjD;;;;;;"}
|
|
@@ -179,48 +179,28 @@ function getScrollParent(element, vertical) {
|
|
|
179
179
|
return getScrollParent(element.parentElement, vertical);
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
189
|
-
* wrongly scale down to what PPK calls the visual
|
|
190
|
-
* viewport and be smaller than the @media values
|
|
191
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
192
|
-
*
|
|
193
|
-
* 2. document.documentElement.clientHeight
|
|
194
|
-
* 2.1. equals CSS viewport width minus scrollbar width
|
|
195
|
-
* 2.2. matches @media (height) when there is no scrollbar
|
|
196
|
-
* 2.3. available cross-browser
|
|
197
|
-
* 2.4. inaccurate if doctype is missing
|
|
198
|
-
*/
|
|
199
|
-
function tuiGetViewportHeight(_a) {
|
|
200
|
-
var document = _a.document, innerHeight = _a.innerHeight;
|
|
201
|
-
return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);
|
|
182
|
+
function tuiIsFormFieldElement(element) {
|
|
183
|
+
var textfield = element;
|
|
184
|
+
return (!!textfield &&
|
|
185
|
+
'value' in textfield &&
|
|
186
|
+
'selectionStart' in textfield &&
|
|
187
|
+
'selectionEnd' in textfield);
|
|
202
188
|
}
|
|
203
189
|
|
|
204
190
|
/**
|
|
205
191
|
* @description:
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* 1. window.innerWidth
|
|
209
|
-
* 1.1. gets CSS viewport @media (width) which include scrollbars
|
|
210
|
-
* 1.2. initial-scale and zoom variations may cause mobile values to
|
|
211
|
-
* wrongly scale down to what PPK calls the visual
|
|
212
|
-
* viewport and be smaller than the @media values
|
|
213
|
-
* 1.3. zoom may cause values to be 1px off due to native rounding
|
|
192
|
+
* cross browser way to get selected text
|
|
214
193
|
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* 2.3. available cross-browser
|
|
219
|
-
* 2.4. inaccurate if doctype is missing
|
|
194
|
+
* History:
|
|
195
|
+
* BUG - window.getSelection() fails when text selected in a form field
|
|
196
|
+
* https://bugzilla.mozilla.org/show_bug.cgi?id=85686
|
|
220
197
|
*/
|
|
221
|
-
function
|
|
222
|
-
var
|
|
223
|
-
|
|
198
|
+
function tuiGetSelectedText(_a) {
|
|
199
|
+
var getSelection = _a.getSelection, document = _a.document;
|
|
200
|
+
var _b;
|
|
201
|
+
return tuiIsFormFieldElement(document.activeElement)
|
|
202
|
+
? document.activeElement.value.slice(document.activeElement.selectionStart || 0, document.activeElement.selectionEnd || 0)
|
|
203
|
+
: ((_b = getSelection()) === null || _b === void 0 ? void 0 : _b.toString()) || null;
|
|
224
204
|
}
|
|
225
205
|
|
|
226
206
|
function isCurrentTarget(_a) {
|
|
@@ -253,5 +233,5 @@ function isNodeIn(node, selector) {
|
|
|
253
233
|
* Generated bundle index. Do not edit.
|
|
254
234
|
*/
|
|
255
235
|
|
|
256
|
-
export { canScroll, containsOrAfter, getActualTarget, getClipboardDataText, getClosestElement, getDocumentOrShadowRoot, getElementObscurers, getElementOffset, getScrollParent, isCurrentTarget, isInsideIframe, isNodeIn, tuiCustomEvent,
|
|
236
|
+
export { canScroll, containsOrAfter, getActualTarget, getClipboardDataText, getClosestElement, getDocumentOrShadowRoot, getElementObscurers, getElementOffset, getScrollParent, isCurrentTarget, isInsideIframe, isNodeIn, tuiCustomEvent, tuiGetSelectedText, tuiIsFormFieldElement };
|
|
257
237
|
//# sourceMappingURL=taiga-ui-cdk-utils-dom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-cdk-utils-dom.js","sources":["ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/get-viewport-height.ts","ng://@taiga-ui/cdk/utils/dom/get-viewport-width.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts","ng://@taiga-ui/cdk/utils/dom/taiga-ui-cdk-utils-dom.ts"],"sourcesContent":["export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","/**\n * @description:\n * Cross-browser @media (height)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (height) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientHeight\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (height) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportHeight({document, innerHeight}: Window): number {\n return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);\n}\n","/**\n * @description:\n * Cross-browser @media (width)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (width) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientWidth\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (width) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportWidth({document, innerWidth}: Window): number {\n return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;SAAgB,SAAS,CACrB,OAAgB,EAChB,WAAoB,EACpB,QAAiB,EACjB,SAAkB;IAElB,OAAO,QAAQ;UACT,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC;UAClD,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CACtB,OAAgB,EAChB,WAAoB,EACpB,SAAkB;IAElB,IAAI,cAAc,GAAG,OAAO,CAAC;IAE7B,OAAO,cAAc,KAAK,WAAW,CAAC,aAAa,EAAE;QACjD,IACI,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS;aACtD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,cAAc,CAAC,YAAY,CAAC;gBAC9D,cAAc,CAAC,YAAY;gBAC3B,SAAS,CAAC,EAChB;YACE,OAAO,IAAI,CAAC;SACf;QAED,IAAI,cAAc,CAAC,aAAa,EAAE;YAC9B,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC;SACjD;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;KACJ;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;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ACdA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-cdk-utils-dom.js","sources":["ng://@taiga-ui/cdk/utils/dom/can-scroll.ts","ng://@taiga-ui/cdk/utils/dom/contains-or-after.ts","ng://@taiga-ui/cdk/utils/dom/custom-event.ts","ng://@taiga-ui/cdk/utils/dom/get-actual-target.ts","ng://@taiga-ui/cdk/utils/dom/get-clipboard-data-text.ts","ng://@taiga-ui/cdk/utils/dom/get-closest-element.ts","ng://@taiga-ui/cdk/utils/dom/get-document-or-shadow-root.ts","ng://@taiga-ui/cdk/utils/dom/get-element-obscurers.ts","ng://@taiga-ui/cdk/utils/dom/get-element-offset.ts","ng://@taiga-ui/cdk/utils/dom/get-scroll-parent.ts","ng://@taiga-ui/cdk/utils/dom/is-form-field.ts","ng://@taiga-ui/cdk/utils/dom/get-selected-text.ts","ng://@taiga-ui/cdk/utils/dom/is-current-target.ts","ng://@taiga-ui/cdk/utils/dom/is-inside-iframe.ts","ng://@taiga-ui/cdk/utils/dom/is-node-in.ts","ng://@taiga-ui/cdk/utils/dom/taiga-ui-cdk-utils-dom.ts"],"sourcesContent":["export function canScroll(\n element: Element,\n rootElement: Element,\n vertical: boolean,\n scrollEnd: boolean,\n): boolean {\n return vertical\n ? canScrollVertical(element, rootElement, scrollEnd)\n : canScrollHorizontal(element, rootElement, scrollEnd);\n}\n\nfunction canScrollVertical(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollTop) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollTop + currentElement.clientHeight) <\n currentElement.scrollHeight &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n\nfunction canScrollHorizontal(\n element: Element,\n rootElement: Element,\n scrollEnd: boolean,\n): boolean {\n let currentElement = element;\n\n while (currentElement !== rootElement.parentElement) {\n if (\n (Math.floor(currentElement.scrollLeft) > 0 && !scrollEnd) ||\n (Math.ceil(currentElement.scrollLeft + currentElement.clientWidth) <\n currentElement.scrollWidth &&\n scrollEnd)\n ) {\n return true;\n }\n\n if (currentElement.parentElement) {\n currentElement = currentElement.parentElement;\n } else {\n return false;\n }\n }\n\n return false;\n}\n","export function containsOrAfter(current: Node, node: Node): boolean {\n return (\n current.contains(node) ||\n !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING)\n );\n}\n","/** @deprecated only needed for IE, remove in 3.0 */\nexport function tuiCustomEvent<T = null>(\n name: string,\n {bubbles = false, cancelable = false, detail = null}: CustomEventInit<T | null> = {},\n documentRef: Document,\n): CustomEvent {\n if (typeof CustomEvent === 'function') {\n return new CustomEvent(name, {bubbles, cancelable, detail});\n }\n\n const customEvent = documentRef.createEvent('CustomEvent');\n\n customEvent.initCustomEvent(name, bubbles, cancelable, detail);\n\n return customEvent;\n}\n","/**\n * Gets actual target from open Shadow DOM if event happened within it\n */\nexport function getActualTarget(event: Event): Node {\n if ('composedPath' in event) {\n return (event as any).composedPath()[0];\n }\n\n return (event as any).target;\n}\n","const DEFAULT_FORMAT = 'text/plain';\n\n/**\n * Gets text from data of clipboardEvent, it also works in IE and Edge browsers\n */\nexport function getClipboardDataText(\n event: ClipboardEvent,\n format: string = DEFAULT_FORMAT,\n): string {\n return 'clipboardData' in event && event.clipboardData !== null\n ? event.clipboardData.getData(format) ||\n event.clipboardData.getData(DEFAULT_FORMAT)\n : (event as any).target.ownerDocument.defaultView.clipboardData.getData('text');\n}\n","/**\n * Gets closest element by selector i.e. {@link Element.closest}\n * @deprecated only needed for IE, remove in 3.0\n */\nexport function getClosestElement(element: Element, selector: string): Element | null {\n const closest = Element.prototype.closest;\n\n if (closest) {\n return closest.call(element, selector);\n }\n\n const matchesSelector =\n Element.prototype.matches || (Element.prototype as any).msMatchesSelector;\n\n do {\n if (matchesSelector.call(element, selector)) {\n return element;\n }\n\n (element as Element | null) = element.parentElement;\n } while (element !== null);\n\n return null;\n}\n","export function getDocumentOrShadowRoot(node: Node): DocumentOrShadowRoot {\n return 'getRootNode' in node && node.isConnected\n ? (node.getRootNode() as Document)\n : node.ownerDocument!;\n}\n","import {clamp} from '@taiga-ui/cdk/utils/math';\nimport {isPresent} from '@taiga-ui/cdk/utils/miscellaneous';\n\nimport {getDocumentOrShadowRoot} from './get-document-or-shadow-root';\n\n/**\n * Returns array of Elements covering edges of given element or null if at least one edge middle point is visible\n *\n * CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered\n */\nexport function getElementObscurers(element: Element): readonly Element[] | null {\n const {ownerDocument} = element;\n\n if (!ownerDocument || !ownerDocument.defaultView) {\n return null;\n }\n\n const {innerWidth, innerHeight} = ownerDocument.defaultView;\n const documentRef = getDocumentOrShadowRoot(element);\n const rect = element.getBoundingClientRect();\n const left = clamp(Math.round(rect.left) + 2, 0, innerWidth);\n const top = clamp(Math.round(rect.top) + 2, 0, innerHeight);\n const right = clamp(Math.round(rect.right) - 2, 0, innerWidth);\n const bottom = clamp(Math.round(rect.bottom) - 2, 0, innerHeight);\n const horizontalMiddle = clamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);\n const verticalMiddle = clamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);\n const elements = [\n documentRef.elementFromPoint(horizontalMiddle, top),\n documentRef.elementFromPoint(horizontalMiddle, bottom),\n documentRef.elementFromPoint(left, verticalMiddle),\n documentRef.elementFromPoint(right, verticalMiddle),\n ];\n const nonNull = elements.filter(isPresent);\n\n if (!nonNull.length) {\n return nonNull;\n }\n\n const filtered = nonNull.filter(el => !element.contains(el));\n\n return filtered.length === 4 ? filtered : null;\n}\n","import {tuiAssert} from '@taiga-ui/cdk/classes';\n\n/**\n * Calculates offset for an element relative to it's parent several levels above\n *\n * @param host parent element\n * @param element\n * @return object with offsetTop and offsetLeft number properties\n */\nexport function getElementOffset(\n host: Element,\n element: HTMLElement,\n): {offsetTop: number; offsetLeft: number} {\n tuiAssert.assert(host.contains(element), 'Host must contain element');\n\n let {offsetTop, offsetLeft, offsetParent} = element;\n\n // TODO: iframe warning\n while (offsetParent && offsetParent instanceof HTMLElement && offsetParent !== host) {\n offsetTop += offsetParent.offsetTop;\n offsetLeft += offsetParent.offsetLeft;\n offsetParent = offsetParent.offsetParent;\n }\n\n return {offsetTop, offsetLeft};\n}\n","/**\n * Finds nearest parent with scroll in it\n *\n * @param element initial element\n * @param vertical flag for orientation of scroll\n */\nexport function getScrollParent(\n element: Element | null,\n vertical: boolean = true,\n): Element | null {\n if (element === null) {\n return null;\n }\n\n if (vertical && element.scrollHeight > element.clientHeight) {\n return element;\n }\n\n if (!vertical && element.scrollWidth > element.clientWidth) {\n return element;\n }\n\n return getScrollParent(element.parentElement, vertical);\n}\n","export function tuiIsFormFieldElement(\n element: unknown | null,\n): element is HTMLInputElement | HTMLTextAreaElement {\n const textfield = element as Record<string, unknown> | null;\n\n return (\n !!textfield &&\n 'value' in textfield &&\n 'selectionStart' in textfield &&\n 'selectionEnd' in textfield\n );\n}\n","import {tuiIsFormFieldElement} from './is-form-field';\n\n/**\n * @description:\n * cross browser way to get selected text\n *\n * History:\n * BUG - window.getSelection() fails when text selected in a form field\n * https://bugzilla.mozilla.org/show_bug.cgi?id=85686\n */\nexport function tuiGetSelectedText({getSelection, document}: Window): string | null {\n return tuiIsFormFieldElement(document.activeElement)\n ? document.activeElement.value.slice(\n document.activeElement.selectionStart || 0,\n document.activeElement.selectionEnd || 0,\n )\n : getSelection()?.toString() || null;\n}\n","export function isCurrentTarget({target, currentTarget}: Event): boolean {\n return target === currentTarget;\n}\n","/**\n * Checks if an app is running inside <iframe /> tag\n */\nexport function isInsideIframe(windowRef: Window): boolean {\n return windowRef.parent !== windowRef;\n}\n","import {getClosestElement} from './get-closest-element';\n\n/**\n * Checks if node is inside a specific selector\n *\n * @param node\n * @param selector\n * @return true if node is inside a particular selector\n */\nexport function isNodeIn(node: Node, selector: string): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !!node.parentElement && !!getClosestElement(node.parentElement, selector)\n : node.nodeType === Node.ELEMENT_NODE &&\n !!getClosestElement(node as Element, selector);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;SAAgB,SAAS,CACrB,OAAgB,EAChB,WAAoB,EACpB,QAAiB,EACjB,SAAkB;IAElB,OAAO,QAAQ;UACT,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC;UAClD,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,iBAAiB,CACtB,OAAgB,EAChB,WAAoB,EACpB,SAAkB;IAElB,IAAI,cAAc,GAAG,OAAO,CAAC;IAE7B,OAAO,cAAc,KAAK,WAAW,CAAC,aAAa,EAAE;QACjD,IACI,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS;aACtD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,cAAc,CAAC,YAAY,CAAC;gBAC9D,cAAc,CAAC,YAAY;gBAC3B,SAAS,CAAC,EAChB;YACE,OAAO,IAAI,CAAC;SACf;QAED,IAAI,cAAc,CAAC,aAAa,EAAE;YAC9B,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC;SACjD;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;KACJ;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,mBAAmB,CACxB,OAAgB,EAChB,WAAoB,EACpB,SAAkB;IAElB,IAAI,cAAc,GAAG,OAAO,CAAC;IAE7B,OAAO,cAAc,KAAK,WAAW,CAAC,aAAa,EAAE;QACjD,IACI,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS;aACvD,IAAI,CAAC,IAA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|
},
|
|
105
|
+
{
|
|
106
|
+
from: {
|
|
107
|
+
name: 'TuiFieldErrorModule',
|
|
108
|
+
moduleSpecifier: '@taiga-ui/kit',
|
|
109
|
+
},
|
|
110
|
+
to: {
|
|
111
|
+
name: 'TuiFieldErrorPipeModule',
|
|
112
|
+
moduleSpecifier: '@taiga-ui/kit',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
105
115
|
];
|
|
@@ -25,3 +25,20 @@ export interface AttributeToDirective {
|
|
|
25
25
|
export declare const ATTRS_TO_REPLACE: ReplacementAttributes[];
|
|
26
26
|
export declare const TAGS_TO_REPLACE: ReplacementTags[];
|
|
27
27
|
export declare const ATTR_TO_DIRECTIVE: AttributeToDirective[];
|
|
28
|
+
export declare const TEMPLATE_COMMENTS: readonly [{
|
|
29
|
+
readonly tag: "tui-input-slider";
|
|
30
|
+
readonly withAttr: "pluralize";
|
|
31
|
+
readonly comment: "[pluralize] => Use [postfix] instead. See https://taiga-ui.dev/components/input-slider/API?postfix=apples";
|
|
32
|
+
}, {
|
|
33
|
+
readonly tag: "tui-input-slider";
|
|
34
|
+
readonly withAttr: "segmentsPluralize";
|
|
35
|
+
readonly comment: "See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/input-slider#slider-segments";
|
|
36
|
+
}, {
|
|
37
|
+
readonly tag: "tui-input-range";
|
|
38
|
+
readonly withAttr: "segmentsPluralize";
|
|
39
|
+
readonly comment: "See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/input-range#segments";
|
|
40
|
+
}, {
|
|
41
|
+
readonly tag: "tui-range";
|
|
42
|
+
readonly withAttr: "pluralize";
|
|
43
|
+
readonly comment: "See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/range#segments";
|
|
44
|
+
}];
|
|
@@ -51,6 +51,7 @@ exports.ATTRS_TO_REPLACE = [
|
|
|
51
51
|
from: {
|
|
52
52
|
attrName: '[quantum]',
|
|
53
53
|
withAttrsNames: ['tuiSlider'],
|
|
54
|
+
withTagNames: ['tui-slider'],
|
|
54
55
|
},
|
|
55
56
|
to: {
|
|
56
57
|
attrName: '[step]',
|
|
@@ -129,4 +130,35 @@ exports.ATTR_TO_DIRECTIVE = [
|
|
|
129
130
|
moduleSpecifier: '@taiga-ui/core',
|
|
130
131
|
},
|
|
131
132
|
},
|
|
133
|
+
{
|
|
134
|
+
componentSelector: '*',
|
|
135
|
+
inputProperty: 'scrollIntoView',
|
|
136
|
+
directive: 'tuiScrollIntoViewLink',
|
|
137
|
+
directiveModule: {
|
|
138
|
+
name: 'TuiScrollIntoViewLinkModule',
|
|
139
|
+
moduleSpecifier: '@taiga-ui/addon-doc',
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
exports.TEMPLATE_COMMENTS = [
|
|
144
|
+
{
|
|
145
|
+
tag: 'tui-input-slider',
|
|
146
|
+
withAttr: 'pluralize',
|
|
147
|
+
comment: '[pluralize] => Use [postfix] instead. See https://taiga-ui.dev/components/input-slider/API?postfix=apples',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
tag: 'tui-input-slider',
|
|
151
|
+
withAttr: 'segmentsPluralize',
|
|
152
|
+
comment: 'See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/input-slider#slider-segments',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
tag: 'tui-input-range',
|
|
156
|
+
withAttr: 'segmentsPluralize',
|
|
157
|
+
comment: 'See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/input-range#segments',
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
tag: 'tui-range',
|
|
161
|
+
withAttr: 'pluralize',
|
|
162
|
+
comment: 'See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/range#segments',
|
|
163
|
+
},
|
|
132
164
|
];
|
|
@@ -121,4 +121,34 @@ exports.TYPES_TO_RENAME = [
|
|
|
121
121
|
to: 'TuiLanguage',
|
|
122
122
|
moduleSpecifier: ['@taiga-ui/i18n'],
|
|
123
123
|
},
|
|
124
|
+
{
|
|
125
|
+
from: 'ScrollIntoViewDirective',
|
|
126
|
+
to: 'TuiScrollIntoViewLinkDirective',
|
|
127
|
+
moduleSpecifier: ['@taiga-ui/addon-doc'],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
from: 'CodeComponent',
|
|
131
|
+
to: 'TuiCodeComponent',
|
|
132
|
+
moduleSpecifier: ['@taiga-ui/addon-doc'],
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
from: 'TableBar',
|
|
136
|
+
to: 'TuiTableBar',
|
|
137
|
+
moduleSpecifier: ['@taiga-ui/addon-tablebars'],
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
from: 'InvalidDayException',
|
|
141
|
+
to: 'TuiInvalidDayException',
|
|
142
|
+
moduleSpecifier: ['@taiga-ui/cdk'],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
from: 'InvalidMonthException',
|
|
146
|
+
to: 'TuiInvalidMonthException',
|
|
147
|
+
moduleSpecifier: ['@taiga-ui/cdk'],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
from: 'InvalidYearException',
|
|
151
|
+
to: 'TuiInvalidYearException',
|
|
152
|
+
moduleSpecifier: ['@taiga-ui/cdk'],
|
|
153
|
+
},
|
|
124
154
|
];
|
|
@@ -14,22 +14,53 @@ const migrate_sliders_1 = require("./steps/migrate-sliders");
|
|
|
14
14
|
const remove_module_1 = require("./steps/remove-module");
|
|
15
15
|
const miscellaneous_1 = require("./steps/miscellaneous");
|
|
16
16
|
const replace_functions_1 = require("./steps/replace-functions");
|
|
17
|
+
const migrate_progress_1 = require("./steps/migrate-progress");
|
|
18
|
+
const colored_log_1 = require("../utils/colored-log");
|
|
17
19
|
function updateToV3(_) {
|
|
18
20
|
return (tree, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
console.info('\x1b[35m', `taiga packages will be updated to ${versions_1.TAIGA_VERSION}`);
|
|
22
|
+
const fileSystem = getFileSystem(tree);
|
|
23
|
+
colored_log_1.infoLog('replacing deep imports...');
|
|
21
24
|
replace_deep_import_1.replaceDeepImports();
|
|
25
|
+
colored_log_1.successLog('deep imports replaced');
|
|
26
|
+
colored_log_1.infoLog('replacing enums imports...');
|
|
22
27
|
replace_enums_1.replaceEnums();
|
|
28
|
+
colored_log_1.successLog('enums replaced');
|
|
29
|
+
colored_log_1.infoLog('renaming types...');
|
|
23
30
|
rename_types_1.renameTypes();
|
|
31
|
+
colored_log_1.successLog('types renamed');
|
|
32
|
+
colored_log_1.infoLog('replacing consts...');
|
|
24
33
|
replace_const_1.replaceConsts();
|
|
34
|
+
colored_log_1.successLog('constants replaced');
|
|
35
|
+
colored_log_1.infoLog('replacing services...');
|
|
25
36
|
replace_services_1.replaceServices();
|
|
37
|
+
colored_log_1.successLog('services replaced');
|
|
26
38
|
show_warnings_1.showWarnings(context);
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
colored_log_1.infoLog('migrating templates...');
|
|
40
|
+
migrate_templates_1.migrateTemplates(fileSystem);
|
|
41
|
+
colored_log_1.successLog('templates migrated');
|
|
42
|
+
fileSystem.commitEdits();
|
|
43
|
+
ng_morph_1.saveActiveProject();
|
|
44
|
+
const updatedFileSystem = getFileSystem(tree);
|
|
45
|
+
colored_log_1.infoLog('migrating sliders...');
|
|
46
|
+
migrate_sliders_1.migrateSliders(updatedFileSystem);
|
|
47
|
+
colored_log_1.successLog('sliders migrated');
|
|
48
|
+
colored_log_1.infoLog('migrating progress bars');
|
|
49
|
+
migrate_progress_1.migrateProgress(updatedFileSystem);
|
|
50
|
+
colored_log_1.successLog('progress bars migrated');
|
|
51
|
+
colored_log_1.infoLog('removing modules...');
|
|
29
52
|
remove_module_1.removeModules();
|
|
53
|
+
colored_log_1.successLog('modules removed');
|
|
54
|
+
colored_log_1.infoLog('miscellaneous migrating...');
|
|
30
55
|
replace_functions_1.replaceFunctions();
|
|
31
56
|
miscellaneous_1.miscellaneousMigrations();
|
|
57
|
+
colored_log_1.successLog('miscellaneous migrated');
|
|
32
58
|
ng_morph_1.saveActiveProject();
|
|
33
59
|
});
|
|
34
60
|
}
|
|
35
61
|
exports.updateToV3 = updateToV3;
|
|
62
|
+
function getFileSystem(tree) {
|
|
63
|
+
const project = ng_morph_1.createProject(tree, '/', '**/**.{html,ts}');
|
|
64
|
+
ng_morph_1.setActiveProject(project);
|
|
65
|
+
return project.getFileSystem().fs;
|
|
66
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ng_morph_1 = require("ng-morph");
|
|
4
|
+
const get_component_templates_1 = require("../../utils/templates/get-component-templates");
|
|
5
|
+
const elements_1 = require("../../utils/templates/elements");
|
|
6
|
+
const template_resource_1 = require("../../utils/templates/template-resource");
|
|
7
|
+
exports.DEPRECATED_PROGRESS_PIPES_REG = /\s*\|\s*tuiProgressColorSegments(Async\s*\|\s*async)?/gi;
|
|
8
|
+
const PROPERTY_FOR_DEPRECATED_PIPES = '[color]';
|
|
9
|
+
function migrateProgress(fileSystem) {
|
|
10
|
+
const templateResources = get_component_templates_1.getComponentTemplates('**/**');
|
|
11
|
+
for (const templateResource of templateResources) {
|
|
12
|
+
replaceProgressColorSegmentsPipe(templateResource, fileSystem);
|
|
13
|
+
}
|
|
14
|
+
fileSystem.commitEdits();
|
|
15
|
+
ng_morph_1.saveActiveProject();
|
|
16
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', '**/**'));
|
|
17
|
+
}
|
|
18
|
+
exports.migrateProgress = migrateProgress;
|
|
19
|
+
function replaceProgressColorSegmentsPipe(templateResource, fileSystem) {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const template = template_resource_1.getTemplateFromTemplateResource(templateResource, fileSystem);
|
|
22
|
+
const templateOffset = template_resource_1.getTemplateOffset(templateResource);
|
|
23
|
+
const path = fileSystem.resolve(template_resource_1.getPathFromTemplateResource(templateResource));
|
|
24
|
+
const recorder = fileSystem.edit(path);
|
|
25
|
+
const progressElements = elements_1.findElementsWithAttribute(template, PROPERTY_FOR_DEPRECATED_PIPES).filter(isProgressWithDeprecatedPipe);
|
|
26
|
+
for (const progressEl of progressElements) {
|
|
27
|
+
const oldValue = ((_a = progressEl.attrs.find(attr => attr.name === PROPERTY_FOR_DEPRECATED_PIPES)) === null || _a === void 0 ? void 0 : _a.value) || '';
|
|
28
|
+
const newValue = oldValue.replace(exports.DEPRECATED_PROGRESS_PIPES_REG, '');
|
|
29
|
+
const attrLocations = (_b = progressEl.sourceCodeLocation) === null || _b === void 0 ? void 0 : _b.attrs;
|
|
30
|
+
if (attrLocations) {
|
|
31
|
+
const { startOffset, endOffset } = attrLocations[PROPERTY_FOR_DEPRECATED_PIPES];
|
|
32
|
+
recorder.remove(templateOffset + startOffset, endOffset - startOffset);
|
|
33
|
+
recorder.insertRight(templateOffset + startOffset, `[tuiProgressColorSegments]="${newValue}"`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function isProgressWithDeprecatedPipe(element) {
|
|
38
|
+
return (element.tagName === 'progress' &&
|
|
39
|
+
element.attrs.some(attr => attr.name === PROPERTY_FOR_DEPRECATED_PIPES &&
|
|
40
|
+
attr.value.match(exports.DEPRECATED_PROGRESS_PIPES_REG)));
|
|
41
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function migrateSliders(
|
|
1
|
+
import { DevkitFileSystem } from 'ng-morph/project/classes/devkit-file-system';
|
|
2
|
+
export declare function migrateSliders(fileSystem: DevkitFileSystem): void;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const migrate_input_slider_1 = require("./migrate-input-slider");
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const migrate_input_range_1 = require("./migrate-input-range");
|
|
5
|
+
function migrateSliders(fileSystem) {
|
|
6
|
+
migrate_input_slider_1.migrateInputSlider(fileSystem);
|
|
7
|
+
migrate_input_range_1.migrateInputRange(fileSystem);
|
|
6
8
|
}
|
|
7
9
|
exports.migrateSliders = migrateSliders;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
|
|
4
|
+
const ng_component_input_manipulations_1 = require("../../../utils/templates/ng-component-input-manipulations");
|
|
5
|
+
const ng_morph_1 = require("ng-morph");
|
|
6
|
+
const ng_component_1 = require("../../../utils/angular/ng-component");
|
|
7
|
+
const add_unique_import_1 = require("../../../utils/add-unique-import");
|
|
8
|
+
const MIN_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationInputRangeMinLabel';
|
|
9
|
+
const MAX_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationInputRangeMaxLabel';
|
|
10
|
+
function migrateInputRange(fileSystem) {
|
|
11
|
+
const templateResources = get_component_templates_1.getComponentTemplates('**/**');
|
|
12
|
+
const COMPONENTS_WITH_MIN_LABELS = new Set();
|
|
13
|
+
const COMPONENTS_WITH_MAX_LABELS = new Set();
|
|
14
|
+
for (const templateResource of templateResources) {
|
|
15
|
+
replaceMinLabel(templateResource, fileSystem, COMPONENTS_WITH_MIN_LABELS);
|
|
16
|
+
replaceMaxLabel(templateResource, fileSystem, COMPONENTS_WITH_MAX_LABELS);
|
|
17
|
+
}
|
|
18
|
+
save(fileSystem);
|
|
19
|
+
for (const componentPath of COMPONENTS_WITH_MIN_LABELS) {
|
|
20
|
+
addMinMaxLabelMethod(componentPath, MIN_LABELS_MIGRATION_METHOD_NAME, [
|
|
21
|
+
'const currentValue = context.$implicit;',
|
|
22
|
+
'const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input-range',
|
|
23
|
+
'const minLabelText = "Min"; // TODO: (Taiga UI migration) replace with the required label',
|
|
24
|
+
'if (currentValue === minValue) return minLabelText;',
|
|
25
|
+
'return String(currentValue);',
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
28
|
+
for (const componentPath of COMPONENTS_WITH_MAX_LABELS) {
|
|
29
|
+
addMinMaxLabelMethod(componentPath, MAX_LABELS_MIGRATION_METHOD_NAME, [
|
|
30
|
+
'const currentValue = context.$implicit;',
|
|
31
|
+
'const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input',
|
|
32
|
+
'const maxLabelText = "Max"; // TODO: (Taiga UI migration) replace with the required label',
|
|
33
|
+
'if (currentValue === maxValue) return maxLabelText;',
|
|
34
|
+
'return String(currentValue);',
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.migrateInputRange = migrateInputRange;
|
|
39
|
+
function replaceMinLabel(templateResource, fileSystem, modifiedComponentStorage) {
|
|
40
|
+
const wasModified = ng_component_input_manipulations_1.replaceInputProperty({
|
|
41
|
+
templateResource,
|
|
42
|
+
fileSystem,
|
|
43
|
+
componentSelector: 'tui-input-range',
|
|
44
|
+
from: 'minLabel',
|
|
45
|
+
to: '[leftValueContent]',
|
|
46
|
+
newValue: MIN_LABELS_MIGRATION_METHOD_NAME,
|
|
47
|
+
});
|
|
48
|
+
if (wasModified) {
|
|
49
|
+
modifiedComponentStorage.add(templateResource.componentPath);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function replaceMaxLabel(templateResource, fileSystem, modifiedComponentStorage) {
|
|
53
|
+
const wasModified = ng_component_input_manipulations_1.replaceInputProperty({
|
|
54
|
+
templateResource,
|
|
55
|
+
fileSystem,
|
|
56
|
+
componentSelector: 'tui-input-range',
|
|
57
|
+
from: 'maxLabel',
|
|
58
|
+
to: '[rightValueContent]',
|
|
59
|
+
newValue: MAX_LABELS_MIGRATION_METHOD_NAME,
|
|
60
|
+
});
|
|
61
|
+
if (wasModified) {
|
|
62
|
+
modifiedComponentStorage.add(templateResource.componentPath);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function addMinMaxLabelMethod(componentPath, methodName, methodCode) {
|
|
66
|
+
const [ngComponent] = ng_component_1.getNgComponents(componentPath);
|
|
67
|
+
if (ngComponent) {
|
|
68
|
+
add_unique_import_1.addUniqueImport(ngComponent.getSourceFile().getFilePath(), 'TuiContextWithImplicit', '@taiga-ui/cdk');
|
|
69
|
+
ng_morph_1.addMethods(ngComponent, {
|
|
70
|
+
name: methodName,
|
|
71
|
+
returnType: 'string',
|
|
72
|
+
parameters: [{ name: 'context', type: 'TuiContextWithImplicit<number>' }],
|
|
73
|
+
statements: methodCode,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* We should update virtual file tree after template manipulations
|
|
79
|
+
* otherwise all following ng-morph commands will overwrite all previous template manipulations
|
|
80
|
+
* */
|
|
81
|
+
function save(fileSystem) {
|
|
82
|
+
fileSystem.commitEdits();
|
|
83
|
+
ng_morph_1.saveActiveProject();
|
|
84
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', '**/**'));
|
|
85
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function migrateInputSlider(
|
|
1
|
+
import { DevkitFileSystem } from 'ng-morph/project/classes/devkit-file-system';
|
|
2
|
+
export declare function migrateInputSlider(fileSystem: DevkitFileSystem): void;
|