@cuby-ui/cdk 0.0.487 → 0.0.488
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/constants/empty.d.ts +10 -0
- package/constants/handlers.d.ts +8 -0
- package/constants/index.d.ts +4 -0
- package/constants/svg-node-filter.d.ts +1 -0
- package/constants/units.d.ts +17 -0
- package/date-time/index.d.ts +1 -0
- package/date-time/time.d.ts +14 -0
- package/directives/active-zone/active-zone.directive.d.ts +22 -0
- package/directives/active-zone/index.d.ts +1 -0
- package/directives/auto-resizing.directive.d.ts +18 -0
- package/directives/click-outside.directive.d.ts +9 -0
- package/directives/content-editable-value-accessor.directive.d.ts +17 -0
- package/directives/dimensions-observer.directive.d.ts +13 -0
- package/directives/drag-drop/drag-drop.directive.d.ts +42 -0
- package/directives/drag-drop/drag-drop.options.d.ts +11 -0
- package/directives/drag-drop/drag-list.directive.d.ts +10 -0
- package/directives/drag-drop/drag-pointer.directive.d.ts +8 -0
- package/directives/drag-drop/index.d.ts +4 -0
- package/directives/element.directive.d.ts +8 -0
- package/directives/focus-trap.directive.d.ts +14 -0
- package/directives/handle-scroll.directive.d.ts +23 -0
- package/directives/hovered/hovered.directive.d.ts +7 -0
- package/directives/hovered/hovered.service.d.ts +12 -0
- package/directives/hovered/index.d.ts +2 -0
- package/directives/index.d.ts +17 -0
- package/directives/item.directive.d.ts +5 -0
- package/directives/ladder-list.directive.d.ts +13 -0
- package/directives/let.context.d.ts +9 -0
- package/directives/let.directive.d.ts +9 -0
- package/directives/target.directive.d.ts +14 -0
- package/directives/typed-template.directive.d.ts +13 -0
- package/directives/typed-template.options.d.ts +3 -0
- package/esm2022/constants/empty.mjs +24 -0
- package/esm2022/constants/handlers.mjs +11 -0
- package/esm2022/constants/index.mjs +5 -0
- package/esm2022/constants/svg-node-filter.mjs +6 -0
- package/esm2022/constants/units.mjs +64 -0
- package/esm2022/cuby-ui-cdk.mjs +5 -0
- package/esm2022/date-time/index.mjs +2 -0
- package/esm2022/date-time/time.mjs +72 -0
- package/esm2022/directives/active-zone/active-zone.directive.mjs +75 -0
- package/esm2022/directives/active-zone/index.mjs +2 -0
- package/esm2022/directives/auto-resizing.directive.mjs +64 -0
- package/esm2022/directives/click-outside.directive.mjs +29 -0
- package/esm2022/directives/content-editable-value-accessor.directive.mjs +44 -0
- package/esm2022/directives/dimensions-observer.directive.mjs +32 -0
- package/esm2022/directives/drag-drop/drag-drop.directive.mjs +184 -0
- package/esm2022/directives/drag-drop/drag-drop.options.mjs +2 -0
- package/esm2022/directives/drag-drop/drag-list.directive.mjs +22 -0
- package/esm2022/directives/drag-drop/drag-pointer.directive.mjs +20 -0
- package/esm2022/directives/drag-drop/index.mjs +4 -0
- package/esm2022/directives/element.directive.mjs +19 -0
- package/esm2022/directives/focus-trap.directive.mjs +50 -0
- package/esm2022/directives/handle-scroll.directive.mjs +81 -0
- package/esm2022/directives/hovered/hovered.directive.mjs +21 -0
- package/esm2022/directives/hovered/hovered.service.mjs +32 -0
- package/esm2022/directives/hovered/index.mjs +3 -0
- package/esm2022/directives/index.mjs +18 -0
- package/esm2022/directives/item.directive.mjs +14 -0
- package/esm2022/directives/ladder-list.directive.mjs +42 -0
- package/esm2022/directives/let.context.mjs +12 -0
- package/esm2022/directives/let.directive.mjs +23 -0
- package/esm2022/directives/target.directive.mjs +36 -0
- package/esm2022/directives/typed-template.directive.mjs +27 -0
- package/esm2022/directives/typed-template.options.mjs +2 -0
- package/esm2022/index.mjs +12 -0
- package/esm2022/interfaces/dimensions.mjs +2 -0
- package/esm2022/interfaces/index.mjs +4 -0
- package/esm2022/interfaces/on-change.mjs +2 -0
- package/esm2022/interfaces/on-touched.mjs +2 -0
- package/esm2022/models/consumption-units.mjs +2 -0
- package/esm2022/models/index.mjs +2 -0
- package/esm2022/observables/if-map.mjs +5 -0
- package/esm2022/observables/index.mjs +5 -0
- package/esm2022/observables/typed-from-event.mjs +9 -0
- package/esm2022/observables/watch.mjs +6 -0
- package/esm2022/observables/zone.mjs +34 -0
- package/esm2022/pipes/filter.pipe.mjs +17 -0
- package/esm2022/pipes/index.mjs +2 -0
- package/esm2022/services/consumption-units.service.mjs +67 -0
- package/esm2022/services/destroy.service.mjs +15 -0
- package/esm2022/services/id.service.mjs +21 -0
- package/esm2022/services/index.mjs +5 -0
- package/esm2022/services/popover.service.mjs +41 -0
- package/esm2022/tokens/active-element.mjs +52 -0
- package/esm2022/tokens/animation-frame.mjs +21 -0
- package/esm2022/tokens/environment.mjs +47 -0
- package/esm2022/tokens/history.mjs +5 -0
- package/esm2022/tokens/index.mjs +11 -0
- package/esm2022/tokens/local-storage.mjs +5 -0
- package/esm2022/tokens/navigator.mjs +6 -0
- package/esm2022/tokens/removed-element.mjs +19 -0
- package/esm2022/tokens/session-storage.mjs +5 -0
- package/esm2022/tokens/user-agent.mjs +6 -0
- package/esm2022/tokens/window.mjs +11 -0
- package/esm2022/types/context.mjs +2 -0
- package/esm2022/types/date-time.mjs +2 -0
- package/esm2022/types/handler.mjs +2 -0
- package/esm2022/types/index.mjs +9 -0
- package/esm2022/types/input-type.mjs +2 -0
- package/esm2022/types/mapper.mjs +2 -0
- package/esm2022/types/matcher.mjs +2 -0
- package/esm2022/types/nullable.mjs +2 -0
- package/esm2022/types/value-of.mjs +2 -0
- package/esm2022/utils/dom/contains-or-after.mjs +9 -0
- package/esm2022/utils/dom/element-checks.mjs +20 -0
- package/esm2022/utils/dom/get-actual-target.mjs +7 -0
- package/esm2022/utils/dom/get-document-or-shadow-root.mjs +6 -0
- package/esm2022/utils/dom/get-element-obscurers.mjs +42 -0
- package/esm2022/utils/dom/index.mjs +8 -0
- package/esm2022/utils/dom/inject-element.mjs +5 -0
- package/esm2022/utils/dom/point-to-client-rect.mjs +17 -0
- package/esm2022/utils/files/files.uploader.mjs +19 -0
- package/esm2022/utils/files/index.mjs +3 -0
- package/esm2022/utils/files/take-capture-from-video.mjs +25 -0
- package/esm2022/utils/focus/blur-native-focused.mjs +9 -0
- package/esm2022/utils/focus/get-closest-focusable.mjs +22 -0
- package/esm2022/utils/focus/get-native-focused.mjs +11 -0
- package/esm2022/utils/focus/index.mjs +7 -0
- package/esm2022/utils/focus/is-native-focused.mjs +13 -0
- package/esm2022/utils/focus/is-native-keyboard-focusable.mjs +26 -0
- package/esm2022/utils/focus/is-native-mouse-focusable.mjs +6 -0
- package/esm2022/utils/index.mjs +8 -0
- package/esm2022/utils/math/clamp.mjs +11 -0
- package/esm2022/utils/math/index.mjs +2 -0
- package/esm2022/utils/miscellaneous/array-remove.mjs +4 -0
- package/esm2022/utils/miscellaneous/index.mjs +6 -0
- package/esm2022/utils/miscellaneous/is-present.mjs +4 -0
- package/esm2022/utils/miscellaneous/move-item-in-array.mjs +10 -0
- package/esm2022/utils/miscellaneous/pure.mjs +81 -0
- package/esm2022/utils/miscellaneous/px.mjs +7 -0
- package/esm2022/utils/platform/index.mjs +2 -0
- package/esm2022/utils/platform/is-ios.mjs +6 -0
- package/esm2022/utils/token/create-token.mjs +8 -0
- package/esm2022/utils/token/index.mjs +3 -0
- package/esm2022/utils/token/provide.mjs +4 -0
- package/fesm2022/cuby-ui-cdk.mjs +1644 -0
- package/fesm2022/cuby-ui-cdk.mjs.map +1 -0
- package/index.d.ts +11 -0
- package/interfaces/dimensions.d.ts +4 -0
- package/interfaces/index.d.ts +3 -0
- package/interfaces/on-change.d.ts +3 -0
- package/interfaces/on-touched.d.ts +3 -0
- package/models/consumption-units.d.ts +14 -0
- package/models/index.d.ts +1 -0
- package/observables/if-map.d.ts +3 -0
- package/observables/index.d.ts +4 -0
- package/observables/typed-from-event.d.ts +16 -0
- package/observables/watch.d.ts +3 -0
- package/observables/zone.d.ts +7 -0
- package/package.json +1 -4
- package/pipes/filter.pipe.d.ts +8 -0
- package/pipes/index.d.ts +1 -0
- package/services/consumption-units.service.d.ts +13 -0
- package/services/destroy.service.d.ts +8 -0
- package/services/id.service.d.ts +8 -0
- package/services/index.d.ts +4 -0
- package/services/popover.service.d.ts +23 -0
- package/tokens/active-element.d.ts +5 -0
- package/tokens/animation-frame.d.ts +3 -0
- package/tokens/environment.d.ts +19 -0
- package/tokens/history.d.ts +1 -0
- package/tokens/index.d.ts +10 -0
- package/tokens/local-storage.d.ts +1 -0
- package/tokens/navigator.d.ts +2 -0
- package/tokens/removed-element.d.ts +4 -0
- package/tokens/session-storage.d.ts +1 -0
- package/tokens/user-agent.d.ts +2 -0
- package/tokens/window.d.ts +1 -0
- package/types/context.d.ts +3 -0
- package/types/date-time.d.ts +1 -0
- package/types/handler.d.ts +4 -0
- package/types/index.d.ts +8 -0
- package/types/input-type.d.ts +1 -0
- package/types/mapper.d.ts +1 -0
- package/types/matcher.d.ts +2 -0
- package/types/nullable.d.ts +1 -0
- package/types/value-of.d.ts +1 -0
- package/utils/dom/contains-or-after.d.ts +1 -0
- package/utils/dom/element-checks.d.ts +6 -0
- package/utils/dom/get-actual-target.d.ts +4 -0
- package/utils/dom/get-document-or-shadow-root.d.ts +1 -0
- package/utils/dom/get-element-obscurers.d.ts +9 -0
- package/utils/dom/index.d.ts +7 -0
- package/utils/dom/inject-element.d.ts +1 -0
- package/utils/dom/point-to-client-rect.d.ts +1 -0
- package/utils/files/files.uploader.d.ts +5 -0
- package/utils/files/index.d.ts +2 -0
- package/utils/files/take-capture-from-video.d.ts +1 -0
- package/utils/focus/blur-native-focused.d.ts +1 -0
- package/utils/focus/get-closest-focusable.d.ts +7 -0
- package/utils/focus/get-native-focused.d.ts +1 -0
- package/utils/focus/index.d.ts +6 -0
- package/utils/focus/is-native-focused.d.ts +9 -0
- package/utils/focus/is-native-keyboard-focusable.d.ts +1 -0
- package/utils/focus/is-native-mouse-focusable.d.ts +1 -0
- package/utils/index.d.ts +7 -0
- package/utils/math/clamp.d.ts +8 -0
- package/utils/math/index.d.ts +1 -0
- package/utils/miscellaneous/array-remove.d.ts +1 -0
- package/utils/miscellaneous/index.d.ts +5 -0
- package/utils/miscellaneous/is-present.d.ts +1 -0
- package/utils/miscellaneous/move-item-in-array.d.ts +1 -0
- package/utils/miscellaneous/pure.d.ts +21 -0
- package/utils/miscellaneous/px.d.ts +4 -0
- package/utils/platform/index.d.ts +1 -0
- package/utils/platform/is-ios.d.ts +3 -0
- package/utils/token/create-token.d.ts +3 -0
- package/utils/token/index.d.ts +2 -0
- package/utils/token/provide.d.ts +3 -0
|
@@ -0,0 +1,1644 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { QueryList, inject, ChangeDetectorRef, NgZone, InjectionToken, ElementRef, Directive, Output, Input, Injectable, Renderer2, signal, input, output, HostListener, EventEmitter, HostBinding, ViewContainerRef, TemplateRef, effect, Pipe } from '@angular/core';
|
|
3
|
+
import { __decorate, __metadata } from 'tslib';
|
|
4
|
+
import { NgControl, NgModel, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
+
import { pipe, switchMap, EMPTY, fromEvent, tap, Observable, asyncScheduler, BehaviorSubject, timer, map, startWith, share, merge, filter, takeUntil, repeat, withLatestFrom, of, take, distinctUntilChanged, skip, Subject, interval } from 'rxjs';
|
|
6
|
+
import { DOCUMENT } from '@angular/common';
|
|
7
|
+
import { ɵAnimationEngine as _AnimationEngine } from '@angular/animations/browser';
|
|
8
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
9
|
+
|
|
10
|
+
const rect = {
|
|
11
|
+
bottom: 0,
|
|
12
|
+
height: 0,
|
|
13
|
+
left: 0,
|
|
14
|
+
right: 0,
|
|
15
|
+
top: 0,
|
|
16
|
+
width: 0,
|
|
17
|
+
x: 0,
|
|
18
|
+
y: 0
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* For type safety when using @ContentChildren and @ViewChildren
|
|
22
|
+
*
|
|
23
|
+
* NOTE: Be careful subscribing to 'changes'
|
|
24
|
+
*/
|
|
25
|
+
const EMPTY_QUERY = new QueryList();
|
|
26
|
+
const EMPTY_ARRAY = [];
|
|
27
|
+
const EMPTY_FUNCTION = () => { };
|
|
28
|
+
const EMPTY_CLIENT_RECT = {
|
|
29
|
+
...rect,
|
|
30
|
+
toJSON: () => rect
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Handler that always returns `false`.
|
|
35
|
+
*/
|
|
36
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
37
|
+
const CUI_FALSE_HANDLER = () => false;
|
|
38
|
+
/**
|
|
39
|
+
* Handler that always returns `true`.
|
|
40
|
+
*/
|
|
41
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
42
|
+
const CUI_TRUE_HANDLER = () => true;
|
|
43
|
+
|
|
44
|
+
const UnitsMetricWeight = [
|
|
45
|
+
{ label: 'kilogram (kg)', abbreviation: 'kg', value: 'KILOGRAM' },
|
|
46
|
+
{ label: 'gram', abbreviation: 'g', value: 'G' },
|
|
47
|
+
{ label: 'ton', abbreviation: 'tn', value: 'TONNE' }
|
|
48
|
+
];
|
|
49
|
+
const UnitsImperialWeight = [
|
|
50
|
+
{ label: 'ounce', abbreviation: 'oz', value: 'OZ' },
|
|
51
|
+
{ label: 'pound', abbreviation: 'lb', value: 'POUND' },
|
|
52
|
+
{ label: 'ton', abbreviation: 'tn', value: 'TON_US' }
|
|
53
|
+
];
|
|
54
|
+
const UnitsMetricLength = [
|
|
55
|
+
{ label: 'meter', abbreviation: 'm', value: 'METER' },
|
|
56
|
+
{ label: 'millimeter', abbreviation: 'mm', value: 'MILLI_METER' },
|
|
57
|
+
{ label: 'centimeter', abbreviation: 'cm', value: 'CENTI_METER' }
|
|
58
|
+
// { label: 'kilometer', abbreviation: 'km', value: 'KILO_METER' },
|
|
59
|
+
];
|
|
60
|
+
const UnitsImperialLength = [
|
|
61
|
+
{ label: 'foot', abbreviation: 'ft', value: 'FOOT' },
|
|
62
|
+
{ label: 'inch', abbreviation: 'i', value: 'INCH' },
|
|
63
|
+
{ label: 'yard', abbreviation: 'yd', value: 'YARD' }
|
|
64
|
+
// { label: 'mile', abbreviation: 'm', value: 'MILE' },
|
|
65
|
+
];
|
|
66
|
+
const UnitsMetricVolume = [
|
|
67
|
+
{ label: 'litre', abbreviation: 'l', value: 'LITRE' },
|
|
68
|
+
{ label: 'millilitre', abbreviation: 'ml', value: 'MILLI_LITRE' },
|
|
69
|
+
{ label: 'cubic metre', abbreviation: 'm³', value: 'CUBIC_METRE' }
|
|
70
|
+
];
|
|
71
|
+
const UnitsImperialVolume = [
|
|
72
|
+
{ label: 'gallon liquid', abbreviation: 'gl', value: 'GALLON_LIQUID' },
|
|
73
|
+
{ label: 'gallon dry', abbreviation: 'gd', value: 'GALLON_DRY' },
|
|
74
|
+
{ label: 'fluid ounce', abbreviation: 'fo', value: 'FLUID_OUNCE' },
|
|
75
|
+
{ label: 'barrel', abbreviation: 'b', value: 'BARREL' },
|
|
76
|
+
{ label: 'pint', abbreviation: 'p', value: 'PINT' }
|
|
77
|
+
];
|
|
78
|
+
const UnitsMetricSquare = [
|
|
79
|
+
{ label: 'sq. meter', abbreviation: 'm²', value: 'SQUARE_METRE', initial: 'METER' },
|
|
80
|
+
{ label: 'sq. millimeter', abbreviation: 'mm²', value: 'SQUARE_MILLI', initial: 'MILLI_METER' },
|
|
81
|
+
{ label: 'sq. centimeter', abbreviation: 'cm²', value: 'SQUARE_CENTI', initial: 'CENTI_METER' }
|
|
82
|
+
];
|
|
83
|
+
const UnitsImperialSquare = [
|
|
84
|
+
{ label: 'sq. foot', abbreviation: 'ft²', value: 'SQUARE_FOOT', initial: 'FOOT' },
|
|
85
|
+
{ label: 'sq. inch', abbreviation: 'inch²', value: 'SQUARE_INCH', initial: 'INCH' },
|
|
86
|
+
{ label: 'sq. yard', abbreviation: 'yard²', value: 'SQUARE_YARD', initial: 'YARD' }
|
|
87
|
+
];
|
|
88
|
+
const UnitsAmount = [{ label: 'pieces', value: 'PIECES', abbreviation: 'pcs' }];
|
|
89
|
+
const UnitsMetric = {
|
|
90
|
+
["LENGTH" /* Consumption.Length */]: UnitsMetricLength,
|
|
91
|
+
["SQUARE" /* Consumption.Square */]: UnitsMetricSquare,
|
|
92
|
+
["VOLUME" /* Consumption.Volume */]: UnitsMetricVolume,
|
|
93
|
+
["WEIGHT" /* Consumption.Weight */]: UnitsMetricWeight,
|
|
94
|
+
["AMOUNT" /* Consumption.Amount */]: UnitsAmount
|
|
95
|
+
};
|
|
96
|
+
const UnitsImperial = {
|
|
97
|
+
["LENGTH" /* Consumption.Length */]: UnitsImperialLength,
|
|
98
|
+
["SQUARE" /* Consumption.Square */]: UnitsImperialSquare,
|
|
99
|
+
["VOLUME" /* Consumption.Volume */]: UnitsImperialVolume,
|
|
100
|
+
["WEIGHT" /* Consumption.Weight */]: UnitsImperialWeight,
|
|
101
|
+
["AMOUNT" /* Consumption.Amount */]: UnitsAmount
|
|
102
|
+
};
|
|
103
|
+
const SystemUnits = {
|
|
104
|
+
["METRIC" /* UnitsSystem.Metric */]: UnitsMetric,
|
|
105
|
+
["IMPERIAL" /* UnitsSystem.Imperial */]: UnitsImperial
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const svgNodeFilter = {
|
|
109
|
+
acceptNode(node) {
|
|
110
|
+
return 'ownerSVGElement' in node ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
class CuiTime {
|
|
115
|
+
constructor(hours, minutes, seconds = 0, ms = 0) {
|
|
116
|
+
this.hours = hours;
|
|
117
|
+
this.minutes = minutes;
|
|
118
|
+
this.seconds = seconds;
|
|
119
|
+
this.ms = ms;
|
|
120
|
+
}
|
|
121
|
+
static fromString(time) {
|
|
122
|
+
const hours = this.parseHours(time);
|
|
123
|
+
const minutes = Number(time.slice(3, 5)) || 0;
|
|
124
|
+
const seconds = Number(time.slice(6, 8)) || 0;
|
|
125
|
+
const ms = Number(time.slice(9, 12)) || 0;
|
|
126
|
+
return new CuiTime(hours, minutes, seconds, ms);
|
|
127
|
+
}
|
|
128
|
+
static fromPT(time) {
|
|
129
|
+
let duration = time.trim().toUpperCase();
|
|
130
|
+
if (!duration.startsWith('P')) {
|
|
131
|
+
throw new Error('Invalid PT format: does not start with P');
|
|
132
|
+
}
|
|
133
|
+
duration = duration.substring(1);
|
|
134
|
+
if (duration.startsWith('T')) {
|
|
135
|
+
duration = duration.substring(1);
|
|
136
|
+
}
|
|
137
|
+
const regex = /(\d+(\.\d+)?)([HMS])/g;
|
|
138
|
+
let match;
|
|
139
|
+
let hours = 0, minutes = 0, seconds = 0, ms = 0;
|
|
140
|
+
while ((match = regex.exec(duration)) !== null) {
|
|
141
|
+
const value = parseFloat(match[1]);
|
|
142
|
+
const unit = match[3];
|
|
143
|
+
if (unit === 'H') {
|
|
144
|
+
hours = value;
|
|
145
|
+
}
|
|
146
|
+
else if (unit === 'M') {
|
|
147
|
+
minutes = value;
|
|
148
|
+
}
|
|
149
|
+
else if (unit === 'S') {
|
|
150
|
+
seconds = Math.floor(value);
|
|
151
|
+
ms = Math.round((value - seconds) * 1000);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return new CuiTime(hours, minutes, seconds, ms);
|
|
155
|
+
}
|
|
156
|
+
static parseHours(time) {
|
|
157
|
+
return Number(time.slice(0, 2));
|
|
158
|
+
}
|
|
159
|
+
toString(mode) {
|
|
160
|
+
const needAddMs = mode?.startsWith('HH:MM:SS.MSS') || (!mode && this.ms > 0);
|
|
161
|
+
const needAddSeconds = needAddMs || mode?.startsWith('HH:MM:SS') || (!mode && this.seconds > 0);
|
|
162
|
+
const hhMm = `${this.formatTime(this.hours)}:${this.formatTime(this.minutes)}`;
|
|
163
|
+
const ss = needAddSeconds ? `:${this.formatTime(this.seconds)}` : '';
|
|
164
|
+
const mss = needAddMs ? `.${this.formatTime(this.ms, 3)}` : '';
|
|
165
|
+
return `${hhMm}${ss}${mss}`;
|
|
166
|
+
}
|
|
167
|
+
toPT(mode) {
|
|
168
|
+
let duration = 'PT';
|
|
169
|
+
if (this.hours !== 0) {
|
|
170
|
+
duration += `${this.hours}H`;
|
|
171
|
+
}
|
|
172
|
+
if (this.minutes !== 0) {
|
|
173
|
+
duration += `${this.minutes}M`;
|
|
174
|
+
}
|
|
175
|
+
const totalSeconds = this.seconds + this.ms / 1000;
|
|
176
|
+
if (totalSeconds !== 0 || duration === 'PT') {
|
|
177
|
+
duration += `${parseFloat(totalSeconds.toFixed(3))}S`;
|
|
178
|
+
}
|
|
179
|
+
return duration;
|
|
180
|
+
}
|
|
181
|
+
formatTime(time, digits = 2) {
|
|
182
|
+
return String(time).padStart(digits, '0');
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function cuiIfMap(project, predicate = Boolean) {
|
|
187
|
+
return pipe(switchMap((value) => (predicate(value) ? project(value) : EMPTY)));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function cuiTypedFromEvent(target, event, options = {}) {
|
|
191
|
+
/**
|
|
192
|
+
* @note:
|
|
193
|
+
* in RxJS 7 type signature `CuiTypedEventTarget<E>` !== `HasEventTargetAddRemove<E>`
|
|
194
|
+
*/
|
|
195
|
+
return fromEvent(target, event, options);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function cuiWatch(cdr = inject(ChangeDetectorRef)) {
|
|
199
|
+
return tap(() => cdr.markForCheck());
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function cuiZonefull(zone = inject(NgZone)) {
|
|
203
|
+
return (source) => new Observable((subscriber) => source.subscribe({
|
|
204
|
+
next: (value) => zone.run(() => subscriber.next(value)),
|
|
205
|
+
error: (error) => zone.run(() => subscriber.error(error)),
|
|
206
|
+
complete: () => zone.run(() => subscriber.complete())
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
function cuiZonefree(zone = inject(NgZone)) {
|
|
210
|
+
return (source) => new Observable((subscriber) => zone.runOutsideAngular(() => source.subscribe(subscriber)));
|
|
211
|
+
}
|
|
212
|
+
function cuiZoneOptimized(zone = inject(NgZone)) {
|
|
213
|
+
return pipe(cuiZonefree(zone), cuiZonefull(zone));
|
|
214
|
+
}
|
|
215
|
+
class CuiZoneScheduler {
|
|
216
|
+
constructor(zoneConditionFn, scheduler = asyncScheduler) {
|
|
217
|
+
this.zoneConditionFn = zoneConditionFn;
|
|
218
|
+
this.scheduler = scheduler;
|
|
219
|
+
}
|
|
220
|
+
now() {
|
|
221
|
+
return this.scheduler.now();
|
|
222
|
+
}
|
|
223
|
+
schedule(...args) {
|
|
224
|
+
return this.zoneConditionFn(() => this.scheduler.schedule(...args));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function cuiZonefreeScheduler(zone = inject(NgZone), scheduler = asyncScheduler) {
|
|
228
|
+
return new CuiZoneScheduler(zone.runOutsideAngular.bind(zone), scheduler);
|
|
229
|
+
}
|
|
230
|
+
function cuiZonefullScheduler(zone = inject(NgZone), scheduler = asyncScheduler) {
|
|
231
|
+
return new CuiZoneScheduler(zone.run.bind(zone), scheduler);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function cuiCreateToken(defaults) {
|
|
235
|
+
return cuiCreateTokenFromFactory(() => defaults);
|
|
236
|
+
}
|
|
237
|
+
function cuiCreateTokenFromFactory(factory) {
|
|
238
|
+
return new InjectionToken('', { factory });
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function cuiProvide(provide, useExisting, multi = false) {
|
|
242
|
+
return { provide, useExisting, multi };
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const CUI_WINDOW = cuiCreateTokenFromFactory(() => {
|
|
246
|
+
const { defaultView } = inject(DOCUMENT);
|
|
247
|
+
if (!defaultView) {
|
|
248
|
+
throw new Error('Window is not available');
|
|
249
|
+
}
|
|
250
|
+
return defaultView;
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
function cuiContainsOrAfter(current, node) {
|
|
254
|
+
try {
|
|
255
|
+
return current.contains(node) || !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING);
|
|
256
|
+
}
|
|
257
|
+
catch {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function cuiIsInput(element) {
|
|
263
|
+
return element.matches('input');
|
|
264
|
+
}
|
|
265
|
+
function cuiIsTextarea(element) {
|
|
266
|
+
return element.matches('textarea');
|
|
267
|
+
}
|
|
268
|
+
function cuiIsTextfield(element) {
|
|
269
|
+
return cuiIsInput(element) || cuiIsTextarea(element);
|
|
270
|
+
}
|
|
271
|
+
function cuiIsElement(node) {
|
|
272
|
+
return !!node && 'nodeType' in node && node.nodeType === Node.ELEMENT_NODE;
|
|
273
|
+
}
|
|
274
|
+
function cuiIsHTMLElement(node) {
|
|
275
|
+
const defaultView = node?.ownerDocument.defaultView;
|
|
276
|
+
return !!node && !!defaultView && node instanceof defaultView.HTMLElement;
|
|
277
|
+
}
|
|
278
|
+
function cuiIsTextNode(node) {
|
|
279
|
+
return node.nodeType === Node.TEXT_NODE;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Gets actual target from open Shadow DOM if event happened within it
|
|
284
|
+
*/
|
|
285
|
+
function cuiGetActualTarget(event) {
|
|
286
|
+
return event.composedPath()[0];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function cuiGetDocumentOrShadowRoot(node) {
|
|
290
|
+
return 'getRootNode' in node && node.isConnected
|
|
291
|
+
? node.getRootNode()
|
|
292
|
+
: node.ownerDocument;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Clamps a value between two inclusive limits
|
|
297
|
+
*
|
|
298
|
+
* @param value
|
|
299
|
+
* @param min lower limit
|
|
300
|
+
* @param max upper limit
|
|
301
|
+
*/
|
|
302
|
+
function cuiClamp(value, min, max) {
|
|
303
|
+
return Math.min(max, Math.max(min, value));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function cuiMoveItemInArray(array, fromIndex, toIndex) {
|
|
307
|
+
const resultArray = [...array];
|
|
308
|
+
if (fromIndex === toIndex) {
|
|
309
|
+
return resultArray;
|
|
310
|
+
}
|
|
311
|
+
const [item] = resultArray.splice(fromIndex, 1);
|
|
312
|
+
resultArray.splice(toIndex, 0, item);
|
|
313
|
+
return resultArray;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function cuiArrayRemove(array, index) {
|
|
317
|
+
return array.slice(0, Math.max(index, 0)).concat(array.slice(Math.max(index + 1, 0)));
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function cuiIsPresent(value) {
|
|
321
|
+
return value !== null && value !== undefined;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function decorateMethod(originalMethod) {
|
|
325
|
+
let previousArgs = [];
|
|
326
|
+
let originalFnWasCalledLeastAtOnce = false;
|
|
327
|
+
let pureValue;
|
|
328
|
+
return function cuiPureMethodPatched(...args) {
|
|
329
|
+
const isPure = originalFnWasCalledLeastAtOnce &&
|
|
330
|
+
previousArgs.length === args.length &&
|
|
331
|
+
args.every((arg, index) => arg === previousArgs[index]);
|
|
332
|
+
if (isPure) {
|
|
333
|
+
return pureValue;
|
|
334
|
+
}
|
|
335
|
+
previousArgs = args;
|
|
336
|
+
pureValue = originalMethod.apply(this, args);
|
|
337
|
+
originalFnWasCalledLeastAtOnce = true;
|
|
338
|
+
return pureValue;
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
function decorateGetter(originalGetter, propertyKey, enumerable = true) {
|
|
342
|
+
return function cuiPureGetterPatched() {
|
|
343
|
+
const value = originalGetter.call(this);
|
|
344
|
+
Object.defineProperty(this, propertyKey, { enumerable, value });
|
|
345
|
+
return value;
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
function cuiPure(target, propertyKeyOrContext, descriptor) {
|
|
349
|
+
if (typeof target === 'function') {
|
|
350
|
+
const context = propertyKeyOrContext;
|
|
351
|
+
if (context.kind === 'getter') {
|
|
352
|
+
return decorateGetter(target, context.name);
|
|
353
|
+
}
|
|
354
|
+
if (context.kind === 'method') {
|
|
355
|
+
return decorateMethod(target);
|
|
356
|
+
}
|
|
357
|
+
throw new CuiPureException();
|
|
358
|
+
}
|
|
359
|
+
const { get, enumerable, value } = descriptor;
|
|
360
|
+
const propertyKey = propertyKeyOrContext;
|
|
361
|
+
if (get) {
|
|
362
|
+
return {
|
|
363
|
+
configurable: true,
|
|
364
|
+
enumerable,
|
|
365
|
+
get: decorateGetter(get, propertyKey, enumerable)
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
if (typeof value !== 'function') {
|
|
369
|
+
throw new CuiPureException();
|
|
370
|
+
}
|
|
371
|
+
const original = value;
|
|
372
|
+
return {
|
|
373
|
+
configurable: true,
|
|
374
|
+
enumerable,
|
|
375
|
+
get() {
|
|
376
|
+
let previousArgs = [];
|
|
377
|
+
let originalFnWasCalledLeastAtOnce = false;
|
|
378
|
+
let pureValue;
|
|
379
|
+
const patched = (...args) => {
|
|
380
|
+
const isPure = originalFnWasCalledLeastAtOnce &&
|
|
381
|
+
previousArgs.length === args.length &&
|
|
382
|
+
args.every((arg, index) => arg === previousArgs[index]);
|
|
383
|
+
if (isPure) {
|
|
384
|
+
return pureValue;
|
|
385
|
+
}
|
|
386
|
+
previousArgs = args;
|
|
387
|
+
pureValue = original.apply(this, args);
|
|
388
|
+
originalFnWasCalledLeastAtOnce = true;
|
|
389
|
+
return pureValue;
|
|
390
|
+
};
|
|
391
|
+
Object.defineProperty(this, propertyKey, {
|
|
392
|
+
configurable: true,
|
|
393
|
+
value: patched
|
|
394
|
+
});
|
|
395
|
+
return patched;
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
class CuiPureException extends Error {
|
|
400
|
+
constructor() {
|
|
401
|
+
super('cuiPure can only be used with functions or getters');
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Adds 'px' to the number and turns it into a string
|
|
407
|
+
*/
|
|
408
|
+
function cuiPx(value) {
|
|
409
|
+
return `${value}px`;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Returns array of Elements covering edges of given element or null if at least one edge middle point is visible
|
|
414
|
+
*
|
|
415
|
+
* CAUTION: Empty array means element if offscreen i.e. covered by no elements, rather than not covered
|
|
416
|
+
* ```ts
|
|
417
|
+
* function cuiGetElementObscures(element: Element): readonly [Element, Element, Element, Element] | [] | null
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
function cuiGetElementObscures(element) {
|
|
421
|
+
const { ownerDocument } = element;
|
|
422
|
+
if (!ownerDocument?.defaultView || !element.getBoundingClientRect) {
|
|
423
|
+
return null;
|
|
424
|
+
}
|
|
425
|
+
const { innerWidth, innerHeight } = ownerDocument.defaultView;
|
|
426
|
+
const doc = cuiGetDocumentOrShadowRoot(element);
|
|
427
|
+
const rect = element.getBoundingClientRect();
|
|
428
|
+
if (rect.width === 0 && rect.height === 0) {
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
431
|
+
const left = cuiClamp(Math.round(rect.left) + 2, 0, innerWidth);
|
|
432
|
+
const top = cuiClamp(Math.round(rect.top) + 2, 0, innerHeight);
|
|
433
|
+
const right = cuiClamp(Math.round(rect.right) - 2, 0, innerWidth);
|
|
434
|
+
const bottom = cuiClamp(Math.round(rect.bottom) - 2, 0, innerHeight);
|
|
435
|
+
const horizontalMiddle = cuiClamp(Math.round(rect.left + rect.width / 2), 0, innerWidth);
|
|
436
|
+
const verticalMiddle = cuiClamp(Math.round(rect.top + rect.height / 2), 0, innerHeight);
|
|
437
|
+
const elements = [
|
|
438
|
+
doc.elementFromPoint(horizontalMiddle, top),
|
|
439
|
+
doc.elementFromPoint(horizontalMiddle, bottom),
|
|
440
|
+
doc.elementFromPoint(left, verticalMiddle),
|
|
441
|
+
doc.elementFromPoint(right, verticalMiddle)
|
|
442
|
+
];
|
|
443
|
+
const nonNull = elements.filter(cuiIsPresent);
|
|
444
|
+
if (!nonNull.length) {
|
|
445
|
+
return [];
|
|
446
|
+
}
|
|
447
|
+
const filtered = nonNull.filter((el) => !element.contains(el) && !el.contains(element));
|
|
448
|
+
return filtered.length === 4 ? filtered : null;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function cuiInjectElement() {
|
|
452
|
+
return inject(ElementRef).nativeElement;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function cuiPointToClientRect(x = 0, y = 0) {
|
|
456
|
+
const rect = {
|
|
457
|
+
x,
|
|
458
|
+
y,
|
|
459
|
+
left: x,
|
|
460
|
+
right: x,
|
|
461
|
+
top: y,
|
|
462
|
+
bottom: y,
|
|
463
|
+
width: 0,
|
|
464
|
+
height: 0
|
|
465
|
+
};
|
|
466
|
+
return {
|
|
467
|
+
...rect,
|
|
468
|
+
toJSON: () => rect
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
function cuiGetNativeFocused({ activeElement }) {
|
|
473
|
+
if (!activeElement?.shadowRoot) {
|
|
474
|
+
return activeElement;
|
|
475
|
+
}
|
|
476
|
+
let element = activeElement.shadowRoot.activeElement;
|
|
477
|
+
while (element?.shadowRoot) {
|
|
478
|
+
element = element.shadowRoot.activeElement;
|
|
479
|
+
}
|
|
480
|
+
return element;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
function cuiBlurNativeFocused(document) {
|
|
484
|
+
const activeElement = cuiGetNativeFocused(document);
|
|
485
|
+
if (cuiIsHTMLElement(activeElement)) {
|
|
486
|
+
activeElement.blur();
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
function cuiIsNativeKeyboardFocusable(element) {
|
|
491
|
+
if (element.hasAttribute('disabled') || element.getAttribute('tabIndex') === '-1') {
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
if ((cuiIsHTMLElement(element) && element.isContentEditable) || element.getAttribute('tabIndex') === '0') {
|
|
495
|
+
return true;
|
|
496
|
+
}
|
|
497
|
+
switch (element.tagName) {
|
|
498
|
+
case 'BUTTON':
|
|
499
|
+
case 'SELECT':
|
|
500
|
+
case 'TEXTAREA':
|
|
501
|
+
return true;
|
|
502
|
+
case 'VIDEO':
|
|
503
|
+
case 'AUDIO':
|
|
504
|
+
return element.hasAttribute('controls');
|
|
505
|
+
case 'INPUT':
|
|
506
|
+
return element.getAttribute('type') !== 'hidden';
|
|
507
|
+
case 'A':
|
|
508
|
+
case 'LINK':
|
|
509
|
+
return element.hasAttribute('href');
|
|
510
|
+
default:
|
|
511
|
+
return false;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
function cuiIsNativeMouseFocusable(element) {
|
|
516
|
+
return (!element.hasAttribute('disabled') &&
|
|
517
|
+
(element.getAttribute('tabIndex') === '-1' || cuiIsNativeKeyboardFocusable(element)));
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
function cuiGetClosestFocusable({ initial, root, previous = false, keyboard = true }) {
|
|
521
|
+
if (!root.ownerDocument) {
|
|
522
|
+
return null;
|
|
523
|
+
}
|
|
524
|
+
const check = keyboard ? cuiIsNativeKeyboardFocusable : cuiIsNativeMouseFocusable;
|
|
525
|
+
const treeWalker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, svgNodeFilter);
|
|
526
|
+
treeWalker.currentNode = initial;
|
|
527
|
+
while (previous ? treeWalker.previousNode() : treeWalker.nextNode()) {
|
|
528
|
+
if (cuiIsHTMLElement(treeWalker.currentNode)) {
|
|
529
|
+
initial = treeWalker.currentNode;
|
|
530
|
+
}
|
|
531
|
+
if (cuiIsHTMLElement(initial) && check(initial)) {
|
|
532
|
+
return initial;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return null;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Checks if element is focused.
|
|
540
|
+
*
|
|
541
|
+
* Could return true even after blur since element remains focused if you switch away from a browser tab.
|
|
542
|
+
*
|
|
543
|
+
* @param node or null (as a common return value of DOM nodes walking)
|
|
544
|
+
* @return true if focused
|
|
545
|
+
*/
|
|
546
|
+
function cuiIsNativeFocused(node) {
|
|
547
|
+
return !!node?.ownerDocument && cuiGetNativeFocused(node.ownerDocument) === node && node.ownerDocument.hasFocus();
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
const CUI_SAFARI_REG_EXP = /^((?!chrome|android).)*safari/i;
|
|
551
|
+
const CUI_IOS_REG_EXP = /ipad|iphone|ipod/i;
|
|
552
|
+
function cuiIsIos({ userAgent, maxTouchPoints }) {
|
|
553
|
+
return CUI_SAFARI_REG_EXP.test(userAgent) || (CUI_IOS_REG_EXP.test(userAgent) && maxTouchPoints > 1);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
class FilesUploaderImpl {
|
|
557
|
+
uploadFile(types = '*') {
|
|
558
|
+
const input = document.createElement('input');
|
|
559
|
+
input.type = 'file';
|
|
560
|
+
input.accept = types;
|
|
561
|
+
return new Promise((resolve) => {
|
|
562
|
+
input.onchange = () => {
|
|
563
|
+
const files = input.files;
|
|
564
|
+
if (!files?.length) {
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
resolve(files);
|
|
568
|
+
};
|
|
569
|
+
input.click();
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
const FilesUploader = new FilesUploaderImpl();
|
|
574
|
+
|
|
575
|
+
function takeCaptureFromVideo(url, time = 1) {
|
|
576
|
+
const canvas = document.createElement('canvas');
|
|
577
|
+
const video = document.createElement('video');
|
|
578
|
+
video.src = url;
|
|
579
|
+
video.currentTime = time;
|
|
580
|
+
canvas.width = 184;
|
|
581
|
+
canvas.height = 120;
|
|
582
|
+
return new Promise((resolve) => {
|
|
583
|
+
video.onloadeddata = () => {
|
|
584
|
+
const context = canvas.getContext('2d');
|
|
585
|
+
if (!context) {
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
589
|
+
canvas.toBlob((blob) => {
|
|
590
|
+
if (!blob) {
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
resolve(URL.createObjectURL(blob));
|
|
594
|
+
});
|
|
595
|
+
};
|
|
596
|
+
video.load();
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Element currently being removed by AnimationEngine
|
|
602
|
+
*/
|
|
603
|
+
const CUI_REMOVED_ELEMENT = cuiCreateTokenFromFactory(() => {
|
|
604
|
+
const stub = { onRemovalComplete: () => { } };
|
|
605
|
+
const element$ = new BehaviorSubject(null);
|
|
606
|
+
const engine = inject(_AnimationEngine, { optional: true }) || stub;
|
|
607
|
+
const { onRemovalComplete = stub.onRemovalComplete } = engine;
|
|
608
|
+
engine.onRemovalComplete = (element, context) => {
|
|
609
|
+
element$.next(element);
|
|
610
|
+
onRemovalComplete.call(engine, element, context);
|
|
611
|
+
};
|
|
612
|
+
return element$.pipe(switchMap((element) => timer(0).pipe(map(() => null), startWith(element))), share());
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
// Checks if focusout event should be considered leaving active zone
|
|
616
|
+
function isValidFocusout(target, removedElement = null) {
|
|
617
|
+
return (
|
|
618
|
+
// Not due to switching tabs/going to DevTools
|
|
619
|
+
cuiGetDocumentOrShadowRoot(target).activeElement !== target &&
|
|
620
|
+
// Not due to button/input becoming disabled or under disabled fieldset
|
|
621
|
+
!target.matches(':disabled') &&
|
|
622
|
+
// Not due to element being removed from DOM
|
|
623
|
+
!removedElement?.contains(target) &&
|
|
624
|
+
// Not due to scrollable element became non-scrollable
|
|
625
|
+
cuiIsNativeMouseFocusable(target));
|
|
626
|
+
}
|
|
627
|
+
function shadowRootActiveElement(root) {
|
|
628
|
+
return merge(cuiTypedFromEvent(root, 'focusin').pipe(map(({ target }) => target)), cuiTypedFromEvent(root, 'focusout').pipe(filter(({ target, relatedTarget }) => !!relatedTarget && isValidFocusout(target)), map(({ relatedTarget }) => relatedTarget)));
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Active element on the document for ActiveZone
|
|
632
|
+
*/
|
|
633
|
+
const CUI_ACTIVE_ELEMENT = cuiCreateTokenFromFactory(() => {
|
|
634
|
+
const removedElement$ = inject(CUI_REMOVED_ELEMENT);
|
|
635
|
+
const win = inject(CUI_WINDOW);
|
|
636
|
+
const doc = inject(DOCUMENT);
|
|
637
|
+
const zone = inject(NgZone);
|
|
638
|
+
const focusout$ = cuiTypedFromEvent(win, 'focusout', { capture: true });
|
|
639
|
+
const focusin$ = cuiTypedFromEvent(win, 'focusin', { capture: true });
|
|
640
|
+
const blur$ = cuiTypedFromEvent(win, 'blur');
|
|
641
|
+
const mousedown$ = cuiTypedFromEvent(win, 'mousedown');
|
|
642
|
+
const mouseup$ = cuiTypedFromEvent(win, 'mouseup');
|
|
643
|
+
return merge(focusout$.pipe(takeUntil(mousedown$), repeat({ delay: () => mouseup$ }), withLatestFrom(removedElement$), filter(([event, removedElement]) => isValidFocusout(cuiGetActualTarget(event), removedElement)), map(([{ relatedTarget }]) => relatedTarget)), blur$.pipe(map(() => doc.activeElement), filter((element) => !!element?.matches('iframe'))), focusin$.pipe(switchMap((event) => {
|
|
644
|
+
const target = cuiGetActualTarget(event);
|
|
645
|
+
const root = cuiGetDocumentOrShadowRoot(target);
|
|
646
|
+
return root === doc ? of(target) : shadowRootActiveElement(root).pipe(startWith(target));
|
|
647
|
+
})), mousedown$.pipe(switchMap((event) => {
|
|
648
|
+
const actualTargetInCurrentTime = cuiGetActualTarget(event);
|
|
649
|
+
return !doc.activeElement || doc.activeElement === doc.body
|
|
650
|
+
? of(actualTargetInCurrentTime)
|
|
651
|
+
: focusout$.pipe(take(1), map(
|
|
652
|
+
/**
|
|
653
|
+
* Do not use `map(() => cuiGetActualTarget(event))`
|
|
654
|
+
* because we have different result in runtime
|
|
655
|
+
*/
|
|
656
|
+
() => actualTargetInCurrentTime), takeUntil(timer(0, cuiZonefreeScheduler(zone))));
|
|
657
|
+
}))).pipe(distinctUntilChanged(), share());
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
const CUI_ANIMATION_FRAME = new InjectionToken('[CUI_ANIMATION_FRAME]', {
|
|
661
|
+
factory: () => {
|
|
662
|
+
const { requestAnimationFrame, cancelAnimationFrame } = inject(CUI_WINDOW);
|
|
663
|
+
const animationFrame$ = new Observable((subscriber) => {
|
|
664
|
+
let id = NaN;
|
|
665
|
+
const callback = (timestamp) => {
|
|
666
|
+
subscriber.next(timestamp);
|
|
667
|
+
id = requestAnimationFrame(callback);
|
|
668
|
+
};
|
|
669
|
+
id = requestAnimationFrame(callback);
|
|
670
|
+
return () => {
|
|
671
|
+
cancelAnimationFrame(id);
|
|
672
|
+
};
|
|
673
|
+
});
|
|
674
|
+
return animationFrame$.pipe(share());
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
const CUI_NAVIGATOR = new InjectionToken('[CUI_NAVIGATOR]', {
|
|
679
|
+
factory: () => inject(CUI_WINDOW).navigator
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
const CUI_USER_AGENT = new InjectionToken('[CUI_USER_AGENT]', {
|
|
683
|
+
factory: () => inject(CUI_NAVIGATOR).userAgent
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
// https://stackoverflow.com/a/11381730/2706426 http://detectmobilebrowsers.com/
|
|
687
|
+
const firstRegex =
|
|
688
|
+
// eslint-disable-next-line sonarjs/regex-complexity
|
|
689
|
+
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series([46])0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/;
|
|
690
|
+
const secondRegex =
|
|
691
|
+
// eslint-disable-next-line sonarjs/regex-complexity
|
|
692
|
+
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ \-/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja([tv])a|jbro|jemu|jigs|kddi|keji|kgt([ /])|klon|kpt |kwc-|kyo([ck])|le(no|xi)|lg( g|\/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30([02])|n50([025])|n7(0([01])|10)|ne(([cm])-|on|tf|wf|wg|wt)|nok([6i])|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c([-01])|47|mc|nd|ri)|sgh-|shar|sie([-m])|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel([im])|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c([- ])|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/;
|
|
693
|
+
const CUI_IS_MOBILE = cuiCreateTokenFromFactory(() => firstRegex.test(inject(CUI_USER_AGENT).toLowerCase()) ||
|
|
694
|
+
secondRegex.test(inject(CUI_USER_AGENT).slice(0, 4).toLowerCase()));
|
|
695
|
+
const CUI_IS_IOS = cuiCreateTokenFromFactory(() => cuiIsIos(inject(CUI_NAVIGATOR)));
|
|
696
|
+
const CUI_IS_ANDROID = cuiCreateTokenFromFactory(() => inject(CUI_IS_MOBILE) && !inject(CUI_IS_IOS));
|
|
697
|
+
const CUI_IS_WEBKIT = cuiCreateTokenFromFactory(() => !!inject(CUI_WINDOW)?.webkitConvertPointFromNodeToPage);
|
|
698
|
+
const CUI_PLATFORM = cuiCreateTokenFromFactory(() => {
|
|
699
|
+
if (inject(CUI_IS_IOS)) {
|
|
700
|
+
return 'ios';
|
|
701
|
+
}
|
|
702
|
+
return inject(CUI_IS_ANDROID) ? 'android' : 'web';
|
|
703
|
+
});
|
|
704
|
+
const CUI_IS_TOUCH = cuiCreateTokenFromFactory(() => {
|
|
705
|
+
const media = inject(CUI_WINDOW).matchMedia('(pointer: coarse)');
|
|
706
|
+
return toSignal(fromEvent(media, 'change').pipe(map(() => media.matches)), {
|
|
707
|
+
initialValue: media.matches
|
|
708
|
+
});
|
|
709
|
+
});
|
|
710
|
+
/**
|
|
711
|
+
* Detect if app is running under Cypress
|
|
712
|
+
* {@link https://docs.cypress.io/faq/questions/using-cypress-faq#Is-there-any-way-to-detect-if-my-app-is-running-under-Cypress Cypress docs}
|
|
713
|
+
*/
|
|
714
|
+
const CUI_IS_CYPRESS = cuiCreateTokenFromFactory(() => !!inject(CUI_WINDOW).Cypress);
|
|
715
|
+
/**
|
|
716
|
+
* Manually provide `true` when running tests in Playwright
|
|
717
|
+
*/
|
|
718
|
+
const CUI_IS_PLAYWRIGHT = cuiCreateTokenFromFactory(CUI_FALSE_HANDLER);
|
|
719
|
+
/**
|
|
720
|
+
* Detect if app is running under any of test frameworks
|
|
721
|
+
*/
|
|
722
|
+
const CUI_IS_E2E = cuiCreateTokenFromFactory(() => inject(CUI_IS_CYPRESS) || inject(CUI_IS_PLAYWRIGHT));
|
|
723
|
+
|
|
724
|
+
const CUI_HISTORY = cuiCreateTokenFromFactory(() => inject(CUI_WINDOW).history);
|
|
725
|
+
|
|
726
|
+
const CUI_LOCAL_STORAGE = cuiCreateTokenFromFactory(() => inject(CUI_WINDOW).localStorage);
|
|
727
|
+
|
|
728
|
+
const CUI_SESSION_STORAGE = cuiCreateTokenFromFactory(() => inject(CUI_WINDOW).sessionStorage);
|
|
729
|
+
|
|
730
|
+
class CuiActiveZone {
|
|
731
|
+
constructor() {
|
|
732
|
+
this.control = inject(NgControl, { self: true, optional: true });
|
|
733
|
+
this.active$ = inject(CUI_ACTIVE_ELEMENT);
|
|
734
|
+
this.zone = inject(NgZone);
|
|
735
|
+
this.el = cuiInjectElement();
|
|
736
|
+
this.cuiActiveZoneParent = null;
|
|
737
|
+
this.subActiveZones = [];
|
|
738
|
+
this.directParentActiveZone = inject(CuiActiveZone, {
|
|
739
|
+
skipSelf: true,
|
|
740
|
+
optional: true
|
|
741
|
+
});
|
|
742
|
+
this.cuiActiveZoneChange = this.active$.pipe(map((element) => !!element && this.contains(element)), startWith(false), distinctUntilChanged(), skip(1), tap((active) => {
|
|
743
|
+
if (!active && typeof this.control?.valueAccessor.onTouched === 'function') {
|
|
744
|
+
this.control.valueAccessor.onTouched();
|
|
745
|
+
}
|
|
746
|
+
}), cuiZoneOptimized(this.zone));
|
|
747
|
+
this.directParentActiveZone?.addSubActiveZone(this);
|
|
748
|
+
}
|
|
749
|
+
set cuiActiveZoneParentSetter(zone) {
|
|
750
|
+
this.setZone(zone);
|
|
751
|
+
}
|
|
752
|
+
ngOnDestroy() {
|
|
753
|
+
this.directParentActiveZone?.removeSubActiveZone(this);
|
|
754
|
+
this.cuiActiveZoneParent?.removeSubActiveZone(this);
|
|
755
|
+
}
|
|
756
|
+
contains(node) {
|
|
757
|
+
return (this.el.contains(node) ||
|
|
758
|
+
this.subActiveZones.some((item, index, array) => array.indexOf(item) === index && item.contains(node)));
|
|
759
|
+
}
|
|
760
|
+
setZone(zone) {
|
|
761
|
+
this.cuiActiveZoneParent?.removeSubActiveZone(this);
|
|
762
|
+
zone?.addSubActiveZone(this);
|
|
763
|
+
this.cuiActiveZoneParent = zone;
|
|
764
|
+
}
|
|
765
|
+
addSubActiveZone(activeZone) {
|
|
766
|
+
this.subActiveZones = [...this.subActiveZones, activeZone];
|
|
767
|
+
}
|
|
768
|
+
removeSubActiveZone(activeZone) {
|
|
769
|
+
this.subActiveZones = cuiArrayRemove(this.subActiveZones, this.subActiveZones.indexOf(activeZone));
|
|
770
|
+
}
|
|
771
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiActiveZone, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
772
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: CuiActiveZone, isStandalone: true, selector: "[cuiActiveZone]:not(ng-container), [cuiActiveZoneChange]:not(ng-container), [cuiActiveZoneParent]:not(ng-container)", inputs: { cuiActiveZoneParentSetter: ["cuiActiveZoneParent", "cuiActiveZoneParentSetter"] }, outputs: { cuiActiveZoneChange: "cuiActiveZoneChange" }, host: { listeners: { "document:mousedown.silent": "(0)" } }, exportAs: ["cuiActiveZone"], ngImport: i0 }); }
|
|
773
|
+
}
|
|
774
|
+
__decorate([
|
|
775
|
+
cuiPure,
|
|
776
|
+
__metadata("design:type", Function),
|
|
777
|
+
__metadata("design:paramtypes", [Object]),
|
|
778
|
+
__metadata("design:returntype", void 0)
|
|
779
|
+
], CuiActiveZone.prototype, "setZone", null);
|
|
780
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiActiveZone, decorators: [{
|
|
781
|
+
type: Directive,
|
|
782
|
+
args: [{
|
|
783
|
+
standalone: true,
|
|
784
|
+
selector: '[cuiActiveZone]:not(ng-container), [cuiActiveZoneChange]:not(ng-container), [cuiActiveZoneParent]:not(ng-container)',
|
|
785
|
+
exportAs: 'cuiActiveZone',
|
|
786
|
+
host: {
|
|
787
|
+
'(document:mousedown.silent)': '(0)'
|
|
788
|
+
}
|
|
789
|
+
}]
|
|
790
|
+
}], ctorParameters: () => [], propDecorators: { cuiActiveZoneChange: [{
|
|
791
|
+
type: Output
|
|
792
|
+
}], cuiActiveZoneParentSetter: [{
|
|
793
|
+
type: Input,
|
|
794
|
+
args: ['cuiActiveZoneParent']
|
|
795
|
+
}], setZone: [] } });
|
|
796
|
+
|
|
797
|
+
function movedOut({ currentTarget, relatedTarget }) {
|
|
798
|
+
return !cuiIsElement(relatedTarget) || !cuiIsElement(currentTarget) || !currentTarget.contains(relatedTarget);
|
|
799
|
+
}
|
|
800
|
+
class CuiHoveredService extends Observable {
|
|
801
|
+
constructor() {
|
|
802
|
+
super((subscriber) => this.stream$.subscribe(subscriber));
|
|
803
|
+
this.el = cuiInjectElement();
|
|
804
|
+
this.zone = inject(NgZone);
|
|
805
|
+
this.stream$ = merge(cuiTypedFromEvent(this.el, 'mouseenter').pipe(map(CUI_TRUE_HANDLER)), cuiTypedFromEvent(this.el, 'mouseleave').pipe(map(CUI_FALSE_HANDLER)),
|
|
806
|
+
// Hello, Safari
|
|
807
|
+
cuiTypedFromEvent(this.el, 'mouseout').pipe(filter(movedOut), map(CUI_FALSE_HANDLER))).pipe(distinctUntilChanged(), cuiZoneOptimized(this.zone));
|
|
808
|
+
}
|
|
809
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiHoveredService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
810
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiHoveredService }); }
|
|
811
|
+
}
|
|
812
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiHoveredService, decorators: [{
|
|
813
|
+
type: Injectable
|
|
814
|
+
}], ctorParameters: () => [] });
|
|
815
|
+
function cuiHovered() {
|
|
816
|
+
return toSignal(inject(CUI_IS_MOBILE) ? of(false) : inject(CuiHoveredService).pipe(cuiWatch()), {
|
|
817
|
+
initialValue: false
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
class CuiHovered {
|
|
822
|
+
constructor() {
|
|
823
|
+
this.cuiHoveredChange = inject(CuiHoveredService);
|
|
824
|
+
}
|
|
825
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiHovered, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
826
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: CuiHovered, isStandalone: true, selector: "[cuiHoveredChange]", outputs: { cuiHoveredChange: "cuiHoveredChange" }, providers: [CuiHoveredService], ngImport: i0 }); }
|
|
827
|
+
}
|
|
828
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiHovered, decorators: [{
|
|
829
|
+
type: Directive,
|
|
830
|
+
args: [{
|
|
831
|
+
standalone: true,
|
|
832
|
+
selector: '[cuiHoveredChange]',
|
|
833
|
+
providers: [CuiHoveredService]
|
|
834
|
+
}]
|
|
835
|
+
}], propDecorators: { cuiHoveredChange: [{
|
|
836
|
+
type: Output
|
|
837
|
+
}] } });
|
|
838
|
+
|
|
839
|
+
class CuiConsumptionUnitsService {
|
|
840
|
+
getConsumptionsUnits(material) {
|
|
841
|
+
let consumptionsUnits = {};
|
|
842
|
+
const consumptionsUnitsSystem = this.getConsumptionsUnitsSystem(material);
|
|
843
|
+
const consumptions = material.consumption;
|
|
844
|
+
consumptions.forEach((consumption) => {
|
|
845
|
+
consumptionsUnits = {
|
|
846
|
+
...consumptionsUnits,
|
|
847
|
+
[consumption]: this.getConsumptionUnits(consumption, consumptionsUnitsSystem)
|
|
848
|
+
};
|
|
849
|
+
});
|
|
850
|
+
return consumptionsUnits;
|
|
851
|
+
}
|
|
852
|
+
getConsumptionByUnit(unit) {
|
|
853
|
+
const unitsSystem = this.getUnitsSystemByUnit(unit);
|
|
854
|
+
const consumption = Object.entries(SystemUnits[unitsSystem]).find(([consumption, consumptionUnits]) => consumptionUnits.find((consumptionUnit) => consumptionUnit.value === unit))?.[0];
|
|
855
|
+
return consumption ?? "LENGTH" /* Consumption.Length */;
|
|
856
|
+
}
|
|
857
|
+
getUnitsSystemByUnit(consumptionUnit) {
|
|
858
|
+
return Object.entries(SystemUnits).find(([unitsSystem, consumptionUnits]) => Object.entries(consumptionUnits).find(([consumption, units]) => units.find((unit) => unit.value === consumptionUnit)))?.[0];
|
|
859
|
+
}
|
|
860
|
+
getConsumptionsUnitsSystem(material) {
|
|
861
|
+
let specifications = {};
|
|
862
|
+
if (material.specifications) {
|
|
863
|
+
specifications = material.specifications;
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
specifications = this.prepareParametersToSpecifications(material);
|
|
867
|
+
}
|
|
868
|
+
const weightValue = specifications.weight.unit;
|
|
869
|
+
const unitsSystem = Object.entries(SystemUnits).find(([key, value]) => value.WEIGHT?.includes(weightValue));
|
|
870
|
+
if (!unitsSystem) {
|
|
871
|
+
return "METRIC" /* UnitsSystem.Metric */;
|
|
872
|
+
}
|
|
873
|
+
return unitsSystem[0];
|
|
874
|
+
}
|
|
875
|
+
prepareParametersToSpecifications(material) {
|
|
876
|
+
const arrayFromParameters = material.parameters.map((param) => {
|
|
877
|
+
return {
|
|
878
|
+
[param.measure.toLowerCase()]: { value: param.value, unit: param.unit }
|
|
879
|
+
};
|
|
880
|
+
});
|
|
881
|
+
return arrayFromParameters.reduce((result, item) => {
|
|
882
|
+
for (const key in item) {
|
|
883
|
+
if (Object.prototype.hasOwnProperty.call(item, key)) {
|
|
884
|
+
result[key] = item[key];
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
return result;
|
|
888
|
+
}, {});
|
|
889
|
+
}
|
|
890
|
+
getConsumptionUnits(consumption, unitsSystem) {
|
|
891
|
+
return SystemUnits[unitsSystem][consumption] ?? [];
|
|
892
|
+
}
|
|
893
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiConsumptionUnitsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
894
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiConsumptionUnitsService, providedIn: 'root' }); }
|
|
895
|
+
}
|
|
896
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiConsumptionUnitsService, decorators: [{
|
|
897
|
+
type: Injectable,
|
|
898
|
+
args: [{
|
|
899
|
+
providedIn: 'root'
|
|
900
|
+
}]
|
|
901
|
+
}] });
|
|
902
|
+
|
|
903
|
+
class CuiDestroyService extends Subject {
|
|
904
|
+
ngOnDestroy() {
|
|
905
|
+
this.next();
|
|
906
|
+
this.complete();
|
|
907
|
+
}
|
|
908
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiDestroyService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
909
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiDestroyService }); }
|
|
910
|
+
}
|
|
911
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiDestroyService, decorators: [{
|
|
912
|
+
type: Injectable
|
|
913
|
+
}] });
|
|
914
|
+
|
|
915
|
+
const CUI = 'cui_';
|
|
916
|
+
class CuiIdService {
|
|
917
|
+
static { this.autoId = 0; }
|
|
918
|
+
generate() {
|
|
919
|
+
return `${CUI}${CuiIdService.autoId++}${Date.now()}`;
|
|
920
|
+
}
|
|
921
|
+
checkIdGenerated(id) {
|
|
922
|
+
return id.startsWith(CUI);
|
|
923
|
+
}
|
|
924
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiIdService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
925
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiIdService, providedIn: 'root' }); }
|
|
926
|
+
}
|
|
927
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiIdService, decorators: [{
|
|
928
|
+
type: Injectable,
|
|
929
|
+
args: [{
|
|
930
|
+
providedIn: 'root'
|
|
931
|
+
}]
|
|
932
|
+
}] });
|
|
933
|
+
|
|
934
|
+
class CuiPopoverService {
|
|
935
|
+
constructor(items, component, options = {}) {
|
|
936
|
+
this.options = options;
|
|
937
|
+
this.cuiIdService = inject(CuiIdService);
|
|
938
|
+
this.items$ = inject(items);
|
|
939
|
+
this.component = component;
|
|
940
|
+
}
|
|
941
|
+
open(content, options = {}) {
|
|
942
|
+
return new Observable((observer) => {
|
|
943
|
+
const item = {
|
|
944
|
+
...this.options,
|
|
945
|
+
...options,
|
|
946
|
+
$implicit: observer,
|
|
947
|
+
id: this.cuiIdService.generate(),
|
|
948
|
+
component: this.component,
|
|
949
|
+
content: content,
|
|
950
|
+
completeWith: (result) => {
|
|
951
|
+
observer.next(result);
|
|
952
|
+
observer.complete();
|
|
953
|
+
}
|
|
954
|
+
};
|
|
955
|
+
this.items$.next([...this.items$.value, item]);
|
|
956
|
+
return () => {
|
|
957
|
+
this.items$.next(this.items$.value.filter((value) => value !== item));
|
|
958
|
+
};
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
closeAll() {
|
|
962
|
+
this.items$.next([]);
|
|
963
|
+
}
|
|
964
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiPopoverService, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
965
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiPopoverService }); }
|
|
966
|
+
}
|
|
967
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiPopoverService, decorators: [{
|
|
968
|
+
type: Injectable
|
|
969
|
+
}], ctorParameters: () => [{ type: undefined }, { type: undefined }, { type: undefined }] });
|
|
970
|
+
|
|
971
|
+
class CuiDragListDirective {
|
|
972
|
+
constructor() {
|
|
973
|
+
this.renderer = inject(Renderer2);
|
|
974
|
+
this.element = inject(ElementRef).nativeElement;
|
|
975
|
+
this.id = inject(CuiIdService).generate();
|
|
976
|
+
this.listId = `${this.id}-list`;
|
|
977
|
+
this.renderer.setAttribute(this.element, 'id', this.listId);
|
|
978
|
+
}
|
|
979
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiDragListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
980
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: CuiDragListDirective, isStandalone: true, selector: "[cuiDragList]", ngImport: i0 }); }
|
|
981
|
+
}
|
|
982
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiDragListDirective, decorators: [{
|
|
983
|
+
type: Directive,
|
|
984
|
+
args: [{
|
|
985
|
+
selector: '[cuiDragList]',
|
|
986
|
+
standalone: true
|
|
987
|
+
}]
|
|
988
|
+
}], ctorParameters: () => [] });
|
|
989
|
+
|
|
990
|
+
class CuiDragDropDirective {
|
|
991
|
+
constructor() {
|
|
992
|
+
this.zone = inject(NgZone);
|
|
993
|
+
this.document = inject(DOCUMENT);
|
|
994
|
+
this.renderer = inject(Renderer2);
|
|
995
|
+
this.element = inject(ElementRef).nativeElement;
|
|
996
|
+
this.dragListDirective = inject(CuiDragListDirective);
|
|
997
|
+
this.PLACEHOLDER_CLASS = 'cui-drag-drop-placeholder';
|
|
998
|
+
this.listId = this.dragListDirective.listId;
|
|
999
|
+
this.itemAttribute = `${this.listId}-drag-item`;
|
|
1000
|
+
this.abortController = new AbortController();
|
|
1001
|
+
this.hostAbortController = new AbortController();
|
|
1002
|
+
this.draggingElement = signal(null);
|
|
1003
|
+
this.placeholderElement = signal(null);
|
|
1004
|
+
this.dragData = signal({});
|
|
1005
|
+
this.disabled = input(false);
|
|
1006
|
+
this.elementDragged = output();
|
|
1007
|
+
this.initDragItem();
|
|
1008
|
+
this.initPointerEvents(this.element);
|
|
1009
|
+
}
|
|
1010
|
+
ngOnDestroy() {
|
|
1011
|
+
this.destroyEvents();
|
|
1012
|
+
}
|
|
1013
|
+
changePointerEvents(element) {
|
|
1014
|
+
this.hostAbortController.abort();
|
|
1015
|
+
this.hostAbortController = new AbortController();
|
|
1016
|
+
this.initPointerEvents(element);
|
|
1017
|
+
}
|
|
1018
|
+
onDrag(clientX, clientY) {
|
|
1019
|
+
if (!this.draggingElement()) {
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
const elementsFromPoint = this.document.elementsFromPoint(clientX, clientY);
|
|
1023
|
+
const elementFromPoint = elementsFromPoint.find((element) => element.closest(`#${this.listId}`));
|
|
1024
|
+
if (!elementFromPoint) {
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
const targetElement = elementFromPoint.closest(`[${this.itemAttribute}]`);
|
|
1028
|
+
if (!targetElement || targetElement === this.draggingElement()) {
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
this.configurateDragData(targetElement, clientY);
|
|
1032
|
+
}
|
|
1033
|
+
onDragStart(event) {
|
|
1034
|
+
if (this.disabled()) {
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
let isClicked = true;
|
|
1038
|
+
const elementClientRect = this.element.getBoundingClientRect();
|
|
1039
|
+
const shiftX = event.clientX - elementClientRect.left;
|
|
1040
|
+
const shiftY = event.clientY - elementClientRect.top;
|
|
1041
|
+
this.prevIndex = this.calculatePreviousIndex();
|
|
1042
|
+
this.document.addEventListener('pointermove', ({ clientX, clientY }) => {
|
|
1043
|
+
if (isClicked) {
|
|
1044
|
+
this.prepareMoving();
|
|
1045
|
+
isClicked = false;
|
|
1046
|
+
}
|
|
1047
|
+
const draggingElement = this.draggingElement();
|
|
1048
|
+
this.renderer.setStyle(draggingElement, 'left', clientX - shiftX + 'px');
|
|
1049
|
+
this.renderer.setStyle(draggingElement, 'top', clientY - shiftY + 'px');
|
|
1050
|
+
this.onDrag(clientX, clientY);
|
|
1051
|
+
}, { signal: this.abortController.signal });
|
|
1052
|
+
}
|
|
1053
|
+
onDragEnd() {
|
|
1054
|
+
const { targetElement, pointer } = this.dragData();
|
|
1055
|
+
if (targetElement && pointer) {
|
|
1056
|
+
this.elementDragged.emit({
|
|
1057
|
+
index: this.index,
|
|
1058
|
+
prevIndex: this.prevIndex,
|
|
1059
|
+
targetElement,
|
|
1060
|
+
pointer
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
// remove document events
|
|
1064
|
+
this.abortController.abort();
|
|
1065
|
+
this.abortController = new AbortController();
|
|
1066
|
+
this.removeDragElement();
|
|
1067
|
+
this.removePlaceholder();
|
|
1068
|
+
this.dragData.set({});
|
|
1069
|
+
}
|
|
1070
|
+
initDragItem() {
|
|
1071
|
+
this.renderer.setAttribute(this.element, this.itemAttribute, 'true');
|
|
1072
|
+
}
|
|
1073
|
+
initPointerEvents(element) {
|
|
1074
|
+
const signal = this.hostAbortController.signal;
|
|
1075
|
+
this.zone.runOutsideAngular(() => {
|
|
1076
|
+
element.addEventListener('pointerup', this.onDragEnd.bind(this), { signal });
|
|
1077
|
+
element.addEventListener('pointerdown', this.onDragStart.bind(this), { signal });
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
destroyEvents() {
|
|
1081
|
+
this.hostAbortController.abort();
|
|
1082
|
+
this.abortController.abort();
|
|
1083
|
+
}
|
|
1084
|
+
prepareMoving() {
|
|
1085
|
+
const placeholderElement = this.createPlaceholderElement();
|
|
1086
|
+
const draggingElement = this.createDragElement();
|
|
1087
|
+
this.document.addEventListener('pointerup', this.onDragEnd.bind(this), {
|
|
1088
|
+
signal: this.abortController.signal
|
|
1089
|
+
});
|
|
1090
|
+
this.element.after(placeholderElement);
|
|
1091
|
+
this.draggingElement.set(draggingElement);
|
|
1092
|
+
this.element.remove();
|
|
1093
|
+
this.document.body.append(draggingElement);
|
|
1094
|
+
}
|
|
1095
|
+
configurateDragData(targetElement, clientY) {
|
|
1096
|
+
const placeholderElement = this.placeholderElement();
|
|
1097
|
+
const boundingRect = targetElement.getBoundingClientRect();
|
|
1098
|
+
const middleY = boundingRect.top + boundingRect.height / 2;
|
|
1099
|
+
if (clientY < middleY) {
|
|
1100
|
+
targetElement.before(placeholderElement);
|
|
1101
|
+
this.dragData.set({ targetElement, pointer: 'BEFORE' });
|
|
1102
|
+
}
|
|
1103
|
+
else {
|
|
1104
|
+
targetElement.after(placeholderElement);
|
|
1105
|
+
this.dragData.set({ targetElement, pointer: 'AFTER' });
|
|
1106
|
+
}
|
|
1107
|
+
this.index = this.calculateIndex(placeholderElement);
|
|
1108
|
+
}
|
|
1109
|
+
createDragElement() {
|
|
1110
|
+
const width = this.element.clientWidth;
|
|
1111
|
+
const draggingElement = this.element.cloneNode(true);
|
|
1112
|
+
this.renderer.setStyle(draggingElement, 'position', 'fixed');
|
|
1113
|
+
this.renderer.setStyle(draggingElement, 'display', 'block');
|
|
1114
|
+
this.renderer.setStyle(draggingElement, 'margin', '0');
|
|
1115
|
+
this.renderer.setStyle(draggingElement, 'width', `${width}px`);
|
|
1116
|
+
return draggingElement;
|
|
1117
|
+
}
|
|
1118
|
+
createPlaceholderElement() {
|
|
1119
|
+
const element = this.placeholderElement();
|
|
1120
|
+
if (element) {
|
|
1121
|
+
return element;
|
|
1122
|
+
}
|
|
1123
|
+
const placeholderElement = this.renderer.createElement('div');
|
|
1124
|
+
this.renderer.addClass(placeholderElement, this.PLACEHOLDER_CLASS);
|
|
1125
|
+
this.placeholderElement.set(placeholderElement);
|
|
1126
|
+
return placeholderElement;
|
|
1127
|
+
}
|
|
1128
|
+
removeDragElement() {
|
|
1129
|
+
const draggingElement = this.draggingElement();
|
|
1130
|
+
if (!draggingElement) {
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
draggingElement.remove();
|
|
1134
|
+
this.draggingElement.set(null);
|
|
1135
|
+
}
|
|
1136
|
+
removePlaceholder() {
|
|
1137
|
+
const placeholderElement = this.placeholderElement();
|
|
1138
|
+
if (!placeholderElement) {
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
placeholderElement.after(this.element);
|
|
1142
|
+
placeholderElement.remove();
|
|
1143
|
+
this.placeholderElement.set(null);
|
|
1144
|
+
}
|
|
1145
|
+
calculateIndex(placeholderElement) {
|
|
1146
|
+
const childNodes = placeholderElement.parentElement.childNodes;
|
|
1147
|
+
const elements = Array.from(childNodes).filter((node) => node instanceof HTMLElement);
|
|
1148
|
+
return elements.indexOf(placeholderElement);
|
|
1149
|
+
}
|
|
1150
|
+
calculatePreviousIndex() {
|
|
1151
|
+
let index = 0;
|
|
1152
|
+
let currentElement = this.element;
|
|
1153
|
+
while (currentElement && currentElement.previousElementSibling) {
|
|
1154
|
+
index++;
|
|
1155
|
+
currentElement = currentElement.previousElementSibling;
|
|
1156
|
+
}
|
|
1157
|
+
return index;
|
|
1158
|
+
}
|
|
1159
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiDragDropDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1160
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.14", type: CuiDragDropDirective, isStandalone: true, selector: "[cuiDragDrop]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { elementDragged: "elementDragged" }, ngImport: i0 }); }
|
|
1161
|
+
}
|
|
1162
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiDragDropDirective, decorators: [{
|
|
1163
|
+
type: Directive,
|
|
1164
|
+
args: [{
|
|
1165
|
+
selector: '[cuiDragDrop]',
|
|
1166
|
+
standalone: true
|
|
1167
|
+
}]
|
|
1168
|
+
}], ctorParameters: () => [] });
|
|
1169
|
+
|
|
1170
|
+
class CuiDragPointerDirective {
|
|
1171
|
+
constructor() {
|
|
1172
|
+
this.dragDropDirective = inject(CuiDragDropDirective);
|
|
1173
|
+
this.element = inject(ElementRef).nativeElement;
|
|
1174
|
+
this.dragDropDirective.changePointerEvents(this.element);
|
|
1175
|
+
}
|
|
1176
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiDragPointerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1177
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: CuiDragPointerDirective, isStandalone: true, selector: "[cuiDragPointer]", ngImport: i0 }); }
|
|
1178
|
+
}
|
|
1179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiDragPointerDirective, decorators: [{
|
|
1180
|
+
type: Directive,
|
|
1181
|
+
args: [{
|
|
1182
|
+
selector: '[cuiDragPointer]',
|
|
1183
|
+
standalone: true
|
|
1184
|
+
}]
|
|
1185
|
+
}], ctorParameters: () => [] });
|
|
1186
|
+
|
|
1187
|
+
class CuiAutoResizingDirective {
|
|
1188
|
+
constructor() {
|
|
1189
|
+
this.window = inject(CUI_WINDOW);
|
|
1190
|
+
this.element = inject(ElementRef).nativeElement;
|
|
1191
|
+
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
1192
|
+
this.ngModel = inject(NgModel, { self: true, optional: true });
|
|
1193
|
+
this.destroy$ = inject(CuiDestroyService, { self: true });
|
|
1194
|
+
this.elementStyles = this.element.style;
|
|
1195
|
+
}
|
|
1196
|
+
ngOnInit() {
|
|
1197
|
+
this.initNgControlValueChangeSubscription();
|
|
1198
|
+
this.initNgModelValueChangeSubscription();
|
|
1199
|
+
}
|
|
1200
|
+
ngAfterViewChecked() {
|
|
1201
|
+
this.resize();
|
|
1202
|
+
}
|
|
1203
|
+
onInput() {
|
|
1204
|
+
this.resize();
|
|
1205
|
+
}
|
|
1206
|
+
initNgControlValueChangeSubscription() {
|
|
1207
|
+
if (!this.ngControl) {
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
1210
|
+
this.ngControl.valueChanges.pipe(takeUntil(this.destroy$)).subscribe(this.resize.bind(this));
|
|
1211
|
+
}
|
|
1212
|
+
initNgModelValueChangeSubscription() {
|
|
1213
|
+
if (!this.ngModel) {
|
|
1214
|
+
return;
|
|
1215
|
+
}
|
|
1216
|
+
this.ngModel.valueChanges.pipe(takeUntil(this.destroy$)).subscribe(this.resize.bind(this));
|
|
1217
|
+
}
|
|
1218
|
+
resize() {
|
|
1219
|
+
const { maxHeight: computedMaxHeight, borderTopWidth, borderBottomWidth } = this.window.getComputedStyle(this.element);
|
|
1220
|
+
this.elementStyles.height = 'auto';
|
|
1221
|
+
this.elementStyles.height =
|
|
1222
|
+
this.element.scrollHeight + parseFloat(borderTopWidth) + parseFloat(borderBottomWidth) + 'px';
|
|
1223
|
+
if (parseFloat(this.element.style.height) < parseFloat(computedMaxHeight)) {
|
|
1224
|
+
this.elementStyles.overflow = 'hidden';
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
this.elementStyles.overflowY = 'scroll';
|
|
1228
|
+
this.elementStyles.height = computedMaxHeight;
|
|
1229
|
+
}
|
|
1230
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiAutoResizingDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1231
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: CuiAutoResizingDirective, isStandalone: true, selector: "textarea[cuiAutoResizing]", host: { listeners: { "input": "onInput()" } }, providers: [CuiDestroyService], ngImport: i0 }); }
|
|
1232
|
+
}
|
|
1233
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiAutoResizingDirective, decorators: [{
|
|
1234
|
+
type: Directive,
|
|
1235
|
+
args: [{
|
|
1236
|
+
standalone: true,
|
|
1237
|
+
selector: 'textarea[cuiAutoResizing]',
|
|
1238
|
+
providers: [CuiDestroyService]
|
|
1239
|
+
}]
|
|
1240
|
+
}], propDecorators: { onInput: [{
|
|
1241
|
+
type: HostListener,
|
|
1242
|
+
args: ['input']
|
|
1243
|
+
}] } });
|
|
1244
|
+
|
|
1245
|
+
class CuiHandleScrollDirective {
|
|
1246
|
+
constructor() {
|
|
1247
|
+
this.window = inject(CUI_WINDOW);
|
|
1248
|
+
this.document = inject(DOCUMENT);
|
|
1249
|
+
this.renderer = inject(Renderer2);
|
|
1250
|
+
this.zone = inject(NgZone);
|
|
1251
|
+
this.abortController = new AbortController();
|
|
1252
|
+
this.SCROLL_AREA_HEIGHT = 100;
|
|
1253
|
+
this.scrollGapElements = signal(null);
|
|
1254
|
+
this.scrollSpeed = input(100);
|
|
1255
|
+
}
|
|
1256
|
+
ngOnDestroy() {
|
|
1257
|
+
this.removeSubscription();
|
|
1258
|
+
}
|
|
1259
|
+
onTargetMove() {
|
|
1260
|
+
const signal = this.abortController.signal;
|
|
1261
|
+
this.zone.runOutsideAngular(this.initScrollEvent.bind(this, signal));
|
|
1262
|
+
}
|
|
1263
|
+
initScrollEvent(signal) {
|
|
1264
|
+
this.document.addEventListener('pointermove', ({ clientY }) => this.handleScroll(clientY), { signal });
|
|
1265
|
+
this.document.addEventListener('pointerup', () => {
|
|
1266
|
+
this.scrollGapElements()?.forEach((element) => element.remove());
|
|
1267
|
+
this.scrollGapElements.set(null);
|
|
1268
|
+
this.removeSubscription();
|
|
1269
|
+
this.abortController.abort();
|
|
1270
|
+
this.abortController = new AbortController();
|
|
1271
|
+
}, { signal });
|
|
1272
|
+
}
|
|
1273
|
+
handleScroll(clientY) {
|
|
1274
|
+
const windowHeight = this.document.documentElement.clientHeight;
|
|
1275
|
+
const scrollSpeed = this.scrollSpeed();
|
|
1276
|
+
if (!this.scrollGapElements()) {
|
|
1277
|
+
this.setScrollGapElements();
|
|
1278
|
+
}
|
|
1279
|
+
if (clientY <= this.SCROLL_AREA_HEIGHT) {
|
|
1280
|
+
this.startScrolling(-scrollSpeed);
|
|
1281
|
+
return;
|
|
1282
|
+
}
|
|
1283
|
+
if (clientY >= windowHeight - this.SCROLL_AREA_HEIGHT) {
|
|
1284
|
+
this.startScrolling(scrollSpeed);
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
this.removeSubscription();
|
|
1288
|
+
}
|
|
1289
|
+
setScrollGapElements() {
|
|
1290
|
+
const scrollGapElement = this.renderer.createElement('div');
|
|
1291
|
+
this.renderer.setStyle(scrollGapElement, 'position', 'fixed');
|
|
1292
|
+
this.renderer.setStyle(scrollGapElement, 'width', '100%');
|
|
1293
|
+
this.renderer.setStyle(scrollGapElement, 'height', '48px');
|
|
1294
|
+
this.renderer.setStyle(scrollGapElement, 'top', '0');
|
|
1295
|
+
const scrollGapBottomElement = scrollGapElement.cloneNode(true);
|
|
1296
|
+
this.renderer.appendChild(this.document.body, scrollGapElement);
|
|
1297
|
+
this.renderer.appendChild(this.document.body, scrollGapBottomElement);
|
|
1298
|
+
this.scrollGapElements.set([scrollGapElement, scrollGapBottomElement]);
|
|
1299
|
+
}
|
|
1300
|
+
startScrolling(speed) {
|
|
1301
|
+
this.removeSubscription();
|
|
1302
|
+
this.scrollSubscription = interval(this.scrollSpeed()).subscribe(() => this.window.scrollBy({ top: speed, behavior: 'smooth' }));
|
|
1303
|
+
}
|
|
1304
|
+
removeSubscription() {
|
|
1305
|
+
this.scrollSubscription?.unsubscribe();
|
|
1306
|
+
}
|
|
1307
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiHandleScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1308
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.14", type: CuiHandleScrollDirective, isStandalone: true, selector: "[cuiHandleScroll]", inputs: { scrollSpeed: { classPropertyName: "scrollSpeed", publicName: "scrollSpeed", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "pointerdown": "onTargetMove()" } }, ngImport: i0 }); }
|
|
1309
|
+
}
|
|
1310
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiHandleScrollDirective, decorators: [{
|
|
1311
|
+
type: Directive,
|
|
1312
|
+
args: [{
|
|
1313
|
+
selector: '[cuiHandleScroll]',
|
|
1314
|
+
standalone: true,
|
|
1315
|
+
host: {
|
|
1316
|
+
'(pointerdown)': 'onTargetMove()'
|
|
1317
|
+
}
|
|
1318
|
+
}]
|
|
1319
|
+
}] });
|
|
1320
|
+
|
|
1321
|
+
class CuiClickOutsideDirective {
|
|
1322
|
+
constructor() {
|
|
1323
|
+
this.element = inject(ElementRef).nativeElement;
|
|
1324
|
+
this.cuiClickOutside = new EventEmitter();
|
|
1325
|
+
}
|
|
1326
|
+
onClickOutside(target) {
|
|
1327
|
+
if (this.element.contains(target)) {
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
this.cuiClickOutside.emit(target);
|
|
1331
|
+
}
|
|
1332
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiClickOutsideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1333
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: CuiClickOutsideDirective, isStandalone: true, selector: "(cuiClickOutside)", outputs: { cuiClickOutside: "cuiClickOutside" }, host: { listeners: { "document:click": "onClickOutside($event.target)" } }, ngImport: i0 }); }
|
|
1334
|
+
}
|
|
1335
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiClickOutsideDirective, decorators: [{
|
|
1336
|
+
type: Directive,
|
|
1337
|
+
args: [{
|
|
1338
|
+
standalone: true,
|
|
1339
|
+
selector: '(cuiClickOutside)'
|
|
1340
|
+
}]
|
|
1341
|
+
}], propDecorators: { cuiClickOutside: [{
|
|
1342
|
+
type: Output
|
|
1343
|
+
}], onClickOutside: [{
|
|
1344
|
+
type: HostListener,
|
|
1345
|
+
args: ['document:click', ['$event.target']]
|
|
1346
|
+
}] } });
|
|
1347
|
+
|
|
1348
|
+
class CuiDimensionsObserverDirective {
|
|
1349
|
+
constructor() {
|
|
1350
|
+
this.element = inject(ElementRef).nativeElement;
|
|
1351
|
+
this.observer = new ResizeObserver((entries) => {
|
|
1352
|
+
entries.forEach(() => this.cuiResizeObserver.emit({
|
|
1353
|
+
width: this.element.offsetWidth,
|
|
1354
|
+
height: this.element.offsetHeight
|
|
1355
|
+
}));
|
|
1356
|
+
});
|
|
1357
|
+
this.cuiResizeObserver = new EventEmitter();
|
|
1358
|
+
}
|
|
1359
|
+
ngOnInit() {
|
|
1360
|
+
this.observer.observe(this.element);
|
|
1361
|
+
}
|
|
1362
|
+
ngOnDestroy() {
|
|
1363
|
+
this.observer.disconnect();
|
|
1364
|
+
}
|
|
1365
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiDimensionsObserverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1366
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: CuiDimensionsObserverDirective, isStandalone: true, selector: "[cuiResizeObserver]", outputs: { cuiResizeObserver: "cuiResizeObserver" }, ngImport: i0 }); }
|
|
1367
|
+
}
|
|
1368
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiDimensionsObserverDirective, decorators: [{
|
|
1369
|
+
type: Directive,
|
|
1370
|
+
args: [{
|
|
1371
|
+
standalone: true,
|
|
1372
|
+
selector: '[cuiResizeObserver]'
|
|
1373
|
+
}]
|
|
1374
|
+
}], propDecorators: { cuiResizeObserver: [{
|
|
1375
|
+
type: Output
|
|
1376
|
+
}] } });
|
|
1377
|
+
|
|
1378
|
+
class CuiContentEditableValueAccessorDirective {
|
|
1379
|
+
constructor() {
|
|
1380
|
+
this.element = inject(ElementRef).nativeElement;
|
|
1381
|
+
}
|
|
1382
|
+
writeValue(value) {
|
|
1383
|
+
this.element.innerText = value ?? '';
|
|
1384
|
+
}
|
|
1385
|
+
registerOnChange(fn) {
|
|
1386
|
+
this.onChange = fn;
|
|
1387
|
+
}
|
|
1388
|
+
registerOnTouched(fn) {
|
|
1389
|
+
this.onTouched = fn;
|
|
1390
|
+
}
|
|
1391
|
+
setDisabledState(isDisabled) {
|
|
1392
|
+
this.element.contentEditable = String(!isDisabled);
|
|
1393
|
+
}
|
|
1394
|
+
onInput() {
|
|
1395
|
+
this.onChange(this.element.innerHTML === '<br>' ? '' : this.element.innerText);
|
|
1396
|
+
}
|
|
1397
|
+
onBlur() {
|
|
1398
|
+
this.onTouched();
|
|
1399
|
+
}
|
|
1400
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiContentEditableValueAccessorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1401
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: CuiContentEditableValueAccessorDirective, isStandalone: true, selector: "[contenteditable][formControlName], [contenteditable][formControl], [contenteditable][ngModel]", host: { listeners: { "input": "onInput()", "blur": "onBlur()" } }, providers: [cuiProvide(NG_VALUE_ACCESSOR, CuiContentEditableValueAccessorDirective, true)], ngImport: i0 }); }
|
|
1402
|
+
}
|
|
1403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiContentEditableValueAccessorDirective, decorators: [{
|
|
1404
|
+
type: Directive,
|
|
1405
|
+
args: [{
|
|
1406
|
+
standalone: true,
|
|
1407
|
+
selector: '[contenteditable][formControlName], [contenteditable][formControl], [contenteditable][ngModel]',
|
|
1408
|
+
providers: [cuiProvide(NG_VALUE_ACCESSOR, CuiContentEditableValueAccessorDirective, true)]
|
|
1409
|
+
}]
|
|
1410
|
+
}], propDecorators: { onInput: [{
|
|
1411
|
+
type: HostListener,
|
|
1412
|
+
args: ['input']
|
|
1413
|
+
}], onBlur: [{
|
|
1414
|
+
type: HostListener,
|
|
1415
|
+
args: ['blur']
|
|
1416
|
+
}] } });
|
|
1417
|
+
|
|
1418
|
+
class CuiElementDirective {
|
|
1419
|
+
constructor() {
|
|
1420
|
+
this.nativeElement = inject((ElementRef)).nativeElement;
|
|
1421
|
+
return new ElementRef(this.nativeElement);
|
|
1422
|
+
}
|
|
1423
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1424
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: CuiElementDirective, isStandalone: true, selector: "[cuiElement]", exportAs: ["elementRef"], ngImport: i0 }); }
|
|
1425
|
+
}
|
|
1426
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiElementDirective, decorators: [{
|
|
1427
|
+
type: Directive,
|
|
1428
|
+
args: [{
|
|
1429
|
+
standalone: true,
|
|
1430
|
+
selector: '[cuiElement]',
|
|
1431
|
+
exportAs: 'elementRef'
|
|
1432
|
+
}]
|
|
1433
|
+
}], ctorParameters: () => [] });
|
|
1434
|
+
|
|
1435
|
+
class CuiFocusTrapDirective {
|
|
1436
|
+
constructor() {
|
|
1437
|
+
this.document = inject(DOCUMENT);
|
|
1438
|
+
this.element = inject(ElementRef).nativeElement;
|
|
1439
|
+
this.activeElement = cuiGetNativeFocused(this.document);
|
|
1440
|
+
this.tabIndex = 0;
|
|
1441
|
+
this.initElementFocus();
|
|
1442
|
+
}
|
|
1443
|
+
ngOnDestroy() {
|
|
1444
|
+
cuiBlurNativeFocused(this.document);
|
|
1445
|
+
Promise.resolve().then(() => {
|
|
1446
|
+
if (!cuiIsHTMLElement(this.activeElement)) {
|
|
1447
|
+
return;
|
|
1448
|
+
}
|
|
1449
|
+
this.activeElement.focus();
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
onFocusIn(node) {
|
|
1453
|
+
if (cuiContainsOrAfter(this.element, node)) {
|
|
1454
|
+
return;
|
|
1455
|
+
}
|
|
1456
|
+
cuiGetClosestFocusable({
|
|
1457
|
+
initial: this.element,
|
|
1458
|
+
root: this.element
|
|
1459
|
+
})?.focus();
|
|
1460
|
+
}
|
|
1461
|
+
initElementFocus() {
|
|
1462
|
+
Promise.resolve().then(() => this.element.focus());
|
|
1463
|
+
}
|
|
1464
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiFocusTrapDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1465
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: CuiFocusTrapDirective, isStandalone: true, selector: "[cuiFocusTrap]", host: { listeners: { "window:focusin": "onFocusIn($event.target)" }, properties: { "tabIndex": "this.tabIndex" } }, ngImport: i0 }); }
|
|
1466
|
+
}
|
|
1467
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiFocusTrapDirective, decorators: [{
|
|
1468
|
+
type: Directive,
|
|
1469
|
+
args: [{
|
|
1470
|
+
standalone: true,
|
|
1471
|
+
selector: '[cuiFocusTrap]'
|
|
1472
|
+
}]
|
|
1473
|
+
}], ctorParameters: () => [], propDecorators: { tabIndex: [{
|
|
1474
|
+
type: HostBinding,
|
|
1475
|
+
args: ['tabIndex']
|
|
1476
|
+
}], onFocusIn: [{
|
|
1477
|
+
type: HostListener,
|
|
1478
|
+
args: ['window:focusin', ['$event.target']]
|
|
1479
|
+
}] } });
|
|
1480
|
+
|
|
1481
|
+
class CuiItemDirective {
|
|
1482
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1483
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: CuiItemDirective, isStandalone: true, selector: "[cuiItem]", ngImport: i0 }); }
|
|
1484
|
+
}
|
|
1485
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiItemDirective, decorators: [{
|
|
1486
|
+
type: Directive,
|
|
1487
|
+
args: [{
|
|
1488
|
+
standalone: true,
|
|
1489
|
+
selector: '[cuiItem]'
|
|
1490
|
+
}]
|
|
1491
|
+
}] });
|
|
1492
|
+
|
|
1493
|
+
class CuiLetContext {
|
|
1494
|
+
constructor(internalDirectiveInstance) {
|
|
1495
|
+
this.internalDirectiveInstance = internalDirectiveInstance;
|
|
1496
|
+
}
|
|
1497
|
+
get $implicit() {
|
|
1498
|
+
return this.internalDirectiveInstance.cuiLet;
|
|
1499
|
+
}
|
|
1500
|
+
get cuiLet() {
|
|
1501
|
+
return this.internalDirectiveInstance.cuiLet;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
class CuiLetDirective {
|
|
1506
|
+
constructor() {
|
|
1507
|
+
inject(ViewContainerRef).createEmbeddedView(inject((TemplateRef)), new CuiLetContext(this));
|
|
1508
|
+
}
|
|
1509
|
+
static ngTemplateContextGuard(_dir, _ctx) {
|
|
1510
|
+
return true;
|
|
1511
|
+
}
|
|
1512
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiLetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1513
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: CuiLetDirective, isStandalone: true, selector: "[cuiLet]", inputs: { cuiLet: "cuiLet" }, ngImport: i0 }); }
|
|
1514
|
+
}
|
|
1515
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiLetDirective, decorators: [{
|
|
1516
|
+
type: Directive,
|
|
1517
|
+
args: [{
|
|
1518
|
+
standalone: true,
|
|
1519
|
+
selector: '[cuiLet]'
|
|
1520
|
+
}]
|
|
1521
|
+
}], ctorParameters: () => [], propDecorators: { cuiLet: [{
|
|
1522
|
+
type: Input
|
|
1523
|
+
}] } });
|
|
1524
|
+
|
|
1525
|
+
class CuiTargetDirective {
|
|
1526
|
+
constructor() {
|
|
1527
|
+
this.clickListener = (event) => {
|
|
1528
|
+
this.clicked.emit(event);
|
|
1529
|
+
};
|
|
1530
|
+
this.clicked = new EventEmitter();
|
|
1531
|
+
}
|
|
1532
|
+
ngOnInit() {
|
|
1533
|
+
this.initClickListener();
|
|
1534
|
+
}
|
|
1535
|
+
ngOnDestroy() {
|
|
1536
|
+
this.destroyClickListener();
|
|
1537
|
+
}
|
|
1538
|
+
initClickListener() {
|
|
1539
|
+
this.ccTarget.addEventListener('click', this.clickListener);
|
|
1540
|
+
}
|
|
1541
|
+
destroyClickListener() {
|
|
1542
|
+
this.ccTarget.removeEventListener('click', this.clickListener);
|
|
1543
|
+
}
|
|
1544
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiTargetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1545
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: CuiTargetDirective, isStandalone: true, selector: "[ccTarget]", inputs: { ccTarget: "ccTarget" }, outputs: { clicked: "clicked" }, ngImport: i0 }); }
|
|
1546
|
+
}
|
|
1547
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiTargetDirective, decorators: [{
|
|
1548
|
+
type: Directive,
|
|
1549
|
+
args: [{
|
|
1550
|
+
standalone: true,
|
|
1551
|
+
selector: '[ccTarget]'
|
|
1552
|
+
}]
|
|
1553
|
+
}], propDecorators: { ccTarget: [{
|
|
1554
|
+
type: Input
|
|
1555
|
+
}], clicked: [{
|
|
1556
|
+
type: Output
|
|
1557
|
+
}] } });
|
|
1558
|
+
|
|
1559
|
+
class CuiLadderListDirective {
|
|
1560
|
+
constructor() {
|
|
1561
|
+
this.zone = inject(NgZone);
|
|
1562
|
+
this.element = inject(ElementRef).nativeElement;
|
|
1563
|
+
this.LIST_ITEM_MARGIN_LEFT = 16;
|
|
1564
|
+
this.disabled = input(false);
|
|
1565
|
+
effect(() => this.initElementsEffect());
|
|
1566
|
+
}
|
|
1567
|
+
initElementsEffect() {
|
|
1568
|
+
this.zone.runOutsideAngular(this.initObserver.bind(this));
|
|
1569
|
+
}
|
|
1570
|
+
initObserver() {
|
|
1571
|
+
const observer = new MutationObserver(this.calculateListItemsMargin.bind(this));
|
|
1572
|
+
this.calculateListItemsMargin();
|
|
1573
|
+
observer.observe(this.element, { childList: true });
|
|
1574
|
+
}
|
|
1575
|
+
calculateListItemsMargin() {
|
|
1576
|
+
if (this.disabled()) {
|
|
1577
|
+
return;
|
|
1578
|
+
}
|
|
1579
|
+
let index = 0;
|
|
1580
|
+
this.element.childNodes.forEach((node) => {
|
|
1581
|
+
if (!(node instanceof HTMLElement)) {
|
|
1582
|
+
return;
|
|
1583
|
+
}
|
|
1584
|
+
node.style.marginLeft = index * this.LIST_ITEM_MARGIN_LEFT + 'px';
|
|
1585
|
+
index += 1;
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiLadderListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1589
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.14", type: CuiLadderListDirective, isStandalone: true, selector: "[cuiLadderList]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
1590
|
+
}
|
|
1591
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiLadderListDirective, decorators: [{
|
|
1592
|
+
type: Directive,
|
|
1593
|
+
args: [{
|
|
1594
|
+
selector: '[cuiLadderList]',
|
|
1595
|
+
standalone: true
|
|
1596
|
+
}]
|
|
1597
|
+
}], ctorParameters: () => [] });
|
|
1598
|
+
|
|
1599
|
+
class CuiTypedTemplateDirective extends TemplateRef {
|
|
1600
|
+
constructor() {
|
|
1601
|
+
super();
|
|
1602
|
+
this.templateRef = inject(TemplateRef);
|
|
1603
|
+
this.elementRef = this.templateRef.elementRef;
|
|
1604
|
+
this.type = input.required({ alias: 'cuiTypedTemplate' });
|
|
1605
|
+
}
|
|
1606
|
+
createEmbeddedView(context) {
|
|
1607
|
+
return this.templateRef.createEmbeddedView(context);
|
|
1608
|
+
}
|
|
1609
|
+
static ngTemplateContextGuard(_, ctx) {
|
|
1610
|
+
return true;
|
|
1611
|
+
}
|
|
1612
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiTypedTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1613
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.14", type: CuiTypedTemplateDirective, isStandalone: true, selector: "ng-template[cuiTypedTemplate]", inputs: { type: { classPropertyName: "type", publicName: "cuiTypedTemplate", isSignal: true, isRequired: true, transformFunction: null } }, exportAs: ["cuiTypedTemplate"], usesInheritance: true, ngImport: i0 }); }
|
|
1614
|
+
}
|
|
1615
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiTypedTemplateDirective, decorators: [{
|
|
1616
|
+
type: Directive,
|
|
1617
|
+
args: [{
|
|
1618
|
+
selector: 'ng-template[cuiTypedTemplate]',
|
|
1619
|
+
standalone: true,
|
|
1620
|
+
exportAs: 'cuiTypedTemplate'
|
|
1621
|
+
}]
|
|
1622
|
+
}], ctorParameters: () => [] });
|
|
1623
|
+
|
|
1624
|
+
class CuiFilterPipe {
|
|
1625
|
+
transform(items, matcher, ...args) {
|
|
1626
|
+
return items.filter((item) => matcher(item, ...args));
|
|
1627
|
+
}
|
|
1628
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1629
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: CuiFilterPipe, isStandalone: true, name: "cuiFilter" }); }
|
|
1630
|
+
}
|
|
1631
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiFilterPipe, decorators: [{
|
|
1632
|
+
type: Pipe,
|
|
1633
|
+
args: [{
|
|
1634
|
+
standalone: true,
|
|
1635
|
+
name: 'cuiFilter'
|
|
1636
|
+
}]
|
|
1637
|
+
}] });
|
|
1638
|
+
|
|
1639
|
+
/**
|
|
1640
|
+
* Generated bundle index. Do not edit.
|
|
1641
|
+
*/
|
|
1642
|
+
|
|
1643
|
+
export { CUI_ACTIVE_ELEMENT, CUI_ANIMATION_FRAME, CUI_FALSE_HANDLER, CUI_HISTORY, CUI_IOS_REG_EXP, CUI_IS_ANDROID, CUI_IS_CYPRESS, CUI_IS_E2E, CUI_IS_IOS, CUI_IS_MOBILE, CUI_IS_PLAYWRIGHT, CUI_IS_TOUCH, CUI_IS_WEBKIT, CUI_LOCAL_STORAGE, CUI_NAVIGATOR, CUI_PLATFORM, CUI_REMOVED_ELEMENT, CUI_SAFARI_REG_EXP, CUI_SESSION_STORAGE, CUI_TRUE_HANDLER, CUI_USER_AGENT, CUI_WINDOW, CuiActiveZone, CuiAutoResizingDirective, CuiClickOutsideDirective, CuiConsumptionUnitsService, CuiContentEditableValueAccessorDirective, CuiDestroyService, CuiDimensionsObserverDirective, CuiDragDropDirective, CuiDragListDirective, CuiDragPointerDirective, CuiElementDirective, CuiFilterPipe, CuiFocusTrapDirective, CuiHandleScrollDirective, CuiHovered, CuiHoveredService, CuiIdService, CuiItemDirective, CuiLadderListDirective, CuiLetContext, CuiLetDirective, CuiPopoverService, CuiPureException, CuiTargetDirective, CuiTime, CuiTypedTemplateDirective, EMPTY_ARRAY, EMPTY_CLIENT_RECT, EMPTY_FUNCTION, EMPTY_QUERY, FilesUploader, SystemUnits, UnitsAmount, UnitsImperial, UnitsImperialLength, UnitsImperialSquare, UnitsImperialVolume, UnitsImperialWeight, UnitsMetric, UnitsMetricLength, UnitsMetricSquare, UnitsMetricVolume, UnitsMetricWeight, cuiArrayRemove, cuiBlurNativeFocused, cuiClamp, cuiContainsOrAfter, cuiCreateToken, cuiCreateTokenFromFactory, cuiGetActualTarget, cuiGetClosestFocusable, cuiGetDocumentOrShadowRoot, cuiGetElementObscures, cuiGetNativeFocused, cuiHovered, cuiIfMap, cuiInjectElement, cuiIsElement, cuiIsHTMLElement, cuiIsInput, cuiIsIos, cuiIsNativeFocused, cuiIsNativeKeyboardFocusable, cuiIsNativeMouseFocusable, cuiIsPresent, cuiIsTextNode, cuiIsTextarea, cuiIsTextfield, cuiMoveItemInArray, cuiPointToClientRect, cuiProvide, cuiPure, cuiPx, cuiTypedFromEvent, cuiWatch, cuiZoneOptimized, cuiZonefree, cuiZonefreeScheduler, cuiZonefull, cuiZonefullScheduler, svgNodeFilter, takeCaptureFromVideo };
|
|
1644
|
+
//# sourceMappingURL=cuby-ui-cdk.mjs.map
|