shirkasoft-ui-components 1.14.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -9
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs +189 -100
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-button.mjs +363 -69
- package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-chart.mjs +206 -142
- package/fesm2022/shirkasoft-ui-components-chart.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-config.mjs +905 -843
- package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +307 -142
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs +1697 -1440
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs +347 -92
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs +555 -300
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-icons.mjs +1028 -533
- package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-knob.mjs +389 -201
- package/fesm2022/shirkasoft-ui-components-knob.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-loading.mjs +505 -128
- package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-modal.mjs +311 -314
- package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-notification.mjs +188 -142
- package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-price-input.mjs +585 -327
- package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs +669 -289
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-select.mjs +1076 -819
- package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs +508 -184
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs +197 -57
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +1916 -1698
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tabs.mjs +419 -175
- package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tag.mjs +175 -49
- package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-text-field.mjs +749 -402
- package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +310 -124
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme.mjs +141 -174
- package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-timeline.mjs +791 -203
- package/fesm2022/shirkasoft-ui-components-timeline.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-toggle.mjs +179 -109
- package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs +244 -180
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs +129 -133
- package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-wizard.mjs +673 -165
- package/fesm2022/shirkasoft-ui-components-wizard.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components.mjs +0 -9
- package/package.json +5 -5
- package/types/shirkasoft-ui-components-breadcrumb.d.ts +59 -44
- package/types/shirkasoft-ui-components-button.d.ts +142 -49
- package/types/shirkasoft-ui-components-chart.d.ts +59 -44
- package/types/shirkasoft-ui-components-config.d.ts +193 -204
- package/types/shirkasoft-ui-components-confirm-dialog.d.ts +107 -66
- package/types/shirkasoft-ui-components-date-picker.d.ts +561 -398
- package/types/shirkasoft-ui-components-fieldset.d.ts +135 -60
- package/types/shirkasoft-ui-components-file-upload.d.ts +210 -112
- package/types/shirkasoft-ui-components-icons.d.ts +1302 -1294
- package/types/shirkasoft-ui-components-knob.d.ts +144 -78
- package/types/shirkasoft-ui-components-loading.d.ts +155 -64
- package/types/shirkasoft-ui-components-modal.d.ts +134 -136
- package/types/shirkasoft-ui-components-notification.d.ts +63 -59
- package/types/shirkasoft-ui-components-price-input.d.ts +232 -113
- package/types/shirkasoft-ui-components-rail-sidebar.d.ts +262 -142
- package/types/shirkasoft-ui-components-select.d.ts +335 -196
- package/types/shirkasoft-ui-components-sidebar.d.ts +198 -93
- package/types/shirkasoft-ui-components-skeleton.d.ts +68 -27
- package/types/shirkasoft-ui-components-table.d.ts +849 -660
- package/types/shirkasoft-ui-components-tabs.d.ts +102 -61
- package/types/shirkasoft-ui-components-tag.d.ts +54 -23
- package/types/shirkasoft-ui-components-text-field.d.ts +263 -127
- package/types/shirkasoft-ui-components-theme-picker.d.ts +92 -58
- package/types/shirkasoft-ui-components-theme.d.ts +56 -64
- package/types/shirkasoft-ui-components-timeline.d.ts +325 -150
- package/types/shirkasoft-ui-components-toggle.d.ts +73 -49
- package/types/shirkasoft-ui-components-tooltip.d.ts +64 -43
- package/types/shirkasoft-ui-components-utils.d.ts +47 -15
- package/types/shirkasoft-ui-components-wizard.d.ts +236 -87
- package/types/shirkasoft-ui-components.d.ts +1 -2
- package/fesm2022/shirkasoft-ui-components.mjs.map +0 -1
|
@@ -1,315 +1,312 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { CommonModule } from
|
|
4
|
-
import { LucideX, ShkIconDirective } from
|
|
5
|
-
import { TranslocoService } from
|
|
6
|
-
import { Router } from
|
|
7
|
-
import { NotificationService } from
|
|
8
|
-
import { getIcon } from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
if (
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Generated bundle index. Do not edit.
|
|
312
|
-
*/
|
|
313
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, Injectable, ViewContainerRef, computed, effect, inject, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { CommonModule } from "@angular/common";
|
|
4
|
+
import { LucideX, ShkIconDirective } from "shirkasoft-ui-components/icons";
|
|
5
|
+
import { TranslocoService } from "@jsverse/transloco";
|
|
6
|
+
import { Router } from "@angular/router";
|
|
7
|
+
import { NotificationService } from "shirkasoft-ui-components/notification";
|
|
8
|
+
import { getIcon } from "shirkasoft-ui-components/utils";
|
|
9
|
+
var ModalService = class ModalService {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.stackSignal = signal([], ...ngDevMode ? [{ debugName: "stackSignal" }] : /* istanbul ignore next */ []);
|
|
12
|
+
this.closeRequestSignal = signal(0, ...ngDevMode ? [{ debugName: "closeRequestSignal" }] : /* istanbul ignore next */ []);
|
|
13
|
+
this.router = inject(Router);
|
|
14
|
+
this.destroyRef = inject(DestroyRef);
|
|
15
|
+
this.modalStack = computed(() => this.stackSignal(), ...ngDevMode ? [{ debugName: "modalStack" }] : /* istanbul ignore next */ []);
|
|
16
|
+
this.currentModal = computed(() => {
|
|
17
|
+
const stack = this.stackSignal();
|
|
18
|
+
return stack.length > 0 ? stack[stack.length - 1] : null;
|
|
19
|
+
}, ...ngDevMode ? [{ debugName: "currentModal" }] : /* istanbul ignore next */ []);
|
|
20
|
+
this.closeRequest = computed(() => this.closeRequestSignal(), ...ngDevMode ? [{ debugName: "closeRequest" }] : /* istanbul ignore next */ []);
|
|
21
|
+
this.router.events.subscribe(() => {
|
|
22
|
+
this.stackSignal.set([]);
|
|
23
|
+
});
|
|
24
|
+
this.destroyRef.onDestroy(() => this.stackSignal.set([]));
|
|
25
|
+
}
|
|
26
|
+
open(config) {
|
|
27
|
+
this.stackSignal.update((stack) => [...stack, config]);
|
|
28
|
+
}
|
|
29
|
+
accept() {
|
|
30
|
+
this.close();
|
|
31
|
+
}
|
|
32
|
+
close() {
|
|
33
|
+
const stack = this.stackSignal();
|
|
34
|
+
if (stack.length > 0) {
|
|
35
|
+
stack[stack.length - 1]?.onClose?.();
|
|
36
|
+
this.stackSignal.set(stack.slice(0, -1));
|
|
37
|
+
this.closeRequestSignal.update((v) => v + 1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
clear() {
|
|
41
|
+
this.stackSignal.set([]);
|
|
42
|
+
}
|
|
43
|
+
static {
|
|
44
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
45
|
+
minVersion: "12.0.0",
|
|
46
|
+
version: "22.3.2",
|
|
47
|
+
ngImport: i0,
|
|
48
|
+
type: ModalService,
|
|
49
|
+
deps: [],
|
|
50
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
static {
|
|
54
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
55
|
+
minVersion: "12.0.0",
|
|
56
|
+
version: "22.3.2",
|
|
57
|
+
ngImport: i0,
|
|
58
|
+
type: ModalService,
|
|
59
|
+
providedIn: "root"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
64
|
+
minVersion: "12.0.0",
|
|
65
|
+
version: "22.3.2",
|
|
66
|
+
ngImport: i0,
|
|
67
|
+
type: ModalService,
|
|
68
|
+
decorators: [{
|
|
69
|
+
type: Injectable,
|
|
70
|
+
args: [{ providedIn: "root" }]
|
|
71
|
+
}],
|
|
72
|
+
ctorParameters: () => []
|
|
73
|
+
});
|
|
74
|
+
var ModalComponent = class ModalComponent {
|
|
75
|
+
constructor() {
|
|
76
|
+
this.getIcon = (name) => getIcon(name, LucideX);
|
|
77
|
+
this.notificationSrv = inject(NotificationService);
|
|
78
|
+
this.destroyRef = inject(DestroyRef);
|
|
79
|
+
this.modalSrv = inject(ModalService);
|
|
80
|
+
this.transloco = inject(TranslocoService);
|
|
81
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
82
|
+
this.container = viewChild("dynamicContent", {
|
|
83
|
+
...ngDevMode ? { debugName: "container" } : /* istanbul ignore next */ {},
|
|
84
|
+
read: ViewContainerRef
|
|
85
|
+
});
|
|
86
|
+
this.currentConfig = signal(null, ...ngDevMode ? [{ debugName: "currentConfig" }] : /* istanbul ignore next */ []);
|
|
87
|
+
this.title = signal("", ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
88
|
+
this.visible = signal(false, ...ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []);
|
|
89
|
+
this.loading = signal(false, ...ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []);
|
|
90
|
+
this.isProcessing = signal(false, ...ngDevMode ? [{ debugName: "isProcessing" }] : /* istanbul ignore next */ []);
|
|
91
|
+
this.isExpanded = signal(false, ...ngDevMode ? [{ debugName: "isExpanded" }] : /* istanbul ignore next */ []);
|
|
92
|
+
this.isFormValid = signal(false, ...ngDevMode ? [{ debugName: "isFormValid" }] : /* istanbul ignore next */ []);
|
|
93
|
+
this.componentRef = null;
|
|
94
|
+
this.subscriptions = [];
|
|
95
|
+
this.computedModalWidth = computed(() => {
|
|
96
|
+
return this.isExpanded() ? "100vw" : this.currentConfig()?.width ?? "560px";
|
|
97
|
+
}, ...ngDevMode ? [{ debugName: "computedModalWidth" }] : /* istanbul ignore next */ []);
|
|
98
|
+
this.modalButtonsVisible = computed(() => this.currentConfig()?.showButtons ?? true, ...ngDevMode ? [{ debugName: "modalButtonsVisible" }] : /* istanbul ignore next */ []);
|
|
99
|
+
this.showExpandButton = computed(() => this.currentConfig()?.showExpandButton ?? false, ...ngDevMode ? [{ debugName: "showExpandButton" }] : /* istanbul ignore next */ []);
|
|
100
|
+
this.cancelLabel = computed(() => this.currentConfig()?.cancelLabel || "Cancelar", ...ngDevMode ? [{ debugName: "cancelLabel" }] : /* istanbul ignore next */ []);
|
|
101
|
+
this.acceptLabel = computed(() => this.currentConfig()?.acceptLabel || "Aceptar", ...ngDevMode ? [{ debugName: "acceptLabel" }] : /* istanbul ignore next */ []);
|
|
102
|
+
effect(() => {
|
|
103
|
+
const config = this.modalSrv.currentModal();
|
|
104
|
+
if (config) {
|
|
105
|
+
this.currentConfig.set(config);
|
|
106
|
+
this.title.set(config.title);
|
|
107
|
+
this.isExpanded.set(false);
|
|
108
|
+
this.visible.set(true);
|
|
109
|
+
this.isProcessing.set(false);
|
|
110
|
+
this.loading.set(false);
|
|
111
|
+
this.cdr.markForCheck();
|
|
112
|
+
setTimeout(() => {
|
|
113
|
+
untracked(() => this.loadComponent(config));
|
|
114
|
+
});
|
|
115
|
+
} else {
|
|
116
|
+
this.visible.set(false);
|
|
117
|
+
this.currentConfig.set(null);
|
|
118
|
+
this.cdr.markForCheck();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
this.destroyRef.onDestroy(() => this.cleanup());
|
|
122
|
+
}
|
|
123
|
+
onVisibleChange(show) {
|
|
124
|
+
this.visible.set(show);
|
|
125
|
+
if (!show) this.closeModal();
|
|
126
|
+
this.cdr.markForCheck();
|
|
127
|
+
}
|
|
128
|
+
loadComponent(config) {
|
|
129
|
+
const containerRef = this.container();
|
|
130
|
+
if (!containerRef) return;
|
|
131
|
+
this.cleanup();
|
|
132
|
+
containerRef.clear();
|
|
133
|
+
this.componentRef = containerRef.createComponent(config.component);
|
|
134
|
+
if (config.data) Object.entries(config.data).forEach(([key, value]) => {
|
|
135
|
+
this.componentRef?.setInput(key, value);
|
|
136
|
+
});
|
|
137
|
+
const instance = this.componentRef.instance;
|
|
138
|
+
this.subscribeToOutput(instance.formValid, (valid) => {
|
|
139
|
+
this.isFormValid.set(valid);
|
|
140
|
+
this.cdr.markForCheck();
|
|
141
|
+
});
|
|
142
|
+
this.subscribeToOutput(instance.submitSuccess, (payload) => this.handleSubmit(true, payload));
|
|
143
|
+
this.subscribeToOutput(instance.submitError, () => this.handleSubmit(false));
|
|
144
|
+
this.componentRef.changeDetectorRef.markForCheck();
|
|
145
|
+
this.cdr.markForCheck();
|
|
146
|
+
}
|
|
147
|
+
subscribeToOutput(output, callback) {
|
|
148
|
+
if (output?.subscribe) this.subscriptions.push(output.subscribe(callback));
|
|
149
|
+
}
|
|
150
|
+
handleSubmit(success, payload) {
|
|
151
|
+
this.isProcessing.set(false);
|
|
152
|
+
this.loading.set(false);
|
|
153
|
+
this.cdr.markForCheck();
|
|
154
|
+
if (success) {
|
|
155
|
+
const onAccept = this.currentConfig()?.onAccept;
|
|
156
|
+
if (onAccept) untracked(() => onAccept(payload !== void 0 ? payload : this.getFormValue()));
|
|
157
|
+
untracked(() => this.modalSrv.accept());
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
getFormValue() {
|
|
161
|
+
const instance = this.componentRef?.instance;
|
|
162
|
+
const form = instance ? this.getForm(instance) : null;
|
|
163
|
+
if (!form) return void 0;
|
|
164
|
+
return this.isSignalField(form) ? form.value() : form.getRawValue?.();
|
|
165
|
+
}
|
|
166
|
+
closeModal() {
|
|
167
|
+
if (this.componentRef?.instance?.handleCancel) this.componentRef.instance.handleCancel();
|
|
168
|
+
this.doClose();
|
|
169
|
+
}
|
|
170
|
+
doClose() {
|
|
171
|
+
this.visible.set(false);
|
|
172
|
+
this.isProcessing.set(false);
|
|
173
|
+
this.loading.set(false);
|
|
174
|
+
if (this.isExpanded()) this.isExpanded.set(false);
|
|
175
|
+
this.cdr.markForCheck();
|
|
176
|
+
setTimeout(() => {
|
|
177
|
+
this.cleanup();
|
|
178
|
+
this.modalSrv.close();
|
|
179
|
+
}, 100);
|
|
180
|
+
}
|
|
181
|
+
toggleExpand() {
|
|
182
|
+
this.isExpanded.update((v) => !v);
|
|
183
|
+
this.cdr.markForCheck();
|
|
184
|
+
}
|
|
185
|
+
onAccept() {
|
|
186
|
+
if (!this.componentRef || !this.isDynamicComponent(this.componentRef.instance)) return;
|
|
187
|
+
if (this.isProcessing()) return;
|
|
188
|
+
const instance = this.componentRef.instance;
|
|
189
|
+
const form = this.getForm(instance);
|
|
190
|
+
if (form) {
|
|
191
|
+
if (this.isSignalField(form)) form.markAsTouched();
|
|
192
|
+
else this.markAllAsTouched(form);
|
|
193
|
+
this.componentRef.changeDetectorRef.markForCheck();
|
|
194
|
+
this.cdr.markForCheck();
|
|
195
|
+
if (this.isSignalField(form) ? form.errorSummary().some((error) => error.kind !== "warning") : this.hasRealErrors(form)) {
|
|
196
|
+
this.notificationSrv.addNotification(this.transloco.translate("modal.formInvalid"), "warning");
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
this.isProcessing.set(true);
|
|
201
|
+
this.loading.set(true);
|
|
202
|
+
this.cdr.markForCheck();
|
|
203
|
+
instance.onSubmit();
|
|
204
|
+
}
|
|
205
|
+
getForm(instance) {
|
|
206
|
+
if (!instance["form"]) return null;
|
|
207
|
+
return typeof instance["form"] === "function" ? instance["form"]() : instance["form"];
|
|
208
|
+
}
|
|
209
|
+
isSignalField(form) {
|
|
210
|
+
return typeof form.errorSummary === "function";
|
|
211
|
+
}
|
|
212
|
+
hasRealErrors(control) {
|
|
213
|
+
const errors = control.errors;
|
|
214
|
+
if (errors && Object.keys(errors).some((key) => key !== "warning")) return true;
|
|
215
|
+
return this.childControls(control).some((child) => this.hasRealErrors(child));
|
|
216
|
+
}
|
|
217
|
+
markAllAsTouched(control) {
|
|
218
|
+
control.markAsTouched();
|
|
219
|
+
control.updateValueAndValidity({
|
|
220
|
+
onlySelf: true,
|
|
221
|
+
emitEvent: true
|
|
222
|
+
});
|
|
223
|
+
this.childControls(control).forEach((child) => this.markAllAsTouched(child));
|
|
224
|
+
}
|
|
225
|
+
childControls(control) {
|
|
226
|
+
if (!control.controls) return [];
|
|
227
|
+
return Array.isArray(control.controls) ? control.controls : Object.values(control.controls);
|
|
228
|
+
}
|
|
229
|
+
isDynamicComponent(instance) {
|
|
230
|
+
return typeof instance?.onSubmit === "function";
|
|
231
|
+
}
|
|
232
|
+
cleanup() {
|
|
233
|
+
this.subscriptions.forEach((sub) => sub.unsubscribe());
|
|
234
|
+
this.subscriptions = [];
|
|
235
|
+
if (this.componentRef) {
|
|
236
|
+
this.componentRef.destroy();
|
|
237
|
+
this.componentRef = null;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
static {
|
|
241
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
242
|
+
minVersion: "12.0.0",
|
|
243
|
+
version: "22.3.2",
|
|
244
|
+
ngImport: i0,
|
|
245
|
+
type: ModalComponent,
|
|
246
|
+
deps: [],
|
|
247
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
static {
|
|
251
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
252
|
+
minVersion: "17.0.0",
|
|
253
|
+
version: "22.3.2",
|
|
254
|
+
type: ModalComponent,
|
|
255
|
+
isStandalone: true,
|
|
256
|
+
selector: "shk-modal",
|
|
257
|
+
viewQueries: [{
|
|
258
|
+
propertyName: "container",
|
|
259
|
+
first: true,
|
|
260
|
+
predicate: ["dynamicContent"],
|
|
261
|
+
descendants: true,
|
|
262
|
+
read: ViewContainerRef,
|
|
263
|
+
isSignal: true
|
|
264
|
+
}],
|
|
265
|
+
ngImport: i0,
|
|
266
|
+
template: "@if (visible()) {\n <div\n class=\"shk-dialog-backdrop fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-40 p-4 pt-4 overflow-y-auto _shk-scrollbar\"\n (click)=\"closeModal()\"\n >\n <div\n class=\"shk-dialog-panel bg-white dark:[background-color:var(--shk-surface-100)] rounded-xl shadow-2xl overflow-hidden flex flex-col\"\n [class.w-[95vw]]=\"isExpanded()\"\n [class.h-[90vh]]=\"isExpanded()\"\n [class.w-full]=\"!isExpanded()\"\n [style.max-width]=\"isExpanded() ? undefined : computedModalWidth()\"\n (click)=\"$event.stopPropagation()\"\n >\n <div class=\"shk-modal-header flex items-center justify-between px-6 pt-4 pb-2 shrink-0\">\n <span class=\"font-semibold text-lg _shk-text-surface-800\">{{ title() }}</span>\n <div class=\"flex items-center gap-2\">\n @if (showExpandButton()) {\n <button\n type=\"button\"\n (click)=\"toggleExpand()\"\n class=\"p-1.5 rounded-lg hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] _shk-text-surface-500 transition-colors\"\n >\n @if (isExpanded()) {\n <svg [shkIcon]=\"getIcon('minimize-2')\" class=\"w-4 h-4\"></svg>\n } @else {\n <svg [shkIcon]=\"getIcon('maximize-2')\" class=\"w-4 h-4\"></svg>\n }\n </button>\n }\n <button\n type=\"button\"\n (click)=\"closeModal()\"\n class=\"p-1.5 rounded-lg hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] _shk-text-surface-500 transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n </div>\n\n <div class=\"overflow-y-auto px-6 py-4 flex-1 max-h-[70vh] _shk-scrollbar\">\n <ng-container #dynamicContent></ng-container>\n </div>\n\n @if (modalButtonsVisible()) {\n <hr class=\"border-t _shk-border shrink-0\" />\n <div class=\"flex justify-end gap-3 px-6 py-4 shrink-0\">\n <button\n type=\"button\"\n (click)=\"closeModal()\"\n [disabled]=\"loading()\"\n class=\"px-4 py-2 text-sm font-semibold _shk-text-surface-600 _shk-bg-surface-100 hover:[background-color:var(--shk-surface-200)] dark:hover:[background-color:var(--shk-surface-300)] rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-4 h-4\"></svg>\n {{ cancelLabel() }}\n </button>\n <button\n type=\"button\"\n (click)=\"onAccept()\"\n [disabled]=\"loading()\"\n class=\"px-4 py-2 text-sm font-semibold _shk-text-white _shk-bg-emerald hover:[background-color:var(--shk-emerald-700)] rounded-lg shadow-md transition-all flex items-center gap-2 disabled:opacity-50\"\n >\n @if (loading()) {\n <svg [shkIcon]=\"getIcon('loader-circle')\" class=\"w-4 h-4 animate-spin\"></svg>\n } @else {\n <svg [shkIcon]=\"getIcon('check')\" class=\"w-4 h-4\"></svg>\n }\n {{ acceptLabel() }}\n </button>\n </div>\n }\n </div>\n </div>\n}\n",
|
|
267
|
+
styles: [".shk-dialog-backdrop{animation:shk-dialog-fade .15s ease-out}.shk-dialog-panel{border:1px solid var(--shk-surface-200);box-shadow:0 24px 48px -12px #00000040,0 8px 16px -8px #0000001a;animation:shk-dialog-in .2s cubic-bezier(.21,1.02,.73,1)}:host-context(.dark) .shk-dialog-panel{box-shadow:0 24px 48px -12px #000000b3,0 8px 16px -8px #00000080}@keyframes shk-dialog-fade{0%{opacity:0}}@keyframes shk-dialog-in{0%{opacity:0;transform:translateY(8px) scale(.97)}}.shk-modal-header{padding-top:1.25rem}\n"],
|
|
268
|
+
dependencies: [{
|
|
269
|
+
kind: "ngmodule",
|
|
270
|
+
type: CommonModule
|
|
271
|
+
}, {
|
|
272
|
+
kind: "directive",
|
|
273
|
+
type: ShkIconDirective,
|
|
274
|
+
selector: "svg[shkIcon]",
|
|
275
|
+
inputs: [
|
|
276
|
+
"shkIcon",
|
|
277
|
+
"size",
|
|
278
|
+
"strokeWidth",
|
|
279
|
+
"color"
|
|
280
|
+
]
|
|
281
|
+
}],
|
|
282
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
287
|
+
minVersion: "12.0.0",
|
|
288
|
+
version: "22.3.2",
|
|
289
|
+
ngImport: i0,
|
|
290
|
+
type: ModalComponent,
|
|
291
|
+
decorators: [{
|
|
292
|
+
type: Component,
|
|
293
|
+
args: [{
|
|
294
|
+
selector: "shk-modal",
|
|
295
|
+
imports: [CommonModule, ShkIconDirective],
|
|
296
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
297
|
+
template: "@if (visible()) {\n <div\n class=\"shk-dialog-backdrop fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-40 p-4 pt-4 overflow-y-auto _shk-scrollbar\"\n (click)=\"closeModal()\"\n >\n <div\n class=\"shk-dialog-panel bg-white dark:[background-color:var(--shk-surface-100)] rounded-xl shadow-2xl overflow-hidden flex flex-col\"\n [class.w-[95vw]]=\"isExpanded()\"\n [class.h-[90vh]]=\"isExpanded()\"\n [class.w-full]=\"!isExpanded()\"\n [style.max-width]=\"isExpanded() ? undefined : computedModalWidth()\"\n (click)=\"$event.stopPropagation()\"\n >\n <div class=\"shk-modal-header flex items-center justify-between px-6 pt-4 pb-2 shrink-0\">\n <span class=\"font-semibold text-lg _shk-text-surface-800\">{{ title() }}</span>\n <div class=\"flex items-center gap-2\">\n @if (showExpandButton()) {\n <button\n type=\"button\"\n (click)=\"toggleExpand()\"\n class=\"p-1.5 rounded-lg hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] _shk-text-surface-500 transition-colors\"\n >\n @if (isExpanded()) {\n <svg [shkIcon]=\"getIcon('minimize-2')\" class=\"w-4 h-4\"></svg>\n } @else {\n <svg [shkIcon]=\"getIcon('maximize-2')\" class=\"w-4 h-4\"></svg>\n }\n </button>\n }\n <button\n type=\"button\"\n (click)=\"closeModal()\"\n class=\"p-1.5 rounded-lg hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)] _shk-text-surface-500 transition-colors\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n </div>\n\n <div class=\"overflow-y-auto px-6 py-4 flex-1 max-h-[70vh] _shk-scrollbar\">\n <ng-container #dynamicContent></ng-container>\n </div>\n\n @if (modalButtonsVisible()) {\n <hr class=\"border-t _shk-border shrink-0\" />\n <div class=\"flex justify-end gap-3 px-6 py-4 shrink-0\">\n <button\n type=\"button\"\n (click)=\"closeModal()\"\n [disabled]=\"loading()\"\n class=\"px-4 py-2 text-sm font-semibold _shk-text-surface-600 _shk-bg-surface-100 hover:[background-color:var(--shk-surface-200)] dark:hover:[background-color:var(--shk-surface-300)] rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50\"\n >\n <svg [shkIcon]=\"getIcon('x')\" class=\"w-4 h-4\"></svg>\n {{ cancelLabel() }}\n </button>\n <button\n type=\"button\"\n (click)=\"onAccept()\"\n [disabled]=\"loading()\"\n class=\"px-4 py-2 text-sm font-semibold _shk-text-white _shk-bg-emerald hover:[background-color:var(--shk-emerald-700)] rounded-lg shadow-md transition-all flex items-center gap-2 disabled:opacity-50\"\n >\n @if (loading()) {\n <svg [shkIcon]=\"getIcon('loader-circle')\" class=\"w-4 h-4 animate-spin\"></svg>\n } @else {\n <svg [shkIcon]=\"getIcon('check')\" class=\"w-4 h-4\"></svg>\n }\n {{ acceptLabel() }}\n </button>\n </div>\n }\n </div>\n </div>\n}\n",
|
|
298
|
+
styles: [".shk-dialog-backdrop{animation:shk-dialog-fade .15s ease-out}.shk-dialog-panel{border:1px solid var(--shk-surface-200);box-shadow:0 24px 48px -12px #00000040,0 8px 16px -8px #0000001a;animation:shk-dialog-in .2s cubic-bezier(.21,1.02,.73,1)}:host-context(.dark) .shk-dialog-panel{box-shadow:0 24px 48px -12px #000000b3,0 8px 16px -8px #00000080}@keyframes shk-dialog-fade{0%{opacity:0}}@keyframes shk-dialog-in{0%{opacity:0;transform:translateY(8px) scale(.97)}}.shk-modal-header{padding-top:1.25rem}\n"]
|
|
299
|
+
}]
|
|
300
|
+
}],
|
|
301
|
+
ctorParameters: () => [],
|
|
302
|
+
propDecorators: { container: [{
|
|
303
|
+
type: i0.ViewChild,
|
|
304
|
+
args: ["dynamicContent", {
|
|
305
|
+
read: ViewContainerRef,
|
|
306
|
+
isSignal: true
|
|
307
|
+
}]
|
|
308
|
+
}] }
|
|
309
|
+
});
|
|
314
310
|
export { ModalComponent, ModalService };
|
|
315
|
-
|
|
311
|
+
|
|
312
|
+
//# sourceMappingURL=shirkasoft-ui-components-modal.mjs.map
|