@uipath/ui-widgets-validation-station 1.0.1-beta.7 → 1.1.0-rc.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/README.md +388 -127
- package/dist/ValidationStation.d.ts +12 -0
- package/dist/ValidationStation.d.ts.map +1 -1
- package/dist/ValidationStation.js +72 -49
- package/dist/ValidationStation.js.map +1 -1
- package/dist/ValidationStation.stories.d.ts.map +1 -1
- package/dist/ValidationStation.stories.js +30 -19
- package/dist/ValidationStation.stories.js.map +1 -1
- package/dist/bindWcEvents.d.ts +25 -0
- package/dist/bindWcEvents.d.ts.map +1 -0
- package/dist/bindWcEvents.js +59 -0
- package/dist/bindWcEvents.js.map +1 -0
- package/dist/bucketArtifactsUtil.d.ts +13 -3
- package/dist/bucketArtifactsUtil.d.ts.map +1 -1
- package/dist/bucketArtifactsUtil.js +50 -33
- package/dist/bucketArtifactsUtil.js.map +1 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/loadValidationStationWc.d.ts +73 -4
- package/dist/loadValidationStationWc.d.ts.map +1 -1
- package/dist/loadValidationStationWc.js +104 -9
- package/dist/loadValidationStationWc.js.map +1 -1
- package/dist/saveHandlers.d.ts +19 -0
- package/dist/saveHandlers.d.ts.map +1 -0
- package/dist/saveHandlers.js +41 -0
- package/dist/saveHandlers.js.map +1 -0
- package/dist/saveValidatedDataUtil.d.ts +2 -2
- package/dist/saveValidatedDataUtil.d.ts.map +1 -1
- package/dist/saveValidatedDataUtil.js +32 -22
- package/dist/saveValidatedDataUtil.js.map +1 -1
- package/dist/subcomponents/CompactBusinessRules.d.ts +8 -0
- package/dist/subcomponents/CompactBusinessRules.d.ts.map +1 -0
- package/dist/subcomponents/CompactBusinessRules.js +55 -0
- package/dist/subcomponents/CompactBusinessRules.js.map +1 -0
- package/dist/subcomponents/CompactDocTypeField.d.ts +8 -0
- package/dist/subcomponents/CompactDocTypeField.d.ts.map +1 -0
- package/dist/subcomponents/CompactDocTypeField.js +42 -0
- package/dist/subcomponents/CompactDocTypeField.js.map +1 -0
- package/dist/subcomponents/CompactFieldsForm.d.ts +10 -0
- package/dist/subcomponents/CompactFieldsForm.d.ts.map +1 -0
- package/dist/subcomponents/CompactFieldsForm.js +68 -0
- package/dist/subcomponents/CompactFieldsForm.js.map +1 -0
- package/dist/subcomponents/CompactTableEditor.d.ts +11 -0
- package/dist/subcomponents/CompactTableEditor.d.ts.map +1 -0
- package/dist/subcomponents/CompactTableEditor.js +61 -0
- package/dist/subcomponents/CompactTableEditor.js.map +1 -0
- package/dist/subcomponents/DocumentViewer.d.ts +8 -0
- package/dist/subcomponents/DocumentViewer.d.ts.map +1 -0
- package/dist/subcomponents/DocumentViewer.js +52 -0
- package/dist/subcomponents/DocumentViewer.js.map +1 -0
- package/dist/subcomponents/shared.d.ts +35 -0
- package/dist/subcomponents/shared.d.ts.map +1 -0
- package/dist/subcomponents/shared.js +36 -0
- package/dist/subcomponents/shared.js.map +1 -0
- package/dist/subcomponents/types.d.ts +82 -0
- package/dist/subcomponents/types.d.ts.map +1 -0
- package/dist/subcomponents/types.js +2 -0
- package/dist/subcomponents/types.js.map +1 -0
- package/dist/subcomponents/useWcElement.d.ts +43 -0
- package/dist/subcomponents/useWcElement.d.ts.map +1 -0
- package/dist/subcomponents/useWcElement.js +38 -0
- package/dist/subcomponents/useWcElement.js.map +1 -0
- package/dist/types.d.ts +153 -34
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +15 -0
- package/dist/types.js.map +1 -1
- package/dist/urlUtil.d.ts +9 -0
- package/dist/urlUtil.d.ts.map +1 -0
- package/dist/urlUtil.js +11 -0
- package/dist/urlUtil.js.map +1 -0
- package/dist/useDuDocumentArtifacts.d.ts +12 -0
- package/dist/useDuDocumentArtifacts.d.ts.map +1 -0
- package/dist/useDuDocumentArtifacts.js +11 -0
- package/dist/useDuDocumentArtifacts.js.map +1 -0
- package/dist/useResolvedArtifacts.d.ts +41 -0
- package/dist/useResolvedArtifacts.d.ts.map +1 -0
- package/dist/useResolvedArtifacts.js +85 -0
- package/dist/useResolvedArtifacts.js.map +1 -0
- package/dist/useWcReady.d.ts +12 -0
- package/dist/useWcReady.d.ts.map +1 -0
- package/dist/useWcReady.js +31 -0
- package/dist/useWcReady.js.map +1 -0
- package/dist/utils/telemetryUtils.d.ts +3 -0
- package/dist/utils/telemetryUtils.d.ts.map +1 -0
- package/dist/utils/telemetryUtils.js +10 -0
- package/dist/utils/telemetryUtils.js.map +1 -0
- package/package.json +6 -5
- package/dist/useBucketArtifacts.d.ts +0 -8
- package/dist/useBucketArtifacts.d.ts.map +0 -1
- package/dist/useBucketArtifacts.js +0 -39
- package/dist/useBucketArtifacts.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompactFieldsForm.js","sourceRoot":"","sources":["../../src/subcomponents/CompactFieldsForm.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,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,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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,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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AAI,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,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,EACV,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,8BAA8B,EAC9B,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,sCAAsC,EACtC,gBAAgB,EAChB,mBAAmB,EACnB,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,cAAc;QAClC,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,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,QAAQ;QAChB,YAAY,EAAE,cAAc;QAC5B,cAAc,EAAE,gBAAgB;QAChC,oCAAoC,EAClC,sCAAsC;QACxC,cAAc,EAAE,gBAAgB;QAChC,iBAAiB,EAAE,mBAAmB;QACtC,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,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAC1E,IAAI,CAAC,SAAS,CAAC;IAEjB,MAAM,KAAK,GAAwC;QACjD,GAAG,WAAW;QACd,OAAO;QACP,IAAI;QACJ,QAAQ,EAAE,QAAQ;QAClB,GAAG;QACH,QAAQ;QACR,gBAAgB;QAChB,iBAAiB;QACjB,8BAA8B;QAC9B,QAAQ;KACT,CAAC;IAEF,OAAO,eAAe,CAAC,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 { DuDocumentArtifacts } 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: DuDocumentArtifacts;
|
|
30
|
+
} | {
|
|
31
|
+
ready: false;
|
|
32
|
+
fallback: ReactElement;
|
|
33
|
+
};
|
|
34
|
+
export declare function resolveArtifacts(error: string | null, wcReady: boolean, artifacts: DuDocumentArtifacts | 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,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD;;;;;;;;;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,mBAAmB,CAAA;CAAE,GAC/C;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,mBAAmB,GAAG,IAAI,GACpC,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,SAAqC;IAErC,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,82 @@
|
|
|
1
|
+
import type { BusinessRuleModel, DeleteFieldValueByPath, DocumentViewerOptions, GoToPage, GoToPageResult, IValidationStationOptions, SelectAndFocusFieldValueByPath, SelectAndFocusFieldValueByPathResult, SetFieldValueByPath } from "@uipath/du-validation-station-wc";
|
|
2
|
+
import type { CSSProperties } from "react";
|
|
3
|
+
import type { DuArtifactsSource } from "../useResolvedArtifacts.js";
|
|
4
|
+
import type { DuCommonProps, DuSaveCallbacks, VsSaveResultEventProps, VsStateEventProps } from "../types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Props common to every subcomponent wrapper: a data source (see
|
|
7
|
+
* {@link DuArtifactsSource}), shared-store linking, and presentation.
|
|
8
|
+
*/
|
|
9
|
+
export interface SubcomponentCommonProps extends DuArtifactsSource, DuCommonProps {
|
|
10
|
+
/**
|
|
11
|
+
* Links this element's store to sibling standalone elements. Elements sharing
|
|
12
|
+
* the same `instanceId` mirror each other's edits, selection, and document
|
|
13
|
+
* type — pass the same value to a viewer + fields-form + table-editor to
|
|
14
|
+
* compose them side by side. Immutable once mounted (set as an attribute
|
|
15
|
+
* before the element connects). Omit for an isolated store.
|
|
16
|
+
*/
|
|
17
|
+
instanceId?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
}
|
|
21
|
+
/** Command inputs shared by the editable subcomponents. */
|
|
22
|
+
export interface SubcomponentCommandProps {
|
|
23
|
+
setFieldValueByPath?: SetFieldValueByPath;
|
|
24
|
+
selectAndFocusFieldValueByPath?: SelectAndFocusFieldValueByPath;
|
|
25
|
+
deleteFieldValueByPath?: DeleteFieldValueByPath;
|
|
26
|
+
discardChanges?: {
|
|
27
|
+
value: boolean;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface CompactFieldsFormProps extends SubcomponentCommonProps, SubcomponentCommandProps, VsStateEventProps, VsSaveResultEventProps, DuSaveCallbacks {
|
|
31
|
+
options?: IValidationStationOptions;
|
|
32
|
+
save?: {
|
|
33
|
+
validate: boolean;
|
|
34
|
+
};
|
|
35
|
+
enableSaveAsDraft?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface CompactTableEditorProps extends SubcomponentCommonProps, SubcomponentCommandProps, VsStateEventProps {
|
|
38
|
+
options?: IValidationStationOptions;
|
|
39
|
+
/** Enable the PDF table-selection round-trip controls. */
|
|
40
|
+
isTableSelectionEnabled?: boolean;
|
|
41
|
+
isDrawingTableSelectionCells?: boolean;
|
|
42
|
+
/** Apply a host-driven PDF table selection result (`IPDFTableSelectionOutput`). */
|
|
43
|
+
applyTableSelection?: unknown;
|
|
44
|
+
/** Fires when the user starts/stops a PDF table selection (`IPDFTableSelectionInput | null`). */
|
|
45
|
+
onTableSelectionEvent?: (selection: unknown) => void;
|
|
46
|
+
/** Fires when the user closes the editor with "Done". */
|
|
47
|
+
onClosed?: () => void;
|
|
48
|
+
}
|
|
49
|
+
export interface CompactBusinessRulesProps extends SubcomponentCommonProps, SubcomponentCommandProps, VsStateEventProps {
|
|
50
|
+
options?: IValidationStationOptions;
|
|
51
|
+
/** Fires when the user expands (true) / collapses (false) the panel. */
|
|
52
|
+
onBusinessRulesToggle?: (expanded: boolean) => void;
|
|
53
|
+
/** Fires when the user clicks an evaluated rule. */
|
|
54
|
+
onBusinessRuleClick?: (rule: BusinessRuleModel) => void;
|
|
55
|
+
}
|
|
56
|
+
export interface DocumentViewerProps extends SubcomponentCommonProps {
|
|
57
|
+
options?: DocumentViewerOptions;
|
|
58
|
+
/** Select a field by path and focus its document reference in the viewer. */
|
|
59
|
+
selectAndFocusFieldValueByPath?: SelectAndFocusFieldValueByPath;
|
|
60
|
+
/** Navigate the document to a page. */
|
|
61
|
+
goToPage?: GoToPage;
|
|
62
|
+
onReady?: (ready: boolean) => void;
|
|
63
|
+
onLoaded?: (loaded: boolean) => void;
|
|
64
|
+
/** Fires when the user selects tokens in the viewer (`IPDFToken[]`). */
|
|
65
|
+
onTokensSelect?: (tokens: unknown[]) => void;
|
|
66
|
+
/** Fires when the viewer toggles between text and document (canvas) mode. */
|
|
67
|
+
onTextModeChange?: (isTextMode: boolean) => void;
|
|
68
|
+
onSelectAndFocusFieldValueByPathResult?: (result: SelectAndFocusFieldValueByPathResult) => void;
|
|
69
|
+
onGoToPageResult?: (result: GoToPageResult) => void;
|
|
70
|
+
/** Fires when the visible page changes. Detail is the 1-based page number. */
|
|
71
|
+
onCurrentPageChange?: (page: number) => void;
|
|
72
|
+
/** Fires once the document is ready. Detail is the total page count. */
|
|
73
|
+
onPageCountChange?: (pageCount: number) => void;
|
|
74
|
+
}
|
|
75
|
+
export interface CompactDocTypeFieldProps extends SubcomponentCommonProps {
|
|
76
|
+
options?: IValidationStationOptions;
|
|
77
|
+
onLoaded?: (loaded: boolean) => void;
|
|
78
|
+
onDocumentTypeChanged?: (documentTypeId: string) => void;
|
|
79
|
+
/** Fires when the dropdown panel opens (true) / closes (false). */
|
|
80
|
+
onPanelOpenChange?: (open: boolean) => void;
|
|
81
|
+
}
|
|
82
|
+
//# 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,qBAAqB,EACrB,QAAQ,EACR,cAAc,EACd,yBAAyB,EACzB,8BAA8B,EAC9B,oCAAoC,EACpC,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,WAAW,uBACf,SAAQ,iBAAiB,EAAE,aAAa;IACxC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,2DAA2D;AAC3D,MAAM,WAAW,wBAAwB;IACvC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C,EAAE,8BAA8B,CAAC;IAChE,uCAAuC;IACvC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,wEAAwE;IACxE,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAC7C,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,sCAAsC,CAAC,EAAE,CACvC,MAAM,EAAE,oCAAoC,KACzC,IAAI,CAAC;IACV,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IACpD,8EAA8E;IAC9E,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,wEAAwE;IACxE,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAID,MAAM,WAAW,wBAAyB,SAAQ,uBAAuB;IACvE,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,QAAQ,CAAC,EAAE,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 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/subcomponents/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import { type ResolvedArtifacts, type DuArtifactsSource } from "../useResolvedArtifacts.js";
|
|
3
|
+
import { ValidationStationLanguage, type DuTheme } from "../types.js";
|
|
4
|
+
/** Presentation + linking props common to every subcomponent wrapper. */
|
|
5
|
+
export interface WcElementCommon {
|
|
6
|
+
instanceId?: string;
|
|
7
|
+
theme?: DuTheme;
|
|
8
|
+
language?: ValidationStationLanguage;
|
|
9
|
+
isReadonly?: boolean;
|
|
10
|
+
persistent?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
/** The common JSX prop block every DU standalone element accepts. */
|
|
15
|
+
interface WcCommonProps {
|
|
16
|
+
className?: string;
|
|
17
|
+
style?: Record<string, string | number>;
|
|
18
|
+
"instance-id"?: string;
|
|
19
|
+
documentId?: string;
|
|
20
|
+
theme: DuTheme;
|
|
21
|
+
language: ValidationStationLanguage;
|
|
22
|
+
isReadonly: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface WcElementState extends ResolvedArtifacts {
|
|
25
|
+
wcReady: boolean;
|
|
26
|
+
/** Tag actually rendered — the base tag, or its persistent variant. */
|
|
27
|
+
tag: string;
|
|
28
|
+
commonProps: WcCommonProps;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Shared plumbing for the five subcomponent wrappers: resolves artifacts
|
|
32
|
+
* (pre-fetched or self-fetched), waits for the **actually-rendered** element tag
|
|
33
|
+
* (base vs persistent variant) to upgrade, and assembles the common JSX prop
|
|
34
|
+
* block with defaults applied once. Each wrapper supplies only its event map
|
|
35
|
+
* (via {@link useWcRef}) and element-specific props.
|
|
36
|
+
*/
|
|
37
|
+
export declare function useWcElement(params: {
|
|
38
|
+
baseTag: string;
|
|
39
|
+
dataSource: DuArtifactsSource;
|
|
40
|
+
common: WcElementCommon;
|
|
41
|
+
}): WcElementState;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=useWcElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWcElement.d.ts","sourceRoot":"","sources":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PersistentTag } from "../loadValidationStationWc.js";
|
|
2
|
+
import { useResolvedArtifacts, } from "../useResolvedArtifacts.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 } = useResolvedArtifacts(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
|
+
wcReady,
|
|
34
|
+
tag,
|
|
35
|
+
commonProps,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=useWcElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWcElement.js","sourceRoot":"","sources":["../../src/subcomponents/useWcElement.ts"],"names":[],"mappings":"AAC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ueByPath, IValidationStationOptions, SelectAndFocusFieldValueByPath, SetFieldValueByPath } from "@uipath/du-validation-station-wc";
|
|
2
|
-
import type { UiPath } from "@uipath/uipath-typescript/core";
|
|
1
|
+
import type { DeleteFieldValueByPath, DeleteFieldValueByPathResult, EvaluatedBusinessRulesForFieldValueDto, IFieldValueDetailsDto, ISaveResult, IValidationStationOptions, IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest, SelectAndFocusFieldValueByPath, SelectAndFocusFieldValueByPathResult, SetFieldValueByPath, SetFieldValueByPathResult } from "@uipath/du-validation-station-wc";
|
|
3
2
|
import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
|
|
4
3
|
import type { SaveValidatedDataResult } from "./saveValidatedDataUtil.js";
|
|
5
|
-
|
|
4
|
+
import type { DuArtifactsSource } from "./useResolvedArtifacts.js";
|
|
5
|
+
export type { DeleteFieldValueByPath, DeleteFieldValueByPathResult, EvaluatedBusinessRulesForFieldValueDto, IFieldValueDetailsDto, ISaveResult, IValidationStationOptions, IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest, SaveValidatedDataResult, SelectAndFocusFieldValueByPath, SelectAndFocusFieldValueByPathResult, SetFieldValueByPath, SetFieldValueByPathResult, };
|
|
6
|
+
export declare enum TelemetryEvent {
|
|
7
|
+
Load = "ValidationStation.Load",
|
|
8
|
+
/**
|
|
9
|
+
* One event per submit. Its status is the persistence outcome where the
|
|
10
|
+
* widget did the write-back, and the attempt where the host owns it.
|
|
11
|
+
*/
|
|
12
|
+
Submit = "ValidationStation.Submit",
|
|
13
|
+
ExceptionRequest = "ValidationStation.ExceptionRequest"
|
|
14
|
+
}
|
|
15
|
+
export declare enum TelemetryStatus {
|
|
16
|
+
Success = "ValidationStation.Success",
|
|
17
|
+
Error = "ValidationStation.Error"
|
|
18
|
+
}
|
|
6
19
|
export declare enum ValidationStationLanguage {
|
|
7
20
|
German = "de",
|
|
8
21
|
English = "en",
|
|
@@ -19,21 +32,147 @@ export declare enum ValidationStationLanguage {
|
|
|
19
32
|
ChineseSimplified = "zh-CN",
|
|
20
33
|
ChineseTraditional = "zh-TW"
|
|
21
34
|
}
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
35
|
+
export type DuTheme = "light" | "dark" | "light-hc" | "dark-hc";
|
|
36
|
+
/**
|
|
37
|
+
* The inputs every DU element takes, whichever one you render — as opposed to
|
|
38
|
+
* the data, commands and outputs that differ between them.
|
|
39
|
+
*/
|
|
40
|
+
export interface DuCommonProps {
|
|
41
|
+
theme?: DuTheme;
|
|
42
|
+
language?: ValidationStationLanguage;
|
|
43
|
+
/** Render the document without editing affordances. */
|
|
44
|
+
isReadonly?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Render the persistent element variant, which survives portal/DOM
|
|
47
|
+
* detachment (e.g. tab switches) and is torn down via `forceDestroy()` when
|
|
48
|
+
* the React component unmounts. Defaults to `false`.
|
|
49
|
+
*/
|
|
50
|
+
persistent?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Everything the Validation Station elements need to render one document:
|
|
54
|
+
* the taxonomy, the extraction result to edit, the digitised document model,
|
|
55
|
+
* and the document itself.
|
|
56
|
+
*
|
|
57
|
+
* Storage-agnostic — `fetchDuDocumentArtifacts` produces one of these from an
|
|
58
|
+
* Orchestrator storage bucket, but a host holding the same pieces anywhere
|
|
59
|
+
* else can build one by hand and pass it as the `artifacts` prop.
|
|
60
|
+
*/
|
|
61
|
+
export interface DuDocumentArtifacts {
|
|
62
|
+
taxonomy: DuFramework.DocumentTaxonomy;
|
|
63
|
+
extractionResult: DuFramework.ExtractionResult;
|
|
64
|
+
dom: DuFramework.DocumentEntity;
|
|
26
65
|
text: string | undefined;
|
|
27
66
|
customizationInfo: unknown;
|
|
28
67
|
original: string | undefined;
|
|
29
68
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
69
|
+
/**
|
|
70
|
+
* The save flows every save-capable widget reports — `ValidationStation` and
|
|
71
|
+
* `CompactFieldsForm`. Both implement them identically, so a host swapping one
|
|
72
|
+
* for the other keeps its handlers.
|
|
73
|
+
*/
|
|
74
|
+
export interface DuSaveCallbacks {
|
|
75
|
+
/**
|
|
76
|
+
* The user submitted (`save={{ validate: true }}`). Always fires, and always
|
|
77
|
+
* carries the request the web component produced.
|
|
78
|
+
*
|
|
79
|
+
* `result` is present only when the widget persisted the data itself, i.e.
|
|
80
|
+
* when it has `sdk` + `data` naming a folder. Otherwise the write-back
|
|
81
|
+
* is yours — the exported `submitValidatedData` does what the widget would
|
|
82
|
+
* have done for a bucket-backed document.
|
|
83
|
+
*/
|
|
84
|
+
onSubmit?: (request: IVsSaveValidatedDataRequest, result?: SaveValidatedDataResult) => void;
|
|
85
|
+
/**
|
|
86
|
+
* The user saved a draft (`save={{ validate: false }}`). Same contract as
|
|
87
|
+
* {@link DuSaveCallbacks.onSubmit}; the host-side equivalent is
|
|
88
|
+
* `saveValidatedDataAsDraft`.
|
|
89
|
+
*/
|
|
90
|
+
onSaveAsDraft?: (request: IVsSaveValidatedDataAsDraftRequest, result?: SaveValidatedDataResult) => void;
|
|
91
|
+
/**
|
|
92
|
+
* The user reported the document as an exception. The widget never persists
|
|
93
|
+
* this in either mode, so there is no `result` — the host owns it, typically
|
|
94
|
+
* via `OrchestratorDuModule.submitExceptionReport(...)`. The reason lives at
|
|
95
|
+
* `request.exceptionReport.Reason`.
|
|
96
|
+
*/
|
|
97
|
+
onReportException?: (request: IVsSaveExceptionReportRequest) => void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Callbacks for the edit/state events reported by the four widgets that share
|
|
101
|
+
* the Validation Station's extraction store: the full `ValidationStation`, the
|
|
102
|
+
* compact fields form, the table editor and the business-rules panel. One store
|
|
103
|
+
* means one set of events — an edit or selection driven through any of them
|
|
104
|
+
* reaches the others — so a host swapping one for another keeps its handlers.
|
|
105
|
+
*
|
|
106
|
+
* `DocumentViewer` (`loaded`, `selectAndFocusFieldValueByPathResult`) and
|
|
107
|
+
* `CompactDocTypeField` (`loaded`, `documentTypeChanged`) overlap on a few of
|
|
108
|
+
* these and declare them on their own props instead.
|
|
109
|
+
*
|
|
110
|
+
* Mirrors the web component's `IVsWcCommonStateEventMap`.
|
|
111
|
+
*/
|
|
112
|
+
export interface VsStateEventProps {
|
|
113
|
+
/**
|
|
114
|
+
* The element finished loading. The path-addressed command props need the
|
|
115
|
+
* taxonomy and extraction result this signals, so gate them on it.
|
|
116
|
+
*/
|
|
117
|
+
onLoaded?: (loaded: boolean) => void;
|
|
118
|
+
onDirtyChange?: (dirty: boolean) => void;
|
|
119
|
+
onDocumentTypeChanged?: (documentTypeId: string) => void;
|
|
120
|
+
/**
|
|
121
|
+
* Every change to the extraction result, i.e. the host's window onto the
|
|
122
|
+
* user's edits.
|
|
123
|
+
*
|
|
124
|
+
* Requires `options={{ emitDtoStateChanges: true }}`; the element defaults
|
|
125
|
+
* the flag to `false`.
|
|
126
|
+
*/
|
|
127
|
+
onExtractionResultChanged?: (result: DuFramework.ExtractionResult) => void;
|
|
128
|
+
onFieldValueSelected?: (details: IFieldValueDetailsDto) => void;
|
|
129
|
+
onFieldValueChanged?: (details: IFieldValueDetailsDto) => void;
|
|
130
|
+
/** Field validation errors and business rules, re-evaluated. */
|
|
131
|
+
onBusinessRulesEvaluated?: (rules: EvaluatedBusinessRulesForFieldValueDto[]) => void;
|
|
132
|
+
/** Outcome of the `setFieldValueByPath` command. */
|
|
133
|
+
onSetFieldValueByPathResult?: (result: SetFieldValueByPathResult) => void;
|
|
134
|
+
/** Outcome of the `selectAndFocusFieldValueByPath` command. */
|
|
135
|
+
onSelectAndFocusFieldValueByPathResult?: (result: SelectAndFocusFieldValueByPathResult) => void;
|
|
136
|
+
/** Outcome of the `deleteFieldValueByPath` command. */
|
|
137
|
+
onDeleteFieldValueByPathResult?: (result: DeleteFieldValueByPathResult) => void;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Reported by the two widgets that have a `save` command: `ValidationStation`
|
|
141
|
+
* and `CompactFieldsForm`. Composed alongside {@link VsStateEventProps} rather
|
|
142
|
+
* than extending it, so the table editor and business-rules panel can take the
|
|
143
|
+
* state events on their own.
|
|
144
|
+
*
|
|
145
|
+
* Together the two make up the web component's `IVsWcCommonEventMap`.
|
|
146
|
+
*/
|
|
147
|
+
export interface VsSaveResultEventProps {
|
|
148
|
+
/** Outcome of a `save` command. */
|
|
149
|
+
onSaveResult?: (result: ISaveResult) => void;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The output surface unique to the full `ValidationStation` element: overall
|
|
153
|
+
* validity plus the document-viewer panel layout. Mirrors the web component's
|
|
154
|
+
* `IVsWcSharedEventMap`.
|
|
155
|
+
*/
|
|
156
|
+
export interface ValidationStationEventProps extends VsStateEventProps, VsSaveResultEventProps {
|
|
157
|
+
/**
|
|
158
|
+
* Validity changed. `true` when no critical (Must) business rule is broken and
|
|
159
|
+
* no field value fails validation — the element weighs both, and counts every
|
|
160
|
+
* validation error as Must.
|
|
161
|
+
*/
|
|
162
|
+
onIsValidChange?: (isValid: boolean) => void;
|
|
163
|
+
/** The fields panel was resized. Detail is the width in pixels. */
|
|
164
|
+
onFieldsPanelWidthChanged?: (width: number) => void;
|
|
165
|
+
/** The fields panel moved to the other side of the document viewer. */
|
|
166
|
+
onFieldsPanelSideChanged?: (side: "left" | "right") => void;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Props for the monolithic `ValidationStation`.
|
|
170
|
+
*
|
|
171
|
+
* The document data comes from a {@link DuArtifactsSource}: either
|
|
172
|
+
* pre-fetched `artifacts` handed in directly, or `sdk` + `data` for the widget
|
|
173
|
+
* to fetch from the bucket paths on `ContentValidationData`.
|
|
174
|
+
*/
|
|
175
|
+
export interface ValidationStationProps extends DuArtifactsSource, DuCommonProps, DuSaveCallbacks, ValidationStationEventProps {
|
|
37
176
|
options?: IValidationStationOptions;
|
|
38
177
|
save?: {
|
|
39
178
|
validate: boolean;
|
|
@@ -44,25 +183,5 @@ export interface ValidationStationProps {
|
|
|
44
183
|
setFieldValueByPath?: SetFieldValueByPath;
|
|
45
184
|
selectAndFocusFieldValueByPath?: SelectAndFocusFieldValueByPath;
|
|
46
185
|
deleteFieldValueByPath?: DeleteFieldValueByPath;
|
|
47
|
-
/**
|
|
48
|
-
* Fired after the submit flow (`save={{ validate: true }}`) finishes
|
|
49
|
-
* (ProcessExtractedData + bucket upload). `result.success` is `false` on
|
|
50
|
-
* any failure — the host app decides whether to retry, complete the task,
|
|
51
|
-
* surface an error, etc.
|
|
52
|
-
*/
|
|
53
|
-
onSubmitComplete?: (result: SaveValidatedDataResult) => void;
|
|
54
|
-
/**
|
|
55
|
-
* Fired after the save-as-draft flow (`save={{ validate: false }}`)
|
|
56
|
-
* finishes (uploads `validatedData` straight to the bucket, no
|
|
57
|
-
* `ProcessExtractedData` call).
|
|
58
|
-
*/
|
|
59
|
-
onSaveAsDraftComplete?: (result: SaveValidatedDataResult) => void;
|
|
60
|
-
/**
|
|
61
|
-
* Fired when the user reports the document as an exception. The widget does
|
|
62
|
-
* NOT call any API for this flow — the host owns persistence (typically a
|
|
63
|
-
* `OrchestratorDuModule.submitExceptionReport(taskId, documentId, reason, ...)`
|
|
64
|
-
* call).
|
|
65
|
-
*/
|
|
66
|
-
onReportExceptionComplete?: (documentId: string, reason: string) => void;
|
|
67
186
|
}
|
|
68
187
|
//# sourceMappingURL=types.d.ts.map
|