@acorex/layout 4.2.0 → 4.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/acorex-layout.d.ts +5 -0
- 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 +19 -0
- package/lib/widget-board/editors/widget-size-editor/widget-size.module.d.ts +10 -0
- package/lib/widget-board/widget-board.component.d.ts +61 -0
- package/lib/widget-board/widget-board.module.d.ts +18 -0
- package/lib/widget-board/widget-config.component.d.ts +23 -0
- package/lib/widget-board/widget-host.component.d.ts +51 -0
- package/lib/widget-board/widget-save.component.d.ts +19 -0
- package/lib/widget-board/widget.class.d.ts +56 -0
- package/package.json +31 -11
- package/{src/public-api.ts → public-api.d.ts} +0 -0
- package/karma.conf.js +0 -32
- package/ng-package.json +0 -9
- package/src/lib/widget-board/editors/widget-size-editor/widget-size.editor.html +0 -10
- package/src/lib/widget-board/editors/widget-size-editor/widget-size.editor.ts +0 -55
- package/src/lib/widget-board/editors/widget-size-editor/widget-size.module.ts +0 -19
- package/src/lib/widget-board/widget-board.component.html +0 -7
- package/src/lib/widget-board/widget-board.component.scss +0 -198
- package/src/lib/widget-board/widget-board.component.ts +0 -510
- package/src/lib/widget-board/widget-board.module.ts +0 -74
- package/src/lib/widget-board/widget-config.component.html +0 -16
- package/src/lib/widget-board/widget-config.component.ts +0 -99
- package/src/lib/widget-board/widget-host.component.html +0 -30
- package/src/lib/widget-board/widget-host.component.ts +0 -343
- package/src/lib/widget-board/widget-save.component.html +0 -43
- package/src/lib/widget-board/widget-save.component.ts +0 -88
- package/src/lib/widget-board/widget.class.ts +0 -178
- package/src/test.ts +0 -28
- package/tsconfig.lib.json +0 -23
- package/tsconfig.lib.prod.json +0 -6
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -17
@@ -0,0 +1,1166 @@
|
|
1
|
+
import { __decorate, __metadata, __awaiter } from 'tslib';
|
2
|
+
import * as i0 from '@angular/core';
|
3
|
+
import { EventEmitter, Injectable, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, ViewContainerRef, Input, Output, HostBinding, ViewChildren, NgModule } from '@angular/core';
|
4
|
+
import * as i1 from '@acorex/components';
|
5
|
+
import { propertyEditor, AXBasePopupPageComponent, AXValidationFormComponent, AXPropertyDecorators, AXProperyEditorComponent, AXSearchBoxModule, AXLoadingModule, AXProppertyEditorModule, AXPageModule, AXToolbarModule, AXLabelModule, AXTextAreaModule, AXFieldsetModule, AXTextBoxModule, AXFormGroupModule, AXTabStripModule, AXCheckBoxModule, AXMenuModule, AXValidationModule, AXNumberBoxModule } from '@acorex/components';
|
6
|
+
import * as i1$1 from '@acorex/core';
|
7
|
+
import { AXHtmlUtil, AXTranslator, AXObjectUtil, AXClientRec, AXTranslatorModule } from '@acorex/core';
|
8
|
+
import * as i2 from '@angular/common';
|
9
|
+
import { CommonModule } from '@angular/common';
|
10
|
+
import { Observable } from 'rxjs';
|
11
|
+
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
12
|
+
import * as i1$2 from '@angular/router';
|
13
|
+
import { RouterModule } from '@angular/router';
|
14
|
+
import { FormsModule } from '@angular/forms';
|
15
|
+
|
16
|
+
// @dynamic
|
17
|
+
// TODO: Add Angular decorator.
|
18
|
+
class AXWidgetComponent {
|
19
|
+
constructor() {
|
20
|
+
this.uid = AXHtmlUtil.getUID();
|
21
|
+
this.onBusyChanged = new EventEmitter();
|
22
|
+
this._isBusy = true;
|
23
|
+
this.refreshRate = [{
|
24
|
+
id: 60000 * 5,
|
25
|
+
text: AXTranslator.get('dateTime.duration.format_minute').replace('{0}', '5')
|
26
|
+
}];
|
27
|
+
this.onConfiguredChanged = new EventEmitter();
|
28
|
+
this.onConfiguredChanged.subscribe(() => {
|
29
|
+
if (this.isConfigured === true && this.getRefreshRate()) {
|
30
|
+
this.restartRefreshTimer();
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
this.stopRefreshTimer();
|
34
|
+
}
|
35
|
+
});
|
36
|
+
}
|
37
|
+
get isBusy() {
|
38
|
+
return this._isBusy;
|
39
|
+
}
|
40
|
+
set isBusy(v) {
|
41
|
+
if (v !== this._isBusy) {
|
42
|
+
const eventData = {
|
43
|
+
component: this,
|
44
|
+
oldValue: this._isBusy,
|
45
|
+
value: v
|
46
|
+
};
|
47
|
+
this._isBusy = v;
|
48
|
+
this.onBusyChanged.emit(eventData);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
// ???
|
52
|
+
getRefreshRate() {
|
53
|
+
return Array.isArray(this.refreshRate) && this.refreshRate.length ? this.refreshRate[0].id : this.refreshRate;
|
54
|
+
}
|
55
|
+
startRefreshTimer() {
|
56
|
+
this.intervalId = window.setInterval(this.refresh.bind(this), this.getRefreshRate());
|
57
|
+
}
|
58
|
+
stopRefreshTimer() {
|
59
|
+
window.clearInterval(this.intervalId);
|
60
|
+
}
|
61
|
+
restartRefreshTimer() {
|
62
|
+
this.stopRefreshTimer();
|
63
|
+
this.startRefreshTimer();
|
64
|
+
}
|
65
|
+
ngOnDestroy() {
|
66
|
+
this.stopRefreshTimer();
|
67
|
+
}
|
68
|
+
redraw() {
|
69
|
+
}
|
70
|
+
refresh() {
|
71
|
+
this.restartRefreshTimer();
|
72
|
+
}
|
73
|
+
get isConfigured() {
|
74
|
+
return true;
|
75
|
+
}
|
76
|
+
setValue(name, value) {
|
77
|
+
this[name] = value;
|
78
|
+
this.onConfiguredChanged.emit();
|
79
|
+
}
|
80
|
+
getValue(name) {
|
81
|
+
var _a;
|
82
|
+
const val = this[name];
|
83
|
+
const config = this['__meta__'].config;
|
84
|
+
const runtime = (_a = config.props[name]) === null || _a === void 0 ? void 0 : _a.runtime;
|
85
|
+
if (runtime && this.provideValue) {
|
86
|
+
const res = this.provideValue({
|
87
|
+
name,
|
88
|
+
value: val,
|
89
|
+
uniqueName: config.uniqueName,
|
90
|
+
options: config.options,
|
91
|
+
});
|
92
|
+
if (this.provideValue instanceof Promise) {
|
93
|
+
return res;
|
94
|
+
}
|
95
|
+
else {
|
96
|
+
return Promise.resolve(res);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
return Promise.resolve(val);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
AXWidgetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
103
|
+
AXWidgetComponent.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetComponent });
|
104
|
+
__decorate([
|
105
|
+
propertyEditor({
|
106
|
+
editorClass: 'ax/editors/widget-size',
|
107
|
+
title: 'common.size',
|
108
|
+
visible: false,
|
109
|
+
order: -99,
|
110
|
+
}),
|
111
|
+
__metadata("design:type", Array)
|
112
|
+
], AXWidgetComponent.prototype, "widgetSize", void 0);
|
113
|
+
__decorate([
|
114
|
+
propertyEditor({
|
115
|
+
editorClass: 'ax/editors/select',
|
116
|
+
title: 'common.refresh-rate',
|
117
|
+
visible: true,
|
118
|
+
order: -98,
|
119
|
+
editorOptions: {
|
120
|
+
items: () => {
|
121
|
+
return [1, 2, 3, 5, 10, 20, 30, 60].map(c => ({
|
122
|
+
id: 60000 * c,
|
123
|
+
text: AXTranslator.get('dateTime.duration.format_minute').replace('{0}', c.toString())
|
124
|
+
}));
|
125
|
+
},
|
126
|
+
allowNull: false,
|
127
|
+
allowSearch: false,
|
128
|
+
selectionDataMode: 'value',
|
129
|
+
selectionMode: 'single',
|
130
|
+
valueField: 'id',
|
131
|
+
}
|
132
|
+
}),
|
133
|
+
__metadata("design:type", Object)
|
134
|
+
], AXWidgetComponent.prototype, "refreshRate", void 0);
|
135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetComponent, decorators: [{
|
136
|
+
type: Injectable
|
137
|
+
}], ctorParameters: function () { return []; }, propDecorators: { widgetSize: [], refreshRate: [] } });
|
138
|
+
|
139
|
+
class AXWidgetConfigComponent extends AXBasePopupPageComponent {
|
140
|
+
constructor(cdr) {
|
141
|
+
super();
|
142
|
+
this.cdr = cdr;
|
143
|
+
this.props = [];
|
144
|
+
this.displayProps = [];
|
145
|
+
this.changes = [];
|
146
|
+
this.context = {};
|
147
|
+
}
|
148
|
+
getFooterButtons() {
|
149
|
+
return [
|
150
|
+
{
|
151
|
+
name: 'okay',
|
152
|
+
submitBehavior: true,
|
153
|
+
text: AXTranslator.get('common.confirm'),
|
154
|
+
style: 'success'
|
155
|
+
},
|
156
|
+
{
|
157
|
+
name: 'cancel',
|
158
|
+
cancelBehavior: true,
|
159
|
+
text: AXTranslator.get('common.cancel'),
|
160
|
+
style: 'danger blank'
|
161
|
+
}
|
162
|
+
];
|
163
|
+
}
|
164
|
+
onFooterButtonClick(e) {
|
165
|
+
if (e.name === 'cancel') {
|
166
|
+
this.close();
|
167
|
+
}
|
168
|
+
if (e.name === 'okay') {
|
169
|
+
this.form.validate().then(c => {
|
170
|
+
if (c.result) {
|
171
|
+
this.close(this.changes);
|
172
|
+
}
|
173
|
+
});
|
174
|
+
}
|
175
|
+
}
|
176
|
+
handleValueChange(e) {
|
177
|
+
const prop = this.changes.find(c => c.property.name === e.property.name);
|
178
|
+
if (prop) {
|
179
|
+
prop.value = e.value;
|
180
|
+
}
|
181
|
+
else {
|
182
|
+
this.changes.push({ property: e.property, value: e.value });
|
183
|
+
}
|
184
|
+
this.updateContext();
|
185
|
+
}
|
186
|
+
ngOnInit() {
|
187
|
+
this.displayProps = this.props.filter(c => c.property.visible !== false).sort((a, b) => a.property.order - b.property.order);
|
188
|
+
this.updateContext();
|
189
|
+
}
|
190
|
+
updateContext() {
|
191
|
+
const ctx = {};
|
192
|
+
this.props.forEach(p => {
|
193
|
+
ctx[p.property.name] = p.value;
|
194
|
+
});
|
195
|
+
this.changes.forEach(p => {
|
196
|
+
ctx[p.property.name] = p.value;
|
197
|
+
});
|
198
|
+
this.context = ctx;
|
199
|
+
}
|
200
|
+
identify(index, item) {
|
201
|
+
return item.property.name;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
AXWidgetConfigComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetConfigComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
205
|
+
AXWidgetConfigComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: AXWidgetConfigComponent, selector: "ng-component", viewQueries: [{ propertyName: "form", first: true, predicate: AXValidationFormComponent, descendants: true }], usesInheritance: true, ngImport: i0, 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>", components: [{ type: i1.AXPageComponent, selector: "ax-page" }, { type: i1.AXPageContentComponent, selector: "ax-page-content" }, { type: i1.AXValidationFormComponent, selector: "ax-validation-form", inputs: ["validateOn"], outputs: ["onInit"] }, { type: i1.AXLabelComponent, selector: "ax-label", inputs: ["size"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.AXPropertyEditorRendererDirective, selector: "[ax-property-editor-renderer]", inputs: ["property", "validationForm", "context", "host", "groupId"], outputs: ["onValueChange"] }], pipes: { "trans": i1$1.AXTranslatorPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
206
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetConfigComponent, decorators: [{
|
207
|
+
type: Component,
|
208
|
+
args: [{ encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, 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>" }]
|
209
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { form: [{
|
210
|
+
type: ViewChild,
|
211
|
+
args: [AXValidationFormComponent]
|
212
|
+
}] } });
|
213
|
+
|
214
|
+
class AXWidgetSaveComponent extends AXBasePopupPageComponent {
|
215
|
+
constructor() {
|
216
|
+
super(...arguments);
|
217
|
+
this.props = [];
|
218
|
+
}
|
219
|
+
getFooterButtons() {
|
220
|
+
return [
|
221
|
+
{
|
222
|
+
name: 'okay',
|
223
|
+
submitBehavior: true,
|
224
|
+
text: AXTranslator.get('common.confirm'),
|
225
|
+
style: 'ax success'
|
226
|
+
},
|
227
|
+
{
|
228
|
+
name: 'cancel',
|
229
|
+
cancelBehavior: true,
|
230
|
+
text: AXTranslator.get('common.cancel'),
|
231
|
+
style: 'ax light'
|
232
|
+
}
|
233
|
+
];
|
234
|
+
}
|
235
|
+
ngOnInit() {
|
236
|
+
var _a;
|
237
|
+
const titleProp = this.props.find(c => c.property.name === 'title' || c.property.name === 'name');
|
238
|
+
const title = (titleProp === null || titleProp === void 0 ? void 0 : titleProp.value) || this.config.title;
|
239
|
+
const pp = {};
|
240
|
+
(_a = this.props) === null || _a === void 0 ? void 0 : _a.forEach(c => {
|
241
|
+
pp[c.property.name] = c.property;
|
242
|
+
});
|
243
|
+
this.data = {
|
244
|
+
component: this.config.component,
|
245
|
+
title,
|
246
|
+
uniqueName: `${this.config.uniqueName}-${AXHtmlUtil.getUID()}`,
|
247
|
+
options: AXObjectUtil.deepJSONClone(this.config.options),
|
248
|
+
props: AXObjectUtil.deepJSONClone(pp)
|
249
|
+
};
|
250
|
+
this.displayProps = this.props
|
251
|
+
.filter(c => c.property.visible !== false)
|
252
|
+
.sort((a, b) => a.property.order - b.property.order)
|
253
|
+
.map(c => ({
|
254
|
+
name: c.property.name,
|
255
|
+
title: c.property.title,
|
256
|
+
allow: true
|
257
|
+
}));
|
258
|
+
}
|
259
|
+
onFooterButtonClick(e) {
|
260
|
+
if (e.name === 'cancel') {
|
261
|
+
this.close();
|
262
|
+
}
|
263
|
+
if (e.name === 'okay') {
|
264
|
+
this.props.forEach(p => {
|
265
|
+
const pp = this.displayProps.find(c => c.name === p.property.name);
|
266
|
+
if (pp == null || !pp.allow) {
|
267
|
+
let ppp = this.data.props[p.property.name];
|
268
|
+
if (ppp) {
|
269
|
+
ppp.visible = false;
|
270
|
+
}
|
271
|
+
else {
|
272
|
+
ppp = { visible: false };
|
273
|
+
}
|
274
|
+
}
|
275
|
+
});
|
276
|
+
this.close(this.data);
|
277
|
+
}
|
278
|
+
}
|
279
|
+
}
|
280
|
+
AXWidgetSaveComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSaveComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
281
|
+
AXWidgetSaveComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: AXWidgetSaveComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, 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>", components: [{ type: i1.AXPageComponent, selector: "ax-page" }, { type: i1.AXPageContentComponent, selector: "ax-page-content" }, { type: i1.AXFormGroupComponent, selector: "ax-form-group", inputs: ["size"] }, { type: i1.AXLabelComponent, selector: "ax-label", inputs: ["size"] }, { type: i1.AXTextBoxComponent, selector: "ax-text-box", inputs: ["mask", "type", "showMask", "maxLength", "maskGuid", "maskPlaceholder", "maskKeepCharPositions"] }, { type: i1.AXTextAreaComponent, selector: "ax-text-area", inputs: ["rows", "cols", "maxLength"] }, { type: i1.AXFieldsetComponent, selector: "ax-fieldset", inputs: ["size", "caption", "allowCollapse"] }, { type: i1.AXCheckBoxComponent, selector: "ax-check-box", inputs: ["readonly", "disabled", "size", "label", "tabIndex", "indeterminate", "value"], outputs: ["onValueChanged", "valueChange", "onClick"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "trans": i1$1.AXTranslatorPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
282
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSaveComponent, decorators: [{
|
283
|
+
type: Component,
|
284
|
+
args: [{ encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, 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>" }]
|
285
|
+
}] });
|
286
|
+
|
287
|
+
class AXWidgetHostComponent {
|
288
|
+
constructor(ref, componentFactoryResolver, rendererService, cdr, popup, loadingService) {
|
289
|
+
this.ref = ref;
|
290
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
291
|
+
this.rendererService = rendererService;
|
292
|
+
this.cdr = cdr;
|
293
|
+
this.popup = popup;
|
294
|
+
this.loadingService = loadingService;
|
295
|
+
this._hasProps = false;
|
296
|
+
this._hasMenu = false;
|
297
|
+
this.configMenuItem = [
|
298
|
+
{
|
299
|
+
icon: 'far fa-ellipsis-h',
|
300
|
+
items: []
|
301
|
+
}
|
302
|
+
];
|
303
|
+
this.onRemove = new EventEmitter();
|
304
|
+
this.onConfigChanged = new EventEmitter();
|
305
|
+
this.onResized = new EventEmitter();
|
306
|
+
this.onSave = new EventEmitter();
|
307
|
+
this._isLoading = false;
|
308
|
+
this.sizeX = 1;
|
309
|
+
this.sizeY = 1;
|
310
|
+
this.col = 1;
|
311
|
+
this.row = 1;
|
312
|
+
}
|
313
|
+
get widget() {
|
314
|
+
return this._widget;
|
315
|
+
}
|
316
|
+
get element() {
|
317
|
+
return this.ref.nativeElement;
|
318
|
+
}
|
319
|
+
get isLoading() {
|
320
|
+
return this._isLoading;
|
321
|
+
}
|
322
|
+
set isLoading(v) {
|
323
|
+
this._isLoading = v;
|
324
|
+
if (this._loadingId && !v) {
|
325
|
+
this.loadingService.hide(this._loadingId);
|
326
|
+
this._loadingId = null;
|
327
|
+
}
|
328
|
+
if (v) {
|
329
|
+
this._loadingId = this.loadingService.show(this.ref.nativeElement);
|
330
|
+
}
|
331
|
+
}
|
332
|
+
get isConfigured() {
|
333
|
+
var _a;
|
334
|
+
return ((_a = this._widget) === null || _a === void 0 ? void 0 : _a.isConfigured) || false;
|
335
|
+
}
|
336
|
+
ngOnInit() {
|
337
|
+
this.isLoading = true;
|
338
|
+
}
|
339
|
+
ngAfterViewInit() {
|
340
|
+
return __awaiter(this, void 0, void 0, function* () {
|
341
|
+
let component;
|
342
|
+
if (typeof this.config.component === 'string') {
|
343
|
+
const route = yield this.rendererService.findLoadedComponentByRoute(this.config.component, 20);
|
344
|
+
component = route === null || route === void 0 ? void 0 : route.component;
|
345
|
+
}
|
346
|
+
else if (typeof this.config.component === 'function') {
|
347
|
+
component = this.config.component;
|
348
|
+
}
|
349
|
+
if (component == null) {
|
350
|
+
console.error(`Invalid Widget Component!`, this.config);
|
351
|
+
this.onRemove.emit(this);
|
352
|
+
return;
|
353
|
+
}
|
354
|
+
const widgetFactory = this.componentFactoryResolver.resolveComponentFactory(component);
|
355
|
+
this.componentRef = this.vc.createComponent(widgetFactory);
|
356
|
+
this._widget = this.componentRef.instance;
|
357
|
+
this._widget.provideValue = this.provideValue;
|
358
|
+
if (this._widget.onBusyChanged) {
|
359
|
+
this._widget.onBusyChanged.subscribe((d) => {
|
360
|
+
if (!this._widget.widgetSize) {
|
361
|
+
this._widget.setValue('widgetSize', [this.sizeX, this.sizeY]);
|
362
|
+
}
|
363
|
+
else {
|
364
|
+
this.setSizeFromOptions();
|
365
|
+
}
|
366
|
+
this.isLoading = d.value;
|
367
|
+
this.cdr.detectChanges();
|
368
|
+
});
|
369
|
+
}
|
370
|
+
if (this._widget.onConfiguredChanged) {
|
371
|
+
this._widget.onConfiguredChanged.subscribe(() => {
|
372
|
+
this.setSizeFromOptions();
|
373
|
+
});
|
374
|
+
}
|
375
|
+
//
|
376
|
+
if (this.config.options) {
|
377
|
+
Object.assign(this._widget, this.config.options);
|
378
|
+
}
|
379
|
+
this._hasProps = AXPropertyDecorators.getProperties(this._widget).length > 0;
|
380
|
+
this.isLoading = false;
|
381
|
+
this.config['__meta__'].instance = this;
|
382
|
+
this._widget['__meta__'] = {};
|
383
|
+
this._widget['__meta__'].config = this.config;
|
384
|
+
//
|
385
|
+
this.configMenuItem[0].items.push({
|
386
|
+
name: 'refresh',
|
387
|
+
icon: 'far fa-undo',
|
388
|
+
text: AXTranslator.get('common.refresh'),
|
389
|
+
onClick: () => {
|
390
|
+
var _a;
|
391
|
+
(_a = this === null || this === void 0 ? void 0 : this.widget) === null || _a === void 0 ? void 0 : _a.refresh();
|
392
|
+
}
|
393
|
+
});
|
394
|
+
//
|
395
|
+
if (this._hasProps) {
|
396
|
+
this.configMenuItem[0].items.push({
|
397
|
+
name: 'configs',
|
398
|
+
icon: 'far fa-cogs',
|
399
|
+
text: AXTranslator.get('common.configs'),
|
400
|
+
onClick: () => {
|
401
|
+
this.openConfigDialog();
|
402
|
+
}
|
403
|
+
});
|
404
|
+
}
|
405
|
+
this.configMenuItem[0].items.push({
|
406
|
+
name: 'save',
|
407
|
+
icon: 'far fa-save',
|
408
|
+
text: AXTranslator.get('common.save-as'),
|
409
|
+
onClick: () => {
|
410
|
+
this.openSaveDialog();
|
411
|
+
}
|
412
|
+
});
|
413
|
+
if (true) {
|
414
|
+
this.configMenuItem[0].items.push({
|
415
|
+
name: 'remove',
|
416
|
+
icon: 'far fa-times',
|
417
|
+
style: 'ax danger blank',
|
418
|
+
text: AXTranslator.get('common.remove'),
|
419
|
+
onClick: () => {
|
420
|
+
this.onRemove.emit(this);
|
421
|
+
}
|
422
|
+
});
|
423
|
+
}
|
424
|
+
this._hasMenu = this.configMenuItem[0].items.length > 0;
|
425
|
+
this.cdr.detectChanges();
|
426
|
+
});
|
427
|
+
}
|
428
|
+
setSizeFromOptions() {
|
429
|
+
this._widget.getValue('widgetSize').then(c => {
|
430
|
+
const oldSizeX = this.sizeX;
|
431
|
+
const oldSizeY = this.sizeY;
|
432
|
+
if (c && Array.isArray(c) && (oldSizeX !== c[0] || oldSizeY !== c[1])) {
|
433
|
+
this.config.sizeX = this.sizeX = c[0];
|
434
|
+
this.config.sizeY = this.sizeY = c[1];
|
435
|
+
this.onResized.emit({
|
436
|
+
component: this._widget,
|
437
|
+
config: this.config
|
438
|
+
});
|
439
|
+
}
|
440
|
+
this.cdr.detectChanges();
|
441
|
+
});
|
442
|
+
}
|
443
|
+
remove(e) {
|
444
|
+
e.preventDefault();
|
445
|
+
e.stopPropagation();
|
446
|
+
this.onRemove.emit(this);
|
447
|
+
return false;
|
448
|
+
}
|
449
|
+
handleConfig(e) {
|
450
|
+
e.preventDefault();
|
451
|
+
e.stopPropagation();
|
452
|
+
this.openConfigDialog();
|
453
|
+
return false;
|
454
|
+
}
|
455
|
+
openConfigDialog() {
|
456
|
+
const ppp = this.getMergedProps();
|
457
|
+
this.popup.open(AXWidgetConfigComponent, {
|
458
|
+
title: AXTranslator.get('common.configs'),
|
459
|
+
size: 'sm',
|
460
|
+
data: {
|
461
|
+
props: ppp.map(c => ({ property: c.options, value: this._widget[c.options.name] })),
|
462
|
+
widget: this.widget
|
463
|
+
}
|
464
|
+
}).then(c => {
|
465
|
+
if (c.data) {
|
466
|
+
if (!this.config.options) {
|
467
|
+
this.config.options = {};
|
468
|
+
}
|
469
|
+
c.data.forEach(p => {
|
470
|
+
this._widget.setValue(p.property.name, p.value);
|
471
|
+
this.config.options[p.property.name] = p.value;
|
472
|
+
});
|
473
|
+
this.emitConfigChanged();
|
474
|
+
this._widget.redraw();
|
475
|
+
this.cdr.detectChanges();
|
476
|
+
}
|
477
|
+
});
|
478
|
+
}
|
479
|
+
openSaveDialog() {
|
480
|
+
const ppp = this.getMergedProps();
|
481
|
+
this.popup.open(AXWidgetSaveComponent, {
|
482
|
+
title: AXTranslator.get('common.save-as'),
|
483
|
+
size: 'sm',
|
484
|
+
data: {
|
485
|
+
config: this.config,
|
486
|
+
props: ppp.map(c => ({ property: c.options, value: this._widget[c.options.name] }))
|
487
|
+
}
|
488
|
+
}).then(c => {
|
489
|
+
if (c.data) {
|
490
|
+
this.onSave.emit({
|
491
|
+
component: this._widget,
|
492
|
+
data: c.data
|
493
|
+
});
|
494
|
+
}
|
495
|
+
});
|
496
|
+
}
|
497
|
+
handleOptionClick(e) {
|
498
|
+
e.preventDefault();
|
499
|
+
e.stopPropagation();
|
500
|
+
this.openConfigDialog();
|
501
|
+
return false;
|
502
|
+
}
|
503
|
+
ngOnDestroy() {
|
504
|
+
this.vc.clear();
|
505
|
+
if (this.componentRef) {
|
506
|
+
this.componentRef.destroy();
|
507
|
+
}
|
508
|
+
}
|
509
|
+
getMergedProps() {
|
510
|
+
const ppp = AXObjectUtil.deepCopy(AXPropertyDecorators.getProperties(this._widget));
|
511
|
+
for (const key in this.config.props) {
|
512
|
+
if (Object.prototype.hasOwnProperty.call(this.config.props, key)) {
|
513
|
+
const newP = this.config.props[key];
|
514
|
+
const existPropDec = ppp.find(p => p.property === key);
|
515
|
+
if (existPropDec) {
|
516
|
+
Object.assign(existPropDec.options, newP);
|
517
|
+
}
|
518
|
+
}
|
519
|
+
}
|
520
|
+
return ppp;
|
521
|
+
}
|
522
|
+
emitConfigChanged() {
|
523
|
+
this.onConfigChanged.emit({
|
524
|
+
component: this._widget,
|
525
|
+
config: this.config
|
526
|
+
});
|
527
|
+
}
|
528
|
+
}
|
529
|
+
AXWidgetHostComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetHostComponent, deps: [{ token: i0.ElementRef }, { token: i0.ComponentFactoryResolver }, { token: i1$1.AXRenderService }, { token: i0.ChangeDetectorRef }, { token: i1.AXPopupService }, { token: i1.AXLoadingService }], target: i0.ɵɵFactoryTarget.Component });
|
530
|
+
AXWidgetHostComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: AXWidgetHostComponent, selector: "ax-widget-host", inputs: { provideValue: "provideValue", config: "config", sizeX: "sizeX", sizeY: "sizeY", col: "col", row: "row" }, outputs: { onRemove: "onRemove", onConfigChanged: "onConfigChanged", onResized: "onResized", onSave: "onSave" }, host: { attributes: { "tabindex": "0" }, properties: { "attr.data-size-x": "this.sizeX", "attr.data-size-y": "this.sizeY", "attr.data-col": "this.col", "attr.data-row": "this.row" }, classAttribute: "ax widget-host" }, viewQueries: [{ propertyName: "vc", first: true, predicate: ["vc"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div class='widget-container'>\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>", components: [{ type: i1.AXMenuComponent, selector: "ax-menu", inputs: ["menuTemplate", "rtl", "size", "selection", "mode", "target", "floatAlignment", "floatPlacemnet", "direction", "items"], outputs: ["onItemClick"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "trans": i1$1.AXTranslatorPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
531
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetHostComponent, decorators: [{
|
532
|
+
type: Component,
|
533
|
+
args: [{ selector: 'ax-widget-host', host: { class: 'ax widget-host', tabindex: '0' }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, 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>" }]
|
534
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i1$1.AXRenderService }, { type: i0.ChangeDetectorRef }, { type: i1.AXPopupService }, { type: i1.AXLoadingService }]; }, propDecorators: { provideValue: [{
|
535
|
+
type: Input
|
536
|
+
}], onRemove: [{
|
537
|
+
type: Output
|
538
|
+
}], onConfigChanged: [{
|
539
|
+
type: Output
|
540
|
+
}], onResized: [{
|
541
|
+
type: Output
|
542
|
+
}], onSave: [{
|
543
|
+
type: Output
|
544
|
+
}], config: [{
|
545
|
+
type: Input
|
546
|
+
}], vc: [{
|
547
|
+
type: ViewChild,
|
548
|
+
args: ['vc', { read: ViewContainerRef }]
|
549
|
+
}], sizeX: [{
|
550
|
+
type: HostBinding,
|
551
|
+
args: ['attr.data-size-x']
|
552
|
+
}, {
|
553
|
+
type: Input
|
554
|
+
}], sizeY: [{
|
555
|
+
type: HostBinding,
|
556
|
+
args: ['attr.data-size-y']
|
557
|
+
}, {
|
558
|
+
type: Input
|
559
|
+
}], col: [{
|
560
|
+
type: HostBinding,
|
561
|
+
args: ['attr.data-col']
|
562
|
+
}, {
|
563
|
+
type: Input
|
564
|
+
}], row: [{
|
565
|
+
type: HostBinding,
|
566
|
+
args: ['attr.data-row']
|
567
|
+
}, {
|
568
|
+
type: Input
|
569
|
+
}] } });
|
570
|
+
|
571
|
+
class AXWidgetBoardComponent {
|
572
|
+
constructor(ref, zone, cdr) {
|
573
|
+
this.ref = ref;
|
574
|
+
this.zone = zone;
|
575
|
+
this.cdr = cdr;
|
576
|
+
this.widgets = [];
|
577
|
+
this.galleryItems = [];
|
578
|
+
this.tileSize = 80;
|
579
|
+
this.gapSize = 5;
|
580
|
+
this.newWidget = null;
|
581
|
+
this._isInEditing = false;
|
582
|
+
this.isDragging = false;
|
583
|
+
this.DATA_COL = 'data-col';
|
584
|
+
this.DATA_ROW = 'data-row';
|
585
|
+
this.DATA_SIZE_X = 'data-size-x';
|
586
|
+
this.DATA_SIZE_Y = 'data-size-y';
|
587
|
+
this.DATA_OLD_COL = 'data-old-col';
|
588
|
+
this.DATA_OLD_ROW = 'data-old-row';
|
589
|
+
this.onConfigChanged = new EventEmitter();
|
590
|
+
this.onWidgetSave = new EventEmitter();
|
591
|
+
}
|
592
|
+
isInEditing() {
|
593
|
+
return this._isInEditing;
|
594
|
+
}
|
595
|
+
ngOnInit() {
|
596
|
+
if (this.rtl == null) {
|
597
|
+
this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue('direction') === 'rtl';
|
598
|
+
}
|
599
|
+
}
|
600
|
+
ngAfterViewInit() {
|
601
|
+
this.zone.runOutsideAngular((c) => {
|
602
|
+
const style = document.createElement('style');
|
603
|
+
style.type = 'text/css';
|
604
|
+
this.ref.nativeElement.appendChild(style);
|
605
|
+
// add css data classes
|
606
|
+
for (let i = 1; i <= 50; i++) {
|
607
|
+
style.innerHTML += `[${this.DATA_COL}="${i}"] { ${this.rtl ? 'right' : 'left'}: ${(i - 1) * (this.tileSize + this.gapSize)}px; }`;
|
608
|
+
style.innerHTML += `[${this.DATA_ROW}="${i}"] { top: ${(i - 1) * (this.tileSize + this.gapSize)}px; }`;
|
609
|
+
style.innerHTML += `[${this.DATA_SIZE_X}="${i}"] { width: ${(i * this.tileSize) + ((i - 1) * this.gapSize)}px; }`;
|
610
|
+
style.innerHTML += `[${this.DATA_SIZE_Y}="${i}"] { height: ${(i * this.tileSize) + ((i - 1) * this.gapSize)}px; }`;
|
611
|
+
}
|
612
|
+
});
|
613
|
+
}
|
614
|
+
calcGridSize() {
|
615
|
+
this.zone.runOutsideAngular(() => {
|
616
|
+
const width = (Math.max(...this.widgets.map((c) => c.col + c.sizeX - 1))) * (this.tileSize + this.gapSize);
|
617
|
+
const height = (Math.max(...this.widgets.map((c) => c.row + c.sizeY - 1))) * (this.tileSize + this.gapSize);
|
618
|
+
this.container.nativeElement.style.width = width + 'px';
|
619
|
+
this.container.nativeElement.style.height = height + 'px';
|
620
|
+
});
|
621
|
+
}
|
622
|
+
toggleEdit() {
|
623
|
+
this._isInEditing ? this.finishEdit() : this.startEdit();
|
624
|
+
}
|
625
|
+
dragStart(e) {
|
626
|
+
e.preventDefault();
|
627
|
+
e.stopPropagation();
|
628
|
+
this.zone.runOutsideAngular(() => {
|
629
|
+
if (this._isInEditing && e.which === 1) {
|
630
|
+
this.dragItem = e.currentTarget;
|
631
|
+
this.dragItem.setAttribute('data-x-offset', (this.dragItem.offsetLeft - e.clientX).toString());
|
632
|
+
//
|
633
|
+
this.dragItem.setAttribute('data-y-offset', (this.dragItem.offsetTop - e.clientY).toString());
|
634
|
+
this.dragItem.classList.add('widget-dragging');
|
635
|
+
this.dragItem.classList.remove('animate__animated', 'animate__pulse');
|
636
|
+
}
|
637
|
+
});
|
638
|
+
return false;
|
639
|
+
}
|
640
|
+
removePositionData() {
|
641
|
+
this.zone.runOutsideAngular(() => {
|
642
|
+
if (this.dragItem && this._isInEditing && this.dragItem.getAttribute(this.DATA_OLD_COL) == null) {
|
643
|
+
this.dragItem.setAttribute(this.DATA_OLD_COL, this.dragItem.getAttribute(this.DATA_COL));
|
644
|
+
this.dragItem.setAttribute(this.DATA_OLD_ROW, this.dragItem.getAttribute(this.DATA_ROW));
|
645
|
+
this.dragItem.removeAttribute(this.DATA_COL);
|
646
|
+
this.dragItem.removeAttribute(this.DATA_ROW);
|
647
|
+
}
|
648
|
+
});
|
649
|
+
}
|
650
|
+
resetPositionData() {
|
651
|
+
this.zone.runOutsideAngular(() => {
|
652
|
+
if (this.dragItem && this._isInEditing) {
|
653
|
+
this.setPosition(this.dragItem, this.dragItem.getAttribute(this.DATA_OLD_COL), this.dragItem.getAttribute(this.DATA_OLD_ROW));
|
654
|
+
}
|
655
|
+
});
|
656
|
+
}
|
657
|
+
setPosition(element, col, row) {
|
658
|
+
this.zone.runOutsideAngular(() => {
|
659
|
+
element.setAttribute(this.DATA_COL, col);
|
660
|
+
element.setAttribute(this.DATA_ROW, row);
|
661
|
+
element.removeAttribute(this.DATA_OLD_COL);
|
662
|
+
element.removeAttribute(this.DATA_OLD_ROW);
|
663
|
+
element.style.removeProperty('top');
|
664
|
+
element.style.removeProperty('left');
|
665
|
+
const widget = this.widgets.find(c => c['__meta__'].instance.element === element);
|
666
|
+
widget.col = Number(col);
|
667
|
+
widget.row = Number(row);
|
668
|
+
});
|
669
|
+
}
|
670
|
+
drag(e) {
|
671
|
+
e.preventDefault();
|
672
|
+
e.stopPropagation();
|
673
|
+
this.zone.runOutsideAngular(() => {
|
674
|
+
if (this.dragItem && this._isInEditing) {
|
675
|
+
this.isDragging = true;
|
676
|
+
this.addPlaceholder();
|
677
|
+
const xOffset = Number(this.dragItem.getAttribute('data-x-offset'));
|
678
|
+
const yOffset = Number(this.dragItem.getAttribute('data-y-offset'));
|
679
|
+
this.dragItem.style.left = e.clientX + xOffset + 'px';
|
680
|
+
this.dragItem.style.top = e.clientY + yOffset + 'px';
|
681
|
+
//
|
682
|
+
this.detectBestPlacement();
|
683
|
+
this.removePositionData();
|
684
|
+
}
|
685
|
+
});
|
686
|
+
return false;
|
687
|
+
}
|
688
|
+
dragEnd(e) {
|
689
|
+
this.zone.runOutsideAngular(() => {
|
690
|
+
if (this.dragItem && this._isInEditing && this.isDragging) {
|
691
|
+
this.dragItem.classList.remove('widget-dragging');
|
692
|
+
this.dragItem.classList.add('animate__animated', 'animate__pulse');
|
693
|
+
//
|
694
|
+
const p = this.container.nativeElement.querySelector('.widget-blank-placeholder');
|
695
|
+
if (this.newWidget) {
|
696
|
+
const w = {
|
697
|
+
uniqueName: this.newWidget.uniqueName,
|
698
|
+
component: this.newWidget.component,
|
699
|
+
title: this.newWidget.title,
|
700
|
+
options: this.newWidget.options,
|
701
|
+
sizeX: this.newWidget.sizeX,
|
702
|
+
sizeY: this.newWidget.sizeY,
|
703
|
+
col: Number(p.getAttribute(this.DATA_COL)),
|
704
|
+
row: Number(p.getAttribute(this.DATA_ROW))
|
705
|
+
};
|
706
|
+
this.widgets.push(w);
|
707
|
+
this.newWidget = null;
|
708
|
+
this.container.nativeElement.removeChild(this.dragItem);
|
709
|
+
this.zone.run(() => {
|
710
|
+
this.cdr.detectChanges();
|
711
|
+
this.calcGridSize();
|
712
|
+
setTimeout(() => {
|
713
|
+
w['__meta__'].instance.element.addEventListener('mousedown', this.dragStart.bind(this), false);
|
714
|
+
}, 1000);
|
715
|
+
});
|
716
|
+
}
|
717
|
+
else {
|
718
|
+
if (p) {
|
719
|
+
this.setPosition(this.dragItem, p.getAttribute(this.DATA_COL), p.getAttribute(this.DATA_ROW));
|
720
|
+
}
|
721
|
+
else {
|
722
|
+
this.setPosition(this.dragItem, this.dragItem.getAttribute(this.DATA_OLD_COL), this.dragItem.getAttribute(this.DATA_OLD_ROW));
|
723
|
+
}
|
724
|
+
}
|
725
|
+
//
|
726
|
+
this.removePlaceholder();
|
727
|
+
this.dragItem = null;
|
728
|
+
this.calcGridSize();
|
729
|
+
this.emitConfigChanged();
|
730
|
+
}
|
731
|
+
this.isDragging = false;
|
732
|
+
});
|
733
|
+
}
|
734
|
+
detectFirstEmptySlot(w) {
|
735
|
+
const xTile = Math.floor(this.ref.nativeElement.parentElement.offsetWidth / this.tileSize);
|
736
|
+
for (let j = 1; j <= 100; j++) {
|
737
|
+
for (let i = 1; i <= xTile - w.sizeX; i++) {
|
738
|
+
const rec = new AXClientRec({
|
739
|
+
left: i,
|
740
|
+
top: j,
|
741
|
+
width: w.sizeX,
|
742
|
+
height: w.sizeY
|
743
|
+
});
|
744
|
+
const el = this.widgets.filter(c => c !== w).find((c) => rec.intersect({
|
745
|
+
left: c.col,
|
746
|
+
top: c.row,
|
747
|
+
width: c.sizeX,
|
748
|
+
height: c.sizeY
|
749
|
+
}));
|
750
|
+
if (el == null) {
|
751
|
+
w.col = i;
|
752
|
+
w.row = j;
|
753
|
+
return;
|
754
|
+
}
|
755
|
+
}
|
756
|
+
}
|
757
|
+
}
|
758
|
+
detectBestPlacement() {
|
759
|
+
this.zone.runOutsideAngular(() => {
|
760
|
+
const p = this.container.nativeElement.querySelector('.widget-blank-placeholder');
|
761
|
+
let col = Math.ceil(this.dragItem.offsetLeft / this.tileSize);
|
762
|
+
if (this.rtl) {
|
763
|
+
col = Math.ceil((this.container.nativeElement.clientWidth - (this.dragItem.offsetLeft + this.dragItem.clientWidth)) / this.tileSize);
|
764
|
+
}
|
765
|
+
let row = Math.ceil(this.dragItem.offsetTop / this.tileSize);
|
766
|
+
if (col < 1) {
|
767
|
+
col = 1;
|
768
|
+
}
|
769
|
+
if (row < 1) {
|
770
|
+
row = 1;
|
771
|
+
}
|
772
|
+
const widgets = Array.from(this.ref.nativeElement.querySelectorAll('.widget-host')).map((c) => c);
|
773
|
+
p.setAttribute(this.DATA_COL, col.toString());
|
774
|
+
p.setAttribute(this.DATA_ROW, row.toString());
|
775
|
+
const collision = widgets.filter(c => c !== this.dragItem).some(c => AXHtmlUtil.collision(c, this.dragItem));
|
776
|
+
if (collision) {
|
777
|
+
this.removePlaceholder();
|
778
|
+
}
|
779
|
+
});
|
780
|
+
}
|
781
|
+
addPlaceholder() {
|
782
|
+
this.zone.runOutsideAngular(() => {
|
783
|
+
this.removePlaceholder();
|
784
|
+
if (this.dragItem) {
|
785
|
+
const p = document.createElement('div');
|
786
|
+
p.classList.add('widget-blank-placeholder');
|
787
|
+
p.setAttribute(this.DATA_COL, this.dragItem.getAttribute(this.DATA_COL));
|
788
|
+
p.setAttribute(this.DATA_ROW, this.dragItem.getAttribute(this.DATA_ROW));
|
789
|
+
p.setAttribute(this.DATA_SIZE_X, this.dragItem.getAttribute(this.DATA_SIZE_X));
|
790
|
+
p.setAttribute(this.DATA_SIZE_Y, this.dragItem.getAttribute(this.DATA_SIZE_Y));
|
791
|
+
this.container.nativeElement.appendChild(p);
|
792
|
+
}
|
793
|
+
});
|
794
|
+
}
|
795
|
+
removePlaceholder() {
|
796
|
+
const p = this.container.nativeElement.querySelector('.widget-blank-placeholder');
|
797
|
+
p === null || p === void 0 ? void 0 : p.remove();
|
798
|
+
}
|
799
|
+
startEdit() {
|
800
|
+
this._isInEditing = true;
|
801
|
+
this.calcGridSize();
|
802
|
+
this.ref.nativeElement.classList.add('grid-background');
|
803
|
+
const bg = this.ref.nativeElement;
|
804
|
+
bg.style.setProperty('background-position', `${this.rtl ? 'right' : 'left'} top`);
|
805
|
+
// tslint:disable-next-line: max-line-length
|
806
|
+
const pattern = `url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${this.tileSize + this.gapSize}" height="${this.tileSize + this.gapSize}"> <rect style="fill: %23dadada" x="${this.rtl ? this.gapSize : 0}" width="${this.tileSize}" height="${this.tileSize}" y="0"></rect></svg>')`;
|
807
|
+
bg.style.setProperty('background-image', pattern);
|
808
|
+
//
|
809
|
+
const widgets = Array.from(this.ref.nativeElement.querySelectorAll('.widget-host'));
|
810
|
+
widgets.forEach((w) => {
|
811
|
+
w.addEventListener('mousedown', this.dragStart.bind(this), false);
|
812
|
+
});
|
813
|
+
this.ref.nativeElement.addEventListener('mousemove', this.drag.bind(this), false);
|
814
|
+
this.ref.nativeElement.addEventListener('mouseup', this.dragEnd.bind(this), false);
|
815
|
+
}
|
816
|
+
finishEdit() {
|
817
|
+
this.ref.nativeElement.classList.remove('grid-background');
|
818
|
+
const bg = this.ref.nativeElement;
|
819
|
+
bg.style.removeProperty('background-image');
|
820
|
+
//
|
821
|
+
this._isInEditing = false;
|
822
|
+
const widgets = Array.from(this.ref.nativeElement.querySelectorAll('.widget-host'));
|
823
|
+
widgets.forEach((w) => {
|
824
|
+
w.removeEventListener('mousedown', this.dragStart.bind(this), false);
|
825
|
+
});
|
826
|
+
this.ref.nativeElement.removeEventListener('mousemove', this.drag.bind(this), false);
|
827
|
+
this.ref.nativeElement.removeEventListener('mouseup', this.dragEnd.bind(this), false);
|
828
|
+
this.emitConfigChanged();
|
829
|
+
}
|
830
|
+
addWidget(widget) {
|
831
|
+
this.zone.runOutsideAngular(() => {
|
832
|
+
this.newWidget = {
|
833
|
+
uniqueName: widget.uniqueName,
|
834
|
+
component: widget.component,
|
835
|
+
title: widget.title,
|
836
|
+
col: 1,
|
837
|
+
row: 1,
|
838
|
+
sizeX: widget.sizeX,
|
839
|
+
sizeY: widget.sizeY,
|
840
|
+
options: widget.options,
|
841
|
+
props: widget.props
|
842
|
+
};
|
843
|
+
this.detectFirstEmptySlot(this.newWidget);
|
844
|
+
const w = {
|
845
|
+
uniqueName: this.newWidget.uniqueName,
|
846
|
+
component: this.newWidget.component,
|
847
|
+
title: this.newWidget.title,
|
848
|
+
options: this.newWidget.options,
|
849
|
+
props: this.newWidget.props,
|
850
|
+
sizeX: this.newWidget.sizeX,
|
851
|
+
sizeY: this.newWidget.sizeY,
|
852
|
+
col: this.newWidget.col,
|
853
|
+
row: this.newWidget.row
|
854
|
+
};
|
855
|
+
this.widgets.push(w);
|
856
|
+
this.newWidget = null;
|
857
|
+
this.zone.run(() => {
|
858
|
+
this.cdr.detectChanges();
|
859
|
+
this.calcGridSize();
|
860
|
+
this.emitConfigChanged();
|
861
|
+
setTimeout(() => {
|
862
|
+
w['__meta__'].instance.element.addEventListener('mousedown', this.dragStart.bind(this), false);
|
863
|
+
}, 1000);
|
864
|
+
});
|
865
|
+
});
|
866
|
+
}
|
867
|
+
handleOnRemove(w) {
|
868
|
+
w.element.classList.add('animate__animated', 'animate__zoomOut');
|
869
|
+
w.element.addEventListener('animationend', () => {
|
870
|
+
this.widgets = this.widgets.filter((c) => c.__meta__.id !== w.config.__meta__.id);
|
871
|
+
this.cdr.detectChanges();
|
872
|
+
this.calcGridSize();
|
873
|
+
this.emitConfigChanged();
|
874
|
+
});
|
875
|
+
}
|
876
|
+
handleOnSave(e) {
|
877
|
+
this.onWidgetSave.emit(e);
|
878
|
+
}
|
879
|
+
trackByFn(index, item) {
|
880
|
+
var _a, _b;
|
881
|
+
if (!((_a = item['__meta__']) === null || _a === void 0 ? void 0 : _a.id)) {
|
882
|
+
item['__meta__'] = {};
|
883
|
+
item['__meta__'].id = AXHtmlUtil.getUID();
|
884
|
+
}
|
885
|
+
return (_b = item['__meta__']) === null || _b === void 0 ? void 0 : _b.id;
|
886
|
+
}
|
887
|
+
load(widgets) {
|
888
|
+
this.clear();
|
889
|
+
return new Promise((resolve, reject) => {
|
890
|
+
if (widgets) {
|
891
|
+
const loadedWidgets = [];
|
892
|
+
if (typeof widgets === 'string') {
|
893
|
+
try {
|
894
|
+
loadedWidgets.push(...JSON.parse(widgets));
|
895
|
+
}
|
896
|
+
catch (error) {
|
897
|
+
reject('Invalid widget json data!');
|
898
|
+
}
|
899
|
+
}
|
900
|
+
else {
|
901
|
+
loadedWidgets.push(...widgets);
|
902
|
+
}
|
903
|
+
let intervalId = -1;
|
904
|
+
const loadFunc = () => {
|
905
|
+
if (this.galleryItems && this.galleryItems.length > 0) {
|
906
|
+
loadedWidgets.forEach(w => {
|
907
|
+
const gitem = this.galleryItems.find(c => c.uniqueName === w.uniqueName);
|
908
|
+
if (gitem) {
|
909
|
+
w.component = gitem.component;
|
910
|
+
if (gitem.props) {
|
911
|
+
w.props = JSON.parse(JSON.stringify(gitem.props));
|
912
|
+
}
|
913
|
+
}
|
914
|
+
});
|
915
|
+
this.widgets.push(...loadedWidgets);
|
916
|
+
window.clearInterval(intervalId);
|
917
|
+
this.cdr.detectChanges();
|
918
|
+
resolve();
|
919
|
+
}
|
920
|
+
};
|
921
|
+
intervalId = window.setInterval(loadFunc, 200);
|
922
|
+
}
|
923
|
+
else {
|
924
|
+
resolve();
|
925
|
+
}
|
926
|
+
});
|
927
|
+
}
|
928
|
+
clear() {
|
929
|
+
if (this.widgets.length) {
|
930
|
+
this.widgets = [];
|
931
|
+
this.cdr.detectChanges();
|
932
|
+
this.emitConfigChanged();
|
933
|
+
}
|
934
|
+
}
|
935
|
+
save() {
|
936
|
+
const obj = this.widgets.map(c => ({
|
937
|
+
uniqueName: c.uniqueName,
|
938
|
+
component: c.component,
|
939
|
+
title: c.title,
|
940
|
+
sizeX: c.sizeX,
|
941
|
+
sizeY: c.sizeY,
|
942
|
+
col: c.col,
|
943
|
+
row: c.row,
|
944
|
+
options: c.options,
|
945
|
+
props: c.props
|
946
|
+
}));
|
947
|
+
return Promise.resolve(JSON.stringify(obj));
|
948
|
+
}
|
949
|
+
refresh() {
|
950
|
+
this.widgetHosts.forEach(host => {
|
951
|
+
host.widget.refresh();
|
952
|
+
});
|
953
|
+
}
|
954
|
+
handleOnConfigChanged(e) {
|
955
|
+
this.cdr.detectChanges();
|
956
|
+
this.emitConfigChanged();
|
957
|
+
}
|
958
|
+
handleOnResizedChanged(e) {
|
959
|
+
this.detectFirstEmptySlot(e.config);
|
960
|
+
this.cdr.detectChanges();
|
961
|
+
this.emitConfigChanged();
|
962
|
+
}
|
963
|
+
emitConfigChanged() {
|
964
|
+
if (!this.resizeChangeObserver) {
|
965
|
+
this.resizeChangeObserver = new Observable();
|
966
|
+
Observable.create(observer => {
|
967
|
+
this.resizeChangeObserver = observer;
|
968
|
+
})
|
969
|
+
.pipe(debounceTime(750))
|
970
|
+
.pipe(distinctUntilChanged())
|
971
|
+
.subscribe(c => {
|
972
|
+
this.onConfigChanged.emit({
|
973
|
+
component: this
|
974
|
+
});
|
975
|
+
});
|
976
|
+
}
|
977
|
+
this.resizeChangeObserver.next(new Date());
|
978
|
+
}
|
979
|
+
}
|
980
|
+
AXWidgetBoardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
981
|
+
AXWidgetBoardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: AXWidgetBoardComponent, selector: "ax-widget-board", inputs: { galleryItems: "galleryItems", tileSize: "tileSize", gapSize: "gapSize", provideValue: "provideValue" }, outputs: { onConfigChanged: "onConfigChanged", onWidgetSave: "onWidgetSave" }, host: { classAttribute: "ax widget-board" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true }, { propertyName: "widgetHosts", predicate: AXWidgetHostComponent, descendants: true }], ngImport: i0, template: "<div class=\"widgets-container\" [class.rtl]=\"rtl\" #container>\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", styles: [".widget-board{display:inline-block;margin:15px 20px;min-width:calc(100% - 40px);min-height:calc(100% - 34px);--animate-duration: .5s;background-repeat:no-repeat}.widget-board.grid-background{background-repeat:repeat!important}.widget-board.grid-background .widgets-container .widget-host{touch-action:none;-webkit-user-select:none;-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:white;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 ease}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button{display:inline-block;background-color:#f0f0f0;border-radius:1px;border:2px solid #fff;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:0;height:32px;width:32px;cursor:pointer;color:#666}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button:hover{border-color:#a6a6a6;background-color:#c8c8c8}.widget-board .widgets-container .widget-host .widget-options-menu{display:none;position:absolute;top:0;right:0;z-index:2;cursor:pointer;padding:2px 5px}.widget-board .widgets-container .widget-host .widget-options-menu:hover{background-color:#f0f0f0}.widget-board .widgets-container .widget-host .widget-container{padding:1px;height:100%}.widget-board .widgets-container .widget-host .widget-container:hover .widget-options-menu{display:block}\n"], components: [{ type: AXWidgetHostComponent, selector: "ax-widget-host", inputs: ["provideValue", "config", "sizeX", "sizeY", "col", "row"], outputs: ["onRemove", "onConfigChanged", "onResized", "onSave"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
982
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardComponent, decorators: [{
|
983
|
+
type: Component,
|
984
|
+
args: [{ selector: 'ax-widget-board', host: { class: 'ax widget-board' }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, 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", styles: [".widget-board{display:inline-block;margin:15px 20px;min-width:calc(100% - 40px);min-height:calc(100% - 34px);--animate-duration: .5s;background-repeat:no-repeat}.widget-board.grid-background{background-repeat:repeat!important}.widget-board.grid-background .widgets-container .widget-host{touch-action:none;-webkit-user-select:none;-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:white;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 ease}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button{display:inline-block;background-color:#f0f0f0;border-radius:1px;border:2px solid #fff;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:0;height:32px;width:32px;cursor:pointer;color:#666}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button:hover{border-color:#a6a6a6;background-color:#c8c8c8}.widget-board .widgets-container .widget-host .widget-options-menu{display:none;position:absolute;top:0;right:0;z-index:2;cursor:pointer;padding:2px 5px}.widget-board .widgets-container .widget-host .widget-options-menu:hover{background-color:#f0f0f0}.widget-board .widgets-container .widget-host .widget-container{padding:1px;height:100%}.widget-board .widgets-container .widget-host .widget-container:hover .widget-options-menu{display:block}\n"] }]
|
985
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { container: [{
|
986
|
+
type: ViewChild,
|
987
|
+
args: ['container']
|
988
|
+
}], widgetHosts: [{
|
989
|
+
type: ViewChildren,
|
990
|
+
args: [AXWidgetHostComponent]
|
991
|
+
}], galleryItems: [{
|
992
|
+
type: Input
|
993
|
+
}], tileSize: [{
|
994
|
+
type: Input
|
995
|
+
}], gapSize: [{
|
996
|
+
type: Input
|
997
|
+
}], provideValue: [{
|
998
|
+
type: Input
|
999
|
+
}], onConfigChanged: [{
|
1000
|
+
type: Output
|
1001
|
+
}], onWidgetSave: [{
|
1002
|
+
type: Output
|
1003
|
+
}] } });
|
1004
|
+
|
1005
|
+
class AXWidgetSizePropertyEditorComponent extends AXProperyEditorComponent {
|
1006
|
+
constructor(cdr) {
|
1007
|
+
super(cdr);
|
1008
|
+
this.cdr = cdr;
|
1009
|
+
this.minX = 1;
|
1010
|
+
this.maxX = 10;
|
1011
|
+
this.minY = 1;
|
1012
|
+
this.maxY = 10;
|
1013
|
+
}
|
1014
|
+
ngOnInit() {
|
1015
|
+
if (Array.isArray(this.value)) {
|
1016
|
+
this.sizeX = this.value[0];
|
1017
|
+
this.sizeY = this.value[1];
|
1018
|
+
}
|
1019
|
+
else {
|
1020
|
+
this.sizeX = 2;
|
1021
|
+
this.sizeY = 2;
|
1022
|
+
}
|
1023
|
+
}
|
1024
|
+
handleMinValueChange(e) {
|
1025
|
+
this.sizeX = e.value;
|
1026
|
+
if (this.sizeY > 0) {
|
1027
|
+
super.handleValueChange([this.sizeX, this.sizeY]);
|
1028
|
+
}
|
1029
|
+
}
|
1030
|
+
handleMaxValueChange(e) {
|
1031
|
+
this.sizeY = e.value;
|
1032
|
+
if (this.sizeX > 0) {
|
1033
|
+
super.handleValueChange([this.sizeX, this.sizeY]);
|
1034
|
+
}
|
1035
|
+
}
|
1036
|
+
ngAfterViewInit() {
|
1037
|
+
this.onRenderCompleted.emit();
|
1038
|
+
}
|
1039
|
+
}
|
1040
|
+
AXWidgetSizePropertyEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
1041
|
+
AXWidgetSizePropertyEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: AXWidgetSizePropertyEditorComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, 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>", components: [{ type: i1.AXNumberBoxComponent, selector: "ax-number-box", inputs: ["min", "max", "showSeparator", "showCurrency", "showCounter", "scrollWeel", "showDoubleCounter", "maxLength", "intStep", "decimalNumber", "customStep"] }] });
|
1042
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorComponent, decorators: [{
|
1043
|
+
type: Component,
|
1044
|
+
args: [{ 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>" }]
|
1045
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
1046
|
+
|
1047
|
+
class AXWidgetBoardModule {
|
1048
|
+
/**
|
1049
|
+
*
|
1050
|
+
*/
|
1051
|
+
constructor() {
|
1052
|
+
AXTranslator.load('en', {
|
1053
|
+
'widget-board': {
|
1054
|
+
'configurable-props': 'Configurable Properties',
|
1055
|
+
configure: 'Configure Widget'
|
1056
|
+
}
|
1057
|
+
});
|
1058
|
+
AXTranslator.load('fa', {
|
1059
|
+
'widget-board': {
|
1060
|
+
'configurable-props': 'ویژگی های قابل تنظیم',
|
1061
|
+
configure: 'پیکر بندی ابزارک'
|
1062
|
+
}
|
1063
|
+
});
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
AXWidgetBoardModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1067
|
+
AXWidgetBoardModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardModule, declarations: [AXWidgetBoardComponent, AXWidgetHostComponent, AXWidgetConfigComponent, AXWidgetSaveComponent], imports: [CommonModule,
|
1068
|
+
AXSearchBoxModule,
|
1069
|
+
AXLoadingModule,
|
1070
|
+
RouterModule,
|
1071
|
+
AXProppertyEditorModule,
|
1072
|
+
AXPageModule,
|
1073
|
+
AXToolbarModule,
|
1074
|
+
AXTranslatorModule,
|
1075
|
+
AXLabelModule,
|
1076
|
+
AXTextAreaModule,
|
1077
|
+
AXFieldsetModule,
|
1078
|
+
AXTextBoxModule,
|
1079
|
+
AXFormGroupModule,
|
1080
|
+
AXTabStripModule,
|
1081
|
+
AXCheckBoxModule,
|
1082
|
+
AXMenuModule,
|
1083
|
+
AXTranslatorModule,
|
1084
|
+
AXValidationModule, i1$2.RouterModule], exports: [AXWidgetBoardComponent, AXProppertyEditorModule] });
|
1085
|
+
AXWidgetBoardModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardModule, providers: [], imports: [[
|
1086
|
+
CommonModule,
|
1087
|
+
AXSearchBoxModule,
|
1088
|
+
AXLoadingModule,
|
1089
|
+
RouterModule,
|
1090
|
+
AXProppertyEditorModule,
|
1091
|
+
AXPageModule,
|
1092
|
+
AXToolbarModule,
|
1093
|
+
AXTranslatorModule,
|
1094
|
+
AXLabelModule,
|
1095
|
+
AXTextAreaModule,
|
1096
|
+
AXFieldsetModule,
|
1097
|
+
AXTextBoxModule,
|
1098
|
+
AXFormGroupModule,
|
1099
|
+
AXTabStripModule,
|
1100
|
+
AXCheckBoxModule,
|
1101
|
+
AXMenuModule,
|
1102
|
+
AXTranslatorModule,
|
1103
|
+
AXValidationModule,
|
1104
|
+
RouterModule.forChild([
|
1105
|
+
{
|
1106
|
+
component: AXWidgetSizePropertyEditorComponent,
|
1107
|
+
path: 'ax/editors/widget-size'
|
1108
|
+
},
|
1109
|
+
])
|
1110
|
+
], AXProppertyEditorModule] });
|
1111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardModule, decorators: [{
|
1112
|
+
type: NgModule,
|
1113
|
+
args: [{
|
1114
|
+
imports: [
|
1115
|
+
CommonModule,
|
1116
|
+
AXSearchBoxModule,
|
1117
|
+
AXLoadingModule,
|
1118
|
+
RouterModule,
|
1119
|
+
AXProppertyEditorModule,
|
1120
|
+
AXPageModule,
|
1121
|
+
AXToolbarModule,
|
1122
|
+
AXTranslatorModule,
|
1123
|
+
AXLabelModule,
|
1124
|
+
AXTextAreaModule,
|
1125
|
+
AXFieldsetModule,
|
1126
|
+
AXTextBoxModule,
|
1127
|
+
AXFormGroupModule,
|
1128
|
+
AXTabStripModule,
|
1129
|
+
AXCheckBoxModule,
|
1130
|
+
AXMenuModule,
|
1131
|
+
AXTranslatorModule,
|
1132
|
+
AXValidationModule,
|
1133
|
+
RouterModule.forChild([
|
1134
|
+
{
|
1135
|
+
component: AXWidgetSizePropertyEditorComponent,
|
1136
|
+
path: 'ax/editors/widget-size'
|
1137
|
+
},
|
1138
|
+
])
|
1139
|
+
],
|
1140
|
+
exports: [AXWidgetBoardComponent, AXProppertyEditorModule],
|
1141
|
+
declarations: [AXWidgetBoardComponent, AXWidgetHostComponent, AXWidgetConfigComponent, AXWidgetSaveComponent],
|
1142
|
+
providers: []
|
1143
|
+
}]
|
1144
|
+
}], ctorParameters: function () { return []; } });
|
1145
|
+
|
1146
|
+
class AXWidgetSizePropertyEditorModule {
|
1147
|
+
}
|
1148
|
+
AXWidgetSizePropertyEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1149
|
+
AXWidgetSizePropertyEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorModule, declarations: [AXWidgetSizePropertyEditorComponent], imports: [CommonModule, FormsModule, AXNumberBoxModule], exports: [AXWidgetSizePropertyEditorComponent] });
|
1150
|
+
AXWidgetSizePropertyEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorModule, providers: [], imports: [[CommonModule, FormsModule, AXNumberBoxModule]] });
|
1151
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorModule, decorators: [{
|
1152
|
+
type: NgModule,
|
1153
|
+
args: [{
|
1154
|
+
declarations: [AXWidgetSizePropertyEditorComponent],
|
1155
|
+
imports: [CommonModule, FormsModule, AXNumberBoxModule],
|
1156
|
+
exports: [AXWidgetSizePropertyEditorComponent],
|
1157
|
+
providers: []
|
1158
|
+
}]
|
1159
|
+
}] });
|
1160
|
+
|
1161
|
+
/**
|
1162
|
+
* Generated bundle index. Do not edit.
|
1163
|
+
*/
|
1164
|
+
|
1165
|
+
export { AXWidgetBoardComponent, AXWidgetBoardModule, AXWidgetComponent, AXWidgetHostComponent, AXWidgetSizePropertyEditorComponent, AXWidgetSizePropertyEditorModule };
|
1166
|
+
//# sourceMappingURL=acorex-layout.mjs.map
|