@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
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import { type ValidationStationProps } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The all-in-one Document Understanding Validation Station: document viewer,
|
|
4
|
+
* fields form, table editor, business rules and save actions in one element.
|
|
5
|
+
*
|
|
6
|
+
* Takes its document either pre-fetched (`artifacts`) or self-fetched from the
|
|
7
|
+
* bucket paths on `data` (`sdk` + `data`) — see {@link DuArtifactsSource}.
|
|
8
|
+
*
|
|
9
|
+
* Reports every event in the element's public
|
|
10
|
+
* `IValidationStationStandaloneWcEventMap`: the save flows through
|
|
11
|
+
* {@link DuSaveCallbacks}, and the edit, validity, command-outcome and panel
|
|
12
|
+
* events through {@link ValidationStationEventProps}.
|
|
13
|
+
*/
|
|
2
14
|
export declare const ValidationStation: React.FC<ValidationStationProps>;
|
|
3
15
|
//# sourceMappingURL=ValidationStation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationStation.d.ts","sourceRoot":"","sources":["../src/ValidationStation.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ValidationStation.d.ts","sourceRoot":"","sources":["../src/ValidationStation.tsx"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAIpB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAmG9D,CAAC"}
|
|
@@ -1,53 +1,76 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { submitValidatedData, saveValidatedDataAsDraft, } from "./saveValidatedDataUtil.js";
|
|
1
|
+
import { useWcRef } from "./bindWcEvents.js";
|
|
2
|
+
import { convertToPersistentTag, VALIDATION_STATION_TAG, } from "./loadValidationStationWc.js";
|
|
3
|
+
import { createSaveHandlers } from "./saveHandlers.js";
|
|
4
|
+
import { renderWcElement, resolveArtifacts } from "./subcomponents/shared.js";
|
|
6
5
|
import { ValidationStationLanguage, } from "./types.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
6
|
+
import { useResolvedArtifacts } from "./useResolvedArtifacts.js";
|
|
7
|
+
import { useWcReady } from "./useWcReady.js";
|
|
8
|
+
/**
|
|
9
|
+
* The all-in-one Document Understanding Validation Station: document viewer,
|
|
10
|
+
* fields form, table editor, business rules and save actions in one element.
|
|
11
|
+
*
|
|
12
|
+
* Takes its document either pre-fetched (`artifacts`) or self-fetched from the
|
|
13
|
+
* bucket paths on `data` (`sdk` + `data`) — see {@link DuArtifactsSource}.
|
|
14
|
+
*
|
|
15
|
+
* Reports every event in the element's public
|
|
16
|
+
* `IValidationStationStandaloneWcEventMap`: the save flows through
|
|
17
|
+
* {@link DuSaveCallbacks}, and the edit, validity, command-outcome and panel
|
|
18
|
+
* events through {@link ValidationStationEventProps}.
|
|
19
|
+
*/
|
|
20
|
+
export const ValidationStation = ({ sdk, data, artifacts: providedArtifacts, documentId: documentIdProp, theme = "light", language = ValidationStationLanguage.English, isReadonly = false, persistent = false, options, save, discardChanges, setFieldValueByPath, selectAndFocusFieldValueByPath, deleteFieldValueByPath, onSubmit, onSaveAsDraft, onReportException, onLoaded, onDirtyChange, onIsValidChange, onDocumentTypeChanged, onExtractionResultChanged, onFieldValueSelected, onFieldValueChanged, onBusinessRulesEvaluated, onSaveResult, onSetFieldValueByPathResult, onSelectAndFocusFieldValueByPathResult, onDeleteFieldValueByPathResult, onFieldsPanelWidthChanged, onFieldsPanelSideChanged, }) => {
|
|
21
|
+
const { artifacts, error, documentId } = useResolvedArtifacts({
|
|
22
|
+
sdk,
|
|
23
|
+
data,
|
|
24
|
+
artifacts: providedArtifacts,
|
|
25
|
+
documentId: documentIdProp,
|
|
26
|
+
});
|
|
27
|
+
const tag = persistent
|
|
28
|
+
? convertToPersistentTag(VALIDATION_STATION_TAG)
|
|
29
|
+
: VALIDATION_STATION_TAG;
|
|
30
|
+
// Gate on the tag actually rendered, not always the base one.
|
|
31
|
+
const wcReady = useWcReady(tag);
|
|
32
|
+
const { handleSubmit, handleSaveAsDraft, handleException } = createSaveHandlers({ sdk, data }, { onSubmit, onSaveAsDraft, onReportException });
|
|
33
|
+
const ref = useWcRef({
|
|
34
|
+
loaded: onLoaded,
|
|
35
|
+
dirty: onDirtyChange,
|
|
36
|
+
isValid: onIsValidChange,
|
|
37
|
+
documentTypeChanged: onDocumentTypeChanged,
|
|
38
|
+
extractionResultChanged: onExtractionResultChanged,
|
|
39
|
+
fieldValueSelected: onFieldValueSelected,
|
|
40
|
+
fieldValueChanged: onFieldValueChanged,
|
|
41
|
+
businessRulesEvaluated: onBusinessRulesEvaluated,
|
|
42
|
+
saveResult: onSaveResult,
|
|
43
|
+
setFieldValueByPathResult: onSetFieldValueByPathResult,
|
|
44
|
+
selectAndFocusFieldValueByPathResult: onSelectAndFocusFieldValueByPathResult,
|
|
45
|
+
deleteFieldValueByPathResult: onDeleteFieldValueByPathResult,
|
|
46
|
+
fieldsPanelWidthChanged: onFieldsPanelWidthChanged,
|
|
47
|
+
fieldsPanelSideChanged: onFieldsPanelSideChanged,
|
|
48
|
+
saveValidatedDataRequest: handleSubmit,
|
|
49
|
+
saveValidatedDataAsDraftRequest: handleSaveAsDraft,
|
|
50
|
+
saveExceptionReportRequest: handleException,
|
|
51
|
+
}, persistent);
|
|
52
|
+
const gate = resolveArtifacts(error, wcReady, artifacts);
|
|
53
|
+
if (!gate.ready)
|
|
54
|
+
return gate.fallback;
|
|
55
|
+
const props = {
|
|
56
|
+
theme,
|
|
57
|
+
language,
|
|
58
|
+
isReadonly,
|
|
59
|
+
enableSaveAsDraft: true,
|
|
60
|
+
documentId,
|
|
61
|
+
taxonomy: gate.artifacts.taxonomy,
|
|
62
|
+
extractionResult: gate.artifacts.extractionResult,
|
|
63
|
+
dom: gate.artifacts.dom,
|
|
64
|
+
text: gate.artifacts.text,
|
|
65
|
+
customizationInfo: gate.artifacts.customizationInfo,
|
|
66
|
+
original: gate.artifacts.original,
|
|
67
|
+
options,
|
|
68
|
+
save,
|
|
69
|
+
discardChanges,
|
|
70
|
+
setFieldValueByPath,
|
|
71
|
+
selectAndFocusFieldValueByPath,
|
|
72
|
+
deleteFieldValueByPath,
|
|
50
73
|
};
|
|
51
|
-
return (
|
|
74
|
+
return renderWcElement(tag, props, ref);
|
|
52
75
|
};
|
|
53
76
|
//# sourceMappingURL=ValidationStation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationStation.js","sourceRoot":"","sources":["../src/ValidationStation.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ValidationStation.js","sourceRoot":"","sources":["../src/ValidationStation.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EACL,yBAAyB,GAE1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,EAClE,GAAG,EACH,IAAI,EACJ,SAAS,EAAE,iBAAiB,EAC5B,UAAU,EAAE,cAAc,EAC1B,KAAK,GAAG,OAAO,EACf,QAAQ,GAAG,yBAAyB,CAAC,OAAO,EAC5C,UAAU,GAAG,KAAK,EAClB,UAAU,GAAG,KAAK,EAClB,OAAO,EACP,IAAI,EACJ,cAAc,EACd,mBAAmB,EACnB,8BAA8B,EAC9B,sBAAsB,EACtB,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,YAAY,EACZ,2BAA2B,EAC3B,sCAAsC,EACtC,8BAA8B,EAC9B,yBAAyB,EACzB,wBAAwB,GACzB,EAAE,EAAE;IACH,MAAM,EAAE,SAAS,EA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Q;QACR,UAAU;QACV,iBAAiB,EAAE,IAAI;QACvB,UAAU;QACV,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ;QACjC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB;QACjD,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG;QACvB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI;QACzB,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB;QACnD,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ;QACjC,OAAO;QACP,IAAI;QACJ,cAAc;QACd,mBAAmB;QACnB,8BAA8B;QAC9B,sBAAsB;KACvB,CAAC;IAEF,OAAO,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationStation.stories.d.ts","sourceRoot":"","sources":["../src/ValidationStation.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ValidationStation.stories.d.ts","sourceRoot":"","sources":["../src/ValidationStation.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAO5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAatD,UAAU,0BAA2B,SAAQ,IAAI,CAC/C,sBAAsB,EACtB,KAAK,CACN;IACC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,wBAAwB,GAAI,oDAM/B,0BAA0B,4CAoE5B,CAAC;AAkBF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,wBAAwB,CAsJ/C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC"}
|
|
@@ -2,7 +2,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { UiPath } from "@uipath/uipath-typescript/core";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { ValidationStation } from "./ValidationStation";
|
|
5
|
+
import { configureValidationStationWc } from "./loadValidationStationWc";
|
|
5
6
|
import { ValidationStationLanguage } from "./types";
|
|
7
|
+
// Served from `public/du-vs-wc` — staged by the `prestorybook` script and
|
|
8
|
+
// exposed via `staticDirs` in `.storybook/main.ts`. `includeFonts` because
|
|
9
|
+
// Storybook does not load Apollo fonts or Material Icons globally, without which
|
|
10
|
+
// icon glyphs render as empty boxes.
|
|
11
|
+
configureValidationStationWc({
|
|
12
|
+
deploymentUrl: "/du-vs-wc",
|
|
13
|
+
includeFonts: true,
|
|
14
|
+
}).catch((error) => {
|
|
15
|
+
console.error("Failed to load the Validation Station web component:", error);
|
|
16
|
+
});
|
|
6
17
|
const ValidationStationWithSdk = ({ baseUrl, orgName, tenantName, secret, ...props }) => {
|
|
7
18
|
const [state, setState] = useState({ sdk: null, error: null });
|
|
8
19
|
useEffect(() => {
|
|
@@ -55,7 +66,8 @@ const ValidationStationWithSdk = ({ baseUrl, orgName, tenantName, secret, ...pro
|
|
|
55
66
|
const mockData = {
|
|
56
67
|
BucketName: "",
|
|
57
68
|
BucketId: 0,
|
|
58
|
-
|
|
69
|
+
// The folder the bucket lives in — fill in one of the two.
|
|
70
|
+
FolderId: undefined,
|
|
59
71
|
FolderKey: "",
|
|
60
72
|
DocumentId: "",
|
|
61
73
|
EncodedDocumentPath: "",
|
|
@@ -97,18 +109,23 @@ npm install @uipath/ui-widgets-validation-station
|
|
|
97
109
|
|
|
98
110
|
> **Note:** Add either \`light\` or \`dark\` class to your HTML \`<body>\` element to enable proper theming.
|
|
99
111
|
|
|
100
|
-
The
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
dev server). For production, copy the contents of
|
|
105
|
-
\`node_modules/@uipath/du-validation-station-wc\` into your public assets and
|
|
106
|
-
point \`wcAssetsUrl\` at that location.
|
|
112
|
+
The underlying Validation Station web component is loaded at runtime from a URL
|
|
113
|
+
you host — serve the contents of \`node_modules/@uipath/du-validation-station-wc\`
|
|
114
|
+
as static files, then call \`configureValidationStationWc\` once at app startup.
|
|
115
|
+
There is no bundler configuration to write.
|
|
107
116
|
|
|
108
117
|
\`\`\`tsx
|
|
109
|
-
import {
|
|
118
|
+
import {
|
|
119
|
+
configureValidationStationWc,
|
|
120
|
+
ValidationStation,
|
|
121
|
+
} from '@uipath/ui-widgets-validation-station';
|
|
110
122
|
import { UiPath } from '@uipath/uipath-typescript/core';
|
|
111
123
|
|
|
124
|
+
configureValidationStationWc({
|
|
125
|
+
deploymentUrl: '/du-vs-wc',
|
|
126
|
+
includeFonts: true,
|
|
127
|
+
});
|
|
128
|
+
|
|
112
129
|
const sdk = new UiPath({
|
|
113
130
|
baseUrl: 'https://cloud.uipath.com',
|
|
114
131
|
orgName: 'your-org',
|
|
@@ -123,11 +140,9 @@ function App() {
|
|
|
123
140
|
<ValidationStation
|
|
124
141
|
sdk={sdk}
|
|
125
142
|
data={myContentValidationData}
|
|
126
|
-
folderId={12345}
|
|
127
143
|
theme="light"
|
|
128
144
|
language="en"
|
|
129
145
|
save={{ validate: true }}
|
|
130
|
-
// wcAssetsUrl="/assets/du-validation-station-wc"
|
|
131
146
|
/>
|
|
132
147
|
);
|
|
133
148
|
}
|
|
@@ -137,8 +152,9 @@ function App() {
|
|
|
137
152
|
|
|
138
153
|
- React 19.2.0+
|
|
139
154
|
- React DOM 19.2.0+
|
|
140
|
-
- @uipath/
|
|
141
|
-
-
|
|
155
|
+
- @uipath/uipath-typescript
|
|
156
|
+
- The web component's files (from \`@uipath/du-validation-station-wc\`) served at
|
|
157
|
+
the \`deploymentUrl\` you configure`,
|
|
142
158
|
},
|
|
143
159
|
},
|
|
144
160
|
},
|
|
@@ -165,13 +181,9 @@ function App() {
|
|
|
165
181
|
table: { category: "SDK Configuration" },
|
|
166
182
|
},
|
|
167
183
|
data: {
|
|
168
|
-
description: "ContentValidationData object containing bucket paths, document ID, and folder
|
|
184
|
+
description: "ContentValidationData object containing bucket paths, document ID, and the folder they live in (FolderId or FolderKey).",
|
|
169
185
|
control: "object",
|
|
170
186
|
},
|
|
171
|
-
folderId: {
|
|
172
|
-
description: "Storage bucket folder ID. Falls back to data.folderId if not provided.",
|
|
173
|
-
control: "number",
|
|
174
|
-
},
|
|
175
187
|
theme: {
|
|
176
188
|
description: "Visual theme for the validation station",
|
|
177
189
|
control: "select",
|
|
@@ -206,7 +218,6 @@ function App() {
|
|
|
206
218
|
tenantName: "",
|
|
207
219
|
secret: "",
|
|
208
220
|
data: mockData,
|
|
209
|
-
folderId: 0,
|
|
210
221
|
theme: "light",
|
|
211
222
|
language: ValidationStationLanguage.English,
|
|
212
223
|
isReadonly: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationStation.stories.js","sourceRoot":"","sources":["../src/ValidationStation.stories.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ValidationStation.stories.js","sourceRoot":"","sources":["../src/ValidationStation.stories.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,QA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+
/** A web-component element that may expose the persistent-variant teardown. */
|
|
2
|
+
export type WcElement = HTMLElement & {
|
|
3
|
+
forceDestroy?: () => void;
|
|
4
|
+
};
|
|
5
|
+
/** React ref-callback shape for a standalone DU element. */
|
|
6
|
+
export type WcRefCallback = (el: WcElement | null) => void | (() => void);
|
|
7
|
+
type WcHandlers<EventMap> = {
|
|
8
|
+
[K in keyof EventMap]?: (detail: EventMap[K]) => void;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Returns a **stable** React `ref` callback for a standalone DU element. It binds
|
|
12
|
+
* the event handlers once on attach (dispatching to the latest handler set on
|
|
13
|
+
* every event, so changing handler identities between renders does not re-bind)
|
|
14
|
+
* and, on detach, removes them and — when `persistent` — calls `forceDestroy()`
|
|
15
|
+
* to tear down the inner Angular component.
|
|
16
|
+
*
|
|
17
|
+
* The callback identity changes only when `persistent` changes, so React does
|
|
18
|
+
* not detach/re-attach — and never force-destroys a persistent element — on an
|
|
19
|
+
* ordinary re-render. (A fresh callback each render, as a plain factory would
|
|
20
|
+
* produce, would rebind every listener and destroy persistent elements on every
|
|
21
|
+
* parent state change.)
|
|
22
|
+
*/
|
|
23
|
+
export declare function useWcRef<EventMap>(handlers: WcHandlers<EventMap>, persistent?: boolean): WcRefCallback;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=bindWcEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bindWcEvents.d.ts","sourceRoot":"","sources":["../src/bindWcEvents.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAEpE,4DAA4D;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AAE1E,KAAK,UAAU,CAAC,QAAQ,IAAI;KACzB,CAAC,IAAI,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI;CACtD,CAAC;AAmCF;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAC/B,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,EAC9B,UAAU,UAAQ,GACjB,aAAa,CAmBf"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Attaches one `CustomEvent` listener per handler key. Each listener dispatches
|
|
4
|
+
* to the **latest** handler via `getHandlers()`, so changing handler identities
|
|
5
|
+
* between renders never requires re-binding. Returns a cleanup that removes them.
|
|
6
|
+
*
|
|
7
|
+
* The key set is captured once at attach time — callers pass a stable-shape map
|
|
8
|
+
* (all event keys present, values possibly `undefined`), so this covers every
|
|
9
|
+
* event; an entry that is `undefined` at dispatch time is simply a no-op.
|
|
10
|
+
*/
|
|
11
|
+
function bindWcEvents(el, getHandlers) {
|
|
12
|
+
const cleanups = [];
|
|
13
|
+
for (const type of Object.keys(getHandlers())) {
|
|
14
|
+
const listener = (event) => {
|
|
15
|
+
const handler = getHandlers()[type];
|
|
16
|
+
if (typeof handler === "function") {
|
|
17
|
+
handler(event.detail);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
el.addEventListener(type, listener);
|
|
21
|
+
cleanups.push(() => el.removeEventListener(type, listener));
|
|
22
|
+
}
|
|
23
|
+
return () => {
|
|
24
|
+
for (const cleanup of cleanups)
|
|
25
|
+
cleanup();
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Returns a **stable** React `ref` callback for a standalone DU element. It binds
|
|
30
|
+
* the event handlers once on attach (dispatching to the latest handler set on
|
|
31
|
+
* every event, so changing handler identities between renders does not re-bind)
|
|
32
|
+
* and, on detach, removes them and — when `persistent` — calls `forceDestroy()`
|
|
33
|
+
* to tear down the inner Angular component.
|
|
34
|
+
*
|
|
35
|
+
* The callback identity changes only when `persistent` changes, so React does
|
|
36
|
+
* not detach/re-attach — and never force-destroys a persistent element — on an
|
|
37
|
+
* ordinary re-render. (A fresh callback each render, as a plain factory would
|
|
38
|
+
* produce, would rebind every listener and destroy persistent elements on every
|
|
39
|
+
* parent state change.)
|
|
40
|
+
*/
|
|
41
|
+
export function useWcRef(handlers, persistent = false) {
|
|
42
|
+
const handlersRef = useRef(handlers);
|
|
43
|
+
// Keep the latest handlers reachable to the bound listeners without changing
|
|
44
|
+
// the ref-callback identity (updated post-commit, before any event fires).
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
handlersRef.current = handlers;
|
|
47
|
+
});
|
|
48
|
+
return useCallback((el) => {
|
|
49
|
+
if (!el)
|
|
50
|
+
return;
|
|
51
|
+
const unbind = bindWcEvents(el, () => handlersRef.current);
|
|
52
|
+
return () => {
|
|
53
|
+
unbind();
|
|
54
|
+
if (persistent)
|
|
55
|
+
el.forceDestroy?.();
|
|
56
|
+
};
|
|
57
|
+
}, [persistent]);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=bindWcEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bindWcEvents.js","sourceRoot":"","sources":["../src/bindWcEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAYvD;;;;;;;;GAQG;AACH,SAAS,YAAY,CACnB,EAAe,EACf,WAAuC;IAEvC,MAAM,QAAQ,GAAsB,EAAE,CAAC;IAEvC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAkB,CAAC,KAAK,EAAE,EAAE;YACxC,MAAM,OAAO,GACX,WAAW,EACZ,CAAC,IAAI,CAAC,CAAC;YACR,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;gBAClC,OAAO,CAAE,KAA8B,CAAC,MAAM,CAAC,CAAC;YAClD,CAAC;QACH,CAAC,CAAC;QACF,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACpC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,GAAG,EAAE;QACV,KAAK,MAAM,OAAO,IAAI,QAAQ;YAAE,OAAO,EAAE,CAAC;IAC5C,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CACtB,QAA8B,EAC9B,UAAU,GAAG,KAAK;IAElB,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,6EAA6E;IAC7E,2EAA2E;IAC3E,SAAS,CAAC,GAAG,EAAE;QACb,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAChB,CAAC,EAAE,EAAE,EAAE;QACL,IAAI,CAAC,EAAE;YAAE,OAAO;QAChB,MAAM,MAAM,GAAG,YAAY,CAAW,EAAE,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACrE,OAAO,GAAG,EAAE;YACV,MAAM,EAAE,CAAC;YACT,IAAI,UAAU;gBAAE,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC;QACtC,CAAC,CAAC;IACJ,CAAC,EACD,CAAC,UAAU,CAAC,CACb,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
|
|
2
|
+
import { BucketService } from "@uipath/uipath-typescript/buckets";
|
|
3
|
+
import type { UiPath } from "@uipath/uipath-typescript/core";
|
|
4
|
+
import type { DuDocumentArtifacts } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Fetches a document's artifacts from the storage bucket paths on
|
|
7
|
+
* `ContentValidationData`, ready to pass as the `artifacts` prop. The
|
|
8
|
+
* imperative counterpart of `useDuDocumentArtifacts`.
|
|
9
|
+
*
|
|
10
|
+
* @throws if `data` is missing any of the bucket fields the artifacts are read
|
|
11
|
+
* from — the bucket, the paths, or the folder they live in.
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchDuDocumentArtifacts(sdk: UiPath, data: DuFramework.ContentValidationData): Promise<DuDocumentArtifacts>;
|
|
14
|
+
export declare function fetchBucketArtifacts(bucketService: BucketService, data: DuFramework.ContentValidationData): Promise<DuDocumentArtifacts>;
|
|
5
15
|
//# sourceMappingURL=bucketArtifactsUtil.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bucketArtifactsUtil.d.ts","sourceRoot":"","sources":["../src/bucketArtifactsUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,
|
|
1
|
+
{"version":3,"file":"bucketArtifactsUtil.d.ts","sourceRoot":"","sources":["../src/bucketArtifactsUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAgBtD;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,CAAC,qBAAqB,GACtC,OAAO,CAAC,mBAAmB,CAAC,CAE9B;AAED,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,WAAW,CAAC,qBAAqB,GACtC,OAAO,CAAC,mBAAmB,CAAC,CAuE9B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BucketService } from "@uipath/uipath-typescript/buckets";
|
|
1
2
|
import { unzipSync } from "fflate";
|
|
2
3
|
/** Fetch a URI, unzip the first file in the archive, and return the raw text. */
|
|
3
4
|
async function fetchAndUnzip(uri) {
|
|
@@ -11,50 +12,66 @@ async function fetchAndUnzipJson(uri) {
|
|
|
11
12
|
const text = await fetchAndUnzip(uri);
|
|
12
13
|
return JSON.parse(text);
|
|
13
14
|
}
|
|
14
|
-
/** Get URI then immediately fetch + unzip as JSON. */
|
|
15
|
-
async function fetchArtifactJson(bucketService, bucketId, folderId, path) {
|
|
16
|
-
const r = await bucketService.getReadUri({ bucketId, folderId, path });
|
|
17
|
-
return fetchAndUnzipJson(r.uri);
|
|
18
|
-
}
|
|
19
15
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
16
|
+
* Fetches a document's artifacts from the storage bucket paths on
|
|
17
|
+
* `ContentValidationData`, ready to pass as the `artifacts` prop. The
|
|
18
|
+
* imperative counterpart of `useDuDocumentArtifacts`.
|
|
19
|
+
*
|
|
20
|
+
* @throws if `data` is missing any of the bucket fields the artifacts are read
|
|
21
|
+
* from — the bucket, the paths, or the folder they live in.
|
|
22
22
|
*/
|
|
23
|
-
async function
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
return await fetchArtifactJson(bucketService, bucketId, folderId, validatedPath);
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
// Validated result not saved yet — fall through to automatic.
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return fetchArtifactJson(bucketService, bucketId, folderId, automaticPath);
|
|
33
|
-
}
|
|
34
|
-
/** Get URI then immediately fetch + unzip as text. */
|
|
35
|
-
async function fetchArtifactText(bucketService, bucketId, folderId, path) {
|
|
36
|
-
const r = await bucketService.getReadUri({ bucketId, folderId, path });
|
|
37
|
-
return await fetchAndUnzip(r.uri);
|
|
23
|
+
export async function fetchDuDocumentArtifacts(sdk, data) {
|
|
24
|
+
return fetchBucketArtifacts(new BucketService(sdk), data);
|
|
38
25
|
}
|
|
39
|
-
export async function fetchBucketArtifacts(bucketService, data
|
|
40
|
-
const { BucketId, TextPath, TaxonomyPath, EncodedDocumentPath, CustomizationInfoPath, DocumentObjectModelPath, AutomaticExtractionResultsPath, ValidatedExtractionResultsPath, } = data;
|
|
26
|
+
export async function fetchBucketArtifacts(bucketService, data) {
|
|
27
|
+
const { BucketId, FolderId, FolderKey, TextPath, TaxonomyPath, EncodedDocumentPath, CustomizationInfoPath, DocumentObjectModelPath, AutomaticExtractionResultsPath, ValidatedExtractionResultsPath, } = data;
|
|
28
|
+
// The folder every bucket call is scoped to. FolderKey wins when both are
|
|
29
|
+
// set, matching the server's own precedence.
|
|
30
|
+
const scope = FolderKey
|
|
31
|
+
? { folderKey: FolderKey }
|
|
32
|
+
: FolderId
|
|
33
|
+
? { folderId: FolderId }
|
|
34
|
+
: undefined;
|
|
41
35
|
if (!BucketId ||
|
|
36
|
+
!scope ||
|
|
42
37
|
!TextPath ||
|
|
43
38
|
!TaxonomyPath ||
|
|
44
39
|
!EncodedDocumentPath ||
|
|
45
|
-
!CustomizationInfoPath ||
|
|
46
40
|
!DocumentObjectModelPath ||
|
|
47
41
|
!AutomaticExtractionResultsPath) {
|
|
48
|
-
throw new Error("ContentValidationData is missing required bucket artifact
|
|
42
|
+
throw new Error("ContentValidationData is missing required bucket fields (BucketId, artifact paths, or FolderId / FolderKey).");
|
|
49
43
|
}
|
|
44
|
+
const readUri = async (path) => (await bucketService.getReadUri({ bucketId: BucketId, path, ...scope }))
|
|
45
|
+
.uri;
|
|
46
|
+
const readJson = async (path) => fetchAndUnzipJson(await readUri(path));
|
|
47
|
+
const readText = async (path) => fetchAndUnzip(await readUri(path));
|
|
48
|
+
/** The validated result once the reviewer has saved one, else the automatic one. */
|
|
49
|
+
const readExtractionResult = async () => {
|
|
50
|
+
if (ValidatedExtractionResultsPath) {
|
|
51
|
+
try {
|
|
52
|
+
return await readJson(ValidatedExtractionResultsPath);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// Validated result not saved yet — fall through to automatic.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return readJson(AutomaticExtractionResultsPath);
|
|
59
|
+
};
|
|
50
60
|
const [taxonomy, extractionResult, dom, text, customizationInfo, original] = await Promise.all([
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
readJson(TaxonomyPath),
|
|
62
|
+
readExtractionResult(),
|
|
63
|
+
readJson(DocumentObjectModelPath),
|
|
64
|
+
readText(TextPath),
|
|
65
|
+
CustomizationInfoPath ? readJson(CustomizationInfoPath) : {},
|
|
66
|
+
readText(EncodedDocumentPath),
|
|
57
67
|
]);
|
|
58
|
-
return {
|
|
68
|
+
return {
|
|
69
|
+
taxonomy: taxonomy,
|
|
70
|
+
extractionResult: extractionResult,
|
|
71
|
+
dom: dom,
|
|
72
|
+
text,
|
|
73
|
+
customizationInfo,
|
|
74
|
+
original,
|
|
75
|
+
};
|
|
59
76
|
}
|
|
60
77
|
//# sourceMappingURL=bucketArtifactsUtil.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bucketArtifactsUtil.js","sourceRoot":"","sources":["../src/bucketArtifactsUtil.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bucketArtifactsUtil.js","sourceRoot":"","sources":["../src/bucketArtifactsUtil.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGnC,iFAAiF;AACjF,KAAK,UAAU,aAAa,CAAC,GAAW;IACtC,MAAM,GAAG,GAAG,MAAM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,EAAE,QAAwC;QAClD,gBAAgB,EAAE,gBAAgD;QAClE,GAAG,EAAE,GAAiC;QACtC,IAAI;QACJ,iBAAiB;QACjB,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
export { ValidationStationLanguage } from "./types.js";
|
|
2
|
-
export type {
|
|
2
|
+
export type { DuArtifactsSource } from "./useResolvedArtifacts.js";
|
|
3
|
+
export type { DeleteFieldValueByPath, DeleteFieldValueByPathResult, DuCommonProps, DuDocumentArtifacts, DuSaveCallbacks, DuTheme, EvaluatedBusinessRulesForFieldValueDto, IFieldValueDetailsDto, ISaveResult, IValidationStationOptions, IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest, SaveValidatedDataResult, SelectAndFocusFieldValueByPath, SelectAndFocusFieldValueByPathResult, SetFieldValueByPath, SetFieldValueByPathResult, ValidationStationEventProps, ValidationStationProps, VsSaveResultEventProps, VsStateEventProps, } from "./types.js";
|
|
3
4
|
export { ValidationStation } from "./ValidationStation.js";
|
|
5
|
+
export { useDuDocumentArtifacts } from "./useDuDocumentArtifacts.js";
|
|
6
|
+
export { fetchDuDocumentArtifacts } from "./bucketArtifactsUtil.js";
|
|
7
|
+
export { saveValidatedDataAsDraft, submitValidatedData, } from "./saveValidatedDataUtil.js";
|
|
8
|
+
export { configureValidationStationWc, DU_WC_TAGS, VALIDATION_STATION_TAG, } from "./loadValidationStationWc.js";
|
|
9
|
+
export type { ValidationStationWcConfig } from "./loadValidationStationWc.js";
|
|
10
|
+
export { joinDeploymentUrl } from "./urlUtil.js";
|
|
11
|
+
export { CompactBusinessRules } from "./subcomponents/CompactBusinessRules.js";
|
|
12
|
+
export { CompactDocTypeField } from "./subcomponents/CompactDocTypeField.js";
|
|
13
|
+
export { CompactFieldsForm } from "./subcomponents/CompactFieldsForm.js";
|
|
14
|
+
export { CompactTableEditor } from "./subcomponents/CompactTableEditor.js";
|
|
15
|
+
export { DocumentViewer } from "./subcomponents/DocumentViewer.js";
|
|
16
|
+
export type { CompactBusinessRulesProps, CompactDocTypeFieldProps, CompactFieldsFormProps, CompactTableEditorProps, DocumentViewerProps, SubcomponentCommandProps, SubcomponentCommonProps, } from "./subcomponents/types.js";
|
|
4
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,YAAY,EACV,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,8BAA8B,EAC9B,mBAAmB,EACnB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,YAAY,EACV,sBAAsB,EACtB,4BAA4B,EAC5B,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,sCAAsC,EACtC,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,6BAA6B,EAC7B,kCAAkC,EAClC,2BAA2B,EAC3B,uBAAuB,EACvB,8BAA8B,EAC9B,oCAAoC,EACpC,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,4BAA4B,EAC5B,UAAU,EACV,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
export { ValidationStationLanguage } from "./types.js";
|
|
2
2
|
export { ValidationStation } from "./ValidationStation.js";
|
|
3
|
+
export { useDuDocumentArtifacts } from "./useDuDocumentArtifacts.js";
|
|
4
|
+
// ─── Host-driven fetch & persistence ──────────────────────────────────────────
|
|
5
|
+
export { fetchDuDocumentArtifacts } from "./bucketArtifactsUtil.js";
|
|
6
|
+
export { saveValidatedDataAsDraft, submitValidatedData, } from "./saveValidatedDataUtil.js";
|
|
7
|
+
// ─── Web component loading ────────────────────────────────────────────────────
|
|
8
|
+
export { configureValidationStationWc, DU_WC_TAGS, VALIDATION_STATION_TAG, } from "./loadValidationStationWc.js";
|
|
9
|
+
export { joinDeploymentUrl } from "./urlUtil.js";
|
|
10
|
+
// ─── Subcomponents ────────────────────────────────────────────────────────────
|
|
11
|
+
export { CompactBusinessRules } from "./subcomponents/CompactBusinessRules.js";
|
|
12
|
+
export { CompactDocTypeField } from "./subcomponents/CompactDocTypeField.js";
|
|
13
|
+
export { CompactFieldsForm } from "./subcomponents/CompactFieldsForm.js";
|
|
14
|
+
export { CompactTableEditor } from "./subcomponents/CompactTableEditor.js";
|
|
15
|
+
export { DocumentViewer } from "./subcomponents/DocumentViewer.js";
|
|
3
16
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AA0BvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,iFAAiF;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,iFAAiF;AACjF,OAAO,EACL,4BAA4B,EAC5B,UAAU,EACV,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,iFAAiF;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC"}
|