@streamline-pulse/formkrafter-wc 0.1.1 → 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
package/README.md
CHANGED
|
@@ -49,13 +49,13 @@ sequenceDiagram
|
|
|
49
49
|
|
|
50
50
|
Underscore-prefixed keys injected via the `data` prop (e.g. `_authToken`) are available internally (interpolation, rules) but **excluded from every emitted payload**.
|
|
51
51
|
|
|
52
|
-
## Built-in bricks (
|
|
52
|
+
## Built-in bricks (28)
|
|
53
53
|
|
|
54
54
|
| Category | Bricks |
|
|
55
55
|
|---|---|
|
|
56
56
|
| **Inputs** (18) | text, email, password, url, phone, textarea, number, date, time, datetime, select, multi-select, radio, select-boxes, checkbox, tags, signature, address |
|
|
57
|
-
| **Data** (3) | file (pluggable upload), data-grid (repeating rows, per-row validation), hidden |
|
|
58
|
-
| **Layout** (
|
|
57
|
+
| **Data** (3) | file (pluggable upload, per-brick `uploadUrl`), data-grid (repeating rows, per-row validation), hidden |
|
|
58
|
+
| **Layout** (7) | content, recap (live summary of the whole form), group (fieldset), row, column, stepper (wizard), tabs |
|
|
59
59
|
|
|
60
60
|
Notable behaviors:
|
|
61
61
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$1 = require('./index-
|
|
4
|
-
var index = require('./index-
|
|
3
|
+
var index$1 = require('./index-CbyFxLc_.js');
|
|
4
|
+
var index = require('./index-Can2MpG5.js');
|
|
5
5
|
|
|
6
6
|
function _arrayWithHoles(r) {
|
|
7
7
|
if (Array.isArray(r)) return r;
|
|
@@ -2340,7 +2340,7 @@ const FkBrickRender = class {
|
|
|
2340
2340
|
this.errors = {};
|
|
2341
2341
|
}
|
|
2342
2342
|
render() {
|
|
2343
|
-
var _a, _b, _c, _d, _e;
|
|
2343
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2344
2344
|
const spec = this.brickSpec;
|
|
2345
2345
|
if (!spec)
|
|
2346
2346
|
return null;
|
|
@@ -2354,7 +2354,10 @@ const FkBrickRender = class {
|
|
|
2354
2354
|
return null;
|
|
2355
2355
|
const isContainer = spec.type === 'panel' || spec.type === 'collection';
|
|
2356
2356
|
const uid = (_b = spec.configs) === null || _b === void 0 ? void 0 : _b.uid;
|
|
2357
|
-
const childNodes = ((_c = spec.children) !== null && _c !== void 0 ? _c : []).map((childSpec, index) =>
|
|
2357
|
+
const childNodes = ((_c = spec.children) !== null && _c !== void 0 ? _c : []).map((childSpec, index) => {
|
|
2358
|
+
var _a;
|
|
2359
|
+
return (index$1.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 }));
|
|
2360
|
+
});
|
|
2358
2361
|
if (editing && isContainer) {
|
|
2359
2362
|
childNodes.push(index$1.h("fk-drop-area", { path: this.path }));
|
|
2360
2363
|
}
|
|
@@ -2366,7 +2369,8 @@ const FkBrickRender = class {
|
|
|
2366
2369
|
styles: (_d = spec.styles) !== null && _d !== void 0 ? _d : {},
|
|
2367
2370
|
data: getBrickData(spec, this.data),
|
|
2368
2371
|
dataMap: this.dataMap,
|
|
2369
|
-
|
|
2372
|
+
rootSpec: (_e = this.rootSpec) !== null && _e !== void 0 ? _e : this.brickSpec,
|
|
2373
|
+
error: ((_f = spec.configs) === null || _f === void 0 ? void 0 : _f.key) ? this.errors[spec.configs.key] : undefined,
|
|
2370
2374
|
disabled: editing ? false : affected.disabled === true,
|
|
2371
2375
|
path: this.path,
|
|
2372
2376
|
editable: editing,
|
|
@@ -24969,7 +24973,7 @@ const FkEmptyForm = class {
|
|
|
24969
24973
|
};
|
|
24970
24974
|
FkEmptyForm.style = fkEmptyFormCss();
|
|
24971
24975
|
|
|
24972
|
-
const fkFileInputCss = () => `.sc-fk-file-input-h{display:block}.fk-file.sc-fk-file-input{display:flex;flex-direction:column;gap:calc(var(--fk-spacing) / 2);align-items:flex-start}.fk-file__native.sc-fk-file-input{display:none}.fk-file__choose.sc-fk-file-input{font:inherit;font-size:0.85rem;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);border:1px dashed var(--fk-color-border);border-radius:var(--fk-radius);background:transparent;color:var(--fk-color-muted);cursor:pointer}.fk-file__choose.sc-fk-file-input:hover:not(:disabled){border-color:var(--fk-color-primary);color:var(--fk-color-primary)}.fk-file__choose.sc-fk-file-input:disabled{opacity:0.55;cursor:not-allowed}.fk-file__selected.sc-fk-file-input{display:flex;align-items:center;gap:
|
|
24976
|
+
const fkFileInputCss = () => `.sc-fk-file-input-h{display:block}.fk-file.sc-fk-file-input{display:flex;flex-direction:column;gap:calc(var(--fk-spacing) / 2);align-items:flex-start}.fk-file__native.sc-fk-file-input{display:none}.fk-file__choose.sc-fk-file-input{font:inherit;font-size:0.85rem;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);border:1px dashed var(--fk-color-border);border-radius:var(--fk-radius);background:transparent;color:var(--fk-color-muted);cursor:pointer}.fk-file__choose.sc-fk-file-input:hover:not(:disabled){border-color:var(--fk-color-primary);color:var(--fk-color-primary)}.fk-file__choose.sc-fk-file-input:disabled{opacity:0.55;cursor:not-allowed}.fk-file__selected.sc-fk-file-input{display:flex;align-items:center;gap:var(--fk-spacing);width:100%;box-sizing:border-box;padding:calc(var(--fk-spacing) * 0.75) var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface)}.fk-file__icon.sc-fk-file-input{display:inline-flex;flex-shrink:0;color:var(--fk-color-primary)}.fk-file__meta.sc-fk-file-input{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.fk-file__name.sc-fk-file-input{font-size:0.85rem;font-weight:600;color:var(--fk-color-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fk-file__size.sc-fk-file-input{font-size:0.72rem;color:var(--fk-color-muted);white-space:nowrap}.fk-file__remove.sc-fk-file-input{border:none;background:transparent;color:var(--fk-color-muted);font-size:0.8rem;cursor:pointer;padding:4px 6px;border-radius:calc(var(--fk-radius) / 2);flex-shrink:0}.fk-file__remove.sc-fk-file-input:hover:not(:disabled){background:color-mix(in srgb, var(--fk-color-danger) 12%, transparent)}.fk-file__remove.sc-fk-file-input:hover:not(:disabled){color:var(--fk-color-danger)}`;
|
|
24973
24977
|
|
|
24974
24978
|
const FkFileInput = class {
|
|
24975
24979
|
constructor(hostRef) {
|
|
@@ -24977,6 +24981,7 @@ const FkFileInput = class {
|
|
|
24977
24981
|
this.fileValueChange = index$1.createEvent(this, "fileValueChange");
|
|
24978
24982
|
this.disabled = false;
|
|
24979
24983
|
this.uploading = false;
|
|
24984
|
+
this.removing = false;
|
|
24980
24985
|
this.handleFile = async (event) => {
|
|
24981
24986
|
var _a;
|
|
24982
24987
|
const input = event.target;
|
|
@@ -24986,7 +24991,9 @@ const FkFileInput = class {
|
|
|
24986
24991
|
this.uploading = true;
|
|
24987
24992
|
this.uploadError = undefined;
|
|
24988
24993
|
try {
|
|
24989
|
-
const uploaded = await index.services.fileUploadService.upload(file
|
|
24994
|
+
const uploaded = await index.services.fileUploadService.upload(file, {
|
|
24995
|
+
url: this.uploadUrl,
|
|
24996
|
+
});
|
|
24990
24997
|
this.fileValueChange.emit(uploaded);
|
|
24991
24998
|
}
|
|
24992
24999
|
catch (error) {
|
|
@@ -24998,6 +25005,25 @@ const FkFileInput = class {
|
|
|
24998
25005
|
input.value = '';
|
|
24999
25006
|
}
|
|
25000
25007
|
};
|
|
25008
|
+
this.handleRemove = async (event) => {
|
|
25009
|
+
var _a, _b;
|
|
25010
|
+
event.preventDefault();
|
|
25011
|
+
const current = this.value;
|
|
25012
|
+
if (!current)
|
|
25013
|
+
return;
|
|
25014
|
+
this.removing = true;
|
|
25015
|
+
this.uploadError = undefined;
|
|
25016
|
+
try {
|
|
25017
|
+
await ((_b = (_a = index.services.fileUploadService).remove) === null || _b === void 0 ? void 0 : _b.call(_a, current, { url: this.uploadUrl }));
|
|
25018
|
+
}
|
|
25019
|
+
catch (error) {
|
|
25020
|
+
this.uploadError = error instanceof Error ? error.message : String(error);
|
|
25021
|
+
}
|
|
25022
|
+
finally {
|
|
25023
|
+
this.removing = false;
|
|
25024
|
+
this.fileValueChange.emit(undefined);
|
|
25025
|
+
}
|
|
25026
|
+
};
|
|
25001
25027
|
}
|
|
25002
25028
|
formatSize(size) {
|
|
25003
25029
|
if (size < 1024)
|
|
@@ -25007,19 +25033,16 @@ const FkFileInput = class {
|
|
|
25007
25033
|
return `${(size / (1024 * 1024)).toFixed(1)} MB`;
|
|
25008
25034
|
}
|
|
25009
25035
|
render() {
|
|
25010
|
-
return (index$1.h("div", { key: '
|
|
25011
|
-
event.preventDefault();
|
|
25012
|
-
this.fileValueChange.emit(undefined);
|
|
25013
|
-
} }, "\u2715"))) : (index$1.h("button", { type: "button", class: "fk-file__choose", disabled: this.disabled || this.uploading, onClick: (event) => {
|
|
25036
|
+
return (index$1.h("div", { key: 'f7705974fe50f568094cf1f2874716fad7b2e31b', class: "fk-file" }, this.value ? (index$1.h("div", { class: "fk-file__selected" }, index$1.h("span", { class: "fk-file__icon", "aria-hidden": "true" }, index$1.h("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, index$1.h("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), index$1.h("polyline", { points: "14 2 14 8 20 8" }))), index$1.h("span", { class: "fk-file__meta" }, index$1.h("span", { class: "fk-file__name", title: this.value.name }, this.value.name), index$1.h("span", { class: "fk-file__size" }, this.formatSize(this.value.size))), index$1.h("button", { type: "button", class: "fk-file__remove", title: index.fkT('file.remove'), disabled: this.disabled || this.removing, onClick: this.handleRemove }, this.removing ? '…' : '✕'))) : (index$1.h("button", { type: "button", class: "fk-file__choose", disabled: this.disabled || this.uploading, onClick: (event) => {
|
|
25014
25037
|
var _a;
|
|
25015
25038
|
event.preventDefault();
|
|
25016
25039
|
(_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.click();
|
|
25017
|
-
} }, this.uploading ? index.fkT('file.uploading') : index.fkT('file.choose'))), index$1.h("input", { key: '
|
|
25040
|
+
} }, this.uploading ? index.fkT('file.uploading') : index.fkT('file.choose'))), index$1.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 ? (index$1.h("span", { class: "fk-field__error" }, this.uploadError)) : null));
|
|
25018
25041
|
}
|
|
25019
25042
|
};
|
|
25020
25043
|
FkFileInput.style = fkFileInputCss();
|
|
25021
25044
|
|
|
25022
|
-
const fkFormBuilderCss = () => `.fk-builder.sc-fk-form-builder{display:flex;gap:calc(var(--fk-spacing) * 2);align-items:flex-start;font-family:var(--fk-font);color:var(--fk-color-text)}.fk-builder__palette.sc-fk-form-builder{width:220px;flex-shrink:0;padding:calc(var(--fk-spacing) * 1.5);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface)}.fk-builder__main.sc-fk-form-builder{flex:1;min-width:0;display:flex;flex-direction:column;gap:var(--fk-spacing)}.fk-builder__toolbar.sc-fk-form-builder{display:flex;align-items:center;gap:calc(var(--fk-spacing) / 2)}.fk-builder__spacer.sc-fk-form-builder{flex:1}.fk-builder__import-error.sc-fk-form-builder{font-size:0.75rem;color:var(--fk-color-danger)}.fk-builder__tool.sc-fk-form-builder{padding:calc(var(--fk-spacing) / 2) var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 2);background:var(--fk-color-surface);color:var(--fk-color-text);font-size:0.8rem;cursor:pointer}.fk-builder__tool.sc-fk-form-builder:hover:not(:disabled){border-color:var(--fk-color-primary);color:var(--fk-color-primary)}.fk-builder__tool.sc-fk-form-builder:disabled{opacity:0.4;cursor:default}.fk-builder__canvas.sc-fk-form-builder{min-height:320px;padding:calc(var(--fk-spacing) * 2);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface)}.fk-builder__inspector.sc-fk-form-builder{width:260px;flex-shrink:0;padding:calc(var(--fk-spacing) * 1.5);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface)}.fk-builder__hint.sc-fk-form-builder{margin:0;font-size:0.8rem;color:var(--fk-color-muted)}`;
|
|
25045
|
+
const fkFormBuilderCss = () => `.sc-fk-form-builder-h{display:block;container-type:inline-size}.fk-builder.sc-fk-form-builder{display:flex;gap:calc(var(--fk-spacing) * 2);align-items:flex-start;font-family:var(--fk-font);color:var(--fk-color-text)}@container (max-width: 820px){.fk-builder{flex-wrap:wrap}.fk-builder__palette,.fk-builder__inspector{width:100%}.fk-builder__main{order:2;flex-basis:100%}.fk-builder__palette{order:1}.fk-builder__inspector{order:3}}.fk-builder__palette.sc-fk-form-builder{width:220px;flex-shrink:0;padding:calc(var(--fk-spacing) * 1.5);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface)}.fk-builder__main.sc-fk-form-builder{flex:1;min-width:0;display:flex;flex-direction:column;gap:var(--fk-spacing)}.fk-builder__toolbar.sc-fk-form-builder{display:flex;align-items:center;gap:calc(var(--fk-spacing) / 2)}.fk-builder__spacer.sc-fk-form-builder{flex:1}.fk-builder__import-error.sc-fk-form-builder{font-size:0.75rem;color:var(--fk-color-danger)}.fk-builder__tool.sc-fk-form-builder{padding:calc(var(--fk-spacing) / 2) var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 2);background:var(--fk-color-surface);color:var(--fk-color-text);font-size:0.8rem;cursor:pointer}.fk-builder__tool.sc-fk-form-builder:hover:not(:disabled){border-color:var(--fk-color-primary);color:var(--fk-color-primary)}.fk-builder__tool.sc-fk-form-builder:disabled{opacity:0.4;cursor:default}.fk-builder__canvas.sc-fk-form-builder{min-height:320px;padding:calc(var(--fk-spacing) * 2);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface);overflow-x:auto}.fk-builder__inspector.sc-fk-form-builder{width:260px;flex-shrink:0;padding:calc(var(--fk-spacing) * 1.5);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface)}.fk-builder__hint.sc-fk-form-builder{margin:0;font-size:0.8rem;color:var(--fk-color-muted)}`;
|
|
25023
25046
|
|
|
25024
25047
|
const FkFormBuilder = class {
|
|
25025
25048
|
constructor(hostRef) {
|
|
@@ -25384,7 +25407,7 @@ const FkFormRender = class {
|
|
|
25384
25407
|
render() {
|
|
25385
25408
|
if (!this.spec)
|
|
25386
25409
|
return null;
|
|
25387
|
-
return (index$1.h("form", { class: "fk-form", onSubmit: (event) => event.preventDefault() }, index$1.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 })));
|
|
25410
|
+
return (index$1.h("form", { class: "fk-form", onSubmit: (event) => event.preventDefault() }, index$1.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 })));
|
|
25388
25411
|
}
|
|
25389
25412
|
get host() { return index$1.getElement(this); }
|
|
25390
25413
|
static get watchers() { return {
|
|
@@ -25848,28 +25871,6 @@ const FkRulesEditor = class {
|
|
|
25848
25871
|
};
|
|
25849
25872
|
FkRulesEditor.style = fkRulesEditorCss();
|
|
25850
25873
|
|
|
25851
|
-
function normalizeOptions(raw, labelKey = 'label', valueKey = 'value') {
|
|
25852
|
-
if (Array.isArray(raw)) {
|
|
25853
|
-
return raw
|
|
25854
|
-
.map((item) => {
|
|
25855
|
-
var _a, _b;
|
|
25856
|
-
if (typeof item === 'object' && item !== null) {
|
|
25857
|
-
const record = item;
|
|
25858
|
-
const label = (_a = record[labelKey]) !== null && _a !== void 0 ? _a : record[valueKey];
|
|
25859
|
-
const value = (_b = record[valueKey]) !== null && _b !== void 0 ? _b : record[labelKey];
|
|
25860
|
-
return { label: String(label !== null && label !== void 0 ? label : ''), value: String(value !== null && value !== void 0 ? value : '') };
|
|
25861
|
-
}
|
|
25862
|
-
return { label: String(item), value: String(item) };
|
|
25863
|
-
})
|
|
25864
|
-
.filter((option) => option.label !== '');
|
|
25865
|
-
}
|
|
25866
|
-
return String(raw !== null && raw !== void 0 ? raw : '')
|
|
25867
|
-
.split('\n')
|
|
25868
|
-
.map((line) => line.trim())
|
|
25869
|
-
.filter(Boolean)
|
|
25870
|
-
.map((line) => ({ label: line, value: line }));
|
|
25871
|
-
}
|
|
25872
|
-
|
|
25873
25874
|
function interpolateTemplate(template, dataMap) {
|
|
25874
25875
|
return template.replace(/\{(\w+)\}/g, (_, token) => {
|
|
25875
25876
|
const value = dataMap === null || dataMap === void 0 ? void 0 : dataMap[token];
|
|
@@ -26004,13 +26005,13 @@ const FkSelectInput = class {
|
|
|
26004
26005
|
switch (this.source()) {
|
|
26005
26006
|
case 'remote':
|
|
26006
26007
|
return {
|
|
26007
|
-
options: normalizeOptions(this.remoteOptions, labelKey, valueKey),
|
|
26008
|
+
options: index.normalizeOptions(this.remoteOptions, labelKey, valueKey),
|
|
26008
26009
|
error: this.remoteError,
|
|
26009
26010
|
};
|
|
26010
26011
|
case 'dataMap': {
|
|
26011
26012
|
const path = (_c = this.configs) === null || _c === void 0 ? void 0 : _c.optionsPath;
|
|
26012
26013
|
return {
|
|
26013
|
-
options: normalizeOptions(path ? (_d = this.dataMap) === null || _d === void 0 ? void 0 : _d[path] : [], labelKey, valueKey),
|
|
26014
|
+
options: index.normalizeOptions(path ? (_d = this.dataMap) === null || _d === void 0 ? void 0 : _d[path] : [], labelKey, valueKey),
|
|
26014
26015
|
};
|
|
26015
26016
|
}
|
|
26016
26017
|
case 'js': {
|
|
@@ -26021,11 +26022,11 @@ const FkSelectInput = class {
|
|
|
26021
26022
|
if (result instanceof Error) {
|
|
26022
26023
|
return { options: [], error: result.message };
|
|
26023
26024
|
}
|
|
26024
|
-
return { options: normalizeOptions(result, labelKey, valueKey) };
|
|
26025
|
+
return { options: index.normalizeOptions(result, labelKey, valueKey) };
|
|
26025
26026
|
}
|
|
26026
26027
|
default:
|
|
26027
26028
|
return {
|
|
26028
|
-
options: normalizeOptions((_f = this.configs) === null || _f === void 0 ? void 0 : _f.options, labelKey, valueKey),
|
|
26029
|
+
options: index.normalizeOptions((_f = this.configs) === null || _f === void 0 ? void 0 : _f.options, labelKey, valueKey),
|
|
26029
26030
|
};
|
|
26030
26031
|
}
|
|
26031
26032
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
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);
|
|
22
|
+
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);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$1 = require('./index-
|
|
3
|
+
var index$1 = require('./index-CbyFxLc_.js');
|
|
4
4
|
|
|
5
5
|
var _a$1;
|
|
6
6
|
const GLOBAL_KEY$2 = Symbol.for('formkrafter.wc.bricks');
|
|
@@ -16390,6 +16390,21 @@ var keyOfError = (error) => {
|
|
|
16390
16390
|
}
|
|
16391
16391
|
return error.instancePath.split("/").filter(Boolean)[0];
|
|
16392
16392
|
};
|
|
16393
|
+
var hiddenKeys = (brickSpec, dataMap) => {
|
|
16394
|
+
const hidden = new Set;
|
|
16395
|
+
const walk = (brick, parentHidden) => {
|
|
16396
|
+
const isHidden = parentHidden || (brick.rules?.length ? getAffectedProperties(brick.rules, dataMap).hidden === true : false);
|
|
16397
|
+
const key = brick.configs?.key;
|
|
16398
|
+
if (isHidden && key)
|
|
16399
|
+
hidden.add(key);
|
|
16400
|
+
if (brick.type === "collection")
|
|
16401
|
+
return;
|
|
16402
|
+
for (const child of brick.children ?? [])
|
|
16403
|
+
walk(child, isHidden);
|
|
16404
|
+
};
|
|
16405
|
+
walk(brickSpec, false);
|
|
16406
|
+
return hidden;
|
|
16407
|
+
};
|
|
16393
16408
|
var validateBrickSpecDataDetailed = (brickSpec, data, locale) => {
|
|
16394
16409
|
const errors = {};
|
|
16395
16410
|
const validate = compiledValidator(brickSpec, locale);
|
|
@@ -16405,6 +16420,10 @@ var validateBrickSpecDataDetailed = (brickSpec, data, locale) => {
|
|
|
16405
16420
|
if (!(key in errors))
|
|
16406
16421
|
errors[key] = message;
|
|
16407
16422
|
}
|
|
16423
|
+
const dataMap = typeof data === "object" && data !== null ? data : undefined;
|
|
16424
|
+
for (const key of hiddenKeys(brickSpec, dataMap)) {
|
|
16425
|
+
delete errors[key];
|
|
16426
|
+
}
|
|
16408
16427
|
return { valid: Object.keys(errors).length === 0, errors };
|
|
16409
16428
|
};
|
|
16410
16429
|
// lib/ops/pointer.ts
|
|
@@ -16574,7 +16593,7 @@ class SpecHistory {
|
|
|
16574
16593
|
}
|
|
16575
16594
|
}
|
|
16576
16595
|
|
|
16577
|
-
//# debugId=
|
|
16596
|
+
//# debugId=B48CAF1CB5D5782064756E2164756E21
|
|
16578
16597
|
|
|
16579
16598
|
function createBrick(params) {
|
|
16580
16599
|
return new (class extends Brick {
|
|
@@ -16622,6 +16641,28 @@ function asInlineStyle(styles) {
|
|
|
16622
16641
|
return result;
|
|
16623
16642
|
}
|
|
16624
16643
|
|
|
16644
|
+
function normalizeOptions(raw, labelKey = 'label', valueKey = 'value') {
|
|
16645
|
+
if (Array.isArray(raw)) {
|
|
16646
|
+
return raw
|
|
16647
|
+
.map((item) => {
|
|
16648
|
+
var _a, _b;
|
|
16649
|
+
if (typeof item === 'object' && item !== null) {
|
|
16650
|
+
const record = item;
|
|
16651
|
+
const label = (_a = record[labelKey]) !== null && _a !== void 0 ? _a : record[valueKey];
|
|
16652
|
+
const value = (_b = record[valueKey]) !== null && _b !== void 0 ? _b : record[labelKey];
|
|
16653
|
+
return { label: String(label !== null && label !== void 0 ? label : ''), value: String(value !== null && value !== void 0 ? value : '') };
|
|
16654
|
+
}
|
|
16655
|
+
return { label: String(item), value: String(item) };
|
|
16656
|
+
})
|
|
16657
|
+
.filter((option) => option.label !== '');
|
|
16658
|
+
}
|
|
16659
|
+
return String(raw !== null && raw !== void 0 ? raw : '')
|
|
16660
|
+
.split('\n')
|
|
16661
|
+
.map((line) => line.trim())
|
|
16662
|
+
.filter(Boolean)
|
|
16663
|
+
.map((line) => ({ label: line, value: line }));
|
|
16664
|
+
}
|
|
16665
|
+
|
|
16625
16666
|
var _a;
|
|
16626
16667
|
const en = {
|
|
16627
16668
|
'palette.search': 'Search bricks…',
|
|
@@ -16730,6 +16771,12 @@ const en = {
|
|
|
16730
16771
|
'brick.file.name': 'File',
|
|
16731
16772
|
'brick.hidden.name': 'Hidden',
|
|
16732
16773
|
'brick.content.name': 'Content',
|
|
16774
|
+
'brick.recap.name': 'Recap',
|
|
16775
|
+
'recap.empty': 'Nothing to summarize yet.',
|
|
16776
|
+
'recap.yes': 'Yes',
|
|
16777
|
+
'recap.no': 'No',
|
|
16778
|
+
'panel.cfg.showEmpty': 'Show empty fields',
|
|
16779
|
+
'panel.cfg.groupBySections': 'Group by section',
|
|
16733
16780
|
'brick.group.name': 'Group',
|
|
16734
16781
|
'brick.row.name': 'Row',
|
|
16735
16782
|
'brick.column.name': 'Column',
|
|
@@ -16843,6 +16890,12 @@ const frFkTranslations = {
|
|
|
16843
16890
|
'brick.file.name': 'Fichier',
|
|
16844
16891
|
'brick.hidden.name': 'Caché',
|
|
16845
16892
|
'brick.content.name': 'Contenu',
|
|
16893
|
+
'brick.recap.name': 'Récapitulatif',
|
|
16894
|
+
'recap.empty': 'Rien à récapituler pour le moment.',
|
|
16895
|
+
'recap.yes': 'Oui',
|
|
16896
|
+
'recap.no': 'Non',
|
|
16897
|
+
'panel.cfg.showEmpty': 'Afficher les champs vides',
|
|
16898
|
+
'panel.cfg.groupBySections': 'Regrouper par section',
|
|
16846
16899
|
'brick.group.name': 'Groupe',
|
|
16847
16900
|
'brick.row.name': 'Ligne',
|
|
16848
16901
|
'brick.column.name': 'Colonne',
|
|
@@ -17007,10 +17060,10 @@ const datetimeBrick = createTextVariant({
|
|
|
17007
17060
|
name: 'Date / Time',
|
|
17008
17061
|
inputType: 'datetime-local',
|
|
17009
17062
|
});
|
|
17010
|
-
const staticOptions = (
|
|
17011
|
-
|
|
17012
|
-
.
|
|
17013
|
-
|
|
17063
|
+
const staticOptions = (props) => {
|
|
17064
|
+
var _a, _b, _c;
|
|
17065
|
+
return normalizeOptions((_a = props.configs) === null || _a === void 0 ? void 0 : _a.options, typeof ((_b = props.configs) === null || _b === void 0 ? void 0 : _b.labelKey) === 'string' ? props.configs.labelKey : 'label', typeof ((_c = props.configs) === null || _c === void 0 ? void 0 : _c.valueKey) === 'string' ? props.configs.valueKey : 'value');
|
|
17066
|
+
};
|
|
17014
17067
|
const selectBoxesBrick = createBrick({
|
|
17015
17068
|
type: 'input',
|
|
17016
17069
|
dataType: 'array',
|
|
@@ -17019,16 +17072,15 @@ const selectBoxesBrick = createBrick({
|
|
|
17019
17072
|
category: 'Inputs',
|
|
17020
17073
|
defaultConfigs: { label: 'Select boxes', options: 'Option 1\nOption 2\nOption 3' },
|
|
17021
17074
|
render: (props) => {
|
|
17022
|
-
var _a;
|
|
17023
17075
|
const selected = Array.isArray(props.data) ? props.data : [];
|
|
17024
|
-
return (index$1.h("div", { class: "fk-field", style: asInlineStyle(props.styles) }, index$1.h("span", { class: "fk-field__label" }, labelOf(props, 'Select boxes')), index$1.h("div", { class: "fk-radio-group" }, staticOptions(
|
|
17076
|
+
return (index$1.h("div", { class: "fk-field", style: asInlineStyle(props.styles) }, index$1.h("span", { class: "fk-field__label" }, labelOf(props, 'Select boxes')), index$1.h("div", { class: "fk-radio-group" }, staticOptions(props).map((option) => (index$1.h("label", { class: "fk-radio", key: option.value }, index$1.h("input", { type: "checkbox", checked: selected.includes(option.value), disabled: props.editable || props.disabled, onChange: (event) => {
|
|
17025
17077
|
var _a;
|
|
17026
17078
|
const checked = event.target.checked;
|
|
17027
17079
|
const next = checked
|
|
17028
|
-
? [...selected, option]
|
|
17029
|
-
: selected.filter((value) => value !== option);
|
|
17080
|
+
? [...selected, option.value]
|
|
17081
|
+
: selected.filter((value) => value !== option.value);
|
|
17030
17082
|
(_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, next.length ? next : undefined);
|
|
17031
|
-
} }), index$1.h("span", null, option))))), props.error ? index$1.h("span", { class: "fk-field__error" }, props.error) : null));
|
|
17083
|
+
} }), index$1.h("span", null, option.label))))), props.error ? index$1.h("span", { class: "fk-field__error" }, props.error) : null));
|
|
17032
17084
|
},
|
|
17033
17085
|
});
|
|
17034
17086
|
const tagsBrick = createBrick({
|
|
@@ -17100,17 +17152,10 @@ const radioBrick = createBrick({
|
|
|
17100
17152
|
name: 'Radio',
|
|
17101
17153
|
category: 'Inputs',
|
|
17102
17154
|
defaultConfigs: { label: 'Radio', options: 'Option 1\nOption 2' },
|
|
17103
|
-
render: (props) => {
|
|
17155
|
+
render: (props) => (index$1.h("div", { class: "fk-field", style: asInlineStyle(props.styles) }, index$1.h("span", { class: "fk-field__label" }, labelOf(props, 'Radio')), index$1.h("div", { class: "fk-radio-group", role: "radiogroup" }, staticOptions(props).map((option) => {
|
|
17104
17156
|
var _a, _b;
|
|
17105
|
-
return (index$1.h("
|
|
17106
|
-
|
|
17107
|
-
.map((option) => option.trim())
|
|
17108
|
-
.filter(Boolean)
|
|
17109
|
-
.map((option) => {
|
|
17110
|
-
var _a, _b;
|
|
17111
|
-
return (index$1.h("label", { class: "fk-radio", key: option }, index$1.h("input", { type: "radio", name: (_b = (_a = props.configs) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : props.path, checked: props.data === option, disabled: props.editable || props.disabled, onChange: () => { var _a; return (_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, option); } }), index$1.h("span", null, option)));
|
|
17112
|
-
})), props.error ? index$1.h("span", { class: "fk-field__error" }, props.error) : null));
|
|
17113
|
-
},
|
|
17157
|
+
return (index$1.h("label", { class: "fk-radio", key: option.value }, index$1.h("input", { type: "radio", name: (_b = (_a = props.configs) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : props.path, checked: props.data === option.value, disabled: props.editable || props.disabled, onChange: () => { var _a; return (_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, option.value); } }), index$1.h("span", null, option.label)));
|
|
17158
|
+
})), props.error ? index$1.h("span", { class: "fk-field__error" }, props.error) : null)),
|
|
17114
17159
|
});
|
|
17115
17160
|
const ADDRESS_PARTS = [
|
|
17116
17161
|
{ key: 'street', label: () => fkT('address.street'), full: true },
|
|
@@ -17148,8 +17193,8 @@ const fileBrick = createBrick({
|
|
|
17148
17193
|
category: 'Data',
|
|
17149
17194
|
defaultConfigs: { label: 'File' },
|
|
17150
17195
|
render: (props) => {
|
|
17151
|
-
var _a;
|
|
17152
|
-
return fieldBlock(props, 'File', index$1.h("fk-file-input", { value: props.data, accept: (_a = props.configs) === null || _a === void 0 ? void 0 : _a.accept, disabled: props.editable || props.disabled, onFileValueChange: (event) => {
|
|
17196
|
+
var _a, _b;
|
|
17197
|
+
return fieldBlock(props, 'File', index$1.h("fk-file-input", { value: props.data, accept: (_a = props.configs) === null || _a === void 0 ? void 0 : _a.accept, uploadUrl: (_b = props.configs) === null || _b === void 0 ? void 0 : _b.uploadUrl, disabled: props.editable || props.disabled, onFileValueChange: (event) => {
|
|
17153
17198
|
var _a;
|
|
17154
17199
|
event.stopPropagation();
|
|
17155
17200
|
(_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, event.detail);
|
|
@@ -17255,6 +17300,150 @@ const columnBrick = createBrick({
|
|
|
17255
17300
|
category: 'Layout',
|
|
17256
17301
|
render: (props) => (index$1.h("div", { class: "fk-column", style: asInlineStyle(props.styles) }, props.children)),
|
|
17257
17302
|
});
|
|
17303
|
+
const formatRecapValue = (brick, value) => {
|
|
17304
|
+
var _a;
|
|
17305
|
+
if (Array.isArray(value)) {
|
|
17306
|
+
return value
|
|
17307
|
+
.map((item) => formatRecapValue(brick, item))
|
|
17308
|
+
.filter(Boolean)
|
|
17309
|
+
.join(', ');
|
|
17310
|
+
}
|
|
17311
|
+
if (value === true)
|
|
17312
|
+
return fkTOr('recap.yes', 'Yes');
|
|
17313
|
+
if (value === false)
|
|
17314
|
+
return fkTOr('recap.no', 'No');
|
|
17315
|
+
if (value && typeof value === 'object') {
|
|
17316
|
+
const record = value;
|
|
17317
|
+
if (typeof record.name === 'string' && 'url' in record)
|
|
17318
|
+
return record.name;
|
|
17319
|
+
return Object.values(record)
|
|
17320
|
+
.filter((part) => typeof part === 'string' && part)
|
|
17321
|
+
.join(' ');
|
|
17322
|
+
}
|
|
17323
|
+
const raw = String(value !== null && value !== void 0 ? value : '');
|
|
17324
|
+
if (((_a = brick.configs) === null || _a === void 0 ? void 0 : _a.options) != null) {
|
|
17325
|
+
const labelKey = typeof brick.configs.labelKey === 'string' ? brick.configs.labelKey : 'label';
|
|
17326
|
+
const valueKey = typeof brick.configs.valueKey === 'string' ? brick.configs.valueKey : 'value';
|
|
17327
|
+
const match = normalizeOptions(brick.configs.options, labelKey, valueKey).find((option) => option.value === raw);
|
|
17328
|
+
if (match)
|
|
17329
|
+
return match.label;
|
|
17330
|
+
}
|
|
17331
|
+
return raw;
|
|
17332
|
+
};
|
|
17333
|
+
const isEmptyRecapValue = (raw) => raw === undefined ||
|
|
17334
|
+
raw === null ||
|
|
17335
|
+
raw === '' ||
|
|
17336
|
+
(Array.isArray(raw) && raw.length === 0);
|
|
17337
|
+
const brickLabel = (brick, locale) => {
|
|
17338
|
+
var _a, _b, _c, _d, _e;
|
|
17339
|
+
return String((_e = (_c = (_b = resolveLocalizedText((_a = brick.configs) === null || _a === void 0 ? void 0 : _a.label, locale)) !== null && _b !== void 0 ? _b : brick.name) !== null && _c !== void 0 ? _c : (_d = brick.configs) === null || _d === void 0 ? void 0 : _d.key) !== null && _e !== void 0 ? _e : '');
|
|
17340
|
+
};
|
|
17341
|
+
const collectionInputs = (spec) => {
|
|
17342
|
+
var _a, _b;
|
|
17343
|
+
const inputs = [];
|
|
17344
|
+
for (const child of (_a = spec.children) !== null && _a !== void 0 ? _a : []) {
|
|
17345
|
+
const key = (_b = child.configs) === null || _b === void 0 ? void 0 : _b.key;
|
|
17346
|
+
if (child.type === 'input' && key && !key.startsWith('_')) {
|
|
17347
|
+
inputs.push(child);
|
|
17348
|
+
}
|
|
17349
|
+
else if (child.type === 'panel') {
|
|
17350
|
+
inputs.push(...collectionInputs(child));
|
|
17351
|
+
}
|
|
17352
|
+
}
|
|
17353
|
+
return inputs;
|
|
17354
|
+
};
|
|
17355
|
+
const collectRecapItems = (spec, dataMap, locale, showEmpty, groupBySections = false) => {
|
|
17356
|
+
var _a, _b, _c;
|
|
17357
|
+
if (!spec)
|
|
17358
|
+
return [];
|
|
17359
|
+
const items = [];
|
|
17360
|
+
for (const child of (_a = spec.children) !== null && _a !== void 0 ? _a : []) {
|
|
17361
|
+
if (child.id === 'recap' || child.type === 'action')
|
|
17362
|
+
continue;
|
|
17363
|
+
if (getAffectedProperties(child.rules, dataMap).hidden === true)
|
|
17364
|
+
continue;
|
|
17365
|
+
const key = (_b = child.configs) === null || _b === void 0 ? void 0 : _b.key;
|
|
17366
|
+
const label = brickLabel(child, locale);
|
|
17367
|
+
if (child.type === 'collection') {
|
|
17368
|
+
const rows = key && Array.isArray(dataMap === null || dataMap === void 0 ? void 0 : dataMap[key])
|
|
17369
|
+
? dataMap[key]
|
|
17370
|
+
: [];
|
|
17371
|
+
if (!rows.length && !showEmpty)
|
|
17372
|
+
continue;
|
|
17373
|
+
const inputs = collectionInputs(child);
|
|
17374
|
+
items.push({
|
|
17375
|
+
kind: 'collection',
|
|
17376
|
+
label,
|
|
17377
|
+
columns: inputs.map((input) => brickLabel(input, locale)),
|
|
17378
|
+
rows: rows.map((row) => inputs.map((input) => {
|
|
17379
|
+
const raw = row === null || row === void 0 ? void 0 : row[input.configs.key];
|
|
17380
|
+
return isEmptyRecapValue(raw) ? '—' : formatRecapValue(input, raw);
|
|
17381
|
+
})),
|
|
17382
|
+
});
|
|
17383
|
+
continue;
|
|
17384
|
+
}
|
|
17385
|
+
if (child.type === 'panel') {
|
|
17386
|
+
const sectionLabel = resolveLocalizedText((_c = child.configs) === null || _c === void 0 ? void 0 : _c.label, locale);
|
|
17387
|
+
if (groupBySections &&
|
|
17388
|
+
typeof sectionLabel === 'string' &&
|
|
17389
|
+
sectionLabel.trim()) {
|
|
17390
|
+
const sectionItems = collectRecapItems(child, dataMap, locale, showEmpty);
|
|
17391
|
+
if (sectionItems.length) {
|
|
17392
|
+
items.push({ kind: 'section', label: sectionLabel });
|
|
17393
|
+
items.push(...sectionItems);
|
|
17394
|
+
}
|
|
17395
|
+
continue;
|
|
17396
|
+
}
|
|
17397
|
+
items.push(...collectRecapItems(child, dataMap, locale, showEmpty, groupBySections));
|
|
17398
|
+
continue;
|
|
17399
|
+
}
|
|
17400
|
+
if (child.type !== 'input' || !key || key.startsWith('_'))
|
|
17401
|
+
continue;
|
|
17402
|
+
const raw = dataMap === null || dataMap === void 0 ? void 0 : dataMap[key];
|
|
17403
|
+
if (isEmptyRecapValue(raw) && !showEmpty)
|
|
17404
|
+
continue;
|
|
17405
|
+
items.push({
|
|
17406
|
+
kind: 'field',
|
|
17407
|
+
label,
|
|
17408
|
+
value: isEmptyRecapValue(raw) ? '—' : formatRecapValue(child, raw),
|
|
17409
|
+
});
|
|
17410
|
+
}
|
|
17411
|
+
return items;
|
|
17412
|
+
};
|
|
17413
|
+
const recapBrick = createBrick({
|
|
17414
|
+
type: 'output',
|
|
17415
|
+
dataType: 'void',
|
|
17416
|
+
id: 'recap',
|
|
17417
|
+
name: 'Recap',
|
|
17418
|
+
category: 'Layout',
|
|
17419
|
+
defaultConfigs: { label: 'Recap', showEmpty: false, groupBySections: false },
|
|
17420
|
+
render: (props) => {
|
|
17421
|
+
var _a, _b;
|
|
17422
|
+
const items = collectRecapItems(props.rootSpec, props.dataMap, props.locale, ((_a = props.configs) === null || _a === void 0 ? void 0 : _a.showEmpty) === true, ((_b = props.configs) === null || _b === void 0 ? void 0 : _b.groupBySections) === true);
|
|
17423
|
+
const blocks = [];
|
|
17424
|
+
let fields = [];
|
|
17425
|
+
const flushFields = () => {
|
|
17426
|
+
if (!fields.length)
|
|
17427
|
+
return;
|
|
17428
|
+
blocks.push(index$1.h("dl", { class: "fk-recap__list" }, fields.map((field) => (index$1.h("div", { class: "fk-recap__row", key: field.label }, index$1.h("dt", { class: "fk-recap__term" }, field.label), index$1.h("dd", { class: "fk-recap__value" }, field.value))))));
|
|
17429
|
+
fields = [];
|
|
17430
|
+
};
|
|
17431
|
+
for (const item of items) {
|
|
17432
|
+
if (item.kind === 'field') {
|
|
17433
|
+
fields.push(item);
|
|
17434
|
+
continue;
|
|
17435
|
+
}
|
|
17436
|
+
flushFields();
|
|
17437
|
+
if (item.kind === 'section') {
|
|
17438
|
+
blocks.push(index$1.h("span", { class: "fk-recap__group-title", key: `section:${item.label}` }, item.label));
|
|
17439
|
+
continue;
|
|
17440
|
+
}
|
|
17441
|
+
blocks.push(index$1.h("section", { class: "fk-recap__section", key: item.label }, index$1.h("span", { class: "fk-recap__section-title" }, item.label), item.rows.length ? (index$1.h("div", { class: "fk-recap__table-wrap" }, index$1.h("table", { class: "fk-recap__table" }, index$1.h("thead", null, index$1.h("tr", null, index$1.h("th", { class: "fk-recap__index-cell" }, "#"), item.columns.map((column) => (index$1.h("th", { key: column }, column))))), index$1.h("tbody", null, item.rows.map((row, index) => (index$1.h("tr", { key: index }, index$1.h("td", { class: "fk-recap__index-cell" }, index + 1), row.map((cell, cellIndex) => (index$1.h("td", { key: cellIndex }, cell)))))))))) : (index$1.h("p", { class: "fk-recap__empty" }, fkTOr('recap.empty', 'Nothing to summarize yet.')))));
|
|
17442
|
+
}
|
|
17443
|
+
flushFields();
|
|
17444
|
+
return (index$1.h("div", { class: "fk-field fk-recap", style: asInlineStyle(props.styles) }, index$1.h("span", { class: "fk-field__label" }, labelOf(props, 'Recap')), blocks.length ? (blocks) : (index$1.h("p", { class: "fk-recap__empty" }, fkTOr('recap.empty', 'Nothing to summarize yet.')))));
|
|
17445
|
+
},
|
|
17446
|
+
});
|
|
17258
17447
|
function registerDefaultBricks() {
|
|
17259
17448
|
registerBricks([
|
|
17260
17449
|
textInputBrick,
|
|
@@ -17279,6 +17468,7 @@ function registerDefaultBricks() {
|
|
|
17279
17468
|
dataGridBrick,
|
|
17280
17469
|
hiddenBrick,
|
|
17281
17470
|
contentBrick,
|
|
17471
|
+
recapBrick,
|
|
17282
17472
|
groupBrick,
|
|
17283
17473
|
rowBrick,
|
|
17284
17474
|
columnBrick,
|
|
@@ -17317,10 +17507,12 @@ exports.iterateSchemaBricks = iterateSchemaBricks;
|
|
|
17317
17507
|
exports.moveBrick = moveBrick;
|
|
17318
17508
|
exports.multiSelectBrick = multiSelectBrick;
|
|
17319
17509
|
exports.newBrickSpec = newBrickSpec;
|
|
17510
|
+
exports.normalizeOptions = normalizeOptions;
|
|
17320
17511
|
exports.numberBrick = numberBrick;
|
|
17321
17512
|
exports.passwordBrick = passwordBrick;
|
|
17322
17513
|
exports.phoneBrick = phoneBrick;
|
|
17323
17514
|
exports.radioBrick = radioBrick;
|
|
17515
|
+
exports.recapBrick = recapBrick;
|
|
17324
17516
|
exports.registerBrick = registerBrick;
|
|
17325
17517
|
exports.registerBricks = registerBricks;
|
|
17326
17518
|
exports.registerDefaultBricks = registerDefaultBricks;
|