@acorex/cdk 22.0.0-next.9 → 22.0.1-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/acorex-cdk-carousel.mjs +22 -4
- package/fesm2022/acorex-cdk-carousel.mjs.map +1 -1
- package/fesm2022/acorex-cdk-common.mjs +238 -25
- package/fesm2022/acorex-cdk-common.mjs.map +1 -1
- package/fesm2022/acorex-cdk-drag-drop.mjs +182 -51
- package/fesm2022/acorex-cdk-drag-drop.mjs.map +1 -1
- package/fesm2022/acorex-cdk-full-screen.mjs +24 -145
- package/fesm2022/acorex-cdk-full-screen.mjs.map +1 -1
- package/fesm2022/acorex-cdk-gesture.mjs +202 -0
- package/fesm2022/acorex-cdk-gesture.mjs.map +1 -0
- package/fesm2022/acorex-cdk-highlight.mjs +108 -0
- package/fesm2022/acorex-cdk-highlight.mjs.map +1 -0
- package/fesm2022/acorex-cdk-horizontal-scroll.mjs +192 -30
- package/fesm2022/acorex-cdk-horizontal-scroll.mjs.map +1 -1
- package/fesm2022/acorex-cdk-input-mask.mjs +12 -4
- package/fesm2022/acorex-cdk-input-mask.mjs.map +1 -1
- package/fesm2022/acorex-cdk-outline.mjs +49 -12
- package/fesm2022/acorex-cdk-outline.mjs.map +1 -1
- package/fesm2022/acorex-cdk-overlay.mjs +123 -17
- package/fesm2022/acorex-cdk-overlay.mjs.map +1 -1
- package/fesm2022/acorex-cdk-shimmer.mjs +220 -0
- package/fesm2022/acorex-cdk-shimmer.mjs.map +1 -0
- package/fesm2022/acorex-cdk-sliding-item.mjs +70 -60
- package/fesm2022/acorex-cdk-sliding-item.mjs.map +1 -1
- package/gesture/README.md +3 -0
- package/horizontal-scroll/README.md +1 -1
- package/package.json +16 -7
- package/shimmer/README.md +11 -0
- package/sliding-item/README.md +4 -2
- package/types/acorex-cdk-carousel.d.ts +2 -0
- package/types/acorex-cdk-common.d.ts +95 -62
- package/types/acorex-cdk-drag-drop.d.ts +28 -3
- package/types/acorex-cdk-full-screen.d.ts +18 -43
- package/types/acorex-cdk-gesture.d.ts +132 -0
- package/types/acorex-cdk-highlight.d.ts +54 -0
- package/types/acorex-cdk-horizontal-scroll.d.ts +44 -11
- package/types/acorex-cdk-overlay.d.ts +35 -3
- package/types/acorex-cdk-shimmer.d.ts +68 -0
- package/types/acorex-cdk-sliding-item.d.ts +22 -4
- package/fesm2022/acorex-cdk-double-click.mjs +0 -178
- package/fesm2022/acorex-cdk-double-click.mjs.map +0 -1
- package/types/acorex-cdk-double-click.d.ts +0 -66
|
@@ -6,15 +6,24 @@ class AXCarouselDirective {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
this.carousel = signal(null, /* @ts-ignore */
|
|
8
8
|
...(ngDevMode ? [{ debugName: "carousel" }] : /* istanbul ignore next */ []));
|
|
9
|
-
// carouselOptions = input<AXCarouselOptions>();
|
|
10
9
|
this.el = inject(ElementRef);
|
|
11
10
|
this.platformId = inject(PLATFORM_ID);
|
|
11
|
+
this.initId = 0;
|
|
12
|
+
}
|
|
13
|
+
destroy() {
|
|
14
|
+
const instance = this.carousel();
|
|
15
|
+
if (!instance)
|
|
16
|
+
return;
|
|
17
|
+
this.carousel.set(null);
|
|
18
|
+
if (instance.destroyed)
|
|
19
|
+
return;
|
|
20
|
+
instance.destroy(true, true);
|
|
12
21
|
}
|
|
13
22
|
async init(option) {
|
|
14
23
|
if (!isPlatformBrowser(this.platformId))
|
|
15
24
|
return;
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
const id = ++this.initId;
|
|
26
|
+
this.destroy();
|
|
18
27
|
const parentElem = this.el.nativeElement;
|
|
19
28
|
const slides = parentElem.querySelectorAll('.ax-carousel-slide');
|
|
20
29
|
parentElem.querySelector('.ax-carousel-wrapper')?.classList.add('swiper-wrapper');
|
|
@@ -28,7 +37,12 @@ class AXCarouselDirective {
|
|
|
28
37
|
item.classList.add('swiper-slide');
|
|
29
38
|
});
|
|
30
39
|
const { A11y, Autoplay, Controller, EffectCoverflow, EffectCube, EffectFade, EffectFlip, EffectCreative, EffectCards, HashNavigation, History, Keyboard, Mousewheel, Navigation, Pagination, Parallax, Scrollbar, Thumbs, Virtual, Zoom, FreeMode, Grid, Manipulation, } = await import('swiper/modules');
|
|
31
|
-
|
|
40
|
+
if (id !== this.initId)
|
|
41
|
+
return;
|
|
42
|
+
const SwiperCtor = (await import('swiper')).Swiper;
|
|
43
|
+
if (id !== this.initId)
|
|
44
|
+
return;
|
|
45
|
+
const res = new SwiperCtor(parentElem, {
|
|
32
46
|
...option,
|
|
33
47
|
modules: [
|
|
34
48
|
A11y,
|
|
@@ -56,6 +70,10 @@ class AXCarouselDirective {
|
|
|
56
70
|
Manipulation,
|
|
57
71
|
],
|
|
58
72
|
});
|
|
73
|
+
if (id !== this.initId) {
|
|
74
|
+
res.destroy(true, true);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
59
77
|
this.carousel.set(res);
|
|
60
78
|
}
|
|
61
79
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXCarouselDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-cdk-carousel.mjs","sources":["../../../../packages/cdk/carousel/src/carousel.directive.ts","../../../../packages/cdk/carousel/src/acorex-cdk-carousel.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport { Directive, ElementRef, inject, PLATFORM_ID, signal } from '@angular/core';\nimport type { Swiper, SwiperOptions } from 'swiper/types';\n\nexport type AXCarousel = Swiper;\nexport type AXCarouselOptions = SwiperOptions;\n\n@Directive({\n selector: '[axCarousel]',\n exportAs: 'axCarousel',\n})\nexport class AXCarouselDirective {\n carousel = signal<AXCarousel>(null);\n
|
|
1
|
+
{"version":3,"file":"acorex-cdk-carousel.mjs","sources":["../../../../packages/cdk/carousel/src/carousel.directive.ts","../../../../packages/cdk/carousel/src/acorex-cdk-carousel.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport { Directive, ElementRef, inject, PLATFORM_ID, signal } from '@angular/core';\nimport type { Swiper, SwiperOptions } from 'swiper/types';\n\nexport type AXCarousel = Swiper;\nexport type AXCarouselOptions = SwiperOptions;\n\n@Directive({\n selector: '[axCarousel]',\n exportAs: 'axCarousel',\n})\nexport class AXCarouselDirective {\n carousel = signal<AXCarousel>(null);\n private el = inject(ElementRef);\n private platformId = inject(PLATFORM_ID);\n private initId = 0;\n\n destroy(): void {\n const instance = this.carousel();\n if (!instance) return;\n this.carousel.set(null);\n if (instance.destroyed) return;\n instance.destroy(true, true);\n }\n\n async init(option: AXCarouselOptions) {\n if (!isPlatformBrowser(this.platformId)) return;\n const id = ++this.initId;\n this.destroy();\n const parentElem = this.el.nativeElement as HTMLElement;\n const slides = parentElem.querySelectorAll('.ax-carousel-slide');\n\n parentElem.querySelector('.ax-carousel-wrapper')?.classList.add('swiper-wrapper');\n parentElem.querySelector('.ax-carousel-pagination')?.classList.add('swiper-pagination');\n parentElem.querySelector('.ax-carousel-scrollbar')?.classList.add('swiper-scrollbar');\n parentElem.querySelector('.ax-carousel-button-prev')?.classList.add('swiper-button-prev');\n parentElem.querySelector('.ax-carousel-button-next')?.classList.add('swiper-button-next');\n\n slides?.forEach((item) => {\n if (item.classList.contains('swiper-slide')) return;\n item.classList.add('swiper-slide');\n });\n\n const {\n A11y,\n Autoplay,\n Controller,\n EffectCoverflow,\n EffectCube,\n EffectFade,\n EffectFlip,\n EffectCreative,\n EffectCards,\n HashNavigation,\n History,\n Keyboard,\n Mousewheel,\n Navigation,\n Pagination,\n Parallax,\n Scrollbar,\n Thumbs,\n Virtual,\n Zoom,\n FreeMode,\n Grid,\n Manipulation,\n } = await import('swiper/modules');\n\n if (id !== this.initId) return;\n\n const SwiperCtor = (await import('swiper')).Swiper;\n if (id !== this.initId) return;\n\n const res = new SwiperCtor(parentElem, {\n ...option,\n modules: [\n A11y,\n Autoplay,\n Controller,\n EffectCoverflow,\n EffectCube,\n EffectFade,\n EffectFlip,\n EffectCreative,\n EffectCards,\n HashNavigation,\n History,\n Keyboard,\n Mousewheel,\n Navigation,\n Pagination,\n Parallax,\n Scrollbar,\n Thumbs,\n Virtual,\n Zoom,\n FreeMode,\n Grid,\n Manipulation,\n ],\n });\n\n if (id !== this.initId) {\n res.destroy(true, true);\n return;\n }\n\n this.carousel.set(res);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"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"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { model, output, Component, inject, ElementRef, signal, afterNextRender, Injectable, ChangeDetectorRef, ViewContainerRef,
|
|
2
|
+
import { model, output, Component, inject, ElementRef, signal, afterNextRender, Injectable, EventEmitter, PLATFORM_ID, ChangeDetectorRef, ViewContainerRef, DOCUMENT as DOCUMENT$1, Renderer2, Input, Directive, NgModule, InjectionToken, Output, input, effect } from '@angular/core';
|
|
3
3
|
import { AXHtmlUtil } from '@acorex/core/utils';
|
|
4
|
-
import { flatten, cloneDeep, isEqual, omit, get } from 'lodash-es';
|
|
5
4
|
import { isBrowser } from '@acorex/core/platform';
|
|
6
5
|
import { AXValidationService } from '@acorex/core/validation';
|
|
6
|
+
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
7
|
+
import { omit, isEqual, flatten, cloneDeep, get } from 'lodash-es';
|
|
7
8
|
import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
|
|
8
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
9
9
|
import { noop, Subscription, BehaviorSubject, debounceTime, distinctUntilChanged, Subject, fromEvent, skip } from 'rxjs';
|
|
10
10
|
import { DataSource } from '@angular/cdk/collections';
|
|
11
11
|
import { EventManager } from '@angular/platform-browser';
|
|
@@ -66,6 +66,13 @@ class NXComponent {
|
|
|
66
66
|
get nativeElement() {
|
|
67
67
|
return this.#elementRef.nativeElement;
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Gets the host HTML element of the component.
|
|
71
|
+
* Same contract as classic editors so `ax-label` / `ax-form-field` can associate the field.
|
|
72
|
+
*/
|
|
73
|
+
getHostElement() {
|
|
74
|
+
return this.nativeElement;
|
|
75
|
+
}
|
|
69
76
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: NXComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
70
77
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: NXComponent }); }
|
|
71
78
|
}
|
|
@@ -136,25 +143,155 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
136
143
|
}]
|
|
137
144
|
}], propDecorators: { look: [{ type: i0.Input, args: [{ isSignal: true, alias: "look", required: false }] }, { type: i0.Output, args: ["lookChange"] }] } });
|
|
138
145
|
|
|
139
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Signal-based value editor with the same `ax-validation-rule` / `ax-form` contract as the classic value mixins.
|
|
148
|
+
*/
|
|
149
|
+
class NXValueComponent extends NXComponent {
|
|
140
150
|
constructor() {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
this
|
|
144
|
-
|
|
145
|
-
this
|
|
146
|
-
|
|
147
|
-
this
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
+
super(...arguments);
|
|
152
|
+
this.validationRulesChange = new EventEmitter();
|
|
153
|
+
this.#validationRules = [];
|
|
154
|
+
this.#state = 'clear';
|
|
155
|
+
this.#validationService = inject(AXValidationService);
|
|
156
|
+
this.#document = inject(DOCUMENT);
|
|
157
|
+
this.#platformId = inject(PLATFORM_ID);
|
|
158
|
+
this.#registerValidation = afterNextRender(() => {
|
|
159
|
+
this.registerValidation();
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
#validationRules;
|
|
163
|
+
#state;
|
|
164
|
+
#validationService;
|
|
165
|
+
#document;
|
|
166
|
+
#platformId;
|
|
167
|
+
#registerValidation;
|
|
168
|
+
get isRequired() {
|
|
169
|
+
return this.#validationRules.some((rule) => rule.rule == 'required');
|
|
170
|
+
}
|
|
171
|
+
get state() {
|
|
172
|
+
return this.#state;
|
|
173
|
+
}
|
|
174
|
+
registerValidation() {
|
|
175
|
+
this.nativeElement.querySelectorAll('[ax-form-item="true"]').forEach((node) => {
|
|
176
|
+
node.removeAttribute('ax-form-item');
|
|
177
|
+
});
|
|
178
|
+
this.nativeElement.setAttribute('ax-form-item', 'true');
|
|
179
|
+
}
|
|
180
|
+
addValidationRule(rule) {
|
|
181
|
+
this.#validationRules.push(rule);
|
|
182
|
+
this.validationRulesChange.emit(this.#validationRules);
|
|
183
|
+
}
|
|
184
|
+
removeValidationRule(ruleToRemove) {
|
|
185
|
+
this.#validationRules = this.#validationRules.filter((rule) => {
|
|
186
|
+
if (rule.rule !== ruleToRemove.rule) {
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
const ruleOptions = omit(rule.options, ['title']);
|
|
190
|
+
const removeOptions = omit(ruleToRemove.options, ['title']);
|
|
191
|
+
return !isEqual(ruleOptions['pattern'], removeOptions['pattern']);
|
|
192
|
+
});
|
|
193
|
+
this.validationRulesChange.emit(this.#validationRules);
|
|
194
|
+
this.setState('clear');
|
|
195
|
+
}
|
|
196
|
+
removeValidationRuleByType(type) {
|
|
197
|
+
this.#validationRules = this.#validationRules.filter((rule) => rule.rule !== type);
|
|
198
|
+
this.validationRulesChange.emit(this.#validationRules);
|
|
199
|
+
this.setState('clear');
|
|
200
|
+
}
|
|
201
|
+
async validate() {
|
|
202
|
+
const containerClasses = ['ax-editor-container', 'ax-checkbox', 'ax-radio'];
|
|
203
|
+
const container = containerClasses.some((className) => this.nativeElement.classList.contains(className))
|
|
204
|
+
? this.nativeElement
|
|
205
|
+
: this.nativeElement.querySelector('.ax-editor-container');
|
|
206
|
+
const formField = (container || this.nativeElement).closest('ax-form-field') || container?.closest('ax-checkbox');
|
|
207
|
+
const label = formField?.querySelector('ax-label') || formField?.querySelector('label');
|
|
208
|
+
const rules = this.#validationService.ruleFor(this.#currentValue());
|
|
209
|
+
this.#validationRules.forEach((rule) => {
|
|
210
|
+
rule.options ??= {};
|
|
211
|
+
rule.options['title'] = (label?.firstChild?.textContent ?? this.#currentName())?.replace('*', '').trim();
|
|
212
|
+
rules.addRule(rule.rule, rule.options);
|
|
213
|
+
});
|
|
214
|
+
const result = await rules.validate();
|
|
215
|
+
if (result.result) {
|
|
216
|
+
this.setState('clear');
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
const message = result.rules.find((rule) => !rule.result)?.message;
|
|
220
|
+
this.setState('error', message);
|
|
221
|
+
}
|
|
222
|
+
return result;
|
|
223
|
+
}
|
|
224
|
+
setState(state, ...args) {
|
|
225
|
+
if (!isBrowser()) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const container = this.nativeElement.classList.contains('ax-editor-container')
|
|
229
|
+
? this.nativeElement
|
|
230
|
+
: this.nativeElement.querySelector('.ax-editor-container');
|
|
231
|
+
const formField = (container || this.nativeElement).closest('ax-form-field');
|
|
232
|
+
const label = formField?.querySelector('ax-label') || formField?.querySelector('label');
|
|
233
|
+
let target = container || this.nativeElement.firstElementChild;
|
|
234
|
+
if (target?.querySelector('.ax-error-container')) {
|
|
235
|
+
target = target.querySelector('.ax-error-container');
|
|
236
|
+
}
|
|
237
|
+
const parent = target?.parentElement;
|
|
238
|
+
if (!target || !parent) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
switch (state) {
|
|
242
|
+
case 'clear':
|
|
243
|
+
this.#state = 'clear';
|
|
244
|
+
parent.querySelector('span.ax-error-message')?.remove();
|
|
245
|
+
label?.classList.remove('ax-state-error');
|
|
246
|
+
target.classList.remove('ax-state-error', 'ax-state-success');
|
|
247
|
+
break;
|
|
248
|
+
case 'success':
|
|
249
|
+
this.setState('clear');
|
|
250
|
+
target.classList.add('ax-state-success');
|
|
251
|
+
this.#state = 'success';
|
|
252
|
+
break;
|
|
253
|
+
case 'error':
|
|
254
|
+
this.setState('clear');
|
|
255
|
+
if (isPlatformBrowser(this.#platformId)) {
|
|
256
|
+
const message = args[0] ?? '';
|
|
257
|
+
if (message) {
|
|
258
|
+
const span = this.#document.createElement('span');
|
|
259
|
+
span.innerHTML = message;
|
|
260
|
+
span.classList.add('ax-error-message');
|
|
261
|
+
parent.appendChild(span);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
label?.classList.add('ax-state-error');
|
|
265
|
+
target.classList.add('ax-state-error');
|
|
266
|
+
this.#state = 'error';
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
resetErrors() {
|
|
271
|
+
this.setState('clear');
|
|
272
|
+
}
|
|
273
|
+
commitValue(value, _isUserInteraction = false) {
|
|
274
|
+
const model = this.#valueModel();
|
|
275
|
+
model?.set?.(value);
|
|
276
|
+
}
|
|
277
|
+
#currentValue() {
|
|
278
|
+
return this.#resolve(this.value);
|
|
279
|
+
}
|
|
280
|
+
#currentName() {
|
|
281
|
+
return String(this.#resolve(this.name) ?? '');
|
|
282
|
+
}
|
|
283
|
+
#valueModel() {
|
|
284
|
+
return this.value;
|
|
285
|
+
}
|
|
286
|
+
#resolve(prop) {
|
|
287
|
+
return typeof prop === 'function' ? prop() : prop;
|
|
288
|
+
}
|
|
289
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: NXValueComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
290
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: NXValueComponent }); }
|
|
151
291
|
}
|
|
152
292
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: NXValueComponent, decorators: [{
|
|
153
|
-
type:
|
|
154
|
-
|
|
155
|
-
template: '',
|
|
156
|
-
}]
|
|
157
|
-
}], propDecorators: { readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }, { type: i0.Output, args: ["readonlyChange"] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }, { type: i0.Output, args: ["nameChange"] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], onValueChanged: [{ type: i0.Output, args: ["onValueChanged"] }] } });
|
|
293
|
+
type: Injectable
|
|
294
|
+
}] });
|
|
158
295
|
|
|
159
296
|
const defaultOffset = 3;
|
|
160
297
|
function convertToPlacement(value) {
|
|
@@ -575,7 +712,7 @@ class MXValueComponent extends MXInteractiveComponent {
|
|
|
575
712
|
this._isUserInteraction = false;
|
|
576
713
|
this.stateChange = new EventEmitter();
|
|
577
714
|
this._state = 'clear';
|
|
578
|
-
this.document = inject(DOCUMENT);
|
|
715
|
+
this.document = inject(DOCUMENT$1);
|
|
579
716
|
this.platformID = inject(PLATFORM_ID);
|
|
580
717
|
this.validationService = inject(AXValidationService);
|
|
581
718
|
this.validationRulesChange = new EventEmitter();
|
|
@@ -1263,7 +1400,7 @@ class AXAutoFocusDirective {
|
|
|
1263
1400
|
this._host = inject(AXFocusableComponent, { host: true, self: true, optional: true });
|
|
1264
1401
|
this.autoFocus = true;
|
|
1265
1402
|
this.time = 50;
|
|
1266
|
-
this.document = inject(DOCUMENT);
|
|
1403
|
+
this.document = inject(DOCUMENT$1);
|
|
1267
1404
|
this.platformID = inject(PLATFORM_ID);
|
|
1268
1405
|
}
|
|
1269
1406
|
ngAfterViewInit() {
|
|
@@ -1309,7 +1446,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
1309
1446
|
class AXHotkeysService {
|
|
1310
1447
|
constructor() {
|
|
1311
1448
|
this.eventManager = inject(EventManager);
|
|
1312
|
-
this.document = inject(DOCUMENT);
|
|
1449
|
+
this.document = inject(DOCUMENT$1);
|
|
1313
1450
|
this.defaults = {
|
|
1314
1451
|
element: this.document,
|
|
1315
1452
|
};
|
|
@@ -1977,9 +2114,17 @@ class MXSelectionValueComponent extends MXValueComponent {
|
|
|
1977
2114
|
const valueKey = isComplexObject ? get(itemRecord, this.valueField) : item;
|
|
1978
2115
|
const key = valueKey != null ? String(valueKey) : String(item);
|
|
1979
2116
|
const cacheKey = this.createCacheKey(key);
|
|
1980
|
-
// Return cached item if available and has text
|
|
1981
2117
|
const cachedItem = this.dataService.cacheList[cacheKey];
|
|
1982
2118
|
if (cachedItem && get(cachedItem, this.textField) != null) {
|
|
2119
|
+
if (isComplexObject) {
|
|
2120
|
+
const incomingText = get(itemRecord, this.textField);
|
|
2121
|
+
if (incomingText != null &&
|
|
2122
|
+
incomingText !== get(cachedItem, this.textField) &&
|
|
2123
|
+
incomingText !== '@acorex:common.status.loading') {
|
|
2124
|
+
Object.assign(cachedItem, itemRecord);
|
|
2125
|
+
delete cachedItem['_lastDisplayTextResult'];
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
1983
2128
|
return cachedItem;
|
|
1984
2129
|
}
|
|
1985
2130
|
const hasTextProperty = !isComplexObject || get(itemRecord, this.textField) != null;
|
|
@@ -2177,6 +2322,20 @@ class MXSelectionValueComponent extends MXValueComponent {
|
|
|
2177
2322
|
if (item && typeof item === 'object' && item['_displayTextLoading']) {
|
|
2178
2323
|
return '@acorex:common.status.loading';
|
|
2179
2324
|
}
|
|
2325
|
+
if (item && typeof item === 'object') {
|
|
2326
|
+
const incomingText = get(item, this.textField);
|
|
2327
|
+
if (incomingText != null && incomingText !== '' && incomingText !== '@acorex:common.status.loading') {
|
|
2328
|
+
const itemKey = get(item, this.valueField);
|
|
2329
|
+
if (itemKey != null) {
|
|
2330
|
+
const cachedItem = this.dataService.cacheList[this.createCacheKey(String(itemKey))];
|
|
2331
|
+
if (cachedItem && cachedItem[this.textField] !== incomingText) {
|
|
2332
|
+
cachedItem[this.textField] = incomingText;
|
|
2333
|
+
delete cachedItem['_lastDisplayTextResult'];
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
return String(incomingText);
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2180
2339
|
// Add timestamp-based debouncing to prevent excessive calls for ALL item types
|
|
2181
2340
|
const now = Date.now();
|
|
2182
2341
|
const itemKey = typeof item === 'string' ? item : get(item, this.valueField);
|
|
@@ -2491,7 +2650,7 @@ class AXRippleDirective {
|
|
|
2491
2650
|
this.cdr = inject(ChangeDetectorRef);
|
|
2492
2651
|
this.enabled = true;
|
|
2493
2652
|
this.axRippleColor = 'var(--ax-comp-ripple-color, rgba(255, 255, 255, 0.3))';
|
|
2494
|
-
this.document = inject(DOCUMENT);
|
|
2653
|
+
this.document = inject(DOCUMENT$1);
|
|
2495
2654
|
this.platformID = inject(PLATFORM_ID);
|
|
2496
2655
|
}
|
|
2497
2656
|
ngOnInit() {
|
|
@@ -2546,9 +2705,63 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
2546
2705
|
type: Input
|
|
2547
2706
|
}] } });
|
|
2548
2707
|
|
|
2708
|
+
/**
|
|
2709
|
+
* Scrolls `element` into view inside `container` using nearest-edge behavior.
|
|
2710
|
+
* Only adjusts the container's own scrollTop — never the document — so overlay
|
|
2711
|
+
* dismissal on document scroll is not triggered.
|
|
2712
|
+
*/
|
|
2713
|
+
function scrollNearestIntoView(container, element, topInset = 0) {
|
|
2714
|
+
const containerRect = container.getBoundingClientRect();
|
|
2715
|
+
const elementRect = element.getBoundingClientRect();
|
|
2716
|
+
const top = elementRect.top - containerRect.top - topInset;
|
|
2717
|
+
const bottom = elementRect.bottom - containerRect.bottom;
|
|
2718
|
+
if (top < 0) {
|
|
2719
|
+
container.scrollTop += top;
|
|
2720
|
+
}
|
|
2721
|
+
else if (bottom > 0) {
|
|
2722
|
+
container.scrollTop += bottom;
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
/**
|
|
2726
|
+
* Scrolls an option into view inside a scrollable container using nearest-edge behavior.
|
|
2727
|
+
* Uses bounding rects relative to the container so it works even when offsetParent differs.
|
|
2728
|
+
*/
|
|
2729
|
+
function scrollOptionWithinContainer(container, option) {
|
|
2730
|
+
const containerRect = container.getBoundingClientRect();
|
|
2731
|
+
const optionRect = option.getBoundingClientRect();
|
|
2732
|
+
const relativeTop = optionRect.top - containerRect.top + container.scrollTop;
|
|
2733
|
+
const relativeBottom = relativeTop + option.offsetHeight;
|
|
2734
|
+
const viewTop = container.scrollTop;
|
|
2735
|
+
const viewBottom = viewTop + container.clientHeight;
|
|
2736
|
+
const maxScroll = Math.max(0, container.scrollHeight - container.clientHeight);
|
|
2737
|
+
if (relativeTop < viewTop) {
|
|
2738
|
+
container.scrollTop = relativeTop;
|
|
2739
|
+
}
|
|
2740
|
+
else if (relativeBottom > viewBottom) {
|
|
2741
|
+
container.scrollTop = Math.min(relativeBottom - container.clientHeight, maxScroll);
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
/**
|
|
2745
|
+
* Retries `fn` on successive animation frames until it returns true or `attempts` is exhausted.
|
|
2746
|
+
* Used when the target element appears only after an overlay has been positioned and laid out.
|
|
2747
|
+
*/
|
|
2748
|
+
function retryFrames(fn, attempts = 5) {
|
|
2749
|
+
if (typeof requestAnimationFrame === 'undefined') {
|
|
2750
|
+
return;
|
|
2751
|
+
}
|
|
2752
|
+
let remaining = attempts;
|
|
2753
|
+
const tick = () => {
|
|
2754
|
+
if (fn() || --remaining <= 0) {
|
|
2755
|
+
return;
|
|
2756
|
+
}
|
|
2757
|
+
requestAnimationFrame(tick);
|
|
2758
|
+
};
|
|
2759
|
+
requestAnimationFrame(tick);
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2549
2762
|
/**
|
|
2550
2763
|
* Generated bundle index. Do not edit.
|
|
2551
2764
|
*/
|
|
2552
2765
|
|
|
2553
|
-
export { AXAutoFocusDirective, AXAutocompleteParentComponent, AXButtonClickEvent, AXClearableComponent, AXClickEvent, AXClosableComponent, AXCommonModule, AXComponent, AXComponentCloseEvent, AXComponentClosedPromise, AXComponentClosing, AXComponentResult, AXDataSource, AXDomService, AXEvent, AXFocusEvent, AXFocusableComponent, AXHotkeyDirective, AXHotkeysService, AXHtmlEvent, AXInfiniteScrollerDirective, AXInvertedColorDirective, AXItemClickEvent, AXItemSelectedEvent, AXListDataSource, AXNgModelDelayedValueChangedDirective, AXOptionChangedEvent, AXPagedComponent, AXRangeChangedEvent, AXResponsiveDirective, AXRippleDirective, AXSearchableComponent, AXSelectionValueChangedEvent, AXValuableComponent, AXValueChangedEvent, AX_LOCATIONS, AX_PLACEMENT_BOTTOM, AX_PLACEMENT_BOTTOM_END, AX_PLACEMENT_BOTTOM_START, AX_PLACEMENT_END, AX_PLACEMENT_END_BOTTOM, AX_PLACEMENT_END_TOP, AX_PLACEMENT_MAP, AX_PLACEMENT_START, AX_PLACEMENT_START_BOTTOM, AX_PLACEMENT_START_TOP, AX_PLACEMENT_TOP, AX_PLACEMENT_TOP_END, AX_PLACEMENT_TOP_START, AX_SELECTION_DATA_TOKEN, AX_STYLE_COLOR_TYPES, AX_STYLE_LOOK_TYPES, MXBaseComponent, MXButtonBaseComponent, MXColorComponent, MXColorLookComponent, MXInputBaseValueComponent, MXInteractiveComponent, MXLookComponent, MXLookableComponent, MXSelectionBridgeService, MXSelectionValueComponent, MXValueComponent, NXButtonComponent, NXClickEvent, NXColorComponent, NXComponent, NXEvent, NXInteractiveComponent, NXLookComponent, NXNativeEvent, NXValueComponent, TAB_META_KEY, applyDataSourceQuery, convertArrayToDataSource, convertToPlacement };
|
|
2766
|
+
export { AXAutoFocusDirective, AXAutocompleteParentComponent, AXButtonClickEvent, AXClearableComponent, AXClickEvent, AXClosableComponent, AXCommonModule, AXComponent, AXComponentCloseEvent, AXComponentClosedPromise, AXComponentClosing, AXComponentResult, AXDataSource, AXDomService, AXEvent, AXFocusEvent, AXFocusableComponent, AXHotkeyDirective, AXHotkeysService, AXHtmlEvent, AXInfiniteScrollerDirective, AXInvertedColorDirective, AXItemClickEvent, AXItemSelectedEvent, AXListDataSource, AXNgModelDelayedValueChangedDirective, AXOptionChangedEvent, AXPagedComponent, AXRangeChangedEvent, AXResponsiveDirective, AXRippleDirective, AXSearchableComponent, AXSelectionValueChangedEvent, AXValuableComponent, AXValueChangedEvent, AX_LOCATIONS, AX_PLACEMENT_BOTTOM, AX_PLACEMENT_BOTTOM_END, AX_PLACEMENT_BOTTOM_START, AX_PLACEMENT_END, AX_PLACEMENT_END_BOTTOM, AX_PLACEMENT_END_TOP, AX_PLACEMENT_MAP, AX_PLACEMENT_START, AX_PLACEMENT_START_BOTTOM, AX_PLACEMENT_START_TOP, AX_PLACEMENT_TOP, AX_PLACEMENT_TOP_END, AX_PLACEMENT_TOP_START, AX_SELECTION_DATA_TOKEN, AX_STYLE_COLOR_TYPES, AX_STYLE_LOOK_TYPES, MXBaseComponent, MXButtonBaseComponent, MXColorComponent, MXColorLookComponent, MXInputBaseValueComponent, MXInteractiveComponent, MXLookComponent, MXLookableComponent, MXSelectionBridgeService, MXSelectionValueComponent, MXValueComponent, NXButtonComponent, NXClickEvent, NXColorComponent, NXComponent, NXEvent, NXInteractiveComponent, NXLookComponent, NXNativeEvent, NXValueComponent, TAB_META_KEY, applyDataSourceQuery, convertArrayToDataSource, convertToPlacement, retryFrames, scrollNearestIntoView, scrollOptionWithinContainer };
|
|
2554
2767
|
//# sourceMappingURL=acorex-cdk-common.mjs.map
|