@multiplatform.one/frappe-ui 7.6.3 → 7.7.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/ChartCard.cjs +52 -0
- package/dist/cjs/ChartCard.native.js +72 -0
- package/dist/cjs/ChartCard.native.js.map +1 -0
- package/dist/cjs/FrappeChartCard.cjs +3 -3
- package/dist/cjs/FrappeChartCard.native.js +3 -3
- package/dist/cjs/FrappeChartCard.native.js.map +1 -1
- package/dist/cjs/FrappeDashboard.cjs +6 -27
- package/dist/cjs/FrappeDashboard.native.js +6 -33
- package/dist/cjs/FrappeDashboard.native.js.map +1 -1
- package/dist/cjs/fields/CodeEditor/index.cjs +4 -0
- package/dist/cjs/fields/CodeEditor/index.native.js +4 -0
- package/dist/cjs/fields/CodeEditor/index.native.js.map +1 -1
- package/dist/cjs/formEngine/createPrefill.cjs +37 -0
- package/dist/cjs/formEngine/createPrefill.native.js +40 -0
- package/dist/cjs/formEngine/createPrefill.native.js.map +1 -0
- package/dist/cjs/formEngine/dirtyTracking.cjs +55 -0
- package/dist/cjs/formEngine/dirtyTracking.native.js +77 -0
- package/dist/cjs/formEngine/dirtyTracking.native.js.map +1 -0
- package/dist/cjs/formEngine/doctypeMeta.cjs +18 -0
- package/dist/cjs/formEngine/doctypeMeta.native.js +21 -0
- package/dist/cjs/formEngine/doctypeMeta.native.js.map +1 -0
- package/dist/cjs/formEngine/fetchFrom.cjs +67 -0
- package/dist/cjs/formEngine/fetchFrom.native.js +110 -0
- package/dist/cjs/formEngine/fetchFrom.native.js.map +1 -0
- package/dist/cjs/formEngine/fieldPermissions.cjs +55 -0
- package/dist/cjs/formEngine/fieldPermissions.native.js +80 -0
- package/dist/cjs/formEngine/fieldPermissions.native.js.map +1 -0
- package/dist/cjs/formEngine/formActions.cjs +189 -0
- package/dist/cjs/formEngine/formActions.native.js +199 -0
- package/dist/cjs/formEngine/formActions.native.js.map +1 -0
- package/dist/cjs/formEngine/formLayout.cjs +245 -0
- package/dist/cjs/formEngine/formLayout.native.js +388 -0
- package/dist/cjs/formEngine/formLayout.native.js.map +1 -0
- package/dist/cjs/formEngine/index.cjs +48 -0
- package/dist/cjs/formEngine/index.native.js +51 -0
- package/dist/cjs/formEngine/index.native.js.map +1 -0
- package/dist/cjs/formEngine/useFormEngine.cjs +387 -0
- package/dist/cjs/formEngine/useFormEngine.native.js +476 -0
- package/dist/cjs/formEngine/useFormEngine.native.js.map +1 -0
- package/dist/cjs/index.cjs +19 -1
- package/dist/cjs/index.native.js +19 -1
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/ChartCard.mjs +27 -0
- package/dist/esm/ChartCard.mjs.map +1 -0
- package/dist/esm/ChartCard.native.js +33 -0
- package/dist/esm/ChartCard.native.js.map +1 -0
- package/dist/esm/FrappeChartCard.mjs +1 -1
- package/dist/esm/FrappeChartCard.native.js +1 -1
- package/dist/esm/FrappeChartCard.native.js.map +1 -1
- package/dist/esm/FrappeDashboard.mjs +6 -27
- package/dist/esm/FrappeDashboard.mjs.map +1 -1
- package/dist/esm/FrappeDashboard.native.js +6 -33
- package/dist/esm/FrappeDashboard.native.js.map +1 -1
- package/dist/esm/fields/CodeEditor/index.mjs +4 -0
- package/dist/esm/fields/CodeEditor/index.mjs.map +1 -1
- package/dist/esm/fields/CodeEditor/index.native.js +4 -0
- package/dist/esm/fields/CodeEditor/index.native.js.map +1 -1
- package/dist/esm/formEngine/createPrefill.mjs +11 -0
- package/dist/esm/formEngine/createPrefill.mjs.map +1 -0
- package/dist/esm/formEngine/createPrefill.native.js +11 -0
- package/dist/esm/formEngine/createPrefill.native.js.map +1 -0
- package/dist/esm/formEngine/dirtyTracking.mjs +28 -0
- package/dist/esm/formEngine/dirtyTracking.mjs.map +1 -0
- package/dist/esm/formEngine/dirtyTracking.native.js +47 -0
- package/dist/esm/formEngine/dirtyTracking.native.js.map +1 -0
- package/dist/esm/formEngine/doctypeMeta.mjs +2 -0
- package/dist/esm/formEngine/doctypeMeta.mjs.map +1 -0
- package/dist/esm/formEngine/doctypeMeta.native.js +2 -0
- package/dist/esm/formEngine/doctypeMeta.native.js.map +1 -0
- package/dist/esm/formEngine/fetchFrom.mjs +40 -0
- package/dist/esm/formEngine/fetchFrom.mjs.map +1 -0
- package/dist/esm/formEngine/fetchFrom.native.js +80 -0
- package/dist/esm/formEngine/fetchFrom.native.js.map +1 -0
- package/dist/esm/formEngine/fieldPermissions.mjs +28 -0
- package/dist/esm/formEngine/fieldPermissions.mjs.map +1 -0
- package/dist/esm/formEngine/fieldPermissions.native.js +50 -0
- package/dist/esm/formEngine/fieldPermissions.native.js.map +1 -0
- package/dist/esm/formEngine/formActions.mjs +146 -0
- package/dist/esm/formEngine/formActions.mjs.map +1 -0
- package/dist/esm/formEngine/formActions.native.js +153 -0
- package/dist/esm/formEngine/formActions.native.js.map +1 -0
- package/dist/esm/formEngine/formLayout.mjs +217 -0
- package/dist/esm/formEngine/formLayout.mjs.map +1 -0
- package/dist/esm/formEngine/formLayout.native.js +357 -0
- package/dist/esm/formEngine/formLayout.native.js.map +1 -0
- package/dist/esm/formEngine/index.mjs +8 -0
- package/dist/esm/formEngine/index.mjs.map +1 -0
- package/dist/esm/formEngine/index.native.js +8 -0
- package/dist/esm/formEngine/index.native.js.map +1 -0
- package/dist/esm/formEngine/useFormEngine.mjs +362 -0
- package/dist/esm/formEngine/useFormEngine.mjs.map +1 -0
- package/dist/esm/formEngine/useFormEngine.native.js +448 -0
- package/dist/esm/formEngine/useFormEngine.native.js.map +1 -0
- package/dist/esm/index.mjs +4 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +4 -2
- package/dist/esm/index.native.js.map +1 -1
- package/dist/jsx/ChartCard.mjs +27 -0
- package/dist/jsx/ChartCard.mjs.map +1 -0
- package/dist/jsx/ChartCard.native.js +72 -0
- package/dist/jsx/ChartCard.native.js.map +1 -0
- package/dist/jsx/FrappeChartCard.mjs +1 -1
- package/dist/jsx/FrappeChartCard.native.js +3 -3
- package/dist/jsx/FrappeChartCard.native.js.map +1 -1
- package/dist/jsx/FrappeDashboard.mjs +6 -27
- package/dist/jsx/FrappeDashboard.mjs.map +1 -1
- package/dist/jsx/FrappeDashboard.native.js +6 -33
- package/dist/jsx/FrappeDashboard.native.js.map +1 -1
- package/dist/jsx/fields/CodeEditor/index.mjs +4 -0
- package/dist/jsx/fields/CodeEditor/index.mjs.map +1 -1
- package/dist/jsx/fields/CodeEditor/index.native.js +4 -0
- package/dist/jsx/fields/CodeEditor/index.native.js.map +1 -1
- package/dist/jsx/formEngine/createPrefill.mjs +11 -0
- package/dist/jsx/formEngine/createPrefill.mjs.map +1 -0
- package/dist/jsx/formEngine/createPrefill.native.js +40 -0
- package/dist/jsx/formEngine/createPrefill.native.js.map +1 -0
- package/dist/jsx/formEngine/dirtyTracking.mjs +28 -0
- package/dist/jsx/formEngine/dirtyTracking.mjs.map +1 -0
- package/dist/jsx/formEngine/dirtyTracking.native.js +77 -0
- package/dist/jsx/formEngine/dirtyTracking.native.js.map +1 -0
- package/dist/jsx/formEngine/doctypeMeta.mjs +2 -0
- package/dist/jsx/formEngine/doctypeMeta.mjs.map +1 -0
- package/dist/jsx/formEngine/doctypeMeta.native.js +21 -0
- package/dist/jsx/formEngine/doctypeMeta.native.js.map +1 -0
- package/dist/jsx/formEngine/fetchFrom.mjs +40 -0
- package/dist/jsx/formEngine/fetchFrom.mjs.map +1 -0
- package/dist/jsx/formEngine/fetchFrom.native.js +110 -0
- package/dist/jsx/formEngine/fetchFrom.native.js.map +1 -0
- package/dist/jsx/formEngine/fieldPermissions.mjs +28 -0
- package/dist/jsx/formEngine/fieldPermissions.mjs.map +1 -0
- package/dist/jsx/formEngine/fieldPermissions.native.js +80 -0
- package/dist/jsx/formEngine/fieldPermissions.native.js.map +1 -0
- package/dist/jsx/formEngine/formActions.mjs +146 -0
- package/dist/jsx/formEngine/formActions.mjs.map +1 -0
- package/dist/jsx/formEngine/formActions.native.js +199 -0
- package/dist/jsx/formEngine/formActions.native.js.map +1 -0
- package/dist/jsx/formEngine/formLayout.mjs +217 -0
- package/dist/jsx/formEngine/formLayout.mjs.map +1 -0
- package/dist/jsx/formEngine/formLayout.native.js +388 -0
- package/dist/jsx/formEngine/formLayout.native.js.map +1 -0
- package/dist/jsx/formEngine/index.mjs +8 -0
- package/dist/jsx/formEngine/index.mjs.map +1 -0
- package/dist/jsx/formEngine/index.native.js +51 -0
- package/dist/jsx/formEngine/index.native.js.map +1 -0
- package/dist/jsx/formEngine/useFormEngine.mjs +362 -0
- package/dist/jsx/formEngine/useFormEngine.mjs.map +1 -0
- package/dist/jsx/formEngine/useFormEngine.native.js +476 -0
- package/dist/jsx/formEngine/useFormEngine.native.js.map +1 -0
- package/dist/jsx/index.js +4 -2
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +4 -2
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +19 -1
- package/dist/jsx/index.native.js.map +1 -1
- package/package.json +23 -17
- package/src/ChartCard.tsx +31 -0
- package/src/FileBrowser/FileBrowser.spec.tsx +16 -0
- package/src/FileBrowser/FileBrowser.stories.tsx +18 -1
- package/src/FileBrowser/folderTree.spec.tsx +68 -0
- package/src/FrappeCalendar.stories.tsx +1 -2
- package/src/FrappeChartCard.stories.tsx +1 -1
- package/src/FrappeChartCard.tsx +1 -1
- package/src/FrappeDashboard.stories.tsx +6 -5
- package/src/FrappeDashboard.tsx +6 -33
- package/src/FrappeGantt.stories.tsx +1 -2
- package/src/FrappeList.stories.tsx +3 -10
- package/src/components/attachments.stories.tsx +9 -2
- package/src/dependsOn.ts +2 -2
- package/src/fields/CodeEditor/CodeEditor.spec.tsx +37 -0
- package/src/fields/CodeEditor/CodeEditor.stories.tsx +83 -66
- package/src/fields/CodeEditor/index.tsx +4 -0
- package/src/fields/DateRange/DateRange.spec.tsx +143 -0
- package/src/fields/FileUpload.spec.tsx +334 -0
- package/src/fields/FileUploadField/FileUploadField.spec.tsx +166 -0
- package/src/fields/HTML/Html.spec.tsx +179 -0
- package/src/fields/Icon/Icon.stories.tsx +138 -0
- package/src/fields/Link.stories.tsx +2 -0
- package/src/fields/LongText/LongText.spec.tsx +217 -0
- package/src/fields/OTPInput/OTPInput.spec.tsx +167 -0
- package/src/fields/Password/Password.stories.tsx +21 -0
- package/src/fields/Phone/Phone.spec.tsx +151 -0
- package/src/fields/ReadOnly/ReadOnly.spec.tsx +229 -0
- package/src/fields/SmallText/SmallText.spec.tsx +175 -0
- package/src/fields/shared/EditorPreviewPanes.spec.tsx +122 -0
- package/src/formEngine/createPrefill.ts +28 -0
- package/src/formEngine/dirtyTracking.spec.ts +91 -0
- package/src/formEngine/dirtyTracking.ts +64 -0
- package/src/formEngine/doctypeMeta.ts +117 -0
- package/src/formEngine/fetchFrom.spec.ts +92 -0
- package/src/formEngine/fetchFrom.ts +111 -0
- package/src/formEngine/fieldPermissions.spec.ts +61 -0
- package/src/formEngine/fieldPermissions.ts +68 -0
- package/src/formEngine/formActions.ts +285 -0
- package/src/formEngine/formLayout.spec.ts +373 -0
- package/src/formEngine/formLayout.ts +392 -0
- package/src/formEngine/index.ts +33 -0
- package/src/formEngine/seam.spec.ts +148 -0
- package/src/formEngine/useFormEngine.ts +496 -0
- package/src/frappeRemainder.designLaw.spec.ts +9 -0
- package/src/frappeViews.designLaw.spec.ts +1 -0
- package/src/index.spec.ts +7 -3
- package/src/index.ts +51 -1
- package/src/schemaForm/SchemaForm.spec.tsx +4 -1
- package/types/ChartCard.d.ts +13 -0
- package/types/ChartCard.d.ts.map +1 -0
- package/types/FrappeDashboard.d.ts +2 -10
- package/types/FrappeDashboard.d.ts.map +1 -1
- package/types/dependsOn.d.ts +2 -2
- package/types/fields/CodeEditor/index.d.ts.map +1 -1
- package/types/formEngine/createPrefill.d.ts +19 -0
- package/types/formEngine/createPrefill.d.ts.map +1 -0
- package/types/formEngine/dirtyTracking.d.ts +36 -0
- package/types/formEngine/dirtyTracking.d.ts.map +1 -0
- package/types/formEngine/doctypeMeta.d.ts +117 -0
- package/types/formEngine/doctypeMeta.d.ts.map +1 -0
- package/types/formEngine/fetchFrom.d.ts +43 -0
- package/types/formEngine/fetchFrom.d.ts.map +1 -0
- package/types/formEngine/fieldPermissions.d.ts +38 -0
- package/types/formEngine/fieldPermissions.d.ts.map +1 -0
- package/types/formEngine/formActions.d.ts +95 -0
- package/types/formEngine/formActions.d.ts.map +1 -0
- package/types/formEngine/formLayout.d.ts +91 -0
- package/types/formEngine/formLayout.d.ts.map +1 -0
- package/types/formEngine/index.d.ts +27 -0
- package/types/formEngine/index.d.ts.map +1 -0
- package/types/formEngine/useFormEngine.d.ts +61 -0
- package/types/formEngine/useFormEngine.d.ts.map +1 -0
- package/types/index.d.ts +4 -1
- package/types/index.d.ts.map +1 -1
package/types/dependsOn.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Safe evaluator for Frappe `depends_on` / `mandatory_depends_on` /
|
|
3
3
|
* `read_only_depends_on` expressions — the ONE parser for every surface
|
|
4
|
-
* (SchemaForm here, the
|
|
5
|
-
*
|
|
4
|
+
* (SchemaForm here, and the desk form engine next door in ./formEngine;
|
|
5
|
+
* `@multiplatform.one/backoffice` re-exports it from its old path).
|
|
6
6
|
*
|
|
7
7
|
* Frappe's desk evaluates these with JS `eval`; Hermes (React Native), GJS,
|
|
8
8
|
* and CSP-restricted webviews cannot construct functions from strings, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/CodeEditor/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAWL,KAAK,UAAU,EAChB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAkB,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AA8BtE,wBA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AAU,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,IAAI,EAAE,QAAQ,EACd,UAAU,EACV,KAAK,EACL,UAAU,EACV,UAAU,EACV,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,EAAE,EAAE,MAAM,EACV,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,WAAW,EACX,QAAiB,EACjB,OAAW,EACX,OAAY,EACZ,YAAY,EAAE,SAAS,GACxB,EAAE,oBAAoB,2CAwItB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One-shot create-mode prefill hand-off.
|
|
3
|
+
*
|
|
4
|
+
* Two producers, one mechanism:
|
|
5
|
+
* - Duplicate and Amend navigate to `newDocPath(doctype)` and stash the
|
|
6
|
+
* copied values here (in-memory only — a refresh honestly falls back to
|
|
7
|
+
* a blank form; no URL-size limits for large docs).
|
|
8
|
+
* - NewDocRouteScreen stashes parsed `?d=` URL defaults (kanban column "+",
|
|
9
|
+
* calendar day click, connections "+") before rendering the form — those
|
|
10
|
+
* survive refresh because the URL re-stashes them.
|
|
11
|
+
*
|
|
12
|
+
* The create-mode form (useFormEngine seeding) consumes and clears the
|
|
13
|
+
* stash on mount, merging it over meta defaults. Last stash per doctype
|
|
14
|
+
* wins, so a `?d=` navigation cannot double-apply with a stale
|
|
15
|
+
* Duplicate/Amend hand-off.
|
|
16
|
+
*/
|
|
17
|
+
export declare function setCreatePrefill(doctype: string, values: Record<string, unknown>): void;
|
|
18
|
+
export declare function takeCreatePrefill(doctype: string): Record<string, unknown> | undefined;
|
|
19
|
+
//# sourceMappingURL=createPrefill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPrefill.d.ts","sourceRoot":"","sources":["../../src/formEngine/createPrefill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAEvF;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAItF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dirty tracking for the desk form engine (R-1 false "Not Saved" fix).
|
|
3
|
+
*
|
|
4
|
+
* The engine diffs the locally edited doc against the last server baseline.
|
|
5
|
+
* A strict `!==` diff falsely armed Save on untouched documents whenever a
|
|
6
|
+
* field's *representation* of a value differed from the wire format (mount
|
|
7
|
+
* emitters have been fixed at the field level — forms contract: initialization
|
|
8
|
+
* must not emit change events — but the engine stays defensive).
|
|
9
|
+
*/
|
|
10
|
+
export declare function isEmptyValue(value: unknown): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Init-aware value equality. Two representation classes are folded:
|
|
13
|
+
*
|
|
14
|
+
* - empty: null / undefined / "" / [] are one empty state (a field
|
|
15
|
+
* normalizing null → "" is not an edit)
|
|
16
|
+
* - boolean: Check wires 0/1 but a control may emit true/false
|
|
17
|
+
*
|
|
18
|
+
* Everything else stays strict equality — deliberately shallow and honest
|
|
19
|
+
* (no deep equality): desk parity means an edit reverted to a value that is
|
|
20
|
+
* merely *equivalent* (not identical) may still read dirty, while reverting
|
|
21
|
+
* to the exact original value reads clean.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isSameValue(a: unknown, b: unknown): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Names of fields whose local value differs from the baseline.
|
|
26
|
+
*
|
|
27
|
+
* - Edit mode (baseline defined): normalization-insensitive diff via
|
|
28
|
+
* `isSameValue` — an untouched doc reads pristine even if a field
|
|
29
|
+
* re-represented its value during initialization.
|
|
30
|
+
* - Create mode (no baseline): any non-empty value counts, defaults included —
|
|
31
|
+
* desk parity, a new doc shows "Not Saved".
|
|
32
|
+
*
|
|
33
|
+
* `doctype` / `name` are bookkeeping, never dirty.
|
|
34
|
+
*/
|
|
35
|
+
export declare function computeDirtyFields(localDoc: Record<string, unknown>, baseline: Record<string, unknown> | undefined): string[];
|
|
36
|
+
//# sourceMappingURL=dirtyTracking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dirtyTracking.d.ts","sourceRoot":"","sources":["../../src/formEngine/dirtyTracking.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAS3D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC5C,MAAM,EAAE,CASV"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DocType meta shapes as `frappe.desk.form.load.getdoctype` returns them.
|
|
3
|
+
*
|
|
4
|
+
* These were declared in `@multiplatform.one/backoffice`
|
|
5
|
+
* (`shared/useDoctypeMeta.ts`) while the desk form engine lived there. The
|
|
6
|
+
* engine now lives here (MPO-15), so the shapes it consumes live here too —
|
|
7
|
+
* a lower-tier package must never reach up into backoffice for a type.
|
|
8
|
+
* `useDoctypeMeta` (the loader hook, which needs the backoffice app context)
|
|
9
|
+
* stays where it is and re-exports these.
|
|
10
|
+
*
|
|
11
|
+
* Deliberately loose: the server is the source of truth, `0 | 1` flags are
|
|
12
|
+
* what the RPC actually sends, and the index signature carries the keys no
|
|
13
|
+
* surface has needed yet. `fieldtype` stays `string` here; narrowing it to
|
|
14
|
+
* the `FrappeFieldType` union is the remaining half of MPO-15's meta-model
|
|
15
|
+
* criterion and is tracked there, not silently done in a move.
|
|
16
|
+
*/
|
|
17
|
+
/** A single DocField row from a DocType meta (loose — server is source of truth). */
|
|
18
|
+
export interface DocFieldMeta {
|
|
19
|
+
fieldname: string;
|
|
20
|
+
label?: string;
|
|
21
|
+
fieldtype: string;
|
|
22
|
+
options?: string;
|
|
23
|
+
reqd?: 0 | 1;
|
|
24
|
+
hidden?: 0 | 1;
|
|
25
|
+
read_only?: 0 | 1;
|
|
26
|
+
bold?: 0 | 1;
|
|
27
|
+
in_list_view?: 0 | 1;
|
|
28
|
+
in_standard_filter?: 0 | 1;
|
|
29
|
+
in_global_search?: 0 | 1;
|
|
30
|
+
allow_in_quick_entry?: 0 | 1;
|
|
31
|
+
allow_on_submit?: 0 | 1;
|
|
32
|
+
no_copy?: 0 | 1;
|
|
33
|
+
collapsible?: 0 | 1;
|
|
34
|
+
collapsible_depends_on?: string;
|
|
35
|
+
depends_on?: string;
|
|
36
|
+
mandatory_depends_on?: string;
|
|
37
|
+
read_only_depends_on?: string;
|
|
38
|
+
fetch_from?: string;
|
|
39
|
+
permlevel?: number;
|
|
40
|
+
length?: number;
|
|
41
|
+
default?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
precision?: string | number;
|
|
44
|
+
idx?: number;
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
/** DocType Link child row (Connections tab). Probed: `group` arrives null when unset. */
|
|
48
|
+
export interface DocLinkMeta {
|
|
49
|
+
name?: string;
|
|
50
|
+
link_doctype: string;
|
|
51
|
+
link_fieldname: string;
|
|
52
|
+
group?: string | null;
|
|
53
|
+
hidden?: 0 | 1;
|
|
54
|
+
is_child_table?: 0 | 1;
|
|
55
|
+
parent_doctype?: string;
|
|
56
|
+
table_fieldname?: string;
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
}
|
|
59
|
+
/** Role permission row from the DocType meta. */
|
|
60
|
+
export interface DocPermissionRule {
|
|
61
|
+
role?: string;
|
|
62
|
+
permlevel?: number;
|
|
63
|
+
read?: 0 | 1;
|
|
64
|
+
write?: 0 | 1;
|
|
65
|
+
create?: 0 | 1;
|
|
66
|
+
delete?: 0 | 1;
|
|
67
|
+
submit?: 0 | 1;
|
|
68
|
+
cancel?: 0 | 1;
|
|
69
|
+
amend?: 0 | 1;
|
|
70
|
+
print?: 0 | 1;
|
|
71
|
+
email?: 0 | 1;
|
|
72
|
+
share?: 0 | 1;
|
|
73
|
+
if_owner?: 0 | 1;
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
/** DocType meta as returned by frappe.desk.form.load.getdoctype (loose). */
|
|
77
|
+
export interface DoctypeMeta {
|
|
78
|
+
doctype?: string;
|
|
79
|
+
name: string;
|
|
80
|
+
module?: string;
|
|
81
|
+
issingle?: 0 | 1;
|
|
82
|
+
istable?: 0 | 1;
|
|
83
|
+
is_submittable?: 0 | 1;
|
|
84
|
+
is_tree?: 0 | 1;
|
|
85
|
+
/** Desk treeview_settings asset (`{doctype}_tree.js`) — gates Tree. */
|
|
86
|
+
__tree_js?: string;
|
|
87
|
+
/** Desk calendar_settings asset (`{doctype}_calendar.js`) — gates Calendar. */
|
|
88
|
+
__calendar_js?: string;
|
|
89
|
+
is_virtual?: 0 | 1;
|
|
90
|
+
editable_grid?: 0 | 1;
|
|
91
|
+
track_changes?: 0 | 1;
|
|
92
|
+
quick_entry?: 0 | 1;
|
|
93
|
+
autoname?: string;
|
|
94
|
+
naming_rule?: string;
|
|
95
|
+
allow_rename?: 0 | 1;
|
|
96
|
+
allow_copy?: 0 | 1;
|
|
97
|
+
read_only?: 0 | 1;
|
|
98
|
+
in_create?: 0 | 1;
|
|
99
|
+
hide_toolbar?: 0 | 1;
|
|
100
|
+
max_attachments?: number;
|
|
101
|
+
title_field?: string;
|
|
102
|
+
image_field?: string;
|
|
103
|
+
search_fields?: string;
|
|
104
|
+
sort_field?: string;
|
|
105
|
+
sort_order?: string;
|
|
106
|
+
icon?: string;
|
|
107
|
+
document_type?: string;
|
|
108
|
+
fields: DocFieldMeta[];
|
|
109
|
+
permissions?: DocPermissionRule[];
|
|
110
|
+
links?: DocLinkMeta[];
|
|
111
|
+
states?: Array<{
|
|
112
|
+
title?: string;
|
|
113
|
+
color?: string;
|
|
114
|
+
} & Record<string, unknown>>;
|
|
115
|
+
[key: string]: unknown;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=doctypeMeta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctypeMeta.d.ts","sourceRoot":"","sources":["../../src/formEngine/doctypeMeta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,qFAAqF;AACrF,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACb,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACf,SA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ch`) and
|
|
4
|
+
* controls/link.js (`validate_link_and_fetch`):
|
|
5
|
+
*
|
|
6
|
+
* - A field participates when `fetch_from` is "<link_field>.<source_field>"
|
|
7
|
+
* AND (its fieldtype is in the scalar set desk registers, or it is
|
|
8
|
+
* read_only / is_virtual).
|
|
9
|
+
* - When the link field changes to a value, desk calls
|
|
10
|
+
* `frappe.client.validate_link` with the source columns and writes the
|
|
11
|
+
* returned values onto the targets; clearing the link clears the targets.
|
|
12
|
+
* - `fetch_if_empty` targets keep a non-empty existing value (server
|
|
13
|
+
* semantics; desk leaves such fields editable — see
|
|
14
|
+
* `read_only_because_of_fetch_from`, base_input.js:56-66).
|
|
15
|
+
*
|
|
16
|
+
* The server remains authoritative: this is a preview so the user sees the
|
|
17
|
+
* fetched values before save.
|
|
18
|
+
*/
|
|
19
|
+
import type { DocFieldMeta } from "./doctypeMeta";
|
|
20
|
+
export interface FetchRule {
|
|
21
|
+
/** Field to populate. */
|
|
22
|
+
target: string;
|
|
23
|
+
/** Column on the linked doc to read. */
|
|
24
|
+
source: string;
|
|
25
|
+
/** Only fill when the target is currently empty; never lock the field. */
|
|
26
|
+
fetchIfEmpty: boolean;
|
|
27
|
+
}
|
|
28
|
+
/** Map of link fieldname → fetch rules hanging off that link. */
|
|
29
|
+
export type FetchMap = Map<string, FetchRule[]>;
|
|
30
|
+
export declare function buildFetchMap(fields: DocFieldMeta[]): FetchMap;
|
|
31
|
+
/**
|
|
32
|
+
* Values to patch onto the doc after the linked doc's columns arrive.
|
|
33
|
+
* `fetched` is empty when the link was cleared — desk then blanks the
|
|
34
|
+
* targets; `fetch_if_empty` targets holding a value are left alone in both
|
|
35
|
+
* directions (they belong to the user until the server reconciles).
|
|
36
|
+
*/
|
|
37
|
+
export declare function applyFetchedValues(rules: FetchRule[], fetched: Record<string, unknown>, currentDoc: Record<string, unknown>): Record<string, unknown>;
|
|
38
|
+
/**
|
|
39
|
+
* Desk's `read_only_because_of_fetch_from`: a fetch target without
|
|
40
|
+
* `fetch_if_empty` renders read-only while its source link holds a value.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isFetchLocked(field: DocFieldMeta, doc: Record<string, unknown>): boolean;
|
|
43
|
+
//# sourceMappingURL=fetchFrom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchFrom.d.ts","sourceRoot":"","sources":["../../src/formEngine/fetchFrom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAuBlD,MAAM,WAAW,SAAS;IACxB,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,iEAAiE;AACjE,MAAM,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;AAEhD,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,QAAQ,CAsB9D;AAMD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,EAAE,EAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOzB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAKxF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field-level permission matrix — desk parity with
|
|
3
|
+
* frappe/public/js/frappe/model/perm.js (`get_role_permissions` +
|
|
4
|
+
* `get_field_display_status`):
|
|
5
|
+
*
|
|
6
|
+
* perm[level] = OR of meta.permissions rows whose role the session user
|
|
7
|
+
* holds. A field at permlevel L then resolves to:
|
|
8
|
+
* - no read at L → hidden ("None")
|
|
9
|
+
* - read, no write → read-only ("Read")
|
|
10
|
+
* - write → editable ("Write", subject to the other rules)
|
|
11
|
+
*
|
|
12
|
+
* Levels that appear on fields but have no granting rows resolve to
|
|
13
|
+
* {read: false} — desk hides those fields (gap-filled `{}` in perm.js:153).
|
|
14
|
+
* When the caller has no role list (fixtures, roles RPC unavailable) the
|
|
15
|
+
* matrix is undefined and formLayout falls back to the conservative
|
|
16
|
+
* "permlevel > 0 → read-only" rule (never hides, never unlocks).
|
|
17
|
+
*/
|
|
18
|
+
import type { DocPermissionRule } from "./doctypeMeta";
|
|
19
|
+
export interface LevelPerm {
|
|
20
|
+
read: boolean;
|
|
21
|
+
write: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** Sparse array indexed by permlevel; missing entries mean "no rights". */
|
|
24
|
+
export type PermLevelMatrix = LevelPerm[];
|
|
25
|
+
export declare function buildPermLevelMatrix(permissions: DocPermissionRule[] | undefined, userRoles: string[] | undefined): PermLevelMatrix | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Read access at a permlevel. Level 0 is implied by having the doc at all
|
|
28
|
+
* (docinfo/doc-level perms govern it — including share/if_owner grants the
|
|
29
|
+
* role matrix can't see), so only higher levels consult the matrix.
|
|
30
|
+
*/
|
|
31
|
+
export declare function canReadLevel(matrix: PermLevelMatrix | undefined, permlevel: number): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Write access at a permlevel. Level 0 defers to the doc-level write flag
|
|
34
|
+
* (formReadOnly); higher levels require a granting role row — without a
|
|
35
|
+
* matrix the coarse fallback keeps them read-only (desk-safe direction).
|
|
36
|
+
*/
|
|
37
|
+
export declare function canWriteLevel(matrix: PermLevelMatrix | undefined, permlevel: number): boolean;
|
|
38
|
+
//# sourceMappingURL=fieldPermissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldPermissions.d.ts","sourceRoot":"","sources":["../../src/formEngine/fieldPermissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,2EAA2E;AAC3E,MAAM,MAAM,eAAe,GAAG,SAAS,EAAE,CAAC;AAE1C,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,iBAAiB,EAAE,GAAG,SAAS,EAC5C,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,GAC9B,eAAe,GAAG,SAAS,CAc7B;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAI5F;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAI7F"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Desk form RPC helpers — thin wrappers over the whitelisted methods the
|
|
3
|
+
* stock desk form view calls. Every payload here was probed against a live
|
|
4
|
+
* bench (frappe v15) before implementation:
|
|
5
|
+
*
|
|
6
|
+
* frappe.desk.form.assign_to.add {doctype, name, assign_to: [..], description?}
|
|
7
|
+
* frappe.desk.form.assign_to.remove {doctype, name, assign_to: "user"}
|
|
8
|
+
* frappe.desk.form.utils.add_comment {reference_doctype, reference_name, content,
|
|
9
|
+
* comment_email, comment_by}
|
|
10
|
+
* frappe.desk.doctype.tag.tag.add_tag {tag, dt, dn}
|
|
11
|
+
* frappe.desk.doctype.tag.tag.remove_tag{tag, dt, dn}
|
|
12
|
+
* frappe.desk.like.toggle_like {doctype, name, add: "Yes"|"No"}
|
|
13
|
+
* frappe.desk.form.document_follow.follow_document / unfollow_document
|
|
14
|
+
* {doctype, doc_name, user}
|
|
15
|
+
* frappe.model.rename_doc.update_document_title
|
|
16
|
+
* {doctype, docname, name, merge: 0} → new name
|
|
17
|
+
* (what desk calls — syncs the title field too)
|
|
18
|
+
* frappe.client.submit {doc} (full doc incl. modified — OCC enforced)
|
|
19
|
+
* frappe.client.cancel {doctype, name}
|
|
20
|
+
* frappe.client.get_count {doctype, filters}
|
|
21
|
+
* frappe.client.validate_link {doctype, docname, fields: [..]} →
|
|
22
|
+
* {name, <field>: value} (fetch_from preview)
|
|
23
|
+
* frappe.core.doctype.communication.email.make
|
|
24
|
+
* {doctype, name, recipients, subject, content,
|
|
25
|
+
* send_email: 1}
|
|
26
|
+
* frappe.desk.form.utils.remove_attach {fid, dt, dn}
|
|
27
|
+
*/
|
|
28
|
+
import { HttpClient } from "@multiplatform.one/frappe";
|
|
29
|
+
import type { FixtureProvider } from "@multiplatform.one/frappe";
|
|
30
|
+
/**
|
|
31
|
+
* Connection shape shared by every form loader/action — structurally
|
|
32
|
+
* compatible with frappe-ui's FrappeConfig and the frappe package's
|
|
33
|
+
* UseFrappeCollectionConfig (function tokens included).
|
|
34
|
+
*/
|
|
35
|
+
export interface FrappeConnection {
|
|
36
|
+
baseURL: string;
|
|
37
|
+
socketPort?: number;
|
|
38
|
+
/** Same-origin socket override (see FrappeConfig.socketBaseURL). */
|
|
39
|
+
socketBaseURL?: string;
|
|
40
|
+
/** Frappe site name — the realtime Socket.IO namespace. */
|
|
41
|
+
siteName?: string;
|
|
42
|
+
auth?: {
|
|
43
|
+
useToken?: boolean;
|
|
44
|
+
token?: string | (() => string | Promise<string>);
|
|
45
|
+
type?: string;
|
|
46
|
+
};
|
|
47
|
+
syncOptions?: any;
|
|
48
|
+
fixtures?: FixtureProvider;
|
|
49
|
+
}
|
|
50
|
+
export declare function createHttpClient(connection: FrappeConnection): HttpClient;
|
|
51
|
+
export declare function addAssignment(http: HttpClient, doctype: string, name: string, users: string[], description?: string): Promise<unknown>;
|
|
52
|
+
export declare function removeAssignment(http: HttpClient, doctype: string, name: string, user: string): Promise<unknown>;
|
|
53
|
+
export declare function addComment(http: HttpClient, args: {
|
|
54
|
+
doctype: string;
|
|
55
|
+
name: string;
|
|
56
|
+
content: string;
|
|
57
|
+
commentEmail: string;
|
|
58
|
+
commentBy?: string;
|
|
59
|
+
}): Promise<unknown>;
|
|
60
|
+
export declare function addTag(http: HttpClient, doctype: string, name: string, tag: string): Promise<unknown>;
|
|
61
|
+
export declare function removeTag(http: HttpClient, doctype: string, name: string, tag: string): Promise<unknown>;
|
|
62
|
+
export declare function toggleLike(http: HttpClient, doctype: string, name: string, add: boolean): Promise<unknown>;
|
|
63
|
+
export declare function followDocument(http: HttpClient, doctype: string, name: string, user: string): Promise<unknown>;
|
|
64
|
+
export declare function unfollowDocument(http: HttpClient, doctype: string, name: string, user: string): Promise<unknown>;
|
|
65
|
+
/**
|
|
66
|
+
* Rename a document; resolves with the new name. Uses desk's own
|
|
67
|
+
* `update_document_title` (handles title-field sync; the bare
|
|
68
|
+
* `frappe.rename_doc` does not). Pass a `title` argument instead of `name`
|
|
69
|
+
* to retitle without renaming — not needed here yet.
|
|
70
|
+
*/
|
|
71
|
+
export declare function renameDoc(http: HttpClient, doctype: string, oldName: string, newName: string): Promise<string>;
|
|
72
|
+
/** Submit a saved draft (docstatus 0 → 1). Requires the current full doc for OCC. */
|
|
73
|
+
export declare function submitDoc(http: HttpClient, doc: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
|
|
74
|
+
/** Cancel a submitted doc (docstatus 1 → 2). */
|
|
75
|
+
export declare function cancelDoc(http: HttpClient, doctype: string, name: string): Promise<Record<string, unknown> | undefined>;
|
|
76
|
+
/** Direct REST insert — returns the created doc (with its server-issued name). */
|
|
77
|
+
export declare function insertDoc(http: HttpClient, doctype: string, values: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
78
|
+
/**
|
|
79
|
+
* Validate a link value and fetch columns off the linked doc in one call —
|
|
80
|
+
* what desk's Link control uses to drive fetch_from previews. Resolves with
|
|
81
|
+
* `{name, <field>: value, ...}`; rejects when the target doc is missing.
|
|
82
|
+
*/
|
|
83
|
+
export declare function validateLink(http: HttpClient, doctype: string, docname: string, fields: string[]): Promise<Record<string, unknown>>;
|
|
84
|
+
export declare function getCount(http: HttpClient, doctype: string, filters: Record<string, unknown>): Promise<number>;
|
|
85
|
+
export declare function getLoggedUser(http: HttpClient): Promise<string>;
|
|
86
|
+
export declare function removeAttachment(http: HttpClient, fileId: string, doctype: string, name: string): Promise<unknown>;
|
|
87
|
+
export declare function uploadAttachment(http: HttpClient, file: File | Blob, doctype: string, name: string): Promise<unknown>;
|
|
88
|
+
export declare function sendEmail(http: HttpClient, args: {
|
|
89
|
+
doctype: string;
|
|
90
|
+
name: string;
|
|
91
|
+
recipients: string;
|
|
92
|
+
subject: string;
|
|
93
|
+
content: string;
|
|
94
|
+
}): Promise<unknown>;
|
|
95
|
+
//# sourceMappingURL=formActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formActions.d.ts","sourceRoot":"","sources":["../../src/formEngine/formActions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAA+B,MAAM,2BAA2B,CAAC;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE;QACL,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,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AAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oBAE/F;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,IAAI,GAAG,IAAI,EACjB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED,wBAAgB,SAAS,CACvB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,oBAUF"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Desk form layout engine.
|
|
3
|
+
*
|
|
4
|
+
* Splits the flat DocType field list into desk tabs (Tab Break), sections
|
|
5
|
+
* (Section Break, collapsible honored), and columns (Column Break), and
|
|
6
|
+
* maps them to the generic `FormSchema` consumed by frappe-ui's SchemaForm.
|
|
7
|
+
*
|
|
8
|
+
* Dynamic behavior is computed HERE with the safe depends_on evaluator
|
|
9
|
+
* (dependsOn.ts) — the `depends_on` string is deliberately stripped from the
|
|
10
|
+
* FieldSchema handed to SchemaForm so its string-eval-based evaluator
|
|
11
|
+
* (which cannot run on Hermes/GJS) never engages:
|
|
12
|
+
*
|
|
13
|
+
* - depends_on → field omitted from the built schema
|
|
14
|
+
* - mandatory_depends_on → `required: true` on the built FieldSchema
|
|
15
|
+
* - read_only_depends_on → `readOnly: true` on the built FieldSchema
|
|
16
|
+
* - permlevel → hidden without level read, read-only without
|
|
17
|
+
* level write (role matrix via fieldPermissions.ts; coarse read-only
|
|
18
|
+
* fallback when roles are unavailable)
|
|
19
|
+
* - set_only_once → read-only on saved docs
|
|
20
|
+
* - fetch_from → read-only while the source link holds a value
|
|
21
|
+
* (unless fetch_if_empty)
|
|
22
|
+
* - docstatus > 0 → everything read-only except allow_on_submit
|
|
23
|
+
* fields on a submitted (1) doc
|
|
24
|
+
* - collapsible / collapsible_depends_on / missing-mandatory → per-section
|
|
25
|
+
* computed collapse state (desk refresh_section_collapse)
|
|
26
|
+
*
|
|
27
|
+
* Sections whose Section Break has a false depends_on hide wholesale; a
|
|
28
|
+
* section with no visible fields is dropped so SchemaForm never renders an
|
|
29
|
+
* empty card.
|
|
30
|
+
*/
|
|
31
|
+
import type { FormSchema } from "../schemaForm";
|
|
32
|
+
import { type PermLevelMatrix } from "./fieldPermissions";
|
|
33
|
+
import type { DocFieldMeta } from "./doctypeMeta";
|
|
34
|
+
export interface FormTab {
|
|
35
|
+
/** Stable key (fieldname of the Tab Break or "__details") */
|
|
36
|
+
key: string;
|
|
37
|
+
label: string;
|
|
38
|
+
schema: FormSchema;
|
|
39
|
+
}
|
|
40
|
+
export interface BuildTabsOptions {
|
|
41
|
+
fields: DocFieldMeta[];
|
|
42
|
+
doc: Record<string, unknown>;
|
|
43
|
+
/** docstatus of the loaded doc (0 draft / 1 submitted / 2 cancelled). */
|
|
44
|
+
docstatus: number;
|
|
45
|
+
/** Meta-level read_only or missing write permission. */
|
|
46
|
+
formReadOnly: boolean;
|
|
47
|
+
/** Create mode relaxes read_only_depends_on on unsaved values. */
|
|
48
|
+
isCreate: boolean;
|
|
49
|
+
/** Default label for the implicit first tab. */
|
|
50
|
+
detailsLabel: string;
|
|
51
|
+
/**
|
|
52
|
+
* Role-derived permlevel matrix (fieldPermissions.ts). Desk semantics:
|
|
53
|
+
* fields at a level without read HIDE; read without write → read-only.
|
|
54
|
+
* Undefined (fixtures / roles unavailable) → coarse fallback: any
|
|
55
|
+
* permlevel > 0 renders read-only, never hidden.
|
|
56
|
+
*/
|
|
57
|
+
permLevels?: PermLevelMatrix;
|
|
58
|
+
/** Host-hidden fields (fieldnames) — dropped before layout resolution. */
|
|
59
|
+
hiddenFields?: readonly string[];
|
|
60
|
+
/**
|
|
61
|
+
* Host-hidden sections/tabs. Matches a Section Break's or Tab Break's
|
|
62
|
+
* fieldname OR label; the whole section (or tab) is dropped.
|
|
63
|
+
*/
|
|
64
|
+
hiddenSections?: readonly string[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Build the desk tab list for the current doc state. Recomputed whenever
|
|
68
|
+
* the doc changes so depends_on chains re-resolve; the work is O(fields).
|
|
69
|
+
*/
|
|
70
|
+
export declare function buildFormTabs(options: BuildTabsOptions): FormTab[];
|
|
71
|
+
/**
|
|
72
|
+
* Seed a create-mode doc from meta field defaults — desk parity with
|
|
73
|
+
* create_new.js get_default_value / set_default_values:
|
|
74
|
+
*
|
|
75
|
+
* - `Today` → today's date; `now` → time (Time) / local datetime (else)
|
|
76
|
+
* - `__user` / `user` (Link/Data only, avoiding Select option collisions)
|
|
77
|
+
* → session user
|
|
78
|
+
* - Select fields with no default seed their first option
|
|
79
|
+
* (create_new.js:107-114)
|
|
80
|
+
* - `:fieldname` boot sysdefaults, `frappe.*`, `user_fullname` stay unset —
|
|
81
|
+
* server-resolved on insert (documented gap)
|
|
82
|
+
*/
|
|
83
|
+
export declare function buildCreateDefaults(fields: DocFieldMeta[], currentUser?: string): Record<string, unknown>;
|
|
84
|
+
/**
|
|
85
|
+
* Copyable field values for Duplicate / Amend: strips standard bookkeeping
|
|
86
|
+
* fields, `no_copy` fields, layout breaks, and empty values.
|
|
87
|
+
*/
|
|
88
|
+
export declare function buildCopyValues(fields: DocFieldMeta[], doc: Record<string, unknown>): Record<string, unknown>;
|
|
89
|
+
/** True when the doctype names docs by user prompt (show a name input). */
|
|
90
|
+
export declare function isPromptNamed(autoname?: string, namingRule?: string): boolean;
|
|
91
|
+
//# sourceMappingURL=formLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formLayout.d.ts","sourceRoot":"","sources":["../../src/formEngine/formLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH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AAa,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAG7E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The desk form engine.
|
|
3
|
+
*
|
|
4
|
+
* Frappe's desk resolves a form from meta at render time: tabs and sections
|
|
5
|
+
* from the layout breaks, visibility and read-only from `depends_on` chains,
|
|
6
|
+
* `permlevel`, `set_only_once`, `fetch_from`, `docstatus`, and a
|
|
7
|
+
* save/submit/cancel/amend lifecycle on top. All of that used to live in
|
|
8
|
+
* `@multiplatform.one/backoffice`, so an app author who imported the
|
|
9
|
+
* EXPORTED `FrappeForm` got a strictly weaker form than the desk rendered
|
|
10
|
+
* for the same doctype (MPO-15).
|
|
11
|
+
*
|
|
12
|
+
* It lives here now. `@multiplatform.one/backoffice` re-exports every name
|
|
13
|
+
* from its previous paths, so existing imports — barrel and
|
|
14
|
+
* `@multiplatform.one/backoffice/src/form/*` deep — keep resolving.
|
|
15
|
+
*/
|
|
16
|
+
export type { DocFieldMeta, DocLinkMeta, DocPermissionRule, DoctypeMeta } from "./doctypeMeta";
|
|
17
|
+
export { buildPermLevelMatrix, canReadLevel, canWriteLevel } from "./fieldPermissions";
|
|
18
|
+
export type { LevelPerm, PermLevelMatrix } from "./fieldPermissions";
|
|
19
|
+
export { applyFetchedValues, buildFetchMap, isFetchLocked } from "./fetchFrom";
|
|
20
|
+
export type { FetchMap, FetchRule } from "./fetchFrom";
|
|
21
|
+
export { computeDirtyFields, isEmptyValue, isSameValue } from "./dirtyTracking";
|
|
22
|
+
export { setCreatePrefill, takeCreatePrefill } from "./createPrefill";
|
|
23
|
+
export { buildCopyValues, buildCreateDefaults, buildFormTabs, isPromptNamed } from "./formLayout";
|
|
24
|
+
export type { BuildTabsOptions, FormTab } from "./formLayout";
|
|
25
|
+
export { useFormEngine } from "./useFormEngine";
|
|
26
|
+
export type { FormEngine } from "./useFormEngine";
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/formEngine/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE/F,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvF,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/E,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEhF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClG,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The desk form state engine.
|
|
3
|
+
*
|
|
4
|
+
* - Edit mode: the doc lives in a name-filtered live collection
|
|
5
|
+
* (useFrappeCollection + useLiveQuery) so realtime updates flow in; saves
|
|
6
|
+
* write only dirty fields through the collection's optimistic update path
|
|
7
|
+
* (live update_doc enforces If-Match OCC — a version conflict surfaces as
|
|
8
|
+
* a save error and flips `conflict` so the UI can offer a reload).
|
|
9
|
+
* - Create mode: seeds meta defaults (+ optional Duplicate/Amend prefill)
|
|
10
|
+
* and inserts via direct REST so the server-issued name is returned for
|
|
11
|
+
* router.replace(formPath(...)).
|
|
12
|
+
* - Dirty tracking against the last server baseline; external updates land
|
|
13
|
+
* on clean fields in place, dirty fields are preserved.
|
|
14
|
+
* - Submit / Cancel lifecycle for is_submittable doctypes via
|
|
15
|
+
* frappe.client.submit / frappe.client.cancel (probed) — realtime then
|
|
16
|
+
* refreshes the live doc; Amend is a create-mode copy with amended_from.
|
|
17
|
+
*/
|
|
18
|
+
import type { DoctypeMeta } from "./doctypeMeta";
|
|
19
|
+
import type { FrappeConnection } from "./formActions";
|
|
20
|
+
export interface FormEngine {
|
|
21
|
+
/** Current (locally edited) doc values. */
|
|
22
|
+
doc: Record<string, unknown>;
|
|
23
|
+
/** Last authoritative server snapshot (undefined in create mode). */
|
|
24
|
+
baseline: Record<string, unknown> | undefined;
|
|
25
|
+
isLoading: boolean;
|
|
26
|
+
/** Edit-mode doc missing after load settles (bad name / no permission). */
|
|
27
|
+
notFound: boolean;
|
|
28
|
+
/** The open doc was deleted on the server while open. */
|
|
29
|
+
wasDeleted: boolean;
|
|
30
|
+
isCreate: boolean;
|
|
31
|
+
isDirty: boolean;
|
|
32
|
+
dirtyFields: string[];
|
|
33
|
+
isSaving: boolean;
|
|
34
|
+
/** Per-field + `general` error messages. */
|
|
35
|
+
errors: Record<string, string>;
|
|
36
|
+
/** True after a save failed with a version conflict (OCC 409). */
|
|
37
|
+
conflict: boolean;
|
|
38
|
+
/** Logged-in user (for comments / likes / assignments). */
|
|
39
|
+
currentUser: string;
|
|
40
|
+
docstatus: number;
|
|
41
|
+
setValue: (field: string, value: unknown) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Save. Create mode resolves with the server-issued doc name;
|
|
44
|
+
* edit mode resolves with the current name. Undefined = validation failed.
|
|
45
|
+
*/
|
|
46
|
+
save: () => Promise<string | undefined>;
|
|
47
|
+
/** Submit lifecycle (is_submittable): docstatus 0 → 1. */
|
|
48
|
+
submit: () => Promise<boolean>;
|
|
49
|
+
/** Cancel lifecycle: docstatus 1 → 2. */
|
|
50
|
+
cancel: () => Promise<boolean>;
|
|
51
|
+
/** Delete the doc through the live collection. */
|
|
52
|
+
remove: () => Promise<boolean>;
|
|
53
|
+
/** Discard local edits / clear conflict, back to the server baseline. */
|
|
54
|
+
reload: () => void;
|
|
55
|
+
/** Client-side required validation (fires on save too). */
|
|
56
|
+
validate: () => Record<string, string>;
|
|
57
|
+
}
|
|
58
|
+
export declare function useFormEngine(connection: FrappeConnection | undefined, doctype: string,
|
|
59
|
+
/** Document name, or undefined for create mode. */
|
|
60
|
+
name: string | undefined, meta: DoctypeMeta | undefined, translate: (key: string, options?: Record<string, unknown>) => string): FormEngine;
|
|
61
|
+
//# sourceMappingURL=useFormEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormEngine.d.ts","sourceRoot":"","sources":["../../src/formEngine/useFormEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAiBtD,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,QAAQ,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,kEAAkE;IAClE,QAAQ,EAAE,OAAO,CAAC;IAClB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD;;;OAGG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,0DAA0D;IAC1D,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,yCAAyC;IACzC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,kDAAkD;IAClD,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,yEAAyE;IACzE,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAkCD,wBAAgB,aAAa,CAC3B,UAAU,EAAE,gBAAgB,GAAG,SAAS,EACxC,OAAO,EAAE,MAAM;AACf,mDAAmD;AACnD,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,WAAW,GAAG,SAAS,EAC7B,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,GACpE,UAAU,CA2XZ"}
|
package/types/index.d.ts
CHANGED
|
@@ -24,7 +24,8 @@ export { FrappeCalendar, type FrappeCalendarProps, type CalendarViewType, type C
|
|
|
24
24
|
export { FrappeGantt, type FrappeGanttProps } from "./FrappeGantt";
|
|
25
25
|
export { resolveFrappeEventColor, frappeEventColorNames } from "./frappeEventColor";
|
|
26
26
|
export { FrappeReportBuilder, type FrappeReportBuilderProps, type ReportColumn, type GroupByConfig, } from "./FrappeReportBuilder";
|
|
27
|
-
export { FrappeDashboard,
|
|
27
|
+
export { FrappeDashboard, type FrappeDashboardProps, type DashboardDataSource, } from "./FrappeDashboard";
|
|
28
|
+
export { ChartCard } from "./ChartCard";
|
|
28
29
|
export { KPICard, calculateTrend, calculatePercentageChange, aggregateData, type DashboardWidget, type KPICardConfig, type KPICardProps, type ChartConfig, type ChartCardProps, type ChartDataPoint, type ChartType, type TrendDirection, } from "@multiplatform.one/components";
|
|
29
30
|
export { FrappeKPICard, type FrappeKPICardProps, type FrappeKPIDataSource } from "./FrappeKPICard";
|
|
30
31
|
export { FrappeChartCard, type FrappeChartCardProps, type FrappeChartDataSource, } from "./FrappeChartCard";
|
|
@@ -109,4 +110,6 @@ export { useFrappePagination, type UseFrappePaginationOptions, type UseFrappePag
|
|
|
109
110
|
export { useFrappeCollection, useLiveQuery } from "@multiplatform.one/frappe";
|
|
110
111
|
export type { DataTableColumn } from "@multiplatform.one/table";
|
|
111
112
|
export { FrappeReportView, useFrappeReport, compactFilterValues, normalizeReportColumn, normalizeReportPayload, normalizeReportRows, reportColumnToDataTableColumn, reportFieldtypeToTableField, reportRowLabel, scrubFieldname, type FrappeReportColumn, type FrappeReportConnection, type FrappeReportFilterDef, type FrappeReportFixture, type FrappeReportPayload, type FrappeReportRow, type FrappeReportRunResponse, type FrappeReportValues, type FrappeReportViewProps, type UseFrappeReportOptions, type UseFrappeReportResult, } from "./FrappeReportView";
|
|
113
|
+
export { applyFetchedValues, buildCopyValues, buildCreateDefaults, buildFetchMap, buildFormTabs, buildPermLevelMatrix, canReadLevel, canWriteLevel, computeDirtyFields, isEmptyValue, isFetchLocked, isPromptNamed, isSameValue, setCreatePrefill, takeCreatePrefill, useFormEngine, } from "./formEngine";
|
|
114
|
+
export type { BuildTabsOptions, DocFieldMeta, DocLinkMeta, DocPermissionRule, DoctypeMeta, FetchMap, FetchRule, FormEngine, FormTab, LevelPerm, PermLevelMatrix, } from "./formEngine";
|
|
112
115
|
//# sourceMappingURL=index.d.ts.map
|