@uipath/du-validation-station-wc 1.0.0-beta.2 → 1.0.0-beta.3
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/CHANGELOG.md +142 -98
- package/LICENSE +9 -9
- package/README.md +296 -296
- package/chunk-2EG2XMZA.js +1 -0
- package/{chunk-YCOIYOXV.js → chunk-46UR4BR4.js} +1 -1
- package/{chunk-4RC3DPEI.js → chunk-72L4UBH7.js} +1 -1
- package/chunk-A7SW22GE.js +2 -0
- package/chunk-AEFGZOXA.js +1 -0
- package/{chunk-7XMORYEY.js → chunk-IGNVST57.js} +1 -1
- package/{chunk-5LGMGLPM.js → chunk-XOLTEKM3.js} +80 -80
- package/chunk-YYFDQWK6.js +5 -0
- package/{chunk-MEJRHTNP.js → chunk-Z4Q2KRL4.js} +1 -1
- package/du-assets/du-business-rules-executor/dotnet.d.ts +0 -0
- package/du-assets/du-business-rules-executor/dotnet.js +0 -0
- package/du-assets/du-business-rules-executor/dotnet.js.map +0 -0
- package/du-assets/du-business-rules-executor/dotnet.native.wasm +0 -0
- package/du-assets/du-business-rules-executor/dotnet.runtime.js +0 -0
- package/du-assets/du-business-rules-executor/dotnet.runtime.js.map +0 -0
- package/du-assets/du-validation-station-feature/i18n/en.json +14 -1
- package/index.html +16 -16
- package/main.js +25 -19
- package/package.json +3 -2
- package/types.d.ts +401 -401
- package/chunk-4DL5ZETN.js +0 -1
- package/chunk-6AEFIYR5.js +0 -4
- package/chunk-GUD4Q5ED.js +0 -2
- package/chunk-OCUVVNK2.js +0 -1
package/README.md
CHANGED
|
@@ -1,296 +1,296 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
# UiPath Document Understanding — Validation Station Web Component
|
|
4
|
-
|
|
5
|
-
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
[](https://www.npmjs.com/package/@uipath/du-validation-station-wc)
|
|
7
|
-
[](https://www.typescriptlang.org/)
|
|
8
|
-
[](https://angular.dev/)
|
|
9
|
-
|
|
10
|
-
[Install](#install) • [Usage](#usage--standalone-variant) • [React](#react) • [Persistent variant](#persistent-variant) • [Lazy loading](#lazy-loading)
|
|
11
|
-
|
|
12
|
-
A drop-in web component that renders the UiPath Document Understanding Validation Station inside any frontend project.
|
|
13
|
-
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
## About Validation Station
|
|
17
|
-
|
|
18
|
-
Validation Station is the human-in-the-loop review step of a UiPath Document Understanding pipeline. It renders extracted fields next to the original document and lets a reviewer confirm or correct what the extractor produced — scalar and multi-value fields, tables, and the document's classification — with selections in the document mapping back to fields and low-confidence values surfaced for review. The validated payload is emitted to the host application on save, or routed to an exception flow when a document can't be processed.
|
|
19
|
-
|
|
20
|
-
Learn more in the [UiPath Document Understanding docs](https://docs.uipath.com/activities/other/latest/document-understanding/compact-validation-station).
|
|
21
|
-
|
|
22
|
-
<details>
|
|
23
|
-
<summary><strong>Table of contents</strong></summary>
|
|
24
|
-
|
|
25
|
-
- [About Validation Station](#about-validation-station)
|
|
26
|
-
- [Install](#install)
|
|
27
|
-
- [Usage — standalone variant](#usage--standalone-variant)
|
|
28
|
-
- [1. Register the custom elements](#1-register-the-custom-elements)
|
|
29
|
-
- [2. Mount the element](#2-mount-the-element)
|
|
30
|
-
- [3. Wire up data and event handlers](#3-wire-up-data-and-event-handlers)
|
|
31
|
-
- [React](#react)
|
|
32
|
-
- [React 18](#react-18)
|
|
33
|
-
- [React 19](#react-19)
|
|
34
|
-
- [Persistent variant](#persistent-variant)
|
|
35
|
-
- [Lazy loading](#lazy-loading)
|
|
36
|
-
- [Static assets](#static-assets)
|
|
37
|
-
- [Versioning](#versioning)
|
|
38
|
-
- [Support](#support)
|
|
39
|
-
|
|
40
|
-
</details>
|
|
41
|
-
|
|
42
|
-
## Install
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
# npm
|
|
46
|
-
npm install @uipath/du-validation-station-wc
|
|
47
|
-
|
|
48
|
-
# yarn
|
|
49
|
-
yarn add @uipath/du-validation-station-wc
|
|
50
|
-
|
|
51
|
-
# pnpm
|
|
52
|
-
pnpm add @uipath/du-validation-station-wc
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
<div align="right">
|
|
56
|
-
|
|
57
|
-
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
58
|
-
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
## Usage — standalone variant
|
|
62
|
-
|
|
63
|
-
The **standalone** variant (`<ui-du-validation-station-standalone-wc-element>`)
|
|
64
|
-
does not make any HTTP calls. The consumer provides all document data
|
|
65
|
-
as JS properties and handles save / draft / exception requests by
|
|
66
|
-
listening to events. This is the recommended variant for external
|
|
67
|
-
consumers — your backend stays in control of all I/O.
|
|
68
|
-
|
|
69
|
-
### 1. Register the custom elements
|
|
70
|
-
|
|
71
|
-
Side-effect imports register the custom elements with the browser. Do
|
|
72
|
-
this once at app startup (or lazily, behind a route boundary — see
|
|
73
|
-
[Lazy loading](#lazy-loading) below).
|
|
74
|
-
|
|
75
|
-
```ts
|
|
76
|
-
import '@uipath/du-validation-station-wc/polyfills';
|
|
77
|
-
import '@uipath/du-validation-station-wc/main';
|
|
78
|
-
import '@uipath/du-validation-station-wc/styles.css';
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### 2. Mount the element
|
|
82
|
-
|
|
83
|
-
```html
|
|
84
|
-
<ui-du-validation-station-standalone-wc-element id="vs"></ui-du-validation-station-standalone-wc-element>
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### 3. Wire up data and event handlers
|
|
88
|
-
|
|
89
|
-
```ts
|
|
90
|
-
import type {
|
|
91
|
-
IValidationStationStandaloneWcElement,
|
|
92
|
-
IVsSaveValidatedDataRequest,
|
|
93
|
-
IFieldValueDetailsDto,
|
|
94
|
-
} from '@uipath/du-validation-station-wc';
|
|
95
|
-
|
|
96
|
-
const el = document.querySelector<IValidationStationStandaloneWcElement>('#vs')!;
|
|
97
|
-
|
|
98
|
-
// Required setup (object inputs must be JS properties, not HTML attributes).
|
|
99
|
-
el.documentId = 'doc-123';
|
|
100
|
-
el.taxonomy = await fetchTaxonomy();
|
|
101
|
-
el.extractionResult = await fetchExtractionResult();
|
|
102
|
-
el.dom = await fetchDocumentObjectModel();
|
|
103
|
-
el.text = await fetchText();
|
|
104
|
-
el.original = await fetchOriginalAsBase64DataUrl();
|
|
105
|
-
|
|
106
|
-
// Optional configuration.
|
|
107
|
-
el.theme = 'light';
|
|
108
|
-
el.language = 'en';
|
|
109
|
-
el.options = { hideReportAsExceptionButton: true };
|
|
110
|
-
|
|
111
|
-
// User pressed Save — call YOUR backend.
|
|
112
|
-
el.addEventListener('saveValidatedDataRequest', (e: CustomEvent<IVsSaveValidatedDataRequest>) => {
|
|
113
|
-
submitValidatedData(e.detail.documentId, e.detail.validatedData);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// React to field selection.
|
|
117
|
-
el.addEventListener('fieldValueSelected', (e: CustomEvent<IFieldValueDetailsDto>) => {
|
|
118
|
-
console.log('Selected:', e.detail);
|
|
119
|
-
});
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
The shapes of `taxonomy`, `extractionResult`, `dom`, `customizationInfo`,
|
|
123
|
-
and the save-request payloads are typed as `unknown` in the public type
|
|
124
|
-
defs because they originate in UiPath's Document Understanding domain
|
|
125
|
-
DTOs. Cast to the relevant DTO when forwarding to your backend.
|
|
126
|
-
|
|
127
|
-
<div align="right">
|
|
128
|
-
|
|
129
|
-
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
130
|
-
|
|
131
|
-
</div>
|
|
132
|
-
|
|
133
|
-
## React
|
|
134
|
-
|
|
135
|
-
### React 18
|
|
136
|
-
|
|
137
|
-
In React 18, complex object props must be set via a `ref` as JS
|
|
138
|
-
properties — React 18 serialises JSX props to HTML attributes and
|
|
139
|
-
Angular Elements cannot deserialise object JSON. Scalar inputs
|
|
140
|
-
(`theme`, `language`, `is-readonly`, …) work directly as JSX
|
|
141
|
-
attributes.
|
|
142
|
-
|
|
143
|
-
```tsx
|
|
144
|
-
import { useEffect, useRef } from 'react';
|
|
145
|
-
import type {
|
|
146
|
-
IValidationStationStandaloneWcElement,
|
|
147
|
-
IVsSaveValidatedDataRequest,
|
|
148
|
-
} from '@uipath/du-validation-station-wc';
|
|
149
|
-
|
|
150
|
-
import '@uipath/du-validation-station-wc/polyfills';
|
|
151
|
-
import '@uipath/du-validation-station-wc/main';
|
|
152
|
-
import '@uipath/du-validation-station-wc/styles.css';
|
|
153
|
-
|
|
154
|
-
export function ValidationStation(props: {
|
|
155
|
-
documentId: string;
|
|
156
|
-
taxonomy: unknown;
|
|
157
|
-
extractionResult: unknown;
|
|
158
|
-
dom: unknown;
|
|
159
|
-
text: string;
|
|
160
|
-
original: string;
|
|
161
|
-
onSave: (req: IVsSaveValidatedDataRequest) => void;
|
|
162
|
-
}) {
|
|
163
|
-
const ref = useRef<IValidationStationStandaloneWcElement | null>(null);
|
|
164
|
-
|
|
165
|
-
useEffect(() => {
|
|
166
|
-
const el = ref.current;
|
|
167
|
-
if (!el) return;
|
|
168
|
-
el.documentId = props.documentId;
|
|
169
|
-
el.taxonomy = props.taxonomy;
|
|
170
|
-
el.extractionResult = props.extractionResult;
|
|
171
|
-
el.dom = props.dom;
|
|
172
|
-
el.text = props.text;
|
|
173
|
-
el.original = props.original;
|
|
174
|
-
|
|
175
|
-
const handler = (e: CustomEvent<IVsSaveValidatedDataRequest>) => props.onSave(e.detail);
|
|
176
|
-
el.addEventListener('saveValidatedDataRequest', handler);
|
|
177
|
-
return () => el.removeEventListener('saveValidatedDataRequest', handler);
|
|
178
|
-
}, [props]);
|
|
179
|
-
|
|
180
|
-
return (
|
|
181
|
-
<ui-du-validation-station-standalone-wc-element
|
|
182
|
-
ref={ref}
|
|
183
|
-
theme="light"
|
|
184
|
-
is-readonly={false}
|
|
185
|
-
/>
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### React 19
|
|
191
|
-
|
|
192
|
-
React 19 supports passing complex object props directly as JSX
|
|
193
|
-
attributes. Refs become optional for static data:
|
|
194
|
-
|
|
195
|
-
```tsx
|
|
196
|
-
<ui-du-validation-station-standalone-wc-element
|
|
197
|
-
documentId={documentId}
|
|
198
|
-
taxonomy={taxonomy}
|
|
199
|
-
extractionResult={extractionResult}
|
|
200
|
-
dom={dom}
|
|
201
|
-
text={text}
|
|
202
|
-
original={original}
|
|
203
|
-
theme="light"
|
|
204
|
-
/>
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
<div align="right">
|
|
208
|
-
|
|
209
|
-
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
210
|
-
|
|
211
|
-
</div>
|
|
212
|
-
|
|
213
|
-
## Persistent variant
|
|
214
|
-
|
|
215
|
-
If your app moves the element through portals or tab switches, use the
|
|
216
|
-
persistent variant — it suppresses `disconnectedCallback()` so the
|
|
217
|
-
internal Angular state survives detachments. **Always call
|
|
218
|
-
`forceDestroy()`** when permanently removing the element to avoid
|
|
219
|
-
memory leaks.
|
|
220
|
-
|
|
221
|
-
```html
|
|
222
|
-
<ui-du-validation-station-standalone-wc-persistent-element></ui-du-validation-station-standalone-wc-persistent-element>
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
```ts
|
|
226
|
-
import type { IPersistentValidationStationStandaloneWcElement } from '@uipath/du-validation-station-wc';
|
|
227
|
-
|
|
228
|
-
const el = document.querySelector<IPersistentValidationStationStandaloneWcElement>('#vs');
|
|
229
|
-
el?.forceDestroy();
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
<div align="right">
|
|
233
|
-
|
|
234
|
-
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
235
|
-
|
|
236
|
-
</div>
|
|
237
|
-
|
|
238
|
-
## Lazy loading
|
|
239
|
-
|
|
240
|
-
The bundle is non-trivial (several MB). If your app loads the WC
|
|
241
|
-
conditionally, defer the side-effect imports behind a dynamic
|
|
242
|
-
`import()` so the bundler can split it off:
|
|
243
|
-
|
|
244
|
-
```ts
|
|
245
|
-
async function showValidationStation() {
|
|
246
|
-
await Promise.all([
|
|
247
|
-
import('@uipath/du-validation-station-wc/polyfills'),
|
|
248
|
-
import('@uipath/du-validation-station-wc/main'),
|
|
249
|
-
import('@uipath/du-validation-station-wc/styles.css'),
|
|
250
|
-
]);
|
|
251
|
-
// …mount the element.
|
|
252
|
-
}
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
<div align="right">
|
|
256
|
-
|
|
257
|
-
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
258
|
-
|
|
259
|
-
</div>
|
|
260
|
-
|
|
261
|
-
## Static assets
|
|
262
|
-
|
|
263
|
-
The WC loads runtime assets (PDF.js worker, cmaps, wasm, i18n) from a
|
|
264
|
-
sibling `du-assets/` directory at runtime, resolved relative to where
|
|
265
|
-
the WC's main bundle is served via `import.meta.url`.
|
|
266
|
-
|
|
267
|
-
**`du-assets/` must be deployed at the same path level as your output
|
|
268
|
-
bundle**, otherwise PDF rendering and translations will silently 404
|
|
269
|
-
in the browser (no build error).
|
|
270
|
-
|
|
271
|
-
- **If your bundler inlines the WC into your app bundle** (typical
|
|
272
|
-
npm consumers): copy
|
|
273
|
-
`node_modules/@uipath/du-validation-station-wc/du-assets/` to your
|
|
274
|
-
dist root as a post-build step. Most bundlers have an asset-copy
|
|
275
|
-
plugin (Vite `publicDir`, webpack `CopyPlugin`,
|
|
276
|
-
`rollup-plugin-copy`, Angular `assets` array).
|
|
277
|
-
- **If you load `main.js` as a separate browser bundle** (e.g.
|
|
278
|
-
`<script type="module" src="…/main.js">`): make sure your CDN or
|
|
279
|
-
static host serves the package's `du-assets/` folder alongside.
|
|
280
|
-
|
|
281
|
-
<div align="right">
|
|
282
|
-
|
|
283
|
-
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
284
|
-
|
|
285
|
-
</div>
|
|
286
|
-
|
|
287
|
-
## Versioning
|
|
288
|
-
|
|
289
|
-
This package follows semantic versioning. See `CHANGELOG.md` for
|
|
290
|
-
release notes.
|
|
291
|
-
|
|
292
|
-
<div align="right">
|
|
293
|
-
|
|
294
|
-
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
295
|
-
|
|
296
|
-
</div>
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# UiPath Document Understanding — Validation Station Web Component
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://www.npmjs.com/package/@uipath/du-validation-station-wc)
|
|
7
|
+
[](https://www.typescriptlang.org/)
|
|
8
|
+
[](https://angular.dev/)
|
|
9
|
+
|
|
10
|
+
[Install](#install) • [Usage](#usage--standalone-variant) • [React](#react) • [Persistent variant](#persistent-variant) • [Lazy loading](#lazy-loading)
|
|
11
|
+
|
|
12
|
+
A drop-in web component that renders the UiPath Document Understanding Validation Station inside any frontend project.
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
## About Validation Station
|
|
17
|
+
|
|
18
|
+
Validation Station is the human-in-the-loop review step of a UiPath Document Understanding pipeline. It renders extracted fields next to the original document and lets a reviewer confirm or correct what the extractor produced — scalar and multi-value fields, tables, and the document's classification — with selections in the document mapping back to fields and low-confidence values surfaced for review. The validated payload is emitted to the host application on save, or routed to an exception flow when a document can't be processed.
|
|
19
|
+
|
|
20
|
+
Learn more in the [UiPath Document Understanding docs](https://docs.uipath.com/activities/other/latest/document-understanding/compact-validation-station).
|
|
21
|
+
|
|
22
|
+
<details>
|
|
23
|
+
<summary><strong>Table of contents</strong></summary>
|
|
24
|
+
|
|
25
|
+
- [About Validation Station](#about-validation-station)
|
|
26
|
+
- [Install](#install)
|
|
27
|
+
- [Usage — standalone variant](#usage--standalone-variant)
|
|
28
|
+
- [1. Register the custom elements](#1-register-the-custom-elements)
|
|
29
|
+
- [2. Mount the element](#2-mount-the-element)
|
|
30
|
+
- [3. Wire up data and event handlers](#3-wire-up-data-and-event-handlers)
|
|
31
|
+
- [React](#react)
|
|
32
|
+
- [React 18](#react-18)
|
|
33
|
+
- [React 19](#react-19)
|
|
34
|
+
- [Persistent variant](#persistent-variant)
|
|
35
|
+
- [Lazy loading](#lazy-loading)
|
|
36
|
+
- [Static assets](#static-assets)
|
|
37
|
+
- [Versioning](#versioning)
|
|
38
|
+
- [Support](#support)
|
|
39
|
+
|
|
40
|
+
</details>
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# npm
|
|
46
|
+
npm install @uipath/du-validation-station-wc
|
|
47
|
+
|
|
48
|
+
# yarn
|
|
49
|
+
yarn add @uipath/du-validation-station-wc
|
|
50
|
+
|
|
51
|
+
# pnpm
|
|
52
|
+
pnpm add @uipath/du-validation-station-wc
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
<div align="right">
|
|
56
|
+
|
|
57
|
+
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
58
|
+
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
## Usage — standalone variant
|
|
62
|
+
|
|
63
|
+
The **standalone** variant (`<ui-du-validation-station-standalone-wc-element>`)
|
|
64
|
+
does not make any HTTP calls. The consumer provides all document data
|
|
65
|
+
as JS properties and handles save / draft / exception requests by
|
|
66
|
+
listening to events. This is the recommended variant for external
|
|
67
|
+
consumers — your backend stays in control of all I/O.
|
|
68
|
+
|
|
69
|
+
### 1. Register the custom elements
|
|
70
|
+
|
|
71
|
+
Side-effect imports register the custom elements with the browser. Do
|
|
72
|
+
this once at app startup (or lazily, behind a route boundary — see
|
|
73
|
+
[Lazy loading](#lazy-loading) below).
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import '@uipath/du-validation-station-wc/polyfills';
|
|
77
|
+
import '@uipath/du-validation-station-wc/main';
|
|
78
|
+
import '@uipath/du-validation-station-wc/styles.css';
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2. Mount the element
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<ui-du-validation-station-standalone-wc-element id="vs"></ui-du-validation-station-standalone-wc-element>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Wire up data and event handlers
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import type {
|
|
91
|
+
IValidationStationStandaloneWcElement,
|
|
92
|
+
IVsSaveValidatedDataRequest,
|
|
93
|
+
IFieldValueDetailsDto,
|
|
94
|
+
} from '@uipath/du-validation-station-wc';
|
|
95
|
+
|
|
96
|
+
const el = document.querySelector<IValidationStationStandaloneWcElement>('#vs')!;
|
|
97
|
+
|
|
98
|
+
// Required setup (object inputs must be JS properties, not HTML attributes).
|
|
99
|
+
el.documentId = 'doc-123';
|
|
100
|
+
el.taxonomy = await fetchTaxonomy();
|
|
101
|
+
el.extractionResult = await fetchExtractionResult();
|
|
102
|
+
el.dom = await fetchDocumentObjectModel();
|
|
103
|
+
el.text = await fetchText();
|
|
104
|
+
el.original = await fetchOriginalAsBase64DataUrl();
|
|
105
|
+
|
|
106
|
+
// Optional configuration.
|
|
107
|
+
el.theme = 'light';
|
|
108
|
+
el.language = 'en';
|
|
109
|
+
el.options = { hideReportAsExceptionButton: true };
|
|
110
|
+
|
|
111
|
+
// User pressed Save — call YOUR backend.
|
|
112
|
+
el.addEventListener('saveValidatedDataRequest', (e: CustomEvent<IVsSaveValidatedDataRequest>) => {
|
|
113
|
+
submitValidatedData(e.detail.documentId, e.detail.validatedData);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// React to field selection.
|
|
117
|
+
el.addEventListener('fieldValueSelected', (e: CustomEvent<IFieldValueDetailsDto>) => {
|
|
118
|
+
console.log('Selected:', e.detail);
|
|
119
|
+
});
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The shapes of `taxonomy`, `extractionResult`, `dom`, `customizationInfo`,
|
|
123
|
+
and the save-request payloads are typed as `unknown` in the public type
|
|
124
|
+
defs because they originate in UiPath's Document Understanding domain
|
|
125
|
+
DTOs. Cast to the relevant DTO when forwarding to your backend.
|
|
126
|
+
|
|
127
|
+
<div align="right">
|
|
128
|
+
|
|
129
|
+
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
130
|
+
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
## React
|
|
134
|
+
|
|
135
|
+
### React 18
|
|
136
|
+
|
|
137
|
+
In React 18, complex object props must be set via a `ref` as JS
|
|
138
|
+
properties — React 18 serialises JSX props to HTML attributes and
|
|
139
|
+
Angular Elements cannot deserialise object JSON. Scalar inputs
|
|
140
|
+
(`theme`, `language`, `is-readonly`, …) work directly as JSX
|
|
141
|
+
attributes.
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
import { useEffect, useRef } from 'react';
|
|
145
|
+
import type {
|
|
146
|
+
IValidationStationStandaloneWcElement,
|
|
147
|
+
IVsSaveValidatedDataRequest,
|
|
148
|
+
} from '@uipath/du-validation-station-wc';
|
|
149
|
+
|
|
150
|
+
import '@uipath/du-validation-station-wc/polyfills';
|
|
151
|
+
import '@uipath/du-validation-station-wc/main';
|
|
152
|
+
import '@uipath/du-validation-station-wc/styles.css';
|
|
153
|
+
|
|
154
|
+
export function ValidationStation(props: {
|
|
155
|
+
documentId: string;
|
|
156
|
+
taxonomy: unknown;
|
|
157
|
+
extractionResult: unknown;
|
|
158
|
+
dom: unknown;
|
|
159
|
+
text: string;
|
|
160
|
+
original: string;
|
|
161
|
+
onSave: (req: IVsSaveValidatedDataRequest) => void;
|
|
162
|
+
}) {
|
|
163
|
+
const ref = useRef<IValidationStationStandaloneWcElement | null>(null);
|
|
164
|
+
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
const el = ref.current;
|
|
167
|
+
if (!el) return;
|
|
168
|
+
el.documentId = props.documentId;
|
|
169
|
+
el.taxonomy = props.taxonomy;
|
|
170
|
+
el.extractionResult = props.extractionResult;
|
|
171
|
+
el.dom = props.dom;
|
|
172
|
+
el.text = props.text;
|
|
173
|
+
el.original = props.original;
|
|
174
|
+
|
|
175
|
+
const handler = (e: CustomEvent<IVsSaveValidatedDataRequest>) => props.onSave(e.detail);
|
|
176
|
+
el.addEventListener('saveValidatedDataRequest', handler);
|
|
177
|
+
return () => el.removeEventListener('saveValidatedDataRequest', handler);
|
|
178
|
+
}, [props]);
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<ui-du-validation-station-standalone-wc-element
|
|
182
|
+
ref={ref}
|
|
183
|
+
theme="light"
|
|
184
|
+
is-readonly={false}
|
|
185
|
+
/>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### React 19
|
|
191
|
+
|
|
192
|
+
React 19 supports passing complex object props directly as JSX
|
|
193
|
+
attributes. Refs become optional for static data:
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
<ui-du-validation-station-standalone-wc-element
|
|
197
|
+
documentId={documentId}
|
|
198
|
+
taxonomy={taxonomy}
|
|
199
|
+
extractionResult={extractionResult}
|
|
200
|
+
dom={dom}
|
|
201
|
+
text={text}
|
|
202
|
+
original={original}
|
|
203
|
+
theme="light"
|
|
204
|
+
/>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
<div align="right">
|
|
208
|
+
|
|
209
|
+
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
210
|
+
|
|
211
|
+
</div>
|
|
212
|
+
|
|
213
|
+
## Persistent variant
|
|
214
|
+
|
|
215
|
+
If your app moves the element through portals or tab switches, use the
|
|
216
|
+
persistent variant — it suppresses `disconnectedCallback()` so the
|
|
217
|
+
internal Angular state survives detachments. **Always call
|
|
218
|
+
`forceDestroy()`** when permanently removing the element to avoid
|
|
219
|
+
memory leaks.
|
|
220
|
+
|
|
221
|
+
```html
|
|
222
|
+
<ui-du-validation-station-standalone-wc-persistent-element></ui-du-validation-station-standalone-wc-persistent-element>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
import type { IPersistentValidationStationStandaloneWcElement } from '@uipath/du-validation-station-wc';
|
|
227
|
+
|
|
228
|
+
const el = document.querySelector<IPersistentValidationStationStandaloneWcElement>('#vs');
|
|
229
|
+
el?.forceDestroy();
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
<div align="right">
|
|
233
|
+
|
|
234
|
+
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
235
|
+
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
## Lazy loading
|
|
239
|
+
|
|
240
|
+
The bundle is non-trivial (several MB). If your app loads the WC
|
|
241
|
+
conditionally, defer the side-effect imports behind a dynamic
|
|
242
|
+
`import()` so the bundler can split it off:
|
|
243
|
+
|
|
244
|
+
```ts
|
|
245
|
+
async function showValidationStation() {
|
|
246
|
+
await Promise.all([
|
|
247
|
+
import('@uipath/du-validation-station-wc/polyfills'),
|
|
248
|
+
import('@uipath/du-validation-station-wc/main'),
|
|
249
|
+
import('@uipath/du-validation-station-wc/styles.css'),
|
|
250
|
+
]);
|
|
251
|
+
// …mount the element.
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
<div align="right">
|
|
256
|
+
|
|
257
|
+
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
258
|
+
|
|
259
|
+
</div>
|
|
260
|
+
|
|
261
|
+
## Static assets
|
|
262
|
+
|
|
263
|
+
The WC loads runtime assets (PDF.js worker, cmaps, wasm, i18n) from a
|
|
264
|
+
sibling `du-assets/` directory at runtime, resolved relative to where
|
|
265
|
+
the WC's main bundle is served via `import.meta.url`.
|
|
266
|
+
|
|
267
|
+
**`du-assets/` must be deployed at the same path level as your output
|
|
268
|
+
bundle**, otherwise PDF rendering and translations will silently 404
|
|
269
|
+
in the browser (no build error).
|
|
270
|
+
|
|
271
|
+
- **If your bundler inlines the WC into your app bundle** (typical
|
|
272
|
+
npm consumers): copy
|
|
273
|
+
`node_modules/@uipath/du-validation-station-wc/du-assets/` to your
|
|
274
|
+
dist root as a post-build step. Most bundlers have an asset-copy
|
|
275
|
+
plugin (Vite `publicDir`, webpack `CopyPlugin`,
|
|
276
|
+
`rollup-plugin-copy`, Angular `assets` array).
|
|
277
|
+
- **If you load `main.js` as a separate browser bundle** (e.g.
|
|
278
|
+
`<script type="module" src="…/main.js">`): make sure your CDN or
|
|
279
|
+
static host serves the package's `du-assets/` folder alongside.
|
|
280
|
+
|
|
281
|
+
<div align="right">
|
|
282
|
+
|
|
283
|
+
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
284
|
+
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
## Versioning
|
|
288
|
+
|
|
289
|
+
This package follows semantic versioning. See `CHANGELOG.md` for
|
|
290
|
+
release notes.
|
|
291
|
+
|
|
292
|
+
<div align="right">
|
|
293
|
+
|
|
294
|
+
[↑ Back to top](#uipath-document-understanding--validation-station-web-component)
|
|
295
|
+
|
|
296
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$a as Pt,A as F,Ab as Lt,Ba as it,Bb as lt,D as St,Dc as fe,Ga as kt,H as _t,Ha as nt,I as xt,Ia as wt,J as Ct,Ja as U,N as vt,Na as rt,Nf as G,O as zt,P as y,Pb as Qt,Q as T,Qf as Ae,S as E,T as q,Ta as yt,V as me,Va as V,Vb as Zt,Xa as j,Z as bt,Za as Tt,_ as $,_a as Et,aa as f,ab as N,b as ft,bb as It,c as H,cb as Ot,da as P,db as Gt,dc as S,ea as I,ec as Jt,fc as Ht,ga as Mt,gb as Bt,ha as X,hb as Rt,hc as x,ib as Ft,ic as c,jb as $t,ka as Dt,kb as Ut,kc as Wt,l as W,lb as Vt,lc as qt,nb as jt,nc as z,o as R,ob as g,pa as tt,pb as st,pc as D,q as At,qb as at,qc as Xt,rc as ut,s as A,tc as te,ua as O,v as M,vb as ot,w,xa as et,xb as Nt,yb as Kt,yc as ee,zb as Yt,zc as ie}from"./chunk-XOLTEKM3.js";import{f as pe}from"./chunk-3ONYU5UZ.js";function _e(n,r){n&1&&$t(0)}function xe(n,r){if(n&1&&(Rt(0),rt(1,_e,1,0,"ng-container",5),Ft()),n&2){let o=r.$implicit,t=g(3),e=t.$implicit,i=t.$index,s=t.$index,a=g();O(),N("ngTemplateOutlet",a.customGutter().template)("ngTemplateOutletContext",Zt(3,Se,e,a._areas()[i+1],i+1,s===0,i===a._areas().length-2,a.draggedGutterIndex()===i))("ngTemplateOutletInjector",o)}}function Ce(n,r){if(n&1&&rt(0,xe,2,10,"ng-container",4),n&2){let o=g(2).$index;N("asSplitGutterDynamicInjector",o+1)}}function ve(n,r){n&1&&Gt(0,"div",3)}function ze(n,r){if(n&1){let o=Ut();It(0,"div",2,0),jt("asSplitCustomClick",function(){P(o);let e=g().$index,i=g();return I(i.gutterClicked(e))})("asSplitCustomDblClick",function(){P(o);let e=g().$index,i=g();return I(i.gutterDoubleClicked(e))})("asSplitCustomMouseDown",function(e){P(o);let i=Kt(1),s=g().$index,a=g();return I(a.gutterMouseDown(e,i,s,s,s+1))})("asSplitCustomKeyDown",function(e){P(o);let i=g().$index,s=g();return I(s.gutterKeyDown(e,i,i,i+1))}),V(2,Ce,1,1,"ng-container")(3,ve,1,0,"div",3),Ot()}if(n&2){let o,t=g(),e=t.$implicit,i=t.$index,s=g();Lt("as-dragged",s.draggedGutterIndex()===i),N("ngStyle",s.getGutterGridStyle(i+1))("asSplitCustomMultiClickThreshold",s.gutterDblClickDuration())("asSplitCustomClickDeltaInPx",s.gutterClickDeltaPx()),yt("aria-label",s.gutterAriaLabel())("aria-orientation",s.direction())("aria-valuemin",s.getAriaValue(e.minSize()))("aria-valuemax",s.getAriaValue(e.maxSize()))("aria-valuenow",s.getAriaValue(e._internalSize()))("aria-valuetext",s.getAriaAreaSizeText(e)),O(2),j((o=s.customGutter())!=null&&o.template?2:3)}}function be(n,r){if(n&1&&V(0,ze,4,12,"div",1),n&2){let o=r.$index,t=r.$count;j(o!==t-1?0:-1)}}function Me(n,r){n&1&&Bt(0,"div",0)}function B(n){if((o=>window.TouchEvent&&n instanceof TouchEvent)(n)){if(n.changedTouches.length===0)return;let{clientX:o,clientY:t}=n.changedTouches[0];return{x:o,y:t}}if(n instanceof KeyboardEvent){let o=n.target;return{x:o.offsetLeft+o.offsetWidth/2,y:o.offsetTop+o.offsetHeight/2}}return{x:n.clientX,y:n.clientY}}function le(n,r,o,t){if(!t.contains(n.target)||!t.contains(r.target))return!1;let e=B(n),i=B(r);return Math.abs(i.x-e.x)<=o&&Math.abs(i.y-e.y)<=o}function re(n){return M(A(n,"mousedown").pipe(w(r=>r.button===0)),A(n,"touchstart",{passive:!1}))}function ct(n){return M(A(n,"mousemove"),A(n,"touchmove"))}function Y(n,r=!1){let o=M(A(n,"mouseup"),A(n,"touchend"));return r?M(o,A(n,"touchcancel")):o}function dt(n,r){return n.reduce((o,t)=>o+r(t),0)}function Te(n,r){return n.reduce((o,t,e)=>{let[i,s]=r(t,e);return o[i]=s,o},{})}function ue(n){return Object.entries(n).filter(([,r])=>r).map(([r])=>r).join(" ")}function ht(){return n=>new ft(r=>f(et).runOutsideAngular(()=>n.subscribe(r)))}function se(n,r,o){if(n.length===0)return!0;let t=n.map(s=>{let a=s.size();return a==="auto"?"*":a}),e=t.filter(s=>s==="*");if(e.length>1)return o&&console.warn("as-split: Maximum one * area is allowed"),!1;if(r==="pixel")return e.length===1?!0:(o&&console.warn("as-split: Pixel mode must have exactly one * area"),!1);let i=dt(t,s=>s==="*"?0:s);return e.length===1?i<=100.1?!0:(o&&console.warn("as-split: Percent areas must total 100%"),!1):i<99.9||i>100.1?(o&&console.warn("as-split: Percent areas must total 100%"),!1):!0}var oe,Se,De,ke,ne,we,ye,K,Ee,Pe,gt,Ie,ce,Oe,ae,Qe,Ze,Ge=pe(()=>{"use strict";te();te();fe();Ae();me();oe=["*"],Se=(n,r,o,t,e,i)=>({areaBefore:n,areaAfter:r,gutterNum:o,first:t,last:e,isDragged:i});De={dir:"ltr",direction:"horizontal",disabled:!1,gutterDblClickDuration:0,gutterSize:11,gutterStep:1,gutterClickDeltaPx:2,restrictMove:!1,unit:"percent",useTransition:!1},ke=new $("angular-split-global-config",{providedIn:"root",factory:()=>De}),ne=(()=>{let r=class r{constructor(){this.template=f(it),this._gutterToHandleElementMap=new Map,this._gutterToExcludeDragElementMap=new Map}_canStartDragging(t,e){return this._gutterToExcludeDragElementMap.has(e)&&this._gutterToExcludeDragElementMap.get(e).some(s=>s.nativeElement.contains(t))?!1:this._gutterToHandleElementMap.has(e)?this._gutterToHandleElementMap.get(e).some(i=>i.nativeElement.contains(t)):!0}_addToMap(t,e,i){t.has(e)?t.get(e).push(i):t.set(e,[i])}_removedFromMap(t,e,i){let s=t.get(e);s.splice(s.indexOf(i),1),s.length===0&&t.delete(e)}static ngTemplateContextGuard(t,e){return!0}};r.\u0275fac=function(e){return new(e||r)},r.\u0275dir=U({type:r,selectors:[["","asSplitGutter",""]]});let n=r;return n})(),we=new $("Gutter num"),ye=(()=>{let r=class r{constructor(){this.vcr=f(kt),this.templateRef=f(it),this.gutterNum=c.required({alias:"asSplitGutterDynamicInjector"}),Jt(()=>{this.vcr.clear();let t=Mt.create({providers:[{provide:we,useValue:this.gutterNum()}],parent:this.vcr.injector});this.vcr.createEmbeddedView(this.templateRef,{$implicit:t})})}static ngTemplateContextGuard(t,e){return!0}};r.\u0275fac=function(e){return new(e||r)},r.\u0275dir=U({type:r,selectors:[["","asSplitGutterDynamicInjector",""]],inputs:{gutterNum:[1,"asSplitGutterDynamicInjector","gutterNum"]}});let n=r;return n})();K=n=>r=>Xt(r,n),Ee=(n,r)=>{throw new Error(`as-split: unknown value "${n}" for "${r}"`)},Pe=(()=>{let r=class r{constructor(){this.elementRef=f(tt),this.document=f(X),this.multiClickThreshold=c.required({alias:"asSplitCustomMultiClickThreshold"}),this.deltaInPx=c.required({alias:"asSplitCustomClickDeltaInPx"}),this.mouseDown=x({alias:"asSplitCustomMouseDown"}),this.click=x({alias:"asSplitCustomClick"}),this.dblClick=x({alias:"asSplitCustomDblClick"}),this.keyDown=x({alias:"asSplitCustomKeyDown"}),A(this.elementRef.nativeElement,"keydown").pipe(ht(),G()).subscribe(e=>this.keyDown.emit(e));let t=re(this.elementRef.nativeElement).pipe(y(e=>ct(this.document).pipe(w(i=>!le(e,i,this.deltaInPx(),this.elementRef.nativeElement)),F(1),R(()=>!0),T(Y(this.document)))));re(this.elementRef.nativeElement).pipe(E(e=>this.mouseDown.emit(e)),q(),Ct((e,{interval:i})=>i>=this.multiClickThreshold()?1:e+1,0),y(e=>Y(this.elementRef.nativeElement).pipe(q(),F(1),e===2?R(()=>e):At(({interval:i})=>i>=this.multiClickThreshold()?W(e):W(e).pipe(St(this.multiClickThreshold()-i))))),T(t),xt(),ht(),G()).subscribe(e=>{e===1?this.click.emit():e===2&&this.dblClick.emit()})}};r.\u0275fac=function(e){return new(e||r)},r.\u0275dir=U({type:r,selectors:[["","asSplitCustomEventsBehavior",""]],inputs:{multiClickThreshold:[1,"asSplitCustomMultiClickThreshold","multiClickThreshold"],deltaInPx:[1,"asSplitCustomClickDeltaInPx","deltaInPx"]},outputs:{mouseDown:"asSplitCustomMouseDown",click:"asSplitCustomClick",dblClick:"asSplitCustomDblClick",keyDown:"asSplitCustomKeyDown"}});let n=r;return n})();gt=new $("Split Area Contract"),Ie=(()=>{let r=class r{get hostClassesBinding(){return this.hostClasses()}get hostDirBinding(){return this.dir()}constructor(){this.document=f(X),this.elementRef=f(tt),this.ngZone=f(et),this.defaultOptions=f(ke),this.gutterMouseDownSubject=new H,this.dragProgressSubject=new H,this._areas=qt(gt),this.customGutter=Wt(ne),this.gutterSize=c(this.defaultOptions.gutterSize,{transform:K(this.defaultOptions.gutterSize)}),this.gutterStep=c(this.defaultOptions.gutterStep,{transform:K(this.defaultOptions.gutterStep)}),this.disabled=c(this.defaultOptions.disabled,{transform:D}),this.gutterClickDeltaPx=c(this.defaultOptions.gutterClickDeltaPx,{transform:K(this.defaultOptions.gutterClickDeltaPx)}),this.direction=c(this.defaultOptions.direction),this.dir=c(this.defaultOptions.dir),this.unit=c(this.defaultOptions.unit),this.gutterAriaLabel=c(),this.restrictMove=c(this.defaultOptions.restrictMove,{transform:D}),this.useTransition=c(this.defaultOptions.useTransition,{transform:D}),this.gutterDblClickDuration=c(this.defaultOptions.gutterDblClickDuration,{transform:K(this.defaultOptions.gutterDblClickDuration)}),this.gutterClick=x(),this.gutterDblClick=x(),this.dragStart=x(),this.dragEnd=x(),this.transitionEnd=x(),this.dragProgress$=this.dragProgressSubject.asObservable(),this._visibleAreas=S(()=>this._areas().filter(t=>t.visible())),this.gridTemplateColumnsStyle=S(()=>this.createGridTemplateColumnsStyle()),this.hostClasses=S(()=>ue({[`as-${this.direction()}`]:!0,[`as-${this.unit()}`]:!0,"as-disabled":this.disabled(),"as-dragging":this._isDragging(),"as-transition":this.useTransition()&&!this._isDragging()})),this.draggedGutterIndex=Dt(void 0),this._isDragging=S(()=>this.draggedGutterIndex()!==void 0),this._alignedVisibleAreasSizes=S(()=>this.createAlignedVisibleAreasSize()),z()&&ut({read:()=>{this.unit()==="percent"&&this._visibleAreas().every(t=>t.size()==="auto")||se(this._visibleAreas(),this.unit(),!0)}}),ut({write:()=>{this.elementRef.nativeElement.style.gridTemplate=this.gridTemplateColumnsStyle()}}),this.gutterMouseDownSubject.pipe(w(t=>!this.customGutter()||this.customGutter()._canStartDragging(t.mouseDownEvent.target,t.gutterIndex+1)),y(t=>ct(this.document).pipe(zt(t.mouseDownEvent),_t(),vt(([,e])=>le(t.mouseDownEvent,e,this.gutterClickDeltaPx(),t.gutterElement)),F(1),T(M(Y(this.document,!0),A(this.document,"blur"))),E(()=>{this.ngZone.run(()=>{this.dragStart.emit(this.createDragInteractionEvent(t.gutterIndex)),this.draggedGutterIndex.set(t.gutterIndex)})}),R(([e])=>this.createDragStartContext(e,t.areaBeforeGutterIndex,t.areaAfterGutterIndex)),y(e=>ct(this.document).pipe(E(i=>this.mouseDragMove(i,e)),T(Y(this.document,!0)),E({complete:()=>this.ngZone.run(()=>{this.dragEnd.emit(this.createDragInteractionEvent(this.draggedGutterIndex())),this.draggedGutterIndex.set(void 0)})}))))),G()).subscribe(),A(this.elementRef.nativeElement,"transitionend").pipe(w(t=>t.propertyName.startsWith("grid-template")),ht(),G()).subscribe(()=>this.ngZone.run(()=>this.transitionEnd.emit(this.createAreaSizes())))}gutterClicked(t){this.ngZone.run(()=>this.gutterClick.emit(this.createDragInteractionEvent(t)))}gutterDoubleClicked(t){this.ngZone.run(()=>this.gutterDblClick.emit(this.createDragInteractionEvent(t)))}gutterMouseDown(t,e,i,s,a){t.preventDefault(),t.stopPropagation(),!this.disabled()&&this.gutterMouseDownSubject.next({mouseDownEvent:t,gutterElement:e,gutterIndex:i,areaBeforeGutterIndex:s,areaAfterGutterIndex:a})}gutterKeyDown(t,e,i,s){if(this.disabled())return;let a=50,u=10,d=0,l=0;if(this.direction()==="horizontal")switch(t.key){case"ArrowLeft":d-=a;break;case"ArrowRight":d+=a;break;case"PageUp":this.dir()==="rtl"?d-=a*u:d+=a*u;break;case"PageDown":this.dir()==="rtl"?d+=a*u:d-=a*u;break;default:return}else switch(t.key){case"ArrowUp":l-=a;break;case"ArrowDown":l+=a;break;case"PageUp":l-=a*u;break;case"PageDown":l+=a*u;break;default:return}t.preventDefault(),t.stopPropagation();let p=B(t),h=this.createDragStartContext(t,i,s);this.ngZone.run(()=>{this.dragStart.emit(this.createDragInteractionEvent(e)),this.draggedGutterIndex.set(e)}),this.dragMoveToPoint({x:p.x+d,y:p.y+l},h),this.ngZone.run(()=>{this.dragEnd.emit(this.createDragInteractionEvent(e)),this.draggedGutterIndex.set(void 0)})}getGutterGridStyle(t){let e=t*2,i=`${e} / ${e}`;return{"grid-column":this.direction()==="horizontal"?i:"1","grid-row":this.direction()==="vertical"?i:"1"}}getAriaAreaSizeText(t){let e=t._internalSize();if(e!=="*")return`${e.toFixed(0)} ${this.unit()}`}getAriaValue(t){return t==="*"?void 0:t}createDragInteractionEvent(t){return{gutterNum:t+1,sizes:this.createAreaSizes()}}createAreaSizes(){return this._visibleAreas().map(t=>t._internalSize())}createDragStartContext(t,e,i){let s=this.elementRef.nativeElement.getBoundingClientRect(),u=(this.direction()==="horizontal"?s.width:s.height)-(this._visibleAreas().length-1)*this.gutterSize(),d=this._areas().map(h=>{if(this.unit()==="pixel")return h._internalSize();{let _=h._internalSize();return _==="*"?_:_/100*u}}),l=Math.max(0,u-dt(d,h=>h==="*"?0:h)),p=d.map(h=>h==="*"?l:h);return{startEvent:t,areaBeforeGutterIndex:e,areaAfterGutterIndex:i,areasPixelSizes:p,totalAreasPixelSize:u,areaIndexToBoundaries:Te(this._areas(),(h,_)=>{let v=k=>k/100*u,b=this.unit()==="pixel"?{min:h._normalizedMinSize(),max:h._normalizedMaxSize()}:{min:v(h._normalizedMinSize()),max:v(h._normalizedMaxSize())};return[_.toString(),b]})}}mouseDragMove(t,e){t.preventDefault(),t.stopPropagation();let i=B(t);this.dragMoveToPoint(i,e)}dragMoveToPoint(t,e){let i=B(e.startEvent),s=this.direction()==="horizontal"?t.x-i.x:t.y-i.y,a=this.direction()==="horizontal"&&this.dir()==="rtl"?-s:s,u=a>0,d=Math.abs(Math.round(a/this.gutterStep())*this.gutterStep()),l=[...e.areasPixelSizes],p=l.map((m,C)=>C),h=this.restrictMove()?[e.areaBeforeGutterIndex]:p.slice(0,e.areaBeforeGutterIndex+1).filter(m=>this._areas()[m].visible()).reverse(),_=this.restrictMove()?[e.areaAfterGutterIndex]:p.slice(e.areaAfterGutterIndex).filter(m=>this._areas()[m].visible()),v=u?_:h,b=u?h:_,k=d,L=0,Q=0;for(;k!==0&&L<v.length&&Q<b.length;){let m=v[L],C=b[Q],Z=l[m],de=l[C],pt=e.areaIndexToBoundaries[m].min,mt=e.areaIndexToBoundaries[C].max,he=Z-pt,ge=mt-de,J=Math.min(he,ge,k);l[m]-=J,l[C]+=J,k-=J,l[m]===pt&&L++,l[C]===mt&&Q++}this._areas().forEach((m,C)=>{if(m._internalSize()!=="*")if(this.unit()==="pixel")m._internalSize.set(l[C]);else{let Z=l[C]/e.totalAreasPixelSize*100;m._internalSize.set(parseFloat(Z.toFixed(10)))}}),this.dragProgressSubject.next(this.createDragInteractionEvent(this.draggedGutterIndex()))}createGridTemplateColumnsStyle(){let t=[],e=dt(this._visibleAreas(),a=>{let u=a._internalSize();return u==="*"?0:u}),i=this._visibleAreas().length,s=0;return this._areas().forEach((a,u,d)=>{let l=this.unit(),p=a._internalSize();if(!a.visible())t.push(l==="percent"||p==="*"?"0fr":"0px");else{if(l==="pixel"){let v=p==="*"?"1fr":`${p}px`;t.push(v)}else{let b=`${p==="*"?100-e:p}fr`;t.push(b)}s++}if(u===d.length-1)return;let _=i-s;a.visible()&&_>0?t.push(`${this.gutterSize()}px`):t.push("0px")}),this.direction()==="horizontal"?`1fr / ${t.join(" ")}`:`${t.join(" ")} / 1fr`}createAlignedVisibleAreasSize(){let t=this._visibleAreas().map(s=>{let a=s.size();return a==="auto"?"*":a});if(se(this._visibleAreas(),this.unit(),!1))return t;let i=this.unit();if(i==="percent"){let s=100/t.length;return t.map(()=>s)}if(i==="pixel"){if(t.filter(a=>a==="*").length===0)return["*",...t.slice(1)];{let a=t.findIndex(d=>d==="*"),u=100;return t.map((d,l)=>l===a||d!=="*"?d:u)}}return Ee(i,"SplitUnit")}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=nt({type:r,selectors:[["as-split"]],contentQueries:function(e,i,s){e&1&&(ot(s,i._areas,gt,4),ot(s,i.customGutter,ne,5)),e&2&&Nt(2)},hostVars:3,hostBindings:function(e,i){e&2&&(Vt("dir",i.hostDirBinding),lt(i.hostClassesBinding))},inputs:{gutterSize:[1,"gutterSize"],gutterStep:[1,"gutterStep"],disabled:[1,"disabled"],gutterClickDeltaPx:[1,"gutterClickDeltaPx"],direction:[1,"direction"],dir:[1,"dir"],unit:[1,"unit"],gutterAriaLabel:[1,"gutterAriaLabel"],restrictMove:[1,"restrictMove"],useTransition:[1,"useTransition"],gutterDblClickDuration:[1,"gutterDblClickDuration"]},outputs:{gutterClick:"gutterClick",gutterDblClick:"gutterDblClick",dragStart:"dragStart",dragEnd:"dragEnd",transitionEnd:"transitionEnd"},exportAs:["asSplit"],ngContentSelectors:oe,decls:3,vars:0,consts:[["gutter",""],["role","separator","tabindex","0","asSplitCustomEventsBehavior","",1,"as-split-gutter",3,"ngStyle","as-dragged","asSplitCustomMultiClickThreshold","asSplitCustomClickDeltaInPx"],["role","separator","tabindex","0","asSplitCustomEventsBehavior","",1,"as-split-gutter",3,"asSplitCustomClick","asSplitCustomDblClick","asSplitCustomMouseDown","asSplitCustomKeyDown","ngStyle","asSplitCustomMultiClickThreshold","asSplitCustomClickDeltaInPx"],[1,"as-split-gutter-icon"],[4,"asSplitGutterDynamicInjector"],[4,"ngTemplateOutlet","ngTemplateOutletContext","ngTemplateOutletInjector"]],template:function(e,i){e&1&&(st(),at(0),Et(1,be,1,1,null,null,Tt)),e&2&&(O(),Pt(i._areas()))},dependencies:[ee,Pe,ye,ie],styles:['@property --as-gutter-background-color{syntax: "<color>"; inherits: true; initial-value: #eeeeee;}@property --as-gutter-icon-horizontal{syntax: "<url>"; inherits: true; initial-value: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==);}@property --as-gutter-icon-vertical{syntax: "<url>"; inherits: true; initial-value: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFCAMAAABl/6zIAAAABlBMVEUAAADMzMzIT8AyAAAAAXRSTlMAQObYZgAAABRJREFUeAFjYGRkwIMJSeMHlBkOABP7AEGzSuPKAAAAAElFTkSuQmCC);}@property --as-gutter-icon-disabled{syntax: "<url>"; inherits: true; initial-value: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==);}@property --as-transition-duration{syntax: "<time>"; inherits: true; initial-value: .3s;}@property --as-gutter-disabled-cursor{syntax: "*"; inherits: true; initial-value: default;}[_nghost-%COMP%]{--_as-gutter-background-color: var(--as-gutter-background-color, #eeeeee);--_as-gutter-icon-horizontal: var( --as-gutter-icon-horizontal, url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==) );--_as-gutter-icon-vertical: var( --as-gutter-icon-vertical, url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFCAMAAABl/6zIAAAABlBMVEUAAADMzMzIT8AyAAAAAXRSTlMAQObYZgAAABRJREFUeAFjYGRkwIMJSeMHlBkOABP7AEGzSuPKAAAAAElFTkSuQmCC) );--_as-gutter-icon-disabled: var( --as-gutter-icon-disabled, url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==) );--_as-transition-duration: var(--as-transition-duration, .3s);--_as-gutter-disabled-cursor: var(--as-gutter-disabled-cursor, default)}[_nghost-%COMP%]{display:grid;overflow:hidden;height:100%;width:100%}.as-transition[_nghost-%COMP%]{transition:grid-template var(--_as-transition-duration)}.as-split-gutter[_ngcontent-%COMP%]{background-color:var(--_as-gutter-background-color);display:flex;align-items:center;justify-content:center;touch-action:none}.as-horizontal[_nghost-%COMP%] > .as-split-gutter[_ngcontent-%COMP%]{cursor:col-resize;height:100%}.as-vertical[_nghost-%COMP%] > .as-split-gutter[_ngcontent-%COMP%]{cursor:row-resize;width:100%}.as-disabled[_nghost-%COMP%] > .as-split-gutter[_ngcontent-%COMP%]{cursor:var(--_as-gutter-disabled-cursor)}.as-split-gutter-icon[_ngcontent-%COMP%]{width:100%;height:100%;background-position:center center;background-repeat:no-repeat}.as-horizontal[_nghost-%COMP%] > .as-split-gutter[_ngcontent-%COMP%] > .as-split-gutter-icon[_ngcontent-%COMP%]{background-image:var(--_as-gutter-icon-horizontal)}.as-vertical[_nghost-%COMP%] > .as-split-gutter[_ngcontent-%COMP%] > .as-split-gutter-icon[_ngcontent-%COMP%]{background-image:var(--_as-gutter-icon-vertical)}.as-disabled[_nghost-%COMP%] > .as-split-gutter[_ngcontent-%COMP%] > .as-split-gutter-icon[_ngcontent-%COMP%]{background-image:var(--_as-gutter-icon-disabled)}'],changeDetection:0});let n=r;return n})(),ce=n=>n==null||n==="*"?"*":+n,Oe=n=>ce(n),ae=n=>ce(n),Qe=(()=>{let r=class r{constructor(){this.split=f(Ie),this.size=c("auto",{transform:Oe}),this.minSize=c("*",{transform:ae}),this.maxSize=c("*",{transform:ae}),this.lockSize=c(!1,{transform:D}),this.visible=c(!0,{transform:D}),this._internalSize=Ht(()=>{if(!this.visible())return 0;let t=this.split._visibleAreas().findIndex(e=>e===this);return this.split._alignedVisibleAreasSizes()[t]}),this._normalizedMinSize=S(()=>this.normalizeMinSize()),this._normalizedMaxSize=S(()=>this.normalizeMaxSize()),this.index=S(()=>this.split._areas().findIndex(t=>t===this)),this.gridAreaNum=S(()=>this.index()*2+1),this.hostClasses=S(()=>ue({"as-split-area":!0,"as-min":this.visible()&&this._internalSize()===this._normalizedMinSize(),"as-max":this.visible()&&this._internalSize()===this._normalizedMaxSize(),"as-hidden":!this.visible()}))}get hostClassesBinding(){return this.hostClasses()}get hostGridColumnStyleBinding(){return this.split.direction()==="horizontal"?`${this.gridAreaNum()} / ${this.gridAreaNum()}`:void 0}get hostGridRowStyleBinding(){return this.split.direction()==="vertical"?`${this.gridAreaNum()} / ${this.gridAreaNum()}`:void 0}get hostPositionStyleBinding(){return this.split._isDragging()?"relative":void 0}normalizeMinSize(){if(!this.visible())return 0;let e=this.normalizeSizeBoundary(this.minSize,0),i=this.size();return i!=="*"&&i!=="auto"&&i<e?(z()&&console.warn("as-split: size cannot be smaller than minSize"),0):e}normalizeMaxSize(){if(!this.visible())return 1/0;let e=this.normalizeSizeBoundary(this.maxSize,1/0),i=this.size();return i!=="*"&&i!=="auto"&&i>e?(z()&&console.warn("as-split: size cannot be larger than maxSize"),1/0):e}normalizeSizeBoundary(t,e){let i=this.size(),s=this.lockSize(),a=t();return s?(z()&&a!=="*"&&console.warn("as-split: lockSize overwrites maxSize/minSize"),i==="*"||i==="auto"?(z()&&console.warn("as-split: lockSize isn't supported on area with * size or without size"),e):i):a==="*"?e:i==="*"||i==="auto"?(z()&&console.warn("as-split: maxSize/minSize not allowed on * or without size"),e):a}};r.\u0275fac=function(e){return new(e||r)},r.\u0275cmp=nt({type:r,selectors:[["as-split-area"]],hostVars:8,hostBindings:function(e,i){e&2&&(lt(i.hostClassesBinding),Yt("grid-column",i.hostGridColumnStyleBinding)("grid-row",i.hostGridRowStyleBinding)("position",i.hostPositionStyleBinding))},inputs:{size:[1,"size"],minSize:[1,"minSize"],maxSize:[1,"maxSize"],lockSize:[1,"lockSize"],visible:[1,"visible"]},exportAs:["asSplitArea"],features:[Qt([{provide:gt,useExisting:r}])],ngContentSelectors:oe,decls:2,vars:1,consts:[[1,"as-iframe-fix"]],template:function(e,i){e&1&&(st(),at(0),V(1,Me,1,0,"div",0)),e&2&&(O(),j(i.split._isDragging()?1:-1))},styles:["[_nghost-%COMP%]{overflow-x:hidden;overflow-y:auto}.as-horizontal > [_nghost-%COMP%]{height:100%}.as-vertical > [_nghost-%COMP%]{width:100%}.as-iframe-fix[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:100%}"],changeDetection:0});let n=r;return n})(),Ze=(()=>{let r=class r{};r.\u0275fac=function(e){return new(e||r)},r.\u0275mod=wt({type:r}),r.\u0275inj=bt({});let n=r;return n})()});export{Ie as a,Qe as b,Ze as c,Ge as d};
|