@acorex/platform 0.0.0-ACOREX
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/auth/README.md +3 -0
- package/common/README.md +3 -0
- package/core/README.md +4 -0
- package/fesm2022/acorex-platform-auth.mjs +1362 -0
- package/fesm2022/acorex-platform-auth.mjs.map +1 -0
- package/fesm2022/acorex-platform-common-common-settings.provider-G9XcXXOG.mjs +127 -0
- package/fesm2022/acorex-platform-common-common-settings.provider-G9XcXXOG.mjs.map +1 -0
- package/fesm2022/acorex-platform-common.mjs +4601 -0
- package/fesm2022/acorex-platform-common.mjs.map +1 -0
- package/fesm2022/acorex-platform-core.mjs +4374 -0
- package/fesm2022/acorex-platform-core.mjs.map +1 -0
- package/fesm2022/acorex-platform-domain.mjs +3234 -0
- package/fesm2022/acorex-platform-domain.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-builder.mjs +2847 -0
- package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-components-binding-expression-editor-popup.component-CXEdvDTf.mjs +121 -0
- package/fesm2022/acorex-platform-layout-components-binding-expression-editor-popup.component-CXEdvDTf.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-components.mjs +8583 -0
- package/fesm2022/acorex-platform-layout-components.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-designer.mjs +2474 -0
- package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-entity.mjs +19150 -0
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-views.mjs +1468 -0
- package/fesm2022/acorex-platform-layout-views.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widget-core.mjs +2950 -0
- package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets-button-widget-designer.component-Dy7jF-oD.mjs +72 -0
- package/fesm2022/acorex-platform-layout-widgets-button-widget-designer.component-Dy7jF-oD.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets-file-list-popup.component-9uCkMxcc.mjs +158 -0
- package/fesm2022/acorex-platform-layout-widgets-file-list-popup.component-9uCkMxcc.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets-image-preview.popup-C_EPAvCU.mjs +29 -0
- package/fesm2022/acorex-platform-layout-widgets-image-preview.popup-C_EPAvCU.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets-page-widget-designer.component-D10yO28c.mjs +172 -0
- package/fesm2022/acorex-platform-layout-widgets-page-widget-designer.component-D10yO28c.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets-repeater-widget-column.component-BGQqY5Mw.mjs +111 -0
- package/fesm2022/acorex-platform-layout-widgets-repeater-widget-column.component-BGQqY5Mw.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-edit-popup.component-DmzNTYiS.mjs +274 -0
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-edit-popup.component-DmzNTYiS.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-view-popup.component-BNG_588B.mjs +64 -0
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-view-popup.component-BNG_588B.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets-text-block-widget-designer.component-Vo4fWHtX.mjs +34 -0
- package/fesm2022/acorex-platform-layout-widgets-text-block-widget-designer.component-Vo4fWHtX.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets.mjs +29791 -0
- package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -0
- package/fesm2022/acorex-platform-native.mjs +155 -0
- package/fesm2022/acorex-platform-native.mjs.map +1 -0
- package/fesm2022/acorex-platform-runtime-catalog-command-definition.mjs +20 -0
- package/fesm2022/acorex-platform-runtime-catalog-command-definition.mjs.map +1 -0
- package/fesm2022/acorex-platform-runtime-catalog-query-definition.mjs +20 -0
- package/fesm2022/acorex-platform-runtime-catalog-query-definition.mjs.map +1 -0
- package/fesm2022/acorex-platform-runtime.mjs +899 -0
- package/fesm2022/acorex-platform-runtime.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-Cvvr4HnL.mjs +160 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-Cvvr4HnL.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-TYoLN1Jq.mjs +120 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-TYoLN1Jq.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-C2z5Lq9y.mjs +237 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-C2z5Lq9y.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-error-401.component-C7EYJzSr.mjs +31 -0
- package/fesm2022/acorex-platform-themes-default-error-401.component-C7EYJzSr.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-error-404.component-7MVLMwIa.mjs +25 -0
- package/fesm2022/acorex-platform-themes-default-error-404.component-7MVLMwIa.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-error-offline.component-DR6G8gPC.mjs +19 -0
- package/fesm2022/acorex-platform-themes-default-error-offline.component-DR6G8gPC.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default.mjs +2589 -0
- package/fesm2022/acorex-platform-themes-default.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-shared-icon-chooser-column.component-CqkWJYdv.mjs +55 -0
- package/fesm2022/acorex-platform-themes-shared-icon-chooser-column.component-CqkWJYdv.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-shared-icon-chooser-view.component-BOTuLdWN.mjs +57 -0
- package/fesm2022/acorex-platform-themes-shared-icon-chooser-view.component-BOTuLdWN.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-shared-settings.provider-DSs1o1M6.mjs +168 -0
- package/fesm2022/acorex-platform-themes-shared-settings.provider-DSs1o1M6.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-shared-theme-color-chooser-column.component-CHfrTtol.mjs +65 -0
- package/fesm2022/acorex-platform-themes-shared-theme-color-chooser-column.component-CHfrTtol.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-shared-theme-color-chooser-view.component-BSmvnUVq.mjs +64 -0
- package/fesm2022/acorex-platform-themes-shared-theme-color-chooser-view.component-BSmvnUVq.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-shared.mjs +2125 -0
- package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -0
- package/fesm2022/acorex-platform-workflow.mjs +2501 -0
- package/fesm2022/acorex-platform-workflow.mjs.map +1 -0
- package/fesm2022/acorex-platform.mjs +6 -0
- package/fesm2022/acorex-platform.mjs.map +1 -0
- package/layout/builder/README.md +1578 -0
- package/layout/components/README.md +3 -0
- package/layout/designer/README.md +4 -0
- package/layout/entity/README.md +4 -0
- package/layout/views/README.md +3 -0
- package/layout/widget-core/README.md +4 -0
- package/layout/widgets/README.md +3 -0
- package/native/README.md +4 -0
- package/package.json +103 -0
- package/runtime/README.md +3 -0
- package/themes/default/README.md +3 -0
- package/themes/shared/README.md +3 -0
- package/types/acorex-platform-auth.d.ts +680 -0
- package/types/acorex-platform-common.d.ts +2926 -0
- package/types/acorex-platform-core.d.ts +2896 -0
- package/types/acorex-platform-domain.d.ts +2353 -0
- package/types/acorex-platform-layout-builder.d.ts +926 -0
- package/types/acorex-platform-layout-components.d.ts +2903 -0
- package/types/acorex-platform-layout-designer.d.ts +422 -0
- package/types/acorex-platform-layout-entity.d.ts +3189 -0
- package/types/acorex-platform-layout-views.d.ts +667 -0
- package/types/acorex-platform-layout-widget-core.d.ts +1086 -0
- package/types/acorex-platform-layout-widgets.d.ts +5478 -0
- package/types/acorex-platform-native.d.ts +28 -0
- package/types/acorex-platform-runtime-catalog-command-definition.d.ts +137 -0
- package/types/acorex-platform-runtime-catalog-query-definition.d.ts +125 -0
- package/types/acorex-platform-runtime.d.ts +470 -0
- package/types/acorex-platform-themes-default.d.ts +573 -0
- package/types/acorex-platform-themes-shared.d.ts +170 -0
- package/types/acorex-platform-workflow.d.ts +1806 -0
- package/types/acorex-platform.d.ts +2 -0
- package/workflow/README.md +4 -0
|
@@ -0,0 +1,2474 @@
|
|
|
1
|
+
import * as i2 from '@acorex/components/button';
|
|
2
|
+
import { AXButtonModule } from '@acorex/components/button';
|
|
3
|
+
import * as i1 from '@acorex/components/decorators';
|
|
4
|
+
import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
5
|
+
import * as i1$2 from '@acorex/platform/layout/widget-core';
|
|
6
|
+
import { AXPWidgetRegistryService, AXPWidgetGroupEnum, AXPWidgetsCatalog, AXPLayoutBaseWidgetComponent, AXP_WIDGET_TOKEN, AXPWidgetStatus, AXPValueWidgetComponent, AXPWidgetCoreModule } from '@acorex/platform/layout/widget-core';
|
|
7
|
+
import * as i0 from '@angular/core';
|
|
8
|
+
import { signal, computed, Injectable, inject, effect, ViewEncapsulation, ChangeDetectionStrategy, Component, input, output, EventEmitter, HostBinding, Output, model, HostListener, Injector, NgZone, ViewContainerRef, Directive, ElementRef, ViewChild } from '@angular/core';
|
|
9
|
+
import { AXLoadingDialogService } from '@acorex/components/loading-dialog';
|
|
10
|
+
import { AXPopupService } from '@acorex/components/popup';
|
|
11
|
+
import { AXToastService } from '@acorex/components/toast';
|
|
12
|
+
import { AXFileService } from '@acorex/core/file';
|
|
13
|
+
import { merge, cloneDeep, assign, sortBy, get, set, isNil, isEmpty, orderBy, castArray, uniqBy, isEqual } from 'lodash-es';
|
|
14
|
+
import { Subject, distinctUntilChanged, filter, debounceTime, first, merge as merge$1 } from 'rxjs';
|
|
15
|
+
import { AXPBroadcastEventService, AXPPlatformScope, AXPDataSourceDefinitionProviderService } from '@acorex/platform/core';
|
|
16
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
17
|
+
import * as i2$1 from '@acorex/cdk/common';
|
|
18
|
+
import { AXCommonModule } from '@acorex/cdk/common';
|
|
19
|
+
import { AXBasePageComponent } from '@acorex/components/page';
|
|
20
|
+
import * as i7 from '@acorex/components/search-box';
|
|
21
|
+
import { AXSearchBoxModule } from '@acorex/components/search-box';
|
|
22
|
+
import * as i6 from '@acorex/components/tabs';
|
|
23
|
+
import { AXTabsModule } from '@acorex/components/tabs';
|
|
24
|
+
import { AXPSettingsService, AXPStickyDirective, AXPClipBoardService } from '@acorex/platform/common';
|
|
25
|
+
import { AXPWidgetItemComponent, AXPStateMessageComponent, AXPWidgetPropertyViewerComponent } from '@acorex/platform/layout/components';
|
|
26
|
+
import * as i1$1 from '@angular/common';
|
|
27
|
+
import { CommonModule } from '@angular/common';
|
|
28
|
+
import * as i3 from '@angular/forms';
|
|
29
|
+
import { FormsModule } from '@angular/forms';
|
|
30
|
+
import * as i1$4 from '@acorex/components/button-group';
|
|
31
|
+
import { AXButtonGroupModule } from '@acorex/components/button-group';
|
|
32
|
+
import * as i3$1 from '@acorex/components/drawer';
|
|
33
|
+
import { AXDrawerModule } from '@acorex/components/drawer';
|
|
34
|
+
import * as i4 from '@acorex/components/dropdown';
|
|
35
|
+
import { AXDropdownModule } from '@acorex/components/dropdown';
|
|
36
|
+
import * as i5 from '@acorex/components/dropdown-button';
|
|
37
|
+
import { AXDropdownButtonModule } from '@acorex/components/dropdown-button';
|
|
38
|
+
import * as i2$2 from '@acorex/components/menu';
|
|
39
|
+
import { AXMenuModule } from '@acorex/components/menu';
|
|
40
|
+
import * as i1$3 from '@acorex/components/breadcrumbs';
|
|
41
|
+
import { AXBreadcrumbsModule } from '@acorex/components/breadcrumbs';
|
|
42
|
+
import { AXPWorkflowService } from '@acorex/platform/workflow';
|
|
43
|
+
import { AXUnsubscriber } from '@acorex/core/utils';
|
|
44
|
+
import * as i4$1 from '@acorex/components/json-viewer';
|
|
45
|
+
import { AXJsonViewerModule } from '@acorex/components/json-viewer';
|
|
46
|
+
import { AXSafePipe } from '@acorex/core/pipes';
|
|
47
|
+
|
|
48
|
+
// AddWidgetCommand
|
|
49
|
+
class AddWidgetCommand {
|
|
50
|
+
constructor(widget, parent, previousSelection) {
|
|
51
|
+
this.widget = widget;
|
|
52
|
+
this.parent = parent;
|
|
53
|
+
this.previousSelection = previousSelection;
|
|
54
|
+
}
|
|
55
|
+
execute() {
|
|
56
|
+
this.parent.children = this.parent.children || [];
|
|
57
|
+
this.parent.children.push(this.widget);
|
|
58
|
+
}
|
|
59
|
+
undo() {
|
|
60
|
+
this.parent.children = this.parent.children || [];
|
|
61
|
+
const index = this.parent.children.indexOf(this.widget);
|
|
62
|
+
if (index > -1) {
|
|
63
|
+
this.parent.children.splice(index, 1);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
description() {
|
|
67
|
+
return `Added widget ${this.widget.name}`;
|
|
68
|
+
}
|
|
69
|
+
icon() {
|
|
70
|
+
return `fa-solid fa-square-plus`;
|
|
71
|
+
}
|
|
72
|
+
getExecutionSelection() {
|
|
73
|
+
return this.widget; // After executing, select the newly added widget
|
|
74
|
+
}
|
|
75
|
+
getUndoSelection() {
|
|
76
|
+
return this.previousSelection; // After undo, select the previously selected widget
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
class RemoveWidgetCommand {
|
|
80
|
+
constructor(widget, parent, previousSelection) {
|
|
81
|
+
this.widget = widget;
|
|
82
|
+
this.parent = parent;
|
|
83
|
+
this.previousSelection = previousSelection;
|
|
84
|
+
parent.children = parent.children || [];
|
|
85
|
+
this.index = parent.children.indexOf(widget); // Capture the index for undo purposes
|
|
86
|
+
}
|
|
87
|
+
execute() {
|
|
88
|
+
this.parent.children = this.parent.children || [];
|
|
89
|
+
this.index = this.parent.children.indexOf(this.widget); // Re-assert the index in case it has changed
|
|
90
|
+
this.parent.children.splice(this.index, 1);
|
|
91
|
+
}
|
|
92
|
+
undo() {
|
|
93
|
+
this.parent.children = this.parent.children || [];
|
|
94
|
+
this.parent.children.splice(this.index, 0, this.widget); // Reinsert at the original index
|
|
95
|
+
}
|
|
96
|
+
description() {
|
|
97
|
+
return `Removed widget ${this.widget.name}`;
|
|
98
|
+
}
|
|
99
|
+
icon() {
|
|
100
|
+
return `fa-solid fa-square-minus`;
|
|
101
|
+
}
|
|
102
|
+
getExecutionSelection() {
|
|
103
|
+
return this.previousSelection; // Typically the parent or a nearby sibling could be focused
|
|
104
|
+
}
|
|
105
|
+
getUndoSelection() {
|
|
106
|
+
return this.widget; // Select the widget itself when the operation is undone
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
class UpdateWidgetCommand {
|
|
110
|
+
constructor(widget, values, previousSelection) {
|
|
111
|
+
this.widget = widget;
|
|
112
|
+
this.newState = merge(cloneDeep(widget), values);
|
|
113
|
+
this.previousSelection = previousSelection;
|
|
114
|
+
this.previousState = cloneDeep(widget);
|
|
115
|
+
}
|
|
116
|
+
execute() {
|
|
117
|
+
merge(this.widget, this.newState);
|
|
118
|
+
}
|
|
119
|
+
undo() {
|
|
120
|
+
this.deepPruneAndRestore(this.widget, this.previousState);
|
|
121
|
+
}
|
|
122
|
+
description() {
|
|
123
|
+
return `Updated widget ${this.widget.name}`;
|
|
124
|
+
}
|
|
125
|
+
icon() {
|
|
126
|
+
return `fa-solid fa-pen`;
|
|
127
|
+
}
|
|
128
|
+
getExecutionSelection() {
|
|
129
|
+
return this.widget; // Focus the widget after it's updated
|
|
130
|
+
}
|
|
131
|
+
getUndoSelection() {
|
|
132
|
+
return this.previousSelection; // Restore the focus to where it was before the update
|
|
133
|
+
}
|
|
134
|
+
deepPruneAndRestore(current, original) {
|
|
135
|
+
Object.keys(current).forEach(key => {
|
|
136
|
+
if (original.hasOwnProperty(key)) {
|
|
137
|
+
if (typeof current[key] === 'object' && current[key] !== null && !(current[key] instanceof Array)) {
|
|
138
|
+
this.deepPruneAndRestore(current[key], original[key]);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
delete current[key]; // Remove properties not present in original
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
// Restore the original properties
|
|
146
|
+
merge(current, original);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
class CommandManager {
|
|
150
|
+
constructor() {
|
|
151
|
+
this.undoStack = signal([], ...(ngDevMode ? [{ debugName: "undoStack" }] : /* istanbul ignore next */ []));
|
|
152
|
+
this.currentIndex = signal(-1, ...(ngDevMode ? [{ debugName: "currentIndex" }] : /* istanbul ignore next */ []));
|
|
153
|
+
this.selectedNode = signal(null, ...(ngDevMode ? [{ debugName: "selectedNode" }] : /* istanbul ignore next */ []));
|
|
154
|
+
this.canUndo = computed(() => this.currentIndex() >= 0, ...(ngDevMode ? [{ debugName: "canUndo" }] : /* istanbul ignore next */ []));
|
|
155
|
+
this.canRedo = computed(() => this.currentIndex() < this.undoStack().length - 1, ...(ngDevMode ? [{ debugName: "canRedo" }] : /* istanbul ignore next */ []));
|
|
156
|
+
this.history = computed(() => this.undoStack().map((cmd, index) => ({
|
|
157
|
+
description: cmd.description(),
|
|
158
|
+
icon: cmd.icon(),
|
|
159
|
+
isPast: this.currentIndex() > index,
|
|
160
|
+
isFuture: this.currentIndex() < index,
|
|
161
|
+
isCurrent: this.currentIndex() == index
|
|
162
|
+
})), ...(ngDevMode ? [{ debugName: "history" }] : /* istanbul ignore next */ []));
|
|
163
|
+
}
|
|
164
|
+
executeCommand(command) {
|
|
165
|
+
// Check if the currentIndex is not at the end of the undoStack
|
|
166
|
+
if (this.currentIndex() !== this.undoStack().length - 1) {
|
|
167
|
+
// Remove all commands beyond the current index to discard the "future" commands
|
|
168
|
+
const newUndoStack = this.undoStack().slice(0, this.currentIndex() + 1);
|
|
169
|
+
this.undoStack.set(newUndoStack);
|
|
170
|
+
}
|
|
171
|
+
command.execute();
|
|
172
|
+
this.undoStack.set([...this.undoStack(), command]); // Add the new command to the stack
|
|
173
|
+
this.currentIndex.set(this.undoStack().length - 1); // Update currentIndex to the end of the stack
|
|
174
|
+
this.selectedNode.set(command.getExecutionSelection()); // Update the selected node
|
|
175
|
+
}
|
|
176
|
+
undo() {
|
|
177
|
+
if (this.currentIndex() >= 0) {
|
|
178
|
+
const command = this.undoStack()[this.currentIndex()];
|
|
179
|
+
command.undo();
|
|
180
|
+
this.currentIndex.set(this.currentIndex() - 1);
|
|
181
|
+
if (this.currentIndex() >= 0) {
|
|
182
|
+
this.selectedNode.set(this.undoStack()[this.currentIndex()].getUndoSelection());
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
this.selectedNode.set(null); // No selection if all commands are undone
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
redo() {
|
|
190
|
+
if (this.currentIndex() < this.undoStack().length - 1) {
|
|
191
|
+
this.currentIndex.set(this.currentIndex() + 1);
|
|
192
|
+
const command = this.undoStack()[this.currentIndex()];
|
|
193
|
+
command.execute();
|
|
194
|
+
this.selectedNode.set(command.getExecutionSelection());
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
goToCommand(index) {
|
|
198
|
+
if (index < 0 || index >= this.undoStack().length || index === this.currentIndex()) {
|
|
199
|
+
return; // Out of bounds or already at the desired index
|
|
200
|
+
}
|
|
201
|
+
if (index > this.currentIndex()) {
|
|
202
|
+
// Need to redo until reaching the desired index
|
|
203
|
+
while (this.currentIndex() < index) {
|
|
204
|
+
this.redo();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
// Need to undo until reaching the desired index
|
|
209
|
+
while (this.currentIndex() > index) {
|
|
210
|
+
this.undo();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Optionally update any UI components or state here
|
|
214
|
+
this.selectedNode.set(this.undoStack()[this.currentIndex()].getExecutionSelection());
|
|
215
|
+
}
|
|
216
|
+
clear() {
|
|
217
|
+
this.undoStack.set([]);
|
|
218
|
+
this.currentIndex.set(-1);
|
|
219
|
+
}
|
|
220
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CommandManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
221
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CommandManager, providedIn: 'root' }); }
|
|
222
|
+
}
|
|
223
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CommandManager, decorators: [{
|
|
224
|
+
type: Injectable,
|
|
225
|
+
args: [{
|
|
226
|
+
providedIn: 'root'
|
|
227
|
+
}]
|
|
228
|
+
}] });
|
|
229
|
+
|
|
230
|
+
class AXPDesignerConnector {
|
|
231
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerConnector, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
232
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerConnector }); }
|
|
233
|
+
}
|
|
234
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerConnector, decorators: [{
|
|
235
|
+
type: Injectable
|
|
236
|
+
}] });
|
|
237
|
+
|
|
238
|
+
const AXP_DESIGNER_COPY_MENU = {
|
|
239
|
+
text: 'Copy',
|
|
240
|
+
name: 'copy',
|
|
241
|
+
icon: 'fa-solid fa-copy',
|
|
242
|
+
suffix: {
|
|
243
|
+
text: 'Ctrl+C',
|
|
244
|
+
},
|
|
245
|
+
};
|
|
246
|
+
const AXP_DESIGNER_CLONE_MENU = {
|
|
247
|
+
text: 'Clone',
|
|
248
|
+
name: 'clone',
|
|
249
|
+
icon: 'fa-solid fa-clone',
|
|
250
|
+
suffix: {
|
|
251
|
+
text: 'Ctrl+D',
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
const AXP_DESIGNER_CUT_MENU = {
|
|
255
|
+
text: 'Cut',
|
|
256
|
+
name: 'cut',
|
|
257
|
+
icon: 'fa-solid fa-cut',
|
|
258
|
+
suffix: {
|
|
259
|
+
text: 'Ctrl+X',
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
const AXP_DESIGNER_PASTE_MENU = {
|
|
263
|
+
text: 'Paste',
|
|
264
|
+
name: 'paste',
|
|
265
|
+
icon: 'fa-solid fa-paste',
|
|
266
|
+
suffix: {
|
|
267
|
+
text: 'Ctrl+V',
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
const AXP_DESIGNER_ADD_WIDGET_MENU = {
|
|
271
|
+
text: 'Add Widget',
|
|
272
|
+
name: 'add-widget',
|
|
273
|
+
icon: 'fa-solid fa-plus',
|
|
274
|
+
};
|
|
275
|
+
const AXP_DESIGNER_SELECT_WIDGET_MENU = {
|
|
276
|
+
text: 'Select',
|
|
277
|
+
name: 'select',
|
|
278
|
+
break: true,
|
|
279
|
+
icon: 'fa-solid fa-arrow-pointer',
|
|
280
|
+
};
|
|
281
|
+
const AXP_DESIGNER_DELETE_WIDGET_MENU = {
|
|
282
|
+
text: 'Delete',
|
|
283
|
+
name: 'remove-widget',
|
|
284
|
+
icon: 'fa-solid fa-trash',
|
|
285
|
+
};
|
|
286
|
+
const AXP_DESIGNER_SAVE_AS_WIDGET_MENU = {
|
|
287
|
+
text: 'Save As...',
|
|
288
|
+
name: 'save-as',
|
|
289
|
+
icon: 'fa-solid fa-save',
|
|
290
|
+
};
|
|
291
|
+
function cloneWidgetMenu(item, options) {
|
|
292
|
+
return assign(cloneDeep(item), options);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
class AXPDesignerModes {
|
|
296
|
+
static { this.View = { id: 'view', title: 'View' }; }
|
|
297
|
+
static { this.Design = { id: 'designer', title: 'Designer' }; }
|
|
298
|
+
static { this.Edit = { id: 'edit', title: 'Edit' }; }
|
|
299
|
+
}
|
|
300
|
+
var AXPTemplateLoadingStrategy;
|
|
301
|
+
(function (AXPTemplateLoadingStrategy) {
|
|
302
|
+
AXPTemplateLoadingStrategy["Connector"] = "Connector";
|
|
303
|
+
AXPTemplateLoadingStrategy["Broadcast"] = "Broadcast";
|
|
304
|
+
})(AXPTemplateLoadingStrategy || (AXPTemplateLoadingStrategy = {}));
|
|
305
|
+
const AXPDesignerMessageKeys = {
|
|
306
|
+
Preview: "designer-preview",
|
|
307
|
+
Loaded: "designer-preview-loaded",
|
|
308
|
+
ContextChanged: "designer-preview-context-changed",
|
|
309
|
+
PreviewWindow: "designer-open-preview-window",
|
|
310
|
+
RequestFormContent: "designer-request-form-content",
|
|
311
|
+
ResponseFormContent: "designer-response-form-content",
|
|
312
|
+
SaveForm: 'designer-save-form-content',
|
|
313
|
+
FormSaved: 'designer-form-saved-content',
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
class AXPWidgetPickerService {
|
|
317
|
+
constructor() {
|
|
318
|
+
this.popupService = inject(AXPopupService);
|
|
319
|
+
this.widgetRegistryService = inject(AXPWidgetRegistryService);
|
|
320
|
+
this.translationService = inject(AXTranslationService);
|
|
321
|
+
}
|
|
322
|
+
async showPicker(options) {
|
|
323
|
+
const com = await Promise.resolve().then(function () { return widgetPicker_component; }).then((c) => c.AXPDesignerWidgetPickerComponent);
|
|
324
|
+
const widgets = this.widgetRegistryService.all();
|
|
325
|
+
const filteredWidgets = widgets.filter((c) => options.groups.some((d) => c.groups?.includes(d)));
|
|
326
|
+
//
|
|
327
|
+
const result = await this.popupService.open(com, {
|
|
328
|
+
title: await this.translationService.translateAsync('@form-template-management:designer.components.widget-picker.title'),
|
|
329
|
+
size: 'md',
|
|
330
|
+
closeButton: true,
|
|
331
|
+
data: {
|
|
332
|
+
widgets: sortBy(filteredWidgets, (c) => c.title),
|
|
333
|
+
},
|
|
334
|
+
});
|
|
335
|
+
//
|
|
336
|
+
const selectedWidgets = (result.data?.widgets ?? []);
|
|
337
|
+
return selectedWidgets.map((c) => ({
|
|
338
|
+
type: c.name,
|
|
339
|
+
options: c.options,
|
|
340
|
+
title: c.title,
|
|
341
|
+
meta: c.meta,
|
|
342
|
+
}));
|
|
343
|
+
}
|
|
344
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPWidgetPickerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
345
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPWidgetPickerService, providedIn: 'root' }); }
|
|
346
|
+
}
|
|
347
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPWidgetPickerService, decorators: [{
|
|
348
|
+
type: Injectable,
|
|
349
|
+
args: [{
|
|
350
|
+
providedIn: 'root',
|
|
351
|
+
}]
|
|
352
|
+
}] });
|
|
353
|
+
|
|
354
|
+
class AXPDesignerService {
|
|
355
|
+
#ef;
|
|
356
|
+
constructor() {
|
|
357
|
+
this.popupService = inject(AXPopupService);
|
|
358
|
+
this.toastService = inject(AXToastService);
|
|
359
|
+
this.fileService = inject(AXFileService);
|
|
360
|
+
this.loadingService = inject(AXLoadingDialogService);
|
|
361
|
+
this.widgetRegisteryService = inject(AXPWidgetRegistryService);
|
|
362
|
+
this.connector = inject(AXPDesignerConnector);
|
|
363
|
+
this.eventService = inject(AXPBroadcastEventService);
|
|
364
|
+
this.widgetPickerService = inject(AXPWidgetPickerService);
|
|
365
|
+
this.document = signal(this.createDoc(), ...(ngDevMode ? [{ debugName: "document" }] : /* istanbul ignore next */ []));
|
|
366
|
+
this.currentPageIndex = signal(0, ...(ngDevMode ? [{ debugName: "currentPageIndex" }] : /* istanbul ignore next */ []));
|
|
367
|
+
this.currentPage = signal(this.document().children?.[0], ...(ngDevMode ? [{ debugName: "currentPage" }] : /* istanbul ignore next */ []));
|
|
368
|
+
this.commandManager = inject(CommandManager);
|
|
369
|
+
this.clipboard = signal(null, ...(ngDevMode ? [{ debugName: "clipboard" }] : /* istanbul ignore next */ []));
|
|
370
|
+
//
|
|
371
|
+
this.canCutCopy = computed(() => this.can(this.selectedNode()).copyOrCut, ...(ngDevMode ? [{ debugName: "canCutCopy" }] : /* istanbul ignore next */ []));
|
|
372
|
+
this.canDelete = computed(() => this.can(this.selectedNode()).delete, ...(ngDevMode ? [{ debugName: "canDelete" }] : /* istanbul ignore next */ []));
|
|
373
|
+
this.canInsert = computed(() => this.can(this.selectedNode()).insert, ...(ngDevMode ? [{ debugName: "canInsert" }] : /* istanbul ignore next */ []));
|
|
374
|
+
this.canPaste = computed(() => this.can(this.selectedNode()).paste, ...(ngDevMode ? [{ debugName: "canPaste" }] : /* istanbul ignore next */ []));
|
|
375
|
+
//
|
|
376
|
+
this.history = computed(() => this.commandManager.history(), ...(ngDevMode ? [{ debugName: "history" }] : /* istanbul ignore next */ []));
|
|
377
|
+
this.canUndo = computed(() => this.commandManager.canUndo(), ...(ngDevMode ? [{ debugName: "canUndo" }] : /* istanbul ignore next */ []));
|
|
378
|
+
this.canRedo = computed(() => this.commandManager.canRedo(), ...(ngDevMode ? [{ debugName: "canRedo" }] : /* istanbul ignore next */ []));
|
|
379
|
+
//
|
|
380
|
+
this.canSave = computed(() => this.templateId() != null, ...(ngDevMode ? [{ debugName: "canSave" }] : /* istanbul ignore next */ []));
|
|
381
|
+
this.unsavedChanges = signal(false, ...(ngDevMode ? [{ debugName: "unsavedChanges" }] : /* istanbul ignore next */ []));
|
|
382
|
+
this.breadcrumbs = computed(() => {
|
|
383
|
+
return this.selectedNode() ? this.findBreadcrumbs(this.currentPage(), this.selectedNode()) ?? [] : [];
|
|
384
|
+
}, ...(ngDevMode ? [{ debugName: "breadcrumbs" }] : /* istanbul ignore next */ []));
|
|
385
|
+
this.selectedNode = signal(null, ...(ngDevMode ? [{ debugName: "selectedNode" }] : /* istanbul ignore next */ []));
|
|
386
|
+
this.selectedNodeConfig = computed(() => get(this.selectedNode(), '__meta__.config'), ...(ngDevMode ? [{ debugName: "selectedNodeConfig" }] : /* istanbul ignore next */ []));
|
|
387
|
+
this._focusedNode = null;
|
|
388
|
+
this.focusedNode = () => this._focusedNode;
|
|
389
|
+
this.size = signal('xl', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
390
|
+
this.onSelected = new Subject();
|
|
391
|
+
this.onRefresh = new Subject();
|
|
392
|
+
this.onUpdate = new Subject();
|
|
393
|
+
this.onFocused = new Subject();
|
|
394
|
+
this.templateId = signal(null, ...(ngDevMode ? [{ debugName: "templateId" }] : /* istanbul ignore next */ []));
|
|
395
|
+
this.loadingStrategy = signal(AXPTemplateLoadingStrategy.Connector, ...(ngDevMode ? [{ debugName: "loadingStrategy" }] : /* istanbul ignore next */ []));
|
|
396
|
+
this.#ef = effect(() => {
|
|
397
|
+
this.refresh({ widget: this.currentPage() });
|
|
398
|
+
}, ...(ngDevMode ? [{ debugName: "#ef" }] : /* istanbul ignore next */ []));
|
|
399
|
+
this.can = (widget) => {
|
|
400
|
+
if (!widget) {
|
|
401
|
+
return {
|
|
402
|
+
delete: false,
|
|
403
|
+
copyOrCut: false,
|
|
404
|
+
insert: false,
|
|
405
|
+
paste: false,
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
const config = get(widget, '__meta__.config');
|
|
409
|
+
return {
|
|
410
|
+
delete: widget.type != 'page-layout',
|
|
411
|
+
copyOrCut: widget.type != 'page-layout',
|
|
412
|
+
paste: this.clipboard() != null && config.type == 'container' && config.designer?.canInsert != false,
|
|
413
|
+
insert: config.type == 'container' && config.designer?.canInsert != false,
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
this.eventService.listen(AXPDesignerMessageKeys.Loaded).subscribe(() => {
|
|
417
|
+
this.updatePreview();
|
|
418
|
+
});
|
|
419
|
+
//
|
|
420
|
+
this.eventService.listen(AXPDesignerMessageKeys.PreviewWindow).subscribe(() => {
|
|
421
|
+
this.openPreviewWindow();
|
|
422
|
+
});
|
|
423
|
+
//
|
|
424
|
+
// window.addEventListener("beforeunload", (event) => {
|
|
425
|
+
// console.log("Window is before closing...");
|
|
426
|
+
// // event.preventDefault();
|
|
427
|
+
// // event.returnValue = 'abc'; // Some browsers require this to show the prompt.
|
|
428
|
+
// });
|
|
429
|
+
window.addEventListener("unload", async () => {
|
|
430
|
+
console.log("Window is closing...");
|
|
431
|
+
if (this.unsavedChanges()) {
|
|
432
|
+
this.eventService.publish(AXPDesignerMessageKeys.SaveForm, { id: this.templateId(), success: false });
|
|
433
|
+
}
|
|
434
|
+
this.unsubscribeEvents();
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
register(command) {
|
|
438
|
+
this.select({ widget: command.widget });
|
|
439
|
+
}
|
|
440
|
+
select(command) {
|
|
441
|
+
this.selectedNode.set(command.widget);
|
|
442
|
+
this.onSelected.next(command);
|
|
443
|
+
}
|
|
444
|
+
update(command) {
|
|
445
|
+
const node = command.widget ?? this.selectedNode();
|
|
446
|
+
if (command.mode == 'update' && node) {
|
|
447
|
+
this.commandManager.executeCommand(new UpdateWidgetCommand(node, command.values, node));
|
|
448
|
+
}
|
|
449
|
+
//this.selectedNode.update((c) => merge(node, command.values));
|
|
450
|
+
this.onUpdate.next({ widget: node, values: command.values });
|
|
451
|
+
this.unsavedChanges.set(true);
|
|
452
|
+
this.updatePreview();
|
|
453
|
+
}
|
|
454
|
+
focus(command) {
|
|
455
|
+
if (this._focusedNode != command.widget) {
|
|
456
|
+
this._focusedNode = command.widget;
|
|
457
|
+
this.onFocused.next({ widget: this._focusedNode });
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
refresh(command) {
|
|
461
|
+
this.onRefresh.next({ widget: command.widget });
|
|
462
|
+
this.updatePreview();
|
|
463
|
+
}
|
|
464
|
+
findBreadcrumbs(node, targetNode, breadcrumb = []) {
|
|
465
|
+
// Add the current node to the breadcrumb path
|
|
466
|
+
const currentBreadcrumb = [...breadcrumb, node];
|
|
467
|
+
// Check if the current node is the target node
|
|
468
|
+
if (node === targetNode) {
|
|
469
|
+
return currentBreadcrumb;
|
|
470
|
+
}
|
|
471
|
+
// If the node has children, recursively search them
|
|
472
|
+
if (node.children) {
|
|
473
|
+
for (const child of node.children) {
|
|
474
|
+
const result = this.findBreadcrumbs(child, targetNode, currentBreadcrumb);
|
|
475
|
+
if (result) {
|
|
476
|
+
return result;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
// Return undefined if no match is found
|
|
481
|
+
return undefined;
|
|
482
|
+
}
|
|
483
|
+
async showPicker(currentNode = this.selectedNode()) {
|
|
484
|
+
const widgets = await this.widgetPickerService.showPicker({ groups: [AXPWidgetGroupEnum.FormElement] });
|
|
485
|
+
const result = [];
|
|
486
|
+
if (widgets.length) {
|
|
487
|
+
widgets.forEach((c) => {
|
|
488
|
+
result.push(this.addWidget(currentNode, { type: c.type }));
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
return result;
|
|
492
|
+
}
|
|
493
|
+
new() {
|
|
494
|
+
this.commandManager.clear();
|
|
495
|
+
this.document.set(this.createDoc());
|
|
496
|
+
this.currentPage.set(this.document().children?.[0]);
|
|
497
|
+
this.reRenderPage();
|
|
498
|
+
}
|
|
499
|
+
createDoc() {
|
|
500
|
+
const doc = {
|
|
501
|
+
type: AXPWidgetsCatalog.document,
|
|
502
|
+
children: [this.createPage()],
|
|
503
|
+
name: 'document',
|
|
504
|
+
};
|
|
505
|
+
set(doc, '__meta__.id', this.generateUniqueId());
|
|
506
|
+
return doc;
|
|
507
|
+
}
|
|
508
|
+
createPage() {
|
|
509
|
+
const config = this.widgetRegisteryService.resolve('page-layout');
|
|
510
|
+
const page = {
|
|
511
|
+
type: 'page-layout',
|
|
512
|
+
children: [],
|
|
513
|
+
name: 'page-layout1',
|
|
514
|
+
};
|
|
515
|
+
set(page, '__meta__.id', this.generateUniqueId());
|
|
516
|
+
set(page, '__meta__.config', config);
|
|
517
|
+
return page;
|
|
518
|
+
}
|
|
519
|
+
addNewPage() {
|
|
520
|
+
this.addWidget(this.document(), this.createPage());
|
|
521
|
+
this.goToPage(this.currentPageIndex() + 1);
|
|
522
|
+
}
|
|
523
|
+
removePage(index) {
|
|
524
|
+
const page = this.document().children?.[index];
|
|
525
|
+
this.removeWidget(page);
|
|
526
|
+
this.goToPage(index - 1);
|
|
527
|
+
}
|
|
528
|
+
clonePage(index) {
|
|
529
|
+
const page = this.document().children?.[index];
|
|
530
|
+
this.clone(page);
|
|
531
|
+
this.goToPage((this.document().children?.length ?? 1) - 1);
|
|
532
|
+
}
|
|
533
|
+
goToPage(index) {
|
|
534
|
+
this.currentPageIndex.set(index);
|
|
535
|
+
this.currentPage.set(this.document().children?.[this.currentPageIndex()]);
|
|
536
|
+
this.select({ widget: this.currentPage() });
|
|
537
|
+
}
|
|
538
|
+
reRenderPage() {
|
|
539
|
+
this.currentPage.set({ ...this.currentPage() });
|
|
540
|
+
setTimeout(() => {
|
|
541
|
+
this.refresh({ widget: this.currentPage() });
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
findWidgetById(root, id) {
|
|
545
|
+
if (get(root, '__meta__.id') === id) {
|
|
546
|
+
return root; // Return the root if it matches the ID
|
|
547
|
+
}
|
|
548
|
+
if (!root.children)
|
|
549
|
+
return null;
|
|
550
|
+
for (const child of root.children) {
|
|
551
|
+
const found = this.findWidgetById(child, id);
|
|
552
|
+
if (found) {
|
|
553
|
+
return found; // Return the found child
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
return null; // Node not found
|
|
557
|
+
}
|
|
558
|
+
findParent(id, parent = this.currentPage()) {
|
|
559
|
+
if (!parent.children)
|
|
560
|
+
return null;
|
|
561
|
+
if (parent.children.some((child) => get(child, '__meta__.id') === id)) {
|
|
562
|
+
return parent; // Return this node as it's the parent of the node with the given ID
|
|
563
|
+
}
|
|
564
|
+
for (const child of parent.children) {
|
|
565
|
+
const foundParent = this.findParent(id, child);
|
|
566
|
+
if (foundParent)
|
|
567
|
+
return foundParent;
|
|
568
|
+
}
|
|
569
|
+
return null; // No parent found
|
|
570
|
+
}
|
|
571
|
+
findNearestContainer(node, searchUpward = true) {
|
|
572
|
+
if (searchUpward) {
|
|
573
|
+
let current = node;
|
|
574
|
+
while (current) {
|
|
575
|
+
const config = this.widgetRegisteryService.resolve(current.type);
|
|
576
|
+
if (config && config.type == 'container') {
|
|
577
|
+
return current;
|
|
578
|
+
}
|
|
579
|
+
current = this.findParent(get(current, '__meta__.id')); // Use findParent to navigate upwards
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
// Recursive search to find the first container among children
|
|
584
|
+
if (node.children) {
|
|
585
|
+
for (const child of node.children) {
|
|
586
|
+
const config = this.widgetRegisteryService.resolve(child.type);
|
|
587
|
+
if (config && config.type == 'container') {
|
|
588
|
+
return child;
|
|
589
|
+
}
|
|
590
|
+
const foundContainer = this.findNearestContainer(child, false); // Continue searching downwards
|
|
591
|
+
if (foundContainer)
|
|
592
|
+
return foundContainer;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
return null; // Return null if no container found
|
|
597
|
+
}
|
|
598
|
+
addWidget(currentNode, node) {
|
|
599
|
+
//
|
|
600
|
+
const cloned = cloneDeep(node);
|
|
601
|
+
const config = this.widgetRegisteryService.resolve(node.type);
|
|
602
|
+
//
|
|
603
|
+
this.commandManager.executeCommand(new AddWidgetCommand(cloned, currentNode, currentNode));
|
|
604
|
+
//
|
|
605
|
+
cloned.name = this.generateUniqueName(node.type);
|
|
606
|
+
set(cloned, '__meta__.id', this.generateUniqueId());
|
|
607
|
+
set(cloned, '__meta__.config', config);
|
|
608
|
+
set(cloned, '__meta__.added', true);
|
|
609
|
+
//
|
|
610
|
+
this.reRenderPage();
|
|
611
|
+
//
|
|
612
|
+
this.refresh({ widget: currentNode });
|
|
613
|
+
this.select({ widget: cloned });
|
|
614
|
+
return cloned;
|
|
615
|
+
}
|
|
616
|
+
removeWidget(node = this.selectedNode()) {
|
|
617
|
+
if (node.type === 'document-layout' ||
|
|
618
|
+
(node.type === 'page-layout' && (this.document().children?.length ?? 1) == 1)) {
|
|
619
|
+
console.error('Cannot remove the page node.');
|
|
620
|
+
return; // Prevent removing the root page node or document
|
|
621
|
+
}
|
|
622
|
+
const nodeIdToRemove = get(node, '__meta__.id');
|
|
623
|
+
if (!nodeIdToRemove) {
|
|
624
|
+
throw new Error('Node does not have a valid __meta__.id to identify it for removal.');
|
|
625
|
+
}
|
|
626
|
+
// Find the parent of the node to remove it
|
|
627
|
+
const parent = this.findParent(nodeIdToRemove, this.document());
|
|
628
|
+
if (!parent) {
|
|
629
|
+
throw new Error('Parent node not found. The node might be the root node or does not exist.');
|
|
630
|
+
}
|
|
631
|
+
const previousSelection = this.selectedNode(); // Capture the currently selected node before removal
|
|
632
|
+
const command = new RemoveWidgetCommand(node, parent, previousSelection);
|
|
633
|
+
this.commandManager.executeCommand(command);
|
|
634
|
+
this.refresh({ widget: parent }); // Refresh the UI to reflect changes
|
|
635
|
+
this.select({ widget: parent }); // Select the parent node after removal
|
|
636
|
+
}
|
|
637
|
+
navigateTo(index) {
|
|
638
|
+
this.commandManager.goToCommand(index);
|
|
639
|
+
this.reRenderPage();
|
|
640
|
+
const currentSelection = this.commandManager.selectedNode();
|
|
641
|
+
this.refresh({ widget: this.currentPage() });
|
|
642
|
+
this.select({ widget: currentSelection });
|
|
643
|
+
}
|
|
644
|
+
redo() {
|
|
645
|
+
this.commandManager.redo();
|
|
646
|
+
this.reRenderPage();
|
|
647
|
+
const currentSelection = this.commandManager.selectedNode();
|
|
648
|
+
this.refresh({ widget: this.currentPage() });
|
|
649
|
+
this.select({ widget: currentSelection });
|
|
650
|
+
}
|
|
651
|
+
undo() {
|
|
652
|
+
this.commandManager.undo();
|
|
653
|
+
this.reRenderPage();
|
|
654
|
+
const currentSelection = this.commandManager.selectedNode();
|
|
655
|
+
this.refresh({ widget: this.currentPage() });
|
|
656
|
+
this.select({ widget: currentSelection });
|
|
657
|
+
}
|
|
658
|
+
clearHistory() {
|
|
659
|
+
this.commandManager.clear();
|
|
660
|
+
}
|
|
661
|
+
removeMetaProp(obj) {
|
|
662
|
+
const nodeName = '__meta__';
|
|
663
|
+
// Check if the object is an array
|
|
664
|
+
if (Array.isArray(obj)) {
|
|
665
|
+
return obj.map((item) => this.removeMetaProp(item));
|
|
666
|
+
}
|
|
667
|
+
else if (typeof obj === 'object' && obj !== null) {
|
|
668
|
+
// Create a new object to store the result
|
|
669
|
+
let newObj = {};
|
|
670
|
+
for (let key in obj) {
|
|
671
|
+
// Only add the key if it's not the nodeName we want to remove
|
|
672
|
+
if (key !== nodeName) {
|
|
673
|
+
newObj[key] = this.removeMetaProp(obj[key]);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
return newObj;
|
|
677
|
+
}
|
|
678
|
+
// If the value is not an object or array, return it as is
|
|
679
|
+
return obj;
|
|
680
|
+
}
|
|
681
|
+
async addMetaToNodes(node, processedNodes, progressCallback) {
|
|
682
|
+
// Apply your meta logic here
|
|
683
|
+
const config = this.widgetRegisteryService.resolve(node.type);
|
|
684
|
+
//
|
|
685
|
+
set(node, '__meta__.id', this.generateUniqueId());
|
|
686
|
+
set(node, '__meta__.config', config);
|
|
687
|
+
//
|
|
688
|
+
// Increment the processed node count and update the progress dialog
|
|
689
|
+
processedNodes.count++;
|
|
690
|
+
progressCallback(processedNodes.count);
|
|
691
|
+
// Recursively process child nodes using Promise.all
|
|
692
|
+
if (node.children && node.children.length > 0) {
|
|
693
|
+
node.children = await Promise.all(node.children.map(async (child) => await this.addMetaToNodes(child, processedNodes, progressCallback)));
|
|
694
|
+
}
|
|
695
|
+
return node;
|
|
696
|
+
}
|
|
697
|
+
copy(widget = this.selectedNode()) {
|
|
698
|
+
if (this.can(widget).copyOrCut) {
|
|
699
|
+
this.clipboard.set(cloneDeep(widget)); // Use lodash's cloneDeep to ensure a deep copy
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
cut(widget = this.selectedNode()) {
|
|
703
|
+
if (this.can(widget).copyOrCut) {
|
|
704
|
+
this.copy(widget); // Copy the widget to the clipboard
|
|
705
|
+
this.removeWidget(widget); // Reuse the removeWidget method which should handle undo internally
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
clone(widget = this.selectedNode()) {
|
|
709
|
+
if (!widget)
|
|
710
|
+
return;
|
|
711
|
+
this.copy(widget); // Copy the widget to the clipboard
|
|
712
|
+
if (widget.type == 'page-layout') {
|
|
713
|
+
this.paste(this.document());
|
|
714
|
+
}
|
|
715
|
+
else {
|
|
716
|
+
this.paste(widget);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
paste(parentNode = this.selectedNode() ?? this.currentPage()) {
|
|
720
|
+
if (!this.clipboard() || !this.selectedNode() || !parentNode) {
|
|
721
|
+
console.error('Clipboard is empty or no node is selected.');
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
const newNode = cloneDeep(this.clipboard());
|
|
725
|
+
const nearestContainer = this.findNearestContainer(parentNode, true);
|
|
726
|
+
if (!nearestContainer) {
|
|
727
|
+
console.error('No suitable container found.');
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
//
|
|
731
|
+
if (!nearestContainer.children) {
|
|
732
|
+
nearestContainer.children = [];
|
|
733
|
+
}
|
|
734
|
+
//
|
|
735
|
+
const setNameId = (node) => {
|
|
736
|
+
set(node, 'name', this.generateUniqueName(node.type));
|
|
737
|
+
set(node, '__meta__.id', this.generateUniqueId());
|
|
738
|
+
node.children?.forEach((n) => {
|
|
739
|
+
setNameId(n);
|
|
740
|
+
});
|
|
741
|
+
};
|
|
742
|
+
setNameId(newNode);
|
|
743
|
+
//
|
|
744
|
+
this.commandManager.executeCommand(new AddWidgetCommand(newNode, nearestContainer, nearestContainer));
|
|
745
|
+
//
|
|
746
|
+
setTimeout(() => {
|
|
747
|
+
this.refresh({ widget: nearestContainer }); // Refresh the UI
|
|
748
|
+
this.select({ widget: newNode }); // Select the newly pasted node
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
async save() {
|
|
752
|
+
if (this.templateId()) {
|
|
753
|
+
const content = this.export();
|
|
754
|
+
if (this.loadingStrategy() == AXPTemplateLoadingStrategy.Connector) {
|
|
755
|
+
await this.connector.save(this.templateId(), { json: content });
|
|
756
|
+
this.toastService.success('Your changes saved successfully');
|
|
757
|
+
}
|
|
758
|
+
else {
|
|
759
|
+
const result = await this.eventService.sendAndWaitForResponse(AXPDesignerMessageKeys.SaveForm, { id: this.templateId(), success: true, content });
|
|
760
|
+
if (result.success) {
|
|
761
|
+
this.unsavedChanges.set(false);
|
|
762
|
+
window.close();
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
else {
|
|
767
|
+
this.downloadJson();
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
async saveAs(node = this.document()) {
|
|
771
|
+
const content = this.export(node);
|
|
772
|
+
const result = await this.connector.saveAs({ json: content });
|
|
773
|
+
if (result) {
|
|
774
|
+
this.toastService.success('Your changes saved successfully');
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
export(node = this.document()) {
|
|
778
|
+
const json = this.removeMetaProp(node);
|
|
779
|
+
return JSON.stringify(json);
|
|
780
|
+
}
|
|
781
|
+
downloadJson() {
|
|
782
|
+
// Convert the object to a JSON string
|
|
783
|
+
const jsonStr = this.export();
|
|
784
|
+
// Create a blob object from the JSON string
|
|
785
|
+
const blob = new Blob([jsonStr], { type: 'application/json' });
|
|
786
|
+
// Create a URL for the blob object
|
|
787
|
+
const url = URL.createObjectURL(blob);
|
|
788
|
+
// Create a temporary <a> element to trigger the download
|
|
789
|
+
const a = document.createElement('a');
|
|
790
|
+
a.href = url;
|
|
791
|
+
a.download = 'export.json';
|
|
792
|
+
// Append the <a> element to the document body (necessary for some browsers)
|
|
793
|
+
document.body.appendChild(a);
|
|
794
|
+
// Trigger the download by clicking the <a> element
|
|
795
|
+
a.click();
|
|
796
|
+
// Clean up by revoking the object URL and removing the <a> element
|
|
797
|
+
URL.revokeObjectURL(url);
|
|
798
|
+
document.body.removeChild(a);
|
|
799
|
+
}
|
|
800
|
+
async loadById(id, options = { strategy: AXPTemplateLoadingStrategy.Connector }) {
|
|
801
|
+
let content = null;
|
|
802
|
+
try {
|
|
803
|
+
if (options.strategy == AXPTemplateLoadingStrategy.Connector) {
|
|
804
|
+
content = await this.connector.load(id);
|
|
805
|
+
}
|
|
806
|
+
else {
|
|
807
|
+
content = await this.eventService.sendAndWaitForResponse(AXPDesignerMessageKeys.RequestFormContent, { formId: id }, { timeout: 10000, retries: 3, retryDelay: 1000 });
|
|
808
|
+
}
|
|
809
|
+
if (!isNil(content) && !isEmpty(content)) {
|
|
810
|
+
await this.loadByContent(content);
|
|
811
|
+
}
|
|
812
|
+
this.templateId.set(id);
|
|
813
|
+
this.loadingStrategy.set(options.strategy);
|
|
814
|
+
}
|
|
815
|
+
catch (error) {
|
|
816
|
+
this.toastService.danger(error.message);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
async importJSon() {
|
|
820
|
+
const files = await this.fileService.choose({ multiple: false, accept: 'application/json' });
|
|
821
|
+
if (files && files.length) {
|
|
822
|
+
const file = files[0];
|
|
823
|
+
const content = await file.text();
|
|
824
|
+
await this.loadByContent(content);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
async loadByContent(content) {
|
|
828
|
+
const rootNode = JSON.parse(content);
|
|
829
|
+
const totalNode = this.countTotalNodes(rootNode);
|
|
830
|
+
const processedNodes = { count: 0 };
|
|
831
|
+
const button = {
|
|
832
|
+
text: 'Cancel',
|
|
833
|
+
autofocus: true,
|
|
834
|
+
color: 'primary',
|
|
835
|
+
onClick: (e) => {
|
|
836
|
+
dialog.close();
|
|
837
|
+
},
|
|
838
|
+
};
|
|
839
|
+
const dialog = this.loadingService.show({
|
|
840
|
+
mode: 'determinate',
|
|
841
|
+
title: 'Loading Content',
|
|
842
|
+
progressColor: 'primary',
|
|
843
|
+
text: 'Processing content',
|
|
844
|
+
status: `0 of ${totalNode}`,
|
|
845
|
+
buttons: [button],
|
|
846
|
+
});
|
|
847
|
+
try {
|
|
848
|
+
const root = await this.addMetaToNodes(rootNode, processedNodes, (count) => {
|
|
849
|
+
dialog.setProgressValue(Math.ceil((count / totalNode) * 100));
|
|
850
|
+
dialog.setProgressStatus(`${count} of ${totalNode}`);
|
|
851
|
+
});
|
|
852
|
+
const page = root.children?.[0];
|
|
853
|
+
this.document.set(root);
|
|
854
|
+
this.currentPage.set(page);
|
|
855
|
+
dialog.setProgressColor('success');
|
|
856
|
+
dialog.setProgressText('Content loaded successfully');
|
|
857
|
+
button.text = 'Okay';
|
|
858
|
+
button.color = 'success';
|
|
859
|
+
dialog.setProgressValue(100);
|
|
860
|
+
setTimeout(() => {
|
|
861
|
+
this.reRenderPage();
|
|
862
|
+
dialog.close();
|
|
863
|
+
}, 250);
|
|
864
|
+
}
|
|
865
|
+
catch (error) {
|
|
866
|
+
dialog.setProgressColor('danger');
|
|
867
|
+
dialog.setProgressText(error instanceof Error ? error.message : 'Cannot load content');
|
|
868
|
+
button.text = 'Close';
|
|
869
|
+
button.color = 'danger';
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
countTotalNodes(node) {
|
|
873
|
+
let count = 1; // Count the current node
|
|
874
|
+
if (node.children && node.children.length > 0) {
|
|
875
|
+
count += node.children.reduce((sum, child) => sum + this.countTotalNodes(child), 0);
|
|
876
|
+
}
|
|
877
|
+
return count;
|
|
878
|
+
}
|
|
879
|
+
generateUniqueName(type) {
|
|
880
|
+
// Normalize the type to follow camelCase convention
|
|
881
|
+
const baseName = type.charAt(0).toLowerCase() + type.slice(1);
|
|
882
|
+
let index = 1;
|
|
883
|
+
let uniqueName = `${baseName}${index}`;
|
|
884
|
+
// Gather all existing names to check against
|
|
885
|
+
const existingNames = new Set();
|
|
886
|
+
this.collectAllNames(this.document(), existingNames);
|
|
887
|
+
// Increment the index until a unique name is found
|
|
888
|
+
while (existingNames.has(uniqueName)) {
|
|
889
|
+
index++;
|
|
890
|
+
uniqueName = `${baseName}${index}`;
|
|
891
|
+
}
|
|
892
|
+
return uniqueName;
|
|
893
|
+
}
|
|
894
|
+
generateUniqueId() {
|
|
895
|
+
return Math.random() * Math.pow(10, 18);
|
|
896
|
+
}
|
|
897
|
+
collectAllNames(node, names) {
|
|
898
|
+
if (node.name) {
|
|
899
|
+
names.add(node.name);
|
|
900
|
+
}
|
|
901
|
+
if (node.children) {
|
|
902
|
+
for (const child of node.children) {
|
|
903
|
+
this.collectAllNames(child, names);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
updatePreview() {
|
|
908
|
+
this.eventService.publish(AXPDesignerMessageKeys.Preview, {
|
|
909
|
+
id: this.templateId(),
|
|
910
|
+
document: this.removeMetaProp(this.document())
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
async openPreviewDialog() {
|
|
914
|
+
const com = await Promise.resolve().then(function () { return preview_component; }).then((c) => c.AXPLayoutDesignerPreviewComponent);
|
|
915
|
+
await this.popupService.open(com, {
|
|
916
|
+
header: false,
|
|
917
|
+
size: 'full',
|
|
918
|
+
data: {
|
|
919
|
+
initialSize: this.size(),
|
|
920
|
+
isDialogWindow: true,
|
|
921
|
+
},
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
openPreviewWindow() {
|
|
925
|
+
window.open('/forms/preview', '_blank');
|
|
926
|
+
}
|
|
927
|
+
getContextMenuItems(instance, isRoot = false) {
|
|
928
|
+
const widget = instance;
|
|
929
|
+
const node = widget.node;
|
|
930
|
+
const items = [];
|
|
931
|
+
//
|
|
932
|
+
if (this.can(node).insert) {
|
|
933
|
+
items.push(cloneWidgetMenu(AXP_DESIGNER_ADD_WIDGET_MENU, {
|
|
934
|
+
break: true,
|
|
935
|
+
}));
|
|
936
|
+
}
|
|
937
|
+
//
|
|
938
|
+
items.push(cloneWidgetMenu(AXP_DESIGNER_CLONE_MENU, { disabled: !this.can(node).copyOrCut }));
|
|
939
|
+
items.push(cloneWidgetMenu(AXP_DESIGNER_CUT_MENU, { disabled: !this.can(node).copyOrCut }));
|
|
940
|
+
items.push(cloneWidgetMenu(AXP_DESIGNER_COPY_MENU, { disabled: !this.can(node).copyOrCut }));
|
|
941
|
+
items.push(cloneWidgetMenu(AXP_DESIGNER_PASTE_MENU, { disabled: !this.can(node).paste, break: true }));
|
|
942
|
+
//
|
|
943
|
+
items.push(cloneWidgetMenu(AXP_DESIGNER_DELETE_WIDGET_MENU, { disabled: !this.can(node).delete, break: true }));
|
|
944
|
+
//
|
|
945
|
+
items.push(cloneWidgetMenu(AXP_DESIGNER_SAVE_AS_WIDGET_MENU));
|
|
946
|
+
if (instance.onContextMenu) {
|
|
947
|
+
instance.onContextMenu({ items });
|
|
948
|
+
}
|
|
949
|
+
if (!isRoot) {
|
|
950
|
+
items.forEach(item => {
|
|
951
|
+
item.suffix = undefined;
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
return items;
|
|
955
|
+
}
|
|
956
|
+
async executeCommand(context) {
|
|
957
|
+
const widget = context.instance;
|
|
958
|
+
if (context.instance.executeCommand) {
|
|
959
|
+
const command = {
|
|
960
|
+
name: context.name,
|
|
961
|
+
data: context.data,
|
|
962
|
+
handled: false
|
|
963
|
+
};
|
|
964
|
+
await context.instance.executeCommand(command);
|
|
965
|
+
if (command.handled)
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
switch (context.name) {
|
|
969
|
+
case AXP_DESIGNER_SELECT_WIDGET_MENU.name: {
|
|
970
|
+
this.select({ widget: widget.node });
|
|
971
|
+
break;
|
|
972
|
+
}
|
|
973
|
+
case AXP_DESIGNER_ADD_WIDGET_MENU.name: {
|
|
974
|
+
this.showPicker(widget.node);
|
|
975
|
+
break;
|
|
976
|
+
}
|
|
977
|
+
//
|
|
978
|
+
case AXP_DESIGNER_DELETE_WIDGET_MENU.name: {
|
|
979
|
+
this.removeWidget(widget.node);
|
|
980
|
+
break;
|
|
981
|
+
}
|
|
982
|
+
//
|
|
983
|
+
case AXP_DESIGNER_CLONE_MENU.name: {
|
|
984
|
+
this.clone(widget.node);
|
|
985
|
+
break;
|
|
986
|
+
}
|
|
987
|
+
case AXP_DESIGNER_CUT_MENU.name: {
|
|
988
|
+
this.cut(widget.node);
|
|
989
|
+
break;
|
|
990
|
+
}
|
|
991
|
+
case AXP_DESIGNER_COPY_MENU.name: {
|
|
992
|
+
this.copy(widget.node);
|
|
993
|
+
break;
|
|
994
|
+
}
|
|
995
|
+
case AXP_DESIGNER_PASTE_MENU.name: {
|
|
996
|
+
this.paste(widget.node);
|
|
997
|
+
break;
|
|
998
|
+
}
|
|
999
|
+
//
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
unsubscribeEvents() {
|
|
1003
|
+
this.eventService.unsubscribe(AXPDesignerMessageKeys.Loaded);
|
|
1004
|
+
this.eventService.unsubscribe(AXPDesignerMessageKeys.PreviewWindow);
|
|
1005
|
+
}
|
|
1006
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1007
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerService }); }
|
|
1008
|
+
}
|
|
1009
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerService, decorators: [{
|
|
1010
|
+
type: Injectable
|
|
1011
|
+
}], ctorParameters: () => [] });
|
|
1012
|
+
|
|
1013
|
+
class AXPDesignerAddWidgetButtonComponent {
|
|
1014
|
+
constructor() {
|
|
1015
|
+
this.designerService = inject(AXPDesignerService);
|
|
1016
|
+
this.parent = inject(AXPLayoutBaseWidgetComponent);
|
|
1017
|
+
}
|
|
1018
|
+
async handleClick(e) {
|
|
1019
|
+
e.nativeEvent.stopPropagation();
|
|
1020
|
+
await this.designerService.showPicker(this.parent.node);
|
|
1021
|
+
}
|
|
1022
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerAddWidgetButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1023
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: AXPDesignerAddWidgetButtonComponent, isStandalone: true, selector: "axp-designer-add-widget-button", ngImport: i0, template: `
|
|
1024
|
+
<div class="ax-container">
|
|
1025
|
+
<ax-button [text]="'Add New Element'" (onClick)="handleClick($event)" [look]="'solid'" [color]="'primary'">
|
|
1026
|
+
<ax-icon icon="fa-solid fa-plus"></ax-icon>
|
|
1027
|
+
</ax-button>
|
|
1028
|
+
</div>
|
|
1029
|
+
`, isInline: true, styles: ["axp-designer-add-widget-button .ax-container{margin-left:auto;margin-right:auto;display:flex;justify-content:center;padding:.5rem}\n"], dependencies: [{ kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1030
|
+
}
|
|
1031
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerAddWidgetButtonComponent, decorators: [{
|
|
1032
|
+
type: Component,
|
|
1033
|
+
args: [{ selector: 'axp-designer-add-widget-button', template: `
|
|
1034
|
+
<div class="ax-container">
|
|
1035
|
+
<ax-button [text]="'Add New Element'" (onClick)="handleClick($event)" [look]="'solid'" [color]="'primary'">
|
|
1036
|
+
<ax-icon icon="fa-solid fa-plus"></ax-icon>
|
|
1037
|
+
</ax-button>
|
|
1038
|
+
</div>
|
|
1039
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, imports: [AXButtonModule, AXDecoratorModule], encapsulation: ViewEncapsulation.None, styles: ["axp-designer-add-widget-button .ax-container{margin-left:auto;margin-right:auto;display:flex;justify-content:center;padding:.5rem}\n"] }]
|
|
1040
|
+
}] });
|
|
1041
|
+
|
|
1042
|
+
class AXPDesignerAddWidgetLineButtonComponent {
|
|
1043
|
+
constructor() {
|
|
1044
|
+
this.text = input(...(ngDevMode ? [undefined, { debugName: "text" }] : /* istanbul ignore next */ []));
|
|
1045
|
+
this.onClick = output();
|
|
1046
|
+
}
|
|
1047
|
+
handleClick() {
|
|
1048
|
+
this.onClick.emit();
|
|
1049
|
+
}
|
|
1050
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerAddWidgetLineButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1051
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: AXPDesignerAddWidgetLineButtonComponent, isStandalone: true, selector: "axp-designer-add-widget-line-button", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onClick: "onClick" }, ngImport: i0, template: `
|
|
1052
|
+
<div class="ax-flex ax-items-center ax-py-4 ax-text-xs">
|
|
1053
|
+
<div class="ax-flex-grow ax-border-t-2 ax-border-dashed ax-border-surface"></div>
|
|
1054
|
+
<div class="ax-mx-2 ax-sm ">
|
|
1055
|
+
<ax-button [text]="text()" [look]="'twotone'" class="ax-capitalize" (onClick)="handleClick()">
|
|
1056
|
+
<ax-icon icon="fa-solid fa-plus"></ax-icon>
|
|
1057
|
+
</ax-button>
|
|
1058
|
+
</div>
|
|
1059
|
+
<div class="ax-flex-grow ax-border-t-2 ax-border-dashed ax-border-surface"></div>
|
|
1060
|
+
</div>
|
|
1061
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1062
|
+
}
|
|
1063
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerAddWidgetLineButtonComponent, decorators: [{
|
|
1064
|
+
type: Component,
|
|
1065
|
+
args: [{
|
|
1066
|
+
selector: 'axp-designer-add-widget-line-button',
|
|
1067
|
+
template: `
|
|
1068
|
+
<div class="ax-flex ax-items-center ax-py-4 ax-text-xs">
|
|
1069
|
+
<div class="ax-flex-grow ax-border-t-2 ax-border-dashed ax-border-surface"></div>
|
|
1070
|
+
<div class="ax-mx-2 ax-sm ">
|
|
1071
|
+
<ax-button [text]="text()" [look]="'twotone'" class="ax-capitalize" (onClick)="handleClick()">
|
|
1072
|
+
<ax-icon icon="fa-solid fa-plus"></ax-icon>
|
|
1073
|
+
</ax-button>
|
|
1074
|
+
</div>
|
|
1075
|
+
<div class="ax-flex-grow ax-border-t-2 ax-border-dashed ax-border-surface"></div>
|
|
1076
|
+
</div>
|
|
1077
|
+
`,
|
|
1078
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1079
|
+
imports: [AXButtonModule, AXDecoratorModule],
|
|
1080
|
+
encapsulation: ViewEncapsulation.None
|
|
1081
|
+
}]
|
|
1082
|
+
}], propDecorators: { text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], onClick: [{ type: i0.Output, args: ["onClick"] }] } });
|
|
1083
|
+
|
|
1084
|
+
class AXPDesignerAddWidgetMiniButtonComponent {
|
|
1085
|
+
constructor() {
|
|
1086
|
+
this.designerService = inject(AXPDesignerService);
|
|
1087
|
+
this.parent = inject(AXPLayoutBaseWidgetComponent);
|
|
1088
|
+
this.onClick = new EventEmitter();
|
|
1089
|
+
}
|
|
1090
|
+
async handleClick(e) {
|
|
1091
|
+
e.stopPropagation();
|
|
1092
|
+
const a = this.onClick;
|
|
1093
|
+
if (this.onClick.observed) {
|
|
1094
|
+
this.onClick.emit();
|
|
1095
|
+
}
|
|
1096
|
+
else {
|
|
1097
|
+
await this.designerService.showPicker(this.parent.node);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
get __class() {
|
|
1101
|
+
const cls = {};
|
|
1102
|
+
//
|
|
1103
|
+
cls[`ax-flex`] = true;
|
|
1104
|
+
cls[`ax-w-full`] = true;
|
|
1105
|
+
cls[`ax-h-full`] = true;
|
|
1106
|
+
return cls;
|
|
1107
|
+
}
|
|
1108
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerAddWidgetMiniButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1109
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: AXPDesignerAddWidgetMiniButtonComponent, isStandalone: true, selector: "axp-designer-add-widget-mini-button", outputs: { onClick: "onClick" }, host: { properties: { "class": "this.__class" } }, ngImport: i0, template: `
|
|
1110
|
+
<div class="axp-empty-space">
|
|
1111
|
+
<div class="ax-m-auto ax-py-4 ax-px-8">
|
|
1112
|
+
<div
|
|
1113
|
+
class="ax-flex ax-items-center ax-justify-center ax-size-4 hover:ax-scale-125 ax-cursor-pointer"
|
|
1114
|
+
(click)="handleClick($event)"
|
|
1115
|
+
>
|
|
1116
|
+
<i class="fa-solid fa-plus"></i>
|
|
1117
|
+
</div>
|
|
1118
|
+
</div>
|
|
1119
|
+
</div>
|
|
1120
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: AXButtonModule }, { kind: "ngmodule", type: AXDecoratorModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1121
|
+
}
|
|
1122
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerAddWidgetMiniButtonComponent, decorators: [{
|
|
1123
|
+
type: Component,
|
|
1124
|
+
args: [{
|
|
1125
|
+
selector: 'axp-designer-add-widget-mini-button',
|
|
1126
|
+
template: `
|
|
1127
|
+
<div class="axp-empty-space">
|
|
1128
|
+
<div class="ax-m-auto ax-py-4 ax-px-8">
|
|
1129
|
+
<div
|
|
1130
|
+
class="ax-flex ax-items-center ax-justify-center ax-size-4 hover:ax-scale-125 ax-cursor-pointer"
|
|
1131
|
+
(click)="handleClick($event)"
|
|
1132
|
+
>
|
|
1133
|
+
<i class="fa-solid fa-plus"></i>
|
|
1134
|
+
</div>
|
|
1135
|
+
</div>
|
|
1136
|
+
</div>
|
|
1137
|
+
`,
|
|
1138
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1139
|
+
imports: [AXButtonModule, AXDecoratorModule],
|
|
1140
|
+
encapsulation: ViewEncapsulation.None,
|
|
1141
|
+
}]
|
|
1142
|
+
}], propDecorators: { onClick: [{
|
|
1143
|
+
type: Output
|
|
1144
|
+
}], __class: [{
|
|
1145
|
+
type: HostBinding,
|
|
1146
|
+
args: ['class']
|
|
1147
|
+
}] } });
|
|
1148
|
+
|
|
1149
|
+
class AXPDesignerFlexDrawerComponent {
|
|
1150
|
+
constructor() {
|
|
1151
|
+
this.itemsCount = model(12, { ...(ngDevMode ? { debugName: "itemsCount" } : /* istanbul ignore next */ {}), alias: 'items' });
|
|
1152
|
+
this.onSelect = output();
|
|
1153
|
+
this.items = computed(() => Array.from({ length: this.itemsCount() }).map((v, index) => index + 1), ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
1154
|
+
this.range = signal(0, ...(ngDevMode ? [{ debugName: "range" }] : /* istanbul ignore next */ []));
|
|
1155
|
+
}
|
|
1156
|
+
handleMouseHover(c) {
|
|
1157
|
+
this.range.set(c);
|
|
1158
|
+
}
|
|
1159
|
+
handleClick(c) {
|
|
1160
|
+
this.onSelect.emit(c);
|
|
1161
|
+
}
|
|
1162
|
+
handleMouseLeave(event) {
|
|
1163
|
+
this.range.set(0);
|
|
1164
|
+
}
|
|
1165
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerFlexDrawerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1166
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPDesignerFlexDrawerComponent, isStandalone: true, selector: "axp-designer-flex-drawer", inputs: { itemsCount: { classPropertyName: "itemsCount", publicName: "items", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemsCount: "itemsChange", onSelect: "onSelect" }, host: { listeners: { "mouseleave": "handleMouseLeave($event)" } }, ngImport: i0, template: `
|
|
1167
|
+
<table class="table-picker">
|
|
1168
|
+
<tbody>
|
|
1169
|
+
<tr>
|
|
1170
|
+
@for (c of items(); track $index) {
|
|
1171
|
+
<td (mouseenter)="handleMouseHover(c)" [class.picked]="c <= range()" (click)="handleClick(c)"></td>
|
|
1172
|
+
}
|
|
1173
|
+
</tr>
|
|
1174
|
+
<tr>
|
|
1175
|
+
<td [attr.colspan]="items().length" class="ax-text-center">
|
|
1176
|
+
<small>{{ range() }}</small>
|
|
1177
|
+
</td>
|
|
1178
|
+
</tr>
|
|
1179
|
+
</tbody>
|
|
1180
|
+
</table>
|
|
1181
|
+
`, isInline: true, styles: [":host{width:100%}:host table{width:100%;border-collapse:collapse;--tw-border-spacing-x: 0px;--tw-border-spacing-y: 0px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}:host table td{height:2.5rem;border-width:1px;--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-border-lightest-surface),var(--tw-border-opacity, 1))}:host table td:after{content:\"\";display:block}:host table td.picked{border-width:1px;--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-border-lightest-surface),var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgba(var(--ax-sys-color-primary-100),var(--tw-bg-opacity, 1))}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1182
|
+
}
|
|
1183
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerFlexDrawerComponent, decorators: [{
|
|
1184
|
+
type: Component,
|
|
1185
|
+
args: [{ selector: 'axp-designer-flex-drawer', template: `
|
|
1186
|
+
<table class="table-picker">
|
|
1187
|
+
<tbody>
|
|
1188
|
+
<tr>
|
|
1189
|
+
@for (c of items(); track $index) {
|
|
1190
|
+
<td (mouseenter)="handleMouseHover(c)" [class.picked]="c <= range()" (click)="handleClick(c)"></td>
|
|
1191
|
+
}
|
|
1192
|
+
</tr>
|
|
1193
|
+
<tr>
|
|
1194
|
+
<td [attr.colspan]="items().length" class="ax-text-center">
|
|
1195
|
+
<small>{{ range() }}</small>
|
|
1196
|
+
</td>
|
|
1197
|
+
</tr>
|
|
1198
|
+
</tbody>
|
|
1199
|
+
</table>
|
|
1200
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, imports: [], styles: [":host{width:100%}:host table{width:100%;border-collapse:collapse;--tw-border-spacing-x: 0px;--tw-border-spacing-y: 0px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}:host table td{height:2.5rem;border-width:1px;--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-border-lightest-surface),var(--tw-border-opacity, 1))}:host table td:after{content:\"\";display:block}:host table td.picked{border-width:1px;--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-border-lightest-surface),var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgba(var(--ax-sys-color-primary-100),var(--tw-bg-opacity, 1))}\n"] }]
|
|
1201
|
+
}], propDecorators: { itemsCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }, { type: i0.Output, args: ["itemsChange"] }], onSelect: [{ type: i0.Output, args: ["onSelect"] }], handleMouseLeave: [{
|
|
1202
|
+
type: HostListener,
|
|
1203
|
+
args: ['mouseleave', ['$event']]
|
|
1204
|
+
}] } });
|
|
1205
|
+
|
|
1206
|
+
class AXPDesignerGridDrawerComponent {
|
|
1207
|
+
constructor() {
|
|
1208
|
+
this.rowsCount = model(5, { ...(ngDevMode ? { debugName: "rowsCount" } : /* istanbul ignore next */ {}), alias: 'rows' });
|
|
1209
|
+
this.colsCount = model(12, { ...(ngDevMode ? { debugName: "colsCount" } : /* istanbul ignore next */ {}), alias: 'columns' });
|
|
1210
|
+
this.onSelect = output();
|
|
1211
|
+
this.rows = computed(() => Array.from({ length: this.rowsCount() }).map((v, index) => index + 1), ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
1212
|
+
this.columns = computed(() => Array.from({ length: this.colsCount() }).map((v, index) => index + 1), ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
1213
|
+
this.rangeR = signal(0, ...(ngDevMode ? [{ debugName: "rangeR" }] : /* istanbul ignore next */ []));
|
|
1214
|
+
this.rangeC = signal(0, ...(ngDevMode ? [{ debugName: "rangeC" }] : /* istanbul ignore next */ []));
|
|
1215
|
+
}
|
|
1216
|
+
handleMouseHover(r, c) {
|
|
1217
|
+
this.rangeR.set(r);
|
|
1218
|
+
this.rangeC.set(c);
|
|
1219
|
+
}
|
|
1220
|
+
handleClick(r, c) {
|
|
1221
|
+
this.onSelect.emit({ rows: r, cols: c });
|
|
1222
|
+
}
|
|
1223
|
+
handleMouseLeave(event) {
|
|
1224
|
+
this.rangeR.set(0);
|
|
1225
|
+
this.rangeC.set(0);
|
|
1226
|
+
}
|
|
1227
|
+
get __style() {
|
|
1228
|
+
return {
|
|
1229
|
+
'--cols-width': `${this.colsCount() == 0 ? 0 : 100 / this.colsCount()}%`,
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerGridDrawerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1233
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPDesignerGridDrawerComponent, isStandalone: true, selector: "axp-designer-grid-drawer", inputs: { rowsCount: { classPropertyName: "rowsCount", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, colsCount: { classPropertyName: "colsCount", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rowsCount: "rowsChange", colsCount: "columnsChange", onSelect: "onSelect" }, host: { listeners: { "mouseleave": "handleMouseLeave($event)" }, properties: { "style": "this.__style" } }, ngImport: i0, template: `
|
|
1234
|
+
<table class="table-picker">
|
|
1235
|
+
<tbody>
|
|
1236
|
+
@for (r of rows(); track $index) {
|
|
1237
|
+
<tr>
|
|
1238
|
+
@for (c of columns(); track $index) {
|
|
1239
|
+
<td
|
|
1240
|
+
(mouseenter)="handleMouseHover(r, c)"
|
|
1241
|
+
[class.picked]="c <= rangeC() && r <= rangeR()"
|
|
1242
|
+
(click)="handleClick(r, c)"
|
|
1243
|
+
></td>
|
|
1244
|
+
}
|
|
1245
|
+
</tr>
|
|
1246
|
+
}
|
|
1247
|
+
<tr>
|
|
1248
|
+
<td [attr.colspan]="columns().length" class="ax-text-center">
|
|
1249
|
+
<small>{{ rangeC() }}×{{ rangeR() }}</small>
|
|
1250
|
+
</td>
|
|
1251
|
+
</tr>
|
|
1252
|
+
</tbody>
|
|
1253
|
+
</table>
|
|
1254
|
+
`, isInline: true, styles: [":host table{width:100%;border-collapse:collapse;--tw-border-spacing-x: 0px;--tw-border-spacing-y: 0px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}:host table td{height:2.5rem;border-width:1px;--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-border-lightest-surface),var(--tw-border-opacity, 1));width:var(--cols-width)}:host table td:after{content:\"\";display:block}:host table td.picked{border-width:1px;--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-border-lightest-surface),var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgba(var(--ax-sys-color-primary-100),var(--tw-bg-opacity, 1))}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1255
|
+
}
|
|
1256
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerGridDrawerComponent, decorators: [{
|
|
1257
|
+
type: Component,
|
|
1258
|
+
args: [{ selector: 'axp-designer-grid-drawer', template: `
|
|
1259
|
+
<table class="table-picker">
|
|
1260
|
+
<tbody>
|
|
1261
|
+
@for (r of rows(); track $index) {
|
|
1262
|
+
<tr>
|
|
1263
|
+
@for (c of columns(); track $index) {
|
|
1264
|
+
<td
|
|
1265
|
+
(mouseenter)="handleMouseHover(r, c)"
|
|
1266
|
+
[class.picked]="c <= rangeC() && r <= rangeR()"
|
|
1267
|
+
(click)="handleClick(r, c)"
|
|
1268
|
+
></td>
|
|
1269
|
+
}
|
|
1270
|
+
</tr>
|
|
1271
|
+
}
|
|
1272
|
+
<tr>
|
|
1273
|
+
<td [attr.colspan]="columns().length" class="ax-text-center">
|
|
1274
|
+
<small>{{ rangeC() }}×{{ rangeR() }}</small>
|
|
1275
|
+
</td>
|
|
1276
|
+
</tr>
|
|
1277
|
+
</tbody>
|
|
1278
|
+
</table>
|
|
1279
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, imports: [], styles: [":host table{width:100%;border-collapse:collapse;--tw-border-spacing-x: 0px;--tw-border-spacing-y: 0px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}:host table td{height:2.5rem;border-width:1px;--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-border-lightest-surface),var(--tw-border-opacity, 1));width:var(--cols-width)}:host table td:after{content:\"\";display:block}:host table td.picked{border-width:1px;--tw-border-opacity: 1;border-color:rgba(var(--ax-sys-color-border-lightest-surface),var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgba(var(--ax-sys-color-primary-100),var(--tw-bg-opacity, 1))}\n"] }]
|
|
1280
|
+
}], propDecorators: { rowsCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }, { type: i0.Output, args: ["rowsChange"] }], colsCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }, { type: i0.Output, args: ["columnsChange"] }], onSelect: [{ type: i0.Output, args: ["onSelect"] }], handleMouseLeave: [{
|
|
1281
|
+
type: HostListener,
|
|
1282
|
+
args: ['mouseleave', ['$event']]
|
|
1283
|
+
}], __style: [{
|
|
1284
|
+
type: HostBinding,
|
|
1285
|
+
args: ['style']
|
|
1286
|
+
}] } });
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* Maps AXPDisplayWidgetConfig to generic AXPWidgetItemData
|
|
1290
|
+
*/
|
|
1291
|
+
function mapToWidgetItemData(widget) {
|
|
1292
|
+
return {
|
|
1293
|
+
title: widget.title,
|
|
1294
|
+
description: widget.description,
|
|
1295
|
+
icon: widget.icon ?? 'fa-solid fa-cube',
|
|
1296
|
+
isPinned: widget.pinned,
|
|
1297
|
+
data: widget
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
class AXPDesignerWidgetPickerComponent extends AXBasePageComponent {
|
|
1301
|
+
constructor() {
|
|
1302
|
+
super(...arguments);
|
|
1303
|
+
this.settingsService = inject(AXPSettingsService);
|
|
1304
|
+
this.pinnedSettingKey = 'forms:widgets:picker:pinned';
|
|
1305
|
+
this.searchTerm = model('', ...(ngDevMode ? [{ debugName: "searchTerm" }] : /* istanbul ignore next */ []));
|
|
1306
|
+
// Signals
|
|
1307
|
+
this.widgets = [];
|
|
1308
|
+
this.allWidgets = signal([], ...(ngDevMode ? [{ debugName: "allWidgets" }] : /* istanbul ignore next */ []));
|
|
1309
|
+
this.pinnedWidgets = signal([], ...(ngDevMode ? [{ debugName: "pinnedWidgets" }] : /* istanbul ignore next */ []));
|
|
1310
|
+
this.displayWidgets = computed(() => {
|
|
1311
|
+
return this.allWidgets().map((c) => ({ ...c, pinned: this.pinnedWidgets().includes(c.name) }));
|
|
1312
|
+
}, ...(ngDevMode ? [{ debugName: "displayWidgets" }] : /* istanbul ignore next */ []));
|
|
1313
|
+
// Signal to track selected widgets
|
|
1314
|
+
this.selectedWidgets = signal([], ...(ngDevMode ? [{ debugName: "selectedWidgets" }] : /* istanbul ignore next */ []));
|
|
1315
|
+
// Computed for filtered and ordered widget list
|
|
1316
|
+
this.orderedList = computed(() => {
|
|
1317
|
+
const search = this.searchTerm().toLowerCase();
|
|
1318
|
+
const selectedTabName = this.selectedTab().name;
|
|
1319
|
+
return orderBy(this.displayWidgets().filter((w) => {
|
|
1320
|
+
const matchesTab = selectedTabName === 'all' || castArray(w.categories ?? []).some((c) => c.name === selectedTabName);
|
|
1321
|
+
const matchesSearch = !search || w.title.toLowerCase().includes(search) || w.description?.toLowerCase().includes(search);
|
|
1322
|
+
return matchesTab && matchesSearch;
|
|
1323
|
+
}), ['pinned', 'title'], ['desc', 'asc']);
|
|
1324
|
+
}, ...(ngDevMode ? [{ debugName: "orderedList" }] : /* istanbul ignore next */ []));
|
|
1325
|
+
// Pinned and regular lists
|
|
1326
|
+
this.pinnedList = computed(() => this.orderedList().filter((c) => c.pinned), ...(ngDevMode ? [{ debugName: "pinnedList" }] : /* istanbul ignore next */ []));
|
|
1327
|
+
this.regularList = computed(() => this.orderedList().filter((c) => !c.pinned), ...(ngDevMode ? [{ debugName: "regularList" }] : /* istanbul ignore next */ []));
|
|
1328
|
+
// Mapped data for generic widget items
|
|
1329
|
+
this.pinnedWidgetItems = computed(() => this.pinnedList().map(mapToWidgetItemData), ...(ngDevMode ? [{ debugName: "pinnedWidgetItems" }] : /* istanbul ignore next */ []));
|
|
1330
|
+
this.regularWidgetItems = computed(() => this.regularList().map(mapToWidgetItemData), ...(ngDevMode ? [{ debugName: "regularWidgetItems" }] : /* istanbul ignore next */ []));
|
|
1331
|
+
// Tabs for the widget groups
|
|
1332
|
+
this.categories = computed(() => uniqBy(this.allWidgets()
|
|
1333
|
+
.map((w) => castArray(w.categories ?? []))
|
|
1334
|
+
.filter((c) => c.length > 0)
|
|
1335
|
+
.flat(), 'name'), ...(ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []));
|
|
1336
|
+
this.tabs = computed(() => orderBy([{ name: 'all', title: 'All', order: 0 }, ...this.categories()], (c) => c.order), ...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
|
|
1337
|
+
// computed max visible widgets in a tab
|
|
1338
|
+
this.maxVisibleWidgets = computed(() => Math.max(...this.categories().map((c) => this.allWidgets().filter((w) => castArray(w.categories ?? []).some((c) => c.name === c.name)).length)), ...(ngDevMode ? [{ debugName: "maxVisibleWidgets" }] : /* istanbul ignore next */ []));
|
|
1339
|
+
this.currentTabIndex = signal(0, ...(ngDevMode ? [{ debugName: "currentTabIndex" }] : /* istanbul ignore next */ []));
|
|
1340
|
+
this.selectedTab = computed(() => this.tabs()[this.currentTabIndex()], ...(ngDevMode ? [{ debugName: "selectedTab" }] : /* istanbul ignore next */ []));
|
|
1341
|
+
}
|
|
1342
|
+
async ngOnInit() {
|
|
1343
|
+
super.ngOnInit();
|
|
1344
|
+
this.allWidgets.set(this.widgets);
|
|
1345
|
+
this.pinnedWidgets.set((await this.settingsService.get(this.pinnedSettingKey)) || []);
|
|
1346
|
+
}
|
|
1347
|
+
handleTabChange(event) {
|
|
1348
|
+
const indx = event.index;
|
|
1349
|
+
if (this.currentTabIndex() != indx) {
|
|
1350
|
+
this.currentTabIndex.set(indx);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
handleWidgetClick(clickEvent) {
|
|
1354
|
+
const { event, widget } = clickEvent;
|
|
1355
|
+
const originalWidget = widget.data;
|
|
1356
|
+
if (event.ctrlKey) {
|
|
1357
|
+
const currentSelection = this.selectedWidgets();
|
|
1358
|
+
const isAlreadySelected = currentSelection.some((w) => w === originalWidget);
|
|
1359
|
+
if (isAlreadySelected) {
|
|
1360
|
+
// Deselect widget if already selected
|
|
1361
|
+
this.selectedWidgets.set(currentSelection.filter((w) => w !== originalWidget));
|
|
1362
|
+
}
|
|
1363
|
+
else {
|
|
1364
|
+
// Add widget to selection
|
|
1365
|
+
this.selectedWidgets.set([...currentSelection, originalWidget]);
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
else {
|
|
1369
|
+
// If CTRL is not pressed, select only the clicked widget
|
|
1370
|
+
this.close({ widgets: [originalWidget] });
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
async handleWidgetPinClick(clickEvent) {
|
|
1374
|
+
const { widget } = clickEvent;
|
|
1375
|
+
const originalWidget = widget.data;
|
|
1376
|
+
originalWidget.pinned = !originalWidget.pinned;
|
|
1377
|
+
// Get the current list of pinned widgets from settings
|
|
1378
|
+
let pinnedWidgets = (await this.settingsService.get(this.pinnedSettingKey)) || [];
|
|
1379
|
+
// Update the list of pinned widgets based on the pinned status
|
|
1380
|
+
if (originalWidget.pinned) {
|
|
1381
|
+
if (!pinnedWidgets.includes(originalWidget.name)) {
|
|
1382
|
+
pinnedWidgets.push(originalWidget.name);
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
else {
|
|
1386
|
+
pinnedWidgets = pinnedWidgets.filter((name) => name !== originalWidget.name);
|
|
1387
|
+
}
|
|
1388
|
+
// Save the updated list of pinned widgets
|
|
1389
|
+
await this.settingsService.scope(AXPPlatformScope.User).set(this.pinnedSettingKey, pinnedWidgets);
|
|
1390
|
+
// Trigger a re-render of the widgets
|
|
1391
|
+
this.pinnedWidgets.set(pinnedWidgets);
|
|
1392
|
+
}
|
|
1393
|
+
// Check if a widget is selected
|
|
1394
|
+
isWidgetSelected(widget) {
|
|
1395
|
+
return this.selectedWidgets().includes(widget);
|
|
1396
|
+
}
|
|
1397
|
+
// Check if a generic widget item is selected
|
|
1398
|
+
isWidgetItemSelected(widgetItem) {
|
|
1399
|
+
const originalWidget = widgetItem.data;
|
|
1400
|
+
return this.isWidgetSelected(originalWidget);
|
|
1401
|
+
}
|
|
1402
|
+
handleConfirmSelection() {
|
|
1403
|
+
this.close({ widgets: this.selectedWidgets() });
|
|
1404
|
+
}
|
|
1405
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerWidgetPickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1406
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPDesignerWidgetPickerComponent, isStandalone: true, selector: "ng-component", inputs: { searchTerm: { classPropertyName: "searchTerm", publicName: "searchTerm", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { searchTerm: "searchTermChange" }, usesInheritance: true, ngImport: i0, template: "<div class=\"ax-flex ax-flex-col ax-h-[95vh]\"\n [ngClass]=\"{ 'lg:ax-h-[75vh]': maxVisibleWidgets() > 10, 'lg:ax-h-[50vh]': maxVisibleWidgets() <= 10 }\">\n <div>\n <ax-tabs [look]=\"'with-line'\" (onActiveTabChanged)=\"handleTabChange($event)\">\n @for(w of tabs();track $index) {\n <ax-tab-item [text]=\"w.title\" [key]=\"$index.toString()\" [active]=\"currentTabIndex() === $index\"></ax-tab-item>\n }\n </ax-tabs>\n </div>\n <div class=\"ax-overflow-auto\" #content>\n <div class=\"ax-p-4 ax-sticky ax-top-0 ax-z-10 ax-transition-all\" #sticky=\"axpSticky\"\n [axpSticky]=\"'ax-bg-lightest ax-shadow-xl'\" [stickyParent]=\"content\" [stickyOffset]=\"10\">\n <ax-search-box look=\"fill\" placeholder=\"e.g. Button, Text, ...\" [(ngModel)]=\"searchTerm\" [delayTime]=\"300\"\n [axAutoFocus]=\"true\">\n <ax-clear-button></ax-clear-button>\n </ax-search-box>\n </div>\n <div class=\"ax-flex ax-flex-col ax-p-4 ax-pt-0\">\n <div class=\"ax-grid ax-grid-cols-2 ax-gap-2\">\n @for(widgetItem of pinnedWidgetItems();track widgetItem.title) {\n <axp-widget-item [widget]=\"widgetItem\" [isSelected]=\"isWidgetItemSelected(widgetItem)\"\n (onWidgetClick)=\"handleWidgetClick($event)\" (onPinClick)=\"handleWidgetPinClick($event)\">\n </axp-widget-item>\n }\n </div>\n @if(pinnedWidgetItems().length) {\n <hr class=\"ax-my-4 ax-border-dashed\" />\n }\n <div class=\"ax-grid ax-grid-cols-2 ax-gap-2\">\n @for(widgetItem of regularWidgetItems();track widgetItem.title) {\n <axp-widget-item [widget]=\"widgetItem\" [isSelected]=\"isWidgetItemSelected(widgetItem)\"\n (onWidgetClick)=\"handleWidgetClick($event)\" (onPinClick)=\"handleWidgetPinClick($event)\">\n </axp-widget-item>\n }\n </div>\n </div>\n </div>\n</div>\n@if(selectedWidgets().length) {\n<ax-footer>\n <ax-suffix>\n <ax-button look=\"solid\" color=\"primary\" text=\"{{ selectedWidgets().length }} Selected\"\n (onClick)=\"handleConfirmSelection()\"></ax-button>\n </ax-suffix>\n</ax-footer>\n}", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: AXCommonModule }, { kind: "directive", type: i2$1.AXAutoFocusDirective, selector: "[axAutoFocus]", inputs: ["axAutoFocus", "axAutoFocusTime"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorClearButtonComponent, selector: "ax-clear-button", inputs: ["icon"] }, { kind: "component", type: i1.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXTabsModule }, { kind: "component", type: i6.AXTabsComponent, selector: "ax-tabs", inputs: ["look", "location", "fitParent", "minWidth", "content"], outputs: ["onActiveTabChanged"] }, { kind: "component", type: i6.AXTabItemComponent, selector: "ax-tab-item", inputs: ["disabled", "text", "key", "headerTemplate", "active"], outputs: ["disabledChange", "onClick", "onBlur", "onFocus", "activeChange"] }, { kind: "ngmodule", type: AXSearchBoxModule }, { kind: "component", type: i7.AXSearchBoxComponent, selector: "ax-search-box", inputs: ["disabled", "readonly", "tabIndex", "placeholder", "value", "state", "name", "id", "look", "class", "delayTime", "type", "autoSearch"], outputs: ["valueChange", "stateChange", "onValueChanged", "onBlur", "onFocus", "readonlyChange", "disabledChange", "onKeyDown", "onKeyUp", "onKeyPress"] }, { kind: "directive", type: AXPStickyDirective, selector: "[axpSticky]", inputs: ["axpSticky", "stickyOffset", "stickyParent", "stickyTarget"], outputs: ["isStickyChange"], exportAs: ["axpSticky"] }, { kind: "component", type: AXPWidgetItemComponent, selector: "axp-widget-item", inputs: ["widget", "isSelected", "showPinButton", "customClasses"], outputs: ["onWidgetClick", "onPinClick"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1407
|
+
}
|
|
1408
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerWidgetPickerComponent, decorators: [{
|
|
1409
|
+
type: Component,
|
|
1410
|
+
args: [{ imports: [
|
|
1411
|
+
CommonModule,
|
|
1412
|
+
AXCommonModule,
|
|
1413
|
+
FormsModule,
|
|
1414
|
+
AXButtonModule,
|
|
1415
|
+
AXDecoratorModule,
|
|
1416
|
+
AXTabsModule,
|
|
1417
|
+
AXSearchBoxModule,
|
|
1418
|
+
AXPStickyDirective,
|
|
1419
|
+
AXPWidgetItemComponent,
|
|
1420
|
+
], encapsulation: ViewEncapsulation.None, template: "<div class=\"ax-flex ax-flex-col ax-h-[95vh]\"\n [ngClass]=\"{ 'lg:ax-h-[75vh]': maxVisibleWidgets() > 10, 'lg:ax-h-[50vh]': maxVisibleWidgets() <= 10 }\">\n <div>\n <ax-tabs [look]=\"'with-line'\" (onActiveTabChanged)=\"handleTabChange($event)\">\n @for(w of tabs();track $index) {\n <ax-tab-item [text]=\"w.title\" [key]=\"$index.toString()\" [active]=\"currentTabIndex() === $index\"></ax-tab-item>\n }\n </ax-tabs>\n </div>\n <div class=\"ax-overflow-auto\" #content>\n <div class=\"ax-p-4 ax-sticky ax-top-0 ax-z-10 ax-transition-all\" #sticky=\"axpSticky\"\n [axpSticky]=\"'ax-bg-lightest ax-shadow-xl'\" [stickyParent]=\"content\" [stickyOffset]=\"10\">\n <ax-search-box look=\"fill\" placeholder=\"e.g. Button, Text, ...\" [(ngModel)]=\"searchTerm\" [delayTime]=\"300\"\n [axAutoFocus]=\"true\">\n <ax-clear-button></ax-clear-button>\n </ax-search-box>\n </div>\n <div class=\"ax-flex ax-flex-col ax-p-4 ax-pt-0\">\n <div class=\"ax-grid ax-grid-cols-2 ax-gap-2\">\n @for(widgetItem of pinnedWidgetItems();track widgetItem.title) {\n <axp-widget-item [widget]=\"widgetItem\" [isSelected]=\"isWidgetItemSelected(widgetItem)\"\n (onWidgetClick)=\"handleWidgetClick($event)\" (onPinClick)=\"handleWidgetPinClick($event)\">\n </axp-widget-item>\n }\n </div>\n @if(pinnedWidgetItems().length) {\n <hr class=\"ax-my-4 ax-border-dashed\" />\n }\n <div class=\"ax-grid ax-grid-cols-2 ax-gap-2\">\n @for(widgetItem of regularWidgetItems();track widgetItem.title) {\n <axp-widget-item [widget]=\"widgetItem\" [isSelected]=\"isWidgetItemSelected(widgetItem)\"\n (onWidgetClick)=\"handleWidgetClick($event)\" (onPinClick)=\"handleWidgetPinClick($event)\">\n </axp-widget-item>\n }\n </div>\n </div>\n </div>\n</div>\n@if(selectedWidgets().length) {\n<ax-footer>\n <ax-suffix>\n <ax-button look=\"solid\" color=\"primary\" text=\"{{ selectedWidgets().length }} Selected\"\n (onClick)=\"handleConfirmSelection()\"></ax-button>\n </ax-suffix>\n</ax-footer>\n}" }]
|
|
1421
|
+
}], propDecorators: { searchTerm: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchTerm", required: false }] }, { type: i0.Output, args: ["searchTermChange"] }] } });
|
|
1422
|
+
|
|
1423
|
+
var widgetPicker_component = /*#__PURE__*/Object.freeze({
|
|
1424
|
+
__proto__: null,
|
|
1425
|
+
AXPDesignerWidgetPickerComponent: AXPDesignerWidgetPickerComponent
|
|
1426
|
+
});
|
|
1427
|
+
|
|
1428
|
+
class AXPWidgetDesignerRendererDirective {
|
|
1429
|
+
/**
|
|
1430
|
+
* @ignore
|
|
1431
|
+
*/
|
|
1432
|
+
constructor() {
|
|
1433
|
+
this.mergedOptions = signal({}, ...(ngDevMode ? [{ debugName: "mergedOptions" }] : /* istanbul ignore next */ []));
|
|
1434
|
+
this.injector = inject(Injector);
|
|
1435
|
+
this.widgetRegistry = inject(AXPWidgetRegistryService);
|
|
1436
|
+
this.zone = inject(NgZone);
|
|
1437
|
+
this.isLoading = signal(true, ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
|
|
1438
|
+
this.isLoadingComponent = false;
|
|
1439
|
+
this.currentNodeId = null;
|
|
1440
|
+
this.service = inject(AXPDesignerService);
|
|
1441
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
|
1442
|
+
this.parentNode = input(...(ngDevMode ? [undefined, { debugName: "parentNode" }] : /* istanbul ignore next */ []));
|
|
1443
|
+
this.parentElement = input(...(ngDevMode ? [undefined, { debugName: "parentElement" }] : /* istanbul ignore next */ []));
|
|
1444
|
+
this.parentComponent = input(...(ngDevMode ? [undefined, { debugName: "parentComponent" }] : /* istanbul ignore next */ []));
|
|
1445
|
+
this.index = input(...(ngDevMode ? [undefined, { debugName: "index" }] : /* istanbul ignore next */ []));
|
|
1446
|
+
this.locked = input(false, ...(ngDevMode ? [{ debugName: "locked" }] : /* istanbul ignore next */ []));
|
|
1447
|
+
this.mode = input.required(...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
1448
|
+
this.node = input.required(...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
|
|
1449
|
+
this.hostElement = () => this.instance?.host;
|
|
1450
|
+
this.getId = (w) => get(w, '__meta__.id');
|
|
1451
|
+
this.isCurrentWidget = (w) => this.getId(w) == this.getId(this.node());
|
|
1452
|
+
this.subs = [];
|
|
1453
|
+
this.subs[0] = this.service.onUpdate
|
|
1454
|
+
.pipe(
|
|
1455
|
+
//debounceTime(time),
|
|
1456
|
+
distinctUntilChanged((p, c) => this.getId(p.widget) == this.getId(c.widget) && isEqual(p.values?.options, c.values?.options)), filter((c) => this.isCurrentWidget(c.widget) && !this.locked()))
|
|
1457
|
+
.subscribe((c) => {
|
|
1458
|
+
this.applyOptions(c.values?.options);
|
|
1459
|
+
});
|
|
1460
|
+
//
|
|
1461
|
+
this.subs[1] = this.service.onSelected
|
|
1462
|
+
.pipe(distinctUntilChanged((p, c) => this.getId(p.widget) == this.getId(c.widget)))
|
|
1463
|
+
.subscribe((c) => {
|
|
1464
|
+
this.zone.runOutsideAngular(() => {
|
|
1465
|
+
if (this.isCurrentWidget(c.widget) && !this.locked()) {
|
|
1466
|
+
this.applySelectedStyle();
|
|
1467
|
+
}
|
|
1468
|
+
else {
|
|
1469
|
+
this.removeSelectedStyle();
|
|
1470
|
+
}
|
|
1471
|
+
});
|
|
1472
|
+
});
|
|
1473
|
+
//
|
|
1474
|
+
this.subs[2] = this.service.onFocused
|
|
1475
|
+
.pipe(distinctUntilChanged((p, c) => !isNil(p.widget) && !isNil(c.widget) && this.getId(p.widget) == this.getId(c.widget)))
|
|
1476
|
+
.subscribe((c) => {
|
|
1477
|
+
if (c.widget && this.isCurrentWidget(c.widget)) {
|
|
1478
|
+
this.addOverlay();
|
|
1479
|
+
}
|
|
1480
|
+
else {
|
|
1481
|
+
this.removeOverlay();
|
|
1482
|
+
}
|
|
1483
|
+
});
|
|
1484
|
+
//
|
|
1485
|
+
this.subs[3] = this.service.onRefresh
|
|
1486
|
+
.pipe(debounceTime(200), filter((c) => this.isCurrentWidget(c.widget)))
|
|
1487
|
+
.subscribe((c) => {
|
|
1488
|
+
this.instance?.setChildren(this.node().children ?? []);
|
|
1489
|
+
});
|
|
1490
|
+
//
|
|
1491
|
+
}
|
|
1492
|
+
// Detect input changes
|
|
1493
|
+
ngOnChanges(changes) {
|
|
1494
|
+
if (changes['mode'] || changes['node']) {
|
|
1495
|
+
const nodeId = this.getId(this.node()) || null;
|
|
1496
|
+
const modeChanged = changes['mode']?.currentValue !== changes['mode']?.previousValue;
|
|
1497
|
+
const nodeChanged = changes['node'] && nodeId !== this.currentNodeId;
|
|
1498
|
+
// Only load if there's an actual change and we're not already loading
|
|
1499
|
+
//if ((modeChanged || nodeChanged) && !this.isLoadingComponent) {
|
|
1500
|
+
this.loadComponent();
|
|
1501
|
+
//}
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
ngOnDestroy() {
|
|
1505
|
+
this.subs.forEach((s) => {
|
|
1506
|
+
s.unsubscribe();
|
|
1507
|
+
});
|
|
1508
|
+
// Clear loading state and reset tracking variables
|
|
1509
|
+
this.isLoadingComponent = false;
|
|
1510
|
+
this.currentNodeId = null;
|
|
1511
|
+
this.isLoading.set(false);
|
|
1512
|
+
// Clear view container
|
|
1513
|
+
this.viewContainerRef.clear();
|
|
1514
|
+
}
|
|
1515
|
+
async loadComponent() {
|
|
1516
|
+
// Prevent duplicate loading
|
|
1517
|
+
if (this.isLoadingComponent) {
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
1520
|
+
try {
|
|
1521
|
+
this.isLoadingComponent = true;
|
|
1522
|
+
const nodeId = this.getId(this.node()) || null;
|
|
1523
|
+
// Skip if already loaded for the same node and mode
|
|
1524
|
+
// if (this.currentNodeId === nodeId && this.instance) {
|
|
1525
|
+
// this.isLoadingComponent = false;
|
|
1526
|
+
// return;
|
|
1527
|
+
// }
|
|
1528
|
+
this.viewContainerRef.clear();
|
|
1529
|
+
this.isLoading.set(true);
|
|
1530
|
+
this.currentNodeId = nodeId;
|
|
1531
|
+
this.config = this.widgetRegistry.resolve(this.node().type);
|
|
1532
|
+
//
|
|
1533
|
+
const props = [...(this.config?.properties ?? []), ...(this.config?.components[this.mode()]?.properties ?? [])]
|
|
1534
|
+
?.filter((c) => c.schema.defaultValue != null)
|
|
1535
|
+
.map((c) => ({ [c.name]: cloneDeep(c.schema.defaultValue) }))
|
|
1536
|
+
.reduce((acc, curr) => {
|
|
1537
|
+
return { ...acc, ...curr };
|
|
1538
|
+
}, {});
|
|
1539
|
+
//
|
|
1540
|
+
this.mergedOptions.set(merge(props, this.node().options) || {});
|
|
1541
|
+
this.preprocessAndInitialOptions(cloneDeep(this.node().options));
|
|
1542
|
+
const tokenValue = {
|
|
1543
|
+
node: this.node(),
|
|
1544
|
+
options: this.mergedOptions(),
|
|
1545
|
+
config: this.config,
|
|
1546
|
+
defaultValue: cloneDeep(this.node().defaultValue),
|
|
1547
|
+
};
|
|
1548
|
+
const token = Injector.create({
|
|
1549
|
+
parent: this.injector,
|
|
1550
|
+
providers: [
|
|
1551
|
+
{
|
|
1552
|
+
provide: AXP_WIDGET_TOKEN,
|
|
1553
|
+
useValue: tokenValue,
|
|
1554
|
+
},
|
|
1555
|
+
],
|
|
1556
|
+
});
|
|
1557
|
+
var com = await this.config?.components[this.mode()]?.component();
|
|
1558
|
+
this.instance = this.viewContainerRef.createComponent(com, { injector: token }).instance;
|
|
1559
|
+
this.instance.locked = this.locked();
|
|
1560
|
+
this.instance.parent = this.parentNode();
|
|
1561
|
+
this.instance.parentElement = this.parentElement();
|
|
1562
|
+
this.instance.parentComponent = this.parentComponent();
|
|
1563
|
+
this.instance.index = this.index();
|
|
1564
|
+
this.instance.mode = this.mode();
|
|
1565
|
+
//
|
|
1566
|
+
this.instance.onStatusChanged
|
|
1567
|
+
.pipe(filter((c) => c == AXPWidgetStatus.Rendered), first())
|
|
1568
|
+
.subscribe(() => {
|
|
1569
|
+
const host = this.hostElement();
|
|
1570
|
+
set(host, '__meta__.renderer', this);
|
|
1571
|
+
set(host, '__meta__.instance', this.instance);
|
|
1572
|
+
host.classList.add('axp-widget-host');
|
|
1573
|
+
if (this.mode() == 'designer') {
|
|
1574
|
+
if (!this.locked()) {
|
|
1575
|
+
host.addEventListener('mouseover', (e) => {
|
|
1576
|
+
e.stopPropagation();
|
|
1577
|
+
this.addOverlay();
|
|
1578
|
+
this.focus();
|
|
1579
|
+
});
|
|
1580
|
+
host.addEventListener('mouseleave', (e) => {
|
|
1581
|
+
e.stopPropagation();
|
|
1582
|
+
this.removeOverlay();
|
|
1583
|
+
this.blur();
|
|
1584
|
+
});
|
|
1585
|
+
host.addEventListener('click', (e) => {
|
|
1586
|
+
e.stopPropagation();
|
|
1587
|
+
this.applySelectedStyle();
|
|
1588
|
+
this.service.select({ widget: this.node() });
|
|
1589
|
+
});
|
|
1590
|
+
this.service.register({
|
|
1591
|
+
config: this.config,
|
|
1592
|
+
id: get(this.node(), '__meta__.id'),
|
|
1593
|
+
instance: this.instance,
|
|
1594
|
+
widget: this.node(),
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
this.isLoading.set(false);
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
catch (error) {
|
|
1602
|
+
console.error('Error loading component:', error);
|
|
1603
|
+
this.isLoading.set(false);
|
|
1604
|
+
}
|
|
1605
|
+
finally {
|
|
1606
|
+
this.isLoadingComponent = false;
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
select() {
|
|
1610
|
+
if (this.locked())
|
|
1611
|
+
return;
|
|
1612
|
+
//
|
|
1613
|
+
this.service.select({ widget: this.node() });
|
|
1614
|
+
this.applySelectedStyle();
|
|
1615
|
+
}
|
|
1616
|
+
focus() {
|
|
1617
|
+
if (this.locked())
|
|
1618
|
+
return;
|
|
1619
|
+
//
|
|
1620
|
+
this.service.focus({ widget: this.node() });
|
|
1621
|
+
}
|
|
1622
|
+
blur() {
|
|
1623
|
+
if (this.locked())
|
|
1624
|
+
return;
|
|
1625
|
+
//
|
|
1626
|
+
this.service.focus({ widget: null });
|
|
1627
|
+
}
|
|
1628
|
+
applySelectedStyle() {
|
|
1629
|
+
if (this.locked())
|
|
1630
|
+
return;
|
|
1631
|
+
//
|
|
1632
|
+
this.hostElement()?.classList.add('axp-state-selected');
|
|
1633
|
+
this.hostElement()?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
1634
|
+
}
|
|
1635
|
+
removeSelectedStyle() {
|
|
1636
|
+
this.hostElement()?.classList.remove('axp-state-selected');
|
|
1637
|
+
}
|
|
1638
|
+
addOverlay() {
|
|
1639
|
+
if (this.locked())
|
|
1640
|
+
return;
|
|
1641
|
+
//
|
|
1642
|
+
this.zone.runOutsideAngular(() => {
|
|
1643
|
+
if (this.hostElement()) {
|
|
1644
|
+
this.hostElement()?.classList.add('axp-state-hover');
|
|
1645
|
+
//
|
|
1646
|
+
if (this.hostElement().querySelector('.axp-widget-overlay') || this.config?.type == 'container') {
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1649
|
+
this.overlay = document.createElement('div');
|
|
1650
|
+
this.overlay.classList.add('axp-widget-overlay');
|
|
1651
|
+
this.overlay.addEventListener('click', (e) => {
|
|
1652
|
+
e.preventDefault();
|
|
1653
|
+
e.stopPropagation();
|
|
1654
|
+
this.select();
|
|
1655
|
+
});
|
|
1656
|
+
this.overlay.addEventListener('mouseleave', (e) => {
|
|
1657
|
+
e.preventDefault();
|
|
1658
|
+
e.stopPropagation();
|
|
1659
|
+
this.blur();
|
|
1660
|
+
});
|
|
1661
|
+
this.hostElement().appendChild(this.overlay);
|
|
1662
|
+
}
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
removeOverlay() {
|
|
1666
|
+
this.zone.runOutsideAngular(() => {
|
|
1667
|
+
if (this.hostElement()) {
|
|
1668
|
+
this.hostElement()?.classList.remove('axp-state-hover');
|
|
1669
|
+
//
|
|
1670
|
+
this.overlay?.remove();
|
|
1671
|
+
}
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
preprocessAndInitialOptions(obj, pathPrefix = '') {
|
|
1675
|
+
if (!obj)
|
|
1676
|
+
return;
|
|
1677
|
+
//
|
|
1678
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
1679
|
+
const currentPath = pathPrefix ? `${pathPrefix}.${key}` : key;
|
|
1680
|
+
this.mergedOptions.update((currentOptions) => {
|
|
1681
|
+
return set(currentOptions, currentPath, value);
|
|
1682
|
+
});
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
applyOptions(values) {
|
|
1686
|
+
if (this.instance instanceof AXPValueWidgetComponent && this.node().defaultValue != null) {
|
|
1687
|
+
this.instance.setValue(cloneDeep(this.node().defaultValue));
|
|
1688
|
+
}
|
|
1689
|
+
this.mergedOptions.update((currentOptions) => {
|
|
1690
|
+
return merge(currentOptions, values);
|
|
1691
|
+
});
|
|
1692
|
+
this.instance?.setOptions(this.mergedOptions());
|
|
1693
|
+
}
|
|
1694
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPWidgetDesignerRendererDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1695
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: AXPWidgetDesignerRendererDirective, isStandalone: true, selector: "[axp-widget-designer-renderer]", inputs: { parentNode: { classPropertyName: "parentNode", publicName: "parentNode", isSignal: true, isRequired: false, transformFunction: null }, parentElement: { classPropertyName: "parentElement", publicName: "parentElement", isSignal: true, isRequired: false, transformFunction: null }, parentComponent: { classPropertyName: "parentComponent", publicName: "parentComponent", isSignal: true, isRequired: false, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: false, transformFunction: null }, locked: { classPropertyName: "locked", publicName: "locked", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: true, transformFunction: null }, node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null } }, usesOnChanges: true, ngImport: i0 }); }
|
|
1696
|
+
}
|
|
1697
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPWidgetDesignerRendererDirective, decorators: [{
|
|
1698
|
+
type: Directive,
|
|
1699
|
+
args: [{
|
|
1700
|
+
selector: '[axp-widget-designer-renderer]',
|
|
1701
|
+
standalone: true,
|
|
1702
|
+
}]
|
|
1703
|
+
}], ctorParameters: () => [], propDecorators: { parentNode: [{ type: i0.Input, args: [{ isSignal: true, alias: "parentNode", required: false }] }], parentElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "parentElement", required: false }] }], parentComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "parentComponent", required: false }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: false }] }], locked: [{ type: i0.Input, args: [{ isSignal: true, alias: "locked", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: true }] }], node: [{ type: i0.Input, args: [{ isSignal: true, alias: "node", required: true }] }] } });
|
|
1704
|
+
|
|
1705
|
+
class AXPDesignerBoardComponent {
|
|
1706
|
+
// Unified method to extract media queries and create a custom class
|
|
1707
|
+
applyResponsiveStyles(breakpoint) {
|
|
1708
|
+
const minWidth = get(this.breakpointMap, breakpoint);
|
|
1709
|
+
const mediaRules = [];
|
|
1710
|
+
// Loop through all the stylesheets
|
|
1711
|
+
for (const sheet of Array.from(document.styleSheets)) {
|
|
1712
|
+
try {
|
|
1713
|
+
// Loop through CSS rules
|
|
1714
|
+
for (const rule of Array.from(sheet.cssRules)) {
|
|
1715
|
+
// Check if the rule is a CSSMediaRule
|
|
1716
|
+
if (rule instanceof CSSMediaRule && rule.media.mediaText.includes(`min-width: ${minWidth}px`)) {
|
|
1717
|
+
// Loop through the media rule's CSS rules
|
|
1718
|
+
for (const subRule of Array.from(rule.cssRules)) {
|
|
1719
|
+
mediaRules.push(subRule.cssText);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
catch (e) {
|
|
1725
|
+
console.error('Error accessing stylesheet:', e);
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
// Create a dynamic class for the media queries
|
|
1729
|
+
this.createCustomClass(`axp-preview-${breakpoint}`, mediaRules, breakpoint);
|
|
1730
|
+
}
|
|
1731
|
+
createCustomClass(className, styles, breakpoint) {
|
|
1732
|
+
const styleSheet = document.createElement('style');
|
|
1733
|
+
styleSheet.setAttribute('data-screen', breakpoint);
|
|
1734
|
+
// Construct a pure CSS string, dynamically replacing the breakpoint prefix
|
|
1735
|
+
let styleString = '';
|
|
1736
|
+
styles.forEach((style) => {
|
|
1737
|
+
// Replace any prefixed classes like 'lg:' or 'md:' dynamically
|
|
1738
|
+
const dynamicPrefix = new RegExp(`\\.${breakpoint}\\\\:`, 'g');
|
|
1739
|
+
styleString += `.${className} ${style.replace(dynamicPrefix, '.')}`; // Replace the breakpoint prefix
|
|
1740
|
+
});
|
|
1741
|
+
styleSheet.innerText = styleString;
|
|
1742
|
+
this.removeCustomClass();
|
|
1743
|
+
this.elementRef.nativeElement.appendChild(styleSheet);
|
|
1744
|
+
}
|
|
1745
|
+
removeCustomClass() {
|
|
1746
|
+
this.elementRef.nativeElement.querySelectorAll('style').forEach((s) => s.remove());
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* @ignore
|
|
1750
|
+
*/
|
|
1751
|
+
constructor() {
|
|
1752
|
+
this.context = {};
|
|
1753
|
+
this.elementRef = inject((ElementRef));
|
|
1754
|
+
this.breakpointMap = {
|
|
1755
|
+
sm: 640,
|
|
1756
|
+
md: 768,
|
|
1757
|
+
lg: 1024,
|
|
1758
|
+
xl: 1280,
|
|
1759
|
+
xxl: 1536,
|
|
1760
|
+
};
|
|
1761
|
+
this.service = inject(AXPDesignerService);
|
|
1762
|
+
this.width = computed(() => {
|
|
1763
|
+
switch (this.service.size()) {
|
|
1764
|
+
case 'sm':
|
|
1765
|
+
return '340px';
|
|
1766
|
+
case 'md':
|
|
1767
|
+
case 'lg':
|
|
1768
|
+
return '768px';
|
|
1769
|
+
default:
|
|
1770
|
+
return '100%';
|
|
1771
|
+
}
|
|
1772
|
+
}, ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
1773
|
+
this.ef = effect(() => {
|
|
1774
|
+
this.removeCustomClass();
|
|
1775
|
+
if (this.service.size() != 'xl') {
|
|
1776
|
+
this.applyResponsiveStyles(this.service.size());
|
|
1777
|
+
}
|
|
1778
|
+
}, ...(ngDevMode ? [{ debugName: "ef" }] : /* istanbul ignore next */ []));
|
|
1779
|
+
this.service.onRefresh.subscribe(() => {
|
|
1780
|
+
this.contextMenu?.refresh();
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
handleContextMenuOpening(e) {
|
|
1784
|
+
const renderer = get(e.targetElement, '__meta__.renderer');
|
|
1785
|
+
const instance = get(e.targetElement, '__meta__.instance');
|
|
1786
|
+
if (!renderer || !instance) {
|
|
1787
|
+
e.canceled = true;
|
|
1788
|
+
return;
|
|
1789
|
+
}
|
|
1790
|
+
renderer.select();
|
|
1791
|
+
// Fetch context menu items for the current instance
|
|
1792
|
+
try {
|
|
1793
|
+
const items = this.service.getContextMenuItems(instance, true);
|
|
1794
|
+
if (items.length) {
|
|
1795
|
+
e.items.push(...items);
|
|
1796
|
+
}
|
|
1797
|
+
else {
|
|
1798
|
+
e.canceled = true;
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
catch (error) {
|
|
1802
|
+
console.error('Failed to get context menu items:', error);
|
|
1803
|
+
e.canceled = true;
|
|
1804
|
+
}
|
|
1805
|
+
// Recursively bind instance data to all items
|
|
1806
|
+
this.bindInstanceToItems(e.items, instance);
|
|
1807
|
+
// Traverse through parents and add their menu items directly to the root level
|
|
1808
|
+
this.addParentsToRootMenu(instance, e.items);
|
|
1809
|
+
}
|
|
1810
|
+
addParentsToRootMenu(instance, items) {
|
|
1811
|
+
let parent = instance?.parent;
|
|
1812
|
+
const parentItems = [];
|
|
1813
|
+
// Traverse up the parent chain, adding each parent to the "Parents" menu
|
|
1814
|
+
while (parent) {
|
|
1815
|
+
try {
|
|
1816
|
+
const widget = parent;
|
|
1817
|
+
const parentContextItems = this.service.getContextMenuItems(widget);
|
|
1818
|
+
// Create a new menu item for this parent
|
|
1819
|
+
const parentMenuItem = {
|
|
1820
|
+
text: parent.config.title,
|
|
1821
|
+
icon: parent.config.icon,
|
|
1822
|
+
items: [
|
|
1823
|
+
{
|
|
1824
|
+
text: 'Select',
|
|
1825
|
+
name: 'select',
|
|
1826
|
+
break: true,
|
|
1827
|
+
icon: 'fa-solid fa-arrow-pointer',
|
|
1828
|
+
},
|
|
1829
|
+
...parentContextItems,
|
|
1830
|
+
],
|
|
1831
|
+
};
|
|
1832
|
+
// Recursively bind instance data to all items
|
|
1833
|
+
this.bindInstanceToItems(parentMenuItem.items ?? [], widget);
|
|
1834
|
+
// Add the parent menu item to the parentItems array
|
|
1835
|
+
parentItems.push(parentMenuItem);
|
|
1836
|
+
}
|
|
1837
|
+
catch (error) {
|
|
1838
|
+
console.error('Failed to get parent context menu items:', error);
|
|
1839
|
+
}
|
|
1840
|
+
// Move to the next parent in the chain
|
|
1841
|
+
parent = parent?.parent;
|
|
1842
|
+
}
|
|
1843
|
+
// If there are any parent items, add them under a "Parents" group
|
|
1844
|
+
if (parentItems.length > 0) {
|
|
1845
|
+
items[items.length - 1].break = true;
|
|
1846
|
+
items.push({
|
|
1847
|
+
text: 'Parents',
|
|
1848
|
+
icon: 'fa-solid fa-turn-up', // Icon for the "Parents" group
|
|
1849
|
+
items: parentItems, // Add all parent items here
|
|
1850
|
+
});
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
async handleContextMenuItemClick(e) {
|
|
1854
|
+
if (e.item.name) {
|
|
1855
|
+
const instance = get(e.item.data, "instance");
|
|
1856
|
+
await this.service.executeCommand({ instance, name: e.item.name });
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
bindInstanceToItems(items, instance) {
|
|
1860
|
+
items.forEach(item => {
|
|
1861
|
+
// Ensure each item gets the correct instance
|
|
1862
|
+
item.data = { ...(item.data ?? {}), instance };
|
|
1863
|
+
// If the item has sub-items, bind instance to them recursively
|
|
1864
|
+
if (item.items) {
|
|
1865
|
+
this.bindInstanceToItems(item.items, instance);
|
|
1866
|
+
}
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1869
|
+
get __style() {
|
|
1870
|
+
const cls = {};
|
|
1871
|
+
cls[`width`] = this.width();
|
|
1872
|
+
cls[`max-width`] = '1280px';
|
|
1873
|
+
return cls;
|
|
1874
|
+
}
|
|
1875
|
+
get __class() {
|
|
1876
|
+
const cls = {};
|
|
1877
|
+
cls[`axp-designer-board`] = true;
|
|
1878
|
+
cls[`axp-state-design`] = true;
|
|
1879
|
+
cls['ax-h-full'] = true;
|
|
1880
|
+
cls['ax-overflow-auto'] = true;
|
|
1881
|
+
cls[`axp-preview-${this.service.size()}`] = true;
|
|
1882
|
+
return cls;
|
|
1883
|
+
}
|
|
1884
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerBoardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1885
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: AXPDesignerBoardComponent, isStandalone: true, selector: "axp-designer-board", host: { properties: { "style": "this.__style", "class": "this.__class" } }, viewQueries: [{ propertyName: "contextMenu", first: true, predicate: ["contextMenu"], descendants: true }], ngImport: i0, template: "<axp-widgets-container [context]=\"context\">\n <ng-container axp-widget-designer-renderer [node]=\"service.currentPage()\" [mode]=\"'designer'\"></ng-container>\n</axp-widgets-container>\n\n<ax-context-menu class=\"ax-dark\" #contextMenu [target]=\"'.axp-widget-host'\" [orientation]=\"'vertical'\"\n [closeOn]=\"'leave'\" (onOpening)=\"handleContextMenuOpening($event)\" (onItemClick)=\"handleContextMenuItemClick($event)\">\n</ax-context-menu>", dependencies: [{ kind: "ngmodule", type: AXPWidgetCoreModule }, { kind: "component", type: i1$2.AXPWidgetContainerComponent, selector: "axp-widgets-container", inputs: ["context", "functions"], outputs: ["onContextChanged"] }, { kind: "directive", type: AXPWidgetDesignerRendererDirective, selector: "[axp-widget-designer-renderer]", inputs: ["parentNode", "parentElement", "parentComponent", "index", "locked", "mode", "node"] }, { kind: "ngmodule", type: AXMenuModule }, { kind: "component", type: i2$2.AXContextMenuComponent, selector: "ax-context-menu", inputs: ["orientation", "openOn", "closeOn", "items", "target"], outputs: ["onItemClick", "onOpening", "onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1886
|
+
}
|
|
1887
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerBoardComponent, decorators: [{
|
|
1888
|
+
type: Component,
|
|
1889
|
+
args: [{ selector: 'axp-designer-board', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [AXPWidgetCoreModule, AXPWidgetDesignerRendererDirective, AXMenuModule], template: "<axp-widgets-container [context]=\"context\">\n <ng-container axp-widget-designer-renderer [node]=\"service.currentPage()\" [mode]=\"'designer'\"></ng-container>\n</axp-widgets-container>\n\n<ax-context-menu class=\"ax-dark\" #contextMenu [target]=\"'.axp-widget-host'\" [orientation]=\"'vertical'\"\n [closeOn]=\"'leave'\" (onOpening)=\"handleContextMenuOpening($event)\" (onItemClick)=\"handleContextMenuItemClick($event)\">\n</ax-context-menu>" }]
|
|
1890
|
+
}], ctorParameters: () => [], propDecorators: { contextMenu: [{
|
|
1891
|
+
type: ViewChild,
|
|
1892
|
+
args: ['contextMenu']
|
|
1893
|
+
}], __style: [{
|
|
1894
|
+
type: HostBinding,
|
|
1895
|
+
args: ['style']
|
|
1896
|
+
}], __class: [{
|
|
1897
|
+
type: HostBinding,
|
|
1898
|
+
args: ['class']
|
|
1899
|
+
}] } });
|
|
1900
|
+
|
|
1901
|
+
class AXPDesignerBreadcrumbsComponent {
|
|
1902
|
+
constructor() {
|
|
1903
|
+
this.service = inject(AXPDesignerService);
|
|
1904
|
+
}
|
|
1905
|
+
getTitle(node) {
|
|
1906
|
+
return get(node, '__meta__.config.title');
|
|
1907
|
+
}
|
|
1908
|
+
handleClick(node) {
|
|
1909
|
+
this.service.select({ widget: node });
|
|
1910
|
+
}
|
|
1911
|
+
handleMouseOver(node) {
|
|
1912
|
+
this.service.focus({ widget: node });
|
|
1913
|
+
}
|
|
1914
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerBreadcrumbsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1915
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPDesignerBreadcrumbsComponent, isStandalone: true, selector: "axp-designer-breadcrumbs", ngImport: i0, template: `
|
|
1916
|
+
<ax-breadcrumbs>
|
|
1917
|
+
@for( b of service.breadcrumbs();track $index){
|
|
1918
|
+
<ax-breadcrumbs-item>
|
|
1919
|
+
<a (click)="handleClick(b)" (mouseover)="handleMouseOver(b)"> {{ getTitle(b) }}</a>
|
|
1920
|
+
</ax-breadcrumbs-item>
|
|
1921
|
+
}
|
|
1922
|
+
<ng-template #divider>
|
|
1923
|
+
<i class="ax-icon ax-icon-chevron-right"></i>
|
|
1924
|
+
</ng-template>
|
|
1925
|
+
</ax-breadcrumbs>
|
|
1926
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: AXPWidgetCoreModule }, { kind: "ngmodule", type: AXBreadcrumbsModule }, { kind: "component", type: i1$3.AXBreadCrumbsComponent, selector: "ax-breadcrumbs" }, { kind: "component", type: i1$3.AXBreadCrumbsItemComponent, selector: "ax-breadcrumbs-item", inputs: ["disabled", "active"] }, { kind: "ngmodule", type: AXDecoratorModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1927
|
+
}
|
|
1928
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerBreadcrumbsComponent, decorators: [{
|
|
1929
|
+
type: Component,
|
|
1930
|
+
args: [{
|
|
1931
|
+
selector: 'axp-designer-breadcrumbs',
|
|
1932
|
+
template: `
|
|
1933
|
+
<ax-breadcrumbs>
|
|
1934
|
+
@for( b of service.breadcrumbs();track $index){
|
|
1935
|
+
<ax-breadcrumbs-item>
|
|
1936
|
+
<a (click)="handleClick(b)" (mouseover)="handleMouseOver(b)"> {{ getTitle(b) }}</a>
|
|
1937
|
+
</ax-breadcrumbs-item>
|
|
1938
|
+
}
|
|
1939
|
+
<ng-template #divider>
|
|
1940
|
+
<i class="ax-icon ax-icon-chevron-right"></i>
|
|
1941
|
+
</ng-template>
|
|
1942
|
+
</ax-breadcrumbs>
|
|
1943
|
+
`,
|
|
1944
|
+
encapsulation: ViewEncapsulation.None,
|
|
1945
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1946
|
+
imports: [AXPWidgetCoreModule, AXBreadcrumbsModule, AXDecoratorModule]
|
|
1947
|
+
}]
|
|
1948
|
+
}] });
|
|
1949
|
+
|
|
1950
|
+
class AXPLayoutDesignerDrawerContentComponent {
|
|
1951
|
+
constructor() { }
|
|
1952
|
+
ngOnInit() { }
|
|
1953
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutDesignerDrawerContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1954
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: AXPLayoutDesignerDrawerContentComponent, isStandalone: true, selector: "axp-designer-drawer-content", ngImport: i0, template: "<div class=\"ax-flex ax-flex-col ax-border-e ax-w-72 ax-h-full\">\n <div class=\"ax-flex ax-flex-row ax-w-full ax-justify-between ax-p-2 ax-border-b\">\n <div class=\"ax-flex ax-flex-row ax-gap-2 ax-items-center ax-font-semibold\">\n <ng-content select=\"ax-title\"></ng-content>\n </div>\n <div class=\"ax-flex ax-gap-1 ax-items-center\">\n <ng-content select=\"ax-content[header]\">\n </ng-content>\n <ax-close-button></ax-close-button>\n </div>\n </div>\n <div class=\"ax-flex-1 ax-h-full ax-overflow-auto\">\n <ng-content select=\"ax-content[body]\">\n\n </ng-content>\n </div>\n</div>", dependencies: [{ kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorCloseButtonComponent, selector: "ax-close-button", inputs: ["closeAll", "icon"] }] }); }
|
|
1955
|
+
}
|
|
1956
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutDesignerDrawerContentComponent, decorators: [{
|
|
1957
|
+
type: Component,
|
|
1958
|
+
args: [{ imports: [AXDecoratorModule], selector: 'axp-designer-drawer-content', template: "<div class=\"ax-flex ax-flex-col ax-border-e ax-w-72 ax-h-full\">\n <div class=\"ax-flex ax-flex-row ax-w-full ax-justify-between ax-p-2 ax-border-b\">\n <div class=\"ax-flex ax-flex-row ax-gap-2 ax-items-center ax-font-semibold\">\n <ng-content select=\"ax-title\"></ng-content>\n </div>\n <div class=\"ax-flex ax-gap-1 ax-items-center\">\n <ng-content select=\"ax-content[header]\">\n </ng-content>\n <ax-close-button></ax-close-button>\n </div>\n </div>\n <div class=\"ax-flex-1 ax-h-full ax-overflow-auto\">\n <ng-content select=\"ax-content[body]\">\n\n </ng-content>\n </div>\n</div>" }]
|
|
1959
|
+
}], ctorParameters: () => [] });
|
|
1960
|
+
|
|
1961
|
+
class AXPDesignerDataSourcesComponent {
|
|
1962
|
+
constructor() {
|
|
1963
|
+
this.service = inject(AXPDesignerService);
|
|
1964
|
+
this.workflow = inject(AXPWorkflowService);
|
|
1965
|
+
this.dataSourceProvider = inject(AXPDataSourceDefinitionProviderService);
|
|
1966
|
+
this.list = signal([], ...(ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []));
|
|
1967
|
+
}
|
|
1968
|
+
async ngOnInit() {
|
|
1969
|
+
const items = (await this.dataSourceProvider.items()).map(c => ({ name: c.name, title: c.title }));
|
|
1970
|
+
this.list.set(items);
|
|
1971
|
+
}
|
|
1972
|
+
async handleAddClick() {
|
|
1973
|
+
this.workflow.execute('create-entity', {
|
|
1974
|
+
entity: `PlatformManagement.DataSource`,
|
|
1975
|
+
options: {
|
|
1976
|
+
process: {
|
|
1977
|
+
canCreateNewOne: false,
|
|
1978
|
+
redirect: false,
|
|
1979
|
+
},
|
|
1980
|
+
layout: {
|
|
1981
|
+
size: 'lg'
|
|
1982
|
+
}
|
|
1983
|
+
},
|
|
1984
|
+
metadata: {
|
|
1985
|
+
formBuilder: true
|
|
1986
|
+
}
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1989
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerDataSourcesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1990
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPDesignerDataSourcesComponent, isStandalone: true, selector: "axp-designer-data-sources", ngImport: i0, template: "<axp-designer-drawer-content>\n <ax-title>Data Sources</ax-title>\n\n <ax-content header>\n <ax-button look=\"blank\" class=\"ax-sm\" title=\"Add New Data Source\" (onClick)=\"handleAddClick()\">\n <ax-icon class=\"fa-light fa-plus\"></ax-icon>\n </ax-button>\n </ax-content>\n\n <ax-content body>\n @if (list().length) {\n <ul class=\"axp-designer-drawer-list\">\n @for (item of list(); track $index) {\n <li>\n <i class=\"ax-me-1 fa-solid fa-table\"></i>\n {{ item.title }}\n </li>\n }\n </ul>\n } @else {\n <axp-state-message\n icon=\"fa-light fa-database\"\n [title]=\"'@layout-designer:components.data-sources.empty-states.no-data-sources.title'\"\n [description]=\"'@layout-designer:components.data-sources.empty-states.no-data-sources.description'\"\n >\n </axp-state-message>\n }\n </ax-content>\n</axp-designer-drawer-content>\n", dependencies: [{ kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i1.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXPLayoutDesignerDrawerContentComponent, selector: "axp-designer-drawer-content" }, { kind: "component", type: AXPStateMessageComponent, selector: "axp-state-message", inputs: ["mode", "icon", "title", "description", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1991
|
+
}
|
|
1992
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerDataSourcesComponent, decorators: [{
|
|
1993
|
+
type: Component,
|
|
1994
|
+
args: [{ selector: 'axp-designer-data-sources', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1995
|
+
AXDecoratorModule,
|
|
1996
|
+
AXButtonModule,
|
|
1997
|
+
AXPLayoutDesignerDrawerContentComponent,
|
|
1998
|
+
AXPStateMessageComponent
|
|
1999
|
+
], template: "<axp-designer-drawer-content>\n <ax-title>Data Sources</ax-title>\n\n <ax-content header>\n <ax-button look=\"blank\" class=\"ax-sm\" title=\"Add New Data Source\" (onClick)=\"handleAddClick()\">\n <ax-icon class=\"fa-light fa-plus\"></ax-icon>\n </ax-button>\n </ax-content>\n\n <ax-content body>\n @if (list().length) {\n <ul class=\"axp-designer-drawer-list\">\n @for (item of list(); track $index) {\n <li>\n <i class=\"ax-me-1 fa-solid fa-table\"></i>\n {{ item.title }}\n </li>\n }\n </ul>\n } @else {\n <axp-state-message\n icon=\"fa-light fa-database\"\n [title]=\"'@layout-designer:components.data-sources.empty-states.no-data-sources.title'\"\n [description]=\"'@layout-designer:components.data-sources.empty-states.no-data-sources.description'\"\n >\n </axp-state-message>\n }\n </ax-content>\n</axp-designer-drawer-content>\n" }]
|
|
2000
|
+
}] });
|
|
2001
|
+
|
|
2002
|
+
class AXPDesignerHistoryComponent {
|
|
2003
|
+
constructor() {
|
|
2004
|
+
this.service = inject(AXPDesignerService);
|
|
2005
|
+
}
|
|
2006
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerHistoryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2007
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPDesignerHistoryComponent, isStandalone: true, selector: "axp-designer-history", ngImport: i0, template: "<axp-designer-drawer-content>\n <ax-title>History</ax-title>\n\n <ax-content header>\n <ax-button look=\"blank\" class=\"ax-sm\">\n <ax-icon class=\"fa-light fa-ellipsis\"></ax-icon>\n <ax-dropdown-panel class=\"ax-sm\">\n <ax-button-item-list>\n <ax-button-item text=\"Clear\" name=\"add\" (onClick)=\"service.clearHistory()\"> </ax-button-item>\n </ax-button-item-list>\n </ax-dropdown-panel>\n </ax-button>\n </ax-content>\n\n <ax-content body>\n @if (service.history().length) {\n <ul class=\"axp-designer-drawer-list\">\n @for (step of service.history(); track $index) {\n <li\n (click)=\"service.navigateTo($index)\"\n [class.ax-italic]=\"step.isFuture\"\n [class.ax-text-neutral-400]=\"step.isFuture\"\n [class.ax-state-selected]=\"step.isCurrent\"\n >\n <i class=\"ax-me-1\" [ngClass]=\"step.icon\"></i>\n {{ step.description }}\n </li>\n }\n </ul>\n } @else {\n <axp-state-message\n icon=\"fa-light fa-history\"\n [title]=\"'@layout-designer:components.history.empty-states.no-changes.title'\"\n [description]=\"'@layout-designer:components.history.empty-states.no-changes.description'\"\n >\n </axp-state-message>\n }\n </ax-content>\n</axp-designer-drawer-content>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i1.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: i2.AXButtonItemComponent, selector: "ax-button-item", inputs: ["color", "disabled", "text", "selected", "divided", "data", "name"], outputs: ["onClick", "onFocus", "onBlur", "disabledChange"] }, { kind: "component", type: i2.AXButtonItemListComponent, selector: "ax-button-item-list", inputs: ["items", "closeParentOnClick", "lockOnLoading"], outputs: ["onItemClick"] }, { kind: "ngmodule", type: AXDropdownModule }, { kind: "component", type: i4.AXDropdownPanelComponent, selector: "ax-dropdown-panel", inputs: ["isOpen", "fitParent", "dropdownWidth", "position", "placement", "_target", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }, { kind: "component", type: AXPLayoutDesignerDrawerContentComponent, selector: "axp-designer-drawer-content" }, { kind: "component", type: AXPStateMessageComponent, selector: "axp-state-message", inputs: ["mode", "icon", "title", "description", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2008
|
+
}
|
|
2009
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerHistoryComponent, decorators: [{
|
|
2010
|
+
type: Component,
|
|
2011
|
+
args: [{ selector: 'axp-designer-history', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
2012
|
+
CommonModule,
|
|
2013
|
+
AXDecoratorModule,
|
|
2014
|
+
AXButtonModule,
|
|
2015
|
+
AXDropdownModule,
|
|
2016
|
+
AXPLayoutDesignerDrawerContentComponent,
|
|
2017
|
+
AXPStateMessageComponent
|
|
2018
|
+
], template: "<axp-designer-drawer-content>\n <ax-title>History</ax-title>\n\n <ax-content header>\n <ax-button look=\"blank\" class=\"ax-sm\">\n <ax-icon class=\"fa-light fa-ellipsis\"></ax-icon>\n <ax-dropdown-panel class=\"ax-sm\">\n <ax-button-item-list>\n <ax-button-item text=\"Clear\" name=\"add\" (onClick)=\"service.clearHistory()\"> </ax-button-item>\n </ax-button-item-list>\n </ax-dropdown-panel>\n </ax-button>\n </ax-content>\n\n <ax-content body>\n @if (service.history().length) {\n <ul class=\"axp-designer-drawer-list\">\n @for (step of service.history(); track $index) {\n <li\n (click)=\"service.navigateTo($index)\"\n [class.ax-italic]=\"step.isFuture\"\n [class.ax-text-neutral-400]=\"step.isFuture\"\n [class.ax-state-selected]=\"step.isCurrent\"\n >\n <i class=\"ax-me-1\" [ngClass]=\"step.icon\"></i>\n {{ step.description }}\n </li>\n }\n </ul>\n } @else {\n <axp-state-message\n icon=\"fa-light fa-history\"\n [title]=\"'@layout-designer:components.history.empty-states.no-changes.title'\"\n [description]=\"'@layout-designer:components.history.empty-states.no-changes.description'\"\n >\n </axp-state-message>\n }\n </ax-content>\n</axp-designer-drawer-content>\n" }]
|
|
2019
|
+
}] });
|
|
2020
|
+
|
|
2021
|
+
class AXPDesignerOutlineComponent {
|
|
2022
|
+
constructor() {
|
|
2023
|
+
this.service = inject(AXPDesignerService);
|
|
2024
|
+
this.collapsedStates = new Map();
|
|
2025
|
+
this.root = signal(this.getTree(), ...(ngDevMode ? [{ debugName: "root" }] : /* istanbul ignore next */ []));
|
|
2026
|
+
merge$1(this.service.onRefresh, this.service.onUpdate).subscribe(() => {
|
|
2027
|
+
this.root.update((c) => ({ ...this.getTree() }));
|
|
2028
|
+
});
|
|
2029
|
+
}
|
|
2030
|
+
getTree() {
|
|
2031
|
+
return {
|
|
2032
|
+
type: AXPWidgetsCatalog.document,
|
|
2033
|
+
children: [this.service.currentPage()],
|
|
2034
|
+
};
|
|
2035
|
+
}
|
|
2036
|
+
toggleCollapse(node) {
|
|
2037
|
+
// Toggle the current state or set to true if undefined
|
|
2038
|
+
this.collapsedStates.set(node, !this.collapsedStates.get(node));
|
|
2039
|
+
}
|
|
2040
|
+
isCollapsed(node) {
|
|
2041
|
+
// Return the collapsed state, default is false (expanded)
|
|
2042
|
+
return !!this.collapsedStates.get(node);
|
|
2043
|
+
}
|
|
2044
|
+
getConfig(node) {
|
|
2045
|
+
return get(node, '__meta__.config');
|
|
2046
|
+
}
|
|
2047
|
+
handleClick(e, node) {
|
|
2048
|
+
e.stopPropagation();
|
|
2049
|
+
this.service.select({ widget: node });
|
|
2050
|
+
}
|
|
2051
|
+
handleToggleClick(event, item) {
|
|
2052
|
+
event.stopPropagation(); // Prevents the event from bubbling up to parent elements
|
|
2053
|
+
this.toggleCollapse(item);
|
|
2054
|
+
}
|
|
2055
|
+
handleMouseOver(e, node) {
|
|
2056
|
+
e.stopPropagation();
|
|
2057
|
+
this.service.focus({ widget: node });
|
|
2058
|
+
}
|
|
2059
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerOutlineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2060
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPDesignerOutlineComponent, isStandalone: true, selector: "axp-designer-outline", ngImport: i0, template: "<axp-designer-drawer-content>\n <ax-title>Outline</ax-title>\n\n <ax-content body>\n @if (root().children?.length) {\n <ul class=\"ax-space-y-1 ax-p-1 ax-text-white ax-text-sm\">\n @for (node of root().children; track $index) {\n <ng-container [ngTemplateOutlet]=\"sideMenu\" [ngTemplateOutletContext]=\"{ $implicit: node }\"> </ng-container>\n }\n </ul>\n <ng-template #sideMenu let-item>\n <li (click)=\"handleClick($event, item)\" (mouseover)=\"handleMouseOver($event, item)\">\n <div\n [class.ax-bg-neutral-700]=\"item === service.selectedNode()\"\n class=\"ax-flex ax-flex-row ax-items-center ax-cursor-pointer ax-transition ax-duration-150 ax-ease-in-out ax-hover:bg-gray-700 ax-py-1 ax-px-2 ax-rounded-sm ax-group\"\n >\n <span class=\"ax-w-5\">\n @if (item.children?.length) {\n <i\n class=\"fa-solid\"\n [class.fa-chevron-right]=\"isCollapsed(item)\"\n (click)=\"handleToggleClick($event, item)\"\n [class.fa-chevron-down]=\"!isCollapsed(item)\"\n ></i>\n }\n </span>\n @let config = getConfig(item);\n <span class=\"ax-w-5\">\n @if (config.icon) {\n <i [ngClass]=\"config.icon\"></i>\n }\n </span>\n <span class=\"ax-truncate ax-flex-1 ax-pe-2\">{{ config.title }} : {{ item.name }}</span>\n <div class=\"ax-invisible group-hover:ax-visible ax-flex ax-gap-2 ax-justify-end\">\n @if (config.type == 'container') {\n <i class=\"fa-light fa-plus hover:ax-text-primary-500\" (click)=\"service.showPicker(item)\"></i>\n }\n @if (config.name != 'page-layout') {\n <i class=\"fa-light fa-xmark hover:ax-text-danger-500\" (click)=\"service.removeWidget(item)\"></i>\n }\n </div>\n </div>\n @if (item.children?.length && !isCollapsed(item)) {\n <ul class=\"ax-space-y-1 ax-ps-3 ax-text-white ax-text-sm\">\n @for (child of item.children; track child) {\n <ng-container [ngTemplateOutlet]=\"sideMenu\" [ngTemplateOutletContext]=\"{ $implicit: child }\">\n </ng-container>\n }\n </ul>\n }\n </li>\n </ng-template>\n } @else {\n <axp-state-message\n icon=\"fa-light fa-shapes\"\n [title]=\"'@layout-designer:components.outline.empty-states.no-widgets.title'\"\n [description]=\"'@layout-designer:components.outline.empty-states.no-widgets.description'\"\n >\n </axp-state-message>\n }\n </ax-content>\n</axp-designer-drawer-content>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "component", type: AXPLayoutDesignerDrawerContentComponent, selector: "axp-designer-drawer-content" }, { kind: "component", type: AXPStateMessageComponent, selector: "axp-state-message", inputs: ["mode", "icon", "title", "description", "variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2061
|
+
}
|
|
2062
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerOutlineComponent, decorators: [{
|
|
2063
|
+
type: Component,
|
|
2064
|
+
args: [{ selector: 'axp-designer-outline', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
2065
|
+
CommonModule,
|
|
2066
|
+
AXDecoratorModule,
|
|
2067
|
+
AXPLayoutDesignerDrawerContentComponent,
|
|
2068
|
+
AXPStateMessageComponent
|
|
2069
|
+
], template: "<axp-designer-drawer-content>\n <ax-title>Outline</ax-title>\n\n <ax-content body>\n @if (root().children?.length) {\n <ul class=\"ax-space-y-1 ax-p-1 ax-text-white ax-text-sm\">\n @for (node of root().children; track $index) {\n <ng-container [ngTemplateOutlet]=\"sideMenu\" [ngTemplateOutletContext]=\"{ $implicit: node }\"> </ng-container>\n }\n </ul>\n <ng-template #sideMenu let-item>\n <li (click)=\"handleClick($event, item)\" (mouseover)=\"handleMouseOver($event, item)\">\n <div\n [class.ax-bg-neutral-700]=\"item === service.selectedNode()\"\n class=\"ax-flex ax-flex-row ax-items-center ax-cursor-pointer ax-transition ax-duration-150 ax-ease-in-out ax-hover:bg-gray-700 ax-py-1 ax-px-2 ax-rounded-sm ax-group\"\n >\n <span class=\"ax-w-5\">\n @if (item.children?.length) {\n <i\n class=\"fa-solid\"\n [class.fa-chevron-right]=\"isCollapsed(item)\"\n (click)=\"handleToggleClick($event, item)\"\n [class.fa-chevron-down]=\"!isCollapsed(item)\"\n ></i>\n }\n </span>\n @let config = getConfig(item);\n <span class=\"ax-w-5\">\n @if (config.icon) {\n <i [ngClass]=\"config.icon\"></i>\n }\n </span>\n <span class=\"ax-truncate ax-flex-1 ax-pe-2\">{{ config.title }} : {{ item.name }}</span>\n <div class=\"ax-invisible group-hover:ax-visible ax-flex ax-gap-2 ax-justify-end\">\n @if (config.type == 'container') {\n <i class=\"fa-light fa-plus hover:ax-text-primary-500\" (click)=\"service.showPicker(item)\"></i>\n }\n @if (config.name != 'page-layout') {\n <i class=\"fa-light fa-xmark hover:ax-text-danger-500\" (click)=\"service.removeWidget(item)\"></i>\n }\n </div>\n </div>\n @if (item.children?.length && !isCollapsed(item)) {\n <ul class=\"ax-space-y-1 ax-ps-3 ax-text-white ax-text-sm\">\n @for (child of item.children; track child) {\n <ng-container [ngTemplateOutlet]=\"sideMenu\" [ngTemplateOutletContext]=\"{ $implicit: child }\">\n </ng-container>\n }\n </ul>\n }\n </li>\n </ng-template>\n } @else {\n <axp-state-message\n icon=\"fa-light fa-shapes\"\n [title]=\"'@layout-designer:components.outline.empty-states.no-widgets.title'\"\n [description]=\"'@layout-designer:components.outline.empty-states.no-widgets.description'\"\n >\n </axp-state-message>\n }\n </ax-content>\n</axp-designer-drawer-content>\n" }]
|
|
2070
|
+
}], ctorParameters: () => [] });
|
|
2071
|
+
|
|
2072
|
+
class AXPDesignerPagesComponent {
|
|
2073
|
+
constructor() {
|
|
2074
|
+
this.service = inject(AXPDesignerService);
|
|
2075
|
+
}
|
|
2076
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerPagesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2077
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPDesignerPagesComponent, isStandalone: true, selector: "axp-designer-pages", ngImport: i0, template: "<axp-designer-drawer-content class=\"ax-text-on-lightest\">\n <ax-title>Pages</ax-title>\n <ax-content header>\n <ax-button look=\"blank\" class=\"ax-sm\" (onClick)=\"service.addNewPage()\" title=\"Add New Page\">\n <ax-icon class=\"fa-light fa-file-circle-plus\"></ax-icon>\n </ax-button>\n </ax-content>\n\n <ax-content body>\n @let count = service.document().children?.length ?? 0; @if(count) {\n <ul class=\"ax-text-sm ax-p-2 ax-rounded ax-md ax-space-y-1\">\n @for( page of service.document().children;track $index) {\n <li (click)=\"service.goToPage($index)\"\n class=\"ax-cursor-pointer ax-transition ax-duration-150 ax-ease-in-out hover:ax-bg-dark ax-py-1 ax-px-2 ax-rounded-sm ax-group ax-flex ax-justify-between ax-items-center\"\n [class.ax-bg-darkest]=\"$index == service.currentPageIndex()\">\n <div>\n <i class=\"fa-light fa-file ax-me-1\"></i>\n Page {{ $index + 1 }}\n </div>\n <div class=\"ax-invisible group-hover:ax-visible ax-flex ax-gap-2\">\n @if(count>1) {\n <i class=\"fa-light fa-xmark hover:ax-text-danger-500\" (click)=\"service.removePage($index)\"></i>\n }\n <i class=\"fa-light fa-clone hover:ax-text-primary-500\" (click)=\"service.clonePage($index)\"></i>\n </div>\n </li>\n }\n </ul>\n } @else {\n <div class=\"ax-flex ax-justify-center ax-items-center ax-text-gray-300 ax-p-4\">No pages found in the document</div>\n }\n </ax-content>\n</axp-designer-drawer-content>\n", dependencies: [{ kind: "ngmodule", type: AXPWidgetCoreModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i1.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXPLayoutDesignerDrawerContentComponent, selector: "axp-designer-drawer-content" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2078
|
+
}
|
|
2079
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerPagesComponent, decorators: [{
|
|
2080
|
+
type: Component,
|
|
2081
|
+
args: [{ selector: 'axp-designer-pages', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
2082
|
+
AXPWidgetCoreModule,
|
|
2083
|
+
AXDecoratorModule,
|
|
2084
|
+
AXButtonModule,
|
|
2085
|
+
AXPLayoutDesignerDrawerContentComponent
|
|
2086
|
+
], template: "<axp-designer-drawer-content class=\"ax-text-on-lightest\">\n <ax-title>Pages</ax-title>\n <ax-content header>\n <ax-button look=\"blank\" class=\"ax-sm\" (onClick)=\"service.addNewPage()\" title=\"Add New Page\">\n <ax-icon class=\"fa-light fa-file-circle-plus\"></ax-icon>\n </ax-button>\n </ax-content>\n\n <ax-content body>\n @let count = service.document().children?.length ?? 0; @if(count) {\n <ul class=\"ax-text-sm ax-p-2 ax-rounded ax-md ax-space-y-1\">\n @for( page of service.document().children;track $index) {\n <li (click)=\"service.goToPage($index)\"\n class=\"ax-cursor-pointer ax-transition ax-duration-150 ax-ease-in-out hover:ax-bg-dark ax-py-1 ax-px-2 ax-rounded-sm ax-group ax-flex ax-justify-between ax-items-center\"\n [class.ax-bg-darkest]=\"$index == service.currentPageIndex()\">\n <div>\n <i class=\"fa-light fa-file ax-me-1\"></i>\n Page {{ $index + 1 }}\n </div>\n <div class=\"ax-invisible group-hover:ax-visible ax-flex ax-gap-2\">\n @if(count>1) {\n <i class=\"fa-light fa-xmark hover:ax-text-danger-500\" (click)=\"service.removePage($index)\"></i>\n }\n <i class=\"fa-light fa-clone hover:ax-text-primary-500\" (click)=\"service.clonePage($index)\"></i>\n </div>\n </li>\n }\n </ul>\n } @else {\n <div class=\"ax-flex ax-justify-center ax-items-center ax-text-gray-300 ax-p-4\">No pages found in the document</div>\n }\n </ax-content>\n</axp-designer-drawer-content>\n" }]
|
|
2087
|
+
}] });
|
|
2088
|
+
|
|
2089
|
+
class AXPDesignerHeaderMenuComponent {
|
|
2090
|
+
constructor() {
|
|
2091
|
+
this.service = inject(AXPDesignerService);
|
|
2092
|
+
}
|
|
2093
|
+
handleKeyboardEvent(event) {
|
|
2094
|
+
if (event.code == 'Delete' && this.service.canDelete()) {
|
|
2095
|
+
event.preventDefault();
|
|
2096
|
+
this.service.removeWidget();
|
|
2097
|
+
}
|
|
2098
|
+
if (event.code == 'Insert' && this.service.canInsert()) {
|
|
2099
|
+
event.preventDefault();
|
|
2100
|
+
this.service.showPicker();
|
|
2101
|
+
}
|
|
2102
|
+
if (event.shiftKey && event.target == document.body) {
|
|
2103
|
+
switch (event.code) {
|
|
2104
|
+
case 'KeyN':
|
|
2105
|
+
event.preventDefault();
|
|
2106
|
+
this.service.new();
|
|
2107
|
+
break;
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
if (event.ctrlKey) {
|
|
2111
|
+
switch (event.code) {
|
|
2112
|
+
case 'KeyS':
|
|
2113
|
+
event.preventDefault();
|
|
2114
|
+
if (event.shiftKey) {
|
|
2115
|
+
this.service.saveAs();
|
|
2116
|
+
}
|
|
2117
|
+
else {
|
|
2118
|
+
this.service.save();
|
|
2119
|
+
}
|
|
2120
|
+
break;
|
|
2121
|
+
case 'KeyR':
|
|
2122
|
+
event.preventDefault();
|
|
2123
|
+
if (event.shiftKey) {
|
|
2124
|
+
this.service.openPreviewWindow();
|
|
2125
|
+
}
|
|
2126
|
+
else {
|
|
2127
|
+
this.service.openPreviewDialog();
|
|
2128
|
+
}
|
|
2129
|
+
break;
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
//
|
|
2133
|
+
if (event.ctrlKey && event.target == document.body) {
|
|
2134
|
+
switch (event.code) {
|
|
2135
|
+
case 'KeyZ':
|
|
2136
|
+
if (this.service.canUndo()) {
|
|
2137
|
+
event.preventDefault();
|
|
2138
|
+
this.service.undo();
|
|
2139
|
+
}
|
|
2140
|
+
break;
|
|
2141
|
+
case 'KeyY':
|
|
2142
|
+
if (this.service.canRedo()) {
|
|
2143
|
+
event.preventDefault();
|
|
2144
|
+
this.service.redo();
|
|
2145
|
+
}
|
|
2146
|
+
break;
|
|
2147
|
+
case 'KeyC':
|
|
2148
|
+
if (this.service.canCutCopy()) {
|
|
2149
|
+
event.preventDefault();
|
|
2150
|
+
this.service.copy();
|
|
2151
|
+
}
|
|
2152
|
+
break;
|
|
2153
|
+
case 'KeyD':
|
|
2154
|
+
if (this.service.canCutCopy()) {
|
|
2155
|
+
event.preventDefault();
|
|
2156
|
+
this.service.clone();
|
|
2157
|
+
}
|
|
2158
|
+
break;
|
|
2159
|
+
case 'KeyX':
|
|
2160
|
+
if (this.service.canCutCopy()) {
|
|
2161
|
+
// ;
|
|
2162
|
+
event.preventDefault();
|
|
2163
|
+
this.service.cut();
|
|
2164
|
+
}
|
|
2165
|
+
break;
|
|
2166
|
+
case 'KeyV':
|
|
2167
|
+
if (this.service.canPaste()) {
|
|
2168
|
+
event.preventDefault();
|
|
2169
|
+
this.service.paste();
|
|
2170
|
+
}
|
|
2171
|
+
break;
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerHeaderMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2176
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPDesignerHeaderMenuComponent, isStandalone: true, selector: "axp-designer-header-menu", host: { listeners: { "document:keydown": "handleKeyboardEvent($event)" } }, ngImport: i0, template: "<ax-menu [openOn]=\"'hover'\" [hasArrow]=\"false\">\n <ax-menu-item>\n <ax-text>File</ax-text>\n <ax-menu-item (onClick)=\"service.new()\">\n <ax-text>New</ax-text>\n <ax-suffix>\n <ax-text> Shift+N </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-divider></ax-divider>\n @if(service.canSave())\n {\n <ng-container>\n <ax-menu-item (onClick)=\"service.save()\">\n <ax-text>Save</ax-text>\n <ax-suffix>\n <ax-text> Ctrl+S </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-menu-item (onClick)=\"service.saveAs()\">\n <ax-text>Save As...</ax-text>\n <ax-suffix>\n <ax-text> Ctrl+Shift+S </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-divider></ax-divider>\n </ng-container>\n }\n <ax-menu-item>\n <ax-text>Export</ax-text>\n <ax-menu-item (onClick)=\"service.downloadJson()\">\n <ax-text>Download JSON</ax-text>\n </ax-menu-item>\n </ax-menu-item>\n <ax-menu-item>\n <ax-text>Import</ax-text>\n <ax-menu-item (onClick)=\"service.importJSon()\">\n <ax-text>Import JSON</ax-text>\n </ax-menu-item>\n </ax-menu-item>\n </ax-menu-item>\n <ax-menu-item>\n <ax-text>Edit</ax-text>\n <ax-menu-item [disabled]=\"!service.canUndo()\" (onClick)=\"service.undo()\">\n <ax-text>Undo</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-rotate-left\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text> Ctrl+Z </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-menu-item [disabled]=\"!service.canRedo()\" (onClick)=\"service.redo()\">\n <ax-text>Redo</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-rotate-right\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text> Ctrl+Y </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-divider></ax-divider>\n <ax-menu-item [disabled]=\"!service.canCutCopy()\" (onClick)=\"service.clone()\">\n <ax-text>Clone</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-clone\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text> Ctrl+D </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-menu-item [disabled]=\"!service.canCutCopy()\" (onClick)=\"service.cut()\">\n <ax-text>Cut</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-cut\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text> Ctrl+X </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-menu-item [disabled]=\"!service.canCutCopy()\" (onClick)=\"service.copy()\">\n <ax-text>Copy</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-copy\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text> Ctrl+C </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-menu-item [disabled]=\"!service.canPaste()\" (onClick)=\"service.paste()\">\n <ax-text>Paste</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-paste\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text>Ctrl+V</ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-divider></ax-divider>\n <ax-menu-item [disabled]=\"!service.canDelete()\" (onClick)=\"service.removeWidget()\">\n <ax-text>Delete</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-trash\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text>Del</ax-text>\n </ax-suffix>\n </ax-menu-item>\n </ax-menu-item>\n <ax-menu-item>\n <ax-text>Run</ax-text>\n <ax-menu-item (onClick)=\"service.openPreviewDialog()\">\n <ax-text>Preview</ax-text>\n <ax-prefix>\n </ax-prefix>\n <ax-suffix>\n <ax-text>Ctrl+R</ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-menu-item (onClick)=\"service.openPreviewWindow()\">\n <ax-text>Preview in seperate window</ax-text>\n <ax-prefix> </ax-prefix>\n <ax-suffix>\n <ax-text>Ctrl+Shift+R</ax-text>\n </ax-suffix>\n </ax-menu-item>\n </ax-menu-item>\n <ax-menu-item>\n <ax-text>Help</ax-text>\n <ax-menu-item>\n <ax-text>About</ax-text>\n </ax-menu-item>\n </ax-menu-item>\n</ax-menu>", dependencies: [{ kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i1.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXMenuModule }, { kind: "component", type: i2$2.AXMenuItemComponent, selector: "ax-menu-item", inputs: ["name", "data", "disabled", "color"], outputs: ["onClick"] }, { kind: "component", type: i2$2.AXMenuComponent, selector: "ax-menu", inputs: ["orientation", "openOn", "closeOn", "items", "hasArrow"], outputs: ["onItemClick"] }] }); }
|
|
2177
|
+
}
|
|
2178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerHeaderMenuComponent, decorators: [{
|
|
2179
|
+
type: Component,
|
|
2180
|
+
args: [{ imports: [AXDecoratorModule, AXMenuModule], selector: 'axp-designer-header-menu', template: "<ax-menu [openOn]=\"'hover'\" [hasArrow]=\"false\">\n <ax-menu-item>\n <ax-text>File</ax-text>\n <ax-menu-item (onClick)=\"service.new()\">\n <ax-text>New</ax-text>\n <ax-suffix>\n <ax-text> Shift+N </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-divider></ax-divider>\n @if(service.canSave())\n {\n <ng-container>\n <ax-menu-item (onClick)=\"service.save()\">\n <ax-text>Save</ax-text>\n <ax-suffix>\n <ax-text> Ctrl+S </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-menu-item (onClick)=\"service.saveAs()\">\n <ax-text>Save As...</ax-text>\n <ax-suffix>\n <ax-text> Ctrl+Shift+S </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-divider></ax-divider>\n </ng-container>\n }\n <ax-menu-item>\n <ax-text>Export</ax-text>\n <ax-menu-item (onClick)=\"service.downloadJson()\">\n <ax-text>Download JSON</ax-text>\n </ax-menu-item>\n </ax-menu-item>\n <ax-menu-item>\n <ax-text>Import</ax-text>\n <ax-menu-item (onClick)=\"service.importJSon()\">\n <ax-text>Import JSON</ax-text>\n </ax-menu-item>\n </ax-menu-item>\n </ax-menu-item>\n <ax-menu-item>\n <ax-text>Edit</ax-text>\n <ax-menu-item [disabled]=\"!service.canUndo()\" (onClick)=\"service.undo()\">\n <ax-text>Undo</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-rotate-left\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text> Ctrl+Z </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-menu-item [disabled]=\"!service.canRedo()\" (onClick)=\"service.redo()\">\n <ax-text>Redo</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-rotate-right\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text> Ctrl+Y </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-divider></ax-divider>\n <ax-menu-item [disabled]=\"!service.canCutCopy()\" (onClick)=\"service.clone()\">\n <ax-text>Clone</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-clone\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text> Ctrl+D </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-menu-item [disabled]=\"!service.canCutCopy()\" (onClick)=\"service.cut()\">\n <ax-text>Cut</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-cut\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text> Ctrl+X </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-menu-item [disabled]=\"!service.canCutCopy()\" (onClick)=\"service.copy()\">\n <ax-text>Copy</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-copy\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text> Ctrl+C </ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-menu-item [disabled]=\"!service.canPaste()\" (onClick)=\"service.paste()\">\n <ax-text>Paste</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-paste\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text>Ctrl+V</ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-divider></ax-divider>\n <ax-menu-item [disabled]=\"!service.canDelete()\" (onClick)=\"service.removeWidget()\">\n <ax-text>Delete</ax-text>\n <ax-prefix>\n <ax-icon>\n <i class=\"fa-solid fa-trash\"></i>\n </ax-icon>\n </ax-prefix>\n <ax-suffix>\n <ax-text>Del</ax-text>\n </ax-suffix>\n </ax-menu-item>\n </ax-menu-item>\n <ax-menu-item>\n <ax-text>Run</ax-text>\n <ax-menu-item (onClick)=\"service.openPreviewDialog()\">\n <ax-text>Preview</ax-text>\n <ax-prefix>\n </ax-prefix>\n <ax-suffix>\n <ax-text>Ctrl+R</ax-text>\n </ax-suffix>\n </ax-menu-item>\n <ax-menu-item (onClick)=\"service.openPreviewWindow()\">\n <ax-text>Preview in seperate window</ax-text>\n <ax-prefix> </ax-prefix>\n <ax-suffix>\n <ax-text>Ctrl+Shift+R</ax-text>\n </ax-suffix>\n </ax-menu-item>\n </ax-menu-item>\n <ax-menu-item>\n <ax-text>Help</ax-text>\n <ax-menu-item>\n <ax-text>About</ax-text>\n </ax-menu-item>\n </ax-menu-item>\n</ax-menu>" }]
|
|
2181
|
+
}], propDecorators: { handleKeyboardEvent: [{
|
|
2182
|
+
type: HostListener,
|
|
2183
|
+
args: ['document:keydown', ['$event']]
|
|
2184
|
+
}] } });
|
|
2185
|
+
|
|
2186
|
+
class AXPDesignerViewSizeToolbarComponent {
|
|
2187
|
+
constructor() {
|
|
2188
|
+
this.size = model('xl', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2189
|
+
}
|
|
2190
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerViewSizeToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2191
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: AXPDesignerViewSizeToolbarComponent, isStandalone: true, selector: "axp-designer-view-sizes", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { size: "sizeChange" }, ngImport: i0, template: `
|
|
2192
|
+
<ax-button-group [color]="'primary'" [selection]="'multiple'">
|
|
2193
|
+
<ax-button-group-item [selected]="size() == 'xl'" [data]="'xl'" (onClick)="size.set('xl')">
|
|
2194
|
+
<ax-icon class="fa-light fa-desktop fa-fw "></ax-icon>
|
|
2195
|
+
</ax-button-group-item>
|
|
2196
|
+
<ax-button-group-item [selected]="size() == 'lg'" [data]="'lg'" (onClick)="size.set('lg')">
|
|
2197
|
+
<ax-icon class="fa-light fa-tablet fa-fw "></ax-icon>
|
|
2198
|
+
</ax-button-group-item>
|
|
2199
|
+
<ax-button-group-item [selected]="size() == 'sm'" [data]="'sm'" (onClick)="size.set('sm')">
|
|
2200
|
+
<ax-icon class="fa-light fa-mobile fa-fw "></ax-icon>
|
|
2201
|
+
</ax-button-group-item>
|
|
2202
|
+
</ax-button-group>
|
|
2203
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: AXButtonGroupModule }, { kind: "component", type: i1$4.AXButtonGroupComponent, selector: "ax-button-group", inputs: ["disabled", "color", "look", "fitParent", "selection"], outputs: ["onBlur", "onFocus", "lookChange", "colorChange", "disabledChange", "onClick", "selectionChange", "selectedButtonChange"] }, { kind: "component", type: i1$4.AXButtonGroupItemComponent, selector: "ax-button-group-item", inputs: ["color", "disabled", "text", "selected", "divided", "data", "name"], outputs: ["onClick", "onFocus", "onBlur", "disabledChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: AXMenuModule }] }); }
|
|
2204
|
+
}
|
|
2205
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDesignerViewSizeToolbarComponent, decorators: [{
|
|
2206
|
+
type: Component,
|
|
2207
|
+
args: [{
|
|
2208
|
+
selector: 'axp-designer-view-sizes',
|
|
2209
|
+
imports: [AXButtonGroupModule, AXDecoratorModule, AXMenuModule],
|
|
2210
|
+
template: `
|
|
2211
|
+
<ax-button-group [color]="'primary'" [selection]="'multiple'">
|
|
2212
|
+
<ax-button-group-item [selected]="size() == 'xl'" [data]="'xl'" (onClick)="size.set('xl')">
|
|
2213
|
+
<ax-icon class="fa-light fa-desktop fa-fw "></ax-icon>
|
|
2214
|
+
</ax-button-group-item>
|
|
2215
|
+
<ax-button-group-item [selected]="size() == 'lg'" [data]="'lg'" (onClick)="size.set('lg')">
|
|
2216
|
+
<ax-icon class="fa-light fa-tablet fa-fw "></ax-icon>
|
|
2217
|
+
</ax-button-group-item>
|
|
2218
|
+
<ax-button-group-item [selected]="size() == 'sm'" [data]="'sm'" (onClick)="size.set('sm')">
|
|
2219
|
+
<ax-icon class="fa-light fa-mobile fa-fw "></ax-icon>
|
|
2220
|
+
</ax-button-group-item>
|
|
2221
|
+
</ax-button-group>
|
|
2222
|
+
`,
|
|
2223
|
+
}]
|
|
2224
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }, { type: i0.Output, args: ["sizeChange"] }] } });
|
|
2225
|
+
|
|
2226
|
+
class AXPLayoutDesignerComponent {
|
|
2227
|
+
constructor() {
|
|
2228
|
+
this.service = inject(AXPDesignerService);
|
|
2229
|
+
this.id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2230
|
+
this.strategy = input(...(ngDevMode ? [undefined, { debugName: "strategy" }] : /* istanbul ignore next */ []));
|
|
2231
|
+
this.nodeConfig = computed(() => this.service.selectedNode() ? get(this.service.selectedNode(), '__meta__.config') : null, ...(ngDevMode ? [{ debugName: "nodeConfig" }] : /* istanbul ignore next */ []));
|
|
2232
|
+
this.service.onUpdate.subscribe((e) => {
|
|
2233
|
+
this.propertyViewer.update(e.values);
|
|
2234
|
+
});
|
|
2235
|
+
}
|
|
2236
|
+
ngOnInit() {
|
|
2237
|
+
if (this.id()) {
|
|
2238
|
+
this.service.loadById(this.id(), { strategy: (this.strategy() ?? AXPTemplateLoadingStrategy.Connector) });
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
get __styles() {
|
|
2242
|
+
const styles = {};
|
|
2243
|
+
styles[`direction`] = 'ltr';
|
|
2244
|
+
return styles;
|
|
2245
|
+
}
|
|
2246
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutDesignerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2247
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: AXPLayoutDesignerComponent, isStandalone: true, selector: "axp-layout-designer", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, strategy: { classPropertyName: "strategy", publicName: "strategy", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style": "this.__styles" } }, providers: [AXPDesignerService], viewQueries: [{ propertyName: "propertyViewer", first: true, predicate: AXPWidgetPropertyViewerComponent, descendants: true, static: true }], ngImport: i0, template: "<ax-drawer-container class=\"ax-h-full ax-w-full ax-flex ax-relative ax-overflow-hidden\">\n <ax-content class=\"ax-contents\">\n <!-- Toolbar Side -->\n <div class=\"ax-min-w-10 ax-bg-lightest ax-border-e ax-sm ax-flex ax-flex-col ax-items-center ax-dark\">\n <div class=\"ax-min-w-10 ax-h-10 ax-flex ax-items-center ax-justify-center ax-border-b\">\n <img src=\"assets/images/logos/icon-light.svg\" class=\"ax-w-6\" />\n </div>\n <div class=\"ax-py-1\"></div>\n <div class=\"ax-flex ax-flex-col ax-gap-2\">\n <!-- <ax-button look=\"blank\">\n <ax-icon class=\"fa-solid fa-puzzle ax-text-sm\"> </ax-icon>\n </ax-button> -->\n <ax-button look=\"blank\" (onClick)=\"pages.toggle()\" title=\"Pages\">\n <ax-icon class=\"fa-solid fa-page ax-text-sm\"> </ax-icon>\n </ax-button>\n <ax-button look=\"blank\" (onClick)=\"datasources.toggle()\" title=\"Data Sources\">\n <ax-icon class=\"fa-solid fa-database ax-text-sm\"> </ax-icon>\n </ax-button>\n <ax-button look=\"blank\" (onClick)=\"outline.toggle()\" title=\"Outline\">\n <ax-icon class=\"fa-solid fa-list-tree ax-text-sm\"> </ax-icon>\n </ax-button>\n <ax-button look=\"blank\" (onClick)=\"history.toggle()\" title=\"History\">\n <ax-icon class=\"fa-solid fa-clock-rotate-left ax-text-sm\"> </ax-icon>\n </ax-button>\n <!-- <ax-button look=\"blank\" title=\"Timeline\">\n <ax-icon class=\"fa-solid fa-diagram-sankey ax-text-sm\"> </ax-icon>\n </ax-button> -->\n </div>\n </div>\n <!-- Main Side -->\n <div class=\"ax-col-span-10 ax-flex ax-flex-col ax-flex-1\">\n <!-- Header Toolbar -->\n <div class=\"ax-h-10 ax-bg-lightest ax-border-b ax-flex ax-justify-between ax-px-2 ax-dark\">\n <div class=\"ax-flex ax-flex-1 ax-items-center ax-text-white ax-justify-start\">\n <axp-designer-header-menu></axp-designer-header-menu>\n </div>\n <div class=\"ax-flex ax-flex-1 ax-flex-row ax-gap-2 ax-sm ax-items-center ax-justify-center\">\n <axp-designer-view-sizes [(size)]=\"service.size\"></axp-designer-view-sizes>\n </div>\n <div class=\"ax-flex ax-flex-1 ax-flex-row ax-gap-2 ax-sm ax-items-center ax-justify-end\">\n <ax-dropdown-button mode=\"split\" look=\"solid\" text=\"Preview\" class=\"ax-sm\"\n (onClick)=\"service.openPreviewDialog()\">\n <ax-button-item-list>\n <ax-button-item text=\"Open in new window\" (onClick)=\"service.openPreviewWindow()\">\n <ax-prefix>\n <ax-icon icon=\"fa-regular fa-window-restore\"></ax-icon>\n </ax-prefix>\n </ax-button-item>\n </ax-button-item-list>\n </ax-dropdown-button>\n </div>\n </div>\n <!-- Board -->\n <ax-drawer-container class=\"ax-w-full ax-flex-1\">\n <!-- Pages -->\n <ax-drawer #pages location=\"start\" mode=\"push\" class=\"ax-dark ax-bg-lightest\">\n <ax-content>\n <axp-designer-pages></axp-designer-pages>\n </ax-content>\n </ax-drawer>\n <!-- Datasources -->\n <ax-drawer #datasources location=\"start\" mode=\"push\" class=\"ax-dark ax-bg-lightest\">\n <ax-content>\n <axp-designer-data-sources></axp-designer-data-sources>\n </ax-content>\n </ax-drawer>\n <!-- Outline Pnael -->\n <ax-drawer #outline location=\"start\" mode=\"push\" class=\"ax-dark ax-bg-lightest\">\n <ax-content>\n <axp-designer-outline></axp-designer-outline>\n </ax-content>\n </ax-drawer>\n <!-- History Pnael -->\n <ax-drawer #history location=\"start\" mode=\"push\" class=\"ax-dark ax-bg-lightest\">\n <ax-content>\n <axp-designer-history></axp-designer-history>\n </ax-content>\n </ax-drawer>\n <!-- Content of board -->\n <ax-content class=\"ax-light ax-bg-lighter ax-flex ax-justify-center ax-p-10\">\n <axp-designer-board class=\"ax-rounded-lg ax-bg-lightest ax-shadow-md\"> </axp-designer-board>\n </ax-content>\n </ax-drawer-container>\n <!-- Footer -->\n <div class=\"ax-h-10 ax-bg-lightest ax-border-t ax-flex ax-items-center ax-dark\">\n <axp-designer-breadcrumbs class=\"ax-border-default ax-p-2 ax-font-normal\">\n </axp-designer-breadcrumbs>\n </div>\n </div>\n </ax-content>\n <!-- Property Side -->\n <ax-drawer class=\"ax-dark axp-designer-prop-side\" location=\"end\" mode=\"push\" [collapsed]=\"false\" #pd>\n <ax-content class=\"ax-flex ax-flex-col ax-h-full ax-overflow-hidden \">\n <div class=\"ax-flex ax-flex-row ax-w-full ax-justify-between ax-text-white ax-px-4 ax-border-b ax-h-10\">\n <div class=\"ax-flex ax-flex-row ax-gap-2 ax-items-center\">\n <i [ngClass]=\"nodeConfig()?.icon\"></i>\n <span class=\"ax-font-semibold\">{{ nodeConfig()?.title }}</span>\n </div>\n </div>\n <axp-widget-property-viewer [mode]=\"'advanced'\" [widget]=\"service.selectedNode()!\"\n (onChanged)=\"service.update({ values: $event.values, mode: $event.mode })\" class=\"ax-flex-1 ax-overflow-auto\">\n </axp-widget-property-viewer>\n </ax-content>\n </ax-drawer>\n</ax-drawer-container>", styles: ["axp-layout-designer .axp-designer-board{background-color:#fff;background-image:linear-gradient(45deg,#f0f0f0 25%,transparent 25%,transparent 75%,#f0f0f0 75%,#f0f0f0),linear-gradient(45deg,#f0f0f0 25%,#fff 25% 75%,#f0f0f0 75%,#f0f0f0);background-size:20px 20px;background-position:0 0,10px 10px;display:block;height:100%;width:100%;overflow:auto;--tw-bg-opacity: 1;background-color:rgba(var(--ax-sys-color-surface),var(--tw-bg-opacity, 1));padding:.75rem}axp-layout-designer .axp-designer-board ax-drawer{background-color:rgb(var(--ax-sys-color-light-surface));color:rgb(var(--ax-sys-color-on-light-surface));border-color:rgb(var(--ax-sys-color-border-light-surface))}axp-layout-designer .axp-designer-board.axp-state-design .ax-widget-outline{outline-style:dashed;outline-width:1px;outline-offset:2px;outline-color:#d1d5db}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host{cursor:pointer;position:relative}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host.axp-state-selected{outline-style:solid;outline-width:2px;outline-offset:1px;outline-color:rgba(var(--ax-sys-color-lightest-surface),1);outline-color:#60a5fa}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host.axp-state-selected.ax-widget-container{outline-offset:2px}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host.axp-state-hover{outline-style:dashed;outline-width:2px;outline-offset:2px;outline-color:#d946ef}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host.axp-state-hover.axp-state-selected{outline-color:#60a5fa}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host.axp-state-hover.ax-widget-container{outline-offset:4px}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host .axp-widget-overlay{position:absolute;inset:0;z-index:2000;height:100%;width:100%}axp-layout-designer .axp-designer-board .axp-empty-space{display:flex;flex:1 1 0%;cursor:default;align-items:center;justify-content:center;background-color:rgba(var(--ax-sys-color-primary-300),10%);background-image:linear-gradient(135deg,rgba(var(--ax-sys-color-primary-300),50%) 10%,transparent 0,transparent 50%,rgba(var(--ax-sys-color-primary-300),50%) 0,rgba(var(--ax-sys-color-primary-300),50%) 60%,transparent 0,transparent);background-size:7.5px 7.5px;height:100%}axp-layout-designer .axp-designer-board .axp-page-widget-header,axp-layout-designer .axp-designer-board .axp-page-widget-footer{filter:grayscale(100%);opacity:.5}axp-layout-designer .axp-designer-board .axp-page-widget-header:hover,axp-layout-designer .axp-designer-board .axp-page-widget-footer:hover{filter:grayscale(0);opacity:1}axp-layout-designer .axp-designer-board .axp-page-widget-header{margin-bottom:.5rem}axp-layout-designer .axp-designer-board .axp-page-widget-footer{margin-top:.5rem}axp-layout-designer .axp-designer-prop-side{width:20rem;border-inline-start-width:1px;background-color:rgb(var(--ax-sys-color-light-surface));color:rgb(var(--ax-sys-color-on-light-surface));border-color:rgb(var(--ax-sys-color-border-light-surface))}axp-designer-drawer-content ul.axp-designer-drawer-list>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}axp-designer-drawer-content ul.axp-designer-drawer-list{padding:.25rem;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}axp-designer-drawer-content ul.axp-designer-drawer-list li{cursor:pointer;border-radius:.125rem;padding:.25rem .5rem;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);animation-duration:.15s;animation-timing-function:cubic-bezier(.4,0,.2,1)}axp-designer-drawer-content ul.axp-designer-drawer-list li:hover:not(.axp-designer-drawer-list){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}axp-designer-drawer-content ul.axp-designer-drawer-list li.ax-state-selected{--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity, 1))}axp-designer-drawer-content .axp-designer-drawer-empty{display:flex;align-items:center;justify-content:center;padding:1rem;--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: AXPWidgetCoreModule }, { kind: "component", type: AXPDesignerBoardComponent, selector: "axp-designer-board" }, { kind: "component", type: AXPWidgetPropertyViewerComponent, selector: "axp-widget-property-viewer", inputs: ["widget", "mode"], outputs: ["onChanged"] }, { kind: "component", type: AXPDesignerBreadcrumbsComponent, selector: "axp-designer-breadcrumbs" }, { kind: "component", type: AXPDesignerOutlineComponent, selector: "axp-designer-outline" }, { kind: "component", type: AXPDesignerHeaderMenuComponent, selector: "axp-designer-header-menu" }, { kind: "component", type: AXPDesignerHistoryComponent, selector: "axp-designer-history" }, { kind: "component", type: AXPDesignerDataSourcesComponent, selector: "axp-designer-data-sources" }, { kind: "component", type: AXPDesignerPagesComponent, selector: "axp-designer-pages" }, { kind: "component", type: AXPDesignerViewSizeToolbarComponent, selector: "axp-designer-view-sizes", inputs: ["size"], outputs: ["sizeChange"] }, { kind: "ngmodule", type: AXTabsModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: i2.AXButtonItemComponent, selector: "ax-button-item", inputs: ["color", "disabled", "text", "selected", "divided", "data", "name"], outputs: ["onClick", "onFocus", "onBlur", "disabledChange"] }, { kind: "component", type: i2.AXButtonItemListComponent, selector: "ax-button-item-list", inputs: ["items", "closeParentOnClick", "lockOnLoading"], outputs: ["onItemClick"] }, { kind: "ngmodule", type: AXDrawerModule }, { kind: "component", type: i3$1.AXDrawerComponent, selector: "ax-drawer", inputs: ["location", "showBackdrop", "mode", "transition", "closeOnBackdropClick", "backdropClass", "collapsed", "singleOpenMode"], outputs: ["onBackdropClick", "collapsedStateChanged"] }, { kind: "component", type: i3$1.AXDrawerContainerComponent, selector: "ax-drawer-container" }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i1.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXMenuModule }, { kind: "ngmodule", type: AXButtonGroupModule }, { kind: "ngmodule", type: AXDropdownModule }, { kind: "ngmodule", type: AXDropdownButtonModule }, { kind: "component", type: i5.AXDropdownButtonComponent, selector: "ax-dropdown-button", inputs: ["disabled", "size", "color", "look", "text", "type", "mode"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "lookChange", "colorChange", "disabledChange"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2248
|
+
}
|
|
2249
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutDesignerComponent, decorators: [{
|
|
2250
|
+
type: Component,
|
|
2251
|
+
args: [{ selector: 'axp-layout-designer', encapsulation: ViewEncapsulation.None, imports: [
|
|
2252
|
+
CommonModule,
|
|
2253
|
+
AXPWidgetCoreModule,
|
|
2254
|
+
AXPDesignerBoardComponent,
|
|
2255
|
+
AXPWidgetPropertyViewerComponent,
|
|
2256
|
+
AXPDesignerBreadcrumbsComponent,
|
|
2257
|
+
AXPDesignerOutlineComponent,
|
|
2258
|
+
AXPDesignerHeaderMenuComponent,
|
|
2259
|
+
AXPDesignerHistoryComponent,
|
|
2260
|
+
AXPDesignerDataSourcesComponent,
|
|
2261
|
+
AXPDesignerPagesComponent,
|
|
2262
|
+
AXPDesignerViewSizeToolbarComponent,
|
|
2263
|
+
AXTabsModule,
|
|
2264
|
+
AXButtonModule,
|
|
2265
|
+
AXDrawerModule,
|
|
2266
|
+
AXDecoratorModule,
|
|
2267
|
+
AXMenuModule,
|
|
2268
|
+
AXButtonGroupModule,
|
|
2269
|
+
AXDropdownModule,
|
|
2270
|
+
AXDropdownButtonModule,
|
|
2271
|
+
], providers: [AXPDesignerService], template: "<ax-drawer-container class=\"ax-h-full ax-w-full ax-flex ax-relative ax-overflow-hidden\">\n <ax-content class=\"ax-contents\">\n <!-- Toolbar Side -->\n <div class=\"ax-min-w-10 ax-bg-lightest ax-border-e ax-sm ax-flex ax-flex-col ax-items-center ax-dark\">\n <div class=\"ax-min-w-10 ax-h-10 ax-flex ax-items-center ax-justify-center ax-border-b\">\n <img src=\"assets/images/logos/icon-light.svg\" class=\"ax-w-6\" />\n </div>\n <div class=\"ax-py-1\"></div>\n <div class=\"ax-flex ax-flex-col ax-gap-2\">\n <!-- <ax-button look=\"blank\">\n <ax-icon class=\"fa-solid fa-puzzle ax-text-sm\"> </ax-icon>\n </ax-button> -->\n <ax-button look=\"blank\" (onClick)=\"pages.toggle()\" title=\"Pages\">\n <ax-icon class=\"fa-solid fa-page ax-text-sm\"> </ax-icon>\n </ax-button>\n <ax-button look=\"blank\" (onClick)=\"datasources.toggle()\" title=\"Data Sources\">\n <ax-icon class=\"fa-solid fa-database ax-text-sm\"> </ax-icon>\n </ax-button>\n <ax-button look=\"blank\" (onClick)=\"outline.toggle()\" title=\"Outline\">\n <ax-icon class=\"fa-solid fa-list-tree ax-text-sm\"> </ax-icon>\n </ax-button>\n <ax-button look=\"blank\" (onClick)=\"history.toggle()\" title=\"History\">\n <ax-icon class=\"fa-solid fa-clock-rotate-left ax-text-sm\"> </ax-icon>\n </ax-button>\n <!-- <ax-button look=\"blank\" title=\"Timeline\">\n <ax-icon class=\"fa-solid fa-diagram-sankey ax-text-sm\"> </ax-icon>\n </ax-button> -->\n </div>\n </div>\n <!-- Main Side -->\n <div class=\"ax-col-span-10 ax-flex ax-flex-col ax-flex-1\">\n <!-- Header Toolbar -->\n <div class=\"ax-h-10 ax-bg-lightest ax-border-b ax-flex ax-justify-between ax-px-2 ax-dark\">\n <div class=\"ax-flex ax-flex-1 ax-items-center ax-text-white ax-justify-start\">\n <axp-designer-header-menu></axp-designer-header-menu>\n </div>\n <div class=\"ax-flex ax-flex-1 ax-flex-row ax-gap-2 ax-sm ax-items-center ax-justify-center\">\n <axp-designer-view-sizes [(size)]=\"service.size\"></axp-designer-view-sizes>\n </div>\n <div class=\"ax-flex ax-flex-1 ax-flex-row ax-gap-2 ax-sm ax-items-center ax-justify-end\">\n <ax-dropdown-button mode=\"split\" look=\"solid\" text=\"Preview\" class=\"ax-sm\"\n (onClick)=\"service.openPreviewDialog()\">\n <ax-button-item-list>\n <ax-button-item text=\"Open in new window\" (onClick)=\"service.openPreviewWindow()\">\n <ax-prefix>\n <ax-icon icon=\"fa-regular fa-window-restore\"></ax-icon>\n </ax-prefix>\n </ax-button-item>\n </ax-button-item-list>\n </ax-dropdown-button>\n </div>\n </div>\n <!-- Board -->\n <ax-drawer-container class=\"ax-w-full ax-flex-1\">\n <!-- Pages -->\n <ax-drawer #pages location=\"start\" mode=\"push\" class=\"ax-dark ax-bg-lightest\">\n <ax-content>\n <axp-designer-pages></axp-designer-pages>\n </ax-content>\n </ax-drawer>\n <!-- Datasources -->\n <ax-drawer #datasources location=\"start\" mode=\"push\" class=\"ax-dark ax-bg-lightest\">\n <ax-content>\n <axp-designer-data-sources></axp-designer-data-sources>\n </ax-content>\n </ax-drawer>\n <!-- Outline Pnael -->\n <ax-drawer #outline location=\"start\" mode=\"push\" class=\"ax-dark ax-bg-lightest\">\n <ax-content>\n <axp-designer-outline></axp-designer-outline>\n </ax-content>\n </ax-drawer>\n <!-- History Pnael -->\n <ax-drawer #history location=\"start\" mode=\"push\" class=\"ax-dark ax-bg-lightest\">\n <ax-content>\n <axp-designer-history></axp-designer-history>\n </ax-content>\n </ax-drawer>\n <!-- Content of board -->\n <ax-content class=\"ax-light ax-bg-lighter ax-flex ax-justify-center ax-p-10\">\n <axp-designer-board class=\"ax-rounded-lg ax-bg-lightest ax-shadow-md\"> </axp-designer-board>\n </ax-content>\n </ax-drawer-container>\n <!-- Footer -->\n <div class=\"ax-h-10 ax-bg-lightest ax-border-t ax-flex ax-items-center ax-dark\">\n <axp-designer-breadcrumbs class=\"ax-border-default ax-p-2 ax-font-normal\">\n </axp-designer-breadcrumbs>\n </div>\n </div>\n </ax-content>\n <!-- Property Side -->\n <ax-drawer class=\"ax-dark axp-designer-prop-side\" location=\"end\" mode=\"push\" [collapsed]=\"false\" #pd>\n <ax-content class=\"ax-flex ax-flex-col ax-h-full ax-overflow-hidden \">\n <div class=\"ax-flex ax-flex-row ax-w-full ax-justify-between ax-text-white ax-px-4 ax-border-b ax-h-10\">\n <div class=\"ax-flex ax-flex-row ax-gap-2 ax-items-center\">\n <i [ngClass]=\"nodeConfig()?.icon\"></i>\n <span class=\"ax-font-semibold\">{{ nodeConfig()?.title }}</span>\n </div>\n </div>\n <axp-widget-property-viewer [mode]=\"'advanced'\" [widget]=\"service.selectedNode()!\"\n (onChanged)=\"service.update({ values: $event.values, mode: $event.mode })\" class=\"ax-flex-1 ax-overflow-auto\">\n </axp-widget-property-viewer>\n </ax-content>\n </ax-drawer>\n</ax-drawer-container>", styles: ["axp-layout-designer .axp-designer-board{background-color:#fff;background-image:linear-gradient(45deg,#f0f0f0 25%,transparent 25%,transparent 75%,#f0f0f0 75%,#f0f0f0),linear-gradient(45deg,#f0f0f0 25%,#fff 25% 75%,#f0f0f0 75%,#f0f0f0);background-size:20px 20px;background-position:0 0,10px 10px;display:block;height:100%;width:100%;overflow:auto;--tw-bg-opacity: 1;background-color:rgba(var(--ax-sys-color-surface),var(--tw-bg-opacity, 1));padding:.75rem}axp-layout-designer .axp-designer-board ax-drawer{background-color:rgb(var(--ax-sys-color-light-surface));color:rgb(var(--ax-sys-color-on-light-surface));border-color:rgb(var(--ax-sys-color-border-light-surface))}axp-layout-designer .axp-designer-board.axp-state-design .ax-widget-outline{outline-style:dashed;outline-width:1px;outline-offset:2px;outline-color:#d1d5db}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host{cursor:pointer;position:relative}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host.axp-state-selected{outline-style:solid;outline-width:2px;outline-offset:1px;outline-color:rgba(var(--ax-sys-color-lightest-surface),1);outline-color:#60a5fa}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host.axp-state-selected.ax-widget-container{outline-offset:2px}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host.axp-state-hover{outline-style:dashed;outline-width:2px;outline-offset:2px;outline-color:#d946ef}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host.axp-state-hover.axp-state-selected{outline-color:#60a5fa}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host.axp-state-hover.ax-widget-container{outline-offset:4px}axp-layout-designer .axp-designer-board.axp-state-design .axp-widget-host .axp-widget-overlay{position:absolute;inset:0;z-index:2000;height:100%;width:100%}axp-layout-designer .axp-designer-board .axp-empty-space{display:flex;flex:1 1 0%;cursor:default;align-items:center;justify-content:center;background-color:rgba(var(--ax-sys-color-primary-300),10%);background-image:linear-gradient(135deg,rgba(var(--ax-sys-color-primary-300),50%) 10%,transparent 0,transparent 50%,rgba(var(--ax-sys-color-primary-300),50%) 0,rgba(var(--ax-sys-color-primary-300),50%) 60%,transparent 0,transparent);background-size:7.5px 7.5px;height:100%}axp-layout-designer .axp-designer-board .axp-page-widget-header,axp-layout-designer .axp-designer-board .axp-page-widget-footer{filter:grayscale(100%);opacity:.5}axp-layout-designer .axp-designer-board .axp-page-widget-header:hover,axp-layout-designer .axp-designer-board .axp-page-widget-footer:hover{filter:grayscale(0);opacity:1}axp-layout-designer .axp-designer-board .axp-page-widget-header{margin-bottom:.5rem}axp-layout-designer .axp-designer-board .axp-page-widget-footer{margin-top:.5rem}axp-layout-designer .axp-designer-prop-side{width:20rem;border-inline-start-width:1px;background-color:rgb(var(--ax-sys-color-light-surface));color:rgb(var(--ax-sys-color-on-light-surface));border-color:rgb(var(--ax-sys-color-border-light-surface))}axp-designer-drawer-content ul.axp-designer-drawer-list>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}axp-designer-drawer-content ul.axp-designer-drawer-list{padding:.25rem;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}axp-designer-drawer-content ul.axp-designer-drawer-list li{cursor:pointer;border-radius:.125rem;padding:.25rem .5rem;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);animation-duration:.15s;animation-timing-function:cubic-bezier(.4,0,.2,1)}axp-designer-drawer-content ul.axp-designer-drawer-list li:hover:not(.axp-designer-drawer-list){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}axp-designer-drawer-content ul.axp-designer-drawer-list li.ax-state-selected{--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity, 1))}axp-designer-drawer-content .axp-designer-drawer-empty{display:flex;align-items:center;justify-content:center;padding:1rem;--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}\n"] }]
|
|
2272
|
+
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], strategy: [{ type: i0.Input, args: [{ isSignal: true, alias: "strategy", required: false }] }], propertyViewer: [{
|
|
2273
|
+
type: ViewChild,
|
|
2274
|
+
args: [AXPWidgetPropertyViewerComponent, { static: true }]
|
|
2275
|
+
}], __styles: [{
|
|
2276
|
+
type: HostBinding,
|
|
2277
|
+
args: ['style']
|
|
2278
|
+
}] } });
|
|
2279
|
+
|
|
2280
|
+
class AXPLayoutDesignerPreviewViewerComponent {
|
|
2281
|
+
constructor() {
|
|
2282
|
+
this.context = {};
|
|
2283
|
+
this.document = signal({ type: AXPWidgetsCatalog.document }, ...(ngDevMode ? [{ debugName: "document" }] : /* istanbul ignore next */ []));
|
|
2284
|
+
this.currentPageIndex = signal(0, ...(ngDevMode ? [{ debugName: "currentPageIndex" }] : /* istanbul ignore next */ []));
|
|
2285
|
+
this.connector = inject(AXPDesignerConnector);
|
|
2286
|
+
this.eventService = inject(AXPBroadcastEventService);
|
|
2287
|
+
this.unsubscriber = inject(AXUnsubscriber);
|
|
2288
|
+
this.currentPage = computed(() => {
|
|
2289
|
+
return (this.document().children?.[this.currentPageIndex()] ?? { type: AXPWidgetsCatalog.pageLayout });
|
|
2290
|
+
}, ...(ngDevMode ? [{ debugName: "currentPage" }] : /* istanbul ignore next */ []));
|
|
2291
|
+
this.eventService
|
|
2292
|
+
.listen(AXPDesignerMessageKeys.Preview)
|
|
2293
|
+
.pipe(this.unsubscriber.takeUntilDestroy)
|
|
2294
|
+
.subscribe((event) => {
|
|
2295
|
+
this.document.set(event.data.document);
|
|
2296
|
+
});
|
|
2297
|
+
//
|
|
2298
|
+
if (document.body.parentElement) {
|
|
2299
|
+
document.body.parentElement.classList.remove('ax-dark');
|
|
2300
|
+
document.body.parentElement.style.backgroundColor = 'unset';
|
|
2301
|
+
document.body.style.backgroundColor = 'unset';
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
ngAfterViewInit() {
|
|
2305
|
+
this.eventService.publish(AXPDesignerMessageKeys.Loaded);
|
|
2306
|
+
}
|
|
2307
|
+
handleContextChanged(e) {
|
|
2308
|
+
this.context = e.data;
|
|
2309
|
+
this.eventService.publish(AXPDesignerMessageKeys.ContextChanged, this.context);
|
|
2310
|
+
}
|
|
2311
|
+
ngOnDestroy() {
|
|
2312
|
+
this.eventService.unsubscribe(AXPDesignerMessageKeys.Preview);
|
|
2313
|
+
}
|
|
2314
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutDesignerPreviewViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2315
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: AXPLayoutDesignerPreviewViewerComponent, isStandalone: true, selector: "axp-layout-builder-viewer", providers: [AXUnsubscriber], ngImport: i0, template: `
|
|
2316
|
+
<axp-widgets-container [context]="context" (onContextChanged)="handleContextChanged($event)">
|
|
2317
|
+
<ng-container axp-widget-renderer [node]="currentPage()" [mode]="'edit'"></ng-container>
|
|
2318
|
+
</axp-widgets-container>
|
|
2319
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: AXPWidgetCoreModule }, { kind: "component", type: i1$2.AXPWidgetContainerComponent, selector: "axp-widgets-container", inputs: ["context", "functions"], outputs: ["onContextChanged"] }, { kind: "directive", type: i1$2.AXPWidgetRendererDirective, selector: "[axp-widget-renderer]", inputs: ["parentNode", "index", "mode", "node"], outputs: ["onOptionsChanged", "onValueChanged", "onLoad"], exportAs: ["widgetRenderer"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2320
|
+
}
|
|
2321
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutDesignerPreviewViewerComponent, decorators: [{
|
|
2322
|
+
type: Component,
|
|
2323
|
+
args: [{
|
|
2324
|
+
selector: 'axp-layout-builder-viewer',
|
|
2325
|
+
template: `
|
|
2326
|
+
<axp-widgets-container [context]="context" (onContextChanged)="handleContextChanged($event)">
|
|
2327
|
+
<ng-container axp-widget-renderer [node]="currentPage()" [mode]="'edit'"></ng-container>
|
|
2328
|
+
</axp-widgets-container>
|
|
2329
|
+
`,
|
|
2330
|
+
encapsulation: ViewEncapsulation.None,
|
|
2331
|
+
imports: [AXPWidgetCoreModule],
|
|
2332
|
+
providers: [AXUnsubscriber],
|
|
2333
|
+
}]
|
|
2334
|
+
}], ctorParameters: () => [] });
|
|
2335
|
+
|
|
2336
|
+
class AXPLayoutDesignerPreviewFrameComponent {
|
|
2337
|
+
constructor() {
|
|
2338
|
+
this.size = input('xl', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2339
|
+
this.width = computed(() => {
|
|
2340
|
+
;
|
|
2341
|
+
switch (this.size()) {
|
|
2342
|
+
case 'sm':
|
|
2343
|
+
return '340px';
|
|
2344
|
+
case 'md':
|
|
2345
|
+
case 'lg':
|
|
2346
|
+
return '768px';
|
|
2347
|
+
default:
|
|
2348
|
+
return '100%';
|
|
2349
|
+
}
|
|
2350
|
+
}, ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
2351
|
+
}
|
|
2352
|
+
get __class() {
|
|
2353
|
+
const cls = {};
|
|
2354
|
+
cls['ax-flex'] = true;
|
|
2355
|
+
cls['ax-flex-col'] = true;
|
|
2356
|
+
cls['ax-h-full'] = true;
|
|
2357
|
+
cls['ax-W-full'] = true;
|
|
2358
|
+
cls['lg:ax-p-20'] = true;
|
|
2359
|
+
cls['ax-bg-[#f3f3fe]'] = true;
|
|
2360
|
+
cls['ax-w-full'] = true;
|
|
2361
|
+
cls['ax-items-center'] = true;
|
|
2362
|
+
cls['ax-overflow-auto'] = true;
|
|
2363
|
+
return cls;
|
|
2364
|
+
}
|
|
2365
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutDesignerPreviewFrameComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2366
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: AXPLayoutDesignerPreviewFrameComponent, isStandalone: true, selector: "axp-layout-preview-frame", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.__class" } }, ngImport: i0, template: `
|
|
2367
|
+
<div
|
|
2368
|
+
class="ax-flex-1 lg:ax-rounded-lg ax-bg-white lg:ax-shadow-md ax-p-2"
|
|
2369
|
+
[style.width]="width()"
|
|
2370
|
+
style="max-width: 1280px;"
|
|
2371
|
+
>
|
|
2372
|
+
<iframe
|
|
2373
|
+
class="ax-w-full ax-h-full ax-bg-transparent"
|
|
2374
|
+
[frameBorder]="0"
|
|
2375
|
+
[src]="'/forms/viewer' | safe : 'resourceUrl'"
|
|
2376
|
+
>
|
|
2377
|
+
</iframe>
|
|
2378
|
+
</div>
|
|
2379
|
+
`, isInline: true, dependencies: [{ kind: "pipe", type: AXSafePipe, name: "safe" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2380
|
+
}
|
|
2381
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutDesignerPreviewFrameComponent, decorators: [{
|
|
2382
|
+
type: Component,
|
|
2383
|
+
args: [{
|
|
2384
|
+
selector: 'axp-layout-preview-frame',
|
|
2385
|
+
template: `
|
|
2386
|
+
<div
|
|
2387
|
+
class="ax-flex-1 lg:ax-rounded-lg ax-bg-white lg:ax-shadow-md ax-p-2"
|
|
2388
|
+
[style.width]="width()"
|
|
2389
|
+
style="max-width: 1280px;"
|
|
2390
|
+
>
|
|
2391
|
+
<iframe
|
|
2392
|
+
class="ax-w-full ax-h-full ax-bg-transparent"
|
|
2393
|
+
[frameBorder]="0"
|
|
2394
|
+
[src]="'/forms/viewer' | safe : 'resourceUrl'"
|
|
2395
|
+
>
|
|
2396
|
+
</iframe>
|
|
2397
|
+
</div>
|
|
2398
|
+
`,
|
|
2399
|
+
encapsulation: ViewEncapsulation.None,
|
|
2400
|
+
imports: [AXSafePipe]
|
|
2401
|
+
}]
|
|
2402
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], __class: [{
|
|
2403
|
+
type: HostBinding,
|
|
2404
|
+
args: ['class']
|
|
2405
|
+
}] } });
|
|
2406
|
+
|
|
2407
|
+
class AXPLayoutDesignerPreviewComponent extends AXBasePageComponent {
|
|
2408
|
+
constructor() {
|
|
2409
|
+
super();
|
|
2410
|
+
this.clipboard = inject(AXPClipBoardService);
|
|
2411
|
+
this.settings = inject(AXPSettingsService);
|
|
2412
|
+
this.eventService = inject(AXPBroadcastEventService);
|
|
2413
|
+
this.initialSize = 'xl';
|
|
2414
|
+
this.isDialogWindow = false;
|
|
2415
|
+
this.jsonSettingsKey = 'forms:preview:json';
|
|
2416
|
+
this.jsonViewCollapsed = signal(true, ...(ngDevMode ? [{ debugName: "jsonViewCollapsed" }] : /* istanbul ignore next */ []));
|
|
2417
|
+
this.size = signal(this.initialSize, ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
2418
|
+
this.context = signal({}, ...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
|
|
2419
|
+
//
|
|
2420
|
+
this.eventService.listen(AXPDesignerMessageKeys.ContextChanged).subscribe((event) => {
|
|
2421
|
+
this.context.set(event.data);
|
|
2422
|
+
});
|
|
2423
|
+
}
|
|
2424
|
+
async ngOnInit() {
|
|
2425
|
+
this.size.set(this.initialSize);
|
|
2426
|
+
const settingValue = await this.settings.get(this.jsonSettingsKey);
|
|
2427
|
+
this.jsonViewCollapsed.set(!settingValue);
|
|
2428
|
+
}
|
|
2429
|
+
handleCloseButton() {
|
|
2430
|
+
if (this.isDialogWindow) {
|
|
2431
|
+
this.close();
|
|
2432
|
+
}
|
|
2433
|
+
else {
|
|
2434
|
+
window.opener.focus();
|
|
2435
|
+
window.close();
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
handlePreviewWindow() {
|
|
2439
|
+
this.eventService.publish(AXPDesignerMessageKeys.PreviewWindow);
|
|
2440
|
+
this.close();
|
|
2441
|
+
}
|
|
2442
|
+
handleCopyJson() {
|
|
2443
|
+
this.clipboard.copy('Json Data', JSON.stringify(this.context()));
|
|
2444
|
+
}
|
|
2445
|
+
async handleCollapsedChange(value) {
|
|
2446
|
+
await this.settings.scope(AXPPlatformScope.User).set(this.jsonSettingsKey, !value);
|
|
2447
|
+
}
|
|
2448
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutDesignerPreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2449
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPLayoutDesignerPreviewComponent, isStandalone: true, selector: "axp-layout-preview", usesInheritance: true, ngImport: i0, template: "<ax-drawer-container class=\"ax-dark ax-h-full ax-w-full ax-flex ax-relative ax-overflow-hidden\">\n <ax-content>\n <div class=\"ax-dark ax-flex ax-flex-col ax-h-full ax-relative ax-bg-default\">\n <div class=\"ax-flex ax-items-center ax-justify-between ax-h-12 ax-bg-lightest ax-shadow ax-sm ax-px-2\">\n <div class=\"ax-flex ax-flex-1 ax-w-16 ax-justify-start\">\n <ax-button look=\"blank\" text=\"Back to Designer\" (onClick)=\"handleCloseButton()\">\n <ax-prefix>\n <ax-icon class=\"fa-regular fa-chevron-left\"></ax-icon>\n </ax-prefix>\n </ax-button>\n </div>\n <div class=\"ax-flex ax-flex-1 ax-flex-row ax-gap-2 ax-sm ax-items-center ax-justify-center\">\n <axp-designer-view-sizes [(size)]=\"size\"></axp-designer-view-sizes>\n </div>\n <div class=\"ax-flex ax-flex-1 ax-w-16 ax-justify-end\">\n @if(isDialogWindow) {\n <ax-button look=\"blank\" [title]=\"'Preview in to seperate window'\" (onClick)=\"handlePreviewWindow()\">\n <ax-prefix>\n <ax-icon class=\"fa-regular fa-window-restore\"></ax-icon>\n </ax-prefix>\n </ax-button>\n }@else { }\n <ax-button look=\"blank\" (onClick)=\"jsonView.toggle()\">\n <ax-prefix>\n <ax-icon class=\"fa-regular fa-list-tree\"></ax-icon>\n </ax-prefix>\n </ax-button>\n </div>\n </div>\n\n <div class=\"ax-bg-[#f3f3fe] ax-flex ax-flex-1 ax-justify-center ax-overflow-auto\">\n <axp-layout-preview-frame [size]=\"size()\"></axp-layout-preview-frame>\n </div>\n </div>\n </ax-content>\n <!-- [collapsed]=\"jsonViewCollapsed()\"\n (collapsedChange)=\"handleCollapsedChange($event)\" -->\n <ax-drawer class=\"ax-w-1/3 ax-border-s\" location=\"end\" mode=\"push\" #jsonView>\n <ax-content>\n <div class=\"ax-dark ax-flex ax-flex-col ax-h-full ax-relative ax-bg-default\">\n <div class=\"ax-flex ax-items-center ax-justify-between ax-h-12 ax-bg-lightest ax-shadow ax-sm ax-px-2\">\n <div class=\"ax-flex ax-flex-1 ax-w-16 ax-justify-start\">\n <span class=\"ax-text-surface-fore ax-font-semibold\">Form Data</span>\n </div>\n <div class=\"ax-flex ax-flex-1 ax-flex-row ax-gap-2 ax-sm ax-items-center ax-justify-center\"></div>\n <div class=\"ax-flex ax-flex-1 ax-w-16 ax-justify-end\">\n <ax-button look=\"blank\" (onClick)=\"handleCopyJson()\">\n <ax-prefix>\n <ax-icon class=\"fa-regular fa-copy\"></ax-icon>\n </ax-prefix>\n </ax-button>\n </div>\n </div>\n <div class=\"ax-px-6 ax-text-white\">\n <ax-json-viewer [json]=\"context()\"></ax-json-viewer>\n </div>\n </div>\n </ax-content>\n </ax-drawer>\n</ax-drawer-container>", styles: [""], dependencies: [{ kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXButtonGroupModule }, { kind: "ngmodule", type: AXDrawerModule }, { kind: "component", type: i3$1.AXDrawerComponent, selector: "ax-drawer", inputs: ["location", "showBackdrop", "mode", "transition", "closeOnBackdropClick", "backdropClass", "collapsed", "singleOpenMode"], outputs: ["onBackdropClick", "collapsedStateChanged"] }, { kind: "component", type: i3$1.AXDrawerContainerComponent, selector: "ax-drawer-container" }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i1.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXJsonViewerModule }, { kind: "component", type: i4$1.JsonViewerComponent, selector: "ax-json-viewer", inputs: ["json"] }, { kind: "component", type: AXPLayoutDesignerPreviewFrameComponent, selector: "axp-layout-preview-frame", inputs: ["size"] }, { kind: "component", type: AXPDesignerViewSizeToolbarComponent, selector: "axp-designer-view-sizes", inputs: ["size"], outputs: ["sizeChange"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2450
|
+
}
|
|
2451
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutDesignerPreviewComponent, decorators: [{
|
|
2452
|
+
type: Component,
|
|
2453
|
+
args: [{ selector: 'axp-layout-preview', encapsulation: ViewEncapsulation.None, imports: [
|
|
2454
|
+
AXButtonModule,
|
|
2455
|
+
AXButtonGroupModule,
|
|
2456
|
+
AXDrawerModule,
|
|
2457
|
+
AXDecoratorModule,
|
|
2458
|
+
AXJsonViewerModule,
|
|
2459
|
+
AXPLayoutDesignerPreviewFrameComponent,
|
|
2460
|
+
AXPDesignerViewSizeToolbarComponent
|
|
2461
|
+
], template: "<ax-drawer-container class=\"ax-dark ax-h-full ax-w-full ax-flex ax-relative ax-overflow-hidden\">\n <ax-content>\n <div class=\"ax-dark ax-flex ax-flex-col ax-h-full ax-relative ax-bg-default\">\n <div class=\"ax-flex ax-items-center ax-justify-between ax-h-12 ax-bg-lightest ax-shadow ax-sm ax-px-2\">\n <div class=\"ax-flex ax-flex-1 ax-w-16 ax-justify-start\">\n <ax-button look=\"blank\" text=\"Back to Designer\" (onClick)=\"handleCloseButton()\">\n <ax-prefix>\n <ax-icon class=\"fa-regular fa-chevron-left\"></ax-icon>\n </ax-prefix>\n </ax-button>\n </div>\n <div class=\"ax-flex ax-flex-1 ax-flex-row ax-gap-2 ax-sm ax-items-center ax-justify-center\">\n <axp-designer-view-sizes [(size)]=\"size\"></axp-designer-view-sizes>\n </div>\n <div class=\"ax-flex ax-flex-1 ax-w-16 ax-justify-end\">\n @if(isDialogWindow) {\n <ax-button look=\"blank\" [title]=\"'Preview in to seperate window'\" (onClick)=\"handlePreviewWindow()\">\n <ax-prefix>\n <ax-icon class=\"fa-regular fa-window-restore\"></ax-icon>\n </ax-prefix>\n </ax-button>\n }@else { }\n <ax-button look=\"blank\" (onClick)=\"jsonView.toggle()\">\n <ax-prefix>\n <ax-icon class=\"fa-regular fa-list-tree\"></ax-icon>\n </ax-prefix>\n </ax-button>\n </div>\n </div>\n\n <div class=\"ax-bg-[#f3f3fe] ax-flex ax-flex-1 ax-justify-center ax-overflow-auto\">\n <axp-layout-preview-frame [size]=\"size()\"></axp-layout-preview-frame>\n </div>\n </div>\n </ax-content>\n <!-- [collapsed]=\"jsonViewCollapsed()\"\n (collapsedChange)=\"handleCollapsedChange($event)\" -->\n <ax-drawer class=\"ax-w-1/3 ax-border-s\" location=\"end\" mode=\"push\" #jsonView>\n <ax-content>\n <div class=\"ax-dark ax-flex ax-flex-col ax-h-full ax-relative ax-bg-default\">\n <div class=\"ax-flex ax-items-center ax-justify-between ax-h-12 ax-bg-lightest ax-shadow ax-sm ax-px-2\">\n <div class=\"ax-flex ax-flex-1 ax-w-16 ax-justify-start\">\n <span class=\"ax-text-surface-fore ax-font-semibold\">Form Data</span>\n </div>\n <div class=\"ax-flex ax-flex-1 ax-flex-row ax-gap-2 ax-sm ax-items-center ax-justify-center\"></div>\n <div class=\"ax-flex ax-flex-1 ax-w-16 ax-justify-end\">\n <ax-button look=\"blank\" (onClick)=\"handleCopyJson()\">\n <ax-prefix>\n <ax-icon class=\"fa-regular fa-copy\"></ax-icon>\n </ax-prefix>\n </ax-button>\n </div>\n </div>\n <div class=\"ax-px-6 ax-text-white\">\n <ax-json-viewer [json]=\"context()\"></ax-json-viewer>\n </div>\n </div>\n </ax-content>\n </ax-drawer>\n</ax-drawer-container>" }]
|
|
2462
|
+
}], ctorParameters: () => [] });
|
|
2463
|
+
|
|
2464
|
+
var preview_component = /*#__PURE__*/Object.freeze({
|
|
2465
|
+
__proto__: null,
|
|
2466
|
+
AXPLayoutDesignerPreviewComponent: AXPLayoutDesignerPreviewComponent
|
|
2467
|
+
});
|
|
2468
|
+
|
|
2469
|
+
/**
|
|
2470
|
+
* Generated bundle index. Do not edit.
|
|
2471
|
+
*/
|
|
2472
|
+
|
|
2473
|
+
export { AXPDesignerAddWidgetButtonComponent, AXPDesignerAddWidgetLineButtonComponent, AXPDesignerAddWidgetMiniButtonComponent, AXPDesignerConnector, AXPDesignerFlexDrawerComponent, AXPDesignerGridDrawerComponent, AXPDesignerMessageKeys, AXPDesignerModes, AXPDesignerService, AXPDesignerWidgetPickerComponent, AXPLayoutDesignerComponent, AXPLayoutDesignerPreviewComponent, AXPLayoutDesignerPreviewViewerComponent, AXPTemplateLoadingStrategy, AXPWidgetDesignerRendererDirective, AXPWidgetPickerService, AXP_DESIGNER_ADD_WIDGET_MENU, AXP_DESIGNER_CLONE_MENU, AXP_DESIGNER_COPY_MENU, AXP_DESIGNER_CUT_MENU, AXP_DESIGNER_DELETE_WIDGET_MENU, AXP_DESIGNER_PASTE_MENU, AXP_DESIGNER_SAVE_AS_WIDGET_MENU, AXP_DESIGNER_SELECT_WIDGET_MENU, cloneWidgetMenu };
|
|
2474
|
+
//# sourceMappingURL=acorex-platform-layout-designer.mjs.map
|