@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,6 +1,75 @@
|
|
|
1
|
-
import "@uipath/du-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { type LoadWebComponentOptions, type ResolveBaseUrl } from "@uipath/du-utils";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for {@link configureValidationStationWc} — the deployment URL
|
|
4
|
+
* plus every option the underlying loader accepts (currently `includeFonts`:
|
|
5
|
+
* inject the web component's `fonts.css` as a light-DOM stylesheet, needed
|
|
6
|
+
* unless the host already loads Apollo fonts and Material Icons globally).
|
|
7
|
+
*/
|
|
8
|
+
export interface ValidationStationWcConfig extends LoadWebComponentOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Base URL the web component's build artifacts (`polyfills.js`, `main.js`,
|
|
11
|
+
* `styles.css`, `fonts.css`) are served from — e.g. `/du-vs-wc` when the
|
|
12
|
+
* contents of `@uipath/du-validation-station-wc` are hosted from the app's
|
|
13
|
+
* own static assets. Accepts a resolver (`() => string | Promise<string>`)
|
|
14
|
+
* for cases where the URL isn't known synchronously — it's called lazily,
|
|
15
|
+
* at most once per load.
|
|
16
|
+
*
|
|
17
|
+
* Defaults to `du-vs-wc` joined onto {@link getAppBase}, which resolves to
|
|
18
|
+
* `/du-vs-wc` for a plain host and to the deployed app's own base path for a
|
|
19
|
+
* UiPath Coded App — no decision needed for either case. Pass an explicit
|
|
20
|
+
* `deploymentUrl` only when the web component is actually hosted somewhere
|
|
21
|
+
* that default doesn't reach (a different origin, a renamed path).
|
|
22
|
+
*
|
|
23
|
+
* Treat this as trusted application configuration: the loader injects
|
|
24
|
+
* `<script type="module" src>` from it, so whoever controls this URL executes
|
|
25
|
+
* script in your app's origin. Pass a literal, a build-time value, or a
|
|
26
|
+
* resolver derived from one of those — never one derived from `location`, a
|
|
27
|
+
* query parameter, or any other user input.
|
|
28
|
+
*/
|
|
29
|
+
deploymentUrl?: string | ResolveBaseUrl;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Loads the Validation Station web component from `deploymentUrl` (or its
|
|
33
|
+
* default — see {@link ValidationStationWcConfig.deploymentUrl}) and registers
|
|
34
|
+
* every custom element in {@link DU_WC_TAGS}. Call this once at app startup,
|
|
35
|
+
* before rendering any component from this package. Every argument is
|
|
36
|
+
* optional, so `configureValidationStationWc()` is a valid call on a plain
|
|
37
|
+
* host or a UiPath Coded App alike.
|
|
38
|
+
*
|
|
39
|
+
* Loading is per-page and idempotent: while a load is pending or has succeeded,
|
|
40
|
+
* repeat calls return that same promise without re-injecting scripts, so a later
|
|
41
|
+
* call with a different `deploymentUrl` has no effect. Calling it again *after* a
|
|
42
|
+
* failure starts a fresh attempt.
|
|
43
|
+
*
|
|
44
|
+
* The returned promise is the error channel for load failures (a bad URL, a 404,
|
|
45
|
+
* an offline network). The rejection is retained, so components waiting via
|
|
46
|
+
* {@link waitForWcElementReady} observe the same error rather than waiting
|
|
47
|
+
* forever.
|
|
48
|
+
*/
|
|
49
|
+
export declare function configureValidationStationWc(config?: ValidationStationWcConfig): Promise<void>;
|
|
4
50
|
export declare const VALIDATION_STATION_TAG = "ui-du-validation-station-standalone-wc-element";
|
|
5
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Custom-element tag names for every standalone DU web component registered by
|
|
53
|
+
* {@link configureValidationStationWc}. Each has a `-persistent-element` sibling
|
|
54
|
+
* (see {@link convertToPersistentTag}) that survives portal detachment via
|
|
55
|
+
* `forceDestroy()`.
|
|
56
|
+
*/
|
|
57
|
+
export declare const DU_WC_TAGS: {
|
|
58
|
+
readonly validationStation: "ui-du-validation-station-standalone-wc-element";
|
|
59
|
+
readonly documentViewer: "ui-du-document-viewer-standalone-wc-element";
|
|
60
|
+
readonly compactFieldsForm: "ui-du-compact-fields-form-standalone-wc-element";
|
|
61
|
+
readonly compactTableEditor: "ui-du-compact-table-editor-standalone-wc-element";
|
|
62
|
+
readonly compactBusinessRules: "ui-du-compact-business-rules-standalone-wc-element";
|
|
63
|
+
readonly compactDocTypeField: "ui-du-compact-doc-type-field-standalone-wc-element";
|
|
64
|
+
};
|
|
65
|
+
/** Maps a base element tag to its persistent (`forceDestroy()`-capable) variant. */
|
|
66
|
+
export declare function convertToPersistentTag(tag: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Resolves once `tag` has been registered in the browser's custom-element
|
|
69
|
+
* registry — i.e. after {@link configureValidationStationWc}'s scripts have run.
|
|
70
|
+
*
|
|
71
|
+
* The loader resolves on the bundle's `load` event, which is before Angular
|
|
72
|
+
* Elements has defined the elements, so both waits are needed.
|
|
73
|
+
*/
|
|
74
|
+
export declare function waitForWcElementReady(tag: string): Promise<void>;
|
|
6
75
|
//# sourceMappingURL=loadValidationStationWc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadValidationStationWc.d.ts","sourceRoot":"","sources":["../src/loadValidationStationWc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadValidationStationWc.d.ts","sourceRoot":"","sources":["../src/loadValidationStationWc.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAI1B;;;;;GAKG;AACH,MAAM,WAAW,yBAA0B,SAAQ,uBAAuB;IACxE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;CACzC;AAqBD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,GAAE,yBAA8B,GACrC,OAAO,CAAC,IAAI,CAAC,CAoBf;AAED,eAAO,MAAM,sBAAsB,mDACe,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;;;;;CAOb,CAAC;AAEX,oFAAoF;AACpF,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BtE"}
|
|
@@ -1,11 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { loadWebComponent, vsAppName, } from "@uipath/du-utils";
|
|
2
|
+
import { getAppBase } from "@uipath/uipath-typescript";
|
|
3
|
+
import { joinDeploymentUrl } from "./urlUtil.js";
|
|
4
|
+
let loadPromise = null;
|
|
5
|
+
let loadFailed = false;
|
|
6
|
+
let warnedUnconfigured = false;
|
|
7
|
+
/**
|
|
8
|
+
* zone.js — loaded by the web component's `polyfills.js` — replaces the global
|
|
9
|
+
* `Promise` with `ZoneAwarePromise`, which lacks `Promise.try()`. The web
|
|
10
|
+
* component calls it at render time rather than at module init, so restoring it
|
|
11
|
+
* once the bundle has loaded is early enough. Remove when the web component
|
|
12
|
+
* upgrades zone.js.
|
|
13
|
+
*/
|
|
14
|
+
function restorePromiseTry() {
|
|
15
|
+
if (typeof Promise.try === "function")
|
|
16
|
+
return;
|
|
17
|
+
Promise.try = (fn, ...args) => new Promise((resolve) => resolve(fn(...args)));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Loads the Validation Station web component from `deploymentUrl` (or its
|
|
21
|
+
* default — see {@link ValidationStationWcConfig.deploymentUrl}) and registers
|
|
22
|
+
* every custom element in {@link DU_WC_TAGS}. Call this once at app startup,
|
|
23
|
+
* before rendering any component from this package. Every argument is
|
|
24
|
+
* optional, so `configureValidationStationWc()` is a valid call on a plain
|
|
25
|
+
* host or a UiPath Coded App alike.
|
|
26
|
+
*
|
|
27
|
+
* Loading is per-page and idempotent: while a load is pending or has succeeded,
|
|
28
|
+
* repeat calls return that same promise without re-injecting scripts, so a later
|
|
29
|
+
* call with a different `deploymentUrl` has no effect. Calling it again *after* a
|
|
30
|
+
* failure starts a fresh attempt.
|
|
31
|
+
*
|
|
32
|
+
* The returned promise is the error channel for load failures (a bad URL, a 404,
|
|
33
|
+
* an offline network). The rejection is retained, so components waiting via
|
|
34
|
+
* {@link waitForWcElementReady} observe the same error rather than waiting
|
|
35
|
+
* forever.
|
|
36
|
+
*/
|
|
37
|
+
export function configureValidationStationWc(config = {}) {
|
|
38
|
+
if (loadPromise && !loadFailed)
|
|
39
|
+
return loadPromise;
|
|
40
|
+
const { deploymentUrl = joinDeploymentUrl(getAppBase(), vsAppName), ...options } = config;
|
|
41
|
+
loadFailed = false;
|
|
42
|
+
loadPromise = loadWebComponent(vsAppName, document, deploymentUrl, options)
|
|
43
|
+
.then(restorePromiseTry)
|
|
44
|
+
.catch((error) => {
|
|
45
|
+
// Flag rather than clear: `waitForWcElementReady` must still see this
|
|
46
|
+
// rejection (clearing it would look indistinguishable from "never
|
|
47
|
+
// configured" and hang every waiter), while a later configure call is
|
|
48
|
+
// still free to start a new attempt.
|
|
49
|
+
loadFailed = true;
|
|
50
|
+
throw error;
|
|
51
|
+
});
|
|
52
|
+
return loadPromise;
|
|
53
|
+
}
|
|
7
54
|
export const VALIDATION_STATION_TAG = "ui-du-validation-station-standalone-wc-element";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Custom-element tag names for every standalone DU web component registered by
|
|
57
|
+
* {@link configureValidationStationWc}. Each has a `-persistent-element` sibling
|
|
58
|
+
* (see {@link convertToPersistentTag}) that survives portal detachment via
|
|
59
|
+
* `forceDestroy()`.
|
|
60
|
+
*/
|
|
61
|
+
export const DU_WC_TAGS = {
|
|
62
|
+
validationStation: VALIDATION_STATION_TAG,
|
|
63
|
+
documentViewer: "ui-du-document-viewer-standalone-wc-element",
|
|
64
|
+
compactFieldsForm: "ui-du-compact-fields-form-standalone-wc-element",
|
|
65
|
+
compactTableEditor: "ui-du-compact-table-editor-standalone-wc-element",
|
|
66
|
+
compactBusinessRules: "ui-du-compact-business-rules-standalone-wc-element",
|
|
67
|
+
compactDocTypeField: "ui-du-compact-doc-type-field-standalone-wc-element",
|
|
68
|
+
};
|
|
69
|
+
/** Maps a base element tag to its persistent (`forceDestroy()`-capable) variant. */
|
|
70
|
+
export function convertToPersistentTag(tag) {
|
|
71
|
+
return tag.replace(/-element$/, "-persistent-element");
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Resolves once `tag` has been registered in the browser's custom-element
|
|
75
|
+
* registry — i.e. after {@link configureValidationStationWc}'s scripts have run.
|
|
76
|
+
*
|
|
77
|
+
* The loader resolves on the bundle's `load` event, which is before Angular
|
|
78
|
+
* Elements has defined the elements, so both waits are needed.
|
|
79
|
+
*/
|
|
80
|
+
export async function waitForWcElementReady(tag) {
|
|
81
|
+
// No custom-element registry off the main thread / during SSR — resolve to a
|
|
82
|
+
// no-op so this never touches `window` on the server.
|
|
83
|
+
//
|
|
84
|
+
// Guarded here but deliberately *not* in `configureValidationStationWc`, which
|
|
85
|
+
// uses `document` unguarded: this function is reached through `useWcReady`
|
|
86
|
+
// during React rendering, so the framework decides when it runs and a consumer
|
|
87
|
+
// server-rendering <ValidationStation> hits it without opting in. Configuring
|
|
88
|
+
// is the opposite — an explicit call the consumer places at a browser entry
|
|
89
|
+
// point, where a loud `ReferenceError` beats an unhandled rejection (the
|
|
90
|
+
// documented usage is fire-and-forget, with no `.catch`).
|
|
91
|
+
if (typeof window === "undefined")
|
|
92
|
+
return;
|
|
93
|
+
if (loadPromise) {
|
|
94
|
+
await loadPromise;
|
|
95
|
+
}
|
|
96
|
+
else if (!warnedUnconfigured) {
|
|
97
|
+
warnedUnconfigured = true;
|
|
98
|
+
// Not fatal: the host page may have loaded the same bundle by other means
|
|
99
|
+
// (the loader caches on `window`, and hosts like Action Center preload it).
|
|
100
|
+
// Fall through to `whenDefined` so that case still works.
|
|
101
|
+
console.error("[validation-station] configureValidationStationWc({ deploymentUrl }) has not " +
|
|
102
|
+
"been called. Waiting in case the host page loaded the web component another way.");
|
|
103
|
+
}
|
|
104
|
+
await window.customElements.whenDefined(tag);
|
|
105
|
+
}
|
|
11
106
|
//# sourceMappingURL=loadValidationStationWc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadValidationStationWc.js","sourceRoot":"","sources":["../src/loadValidationStationWc.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"loadValidationStationWc.js","sourceRoot":"","sources":["../src/loadValidationStationWc.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,SAAS,GAGV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAgCjD,IAAI,WAAW,GAAyB,IAAI,CAAC;AAC7C,IAAI,UAAU,GAAG,KAAK,CAAC;AACvB,IAAI,kBAAkB,GAAG,KAAK,CAAC;AAE/B;;;;;;GAMG;AACH,SAAS,iBAAiB;IACxB,IAAI,OAAO,OAAO,CAAC,GAAG,KAAK,UAAU;QAAE,OAAO;IAC9C,OAAO,CAAC,GAAG,GAAG,CACZ,EAAsC,EACtC,GAAG,IAAO,EACV,EAAE,CAAC,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO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,2EAA2E;IAC3E,+EAA+E;IAC/E,8EAA8E;IAC9E,4EAA4E;IAC5E,yEAAyE;IACzE,0DAA0D;IAC1D,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAE1C,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,WAAW,CAAC;IACpB,CAAC;SAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC/B,kBAAkB,GAAG,IAAI,CAAC;QAC1B,0EAA0E;QAC1E,4EAA4E;QAC5E,0DAA0D;QAC1D,OAAO,CAAC,KAAK,CACX,+EAA+E;YAC7E,kFAAkF,CACrF,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest } from "@uipath/du-validation-station-wc";
|
|
2
|
+
import type { UiPath } from "@uipath/uipath-typescript/core";
|
|
3
|
+
import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
|
|
4
|
+
import { type DuSaveCallbacks } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Builds the save/draft/exception listeners shared by the two save-capable
|
|
7
|
+
* widgets, `ValidationStation` and `CompactFieldsForm`, so their behaviour
|
|
8
|
+
* cannot drift: each persists when it can, tracks the flow once, and emits the
|
|
9
|
+
* request with the outcome attached only when it was the one that saved.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createSaveHandlers({ sdk, data }: {
|
|
12
|
+
sdk?: UiPath;
|
|
13
|
+
data?: DuFramework.ContentValidationData;
|
|
14
|
+
}, { onSubmit, onSaveAsDraft, onReportException }: DuSaveCallbacks): {
|
|
15
|
+
handleSubmit: (request: IVsSaveValidatedDataRequest) => void;
|
|
16
|
+
handleSaveAsDraft: (request: IVsSaveValidatedDataAsDraftRequest) => void;
|
|
17
|
+
handleException: (request: IVsSaveExceptionReportRequest) => void;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=saveHandlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saveHandlers.d.ts","sourceRoot":"","sources":["../src/saveHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,kCAAkC,EAClC,2BAA2B,EAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAKpF,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,YAAY,CAAC;AAGpB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAC,qBAAqB,CAAA;CAAE,EACzE,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EAAE,EAAE,eAAe;4BAOrC,2BAA2B;iCAgBtB,kCAAkC;+BAWpC,6BAA6B;EAK3D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { saveValidatedDataAsDraft, submitValidatedData, } from "./saveValidatedDataUtil.js";
|
|
2
|
+
import { TelemetryEvent, TelemetryStatus, } from "./types.js";
|
|
3
|
+
import { trackTelemetry } from "./utils/telemetryUtils.js";
|
|
4
|
+
/**
|
|
5
|
+
* Builds the save/draft/exception listeners shared by the two save-capable
|
|
6
|
+
* widgets, `ValidationStation` and `CompactFieldsForm`, so their behaviour
|
|
7
|
+
* cannot drift: each persists when it can, tracks the flow once, and emits the
|
|
8
|
+
* request with the outcome attached only when it was the one that saved.
|
|
9
|
+
*/
|
|
10
|
+
export function createSaveHandlers({ sdk, data }, { onSubmit, onSaveAsDraft, onReportException }) {
|
|
11
|
+
// Everything a write-back needs: an SDK, a payload, and the folder its
|
|
12
|
+
// bucket is scoped to.
|
|
13
|
+
const canPersist = !!sdk && !!data && !!(data.FolderKey || data.FolderId);
|
|
14
|
+
return {
|
|
15
|
+
handleSubmit: (request) => {
|
|
16
|
+
if (!canPersist) {
|
|
17
|
+
// No outcome to wait for, so the event records the attempt.
|
|
18
|
+
trackTelemetry(TelemetryEvent.Submit, TelemetryStatus.Success);
|
|
19
|
+
onSubmit?.(request);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
submitValidatedData(sdk, data, request).then((result) => {
|
|
23
|
+
trackTelemetry(TelemetryEvent.Submit, result.success ? TelemetryStatus.Success : TelemetryStatus.Error);
|
|
24
|
+
onSubmit?.(request, result);
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
handleSaveAsDraft: (request) => {
|
|
28
|
+
if (!canPersist) {
|
|
29
|
+
onSaveAsDraft?.(request);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
saveValidatedDataAsDraft(sdk, data, request).then((result) => onSaveAsDraft?.(request, result));
|
|
33
|
+
},
|
|
34
|
+
// Never persisted by either widget — the host owns it.
|
|
35
|
+
handleException: (request) => {
|
|
36
|
+
trackTelemetry(TelemetryEvent.ExceptionRequest, TelemetryStatus.Success);
|
|
37
|
+
onReportException?.(request);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=saveHandlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saveHandlers.js","sourceRoot":"","sources":["../src/saveHandlers.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,cAAc,EACd,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,EAAE,GAAG,E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,CAAC,gBAAgB,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;YACzE,iBAAiB,EAAE,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -5,6 +5,6 @@ export interface SaveValidatedDataResult {
|
|
|
5
5
|
success: boolean;
|
|
6
6
|
error?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function submitValidatedData(sdk: UiPath, data: DuFramework.ContentValidationData,
|
|
9
|
-
export declare function saveValidatedDataAsDraft(sdk: UiPath, data: DuFramework.ContentValidationData,
|
|
8
|
+
export declare function submitValidatedData(sdk: UiPath, data: DuFramework.ContentValidationData, request: IVsSaveValidatedDataRequest): Promise<SaveValidatedDataResult>;
|
|
9
|
+
export declare function saveValidatedDataAsDraft(sdk: UiPath, data: DuFramework.ContentValidationData, request: IVsSaveValidatedDataAsDraftRequest): Promise<SaveValidatedDataResult>;
|
|
10
10
|
//# sourceMappingURL=saveValidatedDataUtil.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveValidatedDataUtil.d.ts","sourceRoot":"","sources":["../src/saveValidatedDataUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kCAAkC,EAClC,2BAA2B,EAC5B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAIpF,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"saveValidatedDataUtil.d.ts","sourceRoot":"","sources":["../src/saveValidatedDataUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kCAAkC,EAClC,2BAA2B,EAC5B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAIpF,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAgED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,CAAC,qBAAqB,EACvC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,uBAAuB,CAAC,CAsBlC;AAED,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,CAAC,qBAAqB,EACvC,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,uBAAuB,CAAC,CAclC"}
|
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
import { BucketService } from "@uipath/uipath-typescript/buckets";
|
|
2
2
|
import { OrchestratorDuModule } from "@uipath/uipath-typescript/orchestrator-du-module";
|
|
3
3
|
import { strToU8, zipSync } from "fflate";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Where a validated result is written, as described by `data`: the bucket, the
|
|
6
|
+
* path, and the folder both are scoped to. Throws when a piece is missing, so
|
|
7
|
+
* the two save flows report it through their own `SaveValidatedDataResult`.
|
|
8
|
+
*/
|
|
9
|
+
function bucketTarget(data) {
|
|
10
|
+
const { BucketId, ValidatedExtractionResultsPath, DocumentId, FolderId, FolderKey, } = data;
|
|
11
|
+
// FolderKey wins when both are set, matching the server's own precedence.
|
|
12
|
+
const scope = FolderKey
|
|
13
|
+
? { folderKey: FolderKey }
|
|
14
|
+
: FolderId
|
|
15
|
+
? { folderId: FolderId }
|
|
16
|
+
: undefined;
|
|
17
|
+
if (!BucketId || !ValidatedExtractionResultsPath || !scope) {
|
|
18
|
+
throw new Error("ContentValidationData is missing BucketId, ValidatedExtractionResultsPath, or a folder (FolderId / FolderKey).");
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
bucketId: BucketId,
|
|
22
|
+
path: ValidatedExtractionResultsPath,
|
|
23
|
+
scope,
|
|
24
|
+
documentId: DocumentId,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
async function uploadResultToBucket(bucketService, { bucketId, path, scope, documentId }, payload) {
|
|
5
28
|
// The bucket stores a .zip containing a single JSON file. The inner
|
|
6
29
|
// filename is derived from the upload path's basename (e.g.
|
|
7
30
|
// "results/output.zip" → "output.json"). If the path has no basename
|
|
@@ -14,34 +37,28 @@ async function uploadResultToBucket(bucketService, bucketId, folderId, path, dat
|
|
|
14
37
|
const fileName = basename
|
|
15
38
|
? basename.replace(/\.zip$/i, ".json")
|
|
16
39
|
: fallbackFileName;
|
|
17
|
-
const zipped = zipSync({ [fileName]: strToU8(JSON.stringify(
|
|
40
|
+
const zipped = zipSync({ [fileName]: strToU8(JSON.stringify(payload)) });
|
|
18
41
|
const blob = new Blob([new Uint8Array(zipped)], { type: "application/zip" });
|
|
19
42
|
const result = await bucketService.uploadFile({
|
|
20
43
|
bucketId,
|
|
21
|
-
folderId,
|
|
22
44
|
path,
|
|
23
45
|
content: blob,
|
|
46
|
+
...scope,
|
|
24
47
|
});
|
|
25
48
|
if (!result.success) {
|
|
26
49
|
throw new Error(`Bucket upload failed with status ${result.statusCode}`);
|
|
27
50
|
}
|
|
28
51
|
}
|
|
29
|
-
export async function submitValidatedData(sdk, data,
|
|
30
|
-
const { BucketId, ValidatedExtractionResultsPath, DocumentId } = data;
|
|
31
|
-
if (!BucketId || !ValidatedExtractionResultsPath) {
|
|
32
|
-
return {
|
|
33
|
-
success: false,
|
|
34
|
-
error: "ContentValidationData is missing BucketId or ValidatedExtractionResultsPath.",
|
|
35
|
-
};
|
|
36
|
-
}
|
|
52
|
+
export async function submitValidatedData(sdk, data, request) {
|
|
37
53
|
try {
|
|
54
|
+
const target = bucketTarget(data);
|
|
38
55
|
const du = new OrchestratorDuModule(sdk);
|
|
39
56
|
const processedResult = await du.processExtractedData({
|
|
40
57
|
AutomaticExtractedResults: request.automaticExtractionResult,
|
|
41
58
|
ValidatedExtractedResults: request.validatedData,
|
|
42
59
|
Taxonomy: request.taxonomy,
|
|
43
|
-
},
|
|
44
|
-
await uploadResultToBucket(new BucketService(sdk),
|
|
60
|
+
}, target.scope);
|
|
61
|
+
await uploadResultToBucket(new BucketService(sdk), target, processedResult);
|
|
45
62
|
return { success: true };
|
|
46
63
|
}
|
|
47
64
|
catch (error) {
|
|
@@ -51,16 +68,9 @@ export async function submitValidatedData(sdk, data, folderId, request) {
|
|
|
51
68
|
};
|
|
52
69
|
}
|
|
53
70
|
}
|
|
54
|
-
export async function saveValidatedDataAsDraft(sdk, data,
|
|
55
|
-
const { BucketId, ValidatedExtractionResultsPath, DocumentId } = data;
|
|
56
|
-
if (!BucketId || !ValidatedExtractionResultsPath) {
|
|
57
|
-
return {
|
|
58
|
-
success: false,
|
|
59
|
-
error: "ContentValidationData is missing BucketId or ValidatedExtractionResultsPath.",
|
|
60
|
-
};
|
|
61
|
-
}
|
|
71
|
+
export async function saveValidatedDataAsDraft(sdk, data, request) {
|
|
62
72
|
try {
|
|
63
|
-
await uploadResultToBucket(new BucketService(sdk),
|
|
73
|
+
await uploadResultToBucket(new BucketService(sdk), bucketTarget(data), request.validatedData);
|
|
64
74
|
return { success: true };
|
|
65
75
|
}
|
|
66
76
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveValidatedDataUtil.js","sourceRoot":"","sources":["../src/saveValidatedDataUtil.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAO1C,KAAK,UAAU,oBAAoB,CACjC,aAA4B,EAC5B,
|
|
1
|
+
{"version":3,"file":"saveValidatedDataUtil.js","sourceRoot":"","sources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,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,GAAW,EACX,IAAuC,EACvC,OAA2C;IAE3C,IAAI,CAAC;QACH,MAAM,oBAAoB,CACxB,IAAI,aAAa,CAAC,GAAG,CAAC,EACtB,YAAY,CAAC,IAAI,CAAC,EAClB,OAAO,CAAC,aAAa,CACtB,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CompactBusinessRulesProps } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* React wrapper for `<ui-du-compact-business-rules-standalone-wc-element>` — a
|
|
4
|
+
* read-only panel surfacing the evaluated business rules for the shared store.
|
|
5
|
+
* Pair it with a fields-form / table-editor via a shared `instanceId`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CompactBusinessRules: React.FC<CompactBusinessRulesProps>;
|
|
8
|
+
//# sourceMappingURL=CompactBusinessRules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompactBusinessRules.d.ts","sourceRoot":"","sources":["../../src/subcomponents/CompactBusinessRules.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAG5D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA4EpE,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
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-business-rules-standalone-wc-element>` — a
|
|
7
|
+
* read-only panel surfacing the evaluated business rules for the shared store.
|
|
8
|
+
* Pair it with a fields-form / table-editor via a shared `instanceId`.
|
|
9
|
+
*/
|
|
10
|
+
export const CompactBusinessRules = ({ instanceId, theme, language, isReadonly, persistent, className, style, options, setFieldValueByPath, selectAndFocusFieldValueByPath, deleteFieldValueByPath, discardChanges, onLoaded, onDirtyChange, onDocumentTypeChanged, onExtractionResultChanged, onFieldValueSelected, onFieldValueChanged, onBusinessRulesEvaluated, onSetFieldValueByPathResult, onSelectAndFocusFieldValueByPathResult, onDeleteFieldValueByPathResult, onBusinessRulesToggle, onBusinessRuleClick, ...dataSource }) => {
|
|
11
|
+
const { artifacts, error, wcReady, tag, commonProps } = useWcElement({
|
|
12
|
+
baseTag: DU_WC_TAGS.compactBusinessRules,
|
|
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
|
+
dirty: onDirtyChange,
|
|
27
|
+
documentTypeChanged: onDocumentTypeChanged,
|
|
28
|
+
extractionResultChanged: onExtractionResultChanged,
|
|
29
|
+
fieldValueSelected: onFieldValueSelected,
|
|
30
|
+
fieldValueChanged: onFieldValueChanged,
|
|
31
|
+
businessRulesEvaluated: onBusinessRulesEvaluated,
|
|
32
|
+
setFieldValueByPathResult: onSetFieldValueByPathResult,
|
|
33
|
+
selectAndFocusFieldValueByPathResult: onSelectAndFocusFieldValueByPathResult,
|
|
34
|
+
deleteFieldValueByPathResult: onDeleteFieldValueByPathResult,
|
|
35
|
+
businessRulesToggle: onBusinessRulesToggle,
|
|
36
|
+
businessRuleClick: onBusinessRuleClick,
|
|
37
|
+
}, persistent);
|
|
38
|
+
const gate = resolveArtifacts(error, wcReady, artifacts);
|
|
39
|
+
if (!gate.ready)
|
|
40
|
+
return gate.fallback;
|
|
41
|
+
const { taxonomy, extractionResult, customizationInfo } = gate.artifacts;
|
|
42
|
+
const props = {
|
|
43
|
+
...commonProps,
|
|
44
|
+
options,
|
|
45
|
+
discardChanges,
|
|
46
|
+
setFieldValueByPath,
|
|
47
|
+
selectAndFocusFieldValueByPath,
|
|
48
|
+
deleteFieldValueByPath,
|
|
49
|
+
taxonomy,
|
|
50
|
+
extractionResult,
|
|
51
|
+
customizationInfo,
|
|
52
|
+
};
|
|
53
|
+
return renderWcElement(tag, props, ref);
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=CompactBusinessRules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompactBusinessRules.js","sourceRoot":"","sources":["../../src/subcomponents/CompactBusinessRules.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,oBAAoB,GAAwC,CAAC,EACxE,UAAU,EACV,KAAK,EACL,QAAQ,E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M,KAAK,GAA8C;QACvD,GAAG,WAAW;QACd,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 { CompactDocTypeFieldProps } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* React wrapper for `<ui-du-compact-doc-type-field-standalone-wc-element>` — a
|
|
4
|
+
* lightweight document-type selector. Share its store with a fields-form /
|
|
5
|
+
* viewer via a common `instanceId` so a document-type change propagates.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CompactDocTypeField: React.FC<CompactDocTypeFieldProps>;
|
|
8
|
+
//# sourceMappingURL=CompactDocTypeField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompactDocTypeField.d.ts","sourceRoot":"","sources":["../../src/subcomponents/CompactDocTypeField.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAG3D;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAiDlE,CAAC"}
|
|
@@ -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. The only save-capable
|
|
5
|
+
* subcomponent: given `sdk` + `data` it persists the submit and draft flows
|
|
6
|
+
* itself, exactly as `ValidationStation` does, and reports through the same
|
|
7
|
+
* callbacks either way.
|
|
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":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGzD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAmG9D,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useWcRef } from "../bindWcEvents.js";
|
|
2
|
+
import { DU_WC_TAGS } from "../loadValidationStationWc.js";
|
|
3
|
+
import { createSaveHandlers } from "../saveHandlers.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. The only save-capable
|
|
9
|
+
* subcomponent: given `sdk` + `data` it persists the submit and draft flows
|
|
10
|
+
* itself, exactly as `ValidationStation` does, and reports through the same
|
|
11
|
+
* callbacks either way.
|
|
12
|
+
*/
|
|
13
|
+
export const CompactFieldsForm = ({ sdk, data, 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, onSubmit, onSaveAsDraft, onReportException, }) => {
|
|
14
|
+
const { artifacts, error, wcReady, tag, commonProps } = useWcElement({
|
|
15
|
+
baseTag: DU_WC_TAGS.compactFieldsForm,
|
|
16
|
+
dataSource: {
|
|
17
|
+
sdk,
|
|
18
|
+
data,
|
|
19
|
+
artifacts: providedArtifacts,
|
|
20
|
+
documentId: documentIdProp,
|
|
21
|
+
},
|
|
22
|
+
common: {
|
|
23
|
+
instanceId,
|
|
24
|
+
theme,
|
|
25
|
+
language,
|
|
26
|
+
isReadonly,
|
|
27
|
+
persistent,
|
|
28
|
+
className,
|
|
29
|
+
style,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
const { handleSubmit, handleSaveAsDraft, handleException } = createSaveHandlers({ sdk, data }, { onSubmit, onSaveAsDraft, onReportException });
|
|
33
|
+
const ref = useWcRef({
|
|
34
|
+
loaded: onLoaded,
|
|
35
|
+
dirty: onDirtyChange,
|
|
36
|
+
documentTypeChanged: onDocumentTypeChanged,
|
|
37
|
+
extractionResultChanged: onExtractionResultChanged,
|
|
38
|
+
fieldValueSelected: onFieldValueSelected,
|
|
39
|
+
fieldValueChanged: onFieldValueChanged,
|
|
40
|
+
businessRulesEvaluated: onBusinessRulesEvaluated,
|
|
41
|
+
setFieldValueByPathResult: onSetFieldValueByPathResult,
|
|
42
|
+
selectAndFocusFieldValueByPathResult: onSelectAndFocusFieldValueByPathResult,
|
|
43
|
+
deleteFieldValueByPathResult: onDeleteFieldValueByPathResult,
|
|
44
|
+
saveResult: onSaveResult,
|
|
45
|
+
saveValidatedDataRequest: handleSubmit,
|
|
46
|
+
saveValidatedDataAsDraftRequest: handleSaveAsDraft,
|
|
47
|
+
saveExceptionReportRequest: handleException,
|
|
48
|
+
}, persistent);
|
|
49
|
+
const gate = resolveArtifacts(error, wcReady, artifacts);
|
|
50
|
+
if (!gate.ready)
|
|
51
|
+
return gate.fallback;
|
|
52
|
+
const { taxonomy, extractionResult, customizationInfo } = gate.artifacts;
|
|
53
|
+
const props = {
|
|
54
|
+
...commonProps,
|
|
55
|
+
enableSaveAsDraft,
|
|
56
|
+
options,
|
|
57
|
+
save,
|
|
58
|
+
discardChanges,
|
|
59
|
+
setFieldValueByPath,
|
|
60
|
+
selectAndFocusFieldValueByPath,
|
|
61
|
+
deleteFieldValueByPath,
|
|
62
|
+
taxonomy,
|
|
63
|
+
extractionResult,
|
|
64
|
+
customizationInfo,
|
|
65
|
+
};
|
|
66
|
+
return renderWcElement(tag, props, ref);
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=CompactFieldsForm.js.map
|