@uipath/ui-widgets-validation-station 1.0.1-beta.7 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -43
- 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.map +1 -1
- package/dist/bucketArtifactsUtil.js +8 -1
- package/dist/bucketArtifactsUtil.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- 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/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 +3 -3
- 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 +5 -4
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.4.
|
|
16
|
+
@uipath/uipath-typescript >= 1.4.2
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Quick start
|
|
@@ -50,9 +50,10 @@ function App() {
|
|
|
50
50
|
|
|
51
51
|
> `theme` defaults to `"light"` and `language` defaults to `ValidationStationLanguage.English`, so the minimal mount just needs `sdk`, `data`, and a folder.
|
|
52
52
|
|
|
53
|
-
> See [Static assets](#static-assets)
|
|
54
|
-
> `du-assets/` folder
|
|
55
|
-
>
|
|
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
|
|
|
@@ -65,7 +66,7 @@ function App() {
|
|
|
65
66
|
| `language` | `ValidationStationLanguage` | No | `English` | UI language (see enum below) |
|
|
66
67
|
| `isReadonly` | `boolean` | No | `false` | When `true`, renders in read-only mode |
|
|
67
68
|
| `options` | `IValidationStationOptions` | No | — | Fine-grained UI feature flags |
|
|
68
|
-
| `save={{ validate: false }}` | `{ validate: boolean }` | No | — | Trigger **save as draft**. ⚠ Requires `options.emitDtoStateChanges: true` — otherwise the
|
|
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. |
|
|
69
70
|
| `save={{ validate: true }}` | `{ validate: boolean }` | No | — | Trigger **submit** — runs validation first, then saves. |
|
|
70
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. |
|
|
71
72
|
| `setFieldValueByPath` | `SetFieldValueByPath` | No | — | Set a field value addressed by a path of `{ fieldName, valueIndex }` segments |
|
|
@@ -82,7 +83,7 @@ The widget surfaces three user-initiated flows. Submit and draft are owned end-t
|
|
|
82
83
|
| --------------------------- | ----------------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
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.). |
|
|
84
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. |
|
|
85
|
-
| `onReportExceptionComplete` | **Report as exception** | `(documentId: string, reason: string) => void` | Extracts `documentId` and `reason` from the
|
|
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. |
|
|
86
87
|
|
|
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.
|
|
88
89
|
|
|
@@ -264,80 +265,148 @@ const [save, setSave] = useState<{ validate: boolean } | undefined>(undefined);
|
|
|
264
265
|
<ValidationStation sdk={sdk} data={data} folderId={1} save={save} />
|
|
265
266
|
```
|
|
266
267
|
|
|
267
|
-
## Static assets
|
|
268
|
-
|
|
269
|
-
The underlying web component
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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.
|
|
278
302
|
|
|
279
303
|
### Vite
|
|
280
304
|
|
|
281
|
-
|
|
282
|
-
|
|
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.
|
|
283
309
|
|
|
284
310
|
```ts
|
|
285
311
|
// vite.config.ts
|
|
286
312
|
import react from "@vitejs/plugin-react";
|
|
287
|
-
import { cp } from "node:fs/promises";
|
|
313
|
+
import { cp, readFile } from "node:fs/promises";
|
|
288
314
|
import { createRequire } from "node:module";
|
|
289
315
|
import { dirname, resolve } from "node:path";
|
|
290
316
|
import { defineConfig, type Plugin } from "vite";
|
|
291
317
|
|
|
292
318
|
const require = createRequire(import.meta.url);
|
|
293
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.
|
|
294
330
|
function copyDuValidationStationAssets(): Plugin {
|
|
295
|
-
let
|
|
331
|
+
let assetsDir = "";
|
|
296
332
|
return {
|
|
297
333
|
name: "copy-du-validation-station-assets",
|
|
298
334
|
apply: "build",
|
|
299
335
|
configResolved(config) {
|
|
300
|
-
|
|
336
|
+
assetsDir = resolve(
|
|
301
337
|
config.root,
|
|
302
338
|
config.build.outDir,
|
|
303
339
|
config.build.assetsDir,
|
|
304
|
-
"du-assets",
|
|
305
340
|
);
|
|
306
341
|
},
|
|
307
342
|
async closeBundle() {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
);
|
|
311
|
-
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
|
+
});
|
|
312
376
|
},
|
|
313
377
|
};
|
|
314
378
|
}
|
|
315
379
|
|
|
316
380
|
export default defineConfig({
|
|
317
|
-
plugins: [
|
|
381
|
+
plugins: [
|
|
382
|
+
react(),
|
|
383
|
+
copyDuValidationStationAssets(),
|
|
384
|
+
serveDuValidationStationRawCss(),
|
|
385
|
+
],
|
|
318
386
|
optimizeDeps: {
|
|
319
387
|
exclude: ["@uipath/du-validation-station-wc"],
|
|
320
388
|
},
|
|
321
389
|
});
|
|
322
390
|
```
|
|
323
391
|
|
|
324
|
-
`optimizeDeps.exclude` is required — Vite's pre-bundler rewrites
|
|
325
|
-
`import.meta.url`, which breaks the WC's runtime asset resolution.
|
|
326
|
-
|
|
327
392
|
### webpack
|
|
328
393
|
|
|
329
|
-
Use [`copy-webpack-plugin`](https://github.com/webpack-contrib/copy-webpack-plugin) **and** opt the
|
|
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.
|
|
330
395
|
|
|
331
396
|
```js
|
|
332
397
|
// webpack.config.js
|
|
333
398
|
const CopyPlugin = require("copy-webpack-plugin");
|
|
334
399
|
const path = require("path");
|
|
335
400
|
|
|
401
|
+
const wcRoot = path.dirname(
|
|
402
|
+
require.resolve("@uipath/du-validation-station-wc/package.json"),
|
|
403
|
+
);
|
|
404
|
+
|
|
336
405
|
module.exports = {
|
|
337
406
|
module: {
|
|
338
407
|
rules: [
|
|
339
|
-
// Don't parse runtime URL / dynamic-require expressions inside the
|
|
340
|
-
// its assets are resolved at runtime from `import.meta.url`.
|
|
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`.
|
|
341
410
|
{
|
|
342
411
|
test: /node_modules[\\/]@uipath[\\/]du-validation-station-wc[\\/].*\.js$/,
|
|
343
412
|
parser: {
|
|
@@ -351,13 +420,10 @@ module.exports = {
|
|
|
351
420
|
plugins: [
|
|
352
421
|
new CopyPlugin({
|
|
353
422
|
patterns: [
|
|
354
|
-
{
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
) + "/du-assets",
|
|
359
|
-
to: "assets/du-assets",
|
|
360
|
-
},
|
|
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" },
|
|
361
427
|
],
|
|
362
428
|
}),
|
|
363
429
|
],
|
|
@@ -368,8 +434,10 @@ module.exports = {
|
|
|
368
434
|
|
|
369
435
|
Any asset-copy mechanism works — Angular's `assets` array,
|
|
370
436
|
`rollup-plugin-copy`, a `postbuild` npm script with `cp -r`, etc. The
|
|
371
|
-
|
|
372
|
-
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.
|
|
373
441
|
|
|
374
442
|
## Development
|
|
375
443
|
|
|
@@ -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"}
|
|
@@ -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 +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,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAgElD,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,WAAW,CAAC,qBAAqB,EACvC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC,
|
|
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,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAgElD,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,WAAW,CAAC,qBAAqB,EACvC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC,CA2D1B"}
|
|
@@ -55,6 +55,13 @@ export async function fetchBucketArtifacts(bucketService, data, folderId) {
|
|
|
55
55
|
fetchArtifactJson(bucketService, BucketId, folderId, CustomizationInfoPath),
|
|
56
56
|
fetchArtifactText(bucketService, BucketId, folderId, EncodedDocumentPath),
|
|
57
57
|
]);
|
|
58
|
-
return {
|
|
58
|
+
return {
|
|
59
|
+
taxonomy: taxonomy,
|
|
60
|
+
extractionResult: extractionResult,
|
|
61
|
+
dom: dom,
|
|
62
|
+
text,
|
|
63
|
+
customizationInfo,
|
|
64
|
+
original,
|
|
65
|
+
};
|
|
59
66
|
}
|
|
60
67
|
//# sourceMappingURL=bucketArtifactsUtil.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bucketArtifactsUtil.js","sourceRoot":"","sources":["../src/bucketArtifactsUtil.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGnC,iFAAiF;AACjF,KAAK,UAAU,aAAa,CAAC,GAAW;IACtC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAC7C,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,GAAW;IAC1C,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC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
1
|
export { ValidationStationLanguage } from "./types.js";
|
|
2
|
-
export type { DeleteFieldValueByPath, IValidationStationOptions, SaveValidatedDataResult, SelectAndFocusFieldValueByPath, SetFieldValueByPath, ValidationStationProps, } from "./types.js";
|
|
2
|
+
export type { BucketArtifacts, DeleteFieldValueByPath, IValidationStationOptions, SaveValidatedDataResult, SelectAndFocusFieldValueByPath, SetFieldValueByPath, ValidationStationProps, } from "./types.js";
|
|
3
3
|
export { ValidationStation } from "./ValidationStation.js";
|
|
4
|
+
export { useBucketArtifacts } from "./useBucketArtifacts.js";
|
|
5
|
+
export { CompactBusinessRules } from "./subcomponents/CompactBusinessRules.js";
|
|
6
|
+
export { CompactDocTypeField } from "./subcomponents/CompactDocTypeField.js";
|
|
7
|
+
export { CompactFieldsForm } from "./subcomponents/CompactFieldsForm.js";
|
|
8
|
+
export { CompactTableEditor } from "./subcomponents/CompactTableEditor.js";
|
|
9
|
+
export { DocumentViewer } from "./subcomponents/DocumentViewer.js";
|
|
10
|
+
export type { SubcomponentDataSource } from "./useSubcomponentArtifacts.js";
|
|
11
|
+
export type { CompactBusinessRulesProps, CompactDocTypeFieldProps, CompactFieldsFormProps, CompactTableEditorProps, DocumentViewerProps, SubcomponentCommandProps, SubcomponentCommonProps, SubcomponentStateEventProps, } from "./subcomponents/types.js";
|
|
4
12
|
//# 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,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
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,eAAe,EACf,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,8BAA8B,EAC9B,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,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,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
export { ValidationStationLanguage } from "./types.js";
|
|
2
2
|
export { ValidationStation } from "./ValidationStation.js";
|
|
3
|
+
export { useBucketArtifacts } from "./useBucketArtifacts.js";
|
|
4
|
+
// ─── Subcomponents ────────────────────────────────────────────────────────────
|
|
5
|
+
export { CompactBusinessRules } from "./subcomponents/CompactBusinessRules.js";
|
|
6
|
+
export { CompactDocTypeField } from "./subcomponents/CompactDocTypeField.js";
|
|
7
|
+
export { CompactFieldsForm } from "./subcomponents/CompactFieldsForm.js";
|
|
8
|
+
export { CompactTableEditor } from "./subcomponents/CompactTableEditor.js";
|
|
9
|
+
export { DocumentViewer } from "./subcomponents/DocumentViewer.js";
|
|
3
10
|
//# 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;AAUvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,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"}
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import "@uipath/du-validation-station-wc/polyfills";
|
|
2
2
|
import "@uipath/du-validation-station-wc/main";
|
|
3
3
|
import "@uipath/du-validation-station-wc/styles.css";
|
|
4
|
+
import "@uipath/du-validation-station-wc/fonts.css";
|
|
4
5
|
export declare const VALIDATION_STATION_TAG = "ui-du-validation-station-standalone-wc-element";
|
|
6
|
+
/**
|
|
7
|
+
* Custom-element tag names for every standalone DU web component registered by
|
|
8
|
+
* the `main` import above. Each has a `-persistent-element` sibling (see
|
|
9
|
+
* {@link convertToPersistentTag}) that survives portal detachment via `forceDestroy()`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DU_WC_TAGS: {
|
|
12
|
+
readonly validationStation: "ui-du-validation-station-standalone-wc-element";
|
|
13
|
+
readonly documentViewer: "ui-du-document-viewer-standalone-wc-element";
|
|
14
|
+
readonly compactFieldsForm: "ui-du-compact-fields-form-standalone-wc-element";
|
|
15
|
+
readonly compactTableEditor: "ui-du-compact-table-editor-standalone-wc-element";
|
|
16
|
+
readonly compactBusinessRules: "ui-du-compact-business-rules-standalone-wc-element";
|
|
17
|
+
readonly compactDocTypeField: "ui-du-compact-doc-type-field-standalone-wc-element";
|
|
18
|
+
};
|
|
19
|
+
/** Maps a base element tag to its persistent (`forceDestroy()`-capable) variant. */
|
|
20
|
+
export declare function convertToPersistentTag(tag: string): string;
|
|
21
|
+
export declare function waitForWcElementReady(tag: string): Promise<void>;
|
|
5
22
|
export declare const validationStationWcReady: Promise<void>;
|
|
6
23
|
//# sourceMappingURL=loadValidationStationWc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadValidationStationWc.d.ts","sourceRoot":"","sources":["../src/loadValidationStationWc.ts"],"names":[],"mappings":"AAGA,OAAO,4CAA4C,CAAC;AACpD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"loadValidationStationWc.d.ts","sourceRoot":"","sources":["../src/loadValidationStationWc.ts"],"names":[],"mappings":"AAGA,OAAO,4CAA4C,CAAC;AACpD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,6CAA6C,CAAC;AAKrD,OAAO,4CAA4C,CAAC;AAYpD,eAAO,MAAM,sBAAsB,mDACe,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;;;;CAOb,CAAC;AAEX,oFAAoF;AACpF,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMtE;AAED,eAAO,MAAM,wBAAwB,EAAE,OAAO,CAAC,IAAI,CAElD,CAAC"}
|
|
@@ -4,8 +4,42 @@
|
|
|
4
4
|
import "@uipath/du-validation-station-wc/polyfills";
|
|
5
5
|
import "@uipath/du-validation-station-wc/main";
|
|
6
6
|
import "@uipath/du-validation-station-wc/styles.css";
|
|
7
|
+
// Apollo fonts + Material Icons are shipped as a separate, opt-in stylesheet
|
|
8
|
+
// (their @font-face rules must apply in the light DOM — they're ignored inside
|
|
9
|
+
// the WC's shadow root). Without this, text falls back to system fonts and
|
|
10
|
+
// icon glyphs render as empty boxes.
|
|
11
|
+
import "@uipath/du-validation-station-wc/fonts.css";
|
|
12
|
+
// zone.js (loaded above) replaces Promise with ZoneAwarePromise which lacks
|
|
13
|
+
// Promise.try(). The WC calls it at render time, not module init, so restoring
|
|
14
|
+
// it here (after imports) is early enough. Remove when the WC upgrades zone.js.
|
|
15
|
+
if (typeof Promise.try !== "function") {
|
|
16
|
+
Promise.try = (fn, ...args) => new Promise((resolve) => resolve(fn(...args)));
|
|
17
|
+
}
|
|
7
18
|
export const VALIDATION_STATION_TAG = "ui-du-validation-station-standalone-wc-element";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Custom-element tag names for every standalone DU web component registered by
|
|
21
|
+
* the `main` import above. Each has a `-persistent-element` sibling (see
|
|
22
|
+
* {@link convertToPersistentTag}) that survives portal detachment via `forceDestroy()`.
|
|
23
|
+
*/
|
|
24
|
+
export const DU_WC_TAGS = {
|
|
25
|
+
validationStation: VALIDATION_STATION_TAG,
|
|
26
|
+
documentViewer: "ui-du-document-viewer-standalone-wc-element",
|
|
27
|
+
compactFieldsForm: "ui-du-compact-fields-form-standalone-wc-element",
|
|
28
|
+
compactTableEditor: "ui-du-compact-table-editor-standalone-wc-element",
|
|
29
|
+
compactBusinessRules: "ui-du-compact-business-rules-standalone-wc-element",
|
|
30
|
+
compactDocTypeField: "ui-du-compact-doc-type-field-standalone-wc-element",
|
|
31
|
+
};
|
|
32
|
+
/** Maps a base element tag to its persistent (`forceDestroy()`-capable) variant. */
|
|
33
|
+
export function convertToPersistentTag(tag) {
|
|
34
|
+
return tag.replace(/-element$/, "-persistent-element");
|
|
35
|
+
}
|
|
36
|
+
export async function waitForWcElementReady(tag) {
|
|
37
|
+
// No custom-element registry off the main thread / during SSR — resolve to a
|
|
38
|
+
// no-op so importing this module (and the `validationStationWcReady` const
|
|
39
|
+
// below, evaluated at import time) never touches `window` on the server.
|
|
40
|
+
if (typeof window === "undefined")
|
|
41
|
+
return;
|
|
42
|
+
await window.customElements.whenDefined(tag);
|
|
43
|
+
}
|
|
44
|
+
export const validationStationWcReady = waitForWcElementReady(VALIDATION_STATION_TAG);
|
|
11
45
|
//# sourceMappingURL=loadValidationStationWc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadValidationStationWc.js","sourceRoot":"","sources":["../src/loadValidationStationWc.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,gEAAgE;AAChE,OAAO,4CAA4C,CAAC;AACpD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"loadValidationStationWc.js","sourceRoot":"","sources":["../src/loadValidationStationWc.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,gEAAgE;AAChE,OAAO,4CAA4C,CAAC;AACpD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,6CAA6C,CAAC;AACrD,6EAA6E;AAC7E,+EAA+E;AAC/E,2EAA2E;AAC3E,qCAAqC;AACrC,OAAO,4CAA4C,CAAC;AAEpD,4EAA4E;AAC5E,+EAA+E;AAC/E,gFAAgF;AAChF,IAAI,OAAO,OAAO,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;IACtC,OAAO,CAAC,GAAG,GAAG,CACZ,EAAsC,EACtC,GAAG,IAAO,EACV,EAAE,CAAC,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAwB,CAAC;AAChF,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GACjC,gDAAgD,CAAC;AAEnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,iBAAiB,EAAE,sBAAsB;IACzC,cAAc,EAAE,6CAA6C;IAC7D,iBAAiB,EAAE,iDAAiD;IACpE,kBAAkB,EAAE,kDAAkD;IACtE,oBAAoB,EAAE,oDAAoD;IAC1E,mBAAmB,EAAE,oDAAoD;CACjE,CAAC;AAEX,oFAAoF;AACpF,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,OAAO,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,GAAW;IACrD,6EAA6E;IAC7E,2EAA2E;IAC3E,yEAAyE;IACzE,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAC1C,MAAM,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAkB,qBAAqB,CAC1E,sBAAsB,CACvB,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,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gBAAgB,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;IAEzE,MAAM,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"}
|