@uipath/ui-widgets-validation-station 1.0.1-beta.6 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +198 -90
- package/dist/ValidationStation.d.ts +1 -1
- package/dist/ValidationStation.d.ts.map +1 -1
- package/dist/ValidationStation.js +22 -18
- package/dist/ValidationStation.js.map +1 -1
- package/dist/ValidationStation.stories.d.ts.map +1 -1
- package/dist/ValidationStation.stories.js +0 -6
- 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 +1 -1
- package/dist/bucketArtifactsUtil.d.ts.map +1 -1
- package/dist/bucketArtifactsUtil.js +8 -1
- package/dist/bucketArtifactsUtil.js.map +1 -1
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/loadValidationStationWc.d.ts +17 -0
- package/dist/loadValidationStationWc.d.ts.map +1 -1
- package/dist/loadValidationStationWc.js +37 -3
- package/dist/loadValidationStationWc.js.map +1 -1
- package/dist/saveValidatedDataUtil.d.ts +4 -3
- package/dist/saveValidatedDataUtil.d.ts.map +1 -1
- package/dist/saveValidatedDataUtil.js +28 -33
- 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 +87 -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 +128 -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 +44 -0
- package/dist/subcomponents/useWcElement.d.ts.map +1 -0
- package/dist/subcomponents/useWcElement.js +40 -0
- package/dist/subcomponents/useWcElement.js.map +1 -0
- package/dist/types.d.ts +22 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/useBucketArtifacts.d.ts +11 -3
- package/dist/useBucketArtifacts.d.ts.map +1 -1
- package/dist/useBucketArtifacts.js +15 -35
- package/dist/useBucketArtifacts.js.map +1 -1
- package/dist/useSubcomponentArtifacts.d.ts +44 -0
- package/dist/useSubcomponentArtifacts.d.ts.map +1 -0
- package/dist/useSubcomponentArtifacts.js +87 -0
- package/dist/useSubcomponentArtifacts.js.map +1 -0
- package/dist/useWcReady.d.ts +8 -0
- package/dist/useWcReady.d.ts.map +1 -0
- package/dist/useWcReady.js +23 -0
- package/dist/useWcReady.js.map +1 -0
- package/package.json +6 -10
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ npm install @uipath/ui-widgets-validation-station
|
|
|
13
13
|
```
|
|
14
14
|
react >= 19.2.0
|
|
15
15
|
react-dom >= 19.2.0
|
|
16
|
-
@uipath/uipath-typescript >= 1.
|
|
16
|
+
@uipath/uipath-typescript >= 1.4.2
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Quick start
|
|
@@ -23,10 +23,10 @@ react-dom >= 19.2.0
|
|
|
23
23
|
```tsx
|
|
24
24
|
import {
|
|
25
25
|
ValidationStation,
|
|
26
|
-
|
|
26
|
+
ValidationStationLanguage,
|
|
27
27
|
} from "@uipath/ui-widgets-validation-station";
|
|
28
|
-
import "@uipath/ui-widgets-validation-station/ValidationStation.css";
|
|
29
28
|
import { UiPath } from "@uipath/uipath-typescript/core";
|
|
29
|
+
import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
|
|
30
30
|
|
|
31
31
|
const sdk = new UiPath({
|
|
32
32
|
baseUrl: "https://cloud.uipath.com",
|
|
@@ -41,92 +41,120 @@ function App() {
|
|
|
41
41
|
return (
|
|
42
42
|
<ValidationStation
|
|
43
43
|
sdk={sdk}
|
|
44
|
-
data={
|
|
44
|
+
data={selectedTask.data as DuFramework.ContentValidationData}
|
|
45
45
|
folderId={12345}
|
|
46
|
-
theme="light"
|
|
47
|
-
language={Language.English}
|
|
48
46
|
/>
|
|
49
47
|
);
|
|
50
48
|
}
|
|
51
49
|
```
|
|
52
50
|
|
|
53
|
-
>
|
|
54
|
-
|
|
55
|
-
>
|
|
51
|
+
> `theme` defaults to `"light"` and `language` defaults to `ValidationStationLanguage.English`, so the minimal mount just needs `sdk`, `data`, and a folder.
|
|
52
|
+
|
|
53
|
+
> See [Static assets & runtime stylesheets](#static-assets--runtime-stylesheets)
|
|
54
|
+
> below — you must copy the web component's `du-assets/` folder **and its stylesheets**
|
|
55
|
+
> into your build output (and serve raw CSS in dev), or PDF rendering,
|
|
56
|
+
> translations, and **icons** will silently break with no build error.
|
|
56
57
|
|
|
57
58
|
## Props
|
|
58
59
|
|
|
59
|
-
| Prop | Type | Required | Default | Description
|
|
60
|
-
| -------------------------------- | ---------------------------------------------- | -------- | --------- |
|
|
61
|
-
| `sdk` | `UiPath` | Yes | — | UiPath SDK instance for authentication and API calls
|
|
62
|
-
| `data` | `ContentValidationData` | Yes | — | Document data containing bucket paths, document ID, and folder references
|
|
63
|
-
| `folderId` | `number` | No
|
|
64
|
-
| `theme` | `'light' \| 'dark' \| 'light-hc' \| 'dark-hc'` | No | `'light'` | Visual theme
|
|
65
|
-
| `language` | `
|
|
66
|
-
| `isReadonly` | `boolean` | No | `false` | When `true`, renders in read-only mode
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `save`
|
|
70
|
-
| `discardChanges` | `{ value: boolean }` | No | — | Trigger a discard-changes operation
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
### Reacting to save
|
|
78
|
-
|
|
79
|
-
|
|
60
|
+
| Prop | Type | Required | Default | Description |
|
|
61
|
+
| -------------------------------- | ---------------------------------------------- | -------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| `sdk` | `UiPath` | Yes | — | UiPath SDK instance for authentication and API calls |
|
|
63
|
+
| `data` | `ContentValidationData` | Yes | — | Document data containing bucket paths, document ID, and folder references |
|
|
64
|
+
| `folderId` | `number` | No\* | — | Storage bucket folder ID. Falls back to `data.FolderId`. **One of the two must resolve to a value** — otherwise the widget show an error. |
|
|
65
|
+
| `theme` | `'light' \| 'dark' \| 'light-hc' \| 'dark-hc'` | No | `'light'` | Visual theme |
|
|
66
|
+
| `language` | `ValidationStationLanguage` | No | `English` | UI language (see enum below) |
|
|
67
|
+
| `isReadonly` | `boolean` | No | `false` | When `true`, renders in read-only mode |
|
|
68
|
+
| `options` | `IValidationStationOptions` | No | — | Fine-grained UI feature flags |
|
|
69
|
+
| `save={{ validate: false }}` | `{ validate: boolean }` | No | — | Trigger **save as draft**. ⚠ Requires `options.emitDtoStateChanges: true` — otherwise the web component won't surface the latest in-memory extraction state and the save will be a no-op. |
|
|
70
|
+
| `save={{ validate: true }}` | `{ validate: boolean }` | No | — | Trigger **submit** — runs validation first, then saves. |
|
|
71
|
+
| `discardChanges` | `{ value: boolean }` | No | — | Trigger a discard-changes operation. Call `setDiscardChanges({ value: true })` (or `false` — the boolean is ignored) every time you want it to fire. Each call creates a brand-new object even if the content looks identical, and that's what the widget watches for — so calling it repeatedly with the same `{ value: true }` works just fine. |
|
|
72
|
+
| `setFieldValueByPath` | `SetFieldValueByPath` | No | — | Set a field value addressed by a path of `{ fieldName, valueIndex }` segments |
|
|
73
|
+
| `selectAndFocusFieldValueByPath` | `SelectAndFocusFieldValueByPath` | No | — | Select and focus a field value addressed by a path; focuses the document reference if any |
|
|
74
|
+
| `deleteFieldValueByPath` | `DeleteFieldValueByPath` | No | — | Delete a field value addressed by a path |
|
|
75
|
+
|
|
76
|
+
> Three additional callback props (`onSubmitComplete`, `onSaveAsDraftComplete`, `onReportExceptionComplete`) are documented in the next section.
|
|
77
|
+
|
|
78
|
+
### Reacting to save / draft / exception flows
|
|
79
|
+
|
|
80
|
+
The widget surfaces three user-initiated flows. Submit and draft are owned end-to-end by the widget; exception reporting is forwarded to the host so it can call the SDK directly.
|
|
81
|
+
|
|
82
|
+
| Callback | User action | Signature | What the widget does | What the host does |
|
|
83
|
+
| --------------------------- | ----------------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
84
|
+
| `onSubmitComplete` | **Submit** | `(result: SaveValidatedDataResult) => void` | Calls `OrchestratorDuModule.processExtractedData(...)`, then uploads the merged result to `ValidatedExtractionResultsPath`. Fires the callback with the persistence result. | (optional) react to success/failure (complete the task, retry, log, etc.). |
|
|
85
|
+
| `onSaveAsDraftComplete` | **Save as draft** | `(result: SaveValidatedDataResult) => void` | Uploads the in-progress `validatedData` straight to `ValidatedExtractionResultsPath` (no `processExtractedData` call). Fires the callback with the persistence result. | (optional) react to success/failure. |
|
|
86
|
+
| `onReportExceptionComplete` | **Report as exception** | `(documentId: string, reason: string) => void` | Extracts `documentId` and `reason` from the web component's exception DTO and hands them to the host. **No API call.** | Required if you want the report persisted — call `OrchestratorDuModule.submitExceptionReport(...)` yourself. |
|
|
87
|
+
|
|
88
|
+
Submit/draft hand you a `SaveValidatedDataResult` (`{ success, error? }`) — the host owns all UI feedback (toast, retry, etc.); the widget does not surface failures itself. The exception callback hands you `documentId` and `reason` strings ready to forward to the SDK.
|
|
80
89
|
|
|
81
90
|
```tsx
|
|
82
91
|
import {
|
|
83
92
|
ValidationStation,
|
|
84
93
|
type SaveValidatedDataResult,
|
|
85
94
|
} from "@uipath/ui-widgets-validation-station";
|
|
95
|
+
import { OrchestratorDuModule } from "@uipath/uipath-typescript/orchestrator-du-module";
|
|
86
96
|
|
|
87
97
|
function App({ sdk, data, task }) {
|
|
88
|
-
const
|
|
98
|
+
const handleSubmitComplete = async (result: SaveValidatedDataResult) => {
|
|
89
99
|
if (!result.success) {
|
|
90
|
-
|
|
91
|
-
// your own retry / logging / analytics here if needed.
|
|
92
|
-
console.warn("Save failed:", result.error);
|
|
100
|
+
console.warn("Submit failed:", result.error);
|
|
93
101
|
return;
|
|
94
102
|
}
|
|
95
103
|
await task.complete({ action: "Completed", type: "DocumentValidation" });
|
|
96
104
|
};
|
|
97
105
|
|
|
106
|
+
const handleDraftComplete = (result: SaveValidatedDataResult) => {
|
|
107
|
+
if (!result.success) console.warn("Draft save failed:", result.error);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const handleReportException = async (documentId: string, reason: string) => {
|
|
111
|
+
const response = await new OrchestratorDuModule(sdk).submitExceptionReport(
|
|
112
|
+
task.id,
|
|
113
|
+
documentId,
|
|
114
|
+
reason || "Reported via Validation Station",
|
|
115
|
+
{ folderId: task.folderId },
|
|
116
|
+
);
|
|
117
|
+
if (!response.IsSuccessful) {
|
|
118
|
+
console.error("submitExceptionReport failed:", response.ErrorMessage);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
98
122
|
return (
|
|
99
123
|
<ValidationStation
|
|
100
124
|
sdk={sdk}
|
|
101
125
|
data={data}
|
|
102
126
|
folderId={task.folderId}
|
|
103
|
-
|
|
127
|
+
onSubmitComplete={handleSubmitComplete}
|
|
128
|
+
onSaveAsDraftComplete={handleDraftComplete}
|
|
129
|
+
onReportExceptionComplete={handleReportException}
|
|
104
130
|
/>
|
|
105
131
|
);
|
|
106
132
|
}
|
|
107
133
|
```
|
|
108
134
|
|
|
135
|
+
> Submit and draft callbacks are optional, but failures are silent if you skip them — the widget does not surface errors on its own. The exception callback is the only place the report goes; without it the user's "Report as exception" click is a no-op.
|
|
136
|
+
|
|
109
137
|
## Language enum
|
|
110
138
|
|
|
111
|
-
|
|
139
|
+
`ValidationStationLanguage` provides all supported locales:
|
|
112
140
|
|
|
113
141
|
```ts
|
|
114
|
-
import {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
142
|
+
import { ValidationStationLanguage } from "@uipath/ui-widgets-validation-station";
|
|
143
|
+
|
|
144
|
+
ValidationStationLanguage.English; // "en"
|
|
145
|
+
ValidationStationLanguage.German; // "de"
|
|
146
|
+
ValidationStationLanguage.Spanish; // "es"
|
|
147
|
+
ValidationStationLanguage.SpanishMexico; // "es-MX"
|
|
148
|
+
ValidationStationLanguage.French; // "fr"
|
|
149
|
+
ValidationStationLanguage.Japanese; // "ja"
|
|
150
|
+
ValidationStationLanguage.Korean; // "ko"
|
|
151
|
+
ValidationStationLanguage.Portuguese; // "pt"
|
|
152
|
+
ValidationStationLanguage.PortugueseBrazil; // "pt-BR"
|
|
153
|
+
ValidationStationLanguage.Romanian; // "ro"
|
|
154
|
+
ValidationStationLanguage.Russian; // "ru"
|
|
155
|
+
ValidationStationLanguage.Turkish; // "tr"
|
|
156
|
+
ValidationStationLanguage.ChineseSimplified; // "zh-CN"
|
|
157
|
+
ValidationStationLanguage.ChineseTraditional; // "zh-TW"
|
|
130
158
|
```
|
|
131
159
|
|
|
132
160
|
## Exported types
|
|
@@ -134,12 +162,11 @@ Language.ChineseTraditional; // "zh-TW"
|
|
|
134
162
|
All parameter types are re-exported from the package for convenience:
|
|
135
163
|
|
|
136
164
|
```ts
|
|
137
|
-
import {
|
|
165
|
+
import { ValidationStationLanguage } from "@uipath/ui-widgets-validation-station";
|
|
138
166
|
import type {
|
|
139
167
|
ValidationStationProps,
|
|
140
|
-
ISetTableCellValueParameters,
|
|
141
|
-
IDeleteTableCellValueParameters,
|
|
142
168
|
IValidationStationOptions,
|
|
169
|
+
SaveValidatedDataResult,
|
|
143
170
|
SetFieldValueByPath,
|
|
144
171
|
SelectAndFocusFieldValueByPath,
|
|
145
172
|
DeleteFieldValueByPath,
|
|
@@ -238,86 +265,165 @@ const [save, setSave] = useState<{ validate: boolean } | undefined>(undefined);
|
|
|
238
265
|
<ValidationStation sdk={sdk} data={data} folderId={1} save={save} />
|
|
239
266
|
```
|
|
240
267
|
|
|
241
|
-
## Static assets
|
|
242
|
-
|
|
243
|
-
The underlying web component
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
268
|
+
## Static assets & runtime stylesheets
|
|
269
|
+
|
|
270
|
+
The underlying web component resolves several files **at runtime**, relative
|
|
271
|
+
to where its main bundle is served (via `import.meta.url`):
|
|
272
|
+
|
|
273
|
+
- **`du-assets/`** — PDF.js worker, cmaps, wasm, and i18n translations.
|
|
274
|
+
- **`styles.css`** — fetched as raw CSS text and adopted into the component's
|
|
275
|
+
**shadow root**. This is what styles the icons (`<mat-icon>`) and everything
|
|
276
|
+
else _inside_ the shadow boundary.
|
|
277
|
+
- **`fonts.css`** + **`media/`** — the Apollo / Material Icons `@font-face`
|
|
278
|
+
declarations and the font files they reference.
|
|
279
|
+
|
|
280
|
+
> **The React wrapper already imports `styles.css` and `fonts.css` as ES
|
|
281
|
+
> modules for you**, so the _light DOM_ concerns (`@font-face` registration,
|
|
282
|
+
> plus CDK overlays like menus/tooltips that portal to `document.body`) are
|
|
283
|
+
> handled automatically — you do **not** add those imports yourself. What you
|
|
284
|
+
> still have to handle is making the same files reachable by the web component's
|
|
285
|
+
> **runtime `fetch`**, covered below.
|
|
286
|
+
|
|
287
|
+
**These files must be deployed at the same path level as your output bundle.**
|
|
288
|
+
If they're missing there's no build error — they silently 404 at runtime:
|
|
289
|
+
PDFs fail to render, and because the shadow root never receives `styles.css`,
|
|
290
|
+
**icons fall back to a system font and render as empty boxes or raw text**.
|
|
291
|
+
|
|
292
|
+
There are two things to get right:
|
|
293
|
+
|
|
294
|
+
1. **Build** — copy `du-assets/`, `styles.css`, `fonts.css`, and `media/` next
|
|
295
|
+
to your emitted JS chunks.
|
|
296
|
+
2. **Dev server** — if your dev server rewrites `.css` requests into JS modules
|
|
297
|
+
(Vite does this), the web component's `fetch("styles.css")` receives JavaScript instead
|
|
298
|
+
of CSS, `CSSStyleSheet.replaceSync()` parses nothing, and the shadow-root
|
|
299
|
+
styles never load (→ broken icons). You must serve the **raw CSS** for that
|
|
300
|
+
fetch. Bundlers that serve copied files verbatim in dev (e.g.
|
|
301
|
+
webpack-dev-server) don't have this problem — copying alone is enough.
|
|
252
302
|
|
|
253
303
|
### Vite
|
|
254
304
|
|
|
255
|
-
|
|
256
|
-
|
|
305
|
+
Two plugins: one copies the runtime files after a build, one serves raw CSS to
|
|
306
|
+
the web component's `fetch` during dev. `optimizeDeps.exclude` is also required — Vite's
|
|
307
|
+
pre-bundler rewrites `import.meta.url`, which breaks the web component's runtime
|
|
308
|
+
resolution.
|
|
257
309
|
|
|
258
310
|
```ts
|
|
259
311
|
// vite.config.ts
|
|
260
312
|
import react from "@vitejs/plugin-react";
|
|
261
|
-
import { cp } from "node:fs/promises";
|
|
313
|
+
import { cp, readFile } from "node:fs/promises";
|
|
262
314
|
import { createRequire } from "node:module";
|
|
263
315
|
import { dirname, resolve } from "node:path";
|
|
264
316
|
import { defineConfig, type Plugin } from "vite";
|
|
265
317
|
|
|
266
318
|
const require = createRequire(import.meta.url);
|
|
267
319
|
|
|
320
|
+
const WC_ROOT = dirname(
|
|
321
|
+
require.resolve("@uipath/du-validation-station-wc/package.json"),
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
// Stylesheets the web component fetches (as raw CSS) at runtime to adopt into its
|
|
325
|
+
// shadow root.
|
|
326
|
+
const WC_RUNTIME_CSS = ["styles.css", "fonts.css"];
|
|
327
|
+
|
|
328
|
+
// BUILD: place the web component's runtime files next to the emitted JS chunks, where
|
|
329
|
+
// `import.meta.url` will resolve them.
|
|
268
330
|
function copyDuValidationStationAssets(): Plugin {
|
|
269
|
-
let
|
|
331
|
+
let assetsDir = "";
|
|
270
332
|
return {
|
|
271
333
|
name: "copy-du-validation-station-assets",
|
|
272
334
|
apply: "build",
|
|
273
335
|
configResolved(config) {
|
|
274
|
-
|
|
336
|
+
assetsDir = resolve(
|
|
275
337
|
config.root,
|
|
276
338
|
config.build.outDir,
|
|
277
339
|
config.build.assetsDir,
|
|
278
|
-
"du-assets",
|
|
279
340
|
);
|
|
280
341
|
},
|
|
281
342
|
async closeBundle() {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
);
|
|
285
|
-
await cp(resolve(
|
|
343
|
+
await cp(resolve(WC_ROOT, "du-assets"), resolve(assetsDir, "du-assets"), {
|
|
344
|
+
recursive: true,
|
|
345
|
+
});
|
|
346
|
+
await cp(resolve(WC_ROOT, "media"), resolve(assetsDir, "media"), {
|
|
347
|
+
recursive: true,
|
|
348
|
+
});
|
|
349
|
+
for (const css of WC_RUNTIME_CSS) {
|
|
350
|
+
await cp(resolve(WC_ROOT, css), resolve(assetsDir, css));
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// DEV: Vite serves any `.css` request as a JS module. Return the real CSS to
|
|
357
|
+
// the web component's raw `fetch` (identified by `Sec-Fetch-Dest: empty`), while letting
|
|
358
|
+
// genuine ES-module imports (`Sec-Fetch-Dest: script`) pass through to Vite.
|
|
359
|
+
function serveDuValidationStationRawCss(): Plugin {
|
|
360
|
+
const pattern = new RegExp(
|
|
361
|
+
`/@uipath/du-validation-station-wc/(${WC_RUNTIME_CSS.join("|")})$`,
|
|
362
|
+
);
|
|
363
|
+
return {
|
|
364
|
+
name: "serve-du-validation-station-raw-css",
|
|
365
|
+
apply: "serve",
|
|
366
|
+
configureServer(server) {
|
|
367
|
+
server.middlewares.use((req, res, next) => {
|
|
368
|
+
if (req.headers["sec-fetch-dest"] !== "empty") return next();
|
|
369
|
+
const match = pattern.exec((req.url ?? "").split("?")[0]);
|
|
370
|
+
if (!match) return next();
|
|
371
|
+
readFile(resolve(WC_ROOT, match[1]), "utf8").then((css) => {
|
|
372
|
+
res.setHeader("Content-Type", "text/css");
|
|
373
|
+
res.end(css);
|
|
374
|
+
}, next);
|
|
375
|
+
});
|
|
286
376
|
},
|
|
287
377
|
};
|
|
288
378
|
}
|
|
289
379
|
|
|
290
380
|
export default defineConfig({
|
|
291
|
-
plugins: [
|
|
381
|
+
plugins: [
|
|
382
|
+
react(),
|
|
383
|
+
copyDuValidationStationAssets(),
|
|
384
|
+
serveDuValidationStationRawCss(),
|
|
385
|
+
],
|
|
292
386
|
optimizeDeps: {
|
|
293
387
|
exclude: ["@uipath/du-validation-station-wc"],
|
|
294
388
|
},
|
|
295
389
|
});
|
|
296
390
|
```
|
|
297
391
|
|
|
298
|
-
`optimizeDeps.exclude` is required — Vite's pre-bundler rewrites
|
|
299
|
-
`import.meta.url`, which breaks the WC's runtime asset resolution.
|
|
300
|
-
|
|
301
392
|
### webpack
|
|
302
393
|
|
|
303
|
-
Use [`copy-webpack-plugin`](https://github.com/webpack-contrib/copy-webpack-plugin):
|
|
394
|
+
Use [`copy-webpack-plugin`](https://github.com/webpack-contrib/copy-webpack-plugin) to copy `du-assets/`, the stylesheets, and `media/` next to your bundle, **and** opt the web component bundle out of webpack's `new URL(..., import.meta.url)` parsing — the web component uses that pattern for its runtime resolution, and webpack will otherwise try to bundle the directory and fail with `Module not found: Error: Can't resolve './du-assets/'`. webpack-dev-server serves the copied files verbatim, so no separate raw-CSS handling is needed.
|
|
304
395
|
|
|
305
396
|
```js
|
|
306
397
|
// webpack.config.js
|
|
307
398
|
const CopyPlugin = require("copy-webpack-plugin");
|
|
308
399
|
const path = require("path");
|
|
309
400
|
|
|
401
|
+
const wcRoot = path.dirname(
|
|
402
|
+
require.resolve("@uipath/du-validation-station-wc/package.json"),
|
|
403
|
+
);
|
|
404
|
+
|
|
310
405
|
module.exports = {
|
|
406
|
+
module: {
|
|
407
|
+
rules: [
|
|
408
|
+
// Don't parse runtime URL / dynamic-require expressions inside the web component —
|
|
409
|
+
// its assets and stylesheets are resolved at runtime from `import.meta.url`.
|
|
410
|
+
{
|
|
411
|
+
test: /node_modules[\\/]@uipath[\\/]du-validation-station-wc[\\/].*\.js$/,
|
|
412
|
+
parser: {
|
|
413
|
+
url: false,
|
|
414
|
+
exprContextCritical: false,
|
|
415
|
+
unknownContextCritical: false,
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
],
|
|
419
|
+
},
|
|
311
420
|
plugins: [
|
|
312
421
|
new CopyPlugin({
|
|
313
422
|
patterns: [
|
|
314
|
-
{
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
) + "/du-assets",
|
|
319
|
-
to: "assets/du-assets",
|
|
320
|
-
},
|
|
423
|
+
{ from: `${wcRoot}/du-assets`, to: "assets/du-assets" },
|
|
424
|
+
{ from: `${wcRoot}/media`, to: "assets/media" },
|
|
425
|
+
{ from: `${wcRoot}/styles.css`, to: "assets/styles.css" },
|
|
426
|
+
{ from: `${wcRoot}/fonts.css`, to: "assets/fonts.css" },
|
|
321
427
|
],
|
|
322
428
|
}),
|
|
323
429
|
],
|
|
@@ -328,8 +434,10 @@ module.exports = {
|
|
|
328
434
|
|
|
329
435
|
Any asset-copy mechanism works — Angular's `assets` array,
|
|
330
436
|
`rollup-plugin-copy`, a `postbuild` npm script with `cp -r`, etc. The
|
|
331
|
-
|
|
332
|
-
sitting next to the JS chunks that
|
|
437
|
+
requirement is the same: the final deployed layout must have `du-assets/`,
|
|
438
|
+
`styles.css`, `fonts.css`, and `media/` sitting next to the JS chunks that
|
|
439
|
+
import the web component. If your dev server transforms `.css` into JS modules, also make
|
|
440
|
+
sure the web component's runtime `fetch` for `styles.css`/`fonts.css` receives raw CSS.
|
|
333
441
|
|
|
334
442
|
## Development
|
|
335
443
|
|
|
@@ -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":"AAaA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAkH9D,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { toast, Toaster } from "@uipath/apollo-wind";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
|
-
import { validationStationWcReady } from "./loadValidationStationWc";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
4
|
+
import { validationStationWcReady } from "./loadValidationStationWc.js";
|
|
5
|
+
import { submitValidatedData, saveValidatedDataAsDraft, } from "./saveValidatedDataUtil.js";
|
|
6
|
+
import { ValidationStationLanguage, } from "./types.js";
|
|
7
|
+
import { useBucketArtifacts } from "./useBucketArtifacts.js";
|
|
8
|
+
export const ValidationStation = ({ sdk, data, folderId, theme = "light", language = ValidationStationLanguage.English, isReadonly = false, options, save, discardChanges, setFieldValueByPath, selectAndFocusFieldValueByPath, deleteFieldValueByPath, onSubmitComplete, onSaveAsDraftComplete, onReportExceptionComplete, }) => {
|
|
8
9
|
const { artifacts, error } = useBucketArtifacts(sdk, data, folderId);
|
|
9
10
|
const [wcReady, setWcReady] = useState(false);
|
|
10
11
|
useEffect(() => {
|
|
@@ -27,23 +28,26 @@ export const ValidationStation = ({ sdk, data, folderId, theme, language, isRead
|
|
|
27
28
|
const refCallback = (el) => {
|
|
28
29
|
if (!el)
|
|
29
30
|
return;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
31
|
+
if (!resolvedFolderId) {
|
|
32
|
+
toast.error("folderId of Storage bucket is required. Provide it as a prop or ensure data.FolderId is set.");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const onSubmitRequest = (event) => submitValidatedData(sdk, data, resolvedFolderId, event.detail).then(onSubmitComplete);
|
|
36
|
+
const onSaveAsDraftRequest = (event) => saveValidatedDataAsDraft(sdk, data, resolvedFolderId, event.detail).then(onSaveAsDraftComplete);
|
|
37
|
+
const onExceptionRequest = (event) => {
|
|
38
|
+
const { documentId, exceptionReport } = event.detail;
|
|
39
|
+
const reason = exceptionReport?.Reason ?? "";
|
|
40
|
+
onReportExceptionComplete?.(documentId, reason);
|
|
41
41
|
};
|
|
42
|
-
el.addEventListener("saveValidatedDataRequest",
|
|
42
|
+
el.addEventListener("saveValidatedDataRequest", onSubmitRequest);
|
|
43
|
+
el.addEventListener("saveValidatedDataAsDraftRequest", onSaveAsDraftRequest);
|
|
44
|
+
el.addEventListener("saveExceptionReportRequest", onExceptionRequest);
|
|
43
45
|
return () => {
|
|
44
|
-
el.removeEventListener("saveValidatedDataRequest",
|
|
46
|
+
el.removeEventListener("saveValidatedDataRequest", onSubmitRequest);
|
|
47
|
+
el.removeEventListener("saveValidatedDataAsDraftRequest", onSaveAsDraftRequest);
|
|
48
|
+
el.removeEventListener("saveExceptionReportRequest", onExceptionRequest);
|
|
45
49
|
};
|
|
46
50
|
};
|
|
47
|
-
return (_jsxs(_Fragment, { children: [_jsx("ui-du-validation-station-standalone-wc-element", { ...{ ref: refCallback }, theme: theme, language: language, isReadonly: isReadonly, enableSaveAsDraft:
|
|
51
|
+
return (_jsxs(_Fragment, { children: [_jsx("ui-du-validation-station-standalone-wc-element", { ...{ ref: refCallback }, theme: theme, language: language, isReadonly: isReadonly, enableSaveAsDraft: true, documentId: data.DocumentId, taxonomy: artifacts.taxonomy, extractionResult: artifacts.extractionResult, dom: artifacts.dom, text: artifacts.text, customizationInfo: artifacts.customizationInfo, original: artifacts.original, options: options, save: save, discardChanges: discardChanges, setFieldValueByPath: setFieldValueByPath, selectAndFocusFieldValueByPath: selectAndFocusFieldValueByPath, deleteFieldValueByPath: deleteFieldValueByPath }), _jsx(Toaster, { position: "top-right" })] }));
|
|
48
52
|
};
|
|
49
53
|
//# 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":";AAMA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C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;AAiBF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,wBAAwB,
|
|
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;AAM5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,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;AAiBF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,wBAAwB,CAwJ/C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC"}
|
|
@@ -107,7 +107,6 @@ point \`wcAssetsUrl\` at that location.
|
|
|
107
107
|
|
|
108
108
|
\`\`\`tsx
|
|
109
109
|
import { ValidationStation } from '@uipath/ui-widgets-validation-station';
|
|
110
|
-
import "@uipath/ui-widgets-validation-station/ValidationStation.css";
|
|
111
110
|
import { UiPath } from '@uipath/uipath-typescript/core';
|
|
112
111
|
|
|
113
112
|
const sdk = new UiPath({
|
|
@@ -188,10 +187,6 @@ function App() {
|
|
|
188
187
|
description: "When true, the validation station is in read-only mode",
|
|
189
188
|
control: "boolean",
|
|
190
189
|
},
|
|
191
|
-
enableSaveAsDraft: {
|
|
192
|
-
description: "When true, enables the save-as-draft functionality",
|
|
193
|
-
control: "boolean",
|
|
194
|
-
},
|
|
195
190
|
options: {
|
|
196
191
|
description: "Additional configuration options for the validation station",
|
|
197
192
|
control: "object",
|
|
@@ -215,7 +210,6 @@ function App() {
|
|
|
215
210
|
theme: "light",
|
|
216
211
|
language: ValidationStationLanguage.English,
|
|
217
212
|
isReadonly: false,
|
|
218
|
-
enableSaveAsDraft: false,
|
|
219
213
|
},
|
|
220
214
|
};
|
|
221
215
|
export default meta;
|
|
@@ -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;AAapD,MAAM,wBAAwB,GAAG,CAAC,EAChC,OAAO,EACP,OAAO,EACP,UAAU,EACV,MAAM,EACN,GAAG,KAAK,EACmB,EAAE,EAAE;IAC/B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAG/B,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU,IAAI,CAAC,MAAM,EAAE,CAAC;YACnD,OAAO;QACT,CAAC;QAED,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE;YACzB,IAAI,CAAC;gBACH,MAAM,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC;oBACrD,CAAC,CAAC,OAAO;oBACT,CAAC,CAAC,WAAW,OAAO,EAAE,CAAC;gBACzB,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;oBACxB,OAAO,EAAE,iBAAi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;IAChE,CAAC;IAED,OAAO,KAAC,iBAAiB,IAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAsC;IAClD,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,EAAE;IACb,UAAU,EAAE,EAAE;IACd,mBAAmB,EAAE,EAAE;IACvB,QAAQ,EAAE,EAAE;IACZ,uBAAuB,EAAE,EAAE;IAC3B,YAAY,EAAE,EAAE;IAChB,8BAA8B,EAAE,EAAE;IAClC,8BAA8B,EAAE,EAAE;IAClC,qBAAqB,EAAE,EAAE;CAC1B,CAAC;AAEF,MAAM,IAAI,GAA0C;IAClD,KAAK,EAAE,8BAA8B;IACrC,SAAS,EAAE,wBAAwB;IACnC,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,cAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAC7B,KAAC,KAAK,KAAG,GACL,CACP;KACF;IACD,UAAU,EAAE;QACV,MAAM,EAAE,YAAY;QACpB,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EAAE
|
|
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;AAapD,MAAM,wBAAwB,GAAG,CAAC,EAChC,OAAO,EACP,OAAO,EACP,UAAU,EACV,MAAM,EACN,GAAG,KAAK,EACmB,EAAE,EAAE;IAC/B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QA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ACP,WAAW,EACT,6DAA6D;YAC/D,OAAO,EAAE,QAAQ;SAClB;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,uCAAuC;YACpD,OAAO,EAAE,QAAQ;SAClB;QACD,cAAc,EAAE;YACd,WAAW,EAAE,yBAAyB;YACtC,OAAO,EAAE,QAAQ;SAClB;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,kBAAkB;QAC3B,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC;QACX,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,yBAAyB,CAAC,OAAO;QAC3C,UAAU,EAAE,KAAK;KAClB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,KAAK,EACH,gIAAgI;aACnI;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** 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"}
|