cmat 0.0.86 → 0.0.88
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/cmat-components-adapter.mjs +9 -9
- package/fesm2022/cmat-components-adapter.mjs.map +1 -1
- package/fesm2022/cmat-components-breadcrumb.mjs +98 -80
- package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/cmat-components-card.mjs +26 -34
- package/fesm2022/cmat-components-card.mjs.map +1 -1
- package/fesm2022/cmat-components-carousel.mjs +467 -556
- package/fesm2022/cmat-components-carousel.mjs.map +1 -1
- package/fesm2022/cmat-components-cascade.mjs +270 -259
- package/fesm2022/cmat-components-cascade.mjs.map +1 -1
- package/fesm2022/cmat-components-chip-input.mjs +200 -116
- package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
- package/fesm2022/cmat-components-code-editor.mjs +85 -38
- package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-color-picker.mjs +841 -0
- package/fesm2022/cmat-components-color-picker.mjs.map +1 -0
- package/fesm2022/cmat-components-custom-formly.mjs +1395 -838
- package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
- package/fesm2022/cmat-components-data-picker.mjs +996 -0
- package/fesm2022/cmat-components-data-picker.mjs.map +1 -0
- package/fesm2022/cmat-components-date-range.mjs +310 -264
- package/fesm2022/cmat-components-date-range.mjs.map +1 -1
- package/fesm2022/cmat-components-date-time-display.mjs +16 -20
- package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
- package/fesm2022/cmat-components-drawer.mjs +120 -137
- package/fesm2022/cmat-components-drawer.mjs.map +1 -1
- package/fesm2022/cmat-components-empty-state.mjs +17 -24
- package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
- package/fesm2022/cmat-components-file-preview.mjs +18 -24
- package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
- package/fesm2022/cmat-components-filter-toolbar.mjs +30 -39
- package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-form-actions.mjs +12 -12
- package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
- package/fesm2022/cmat-components-fullscreen.mjs +10 -10
- package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
- package/fesm2022/cmat-components-highlight.mjs +48 -41
- package/fesm2022/cmat-components-highlight.mjs.map +1 -1
- package/fesm2022/cmat-components-image-viewer.mjs +104 -107
- package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
- package/fesm2022/cmat-components-inline-loading.mjs +12 -15
- package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
- package/fesm2022/cmat-components-json-editor.mjs +118 -75
- package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-knob-input.mjs +196 -178
- package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
- package/fesm2022/cmat-components-masonry.mjs +26 -41
- package/fesm2022/cmat-components-masonry.mjs.map +1 -1
- package/fesm2022/cmat-components-material-color-picker.mjs +81 -80
- package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-material-datetimepicker.mjs +1212 -1287
- package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
- package/fesm2022/cmat-components-navigation.mjs +467 -450
- package/fesm2022/cmat-components-navigation.mjs.map +1 -1
- package/fesm2022/cmat-components-opt-input.mjs +143 -132
- package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
- package/fesm2022/cmat-components-org-chart.mjs +68 -83
- package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
- package/fesm2022/cmat-components-page-header.mjs +18 -24
- package/fesm2022/cmat-components-page-header.mjs.map +1 -1
- package/fesm2022/cmat-components-pagination.mjs +220 -136
- package/fesm2022/cmat-components-pagination.mjs.map +1 -1
- package/fesm2022/cmat-components-password-strength.mjs +262 -215
- package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
- package/fesm2022/cmat-components-popover.mjs +227 -195
- package/fesm2022/cmat-components-popover.mjs.map +1 -1
- package/fesm2022/cmat-components-progress-bar.mjs +15 -34
- package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
- package/fesm2022/cmat-components-qrcode.mjs +95 -88
- package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
- package/fesm2022/cmat-components-rating.mjs +70 -67
- package/fesm2022/cmat-components-rating.mjs.map +1 -1
- package/fesm2022/cmat-components-rich-text-editor.mjs +23 -26
- package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-select-search.mjs +190 -159
- package/fesm2022/cmat-components-select-search.mjs.map +1 -1
- package/fesm2022/cmat-components-select-table.mjs +276 -213
- package/fesm2022/cmat-components-select-table.mjs.map +1 -1
- package/fesm2022/cmat-components-select-tree.mjs +178 -128
- package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
- package/fesm2022/cmat-components-skeleton.mjs +44 -28
- package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
- package/fesm2022/cmat-components-speed-dial.mjs +107 -163
- package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
- package/fesm2022/cmat-components-status-tag.mjs +29 -36
- package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
- package/fesm2022/cmat-components-table-toolbar.mjs +14 -18
- package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-timeline.mjs +111 -118
- package/fesm2022/cmat-components-timeline.mjs.map +1 -1
- package/fesm2022/cmat-components-toast.mjs +65 -66
- package/fesm2022/cmat-components-toast.mjs.map +1 -1
- package/fesm2022/cmat-components-transfer-picker.mjs +130 -160
- package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-treetable.mjs +32 -39
- package/fesm2022/cmat-components-treetable.mjs.map +1 -1
- package/fesm2022/cmat-components-upload.mjs +186 -176
- package/fesm2022/cmat-components-upload.mjs.map +1 -1
- package/fesm2022/cmat-directives-animate-on-scroll.mjs +25 -28
- package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
- package/fesm2022/cmat-directives-arrow-cursor.mjs +85 -92
- package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
- package/fesm2022/cmat-directives-autofocus.mjs +3 -3
- package/fesm2022/cmat-directives-autofocus.mjs.map +1 -1
- package/fesm2022/cmat-directives-data-exporter.mjs +49 -50
- package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
- package/fesm2022/cmat-directives-debounce.mjs +16 -19
- package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
- package/fesm2022/cmat-directives-digit-only.mjs +60 -69
- package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
- package/fesm2022/cmat-directives-equal-validator.mjs +3 -3
- package/fesm2022/cmat-directives-equal-validator.mjs.map +1 -1
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +31 -30
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
- package/fesm2022/cmat-lib-mock-api.mjs +6 -6
- package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
- package/fesm2022/cmat-pipes-bytes.mjs +3 -3
- package/fesm2022/cmat-pipes-bytes.mjs.map +1 -1
- package/fesm2022/cmat-pipes-date-format.mjs +3 -3
- package/fesm2022/cmat-pipes-date-format.mjs.map +1 -1
- package/fesm2022/cmat-pipes-find-by-key.mjs +3 -3
- package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
- package/fesm2022/cmat-pipes-group-by.mjs +3 -3
- package/fesm2022/cmat-pipes-group-by.mjs.map +1 -1
- package/fesm2022/cmat-pipes-keys.mjs +3 -3
- package/fesm2022/cmat-pipes-keys.mjs.map +1 -1
- package/fesm2022/cmat-pipes-secure.mjs +7 -13
- package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
- package/fesm2022/cmat-pipes-uppercase.mjs +3 -3
- package/fesm2022/cmat-pipes-uppercase.mjs.map +1 -1
- package/fesm2022/cmat-services-alert.mjs +26 -27
- package/fesm2022/cmat-services-alert.mjs.map +1 -1
- package/fesm2022/cmat-services-config.mjs +14 -23
- package/fesm2022/cmat-services-config.mjs.map +1 -1
- package/fesm2022/cmat-services-confirmation.mjs +8 -8
- package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
- package/fesm2022/cmat-services-data.mjs +6 -10
- package/fesm2022/cmat-services-data.mjs.map +1 -1
- package/fesm2022/cmat-services-export-as.mjs +3 -3
- package/fesm2022/cmat-services-export-as.mjs.map +1 -1
- package/fesm2022/cmat-services-loading.mjs +30 -47
- package/fesm2022/cmat-services-loading.mjs.map +1 -1
- package/fesm2022/cmat-services-local-storage.mjs +3 -3
- package/fesm2022/cmat-services-local-storage.mjs.map +1 -1
- package/fesm2022/cmat-services-media-watcher.mjs +43 -34
- package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
- package/fesm2022/cmat-services-platform.mjs +3 -3
- package/fesm2022/cmat-services-platform.mjs.map +1 -1
- package/fesm2022/cmat-services-splash-screen.mjs +3 -3
- package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
- package/fesm2022/cmat-services-title.mjs +3 -3
- package/fesm2022/cmat-services-title.mjs.map +1 -1
- package/fesm2022/cmat-services-translation.mjs +11 -11
- package/fesm2022/cmat-services-translation.mjs.map +1 -1
- package/fesm2022/cmat-services-utils.mjs +4 -4
- package/fesm2022/cmat-services-utils.mjs.map +1 -1
- package/fesm2022/cmat.mjs +9229 -7508
- package/fesm2022/cmat.mjs.map +1 -1
- package/icons/material-icons/heroicons-outline.svg +3 -0
- package/icons/material-icons/heroicons-solid.svg +3 -0
- package/package.json +10 -1
- package/styles/components/bundle.scss +21 -0
- package/styles/overrides/angular-material.scss +22 -1
- package/tailwind/plugins/theming.js +183 -183
- package/types/cmat-components-breadcrumb.d.ts +40 -37
- package/types/cmat-components-card.d.ts +11 -13
- package/types/cmat-components-carousel.d.ts +87 -113
- package/types/cmat-components-cascade.d.ts +84 -65
- package/types/cmat-components-chip-input.d.ts +29 -24
- package/types/cmat-components-code-editor.d.ts +28 -12
- package/types/cmat-components-color-picker.d.ts +236 -0
- package/types/cmat-components-custom-formly.d.ts +316 -184
- package/types/cmat-components-data-picker.d.ts +372 -0
- package/types/cmat-components-date-range.d.ts +31 -36
- package/types/cmat-components-date-time-display.d.ts +8 -8
- package/types/cmat-components-drawer.d.ts +30 -32
- package/types/cmat-components-empty-state.d.ts +9 -10
- package/types/cmat-components-file-preview.d.ts +9 -9
- package/types/cmat-components-filter-toolbar.d.ts +15 -15
- package/types/cmat-components-form-actions.d.ts +5 -5
- package/types/cmat-components-fullscreen.d.ts +5 -5
- package/types/cmat-components-highlight.d.ts +13 -14
- package/types/cmat-components-image-viewer.d.ts +29 -33
- package/types/cmat-components-inline-loading.d.ts +6 -6
- package/types/cmat-components-json-editor.d.ts +15 -17
- package/types/cmat-components-knob-input.d.ts +58 -55
- package/types/cmat-components-masonry.d.ts +9 -12
- package/types/cmat-components-material-color-picker.d.ts +16 -21
- package/types/cmat-components-material-datetimepicker.d.ts +174 -216
- package/types/cmat-components-navigation.d.ts +34 -39
- package/types/cmat-components-opt-input.d.ts +35 -33
- package/types/cmat-components-org-chart.d.ts +8 -9
- package/types/cmat-components-page-header.d.ts +9 -9
- package/types/cmat-components-pagination.d.ts +36 -40
- package/types/cmat-components-password-strength.d.ts +58 -64
- package/types/cmat-components-popover.d.ts +22 -32
- package/types/cmat-components-progress-bar.d.ts +7 -10
- package/types/cmat-components-qrcode.d.ts +22 -22
- package/types/cmat-components-rating.d.ts +17 -19
- package/types/cmat-components-rich-text-editor.d.ts +11 -12
- package/types/cmat-components-select-search.d.ts +48 -36
- package/types/cmat-components-select-table.d.ts +38 -34
- package/types/cmat-components-select-tree.d.ts +17 -15
- package/types/cmat-components-skeleton.d.ts +27 -10
- package/types/cmat-components-speed-dial.d.ts +24 -33
- package/types/cmat-components-status-tag.d.ts +19 -9
- package/types/cmat-components-table-toolbar.d.ts +7 -7
- package/types/cmat-components-timeline.d.ts +33 -34
- package/types/cmat-components-toast.d.ts +26 -30
- package/types/cmat-components-transfer-picker.d.ts +51 -56
- package/types/cmat-components-treetable.d.ts +12 -13
- package/types/cmat-components-upload.d.ts +33 -38
- package/types/cmat-components-x6-angular-shape.d.ts +1 -1
- package/types/cmat-directives-animate-on-scroll.d.ts +7 -7
- package/types/cmat-directives-arrow-cursor.d.ts +18 -20
- package/types/cmat-directives-data-exporter.d.ts +10 -10
- package/types/cmat-directives-debounce.d.ts +5 -5
- package/types/cmat-directives-digit-only.d.ts +13 -13
- package/types/cmat-directives-seamless-auto-scroll.d.ts +7 -7
- package/types/cmat-pipes-secure.d.ts +1 -3
- package/types/cmat-services-alert.d.ts +11 -12
- package/types/cmat-services-config.d.ts +2 -7
- package/types/cmat-services-confirmation.d.ts +2 -2
- package/types/cmat-services-data.d.ts +0 -1
- package/types/cmat-services-loading.d.ts +14 -22
- package/types/cmat-services-media-watcher.d.ts +5 -5
- package/types/cmat-services-translation.d.ts +4 -5
- package/types/cmat.d.ts +2167 -1746
|
@@ -1,153 +1,156 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
2
|
+
import { input, output, signal, inject, DOCUMENT, computed, HostListener, Directive } from '@angular/core';
|
|
4
3
|
import { CmatMediaWatcherService } from 'cmat/services/media-watcher';
|
|
5
4
|
|
|
6
5
|
class CmatArrowCursorDirective {
|
|
7
6
|
constructor() {
|
|
8
|
-
this.animationDuration = 0.3
|
|
9
|
-
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
this.
|
|
13
|
-
|
|
14
|
-
this.
|
|
15
|
-
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
this.
|
|
7
|
+
this.animationDuration = input(0.3, /* @ts-ignore */
|
|
8
|
+
...(ngDevMode ? [{ debugName: "animationDuration" }] : /* istanbul ignore next */ []));
|
|
9
|
+
this.orientation = input('horizontal', /* @ts-ignore */
|
|
10
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
11
|
+
this.enabled = input(false, /* @ts-ignore */
|
|
12
|
+
...(ngDevMode ? [{ debugName: "enabled" }] : /* istanbul ignore next */ []));
|
|
13
|
+
this.selector = input('.carousel-arrow-cursor', /* @ts-ignore */
|
|
14
|
+
...(ngDevMode ? [{ debugName: "selector" }] : /* istanbul ignore next */ []));
|
|
15
|
+
this.clickEvent = output();
|
|
16
|
+
this._arrowCursor = null;
|
|
17
|
+
this._cursorAnimationFrame = signal(null, /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "_cursorAnimationFrame" }] : /* istanbul ignore next */ []));
|
|
19
|
+
this._cursorClientX = signal(0, /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "_cursorClientX" }] : /* istanbul ignore next */ []));
|
|
21
|
+
this._cursorClientY = signal(0, /* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [{ debugName: "_cursorClientY" }] : /* istanbul ignore next */ []));
|
|
23
|
+
this._cursorSide = signal(null, /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "_cursorSide" }] : /* istanbul ignore next */ []));
|
|
25
|
+
this._oldCursorSide = signal(null, /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "_oldCursorSide" }] : /* istanbul ignore next */ []));
|
|
21
27
|
this._document = inject(DOCUMENT);
|
|
22
28
|
this._cmatMediaWatcherService = inject(CmatMediaWatcherService);
|
|
23
|
-
this._destroyRef = inject(DestroyRef);
|
|
24
29
|
this._isCursorActive = false;
|
|
25
30
|
this._boundMoveCursor = this.moveCursor.bind(this);
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
32
|
+
this.isPhone = computed(() => {
|
|
33
|
+
return !this._cmatMediaWatcherService.mediaChange().matchingAliases.includes('lg');
|
|
34
|
+
}, /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "isPhone" }] : /* istanbul ignore next */ []));
|
|
26
36
|
}
|
|
27
37
|
onMouseEnter(event) {
|
|
28
|
-
if (!this.isPhone && this.enabled) {
|
|
29
|
-
this.
|
|
30
|
-
if (this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
if (this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
38
|
+
if (!this.isPhone() && this.enabled()) {
|
|
39
|
+
this._arrowCursor = this._document.querySelector(this.selector());
|
|
40
|
+
if (this._cursorIcon == null) {
|
|
41
|
+
this._cursorIcon = this._arrowCursor?.querySelector('.arrow-cursor-icon') ?? null;
|
|
42
|
+
this._cursorSide.set(null);
|
|
43
|
+
if (this._cursorIcon) {
|
|
44
|
+
this._cursorIcon.style.transform = 'rotate3d(0,0,1,-135deg) scale3d(0.5,0.5,1)';
|
|
45
|
+
this._cursorIcon.style.opacity = '0';
|
|
36
46
|
}
|
|
37
47
|
}
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
48
|
+
this._cursorClientX.set(event.clientX);
|
|
49
|
+
this._cursorClientY.set(event.clientY);
|
|
40
50
|
let t;
|
|
41
|
-
if (this.orientation === 'horizontal') {
|
|
42
|
-
this.
|
|
51
|
+
if (this.orientation() === 'horizontal') {
|
|
52
|
+
this._cursorSide.set(this._cursorClientX() > window.innerWidth / 2 ? 'right' : 'left');
|
|
43
53
|
const target = event.target;
|
|
44
54
|
if (target) {
|
|
45
|
-
t = (this.
|
|
55
|
+
t = (this._cursorClientY() < (target.getBoundingClientRect().top + target.getBoundingClientRect().height / 2))
|
|
46
56
|
? -135
|
|
47
|
-
: (this.
|
|
57
|
+
: (this._cursorSide() === 'right' ? 135 : -315);
|
|
48
58
|
}
|
|
49
59
|
else {
|
|
50
60
|
t = -135;
|
|
51
61
|
}
|
|
52
62
|
}
|
|
53
63
|
else {
|
|
54
|
-
this.
|
|
64
|
+
this._cursorSide.set(this._cursorClientY() > window.innerHeight / 2 ? 'down' : 'up');
|
|
55
65
|
const target = event.target;
|
|
56
66
|
if (target) {
|
|
57
|
-
t = (this.
|
|
67
|
+
t = (this._cursorClientX() < (target.getBoundingClientRect().left + target.getBoundingClientRect().width / 2))
|
|
58
68
|
? 135
|
|
59
|
-
: (this.
|
|
69
|
+
: (this._cursorSide() === 'down' ? -135 : 45);
|
|
60
70
|
}
|
|
61
71
|
else {
|
|
62
72
|
t = 135;
|
|
63
73
|
}
|
|
64
74
|
}
|
|
65
|
-
if (this.
|
|
66
|
-
this.
|
|
67
|
-
this.
|
|
68
|
-
this._applyCursorRotation(this.
|
|
69
|
-
this.
|
|
75
|
+
if (this._cursorIcon) {
|
|
76
|
+
this._cursorIcon.style.transform = 'rotate3d(0,0,1,' + t + 'deg)';
|
|
77
|
+
this._cursorIcon.style.transition = this.animationDuration() + 's';
|
|
78
|
+
this._applyCursorRotation(this._cursorSide());
|
|
79
|
+
this._cursorIcon.style.opacity = '1';
|
|
70
80
|
}
|
|
71
81
|
this._startCursorLoop();
|
|
72
82
|
}
|
|
73
83
|
}
|
|
74
84
|
onMouseLeave(event) {
|
|
75
|
-
if (!this.isPhone && this.enabled) {
|
|
85
|
+
if (!this.isPhone() && this.enabled()) {
|
|
76
86
|
let t;
|
|
77
87
|
const target = event.target;
|
|
78
88
|
if (!target) {
|
|
79
89
|
return;
|
|
80
90
|
}
|
|
81
|
-
if (this.orientation === 'horizontal') {
|
|
82
|
-
t = (this.
|
|
83
|
-
? (('right' === this.
|
|
84
|
-
: (('right' === this.
|
|
91
|
+
if (this.orientation() === 'horizontal') {
|
|
92
|
+
t = (this._cursorClientY() < (target.getBoundingClientRect().top + target.getBoundingClientRect().height / 2))
|
|
93
|
+
? (('right' === this._cursorSide()) ? -135 : -45)
|
|
94
|
+
: (('right' === this._cursorSide()) ? 135 : -315);
|
|
85
95
|
}
|
|
86
96
|
else {
|
|
87
|
-
t = (this.
|
|
88
|
-
? (('down' === this.
|
|
89
|
-
: (('down' === this.
|
|
97
|
+
t = (this._cursorClientX() < (target.getBoundingClientRect().left + target.getBoundingClientRect().width / 2))
|
|
98
|
+
? (('down' === this._cursorSide()) ? 225 : -225)
|
|
99
|
+
: (('down' === this._cursorSide()) ? -45 : 45);
|
|
90
100
|
}
|
|
91
|
-
if (this.
|
|
92
|
-
this.
|
|
93
|
-
this.
|
|
94
|
-
this.
|
|
101
|
+
if (this._cursorIcon) {
|
|
102
|
+
this._cursorIcon.style.transition = this.animationDuration() + 's';
|
|
103
|
+
this._cursorIcon.style.transform = 'rotate3d(0,0,1,' + t + 'deg) scale3d(0.3,0.3,1)';
|
|
104
|
+
this._cursorIcon.style.opacity = '0';
|
|
95
105
|
}
|
|
96
106
|
this._stopCursorLoop();
|
|
97
107
|
}
|
|
98
108
|
}
|
|
99
109
|
onMouseOver(event) {
|
|
100
|
-
if (!this.isPhone && this.
|
|
101
|
-
this.
|
|
102
|
-
this.
|
|
103
|
-
if (this.orientation === 'horizontal') {
|
|
104
|
-
this.
|
|
110
|
+
if (!this.isPhone() && this._cursorIcon && this.enabled()) {
|
|
111
|
+
this._cursorClientX.set(event.clientX);
|
|
112
|
+
this._cursorClientY.set(event.clientY);
|
|
113
|
+
if (this.orientation() === 'horizontal') {
|
|
114
|
+
this._cursorSide.set(this._cursorClientX() > window.innerWidth / 2 ? 'right' : 'left');
|
|
105
115
|
}
|
|
106
116
|
else {
|
|
107
|
-
this.
|
|
117
|
+
this._cursorSide.set(this._cursorClientY() > window.innerHeight / 2 ? 'down' : 'up');
|
|
108
118
|
}
|
|
109
|
-
if (this.
|
|
110
|
-
this.
|
|
111
|
-
this._applyCursorRotation(this.
|
|
112
|
-
this.
|
|
119
|
+
if (this._oldCursorSide() !== this._cursorSide()) {
|
|
120
|
+
this._cursorIcon.style.transition = this.animationDuration() + 's';
|
|
121
|
+
this._applyCursorRotation(this._cursorSide());
|
|
122
|
+
this._oldCursorSide.set(this._cursorSide());
|
|
113
123
|
}
|
|
114
124
|
}
|
|
115
125
|
}
|
|
116
126
|
onClick(event) {
|
|
117
|
-
if (!this.isPhone && this.
|
|
118
|
-
this.clickEvent.emit(this.
|
|
127
|
+
if (!this.isPhone() && this._cursorIcon && this.enabled()) {
|
|
128
|
+
this.clickEvent.emit(this._cursorSide());
|
|
119
129
|
event.stopPropagation();
|
|
120
130
|
}
|
|
121
131
|
}
|
|
122
|
-
ngAfterViewInit() {
|
|
123
|
-
this._cmatMediaWatcherService.onMediaChange$
|
|
124
|
-
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
125
|
-
.subscribe(({ matchingAliases }) => {
|
|
126
|
-
this.isPhone = !matchingAliases.includes('lg');
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
132
|
ngOnDestroy() {
|
|
130
133
|
this._stopCursorLoop();
|
|
131
134
|
}
|
|
132
135
|
moveCursor() {
|
|
133
|
-
if (this._isCursorActive && this.
|
|
134
|
-
this.
|
|
135
|
-
this.
|
|
136
|
+
if (this._isCursorActive && this._arrowCursor) {
|
|
137
|
+
this._arrowCursor.style.transform = 'translate3d(' + this._cursorClientX() + 'px,' + this._cursorClientY() + 'px,0px)';
|
|
138
|
+
this._cursorAnimationFrame.set(requestAnimationFrame(this._boundMoveCursor));
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
141
|
_startCursorLoop() {
|
|
139
142
|
this._isCursorActive = true;
|
|
140
|
-
this.
|
|
143
|
+
this._cursorAnimationFrame.set(requestAnimationFrame(this._boundMoveCursor));
|
|
141
144
|
}
|
|
142
145
|
_stopCursorLoop() {
|
|
143
146
|
this._isCursorActive = false;
|
|
144
|
-
if (this.
|
|
145
|
-
window.cancelAnimationFrame(this.
|
|
146
|
-
this.
|
|
147
|
+
if (this._cursorAnimationFrame() !== null) {
|
|
148
|
+
window.cancelAnimationFrame(this._cursorAnimationFrame() ?? 0);
|
|
149
|
+
this._cursorAnimationFrame.set(null);
|
|
147
150
|
}
|
|
148
151
|
}
|
|
149
152
|
_applyCursorRotation(side) {
|
|
150
|
-
if (!this.
|
|
153
|
+
if (!this._cursorIcon) {
|
|
151
154
|
return;
|
|
152
155
|
}
|
|
153
156
|
const rotationMap = {
|
|
@@ -158,28 +161,18 @@ class CmatArrowCursorDirective {
|
|
|
158
161
|
};
|
|
159
162
|
const transform = side ? rotationMap[side] : null;
|
|
160
163
|
if (transform) {
|
|
161
|
-
this.
|
|
164
|
+
this._cursorIcon.style.transform = transform;
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
165
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
167
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatArrowCursorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
168
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: CmatArrowCursorDirective, isStandalone: true, selector: "[cmatArrowCursor]", inputs: { animationDuration: { classPropertyName: "animationDuration", publicName: "animationDuration", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, enabled: { classPropertyName: "enabled", publicName: "enabled", isSignal: true, isRequired: false, transformFunction: null }, selector: { classPropertyName: "selector", publicName: "selector", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { clickEvent: "clickEvent" }, host: { listeners: { "mouseenter": "onMouseEnter($event)", "mouseleave": "onMouseLeave($event)", "mousemove": "onMouseOver($event)", "click": "onClick($event)" } }, ngImport: i0 }); }
|
|
166
169
|
}
|
|
167
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
170
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatArrowCursorDirective, decorators: [{
|
|
168
171
|
type: Directive,
|
|
169
172
|
args: [{
|
|
170
173
|
selector: '[cmatArrowCursor]'
|
|
171
174
|
}]
|
|
172
|
-
}], propDecorators: { animationDuration: [{
|
|
173
|
-
type: Input
|
|
174
|
-
}], orientation: [{
|
|
175
|
-
type: Input
|
|
176
|
-
}], enabled: [{
|
|
177
|
-
type: Input
|
|
178
|
-
}], selector: [{
|
|
179
|
-
type: Input
|
|
180
|
-
}], clickEvent: [{
|
|
181
|
-
type: Output
|
|
182
|
-
}], onMouseEnter: [{
|
|
175
|
+
}], propDecorators: { animationDuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "animationDuration", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], enabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "enabled", required: false }] }], selector: [{ type: i0.Input, args: [{ isSignal: true, alias: "selector", required: false }] }], clickEvent: [{ type: i0.Output, args: ["clickEvent"] }], onMouseEnter: [{
|
|
183
176
|
type: HostListener,
|
|
184
177
|
args: ['mouseenter', ['$event']]
|
|
185
178
|
}], onMouseLeave: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmat-directives-arrow-cursor.mjs","sources":["../../../projects/cmat/directives/arrow-cursor/arrow-cursor.directive.ts","../../../projects/cmat/directives/arrow-cursor/cmat-directives-arrow-cursor.ts"],"sourcesContent":["import { Directive, AfterViewInit, DestroyRef, EventEmitter, HostListener, Input, OnDestroy, Output, DOCUMENT, inject } from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { CmatMediaWatcherService } from 'cmat/services/media-watcher';\r\n\r\n@Directive({\r\n selector: '[cmatArrowCursor]'\r\n})\r\nexport class CmatArrowCursorDirective implements AfterViewInit, OnDestroy {\r\n @Input() animationDuration: number = 0.3;\r\n @Input() orientation: 'horizontal' | 'vertical' = 'horizontal';\r\n @Input() enabled: boolean = false;\r\n @Input() selector: string = '.carousel-arrow-cursor';\r\n @Output() clickEvent: EventEmitter<string | null> = new EventEmitter<string | null>();\r\n\r\n cursorAnimationFrame: number | null = null;\r\n isPhone = false;\r\n arrowCursor: HTMLDivElement | null = null;\r\n cursorClientX = 0;\r\n cursorClientY = 0;\r\n cursorIcon: SVGElement | null = null;\r\n cursorSide: string | null = null;\r\n oldCursorSide: string | null = null;\r\n\r\n private _document = inject<Document>(DOCUMENT);\r\n private _cmatMediaWatcherService = inject(CmatMediaWatcherService);\r\n private readonly _destroyRef = inject(DestroyRef);\r\n private _isCursorActive = false;\r\n private readonly _boundMoveCursor = this.moveCursor.bind(this);\r\n\r\n @HostListener('mouseenter', ['$event'])\r\n public onMouseEnter(event: MouseEvent): void {\r\n if (!this.isPhone && this.enabled) {\r\n this.arrowCursor ??= this._document.querySelector(this.selector);\r\n if (this.cursorIcon == null) {\r\n this.cursorIcon = this.arrowCursor?.querySelector('.arrow-cursor-icon') ?? null;\r\n this.cursorSide = null;\r\n\r\n if (this.cursorIcon) {\r\n this.cursorIcon.style.transform = 'rotate3d(0,0,1,-135deg) scale3d(0.5,0.5,1)';\r\n this.cursorIcon.style.opacity = '0';\r\n }\r\n }\r\n\r\n this.cursorClientX = event.clientX;\r\n this.cursorClientY = event.clientY;\r\n\r\n let t;\r\n\r\n if (this.orientation === 'horizontal') {\r\n this.cursorSide = this.cursorClientX > window.innerWidth / 2 ? 'right' : 'left';\r\n\r\n const target = event.target as HTMLElement | null;\r\n if (target) {\r\n t = (this.cursorClientY < (target.getBoundingClientRect().top + target.getBoundingClientRect().height / 2))\r\n ? -135\r\n : (this.cursorSide === 'right' ? 135 : -315);\r\n } else {\r\n t = -135;\r\n }\r\n } else {\r\n this.cursorSide = this.cursorClientY > window.innerHeight / 2 ? 'down' : 'up';\r\n\r\n const target = event.target as HTMLElement | null;\r\n if (target) {\r\n t = (this.cursorClientX < (target.getBoundingClientRect().left + target.getBoundingClientRect().width / 2))\r\n ? 135\r\n : (this.cursorSide === 'down' ? -135 : 45);\r\n } else {\r\n t = 135;\r\n }\r\n }\r\n\r\n if (this.cursorIcon) {\r\n this.cursorIcon.style.transform = 'rotate3d(0,0,1,' + t + 'deg)';\r\n this.cursorIcon.style.transition = this.animationDuration + 's';\r\n this._applyCursorRotation(this.cursorSide);\r\n this.cursorIcon.style.opacity = '1';\r\n }\r\n\r\n this._startCursorLoop();\r\n }\r\n }\r\n\r\n @HostListener('mouseleave', ['$event'])\r\n public onMouseLeave(event: MouseEvent): void {\r\n if (!this.isPhone && this.enabled) {\r\n let t;\r\n\r\n const target = event.target as HTMLElement | null;\r\n if (!target) {\r\n return;\r\n }\r\n\r\n if (this.orientation === 'horizontal') {\r\n t = (this.cursorClientY < (target.getBoundingClientRect().top + target.getBoundingClientRect().height / 2))\r\n ? (('right' === this.cursorSide) ? -135 : -45)\r\n : (('right' === this.cursorSide) ? 135 : -315);\r\n } else {\r\n t = (this.cursorClientX < (target.getBoundingClientRect().left + target.getBoundingClientRect().width / 2))\r\n ? (('down' === this.cursorSide) ? 225 : -225)\r\n : (('down' === this.cursorSide) ? -45 : 45);\r\n }\r\n\r\n if (this.cursorIcon) {\r\n this.cursorIcon.style.transition = this.animationDuration + 's';\r\n this.cursorIcon.style.transform = 'rotate3d(0,0,1,' + t + 'deg) scale3d(0.3,0.3,1)';\r\n this.cursorIcon.style.opacity = '0';\r\n }\r\n\r\n this._stopCursorLoop();\r\n }\r\n }\r\n\r\n @HostListener('mousemove', ['$event'])\r\n public onMouseOver(event: MouseEvent): void {\r\n if (!this.isPhone && this.cursorIcon && this.enabled) {\r\n this.cursorClientX = event.clientX;\r\n this.cursorClientY = event.clientY;\r\n\r\n if (this.orientation === 'horizontal') {\r\n this.cursorSide = this.cursorClientX > window.innerWidth / 2 ? 'right' : 'left';\r\n } else {\r\n this.cursorSide = this.cursorClientY > window.innerHeight / 2 ? 'down' : 'up';\r\n }\r\n\r\n if (this.oldCursorSide !== this.cursorSide) {\r\n this.cursorIcon.style.transition = this.animationDuration + 's';\r\n this._applyCursorRotation(this.cursorSide);\r\n this.oldCursorSide = this.cursorSide;\r\n }\r\n }\r\n }\r\n\r\n @HostListener('click', ['$event'])\r\n onClick(event: Event): void {\r\n if (!this.isPhone && this.cursorIcon && this.enabled) {\r\n this.clickEvent.emit(this.cursorSide);\r\n\r\n event.stopPropagation();\r\n }\r\n }\r\n\r\n ngAfterViewInit(): void {\r\n this._cmatMediaWatcherService.onMediaChange$\r\n .pipe(takeUntilDestroyed(this._destroyRef))\r\n .subscribe(({ matchingAliases }) => {\r\n this.isPhone = !matchingAliases.includes('lg');\r\n });\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this._stopCursorLoop();\r\n }\r\n\r\n moveCursor(): void {\r\n if (this._isCursorActive && this.arrowCursor) {\r\n this.arrowCursor.style.transform = 'translate3d(' + this.cursorClientX + 'px,' + this.cursorClientY + 'px,0px)';\r\n this.cursorAnimationFrame = requestAnimationFrame(this._boundMoveCursor);\r\n }\r\n }\r\n\r\n private _startCursorLoop(): void {\r\n this._isCursorActive = true;\r\n this.cursorAnimationFrame = requestAnimationFrame(this._boundMoveCursor);\r\n }\r\n\r\n private _stopCursorLoop(): void {\r\n this._isCursorActive = false;\r\n if (this.cursorAnimationFrame !== null) {\r\n window.cancelAnimationFrame(this.cursorAnimationFrame);\r\n this.cursorAnimationFrame = null;\r\n }\r\n }\r\n\r\n private _applyCursorRotation(side: string | null): void {\r\n if (!this.cursorIcon) {\r\n return;\r\n }\r\n const rotationMap: Record<string, string> = {\r\n 'left': 'rotate3d(0,0,1,-180deg)',\r\n 'up': 'rotate3d(0,0,1,-90deg)',\r\n 'right': 'rotate3d(0,0,1,0deg)',\r\n 'down': 'rotate3d(0,0,1,90deg)'\r\n };\r\n const transform = side ? rotationMap[side] : null;\r\n if (transform) {\r\n this.cursorIcon.style.transform = transform;\r\n }\r\n }\r\n\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAOa,wBAAwB,CAAA;AAHrC,IAAA,WAAA,GAAA;QAIa,IAAA,CAAA,iBAAiB,GAAW,GAAG;QAC/B,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;sBACA;;sBACA;;sBACA;;sBAiBA,YAAY;uBAAC,YAAY,EAAE,CAAC,QAAQ,CAAC;;sBAsDrC,YAAY;uBAAC,YAAY,EAAE,CAAC,QAAQ,CAAC;;sBA8BrC,YAAY;uBAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;;sBAoBpC,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;;ACrIrC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cmat-directives-arrow-cursor.mjs","sources":["../../../projects/cmat/directives/arrow-cursor/arrow-cursor.directive.ts","../../../projects/cmat/directives/arrow-cursor/cmat-directives-arrow-cursor.ts"],"sourcesContent":["import {\r\n Directive,\r\n HostListener,\r\n DOCUMENT,\r\n inject,\r\n input,\r\n output,\r\n OnDestroy,\r\n computed,\r\n signal,\r\n} from '@angular/core';\r\nimport { CmatMediaWatcherService } from 'cmat/services/media-watcher';\r\n\r\n@Directive({\r\n selector: '[cmatArrowCursor]'\r\n})\r\nexport class CmatArrowCursorDirective implements OnDestroy {\r\n readonly animationDuration = input<number>(0.3);\r\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal');\r\n readonly enabled = input<boolean>(false);\r\n readonly selector = input<string>('.carousel-arrow-cursor');\r\n\r\n readonly clickEvent = output<string | null>();\r\n\r\n private _arrowCursor: HTMLDivElement | null = null;\r\n private _cursorIcon: SVGElement | null;\r\n\r\n private readonly _cursorAnimationFrame = signal<number | null>(null);\r\n private readonly _cursorClientX = signal(0);\r\n private readonly _cursorClientY = signal(0);\r\n private readonly _cursorSide = signal<string | null>(null);\r\n private readonly _oldCursorSide = signal<string | null>(null);\r\n\r\n private _document = inject<Document>(DOCUMENT);\r\n private _cmatMediaWatcherService = inject(CmatMediaWatcherService);\r\n private _isCursorActive = false;\r\n private readonly _boundMoveCursor = this.moveCursor.bind(this);\r\n\r\n // eslint-disable-next-line @typescript-eslint/member-ordering\r\n readonly isPhone = computed(() => {\r\n return !this._cmatMediaWatcherService.mediaChange().matchingAliases.includes('lg')\r\n });\r\n\r\n @HostListener('mouseenter', ['$event'])\r\n public onMouseEnter(event: MouseEvent): void {\r\n if (!this.isPhone() && this.enabled()) {\r\n this._arrowCursor = this._document.querySelector(this.selector());\r\n if (this._cursorIcon == null) {\r\n this._cursorIcon = this._arrowCursor?.querySelector('.arrow-cursor-icon') ?? null;\r\n this._cursorSide.set(null);\r\n\r\n if (this._cursorIcon) {\r\n this._cursorIcon.style.transform = 'rotate3d(0,0,1,-135deg) scale3d(0.5,0.5,1)';\r\n this._cursorIcon.style.opacity = '0';\r\n }\r\n }\r\n\r\n this._cursorClientX.set(event.clientX);\r\n this._cursorClientY.set(event.clientY);\r\n\r\n let t;\r\n\r\n if (this.orientation() === 'horizontal') {\r\n this._cursorSide.set(this._cursorClientX() > window.innerWidth / 2 ? 'right' : 'left');\r\n\r\n const target = event.target as HTMLElement | null;\r\n if (target) {\r\n t = (this._cursorClientY() < (target.getBoundingClientRect().top + target.getBoundingClientRect().height / 2))\r\n ? -135\r\n : (this._cursorSide() === 'right' ? 135 : -315);\r\n } else {\r\n t = -135;\r\n }\r\n } else {\r\n this._cursorSide.set(this._cursorClientY() > window.innerHeight / 2 ? 'down' : 'up');\r\n\r\n const target = event.target as HTMLElement | null;\r\n if (target) {\r\n t = (this._cursorClientX() < (target.getBoundingClientRect().left + target.getBoundingClientRect().width / 2))\r\n ? 135\r\n : (this._cursorSide() === 'down' ? -135 : 45);\r\n } else {\r\n t = 135;\r\n }\r\n }\r\n\r\n if (this._cursorIcon) {\r\n this._cursorIcon.style.transform = 'rotate3d(0,0,1,' + t + 'deg)';\r\n this._cursorIcon.style.transition = this.animationDuration() + 's';\r\n this._applyCursorRotation(this._cursorSide());\r\n this._cursorIcon.style.opacity = '1';\r\n }\r\n\r\n this._startCursorLoop();\r\n }\r\n }\r\n\r\n @HostListener('mouseleave', ['$event'])\r\n public onMouseLeave(event: MouseEvent): void {\r\n if (!this.isPhone() && this.enabled()) {\r\n let t;\r\n\r\n const target = event.target as HTMLElement | null;\r\n if (!target) {\r\n return;\r\n }\r\n\r\n if (this.orientation() === 'horizontal') {\r\n t = (this._cursorClientY() < (target.getBoundingClientRect().top + target.getBoundingClientRect().height / 2))\r\n ? (('right' === this._cursorSide()) ? -135 : -45)\r\n : (('right' === this._cursorSide()) ? 135 : -315);\r\n } else {\r\n t = (this._cursorClientX() < (target.getBoundingClientRect().left + target.getBoundingClientRect().width / 2))\r\n ? (('down' === this._cursorSide()) ? 225 : -225)\r\n : (('down' === this._cursorSide()) ? -45 : 45);\r\n }\r\n\r\n if (this._cursorIcon) {\r\n this._cursorIcon.style.transition = this.animationDuration() + 's';\r\n this._cursorIcon.style.transform = 'rotate3d(0,0,1,' + t + 'deg) scale3d(0.3,0.3,1)';\r\n this._cursorIcon.style.opacity = '0';\r\n }\r\n\r\n this._stopCursorLoop();\r\n }\r\n }\r\n\r\n @HostListener('mousemove', ['$event'])\r\n public onMouseOver(event: MouseEvent): void {\r\n if (!this.isPhone() && this._cursorIcon && this.enabled()) {\r\n this._cursorClientX.set(event.clientX);\r\n this._cursorClientY.set(event.clientY);\r\n\r\n if (this.orientation() === 'horizontal') {\r\n this._cursorSide.set(this._cursorClientX() > window.innerWidth / 2 ? 'right' : 'left');\r\n } else {\r\n this._cursorSide.set(this._cursorClientY() > window.innerHeight / 2 ? 'down' : 'up');\r\n }\r\n\r\n if (this._oldCursorSide() !== this._cursorSide()) {\r\n this._cursorIcon.style.transition = this.animationDuration() + 's';\r\n this._applyCursorRotation(this._cursorSide());\r\n this._oldCursorSide.set(this._cursorSide());\r\n }\r\n }\r\n }\r\n\r\n @HostListener('click', ['$event'])\r\n onClick(event: Event): void {\r\n if (!this.isPhone() && this._cursorIcon && this.enabled()) {\r\n this.clickEvent.emit(this._cursorSide());\r\n\r\n event.stopPropagation();\r\n }\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this._stopCursorLoop();\r\n }\r\n\r\n moveCursor(): void {\r\n if (this._isCursorActive && this._arrowCursor) {\r\n this._arrowCursor.style.transform = 'translate3d(' + this._cursorClientX() + 'px,' + this._cursorClientY() + 'px,0px)';\r\n this._cursorAnimationFrame.set(requestAnimationFrame(this._boundMoveCursor));\r\n }\r\n }\r\n\r\n private _startCursorLoop(): void {\r\n this._isCursorActive = true;\r\n this._cursorAnimationFrame.set(requestAnimationFrame(this._boundMoveCursor));\r\n }\r\n\r\n private _stopCursorLoop(): void {\r\n this._isCursorActive = false;\r\n if (this._cursorAnimationFrame() !== null) {\r\n window.cancelAnimationFrame(this._cursorAnimationFrame() ?? 0);\r\n this._cursorAnimationFrame.set(null);\r\n }\r\n }\r\n\r\n private _applyCursorRotation(side: string | null): void {\r\n if (!this._cursorIcon) {\r\n return;\r\n }\r\n const rotationMap: Record<string, string> = {\r\n 'left': 'rotate3d(0,0,1,-180deg)',\r\n 'up': 'rotate3d(0,0,1,-90deg)',\r\n 'right': 'rotate3d(0,0,1,0deg)',\r\n 'down': 'rotate3d(0,0,1,90deg)'\r\n };\r\n const transform = side ? rotationMap[side] : null;\r\n if (transform) {\r\n this._cursorIcon.style.transform = transform;\r\n }\r\n }\r\n\r\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAgBa,wBAAwB,CAAA;AAHrC,IAAA,WAAA,GAAA;QAIa,IAAA,CAAA,iBAAiB,GAAG,KAAK,CAAS,GAAG;8FAAC;QACtC,IAAA,CAAA,WAAW,GAAG,KAAK,CAA4B,YAAY;wFAAC;QAC5D,IAAA,CAAA,OAAO,GAAG,KAAK,CAAU,KAAK;oFAAC;QAC/B,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAS,wBAAwB;qFAAC;QAElD,IAAA,CAAA,UAAU,GAAG,MAAM,EAAiB;QAErC,IAAA,CAAA,YAAY,GAA0B,IAAI;QAGjC,IAAA,CAAA,qBAAqB,GAAG,MAAM,CAAgB,IAAI;kGAAC;QACnD,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,CA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AAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,UAAA,EAAA,YAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,YAAA,EAAA,sBAAA,EAAA,YAAA,EAAA,sBAAA,EAAA,WAAA,EAAA,qBAAA,EAAA,OAAA,EAAA,iBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAHpC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE;AACb,iBAAA;;sBA4BI,YAAY;uBAAC,YAAY,EAAE,CAAC,QAAQ,CAAC;;sBAsDrC,YAAY;uBAAC,YAAY,EAAE,CAAC,QAAQ,CAAC;;sBA8BrC,YAAY;uBAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;;sBAoBpC,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;;ACnJrC;;AAEG;;;;"}
|
|
@@ -8,10 +8,10 @@ class CmatAutofocusDirective {
|
|
|
8
8
|
this.element.nativeElement.focus();
|
|
9
9
|
}, 0);
|
|
10
10
|
}
|
|
11
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
12
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
11
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatAutofocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
12
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.2", type: CmatAutofocusDirective, isStandalone: true, selector: "[cmatAutofocus]", ngImport: i0 }); }
|
|
13
13
|
}
|
|
14
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatAutofocusDirective, decorators: [{
|
|
15
15
|
type: Directive,
|
|
16
16
|
args: [{
|
|
17
17
|
selector: '[cmatAutofocus]'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmat-directives-autofocus.mjs","sources":["../../../projects/cmat/directives/autofocus/autofocus.directive.ts","../../../projects/cmat/directives/autofocus/cmat-directives-autofocus.ts"],"sourcesContent":["import { Directive, ElementRef, inject } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[cmatAutofocus]'\r\n})\r\nexport class CmatAutofocusDirective {\r\n element = inject<ElementRef<HTMLElement>>(ElementRef);\r\n\r\n constructor() {\r\n setTimeout(() => {\r\n this.element.nativeElement.focus();\r\n }, 0);\r\n\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAKa,sBAAsB,CAAA;AAGjC,IAAA,WAAA,GAAA;AAFA,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAA0B,UAAU,CAAC;QAGnD,UAAU,CAAC,MAAK;AACd,YAAA,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE;QACpC,CAAC,EAAE,CAAC,CAAC;IAEP
|
|
1
|
+
{"version":3,"file":"cmat-directives-autofocus.mjs","sources":["../../../projects/cmat/directives/autofocus/autofocus.directive.ts","../../../projects/cmat/directives/autofocus/cmat-directives-autofocus.ts"],"sourcesContent":["import { Directive, ElementRef, inject } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[cmatAutofocus]'\r\n})\r\nexport class CmatAutofocusDirective {\r\n element = inject<ElementRef<HTMLElement>>(ElementRef);\r\n\r\n constructor() {\r\n setTimeout(() => {\r\n this.element.nativeElement.focus();\r\n }, 0);\r\n\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAKa,sBAAsB,CAAA;AAGjC,IAAA,WAAA,GAAA;AAFA,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAA0B,UAAU,CAAC;QAGnD,UAAU,CAAC,MAAK;AACd,YAAA,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE;QACpC,CAAC,EAAE,CAAC,CAAC;IAEP;8GARW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAtB,sBAAsB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAHlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE;AACX,iBAAA;;;ACJD;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, inject, Injector,
|
|
2
|
+
import { Injectable, inject, Injector, input, Directive } from '@angular/core';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import * as FileSaver from 'file-saver-es';
|
|
5
5
|
|
|
@@ -107,10 +107,10 @@ class CsvExporterService extends WorksheetExporter {
|
|
|
107
107
|
getMimeType() {
|
|
108
108
|
return MIME_CSV;
|
|
109
109
|
}
|
|
110
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
111
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
110
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CsvExporterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
111
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CsvExporterService, providedIn: 'root' }); }
|
|
112
112
|
}
|
|
113
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CsvExporterService, decorators: [{
|
|
114
114
|
type: Injectable,
|
|
115
115
|
args: [{
|
|
116
116
|
providedIn: 'root'
|
|
@@ -131,10 +131,10 @@ class JsonExporterService extends FileExporter {
|
|
|
131
131
|
getMimeType() {
|
|
132
132
|
return MIME_JSON;
|
|
133
133
|
}
|
|
134
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
135
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
134
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: JsonExporterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
135
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: JsonExporterService, providedIn: 'root' }); }
|
|
136
136
|
}
|
|
137
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
137
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: JsonExporterService, decorators: [{
|
|
138
138
|
type: Injectable,
|
|
139
139
|
args: [{
|
|
140
140
|
providedIn: 'root'
|
|
@@ -165,10 +165,10 @@ class TxtExporterService extends FileExporter {
|
|
|
165
165
|
return TAB;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
169
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
168
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: TxtExporterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
169
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: TxtExporterService, providedIn: 'root' }); }
|
|
170
170
|
}
|
|
171
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
171
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: TxtExporterService, decorators: [{
|
|
172
172
|
type: Injectable,
|
|
173
173
|
args: [{
|
|
174
174
|
providedIn: 'root'
|
|
@@ -212,10 +212,10 @@ class XlsExporterService extends WorksheetExporter {
|
|
|
212
212
|
_convertToWch(columnWidths) {
|
|
213
213
|
return columnWidths.map(width => ({ wch: width }));
|
|
214
214
|
}
|
|
215
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
216
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
215
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: XlsExporterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
216
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: XlsExporterService, providedIn: 'root' }); }
|
|
217
217
|
}
|
|
218
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
218
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: XlsExporterService, decorators: [{
|
|
219
219
|
type: Injectable,
|
|
220
220
|
args: [{
|
|
221
221
|
providedIn: 'root'
|
|
@@ -229,10 +229,10 @@ class XlsxExporterService extends XlsExporterService {
|
|
|
229
229
|
getMimeType() {
|
|
230
230
|
return MIME_EXCEL_XLSX;
|
|
231
231
|
}
|
|
232
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
233
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
232
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: XlsxExporterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
233
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: XlsxExporterService, providedIn: 'root' }); }
|
|
234
234
|
}
|
|
235
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
235
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: XlsxExporterService, decorators: [{
|
|
236
236
|
type: Injectable,
|
|
237
237
|
args: [{
|
|
238
238
|
providedIn: 'root'
|
|
@@ -264,10 +264,10 @@ class ServiceLocatorService {
|
|
|
264
264
|
return this._injector.get(XlsxExporterService);
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
268
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
267
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: ServiceLocatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
268
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: ServiceLocatorService, providedIn: 'root' }); }
|
|
269
269
|
}
|
|
270
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
270
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: ServiceLocatorService, decorators: [{
|
|
271
271
|
type: Injectable,
|
|
272
272
|
args: [{
|
|
273
273
|
providedIn: 'root'
|
|
@@ -276,67 +276,66 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
276
276
|
|
|
277
277
|
class CmatDataExporterDirective {
|
|
278
278
|
constructor() {
|
|
279
|
-
this.
|
|
280
|
-
|
|
281
|
-
this.
|
|
279
|
+
this.dataSource = input([], /* @ts-ignore */
|
|
280
|
+
...(ngDevMode ? [{ debugName: "dataSource" }] : /* istanbul ignore next */ []));
|
|
281
|
+
this.exportColumns = input([], /* @ts-ignore */
|
|
282
|
+
...(ngDevMode ? [{ debugName: "exportColumns" }] : /* istanbul ignore next */ []));
|
|
283
|
+
this.options = input(/* @ts-ignore */
|
|
284
|
+
...(ngDevMode ? [undefined, { debugName: "options" }] : /* istanbul ignore next */ []));
|
|
285
|
+
this.exportType = input('xlsx', /* @ts-ignore */
|
|
286
|
+
...(ngDevMode ? [{ debugName: "exportType" }] : /* istanbul ignore next */ []));
|
|
287
|
+
this.transformBoolean = input(true, /* @ts-ignore */
|
|
288
|
+
...(ngDevMode ? [{ debugName: "transformBoolean" }] : /* istanbul ignore next */ []));
|
|
289
|
+
this.transformDate = input(true, /* @ts-ignore */
|
|
290
|
+
...(ngDevMode ? [{ debugName: "transformDate" }] : /* istanbul ignore next */ []));
|
|
291
|
+
this.dateFormat = input('YYYY-MM-DD', /* @ts-ignore */
|
|
292
|
+
...(ngDevMode ? [{ debugName: "dateFormat" }] : /* istanbul ignore next */ []));
|
|
282
293
|
this._serviceLocator = inject(ServiceLocatorService);
|
|
283
294
|
}
|
|
284
295
|
ngOnChanges(changes) {
|
|
285
296
|
if (changes.dataSource) {
|
|
286
|
-
if (this.dataSource?.length > 0) {
|
|
297
|
+
if (this.dataSource()?.length > 0) {
|
|
287
298
|
this._data = [];
|
|
288
|
-
this._loadExporter(this.exportType);
|
|
299
|
+
this._loadExporter(this.exportType());
|
|
289
300
|
this._data = [
|
|
290
|
-
this.exportColumns
|
|
301
|
+
this.exportColumns()
|
|
302
|
+
.map(column => ({ [column.code]: column.label }))
|
|
291
303
|
.reduce((acc, curr) => ({ ...acc, ...curr }), {}),
|
|
292
|
-
...this.dataSource.map(user => this.exportColumns.reduce((acc, column) => {
|
|
304
|
+
...this.dataSource().map(user => this.exportColumns().reduce((acc, column) => {
|
|
293
305
|
let value = user[column.code];
|
|
294
|
-
if (this.transformBoolean && typeof value === 'boolean') {
|
|
306
|
+
if (this.transformBoolean() && typeof value === 'boolean') {
|
|
295
307
|
value = value ? '是' : '否';
|
|
296
308
|
}
|
|
297
|
-
else if (this.transformDate
|
|
309
|
+
else if (this.transformDate() &&
|
|
310
|
+
(value instanceof Date || typeof value === 'string')) {
|
|
298
311
|
const datePattern = /^\d{4}[-/]\d{1,2}[-/]\d{1,2}/;
|
|
299
312
|
if (typeof value === 'string' && !datePattern.test(value)) {
|
|
300
313
|
return { ...acc, [column.code]: value };
|
|
301
314
|
}
|
|
302
315
|
const dateValue = dayjs(value);
|
|
303
316
|
if (dateValue.isValid()) {
|
|
304
|
-
value = dateValue.format(this.dateFormat);
|
|
317
|
+
value = dateValue.format(this.dateFormat());
|
|
305
318
|
}
|
|
306
319
|
}
|
|
307
320
|
return { ...acc, [column.code]: value };
|
|
308
|
-
}, {}))
|
|
321
|
+
}, {})),
|
|
309
322
|
];
|
|
310
|
-
this._exporterService.export(this._data, this.options);
|
|
323
|
+
this._exporterService.export(this._data, this.options());
|
|
311
324
|
}
|
|
312
325
|
}
|
|
313
326
|
}
|
|
314
327
|
_loadExporter(exportType) {
|
|
315
328
|
this._exporterService = this._serviceLocator.getService(exportType);
|
|
316
329
|
}
|
|
317
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
318
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
330
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDataExporterDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
331
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: CmatDataExporterDirective, isStandalone: true, selector: "button[cmatDataExporter]", inputs: { dataSource: { classPropertyName: "dataSource", publicName: "dataSource", isSignal: true, isRequired: false, transformFunction: null }, exportColumns: { classPropertyName: "exportColumns", publicName: "exportColumns", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, exportType: { classPropertyName: "exportType", publicName: "exportType", isSignal: true, isRequired: false, transformFunction: null }, transformBoolean: { classPropertyName: "transformBoolean", publicName: "transformBoolean", isSignal: true, isRequired: false, transformFunction: null }, transformDate: { classPropertyName: "transformDate", publicName: "transformDate", isSignal: true, isRequired: false, transformFunction: null }, dateFormat: { classPropertyName: "dateFormat", publicName: "dateFormat", isSignal: true, isRequired: false, transformFunction: null } }, usesOnChanges: true, ngImport: i0 }); }
|
|
319
332
|
}
|
|
320
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
333
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CmatDataExporterDirective, decorators: [{
|
|
321
334
|
type: Directive,
|
|
322
335
|
args: [{
|
|
323
|
-
selector: 'button[cmatDataExporter]'
|
|
336
|
+
selector: 'button[cmatDataExporter]',
|
|
324
337
|
}]
|
|
325
|
-
}], propDecorators: { dataSource: [{
|
|
326
|
-
type: Input
|
|
327
|
-
}], exportColumns: [{
|
|
328
|
-
type: Input
|
|
329
|
-
}], options: [{
|
|
330
|
-
type: Input
|
|
331
|
-
}], exportType: [{
|
|
332
|
-
type: Input
|
|
333
|
-
}], transformBoolean: [{
|
|
334
|
-
type: Input
|
|
335
|
-
}], transformDate: [{
|
|
336
|
-
type: Input
|
|
337
|
-
}], dateFormat: [{
|
|
338
|
-
type: Input
|
|
339
|
-
}] } });
|
|
338
|
+
}], propDecorators: { dataSource: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataSource", required: false }] }], exportColumns: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportColumns", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], exportType: [{ type: i0.Input, args: [{ isSignal: true, alias: "exportType", required: false }] }], transformBoolean: [{ type: i0.Input, args: [{ isSignal: true, alias: "transformBoolean", required: false }] }], transformDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "transformDate", required: false }] }], dateFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFormat", required: false }] }] } });
|
|
340
339
|
|
|
341
340
|
/**
|
|
342
341
|
* Generated bundle index. Do not edit.
|