@streamline-pulse/formkrafter-wc 0.2.0 → 0.4.0
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 +10 -8
- package/dist/components/fk-brick-actions.js +1 -1
- package/dist/components/fk-brick-list.js +1 -1
- package/dist/components/fk-brick-mold-item.js +1 -1
- package/dist/components/fk-brick-not-found.js +1 -1
- package/dist/components/fk-brick-render.js +1 -1
- package/dist/components/fk-code-editor.js +1 -1
- package/dist/components/fk-data-grid.js +1 -1
- package/dist/components/fk-drop-area.js +1 -1
- package/dist/components/fk-empty-form.js +1 -1
- package/dist/components/fk-file-input.js +1 -1
- package/dist/components/fk-form-builder.js +1 -1
- package/dist/components/fk-form-render.js +1 -1
- package/dist/components/fk-property-panel.js +1 -1
- package/dist/components/fk-rules-editor.js +1 -1
- package/dist/components/fk-select-input.js +1 -1
- package/dist/components/fk-signature-input.js +1 -1
- package/dist/components/fk-stepper.js +1 -1
- package/dist/components/fk-tabs.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-LXnm2ogM.js → p-28GBFlUX.js} +4 -4
- package/dist/components/p-BB4Llg42.js +1 -0
- package/dist/components/p-BGxmFcpL.js +1 -0
- package/dist/components/{p-BVBfbMl_.js → p-BInUBjyw.js} +1 -1
- package/dist/components/p-BietHxaT.js +1 -0
- package/dist/components/{p-C85zhhpr.js → p-BnzSarwW.js} +1 -1
- package/dist/components/p-BpkKcCCr.js +1 -0
- package/dist/components/p-C0Y8qh8R.js +1 -0
- package/dist/components/p-C5OWoRhO.js +1 -0
- package/dist/components/p-CKs1CWVz.js +1 -0
- package/dist/components/{p-BSPTuA1p.js → p-CZHykCYD.js} +1 -1
- package/dist/components/p-CehxuHtl.js +1 -0
- package/dist/components/p-CqVSd56Z.js +1 -0
- package/dist/components/p-CyZA17qf.js +1 -0
- package/dist/components/p-D4HhZxQ-.js +1 -0
- package/dist/components/p-DC6Wxbnz.js +1 -0
- package/dist/components/p-DRNycSdI.js +1 -0
- package/dist/components/{p-B0YjIsVn.js → p-Dh5Z49YD.js} +1 -1
- package/dist/components/p-DiOstAi9.js +1 -0
- package/dist/components/p-DlqnIm46.js +1 -0
- package/dist/components/{p-BDvqHJih.js → p-DshUS8Zm.js} +1 -1
- package/dist/components/p-DtcM1yw5.js +1 -0
- package/dist/components/p-NDbmiiYk.js +1 -0
- package/dist/components/p-RzeBwfwG.js +1 -0
- package/dist/components/p-ajy8ZcBX.js +1 -0
- package/dist/components/p-kYG3E0GQ.js +1 -0
- package/dist/components/p-tTJg_I4V.js +1 -0
- package/dist/formkrafter-wc/formkrafter-wc.css +1 -1
- package/dist/formkrafter-wc/formkrafter-wc.esm.js +1 -1
- package/dist/formkrafter-wc/index.esm.js +1 -1
- package/dist/formkrafter-wc/p-3579150a.entry.js +1 -0
- package/dist/formkrafter-wc/p-8b0ff66e.entry.js +1 -0
- package/dist/formkrafter-wc/p-BHZMDq2e.js +1 -0
- package/dist/formkrafter-wc/p-BietHxaT.js +1 -0
- package/dist/formkrafter-wc/p-C0Y8qh8R.js +1 -0
- package/dist/formkrafter-wc/p-CehxuHtl.js +1 -0
- package/dist/formkrafter-wc/p-DlqnIm46.js +1 -0
- package/dist/formkrafter-wc/p-DtcM1yw5.js +1 -0
- package/dist/formkrafter-wc/p-RzeBwfwG.js +1 -0
- package/dist/formkrafter-wc/p-WWmY5Z05.js +1 -0
- package/dist/formkrafter-wc/p-hcT25XX4.js +12 -0
- package/dist/formkrafter-wc/p-qLZlXROB.js +2 -0
- package/dist/types/components/fk-code-editor/fk-code-editor.d.ts +3 -1
- package/dist/types/components/fk-data-grid/fk-data-grid.d.ts +1 -0
- package/dist/types/components/fk-drop-area/fk-drop-area.d.ts +1 -0
- package/dist/types/components/fk-file-input/fk-file-input.d.ts +7 -3
- package/dist/types/components/fk-form-render/fk-form-render.d.ts +7 -1
- package/dist/types/components/fk-select-input/fk-select-input.d.ts +9 -0
- package/dist/types/components.d.ts +39 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/registry/default-bricks.d.ts +36 -0
- package/dist/types/utils/mask.d.ts +1 -0
- package/package.json +10 -15
- package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -5
- package/dist/cjs/fk-brick-actions_18.cjs.entry.js +0 -26443
- package/dist/cjs/formkrafter-wc.cjs.js +0 -25
- package/dist/cjs/index-Can2MpG5.js +0 -17538
- package/dist/cjs/index-CbyFxLc_.js +0 -2114
- package/dist/cjs/index.cjs.js +0 -48
- package/dist/cjs/loader.cjs.js +0 -13
- package/dist/collection/collection-manifest.json +0 -30
- package/dist/collection/components/fk-brick-actions/fk-brick-actions.css +0 -78
- package/dist/collection/components/fk-brick-actions/fk-brick-actions.js +0 -215
- package/dist/collection/components/fk-brick-list/fk-brick-list.css +0 -71
- package/dist/collection/components/fk-brick-list/fk-brick-list.js +0 -55
- package/dist/collection/components/fk-brick-mold-item/fk-brick-mold-item.css +0 -33
- package/dist/collection/components/fk-brick-mold-item/fk-brick-mold-item.js +0 -73
- package/dist/collection/components/fk-brick-not-found/fk-brick-not-found.css +0 -8
- package/dist/collection/components/fk-brick-not-found/fk-brick-not-found.js +0 -18
- package/dist/collection/components/fk-brick-render/fk-brick-render.js +0 -447
- package/dist/collection/components/fk-code-editor/fk-code-editor.css +0 -26
- package/dist/collection/components/fk-code-editor/fk-code-editor.js +0 -136
- package/dist/collection/components/fk-data-grid/fk-data-grid.css +0 -75
- package/dist/collection/components/fk-data-grid/fk-data-grid.js +0 -300
- package/dist/collection/components/fk-drop-area/fk-drop-area.css +0 -18
- package/dist/collection/components/fk-drop-area/fk-drop-area.js +0 -98
- package/dist/collection/components/fk-empty-form/fk-empty-form.css +0 -22
- package/dist/collection/components/fk-empty-form/fk-empty-form.js +0 -19
- package/dist/collection/components/fk-file-input/fk-file-input.css +0 -95
- package/dist/collection/components/fk-file-input/fk-file-input.js +0 -196
- package/dist/collection/components/fk-form-builder/fk-form-builder.css +0 -112
- package/dist/collection/components/fk-form-builder/fk-form-builder.js +0 -431
- package/dist/collection/components/fk-form-render/fk-form-render.css +0 -7
- package/dist/collection/components/fk-form-render/fk-form-render.js +0 -352
- package/dist/collection/components/fk-property-panel/fk-property-panel.css +0 -153
- package/dist/collection/components/fk-property-panel/fk-property-panel.js +0 -384
- package/dist/collection/components/fk-rules-editor/fk-rules-editor.css +0 -166
- package/dist/collection/components/fk-rules-editor/fk-rules-editor.js +0 -250
- package/dist/collection/components/fk-select-input/fk-select-input.css +0 -144
- package/dist/collection/components/fk-select-input/fk-select-input.js +0 -356
- package/dist/collection/components/fk-signature-input/fk-signature-input.css +0 -42
- package/dist/collection/components/fk-signature-input/fk-signature-input.js +0 -158
- package/dist/collection/components/fk-stepper/fk-stepper.css +0 -85
- package/dist/collection/components/fk-stepper/fk-stepper.js +0 -282
- package/dist/collection/components/fk-tabs/fk-tabs.css +0 -38
- package/dist/collection/components/fk-tabs/fk-tabs.js +0 -236
- package/dist/collection/i18n/i18n.js +0 -257
- package/dist/collection/index.js +0 -5
- package/dist/collection/registry/create-brick.js +0 -34
- package/dist/collection/registry/default-bricks.js +0 -562
- package/dist/collection/registry/registry.js +0 -44
- package/dist/collection/utils/brick-data.js +0 -16
- package/dist/collection/utils/drop.js +0 -14
- package/dist/collection/utils/events.js +0 -1
- package/dist/collection/utils/options.js +0 -21
- package/dist/collection/utils/remote.js +0 -27
- package/dist/collection/utils/rule-condition.js +0 -72
- package/dist/collection/utils/style.js +0 -11
- package/dist/components/p-B1t0M_hN.js +0 -1
- package/dist/components/p-B21cOFRx.js +0 -1
- package/dist/components/p-B7ED8qMb.js +0 -1
- package/dist/components/p-BrOXMyOG.js +0 -1
- package/dist/components/p-CMQ_4Zfv.js +0 -1
- package/dist/components/p-CWQX0sXS.js +0 -1
- package/dist/components/p-CXEvsomA.js +0 -1
- package/dist/components/p-Cq9HSEn8.js +0 -1
- package/dist/components/p-D7bf2ztq.js +0 -1
- package/dist/components/p-DIPoAaGe.js +0 -1
- package/dist/components/p-DYBirEew.js +0 -1
- package/dist/components/p-DluDp8V5.js +0 -1
- package/dist/components/p-Do6-yRva.js +0 -1
- package/dist/components/p-GjmAhT2E.js +0 -1
- package/dist/components/p-y0xDvzJR.js +0 -1
- package/dist/esm/app-globals-DQuL1Twl.js +0 -3
- package/dist/esm/fk-brick-actions_18.entry.js +0 -26424
- package/dist/esm/formkrafter-wc.js +0 -21
- package/dist/esm/index-BB2OOj__.js +0 -17478
- package/dist/esm/index-DMDO6w5-.js +0 -2105
- package/dist/esm/index.js +0 -2
- package/dist/esm/loader.js +0 -11
- package/dist/formkrafter-wc/p-0de7cbe1.entry.js +0 -1
- package/dist/formkrafter-wc/p-Bp_A8oL5.js +0 -12
- package/dist/formkrafter-wc/p-DMDO6w5-.js +0 -2
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/stencil.config.js +0 -34
- package/loader/cdn.js +0 -1
- package/loader/index.cjs.js +0 -1
- package/loader/index.d.ts +0 -24
- package/loader/index.es2017.js +0 -1
- package/loader/index.js +0 -2
|
@@ -1,431 +0,0 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
2
|
-
import { SpecHistory, addBrick, duplicateBrick, getBrickAt, iterateBricks, moveBrick, removeBrick, updateBrickConfigs, updateBrickRules, updateBrickStyles, updateBrickValidations, } from "@streamline-pulse/formkrafter-core";
|
|
3
|
-
import { getBrickMolds, newBrickSpec, } from "../../registry/registry";
|
|
4
|
-
import { registerDefaultBricks } from "../../registry/default-bricks";
|
|
5
|
-
import { fkT } from "../../i18n/i18n";
|
|
6
|
-
export class FkFormBuilder {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.locales = [];
|
|
9
|
-
this.currentData = {};
|
|
10
|
-
this.copied = false;
|
|
11
|
-
this.history = new SpecHistory();
|
|
12
|
-
this.importFromClipboard = async () => {
|
|
13
|
-
try {
|
|
14
|
-
const text = await navigator.clipboard.readText();
|
|
15
|
-
this.importSpec(text, false);
|
|
16
|
-
}
|
|
17
|
-
catch (_a) {
|
|
18
|
-
this.flashImportError(fkT('builder.pasteHint'));
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
this.copySpec = async () => {
|
|
22
|
-
if (!this.currentSpec)
|
|
23
|
-
return;
|
|
24
|
-
await navigator.clipboard.writeText(this.specJson());
|
|
25
|
-
this.copied = true;
|
|
26
|
-
setTimeout(() => (this.copied = false), 1500);
|
|
27
|
-
};
|
|
28
|
-
this.downloadSpec = () => {
|
|
29
|
-
if (!this.currentSpec)
|
|
30
|
-
return;
|
|
31
|
-
const blob = new Blob([this.specJson()], { type: 'application/json' });
|
|
32
|
-
const url = URL.createObjectURL(blob);
|
|
33
|
-
const link = document.createElement('a');
|
|
34
|
-
link.href = url;
|
|
35
|
-
link.download = 'form-spec.json';
|
|
36
|
-
link.click();
|
|
37
|
-
URL.revokeObjectURL(url);
|
|
38
|
-
};
|
|
39
|
-
this.undo = () => {
|
|
40
|
-
if (!this.currentSpec)
|
|
41
|
-
return;
|
|
42
|
-
const spec = this.history.undo(this.currentSpec);
|
|
43
|
-
if (spec === undefined)
|
|
44
|
-
return;
|
|
45
|
-
this.currentSpec = spec;
|
|
46
|
-
this.specChange.emit({ spec, patches: [], inverse: [] });
|
|
47
|
-
};
|
|
48
|
-
this.redo = () => {
|
|
49
|
-
if (!this.currentSpec)
|
|
50
|
-
return;
|
|
51
|
-
const spec = this.history.redo(this.currentSpec);
|
|
52
|
-
if (spec === undefined)
|
|
53
|
-
return;
|
|
54
|
-
this.currentSpec = spec;
|
|
55
|
-
this.specChange.emit({ spec, patches: [], inverse: [] });
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
componentWillLoad() {
|
|
59
|
-
if (getBrickMolds().length === 0)
|
|
60
|
-
registerDefaultBricks();
|
|
61
|
-
this.editLocale = this.locales[0];
|
|
62
|
-
this.currentSpec = this.spec;
|
|
63
|
-
this.currentData = Object.assign({}, this.data);
|
|
64
|
-
}
|
|
65
|
-
syncSpec(next) {
|
|
66
|
-
this.currentSpec = next;
|
|
67
|
-
this.history.clear();
|
|
68
|
-
}
|
|
69
|
-
handleBrickDrop(event) {
|
|
70
|
-
var _a, _b;
|
|
71
|
-
event.stopPropagation();
|
|
72
|
-
const { source, mold, from, parentPath, index } = event.detail;
|
|
73
|
-
if (source === 'new' && mold) {
|
|
74
|
-
const brickSpec = newBrickSpec(mold.type, mold.id);
|
|
75
|
-
if (!brickSpec)
|
|
76
|
-
return;
|
|
77
|
-
if (!this.currentSpec) {
|
|
78
|
-
this.setRootSpec(brickSpec.type === 'panel'
|
|
79
|
-
? brickSpec
|
|
80
|
-
: this.wrapInRootGroup(brickSpec));
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
this.applyUpdate(addBrick(this.currentSpec, brickSpec, parentPath, index));
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (source === 'move' && from && this.currentSpec) {
|
|
87
|
-
if (parentPath === from || parentPath.startsWith(`${from}.`))
|
|
88
|
-
return;
|
|
89
|
-
const parent = getBrickAt(this.currentSpec, parentPath);
|
|
90
|
-
if (!parent)
|
|
91
|
-
return;
|
|
92
|
-
const count = (_b = (_a = parent.children) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
93
|
-
const fromSegments = from.split('.');
|
|
94
|
-
const fromParent = fromSegments.slice(0, -1).join('.');
|
|
95
|
-
const fromIndex = Number(fromSegments[fromSegments.length - 1]);
|
|
96
|
-
const targetIndex = index !== null && index !== void 0 ? index : count;
|
|
97
|
-
if (fromParent === parentPath &&
|
|
98
|
-
(targetIndex === fromIndex || targetIndex === fromIndex + 1)) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
this.applyUpdate(moveBrick(this.currentSpec, from, `${parentPath}.${targetIndex}`));
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
handleBrickRemove(event) {
|
|
105
|
-
event.stopPropagation();
|
|
106
|
-
if (!this.currentSpec)
|
|
107
|
-
return;
|
|
108
|
-
if (event.detail.path === '0') {
|
|
109
|
-
this.setRootSpec(undefined);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
this.applyUpdate(removeBrick(this.currentSpec, event.detail.path));
|
|
113
|
-
}
|
|
114
|
-
handleBrickDuplicate(event) {
|
|
115
|
-
event.stopPropagation();
|
|
116
|
-
if (!this.currentSpec)
|
|
117
|
-
return;
|
|
118
|
-
this.applyUpdate(duplicateBrick(this.currentSpec, event.detail.path));
|
|
119
|
-
}
|
|
120
|
-
handleConfigsChange(event) {
|
|
121
|
-
event.stopPropagation();
|
|
122
|
-
if (!this.currentSpec || !event.detail.uid)
|
|
123
|
-
return;
|
|
124
|
-
this.applyUpdate(updateBrickConfigs(this.currentSpec, event.detail.uid, event.detail.configs));
|
|
125
|
-
}
|
|
126
|
-
handleStylesChange(event) {
|
|
127
|
-
event.stopPropagation();
|
|
128
|
-
if (!this.currentSpec || !event.detail.uid)
|
|
129
|
-
return;
|
|
130
|
-
this.applyUpdate(updateBrickStyles(this.currentSpec, event.detail.uid, event.detail.styles));
|
|
131
|
-
}
|
|
132
|
-
handleValidationsChange(event) {
|
|
133
|
-
event.stopPropagation();
|
|
134
|
-
if (!this.currentSpec || !event.detail.uid)
|
|
135
|
-
return;
|
|
136
|
-
this.applyUpdate(updateBrickValidations(this.currentSpec, event.detail.uid, event.detail.validations));
|
|
137
|
-
}
|
|
138
|
-
handleRulesChange(event) {
|
|
139
|
-
event.stopPropagation();
|
|
140
|
-
if (!this.currentSpec || !event.detail.uid)
|
|
141
|
-
return;
|
|
142
|
-
this.applyUpdate(updateBrickRules(this.currentSpec, event.detail.uid, event.detail.rules));
|
|
143
|
-
}
|
|
144
|
-
handleDataChange(event) {
|
|
145
|
-
this.currentData = event.detail.data;
|
|
146
|
-
}
|
|
147
|
-
handlePaste(event) {
|
|
148
|
-
var _a;
|
|
149
|
-
const target = event.target;
|
|
150
|
-
if (target === null || target === void 0 ? void 0 : target.closest('input, textarea, select, [contenteditable]'))
|
|
151
|
-
return;
|
|
152
|
-
this.importSpec((_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text/plain'), true);
|
|
153
|
-
}
|
|
154
|
-
importSpec(text, silent) {
|
|
155
|
-
if (!text) {
|
|
156
|
-
if (!silent)
|
|
157
|
-
this.flashImportError(fkT('builder.importInvalid'));
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
try {
|
|
161
|
-
const parsed = JSON.parse(text);
|
|
162
|
-
if (typeof parsed !== 'object' ||
|
|
163
|
-
parsed === null ||
|
|
164
|
-
typeof parsed.type !== 'string' ||
|
|
165
|
-
typeof parsed.id !== 'string') {
|
|
166
|
-
throw new Error('not a brick spec');
|
|
167
|
-
}
|
|
168
|
-
this.selectedUid = undefined;
|
|
169
|
-
this.importError = undefined;
|
|
170
|
-
this.setRootSpec(this.ensureUids(parsed));
|
|
171
|
-
}
|
|
172
|
-
catch (_a) {
|
|
173
|
-
if (!silent)
|
|
174
|
-
this.flashImportError(fkT('builder.importInvalid'));
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
ensureUids(spec) {
|
|
178
|
-
var _a;
|
|
179
|
-
const clone = structuredClone(spec);
|
|
180
|
-
for (const { brick } of iterateBricks(clone)) {
|
|
181
|
-
if (!((_a = brick.configs) === null || _a === void 0 ? void 0 : _a.uid)) {
|
|
182
|
-
brick.configs = Object.assign(Object.assign({}, brick.configs), { uid: crypto.randomUUID() });
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return clone;
|
|
186
|
-
}
|
|
187
|
-
flashImportError(message) {
|
|
188
|
-
this.importError = message;
|
|
189
|
-
setTimeout(() => (this.importError = undefined), 4000);
|
|
190
|
-
}
|
|
191
|
-
handleBrickSelect(event) {
|
|
192
|
-
var _a, _b;
|
|
193
|
-
event.stopPropagation();
|
|
194
|
-
if (!this.currentSpec)
|
|
195
|
-
return;
|
|
196
|
-
this.selectedUid = (_b = (_a = getBrickAt(this.currentSpec, event.detail.path)) === null || _a === void 0 ? void 0 : _a.configs) === null || _b === void 0 ? void 0 : _b.uid;
|
|
197
|
-
}
|
|
198
|
-
findSelected() {
|
|
199
|
-
var _a;
|
|
200
|
-
if (!this.currentSpec || !this.selectedUid)
|
|
201
|
-
return undefined;
|
|
202
|
-
for (const { brick, path } of iterateBricks(this.currentSpec)) {
|
|
203
|
-
if (((_a = brick.configs) === null || _a === void 0 ? void 0 : _a.uid) === this.selectedUid)
|
|
204
|
-
return { brick, path };
|
|
205
|
-
}
|
|
206
|
-
return undefined;
|
|
207
|
-
}
|
|
208
|
-
inputFieldKeys() {
|
|
209
|
-
var _a;
|
|
210
|
-
const keys = [];
|
|
211
|
-
for (const { brick } of iterateBricks(this.currentSpec)) {
|
|
212
|
-
const key = (_a = brick.configs) === null || _a === void 0 ? void 0 : _a.key;
|
|
213
|
-
if (brick.type === 'input' && key)
|
|
214
|
-
keys.push(key);
|
|
215
|
-
}
|
|
216
|
-
return keys;
|
|
217
|
-
}
|
|
218
|
-
wrapInRootGroup(brickSpec) {
|
|
219
|
-
const root = newBrickSpec('panel', 'column');
|
|
220
|
-
if (!root)
|
|
221
|
-
return brickSpec;
|
|
222
|
-
return Object.assign(Object.assign({}, root), { name: 'Form', children: [brickSpec] });
|
|
223
|
-
}
|
|
224
|
-
setRootSpec(spec) {
|
|
225
|
-
this.currentSpec = spec;
|
|
226
|
-
this.history.clear();
|
|
227
|
-
this.specChange.emit({ spec, patches: [], inverse: [] });
|
|
228
|
-
}
|
|
229
|
-
applyUpdate(update) {
|
|
230
|
-
this.history.record(update);
|
|
231
|
-
this.currentSpec = update.spec;
|
|
232
|
-
this.specChange.emit({
|
|
233
|
-
spec: update.spec,
|
|
234
|
-
patches: update.patches,
|
|
235
|
-
inverse: update.inverse,
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
specJson() {
|
|
239
|
-
return JSON.stringify(this.currentSpec, null, 2);
|
|
240
|
-
}
|
|
241
|
-
render() {
|
|
242
|
-
return (h("div", { key: 'f23b549325059ff00dc9b4dcce05f82e7905f646', class: "fk-builder" }, h("aside", { key: '76d630af39352b324fa1160945953bcc92f7e678', class: "fk-builder__palette" }, h("fk-brick-list", { key: 'a2fbf6fb78febd993e1972a3077e07cd952501f9' })), h("main", { key: 'e65836c299ef0b102bf99da9263823cb8506aa87', class: "fk-builder__main" }, h("div", { key: 'cf6681fdc4f36720919f3e52852eeaf247b4cd3f', class: "fk-builder__toolbar" }, h("button", { key: '8669e0c0bff778cee7b5a0f8dc85d762cd923309', type: "button", class: "fk-builder__tool", disabled: !this.history.canUndo, onClick: this.undo }, "\u21A9 ", fkT('builder.undo')), h("button", { key: 'e8f1b9e73a97ce7fc134628ec9dd80c43ef27f16', type: "button", class: "fk-builder__tool", disabled: !this.history.canRedo, onClick: this.redo }, "\u21AA ", fkT('builder.redo')), h("span", { key: 'e0af911cdb8686c8276ef3b48f75cf65b3f300ea', class: "fk-builder__spacer" }), this.locales.length > 1 ? (h("select", { class: "fk-builder__tool", onChange: (event) => (this.editLocale = event.target.value) }, this.locales.map((locale) => (h("option", { value: locale, selected: locale === this.editLocale }, locale.toUpperCase()))))) : null, this.importError ? (h("span", { class: "fk-builder__import-error" }, this.importError)) : null, h("button", { key: '5eb508486721587353400365ca3826bed2037620', type: "button", class: "fk-builder__tool", onClick: this.importFromClipboard }, "\u2913 ", fkT('builder.importJson')), h("button", { key: '4e60dd9edeef51da8871c34ea042cb828c6a547b', type: "button", class: "fk-builder__tool", disabled: !this.currentSpec, onClick: this.copySpec }, "\u29C9 ", this.copied ? fkT('builder.copied') : fkT('builder.copyJson')), h("button", { key: '40fc0afc683894136b6be5f73fd7f9803e0cc34c', type: "button", class: "fk-builder__tool", disabled: !this.currentSpec, onClick: this.downloadSpec }, "\u2B07 ", fkT('builder.downloadJson'))), h("div", { key: '317a25b31e4fa22204b923457a507f94bcbe5fbe', class: "fk-builder__canvas" }, this.currentSpec ? (h("fk-form-render", { spec: this.currentSpec, data: this.currentData, editable: true, selectedUid: this.selectedUid, locale: this.editLocale })) : ([h("fk-empty-form", null), h("fk-drop-area", { path: "0" })]))), h("aside", { key: '7d6491acc432ed158eec6727db75f152fa8398d4', class: "fk-builder__inspector" }, (() => {
|
|
243
|
-
const selected = this.findSelected();
|
|
244
|
-
return selected ? (h("fk-property-panel", { brick: selected.brick, fields: this.inputFieldKeys(), locales: this.locales, editLocale: this.editLocale })) : (h("p", { class: "fk-builder__hint" }, fkT('builder.hint')));
|
|
245
|
-
})())));
|
|
246
|
-
}
|
|
247
|
-
static get is() { return "fk-form-builder"; }
|
|
248
|
-
static get encapsulation() { return "scoped"; }
|
|
249
|
-
static get originalStyleUrls() {
|
|
250
|
-
return {
|
|
251
|
-
"$": ["fk-form-builder.css"]
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
static get styleUrls() {
|
|
255
|
-
return {
|
|
256
|
-
"$": ["fk-form-builder.css"]
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
static get properties() {
|
|
260
|
-
return {
|
|
261
|
-
"spec": {
|
|
262
|
-
"type": "unknown",
|
|
263
|
-
"mutable": false,
|
|
264
|
-
"complexType": {
|
|
265
|
-
"original": "BrickSpec",
|
|
266
|
-
"resolved": "BrickSpec",
|
|
267
|
-
"references": {
|
|
268
|
-
"BrickSpec": {
|
|
269
|
-
"location": "import",
|
|
270
|
-
"path": "@streamline-pulse/formkrafter-core",
|
|
271
|
-
"id": "../core/dist/index.d.ts::BrickSpec",
|
|
272
|
-
"referenceLocation": "BrickSpec"
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
"required": false,
|
|
277
|
-
"optional": true,
|
|
278
|
-
"docs": {
|
|
279
|
-
"tags": [],
|
|
280
|
-
"text": ""
|
|
281
|
-
},
|
|
282
|
-
"getter": false,
|
|
283
|
-
"setter": false
|
|
284
|
-
},
|
|
285
|
-
"data": {
|
|
286
|
-
"type": "unknown",
|
|
287
|
-
"mutable": false,
|
|
288
|
-
"complexType": {
|
|
289
|
-
"original": "Record<string, unknown>",
|
|
290
|
-
"resolved": "string | unknown",
|
|
291
|
-
"references": {
|
|
292
|
-
"Record": {
|
|
293
|
-
"location": "global",
|
|
294
|
-
"id": "global::Record"
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
"required": false,
|
|
299
|
-
"optional": true,
|
|
300
|
-
"docs": {
|
|
301
|
-
"tags": [],
|
|
302
|
-
"text": ""
|
|
303
|
-
},
|
|
304
|
-
"getter": false,
|
|
305
|
-
"setter": false
|
|
306
|
-
},
|
|
307
|
-
"locales": {
|
|
308
|
-
"type": "unknown",
|
|
309
|
-
"mutable": false,
|
|
310
|
-
"complexType": {
|
|
311
|
-
"original": "string[]",
|
|
312
|
-
"resolved": "string[]",
|
|
313
|
-
"references": {}
|
|
314
|
-
},
|
|
315
|
-
"required": false,
|
|
316
|
-
"optional": false,
|
|
317
|
-
"docs": {
|
|
318
|
-
"tags": [],
|
|
319
|
-
"text": ""
|
|
320
|
-
},
|
|
321
|
-
"getter": false,
|
|
322
|
-
"setter": false,
|
|
323
|
-
"defaultValue": "[]"
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
static get states() {
|
|
328
|
-
return {
|
|
329
|
-
"currentSpec": {},
|
|
330
|
-
"currentData": {},
|
|
331
|
-
"selectedUid": {},
|
|
332
|
-
"copied": {},
|
|
333
|
-
"importError": {},
|
|
334
|
-
"editLocale": {}
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
static get events() {
|
|
338
|
-
return [{
|
|
339
|
-
"method": "specChange",
|
|
340
|
-
"name": "specChange",
|
|
341
|
-
"bubbles": true,
|
|
342
|
-
"cancelable": true,
|
|
343
|
-
"composed": true,
|
|
344
|
-
"docs": {
|
|
345
|
-
"tags": [],
|
|
346
|
-
"text": ""
|
|
347
|
-
},
|
|
348
|
-
"complexType": {
|
|
349
|
-
"original": "SpecChangeDetail",
|
|
350
|
-
"resolved": "SpecChangeDetail",
|
|
351
|
-
"references": {
|
|
352
|
-
"SpecChangeDetail": {
|
|
353
|
-
"location": "import",
|
|
354
|
-
"path": "../../utils/events",
|
|
355
|
-
"id": "src/utils/events.ts::SpecChangeDetail",
|
|
356
|
-
"referenceLocation": "SpecChangeDetail"
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}];
|
|
361
|
-
}
|
|
362
|
-
static get watchers() {
|
|
363
|
-
return [{
|
|
364
|
-
"propName": "spec",
|
|
365
|
-
"methodName": "syncSpec"
|
|
366
|
-
}];
|
|
367
|
-
}
|
|
368
|
-
static get listeners() {
|
|
369
|
-
return [{
|
|
370
|
-
"name": "brickDrop",
|
|
371
|
-
"method": "handleBrickDrop",
|
|
372
|
-
"target": undefined,
|
|
373
|
-
"capture": false,
|
|
374
|
-
"passive": false
|
|
375
|
-
}, {
|
|
376
|
-
"name": "brickRemove",
|
|
377
|
-
"method": "handleBrickRemove",
|
|
378
|
-
"target": undefined,
|
|
379
|
-
"capture": false,
|
|
380
|
-
"passive": false
|
|
381
|
-
}, {
|
|
382
|
-
"name": "brickDuplicate",
|
|
383
|
-
"method": "handleBrickDuplicate",
|
|
384
|
-
"target": undefined,
|
|
385
|
-
"capture": false,
|
|
386
|
-
"passive": false
|
|
387
|
-
}, {
|
|
388
|
-
"name": "brickConfigsChange",
|
|
389
|
-
"method": "handleConfigsChange",
|
|
390
|
-
"target": undefined,
|
|
391
|
-
"capture": false,
|
|
392
|
-
"passive": false
|
|
393
|
-
}, {
|
|
394
|
-
"name": "brickStylesChange",
|
|
395
|
-
"method": "handleStylesChange",
|
|
396
|
-
"target": undefined,
|
|
397
|
-
"capture": false,
|
|
398
|
-
"passive": false
|
|
399
|
-
}, {
|
|
400
|
-
"name": "brickValidationsChange",
|
|
401
|
-
"method": "handleValidationsChange",
|
|
402
|
-
"target": undefined,
|
|
403
|
-
"capture": false,
|
|
404
|
-
"passive": false
|
|
405
|
-
}, {
|
|
406
|
-
"name": "brickRulesChange",
|
|
407
|
-
"method": "handleRulesChange",
|
|
408
|
-
"target": undefined,
|
|
409
|
-
"capture": false,
|
|
410
|
-
"passive": false
|
|
411
|
-
}, {
|
|
412
|
-
"name": "formDataChange",
|
|
413
|
-
"method": "handleDataChange",
|
|
414
|
-
"target": undefined,
|
|
415
|
-
"capture": false,
|
|
416
|
-
"passive": false
|
|
417
|
-
}, {
|
|
418
|
-
"name": "paste",
|
|
419
|
-
"method": "handlePaste",
|
|
420
|
-
"target": "document",
|
|
421
|
-
"capture": false,
|
|
422
|
-
"passive": false
|
|
423
|
-
}, {
|
|
424
|
-
"name": "brickSelect",
|
|
425
|
-
"method": "handleBrickSelect",
|
|
426
|
-
"target": undefined,
|
|
427
|
-
"capture": false,
|
|
428
|
-
"passive": false
|
|
429
|
-
}];
|
|
430
|
-
}
|
|
431
|
-
}
|