@streamline-pulse/formkrafter-wc 0.1.0 → 0.2.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 +41 -40
- package/dist/cjs/formkrafter-wc.cjs.js +2 -2
- package/dist/cjs/{index-By4GGW_q.js → index-Can2MpG5.js} +215 -23
- package/dist/cjs/{index-D_7eGIJ0.js → index-CbyFxLc_.js} +26 -2
- 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-file-input/fk-file-input.css +26 -5
- package/dist/collection/components/fk-file-input/fk-file-input.js +45 -6
- 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/i18n/i18n.js +12 -0
- package/dist/collection/index.js +1 -1
- package/dist/collection/registry/default-bricks.js +161 -23
- 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-B0YjIsVn.js} +1 -1
- package/dist/components/{p-BIEpAM4V.js → p-B1t0M_hN.js} +1 -1
- package/dist/components/p-B21cOFRx.js +1 -0
- package/dist/components/{p-DWgjI3TW.js → p-B7ED8qMb.js} +1 -1
- package/dist/components/{p-ZEW2q-4b.js → p-BDvqHJih.js} +1 -1
- package/dist/components/{p-BXFug2Ql.js → p-BSPTuA1p.js} +1 -1
- package/dist/components/{p-BNREw7TY.js → p-BVBfbMl_.js} +1 -1
- package/dist/components/p-BrOXMyOG.js +1 -0
- package/dist/components/{p-DtzMNM4i.js → p-C85zhhpr.js} +1 -1
- package/dist/components/p-CMQ_4Zfv.js +1 -0
- package/dist/components/p-CWQX0sXS.js +1 -0
- package/dist/components/{p-DJDrDvoC.js → p-CXEvsomA.js} +1 -1
- package/dist/components/{p-BCQ-hj6j.js → p-Cq9HSEn8.js} +1 -1
- package/dist/components/{p-BQP1WryV.js → p-D7bf2ztq.js} +1 -1
- package/dist/components/{p-DKGyje7v.js → p-DIPoAaGe.js} +1 -1
- package/dist/components/p-DYBirEew.js +1 -0
- package/dist/components/p-DluDp8V5.js +1 -0
- package/dist/components/{p-BLKRn62s.js → p-Do6-yRva.js} +1 -1
- package/dist/components/{p-D318uFl-.js → p-GjmAhT2E.js} +1 -1
- package/dist/components/{p-dX7Lo8Fe.js → p-LXnm2ogM.js} +1 -1
- package/dist/components/{p-Ctt--jpe.js → p-y0xDvzJR.js} +1 -1
- package/dist/esm/fk-brick-actions_18.entry.js +37 -36
- package/dist/esm/formkrafter-wc.js +3 -3
- package/dist/esm/{index-BTmZ8XET.js → index-BB2OOj__.js} +214 -24
- package/dist/esm/{index-BQqrzKxo.js → index-DMDO6w5-.js} +26 -2
- 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-0de7cbe1.entry.js +1 -0
- package/dist/formkrafter-wc/{p-BXIsVlA6.js → p-Bp_A8oL5.js} +4 -4
- package/dist/formkrafter-wc/p-DMDO6w5-.js +2 -0
- package/dist/types/components/fk-brick-render/fk-brick-render.d.ts +1 -0
- package/dist/types/components/fk-file-input/fk-file-input.d.ts +3 -0
- package/dist/types/components.d.ts +5 -0
- 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-BB3BQPr8.js +0 -1
- package/dist/components/p-BOvjVIvo.js +0 -1
- package/dist/components/p-DKoJovNt.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
|
@@ -8,6 +8,10 @@ const BUILD = /* formkrafter-wc */ { hotModuleReplacement: false, hydratedSelect
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
// src/utils/constants.ts
|
|
12
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
13
|
+
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
14
|
+
|
|
11
15
|
// src/utils/get-prop-descriptor.ts
|
|
12
16
|
function getPropertyDescriptor(obj, memberName, getOnly) {
|
|
13
17
|
const stopAt = typeof HTMLElement !== "undefined" ? HTMLElement.prototype : null;
|
|
@@ -828,12 +832,19 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
828
832
|
updateElement(null, newVNode2, isSvgMode);
|
|
829
833
|
}
|
|
830
834
|
} else {
|
|
835
|
+
if (!isSvgMode) {
|
|
836
|
+
isSvgMode = newVNode2.$tag$ === "svg";
|
|
837
|
+
}
|
|
831
838
|
if (!win.document) {
|
|
832
839
|
throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
|
|
833
840
|
}
|
|
834
|
-
elm = newVNode2.$elm$ = win.document.
|
|
841
|
+
elm = newVNode2.$elm$ = win.document.createElementNS(
|
|
842
|
+
isSvgMode ? SVG_NS : HTML_NS,
|
|
835
843
|
!useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
836
|
-
);
|
|
844
|
+
) ;
|
|
845
|
+
if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
|
846
|
+
isSvgMode = false;
|
|
847
|
+
}
|
|
837
848
|
{
|
|
838
849
|
updateElement(null, newVNode2, isSvgMode);
|
|
839
850
|
}
|
|
@@ -849,6 +860,13 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
849
860
|
}
|
|
850
861
|
}
|
|
851
862
|
}
|
|
863
|
+
{
|
|
864
|
+
if (newVNode2.$tag$ === "svg") {
|
|
865
|
+
isSvgMode = false;
|
|
866
|
+
} else if (elm.tagName === "foreignObject") {
|
|
867
|
+
isSvgMode = true;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
852
870
|
}
|
|
853
871
|
elm["s-hn"] = hostTagName;
|
|
854
872
|
{
|
|
@@ -1070,6 +1088,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
1070
1088
|
const text = newVNode2.$text$;
|
|
1071
1089
|
let defaultHolder;
|
|
1072
1090
|
if (text == null) {
|
|
1091
|
+
{
|
|
1092
|
+
isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
|
|
1093
|
+
}
|
|
1073
1094
|
{
|
|
1074
1095
|
if (tag === "slot" && !useNativeShadowDom) {
|
|
1075
1096
|
if (oldVNode.$name$ !== newVNode2.$name$) {
|
|
@@ -1092,6 +1113,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
1092
1113
|
) {
|
|
1093
1114
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
1094
1115
|
} else ;
|
|
1116
|
+
if (isSvgMode && tag === "svg") {
|
|
1117
|
+
isSvgMode = false;
|
|
1118
|
+
}
|
|
1095
1119
|
} else if ((defaultHolder = elm["s-cr"])) {
|
|
1096
1120
|
defaultHolder.parentNode.textContent = text;
|
|
1097
1121
|
} else if (oldVNode.$text$ !== text) {
|
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-CbyFxLc_.js');
|
|
4
|
+
var index$1 = require('./index-Can2MpG5.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-CbyFxLc_.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"],"uploading":[32],"removing":[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],"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,
|
|
@@ -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) {
|
|
@@ -5,6 +5,7 @@ export class FkFileInput {
|
|
|
5
5
|
constructor() {
|
|
6
6
|
this.disabled = false;
|
|
7
7
|
this.uploading = false;
|
|
8
|
+
this.removing = false;
|
|
8
9
|
this.handleFile = async (event) => {
|
|
9
10
|
var _a;
|
|
10
11
|
const input = event.target;
|
|
@@ -14,7 +15,9 @@ export class FkFileInput {
|
|
|
14
15
|
this.uploading = true;
|
|
15
16
|
this.uploadError = undefined;
|
|
16
17
|
try {
|
|
17
|
-
const uploaded = await services.fileUploadService.upload(file
|
|
18
|
+
const uploaded = await services.fileUploadService.upload(file, {
|
|
19
|
+
url: this.uploadUrl,
|
|
20
|
+
});
|
|
18
21
|
this.fileValueChange.emit(uploaded);
|
|
19
22
|
}
|
|
20
23
|
catch (error) {
|
|
@@ -26,6 +29,25 @@ export class FkFileInput {
|
|
|
26
29
|
input.value = '';
|
|
27
30
|
}
|
|
28
31
|
};
|
|
32
|
+
this.handleRemove = async (event) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
const current = this.value;
|
|
36
|
+
if (!current)
|
|
37
|
+
return;
|
|
38
|
+
this.removing = true;
|
|
39
|
+
this.uploadError = undefined;
|
|
40
|
+
try {
|
|
41
|
+
await ((_b = (_a = services.fileUploadService).remove) === null || _b === void 0 ? void 0 : _b.call(_a, current, { url: this.uploadUrl }));
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
this.uploadError = error instanceof Error ? error.message : String(error);
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
this.removing = false;
|
|
48
|
+
this.fileValueChange.emit(undefined);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
29
51
|
}
|
|
30
52
|
formatSize(size) {
|
|
31
53
|
if (size < 1024)
|
|
@@ -35,14 +57,11 @@ export class FkFileInput {
|
|
|
35
57
|
return `${(size / (1024 * 1024)).toFixed(1)} MB`;
|
|
36
58
|
}
|
|
37
59
|
render() {
|
|
38
|
-
return (h("div", { key: '
|
|
39
|
-
event.preventDefault();
|
|
40
|
-
this.fileValueChange.emit(undefined);
|
|
41
|
-
} }, "\u2715"))) : (h("button", { type: "button", class: "fk-file__choose", disabled: this.disabled || this.uploading, onClick: (event) => {
|
|
60
|
+
return (h("div", { key: 'f7705974fe50f568094cf1f2874716fad7b2e31b', class: "fk-file" }, this.value ? (h("div", { class: "fk-file__selected" }, 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: this.value.name }, this.value.name), h("span", { class: "fk-file__size" }, this.formatSize(this.value.size))), h("button", { type: "button", class: "fk-file__remove", title: fkT('file.remove'), disabled: this.disabled || this.removing, onClick: this.handleRemove }, this.removing ? '…' : '✕'))) : (h("button", { type: "button", class: "fk-file__choose", disabled: this.disabled || this.uploading, onClick: (event) => {
|
|
42
61
|
var _a;
|
|
43
62
|
event.preventDefault();
|
|
44
63
|
(_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.click();
|
|
45
|
-
} }, this.uploading ? fkT('file.uploading') : fkT('file.choose'))), h("input", { key: '
|
|
64
|
+
} }, this.uploading ? fkT('file.uploading') : fkT('file.choose'))), h("input", { key: '170b1335f87a4ffdfa6cc29e005036384c4f04a6', class: "fk-file__native", type: "file", accept: this.accept, disabled: this.disabled, ref: (element) => (this.inputEl = element), onChange: this.handleFile }), this.uploadError ? (h("span", { class: "fk-field__error" }, this.uploadError)) : null));
|
|
46
65
|
}
|
|
47
66
|
static get is() { return "fk-file-input"; }
|
|
48
67
|
static get encapsulation() { return "scoped"; }
|
|
@@ -120,12 +139,32 @@ export class FkFileInput {
|
|
|
120
139
|
"setter": false,
|
|
121
140
|
"reflect": false,
|
|
122
141
|
"attribute": "accept"
|
|
142
|
+
},
|
|
143
|
+
"uploadUrl": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"mutable": false,
|
|
146
|
+
"complexType": {
|
|
147
|
+
"original": "string",
|
|
148
|
+
"resolved": "string",
|
|
149
|
+
"references": {}
|
|
150
|
+
},
|
|
151
|
+
"required": false,
|
|
152
|
+
"optional": true,
|
|
153
|
+
"docs": {
|
|
154
|
+
"tags": [],
|
|
155
|
+
"text": ""
|
|
156
|
+
},
|
|
157
|
+
"getter": false,
|
|
158
|
+
"setter": false,
|
|
159
|
+
"reflect": false,
|
|
160
|
+
"attribute": "upload-url"
|
|
123
161
|
}
|
|
124
162
|
};
|
|
125
163
|
}
|
|
126
164
|
static get states() {
|
|
127
165
|
return {
|
|
128
166
|
"uploading": {},
|
|
167
|
+
"removing": {},
|
|
129
168
|
"uploadError": {}
|
|
130
169
|
};
|
|
131
170
|
}
|
|
@@ -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"; }
|
|
@@ -106,6 +106,12 @@ const en = {
|
|
|
106
106
|
'brick.file.name': 'File',
|
|
107
107
|
'brick.hidden.name': 'Hidden',
|
|
108
108
|
'brick.content.name': 'Content',
|
|
109
|
+
'brick.recap.name': 'Recap',
|
|
110
|
+
'recap.empty': 'Nothing to summarize yet.',
|
|
111
|
+
'recap.yes': 'Yes',
|
|
112
|
+
'recap.no': 'No',
|
|
113
|
+
'panel.cfg.showEmpty': 'Show empty fields',
|
|
114
|
+
'panel.cfg.groupBySections': 'Group by section',
|
|
109
115
|
'brick.group.name': 'Group',
|
|
110
116
|
'brick.row.name': 'Row',
|
|
111
117
|
'brick.column.name': 'Column',
|
|
@@ -219,6 +225,12 @@ export const frFkTranslations = {
|
|
|
219
225
|
'brick.file.name': 'Fichier',
|
|
220
226
|
'brick.hidden.name': 'Caché',
|
|
221
227
|
'brick.content.name': 'Contenu',
|
|
228
|
+
'brick.recap.name': 'Récapitulatif',
|
|
229
|
+
'recap.empty': 'Rien à récapituler pour le moment.',
|
|
230
|
+
'recap.yes': 'Oui',
|
|
231
|
+
'recap.no': 'Non',
|
|
232
|
+
'panel.cfg.showEmpty': 'Afficher les champs vides',
|
|
233
|
+
'panel.cfg.groupBySections': 'Regrouper par section',
|
|
222
234
|
'brick.group.name': 'Groupe',
|
|
223
235
|
'brick.row.name': 'Ligne',
|
|
224
236
|
'brick.column.name': 'Colonne',
|
package/dist/collection/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { h } from '@stencil/core';
|
|
2
2
|
export { registerBrick, registerBricks, getBrick, getBrickMolds, getBrickMoldsGroupedByCategory, newBrickSpec, } from './registry/registry';
|
|
3
3
|
export { createBrick } from './registry/create-brick';
|
|
4
|
-
export { registerDefaultBricks, textInputBrick, emailBrick, passwordBrick, urlBrick, phoneBrick, textareaBrick, numberBrick, dateBrick, timeBrick, datetimeBrick, selectBrick, multiSelectBrick, radioBrick, selectBoxesBrick, checkboxBrick, tagsBrick, signatureBrick, addressBrick, fileBrick, dataGridBrick, hiddenBrick, contentBrick, groupBrick, rowBrick, columnBrick, stepperBrick, tabsBrick, } from './registry/default-bricks';
|
|
4
|
+
export { registerDefaultBricks, textInputBrick, emailBrick, passwordBrick, urlBrick, phoneBrick, textareaBrick, numberBrick, dateBrick, timeBrick, datetimeBrick, selectBrick, multiSelectBrick, radioBrick, selectBoxesBrick, checkboxBrick, tagsBrick, signatureBrick, addressBrick, fileBrick, dataGridBrick, hiddenBrick, contentBrick, recapBrick, groupBrick, rowBrick, columnBrick, stepperBrick, tabsBrick, } from './registry/default-bricks';
|
|
5
5
|
export { setFkTranslations, fkT, fkTOr, frFkTranslations } from './i18n/i18n';
|