@hanzo/ui 8.0.21 → 8.0.23
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/ThemeToggleNext-AEDLHX5X.js +5 -0
- package/dist/{ThemeToggleNext-OMBC67MO.js.map → ThemeToggleNext-AEDLHX5X.js.map} +1 -1
- package/dist/ThemeToggleNext-N6ASYJ6J.cjs +20 -0
- package/dist/{ThemeToggleNext-LI3SBFW7.cjs.map → ThemeToggleNext-N6ASYJ6J.cjs.map} +1 -1
- package/dist/chunk-2BM42AZR.cjs +2301 -0
- package/dist/chunk-2BM42AZR.cjs.map +1 -0
- package/dist/{chunk-T3UAC7ZZ.js → chunk-77AMCLN4.js} +4 -4
- package/dist/{chunk-T3UAC7ZZ.js.map → chunk-77AMCLN4.js.map} +1 -1
- package/dist/chunk-7P7R7FC5.js +2231 -0
- package/dist/chunk-7P7R7FC5.js.map +1 -0
- package/dist/{chunk-57YEM34R.cjs → chunk-7XDEUEWI.cjs} +11 -2
- package/dist/chunk-7XDEUEWI.cjs.map +1 -0
- package/dist/{chunk-J3P63OX6.cjs → chunk-ARV3P4CE.cjs} +5 -5
- package/dist/{chunk-J3P63OX6.cjs.map → chunk-ARV3P4CE.cjs.map} +1 -1
- package/dist/{chunk-P6IHE2O3.js → chunk-FVQXROBK.js} +11 -3
- package/dist/chunk-FVQXROBK.js.map +1 -0
- package/dist/{chunk-WN3YJYGQ.cjs → chunk-NBZDIMP3.cjs} +11 -11
- package/dist/chunk-NBZDIMP3.cjs.map +1 -0
- package/dist/{chunk-WW6C6EHS.js → chunk-P2P6ST6J.js} +4 -4
- package/dist/chunk-P2P6ST6J.js.map +1 -0
- package/dist/framework/CollectionsBrowser.d.ts +44 -0
- package/dist/framework/DocTypeDetail.d.ts +13 -0
- package/dist/framework/DocTypeRecords.d.ts +43 -0
- package/dist/framework/Loader.d.ts +4 -0
- package/dist/framework/client.d.ts +87 -0
- package/dist/framework/data.d.ts +18 -0
- package/dist/framework/fields.d.ts +75 -0
- package/dist/framework/index.d.ts +23 -0
- package/dist/framework/types.d.ts +81 -0
- package/dist/framework.cjs +757 -0
- package/dist/framework.cjs.map +1 -0
- package/dist/framework.d.ts +1 -0
- package/dist/framework.js +727 -0
- package/dist/framework.js.map +1 -0
- package/dist/product/index.cjs +323 -2340
- package/dist/product/index.cjs.map +1 -1
- package/dist/product/index.js +4 -2231
- package/dist/product/index.js.map +1 -1
- package/dist/product/instrument.d.ts +6 -0
- package/dist/product/social/index.cjs +16 -16
- package/dist/product/social/index.js +2 -2
- package/package.json +7 -1
- package/dist/ThemeToggleNext-LI3SBFW7.cjs +0 -20
- package/dist/ThemeToggleNext-OMBC67MO.js +0 -5
- package/dist/chunk-57YEM34R.cjs.map +0 -1
- package/dist/chunk-P6IHE2O3.js.map +0 -1
- package/dist/chunk-WN3YJYGQ.cjs.map +0 -1
- package/dist/chunk-WW6C6EHS.js.map +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure mapping between the Hanzo Framework DocType metadata and @hanzo/data's
|
|
3
|
+
* render model — the brain of the generic DocType renderer. It is the ONE place
|
|
4
|
+
* that translates the engine's Frappe field vocabulary into @hanzo/data's, so
|
|
5
|
+
* EVERY app lane (CMS/ERP/CRM/Helpdesk) renders list/form/detail identically with
|
|
6
|
+
* zero per-doctype code. A new DocType — or a whole new lane — "just works".
|
|
7
|
+
*
|
|
8
|
+
* No I/O, no React — data in, data out, trivially testable (the @hanzo/data
|
|
9
|
+
* imports are `import type`, erased at build, so the unit test runs in plain Node).
|
|
10
|
+
*/
|
|
11
|
+
import type { FieldDefinition, SelectOption } from '@hanzo/data';
|
|
12
|
+
import type { DocField, DocType, FrameworkDoc } from './types';
|
|
13
|
+
/** `first_name` / `firstName` → "First Name"; known acronyms upper-cased. */
|
|
14
|
+
export declare function humanize(name: string): string;
|
|
15
|
+
/** The autoname source field for a `field:xxx` rule (`""` otherwise). */
|
|
16
|
+
export declare function autonameSource(dt: DocType): string;
|
|
17
|
+
export interface FieldMapOpts {
|
|
18
|
+
/** Editing an existing record: the autoname-source field is fixed (the URL key). */
|
|
19
|
+
editing?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Map a DocType's fields to the ordered `FieldDefinition[]` every @hanzo/data view
|
|
23
|
+
* renders from. Hidden fields are dropped; the engine's readOnly is honored; and
|
|
24
|
+
* when editing an existing record the autoname source (e.g. `slug`) is made
|
|
25
|
+
* read-only because it IS the document's immutable URL key.
|
|
26
|
+
*/
|
|
27
|
+
export declare function docTypeToFields(dt: DocType, opts?: FieldMapOpts): FieldDefinition[];
|
|
28
|
+
/** The status field a publishable content type uses (a Select including "Published"). */
|
|
29
|
+
export declare function statusField(dt: DocType): string;
|
|
30
|
+
/** Fields shown as table columns: the `inListView` subset (all, if none flagged). */
|
|
31
|
+
export declare function listHiddenFields(dt: DocType): string[];
|
|
32
|
+
/** True when a DocType is a media/asset library (a required Attach) → grid view. */
|
|
33
|
+
export declare function isMediaDoctype(dt: DocType): boolean;
|
|
34
|
+
/** The primary Attach field name (the asset URL) of a media doctype. */
|
|
35
|
+
export declare function mediaFileField(dt: DocType): string;
|
|
36
|
+
/** DocTypes belonging to an app lane (module) — a CMS "collection" is one of these. */
|
|
37
|
+
export declare function moduleDoctypes(dts: DocType[], module: string): DocType[];
|
|
38
|
+
/** The conventional field a collection uses to scope documents to a project. */
|
|
39
|
+
export declare const PROJECT_FIELD = "project";
|
|
40
|
+
/** True when a DocType declares the `project` scope field (→ project filtering works). */
|
|
41
|
+
export declare function hasProjectField(dt: DocType): boolean;
|
|
42
|
+
/** A record's human title — the DocType's titleField, else its name. */
|
|
43
|
+
export declare function titleOf(doc: Record<string, unknown>, dt: DocType): string;
|
|
44
|
+
/**
|
|
45
|
+
* URL-safe slug from arbitrary text: lower-case, any run of non-alphanumerics
|
|
46
|
+
* collapsed to a single dash, ends trimmed. Guarantees a no-space, `%`-free
|
|
47
|
+
* document name (the engine and the console's own proxy path both require it).
|
|
48
|
+
*/
|
|
49
|
+
export declare function slugify(s: unknown): string;
|
|
50
|
+
/** Valid Pascal/slug DocType name (letters/digits/dash/underscore, alnum-led, no space). */
|
|
51
|
+
export declare function isValidDoctypeName(name: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* A framework document → a flat @hanzo/data record: the field values coerced to
|
|
54
|
+
* their display shapes, plus `id` (the record key every view uses) and the managed
|
|
55
|
+
* envelope. The ONE read mapping every DocType view shares.
|
|
56
|
+
*/
|
|
57
|
+
export declare function toRecord(doc: FrameworkDoc, dt: DocType): Record<string, unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* Enrich a record's Link values with the target's human label ({id,label}), so a
|
|
60
|
+
* relation renders as its title (not a raw id) in BOTH the list cell and the
|
|
61
|
+
* detail — @hanzo/data's relation display reads `.label`, its input reads `.id`.
|
|
62
|
+
* `optionsByField` is the loaded picker options per Link field (value=id, label=title).
|
|
63
|
+
*/
|
|
64
|
+
export declare function enrichLinks(record: Record<string, unknown>, dt: DocType, optionsByField: Record<string, SelectOption[]>): Record<string, unknown>;
|
|
65
|
+
/** The Link fields of a DocType (their options must be loaded for the picker). */
|
|
66
|
+
export declare function linkFields(dt: DocType): DocField[];
|
|
67
|
+
/** A blank create-form draft seeded with each field's declared default (Check → bool). */
|
|
68
|
+
export declare function newDraft(dt: DocType): Record<string, unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* A draft record → the framework write body: editable field values only (the
|
|
71
|
+
* engine owns `name`/`docstatus`/timestamps), each coerced to its wire shape, and
|
|
72
|
+
* the autoname source (e.g. `slug`) slugified so the document name is always URL-
|
|
73
|
+
* safe. Fields left `undefined` are dropped — a partial edit never nulls a value.
|
|
74
|
+
*/
|
|
75
|
+
export declare function savePayload(draft: Record<string, unknown>, dt: DocType): Record<string, unknown>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@hanzo/ui/framework` — the generic renderer for the Hanzo Framework DocType
|
|
3
|
+
* engine (cloud `clients/framework`, /v1/framework/*).
|
|
4
|
+
*
|
|
5
|
+
* The engine's thesis is that a business app IS a set of DocTypes: an ERP Sales
|
|
6
|
+
* Order, a CRM Deal, a CMS Page and a Helpdesk Ticket differ only in metadata.
|
|
7
|
+
* This module is the other half of that thesis — ONE list, ONE detail, ONE form,
|
|
8
|
+
* driven entirely by that metadata, so every lane renders with zero per-app UI.
|
|
9
|
+
*
|
|
10
|
+
* Three seams keep it host-agnostic:
|
|
11
|
+
* • `Transport` — how a host reaches /v1/framework (BFF proxy vs IAM bearer).
|
|
12
|
+
* • `renderBuilder` — schema AUTHORING, which only an admin surface offers.
|
|
13
|
+
* • `renderMedia` — an asset gallery, which needs the host's object store.
|
|
14
|
+
* Anything a host does not supply is simply not offered; nothing is faked.
|
|
15
|
+
*/
|
|
16
|
+
export * from './types';
|
|
17
|
+
export * from './fields';
|
|
18
|
+
export * from './client';
|
|
19
|
+
export * from './data';
|
|
20
|
+
export { Loader } from './Loader';
|
|
21
|
+
export { CollectionsBrowser, type CollectionsBrowserProps } from './CollectionsBrowser';
|
|
22
|
+
export { DocTypeRecords, type DocTypeRecordsProps } from './DocTypeRecords';
|
|
23
|
+
export { DocTypeDetail, type DocTypeDetailProps } from './DocTypeDetail';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Hanzo Framework wire types — the DocType/DocField/document contract the
|
|
3
|
+
* cloud `clients/framework` engine serves at /v1/framework/* (Frappe's DocType
|
|
4
|
+
* metadata core, rebuilt native in Go). These mirror the Go JSON tags exactly.
|
|
5
|
+
*
|
|
6
|
+
* This is the ONE metadata vocabulary the generic @hanzo/data DocType renderer
|
|
7
|
+
* builds from, so CMS/ERP/CRM/Helpdesk — all "just DocTypes" on the engine —
|
|
8
|
+
* render through the SAME components. Types only; no runtime.
|
|
9
|
+
*/
|
|
10
|
+
/** The engine's closed fieldtype set (mirrors clients/framework/doctype.go). */
|
|
11
|
+
export type Fieldtype = 'Data' | 'Int' | 'Float' | 'Currency' | 'Check' | 'Date' | 'Datetime' | 'Text' | 'SmallText' | 'LongText' | 'RichText' | 'Select' | 'Link' | 'Table' | 'Attach' | 'JSON' | 'Password';
|
|
12
|
+
/** One field of a DocType (Frappe's DocField). */
|
|
13
|
+
export interface DocField {
|
|
14
|
+
fieldname: string;
|
|
15
|
+
fieldtype: Fieldtype;
|
|
16
|
+
label?: string;
|
|
17
|
+
reqd?: boolean;
|
|
18
|
+
/** Select → newline-separated choices; Link → target DocType; Table → child DocType. */
|
|
19
|
+
options?: string;
|
|
20
|
+
default?: string;
|
|
21
|
+
unique?: boolean;
|
|
22
|
+
readOnly?: boolean;
|
|
23
|
+
hidden?: boolean;
|
|
24
|
+
inListView?: boolean;
|
|
25
|
+
fetchFrom?: string;
|
|
26
|
+
}
|
|
27
|
+
/** A role's rights on a DocType (Frappe's DocPerm). */
|
|
28
|
+
export interface DocPerm {
|
|
29
|
+
role: string;
|
|
30
|
+
read?: boolean;
|
|
31
|
+
write?: boolean;
|
|
32
|
+
create?: boolean;
|
|
33
|
+
delete?: boolean;
|
|
34
|
+
submit?: boolean;
|
|
35
|
+
cancel?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** A DocType definition — per-org metadata. */
|
|
38
|
+
export interface DocType {
|
|
39
|
+
name: string;
|
|
40
|
+
module?: string;
|
|
41
|
+
isSingle?: boolean;
|
|
42
|
+
isSubmittable?: boolean;
|
|
43
|
+
autoname?: string;
|
|
44
|
+
titleField?: string;
|
|
45
|
+
fields: DocField[];
|
|
46
|
+
permissions?: DocPerm[];
|
|
47
|
+
createdAt?: number;
|
|
48
|
+
updatedAt?: number;
|
|
49
|
+
}
|
|
50
|
+
/** The managed document envelope keys the engine always returns. */
|
|
51
|
+
export interface DocEnvelope {
|
|
52
|
+
name: string;
|
|
53
|
+
doctype: string;
|
|
54
|
+
/** 0 = draft, 1 = submitted, 2 = cancelled. */
|
|
55
|
+
docstatus: number;
|
|
56
|
+
createdAt: number;
|
|
57
|
+
updatedAt: number;
|
|
58
|
+
}
|
|
59
|
+
/** A document: the field data overlaid with the managed envelope keys. */
|
|
60
|
+
export type FrameworkDoc = Record<string, unknown> & DocEnvelope;
|
|
61
|
+
/** A registered app lane and (optionally, per-org) which fixtures are installed. */
|
|
62
|
+
export interface ModuleInfo {
|
|
63
|
+
module: string;
|
|
64
|
+
doctypes: string[];
|
|
65
|
+
installed?: string[];
|
|
66
|
+
}
|
|
67
|
+
/** The result of installing a module into the caller's org. */
|
|
68
|
+
export interface InstallResult {
|
|
69
|
+
module: string;
|
|
70
|
+
created: string[];
|
|
71
|
+
existing: string[];
|
|
72
|
+
}
|
|
73
|
+
/** List query for the generic document surface. */
|
|
74
|
+
export interface ListQuery {
|
|
75
|
+
filters?: Record<string, string | number | boolean>;
|
|
76
|
+
fields?: string[];
|
|
77
|
+
orderBy?: string;
|
|
78
|
+
limit?: number;
|
|
79
|
+
}
|
|
80
|
+
/** The redacted-Password marker the engine returns for a set secret. */
|
|
81
|
+
export declare const REDACTED_MARKER = "__set__";
|