@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.
Files changed (82) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/fk-brick-actions_18.cjs.entry.js +41 -40
  3. package/dist/cjs/formkrafter-wc.cjs.js +2 -2
  4. package/dist/cjs/{index-By4GGW_q.js → index-Can2MpG5.js} +215 -23
  5. package/dist/cjs/{index-D_7eGIJ0.js → index-CbyFxLc_.js} +26 -2
  6. package/dist/cjs/index.cjs.js +3 -2
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/collection/components/fk-brick-render/fk-brick-render.js +31 -3
  9. package/dist/collection/components/fk-file-input/fk-file-input.css +26 -5
  10. package/dist/collection/components/fk-file-input/fk-file-input.js +45 -6
  11. package/dist/collection/components/fk-form-builder/fk-form-builder.css +30 -0
  12. package/dist/collection/components/fk-form-render/fk-form-render.js +1 -1
  13. package/dist/collection/i18n/i18n.js +12 -0
  14. package/dist/collection/index.js +1 -1
  15. package/dist/collection/registry/default-bricks.js +161 -23
  16. package/dist/components/fk-brick-actions.js +1 -1
  17. package/dist/components/fk-brick-list.js +1 -1
  18. package/dist/components/fk-brick-mold-item.js +1 -1
  19. package/dist/components/fk-brick-not-found.js +1 -1
  20. package/dist/components/fk-brick-render.js +1 -1
  21. package/dist/components/fk-code-editor.js +1 -1
  22. package/dist/components/fk-data-grid.js +1 -1
  23. package/dist/components/fk-drop-area.js +1 -1
  24. package/dist/components/fk-empty-form.js +1 -1
  25. package/dist/components/fk-file-input.js +1 -1
  26. package/dist/components/fk-form-builder.js +1 -1
  27. package/dist/components/fk-form-render.js +1 -1
  28. package/dist/components/fk-property-panel.js +1 -1
  29. package/dist/components/fk-rules-editor.js +1 -1
  30. package/dist/components/fk-select-input.js +1 -1
  31. package/dist/components/fk-signature-input.js +1 -1
  32. package/dist/components/fk-stepper.js +1 -1
  33. package/dist/components/fk-tabs.js +1 -1
  34. package/dist/components/index.js +1 -1
  35. package/dist/components/{p-B4vAN-UA.js → p-B0YjIsVn.js} +1 -1
  36. package/dist/components/{p-BIEpAM4V.js → p-B1t0M_hN.js} +1 -1
  37. package/dist/components/p-B21cOFRx.js +1 -0
  38. package/dist/components/{p-DWgjI3TW.js → p-B7ED8qMb.js} +1 -1
  39. package/dist/components/{p-ZEW2q-4b.js → p-BDvqHJih.js} +1 -1
  40. package/dist/components/{p-BXFug2Ql.js → p-BSPTuA1p.js} +1 -1
  41. package/dist/components/{p-BNREw7TY.js → p-BVBfbMl_.js} +1 -1
  42. package/dist/components/p-BrOXMyOG.js +1 -0
  43. package/dist/components/{p-DtzMNM4i.js → p-C85zhhpr.js} +1 -1
  44. package/dist/components/p-CMQ_4Zfv.js +1 -0
  45. package/dist/components/p-CWQX0sXS.js +1 -0
  46. package/dist/components/{p-DJDrDvoC.js → p-CXEvsomA.js} +1 -1
  47. package/dist/components/{p-BCQ-hj6j.js → p-Cq9HSEn8.js} +1 -1
  48. package/dist/components/{p-BQP1WryV.js → p-D7bf2ztq.js} +1 -1
  49. package/dist/components/{p-DKGyje7v.js → p-DIPoAaGe.js} +1 -1
  50. package/dist/components/p-DYBirEew.js +1 -0
  51. package/dist/components/p-DluDp8V5.js +1 -0
  52. package/dist/components/{p-BLKRn62s.js → p-Do6-yRva.js} +1 -1
  53. package/dist/components/{p-D318uFl-.js → p-GjmAhT2E.js} +1 -1
  54. package/dist/components/{p-dX7Lo8Fe.js → p-LXnm2ogM.js} +1 -1
  55. package/dist/components/{p-Ctt--jpe.js → p-y0xDvzJR.js} +1 -1
  56. package/dist/esm/fk-brick-actions_18.entry.js +37 -36
  57. package/dist/esm/formkrafter-wc.js +3 -3
  58. package/dist/esm/{index-BTmZ8XET.js → index-BB2OOj__.js} +214 -24
  59. package/dist/esm/{index-BQqrzKxo.js → index-DMDO6w5-.js} +26 -2
  60. package/dist/esm/index.js +2 -2
  61. package/dist/esm/loader.js +3 -3
  62. package/dist/formkrafter-wc/formkrafter-wc.css +1 -1
  63. package/dist/formkrafter-wc/formkrafter-wc.esm.js +1 -1
  64. package/dist/formkrafter-wc/index.esm.js +1 -1
  65. package/dist/formkrafter-wc/p-0de7cbe1.entry.js +1 -0
  66. package/dist/formkrafter-wc/{p-BXIsVlA6.js → p-Bp_A8oL5.js} +4 -4
  67. package/dist/formkrafter-wc/p-DMDO6w5-.js +2 -0
  68. package/dist/types/components/fk-brick-render/fk-brick-render.d.ts +1 -0
  69. package/dist/types/components/fk-file-input/fk-file-input.d.ts +3 -0
  70. package/dist/types/components.d.ts +5 -0
  71. package/dist/types/home/runner/work/formkrafter/formkrafter/packages/wc/.stencil/stencil.config.d.ts +2 -0
  72. package/dist/types/index.d.ts +1 -1
  73. package/dist/types/registry/default-bricks.d.ts +73 -54
  74. package/package.json +11 -2
  75. package/dist/components/p-BB3BQPr8.js +0 -1
  76. package/dist/components/p-BOvjVIvo.js +0 -1
  77. package/dist/components/p-DKoJovNt.js +0 -1
  78. package/dist/components/p-QC41Uj05.js +0 -1
  79. package/dist/components/p-TvmRksgg.js +0 -1
  80. package/dist/formkrafter-wc/p-BQqrzKxo.js +0 -2
  81. package/dist/formkrafter-wc/p-f6bc0be0.entry.js +0 -1
  82. package/dist/types/Users/datagnikan/Desktop/WorkSpace/streamline-pulse/formkrafter-js/formkrafter/packages/wc/.stencil/stencil.config.d.ts +0 -2
@@ -2,8 +2,9 @@ import { h } from "@stencil/core";
2
2
  import { createBrick } from "./create-brick";
3
3
  import { registerBricks } from "./registry";
4
4
  import { asInlineStyle } from "../utils/style";
5
- import { fkT } from "../i18n/i18n";
6
- import { resolveLocalizedText } from "@streamline-pulse/formkrafter-core";
5
+ import { normalizeOptions } from "../utils/options";
6
+ import { fkT, fkTOr } from "../i18n/i18n";
7
+ import { getAffectedProperties, resolveLocalizedText, } from "@streamline-pulse/formkrafter-core";
7
8
  const labelOf = (props, fallback) => { var _a, _b, _c, _d; return (_d = (_b = (_a = props.configs) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : (_c = props.configs) === null || _c === void 0 ? void 0 : _c.key) !== null && _d !== void 0 ? _d : fallback; };
8
9
  const adorned = (props, control) => {
9
10
  var _a, _b;
@@ -143,10 +144,10 @@ export const datetimeBrick = createTextVariant({
143
144
  name: 'Date / Time',
144
145
  inputType: 'datetime-local',
145
146
  });
146
- const staticOptions = (raw) => String(raw !== null && raw !== void 0 ? raw : '')
147
- .split('\n')
148
- .map((option) => option.trim())
149
- .filter(Boolean);
147
+ const staticOptions = (props) => {
148
+ var _a, _b, _c;
149
+ 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');
150
+ };
150
151
  export const selectBoxesBrick = createBrick({
151
152
  type: 'input',
152
153
  dataType: 'array',
@@ -155,16 +156,15 @@ export const selectBoxesBrick = createBrick({
155
156
  category: 'Inputs',
156
157
  defaultConfigs: { label: 'Select boxes', options: 'Option 1\nOption 2\nOption 3' },
157
158
  render: (props) => {
158
- var _a;
159
159
  const selected = Array.isArray(props.data) ? props.data : [];
160
- 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((_a = props.configs) === null || _a === void 0 ? void 0 : _a.options).map((option) => (h("label", { class: "fk-radio", key: option }, h("input", { type: "checkbox", checked: selected.includes(option), disabled: props.editable || props.disabled, onChange: (event) => {
160
+ 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) => {
161
161
  var _a;
162
162
  const checked = event.target.checked;
163
163
  const next = checked
164
- ? [...selected, option]
165
- : selected.filter((value) => value !== option);
164
+ ? [...selected, option.value]
165
+ : selected.filter((value) => value !== option.value);
166
166
  (_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, next.length ? next : undefined);
167
- } }), h("span", null, option))))), props.error ? h("span", { class: "fk-field__error" }, props.error) : null));
167
+ } }), h("span", null, option.label))))), props.error ? h("span", { class: "fk-field__error" }, props.error) : null));
168
168
  },
169
169
  });
170
170
  export const tagsBrick = createBrick({
@@ -236,17 +236,10 @@ export const radioBrick = createBrick({
236
236
  name: 'Radio',
237
237
  category: 'Inputs',
238
238
  defaultConfigs: { label: 'Radio', options: 'Option 1\nOption 2' },
239
- render: (props) => {
239
+ render: (props) => (h("div", { class: "fk-field", style: asInlineStyle(props.styles) }, h("span", { class: "fk-field__label" }, labelOf(props, 'Radio')), h("div", { class: "fk-radio-group", role: "radiogroup" }, staticOptions(props).map((option) => {
240
240
  var _a, _b;
241
- return (h("div", { class: "fk-field", style: asInlineStyle(props.styles) }, h("span", { class: "fk-field__label" }, labelOf(props, 'Radio')), h("div", { class: "fk-radio-group", role: "radiogroup" }, String((_b = (_a = props.configs) === null || _a === void 0 ? void 0 : _a.options) !== null && _b !== void 0 ? _b : '')
242
- .split('\n')
243
- .map((option) => option.trim())
244
- .filter(Boolean)
245
- .map((option) => {
246
- var _a, _b;
247
- 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)));
248
- })), props.error ? h("span", { class: "fk-field__error" }, props.error) : null));
249
- },
241
+ 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)));
242
+ })), props.error ? h("span", { class: "fk-field__error" }, props.error) : null)),
250
243
  });
251
244
  const ADDRESS_PARTS = [
252
245
  { key: 'street', label: () => fkT('address.street'), full: true },
@@ -284,8 +277,8 @@ export const fileBrick = createBrick({
284
277
  category: 'Data',
285
278
  defaultConfigs: { label: 'File' },
286
279
  render: (props) => {
287
- var _a;
288
- 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) => {
280
+ var _a, _b;
281
+ 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, disabled: props.editable || props.disabled, onFileValueChange: (event) => {
289
282
  var _a;
290
283
  event.stopPropagation();
291
284
  (_a = props.onDataChange) === null || _a === void 0 ? void 0 : _a.call(props, event.detail);
@@ -391,6 +384,150 @@ export const columnBrick = createBrick({
391
384
  category: 'Layout',
392
385
  render: (props) => (h("div", { class: "fk-column", style: asInlineStyle(props.styles) }, props.children)),
393
386
  });
387
+ const formatRecapValue = (brick, value) => {
388
+ var _a;
389
+ if (Array.isArray(value)) {
390
+ return value
391
+ .map((item) => formatRecapValue(brick, item))
392
+ .filter(Boolean)
393
+ .join(', ');
394
+ }
395
+ if (value === true)
396
+ return fkTOr('recap.yes', 'Yes');
397
+ if (value === false)
398
+ return fkTOr('recap.no', 'No');
399
+ if (value && typeof value === 'object') {
400
+ const record = value;
401
+ if (typeof record.name === 'string' && 'url' in record)
402
+ return record.name;
403
+ return Object.values(record)
404
+ .filter((part) => typeof part === 'string' && part)
405
+ .join(' ');
406
+ }
407
+ const raw = String(value !== null && value !== void 0 ? value : '');
408
+ if (((_a = brick.configs) === null || _a === void 0 ? void 0 : _a.options) != null) {
409
+ const labelKey = typeof brick.configs.labelKey === 'string' ? brick.configs.labelKey : 'label';
410
+ const valueKey = typeof brick.configs.valueKey === 'string' ? brick.configs.valueKey : 'value';
411
+ const match = normalizeOptions(brick.configs.options, labelKey, valueKey).find((option) => option.value === raw);
412
+ if (match)
413
+ return match.label;
414
+ }
415
+ return raw;
416
+ };
417
+ const isEmptyRecapValue = (raw) => raw === undefined ||
418
+ raw === null ||
419
+ raw === '' ||
420
+ (Array.isArray(raw) && raw.length === 0);
421
+ const brickLabel = (brick, locale) => {
422
+ var _a, _b, _c, _d, _e;
423
+ 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 : '');
424
+ };
425
+ const collectionInputs = (spec) => {
426
+ var _a, _b;
427
+ const inputs = [];
428
+ for (const child of (_a = spec.children) !== null && _a !== void 0 ? _a : []) {
429
+ const key = (_b = child.configs) === null || _b === void 0 ? void 0 : _b.key;
430
+ if (child.type === 'input' && key && !key.startsWith('_')) {
431
+ inputs.push(child);
432
+ }
433
+ else if (child.type === 'panel') {
434
+ inputs.push(...collectionInputs(child));
435
+ }
436
+ }
437
+ return inputs;
438
+ };
439
+ const collectRecapItems = (spec, dataMap, locale, showEmpty, groupBySections = false) => {
440
+ var _a, _b, _c;
441
+ if (!spec)
442
+ return [];
443
+ const items = [];
444
+ for (const child of (_a = spec.children) !== null && _a !== void 0 ? _a : []) {
445
+ if (child.id === 'recap' || child.type === 'action')
446
+ continue;
447
+ if (getAffectedProperties(child.rules, dataMap).hidden === true)
448
+ continue;
449
+ const key = (_b = child.configs) === null || _b === void 0 ? void 0 : _b.key;
450
+ const label = brickLabel(child, locale);
451
+ if (child.type === 'collection') {
452
+ const rows = key && Array.isArray(dataMap === null || dataMap === void 0 ? void 0 : dataMap[key])
453
+ ? dataMap[key]
454
+ : [];
455
+ if (!rows.length && !showEmpty)
456
+ continue;
457
+ const inputs = collectionInputs(child);
458
+ items.push({
459
+ kind: 'collection',
460
+ label,
461
+ columns: inputs.map((input) => brickLabel(input, locale)),
462
+ rows: rows.map((row) => inputs.map((input) => {
463
+ const raw = row === null || row === void 0 ? void 0 : row[input.configs.key];
464
+ return isEmptyRecapValue(raw) ? '—' : formatRecapValue(input, raw);
465
+ })),
466
+ });
467
+ continue;
468
+ }
469
+ if (child.type === 'panel') {
470
+ const sectionLabel = resolveLocalizedText((_c = child.configs) === null || _c === void 0 ? void 0 : _c.label, locale);
471
+ if (groupBySections &&
472
+ typeof sectionLabel === 'string' &&
473
+ sectionLabel.trim()) {
474
+ const sectionItems = collectRecapItems(child, dataMap, locale, showEmpty);
475
+ if (sectionItems.length) {
476
+ items.push({ kind: 'section', label: sectionLabel });
477
+ items.push(...sectionItems);
478
+ }
479
+ continue;
480
+ }
481
+ items.push(...collectRecapItems(child, dataMap, locale, showEmpty, groupBySections));
482
+ continue;
483
+ }
484
+ if (child.type !== 'input' || !key || key.startsWith('_'))
485
+ continue;
486
+ const raw = dataMap === null || dataMap === void 0 ? void 0 : dataMap[key];
487
+ if (isEmptyRecapValue(raw) && !showEmpty)
488
+ continue;
489
+ items.push({
490
+ kind: 'field',
491
+ label,
492
+ value: isEmptyRecapValue(raw) ? '—' : formatRecapValue(child, raw),
493
+ });
494
+ }
495
+ return items;
496
+ };
497
+ export const recapBrick = createBrick({
498
+ type: 'output',
499
+ dataType: 'void',
500
+ id: 'recap',
501
+ name: 'Recap',
502
+ category: 'Layout',
503
+ defaultConfigs: { label: 'Recap', showEmpty: false, groupBySections: false },
504
+ render: (props) => {
505
+ var _a, _b;
506
+ 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);
507
+ const blocks = [];
508
+ let fields = [];
509
+ const flushFields = () => {
510
+ if (!fields.length)
511
+ return;
512
+ 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))))));
513
+ fields = [];
514
+ };
515
+ for (const item of items) {
516
+ if (item.kind === 'field') {
517
+ fields.push(item);
518
+ continue;
519
+ }
520
+ flushFields();
521
+ if (item.kind === 'section') {
522
+ blocks.push(h("span", { class: "fk-recap__group-title", key: `section:${item.label}` }, item.label));
523
+ continue;
524
+ }
525
+ 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.')))));
526
+ }
527
+ flushFields();
528
+ 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.')))));
529
+ },
530
+ });
394
531
  export function registerDefaultBricks() {
395
532
  registerBricks([
396
533
  textInputBrick,
@@ -415,6 +552,7 @@ export function registerDefaultBricks() {
415
552
  dataGridBrick,
416
553
  hiddenBrick,
417
554
  contentBrick,
555
+ recapBrick,
418
556
  groupBrick,
419
557
  rowBrick,
420
558
  columnBrick,
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-BNREw7TY.js";const p=o,r=s;export{p as FkBrickActions,r as defineCustomElement}
1
+ import{F as o,d as s}from"./p-BVBfbMl_.js";const p=o,r=s;export{p as FkBrickActions,r as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-ZEW2q-4b.js";const p=o,r=s;export{p as FkBrickList,r as defineCustomElement}
1
+ import{F as o,d as s}from"./p-BDvqHJih.js";const p=o,r=s;export{p as FkBrickList,r as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-B4vAN-UA.js";const p=o,r=s;export{p as FkBrickMoldItem,r as defineCustomElement}
1
+ import{F as s,d as o}from"./p-B0YjIsVn.js";const p=s,r=o;export{p as FkBrickMoldItem,r as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as r}from"./p-BB3BQPr8.js";const s=o,p=r;export{s as FkBrickNotFound,p as defineCustomElement}
1
+ import{F as o,d as s}from"./p-CMQ_4Zfv.js";const p=o,r=s;export{p as FkBrickNotFound,r as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-DKoJovNt.js";const t=o,p=s;export{t as FkBrickRender,p as defineCustomElement}
1
+ import{F as o,d as p}from"./p-DluDp8V5.js";const s=o,r=p;export{s as FkBrickRender,r as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as p}from"./p-BIEpAM4V.js";const s=o,r=p;export{s as FkCodeEditor,r as defineCustomElement}
1
+ import{F as o,d as s}from"./p-B1t0M_hN.js";const t=o,p=s;export{t as FkCodeEditor,p as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-BCQ-hj6j.js";const j=o,p=s;export{j as FkDataGrid,p as defineCustomElement}
1
+ import{F as o,d as s}from"./p-Cq9HSEn8.js";const p=o,r=s;export{p as FkDataGrid,r as defineCustomElement}
@@ -1 +1 @@
1
- import{F as t,d as o}from"./p-Ctt--jpe.js";const p=t,s=o;export{p as FkDropArea,s as defineCustomElement}
1
+ import{F as o,d as s}from"./p-y0xDvzJR.js";const p=o,r=s;export{p as FkDropArea,r as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as r}from"./p-DJDrDvoC.js";const s=o,p=r;export{s as FkEmptyForm,p as defineCustomElement}
1
+ import{F as o,d as s}from"./p-CXEvsomA.js";const m=o,p=s;export{m as FkEmptyForm,p as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-BOvjVIvo.js";const p=o,r=s;export{p as FkFileInput,r as defineCustomElement}
1
+ import{F as o,d as s}from"./p-B21cOFRx.js";const p=o,r=s;export{p as FkFileInput,r as defineCustomElement}
@@ -1 +1 @@
1
- import{t as e,p as s,H as t,c as r,h as i}from"./p-QC41Uj05.js";import{S as o,c as a,d as c,m as l,e as d,f as n,u as f,h as k,j as p,k as h,i as u}from"./p-dX7Lo8Fe.js";import{g as b,n as m}from"./p-gPc0o8Jb.js";import{registerDefaultBricks as v}from"./index.js";import{a as g}from"./p-BQP1WryV.js";import{d as y}from"./p-BNREw7TY.js";import{d as _}from"./p-ZEW2q-4b.js";import{d as j}from"./p-B4vAN-UA.js";import{d as C}from"./p-BB3BQPr8.js";import{d as E}from"./p-DKoJovNt.js";import{d as x}from"./p-BIEpAM4V.js";import{d as B}from"./p-BCQ-hj6j.js";import{d as D}from"./p-Ctt--jpe.js";import{d as S}from"./p-DJDrDvoC.js";import{d as w}from"./p-BOvjVIvo.js";import{d as R}from"./p-D318uFl-.js";import{d as J}from"./p-DWgjI3TW.js";import{d as O}from"./p-BXFug2Ql.js";import{d as U}from"./p-TvmRksgg.js";import{d as I}from"./p-DtzMNM4i.js";import{d as L}from"./p-BLKRn62s.js";import{d as N}from"./p-DKGyje7v.js";const P=s(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.specChange=r(this,"specChange"),this.locales=[],this.currentData={},this.copied=!1,this.history=new o,this.importFromClipboard=async()=>{try{const e=await navigator.clipboard.readText();this.importSpec(e,!1)}catch(e){this.flashImportError(g("builder.pasteHint"))}},this.copySpec=async()=>{this.currentSpec&&(await navigator.clipboard.writeText(this.specJson()),this.copied=!0,setTimeout((()=>this.copied=!1),1500))},this.downloadSpec=()=>{if(!this.currentSpec)return;const e=new Blob([this.specJson()],{type:"application/json"}),s=URL.createObjectURL(e),t=document.createElement("a");t.href=s,t.download="form-spec.json",t.click(),URL.revokeObjectURL(s)},this.undo=()=>{if(!this.currentSpec)return;const e=this.history.undo(this.currentSpec);void 0!==e&&(this.currentSpec=e,this.specChange.emit({spec:e,patches:[],inverse:[]}))},this.redo=()=>{if(!this.currentSpec)return;const e=this.history.redo(this.currentSpec);void 0!==e&&(this.currentSpec=e,this.specChange.emit({spec:e,patches:[],inverse:[]}))}}componentWillLoad(){0===b().length&&v(),this.editLocale=this.locales[0],this.currentSpec=this.spec,this.currentData=Object.assign({},this.data)}syncSpec(e){this.currentSpec=e,this.history.clear()}handleBrickDrop(e){var s,t;e.stopPropagation();const{source:r,mold:i,from:o,parentPath:d,index:n}=e.detail;if("new"===r&&i){const e=m(i.type,i.id);if(!e)return;return this.currentSpec?void this.applyUpdate(a(this.currentSpec,e,d,n)):void this.setRootSpec("panel"===e.type?e:this.wrapInRootGroup(e))}if("move"===r&&o&&this.currentSpec){if(d===o||d.startsWith(o+"."))return;const e=c(this.currentSpec,d);if(!e)return;const r=null!==(t=null===(s=e.children)||void 0===s?void 0:s.length)&&void 0!==t?t:0,i=o.split("."),a=i.slice(0,-1).join("."),f=Number(i[i.length-1]),k=null!=n?n:r;if(a===d&&(k===f||k===f+1))return;this.applyUpdate(l(this.currentSpec,o,`${d}.${k}`))}}handleBrickRemove(e){e.stopPropagation(),this.currentSpec&&("0"!==e.detail.path?this.applyUpdate(d(this.currentSpec,e.detail.path)):this.setRootSpec(void 0))}handleBrickDuplicate(e){e.stopPropagation(),this.currentSpec&&this.applyUpdate(n(this.currentSpec,e.detail.path))}handleConfigsChange(e){e.stopPropagation(),this.currentSpec&&e.detail.uid&&this.applyUpdate(f(this.currentSpec,e.detail.uid,e.detail.configs))}handleStylesChange(e){e.stopPropagation(),this.currentSpec&&e.detail.uid&&this.applyUpdate(k(this.currentSpec,e.detail.uid,e.detail.styles))}handleValidationsChange(e){e.stopPropagation(),this.currentSpec&&e.detail.uid&&this.applyUpdate(p(this.currentSpec,e.detail.uid,e.detail.validations))}handleRulesChange(e){e.stopPropagation(),this.currentSpec&&e.detail.uid&&this.applyUpdate(h(this.currentSpec,e.detail.uid,e.detail.rules))}handleDataChange(e){this.currentData=e.detail.data}handlePaste(e){var s;const t=e.target;(null==t?void 0:t.closest("input, textarea, select, [contenteditable]"))||this.importSpec(null===(s=e.clipboardData)||void 0===s?void 0:s.getData("text/plain"),!0)}importSpec(e,s){if(e)try{const s=JSON.parse(e);if("object"!=typeof s||null===s||"string"!=typeof s.type||"string"!=typeof s.id)throw Error("not a brick spec");this.selectedUid=void 0,this.importError=void 0,this.setRootSpec(this.ensureUids(s))}catch(e){s||this.flashImportError(g("builder.importInvalid"))}else s||this.flashImportError(g("builder.importInvalid"))}ensureUids(e){var s;const t=structuredClone(e);for(const{brick:e}of u(t))(null===(s=e.configs)||void 0===s?void 0:s.uid)||(e.configs=Object.assign(Object.assign({},e.configs),{uid:crypto.randomUUID()}));return t}flashImportError(e){this.importError=e,setTimeout((()=>this.importError=void 0),4e3)}handleBrickSelect(e){var s,t;e.stopPropagation(),this.currentSpec&&(this.selectedUid=null===(t=null===(s=c(this.currentSpec,e.detail.path))||void 0===s?void 0:s.configs)||void 0===t?void 0:t.uid)}findSelected(){var e;if(this.currentSpec&&this.selectedUid)for(const{brick:s,path:t}of u(this.currentSpec))if((null===(e=s.configs)||void 0===e?void 0:e.uid)===this.selectedUid)return{brick:s,path:t}}inputFieldKeys(){var e;const s=[];for(const{brick:t}of u(this.currentSpec)){const r=null===(e=t.configs)||void 0===e?void 0:e.key;"input"===t.type&&r&&s.push(r)}return s}wrapInRootGroup(e){const s=m("panel","column");return s?Object.assign(Object.assign({},s),{name:"Form",children:[e]}):e}setRootSpec(e){this.currentSpec=e,this.history.clear(),this.specChange.emit({spec:e,patches:[],inverse:[]})}applyUpdate(e){this.history.record(e),this.currentSpec=e.spec,this.specChange.emit({spec:e.spec,patches:e.patches,inverse:e.inverse})}specJson(){return JSON.stringify(this.currentSpec,null,2)}render(){return i("div",{key:"f23b549325059ff00dc9b4dcce05f82e7905f646",class:"fk-builder"},i("aside",{key:"76d630af39352b324fa1160945953bcc92f7e678",class:"fk-builder__palette"},i("fk-brick-list",{key:"a2fbf6fb78febd993e1972a3077e07cd952501f9"})),i("main",{key:"e65836c299ef0b102bf99da9263823cb8506aa87",class:"fk-builder__main"},i("div",{key:"cf6681fdc4f36720919f3e52852eeaf247b4cd3f",class:"fk-builder__toolbar"},i("button",{key:"8669e0c0bff778cee7b5a0f8dc85d762cd923309",type:"button",class:"fk-builder__tool",disabled:!this.history.canUndo,onClick:this.undo},"↩ ",g("builder.undo")),i("button",{key:"e8f1b9e73a97ce7fc134628ec9dd80c43ef27f16",type:"button",class:"fk-builder__tool",disabled:!this.history.canRedo,onClick:this.redo},"↪ ",g("builder.redo")),i("span",{key:"e0af911cdb8686c8276ef3b48f75cf65b3f300ea",class:"fk-builder__spacer"}),this.locales.length>1?i("select",{class:"fk-builder__tool",onChange:e=>this.editLocale=e.target.value},this.locales.map((e=>i("option",{value:e,selected:e===this.editLocale},e.toUpperCase())))):null,this.importError?i("span",{class:"fk-builder__import-error"},this.importError):null,i("button",{key:"5eb508486721587353400365ca3826bed2037620",type:"button",class:"fk-builder__tool",onClick:this.importFromClipboard},"⤓ ",g("builder.importJson")),i("button",{key:"4e60dd9edeef51da8871c34ea042cb828c6a547b",type:"button",class:"fk-builder__tool",disabled:!this.currentSpec,onClick:this.copySpec},"⧉ ",g(this.copied?"builder.copied":"builder.copyJson")),i("button",{key:"40fc0afc683894136b6be5f73fd7f9803e0cc34c",type:"button",class:"fk-builder__tool",disabled:!this.currentSpec,onClick:this.downloadSpec},"⬇ ",g("builder.downloadJson"))),i("div",{key:"317a25b31e4fa22204b923457a507f94bcbe5fbe",class:"fk-builder__canvas"},this.currentSpec?i("fk-form-render",{spec:this.currentSpec,data:this.currentData,editable:!0,selectedUid:this.selectedUid,locale:this.editLocale}):[i("fk-empty-form",null),i("fk-drop-area",{path:"0"})])),i("aside",{key:"7d6491acc432ed158eec6727db75f152fa8398d4",class:"fk-builder__inspector"},(()=>{const e=this.findSelected();return e?i("fk-property-panel",{brick:e.brick,fields:this.inputFieldKeys(),locales:this.locales,editLocale:this.editLocale}):i("p",{class:"fk-builder__hint"},g("builder.hint"))})()))}static get watchers(){return{spec:[{syncSpec:0}]}}static get style(){return".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)}"}},[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}]}]);function V(){"undefined"!=typeof customElements&&["fk-form-builder","fk-brick-actions","fk-brick-list","fk-brick-mold-item","fk-brick-not-found","fk-brick-render","fk-code-editor","fk-data-grid","fk-drop-area","fk-empty-form","fk-file-input","fk-form-render","fk-property-panel","fk-rules-editor","fk-select-input","fk-signature-input","fk-stepper","fk-tabs"].forEach((s=>{switch(s){case"fk-form-builder":customElements.get(e(s))||customElements.define(e(s),P);break;case"fk-brick-actions":customElements.get(e(s))||y();break;case"fk-brick-list":customElements.get(e(s))||_();break;case"fk-brick-mold-item":customElements.get(e(s))||j();break;case"fk-brick-not-found":customElements.get(e(s))||C();break;case"fk-brick-render":customElements.get(e(s))||E();break;case"fk-code-editor":customElements.get(e(s))||x();break;case"fk-data-grid":customElements.get(e(s))||B();break;case"fk-drop-area":customElements.get(e(s))||D();break;case"fk-empty-form":customElements.get(e(s))||S();break;case"fk-file-input":customElements.get(e(s))||w();break;case"fk-form-render":customElements.get(e(s))||R();break;case"fk-property-panel":customElements.get(e(s))||J();break;case"fk-rules-editor":customElements.get(e(s))||O();break;case"fk-select-input":customElements.get(e(s))||U();break;case"fk-signature-input":customElements.get(e(s))||I();break;case"fk-stepper":customElements.get(e(s))||L();break;case"fk-tabs":customElements.get(e(s))||N()}}))}V();const F=P,Q=V;export{F as FkFormBuilder,Q as defineCustomElement}
1
+ import{t as e,p as r,H as t,c as s,h as i}from"./p-BrOXMyOG.js";import{S as o,c as a,d as c,m as l,e as d,f as n,u as f,h as p,j as k,k as h,i as u}from"./p-LXnm2ogM.js";import{g as b,n as m}from"./p-gPc0o8Jb.js";import{registerDefaultBricks as v}from"./index.js";import{a as _}from"./p-D7bf2ztq.js";import{d as g}from"./p-BVBfbMl_.js";import{d as y}from"./p-BDvqHJih.js";import{d as j}from"./p-B0YjIsVn.js";import{d as x}from"./p-CMQ_4Zfv.js";import{d as C}from"./p-DluDp8V5.js";import{d as E}from"./p-B1t0M_hN.js";import{d as w}from"./p-Cq9HSEn8.js";import{d as B}from"./p-y0xDvzJR.js";import{d as D}from"./p-CXEvsomA.js";import{d as S}from"./p-B21cOFRx.js";import{d as R}from"./p-GjmAhT2E.js";import{d as O}from"./p-B7ED8qMb.js";import{d as J}from"./p-BSPTuA1p.js";import{d as z}from"./p-DYBirEew.js";import{d as I}from"./p-C85zhhpr.js";import{d as L}from"./p-Do6-yRva.js";import{d as M}from"./p-DIPoAaGe.js";const P=r(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.specChange=s(this,"specChange"),this.locales=[],this.currentData={},this.copied=!1,this.history=new o,this.importFromClipboard=async()=>{try{const e=await navigator.clipboard.readText();this.importSpec(e,!1)}catch(e){this.flashImportError(_("builder.pasteHint"))}},this.copySpec=async()=>{this.currentSpec&&(await navigator.clipboard.writeText(this.specJson()),this.copied=!0,setTimeout((()=>this.copied=!1),1500))},this.downloadSpec=()=>{if(!this.currentSpec)return;const e=new Blob([this.specJson()],{type:"application/json"}),r=URL.createObjectURL(e),t=document.createElement("a");t.href=r,t.download="form-spec.json",t.click(),URL.revokeObjectURL(r)},this.undo=()=>{if(!this.currentSpec)return;const e=this.history.undo(this.currentSpec);void 0!==e&&(this.currentSpec=e,this.specChange.emit({spec:e,patches:[],inverse:[]}))},this.redo=()=>{if(!this.currentSpec)return;const e=this.history.redo(this.currentSpec);void 0!==e&&(this.currentSpec=e,this.specChange.emit({spec:e,patches:[],inverse:[]}))}}componentWillLoad(){0===b().length&&v(),this.editLocale=this.locales[0],this.currentSpec=this.spec,this.currentData=Object.assign({},this.data)}syncSpec(e){this.currentSpec=e,this.history.clear()}handleBrickDrop(e){var r,t;e.stopPropagation();const{source:s,mold:i,from:o,parentPath:d,index:n}=e.detail;if("new"===s&&i){const e=m(i.type,i.id);if(!e)return;return this.currentSpec?void this.applyUpdate(a(this.currentSpec,e,d,n)):void this.setRootSpec("panel"===e.type?e:this.wrapInRootGroup(e))}if("move"===s&&o&&this.currentSpec){if(d===o||d.startsWith(o+"."))return;const e=c(this.currentSpec,d);if(!e)return;const s=null!==(t=null===(r=e.children)||void 0===r?void 0:r.length)&&void 0!==t?t:0,i=o.split("."),a=i.slice(0,-1).join("."),f=Number(i[i.length-1]),p=null!=n?n:s;if(a===d&&(p===f||p===f+1))return;this.applyUpdate(l(this.currentSpec,o,`${d}.${p}`))}}handleBrickRemove(e){e.stopPropagation(),this.currentSpec&&("0"!==e.detail.path?this.applyUpdate(d(this.currentSpec,e.detail.path)):this.setRootSpec(void 0))}handleBrickDuplicate(e){e.stopPropagation(),this.currentSpec&&this.applyUpdate(n(this.currentSpec,e.detail.path))}handleConfigsChange(e){e.stopPropagation(),this.currentSpec&&e.detail.uid&&this.applyUpdate(f(this.currentSpec,e.detail.uid,e.detail.configs))}handleStylesChange(e){e.stopPropagation(),this.currentSpec&&e.detail.uid&&this.applyUpdate(p(this.currentSpec,e.detail.uid,e.detail.styles))}handleValidationsChange(e){e.stopPropagation(),this.currentSpec&&e.detail.uid&&this.applyUpdate(k(this.currentSpec,e.detail.uid,e.detail.validations))}handleRulesChange(e){e.stopPropagation(),this.currentSpec&&e.detail.uid&&this.applyUpdate(h(this.currentSpec,e.detail.uid,e.detail.rules))}handleDataChange(e){this.currentData=e.detail.data}handlePaste(e){var r;const t=e.target;(null==t?void 0:t.closest("input, textarea, select, [contenteditable]"))||this.importSpec(null===(r=e.clipboardData)||void 0===r?void 0:r.getData("text/plain"),!0)}importSpec(e,r){if(e)try{const r=JSON.parse(e);if("object"!=typeof r||null===r||"string"!=typeof r.type||"string"!=typeof r.id)throw Error("not a brick spec");this.selectedUid=void 0,this.importError=void 0,this.setRootSpec(this.ensureUids(r))}catch(e){r||this.flashImportError(_("builder.importInvalid"))}else r||this.flashImportError(_("builder.importInvalid"))}ensureUids(e){var r;const t=structuredClone(e);for(const{brick:e}of u(t))(null===(r=e.configs)||void 0===r?void 0:r.uid)||(e.configs=Object.assign(Object.assign({},e.configs),{uid:crypto.randomUUID()}));return t}flashImportError(e){this.importError=e,setTimeout((()=>this.importError=void 0),4e3)}handleBrickSelect(e){var r,t;e.stopPropagation(),this.currentSpec&&(this.selectedUid=null===(t=null===(r=c(this.currentSpec,e.detail.path))||void 0===r?void 0:r.configs)||void 0===t?void 0:t.uid)}findSelected(){var e;if(this.currentSpec&&this.selectedUid)for(const{brick:r,path:t}of u(this.currentSpec))if((null===(e=r.configs)||void 0===e?void 0:e.uid)===this.selectedUid)return{brick:r,path:t}}inputFieldKeys(){var e;const r=[];for(const{brick:t}of u(this.currentSpec)){const s=null===(e=t.configs)||void 0===e?void 0:e.key;"input"===t.type&&s&&r.push(s)}return r}wrapInRootGroup(e){const r=m("panel","column");return r?Object.assign(Object.assign({},r),{name:"Form",children:[e]}):e}setRootSpec(e){this.currentSpec=e,this.history.clear(),this.specChange.emit({spec:e,patches:[],inverse:[]})}applyUpdate(e){this.history.record(e),this.currentSpec=e.spec,this.specChange.emit({spec:e.spec,patches:e.patches,inverse:e.inverse})}specJson(){return JSON.stringify(this.currentSpec,null,2)}render(){return i("div",{key:"f23b549325059ff00dc9b4dcce05f82e7905f646",class:"fk-builder"},i("aside",{key:"76d630af39352b324fa1160945953bcc92f7e678",class:"fk-builder__palette"},i("fk-brick-list",{key:"a2fbf6fb78febd993e1972a3077e07cd952501f9"})),i("main",{key:"e65836c299ef0b102bf99da9263823cb8506aa87",class:"fk-builder__main"},i("div",{key:"cf6681fdc4f36720919f3e52852eeaf247b4cd3f",class:"fk-builder__toolbar"},i("button",{key:"8669e0c0bff778cee7b5a0f8dc85d762cd923309",type:"button",class:"fk-builder__tool",disabled:!this.history.canUndo,onClick:this.undo},"↩ ",_("builder.undo")),i("button",{key:"e8f1b9e73a97ce7fc134628ec9dd80c43ef27f16",type:"button",class:"fk-builder__tool",disabled:!this.history.canRedo,onClick:this.redo},"↪ ",_("builder.redo")),i("span",{key:"e0af911cdb8686c8276ef3b48f75cf65b3f300ea",class:"fk-builder__spacer"}),this.locales.length>1?i("select",{class:"fk-builder__tool",onChange:e=>this.editLocale=e.target.value},this.locales.map((e=>i("option",{value:e,selected:e===this.editLocale},e.toUpperCase())))):null,this.importError?i("span",{class:"fk-builder__import-error"},this.importError):null,i("button",{key:"5eb508486721587353400365ca3826bed2037620",type:"button",class:"fk-builder__tool",onClick:this.importFromClipboard},"⤓ ",_("builder.importJson")),i("button",{key:"4e60dd9edeef51da8871c34ea042cb828c6a547b",type:"button",class:"fk-builder__tool",disabled:!this.currentSpec,onClick:this.copySpec},"⧉ ",_(this.copied?"builder.copied":"builder.copyJson")),i("button",{key:"40fc0afc683894136b6be5f73fd7f9803e0cc34c",type:"button",class:"fk-builder__tool",disabled:!this.currentSpec,onClick:this.downloadSpec},"⬇ ",_("builder.downloadJson"))),i("div",{key:"317a25b31e4fa22204b923457a507f94bcbe5fbe",class:"fk-builder__canvas"},this.currentSpec?i("fk-form-render",{spec:this.currentSpec,data:this.currentData,editable:!0,selectedUid:this.selectedUid,locale:this.editLocale}):[i("fk-empty-form",null),i("fk-drop-area",{path:"0"})])),i("aside",{key:"7d6491acc432ed158eec6727db75f152fa8398d4",class:"fk-builder__inspector"},(()=>{const e=this.findSelected();return e?i("fk-property-panel",{brick:e.brick,fields:this.inputFieldKeys(),locales:this.locales,editLocale:this.editLocale}):i("p",{class:"fk-builder__hint"},_("builder.hint"))})()))}static get watchers(){return{spec:[{syncSpec:0}]}}static get style(){return".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)}"}},[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}]}]);function U(){"undefined"!=typeof customElements&&["fk-form-builder","fk-brick-actions","fk-brick-list","fk-brick-mold-item","fk-brick-not-found","fk-brick-render","fk-code-editor","fk-data-grid","fk-drop-area","fk-empty-form","fk-file-input","fk-form-render","fk-property-panel","fk-rules-editor","fk-select-input","fk-signature-input","fk-stepper","fk-tabs"].forEach((r=>{switch(r){case"fk-form-builder":customElements.get(e(r))||customElements.define(e(r),P);break;case"fk-brick-actions":customElements.get(e(r))||g();break;case"fk-brick-list":customElements.get(e(r))||y();break;case"fk-brick-mold-item":customElements.get(e(r))||j();break;case"fk-brick-not-found":customElements.get(e(r))||x();break;case"fk-brick-render":customElements.get(e(r))||C();break;case"fk-code-editor":customElements.get(e(r))||E();break;case"fk-data-grid":customElements.get(e(r))||w();break;case"fk-drop-area":customElements.get(e(r))||B();break;case"fk-empty-form":customElements.get(e(r))||D();break;case"fk-file-input":customElements.get(e(r))||S();break;case"fk-form-render":customElements.get(e(r))||R();break;case"fk-property-panel":customElements.get(e(r))||O();break;case"fk-rules-editor":customElements.get(e(r))||J();break;case"fk-select-input":customElements.get(e(r))||z();break;case"fk-signature-input":customElements.get(e(r))||I();break;case"fk-stepper":customElements.get(e(r))||L();break;case"fk-tabs":customElements.get(e(r))||M()}}))}U();const V=P,q=U;export{V as FkFormBuilder,q as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-D318uFl-.js";const p=o,r=s;export{p as FkFormRender,r as defineCustomElement}
1
+ import{F as o,d as s}from"./p-GjmAhT2E.js";const m=o,p=s;export{m as FkFormRender,p as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-DWgjI3TW.js";const p=o,r=s;export{p as FkPropertyPanel,r as defineCustomElement}
1
+ import{F as o,d as s}from"./p-B7ED8qMb.js";const p=o,r=s;export{p as FkPropertyPanel,r as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-BXFug2Ql.js";const p=o,r=s;export{p as FkRulesEditor,r as defineCustomElement}
1
+ import{F as o,d as p}from"./p-BSPTuA1p.js";const s=o,r=p;export{s as FkRulesEditor,r as defineCustomElement}
@@ -1 +1 @@
1
- import{F as s,d as o}from"./p-TvmRksgg.js";const m=s,p=o;export{m as FkSelectInput,p as defineCustomElement}
1
+ import{F as o,d as r}from"./p-DYBirEew.js";const s=o,p=r;export{s as FkSelectInput,p as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-DtzMNM4i.js";const t=o,p=s;export{t as FkSignatureInput,p as defineCustomElement}
1
+ import{F as o,d as p}from"./p-C85zhhpr.js";const r=o,s=p;export{r as FkSignatureInput,s as defineCustomElement}
@@ -1 +1 @@
1
- import{F as s,d as o}from"./p-BLKRn62s.js";const p=s,r=o;export{p as FkStepper,r as defineCustomElement}
1
+ import{F as o,d as s}from"./p-Do6-yRva.js";const a=o,p=s;export{a as FkStepper,p as defineCustomElement}
@@ -1 +1 @@
1
- import{F as o,d as s}from"./p-DKGyje7v.js";const p=o,r=s;export{p as FkTabs,r as defineCustomElement}
1
+ import{F as o,d as s}from"./p-DIPoAaGe.js";const a=o,p=s;export{a as FkTabs,p as defineCustomElement}
@@ -1 +1 @@
1
- import{h as e}from"./p-QC41Uj05.js";export{g as getAssetPath,r as render,s as setAssetPath,b as setNonce,d as setPlatformOptions}from"./p-QC41Uj05.js";import{r as t}from"./p-gPc0o8Jb.js";export{b as getBrick,g as getBrickMolds,a as getBrickMoldsGroupedByCategory,n as newBrickSpec,c as registerBrick}from"./p-gPc0o8Jb.js";import{B as l,n as i}from"./p-dX7Lo8Fe.js";import{a as o}from"./p-BQP1WryV.js";export{f as fkTOr,b as frFkTranslations,s as setFkTranslations}from"./p-BQP1WryV.js";function u(e){return new class extends l{constructor(){var a;super({type:e.type,dataType:e.dataType,id:e.id,name:e.name,category:e.category,configsForm:e.configsForm,styles:null!==(a=e.styles)&&void 0!==a?a:{},validators:e.validators,unWrapData:e.unWrapData,isPrivate:e.isPrivate,defaultConfigs:e.defaultConfigs})}render(a){return e.render(a)}renderBuilder(a){var t;return(null!==(t=e.renderBuilder)&&void 0!==t?t:e.render)(a)}getComponent(e){return this.render(e)}getComponentWithActions(e){return this.renderBuilder(e)}}}const p=e=>e.replace(/-([a-z])/g,((e,a)=>a.toUpperCase()));function v(e){const a=Object.entries(null!=e?e:{}).filter((([,e])=>null!=e&&""!==e));if(0===a.length)return;const t={};for(const[e,l]of a)t[p(e)]=l+"";return t}const y=(e,a)=>{var t,l,n,i;return null!==(i=null!==(l=null===(t=e.configs)||void 0===t?void 0:t.label)&&void 0!==l?l:null===(n=e.configs)||void 0===n?void 0:n.key)&&void 0!==i?i:a},k=(a,t)=>{var l,n;const i=null===(l=a.configs)||void 0===l?void 0:l.prefix,d=null===(n=a.configs)||void 0===n?void 0:n.suffix;return i||d?e("div",{class:"fk-adorned"},i?e("span",{class:"fk-adorned__affix"},i):null,t,d?e("span",{class:"fk-adorned__affix"},d):null):t},m=(a,t,l)=>e("div",{class:"fk-field",style:v(a.styles)},e("span",{class:"fk-field__label"},y(a,t)),l,a.error?e("span",{class:"fk-field__error"},a.error):null),_=(a,t,l)=>e("label",{class:"fk-field",style:v(a.styles)},e("span",{class:"fk-field__label"},y(a,t)),l,a.error?e("span",{class:"fk-field__error"},a.error):null),T=a=>u({type:"input",dataType:"string",id:a.id,name:a.name,category:"Inputs",defaultConfigs:{label:a.name},render:t=>{var l,n;return _(t,a.name,k(t,e("input",{class:"fk-field__input fk-adorned__input",type:a.inputType,value:null!==(l=t.data)&&void 0!==l?l:"",placeholder:null===(n=t.configs)||void 0===n?void 0:n.placeholder,disabled:t.editable||t.disabled,onInput:e=>{var a;return null===(a=t.onDataChange)||void 0===a?void 0:a.call(t,e.target.value)}})))}}),C=T({id:"text",name:"Text",inputType:"text"}),h=T({id:"email",name:"Email",inputType:"email"}),x=T({id:"password",name:"Password",inputType:"password"}),S=T({id:"url",name:"URL",inputType:"url"}),O=T({id:"phone",name:"Phone",inputType:"tel"}),j=u({type:"input",dataType:"string",id:"textarea",name:"Text area",category:"Inputs",defaultConfigs:{label:"Text area"},render:a=>{var t,l;return _(a,"Text area",e("textarea",{class:"fk-field__input fk-field__input--textarea",value:null!==(t=a.data)&&void 0!==t?t:"",placeholder:null===(l=a.configs)||void 0===l?void 0:l.placeholder,disabled:a.editable||a.disabled,onInput:e=>{var t;return null===(t=a.onDataChange)||void 0===t?void 0:t.call(a,e.target.value)}}))}}),I=u({type:"input",dataType:"number",id:"number",name:"Number",category:"Inputs",defaultConfigs:{label:"Number"},render:a=>{var t;return _(a,"Number",k(a,e("input",{class:"fk-field__input fk-adorned__input",type:"number",value:null==a.data?"":a.data+"",placeholder:null===(t=a.configs)||void 0===t?void 0:t.placeholder,disabled:a.editable||a.disabled,onInput:e=>{var t;const l=e.target.value;null===(t=a.onDataChange)||void 0===t||t.call(a,""===l?void 0:Number(l))}})))}}),B=u({type:"input",dataType:"string",id:"date",name:"Date",category:"Inputs",defaultConfigs:{label:"Date"},render:a=>{var t;return _(a,"Date",e("input",{class:"fk-field__input",type:"date",value:null!==(t=a.data)&&void 0!==t?t:"",disabled:a.editable||a.disabled,onInput:e=>{var t;const l=e.target.value;null===(t=a.onDataChange)||void 0===t||t.call(a,""===l?void 0:l)}}))}}),D=u({type:"input",dataType:"string",id:"select",name:"Select",category:"Inputs",defaultConfigs:{label:"Select",optionsSource:"static",options:"Option 1\nOption 2"},render:a=>{var t;return m(a,"Select",e("fk-select-input",{configs:a.configs,value:null!==(t=a.data)&&void 0!==t?t:"",disabled:a.editable||a.disabled,dataMap:a.dataMap,onSelectValueChange:e=>{var t;e.stopPropagation(),null===(t=a.onDataChange)||void 0===t||t.call(a,e.detail)}}))}}),w=u({type:"input",dataType:"array",id:"multi-select",name:"Multi select",category:"Inputs",defaultConfigs:{label:"Multi select",optionsSource:"static",options:"Option 1\nOption 2\nOption 3"},render:a=>m(a,"Multi select",e("fk-select-input",{configs:a.configs,value:Array.isArray(a.data)?a.data:[],multiple:!0,disabled:a.editable||a.disabled,dataMap:a.dataMap,onSelectValueChange:e=>{var t;e.stopPropagation(),null===(t=a.onDataChange)||void 0===t||t.call(a,e.detail)}}))}),A=T({id:"time",name:"Time",inputType:"time"}),L=T({id:"datetime",name:"Date / Time",inputType:"datetime-local"}),P=u({type:"input",dataType:"array",id:"select-boxes",name:"Select boxes",category:"Inputs",defaultConfigs:{label:"Select boxes",options:"Option 1\nOption 2\nOption 3"},render:a=>{var t;const l=Array.isArray(a.data)?a.data:[];return e("div",{class:"fk-field",style:v(a.styles)},e("span",{class:"fk-field__label"},y(a,"Select boxes")),e("div",{class:"fk-radio-group"},(e=>((null!=e?e:"")+"").split("\n").map((e=>e.trim())).filter(Boolean))(null===(t=a.configs)||void 0===t?void 0:t.options).map((t=>e("label",{class:"fk-radio",key:t},e("input",{type:"checkbox",checked:l.includes(t),disabled:a.editable||a.disabled,onChange:e=>{var n;const i=e.target.checked?[...l,t]:l.filter((e=>e!==t));null===(n=a.onDataChange)||void 0===n||n.call(a,i.length?i:void 0)}}),e("span",null,t))))),a.error?e("span",{class:"fk-field__error"},a.error):null)}}),M=u({type:"input",dataType:"array",id:"tags",name:"Tags",category:"Inputs",defaultConfigs:{label:"Tags"},render:a=>{const t=Array.isArray(a.data)?a.data:[];return _(a,"Tags",e("div",{class:"fk-tags"},t.map((l=>e("span",{class:"fk-tags__chip",key:l},l,e("button",{type:"button",class:"fk-tags__remove",disabled:a.editable||a.disabled,onClick:()=>{var e;const n=t.filter((e=>e!==l));null===(e=a.onDataChange)||void 0===e||e.call(a,n.length?n:void 0)}},"✕")))),e("input",{class:"fk-tags__input",type:"text",placeholder:"Add a tag…",disabled:a.editable||a.disabled,onKeyDown:e=>{var l;if("Enter"!==e.key)return;e.preventDefault();const n=e.target,i=n.value.trim();i&&!t.includes(i)&&(null===(l=a.onDataChange)||void 0===l||l.call(a,[...t,i]),n.value="")}})))}}),F=u({type:"input",dataType:"string",id:"signature",name:"Signature",category:"Inputs",defaultConfigs:{label:"Signature"},render:a=>{var t;return _(a,"Signature",e("fk-signature-input",{value:null!==(t=a.data)&&void 0!==t?t:void 0,disabled:a.editable||a.disabled,onSignatureChange:e=>{var t;e.stopPropagation(),null===(t=a.onDataChange)||void 0===t||t.call(a,e.detail)}}))}}),V=u({type:"panel",dataType:"void",id:"tabs",name:"Tabs",category:"Layout",defaultConfigs:{validateTabs:!1},render:a=>{var t,l;const n=(null!==(l=null===(t=a.brickSpec)||void 0===t?void 0:t.children)&&void 0!==l?l:[]).map(((e,t)=>{var l,n;const d=i(null===(l=e.configs)||void 0===l?void 0:l.label,a.locale);return"string"==typeof d?d:null!==(n=e.name)&&void 0!==n?n:"Tab "+(t+1)}));return e("fk-tabs",{tabLabels:n,editable:a.editable,spec:a.brickSpec,dataMap:a.dataMap,locale:a.locale,style:v(a.styles)},a.children)}}),N=u({type:"input",dataType:"string",id:"radio",name:"Radio",category:"Inputs",defaultConfigs:{label:"Radio",options:"Option 1\nOption 2"},render:a=>{var t,l;return e("div",{class:"fk-field",style:v(a.styles)},e("span",{class:"fk-field__label"},y(a,"Radio")),e("div",{class:"fk-radio-group",role:"radiogroup"},((null!==(l=null===(t=a.configs)||void 0===t?void 0:t.options)&&void 0!==l?l:"")+"").split("\n").map((e=>e.trim())).filter(Boolean).map((t=>{var l,n;return e("label",{class:"fk-radio",key:t},e("input",{type:"radio",name:null!==(n=null===(l=a.configs)||void 0===l?void 0:l.key)&&void 0!==n?n:a.path,checked:a.data===t,disabled:a.editable||a.disabled,onChange:()=>{var e;return null===(e=a.onDataChange)||void 0===e?void 0:e.call(a,t)}}),e("span",null,t))}))),a.error?e("span",{class:"fk-field__error"},a.error):null)}}),R=[{key:"street",label:()=>o("address.street"),full:!0},{key:"city",label:()=>o("address.city"),full:!1},{key:"zip",label:()=>o("address.zip"),full:!1},{key:"country",label:()=>o("address.country"),full:!1}],Q=u({type:"input",dataType:"object",id:"address",name:"Address",category:"Inputs",defaultConfigs:{label:"Address"},render:a=>{var t;const l=null!==(t=a.data)&&void 0!==t?t:{};return m(a,"Address",e("div",{class:"fk-address"},R.map((t=>{var n;return e("label",{class:{"fk-address__part":!0,"fk-address__part--full":t.full},key:t.key},e("span",{class:"fk-address__label"},t.label()),e("input",{class:"fk-field__input",type:"text",value:null!==(n=l[t.key])&&void 0!==n?n:"",disabled:a.editable||a.disabled,onInput:e=>{var n;const i=e.target.value,d=Object.assign(Object.assign({},l),{[t.key]:i||void 0}),r=Object.fromEntries(Object.entries(d).filter((([,e])=>void 0!==e)));null===(n=a.onDataChange)||void 0===n||n.call(a,Object.keys(r).length?r:void 0)}}))}))))}}),W=u({type:"input",dataType:"object",id:"file",name:"File",category:"Data",defaultConfigs:{label:"File"},render:a=>{var t;return m(a,"File",e("fk-file-input",{value:a.data,accept:null===(t=a.configs)||void 0===t?void 0:t.accept,disabled:a.editable||a.disabled,onFileValueChange:e=>{var t;e.stopPropagation(),null===(t=a.onDataChange)||void 0===t||t.call(a,e.detail)}}))}}),z=u({type:"collection",dataType:"array",id:"data-grid",name:"Data grid",category:"Data",defaultConfigs:{label:"Data grid"},render:a=>m(a,"Data grid",a.editable||!a.brickSpec?e("div",{class:"fk-grid-template"},e("span",{class:"fk-grid-template__hint"},o("grid.columns")),a.children):e("fk-data-grid",{spec:a.brickSpec,value:a.data,disabled:a.disabled,locale:a.locale,utils:a.utils,onGridValueChange:e=>{var t;e.stopPropagation(),null===(t=a.onDataChange)||void 0===t||t.call(a,e.detail)}}))}),G=u({type:"input",dataType:"string",id:"hidden",name:"Hidden",category:"Data",defaultConfigs:{},render:a=>{var t,l;return a.editable?e("div",{class:"fk-hidden-chip"},"hidden: ",null===(t=a.configs)||void 0===t?void 0:t.key):e("input",{type:"hidden",value:null!==(l=a.data)&&void 0!==l?l:""})}}),U=u({type:"output",dataType:"void",id:"content",name:"Content",category:"Layout",defaultConfigs:{content:"Some text…"},render:a=>{var t,l;return e("div",{class:"fk-content",style:v(a.styles)},((null!==(l=null===(t=a.configs)||void 0===t?void 0:t.content)&&void 0!==l?l:"")+"").split("\n").map((a=>e("p",{class:"fk-content__line"},a))))}}),E=u({type:"panel",dataType:"void",id:"stepper",name:"Stepper",category:"Layout",defaultConfigs:{validateSteps:!1,allowStepClick:!0,showSubmit:!1},render:a=>{var t,l;const n=(null!==(l=null===(t=a.brickSpec)||void 0===t?void 0:t.children)&&void 0!==l?l:[]).map(((e,t)=>{var l,n;const d=i(null===(l=e.configs)||void 0===l?void 0:l.label,a.locale);return"string"==typeof d?d:null!==(n=e.name)&&void 0!==n?n:"Step "+(t+1)}));return e("fk-stepper",{stepLabels:n,editable:a.editable,spec:a.brickSpec,dataMap:a.dataMap,locale:a.locale,style:v(a.styles)},a.children)}}),J=u({type:"input",dataType:"boolean",id:"checkbox",name:"Checkbox",category:"Inputs",defaultConfigs:{label:"Checkbox"},render:a=>e("label",{class:"fk-field fk-field--inline",style:v(a.styles)},e("input",{class:"fk-field__checkbox",type:"checkbox",checked:!0===a.data,disabled:a.editable||a.disabled,onChange:e=>{var t;return null===(t=a.onDataChange)||void 0===t?void 0:t.call(a,e.target.checked)}}),e("span",{class:"fk-field__label"},y(a,"Checkbox")),a.error?e("span",{class:"fk-field__error"},a.error):null)}),H=u({type:"panel",dataType:"void",id:"group",name:"Group",category:"Layout",render:a=>{var t;return e("fieldset",{class:"fk-group",style:v(a.styles)},(null===(t=a.configs)||void 0===t?void 0:t.label)?e("legend",{class:"fk-group__legend"},a.configs.label):null,a.children)}}),K=u({type:"panel",dataType:"void",id:"row",name:"Row",category:"Layout",render:a=>e("div",{class:"fk-row",style:v(a.styles)},a.children)}),X=u({type:"panel",dataType:"void",id:"column",name:"Column",category:"Layout",render:a=>e("div",{class:"fk-column",style:v(a.styles)},a.children)});function q(){t([C,h,x,S,O,j,I,B,A,L,D,w,N,P,J,M,F,Q,W,z,G,U,H,K,X,E,V])}export{Q as addressBrick,J as checkboxBrick,X as columnBrick,U as contentBrick,u as createBrick,z as dataGridBrick,B as dateBrick,L as datetimeBrick,h as emailBrick,W as fileBrick,o as fkT,H as groupBrick,e as h,G as hiddenBrick,w as multiSelectBrick,I as numberBrick,x as passwordBrick,O as phoneBrick,N as radioBrick,t as registerBricks,q as registerDefaultBricks,K as rowBrick,P as selectBoxesBrick,D as selectBrick,F as signatureBrick,E as stepperBrick,V as tabsBrick,M as tagsBrick,C as textInputBrick,j as textareaBrick,A as timeBrick,S as urlBrick}
1
+ import{h as e}from"./p-BrOXMyOG.js";export{g as getAssetPath,r as render,s as setAssetPath,b as setNonce,d as setPlatformOptions}from"./p-BrOXMyOG.js";import{r as t}from"./p-gPc0o8Jb.js";export{b as getBrick,g as getBrickMolds,a as getBrickMoldsGroupedByCategory,n as newBrickSpec,c as registerBrick}from"./p-gPc0o8Jb.js";import{B as l,n as i,g as o}from"./p-LXnm2ogM.js";import{n as u}from"./p-CWQX0sXS.js";import{a as p,f}from"./p-D7bf2ztq.js";export{b as frFkTranslations,s as setFkTranslations}from"./p-D7bf2ztq.js";function v(e){return new class extends l{constructor(){var a;super({type:e.type,dataType:e.dataType,id:e.id,name:e.name,category:e.category,configsForm:e.configsForm,styles:null!==(a=e.styles)&&void 0!==a?a:{},validators:e.validators,unWrapData:e.unWrapData,isPrivate:e.isPrivate,defaultConfigs:e.defaultConfigs})}render(a){return e.render(a)}renderBuilder(a){var t;return(null!==(t=e.renderBuilder)&&void 0!==t?t:e.render)(a)}getComponent(e){return this.render(e)}getComponentWithActions(e){return this.renderBuilder(e)}}}const y=e=>e.replace(/-([a-z])/g,((e,a)=>a.toUpperCase()));function k(e){const a=Object.entries(null!=e?e:{}).filter((([,e])=>null!=e&&""!==e));if(0===a.length)return;const t={};for(const[e,l]of a)t[y(e)]=l+"";return t}const _=(e,a)=>{var t,l,n,i;return null!==(i=null!==(l=null===(t=e.configs)||void 0===t?void 0:t.label)&&void 0!==l?l:null===(n=e.configs)||void 0===n?void 0:n.key)&&void 0!==i?i:a},m=(a,t)=>{var l,n;const i=null===(l=a.configs)||void 0===l?void 0:l.prefix,o=null===(n=a.configs)||void 0===n?void 0:n.suffix;return i||o?e("div",{class:"fk-adorned"},i?e("span",{class:"fk-adorned__affix"},i):null,t,o?e("span",{class:"fk-adorned__affix"},o):null):t},T=(a,t,l)=>e("div",{class:"fk-field",style:k(a.styles)},e("span",{class:"fk-field__label"},_(a,t)),l,a.error?e("span",{class:"fk-field__error"},a.error):null),h=(a,t,l)=>e("label",{class:"fk-field",style:k(a.styles)},e("span",{class:"fk-field__label"},_(a,t)),l,a.error?e("span",{class:"fk-field__error"},a.error):null),C=a=>v({type:"input",dataType:"string",id:a.id,name:a.name,category:"Inputs",defaultConfigs:{label:a.name},render:t=>{var l,n;return h(t,a.name,m(t,e("input",{class:"fk-field__input fk-adorned__input",type:a.inputType,value:null!==(l=t.data)&&void 0!==l?l:"",placeholder:null===(n=t.configs)||void 0===n?void 0:n.placeholder,disabled:t.editable||t.disabled,onInput:e=>{var a;return null===(a=t.onDataChange)||void 0===a?void 0:a.call(t,e.target.value)}})))}}),x=C({id:"text",name:"Text",inputType:"text"}),S=C({id:"email",name:"Email",inputType:"email"}),O=C({id:"password",name:"Password",inputType:"password"}),j=C({id:"url",name:"URL",inputType:"url"}),I=C({id:"phone",name:"Phone",inputType:"tel"}),w=v({type:"input",dataType:"string",id:"textarea",name:"Text area",category:"Inputs",defaultConfigs:{label:"Text area"},render:a=>{var t,l;return h(a,"Text area",e("textarea",{class:"fk-field__input fk-field__input--textarea",value:null!==(t=a.data)&&void 0!==t?t:"",placeholder:null===(l=a.configs)||void 0===l?void 0:l.placeholder,disabled:a.editable||a.disabled,onInput:e=>{var t;return null===(t=a.onDataChange)||void 0===t?void 0:t.call(a,e.target.value)}}))}}),D=v({type:"input",dataType:"number",id:"number",name:"Number",category:"Inputs",defaultConfigs:{label:"Number"},render:a=>{var t;return h(a,"Number",m(a,e("input",{class:"fk-field__input fk-adorned__input",type:"number",value:null==a.data?"":a.data+"",placeholder:null===(t=a.configs)||void 0===t?void 0:t.placeholder,disabled:a.editable||a.disabled,onInput:e=>{var t;const l=e.target.value;null===(t=a.onDataChange)||void 0===t||t.call(a,""===l?void 0:Number(l))}})))}}),A=v({type:"input",dataType:"string",id:"date",name:"Date",category:"Inputs",defaultConfigs:{label:"Date"},render:a=>{var t;return h(a,"Date",e("input",{class:"fk-field__input",type:"date",value:null!==(t=a.data)&&void 0!==t?t:"",disabled:a.editable||a.disabled,onInput:e=>{var t;const l=e.target.value;null===(t=a.onDataChange)||void 0===t||t.call(a,""===l?void 0:l)}}))}}),B=v({type:"input",dataType:"string",id:"select",name:"Select",category:"Inputs",defaultConfigs:{label:"Select",optionsSource:"static",options:"Option 1\nOption 2"},render:a=>{var t;return T(a,"Select",e("fk-select-input",{configs:a.configs,value:null!==(t=a.data)&&void 0!==t?t:"",disabled:a.editable||a.disabled,dataMap:a.dataMap,onSelectValueChange:e=>{var t;e.stopPropagation(),null===(t=a.onDataChange)||void 0===t||t.call(a,e.detail)}}))}}),M=v({type:"input",dataType:"array",id:"multi-select",name:"Multi select",category:"Inputs",defaultConfigs:{label:"Multi select",optionsSource:"static",options:"Option 1\nOption 2\nOption 3"},render:a=>T(a,"Multi select",e("fk-select-input",{configs:a.configs,value:Array.isArray(a.data)?a.data:[],multiple:!0,disabled:a.editable||a.disabled,dataMap:a.dataMap,onSelectValueChange:e=>{var t;e.stopPropagation(),null===(t=a.onDataChange)||void 0===t||t.call(a,e.detail)}}))}),L=C({id:"time",name:"Time",inputType:"time"}),N=C({id:"datetime",name:"Date / Time",inputType:"datetime-local"}),P=e=>{var a,t,l;return u(null===(a=e.configs)||void 0===a?void 0:a.options,"string"==typeof(null===(t=e.configs)||void 0===t?void 0:t.labelKey)?e.configs.labelKey:"label","string"==typeof(null===(l=e.configs)||void 0===l?void 0:l.valueKey)?e.configs.valueKey:"value")},R=v({type:"input",dataType:"array",id:"select-boxes",name:"Select boxes",category:"Inputs",defaultConfigs:{label:"Select boxes",options:"Option 1\nOption 2\nOption 3"},render:a=>{const t=Array.isArray(a.data)?a.data:[];return e("div",{class:"fk-field",style:k(a.styles)},e("span",{class:"fk-field__label"},_(a,"Select boxes")),e("div",{class:"fk-radio-group"},P(a).map((l=>e("label",{class:"fk-radio",key:l.value},e("input",{type:"checkbox",checked:t.includes(l.value),disabled:a.editable||a.disabled,onChange:e=>{var n;const i=e.target.checked?[...t,l.value]:t.filter((e=>e!==l.value));null===(n=a.onDataChange)||void 0===n||n.call(a,i.length?i:void 0)}}),e("span",null,l.label))))),a.error?e("span",{class:"fk-field__error"},a.error):null)}}),z=v({type:"input",dataType:"array",id:"tags",name:"Tags",category:"Inputs",defaultConfigs:{label:"Tags"},render:a=>{const t=Array.isArray(a.data)?a.data:[];return h(a,"Tags",e("div",{class:"fk-tags"},t.map((l=>e("span",{class:"fk-tags__chip",key:l},l,e("button",{type:"button",class:"fk-tags__remove",disabled:a.editable||a.disabled,onClick:()=>{var e;const n=t.filter((e=>e!==l));null===(e=a.onDataChange)||void 0===e||e.call(a,n.length?n:void 0)}},"✕")))),e("input",{class:"fk-tags__input",type:"text",placeholder:"Add a tag…",disabled:a.editable||a.disabled,onKeyDown:e=>{var l;if("Enter"!==e.key)return;e.preventDefault();const n=e.target,i=n.value.trim();i&&!t.includes(i)&&(null===(l=a.onDataChange)||void 0===l||l.call(a,[...t,i]),n.value="")}})))}}),F=v({type:"input",dataType:"string",id:"signature",name:"Signature",category:"Inputs",defaultConfigs:{label:"Signature"},render:a=>{var t;return h(a,"Signature",e("fk-signature-input",{value:null!==(t=a.data)&&void 0!==t?t:void 0,disabled:a.editable||a.disabled,onSignatureChange:e=>{var t;e.stopPropagation(),null===(t=a.onDataChange)||void 0===t||t.call(a,e.detail)}}))}}),G=v({type:"panel",dataType:"void",id:"tabs",name:"Tabs",category:"Layout",defaultConfigs:{validateTabs:!1},render:a=>{var t,l;const n=(null!==(l=null===(t=a.brickSpec)||void 0===t?void 0:t.children)&&void 0!==l?l:[]).map(((e,t)=>{var l,n;const o=i(null===(l=e.configs)||void 0===l?void 0:l.label,a.locale);return"string"==typeof o?o:null!==(n=e.name)&&void 0!==n?n:"Tab "+(t+1)}));return e("fk-tabs",{tabLabels:n,editable:a.editable,spec:a.brickSpec,dataMap:a.dataMap,locale:a.locale,style:k(a.styles)},a.children)}}),X=v({type:"input",dataType:"string",id:"radio",name:"Radio",category:"Inputs",defaultConfigs:{label:"Radio",options:"Option 1\nOption 2"},render:a=>e("div",{class:"fk-field",style:k(a.styles)},e("span",{class:"fk-field__label"},_(a,"Radio")),e("div",{class:"fk-radio-group",role:"radiogroup"},P(a).map((t=>{var l,n;return e("label",{class:"fk-radio",key:t.value},e("input",{type:"radio",name:null!==(n=null===(l=a.configs)||void 0===l?void 0:l.key)&&void 0!==n?n:a.path,checked:a.data===t.value,disabled:a.editable||a.disabled,onChange:()=>{var e;return null===(e=a.onDataChange)||void 0===e?void 0:e.call(a,t.value)}}),e("span",null,t.label))}))),a.error?e("span",{class:"fk-field__error"},a.error):null)}),V=[{key:"street",label:()=>p("address.street"),full:!0},{key:"city",label:()=>p("address.city"),full:!1},{key:"zip",label:()=>p("address.zip"),full:!1},{key:"country",label:()=>p("address.country"),full:!1}],E=v({type:"input",dataType:"object",id:"address",name:"Address",category:"Inputs",defaultConfigs:{label:"Address"},render:a=>{var t;const l=null!==(t=a.data)&&void 0!==t?t:{};return T(a,"Address",e("div",{class:"fk-address"},V.map((t=>{var n;return e("label",{class:{"fk-address__part":!0,"fk-address__part--full":t.full},key:t.key},e("span",{class:"fk-address__label"},t.label()),e("input",{class:"fk-field__input",type:"text",value:null!==(n=l[t.key])&&void 0!==n?n:"",disabled:a.editable||a.disabled,onInput:e=>{var n;const i=e.target.value,o=Object.assign(Object.assign({},l),{[t.key]:i||void 0}),r=Object.fromEntries(Object.entries(o).filter((([,e])=>void 0!==e)));null===(n=a.onDataChange)||void 0===n||n.call(a,Object.keys(r).length?r:void 0)}}))}))))}}),W=v({type:"input",dataType:"object",id:"file",name:"File",category:"Data",defaultConfigs:{label:"File"},render:a=>{var t,l;return T(a,"File",e("fk-file-input",{value:a.data,accept:null===(t=a.configs)||void 0===t?void 0:t.accept,uploadUrl:null===(l=a.configs)||void 0===l?void 0:l.uploadUrl,disabled:a.editable||a.disabled,onFileValueChange:e=>{var t;e.stopPropagation(),null===(t=a.onDataChange)||void 0===t||t.call(a,e.detail)}}))}}),q=v({type:"collection",dataType:"array",id:"data-grid",name:"Data grid",category:"Data",defaultConfigs:{label:"Data grid"},render:a=>T(a,"Data grid",a.editable||!a.brickSpec?e("div",{class:"fk-grid-template"},e("span",{class:"fk-grid-template__hint"},p("grid.columns")),a.children):e("fk-data-grid",{spec:a.brickSpec,value:a.data,disabled:a.disabled,locale:a.locale,utils:a.utils,onGridValueChange:e=>{var t;e.stopPropagation(),null===(t=a.onDataChange)||void 0===t||t.call(a,e.detail)}}))}),J=v({type:"input",dataType:"string",id:"hidden",name:"Hidden",category:"Data",defaultConfigs:{},render:a=>{var t,l;return a.editable?e("div",{class:"fk-hidden-chip"},"hidden: ",null===(t=a.configs)||void 0===t?void 0:t.key):e("input",{type:"hidden",value:null!==(l=a.data)&&void 0!==l?l:""})}}),U=v({type:"output",dataType:"void",id:"content",name:"Content",category:"Layout",defaultConfigs:{content:"Some text…"},render:a=>{var t,l;return e("div",{class:"fk-content",style:k(a.styles)},((null!==(l=null===(t=a.configs)||void 0===t?void 0:t.content)&&void 0!==l?l:"")+"").split("\n").map((a=>e("p",{class:"fk-content__line"},a))))}}),H=v({type:"panel",dataType:"void",id:"stepper",name:"Stepper",category:"Layout",defaultConfigs:{validateSteps:!1,allowStepClick:!0,showSubmit:!1},render:a=>{var t,l;const n=(null!==(l=null===(t=a.brickSpec)||void 0===t?void 0:t.children)&&void 0!==l?l:[]).map(((e,t)=>{var l,n;const o=i(null===(l=e.configs)||void 0===l?void 0:l.label,a.locale);return"string"==typeof o?o:null!==(n=e.name)&&void 0!==n?n:"Step "+(t+1)}));return e("fk-stepper",{stepLabels:n,editable:a.editable,spec:a.brickSpec,dataMap:a.dataMap,locale:a.locale,style:k(a.styles)},a.children)}}),K=v({type:"input",dataType:"boolean",id:"checkbox",name:"Checkbox",category:"Inputs",defaultConfigs:{label:"Checkbox"},render:a=>e("label",{class:"fk-field fk-field--inline",style:k(a.styles)},e("input",{class:"fk-field__checkbox",type:"checkbox",checked:!0===a.data,disabled:a.editable||a.disabled,onChange:e=>{var t;return null===(t=a.onDataChange)||void 0===t?void 0:t.call(a,e.target.checked)}}),e("span",{class:"fk-field__label"},_(a,"Checkbox")),a.error?e("span",{class:"fk-field__error"},a.error):null)}),Q=v({type:"panel",dataType:"void",id:"group",name:"Group",category:"Layout",render:a=>{var t;return e("fieldset",{class:"fk-group",style:k(a.styles)},(null===(t=a.configs)||void 0===t?void 0:t.label)?e("legend",{class:"fk-group__legend"},a.configs.label):null,a.children)}}),Y=v({type:"panel",dataType:"void",id:"row",name:"Row",category:"Layout",render:a=>e("div",{class:"fk-row",style:k(a.styles)},a.children)}),Z=v({type:"panel",dataType:"void",id:"column",name:"Column",category:"Layout",render:a=>e("div",{class:"fk-column",style:k(a.styles)},a.children)}),$=(e,a)=>{var t;if(Array.isArray(a))return a.map((a=>$(e,a))).filter(Boolean).join(", ");if(!0===a)return f("recap.yes","Yes");if(!1===a)return f("recap.no","No");if(a&&"object"==typeof a)return"string"==typeof a.name&&"url"in a?a.name:Object.values(a).filter((e=>"string"==typeof e&&e)).join(" ");const l=(null!=a?a:"")+"";if(null!=(null===(t=e.configs)||void 0===t?void 0:t.options)){const a=u(e.configs.options,"string"==typeof e.configs.labelKey?e.configs.labelKey:"label","string"==typeof e.configs.valueKey?e.configs.valueKey:"value").find((e=>e.value===l));if(a)return a.label}return l},ee=e=>null==e||""===e||Array.isArray(e)&&0===e.length,ae=(e,a)=>{var t,l,n,o,r;return(null!==(r=null!==(n=null!==(l=i(null===(t=e.configs)||void 0===t?void 0:t.label,a))&&void 0!==l?l:e.name)&&void 0!==n?n:null===(o=e.configs)||void 0===o?void 0:o.key)&&void 0!==r?r:"")+""},te=e=>{var a,t;const l=[];for(const n of null!==(a=e.children)&&void 0!==a?a:[]){const e=null===(t=n.configs)||void 0===t?void 0:t.key;"input"===n.type&&e&&!e.startsWith("_")?l.push(n):"panel"===n.type&&l.push(...te(n))}return l},le=(e,a,t,l,n=!1)=>{var r,s,d;if(!e)return[];const u=[];for(const p of null!==(r=e.children)&&void 0!==r?r:[]){if("recap"===p.id||"action"===p.type)continue;if(!0===o(p.rules,a).hidden)continue;const e=null===(s=p.configs)||void 0===s?void 0:s.key,r=ae(p,t);if("collection"===p.type){const n=e&&Array.isArray(null==a?void 0:a[e])?a[e]:[];if(!n.length&&!l)continue;const i=te(p);u.push({kind:"collection",label:r,columns:i.map((e=>ae(e,t))),rows:n.map((e=>i.map((a=>{const t=null==e?void 0:e[a.configs.key];return ee(t)?"—":$(a,t)}))))});continue}if("panel"===p.type){const e=i(null===(d=p.configs)||void 0===d?void 0:d.label,t);if(n&&"string"==typeof e&&e.trim()){const n=le(p,a,t,l);n.length&&(u.push({kind:"section",label:e}),u.push(...n));continue}u.push(...le(p,a,t,l,n));continue}if("input"!==p.type||!e||e.startsWith("_"))continue;const c=null==a?void 0:a[e];ee(c)&&!l||u.push({kind:"field",label:r,value:ee(c)?"—":$(p,c)})}return u},ne=v({type:"output",dataType:"void",id:"recap",name:"Recap",category:"Layout",defaultConfigs:{label:"Recap",showEmpty:!1,groupBySections:!1},render:a=>{var t,l;const n=le(a.rootSpec,a.dataMap,a.locale,!0===(null===(t=a.configs)||void 0===t?void 0:t.showEmpty),!0===(null===(l=a.configs)||void 0===l?void 0:l.groupBySections)),i=[];let o=[];const r=()=>{o.length&&(i.push(e("dl",{class:"fk-recap__list"},o.map((a=>e("div",{class:"fk-recap__row",key:a.label},e("dt",{class:"fk-recap__term"},a.label),e("dd",{class:"fk-recap__value"},a.value)))))),o=[])};for(const a of n)"field"!==a.kind?(r(),i.push("section"!==a.kind?e("section",{class:"fk-recap__section",key:a.label},e("span",{class:"fk-recap__section-title"},a.label),a.rows.length?e("div",{class:"fk-recap__table-wrap"},e("table",{class:"fk-recap__table"},e("thead",null,e("tr",null,e("th",{class:"fk-recap__index-cell"},"#"),a.columns.map((a=>e("th",{key:a},a))))),e("tbody",null,a.rows.map(((a,t)=>e("tr",{key:t},e("td",{class:"fk-recap__index-cell"},t+1),a.map(((a,t)=>e("td",{key:t},a))))))))):e("p",{class:"fk-recap__empty"},f("recap.empty","Nothing to summarize yet."))):e("span",{class:"fk-recap__group-title",key:"section:"+a.label},a.label))):o.push(a);return r(),e("div",{class:"fk-field fk-recap",style:k(a.styles)},e("span",{class:"fk-field__label"},_(a,"Recap")),i.length?i:e("p",{class:"fk-recap__empty"},f("recap.empty","Nothing to summarize yet.")))}});function ie(){t([x,S,O,j,I,w,D,A,L,N,B,M,X,R,K,z,F,E,W,q,J,U,ne,Q,Y,Z,H,G])}export{E as addressBrick,K as checkboxBrick,Z as columnBrick,U as contentBrick,v as createBrick,q as dataGridBrick,A as dateBrick,N as datetimeBrick,S as emailBrick,W as fileBrick,p as fkT,f as fkTOr,Q as groupBrick,e as h,J as hiddenBrick,M as multiSelectBrick,D as numberBrick,O as passwordBrick,I as phoneBrick,X as radioBrick,ne as recapBrick,t as registerBricks,ie as registerDefaultBricks,Y as rowBrick,R as selectBoxesBrick,B as selectBrick,F as signatureBrick,H as stepperBrick,G as tabsBrick,z as tagsBrick,x as textInputBrick,w as textareaBrick,L as timeBrick,j as urlBrick}
@@ -1 +1 @@
1
- import{t as o,p as r,H as i,h as e}from"./p-QC41Uj05.js";import{d as s}from"./p-92BozD8S.js";import{f as t}from"./p-BQP1WryV.js";const a=r(class extends i{constructor(o){super(),!1!==o&&this.__registerHost(),this.isDragging=!1}componentDidLoad(){this.cleanup=s({element:this.host,getInitialData:()=>({kind:"new-brick",moldType:this.brickMold.type,moldId:this.brickMold.id}),onDragStart:()=>this.isDragging=!0,onDrop:()=>this.isDragging=!1})}disconnectedCallback(){var o;null===(o=this.cleanup)||void 0===o||o.call(this)}render(){return e("div",{key:"0570015fb47b6be613f900a333b061537006edec",class:{"fk-mold":!0,"fk-mold--dragging":this.isDragging},title:t(`brick.${this.brickMold.id}.name`,this.brickMold.name)},e("span",{key:"bf3ab329f7a4b054c56e042dd83822706546c93b",class:"fk-mold__name"},t(`brick.${this.brickMold.id}.name`,this.brickMold.name)))}get host(){return this}static get style(){return".sc-fk-brick-mold-item-h{display:block;cursor:grab;min-width:0}.fk-mold.sc-fk-brick-mold-item{display:flex;align-items:center;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 1.5);background:var(--fk-color-surface);font-size:0.8rem;transition:border-color 120ms ease, box-shadow 120ms ease}.fk-mold.sc-fk-brick-mold-item:hover{border-color:var(--fk-color-primary);box-shadow:0 1px 4px var(--fk-color-shadow)}.fk-mold--dragging.sc-fk-brick-mold-item{opacity:0.5}.fk-mold__name.sc-fk-brick-mold-item{font-weight:500;color:var(--fk-color-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}"}},[2,"fk-brick-mold-item",{brickMold:[16],isDragging:[32]}]);function c(){"undefined"!=typeof customElements&&["fk-brick-mold-item"].forEach((r=>{"fk-brick-mold-item"===r&&(customElements.get(o(r))||customElements.define(o(r),a))}))}c();export{a as F,c as d}
1
+ import{t as o,p as r,H as i,h as e}from"./p-BrOXMyOG.js";import{d as t}from"./p-92BozD8S.js";import{f as s}from"./p-D7bf2ztq.js";const a=r(class extends i{constructor(o){super(),!1!==o&&this.__registerHost(),this.isDragging=!1}componentDidLoad(){this.cleanup=t({element:this.host,getInitialData:()=>({kind:"new-brick",moldType:this.brickMold.type,moldId:this.brickMold.id}),onDragStart:()=>this.isDragging=!0,onDrop:()=>this.isDragging=!1})}disconnectedCallback(){var o;null===(o=this.cleanup)||void 0===o||o.call(this)}render(){return e("div",{key:"0570015fb47b6be613f900a333b061537006edec",class:{"fk-mold":!0,"fk-mold--dragging":this.isDragging},title:s(`brick.${this.brickMold.id}.name`,this.brickMold.name)},e("span",{key:"bf3ab329f7a4b054c56e042dd83822706546c93b",class:"fk-mold__name"},s(`brick.${this.brickMold.id}.name`,this.brickMold.name)))}get host(){return this}static get style(){return".sc-fk-brick-mold-item-h{display:block;cursor:grab;min-width:0}.fk-mold.sc-fk-brick-mold-item{display:flex;align-items:center;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 1.5);background:var(--fk-color-surface);font-size:0.8rem;transition:border-color 120ms ease, box-shadow 120ms ease}.fk-mold.sc-fk-brick-mold-item:hover{border-color:var(--fk-color-primary);box-shadow:0 1px 4px var(--fk-color-shadow)}.fk-mold--dragging.sc-fk-brick-mold-item{opacity:0.5}.fk-mold__name.sc-fk-brick-mold-item{font-weight:500;color:var(--fk-color-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}"}},[2,"fk-brick-mold-item",{brickMold:[16],isDragging:[32]}]);function c(){"undefined"!=typeof customElements&&["fk-brick-mold-item"].forEach((r=>{"fk-brick-mold-item"===r&&(customElements.get(o(r))||customElements.define(o(r),a))}))}c();export{a as F,c as d}