@streamline-pulse/formkrafter-wc 0.28.1 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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-not-found.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.d.ts +11 -0
- package/dist/components/fk-document-reader.js +1 -0
- 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-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-CuF0gbWB.js → p-66Xzy1Vh.js} +1 -1
- package/dist/components/{p-Di7uMflS.js → p-BFnqPIpW.js} +1 -1
- package/dist/components/{p-lOT7NMxD.js → p-BJuHN3Uu.js} +1 -1
- package/dist/components/{p-YMLbA4H2.js → p-BO5VWpZE.js} +1 -1
- package/dist/components/{p-xvN-OJAU.js → p-BRITIZrd.js} +1 -1
- package/dist/components/{p-DK2UgrV9.js → p-BSdc_x3o.js} +1 -1
- package/dist/components/{p-CIZUeonQ.js → p-BUgHGozZ.js} +1 -1
- package/dist/components/p-BY2wuPHY.js +1 -0
- package/dist/components/{p-CVsWXbzX.js → p-BYCjTLjB.js} +1 -1
- package/dist/components/{p-DtPhC0nx.js → p-BlgDQ0t7.js} +1 -1
- package/dist/components/{p-BGax6QkM.js → p-BuoiPCr-.js} +1 -1
- package/dist/components/p-CIgvEKbO.js +1 -0
- package/dist/components/{p-Dt5tFknh.js → p-CuWGcxtN.js} +1 -1
- package/dist/components/{p-B5gG7fHb.js → p-Cys4PksI.js} +1 -1
- package/dist/components/{p-DJxeNTfC.js → p-D6W-SOWV.js} +1 -1
- package/dist/components/p-DGCzE6o_.js +1 -0
- package/dist/components/{p-C8yXvs3g.js → p-DMwau-fb.js} +1 -1
- package/dist/components/{p-BEft-cf2.js → p-DPidm5sJ.js} +1 -1
- package/dist/components/{p-DskfAsd6.js → p-DPz8CWwm.js} +1 -1
- package/dist/components/p-D_BgQRLv.js +1 -0
- package/dist/components/{p-Ddiv4Djm.js → p-DdGjQ53Y.js} +7 -7
- package/dist/components/p-bOrdd5ri.js +1 -0
- package/dist/formkrafter-wc/formkrafter-wc.esm.js +1 -1
- package/dist/formkrafter-wc/index.esm.js +1 -1
- package/dist/formkrafter-wc/p-3a516b41.entry.js +1 -0
- package/dist/formkrafter-wc/p-96c82d88.entry.js +1 -0
- package/dist/formkrafter-wc/{p-730cac62.entry.js → p-996cdc3f.entry.js} +1 -1
- package/dist/formkrafter-wc/{p-D3ItRsmP.js → p-Dozlw09a.js} +7 -7
- package/dist/formkrafter-wc/{p-CiXmtjEN.js → p-FupO-_0D.js} +1 -1
- package/dist/types/components/fk-document-reader/fk-document-reader.d.ts +44 -0
- package/dist/types/components.d.ts +135 -2
- package/dist/types/registry/default-bricks.d.ts +72 -0
- package/package.json +2 -2
- package/dist/components/p-DIW5FtAy.js +0 -1
- package/dist/components/p-DMLnAgzb.js +0 -1
- package/dist/components/p-FSCguIuu.js +0 -1
- package/dist/components/p-t-OoJsHu.js +0 -1
- package/dist/formkrafter-wc/p-7bc82da2.entry.js +0 -1
- package/dist/formkrafter-wc/p-f867357b.entry.js +0 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import type { DocumentField, DocumentReading, UploadedFile } from '@streamline-pulse/formkrafter-core';
|
|
3
|
+
/** The value a document brick stores: the file (when uploaded) and what was read from it. */
|
|
4
|
+
export interface DocumentValue extends DocumentReading {
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
size: number;
|
|
8
|
+
file?: UploadedFile;
|
|
9
|
+
readAt?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Picks a document (file or camera on mobile), sends it to the host's
|
|
13
|
+
* document reader, then shows the text and the requested fields, which the
|
|
14
|
+
* user can correct before the form is submitted.
|
|
15
|
+
*/
|
|
16
|
+
export declare class FkDocumentReader {
|
|
17
|
+
value?: DocumentValue;
|
|
18
|
+
accept: string;
|
|
19
|
+
/** Offers the device camera (mobile browsers) in addition to the file picker. */
|
|
20
|
+
capture: boolean;
|
|
21
|
+
readUrl?: string;
|
|
22
|
+
/** When set, the document is also uploaded through the file upload service and kept in the value. */
|
|
23
|
+
uploadUrl?: string;
|
|
24
|
+
keepFile: boolean;
|
|
25
|
+
fields: DocumentField[];
|
|
26
|
+
language?: string;
|
|
27
|
+
/** Form context handed to the host reader (`_`-prefixed keys). */
|
|
28
|
+
context?: Record<string, unknown>;
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
readOnly: boolean;
|
|
31
|
+
documentChange: EventEmitter<DocumentValue | undefined>;
|
|
32
|
+
reading: boolean;
|
|
33
|
+
error?: string;
|
|
34
|
+
showText: boolean;
|
|
35
|
+
private inputEl?;
|
|
36
|
+
private cameraEl?;
|
|
37
|
+
private get locked();
|
|
38
|
+
private handleFile;
|
|
39
|
+
private updateField;
|
|
40
|
+
private fieldLabel;
|
|
41
|
+
private renderFields;
|
|
42
|
+
private renderText;
|
|
43
|
+
render(): any;
|
|
44
|
+
}
|
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
8
|
import { AddressFeature } from "./components/fk-address-search/fk-address-search";
|
|
9
9
|
import { BrickConfigsChangeDetail, BrickDropDetail, BrickPathDetail, BrickReviewChangeDetail, BrickRulesChangeDetail, BrickStylesChangeDetail, BrickValidationsChangeDetail, DataChangeDetail, ReviewChangeDetail, SpecChangeDetail, ValidityChangeDetail } from "./utils/events";
|
|
10
|
-
import { BrickMold, BrickSpec, FieldAnnotations, SlotRules, UploadedFile, Utils, ValidationResult } from "@streamline-pulse/formkrafter-core";
|
|
10
|
+
import { BrickMold, BrickSpec, DocumentField, FieldAnnotations, SlotRules, UploadedFile, Utils, ValidationResult } from "@streamline-pulse/formkrafter-core";
|
|
11
|
+
import { DocumentValue } from "./components/fk-document-reader/fk-document-reader";
|
|
11
12
|
import { GeoGeometry, GeoMode, GeoZone } from "./components/fk-geo-map/fk-geo-map";
|
|
12
13
|
import { PickedSlot } from "./components/fk-slot-picker/fk-slot-picker";
|
|
13
14
|
import { FkVariable } from "./components/fk-variable-picker/fk-variable-picker";
|
|
14
15
|
export { AddressFeature } from "./components/fk-address-search/fk-address-search";
|
|
15
16
|
export { BrickConfigsChangeDetail, BrickDropDetail, BrickPathDetail, BrickReviewChangeDetail, BrickRulesChangeDetail, BrickStylesChangeDetail, BrickValidationsChangeDetail, DataChangeDetail, ReviewChangeDetail, SpecChangeDetail, ValidityChangeDetail } from "./utils/events";
|
|
16
|
-
export { BrickMold, BrickSpec, FieldAnnotations, SlotRules, UploadedFile, Utils, ValidationResult } from "@streamline-pulse/formkrafter-core";
|
|
17
|
+
export { BrickMold, BrickSpec, DocumentField, FieldAnnotations, SlotRules, UploadedFile, Utils, ValidationResult } from "@streamline-pulse/formkrafter-core";
|
|
18
|
+
export { DocumentValue } from "./components/fk-document-reader/fk-document-reader";
|
|
17
19
|
export { GeoGeometry, GeoMode, GeoZone } from "./components/fk-geo-map/fk-geo-map";
|
|
18
20
|
export { PickedSlot } from "./components/fk-slot-picker/fk-slot-picker";
|
|
19
21
|
export { FkVariable } from "./components/fk-variable-picker/fk-variable-picker";
|
|
@@ -140,6 +142,49 @@ export namespace Components {
|
|
|
140
142
|
"validateRows": () => Promise<ValidationResult>;
|
|
141
143
|
"value"?: unknown;
|
|
142
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Picks a document (file or camera on mobile), sends it to the host's
|
|
147
|
+
* document reader, then shows the text and the requested fields, which the
|
|
148
|
+
* user can correct before the form is submitted.
|
|
149
|
+
*/
|
|
150
|
+
interface FkDocumentReader {
|
|
151
|
+
/**
|
|
152
|
+
* @default 'image/*,.pdf'
|
|
153
|
+
*/
|
|
154
|
+
"accept": string;
|
|
155
|
+
/**
|
|
156
|
+
* Offers the device camera (mobile browsers) in addition to the file picker.
|
|
157
|
+
* @default false
|
|
158
|
+
*/
|
|
159
|
+
"capture": boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Form context handed to the host reader (`_`-prefixed keys).
|
|
162
|
+
*/
|
|
163
|
+
"context"?: Record<string, unknown>;
|
|
164
|
+
/**
|
|
165
|
+
* @default false
|
|
166
|
+
*/
|
|
167
|
+
"disabled": boolean;
|
|
168
|
+
/**
|
|
169
|
+
* @default []
|
|
170
|
+
*/
|
|
171
|
+
"fields": DocumentField[];
|
|
172
|
+
/**
|
|
173
|
+
* @default true
|
|
174
|
+
*/
|
|
175
|
+
"keepFile": boolean;
|
|
176
|
+
"language"?: string;
|
|
177
|
+
/**
|
|
178
|
+
* @default false
|
|
179
|
+
*/
|
|
180
|
+
"readOnly": boolean;
|
|
181
|
+
"readUrl"?: string;
|
|
182
|
+
/**
|
|
183
|
+
* When set, the document is also uploaded through the file upload service and kept in the value.
|
|
184
|
+
*/
|
|
185
|
+
"uploadUrl"?: string;
|
|
186
|
+
"value"?: DocumentValue;
|
|
187
|
+
}
|
|
143
188
|
interface FkDropArea {
|
|
144
189
|
/**
|
|
145
190
|
* @default false
|
|
@@ -434,6 +479,10 @@ export interface FkDataGridCustomEvent<T> extends CustomEvent<T> {
|
|
|
434
479
|
detail: T;
|
|
435
480
|
target: HTMLFkDataGridElement;
|
|
436
481
|
}
|
|
482
|
+
export interface FkDocumentReaderCustomEvent<T> extends CustomEvent<T> {
|
|
483
|
+
detail: T;
|
|
484
|
+
target: HTMLFkDocumentReaderElement;
|
|
485
|
+
}
|
|
437
486
|
export interface FkDropAreaCustomEvent<T> extends CustomEvent<T> {
|
|
438
487
|
detail: T;
|
|
439
488
|
target: HTMLFkDropAreaElement;
|
|
@@ -611,6 +660,28 @@ declare global {
|
|
|
611
660
|
prototype: HTMLFkDataGridElement;
|
|
612
661
|
new (): HTMLFkDataGridElement;
|
|
613
662
|
};
|
|
663
|
+
interface HTMLFkDocumentReaderElementEventMap {
|
|
664
|
+
"documentChange": DocumentValue | undefined;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Picks a document (file or camera on mobile), sends it to the host's
|
|
668
|
+
* document reader, then shows the text and the requested fields, which the
|
|
669
|
+
* user can correct before the form is submitted.
|
|
670
|
+
*/
|
|
671
|
+
interface HTMLFkDocumentReaderElement extends Components.FkDocumentReader, HTMLStencilElement {
|
|
672
|
+
addEventListener<K extends keyof HTMLFkDocumentReaderElementEventMap>(type: K, listener: (this: HTMLFkDocumentReaderElement, ev: FkDocumentReaderCustomEvent<HTMLFkDocumentReaderElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
673
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
674
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
675
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
676
|
+
removeEventListener<K extends keyof HTMLFkDocumentReaderElementEventMap>(type: K, listener: (this: HTMLFkDocumentReaderElement, ev: FkDocumentReaderCustomEvent<HTMLFkDocumentReaderElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
677
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
678
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
679
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
680
|
+
}
|
|
681
|
+
var HTMLFkDocumentReaderElement: {
|
|
682
|
+
prototype: HTMLFkDocumentReaderElement;
|
|
683
|
+
new (): HTMLFkDocumentReaderElement;
|
|
684
|
+
};
|
|
614
685
|
interface HTMLFkDropAreaElementEventMap {
|
|
615
686
|
"brickDrop": BrickDropDetail;
|
|
616
687
|
}
|
|
@@ -893,6 +964,7 @@ declare global {
|
|
|
893
964
|
"fk-brick-render": HTMLFkBrickRenderElement;
|
|
894
965
|
"fk-code-editor": HTMLFkCodeEditorElement;
|
|
895
966
|
"fk-data-grid": HTMLFkDataGridElement;
|
|
967
|
+
"fk-document-reader": HTMLFkDocumentReaderElement;
|
|
896
968
|
"fk-drop-area": HTMLFkDropAreaElement;
|
|
897
969
|
"fk-empty-form": HTMLFkEmptyFormElement;
|
|
898
970
|
"fk-file-input": HTMLFkFileInputElement;
|
|
@@ -1050,6 +1122,50 @@ declare namespace LocalJSX {
|
|
|
1050
1122
|
"utils": Utils;
|
|
1051
1123
|
"value"?: unknown;
|
|
1052
1124
|
}
|
|
1125
|
+
/**
|
|
1126
|
+
* Picks a document (file or camera on mobile), sends it to the host's
|
|
1127
|
+
* document reader, then shows the text and the requested fields, which the
|
|
1128
|
+
* user can correct before the form is submitted.
|
|
1129
|
+
*/
|
|
1130
|
+
interface FkDocumentReader {
|
|
1131
|
+
/**
|
|
1132
|
+
* @default 'image/*,.pdf'
|
|
1133
|
+
*/
|
|
1134
|
+
"accept"?: string;
|
|
1135
|
+
/**
|
|
1136
|
+
* Offers the device camera (mobile browsers) in addition to the file picker.
|
|
1137
|
+
* @default false
|
|
1138
|
+
*/
|
|
1139
|
+
"capture"?: boolean;
|
|
1140
|
+
/**
|
|
1141
|
+
* Form context handed to the host reader (`_`-prefixed keys).
|
|
1142
|
+
*/
|
|
1143
|
+
"context"?: Record<string, unknown>;
|
|
1144
|
+
/**
|
|
1145
|
+
* @default false
|
|
1146
|
+
*/
|
|
1147
|
+
"disabled"?: boolean;
|
|
1148
|
+
/**
|
|
1149
|
+
* @default []
|
|
1150
|
+
*/
|
|
1151
|
+
"fields"?: DocumentField[];
|
|
1152
|
+
/**
|
|
1153
|
+
* @default true
|
|
1154
|
+
*/
|
|
1155
|
+
"keepFile"?: boolean;
|
|
1156
|
+
"language"?: string;
|
|
1157
|
+
"onDocumentChange"?: (event: FkDocumentReaderCustomEvent<DocumentValue | undefined>) => void;
|
|
1158
|
+
/**
|
|
1159
|
+
* @default false
|
|
1160
|
+
*/
|
|
1161
|
+
"readOnly"?: boolean;
|
|
1162
|
+
"readUrl"?: string;
|
|
1163
|
+
/**
|
|
1164
|
+
* When set, the document is also uploaded through the file upload service and kept in the value.
|
|
1165
|
+
*/
|
|
1166
|
+
"uploadUrl"?: string;
|
|
1167
|
+
"value"?: DocumentValue;
|
|
1168
|
+
}
|
|
1053
1169
|
interface FkDropArea {
|
|
1054
1170
|
/**
|
|
1055
1171
|
* @default false
|
|
@@ -1388,6 +1504,16 @@ declare namespace LocalJSX {
|
|
|
1388
1504
|
"locale": string;
|
|
1389
1505
|
"reviewable": boolean;
|
|
1390
1506
|
}
|
|
1507
|
+
interface FkDocumentReaderAttributes {
|
|
1508
|
+
"accept": string;
|
|
1509
|
+
"capture": boolean;
|
|
1510
|
+
"readUrl": string;
|
|
1511
|
+
"uploadUrl": string;
|
|
1512
|
+
"keepFile": boolean;
|
|
1513
|
+
"language": string;
|
|
1514
|
+
"disabled": boolean;
|
|
1515
|
+
"readOnly": boolean;
|
|
1516
|
+
}
|
|
1391
1517
|
interface FkDropAreaAttributes {
|
|
1392
1518
|
"path": string;
|
|
1393
1519
|
"empty": boolean;
|
|
@@ -1472,6 +1598,7 @@ declare namespace LocalJSX {
|
|
|
1472
1598
|
"fk-brick-render": Omit<FkBrickRender, keyof FkBrickRenderAttributes> & { [K in keyof FkBrickRender & keyof FkBrickRenderAttributes]?: FkBrickRender[K] } & { [K in keyof FkBrickRender & keyof FkBrickRenderAttributes as `attr:${K}`]?: FkBrickRenderAttributes[K] } & { [K in keyof FkBrickRender & keyof FkBrickRenderAttributes as `prop:${K}`]?: FkBrickRender[K] };
|
|
1473
1599
|
"fk-code-editor": Omit<FkCodeEditor, keyof FkCodeEditorAttributes> & { [K in keyof FkCodeEditor & keyof FkCodeEditorAttributes]?: FkCodeEditor[K] } & { [K in keyof FkCodeEditor & keyof FkCodeEditorAttributes as `attr:${K}`]?: FkCodeEditorAttributes[K] } & { [K in keyof FkCodeEditor & keyof FkCodeEditorAttributes as `prop:${K}`]?: FkCodeEditor[K] };
|
|
1474
1600
|
"fk-data-grid": Omit<FkDataGrid, keyof FkDataGridAttributes> & { [K in keyof FkDataGrid & keyof FkDataGridAttributes]?: FkDataGrid[K] } & { [K in keyof FkDataGrid & keyof FkDataGridAttributes as `attr:${K}`]?: FkDataGridAttributes[K] } & { [K in keyof FkDataGrid & keyof FkDataGridAttributes as `prop:${K}`]?: FkDataGrid[K] };
|
|
1601
|
+
"fk-document-reader": Omit<FkDocumentReader, keyof FkDocumentReaderAttributes> & { [K in keyof FkDocumentReader & keyof FkDocumentReaderAttributes]?: FkDocumentReader[K] } & { [K in keyof FkDocumentReader & keyof FkDocumentReaderAttributes as `attr:${K}`]?: FkDocumentReaderAttributes[K] } & { [K in keyof FkDocumentReader & keyof FkDocumentReaderAttributes as `prop:${K}`]?: FkDocumentReader[K] };
|
|
1475
1602
|
"fk-drop-area": Omit<FkDropArea, keyof FkDropAreaAttributes> & { [K in keyof FkDropArea & keyof FkDropAreaAttributes]?: FkDropArea[K] } & { [K in keyof FkDropArea & keyof FkDropAreaAttributes as `attr:${K}`]?: FkDropAreaAttributes[K] } & { [K in keyof FkDropArea & keyof FkDropAreaAttributes as `prop:${K}`]?: FkDropArea[K] } & OneOf<"path", FkDropArea["path"], FkDropAreaAttributes["path"]>;
|
|
1476
1603
|
"fk-empty-form": FkEmptyForm;
|
|
1477
1604
|
"fk-file-input": Omit<FkFileInput, keyof FkFileInputAttributes> & { [K in keyof FkFileInput & keyof FkFileInputAttributes]?: FkFileInput[K] } & { [K in keyof FkFileInput & keyof FkFileInputAttributes as `attr:${K}`]?: FkFileInputAttributes[K] } & { [K in keyof FkFileInput & keyof FkFileInputAttributes as `prop:${K}`]?: FkFileInput[K] };
|
|
@@ -1507,6 +1634,12 @@ declare module "@stencil/core" {
|
|
|
1507
1634
|
"fk-brick-render": LocalJSX.IntrinsicElements["fk-brick-render"] & JSXBase.HTMLAttributes<HTMLFkBrickRenderElement>;
|
|
1508
1635
|
"fk-code-editor": LocalJSX.IntrinsicElements["fk-code-editor"] & JSXBase.HTMLAttributes<HTMLFkCodeEditorElement>;
|
|
1509
1636
|
"fk-data-grid": LocalJSX.IntrinsicElements["fk-data-grid"] & JSXBase.HTMLAttributes<HTMLFkDataGridElement>;
|
|
1637
|
+
/**
|
|
1638
|
+
* Picks a document (file or camera on mobile), sends it to the host's
|
|
1639
|
+
* document reader, then shows the text and the requested fields, which the
|
|
1640
|
+
* user can correct before the form is submitted.
|
|
1641
|
+
*/
|
|
1642
|
+
"fk-document-reader": LocalJSX.IntrinsicElements["fk-document-reader"] & JSXBase.HTMLAttributes<HTMLFkDocumentReaderElement>;
|
|
1510
1643
|
"fk-drop-area": LocalJSX.IntrinsicElements["fk-drop-area"] & JSXBase.HTMLAttributes<HTMLFkDropAreaElement>;
|
|
1511
1644
|
"fk-empty-form": LocalJSX.IntrinsicElements["fk-empty-form"] & JSXBase.HTMLAttributes<HTMLFkEmptyFormElement>;
|
|
1512
1645
|
"fk-file-input": LocalJSX.IntrinsicElements["fk-file-input"] & JSXBase.HTMLAttributes<HTMLFkFileInputElement>;
|
|
@@ -451,6 +451,78 @@ export declare const appointmentBrick: {
|
|
|
451
451
|
readonly defaultConfigs?: Record<string, unknown>;
|
|
452
452
|
getBrickEmptySpec(): BrickSpec;
|
|
453
453
|
};
|
|
454
|
+
export declare const documentBrick: {
|
|
455
|
+
render(props: WcBrickProps): VNode;
|
|
456
|
+
renderBuilder(props: WcBrickProps): VNode;
|
|
457
|
+
getComponent(props: WcBrickProps): VNode;
|
|
458
|
+
getComponentWithActions(props: WcBrickProps): VNode;
|
|
459
|
+
readonly type: import("@streamline-pulse/formkrafter-core").BrickType;
|
|
460
|
+
readonly dataType: import("@streamline-pulse/formkrafter-core").JSONSchemaType;
|
|
461
|
+
readonly id: string;
|
|
462
|
+
readonly name: string;
|
|
463
|
+
readonly configsForm?: BrickSpec;
|
|
464
|
+
readonly category?: string;
|
|
465
|
+
readonly styles?: Record<string, unknown>;
|
|
466
|
+
readonly unWrapData: boolean;
|
|
467
|
+
readonly isPrivate: boolean;
|
|
468
|
+
readonly validators: import("@streamline-pulse/formkrafter-core").Validator[];
|
|
469
|
+
readonly defaultConfigs?: Record<string, unknown>;
|
|
470
|
+
getBrickEmptySpec(): BrickSpec;
|
|
471
|
+
};
|
|
472
|
+
export declare const measureBrick: {
|
|
473
|
+
render(props: WcBrickProps): VNode;
|
|
474
|
+
renderBuilder(props: WcBrickProps): VNode;
|
|
475
|
+
getComponent(props: WcBrickProps): VNode;
|
|
476
|
+
getComponentWithActions(props: WcBrickProps): VNode;
|
|
477
|
+
readonly type: import("@streamline-pulse/formkrafter-core").BrickType;
|
|
478
|
+
readonly dataType: import("@streamline-pulse/formkrafter-core").JSONSchemaType;
|
|
479
|
+
readonly id: string;
|
|
480
|
+
readonly name: string;
|
|
481
|
+
readonly configsForm?: BrickSpec;
|
|
482
|
+
readonly category?: string;
|
|
483
|
+
readonly styles?: Record<string, unknown>;
|
|
484
|
+
readonly unWrapData: boolean;
|
|
485
|
+
readonly isPrivate: boolean;
|
|
486
|
+
readonly validators: import("@streamline-pulse/formkrafter-core").Validator[];
|
|
487
|
+
readonly defaultConfigs?: Record<string, unknown>;
|
|
488
|
+
getBrickEmptySpec(): BrickSpec;
|
|
489
|
+
};
|
|
490
|
+
export declare const vehiclePlateBrick: {
|
|
491
|
+
render(props: WcBrickProps): VNode;
|
|
492
|
+
renderBuilder(props: WcBrickProps): VNode;
|
|
493
|
+
getComponent(props: WcBrickProps): VNode;
|
|
494
|
+
getComponentWithActions(props: WcBrickProps): VNode;
|
|
495
|
+
readonly type: import("@streamline-pulse/formkrafter-core").BrickType;
|
|
496
|
+
readonly dataType: import("@streamline-pulse/formkrafter-core").JSONSchemaType;
|
|
497
|
+
readonly id: string;
|
|
498
|
+
readonly name: string;
|
|
499
|
+
readonly configsForm?: BrickSpec;
|
|
500
|
+
readonly category?: string;
|
|
501
|
+
readonly styles?: Record<string, unknown>;
|
|
502
|
+
readonly unWrapData: boolean;
|
|
503
|
+
readonly isPrivate: boolean;
|
|
504
|
+
readonly validators: import("@streamline-pulse/formkrafter-core").Validator[];
|
|
505
|
+
readonly defaultConfigs?: Record<string, unknown>;
|
|
506
|
+
getBrickEmptySpec(): BrickSpec;
|
|
507
|
+
};
|
|
508
|
+
export declare const companyRegistryBrick: {
|
|
509
|
+
render(props: WcBrickProps): VNode;
|
|
510
|
+
renderBuilder(props: WcBrickProps): VNode;
|
|
511
|
+
getComponent(props: WcBrickProps): VNode;
|
|
512
|
+
getComponentWithActions(props: WcBrickProps): VNode;
|
|
513
|
+
readonly type: import("@streamline-pulse/formkrafter-core").BrickType;
|
|
514
|
+
readonly dataType: import("@streamline-pulse/formkrafter-core").JSONSchemaType;
|
|
515
|
+
readonly id: string;
|
|
516
|
+
readonly name: string;
|
|
517
|
+
readonly configsForm?: BrickSpec;
|
|
518
|
+
readonly category?: string;
|
|
519
|
+
readonly styles?: Record<string, unknown>;
|
|
520
|
+
readonly unWrapData: boolean;
|
|
521
|
+
readonly isPrivate: boolean;
|
|
522
|
+
readonly validators: import("@streamline-pulse/formkrafter-core").Validator[];
|
|
523
|
+
readonly defaultConfigs?: Record<string, unknown>;
|
|
524
|
+
getBrickEmptySpec(): BrickSpec;
|
|
525
|
+
};
|
|
454
526
|
export declare const dateRangeBrick: {
|
|
455
527
|
render(props: WcBrickProps): VNode;
|
|
456
528
|
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.30.0",
|
|
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.30.0",
|
|
66
66
|
"leaflet": "1.9.4"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t,p as i,H as s,c as e,h as a}from"./p-8ICOcloT.js";import{g as n,r as o,a as h,w as r}from"./p-Ddiv4Djm.js";import{g as l}from"./p-BMtyMU2R.js";import{d as c}from"./p-DJxeNTfC.js";import{d}from"./p-DMLnAgzb.js";import{d as u}from"./p-Dt5tFknh.js";const k=i(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.brickDataChange=e(this,"brickDataChange"),this.brickConfigsChange=e(this,"brickConfigsChange"),this.brickStylesChange=e(this,"brickStylesChange"),this.brickValidationsChange=e(this,"brickValidationsChange"),this.brickRulesChange=e(this,"brickRulesChange"),this.brickRemove=e(this,"brickRemove"),this.brickDuplicate=e(this,"brickDuplicate"),this.brickReviewChange=e(this,"brickReviewChange"),this.path="0",this.editable=!1,this.readOnly=!1,this.disabled=!1,this.errors={},this.reviewable=!1}render(){var t,i,s,e,c,d,u,k;const p=this.brickSpec;if(!p)return null;const b=l(p.type,p.id);if(!b)return a("fk-brick-not-found",null,`${p.type}:${p.id}`);const f=this.editable&&(null===(t=p.editable)||void 0===t||t),v=n(p.rules,this.dataMap);if(!f&&!0===v.hidden)return null;const m="panel"===p.type||"collection"===p.type,g=(null!==(i=p.children)&&void 0!==i?i:[]).map(((t,i)=>{var s;return a("fk-brick-render",{brickSpec:t,rootSpec:null!==(s=this.rootSpec)&&void 0!==s?s:this.brickSpec,data:this.data,dataMap:this.dataMap,errors:this.errors,annotations:this.annotations,notes:this.notes,editableKeys:this.editableKeys,reviewable:this.reviewable,locale:this.locale,path:`${this.path}.${i}`,editable:this.editable,readOnly:this.readOnly,disabled:this.disabled,selectedPath:this.selectedPath,utils:this.utils})})),C=null===(s=p.configs)||void 0===s?void 0:s.key,y=!!C&&("input"===p.type||"collection"===p.type),D=y&&void 0!==this.editableKeys&&!this.editableKeys.includes(C)&&!this.editableKeys.some((t=>t.startsWith(`${C}[`))),S=y?null===(e=this.annotations)||void 0===e?void 0:e[C]:void 0,j=y?null===(c=this.notes)||void 0===c?void 0:c[C]:void 0,w=y&&this.reviewable&&!f?{value:null!=S?S:{},onChange:t=>this.brickReviewChange.emit({key:C,annotation:t})}:void 0;f&&m&&g.push(a("fk-drop-area",{path:this.path}));const E={brickSpec:p,configsForm:p.configsForm,configs:o(p.configs,this.locale),locale:this.locale,styles:null!==(d=p.styles)&&void 0!==d?d:{},data:h(p,this.data),dataMap:this.dataMap,rootSpec:null!==(u=this.rootSpec)&&void 0!==u?u:this.brickSpec,error:(null===(k=p.configs)||void 0===k?void 0:k.key)?this.errors[p.configs.key]:void 0,disabled:!f&&(this.disabled||!0===v.disabled),readOnly:!f&&(this.readOnly||D),annotation:S,note:j,review:w,annotations:this.annotations,notes:this.notes,reviewable:this.reviewable&&!f,editableKeys:this.editableKeys,path:this.path,editable:f,children:g,validations:p.validations,rules:p.rules,utils:this.utils,onDataChange:t=>{const i=r(p,t);void 0!==i&&this.brickDataChange.emit(i)},onConfigsChange:(t,i)=>this.brickConfigsChange.emit({configs:t,path:null!=i?i:this.path}),onStylesChange:(t,i)=>this.brickStylesChange.emit({styles:t,path:null!=i?i:this.path}),onValidationsChange:(t,i)=>this.brickValidationsChange.emit({validations:t,path:null!=i?i:this.path}),onRulesChange:(t,i)=>this.brickRulesChange.emit({rules:t,path:null!=i?i:this.path}),onDelete:t=>this.brickRemove.emit({path:t}),onDuplicate:t=>this.brickDuplicate.emit({path:t})},M=f?b.renderBuilder(E):b.render(E);return f&&"0"!==this.path?a("fk-brick-actions",{path:this.path,selected:this.path===this.selectedPath},M):M}},[0,"fk-brick-render",{brickSpec:[16],rootSpec:[16],data:[16],dataMap:[16],path:[1],editable:[4],readOnly:[4,"read-only"],disabled:[4],selectedPath:[1,"selected-path"],errors:[16],annotations:[16],notes:[16],editableKeys:[16],reviewable:[4],locale:[1],utils:[16]}]);function p(){"undefined"!=typeof customElements&&["fk-brick-render","fk-brick-actions","fk-brick-not-found","fk-brick-render","fk-drop-area"].forEach((i=>{switch(i){case"fk-brick-render":customElements.get(t(i))||customElements.define(t(i),k);break;case"fk-brick-actions":customElements.get(t(i))||c();break;case"fk-brick-not-found":customElements.get(t(i))||d();break;case"fk-brick-render":customElements.get(t(i))||p();break;case"fk-drop-area":customElements.get(t(i))||u()}}))}p();export{k as F,p as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e,p as o,H as r,h as n,a as c}from"./p-8ICOcloT.js";const d=o(class extends r{constructor(e){super(),!1!==e&&this.__registerHost()}render(){return n(c,{key:"847b67e5cef11fd9232053e5171031f39a8ed7d6"},n("p",{key:"a3303c6d28d4d89a2477300b89957b7262ce66c1",class:"fk-not-found"},"Brick ",n("slot",{key:"fac3d69e7eebdcb9c3cbe3a3fc7645440b4d7147"})," not found"))}static get style(){return".fk-not-found.sc-fk-brick-not-found{margin:0;padding:calc(var(--fk-spacing) * 1.5);border:1px dashed var(--fk-color-danger);border-radius:var(--fk-radius);color:var(--fk-color-danger);font-size:0.875rem}"}},[262,"fk-brick-not-found"]);function t(){"undefined"!=typeof customElements&&["fk-brick-not-found"].forEach((o=>{"fk-brick-not-found"===o&&(customElements.get(e(o))||customElements.define(e(o),d))}))}t();export{d as F,t as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e,p as t,H as s,c as o,h as r}from"./p-8ICOcloT.js";import{b as i,j as l,f as a}from"./p-Ddiv4Djm.js";import{d as n}from"./p-BE5v8BN3.js";import{d as p}from"./p-DK2UgrV9.js";const c=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.brickConfigsChange=o(this,"brickConfigsChange"),this.brickValidationsChange=o(this,"brickValidationsChange"),this.brickStylesChange=o(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:i("panel.tab.config")}];return"input"===this.brick.type&&e.push({id:"validation",label:i("panel.tab.validation")}),e.push({id:"styles",label:i("panel.tab.styles")},{id:"rules",label:i("panel.tab.rules")}),e}localized(e,t){var s;if(this.locales.length<=1)return t||void 0;const o=l(e)?Object.assign({},e):{};return"string"==typeof e&&e&&!l(e)&&(o[this.locales[0]]=e),o[null!==(s=this.editLocale)&&void 0!==s?s:this.locales[0]]=t,o}readLocalized(e){var t,s,o;return l(e)?null!==(s=e[null!==(t=this.editLocale)&&void 0!==t?t:this.locales[0]])&&void 0!==s?s:"":null!==(o=e)&&void 0!==o?o:""}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 o;const r=this.validationOf(e),i=(null!==(o=this.brick.validations)&&void 0!==o?o:[]).filter((t=>t.validator!==e));this.emitValidations(t?[...i,Object.assign(Object.assign(Object.assign({},r),{validator:e}),s)]:i)}addStyle(e){const t=this.newStyleKey.trim();t&&(this.emitStyles({[t]:e}),this.newStyleKey="")}textField(e,t,s){var o;return r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},e),r("input",{class:"fk-props__input",type:"text",value:null!==(o=t)&&void 0!==o?o:"",onChange:e=>s(e.target.value)}))}optionsFields(){var e,t,s;const o=this.brick.configs;if(!o||!("options"in o)&&!("optionsSource"in o))return[];const l="optionsSource"in o,a=l&&null!==(e=o.optionsSource)&&void 0!==e?e:"static",n=l?[r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},i("panel.optionsSource")),r("select",{class:"fk-props__input",onChange:e=>this.emitConfigs({optionsSource:e.target.value})},["static","dataMap","remote","js","catalog"].map((e=>r("option",{value:e,selected:e===a},e)))))]:[];return"static"===a&&n.push(r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},i("panel.options")),r("textarea",{class:"fk-props__input fk-props__input--textarea",onChange:e=>this.writeTextConfig("options",e.target.value)},this.readLocalized(o.options)))),"dataMap"===a&&n.push(this.textField(i("panel.dataKey"),o.optionsPath,(e=>this.emitConfigs({optionsPath:e})))),"remote"===a&&n.push(this.textField(i("panel.url"),o.optionsUrl,(e=>this.emitConfigs({optionsUrl:e}))),this.textField(i("panel.responsePath"),o.optionsPath,(e=>this.emitConfigs({optionsPath:e||void 0}))),r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},i("panel.headers")),r("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=o.optionsHeaders)&&void 0!==t?t:"")),this.textField(i("panel.searchParam"),o.searchParam,(e=>this.emitConfigs({searchParam:e||void 0})))),"js"===a&&n.push(r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},"Code"),r("fk-code-editor",{completions:this.fields,value:null!==(s=o.optionsCode)&&void 0!==s?s:"",placeholder:"return dataMap.country === 'BJ' ? ['Cotonou'] : ['Paris'];",onCodeChange:e=>this.emitConfigs({optionsCode:e.detail})}))),"catalog"===a&&n.push(this.textField(i("panel.optionsRef"),o.optionsRef,(e=>this.emitConfigs({optionsRef:e})))),"remote"!==a&&"js"!==a&&"catalog"!==a||n.push(this.textField(i("panel.labelKey"),o.labelKey,(e=>this.emitConfigs({labelKey:e}))),this.textField(i("panel.valueKey"),o.valueKey,(e=>this.emitConfigs({valueKey:e})))),n}renderConfigTab(){const e=this.brick.configs,t="input"===this.brick.type;return r("section",{class:"fk-props__section"},this.textField(i("panel.key"),null==e?void 0:e.key,(e=>this.emitConfigs({key:e}))),this.textField(i("panel.label"),this.readLocalized(null==e?void 0:e.label),(e=>this.writeTextConfig("label",e))),t?[this.textField(i("panel.placeholder"),this.readLocalized(null==e?void 0:e.placeholder),(e=>this.writeTextConfig("placeholder",e))),this.textField(i("panel.prefix"),null==e?void 0:e.prefix,(e=>this.emitConfigs({prefix:e||void 0}))),this.textField(i("panel.suffix"),null==e?void 0:e.suffix,(e=>this.emitConfigs({suffix:e||void 0})))]:null,e&&"specRef"in e?this.textField(a("panel.specRef","Referenced form (specRef)"),e.specRef,(e=>this.emitConfigs({specRef:e}))):null,e&&"mask"in e?this.textField(a("panel.mask","Input mask (9=digit, a=letter, *=any)"),e.mask,(e=>this.emitConfigs({mask:e}))):null,e&&"searchUrl"in e?[this.textField(a("panel.searchUrl","Geocoding URL ({q} = query)"),e.searchUrl,(e=>this.emitConfigs({searchUrl:e}))),this.textField(a("panel.countryCodes","Country codes (bj, tg)"),e.countryCodes,(e=>this.emitConfigs({countryCodes:e})))]:null,e&&"layerUrl"in e?[this.textField(a("panel.layerUrl","Reference layer URL (GeoJSON)"),e.layerUrl,(e=>this.emitConfigs({layerUrl:e}))),this.textField(a("panel.codeProperty","Code property"),e.codeProperty,(e=>this.emitConfigs({codeProperty:e||"code"}))),this.textField(a("panel.nameProperty","Name property"),e.nameProperty,(e=>this.emitConfigs({nameProperty:e||"name"})))]:null,e&&"idFormat"in e?this.textField(a("panel.idFormat","Identifier format (fr-nir, bj-npi, digits-10…)"),e.idFormat,(e=>this.emitConfigs({idFormat:e}))):null,e&&"currencies"in e?[this.textField(a("panel.currencies","Currencies offered (XOF, EUR, USD)"),e.currencies,(e=>this.emitConfigs({currencies:e}))),this.textField(a("panel.currency","Default currency"),e.currency,(e=>this.emitConfigs({currency:e.toUpperCase()})))]:null,e&&"slotsUrl"in e?[this.textField(a("panel.slotsUrl","Slots URL (empty = opening rules)"),e.slotsUrl,(e=>this.emitConfigs({slotsUrl:e}))),this.textField(a("panel.slotDays","Open days (1 = Monday … 7 = Sunday)"),e.days,(e=>this.emitConfigs({days:e}))),this.textField(a("panel.slotFrom","Opens at"),e.from,(e=>this.emitConfigs({from:e}))),this.textField(a("panel.slotTo","Closes at"),e.to,(e=>this.emitConfigs({to:e}))),this.textField(a("panel.slotDuration","Slot length (minutes)"),e.duration,(e=>this.emitConfigs({duration:""===e?void 0:Number(e)}))),this.textField(a("panel.slotHorizon","Bookable days ahead"),e.horizonDays,(e=>this.emitConfigs({horizonDays:""===e?void 0:Number(e)}))),this.textField(a("panel.slotNotice","Notice (hours)"),e.noticeHours,(e=>this.emitConfigs({noticeHours:""===e?void 0:Number(e)}))),this.textField(a("panel.slotExclude","Closed dates (YYYY-MM-DD, comma-separated)"),e.exclude,(e=>this.emitConfigs({exclude:e})))]:null,e&&"tileUrl"in e?[this.textField(a("panel.center","Initial center (lat, lng)"),e.center,(e=>this.emitConfigs({center:e}))),this.textField(a("panel.zoom","Initial zoom"),e.zoom,(e=>this.emitConfigs({zoom:""===e?void 0:Number(e)}))),this.textField(a("panel.height","Height (px)"),e.height,(e=>this.emitConfigs({height:""===e?void 0:Number(e)}))),this.textField(a("panel.tileUrl","Tile URL"),e.tileUrl,(e=>this.emitConfigs({tileUrl:e}))),"shape"in e?this.textField(a("panel.shape","Shape (polygon or line)"),e.shape,(e=>this.emitConfigs({shape:"line"===e?"line":"polygon"}))):null]:null,e&&"accept"in e?this.textField(a("panel.accept","Accepted file types"),e.accept,(e=>this.emitConfigs({accept:e}))):null,e&&"uploadUrl"in e?this.textField(a("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])=>r("label",{class:"fk-props__field fk-props__field--inline",key:e},r("input",{type:"checkbox",checked:!0===t,onChange:t=>this.emitConfigs({[e]:t.target.checked})}),r("span",{class:"fk-props__label"},a(`panel.cfg.${e}`,e))))),e&&"content"in e?r("label",{class:"fk-props__field"},r("span",{class:"fk-props__label"},i("panel.content")),r("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 o=this.validationOf(e);return r("div",{class:"fk-props__vrule"},r("label",{class:"fk-props__field fk-props__field--inline"},r("input",{type:"checkbox",checked:!!o,onChange:t=>this.setValidation(e,t.target.checked)}),r("span",{class:"fk-props__label"},t)),o&&s?r("input",{class:"fk-props__input",type:s,placeholder:"number"===s?"value":"regex",value:null==o.value?"":String(o.value),onChange:t=>{const o=t.target.value;this.setValidation(e,!0,{value:"number"===s?""===o?void 0:Number(o):o||void 0})}}):null,o?this.textField(i("panel.errorMessage"),this.readLocalized(o.message),(t=>this.setValidation(e,!0,{message:this.localized(o.message,t)}))):null)}renderValidationTab(){var e;const t=this.brick.dataType,s=this.validationOf("custom");return r("section",{class:"fk-props__section"},this.validationRow("required",i("panel.required")),"string"===t?[this.validationRow("minLength",i("panel.minLength"),"number"),this.validationRow("maxLength",i("panel.maxLength"),"number"),this.validationRow("pattern",i("panel.pattern"),"text"),this.validationRow("email",i("panel.emailFormat")),this.validationRow("url",i("panel.urlFormat"))]:null,"number"===t?[this.validationRow("min",i("panel.min"),"number"),this.validationRow("max",i("panel.max"),"number")]:null,"array"===t?[this.validationRow("minItems",i("panel.minItems"),"number"),this.validationRow("maxItems",i("panel.maxItems"),"number")]:null,r("div",{class:"fk-props__vrule"},r("label",{class:"fk-props__field fk-props__field--inline"},r("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;"})}}),r("span",{class:"fk-props__label"},i("panel.custom"))),s?r("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(i("panel.fallbackMessage"),this.readLocalized(s.message),(e=>this.setValidation("custom",!0,{message:this.localized(s.message,e)}))):null))}renderStylesTab(){var e;return r("section",{class:"fk-props__section"},Object.entries(null!==(e=this.brick.styles)&&void 0!==e?e:{}).map((([e,t])=>r("div",{class:"fk-props__style-row",key:e},r("span",{class:"fk-props__style-key"},e),r("input",{class:"fk-props__input fk-props__input--grow",type:"text",value:String(null!=t?t:""),onChange:t=>this.emitStyles({[e]:t.target.value})}),r("button",{type:"button",class:"fk-props__remove",title:"Remove style",onClick:()=>this.emitStyles({[e]:void 0})},"✕")))),r("div",{class:"fk-props__style-row"},r("input",{class:"fk-props__input",type:"text",placeholder:i("panel.styleProperty"),value:this.newStyleKey,onInput:e=>this.newStyleKey=e.target.value}),r("input",{class:"fk-props__input fk-props__input--grow",type:"text",placeholder:i("panel.styleValue"),onChange:e=>{const t=e.target;this.addStyle(t.value),t.value=""}})))}render(){return r("div",{key:"01174db529d651b09463634845ae911c1cf42492",class:"fk-props"},r("header",{key:"4dcc00705612ad68377b3e9eaaf98fdd1f5b7eaa",class:"fk-props__header"},r("span",{key:"9b9997a18f063d4dc0b0a093a164f08ce4e40297",class:"fk-props__type"},this.brick.type),r("h4",{key:"833ffd9dd1c13cf37deb50224d972a846d623718",class:"fk-props__title"},a(`brick.${this.brick.id}.name`,this.brick.name))),r("div",{key:"f6b15967ec73701ecc6846bf146ca388e16b6438",class:"fk-props__tabs"},this.availableTabs().map((e=>r("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?r("section",{class:"fk-props__section"},r("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 i,c as e,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-Ddiv4Djm.js";import{registerDefaultBricks as f}from"./index.js";import{d as m}from"./p-C8yXvs3g.js";import{d as p}from"./p-DJxeNTfC.js";import{d as u}from"./p-DMLnAgzb.js";import{d as b}from"./p-DIW5FtAy.js";import{d as k}from"./p-BE5v8BN3.js";import{d as v}from"./p-xvN-OJAU.js";import{d as j}from"./p-Dt5tFknh.js";import{d as g}from"./p-B5gG7fHb.js";import{d as y}from"./p-DskfAsd6.js";import{d as E}from"./p-DtPhC0nx.js";import{d as O}from"./p-Di7uMflS.js";import{d as S}from"./p-YMLbA4H2.js";import{d as D}from"./p-BEft-cf2.js";import{d as x}from"./p-BGax6QkM.js";import{d as C}from"./p-CVsWXbzX.js";const w=s(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.formDataChange=e(this,"formDataChange"),this.formSubmit=e(this,"formSubmit"),this.validityChange=e(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 f(),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:i}=null!=t?t:this.runValidation(),e=`${s}|${Object.keys(i).sort().join(",")}`;e!==this.lastValidity&&(this.lastValidity=e,this.validityChange.emit({valid:s,errors:i}),this.reportToForm(s,i))}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 i,e,r;if(null===(i=this.internals)||void 0===i?void 0:i.setValidity)try{this.internals.setFormValue(JSON.stringify(this.publicData())),t?this.internals.setValidity({}):this.internals.setValidity({customError:!0},null!==(e=Object.values(s)[0])&&void 0!==e?e:a("form.invalid"),null!==(r=this.host.querySelector("input, select, textarea"))&&void 0!==r?r:void 0)}catch(t){}}handleHostFormSubmit(t){var s;const i=null===(s=this.internals)||void 0===s?void 0:s.form;i&&t.target===i&&(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 i of Object.keys(t.detail))s[i]=!0;this.touched=s;const{valid:i,errors:e}=this.runValidation();this.formDataChange.emit({data:this.publicData(),isValid:i,errors:e}),this.emitValidity({valid:i,errors:e})}applyValueEffects(t){var s,i;let e=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===(i=t.rules)||void 0===i?void 0:i.length))continue;const a=d(t.rules,this.dataMap(e));void 0!==a.value&&e[r]!==a.value&&(e=Object.assign(Object.assign({},e),{[r]:a.value}))}return e}async validate(){var t;const s={};for(const{brick:i}of h(this.effectiveSpec())){const e=null===(t=i.configs)||void 0===t?void 0:t.key;e&&(s[e]=!0)}this.touched=s;const i=this.runValidation(),e=Object.assign({},i.errors);let r=i.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(e,s.errors)}const o={valid:r,errors:e};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 i of t.detail.keys)s[i]=!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,i]of Object.entries(this.runValidation().errors))this.touched[s]&&(t[s]=i);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 F(){"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-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),w);break;case"fk-address-search":customElements.get(t(s))||m();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-drop-area":customElements.get(t(s))||j();break;case"fk-file-input":customElements.get(t(s))||g();break;case"fk-geo-map":customElements.get(t(s))||y();break;case"fk-select-input":customElements.get(t(s))||E();break;case"fk-signature-input":customElements.get(t(s))||O();break;case"fk-slot-picker":customElements.get(t(s))||S();break;case"fk-stepper":customElements.get(t(s))||D();break;case"fk-tabs":customElements.get(t(s))||x();break;case"fk-variable-picker":customElements.get(t(s))||C()}}))}F();export{w as F,F as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,h as t,H as r}from"./p-BDqOS1za.js";import{a as f}from"./p-D3ItRsmP.js";const a=class{constructor(t){e(this,t)}render(){return t(r,{key:"b90ba0b48a5b965c2d1e0f16732ef0664e370796"},t("div",{key:"c9858e4f28be65f58e5f02b86a2ae7b3c1e74b4c",class:"fk-empty"},t("p",{key:"625eae4fd358f64f729bd9c066f6ae8780fa4cb2",class:"fk-empty__title"},f("empty.title")),t("p",{key:"6b60a6f830e9938df4600209b3a5700a3bb7728c",class:"fk-empty__hint"},f("empty.hint"))))}};a.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{a as fk_empty_form}
|