@acorex/layout 3.0.65 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/acorex-layout.d.ts +1 -2
- package/esm2020/acorex-layout.mjs +5 -0
- package/esm2020/lib/widget-board/editors/widget-size-editor/widget-size.editor.mjs +46 -0
- package/esm2020/lib/widget-board/editors/widget-size-editor/widget-size.module.mjs +21 -0
- package/esm2020/lib/widget-board/widget-board.component.mjs +441 -0
- package/esm2020/lib/widget-board/widget-board.module.mjs +111 -0
- package/esm2020/lib/widget-board/widget-config.component.mjs +82 -0
- package/esm2020/lib/widget-board/widget-host.component.mjs +290 -0
- package/esm2020/lib/widget-board/widget-save.component.mjs +79 -0
- package/esm2020/lib/widget-board/widget.class.mjs +127 -0
- package/esm2020/public-api.mjs +7 -0
- package/fesm2015/acorex-layout.mjs +1166 -0
- package/fesm2015/acorex-layout.mjs.map +1 -0
- package/fesm2020/acorex-layout.mjs +1159 -0
- package/fesm2020/acorex-layout.mjs.map +1 -0
- package/lib/widget-board/editors/widget-size-editor/widget-size.editor.d.ts +3 -0
- package/lib/widget-board/editors/widget-size-editor/widget-size.module.d.ts +8 -0
- package/lib/widget-board/widget-board.component.d.ts +3 -0
- package/lib/widget-board/widget-board.module.d.ts +12 -0
- package/lib/widget-board/widget-config.component.d.ts +3 -0
- package/lib/widget-board/widget-host.component.d.ts +3 -0
- package/lib/widget-board/widget-save.component.d.ts +3 -0
- package/lib/widget-board/widget.class.d.ts +3 -0
- package/package.json +23 -13
- package/acorex-layout.metadata.json +0 -1
- package/bundles/acorex-layout.umd.js +0 -1487
- package/bundles/acorex-layout.umd.js.map +0 -1
- package/bundles/acorex-layout.umd.min.js +0 -16
- package/bundles/acorex-layout.umd.min.js.map +0 -1
- package/esm2015/acorex-layout.js +0 -7
- package/esm2015/lib/widget-board/editors/widget-size-editor/widget-size.editor.js +0 -49
- package/esm2015/lib/widget-board/editors/widget-size-editor/widget-size.module.js +0 -19
- package/esm2015/lib/widget-board/widget-board.component.js +0 -468
- package/esm2015/lib/widget-board/widget-board.module.js +0 -67
- package/esm2015/lib/widget-board/widget-config.component.js +0 -86
- package/esm2015/lib/widget-board/widget-host.component.js +0 -323
- package/esm2015/lib/widget-board/widget-save.component.js +0 -79
- package/esm2015/lib/widget-board/widget.class.js +0 -123
- package/esm2015/public-api.js +0 -7
- package/esm5/acorex-layout.js +0 -7
- package/esm5/lib/widget-board/editors/widget-size-editor/widget-size.editor.js +0 -52
- package/esm5/lib/widget-board/editors/widget-size-editor/widget-size.module.js +0 -22
- package/esm5/lib/widget-board/widget-board.component.js +0 -494
- package/esm5/lib/widget-board/widget-board.module.js +0 -68
- package/esm5/lib/widget-board/widget-config.component.js +0 -90
- package/esm5/lib/widget-board/widget-host.component.js +0 -359
- package/esm5/lib/widget-board/widget-save.component.js +0 -83
- package/esm5/lib/widget-board/widget.class.js +0 -134
- package/esm5/public-api.js +0 -7
- package/fesm2015/acorex-layout.js +0 -1177
- package/fesm2015/acorex-layout.js.map +0 -1
- package/fesm5/acorex-layout.js +0 -1264
- package/fesm5/acorex-layout.js.map +0 -1
@@ -1,1487 +0,0 @@
|
|
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
|
-
this.configMenuItem[0].items.push({
|
642
|
-
name: 'refresh',
|
643
|
-
icon: 'far fa-undo',
|
644
|
-
text: core$1.AXTranslator.get('common.refresh'),
|
645
|
-
onClick: function () {
|
646
|
-
var _a, _b;
|
647
|
-
(_b = (_a = _this) === null || _a === void 0 ? void 0 : _a.widget) === null || _b === void 0 ? void 0 : _b.refresh();
|
648
|
-
}
|
649
|
-
});
|
650
|
-
//
|
651
|
-
if (this._hasProps) {
|
652
|
-
this.configMenuItem[0].items.push({
|
653
|
-
name: 'configs',
|
654
|
-
icon: 'far fa-cogs',
|
655
|
-
text: core$1.AXTranslator.get('common.configs'),
|
656
|
-
onClick: function () {
|
657
|
-
_this.openConfigDialog();
|
658
|
-
}
|
659
|
-
});
|
660
|
-
}
|
661
|
-
this.configMenuItem[0].items.push({
|
662
|
-
name: 'save',
|
663
|
-
icon: 'far fa-save',
|
664
|
-
text: core$1.AXTranslator.get('common.save-as'),
|
665
|
-
onClick: function () {
|
666
|
-
_this.openSaveDialog();
|
667
|
-
}
|
668
|
-
});
|
669
|
-
if (true) {
|
670
|
-
this.configMenuItem[0].items.push({
|
671
|
-
name: 'remove',
|
672
|
-
icon: 'far fa-times',
|
673
|
-
style: 'ax danger blank',
|
674
|
-
text: core$1.AXTranslator.get('common.remove'),
|
675
|
-
onClick: function () {
|
676
|
-
_this.onRemove.emit(_this);
|
677
|
-
}
|
678
|
-
});
|
679
|
-
}
|
680
|
-
this._hasMenu = this.configMenuItem[0].items.length > 0;
|
681
|
-
this.cdr.detectChanges();
|
682
|
-
return [2 /*return*/];
|
683
|
-
}
|
684
|
-
});
|
685
|
-
});
|
686
|
-
};
|
687
|
-
AXWidgetHostComponent.prototype.setSizeFromOptions = function () {
|
688
|
-
var _this = this;
|
689
|
-
this._widget.getValue('widgetSize').then(function (c) {
|
690
|
-
var oldSizeX = _this.sizeX;
|
691
|
-
var oldSizeY = _this.sizeY;
|
692
|
-
if (c && Array.isArray(c) && (oldSizeX !== c[0] || oldSizeY !== c[1])) {
|
693
|
-
_this.config.sizeX = _this.sizeX = c[0];
|
694
|
-
_this.config.sizeY = _this.sizeY = c[1];
|
695
|
-
_this.onResized.emit({
|
696
|
-
component: _this._widget,
|
697
|
-
config: _this.config
|
698
|
-
});
|
699
|
-
}
|
700
|
-
_this.cdr.detectChanges();
|
701
|
-
});
|
702
|
-
};
|
703
|
-
AXWidgetHostComponent.prototype.remove = function (e) {
|
704
|
-
e.preventDefault();
|
705
|
-
e.stopPropagation();
|
706
|
-
this.onRemove.emit(this);
|
707
|
-
return false;
|
708
|
-
};
|
709
|
-
AXWidgetHostComponent.prototype.handleConfig = function (e) {
|
710
|
-
e.preventDefault();
|
711
|
-
e.stopPropagation();
|
712
|
-
this.openConfigDialog();
|
713
|
-
return false;
|
714
|
-
};
|
715
|
-
AXWidgetHostComponent.prototype.openConfigDialog = function () {
|
716
|
-
var _this = this;
|
717
|
-
var ppp = this.getMergedProps();
|
718
|
-
this.popup.open(AXWidgetConfigComponent, {
|
719
|
-
title: core$1.AXTranslator.get('common.configs'),
|
720
|
-
size: 'sm',
|
721
|
-
data: {
|
722
|
-
props: ppp.map(function (c) { return ({ property: c.options, value: _this._widget[c.options.name] }); }),
|
723
|
-
widget: this.widget
|
724
|
-
}
|
725
|
-
}).then(function (c) {
|
726
|
-
if (c.data) {
|
727
|
-
if (!_this.config.options) {
|
728
|
-
_this.config.options = {};
|
729
|
-
}
|
730
|
-
c.data.forEach(function (p) {
|
731
|
-
_this._widget.setValue(p.property.name, p.value);
|
732
|
-
_this.config.options[p.property.name] = p.value;
|
733
|
-
});
|
734
|
-
_this.emitConfigChanged();
|
735
|
-
_this._widget.redraw();
|
736
|
-
_this.cdr.detectChanges();
|
737
|
-
}
|
738
|
-
});
|
739
|
-
};
|
740
|
-
AXWidgetHostComponent.prototype.openSaveDialog = function () {
|
741
|
-
var _this = this;
|
742
|
-
var ppp = this.getMergedProps();
|
743
|
-
this.popup.open(AXWidgetSaveComponent, {
|
744
|
-
title: core$1.AXTranslator.get('common.save-as'),
|
745
|
-
size: 'sm',
|
746
|
-
data: {
|
747
|
-
config: this.config,
|
748
|
-
props: ppp.map(function (c) { return ({ property: c.options, value: _this._widget[c.options.name] }); })
|
749
|
-
}
|
750
|
-
}).then(function (c) {
|
751
|
-
if (c.data) {
|
752
|
-
_this.onSave.emit({
|
753
|
-
component: _this._widget,
|
754
|
-
data: c.data
|
755
|
-
});
|
756
|
-
}
|
757
|
-
});
|
758
|
-
};
|
759
|
-
AXWidgetHostComponent.prototype.handleOptionClick = function (e) {
|
760
|
-
e.preventDefault();
|
761
|
-
e.stopPropagation();
|
762
|
-
this.openConfigDialog();
|
763
|
-
return false;
|
764
|
-
};
|
765
|
-
AXWidgetHostComponent.prototype.ngOnDestroy = function () {
|
766
|
-
this.vc.clear();
|
767
|
-
if (this.componentRef) {
|
768
|
-
this.componentRef.destroy();
|
769
|
-
}
|
770
|
-
};
|
771
|
-
AXWidgetHostComponent.prototype.getMergedProps = function () {
|
772
|
-
var ppp = core$1.AXObjectUtil.deepCopy(components.AXPropertyDecorators.getProperties(this._widget));
|
773
|
-
var _loop_1 = function (key) {
|
774
|
-
if (Object.prototype.hasOwnProperty.call(this_1.config.props, key)) {
|
775
|
-
var newP = this_1.config.props[key];
|
776
|
-
var existPropDec = ppp.find(function (p) { return p.property === key; });
|
777
|
-
if (existPropDec) {
|
778
|
-
Object.assign(existPropDec.options, newP);
|
779
|
-
}
|
780
|
-
}
|
781
|
-
};
|
782
|
-
var this_1 = this;
|
783
|
-
for (var key in this.config.props) {
|
784
|
-
_loop_1(key);
|
785
|
-
}
|
786
|
-
return ppp;
|
787
|
-
};
|
788
|
-
AXWidgetHostComponent.prototype.emitConfigChanged = function () {
|
789
|
-
this.onConfigChanged.emit({
|
790
|
-
component: this._widget,
|
791
|
-
config: this.config
|
792
|
-
});
|
793
|
-
};
|
794
|
-
AXWidgetHostComponent.ctorParameters = function () { return [
|
795
|
-
{ type: core.ElementRef },
|
796
|
-
{ type: core.ComponentFactoryResolver },
|
797
|
-
{ type: core$1.AXRenderService },
|
798
|
-
{ type: core.ChangeDetectorRef },
|
799
|
-
{ type: components.AXPopupService },
|
800
|
-
{ type: components.AXLoadingService }
|
801
|
-
]; };
|
802
|
-
__decorate([
|
803
|
-
core.Input(),
|
804
|
-
__metadata("design:type", Function)
|
805
|
-
], AXWidgetHostComponent.prototype, "provideValue", void 0);
|
806
|
-
__decorate([
|
807
|
-
core.Output(),
|
808
|
-
__metadata("design:type", core.EventEmitter)
|
809
|
-
], AXWidgetHostComponent.prototype, "onRemove", void 0);
|
810
|
-
__decorate([
|
811
|
-
core.Output(),
|
812
|
-
__metadata("design:type", core.EventEmitter)
|
813
|
-
], AXWidgetHostComponent.prototype, "onConfigChanged", void 0);
|
814
|
-
__decorate([
|
815
|
-
core.Output(),
|
816
|
-
__metadata("design:type", core.EventEmitter)
|
817
|
-
], AXWidgetHostComponent.prototype, "onResized", void 0);
|
818
|
-
__decorate([
|
819
|
-
core.Output(),
|
820
|
-
__metadata("design:type", core.EventEmitter)
|
821
|
-
], AXWidgetHostComponent.prototype, "onSave", void 0);
|
822
|
-
__decorate([
|
823
|
-
core.Input(),
|
824
|
-
__metadata("design:type", Object)
|
825
|
-
], AXWidgetHostComponent.prototype, "config", void 0);
|
826
|
-
__decorate([
|
827
|
-
core.ViewChild('vc', { read: core.ViewContainerRef }),
|
828
|
-
__metadata("design:type", core.ViewContainerRef)
|
829
|
-
], AXWidgetHostComponent.prototype, "vc", void 0);
|
830
|
-
__decorate([
|
831
|
-
core.HostBinding('attr.data-size-x'),
|
832
|
-
core.Input(),
|
833
|
-
__metadata("design:type", Number)
|
834
|
-
], AXWidgetHostComponent.prototype, "sizeX", void 0);
|
835
|
-
__decorate([
|
836
|
-
core.HostBinding('attr.data-size-y'),
|
837
|
-
core.Input(),
|
838
|
-
__metadata("design:type", Number)
|
839
|
-
], AXWidgetHostComponent.prototype, "sizeY", void 0);
|
840
|
-
__decorate([
|
841
|
-
core.HostBinding('attr.data-col'),
|
842
|
-
core.Input(),
|
843
|
-
__metadata("design:type", Number)
|
844
|
-
], AXWidgetHostComponent.prototype, "col", void 0);
|
845
|
-
__decorate([
|
846
|
-
core.HostBinding('attr.data-row'),
|
847
|
-
core.Input(),
|
848
|
-
__metadata("design:type", Number)
|
849
|
-
], AXWidgetHostComponent.prototype, "row", void 0);
|
850
|
-
AXWidgetHostComponent = __decorate([
|
851
|
-
core.Component({
|
852
|
-
selector: 'ax-widget-host',
|
853
|
-
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\" aria-hidden=\"true\"></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\" aria-hidden=\"true\"></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\" aria-hidden=\"true\"></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>",
|
854
|
-
host: { class: 'ax widget-host', tabindex: '0' },
|
855
|
-
encapsulation: core.ViewEncapsulation.None,
|
856
|
-
changeDetection: core.ChangeDetectionStrategy.OnPush
|
857
|
-
}),
|
858
|
-
__metadata("design:paramtypes", [core.ElementRef,
|
859
|
-
core.ComponentFactoryResolver,
|
860
|
-
core$1.AXRenderService,
|
861
|
-
core.ChangeDetectorRef,
|
862
|
-
components.AXPopupService,
|
863
|
-
components.AXLoadingService])
|
864
|
-
], AXWidgetHostComponent);
|
865
|
-
return AXWidgetHostComponent;
|
866
|
-
}());
|
867
|
-
|
868
|
-
var AXWidgetBoardComponent = /** @class */ (function () {
|
869
|
-
function AXWidgetBoardComponent(ref, zone, cdr) {
|
870
|
-
this.ref = ref;
|
871
|
-
this.zone = zone;
|
872
|
-
this.cdr = cdr;
|
873
|
-
this.widgets = [];
|
874
|
-
this.galleryItems = [];
|
875
|
-
this.tileSize = 80;
|
876
|
-
this.gapSize = 5;
|
877
|
-
this.newWidget = null;
|
878
|
-
this._isInEditing = false;
|
879
|
-
this.isDragging = false;
|
880
|
-
this.DATA_COL = 'data-col';
|
881
|
-
this.DATA_ROW = 'data-row';
|
882
|
-
this.DATA_SIZE_X = 'data-size-x';
|
883
|
-
this.DATA_SIZE_Y = 'data-size-y';
|
884
|
-
this.DATA_OLD_COL = 'data-old-col';
|
885
|
-
this.DATA_OLD_ROW = 'data-old-row';
|
886
|
-
this.onConfigChanged = new core.EventEmitter();
|
887
|
-
this.onWidgetSave = new core.EventEmitter();
|
888
|
-
}
|
889
|
-
AXWidgetBoardComponent.prototype.isInEditing = function () {
|
890
|
-
return this._isInEditing;
|
891
|
-
};
|
892
|
-
AXWidgetBoardComponent.prototype.ngOnInit = function () {
|
893
|
-
if (this.rtl == null) {
|
894
|
-
this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue('direction') === 'rtl';
|
895
|
-
}
|
896
|
-
};
|
897
|
-
AXWidgetBoardComponent.prototype.ngAfterViewInit = function () {
|
898
|
-
var _this = this;
|
899
|
-
this.zone.runOutsideAngular(function (c) {
|
900
|
-
var style = document.createElement('style');
|
901
|
-
style.type = 'text/css';
|
902
|
-
_this.ref.nativeElement.appendChild(style);
|
903
|
-
// add css data classes
|
904
|
-
for (var i = 1; i <= 50; i++) {
|
905
|
-
style.innerHTML += "[" + _this.DATA_COL + "=\"" + i + "\"] { " + (_this.rtl ? 'right' : 'left') + ": " + (i - 1) * (_this.tileSize + _this.gapSize) + "px; }";
|
906
|
-
style.innerHTML += "[" + _this.DATA_ROW + "=\"" + i + "\"] { top: " + (i - 1) * (_this.tileSize + _this.gapSize) + "px; }";
|
907
|
-
style.innerHTML += "[" + _this.DATA_SIZE_X + "=\"" + i + "\"] { width: " + ((i * _this.tileSize) + ((i - 1) * _this.gapSize)) + "px; }";
|
908
|
-
style.innerHTML += "[" + _this.DATA_SIZE_Y + "=\"" + i + "\"] { height: " + ((i * _this.tileSize) + ((i - 1) * _this.gapSize)) + "px; }";
|
909
|
-
}
|
910
|
-
});
|
911
|
-
};
|
912
|
-
AXWidgetBoardComponent.prototype.calcGridSize = function () {
|
913
|
-
var _this = this;
|
914
|
-
this.zone.runOutsideAngular(function () {
|
915
|
-
var width = (Math.max.apply(Math, __spread(_this.widgets.map(function (c) { return c.col + c.sizeX - 1; })))) * (_this.tileSize + _this.gapSize);
|
916
|
-
var height = (Math.max.apply(Math, __spread(_this.widgets.map(function (c) { return c.row + c.sizeY - 1; })))) * (_this.tileSize + _this.gapSize);
|
917
|
-
_this.container.nativeElement.style.width = width + 'px';
|
918
|
-
_this.container.nativeElement.style.height = height + 'px';
|
919
|
-
});
|
920
|
-
};
|
921
|
-
AXWidgetBoardComponent.prototype.toggleEdit = function () {
|
922
|
-
this._isInEditing ? this.finishEdit() : this.startEdit();
|
923
|
-
};
|
924
|
-
AXWidgetBoardComponent.prototype.dragStart = function (e) {
|
925
|
-
var _this = this;
|
926
|
-
e.preventDefault();
|
927
|
-
e.stopPropagation();
|
928
|
-
this.zone.runOutsideAngular(function () {
|
929
|
-
if (_this._isInEditing && e.which === 1) {
|
930
|
-
_this.dragItem = e.currentTarget;
|
931
|
-
_this.dragItem.setAttribute('data-x-offset', (_this.dragItem.offsetLeft - e.clientX).toString());
|
932
|
-
//
|
933
|
-
_this.dragItem.setAttribute('data-y-offset', (_this.dragItem.offsetTop - e.clientY).toString());
|
934
|
-
_this.dragItem.classList.add('widget-dragging');
|
935
|
-
_this.dragItem.classList.remove('animate__animated', 'animate__pulse');
|
936
|
-
}
|
937
|
-
});
|
938
|
-
return false;
|
939
|
-
};
|
940
|
-
AXWidgetBoardComponent.prototype.removePositionData = function () {
|
941
|
-
var _this = this;
|
942
|
-
this.zone.runOutsideAngular(function () {
|
943
|
-
if (_this.dragItem && _this._isInEditing && _this.dragItem.getAttribute(_this.DATA_OLD_COL) == null) {
|
944
|
-
_this.dragItem.setAttribute(_this.DATA_OLD_COL, _this.dragItem.getAttribute(_this.DATA_COL));
|
945
|
-
_this.dragItem.setAttribute(_this.DATA_OLD_ROW, _this.dragItem.getAttribute(_this.DATA_ROW));
|
946
|
-
_this.dragItem.removeAttribute(_this.DATA_COL);
|
947
|
-
_this.dragItem.removeAttribute(_this.DATA_ROW);
|
948
|
-
}
|
949
|
-
});
|
950
|
-
};
|
951
|
-
AXWidgetBoardComponent.prototype.resetPositionData = function () {
|
952
|
-
var _this = this;
|
953
|
-
this.zone.runOutsideAngular(function () {
|
954
|
-
if (_this.dragItem && _this._isInEditing) {
|
955
|
-
_this.setPosition(_this.dragItem, _this.dragItem.getAttribute(_this.DATA_OLD_COL), _this.dragItem.getAttribute(_this.DATA_OLD_ROW));
|
956
|
-
}
|
957
|
-
});
|
958
|
-
};
|
959
|
-
AXWidgetBoardComponent.prototype.setPosition = function (element, col, row) {
|
960
|
-
var _this = this;
|
961
|
-
this.zone.runOutsideAngular(function () {
|
962
|
-
element.setAttribute(_this.DATA_COL, col);
|
963
|
-
element.setAttribute(_this.DATA_ROW, row);
|
964
|
-
element.removeAttribute(_this.DATA_OLD_COL);
|
965
|
-
element.removeAttribute(_this.DATA_OLD_ROW);
|
966
|
-
element.style.removeProperty('top');
|
967
|
-
element.style.removeProperty('left');
|
968
|
-
var widget = _this.widgets.find(function (c) { return c['__meta__'].instance.element === element; });
|
969
|
-
widget.col = Number(col);
|
970
|
-
widget.row = Number(row);
|
971
|
-
});
|
972
|
-
};
|
973
|
-
AXWidgetBoardComponent.prototype.drag = function (e) {
|
974
|
-
var _this = this;
|
975
|
-
e.preventDefault();
|
976
|
-
e.stopPropagation();
|
977
|
-
this.zone.runOutsideAngular(function () {
|
978
|
-
if (_this.dragItem && _this._isInEditing) {
|
979
|
-
_this.isDragging = true;
|
980
|
-
_this.addPlaceholder();
|
981
|
-
var xOffset = Number(_this.dragItem.getAttribute('data-x-offset'));
|
982
|
-
var yOffset = Number(_this.dragItem.getAttribute('data-y-offset'));
|
983
|
-
_this.dragItem.style.left = e.clientX + xOffset + 'px';
|
984
|
-
_this.dragItem.style.top = e.clientY + yOffset + 'px';
|
985
|
-
//
|
986
|
-
_this.detectBestPlacement();
|
987
|
-
_this.removePositionData();
|
988
|
-
}
|
989
|
-
});
|
990
|
-
return false;
|
991
|
-
};
|
992
|
-
AXWidgetBoardComponent.prototype.dragEnd = function (e) {
|
993
|
-
var _this = this;
|
994
|
-
this.zone.runOutsideAngular(function () {
|
995
|
-
if (_this.dragItem && _this._isInEditing && _this.isDragging) {
|
996
|
-
_this.dragItem.classList.remove('widget-dragging');
|
997
|
-
_this.dragItem.classList.add('animate__animated', 'animate__pulse');
|
998
|
-
//
|
999
|
-
var p = _this.container.nativeElement.querySelector('.widget-blank-placeholder');
|
1000
|
-
if (_this.newWidget) {
|
1001
|
-
var w_1 = {
|
1002
|
-
uniqueName: _this.newWidget.uniqueName,
|
1003
|
-
component: _this.newWidget.component,
|
1004
|
-
title: _this.newWidget.title,
|
1005
|
-
options: _this.newWidget.options,
|
1006
|
-
sizeX: _this.newWidget.sizeX,
|
1007
|
-
sizeY: _this.newWidget.sizeY,
|
1008
|
-
col: Number(p.getAttribute(_this.DATA_COL)),
|
1009
|
-
row: Number(p.getAttribute(_this.DATA_ROW))
|
1010
|
-
};
|
1011
|
-
_this.widgets.push(w_1);
|
1012
|
-
_this.newWidget = null;
|
1013
|
-
_this.container.nativeElement.removeChild(_this.dragItem);
|
1014
|
-
_this.zone.run(function () {
|
1015
|
-
_this.cdr.detectChanges();
|
1016
|
-
_this.calcGridSize();
|
1017
|
-
setTimeout(function () {
|
1018
|
-
w_1['__meta__'].instance.element.addEventListener('mousedown', _this.dragStart.bind(_this), false);
|
1019
|
-
}, 1000);
|
1020
|
-
});
|
1021
|
-
}
|
1022
|
-
else {
|
1023
|
-
if (p) {
|
1024
|
-
_this.setPosition(_this.dragItem, p.getAttribute(_this.DATA_COL), p.getAttribute(_this.DATA_ROW));
|
1025
|
-
}
|
1026
|
-
else {
|
1027
|
-
_this.setPosition(_this.dragItem, _this.dragItem.getAttribute(_this.DATA_OLD_COL), _this.dragItem.getAttribute(_this.DATA_OLD_ROW));
|
1028
|
-
}
|
1029
|
-
}
|
1030
|
-
//
|
1031
|
-
_this.removePlaceholder();
|
1032
|
-
_this.dragItem = null;
|
1033
|
-
_this.calcGridSize();
|
1034
|
-
_this.emitConfigChanged();
|
1035
|
-
}
|
1036
|
-
_this.isDragging = false;
|
1037
|
-
});
|
1038
|
-
};
|
1039
|
-
AXWidgetBoardComponent.prototype.detectFirstEmptySlot = function (w) {
|
1040
|
-
var xTile = Math.floor(this.ref.nativeElement.parentElement.offsetWidth / this.tileSize);
|
1041
|
-
for (var j = 1; j <= 100; j++) {
|
1042
|
-
var _loop_1 = function (i) {
|
1043
|
-
var rec = new core$1.AXClientRec({
|
1044
|
-
left: i,
|
1045
|
-
top: j,
|
1046
|
-
width: w.sizeX,
|
1047
|
-
height: w.sizeY
|
1048
|
-
});
|
1049
|
-
var el = this_1.widgets.filter(function (c) { return c !== w; }).find(function (c) {
|
1050
|
-
return rec.intersect({
|
1051
|
-
left: c.col,
|
1052
|
-
top: c.row,
|
1053
|
-
width: c.sizeX,
|
1054
|
-
height: c.sizeY
|
1055
|
-
});
|
1056
|
-
});
|
1057
|
-
if (el == null) {
|
1058
|
-
w.col = i;
|
1059
|
-
w.row = j;
|
1060
|
-
return { value: void 0 };
|
1061
|
-
}
|
1062
|
-
};
|
1063
|
-
var this_1 = this;
|
1064
|
-
for (var i = 1; i <= xTile - w.sizeX; i++) {
|
1065
|
-
var state_1 = _loop_1(i);
|
1066
|
-
if (typeof state_1 === "object")
|
1067
|
-
return state_1.value;
|
1068
|
-
}
|
1069
|
-
}
|
1070
|
-
};
|
1071
|
-
AXWidgetBoardComponent.prototype.detectBestPlacement = function () {
|
1072
|
-
var _this = this;
|
1073
|
-
this.zone.runOutsideAngular(function () {
|
1074
|
-
var p = _this.container.nativeElement.querySelector('.widget-blank-placeholder');
|
1075
|
-
var col = Math.ceil(_this.dragItem.offsetLeft / _this.tileSize);
|
1076
|
-
if (_this.rtl) {
|
1077
|
-
col = Math.ceil((_this.container.nativeElement.clientWidth - (_this.dragItem.offsetLeft + _this.dragItem.clientWidth)) / _this.tileSize);
|
1078
|
-
}
|
1079
|
-
var row = Math.ceil(_this.dragItem.offsetTop / _this.tileSize);
|
1080
|
-
if (col < 1) {
|
1081
|
-
col = 1;
|
1082
|
-
}
|
1083
|
-
if (row < 1) {
|
1084
|
-
row = 1;
|
1085
|
-
}
|
1086
|
-
var widgets = Array.from(_this.ref.nativeElement.querySelectorAll('.widget-host')).map(function (c) { return c; });
|
1087
|
-
p.setAttribute(_this.DATA_COL, col.toString());
|
1088
|
-
p.setAttribute(_this.DATA_ROW, row.toString());
|
1089
|
-
var collision = widgets.filter(function (c) { return c !== _this.dragItem; }).some(function (c) { return core$1.AXHtmlUtil.collision(c, _this.dragItem); });
|
1090
|
-
if (collision) {
|
1091
|
-
_this.removePlaceholder();
|
1092
|
-
}
|
1093
|
-
});
|
1094
|
-
};
|
1095
|
-
AXWidgetBoardComponent.prototype.addPlaceholder = function () {
|
1096
|
-
var _this = this;
|
1097
|
-
this.zone.runOutsideAngular(function () {
|
1098
|
-
_this.removePlaceholder();
|
1099
|
-
if (_this.dragItem) {
|
1100
|
-
var p = document.createElement('div');
|
1101
|
-
p.classList.add('widget-blank-placeholder');
|
1102
|
-
p.setAttribute(_this.DATA_COL, _this.dragItem.getAttribute(_this.DATA_COL));
|
1103
|
-
p.setAttribute(_this.DATA_ROW, _this.dragItem.getAttribute(_this.DATA_ROW));
|
1104
|
-
p.setAttribute(_this.DATA_SIZE_X, _this.dragItem.getAttribute(_this.DATA_SIZE_X));
|
1105
|
-
p.setAttribute(_this.DATA_SIZE_Y, _this.dragItem.getAttribute(_this.DATA_SIZE_Y));
|
1106
|
-
_this.container.nativeElement.appendChild(p);
|
1107
|
-
}
|
1108
|
-
});
|
1109
|
-
};
|
1110
|
-
AXWidgetBoardComponent.prototype.removePlaceholder = function () {
|
1111
|
-
var _a;
|
1112
|
-
var p = this.container.nativeElement.querySelector('.widget-blank-placeholder');
|
1113
|
-
(_a = p) === null || _a === void 0 ? void 0 : _a.remove();
|
1114
|
-
};
|
1115
|
-
AXWidgetBoardComponent.prototype.startEdit = function () {
|
1116
|
-
var _this = this;
|
1117
|
-
this._isInEditing = true;
|
1118
|
-
this.calcGridSize();
|
1119
|
-
this.ref.nativeElement.classList.add('grid-background');
|
1120
|
-
var bg = this.ref.nativeElement;
|
1121
|
-
bg.style.setProperty('background-position', (this.rtl ? 'right' : 'left') + " top");
|
1122
|
-
// tslint:disable-next-line: max-line-length
|
1123
|
-
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>')";
|
1124
|
-
bg.style.setProperty('background-image', pattern);
|
1125
|
-
//
|
1126
|
-
var widgets = Array.from(this.ref.nativeElement.querySelectorAll('.widget-host'));
|
1127
|
-
widgets.forEach(function (w) {
|
1128
|
-
w.addEventListener('mousedown', _this.dragStart.bind(_this), false);
|
1129
|
-
});
|
1130
|
-
this.ref.nativeElement.addEventListener('mousemove', this.drag.bind(this), false);
|
1131
|
-
this.ref.nativeElement.addEventListener('mouseup', this.dragEnd.bind(this), false);
|
1132
|
-
};
|
1133
|
-
AXWidgetBoardComponent.prototype.finishEdit = function () {
|
1134
|
-
var _this = this;
|
1135
|
-
this.ref.nativeElement.classList.remove('grid-background');
|
1136
|
-
var bg = this.ref.nativeElement;
|
1137
|
-
bg.style.removeProperty('background-image');
|
1138
|
-
//
|
1139
|
-
this._isInEditing = false;
|
1140
|
-
var widgets = Array.from(this.ref.nativeElement.querySelectorAll('.widget-host'));
|
1141
|
-
widgets.forEach(function (w) {
|
1142
|
-
w.removeEventListener('mousedown', _this.dragStart.bind(_this), false);
|
1143
|
-
});
|
1144
|
-
this.ref.nativeElement.removeEventListener('mousemove', this.drag.bind(this), false);
|
1145
|
-
this.ref.nativeElement.removeEventListener('mouseup', this.dragEnd.bind(this), false);
|
1146
|
-
this.emitConfigChanged();
|
1147
|
-
};
|
1148
|
-
AXWidgetBoardComponent.prototype.addWidget = function (widget) {
|
1149
|
-
var _this = this;
|
1150
|
-
this.zone.runOutsideAngular(function () {
|
1151
|
-
_this.newWidget = {
|
1152
|
-
uniqueName: widget.uniqueName,
|
1153
|
-
component: widget.component,
|
1154
|
-
title: widget.title,
|
1155
|
-
col: 1,
|
1156
|
-
row: 1,
|
1157
|
-
sizeX: widget.sizeX,
|
1158
|
-
sizeY: widget.sizeY,
|
1159
|
-
options: widget.options,
|
1160
|
-
props: widget.props
|
1161
|
-
};
|
1162
|
-
_this.detectFirstEmptySlot(_this.newWidget);
|
1163
|
-
var w = {
|
1164
|
-
uniqueName: _this.newWidget.uniqueName,
|
1165
|
-
component: _this.newWidget.component,
|
1166
|
-
title: _this.newWidget.title,
|
1167
|
-
options: _this.newWidget.options,
|
1168
|
-
props: _this.newWidget.props,
|
1169
|
-
sizeX: _this.newWidget.sizeX,
|
1170
|
-
sizeY: _this.newWidget.sizeY,
|
1171
|
-
col: _this.newWidget.col,
|
1172
|
-
row: _this.newWidget.row
|
1173
|
-
};
|
1174
|
-
_this.widgets.push(w);
|
1175
|
-
_this.newWidget = null;
|
1176
|
-
_this.zone.run(function () {
|
1177
|
-
_this.cdr.detectChanges();
|
1178
|
-
_this.calcGridSize();
|
1179
|
-
_this.emitConfigChanged();
|
1180
|
-
setTimeout(function () {
|
1181
|
-
w['__meta__'].instance.element.addEventListener('mousedown', _this.dragStart.bind(_this), false);
|
1182
|
-
}, 1000);
|
1183
|
-
});
|
1184
|
-
});
|
1185
|
-
};
|
1186
|
-
AXWidgetBoardComponent.prototype.handleOnRemove = function (w) {
|
1187
|
-
var _this = this;
|
1188
|
-
w.element.classList.add('animate__animated', 'animate__zoomOut');
|
1189
|
-
w.element.addEventListener('animationend', function () {
|
1190
|
-
_this.widgets = _this.widgets.filter(function (c) { return c.__meta__.id !== w.config.__meta__.id; });
|
1191
|
-
_this.cdr.detectChanges();
|
1192
|
-
_this.calcGridSize();
|
1193
|
-
_this.emitConfigChanged();
|
1194
|
-
});
|
1195
|
-
};
|
1196
|
-
AXWidgetBoardComponent.prototype.handleOnSave = function (e) {
|
1197
|
-
this.onWidgetSave.emit(e);
|
1198
|
-
};
|
1199
|
-
AXWidgetBoardComponent.prototype.trackByFn = function (index, item) {
|
1200
|
-
var _a, _b;
|
1201
|
-
if (!((_a = item['__meta__']) === null || _a === void 0 ? void 0 : _a.id)) {
|
1202
|
-
item['__meta__'] = {};
|
1203
|
-
item['__meta__'].id = core$1.AXHtmlUtil.getUID();
|
1204
|
-
}
|
1205
|
-
return (_b = item['__meta__']) === null || _b === void 0 ? void 0 : _b.id;
|
1206
|
-
};
|
1207
|
-
AXWidgetBoardComponent.prototype.load = function (widgets) {
|
1208
|
-
var _this = this;
|
1209
|
-
this.clear();
|
1210
|
-
return new Promise(function (resolve, reject) {
|
1211
|
-
if (widgets) {
|
1212
|
-
var loadedWidgets_1 = [];
|
1213
|
-
if (typeof widgets === 'string') {
|
1214
|
-
try {
|
1215
|
-
loadedWidgets_1.push.apply(loadedWidgets_1, __spread(JSON.parse(widgets)));
|
1216
|
-
}
|
1217
|
-
catch (error) {
|
1218
|
-
reject('Invalid widget json data!');
|
1219
|
-
}
|
1220
|
-
}
|
1221
|
-
else {
|
1222
|
-
loadedWidgets_1.push.apply(loadedWidgets_1, __spread(widgets));
|
1223
|
-
}
|
1224
|
-
var intervalId_1 = -1;
|
1225
|
-
var loadFunc = function () {
|
1226
|
-
var _a;
|
1227
|
-
if (_this.galleryItems && _this.galleryItems.length > 0) {
|
1228
|
-
loadedWidgets_1.forEach(function (w) {
|
1229
|
-
var gitem = _this.galleryItems.find(function (c) { return c.uniqueName === w.uniqueName; });
|
1230
|
-
if (gitem) {
|
1231
|
-
w.component = gitem.component;
|
1232
|
-
if (gitem.props) {
|
1233
|
-
w.props = JSON.parse(JSON.stringify(gitem.props));
|
1234
|
-
}
|
1235
|
-
}
|
1236
|
-
});
|
1237
|
-
(_a = _this.widgets).push.apply(_a, __spread(loadedWidgets_1));
|
1238
|
-
window.clearInterval(intervalId_1);
|
1239
|
-
_this.cdr.detectChanges();
|
1240
|
-
resolve();
|
1241
|
-
}
|
1242
|
-
};
|
1243
|
-
intervalId_1 = window.setInterval(loadFunc, 200);
|
1244
|
-
}
|
1245
|
-
else {
|
1246
|
-
resolve();
|
1247
|
-
}
|
1248
|
-
});
|
1249
|
-
};
|
1250
|
-
AXWidgetBoardComponent.prototype.clear = function () {
|
1251
|
-
if (this.widgets.length) {
|
1252
|
-
this.widgets = [];
|
1253
|
-
this.cdr.detectChanges();
|
1254
|
-
this.emitConfigChanged();
|
1255
|
-
}
|
1256
|
-
};
|
1257
|
-
AXWidgetBoardComponent.prototype.save = function () {
|
1258
|
-
var obj = this.widgets.map(function (c) { return ({
|
1259
|
-
uniqueName: c.uniqueName,
|
1260
|
-
component: c.component,
|
1261
|
-
title: c.title,
|
1262
|
-
sizeX: c.sizeX,
|
1263
|
-
sizeY: c.sizeY,
|
1264
|
-
col: c.col,
|
1265
|
-
row: c.row,
|
1266
|
-
options: c.options,
|
1267
|
-
props: c.props
|
1268
|
-
}); });
|
1269
|
-
return Promise.resolve(JSON.stringify(obj));
|
1270
|
-
};
|
1271
|
-
AXWidgetBoardComponent.prototype.refresh = function () {
|
1272
|
-
this.widgetHosts.forEach(function (host) {
|
1273
|
-
host.widget.refresh();
|
1274
|
-
});
|
1275
|
-
};
|
1276
|
-
AXWidgetBoardComponent.prototype.handleOnConfigChanged = function (e) {
|
1277
|
-
this.cdr.detectChanges();
|
1278
|
-
this.emitConfigChanged();
|
1279
|
-
};
|
1280
|
-
AXWidgetBoardComponent.prototype.handleOnResizedChanged = function (e) {
|
1281
|
-
this.detectFirstEmptySlot(e.config);
|
1282
|
-
this.cdr.detectChanges();
|
1283
|
-
this.emitConfigChanged();
|
1284
|
-
};
|
1285
|
-
AXWidgetBoardComponent.prototype.emitConfigChanged = function () {
|
1286
|
-
var _this = this;
|
1287
|
-
if (!this.resizeChangeObserver) {
|
1288
|
-
this.resizeChangeObserver = new rxjs.Observable();
|
1289
|
-
rxjs.Observable.create(function (observer) {
|
1290
|
-
_this.resizeChangeObserver = observer;
|
1291
|
-
})
|
1292
|
-
.pipe(operators.debounceTime(750))
|
1293
|
-
.pipe(operators.distinctUntilChanged())
|
1294
|
-
.subscribe(function (c) {
|
1295
|
-
_this.onConfigChanged.emit({
|
1296
|
-
component: _this
|
1297
|
-
});
|
1298
|
-
});
|
1299
|
-
}
|
1300
|
-
this.resizeChangeObserver.next(new Date());
|
1301
|
-
};
|
1302
|
-
AXWidgetBoardComponent.ctorParameters = function () { return [
|
1303
|
-
{ type: core.ElementRef },
|
1304
|
-
{ type: core.NgZone },
|
1305
|
-
{ type: core.ChangeDetectorRef }
|
1306
|
-
]; };
|
1307
|
-
__decorate([
|
1308
|
-
core.ViewChild('container'),
|
1309
|
-
__metadata("design:type", core.ElementRef)
|
1310
|
-
], AXWidgetBoardComponent.prototype, "container", void 0);
|
1311
|
-
__decorate([
|
1312
|
-
core.ViewChildren(AXWidgetHostComponent),
|
1313
|
-
__metadata("design:type", core.QueryList)
|
1314
|
-
], AXWidgetBoardComponent.prototype, "widgetHosts", void 0);
|
1315
|
-
__decorate([
|
1316
|
-
core.Input(),
|
1317
|
-
__metadata("design:type", Array)
|
1318
|
-
], AXWidgetBoardComponent.prototype, "galleryItems", void 0);
|
1319
|
-
__decorate([
|
1320
|
-
core.Input(),
|
1321
|
-
__metadata("design:type", Number)
|
1322
|
-
], AXWidgetBoardComponent.prototype, "tileSize", void 0);
|
1323
|
-
__decorate([
|
1324
|
-
core.Input(),
|
1325
|
-
__metadata("design:type", Number)
|
1326
|
-
], AXWidgetBoardComponent.prototype, "gapSize", void 0);
|
1327
|
-
__decorate([
|
1328
|
-
core.Input(),
|
1329
|
-
__metadata("design:type", Function)
|
1330
|
-
], AXWidgetBoardComponent.prototype, "provideValue", void 0);
|
1331
|
-
__decorate([
|
1332
|
-
core.Output(),
|
1333
|
-
__metadata("design:type", core.EventEmitter)
|
1334
|
-
], AXWidgetBoardComponent.prototype, "onConfigChanged", void 0);
|
1335
|
-
__decorate([
|
1336
|
-
core.Output(),
|
1337
|
-
__metadata("design:type", core.EventEmitter)
|
1338
|
-
], AXWidgetBoardComponent.prototype, "onWidgetSave", void 0);
|
1339
|
-
AXWidgetBoardComponent = __decorate([
|
1340
|
-
core.Component({
|
1341
|
-
selector: 'ax-widget-board',
|
1342
|
-
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",
|
1343
|
-
host: { class: 'ax widget-board' },
|
1344
|
-
encapsulation: core.ViewEncapsulation.None,
|
1345
|
-
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
1346
|
-
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}"]
|
1347
|
-
}),
|
1348
|
-
__metadata("design:paramtypes", [core.ElementRef,
|
1349
|
-
core.NgZone,
|
1350
|
-
core.ChangeDetectorRef])
|
1351
|
-
], AXWidgetBoardComponent);
|
1352
|
-
return AXWidgetBoardComponent;
|
1353
|
-
}());
|
1354
|
-
|
1355
|
-
var AXWidgetSizePropertyEditorComponent = /** @class */ (function (_super) {
|
1356
|
-
__extends(AXWidgetSizePropertyEditorComponent, _super);
|
1357
|
-
function AXWidgetSizePropertyEditorComponent(cdr) {
|
1358
|
-
var _this = _super.call(this, cdr) || this;
|
1359
|
-
_this.cdr = cdr;
|
1360
|
-
_this.minX = 1;
|
1361
|
-
_this.maxX = 10;
|
1362
|
-
_this.minY = 1;
|
1363
|
-
_this.maxY = 10;
|
1364
|
-
return _this;
|
1365
|
-
}
|
1366
|
-
AXWidgetSizePropertyEditorComponent.prototype.ngOnInit = function () {
|
1367
|
-
if (Array.isArray(this.value)) {
|
1368
|
-
this.sizeX = this.value[0];
|
1369
|
-
this.sizeY = this.value[1];
|
1370
|
-
}
|
1371
|
-
else {
|
1372
|
-
this.sizeX = 2;
|
1373
|
-
this.sizeY = 2;
|
1374
|
-
}
|
1375
|
-
};
|
1376
|
-
AXWidgetSizePropertyEditorComponent.prototype.handleMinValueChange = function (e) {
|
1377
|
-
this.sizeX = e.value;
|
1378
|
-
if (this.sizeY > 0) {
|
1379
|
-
_super.prototype.handleValueChange.call(this, [this.sizeX, this.sizeY]);
|
1380
|
-
}
|
1381
|
-
};
|
1382
|
-
AXWidgetSizePropertyEditorComponent.prototype.handleMaxValueChange = function (e) {
|
1383
|
-
this.sizeY = e.value;
|
1384
|
-
if (this.sizeX > 0) {
|
1385
|
-
_super.prototype.handleValueChange.call(this, [this.sizeX, this.sizeY]);
|
1386
|
-
}
|
1387
|
-
};
|
1388
|
-
AXWidgetSizePropertyEditorComponent.prototype.ngAfterViewInit = function () {
|
1389
|
-
this.onRenderCompleted.emit();
|
1390
|
-
};
|
1391
|
-
AXWidgetSizePropertyEditorComponent.ctorParameters = function () { return [
|
1392
|
-
{ type: core.ChangeDetectorRef }
|
1393
|
-
]; };
|
1394
|
-
AXWidgetSizePropertyEditorComponent = __decorate([
|
1395
|
-
core.Component({
|
1396
|
-
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>"
|
1397
|
-
}),
|
1398
|
-
__metadata("design:paramtypes", [core.ChangeDetectorRef])
|
1399
|
-
], AXWidgetSizePropertyEditorComponent);
|
1400
|
-
return AXWidgetSizePropertyEditorComponent;
|
1401
|
-
}(components.AXProperyEditorComponent));
|
1402
|
-
|
1403
|
-
var AXWidgetBoardModule = /** @class */ (function () {
|
1404
|
-
/**
|
1405
|
-
*
|
1406
|
-
*/
|
1407
|
-
function AXWidgetBoardModule() {
|
1408
|
-
core$1.AXTranslator.load('en', {
|
1409
|
-
'widget-board': {
|
1410
|
-
'configurable-props': 'Configurable Properties',
|
1411
|
-
configure: 'Configure Widget'
|
1412
|
-
}
|
1413
|
-
});
|
1414
|
-
core$1.AXTranslator.load('fa', {
|
1415
|
-
'widget-board': {
|
1416
|
-
'configurable-props': 'ویژگی های قابل تنظیم',
|
1417
|
-
configure: 'پیکر بندی ابزارک'
|
1418
|
-
}
|
1419
|
-
});
|
1420
|
-
}
|
1421
|
-
AXWidgetBoardModule = __decorate([
|
1422
|
-
core.NgModule({
|
1423
|
-
imports: [
|
1424
|
-
common.CommonModule,
|
1425
|
-
components.AXSearchBoxModule,
|
1426
|
-
components.AXLoadingModule,
|
1427
|
-
router.RouterModule,
|
1428
|
-
components.AXProppertyEditorModule,
|
1429
|
-
components.AXPageModule,
|
1430
|
-
components.AXToolbarModule,
|
1431
|
-
core$1.AXTranslatorModule,
|
1432
|
-
components.AXLabelModule,
|
1433
|
-
components.AXTextAreaModule,
|
1434
|
-
components.AXFieldsetModule,
|
1435
|
-
components.AXTextBoxModule,
|
1436
|
-
components.AXFormGroupModule,
|
1437
|
-
components.AXTabStripModule,
|
1438
|
-
components.AXCheckBoxModule,
|
1439
|
-
components.AXMenuModule,
|
1440
|
-
core$1.AXTranslatorModule,
|
1441
|
-
components.AXValidationModule,
|
1442
|
-
router.RouterModule.forChild([
|
1443
|
-
{
|
1444
|
-
component: AXWidgetSizePropertyEditorComponent,
|
1445
|
-
path: 'ax/editors/widget-size'
|
1446
|
-
},
|
1447
|
-
])
|
1448
|
-
],
|
1449
|
-
exports: [AXWidgetBoardComponent, components.AXProppertyEditorModule],
|
1450
|
-
declarations: [AXWidgetBoardComponent, AXWidgetHostComponent, AXWidgetConfigComponent, AXWidgetSaveComponent],
|
1451
|
-
entryComponents: [AXWidgetConfigComponent, AXWidgetSaveComponent],
|
1452
|
-
providers: []
|
1453
|
-
}),
|
1454
|
-
__metadata("design:paramtypes", [])
|
1455
|
-
], AXWidgetBoardModule);
|
1456
|
-
return AXWidgetBoardModule;
|
1457
|
-
}());
|
1458
|
-
|
1459
|
-
var AXWidgetSizePropertyEditorModule = /** @class */ (function () {
|
1460
|
-
function AXWidgetSizePropertyEditorModule() {
|
1461
|
-
}
|
1462
|
-
AXWidgetSizePropertyEditorModule = __decorate([
|
1463
|
-
core.NgModule({
|
1464
|
-
declarations: [AXWidgetSizePropertyEditorComponent],
|
1465
|
-
imports: [common.CommonModule, forms.FormsModule, components.AXNumberBoxModule],
|
1466
|
-
exports: [AXWidgetSizePropertyEditorComponent],
|
1467
|
-
entryComponents: [AXWidgetSizePropertyEditorComponent],
|
1468
|
-
providers: [],
|
1469
|
-
})
|
1470
|
-
], AXWidgetSizePropertyEditorModule);
|
1471
|
-
return AXWidgetSizePropertyEditorModule;
|
1472
|
-
}());
|
1473
|
-
|
1474
|
-
exports.AXWidgetBoardComponent = AXWidgetBoardComponent;
|
1475
|
-
exports.AXWidgetBoardModule = AXWidgetBoardModule;
|
1476
|
-
exports.AXWidgetComponent = AXWidgetComponent;
|
1477
|
-
exports.AXWidgetHostComponent = AXWidgetHostComponent;
|
1478
|
-
exports.AXWidgetSizePropertyEditorComponent = AXWidgetSizePropertyEditorComponent;
|
1479
|
-
exports.AXWidgetSizePropertyEditorModule = AXWidgetSizePropertyEditorModule;
|
1480
|
-
exports.ɵ0 = ɵ0;
|
1481
|
-
exports.ɵa = AXWidgetConfigComponent;
|
1482
|
-
exports.ɵb = AXWidgetSaveComponent;
|
1483
|
-
|
1484
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
1485
|
-
|
1486
|
-
})));
|
1487
|
-
//# sourceMappingURL=acorex-layout.umd.js.map
|