@wawjs/ngx-bos 22.0.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.
Files changed (90) hide show
  1. package/AGENTS.md +23 -0
  2. package/README.md +105 -0
  3. package/RELEASES.md +21 -0
  4. package/ai/architecture.md +40 -0
  5. package/ai/code-style.md +33 -0
  6. package/ai/decisions/2026-06-02-browser-only-bos-spa.md +16 -0
  7. package/ai/decisions/2026-06-02-package-boundary.md +22 -0
  8. package/ai/decisions/2026-06-02-version-start.md +12 -0
  9. package/ai/decisions/index.md +7 -0
  10. package/ai/onboarding.md +19 -0
  11. package/ai/task-execution.md +35 -0
  12. package/ai/tooling.md +33 -0
  13. package/fesm2022/wawjs-ngx-bos.mjs +2287 -0
  14. package/fesm2022/wawjs-ngx-bos.mjs.map +1 -0
  15. package/package.json +38 -0
  16. package/src/feature/file/file.component.html +123 -0
  17. package/src/feature/file/file.component.scss +209 -0
  18. package/src/feature/file/file.component.ts +220 -0
  19. package/src/feature/file/file.const.ts +20 -0
  20. package/src/feature/file/file.interface.ts +12 -0
  21. package/src/feature/file/file.service.ts +34 -0
  22. package/src/feature/file/file.util.ts +72 -0
  23. package/src/feature/file/index.ts +9 -0
  24. package/src/feature/file/pages/files/files.component.html +12 -0
  25. package/src/feature/file/pages/files/files.component.ts +117 -0
  26. package/src/feature/file/pages/files/files.routes.ts +9 -0
  27. package/src/feature/file/selectors/file/file-selector.component.html +11 -0
  28. package/src/feature/file/selectors/file/file-selector.component.ts +27 -0
  29. package/src/feature/user/LICENSE +21 -0
  30. package/src/feature/user/README.md +1 -0
  31. package/src/feature/user/components/user-preview/user-preview.component.html +7 -0
  32. package/src/feature/user/components/user-preview/user-preview.component.scss +27 -0
  33. package/src/feature/user/components/user-preview/user-preview.component.ts +16 -0
  34. package/src/feature/user/guards/admins.guard.ts +22 -0
  35. package/src/feature/user/guards/authenticated.guard.ts +14 -0
  36. package/src/feature/user/guards/guest.guard.ts +14 -0
  37. package/src/feature/user/module.json +1 -0
  38. package/src/feature/user/pages/clients/clients.component.html +8 -0
  39. package/src/feature/user/pages/clients/clients.component.scss +0 -0
  40. package/src/feature/user/pages/clients/clients.component.ts +45 -0
  41. package/src/feature/user/pages/clients/clients.routes.ts +9 -0
  42. package/src/feature/user/pages/users/users.component.html +18 -0
  43. package/src/feature/user/pages/users/users.component.ts +57 -0
  44. package/src/feature/user/pages/users/users.routes.ts +9 -0
  45. package/src/feature/user/selectors/user/user-selector.component.html +6 -0
  46. package/src/feature/user/selectors/user/user-selector.component.scss +0 -0
  47. package/src/feature/user/selectors/user/user-selector.component.ts +17 -0
  48. package/src/feature/user/user.const.ts +13 -0
  49. package/src/feature/user/user.form.ts +54 -0
  50. package/src/feature/user/user.interface.ts +12 -0
  51. package/src/feature/user/user.service.ts +176 -0
  52. package/src/form-components/ace/ace.component.html +14 -0
  53. package/src/form-components/ace/ace.component.scss +22 -0
  54. package/src/form-components/ace/ace.component.ts +210 -0
  55. package/src/form-components/ace/ace.form.ts +184 -0
  56. package/src/form-components/button/button.component.html +15 -0
  57. package/src/form-components/button/button.component.ts +31 -0
  58. package/src/form-components/button/button.form.ts +74 -0
  59. package/src/form-components/file/file.component.html +73 -0
  60. package/src/form-components/file/file.component.ts +91 -0
  61. package/src/form-components/file/file.form.ts +112 -0
  62. package/src/form-components/form-bridge.interface.ts +27 -0
  63. package/src/form-components/index.ts +85 -0
  64. package/src/form-components/input/input.component.html +16 -0
  65. package/src/form-components/input/input.component.ts +31 -0
  66. package/src/form-components/input/input.form.ts +117 -0
  67. package/src/form-components/select/select.component.html +24 -0
  68. package/src/form-components/select/select.component.ts +31 -0
  69. package/src/form-components/select/select.form.ts +88 -0
  70. package/src/form-components/tinymce/tinymce.component.html +13 -0
  71. package/src/form-components/tinymce/tinymce.component.scss +19 -0
  72. package/src/form-components/tinymce/tinymce.component.ts +221 -0
  73. package/src/form-components/tinymce/tinymce.form.ts +191 -0
  74. package/src/icons/spider/LICENSE +21 -0
  75. package/src/icons/spider/README.md +127 -0
  76. package/src/icons/spider/index.ts +1 -0
  77. package/src/icons/spider/module.json +4 -0
  78. package/src/icons/spider/spider.component.html +115 -0
  79. package/src/icons/spider/spider.component.scss +20 -0
  80. package/src/icons/spider/spider.component.ts +20 -0
  81. package/src/ngx-bos.config.ts +55 -0
  82. package/src/pages/form/form.component.html +9 -0
  83. package/src/pages/form/form.component.ts +86 -0
  84. package/src/pages/form/form.routes.ts +9 -0
  85. package/src/pages/forms/forms.component.html +9 -0
  86. package/src/pages/forms/forms.component.ts +77 -0
  87. package/src/pages/forms/forms.routes.ts +9 -0
  88. package/src/pipes/phone.pipe.ts +17 -0
  89. package/src/public-api.ts +36 -0
  90. package/types/wawjs-ngx-bos.d.ts +332 -0
@@ -0,0 +1,2287 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, makeEnvironmentProviders, inject, Injectable, input, model, computed, Component, output, signal, viewChild, createComponent, EnvironmentInjector, ApplicationRef, APP_INITIALIZER, Service, effect, Pipe } from '@angular/core';
3
+ import { NgTemplateOutlet } from '@angular/common';
4
+ import { ModalService, ButtonComponent, SelectComponent, AlertService, TableComponent, buttonDefaults, inputDefaults, InputComponent, selectDefaults, CellDirective } from '@wawjs/ngx-ui';
5
+ import { TranslateDirective, TranslateService } from '@wawjs/ngx-translate';
6
+ import { CrudService, CrudComponent } from '@wawjs/ngx-crud';
7
+ import { HttpService } from '@wawjs/ngx-http';
8
+ import { Clipboard } from '@angular/cdk/clipboard';
9
+ import * as i1$1 from '@wawjs/ngx-form';
10
+ import { FormService, formcomponentForm, formForm } from '@wawjs/ngx-form';
11
+ import { CoreService, EmitterService } from '@wawjs/ngx-core';
12
+ import { AceComponent } from '@wawjs/ngx-ace';
13
+ import * as i1 from '@angular/forms';
14
+ import { FormsModule } from '@angular/forms';
15
+ import { TinymceComponent } from '@wawjs/ngx-tinymce';
16
+ import { Router, RouterLink } from '@angular/router';
17
+ import { parsePhoneNumberFromString } from 'libphonenumber-js';
18
+
19
+ const DEFAULT_NGX_BOS_CONFIG = {
20
+ appId: '',
21
+ url: '',
22
+ cdnUrl: 'https://cdn.webart.work',
23
+ roles: [],
24
+ userFields: [],
25
+ userForm: [],
26
+ signPath: '/sign',
27
+ profilePath: '/profile',
28
+ defaultUserThumb: 'assets/default.png',
29
+ };
30
+ const NGX_BOS_CONFIG = new InjectionToken('NGX_BOS_CONFIG', {
31
+ factory: () => DEFAULT_NGX_BOS_CONFIG,
32
+ });
33
+ function ngxBosProvide(config = {}) {
34
+ return makeEnvironmentProviders([
35
+ {
36
+ provide: NGX_BOS_CONFIG,
37
+ useValue: {
38
+ ...DEFAULT_NGX_BOS_CONFIG,
39
+ ...config,
40
+ roles: config.roles ?? DEFAULT_NGX_BOS_CONFIG.roles,
41
+ userFields: config.userFields ?? DEFAULT_NGX_BOS_CONFIG.userFields,
42
+ userForm: config.userForm ?? DEFAULT_NGX_BOS_CONFIG.userForm,
43
+ },
44
+ },
45
+ ]);
46
+ }
47
+ const provideNgxBos = ngxBosProvide;
48
+
49
+ /**
50
+ * Read a File as base64 data URL.
51
+ */
52
+ function fileToDataUrl(file) {
53
+ return new Promise((resolve, reject) => {
54
+ const reader = new FileReader();
55
+ reader.onload = () => resolve(reader.result);
56
+ reader.onerror = reject;
57
+ reader.readAsDataURL(file);
58
+ });
59
+ }
60
+ /**
61
+ * Resize an image file so it fits within given bounds, preserving aspect ratio.
62
+ * Returns a base64 data URL (or the original if no resize is needed / not image).
63
+ */
64
+ async function resizeImageToBounds(file, bounds) {
65
+ const original = await fileToDataUrl(file);
66
+ // Not an image → just return original
67
+ if (!file.type.startsWith('image/')) {
68
+ return original;
69
+ }
70
+ return new Promise((resolve) => {
71
+ const img = new Image();
72
+ img.onload = () => {
73
+ const maxW = bounds.width || 1920;
74
+ const maxH = bounds.height || 1080;
75
+ // Already within bounds → no resize
76
+ if (img.width <= maxW && img.height <= maxH) {
77
+ resolve(original);
78
+ return;
79
+ }
80
+ const infoRatio = maxW / maxH;
81
+ const imgRatio = img.width / img.height;
82
+ let width;
83
+ let height;
84
+ if (imgRatio > infoRatio) {
85
+ width = Math.min(maxW, img.width);
86
+ height = width / imgRatio;
87
+ }
88
+ else {
89
+ height = Math.min(maxH, img.height);
90
+ width = height * imgRatio;
91
+ }
92
+ const canvas = document.createElement('canvas');
93
+ canvas.width = width;
94
+ canvas.height = height;
95
+ const ctx = canvas.getContext('2d');
96
+ ctx?.drawImage(img, 0, 0, width, height);
97
+ const resized = canvas.toDataURL('image/jpeg', 1);
98
+ resolve(resized);
99
+ };
100
+ img.src = original;
101
+ });
102
+ }
103
+
104
+ const fileDefaults = {
105
+ label: '',
106
+ placeholder: 'Select file',
107
+ disabled: false,
108
+ clearable: true,
109
+ accept: '*/*',
110
+ preview: true,
111
+ // behaviour
112
+ mode: 'single-image', // 'single-image' | 'single-file' | 'multi-image' | 'multi-file'
113
+ view: 'dropzone', // 'dropzone' | 'list' | 'thumb-only'
114
+ // crop
115
+ cropWidth: null,
116
+ cropHeight: null,
117
+ // backend routing
118
+ container: 'general',
119
+ name: '',
120
+ };
121
+
122
+ class FileService extends CrudService {
123
+ constructor() {
124
+ super({ name: 'file' });
125
+ this._http = inject(HttpService);
126
+ this._bosConfig = inject(NGX_BOS_CONFIG);
127
+ }
128
+ /**
129
+ * Upload base64 (data URL) to backend with optional container/name.
130
+ * Returns a URL string from the API.
131
+ */
132
+ async uploadBase64(dataUrl, container = 'general', name = '') {
133
+ return await new Promise((resolve) => {
134
+ this._http.post('/api/cloudflare/upload-base64', { container, name, dataUrl }, (resp) => resolve(this._bosConfig.cdnUrl + '/' + resp.key));
135
+ });
136
+ }
137
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FileService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
138
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FileService, providedIn: 'root' }); }
139
+ }
140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FileService, decorators: [{
141
+ type: Injectable,
142
+ args: [{ providedIn: 'root' }]
143
+ }], ctorParameters: () => [] });
144
+
145
+ class FileComponent {
146
+ constructor() {
147
+ /** UI props */
148
+ this.label = input(fileDefaults.label, /* @ts-ignore */
149
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
150
+ this.placeholder = input(fileDefaults.placeholder, /* @ts-ignore */
151
+ ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
152
+ this.disabled = input(fileDefaults.disabled, /* @ts-ignore */
153
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
154
+ this.clearable = input(fileDefaults.clearable, /* @ts-ignore */
155
+ ...(ngDevMode ? [{ debugName: "clearable" }] : /* istanbul ignore next */ []));
156
+ this.accept = input(fileDefaults.accept, /* @ts-ignore */
157
+ ...(ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []));
158
+ this.preview = input(fileDefaults.preview, /* @ts-ignore */
159
+ ...(ngDevMode ? [{ debugName: "preview" }] : /* istanbul ignore next */ []));
160
+ /** Behaviour */
161
+ this.mode = input(fileDefaults.mode, /* @ts-ignore */
162
+ ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
163
+ this.view = input(fileDefaults.view, /* @ts-ignore */
164
+ ...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
165
+ /** Optional crop box (for image modes) */
166
+ this.cropWidth = input(fileDefaults.cropWidth, /* @ts-ignore */
167
+ ...(ngDevMode ? [{ debugName: "cropWidth" }] : /* istanbul ignore next */ []));
168
+ this.cropHeight = input(fileDefaults.cropHeight, /* @ts-ignore */
169
+ ...(ngDevMode ? [{ debugName: "cropHeight" }] : /* istanbul ignore next */ []));
170
+ /** Custom templates */
171
+ this.t_item = input(/* @ts-ignore */
172
+ ...(ngDevMode ? [undefined, { debugName: "t_item" }] : /* istanbul ignore next */ []));
173
+ this.t_empty = input(/* @ts-ignore */
174
+ ...(ngDevMode ? [undefined, { debugName: "t_empty" }] : /* istanbul ignore next */ []));
175
+ /** Back-end routing */
176
+ this.container = input(fileDefaults.container, /* @ts-ignore */
177
+ ...(ngDevMode ? [{ debugName: "container" }] : /* istanbul ignore next */ []));
178
+ this.name = input(fileDefaults.name, /* @ts-ignore */
179
+ ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
180
+ /** Separate models for each mode */
181
+ this.wImage = model(null, { ...(ngDevMode ? { debugName: "wImage" } : /* istanbul ignore next */ {}), alias: 'wImage' });
182
+ this.wFile = model(null, { ...(ngDevMode ? { debugName: "wFile" } : /* istanbul ignore next */ {}), alias: 'wFile' });
183
+ this.wImages = model([], { ...(ngDevMode ? { debugName: "wImages" } : /* istanbul ignore next */ {}), alias: 'wImages' });
184
+ this.wFiles = model([], { ...(ngDevMode ? { debugName: "wFiles" } : /* istanbul ignore next */ {}), alias: 'wFiles' });
185
+ this._modal = inject(ModalService);
186
+ this._fs = inject(FileService);
187
+ this.isDisabled = computed(() => this.disabled(), /* @ts-ignore */
188
+ ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
189
+ this.isMultiple = computed(() => this.mode().startsWith('multi-'), /* @ts-ignore */
190
+ ...(ngDevMode ? [{ debugName: "isMultiple" }] : /* istanbul ignore next */ []));
191
+ this.isImageMode = computed(() => this.mode().includes('image'), /* @ts-ignore */
192
+ ...(ngDevMode ? [{ debugName: "isImageMode" }] : /* istanbul ignore next */ []));
193
+ /** Normalized list of URLs for rendering */
194
+ this.files = computed(() => {
195
+ const mode = this.mode();
196
+ switch (mode) {
197
+ case 'single-image':
198
+ return this.wImage() ? [this.wImage()] : [];
199
+ case 'single-file':
200
+ return this.wFile() ? [this.wFile()] : [];
201
+ case 'multi-image':
202
+ return this.wImages();
203
+ case 'multi-file':
204
+ return this.wFiles();
205
+ default:
206
+ return [];
207
+ }
208
+ }, /* @ts-ignore */
209
+ ...(ngDevMode ? [{ debugName: "files" }] : /* istanbul ignore next */ []));
210
+ }
211
+ triggerPick(input) {
212
+ if (!this.isDisabled()) {
213
+ input.click();
214
+ }
215
+ }
216
+ isImage(src) {
217
+ return /\.(png|jpe?g|webp|gif)(\?|$)/i.test(src ?? '');
218
+ }
219
+ async onPicked(input) {
220
+ const list = input.files;
221
+ if (!list || !list.length)
222
+ return;
223
+ const doCrop = this.isImageMode() && !!this.cropWidth() && !!this.cropHeight();
224
+ const urls = [];
225
+ const container = this.container();
226
+ const name = this.name();
227
+ for (let i = 0; i < list.length; i++) {
228
+ const f = list.item(i);
229
+ // Always read file as data URL
230
+ const dataUrl = await fileToDataUrl(f);
231
+ if (doCrop) {
232
+ // Lazy-load fabric crop modal only when actually cropping
233
+ const { FabricCropModalComponent } = await import('@wawjs/ngx-fabric');
234
+ await new Promise((resolve) => {
235
+ this._modal.show({
236
+ component: FabricCropModalComponent,
237
+ size: 'big',
238
+ image: dataUrl,
239
+ width: this.cropWidth(),
240
+ height: this.cropHeight(),
241
+ aspectRatio: this.cropWidth() / this.cropHeight(),
242
+ outputWidth: this.cropWidth(),
243
+ outputHeight: this.cropHeight(),
244
+ onCrop: (result) => {
245
+ this._fs
246
+ .uploadBase64(result.base64, container, name)
247
+ .then((url) => {
248
+ urls.push(url);
249
+ resolve();
250
+ });
251
+ },
252
+ onCancel: () => resolve(),
253
+ });
254
+ });
255
+ }
256
+ else {
257
+ const url = await this._fs.uploadBase64(dataUrl, container, name);
258
+ urls.push(url);
259
+ }
260
+ // If single mode, ignore extra files after first
261
+ if (!this.isMultiple()) {
262
+ break;
263
+ }
264
+ }
265
+ this._applyNewUrls(urls);
266
+ input.value = '';
267
+ }
268
+ removeAt(index) {
269
+ const mode = this.mode();
270
+ if (mode === 'single-image') {
271
+ this.wImage.set(null);
272
+ return;
273
+ }
274
+ if (mode === 'single-file') {
275
+ this.wFile.set(null);
276
+ return;
277
+ }
278
+ // Multi modes
279
+ const current = [...this.files()];
280
+ current.splice(index, 1);
281
+ if (mode === 'multi-image') {
282
+ this.wImages.set(current);
283
+ }
284
+ else if (mode === 'multi-file') {
285
+ this.wFiles.set(current);
286
+ }
287
+ }
288
+ clear() {
289
+ const mode = this.mode();
290
+ if (mode === 'single-image') {
291
+ this.wImage.set(null);
292
+ }
293
+ else if (mode === 'single-file') {
294
+ this.wFile.set(null);
295
+ }
296
+ else if (mode === 'multi-image') {
297
+ this.wImages.set([]);
298
+ }
299
+ else if (mode === 'multi-file') {
300
+ this.wFiles.set([]);
301
+ }
302
+ }
303
+ _applyNewUrls(urls) {
304
+ const mode = this.mode();
305
+ if (!urls.length) {
306
+ return;
307
+ }
308
+ if (mode === 'single-image') {
309
+ this.wImage.set(urls[0] ?? null);
310
+ return;
311
+ }
312
+ if (mode === 'single-file') {
313
+ this.wFile.set(urls[0] ?? null);
314
+ return;
315
+ }
316
+ if (mode === 'multi-image') {
317
+ this.wImages.set([...this.wImages(), ...urls]);
318
+ return;
319
+ }
320
+ if (mode === 'multi-file') {
321
+ this.wFiles.set([...this.wFiles(), ...urls]);
322
+ }
323
+ }
324
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
325
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: FileComponent, isStandalone: true, selector: "ngx-file", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, preview: { classPropertyName: "preview", publicName: "preview", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, cropWidth: { classPropertyName: "cropWidth", publicName: "cropWidth", isSignal: true, isRequired: false, transformFunction: null }, cropHeight: { classPropertyName: "cropHeight", publicName: "cropHeight", isSignal: true, isRequired: false, transformFunction: null }, t_item: { classPropertyName: "t_item", publicName: "t_item", isSignal: true, isRequired: false, transformFunction: null }, t_empty: { classPropertyName: "t_empty", publicName: "t_empty", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, wImage: { classPropertyName: "wImage", publicName: "wImage", isSignal: true, isRequired: false, transformFunction: null }, wFile: { classPropertyName: "wFile", publicName: "wFile", isSignal: true, isRequired: false, transformFunction: null }, wImages: { classPropertyName: "wImages", publicName: "wImages", isSignal: true, isRequired: false, transformFunction: null }, wFiles: { classPropertyName: "wFiles", publicName: "wFiles", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { wImage: "wImageChange", wFile: "wFileChange", wImages: "wImagesChange", wFiles: "wFilesChange" }, ngImport: i0, template: "@let _label = label(); @let _ph = placeholder(); @let _files = files(); @let\r\n_disabled = isDisabled(); @let _view = view();\r\n\r\n<div class=\"wfile\" [class._disabled]=\"_disabled\">\r\n\t@if (_label) {\r\n\t<div class=\"wfile__label\" [translate]=\"_label\"></div>\r\n\t}\r\n\r\n\t<input\r\n\t\t#fileInput\r\n\t\ttype=\"file\"\r\n\t\t[attr.accept]=\"accept()\"\r\n\t\t[attr.multiple]=\"isMultiple() ? '' : null\"\r\n\t\t(change)=\"onPicked(fileInput)\"\r\n\t\thidden\r\n\t/>\r\n\r\n\t@if (_view === 'thumb-only') {\r\n\t<div\r\n\t\tclass=\"wfile__body wfile__body--thumb-only\"\r\n\t\trole=\"button\"\r\n\t\ttabindex=\"0\"\r\n\t\t(click)=\"!_disabled && triggerPick(fileInput)\"\r\n\t\t(keydown.enter)=\"!_disabled && triggerPick(fileInput)\"\r\n\t\t(keydown.space)=\"!_disabled && triggerPick(fileInput); $event.preventDefault()\"\r\n\t>\r\n\t\t@if (_files.length === 0) {\r\n\t\t<ng-container [ngTemplateOutlet]=\"t_empty() || emptyTpl\"></ng-container>\r\n\t\t<ng-template #emptyTpl>\r\n\t\t\t<div class=\"wfile__empty\" [translate]=\"_ph\"></div>\r\n\t\t</ng-template>\r\n\t\t} @else {\r\n\t\t<ng-container\r\n\t\t\t[ngTemplateOutlet]=\"t_item() || itemTpl\"\r\n\t\t\t[ngTemplateOutletContext]=\"{ $implicit: _files[0], index: 0 }\"\r\n\t\t></ng-container>\r\n\r\n\t\t<ng-template #itemTpl let-src let-index=\"index\">\r\n\t\t\t@if (preview() && isImage(src)) {\r\n\t\t\t<img class=\"wfile__thumb\" [src]=\"src\" alt=\"preview\" />\r\n\t\t\t} @else {\r\n\t\t\t<span class=\"wfile__name\">{{ src }}</span>\r\n\t\t\t}\r\n\t\t</ng-template>\r\n\t\t} @if (clearable() && _files.length) {\r\n\t\t<button\r\n\t\t\ttype=\"button\"\r\n\t\t\tclass=\"wfile__remove material-icons\"\r\n\t\t\t(click)=\"clear(); $event.stopPropagation()\"\r\n\t\t\taria-label=\"Clear file\"\r\n\t\t>\r\n\t\t\tclose\r\n\t\t</button>\r\n\t\t}\r\n\t</div>\r\n\t} @else {\r\n\t<div class=\"wfile__body\">\r\n\t\t<div class=\"wfile__list\">\r\n\t\t\t@if (_files.length === 0) {\r\n\t\t\t<ng-container\r\n\t\t\t\t[ngTemplateOutlet]=\"t_empty() || emptyTpl\"\r\n\t\t\t></ng-container>\r\n\t\t\t<ng-template #emptyTpl>\r\n\t\t\t\t<div class=\"wfile__empty\" [translate]=\"_ph\"></div>\r\n\t\t\t</ng-template>\r\n\t\t\t} @else {\r\n\t\t\t<ul>\r\n\t\t\t\t@for (src of _files; track src; let i = $index) {\r\n\t\t\t\t<li class=\"wfile__item\">\r\n\t\t\t\t\t<ng-container\r\n\t\t\t\t\t\t[ngTemplateOutlet]=\"t_item() || itemTpl\"\r\n\t\t\t\t\t\t[ngTemplateOutletContext]=\"{ $implicit: src, index: i }\"\r\n\t\t\t\t\t></ng-container>\r\n\r\n\t\t\t\t\t<ng-template #itemTpl let-src let-index=\"index\">\r\n\t\t\t\t\t\t<span class=\"wfile__name\">{{ src }}</span>\r\n\r\n\t\t\t\t\t\t@if (preview() && isImage(src)) {\r\n\t\t\t\t\t\t<img class=\"wfile__thumb\" [src]=\"src\" alt=\"preview\" />\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t<button\r\n\t\t\t\t\t\t\ttype=\"button\"\r\n\t\t\t\t\t\t\tclass=\"wfile__remove material-icons\"\r\n\t\t\t\t\t\t\t(click)=\"removeAt(index); $event.stopPropagation()\"\r\n\t\t\t\t\t\t\t[disabled]=\"_disabled\"\r\n\t\t\t\t\t\t\taria-label=\"Remove file\"\r\n\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\tclose\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t</ng-template>\r\n\t\t\t\t</li>\r\n\t\t\t\t}\r\n\t\t\t</ul>\r\n\t\t\t}\r\n\t\t</div>\r\n\r\n\t\t<div class=\"wfile__actions\">\r\n\t\t\t<wbutton\r\n\t\t\t\ttype=\"primary\"\r\n\t\t\t\t[disableSubmit]=\"true\"\r\n\t\t\t\t[disabled]=\"_disabled\"\r\n\t\t\t\t(wClick)=\"triggerPick(fileInput)\"\r\n\t\t\t>\r\n\t\t\t\t<span class=\"material-icons\">upload_file</span>\r\n\t\t\t\t<span translate>Browse</span>\r\n\t\t\t</wbutton>\r\n\r\n\t\t\t@if (clearable() && _files.length) {\r\n\t\t\t<wbutton\r\n\t\t\t\ttype=\"light\"\r\n\t\t\t\t[disableSubmit]=\"true\"\r\n\t\t\t\t[disabled]=\"_disabled\"\r\n\t\t\t\t(wClick)=\"clear()\"\r\n\t\t\t>\r\n\t\t\t\t<span class=\"material-icons\">close</span>\r\n\t\t\t\t<span translate>Clear</span>\r\n\t\t\t</wbutton>\r\n\t\t\t}\r\n\t\t</div>\r\n\t</div>\r\n\t}\r\n</div>\r\n", styles: [":host{display:block}.wfile._disabled{opacity:.6;pointer-events:none}.wfile__label{margin-bottom:6px}.wfile__body{border:1px solid var(--c-border);border-radius:var(--radius);overflow:hidden;background:var(--c-bg-secondary);box-shadow:var(--shadow-sm)}.wfile__body--thumb-only{display:inline-flex;align-items:center;justify-content:center;inline-size:100px;block-size:100px;padding:0}.wfile__empty{color:var(--c-placeholder);font-size:.85rem;text-align:center;padding:var(--sp-2)}.wfile__thumb{display:block;inline-size:100%;block-size:100%;object-fit:cover}.wfile__name{display:block;max-inline-size:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:var(--sp-2)}.wfile__remove{position:absolute;top:6px;right:6px;inline-size:28px;block-size:28px;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--radius-btn);border:1px solid var(--c-border);background:var(--c-bg-secondary);cursor:pointer}.wfile__remove:hover{background:var(--c-bg-tertiary)}.wfile__dropzone{display:flex;align-items:center;justify-content:center;gap:var(--sp-2);padding:var(--sp-4);background:var(--c-bg-tertiary);border-bottom:1px solid var(--c-border);color:var(--c-text-primary)}.wfile__dropzone._compact{padding:var(--sp-3)}.wfile__dropzone._clickable{cursor:pointer}.wfile__dropzone._clickable:hover{background:var(--c-bg-secondary)}.wfile__placeholder{color:var(--c-placeholder)}.wfile__actions{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-2);padding:var(--sp-2) var(--sp-3);border-top:1px solid var(--c-border);background:var(--c-bg-secondary)}.wfile__files{display:grid;gap:var(--sp-2);padding:var(--sp-3)}.wfile__file{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-2);padding:var(--sp-2) var(--sp-3);border:1px solid var(--c-border);border-radius:var(--radius-card);background:var(--c-bg-secondary)}.wfile__file-meta{display:grid;gap:2px;min-width:0}.wfile__file-name{color:var(--c-text-primary);font-weight:600;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.wfile__file-size{color:var(--c-text-muted);font-size:.85rem}.wfile__file-actions{display:inline-flex;gap:var(--sp-1)}.wfile__thumbs{display:grid;gap:var(--sp-2);grid-template-columns:repeat(auto-fill,minmax(88px,1fr));padding:var(--sp-3)}.wfile__thumb{position:relative;border:1px solid var(--c-border);border-radius:var(--radius-card);background:var(--c-bg-secondary);overflow:hidden;aspect-ratio:1/1}.wfile__thumb img{display:block;inline-size:100%;block-size:100%;object-fit:cover}.wfile__thumb-remove{position:absolute;top:6px;right:6px;inline-size:28px;block-size:28px;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--radius-btn);border:1px solid var(--c-border);background:var(--c-bg-secondary);cursor:pointer}.wfile__thumb-remove:hover{background:var(--c-bg-tertiary)}.wfile__preview{display:block;padding:var(--sp-3);border-top:1px solid var(--c-border);background:var(--c-bg-secondary)}.wfile__preview img{display:block;inline-size:100%;max-block-size:280px;object-fit:contain;border-radius:var(--radius-card);background:var(--c-bg-tertiary)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TranslateDirective, selector: "[translate]", inputs: ["translate", "vars"] }, { kind: "component", type: ButtonComponent, selector: "wbutton", inputs: ["type", "extraClass", "disabled", "disableSubmit", "isMultipleClicksAllowed"], outputs: ["wClick"] }] }); }
326
+ }
327
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FileComponent, decorators: [{
328
+ type: Component,
329
+ args: [{ selector: 'ngx-file', imports: [NgTemplateOutlet, TranslateDirective, ButtonComponent], template: "@let _label = label(); @let _ph = placeholder(); @let _files = files(); @let\r\n_disabled = isDisabled(); @let _view = view();\r\n\r\n<div class=\"wfile\" [class._disabled]=\"_disabled\">\r\n\t@if (_label) {\r\n\t<div class=\"wfile__label\" [translate]=\"_label\"></div>\r\n\t}\r\n\r\n\t<input\r\n\t\t#fileInput\r\n\t\ttype=\"file\"\r\n\t\t[attr.accept]=\"accept()\"\r\n\t\t[attr.multiple]=\"isMultiple() ? '' : null\"\r\n\t\t(change)=\"onPicked(fileInput)\"\r\n\t\thidden\r\n\t/>\r\n\r\n\t@if (_view === 'thumb-only') {\r\n\t<div\r\n\t\tclass=\"wfile__body wfile__body--thumb-only\"\r\n\t\trole=\"button\"\r\n\t\ttabindex=\"0\"\r\n\t\t(click)=\"!_disabled && triggerPick(fileInput)\"\r\n\t\t(keydown.enter)=\"!_disabled && triggerPick(fileInput)\"\r\n\t\t(keydown.space)=\"!_disabled && triggerPick(fileInput); $event.preventDefault()\"\r\n\t>\r\n\t\t@if (_files.length === 0) {\r\n\t\t<ng-container [ngTemplateOutlet]=\"t_empty() || emptyTpl\"></ng-container>\r\n\t\t<ng-template #emptyTpl>\r\n\t\t\t<div class=\"wfile__empty\" [translate]=\"_ph\"></div>\r\n\t\t</ng-template>\r\n\t\t} @else {\r\n\t\t<ng-container\r\n\t\t\t[ngTemplateOutlet]=\"t_item() || itemTpl\"\r\n\t\t\t[ngTemplateOutletContext]=\"{ $implicit: _files[0], index: 0 }\"\r\n\t\t></ng-container>\r\n\r\n\t\t<ng-template #itemTpl let-src let-index=\"index\">\r\n\t\t\t@if (preview() && isImage(src)) {\r\n\t\t\t<img class=\"wfile__thumb\" [src]=\"src\" alt=\"preview\" />\r\n\t\t\t} @else {\r\n\t\t\t<span class=\"wfile__name\">{{ src }}</span>\r\n\t\t\t}\r\n\t\t</ng-template>\r\n\t\t} @if (clearable() && _files.length) {\r\n\t\t<button\r\n\t\t\ttype=\"button\"\r\n\t\t\tclass=\"wfile__remove material-icons\"\r\n\t\t\t(click)=\"clear(); $event.stopPropagation()\"\r\n\t\t\taria-label=\"Clear file\"\r\n\t\t>\r\n\t\t\tclose\r\n\t\t</button>\r\n\t\t}\r\n\t</div>\r\n\t} @else {\r\n\t<div class=\"wfile__body\">\r\n\t\t<div class=\"wfile__list\">\r\n\t\t\t@if (_files.length === 0) {\r\n\t\t\t<ng-container\r\n\t\t\t\t[ngTemplateOutlet]=\"t_empty() || emptyTpl\"\r\n\t\t\t></ng-container>\r\n\t\t\t<ng-template #emptyTpl>\r\n\t\t\t\t<div class=\"wfile__empty\" [translate]=\"_ph\"></div>\r\n\t\t\t</ng-template>\r\n\t\t\t} @else {\r\n\t\t\t<ul>\r\n\t\t\t\t@for (src of _files; track src; let i = $index) {\r\n\t\t\t\t<li class=\"wfile__item\">\r\n\t\t\t\t\t<ng-container\r\n\t\t\t\t\t\t[ngTemplateOutlet]=\"t_item() || itemTpl\"\r\n\t\t\t\t\t\t[ngTemplateOutletContext]=\"{ $implicit: src, index: i }\"\r\n\t\t\t\t\t></ng-container>\r\n\r\n\t\t\t\t\t<ng-template #itemTpl let-src let-index=\"index\">\r\n\t\t\t\t\t\t<span class=\"wfile__name\">{{ src }}</span>\r\n\r\n\t\t\t\t\t\t@if (preview() && isImage(src)) {\r\n\t\t\t\t\t\t<img class=\"wfile__thumb\" [src]=\"src\" alt=\"preview\" />\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t<button\r\n\t\t\t\t\t\t\ttype=\"button\"\r\n\t\t\t\t\t\t\tclass=\"wfile__remove material-icons\"\r\n\t\t\t\t\t\t\t(click)=\"removeAt(index); $event.stopPropagation()\"\r\n\t\t\t\t\t\t\t[disabled]=\"_disabled\"\r\n\t\t\t\t\t\t\taria-label=\"Remove file\"\r\n\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\tclose\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t</ng-template>\r\n\t\t\t\t</li>\r\n\t\t\t\t}\r\n\t\t\t</ul>\r\n\t\t\t}\r\n\t\t</div>\r\n\r\n\t\t<div class=\"wfile__actions\">\r\n\t\t\t<wbutton\r\n\t\t\t\ttype=\"primary\"\r\n\t\t\t\t[disableSubmit]=\"true\"\r\n\t\t\t\t[disabled]=\"_disabled\"\r\n\t\t\t\t(wClick)=\"triggerPick(fileInput)\"\r\n\t\t\t>\r\n\t\t\t\t<span class=\"material-icons\">upload_file</span>\r\n\t\t\t\t<span translate>Browse</span>\r\n\t\t\t</wbutton>\r\n\r\n\t\t\t@if (clearable() && _files.length) {\r\n\t\t\t<wbutton\r\n\t\t\t\ttype=\"light\"\r\n\t\t\t\t[disableSubmit]=\"true\"\r\n\t\t\t\t[disabled]=\"_disabled\"\r\n\t\t\t\t(wClick)=\"clear()\"\r\n\t\t\t>\r\n\t\t\t\t<span class=\"material-icons\">close</span>\r\n\t\t\t\t<span translate>Clear</span>\r\n\t\t\t</wbutton>\r\n\t\t\t}\r\n\t\t</div>\r\n\t</div>\r\n\t}\r\n</div>\r\n", styles: [":host{display:block}.wfile._disabled{opacity:.6;pointer-events:none}.wfile__label{margin-bottom:6px}.wfile__body{border:1px solid var(--c-border);border-radius:var(--radius);overflow:hidden;background:var(--c-bg-secondary);box-shadow:var(--shadow-sm)}.wfile__body--thumb-only{display:inline-flex;align-items:center;justify-content:center;inline-size:100px;block-size:100px;padding:0}.wfile__empty{color:var(--c-placeholder);font-size:.85rem;text-align:center;padding:var(--sp-2)}.wfile__thumb{display:block;inline-size:100%;block-size:100%;object-fit:cover}.wfile__name{display:block;max-inline-size:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:var(--sp-2)}.wfile__remove{position:absolute;top:6px;right:6px;inline-size:28px;block-size:28px;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--radius-btn);border:1px solid var(--c-border);background:var(--c-bg-secondary);cursor:pointer}.wfile__remove:hover{background:var(--c-bg-tertiary)}.wfile__dropzone{display:flex;align-items:center;justify-content:center;gap:var(--sp-2);padding:var(--sp-4);background:var(--c-bg-tertiary);border-bottom:1px solid var(--c-border);color:var(--c-text-primary)}.wfile__dropzone._compact{padding:var(--sp-3)}.wfile__dropzone._clickable{cursor:pointer}.wfile__dropzone._clickable:hover{background:var(--c-bg-secondary)}.wfile__placeholder{color:var(--c-placeholder)}.wfile__actions{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-2);padding:var(--sp-2) var(--sp-3);border-top:1px solid var(--c-border);background:var(--c-bg-secondary)}.wfile__files{display:grid;gap:var(--sp-2);padding:var(--sp-3)}.wfile__file{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-2);padding:var(--sp-2) var(--sp-3);border:1px solid var(--c-border);border-radius:var(--radius-card);background:var(--c-bg-secondary)}.wfile__file-meta{display:grid;gap:2px;min-width:0}.wfile__file-name{color:var(--c-text-primary);font-weight:600;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.wfile__file-size{color:var(--c-text-muted);font-size:.85rem}.wfile__file-actions{display:inline-flex;gap:var(--sp-1)}.wfile__thumbs{display:grid;gap:var(--sp-2);grid-template-columns:repeat(auto-fill,minmax(88px,1fr));padding:var(--sp-3)}.wfile__thumb{position:relative;border:1px solid var(--c-border);border-radius:var(--radius-card);background:var(--c-bg-secondary);overflow:hidden;aspect-ratio:1/1}.wfile__thumb img{display:block;inline-size:100%;block-size:100%;object-fit:cover}.wfile__thumb-remove{position:absolute;top:6px;right:6px;inline-size:28px;block-size:28px;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--radius-btn);border:1px solid var(--c-border);background:var(--c-bg-secondary);cursor:pointer}.wfile__thumb-remove:hover{background:var(--c-bg-tertiary)}.wfile__preview{display:block;padding:var(--sp-3);border-top:1px solid var(--c-border);background:var(--c-bg-secondary)}.wfile__preview img{display:block;inline-size:100%;max-block-size:280px;object-fit:contain;border-radius:var(--radius-card);background:var(--c-bg-tertiary)}\n"] }]
330
+ }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], preview: [{ type: i0.Input, args: [{ isSignal: true, alias: "preview", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], cropWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "cropWidth", required: false }] }], cropHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "cropHeight", required: false }] }], t_item: [{ type: i0.Input, args: [{ isSignal: true, alias: "t_item", required: false }] }], t_empty: [{ type: i0.Input, args: [{ isSignal: true, alias: "t_empty", required: false }] }], container: [{ type: i0.Input, args: [{ isSignal: true, alias: "container", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], wImage: [{ type: i0.Input, args: [{ isSignal: true, alias: "wImage", required: false }] }, { type: i0.Output, args: ["wImageChange"] }], wFile: [{ type: i0.Input, args: [{ isSignal: true, alias: "wFile", required: false }] }, { type: i0.Output, args: ["wFileChange"] }], wImages: [{ type: i0.Input, args: [{ isSignal: true, alias: "wImages", required: false }] }, { type: i0.Output, args: ["wImagesChange"] }], wFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "wFiles", required: false }] }, { type: i0.Output, args: ["wFilesChange"] }] } });
331
+
332
+ class FileSelectorComponent {
333
+ constructor() {
334
+ this._files = inject(FileService);
335
+ this._translate = inject(TranslateService);
336
+ this.wModel = input(null, { ...(ngDevMode ? { debugName: "wModel" } : /* istanbul ignore next */ {}), alias: 'wModel' });
337
+ this.wChange = output();
338
+ this.items = signal(this._files.documents(), /* @ts-ignore */
339
+ ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
340
+ this.placeholder = this._translate.translate('Select file...');
341
+ }
342
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FileSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
343
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: FileSelectorComponent, isStandalone: true, selector: "file-selector", inputs: { wModel: { classPropertyName: "wModel", publicName: "wModel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { wChange: "wChange" }, ngImport: i0, template: "<wselect\r\n\t[placeholder]=\"placeholder()\"\r\n\t[items]=\"items()\"\r\n\tbindLabel=\"name\"\r\n\tbindValue=\"_id\"\r\n></wselect>\r\n\r\n<!--\r\n\t[(wModel)]=\"wModel()\"\r\n\t(wChange)=\"wChange.emit($event as string | null)\"\r\n-->\r\n", dependencies: [{ kind: "component", type: SelectComponent, selector: "wselect", inputs: ["disabled", "clearable", "placeholder", "multiple", "bindLabel", "bindValue", "label", "searchable", "searchableBy", "items", "buttons", "formField", "field", "wModel"], outputs: ["wModelChange", "wChange"] }] }); }
344
+ }
345
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FileSelectorComponent, decorators: [{
346
+ type: Component,
347
+ args: [{ selector: 'file-selector', imports: [SelectComponent], template: "<wselect\r\n\t[placeholder]=\"placeholder()\"\r\n\t[items]=\"items()\"\r\n\tbindLabel=\"name\"\r\n\tbindValue=\"_id\"\r\n></wselect>\r\n\r\n<!--\r\n\t[(wModel)]=\"wModel()\"\r\n\t(wChange)=\"wChange.emit($event as string | null)\"\r\n-->\r\n" }]
348
+ }], propDecorators: { wModel: [{ type: i0.Input, args: [{ isSignal: true, alias: "wModel", required: false }] }], wChange: [{ type: i0.Output, args: ["wChange"] }] } });
349
+
350
+ const fileFormComponents = {
351
+ title: 'File',
352
+ components: [
353
+ {
354
+ name: 'Input',
355
+ key: 'url',
356
+ props: {
357
+ label: 'URL',
358
+ placeholder: 'Enter file URL...',
359
+ },
360
+ },
361
+ {
362
+ name: 'Input',
363
+ key: 'name',
364
+ props: {
365
+ label: 'Name',
366
+ placeholder: 'Enter name...',
367
+ },
368
+ },
369
+ {
370
+ name: 'Input',
371
+ key: 'description',
372
+ props: {
373
+ label: 'Description',
374
+ placeholder: 'Enter description...',
375
+ type: 'textarea',
376
+ },
377
+ },
378
+ ],
379
+ };
380
+ class FilesComponent {
381
+ constructor() {
382
+ this._fileService = inject(FileService);
383
+ this._clipboard = inject(Clipboard);
384
+ this._alert = inject(AlertService);
385
+ this._form = inject(FormService);
386
+ this._core = inject(CoreService);
387
+ this.columns = ['img', 'url'];
388
+ this.form = fileFormComponents;
389
+ this.config = {
390
+ paginate: this.setRows.bind(this),
391
+ perPage: 20,
392
+ setPerPage: this._fileService.setPerPage.bind(this._fileService),
393
+ allDocs: false,
394
+ create: () => {
395
+ this._form.modal(this.form, {
396
+ label: 'Create',
397
+ click: async (created, close) => {
398
+ close();
399
+ this._preCreate(created);
400
+ this._fileService.create(created);
401
+ this.setRows();
402
+ },
403
+ });
404
+ },
405
+ delete: (doc) => {
406
+ this._alert.question({
407
+ text: 'Are you sure you want to delete this file?',
408
+ buttons: [
409
+ { text: 'No' },
410
+ {
411
+ text: 'Yes',
412
+ callback: async () => {
413
+ this._fileService.delete(doc);
414
+ this.setRows();
415
+ },
416
+ },
417
+ ],
418
+ });
419
+ },
420
+ };
421
+ this.rows = [];
422
+ this._page = 1;
423
+ this.setRows();
424
+ }
425
+ copy(text) {
426
+ this._clipboard.copy(text);
427
+ this._alert.info({ text: 'Url has been copied' });
428
+ }
429
+ setRows(page = this._page) {
430
+ this._page = page;
431
+ this._core.afterWhile(this, () => {
432
+ this._fileService.get({ page }).subscribe((rows) => {
433
+ this.rows.splice(0, this.rows.length);
434
+ this.rows.push(...rows);
435
+ });
436
+ }, 250);
437
+ }
438
+ _preCreate(file) {
439
+ delete file.__created;
440
+ }
441
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FilesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
442
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.2", type: FilesComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<wtable title=\"Files\" [columns]=\"columns\" [config]=\"config\" [rows]=\"rows\">\r\n\t<ng-template cell=\"img\" let-element>\r\n\t\t<img\r\n\t\t\t[src]=\"element.url || ''\"\n\t\t\t(click)=\"copy(element.url)\"\r\n\t\t\tstyle=\"height: 100px\"\r\n\t\t/>\r\n\t</ng-template>\r\n\t<ng-template cell=\"url\" let-element>\r\n\t\t<span (click)=\"copy(element.url || '')\">{{ element.url }}</span>\n\t</ng-template>\r\n</wtable>\r\n", dependencies: [{ kind: "component", type: TableComponent, selector: "wtable", inputs: ["bindValue", "rows", "config", "columns", "value", "title"], outputs: ["columnsChange", "onSearch"] }] }); }
443
+ }
444
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FilesComponent, decorators: [{
445
+ type: Component,
446
+ args: [{ imports: [TableComponent], template: "<wtable title=\"Files\" [columns]=\"columns\" [config]=\"config\" [rows]=\"rows\">\r\n\t<ng-template cell=\"img\" let-element>\r\n\t\t<img\r\n\t\t\t[src]=\"element.url || ''\"\n\t\t\t(click)=\"copy(element.url)\"\r\n\t\t\tstyle=\"height: 100px\"\r\n\t\t/>\r\n\t</ng-template>\r\n\t<ng-template cell=\"url\" let-element>\r\n\t\t<span (click)=\"copy(element.url || '')\">{{ element.url }}</span>\n\t</ng-template>\r\n</wtable>\r\n" }]
447
+ }], ctorParameters: () => [] });
448
+
449
+ var files_component = /*#__PURE__*/Object.freeze({
450
+ __proto__: null,
451
+ FilesComponent: FilesComponent
452
+ });
453
+
454
+ const filesRoutes = [
455
+ {
456
+ path: '',
457
+ loadComponent: () => Promise.resolve().then(function () { return files_component; }).then((m) => m.FilesComponent),
458
+ },
459
+ ];
460
+
461
+ const DEFAULT_ACE_CONFIG = {
462
+ // keep empty if you don’t want global defaults
463
+ };
464
+ class AceFormComponent {
465
+ constructor() {
466
+ this._form = inject(FormService);
467
+ this.templateRef = viewChild.required('templateRef');
468
+ }
469
+ ngOnInit() {
470
+ this._form.addTemplateComponent('Ace', this.templateRef());
471
+ }
472
+ /* ------------ value bridge (Signal Forms + legacy) ------------ */
473
+ getValue(data) {
474
+ const key = data?.key ?? null;
475
+ // Signal Forms field (preferred)
476
+ if (data?.field) {
477
+ try {
478
+ const state = data.field();
479
+ if (state?.value && typeof state.value === 'function') {
480
+ return state.value() ?? '';
481
+ }
482
+ }
483
+ catch {
484
+ // fall through
485
+ }
486
+ }
487
+ // Model signal
488
+ if (data?.model && typeof data.model === 'function' && key) {
489
+ const current = data.model();
490
+ return current?.[key] ?? '';
491
+ }
492
+ // Legacy submission object
493
+ if (!key || !data?.submition)
494
+ return '';
495
+ return data.submition[key] ?? '';
496
+ }
497
+ onValueChange(data, value) {
498
+ const key = data?.key ?? null;
499
+ // 1) Signal Forms field
500
+ if (data?.field) {
501
+ try {
502
+ const state = data.field();
503
+ if (state?.value?.set)
504
+ state.value.set(value);
505
+ }
506
+ catch {
507
+ // ignore and fall through
508
+ }
509
+ }
510
+ // 2) Model signal
511
+ else if (data?.model &&
512
+ typeof data.model.update === 'function' &&
513
+ key) {
514
+ data.model.update((current) => ({
515
+ ...current,
516
+ [key]: value,
517
+ }));
518
+ }
519
+ // 3) Legacy submission object
520
+ else if (data?.submition && key) {
521
+ data.submition[key] = value;
522
+ }
523
+ if (typeof data?.wChange === 'function')
524
+ data.wChange();
525
+ }
526
+ /* ------------ config / props helpers ------------ */
527
+ getConfig(data) {
528
+ const props = (data?.props ?? {});
529
+ const config = { ...DEFAULT_ACE_CONFIG };
530
+ const toNumber = (v) => {
531
+ if (v === null || v === undefined || v === '')
532
+ return undefined;
533
+ const n = Number(v);
534
+ return Number.isNaN(n) ? undefined : n;
535
+ };
536
+ // Layout
537
+ const minLines = toNumber(props['minLines']);
538
+ const maxLines = toNumber(props['maxLines']);
539
+ const tabSize = toNumber(props['tabSize']);
540
+ if (props['fontSize'] !== undefined &&
541
+ props['fontSize'] !== null &&
542
+ props['fontSize'] !== '') {
543
+ config.fontSize = String(props['fontSize']);
544
+ }
545
+ if (minLines !== undefined)
546
+ config.minLines = minLines;
547
+ if (maxLines !== undefined)
548
+ config.maxLines = maxLines;
549
+ if (tabSize !== undefined)
550
+ config.tabSize = tabSize;
551
+ // Behavior toggles
552
+ if (typeof props['useSoftTabs'] === 'boolean')
553
+ config.useSoftTabs = props['useSoftTabs'];
554
+ if (typeof props['wrap'] === 'boolean')
555
+ config.wrap = props['wrap'];
556
+ if (typeof props['showLineNumbers'] === 'boolean')
557
+ config.showLineNumbers = props['showLineNumbers'];
558
+ if (typeof props['showGutter'] === 'boolean')
559
+ config.showGutter = props['showGutter'];
560
+ if (typeof props['highlightActiveLine'] === 'boolean')
561
+ config.highlightActiveLine = props['highlightActiveLine'];
562
+ if (typeof props['showPrintMargin'] === 'boolean')
563
+ config.showPrintMargin = props['showPrintMargin'];
564
+ if (typeof props['readOnly'] === 'boolean')
565
+ config.readOnly = props['readOnly'];
566
+ if (typeof props['useWorker'] === 'boolean')
567
+ config.useWorker = props['useWorker'];
568
+ // Local config object from props
569
+ const localConfig = props['config'];
570
+ if (localConfig &&
571
+ typeof localConfig === 'object' &&
572
+ !Array.isArray(localConfig)) {
573
+ Object.assign(config, localConfig);
574
+ }
575
+ // Per-field config (code-level override)
576
+ const fieldConfig = data?.field?.['Config'];
577
+ if (fieldConfig &&
578
+ typeof fieldConfig === 'object' &&
579
+ !Array.isArray(fieldConfig)) {
580
+ Object.assign(config, fieldConfig);
581
+ }
582
+ // Extra config JSON string
583
+ const configJson = props['configJson'];
584
+ if (typeof configJson === 'string' && configJson.trim()) {
585
+ try {
586
+ const json = JSON.parse(configJson);
587
+ if (json && typeof json === 'object' && !Array.isArray(json)) {
588
+ Object.assign(config, json);
589
+ }
590
+ }
591
+ catch {
592
+ // invalid JSON -> ignore
593
+ }
594
+ }
595
+ return config;
596
+ }
597
+ getMode(data) {
598
+ const propsMode = data?.props?.['mode'];
599
+ const fieldMode = data?.field?.['Mode'];
600
+ if (propsMode)
601
+ return String(propsMode);
602
+ if (fieldMode)
603
+ return String(fieldMode);
604
+ return 'text';
605
+ }
606
+ getTheme(data) {
607
+ const propsTheme = data?.props?.['theme'];
608
+ const fieldTheme = data?.field?.['Theme'];
609
+ if (propsTheme)
610
+ return String(propsTheme);
611
+ if (fieldTheme)
612
+ return String(fieldTheme);
613
+ return 'github';
614
+ }
615
+ isDisabled(data) {
616
+ return !!(data?.props?.['disabled'] ||
617
+ data?.component?.disabled ||
618
+ data?.field?.['Disabled']);
619
+ }
620
+ getUseAceClass(data) {
621
+ const prop = data?.props?.['useAceClass'];
622
+ if (typeof prop === 'boolean')
623
+ return prop;
624
+ const field = data?.field?.['UseAceClass'];
625
+ if (typeof field === 'boolean')
626
+ return field;
627
+ return true;
628
+ }
629
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: AceFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
630
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.2", type: AceFormComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-data>\r\n\t<div class=\"w-ace\" [class]=\"data.component?.class\">\r\n\t\t<ace\r\n\t\t\tclass=\"w-ace__editor\"\r\n\t\t\t(valueChange)=\"onValueChange(data, $event)\"\r\n\t\t\t[value]=\"getValue(data)\"\r\n\t\t\t[config]=\"getConfig(data)\"\r\n\t\t\t[mode]=\"$any(getMode(data))\"\r\n\t\t\t[theme]=\"$any(getTheme(data))\"\r\n\t\t\t[disabled]=\"isDisabled(data)\"\r\n\t\t\t[useAceClass]=\"getUseAceClass(data)\"\r\n\t\t></ace>\r\n\t</div>\r\n</ng-template>\r\n", styles: ["@charset \"UTF-8\";.w-ace{width:100%;background:var(--c-bg-secondary);color:var(--c-text-primary);border:1px solid var(--c-border);border-radius:var(--radius-card);box-shadow:var(--shadow-sm);overflow:hidden}.w-ace__editor{display:block;width:100%;height:clamp(240px,60vh,720px)}\n"], dependencies: [{ kind: "component", type: AceComponent, selector: "ace", inputs: ["disabled", "readOnly", "mode", "theme", "config", "useAceClass", "value"], outputs: ["valueChange", "blur", "focus", "copy", "paste", "change", "changeCursor", "changeSession", "changeSelection"], exportAs: ["ngxAce"] }] }); }
631
+ }
632
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: AceFormComponent, decorators: [{
633
+ type: Component,
634
+ args: [{ imports: [AceComponent], template: "<ng-template #templateRef let-data>\r\n\t<div class=\"w-ace\" [class]=\"data.component?.class\">\r\n\t\t<ace\r\n\t\t\tclass=\"w-ace__editor\"\r\n\t\t\t(valueChange)=\"onValueChange(data, $event)\"\r\n\t\t\t[value]=\"getValue(data)\"\r\n\t\t\t[config]=\"getConfig(data)\"\r\n\t\t\t[mode]=\"$any(getMode(data))\"\r\n\t\t\t[theme]=\"$any(getTheme(data))\"\r\n\t\t\t[disabled]=\"isDisabled(data)\"\r\n\t\t\t[useAceClass]=\"getUseAceClass(data)\"\r\n\t\t></ace>\r\n\t</div>\r\n</ng-template>\r\n", styles: ["@charset \"UTF-8\";.w-ace{width:100%;background:var(--c-bg-secondary);color:var(--c-text-primary);border:1px solid var(--c-border);border-radius:var(--radius-card);box-shadow:var(--shadow-sm);overflow:hidden}.w-ace__editor{display:block;width:100%;height:clamp(240px,60vh,720px)}\n"] }]
635
+ }], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
636
+
637
+ const aceForm = {
638
+ formId: 'ace',
639
+ title: 'Ace editor',
640
+ components: [
641
+ // Language / theme
642
+ {
643
+ name: 'Select',
644
+ key: 'mode',
645
+ props: {
646
+ label: 'Mode (language)',
647
+ placeholder: 'Select language mode...',
648
+ items: [
649
+ 'text',
650
+ 'javascript',
651
+ 'typescript',
652
+ 'json',
653
+ 'html',
654
+ 'css',
655
+ 'scss',
656
+ 'markdown',
657
+ 'sql',
658
+ 'yaml',
659
+ 'xml',
660
+ 'sh',
661
+ 'powershell',
662
+ ],
663
+ },
664
+ },
665
+ {
666
+ name: 'Select',
667
+ key: 'theme',
668
+ props: {
669
+ label: 'Theme',
670
+ placeholder: 'Select theme...',
671
+ items: [
672
+ 'github',
673
+ 'monokai',
674
+ 'tomorrow',
675
+ 'twilight',
676
+ 'solarized_light',
677
+ 'solarized_dark',
678
+ 'dracula',
679
+ 'chaos',
680
+ 'chrome',
681
+ 'clouds',
682
+ ],
683
+ },
684
+ },
685
+ // Layout
686
+ {
687
+ name: 'Input',
688
+ key: 'fontSize',
689
+ props: {
690
+ label: 'Font size',
691
+ placeholder: 'Example: 12px or 12pt',
692
+ },
693
+ },
694
+ {
695
+ name: 'Input',
696
+ key: 'minLines',
697
+ props: {
698
+ label: 'Min lines',
699
+ placeholder: 'e.g. 10',
700
+ type: 'number',
701
+ },
702
+ },
703
+ {
704
+ name: 'Input',
705
+ key: 'maxLines',
706
+ props: {
707
+ label: 'Max lines',
708
+ placeholder: 'e.g. 60',
709
+ type: 'number',
710
+ },
711
+ },
712
+ // Tabs / wrapping
713
+ {
714
+ name: 'Input',
715
+ key: 'tabSize',
716
+ props: {
717
+ label: 'Tab size',
718
+ placeholder: 'e.g. 2 or 4',
719
+ type: 'number',
720
+ },
721
+ },
722
+ {
723
+ name: 'Input',
724
+ key: 'useSoftTabs',
725
+ props: {
726
+ label: 'Use soft tabs (spaces)',
727
+ type: 'checkbox',
728
+ },
729
+ },
730
+ {
731
+ name: 'Input',
732
+ key: 'wrap',
733
+ props: {
734
+ label: 'Wrap long lines',
735
+ type: 'checkbox',
736
+ },
737
+ },
738
+ // Visibility / UX
739
+ {
740
+ name: 'Input',
741
+ key: 'showLineNumbers',
742
+ props: {
743
+ label: 'Show line numbers',
744
+ type: 'checkbox',
745
+ },
746
+ },
747
+ {
748
+ name: 'Input',
749
+ key: 'showGutter',
750
+ props: {
751
+ label: 'Show gutter',
752
+ type: 'checkbox',
753
+ },
754
+ },
755
+ {
756
+ name: 'Input',
757
+ key: 'highlightActiveLine',
758
+ props: {
759
+ label: 'Highlight active line',
760
+ type: 'checkbox',
761
+ },
762
+ },
763
+ {
764
+ name: 'Input',
765
+ key: 'showPrintMargin',
766
+ props: {
767
+ label: 'Show print margin',
768
+ type: 'checkbox',
769
+ },
770
+ },
771
+ // Behavior
772
+ {
773
+ name: 'Input',
774
+ key: 'readOnly',
775
+ props: {
776
+ label: 'Read only',
777
+ type: 'checkbox',
778
+ },
779
+ },
780
+ {
781
+ name: 'Input',
782
+ key: 'useWorker',
783
+ props: {
784
+ label: 'Use web worker (linting, etc.)',
785
+ type: 'checkbox',
786
+ },
787
+ },
788
+ {
789
+ name: 'Input',
790
+ key: 'disabled',
791
+ props: {
792
+ label: 'Disabled (component)',
793
+ type: 'checkbox',
794
+ },
795
+ },
796
+ {
797
+ name: 'Input',
798
+ key: 'useAceClass',
799
+ props: {
800
+ label: 'Use Ace built-in styles',
801
+ type: 'checkbox',
802
+ },
803
+ },
804
+ // Extra config escape hatch
805
+ {
806
+ name: 'Input',
807
+ key: 'configJson',
808
+ props: {
809
+ label: 'Extra Ace config (JSON)',
810
+ placeholder: '{"printMarginColumn": 120, "scrollPastEnd": 0.5}',
811
+ type: 'textarea',
812
+ },
813
+ },
814
+ ],
815
+ };
816
+
817
+ class ButtonFormComponent {
818
+ constructor() {
819
+ this._formService = inject(FormService);
820
+ this.templateRef = viewChild.required('templateRef');
821
+ this.buttonDefaults = buttonDefaults;
822
+ }
823
+ ngOnInit() {
824
+ this._formService.addTemplateComponent('Button', this.templateRef());
825
+ }
826
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: ButtonFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
827
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.2", type: ButtonFormComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-data>\r\n\t<wbutton\r\n\t\t[type]=\"data.props.type ?? buttonDefaults.type\"\r\n\t\t[extraClass]=\"data.props.extraClass ?? buttonDefaults.extraClass\"\r\n\t\t[disabled]=\"data.props.disabled === true || data.component?.disabled === true\"\r\n\t\t[disableSubmit]=\"data.props.disableSubmit ?? buttonDefaults.disableSubmit\"\r\n\t\t[isMultipleClicksAllowed]=\"\r\n\t\t\tdata.props.isMultipleClicksAllowed ??\r\n\t\t\tbuttonDefaults.isMultipleClicksAllowed\r\n\t\t\"\r\n\t\t(wClick)=\"data.props.onClick?.($event); data.wClick?.()\"\r\n\t>\r\n\t\t{{ data.props.label || data.props.text || 'Button' }}\r\n\t</wbutton>\r\n</ng-template>\r\n", dependencies: [{ kind: "component", type: ButtonComponent, selector: "wbutton", inputs: ["type", "extraClass", "disabled", "disableSubmit", "isMultipleClicksAllowed"], outputs: ["wClick"] }] }); }
828
+ }
829
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: ButtonFormComponent, decorators: [{
830
+ type: Component,
831
+ args: [{ imports: [ButtonComponent], template: "<ng-template #templateRef let-data>\r\n\t<wbutton\r\n\t\t[type]=\"data.props.type ?? buttonDefaults.type\"\r\n\t\t[extraClass]=\"data.props.extraClass ?? buttonDefaults.extraClass\"\r\n\t\t[disabled]=\"data.props.disabled === true || data.component?.disabled === true\"\r\n\t\t[disableSubmit]=\"data.props.disableSubmit ?? buttonDefaults.disableSubmit\"\r\n\t\t[isMultipleClicksAllowed]=\"\r\n\t\t\tdata.props.isMultipleClicksAllowed ??\r\n\t\t\tbuttonDefaults.isMultipleClicksAllowed\r\n\t\t\"\r\n\t\t(wClick)=\"data.props.onClick?.($event); data.wClick?.()\"\r\n\t>\r\n\t\t{{ data.props.label || data.props.text || 'Button' }}\r\n\t</wbutton>\r\n</ng-template>\r\n" }]
832
+ }], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
833
+
834
+ const buttonForm = {
835
+ formId: 'button',
836
+ title: 'Button',
837
+ components: [
838
+ {
839
+ name: 'Input',
840
+ key: 'label',
841
+ focused: true,
842
+ props: {
843
+ label: 'Label',
844
+ placeholder: 'Enter button label...',
845
+ },
846
+ },
847
+ {
848
+ name: 'Input',
849
+ key: 'text',
850
+ props: {
851
+ label: 'Text (fallback)',
852
+ placeholder: 'Optional alternative text...',
853
+ },
854
+ },
855
+ {
856
+ name: 'Select',
857
+ key: 'type',
858
+ props: {
859
+ label: 'Button type',
860
+ placeholder: 'Select button type...',
861
+ items: [
862
+ 'primary',
863
+ 'secondary',
864
+ 'success',
865
+ 'danger',
866
+ 'warning',
867
+ 'info',
868
+ 'light',
869
+ 'dark',
870
+ 'link',
871
+ ],
872
+ },
873
+ },
874
+ {
875
+ name: 'Input',
876
+ key: 'extraClass',
877
+ props: {
878
+ label: 'Extra CSS classes',
879
+ placeholder: 'wbutton--wide, my-custom-class...',
880
+ },
881
+ },
882
+ {
883
+ name: 'Input',
884
+ key: 'disabled',
885
+ props: {
886
+ label: 'Disabled',
887
+ type: 'checkbox',
888
+ },
889
+ },
890
+ {
891
+ name: 'Input',
892
+ key: 'disableSubmit',
893
+ props: {
894
+ label: 'Disable submit (use type="button")',
895
+ type: 'checkbox',
896
+ },
897
+ },
898
+ {
899
+ name: 'Input',
900
+ key: 'isMultipleClicksAllowed',
901
+ props: {
902
+ label: 'Allow multiple rapid clicks',
903
+ type: 'checkbox',
904
+ },
905
+ },
906
+ ],
907
+ };
908
+
909
+ class FileFormComponent {
910
+ constructor() {
911
+ this._formService = inject(FormService);
912
+ this.templateRef = viewChild.required('templateRef');
913
+ this.fileDefaults = fileDefaults;
914
+ }
915
+ ngOnInit() {
916
+ this._formService.addTemplateComponent('File', this.templateRef());
917
+ }
918
+ /* ------------ value bridge (Signal Forms + model + legacy) ------------ */
919
+ getValue(data) {
920
+ const key = data?.key ?? null;
921
+ // 1) Signal Forms field (preferred)
922
+ if (data?.field) {
923
+ try {
924
+ const state = data.field();
925
+ if (state?.value && typeof state.value === 'function') {
926
+ return state.value();
927
+ }
928
+ }
929
+ catch {
930
+ // fall through
931
+ }
932
+ }
933
+ // 2) Model signal
934
+ if (data?.model && typeof data.model === 'function' && key) {
935
+ const current = data.model();
936
+ return current?.[key];
937
+ }
938
+ // 3) Legacy submission object
939
+ if (!key || !data?.submition)
940
+ return null;
941
+ return data.submition[key] ?? null;
942
+ }
943
+ onValueChange(data, value) {
944
+ const key = data?.key ?? null;
945
+ // 1) Signal Forms field
946
+ if (data?.field) {
947
+ try {
948
+ const state = data.field();
949
+ if (state?.value?.set)
950
+ state.value.set(value);
951
+ }
952
+ catch {
953
+ // ignore and fall through
954
+ }
955
+ }
956
+ // 2) Model signal
957
+ else if (data?.model &&
958
+ typeof data.model.update === 'function' &&
959
+ key) {
960
+ data.model.update((current) => ({
961
+ ...current,
962
+ [key]: value,
963
+ }));
964
+ }
965
+ // 3) Legacy submission object
966
+ else if (data?.submition && key) {
967
+ data.submition[key] = value;
968
+ }
969
+ if (typeof data?.wChange === 'function')
970
+ data.wChange();
971
+ }
972
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FileFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
973
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: FileFormComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-data>\r\n\t@let mode = (data.props.mode ?? fileDefaults.mode); @switch (mode) { @case\r\n\t('single-image') {\r\n\t<ngx-file\r\n\t\t[label]=\"data.props.label ?? fileDefaults.label\"\r\n\t\t[placeholder]=\"data.props.placeholder ?? fileDefaults.placeholder\"\r\n\t\t[disabled]=\"data.props.disabled === true || data.component?.disabled === true\"\r\n\t\t[clearable]=\"data.props.clearable ?? fileDefaults.clearable\"\r\n\t\t[accept]=\"data.props.accept ?? fileDefaults.accept\"\r\n\t\t[preview]=\"data.props.preview ?? fileDefaults.preview\"\r\n\t\t[mode]=\"mode\"\r\n\t\t[view]=\"data.props.view ?? fileDefaults.view\"\r\n\t\t[cropWidth]=\"data.props.cropWidth ?? fileDefaults.cropWidth\"\r\n\t\t[cropHeight]=\"data.props.cropHeight ?? fileDefaults.cropHeight\"\r\n\t\t[container]=\"data.props.container ?? fileDefaults.container\"\r\n\t\t[name]=\"data.props.name ?? fileDefaults.name\"\r\n\t\t[wImage]=\"getValue(data)\"\r\n\t\t(wImageChange)=\"onValueChange(data, $event)\"\r\n\t></ngx-file>\r\n\t} @case ('single-file') {\r\n\t<ngx-file\r\n\t\t[label]=\"data.props.label ?? fileDefaults.label\"\r\n\t\t[placeholder]=\"data.props.placeholder ?? fileDefaults.placeholder\"\r\n\t\t[disabled]=\"data.props.disabled === true || data.component?.disabled === true\"\r\n\t\t[clearable]=\"data.props.clearable ?? fileDefaults.clearable\"\r\n\t\t[accept]=\"data.props.accept ?? fileDefaults.accept\"\r\n\t\t[preview]=\"data.props.preview ?? fileDefaults.preview\"\r\n\t\t[mode]=\"mode\"\r\n\t\t[view]=\"data.props.view ?? fileDefaults.view\"\r\n\t\t[cropWidth]=\"data.props.cropWidth ?? fileDefaults.cropWidth\"\r\n\t\t[cropHeight]=\"data.props.cropHeight ?? fileDefaults.cropHeight\"\r\n\t\t[container]=\"data.props.container ?? fileDefaults.container\"\r\n\t\t[name]=\"data.props.name ?? fileDefaults.name\"\r\n\t\t[wFile]=\"getValue(data)\"\r\n\t\t(wFileChange)=\"onValueChange(data, $event)\"\r\n\t></ngx-file>\r\n\t} @case ('multi-image') {\r\n\t<ngx-file\r\n\t\t[label]=\"data.props.label ?? fileDefaults.label\"\r\n\t\t[placeholder]=\"data.props.placeholder ?? fileDefaults.placeholder\"\r\n\t\t[disabled]=\"data.props.disabled === true || data.component?.disabled === true\"\r\n\t\t[clearable]=\"data.props.clearable ?? fileDefaults.clearable\"\r\n\t\t[accept]=\"data.props.accept ?? fileDefaults.accept\"\r\n\t\t[preview]=\"data.props.preview ?? fileDefaults.preview\"\r\n\t\t[mode]=\"mode\"\r\n\t\t[view]=\"data.props.view ?? fileDefaults.view\"\r\n\t\t[cropWidth]=\"data.props.cropWidth ?? fileDefaults.cropWidth\"\r\n\t\t[cropHeight]=\"data.props.cropHeight ?? fileDefaults.cropHeight\"\r\n\t\t[container]=\"data.props.container ?? fileDefaults.container\"\r\n\t\t[name]=\"data.props.name ?? fileDefaults.name\"\r\n\t\t[wImages]=\"getValue(data)\"\r\n\t\t(wImagesChange)=\"onValueChange(data, $event)\"\r\n\t></ngx-file>\r\n\t} @default {\r\n\t<!-- multi-file (default) -->\r\n\t<ngx-file\r\n\t\t[label]=\"data.props.label ?? fileDefaults.label\"\r\n\t\t[placeholder]=\"data.props.placeholder ?? fileDefaults.placeholder\"\r\n\t\t[disabled]=\"data.props.disabled === true || data.component?.disabled === true\"\r\n\t\t[clearable]=\"data.props.clearable ?? fileDefaults.clearable\"\r\n\t\t[accept]=\"data.props.accept ?? fileDefaults.accept\"\r\n\t\t[preview]=\"data.props.preview ?? fileDefaults.preview\"\r\n\t\t[mode]=\"mode\"\r\n\t\t[view]=\"data.props.view ?? fileDefaults.view\"\r\n\t\t[cropWidth]=\"data.props.cropWidth ?? fileDefaults.cropWidth\"\r\n\t\t[cropHeight]=\"data.props.cropHeight ?? fileDefaults.cropHeight\"\r\n\t\t[container]=\"data.props.container ?? fileDefaults.container\"\r\n\t\t[name]=\"data.props.name ?? fileDefaults.name\"\r\n\t\t[wFiles]=\"getValue(data)\"\r\n\t\t(wFilesChange)=\"onValueChange(data, $event)\"\r\n\t></ngx-file>\r\n\t} }\r\n</ng-template>\r\n", dependencies: [{ kind: "component", type: FileComponent, selector: "ngx-file", inputs: ["label", "placeholder", "disabled", "clearable", "accept", "preview", "mode", "view", "cropWidth", "cropHeight", "t_item", "t_empty", "container", "name", "wImage", "wFile", "wImages", "wFiles"], outputs: ["wImageChange", "wFileChange", "wImagesChange", "wFilesChange"] }] }); }
974
+ }
975
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FileFormComponent, decorators: [{
976
+ type: Component,
977
+ args: [{ imports: [FileComponent], template: "<ng-template #templateRef let-data>\r\n\t@let mode = (data.props.mode ?? fileDefaults.mode); @switch (mode) { @case\r\n\t('single-image') {\r\n\t<ngx-file\r\n\t\t[label]=\"data.props.label ?? fileDefaults.label\"\r\n\t\t[placeholder]=\"data.props.placeholder ?? fileDefaults.placeholder\"\r\n\t\t[disabled]=\"data.props.disabled === true || data.component?.disabled === true\"\r\n\t\t[clearable]=\"data.props.clearable ?? fileDefaults.clearable\"\r\n\t\t[accept]=\"data.props.accept ?? fileDefaults.accept\"\r\n\t\t[preview]=\"data.props.preview ?? fileDefaults.preview\"\r\n\t\t[mode]=\"mode\"\r\n\t\t[view]=\"data.props.view ?? fileDefaults.view\"\r\n\t\t[cropWidth]=\"data.props.cropWidth ?? fileDefaults.cropWidth\"\r\n\t\t[cropHeight]=\"data.props.cropHeight ?? fileDefaults.cropHeight\"\r\n\t\t[container]=\"data.props.container ?? fileDefaults.container\"\r\n\t\t[name]=\"data.props.name ?? fileDefaults.name\"\r\n\t\t[wImage]=\"getValue(data)\"\r\n\t\t(wImageChange)=\"onValueChange(data, $event)\"\r\n\t></ngx-file>\r\n\t} @case ('single-file') {\r\n\t<ngx-file\r\n\t\t[label]=\"data.props.label ?? fileDefaults.label\"\r\n\t\t[placeholder]=\"data.props.placeholder ?? fileDefaults.placeholder\"\r\n\t\t[disabled]=\"data.props.disabled === true || data.component?.disabled === true\"\r\n\t\t[clearable]=\"data.props.clearable ?? fileDefaults.clearable\"\r\n\t\t[accept]=\"data.props.accept ?? fileDefaults.accept\"\r\n\t\t[preview]=\"data.props.preview ?? fileDefaults.preview\"\r\n\t\t[mode]=\"mode\"\r\n\t\t[view]=\"data.props.view ?? fileDefaults.view\"\r\n\t\t[cropWidth]=\"data.props.cropWidth ?? fileDefaults.cropWidth\"\r\n\t\t[cropHeight]=\"data.props.cropHeight ?? fileDefaults.cropHeight\"\r\n\t\t[container]=\"data.props.container ?? fileDefaults.container\"\r\n\t\t[name]=\"data.props.name ?? fileDefaults.name\"\r\n\t\t[wFile]=\"getValue(data)\"\r\n\t\t(wFileChange)=\"onValueChange(data, $event)\"\r\n\t></ngx-file>\r\n\t} @case ('multi-image') {\r\n\t<ngx-file\r\n\t\t[label]=\"data.props.label ?? fileDefaults.label\"\r\n\t\t[placeholder]=\"data.props.placeholder ?? fileDefaults.placeholder\"\r\n\t\t[disabled]=\"data.props.disabled === true || data.component?.disabled === true\"\r\n\t\t[clearable]=\"data.props.clearable ?? fileDefaults.clearable\"\r\n\t\t[accept]=\"data.props.accept ?? fileDefaults.accept\"\r\n\t\t[preview]=\"data.props.preview ?? fileDefaults.preview\"\r\n\t\t[mode]=\"mode\"\r\n\t\t[view]=\"data.props.view ?? fileDefaults.view\"\r\n\t\t[cropWidth]=\"data.props.cropWidth ?? fileDefaults.cropWidth\"\r\n\t\t[cropHeight]=\"data.props.cropHeight ?? fileDefaults.cropHeight\"\r\n\t\t[container]=\"data.props.container ?? fileDefaults.container\"\r\n\t\t[name]=\"data.props.name ?? fileDefaults.name\"\r\n\t\t[wImages]=\"getValue(data)\"\r\n\t\t(wImagesChange)=\"onValueChange(data, $event)\"\r\n\t></ngx-file>\r\n\t} @default {\r\n\t<!-- multi-file (default) -->\r\n\t<ngx-file\r\n\t\t[label]=\"data.props.label ?? fileDefaults.label\"\r\n\t\t[placeholder]=\"data.props.placeholder ?? fileDefaults.placeholder\"\r\n\t\t[disabled]=\"data.props.disabled === true || data.component?.disabled === true\"\r\n\t\t[clearable]=\"data.props.clearable ?? fileDefaults.clearable\"\r\n\t\t[accept]=\"data.props.accept ?? fileDefaults.accept\"\r\n\t\t[preview]=\"data.props.preview ?? fileDefaults.preview\"\r\n\t\t[mode]=\"mode\"\r\n\t\t[view]=\"data.props.view ?? fileDefaults.view\"\r\n\t\t[cropWidth]=\"data.props.cropWidth ?? fileDefaults.cropWidth\"\r\n\t\t[cropHeight]=\"data.props.cropHeight ?? fileDefaults.cropHeight\"\r\n\t\t[container]=\"data.props.container ?? fileDefaults.container\"\r\n\t\t[name]=\"data.props.name ?? fileDefaults.name\"\r\n\t\t[wFiles]=\"getValue(data)\"\r\n\t\t(wFilesChange)=\"onValueChange(data, $event)\"\r\n\t></ngx-file>\r\n\t} }\r\n</ng-template>\r\n" }]
978
+ }], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
979
+
980
+ const fileForm = {
981
+ formId: 'file',
982
+ title: 'File',
983
+ components: [
984
+ {
985
+ name: 'Input',
986
+ key: 'label',
987
+ focused: true,
988
+ props: {
989
+ label: 'Label',
990
+ placeholder: 'Enter file field label...',
991
+ },
992
+ },
993
+ {
994
+ name: 'Input',
995
+ key: 'placeholder',
996
+ props: {
997
+ label: 'Placeholder',
998
+ placeholder: 'Select file',
999
+ },
1000
+ },
1001
+ {
1002
+ name: 'Select',
1003
+ key: 'mode',
1004
+ props: {
1005
+ label: 'Mode',
1006
+ placeholder: 'Select mode...',
1007
+ items: [
1008
+ 'single-image',
1009
+ 'single-file',
1010
+ 'multi-image',
1011
+ 'multi-file',
1012
+ ],
1013
+ },
1014
+ },
1015
+ {
1016
+ name: 'Select',
1017
+ key: 'view',
1018
+ props: {
1019
+ label: 'View',
1020
+ placeholder: 'Select view...',
1021
+ items: ['dropzone', 'list', 'thumb-only'],
1022
+ },
1023
+ },
1024
+ {
1025
+ name: 'Input',
1026
+ key: 'accept',
1027
+ props: {
1028
+ label: 'Accept',
1029
+ placeholder: 'Example: image/*, application/pdf',
1030
+ },
1031
+ },
1032
+ {
1033
+ name: 'Input',
1034
+ key: 'preview',
1035
+ props: {
1036
+ label: 'Show image preview',
1037
+ type: 'checkbox',
1038
+ },
1039
+ },
1040
+ {
1041
+ name: 'Input',
1042
+ key: 'clearable',
1043
+ props: {
1044
+ label: 'Allow clear',
1045
+ type: 'checkbox',
1046
+ },
1047
+ },
1048
+ {
1049
+ name: 'Input',
1050
+ key: 'cropWidth',
1051
+ props: {
1052
+ label: 'Crop width (px)',
1053
+ placeholder: 'Example: 1080',
1054
+ type: 'number',
1055
+ },
1056
+ },
1057
+ {
1058
+ name: 'Input',
1059
+ key: 'cropHeight',
1060
+ props: {
1061
+ label: 'Crop height (px)',
1062
+ placeholder: 'Example: 1080',
1063
+ type: 'number',
1064
+ },
1065
+ },
1066
+ {
1067
+ name: 'Input',
1068
+ key: 'container',
1069
+ props: {
1070
+ label: 'Backend container',
1071
+ placeholder: 'general, avatars, products...',
1072
+ },
1073
+ },
1074
+ {
1075
+ name: 'Input',
1076
+ key: 'name',
1077
+ props: {
1078
+ label: 'File name / prefix',
1079
+ placeholder: 'Optional file name prefix...',
1080
+ },
1081
+ },
1082
+ {
1083
+ name: 'Input',
1084
+ key: 'disabled',
1085
+ props: {
1086
+ label: 'Disabled',
1087
+ type: 'checkbox',
1088
+ },
1089
+ },
1090
+ ],
1091
+ };
1092
+
1093
+ class InputFormComponent {
1094
+ constructor() {
1095
+ this._formService = inject(FormService);
1096
+ this.templateRef = viewChild.required('templateRef');
1097
+ this.inputDefaults = inputDefaults;
1098
+ }
1099
+ ngOnInit() {
1100
+ this._formService.addTemplateComponent('Input', this.templateRef());
1101
+ }
1102
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: InputFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1103
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.2", type: InputFormComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-data>\r\n\t<winput\r\n\t\t[formField]=\"data.field\"\r\n\t\t[label]=\"data.props.label ?? inputDefaults.label\"\r\n\t\t[placeholder]=\"data.props.placeholder ?? inputDefaults.placeholder\"\r\n\t\t[type]=\"data.props.type ?? inputDefaults.type\"\r\n\t\t[name]=\"data.props.name || data.key || inputDefaults.name\"\r\n\t\t[items]=\"data.props.items ?? inputDefaults.items\"\r\n\t\t[disabled]=\"!!data.props.disabled || !!data.component?.disabled\"\r\n\t\t[focused]=\"data.props.focused ?? inputDefaults.focused\"\r\n\t\t[clearable]=\"data.props.clearable ?? inputDefaults.clearable\"\r\n\t\t[wClass]=\"data.props.wClass ?? inputDefaults.wClass\"\r\n\t\t[autocomplete]=\"data.props.autocomplete ?? inputDefaults.autocomplete\"\r\n\t\t[error]=\"data.props.error ?? inputDefaults.error\"\r\n\t></winput>\r\n</ng-template>\r\n", dependencies: [{ kind: "component", type: InputComponent, selector: "winput", inputs: ["formField", "wModel", "type", "name", "label", "placeholder", "items", "icons", "disabled", "focused", "clearable", "wClass", "autocomplete", "error"], outputs: ["wModelChange", "wChange", "wSubmit", "wBlur", "wFocus", "wKeydown"] }] }); }
1104
+ }
1105
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: InputFormComponent, decorators: [{
1106
+ type: Component,
1107
+ args: [{ imports: [InputComponent], template: "<ng-template #templateRef let-data>\r\n\t<winput\r\n\t\t[formField]=\"data.field\"\r\n\t\t[label]=\"data.props.label ?? inputDefaults.label\"\r\n\t\t[placeholder]=\"data.props.placeholder ?? inputDefaults.placeholder\"\r\n\t\t[type]=\"data.props.type ?? inputDefaults.type\"\r\n\t\t[name]=\"data.props.name || data.key || inputDefaults.name\"\r\n\t\t[items]=\"data.props.items ?? inputDefaults.items\"\r\n\t\t[disabled]=\"!!data.props.disabled || !!data.component?.disabled\"\r\n\t\t[focused]=\"data.props.focused ?? inputDefaults.focused\"\r\n\t\t[clearable]=\"data.props.clearable ?? inputDefaults.clearable\"\r\n\t\t[wClass]=\"data.props.wClass ?? inputDefaults.wClass\"\r\n\t\t[autocomplete]=\"data.props.autocomplete ?? inputDefaults.autocomplete\"\r\n\t\t[error]=\"data.props.error ?? inputDefaults.error\"\r\n\t></winput>\r\n</ng-template>\r\n" }]
1108
+ }], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
1109
+
1110
+ const inputForm = {
1111
+ formId: 'form',
1112
+ title: 'Form',
1113
+ components: [
1114
+ {
1115
+ name: 'Input',
1116
+ key: 'label',
1117
+ focused: true,
1118
+ props: {
1119
+ placeholder: 'Enter component label...',
1120
+ label: 'Label',
1121
+ },
1122
+ },
1123
+ {
1124
+ name: 'Input',
1125
+ key: 'placeholder',
1126
+ props: {
1127
+ placeholder: 'Enter component placeholder...',
1128
+ label: 'Placeholder',
1129
+ },
1130
+ },
1131
+ {
1132
+ name: 'Select',
1133
+ key: 'type',
1134
+ props: {
1135
+ placeholder: 'Enter component type...',
1136
+ label: 'Type',
1137
+ items: [
1138
+ 'text',
1139
+ 'password',
1140
+ 'email',
1141
+ 'radio',
1142
+ 'checkbox',
1143
+ 'textarea',
1144
+ 'search',
1145
+ 'tel',
1146
+ 'url',
1147
+ 'number',
1148
+ 'range',
1149
+ 'color',
1150
+ 'date',
1151
+ 'month',
1152
+ 'week',
1153
+ 'time',
1154
+ 'datetime',
1155
+ 'datetime-local',
1156
+ ],
1157
+ },
1158
+ },
1159
+ {
1160
+ name: 'Input',
1161
+ key: 'name',
1162
+ props: {
1163
+ placeholder: 'Enter HTML name attribute...',
1164
+ label: 'Name',
1165
+ },
1166
+ },
1167
+ {
1168
+ name: 'Input',
1169
+ key: 'autocomplete',
1170
+ props: {
1171
+ placeholder: 'Enter autocomplete (email, name, current-password, off...)',
1172
+ label: 'Autocomplete',
1173
+ },
1174
+ },
1175
+ {
1176
+ name: 'Input',
1177
+ key: 'wClass',
1178
+ props: {
1179
+ placeholder: 'Enter extra CSS classes...',
1180
+ label: 'CSS classes',
1181
+ },
1182
+ },
1183
+ {
1184
+ name: 'Input',
1185
+ key: 'items',
1186
+ props: {
1187
+ label: 'Items (for radio / checkbox)',
1188
+ placeholder: 'Option 1, Option 2, Option 3...',
1189
+ type: 'textarea',
1190
+ },
1191
+ },
1192
+ {
1193
+ name: 'Input',
1194
+ key: 'clearable',
1195
+ props: {
1196
+ label: 'Clearable',
1197
+ type: 'checkbox',
1198
+ },
1199
+ },
1200
+ {
1201
+ name: 'Input',
1202
+ key: 'disabled',
1203
+ props: {
1204
+ label: 'Disabled',
1205
+ type: 'checkbox',
1206
+ },
1207
+ },
1208
+ {
1209
+ name: 'Input',
1210
+ key: 'focused',
1211
+ props: {
1212
+ label: 'Auto focus',
1213
+ type: 'checkbox',
1214
+ },
1215
+ },
1216
+ {
1217
+ name: 'Input',
1218
+ key: 'error',
1219
+ props: {
1220
+ label: 'Custom error (optional)',
1221
+ placeholder: 'Static error or i18n key...',
1222
+ },
1223
+ },
1224
+ ],
1225
+ };
1226
+
1227
+ class SelectFormComponent {
1228
+ constructor() {
1229
+ this._formService = inject(FormService);
1230
+ this.templateRef = viewChild.required('templateRef');
1231
+ this.selectDefaults = selectDefaults;
1232
+ }
1233
+ ngOnInit() {
1234
+ this._formService.addTemplateComponent('Select', this.templateRef());
1235
+ }
1236
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: SelectFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1237
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.2", type: SelectFormComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-data>\r\n\t<wselect\r\n\t\t[formField]=\"data.formField\"\r\n\t\t[items]=\"data.props.items ?? selectDefaults.items\"\r\n\t\t[placeholder]=\"\r\n\t\t\tdata.props.placeholder ?? selectDefaults.placeholder\r\n\t\t\"\r\n\t\t[label]=\"data.props.label ?? selectDefaults.label\"\r\n\t\t[bindLabel]=\"data.props.bindLabel ?? selectDefaults.bindLabel\"\r\n\t\t[bindValue]=\"data.props.bindValue ?? selectDefaults.bindValue\"\r\n\t\t[multiple]=\"data.props.multiple ?? selectDefaults.multiple\"\r\n\t\t[clearable]=\"data.props.clearable ?? selectDefaults.clearable\"\r\n\t\t[searchable]=\"data.props.searchable ?? selectDefaults.searchable\"\r\n\t\t[searchableBy]=\"\r\n\t\t\tdata.props.searchableBy ?? selectDefaults.searchableBy\r\n\t\t\"\r\n\t\t[buttons]=\"data.props.buttons ?? selectDefaults.buttons\"\r\n\t\t[disabled]=\"\r\n\t\t\tdata.props.disabled === true ||\r\n\t\t\tdata.component.disabled === true\r\n\t\t\"\r\n\t\t(wChange)=\"data.props.onChange?.($event)\"\r\n\t></wselect>\r\n</ng-template>\r\n", dependencies: [{ kind: "component", type: SelectComponent, selector: "wselect", inputs: ["disabled", "clearable", "placeholder", "multiple", "bindLabel", "bindValue", "label", "searchable", "searchableBy", "items", "buttons", "formField", "field", "wModel"], outputs: ["wModelChange", "wChange"] }] }); }
1238
+ }
1239
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: SelectFormComponent, decorators: [{
1240
+ type: Component,
1241
+ args: [{ imports: [SelectComponent], template: "<ng-template #templateRef let-data>\r\n\t<wselect\r\n\t\t[formField]=\"data.formField\"\r\n\t\t[items]=\"data.props.items ?? selectDefaults.items\"\r\n\t\t[placeholder]=\"\r\n\t\t\tdata.props.placeholder ?? selectDefaults.placeholder\r\n\t\t\"\r\n\t\t[label]=\"data.props.label ?? selectDefaults.label\"\r\n\t\t[bindLabel]=\"data.props.bindLabel ?? selectDefaults.bindLabel\"\r\n\t\t[bindValue]=\"data.props.bindValue ?? selectDefaults.bindValue\"\r\n\t\t[multiple]=\"data.props.multiple ?? selectDefaults.multiple\"\r\n\t\t[clearable]=\"data.props.clearable ?? selectDefaults.clearable\"\r\n\t\t[searchable]=\"data.props.searchable ?? selectDefaults.searchable\"\r\n\t\t[searchableBy]=\"\r\n\t\t\tdata.props.searchableBy ?? selectDefaults.searchableBy\r\n\t\t\"\r\n\t\t[buttons]=\"data.props.buttons ?? selectDefaults.buttons\"\r\n\t\t[disabled]=\"\r\n\t\t\tdata.props.disabled === true ||\r\n\t\t\tdata.component.disabled === true\r\n\t\t\"\r\n\t\t(wChange)=\"data.props.onChange?.($event)\"\r\n\t></wselect>\r\n</ng-template>\r\n" }]
1242
+ }], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
1243
+
1244
+ const selectForm = {
1245
+ formId: 'select',
1246
+ title: 'Select',
1247
+ components: [
1248
+ {
1249
+ name: 'Input',
1250
+ key: 'label',
1251
+ focused: true,
1252
+ props: {
1253
+ placeholder: 'Enter select label...',
1254
+ label: 'Label',
1255
+ },
1256
+ },
1257
+ {
1258
+ name: 'Input',
1259
+ key: 'placeholder',
1260
+ props: {
1261
+ placeholder: 'Enter select placeholder...',
1262
+ label: 'Placeholder',
1263
+ },
1264
+ },
1265
+ {
1266
+ name: 'Input',
1267
+ key: 'bindLabel',
1268
+ props: {
1269
+ placeholder: 'Enter label field (e.g. name)...',
1270
+ label: 'Bind label',
1271
+ },
1272
+ },
1273
+ {
1274
+ name: 'Input',
1275
+ key: 'bindValue',
1276
+ props: {
1277
+ placeholder: 'Enter value field (e.g. _id)...',
1278
+ label: 'Bind value',
1279
+ },
1280
+ },
1281
+ {
1282
+ name: 'Input',
1283
+ key: 'items',
1284
+ props: {
1285
+ label: 'Items',
1286
+ placeholder: 'Option 1, Option 2, Option 3...',
1287
+ type: 'textarea',
1288
+ },
1289
+ },
1290
+ {
1291
+ name: 'Input',
1292
+ key: 'searchableBy',
1293
+ props: {
1294
+ label: 'Searchable by',
1295
+ placeholder: 'name email ...',
1296
+ },
1297
+ },
1298
+ {
1299
+ name: 'Input',
1300
+ key: 'multiple',
1301
+ props: {
1302
+ label: 'Multiple select',
1303
+ type: 'checkbox',
1304
+ },
1305
+ },
1306
+ {
1307
+ name: 'Input',
1308
+ key: 'clearable',
1309
+ props: {
1310
+ label: 'Clearable',
1311
+ type: 'checkbox',
1312
+ },
1313
+ },
1314
+ {
1315
+ name: 'Input',
1316
+ key: 'searchable',
1317
+ props: {
1318
+ label: 'Searchable',
1319
+ type: 'checkbox',
1320
+ },
1321
+ },
1322
+ {
1323
+ name: 'Input',
1324
+ key: 'disabled',
1325
+ props: {
1326
+ label: 'Disabled',
1327
+ type: 'checkbox',
1328
+ },
1329
+ },
1330
+ ],
1331
+ };
1332
+
1333
+ class TinymceFormComponent {
1334
+ constructor() {
1335
+ this._form = inject(FormService);
1336
+ this.templateRef = viewChild.required('templateRef');
1337
+ }
1338
+ ngOnInit() {
1339
+ this._form.addTemplateComponent('Tinymce', this.templateRef());
1340
+ }
1341
+ /** Read current value: prefer Signal Form field, fallback to raw submition. */
1342
+ getValue(data) {
1343
+ const key = data?.key ?? null;
1344
+ // Signal Forms field (preferred)
1345
+ if (data?.field) {
1346
+ try {
1347
+ const state = data.field();
1348
+ if (state?.value && typeof state.value === 'function') {
1349
+ return state.value() ?? '';
1350
+ }
1351
+ }
1352
+ catch {
1353
+ // fall through
1354
+ }
1355
+ }
1356
+ // Model signal fallback
1357
+ if (data?.model && typeof data.model === 'function' && key) {
1358
+ const current = data.model();
1359
+ return current?.[key] ?? '';
1360
+ }
1361
+ // Legacy submission object
1362
+ if (!key || !data?.submition)
1363
+ return '';
1364
+ return data.submition[key] ?? '';
1365
+ }
1366
+ /** Bridge TinyMCE -> Signal Forms (field/model) + legacy submition. */
1367
+ onValueChange(data, value) {
1368
+ const key = data.key;
1369
+ // 1) Signal Forms field (preferred)
1370
+ if (data.field) {
1371
+ try {
1372
+ const state = data.field();
1373
+ if (state?.value?.set) {
1374
+ state.value.set(value);
1375
+ }
1376
+ }
1377
+ catch {
1378
+ // ignore and fall through
1379
+ }
1380
+ }
1381
+ // 2) Fallback to model signal if present
1382
+ else if (data.model && typeof data.model.update === 'function' && key) {
1383
+ data.model.update((current) => ({
1384
+ ...current,
1385
+ [key]: value,
1386
+ }));
1387
+ }
1388
+ // 3) Legacy: mutate submition object
1389
+ else if (data.submition && key) {
1390
+ data.submition[key] = value;
1391
+ }
1392
+ // Notify wform so it can emit debounced change + keep Modal submition in sync
1393
+ if (typeof data.wChange === 'function') {
1394
+ data.wChange();
1395
+ }
1396
+ }
1397
+ // ---- Props helpers (all via component.props) -----------------------------
1398
+ getConfig(data) {
1399
+ const props = data?.props ?? {};
1400
+ const toNumber = (v) => {
1401
+ if (v === null || v === undefined || v === '')
1402
+ return undefined;
1403
+ const n = Number(v);
1404
+ return Number.isNaN(n) ? undefined : n;
1405
+ };
1406
+ // Base config from simple props
1407
+ const config = {};
1408
+ // Layout
1409
+ const height = toNumber(props['height']);
1410
+ const minHeight = toNumber(props['minHeight']);
1411
+ const maxHeight = toNumber(props['maxHeight']);
1412
+ if (height !== undefined)
1413
+ config.height = height;
1414
+ if (minHeight !== undefined)
1415
+ config.min_height = minHeight;
1416
+ if (maxHeight !== undefined)
1417
+ config.max_height = maxHeight;
1418
+ // Toggles
1419
+ if (typeof props['menubar'] === 'boolean') {
1420
+ config.menubar = props['menubar'];
1421
+ }
1422
+ if (typeof props['statusbar'] === 'boolean') {
1423
+ config.statusbar = props['statusbar'];
1424
+ }
1425
+ if (typeof props['branding'] === 'boolean') {
1426
+ config.branding = props['branding'];
1427
+ }
1428
+ if (typeof props['pasteAsText'] === 'boolean') {
1429
+ config.paste_as_text = props['pasteAsText'];
1430
+ }
1431
+ // Toolbar presets
1432
+ if (props['toolbarPreset']) {
1433
+ const preset = String(props['toolbarPreset']);
1434
+ const toolbarMap = {
1435
+ basic: 'undo redo | bold italic underline | bullist numlist | link',
1436
+ standard: 'undo redo | styles | bold italic underline | alignleft aligncenter alignright | bullist numlist | link image table',
1437
+ full: 'undo redo | styles | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | forecolor backcolor | removeformat',
1438
+ };
1439
+ if (preset !== 'custom' && toolbarMap[preset]) {
1440
+ config.toolbar = toolbarMap[preset];
1441
+ }
1442
+ }
1443
+ // Plugins presets
1444
+ if (props['pluginsPreset']) {
1445
+ const preset = String(props['pluginsPreset']);
1446
+ const pluginsMap = {
1447
+ minimal: 'lists link',
1448
+ standard: 'lists link image table code',
1449
+ media: 'lists link image media table code',
1450
+ all: 'advlist anchor autolink charmap code emoticons image link lists media searchreplace table visualblocks wordcount',
1451
+ };
1452
+ if (preset !== 'custom' && pluginsMap[preset]) {
1453
+ config.plugins = pluginsMap[preset];
1454
+ }
1455
+ }
1456
+ // Content behavior
1457
+ if (props['forceRootBlock']) {
1458
+ const value = String(props['forceRootBlock']);
1459
+ if (value === 'false') {
1460
+ config.forced_root_block = false;
1461
+ }
1462
+ else if (value === 'default') {
1463
+ // let TinyMCE decide; do not set
1464
+ }
1465
+ else {
1466
+ config.forced_root_block = value;
1467
+ }
1468
+ }
1469
+ // Uploads / assets
1470
+ if (props['imageUploadUrl']) {
1471
+ config.images_upload_url = String(props['imageUploadUrl']);
1472
+ }
1473
+ // Styling
1474
+ if (props['contentCss']) {
1475
+ config.content_css = String(props['contentCss']);
1476
+ }
1477
+ if (props['contentStyle']) {
1478
+ config.content_style = String(props['contentStyle']);
1479
+ }
1480
+ if (props['bodyClass']) {
1481
+ config.body_class = String(props['bodyClass']);
1482
+ }
1483
+ // Localization
1484
+ if (props['language']) {
1485
+ config.language = String(props['language']);
1486
+ }
1487
+ if (props['skin']) {
1488
+ config.skin = String(props['skin']);
1489
+ }
1490
+ // Raw config (object)
1491
+ const rawConfig = props['config'];
1492
+ if (rawConfig && typeof rawConfig === 'object') {
1493
+ Object.assign(config, rawConfig);
1494
+ }
1495
+ // Raw config JSON (string)
1496
+ const configJson = props['configJson'];
1497
+ if (typeof configJson === 'string' && configJson.trim()) {
1498
+ try {
1499
+ const json = JSON.parse(configJson);
1500
+ if (json && typeof json === 'object') {
1501
+ Object.assign(config, json);
1502
+ }
1503
+ }
1504
+ catch {
1505
+ // invalid JSON -> silently ignore, keep safe
1506
+ }
1507
+ }
1508
+ return config;
1509
+ }
1510
+ isDisabled(data) {
1511
+ return !!(data?.props?.['disabled'] || data?.component?.disabled);
1512
+ }
1513
+ isInline(data) {
1514
+ return data?.props?.['inline'] ?? false;
1515
+ }
1516
+ getPlaceholder(data) {
1517
+ return data?.props?.['placeholder'] ?? '';
1518
+ }
1519
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: TinymceFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1520
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.2", type: TinymceFormComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #templateRef let-data>\r\n\t<div class=\"w-tiny\" [class]=\"data.component?.class\">\r\n\t\t<tinymce\r\n\t\t\tclass=\"w-tiny__editor\"\r\n\t\t\t[ngModel]=\"getValue(data)\"\r\n\t\t\t(ngModelChange)=\"onValueChange(data, $event)\"\r\n\t\t\t[config]=\"getConfig(data)\"\r\n\t\t\t[disabled]=\"isDisabled(data)\"\r\n\t\t\t[inline]=\"isInline(data)\"\r\n\t\t\t[placeholder]=\"getPlaceholder(data)\"\r\n\t\t></tinymce>\r\n\t</div>\r\n</ng-template>\r\n", styles: [".w-tiny{width:100%;background:var(--c-bg-secondary);color:var(--c-text-primary);border:1px solid var(--c-border);border-radius:var(--radius-card);box-shadow:var(--shadow-sm);overflow:hidden;padding:var(--sp-2)}.w-tiny__editor{display:block;width:100%}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: TinymceComponent, selector: "tinymce", inputs: ["config", "placeholder", "inline", "disabled", "delay", "loading"], outputs: ["ready"], exportAs: ["ngxTinymce"] }] }); }
1521
+ }
1522
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: TinymceFormComponent, decorators: [{
1523
+ type: Component,
1524
+ args: [{ imports: [FormsModule, TinymceComponent], template: "<ng-template #templateRef let-data>\r\n\t<div class=\"w-tiny\" [class]=\"data.component?.class\">\r\n\t\t<tinymce\r\n\t\t\tclass=\"w-tiny__editor\"\r\n\t\t\t[ngModel]=\"getValue(data)\"\r\n\t\t\t(ngModelChange)=\"onValueChange(data, $event)\"\r\n\t\t\t[config]=\"getConfig(data)\"\r\n\t\t\t[disabled]=\"isDisabled(data)\"\r\n\t\t\t[inline]=\"isInline(data)\"\r\n\t\t\t[placeholder]=\"getPlaceholder(data)\"\r\n\t\t></tinymce>\r\n\t</div>\r\n</ng-template>\r\n", styles: [".w-tiny{width:100%;background:var(--c-bg-secondary);color:var(--c-text-primary);border:1px solid var(--c-border);border-radius:var(--radius-card);box-shadow:var(--shadow-sm);overflow:hidden;padding:var(--sp-2)}.w-tiny__editor{display:block;width:100%}\n"] }]
1525
+ }], propDecorators: { templateRef: [{ type: i0.ViewChild, args: ['templateRef', { isSignal: true }] }] } });
1526
+
1527
+ const tinymceForm = {
1528
+ formId: 'tinymce',
1529
+ title: 'Tinymce',
1530
+ components: [
1531
+ // UX basics
1532
+ {
1533
+ name: 'Input',
1534
+ key: 'placeholder',
1535
+ focused: true,
1536
+ props: {
1537
+ label: 'Placeholder',
1538
+ placeholder: 'Enter editor placeholder...',
1539
+ },
1540
+ },
1541
+ {
1542
+ name: 'Input',
1543
+ key: 'height',
1544
+ props: {
1545
+ label: 'Height (px)',
1546
+ placeholder: 'Example: 300',
1547
+ type: 'number',
1548
+ },
1549
+ },
1550
+ {
1551
+ name: 'Input',
1552
+ key: 'minHeight',
1553
+ props: {
1554
+ label: 'Min height (px)',
1555
+ placeholder: 'Example: 200',
1556
+ type: 'number',
1557
+ },
1558
+ },
1559
+ {
1560
+ name: 'Input',
1561
+ key: 'maxHeight',
1562
+ props: {
1563
+ label: 'Max height (px)',
1564
+ placeholder: 'Example: 600',
1565
+ type: 'number',
1566
+ },
1567
+ },
1568
+ // Toggles
1569
+ {
1570
+ name: 'Input',
1571
+ key: 'disabled',
1572
+ props: {
1573
+ label: 'Disabled',
1574
+ type: 'checkbox',
1575
+ },
1576
+ },
1577
+ {
1578
+ name: 'Input',
1579
+ key: 'inline',
1580
+ props: {
1581
+ label: 'Inline mode',
1582
+ type: 'checkbox',
1583
+ },
1584
+ },
1585
+ {
1586
+ name: 'Input',
1587
+ key: 'menubar',
1588
+ props: {
1589
+ label: 'Show menubar',
1590
+ type: 'checkbox',
1591
+ },
1592
+ },
1593
+ {
1594
+ name: 'Input',
1595
+ key: 'statusbar',
1596
+ props: {
1597
+ label: 'Show statusbar',
1598
+ type: 'checkbox',
1599
+ },
1600
+ },
1601
+ {
1602
+ name: 'Input',
1603
+ key: 'branding',
1604
+ props: {
1605
+ label: 'Show TinyMCE branding',
1606
+ type: 'checkbox',
1607
+ },
1608
+ },
1609
+ {
1610
+ name: 'Input',
1611
+ key: 'pasteAsText',
1612
+ props: {
1613
+ label: 'Paste as plain text',
1614
+ type: 'checkbox',
1615
+ },
1616
+ },
1617
+ // Toolbar / plugins presets
1618
+ {
1619
+ name: 'Select',
1620
+ key: 'toolbarPreset',
1621
+ props: {
1622
+ label: 'Toolbar preset',
1623
+ placeholder: 'Choose toolbar preset...',
1624
+ items: ['basic', 'standard', 'full', 'custom'],
1625
+ },
1626
+ },
1627
+ {
1628
+ name: 'Select',
1629
+ key: 'pluginsPreset',
1630
+ props: {
1631
+ label: 'Plugins preset',
1632
+ placeholder: 'Choose plugins preset...',
1633
+ items: ['minimal', 'standard', 'media', 'all', 'custom'],
1634
+ },
1635
+ },
1636
+ // Content behavior
1637
+ {
1638
+ name: 'Select',
1639
+ key: 'forceRootBlock',
1640
+ props: {
1641
+ label: 'Force root block',
1642
+ placeholder: 'Default (TinyMCE)',
1643
+ items: ['default', 'p', 'div', 'false'],
1644
+ },
1645
+ },
1646
+ // Uploads / assets
1647
+ {
1648
+ name: 'Input',
1649
+ key: 'imageUploadUrl',
1650
+ props: {
1651
+ label: 'Images upload URL',
1652
+ placeholder: 'https://api.example.com/upload',
1653
+ },
1654
+ },
1655
+ // Styling
1656
+ {
1657
+ name: 'Input',
1658
+ key: 'contentCss',
1659
+ props: {
1660
+ label: 'Content CSS (URL)',
1661
+ placeholder: '/assets/tinymce-content.css',
1662
+ },
1663
+ },
1664
+ {
1665
+ name: 'Input',
1666
+ key: 'contentStyle',
1667
+ props: {
1668
+ label: 'Content styles (CSS string)',
1669
+ placeholder: 'body { font-family: system-ui; }',
1670
+ type: 'textarea',
1671
+ },
1672
+ },
1673
+ {
1674
+ name: 'Input',
1675
+ key: 'bodyClass',
1676
+ props: {
1677
+ label: 'Editor body CSS class',
1678
+ placeholder: 'w-tiny-body',
1679
+ },
1680
+ },
1681
+ // Localization / skin
1682
+ {
1683
+ name: 'Input',
1684
+ key: 'language',
1685
+ props: {
1686
+ label: 'Language code',
1687
+ placeholder: 'Example: en, uk, de...',
1688
+ },
1689
+ },
1690
+ {
1691
+ name: 'Input',
1692
+ key: 'skin',
1693
+ props: {
1694
+ label: 'Skin',
1695
+ placeholder: 'Example: oxide, oxide-dark...',
1696
+ },
1697
+ },
1698
+ // Raw config escape hatch
1699
+ {
1700
+ name: 'Input',
1701
+ key: 'configJson',
1702
+ props: {
1703
+ label: 'Extra TinyMCE config (JSON)',
1704
+ placeholder: '{"menubar": false, "toolbar": "undo redo | bold italic"}',
1705
+ type: 'textarea',
1706
+ },
1707
+ },
1708
+ ],
1709
+ };
1710
+
1711
+ /* components */
1712
+ const FORM_COMPONENTS = [
1713
+ 'Input',
1714
+ 'Select',
1715
+ 'File',
1716
+ 'Button',
1717
+ 'Ace',
1718
+ 'Tinymce',
1719
+ ];
1720
+ const FORM_COMPONENT_FORM = (key) => {
1721
+ return {
1722
+ Input: inputForm,
1723
+ Select: selectForm,
1724
+ File: fileForm,
1725
+ Button: buttonForm,
1726
+ Ace: aceForm,
1727
+ Tinymce: tinymceForm,
1728
+ }[key];
1729
+ };
1730
+ /**
1731
+ * Central registry: template name → component class.
1732
+ * Names must match `component.name` in form schema (e.g. `{ name: 'Input', ... }`)
1733
+ * and what the template component passes into FormService.addTemplateComponent().
1734
+ */
1735
+ const FORM_TEMPLATE_COMPONENTS = {
1736
+ Input: InputFormComponent,
1737
+ Select: SelectFormComponent,
1738
+ File: FileFormComponent,
1739
+ Button: ButtonFormComponent,
1740
+ Ace: AceFormComponent,
1741
+ Tinymce: TinymceFormComponent,
1742
+ /* addComponents */
1743
+ };
1744
+ function registerFormTemplatesFactory(injector, appRef) {
1745
+ return () => {
1746
+ // Instantiate each template component once so their ngOnInit runs
1747
+ // and they call FormService.addTemplateComponent(name, templateRef)
1748
+ Object.values(FORM_TEMPLATE_COMPONENTS).forEach((cmp) => {
1749
+ const ref = createComponent(cmp, {
1750
+ environmentInjector: injector,
1751
+ });
1752
+ appRef.attachView(ref.hostView);
1753
+ ref.hostView.detectChanges?.();
1754
+ // no DOM insertion – purely for registration side-effects
1755
+ });
1756
+ };
1757
+ }
1758
+ const provideFormComponents = () => {
1759
+ return {
1760
+ provide: APP_INITIALIZER,
1761
+ multi: true,
1762
+ useFactory: registerFormTemplatesFactory,
1763
+ deps: [EnvironmentInjector, ApplicationRef],
1764
+ };
1765
+ };
1766
+
1767
+ const NEW_USER = {
1768
+ _id: '',
1769
+ data: {},
1770
+ is: {},
1771
+ roles: [],
1772
+ name: '',
1773
+ phone: '',
1774
+ bio: '',
1775
+ email: '',
1776
+ thumb: '',
1777
+ };
1778
+
1779
+ const createUserFormComponents = (userForm = []) => ({
1780
+ formId: 'user',
1781
+ title: 'Profile Settings',
1782
+ components: [
1783
+ {
1784
+ name: 'Input',
1785
+ key: 'name',
1786
+ focused: true,
1787
+ props: {
1788
+ placeholder: 'Enter name...',
1789
+ label: 'Name',
1790
+ },
1791
+ },
1792
+ {
1793
+ name: 'Input',
1794
+ key: 'email',
1795
+ props: {
1796
+ placeholder: 'Enter email...',
1797
+ label: 'Email',
1798
+ type: 'email',
1799
+ },
1800
+ },
1801
+ {
1802
+ name: 'Input',
1803
+ key: 'phone',
1804
+ props: {
1805
+ placeholder: 'Enter phone...',
1806
+ label: 'Phone',
1807
+ },
1808
+ },
1809
+ {
1810
+ name: 'Input',
1811
+ key: 'bio',
1812
+ props: {
1813
+ placeholder: 'Enter bio...',
1814
+ label: 'Biography',
1815
+ type: 'textarea',
1816
+ },
1817
+ },
1818
+ ...userForm,
1819
+ ],
1820
+ });
1821
+ const userFormComponentsFactory = () => {
1822
+ const config = inject(NGX_BOS_CONFIG);
1823
+ return createUserFormComponents(config.userForm);
1824
+ };
1825
+
1826
+ class UserService extends CrudService {
1827
+ role(role) {
1828
+ return !!(this.user().is || {})[role];
1829
+ }
1830
+ constructor() {
1831
+ super({
1832
+ name: 'user',
1833
+ replace: (user) => {
1834
+ user.roles = [];
1835
+ user.data = user.data || {};
1836
+ user.is = user.is || {};
1837
+ for (const field of this._bosConfig.userFields) {
1838
+ user.data[field] = user.data[field] || {};
1839
+ }
1840
+ for (const role of this.roles) {
1841
+ if (user.is[role]) {
1842
+ user.roles.push(role);
1843
+ }
1844
+ }
1845
+ return user;
1846
+ },
1847
+ });
1848
+ this._userHttpService = inject(HttpService);
1849
+ this._alertService = inject(AlertService);
1850
+ this._router = inject(Router);
1851
+ this._emitterService = inject(EmitterService);
1852
+ this._bosConfig = inject(NGX_BOS_CONFIG);
1853
+ this.url = this._bosConfig.url;
1854
+ this.roles = this._bosConfig.roles.concat(['admin']);
1855
+ this.employees = this._bosConfig.roles;
1856
+ this.users = signal(this.documents(), /* @ts-ignore */
1857
+ ...(ngDevMode ? [{ debugName: "users" }] : /* istanbul ignore next */ []));
1858
+ this.user = signal(localStorage.getItem('waw_user')
1859
+ ? JSON.parse(localStorage.getItem('waw_user'))
1860
+ : this.prepareDocument()(), /* @ts-ignore */
1861
+ ...(ngDevMode ? [{ debugName: "user" }] : /* istanbul ignore next */ []));
1862
+ this.thumb = computed(() => {
1863
+ const thumb = this.user().thumb;
1864
+ return !thumb || thumb.includes(this._bosConfig.defaultUserThumb)
1865
+ ? this._bosConfig.defaultUserThumb
1866
+ : this.url + thumb;
1867
+ }, /* @ts-ignore */
1868
+ ...(ngDevMode ? [{ debugName: "thumb" }] : /* istanbul ignore next */ []));
1869
+ this.usersByRole = computed(() => {
1870
+ const splitted = {};
1871
+ for (const user of this.documents()) {
1872
+ for (const role of user.roles || []) {
1873
+ if (role === undefined || role === null)
1874
+ continue;
1875
+ (splitted[String(role)] ??= []).push(user);
1876
+ }
1877
+ }
1878
+ return splitted;
1879
+ }, /* @ts-ignore */
1880
+ ...(ngDevMode ? [{ debugName: "usersByRole" }] : /* istanbul ignore next */ []));
1881
+ if (localStorage.getItem('waw_user')) {
1882
+ this.fetch({}, { name: 'me' }).subscribe((user) => {
1883
+ if (user) {
1884
+ if (!localStorage.getItem('waw_user') &&
1885
+ this._router.url === this._bosConfig.signPath) {
1886
+ this._router.navigateByUrl(this._bosConfig.profilePath);
1887
+ }
1888
+ this.setUser(user);
1889
+ }
1890
+ else if (localStorage.getItem('waw_user')) {
1891
+ this.logout();
1892
+ }
1893
+ });
1894
+ this.get({
1895
+ query: this._bosConfig.appId ? 'appId=' + this._bosConfig.appId : '',
1896
+ });
1897
+ }
1898
+ }
1899
+ setUser(user) {
1900
+ this.user.set(user);
1901
+ localStorage.setItem('waw_user', JSON.stringify(user));
1902
+ this._emitterService.complete('us.user');
1903
+ }
1904
+ updateMe() {
1905
+ this.setUser(this.user());
1906
+ return this.update(this.user()).subscribe(() => {
1907
+ this._alertService.info({
1908
+ text: 'Profile information has been updated',
1909
+ });
1910
+ });
1911
+ }
1912
+ updateMeAfterWhile() {
1913
+ this.setUser(this.user());
1914
+ this.updateAfterWhile(this.user());
1915
+ }
1916
+ changePassword(oldPass, newPass) {
1917
+ return this._userHttpService.post('/api/user/changePassword', {
1918
+ newPass: newPass,
1919
+ oldPass: oldPass,
1920
+ }, (resp) => {
1921
+ if (resp) {
1922
+ this._alertService.info({
1923
+ text: 'Successfully changed password',
1924
+ });
1925
+ }
1926
+ else {
1927
+ this._alertService.error({
1928
+ text: 'Incorrect current password',
1929
+ });
1930
+ }
1931
+ });
1932
+ }
1933
+ logout() {
1934
+ this.user.set(this.prepareDocument()());
1935
+ localStorage.removeItem('waw_user');
1936
+ this._userHttpService.remove('token');
1937
+ this._userHttpService.get('/api/user/logout');
1938
+ this._router.navigateByUrl(this._bosConfig.signPath);
1939
+ setTimeout(() => {
1940
+ location.reload();
1941
+ }, 100);
1942
+ }
1943
+ updateAdmin(user) {
1944
+ return this.update(user, {
1945
+ name: 'admin',
1946
+ });
1947
+ }
1948
+ deleteAdmin(user) {
1949
+ return this.delete(user, {
1950
+ name: 'admin',
1951
+ });
1952
+ }
1953
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: UserService, deps: [], target: i0.ɵɵFactoryTarget.Service }); }
1954
+ static { this.ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.0.2", ngImport: i0, type: UserService }); }
1955
+ }
1956
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: UserService, decorators: [{
1957
+ type: Service
1958
+ }], ctorParameters: () => [] });
1959
+
1960
+ const adminsGuard = () => {
1961
+ const router = inject(Router);
1962
+ const config = inject(NGX_BOS_CONFIG);
1963
+ const stored = localStorage.getItem('waw_user');
1964
+ if (!stored) {
1965
+ return router.parseUrl(config.signPath);
1966
+ }
1967
+ const user = JSON.parse(stored);
1968
+ if (user.is && user.is.admin) {
1969
+ return true;
1970
+ }
1971
+ return router.parseUrl(config.profilePath);
1972
+ };
1973
+
1974
+ const authenticatedGuard = () => {
1975
+ const router = inject(Router);
1976
+ const config = inject(NGX_BOS_CONFIG);
1977
+ if (localStorage.getItem('waw_user')) {
1978
+ return true;
1979
+ }
1980
+ return router.parseUrl(config.signPath);
1981
+ };
1982
+
1983
+ const guestGuard = () => {
1984
+ const router = inject(Router);
1985
+ const config = inject(NGX_BOS_CONFIG);
1986
+ if (localStorage.getItem('waw_user')) {
1987
+ return router.parseUrl(config.profilePath);
1988
+ }
1989
+ return true;
1990
+ };
1991
+
1992
+ class UserSelectorComponent {
1993
+ constructor() {
1994
+ this.userService = inject(UserService);
1995
+ this.value = input('', /* @ts-ignore */
1996
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
1997
+ this.onChange = output();
1998
+ }
1999
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: UserSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2000
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: UserSelectorComponent, isStandalone: true, selector: "user-selector", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChange: "onChange" }, ngImport: i0, template: "<wselect\r\n\t(wChange)=\"onChange.emit($event)\"\r\n\tplaceholder=\"Select user...\"\r\n\t[items]=\"userService.users()\"\r\n\t[wModel]=\"value()\"\r\n></wselect>\r\n", styles: [""], dependencies: [{ kind: "component", type: SelectComponent, selector: "wselect", inputs: ["disabled", "clearable", "placeholder", "multiple", "bindLabel", "bindValue", "label", "searchable", "searchableBy", "items", "buttons", "formField", "field", "wModel"], outputs: ["wModelChange", "wChange"] }] }); }
2001
+ }
2002
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: UserSelectorComponent, decorators: [{
2003
+ type: Component,
2004
+ args: [{ imports: [SelectComponent], selector: 'user-selector', template: "<wselect\r\n\t(wChange)=\"onChange.emit($event)\"\r\n\tplaceholder=\"Select user...\"\r\n\t[items]=\"userService.users()\"\r\n\t[wModel]=\"value()\"\r\n></wselect>\r\n" }]
2005
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], onChange: [{ type: i0.Output, args: ["onChange"] }] } });
2006
+
2007
+ class UserPreviewComponent {
2008
+ constructor() {
2009
+ this.userService = inject(UserService);
2010
+ this.bosConfig = inject(NGX_BOS_CONFIG);
2011
+ }
2012
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: UserPreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2013
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.2", type: UserPreviewComponent, isStandalone: true, selector: "user-preview", ngImport: i0, template: "<a\r\n\tclass=\"space__header-avatar\"\r\n\t[routerLink]=\"bosConfig.profilePath\"\r\n\taria-label=\"Profile\"\r\n>\r\n\t<img [src]=\"userService.thumb()\" alt=\"\" />\r\n</a>\r\n", styles: [".space__header-avatar{margin-inline-start:var(--sp-3);inline-size:32px;block-size:32px;border-radius:999px;overflow:hidden;display:inline-flex;cursor:pointer;text-decoration:none}.space__header-avatar:focus-visible{outline:none;box-shadow:var(--focus-ring)}.space__header-avatar img{inline-size:100%;block-size:100%;object-fit:cover;border-radius:inherit;display:block}\n"], dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }] }); }
2014
+ }
2015
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: UserPreviewComponent, decorators: [{
2016
+ type: Component,
2017
+ args: [{ selector: 'user-preview', imports: [RouterLink], template: "<a\r\n\tclass=\"space__header-avatar\"\r\n\t[routerLink]=\"bosConfig.profilePath\"\r\n\taria-label=\"Profile\"\r\n>\r\n\t<img [src]=\"userService.thumb()\" alt=\"\" />\r\n</a>\r\n", styles: [".space__header-avatar{margin-inline-start:var(--sp-3);inline-size:32px;block-size:32px;border-radius:999px;overflow:hidden;display:inline-flex;cursor:pointer;text-decoration:none}.space__header-avatar:focus-visible{outline:none;box-shadow:var(--focus-ring)}.space__header-avatar img{inline-size:100%;block-size:100%;object-fit:cover;border-radius:inherit;display:block}\n"] }]
2018
+ }] });
2019
+
2020
+ class UsersComponent extends CrudComponent {
2021
+ allowUrl() {
2022
+ return false;
2023
+ }
2024
+ async delete(doc) {
2025
+ this.userService.deleteAdmin(doc).subscribe(() => {
2026
+ this.setDocuments();
2027
+ });
2028
+ }
2029
+ constructor() {
2030
+ super(userFormComponentsFactory(), inject(FormService), inject(UserService), 'user');
2031
+ this.configType = 'local';
2032
+ this._router = inject(Router);
2033
+ this.userService = inject(UserService);
2034
+ this.roles = this._router.url.includes('admin')
2035
+ ? this.userService.roles
2036
+ : this.userService.employees;
2037
+ this.columns = ['name', 'email'];
2038
+ this.config = this.getConfig();
2039
+ this.setDocuments();
2040
+ for (const role of this.userService.roles) {
2041
+ this.columns.push(role);
2042
+ }
2043
+ }
2044
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: UsersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2045
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: UsersComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<!--==== Table Module ====-->\r\n<wtable\r\n\t[rows]=\"documents()\"\r\n\t[columns]=\"columns\"\r\n\t[config]=\"config\"\r\n\ttitle=\"Users\"\r\n>\r\n\t@for (role of roles; track role) {\r\n\t<ng-template [cell]=\"role\" let-user>\r\n\t\t<winput\r\n\t\t\t(wChange)=\"user.is[role] = $event; update(user)\"\r\n\t\t\t[wModel]=\"user.is[role]\"\r\n\t\t\ttype=\"checkbox\"\r\n\t\t/>\r\n\t</ng-template>\r\n\t}\r\n</wtable>\r\n<!-- ==================== -->\r\n", dependencies: [{ kind: "component", type: TableComponent, selector: "wtable", inputs: ["bindValue", "rows", "config", "columns", "value", "title"], outputs: ["columnsChange", "onSearch"] }, { kind: "directive", type: CellDirective, selector: "ng-template[cell]", inputs: ["cell"] }, { kind: "component", type: InputComponent, selector: "winput", inputs: ["formField", "wModel", "type", "name", "label", "placeholder", "items", "icons", "disabled", "focused", "clearable", "wClass", "autocomplete", "error"], outputs: ["wModelChange", "wChange", "wSubmit", "wBlur", "wFocus", "wKeydown"] }] }); }
2046
+ }
2047
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: UsersComponent, decorators: [{
2048
+ type: Component,
2049
+ args: [{ imports: [TableComponent, CellDirective, InputComponent], template: "<!--==== Table Module ====-->\r\n<wtable\r\n\t[rows]=\"documents()\"\r\n\t[columns]=\"columns\"\r\n\t[config]=\"config\"\r\n\ttitle=\"Users\"\r\n>\r\n\t@for (role of roles; track role) {\r\n\t<ng-template [cell]=\"role\" let-user>\r\n\t\t<winput\r\n\t\t\t(wChange)=\"user.is[role] = $event; update(user)\"\r\n\t\t\t[wModel]=\"user.is[role]\"\r\n\t\t\ttype=\"checkbox\"\r\n\t\t/>\r\n\t</ng-template>\r\n\t}\r\n</wtable>\r\n<!-- ==================== -->\r\n" }]
2050
+ }], ctorParameters: () => [] });
2051
+
2052
+ var users_component = /*#__PURE__*/Object.freeze({
2053
+ __proto__: null,
2054
+ UsersComponent: UsersComponent
2055
+ });
2056
+
2057
+ const usersRoutes = [
2058
+ {
2059
+ path: '',
2060
+ loadComponent: () => Promise.resolve().then(function () { return users_component; }).then((m) => m.UsersComponent),
2061
+ },
2062
+ ];
2063
+
2064
+ class ClientsComponent extends CrudComponent {
2065
+ allowUrl() {
2066
+ // no URL-driven filters for now, same as UsersComponent
2067
+ return false;
2068
+ }
2069
+ constructor() {
2070
+ // 'user' docType reuses existing user form components
2071
+ super(userFormComponentsFactory(), inject(FormService), inject(UserService), 'user');
2072
+ /** Use server-side pagination for clients */
2073
+ this.configType = 'server';
2074
+ /** Basic columns for clients table */
2075
+ this.columns = ['name', 'email'];
2076
+ /** wtable config built by CrudComponent, aware of server mode */
2077
+ this.config = this.getConfig();
2078
+ // fetch first page from server using CrudComponent logic
2079
+ this.setDocuments();
2080
+ }
2081
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: ClientsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2082
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.2", type: ClientsComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<!--==== Table Module ====-->\r\n<wtable\r\n\t[rows]=\"documents()\"\r\n\t[columns]=\"columns\"\r\n\t[config]=\"config\"\r\n\ttitle=\"Clients\"\r\n></wtable>\r\n<!-- ==================== -->\r\n", styles: [""], dependencies: [{ kind: "component", type: TableComponent, selector: "wtable", inputs: ["bindValue", "rows", "config", "columns", "value", "title"], outputs: ["columnsChange", "onSearch"] }] }); }
2083
+ }
2084
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: ClientsComponent, decorators: [{
2085
+ type: Component,
2086
+ args: [{ imports: [TableComponent], template: "<!--==== Table Module ====-->\r\n<wtable\r\n\t[rows]=\"documents()\"\r\n\t[columns]=\"columns\"\r\n\t[config]=\"config\"\r\n\ttitle=\"Clients\"\r\n></wtable>\r\n<!-- ==================== -->\r\n" }]
2087
+ }], ctorParameters: () => [] });
2088
+
2089
+ var clients_component = /*#__PURE__*/Object.freeze({
2090
+ __proto__: null,
2091
+ ClientsComponent: ClientsComponent
2092
+ });
2093
+
2094
+ const clientsRoutes = [
2095
+ {
2096
+ path: '',
2097
+ loadComponent: () => Promise.resolve().then(function () { return clients_component; }).then((m) => m.ClientsComponent),
2098
+ },
2099
+ ];
2100
+
2101
+ class FormComponent extends CrudComponent {
2102
+ preCreate(doc) {
2103
+ doc.formId = this.formId;
2104
+ doc.appId = this._bosConfig.appId;
2105
+ }
2106
+ allowUrl() {
2107
+ return false;
2108
+ }
2109
+ constructor(_formcomponentService, _formService) {
2110
+ super(formcomponentForm, _formService, _formcomponentService, 'user');
2111
+ this._router = inject(Router);
2112
+ this._bosConfig = inject(NGX_BOS_CONFIG);
2113
+ this.formId = this._router.url.split('form/')[1];
2114
+ this.configType = 'local';
2115
+ this.localDocumentsFilter = (doc) => {
2116
+ return doc.formId === this.formId;
2117
+ };
2118
+ /** Basic columns for clients table */
2119
+ this.columns = ['name', 'key'];
2120
+ /** wtable config built by CrudComponent, aware of server mode */
2121
+ this.config = this.getConfig();
2122
+ effect(() => {
2123
+ if (_formcomponentService.isLoaded()) {
2124
+ this.setDocuments();
2125
+ }
2126
+ });
2127
+ this.config.buttons.unshift({
2128
+ icon: 'settings',
2129
+ click: (doc) => {
2130
+ _formService.modal(FORM_COMPONENT_FORM(doc.name), {
2131
+ label: 'Update',
2132
+ click: async (updated, close) => {
2133
+ close();
2134
+ doc.props = {
2135
+ ...doc.props,
2136
+ ...updated,
2137
+ };
2138
+ _formcomponentService.update(doc);
2139
+ },
2140
+ }, doc.props || {});
2141
+ },
2142
+ });
2143
+ }
2144
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FormComponent, deps: [{ token: i1$1.FormcomponentService }, { token: i1$1.FormService }], target: i0.ɵɵFactoryTarget.Component }); }
2145
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.2", type: FormComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<!--==== Table Module ====-->\r\n<wtable\r\n\t[rows]=\"documents()\"\r\n\t[columns]=\"columns\"\r\n\t[config]=\"config\"\r\n\ttitle=\"Forms\"\r\n>\r\n</wtable>\r\n<!-- ==================== -->\r\n", dependencies: [{ kind: "component", type: TableComponent, selector: "wtable", inputs: ["bindValue", "rows", "config", "columns", "value", "title"], outputs: ["columnsChange", "onSearch"] }] }); }
2146
+ }
2147
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FormComponent, decorators: [{
2148
+ type: Component,
2149
+ args: [{ imports: [TableComponent], template: "<!--==== Table Module ====-->\r\n<wtable\r\n\t[rows]=\"documents()\"\r\n\t[columns]=\"columns\"\r\n\t[config]=\"config\"\r\n\ttitle=\"Forms\"\r\n>\r\n</wtable>\r\n<!-- ==================== -->\r\n" }]
2150
+ }], ctorParameters: () => [{ type: i1$1.FormcomponentService }, { type: i1$1.FormService }] });
2151
+
2152
+ var form_component = /*#__PURE__*/Object.freeze({
2153
+ __proto__: null,
2154
+ FormComponent: FormComponent
2155
+ });
2156
+
2157
+ const formRoutes = [
2158
+ {
2159
+ path: '',
2160
+ loadComponent: () => Promise.resolve().then(function () { return form_component; }).then((m) => m.FormComponent),
2161
+ },
2162
+ ];
2163
+
2164
+ class FormsComponent {
2165
+ constructor() {
2166
+ this._formService = inject(FormService);
2167
+ this._bosConfig = inject(NGX_BOS_CONFIG);
2168
+ this.columns = ['formId', 'title'];
2169
+ this.config = {
2170
+ buttons: [
2171
+ {
2172
+ icon: 'edit',
2173
+ click: (form) => {
2174
+ this._formService.modal(formForm, {
2175
+ label: 'Update',
2176
+ click: async (updated, close) => {
2177
+ close();
2178
+ if (form._id) {
2179
+ this._formService.update(updated);
2180
+ }
2181
+ else {
2182
+ this._formService.create({
2183
+ ...updated,
2184
+ appId: this._bosConfig.appId,
2185
+ });
2186
+ }
2187
+ },
2188
+ }, form);
2189
+ },
2190
+ },
2191
+ {
2192
+ icon: 'build',
2193
+ hrefFunc: (form) => {
2194
+ return '/admin/form/' + form.formId;
2195
+ },
2196
+ },
2197
+ ],
2198
+ };
2199
+ this.documents = signal([], /* @ts-ignore */
2200
+ ...(ngDevMode ? [{ debugName: "documents" }] : /* istanbul ignore next */ []));
2201
+ effect(() => {
2202
+ const byFormId = this._formService.getFieldSignals('formId')();
2203
+ this.documents.set(this._formService.formIds().map((formId) => {
2204
+ return {
2205
+ formId,
2206
+ ...(byFormId[formId]?.length
2207
+ ? byFormId[formId][0]()
2208
+ : {}),
2209
+ };
2210
+ }));
2211
+ });
2212
+ }
2213
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FormsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2214
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.2", type: FormsComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<!--==== Table Module ====-->\r\n<wtable\r\n\t[rows]=\"documents()\"\r\n\t[columns]=\"columns\"\r\n\t[config]=\"config\"\r\n\ttitle=\"Forms\"\r\n>\r\n</wtable>\r\n<!-- ==================== -->\r\n", dependencies: [{ kind: "component", type: TableComponent, selector: "wtable", inputs: ["bindValue", "rows", "config", "columns", "value", "title"], outputs: ["columnsChange", "onSearch"] }] }); }
2215
+ }
2216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: FormsComponent, decorators: [{
2217
+ type: Component,
2218
+ args: [{ imports: [TableComponent], template: "<!--==== Table Module ====-->\r\n<wtable\r\n\t[rows]=\"documents()\"\r\n\t[columns]=\"columns\"\r\n\t[config]=\"config\"\r\n\ttitle=\"Forms\"\r\n>\r\n</wtable>\r\n<!-- ==================== -->\r\n" }]
2219
+ }], ctorParameters: () => [] });
2220
+
2221
+ var forms_component = /*#__PURE__*/Object.freeze({
2222
+ __proto__: null,
2223
+ FormsComponent: FormsComponent
2224
+ });
2225
+
2226
+ const formsRoutes = [
2227
+ {
2228
+ path: '',
2229
+ loadComponent: () => Promise.resolve().then(function () { return forms_component; }).then((m) => m.FormsComponent),
2230
+ },
2231
+ ];
2232
+
2233
+ class SpiderComponent {
2234
+ constructor() {
2235
+ this.width = input('', /* @ts-ignore */
2236
+ ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
2237
+ this.height = input('', /* @ts-ignore */
2238
+ ...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
2239
+ this.start = input('', /* @ts-ignore */
2240
+ ...(ngDevMode ? [{ debugName: "start" }] : /* istanbul ignore next */ []));
2241
+ this.end = input('', /* @ts-ignore */
2242
+ ...(ngDevMode ? [{ debugName: "end" }] : /* istanbul ignore next */ []));
2243
+ }
2244
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: SpiderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2245
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: SpiderComponent, isStandalone: true, selector: "icon-spider", inputs: { width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, start: { classPropertyName: "start", publicName: "start", isSignal: true, isRequired: false, transformFunction: null }, end: { classPropertyName: "end", publicName: "end", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.--spider-w": "width", "style.--spider-h": "height", "style.--spider-start": "start", "style.--spider-end": "end" }, classAttribute: "spider" }, ngImport: i0, template: "<svg\r\n\tpreserveAspectRatio=\"xMidYMid meet\"\r\n\txmlns=\"http://www.w3.org/2000/svg\"\r\n\tviewBox=\"0 0 72 84\"\r\n\tclass=\"spider__svg\"\r\n\tfill=\"none\"\r\n>\r\n\t<path\r\n\t\td=\"M29.7441 38.2845C29.7441 38.2845 31.8474 35.0824 33.6034 33.46C35.2166 31.9737 35.9191 31.6079 36.0232 31.5575C36.1314 31.6079 36.8298 31.9737 38.443 33.46C40.1991 35.0824 42.3025 38.2845 42.3025 38.2845C42.3025 38.2845 47.196 35.9266 47.196 29.1802C47.196 22.4337 42.8736 18.9516 42.8736 18.9516C47.9679 27.7872 43.1013 33.2694 43.1013 33.2694C43.1013 33.2694 42.1364 33.1137 40.3998 31.0165C39.0996 29.5517 37.6333 28.246 36.031 27.126V27.1064V27.126C34.4245 28.2391 32.953 29.5384 31.6468 30.9971C29.9139 33.0942 28.9452 33.2498 28.9452 33.2498C28.9452 33.2498 24.0746 27.7679 29.1691 18.9321C29.1691 18.9321 24.8504 22.3948 24.8504 29.1607C24.8504 35.9266 29.7441 38.2845 29.7441 38.2845Z\"\r\n\t\tfill=\"url(#paint0_linear_5_30)\"\r\n\t/>\r\n\t<path\r\n\t\td=\"M31.1333 41.3775C30.7938 44.101 32.322 45.2097 32.322 45.2097C32.3393 44.5685 32.4233 43.9308 32.5729 43.3072C32.7736 42.7159 33.8967 41.3618 35.0583 41.3618H36.988C38.1459 41.3618 39.2727 42.7003 39.4772 43.3072C39.6241 43.9312 39.707 44.5688 39.7242 45.2097C39.7242 45.2097 41.268 44.101 40.9167 41.3775C40.5965 38.8135 36.5132 35.3236 36.0464 34.9306V34.8917H36.0232H36V34.9306C35.533 35.3236 31.4499 38.8135 31.1333 41.3775Z\"\r\n\t\tfill=\"url(#paint1_linear_5_30)\"\r\n\t/>\r\n\t<path\r\n\t\td=\"M43.2673 45.91C42.5186 47.5046 41.2429 48.7867 39.6587 49.5362C39.6587 49.5362 36.2085 44.7117 36.0386 44.5639V44.5406V44.5639C35.8688 44.7117 32.4224 49.5362 32.4224 49.5362C30.8254 48.7934 29.5365 47.5106 28.7792 45.91C27.6832 43.3578 28.7792 40.0742 28.7792 40.0742C27.8222 40.9534 25.823 45.91 28.0074 49.7775C28.644 50.9108 29.5247 51.8858 30.5848 52.6305C31.6448 53.3753 32.857 53.8708 34.1322 54.0805C34.1322 54.0805 33.395 52.9756 34.0125 51.1587C34.3557 50.1073 35.0716 49.2207 36.0232 48.6687C36.9748 49.2207 37.6907 50.1073 38.034 51.1587C38.6552 52.9756 37.9143 54.0805 37.9143 54.0805C39.1933 53.8718 40.4095 53.3761 41.473 52.6299C42.5364 51.8838 43.4201 50.9063 44.0583 49.7696C46.2235 45.879 44.2244 40.9456 43.2866 40.0663C43.2673 40.0742 44.3827 43.3578 43.2673 45.91Z\"\r\n\t\tfill=\"url(#paint2_linear_5_30)\"\r\n\t/>\r\n\t<path\r\n\t\td=\"M18.7064 30.4135C19.2274 31.2189 25.8191 39.9729 25.8191 39.9729C25.8191 39.9729 27.1042 37.4868 25.9232 36.0005C24.7424 34.5144 21.5507 30.3474 20.9486 29.363C20.4509 28.4918 20.1627 27.515 20.1073 26.5111C20.034 25.6902 19.0767 14.6757 19.0767 14.6757C19.8965 11.6482 21.2001 8.77554 22.9362 6.17063C24.3439 4.00548 25.9018 1.94346 27.5982 0C27.5982 0 23.0403 3.23317 20.4314 7.2717C18.8838 9.64045 17.6645 12.2114 16.8074 14.913C16.8074 14.913 17.4134 24.6125 17.5407 26.5189C17.5809 27.8983 17.9831 29.2421 18.7064 30.4135Z\"\r\n\t\tfill=\"url(#paint3_linear_5_30)\"\r\n\t/>\r\n\t<path\r\n\t\td=\"M19.0923 59.368C19.0923 59.368 19.0923 57.6639 20.1227 54.7848C21.1531 51.9056 24.7539 45.416 24.7539 45.416L25.0279 40.8056L24.3139 39.8095C24.3139 39.8095 19.096 37.7863 16.9811 36.6464C14.8663 35.5064 14.3105 35.1952 14.3105 35.1952C13.5116 33.6583 12.8328 32.0608 12.2805 30.4174C11.1922 27.3555 10.7599 25.9625 10.7599 25.9625C10.5214 22.9704 10.4609 19.9668 10.5785 16.9673C10.7599 11.781 11.0301 10.1158 11.0301 10.1158C11.0301 10.1158 9.72946 12.0067 9.15056 16.4031C8.57166 20.7996 8.44816 26.2622 8.44816 26.2622L11.7054 36.6152C11.7054 36.6152 14.407 38.4827 17.9074 40.4204C19.0234 41.0646 20.2047 41.5863 21.431 41.9767L12.4464 43.3735L3.91342 50.7658C2.51875 53.6073 1.48155 56.6135 0.825943 59.7142C-0.277831 64.9084 0.0540732 70.581 0.0540732 70.581C0.0540732 70.581 1.39713 64.9084 2.99104 59.8194C4.58495 54.7304 5.95501 52.3647 5.95501 52.3647L13.6737 46.3343L19.787 45.7468L15.0708 57.8078C15.0708 57.8078 15.0283 59.3641 15.7037 62.8657C16.3792 66.3673 19.266 75.67 19.266 75.67L26.6296 84L27.3397 83.8715L21.7822 74.6156L19.0923 59.368Z\"\r\n\t\tfill=\"url(#paint4_linear_5_30)\"\r\n\t/>\r\n\t<path\r\n\t\td=\"M52.923 14.6757C52.923 14.6757 51.9659 25.6786 51.8888 26.5111C51.8333 27.515 51.5451 28.4918 51.0475 29.363C50.4492 30.3513 47.2537 34.5105 46.0728 36.0005C44.8918 37.4907 46.1769 39.9729 46.1769 39.9729C46.1769 39.9729 52.7725 31.2189 53.2936 30.4135C54.0144 29.2429 54.4139 27.9002 54.4514 26.5228C54.5826 24.6164 55.1886 14.9169 55.1886 14.9169C54.3296 12.216 53.1105 9.64533 51.5646 7.27559C48.9596 3.23317 44.4017 0 44.4017 0C46.1041 1.94244 47.6672 4.00452 49.0791 6.17063C50.8088 8.7772 52.1069 11.6496 52.923 14.6757Z\"\r\n\t\tfill=\"url(#paint5_linear_5_30)\"\r\n\t/>\r\n\t<path\r\n\t\td=\"M71.1821 59.7027C70.5274 56.6015 69.4902 53.5952 68.0945 50.7541L59.5576 43.3617L50.5576 41.9689C51.7828 41.5784 52.9627 41.0566 54.0774 40.4126C57.5932 38.4673 60.2833 36.6075 60.2833 36.6075L63.5366 26.2544C63.5366 26.2544 63.4132 20.8074 62.8343 16.3992C62.2554 11.9911 60.9779 10.1158 60.9779 10.1158C60.9779 10.1158 61.248 11.7771 61.4295 16.9634C61.5448 19.9628 61.4841 22.9665 61.248 25.9586C61.248 25.9586 60.8081 27.3516 59.7313 30.4135C59.179 32.0569 58.5003 33.6544 57.7014 35.1913C57.7014 35.1913 57.1456 35.4986 55.0307 36.6425C52.9158 37.7863 47.6979 39.8056 47.6979 39.8056L46.9839 40.8017L47.2541 45.4121C47.2541 45.4121 50.8664 51.9017 51.8853 54.7808C52.9041 57.66 52.9158 59.3641 52.9158 59.3641L50.2142 74.6117L44.6528 83.8715L45.3629 84L52.7305 75.6778C52.7305 75.6778 55.6134 66.3868 56.2927 62.8735C56.972 59.3603 56.9256 57.8156 56.9256 57.8156L52.2094 45.7544L58.3189 46.3419L66.0375 52.3725C66.0375 52.3725 67.4115 54.738 69.0054 59.8272C70.5993 64.9162 71.9423 70.5888 71.9423 70.5888C71.9423 70.5888 72.2896 64.8967 71.1821 59.7027Z\"\r\n\t\tfill=\"url(#paint6_linear_5_30)\"\r\n\t/>\r\n\t<defs>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint0_linear_5_30\"\r\n\t\t\tx1=\"36.0232\"\r\n\t\t\ty1=\"18.9321\"\r\n\t\t\tx2=\"36.0232\"\r\n\t\t\ty2=\"38.2845\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint1_linear_5_30\"\r\n\t\t\tx1=\"36.0264\"\r\n\t\t\ty1=\"34.8917\"\r\n\t\t\tx2=\"36.0264\"\r\n\t\t\ty2=\"45.2097\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint2_linear_5_30\"\r\n\t\t\tx1=\"36.0264\"\r\n\t\t\ty1=\"40.0663\"\r\n\t\t\tx2=\"36.0264\"\r\n\t\t\ty2=\"54.0805\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint3_linear_5_30\"\r\n\t\t\tx1=\"22.2029\"\r\n\t\t\ty1=\"0\"\r\n\t\t\tx2=\"22.2029\"\r\n\t\t\ty2=\"39.9729\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint4_linear_5_30\"\r\n\t\t\tx1=\"13.6735\"\r\n\t\t\ty1=\"10.1158\"\r\n\t\t\tx2=\"13.6735\"\r\n\t\t\ty2=\"84\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint5_linear_5_30\"\r\n\t\t\tx1=\"49.7951\"\r\n\t\t\ty1=\"0\"\r\n\t\t\tx2=\"49.7951\"\r\n\t\t\ty2=\"39.9729\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint6_linear_5_30\"\r\n\t\t\tx1=\"58.3234\"\r\n\t\t\ty1=\"10.1158\"\r\n\t\t\tx2=\"58.3234\"\r\n\t\t\ty2=\"84\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t</defs>\r\n</svg>\r\n", styles: [".spider{--spider-w: 100%;--spider-h: auto;display:inline-block;inline-size:var(--spider-w);block-size:var(--spider-h);line-height:0}.spider__svg{display:block;inline-size:100%;block-size:100%;max-inline-size:100%;max-block-size:100%;aspect-ratio:72/84}\n"] }); }
2246
+ }
2247
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: SpiderComponent, decorators: [{
2248
+ type: Component,
2249
+ args: [{ selector: 'icon-spider', host: {
2250
+ class: 'spider',
2251
+ '[style.--spider-w]': 'width',
2252
+ '[style.--spider-h]': 'height',
2253
+ '[style.--spider-start]': 'start',
2254
+ '[style.--spider-end]': 'end',
2255
+ }, template: "<svg\r\n\tpreserveAspectRatio=\"xMidYMid meet\"\r\n\txmlns=\"http://www.w3.org/2000/svg\"\r\n\tviewBox=\"0 0 72 84\"\r\n\tclass=\"spider__svg\"\r\n\tfill=\"none\"\r\n>\r\n\t<path\r\n\t\td=\"M29.7441 38.2845C29.7441 38.2845 31.8474 35.0824 33.6034 33.46C35.2166 31.9737 35.9191 31.6079 36.0232 31.5575C36.1314 31.6079 36.8298 31.9737 38.443 33.46C40.1991 35.0824 42.3025 38.2845 42.3025 38.2845C42.3025 38.2845 47.196 35.9266 47.196 29.1802C47.196 22.4337 42.8736 18.9516 42.8736 18.9516C47.9679 27.7872 43.1013 33.2694 43.1013 33.2694C43.1013 33.2694 42.1364 33.1137 40.3998 31.0165C39.0996 29.5517 37.6333 28.246 36.031 27.126V27.1064V27.126C34.4245 28.2391 32.953 29.5384 31.6468 30.9971C29.9139 33.0942 28.9452 33.2498 28.9452 33.2498C28.9452 33.2498 24.0746 27.7679 29.1691 18.9321C29.1691 18.9321 24.8504 22.3948 24.8504 29.1607C24.8504 35.9266 29.7441 38.2845 29.7441 38.2845Z\"\r\n\t\tfill=\"url(#paint0_linear_5_30)\"\r\n\t/>\r\n\t<path\r\n\t\td=\"M31.1333 41.3775C30.7938 44.101 32.322 45.2097 32.322 45.2097C32.3393 44.5685 32.4233 43.9308 32.5729 43.3072C32.7736 42.7159 33.8967 41.3618 35.0583 41.3618H36.988C38.1459 41.3618 39.2727 42.7003 39.4772 43.3072C39.6241 43.9312 39.707 44.5688 39.7242 45.2097C39.7242 45.2097 41.268 44.101 40.9167 41.3775C40.5965 38.8135 36.5132 35.3236 36.0464 34.9306V34.8917H36.0232H36V34.9306C35.533 35.3236 31.4499 38.8135 31.1333 41.3775Z\"\r\n\t\tfill=\"url(#paint1_linear_5_30)\"\r\n\t/>\r\n\t<path\r\n\t\td=\"M43.2673 45.91C42.5186 47.5046 41.2429 48.7867 39.6587 49.5362C39.6587 49.5362 36.2085 44.7117 36.0386 44.5639V44.5406V44.5639C35.8688 44.7117 32.4224 49.5362 32.4224 49.5362C30.8254 48.7934 29.5365 47.5106 28.7792 45.91C27.6832 43.3578 28.7792 40.0742 28.7792 40.0742C27.8222 40.9534 25.823 45.91 28.0074 49.7775C28.644 50.9108 29.5247 51.8858 30.5848 52.6305C31.6448 53.3753 32.857 53.8708 34.1322 54.0805C34.1322 54.0805 33.395 52.9756 34.0125 51.1587C34.3557 50.1073 35.0716 49.2207 36.0232 48.6687C36.9748 49.2207 37.6907 50.1073 38.034 51.1587C38.6552 52.9756 37.9143 54.0805 37.9143 54.0805C39.1933 53.8718 40.4095 53.3761 41.473 52.6299C42.5364 51.8838 43.4201 50.9063 44.0583 49.7696C46.2235 45.879 44.2244 40.9456 43.2866 40.0663C43.2673 40.0742 44.3827 43.3578 43.2673 45.91Z\"\r\n\t\tfill=\"url(#paint2_linear_5_30)\"\r\n\t/>\r\n\t<path\r\n\t\td=\"M18.7064 30.4135C19.2274 31.2189 25.8191 39.9729 25.8191 39.9729C25.8191 39.9729 27.1042 37.4868 25.9232 36.0005C24.7424 34.5144 21.5507 30.3474 20.9486 29.363C20.4509 28.4918 20.1627 27.515 20.1073 26.5111C20.034 25.6902 19.0767 14.6757 19.0767 14.6757C19.8965 11.6482 21.2001 8.77554 22.9362 6.17063C24.3439 4.00548 25.9018 1.94346 27.5982 0C27.5982 0 23.0403 3.23317 20.4314 7.2717C18.8838 9.64045 17.6645 12.2114 16.8074 14.913C16.8074 14.913 17.4134 24.6125 17.5407 26.5189C17.5809 27.8983 17.9831 29.2421 18.7064 30.4135Z\"\r\n\t\tfill=\"url(#paint3_linear_5_30)\"\r\n\t/>\r\n\t<path\r\n\t\td=\"M19.0923 59.368C19.0923 59.368 19.0923 57.6639 20.1227 54.7848C21.1531 51.9056 24.7539 45.416 24.7539 45.416L25.0279 40.8056L24.3139 39.8095C24.3139 39.8095 19.096 37.7863 16.9811 36.6464C14.8663 35.5064 14.3105 35.1952 14.3105 35.1952C13.5116 33.6583 12.8328 32.0608 12.2805 30.4174C11.1922 27.3555 10.7599 25.9625 10.7599 25.9625C10.5214 22.9704 10.4609 19.9668 10.5785 16.9673C10.7599 11.781 11.0301 10.1158 11.0301 10.1158C11.0301 10.1158 9.72946 12.0067 9.15056 16.4031C8.57166 20.7996 8.44816 26.2622 8.44816 26.2622L11.7054 36.6152C11.7054 36.6152 14.407 38.4827 17.9074 40.4204C19.0234 41.0646 20.2047 41.5863 21.431 41.9767L12.4464 43.3735L3.91342 50.7658C2.51875 53.6073 1.48155 56.6135 0.825943 59.7142C-0.277831 64.9084 0.0540732 70.581 0.0540732 70.581C0.0540732 70.581 1.39713 64.9084 2.99104 59.8194C4.58495 54.7304 5.95501 52.3647 5.95501 52.3647L13.6737 46.3343L19.787 45.7468L15.0708 57.8078C15.0708 57.8078 15.0283 59.3641 15.7037 62.8657C16.3792 66.3673 19.266 75.67 19.266 75.67L26.6296 84L27.3397 83.8715L21.7822 74.6156L19.0923 59.368Z\"\r\n\t\tfill=\"url(#paint4_linear_5_30)\"\r\n\t/>\r\n\t<path\r\n\t\td=\"M52.923 14.6757C52.923 14.6757 51.9659 25.6786 51.8888 26.5111C51.8333 27.515 51.5451 28.4918 51.0475 29.363C50.4492 30.3513 47.2537 34.5105 46.0728 36.0005C44.8918 37.4907 46.1769 39.9729 46.1769 39.9729C46.1769 39.9729 52.7725 31.2189 53.2936 30.4135C54.0144 29.2429 54.4139 27.9002 54.4514 26.5228C54.5826 24.6164 55.1886 14.9169 55.1886 14.9169C54.3296 12.216 53.1105 9.64533 51.5646 7.27559C48.9596 3.23317 44.4017 0 44.4017 0C46.1041 1.94244 47.6672 4.00452 49.0791 6.17063C50.8088 8.7772 52.1069 11.6496 52.923 14.6757Z\"\r\n\t\tfill=\"url(#paint5_linear_5_30)\"\r\n\t/>\r\n\t<path\r\n\t\td=\"M71.1821 59.7027C70.5274 56.6015 69.4902 53.5952 68.0945 50.7541L59.5576 43.3617L50.5576 41.9689C51.7828 41.5784 52.9627 41.0566 54.0774 40.4126C57.5932 38.4673 60.2833 36.6075 60.2833 36.6075L63.5366 26.2544C63.5366 26.2544 63.4132 20.8074 62.8343 16.3992C62.2554 11.9911 60.9779 10.1158 60.9779 10.1158C60.9779 10.1158 61.248 11.7771 61.4295 16.9634C61.5448 19.9628 61.4841 22.9665 61.248 25.9586C61.248 25.9586 60.8081 27.3516 59.7313 30.4135C59.179 32.0569 58.5003 33.6544 57.7014 35.1913C57.7014 35.1913 57.1456 35.4986 55.0307 36.6425C52.9158 37.7863 47.6979 39.8056 47.6979 39.8056L46.9839 40.8017L47.2541 45.4121C47.2541 45.4121 50.8664 51.9017 51.8853 54.7808C52.9041 57.66 52.9158 59.3641 52.9158 59.3641L50.2142 74.6117L44.6528 83.8715L45.3629 84L52.7305 75.6778C52.7305 75.6778 55.6134 66.3868 56.2927 62.8735C56.972 59.3603 56.9256 57.8156 56.9256 57.8156L52.2094 45.7544L58.3189 46.3419L66.0375 52.3725C66.0375 52.3725 67.4115 54.738 69.0054 59.8272C70.5993 64.9162 71.9423 70.5888 71.9423 70.5888C71.9423 70.5888 72.2896 64.8967 71.1821 59.7027Z\"\r\n\t\tfill=\"url(#paint6_linear_5_30)\"\r\n\t/>\r\n\t<defs>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint0_linear_5_30\"\r\n\t\t\tx1=\"36.0232\"\r\n\t\t\ty1=\"18.9321\"\r\n\t\t\tx2=\"36.0232\"\r\n\t\t\ty2=\"38.2845\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint1_linear_5_30\"\r\n\t\t\tx1=\"36.0264\"\r\n\t\t\ty1=\"34.8917\"\r\n\t\t\tx2=\"36.0264\"\r\n\t\t\ty2=\"45.2097\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint2_linear_5_30\"\r\n\t\t\tx1=\"36.0264\"\r\n\t\t\ty1=\"40.0663\"\r\n\t\t\tx2=\"36.0264\"\r\n\t\t\ty2=\"54.0805\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint3_linear_5_30\"\r\n\t\t\tx1=\"22.2029\"\r\n\t\t\ty1=\"0\"\r\n\t\t\tx2=\"22.2029\"\r\n\t\t\ty2=\"39.9729\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint4_linear_5_30\"\r\n\t\t\tx1=\"13.6735\"\r\n\t\t\ty1=\"10.1158\"\r\n\t\t\tx2=\"13.6735\"\r\n\t\t\ty2=\"84\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint5_linear_5_30\"\r\n\t\t\tx1=\"49.7951\"\r\n\t\t\ty1=\"0\"\r\n\t\t\tx2=\"49.7951\"\r\n\t\t\ty2=\"39.9729\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t\t<linearGradient\r\n\t\t\tid=\"paint6_linear_5_30\"\r\n\t\t\tx1=\"58.3234\"\r\n\t\t\ty1=\"10.1158\"\r\n\t\t\tx2=\"58.3234\"\r\n\t\t\ty2=\"84\"\r\n\t\t\tgradientUnits=\"userSpaceOnUse\"\r\n\t\t>\r\n\t\t\t<stop stop-color=\"#F6C93C\" />\r\n\t\t\t<stop offset=\"1\" stop-color=\"#A79F1E\" />\r\n\t\t</linearGradient>\r\n\t</defs>\r\n</svg>\r\n", styles: [".spider{--spider-w: 100%;--spider-h: auto;display:inline-block;inline-size:var(--spider-w);block-size:var(--spider-h);line-height:0}.spider__svg{display:block;inline-size:100%;block-size:100%;max-inline-size:100%;max-block-size:100%;aspect-ratio:72/84}\n"] }]
2256
+ }], propDecorators: { width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], start: [{ type: i0.Input, args: [{ isSignal: true, alias: "start", required: false }] }], end: [{ type: i0.Input, args: [{ isSignal: true, alias: "end", required: false }] }] } });
2257
+
2258
+ class PhonePipe {
2259
+ transform(value, country = 'US') {
2260
+ const raw = String(value ?? '').trim();
2261
+ if (!raw)
2262
+ return '';
2263
+ const phone = parsePhoneNumberFromString(raw, country);
2264
+ return phone ? phone.formatInternational() : raw;
2265
+ }
2266
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: PhonePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
2267
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.0.2", ngImport: i0, type: PhonePipe, isStandalone: true, name: "phone" }); }
2268
+ }
2269
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: PhonePipe, decorators: [{
2270
+ type: Pipe,
2271
+ args: [{ name: 'phone' }]
2272
+ }] });
2273
+
2274
+ /*
2275
+ * Public API surface for @wawjs/ngx-bos.
2276
+ *
2277
+ * Reusable BOS contracts and services will be exported here as code moves from
2278
+ * the source app into the package.
2279
+ */
2280
+ const NGX_BOS_VERSION = '22.0.0';
2281
+
2282
+ /**
2283
+ * Generated bundle index. Do not edit.
2284
+ */
2285
+
2286
+ export { ClientsComponent, DEFAULT_NGX_BOS_CONFIG, FORM_COMPONENTS, FORM_COMPONENT_FORM, FORM_TEMPLATE_COMPONENTS, FileComponent, FileSelectorComponent, FileService, FilesComponent, FormComponent, FormsComponent, NEW_USER, NGX_BOS_CONFIG, NGX_BOS_VERSION, PhonePipe, SpiderComponent, UserPreviewComponent, UserSelectorComponent, UserService, UsersComponent, adminsGuard, authenticatedGuard, clientsRoutes, createUserFormComponents, fileDefaults, fileToDataUrl, filesRoutes, formRoutes, formsRoutes, guestGuard, ngxBosProvide, provideFormComponents, provideNgxBos, resizeImageToBounds, userFormComponentsFactory, usersRoutes };
2287
+ //# sourceMappingURL=wawjs-ngx-bos.mjs.map