@acorex/layout 16.20.14 → 16.22.2

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.
@@ -1,1207 +1,1572 @@
1
- import { __decorate, __metadata } from 'tslib';
2
- import * as i0 from '@angular/core';
3
- import { EventEmitter, Injectable, ViewChild, ChangeDetectionStrategy, ViewEncapsulation, Component, ViewContainerRef, HostBinding, Input, Output, ViewChildren, NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
4
- import * as i1 from '@acorex/components';
5
- import { propertyEditor, AXBasePopupPageComponent, AXValidationFormComponent, AXPropertyDecorators, AXProperyEditorComponent, AXProppertyEditorModule, AXSearchBoxModule, AXLoadingModule, AXPageModule, AXToolbarModule, AXLabelModule, AXTextAreaModule, AXFieldsetModule, AXTextBoxModule, AXFormGroupModule, AXTabStripModule, AXCheckBoxModule, AXMenuModule, AXValidationModule, AXNumberBoxModule } from '@acorex/components';
6
- import * as i1$1 from '@acorex/core';
7
- import { AXHtmlUtil, AXTranslator, AXObjectUtil, AXClientRec, AXTranslatorModule } from '@acorex/core';
8
- import { Subject } from 'rxjs';
9
- import { debounceTime } from 'rxjs/operators';
10
- import { CommonModule } from '@angular/common';
11
- import * as i1$2 from '@angular/router';
12
- import { RouterModule } from '@angular/router';
13
- import { FormsModule } from '@angular/forms';
14
-
15
- // @dynamic
16
- // TODO: Add Angular decorator.
17
- class AXWidgetComponent {
18
- uid = AXHtmlUtil.getUID();
19
- provideValue;
20
- onBusyChanged = new EventEmitter();
21
- _isBusy = true;
22
- get isBusy() {
23
- return this._isBusy;
24
- }
25
- set isBusy(v) {
26
- if (v !== this._isBusy) {
27
- const eventData = {
28
- component: this,
29
- oldValue: this._isBusy,
30
- value: v
31
- };
32
- this._isBusy = v;
33
- this.onBusyChanged.emit(eventData);
34
- }
35
- }
36
- widgetSize;
37
- refreshRate = [{
38
- id: 60000 * 5,
39
- text: AXTranslator.get('dateTime.duration.format_minute').replace('{0}', '5')
40
- }];
41
- // ???
42
- getRefreshRate() {
43
- return Array.isArray(this.refreshRate) && this.refreshRate.length ? this.refreshRate[0].id : this.refreshRate;
44
- }
45
- intervalId;
46
- constructor() {
47
- this.onConfiguredChanged.subscribe(() => {
48
- if (this.isConfigured === true && this.getRefreshRate()) {
49
- this.restartRefreshTimer();
50
- }
51
- else {
52
- this.stopRefreshTimer();
53
- }
54
- });
55
- }
56
- startRefreshTimer() {
57
- this.intervalId = window.setInterval(this.refresh.bind(this), this.getRefreshRate());
58
- }
59
- stopRefreshTimer() {
60
- window.clearInterval(this.intervalId);
61
- }
62
- restartRefreshTimer() {
63
- this.stopRefreshTimer();
64
- this.startRefreshTimer();
65
- }
66
- ngOnDestroy() {
67
- this.stopRefreshTimer();
68
- }
69
- redraw() {
70
- }
71
- refresh() {
72
- this.restartRefreshTimer();
73
- }
74
- onConfiguredChanged = new EventEmitter();
75
- get isConfigured() {
76
- return true;
77
- }
78
- setValue(name, value) {
79
- this[name] = value;
80
- this.onConfiguredChanged.emit();
81
- }
82
- getValue(name) {
83
- const val = this[name];
84
- const config = this['__meta__'].config;
85
- const runtime = config.props[name]?.runtime;
86
- if (runtime && this.provideValue) {
87
- const res = this.provideValue({
88
- name,
89
- value: val,
90
- uniqueName: config.uniqueName,
91
- options: config.options,
92
- });
93
- if (this.provideValue instanceof Promise) {
94
- return res;
95
- }
96
- else {
97
- return Promise.resolve(res);
98
- }
99
- }
100
- return Promise.resolve(val);
101
- }
102
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
103
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetComponent });
104
- }
105
- __decorate([
106
- propertyEditor({
107
- editorClass: 'ax/editors/widget-size',
108
- title: 'common.size',
109
- visible: false,
110
- order: -99,
111
- }),
112
- __metadata("design:type", Array)
113
- ], AXWidgetComponent.prototype, "widgetSize", void 0);
114
- __decorate([
115
- propertyEditor({
116
- editorClass: 'ax/editors/select',
117
- title: 'common.refresh-rate',
118
- visible: true,
119
- order: -98,
120
- editorOptions: {
121
- items: () => {
122
- return ['بدون مقدار', 1, 2, 3, 5, 10, 20, 30, 60].map(c => ({
123
- id: typeof (c) === 'number' ? 60000 * c : 0,
124
- text: typeof (c) === 'number' ? AXTranslator.get('dateTime.duration.format_minute').replace('{0}', c.toString()) : c
125
- }));
126
- },
127
- allowNull: false,
128
- allowSearch: false,
129
- selectionDataMode: 'value',
130
- selectionMode: 'single',
131
- valueField: 'id',
132
- }
133
- }),
134
- __metadata("design:type", Object)
135
- ], AXWidgetComponent.prototype, "refreshRate", void 0);
136
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetComponent, decorators: [{
137
- type: Injectable
138
- }], ctorParameters: () => [], propDecorators: { widgetSize: [], refreshRate: [] } });
139
-
140
- class AXWidgetConfigComponent extends AXBasePopupPageComponent {
141
- cdr;
142
- form;
143
- constructor(cdr) {
144
- super();
145
- this.cdr = cdr;
146
- }
147
- widget;
148
- props = [];
149
- displayProps = [];
150
- changes = [];
151
- context = {};
152
- getFooterButtons() {
153
- return [
154
- {
155
- name: 'okay',
156
- submitBehavior: true,
157
- text: AXTranslator.get('common.confirm'),
158
- style: 'success'
159
- },
160
- {
161
- name: 'cancel',
162
- cancelBehavior: true,
163
- text: AXTranslator.get('common.cancel'),
164
- style: 'danger blank'
165
- }
166
- ];
167
- }
168
- onFooterButtonClick(e) {
169
- if (e.name === 'cancel') {
170
- this.close();
171
- }
172
- if (e.name === 'okay') {
173
- this.form.validate().then(c => {
174
- if (c.result) {
175
- this.close(this.changes);
176
- }
177
- });
178
- }
179
- }
180
- handleValueChange(e) {
181
- const prop = this.changes.find(c => c.property.name === e.property.name);
182
- if (prop) {
183
- prop.value = e.value;
184
- }
185
- else {
186
- this.changes.push({ property: e.property, value: e.value });
187
- }
188
- this.updateContext();
189
- }
190
- ngOnInit() {
191
- this.displayProps = this.props.filter(c => c.property.visible !== false).sort((a, b) => a.property.order - b.property.order);
192
- this.updateContext();
193
- }
194
- updateContext() {
195
- const ctx = {};
196
- this.props.forEach(p => {
197
- ctx[p.property.name] = p.value;
198
- });
199
- this.changes.forEach(p => {
200
- ctx[p.property.name] = p.value;
201
- });
202
- this.context = ctx;
203
- }
204
- identify(index, item) {
205
- return item.property.name;
206
- }
207
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetConfigComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
208
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.3", type: AXWidgetConfigComponent, isStandalone: false, selector: "ng-component", viewQueries: [{ propertyName: "form", first: true, predicate: AXValidationFormComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<ax-page>\n <ax-page-content>\n <div class=\"container\">\n <ax-validation-form #form>\n @for (p of displayProps; track identify($index, p)) {\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-label>{{p.property.title | trans}}</ax-label>\n <ng-container ax-property-editor-renderer [property]=\"p\" [context]=\"context\" [host]=\"widget\" [validationForm]=\"form\"\n (onValueChange)=\"handleValueChange($event)\">\n </ng-container>\n </div>\n </div>\n }\n </ax-validation-form>\n </div>\n </ax-page-content>\n</ax-page>", dependencies: [{ kind: "directive", type: i1.AXPropertyEditorRendererDirective, selector: "[ax-property-editor-renderer]", inputs: ["property", "validationForm", "context", "host", "groupId"], outputs: ["onValueChange"] }, { kind: "component", type: i1.AXPageContentComponent, selector: "ax-page-content" }, { kind: "component", type: i1.AXPageComponent, selector: "ax-page" }, { kind: "component", type: i1.AXLabelComponent, selector: "ax-label", inputs: ["size"], outputs: ["clickLabel"] }, { kind: "component", type: i1.AXValidationFormComponent, selector: "ax-validation-form", inputs: ["validateOn"], outputs: ["onInit"] }, { kind: "pipe", type: i1$1.AXTranslatorPipe, name: "trans" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
209
- }
210
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetConfigComponent, decorators: [{
211
- type: Component,
212
- args: [{ encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<ax-page>\n <ax-page-content>\n <div class=\"container\">\n <ax-validation-form #form>\n @for (p of displayProps; track identify($index, p)) {\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-label>{{p.property.title | trans}}</ax-label>\n <ng-container ax-property-editor-renderer [property]=\"p\" [context]=\"context\" [host]=\"widget\" [validationForm]=\"form\"\n (onValueChange)=\"handleValueChange($event)\">\n </ng-container>\n </div>\n </div>\n }\n </ax-validation-form>\n </div>\n </ax-page-content>\n</ax-page>" }]
213
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { form: [{
214
- type: ViewChild,
215
- args: [AXValidationFormComponent]
216
- }] } });
217
-
218
- class AXWidgetSaveComponent extends AXBasePopupPageComponent {
219
- config;
220
- props = [];
221
- displayProps;
222
- data;
223
- getFooterButtons() {
224
- return [
225
- {
226
- name: 'okay',
227
- submitBehavior: true,
228
- text: AXTranslator.get('common.confirm'),
229
- style: 'ax success'
230
- },
231
- {
232
- name: 'cancel',
233
- cancelBehavior: true,
234
- text: AXTranslator.get('common.cancel'),
235
- style: 'ax light'
236
- }
237
- ];
238
- }
239
- ngOnInit() {
240
- const titleProp = this.props.find(c => c.property.name === 'title' || c.property.name === 'name');
241
- const title = titleProp?.value || this.config.title;
242
- const pp = {};
243
- this.props?.forEach(c => {
244
- pp[c.property.name] = c.property;
245
- });
246
- this.data = {
247
- component: this.config.component,
248
- title,
249
- uniqueName: `${this.config.uniqueName}-${AXHtmlUtil.getUID()}`,
250
- options: AXObjectUtil.deepJSONClone(this.config.options),
251
- props: AXObjectUtil.deepJSONClone(pp)
252
- };
253
- this.displayProps = this.props
254
- .filter(c => c.property.visible !== false)
255
- .sort((a, b) => a.property.order - b.property.order)
256
- .map(c => ({
257
- name: c.property.name,
258
- title: c.property.title,
259
- allow: true
260
- }));
261
- }
262
- onFooterButtonClick(e) {
263
- if (e.name === 'cancel') {
264
- this.close();
265
- }
266
- if (e.name === 'okay') {
267
- this.props.forEach(p => {
268
- const pp = this.displayProps.find(c => c.name === p.property.name);
269
- if (pp == null || !pp.allow) {
270
- let ppp = this.data.props[p.property.name];
271
- if (ppp) {
272
- ppp.visible = false;
273
- }
274
- else {
275
- ppp = { visible: false };
276
- }
277
- }
278
- });
279
- this.close(this.data);
280
- }
281
- }
282
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetSaveComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
283
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.3", type: AXWidgetSaveComponent, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<ax-page>\n <ax-page-content>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.title' | trans}}</ax-label>\n <ax-text-box [(value)]=\"data.title\"></ax-text-box>\n </ax-form-group>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.description' | trans}}</ax-label>\n <ax-text-area [(value)]=\"data.description\"></ax-text-area>\n </ax-form-group>\n </div>\n </div>\n <!-- <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.uniquename' | trans}}</ax-label>\n <ax-text-box></ax-text-box>\n </ax-form-group>\n </div>\n </div> -->\n <div class=\"row\" style=\"margin-block-end: var(--ax-size-md);margin-block-start: var(--ax-size-md);\">\n <div class=\"col-12\">\n <ax-fieldset caption=\"{{'widget-board.configurable-props' | trans}}\">\n @for (prop of displayProps; track prop) {\n <div class=\"row\">\n <div class=\"col-12\" style=\"margin-block-end: var(--ax-size-sm)\">\n <ax-check-box [(value)]=\"prop.allow\" label=\"{{ prop.title | trans }}\">\n </ax-check-box>\n </div>\n </div>\n }\n </ax-fieldset>\n </div>\n </div>\n </div>\n</ax-page-content>\n</ax-page>", dependencies: [{ kind: "component", type: i1.AXPageContentComponent, selector: "ax-page-content" }, { kind: "component", type: i1.AXPageComponent, selector: "ax-page" }, { kind: "component", type: i1.AXLabelComponent, selector: "ax-label", inputs: ["size"], outputs: ["clickLabel"] }, { kind: "component", type: i1.AXTextAreaComponent, selector: "ax-text-area", inputs: ["rows", "cols", "maxLength"], outputs: ["onBlur", "onFocus"] }, { kind: "component", type: i1.AXFieldsetComponent, selector: "ax-fieldset", inputs: ["size", "caption", "allowCollapse"] }, { kind: "component", type: i1.AXTextBoxComponent, selector: "ax-text-box", inputs: ["mask", "showMask", "type", "maxLength", "maskGuid", "maskPlaceholder", "maskKeepCharPositions", "leadZeroDateTime"] }, { kind: "component", type: i1.AXFormGroupComponent, selector: "ax-form-group", inputs: ["size", "labelMode"], outputs: ["labelModeChange"] }, { kind: "component", type: i1.AXCheckBoxComponent, selector: "ax-check-box", inputs: ["readonly", "disabled", "size", "label", "tabIndex", "indeterminate", "value"], outputs: ["onValueChanged", "valueChange", "onClick"] }, { kind: "pipe", type: i1$1.AXTranslatorPipe, name: "trans" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
284
- }
285
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetSaveComponent, decorators: [{
286
- type: Component,
287
- args: [{ encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<ax-page>\n <ax-page-content>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.title' | trans}}</ax-label>\n <ax-text-box [(value)]=\"data.title\"></ax-text-box>\n </ax-form-group>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.description' | trans}}</ax-label>\n <ax-text-area [(value)]=\"data.description\"></ax-text-area>\n </ax-form-group>\n </div>\n </div>\n <!-- <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.uniquename' | trans}}</ax-label>\n <ax-text-box></ax-text-box>\n </ax-form-group>\n </div>\n </div> -->\n <div class=\"row\" style=\"margin-block-end: var(--ax-size-md);margin-block-start: var(--ax-size-md);\">\n <div class=\"col-12\">\n <ax-fieldset caption=\"{{'widget-board.configurable-props' | trans}}\">\n @for (prop of displayProps; track prop) {\n <div class=\"row\">\n <div class=\"col-12\" style=\"margin-block-end: var(--ax-size-sm)\">\n <ax-check-box [(value)]=\"prop.allow\" label=\"{{ prop.title | trans }}\">\n </ax-check-box>\n </div>\n </div>\n }\n </ax-fieldset>\n </div>\n </div>\n </div>\n</ax-page-content>\n</ax-page>" }]
288
- }] });
289
-
290
- class AXWidgetHostComponent {
291
- ref;
292
- componentFactoryResolver;
293
- rendererService;
294
- cdr;
295
- popup;
296
- loadingService;
297
- _widget;
298
- get widget() {
299
- return this._widget;
300
- }
301
- _hasProps = false;
302
- _hasMenu = false;
303
- provideValue;
304
- get element() {
305
- return this.ref.nativeElement;
306
- }
307
- configMenuItem = [
308
- {
309
- icon: 'far fa-ellipsis-h',
310
- items: []
311
- }
312
- ];
313
- onRemove = new EventEmitter();
314
- onConfigChanged = new EventEmitter();
315
- onResized = new EventEmitter();
316
- onSave = new EventEmitter();
317
- config;
318
- vc;
319
- readonly = false;
320
- componentRef;
321
- //private isLoading: boolean = true;
322
- // get isBusy() {
323
- // return this._widget?.isBusy || this.isLoading;
324
- // }
325
- _loadingId;
326
- _isLoading = false;
327
- get isLoading() {
328
- return this._isLoading;
329
- }
330
- set isLoading(v) {
331
- this._isLoading = v;
332
- if (this._loadingId && !v) {
333
- this.loadingService.hide(this._loadingId);
334
- this._loadingId = null;
335
- }
336
- if (v) {
337
- // this._loadingId = this.loadingService.show(this.ref.nativeElement);
338
- }
339
- }
340
- get isConfigured() {
341
- return this._widget?.isConfigured || false;
342
- }
343
- constructor(ref, componentFactoryResolver, rendererService, cdr, popup, loadingService) {
344
- this.ref = ref;
345
- this.componentFactoryResolver = componentFactoryResolver;
346
- this.rendererService = rendererService;
347
- this.cdr = cdr;
348
- this.popup = popup;
349
- this.loadingService = loadingService;
350
- }
351
- ngOnInit() {
352
- // this.isLoading = true;
353
- }
354
- async ngAfterViewInit() {
355
- let component;
356
- if (typeof this.config.component === 'string') {
357
- const route = await this.rendererService.findLoadedComponentByRoute(this.config.component, 20);
358
- component = route?.component;
359
- }
360
- else if (typeof this.config.component === 'function') {
361
- component = this.config.component;
362
- }
363
- if (component == null) {
364
- console.error(`Invalid Widget Component!`, this.config);
365
- this.onRemove.emit(this);
366
- return;
367
- }
368
- const widgetFactory = this.componentFactoryResolver.resolveComponentFactory(component);
369
- this.componentRef = this.vc.createComponent(widgetFactory);
370
- this._widget = this.componentRef.instance;
371
- this._widget.provideValue = this.provideValue;
372
- if (this._widget.onBusyChanged) {
373
- this._widget.onBusyChanged.subscribe((d) => {
374
- if (!this._widget.widgetSize) {
375
- this._widget.setValue('widgetSize', [this.sizeX, this.sizeY]);
376
- }
377
- else {
378
- this.setSizeFromOptions();
379
- }
380
- // this.isLoading = d.value;
381
- this.cdr.detectChanges();
382
- });
383
- }
384
- if (this._widget.onConfiguredChanged) {
385
- this._widget.onConfiguredChanged.subscribe(() => {
386
- this.setSizeFromOptions();
387
- });
388
- }
389
- //
390
- if (this.config.options) {
391
- Object.assign(this._widget, this.config.options);
392
- }
393
- this._hasProps = AXPropertyDecorators.getProperties(this._widget).length > 0;
394
- this.isLoading = false;
395
- this.config['__meta__'].instance = this;
396
- this._widget['__meta__'] = {};
397
- this._widget['__meta__'].config = this.config;
398
- //
399
- this.configMenuItem[0].items.push({
400
- name: 'refresh',
401
- icon: 'far fa-undo',
402
- text: AXTranslator.get('common.refresh'),
403
- onClick: () => {
404
- this?.widget?.refresh();
405
- }
406
- });
407
- //
408
- if (this._hasProps) {
409
- this.configMenuItem[0].items.push({
410
- name: 'configs',
411
- icon: 'far fa-cogs',
412
- text: AXTranslator.get('common.configs'),
413
- onClick: () => {
414
- this.openConfigDialog();
415
- }
416
- });
417
- }
418
- this.configMenuItem[0].items.push({
419
- name: 'save',
420
- icon: 'far fa-save',
421
- text: AXTranslator.get('common.save-as'),
422
- onClick: () => {
423
- this.openSaveDialog();
424
- }
425
- });
426
- if (true) {
427
- this.configMenuItem[0].items.push({
428
- name: 'remove',
429
- icon: 'far fa-times',
430
- style: 'ax danger blank',
431
- text: AXTranslator.get('common.remove'),
432
- onClick: () => {
433
- this.onRemove.emit(this);
434
- }
435
- });
436
- }
437
- this._hasMenu = this.configMenuItem[0].items.length > 0;
438
- this.cdr.detectChanges();
439
- }
440
- sizeX = 1;
441
- sizeY = 1;
442
- col = 1;
443
- row = 1;
444
- setSizeFromOptions() {
445
- this._widget.getValue('widgetSize').then(c => {
446
- const oldSizeX = this.sizeX;
447
- const oldSizeY = this.sizeY;
448
- if (c && Array.isArray(c) && (oldSizeX !== c[0] || oldSizeY !== c[1])) {
449
- this.config.sizeX = this.sizeX = c[0];
450
- this.config.sizeY = this.sizeY = c[1];
451
- this.onResized.emit({
452
- component: this._widget,
453
- config: this.config
454
- });
455
- }
456
- this.cdr.detectChanges();
457
- });
458
- }
459
- remove(e) {
460
- e.preventDefault();
461
- e.stopPropagation();
462
- if (!this.readonly)
463
- this.onRemove.emit(this);
464
- return false;
465
- }
466
- handleConfig(e) {
467
- e.preventDefault();
468
- e.stopPropagation();
469
- if (!this.readonly)
470
- this.openConfigDialog();
471
- return false;
472
- }
473
- openConfigDialog() {
474
- const ppp = this.getMergedProps();
475
- this.popup.open(AXWidgetConfigComponent, {
476
- title: AXTranslator.get('common.configs'),
477
- size: 'sm',
478
- data: {
479
- props: ppp.map(c => ({ property: c.options, value: this._widget[c.options.name] })),
480
- widget: this.widget
481
- }
482
- }).then(c => {
483
- if (c.data) {
484
- if (!this.config.options) {
485
- this.config.options = {};
486
- }
487
- c.data.forEach(p => {
488
- this._widget.setValue(p.property.name, p.value);
489
- this.config.options[p.property.name] = p.value;
490
- });
491
- this.emitConfigChanged();
492
- this._widget.redraw();
493
- this.cdr.detectChanges();
494
- }
495
- });
496
- }
497
- openSaveDialog() {
498
- const ppp = this.getMergedProps();
499
- this.popup.open(AXWidgetSaveComponent, {
500
- title: AXTranslator.get('common.save-as'),
501
- size: 'sm',
502
- data: {
503
- config: this.config,
504
- props: ppp.map(c => ({ property: c.options, value: this._widget[c.options.name] }))
505
- }
506
- }).then(c => {
507
- if (c.data) {
508
- this.onSave.emit({
509
- component: this._widget,
510
- data: c.data
511
- });
512
- }
513
- });
514
- }
515
- handleOptionClick(e) {
516
- e.preventDefault();
517
- e.stopPropagation();
518
- this.openConfigDialog();
519
- return false;
520
- }
521
- ngOnDestroy() {
522
- this.vc.clear();
523
- if (this.componentRef) {
524
- this.componentRef.destroy();
525
- }
526
- }
527
- getMergedProps() {
528
- const ppp = AXObjectUtil.deepCopy(AXPropertyDecorators.getProperties(this._widget));
529
- for (const key in this.config.props) {
530
- if (Object.prototype.hasOwnProperty.call(this.config.props, key)) {
531
- const newP = this.config.props[key];
532
- const existPropDec = ppp.find(p => p.property === key);
533
- if (existPropDec) {
534
- Object.assign(existPropDec.options, newP);
535
- }
536
- }
537
- }
538
- return ppp;
539
- }
540
- emitConfigChanged() {
541
- this.onConfigChanged.emit({
542
- component: this._widget,
543
- config: this.config
544
- });
545
- }
546
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetHostComponent, deps: [{ token: i0.ElementRef }, { token: i0.ComponentFactoryResolver }, { token: i1$1.AXRenderService }, { token: i0.ChangeDetectorRef }, { token: i1.AXPopupService }, { token: i1.AXLoadingService }], target: i0.ɵɵFactoryTarget.Component });
547
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.3", type: AXWidgetHostComponent, isStandalone: false, selector: "ax-widget-host", inputs: { provideValue: "provideValue", config: "config", readonly: "readonly", sizeX: "sizeX", sizeY: "sizeY", col: "col", row: "row" }, outputs: { onRemove: "onRemove", onConfigChanged: "onConfigChanged", onResized: "onResized", onSave: "onSave" }, host: { attributes: { "tabindex": "0" }, properties: { "attr.data-size-x": "this.sizeX", "attr.data-size-y": "this.sizeY", "attr.data-col": "this.col", "attr.data-row": "this.row" }, classAttribute: "ax widget-host" }, viewQueries: [{ propertyName: "vc", first: true, predicate: ["vc"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div class='widget-container'>\n @if (!isConfigured) {\n <div class=\"widget-config-overlay\" (click)=\"handleConfig($event)\">\n <div class=\"widget-title\">{{config.title}}</div>\n <div class=\"widget-config-box\">\n <div class=\"config-title\">{{ 'widget-board.configure' | trans}}</div>\n @if (!readonly) {\n <div class=\"config-icon\"><i class=\"fas fa-cogs fa-5x\" aria-hidden=\"true\"></i></div>\n }\n </div>\n </div>\n }\n <div class='widget-edit-overlay' >\n <div class='widget-edit-menu'>\n @if (_hasProps) {\n <button class=\"widget-edit-menu-button\" (click)=\"handleConfig($event)\"\n (mousedown)=\"$event.stopPropagation()\" (mouseup)=\"$event.stopPropagation()\">\n <i class=\"far fa-cogs\" aria-hidden=\"true\"></i>\n </button>\n }\n <button class=\"widget-edit-menu-button\" (click)=\"remove($event)\" (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\">\n <i class=\"far fa-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n </div>\n @if (_hasMenu && !readonly) {\n <div class=\"widget-options-menu\" >\n <ax-menu [items]='configMenuItem' direction=\"horizontal\"></ax-menu>\n </div>\n }\n <!-- <ax-loading-panel [visible]=\"isBusy\">\n</ax-loading-panel> -->\n<div class=\"widget-content\">\n <ng-container #vc></ng-container>\n</div>\n</div>", dependencies: [{ kind: "component", type: i1.AXMenuComponent, selector: "ax-menu", inputs: ["menuTemplate", "rtl", "size", "selection", "mode", "target", "floatAlignment", "floatPlacemnet", "direction", "items"], outputs: ["onItemClick"] }, { kind: "pipe", type: i1$1.AXTranslatorPipe, name: "trans" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
548
- }
549
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetHostComponent, decorators: [{
550
- type: Component,
551
- args: [{ selector: 'ax-widget-host', host: { class: 'ax widget-host', tabindex: '0' }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class='widget-container'>\n @if (!isConfigured) {\n <div class=\"widget-config-overlay\" (click)=\"handleConfig($event)\">\n <div class=\"widget-title\">{{config.title}}</div>\n <div class=\"widget-config-box\">\n <div class=\"config-title\">{{ 'widget-board.configure' | trans}}</div>\n @if (!readonly) {\n <div class=\"config-icon\"><i class=\"fas fa-cogs fa-5x\" aria-hidden=\"true\"></i></div>\n }\n </div>\n </div>\n }\n <div class='widget-edit-overlay' >\n <div class='widget-edit-menu'>\n @if (_hasProps) {\n <button class=\"widget-edit-menu-button\" (click)=\"handleConfig($event)\"\n (mousedown)=\"$event.stopPropagation()\" (mouseup)=\"$event.stopPropagation()\">\n <i class=\"far fa-cogs\" aria-hidden=\"true\"></i>\n </button>\n }\n <button class=\"widget-edit-menu-button\" (click)=\"remove($event)\" (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\">\n <i class=\"far fa-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n </div>\n @if (_hasMenu && !readonly) {\n <div class=\"widget-options-menu\" >\n <ax-menu [items]='configMenuItem' direction=\"horizontal\"></ax-menu>\n </div>\n }\n <!-- <ax-loading-panel [visible]=\"isBusy\">\n</ax-loading-panel> -->\n<div class=\"widget-content\">\n <ng-container #vc></ng-container>\n</div>\n</div>" }]
552
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i1$1.AXRenderService }, { type: i0.ChangeDetectorRef }, { type: i1.AXPopupService }, { type: i1.AXLoadingService }], propDecorators: { provideValue: [{
553
- type: Input
554
- }], onRemove: [{
555
- type: Output
556
- }], onConfigChanged: [{
557
- type: Output
558
- }], onResized: [{
559
- type: Output
560
- }], onSave: [{
561
- type: Output
562
- }], config: [{
563
- type: Input
564
- }], vc: [{
565
- type: ViewChild,
566
- args: ['vc', { read: ViewContainerRef }]
567
- }], readonly: [{
568
- type: Input
569
- }], sizeX: [{
570
- type: HostBinding,
571
- args: ['attr.data-size-x']
572
- }, {
573
- type: Input
574
- }], sizeY: [{
575
- type: HostBinding,
576
- args: ['attr.data-size-y']
577
- }, {
578
- type: Input
579
- }], col: [{
580
- type: HostBinding,
581
- args: ['attr.data-col']
582
- }, {
583
- type: Input
584
- }], row: [{
585
- type: HostBinding,
586
- args: ['attr.data-row']
587
- }, {
588
- type: Input
589
- }] } });
590
-
591
- class AXWidgetBoardComponent {
592
- ref;
593
- zone;
594
- cdr;
595
- container;
596
- widgetHosts;
597
- widgets = [];
598
- galleryItems = [];
599
- tileSize = 80;
600
- gapSize = 5;
601
- readonly = false;
602
- newWidget = null;
603
- rtl;
604
- _isInEditing = false;
605
- isInEditing() {
606
- return this._isInEditing;
607
- }
608
- isDragging = false;
609
- dragItem;
610
- saveSubject = new Subject();
611
- provideValue;
612
- DATA_COL = 'data-col';
613
- DATA_ROW = 'data-row';
614
- DATA_SIZE_X = 'data-size-x';
615
- DATA_SIZE_Y = 'data-size-y';
616
- DATA_OLD_COL = 'data-old-col';
617
- DATA_OLD_ROW = 'data-old-row';
618
- onConfigChanged = new EventEmitter();
619
- onWidgetSave = new EventEmitter();
620
- constructor(ref, zone, cdr) {
621
- this.ref = ref;
622
- this.zone = zone;
623
- this.cdr = cdr;
624
- }
625
- ngOnInit() {
626
- if (this.rtl == null) {
627
- this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue('direction') === 'rtl';
628
- }
629
- this.saveSubject.pipe(debounceTime(750)).subscribe((value) => {
630
- this.emitConfigChanged(value);
631
- });
632
- }
633
- ngOnDestroy() {
634
- this.saveSubject?.unsubscribe();
635
- }
636
- ngAfterViewInit() {
637
- this.zone.runOutsideAngular((c) => {
638
- const style = document.createElement('style');
639
- style.type = 'text/css';
640
- this.ref.nativeElement.appendChild(style);
641
- // add css data classes
642
- for (let i = 1; i <= 50; i++) {
643
- style.innerHTML += `[${this.DATA_COL}="${i}"] { ${this.rtl ? 'right' : 'left'}: ${(i - 1) * (this.tileSize + this.gapSize)}px; }`;
644
- style.innerHTML += `[${this.DATA_ROW}="${i}"] { top: ${(i - 1) * (this.tileSize + this.gapSize)}px; }`;
645
- style.innerHTML += `[${this.DATA_SIZE_X}="${i}"] { width: ${(i * this.tileSize) + ((i - 1) * this.gapSize)}px; }`;
646
- style.innerHTML += `[${this.DATA_SIZE_Y}="${i}"] { height: ${(i * this.tileSize) + ((i - 1) * this.gapSize)}px; }`;
647
- }
648
- });
649
- }
650
- calcGridSize() {
651
- this.zone.runOutsideAngular(() => {
652
- const width = (Math.max(...this.widgets.map((c) => c.col + c.sizeX - 1))) * (this.tileSize + this.gapSize);
653
- const height = (Math.max(...this.widgets.map((c) => c.row + c.sizeY - 1))) * (this.tileSize + this.gapSize);
654
- this.container.nativeElement.style.width = width + 'px';
655
- this.container.nativeElement.style.height = height + 'px';
656
- });
657
- }
658
- toggleEdit() {
659
- this._isInEditing ? this.finishEdit() : this.startEdit();
660
- }
661
- dragStart(e) {
662
- e.preventDefault();
663
- e.stopPropagation();
664
- this.zone.runOutsideAngular(() => {
665
- if (this._isInEditing && e.which === 1) {
666
- this.dragItem = e.currentTarget;
667
- this.dragItem.setAttribute('data-x-offset', (this.dragItem.offsetLeft - e.clientX).toString());
668
- //
669
- this.dragItem.setAttribute('data-y-offset', (this.dragItem.offsetTop - e.clientY).toString());
670
- this.dragItem.classList.add('widget-dragging');
671
- this.dragItem.classList.remove('animate__animated', 'animate__pulse');
672
- }
673
- });
674
- return false;
675
- }
676
- removePositionData() {
677
- this.zone.runOutsideAngular(() => {
678
- if (this.dragItem && this._isInEditing && this.dragItem.getAttribute(this.DATA_OLD_COL) == null) {
679
- this.dragItem.setAttribute(this.DATA_OLD_COL, this.dragItem.getAttribute(this.DATA_COL));
680
- this.dragItem.setAttribute(this.DATA_OLD_ROW, this.dragItem.getAttribute(this.DATA_ROW));
681
- this.dragItem.removeAttribute(this.DATA_COL);
682
- this.dragItem.removeAttribute(this.DATA_ROW);
683
- }
684
- });
685
- }
686
- resetPositionData() {
687
- this.zone.runOutsideAngular(() => {
688
- if (this.dragItem && this._isInEditing) {
689
- this.setPosition(this.dragItem, this.dragItem.getAttribute(this.DATA_OLD_COL), this.dragItem.getAttribute(this.DATA_OLD_ROW));
690
- }
691
- });
692
- }
693
- setPosition(element, col, row) {
694
- this.zone.runOutsideAngular(() => {
695
- element.setAttribute(this.DATA_COL, col);
696
- element.setAttribute(this.DATA_ROW, row);
697
- element.removeAttribute(this.DATA_OLD_COL);
698
- element.removeAttribute(this.DATA_OLD_ROW);
699
- element.style.removeProperty('top');
700
- element.style.removeProperty('left');
701
- const widget = this.widgets.find(c => c['__meta__'].instance.element === element);
702
- widget.col = Number(col);
703
- widget.row = Number(row);
704
- });
705
- }
706
- drag(e) {
707
- e.preventDefault();
708
- e.stopPropagation();
709
- this.zone.runOutsideAngular(() => {
710
- if (this.dragItem && this._isInEditing) {
711
- this.isDragging = true;
712
- this.addPlaceholder();
713
- const xOffset = Number(this.dragItem.getAttribute('data-x-offset'));
714
- const yOffset = Number(this.dragItem.getAttribute('data-y-offset'));
715
- this.dragItem.style.left = e.clientX + xOffset + 'px';
716
- this.dragItem.style.top = e.clientY + yOffset + 'px';
717
- //
718
- this.detectBestPlacement();
719
- this.removePositionData();
720
- }
721
- });
722
- return false;
723
- }
724
- dragEnd(e) {
725
- this.zone.runOutsideAngular(() => {
726
- if (this.dragItem && this._isInEditing && this.isDragging) {
727
- this.dragItem.classList.remove('widget-dragging');
728
- this.dragItem.classList.add('animate__animated', 'animate__pulse');
729
- //
730
- const p = this.container.nativeElement.querySelector('.widget-blank-placeholder');
731
- if (this.newWidget) {
732
- const w = {
733
- uniqueName: this.newWidget.uniqueName,
734
- component: this.newWidget.component,
735
- title: this.newWidget.title,
736
- options: this.newWidget.options,
737
- sizeX: this.newWidget.sizeX,
738
- sizeY: this.newWidget.sizeY,
739
- col: Number(p.getAttribute(this.DATA_COL)),
740
- row: Number(p.getAttribute(this.DATA_ROW))
741
- };
742
- this.widgets.push(w);
743
- this.newWidget = null;
744
- this.container.nativeElement.removeChild(this.dragItem);
745
- this.zone.run(() => {
746
- this.cdr.detectChanges();
747
- this.calcGridSize();
748
- setTimeout(() => {
749
- w['__meta__'].instance.element.addEventListener('mousedown', this.dragStart.bind(this), false);
750
- }, 1000);
751
- });
752
- }
753
- else {
754
- if (p) {
755
- this.setPosition(this.dragItem, p.getAttribute(this.DATA_COL), p.getAttribute(this.DATA_ROW));
756
- }
757
- else {
758
- this.setPosition(this.dragItem, this.dragItem.getAttribute(this.DATA_OLD_COL), this.dragItem.getAttribute(this.DATA_OLD_ROW));
759
- }
760
- }
761
- //
762
- this.removePlaceholder();
763
- this.dragItem = null;
764
- this.calcGridSize();
765
- this.saveSubject.next('config');
766
- }
767
- this.isDragging = false;
768
- });
769
- }
770
- detectFirstEmptySlot(w) {
771
- const xTile = Math.floor(this.ref.nativeElement.parentElement.offsetWidth / this.tileSize);
772
- for (let j = 1; j <= 100; j++) {
773
- for (let i = 1; i <= xTile - w.sizeX; i++) {
774
- const rec = new AXClientRec({
775
- left: i,
776
- top: j,
777
- width: w.sizeX,
778
- height: w.sizeY
779
- });
780
- const el = this.widgets.filter(c => c !== w).find((c) => rec.intersect({
781
- left: c.col,
782
- top: c.row,
783
- width: c.sizeX,
784
- height: c.sizeY
785
- }));
786
- if (el == null) {
787
- w.col = i;
788
- w.row = j;
789
- return;
790
- }
791
- }
792
- }
793
- }
794
- detectBestPlacement() {
795
- this.zone.runOutsideAngular(() => {
796
- const p = this.container.nativeElement.querySelector('.widget-blank-placeholder');
797
- let col = Math.ceil(this.dragItem.offsetLeft / this.tileSize);
798
- if (this.rtl) {
799
- col = Math.ceil((this.container.nativeElement.clientWidth - (this.dragItem.offsetLeft + this.dragItem.clientWidth)) / this.tileSize);
800
- }
801
- let row = Math.ceil(this.dragItem.offsetTop / this.tileSize);
802
- if (col < 1) {
803
- col = 1;
804
- }
805
- if (row < 1) {
806
- row = 1;
807
- }
808
- const widgets = Array.from(this.ref.nativeElement.querySelectorAll('.widget-host')).map((c) => c);
809
- p.setAttribute(this.DATA_COL, col.toString());
810
- p.setAttribute(this.DATA_ROW, row.toString());
811
- const collision = widgets.filter(c => c !== this.dragItem).some(c => AXHtmlUtil.collision(c, this.dragItem));
812
- if (collision) {
813
- this.removePlaceholder();
814
- }
815
- });
816
- }
817
- addPlaceholder() {
818
- this.zone.runOutsideAngular(() => {
819
- this.removePlaceholder();
820
- if (this.dragItem) {
821
- const p = document.createElement('div');
822
- p.classList.add('widget-blank-placeholder');
823
- p.setAttribute(this.DATA_COL, this.dragItem.getAttribute(this.DATA_COL));
824
- p.setAttribute(this.DATA_ROW, this.dragItem.getAttribute(this.DATA_ROW));
825
- p.setAttribute(this.DATA_SIZE_X, this.dragItem.getAttribute(this.DATA_SIZE_X));
826
- p.setAttribute(this.DATA_SIZE_Y, this.dragItem.getAttribute(this.DATA_SIZE_Y));
827
- this.container.nativeElement.appendChild(p);
828
- }
829
- });
830
- }
831
- removePlaceholder() {
832
- const p = this.container.nativeElement.querySelector('.widget-blank-placeholder');
833
- p?.remove();
834
- }
835
- startEdit() {
836
- this._isInEditing = true;
837
- this.calcGridSize();
838
- this.ref.nativeElement.classList.add('grid-background');
839
- const bg = this.ref.nativeElement;
840
- bg.style.setProperty('background-position', `${this.rtl ? 'right' : 'left'} top`);
841
- // tslint:disable-next-line: max-line-length
842
- const pattern = `url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${this.tileSize + this.gapSize}" height="${this.tileSize + this.gapSize}"> <rect style="fill: %23dadada" x="${this.rtl ? this.gapSize : 0}" width="${this.tileSize}" height="${this.tileSize}" y="0"></rect></svg>')`;
843
- bg.style.setProperty('background-image', pattern);
844
- //
845
- const widgets = Array.from(this.ref.nativeElement.querySelectorAll('.widget-host'));
846
- widgets.forEach((w) => {
847
- w.addEventListener('mousedown', this.dragStart.bind(this), false);
848
- });
849
- this.ref.nativeElement.addEventListener('mousemove', this.drag.bind(this), false);
850
- this.ref.nativeElement.addEventListener('mouseup', this.dragEnd.bind(this), false);
851
- }
852
- finishEdit() {
853
- this.ref.nativeElement.classList.remove('grid-background');
854
- const bg = this.ref.nativeElement;
855
- bg.style.removeProperty('background-image');
856
- //
857
- this._isInEditing = false;
858
- const widgets = Array.from(this.ref.nativeElement.querySelectorAll('.widget-host'));
859
- widgets.forEach((w) => {
860
- w.removeEventListener('mousedown', this.dragStart.bind(this), false);
861
- });
862
- this.ref.nativeElement.removeEventListener('mousemove', this.drag.bind(this), false);
863
- this.ref.nativeElement.removeEventListener('mouseup', this.dragEnd.bind(this), false);
864
- this.saveSubject.next('config');
865
- }
866
- addWidget(widget) {
867
- this.zone.runOutsideAngular(() => {
868
- this.newWidget = {
869
- uniqueName: widget.uniqueName,
870
- component: widget.component,
871
- title: widget.title,
872
- col: 1,
873
- row: 1,
874
- sizeX: widget.sizeX,
875
- sizeY: widget.sizeY,
876
- options: widget.options,
877
- props: widget.props
878
- };
879
- this.detectFirstEmptySlot(this.newWidget);
880
- const w = {
881
- uniqueName: this.newWidget.uniqueName,
882
- component: this.newWidget.component,
883
- title: this.newWidget.title,
884
- options: this.newWidget.options,
885
- props: this.newWidget.props,
886
- sizeX: this.newWidget.sizeX,
887
- sizeY: this.newWidget.sizeY,
888
- col: this.newWidget.col,
889
- row: this.newWidget.row
890
- };
891
- this.widgets.push(w);
892
- this.newWidget = null;
893
- this.zone.run(() => {
894
- this.cdr.detectChanges();
895
- this.calcGridSize();
896
- this.emitConfigChanged('add');
897
- setTimeout(() => {
898
- w['__meta__'].instance.element.addEventListener('mousedown', this.dragStart.bind(this), false);
899
- }, 1000);
900
- });
901
- });
902
- }
903
- handleOnRemove(w) {
904
- w.element.classList.add('animate__animated', 'animate__zoomOut');
905
- w.element.addEventListener('animationend', () => {
906
- this.widgets = this.widgets.filter((c) => c.__meta__.id !== w.config.__meta__.id);
907
- this.cdr.detectChanges();
908
- this.calcGridSize();
909
- this.emitConfigChanged('remove');
910
- });
911
- }
912
- handleOnSave(e) {
913
- this.onWidgetSave.emit(e);
914
- }
915
- trackByFn(index, item) {
916
- if (!item['__meta__']?.id) {
917
- item['__meta__'] = {};
918
- item['__meta__'].id = AXHtmlUtil.getUID();
919
- }
920
- return item['__meta__']?.id;
921
- }
922
- load(widgets) {
923
- this.clear();
924
- return new Promise((resolve, reject) => {
925
- if (widgets) {
926
- const loadedWidgets = [];
927
- if (typeof widgets === 'string') {
928
- try {
929
- loadedWidgets.push(...JSON.parse(widgets));
930
- this.emitConfigChanged('load');
931
- }
932
- catch (error) {
933
- reject('Invalid widget json data!');
934
- }
935
- }
936
- else {
937
- loadedWidgets.push(...widgets);
938
- this.emitConfigChanged('load');
939
- }
940
- let intervalId = -1;
941
- const loadFunc = () => {
942
- if (this.galleryItems && this.galleryItems.length > 0) {
943
- loadedWidgets.forEach(w => {
944
- const gitem = this.galleryItems.find(c => c.uniqueName === w.uniqueName);
945
- if (gitem) {
946
- w.component = gitem.component;
947
- if (gitem.props) {
948
- w.props = JSON.parse(JSON.stringify(gitem.props));
949
- }
950
- }
951
- });
952
- this.widgets.push(...loadedWidgets);
953
- this.emitConfigChanged('load');
954
- window.clearInterval(intervalId);
955
- this.cdr.detectChanges();
956
- resolve();
957
- }
958
- };
959
- intervalId = window.setInterval(loadFunc, 200);
960
- }
961
- else {
962
- resolve();
963
- }
964
- });
965
- }
966
- clear() {
967
- if (this.widgets.length) {
968
- this.widgets = [];
969
- this.cdr.detectChanges();
970
- this.saveSubject.next('clear');
971
- }
972
- }
973
- save() {
974
- const obj = this.widgets.map(c => ({
975
- uniqueName: c.uniqueName,
976
- component: c.component,
977
- title: c.title,
978
- sizeX: c.sizeX,
979
- sizeY: c.sizeY,
980
- col: c.col,
981
- row: c.row,
982
- options: c.options,
983
- props: c.props
984
- }));
985
- return Promise.resolve(JSON.stringify(obj));
986
- }
987
- refresh() {
988
- this.widgetHosts.forEach(host => {
989
- host.widget.refresh();
990
- });
991
- }
992
- handleOnConfigChanged(e) {
993
- this.cdr.detectChanges();
994
- this.saveSubject.next('config');
995
- }
996
- handleOnResizedChanged(e) {
997
- this.detectFirstEmptySlot(e.config);
998
- this.cdr.detectChanges();
999
- this.saveSubject.next('config');
1000
- }
1001
- emitConfigChanged(mode) {
1002
- this.onConfigChanged.emit({
1003
- component: this,
1004
- mode: mode
1005
- });
1006
- }
1007
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetBoardComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1008
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.3", type: AXWidgetBoardComponent, isStandalone: false, selector: "ax-widget-board", inputs: { galleryItems: "galleryItems", tileSize: "tileSize", gapSize: "gapSize", readonly: "readonly", provideValue: "provideValue" }, outputs: { onConfigChanged: "onConfigChanged", onWidgetSave: "onWidgetSave" }, host: { classAttribute: "ax widget-board" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true }, { propertyName: "widgetHosts", predicate: AXWidgetHostComponent, descendants: true }], ngImport: i0, template: "<div class=\"widgets-container\" [class.rtl]=\"rtl\" #container>\n @for (w of widgets; track trackByFn($index, w)) {\n <ax-widget-host [config]='w' [sizeX]=\"w.sizeX\" [readonly]=\"readonly || w.readonly\"\n [sizeY]=\"w.sizeY\" [col]=\"w.col\" [row]=\"w.row\" (onRemove)=\"handleOnRemove($event)\" (onSave)=\"handleOnSave($event)\"\n (onConfigChanged)=\"handleOnConfigChanged($event)\" (onResized)=\"handleOnResizedChanged($event)\"\n [provideValue]=\"provideValue\">\n </ax-widget-host>\n }\n</div>\n", styles: [".widget-board{overflow:scroll;scrollbar-width:thin;display:inline-block;margin:15px 20px;min-width:calc(100% - 18px);min-height:calc(100% - 18px);--animate-duration: .5s;background-repeat:no-repeat}.widget-board.grid-background{background-repeat:repeat!important}.widget-board.grid-background .widgets-container .widget-host{touch-action:none;-webkit-user-select:none;user-select:none}.widget-board.grid-background .widgets-container .widget-host .widget-edit-overlay{display:block;cursor:move}.widget-board.grid-background .widgets-container .widget-host.widget-dragging{z-index:1000}.widget-board.grid-background .widgets-container .widget-host:focus{outline-width:1px;outline-style:solid;outline-color:var(--ax-primary-color)}.widget-board.grid-background .widget-blank-placeholder{background:var(--ax-primary-trans-light-color);position:absolute}.widget-board .widgets-container{position:relative;touch-action:none}.widget-board .widgets-container.rtl .widget-host .widget-options-menu{right:unset!important;left:0!important}.widget-board .widgets-container .widget-host{position:absolute;background:#fff;box-shadow:2px 2px 3px #dadada}.widget-board .widgets-container .widget-host .widget-content{width:100%;height:100%;display:flex;flex-direction:column}.widget-board .widgets-container .widget-host .widget-content .widget-title{padding:var(--ax-size-md);text-align:start;font-size:1.5em;position:absolute}.widget-board .widgets-container .widget-host .widget-edit-loading{display:none;background:#ffffffd9;position:absolute;width:100%;height:100%;top:0;left:0;z-index:2;display:flex}.widget-board .widgets-container .widget-host .widget-config-overlay{position:absolute;background:#fff;width:100%;height:100%;top:0;left:0;z-index:1;padding:var(--ax-size-md);cursor:pointer}.widget-board .widgets-container .widget-host .widget-config-overlay:hover .widget-title{text-decoration:underline}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-title{text-align:start;font-size:1.5em}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-config-box{align-self:center;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(--ax-gray-dark-color)}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-config-box .config-title{font-size:1.2em;margin-bottom:var(--ax-size-md)}.widget-board .widgets-container .widget-host .widget-edit-overlay{display:none;background:#ffffff80;position:absolute;width:100%;height:100%;top:0;left:0;z-index:10}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu{margin:6px;text-align:end;float:inline-end;opacity:1;transition:opacity 1s ease}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button{display:inline-block;background-color:#f0f0f0;border-radius:1px;border:2px solid #fff;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:0;height:32px;width:32px;cursor:pointer;color:#666}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button:hover{border-color:#a6a6a6;background-color:#c8c8c8}.widget-board .widgets-container .widget-host .widget-options-menu{display:none;position:absolute;top:0;right:0;z-index:2;cursor:pointer;padding:2px 5px}.widget-board .widgets-container .widget-host .widget-options-menu:hover{background-color:#f0f0f0}.widget-board .widgets-container .widget-host .widget-container{padding:1px;height:100%}.widget-board .widgets-container .widget-host .widget-container:hover .widget-options-menu{display:block}\n"], dependencies: [{ kind: "component", type: AXWidgetHostComponent, selector: "ax-widget-host", inputs: ["provideValue", "config", "readonly", "sizeX", "sizeY", "col", "row"], outputs: ["onRemove", "onConfigChanged", "onResized", "onSave"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1009
- }
1010
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetBoardComponent, decorators: [{
1011
- type: Component,
1012
- args: [{ selector: 'ax-widget-board', host: { class: 'ax widget-board' }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"widgets-container\" [class.rtl]=\"rtl\" #container>\n @for (w of widgets; track trackByFn($index, w)) {\n <ax-widget-host [config]='w' [sizeX]=\"w.sizeX\" [readonly]=\"readonly || w.readonly\"\n [sizeY]=\"w.sizeY\" [col]=\"w.col\" [row]=\"w.row\" (onRemove)=\"handleOnRemove($event)\" (onSave)=\"handleOnSave($event)\"\n (onConfigChanged)=\"handleOnConfigChanged($event)\" (onResized)=\"handleOnResizedChanged($event)\"\n [provideValue]=\"provideValue\">\n </ax-widget-host>\n }\n</div>\n", styles: [".widget-board{overflow:scroll;scrollbar-width:thin;display:inline-block;margin:15px 20px;min-width:calc(100% - 18px);min-height:calc(100% - 18px);--animate-duration: .5s;background-repeat:no-repeat}.widget-board.grid-background{background-repeat:repeat!important}.widget-board.grid-background .widgets-container .widget-host{touch-action:none;-webkit-user-select:none;user-select:none}.widget-board.grid-background .widgets-container .widget-host .widget-edit-overlay{display:block;cursor:move}.widget-board.grid-background .widgets-container .widget-host.widget-dragging{z-index:1000}.widget-board.grid-background .widgets-container .widget-host:focus{outline-width:1px;outline-style:solid;outline-color:var(--ax-primary-color)}.widget-board.grid-background .widget-blank-placeholder{background:var(--ax-primary-trans-light-color);position:absolute}.widget-board .widgets-container{position:relative;touch-action:none}.widget-board .widgets-container.rtl .widget-host .widget-options-menu{right:unset!important;left:0!important}.widget-board .widgets-container .widget-host{position:absolute;background:#fff;box-shadow:2px 2px 3px #dadada}.widget-board .widgets-container .widget-host .widget-content{width:100%;height:100%;display:flex;flex-direction:column}.widget-board .widgets-container .widget-host .widget-content .widget-title{padding:var(--ax-size-md);text-align:start;font-size:1.5em;position:absolute}.widget-board .widgets-container .widget-host .widget-edit-loading{display:none;background:#ffffffd9;position:absolute;width:100%;height:100%;top:0;left:0;z-index:2;display:flex}.widget-board .widgets-container .widget-host .widget-config-overlay{position:absolute;background:#fff;width:100%;height:100%;top:0;left:0;z-index:1;padding:var(--ax-size-md);cursor:pointer}.widget-board .widgets-container .widget-host .widget-config-overlay:hover .widget-title{text-decoration:underline}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-title{text-align:start;font-size:1.5em}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-config-box{align-self:center;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(--ax-gray-dark-color)}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-config-box .config-title{font-size:1.2em;margin-bottom:var(--ax-size-md)}.widget-board .widgets-container .widget-host .widget-edit-overlay{display:none;background:#ffffff80;position:absolute;width:100%;height:100%;top:0;left:0;z-index:10}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu{margin:6px;text-align:end;float:inline-end;opacity:1;transition:opacity 1s ease}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button{display:inline-block;background-color:#f0f0f0;border-radius:1px;border:2px solid #fff;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:0;height:32px;width:32px;cursor:pointer;color:#666}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button:hover{border-color:#a6a6a6;background-color:#c8c8c8}.widget-board .widgets-container .widget-host .widget-options-menu{display:none;position:absolute;top:0;right:0;z-index:2;cursor:pointer;padding:2px 5px}.widget-board .widgets-container .widget-host .widget-options-menu:hover{background-color:#f0f0f0}.widget-board .widgets-container .widget-host .widget-container{padding:1px;height:100%}.widget-board .widgets-container .widget-host .widget-container:hover .widget-options-menu{display:block}\n"] }]
1013
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }], propDecorators: { container: [{
1014
- type: ViewChild,
1015
- args: ['container']
1016
- }], widgetHosts: [{
1017
- type: ViewChildren,
1018
- args: [AXWidgetHostComponent]
1019
- }], galleryItems: [{
1020
- type: Input
1021
- }], tileSize: [{
1022
- type: Input
1023
- }], gapSize: [{
1024
- type: Input
1025
- }], readonly: [{
1026
- type: Input
1027
- }], provideValue: [{
1028
- type: Input
1029
- }], onConfigChanged: [{
1030
- type: Output
1031
- }], onWidgetSave: [{
1032
- type: Output
1033
- }] } });
1034
-
1035
- class AXWidgetSizePropertyEditorComponent extends AXProperyEditorComponent {
1036
- cdr;
1037
- sizeX;
1038
- sizeY;
1039
- minX = 1;
1040
- maxX = 20;
1041
- minY = 1;
1042
- maxY = 20;
1043
- constructor(cdr) {
1044
- super(cdr);
1045
- this.cdr = cdr;
1046
- }
1047
- ngOnInit() {
1048
- if (Array.isArray(this.value)) {
1049
- this.sizeX = this.value[0];
1050
- this.sizeY = this.value[1];
1051
- }
1052
- else {
1053
- this.sizeX = 2;
1054
- this.sizeY = 2;
1055
- }
1056
- }
1057
- handleMinValueChange(e) {
1058
- this.sizeX = e.value;
1059
- if (this.sizeY > 0) {
1060
- super.handleValueChange([this.sizeX, this.sizeY]);
1061
- }
1062
- }
1063
- handleMaxValueChange(e) {
1064
- this.sizeY = e.value;
1065
- if (this.sizeX > 0) {
1066
- super.handleValueChange([this.sizeX, this.sizeY]);
1067
- }
1068
- }
1069
- ngAfterViewInit() {
1070
- this.onRenderCompleted.emit();
1071
- }
1072
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetSizePropertyEditorComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1073
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: AXWidgetSizePropertyEditorComponent, isStandalone: false, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div style=\"display: grid;grid-gap: 2%; grid-template-columns: 49% 49%;\">\n <ax-number-box (onValueChanged)=\"handleMinValueChange($event)\" [value]=\"sizeX\" [min]=\"minX\" [max]=\"maxX\">\n </ax-number-box>\n <ax-number-box (onValueChanged)=\"handleMaxValueChange($event)\" [value]=\"sizeY\" [min]=\"minY\" [max]=\"maxY\">\n </ax-number-box>\n</div>", dependencies: [{ kind: "component", type: i1.AXNumberBoxComponent, selector: "ax-number-box", inputs: ["min", "max", "showSeparator", "showCurrency", "showCounter", "scrollWeel", "showDoubleCounter", "maxLength", "intStep", "decimalNumber", "customStep"] }] });
1074
- }
1075
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetSizePropertyEditorComponent, decorators: [{
1076
- type: Component,
1077
- args: [{ standalone: false, template: "<div style=\"display: grid;grid-gap: 2%; grid-template-columns: 49% 49%;\">\n <ax-number-box (onValueChanged)=\"handleMinValueChange($event)\" [value]=\"sizeX\" [min]=\"minX\" [max]=\"maxX\">\n </ax-number-box>\n <ax-number-box (onValueChanged)=\"handleMaxValueChange($event)\" [value]=\"sizeY\" [min]=\"minY\" [max]=\"maxY\">\n </ax-number-box>\n</div>" }]
1078
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
1079
-
1080
- class AXWidgetBoardModule {
1081
- /**
1082
- *
1083
- */
1084
- constructor() {
1085
- AXTranslator.load('en', {
1086
- 'widget-board': {
1087
- 'configurable-props': 'Configurable Properties',
1088
- configure: 'Configure Widget',
1089
- },
1090
- });
1091
- AXTranslator.load('fa', {
1092
- 'widget-board': {
1093
- 'configurable-props': 'ویژگی های قابل تنظیم',
1094
- configure: 'پیکر بندی ابزارک',
1095
- },
1096
- });
1097
- }
1098
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetBoardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1099
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetBoardModule, declarations: [AXWidgetBoardComponent,
1100
- AXWidgetHostComponent,
1101
- AXWidgetConfigComponent,
1102
- AXWidgetSaveComponent], imports: [CommonModule,
1103
- AXSearchBoxModule,
1104
- AXLoadingModule,
1105
- RouterModule,
1106
- AXProppertyEditorModule,
1107
- AXPageModule,
1108
- AXToolbarModule,
1109
- AXTranslatorModule,
1110
- AXLabelModule,
1111
- AXTextAreaModule,
1112
- AXFieldsetModule,
1113
- AXTextBoxModule,
1114
- AXFormGroupModule,
1115
- AXTabStripModule,
1116
- AXCheckBoxModule,
1117
- AXMenuModule,
1118
- AXTranslatorModule,
1119
- AXValidationModule, i1$2.RouterModule], exports: [AXWidgetBoardComponent, AXProppertyEditorModule] });
1120
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetBoardModule, imports: [CommonModule,
1121
- AXSearchBoxModule,
1122
- AXLoadingModule,
1123
- RouterModule,
1124
- AXProppertyEditorModule,
1125
- AXPageModule,
1126
- AXToolbarModule,
1127
- AXTranslatorModule,
1128
- AXLabelModule,
1129
- AXTextAreaModule,
1130
- AXFieldsetModule,
1131
- AXTextBoxModule,
1132
- AXFormGroupModule,
1133
- AXTabStripModule,
1134
- AXCheckBoxModule,
1135
- AXMenuModule,
1136
- AXTranslatorModule,
1137
- AXValidationModule,
1138
- RouterModule.forChild([
1139
- {
1140
- component: AXWidgetSizePropertyEditorComponent,
1141
- path: 'ax/editors/widget-size',
1142
- },
1143
- ]), AXProppertyEditorModule] });
1144
- }
1145
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetBoardModule, decorators: [{
1146
- type: NgModule,
1147
- args: [{
1148
- imports: [
1149
- CommonModule,
1150
- AXSearchBoxModule,
1151
- AXLoadingModule,
1152
- RouterModule,
1153
- AXProppertyEditorModule,
1154
- AXPageModule,
1155
- AXToolbarModule,
1156
- AXTranslatorModule,
1157
- AXLabelModule,
1158
- AXTextAreaModule,
1159
- AXFieldsetModule,
1160
- AXTextBoxModule,
1161
- AXFormGroupModule,
1162
- AXTabStripModule,
1163
- AXCheckBoxModule,
1164
- AXMenuModule,
1165
- AXTranslatorModule,
1166
- AXValidationModule,
1167
- RouterModule.forChild([
1168
- {
1169
- component: AXWidgetSizePropertyEditorComponent,
1170
- path: 'ax/editors/widget-size',
1171
- },
1172
- ]),
1173
- ],
1174
- exports: [AXWidgetBoardComponent, AXProppertyEditorModule],
1175
- declarations: [
1176
- AXWidgetBoardComponent,
1177
- AXWidgetHostComponent,
1178
- AXWidgetConfigComponent,
1179
- AXWidgetSaveComponent,
1180
- ],
1181
- providers: [],
1182
- schemas: [NO_ERRORS_SCHEMA],
1183
- }]
1184
- }], ctorParameters: () => [] });
1185
-
1186
- class AXWidgetSizePropertyEditorModule {
1187
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetSizePropertyEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1188
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetSizePropertyEditorModule, declarations: [AXWidgetSizePropertyEditorComponent], imports: [CommonModule, FormsModule, AXNumberBoxModule], exports: [AXWidgetSizePropertyEditorComponent] });
1189
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetSizePropertyEditorModule, imports: [CommonModule, FormsModule, AXNumberBoxModule] });
1190
- }
1191
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXWidgetSizePropertyEditorModule, decorators: [{
1192
- type: NgModule,
1193
- args: [{
1194
- declarations: [AXWidgetSizePropertyEditorComponent],
1195
- imports: [CommonModule, FormsModule, AXNumberBoxModule],
1196
- exports: [AXWidgetSizePropertyEditorComponent],
1197
- providers: [],
1198
- schemas: [NO_ERRORS_SCHEMA],
1199
- }]
1200
- }] });
1201
-
1202
- /**
1203
- * Generated bundle index. Do not edit.
1204
- */
1205
-
1
+ import { __decorate, __metadata } from "tslib";
2
+ import * as i0 from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, EventEmitter, HostBinding, Injectable, Input, NO_ERRORS_SCHEMA, NgModule, Output, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation } from "@angular/core";
4
+ import * as i1$1 from "@acorex/components";
5
+ import { AXBasePopupPageComponent, AXCheckBoxModule, AXFieldsetModule, AXFormGroupModule, AXLabelModule, AXLoadingModule, AXMenuModule, AXNumberBoxModule, AXPageModule, AXPropertyDecorators, AXProperyEditorComponent, AXProppertyEditorModule, AXSearchBoxModule, AXTabStripModule, AXTextAreaModule, AXTextBoxModule, AXToolbarModule, AXValidationFormComponent, AXValidationModule, propertyEditor } from "@acorex/components";
6
+ import * as i2 from "@acorex/core";
7
+ import { AXClientRec, AXHtmlUtil, AXObjectUtil, AXTranslator, AXTranslatorModule } from "@acorex/core";
8
+ import { Subject } from "rxjs";
9
+ import { debounceTime } from "rxjs/operators";
10
+ import { CommonModule } from "@angular/common";
11
+ import * as i1 from "@angular/router";
12
+ import { RouterModule } from "@angular/router";
13
+ import { FormsModule } from "@angular/forms";
14
+ var AXWidgetComponent = class AXWidgetComponent {
15
+ uid = AXHtmlUtil.getUID();
16
+ provideValue;
17
+ onBusyChanged = new EventEmitter();
18
+ _isBusy = true;
19
+ get isBusy() {
20
+ return this._isBusy;
21
+ }
22
+ set isBusy(v) {
23
+ if (v !== this._isBusy) {
24
+ const eventData = {
25
+ component: this,
26
+ oldValue: this._isBusy,
27
+ value: v
28
+ };
29
+ this._isBusy = v;
30
+ this.onBusyChanged.emit(eventData);
31
+ }
32
+ }
33
+ widgetSize;
34
+ refreshRate = [{
35
+ id: 3e5,
36
+ text: AXTranslator.get("dateTime.duration.format_minute").replace("{0}", "5")
37
+ }];
38
+ getRefreshRate() {
39
+ return Array.isArray(this.refreshRate) && this.refreshRate.length ? this.refreshRate[0].id : this.refreshRate;
40
+ }
41
+ intervalId;
42
+ constructor() {
43
+ this.onConfiguredChanged.subscribe(() => {
44
+ if (this.isConfigured === true && this.getRefreshRate()) this.restartRefreshTimer();
45
+ else this.stopRefreshTimer();
46
+ });
47
+ }
48
+ startRefreshTimer() {
49
+ this.intervalId = window.setInterval(this.refresh.bind(this), this.getRefreshRate());
50
+ }
51
+ stopRefreshTimer() {
52
+ window.clearInterval(this.intervalId);
53
+ }
54
+ restartRefreshTimer() {
55
+ this.stopRefreshTimer();
56
+ this.startRefreshTimer();
57
+ }
58
+ ngOnDestroy() {
59
+ this.stopRefreshTimer();
60
+ }
61
+ redraw() {}
62
+ refresh() {
63
+ this.restartRefreshTimer();
64
+ }
65
+ onConfiguredChanged = new EventEmitter();
66
+ get isConfigured() {
67
+ return true;
68
+ }
69
+ setValue(name, value) {
70
+ this[name] = value;
71
+ this.onConfiguredChanged.emit();
72
+ }
73
+ getValue(name) {
74
+ const val = this[name];
75
+ const config = this["__meta__"].config;
76
+ if (config.props[name]?.runtime && this.provideValue) {
77
+ const res = this.provideValue({
78
+ name,
79
+ value: val,
80
+ uniqueName: config.uniqueName,
81
+ options: config.options
82
+ });
83
+ if (this.provideValue instanceof Promise) return res;
84
+ else return Promise.resolve(res);
85
+ }
86
+ return Promise.resolve(val);
87
+ }
88
+ static ɵfac = i0.ɵɵngDeclareFactory({
89
+ minVersion: "12.0.0",
90
+ version: "22.2.0",
91
+ ngImport: i0,
92
+ type: AXWidgetComponent,
93
+ deps: [],
94
+ target: i0.ɵɵFactoryTarget.Injectable
95
+ });
96
+ static ɵprov = i0.ɵɵngDeclareInjectable({
97
+ minVersion: "12.0.0",
98
+ version: "22.2.0",
99
+ ngImport: i0,
100
+ type: AXWidgetComponent
101
+ });
102
+ };
103
+ __decorate([propertyEditor({
104
+ editorClass: "ax/editors/widget-size",
105
+ title: "common.size",
106
+ visible: false,
107
+ order: -99
108
+ }), __metadata("design:type", Array)], AXWidgetComponent.prototype, "widgetSize", void 0);
109
+ __decorate([propertyEditor({
110
+ editorClass: "ax/editors/select",
111
+ title: "common.refresh-rate",
112
+ visible: true,
113
+ order: -98,
114
+ editorOptions: {
115
+ items: () => {
116
+ return [
117
+ "بدون مقدار",
118
+ 1,
119
+ 2,
120
+ 3,
121
+ 5,
122
+ 10,
123
+ 20,
124
+ 30,
125
+ 60
126
+ ].map((c) => ({
127
+ id: typeof c === "number" ? 6e4 * c : 0,
128
+ text: typeof c === "number" ? AXTranslator.get("dateTime.duration.format_minute").replace("{0}", c.toString()) : c
129
+ }));
130
+ },
131
+ allowNull: false,
132
+ allowSearch: false,
133
+ selectionDataMode: "value",
134
+ selectionMode: "single",
135
+ valueField: "id"
136
+ }
137
+ }), __metadata("design:type", Object)], AXWidgetComponent.prototype, "refreshRate", void 0);
138
+ i0.ɵɵngDeclareClassMetadata({
139
+ minVersion: "12.0.0",
140
+ version: "22.2.0",
141
+ ngImport: i0,
142
+ type: AXWidgetComponent,
143
+ decorators: [{ type: Injectable }],
144
+ ctorParameters: () => [],
145
+ propDecorators: {
146
+ widgetSize: [],
147
+ refreshRate: []
148
+ }
149
+ });
150
+ var AXWidgetConfigComponent = class AXWidgetConfigComponent extends AXBasePopupPageComponent {
151
+ cdr;
152
+ form;
153
+ constructor(cdr) {
154
+ super();
155
+ this.cdr = cdr;
156
+ }
157
+ widget;
158
+ props = [];
159
+ displayProps = [];
160
+ changes = [];
161
+ context = {};
162
+ getFooterButtons() {
163
+ return [{
164
+ name: "okay",
165
+ submitBehavior: true,
166
+ text: AXTranslator.get("common.confirm"),
167
+ style: "success"
168
+ }, {
169
+ name: "cancel",
170
+ cancelBehavior: true,
171
+ text: AXTranslator.get("common.cancel"),
172
+ style: "danger blank"
173
+ }];
174
+ }
175
+ onFooterButtonClick(e) {
176
+ if (e.name === "cancel") this.close();
177
+ if (e.name === "okay") this.form.validate().then((c) => {
178
+ if (c.result) this.close(this.changes);
179
+ });
180
+ }
181
+ handleValueChange(e) {
182
+ const prop = this.changes.find((c) => c.property.name === e.property.name);
183
+ if (prop) prop.value = e.value;
184
+ else this.changes.push({
185
+ property: e.property,
186
+ value: e.value
187
+ });
188
+ this.updateContext();
189
+ }
190
+ ngOnInit() {
191
+ this.displayProps = this.props.filter((c) => c.property.visible !== false).sort((a, b) => a.property.order - b.property.order);
192
+ this.updateContext();
193
+ }
194
+ updateContext() {
195
+ const ctx = {};
196
+ this.props.forEach((p) => {
197
+ ctx[p.property.name] = p.value;
198
+ });
199
+ this.changes.forEach((p) => {
200
+ ctx[p.property.name] = p.value;
201
+ });
202
+ this.context = ctx;
203
+ }
204
+ identify(index, item) {
205
+ return item.property.name;
206
+ }
207
+ static ɵfac = i0.ɵɵngDeclareFactory({
208
+ minVersion: "12.0.0",
209
+ version: "22.2.0",
210
+ ngImport: i0,
211
+ type: AXWidgetConfigComponent,
212
+ deps: [{ token: i0.ChangeDetectorRef }],
213
+ target: i0.ɵɵFactoryTarget.Component
214
+ });
215
+ static ɵcmp = i0.ɵɵngDeclareComponent({
216
+ minVersion: "17.0.0",
217
+ version: "22.2.0",
218
+ type: AXWidgetConfigComponent,
219
+ isStandalone: false,
220
+ selector: "ng-component",
221
+ viewQueries: [{
222
+ propertyName: "form",
223
+ first: true,
224
+ predicate: AXValidationFormComponent,
225
+ descendants: true
226
+ }],
227
+ usesInheritance: true,
228
+ ngImport: i0,
229
+ template: "<ax-page>\n <ax-page-content>\n <div class=\"container\">\n <ax-validation-form #form>\n @for (p of displayProps; track identify($index, p)) {\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-label>{{p.property.title | trans}}</ax-label>\n <ng-container ax-property-editor-renderer [property]=\"p\" [context]=\"context\" [host]=\"widget\" [validationForm]=\"form\"\n (onValueChange)=\"handleValueChange($event)\">\n </ng-container>\n </div>\n </div>\n }\n </ax-validation-form>\n </div>\n </ax-page-content>\n</ax-page>",
230
+ dependencies: [
231
+ {
232
+ kind: "directive",
233
+ type: i1$1.AXPropertyEditorRendererDirective,
234
+ selector: "[ax-property-editor-renderer]",
235
+ inputs: [
236
+ "property",
237
+ "validationForm",
238
+ "context",
239
+ "host",
240
+ "groupId"
241
+ ],
242
+ outputs: ["onValueChange"]
243
+ },
244
+ {
245
+ kind: "component",
246
+ type: i1$1.AXPageContentComponent,
247
+ selector: "ax-page-content"
248
+ },
249
+ {
250
+ kind: "component",
251
+ type: i1$1.AXPageComponent,
252
+ selector: "ax-page"
253
+ },
254
+ {
255
+ kind: "component",
256
+ type: i1$1.AXLabelComponent,
257
+ selector: "ax-label",
258
+ inputs: ["size"],
259
+ outputs: ["clickLabel"]
260
+ },
261
+ {
262
+ kind: "component",
263
+ type: i1$1.AXValidationFormComponent,
264
+ selector: "ax-validation-form",
265
+ inputs: ["validateOn"],
266
+ outputs: ["onInit"]
267
+ },
268
+ {
269
+ kind: "pipe",
270
+ type: i2.AXTranslatorPipe,
271
+ name: "trans"
272
+ }
273
+ ],
274
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
275
+ encapsulation: i0.ViewEncapsulation.None
276
+ });
277
+ };
278
+ i0.ɵɵngDeclareClassMetadata({
279
+ minVersion: "12.0.0",
280
+ version: "22.2.0",
281
+ ngImport: i0,
282
+ type: AXWidgetConfigComponent,
283
+ decorators: [{
284
+ type: Component,
285
+ args: [{
286
+ encapsulation: ViewEncapsulation.None,
287
+ changeDetection: ChangeDetectionStrategy.OnPush,
288
+ standalone: false,
289
+ template: "<ax-page>\n <ax-page-content>\n <div class=\"container\">\n <ax-validation-form #form>\n @for (p of displayProps; track identify($index, p)) {\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-label>{{p.property.title | trans}}</ax-label>\n <ng-container ax-property-editor-renderer [property]=\"p\" [context]=\"context\" [host]=\"widget\" [validationForm]=\"form\"\n (onValueChange)=\"handleValueChange($event)\">\n </ng-container>\n </div>\n </div>\n }\n </ax-validation-form>\n </div>\n </ax-page-content>\n</ax-page>"
290
+ }]
291
+ }],
292
+ ctorParameters: () => [{ type: i0.ChangeDetectorRef }],
293
+ propDecorators: { form: [{
294
+ type: ViewChild,
295
+ args: [AXValidationFormComponent]
296
+ }] }
297
+ });
298
+ var AXWidgetSaveComponent = class AXWidgetSaveComponent extends AXBasePopupPageComponent {
299
+ config;
300
+ props = [];
301
+ displayProps;
302
+ data;
303
+ getFooterButtons() {
304
+ return [{
305
+ name: "okay",
306
+ submitBehavior: true,
307
+ text: AXTranslator.get("common.confirm"),
308
+ style: "ax success"
309
+ }, {
310
+ name: "cancel",
311
+ cancelBehavior: true,
312
+ text: AXTranslator.get("common.cancel"),
313
+ style: "ax light"
314
+ }];
315
+ }
316
+ ngOnInit() {
317
+ const title = this.props.find((c) => c.property.name === "title" || c.property.name === "name")?.value || this.config.title;
318
+ const pp = {};
319
+ this.props?.forEach((c) => {
320
+ pp[c.property.name] = c.property;
321
+ });
322
+ this.data = {
323
+ component: this.config.component,
324
+ title,
325
+ uniqueName: `${this.config.uniqueName}-${AXHtmlUtil.getUID()}`,
326
+ options: AXObjectUtil.deepJSONClone(this.config.options),
327
+ props: AXObjectUtil.deepJSONClone(pp)
328
+ };
329
+ this.displayProps = this.props.filter((c) => c.property.visible !== false).sort((a, b) => a.property.order - b.property.order).map((c) => ({
330
+ name: c.property.name,
331
+ title: c.property.title,
332
+ allow: true
333
+ }));
334
+ }
335
+ onFooterButtonClick(e) {
336
+ if (e.name === "cancel") this.close();
337
+ if (e.name === "okay") {
338
+ this.props.forEach((p) => {
339
+ const pp = this.displayProps.find((c) => c.name === p.property.name);
340
+ if (pp == null || !pp.allow) {
341
+ let ppp = this.data.props[p.property.name];
342
+ if (ppp) ppp.visible = false;
343
+ else ppp = { visible: false };
344
+ }
345
+ });
346
+ this.close(this.data);
347
+ }
348
+ }
349
+ static ɵfac = i0.ɵɵngDeclareFactory({
350
+ minVersion: "12.0.0",
351
+ version: "22.2.0",
352
+ ngImport: i0,
353
+ type: AXWidgetSaveComponent,
354
+ deps: null,
355
+ target: i0.ɵɵFactoryTarget.Component
356
+ });
357
+ static ɵcmp = i0.ɵɵngDeclareComponent({
358
+ minVersion: "17.0.0",
359
+ version: "22.2.0",
360
+ type: AXWidgetSaveComponent,
361
+ isStandalone: false,
362
+ selector: "ng-component",
363
+ usesInheritance: true,
364
+ ngImport: i0,
365
+ template: "<ax-page>\n <ax-page-content>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.title' | trans}}</ax-label>\n <ax-text-box [(value)]=\"data.title\"></ax-text-box>\n </ax-form-group>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.description' | trans}}</ax-label>\n <ax-text-area [(value)]=\"data.description\"></ax-text-area>\n </ax-form-group>\n </div>\n </div>\n <!-- <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.uniquename' | trans}}</ax-label>\n <ax-text-box></ax-text-box>\n </ax-form-group>\n </div>\n </div> -->\n <div class=\"row\" style=\"margin-block-end: var(--ax-size-md);margin-block-start: var(--ax-size-md);\">\n <div class=\"col-12\">\n <ax-fieldset caption=\"{{'widget-board.configurable-props' | trans}}\">\n @for (prop of displayProps; track prop) {\n <div class=\"row\">\n <div class=\"col-12\" style=\"margin-block-end: var(--ax-size-sm)\">\n <ax-check-box [(value)]=\"prop.allow\" label=\"{{ prop.title | trans }}\">\n </ax-check-box>\n </div>\n </div>\n }\n </ax-fieldset>\n </div>\n </div>\n </div>\n</ax-page-content>\n</ax-page>",
366
+ dependencies: [
367
+ {
368
+ kind: "component",
369
+ type: i1$1.AXPageContentComponent,
370
+ selector: "ax-page-content"
371
+ },
372
+ {
373
+ kind: "component",
374
+ type: i1$1.AXPageComponent,
375
+ selector: "ax-page"
376
+ },
377
+ {
378
+ kind: "component",
379
+ type: i1$1.AXLabelComponent,
380
+ selector: "ax-label",
381
+ inputs: ["size"],
382
+ outputs: ["clickLabel"]
383
+ },
384
+ {
385
+ kind: "component",
386
+ type: i1$1.AXTextAreaComponent,
387
+ selector: "ax-text-area",
388
+ inputs: [
389
+ "rows",
390
+ "cols",
391
+ "maxLength"
392
+ ],
393
+ outputs: ["onBlur", "onFocus"]
394
+ },
395
+ {
396
+ kind: "component",
397
+ type: i1$1.AXFieldsetComponent,
398
+ selector: "ax-fieldset",
399
+ inputs: [
400
+ "size",
401
+ "caption",
402
+ "allowCollapse"
403
+ ]
404
+ },
405
+ {
406
+ kind: "component",
407
+ type: i1$1.AXTextBoxComponent,
408
+ selector: "ax-text-box",
409
+ inputs: [
410
+ "mask",
411
+ "showMask",
412
+ "type",
413
+ "maxLength",
414
+ "maskGuid",
415
+ "maskPlaceholder",
416
+ "maskKeepCharPositions",
417
+ "leadZeroDateTime"
418
+ ]
419
+ },
420
+ {
421
+ kind: "component",
422
+ type: i1$1.AXFormGroupComponent,
423
+ selector: "ax-form-group",
424
+ inputs: ["size", "labelMode"],
425
+ outputs: ["labelModeChange"]
426
+ },
427
+ {
428
+ kind: "component",
429
+ type: i1$1.AXCheckBoxComponent,
430
+ selector: "ax-check-box",
431
+ inputs: [
432
+ "readonly",
433
+ "disabled",
434
+ "size",
435
+ "label",
436
+ "tabIndex",
437
+ "indeterminate",
438
+ "value"
439
+ ],
440
+ outputs: [
441
+ "onValueChanged",
442
+ "valueChange",
443
+ "onClick"
444
+ ]
445
+ },
446
+ {
447
+ kind: "pipe",
448
+ type: i2.AXTranslatorPipe,
449
+ name: "trans"
450
+ }
451
+ ],
452
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
453
+ encapsulation: i0.ViewEncapsulation.None
454
+ });
455
+ };
456
+ i0.ɵɵngDeclareClassMetadata({
457
+ minVersion: "12.0.0",
458
+ version: "22.2.0",
459
+ ngImport: i0,
460
+ type: AXWidgetSaveComponent,
461
+ decorators: [{
462
+ type: Component,
463
+ args: [{
464
+ encapsulation: ViewEncapsulation.None,
465
+ changeDetection: ChangeDetectionStrategy.OnPush,
466
+ standalone: false,
467
+ template: "<ax-page>\n <ax-page-content>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.title' | trans}}</ax-label>\n <ax-text-box [(value)]=\"data.title\"></ax-text-box>\n </ax-form-group>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.description' | trans}}</ax-label>\n <ax-text-area [(value)]=\"data.description\"></ax-text-area>\n </ax-form-group>\n </div>\n </div>\n <!-- <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.uniquename' | trans}}</ax-label>\n <ax-text-box></ax-text-box>\n </ax-form-group>\n </div>\n </div> -->\n <div class=\"row\" style=\"margin-block-end: var(--ax-size-md);margin-block-start: var(--ax-size-md);\">\n <div class=\"col-12\">\n <ax-fieldset caption=\"{{'widget-board.configurable-props' | trans}}\">\n @for (prop of displayProps; track prop) {\n <div class=\"row\">\n <div class=\"col-12\" style=\"margin-block-end: var(--ax-size-sm)\">\n <ax-check-box [(value)]=\"prop.allow\" label=\"{{ prop.title | trans }}\">\n </ax-check-box>\n </div>\n </div>\n }\n </ax-fieldset>\n </div>\n </div>\n </div>\n</ax-page-content>\n</ax-page>"
468
+ }]
469
+ }]
470
+ });
471
+ var AXWidgetHostComponent = class AXWidgetHostComponent {
472
+ ref;
473
+ rendererService;
474
+ cdr;
475
+ popup;
476
+ loadingService;
477
+ _widget;
478
+ get widget() {
479
+ return this._widget;
480
+ }
481
+ _hasProps = false;
482
+ _hasMenu = false;
483
+ provideValue;
484
+ get element() {
485
+ return this.ref.nativeElement;
486
+ }
487
+ configMenuItem = [{
488
+ icon: "far fa-ellipsis-h",
489
+ items: []
490
+ }];
491
+ onRemove = new EventEmitter();
492
+ onConfigChanged = new EventEmitter();
493
+ onResized = new EventEmitter();
494
+ onSave = new EventEmitter();
495
+ config;
496
+ vc;
497
+ readonly = false;
498
+ componentRef;
499
+ _loadingId;
500
+ _isLoading = false;
501
+ get isLoading() {
502
+ return this._isLoading;
503
+ }
504
+ set isLoading(v) {
505
+ this._isLoading = v;
506
+ if (this._loadingId && !v) {
507
+ this.loadingService.hide(this._loadingId);
508
+ this._loadingId = null;
509
+ }
510
+ if (v) {}
511
+ }
512
+ get isConfigured() {
513
+ return this._widget?.isConfigured || false;
514
+ }
515
+ constructor(ref, rendererService, cdr, popup, loadingService) {
516
+ this.ref = ref;
517
+ this.rendererService = rendererService;
518
+ this.cdr = cdr;
519
+ this.popup = popup;
520
+ this.loadingService = loadingService;
521
+ }
522
+ ngOnInit() {}
523
+ async ngAfterViewInit() {
524
+ let component;
525
+ if (typeof this.config.component === "string") component = (await this.rendererService.findLoadedComponentByRoute(this.config.component, 20))?.component;
526
+ else if (typeof this.config.component === "function") component = this.config.component;
527
+ if (component == null) {
528
+ console.error(`Invalid Widget Component!`, this.config);
529
+ this.onRemove.emit(this);
530
+ return;
531
+ }
532
+ this.componentRef = this.vc.createComponent(component);
533
+ this._widget = this.componentRef.instance;
534
+ this._widget.provideValue = this.provideValue;
535
+ if (this._widget.onBusyChanged) this._widget.onBusyChanged.subscribe((d) => {
536
+ if (!this._widget.widgetSize) this._widget.setValue("widgetSize", [this.sizeX, this.sizeY]);
537
+ else this.setSizeFromOptions();
538
+ this.cdr.detectChanges();
539
+ });
540
+ if (this._widget.onConfiguredChanged) this._widget.onConfiguredChanged.subscribe(() => {
541
+ this.setSizeFromOptions();
542
+ });
543
+ if (this.config.options) Object.assign(this._widget, this.config.options);
544
+ this._hasProps = AXPropertyDecorators.getProperties(this._widget).length > 0;
545
+ this.isLoading = false;
546
+ this.config["__meta__"].instance = this;
547
+ this._widget["__meta__"] = {};
548
+ this._widget["__meta__"].config = this.config;
549
+ this.configMenuItem[0].items.push({
550
+ name: "refresh",
551
+ icon: "far fa-undo",
552
+ text: AXTranslator.get("common.refresh"),
553
+ onClick: () => {
554
+ this?.widget?.refresh();
555
+ }
556
+ });
557
+ if (this._hasProps) this.configMenuItem[0].items.push({
558
+ name: "configs",
559
+ icon: "far fa-cogs",
560
+ text: AXTranslator.get("common.configs"),
561
+ onClick: () => {
562
+ this.openConfigDialog();
563
+ }
564
+ });
565
+ this.configMenuItem[0].items.push({
566
+ name: "save",
567
+ icon: "far fa-save",
568
+ text: AXTranslator.get("common.save-as"),
569
+ onClick: () => {
570
+ this.openSaveDialog();
571
+ }
572
+ });
573
+ this.configMenuItem[0].items.push({
574
+ name: "remove",
575
+ icon: "far fa-times",
576
+ style: "ax danger blank",
577
+ text: AXTranslator.get("common.remove"),
578
+ onClick: () => {
579
+ this.onRemove.emit(this);
580
+ }
581
+ });
582
+ this._hasMenu = this.configMenuItem[0].items.length > 0;
583
+ this.cdr.detectChanges();
584
+ }
585
+ sizeX = 1;
586
+ sizeY = 1;
587
+ col = 1;
588
+ row = 1;
589
+ setSizeFromOptions() {
590
+ this._widget.getValue("widgetSize").then((c) => {
591
+ const oldSizeX = this.sizeX;
592
+ const oldSizeY = this.sizeY;
593
+ if (c && Array.isArray(c) && (oldSizeX !== c[0] || oldSizeY !== c[1])) {
594
+ this.config.sizeX = this.sizeX = c[0];
595
+ this.config.sizeY = this.sizeY = c[1];
596
+ this.onResized.emit({
597
+ component: this._widget,
598
+ config: this.config
599
+ });
600
+ }
601
+ this.cdr.detectChanges();
602
+ });
603
+ }
604
+ remove(e) {
605
+ e.preventDefault();
606
+ e.stopPropagation();
607
+ if (!this.readonly) this.onRemove.emit(this);
608
+ return false;
609
+ }
610
+ handleConfig(e) {
611
+ e.preventDefault();
612
+ e.stopPropagation();
613
+ if (!this.readonly) this.openConfigDialog();
614
+ return false;
615
+ }
616
+ openConfigDialog() {
617
+ const ppp = this.getMergedProps();
618
+ this.popup.open(AXWidgetConfigComponent, {
619
+ title: AXTranslator.get("common.configs"),
620
+ size: "sm",
621
+ data: {
622
+ props: ppp.map((c) => ({
623
+ property: c.options,
624
+ value: this._widget[c.options.name]
625
+ })),
626
+ widget: this.widget
627
+ }
628
+ }).then((c) => {
629
+ if (c.data) {
630
+ if (!this.config.options) this.config.options = {};
631
+ c.data.forEach((p) => {
632
+ this._widget.setValue(p.property.name, p.value);
633
+ this.config.options[p.property.name] = p.value;
634
+ });
635
+ this.emitConfigChanged();
636
+ this._widget.redraw();
637
+ this.cdr.detectChanges();
638
+ }
639
+ });
640
+ }
641
+ openSaveDialog() {
642
+ const ppp = this.getMergedProps();
643
+ this.popup.open(AXWidgetSaveComponent, {
644
+ title: AXTranslator.get("common.save-as"),
645
+ size: "sm",
646
+ data: {
647
+ config: this.config,
648
+ props: ppp.map((c) => ({
649
+ property: c.options,
650
+ value: this._widget[c.options.name]
651
+ }))
652
+ }
653
+ }).then((c) => {
654
+ if (c.data) this.onSave.emit({
655
+ component: this._widget,
656
+ data: c.data
657
+ });
658
+ });
659
+ }
660
+ handleOptionClick(e) {
661
+ e.preventDefault();
662
+ e.stopPropagation();
663
+ this.openConfigDialog();
664
+ return false;
665
+ }
666
+ ngOnDestroy() {
667
+ this.vc.clear();
668
+ if (this.componentRef) this.componentRef.destroy();
669
+ }
670
+ getMergedProps() {
671
+ const ppp = AXObjectUtil.deepCopy(AXPropertyDecorators.getProperties(this._widget));
672
+ for (const key in this.config.props) if (Object.prototype.hasOwnProperty.call(this.config.props, key)) {
673
+ const newP = this.config.props[key];
674
+ const existPropDec = ppp.find((p) => p.property === key);
675
+ if (existPropDec) Object.assign(existPropDec.options, newP);
676
+ }
677
+ return ppp;
678
+ }
679
+ emitConfigChanged() {
680
+ this.onConfigChanged.emit({
681
+ component: this._widget,
682
+ config: this.config
683
+ });
684
+ }
685
+ static ɵfac = i0.ɵɵngDeclareFactory({
686
+ minVersion: "12.0.0",
687
+ version: "22.2.0",
688
+ ngImport: i0,
689
+ type: AXWidgetHostComponent,
690
+ deps: [
691
+ { token: i0.ElementRef },
692
+ { token: i2.AXRenderService },
693
+ { token: i0.ChangeDetectorRef },
694
+ { token: i1$1.AXPopupService },
695
+ { token: i1$1.AXLoadingService }
696
+ ],
697
+ target: i0.ɵɵFactoryTarget.Component
698
+ });
699
+ static ɵcmp = i0.ɵɵngDeclareComponent({
700
+ minVersion: "17.0.0",
701
+ version: "22.2.0",
702
+ type: AXWidgetHostComponent,
703
+ isStandalone: false,
704
+ selector: "ax-widget-host",
705
+ inputs: {
706
+ provideValue: "provideValue",
707
+ config: "config",
708
+ readonly: "readonly",
709
+ sizeX: "sizeX",
710
+ sizeY: "sizeY",
711
+ col: "col",
712
+ row: "row"
713
+ },
714
+ outputs: {
715
+ onRemove: "onRemove",
716
+ onConfigChanged: "onConfigChanged",
717
+ onResized: "onResized",
718
+ onSave: "onSave"
719
+ },
720
+ host: {
721
+ attributes: { "tabindex": "0" },
722
+ properties: {
723
+ "attr.data-size-x": "this.sizeX",
724
+ "attr.data-size-y": "this.sizeY",
725
+ "attr.data-col": "this.col",
726
+ "attr.data-row": "this.row"
727
+ },
728
+ classAttribute: "ax widget-host"
729
+ },
730
+ viewQueries: [{
731
+ propertyName: "vc",
732
+ first: true,
733
+ predicate: ["vc"],
734
+ descendants: true,
735
+ read: ViewContainerRef
736
+ }],
737
+ ngImport: i0,
738
+ template: "<div class='widget-container'>\n @if (!isConfigured) {\n <div class=\"widget-config-overlay\" (click)=\"handleConfig($event)\">\n <div class=\"widget-title\">{{config.title}}</div>\n <div class=\"widget-config-box\">\n <div class=\"config-title\">{{ 'widget-board.configure' | trans}}</div>\n @if (!readonly) {\n <div class=\"config-icon\"><i class=\"fas fa-cogs fa-5x\" aria-hidden=\"true\"></i></div>\n }\n </div>\n </div>\n }\n <div class='widget-edit-overlay' >\n <div class='widget-edit-menu'>\n @if (_hasProps) {\n <button class=\"widget-edit-menu-button\" (click)=\"handleConfig($event)\"\n (mousedown)=\"$event.stopPropagation()\" (mouseup)=\"$event.stopPropagation()\">\n <i class=\"far fa-cogs\" aria-hidden=\"true\"></i>\n </button>\n }\n <button class=\"widget-edit-menu-button\" (click)=\"remove($event)\" (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\">\n <i class=\"far fa-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n </div>\n @if (_hasMenu && !readonly) {\n <div class=\"widget-options-menu\" >\n <ax-menu [items]='configMenuItem' direction=\"horizontal\"></ax-menu>\n </div>\n }\n <!-- <ax-loading-panel [visible]=\"isBusy\">\n</ax-loading-panel> -->\n<div class=\"widget-content\">\n <ng-container #vc></ng-container>\n</div>\n</div>",
739
+ dependencies: [{
740
+ kind: "component",
741
+ type: i1$1.AXMenuComponent,
742
+ selector: "ax-menu",
743
+ inputs: [
744
+ "menuTemplate",
745
+ "rtl",
746
+ "size",
747
+ "selection",
748
+ "mode",
749
+ "target",
750
+ "floatAlignment",
751
+ "floatPlacemnet",
752
+ "direction",
753
+ "items"
754
+ ],
755
+ outputs: ["onItemClick"]
756
+ }, {
757
+ kind: "pipe",
758
+ type: i2.AXTranslatorPipe,
759
+ name: "trans"
760
+ }],
761
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
762
+ encapsulation: i0.ViewEncapsulation.None
763
+ });
764
+ };
765
+ i0.ɵɵngDeclareClassMetadata({
766
+ minVersion: "12.0.0",
767
+ version: "22.2.0",
768
+ ngImport: i0,
769
+ type: AXWidgetHostComponent,
770
+ decorators: [{
771
+ type: Component,
772
+ args: [{
773
+ selector: "ax-widget-host",
774
+ host: {
775
+ class: "ax widget-host",
776
+ tabindex: "0"
777
+ },
778
+ encapsulation: ViewEncapsulation.None,
779
+ changeDetection: ChangeDetectionStrategy.OnPush,
780
+ standalone: false,
781
+ template: "<div class='widget-container'>\n @if (!isConfigured) {\n <div class=\"widget-config-overlay\" (click)=\"handleConfig($event)\">\n <div class=\"widget-title\">{{config.title}}</div>\n <div class=\"widget-config-box\">\n <div class=\"config-title\">{{ 'widget-board.configure' | trans}}</div>\n @if (!readonly) {\n <div class=\"config-icon\"><i class=\"fas fa-cogs fa-5x\" aria-hidden=\"true\"></i></div>\n }\n </div>\n </div>\n }\n <div class='widget-edit-overlay' >\n <div class='widget-edit-menu'>\n @if (_hasProps) {\n <button class=\"widget-edit-menu-button\" (click)=\"handleConfig($event)\"\n (mousedown)=\"$event.stopPropagation()\" (mouseup)=\"$event.stopPropagation()\">\n <i class=\"far fa-cogs\" aria-hidden=\"true\"></i>\n </button>\n }\n <button class=\"widget-edit-menu-button\" (click)=\"remove($event)\" (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\">\n <i class=\"far fa-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n </div>\n @if (_hasMenu && !readonly) {\n <div class=\"widget-options-menu\" >\n <ax-menu [items]='configMenuItem' direction=\"horizontal\"></ax-menu>\n </div>\n }\n <!-- <ax-loading-panel [visible]=\"isBusy\">\n</ax-loading-panel> -->\n<div class=\"widget-content\">\n <ng-container #vc></ng-container>\n</div>\n</div>"
782
+ }]
783
+ }],
784
+ ctorParameters: () => [
785
+ { type: i0.ElementRef },
786
+ { type: i2.AXRenderService },
787
+ { type: i0.ChangeDetectorRef },
788
+ { type: i1$1.AXPopupService },
789
+ { type: i1$1.AXLoadingService }
790
+ ],
791
+ propDecorators: {
792
+ provideValue: [{ type: Input }],
793
+ onRemove: [{ type: Output }],
794
+ onConfigChanged: [{ type: Output }],
795
+ onResized: [{ type: Output }],
796
+ onSave: [{ type: Output }],
797
+ config: [{ type: Input }],
798
+ vc: [{
799
+ type: ViewChild,
800
+ args: ["vc", { read: ViewContainerRef }]
801
+ }],
802
+ readonly: [{ type: Input }],
803
+ sizeX: [{
804
+ type: HostBinding,
805
+ args: ["attr.data-size-x"]
806
+ }, { type: Input }],
807
+ sizeY: [{
808
+ type: HostBinding,
809
+ args: ["attr.data-size-y"]
810
+ }, { type: Input }],
811
+ col: [{
812
+ type: HostBinding,
813
+ args: ["attr.data-col"]
814
+ }, { type: Input }],
815
+ row: [{
816
+ type: HostBinding,
817
+ args: ["attr.data-row"]
818
+ }, { type: Input }]
819
+ }
820
+ });
821
+ var AXWidgetBoardComponent = class AXWidgetBoardComponent {
822
+ ref;
823
+ zone;
824
+ cdr;
825
+ container;
826
+ widgetHosts;
827
+ widgets = [];
828
+ galleryItems = [];
829
+ tileSize = 80;
830
+ gapSize = 5;
831
+ readonly = false;
832
+ newWidget = null;
833
+ rtl;
834
+ _isInEditing = false;
835
+ isInEditing() {
836
+ return this._isInEditing;
837
+ }
838
+ isDragging = false;
839
+ dragItem;
840
+ saveSubject = new Subject();
841
+ provideValue;
842
+ DATA_COL = "data-col";
843
+ DATA_ROW = "data-row";
844
+ DATA_SIZE_X = "data-size-x";
845
+ DATA_SIZE_Y = "data-size-y";
846
+ DATA_OLD_COL = "data-old-col";
847
+ DATA_OLD_ROW = "data-old-row";
848
+ onConfigChanged = new EventEmitter();
849
+ onWidgetSave = new EventEmitter();
850
+ constructor(ref, zone, cdr) {
851
+ this.ref = ref;
852
+ this.zone = zone;
853
+ this.cdr = cdr;
854
+ }
855
+ ngOnInit() {
856
+ if (this.rtl == null) this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue("direction") === "rtl";
857
+ this.saveSubject.pipe(debounceTime(750)).subscribe((value) => {
858
+ this.emitConfigChanged(value);
859
+ });
860
+ }
861
+ ngOnDestroy() {
862
+ this.saveSubject?.unsubscribe();
863
+ }
864
+ ngAfterViewInit() {
865
+ this.zone.runOutsideAngular((c) => {
866
+ const style = document.createElement("style");
867
+ style.type = "text/css";
868
+ this.ref.nativeElement.appendChild(style);
869
+ for (let i = 1; i <= 50; i++) {
870
+ style.innerHTML += `[${this.DATA_COL}="${i}"] { ${this.rtl ? "right" : "left"}: ${(i - 1) * (this.tileSize + this.gapSize)}px; }`;
871
+ style.innerHTML += `[${this.DATA_ROW}="${i}"] { top: ${(i - 1) * (this.tileSize + this.gapSize)}px; }`;
872
+ style.innerHTML += `[${this.DATA_SIZE_X}="${i}"] { width: ${i * this.tileSize + (i - 1) * this.gapSize}px; }`;
873
+ style.innerHTML += `[${this.DATA_SIZE_Y}="${i}"] { height: ${i * this.tileSize + (i - 1) * this.gapSize}px; }`;
874
+ }
875
+ });
876
+ }
877
+ calcGridSize() {
878
+ this.zone.runOutsideAngular(() => {
879
+ const width = Math.max(...this.widgets.map((c) => c.col + c.sizeX - 1)) * (this.tileSize + this.gapSize);
880
+ const height = Math.max(...this.widgets.map((c) => c.row + c.sizeY - 1)) * (this.tileSize + this.gapSize);
881
+ this.container.nativeElement.style.width = width + "px";
882
+ this.container.nativeElement.style.height = height + "px";
883
+ });
884
+ }
885
+ toggleEdit() {
886
+ this._isInEditing ? this.finishEdit() : this.startEdit();
887
+ }
888
+ dragStart(e) {
889
+ e.preventDefault();
890
+ e.stopPropagation();
891
+ this.zone.runOutsideAngular(() => {
892
+ if (this._isInEditing && e.which === 1) {
893
+ this.dragItem = e.currentTarget;
894
+ this.dragItem.setAttribute("data-x-offset", (this.dragItem.offsetLeft - e.clientX).toString());
895
+ this.dragItem.setAttribute("data-y-offset", (this.dragItem.offsetTop - e.clientY).toString());
896
+ this.dragItem.classList.add("widget-dragging");
897
+ this.dragItem.classList.remove("animate__animated", "animate__pulse");
898
+ }
899
+ });
900
+ return false;
901
+ }
902
+ removePositionData() {
903
+ this.zone.runOutsideAngular(() => {
904
+ if (this.dragItem && this._isInEditing && this.dragItem.getAttribute(this.DATA_OLD_COL) == null) {
905
+ this.dragItem.setAttribute(this.DATA_OLD_COL, this.dragItem.getAttribute(this.DATA_COL));
906
+ this.dragItem.setAttribute(this.DATA_OLD_ROW, this.dragItem.getAttribute(this.DATA_ROW));
907
+ this.dragItem.removeAttribute(this.DATA_COL);
908
+ this.dragItem.removeAttribute(this.DATA_ROW);
909
+ }
910
+ });
911
+ }
912
+ resetPositionData() {
913
+ this.zone.runOutsideAngular(() => {
914
+ if (this.dragItem && this._isInEditing) this.setPosition(this.dragItem, this.dragItem.getAttribute(this.DATA_OLD_COL), this.dragItem.getAttribute(this.DATA_OLD_ROW));
915
+ });
916
+ }
917
+ setPosition(element, col, row) {
918
+ this.zone.runOutsideAngular(() => {
919
+ element.setAttribute(this.DATA_COL, col);
920
+ element.setAttribute(this.DATA_ROW, row);
921
+ element.removeAttribute(this.DATA_OLD_COL);
922
+ element.removeAttribute(this.DATA_OLD_ROW);
923
+ element.style.removeProperty("top");
924
+ element.style.removeProperty("left");
925
+ const widget = this.widgets.find((c) => c["__meta__"].instance.element === element);
926
+ widget.col = Number(col);
927
+ widget.row = Number(row);
928
+ });
929
+ }
930
+ drag(e) {
931
+ e.preventDefault();
932
+ e.stopPropagation();
933
+ this.zone.runOutsideAngular(() => {
934
+ if (this.dragItem && this._isInEditing) {
935
+ this.isDragging = true;
936
+ this.addPlaceholder();
937
+ const xOffset = Number(this.dragItem.getAttribute("data-x-offset"));
938
+ const yOffset = Number(this.dragItem.getAttribute("data-y-offset"));
939
+ this.dragItem.style.left = e.clientX + xOffset + "px";
940
+ this.dragItem.style.top = e.clientY + yOffset + "px";
941
+ this.detectBestPlacement();
942
+ this.removePositionData();
943
+ }
944
+ });
945
+ return false;
946
+ }
947
+ dragEnd(e) {
948
+ this.zone.runOutsideAngular(() => {
949
+ if (this.dragItem && this._isInEditing && this.isDragging) {
950
+ this.dragItem.classList.remove("widget-dragging");
951
+ this.dragItem.classList.add("animate__animated", "animate__pulse");
952
+ const p = this.container.nativeElement.querySelector(".widget-blank-placeholder");
953
+ if (this.newWidget) {
954
+ const w = {
955
+ uniqueName: this.newWidget.uniqueName,
956
+ component: this.newWidget.component,
957
+ title: this.newWidget.title,
958
+ options: this.newWidget.options,
959
+ sizeX: this.newWidget.sizeX,
960
+ sizeY: this.newWidget.sizeY,
961
+ col: Number(p.getAttribute(this.DATA_COL)),
962
+ row: Number(p.getAttribute(this.DATA_ROW))
963
+ };
964
+ this.widgets.push(w);
965
+ this.newWidget = null;
966
+ this.container.nativeElement.removeChild(this.dragItem);
967
+ this.zone.run(() => {
968
+ this.cdr.detectChanges();
969
+ this.calcGridSize();
970
+ setTimeout(() => {
971
+ w["__meta__"].instance.element.addEventListener("mousedown", this.dragStart.bind(this), false);
972
+ }, 1e3);
973
+ });
974
+ } else if (p) this.setPosition(this.dragItem, p.getAttribute(this.DATA_COL), p.getAttribute(this.DATA_ROW));
975
+ else this.setPosition(this.dragItem, this.dragItem.getAttribute(this.DATA_OLD_COL), this.dragItem.getAttribute(this.DATA_OLD_ROW));
976
+ this.removePlaceholder();
977
+ this.dragItem = null;
978
+ this.calcGridSize();
979
+ this.saveSubject.next("config");
980
+ }
981
+ this.isDragging = false;
982
+ });
983
+ }
984
+ detectFirstEmptySlot(w) {
985
+ const xTile = Math.floor(this.ref.nativeElement.parentElement.offsetWidth / this.tileSize);
986
+ for (let j = 1; j <= 100; j++) for (let i = 1; i <= xTile - w.sizeX; i++) {
987
+ const rec = new AXClientRec({
988
+ left: i,
989
+ top: j,
990
+ width: w.sizeX,
991
+ height: w.sizeY
992
+ });
993
+ if (this.widgets.filter((c) => c !== w).find((c) => rec.intersect({
994
+ left: c.col,
995
+ top: c.row,
996
+ width: c.sizeX,
997
+ height: c.sizeY
998
+ })) == null) {
999
+ w.col = i;
1000
+ w.row = j;
1001
+ return;
1002
+ }
1003
+ }
1004
+ }
1005
+ detectBestPlacement() {
1006
+ this.zone.runOutsideAngular(() => {
1007
+ const p = this.container.nativeElement.querySelector(".widget-blank-placeholder");
1008
+ let col = Math.ceil(this.dragItem.offsetLeft / this.tileSize);
1009
+ if (this.rtl) col = Math.ceil((this.container.nativeElement.clientWidth - (this.dragItem.offsetLeft + this.dragItem.clientWidth)) / this.tileSize);
1010
+ let row = Math.ceil(this.dragItem.offsetTop / this.tileSize);
1011
+ if (col < 1) col = 1;
1012
+ if (row < 1) row = 1;
1013
+ const widgets = Array.from(this.ref.nativeElement.querySelectorAll(".widget-host")).map((c) => c);
1014
+ p.setAttribute(this.DATA_COL, col.toString());
1015
+ p.setAttribute(this.DATA_ROW, row.toString());
1016
+ if (widgets.filter((c) => c !== this.dragItem).some((c) => AXHtmlUtil.collision(c, this.dragItem))) this.removePlaceholder();
1017
+ });
1018
+ }
1019
+ addPlaceholder() {
1020
+ this.zone.runOutsideAngular(() => {
1021
+ this.removePlaceholder();
1022
+ if (this.dragItem) {
1023
+ const p = document.createElement("div");
1024
+ p.classList.add("widget-blank-placeholder");
1025
+ p.setAttribute(this.DATA_COL, this.dragItem.getAttribute(this.DATA_COL));
1026
+ p.setAttribute(this.DATA_ROW, this.dragItem.getAttribute(this.DATA_ROW));
1027
+ p.setAttribute(this.DATA_SIZE_X, this.dragItem.getAttribute(this.DATA_SIZE_X));
1028
+ p.setAttribute(this.DATA_SIZE_Y, this.dragItem.getAttribute(this.DATA_SIZE_Y));
1029
+ this.container.nativeElement.appendChild(p);
1030
+ }
1031
+ });
1032
+ }
1033
+ removePlaceholder() {
1034
+ this.container.nativeElement.querySelector(".widget-blank-placeholder")?.remove();
1035
+ }
1036
+ startEdit() {
1037
+ this._isInEditing = true;
1038
+ this.calcGridSize();
1039
+ this.ref.nativeElement.classList.add("grid-background");
1040
+ const bg = this.ref.nativeElement;
1041
+ bg.style.setProperty("background-position", `${this.rtl ? "right" : "left"} top`);
1042
+ const pattern = `url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${this.tileSize + this.gapSize}" height="${this.tileSize + this.gapSize}"> <rect style="fill: %23dadada" x="${this.rtl ? this.gapSize : 0}" width="${this.tileSize}" height="${this.tileSize}" y="0"></rect></svg>')`;
1043
+ bg.style.setProperty("background-image", pattern);
1044
+ Array.from(this.ref.nativeElement.querySelectorAll(".widget-host")).forEach((w) => {
1045
+ w.addEventListener("mousedown", this.dragStart.bind(this), false);
1046
+ });
1047
+ this.ref.nativeElement.addEventListener("mousemove", this.drag.bind(this), false);
1048
+ this.ref.nativeElement.addEventListener("mouseup", this.dragEnd.bind(this), false);
1049
+ }
1050
+ finishEdit() {
1051
+ this.ref.nativeElement.classList.remove("grid-background");
1052
+ this.ref.nativeElement.style.removeProperty("background-image");
1053
+ this._isInEditing = false;
1054
+ Array.from(this.ref.nativeElement.querySelectorAll(".widget-host")).forEach((w) => {
1055
+ w.removeEventListener("mousedown", this.dragStart.bind(this), false);
1056
+ });
1057
+ this.ref.nativeElement.removeEventListener("mousemove", this.drag.bind(this), false);
1058
+ this.ref.nativeElement.removeEventListener("mouseup", this.dragEnd.bind(this), false);
1059
+ this.saveSubject.next("config");
1060
+ }
1061
+ addWidget(widget) {
1062
+ this.zone.runOutsideAngular(() => {
1063
+ this.newWidget = {
1064
+ uniqueName: widget.uniqueName,
1065
+ component: widget.component,
1066
+ title: widget.title,
1067
+ col: 1,
1068
+ row: 1,
1069
+ sizeX: widget.sizeX,
1070
+ sizeY: widget.sizeY,
1071
+ options: widget.options,
1072
+ props: widget.props
1073
+ };
1074
+ this.detectFirstEmptySlot(this.newWidget);
1075
+ const w = {
1076
+ uniqueName: this.newWidget.uniqueName,
1077
+ component: this.newWidget.component,
1078
+ title: this.newWidget.title,
1079
+ options: this.newWidget.options,
1080
+ props: this.newWidget.props,
1081
+ sizeX: this.newWidget.sizeX,
1082
+ sizeY: this.newWidget.sizeY,
1083
+ col: this.newWidget.col,
1084
+ row: this.newWidget.row
1085
+ };
1086
+ this.widgets.push(w);
1087
+ this.newWidget = null;
1088
+ this.zone.run(() => {
1089
+ this.cdr.detectChanges();
1090
+ this.calcGridSize();
1091
+ this.emitConfigChanged("add");
1092
+ setTimeout(() => {
1093
+ w["__meta__"].instance.element.addEventListener("mousedown", this.dragStart.bind(this), false);
1094
+ }, 1e3);
1095
+ });
1096
+ });
1097
+ }
1098
+ handleOnRemove(w) {
1099
+ w.element.classList.add("animate__animated", "animate__zoomOut");
1100
+ w.element.addEventListener("animationend", () => {
1101
+ this.widgets = this.widgets.filter((c) => c.__meta__.id !== w.config.__meta__.id);
1102
+ this.cdr.detectChanges();
1103
+ this.calcGridSize();
1104
+ this.emitConfigChanged("remove");
1105
+ });
1106
+ }
1107
+ handleOnSave(e) {
1108
+ this.onWidgetSave.emit(e);
1109
+ }
1110
+ trackByFn(index, item) {
1111
+ if (!item["__meta__"]?.id) {
1112
+ item["__meta__"] = {};
1113
+ item["__meta__"].id = AXHtmlUtil.getUID();
1114
+ }
1115
+ return item["__meta__"]?.id;
1116
+ }
1117
+ load(widgets) {
1118
+ this.clear();
1119
+ return new Promise((resolve, reject) => {
1120
+ if (widgets) {
1121
+ const loadedWidgets = [];
1122
+ if (typeof widgets === "string") try {
1123
+ loadedWidgets.push(...JSON.parse(widgets));
1124
+ this.emitConfigChanged("load");
1125
+ } catch (error) {
1126
+ reject("Invalid widget json data!");
1127
+ }
1128
+ else {
1129
+ loadedWidgets.push(...widgets);
1130
+ this.emitConfigChanged("load");
1131
+ }
1132
+ let intervalId = -1;
1133
+ const loadFunc = () => {
1134
+ if (this.galleryItems && this.galleryItems.length > 0) {
1135
+ loadedWidgets.forEach((w) => {
1136
+ const gitem = this.galleryItems.find((c) => c.uniqueName === w.uniqueName);
1137
+ if (gitem) {
1138
+ w.component = gitem.component;
1139
+ if (gitem.props) w.props = JSON.parse(JSON.stringify(gitem.props));
1140
+ }
1141
+ });
1142
+ this.widgets.push(...loadedWidgets);
1143
+ this.emitConfigChanged("load");
1144
+ window.clearInterval(intervalId);
1145
+ this.cdr.detectChanges();
1146
+ resolve();
1147
+ }
1148
+ };
1149
+ intervalId = window.setInterval(loadFunc, 200);
1150
+ } else resolve();
1151
+ });
1152
+ }
1153
+ clear() {
1154
+ if (this.widgets.length) {
1155
+ this.widgets = [];
1156
+ this.cdr.detectChanges();
1157
+ this.saveSubject.next("clear");
1158
+ }
1159
+ }
1160
+ save() {
1161
+ const obj = this.widgets.map((c) => ({
1162
+ uniqueName: c.uniqueName,
1163
+ component: c.component,
1164
+ title: c.title,
1165
+ sizeX: c.sizeX,
1166
+ sizeY: c.sizeY,
1167
+ col: c.col,
1168
+ row: c.row,
1169
+ options: c.options,
1170
+ props: c.props
1171
+ }));
1172
+ return Promise.resolve(JSON.stringify(obj));
1173
+ }
1174
+ refresh() {
1175
+ this.widgetHosts.forEach((host) => {
1176
+ host.widget.refresh();
1177
+ });
1178
+ }
1179
+ handleOnConfigChanged(e) {
1180
+ this.cdr.detectChanges();
1181
+ this.saveSubject.next("config");
1182
+ }
1183
+ handleOnResizedChanged(e) {
1184
+ this.detectFirstEmptySlot(e.config);
1185
+ this.cdr.detectChanges();
1186
+ this.saveSubject.next("config");
1187
+ }
1188
+ emitConfigChanged(mode) {
1189
+ this.onConfigChanged.emit({
1190
+ component: this,
1191
+ mode
1192
+ });
1193
+ }
1194
+ static ɵfac = i0.ɵɵngDeclareFactory({
1195
+ minVersion: "12.0.0",
1196
+ version: "22.2.0",
1197
+ ngImport: i0,
1198
+ type: AXWidgetBoardComponent,
1199
+ deps: [
1200
+ { token: i0.ElementRef },
1201
+ { token: i0.NgZone },
1202
+ { token: i0.ChangeDetectorRef }
1203
+ ],
1204
+ target: i0.ɵɵFactoryTarget.Component
1205
+ });
1206
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1207
+ minVersion: "17.0.0",
1208
+ version: "22.2.0",
1209
+ type: AXWidgetBoardComponent,
1210
+ isStandalone: false,
1211
+ selector: "ax-widget-board",
1212
+ inputs: {
1213
+ galleryItems: "galleryItems",
1214
+ tileSize: "tileSize",
1215
+ gapSize: "gapSize",
1216
+ readonly: "readonly",
1217
+ provideValue: "provideValue"
1218
+ },
1219
+ outputs: {
1220
+ onConfigChanged: "onConfigChanged",
1221
+ onWidgetSave: "onWidgetSave"
1222
+ },
1223
+ host: { classAttribute: "ax widget-board" },
1224
+ viewQueries: [{
1225
+ propertyName: "container",
1226
+ first: true,
1227
+ predicate: ["container"],
1228
+ descendants: true
1229
+ }, {
1230
+ propertyName: "widgetHosts",
1231
+ predicate: AXWidgetHostComponent,
1232
+ descendants: true
1233
+ }],
1234
+ ngImport: i0,
1235
+ template: "<div class=\"widgets-container\" [class.rtl]=\"rtl\" #container>\n @for (w of widgets; track trackByFn($index, w)) {\n <ax-widget-host [config]='w' [sizeX]=\"w.sizeX\" [readonly]=\"readonly || w.readonly\"\n [sizeY]=\"w.sizeY\" [col]=\"w.col\" [row]=\"w.row\" (onRemove)=\"handleOnRemove($event)\" (onSave)=\"handleOnSave($event)\"\n (onConfigChanged)=\"handleOnConfigChanged($event)\" (onResized)=\"handleOnResizedChanged($event)\"\n [provideValue]=\"provideValue\">\n </ax-widget-host>\n }\n</div>\n",
1236
+ styles: [".widget-board{overflow:scroll;scrollbar-width:thin;display:inline-block;margin:15px 20px;min-width:calc(100% - 18px);min-height:calc(100% - 18px);--animate-duration: .5s;background-repeat:no-repeat}.widget-board.grid-background{background-repeat:repeat!important}.widget-board.grid-background .widgets-container .widget-host{touch-action:none}.widget-board.grid-background .widgets-container .widget-host .widget-edit-overlay{display:block;cursor:move}.widget-board.grid-background .widgets-container .widget-host.widget-dragging{z-index:1000}.widget-board.grid-background .widgets-container .widget-host:focus{outline-width:1px;outline-style:solid;outline-color:var(--ax-primary-color)}.widget-board.grid-background .widgets-container .widget-host{touch-action:none;-webkit-user-select:none;user-select:none}.widget-board.grid-background .widget-blank-placeholder{background:var(--ax-primary-trans-light-color);position:absolute}.widget-board .widgets-container{position:relative;touch-action:none}.widget-board .widgets-container.rtl .widget-host .widget-options-menu{right:unset!important;left:0!important}.widget-board .widgets-container .widget-host{position:absolute;background:#fff;box-shadow:2px 2px 3px #dadada}.widget-board .widgets-container .widget-host .widget-content{width:100%;height:100%;display:flex;flex-direction:column}.widget-board .widgets-container .widget-host .widget-content .widget-title{padding:var(--ax-size-md);text-align:start;font-size:1.5em;position:absolute}.widget-board .widgets-container .widget-host .widget-edit-loading{display:none;background:#ffffffd9;position:absolute;width:100%;height:100%;top:0;left:0;z-index:2;display:flex}.widget-board .widgets-container .widget-host .widget-config-overlay{position:absolute;background:#fff;width:100%;height:100%;top:0;left:0;z-index:1;padding:var(--ax-size-md);cursor:pointer}.widget-board .widgets-container .widget-host .widget-config-overlay:hover .widget-title{text-decoration:underline}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-title{text-align:start;font-size:1.5em}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-config-box{align-self:center;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(--ax-gray-dark-color)}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-config-box .config-title{font-size:1.2em;margin-bottom:var(--ax-size-md)}.widget-board .widgets-container .widget-host .widget-edit-overlay{display:none;background:#ffffff80;position:absolute;width:100%;height:100%;top:0;left:0;z-index:10}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu{margin:6px;text-align:end;float:inline-end;opacity:1;transition:opacity 1s ease}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button{display:inline-block;background-color:#f0f0f0;border-radius:1px;border:2px solid #fff;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:0;height:32px;width:32px;cursor:pointer;color:#666}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button:hover{border-color:#a6a6a6;background-color:#c8c8c8}.widget-board .widgets-container .widget-host .widget-options-menu{display:none;position:absolute;top:0;right:0;z-index:2;cursor:pointer;padding:2px 5px}.widget-board .widgets-container .widget-host .widget-options-menu:hover{background-color:#f0f0f0}.widget-board .widgets-container .widget-host .widget-container{padding:1px;height:100%}.widget-board .widgets-container .widget-host .widget-container:hover .widget-options-menu{display:block}\n"],
1237
+ dependencies: [{
1238
+ kind: "component",
1239
+ type: AXWidgetHostComponent,
1240
+ selector: "ax-widget-host",
1241
+ inputs: [
1242
+ "provideValue",
1243
+ "config",
1244
+ "readonly",
1245
+ "sizeX",
1246
+ "sizeY",
1247
+ "col",
1248
+ "row"
1249
+ ],
1250
+ outputs: [
1251
+ "onRemove",
1252
+ "onConfigChanged",
1253
+ "onResized",
1254
+ "onSave"
1255
+ ]
1256
+ }],
1257
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1258
+ encapsulation: i0.ViewEncapsulation.None
1259
+ });
1260
+ };
1261
+ i0.ɵɵngDeclareClassMetadata({
1262
+ minVersion: "12.0.0",
1263
+ version: "22.2.0",
1264
+ ngImport: i0,
1265
+ type: AXWidgetBoardComponent,
1266
+ decorators: [{
1267
+ type: Component,
1268
+ args: [{
1269
+ selector: "ax-widget-board",
1270
+ host: { class: "ax widget-board" },
1271
+ encapsulation: ViewEncapsulation.None,
1272
+ changeDetection: ChangeDetectionStrategy.OnPush,
1273
+ standalone: false,
1274
+ template: "<div class=\"widgets-container\" [class.rtl]=\"rtl\" #container>\n @for (w of widgets; track trackByFn($index, w)) {\n <ax-widget-host [config]='w' [sizeX]=\"w.sizeX\" [readonly]=\"readonly || w.readonly\"\n [sizeY]=\"w.sizeY\" [col]=\"w.col\" [row]=\"w.row\" (onRemove)=\"handleOnRemove($event)\" (onSave)=\"handleOnSave($event)\"\n (onConfigChanged)=\"handleOnConfigChanged($event)\" (onResized)=\"handleOnResizedChanged($event)\"\n [provideValue]=\"provideValue\">\n </ax-widget-host>\n }\n</div>\n",
1275
+ styles: [".widget-board{overflow:scroll;scrollbar-width:thin;display:inline-block;margin:15px 20px;min-width:calc(100% - 18px);min-height:calc(100% - 18px);--animate-duration: .5s;background-repeat:no-repeat}.widget-board.grid-background{background-repeat:repeat!important}.widget-board.grid-background .widgets-container .widget-host{touch-action:none}.widget-board.grid-background .widgets-container .widget-host .widget-edit-overlay{display:block;cursor:move}.widget-board.grid-background .widgets-container .widget-host.widget-dragging{z-index:1000}.widget-board.grid-background .widgets-container .widget-host:focus{outline-width:1px;outline-style:solid;outline-color:var(--ax-primary-color)}.widget-board.grid-background .widgets-container .widget-host{touch-action:none;-webkit-user-select:none;user-select:none}.widget-board.grid-background .widget-blank-placeholder{background:var(--ax-primary-trans-light-color);position:absolute}.widget-board .widgets-container{position:relative;touch-action:none}.widget-board .widgets-container.rtl .widget-host .widget-options-menu{right:unset!important;left:0!important}.widget-board .widgets-container .widget-host{position:absolute;background:#fff;box-shadow:2px 2px 3px #dadada}.widget-board .widgets-container .widget-host .widget-content{width:100%;height:100%;display:flex;flex-direction:column}.widget-board .widgets-container .widget-host .widget-content .widget-title{padding:var(--ax-size-md);text-align:start;font-size:1.5em;position:absolute}.widget-board .widgets-container .widget-host .widget-edit-loading{display:none;background:#ffffffd9;position:absolute;width:100%;height:100%;top:0;left:0;z-index:2;display:flex}.widget-board .widgets-container .widget-host .widget-config-overlay{position:absolute;background:#fff;width:100%;height:100%;top:0;left:0;z-index:1;padding:var(--ax-size-md);cursor:pointer}.widget-board .widgets-container .widget-host .widget-config-overlay:hover .widget-title{text-decoration:underline}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-title{text-align:start;font-size:1.5em}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-config-box{align-self:center;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(--ax-gray-dark-color)}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-config-box .config-title{font-size:1.2em;margin-bottom:var(--ax-size-md)}.widget-board .widgets-container .widget-host .widget-edit-overlay{display:none;background:#ffffff80;position:absolute;width:100%;height:100%;top:0;left:0;z-index:10}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu{margin:6px;text-align:end;float:inline-end;opacity:1;transition:opacity 1s ease}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button{display:inline-block;background-color:#f0f0f0;border-radius:1px;border:2px solid #fff;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:0;height:32px;width:32px;cursor:pointer;color:#666}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button:hover{border-color:#a6a6a6;background-color:#c8c8c8}.widget-board .widgets-container .widget-host .widget-options-menu{display:none;position:absolute;top:0;right:0;z-index:2;cursor:pointer;padding:2px 5px}.widget-board .widgets-container .widget-host .widget-options-menu:hover{background-color:#f0f0f0}.widget-board .widgets-container .widget-host .widget-container{padding:1px;height:100%}.widget-board .widgets-container .widget-host .widget-container:hover .widget-options-menu{display:block}\n"]
1276
+ }]
1277
+ }],
1278
+ ctorParameters: () => [
1279
+ { type: i0.ElementRef },
1280
+ { type: i0.NgZone },
1281
+ { type: i0.ChangeDetectorRef }
1282
+ ],
1283
+ propDecorators: {
1284
+ container: [{
1285
+ type: ViewChild,
1286
+ args: ["container"]
1287
+ }],
1288
+ widgetHosts: [{
1289
+ type: ViewChildren,
1290
+ args: [AXWidgetHostComponent]
1291
+ }],
1292
+ galleryItems: [{ type: Input }],
1293
+ tileSize: [{ type: Input }],
1294
+ gapSize: [{ type: Input }],
1295
+ readonly: [{ type: Input }],
1296
+ provideValue: [{ type: Input }],
1297
+ onConfigChanged: [{ type: Output }],
1298
+ onWidgetSave: [{ type: Output }]
1299
+ }
1300
+ });
1301
+ var AXWidgetSizePropertyEditorComponent = class AXWidgetSizePropertyEditorComponent extends AXProperyEditorComponent {
1302
+ cdr;
1303
+ sizeX;
1304
+ sizeY;
1305
+ minX = 1;
1306
+ maxX = 20;
1307
+ minY = 1;
1308
+ maxY = 20;
1309
+ constructor(cdr) {
1310
+ super(cdr);
1311
+ this.cdr = cdr;
1312
+ }
1313
+ ngOnInit() {
1314
+ if (Array.isArray(this.value)) {
1315
+ this.sizeX = this.value[0];
1316
+ this.sizeY = this.value[1];
1317
+ } else {
1318
+ this.sizeX = 2;
1319
+ this.sizeY = 2;
1320
+ }
1321
+ }
1322
+ handleMinValueChange(e) {
1323
+ this.sizeX = e.value;
1324
+ if (this.sizeY > 0) super.handleValueChange([this.sizeX, this.sizeY]);
1325
+ }
1326
+ handleMaxValueChange(e) {
1327
+ this.sizeY = e.value;
1328
+ if (this.sizeX > 0) super.handleValueChange([this.sizeX, this.sizeY]);
1329
+ }
1330
+ ngAfterViewInit() {
1331
+ this.onRenderCompleted.emit();
1332
+ }
1333
+ static ɵfac = i0.ɵɵngDeclareFactory({
1334
+ minVersion: "12.0.0",
1335
+ version: "22.2.0",
1336
+ ngImport: i0,
1337
+ type: AXWidgetSizePropertyEditorComponent,
1338
+ deps: [{ token: i0.ChangeDetectorRef }],
1339
+ target: i0.ɵɵFactoryTarget.Component
1340
+ });
1341
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1342
+ minVersion: "14.0.0",
1343
+ version: "22.2.0",
1344
+ type: AXWidgetSizePropertyEditorComponent,
1345
+ isStandalone: false,
1346
+ selector: "ng-component",
1347
+ usesInheritance: true,
1348
+ ngImport: i0,
1349
+ template: "<div style=\"display: grid;grid-gap: 2%; grid-template-columns: 49% 49%;\">\n <ax-number-box (onValueChanged)=\"handleMinValueChange($event)\" [value]=\"sizeX\" [min]=\"minX\" [max]=\"maxX\">\n </ax-number-box>\n <ax-number-box (onValueChanged)=\"handleMaxValueChange($event)\" [value]=\"sizeY\" [min]=\"minY\" [max]=\"maxY\">\n </ax-number-box>\n</div>",
1350
+ dependencies: [{
1351
+ kind: "component",
1352
+ type: i1$1.AXNumberBoxComponent,
1353
+ selector: "ax-number-box",
1354
+ inputs: [
1355
+ "min",
1356
+ "max",
1357
+ "showSeparator",
1358
+ "showCurrency",
1359
+ "showCounter",
1360
+ "scrollWeel",
1361
+ "showDoubleCounter",
1362
+ "maxLength",
1363
+ "intStep",
1364
+ "decimalNumber",
1365
+ "customStep"
1366
+ ]
1367
+ }],
1368
+ changeDetection: i0.ChangeDetectionStrategy.Eager
1369
+ });
1370
+ };
1371
+ i0.ɵɵngDeclareClassMetadata({
1372
+ minVersion: "12.0.0",
1373
+ version: "22.2.0",
1374
+ ngImport: i0,
1375
+ type: AXWidgetSizePropertyEditorComponent,
1376
+ decorators: [{
1377
+ type: Component,
1378
+ args: [{
1379
+ changeDetection: ChangeDetectionStrategy.Eager,
1380
+ standalone: false,
1381
+ template: "<div style=\"display: grid;grid-gap: 2%; grid-template-columns: 49% 49%;\">\n <ax-number-box (onValueChanged)=\"handleMinValueChange($event)\" [value]=\"sizeX\" [min]=\"minX\" [max]=\"maxX\">\n </ax-number-box>\n <ax-number-box (onValueChanged)=\"handleMaxValueChange($event)\" [value]=\"sizeY\" [min]=\"minY\" [max]=\"maxY\">\n </ax-number-box>\n</div>"
1382
+ }]
1383
+ }],
1384
+ ctorParameters: () => [{ type: i0.ChangeDetectorRef }]
1385
+ });
1386
+ var AXWidgetBoardModule = class AXWidgetBoardModule {
1387
+ constructor() {
1388
+ AXTranslator.load("en", { "widget-board": {
1389
+ "configurable-props": "Configurable Properties",
1390
+ configure: "Configure Widget"
1391
+ } });
1392
+ AXTranslator.load("fa", { "widget-board": {
1393
+ "configurable-props": "ویژگی های قابل تنظیم",
1394
+ configure: "پیکر بندی ابزارک"
1395
+ } });
1396
+ }
1397
+ static ɵfac = i0.ɵɵngDeclareFactory({
1398
+ minVersion: "12.0.0",
1399
+ version: "22.2.0",
1400
+ ngImport: i0,
1401
+ type: AXWidgetBoardModule,
1402
+ deps: [],
1403
+ target: i0.ɵɵFactoryTarget.NgModule
1404
+ });
1405
+ static ɵmod = i0.ɵɵngDeclareNgModule({
1406
+ minVersion: "14.0.0",
1407
+ version: "22.2.0",
1408
+ ngImport: i0,
1409
+ type: AXWidgetBoardModule,
1410
+ declarations: [
1411
+ AXWidgetBoardComponent,
1412
+ AXWidgetHostComponent,
1413
+ AXWidgetConfigComponent,
1414
+ AXWidgetSaveComponent
1415
+ ],
1416
+ imports: [
1417
+ CommonModule,
1418
+ AXSearchBoxModule,
1419
+ AXLoadingModule,
1420
+ RouterModule,
1421
+ AXProppertyEditorModule,
1422
+ AXPageModule,
1423
+ AXToolbarModule,
1424
+ AXTranslatorModule,
1425
+ AXLabelModule,
1426
+ AXTextAreaModule,
1427
+ AXFieldsetModule,
1428
+ AXTextBoxModule,
1429
+ AXFormGroupModule,
1430
+ AXTabStripModule,
1431
+ AXCheckBoxModule,
1432
+ AXMenuModule,
1433
+ AXTranslatorModule,
1434
+ AXValidationModule,
1435
+ i1.RouterModule
1436
+ ],
1437
+ exports: [AXWidgetBoardComponent, AXProppertyEditorModule]
1438
+ });
1439
+ static ɵinj = i0.ɵɵngDeclareInjector({
1440
+ minVersion: "12.0.0",
1441
+ version: "22.2.0",
1442
+ ngImport: i0,
1443
+ type: AXWidgetBoardModule,
1444
+ imports: [
1445
+ CommonModule,
1446
+ AXSearchBoxModule,
1447
+ AXLoadingModule,
1448
+ RouterModule,
1449
+ AXProppertyEditorModule,
1450
+ AXPageModule,
1451
+ AXToolbarModule,
1452
+ AXTranslatorModule,
1453
+ AXLabelModule,
1454
+ AXTextAreaModule,
1455
+ AXFieldsetModule,
1456
+ AXTextBoxModule,
1457
+ AXFormGroupModule,
1458
+ AXTabStripModule,
1459
+ AXCheckBoxModule,
1460
+ AXMenuModule,
1461
+ AXTranslatorModule,
1462
+ AXValidationModule,
1463
+ RouterModule.forChild([{
1464
+ component: AXWidgetSizePropertyEditorComponent,
1465
+ path: "ax/editors/widget-size"
1466
+ }]),
1467
+ AXProppertyEditorModule
1468
+ ]
1469
+ });
1470
+ };
1471
+ i0.ɵɵngDeclareClassMetadata({
1472
+ minVersion: "12.0.0",
1473
+ version: "22.2.0",
1474
+ ngImport: i0,
1475
+ type: AXWidgetBoardModule,
1476
+ decorators: [{
1477
+ type: NgModule,
1478
+ args: [{
1479
+ imports: [
1480
+ CommonModule,
1481
+ AXSearchBoxModule,
1482
+ AXLoadingModule,
1483
+ RouterModule,
1484
+ AXProppertyEditorModule,
1485
+ AXPageModule,
1486
+ AXToolbarModule,
1487
+ AXTranslatorModule,
1488
+ AXLabelModule,
1489
+ AXTextAreaModule,
1490
+ AXFieldsetModule,
1491
+ AXTextBoxModule,
1492
+ AXFormGroupModule,
1493
+ AXTabStripModule,
1494
+ AXCheckBoxModule,
1495
+ AXMenuModule,
1496
+ AXTranslatorModule,
1497
+ AXValidationModule,
1498
+ RouterModule.forChild([{
1499
+ component: AXWidgetSizePropertyEditorComponent,
1500
+ path: "ax/editors/widget-size"
1501
+ }])
1502
+ ],
1503
+ exports: [AXWidgetBoardComponent, AXProppertyEditorModule],
1504
+ declarations: [
1505
+ AXWidgetBoardComponent,
1506
+ AXWidgetHostComponent,
1507
+ AXWidgetConfigComponent,
1508
+ AXWidgetSaveComponent
1509
+ ],
1510
+ providers: [],
1511
+ schemas: [NO_ERRORS_SCHEMA]
1512
+ }]
1513
+ }],
1514
+ ctorParameters: () => []
1515
+ });
1516
+ var AXWidgetSizePropertyEditorModule = class AXWidgetSizePropertyEditorModule {
1517
+ static ɵfac = i0.ɵɵngDeclareFactory({
1518
+ minVersion: "12.0.0",
1519
+ version: "22.2.0",
1520
+ ngImport: i0,
1521
+ type: AXWidgetSizePropertyEditorModule,
1522
+ deps: [],
1523
+ target: i0.ɵɵFactoryTarget.NgModule
1524
+ });
1525
+ static ɵmod = i0.ɵɵngDeclareNgModule({
1526
+ minVersion: "14.0.0",
1527
+ version: "22.2.0",
1528
+ ngImport: i0,
1529
+ type: AXWidgetSizePropertyEditorModule,
1530
+ declarations: [AXWidgetSizePropertyEditorComponent],
1531
+ imports: [
1532
+ CommonModule,
1533
+ FormsModule,
1534
+ AXNumberBoxModule
1535
+ ],
1536
+ exports: [AXWidgetSizePropertyEditorComponent]
1537
+ });
1538
+ static ɵinj = i0.ɵɵngDeclareInjector({
1539
+ minVersion: "12.0.0",
1540
+ version: "22.2.0",
1541
+ ngImport: i0,
1542
+ type: AXWidgetSizePropertyEditorModule,
1543
+ imports: [
1544
+ CommonModule,
1545
+ FormsModule,
1546
+ AXNumberBoxModule
1547
+ ]
1548
+ });
1549
+ };
1550
+ i0.ɵɵngDeclareClassMetadata({
1551
+ minVersion: "12.0.0",
1552
+ version: "22.2.0",
1553
+ ngImport: i0,
1554
+ type: AXWidgetSizePropertyEditorModule,
1555
+ decorators: [{
1556
+ type: NgModule,
1557
+ args: [{
1558
+ declarations: [AXWidgetSizePropertyEditorComponent],
1559
+ imports: [
1560
+ CommonModule,
1561
+ FormsModule,
1562
+ AXNumberBoxModule
1563
+ ],
1564
+ exports: [AXWidgetSizePropertyEditorComponent],
1565
+ providers: [],
1566
+ schemas: [NO_ERRORS_SCHEMA]
1567
+ }]
1568
+ }]
1569
+ });
1206
1570
  export { AXWidgetBoardComponent, AXWidgetBoardModule, AXWidgetComponent, AXWidgetHostComponent, AXWidgetSizePropertyEditorComponent, AXWidgetSizePropertyEditorModule };
1207
- //# sourceMappingURL=acorex-layout.mjs.map
1571
+
1572
+ //# sourceMappingURL=acorex-layout.mjs.map