@acorex/layout 1.3.90

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. package/README.md +2 -0
  2. package/acorex-layout.d.ts +6 -0
  3. package/acorex-layout.metadata.json +1 -0
  4. package/bundles/acorex-layout.umd.js +1479 -0
  5. package/bundles/acorex-layout.umd.js.map +1 -0
  6. package/bundles/acorex-layout.umd.min.js +16 -0
  7. package/bundles/acorex-layout.umd.min.js.map +1 -0
  8. package/esm2015/acorex-layout.js +7 -0
  9. package/esm2015/lib/widget-board/editors/widget-size-editor/widget-size.editor.js +49 -0
  10. package/esm2015/lib/widget-board/editors/widget-size-editor/widget-size.module.js +22 -0
  11. package/esm2015/lib/widget-board/widget-board.component.js +468 -0
  12. package/esm2015/lib/widget-board/widget-board.module.js +69 -0
  13. package/esm2015/lib/widget-board/widget-config.component.js +86 -0
  14. package/esm2015/lib/widget-board/widget-host.component.js +313 -0
  15. package/esm2015/lib/widget-board/widget-save.component.js +79 -0
  16. package/esm2015/lib/widget-board/widget.class.js +123 -0
  17. package/esm2015/public-api.js +7 -0
  18. package/esm5/acorex-layout.js +7 -0
  19. package/esm5/lib/widget-board/editors/widget-size-editor/widget-size.editor.js +52 -0
  20. package/esm5/lib/widget-board/editors/widget-size-editor/widget-size.module.js +23 -0
  21. package/esm5/lib/widget-board/widget-board.component.js +494 -0
  22. package/esm5/lib/widget-board/widget-board.module.js +70 -0
  23. package/esm5/lib/widget-board/widget-config.component.js +90 -0
  24. package/esm5/lib/widget-board/widget-host.component.js +349 -0
  25. package/esm5/lib/widget-board/widget-save.component.js +83 -0
  26. package/esm5/lib/widget-board/widget.class.js +134 -0
  27. package/esm5/public-api.js +7 -0
  28. package/fesm2015/acorex-layout.js +1171 -0
  29. package/fesm2015/acorex-layout.js.map +1 -0
  30. package/fesm5/acorex-layout.js +1256 -0
  31. package/fesm5/acorex-layout.js.map +1 -0
  32. package/lib/widget-board/editors/widget-size-editor/widget-size.editor.d.ts +16 -0
  33. package/lib/widget-board/editors/widget-size-editor/widget-size.module.d.ts +3 -0
  34. package/lib/widget-board/widget-board.component.d.ts +58 -0
  35. package/lib/widget-board/widget-board.module.d.ts +6 -0
  36. package/lib/widget-board/widget-config.component.d.ts +20 -0
  37. package/lib/widget-board/widget-host.component.d.ts +48 -0
  38. package/lib/widget-board/widget-save.component.d.ts +16 -0
  39. package/lib/widget-board/widget.class.d.ts +53 -0
  40. package/package.json +21 -0
  41. package/public-api.d.ts +6 -0
@@ -0,0 +1,1479 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@acorex/components'), require('@acorex/core'), require('rxjs'), require('rxjs/operators'), require('@angular/common'), require('@angular/router'), require('@angular/forms')) :
3
+ typeof define === 'function' && define.amd ? define('@acorex/layout', ['exports', '@angular/core', '@acorex/components', '@acorex/core', 'rxjs', 'rxjs/operators', '@angular/common', '@angular/router', '@angular/forms'], factory) :
4
+ (global = global || self, factory((global.acorex = global.acorex || {}, global.acorex.layout = {}), global.ng.core, global.components, global.core$1, global.rxjs, global.rxjs.operators, global.ng.common, global.ng.router, global.ng.forms));
5
+ }(this, (function (exports, core, components, core$1, rxjs, operators, common, router, forms) { 'use strict';
6
+
7
+ /*! *****************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
21
+ /* global Reflect, Promise */
22
+
23
+ var extendStatics = function(d, b) {
24
+ extendStatics = Object.setPrototypeOf ||
25
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27
+ return extendStatics(d, b);
28
+ };
29
+
30
+ function __extends(d, b) {
31
+ extendStatics(d, b);
32
+ function __() { this.constructor = d; }
33
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
+ }
35
+
36
+ var __assign = function() {
37
+ __assign = Object.assign || function __assign(t) {
38
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
39
+ s = arguments[i];
40
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41
+ }
42
+ return t;
43
+ };
44
+ return __assign.apply(this, arguments);
45
+ };
46
+
47
+ function __rest(s, e) {
48
+ var t = {};
49
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
+ t[p] = s[p];
51
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
+ t[p[i]] = s[p[i]];
55
+ }
56
+ return t;
57
+ }
58
+
59
+ function __decorate(decorators, target, key, desc) {
60
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
62
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
63
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
64
+ }
65
+
66
+ function __param(paramIndex, decorator) {
67
+ return function (target, key) { decorator(target, key, paramIndex); }
68
+ }
69
+
70
+ function __metadata(metadataKey, metadataValue) {
71
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
72
+ }
73
+
74
+ function __awaiter(thisArg, _arguments, P, generator) {
75
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
76
+ return new (P || (P = Promise))(function (resolve, reject) {
77
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
78
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
79
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
80
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
81
+ });
82
+ }
83
+
84
+ function __generator(thisArg, body) {
85
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
86
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
87
+ function verb(n) { return function (v) { return step([n, v]); }; }
88
+ function step(op) {
89
+ if (f) throw new TypeError("Generator is already executing.");
90
+ while (_) try {
91
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
92
+ if (y = 0, t) op = [op[0] & 2, t.value];
93
+ switch (op[0]) {
94
+ case 0: case 1: t = op; break;
95
+ case 4: _.label++; return { value: op[1], done: false };
96
+ case 5: _.label++; y = op[1]; op = [0]; continue;
97
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
98
+ default:
99
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
100
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
101
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
102
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
103
+ if (t[2]) _.ops.pop();
104
+ _.trys.pop(); continue;
105
+ }
106
+ op = body.call(thisArg, _);
107
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
108
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
109
+ }
110
+ }
111
+
112
+ function __createBinding(o, m, k, k2) {
113
+ if (k2 === undefined) k2 = k;
114
+ o[k2] = m[k];
115
+ }
116
+
117
+ function __exportStar(m, exports) {
118
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
119
+ }
120
+
121
+ function __values(o) {
122
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
123
+ if (m) return m.call(o);
124
+ if (o && typeof o.length === "number") return {
125
+ next: function () {
126
+ if (o && i >= o.length) o = void 0;
127
+ return { value: o && o[i++], done: !o };
128
+ }
129
+ };
130
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
131
+ }
132
+
133
+ function __read(o, n) {
134
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
135
+ if (!m) return o;
136
+ var i = m.call(o), r, ar = [], e;
137
+ try {
138
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
139
+ }
140
+ catch (error) { e = { error: error }; }
141
+ finally {
142
+ try {
143
+ if (r && !r.done && (m = i["return"])) m.call(i);
144
+ }
145
+ finally { if (e) throw e.error; }
146
+ }
147
+ return ar;
148
+ }
149
+
150
+ function __spread() {
151
+ for (var ar = [], i = 0; i < arguments.length; i++)
152
+ ar = ar.concat(__read(arguments[i]));
153
+ return ar;
154
+ }
155
+
156
+ function __spreadArrays() {
157
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
158
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
159
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
160
+ r[k] = a[j];
161
+ return r;
162
+ };
163
+
164
+ function __await(v) {
165
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
166
+ }
167
+
168
+ function __asyncGenerator(thisArg, _arguments, generator) {
169
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
170
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
171
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
172
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
173
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
174
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
175
+ function fulfill(value) { resume("next", value); }
176
+ function reject(value) { resume("throw", value); }
177
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
178
+ }
179
+
180
+ function __asyncDelegator(o) {
181
+ var i, p;
182
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
183
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
184
+ }
185
+
186
+ function __asyncValues(o) {
187
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
188
+ var m = o[Symbol.asyncIterator], i;
189
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
190
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
191
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
192
+ }
193
+
194
+ function __makeTemplateObject(cooked, raw) {
195
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
196
+ return cooked;
197
+ };
198
+
199
+ function __importStar(mod) {
200
+ if (mod && mod.__esModule) return mod;
201
+ var result = {};
202
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
203
+ result.default = mod;
204
+ return result;
205
+ }
206
+
207
+ function __importDefault(mod) {
208
+ return (mod && mod.__esModule) ? mod : { default: mod };
209
+ }
210
+
211
+ function __classPrivateFieldGet(receiver, privateMap) {
212
+ if (!privateMap.has(receiver)) {
213
+ throw new TypeError("attempted to get private field on non-instance");
214
+ }
215
+ return privateMap.get(receiver);
216
+ }
217
+
218
+ function __classPrivateFieldSet(receiver, privateMap, value) {
219
+ if (!privateMap.has(receiver)) {
220
+ throw new TypeError("attempted to set private field on non-instance");
221
+ }
222
+ privateMap.set(receiver, value);
223
+ return value;
224
+ }
225
+
226
+ var ɵ0 = function () {
227
+ return [1, 2, 3, 5, 10, 20, 30, 60].map(function (c) { return ({
228
+ id: 60000 * c,
229
+ text: core$1.AXTranslator.get('dateTime.duration.format_minute').replace('{0}', c.toString())
230
+ }); });
231
+ };
232
+ // @dynamic
233
+ var AXWidgetComponent = /** @class */ (function () {
234
+ function AXWidgetComponent() {
235
+ var _this = this;
236
+ this.uid = core$1.AXHtmlUtil.getUID();
237
+ this.onBusyChanged = new core.EventEmitter();
238
+ this._isBusy = true;
239
+ this.refreshRate = [{
240
+ id: 60000 * 5,
241
+ text: core$1.AXTranslator.get('dateTime.duration.format_minute').replace('{0}', '5')
242
+ }];
243
+ this.onConfiguredChanged = new core.EventEmitter();
244
+ this.onConfiguredChanged.subscribe(function () {
245
+ if (_this.isConfigured === true && _this.getRefreshRate()) {
246
+ _this.restartRefreshTimer();
247
+ }
248
+ else {
249
+ _this.stopRefreshTimer();
250
+ }
251
+ });
252
+ }
253
+ Object.defineProperty(AXWidgetComponent.prototype, "isBusy", {
254
+ get: function () {
255
+ return this._isBusy;
256
+ },
257
+ set: function (v) {
258
+ if (v !== this._isBusy) {
259
+ var eventData = {
260
+ component: this,
261
+ oldValue: this._isBusy,
262
+ value: v
263
+ };
264
+ this._isBusy = v;
265
+ this.onBusyChanged.emit(eventData);
266
+ }
267
+ },
268
+ enumerable: true,
269
+ configurable: true
270
+ });
271
+ // ???
272
+ AXWidgetComponent.prototype.getRefreshRate = function () {
273
+ return Array.isArray(this.refreshRate) && this.refreshRate.length ? this.refreshRate[0].id : this.refreshRate;
274
+ };
275
+ AXWidgetComponent.prototype.startRefreshTimer = function () {
276
+ this.intervalId = window.setInterval(this.refresh.bind(this), this.getRefreshRate());
277
+ };
278
+ AXWidgetComponent.prototype.stopRefreshTimer = function () {
279
+ window.clearInterval(this.intervalId);
280
+ };
281
+ AXWidgetComponent.prototype.restartRefreshTimer = function () {
282
+ this.stopRefreshTimer();
283
+ this.startRefreshTimer();
284
+ };
285
+ AXWidgetComponent.prototype.ngOnDestroy = function () {
286
+ this.stopRefreshTimer();
287
+ };
288
+ AXWidgetComponent.prototype.redraw = function () {
289
+ };
290
+ AXWidgetComponent.prototype.refresh = function () {
291
+ this.restartRefreshTimer();
292
+ };
293
+ Object.defineProperty(AXWidgetComponent.prototype, "isConfigured", {
294
+ get: function () {
295
+ return true;
296
+ },
297
+ enumerable: true,
298
+ configurable: true
299
+ });
300
+ AXWidgetComponent.prototype.setValue = function (name, value) {
301
+ this[name] = value;
302
+ this.onConfiguredChanged.emit();
303
+ };
304
+ AXWidgetComponent.prototype.getValue = function (name) {
305
+ var _a;
306
+ var val = this[name];
307
+ var config = this['__meta__'].config;
308
+ var runtime = (_a = config.props[name]) === null || _a === void 0 ? void 0 : _a.runtime;
309
+ if (runtime && this.provideValue) {
310
+ var res = this.provideValue({
311
+ name: name,
312
+ value: val,
313
+ uniqueName: config.uniqueName,
314
+ options: config.options,
315
+ });
316
+ if (this.provideValue instanceof Promise) {
317
+ return res;
318
+ }
319
+ else {
320
+ return Promise.resolve(res);
321
+ }
322
+ }
323
+ return Promise.resolve(val);
324
+ };
325
+ __decorate([
326
+ components.propertyEditor({
327
+ editorClass: 'ax/editors/widget-size',
328
+ title: 'common.size',
329
+ visible: false,
330
+ order: -99,
331
+ }),
332
+ __metadata("design:type", Array)
333
+ ], AXWidgetComponent.prototype, "widgetSize", void 0);
334
+ __decorate([
335
+ components.propertyEditor({
336
+ editorClass: 'ax/editors/select',
337
+ title: 'common.refresh-rate',
338
+ visible: true,
339
+ order: -98,
340
+ editorOptions: {
341
+ items: ɵ0,
342
+ allowNull: false,
343
+ allowSearch: false,
344
+ selectionDataMode: 'value',
345
+ selectionMode: 'single',
346
+ valueField: 'id',
347
+ }
348
+ }),
349
+ __metadata("design:type", Object)
350
+ ], AXWidgetComponent.prototype, "refreshRate", void 0);
351
+ return AXWidgetComponent;
352
+ }());
353
+
354
+ var AXWidgetConfigComponent = /** @class */ (function (_super) {
355
+ __extends(AXWidgetConfigComponent, _super);
356
+ function AXWidgetConfigComponent(cdr) {
357
+ var _this = _super.call(this) || this;
358
+ _this.cdr = cdr;
359
+ _this.props = [];
360
+ _this.displayProps = [];
361
+ _this.changes = [];
362
+ _this.context = {};
363
+ return _this;
364
+ }
365
+ AXWidgetConfigComponent.prototype.getFooterButtons = function () {
366
+ return [
367
+ {
368
+ name: 'okay',
369
+ submitBehavior: true,
370
+ text: core$1.AXTranslator.get('common.confirm'),
371
+ style: 'success'
372
+ },
373
+ {
374
+ name: 'cancel',
375
+ cancelBehavior: true,
376
+ text: core$1.AXTranslator.get('common.cancel'),
377
+ style: 'danger blank'
378
+ }
379
+ ];
380
+ };
381
+ AXWidgetConfigComponent.prototype.onFooterButtonClick = function (e) {
382
+ var _this = this;
383
+ if (e.name === 'cancel') {
384
+ this.close();
385
+ }
386
+ if (e.name === 'okay') {
387
+ this.form.validate().then(function (c) {
388
+ if (c.result) {
389
+ _this.close(_this.changes);
390
+ }
391
+ });
392
+ }
393
+ };
394
+ AXWidgetConfigComponent.prototype.handleValueChange = function (e) {
395
+ var prop = this.changes.find(function (c) { return c.property.name === e.property.name; });
396
+ if (prop) {
397
+ prop.value = e.value;
398
+ }
399
+ else {
400
+ this.changes.push({ property: e.property, value: e.value });
401
+ }
402
+ this.updateContext();
403
+ };
404
+ AXWidgetConfigComponent.prototype.ngOnInit = function () {
405
+ this.displayProps = this.props.filter(function (c) { return c.property.visible !== false; }).sort(function (a, b) { return a.property.order - b.property.order; });
406
+ this.updateContext();
407
+ };
408
+ AXWidgetConfigComponent.prototype.updateContext = function () {
409
+ var ctx = {};
410
+ this.props.forEach(function (p) {
411
+ ctx[p.property.name] = p.value;
412
+ });
413
+ this.changes.forEach(function (p) {
414
+ ctx[p.property.name] = p.value;
415
+ });
416
+ this.context = ctx;
417
+ };
418
+ AXWidgetConfigComponent.prototype.identify = function (index, item) {
419
+ return item.property.name;
420
+ };
421
+ AXWidgetConfigComponent.ctorParameters = function () { return [
422
+ { type: core.ChangeDetectorRef }
423
+ ]; };
424
+ __decorate([
425
+ core.ViewChild(components.AXValidationFormComponent),
426
+ __metadata("design:type", components.AXValidationFormComponent)
427
+ ], AXWidgetConfigComponent.prototype, "form", void 0);
428
+ AXWidgetConfigComponent = __decorate([
429
+ core.Component({
430
+ template: "<ax-page>\r\n <ax-page-content>\r\n <div class=\"container\">\r\n <ax-validation-form #form>\r\n <div class=\"row\" *ngFor=\"let p of displayProps; trackBy: identify\">\r\n <div class=\"col-12\">\r\n <ax-label>{{p.property.title | trans}}</ax-label>\r\n <ng-container ax-property-editor-renderer [property]=\"p\" [context]=\"context\" [host]=\"widget\" [validationForm]=\"form\"\r\n (onValueChange)=\"handleValueChange($event)\">\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ax-validation-form>\r\n </div>\r\n </ax-page-content>\r\n</ax-page>",
431
+ encapsulation: core.ViewEncapsulation.None,
432
+ changeDetection: core.ChangeDetectionStrategy.OnPush
433
+ }),
434
+ __metadata("design:paramtypes", [core.ChangeDetectorRef])
435
+ ], AXWidgetConfigComponent);
436
+ return AXWidgetConfigComponent;
437
+ }(components.AXBasePopupPageComponent));
438
+
439
+ var AXWidgetSaveComponent = /** @class */ (function (_super) {
440
+ __extends(AXWidgetSaveComponent, _super);
441
+ function AXWidgetSaveComponent() {
442
+ var _this = _super !== null && _super.apply(this, arguments) || this;
443
+ _this.props = [];
444
+ return _this;
445
+ }
446
+ AXWidgetSaveComponent.prototype.getFooterButtons = function () {
447
+ return [
448
+ {
449
+ name: 'okay',
450
+ submitBehavior: true,
451
+ text: core$1.AXTranslator.get('common.confirm'),
452
+ style: 'ax success'
453
+ },
454
+ {
455
+ name: 'cancel',
456
+ cancelBehavior: true,
457
+ text: core$1.AXTranslator.get('common.cancel'),
458
+ style: 'ax light'
459
+ }
460
+ ];
461
+ };
462
+ AXWidgetSaveComponent.prototype.ngOnInit = function () {
463
+ var _a, _b;
464
+ var titleProp = this.props.find(function (c) { return c.property.name === 'title' || c.property.name === 'name'; });
465
+ var title = ((_a = titleProp) === null || _a === void 0 ? void 0 : _a.value) || this.config.title;
466
+ var pp = {};
467
+ (_b = this.props) === null || _b === void 0 ? void 0 : _b.forEach(function (c) {
468
+ pp[c.property.name] = c.property;
469
+ });
470
+ this.data = {
471
+ component: this.config.component,
472
+ title: title,
473
+ uniqueName: this.config.uniqueName + "-" + core$1.AXHtmlUtil.getUID(),
474
+ options: core$1.AXObjectUtil.deepJSONClone(this.config.options),
475
+ props: core$1.AXObjectUtil.deepJSONClone(pp)
476
+ };
477
+ this.displayProps = this.props
478
+ .filter(function (c) { return c.property.visible !== false; })
479
+ .sort(function (a, b) { return a.property.order - b.property.order; })
480
+ .map(function (c) { return ({
481
+ name: c.property.name,
482
+ title: c.property.title,
483
+ allow: true
484
+ }); });
485
+ };
486
+ AXWidgetSaveComponent.prototype.onFooterButtonClick = function (e) {
487
+ var _this = this;
488
+ if (e.name === 'cancel') {
489
+ this.close();
490
+ }
491
+ if (e.name === 'okay') {
492
+ this.props.forEach(function (p) {
493
+ var pp = _this.displayProps.find(function (c) { return c.name === p.property.name; });
494
+ if (pp == null || !pp.allow) {
495
+ var ppp = _this.data.props[p.property.name];
496
+ if (ppp) {
497
+ ppp.visible = false;
498
+ }
499
+ else {
500
+ ppp = { visible: false };
501
+ }
502
+ }
503
+ });
504
+ this.close(this.data);
505
+ }
506
+ };
507
+ AXWidgetSaveComponent = __decorate([
508
+ core.Component({
509
+ template: "<ax-page>\r\n <ax-page-content>\r\n <div class=\"container\">\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <ax-form-group>\r\n <ax-label>{{'common.title' | trans}}</ax-label>\r\n <ax-text-box [(value)]=\"data.title\"></ax-text-box>\r\n </ax-form-group>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <ax-form-group>\r\n <ax-label>{{'common.description' | trans}}</ax-label>\r\n <ax-text-area [(value)]=\"data.description\"></ax-text-area>\r\n </ax-form-group>\r\n </div>\r\n </div>\r\n <!-- <div class=\"row\">\r\n <div class=\"col-12\">\r\n <ax-form-group>\r\n <ax-label>{{'common.uniquename' | trans}}</ax-label>\r\n <ax-text-box></ax-text-box>\r\n </ax-form-group>\r\n </div>\r\n </div> -->\r\n <div class=\"row\" style=\"margin-block-end: var(--ax-size-md);margin-block-start: var(--ax-size-md);\">\r\n <div class=\"col-12\">\r\n <ax-fieldset caption=\"{{'widget-board.configurable-props' | trans}}\">\r\n <div class=\"row\" *ngFor=\"let prop of displayProps\">\r\n <div class=\"col-12\" style=\"margin-block-end: var(--ax-size-sm)\">\r\n <ax-check-box [(value)]=\"prop.allow\" label=\"{{ prop.title | trans }}\">\r\n\r\n </ax-check-box>\r\n </div>\r\n </div>\r\n </ax-fieldset>\r\n </div>\r\n </div>\r\n </div>\r\n </ax-page-content>\r\n</ax-page>",
510
+ encapsulation: core.ViewEncapsulation.None,
511
+ changeDetection: core.ChangeDetectionStrategy.OnPush
512
+ })
513
+ ], AXWidgetSaveComponent);
514
+ return AXWidgetSaveComponent;
515
+ }(components.AXBasePopupPageComponent));
516
+
517
+ var AXWidgetHostComponent = /** @class */ (function () {
518
+ function AXWidgetHostComponent(ref, componentFactoryResolver, rendererService, cdr, popup, loadingService) {
519
+ this.ref = ref;
520
+ this.componentFactoryResolver = componentFactoryResolver;
521
+ this.rendererService = rendererService;
522
+ this.cdr = cdr;
523
+ this.popup = popup;
524
+ this.loadingService = loadingService;
525
+ this._hasProps = false;
526
+ this._hasMenu = false;
527
+ this.configMenuItem = [
528
+ {
529
+ icon: 'far fa-ellipsis-h',
530
+ items: []
531
+ }
532
+ ];
533
+ this.onRemove = new core.EventEmitter();
534
+ this.onConfigChanged = new core.EventEmitter();
535
+ this.onResized = new core.EventEmitter();
536
+ this.onSave = new core.EventEmitter();
537
+ this._isLoading = false;
538
+ this.sizeX = 1;
539
+ this.sizeY = 1;
540
+ this.col = 1;
541
+ this.row = 1;
542
+ }
543
+ Object.defineProperty(AXWidgetHostComponent.prototype, "widget", {
544
+ get: function () {
545
+ return this._widget;
546
+ },
547
+ enumerable: true,
548
+ configurable: true
549
+ });
550
+ Object.defineProperty(AXWidgetHostComponent.prototype, "element", {
551
+ get: function () {
552
+ return this.ref.nativeElement;
553
+ },
554
+ enumerable: true,
555
+ configurable: true
556
+ });
557
+ Object.defineProperty(AXWidgetHostComponent.prototype, "isLoading", {
558
+ get: function () {
559
+ return this._isLoading;
560
+ },
561
+ set: function (v) {
562
+ this._isLoading = v;
563
+ if (this._loadingId && !v) {
564
+ this.loadingService.hide(this._loadingId);
565
+ this._loadingId = null;
566
+ }
567
+ if (v) {
568
+ this._loadingId = this.loadingService.show(this.ref.nativeElement);
569
+ }
570
+ },
571
+ enumerable: true,
572
+ configurable: true
573
+ });
574
+ Object.defineProperty(AXWidgetHostComponent.prototype, "isConfigured", {
575
+ get: function () {
576
+ var _a;
577
+ return ((_a = this._widget) === null || _a === void 0 ? void 0 : _a.isConfigured) || false;
578
+ },
579
+ enumerable: true,
580
+ configurable: true
581
+ });
582
+ AXWidgetHostComponent.prototype.ngOnInit = function () {
583
+ this.isLoading = true;
584
+ };
585
+ AXWidgetHostComponent.prototype.ngAfterViewInit = function () {
586
+ var _a;
587
+ return __awaiter(this, void 0, void 0, function () {
588
+ var component, route, widgetFactory;
589
+ var _this = this;
590
+ return __generator(this, function (_b) {
591
+ switch (_b.label) {
592
+ case 0:
593
+ if (!(typeof this.config.component === 'string')) return [3 /*break*/, 2];
594
+ return [4 /*yield*/, this.rendererService.findLoadedComponentByRoute(this.config.component, 20)];
595
+ case 1:
596
+ route = _b.sent();
597
+ component = (_a = route) === null || _a === void 0 ? void 0 : _a.component;
598
+ return [3 /*break*/, 3];
599
+ case 2:
600
+ if (typeof this.config.component === 'function') {
601
+ component = this.config.component;
602
+ }
603
+ _b.label = 3;
604
+ case 3:
605
+ if (component == null) {
606
+ console.error("Invalid Widget Component!", this.config);
607
+ this.onRemove.emit(this);
608
+ return [2 /*return*/];
609
+ }
610
+ widgetFactory = this.componentFactoryResolver.resolveComponentFactory(component);
611
+ this.componentRef = this.vc.createComponent(widgetFactory);
612
+ this._widget = this.componentRef.instance;
613
+ this._widget.provideValue = this.provideValue;
614
+ if (this._widget.onBusyChanged) {
615
+ this._widget.onBusyChanged.subscribe(function (d) {
616
+ if (!_this._widget.widgetSize) {
617
+ _this._widget.setValue('widgetSize', [_this.sizeX, _this.sizeY]);
618
+ }
619
+ else {
620
+ _this.setSizeFromOptions();
621
+ }
622
+ _this.isLoading = d.value;
623
+ _this.cdr.detectChanges();
624
+ });
625
+ }
626
+ if (this._widget.onConfiguredChanged) {
627
+ this._widget.onConfiguredChanged.subscribe(function () {
628
+ _this.setSizeFromOptions();
629
+ });
630
+ }
631
+ //
632
+ if (this.config.options) {
633
+ Object.assign(this._widget, this.config.options);
634
+ }
635
+ this._hasProps = components.AXPropertyDecorators.getProperties(this._widget).length > 0;
636
+ this.isLoading = false;
637
+ this.config['__meta__'].instance = this;
638
+ this._widget['__meta__'] = {};
639
+ this._widget['__meta__'].config = this.config;
640
+ //
641
+ if (this._hasProps) {
642
+ this.configMenuItem[0].items.push({
643
+ name: 'configs',
644
+ icon: 'far fa-cogs',
645
+ text: core$1.AXTranslator.get('common.configs'),
646
+ onClick: function () {
647
+ _this.openConfigDialog();
648
+ }
649
+ });
650
+ }
651
+ this.configMenuItem[0].items.push({
652
+ name: 'save',
653
+ icon: 'far fa-save',
654
+ text: core$1.AXTranslator.get('common.save-as'),
655
+ onClick: function () {
656
+ _this.openSaveDialog();
657
+ }
658
+ });
659
+ if (true) {
660
+ this.configMenuItem[0].items.push({
661
+ name: 'remove',
662
+ icon: 'far fa-times',
663
+ style: 'ax danger blank',
664
+ text: core$1.AXTranslator.get('common.remove'),
665
+ onClick: function () {
666
+ _this.onRemove.emit(_this);
667
+ }
668
+ });
669
+ }
670
+ this._hasMenu = this.configMenuItem[0].items.length > 0;
671
+ this.cdr.detectChanges();
672
+ return [2 /*return*/];
673
+ }
674
+ });
675
+ });
676
+ };
677
+ AXWidgetHostComponent.prototype.setSizeFromOptions = function () {
678
+ var _this = this;
679
+ this._widget.getValue('widgetSize').then(function (c) {
680
+ var oldSizeX = _this.sizeX;
681
+ var oldSizeY = _this.sizeY;
682
+ if (c && Array.isArray(c) && (oldSizeX !== c[0] || oldSizeY !== c[1])) {
683
+ _this.config.sizeX = _this.sizeX = c[0];
684
+ _this.config.sizeY = _this.sizeY = c[1];
685
+ _this.onResized.emit({
686
+ component: _this._widget,
687
+ config: _this.config
688
+ });
689
+ }
690
+ _this.cdr.detectChanges();
691
+ });
692
+ };
693
+ AXWidgetHostComponent.prototype.remove = function (e) {
694
+ e.preventDefault();
695
+ e.stopPropagation();
696
+ this.onRemove.emit(this);
697
+ return false;
698
+ };
699
+ AXWidgetHostComponent.prototype.handleConfig = function (e) {
700
+ e.preventDefault();
701
+ e.stopPropagation();
702
+ this.openConfigDialog();
703
+ return false;
704
+ };
705
+ AXWidgetHostComponent.prototype.openConfigDialog = function () {
706
+ var _this = this;
707
+ var ppp = this.getMergedProps();
708
+ this.popup.open(AXWidgetConfigComponent, {
709
+ title: core$1.AXTranslator.get('common.configs'),
710
+ size: 'sm',
711
+ data: {
712
+ props: ppp.map(function (c) { return ({ property: c.options, value: _this._widget[c.options.name] }); }),
713
+ widget: this.widget
714
+ }
715
+ }).then(function (c) {
716
+ if (c.data) {
717
+ if (!_this.config.options) {
718
+ _this.config.options = {};
719
+ }
720
+ c.data.forEach(function (p) {
721
+ _this._widget.setValue(p.property.name, p.value);
722
+ _this.config.options[p.property.name] = p.value;
723
+ });
724
+ _this.emitConfigChanged();
725
+ _this._widget.redraw();
726
+ _this.cdr.detectChanges();
727
+ }
728
+ });
729
+ };
730
+ AXWidgetHostComponent.prototype.openSaveDialog = function () {
731
+ var _this = this;
732
+ var ppp = this.getMergedProps();
733
+ this.popup.open(AXWidgetSaveComponent, {
734
+ title: core$1.AXTranslator.get('common.save-as'),
735
+ size: 'sm',
736
+ data: {
737
+ config: this.config,
738
+ props: ppp.map(function (c) { return ({ property: c.options, value: _this._widget[c.options.name] }); })
739
+ }
740
+ }).then(function (c) {
741
+ if (c.data) {
742
+ _this.onSave.emit({
743
+ component: _this._widget,
744
+ data: c.data
745
+ });
746
+ }
747
+ });
748
+ };
749
+ AXWidgetHostComponent.prototype.handleOptionClick = function (e) {
750
+ e.preventDefault();
751
+ e.stopPropagation();
752
+ this.openConfigDialog();
753
+ return false;
754
+ };
755
+ AXWidgetHostComponent.prototype.ngOnDestroy = function () {
756
+ this.vc.clear();
757
+ if (this.componentRef) {
758
+ this.componentRef.destroy();
759
+ }
760
+ };
761
+ AXWidgetHostComponent.prototype.getMergedProps = function () {
762
+ var ppp = core$1.AXObjectUtil.deepCopy(components.AXPropertyDecorators.getProperties(this._widget));
763
+ var _loop_1 = function (key) {
764
+ if (Object.prototype.hasOwnProperty.call(this_1.config.props, key)) {
765
+ var newP = this_1.config.props[key];
766
+ var existPropDec = ppp.find(function (p) { return p.property === key; });
767
+ if (existPropDec) {
768
+ Object.assign(existPropDec.options, newP);
769
+ }
770
+ }
771
+ };
772
+ var this_1 = this;
773
+ for (var key in this.config.props) {
774
+ _loop_1(key);
775
+ }
776
+ return ppp;
777
+ };
778
+ AXWidgetHostComponent.prototype.emitConfigChanged = function () {
779
+ this.onConfigChanged.emit({
780
+ component: this._widget,
781
+ config: this.config
782
+ });
783
+ };
784
+ AXWidgetHostComponent.ctorParameters = function () { return [
785
+ { type: core.ElementRef },
786
+ { type: core.ComponentFactoryResolver },
787
+ { type: core$1.AXRenderService },
788
+ { type: core.ChangeDetectorRef },
789
+ { type: components.AXPopupService },
790
+ { type: components.AXLoadingService }
791
+ ]; };
792
+ __decorate([
793
+ core.Input(),
794
+ __metadata("design:type", Function)
795
+ ], AXWidgetHostComponent.prototype, "provideValue", void 0);
796
+ __decorate([
797
+ core.Output(),
798
+ __metadata("design:type", core.EventEmitter)
799
+ ], AXWidgetHostComponent.prototype, "onRemove", void 0);
800
+ __decorate([
801
+ core.Output(),
802
+ __metadata("design:type", core.EventEmitter)
803
+ ], AXWidgetHostComponent.prototype, "onConfigChanged", void 0);
804
+ __decorate([
805
+ core.Output(),
806
+ __metadata("design:type", core.EventEmitter)
807
+ ], AXWidgetHostComponent.prototype, "onResized", void 0);
808
+ __decorate([
809
+ core.Output(),
810
+ __metadata("design:type", core.EventEmitter)
811
+ ], AXWidgetHostComponent.prototype, "onSave", void 0);
812
+ __decorate([
813
+ core.Input(),
814
+ __metadata("design:type", Object)
815
+ ], AXWidgetHostComponent.prototype, "config", void 0);
816
+ __decorate([
817
+ core.ViewChild('vc', { read: core.ViewContainerRef }),
818
+ __metadata("design:type", core.ViewContainerRef)
819
+ ], AXWidgetHostComponent.prototype, "vc", void 0);
820
+ __decorate([
821
+ core.HostBinding('attr.data-size-x'),
822
+ core.Input(),
823
+ __metadata("design:type", Number)
824
+ ], AXWidgetHostComponent.prototype, "sizeX", void 0);
825
+ __decorate([
826
+ core.HostBinding('attr.data-size-y'),
827
+ core.Input(),
828
+ __metadata("design:type", Number)
829
+ ], AXWidgetHostComponent.prototype, "sizeY", void 0);
830
+ __decorate([
831
+ core.HostBinding('attr.data-col'),
832
+ core.Input(),
833
+ __metadata("design:type", Number)
834
+ ], AXWidgetHostComponent.prototype, "col", void 0);
835
+ __decorate([
836
+ core.HostBinding('attr.data-row'),
837
+ core.Input(),
838
+ __metadata("design:type", Number)
839
+ ], AXWidgetHostComponent.prototype, "row", void 0);
840
+ AXWidgetHostComponent = __decorate([
841
+ core.Component({
842
+ selector: 'ax-widget-host',
843
+ template: "<div class='widget-container'>\r\n <div class=\"widget-config-overlay\" *ngIf=\"!isConfigured\" (click)=\"handleConfig($event)\">\r\n <div class=\"widget-title\">{{config.title}}</div>\r\n <div class=\"widget-config-box\">\r\n <div class=\"config-title\">{{ 'widget-board.configure' | trans}}</div>\r\n <div class=\"config-icon\"><i class=\"fas fa-cogs fa-5x\"></i></div>\r\n </div>\r\n </div>\r\n <div class='widget-edit-overlay'>\r\n <div class='widget-edit-menu'>\r\n <button class=\"widget-edit-menu-button\" (click)=\"handleConfig($event)\"\r\n (mousedown)=\"$event.stopPropagation()\" *ngIf=\"_hasProps\" (mouseup)=\"$event.stopPropagation()\">\r\n <i class=\"far fa-cogs\"></i>\r\n </button>\r\n <button class=\"widget-edit-menu-button\" (click)=\"remove($event)\" (mousedown)=\"$event.stopPropagation()\"\r\n (mouseup)=\"$event.stopPropagation()\">\r\n <i class=\"far fa-times\"></i>\r\n </button>\r\n </div>\r\n\r\n </div>\r\n <div class=\"widget-options-menu\" *ngIf=\"_hasMenu\">\r\n <ax-menu [items]='configMenuItem' direction=\"horizontal\"></ax-menu>\r\n </div>\r\n <!-- <ax-loading-panel [visible]=\"isBusy\">\r\n </ax-loading-panel> -->\r\n <div class=\"widget-content\">\r\n <ng-container #vc></ng-container>\r\n </div>\r\n</div>",
844
+ host: { class: 'ax widget-host', tabindex: '0' },
845
+ encapsulation: core.ViewEncapsulation.None,
846
+ changeDetection: core.ChangeDetectionStrategy.OnPush
847
+ }),
848
+ __metadata("design:paramtypes", [core.ElementRef,
849
+ core.ComponentFactoryResolver,
850
+ core$1.AXRenderService,
851
+ core.ChangeDetectorRef,
852
+ components.AXPopupService,
853
+ components.AXLoadingService])
854
+ ], AXWidgetHostComponent);
855
+ return AXWidgetHostComponent;
856
+ }());
857
+
858
+ var AXWidgetBoardComponent = /** @class */ (function () {
859
+ function AXWidgetBoardComponent(ref, zone, cdr) {
860
+ this.ref = ref;
861
+ this.zone = zone;
862
+ this.cdr = cdr;
863
+ this.widgets = [];
864
+ this.galleryItems = [];
865
+ this.tileSize = 80;
866
+ this.gapSize = 5;
867
+ this.newWidget = null;
868
+ this._isInEditing = false;
869
+ this.isDragging = false;
870
+ this.DATA_COL = 'data-col';
871
+ this.DATA_ROW = 'data-row';
872
+ this.DATA_SIZE_X = 'data-size-x';
873
+ this.DATA_SIZE_Y = 'data-size-y';
874
+ this.DATA_OLD_COL = 'data-old-col';
875
+ this.DATA_OLD_ROW = 'data-old-row';
876
+ this.onConfigChanged = new core.EventEmitter();
877
+ this.onWidgetSave = new core.EventEmitter();
878
+ }
879
+ AXWidgetBoardComponent.prototype.isInEditing = function () {
880
+ return this._isInEditing;
881
+ };
882
+ AXWidgetBoardComponent.prototype.ngOnInit = function () {
883
+ if (this.rtl == null) {
884
+ this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue('direction') === 'rtl';
885
+ }
886
+ };
887
+ AXWidgetBoardComponent.prototype.ngAfterViewInit = function () {
888
+ var _this = this;
889
+ this.zone.runOutsideAngular(function (c) {
890
+ var style = document.createElement('style');
891
+ style.type = 'text/css';
892
+ _this.ref.nativeElement.appendChild(style);
893
+ // add css data classes
894
+ for (var i = 1; i <= 50; i++) {
895
+ style.innerHTML += "[" + _this.DATA_COL + "=\"" + i + "\"] { " + (_this.rtl ? 'right' : 'left') + ": " + (i - 1) * (_this.tileSize + _this.gapSize) + "px; }";
896
+ style.innerHTML += "[" + _this.DATA_ROW + "=\"" + i + "\"] { top: " + (i - 1) * (_this.tileSize + _this.gapSize) + "px; }";
897
+ style.innerHTML += "[" + _this.DATA_SIZE_X + "=\"" + i + "\"] { width: " + ((i * _this.tileSize) + ((i - 1) * _this.gapSize)) + "px; }";
898
+ style.innerHTML += "[" + _this.DATA_SIZE_Y + "=\"" + i + "\"] { height: " + ((i * _this.tileSize) + ((i - 1) * _this.gapSize)) + "px; }";
899
+ }
900
+ });
901
+ };
902
+ AXWidgetBoardComponent.prototype.calcGridSize = function () {
903
+ var _this = this;
904
+ this.zone.runOutsideAngular(function () {
905
+ var width = (Math.max.apply(Math, __spread(_this.widgets.map(function (c) { return c.col + c.sizeX - 1; })))) * (_this.tileSize + _this.gapSize);
906
+ var height = (Math.max.apply(Math, __spread(_this.widgets.map(function (c) { return c.row + c.sizeY - 1; })))) * (_this.tileSize + _this.gapSize);
907
+ _this.container.nativeElement.style.width = width + 'px';
908
+ _this.container.nativeElement.style.height = height + 'px';
909
+ });
910
+ };
911
+ AXWidgetBoardComponent.prototype.toggleEdit = function () {
912
+ this._isInEditing ? this.finishEdit() : this.startEdit();
913
+ };
914
+ AXWidgetBoardComponent.prototype.dragStart = function (e) {
915
+ var _this = this;
916
+ e.preventDefault();
917
+ e.stopPropagation();
918
+ this.zone.runOutsideAngular(function () {
919
+ if (_this._isInEditing && e.which === 1) {
920
+ _this.dragItem = e.currentTarget;
921
+ _this.dragItem.setAttribute('data-x-offset', (_this.dragItem.offsetLeft - e.clientX).toString());
922
+ //
923
+ _this.dragItem.setAttribute('data-y-offset', (_this.dragItem.offsetTop - e.clientY).toString());
924
+ _this.dragItem.classList.add('widget-dragging');
925
+ _this.dragItem.classList.remove('animate__animated', 'animate__pulse');
926
+ }
927
+ });
928
+ return false;
929
+ };
930
+ AXWidgetBoardComponent.prototype.removePositionData = function () {
931
+ var _this = this;
932
+ this.zone.runOutsideAngular(function () {
933
+ if (_this.dragItem && _this._isInEditing && _this.dragItem.getAttribute(_this.DATA_OLD_COL) == null) {
934
+ _this.dragItem.setAttribute(_this.DATA_OLD_COL, _this.dragItem.getAttribute(_this.DATA_COL));
935
+ _this.dragItem.setAttribute(_this.DATA_OLD_ROW, _this.dragItem.getAttribute(_this.DATA_ROW));
936
+ _this.dragItem.removeAttribute(_this.DATA_COL);
937
+ _this.dragItem.removeAttribute(_this.DATA_ROW);
938
+ }
939
+ });
940
+ };
941
+ AXWidgetBoardComponent.prototype.resetPositionData = function () {
942
+ var _this = this;
943
+ this.zone.runOutsideAngular(function () {
944
+ if (_this.dragItem && _this._isInEditing) {
945
+ _this.setPosition(_this.dragItem, _this.dragItem.getAttribute(_this.DATA_OLD_COL), _this.dragItem.getAttribute(_this.DATA_OLD_ROW));
946
+ }
947
+ });
948
+ };
949
+ AXWidgetBoardComponent.prototype.setPosition = function (element, col, row) {
950
+ var _this = this;
951
+ this.zone.runOutsideAngular(function () {
952
+ element.setAttribute(_this.DATA_COL, col);
953
+ element.setAttribute(_this.DATA_ROW, row);
954
+ element.removeAttribute(_this.DATA_OLD_COL);
955
+ element.removeAttribute(_this.DATA_OLD_ROW);
956
+ element.style.removeProperty('top');
957
+ element.style.removeProperty('left');
958
+ var widget = _this.widgets.find(function (c) { return c['__meta__'].instance.element === element; });
959
+ widget.col = Number(col);
960
+ widget.row = Number(row);
961
+ });
962
+ };
963
+ AXWidgetBoardComponent.prototype.drag = function (e) {
964
+ var _this = this;
965
+ e.preventDefault();
966
+ e.stopPropagation();
967
+ this.zone.runOutsideAngular(function () {
968
+ if (_this.dragItem && _this._isInEditing) {
969
+ _this.isDragging = true;
970
+ _this.addPlaceholder();
971
+ var xOffset = Number(_this.dragItem.getAttribute('data-x-offset'));
972
+ var yOffset = Number(_this.dragItem.getAttribute('data-y-offset'));
973
+ _this.dragItem.style.left = e.clientX + xOffset + 'px';
974
+ _this.dragItem.style.top = e.clientY + yOffset + 'px';
975
+ //
976
+ _this.detectBestPlacement();
977
+ _this.removePositionData();
978
+ }
979
+ });
980
+ return false;
981
+ };
982
+ AXWidgetBoardComponent.prototype.dragEnd = function (e) {
983
+ var _this = this;
984
+ this.zone.runOutsideAngular(function () {
985
+ if (_this.dragItem && _this._isInEditing && _this.isDragging) {
986
+ _this.dragItem.classList.remove('widget-dragging');
987
+ _this.dragItem.classList.add('animate__animated', 'animate__pulse');
988
+ //
989
+ var p = _this.container.nativeElement.querySelector('.widget-blank-placeholder');
990
+ if (_this.newWidget) {
991
+ var w_1 = {
992
+ uniqueName: _this.newWidget.uniqueName,
993
+ component: _this.newWidget.component,
994
+ title: _this.newWidget.title,
995
+ options: _this.newWidget.options,
996
+ sizeX: _this.newWidget.sizeX,
997
+ sizeY: _this.newWidget.sizeY,
998
+ col: Number(p.getAttribute(_this.DATA_COL)),
999
+ row: Number(p.getAttribute(_this.DATA_ROW))
1000
+ };
1001
+ _this.widgets.push(w_1);
1002
+ _this.newWidget = null;
1003
+ _this.container.nativeElement.removeChild(_this.dragItem);
1004
+ _this.zone.run(function () {
1005
+ _this.cdr.detectChanges();
1006
+ _this.calcGridSize();
1007
+ setTimeout(function () {
1008
+ w_1['__meta__'].instance.element.addEventListener('mousedown', _this.dragStart.bind(_this), false);
1009
+ }, 1000);
1010
+ });
1011
+ }
1012
+ else {
1013
+ if (p) {
1014
+ _this.setPosition(_this.dragItem, p.getAttribute(_this.DATA_COL), p.getAttribute(_this.DATA_ROW));
1015
+ }
1016
+ else {
1017
+ _this.setPosition(_this.dragItem, _this.dragItem.getAttribute(_this.DATA_OLD_COL), _this.dragItem.getAttribute(_this.DATA_OLD_ROW));
1018
+ }
1019
+ }
1020
+ //
1021
+ _this.removePlaceholder();
1022
+ _this.dragItem = null;
1023
+ _this.calcGridSize();
1024
+ _this.emitConfigChanged();
1025
+ }
1026
+ _this.isDragging = false;
1027
+ });
1028
+ };
1029
+ AXWidgetBoardComponent.prototype.detectFirstEmptySlot = function (w) {
1030
+ var xTile = Math.floor(this.ref.nativeElement.parentElement.offsetWidth / this.tileSize);
1031
+ for (var j = 1; j <= 100; j++) {
1032
+ var _loop_1 = function (i) {
1033
+ var rec = new core$1.AXClientRec({
1034
+ left: i,
1035
+ top: j,
1036
+ width: w.sizeX,
1037
+ height: w.sizeY
1038
+ });
1039
+ var el = this_1.widgets.filter(function (c) { return c !== w; }).find(function (c) {
1040
+ return rec.intersect({
1041
+ left: c.col,
1042
+ top: c.row,
1043
+ width: c.sizeX,
1044
+ height: c.sizeY
1045
+ });
1046
+ });
1047
+ if (el == null) {
1048
+ w.col = i;
1049
+ w.row = j;
1050
+ return { value: void 0 };
1051
+ }
1052
+ };
1053
+ var this_1 = this;
1054
+ for (var i = 1; i <= xTile - w.sizeX; i++) {
1055
+ var state_1 = _loop_1(i);
1056
+ if (typeof state_1 === "object")
1057
+ return state_1.value;
1058
+ }
1059
+ }
1060
+ };
1061
+ AXWidgetBoardComponent.prototype.detectBestPlacement = function () {
1062
+ var _this = this;
1063
+ this.zone.runOutsideAngular(function () {
1064
+ var p = _this.container.nativeElement.querySelector('.widget-blank-placeholder');
1065
+ var col = Math.ceil(_this.dragItem.offsetLeft / _this.tileSize);
1066
+ if (_this.rtl) {
1067
+ col = Math.ceil((_this.container.nativeElement.clientWidth - (_this.dragItem.offsetLeft + _this.dragItem.clientWidth)) / _this.tileSize);
1068
+ }
1069
+ var row = Math.ceil(_this.dragItem.offsetTop / _this.tileSize);
1070
+ if (col < 1) {
1071
+ col = 1;
1072
+ }
1073
+ if (row < 1) {
1074
+ row = 1;
1075
+ }
1076
+ var widgets = Array.from(_this.ref.nativeElement.querySelectorAll('.widget-host')).map(function (c) { return c; });
1077
+ p.setAttribute(_this.DATA_COL, col.toString());
1078
+ p.setAttribute(_this.DATA_ROW, row.toString());
1079
+ var collision = widgets.filter(function (c) { return c !== _this.dragItem; }).some(function (c) { return core$1.AXHtmlUtil.collision(c, _this.dragItem); });
1080
+ if (collision) {
1081
+ _this.removePlaceholder();
1082
+ }
1083
+ });
1084
+ };
1085
+ AXWidgetBoardComponent.prototype.addPlaceholder = function () {
1086
+ var _this = this;
1087
+ this.zone.runOutsideAngular(function () {
1088
+ _this.removePlaceholder();
1089
+ if (_this.dragItem) {
1090
+ var p = document.createElement('div');
1091
+ p.classList.add('widget-blank-placeholder');
1092
+ p.setAttribute(_this.DATA_COL, _this.dragItem.getAttribute(_this.DATA_COL));
1093
+ p.setAttribute(_this.DATA_ROW, _this.dragItem.getAttribute(_this.DATA_ROW));
1094
+ p.setAttribute(_this.DATA_SIZE_X, _this.dragItem.getAttribute(_this.DATA_SIZE_X));
1095
+ p.setAttribute(_this.DATA_SIZE_Y, _this.dragItem.getAttribute(_this.DATA_SIZE_Y));
1096
+ _this.container.nativeElement.appendChild(p);
1097
+ }
1098
+ });
1099
+ };
1100
+ AXWidgetBoardComponent.prototype.removePlaceholder = function () {
1101
+ var _a;
1102
+ var p = this.container.nativeElement.querySelector('.widget-blank-placeholder');
1103
+ (_a = p) === null || _a === void 0 ? void 0 : _a.remove();
1104
+ };
1105
+ AXWidgetBoardComponent.prototype.startEdit = function () {
1106
+ var _this = this;
1107
+ this._isInEditing = true;
1108
+ this.calcGridSize();
1109
+ this.ref.nativeElement.classList.add('grid-background');
1110
+ var bg = this.ref.nativeElement;
1111
+ bg.style.setProperty('background-position', (this.rtl ? 'right' : 'left') + " top");
1112
+ // tslint:disable-next-line: max-line-length
1113
+ var 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>')";
1114
+ bg.style.setProperty('background-image', pattern);
1115
+ //
1116
+ var widgets = Array.from(this.ref.nativeElement.querySelectorAll('.widget-host'));
1117
+ widgets.forEach(function (w) {
1118
+ w.addEventListener('mousedown', _this.dragStart.bind(_this), false);
1119
+ });
1120
+ this.ref.nativeElement.addEventListener('mousemove', this.drag.bind(this), false);
1121
+ this.ref.nativeElement.addEventListener('mouseup', this.dragEnd.bind(this), false);
1122
+ };
1123
+ AXWidgetBoardComponent.prototype.finishEdit = function () {
1124
+ var _this = this;
1125
+ this.ref.nativeElement.classList.remove('grid-background');
1126
+ var bg = this.ref.nativeElement;
1127
+ bg.style.removeProperty('background-image');
1128
+ //
1129
+ this._isInEditing = false;
1130
+ var widgets = Array.from(this.ref.nativeElement.querySelectorAll('.widget-host'));
1131
+ widgets.forEach(function (w) {
1132
+ w.removeEventListener('mousedown', _this.dragStart.bind(_this), false);
1133
+ });
1134
+ this.ref.nativeElement.removeEventListener('mousemove', this.drag.bind(this), false);
1135
+ this.ref.nativeElement.removeEventListener('mouseup', this.dragEnd.bind(this), false);
1136
+ this.emitConfigChanged();
1137
+ };
1138
+ AXWidgetBoardComponent.prototype.addWidget = function (widget) {
1139
+ var _this = this;
1140
+ this.zone.runOutsideAngular(function () {
1141
+ _this.newWidget = {
1142
+ uniqueName: widget.uniqueName,
1143
+ component: widget.component,
1144
+ title: widget.title,
1145
+ col: 1,
1146
+ row: 1,
1147
+ sizeX: widget.sizeX,
1148
+ sizeY: widget.sizeY,
1149
+ options: widget.options,
1150
+ props: widget.props
1151
+ };
1152
+ _this.detectFirstEmptySlot(_this.newWidget);
1153
+ var w = {
1154
+ uniqueName: _this.newWidget.uniqueName,
1155
+ component: _this.newWidget.component,
1156
+ title: _this.newWidget.title,
1157
+ options: _this.newWidget.options,
1158
+ props: _this.newWidget.props,
1159
+ sizeX: _this.newWidget.sizeX,
1160
+ sizeY: _this.newWidget.sizeY,
1161
+ col: _this.newWidget.col,
1162
+ row: _this.newWidget.row
1163
+ };
1164
+ _this.widgets.push(w);
1165
+ _this.newWidget = null;
1166
+ _this.zone.run(function () {
1167
+ _this.cdr.detectChanges();
1168
+ _this.calcGridSize();
1169
+ _this.emitConfigChanged();
1170
+ setTimeout(function () {
1171
+ w['__meta__'].instance.element.addEventListener('mousedown', _this.dragStart.bind(_this), false);
1172
+ }, 1000);
1173
+ });
1174
+ });
1175
+ };
1176
+ AXWidgetBoardComponent.prototype.handleOnRemove = function (w) {
1177
+ var _this = this;
1178
+ w.element.classList.add('animate__animated', 'animate__zoomOut');
1179
+ w.element.addEventListener('animationend', function () {
1180
+ _this.widgets = _this.widgets.filter(function (c) { return c.__meta__.id !== w.config.__meta__.id; });
1181
+ _this.cdr.detectChanges();
1182
+ _this.calcGridSize();
1183
+ _this.emitConfigChanged();
1184
+ });
1185
+ };
1186
+ AXWidgetBoardComponent.prototype.handleOnSave = function (e) {
1187
+ this.onWidgetSave.emit(e);
1188
+ };
1189
+ AXWidgetBoardComponent.prototype.trackByFn = function (index, item) {
1190
+ var _a, _b;
1191
+ if (!((_a = item['__meta__']) === null || _a === void 0 ? void 0 : _a.id)) {
1192
+ item['__meta__'] = {};
1193
+ item['__meta__'].id = core$1.AXHtmlUtil.getUID();
1194
+ }
1195
+ return (_b = item['__meta__']) === null || _b === void 0 ? void 0 : _b.id;
1196
+ };
1197
+ AXWidgetBoardComponent.prototype.load = function (widgets) {
1198
+ var _this = this;
1199
+ this.clear();
1200
+ return new Promise(function (resolve, reject) {
1201
+ if (widgets) {
1202
+ var loadedWidgets_1 = [];
1203
+ if (typeof widgets === 'string') {
1204
+ try {
1205
+ loadedWidgets_1.push.apply(loadedWidgets_1, __spread(JSON.parse(widgets)));
1206
+ }
1207
+ catch (error) {
1208
+ reject('Invalid widget json data!');
1209
+ }
1210
+ }
1211
+ else {
1212
+ loadedWidgets_1.push.apply(loadedWidgets_1, __spread(widgets));
1213
+ }
1214
+ var intervalId_1 = -1;
1215
+ var loadFunc = function () {
1216
+ var _a;
1217
+ if (_this.galleryItems && _this.galleryItems.length > 0) {
1218
+ loadedWidgets_1.forEach(function (w) {
1219
+ var gitem = _this.galleryItems.find(function (c) { return c.uniqueName === w.uniqueName; });
1220
+ if (gitem) {
1221
+ w.component = gitem.component;
1222
+ if (gitem.props) {
1223
+ w.props = JSON.parse(JSON.stringify(gitem.props));
1224
+ }
1225
+ }
1226
+ });
1227
+ (_a = _this.widgets).push.apply(_a, __spread(loadedWidgets_1));
1228
+ window.clearInterval(intervalId_1);
1229
+ _this.cdr.detectChanges();
1230
+ resolve();
1231
+ }
1232
+ };
1233
+ intervalId_1 = window.setInterval(loadFunc, 200);
1234
+ }
1235
+ else {
1236
+ resolve();
1237
+ }
1238
+ });
1239
+ };
1240
+ AXWidgetBoardComponent.prototype.clear = function () {
1241
+ if (this.widgets.length) {
1242
+ this.widgets = [];
1243
+ this.cdr.detectChanges();
1244
+ this.emitConfigChanged();
1245
+ }
1246
+ };
1247
+ AXWidgetBoardComponent.prototype.save = function () {
1248
+ var obj = this.widgets.map(function (c) { return ({
1249
+ uniqueName: c.uniqueName,
1250
+ component: c.component,
1251
+ title: c.title,
1252
+ sizeX: c.sizeX,
1253
+ sizeY: c.sizeY,
1254
+ col: c.col,
1255
+ row: c.row,
1256
+ options: c.options,
1257
+ props: c.props
1258
+ }); });
1259
+ return Promise.resolve(JSON.stringify(obj));
1260
+ };
1261
+ AXWidgetBoardComponent.prototype.refresh = function () {
1262
+ this.widgetHosts.forEach(function (host) {
1263
+ host.widget.refresh();
1264
+ });
1265
+ };
1266
+ AXWidgetBoardComponent.prototype.handleOnConfigChanged = function (e) {
1267
+ this.cdr.detectChanges();
1268
+ this.emitConfigChanged();
1269
+ };
1270
+ AXWidgetBoardComponent.prototype.handleOnResizedChanged = function (e) {
1271
+ this.detectFirstEmptySlot(e.config);
1272
+ this.cdr.detectChanges();
1273
+ this.emitConfigChanged();
1274
+ };
1275
+ AXWidgetBoardComponent.prototype.emitConfigChanged = function () {
1276
+ var _this = this;
1277
+ if (!this.resizeChangeObserver) {
1278
+ this.resizeChangeObserver = new rxjs.Observable();
1279
+ rxjs.Observable.create(function (observer) {
1280
+ _this.resizeChangeObserver = observer;
1281
+ })
1282
+ .pipe(operators.debounceTime(750))
1283
+ .pipe(operators.distinctUntilChanged())
1284
+ .subscribe(function (c) {
1285
+ _this.onConfigChanged.emit({
1286
+ component: _this
1287
+ });
1288
+ });
1289
+ }
1290
+ this.resizeChangeObserver.next(new Date());
1291
+ };
1292
+ AXWidgetBoardComponent.ctorParameters = function () { return [
1293
+ { type: core.ElementRef },
1294
+ { type: core.NgZone },
1295
+ { type: core.ChangeDetectorRef }
1296
+ ]; };
1297
+ __decorate([
1298
+ core.ViewChild('container'),
1299
+ __metadata("design:type", core.ElementRef)
1300
+ ], AXWidgetBoardComponent.prototype, "container", void 0);
1301
+ __decorate([
1302
+ core.ViewChildren(AXWidgetHostComponent),
1303
+ __metadata("design:type", core.QueryList)
1304
+ ], AXWidgetBoardComponent.prototype, "widgetHosts", void 0);
1305
+ __decorate([
1306
+ core.Input(),
1307
+ __metadata("design:type", Array)
1308
+ ], AXWidgetBoardComponent.prototype, "galleryItems", void 0);
1309
+ __decorate([
1310
+ core.Input(),
1311
+ __metadata("design:type", Number)
1312
+ ], AXWidgetBoardComponent.prototype, "tileSize", void 0);
1313
+ __decorate([
1314
+ core.Input(),
1315
+ __metadata("design:type", Number)
1316
+ ], AXWidgetBoardComponent.prototype, "gapSize", void 0);
1317
+ __decorate([
1318
+ core.Input(),
1319
+ __metadata("design:type", Function)
1320
+ ], AXWidgetBoardComponent.prototype, "provideValue", void 0);
1321
+ __decorate([
1322
+ core.Output(),
1323
+ __metadata("design:type", core.EventEmitter)
1324
+ ], AXWidgetBoardComponent.prototype, "onConfigChanged", void 0);
1325
+ __decorate([
1326
+ core.Output(),
1327
+ __metadata("design:type", core.EventEmitter)
1328
+ ], AXWidgetBoardComponent.prototype, "onWidgetSave", void 0);
1329
+ AXWidgetBoardComponent = __decorate([
1330
+ core.Component({
1331
+ selector: 'ax-widget-board',
1332
+ template: "<div class=\"widgets-container\" [class.rtl]=\"rtl\" #container>\r\n <ax-widget-host *ngFor=\"let w of widgets;trackBy: trackByFn\" [config]='w' [sizeX]=\"w.sizeX\"\r\n [sizeY]=\"w.sizeY\" [col]=\"w.col\" [row]=\"w.row\" (onRemove)=\"handleOnRemove($event)\" (onSave)=\"handleOnSave($event)\"\r\n (onConfigChanged)=\"handleOnConfigChanged($event)\" (onResized)=\"handleOnResizedChanged($event)\"\r\n [provideValue]=\"provideValue\">\r\n </ax-widget-host>\r\n</div>\r\n",
1333
+ host: { class: 'ax widget-board' },
1334
+ encapsulation: core.ViewEncapsulation.None,
1335
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1336
+ styles: [".widget-board{display:inline-block;margin:15px 20px;min-width:calc(100% - 40px);min-height:calc(100% - 34px);--animate-duration:0.5s;background-repeat:no-repeat}.widget-board.grid-background{background-repeat:repeat!important}.widget-board.grid-background .widgets-container .widget-host{touch-action:none;touch-action:none;-webkit-user-select:none;-moz-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:rgba(255,255,255,.85);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:rgba(255,255,255,.5);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}.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}"]
1337
+ }),
1338
+ __metadata("design:paramtypes", [core.ElementRef,
1339
+ core.NgZone,
1340
+ core.ChangeDetectorRef])
1341
+ ], AXWidgetBoardComponent);
1342
+ return AXWidgetBoardComponent;
1343
+ }());
1344
+
1345
+ var AXWidgetSizePropertyEditorComponent = /** @class */ (function (_super) {
1346
+ __extends(AXWidgetSizePropertyEditorComponent, _super);
1347
+ function AXWidgetSizePropertyEditorComponent(cdr) {
1348
+ var _this = _super.call(this, cdr) || this;
1349
+ _this.cdr = cdr;
1350
+ _this.minX = 1;
1351
+ _this.maxX = 10;
1352
+ _this.minY = 1;
1353
+ _this.maxY = 10;
1354
+ return _this;
1355
+ }
1356
+ AXWidgetSizePropertyEditorComponent.prototype.ngOnInit = function () {
1357
+ if (Array.isArray(this.value)) {
1358
+ this.sizeX = this.value[0];
1359
+ this.sizeY = this.value[1];
1360
+ }
1361
+ else {
1362
+ this.sizeX = 2;
1363
+ this.sizeY = 2;
1364
+ }
1365
+ };
1366
+ AXWidgetSizePropertyEditorComponent.prototype.handleMinValueChange = function (e) {
1367
+ this.sizeX = e.value;
1368
+ if (this.sizeY > 0) {
1369
+ _super.prototype.handleValueChange.call(this, [this.sizeX, this.sizeY]);
1370
+ }
1371
+ };
1372
+ AXWidgetSizePropertyEditorComponent.prototype.handleMaxValueChange = function (e) {
1373
+ this.sizeY = e.value;
1374
+ if (this.sizeX > 0) {
1375
+ _super.prototype.handleValueChange.call(this, [this.sizeX, this.sizeY]);
1376
+ }
1377
+ };
1378
+ AXWidgetSizePropertyEditorComponent.prototype.ngAfterViewInit = function () {
1379
+ this.initiated = true;
1380
+ };
1381
+ AXWidgetSizePropertyEditorComponent.ctorParameters = function () { return [
1382
+ { type: core.ChangeDetectorRef }
1383
+ ]; };
1384
+ AXWidgetSizePropertyEditorComponent = __decorate([
1385
+ core.Component({
1386
+ template: "<div style=\"display: flex;\">\r\n <div style=\"margin-inline-end: 0.5em;flex: calc(50% - 0.25em);\">\r\n <ax-number-box (onValueChanged)=\"handleMinValueChange($event)\" [value]=\"sizeX\" [min]=\"minX\" [max]=\"maxX\">\r\n </ax-number-box>\r\n </div>\r\n <div style=\"flex: calc(50% - 0.25em);\">\r\n <ax-number-box (onValueChanged)=\"handleMaxValueChange($event)\" [value]=\"sizeY\" [min]=\"minY\" [max]=\"maxY\">\r\n </ax-number-box>\r\n </div>\r\n</div>"
1387
+ }),
1388
+ __metadata("design:paramtypes", [core.ChangeDetectorRef])
1389
+ ], AXWidgetSizePropertyEditorComponent);
1390
+ return AXWidgetSizePropertyEditorComponent;
1391
+ }(components.AXProperyEditorComponent));
1392
+
1393
+ var AXWidgetSizePropertyEditorModule = /** @class */ (function () {
1394
+ function AXWidgetSizePropertyEditorModule() {
1395
+ }
1396
+ AXWidgetSizePropertyEditorModule = __decorate([
1397
+ core.NgModule({
1398
+ declarations: [AXWidgetSizePropertyEditorComponent],
1399
+ imports: [common.CommonModule, forms.FormsModule, components.AXNumberBoxModule],
1400
+ exports: [AXWidgetSizePropertyEditorComponent],
1401
+ entryComponents: [AXWidgetSizePropertyEditorComponent],
1402
+ providers: [],
1403
+ }),
1404
+ __metadata("design:paramtypes", [])
1405
+ ], AXWidgetSizePropertyEditorModule);
1406
+ return AXWidgetSizePropertyEditorModule;
1407
+ }());
1408
+
1409
+ var AXWidgetBoardModule = /** @class */ (function () {
1410
+ /**
1411
+ *
1412
+ */
1413
+ function AXWidgetBoardModule() {
1414
+ core$1.AXTranslator.load('en', {
1415
+ 'widget-board': {
1416
+ 'configurable-props': 'Configurable Properties',
1417
+ configure: 'Configure Widget'
1418
+ }
1419
+ });
1420
+ core$1.AXTranslator.load('fa', {
1421
+ 'widget-board': {
1422
+ 'configurable-props': 'ویژگی های قابل تنظیم',
1423
+ configure: 'پیکر بندی ابزارک'
1424
+ }
1425
+ });
1426
+ }
1427
+ AXWidgetBoardModule = __decorate([
1428
+ core.NgModule({
1429
+ imports: [
1430
+ common.CommonModule,
1431
+ components.AXSearchBoxModule,
1432
+ components.AXLoadingModule,
1433
+ router.RouterModule,
1434
+ components.AXProppertyEditorModule,
1435
+ components.AXPageModule,
1436
+ components.AXToolbarModule,
1437
+ core$1.AXTranslatorModule,
1438
+ components.AXLabelModule,
1439
+ components.AXTextAreaModule,
1440
+ components.AXFieldsetModule,
1441
+ components.AXTextBoxModule,
1442
+ components.AXFormGroupModule,
1443
+ components.AXTabStripModule,
1444
+ components.AXCheckBoxModule,
1445
+ components.AXMenuModule,
1446
+ core$1.AXTranslatorModule,
1447
+ AXWidgetSizePropertyEditorModule,
1448
+ components.AXValidationModule,
1449
+ router.RouterModule.forChild([
1450
+ {
1451
+ component: AXWidgetSizePropertyEditorComponent,
1452
+ path: 'ax/editors/widget-size'
1453
+ },
1454
+ ])
1455
+ ],
1456
+ exports: [AXWidgetBoardComponent, components.AXProppertyEditorModule],
1457
+ declarations: [AXWidgetBoardComponent, AXWidgetHostComponent, AXWidgetConfigComponent, AXWidgetSaveComponent],
1458
+ entryComponents: [AXWidgetConfigComponent, AXWidgetSaveComponent],
1459
+ providers: []
1460
+ }),
1461
+ __metadata("design:paramtypes", [])
1462
+ ], AXWidgetBoardModule);
1463
+ return AXWidgetBoardModule;
1464
+ }());
1465
+
1466
+ exports.AXWidgetBoardComponent = AXWidgetBoardComponent;
1467
+ exports.AXWidgetBoardModule = AXWidgetBoardModule;
1468
+ exports.AXWidgetComponent = AXWidgetComponent;
1469
+ exports.AXWidgetHostComponent = AXWidgetHostComponent;
1470
+ exports.AXWidgetSizePropertyEditorComponent = AXWidgetSizePropertyEditorComponent;
1471
+ exports.AXWidgetSizePropertyEditorModule = AXWidgetSizePropertyEditorModule;
1472
+ exports.ɵ0 = ɵ0;
1473
+ exports.ɵa = AXWidgetConfigComponent;
1474
+ exports.ɵb = AXWidgetSaveComponent;
1475
+
1476
+ Object.defineProperty(exports, '__esModule', { value: true });
1477
+
1478
+ })));
1479
+ //# sourceMappingURL=acorex-layout.umd.js.map