@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h } from './index-
|
|
1
|
+
import { h } from './index-qLZlXROB.js';
|
|
2
2
|
|
|
3
3
|
var _a$1;
|
|
4
4
|
const GLOBAL_KEY$2 = Symbol.for('formkrafter.wc.bricks');
|
|
@@ -15783,7 +15783,7 @@ function buildValidationSchema(brickSpecs, locale) {
|
|
|
15783
15783
|
};
|
|
15784
15784
|
for (const brick of iterateSchemaBricks(brickSpecs)) {
|
|
15785
15785
|
const key = brick.configs?.key;
|
|
15786
|
-
const dataType = brick.dataType;
|
|
15786
|
+
const dataType = brick.configs?.multiple === true && brick.dataType === "object" ? "array" : brick.dataType;
|
|
15787
15787
|
if (!key || !dataType || dataType === "void")
|
|
15788
15788
|
continue;
|
|
15789
15789
|
const isRequired = brick.validations?.find((validation2) => validation2.validator === "required");
|
|
@@ -16388,6 +16388,21 @@ var keyOfError = (error) => {
|
|
|
16388
16388
|
}
|
|
16389
16389
|
return error.instancePath.split("/").filter(Boolean)[0];
|
|
16390
16390
|
};
|
|
16391
|
+
var hiddenKeys = (brickSpec, dataMap) => {
|
|
16392
|
+
const hidden = new Set;
|
|
16393
|
+
const walk = (brick, parentHidden) => {
|
|
16394
|
+
const isHidden = parentHidden || (brick.rules?.length ? getAffectedProperties(brick.rules, dataMap).hidden === true : false);
|
|
16395
|
+
const key = brick.configs?.key;
|
|
16396
|
+
if (isHidden && key)
|
|
16397
|
+
hidden.add(key);
|
|
16398
|
+
if (brick.type === "collection")
|
|
16399
|
+
return;
|
|
16400
|
+
for (const child of brick.children ?? [])
|
|
16401
|
+
walk(child, isHidden);
|
|
16402
|
+
};
|
|
16403
|
+
walk(brickSpec, false);
|
|
16404
|
+
return hidden;
|
|
16405
|
+
};
|
|
16391
16406
|
var validateBrickSpecDataDetailed = (brickSpec, data, locale) => {
|
|
16392
16407
|
const errors = {};
|
|
16393
16408
|
const validate = compiledValidator(brickSpec, locale);
|
|
@@ -16403,6 +16418,10 @@ var validateBrickSpecDataDetailed = (brickSpec, data, locale) => {
|
|
|
16403
16418
|
if (!(key in errors))
|
|
16404
16419
|
errors[key] = message;
|
|
16405
16420
|
}
|
|
16421
|
+
const dataMap = typeof data === "object" && data !== null ? data : undefined;
|
|
16422
|
+
for (const key of hiddenKeys(brickSpec, dataMap)) {
|
|
16423
|
+
delete errors[key];
|
|
16424
|
+
}
|
|
16406
16425
|
return { valid: Object.keys(errors).length === 0, errors };
|
|
16407
16426
|
};
|
|
16408
16427
|
// lib/ops/pointer.ts
|
|
@@ -16572,7 +16591,7 @@ class SpecHistory {
|
|
|
16572
16591
|
}
|
|
16573
16592
|
}
|
|
16574
16593
|
|
|
16575
|
-
//# debugId=
|
|
16594
|
+
//# debugId=889DCABFD85A92E164756E2164756E21
|
|
16576
16595
|
|
|
16577
16596
|
function createBrick(params) {
|
|
16578
16597
|
return new (class extends Brick {
|
|
@@ -16620,6 +16639,28 @@ function asInlineStyle(styles) {
|
|
|
16620
16639
|
return result;
|
|
16621
16640
|
}
|
|
16622
16641
|
|
|
16642
|
+
function normalizeOptions(raw, labelKey = 'label', valueKey = 'value') {
|
|
16643
|
+
if (Array.isArray(raw)) {
|
|
16644
|
+
return raw
|
|
16645
|
+
.map((item) => {
|
|
16646
|
+
var _a, _b;
|
|
16647
|
+
if (typeof item === 'object' && item !== null) {
|
|
16648
|
+
const record = item;
|
|
16649
|
+
const label = (_a = record[labelKey]) !== null && _a !== void 0 ? _a : record[valueKey];
|
|
16650
|
+
const value = (_b = record[valueKey]) !== null && _b !== void 0 ? _b : record[labelKey];
|
|
16651
|
+
return { label: String(label !== null && label !== void 0 ? label : ''), value: String(value !== null && value !== void 0 ? value : '') };
|
|
16652
|
+
}
|
|
16653
|
+
return { label: String(item), value: String(item) };
|
|
16654
|
+
})
|
|
16655
|
+
.filter((option) => option.label !== '');
|
|
16656
|
+
}
|
|
16657
|
+
return String(raw !== null && raw !== void 0 ? raw : '')
|
|
16658
|
+
.split('\n')
|
|
16659
|
+
.map((line) => line.trim())
|
|
16660
|
+
.filter(Boolean)
|
|
16661
|
+
.map((line) => ({ label: line, value: line }));
|
|
16662
|
+
}
|
|
16663
|
+
|
|
16623
16664
|
var _a;
|
|
16624
16665
|
const en = {
|
|
16625
16666
|
'palette.search': 'Search bricks…',
|
|
@@ -16656,6 +16697,9 @@ const en = {
|
|
|
16656
16697
|
'panel.placeholder': 'Placeholder',
|
|
16657
16698
|
'panel.prefix': 'Prefix',
|
|
16658
16699
|
'panel.suffix': 'Suffix',
|
|
16700
|
+
'panel.accept': 'Accepted file types',
|
|
16701
|
+
'panel.uploadUrl': 'Upload URL',
|
|
16702
|
+
'panel.cfg.multiple': 'Allow multiple files',
|
|
16659
16703
|
'panel.optionsSource': 'Options source',
|
|
16660
16704
|
'panel.options': 'Options (one per line)',
|
|
16661
16705
|
'panel.content': 'Content',
|
|
@@ -16683,6 +16727,7 @@ const en = {
|
|
|
16683
16727
|
'file.choose': 'Choose a file…',
|
|
16684
16728
|
'file.uploading': 'Uploading…',
|
|
16685
16729
|
'file.remove': 'Remove file',
|
|
16730
|
+
'file.addAnother': '+ Add a file',
|
|
16686
16731
|
'address.street': 'Street',
|
|
16687
16732
|
'address.city': 'City',
|
|
16688
16733
|
'address.zip': 'Postal code',
|
|
@@ -16728,6 +16773,12 @@ const en = {
|
|
|
16728
16773
|
'brick.file.name': 'File',
|
|
16729
16774
|
'brick.hidden.name': 'Hidden',
|
|
16730
16775
|
'brick.content.name': 'Content',
|
|
16776
|
+
'brick.recap.name': 'Recap',
|
|
16777
|
+
'recap.empty': 'Nothing to summarize yet.',
|
|
16778
|
+
'recap.yes': 'Yes',
|
|
16779
|
+
'recap.no': 'No',
|
|
16780
|
+
'panel.cfg.showEmpty': 'Show empty fields',
|
|
16781
|
+
'panel.cfg.groupBySections': 'Group by section',
|
|
16731
16782
|
'brick.group.name': 'Group',
|
|
16732
16783
|
'brick.row.name': 'Row',
|
|
16733
16784
|
'brick.column.name': 'Column',
|
|
@@ -16769,6 +16820,9 @@ const frFkTranslations = {
|
|
|
16769
16820
|
'panel.placeholder': 'Placeholder',
|
|
16770
16821
|
'panel.prefix': 'Préfixe',
|
|
16771
16822
|
'panel.suffix': 'Suffixe',
|
|
16823
|
+
'panel.accept': 'Types de fichiers acceptés',
|
|
16824
|
+
'panel.uploadUrl': "URL d'upload",
|
|
16825
|
+
'panel.cfg.multiple': 'Autoriser plusieurs fichiers',
|
|
16772
16826
|
'panel.optionsSource': 'Source des options',
|
|
16773
16827
|
'panel.options': 'Options (une par ligne)',
|
|
16774
16828
|
'panel.content': 'Contenu',
|
|
@@ -16796,6 +16850,7 @@ const frFkTranslations = {
|
|
|
16796
16850
|
'file.choose': 'Choisir un fichier…',
|
|
16797
16851
|
'file.uploading': 'Envoi en cours…',
|
|
16798
16852
|
'file.remove': 'Retirer le fichier',
|
|
16853
|
+
'file.addAnother': '+ Ajouter un fichier',
|
|
16799
16854
|
'address.street': 'Rue',
|
|
16800
16855
|
'address.city': 'Ville',
|
|
16801
16856
|
'address.zip': 'Code postal',
|
|
@@ -16841,6 +16896,12 @@ const frFkTranslations = {
|
|
|
16841
16896
|
'brick.file.name': 'Fichier',
|
|
16842
16897
|
'brick.hidden.name': 'Caché',
|
|
16843
16898
|
'brick.content.name': 'Contenu',
|
|
16899
|
+
'brick.recap.name': 'Récapitulatif',
|
|
16900
|
+
'recap.empty': 'Rien à récapituler pour le moment.',
|
|
16901
|
+
'recap.yes': 'Oui',
|
|
16902
|
+
'recap.no': 'Non',
|
|
16903
|
+
'panel.cfg.showEmpty': 'Afficher les champs vides',
|
|
16904
|
+
'panel.cfg.groupBySections': 'Regrouper par section',
|
|
16844
16905
|
'brick.group.name': 'Groupe',
|
|
16845
16906
|
'brick.row.name': 'Ligne',
|
|
16846
16907
|
'brick.column.name': 'Colonne',
|
|
@@ -16875,8 +16936,10 @@ const adorned = (props, control) => {
|
|
|
16875
16936
|
return control;
|
|
16876
16937
|
return (h("div", { class: "fk-adorned" }, prefix ? h("span", { class: "fk-adorned__affix" }, prefix) : null, control, suffix ? h("span", { class: "fk-adorned__affix" }, suffix) : null));
|
|
16877
16938
|
};
|
|
16878
|
-
const
|
|
16879
|
-
const
|
|
16939
|
+
const fieldError = (props) => props.error ? (h("span", { class: "fk-field__error", role: "alert" }, props.error)) : null;
|
|
16940
|
+
const invalidAttr = (props) => props.error ? { 'aria-invalid': 'true' } : {};
|
|
16941
|
+
const fieldBlock = (props, fallback, control) => (h("div", { class: "fk-field", style: asInlineStyle(props.styles) }, h("span", { class: "fk-field__label" }, labelOf(props, fallback)), control, fieldError(props)));
|
|
16942
|
+
const field = (props, fallback, control) => (h("label", { class: "fk-field", style: asInlineStyle(props.styles) }, h("span", { class: "fk-field__label" }, labelOf(props, fallback)), control, fieldError(props)));
|
|
16880
16943
|
const createTextVariant = (params) => createBrick({
|
|
16881
16944
|
type: 'input',
|
|
16882
16945
|
dataType: 'string',
|
|
@@ -16886,7 +16949,7 @@ const createTextVariant = (params) => createBrick({
|
|
|
16886
16949
|
defaultConfigs: { label: params.name },
|
|
16887
16950
|
render: (props) => {
|
|
16888
16951
|
var _a, _b;
|
|
16889
|
-
return field(props, params.name, adorned(props, h("input", { class: "fk-field__input fk-adorned__input", type: params.inputType, value: (_a = props.data) !== null && _a !== void 0 ? _a : '', placeholder: (_b = props.configs) === null || _b === void 0 ? void 0 : _b.placeholder, disabled: props.editable || props.disabled, onInput: (event) => { var _a; return (_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, event.target.value); } })));
|
|
16952
|
+
return field(props, params.name, adorned(props, h("input", Object.assign({}, invalidAttr(props), { class: "fk-field__input fk-adorned__input", type: params.inputType, value: (_a = props.data) !== null && _a !== void 0 ? _a : '', placeholder: (_b = props.configs) === null || _b === void 0 ? void 0 : _b.placeholder, disabled: props.editable || props.disabled, onInput: (event) => { var _a; return (_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, event.target.value); } }))));
|
|
16890
16953
|
},
|
|
16891
16954
|
});
|
|
16892
16955
|
const textInputBrick = createTextVariant({
|
|
@@ -16923,7 +16986,7 @@ const textareaBrick = createBrick({
|
|
|
16923
16986
|
defaultConfigs: { label: 'Text area' },
|
|
16924
16987
|
render: (props) => {
|
|
16925
16988
|
var _a, _b;
|
|
16926
|
-
return field(props, 'Text area', h("textarea", { class: "fk-field__input fk-field__input--textarea", value: (_a = props.data) !== null && _a !== void 0 ? _a : '', placeholder: (_b = props.configs) === null || _b === void 0 ? void 0 : _b.placeholder, disabled: props.editable || props.disabled, onInput: (event) => { var _a; return (_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, event.target.value); } }));
|
|
16989
|
+
return field(props, 'Text area', h("textarea", Object.assign({}, invalidAttr(props), { class: "fk-field__input fk-field__input--textarea", value: (_a = props.data) !== null && _a !== void 0 ? _a : '', placeholder: (_b = props.configs) === null || _b === void 0 ? void 0 : _b.placeholder, disabled: props.editable || props.disabled, onInput: (event) => { var _a; return (_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, event.target.value); } })));
|
|
16927
16990
|
},
|
|
16928
16991
|
});
|
|
16929
16992
|
const numberBrick = createBrick({
|
|
@@ -16935,11 +16998,11 @@ const numberBrick = createBrick({
|
|
|
16935
16998
|
defaultConfigs: { label: 'Number' },
|
|
16936
16999
|
render: (props) => {
|
|
16937
17000
|
var _a;
|
|
16938
|
-
return field(props, 'Number', adorned(props, h("input", { class: "fk-field__input fk-adorned__input", type: "number", value: props.data == null ? '' : String(props.data), placeholder: (_a = props.configs) === null || _a === void 0 ? void 0 : _a.placeholder, disabled: props.editable || props.disabled, onInput: (event) => {
|
|
17001
|
+
return field(props, 'Number', adorned(props, h("input", Object.assign({}, invalidAttr(props), { class: "fk-field__input fk-adorned__input", type: "number", value: props.data == null ? '' : String(props.data), placeholder: (_a = props.configs) === null || _a === void 0 ? void 0 : _a.placeholder, disabled: props.editable || props.disabled, onInput: (event) => {
|
|
16939
17002
|
var _a;
|
|
16940
17003
|
const raw = event.target.value;
|
|
16941
17004
|
(_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, raw === '' ? undefined : Number(raw));
|
|
16942
|
-
} })));
|
|
17005
|
+
} }))));
|
|
16943
17006
|
},
|
|
16944
17007
|
});
|
|
16945
17008
|
const dateBrick = createBrick({
|
|
@@ -16951,11 +17014,11 @@ const dateBrick = createBrick({
|
|
|
16951
17014
|
defaultConfigs: { label: 'Date' },
|
|
16952
17015
|
render: (props) => {
|
|
16953
17016
|
var _a;
|
|
16954
|
-
return field(props, 'Date', h("input", { class: "fk-field__input", type: "date", value: (_a = props.data) !== null && _a !== void 0 ? _a : '', disabled: props.editable || props.disabled, onInput: (event) => {
|
|
17017
|
+
return field(props, 'Date', h("input", Object.assign({}, invalidAttr(props), { class: "fk-field__input", type: "date", value: (_a = props.data) !== null && _a !== void 0 ? _a : '', disabled: props.editable || props.disabled, onInput: (event) => {
|
|
16955
17018
|
var _a;
|
|
16956
17019
|
const raw = event.target.value;
|
|
16957
17020
|
(_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, raw === '' ? undefined : raw);
|
|
16958
|
-
} }));
|
|
17021
|
+
} })));
|
|
16959
17022
|
},
|
|
16960
17023
|
});
|
|
16961
17024
|
const selectBrick = createBrick({
|
|
@@ -16971,7 +17034,7 @@ const selectBrick = createBrick({
|
|
|
16971
17034
|
},
|
|
16972
17035
|
render: (props) => {
|
|
16973
17036
|
var _a;
|
|
16974
|
-
return fieldBlock(props, 'Select', h("fk-select-input", { configs: props.configs, value: (_a = props.data) !== null && _a !== void 0 ? _a : '', disabled: props.editable || props.disabled, dataMap: props.dataMap, onSelectValueChange: (event) => {
|
|
17037
|
+
return fieldBlock(props, 'Select', h("fk-select-input", { configs: props.configs, value: (_a = props.data) !== null && _a !== void 0 ? _a : '', disabled: props.editable || props.disabled, invalid: !!props.error, dataMap: props.dataMap, onSelectValueChange: (event) => {
|
|
16975
17038
|
var _a;
|
|
16976
17039
|
event.stopPropagation();
|
|
16977
17040
|
(_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, event.detail);
|
|
@@ -16989,7 +17052,7 @@ const multiSelectBrick = createBrick({
|
|
|
16989
17052
|
optionsSource: 'static',
|
|
16990
17053
|
options: 'Option 1\nOption 2\nOption 3',
|
|
16991
17054
|
},
|
|
16992
|
-
render: (props) => fieldBlock(props, 'Multi select', h("fk-select-input", { configs: props.configs, value: Array.isArray(props.data) ? props.data : [], multiple: true, disabled: props.editable || props.disabled, dataMap: props.dataMap, onSelectValueChange: (event) => {
|
|
17055
|
+
render: (props) => fieldBlock(props, 'Multi select', h("fk-select-input", { configs: props.configs, value: Array.isArray(props.data) ? props.data : [], multiple: true, disabled: props.editable || props.disabled, invalid: !!props.error, dataMap: props.dataMap, onSelectValueChange: (event) => {
|
|
16993
17056
|
var _a;
|
|
16994
17057
|
event.stopPropagation();
|
|
16995
17058
|
(_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, event.detail);
|
|
@@ -17005,10 +17068,10 @@ const datetimeBrick = createTextVariant({
|
|
|
17005
17068
|
name: 'Date / Time',
|
|
17006
17069
|
inputType: 'datetime-local',
|
|
17007
17070
|
});
|
|
17008
|
-
const staticOptions = (
|
|
17009
|
-
|
|
17010
|
-
.
|
|
17011
|
-
|
|
17071
|
+
const staticOptions = (props) => {
|
|
17072
|
+
var _a, _b, _c;
|
|
17073
|
+
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');
|
|
17074
|
+
};
|
|
17012
17075
|
const selectBoxesBrick = createBrick({
|
|
17013
17076
|
type: 'input',
|
|
17014
17077
|
dataType: 'array',
|
|
@@ -17017,16 +17080,15 @@ const selectBoxesBrick = createBrick({
|
|
|
17017
17080
|
category: 'Inputs',
|
|
17018
17081
|
defaultConfigs: { label: 'Select boxes', options: 'Option 1\nOption 2\nOption 3' },
|
|
17019
17082
|
render: (props) => {
|
|
17020
|
-
var _a;
|
|
17021
17083
|
const selected = Array.isArray(props.data) ? props.data : [];
|
|
17022
|
-
return (h("div", { class: "fk-field", style: asInlineStyle(props.styles) }, h("span", { class: "fk-field__label" }, labelOf(props, 'Select boxes')), h("div", { class: "fk-radio-group" }, staticOptions(
|
|
17084
|
+
return (h("div", { class: "fk-field", style: asInlineStyle(props.styles) }, h("span", { class: "fk-field__label" }, labelOf(props, 'Select boxes')), h("div", { class: "fk-radio-group" }, staticOptions(props).map((option) => (h("label", { class: "fk-radio", key: option.value }, h("input", { type: "checkbox", checked: selected.includes(option.value), disabled: props.editable || props.disabled, onChange: (event) => {
|
|
17023
17085
|
var _a;
|
|
17024
17086
|
const checked = event.target.checked;
|
|
17025
17087
|
const next = checked
|
|
17026
|
-
? [...selected, option]
|
|
17027
|
-
: selected.filter((value) => value !== option);
|
|
17088
|
+
? [...selected, option.value]
|
|
17089
|
+
: selected.filter((value) => value !== option.value);
|
|
17028
17090
|
(_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, next.length ? next : undefined);
|
|
17029
|
-
} }), h("span", null, option))))), props.error ? h("span", { class: "fk-field__error" }, props.error) : null));
|
|
17091
|
+
} }), h("span", null, option.label))))), props.error ? h("span", { class: "fk-field__error" }, props.error) : null));
|
|
17030
17092
|
},
|
|
17031
17093
|
});
|
|
17032
17094
|
const tagsBrick = createBrick({
|
|
@@ -17098,17 +17160,10 @@ const radioBrick = createBrick({
|
|
|
17098
17160
|
name: 'Radio',
|
|
17099
17161
|
category: 'Inputs',
|
|
17100
17162
|
defaultConfigs: { label: 'Radio', options: 'Option 1\nOption 2' },
|
|
17101
|
-
render: (props) => {
|
|
17163
|
+
render: (props) => (h("div", { class: "fk-field", style: asInlineStyle(props.styles) }, h("span", { class: "fk-field__label" }, labelOf(props, 'Radio')), h("div", Object.assign({ class: "fk-radio-group", role: "radiogroup" }, invalidAttr(props)), staticOptions(props).map((option) => {
|
|
17102
17164
|
var _a, _b;
|
|
17103
|
-
return (h("
|
|
17104
|
-
|
|
17105
|
-
.map((option) => option.trim())
|
|
17106
|
-
.filter(Boolean)
|
|
17107
|
-
.map((option) => {
|
|
17108
|
-
var _a, _b;
|
|
17109
|
-
return (h("label", { class: "fk-radio", key: option }, 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); } }), h("span", null, option)));
|
|
17110
|
-
})), props.error ? h("span", { class: "fk-field__error" }, props.error) : null));
|
|
17111
|
-
},
|
|
17165
|
+
return (h("label", { class: "fk-radio", key: option.value }, 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); } }), h("span", null, option.label)));
|
|
17166
|
+
})), props.error ? h("span", { class: "fk-field__error" }, props.error) : null)),
|
|
17112
17167
|
});
|
|
17113
17168
|
const ADDRESS_PARTS = [
|
|
17114
17169
|
{ key: 'street', label: () => fkT('address.street'), full: true },
|
|
@@ -17144,10 +17199,10 @@ const fileBrick = createBrick({
|
|
|
17144
17199
|
id: 'file',
|
|
17145
17200
|
name: 'File',
|
|
17146
17201
|
category: 'Data',
|
|
17147
|
-
defaultConfigs: { label: 'File' },
|
|
17202
|
+
defaultConfigs: { label: 'File', accept: '', uploadUrl: '', multiple: false },
|
|
17148
17203
|
render: (props) => {
|
|
17149
|
-
var _a;
|
|
17150
|
-
return fieldBlock(props, 'File', 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) => {
|
|
17204
|
+
var _a, _b, _c;
|
|
17205
|
+
return fieldBlock(props, 'File', 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, multiple: ((_c = props.configs) === null || _c === void 0 ? void 0 : _c.multiple) === true, disabled: props.editable || props.disabled, onFileValueChange: (event) => {
|
|
17151
17206
|
var _a;
|
|
17152
17207
|
event.stopPropagation();
|
|
17153
17208
|
(_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, event.detail);
|
|
@@ -17253,6 +17308,150 @@ const columnBrick = createBrick({
|
|
|
17253
17308
|
category: 'Layout',
|
|
17254
17309
|
render: (props) => (h("div", { class: "fk-column", style: asInlineStyle(props.styles) }, props.children)),
|
|
17255
17310
|
});
|
|
17311
|
+
const formatRecapValue = (brick, value) => {
|
|
17312
|
+
var _a;
|
|
17313
|
+
if (Array.isArray(value)) {
|
|
17314
|
+
return value
|
|
17315
|
+
.map((item) => formatRecapValue(brick, item))
|
|
17316
|
+
.filter(Boolean)
|
|
17317
|
+
.join(', ');
|
|
17318
|
+
}
|
|
17319
|
+
if (value === true)
|
|
17320
|
+
return fkTOr('recap.yes', 'Yes');
|
|
17321
|
+
if (value === false)
|
|
17322
|
+
return fkTOr('recap.no', 'No');
|
|
17323
|
+
if (value && typeof value === 'object') {
|
|
17324
|
+
const record = value;
|
|
17325
|
+
if (typeof record.name === 'string' && 'url' in record)
|
|
17326
|
+
return record.name;
|
|
17327
|
+
return Object.values(record)
|
|
17328
|
+
.filter((part) => typeof part === 'string' && part)
|
|
17329
|
+
.join(' ');
|
|
17330
|
+
}
|
|
17331
|
+
const raw = String(value !== null && value !== void 0 ? value : '');
|
|
17332
|
+
if (((_a = brick.configs) === null || _a === void 0 ? void 0 : _a.options) != null) {
|
|
17333
|
+
const labelKey = typeof brick.configs.labelKey === 'string' ? brick.configs.labelKey : 'label';
|
|
17334
|
+
const valueKey = typeof brick.configs.valueKey === 'string' ? brick.configs.valueKey : 'value';
|
|
17335
|
+
const match = normalizeOptions(brick.configs.options, labelKey, valueKey).find((option) => option.value === raw);
|
|
17336
|
+
if (match)
|
|
17337
|
+
return match.label;
|
|
17338
|
+
}
|
|
17339
|
+
return raw;
|
|
17340
|
+
};
|
|
17341
|
+
const isEmptyRecapValue = (raw) => raw === undefined ||
|
|
17342
|
+
raw === null ||
|
|
17343
|
+
raw === '' ||
|
|
17344
|
+
(Array.isArray(raw) && raw.length === 0);
|
|
17345
|
+
const brickLabel = (brick, locale) => {
|
|
17346
|
+
var _a, _b, _c, _d, _e;
|
|
17347
|
+
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 : '');
|
|
17348
|
+
};
|
|
17349
|
+
const collectionInputs = (spec) => {
|
|
17350
|
+
var _a, _b;
|
|
17351
|
+
const inputs = [];
|
|
17352
|
+
for (const child of (_a = spec.children) !== null && _a !== void 0 ? _a : []) {
|
|
17353
|
+
const key = (_b = child.configs) === null || _b === void 0 ? void 0 : _b.key;
|
|
17354
|
+
if (child.type === 'input' && key && !key.startsWith('_')) {
|
|
17355
|
+
inputs.push(child);
|
|
17356
|
+
}
|
|
17357
|
+
else if (child.type === 'panel') {
|
|
17358
|
+
inputs.push(...collectionInputs(child));
|
|
17359
|
+
}
|
|
17360
|
+
}
|
|
17361
|
+
return inputs;
|
|
17362
|
+
};
|
|
17363
|
+
const collectRecapItems = (spec, dataMap, locale, showEmpty, groupBySections = false) => {
|
|
17364
|
+
var _a, _b, _c;
|
|
17365
|
+
if (!spec)
|
|
17366
|
+
return [];
|
|
17367
|
+
const items = [];
|
|
17368
|
+
for (const child of (_a = spec.children) !== null && _a !== void 0 ? _a : []) {
|
|
17369
|
+
if (child.id === 'recap' || child.type === 'action')
|
|
17370
|
+
continue;
|
|
17371
|
+
if (getAffectedProperties(child.rules, dataMap).hidden === true)
|
|
17372
|
+
continue;
|
|
17373
|
+
const key = (_b = child.configs) === null || _b === void 0 ? void 0 : _b.key;
|
|
17374
|
+
const label = brickLabel(child, locale);
|
|
17375
|
+
if (child.type === 'collection') {
|
|
17376
|
+
const rows = key && Array.isArray(dataMap === null || dataMap === void 0 ? void 0 : dataMap[key])
|
|
17377
|
+
? dataMap[key]
|
|
17378
|
+
: [];
|
|
17379
|
+
if (!rows.length && !showEmpty)
|
|
17380
|
+
continue;
|
|
17381
|
+
const inputs = collectionInputs(child);
|
|
17382
|
+
items.push({
|
|
17383
|
+
kind: 'collection',
|
|
17384
|
+
label,
|
|
17385
|
+
columns: inputs.map((input) => brickLabel(input, locale)),
|
|
17386
|
+
rows: rows.map((row) => inputs.map((input) => {
|
|
17387
|
+
const raw = row === null || row === void 0 ? void 0 : row[input.configs.key];
|
|
17388
|
+
return isEmptyRecapValue(raw) ? '—' : formatRecapValue(input, raw);
|
|
17389
|
+
})),
|
|
17390
|
+
});
|
|
17391
|
+
continue;
|
|
17392
|
+
}
|
|
17393
|
+
if (child.type === 'panel') {
|
|
17394
|
+
const sectionLabel = resolveLocalizedText((_c = child.configs) === null || _c === void 0 ? void 0 : _c.label, locale);
|
|
17395
|
+
if (groupBySections &&
|
|
17396
|
+
typeof sectionLabel === 'string' &&
|
|
17397
|
+
sectionLabel.trim()) {
|
|
17398
|
+
const sectionItems = collectRecapItems(child, dataMap, locale, showEmpty);
|
|
17399
|
+
if (sectionItems.length) {
|
|
17400
|
+
items.push({ kind: 'section', label: sectionLabel });
|
|
17401
|
+
items.push(...sectionItems);
|
|
17402
|
+
}
|
|
17403
|
+
continue;
|
|
17404
|
+
}
|
|
17405
|
+
items.push(...collectRecapItems(child, dataMap, locale, showEmpty, groupBySections));
|
|
17406
|
+
continue;
|
|
17407
|
+
}
|
|
17408
|
+
if (child.type !== 'input' || !key || key.startsWith('_'))
|
|
17409
|
+
continue;
|
|
17410
|
+
const raw = dataMap === null || dataMap === void 0 ? void 0 : dataMap[key];
|
|
17411
|
+
if (isEmptyRecapValue(raw) && !showEmpty)
|
|
17412
|
+
continue;
|
|
17413
|
+
items.push({
|
|
17414
|
+
kind: 'field',
|
|
17415
|
+
label,
|
|
17416
|
+
value: isEmptyRecapValue(raw) ? '—' : formatRecapValue(child, raw),
|
|
17417
|
+
});
|
|
17418
|
+
}
|
|
17419
|
+
return items;
|
|
17420
|
+
};
|
|
17421
|
+
const recapBrick = createBrick({
|
|
17422
|
+
type: 'output',
|
|
17423
|
+
dataType: 'void',
|
|
17424
|
+
id: 'recap',
|
|
17425
|
+
name: 'Recap',
|
|
17426
|
+
category: 'Layout',
|
|
17427
|
+
defaultConfigs: { label: 'Recap', showEmpty: false, groupBySections: false },
|
|
17428
|
+
render: (props) => {
|
|
17429
|
+
var _a, _b;
|
|
17430
|
+
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);
|
|
17431
|
+
const blocks = [];
|
|
17432
|
+
let fields = [];
|
|
17433
|
+
const flushFields = () => {
|
|
17434
|
+
if (!fields.length)
|
|
17435
|
+
return;
|
|
17436
|
+
blocks.push(h("dl", { class: "fk-recap__list" }, fields.map((field) => (h("div", { class: "fk-recap__row", key: field.label }, h("dt", { class: "fk-recap__term" }, field.label), h("dd", { class: "fk-recap__value" }, field.value))))));
|
|
17437
|
+
fields = [];
|
|
17438
|
+
};
|
|
17439
|
+
for (const item of items) {
|
|
17440
|
+
if (item.kind === 'field') {
|
|
17441
|
+
fields.push(item);
|
|
17442
|
+
continue;
|
|
17443
|
+
}
|
|
17444
|
+
flushFields();
|
|
17445
|
+
if (item.kind === 'section') {
|
|
17446
|
+
blocks.push(h("span", { class: "fk-recap__group-title", key: `section:${item.label}` }, item.label));
|
|
17447
|
+
continue;
|
|
17448
|
+
}
|
|
17449
|
+
blocks.push(h("section", { class: "fk-recap__section", key: item.label }, h("span", { class: "fk-recap__section-title" }, item.label), item.rows.length ? (h("div", { class: "fk-recap__table-wrap" }, h("table", { class: "fk-recap__table" }, h("thead", null, h("tr", null, h("th", { class: "fk-recap__index-cell" }, "#"), item.columns.map((column) => (h("th", { key: column }, column))))), h("tbody", null, item.rows.map((row, index) => (h("tr", { key: index }, h("td", { class: "fk-recap__index-cell" }, index + 1), row.map((cell, cellIndex) => (h("td", { key: cellIndex }, cell)))))))))) : (h("p", { class: "fk-recap__empty" }, fkTOr('recap.empty', 'Nothing to summarize yet.')))));
|
|
17450
|
+
}
|
|
17451
|
+
flushFields();
|
|
17452
|
+
return (h("div", { class: "fk-field fk-recap", style: asInlineStyle(props.styles) }, h("span", { class: "fk-field__label" }, labelOf(props, 'Recap')), blocks.length ? (blocks) : (h("p", { class: "fk-recap__empty" }, fkTOr('recap.empty', 'Nothing to summarize yet.')))));
|
|
17453
|
+
},
|
|
17454
|
+
});
|
|
17256
17455
|
function registerDefaultBricks() {
|
|
17257
17456
|
registerBricks([
|
|
17258
17457
|
textInputBrick,
|
|
@@ -17277,6 +17476,7 @@ function registerDefaultBricks() {
|
|
|
17277
17476
|
dataGridBrick,
|
|
17278
17477
|
hiddenBrick,
|
|
17279
17478
|
contentBrick,
|
|
17479
|
+
recapBrick,
|
|
17280
17480
|
groupBrick,
|
|
17281
17481
|
rowBrick,
|
|
17282
17482
|
columnBrick,
|
|
@@ -17285,4 +17485,4 @@ function registerDefaultBricks() {
|
|
|
17285
17485
|
]);
|
|
17286
17486
|
}
|
|
17287
17487
|
|
|
17288
|
-
export {
|
|
17488
|
+
export { rowBrick as $, registerBricks as A, createBrick as B, textInputBrick as C, emailBrick as D, passwordBrick as E, urlBrick as F, phoneBrick as G, textareaBrick as H, numberBrick as I, dateBrick as J, timeBrick as K, datetimeBrick as L, selectBrick as M, multiSelectBrick as N, radioBrick as O, selectBoxesBrick as P, checkboxBrick as Q, tagsBrick as R, SpecHistory as S, signatureBrick as T, addressBrick as U, fileBrick as V, dataGridBrick as W, hiddenBrick as X, contentBrick as Y, recapBrick as Z, groupBrick as _, getBrickMoldsGroupedByCategory as a, columnBrick as a0, stepperBrick as a1, tabsBrick as a2, setFkTranslations as a3, frFkTranslations as a4, fkTOr as b, getBrick as c, getAffectedProperties as d, registerDefaultBricks as e, fkT as f, getBrickMolds as g, addBrick as h, getBrickAt as i, removeBrick as j, duplicateBrick as k, updateBrickStyles as l, moveBrick as m, newBrickSpec as n, updateBrickValidations as o, updateBrickRules as p, iterateBricks as q, resolveLocalizedRecord as r, services as s, isLocalizedObject as t, updateBrickConfigs as u, validateBrickSpecDataDetailed as v, normalizeOptions as w, evalBrickCode as x, iterateSchemaBricks as y, registerBrick as z };
|