@streamline-pulse/formkrafter-wc 0.1.1 → 0.3.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 +3 -3
- package/dist/cjs/fk-brick-actions_18.cjs.entry.js +258 -22476
- package/dist/cjs/formkrafter-wc.cjs.js +2 -2
- package/dist/cjs/index-Bhy1RJMV.js +3042 -0
- package/dist/cjs/{index-D_7eGIJ0.js → index-CImTe9BG.js} +40 -4
- package/dist/cjs/index-CdaT3-qx.js +5444 -0
- package/dist/cjs/{index-By4GGW_q.js → index-CkPPRg03.js} +237 -35
- package/dist/cjs/index-DHgK3reD.js +12233 -0
- package/dist/cjs/index-Ds0sDbXV.js +4019 -0
- package/dist/cjs/index-c9BL7y3N.js +1922 -0
- package/dist/cjs/index.cjs.js +3 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/fk-brick-render/fk-brick-render.js +31 -3
- package/dist/collection/components/fk-code-editor/fk-code-editor.js +17 -8
- package/dist/collection/components/fk-file-input/fk-file-input.css +26 -5
- package/dist/collection/components/fk-file-input/fk-file-input.js +96 -14
- package/dist/collection/components/fk-form-builder/fk-form-builder.css +30 -0
- package/dist/collection/components/fk-form-render/fk-form-render.js +1 -1
- package/dist/collection/components/fk-property-panel/fk-property-panel.js +5 -1
- package/dist/collection/components/fk-select-input/fk-select-input.css +9 -0
- package/dist/collection/components/fk-select-input/fk-select-input.js +118 -20
- package/dist/collection/components/fk-stepper/fk-stepper.css +14 -0
- package/dist/collection/components/fk-stepper/fk-stepper.js +4 -1
- package/dist/collection/components/fk-tabs/fk-tabs.js +15 -2
- package/dist/collection/i18n/i18n.js +20 -0
- package/dist/collection/index.js +1 -1
- package/dist/collection/registry/default-bricks.js +174 -34
- 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-B4vAN-UA.js → p--vL6GR31.js} +1 -1
- package/dist/components/p-4COASNrZ.js +1 -0
- package/dist/components/p-BB4Llg42.js +1 -0
- package/dist/components/p-BGkZP87K.js +1 -0
- package/dist/components/p-BOmBVgfJ.js +1 -0
- package/dist/components/p-BWdm2a6q.js +1 -0
- package/dist/components/{p-D318uFl-.js → p-B_-x-GlA.js} +1 -1
- package/dist/components/p-Br1s4Ujx.js +1 -0
- package/dist/components/p-C-wnqV3i.js +1 -0
- package/dist/components/{p-ZEW2q-4b.js → p-CIfjRTky.js} +1 -1
- package/dist/components/{p-dX7Lo8Fe.js → p-CKMHMpID.js} +1 -1
- package/dist/components/p-CUF31e-P.js +1 -0
- package/dist/components/p-CWQX0sXS.js +1 -0
- package/dist/components/p-D6n74M9d.js +1 -0
- package/dist/components/{p-DJDrDvoC.js → p-DFe3zZCI.js} +1 -1
- package/dist/components/p-DMCkrZqi.js +1 -0
- package/dist/components/p-DOInQkG6.js +1 -0
- package/dist/components/{p-BNREw7TY.js → p-DYchD23x.js} +1 -1
- package/dist/components/p-DtcM1yw5.js +1 -0
- package/dist/components/{p-BB3BQPr8.js → p-NDbmiiYk.js} +1 -1
- package/dist/components/p-PAr7WoWG.js +1 -0
- package/dist/components/{p-Ctt--jpe.js → p-YyGnQmX-.js} +1 -1
- package/dist/components/{p-DtzMNM4i.js → p-fDJP6whN.js} +1 -1
- package/dist/components/p-swxZqinH.js +1 -0
- package/dist/components/{p-BXFug2Ql.js → p-v7LxwCAc.js} +1 -1
- package/dist/components/p-wuC5rVU7.js +1 -0
- package/dist/esm/fk-brick-actions_18.entry.js +254 -22472
- package/dist/esm/formkrafter-wc.js +3 -3
- package/dist/esm/index-BAcz7b5u.js +5416 -0
- package/dist/esm/index-BkRMoLXK.js +3029 -0
- package/dist/esm/index-CGMDfZ5m.js +1808 -0
- package/dist/esm/{index-BTmZ8XET.js → index-D7Cta1UB.js} +236 -36
- package/dist/esm/index-DtcM1yw5.js +3991 -0
- package/dist/esm/index-DuVf3NlP.js +12222 -0
- package/dist/esm/{index-BQqrzKxo.js → index-qLZlXROB.js} +40 -4
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +3 -3
- 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-4COASNrZ.js +1 -0
- package/dist/formkrafter-wc/p-6d29555b.entry.js +1 -0
- package/dist/formkrafter-wc/p-C-wnqV3i.js +1 -0
- package/dist/formkrafter-wc/p-DMCkrZqi.js +1 -0
- package/dist/formkrafter-wc/p-DOInQkG6.js +1 -0
- package/dist/formkrafter-wc/{p-BXIsVlA6.js → p-Ddu6BquK.js} +4 -4
- package/dist/formkrafter-wc/p-DtcM1yw5.js +1 -0
- package/dist/formkrafter-wc/p-qLZlXROB.js +2 -0
- package/dist/types/components/fk-brick-render/fk-brick-render.d.ts +1 -0
- package/dist/types/components/fk-code-editor/fk-code-editor.d.ts +2 -1
- package/dist/types/components/fk-file-input/fk-file-input.d.ts +9 -2
- package/dist/types/components/fk-select-input/fk-select-input.d.ts +9 -0
- package/dist/types/components.d.ts +27 -4
- package/dist/types/home/runner/work/formkrafter/formkrafter/packages/wc/.stencil/stencil.config.d.ts +2 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/registry/default-bricks.d.ts +73 -54
- package/package.json +11 -2
- package/dist/components/p-BCQ-hj6j.js +0 -1
- package/dist/components/p-BIEpAM4V.js +0 -1
- package/dist/components/p-BLKRn62s.js +0 -1
- package/dist/components/p-BOvjVIvo.js +0 -1
- package/dist/components/p-BQP1WryV.js +0 -1
- package/dist/components/p-DKGyje7v.js +0 -1
- package/dist/components/p-DKoJovNt.js +0 -1
- package/dist/components/p-DWgjI3TW.js +0 -1
- package/dist/components/p-QC41Uj05.js +0 -1
- package/dist/components/p-TvmRksgg.js +0 -1
- package/dist/formkrafter-wc/p-BQqrzKxo.js +0 -2
- package/dist/formkrafter-wc/p-f6bc0be0.entry.js +0 -1
- package/dist/types/Users/datagnikan/Desktop/WorkSpace/streamline-pulse/formkrafter-js/formkrafter/packages/wc/.stencil/stencil.config.d.ts +0 -2
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var index$1 = require('./index-
|
|
3
|
+
var index = require('./index-CImTe9BG.js');
|
|
4
|
+
var index$1 = require('./index-CkPPRg03.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -30,6 +30,7 @@ exports.numberBrick = index$1.numberBrick;
|
|
|
30
30
|
exports.passwordBrick = index$1.passwordBrick;
|
|
31
31
|
exports.phoneBrick = index$1.phoneBrick;
|
|
32
32
|
exports.radioBrick = index$1.radioBrick;
|
|
33
|
+
exports.recapBrick = index$1.recapBrick;
|
|
33
34
|
exports.registerBrick = index$1.registerBrick;
|
|
34
35
|
exports.registerBricks = index$1.registerBricks;
|
|
35
36
|
exports.registerDefaultBricks = index$1.registerDefaultBricks;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-CImTe9BG.js');
|
|
4
4
|
var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
5
5
|
|
|
6
6
|
const defineCustomElements = async (win, options) => {
|
|
7
7
|
if (typeof window === 'undefined') return undefined;
|
|
8
8
|
await appGlobals.globalScripts();
|
|
9
|
-
return index.bootstrapLazy([["fk-brick-actions_18.cjs",[[2,"fk-form-builder",{"spec":[16],"data":[16],"locales":[16],"currentSpec":[32],"currentData":[32],"selectedUid":[32],"copied":[32],"importError":[32],"editLocale":[32]},[[0,"brickDrop","handleBrickDrop"],[0,"brickRemove","handleBrickRemove"],[0,"brickDuplicate","handleBrickDuplicate"],[0,"brickConfigsChange","handleConfigsChange"],[0,"brickStylesChange","handleStylesChange"],[0,"brickValidationsChange","handleValidationsChange"],[0,"brickRulesChange","handleRulesChange"],[0,"formDataChange","handleDataChange"],[4,"paste","handlePaste"],[0,"brickSelect","handleBrickSelect"]],{"spec":[{"syncSpec":0}]}],[2,"fk-data-grid",{"spec":[16],"value":[16],"disabled":[4],"locale":[1],"utils":[16],"touched":[32],"validateRows":[64]},[[0,"brickDataChange","handleRowChange"]]],[2,"fk-form-render",{"spec":[16],"data":[16],"editable":[4],"selectedUid":[1,"selected-uid"],"locale":[1],"currentData":[32],"touched":[32],"validate":[64]},[[0,"brickDataChange","handleBrickDataChange"],[0,"stepTouch","handleStepTouch"],[0,"stepperSubmit","handleStepperSubmit"]],{"data":[{"syncData":0}]}],[2,"fk-property-panel",{"brick":[16],"fields":[16],"locales":[16],"editLocale":[1,"edit-locale"],"activeTab":[32],"newStyleKey":[32]},null,{"brick":[{"onBrickChange":0}]}],[2,"fk-brick-list",{"query":[32],"collapsed":[32]}],[2,"fk-empty-form"],[2,"fk-file-input",{"value":[16],"disabled":[4],"accept":[1],"uploading":[32],"uploadError":[32]}],[2,"fk-select-input",{"configs":[16],"value":[1],"disabled":[4],"multiple":[4],"dataMap":[16],"open":[32],"query":[32],"remoteOptions":[32],"remoteError":[32]},null,{"configs":[{"onConfigsChange":0}],"dataMap":[{"onDataMapChange":0}]}],[2,"fk-signature-input",{"value":[1],"disabled":[4]},null,{"value":[{"onValueChange":0}]}],[262,"fk-stepper",{"stepLabels":[16],"editable":[4],"spec":[16],"dataMap":[16],"locale":[1],"active":[32]},null,{"stepLabels":[{"clampActive":0}]}],[262,"fk-tabs",{"tabLabels":[16],"editable":[4],"spec":[16],"dataMap":[16],"locale":[1],"active":[32]},null,{"tabLabels":[{"clampActive":0}]}],[2,"fk-rules-editor",{"brick":[16],"fields":[16],"forcedModes":[32],"jsonErrors":[32],"codeErrors":[32]}],[2,"fk-brick-mold-item",{"brickMold":[16],"isDragging":[32]}],[2,"fk-code-editor",{"value":[1],"placeholder":[1]},null,{"value":[{"syncValue":0}]}],[0,"fk-brick-render",{"brickSpec":[16],"data":[16],"dataMap":[16],"path":[1],"editable":[4],"selectedUid":[1,"selected-uid"],"errors":[16],"locale":[1],"utils":[16]}],[262,"fk-brick-actions",{"path":[1],"selected":[4],"isDragging":[32],"isDropTarget":[32]}],[262,"fk-brick-not-found"],[2,"fk-drop-area",{"path":[1],"isOver":[32]}]]]], options);
|
|
9
|
+
return index.bootstrapLazy([["fk-brick-actions_18.cjs",[[2,"fk-form-builder",{"spec":[16],"data":[16],"locales":[16],"currentSpec":[32],"currentData":[32],"selectedUid":[32],"copied":[32],"importError":[32],"editLocale":[32]},[[0,"brickDrop","handleBrickDrop"],[0,"brickRemove","handleBrickRemove"],[0,"brickDuplicate","handleBrickDuplicate"],[0,"brickConfigsChange","handleConfigsChange"],[0,"brickStylesChange","handleStylesChange"],[0,"brickValidationsChange","handleValidationsChange"],[0,"brickRulesChange","handleRulesChange"],[0,"formDataChange","handleDataChange"],[4,"paste","handlePaste"],[0,"brickSelect","handleBrickSelect"]],{"spec":[{"syncSpec":0}]}],[2,"fk-data-grid",{"spec":[16],"value":[16],"disabled":[4],"locale":[1],"utils":[16],"touched":[32],"validateRows":[64]},[[0,"brickDataChange","handleRowChange"]]],[2,"fk-form-render",{"spec":[16],"data":[16],"editable":[4],"selectedUid":[1,"selected-uid"],"locale":[1],"currentData":[32],"touched":[32],"validate":[64]},[[0,"brickDataChange","handleBrickDataChange"],[0,"stepTouch","handleStepTouch"],[0,"stepperSubmit","handleStepperSubmit"]],{"data":[{"syncData":0}]}],[2,"fk-property-panel",{"brick":[16],"fields":[16],"locales":[16],"editLocale":[1,"edit-locale"],"activeTab":[32],"newStyleKey":[32]},null,{"brick":[{"onBrickChange":0}]}],[2,"fk-brick-list",{"query":[32],"collapsed":[32]}],[2,"fk-empty-form"],[2,"fk-file-input",{"value":[16],"disabled":[4],"accept":[1],"uploadUrl":[1,"upload-url"],"multiple":[4],"uploading":[32],"removingUrl":[32],"uploadError":[32]}],[2,"fk-select-input",{"configs":[16],"value":[1],"disabled":[4],"multiple":[4],"invalid":[4],"dataMap":[16],"open":[32],"query":[32],"activeIndex":[32],"remoteOptions":[32],"remoteError":[32]},null,{"configs":[{"onConfigsChange":0}],"dataMap":[{"onDataMapChange":0}]}],[2,"fk-signature-input",{"value":[1],"disabled":[4]},null,{"value":[{"onValueChange":0}]}],[262,"fk-stepper",{"stepLabels":[16],"editable":[4],"spec":[16],"dataMap":[16],"locale":[1],"active":[32]},null,{"stepLabels":[{"clampActive":0}]}],[262,"fk-tabs",{"tabLabels":[16],"editable":[4],"spec":[16],"dataMap":[16],"locale":[1],"active":[32]},null,{"tabLabels":[{"clampActive":0}]}],[2,"fk-rules-editor",{"brick":[16],"fields":[16],"forcedModes":[32],"jsonErrors":[32],"codeErrors":[32]}],[2,"fk-brick-mold-item",{"brickMold":[16],"isDragging":[32]}],[2,"fk-code-editor",{"value":[1],"placeholder":[1]},null,{"value":[{"syncValue":0}]}],[0,"fk-brick-render",{"brickSpec":[16],"rootSpec":[16],"data":[16],"dataMap":[16],"path":[1],"editable":[4],"selectedUid":[1,"selected-uid"],"errors":[16],"locale":[1],"utils":[16]}],[262,"fk-brick-actions",{"path":[1],"selected":[4],"isDragging":[32],"isDropTarget":[32]}],[262,"fk-brick-not-found"],[2,"fk-drop-area",{"path":[1],"isOver":[32]}]]]], options);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|
|
@@ -9,7 +9,7 @@ export class FkBrickRender {
|
|
|
9
9
|
this.errors = {};
|
|
10
10
|
}
|
|
11
11
|
render() {
|
|
12
|
-
var _a, _b, _c, _d, _e;
|
|
12
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13
13
|
const spec = this.brickSpec;
|
|
14
14
|
if (!spec)
|
|
15
15
|
return null;
|
|
@@ -23,7 +23,10 @@ export class FkBrickRender {
|
|
|
23
23
|
return null;
|
|
24
24
|
const isContainer = spec.type === 'panel' || spec.type === 'collection';
|
|
25
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) =>
|
|
26
|
+
const childNodes = ((_c = spec.children) !== null && _c !== void 0 ? _c : []).map((childSpec, index) => {
|
|
27
|
+
var _a;
|
|
28
|
+
return (h("fk-brick-render", { brickSpec: childSpec, rootSpec: (_a = this.rootSpec) !== null && _a !== void 0 ? _a : this.brickSpec, 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 }));
|
|
29
|
+
});
|
|
27
30
|
if (editing && isContainer) {
|
|
28
31
|
childNodes.push(h("fk-drop-area", { path: this.path }));
|
|
29
32
|
}
|
|
@@ -35,7 +38,8 @@ export class FkBrickRender {
|
|
|
35
38
|
styles: (_d = spec.styles) !== null && _d !== void 0 ? _d : {},
|
|
36
39
|
data: getBrickData(spec, this.data),
|
|
37
40
|
dataMap: this.dataMap,
|
|
38
|
-
|
|
41
|
+
rootSpec: (_e = this.rootSpec) !== null && _e !== void 0 ? _e : this.brickSpec,
|
|
42
|
+
error: ((_f = spec.configs) === null || _f === void 0 ? void 0 : _f.key) ? this.errors[spec.configs.key] : undefined,
|
|
39
43
|
disabled: editing ? false : affected.disabled === true,
|
|
40
44
|
path: this.path,
|
|
41
45
|
editable: editing,
|
|
@@ -90,6 +94,30 @@ export class FkBrickRender {
|
|
|
90
94
|
"getter": false,
|
|
91
95
|
"setter": false
|
|
92
96
|
},
|
|
97
|
+
"rootSpec": {
|
|
98
|
+
"type": "unknown",
|
|
99
|
+
"mutable": false,
|
|
100
|
+
"complexType": {
|
|
101
|
+
"original": "BrickSpec",
|
|
102
|
+
"resolved": "BrickSpec",
|
|
103
|
+
"references": {
|
|
104
|
+
"BrickSpec": {
|
|
105
|
+
"location": "import",
|
|
106
|
+
"path": "@streamline-pulse/formkrafter-core",
|
|
107
|
+
"id": "../core/dist/index.d.ts::BrickSpec",
|
|
108
|
+
"referenceLocation": "BrickSpec"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"required": false,
|
|
113
|
+
"optional": true,
|
|
114
|
+
"docs": {
|
|
115
|
+
"tags": [],
|
|
116
|
+
"text": ""
|
|
117
|
+
},
|
|
118
|
+
"getter": false,
|
|
119
|
+
"setter": false
|
|
120
|
+
},
|
|
93
121
|
"data": {
|
|
94
122
|
"type": "unknown",
|
|
95
123
|
"mutable": false,
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
const fetchCodeMirror = () => Promise.all([
|
|
2
|
+
import('@codemirror/state'),
|
|
3
|
+
import('@codemirror/view'),
|
|
4
|
+
import('@codemirror/commands'),
|
|
5
|
+
import('@codemirror/language'),
|
|
6
|
+
import('@codemirror/lang-javascript'),
|
|
7
|
+
]);
|
|
8
|
+
let codeMirrorModules;
|
|
9
|
+
const loadCodeMirror = () => (codeMirrorModules !== null && codeMirrorModules !== void 0 ? codeMirrorModules : (codeMirrorModules = fetchCodeMirror()));
|
|
6
10
|
export class FkCodeEditor {
|
|
7
11
|
constructor() {
|
|
8
12
|
this.value = '';
|
|
9
13
|
this.placeholder = '';
|
|
14
|
+
this.disconnected = false;
|
|
10
15
|
}
|
|
11
|
-
componentDidLoad() {
|
|
12
|
-
|
|
16
|
+
async componentDidLoad() {
|
|
17
|
+
const [{ EditorState }, { EditorView: View, keymap, lineNumbers, placeholder: cmPlaceholder }, { defaultKeymap, history, historyKeymap }, { defaultHighlightStyle, syntaxHighlighting }, { javascript },] = await loadCodeMirror();
|
|
18
|
+
if (this.disconnected)
|
|
19
|
+
return;
|
|
20
|
+
this.view = new View({
|
|
13
21
|
parent: this.host,
|
|
14
22
|
state: EditorState.create({
|
|
15
23
|
doc: this.value,
|
|
@@ -20,7 +28,7 @@ export class FkCodeEditor {
|
|
|
20
28
|
javascript(),
|
|
21
29
|
syntaxHighlighting(defaultHighlightStyle),
|
|
22
30
|
cmPlaceholder(this.placeholder),
|
|
23
|
-
|
|
31
|
+
View.domEventHandlers({
|
|
24
32
|
blur: () => this.emitIfChanged(),
|
|
25
33
|
}),
|
|
26
34
|
],
|
|
@@ -46,6 +54,7 @@ export class FkCodeEditor {
|
|
|
46
54
|
}
|
|
47
55
|
disconnectedCallback() {
|
|
48
56
|
var _a;
|
|
57
|
+
this.disconnected = true;
|
|
49
58
|
(_a = this.view) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
50
59
|
this.view = undefined;
|
|
51
60
|
}
|
|
@@ -37,14 +37,29 @@
|
|
|
37
37
|
.fk-file__selected {
|
|
38
38
|
display: flex;
|
|
39
39
|
align-items: center;
|
|
40
|
-
gap:
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
gap: var(--fk-spacing);
|
|
41
|
+
width: 100%;
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
padding: calc(var(--fk-spacing) * 0.75) var(--fk-spacing);
|
|
43
44
|
border: 1px solid var(--fk-color-border);
|
|
44
45
|
border-radius: var(--fk-radius);
|
|
45
46
|
background: var(--fk-color-surface);
|
|
46
47
|
}
|
|
47
48
|
|
|
49
|
+
.fk-file__icon {
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
flex-shrink: 0;
|
|
52
|
+
color: var(--fk-color-primary);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.fk-file__meta {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
gap: 2px;
|
|
59
|
+
flex: 1;
|
|
60
|
+
min-width: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
48
63
|
.fk-file__name {
|
|
49
64
|
font-size: 0.85rem;
|
|
50
65
|
font-weight: 600;
|
|
@@ -64,9 +79,15 @@
|
|
|
64
79
|
border: none;
|
|
65
80
|
background: transparent;
|
|
66
81
|
color: var(--fk-color-muted);
|
|
67
|
-
font-size: 0.
|
|
82
|
+
font-size: 0.8rem;
|
|
68
83
|
cursor: pointer;
|
|
69
|
-
padding:
|
|
84
|
+
padding: 4px 6px;
|
|
85
|
+
border-radius: calc(var(--fk-radius) / 2);
|
|
86
|
+
flex-shrink: 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.fk-file__remove:hover:not(:disabled) {
|
|
90
|
+
background: color-mix(in srgb, var(--fk-color-danger) 12%, transparent);
|
|
70
91
|
}
|
|
71
92
|
|
|
72
93
|
.fk-file__remove:hover:not(:disabled) {
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { services } from "@streamline-pulse/formkrafter-core";
|
|
3
|
-
import { fkT } from "../../i18n/i18n";
|
|
3
|
+
import { fkT, fkTOr } from "../../i18n/i18n";
|
|
4
4
|
export class FkFileInput {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.disabled = false;
|
|
7
|
+
this.multiple = false;
|
|
7
8
|
this.uploading = false;
|
|
8
9
|
this.handleFile = async (event) => {
|
|
9
10
|
var _a;
|
|
10
11
|
const input = event.target;
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
12
|
+
const selected = Array.from((_a = input.files) !== null && _a !== void 0 ? _a : []);
|
|
13
|
+
if (!selected.length)
|
|
13
14
|
return;
|
|
14
15
|
this.uploading = true;
|
|
15
16
|
this.uploadError = undefined;
|
|
16
17
|
try {
|
|
17
|
-
const uploaded =
|
|
18
|
-
this.
|
|
18
|
+
const uploaded = [];
|
|
19
|
+
for (const file of this.multiple ? selected : selected.slice(0, 1)) {
|
|
20
|
+
uploaded.push(await services.fileUploadService.upload(file, { url: this.uploadUrl }));
|
|
21
|
+
}
|
|
22
|
+
this.emitFiles(this.multiple ? [...this.files, ...uploaded] : uploaded);
|
|
19
23
|
}
|
|
20
24
|
catch (error) {
|
|
21
25
|
this.uploadError =
|
|
@@ -26,6 +30,34 @@ export class FkFileInput {
|
|
|
26
30
|
input.value = '';
|
|
27
31
|
}
|
|
28
32
|
};
|
|
33
|
+
this.handleRemove = async (file) => {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
this.removingUrl = file.url;
|
|
36
|
+
this.uploadError = undefined;
|
|
37
|
+
try {
|
|
38
|
+
await ((_b = (_a = services.fileUploadService).remove) === null || _b === void 0 ? void 0 : _b.call(_a, file, { url: this.uploadUrl }));
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
this.uploadError = error instanceof Error ? error.message : String(error);
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
this.removingUrl = undefined;
|
|
45
|
+
this.emitFiles(this.files.filter((item) => item !== file));
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
get files() {
|
|
50
|
+
if (Array.isArray(this.value))
|
|
51
|
+
return this.value;
|
|
52
|
+
return this.value ? [this.value] : [];
|
|
53
|
+
}
|
|
54
|
+
emitFiles(files) {
|
|
55
|
+
if (this.multiple) {
|
|
56
|
+
this.fileValueChange.emit(files.length ? files : undefined);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this.fileValueChange.emit(files[0]);
|
|
60
|
+
}
|
|
29
61
|
}
|
|
30
62
|
formatSize(size) {
|
|
31
63
|
if (size < 1024)
|
|
@@ -34,15 +66,25 @@ export class FkFileInput {
|
|
|
34
66
|
return `${(size / 1024).toFixed(1)} KB`;
|
|
35
67
|
return `${(size / (1024 * 1024)).toFixed(1)} MB`;
|
|
36
68
|
}
|
|
37
|
-
|
|
38
|
-
|
|
69
|
+
renderFile(file) {
|
|
70
|
+
const removing = this.removingUrl !== undefined && this.removingUrl === file.url;
|
|
71
|
+
return (h("div", { class: "fk-file__selected", key: `${file.url}:${file.name}` }, h("span", { class: "fk-file__icon", "aria-hidden": "true" }, h("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), h("polyline", { points: "14 2 14 8 20 8" }))), h("span", { class: "fk-file__meta" }, h("span", { class: "fk-file__name", title: file.name }, file.name), h("span", { class: "fk-file__size" }, this.formatSize(file.size))), h("button", { type: "button", class: "fk-file__remove", title: fkT('file.remove'), disabled: this.disabled || removing, onClick: (event) => {
|
|
39
72
|
event.preventDefault();
|
|
40
|
-
this.
|
|
41
|
-
} },
|
|
73
|
+
void this.handleRemove(file);
|
|
74
|
+
} }, removing ? '…' : '✕')));
|
|
75
|
+
}
|
|
76
|
+
render() {
|
|
77
|
+
const files = this.files;
|
|
78
|
+
const showChoose = this.multiple || files.length === 0;
|
|
79
|
+
return (h("div", { key: '883cb0627b948d807f59ed5c62e44b0db421c3c6', class: "fk-file" }, files.map((file) => this.renderFile(file)), showChoose ? (h("button", { type: "button", class: "fk-file__choose", disabled: this.disabled || this.uploading, onClick: (event) => {
|
|
42
80
|
var _a;
|
|
43
81
|
event.preventDefault();
|
|
44
82
|
(_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.click();
|
|
45
|
-
} }, this.uploading
|
|
83
|
+
} }, this.uploading
|
|
84
|
+
? fkT('file.uploading')
|
|
85
|
+
: this.multiple && files.length
|
|
86
|
+
? fkTOr('file.addAnother', '+ Add a file')
|
|
87
|
+
: fkT('file.choose'))) : null, h("input", { key: 'a35947614d82f94eba8453b1f43382d2754cb36f', class: "fk-file__native", type: "file", accept: this.accept, multiple: this.multiple, disabled: this.disabled, ref: (element) => (this.inputEl = element), onChange: this.handleFile }), this.uploadError ? (h("span", { class: "fk-field__error" }, this.uploadError)) : null));
|
|
46
88
|
}
|
|
47
89
|
static get is() { return "fk-file-input"; }
|
|
48
90
|
static get encapsulation() { return "scoped"; }
|
|
@@ -62,8 +104,8 @@ export class FkFileInput {
|
|
|
62
104
|
"type": "unknown",
|
|
63
105
|
"mutable": false,
|
|
64
106
|
"complexType": {
|
|
65
|
-
"original": "UploadedFile",
|
|
66
|
-
"resolved": "UploadedFile",
|
|
107
|
+
"original": "UploadedFile | UploadedFile[]",
|
|
108
|
+
"resolved": "UploadedFile | UploadedFile[]",
|
|
67
109
|
"references": {
|
|
68
110
|
"UploadedFile": {
|
|
69
111
|
"location": "import",
|
|
@@ -120,12 +162,52 @@ export class FkFileInput {
|
|
|
120
162
|
"setter": false,
|
|
121
163
|
"reflect": false,
|
|
122
164
|
"attribute": "accept"
|
|
165
|
+
},
|
|
166
|
+
"uploadUrl": {
|
|
167
|
+
"type": "string",
|
|
168
|
+
"mutable": false,
|
|
169
|
+
"complexType": {
|
|
170
|
+
"original": "string",
|
|
171
|
+
"resolved": "string",
|
|
172
|
+
"references": {}
|
|
173
|
+
},
|
|
174
|
+
"required": false,
|
|
175
|
+
"optional": true,
|
|
176
|
+
"docs": {
|
|
177
|
+
"tags": [],
|
|
178
|
+
"text": ""
|
|
179
|
+
},
|
|
180
|
+
"getter": false,
|
|
181
|
+
"setter": false,
|
|
182
|
+
"reflect": false,
|
|
183
|
+
"attribute": "upload-url"
|
|
184
|
+
},
|
|
185
|
+
"multiple": {
|
|
186
|
+
"type": "boolean",
|
|
187
|
+
"mutable": false,
|
|
188
|
+
"complexType": {
|
|
189
|
+
"original": "boolean",
|
|
190
|
+
"resolved": "boolean",
|
|
191
|
+
"references": {}
|
|
192
|
+
},
|
|
193
|
+
"required": false,
|
|
194
|
+
"optional": false,
|
|
195
|
+
"docs": {
|
|
196
|
+
"tags": [],
|
|
197
|
+
"text": ""
|
|
198
|
+
},
|
|
199
|
+
"getter": false,
|
|
200
|
+
"setter": false,
|
|
201
|
+
"reflect": false,
|
|
202
|
+
"attribute": "multiple",
|
|
203
|
+
"defaultValue": "false"
|
|
123
204
|
}
|
|
124
205
|
};
|
|
125
206
|
}
|
|
126
207
|
static get states() {
|
|
127
208
|
return {
|
|
128
209
|
"uploading": {},
|
|
210
|
+
"removingUrl": {},
|
|
129
211
|
"uploadError": {}
|
|
130
212
|
};
|
|
131
213
|
}
|
|
@@ -141,8 +223,8 @@ export class FkFileInput {
|
|
|
141
223
|
"text": ""
|
|
142
224
|
},
|
|
143
225
|
"complexType": {
|
|
144
|
-
"original": "UploadedFile | undefined",
|
|
145
|
-
"resolved": "UploadedFile",
|
|
226
|
+
"original": "UploadedFile | UploadedFile[] | undefined",
|
|
227
|
+
"resolved": "UploadedFile | UploadedFile[]",
|
|
146
228
|
"references": {
|
|
147
229
|
"UploadedFile": {
|
|
148
230
|
"location": "import",
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
container-type: inline-size;
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
.fk-builder {
|
|
2
7
|
display: flex;
|
|
3
8
|
gap: calc(var(--fk-spacing) * 2);
|
|
@@ -6,6 +11,30 @@
|
|
|
6
11
|
color: var(--fk-color-text);
|
|
7
12
|
}
|
|
8
13
|
|
|
14
|
+
@container (max-width: 820px) {
|
|
15
|
+
.fk-builder {
|
|
16
|
+
flex-wrap: wrap;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.fk-builder__palette,
|
|
20
|
+
.fk-builder__inspector {
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.fk-builder__main {
|
|
25
|
+
order: 2;
|
|
26
|
+
flex-basis: 100%;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.fk-builder__palette {
|
|
30
|
+
order: 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.fk-builder__inspector {
|
|
34
|
+
order: 3;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
9
38
|
.fk-builder__palette {
|
|
10
39
|
width: 220px;
|
|
11
40
|
flex-shrink: 0;
|
|
@@ -64,6 +93,7 @@
|
|
|
64
93
|
border: 1px solid var(--fk-color-border);
|
|
65
94
|
border-radius: var(--fk-radius);
|
|
66
95
|
background: var(--fk-color-surface);
|
|
96
|
+
overflow-x: auto;
|
|
67
97
|
}
|
|
68
98
|
|
|
69
99
|
.fk-builder__inspector {
|
|
@@ -107,7 +107,7 @@ export class FkFormRender {
|
|
|
107
107
|
render() {
|
|
108
108
|
if (!this.spec)
|
|
109
109
|
return null;
|
|
110
|
-
return (h("form", { class: "fk-form", onSubmit: (event) => event.preventDefault() }, h("fk-brick-render", { brickSpec: this.spec, data: this.currentData, dataMap: this.currentData, errors: this.visibleErrors(), locale: this.locale, path: "0", editable: this.editable, selectedUid: this.selectedUid, utils: this.utils })));
|
|
110
|
+
return (h("form", { class: "fk-form", onSubmit: (event) => event.preventDefault() }, h("fk-brick-render", { brickSpec: this.spec, rootSpec: this.spec, data: this.currentData, dataMap: this.currentData, errors: this.visibleErrors(), locale: this.locale, path: "0", editable: this.editable, selectedUid: this.selectedUid, utils: this.utils })));
|
|
111
111
|
}
|
|
112
112
|
static get is() { return "fk-form-render"; }
|
|
113
113
|
static get encapsulation() { return "scoped"; }
|
|
@@ -133,6 +133,10 @@ export class FkPropertyPanel {
|
|
|
133
133
|
this.textField(fkT('panel.prefix'), configs === null || configs === void 0 ? void 0 : configs.prefix, (value) => this.emitConfigs({ prefix: value || undefined })),
|
|
134
134
|
this.textField(fkT('panel.suffix'), configs === null || configs === void 0 ? void 0 : configs.suffix, (value) => this.emitConfigs({ suffix: value || undefined })),
|
|
135
135
|
]
|
|
136
|
+
: null, configs && 'accept' in configs
|
|
137
|
+
? this.textField(fkTOr('panel.accept', 'Accepted file types'), configs.accept, (value) => this.emitConfigs({ accept: value }))
|
|
138
|
+
: null, configs && 'uploadUrl' in configs
|
|
139
|
+
? this.textField(fkTOr('panel.uploadUrl', 'Upload URL'), configs.uploadUrl, (value) => this.emitConfigs({ uploadUrl: value }))
|
|
136
140
|
: null, this.optionsFields(), Object.entries(configs !== null && configs !== void 0 ? configs : {})
|
|
137
141
|
.filter(([, value]) => typeof value === 'boolean')
|
|
138
142
|
.map(([key, value]) => (h("label", { class: "fk-props__field fk-props__field--inline", key: key }, h("input", { type: "checkbox", checked: value === true, onChange: (event) => this.emitConfigs({
|
|
@@ -200,7 +204,7 @@ export class FkPropertyPanel {
|
|
|
200
204
|
} }))));
|
|
201
205
|
}
|
|
202
206
|
render() {
|
|
203
|
-
return (h("div", { key: '
|
|
207
|
+
return (h("div", { key: '095fc127131cc509f0fb27ae2853042d3ca97e8f', class: "fk-props" }, h("header", { key: '5e5c3eb0cc844dbc023336c93e7b347bc87f5501', class: "fk-props__header" }, h("span", { key: 'f01a54c31c5885741c3671bbcd2bb46ec9deff32', class: "fk-props__type" }, this.brick.type), h("h4", { key: 'a558c48e018a228084eeac289b98e76495d7e630', class: "fk-props__title" }, fkTOr(`brick.${this.brick.id}.name`, this.brick.name))), h("div", { key: 'c11ee0bf0f17754abc00b561fef398bf9cdd9416', class: "fk-props__tabs" }, this.availableTabs().map((tab) => (h("button", { key: tab.id, type: "button", class: {
|
|
204
208
|
'fk-props__tab': true,
|
|
205
209
|
'fk-props__tab--active': this.activeTab === tab.id,
|
|
206
210
|
}, onClick: () => (this.activeTab = tab.id) }, tab.label)))), this.activeTab === 'config' ? this.renderConfigTab() : null, this.activeTab === 'validation' ? this.renderValidationTab() : null, this.activeTab === 'styles' ? this.renderStylesTab() : null, this.activeTab === 'rules' ? (h("section", { class: "fk-props__section" }, h("fk-rules-editor", { brick: this.brick, fields: this.fields }))) : null));
|
|
@@ -142,3 +142,12 @@
|
|
|
142
142
|
font-size: 0.85rem;
|
|
143
143
|
color: var(--fk-color-muted);
|
|
144
144
|
}
|
|
145
|
+
|
|
146
|
+
.fk-select__trigger:focus-visible {
|
|
147
|
+
outline: 2px solid color-mix(in srgb, var(--fk-color-primary) 55%, transparent);
|
|
148
|
+
outline-offset: 1px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.fk-select__option--active {
|
|
152
|
+
background: color-mix(in srgb, var(--fk-color-primary) 12%, transparent);
|
|
153
|
+
}
|