@vef-framework-react/approval-form-bridge 2.19.0 → 2.21.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/dist/cjs/project.cjs +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/issues.js +1 -1
- package/dist/es/project.js +16 -16
- package/dist/es/registry.js +1 -1
- package/dist/es/validate.js +1 -1
- package/dist/types/contract.d.ts +36 -1
- package/package.json +3 -3
package/dist/cjs/project.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./issues.cjs");let t=require("@vef-framework-react/form-editor");var n={textfield:`input`,"code-editor":`textarea`,textarea:`textarea`,number:`number`,select:`select`,radio:`select`,"checkbox-group":`select`,date:`date`,datetime:`date`,upload:`upload`},r=new Set([`switch`,`daterange`]);function i(n){let r=[],i=[],u=[],d=new Map((n.dataSources??[]).map(e=>[e.id,e])),f=new Map;for(let p of[n.presentations.pc,n.presentations.mobile])p!==void 0&&(0,t.walkNodes)(p,(n,m)=>{if(m.length>0||!(0,t.isKeyedNode)(n))return;let g=f.get(n.key),_=a(n);if(_!==void 0){g!==null&&(r.push(_),f.set(n.key,null));return}if(g!==void 0){if(g!==null){let t=o(n);t!==null&&t!==g.kind?r.push(e.issueCrossDeviceKindMismatch(n.key,g.kind,t)):t===`table`&&g.tableSignature!==void 0&&s(n)!==g.tableSignature&&r.push(e.issueCrossDeviceTableMismatch(n.key))}return}let v=n.type===`subform`,y=v?l(n,d,r):c(n,n.key,d,r);f.set(n.key,y===void 0?null:{kind:y.approval.kind,...v&&{tableSignature:s(n)}}),y!==void 0&&(i.push({...y.approval,sortOrder:i.length}),u.push(h(p,n)?{...y.flow,hasConditionalVisibility:!0}:y.flow))});return{fields:i,formFields:u,issues:r,valid:r.every(e=>e.severity!==`error`)}}function a(t){if(!(t.type===`subform`||n[t.type]!==void 0))return r.has(t.type)?e.issueUnmappableFieldType(t.key,t.type):e.issueUnknownFieldType(t.key,t.type)}function o(e){return e.type===`subform`?`table`:n[e.type]??null}function s(e){let r=[],i=new Set;return(0,t.walkNodes)({children:e.template},(e,a)=>{a.length>0||!(0,t.isKeyedNode)(e)||i.has(e.key)||(i.add(e.key),r.push(`${e.key}:${e.type===`subform`?`table`:n[e.type]??`?`}`))}),r.join(`,`)}function c(t,i,a,o){let s=n[t.type];if(s===void 0){o.push(r.has(t.type)?e.issueUnmappableFieldType(i,t.type):e.issueUnknownFieldType(i,t.type));return}m(t,i,o);let c=t.label??t.key,l=u(t,i,a,o),{isRequired:
|
|
1
|
+
const e=require("./issues.cjs");let t=require("@vef-framework-react/form-editor");var n={textfield:`input`,"code-editor":`textarea`,textarea:`textarea`,number:`number`,select:`select`,radio:`select`,"checkbox-group":`select`,date:`date`,datetime:`date`,upload:`upload`},r=new Set([`switch`,`daterange`]);function i(n){let r=[],i=[],u=[],d=new Map((n.dataSources??[]).map(e=>[e.id,e])),f=new Map;for(let p of[n.presentations.pc,n.presentations.mobile])p!==void 0&&(0,t.walkNodes)(p,(n,m)=>{if(m.length>0||!(0,t.isKeyedNode)(n))return;let g=f.get(n.key),_=a(n);if(_!==void 0){g!==null&&(r.push(_),f.set(n.key,null));return}if(g!==void 0){if(g!==null){let t=o(n);t!==null&&t!==g.kind?r.push(e.issueCrossDeviceKindMismatch(n.key,g.kind,t)):t===`table`&&g.tableSignature!==void 0&&s(n)!==g.tableSignature&&r.push(e.issueCrossDeviceTableMismatch(n.key))}return}let v=n.type===`subform`,y=v?l(n,d,r):c(n,n.key,d,r);f.set(n.key,y===void 0?null:{kind:y.approval.kind,...v&&{tableSignature:s(n)}}),y!==void 0&&(i.push({...y.approval,sortOrder:i.length}),u.push(h(p,n)?{...y.flow,hasConditionalVisibility:!0}:y.flow))});return{fields:i,formFields:u,issues:r,valid:r.every(e=>e.severity!==`error`)}}function a(t){if(!(t.type===`subform`||n[t.type]!==void 0))return r.has(t.type)?e.issueUnmappableFieldType(t.key,t.type):e.issueUnknownFieldType(t.key,t.type)}function o(e){return e.type===`subform`?`table`:n[e.type]??null}function s(e){let r=[],i=new Set;return(0,t.walkNodes)({children:e.template},(e,a)=>{a.length>0||!(0,t.isKeyedNode)(e)||i.has(e.key)||(i.add(e.key),r.push(`${e.key}:${e.type===`subform`?`table`:n[e.type]??`?`}`))}),r.join(`,`)}function c(t,i,a,o){let s=n[t.type];if(s===void 0){o.push(r.has(t.type)?e.issueUnmappableFieldType(i,t.type):e.issueUnknownFieldType(i,t.type));return}m(t,i,o);let c=t.label??t.key,{options:l,optionSource:h}=u(t,i,a,o),{isRequired:g,rule:_}=p(t),v=d(t),{precision:y}=t,{placeholder:b}=t,x=y!==void 0&&y>0;return _?.pattern!==void 0&&f(_.pattern)&&o.push(e.issuePatternUnsupported(i)),v===`decimal`&&!x&&o.push(e.issueDecimalScaleMissing(i)),{approval:{key:t.key,kind:s,label:c,...b!==void 0&&{placeholder:b},...g&&{isRequired:g},...l!==void 0&&{options:l},...h!==void 0&&{optionSource:h},..._!==void 0&&{validation:_},...v!==void 0&&{columnType:v},...v===`decimal`&&x&&{scale:y}},flow:{key:t.key,kind:s,label:c,...l!==void 0&&{options:l}}}}function l(n,r,i){let a=[],o=[],s=new Set,l=!1;if((0,t.walkNodes)({children:n.template},(u,d)=>{if(d.length>0||!(0,t.isKeyedNode)(u)||s.has(u.key))return;if(s.add(u.key),u.type===`subform`){l=!0,i.push(e.issueNestedSubform(`${n.key}.${u.key}`));return}let f=c(u,`${n.key}.${u.key}`,r,i);f!==void 0&&(a.push({...f.approval,sortOrder:a.length}),o.push(f.flow))}),a.length===0){l||i.push(e.issueTableColumnsEmpty(n.key));return}m(n,n.key,i);let u=n.label??n.key,d=(n.minRows??0)>=1,f={...n.minRows!==void 0&&n.minRows>0&&{minLength:n.minRows},...n.maxRows!==void 0&&{maxLength:n.maxRows}},p=f.minLength!==void 0||f.maxLength!==void 0;return{approval:{key:n.key,kind:`table`,label:u,...d&&{isRequired:d},...p&&{validation:f},columns:a},flow:{key:n.key,kind:`table`,label:u,columns:o}}}function u(t,n,r,i){let a=t.dataSource;if(a===void 0)return{};let o=a.kind===`ref`?r.get(a.dataSourceId):a;return o?.kind===`static`?{options:o.options}:(i.push(e.issueOptionsNotStatic(n)),o?.kind===`remote`?{optionSource:{kind:`remote`,...o.request!==void 0&&{request:o.request},...o.mapping!==void 0&&{mapping:o.mapping}}}:{})}function d(e){if(e.columnType!==void 0)return e.columnType;let n=(0,t.inferColumnType)(e);return e.type===`number`&&n===`integer`?void 0:n}function f(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];if(r===`\\`){let r=e[n+1];if(!t&&r!==void 0&&r>=`1`&&r<=`9`)return!0;n++;continue}if(r===`[`){t=!0;continue}if(r===`]`){t=!1;continue}if(!t&&r===`(`&&e[n+1]===`?`){let t=e.slice(n+2);if(t.startsWith(`=`)||t.startsWith(`!`)||t.startsWith(`<=`)||t.startsWith(`<!`))return!0}}return!1}function p(e){let{required:t,...n}=e.validate??{},r=Object.entries(n).filter(([,e])=>e!==void 0);return{isRequired:t===!0,...r.length>0&&{rule:Object.fromEntries(r)}}}function m(t,n,r){let{linkage:i}=t;i!==void 0&&(i.defaults!==void 0||(i.rules?.length??0)>0)&&r.push(e.issueLinkageNotProjected(n))}function h(e,n){if(g(n.linkage))return!0;for(let r=(0,t.findParentContainer)(e,n.id);r!==void 0;r=(0,t.findParentContainer)(e,r.id))if(g(r.linkage))return!0;return!1}function g(e){return e===void 0?!1:e.defaults?.hidden===!0?!0:(e.rules??[]).some(e=>e.actions.some(e=>e.type===`hide`||e.type===`show`||e.type===`script`))}exports.projectFormSchema=i;
|
package/dist/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/approval-form-bridge v2.
|
|
1
|
+
/*! @vef-framework-react/approval-form-bridge v2.21.0 made by Venus | 2026-09-14T13:40:17.883Z */
|
|
2
2
|
import { projectFormSchema as e } from "./project.js";
|
|
3
3
|
import { APPROVAL_EXCLUDED_FIELD_TYPES as t, createApprovalRegistries as n } from "./registry.js";
|
|
4
4
|
import { validateApprovalSchema as r } from "./validate.js";
|
package/dist/es/issues.js
CHANGED
package/dist/es/project.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/approval-form-bridge v2.
|
|
1
|
+
/*! @vef-framework-react/approval-form-bridge v2.21.0 made by Venus | 2026-09-14T13:40:17.883Z */
|
|
2
2
|
import { issueCrossDeviceKindMismatch as e, issueCrossDeviceTableMismatch as t, issueDecimalScaleMissing as n, issueLinkageNotProjected as r, issueNestedSubform as i, issueOptionsNotStatic as a, issuePatternUnsupported as o, issueTableColumnsEmpty as s, issueUnknownFieldType as c, issueUnmappableFieldType as l } from "./issues.js";
|
|
3
3
|
import { findParentContainer as u, inferColumnType as d, isKeyedNode as f, walkNodes as p } from "@vef-framework-react/form-editor";
|
|
4
4
|
//#region src/project.ts
|
|
@@ -68,18 +68,19 @@ function b(e, t, r, i) {
|
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
E(e, t, i);
|
|
71
|
-
let s = e.label ?? e.key, u = S(e, t, r, i), { isRequired:
|
|
72
|
-
return
|
|
71
|
+
let s = e.label ?? e.key, { options: u, optionSource: d } = S(e, t, r, i), { isRequired: f, rule: p } = T(e), g = C(e), { precision: _ } = e, { placeholder: v } = e, y = _ !== void 0 && _ > 0;
|
|
72
|
+
return p?.pattern !== void 0 && w(p.pattern) && i.push(o(t)), g === "decimal" && !y && i.push(n(t)), {
|
|
73
73
|
approval: {
|
|
74
74
|
key: e.key,
|
|
75
75
|
kind: a,
|
|
76
76
|
label: s,
|
|
77
|
-
...
|
|
78
|
-
...
|
|
77
|
+
...v !== void 0 && { placeholder: v },
|
|
78
|
+
...f && { isRequired: f },
|
|
79
79
|
...u !== void 0 && { options: u },
|
|
80
|
-
...
|
|
81
|
-
...p !== void 0 && {
|
|
82
|
-
...
|
|
80
|
+
...d !== void 0 && { optionSource: d },
|
|
81
|
+
...p !== void 0 && { validation: p },
|
|
82
|
+
...g !== void 0 && { columnType: g },
|
|
83
|
+
...g === "decimal" && y && { scale: _ }
|
|
83
84
|
},
|
|
84
85
|
flow: {
|
|
85
86
|
key: e.key,
|
|
@@ -130,14 +131,13 @@ function x(e, t, n) {
|
|
|
130
131
|
}
|
|
131
132
|
function S(e, t, n, r) {
|
|
132
133
|
let i = e.dataSource;
|
|
133
|
-
if (i
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
}
|
|
134
|
+
if (i === void 0) return {};
|
|
135
|
+
let o = i.kind === "ref" ? n.get(i.dataSourceId) : i;
|
|
136
|
+
return o?.kind === "static" ? { options: o.options } : (r.push(a(t)), o?.kind === "remote" ? { optionSource: {
|
|
137
|
+
kind: "remote",
|
|
138
|
+
...o.request !== void 0 && { request: o.request },
|
|
139
|
+
...o.mapping !== void 0 && { mapping: o.mapping }
|
|
140
|
+
} } : {});
|
|
141
141
|
}
|
|
142
142
|
function C(e) {
|
|
143
143
|
if (e.columnType !== void 0) return e.columnType;
|
package/dist/es/registry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/approval-form-bridge v2.
|
|
1
|
+
/*! @vef-framework-react/approval-form-bridge v2.21.0 made by Venus | 2026-09-14T13:40:17.883Z */
|
|
2
2
|
import { createDefaultMobileRegistry as e, createDefaultRegistry as t } from "@vef-framework-react/form-editor";
|
|
3
3
|
//#region src/registry.ts
|
|
4
4
|
var n = [
|
package/dist/es/validate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/approval-form-bridge v2.
|
|
1
|
+
/*! @vef-framework-react/approval-form-bridge v2.21.0 made by Venus | 2026-09-14T13:40:17.883Z */
|
|
2
2
|
import { projectFormSchema as e } from "./project.js";
|
|
3
3
|
import { validateSchema as t } from "@vef-framework-react/form-editor";
|
|
4
4
|
//#region src/validate.ts
|
package/dist/types/contract.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColumnDataType } from '@vef-framework-react/form-editor';
|
|
1
|
+
import { ColumnDataType, RemoteDataSourceRequest, RemoteOptionMapping } from '@vef-framework-react/form-editor';
|
|
2
2
|
/**
|
|
3
3
|
* Field kind stored by the approval backend (`approval/form_field.go`
|
|
4
4
|
* `FieldKind` / `approval/enums.go`). The Go enum is the source of truth;
|
|
@@ -28,6 +28,34 @@ export interface ApprovalValidationRule {
|
|
|
28
28
|
pattern?: string;
|
|
29
29
|
message?: string;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Where a selection field's options come from, when the projection could not
|
|
33
|
+
* enumerate them into `options`. Mirrors the Go backend's `FieldOptionSource`.
|
|
34
|
+
*
|
|
35
|
+
* The designer's source union also carries `static` and `ref`, but neither
|
|
36
|
+
* survives projection: a static source — inline or reached through a `ref` — is
|
|
37
|
+
* enumerated into `options`, and a `ref` is dereferenced to whatever it points
|
|
38
|
+
* at. Only a source that stays unresolved is emitted here, so this vocabulary is
|
|
39
|
+
* deliberately narrower than the designer's.
|
|
40
|
+
*/
|
|
41
|
+
export type ApprovalOptionSourceKind = "remote";
|
|
42
|
+
/**
|
|
43
|
+
* A remote option source, post-dereference: a consumer never chases a
|
|
44
|
+
* `dataSourceId`. `request` and `mapping` reuse the form-editor's own types,
|
|
45
|
+
* which the Go `RemoteOptionRequest` / `RemoteOptionMapping` mirror field for
|
|
46
|
+
* field — including `request.params`, carried UNEVALUATED (each parameter a
|
|
47
|
+
* literal or an expression bound to the live form), because neither the backend
|
|
48
|
+
* nor a list-rendering consumer holds the form values an expression reads.
|
|
49
|
+
*
|
|
50
|
+
* `request` is optional only because the projector emits a source whose request
|
|
51
|
+
* the designer left unset rather than silently dropping it; the Go deploy
|
|
52
|
+
* validation rejects that document, so a deployed version always carries one.
|
|
53
|
+
*/
|
|
54
|
+
export interface ApprovalFieldOptionSource {
|
|
55
|
+
kind: ApprovalOptionSourceKind;
|
|
56
|
+
request?: RemoteDataSourceRequest;
|
|
57
|
+
mapping?: RemoteOptionMapping;
|
|
58
|
+
}
|
|
31
59
|
/**
|
|
32
60
|
* A single form field flattened to the Go backend's `FormFieldDefinition`
|
|
33
61
|
* (`approval/form_field.go`). The contract's top-level artifact is a bare
|
|
@@ -48,6 +76,13 @@ export interface ApprovalFormField {
|
|
|
48
76
|
defaultValue?: unknown;
|
|
49
77
|
isRequired?: boolean;
|
|
50
78
|
options?: ApprovalFieldOption[];
|
|
79
|
+
/**
|
|
80
|
+
* Where the options come from when they could not be enumerated into
|
|
81
|
+
* `options`. The backend never resolves it — select validation reads
|
|
82
|
+
* `options` and accepts any value when there are none — so it exists for
|
|
83
|
+
* consumers that must render a stored value as its label.
|
|
84
|
+
*/
|
|
85
|
+
optionSource?: ApprovalFieldOptionSource;
|
|
51
86
|
validation?: ApprovalValidationRule;
|
|
52
87
|
props?: Record<string, unknown>;
|
|
53
88
|
sortOrder: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vef-framework-react/approval-form-bridge",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Projection bridge from form-editor schemas to the approval form contract",
|
|
6
6
|
"keywords": [
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"dist"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@vef-framework-react/approval-flow-editor": "2.
|
|
44
|
-
"@vef-framework-react/form-editor": "2.
|
|
43
|
+
"@vef-framework-react/approval-flow-editor": "2.21.0",
|
|
44
|
+
"@vef-framework-react/form-editor": "2.21.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"react": "^19.2.7"
|