@zeyos/zx 2.1.0 → 2.2.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/CHANGELOG.md +39 -0
- package/README.md +15 -0
- package/dist/types/compat/base.d.ts +156 -0
- package/dist/types/compat/globals.d.ts +20 -0
- package/dist/types/compat/index.d.ts +128 -0
- package/dist/types/compat/map/basic.d.ts +175 -0
- package/dist/types/compat/map/data.d.ts +102 -0
- package/dist/types/compat/map/date-time.d.ts +80 -0
- package/dist/types/compat/map/factory.d.ts +9 -0
- package/dist/types/compat/map/form.d.ts +98 -0
- package/dist/types/compat/map/helpers.d.ts +12 -0
- package/dist/types/compat/map/http.d.ts +36 -0
- package/dist/types/compat/map/layout.d.ts +106 -0
- package/dist/types/compat/map/options.d.ts +80 -0
- package/dist/types/compat/map/select.d.ts +95 -0
- package/dist/types/compat/map/stubs.d.ts +32 -0
- package/dist/types/compat/map/utilities.d.ts +37 -0
- package/dist/types/compat-entry.d.ts +5 -0
- package/dist/types/components/badge/badge.d.ts +46 -0
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +200 -0
- package/dist/types/components/button/button.d.ts +42 -0
- package/dist/types/components/check-button/check-button.d.ts +98 -0
- package/dist/types/components/checklist/checklist.d.ts +143 -0
- package/dist/types/components/checklist/field-adapter.d.ts +5 -0
- package/dist/types/components/context-menu/context-menu.d.ts +130 -0
- package/dist/types/components/copy/copy-button.d.ts +48 -0
- package/dist/types/components/copy/copy-input.d.ts +91 -0
- package/dist/types/components/data-filter/data-filter.d.ts +250 -0
- package/dist/types/components/data-filter/filter-core.d.ts +52 -0
- package/dist/types/components/date-picker/date-picker.d.ts +137 -0
- package/dist/types/components/date-picker/date-range-picker.d.ts +350 -0
- package/dist/types/components/date-picker/field-adapter.d.ts +6 -0
- package/dist/types/components/date-picker/month-picker.d.ts +75 -0
- package/dist/types/components/date-picker/range-field-adapter.d.ts +7 -0
- package/dist/types/components/date-picker/time-picker.d.ts +127 -0
- package/dist/types/components/datebox/date-range-box.d.ts +218 -0
- package/dist/types/components/datebox/datebox.d.ts +160 -0
- package/dist/types/components/datebox/field-adapter.d.ts +5 -0
- package/dist/types/components/dialog/dialog.d.ts +284 -0
- package/dist/types/components/dropdown/dropdown.d.ts +118 -0
- package/dist/types/components/empty-state/empty-state.d.ts +38 -0
- package/dist/types/components/field/field.d.ts +231 -0
- package/dist/types/components/field-upload/field-adapter.d.ts +5 -0
- package/dist/types/components/field-upload/field-upload.d.ts +213 -0
- package/dist/types/components/fieldset/fieldset.d.ts +125 -0
- package/dist/types/components/finder/finder.d.ts +252 -0
- package/dist/types/components/form/form.d.ts +194 -0
- package/dist/types/components/groupbox/groupbox.d.ts +89 -0
- package/dist/types/components/layout/layout.d.ts +132 -0
- package/dist/types/components/loading/inline-loading.d.ts +86 -0
- package/dist/types/components/loading/progress-bar.d.ts +168 -0
- package/dist/types/components/loading/spinner.d.ts +34 -0
- package/dist/types/components/master-panel/master-panel.d.ts +112 -0
- package/dist/types/components/menu-button/menu-button.d.ts +142 -0
- package/dist/types/components/message/message.d.ts +212 -0
- package/dist/types/components/modal/modal.d.ts +105 -0
- package/dist/types/components/multi-value-editor/field-adapter.d.ts +5 -0
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +66 -0
- package/dist/types/components/navigation-bar/navigation-bar.d.ts +229 -0
- package/dist/types/components/number-field/field-adapter.d.ts +5 -0
- package/dist/types/components/number-field/number-field.d.ts +292 -0
- package/dist/types/components/pagination/pagination.d.ts +267 -0
- package/dist/types/components/panel/panel.d.ts +194 -0
- package/dist/types/components/permission/permission.d.ts +93 -0
- package/dist/types/components/rating/field-adapter.d.ts +5 -0
- package/dist/types/components/rating/rating.d.ts +213 -0
- package/dist/types/components/search/search.d.ts +98 -0
- package/dist/types/components/select/field-adapter.d.ts +5 -0
- package/dist/types/components/select/filter.d.ts +11 -0
- package/dist/types/components/select/select.d.ts +235 -0
- package/dist/types/components/skeleton/skeleton.d.ts +97 -0
- package/dist/types/components/slider/field-adapter.d.ts +5 -0
- package/dist/types/components/slider/slider.d.ts +216 -0
- package/dist/types/components/split-view/split-view.d.ts +335 -0
- package/dist/types/components/stepper/stepper.d.ts +314 -0
- package/dist/types/components/stepper/steps.d.ts +131 -0
- package/dist/types/components/tabbox/tabbox.d.ts +230 -0
- package/dist/types/components/table/sort.d.ts +49 -0
- package/dist/types/components/table/table.d.ts +872 -0
- package/dist/types/components/tag-picker/field-adapter.d.ts +5 -0
- package/dist/types/components/tag-picker/tag-picker.d.ts +375 -0
- package/dist/types/components/timebox/field-adapter.d.ts +5 -0
- package/dist/types/components/timebox/timebox.d.ts +121 -0
- package/dist/types/components/toggle/field-adapter.d.ts +5 -0
- package/dist/types/components/toggle/toggle.d.ts +94 -0
- package/dist/types/components/toolbar/toolbar.d.ts +230 -0
- package/dist/types/components/tooltip/tooltip.d.ts +183 -0
- package/dist/types/components/tree/hierarchy.d.ts +113 -0
- package/dist/types/components/tree/tree.d.ts +383 -0
- package/dist/types/components/truncate/truncate.d.ts +61 -0
- package/dist/types/components/value-list/field-adapter.d.ts +5 -0
- package/dist/types/components/value-list/value-list.d.ts +143 -0
- package/dist/types/core/breakpoint.d.ts +68 -0
- package/dist/types/core/component.d.ts +115 -0
- package/dist/types/core/date.d.ts +50 -0
- package/dist/types/core/dom.d.ts +86 -0
- package/dist/types/core/export.d.ts +70 -0
- package/dist/types/core/fontawesome.d.ts +107 -0
- package/dist/types/core/format.d.ts +107 -0
- package/dist/types/core/http.d.ts +122 -0
- package/dist/types/core/i18n.d.ts +35 -0
- package/dist/types/core/icons.d.ts +137 -0
- package/dist/types/core/keyboard.d.ts +72 -0
- package/dist/types/core/position.d.ts +45 -0
- package/dist/types/core/storage.d.ts +46 -0
- package/dist/types/core/util.d.ts +117 -0
- package/dist/types/elements/define.d.ts +73 -0
- package/dist/types/elements/reflect.d.ts +27 -0
- package/dist/types/index.d.ts +79 -0
- package/dist/types/zeyos/connect.d.ts +65 -0
- package/dist/types/zeyos/form.d.ts +140 -0
- package/dist/types/zeyos/icons.d.ts +104 -0
- package/dist/types/zeyos/index.d.ts +12 -0
- package/dist/types/zeyos/modules.d.ts +110 -0
- package/dist/types/zeyos/query.d.ts +157 -0
- package/dist/types/zeyos/schema.d.ts +79 -0
- package/dist/types/zeyos/select.d.ts +167 -0
- package/dist/types/zeyos/table.d.ts +205 -0
- package/dist/zx-compat.esm.js +362 -33
- package/dist/zx-compat.esm.min.js +1 -1
- package/dist/zx-compat.global.js +359 -67
- package/dist/zx-compat.global.min.js +3 -3
- package/dist/zx-zeyos.esm.js +342 -43
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +68 -6
- package/dist/zx.esm.js +346 -67
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +346 -67
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +48 -2
- package/docs/llms.md +28 -0
- package/package.json +37 -9
- package/src/compat/base.js +291 -0
- package/src/compat/globals.js +165 -0
- package/src/compat/index.js +84 -0
- package/src/compat/map/basic.js +464 -0
- package/src/compat/map/data.js +232 -0
- package/src/compat/map/date-time.js +177 -0
- package/src/compat/map/factory.js +45 -0
- package/src/compat/map/form.js +330 -0
- package/src/compat/map/helpers.js +46 -0
- package/src/compat/map/http.js +117 -0
- package/src/compat/map/layout.js +256 -0
- package/src/compat/map/options.js +267 -0
- package/src/compat/map/select.js +198 -0
- package/src/compat/map/stubs.js +26 -0
- package/src/compat/map/utilities.js +113 -0
- package/src/compat-entry.js +11 -0
- package/src/components/badge/badge.css +147 -0
- package/src/components/badge/badge.js +92 -0
- package/src/components/breadcrumb/breadcrumb.css +105 -0
- package/src/components/breadcrumb/breadcrumb.js +331 -0
- package/src/components/button/button.css +104 -0
- package/src/components/button/button.js +76 -0
- package/src/components/check-button/check-button.css +66 -0
- package/src/components/check-button/check-button.js +167 -0
- package/src/components/checklist/checklist.css +65 -0
- package/src/components/checklist/checklist.js +282 -0
- package/src/components/checklist/field-adapter.js +46 -0
- package/src/components/context-menu/context-menu.css +54 -0
- package/src/components/context-menu/context-menu.js +334 -0
- package/src/components/copy/copy-button.css +27 -0
- package/src/components/copy/copy-button.js +78 -0
- package/src/components/copy/copy-input.css +59 -0
- package/src/components/copy/copy-input.js +123 -0
- package/src/components/data-filter/data-filter.css +53 -0
- package/src/components/data-filter/data-filter.js +400 -0
- package/src/components/data-filter/filter-core.js +128 -0
- package/src/components/date-picker/date-picker.css +181 -0
- package/src/components/date-picker/date-picker.js +500 -0
- package/src/components/date-picker/date-range-picker.css +264 -0
- package/src/components/date-picker/date-range-picker.js +990 -0
- package/src/components/date-picker/field-adapter.js +36 -0
- package/src/components/date-picker/month-picker.js +223 -0
- package/src/components/date-picker/range-field-adapter.js +31 -0
- package/src/components/date-picker/time-picker.css +191 -0
- package/src/components/date-picker/time-picker.js +406 -0
- package/src/components/datebox/date-range-box.css +128 -0
- package/src/components/datebox/date-range-box.js +492 -0
- package/src/components/datebox/datebox.css +108 -0
- package/src/components/datebox/datebox.js +358 -0
- package/src/components/datebox/field-adapter.js +34 -0
- package/src/components/dialog/dialog.css +74 -0
- package/src/components/dialog/dialog.js +450 -0
- package/src/components/dropdown/dropdown.css +24 -0
- package/src/components/dropdown/dropdown.js +288 -0
- package/src/components/empty-state/empty-state.css +80 -0
- package/src/components/empty-state/empty-state.js +92 -0
- package/src/components/field/field.css +127 -0
- package/src/components/field/field.js +605 -0
- package/src/components/field-upload/field-adapter.js +21 -0
- package/src/components/field-upload/field-upload.css +108 -0
- package/src/components/field-upload/field-upload.js +475 -0
- package/src/components/fieldset/fieldset.css +37 -0
- package/src/components/fieldset/fieldset.js +307 -0
- package/src/components/finder/finder.css +98 -0
- package/src/components/finder/finder.js +509 -0
- package/src/components/form/form.css +32 -0
- package/src/components/form/form.js +302 -0
- package/src/components/groupbox/groupbox.css +51 -0
- package/src/components/groupbox/groupbox.js +199 -0
- package/src/components/layout/layout.css +117 -0
- package/src/components/layout/layout.js +136 -0
- package/src/components/loading/inline-loading.css +34 -0
- package/src/components/loading/inline-loading.js +140 -0
- package/src/components/loading/progress-bar.css +115 -0
- package/src/components/loading/progress-bar.js +259 -0
- package/src/components/loading/spinner.css +58 -0
- package/src/components/loading/spinner.js +57 -0
- package/src/components/master-panel/master-panel.css +51 -0
- package/src/components/master-panel/master-panel.js +203 -0
- package/src/components/menu-button/menu-button.css +49 -0
- package/src/components/menu-button/menu-button.js +294 -0
- package/src/components/message/message.css +122 -0
- package/src/components/message/message.js +499 -0
- package/src/components/modal/modal.css +47 -0
- package/src/components/modal/modal.js +203 -0
- package/src/components/multi-value-editor/field-adapter.js +44 -0
- package/src/components/multi-value-editor/multi-value-editor.css +56 -0
- package/src/components/multi-value-editor/multi-value-editor.js +170 -0
- package/src/components/navigation-bar/navigation-bar.css +130 -0
- package/src/components/navigation-bar/navigation-bar.js +450 -0
- package/src/components/number-field/field-adapter.js +40 -0
- package/src/components/number-field/number-field.css +77 -0
- package/src/components/number-field/number-field.js +545 -0
- package/src/components/pagination/pagination.css +95 -0
- package/src/components/pagination/pagination.js +481 -0
- package/src/components/panel/panel.css +123 -0
- package/src/components/panel/panel.js +336 -0
- package/src/components/permission/permission.css +47 -0
- package/src/components/permission/permission.js +198 -0
- package/src/components/rating/field-adapter.js +34 -0
- package/src/components/rating/rating.css +97 -0
- package/src/components/rating/rating.js +395 -0
- package/src/components/search/search.css +70 -0
- package/src/components/search/search.js +193 -0
- package/src/components/select/field-adapter.js +24 -0
- package/src/components/select/filter.js +39 -0
- package/src/components/select/select.css +180 -0
- package/src/components/select/select.js +663 -0
- package/src/components/skeleton/skeleton.css +76 -0
- package/src/components/skeleton/skeleton.js +139 -0
- package/src/components/slider/field-adapter.js +36 -0
- package/src/components/slider/slider.css +181 -0
- package/src/components/slider/slider.js +399 -0
- package/src/components/split-view/split-view.css +139 -0
- package/src/components/split-view/split-view.js +806 -0
- package/src/components/stepper/stepper.css +234 -0
- package/src/components/stepper/stepper.js +459 -0
- package/src/components/stepper/steps.js +131 -0
- package/src/components/tabbox/tabbox.css +281 -0
- package/src/components/tabbox/tabbox.js +484 -0
- package/src/components/table/sort.js +85 -0
- package/src/components/table/table.css +364 -0
- package/src/components/table/table.js +1693 -0
- package/src/components/tag-picker/field-adapter.js +35 -0
- package/src/components/tag-picker/tag-picker.css +169 -0
- package/src/components/tag-picker/tag-picker.js +837 -0
- package/src/components/timebox/field-adapter.js +24 -0
- package/src/components/timebox/timebox.css +51 -0
- package/src/components/timebox/timebox.js +276 -0
- package/src/components/toggle/field-adapter.js +24 -0
- package/src/components/toggle/toggle.css +66 -0
- package/src/components/toggle/toggle.js +150 -0
- package/src/components/toolbar/toolbar.css +81 -0
- package/src/components/toolbar/toolbar.js +511 -0
- package/src/components/tooltip/tooltip.css +36 -0
- package/src/components/tooltip/tooltip.js +420 -0
- package/src/components/tree/hierarchy.js +151 -0
- package/src/components/tree/tree.css +99 -0
- package/src/components/tree/tree.js +784 -0
- package/src/components/truncate/truncate.css +20 -0
- package/src/components/truncate/truncate.js +92 -0
- package/src/components/value-list/field-adapter.js +24 -0
- package/src/components/value-list/value-list.css +108 -0
- package/src/components/value-list/value-list.js +336 -0
- package/src/core/breakpoint.js +150 -0
- package/src/core/component.js +292 -0
- package/src/core/date.js +216 -0
- package/src/core/dom.js +260 -0
- package/src/core/export.js +204 -0
- package/src/core/fontawesome.js +177 -0
- package/src/core/format.js +283 -0
- package/src/core/http.js +246 -0
- package/src/core/i18n.js +83 -0
- package/src/core/icons.js +283 -0
- package/src/core/keyboard.js +240 -0
- package/src/core/position.js +177 -0
- package/src/core/storage.js +175 -0
- package/src/core/util.js +336 -0
- package/src/elements/define.js +715 -0
- package/src/elements/reflect.js +79 -0
- package/src/index.js +131 -0
- package/src/zeyos/connect.js +142 -0
- package/src/zeyos/form.js +254 -0
- package/src/zeyos/icons.js +92 -0
- package/src/zeyos/index.js +21 -0
- package/src/zeyos/modules.js +269 -0
- package/src/zeyos/query.js +199 -0
- package/src/zeyos/schema.js +474 -0
- package/src/zeyos/select.js +175 -0
- package/src/zeyos/table.js +272 -0
- package/styles/base.css +124 -0
- package/styles/icons.css +34 -0
- package/styles/tokens/dark.css +84 -0
- package/styles/tokens/density.css +9 -0
- package/styles/tokens/global.css +80 -0
- package/styles/tokens/modules.css +109 -0
- package/styles/tokens/semantic.css +49 -0
- package/styles/zx.css +61 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export type ConnectOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Error reporter.
|
|
4
|
+
*/
|
|
5
|
+
onError?: (error: unknown, context?: {
|
|
6
|
+
operation?: string;
|
|
7
|
+
resource?: string;
|
|
8
|
+
}) => unknown;
|
|
9
|
+
/**
|
|
10
|
+
* BCP 47 locale applied to Zx i18n/date formatting.
|
|
11
|
+
*/
|
|
12
|
+
locale?: string;
|
|
13
|
+
};
|
|
14
|
+
export type ZeyosFacade = {
|
|
15
|
+
/**
|
|
16
|
+
* Injected client instance.
|
|
17
|
+
*/
|
|
18
|
+
client: Record<string, any>;
|
|
19
|
+
/**
|
|
20
|
+
* List a resource.
|
|
21
|
+
*/
|
|
22
|
+
list: (resource: string, params?: Record<string, unknown>) => Promise<unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* Fetch one record.
|
|
25
|
+
*/
|
|
26
|
+
get: (resource: string, idOrParams: unknown, params?: Record<string, unknown>) => Promise<unknown>;
|
|
27
|
+
/**
|
|
28
|
+
* Create one record.
|
|
29
|
+
*/
|
|
30
|
+
create: (resource: string, data: Record<string, unknown>) => Promise<unknown>;
|
|
31
|
+
/**
|
|
32
|
+
* Update one record.
|
|
33
|
+
*/
|
|
34
|
+
update: (resource: string, idOrInput: unknown, data?: Record<string, unknown>) => Promise<unknown>;
|
|
35
|
+
/**
|
|
36
|
+
* Report an API error.
|
|
37
|
+
*/
|
|
38
|
+
reportError: (error: unknown, context?: {
|
|
39
|
+
operation?: string;
|
|
40
|
+
resource?: string;
|
|
41
|
+
}) => unknown;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* @typedef {Object} ConnectOptions
|
|
45
|
+
* @property {(error: unknown, context?: {operation?: string, resource?: string}) => unknown} [onError] Error reporter.
|
|
46
|
+
* @property {string} [locale] BCP 47 locale applied to Zx i18n/date formatting.
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* @typedef {Object} ZeyosFacade
|
|
50
|
+
* @property {Record<string, any>} client Injected client instance.
|
|
51
|
+
* @property {(resource: string, params?: Record<string, unknown>) => Promise<unknown>} list List a resource.
|
|
52
|
+
* @property {(resource: string, idOrParams: unknown, params?: Record<string, unknown>) => Promise<unknown>} get Fetch one record.
|
|
53
|
+
* @property {(resource: string, data: Record<string, unknown>) => Promise<unknown>} create Create one record.
|
|
54
|
+
* @property {(resource: string, idOrInput: unknown, data?: Record<string, unknown>) => Promise<unknown>} update Update one record.
|
|
55
|
+
* @property {(error: unknown, context?: {operation?: string, resource?: string}) => unknown} reportError Report an API error.
|
|
56
|
+
*/
|
|
57
|
+
/**
|
|
58
|
+
* Connects an existing injected `@zeyos/client` instance to Zx infrastructure. This function never
|
|
59
|
+
* creates or imports the client package. It applies a supplied/derivable locale and returns thin
|
|
60
|
+
* operation helpers that report and rethrow failures.
|
|
61
|
+
* @param {Record<string, any>} client Injected ZeyOS client instance.
|
|
62
|
+
* @param {ConnectOptions} [options={}] Wiring options.
|
|
63
|
+
* @returns {ZeyosFacade} Bound facade.
|
|
64
|
+
*/
|
|
65
|
+
export declare function connect(client: Record<string, any>, { onError, locale }?: ConnectOptions): ZeyosFacade;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Form } from '../index.js';
|
|
2
|
+
export type ZeyosFormOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Curated ordered field allow-list.
|
|
5
|
+
*/
|
|
6
|
+
fields?: string[];
|
|
7
|
+
/**
|
|
8
|
+
* Field ids to omit.
|
|
9
|
+
*/
|
|
10
|
+
exclude?: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Per-field label overrides.
|
|
13
|
+
*/
|
|
14
|
+
labels?: Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Fieldset legend.
|
|
17
|
+
*/
|
|
18
|
+
title?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Fieldset column count.
|
|
21
|
+
*/
|
|
22
|
+
columns?: 1 | 2 | 3;
|
|
23
|
+
/**
|
|
24
|
+
* Initial record using ZeyOS storage values.
|
|
25
|
+
*/
|
|
26
|
+
value?: Record<string, unknown>;
|
|
27
|
+
/**
|
|
28
|
+
* Initial record id to load.
|
|
29
|
+
*/
|
|
30
|
+
id?: unknown;
|
|
31
|
+
/**
|
|
32
|
+
* Success callback.
|
|
33
|
+
*/
|
|
34
|
+
onSaved?: (record: Record<string, unknown>) => unknown | Promise<unknown>;
|
|
35
|
+
};
|
|
36
|
+
export type ZeyosFormConfig = {
|
|
37
|
+
/**
|
|
38
|
+
* Ordered normalized schema metadata.
|
|
39
|
+
*/
|
|
40
|
+
fieldMeta: Record<string, any>[];
|
|
41
|
+
/**
|
|
42
|
+
* Field descriptors keyed by id.
|
|
43
|
+
*/
|
|
44
|
+
fields: Record<string, Record<string, any>>;
|
|
45
|
+
/**
|
|
46
|
+
* Referenced-resource fields.
|
|
47
|
+
*/
|
|
48
|
+
entityFields: Array<{
|
|
49
|
+
id: string;
|
|
50
|
+
resource: string;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Plain Zx Form options.
|
|
54
|
+
*/
|
|
55
|
+
formOptions: Record<string, any>;
|
|
56
|
+
/**
|
|
57
|
+
* Maps Unix seconds to Date values.
|
|
58
|
+
*/
|
|
59
|
+
mapFromRecord: (record: Record<string, unknown>) => Record<string, unknown>;
|
|
60
|
+
/**
|
|
61
|
+
* Maps Date and enum values to API storage values.
|
|
62
|
+
*/
|
|
63
|
+
mapToRecord: (values: Record<string, unknown>) => Record<string, unknown>;
|
|
64
|
+
};
|
|
65
|
+
export type ZeyosFormBinding = {
|
|
66
|
+
/**
|
|
67
|
+
* Generated Zx form.
|
|
68
|
+
*/
|
|
69
|
+
form: Form;
|
|
70
|
+
/**
|
|
71
|
+
* Initial value/load readiness.
|
|
72
|
+
*/
|
|
73
|
+
ready: Promise<Record<string, unknown> | null>;
|
|
74
|
+
/**
|
|
75
|
+
* Loads and maps one record.
|
|
76
|
+
*/
|
|
77
|
+
load: (id: unknown) => Promise<Record<string, unknown>>;
|
|
78
|
+
/**
|
|
79
|
+
* Validates and creates or updates the record.
|
|
80
|
+
*/
|
|
81
|
+
save: () => Promise<Record<string, unknown> | null>;
|
|
82
|
+
/**
|
|
83
|
+
* Returns the generated Zx Form.
|
|
84
|
+
*/
|
|
85
|
+
getForm: () => Form;
|
|
86
|
+
/**
|
|
87
|
+
* Destroys the form and all owned fields/selects.
|
|
88
|
+
*/
|
|
89
|
+
destroy: () => void;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* @typedef {Object} ZeyosFormOptions
|
|
93
|
+
* @property {string[]} [fields] Curated ordered field allow-list.
|
|
94
|
+
* @property {string[]} [exclude] Field ids to omit.
|
|
95
|
+
* @property {Record<string, string>} [labels] Per-field label overrides.
|
|
96
|
+
* @property {string} [title=''] Fieldset legend.
|
|
97
|
+
* @property {1|2|3} [columns=2] Fieldset column count.
|
|
98
|
+
* @property {Record<string, unknown>} [value] Initial record using ZeyOS storage values.
|
|
99
|
+
* @property {unknown} [id] Initial record id to load.
|
|
100
|
+
* @property {(record: Record<string, unknown>) => unknown|Promise<unknown>} [onSaved] Success callback.
|
|
101
|
+
*/
|
|
102
|
+
/**
|
|
103
|
+
* @typedef {Object} ZeyosFormConfig
|
|
104
|
+
* @property {Record<string, any>[]} fieldMeta Ordered normalized schema metadata.
|
|
105
|
+
* @property {Record<string, Record<string, any>>} fields Field descriptors keyed by id.
|
|
106
|
+
* @property {Array<{id: string, resource: string}>} entityFields Referenced-resource fields.
|
|
107
|
+
* @property {Record<string, any>} formOptions Plain Zx Form options.
|
|
108
|
+
* @property {(record: Record<string, unknown>) => Record<string, unknown>} mapFromRecord Maps Unix seconds to Date values.
|
|
109
|
+
* @property {(values: Record<string, unknown>) => Record<string, unknown>} mapToRecord Maps Date and enum values to API storage values.
|
|
110
|
+
*/
|
|
111
|
+
/**
|
|
112
|
+
* @typedef {Object} ZeyosFormBinding
|
|
113
|
+
* @property {Form} form Generated Zx form.
|
|
114
|
+
* @property {Promise<Record<string, unknown>|null>} ready Initial value/load readiness.
|
|
115
|
+
* @property {(id: unknown) => Promise<Record<string, unknown>>} load Loads and maps one record.
|
|
116
|
+
* @property {() => Promise<Record<string, unknown>|null>} save Validates and creates or updates the record.
|
|
117
|
+
* @property {() => Form} getForm Returns the generated Zx Form.
|
|
118
|
+
* @property {() => void} destroy Destroys the form and all owned fields/selects.
|
|
119
|
+
*/
|
|
120
|
+
/**
|
|
121
|
+
* Builds the DOM-free form configuration consumed by {@link zeyosForm}. Entity descriptors retain
|
|
122
|
+
* the `zxselect` type and receive the same async options used by {@link zeyosSelect}; enum options
|
|
123
|
+
* come from normalized schema metadata, and the returned mappers handle Unix-second dates.
|
|
124
|
+
* @param {Record<string, any>} client Injected ZeyOS client instance.
|
|
125
|
+
* @param {string} resource Resource name such as `transactions`.
|
|
126
|
+
* @param {ZeyosFormOptions} [opts={}] Schema curation and layout options.
|
|
127
|
+
* @returns {ZeyosFormConfig} Plain generator configuration and value mappers.
|
|
128
|
+
*/
|
|
129
|
+
export declare function buildZeyosFormConfig(client: Record<string, any>, resource: string, opts?: ZeyosFormOptions): ZeyosFormConfig;
|
|
130
|
+
/**
|
|
131
|
+
* Generates a schema-driven Zx Form and a small async binding object. `load(id)` hydrates entity
|
|
132
|
+
* labels and converts Unix seconds to Date objects. `save()` validates, maps values back to API
|
|
133
|
+
* storage types, calls create/update through the WP14 connection facade, shows a success toast,
|
|
134
|
+
* and invokes `onSaved(record)`. Await `ready` when `opts.id` or `opts.value` is supplied.
|
|
135
|
+
* @param {Record<string, any>} client Injected ZeyOS client instance.
|
|
136
|
+
* @param {string} resource Resource name such as `transactions`.
|
|
137
|
+
* @param {ZeyosFormOptions} [opts={}] Schema, initial value, and save options.
|
|
138
|
+
* @returns {ZeyosFormBinding} Generated form and lifecycle/data methods.
|
|
139
|
+
*/
|
|
140
|
+
export declare function zeyosForm(client: Record<string, any>, resource: string, opts?: ZeyosFormOptions): ZeyosFormBinding;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZeyOS module icons: the Font Awesome kit that carries them, and the two renderers built on the
|
|
3
|
+
* configuration in `./modules.js`.
|
|
4
|
+
* @module zx/zeyos/icons
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The ZeyOS Font Awesome kit. It carries the licensed Font Awesome styles plus the custom
|
|
8
|
+
* `zeyos-*` module glyphs, which render as `<i class="fa-kit fa-zeyos-notes">`.
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
export declare const ZEYOS_ICON_KIT: string;
|
|
12
|
+
/**
|
|
13
|
+
* Loads the ZeyOS kit and makes Font Awesome the renderer for every Zx icon. Call it once at
|
|
14
|
+
* startup; repeat calls reuse the first load.
|
|
15
|
+
* @param {{kit?: string, style?: string, family?: string, fixedWidth?: boolean}} [options={}]
|
|
16
|
+
* Overrides — a different kit, or a different default style such as `'duotone'`.
|
|
17
|
+
* @returns {Promise<object>} Resolves with the icon configuration once the kit has loaded.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useZeyosIcons(options?: {
|
|
20
|
+
kit?: string;
|
|
21
|
+
style?: string;
|
|
22
|
+
family?: string;
|
|
23
|
+
fixedWidth?: boolean;
|
|
24
|
+
}): Promise<object>;
|
|
25
|
+
export type ModuleIconOptions = {
|
|
26
|
+
/**
|
|
27
|
+
* Rendered size.
|
|
28
|
+
*/
|
|
29
|
+
size?: number | string;
|
|
30
|
+
/**
|
|
31
|
+
* Accessible label; null marks the icon decorative.
|
|
32
|
+
*/
|
|
33
|
+
label?: string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Render the stock Font Awesome fallback instead of the
|
|
36
|
+
* kit's custom glyph — for pages running on a kit without the ZeyOS icon uploads.
|
|
37
|
+
*/
|
|
38
|
+
standard?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Extra class names.
|
|
41
|
+
*/
|
|
42
|
+
class?: string | string[];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* @typedef {Object} ModuleIconOptions
|
|
46
|
+
* @property {number|string} [size=16] Rendered size.
|
|
47
|
+
* @property {string|null} [label=null] Accessible label; null marks the icon decorative.
|
|
48
|
+
* @property {boolean} [standard=false] Render the stock Font Awesome fallback instead of the
|
|
49
|
+
* kit's custom glyph — for pages running on a kit without the ZeyOS icon uploads.
|
|
50
|
+
* @property {string|string[]} [class] Extra class names.
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Creates a module's icon. Module, entity, and API resource names are all accepted
|
|
54
|
+
* (`'notes'`, `'transactions.billing'`, `'invoices'`); unknown names fall back to the ZeyOS
|
|
55
|
+
* default glyph.
|
|
56
|
+
* @param {string} name Module, entity, or resource name.
|
|
57
|
+
* @param {ModuleIconOptions} [options={}] Display and accessibility options.
|
|
58
|
+
* @returns {HTMLElement} An `<i>` element carrying the Font Awesome classes.
|
|
59
|
+
*/
|
|
60
|
+
export declare function moduleIcon(name: string, options?: ModuleIconOptions): HTMLElement;
|
|
61
|
+
export type ModuleChipOptions = {
|
|
62
|
+
/**
|
|
63
|
+
* Chip edge length.
|
|
64
|
+
*/
|
|
65
|
+
size?: number | string;
|
|
66
|
+
/**
|
|
67
|
+
* Glyph size; `1em` is 60% of the chip edge.
|
|
68
|
+
*/
|
|
69
|
+
iconSize?: number | string;
|
|
70
|
+
/**
|
|
71
|
+
* Accessible label; null marks the chip decorative.
|
|
72
|
+
*/
|
|
73
|
+
label?: string | null;
|
|
74
|
+
/**
|
|
75
|
+
* Adds the module's display name as a `title` tooltip.
|
|
76
|
+
*/
|
|
77
|
+
title?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Use the stock Font Awesome fallback glyph.
|
|
80
|
+
*/
|
|
81
|
+
standard?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Extra class names.
|
|
84
|
+
*/
|
|
85
|
+
class?: string | string[];
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* @typedef {Object} ModuleChipOptions
|
|
89
|
+
* @property {number|string} [size=24] Chip edge length.
|
|
90
|
+
* @property {number|string} [iconSize='1em'] Glyph size; `1em` is 60% of the chip edge.
|
|
91
|
+
* @property {string|null} [label=null] Accessible label; null marks the chip decorative.
|
|
92
|
+
* @property {boolean} [title=false] Adds the module's display name as a `title` tooltip.
|
|
93
|
+
* @property {boolean} [standard=false] Use the stock Font Awesome fallback glyph.
|
|
94
|
+
* @property {string|string[]} [class] Extra class names.
|
|
95
|
+
*/
|
|
96
|
+
/**
|
|
97
|
+
* Creates a module's icon chip: the glyph on the module's identity colour, the way ZeyOS draws
|
|
98
|
+
* module icons in navigation and record headers. The glyph colour is whichever of ZeyOS's two
|
|
99
|
+
* foregrounds contrasts better with the background.
|
|
100
|
+
* @param {string} name Module, entity, or resource name.
|
|
101
|
+
* @param {ModuleChipOptions} [options={}] Display and accessibility options.
|
|
102
|
+
* @returns {HTMLElement} A `<span class="zx-module-icon">` wrapping the glyph.
|
|
103
|
+
*/
|
|
104
|
+
export declare function moduleChip(name: string, options?: ModuleChipOptions): HTMLElement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional injection-based Zx binding for `@zeyos/client` applications.
|
|
3
|
+
* @module zx/zeyos
|
|
4
|
+
*/
|
|
5
|
+
export { fieldToZxField, fieldToZxColumn, resolveFields, registerFieldType } from './schema.js';
|
|
6
|
+
export { buildListQuery, tableSortToQuery, dataFilterStateToFilters, dateToUnixSeconds, unixSecondsToDate } from './query.js';
|
|
7
|
+
export { connect } from './connect.js';
|
|
8
|
+
export { zeyosModules, moduleAliases, moduleInfo, moduleColor, moduleIconName, moduleKeys, moduleGlyphColor, normalizeModuleName, registerModules } from './modules.js';
|
|
9
|
+
export { ZEYOS_ICON_KIT, useZeyosIcons, moduleIcon, moduleChip } from './icons.js';
|
|
10
|
+
export { zeyosSelect } from './select.js';
|
|
11
|
+
export { zeyosForm } from './form.js';
|
|
12
|
+
export { zeyosTable } from './table.js';
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZeyOS module and entity identity — the icon and the colour each one is drawn with.
|
|
3
|
+
*
|
|
4
|
+
* This is the configuration file the rest of the ZeyOS layer reads. One entry per module:
|
|
5
|
+
*
|
|
6
|
+
* ```js
|
|
7
|
+
* notes: { label: 'Notes', icon: 'zeyos-notes', color: '#008853', fa: 'note-sticky' }
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* - `icon` is the icon's name in the ZeyOS Font Awesome kit; it renders as
|
|
11
|
+
* `<i class="fa-kit fa-zeyos-notes">` and needs the kit loaded (see `./icons.js`).
|
|
12
|
+
* - `fa` is a stock Font Awesome name used when the custom icons are unavailable — every one of
|
|
13
|
+
* them exists in Font Awesome Free, so the fallback also works on a Free kit.
|
|
14
|
+
* - `color` is the module's identity colour, used for icon chips and header accents. Colours
|
|
15
|
+
* marked "ZeyOS runtime" below are the values ZeyOS itself ships (`ICO.Colors`); the rest are
|
|
16
|
+
* Zx defaults for modules ZeyOS has no colour for. Both are overridable: a ZeyOS menu payload
|
|
17
|
+
* is authoritative, so pass its colours to `registerModules()` at startup.
|
|
18
|
+
*
|
|
19
|
+
* The `--zx-module-*` CSS custom properties in `styles/tokens/modules.css` are generated from
|
|
20
|
+
* this file by `tools/build-module-tokens.js`; `tests/unit/zeyos-modules.test.js` fails if the
|
|
21
|
+
* two drift apart.
|
|
22
|
+
*
|
|
23
|
+
* @module zx/zeyos/modules
|
|
24
|
+
*/
|
|
25
|
+
export type ZeyosModule = {
|
|
26
|
+
/**
|
|
27
|
+
* English display name.
|
|
28
|
+
*/
|
|
29
|
+
label: string;
|
|
30
|
+
/**
|
|
31
|
+
* Icon name in the ZeyOS Font Awesome kit.
|
|
32
|
+
*/
|
|
33
|
+
icon: string;
|
|
34
|
+
/**
|
|
35
|
+
* Identity colour as a hex string.
|
|
36
|
+
*/
|
|
37
|
+
color: string;
|
|
38
|
+
/**
|
|
39
|
+
* Stock Font Awesome name used when the kit's custom icons are missing.
|
|
40
|
+
*/
|
|
41
|
+
fa: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* @typedef {Object} ZeyosModule
|
|
45
|
+
* @property {string} label English display name.
|
|
46
|
+
* @property {string} icon Icon name in the ZeyOS Font Awesome kit.
|
|
47
|
+
* @property {string} color Identity colour as a hex string.
|
|
48
|
+
* @property {string} fa Stock Font Awesome name used when the kit's custom icons are missing.
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* Every module in the ZeyOS Font Awesome kit, keyed by module identifier.
|
|
52
|
+
* @type {Readonly<Record<string, ZeyosModule>>}
|
|
53
|
+
*/
|
|
54
|
+
export declare const zeyosModules: Readonly<Record<string, ZeyosModule>>;
|
|
55
|
+
/**
|
|
56
|
+
* Alternative identifiers resolving to a module key: API resource names, ZeyOS entity names, and
|
|
57
|
+
* the legacy gx module names. Dotted ZeyOS identifiers (`transactions.billing`) need no entry —
|
|
58
|
+
* `normalizeModuleName()` turns dots into hyphens first.
|
|
59
|
+
* @type {Readonly<Record<string, string>>}
|
|
60
|
+
*/
|
|
61
|
+
export declare const moduleAliases: Readonly<Record<string, string>>;
|
|
62
|
+
/**
|
|
63
|
+
* Normalizes a module, entity, or resource name to a module key. Case, surrounding whitespace,
|
|
64
|
+
* dots (`transactions.billing`), and underscores are all accepted; aliases are resolved.
|
|
65
|
+
* @param {string|null|undefined} name Module, entity, or resource name.
|
|
66
|
+
* @returns {string} A module key, or `'default'` when nothing matches.
|
|
67
|
+
*/
|
|
68
|
+
export declare function normalizeModuleName(name: string | null | undefined): string;
|
|
69
|
+
/**
|
|
70
|
+
* Looks a module up. Unknown names fall back to the `default` entry, so callers always get an
|
|
71
|
+
* icon and a colour.
|
|
72
|
+
* @param {string|null|undefined} name Module, entity, or resource name.
|
|
73
|
+
* @returns {ZeyosModule} The module's configuration.
|
|
74
|
+
*/
|
|
75
|
+
export declare function moduleInfo(name: string | null | undefined): ZeyosModule;
|
|
76
|
+
/**
|
|
77
|
+
* Reads a module's identity colour.
|
|
78
|
+
* @param {string|null|undefined} name Module, entity, or resource name.
|
|
79
|
+
* @returns {string} Hex colour.
|
|
80
|
+
*/
|
|
81
|
+
export declare function moduleColor(name: string | null | undefined): string;
|
|
82
|
+
/**
|
|
83
|
+
* Reads the kit icon name for a module (`'zeyos-notes'`), or its stock Font Awesome fallback.
|
|
84
|
+
* @param {string|null|undefined} name Module, entity, or resource name.
|
|
85
|
+
* @param {{standard?: boolean}} [options={}] Set `standard` for the stock Font Awesome name.
|
|
86
|
+
* @returns {string} Icon name without the `fa-` prefix.
|
|
87
|
+
*/
|
|
88
|
+
export declare function moduleIconName(name: string | null | undefined, { standard }?: {
|
|
89
|
+
standard?: boolean;
|
|
90
|
+
}): string;
|
|
91
|
+
/**
|
|
92
|
+
* Lists every module key, including runtime registrations.
|
|
93
|
+
* @returns {string[]} Sorted module keys.
|
|
94
|
+
*/
|
|
95
|
+
export declare function moduleKeys(): string[];
|
|
96
|
+
/**
|
|
97
|
+
* Registers modules, or overrides shipped ones — for forks, weblets, and the colours a ZeyOS
|
|
98
|
+
* menu payload carries. A partial entry inherits the rest from the module it replaces.
|
|
99
|
+
* @param {Record<string, string|Partial<ZeyosModule>>} modules Entries keyed by module name;
|
|
100
|
+
* a string value sets the colour only.
|
|
101
|
+
* @returns {void}
|
|
102
|
+
*/
|
|
103
|
+
export declare function registerModules(modules: Record<string, string | Partial<ZeyosModule>>): void;
|
|
104
|
+
/**
|
|
105
|
+
* Picks the higher-contrast glyph colour for a background, using the same two candidates and the
|
|
106
|
+
* same WCAG relative-luminance maths ZeyOS used to measure its palette.
|
|
107
|
+
* @param {string} background Hex colour, three or six digits.
|
|
108
|
+
* @returns {string} `'#ffffff'` or `'#141414'`.
|
|
109
|
+
*/
|
|
110
|
+
export declare function moduleGlyphColor(background: string): string;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/** @typedef {{id?: string, field?: string, rawField?: string, dir?: 'asc'|'desc'}} ZxSort */
|
|
2
|
+
export type ZxSort = {
|
|
3
|
+
id?: string;
|
|
4
|
+
field?: string;
|
|
5
|
+
rawField?: string;
|
|
6
|
+
dir?: 'asc' | 'desc';
|
|
7
|
+
};
|
|
8
|
+
export type ListQueryOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* Projection, including aliases and dot joins.
|
|
11
|
+
*/
|
|
12
|
+
fields?: string[] | Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Zx table sort state.
|
|
15
|
+
*/
|
|
16
|
+
sort?: ZxSort | ZxSort[];
|
|
17
|
+
/**
|
|
18
|
+
* ZeyOS field predicates.
|
|
19
|
+
*/
|
|
20
|
+
filters?: Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Full-text query.
|
|
23
|
+
*/
|
|
24
|
+
search?: string;
|
|
25
|
+
/**
|
|
26
|
+
* UI search-field metadata; ZeyOS searches its indexed text fields.
|
|
27
|
+
*/
|
|
28
|
+
searchFields?: string[];
|
|
29
|
+
/**
|
|
30
|
+
* Page size.
|
|
31
|
+
*/
|
|
32
|
+
limit?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Page offset.
|
|
35
|
+
*/
|
|
36
|
+
offset?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Visibility predicate; null is preserved deliberately.
|
|
39
|
+
*/
|
|
40
|
+
visibility?: number | null;
|
|
41
|
+
/**
|
|
42
|
+
* Request a server-side count instead of counting a returned page.
|
|
43
|
+
*/
|
|
44
|
+
count?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type ServerFilterDefinition = {
|
|
47
|
+
/**
|
|
48
|
+
* DataFilter state key.
|
|
49
|
+
*/
|
|
50
|
+
id: string;
|
|
51
|
+
/**
|
|
52
|
+
* Raw ZeyOS field.
|
|
53
|
+
*/
|
|
54
|
+
field?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Raw ZeyOS field when the UI id is an alias.
|
|
57
|
+
*/
|
|
58
|
+
rawField?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Raw fields combined as an OR group.
|
|
61
|
+
*/
|
|
62
|
+
fields?: string[];
|
|
63
|
+
/**
|
|
64
|
+
* ZeyOS comparison operator such as `>=` or `IN`.
|
|
65
|
+
*/
|
|
66
|
+
operator?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Semantic value format; date/datetime values become Unix seconds.
|
|
69
|
+
*/
|
|
70
|
+
format?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Semantic value type; date/datetime values become Unix seconds.
|
|
73
|
+
*/
|
|
74
|
+
type?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Preserve an empty-string value instead of treating it as inactive UI state.
|
|
77
|
+
*/
|
|
78
|
+
includeEmpty?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Preserve null instead of treating it as inactive UI state.
|
|
81
|
+
*/
|
|
82
|
+
includeNull?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Value transform.
|
|
85
|
+
*/
|
|
86
|
+
transform?: (value: unknown, state: Record<string, unknown>) => unknown;
|
|
87
|
+
/**
|
|
88
|
+
* Complete predicate transform.
|
|
89
|
+
*/
|
|
90
|
+
toFilter?: (value: unknown, state: Record<string, unknown>) => Record<string, unknown> | undefined;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* @typedef {Object} ListQueryOptions
|
|
94
|
+
* @property {string[]|Record<string, string>} [fields] Projection, including aliases and dot joins.
|
|
95
|
+
* @property {ZxSort|ZxSort[]} [sort] Zx table sort state.
|
|
96
|
+
* @property {Record<string, unknown>} [filters] ZeyOS field predicates.
|
|
97
|
+
* @property {string} [search] Full-text query.
|
|
98
|
+
* @property {string[]} [searchFields] UI search-field metadata; ZeyOS searches its indexed text fields.
|
|
99
|
+
* @property {number} [limit] Page size.
|
|
100
|
+
* @property {number} [offset] Page offset.
|
|
101
|
+
* @property {number|null} [visibility=0] Visibility predicate; null is preserved deliberately.
|
|
102
|
+
* @property {boolean} [count=false] Request a server-side count instead of counting a returned page.
|
|
103
|
+
*/
|
|
104
|
+
/**
|
|
105
|
+
* @typedef {Object} ServerFilterDefinition
|
|
106
|
+
* @property {string} id DataFilter state key.
|
|
107
|
+
* @property {string} [field] Raw ZeyOS field.
|
|
108
|
+
* @property {string} [rawField] Raw ZeyOS field when the UI id is an alias.
|
|
109
|
+
* @property {string[]} [fields] Raw fields combined as an OR group.
|
|
110
|
+
* @property {string} [operator] ZeyOS comparison operator such as `>=` or `IN`.
|
|
111
|
+
* @property {string} [format] Semantic value format; date/datetime values become Unix seconds.
|
|
112
|
+
* @property {string} [type] Semantic value type; date/datetime values become Unix seconds.
|
|
113
|
+
* @property {boolean} [includeEmpty=false] Preserve an empty-string value instead of treating it as inactive UI state.
|
|
114
|
+
* @property {boolean} [includeNull=false] Preserve null instead of treating it as inactive UI state.
|
|
115
|
+
* @property {(value: unknown, state: Record<string, unknown>) => unknown} [transform] Value transform.
|
|
116
|
+
* @property {(value: unknown, state: Record<string, unknown>) => Record<string, unknown>|undefined} [toFilter] Complete predicate transform.
|
|
117
|
+
*/
|
|
118
|
+
/**
|
|
119
|
+
* Converts a Date to the Unix-second unit used by every ZeyOS timestamp.
|
|
120
|
+
* Milliseconds are truncated because the server stores whole seconds.
|
|
121
|
+
* @param {Date|null|undefined} date Date value.
|
|
122
|
+
* @returns {number|null} Unix seconds, or null for a nullish input.
|
|
123
|
+
*/
|
|
124
|
+
export declare function dateToUnixSeconds(date: Date | null | undefined): number | null;
|
|
125
|
+
/**
|
|
126
|
+
* Converts a ZeyOS Unix-second timestamp to a Date.
|
|
127
|
+
* Numeric strings are accepted because some endpoints serialize bigint columns as strings.
|
|
128
|
+
* @param {number|string|null|undefined} seconds Unix seconds.
|
|
129
|
+
* @returns {Date|null} Date value, or null for a nullish input.
|
|
130
|
+
*/
|
|
131
|
+
export declare function unixSecondsToDate(seconds: number | string | null | undefined): Date | null;
|
|
132
|
+
/**
|
|
133
|
+
* Converts one or more Zx Table sort records to the signed field notation used by ZeyOS.
|
|
134
|
+
* A missing sort produces an empty array.
|
|
135
|
+
* @param {ZxSort|ZxSort[]|null|undefined} sort Zx sort state.
|
|
136
|
+
* @returns {string[]} Signed raw fields such as `+name` or `-lastmodified`.
|
|
137
|
+
*/
|
|
138
|
+
export declare function tableSortToQuery(sort: ZxSort | ZxSort[] | null | undefined): string[];
|
|
139
|
+
/**
|
|
140
|
+
* Converts DataFilter state to ZeyOS field predicates. Definitions may rename UI ids,
|
|
141
|
+
* add comparison operators, combine several fields with OR, or transform values. Blank/null
|
|
142
|
+
* values are DataFilter's inactive sentinels by default; `includeEmpty`/`includeNull` opt in to
|
|
143
|
+
* the distinct ZeyOS meanings. Zero and false are always retained.
|
|
144
|
+
* @param {Record<string, unknown>} state DataFilter state keyed by definition id.
|
|
145
|
+
* @param {ServerFilterDefinition[]|Record<string, string|ServerFilterDefinition>} [defs=[]] Server mappings.
|
|
146
|
+
* @returns {Record<string, unknown>} ZeyOS `filters` object (plural at the call site).
|
|
147
|
+
*/
|
|
148
|
+
export declare function dataFilterStateToFilters(state: Record<string, unknown>, defs?: ServerFilterDefinition[] | Record<string, string | ServerFilterDefinition>): Record<string, unknown>;
|
|
149
|
+
/**
|
|
150
|
+
* Builds the body passed to a generated `client.api.list<Resource>()` operation. Predicates are
|
|
151
|
+
* always emitted under `filters` (plural), which is required for indexed foreign-key matching.
|
|
152
|
+
* Full-text `query` is server-scoped: `searchFields` describes the UI but is not an API parameter.
|
|
153
|
+
* Set `count` to use ZeyOS's server-side count; there is no equivalent server-side SUM.
|
|
154
|
+
* @param {ListQueryOptions} [options={}] Zx list state.
|
|
155
|
+
* @returns {Record<string, unknown>} ZeyOS list request body.
|
|
156
|
+
*/
|
|
157
|
+
export declare function buildListQuery(options?: ListQueryOptions): Record<string, unknown>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export type FieldMeta = Record<string, unknown>;
|
|
2
|
+
export type FieldTypeStrategy = {
|
|
3
|
+
/**
|
|
4
|
+
* Zx Field descriptor fragment.
|
|
5
|
+
*/
|
|
6
|
+
field: Record<string, unknown> | ((meta: FieldMeta) => Record<string, unknown>);
|
|
7
|
+
/**
|
|
8
|
+
* Zx Table column fragment.
|
|
9
|
+
*/
|
|
10
|
+
column: Record<string, unknown> | ((meta: FieldMeta) => Record<string, unknown>);
|
|
11
|
+
};
|
|
12
|
+
export type ResolveFieldOptions = {
|
|
13
|
+
/**
|
|
14
|
+
* Curated allow-list; its order becomes the output order.
|
|
15
|
+
*/
|
|
16
|
+
fields?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Field ids to omit.
|
|
19
|
+
*/
|
|
20
|
+
exclude?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Per-field label overrides.
|
|
23
|
+
*/
|
|
24
|
+
labels?: Record<string, string>;
|
|
25
|
+
};
|
|
26
|
+
/** @typedef {Record<string, unknown>} FieldMeta */
|
|
27
|
+
/**
|
|
28
|
+
* @typedef {Object} FieldTypeStrategy
|
|
29
|
+
* @property {Record<string, unknown>|((meta: FieldMeta) => Record<string, unknown>)} field Zx Field descriptor fragment.
|
|
30
|
+
* @property {Record<string, unknown>|((meta: FieldMeta) => Record<string, unknown>)} column Zx Table column fragment.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* @typedef {Object} ResolveFieldOptions
|
|
34
|
+
* @property {string[]} [fields] Curated allow-list; its order becomes the output order.
|
|
35
|
+
* @property {string[]} [exclude] Field ids to omit.
|
|
36
|
+
* @property {Record<string, string>} [labels] Per-field label overrides.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* Extensible ZeyOS semantic/DB type registry. Keys are normalized to lowercase. Built-in choices:
|
|
40
|
+
* references use `zxselect`; monetary/numeric data uses `float`; Unix timestamps use date widgets;
|
|
41
|
+
* enums use native Field options; booleans use `toggle`; arrays use `valuelist`; and long structured
|
|
42
|
+
* text uses `textarea`. Extend it through {@link registerFieldType} rather than replacing entries.
|
|
43
|
+
* @type {Record<string, FieldTypeStrategy>}
|
|
44
|
+
*/
|
|
45
|
+
export declare const TYPE_MAP: Record<string, FieldTypeStrategy>;
|
|
46
|
+
/**
|
|
47
|
+
* Registers or replaces a field/column strategy for a semantic format or DB type.
|
|
48
|
+
* @param {string} typeOrFormat Semantic format or database type.
|
|
49
|
+
* @param {FieldTypeStrategy} strategy Field and column descriptor builders/fragments.
|
|
50
|
+
* @returns {FieldTypeStrategy} The registered strategy.
|
|
51
|
+
*/
|
|
52
|
+
export declare function registerFieldType(typeOrFormat: string, strategy: FieldTypeStrategy): FieldTypeStrategy;
|
|
53
|
+
/**
|
|
54
|
+
* Converts normalized ZeyOS field metadata to a Zx Field configuration. Semantic `format` wins
|
|
55
|
+
* over the database `type`; relations and enums are detected before scalar DB types. Read-only
|
|
56
|
+
* fields become disabled controls and NOT NULL/required metadata becomes `required: true`.
|
|
57
|
+
* @param {FieldMeta} meta Normalized metadata containing at least `id` or `name`.
|
|
58
|
+
* @returns {Record<string, unknown>} Plain Zx Field descriptor.
|
|
59
|
+
*/
|
|
60
|
+
export declare function fieldToZxField(meta: FieldMeta): Record<string, unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* Converts normalized ZeyOS field metadata to a Zx Table column configuration. Renderers return
|
|
63
|
+
* strings only (never DOM): references/enums show labels, numeric columns are right-aligned,
|
|
64
|
+
* booleans show a check, and Unix seconds are formatted as dates.
|
|
65
|
+
* @param {FieldMeta} meta Normalized metadata containing at least `id` or `name`.
|
|
66
|
+
* @returns {Record<string, unknown>} Plain Zx Table column descriptor.
|
|
67
|
+
*/
|
|
68
|
+
export declare function fieldToZxColumn(meta: FieldMeta): Record<string, unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* Resolves a resource's runtime client schema into ordered normalized field metadata. The current
|
|
71
|
+
* client returns names from `schema.fields(resource)` and definitions from
|
|
72
|
+
* `schema.describe(resource).fields`; embedded `enum` data is authoritative. A compatible
|
|
73
|
+
* `schema.enums(resource, field)` is used when supplied by another client version/stub.
|
|
74
|
+
* @param {Record<string, any>} client Injected `@zeyos/client` instance.
|
|
75
|
+
* @param {string} resource Schema resource name such as `tickets`.
|
|
76
|
+
* @param {ResolveFieldOptions} [opts={}] Curation options.
|
|
77
|
+
* @returns {FieldMeta[]} Ordered normalized metadata.
|
|
78
|
+
*/
|
|
79
|
+
export declare function resolveFields(client: Record<string, any>, resource: string, opts?: ResolveFieldOptions): FieldMeta[];
|