@acorex/layout 6.5.71 → 6.5.73
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -2
- package/esm2022/acorex-layout.mjs +5 -0
- package/esm2022/index.mjs +7 -0
- package/esm2022/lib/widget-board/editors/widget-size-editor/widget-size.editor.mjs +49 -0
- package/esm2022/lib/widget-board/editors/widget-size-editor/widget-size.module.mjs +21 -0
- package/esm2022/lib/widget-board/widget-board.component.mjs +452 -0
- package/esm2022/lib/widget-board/widget-board.module.mjs +109 -0
- package/esm2022/lib/widget-board/widget-config.component.mjs +85 -0
- package/esm2022/lib/widget-board/widget-host.component.mjs +311 -0
- package/esm2022/lib/widget-board/widget-save.component.mjs +79 -0
- package/esm2022/lib/widget-board/widget.class.mjs +130 -0
- package/{fesm2020 → fesm2022}/acorex-layout.mjs +158 -127
- package/fesm2022/acorex-layout.mjs.map +1 -0
- package/lib/widget-board/editors/widget-size-editor/widget-size.editor.d.ts +1 -1
- package/lib/widget-board/widget-board.component.d.ts +1 -1
- package/lib/widget-board/widget-config.component.d.ts +1 -1
- package/lib/widget-board/widget-host.component.d.ts +1 -1
- package/lib/widget-board/widget-save.component.d.ts +1 -1
- package/package.json +12 -18
- package/acorex-layout.d.ts +0 -5
- package/esm2020/acorex-layout.mjs +0 -5
- package/esm2020/lib/widget-board/editors/widget-size-editor/widget-size.editor.mjs +0 -46
- package/esm2020/lib/widget-board/editors/widget-size-editor/widget-size.module.mjs +0 -21
- package/esm2020/lib/widget-board/widget-board.component.mjs +0 -444
- package/esm2020/lib/widget-board/widget-board.module.mjs +0 -111
- package/esm2020/lib/widget-board/widget-config.component.mjs +0 -82
- package/esm2020/lib/widget-board/widget-host.component.mjs +0 -295
- package/esm2020/lib/widget-board/widget-save.component.mjs +0 -79
- package/esm2020/lib/widget-board/widget.class.mjs +0 -127
- package/esm2020/public-api.mjs +0 -7
- package/fesm2015/acorex-layout.mjs +0 -1175
- package/fesm2015/acorex-layout.mjs.map +0 -1
- package/fesm2020/acorex-layout.mjs.map +0 -1
- /package/{public-api.d.ts → index.d.ts} +0 -0
@@ -1,1175 +0,0 @@
|
|
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 { Subject } from 'rxjs';
|
11
|
-
import { debounceTime } 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>\n <ax-page-content>\n <div class=\"container\">\n <ax-validation-form #form>\n <div class=\"row\" *ngFor=\"let p of displayProps; trackBy: identify\">\n <div class=\"col-12\">\n <ax-label>{{p.property.title | trans}}</ax-label>\n <ng-container ax-property-editor-renderer [property]=\"p\" [context]=\"context\" [host]=\"widget\" [validationForm]=\"form\"\n (onValueChange)=\"handleValueChange($event)\">\n </ng-container>\n </div>\n </div>\n </ax-validation-form>\n </div>\n </ax-page-content>\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>\n <ax-page-content>\n <div class=\"container\">\n <ax-validation-form #form>\n <div class=\"row\" *ngFor=\"let p of displayProps; trackBy: identify\">\n <div class=\"col-12\">\n <ax-label>{{p.property.title | trans}}</ax-label>\n <ng-container ax-property-editor-renderer [property]=\"p\" [context]=\"context\" [host]=\"widget\" [validationForm]=\"form\"\n (onValueChange)=\"handleValueChange($event)\">\n </ng-container>\n </div>\n </div>\n </ax-validation-form>\n </div>\n </ax-page-content>\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>\n <ax-page-content>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.title' | trans}}</ax-label>\n <ax-text-box [(value)]=\"data.title\"></ax-text-box>\n </ax-form-group>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.description' | trans}}</ax-label>\n <ax-text-area [(value)]=\"data.description\"></ax-text-area>\n </ax-form-group>\n </div>\n </div>\n <!-- <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.uniquename' | trans}}</ax-label>\n <ax-text-box></ax-text-box>\n </ax-form-group>\n </div>\n </div> -->\n <div class=\"row\" style=\"margin-block-end: var(--ax-size-md);margin-block-start: var(--ax-size-md);\">\n <div class=\"col-12\">\n <ax-fieldset caption=\"{{'widget-board.configurable-props' | trans}}\">\n <div class=\"row\" *ngFor=\"let prop of displayProps\">\n <div class=\"col-12\" style=\"margin-block-end: var(--ax-size-sm)\">\n <ax-check-box [(value)]=\"prop.allow\" label=\"{{ prop.title | trans }}\">\n\n </ax-check-box>\n </div>\n </div>\n </ax-fieldset>\n </div>\n </div>\n </div>\n </ax-page-content>\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>\n <ax-page-content>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.title' | trans}}</ax-label>\n <ax-text-box [(value)]=\"data.title\"></ax-text-box>\n </ax-form-group>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.description' | trans}}</ax-label>\n <ax-text-area [(value)]=\"data.description\"></ax-text-area>\n </ax-form-group>\n </div>\n </div>\n <!-- <div class=\"row\">\n <div class=\"col-12\">\n <ax-form-group>\n <ax-label>{{'common.uniquename' | trans}}</ax-label>\n <ax-text-box></ax-text-box>\n </ax-form-group>\n </div>\n </div> -->\n <div class=\"row\" style=\"margin-block-end: var(--ax-size-md);margin-block-start: var(--ax-size-md);\">\n <div class=\"col-12\">\n <ax-fieldset caption=\"{{'widget-board.configurable-props' | trans}}\">\n <div class=\"row\" *ngFor=\"let prop of displayProps\">\n <div class=\"col-12\" style=\"margin-block-end: var(--ax-size-sm)\">\n <ax-check-box [(value)]=\"prop.allow\" label=\"{{ prop.title | trans }}\">\n\n </ax-check-box>\n </div>\n </div>\n </ax-fieldset>\n </div>\n </div>\n </div>\n </ax-page-content>\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.readonly = false;
|
308
|
-
this._isLoading = false;
|
309
|
-
this.sizeX = 1;
|
310
|
-
this.sizeY = 1;
|
311
|
-
this.col = 1;
|
312
|
-
this.row = 1;
|
313
|
-
}
|
314
|
-
get widget() {
|
315
|
-
return this._widget;
|
316
|
-
}
|
317
|
-
get element() {
|
318
|
-
return this.ref.nativeElement;
|
319
|
-
}
|
320
|
-
get isLoading() {
|
321
|
-
return this._isLoading;
|
322
|
-
}
|
323
|
-
set isLoading(v) {
|
324
|
-
this._isLoading = v;
|
325
|
-
if (this._loadingId && !v) {
|
326
|
-
this.loadingService.hide(this._loadingId);
|
327
|
-
this._loadingId = null;
|
328
|
-
}
|
329
|
-
if (v) {
|
330
|
-
this._loadingId = this.loadingService.show(this.ref.nativeElement);
|
331
|
-
}
|
332
|
-
}
|
333
|
-
get isConfigured() {
|
334
|
-
var _a;
|
335
|
-
return ((_a = this._widget) === null || _a === void 0 ? void 0 : _a.isConfigured) || false;
|
336
|
-
}
|
337
|
-
ngOnInit() {
|
338
|
-
this.isLoading = true;
|
339
|
-
}
|
340
|
-
ngAfterViewInit() {
|
341
|
-
return __awaiter(this, void 0, void 0, function* () {
|
342
|
-
let component;
|
343
|
-
if (typeof this.config.component === 'string') {
|
344
|
-
const route = yield this.rendererService.findLoadedComponentByRoute(this.config.component, 20);
|
345
|
-
component = route === null || route === void 0 ? void 0 : route.component;
|
346
|
-
}
|
347
|
-
else if (typeof this.config.component === 'function') {
|
348
|
-
component = this.config.component;
|
349
|
-
}
|
350
|
-
if (component == null) {
|
351
|
-
console.error(`Invalid Widget Component!`, this.config);
|
352
|
-
this.onRemove.emit(this);
|
353
|
-
return;
|
354
|
-
}
|
355
|
-
const widgetFactory = this.componentFactoryResolver.resolveComponentFactory(component);
|
356
|
-
this.componentRef = this.vc.createComponent(widgetFactory);
|
357
|
-
this._widget = this.componentRef.instance;
|
358
|
-
this._widget.provideValue = this.provideValue;
|
359
|
-
if (this._widget.onBusyChanged) {
|
360
|
-
this._widget.onBusyChanged.subscribe((d) => {
|
361
|
-
if (!this._widget.widgetSize) {
|
362
|
-
this._widget.setValue('widgetSize', [this.sizeX, this.sizeY]);
|
363
|
-
}
|
364
|
-
else {
|
365
|
-
this.setSizeFromOptions();
|
366
|
-
}
|
367
|
-
this.isLoading = d.value;
|
368
|
-
this.cdr.detectChanges();
|
369
|
-
});
|
370
|
-
}
|
371
|
-
if (this._widget.onConfiguredChanged) {
|
372
|
-
this._widget.onConfiguredChanged.subscribe(() => {
|
373
|
-
this.setSizeFromOptions();
|
374
|
-
});
|
375
|
-
}
|
376
|
-
//
|
377
|
-
if (this.config.options) {
|
378
|
-
Object.assign(this._widget, this.config.options);
|
379
|
-
}
|
380
|
-
this._hasProps = AXPropertyDecorators.getProperties(this._widget).length > 0;
|
381
|
-
this.isLoading = false;
|
382
|
-
this.config['__meta__'].instance = this;
|
383
|
-
this._widget['__meta__'] = {};
|
384
|
-
this._widget['__meta__'].config = this.config;
|
385
|
-
//
|
386
|
-
this.configMenuItem[0].items.push({
|
387
|
-
name: 'refresh',
|
388
|
-
icon: 'far fa-undo',
|
389
|
-
text: AXTranslator.get('common.refresh'),
|
390
|
-
onClick: () => {
|
391
|
-
var _a;
|
392
|
-
(_a = this === null || this === void 0 ? void 0 : this.widget) === null || _a === void 0 ? void 0 : _a.refresh();
|
393
|
-
}
|
394
|
-
});
|
395
|
-
//
|
396
|
-
if (this._hasProps) {
|
397
|
-
this.configMenuItem[0].items.push({
|
398
|
-
name: 'configs',
|
399
|
-
icon: 'far fa-cogs',
|
400
|
-
text: AXTranslator.get('common.configs'),
|
401
|
-
onClick: () => {
|
402
|
-
this.openConfigDialog();
|
403
|
-
}
|
404
|
-
});
|
405
|
-
}
|
406
|
-
this.configMenuItem[0].items.push({
|
407
|
-
name: 'save',
|
408
|
-
icon: 'far fa-save',
|
409
|
-
text: AXTranslator.get('common.save-as'),
|
410
|
-
onClick: () => {
|
411
|
-
this.openSaveDialog();
|
412
|
-
}
|
413
|
-
});
|
414
|
-
if (true) {
|
415
|
-
this.configMenuItem[0].items.push({
|
416
|
-
name: 'remove',
|
417
|
-
icon: 'far fa-times',
|
418
|
-
style: 'ax danger blank',
|
419
|
-
text: AXTranslator.get('common.remove'),
|
420
|
-
onClick: () => {
|
421
|
-
this.onRemove.emit(this);
|
422
|
-
}
|
423
|
-
});
|
424
|
-
}
|
425
|
-
this._hasMenu = this.configMenuItem[0].items.length > 0;
|
426
|
-
this.cdr.detectChanges();
|
427
|
-
});
|
428
|
-
}
|
429
|
-
setSizeFromOptions() {
|
430
|
-
this._widget.getValue('widgetSize').then(c => {
|
431
|
-
const oldSizeX = this.sizeX;
|
432
|
-
const oldSizeY = this.sizeY;
|
433
|
-
if (c && Array.isArray(c) && (oldSizeX !== c[0] || oldSizeY !== c[1])) {
|
434
|
-
this.config.sizeX = this.sizeX = c[0];
|
435
|
-
this.config.sizeY = this.sizeY = c[1];
|
436
|
-
this.onResized.emit({
|
437
|
-
component: this._widget,
|
438
|
-
config: this.config
|
439
|
-
});
|
440
|
-
}
|
441
|
-
this.cdr.detectChanges();
|
442
|
-
});
|
443
|
-
}
|
444
|
-
remove(e) {
|
445
|
-
e.preventDefault();
|
446
|
-
e.stopPropagation();
|
447
|
-
if (!this.readonly)
|
448
|
-
this.onRemove.emit(this);
|
449
|
-
return false;
|
450
|
-
}
|
451
|
-
handleConfig(e) {
|
452
|
-
e.preventDefault();
|
453
|
-
e.stopPropagation();
|
454
|
-
if (!this.readonly)
|
455
|
-
this.openConfigDialog();
|
456
|
-
return false;
|
457
|
-
}
|
458
|
-
openConfigDialog() {
|
459
|
-
const ppp = this.getMergedProps();
|
460
|
-
this.popup.open(AXWidgetConfigComponent, {
|
461
|
-
title: AXTranslator.get('common.configs'),
|
462
|
-
size: 'sm',
|
463
|
-
data: {
|
464
|
-
props: ppp.map(c => ({ property: c.options, value: this._widget[c.options.name] })),
|
465
|
-
widget: this.widget
|
466
|
-
}
|
467
|
-
}).then(c => {
|
468
|
-
if (c.data) {
|
469
|
-
if (!this.config.options) {
|
470
|
-
this.config.options = {};
|
471
|
-
}
|
472
|
-
c.data.forEach(p => {
|
473
|
-
this._widget.setValue(p.property.name, p.value);
|
474
|
-
this.config.options[p.property.name] = p.value;
|
475
|
-
});
|
476
|
-
this.emitConfigChanged();
|
477
|
-
this._widget.redraw();
|
478
|
-
this.cdr.detectChanges();
|
479
|
-
}
|
480
|
-
});
|
481
|
-
}
|
482
|
-
openSaveDialog() {
|
483
|
-
const ppp = this.getMergedProps();
|
484
|
-
this.popup.open(AXWidgetSaveComponent, {
|
485
|
-
title: AXTranslator.get('common.save-as'),
|
486
|
-
size: 'sm',
|
487
|
-
data: {
|
488
|
-
config: this.config,
|
489
|
-
props: ppp.map(c => ({ property: c.options, value: this._widget[c.options.name] }))
|
490
|
-
}
|
491
|
-
}).then(c => {
|
492
|
-
if (c.data) {
|
493
|
-
this.onSave.emit({
|
494
|
-
component: this._widget,
|
495
|
-
data: c.data
|
496
|
-
});
|
497
|
-
}
|
498
|
-
});
|
499
|
-
}
|
500
|
-
handleOptionClick(e) {
|
501
|
-
e.preventDefault();
|
502
|
-
e.stopPropagation();
|
503
|
-
this.openConfigDialog();
|
504
|
-
return false;
|
505
|
-
}
|
506
|
-
ngOnDestroy() {
|
507
|
-
this.vc.clear();
|
508
|
-
if (this.componentRef) {
|
509
|
-
this.componentRef.destroy();
|
510
|
-
}
|
511
|
-
}
|
512
|
-
getMergedProps() {
|
513
|
-
const ppp = AXObjectUtil.deepCopy(AXPropertyDecorators.getProperties(this._widget));
|
514
|
-
for (const key in this.config.props) {
|
515
|
-
if (Object.prototype.hasOwnProperty.call(this.config.props, key)) {
|
516
|
-
const newP = this.config.props[key];
|
517
|
-
const existPropDec = ppp.find(p => p.property === key);
|
518
|
-
if (existPropDec) {
|
519
|
-
Object.assign(existPropDec.options, newP);
|
520
|
-
}
|
521
|
-
}
|
522
|
-
}
|
523
|
-
return ppp;
|
524
|
-
}
|
525
|
-
emitConfigChanged() {
|
526
|
-
this.onConfigChanged.emit({
|
527
|
-
component: this._widget,
|
528
|
-
config: this.config
|
529
|
-
});
|
530
|
-
}
|
531
|
-
}
|
532
|
-
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 });
|
533
|
-
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'>\n <div class=\"widget-config-overlay\" *ngIf=\"!isConfigured\" (click)=\"handleConfig($event)\">\n <div class=\"widget-title\">{{config.title}}</div>\n <div class=\"widget-config-box\">\n <div class=\"config-title\">{{ 'widget-board.configure' | trans}}</div>\n <div class=\"config-icon\" *ngIf=\"!readonly\"><i class=\"fas fa-cogs fa-5x\" aria-hidden=\"true\"></i></div>\n </div>\n </div>\n <div class='widget-edit-overlay' >\n <div class='widget-edit-menu'>\n <button class=\"widget-edit-menu-button\" (click)=\"handleConfig($event)\"\n (mousedown)=\"$event.stopPropagation()\" *ngIf=\"_hasProps\" (mouseup)=\"$event.stopPropagation()\">\n <i class=\"far fa-cogs\" aria-hidden=\"true\"></i>\n </button>\n <button class=\"widget-edit-menu-button\" (click)=\"remove($event)\" (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\">\n <i class=\"far fa-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n </div>\n <div class=\"widget-options-menu\" *ngIf=\"_hasMenu && !readonly\">\n <ax-menu [items]='configMenuItem' direction=\"horizontal\"></ax-menu>\n </div>\n <!-- <ax-loading-panel [visible]=\"isBusy\">\n </ax-loading-panel> -->\n <div class=\"widget-content\">\n <ng-container #vc></ng-container>\n </div>\n</div>", 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 });
|
534
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetHostComponent, decorators: [{
|
535
|
-
type: Component,
|
536
|
-
args: [{ selector: 'ax-widget-host', host: { class: 'ax widget-host', tabindex: '0' }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class='widget-container'>\n <div class=\"widget-config-overlay\" *ngIf=\"!isConfigured\" (click)=\"handleConfig($event)\">\n <div class=\"widget-title\">{{config.title}}</div>\n <div class=\"widget-config-box\">\n <div class=\"config-title\">{{ 'widget-board.configure' | trans}}</div>\n <div class=\"config-icon\" *ngIf=\"!readonly\"><i class=\"fas fa-cogs fa-5x\" aria-hidden=\"true\"></i></div>\n </div>\n </div>\n <div class='widget-edit-overlay' >\n <div class='widget-edit-menu'>\n <button class=\"widget-edit-menu-button\" (click)=\"handleConfig($event)\"\n (mousedown)=\"$event.stopPropagation()\" *ngIf=\"_hasProps\" (mouseup)=\"$event.stopPropagation()\">\n <i class=\"far fa-cogs\" aria-hidden=\"true\"></i>\n </button>\n <button class=\"widget-edit-menu-button\" (click)=\"remove($event)\" (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\">\n <i class=\"far fa-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n </div>\n <div class=\"widget-options-menu\" *ngIf=\"_hasMenu && !readonly\">\n <ax-menu [items]='configMenuItem' direction=\"horizontal\"></ax-menu>\n </div>\n <!-- <ax-loading-panel [visible]=\"isBusy\">\n </ax-loading-panel> -->\n <div class=\"widget-content\">\n <ng-container #vc></ng-container>\n </div>\n</div>" }]
|
537
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i1$1.AXRenderService }, { type: i0.ChangeDetectorRef }, { type: i1.AXPopupService }, { type: i1.AXLoadingService }]; }, propDecorators: { provideValue: [{
|
538
|
-
type: Input
|
539
|
-
}], onRemove: [{
|
540
|
-
type: Output
|
541
|
-
}], onConfigChanged: [{
|
542
|
-
type: Output
|
543
|
-
}], onResized: [{
|
544
|
-
type: Output
|
545
|
-
}], onSave: [{
|
546
|
-
type: Output
|
547
|
-
}], config: [{
|
548
|
-
type: Input
|
549
|
-
}], vc: [{
|
550
|
-
type: ViewChild,
|
551
|
-
args: ['vc', { read: ViewContainerRef }]
|
552
|
-
}], readonly: [{
|
553
|
-
type: Input
|
554
|
-
}], sizeX: [{
|
555
|
-
type: HostBinding,
|
556
|
-
args: ['attr.data-size-x']
|
557
|
-
}, {
|
558
|
-
type: Input
|
559
|
-
}], sizeY: [{
|
560
|
-
type: HostBinding,
|
561
|
-
args: ['attr.data-size-y']
|
562
|
-
}, {
|
563
|
-
type: Input
|
564
|
-
}], col: [{
|
565
|
-
type: HostBinding,
|
566
|
-
args: ['attr.data-col']
|
567
|
-
}, {
|
568
|
-
type: Input
|
569
|
-
}], row: [{
|
570
|
-
type: HostBinding,
|
571
|
-
args: ['attr.data-row']
|
572
|
-
}, {
|
573
|
-
type: Input
|
574
|
-
}] } });
|
575
|
-
|
576
|
-
class AXWidgetBoardComponent {
|
577
|
-
constructor(ref, zone, cdr) {
|
578
|
-
this.ref = ref;
|
579
|
-
this.zone = zone;
|
580
|
-
this.cdr = cdr;
|
581
|
-
this.widgets = [];
|
582
|
-
this.galleryItems = [];
|
583
|
-
this.tileSize = 80;
|
584
|
-
this.gapSize = 5;
|
585
|
-
this.readonly = false;
|
586
|
-
this.newWidget = null;
|
587
|
-
this._isInEditing = false;
|
588
|
-
this.isDragging = false;
|
589
|
-
this.saveSubject = new Subject();
|
590
|
-
this.DATA_COL = 'data-col';
|
591
|
-
this.DATA_ROW = 'data-row';
|
592
|
-
this.DATA_SIZE_X = 'data-size-x';
|
593
|
-
this.DATA_SIZE_Y = 'data-size-y';
|
594
|
-
this.DATA_OLD_COL = 'data-old-col';
|
595
|
-
this.DATA_OLD_ROW = 'data-old-row';
|
596
|
-
this.onConfigChanged = new EventEmitter();
|
597
|
-
this.onWidgetSave = new EventEmitter();
|
598
|
-
}
|
599
|
-
isInEditing() {
|
600
|
-
return this._isInEditing;
|
601
|
-
}
|
602
|
-
ngOnInit() {
|
603
|
-
if (this.rtl == null) {
|
604
|
-
this.rtl = window.getComputedStyle(this.ref.nativeElement, null).getPropertyValue('direction') === 'rtl';
|
605
|
-
}
|
606
|
-
this.saveSubject.pipe(debounceTime(750)).subscribe((value) => {
|
607
|
-
this.emitConfigChanged(value);
|
608
|
-
});
|
609
|
-
}
|
610
|
-
ngOnDestroy() {
|
611
|
-
var _a;
|
612
|
-
(_a = this.saveSubject) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
613
|
-
}
|
614
|
-
ngAfterViewInit() {
|
615
|
-
this.zone.runOutsideAngular((c) => {
|
616
|
-
const style = document.createElement('style');
|
617
|
-
style.type = 'text/css';
|
618
|
-
this.ref.nativeElement.appendChild(style);
|
619
|
-
// add css data classes
|
620
|
-
for (let i = 1; i <= 50; i++) {
|
621
|
-
style.innerHTML += `[${this.DATA_COL}="${i}"] { ${this.rtl ? 'right' : 'left'}: ${(i - 1) * (this.tileSize + this.gapSize)}px; }`;
|
622
|
-
style.innerHTML += `[${this.DATA_ROW}="${i}"] { top: ${(i - 1) * (this.tileSize + this.gapSize)}px; }`;
|
623
|
-
style.innerHTML += `[${this.DATA_SIZE_X}="${i}"] { width: ${(i * this.tileSize) + ((i - 1) * this.gapSize)}px; }`;
|
624
|
-
style.innerHTML += `[${this.DATA_SIZE_Y}="${i}"] { height: ${(i * this.tileSize) + ((i - 1) * this.gapSize)}px; }`;
|
625
|
-
}
|
626
|
-
});
|
627
|
-
}
|
628
|
-
calcGridSize() {
|
629
|
-
this.zone.runOutsideAngular(() => {
|
630
|
-
const width = (Math.max(...this.widgets.map((c) => c.col + c.sizeX - 1))) * (this.tileSize + this.gapSize);
|
631
|
-
const height = (Math.max(...this.widgets.map((c) => c.row + c.sizeY - 1))) * (this.tileSize + this.gapSize);
|
632
|
-
this.container.nativeElement.style.width = width + 'px';
|
633
|
-
this.container.nativeElement.style.height = height + 'px';
|
634
|
-
});
|
635
|
-
}
|
636
|
-
toggleEdit() {
|
637
|
-
this._isInEditing ? this.finishEdit() : this.startEdit();
|
638
|
-
}
|
639
|
-
dragStart(e) {
|
640
|
-
e.preventDefault();
|
641
|
-
e.stopPropagation();
|
642
|
-
this.zone.runOutsideAngular(() => {
|
643
|
-
if (this._isInEditing && e.which === 1) {
|
644
|
-
this.dragItem = e.currentTarget;
|
645
|
-
this.dragItem.setAttribute('data-x-offset', (this.dragItem.offsetLeft - e.clientX).toString());
|
646
|
-
//
|
647
|
-
this.dragItem.setAttribute('data-y-offset', (this.dragItem.offsetTop - e.clientY).toString());
|
648
|
-
this.dragItem.classList.add('widget-dragging');
|
649
|
-
this.dragItem.classList.remove('animate__animated', 'animate__pulse');
|
650
|
-
}
|
651
|
-
});
|
652
|
-
return false;
|
653
|
-
}
|
654
|
-
removePositionData() {
|
655
|
-
this.zone.runOutsideAngular(() => {
|
656
|
-
if (this.dragItem && this._isInEditing && this.dragItem.getAttribute(this.DATA_OLD_COL) == null) {
|
657
|
-
this.dragItem.setAttribute(this.DATA_OLD_COL, this.dragItem.getAttribute(this.DATA_COL));
|
658
|
-
this.dragItem.setAttribute(this.DATA_OLD_ROW, this.dragItem.getAttribute(this.DATA_ROW));
|
659
|
-
this.dragItem.removeAttribute(this.DATA_COL);
|
660
|
-
this.dragItem.removeAttribute(this.DATA_ROW);
|
661
|
-
}
|
662
|
-
});
|
663
|
-
}
|
664
|
-
resetPositionData() {
|
665
|
-
this.zone.runOutsideAngular(() => {
|
666
|
-
if (this.dragItem && this._isInEditing) {
|
667
|
-
this.setPosition(this.dragItem, this.dragItem.getAttribute(this.DATA_OLD_COL), this.dragItem.getAttribute(this.DATA_OLD_ROW));
|
668
|
-
}
|
669
|
-
});
|
670
|
-
}
|
671
|
-
setPosition(element, col, row) {
|
672
|
-
this.zone.runOutsideAngular(() => {
|
673
|
-
element.setAttribute(this.DATA_COL, col);
|
674
|
-
element.setAttribute(this.DATA_ROW, row);
|
675
|
-
element.removeAttribute(this.DATA_OLD_COL);
|
676
|
-
element.removeAttribute(this.DATA_OLD_ROW);
|
677
|
-
element.style.removeProperty('top');
|
678
|
-
element.style.removeProperty('left');
|
679
|
-
const widget = this.widgets.find(c => c['__meta__'].instance.element === element);
|
680
|
-
widget.col = Number(col);
|
681
|
-
widget.row = Number(row);
|
682
|
-
});
|
683
|
-
}
|
684
|
-
drag(e) {
|
685
|
-
e.preventDefault();
|
686
|
-
e.stopPropagation();
|
687
|
-
this.zone.runOutsideAngular(() => {
|
688
|
-
if (this.dragItem && this._isInEditing) {
|
689
|
-
this.isDragging = true;
|
690
|
-
this.addPlaceholder();
|
691
|
-
const xOffset = Number(this.dragItem.getAttribute('data-x-offset'));
|
692
|
-
const yOffset = Number(this.dragItem.getAttribute('data-y-offset'));
|
693
|
-
this.dragItem.style.left = e.clientX + xOffset + 'px';
|
694
|
-
this.dragItem.style.top = e.clientY + yOffset + 'px';
|
695
|
-
//
|
696
|
-
this.detectBestPlacement();
|
697
|
-
this.removePositionData();
|
698
|
-
}
|
699
|
-
});
|
700
|
-
return false;
|
701
|
-
}
|
702
|
-
dragEnd(e) {
|
703
|
-
this.zone.runOutsideAngular(() => {
|
704
|
-
if (this.dragItem && this._isInEditing && this.isDragging) {
|
705
|
-
this.dragItem.classList.remove('widget-dragging');
|
706
|
-
this.dragItem.classList.add('animate__animated', 'animate__pulse');
|
707
|
-
//
|
708
|
-
const p = this.container.nativeElement.querySelector('.widget-blank-placeholder');
|
709
|
-
if (this.newWidget) {
|
710
|
-
const w = {
|
711
|
-
uniqueName: this.newWidget.uniqueName,
|
712
|
-
component: this.newWidget.component,
|
713
|
-
title: this.newWidget.title,
|
714
|
-
options: this.newWidget.options,
|
715
|
-
sizeX: this.newWidget.sizeX,
|
716
|
-
sizeY: this.newWidget.sizeY,
|
717
|
-
col: Number(p.getAttribute(this.DATA_COL)),
|
718
|
-
row: Number(p.getAttribute(this.DATA_ROW))
|
719
|
-
};
|
720
|
-
this.widgets.push(w);
|
721
|
-
this.newWidget = null;
|
722
|
-
this.container.nativeElement.removeChild(this.dragItem);
|
723
|
-
this.zone.run(() => {
|
724
|
-
this.cdr.detectChanges();
|
725
|
-
this.calcGridSize();
|
726
|
-
setTimeout(() => {
|
727
|
-
w['__meta__'].instance.element.addEventListener('mousedown', this.dragStart.bind(this), false);
|
728
|
-
}, 1000);
|
729
|
-
});
|
730
|
-
}
|
731
|
-
else {
|
732
|
-
if (p) {
|
733
|
-
this.setPosition(this.dragItem, p.getAttribute(this.DATA_COL), p.getAttribute(this.DATA_ROW));
|
734
|
-
}
|
735
|
-
else {
|
736
|
-
this.setPosition(this.dragItem, this.dragItem.getAttribute(this.DATA_OLD_COL), this.dragItem.getAttribute(this.DATA_OLD_ROW));
|
737
|
-
}
|
738
|
-
}
|
739
|
-
//
|
740
|
-
this.removePlaceholder();
|
741
|
-
this.dragItem = null;
|
742
|
-
this.calcGridSize();
|
743
|
-
this.saveSubject.next('config');
|
744
|
-
}
|
745
|
-
this.isDragging = false;
|
746
|
-
});
|
747
|
-
}
|
748
|
-
detectFirstEmptySlot(w) {
|
749
|
-
const xTile = Math.floor(this.ref.nativeElement.parentElement.offsetWidth / this.tileSize);
|
750
|
-
for (let j = 1; j <= 100; j++) {
|
751
|
-
for (let i = 1; i <= xTile - w.sizeX; i++) {
|
752
|
-
const rec = new AXClientRec({
|
753
|
-
left: i,
|
754
|
-
top: j,
|
755
|
-
width: w.sizeX,
|
756
|
-
height: w.sizeY
|
757
|
-
});
|
758
|
-
const el = this.widgets.filter(c => c !== w).find((c) => rec.intersect({
|
759
|
-
left: c.col,
|
760
|
-
top: c.row,
|
761
|
-
width: c.sizeX,
|
762
|
-
height: c.sizeY
|
763
|
-
}));
|
764
|
-
if (el == null) {
|
765
|
-
w.col = i;
|
766
|
-
w.row = j;
|
767
|
-
return;
|
768
|
-
}
|
769
|
-
}
|
770
|
-
}
|
771
|
-
}
|
772
|
-
detectBestPlacement() {
|
773
|
-
this.zone.runOutsideAngular(() => {
|
774
|
-
const p = this.container.nativeElement.querySelector('.widget-blank-placeholder');
|
775
|
-
let col = Math.ceil(this.dragItem.offsetLeft / this.tileSize);
|
776
|
-
if (this.rtl) {
|
777
|
-
col = Math.ceil((this.container.nativeElement.clientWidth - (this.dragItem.offsetLeft + this.dragItem.clientWidth)) / this.tileSize);
|
778
|
-
}
|
779
|
-
let row = Math.ceil(this.dragItem.offsetTop / this.tileSize);
|
780
|
-
if (col < 1) {
|
781
|
-
col = 1;
|
782
|
-
}
|
783
|
-
if (row < 1) {
|
784
|
-
row = 1;
|
785
|
-
}
|
786
|
-
const widgets = Array.from(this.ref.nativeElement.querySelectorAll('.widget-host')).map((c) => c);
|
787
|
-
p.setAttribute(this.DATA_COL, col.toString());
|
788
|
-
p.setAttribute(this.DATA_ROW, row.toString());
|
789
|
-
const collision = widgets.filter(c => c !== this.dragItem).some(c => AXHtmlUtil.collision(c, this.dragItem));
|
790
|
-
if (collision) {
|
791
|
-
this.removePlaceholder();
|
792
|
-
}
|
793
|
-
});
|
794
|
-
}
|
795
|
-
addPlaceholder() {
|
796
|
-
this.zone.runOutsideAngular(() => {
|
797
|
-
this.removePlaceholder();
|
798
|
-
if (this.dragItem) {
|
799
|
-
const p = document.createElement('div');
|
800
|
-
p.classList.add('widget-blank-placeholder');
|
801
|
-
p.setAttribute(this.DATA_COL, this.dragItem.getAttribute(this.DATA_COL));
|
802
|
-
p.setAttribute(this.DATA_ROW, this.dragItem.getAttribute(this.DATA_ROW));
|
803
|
-
p.setAttribute(this.DATA_SIZE_X, this.dragItem.getAttribute(this.DATA_SIZE_X));
|
804
|
-
p.setAttribute(this.DATA_SIZE_Y, this.dragItem.getAttribute(this.DATA_SIZE_Y));
|
805
|
-
this.container.nativeElement.appendChild(p);
|
806
|
-
}
|
807
|
-
});
|
808
|
-
}
|
809
|
-
removePlaceholder() {
|
810
|
-
const p = this.container.nativeElement.querySelector('.widget-blank-placeholder');
|
811
|
-
p === null || p === void 0 ? void 0 : p.remove();
|
812
|
-
}
|
813
|
-
startEdit() {
|
814
|
-
this._isInEditing = true;
|
815
|
-
this.calcGridSize();
|
816
|
-
this.ref.nativeElement.classList.add('grid-background');
|
817
|
-
const bg = this.ref.nativeElement;
|
818
|
-
bg.style.setProperty('background-position', `${this.rtl ? 'right' : 'left'} top`);
|
819
|
-
// tslint:disable-next-line: max-line-length
|
820
|
-
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>')`;
|
821
|
-
bg.style.setProperty('background-image', pattern);
|
822
|
-
//
|
823
|
-
const widgets = Array.from(this.ref.nativeElement.querySelectorAll('.widget-host'));
|
824
|
-
widgets.forEach((w) => {
|
825
|
-
w.addEventListener('mousedown', this.dragStart.bind(this), false);
|
826
|
-
});
|
827
|
-
this.ref.nativeElement.addEventListener('mousemove', this.drag.bind(this), false);
|
828
|
-
this.ref.nativeElement.addEventListener('mouseup', this.dragEnd.bind(this), false);
|
829
|
-
}
|
830
|
-
finishEdit() {
|
831
|
-
this.ref.nativeElement.classList.remove('grid-background');
|
832
|
-
const bg = this.ref.nativeElement;
|
833
|
-
bg.style.removeProperty('background-image');
|
834
|
-
//
|
835
|
-
this._isInEditing = false;
|
836
|
-
const widgets = Array.from(this.ref.nativeElement.querySelectorAll('.widget-host'));
|
837
|
-
widgets.forEach((w) => {
|
838
|
-
w.removeEventListener('mousedown', this.dragStart.bind(this), false);
|
839
|
-
});
|
840
|
-
this.ref.nativeElement.removeEventListener('mousemove', this.drag.bind(this), false);
|
841
|
-
this.ref.nativeElement.removeEventListener('mouseup', this.dragEnd.bind(this), false);
|
842
|
-
this.saveSubject.next('config');
|
843
|
-
}
|
844
|
-
addWidget(widget) {
|
845
|
-
this.zone.runOutsideAngular(() => {
|
846
|
-
this.newWidget = {
|
847
|
-
uniqueName: widget.uniqueName,
|
848
|
-
component: widget.component,
|
849
|
-
title: widget.title,
|
850
|
-
col: 1,
|
851
|
-
row: 1,
|
852
|
-
sizeX: widget.sizeX,
|
853
|
-
sizeY: widget.sizeY,
|
854
|
-
options: widget.options,
|
855
|
-
props: widget.props
|
856
|
-
};
|
857
|
-
this.detectFirstEmptySlot(this.newWidget);
|
858
|
-
const w = {
|
859
|
-
uniqueName: this.newWidget.uniqueName,
|
860
|
-
component: this.newWidget.component,
|
861
|
-
title: this.newWidget.title,
|
862
|
-
options: this.newWidget.options,
|
863
|
-
props: this.newWidget.props,
|
864
|
-
sizeX: this.newWidget.sizeX,
|
865
|
-
sizeY: this.newWidget.sizeY,
|
866
|
-
col: this.newWidget.col,
|
867
|
-
row: this.newWidget.row
|
868
|
-
};
|
869
|
-
this.widgets.push(w);
|
870
|
-
this.newWidget = null;
|
871
|
-
this.zone.run(() => {
|
872
|
-
this.cdr.detectChanges();
|
873
|
-
this.calcGridSize();
|
874
|
-
this.emitConfigChanged('add');
|
875
|
-
setTimeout(() => {
|
876
|
-
w['__meta__'].instance.element.addEventListener('mousedown', this.dragStart.bind(this), false);
|
877
|
-
}, 1000);
|
878
|
-
});
|
879
|
-
});
|
880
|
-
}
|
881
|
-
handleOnRemove(w) {
|
882
|
-
w.element.classList.add('animate__animated', 'animate__zoomOut');
|
883
|
-
w.element.addEventListener('animationend', () => {
|
884
|
-
this.widgets = this.widgets.filter((c) => c.__meta__.id !== w.config.__meta__.id);
|
885
|
-
this.cdr.detectChanges();
|
886
|
-
this.calcGridSize();
|
887
|
-
this.emitConfigChanged('remove');
|
888
|
-
});
|
889
|
-
}
|
890
|
-
handleOnSave(e) {
|
891
|
-
this.onWidgetSave.emit(e);
|
892
|
-
}
|
893
|
-
trackByFn(index, item) {
|
894
|
-
var _a, _b;
|
895
|
-
if (!((_a = item['__meta__']) === null || _a === void 0 ? void 0 : _a.id)) {
|
896
|
-
item['__meta__'] = {};
|
897
|
-
item['__meta__'].id = AXHtmlUtil.getUID();
|
898
|
-
}
|
899
|
-
return (_b = item['__meta__']) === null || _b === void 0 ? void 0 : _b.id;
|
900
|
-
}
|
901
|
-
load(widgets) {
|
902
|
-
this.clear();
|
903
|
-
return new Promise((resolve, reject) => {
|
904
|
-
if (widgets) {
|
905
|
-
const loadedWidgets = [];
|
906
|
-
if (typeof widgets === 'string') {
|
907
|
-
try {
|
908
|
-
loadedWidgets.push(...JSON.parse(widgets));
|
909
|
-
this.emitConfigChanged('load');
|
910
|
-
}
|
911
|
-
catch (error) {
|
912
|
-
reject('Invalid widget json data!');
|
913
|
-
}
|
914
|
-
}
|
915
|
-
else {
|
916
|
-
loadedWidgets.push(...widgets);
|
917
|
-
this.emitConfigChanged('load');
|
918
|
-
}
|
919
|
-
let intervalId = -1;
|
920
|
-
const loadFunc = () => {
|
921
|
-
if (this.galleryItems && this.galleryItems.length > 0) {
|
922
|
-
loadedWidgets.forEach(w => {
|
923
|
-
const gitem = this.galleryItems.find(c => c.uniqueName === w.uniqueName);
|
924
|
-
if (gitem) {
|
925
|
-
w.component = gitem.component;
|
926
|
-
if (gitem.props) {
|
927
|
-
w.props = JSON.parse(JSON.stringify(gitem.props));
|
928
|
-
}
|
929
|
-
}
|
930
|
-
});
|
931
|
-
this.widgets.push(...loadedWidgets);
|
932
|
-
this.emitConfigChanged('load');
|
933
|
-
window.clearInterval(intervalId);
|
934
|
-
this.cdr.detectChanges();
|
935
|
-
resolve();
|
936
|
-
}
|
937
|
-
};
|
938
|
-
intervalId = window.setInterval(loadFunc, 200);
|
939
|
-
}
|
940
|
-
else {
|
941
|
-
resolve();
|
942
|
-
}
|
943
|
-
});
|
944
|
-
}
|
945
|
-
clear() {
|
946
|
-
if (this.widgets.length) {
|
947
|
-
this.widgets = [];
|
948
|
-
this.cdr.detectChanges();
|
949
|
-
this.saveSubject.next('clear');
|
950
|
-
}
|
951
|
-
}
|
952
|
-
save() {
|
953
|
-
const obj = this.widgets.map(c => ({
|
954
|
-
uniqueName: c.uniqueName,
|
955
|
-
component: c.component,
|
956
|
-
title: c.title,
|
957
|
-
sizeX: c.sizeX,
|
958
|
-
sizeY: c.sizeY,
|
959
|
-
col: c.col,
|
960
|
-
row: c.row,
|
961
|
-
options: c.options,
|
962
|
-
props: c.props
|
963
|
-
}));
|
964
|
-
return Promise.resolve(JSON.stringify(obj));
|
965
|
-
}
|
966
|
-
refresh() {
|
967
|
-
this.widgetHosts.forEach(host => {
|
968
|
-
host.widget.refresh();
|
969
|
-
});
|
970
|
-
}
|
971
|
-
handleOnConfigChanged(e) {
|
972
|
-
this.cdr.detectChanges();
|
973
|
-
this.saveSubject.next('config');
|
974
|
-
}
|
975
|
-
handleOnResizedChanged(e) {
|
976
|
-
this.detectFirstEmptySlot(e.config);
|
977
|
-
this.cdr.detectChanges();
|
978
|
-
this.saveSubject.next('config');
|
979
|
-
}
|
980
|
-
emitConfigChanged(mode) {
|
981
|
-
this.onConfigChanged.emit({
|
982
|
-
component: this,
|
983
|
-
mode: mode
|
984
|
-
});
|
985
|
-
}
|
986
|
-
}
|
987
|
-
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 });
|
988
|
-
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>\n <ax-widget-host *ngFor=\"let w of widgets;trackBy: trackByFn\" [config]='w' [sizeX]=\"w.sizeX\" [readonly]=\"readonly || w.readonly\"\n [sizeY]=\"w.sizeY\" [col]=\"w.col\" [row]=\"w.row\" (onRemove)=\"handleOnRemove($event)\" (onSave)=\"handleOnSave($event)\"\n (onConfigChanged)=\"handleOnConfigChanged($event)\" (onResized)=\"handleOnResizedChanged($event)\"\n [provideValue]=\"provideValue\">\n </ax-widget-host>\n</div>\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;z-index:0}.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 });
|
989
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardComponent, decorators: [{
|
990
|
-
type: Component,
|
991
|
-
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>\n <ax-widget-host *ngFor=\"let w of widgets;trackBy: trackByFn\" [config]='w' [sizeX]=\"w.sizeX\" [readonly]=\"readonly || w.readonly\"\n [sizeY]=\"w.sizeY\" [col]=\"w.col\" [row]=\"w.row\" (onRemove)=\"handleOnRemove($event)\" (onSave)=\"handleOnSave($event)\"\n (onConfigChanged)=\"handleOnConfigChanged($event)\" (onResized)=\"handleOnResizedChanged($event)\"\n [provideValue]=\"provideValue\">\n </ax-widget-host>\n</div>\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;z-index:0}.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"] }]
|
992
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { container: [{
|
993
|
-
type: ViewChild,
|
994
|
-
args: ['container']
|
995
|
-
}], widgetHosts: [{
|
996
|
-
type: ViewChildren,
|
997
|
-
args: [AXWidgetHostComponent]
|
998
|
-
}], galleryItems: [{
|
999
|
-
type: Input
|
1000
|
-
}], tileSize: [{
|
1001
|
-
type: Input
|
1002
|
-
}], gapSize: [{
|
1003
|
-
type: Input
|
1004
|
-
}], readonly: [{
|
1005
|
-
type: Input
|
1006
|
-
}], provideValue: [{
|
1007
|
-
type: Input
|
1008
|
-
}], onConfigChanged: [{
|
1009
|
-
type: Output
|
1010
|
-
}], onWidgetSave: [{
|
1011
|
-
type: Output
|
1012
|
-
}] } });
|
1013
|
-
|
1014
|
-
class AXWidgetSizePropertyEditorComponent extends AXProperyEditorComponent {
|
1015
|
-
constructor(cdr) {
|
1016
|
-
super(cdr);
|
1017
|
-
this.cdr = cdr;
|
1018
|
-
this.minX = 1;
|
1019
|
-
this.maxX = 10;
|
1020
|
-
this.minY = 1;
|
1021
|
-
this.maxY = 10;
|
1022
|
-
}
|
1023
|
-
ngOnInit() {
|
1024
|
-
if (Array.isArray(this.value)) {
|
1025
|
-
this.sizeX = this.value[0];
|
1026
|
-
this.sizeY = this.value[1];
|
1027
|
-
}
|
1028
|
-
else {
|
1029
|
-
this.sizeX = 2;
|
1030
|
-
this.sizeY = 2;
|
1031
|
-
}
|
1032
|
-
}
|
1033
|
-
handleMinValueChange(e) {
|
1034
|
-
this.sizeX = e.value;
|
1035
|
-
if (this.sizeY > 0) {
|
1036
|
-
super.handleValueChange([this.sizeX, this.sizeY]);
|
1037
|
-
}
|
1038
|
-
}
|
1039
|
-
handleMaxValueChange(e) {
|
1040
|
-
this.sizeY = e.value;
|
1041
|
-
if (this.sizeX > 0) {
|
1042
|
-
super.handleValueChange([this.sizeX, this.sizeY]);
|
1043
|
-
}
|
1044
|
-
}
|
1045
|
-
ngAfterViewInit() {
|
1046
|
-
this.onRenderCompleted.emit();
|
1047
|
-
}
|
1048
|
-
}
|
1049
|
-
AXWidgetSizePropertyEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
1050
|
-
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%;\">\n <ax-number-box (onValueChanged)=\"handleMinValueChange($event)\" [value]=\"sizeX\" [min]=\"minX\" [max]=\"maxX\">\n </ax-number-box>\n <ax-number-box (onValueChanged)=\"handleMaxValueChange($event)\" [value]=\"sizeY\" [min]=\"minY\" [max]=\"maxY\">\n </ax-number-box>\n</div>", components: [{ type: i1.AXNumberBoxComponent, selector: "ax-number-box", inputs: ["min", "max", "showSeparator", "showCurrency", "showCounter", "scrollWeel", "showDoubleCounter", "maxLength", "intStep", "decimalNumber", "customStep"] }] });
|
1051
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorComponent, decorators: [{
|
1052
|
-
type: Component,
|
1053
|
-
args: [{ template: "<div style=\"display: grid;grid-gap: 2%; grid-template-columns: 49% 49%;\">\n <ax-number-box (onValueChanged)=\"handleMinValueChange($event)\" [value]=\"sizeX\" [min]=\"minX\" [max]=\"maxX\">\n </ax-number-box>\n <ax-number-box (onValueChanged)=\"handleMaxValueChange($event)\" [value]=\"sizeY\" [min]=\"minY\" [max]=\"maxY\">\n </ax-number-box>\n</div>" }]
|
1054
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
1055
|
-
|
1056
|
-
class AXWidgetBoardModule {
|
1057
|
-
/**
|
1058
|
-
*
|
1059
|
-
*/
|
1060
|
-
constructor() {
|
1061
|
-
AXTranslator.load('en', {
|
1062
|
-
'widget-board': {
|
1063
|
-
'configurable-props': 'Configurable Properties',
|
1064
|
-
configure: 'Configure Widget'
|
1065
|
-
}
|
1066
|
-
});
|
1067
|
-
AXTranslator.load('fa', {
|
1068
|
-
'widget-board': {
|
1069
|
-
'configurable-props': 'ویژگی های قابل تنظیم',
|
1070
|
-
configure: 'پیکر بندی ابزارک'
|
1071
|
-
}
|
1072
|
-
});
|
1073
|
-
}
|
1074
|
-
}
|
1075
|
-
AXWidgetBoardModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1076
|
-
AXWidgetBoardModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardModule, declarations: [AXWidgetBoardComponent, AXWidgetHostComponent, AXWidgetConfigComponent, AXWidgetSaveComponent], imports: [CommonModule,
|
1077
|
-
AXSearchBoxModule,
|
1078
|
-
AXLoadingModule,
|
1079
|
-
RouterModule,
|
1080
|
-
AXProppertyEditorModule,
|
1081
|
-
AXPageModule,
|
1082
|
-
AXToolbarModule,
|
1083
|
-
AXTranslatorModule,
|
1084
|
-
AXLabelModule,
|
1085
|
-
AXTextAreaModule,
|
1086
|
-
AXFieldsetModule,
|
1087
|
-
AXTextBoxModule,
|
1088
|
-
AXFormGroupModule,
|
1089
|
-
AXTabStripModule,
|
1090
|
-
AXCheckBoxModule,
|
1091
|
-
AXMenuModule,
|
1092
|
-
AXTranslatorModule,
|
1093
|
-
AXValidationModule, i1$2.RouterModule], exports: [AXWidgetBoardComponent, AXProppertyEditorModule] });
|
1094
|
-
AXWidgetBoardModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardModule, providers: [], imports: [[
|
1095
|
-
CommonModule,
|
1096
|
-
AXSearchBoxModule,
|
1097
|
-
AXLoadingModule,
|
1098
|
-
RouterModule,
|
1099
|
-
AXProppertyEditorModule,
|
1100
|
-
AXPageModule,
|
1101
|
-
AXToolbarModule,
|
1102
|
-
AXTranslatorModule,
|
1103
|
-
AXLabelModule,
|
1104
|
-
AXTextAreaModule,
|
1105
|
-
AXFieldsetModule,
|
1106
|
-
AXTextBoxModule,
|
1107
|
-
AXFormGroupModule,
|
1108
|
-
AXTabStripModule,
|
1109
|
-
AXCheckBoxModule,
|
1110
|
-
AXMenuModule,
|
1111
|
-
AXTranslatorModule,
|
1112
|
-
AXValidationModule,
|
1113
|
-
RouterModule.forChild([
|
1114
|
-
{
|
1115
|
-
component: AXWidgetSizePropertyEditorComponent,
|
1116
|
-
path: 'ax/editors/widget-size'
|
1117
|
-
},
|
1118
|
-
])
|
1119
|
-
], AXProppertyEditorModule] });
|
1120
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetBoardModule, decorators: [{
|
1121
|
-
type: NgModule,
|
1122
|
-
args: [{
|
1123
|
-
imports: [
|
1124
|
-
CommonModule,
|
1125
|
-
AXSearchBoxModule,
|
1126
|
-
AXLoadingModule,
|
1127
|
-
RouterModule,
|
1128
|
-
AXProppertyEditorModule,
|
1129
|
-
AXPageModule,
|
1130
|
-
AXToolbarModule,
|
1131
|
-
AXTranslatorModule,
|
1132
|
-
AXLabelModule,
|
1133
|
-
AXTextAreaModule,
|
1134
|
-
AXFieldsetModule,
|
1135
|
-
AXTextBoxModule,
|
1136
|
-
AXFormGroupModule,
|
1137
|
-
AXTabStripModule,
|
1138
|
-
AXCheckBoxModule,
|
1139
|
-
AXMenuModule,
|
1140
|
-
AXTranslatorModule,
|
1141
|
-
AXValidationModule,
|
1142
|
-
RouterModule.forChild([
|
1143
|
-
{
|
1144
|
-
component: AXWidgetSizePropertyEditorComponent,
|
1145
|
-
path: 'ax/editors/widget-size'
|
1146
|
-
},
|
1147
|
-
])
|
1148
|
-
],
|
1149
|
-
exports: [AXWidgetBoardComponent, AXProppertyEditorModule],
|
1150
|
-
declarations: [AXWidgetBoardComponent, AXWidgetHostComponent, AXWidgetConfigComponent, AXWidgetSaveComponent],
|
1151
|
-
providers: []
|
1152
|
-
}]
|
1153
|
-
}], ctorParameters: function () { return []; } });
|
1154
|
-
|
1155
|
-
class AXWidgetSizePropertyEditorModule {
|
1156
|
-
}
|
1157
|
-
AXWidgetSizePropertyEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1158
|
-
AXWidgetSizePropertyEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorModule, declarations: [AXWidgetSizePropertyEditorComponent], imports: [CommonModule, FormsModule, AXNumberBoxModule], exports: [AXWidgetSizePropertyEditorComponent] });
|
1159
|
-
AXWidgetSizePropertyEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorModule, providers: [], imports: [[CommonModule, FormsModule, AXNumberBoxModule]] });
|
1160
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXWidgetSizePropertyEditorModule, decorators: [{
|
1161
|
-
type: NgModule,
|
1162
|
-
args: [{
|
1163
|
-
declarations: [AXWidgetSizePropertyEditorComponent],
|
1164
|
-
imports: [CommonModule, FormsModule, AXNumberBoxModule],
|
1165
|
-
exports: [AXWidgetSizePropertyEditorComponent],
|
1166
|
-
providers: []
|
1167
|
-
}]
|
1168
|
-
}] });
|
1169
|
-
|
1170
|
-
/**
|
1171
|
-
* Generated bundle index. Do not edit.
|
1172
|
-
*/
|
1173
|
-
|
1174
|
-
export { AXWidgetBoardComponent, AXWidgetBoardModule, AXWidgetComponent, AXWidgetHostComponent, AXWidgetSizePropertyEditorComponent, AXWidgetSizePropertyEditorModule };
|
1175
|
-
//# sourceMappingURL=acorex-layout.mjs.map
|