bank20baht-ui 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/dist/chunks/{index-yULskrKT.js → index-HK6XwOZe.js} +178 -136
- package/dist/components/baht-form.d.ts +2 -2
- package/dist/components/baht-workflow.d.ts +4 -4
- package/dist/components/primitives/baht-datepicker.d.ts +6 -6
- package/dist/components/primitives/baht-file.d.ts +2 -2
- package/dist/components/primitives/baht-keyvalue-editor.d.ts +1 -1
- package/dist/core/dates.d.ts +1 -1
- package/dist/core/display.d.ts +1 -1
- package/dist/core/engine/graph.d.ts +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/legacy.d.ts +14 -0
- package/dist/core/types.d.ts +27 -27
- package/dist/custom-elements.json +14 -14
- package/dist/engine.js +21 -19
- package/dist/index.js +248 -232
- package/dist/vscode.html-custom-data.json +3 -3
- package/dist/web-types.json +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,9 +19,9 @@ npm i bank20baht-ui
|
|
|
19
19
|
<script>
|
|
20
20
|
const el = document.getElementById('f');
|
|
21
21
|
el.form = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
form_id: 'f1',
|
|
23
|
+
form_name: 'Person',
|
|
24
|
+
fields: [
|
|
25
25
|
{ order: 1, type: 'text', key: 'firstName', label: 'First name', width: '1/2', required: true, value: '' },
|
|
26
26
|
{ order: 2, type: 'text', key: 'lastName', label: 'Last name', width: '1/2', required: true, value: '' },
|
|
27
27
|
{ order: 3, type: 'number', key: 'age', label: 'Age', width: '1/4', min: 0, value: null }
|
|
@@ -63,7 +63,7 @@ gives you the same formatting for tables.
|
|
|
63
63
|
### Repeater — line items / repeating rows
|
|
64
64
|
|
|
65
65
|
```js
|
|
66
|
-
{ order: 5, type: 'repeater', key: 'items', label: 'Line items',
|
|
66
|
+
{ order: 5, type: 'repeater', key: 'items', label: 'Line items', min_rows: 1,
|
|
67
67
|
fields: [
|
|
68
68
|
{ order: 1, type: 'text', key: 'name', width: '1/2', required: true },
|
|
69
69
|
{ order: 2, type: 'number', key: 'qty', width: '1/4', min: 1 },
|
|
@@ -71,14 +71,14 @@ gives you the same formatting for tables.
|
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
Value is an array of row objects (`getData().items → [{ name, qty }, …]`). Rows add/remove in
|
|
74
|
-
the UI (`
|
|
74
|
+
the UI (`min_rows`/`max_rows` bound the count), each row validates its sub-fields — errors come
|
|
75
75
|
back as `items[0].name`, on both the client and `bank20baht-validator`. One level deep only.
|
|
76
76
|
|
|
77
77
|
### Dependent / async dropdowns
|
|
78
78
|
|
|
79
79
|
```js
|
|
80
80
|
// schema — functions never live in JSON, only registry names:
|
|
81
|
-
{ order: 2, type: 'dropdown', key: 'amphoe',
|
|
81
|
+
{ order: 2, type: 'dropdown', key: 'amphoe', options_from: 'amphoeFor', options_deps: ['province'] }
|
|
82
82
|
|
|
83
83
|
// registry:
|
|
84
84
|
el.registry = {
|
|
@@ -119,7 +119,7 @@ with the same JSON — `bank20baht-validator` re-exports `applyFlags`.
|
|
|
119
119
|
|
|
120
120
|
```js
|
|
121
121
|
// schema:
|
|
122
|
-
{ order: 6, type: 'file', key: 'doc', uploader: 'default', accept: '.pdf,image/*',
|
|
122
|
+
{ order: 6, type: 'file', key: 'doc', uploader: 'default', accept: '.pdf,image/*', max_size: 10_485_760 }
|
|
123
123
|
|
|
124
124
|
// registry — File in, serializable ref out:
|
|
125
125
|
el.registry = {
|
|
@@ -131,7 +131,7 @@ el.registry = {
|
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
Picking a file uploads immediately; the value becomes `{ name, size, type, url }` — plain
|
|
134
|
-
JSON, chips with remove buttons in the UI, `
|
|
134
|
+
JSON, chips with remove buttons in the UI, `max_size`/`accept` validated on both client and
|
|
135
135
|
server. Omit `uploader` for the old capture-only mode.
|
|
136
136
|
|
|
137
137
|
### Drafts / autosave (host pattern)
|
|
@@ -160,7 +160,7 @@ setLocale('th', { required: 'ห้ามว่าง' }); // locale + your own
|
|
|
160
160
|
```
|
|
161
161
|
|
|
162
162
|
Call it once before mounting. Per-field `message` and label attributes
|
|
163
|
-
(`next-label`, `approval.
|
|
163
|
+
(`next-label`, `approval.approve_label`, …) still win over the catalog. The server can
|
|
164
164
|
localize too: `bank20baht-validator` re-exports `setLocale`, so validation issues come
|
|
165
165
|
back in the same language the client shows.
|
|
166
166
|
|
|
@@ -168,8 +168,8 @@ back in the same language the client shows.
|
|
|
168
168
|
|
|
169
169
|
```js
|
|
170
170
|
document.querySelector('baht-workflow').workflow = {
|
|
171
|
-
|
|
172
|
-
forms: [/* {
|
|
171
|
+
workflow_id: 'wf-1',
|
|
172
|
+
forms: [/* {form_id, form_name, order, fields}, ... */],
|
|
173
173
|
rules: [
|
|
174
174
|
{ id: 'skip-person',
|
|
175
175
|
when: { field: 'Intro.kind', op: 'eq', value: 'company' },
|
|
@@ -319,7 +319,7 @@ vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.startsWith('b
|
|
|
319
319
|
file (capture only, no upload) · label (static)`
|
|
320
320
|
|
|
321
321
|
Each field descriptor: `{ order, type, key, label, placeholder, width: '1/4'|'1/2'|'3/4'|'full',
|
|
322
|
-
value, disabled, required, options,
|
|
322
|
+
value, disabled, required, options, max_length, min, max, validators[], formatter }`.
|
|
323
323
|
|
|
324
324
|
## Visual Builder
|
|
325
325
|
|