@streamline-pulse/formkrafter-wc 0.30.0 → 0.31.1
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/dist/components/fk-address-search.js +1 -1
- 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-render.js +1 -1
- package/dist/components/fk-data-grid.js +1 -1
- package/dist/components/fk-document-reader.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-form-review.js +1 -1
- package/dist/components/fk-geo-map.js +1 -1
- package/dist/components/fk-key-value.d.ts +11 -0
- package/dist/components/fk-key-value.js +1 -0
- 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-slot-picker.js +1 -1
- package/dist/components/fk-stepper.js +1 -1
- package/dist/components/fk-tabs.js +1 -1
- package/dist/components/fk-variable-picker.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-CuWGcxtN.js → p--TMHeyce.js} +1 -1
- package/dist/components/{p-Cys4PksI.js → p-2jLHed2t.js} +1 -1
- package/dist/components/{p-BO5VWpZE.js → p-BVvd-s8C.js} +1 -1
- package/dist/components/{p-D6W-SOWV.js → p-Bgt1miav.js} +1 -1
- package/dist/components/{p-BuoiPCr-.js → p-C4kasL4W.js} +1 -1
- package/dist/components/{p-DPidm5sJ.js → p-CSyRbKNl.js} +1 -1
- package/dist/components/{p-BlgDQ0t7.js → p-Cf7R_DSc.js} +1 -1
- package/dist/{formkrafter-wc/p-FupO-_0D.js → components/p-ClM6Z5Ke.js} +1 -1
- package/dist/components/p-D-_2yA8K.js +1 -0
- package/dist/components/p-DG0bp7t3.js +1 -0
- package/dist/components/{p-BFnqPIpW.js → p-DTmNlqIU.js} +1 -1
- package/dist/components/p-DccQ_h8S.js +1 -0
- package/dist/components/{p-BYCjTLjB.js → p-DoGKSvuu.js} +1 -1
- package/dist/components/{p-BJuHN3Uu.js → p-DsaDkXrC.js} +1 -1
- package/dist/components/{p-DGCzE6o_.js → p-Duq1YlG7.js} +1 -1
- package/dist/components/{p-DMwau-fb.js → p-Jnu12uj1.js} +1 -1
- package/dist/components/{p-DdGjQ53Y.js → p-KZap8cm6.js} +5 -5
- package/dist/components/{p-BSdc_x3o.js → p-SppGy4eh.js} +1 -1
- package/dist/components/{p-BUgHGozZ.js → p-Vjwmh2k1.js} +1 -1
- package/dist/components/p-fmPZmfxd.js +1 -0
- package/dist/components/{p-DPz8CWwm.js → p-mmTN95UP.js} +1 -1
- package/dist/components/{p-D_BgQRLv.js → p-uj744QI6.js} +1 -1
- 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-28f6d8b7.entry.js +1 -0
- package/dist/formkrafter-wc/{p-996cdc3f.entry.js → p-33735eab.entry.js} +1 -1
- package/dist/formkrafter-wc/p-97e2c3a7.entry.js +1 -0
- package/dist/{components/p-66Xzy1Vh.js → formkrafter-wc/p-CBfkGjx3.js} +1 -1
- package/dist/formkrafter-wc/{p-Dozlw09a.js → p-CMuc9GII.js} +5 -5
- package/dist/types/components/fk-data-grid/fk-data-grid.d.ts +3 -0
- package/dist/types/components/fk-key-value/fk-key-value.d.ts +29 -0
- package/dist/types/components.d.ts +89 -0
- package/dist/types/registry/default-bricks.d.ts +18 -0
- package/package.json +2 -2
- package/dist/components/p-BRITIZrd.js +0 -1
- package/dist/components/p-BY2wuPHY.js +0 -1
- package/dist/components/p-bOrdd5ri.js +0 -1
- package/dist/formkrafter-wc/p-3a516b41.entry.js +0 -1
- package/dist/formkrafter-wc/p-96c82d88.entry.js +0 -1
|
@@ -14,6 +14,8 @@ export declare class FkDataGrid {
|
|
|
14
14
|
notes?: FieldAnnotations;
|
|
15
15
|
reviewable: boolean;
|
|
16
16
|
editableKeys?: string[];
|
|
17
|
+
/** Data map of the enclosing form: its `_`-prefixed context (variables, API base…) reaches the cells. */
|
|
18
|
+
dataMap?: Record<string, unknown>;
|
|
17
19
|
gridValueChange: EventEmitter<Array<Record<string, unknown>> | undefined>;
|
|
18
20
|
brickReviewChange: EventEmitter<BrickReviewChangeDetail>;
|
|
19
21
|
private gridKey;
|
|
@@ -32,5 +34,6 @@ export declare class FkDataGrid {
|
|
|
32
34
|
private addRow;
|
|
33
35
|
private moveRow;
|
|
34
36
|
private removeRow;
|
|
37
|
+
private contextMap;
|
|
35
38
|
render(): any;
|
|
36
39
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
type Row = {
|
|
3
|
+
key: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A flat object edited row by row (key, value). Rows with an empty key stay
|
|
8
|
+
* local until named; values accept template variables through the picker.
|
|
9
|
+
*/
|
|
10
|
+
export declare class FkKeyValue {
|
|
11
|
+
value?: Record<string, unknown>;
|
|
12
|
+
keyLabel?: string;
|
|
13
|
+
valueLabel?: string;
|
|
14
|
+
variables: {
|
|
15
|
+
name: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
}[];
|
|
18
|
+
disabled: boolean;
|
|
19
|
+
readOnly: boolean;
|
|
20
|
+
keyValueChange: EventEmitter<Record<string, string> | undefined>;
|
|
21
|
+
rows: Row[];
|
|
22
|
+
componentWillLoad(): void;
|
|
23
|
+
onValueChange(next: unknown): void;
|
|
24
|
+
private get locked();
|
|
25
|
+
private commit;
|
|
26
|
+
private update;
|
|
27
|
+
render(): any;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -122,6 +122,10 @@ export namespace Components {
|
|
|
122
122
|
* Review maps keyed `grid[index].field`, scoped to each row.
|
|
123
123
|
*/
|
|
124
124
|
"annotations"?: FieldAnnotations;
|
|
125
|
+
/**
|
|
126
|
+
* Data map of the enclosing form: its `_`-prefixed context (variables, API base…) reaches the cells.
|
|
127
|
+
*/
|
|
128
|
+
"dataMap"?: Record<string, unknown>;
|
|
125
129
|
/**
|
|
126
130
|
* @default false
|
|
127
131
|
*/
|
|
@@ -346,6 +350,27 @@ export namespace Components {
|
|
|
346
350
|
*/
|
|
347
351
|
"zoom": number;
|
|
348
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* A flat object edited row by row (key, value). Rows with an empty key stay
|
|
355
|
+
* local until named; values accept template variables through the picker.
|
|
356
|
+
*/
|
|
357
|
+
interface FkKeyValue {
|
|
358
|
+
/**
|
|
359
|
+
* @default false
|
|
360
|
+
*/
|
|
361
|
+
"disabled": boolean;
|
|
362
|
+
"keyLabel"?: string;
|
|
363
|
+
/**
|
|
364
|
+
* @default false
|
|
365
|
+
*/
|
|
366
|
+
"readOnly": boolean;
|
|
367
|
+
"value"?: Record<string, unknown>;
|
|
368
|
+
"valueLabel"?: string;
|
|
369
|
+
/**
|
|
370
|
+
* @default []
|
|
371
|
+
*/
|
|
372
|
+
"variables": { name: string; label?: string }[];
|
|
373
|
+
}
|
|
349
374
|
interface FkPropertyPanel {
|
|
350
375
|
"brick": BrickSpec;
|
|
351
376
|
"editLocale"?: string;
|
|
@@ -507,6 +532,10 @@ export interface FkGeoMapCustomEvent<T> extends CustomEvent<T> {
|
|
|
507
532
|
detail: T;
|
|
508
533
|
target: HTMLFkGeoMapElement;
|
|
509
534
|
}
|
|
535
|
+
export interface FkKeyValueCustomEvent<T> extends CustomEvent<T> {
|
|
536
|
+
detail: T;
|
|
537
|
+
target: HTMLFkKeyValueElement;
|
|
538
|
+
}
|
|
510
539
|
export interface FkPropertyPanelCustomEvent<T> extends CustomEvent<T> {
|
|
511
540
|
detail: T;
|
|
512
541
|
target: HTMLFkPropertyPanelElement;
|
|
@@ -804,6 +833,27 @@ declare global {
|
|
|
804
833
|
prototype: HTMLFkGeoMapElement;
|
|
805
834
|
new (): HTMLFkGeoMapElement;
|
|
806
835
|
};
|
|
836
|
+
interface HTMLFkKeyValueElementEventMap {
|
|
837
|
+
"keyValueChange": Record<string, string> | undefined;
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* A flat object edited row by row (key, value). Rows with an empty key stay
|
|
841
|
+
* local until named; values accept template variables through the picker.
|
|
842
|
+
*/
|
|
843
|
+
interface HTMLFkKeyValueElement extends Components.FkKeyValue, HTMLStencilElement {
|
|
844
|
+
addEventListener<K extends keyof HTMLFkKeyValueElementEventMap>(type: K, listener: (this: HTMLFkKeyValueElement, ev: FkKeyValueCustomEvent<HTMLFkKeyValueElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
845
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
846
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
847
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
848
|
+
removeEventListener<K extends keyof HTMLFkKeyValueElementEventMap>(type: K, listener: (this: HTMLFkKeyValueElement, ev: FkKeyValueCustomEvent<HTMLFkKeyValueElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
849
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
850
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
851
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
852
|
+
}
|
|
853
|
+
var HTMLFkKeyValueElement: {
|
|
854
|
+
prototype: HTMLFkKeyValueElement;
|
|
855
|
+
new (): HTMLFkKeyValueElement;
|
|
856
|
+
};
|
|
807
857
|
interface HTMLFkPropertyPanelElementEventMap {
|
|
808
858
|
"brickConfigsChange": BrickConfigsChangeDetail;
|
|
809
859
|
"brickValidationsChange": BrickValidationsChangeDetail;
|
|
@@ -972,6 +1022,7 @@ declare global {
|
|
|
972
1022
|
"fk-form-render": HTMLFkFormRenderElement;
|
|
973
1023
|
"fk-form-review": HTMLFkFormReviewElement;
|
|
974
1024
|
"fk-geo-map": HTMLFkGeoMapElement;
|
|
1025
|
+
"fk-key-value": HTMLFkKeyValueElement;
|
|
975
1026
|
"fk-property-panel": HTMLFkPropertyPanelElement;
|
|
976
1027
|
"fk-rules-editor": HTMLFkRulesEditorElement;
|
|
977
1028
|
"fk-select-input": HTMLFkSelectInputElement;
|
|
@@ -1101,6 +1152,10 @@ declare namespace LocalJSX {
|
|
|
1101
1152
|
* Review maps keyed `grid[index].field`, scoped to each row.
|
|
1102
1153
|
*/
|
|
1103
1154
|
"annotations"?: FieldAnnotations;
|
|
1155
|
+
/**
|
|
1156
|
+
* Data map of the enclosing form: its `_`-prefixed context (variables, API base…) reaches the cells.
|
|
1157
|
+
*/
|
|
1158
|
+
"dataMap"?: Record<string, unknown>;
|
|
1104
1159
|
/**
|
|
1105
1160
|
* @default false
|
|
1106
1161
|
*/
|
|
@@ -1345,6 +1400,28 @@ declare namespace LocalJSX {
|
|
|
1345
1400
|
*/
|
|
1346
1401
|
"zoom"?: number;
|
|
1347
1402
|
}
|
|
1403
|
+
/**
|
|
1404
|
+
* A flat object edited row by row (key, value). Rows with an empty key stay
|
|
1405
|
+
* local until named; values accept template variables through the picker.
|
|
1406
|
+
*/
|
|
1407
|
+
interface FkKeyValue {
|
|
1408
|
+
/**
|
|
1409
|
+
* @default false
|
|
1410
|
+
*/
|
|
1411
|
+
"disabled"?: boolean;
|
|
1412
|
+
"keyLabel"?: string;
|
|
1413
|
+
"onKeyValueChange"?: (event: FkKeyValueCustomEvent<Record<string, string> | undefined>) => void;
|
|
1414
|
+
/**
|
|
1415
|
+
* @default false
|
|
1416
|
+
*/
|
|
1417
|
+
"readOnly"?: boolean;
|
|
1418
|
+
"value"?: Record<string, unknown>;
|
|
1419
|
+
"valueLabel"?: string;
|
|
1420
|
+
/**
|
|
1421
|
+
* @default []
|
|
1422
|
+
*/
|
|
1423
|
+
"variables"?: { name: string; label?: string }[];
|
|
1424
|
+
}
|
|
1348
1425
|
interface FkPropertyPanel {
|
|
1349
1426
|
"brick": BrickSpec;
|
|
1350
1427
|
"editLocale"?: string;
|
|
@@ -1554,6 +1631,12 @@ declare namespace LocalJSX {
|
|
|
1554
1631
|
"layerNameProperty": string;
|
|
1555
1632
|
"multiple": boolean;
|
|
1556
1633
|
}
|
|
1634
|
+
interface FkKeyValueAttributes {
|
|
1635
|
+
"keyLabel": string;
|
|
1636
|
+
"valueLabel": string;
|
|
1637
|
+
"disabled": boolean;
|
|
1638
|
+
"readOnly": boolean;
|
|
1639
|
+
}
|
|
1557
1640
|
interface FkPropertyPanelAttributes {
|
|
1558
1641
|
"path": string;
|
|
1559
1642
|
"locale": string;
|
|
@@ -1606,6 +1689,7 @@ declare namespace LocalJSX {
|
|
|
1606
1689
|
"fk-form-render": Omit<FkFormRender, keyof FkFormRenderAttributes> & { [K in keyof FkFormRender & keyof FkFormRenderAttributes]?: FkFormRender[K] } & { [K in keyof FkFormRender & keyof FkFormRenderAttributes as `attr:${K}`]?: FkFormRenderAttributes[K] } & { [K in keyof FkFormRender & keyof FkFormRenderAttributes as `prop:${K}`]?: FkFormRender[K] };
|
|
1607
1690
|
"fk-form-review": Omit<FkFormReview, keyof FkFormReviewAttributes> & { [K in keyof FkFormReview & keyof FkFormReviewAttributes]?: FkFormReview[K] } & { [K in keyof FkFormReview & keyof FkFormReviewAttributes as `attr:${K}`]?: FkFormReviewAttributes[K] } & { [K in keyof FkFormReview & keyof FkFormReviewAttributes as `prop:${K}`]?: FkFormReview[K] };
|
|
1608
1691
|
"fk-geo-map": Omit<FkGeoMap, keyof FkGeoMapAttributes> & { [K in keyof FkGeoMap & keyof FkGeoMapAttributes]?: FkGeoMap[K] } & { [K in keyof FkGeoMap & keyof FkGeoMapAttributes as `attr:${K}`]?: FkGeoMapAttributes[K] } & { [K in keyof FkGeoMap & keyof FkGeoMapAttributes as `prop:${K}`]?: FkGeoMap[K] };
|
|
1692
|
+
"fk-key-value": Omit<FkKeyValue, keyof FkKeyValueAttributes> & { [K in keyof FkKeyValue & keyof FkKeyValueAttributes]?: FkKeyValue[K] } & { [K in keyof FkKeyValue & keyof FkKeyValueAttributes as `attr:${K}`]?: FkKeyValueAttributes[K] } & { [K in keyof FkKeyValue & keyof FkKeyValueAttributes as `prop:${K}`]?: FkKeyValue[K] };
|
|
1609
1693
|
"fk-property-panel": Omit<FkPropertyPanel, keyof FkPropertyPanelAttributes> & { [K in keyof FkPropertyPanel & keyof FkPropertyPanelAttributes]?: FkPropertyPanel[K] } & { [K in keyof FkPropertyPanel & keyof FkPropertyPanelAttributes as `attr:${K}`]?: FkPropertyPanelAttributes[K] } & { [K in keyof FkPropertyPanel & keyof FkPropertyPanelAttributes as `prop:${K}`]?: FkPropertyPanel[K] };
|
|
1610
1694
|
"fk-rules-editor": Omit<FkRulesEditor, keyof FkRulesEditorAttributes> & { [K in keyof FkRulesEditor & keyof FkRulesEditorAttributes]?: FkRulesEditor[K] } & { [K in keyof FkRulesEditor & keyof FkRulesEditorAttributes as `attr:${K}`]?: FkRulesEditorAttributes[K] } & { [K in keyof FkRulesEditor & keyof FkRulesEditorAttributes as `prop:${K}`]?: FkRulesEditor[K] };
|
|
1611
1695
|
"fk-select-input": Omit<FkSelectInput, keyof FkSelectInputAttributes> & { [K in keyof FkSelectInput & keyof FkSelectInputAttributes]?: FkSelectInput[K] } & { [K in keyof FkSelectInput & keyof FkSelectInputAttributes as `attr:${K}`]?: FkSelectInputAttributes[K] } & { [K in keyof FkSelectInput & keyof FkSelectInputAttributes as `prop:${K}`]?: FkSelectInput[K] };
|
|
@@ -1658,6 +1742,11 @@ declare module "@stencil/core" {
|
|
|
1658
1742
|
* longitude inputs, so the field works when tiles cannot load.
|
|
1659
1743
|
*/
|
|
1660
1744
|
"fk-geo-map": LocalJSX.IntrinsicElements["fk-geo-map"] & JSXBase.HTMLAttributes<HTMLFkGeoMapElement>;
|
|
1745
|
+
/**
|
|
1746
|
+
* A flat object edited row by row (key, value). Rows with an empty key stay
|
|
1747
|
+
* local until named; values accept template variables through the picker.
|
|
1748
|
+
*/
|
|
1749
|
+
"fk-key-value": LocalJSX.IntrinsicElements["fk-key-value"] & JSXBase.HTMLAttributes<HTMLFkKeyValueElement>;
|
|
1661
1750
|
"fk-property-panel": LocalJSX.IntrinsicElements["fk-property-panel"] & JSXBase.HTMLAttributes<HTMLFkPropertyPanelElement>;
|
|
1662
1751
|
"fk-rules-editor": LocalJSX.IntrinsicElements["fk-rules-editor"] & JSXBase.HTMLAttributes<HTMLFkRulesEditorElement>;
|
|
1663
1752
|
"fk-select-input": LocalJSX.IntrinsicElements["fk-select-input"] & JSXBase.HTMLAttributes<HTMLFkSelectInputElement>;
|
|
@@ -631,6 +631,24 @@ export declare const dataGridBrick: {
|
|
|
631
631
|
readonly defaultConfigs?: Record<string, unknown>;
|
|
632
632
|
getBrickEmptySpec(): BrickSpec;
|
|
633
633
|
};
|
|
634
|
+
export declare const keyValueBrick: {
|
|
635
|
+
render(props: WcBrickProps): VNode;
|
|
636
|
+
renderBuilder(props: WcBrickProps): VNode;
|
|
637
|
+
getComponent(props: WcBrickProps): VNode;
|
|
638
|
+
getComponentWithActions(props: WcBrickProps): VNode;
|
|
639
|
+
readonly type: import("@streamline-pulse/formkrafter-core").BrickType;
|
|
640
|
+
readonly dataType: import("@streamline-pulse/formkrafter-core").JSONSchemaType;
|
|
641
|
+
readonly id: string;
|
|
642
|
+
readonly name: string;
|
|
643
|
+
readonly configsForm?: BrickSpec;
|
|
644
|
+
readonly category?: string;
|
|
645
|
+
readonly styles?: Record<string, unknown>;
|
|
646
|
+
readonly unWrapData: boolean;
|
|
647
|
+
readonly isPrivate: boolean;
|
|
648
|
+
readonly validators: import("@streamline-pulse/formkrafter-core").Validator[];
|
|
649
|
+
readonly defaultConfigs?: Record<string, unknown>;
|
|
650
|
+
getBrickEmptySpec(): BrickSpec;
|
|
651
|
+
};
|
|
634
652
|
export declare const hiddenBrick: {
|
|
635
653
|
render(props: WcBrickProps): VNode;
|
|
636
654
|
renderBuilder(props: WcBrickProps): VNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamline-pulse/formkrafter-wc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "FormKrafter web components (Stencil)",
|
|
6
6
|
"main": "dist/components/index.js",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@codemirror/state": "^6.7.1",
|
|
63
63
|
"@codemirror/theme-one-dark": "^6.1.3",
|
|
64
64
|
"@codemirror/view": "^6.43.6",
|
|
65
|
-
"@streamline-pulse/formkrafter-core": "0.
|
|
65
|
+
"@streamline-pulse/formkrafter-core": "0.31.1",
|
|
66
66
|
"leaflet": "1.9.4"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as r,p as i,H as t,c as o,h as s}from"./p-8ICOcloT.js";import{v as e,b as a,f as d}from"./p-DdGjQ53Y.js";import{d as n}from"./p-D6W-SOWV.js";import{d as c}from"./p-CIgvEKbO.js";import{d as l}from"./p-D_BgQRLv.js";import{d as f}from"./p-CuWGcxtN.js";const h=i(class extends t{constructor(r){super(),!1!==r&&this.__registerHost(),this.gridValueChange=o(this,"gridValueChange"),this.brickReviewChange=o(this,"brickReviewChange"),this.disabled=!1,this.readOnly=!1,this.reviewable=!1,this.touched={},this.addRow=r=>{r.preventDefault(),this.gridValueChange.emit([...this.rows(),{}])}}gridKey(){var r,i;return null!==(i=null===(r=this.spec.configs)||void 0===r?void 0:r.key)&&void 0!==i?i:"grid"}rowScoped(r,i){if(!r)return;const t=`${this.gridKey()}[${i}].`,o={};for(const[i,s]of Object.entries(r))i.startsWith(t)&&(o[i.slice(t.length)]=s);return o}rowEditableKeys(r){if(void 0===this.editableKeys||this.editableKeys.includes(this.gridKey()))return;const i=`${this.gridKey()}[${r}].`;return this.editableKeys.filter((r=>r.startsWith(i))).map((r=>r.slice(i.length)))}rowsLocked(){return void 0!==this.editableKeys&&!this.editableKeys.includes(this.gridKey())}handleRowReviewChange(r){if(r.target===this.host)return;r.stopPropagation();const i=r.target.closest("[data-grid-row]"),t=null==i?void 0:i.getAttribute("data-grid-row");null!=t&&this.brickReviewChange.emit({key:`${this.gridKey()}[${t}].${r.detail.key}`,annotation:r.detail.annotation})}rows(){return Array.isArray(this.value)?this.value:[]}rowSpec(){var r,i;return(null===(r=this.rowSpecCache)||void 0===r?void 0:r.source)!==this.spec&&(this.rowSpecCache={source:this.spec,rowSpec:{type:"panel",id:"grid-row",name:"Row",configs:{key:"row"},children:null!==(i=this.spec.children)&&void 0!==i?i:[]}}),this.rowSpecCache.rowSpec}rowErrors(r){const i=Object.fromEntries(Object.entries(r).filter((([,r])=>""!==r&&null!=r)));return e(this.rowSpec(),i,this.locale).errors}visibleRowErrors(r){var i,t;const o=null!==(i=this.rows()[r])&&void 0!==i?i:{},s=null!==(t=this.touched[r])&&void 0!==t?t:{},e={};for(const[r,i]of Object.entries(this.rowErrors(o)))s[r]&&(e[r]=i);return e}handleRowChange(r){var i,t;r.stopPropagation();const o=r.target.closest("[data-grid-row]"),s=Number(null!==(i=null==o?void 0:o.getAttribute("data-grid-row"))&&void 0!==i?i:-1);if(s<0)return;const e=Object.assign({},null!==(t=this.touched[s])&&void 0!==t?t:{});for(const i of Object.keys(r.detail))e[i]=!0;this.touched=Object.assign(Object.assign({},this.touched),{[s]:e});const a=this.rows().map(((i,t)=>t===s?Object.assign(Object.assign({},i),r.detail):i));this.gridValueChange.emit(a)}async validateRows(){var r,i;const t=this.rows(),o=null!==(i=null===(r=this.spec.configs)||void 0===r?void 0:r.key)&&void 0!==i?i:"grid",s={},e={};return t.forEach(((r,i)=>{var t,a;const d={};for(const r of null!==(t=this.spec.children)&&void 0!==t?t:[])(null===(a=r.configs)||void 0===a?void 0:a.key)&&(d[r.configs.key]=!0);s[i]=d;for(const[t,s]of Object.entries(this.rowErrors(r)))e[`${o}[${i}].${t}`]=s})),this.touched=s,{valid:0===Object.keys(e).length,errors:e}}moveRow(r,i){const t=[...this.rows()],o=r+i;if(o<0||o>=t.length)return;const[s]=t.splice(r,1);t.splice(o,0,s);const e=Object.assign({},this.touched),a=e[r];e[r]=e[o],e[o]=a,this.touched=e,this.gridValueChange.emit(t)}removeRow(r){const i=this.rows().filter(((i,t)=>t!==r)),t={};for(const[i,o]of Object.entries(this.touched)){const s=Number(i);s<r?t[s]=o:s>r&&(t[s-1]=o)}this.touched=t,this.gridValueChange.emit(i.length?i:void 0)}render(){var r;const i=null!==(r=this.spec.children)&&void 0!==r?r:[],t=this.rows();return s("div",{key:"a1dc359954c394b6385538de0b9d42ec6eda2d58",class:"fk-grid"},0===t.length?s("p",{class:"fk-grid__empty"},a("grid.empty")):null,t.map(((r,o)=>s("div",{class:"fk-grid__row","data-grid-row":o,key:o},s("div",{class:"fk-grid__cells"},i.map(((i,t)=>s("fk-brick-render",{brickSpec:i,data:r,dataMap:r,errors:this.visibleRowErrors(o),annotations:this.rowScoped(this.annotations,o),notes:this.rowScoped(this.notes,o),reviewable:this.reviewable,editableKeys:this.rowEditableKeys(o),locale:this.locale,readOnly:this.readOnly,disabled:this.disabled&&!this.readOnly,path:`grid.${o}.${t}`,utils:this.utils})))),s("div",{class:"fk-grid__row-actions"},s("button",{type:"button",class:"fk-grid__move",title:d("grid.moveUp","Move row up"),"aria-label":d("grid.moveUp","Move row up"),disabled:this.disabled||this.rowsLocked()||0===o,onClick:r=>{r.preventDefault(),this.moveRow(o,-1)}},"↑"),s("button",{type:"button",class:"fk-grid__move",title:d("grid.moveDown","Move row down"),"aria-label":d("grid.moveDown","Move row down"),disabled:this.disabled||this.rowsLocked()||o===t.length-1,onClick:r=>{r.preventDefault(),this.moveRow(o,1)}},"↓"),s("button",{type:"button",class:"fk-grid__remove",title:a("grid.removeRow"),"aria-label":a("grid.removeRow"),disabled:this.disabled||this.rowsLocked(),onClick:r=>{r.preventDefault(),this.removeRow(o)}},"✕"))))),s("button",{key:"0e42a9e1b8e05f92677f8d25c107a26518b104bb",type:"button",class:"fk-grid__add",disabled:this.disabled||this.rowsLocked(),onClick:this.addRow},a("grid.addRow")))}get host(){return this}static get style(){return".sc-fk-data-grid-h{display:block}.fk-grid.sc-fk-data-grid{display:flex;flex-direction:column;gap:var(--fk-spacing)}.fk-grid__empty.sc-fk-data-grid{margin:0;padding:var(--fk-spacing);border:1px dashed var(--fk-color-border);border-radius:var(--fk-radius);font-size:0.85rem;color:var(--fk-color-muted);text-align:center}.fk-grid__row.sc-fk-data-grid{display:flex;align-items:flex-start;gap:var(--fk-spacing);padding:var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:color-mix(in srgb, var(--fk-color-surface) 60%, transparent)}.fk-grid__cells.sc-fk-data-grid{display:flex;flex:1;flex-wrap:wrap;gap:var(--fk-spacing);min-width:0}.fk-grid__cells.sc-fk-data-grid>*.sc-fk-data-grid{flex:1;min-width:160px}.fk-grid__remove.sc-fk-data-grid{border:none;background:transparent;color:var(--fk-color-muted);font-size:0.8rem;cursor:pointer;padding:4px 6px;min-width:24px;min-height:24px;border-radius:calc(var(--fk-radius) / 2)}.fk-grid__remove.sc-fk-data-grid:hover:not(:disabled){color:var(--fk-color-danger);background:color-mix(in srgb, var(--fk-color-danger) 10%, transparent)}.fk-grid__add.sc-fk-data-grid{align-self:flex-start;font:inherit;font-size:0.8rem;font-weight:600;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);border:1px dashed var(--fk-color-border);border-radius:var(--fk-radius);background:transparent;color:var(--fk-color-muted);cursor:pointer}.fk-grid__add.sc-fk-data-grid:hover:not(:disabled){border-color:var(--fk-color-primary);color:var(--fk-color-primary)}.fk-grid__row-actions.sc-fk-data-grid{display:flex;flex-direction:column;gap:2px;flex-shrink:0}.fk-grid__move.sc-fk-data-grid{border:none;background:transparent;color:var(--fk-color-muted);font-size:0.8rem;cursor:pointer;padding:2px 6px;min-width:24px;min-height:24px;border-radius:calc(var(--fk-radius) / 2)}.fk-grid__move.sc-fk-data-grid:hover:not(:disabled){color:var(--fk-color-primary);background:color-mix(in srgb, var(--fk-color-primary) 10%, transparent)}.fk-grid__move.sc-fk-data-grid:disabled{opacity:0.3;cursor:default}.fk-grid__move.sc-fk-data-grid:focus-visible,.fk-grid__remove.sc-fk-data-grid:focus-visible{outline:2px solid color-mix(in srgb, var(--fk-color-primary) 55%, transparent);outline-offset:1px}"}},[2,"fk-data-grid",{spec:[16],value:[16],disabled:[4],readOnly:[4,"read-only"],locale:[1],utils:[16],annotations:[16],notes:[16],reviewable:[4],editableKeys:[16],touched:[32],validateRows:[64]},[[0,"brickReviewChange","handleRowReviewChange"],[0,"brickDataChange","handleRowChange"]]]);function k(){"undefined"!=typeof customElements&&["fk-data-grid","fk-brick-actions","fk-brick-not-found","fk-brick-render","fk-drop-area"].forEach((i=>{switch(i){case"fk-data-grid":customElements.get(r(i))||customElements.define(r(i),h);break;case"fk-brick-actions":customElements.get(r(i))||n();break;case"fk-brick-not-found":customElements.get(r(i))||c();break;case"fk-brick-render":customElements.get(r(i))||l();break;case"fk-drop-area":customElements.get(r(i))||f()}}))}k();export{h as F,k as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e,p as t,H as s,c as a,h as l}from"./p-8ICOcloT.js";import{b as r,j as i,f as o}from"./p-DdGjQ53Y.js";import{d as n}from"./p-BE5v8BN3.js";import{d as p}from"./p-BSdc_x3o.js";const c=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.brickConfigsChange=a(this,"brickConfigsChange"),this.brickValidationsChange=a(this,"brickValidationsChange"),this.brickStylesChange=a(this,"brickStylesChange"),this.fields=[],this.locales=[],this.activeTab="config",this.newStyleKey=""}onBrickChange(){this.availableTabs().some((e=>e.id===this.activeTab))||(this.activeTab="config")}availableTabs(){const e=[{id:"config",label:r("panel.tab.config")}];return"input"===this.brick.type&&e.push({id:"validation",label:r("panel.tab.validation")}),e.push({id:"styles",label:r("panel.tab.styles")},{id:"rules",label:r("panel.tab.rules")}),e}localized(e,t){var s;if(this.locales.length<=1)return t||void 0;const a=i(e)?Object.assign({},e):{};return"string"==typeof e&&e&&!i(e)&&(a[this.locales[0]]=e),a[null!==(s=this.editLocale)&&void 0!==s?s:this.locales[0]]=t,a}readLocalized(e){var t,s,a;return i(e)?null!==(s=e[null!==(t=this.editLocale)&&void 0!==t?t:this.locales[0]])&&void 0!==s?s:"":null!==(a=e)&&void 0!==a?a:""}writeTextConfig(e,t){var s;this.emitConfigs({[e]:this.localized(null===(s=this.brick.configs)||void 0===s?void 0:s[e],t)})}emitConfigs(e){this.path&&this.brickConfigsChange.emit({configs:e,path:this.path})}emitValidations(e){this.path&&this.brickValidationsChange.emit({validations:e,path:this.path})}emitStyles(e){this.path&&this.brickStylesChange.emit({styles:e,path:this.path})}validationOf(e){var t;return null===(t=this.brick.validations)||void 0===t?void 0:t.find((t=>t.validator===e))}setValidation(e,t,s={}){var a;const l=this.validationOf(e),r=(null!==(a=this.brick.validations)&&void 0!==a?a:[]).filter((t=>t.validator!==e));this.emitValidations(t?[...r,Object.assign(Object.assign(Object.assign({},l),{validator:e}),s)]:r)}addStyle(e){const t=this.newStyleKey.trim();t&&(this.emitStyles({[t]:e}),this.newStyleKey="")}textField(e,t,s){var a;return l("label",{class:"fk-props__field"},l("span",{class:"fk-props__label"},e),l("input",{class:"fk-props__input",type:"text",value:null!==(a=t)&&void 0!==a?a:"",onChange:e=>s(e.target.value)}))}optionsFields(){var e,t,s;const a=this.brick.configs;if(!a||!("options"in a)&&!("optionsSource"in a))return[];const i="optionsSource"in a,o=i&&null!==(e=a.optionsSource)&&void 0!==e?e:"static",n=i?[l("label",{class:"fk-props__field"},l("span",{class:"fk-props__label"},r("panel.optionsSource")),l("select",{class:"fk-props__input",onChange:e=>this.emitConfigs({optionsSource:e.target.value})},["static","dataMap","remote","js","catalog"].map((e=>l("option",{value:e,selected:e===o},e)))))]:[];return"static"===o&&n.push(l("label",{class:"fk-props__field"},l("span",{class:"fk-props__label"},r("panel.options")),l("textarea",{class:"fk-props__input fk-props__input--textarea",onChange:e=>this.writeTextConfig("options",e.target.value)},this.readLocalized(a.options)))),"dataMap"===o&&n.push(this.textField(r("panel.dataKey"),a.optionsPath,(e=>this.emitConfigs({optionsPath:e})))),"remote"===o&&n.push(this.textField(r("panel.url"),a.optionsUrl,(e=>this.emitConfigs({optionsUrl:e}))),this.textField(r("panel.responsePath"),a.optionsPath,(e=>this.emitConfigs({optionsPath:e||void 0}))),l("label",{class:"fk-props__field"},l("span",{class:"fk-props__label"},r("panel.headers")),l("textarea",{class:"fk-props__input fk-props__input--textarea",placeholder:"Authorization: Bearer {token}",onChange:e=>this.emitConfigs({optionsHeaders:e.target.value||void 0})},null!==(t=a.optionsHeaders)&&void 0!==t?t:"")),this.textField(r("panel.searchParam"),a.searchParam,(e=>this.emitConfigs({searchParam:e||void 0})))),"js"===o&&n.push(l("label",{class:"fk-props__field"},l("span",{class:"fk-props__label"},"Code"),l("fk-code-editor",{completions:this.fields,value:null!==(s=a.optionsCode)&&void 0!==s?s:"",placeholder:"return dataMap.country === 'BJ' ? ['Cotonou'] : ['Paris'];",onCodeChange:e=>this.emitConfigs({optionsCode:e.detail})}))),"catalog"===o&&n.push(this.textField(r("panel.optionsRef"),a.optionsRef,(e=>this.emitConfigs({optionsRef:e})))),"remote"!==o&&"js"!==o&&"catalog"!==o||n.push(this.textField(r("panel.labelKey"),a.labelKey,(e=>this.emitConfigs({labelKey:e}))),this.textField(r("panel.valueKey"),a.valueKey,(e=>this.emitConfigs({valueKey:e})))),n}renderConfigTab(){const e=this.brick.configs,t="input"===this.brick.type;return l("section",{class:"fk-props__section"},this.textField(r("panel.key"),null==e?void 0:e.key,(e=>this.emitConfigs({key:e}))),this.textField(r("panel.label"),this.readLocalized(null==e?void 0:e.label),(e=>this.writeTextConfig("label",e))),t?[this.textField(r("panel.placeholder"),this.readLocalized(null==e?void 0:e.placeholder),(e=>this.writeTextConfig("placeholder",e))),this.textField(r("panel.prefix"),null==e?void 0:e.prefix,(e=>this.emitConfigs({prefix:e||void 0}))),this.textField(r("panel.suffix"),null==e?void 0:e.suffix,(e=>this.emitConfigs({suffix:e||void 0})))]:null,e&&"specRef"in e?this.textField(o("panel.specRef","Referenced form (specRef)"),e.specRef,(e=>this.emitConfigs({specRef:e}))):null,e&&"mask"in e?this.textField(o("panel.mask","Input mask (9=digit, a=letter, *=any)"),e.mask,(e=>this.emitConfigs({mask:e}))):null,e&&"searchUrl"in e?[this.textField(o("panel.searchUrl","Geocoding URL ({q} = query)"),e.searchUrl,(e=>this.emitConfigs({searchUrl:e}))),this.textField(o("panel.countryCodes","Country codes (bj, tg)"),e.countryCodes,(e=>this.emitConfigs({countryCodes:e})))]:null,e&&"layerUrl"in e?[this.textField(o("panel.layerUrl","Reference layer URL (GeoJSON)"),e.layerUrl,(e=>this.emitConfigs({layerUrl:e}))),this.textField(o("panel.codeProperty","Code property"),e.codeProperty,(e=>this.emitConfigs({codeProperty:e||"code"}))),this.textField(o("panel.nameProperty","Name property"),e.nameProperty,(e=>this.emitConfigs({nameProperty:e||"name"})))]:null,e&&"idFormat"in e?this.textField(o("panel.idFormat","Identifier format (fr-nir, bj-npi, digits-10…)"),e.idFormat,(e=>this.emitConfigs({idFormat:e}))):null,e&&"currencies"in e?[this.textField(o("panel.currencies","Currencies offered (XOF, EUR, USD)"),e.currencies,(e=>this.emitConfigs({currencies:e}))),this.textField(o("panel.currency","Default currency"),e.currency,(e=>this.emitConfigs({currency:e.toUpperCase()})))]:null,e&&"slotsUrl"in e?[this.textField(o("panel.slotsUrl","Slots URL (empty = opening rules)"),e.slotsUrl,(e=>this.emitConfigs({slotsUrl:e}))),this.textField(o("panel.slotDays","Open days (1 = Monday … 7 = Sunday)"),e.days,(e=>this.emitConfigs({days:e}))),this.textField(o("panel.slotFrom","Opens at"),e.from,(e=>this.emitConfigs({from:e}))),this.textField(o("panel.slotTo","Closes at"),e.to,(e=>this.emitConfigs({to:e}))),this.textField(o("panel.slotDuration","Slot length (minutes)"),e.duration,(e=>this.emitConfigs({duration:""===e?void 0:Number(e)}))),this.textField(o("panel.slotHorizon","Bookable days ahead"),e.horizonDays,(e=>this.emitConfigs({horizonDays:""===e?void 0:Number(e)}))),this.textField(o("panel.slotNotice","Notice (hours)"),e.noticeHours,(e=>this.emitConfigs({noticeHours:""===e?void 0:Number(e)}))),this.textField(o("panel.slotExclude","Closed dates (YYYY-MM-DD, comma-separated)"),e.exclude,(e=>this.emitConfigs({exclude:e})))]:null,e&&"family"in e?[this.textField(o("panel.family","Measure family (length, area, mass, volume, duration)"),e.family,(e=>this.emitConfigs({family:e}))),this.textField(o("panel.units","Units offered (ids, comma-separated; empty = all)"),e.units,(e=>this.emitConfigs({units:e}))),this.textField(o("panel.unit","Default unit"),e.unit,(e=>this.emitConfigs({unit:e})))]:null,e&&"plateFormat"in e?this.textField(o("panel.plateFormat","Plate format (fr, bj, ci, sn, generic)"),e.plateFormat,(e=>this.emitConfigs({plateFormat:e}))):null,e&&"registryFormat"in e?this.textField(o("panel.registryFormat","Registration format (ohada-rccm, fr-rcs, generic)"),e.registryFormat,(e=>this.emitConfigs({registryFormat:e}))):null,e&&"readUrl"in e?[this.textField(o("panel.readUrl","Reader URL (empty = host default)"),e.readUrl,(e=>this.emitConfigs({readUrl:e}))),l("label",{class:"fk-props__field"},l("span",{class:"fk-props__label"},o("panel.documentFields","Fields to read (key|Label per line)")),l("textarea",{class:"fk-props__input fk-props__input--textarea",onChange:e=>this.emitConfigs({fields:e.target.value})},"string"==typeof e.fields?e.fields:"")),l("label",{class:"fk-props__field"},l("span",{class:"fk-props__label"},o("panel.documentFills","Fill the form (field=formKey per line)")),l("textarea",{class:"fk-props__input fk-props__input--textarea",onChange:e=>this.emitConfigs({fills:e.target.value})},"string"==typeof e.fills?e.fills:"")),this.textField(o("panel.documentLanguage","Document language (fr, en…)"),e.language,(e=>this.emitConfigs({language:e}))),this.textField(o("panel.accept","Accepted files"),e.accept,(e=>this.emitConfigs({accept:e}))),this.textField(o("panel.uploadUrl","Upload URL"),e.uploadUrl,(e=>this.emitConfigs({uploadUrl:e})))]:null,e&&"tileUrl"in e?[this.textField(o("panel.center","Initial center (lat, lng)"),e.center,(e=>this.emitConfigs({center:e}))),this.textField(o("panel.zoom","Initial zoom"),e.zoom,(e=>this.emitConfigs({zoom:""===e?void 0:Number(e)}))),this.textField(o("panel.height","Height (px)"),e.height,(e=>this.emitConfigs({height:""===e?void 0:Number(e)}))),this.textField(o("panel.tileUrl","Tile URL"),e.tileUrl,(e=>this.emitConfigs({tileUrl:e}))),"shape"in e?this.textField(o("panel.shape","Shape (polygon or line)"),e.shape,(e=>this.emitConfigs({shape:"line"===e?"line":"polygon"}))):null]:null,e&&"accept"in e?this.textField(o("panel.accept","Accepted file types"),e.accept,(e=>this.emitConfigs({accept:e}))):null,e&&"uploadUrl"in e?this.textField(o("panel.uploadUrl","Upload URL"),e.uploadUrl,(e=>this.emitConfigs({uploadUrl:e}))):null,this.optionsFields(),Object.entries(null!=e?e:{}).filter((([,e])=>"boolean"==typeof e)).map((([e,t])=>l("label",{class:"fk-props__field fk-props__field--inline",key:e},l("input",{type:"checkbox",checked:!0===t,onChange:t=>this.emitConfigs({[e]:t.target.checked})}),l("span",{class:"fk-props__label"},o(`panel.cfg.${e}`,e))))),e&&"content"in e?l("label",{class:"fk-props__field"},l("span",{class:"fk-props__label"},r("panel.content")),l("textarea",{class:"fk-props__input fk-props__input--textarea",onChange:e=>this.writeTextConfig("content",e.target.value)},this.readLocalized(e.content))):null)}validationRow(e,t,s){const a=this.validationOf(e);return l("div",{class:"fk-props__vrule"},l("label",{class:"fk-props__field fk-props__field--inline"},l("input",{type:"checkbox",checked:!!a,onChange:t=>this.setValidation(e,t.target.checked)}),l("span",{class:"fk-props__label"},t)),a&&s?l("input",{class:"fk-props__input",type:s,placeholder:"number"===s?"value":"regex",value:null==a.value?"":String(a.value),onChange:t=>{const a=t.target.value;this.setValidation(e,!0,{value:"number"===s?""===a?void 0:Number(a):a||void 0})}}):null,a?this.textField(r("panel.errorMessage"),this.readLocalized(a.message),(t=>this.setValidation(e,!0,{message:this.localized(a.message,t)}))):null)}renderValidationTab(){var e;const t=this.brick.dataType,s=this.validationOf("custom");return l("section",{class:"fk-props__section"},this.validationRow("required",r("panel.required")),"string"===t?[this.validationRow("minLength",r("panel.minLength"),"number"),this.validationRow("maxLength",r("panel.maxLength"),"number"),this.validationRow("pattern",r("panel.pattern"),"text"),this.validationRow("email",r("panel.emailFormat")),this.validationRow("url",r("panel.urlFormat"))]:null,"number"===t?[this.validationRow("min",r("panel.min"),"number"),this.validationRow("max",r("panel.max"),"number")]:null,"array"===t?[this.validationRow("minItems",r("panel.minItems"),"number"),this.validationRow("maxItems",r("panel.maxItems"),"number")]:null,l("div",{class:"fk-props__vrule"},l("label",{class:"fk-props__field fk-props__field--inline"},l("input",{type:"checkbox",checked:!!s,onChange:e=>{var t;return this.setValidation("custom",e.target.checked,{customValidator:null!==(t=null==s?void 0:s.customValidator)&&void 0!==t?t:"return true;"})}}),l("span",{class:"fk-props__label"},r("panel.custom"))),s?l("fk-code-editor",{completions:this.fields,value:null!==(e=s.customValidator)&&void 0!==e?e:"",placeholder:'return value?.startsWith("BJ-") ? true : "Must start with BJ-";',onCodeChange:e=>this.setValidation("custom",!0,{customValidator:e.detail})}):null,s?this.textField(r("panel.fallbackMessage"),this.readLocalized(s.message),(e=>this.setValidation("custom",!0,{message:this.localized(s.message,e)}))):null))}renderStylesTab(){var e;return l("section",{class:"fk-props__section"},Object.entries(null!==(e=this.brick.styles)&&void 0!==e?e:{}).map((([e,t])=>l("div",{class:"fk-props__style-row",key:e},l("span",{class:"fk-props__style-key"},e),l("input",{class:"fk-props__input fk-props__input--grow",type:"text",value:String(null!=t?t:""),onChange:t=>this.emitStyles({[e]:t.target.value})}),l("button",{type:"button",class:"fk-props__remove",title:"Remove style",onClick:()=>this.emitStyles({[e]:void 0})},"✕")))),l("div",{class:"fk-props__style-row"},l("input",{class:"fk-props__input",type:"text",placeholder:r("panel.styleProperty"),value:this.newStyleKey,onInput:e=>this.newStyleKey=e.target.value}),l("input",{class:"fk-props__input fk-props__input--grow",type:"text",placeholder:r("panel.styleValue"),onChange:e=>{const t=e.target;this.addStyle(t.value),t.value=""}})))}render(){return l("div",{key:"ec1127bb1f8f8883998c32a4643d0e883149e0ce",class:"fk-props"},l("header",{key:"f1d8243976656239d41d39e66f805cc44df45a6d",class:"fk-props__header"},l("span",{key:"82c9b8a3af10baf61f05dca322a1d736bb5d753c",class:"fk-props__type"},this.brick.type),l("h4",{key:"e36e188ac9791a2dcc09ed76f7e7dc1bfdd64b55",class:"fk-props__title"},o(`brick.${this.brick.id}.name`,this.brick.name))),l("div",{key:"5881bca531fba223155973007a7bde6234e99bc2",class:"fk-props__tabs"},this.availableTabs().map((e=>l("button",{key:e.id,type:"button",class:{"fk-props__tab":!0,"fk-props__tab--active":this.activeTab===e.id},onClick:()=>this.activeTab=e.id},e.label)))),"config"===this.activeTab?this.renderConfigTab():null,"validation"===this.activeTab?this.renderValidationTab():null,"styles"===this.activeTab?this.renderStylesTab():null,"rules"===this.activeTab?l("section",{class:"fk-props__section"},l("fk-rules-editor",{brick:this.brick,path:this.path,fields:this.fields})):null)}static get watchers(){return{brick:[{onBrickChange:0}]}}static get style(){return".sc-fk-property-panel-h{display:block}.fk-props.sc-fk-property-panel{display:flex;flex-direction:column;gap:calc(var(--fk-spacing) * 1.5)}.fk-props__header.sc-fk-property-panel{display:flex;flex-direction:column;gap:2px}.fk-props__type.sc-fk-property-panel{font-size:0.65rem;font-weight:700;text-transform:uppercase;letter-spacing:0.08em;color:var(--fk-color-primary)}.fk-props__title.sc-fk-property-panel{margin:0;font-size:0.95rem;color:var(--fk-color-text)}.fk-props__section.sc-fk-property-panel{display:flex;flex-direction:column;gap:var(--fk-spacing);padding-top:var(--fk-spacing)}.fk-props__tabs.sc-fk-property-panel{display:flex;gap:2px;border-bottom:1px solid var(--fk-color-border)}.fk-props__tab.sc-fk-property-panel{font:inherit;font-size:0.72rem;font-weight:600;padding:5px 9px;border:none;border-bottom:2px solid transparent;border-radius:0;background:transparent;color:var(--fk-color-muted);text-transform:none;letter-spacing:normal;cursor:pointer}.fk-props__tab.sc-fk-property-panel:hover{color:var(--fk-color-text)}.fk-props__tab--active.sc-fk-property-panel{color:var(--fk-color-primary);border-bottom-color:var(--fk-color-primary)}.fk-props__section-title.sc-fk-property-panel{margin:0;font-size:0.7rem;font-weight:700;text-transform:uppercase;letter-spacing:0.08em;color:var(--fk-color-muted)}.fk-props__field.sc-fk-property-panel{display:flex;flex-direction:column;gap:4px;font-style:normal;text-decoration:none}.fk-props__field--inline.sc-fk-property-panel{flex-direction:row;align-items:center;gap:8px}.fk-props__label.sc-fk-property-panel{font-size:0.75rem;font-weight:600;color:var(--fk-color-muted);font-style:normal;text-decoration:none}.fk-props__input.sc-fk-property-panel{font:inherit;font-size:0.85rem;padding:6px 8px;border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 2);background:var(--fk-color-surface);color:var(--fk-color-text)}.fk-props__input.sc-fk-property-panel:focus{outline:none;border-color:var(--fk-color-primary);box-shadow:0 0 0 2px color-mix(in srgb, var(--fk-color-primary) 20%, transparent)}.fk-props__input--textarea.sc-fk-property-panel{min-height:72px;resize:vertical}.fk-props__vrule.sc-fk-property-panel{display:flex;flex-direction:column;gap:6px;padding:calc(var(--fk-spacing) / 1.5);border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 1.5)}.fk-props__style-row.sc-fk-property-panel{display:flex;align-items:center;gap:6px}.fk-props__style-key.sc-fk-property-panel{font-family:ui-monospace, SFMono-Regular, Menlo, monospace;font-size:0.75rem;color:var(--fk-color-text);min-width:72px}.fk-props__input--grow.sc-fk-property-panel{flex:1;min-width:0}.fk-props__remove.sc-fk-property-panel{border:none;background:transparent;color:var(--fk-color-muted);font-size:0.75rem;cursor:pointer;padding:2px 4px;border-radius:calc(var(--fk-radius) / 2)}.fk-props__remove.sc-fk-property-panel:hover{color:var(--fk-color-danger);background:color-mix(in srgb, var(--fk-color-danger) 10%, transparent)}"}},[2,"fk-property-panel",{brick:[16],path:[1],fields:[16],locales:[16],locale:[1],editLocale:[1,"edit-locale"],activeTab:[32],newStyleKey:[32]},void 0,{brick:[{onBrickChange:0}]}]);function h(){"undefined"!=typeof customElements&&["fk-property-panel","fk-code-editor","fk-rules-editor"].forEach((t=>{switch(t){case"fk-property-panel":customElements.get(e(t))||customElements.define(e(t),c);break;case"fk-code-editor":customElements.get(e(t))||n();break;case"fk-rules-editor":customElements.get(e(t))||p()}}))}h();export{c as F,h as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t,p as s,H as e,c as i,h as r}from"./p-8ICOcloT.js";import{b as a,d as o,h as n,e as c,i as h,g as d,v as l}from"./p-DdGjQ53Y.js";import{registerDefaultBricks as m}from"./index.js";import{d as f}from"./p-DMwau-fb.js";import{d as p}from"./p-D6W-SOWV.js";import{d as u}from"./p-CIgvEKbO.js";import{d as b}from"./p-D_BgQRLv.js";import{d as k}from"./p-BE5v8BN3.js";import{d as v}from"./p-BRITIZrd.js";import{d as j}from"./p-DGCzE6o_.js";import{d as g}from"./p-CuWGcxtN.js";import{d as E}from"./p-Cys4PksI.js";import{d as y}from"./p-DPz8CWwm.js";import{d as O}from"./p-BlgDQ0t7.js";import{d as S}from"./p-BFnqPIpW.js";import{d as D}from"./p-BO5VWpZE.js";import{d as C}from"./p-DPidm5sJ.js";import{d as x}from"./p-BuoiPCr-.js";import{d as w}from"./p-BYCjTLjB.js";const B=s(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.formDataChange=i(this,"formDataChange"),this.formSubmit=i(this,"formSubmit"),this.validityChange=i(this,"validityChange"),this.editable=!1,this.readOnly=!1,this.disabled=!1,this.showSubmit=!1,this.reviewable=!1,this.currentData={},this.touched={},this.expanding=!1,this.utils={validateForm:()=>({isValid:this.runValidation().valid})}}componentWillLoad(){return m(),this.attachFormInternals(),this.currentData=this.seeded(this.data),this.runExpansion()}syncData(t){this.currentData=this.seeded(t)}onSpecChange(){this.currentData=this.seeded(this.data),this.runExpansion()}componentDidLoad(){this.emitValidity()}emitValidity(t){const{valid:s,errors:e}=null!=t?t:this.runValidation(),i=`${s}|${Object.keys(e).sort().join(",")}`;i!==this.lastValidity&&(this.lastValidity=i,this.validityChange.emit({valid:s,errors:e}),this.reportToForm(s,e))}attachFormInternals(){const t=this.host;if("function"==typeof t.attachInternals)try{this.internals=t.attachInternals()}catch(t){this.internals=void 0}}reportToForm(t,s){var e,i,r;if(null===(e=this.internals)||void 0===e?void 0:e.setValidity)try{this.internals.setFormValue(JSON.stringify(this.publicData())),t?this.internals.setValidity({}):this.internals.setValidity({customError:!0},null!==(i=Object.values(s)[0])&&void 0!==i?i:a("form.invalid"),null!==(r=this.host.querySelector("input, select, textarea"))&&void 0!==r?r:void 0)}catch(t){}}handleHostFormSubmit(t){var s;const e=null===(s=this.internals)||void 0===s?void 0:s.form;e&&t.target===e&&(t.preventDefault(),this.submit())}seeded(t){return Object.assign(Object.assign({},o(this.effectiveSpec())),t)}effectiveSpec(){var t;return null!==(t=this.expandedSpec)&&void 0!==t?t:this.spec}async runExpansion(){if(this.expandError=void 0,this.editable||!n(this.spec))return void(this.expandedSpec=void 0);const t=this.spec;this.expanding=!0;try{const s=await c(t);this.spec===t&&(this.expandedSpec=s,this.currentData=this.seeded(this.currentData))}catch(s){this.spec===t&&(this.expandedSpec=void 0,this.expandError=s instanceof Error?s.message:String(s))}finally{this.spec===t&&(this.expanding=!1)}}publicData(){return Object.fromEntries(Object.entries(this.currentData).filter((([t])=>!t.startsWith("_"))))}dataMap(t=this.currentData){return this.context?Object.assign(Object.assign({},t),this.context):t}handleBrickDataChange(t){t.stopPropagation(),this.currentData=this.applyValueEffects(Object.assign(Object.assign({},this.currentData),t.detail));const s=Object.assign({},this.touched);for(const e of Object.keys(t.detail))s[e]=!0;this.touched=s;const{valid:e,errors:i}=this.runValidation();this.formDataChange.emit({data:this.publicData(),isValid:e,errors:i}),this.emitValidity({valid:e,errors:i})}applyValueEffects(t){var s,e;let i=t;for(const{brick:t}of h(this.effectiveSpec())){const r=null===(s=t.configs)||void 0===s?void 0:s.key;if(!r||!(null===(e=t.rules)||void 0===e?void 0:e.length))continue;const a=d(t.rules,this.dataMap(i));void 0!==a.value&&i[r]!==a.value&&(i=Object.assign(Object.assign({},i),{[r]:a.value}))}return i}async validate(){var t;const s={};for(const{brick:e}of h(this.effectiveSpec())){const i=null===(t=e.configs)||void 0===t?void 0:t.key;i&&(s[i]=!0)}this.touched=s;const e=this.runValidation(),i=Object.assign({},e.errors);let r=e.valid;const a=Array.from(this.host.querySelectorAll("fk-data-grid"));for(const t of a){const s=await t.validateRows();r=r&&s.valid,Object.assign(i,s.errors)}const o={valid:r,errors:i};return this.emitValidity(o),this.formDataChange.emit({data:this.publicData(),isValid:o.valid,errors:o.errors}),o}async submit(){const t=await this.validate();return!t.valid||this.readOnly||this.disabled||this.formSubmit.emit({data:this.publicData(),isValid:!0,errors:{}}),t}handleStepTouch(t){t.stopPropagation();const s=Object.assign({},this.touched);for(const e of t.detail.keys)s[e]=!0;this.touched=s}async handleStepperSubmit(t){t.stopPropagation(),await this.submit()}runValidation(){const t=Object.fromEntries(Object.entries(this.currentData).filter((([,t])=>""!==t&&null!=t)));return l(this.effectiveSpec(),t,this.locale,this.context?this.dataMap(t):void 0)}visibleErrors(){if(this.editable)return{};const t={};for(const[s,e]of Object.entries(this.runValidation().errors))this.touched[s]&&(t[s]=e);return t}render(){var t;return this.spec?this.expanding?r("p",{class:"fk-form__expanding"},a("nestedForm.loading")):r("form",{class:"fk-form",onSubmit:t=>t.preventDefault()},this.expandError?r("span",{class:"fk-field__error",role:"alert"},this.expandError):null,r("fk-brick-render",{brickSpec:this.effectiveSpec(),rootSpec:this.effectiveSpec(),data:this.currentData,dataMap:this.dataMap(),errors:this.visibleErrors(),annotations:this.annotations,notes:this.notes,editableKeys:this.editableKeys,reviewable:this.reviewable,locale:this.locale,path:"0",editable:this.editable,readOnly:this.readOnly,disabled:this.disabled,selectedPath:this.selectedPath,utils:this.utils}),!this.showSubmit||this.editable||this.readOnly||this.disabled?null:r("button",{type:"submit",class:"fk-form__submit",onClick:t=>{t.preventDefault(),this.submit()}},null!==(t=this.submitLabel)&&void 0!==t?t:a("form.submit"))):null}static get formAssociated(){return!0}get host(){return this}static get watchers(){return{data:[{syncData:0}],spec:[{onSpecChange:0}]}}static get style(){return".fk-form.sc-fk-form-render{display:flex;flex-direction:column;gap:var(--fk-spacing);font-family:var(--fk-font);color:var(--fk-color-text)}"}},[66,"fk-form-render",{spec:[16],data:[16],context:[16],editable:[4],readOnly:[4,"read-only"],disabled:[4],showSubmit:[4,"show-submit"],submitLabel:[1,"submit-label"],selectedPath:[1,"selected-path"],locale:[1],annotations:[16],notes:[16],editableKeys:[16],reviewable:[4],currentData:[32],touched:[32],expandedSpec:[32],expanding:[32],expandError:[32],validate:[64],submit:[64]},[[8,"submit","handleHostFormSubmit"],[0,"brickDataChange","handleBrickDataChange"],[0,"stepTouch","handleStepTouch"],[0,"stepperSubmit","handleStepperSubmit"]],{data:[{syncData:0}],spec:[{onSpecChange:0}]}]);function V(){"undefined"!=typeof customElements&&["fk-form-render","fk-address-search","fk-brick-actions","fk-brick-not-found","fk-brick-render","fk-code-editor","fk-data-grid","fk-document-reader","fk-drop-area","fk-file-input","fk-geo-map","fk-select-input","fk-signature-input","fk-slot-picker","fk-stepper","fk-tabs","fk-variable-picker"].forEach((s=>{switch(s){case"fk-form-render":customElements.get(t(s))||customElements.define(t(s),B);break;case"fk-address-search":customElements.get(t(s))||f();break;case"fk-brick-actions":customElements.get(t(s))||p();break;case"fk-brick-not-found":customElements.get(t(s))||u();break;case"fk-brick-render":customElements.get(t(s))||b();break;case"fk-code-editor":customElements.get(t(s))||k();break;case"fk-data-grid":customElements.get(t(s))||v();break;case"fk-document-reader":customElements.get(t(s))||j();break;case"fk-drop-area":customElements.get(t(s))||g();break;case"fk-file-input":customElements.get(t(s))||E();break;case"fk-geo-map":customElements.get(t(s))||y();break;case"fk-select-input":customElements.get(t(s))||O();break;case"fk-signature-input":customElements.get(t(s))||S();break;case"fk-slot-picker":customElements.get(t(s))||D();break;case"fk-stepper":customElements.get(t(s))||C();break;case"fk-tabs":customElements.get(t(s))||x();break;case"fk-variable-picker":customElements.get(t(s))||w()}}))}V();export{B as F,V as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,h as t,H as r}from"./p-BDqOS1za.js";import{a}from"./p-Dozlw09a.js";const f=class{constructor(t){e(this,t)}render(){return t(r,{key:"a0ffdd18ff901157f1fbcada0a2a4eb04845120c"},t("div",{key:"db7dd851b10d2e9a8711a68c458e690d07158b57",class:"fk-empty"},t("p",{key:"46942af055c19bdd12d4a002698339166fb46100",class:"fk-empty__title"},a("empty.title")),t("p",{key:"d1abc66f264243d4bfbc8b5e9c4e8b34f780c890",class:"fk-empty__hint"},a("empty.hint"))))}};f.style=".fk-empty.sc-fk-empty-form{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--fk-spacing) / 2);min-height:160px;border:2px dashed var(--fk-color-border);border-radius:var(--fk-radius);color:var(--fk-color-muted);text-align:center}.fk-empty__title.sc-fk-empty-form{margin:0;font-weight:600}.fk-empty__hint.sc-fk-empty-form{margin:0;font-size:0.875rem}";export{f as fk_empty_form}
|