@streamline-pulse/formkrafter-wc 0.1.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/LICENSE +21 -0
- package/README.md +140 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/fk-brick-actions_18.cjs.entry.js +26442 -0
- package/dist/cjs/formkrafter-wc.cjs.js +25 -0
- package/dist/cjs/index-By4GGW_q.js +17346 -0
- package/dist/cjs/index-D_7eGIJ0.js +2090 -0
- package/dist/cjs/index.cjs.js +47 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/collection/collection-manifest.json +30 -0
- package/dist/collection/components/fk-brick-actions/fk-brick-actions.css +78 -0
- package/dist/collection/components/fk-brick-actions/fk-brick-actions.js +215 -0
- package/dist/collection/components/fk-brick-list/fk-brick-list.css +71 -0
- package/dist/collection/components/fk-brick-list/fk-brick-list.js +55 -0
- package/dist/collection/components/fk-brick-mold-item/fk-brick-mold-item.css +33 -0
- package/dist/collection/components/fk-brick-mold-item/fk-brick-mold-item.js +73 -0
- package/dist/collection/components/fk-brick-not-found/fk-brick-not-found.css +8 -0
- package/dist/collection/components/fk-brick-not-found/fk-brick-not-found.js +18 -0
- package/dist/collection/components/fk-brick-render/fk-brick-render.js +419 -0
- package/dist/collection/components/fk-code-editor/fk-code-editor.css +26 -0
- package/dist/collection/components/fk-code-editor/fk-code-editor.js +136 -0
- package/dist/collection/components/fk-data-grid/fk-data-grid.css +75 -0
- package/dist/collection/components/fk-data-grid/fk-data-grid.js +300 -0
- package/dist/collection/components/fk-drop-area/fk-drop-area.css +18 -0
- package/dist/collection/components/fk-drop-area/fk-drop-area.js +98 -0
- package/dist/collection/components/fk-empty-form/fk-empty-form.css +22 -0
- package/dist/collection/components/fk-empty-form/fk-empty-form.js +19 -0
- package/dist/collection/components/fk-file-input/fk-file-input.css +74 -0
- package/dist/collection/components/fk-file-input/fk-file-input.js +157 -0
- package/dist/collection/components/fk-form-builder/fk-form-builder.css +82 -0
- package/dist/collection/components/fk-form-builder/fk-form-builder.js +431 -0
- package/dist/collection/components/fk-form-render/fk-form-render.css +7 -0
- package/dist/collection/components/fk-form-render/fk-form-render.js +352 -0
- package/dist/collection/components/fk-property-panel/fk-property-panel.css +153 -0
- package/dist/collection/components/fk-property-panel/fk-property-panel.js +384 -0
- package/dist/collection/components/fk-rules-editor/fk-rules-editor.css +166 -0
- package/dist/collection/components/fk-rules-editor/fk-rules-editor.js +250 -0
- package/dist/collection/components/fk-select-input/fk-select-input.css +144 -0
- package/dist/collection/components/fk-select-input/fk-select-input.js +356 -0
- package/dist/collection/components/fk-signature-input/fk-signature-input.css +42 -0
- package/dist/collection/components/fk-signature-input/fk-signature-input.js +158 -0
- package/dist/collection/components/fk-stepper/fk-stepper.css +85 -0
- package/dist/collection/components/fk-stepper/fk-stepper.js +282 -0
- package/dist/collection/components/fk-tabs/fk-tabs.css +38 -0
- package/dist/collection/components/fk-tabs/fk-tabs.js +236 -0
- package/dist/collection/i18n/i18n.js +245 -0
- package/dist/collection/index.js +5 -0
- package/dist/collection/registry/create-brick.js +34 -0
- package/dist/collection/registry/default-bricks.js +424 -0
- package/dist/collection/registry/registry.js +44 -0
- package/dist/collection/utils/brick-data.js +16 -0
- package/dist/collection/utils/drop.js +14 -0
- package/dist/collection/utils/events.js +1 -0
- package/dist/collection/utils/options.js +21 -0
- package/dist/collection/utils/remote.js +27 -0
- package/dist/collection/utils/rule-condition.js +72 -0
- package/dist/collection/utils/style.js +11 -0
- package/dist/components/fk-brick-actions.d.ts +11 -0
- package/dist/components/fk-brick-actions.js +1 -0
- package/dist/components/fk-brick-list.d.ts +11 -0
- package/dist/components/fk-brick-list.js +1 -0
- package/dist/components/fk-brick-mold-item.d.ts +11 -0
- package/dist/components/fk-brick-mold-item.js +1 -0
- package/dist/components/fk-brick-not-found.d.ts +11 -0
- package/dist/components/fk-brick-not-found.js +1 -0
- package/dist/components/fk-brick-render.d.ts +11 -0
- package/dist/components/fk-brick-render.js +1 -0
- package/dist/components/fk-code-editor.d.ts +11 -0
- package/dist/components/fk-code-editor.js +1 -0
- package/dist/components/fk-data-grid.d.ts +11 -0
- package/dist/components/fk-data-grid.js +1 -0
- package/dist/components/fk-drop-area.d.ts +11 -0
- package/dist/components/fk-drop-area.js +1 -0
- package/dist/components/fk-empty-form.d.ts +11 -0
- package/dist/components/fk-empty-form.js +1 -0
- package/dist/components/fk-file-input.d.ts +11 -0
- package/dist/components/fk-file-input.js +1 -0
- package/dist/components/fk-form-builder.d.ts +11 -0
- package/dist/components/fk-form-builder.js +1 -0
- package/dist/components/fk-form-render.d.ts +11 -0
- package/dist/components/fk-form-render.js +1 -0
- package/dist/components/fk-property-panel.d.ts +11 -0
- package/dist/components/fk-property-panel.js +1 -0
- package/dist/components/fk-rules-editor.d.ts +11 -0
- package/dist/components/fk-rules-editor.js +1 -0
- package/dist/components/fk-select-input.d.ts +11 -0
- package/dist/components/fk-select-input.js +1 -0
- package/dist/components/fk-signature-input.d.ts +11 -0
- package/dist/components/fk-signature-input.js +1 -0
- package/dist/components/fk-stepper.d.ts +11 -0
- package/dist/components/fk-stepper.js +1 -0
- package/dist/components/fk-tabs.d.ts +11 -0
- package/dist/components/fk-tabs.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/p-92BozD8S.js +1 -0
- package/dist/components/p-B4vAN-UA.js +1 -0
- package/dist/components/p-BB3BQPr8.js +1 -0
- package/dist/components/p-BCQ-hj6j.js +1 -0
- package/dist/components/p-BIEpAM4V.js +1 -0
- package/dist/components/p-BLKRn62s.js +1 -0
- package/dist/components/p-BNREw7TY.js +1 -0
- package/dist/components/p-BOvjVIvo.js +1 -0
- package/dist/components/p-BQP1WryV.js +1 -0
- package/dist/components/p-BXFug2Ql.js +1 -0
- package/dist/components/p-Ctt--jpe.js +1 -0
- package/dist/components/p-D318uFl-.js +1 -0
- package/dist/components/p-DJDrDvoC.js +1 -0
- package/dist/components/p-DKGyje7v.js +1 -0
- package/dist/components/p-DKoJovNt.js +1 -0
- package/dist/components/p-DWgjI3TW.js +1 -0
- package/dist/components/p-Diknh4-7.js +1 -0
- package/dist/components/p-DtzMNM4i.js +1 -0
- package/dist/components/p-QC41Uj05.js +1 -0
- package/dist/components/p-TvmRksgg.js +1 -0
- package/dist/components/p-ZEW2q-4b.js +1 -0
- package/dist/components/p-dX7Lo8Fe.js +12 -0
- package/dist/components/p-gPc0o8Jb.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/fk-brick-actions_18.entry.js +26423 -0
- package/dist/esm/formkrafter-wc.js +21 -0
- package/dist/esm/index-BQqrzKxo.js +2081 -0
- package/dist/esm/index-BTmZ8XET.js +17288 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/formkrafter-wc/formkrafter-wc.css +1 -0
- package/dist/formkrafter-wc/formkrafter-wc.esm.js +1 -0
- package/dist/formkrafter-wc/index.esm.js +1 -0
- package/dist/formkrafter-wc/p-BQqrzKxo.js +2 -0
- package/dist/formkrafter-wc/p-BXIsVlA6.js +12 -0
- package/dist/formkrafter-wc/p-DQuL1Twl.js +1 -0
- package/dist/formkrafter-wc/p-f6bc0be0.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +34 -0
- package/dist/types/Users/datagnikan/Desktop/WorkSpace/streamline-pulse/formkrafter-js/formkrafter/packages/wc/.stencil/stencil.config.d.ts +2 -0
- package/dist/types/components/fk-brick-actions/fk-brick-actions.d.ts +18 -0
- package/dist/types/components/fk-brick-list/fk-brick-list.d.ts +6 -0
- package/dist/types/components/fk-brick-mold-item/fk-brick-mold-item.d.ts +10 -0
- package/dist/types/components/fk-brick-not-found/fk-brick-not-found.d.ts +3 -0
- package/dist/types/components/fk-brick-render/fk-brick-render.d.ts +22 -0
- package/dist/types/components/fk-code-editor/fk-code-editor.d.ts +13 -0
- package/dist/types/components/fk-data-grid/fk-data-grid.d.ts +21 -0
- package/dist/types/components/fk-drop-area/fk-drop-area.d.ts +12 -0
- package/dist/types/components/fk-empty-form/fk-empty-form.d.ts +3 -0
- package/dist/types/components/fk-file-input/fk-file-input.d.ts +14 -0
- package/dist/types/components/fk-form-builder/fk-form-builder.d.ts +43 -0
- package/dist/types/components/fk-form-render/fk-form-render.d.ts +29 -0
- package/dist/types/components/fk-property-panel/fk-property-panel.d.ts +34 -0
- package/dist/types/components/fk-rules-editor/fk-rules-editor.d.ts +29 -0
- package/dist/types/components/fk-select-input/fk-select-input.d.ts +37 -0
- package/dist/types/components/fk-signature-input/fk-signature-input.d.ts +19 -0
- package/dist/types/components/fk-stepper/fk-stepper.d.ts +27 -0
- package/dist/types/components/fk-tabs/fk-tabs.d.ts +23 -0
- package/dist/types/components.d.ts +796 -0
- package/dist/types/i18n/i18n.d.ts +5 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/registry/create-brick.d.ts +37 -0
- package/dist/types/registry/default-bricks.d.ts +489 -0
- package/dist/types/registry/registry.d.ts +8 -0
- package/dist/types/stencil-public-runtime.d.ts +1861 -0
- package/dist/types/utils/brick-data.d.ts +3 -0
- package/dist/types/utils/drop.d.ts +2 -0
- package/dist/types/utils/events.d.ts +37 -0
- package/dist/types/utils/options.d.ts +5 -0
- package/dist/types/utils/remote.d.ts +3 -0
- package/dist/types/utils/rule-condition.d.ts +30 -0
- package/dist/types/utils/style.d.ts +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +80 -0
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { getAffectedProperties, resolveLocalizedRecord, } from "@streamline-pulse/formkrafter-core";
|
|
3
|
+
import { getBrick } from "../../registry/registry";
|
|
4
|
+
import { getBrickData, wrapBrickData } from "../../utils/brick-data";
|
|
5
|
+
export class FkBrickRender {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.path = '0';
|
|
8
|
+
this.editable = false;
|
|
9
|
+
this.errors = {};
|
|
10
|
+
}
|
|
11
|
+
render() {
|
|
12
|
+
var _a, _b, _c, _d, _e;
|
|
13
|
+
const spec = this.brickSpec;
|
|
14
|
+
if (!spec)
|
|
15
|
+
return null;
|
|
16
|
+
const brick = getBrick(spec.type, spec.id);
|
|
17
|
+
if (!brick) {
|
|
18
|
+
return h("fk-brick-not-found", null, `${spec.type}:${spec.id}`);
|
|
19
|
+
}
|
|
20
|
+
const editing = this.editable && ((_a = spec.editable) !== null && _a !== void 0 ? _a : true);
|
|
21
|
+
const affected = getAffectedProperties(spec.rules, this.dataMap);
|
|
22
|
+
if (!editing && affected.hidden === true)
|
|
23
|
+
return null;
|
|
24
|
+
const isContainer = spec.type === 'panel' || spec.type === 'collection';
|
|
25
|
+
const uid = (_b = spec.configs) === null || _b === void 0 ? void 0 : _b.uid;
|
|
26
|
+
const childNodes = ((_c = spec.children) !== null && _c !== void 0 ? _c : []).map((childSpec, index) => (h("fk-brick-render", { brickSpec: childSpec, data: this.data, dataMap: this.dataMap, errors: this.errors, locale: this.locale, path: `${this.path}.${index}`, editable: this.editable, selectedUid: this.selectedUid, utils: this.utils })));
|
|
27
|
+
if (editing && isContainer) {
|
|
28
|
+
childNodes.push(h("fk-drop-area", { path: this.path }));
|
|
29
|
+
}
|
|
30
|
+
const props = {
|
|
31
|
+
brickSpec: spec,
|
|
32
|
+
configsForm: spec.configsForm,
|
|
33
|
+
configs: resolveLocalizedRecord(spec.configs, this.locale),
|
|
34
|
+
locale: this.locale,
|
|
35
|
+
styles: (_d = spec.styles) !== null && _d !== void 0 ? _d : {},
|
|
36
|
+
data: getBrickData(spec, this.data),
|
|
37
|
+
dataMap: this.dataMap,
|
|
38
|
+
error: ((_e = spec.configs) === null || _e === void 0 ? void 0 : _e.key) ? this.errors[spec.configs.key] : undefined,
|
|
39
|
+
disabled: editing ? false : affected.disabled === true,
|
|
40
|
+
path: this.path,
|
|
41
|
+
editable: editing,
|
|
42
|
+
children: childNodes,
|
|
43
|
+
validations: spec.validations,
|
|
44
|
+
rules: spec.rules,
|
|
45
|
+
utils: this.utils,
|
|
46
|
+
onDataChange: (value) => {
|
|
47
|
+
const wrapped = wrapBrickData(spec, value);
|
|
48
|
+
if (wrapped !== undefined)
|
|
49
|
+
this.brickDataChange.emit(wrapped);
|
|
50
|
+
},
|
|
51
|
+
onConfigsChange: (configs, changedUid) => this.brickConfigsChange.emit({ configs, uid: changedUid !== null && changedUid !== void 0 ? changedUid : uid }),
|
|
52
|
+
onStylesChange: (styles, changedUid) => this.brickStylesChange.emit({
|
|
53
|
+
styles: styles,
|
|
54
|
+
uid: changedUid !== null && changedUid !== void 0 ? changedUid : uid,
|
|
55
|
+
}),
|
|
56
|
+
onValidationsChange: (validations, changedUid) => this.brickValidationsChange.emit({ validations, uid: changedUid !== null && changedUid !== void 0 ? changedUid : uid }),
|
|
57
|
+
onRulesChange: (rules, changedUid) => this.brickRulesChange.emit({ rules, uid: changedUid !== null && changedUid !== void 0 ? changedUid : uid }),
|
|
58
|
+
onDelete: (path) => this.brickRemove.emit({ path }),
|
|
59
|
+
onDuplicate: (path) => this.brickDuplicate.emit({ path }),
|
|
60
|
+
};
|
|
61
|
+
const node = (editing ? brick.renderBuilder(props) : brick.render(props));
|
|
62
|
+
if (!editing || this.path === '0')
|
|
63
|
+
return node;
|
|
64
|
+
return (h("fk-brick-actions", { path: this.path, selected: uid !== undefined && uid === this.selectedUid }, node));
|
|
65
|
+
}
|
|
66
|
+
static get is() { return "fk-brick-render"; }
|
|
67
|
+
static get properties() {
|
|
68
|
+
return {
|
|
69
|
+
"brickSpec": {
|
|
70
|
+
"type": "unknown",
|
|
71
|
+
"mutable": false,
|
|
72
|
+
"complexType": {
|
|
73
|
+
"original": "BrickSpec",
|
|
74
|
+
"resolved": "BrickSpec",
|
|
75
|
+
"references": {
|
|
76
|
+
"BrickSpec": {
|
|
77
|
+
"location": "import",
|
|
78
|
+
"path": "@streamline-pulse/formkrafter-core",
|
|
79
|
+
"id": "../core/dist/index.d.ts::BrickSpec",
|
|
80
|
+
"referenceLocation": "BrickSpec"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"required": true,
|
|
85
|
+
"optional": false,
|
|
86
|
+
"docs": {
|
|
87
|
+
"tags": [],
|
|
88
|
+
"text": ""
|
|
89
|
+
},
|
|
90
|
+
"getter": false,
|
|
91
|
+
"setter": false
|
|
92
|
+
},
|
|
93
|
+
"data": {
|
|
94
|
+
"type": "unknown",
|
|
95
|
+
"mutable": false,
|
|
96
|
+
"complexType": {
|
|
97
|
+
"original": "Record<string, unknown>",
|
|
98
|
+
"resolved": "string | unknown",
|
|
99
|
+
"references": {
|
|
100
|
+
"Record": {
|
|
101
|
+
"location": "global",
|
|
102
|
+
"id": "global::Record"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"required": false,
|
|
107
|
+
"optional": true,
|
|
108
|
+
"docs": {
|
|
109
|
+
"tags": [],
|
|
110
|
+
"text": ""
|
|
111
|
+
},
|
|
112
|
+
"getter": false,
|
|
113
|
+
"setter": false
|
|
114
|
+
},
|
|
115
|
+
"dataMap": {
|
|
116
|
+
"type": "unknown",
|
|
117
|
+
"mutable": false,
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "Record<string, unknown>",
|
|
120
|
+
"resolved": "string | unknown",
|
|
121
|
+
"references": {
|
|
122
|
+
"Record": {
|
|
123
|
+
"location": "global",
|
|
124
|
+
"id": "global::Record"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"required": false,
|
|
129
|
+
"optional": true,
|
|
130
|
+
"docs": {
|
|
131
|
+
"tags": [],
|
|
132
|
+
"text": ""
|
|
133
|
+
},
|
|
134
|
+
"getter": false,
|
|
135
|
+
"setter": false
|
|
136
|
+
},
|
|
137
|
+
"path": {
|
|
138
|
+
"type": "string",
|
|
139
|
+
"mutable": false,
|
|
140
|
+
"complexType": {
|
|
141
|
+
"original": "string",
|
|
142
|
+
"resolved": "string",
|
|
143
|
+
"references": {}
|
|
144
|
+
},
|
|
145
|
+
"required": false,
|
|
146
|
+
"optional": false,
|
|
147
|
+
"docs": {
|
|
148
|
+
"tags": [],
|
|
149
|
+
"text": ""
|
|
150
|
+
},
|
|
151
|
+
"getter": false,
|
|
152
|
+
"setter": false,
|
|
153
|
+
"reflect": false,
|
|
154
|
+
"attribute": "path",
|
|
155
|
+
"defaultValue": "'0'"
|
|
156
|
+
},
|
|
157
|
+
"editable": {
|
|
158
|
+
"type": "boolean",
|
|
159
|
+
"mutable": false,
|
|
160
|
+
"complexType": {
|
|
161
|
+
"original": "boolean",
|
|
162
|
+
"resolved": "boolean",
|
|
163
|
+
"references": {}
|
|
164
|
+
},
|
|
165
|
+
"required": false,
|
|
166
|
+
"optional": false,
|
|
167
|
+
"docs": {
|
|
168
|
+
"tags": [],
|
|
169
|
+
"text": ""
|
|
170
|
+
},
|
|
171
|
+
"getter": false,
|
|
172
|
+
"setter": false,
|
|
173
|
+
"reflect": false,
|
|
174
|
+
"attribute": "editable",
|
|
175
|
+
"defaultValue": "false"
|
|
176
|
+
},
|
|
177
|
+
"selectedUid": {
|
|
178
|
+
"type": "string",
|
|
179
|
+
"mutable": false,
|
|
180
|
+
"complexType": {
|
|
181
|
+
"original": "string",
|
|
182
|
+
"resolved": "string",
|
|
183
|
+
"references": {}
|
|
184
|
+
},
|
|
185
|
+
"required": false,
|
|
186
|
+
"optional": true,
|
|
187
|
+
"docs": {
|
|
188
|
+
"tags": [],
|
|
189
|
+
"text": ""
|
|
190
|
+
},
|
|
191
|
+
"getter": false,
|
|
192
|
+
"setter": false,
|
|
193
|
+
"reflect": false,
|
|
194
|
+
"attribute": "selected-uid"
|
|
195
|
+
},
|
|
196
|
+
"errors": {
|
|
197
|
+
"type": "unknown",
|
|
198
|
+
"mutable": false,
|
|
199
|
+
"complexType": {
|
|
200
|
+
"original": "Record<string, string>",
|
|
201
|
+
"resolved": "string",
|
|
202
|
+
"references": {
|
|
203
|
+
"Record": {
|
|
204
|
+
"location": "global",
|
|
205
|
+
"id": "global::Record"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"required": false,
|
|
210
|
+
"optional": false,
|
|
211
|
+
"docs": {
|
|
212
|
+
"tags": [],
|
|
213
|
+
"text": ""
|
|
214
|
+
},
|
|
215
|
+
"getter": false,
|
|
216
|
+
"setter": false,
|
|
217
|
+
"defaultValue": "{}"
|
|
218
|
+
},
|
|
219
|
+
"locale": {
|
|
220
|
+
"type": "string",
|
|
221
|
+
"mutable": false,
|
|
222
|
+
"complexType": {
|
|
223
|
+
"original": "string",
|
|
224
|
+
"resolved": "string",
|
|
225
|
+
"references": {}
|
|
226
|
+
},
|
|
227
|
+
"required": false,
|
|
228
|
+
"optional": true,
|
|
229
|
+
"docs": {
|
|
230
|
+
"tags": [],
|
|
231
|
+
"text": ""
|
|
232
|
+
},
|
|
233
|
+
"getter": false,
|
|
234
|
+
"setter": false,
|
|
235
|
+
"reflect": false,
|
|
236
|
+
"attribute": "locale"
|
|
237
|
+
},
|
|
238
|
+
"utils": {
|
|
239
|
+
"type": "unknown",
|
|
240
|
+
"mutable": false,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "Utils",
|
|
243
|
+
"resolved": "object & { validateForm: () => { isValid: boolean; }; }",
|
|
244
|
+
"references": {
|
|
245
|
+
"Utils": {
|
|
246
|
+
"location": "import",
|
|
247
|
+
"path": "@streamline-pulse/formkrafter-core",
|
|
248
|
+
"id": "../core/dist/index.d.ts::Utils",
|
|
249
|
+
"referenceLocation": "Utils"
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
"required": true,
|
|
254
|
+
"optional": false,
|
|
255
|
+
"docs": {
|
|
256
|
+
"tags": [],
|
|
257
|
+
"text": ""
|
|
258
|
+
},
|
|
259
|
+
"getter": false,
|
|
260
|
+
"setter": false
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
static get events() {
|
|
265
|
+
return [{
|
|
266
|
+
"method": "brickDataChange",
|
|
267
|
+
"name": "brickDataChange",
|
|
268
|
+
"bubbles": true,
|
|
269
|
+
"cancelable": true,
|
|
270
|
+
"composed": true,
|
|
271
|
+
"docs": {
|
|
272
|
+
"tags": [],
|
|
273
|
+
"text": ""
|
|
274
|
+
},
|
|
275
|
+
"complexType": {
|
|
276
|
+
"original": "Record<string, unknown>",
|
|
277
|
+
"resolved": "string | unknown",
|
|
278
|
+
"references": {
|
|
279
|
+
"Record": {
|
|
280
|
+
"location": "global",
|
|
281
|
+
"id": "global::Record"
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}, {
|
|
286
|
+
"method": "brickConfigsChange",
|
|
287
|
+
"name": "brickConfigsChange",
|
|
288
|
+
"bubbles": true,
|
|
289
|
+
"cancelable": true,
|
|
290
|
+
"composed": true,
|
|
291
|
+
"docs": {
|
|
292
|
+
"tags": [],
|
|
293
|
+
"text": ""
|
|
294
|
+
},
|
|
295
|
+
"complexType": {
|
|
296
|
+
"original": "BrickConfigsChangeDetail",
|
|
297
|
+
"resolved": "BrickConfigsChangeDetail",
|
|
298
|
+
"references": {
|
|
299
|
+
"BrickConfigsChangeDetail": {
|
|
300
|
+
"location": "import",
|
|
301
|
+
"path": "../../utils/events",
|
|
302
|
+
"id": "src/utils/events.ts::BrickConfigsChangeDetail",
|
|
303
|
+
"referenceLocation": "BrickConfigsChangeDetail"
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}, {
|
|
308
|
+
"method": "brickStylesChange",
|
|
309
|
+
"name": "brickStylesChange",
|
|
310
|
+
"bubbles": true,
|
|
311
|
+
"cancelable": true,
|
|
312
|
+
"composed": true,
|
|
313
|
+
"docs": {
|
|
314
|
+
"tags": [],
|
|
315
|
+
"text": ""
|
|
316
|
+
},
|
|
317
|
+
"complexType": {
|
|
318
|
+
"original": "BrickStylesChangeDetail",
|
|
319
|
+
"resolved": "BrickStylesChangeDetail",
|
|
320
|
+
"references": {
|
|
321
|
+
"BrickStylesChangeDetail": {
|
|
322
|
+
"location": "import",
|
|
323
|
+
"path": "../../utils/events",
|
|
324
|
+
"id": "src/utils/events.ts::BrickStylesChangeDetail",
|
|
325
|
+
"referenceLocation": "BrickStylesChangeDetail"
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}, {
|
|
330
|
+
"method": "brickValidationsChange",
|
|
331
|
+
"name": "brickValidationsChange",
|
|
332
|
+
"bubbles": true,
|
|
333
|
+
"cancelable": true,
|
|
334
|
+
"composed": true,
|
|
335
|
+
"docs": {
|
|
336
|
+
"tags": [],
|
|
337
|
+
"text": ""
|
|
338
|
+
},
|
|
339
|
+
"complexType": {
|
|
340
|
+
"original": "BrickValidationsChangeDetail",
|
|
341
|
+
"resolved": "BrickValidationsChangeDetail",
|
|
342
|
+
"references": {
|
|
343
|
+
"BrickValidationsChangeDetail": {
|
|
344
|
+
"location": "import",
|
|
345
|
+
"path": "../../utils/events",
|
|
346
|
+
"id": "src/utils/events.ts::BrickValidationsChangeDetail",
|
|
347
|
+
"referenceLocation": "BrickValidationsChangeDetail"
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}, {
|
|
352
|
+
"method": "brickRulesChange",
|
|
353
|
+
"name": "brickRulesChange",
|
|
354
|
+
"bubbles": true,
|
|
355
|
+
"cancelable": true,
|
|
356
|
+
"composed": true,
|
|
357
|
+
"docs": {
|
|
358
|
+
"tags": [],
|
|
359
|
+
"text": ""
|
|
360
|
+
},
|
|
361
|
+
"complexType": {
|
|
362
|
+
"original": "BrickRulesChangeDetail",
|
|
363
|
+
"resolved": "BrickRulesChangeDetail",
|
|
364
|
+
"references": {
|
|
365
|
+
"BrickRulesChangeDetail": {
|
|
366
|
+
"location": "import",
|
|
367
|
+
"path": "../../utils/events",
|
|
368
|
+
"id": "src/utils/events.ts::BrickRulesChangeDetail",
|
|
369
|
+
"referenceLocation": "BrickRulesChangeDetail"
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}, {
|
|
374
|
+
"method": "brickRemove",
|
|
375
|
+
"name": "brickRemove",
|
|
376
|
+
"bubbles": true,
|
|
377
|
+
"cancelable": true,
|
|
378
|
+
"composed": true,
|
|
379
|
+
"docs": {
|
|
380
|
+
"tags": [],
|
|
381
|
+
"text": ""
|
|
382
|
+
},
|
|
383
|
+
"complexType": {
|
|
384
|
+
"original": "BrickPathDetail",
|
|
385
|
+
"resolved": "BrickPathDetail",
|
|
386
|
+
"references": {
|
|
387
|
+
"BrickPathDetail": {
|
|
388
|
+
"location": "import",
|
|
389
|
+
"path": "../../utils/events",
|
|
390
|
+
"id": "src/utils/events.ts::BrickPathDetail",
|
|
391
|
+
"referenceLocation": "BrickPathDetail"
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}, {
|
|
396
|
+
"method": "brickDuplicate",
|
|
397
|
+
"name": "brickDuplicate",
|
|
398
|
+
"bubbles": true,
|
|
399
|
+
"cancelable": true,
|
|
400
|
+
"composed": true,
|
|
401
|
+
"docs": {
|
|
402
|
+
"tags": [],
|
|
403
|
+
"text": ""
|
|
404
|
+
},
|
|
405
|
+
"complexType": {
|
|
406
|
+
"original": "BrickPathDetail",
|
|
407
|
+
"resolved": "BrickPathDetail",
|
|
408
|
+
"references": {
|
|
409
|
+
"BrickPathDetail": {
|
|
410
|
+
"location": "import",
|
|
411
|
+
"path": "../../utils/events",
|
|
412
|
+
"id": "src/utils/events.ts::BrickPathDetail",
|
|
413
|
+
"referenceLocation": "BrickPathDetail"
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}];
|
|
418
|
+
}
|
|
419
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
:host .cm-editor {
|
|
6
|
+
min-height: 88px;
|
|
7
|
+
font-size: 0.75rem;
|
|
8
|
+
border: 1px solid var(--fk-color-border);
|
|
9
|
+
border-radius: calc(var(--fk-radius) / 2);
|
|
10
|
+
background: var(--fk-color-surface);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:host .cm-editor.cm-focused {
|
|
14
|
+
outline: none;
|
|
15
|
+
border-color: var(--fk-color-primary);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host .cm-gutters {
|
|
19
|
+
border-right: 1px solid var(--fk-color-border);
|
|
20
|
+
background: color-mix(in srgb, var(--fk-color-surface) 70%, transparent);
|
|
21
|
+
color: var(--fk-color-muted);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host .cm-content {
|
|
25
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
26
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { EditorState } from "@codemirror/state";
|
|
2
|
+
import { EditorView, keymap, lineNumbers, placeholder as cmPlaceholder, } from "@codemirror/view";
|
|
3
|
+
import { defaultKeymap, history, historyKeymap } from "@codemirror/commands";
|
|
4
|
+
import { defaultHighlightStyle, syntaxHighlighting } from "@codemirror/language";
|
|
5
|
+
import { javascript } from "@codemirror/lang-javascript";
|
|
6
|
+
export class FkCodeEditor {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.value = '';
|
|
9
|
+
this.placeholder = '';
|
|
10
|
+
}
|
|
11
|
+
componentDidLoad() {
|
|
12
|
+
this.view = new EditorView({
|
|
13
|
+
parent: this.host,
|
|
14
|
+
state: EditorState.create({
|
|
15
|
+
doc: this.value,
|
|
16
|
+
extensions: [
|
|
17
|
+
lineNumbers(),
|
|
18
|
+
history(),
|
|
19
|
+
keymap.of([...defaultKeymap, ...historyKeymap]),
|
|
20
|
+
javascript(),
|
|
21
|
+
syntaxHighlighting(defaultHighlightStyle),
|
|
22
|
+
cmPlaceholder(this.placeholder),
|
|
23
|
+
EditorView.domEventHandlers({
|
|
24
|
+
blur: () => this.emitIfChanged(),
|
|
25
|
+
}),
|
|
26
|
+
],
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
syncValue(next) {
|
|
31
|
+
if (!this.view || this.view.hasFocus)
|
|
32
|
+
return;
|
|
33
|
+
const current = this.view.state.doc.toString();
|
|
34
|
+
if (current !== next) {
|
|
35
|
+
this.view.dispatch({
|
|
36
|
+
changes: { from: 0, to: current.length, insert: next },
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
emitIfChanged() {
|
|
41
|
+
if (!this.view)
|
|
42
|
+
return;
|
|
43
|
+
const doc = this.view.state.doc.toString();
|
|
44
|
+
if (doc !== this.value)
|
|
45
|
+
this.codeChange.emit(doc);
|
|
46
|
+
}
|
|
47
|
+
disconnectedCallback() {
|
|
48
|
+
var _a;
|
|
49
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
50
|
+
this.view = undefined;
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
static get is() { return "fk-code-editor"; }
|
|
56
|
+
static get encapsulation() { return "scoped"; }
|
|
57
|
+
static get originalStyleUrls() {
|
|
58
|
+
return {
|
|
59
|
+
"$": ["fk-code-editor.css"]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
static get styleUrls() {
|
|
63
|
+
return {
|
|
64
|
+
"$": ["fk-code-editor.css"]
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
static get properties() {
|
|
68
|
+
return {
|
|
69
|
+
"value": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"mutable": false,
|
|
72
|
+
"complexType": {
|
|
73
|
+
"original": "string",
|
|
74
|
+
"resolved": "string",
|
|
75
|
+
"references": {}
|
|
76
|
+
},
|
|
77
|
+
"required": false,
|
|
78
|
+
"optional": false,
|
|
79
|
+
"docs": {
|
|
80
|
+
"tags": [],
|
|
81
|
+
"text": ""
|
|
82
|
+
},
|
|
83
|
+
"getter": false,
|
|
84
|
+
"setter": false,
|
|
85
|
+
"reflect": false,
|
|
86
|
+
"attribute": "value",
|
|
87
|
+
"defaultValue": "''"
|
|
88
|
+
},
|
|
89
|
+
"placeholder": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"mutable": false,
|
|
92
|
+
"complexType": {
|
|
93
|
+
"original": "string",
|
|
94
|
+
"resolved": "string",
|
|
95
|
+
"references": {}
|
|
96
|
+
},
|
|
97
|
+
"required": false,
|
|
98
|
+
"optional": false,
|
|
99
|
+
"docs": {
|
|
100
|
+
"tags": [],
|
|
101
|
+
"text": ""
|
|
102
|
+
},
|
|
103
|
+
"getter": false,
|
|
104
|
+
"setter": false,
|
|
105
|
+
"reflect": false,
|
|
106
|
+
"attribute": "placeholder",
|
|
107
|
+
"defaultValue": "''"
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
static get events() {
|
|
112
|
+
return [{
|
|
113
|
+
"method": "codeChange",
|
|
114
|
+
"name": "codeChange",
|
|
115
|
+
"bubbles": true,
|
|
116
|
+
"cancelable": true,
|
|
117
|
+
"composed": true,
|
|
118
|
+
"docs": {
|
|
119
|
+
"tags": [],
|
|
120
|
+
"text": ""
|
|
121
|
+
},
|
|
122
|
+
"complexType": {
|
|
123
|
+
"original": "string",
|
|
124
|
+
"resolved": "string",
|
|
125
|
+
"references": {}
|
|
126
|
+
}
|
|
127
|
+
}];
|
|
128
|
+
}
|
|
129
|
+
static get elementRef() { return "host"; }
|
|
130
|
+
static get watchers() {
|
|
131
|
+
return [{
|
|
132
|
+
"propName": "value",
|
|
133
|
+
"methodName": "syncValue"
|
|
134
|
+
}];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.fk-grid {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: var(--fk-spacing);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.fk-grid__empty {
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: var(--fk-spacing);
|
|
14
|
+
border: 1px dashed var(--fk-color-border);
|
|
15
|
+
border-radius: var(--fk-radius);
|
|
16
|
+
font-size: 0.85rem;
|
|
17
|
+
color: var(--fk-color-muted);
|
|
18
|
+
text-align: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.fk-grid__row {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: flex-start;
|
|
24
|
+
gap: var(--fk-spacing);
|
|
25
|
+
padding: var(--fk-spacing);
|
|
26
|
+
border: 1px solid var(--fk-color-border);
|
|
27
|
+
border-radius: var(--fk-radius);
|
|
28
|
+
background: color-mix(in srgb, var(--fk-color-surface) 60%, transparent);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.fk-grid__cells {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex: 1;
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
gap: var(--fk-spacing);
|
|
36
|
+
min-width: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.fk-grid__cells > * {
|
|
40
|
+
flex: 1;
|
|
41
|
+
min-width: 160px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.fk-grid__remove {
|
|
45
|
+
border: none;
|
|
46
|
+
background: transparent;
|
|
47
|
+
color: var(--fk-color-muted);
|
|
48
|
+
font-size: 0.8rem;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
padding: 4px 6px;
|
|
51
|
+
border-radius: calc(var(--fk-radius) / 2);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.fk-grid__remove:hover:not(:disabled) {
|
|
55
|
+
color: var(--fk-color-danger);
|
|
56
|
+
background: color-mix(in srgb, var(--fk-color-danger) 10%, transparent);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.fk-grid__add {
|
|
60
|
+
align-self: flex-start;
|
|
61
|
+
font: inherit;
|
|
62
|
+
font-size: 0.8rem;
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
padding: calc(var(--fk-spacing) / 1.5) var(--fk-spacing);
|
|
65
|
+
border: 1px dashed var(--fk-color-border);
|
|
66
|
+
border-radius: var(--fk-radius);
|
|
67
|
+
background: transparent;
|
|
68
|
+
color: var(--fk-color-muted);
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.fk-grid__add:hover:not(:disabled) {
|
|
73
|
+
border-color: var(--fk-color-primary);
|
|
74
|
+
color: var(--fk-color-primary);
|
|
75
|
+
}
|