@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,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$1 = require('./index-
|
|
3
|
+
var index$1 = require('./index-CImTe9BG.js');
|
|
4
4
|
|
|
5
5
|
var _a$1;
|
|
6
6
|
const GLOBAL_KEY$2 = Symbol.for('formkrafter.wc.bricks');
|
|
@@ -15785,7 +15785,7 @@ function buildValidationSchema(brickSpecs, locale) {
|
|
|
15785
15785
|
};
|
|
15786
15786
|
for (const brick of iterateSchemaBricks(brickSpecs)) {
|
|
15787
15787
|
const key = brick.configs?.key;
|
|
15788
|
-
const dataType = brick.dataType;
|
|
15788
|
+
const dataType = brick.configs?.multiple === true && brick.dataType === "object" ? "array" : brick.dataType;
|
|
15789
15789
|
if (!key || !dataType || dataType === "void")
|
|
15790
15790
|
continue;
|
|
15791
15791
|
const isRequired = brick.validations?.find((validation2) => validation2.validator === "required");
|
|
@@ -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=889DCABFD85A92E164756E2164756E21
|
|
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…',
|
|
@@ -16658,6 +16699,9 @@ const en = {
|
|
|
16658
16699
|
'panel.placeholder': 'Placeholder',
|
|
16659
16700
|
'panel.prefix': 'Prefix',
|
|
16660
16701
|
'panel.suffix': 'Suffix',
|
|
16702
|
+
'panel.accept': 'Accepted file types',
|
|
16703
|
+
'panel.uploadUrl': 'Upload URL',
|
|
16704
|
+
'panel.cfg.multiple': 'Allow multiple files',
|
|
16661
16705
|
'panel.optionsSource': 'Options source',
|
|
16662
16706
|
'panel.options': 'Options (one per line)',
|
|
16663
16707
|
'panel.content': 'Content',
|
|
@@ -16685,6 +16729,7 @@ const en = {
|
|
|
16685
16729
|
'file.choose': 'Choose a file…',
|
|
16686
16730
|
'file.uploading': 'Uploading…',
|
|
16687
16731
|
'file.remove': 'Remove file',
|
|
16732
|
+
'file.addAnother': '+ Add a file',
|
|
16688
16733
|
'address.street': 'Street',
|
|
16689
16734
|
'address.city': 'City',
|
|
16690
16735
|
'address.zip': 'Postal code',
|
|
@@ -16730,6 +16775,12 @@ const en = {
|
|
|
16730
16775
|
'brick.file.name': 'File',
|
|
16731
16776
|
'brick.hidden.name': 'Hidden',
|
|
16732
16777
|
'brick.content.name': 'Content',
|
|
16778
|
+
'brick.recap.name': 'Recap',
|
|
16779
|
+
'recap.empty': 'Nothing to summarize yet.',
|
|
16780
|
+
'recap.yes': 'Yes',
|
|
16781
|
+
'recap.no': 'No',
|
|
16782
|
+
'panel.cfg.showEmpty': 'Show empty fields',
|
|
16783
|
+
'panel.cfg.groupBySections': 'Group by section',
|
|
16733
16784
|
'brick.group.name': 'Group',
|
|
16734
16785
|
'brick.row.name': 'Row',
|
|
16735
16786
|
'brick.column.name': 'Column',
|
|
@@ -16771,6 +16822,9 @@ const frFkTranslations = {
|
|
|
16771
16822
|
'panel.placeholder': 'Placeholder',
|
|
16772
16823
|
'panel.prefix': 'Préfixe',
|
|
16773
16824
|
'panel.suffix': 'Suffixe',
|
|
16825
|
+
'panel.accept': 'Types de fichiers acceptés',
|
|
16826
|
+
'panel.uploadUrl': "URL d'upload",
|
|
16827
|
+
'panel.cfg.multiple': 'Autoriser plusieurs fichiers',
|
|
16774
16828
|
'panel.optionsSource': 'Source des options',
|
|
16775
16829
|
'panel.options': 'Options (une par ligne)',
|
|
16776
16830
|
'panel.content': 'Contenu',
|
|
@@ -16798,6 +16852,7 @@ const frFkTranslations = {
|
|
|
16798
16852
|
'file.choose': 'Choisir un fichier…',
|
|
16799
16853
|
'file.uploading': 'Envoi en cours…',
|
|
16800
16854
|
'file.remove': 'Retirer le fichier',
|
|
16855
|
+
'file.addAnother': '+ Ajouter un fichier',
|
|
16801
16856
|
'address.street': 'Rue',
|
|
16802
16857
|
'address.city': 'Ville',
|
|
16803
16858
|
'address.zip': 'Code postal',
|
|
@@ -16843,6 +16898,12 @@ const frFkTranslations = {
|
|
|
16843
16898
|
'brick.file.name': 'Fichier',
|
|
16844
16899
|
'brick.hidden.name': 'Caché',
|
|
16845
16900
|
'brick.content.name': 'Contenu',
|
|
16901
|
+
'brick.recap.name': 'Récapitulatif',
|
|
16902
|
+
'recap.empty': 'Rien à récapituler pour le moment.',
|
|
16903
|
+
'recap.yes': 'Oui',
|
|
16904
|
+
'recap.no': 'Non',
|
|
16905
|
+
'panel.cfg.showEmpty': 'Afficher les champs vides',
|
|
16906
|
+
'panel.cfg.groupBySections': 'Regrouper par section',
|
|
16846
16907
|
'brick.group.name': 'Groupe',
|
|
16847
16908
|
'brick.row.name': 'Ligne',
|
|
16848
16909
|
'brick.column.name': 'Colonne',
|
|
@@ -16877,8 +16938,10 @@ const adorned = (props, control) => {
|
|
|
16877
16938
|
return control;
|
|
16878
16939
|
return (index$1.h("div", { class: "fk-adorned" }, prefix ? index$1.h("span", { class: "fk-adorned__affix" }, prefix) : null, control, suffix ? index$1.h("span", { class: "fk-adorned__affix" }, suffix) : null));
|
|
16879
16940
|
};
|
|
16880
|
-
const
|
|
16881
|
-
const
|
|
16941
|
+
const fieldError = (props) => props.error ? (index$1.h("span", { class: "fk-field__error", role: "alert" }, props.error)) : null;
|
|
16942
|
+
const invalidAttr = (props) => props.error ? { 'aria-invalid': 'true' } : {};
|
|
16943
|
+
const fieldBlock = (props, fallback, control) => (index$1.h("div", { class: "fk-field", style: asInlineStyle(props.styles) }, index$1.h("span", { class: "fk-field__label" }, labelOf(props, fallback)), control, fieldError(props)));
|
|
16944
|
+
const field = (props, fallback, control) => (index$1.h("label", { class: "fk-field", style: asInlineStyle(props.styles) }, index$1.h("span", { class: "fk-field__label" }, labelOf(props, fallback)), control, fieldError(props)));
|
|
16882
16945
|
const createTextVariant = (params) => createBrick({
|
|
16883
16946
|
type: 'input',
|
|
16884
16947
|
dataType: 'string',
|
|
@@ -16888,7 +16951,7 @@ const createTextVariant = (params) => createBrick({
|
|
|
16888
16951
|
defaultConfigs: { label: params.name },
|
|
16889
16952
|
render: (props) => {
|
|
16890
16953
|
var _a, _b;
|
|
16891
|
-
return field(props, params.name, adorned(props, index$1.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); } })));
|
|
16954
|
+
return field(props, params.name, adorned(props, index$1.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); } }))));
|
|
16892
16955
|
},
|
|
16893
16956
|
});
|
|
16894
16957
|
const textInputBrick = createTextVariant({
|
|
@@ -16925,7 +16988,7 @@ const textareaBrick = createBrick({
|
|
|
16925
16988
|
defaultConfigs: { label: 'Text area' },
|
|
16926
16989
|
render: (props) => {
|
|
16927
16990
|
var _a, _b;
|
|
16928
|
-
return field(props, 'Text area', index$1.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); } }));
|
|
16991
|
+
return field(props, 'Text area', index$1.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); } })));
|
|
16929
16992
|
},
|
|
16930
16993
|
});
|
|
16931
16994
|
const numberBrick = createBrick({
|
|
@@ -16937,11 +17000,11 @@ const numberBrick = createBrick({
|
|
|
16937
17000
|
defaultConfigs: { label: 'Number' },
|
|
16938
17001
|
render: (props) => {
|
|
16939
17002
|
var _a;
|
|
16940
|
-
return field(props, 'Number', adorned(props, index$1.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) => {
|
|
17003
|
+
return field(props, 'Number', adorned(props, index$1.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) => {
|
|
16941
17004
|
var _a;
|
|
16942
17005
|
const raw = event.target.value;
|
|
16943
17006
|
(_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, raw === '' ? undefined : Number(raw));
|
|
16944
|
-
} })));
|
|
17007
|
+
} }))));
|
|
16945
17008
|
},
|
|
16946
17009
|
});
|
|
16947
17010
|
const dateBrick = createBrick({
|
|
@@ -16953,11 +17016,11 @@ const dateBrick = createBrick({
|
|
|
16953
17016
|
defaultConfigs: { label: 'Date' },
|
|
16954
17017
|
render: (props) => {
|
|
16955
17018
|
var _a;
|
|
16956
|
-
return field(props, 'Date', index$1.h("input", { class: "fk-field__input", type: "date", value: (_a = props.data) !== null && _a !== void 0 ? _a : '', disabled: props.editable || props.disabled, onInput: (event) => {
|
|
17019
|
+
return field(props, 'Date', index$1.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) => {
|
|
16957
17020
|
var _a;
|
|
16958
17021
|
const raw = event.target.value;
|
|
16959
17022
|
(_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, raw === '' ? undefined : raw);
|
|
16960
|
-
} }));
|
|
17023
|
+
} })));
|
|
16961
17024
|
},
|
|
16962
17025
|
});
|
|
16963
17026
|
const selectBrick = createBrick({
|
|
@@ -16973,7 +17036,7 @@ const selectBrick = createBrick({
|
|
|
16973
17036
|
},
|
|
16974
17037
|
render: (props) => {
|
|
16975
17038
|
var _a;
|
|
16976
|
-
return fieldBlock(props, 'Select', index$1.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) => {
|
|
17039
|
+
return fieldBlock(props, 'Select', index$1.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) => {
|
|
16977
17040
|
var _a;
|
|
16978
17041
|
event.stopPropagation();
|
|
16979
17042
|
(_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, event.detail);
|
|
@@ -16991,7 +17054,7 @@ const multiSelectBrick = createBrick({
|
|
|
16991
17054
|
optionsSource: 'static',
|
|
16992
17055
|
options: 'Option 1\nOption 2\nOption 3',
|
|
16993
17056
|
},
|
|
16994
|
-
render: (props) => fieldBlock(props, 'Multi select', index$1.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) => {
|
|
17057
|
+
render: (props) => fieldBlock(props, 'Multi select', index$1.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) => {
|
|
16995
17058
|
var _a;
|
|
16996
17059
|
event.stopPropagation();
|
|
16997
17060
|
(_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, event.detail);
|
|
@@ -17007,10 +17070,10 @@ const datetimeBrick = createTextVariant({
|
|
|
17007
17070
|
name: 'Date / Time',
|
|
17008
17071
|
inputType: 'datetime-local',
|
|
17009
17072
|
});
|
|
17010
|
-
const staticOptions = (
|
|
17011
|
-
|
|
17012
|
-
.
|
|
17013
|
-
|
|
17073
|
+
const staticOptions = (props) => {
|
|
17074
|
+
var _a, _b, _c;
|
|
17075
|
+
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');
|
|
17076
|
+
};
|
|
17014
17077
|
const selectBoxesBrick = createBrick({
|
|
17015
17078
|
type: 'input',
|
|
17016
17079
|
dataType: 'array',
|
|
@@ -17019,16 +17082,15 @@ const selectBoxesBrick = createBrick({
|
|
|
17019
17082
|
category: 'Inputs',
|
|
17020
17083
|
defaultConfigs: { label: 'Select boxes', options: 'Option 1\nOption 2\nOption 3' },
|
|
17021
17084
|
render: (props) => {
|
|
17022
|
-
var _a;
|
|
17023
17085
|
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(
|
|
17086
|
+
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
17087
|
var _a;
|
|
17026
17088
|
const checked = event.target.checked;
|
|
17027
17089
|
const next = checked
|
|
17028
|
-
? [...selected, option]
|
|
17029
|
-
: selected.filter((value) => value !== option);
|
|
17090
|
+
? [...selected, option.value]
|
|
17091
|
+
: selected.filter((value) => value !== option.value);
|
|
17030
17092
|
(_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));
|
|
17093
|
+
} }), index$1.h("span", null, option.label))))), props.error ? index$1.h("span", { class: "fk-field__error" }, props.error) : null));
|
|
17032
17094
|
},
|
|
17033
17095
|
});
|
|
17034
17096
|
const tagsBrick = createBrick({
|
|
@@ -17100,17 +17162,10 @@ const radioBrick = createBrick({
|
|
|
17100
17162
|
name: 'Radio',
|
|
17101
17163
|
category: 'Inputs',
|
|
17102
17164
|
defaultConfigs: { label: 'Radio', options: 'Option 1\nOption 2' },
|
|
17103
|
-
render: (props) => {
|
|
17165
|
+
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", Object.assign({ class: "fk-radio-group", role: "radiogroup" }, invalidAttr(props)), staticOptions(props).map((option) => {
|
|
17104
17166
|
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
|
-
},
|
|
17167
|
+
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)));
|
|
17168
|
+
})), props.error ? index$1.h("span", { class: "fk-field__error" }, props.error) : null)),
|
|
17114
17169
|
});
|
|
17115
17170
|
const ADDRESS_PARTS = [
|
|
17116
17171
|
{ key: 'street', label: () => fkT('address.street'), full: true },
|
|
@@ -17146,10 +17201,10 @@ const fileBrick = createBrick({
|
|
|
17146
17201
|
id: 'file',
|
|
17147
17202
|
name: 'File',
|
|
17148
17203
|
category: 'Data',
|
|
17149
|
-
defaultConfigs: { label: 'File' },
|
|
17204
|
+
defaultConfigs: { label: 'File', accept: '', uploadUrl: '', multiple: false },
|
|
17150
17205
|
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) => {
|
|
17206
|
+
var _a, _b, _c;
|
|
17207
|
+
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, multiple: ((_c = props.configs) === null || _c === void 0 ? void 0 : _c.multiple) === true, disabled: props.editable || props.disabled, onFileValueChange: (event) => {
|
|
17153
17208
|
var _a;
|
|
17154
17209
|
event.stopPropagation();
|
|
17155
17210
|
(_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, event.detail);
|
|
@@ -17255,6 +17310,150 @@ const columnBrick = createBrick({
|
|
|
17255
17310
|
category: 'Layout',
|
|
17256
17311
|
render: (props) => (index$1.h("div", { class: "fk-column", style: asInlineStyle(props.styles) }, props.children)),
|
|
17257
17312
|
});
|
|
17313
|
+
const formatRecapValue = (brick, value) => {
|
|
17314
|
+
var _a;
|
|
17315
|
+
if (Array.isArray(value)) {
|
|
17316
|
+
return value
|
|
17317
|
+
.map((item) => formatRecapValue(brick, item))
|
|
17318
|
+
.filter(Boolean)
|
|
17319
|
+
.join(', ');
|
|
17320
|
+
}
|
|
17321
|
+
if (value === true)
|
|
17322
|
+
return fkTOr('recap.yes', 'Yes');
|
|
17323
|
+
if (value === false)
|
|
17324
|
+
return fkTOr('recap.no', 'No');
|
|
17325
|
+
if (value && typeof value === 'object') {
|
|
17326
|
+
const record = value;
|
|
17327
|
+
if (typeof record.name === 'string' && 'url' in record)
|
|
17328
|
+
return record.name;
|
|
17329
|
+
return Object.values(record)
|
|
17330
|
+
.filter((part) => typeof part === 'string' && part)
|
|
17331
|
+
.join(' ');
|
|
17332
|
+
}
|
|
17333
|
+
const raw = String(value !== null && value !== void 0 ? value : '');
|
|
17334
|
+
if (((_a = brick.configs) === null || _a === void 0 ? void 0 : _a.options) != null) {
|
|
17335
|
+
const labelKey = typeof brick.configs.labelKey === 'string' ? brick.configs.labelKey : 'label';
|
|
17336
|
+
const valueKey = typeof brick.configs.valueKey === 'string' ? brick.configs.valueKey : 'value';
|
|
17337
|
+
const match = normalizeOptions(brick.configs.options, labelKey, valueKey).find((option) => option.value === raw);
|
|
17338
|
+
if (match)
|
|
17339
|
+
return match.label;
|
|
17340
|
+
}
|
|
17341
|
+
return raw;
|
|
17342
|
+
};
|
|
17343
|
+
const isEmptyRecapValue = (raw) => raw === undefined ||
|
|
17344
|
+
raw === null ||
|
|
17345
|
+
raw === '' ||
|
|
17346
|
+
(Array.isArray(raw) && raw.length === 0);
|
|
17347
|
+
const brickLabel = (brick, locale) => {
|
|
17348
|
+
var _a, _b, _c, _d, _e;
|
|
17349
|
+
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 : '');
|
|
17350
|
+
};
|
|
17351
|
+
const collectionInputs = (spec) => {
|
|
17352
|
+
var _a, _b;
|
|
17353
|
+
const inputs = [];
|
|
17354
|
+
for (const child of (_a = spec.children) !== null && _a !== void 0 ? _a : []) {
|
|
17355
|
+
const key = (_b = child.configs) === null || _b === void 0 ? void 0 : _b.key;
|
|
17356
|
+
if (child.type === 'input' && key && !key.startsWith('_')) {
|
|
17357
|
+
inputs.push(child);
|
|
17358
|
+
}
|
|
17359
|
+
else if (child.type === 'panel') {
|
|
17360
|
+
inputs.push(...collectionInputs(child));
|
|
17361
|
+
}
|
|
17362
|
+
}
|
|
17363
|
+
return inputs;
|
|
17364
|
+
};
|
|
17365
|
+
const collectRecapItems = (spec, dataMap, locale, showEmpty, groupBySections = false) => {
|
|
17366
|
+
var _a, _b, _c;
|
|
17367
|
+
if (!spec)
|
|
17368
|
+
return [];
|
|
17369
|
+
const items = [];
|
|
17370
|
+
for (const child of (_a = spec.children) !== null && _a !== void 0 ? _a : []) {
|
|
17371
|
+
if (child.id === 'recap' || child.type === 'action')
|
|
17372
|
+
continue;
|
|
17373
|
+
if (getAffectedProperties(child.rules, dataMap).hidden === true)
|
|
17374
|
+
continue;
|
|
17375
|
+
const key = (_b = child.configs) === null || _b === void 0 ? void 0 : _b.key;
|
|
17376
|
+
const label = brickLabel(child, locale);
|
|
17377
|
+
if (child.type === 'collection') {
|
|
17378
|
+
const rows = key && Array.isArray(dataMap === null || dataMap === void 0 ? void 0 : dataMap[key])
|
|
17379
|
+
? dataMap[key]
|
|
17380
|
+
: [];
|
|
17381
|
+
if (!rows.length && !showEmpty)
|
|
17382
|
+
continue;
|
|
17383
|
+
const inputs = collectionInputs(child);
|
|
17384
|
+
items.push({
|
|
17385
|
+
kind: 'collection',
|
|
17386
|
+
label,
|
|
17387
|
+
columns: inputs.map((input) => brickLabel(input, locale)),
|
|
17388
|
+
rows: rows.map((row) => inputs.map((input) => {
|
|
17389
|
+
const raw = row === null || row === void 0 ? void 0 : row[input.configs.key];
|
|
17390
|
+
return isEmptyRecapValue(raw) ? '—' : formatRecapValue(input, raw);
|
|
17391
|
+
})),
|
|
17392
|
+
});
|
|
17393
|
+
continue;
|
|
17394
|
+
}
|
|
17395
|
+
if (child.type === 'panel') {
|
|
17396
|
+
const sectionLabel = resolveLocalizedText((_c = child.configs) === null || _c === void 0 ? void 0 : _c.label, locale);
|
|
17397
|
+
if (groupBySections &&
|
|
17398
|
+
typeof sectionLabel === 'string' &&
|
|
17399
|
+
sectionLabel.trim()) {
|
|
17400
|
+
const sectionItems = collectRecapItems(child, dataMap, locale, showEmpty);
|
|
17401
|
+
if (sectionItems.length) {
|
|
17402
|
+
items.push({ kind: 'section', label: sectionLabel });
|
|
17403
|
+
items.push(...sectionItems);
|
|
17404
|
+
}
|
|
17405
|
+
continue;
|
|
17406
|
+
}
|
|
17407
|
+
items.push(...collectRecapItems(child, dataMap, locale, showEmpty, groupBySections));
|
|
17408
|
+
continue;
|
|
17409
|
+
}
|
|
17410
|
+
if (child.type !== 'input' || !key || key.startsWith('_'))
|
|
17411
|
+
continue;
|
|
17412
|
+
const raw = dataMap === null || dataMap === void 0 ? void 0 : dataMap[key];
|
|
17413
|
+
if (isEmptyRecapValue(raw) && !showEmpty)
|
|
17414
|
+
continue;
|
|
17415
|
+
items.push({
|
|
17416
|
+
kind: 'field',
|
|
17417
|
+
label,
|
|
17418
|
+
value: isEmptyRecapValue(raw) ? '—' : formatRecapValue(child, raw),
|
|
17419
|
+
});
|
|
17420
|
+
}
|
|
17421
|
+
return items;
|
|
17422
|
+
};
|
|
17423
|
+
const recapBrick = createBrick({
|
|
17424
|
+
type: 'output',
|
|
17425
|
+
dataType: 'void',
|
|
17426
|
+
id: 'recap',
|
|
17427
|
+
name: 'Recap',
|
|
17428
|
+
category: 'Layout',
|
|
17429
|
+
defaultConfigs: { label: 'Recap', showEmpty: false, groupBySections: false },
|
|
17430
|
+
render: (props) => {
|
|
17431
|
+
var _a, _b;
|
|
17432
|
+
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);
|
|
17433
|
+
const blocks = [];
|
|
17434
|
+
let fields = [];
|
|
17435
|
+
const flushFields = () => {
|
|
17436
|
+
if (!fields.length)
|
|
17437
|
+
return;
|
|
17438
|
+
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))))));
|
|
17439
|
+
fields = [];
|
|
17440
|
+
};
|
|
17441
|
+
for (const item of items) {
|
|
17442
|
+
if (item.kind === 'field') {
|
|
17443
|
+
fields.push(item);
|
|
17444
|
+
continue;
|
|
17445
|
+
}
|
|
17446
|
+
flushFields();
|
|
17447
|
+
if (item.kind === 'section') {
|
|
17448
|
+
blocks.push(index$1.h("span", { class: "fk-recap__group-title", key: `section:${item.label}` }, item.label));
|
|
17449
|
+
continue;
|
|
17450
|
+
}
|
|
17451
|
+
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.')))));
|
|
17452
|
+
}
|
|
17453
|
+
flushFields();
|
|
17454
|
+
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.')))));
|
|
17455
|
+
},
|
|
17456
|
+
});
|
|
17258
17457
|
function registerDefaultBricks() {
|
|
17259
17458
|
registerBricks([
|
|
17260
17459
|
textInputBrick,
|
|
@@ -17279,6 +17478,7 @@ function registerDefaultBricks() {
|
|
|
17279
17478
|
dataGridBrick,
|
|
17280
17479
|
hiddenBrick,
|
|
17281
17480
|
contentBrick,
|
|
17481
|
+
recapBrick,
|
|
17282
17482
|
groupBrick,
|
|
17283
17483
|
rowBrick,
|
|
17284
17484
|
columnBrick,
|
|
@@ -17317,10 +17517,12 @@ exports.iterateSchemaBricks = iterateSchemaBricks;
|
|
|
17317
17517
|
exports.moveBrick = moveBrick;
|
|
17318
17518
|
exports.multiSelectBrick = multiSelectBrick;
|
|
17319
17519
|
exports.newBrickSpec = newBrickSpec;
|
|
17520
|
+
exports.normalizeOptions = normalizeOptions;
|
|
17320
17521
|
exports.numberBrick = numberBrick;
|
|
17321
17522
|
exports.passwordBrick = passwordBrick;
|
|
17322
17523
|
exports.phoneBrick = phoneBrick;
|
|
17323
17524
|
exports.radioBrick = radioBrick;
|
|
17525
|
+
exports.recapBrick = recapBrick;
|
|
17324
17526
|
exports.registerBrick = registerBrick;
|
|
17325
17527
|
exports.registerBricks = registerBricks;
|
|
17326
17528
|
exports.registerDefaultBricks = registerDefaultBricks;
|