@acorex/layout 5.1.6 → 5.1.8
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 +444 -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 +295 -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 +1174 -0
- package/fesm2015/acorex-layout.mjs.map +1 -0
- package/fesm2020/acorex-layout.mjs +1167 -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 +62 -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 +52 -0
- package/lib/widget-board/widget-save.component.d.ts +19 -0
- package/lib/widget-board/widget.class.d.ts +57 -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 -6
- 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 -514
- 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 -350
- 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 -179
- 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,1167 @@
|
|
1
|
+
import { __decorate, __metadata } 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
|
+
const val = this[name];
|
82
|
+
const config = this['__meta__'].config;
|
83
|
+
const runtime = config.props[name]?.runtime;
|
84
|
+
if (runtime && this.provideValue) {
|
85
|
+
const res = this.provideValue({
|
86
|
+
name,
|
87
|
+
value: val,
|
88
|
+
uniqueName: config.uniqueName,
|
89
|
+
options: config.options,
|
90
|
+
});
|
91
|
+
if (this.provideValue instanceof Promise) {
|
92
|
+
return res;
|
93
|
+
}
|
94
|
+
else {
|
95
|
+
return Promise.resolve(res);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
return Promise.resolve(val);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
AXWidgetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
102
|
+
AXWidgetComponent.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetComponent });
|
103
|
+
__decorate([
|
104
|
+
propertyEditor({
|
105
|
+
editorClass: 'ax/editors/widget-size',
|
106
|
+
title: 'common.size',
|
107
|
+
visible: false,
|
108
|
+
order: -99,
|
109
|
+
}),
|
110
|
+
__metadata("design:type", Array)
|
111
|
+
], AXWidgetComponent.prototype, "widgetSize", void 0);
|
112
|
+
__decorate([
|
113
|
+
propertyEditor({
|
114
|
+
editorClass: 'ax/editors/select',
|
115
|
+
title: 'common.refresh-rate',
|
116
|
+
visible: true,
|
117
|
+
order: -98,
|
118
|
+
editorOptions: {
|
119
|
+
items: () => {
|
120
|
+
return [1, 2, 3, 5, 10, 20, 30, 60].map(c => ({
|
121
|
+
id: 60000 * c,
|
122
|
+
text: AXTranslator.get('dateTime.duration.format_minute').replace('{0}', c.toString())
|
123
|
+
}));
|
124
|
+
},
|
125
|
+
allowNull: false,
|
126
|
+
allowSearch: false,
|
127
|
+
selectionDataMode: 'value',
|
128
|
+
selectionMode: 'single',
|
129
|
+
valueField: 'id',
|
130
|
+
}
|
131
|
+
}),
|
132
|
+
__metadata("design:type", Object)
|
133
|
+
], AXWidgetComponent.prototype, "refreshRate", void 0);
|
134
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetComponent, decorators: [{
|
135
|
+
type: Injectable
|
136
|
+
}], ctorParameters: function () { return []; }, propDecorators: { widgetSize: [], refreshRate: [] } });
|
137
|
+
|
138
|
+
class AXWidgetConfigComponent extends AXBasePopupPageComponent {
|
139
|
+
constructor(cdr) {
|
140
|
+
super();
|
141
|
+
this.cdr = cdr;
|
142
|
+
this.props = [];
|
143
|
+
this.displayProps = [];
|
144
|
+
this.changes = [];
|
145
|
+
this.context = {};
|
146
|
+
}
|
147
|
+
getFooterButtons() {
|
148
|
+
return [
|
149
|
+
{
|
150
|
+
name: 'okay',
|
151
|
+
submitBehavior: true,
|
152
|
+
text: AXTranslator.get('common.confirm'),
|
153
|
+
style: 'success'
|
154
|
+
},
|
155
|
+
{
|
156
|
+
name: 'cancel',
|
157
|
+
cancelBehavior: true,
|
158
|
+
text: AXTranslator.get('common.cancel'),
|
159
|
+
style: 'danger blank'
|
160
|
+
}
|
161
|
+
];
|
162
|
+
}
|
163
|
+
onFooterButtonClick(e) {
|
164
|
+
if (e.name === 'cancel') {
|
165
|
+
this.close();
|
166
|
+
}
|
167
|
+
if (e.name === 'okay') {
|
168
|
+
this.form.validate().then(c => {
|
169
|
+
if (c.result) {
|
170
|
+
this.close(this.changes);
|
171
|
+
}
|
172
|
+
});
|
173
|
+
}
|
174
|
+
}
|
175
|
+
handleValueChange(e) {
|
176
|
+
const prop = this.changes.find(c => c.property.name === e.property.name);
|
177
|
+
if (prop) {
|
178
|
+
prop.value = e.value;
|
179
|
+
}
|
180
|
+
else {
|
181
|
+
this.changes.push({ property: e.property, value: e.value });
|
182
|
+
}
|
183
|
+
this.updateContext();
|
184
|
+
}
|
185
|
+
ngOnInit() {
|
186
|
+
this.displayProps = this.props.filter(c => c.property.visible !== false).sort((a, b) => a.property.order - b.property.order);
|
187
|
+
this.updateContext();
|
188
|
+
}
|
189
|
+
updateContext() {
|
190
|
+
const ctx = {};
|
191
|
+
this.props.forEach(p => {
|
192
|
+
ctx[p.property.name] = p.value;
|
193
|
+
});
|
194
|
+
this.changes.forEach(p => {
|
195
|
+
ctx[p.property.name] = p.value;
|
196
|
+
});
|
197
|
+
this.context = ctx;
|
198
|
+
}
|
199
|
+
identify(index, item) {
|
200
|
+
return item.property.name;
|
201
|
+
}
|
202
|
+
}
|
203
|
+
AXWidgetConfigComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetConfigComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
204
|
+
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 });
|
205
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetConfigComponent, decorators: [{
|
206
|
+
type: Component,
|
207
|
+
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>" }]
|
208
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { form: [{
|
209
|
+
type: ViewChild,
|
210
|
+
args: [AXValidationFormComponent]
|
211
|
+
}] } });
|
212
|
+
|
213
|
+
class AXWidgetSaveComponent extends AXBasePopupPageComponent {
|
214
|
+
constructor() {
|
215
|
+
super(...arguments);
|
216
|
+
this.props = [];
|
217
|
+
}
|
218
|
+
getFooterButtons() {
|
219
|
+
return [
|
220
|
+
{
|
221
|
+
name: 'okay',
|
222
|
+
submitBehavior: true,
|
223
|
+
text: AXTranslator.get('common.confirm'),
|
224
|
+
style: 'ax success'
|
225
|
+
},
|
226
|
+
{
|
227
|
+
name: 'cancel',
|
228
|
+
cancelBehavior: true,
|
229
|
+
text: AXTranslator.get('common.cancel'),
|
230
|
+
style: 'ax light'
|
231
|
+
}
|
232
|
+
];
|
233
|
+
}
|
234
|
+
ngOnInit() {
|
235
|
+
const titleProp = this.props.find(c => c.property.name === 'title' || c.property.name === 'name');
|
236
|
+
const title = titleProp?.value || this.config.title;
|
237
|
+
const pp = {};
|
238
|
+
this.props?.forEach(c => {
|
239
|
+
pp[c.property.name] = c.property;
|
240
|
+
});
|
241
|
+
this.data = {
|
242
|
+
component: this.config.component,
|
243
|
+
title,
|
244
|
+
uniqueName: `${this.config.uniqueName}-${AXHtmlUtil.getUID()}`,
|
245
|
+
options: AXObjectUtil.deepJSONClone(this.config.options),
|
246
|
+
props: AXObjectUtil.deepJSONClone(pp)
|
247
|
+
};
|
248
|
+
this.displayProps = this.props
|
249
|
+
.filter(c => c.property.visible !== false)
|
250
|
+
.sort((a, b) => a.property.order - b.property.order)
|
251
|
+
.map(c => ({
|
252
|
+
name: c.property.name,
|
253
|
+
title: c.property.title,
|
254
|
+
allow: true
|
255
|
+
}));
|
256
|
+
}
|
257
|
+
onFooterButtonClick(e) {
|
258
|
+
if (e.name === 'cancel') {
|
259
|
+
this.close();
|
260
|
+
}
|
261
|
+
if (e.name === 'okay') {
|
262
|
+
this.props.forEach(p => {
|
263
|
+
const pp = this.displayProps.find(c => c.name === p.property.name);
|
264
|
+
if (pp == null || !pp.allow) {
|
265
|
+
let ppp = this.data.props[p.property.name];
|
266
|
+
if (ppp) {
|
267
|
+
ppp.visible = false;
|
268
|
+
}
|
269
|
+
else {
|
270
|
+
ppp = { visible: false };
|
271
|
+
}
|
272
|
+
}
|
273
|
+
});
|
274
|
+
this.close(this.data);
|
275
|
+
}
|
276
|
+
}
|
277
|
+
}
|
278
|
+
AXWidgetSaveComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSaveComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
279
|
+
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 });
|
280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSaveComponent, decorators: [{
|
281
|
+
type: Component,
|
282
|
+
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>" }]
|
283
|
+
}] });
|
284
|
+
|
285
|
+
class AXWidgetHostComponent {
|
286
|
+
constructor(ref, componentFactoryResolver, rendererService, cdr, popup, loadingService) {
|
287
|
+
this.ref = ref;
|
288
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
289
|
+
this.rendererService = rendererService;
|
290
|
+
this.cdr = cdr;
|
291
|
+
this.popup = popup;
|
292
|
+
this.loadingService = loadingService;
|
293
|
+
this._hasProps = false;
|
294
|
+
this._hasMenu = false;
|
295
|
+
this.configMenuItem = [
|
296
|
+
{
|
297
|
+
icon: 'far fa-ellipsis-h',
|
298
|
+
items: []
|
299
|
+
}
|
300
|
+
];
|
301
|
+
this.onRemove = new EventEmitter();
|
302
|
+
this.onConfigChanged = new EventEmitter();
|
303
|
+
this.onResized = new EventEmitter();
|
304
|
+
this.onSave = new EventEmitter();
|
305
|
+
this.readonly = false;
|
306
|
+
this._isLoading = false;
|
307
|
+
this.sizeX = 1;
|
308
|
+
this.sizeY = 1;
|
309
|
+
this.col = 1;
|
310
|
+
this.row = 1;
|
311
|
+
}
|
312
|
+
get widget() {
|
313
|
+
return this._widget;
|
314
|
+
}
|
315
|
+
get element() {
|
316
|
+
return this.ref.nativeElement;
|
317
|
+
}
|
318
|
+
get isLoading() {
|
319
|
+
return this._isLoading;
|
320
|
+
}
|
321
|
+
set isLoading(v) {
|
322
|
+
this._isLoading = v;
|
323
|
+
if (this._loadingId && !v) {
|
324
|
+
this.loadingService.hide(this._loadingId);
|
325
|
+
this._loadingId = null;
|
326
|
+
}
|
327
|
+
if (v) {
|
328
|
+
this._loadingId = this.loadingService.show(this.ref.nativeElement);
|
329
|
+
}
|
330
|
+
}
|
331
|
+
get isConfigured() {
|
332
|
+
return this._widget?.isConfigured || false;
|
333
|
+
}
|
334
|
+
ngOnInit() {
|
335
|
+
this.isLoading = true;
|
336
|
+
}
|
337
|
+
async ngAfterViewInit() {
|
338
|
+
let component;
|
339
|
+
if (typeof this.config.component === 'string') {
|
340
|
+
const route = await this.rendererService.findLoadedComponentByRoute(this.config.component, 20);
|
341
|
+
component = route?.component;
|
342
|
+
}
|
343
|
+
else if (typeof this.config.component === 'function') {
|
344
|
+
component = this.config.component;
|
345
|
+
}
|
346
|
+
if (component == null) {
|
347
|
+
console.error(`Invalid Widget Component!`, this.config);
|
348
|
+
this.onRemove.emit(this);
|
349
|
+
return;
|
350
|
+
}
|
351
|
+
const widgetFactory = this.componentFactoryResolver.resolveComponentFactory(component);
|
352
|
+
this.componentRef = this.vc.createComponent(widgetFactory);
|
353
|
+
this._widget = this.componentRef.instance;
|
354
|
+
this._widget.provideValue = this.provideValue;
|
355
|
+
if (this._widget.onBusyChanged) {
|
356
|
+
this._widget.onBusyChanged.subscribe((d) => {
|
357
|
+
if (!this._widget.widgetSize) {
|
358
|
+
this._widget.setValue('widgetSize', [this.sizeX, this.sizeY]);
|
359
|
+
}
|
360
|
+
else {
|
361
|
+
this.setSizeFromOptions();
|
362
|
+
}
|
363
|
+
this.isLoading = d.value;
|
364
|
+
this.cdr.detectChanges();
|
365
|
+
});
|
366
|
+
}
|
367
|
+
if (this._widget.onConfiguredChanged) {
|
368
|
+
this._widget.onConfiguredChanged.subscribe(() => {
|
369
|
+
this.setSizeFromOptions();
|
370
|
+
});
|
371
|
+
}
|
372
|
+
//
|
373
|
+
if (this.config.options) {
|
374
|
+
Object.assign(this._widget, this.config.options);
|
375
|
+
}
|
376
|
+
this._hasProps = AXPropertyDecorators.getProperties(this._widget).length > 0;
|
377
|
+
this.isLoading = false;
|
378
|
+
this.config['__meta__'].instance = this;
|
379
|
+
this._widget['__meta__'] = {};
|
380
|
+
this._widget['__meta__'].config = this.config;
|
381
|
+
//
|
382
|
+
this.configMenuItem[0].items.push({
|
383
|
+
name: 'refresh',
|
384
|
+
icon: 'far fa-undo',
|
385
|
+
text: AXTranslator.get('common.refresh'),
|
386
|
+
onClick: () => {
|
387
|
+
this?.widget?.refresh();
|
388
|
+
}
|
389
|
+
});
|
390
|
+
//
|
391
|
+
if (this._hasProps) {
|
392
|
+
this.configMenuItem[0].items.push({
|
393
|
+
name: 'configs',
|
394
|
+
icon: 'far fa-cogs',
|
395
|
+
text: AXTranslator.get('common.configs'),
|
396
|
+
onClick: () => {
|
397
|
+
this.openConfigDialog();
|
398
|
+
}
|
399
|
+
});
|
400
|
+
}
|
401
|
+
this.configMenuItem[0].items.push({
|
402
|
+
name: 'save',
|
403
|
+
icon: 'far fa-save',
|
404
|
+
text: AXTranslator.get('common.save-as'),
|
405
|
+
onClick: () => {
|
406
|
+
this.openSaveDialog();
|
407
|
+
}
|
408
|
+
});
|
409
|
+
if (true) {
|
410
|
+
this.configMenuItem[0].items.push({
|
411
|
+
name: 'remove',
|
412
|
+
icon: 'far fa-times',
|
413
|
+
style: 'ax danger blank',
|
414
|
+
text: AXTranslator.get('common.remove'),
|
415
|
+
onClick: () => {
|
416
|
+
this.onRemove.emit(this);
|
417
|
+
}
|
418
|
+
});
|
419
|
+
}
|
420
|
+
this._hasMenu = this.configMenuItem[0].items.length > 0;
|
421
|
+
this.cdr.detectChanges();
|
422
|
+
}
|
423
|
+
setSizeFromOptions() {
|
424
|
+
this._widget.getValue('widgetSize').then(c => {
|
425
|
+
const oldSizeX = this.sizeX;
|
426
|
+
const oldSizeY = this.sizeY;
|
427
|
+
if (c && Array.isArray(c) && (oldSizeX !== c[0] || oldSizeY !== c[1])) {
|
428
|
+
this.config.sizeX = this.sizeX = c[0];
|
429
|
+
this.config.sizeY = this.sizeY = c[1];
|
430
|
+
this.onResized.emit({
|
431
|
+
component: this._widget,
|
432
|
+
config: this.config
|
433
|
+
});
|
434
|
+
}
|
435
|
+
this.cdr.detectChanges();
|
436
|
+
});
|
437
|
+
}
|
438
|
+
remove(e) {
|
439
|
+
e.preventDefault();
|
440
|
+
e.stopPropagation();
|
441
|
+
if (!this.readonly)
|
442
|
+
this.onRemove.emit(this);
|
443
|
+
return false;
|
444
|
+
}
|
445
|
+
handleConfig(e) {
|
446
|
+
e.preventDefault();
|
447
|
+
e.stopPropagation();
|
448
|
+
if (!this.readonly)
|
449
|
+
this.openConfigDialog();
|
450
|
+
return false;
|
451
|
+
}
|
452
|
+
openConfigDialog() {
|
453
|
+
const ppp = this.getMergedProps();
|
454
|
+
this.popup.open(AXWidgetConfigComponent, {
|
455
|
+
title: AXTranslator.get('common.configs'),
|
456
|
+
size: 'sm',
|
457
|
+
data: {
|
458
|
+
props: ppp.map(c => ({ property: c.options, value: this._widget[c.options.name] })),
|
459
|
+
widget: this.widget
|
460
|
+
}
|
461
|
+
}).then(c => {
|
462
|
+
if (c.data) {
|
463
|
+
if (!this.config.options) {
|
464
|
+
this.config.options = {};
|
465
|
+
}
|
466
|
+
c.data.forEach(p => {
|
467
|
+
this._widget.setValue(p.property.name, p.value);
|
468
|
+
this.config.options[p.property.name] = p.value;
|
469
|
+
});
|
470
|
+
this.emitConfigChanged();
|
471
|
+
this._widget.redraw();
|
472
|
+
this.cdr.detectChanges();
|
473
|
+
}
|
474
|
+
});
|
475
|
+
}
|
476
|
+
openSaveDialog() {
|
477
|
+
const ppp = this.getMergedProps();
|
478
|
+
this.popup.open(AXWidgetSaveComponent, {
|
479
|
+
title: AXTranslator.get('common.save-as'),
|
480
|
+
size: 'sm',
|
481
|
+
data: {
|
482
|
+
config: this.config,
|
483
|
+
props: ppp.map(c => ({ property: c.options, value: this._widget[c.options.name] }))
|
484
|
+
}
|
485
|
+
}).then(c => {
|
486
|
+
if (c.data) {
|
487
|
+
this.onSave.emit({
|
488
|
+
component: this._widget,
|
489
|
+
data: c.data
|
490
|
+
});
|
491
|
+
}
|
492
|
+
});
|
493
|
+
}
|
494
|
+
handleOptionClick(e) {
|
495
|
+
e.preventDefault();
|
496
|
+
e.stopPropagation();
|
497
|
+
this.openConfigDialog();
|
498
|
+
return false;
|
499
|
+
}
|
500
|
+
ngOnDestroy() {
|
501
|
+
this.vc.clear();
|
502
|
+
if (this.componentRef) {
|
503
|
+
this.componentRef.destroy();
|
504
|
+
}
|
505
|
+
}
|
506
|
+
getMergedProps() {
|
507
|
+
const ppp = AXObjectUtil.deepCopy(AXPropertyDecorators.getProperties(this._widget));
|
508
|
+
for (const key in this.config.props) {
|
509
|
+
if (Object.prototype.hasOwnProperty.call(this.config.props, key)) {
|
510
|
+
const newP = this.config.props[key];
|
511
|
+
const existPropDec = ppp.find(p => p.property === key);
|
512
|
+
if (existPropDec) {
|
513
|
+
Object.assign(existPropDec.options, newP);
|
514
|
+
}
|
515
|
+
}
|
516
|
+
}
|
517
|
+
return ppp;
|
518
|
+
}
|
519
|
+
emitConfigChanged() {
|
520
|
+
this.onConfigChanged.emit({
|
521
|
+
component: this._widget,
|
522
|
+
config: this.config
|
523
|
+
});
|
524
|
+
}
|
525
|
+
}
|
526
|
+
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 });
|
527
|
+
AXWidgetHostComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: AXWidgetHostComponent, selector: "ax-widget-host", inputs: { provideValue: "provideValue", config: "config", readonly: "readonly", sizeX: "sizeX", sizeY: "sizeY", col: "col", row: "row" }, outputs: { onRemove: "onRemove", onConfigChanged: "onConfigChanged", onResized: "onResized", onSave: "onSave" }, host: { attributes: { "tabindex": "0" }, properties: { "attr.data-size-x": "this.sizeX", "attr.data-size-y": "this.sizeY", "attr.data-col": "this.col", "attr.data-row": "this.row" }, classAttribute: "ax widget-host" }, viewQueries: [{ propertyName: "vc", first: true, predicate: ["vc"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div class='widget-container'>\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\" *ngIf=\"!readonly\"><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 && !readonly\">\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 });
|
528
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetHostComponent, decorators: [{
|
529
|
+
type: Component,
|
530
|
+
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\" *ngIf=\"!readonly\"><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 && !readonly\">\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>" }]
|
531
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i1$1.AXRenderService }, { type: i0.ChangeDetectorRef }, { type: i1.AXPopupService }, { type: i1.AXLoadingService }]; }, propDecorators: { provideValue: [{
|
532
|
+
type: Input
|
533
|
+
}], onRemove: [{
|
534
|
+
type: Output
|
535
|
+
}], onConfigChanged: [{
|
536
|
+
type: Output
|
537
|
+
}], onResized: [{
|
538
|
+
type: Output
|
539
|
+
}], onSave: [{
|
540
|
+
type: Output
|
541
|
+
}], config: [{
|
542
|
+
type: Input
|
543
|
+
}], vc: [{
|
544
|
+
type: ViewChild,
|
545
|
+
args: ['vc', { read: ViewContainerRef }]
|
546
|
+
}], readonly: [{
|
547
|
+
type: Input
|
548
|
+
}], sizeX: [{
|
549
|
+
type: HostBinding,
|
550
|
+
args: ['attr.data-size-x']
|
551
|
+
}, {
|
552
|
+
type: Input
|
553
|
+
}], sizeY: [{
|
554
|
+
type: HostBinding,
|
555
|
+
args: ['attr.data-size-y']
|
556
|
+
}, {
|
557
|
+
type: Input
|
558
|
+
}], col: [{
|
559
|
+
type: HostBinding,
|
560
|
+
args: ['attr.data-col']
|
561
|
+
}, {
|
562
|
+
type: Input
|
563
|
+
}], row: [{
|
564
|
+
type: HostBinding,
|
565
|
+
args: ['attr.data-row']
|
566
|
+
}, {
|
567
|
+
type: Input
|
568
|
+
}] } });
|
569
|
+
|
570
|
+
class AXWidgetBoardComponent {
|
571
|
+
constructor(ref, zone, cdr) {
|
572
|
+
this.ref = ref;
|
573
|
+
this.zone = zone;
|
574
|
+
this.cdr = cdr;
|
575
|
+
this.widgets = [];
|
576
|
+
this.galleryItems = [];
|
577
|
+
this.tileSize = 80;
|
578
|
+
this.gapSize = 5;
|
579
|
+
this.readonly = false;
|
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?.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
|
+
if (!item['__meta__']?.id) {
|
881
|
+
item['__meta__'] = {};
|
882
|
+
item['__meta__'].id = AXHtmlUtil.getUID();
|
883
|
+
}
|
884
|
+
return item['__meta__']?.id;
|
885
|
+
}
|
886
|
+
load(widgets) {
|
887
|
+
this.clear();
|
888
|
+
return new Promise((resolve, reject) => {
|
889
|
+
if (widgets) {
|
890
|
+
const loadedWidgets = [];
|
891
|
+
if (typeof widgets === 'string') {
|
892
|
+
try {
|
893
|
+
loadedWidgets.push(...JSON.parse(widgets));
|
894
|
+
}
|
895
|
+
catch (error) {
|
896
|
+
reject('Invalid widget json data!');
|
897
|
+
}
|
898
|
+
}
|
899
|
+
else {
|
900
|
+
loadedWidgets.push(...widgets);
|
901
|
+
}
|
902
|
+
let intervalId = -1;
|
903
|
+
const loadFunc = () => {
|
904
|
+
if (this.galleryItems && this.galleryItems.length > 0) {
|
905
|
+
loadedWidgets.forEach(w => {
|
906
|
+
const gitem = this.galleryItems.find(c => c.uniqueName === w.uniqueName);
|
907
|
+
if (gitem) {
|
908
|
+
w.component = gitem.component;
|
909
|
+
if (gitem.props) {
|
910
|
+
w.props = JSON.parse(JSON.stringify(gitem.props));
|
911
|
+
}
|
912
|
+
}
|
913
|
+
});
|
914
|
+
this.widgets.push(...loadedWidgets);
|
915
|
+
window.clearInterval(intervalId);
|
916
|
+
this.cdr.detectChanges();
|
917
|
+
resolve();
|
918
|
+
}
|
919
|
+
};
|
920
|
+
intervalId = window.setInterval(loadFunc, 200);
|
921
|
+
}
|
922
|
+
else {
|
923
|
+
resolve();
|
924
|
+
}
|
925
|
+
});
|
926
|
+
}
|
927
|
+
clear() {
|
928
|
+
if (this.widgets.length) {
|
929
|
+
this.widgets = [];
|
930
|
+
this.cdr.detectChanges();
|
931
|
+
this.emitConfigChanged();
|
932
|
+
}
|
933
|
+
}
|
934
|
+
save() {
|
935
|
+
const obj = this.widgets.map(c => ({
|
936
|
+
uniqueName: c.uniqueName,
|
937
|
+
component: c.component,
|
938
|
+
title: c.title,
|
939
|
+
sizeX: c.sizeX,
|
940
|
+
sizeY: c.sizeY,
|
941
|
+
col: c.col,
|
942
|
+
row: c.row,
|
943
|
+
options: c.options,
|
944
|
+
props: c.props
|
945
|
+
}));
|
946
|
+
return Promise.resolve(JSON.stringify(obj));
|
947
|
+
}
|
948
|
+
refresh() {
|
949
|
+
this.widgetHosts.forEach(host => {
|
950
|
+
host.widget.refresh();
|
951
|
+
});
|
952
|
+
}
|
953
|
+
handleOnConfigChanged(e) {
|
954
|
+
this.cdr.detectChanges();
|
955
|
+
this.emitConfigChanged();
|
956
|
+
}
|
957
|
+
handleOnResizedChanged(e) {
|
958
|
+
this.detectFirstEmptySlot(e.config);
|
959
|
+
this.cdr.detectChanges();
|
960
|
+
this.emitConfigChanged();
|
961
|
+
}
|
962
|
+
emitConfigChanged() {
|
963
|
+
if (!this.resizeChangeObserver) {
|
964
|
+
this.resizeChangeObserver = new Observable();
|
965
|
+
Observable.create(observer => {
|
966
|
+
this.resizeChangeObserver = observer;
|
967
|
+
})
|
968
|
+
.pipe(debounceTime(750))
|
969
|
+
.pipe(distinctUntilChanged())
|
970
|
+
.subscribe(c => {
|
971
|
+
this.onConfigChanged.emit({
|
972
|
+
component: this
|
973
|
+
});
|
974
|
+
});
|
975
|
+
}
|
976
|
+
this.resizeChangeObserver.next(new Date());
|
977
|
+
}
|
978
|
+
}
|
979
|
+
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 });
|
980
|
+
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", readonly: "readonly", provideValue: "provideValue" }, outputs: { onConfigChanged: "onConfigChanged", onWidgetSave: "onWidgetSave" }, host: { classAttribute: "ax widget-board" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true }, { propertyName: "widgetHosts", predicate: AXWidgetHostComponent, descendants: true }], ngImport: i0, template: "<div class=\"widgets-container\" [class.rtl]=\"rtl\" #container>\r\n <ax-widget-host *ngFor=\"let w of widgets;trackBy: trackByFn\" [config]='w' [sizeX]=\"w.sizeX\" [readonly]=\"readonly || w.readonly\"\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", "readonly", "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 });
|
981
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardComponent, decorators: [{
|
982
|
+
type: Component,
|
983
|
+
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\" [readonly]=\"readonly || w.readonly\"\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"] }]
|
984
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { container: [{
|
985
|
+
type: ViewChild,
|
986
|
+
args: ['container']
|
987
|
+
}], widgetHosts: [{
|
988
|
+
type: ViewChildren,
|
989
|
+
args: [AXWidgetHostComponent]
|
990
|
+
}], galleryItems: [{
|
991
|
+
type: Input
|
992
|
+
}], tileSize: [{
|
993
|
+
type: Input
|
994
|
+
}], gapSize: [{
|
995
|
+
type: Input
|
996
|
+
}], readonly: [{
|
997
|
+
type: Input
|
998
|
+
}], provideValue: [{
|
999
|
+
type: Input
|
1000
|
+
}], onConfigChanged: [{
|
1001
|
+
type: Output
|
1002
|
+
}], onWidgetSave: [{
|
1003
|
+
type: Output
|
1004
|
+
}] } });
|
1005
|
+
|
1006
|
+
class AXWidgetSizePropertyEditorComponent extends AXProperyEditorComponent {
|
1007
|
+
constructor(cdr) {
|
1008
|
+
super(cdr);
|
1009
|
+
this.cdr = cdr;
|
1010
|
+
this.minX = 1;
|
1011
|
+
this.maxX = 10;
|
1012
|
+
this.minY = 1;
|
1013
|
+
this.maxY = 10;
|
1014
|
+
}
|
1015
|
+
ngOnInit() {
|
1016
|
+
if (Array.isArray(this.value)) {
|
1017
|
+
this.sizeX = this.value[0];
|
1018
|
+
this.sizeY = this.value[1];
|
1019
|
+
}
|
1020
|
+
else {
|
1021
|
+
this.sizeX = 2;
|
1022
|
+
this.sizeY = 2;
|
1023
|
+
}
|
1024
|
+
}
|
1025
|
+
handleMinValueChange(e) {
|
1026
|
+
this.sizeX = e.value;
|
1027
|
+
if (this.sizeY > 0) {
|
1028
|
+
super.handleValueChange([this.sizeX, this.sizeY]);
|
1029
|
+
}
|
1030
|
+
}
|
1031
|
+
handleMaxValueChange(e) {
|
1032
|
+
this.sizeY = e.value;
|
1033
|
+
if (this.sizeX > 0) {
|
1034
|
+
super.handleValueChange([this.sizeX, this.sizeY]);
|
1035
|
+
}
|
1036
|
+
}
|
1037
|
+
ngAfterViewInit() {
|
1038
|
+
this.onRenderCompleted.emit();
|
1039
|
+
}
|
1040
|
+
}
|
1041
|
+
AXWidgetSizePropertyEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
1042
|
+
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: grid;grid-gap: 2%; grid-template-columns: 49% 49%;\">\r\n <ax-number-box (onValueChanged)=\"handleMinValueChange($event)\" [value]=\"sizeX\" [min]=\"minX\" [max]=\"maxX\">\r\n </ax-number-box>\r\n <ax-number-box (onValueChanged)=\"handleMaxValueChange($event)\" [value]=\"sizeY\" [min]=\"minY\" [max]=\"maxY\">\r\n </ax-number-box>\r\n</div>", components: [{ type: i1.AXNumberBoxComponent, selector: "ax-number-box", inputs: ["min", "max", "showSeparator", "showCurrency", "showCounter", "scrollWeel", "showDoubleCounter", "maxLength", "intStep", "decimalNumber", "customStep"] }] });
|
1043
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorComponent, decorators: [{
|
1044
|
+
type: Component,
|
1045
|
+
args: [{ template: "<div style=\"display: grid;grid-gap: 2%; grid-template-columns: 49% 49%;\">\r\n <ax-number-box (onValueChanged)=\"handleMinValueChange($event)\" [value]=\"sizeX\" [min]=\"minX\" [max]=\"maxX\">\r\n </ax-number-box>\r\n <ax-number-box (onValueChanged)=\"handleMaxValueChange($event)\" [value]=\"sizeY\" [min]=\"minY\" [max]=\"maxY\">\r\n </ax-number-box>\r\n</div>" }]
|
1046
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
1047
|
+
|
1048
|
+
class AXWidgetBoardModule {
|
1049
|
+
/**
|
1050
|
+
*
|
1051
|
+
*/
|
1052
|
+
constructor() {
|
1053
|
+
AXTranslator.load('en', {
|
1054
|
+
'widget-board': {
|
1055
|
+
'configurable-props': 'Configurable Properties',
|
1056
|
+
configure: 'Configure Widget'
|
1057
|
+
}
|
1058
|
+
});
|
1059
|
+
AXTranslator.load('fa', {
|
1060
|
+
'widget-board': {
|
1061
|
+
'configurable-props': 'ویژگی های قابل تنظیم',
|
1062
|
+
configure: 'پیکر بندی ابزارک'
|
1063
|
+
}
|
1064
|
+
});
|
1065
|
+
}
|
1066
|
+
}
|
1067
|
+
AXWidgetBoardModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1068
|
+
AXWidgetBoardModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardModule, declarations: [AXWidgetBoardComponent, AXWidgetHostComponent, AXWidgetConfigComponent, AXWidgetSaveComponent], imports: [CommonModule,
|
1069
|
+
AXSearchBoxModule,
|
1070
|
+
AXLoadingModule,
|
1071
|
+
RouterModule,
|
1072
|
+
AXProppertyEditorModule,
|
1073
|
+
AXPageModule,
|
1074
|
+
AXToolbarModule,
|
1075
|
+
AXTranslatorModule,
|
1076
|
+
AXLabelModule,
|
1077
|
+
AXTextAreaModule,
|
1078
|
+
AXFieldsetModule,
|
1079
|
+
AXTextBoxModule,
|
1080
|
+
AXFormGroupModule,
|
1081
|
+
AXTabStripModule,
|
1082
|
+
AXCheckBoxModule,
|
1083
|
+
AXMenuModule,
|
1084
|
+
AXTranslatorModule,
|
1085
|
+
AXValidationModule, i1$2.RouterModule], exports: [AXWidgetBoardComponent, AXProppertyEditorModule] });
|
1086
|
+
AXWidgetBoardModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardModule, providers: [], imports: [[
|
1087
|
+
CommonModule,
|
1088
|
+
AXSearchBoxModule,
|
1089
|
+
AXLoadingModule,
|
1090
|
+
RouterModule,
|
1091
|
+
AXProppertyEditorModule,
|
1092
|
+
AXPageModule,
|
1093
|
+
AXToolbarModule,
|
1094
|
+
AXTranslatorModule,
|
1095
|
+
AXLabelModule,
|
1096
|
+
AXTextAreaModule,
|
1097
|
+
AXFieldsetModule,
|
1098
|
+
AXTextBoxModule,
|
1099
|
+
AXFormGroupModule,
|
1100
|
+
AXTabStripModule,
|
1101
|
+
AXCheckBoxModule,
|
1102
|
+
AXMenuModule,
|
1103
|
+
AXTranslatorModule,
|
1104
|
+
AXValidationModule,
|
1105
|
+
RouterModule.forChild([
|
1106
|
+
{
|
1107
|
+
component: AXWidgetSizePropertyEditorComponent,
|
1108
|
+
path: 'ax/editors/widget-size'
|
1109
|
+
},
|
1110
|
+
])
|
1111
|
+
], AXProppertyEditorModule] });
|
1112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardModule, decorators: [{
|
1113
|
+
type: NgModule,
|
1114
|
+
args: [{
|
1115
|
+
imports: [
|
1116
|
+
CommonModule,
|
1117
|
+
AXSearchBoxModule,
|
1118
|
+
AXLoadingModule,
|
1119
|
+
RouterModule,
|
1120
|
+
AXProppertyEditorModule,
|
1121
|
+
AXPageModule,
|
1122
|
+
AXToolbarModule,
|
1123
|
+
AXTranslatorModule,
|
1124
|
+
AXLabelModule,
|
1125
|
+
AXTextAreaModule,
|
1126
|
+
AXFieldsetModule,
|
1127
|
+
AXTextBoxModule,
|
1128
|
+
AXFormGroupModule,
|
1129
|
+
AXTabStripModule,
|
1130
|
+
AXCheckBoxModule,
|
1131
|
+
AXMenuModule,
|
1132
|
+
AXTranslatorModule,
|
1133
|
+
AXValidationModule,
|
1134
|
+
RouterModule.forChild([
|
1135
|
+
{
|
1136
|
+
component: AXWidgetSizePropertyEditorComponent,
|
1137
|
+
path: 'ax/editors/widget-size'
|
1138
|
+
},
|
1139
|
+
])
|
1140
|
+
],
|
1141
|
+
exports: [AXWidgetBoardComponent, AXProppertyEditorModule],
|
1142
|
+
declarations: [AXWidgetBoardComponent, AXWidgetHostComponent, AXWidgetConfigComponent, AXWidgetSaveComponent],
|
1143
|
+
providers: []
|
1144
|
+
}]
|
1145
|
+
}], ctorParameters: function () { return []; } });
|
1146
|
+
|
1147
|
+
class AXWidgetSizePropertyEditorModule {
|
1148
|
+
}
|
1149
|
+
AXWidgetSizePropertyEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1150
|
+
AXWidgetSizePropertyEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorModule, declarations: [AXWidgetSizePropertyEditorComponent], imports: [CommonModule, FormsModule, AXNumberBoxModule], exports: [AXWidgetSizePropertyEditorComponent] });
|
1151
|
+
AXWidgetSizePropertyEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorModule, providers: [], imports: [[CommonModule, FormsModule, AXNumberBoxModule]] });
|
1152
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorModule, decorators: [{
|
1153
|
+
type: NgModule,
|
1154
|
+
args: [{
|
1155
|
+
declarations: [AXWidgetSizePropertyEditorComponent],
|
1156
|
+
imports: [CommonModule, FormsModule, AXNumberBoxModule],
|
1157
|
+
exports: [AXWidgetSizePropertyEditorComponent],
|
1158
|
+
providers: []
|
1159
|
+
}]
|
1160
|
+
}] });
|
1161
|
+
|
1162
|
+
/**
|
1163
|
+
* Generated bundle index. Do not edit.
|
1164
|
+
*/
|
1165
|
+
|
1166
|
+
export { AXWidgetBoardComponent, AXWidgetBoardModule, AXWidgetComponent, AXWidgetHostComponent, AXWidgetSizePropertyEditorComponent, AXWidgetSizePropertyEditorModule };
|
1167
|
+
//# sourceMappingURL=acorex-layout.mjs.map
|