@uipath/ui-widgets-validation-station 1.0.1-beta.7 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +111 -43
  2. package/dist/bindWcEvents.d.ts +25 -0
  3. package/dist/bindWcEvents.d.ts.map +1 -0
  4. package/dist/bindWcEvents.js +59 -0
  5. package/dist/bindWcEvents.js.map +1 -0
  6. package/dist/bucketArtifactsUtil.d.ts.map +1 -1
  7. package/dist/bucketArtifactsUtil.js +8 -1
  8. package/dist/bucketArtifactsUtil.js.map +1 -1
  9. package/dist/index.d.ts +9 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +7 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/loadValidationStationWc.d.ts +17 -0
  14. package/dist/loadValidationStationWc.d.ts.map +1 -1
  15. package/dist/loadValidationStationWc.js +37 -3
  16. package/dist/loadValidationStationWc.js.map +1 -1
  17. package/dist/subcomponents/CompactBusinessRules.d.ts +8 -0
  18. package/dist/subcomponents/CompactBusinessRules.d.ts.map +1 -0
  19. package/dist/subcomponents/CompactBusinessRules.js +55 -0
  20. package/dist/subcomponents/CompactBusinessRules.js.map +1 -0
  21. package/dist/subcomponents/CompactDocTypeField.d.ts +8 -0
  22. package/dist/subcomponents/CompactDocTypeField.d.ts.map +1 -0
  23. package/dist/subcomponents/CompactDocTypeField.js +42 -0
  24. package/dist/subcomponents/CompactDocTypeField.js.map +1 -0
  25. package/dist/subcomponents/CompactFieldsForm.d.ts +10 -0
  26. package/dist/subcomponents/CompactFieldsForm.d.ts.map +1 -0
  27. package/dist/subcomponents/CompactFieldsForm.js +87 -0
  28. package/dist/subcomponents/CompactFieldsForm.js.map +1 -0
  29. package/dist/subcomponents/CompactTableEditor.d.ts +11 -0
  30. package/dist/subcomponents/CompactTableEditor.d.ts.map +1 -0
  31. package/dist/subcomponents/CompactTableEditor.js +61 -0
  32. package/dist/subcomponents/CompactTableEditor.js.map +1 -0
  33. package/dist/subcomponents/DocumentViewer.d.ts +8 -0
  34. package/dist/subcomponents/DocumentViewer.d.ts.map +1 -0
  35. package/dist/subcomponents/DocumentViewer.js +52 -0
  36. package/dist/subcomponents/DocumentViewer.js.map +1 -0
  37. package/dist/subcomponents/shared.d.ts +35 -0
  38. package/dist/subcomponents/shared.d.ts.map +1 -0
  39. package/dist/subcomponents/shared.js +36 -0
  40. package/dist/subcomponents/shared.js.map +1 -0
  41. package/dist/subcomponents/types.d.ts +128 -0
  42. package/dist/subcomponents/types.d.ts.map +1 -0
  43. package/dist/subcomponents/types.js +2 -0
  44. package/dist/subcomponents/types.js.map +1 -0
  45. package/dist/subcomponents/useWcElement.d.ts +44 -0
  46. package/dist/subcomponents/useWcElement.d.ts.map +1 -0
  47. package/dist/subcomponents/useWcElement.js +40 -0
  48. package/dist/subcomponents/useWcElement.js.map +1 -0
  49. package/dist/types.d.ts +3 -3
  50. package/dist/types.d.ts.map +1 -1
  51. package/dist/useBucketArtifacts.d.ts +11 -3
  52. package/dist/useBucketArtifacts.d.ts.map +1 -1
  53. package/dist/useBucketArtifacts.js +15 -35
  54. package/dist/useBucketArtifacts.js.map +1 -1
  55. package/dist/useSubcomponentArtifacts.d.ts +44 -0
  56. package/dist/useSubcomponentArtifacts.d.ts.map +1 -0
  57. package/dist/useSubcomponentArtifacts.js +87 -0
  58. package/dist/useSubcomponentArtifacts.js.map +1 -0
  59. package/dist/useWcReady.d.ts +8 -0
  60. package/dist/useWcReady.d.ts.map +1 -0
  61. package/dist/useWcReady.js +23 -0
  62. package/dist/useWcReady.js.map +1 -0
  63. package/package.json +5 -4
@@ -0,0 +1,42 @@
1
+ import { useWcRef } from "../bindWcEvents.js";
2
+ import { DU_WC_TAGS } from "../loadValidationStationWc.js";
3
+ import { renderWcElement, resolveArtifacts } from "./shared.js";
4
+ import { useWcElement } from "./useWcElement.js";
5
+ /**
6
+ * React wrapper for `<ui-du-compact-doc-type-field-standalone-wc-element>` — a
7
+ * lightweight document-type selector. Share its store with a fields-form /
8
+ * viewer via a common `instanceId` so a document-type change propagates.
9
+ */
10
+ export const CompactDocTypeField = ({ instanceId, theme, language, isReadonly, persistent, className, style, options, onLoaded, onDocumentTypeChanged, onPanelOpenChange, ...dataSource }) => {
11
+ const { artifacts, error, wcReady, tag, commonProps } = useWcElement({
12
+ baseTag: DU_WC_TAGS.compactDocTypeField,
13
+ dataSource,
14
+ common: {
15
+ instanceId,
16
+ theme,
17
+ language,
18
+ isReadonly,
19
+ persistent,
20
+ className,
21
+ style,
22
+ },
23
+ });
24
+ const ref = useWcRef({
25
+ loaded: onLoaded,
26
+ documentTypeChanged: onDocumentTypeChanged,
27
+ panelOpenChange: onPanelOpenChange,
28
+ }, persistent);
29
+ const gate = resolveArtifacts(error, wcReady, artifacts);
30
+ if (!gate.ready)
31
+ return gate.fallback;
32
+ const { taxonomy, extractionResult, customizationInfo } = gate.artifacts;
33
+ const props = {
34
+ ...commonProps,
35
+ options,
36
+ taxonomy,
37
+ extractionResult,
38
+ customizationInfo,
39
+ };
40
+ return renderWcElement(tag, props, ref);
41
+ };
42
+ //# sourceMappingURL=CompactDocTypeField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompactDocTypeField.js","sourceRoot":"","sources":["../../src/subcomponents/CompactDocTypeField.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAuC,CAAC,EACtE,UAAU,EACV,KAAK,EACL,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,qBAAqB,EACrB,iBAAiB,EACjB,GAAG,UAAU,EACd,EAAE,EAAE;IACH,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC;QACnE,OAAO,EAAE,UAAU,CAAC,mBAAmB;QACvC,UAAU;QACV,MAAM,EAAE;YACN,UAAU;YACV,KAAK;YACL,QAAQ;YACR,UAAU;YACV,UAAU;YACV,SAAS;YACT,KAAK;SACN;KACF,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,QAAQ,CAClB;QACE,MAAM,EAAE,QAAQ;QAChB,mBAAmB,EAAE,qBAAqB;QAC1C,eAAe,EAAE,iBAAiB;KACnC,EACD,UAAU,CACX,CAAC;IAEF,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IACzD,IAAI,CAAC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtC,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;IAEzE,MAAM,KAAK,GAA6C;QACtD,GAAG,WAAW;QACd,OAAO;QACP,QAAQ;QACR,gBAAgB;QAChB,iBAAiB;KAClB,CAAC;IAEF,OAAO,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { CompactFieldsFormProps } from "./types.js";
2
+ /**
3
+ * React wrapper for `<ui-du-compact-fields-form-standalone-wc-element>` — the
4
+ * extraction-fields panel without a document viewer. Save-capable: when an
5
+ * `sdk` + `data` + folder id are available it auto-wires the submit / draft
6
+ * flows (like `ValidationStation`); otherwise handle the raw save-request
7
+ * events yourself.
8
+ */
9
+ export declare const CompactFieldsForm: React.FC<CompactFieldsFormProps>;
10
+ //# sourceMappingURL=CompactFieldsForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompactFieldsForm.d.ts","sourceRoot":"","sources":["../../src/subcomponents/CompactFieldsForm.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGzD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAqI9D,CAAC"}
@@ -0,0 +1,87 @@
1
+ import { useWcRef } from "../bindWcEvents.js";
2
+ import { DU_WC_TAGS } from "../loadValidationStationWc.js";
3
+ import { saveValidatedDataAsDraft, submitValidatedData, } from "../saveValidatedDataUtil.js";
4
+ import { renderWcElement, resolveArtifacts } from "./shared.js";
5
+ import { useWcElement } from "./useWcElement.js";
6
+ /**
7
+ * React wrapper for `<ui-du-compact-fields-form-standalone-wc-element>` — the
8
+ * extraction-fields panel without a document viewer. Save-capable: when an
9
+ * `sdk` + `data` + folder id are available it auto-wires the submit / draft
10
+ * flows (like `ValidationStation`); otherwise handle the raw save-request
11
+ * events yourself.
12
+ */
13
+ export const CompactFieldsForm = ({ sdk, data, folderId, artifacts: providedArtifacts, documentId: documentIdProp, instanceId, theme, language, isReadonly, persistent, className, style, options, save, enableSaveAsDraft = true, setFieldValueByPath, selectAndFocusFieldValueByPath, deleteFieldValueByPath, discardChanges, onLoaded, onDirtyChange, onDocumentTypeChanged, onExtractionResultChanged, onFieldValueSelected, onFieldValueChanged, onBusinessRulesEvaluated, onSetFieldValueByPathResult, onSelectAndFocusFieldValueByPathResult, onDeleteFieldValueByPathResult, onSaveResult, onSubmitComplete, onSaveAsDraftComplete, onReportExceptionComplete, onSaveValidatedDataRequest, onSaveValidatedDataAsDraftRequest, onSaveExceptionReportRequest, }) => {
14
+ const { artifacts, error, wcReady, tag, commonProps, canPersist, resolvedFolderId, } = useWcElement({
15
+ baseTag: DU_WC_TAGS.compactFieldsForm,
16
+ dataSource: {
17
+ sdk,
18
+ data,
19
+ folderId,
20
+ artifacts: providedArtifacts,
21
+ documentId: documentIdProp,
22
+ },
23
+ common: {
24
+ instanceId,
25
+ theme,
26
+ language,
27
+ isReadonly,
28
+ persistent,
29
+ className,
30
+ style,
31
+ },
32
+ });
33
+ // Auto-wire persistence only when a full self-fetching context is available
34
+ // (canPersist); otherwise the raw save-request callbacks are the only signal.
35
+ const handleSubmit = (request) => {
36
+ onSaveValidatedDataRequest?.(request);
37
+ if (canPersist) {
38
+ submitValidatedData(sdk, data, resolvedFolderId, request).then(onSubmitComplete);
39
+ }
40
+ };
41
+ const handleSaveAsDraft = (request) => {
42
+ onSaveValidatedDataAsDraftRequest?.(request);
43
+ if (canPersist) {
44
+ saveValidatedDataAsDraft(sdk, data, resolvedFolderId, request).then(onSaveAsDraftComplete);
45
+ }
46
+ };
47
+ const handleException = (request) => {
48
+ onSaveExceptionReportRequest?.(request);
49
+ const reason = request.exceptionReport?.Reason ?? "";
50
+ onReportExceptionComplete?.(request.documentId, reason);
51
+ };
52
+ const ref = useWcRef({
53
+ loaded: onLoaded,
54
+ dirty: onDirtyChange,
55
+ documentTypeChanged: onDocumentTypeChanged,
56
+ extractionResultChanged: onExtractionResultChanged,
57
+ fieldValueSelected: onFieldValueSelected,
58
+ fieldValueChanged: onFieldValueChanged,
59
+ businessRulesEvaluated: onBusinessRulesEvaluated,
60
+ setFieldValueByPathResult: onSetFieldValueByPathResult,
61
+ selectAndFocusFieldValueByPathResult: onSelectAndFocusFieldValueByPathResult,
62
+ deleteFieldValueByPathResult: onDeleteFieldValueByPathResult,
63
+ saveResult: onSaveResult,
64
+ saveValidatedDataRequest: handleSubmit,
65
+ saveValidatedDataAsDraftRequest: handleSaveAsDraft,
66
+ saveExceptionReportRequest: handleException,
67
+ }, persistent);
68
+ const gate = resolveArtifacts(error, wcReady, artifacts);
69
+ if (!gate.ready)
70
+ return gate.fallback;
71
+ const { taxonomy, extractionResult, customizationInfo } = gate.artifacts;
72
+ const props = {
73
+ ...commonProps,
74
+ enableSaveAsDraft,
75
+ options,
76
+ save,
77
+ discardChanges,
78
+ setFieldValueByPath,
79
+ selectAndFocusFieldValueByPath,
80
+ deleteFieldValueByPath,
81
+ taxonomy,
82
+ extractionResult,
83
+ customizationInfo,
84
+ };
85
+ return renderWcElement(tag, props, ref);
86
+ };
87
+ //# sourceMappingURL=CompactFieldsForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompactFieldsForm.js","sourceRoot":"","sources":["../../src/subcomponents/CompactFieldsForm.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,EAClE,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,SAAS,EAAE,iBAAiB,EAC5B,UAAU,EAAE,cAAc,EAC1B,UAAU,EACV,KAAK,EACL,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,IAAI,EACJ,iBAAiB,GAAG,IAAI,EACxB,mBAAmB,EACnB,8BAA8B,EAC9B,sBAAsB,EACtB,cAAc,EACd,QAAQ,EACR,aAAa,EACb,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,sCAAsC,EACtC,8BAA8B,EAC9B,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,iCAAiC,EACjC,4BAA4B,GAC7B,EAAE,EAAE;IACH,MAAM,EACJ,SAAS,EACT,KAAK,EACL,OAAO,EACP,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,mBAAmB,EAAE,qBAAqB;QAC1C,uBAAuB,EAAE,yBAAyB;QAClD,kBAAkB,EAAE,oBAAoB;QACxC,iBAAiB,EAAE,mBAAmB;QACtC,sBAAsB,EAAE,wBAAwB;QAChD,yBAAyB,EAAE,2BAA2B;QACtD,oCAAoC,EAClC,sCAAsC;QACxC,4BAA4B,EAAE,8BAA8B;QAC5D,UAAU,EAAE,YAAY;QACxB,wBAAwB,EAAE,YAAY;QACtC,+BAA+B,EAAE,iBAAiB;QAClD,0BAA0B,EAAE,eAAe;KAC5C,EACD,UAAU,CACX,CAAC;IAEF,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IACzD,IAAI,CAAC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtC,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;IAEzE,MAAM,KAAK,GAA2C;QACpD,GAAG,WAAW;QACd,iBAAiB;QACjB,OAAO;QACP,IAAI;QACJ,cAAc;QACd,mBAAmB;QACnB,8BAA8B;QAC9B,sBAAsB;QACtB,QAAQ;QACR,gBAAgB;QAChB,iBAAiB;KAClB,CAAC;IAEF,OAAO,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { CompactTableEditorProps } from "./types.js";
2
+ /**
3
+ * React wrapper for `<ui-du-compact-table-editor-standalone-wc-element>` — an
4
+ * inline editor for a single extracted table. Edit-only (no save flow): persist
5
+ * via `onExtractionResultChanged` / `onFieldValueChanged` / `onDirtyChange`. It
6
+ * renders a table only while a table field is selected in the store — select
7
+ * one via `selectAndFocusFieldValueByPath` (use `valueIndex: -1` to target the
8
+ * table itself) or from a sibling element sharing the same `instanceId`.
9
+ */
10
+ export declare const CompactTableEditor: React.FC<CompactTableEditorProps>;
11
+ //# sourceMappingURL=CompactTableEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompactTableEditor.d.ts","sourceRoot":"","sources":["../../src/subcomponents/CompactTableEditor.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAG1D;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAkFhE,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { useWcRef } from "../bindWcEvents.js";
2
+ import { DU_WC_TAGS } from "../loadValidationStationWc.js";
3
+ import { renderWcElement, resolveArtifacts } from "./shared.js";
4
+ import { useWcElement } from "./useWcElement.js";
5
+ /**
6
+ * React wrapper for `<ui-du-compact-table-editor-standalone-wc-element>` — an
7
+ * inline editor for a single extracted table. Edit-only (no save flow): persist
8
+ * via `onExtractionResultChanged` / `onFieldValueChanged` / `onDirtyChange`. It
9
+ * renders a table only while a table field is selected in the store — select
10
+ * one via `selectAndFocusFieldValueByPath` (use `valueIndex: -1` to target the
11
+ * table itself) or from a sibling element sharing the same `instanceId`.
12
+ */
13
+ export const CompactTableEditor = ({ instanceId, theme, language, isReadonly, persistent, className, style, options, isTableSelectionEnabled, isDrawingTableSelectionCells, applyTableSelection, setFieldValueByPath, selectAndFocusFieldValueByPath, deleteFieldValueByPath, discardChanges, onLoaded, onDirtyChange, onDocumentTypeChanged, onExtractionResultChanged, onFieldValueSelected, onFieldValueChanged, onBusinessRulesEvaluated, onSetFieldValueByPathResult, onSelectAndFocusFieldValueByPathResult, onDeleteFieldValueByPathResult, onTableSelectionEvent, onClosed, ...dataSource }) => {
14
+ const { artifacts, error, wcReady, tag, commonProps } = useWcElement({
15
+ baseTag: DU_WC_TAGS.compactTableEditor,
16
+ dataSource,
17
+ common: {
18
+ instanceId,
19
+ theme,
20
+ language,
21
+ isReadonly,
22
+ persistent,
23
+ className,
24
+ style,
25
+ },
26
+ });
27
+ const ref = useWcRef({
28
+ loaded: onLoaded,
29
+ dirty: onDirtyChange,
30
+ documentTypeChanged: onDocumentTypeChanged,
31
+ extractionResultChanged: onExtractionResultChanged,
32
+ fieldValueSelected: onFieldValueSelected,
33
+ fieldValueChanged: onFieldValueChanged,
34
+ businessRulesEvaluated: onBusinessRulesEvaluated,
35
+ setFieldValueByPathResult: onSetFieldValueByPathResult,
36
+ selectAndFocusFieldValueByPathResult: onSelectAndFocusFieldValueByPathResult,
37
+ deleteFieldValueByPathResult: onDeleteFieldValueByPathResult,
38
+ tableSelectionEvent: onTableSelectionEvent,
39
+ closed: onClosed,
40
+ }, persistent);
41
+ const gate = resolveArtifacts(error, wcReady, artifacts);
42
+ if (!gate.ready)
43
+ return gate.fallback;
44
+ const { taxonomy, extractionResult, customizationInfo } = gate.artifacts;
45
+ const props = {
46
+ ...commonProps,
47
+ isTableSelectionEnabled,
48
+ isDrawingTableSelectionCells,
49
+ applyTableSelection,
50
+ options,
51
+ discardChanges,
52
+ setFieldValueByPath,
53
+ selectAndFocusFieldValueByPath,
54
+ deleteFieldValueByPath,
55
+ taxonomy,
56
+ extractionResult,
57
+ customizationInfo,
58
+ };
59
+ return renderWcElement(tag, props, ref);
60
+ };
61
+ //# sourceMappingURL=CompactTableEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompactTableEditor.js","sourceRoot":"","sources":["../../src/subcomponents/CompactTableEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsC,CAAC,EACpE,UAAU,EACV,KAAK,EACL,QAAQ,EACR,U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AAI,CAAC,SAAS,CAAC;IAEzE,MAAM,KAAK,GAA4C;QACrD,GAAG,WAAW;QACd,uBAAuB;QACvB,4BAA4B;QAC5B,mBAAmB;QACnB,OAAO;QACP,cAAc;QACd,mBAAmB;QACnB,8BAA8B;QAC9B,sBAAsB;QACtB,QAAQ;QACR,gBAAgB;QAChB,iBAAiB;KAClB,CAAC;IAEF,OAAO,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { DocumentViewerProps } from "./types.js";
2
+ /**
3
+ * React wrapper for `<ui-du-document-viewer-standalone-wc-element>` — the
4
+ * document/text viewer with no fields form or save flow. Share its store with a
5
+ * fields-form / table-editor by passing the same `instanceId`.
6
+ */
7
+ export declare const DocumentViewer: React.FC<DocumentViewerProps>;
8
+ //# sourceMappingURL=DocumentViewer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentViewer.d.ts","sourceRoot":"","sources":["../../src/subcomponents/DocumentViewer.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGtD;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAoExD,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { useWcRef } from "../bindWcEvents.js";
2
+ import { DU_WC_TAGS } from "../loadValidationStationWc.js";
3
+ import { renderWcElement, resolveArtifacts } from "./shared.js";
4
+ import { useWcElement } from "./useWcElement.js";
5
+ /**
6
+ * React wrapper for `<ui-du-document-viewer-standalone-wc-element>` — the
7
+ * document/text viewer with no fields form or save flow. Share its store with a
8
+ * fields-form / table-editor by passing the same `instanceId`.
9
+ */
10
+ export const DocumentViewer = ({ instanceId, theme, language, isReadonly, persistent, className, style, options, selectAndFocusFieldValueByPath, goToPage, onReady, onLoaded, onTokensSelect, onTextModeChange, onSelectAndFocusFieldValueByPathResult, onGoToPageResult, onCurrentPageChange, onPageCountChange, ...dataSource }) => {
11
+ const { artifacts, error, wcReady, tag, commonProps } = useWcElement({
12
+ baseTag: DU_WC_TAGS.documentViewer,
13
+ dataSource,
14
+ common: {
15
+ instanceId,
16
+ theme,
17
+ language,
18
+ isReadonly,
19
+ persistent,
20
+ className,
21
+ style,
22
+ },
23
+ });
24
+ const ref = useWcRef({
25
+ ready: onReady,
26
+ loaded: onLoaded,
27
+ tokensSelect: onTokensSelect,
28
+ textModeChange: onTextModeChange,
29
+ selectAndFocusFieldValueByPathResult: onSelectAndFocusFieldValueByPathResult,
30
+ goToPageResult: onGoToPageResult,
31
+ currentPageChange: onCurrentPageChange,
32
+ pageCountChange: onPageCountChange,
33
+ }, persistent);
34
+ const gate = resolveArtifacts(error, wcReady, artifacts);
35
+ if (!gate.ready)
36
+ return gate.fallback;
37
+ const { text, original, dom, taxonomy, extractionResult, customizationInfo } = gate.artifacts;
38
+ const props = {
39
+ ...commonProps,
40
+ options,
41
+ text,
42
+ document: original,
43
+ dom,
44
+ taxonomy,
45
+ extractionResult,
46
+ customizationInfo,
47
+ selectAndFocusFieldValueByPath,
48
+ goToPage,
49
+ };
50
+ return renderWcElement(tag, props, ref);
51
+ };
52
+ //# sourceMappingURL=DocumentViewer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentViewer.js","sourceRoot":"","sources":["../../src/subcomponents/DocumentViewer.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkC,CAAC,EAC5D,UAAU,EACV,KAAK,EACL,QAAQ,EACR,UAAU,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,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { type CSSProperties, type ReactElement } from "react";
2
+ import type { WcRefCallback } from "../bindWcEvents.js";
3
+ import type { BucketArtifacts } from "../types.js";
4
+ /**
5
+ * Renders a standalone DU custom element by tag name with the given (typed)
6
+ * JSX props and ref callback.
7
+ *
8
+ * Rendering by string tag (rather than a computed JSX component) keeps the
9
+ * element out of React's component identity, so its inner Angular component is
10
+ * not torn down and recreated on every parent render. `Props` is the web
11
+ * component's JSX prop interface, so the caller's props object is fully
12
+ * type-checked at construction.
13
+ */
14
+ export declare function renderWcElement<Props extends object>(tag: string, props: Props, ref: WcRefCallback): ReactElement;
15
+ /**
16
+ * Bridges React's `CSSProperties` to the `string | Record<string, string |
17
+ * number>` shape the DU element JSX props declare for `style`. Safe: the two
18
+ * shapes are structurally compatible at runtime (both plain string/number maps
19
+ * keyed by CSS property); the cast only silences the nominal type difference.
20
+ */
21
+ export declare function wcStyle(style?: CSSProperties): Record<string, string | number> | undefined;
22
+ /**
23
+ * Resolves the shared loading/error gate for a subcomponent wrapper. Returns a
24
+ * discriminated result so the caller narrows `artifacts` to non-null without a
25
+ * `!` assertion: render `fallback` when not ready, otherwise use `artifacts`.
26
+ */
27
+ export type ArtifactsGate = {
28
+ ready: true;
29
+ artifacts: BucketArtifacts;
30
+ } | {
31
+ ready: false;
32
+ fallback: ReactElement;
33
+ };
34
+ export declare function resolveArtifacts(error: string | null, wcReady: boolean, artifacts: BucketArtifacts | null): ArtifactsGate;
35
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/subcomponents/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,SAAS,MAAM,EAClD,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,aAAa,GACjB,YAAY,CAEd;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,KAAK,CAAC,EAAE,aAAa,GACpB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,SAAS,CAE7C;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACrB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,eAAe,CAAA;CAAE,GAC3C;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,CAAC;AAE7C,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,eAAe,GAAG,IAAI,GAChC,aAAa,CAef"}
@@ -0,0 +1,36 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * Renders a standalone DU custom element by tag name with the given (typed)
4
+ * JSX props and ref callback.
5
+ *
6
+ * Rendering by string tag (rather than a computed JSX component) keeps the
7
+ * element out of React's component identity, so its inner Angular component is
8
+ * not torn down and recreated on every parent render. `Props` is the web
9
+ * component's JSX prop interface, so the caller's props object is fully
10
+ * type-checked at construction.
11
+ */
12
+ export function renderWcElement(tag, props, ref) {
13
+ return createElement(tag, { ...props, ref });
14
+ }
15
+ /**
16
+ * Bridges React's `CSSProperties` to the `string | Record<string, string |
17
+ * number>` shape the DU element JSX props declare for `style`. Safe: the two
18
+ * shapes are structurally compatible at runtime (both plain string/number maps
19
+ * keyed by CSS property); the cast only silences the nominal type difference.
20
+ */
21
+ export function wcStyle(style) {
22
+ return style;
23
+ }
24
+ export function resolveArtifacts(error, wcReady, artifacts) {
25
+ if (error) {
26
+ return {
27
+ ready: false,
28
+ fallback: createElement("div", null, `Failed to load document artifacts: ${error}`),
29
+ };
30
+ }
31
+ if (!artifacts || !wcReady) {
32
+ return { ready: false, fallback: createElement("div", null, "Loading...") };
33
+ }
34
+ return { ready: true, artifacts };
35
+ }
36
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/subcomponents/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAyC,MAAM,OAAO,CAAC;AAI7E;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAC7B,GAAW,EACX,KAAY,EACZ,GAAkB;IAElB,OAAO,aAAa,CAAC,GAAG,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CACrB,KAAqB;IAErB,OAAO,KAA+D,CAAC;AACzE,CAAC;AAWD,MAAM,UAAU,gBAAgB,CAC9B,KAAoB,EACpB,OAAgB,EAChB,SAAiC;IAEjC,IAAI,KAAK,EAAE,CAAC;QACV,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,aAAa,CACrB,KAAK,EACL,IAAI,EACJ,sCAAsC,KAAK,EAAE,CAC9C;SACF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,SAAS,IAAI,CAAC,OAAO,EAAE,CAAC;QAC3B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,EAAE,CAAC;IAC9E,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AACpC,CAAC"}
@@ -0,0 +1,128 @@
1
+ import type { BusinessRuleModel, DeleteFieldValueByPath, DeleteFieldValueByPathResult, DocumentViewerOptions, EvaluatedBusinessRulesForFieldValueDto, GoToPage, GoToPageResult, IFieldValueDetailsDto, ISaveResult, IValidationStationOptions, IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest, SelectAndFocusFieldValueByPath, SelectAndFocusFieldValueByPathResult, SetFieldValueByPath, SetFieldValueByPathResult } from "@uipath/du-validation-station-wc";
2
+ import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
3
+ import type { CSSProperties } from "react";
4
+ import type { SaveValidatedDataResult } from "../saveValidatedDataUtil.js";
5
+ import type { SubcomponentDataSource } from "../useSubcomponentArtifacts.js";
6
+ import type { ValidationStationLanguage } from "../types.js";
7
+ /** Theme variants accepted by every DU standalone element. */
8
+ export type WcTheme = "light" | "dark" | "light-hc" | "dark-hc";
9
+ /**
10
+ * Props common to every subcomponent wrapper: a data source (see
11
+ * {@link SubcomponentDataSource}), shared-store linking, and presentation.
12
+ */
13
+ export interface SubcomponentCommonProps extends SubcomponentDataSource {
14
+ /**
15
+ * Links this element's store to sibling standalone elements. Elements sharing
16
+ * the same `instanceId` mirror each other's edits, selection, and document
17
+ * type — pass the same value to a viewer + fields-form + table-editor to
18
+ * compose them side by side. Immutable once mounted (set as an attribute
19
+ * before the element connects). Omit for an isolated store.
20
+ */
21
+ instanceId?: string;
22
+ theme?: WcTheme;
23
+ language?: ValidationStationLanguage;
24
+ isReadonly?: boolean;
25
+ /**
26
+ * Render the persistent element variant, which survives portal/DOM
27
+ * detachment (e.g. tab switches) and is torn down via `forceDestroy()` when
28
+ * this React component unmounts. Defaults to `false`.
29
+ */
30
+ persistent?: boolean;
31
+ className?: string;
32
+ style?: CSSProperties;
33
+ }
34
+ /** Command inputs shared by the editable subcomponents. */
35
+ export interface SubcomponentCommandProps {
36
+ setFieldValueByPath?: SetFieldValueByPath;
37
+ selectAndFocusFieldValueByPath?: SelectAndFocusFieldValueByPath;
38
+ deleteFieldValueByPath?: DeleteFieldValueByPath;
39
+ discardChanges?: {
40
+ value: boolean;
41
+ };
42
+ }
43
+ /** Callbacks for the edit/state events shared by the compact VS-family elements. */
44
+ export interface SubcomponentStateEventProps {
45
+ onLoaded?: (loaded: boolean) => void;
46
+ onDirtyChange?: (dirty: boolean) => void;
47
+ onDocumentTypeChanged?: (documentTypeId: string) => void;
48
+ onExtractionResultChanged?: (result: DuFramework.ExtractionResult) => void;
49
+ onFieldValueSelected?: (details: IFieldValueDetailsDto) => void;
50
+ onFieldValueChanged?: (details: IFieldValueDetailsDto) => void;
51
+ onBusinessRulesEvaluated?: (rules: EvaluatedBusinessRulesForFieldValueDto[]) => void;
52
+ onSetFieldValueByPathResult?: (result: SetFieldValueByPathResult) => void;
53
+ onSelectAndFocusFieldValueByPathResult?: (result: SelectAndFocusFieldValueByPathResult) => void;
54
+ onDeleteFieldValueByPathResult?: (result: DeleteFieldValueByPathResult) => void;
55
+ }
56
+ export interface CompactFieldsFormProps extends SubcomponentCommonProps, SubcomponentCommandProps, SubcomponentStateEventProps {
57
+ options?: IValidationStationOptions;
58
+ /** Trigger a save; `{ validate: true }` validates before saving. */
59
+ save?: {
60
+ validate: boolean;
61
+ };
62
+ /** Expose a "Save as draft" action. */
63
+ enableSaveAsDraft?: boolean;
64
+ /** Result of a `save` command. */
65
+ onSaveResult?: (result: ISaveResult) => void;
66
+ /**
67
+ * Fired after the submit flow completes. Only auto-wired when the wrapper has
68
+ * an `sdk` + `data` + resolved `folderId`; otherwise handle the raw
69
+ * `onSaveValidatedDataRequest` event yourself.
70
+ */
71
+ onSubmitComplete?: (result: SaveValidatedDataResult) => void;
72
+ /** Fired after the save-as-draft flow completes (self-fetching mode only). */
73
+ onSaveAsDraftComplete?: (result: SaveValidatedDataResult) => void;
74
+ /** Fired when the user reports the document as an exception. */
75
+ onReportExceptionComplete?: (documentId: string, reason: string) => void;
76
+ /** Raw save-request event — use when driving persistence yourself. */
77
+ onSaveValidatedDataRequest?: (request: IVsSaveValidatedDataRequest) => void;
78
+ /** Raw save-as-draft-request event. */
79
+ onSaveValidatedDataAsDraftRequest?: (request: IVsSaveValidatedDataAsDraftRequest) => void;
80
+ /** Raw report-exception-request event. */
81
+ onSaveExceptionReportRequest?: (request: IVsSaveExceptionReportRequest) => void;
82
+ }
83
+ export interface CompactTableEditorProps extends SubcomponentCommonProps, SubcomponentCommandProps, SubcomponentStateEventProps {
84
+ options?: IValidationStationOptions;
85
+ /** Enable the PDF table-selection round-trip controls. */
86
+ isTableSelectionEnabled?: boolean;
87
+ isDrawingTableSelectionCells?: boolean;
88
+ /** Apply a host-driven PDF table selection result (`IPDFTableSelectionOutput`). */
89
+ applyTableSelection?: unknown;
90
+ /** Fires when the user starts/stops a PDF table selection (`IPDFTableSelectionInput | null`). */
91
+ onTableSelectionEvent?: (selection: unknown) => void;
92
+ /** Fires when the user closes the editor with "Done". */
93
+ onClosed?: () => void;
94
+ }
95
+ export interface CompactBusinessRulesProps extends SubcomponentCommonProps, SubcomponentCommandProps, SubcomponentStateEventProps {
96
+ options?: IValidationStationOptions;
97
+ /** Fires when the user expands (true) / collapses (false) the panel. */
98
+ onBusinessRulesToggle?: (expanded: boolean) => void;
99
+ /** Fires when the user clicks an evaluated rule. */
100
+ onBusinessRuleClick?: (rule: BusinessRuleModel) => void;
101
+ }
102
+ export interface DocumentViewerProps extends SubcomponentCommonProps {
103
+ options?: DocumentViewerOptions;
104
+ /** Select a field by path and focus its document reference in the viewer. */
105
+ selectAndFocusFieldValueByPath?: SelectAndFocusFieldValueByPath;
106
+ /** Navigate the document to a page. */
107
+ goToPage?: GoToPage;
108
+ onReady?: (ready: boolean) => void;
109
+ onLoaded?: (loaded: boolean) => void;
110
+ /** Fires when the user selects tokens in the viewer (`IPDFToken[]`). */
111
+ onTokensSelect?: (tokens: unknown[]) => void;
112
+ /** Fires when the viewer toggles between text and document (canvas) mode. */
113
+ onTextModeChange?: (isTextMode: boolean) => void;
114
+ onSelectAndFocusFieldValueByPathResult?: (result: SelectAndFocusFieldValueByPathResult) => void;
115
+ onGoToPageResult?: (result: GoToPageResult) => void;
116
+ /** Fires when the visible page changes. Detail is the 1-based page number. */
117
+ onCurrentPageChange?: (page: number) => void;
118
+ /** Fires once the document is ready. Detail is the total page count. */
119
+ onPageCountChange?: (pageCount: number) => void;
120
+ }
121
+ export interface CompactDocTypeFieldProps extends SubcomponentCommonProps {
122
+ options?: IValidationStationOptions;
123
+ onLoaded?: (loaded: boolean) => void;
124
+ onDocumentTypeChanged?: (documentTypeId: string) => void;
125
+ /** Fires when the dropdown panel opens (true) / closes (false). */
126
+ onPanelOpenChange?: (open: boolean) => void;
127
+ }
128
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/subcomponents/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,EACrB,sCAAsC,EACtC,QAAQ,EACR,cAAc,EACd,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,6BAA6B,EAC7B,kCAAkC,EAClC,2BAA2B,EAC3B,8BAA8B,EAC9B,oCAAoC,EACpC,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE7D,8DAA8D;AAC9D,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;AAEhE;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,sBAAsB;IACrE;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;I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AAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,qBAAqB,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/subcomponents/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,44 @@
1
+ import type { CSSProperties } from "react";
2
+ import { type ResolvedArtifacts, type SubcomponentDataSource } from "../useSubcomponentArtifacts.js";
3
+ import { ValidationStationLanguage } from "../types.js";
4
+ import type { WcTheme } from "./types.js";
5
+ /** Presentation + linking props common to every subcomponent wrapper. */
6
+ export interface WcElementCommon {
7
+ instanceId?: string;
8
+ theme?: WcTheme;
9
+ language?: ValidationStationLanguage;
10
+ isReadonly?: boolean;
11
+ persistent?: boolean;
12
+ className?: string;
13
+ style?: CSSProperties;
14
+ }
15
+ /** The common JSX prop block every DU standalone element accepts. */
16
+ interface WcCommonProps {
17
+ className?: string;
18
+ style?: Record<string, string | number>;
19
+ "instance-id"?: string;
20
+ documentId?: string;
21
+ theme: WcTheme;
22
+ language: ValidationStationLanguage;
23
+ isReadonly: boolean;
24
+ }
25
+ export interface WcElementState extends ResolvedArtifacts {
26
+ wcReady: boolean;
27
+ /** Tag actually rendered — the base tag, or its persistent variant. */
28
+ tag: string;
29
+ commonProps: WcCommonProps;
30
+ }
31
+ /**
32
+ * Shared plumbing for the five subcomponent wrappers: resolves artifacts
33
+ * (pre-fetched or self-fetched), waits for the **actually-rendered** element tag
34
+ * (base vs persistent variant) to upgrade, and assembles the common JSX prop
35
+ * block with defaults applied once. Each wrapper supplies only its event map
36
+ * (via {@link useWcRef}) and element-specific props.
37
+ */
38
+ export declare function useWcElement(params: {
39
+ baseTag: string;
40
+ dataSource: SubcomponentDataSource;
41
+ common: WcElementCommon;
42
+ }): WcElementState;
43
+ export {};
44
+ //# sourceMappingURL=useWcElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWcElement.d.ts","sourceRoot":"","sources":["../../src/subcomponents/useWcElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,qEAAqE;AACrE,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,yBAAyB,CAAC;IACpC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,OAAO,EAAE,OAAO,CAAC;IACjB,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,aAAa,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,sBAAsB,CAAC;IACnC,MAAM,EAAE,eAAe,CAAC;CACzB,GAAG,cAAc,CA8BjB"}
@@ -0,0 +1,40 @@
1
+ import { convertToPersistentTag } from "../loadValidationStationWc.js";
2
+ import { useSubcomponentArtifacts, } from "../useSubcomponentArtifacts.js";
3
+ import { ValidationStationLanguage } from "../types.js";
4
+ import { useWcReady } from "../useWcReady.js";
5
+ import { wcStyle } from "./shared.js";
6
+ /**
7
+ * Shared plumbing for the five subcomponent wrappers: resolves artifacts
8
+ * (pre-fetched or self-fetched), waits for the **actually-rendered** element tag
9
+ * (base vs persistent variant) to upgrade, and assembles the common JSX prop
10
+ * block with defaults applied once. Each wrapper supplies only its event map
11
+ * (via {@link useWcRef}) and element-specific props.
12
+ */
13
+ export function useWcElement(params) {
14
+ const { baseTag, dataSource, common } = params;
15
+ const persistent = common.persistent ?? false;
16
+ const tag = persistent ? convertToPersistentTag(baseTag) : baseTag;
17
+ const { artifacts, error, documentId, canPersist, resolvedFolderId } = useSubcomponentArtifacts(dataSource);
18
+ // Gate on the tag actually rendered, not always the base tag.
19
+ const wcReady = useWcReady(tag);
20
+ const commonProps = {
21
+ className: common.className,
22
+ style: wcStyle(common.style),
23
+ "instance-id": common.instanceId,
24
+ documentId,
25
+ theme: common.theme ?? "light",
26
+ language: common.language ?? ValidationStationLanguage.English,
27
+ isReadonly: common.isReadonly ?? false,
28
+ };
29
+ return {
30
+ artifacts,
31
+ error,
32
+ documentId,
33
+ canPersist,
34
+ resolvedFolderId,
35
+ wcReady,
36
+ tag,
37
+ commonProps,
38
+ };
39
+ }
40
+ //# sourceMappingURL=useWcElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWcElement.js","sourceRoot":"","sources":["../../src/subcomponents/useWcElement.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA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