@streamline-pulse/formkrafter-wc 0.21.0 → 0.22.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-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-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.d.ts +11 -0
- package/dist/components/fk-form-review.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-stepper.js +1 -1
- package/dist/components/fk-tabs.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-B6O_oDBF.js → p-B-a-xyQa.js} +1 -1
- package/dist/components/{p-B8iS2Kfi.js → p-Biq3Q5cJ.js} +1 -1
- package/dist/components/{p-BypSt35U.js → p-BmlOjFQ_.js} +7 -7
- package/dist/components/p-CQwP9ywY.js +1 -0
- package/dist/components/{p-D1eyzDcY.js → p-CcBrQb8q.js} +1 -1
- package/dist/components/{p-ChWBbax4.js → p-Chsmhqt6.js} +1 -1
- package/dist/components/{p-CWqEmA8p.js → p-D3gCWPK-.js} +1 -1
- package/dist/components/{p-HXtoKsEx.js → p-D6d40bcg.js} +1 -1
- package/dist/components/{p-BFUJv0mU.js → p-D9Bex5Kq.js} +1 -1
- package/dist/components/{p-D0vzpQtg.js → p-DFqFSvCD.js} +1 -1
- package/dist/components/{p-DumoqCP0.js → p-DHJ5oYz-.js} +1 -1
- package/dist/components/{p-1ONICifP.js → p-DyibkWjq.js} +1 -1
- package/dist/components/{p-Dseq5Dgf.js → p-LFS7Colb.js} +1 -1
- package/dist/components/p-S9JRhOzf.js +1 -0
- package/dist/components/p-bvpqmJPL.js +1 -0
- 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-899de018.entry.js +1 -0
- package/dist/formkrafter-wc/p-9c234229.entry.js +1 -0
- package/dist/formkrafter-wc/{p-CVCwXROd.js → p-CQdBfoyu.js} +7 -7
- package/dist/formkrafter-wc/{p-87fbf005.entry.js → p-e30767fc.entry.js} +1 -1
- package/dist/types/components/fk-brick-render/fk-brick-render.d.ts +6 -2
- package/dist/types/components/fk-form-render/fk-form-render.d.ts +7 -1
- package/dist/types/components/fk-form-review/fk-form-review.d.ts +22 -0
- package/dist/types/components.d.ts +114 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/events.d.ts +10 -0
- package/package.json +2 -2
- package/dist/components/p-Cw3ipjvW.js +0 -1
- package/dist/components/p-D5-mBASz.js +0 -1
- package/dist/components/p-DCIGY0T9.js +0 -1
- package/dist/formkrafter-wc/p-2d48803d.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as t,H as a}from"./p-C7Z9P9uL.js";import{
|
|
1
|
+
import{r as e,h as t,H as a}from"./p-C7Z9P9uL.js";import{a as r}from"./p-CQdBfoyu.js";const c=class{constructor(t){e(this,t)}render(){return t(a,{key:"a4d0825c084d261dfb8dc99a366a1e3f6e0c862d"},t("div",{key:"3e012165aec178ac8ea8e1211d891aa4d1d42d55",class:"fk-empty"},t("p",{key:"8c99ad57686aadd9d68a52767743ab907ec8e692",class:"fk-empty__title"},r("empty.title")),t("p",{key:"585262991b3497a3fcf430e26d53adc66ae9f74d",class:"fk-empty__hint"},r("empty.hint"))))}};c.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{c as fk_empty_form}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
-
import type { BrickSpec, Utils } from '@streamline-pulse/formkrafter-core';
|
|
3
|
-
import type { BrickConfigsChangeDetail, BrickPathDetail, BrickRulesChangeDetail, BrickStylesChangeDetail, BrickValidationsChangeDetail } from '../../utils/events';
|
|
2
|
+
import type { BrickSpec, FieldAnnotations, Utils } from '@streamline-pulse/formkrafter-core';
|
|
3
|
+
import type { BrickConfigsChangeDetail, BrickPathDetail, BrickRulesChangeDetail, BrickStylesChangeDetail, BrickReviewChangeDetail, BrickValidationsChangeDetail } from '../../utils/events';
|
|
4
4
|
export declare class FkBrickRender {
|
|
5
5
|
brickSpec: BrickSpec;
|
|
6
6
|
rootSpec?: BrickSpec;
|
|
@@ -12,6 +12,9 @@ export declare class FkBrickRender {
|
|
|
12
12
|
disabled: boolean;
|
|
13
13
|
selectedPath?: string;
|
|
14
14
|
errors: Record<string, string>;
|
|
15
|
+
annotations?: FieldAnnotations;
|
|
16
|
+
editableKeys?: string[];
|
|
17
|
+
reviewable: boolean;
|
|
15
18
|
locale?: string;
|
|
16
19
|
utils: Utils;
|
|
17
20
|
brickDataChange: EventEmitter<Record<string, unknown>>;
|
|
@@ -21,5 +24,6 @@ export declare class FkBrickRender {
|
|
|
21
24
|
brickRulesChange: EventEmitter<BrickRulesChangeDetail>;
|
|
22
25
|
brickRemove: EventEmitter<BrickPathDetail>;
|
|
23
26
|
brickDuplicate: EventEmitter<BrickPathDetail>;
|
|
27
|
+
brickReviewChange: EventEmitter<BrickReviewChangeDetail>;
|
|
24
28
|
render(): any;
|
|
25
29
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
-
import type { BrickSpec, ValidationResult } from '@streamline-pulse/formkrafter-core';
|
|
2
|
+
import type { FieldAnnotations, BrickSpec, ValidationResult } from '@streamline-pulse/formkrafter-core';
|
|
3
3
|
import type { DataChangeDetail, ValidityChangeDetail } from '../../utils/events';
|
|
4
4
|
export declare class FkFormRender {
|
|
5
5
|
host: HTMLElement;
|
|
@@ -13,6 +13,12 @@ export declare class FkFormRender {
|
|
|
13
13
|
submitLabel?: string;
|
|
14
14
|
selectedPath?: string;
|
|
15
15
|
locale?: string;
|
|
16
|
+
/** Reviewer notes shown under the matching fields (by brick key). */
|
|
17
|
+
annotations?: FieldAnnotations;
|
|
18
|
+
/** When set, only these keys stay editable; every other field renders read-only. */
|
|
19
|
+
editableKeys?: string[];
|
|
20
|
+
/** Used by fk-form-review: render the flag and comment controls under each field. */
|
|
21
|
+
reviewable: boolean;
|
|
16
22
|
formDataChange: EventEmitter<DataChangeDetail>;
|
|
17
23
|
formSubmit: EventEmitter<DataChangeDetail>;
|
|
18
24
|
validityChange: EventEmitter<ValidityChangeDetail>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import type { BrickSpec, FieldAnnotations } from '@streamline-pulse/formkrafter-core';
|
|
3
|
+
import type { BrickReviewChangeDetail, ReviewChangeDetail } from '../../utils/events';
|
|
4
|
+
/**
|
|
5
|
+
* A filled form, read-only, where a reviewer flags fields as incorrect and
|
|
6
|
+
* comments them. Rendering is delegated to fk-form-render; this element only
|
|
7
|
+
* holds the review map and emits it.
|
|
8
|
+
*/
|
|
9
|
+
export declare class FkFormReview {
|
|
10
|
+
spec: BrickSpec;
|
|
11
|
+
data?: Record<string, unknown>;
|
|
12
|
+
context?: Record<string, unknown>;
|
|
13
|
+
locale?: string;
|
|
14
|
+
/** Existing annotations to start from (by brick key). */
|
|
15
|
+
reviews?: FieldAnnotations;
|
|
16
|
+
reviewChange: EventEmitter<ReviewChangeDetail>;
|
|
17
|
+
current: FieldAnnotations;
|
|
18
|
+
componentWillLoad(): void;
|
|
19
|
+
syncReviews(next?: FieldAnnotations): void;
|
|
20
|
+
handleBrickReviewChange(event: CustomEvent<BrickReviewChangeDetail>): void;
|
|
21
|
+
render(): any;
|
|
22
|
+
}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* It contains typing information for all components that exist in this project.
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
|
-
import { BrickConfigsChangeDetail, BrickDropDetail, BrickPathDetail, BrickRulesChangeDetail, BrickStylesChangeDetail, BrickValidationsChangeDetail, DataChangeDetail, SpecChangeDetail, ValidityChangeDetail } from "./utils/events";
|
|
9
|
-
import { BrickMold, BrickSpec, UploadedFile, Utils, ValidationResult } from "@streamline-pulse/formkrafter-core";
|
|
10
|
-
export { BrickConfigsChangeDetail, BrickDropDetail, BrickPathDetail, BrickRulesChangeDetail, BrickStylesChangeDetail, BrickValidationsChangeDetail, DataChangeDetail, SpecChangeDetail, ValidityChangeDetail } from "./utils/events";
|
|
11
|
-
export { BrickMold, BrickSpec, UploadedFile, Utils, ValidationResult } from "@streamline-pulse/formkrafter-core";
|
|
8
|
+
import { BrickConfigsChangeDetail, BrickDropDetail, BrickPathDetail, BrickReviewChangeDetail, BrickRulesChangeDetail, BrickStylesChangeDetail, BrickValidationsChangeDetail, DataChangeDetail, ReviewChangeDetail, SpecChangeDetail, ValidityChangeDetail } from "./utils/events";
|
|
9
|
+
import { BrickMold, BrickSpec, FieldAnnotations, UploadedFile, Utils, ValidationResult } from "@streamline-pulse/formkrafter-core";
|
|
10
|
+
export { BrickConfigsChangeDetail, BrickDropDetail, BrickPathDetail, BrickReviewChangeDetail, BrickRulesChangeDetail, BrickStylesChangeDetail, BrickValidationsChangeDetail, DataChangeDetail, ReviewChangeDetail, SpecChangeDetail, ValidityChangeDetail } from "./utils/events";
|
|
11
|
+
export { BrickMold, BrickSpec, FieldAnnotations, UploadedFile, Utils, ValidationResult } from "@streamline-pulse/formkrafter-core";
|
|
12
12
|
export namespace Components {
|
|
13
13
|
interface FkBrickActions {
|
|
14
14
|
"path": string;
|
|
@@ -26,6 +26,7 @@ export namespace Components {
|
|
|
26
26
|
interface FkBrickNotFound {
|
|
27
27
|
}
|
|
28
28
|
interface FkBrickRender {
|
|
29
|
+
"annotations"?: FieldAnnotations;
|
|
29
30
|
"brickSpec": BrickSpec;
|
|
30
31
|
"data"?: Record<string, unknown>;
|
|
31
32
|
"dataMap"?: Record<string, unknown>;
|
|
@@ -37,6 +38,7 @@ export namespace Components {
|
|
|
37
38
|
* @default false
|
|
38
39
|
*/
|
|
39
40
|
"editable": boolean;
|
|
41
|
+
"editableKeys"?: string[];
|
|
40
42
|
/**
|
|
41
43
|
* @default {}
|
|
42
44
|
*/
|
|
@@ -50,6 +52,10 @@ export namespace Components {
|
|
|
50
52
|
* @default false
|
|
51
53
|
*/
|
|
52
54
|
"readOnly": boolean;
|
|
55
|
+
/**
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
"reviewable": boolean;
|
|
53
59
|
"rootSpec"?: BrickSpec;
|
|
54
60
|
"selectedPath"?: string;
|
|
55
61
|
"utils": Utils;
|
|
@@ -116,6 +122,10 @@ export namespace Components {
|
|
|
116
122
|
"spec"?: BrickSpec;
|
|
117
123
|
}
|
|
118
124
|
interface FkFormRender {
|
|
125
|
+
/**
|
|
126
|
+
* Reviewer notes shown under the matching fields (by brick key).
|
|
127
|
+
*/
|
|
128
|
+
"annotations"?: FieldAnnotations;
|
|
119
129
|
"context"?: Record<string, unknown>;
|
|
120
130
|
"data"?: Record<string, unknown>;
|
|
121
131
|
/**
|
|
@@ -126,11 +136,20 @@ export namespace Components {
|
|
|
126
136
|
* @default false
|
|
127
137
|
*/
|
|
128
138
|
"editable": boolean;
|
|
139
|
+
/**
|
|
140
|
+
* When set, only these keys stay editable; every other field renders read-only.
|
|
141
|
+
*/
|
|
142
|
+
"editableKeys"?: string[];
|
|
129
143
|
"locale"?: string;
|
|
130
144
|
/**
|
|
131
145
|
* @default false
|
|
132
146
|
*/
|
|
133
147
|
"readOnly": boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Used by fk-form-review: render the flag and comment controls under each field.
|
|
150
|
+
* @default false
|
|
151
|
+
*/
|
|
152
|
+
"reviewable": boolean;
|
|
134
153
|
"selectedPath"?: string;
|
|
135
154
|
/**
|
|
136
155
|
* @default false
|
|
@@ -141,6 +160,21 @@ export namespace Components {
|
|
|
141
160
|
"submitLabel"?: string;
|
|
142
161
|
"validate": () => Promise<ValidationResult>;
|
|
143
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* A filled form, read-only, where a reviewer flags fields as incorrect and
|
|
165
|
+
* comments them. Rendering is delegated to fk-form-render; this element only
|
|
166
|
+
* holds the review map and emits it.
|
|
167
|
+
*/
|
|
168
|
+
interface FkFormReview {
|
|
169
|
+
"context"?: Record<string, unknown>;
|
|
170
|
+
"data"?: Record<string, unknown>;
|
|
171
|
+
"locale"?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Existing annotations to start from (by brick key).
|
|
174
|
+
*/
|
|
175
|
+
"reviews"?: FieldAnnotations;
|
|
176
|
+
"spec": BrickSpec;
|
|
177
|
+
}
|
|
144
178
|
interface FkPropertyPanel {
|
|
145
179
|
"brick": BrickSpec;
|
|
146
180
|
"editLocale"?: string;
|
|
@@ -251,6 +285,10 @@ export interface FkFormRenderCustomEvent<T> extends CustomEvent<T> {
|
|
|
251
285
|
detail: T;
|
|
252
286
|
target: HTMLFkFormRenderElement;
|
|
253
287
|
}
|
|
288
|
+
export interface FkFormReviewCustomEvent<T> extends CustomEvent<T> {
|
|
289
|
+
detail: T;
|
|
290
|
+
target: HTMLFkFormReviewElement;
|
|
291
|
+
}
|
|
254
292
|
export interface FkPropertyPanelCustomEvent<T> extends CustomEvent<T> {
|
|
255
293
|
detail: T;
|
|
256
294
|
target: HTMLFkPropertyPanelElement;
|
|
@@ -322,6 +360,7 @@ declare global {
|
|
|
322
360
|
"brickRulesChange": BrickRulesChangeDetail;
|
|
323
361
|
"brickRemove": BrickPathDetail;
|
|
324
362
|
"brickDuplicate": BrickPathDetail;
|
|
363
|
+
"brickReviewChange": BrickReviewChangeDetail;
|
|
325
364
|
}
|
|
326
365
|
interface HTMLFkBrickRenderElement extends Components.FkBrickRender, HTMLStencilElement {
|
|
327
366
|
addEventListener<K extends keyof HTMLFkBrickRenderElementEventMap>(type: K, listener: (this: HTMLFkBrickRenderElement, ev: FkBrickRenderCustomEvent<HTMLFkBrickRenderElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -447,6 +486,28 @@ declare global {
|
|
|
447
486
|
prototype: HTMLFkFormRenderElement;
|
|
448
487
|
new (): HTMLFkFormRenderElement;
|
|
449
488
|
};
|
|
489
|
+
interface HTMLFkFormReviewElementEventMap {
|
|
490
|
+
"reviewChange": ReviewChangeDetail;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* A filled form, read-only, where a reviewer flags fields as incorrect and
|
|
494
|
+
* comments them. Rendering is delegated to fk-form-render; this element only
|
|
495
|
+
* holds the review map and emits it.
|
|
496
|
+
*/
|
|
497
|
+
interface HTMLFkFormReviewElement extends Components.FkFormReview, HTMLStencilElement {
|
|
498
|
+
addEventListener<K extends keyof HTMLFkFormReviewElementEventMap>(type: K, listener: (this: HTMLFkFormReviewElement, ev: FkFormReviewCustomEvent<HTMLFkFormReviewElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
499
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
500
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
501
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
502
|
+
removeEventListener<K extends keyof HTMLFkFormReviewElementEventMap>(type: K, listener: (this: HTMLFkFormReviewElement, ev: FkFormReviewCustomEvent<HTMLFkFormReviewElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
503
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
504
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
505
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
506
|
+
}
|
|
507
|
+
var HTMLFkFormReviewElement: {
|
|
508
|
+
prototype: HTMLFkFormReviewElement;
|
|
509
|
+
new (): HTMLFkFormReviewElement;
|
|
510
|
+
};
|
|
450
511
|
interface HTMLFkPropertyPanelElementEventMap {
|
|
451
512
|
"brickConfigsChange": BrickConfigsChangeDetail;
|
|
452
513
|
"brickValidationsChange": BrickValidationsChangeDetail;
|
|
@@ -565,6 +626,7 @@ declare global {
|
|
|
565
626
|
"fk-file-input": HTMLFkFileInputElement;
|
|
566
627
|
"fk-form-builder": HTMLFkFormBuilderElement;
|
|
567
628
|
"fk-form-render": HTMLFkFormRenderElement;
|
|
629
|
+
"fk-form-review": HTMLFkFormReviewElement;
|
|
568
630
|
"fk-property-panel": HTMLFkPropertyPanelElement;
|
|
569
631
|
"fk-rules-editor": HTMLFkRulesEditorElement;
|
|
570
632
|
"fk-select-input": HTMLFkSelectInputElement;
|
|
@@ -596,6 +658,7 @@ declare namespace LocalJSX {
|
|
|
596
658
|
interface FkBrickNotFound {
|
|
597
659
|
}
|
|
598
660
|
interface FkBrickRender {
|
|
661
|
+
"annotations"?: FieldAnnotations;
|
|
599
662
|
"brickSpec": BrickSpec;
|
|
600
663
|
"data"?: Record<string, unknown>;
|
|
601
664
|
"dataMap"?: Record<string, unknown>;
|
|
@@ -607,6 +670,7 @@ declare namespace LocalJSX {
|
|
|
607
670
|
* @default false
|
|
608
671
|
*/
|
|
609
672
|
"editable"?: boolean;
|
|
673
|
+
"editableKeys"?: string[];
|
|
610
674
|
/**
|
|
611
675
|
* @default {}
|
|
612
676
|
*/
|
|
@@ -616,6 +680,7 @@ declare namespace LocalJSX {
|
|
|
616
680
|
"onBrickDataChange"?: (event: FkBrickRenderCustomEvent<Record<string, unknown>>) => void;
|
|
617
681
|
"onBrickDuplicate"?: (event: FkBrickRenderCustomEvent<BrickPathDetail>) => void;
|
|
618
682
|
"onBrickRemove"?: (event: FkBrickRenderCustomEvent<BrickPathDetail>) => void;
|
|
683
|
+
"onBrickReviewChange"?: (event: FkBrickRenderCustomEvent<BrickReviewChangeDetail>) => void;
|
|
619
684
|
"onBrickRulesChange"?: (event: FkBrickRenderCustomEvent<BrickRulesChangeDetail>) => void;
|
|
620
685
|
"onBrickStylesChange"?: (event: FkBrickRenderCustomEvent<BrickStylesChangeDetail>) => void;
|
|
621
686
|
"onBrickValidationsChange"?: (event: FkBrickRenderCustomEvent<BrickValidationsChangeDetail>) => void;
|
|
@@ -627,6 +692,10 @@ declare namespace LocalJSX {
|
|
|
627
692
|
* @default false
|
|
628
693
|
*/
|
|
629
694
|
"readOnly"?: boolean;
|
|
695
|
+
/**
|
|
696
|
+
* @default false
|
|
697
|
+
*/
|
|
698
|
+
"reviewable"?: boolean;
|
|
630
699
|
"rootSpec"?: BrickSpec;
|
|
631
700
|
"selectedPath"?: string;
|
|
632
701
|
"utils": Utils;
|
|
@@ -697,6 +766,10 @@ declare namespace LocalJSX {
|
|
|
697
766
|
"spec"?: BrickSpec;
|
|
698
767
|
}
|
|
699
768
|
interface FkFormRender {
|
|
769
|
+
/**
|
|
770
|
+
* Reviewer notes shown under the matching fields (by brick key).
|
|
771
|
+
*/
|
|
772
|
+
"annotations"?: FieldAnnotations;
|
|
700
773
|
"context"?: Record<string, unknown>;
|
|
701
774
|
"data"?: Record<string, unknown>;
|
|
702
775
|
/**
|
|
@@ -707,6 +780,10 @@ declare namespace LocalJSX {
|
|
|
707
780
|
* @default false
|
|
708
781
|
*/
|
|
709
782
|
"editable"?: boolean;
|
|
783
|
+
/**
|
|
784
|
+
* When set, only these keys stay editable; every other field renders read-only.
|
|
785
|
+
*/
|
|
786
|
+
"editableKeys"?: string[];
|
|
710
787
|
/**
|
|
711
788
|
* The `id` of a `<form>` element to associate this element with.
|
|
712
789
|
*/
|
|
@@ -723,6 +800,11 @@ declare namespace LocalJSX {
|
|
|
723
800
|
* @default false
|
|
724
801
|
*/
|
|
725
802
|
"readOnly"?: boolean;
|
|
803
|
+
/**
|
|
804
|
+
* Used by fk-form-review: render the flag and comment controls under each field.
|
|
805
|
+
* @default false
|
|
806
|
+
*/
|
|
807
|
+
"reviewable"?: boolean;
|
|
726
808
|
"selectedPath"?: string;
|
|
727
809
|
/**
|
|
728
810
|
* @default false
|
|
@@ -731,6 +813,22 @@ declare namespace LocalJSX {
|
|
|
731
813
|
"spec": BrickSpec;
|
|
732
814
|
"submitLabel"?: string;
|
|
733
815
|
}
|
|
816
|
+
/**
|
|
817
|
+
* A filled form, read-only, where a reviewer flags fields as incorrect and
|
|
818
|
+
* comments them. Rendering is delegated to fk-form-render; this element only
|
|
819
|
+
* holds the review map and emits it.
|
|
820
|
+
*/
|
|
821
|
+
interface FkFormReview {
|
|
822
|
+
"context"?: Record<string, unknown>;
|
|
823
|
+
"data"?: Record<string, unknown>;
|
|
824
|
+
"locale"?: string;
|
|
825
|
+
"onReviewChange"?: (event: FkFormReviewCustomEvent<ReviewChangeDetail>) => void;
|
|
826
|
+
/**
|
|
827
|
+
* Existing annotations to start from (by brick key).
|
|
828
|
+
*/
|
|
829
|
+
"reviews"?: FieldAnnotations;
|
|
830
|
+
"spec": BrickSpec;
|
|
831
|
+
}
|
|
734
832
|
interface FkPropertyPanel {
|
|
735
833
|
"brick": BrickSpec;
|
|
736
834
|
"editLocale"?: string;
|
|
@@ -831,6 +929,7 @@ declare namespace LocalJSX {
|
|
|
831
929
|
"readOnly": boolean;
|
|
832
930
|
"disabled": boolean;
|
|
833
931
|
"selectedPath": string;
|
|
932
|
+
"reviewable": boolean;
|
|
834
933
|
"locale": string;
|
|
835
934
|
}
|
|
836
935
|
interface FkCodeEditorAttributes {
|
|
@@ -863,6 +962,10 @@ declare namespace LocalJSX {
|
|
|
863
962
|
"submitLabel": string;
|
|
864
963
|
"selectedPath": string;
|
|
865
964
|
"locale": string;
|
|
965
|
+
"reviewable": boolean;
|
|
966
|
+
}
|
|
967
|
+
interface FkFormReviewAttributes {
|
|
968
|
+
"locale": string;
|
|
866
969
|
}
|
|
867
970
|
interface FkPropertyPanelAttributes {
|
|
868
971
|
"path": string;
|
|
@@ -906,6 +1009,7 @@ declare namespace LocalJSX {
|
|
|
906
1009
|
"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] };
|
|
907
1010
|
"fk-form-builder": Omit<FkFormBuilder, keyof FkFormBuilderAttributes> & { [K in keyof FkFormBuilder & keyof FkFormBuilderAttributes]?: FkFormBuilder[K] } & { [K in keyof FkFormBuilder & keyof FkFormBuilderAttributes as `attr:${K}`]?: FkFormBuilderAttributes[K] } & { [K in keyof FkFormBuilder & keyof FkFormBuilderAttributes as `prop:${K}`]?: FkFormBuilder[K] };
|
|
908
1011
|
"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] };
|
|
1012
|
+
"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] };
|
|
909
1013
|
"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] };
|
|
910
1014
|
"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] };
|
|
911
1015
|
"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] };
|
|
@@ -930,6 +1034,12 @@ declare module "@stencil/core" {
|
|
|
930
1034
|
"fk-file-input": LocalJSX.IntrinsicElements["fk-file-input"] & JSXBase.HTMLAttributes<HTMLFkFileInputElement>;
|
|
931
1035
|
"fk-form-builder": LocalJSX.IntrinsicElements["fk-form-builder"] & JSXBase.HTMLAttributes<HTMLFkFormBuilderElement>;
|
|
932
1036
|
"fk-form-render": LocalJSX.IntrinsicElements["fk-form-render"] & JSXBase.HTMLAttributes<HTMLFkFormRenderElement>;
|
|
1037
|
+
/**
|
|
1038
|
+
* A filled form, read-only, where a reviewer flags fields as incorrect and
|
|
1039
|
+
* comments them. Rendering is delegated to fk-form-render; this element only
|
|
1040
|
+
* holds the review map and emits it.
|
|
1041
|
+
*/
|
|
1042
|
+
"fk-form-review": LocalJSX.IntrinsicElements["fk-form-review"] & JSXBase.HTMLAttributes<HTMLFkFormReviewElement>;
|
|
933
1043
|
"fk-property-panel": LocalJSX.IntrinsicElements["fk-property-panel"] & JSXBase.HTMLAttributes<HTMLFkPropertyPanelElement>;
|
|
934
1044
|
"fk-rules-editor": LocalJSX.IntrinsicElements["fk-rules-editor"] & JSXBase.HTMLAttributes<HTMLFkRulesEditorElement>;
|
|
935
1045
|
"fk-select-input": LocalJSX.IntrinsicElements["fk-select-input"] & JSXBase.HTMLAttributes<HTMLFkSelectInputElement>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export type { AnyBrick } from './registry/registry';
|
|
|
6
6
|
export { createBrick } from './registry/create-brick';
|
|
7
7
|
export type { WcBrickConfigs, WcBrickProps, BrickRenderFn } from './registry/create-brick';
|
|
8
8
|
export { registerDefaultBricks, textInputBrick, emailBrick, passwordBrick, urlBrick, phoneBrick, textareaBrick, numberBrick, dateBrick, timeBrick, datetimeBrick, selectBrick, multiSelectBrick, radioBrick, selectBoxesBrick, checkboxBrick, tagsBrick, signatureBrick, addressBrick, codeBrick, fileBrick, dataGridBrick, hiddenBrick, contentBrick, recapBrick, nestedFormBrick, groupBrick, rowBrick, columnBrick, stepperBrick, tabsBrick, } from './registry/default-bricks';
|
|
9
|
-
export type { BrickDropDetail, BrickConfigsChangeDetail, BrickStylesChangeDetail, BrickValidationsChangeDetail, BrickRulesChangeDetail, BrickPathDetail, SpecChangeDetail, DataChangeDetail, } from './utils/events';
|
|
9
|
+
export type { BrickDropDetail, BrickConfigsChangeDetail, BrickStylesChangeDetail, BrickValidationsChangeDetail, BrickRulesChangeDetail, BrickPathDetail, SpecChangeDetail, DataChangeDetail, BrickReviewChangeDetail, ReviewChangeDetail, } from './utils/events';
|
|
10
10
|
export { setFkTranslations, fkT, fkTOr, frFkTranslations } from './i18n/i18n';
|
|
11
11
|
export type { FkTranslations } from './i18n/i18n';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FieldAnnotation, FieldAnnotations } from '@streamline-pulse/formkrafter-core';
|
|
1
2
|
import type { BrickBaseConfigs, BrickMold, BrickSpec, BrickStyles, Operation, Rule, Validation } from '@streamline-pulse/formkrafter-core';
|
|
2
3
|
export interface BrickDropDetail {
|
|
3
4
|
source: 'new' | 'move';
|
|
@@ -30,6 +31,15 @@ export interface SpecChangeDetail {
|
|
|
30
31
|
patches: Operation[];
|
|
31
32
|
inverse: Operation[];
|
|
32
33
|
}
|
|
34
|
+
export interface BrickReviewChangeDetail {
|
|
35
|
+
key: string;
|
|
36
|
+
annotation: FieldAnnotation;
|
|
37
|
+
}
|
|
38
|
+
export interface ReviewChangeDetail {
|
|
39
|
+
reviews: FieldAnnotations;
|
|
40
|
+
/** Keys flagged as incorrect, in spec order of first flagging. */
|
|
41
|
+
flagged: string[];
|
|
42
|
+
}
|
|
33
43
|
export interface ValidityChangeDetail {
|
|
34
44
|
valid: boolean;
|
|
35
45
|
errors: Record<string, string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamline-pulse/formkrafter-wc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.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.22.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@stencil/core": "^4.43.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t,p as s,H as i,c as e,h as a}from"./p-B29HakDD.js";import{g as r,r as h,a as n,w as o}from"./p-BypSt35U.js";import{g as l}from"./p-BMtyMU2R.js";import{d as c}from"./p-1ONICifP.js";import{d}from"./p-BTxz9ZnS.js";import{d as p}from"./p-B6O_oDBF.js";const k=s(class extends i{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.path="0",this.editable=!1,this.readOnly=!1,this.disabled=!1,this.errors={}}render(){var t,s,i,e,c;const d=this.brickSpec;if(!d)return null;const p=l(d.type,d.id);if(!p)return a("fk-brick-not-found",null,`${d.type}:${d.id}`);const k=this.editable&&(null===(t=d.editable)||void 0===t||t),u=r(d.rules,this.dataMap);if(!k&&!0===u.hidden)return null;const f="panel"===d.type||"collection"===d.type,b=(null!==(s=d.children)&&void 0!==s?s:[]).map(((t,s)=>{var i;return a("fk-brick-render",{brickSpec:t,rootSpec:null!==(i=this.rootSpec)&&void 0!==i?i:this.brickSpec,data:this.data,dataMap:this.dataMap,errors:this.errors,locale:this.locale,path:`${this.path}.${s}`,editable:this.editable,readOnly:this.readOnly,disabled:this.disabled,selectedPath:this.selectedPath,utils:this.utils})}));k&&f&&b.push(a("fk-drop-area",{path:this.path}));const m={brickSpec:d,configsForm:d.configsForm,configs:h(d.configs,this.locale),locale:this.locale,styles:null!==(i=d.styles)&&void 0!==i?i:{},data:n(d,this.data),dataMap:this.dataMap,rootSpec:null!==(e=this.rootSpec)&&void 0!==e?e:this.brickSpec,error:(null===(c=d.configs)||void 0===c?void 0:c.key)?this.errors[d.configs.key]:void 0,disabled:!k&&(this.disabled||!0===u.disabled),readOnly:!k&&this.readOnly,path:this.path,editable:k,children:b,validations:d.validations,rules:d.rules,utils:this.utils,onDataChange:t=>{const s=o(d,t);void 0!==s&&this.brickDataChange.emit(s)},onConfigsChange:(t,s)=>this.brickConfigsChange.emit({configs:t,path:null!=s?s:this.path}),onStylesChange:(t,s)=>this.brickStylesChange.emit({styles:t,path:null!=s?s:this.path}),onValidationsChange:(t,s)=>this.brickValidationsChange.emit({validations:t,path:null!=s?s:this.path}),onRulesChange:(t,s)=>this.brickRulesChange.emit({rules:t,path:null!=s?s:this.path}),onDelete:t=>this.brickRemove.emit({path:t}),onDuplicate:t=>this.brickDuplicate.emit({path:t})},g=k?p.renderBuilder(m):p.render(m);return k&&"0"!==this.path?a("fk-brick-actions",{path:this.path,selected:this.path===this.selectedPath},g):g}},[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],locale:[1],utils:[16]}]);function u(){"undefined"!=typeof customElements&&["fk-brick-render","fk-brick-actions","fk-brick-not-found","fk-brick-render","fk-drop-area"].forEach((s=>{switch(s){case"fk-brick-render":customElements.get(t(s))||customElements.define(t(s),k);break;case"fk-brick-actions":customElements.get(t(s))||c();break;case"fk-brick-not-found":customElements.get(t(s))||d();break;case"fk-brick-render":customElements.get(t(s))||u();break;case"fk-drop-area":customElements.get(t(s))||p()}}))}u();export{k as F,u as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t,p as s,H as i,c as e,h as r}from"./p-B29HakDD.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-BypSt35U.js";import{registerDefaultBricks as f}from"./index.js";import{d as m}from"./p-1ONICifP.js";import{d as u}from"./p-BTxz9ZnS.js";import{d as p}from"./p-Cw3ipjvW.js";import{d as b}from"./p-CIGtlYQn.js";import{d as k}from"./p-D0vzpQtg.js";import{d as v}from"./p-B6O_oDBF.js";import{d as j}from"./p-HXtoKsEx.js";import{d as y}from"./p-ChWBbax4.js";import{d as g}from"./p-BFUJv0mU.js";import{d as O}from"./p-D1eyzDcY.js";import{d as S}from"./p-DCIGY0T9.js";const E=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.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(),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],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 D(){"undefined"!=typeof customElements&&["fk-form-render","fk-brick-actions","fk-brick-not-found","fk-brick-render","fk-code-editor","fk-data-grid","fk-drop-area","fk-file-input","fk-select-input","fk-signature-input","fk-stepper","fk-tabs"].forEach((s=>{switch(s){case"fk-form-render":customElements.get(t(s))||customElements.define(t(s),E);break;case"fk-brick-actions":customElements.get(t(s))||m();break;case"fk-brick-not-found":customElements.get(t(s))||u();break;case"fk-brick-render":customElements.get(t(s))||p();break;case"fk-code-editor":customElements.get(t(s))||b();break;case"fk-data-grid":customElements.get(t(s))||k();break;case"fk-drop-area":customElements.get(t(s))||v();break;case"fk-file-input":customElements.get(t(s))||j();break;case"fk-select-input":customElements.get(t(s))||y();break;case"fk-signature-input":customElements.get(t(s))||g();break;case"fk-stepper":customElements.get(t(s))||O();break;case"fk-tabs":customElements.get(t(s))||S()}}))}D();export{E as F,D as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t,p as s,H as a,c as e,h as i}from"./p-B29HakDD.js";import{m as o,v as r}from"./p-BypSt35U.js";const n=s(class extends a{constructor(t){super(),!1!==t&&this.__registerHost(),this.stepTouch=e(this,"stepTouch"),this.tabLabels=[],this.editable=!1,this.active=0}clampActive(){this.active>Math.max(this.tabLabels.length-1,0)&&(this.active=0)}componentDidRender(){const t=this.host.querySelector(".fk-tabs__body");t&&Array.from(t.children).forEach(((t,s)=>{const a=t;this.editable?a.style.removeProperty("display"):a.style.display=s===this.active?"":"none"}))}validateTabs(){var t,s;return!0===(null===(s=null===(t=this.spec)||void 0===t?void 0:t.configs)||void 0===s?void 0:s.validateTabs)}tabSpec(t){var s,a,e;const i=null===(a=null===(s=this.spec)||void 0===s?void 0:s.children)||void 0===a?void 0:a[t];if(i&&this.spec)return(null===(e=this.tabCache)||void 0===e?void 0:e.source)!==this.spec&&(this.tabCache={source:this.spec,specs:[]}),this.tabCache.specs[t]||(this.tabCache.specs[t]={type:"panel",id:"tab",name:"Tab",configs:{key:`tab_${t}`},children:[i]}),this.tabCache.specs[t]}tabKeys(t){var s,a,e;const i=null===(a=null===(s=this.spec)||void 0===s?void 0:s.children)||void 0===a?void 0:a[t];if(!i)return[];const r=[];for(const t of o(i))(null===(e=t.configs)||void 0===e?void 0:e.key)&&r.push(t.configs.key);return r}tabValid(t){var s;const a=this.tabSpec(t);if(!a)return!0;const e=Object.fromEntries(Object.entries(null!==(s=this.dataMap)&&void 0!==s?s:{}).filter((([,t])=>""!==t&&null!=t)));return r(a,e,this.locale).valid}goToTab(t){t!==this.active&&(this.editable||!this.validateTabs()||this.tabValid(this.active)?this.active=t:this.stepTouch.emit({keys:this.tabKeys(this.active)}))}render(){return i("div",{key:"ebded73697ab12ae23d267ea30437129b10efffa",class:"fk-tabs"},i("div",{key:"b027f709c510a5ba1f2b38fdd20b7b131cf5888c",class:"fk-tabs__nav",role:"tablist"},this.tabLabels.map(((t,s)=>i("button",{key:`${s}-${t}`,type:"button",role:"tab","aria-selected":s===this.active?"true":"false",tabIndex:s===this.active?0:-1,class:{"fk-tabs__tab":!0,"fk-tabs__tab--active":s===this.active},onKeyDown:t=>{const a=this.tabLabels.length;!a||"ArrowRight"!==t.key&&"ArrowLeft"!==t.key||(t.preventDefault(),this.goToTab((s+("ArrowRight"===t.key?1:-1)+a)%a),requestAnimationFrame((()=>{var t;null===(t=this.host.querySelector(".fk-tabs__tab--active"))||void 0===t||t.focus()})))},onClick:t=>{t.preventDefault(),this.goToTab(s)}},t)))),i("div",{key:"ec7ed61a3f1f126268e2f1e0dfacfdb85dc542cd",class:"fk-tabs__body"},i("slot",{key:"4e86782cfe37f893992787265fdc764367672f67"})))}get host(){return this}static get watchers(){return{tabLabels:[{clampActive:0}]}}static get style(){return".sc-fk-tabs-h{display:block}.fk-tabs.sc-fk-tabs{display:flex;flex-direction:column;gap:var(--fk-spacing)}.fk-tabs__nav.sc-fk-tabs{display:flex;flex-wrap:wrap;gap:2px;border-bottom:1px solid var(--fk-color-border)}.fk-tabs__tab.sc-fk-tabs{font:inherit;font-size:0.85rem;font-weight:500;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);min-height:24px;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-tabs__tab.sc-fk-tabs:hover{color:var(--fk-color-text)}.fk-tabs__tab--active.sc-fk-tabs{color:var(--fk-color-primary);border-bottom-color:var(--fk-color-primary);font-weight:600}"}},[262,"fk-tabs",{tabLabels:[16],editable:[4],spec:[16],dataMap:[16],locale:[1],active:[32]},void 0,{tabLabels:[{clampActive:0}]}]);function c(){"undefined"!=typeof customElements&&["fk-tabs"].forEach((s=>{"fk-tabs"===s&&(customElements.get(t(s))||customElements.define(t(s),n))}))}c();export{n as F,c as d}
|