@phis/ui 0.5.3 → 0.5.4
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/components/controls/phi-cascader-control.d.ts +9 -1
- package/components/controls/phi-cascader-control.js +25 -3
- package/components/controls/phi-money-control.d.ts +39 -0
- package/components/controls/phi-money-control.js +34 -0
- package/components/controls/phi-number-control.d.ts +6 -1
- package/components/controls/phi-number-control.js +3 -3
- package/components/controls/phi-options-provider.d.ts +7 -0
- package/components/controls/phi-options-provider.js +11 -0
- package/components/forms/extended-form-field-controls.d.ts +1 -0
- package/components/forms/extended-form-field-controls.js +23 -1
- package/components/forms/form-descriptor-runtime-client.js +13 -0
- package/components/forms/form-provider-contract.d.ts +43 -0
- package/components/forms/form-provider-contract.js +40 -0
- package/components/forms/money-field.d.ts +27 -0
- package/components/forms/money-field.js +78 -0
- package/components/forms/shared-form-provider-registry.js +4 -0
- package/components/media/phi-media-picker-binding.js +6 -1
- package/components/media/phi-site-font-assets.js +6 -1
- package/components/motion/phi-sequence-run.d.ts +14 -1
- package/components/motion/phi-sequence-run.js +22 -3
- package/components/motion/phi-sequence-viewport.js +3 -1
- package/components/regions/presets/content-entry-editor-page-tree.js +3 -1
- package/components/tables/client/phi-table-binding.js +16 -3
- package/components/trees/client/phi-tree-binding.js +6 -2
- package/components/widgets/client/shared/phi-collection-view-binding.js +10 -2
- package/components/widgets/client/shared/phi-rendered-value.d.ts +9 -1
- package/components/widgets/client/shared/phi-rendered-value.js +20 -1
- package/components/widgets/config/choice-shared.d.ts +2 -2
- package/components/widgets/label-sets/gallery.js +6 -0
- package/components/widgets/label-sets/interval.d.ts +4 -0
- package/components/widgets/label-sets/interval.js +31 -0
- package/components/widgets/label-sets/record.js +6 -1
- package/components/widgets/label-sets/slot-upload.d.ts +4 -0
- package/components/widgets/label-sets/slot-upload.js +36 -0
- package/components/widgets/label-sets/table.js +6 -1
- package/components/widgets/label-types/gallery.d.ts +7 -0
- package/components/widgets/label-types/gallery.js +6 -0
- package/components/widgets/label-types/interval.d.ts +16 -0
- package/components/widgets/label-types/interval.js +21 -0
- package/components/widgets/label-types/record.d.ts +3 -0
- package/components/widgets/label-types/record.js +2 -0
- package/components/widgets/label-types/slot-upload.d.ts +24 -0
- package/components/widgets/label-types/slot-upload.js +16 -0
- package/components/widgets/label-types/table.d.ts +3 -0
- package/components/widgets/label-types/table.js +2 -0
- package/constants/record-field-kinds.d.ts +1 -1
- package/constants/record-field-kinds.js +1 -1
- package/constants/runtime-module-ownership.js +1 -0
- package/controls.d.ts +7 -0
- package/controls.js +4 -0
- package/helpers/cms-dialog.d.ts +39 -3
- package/helpers/cms-dialog.js +46 -4
- package/helpers/cms-page-catalog.d.ts +8 -0
- package/helpers/cms-page-catalog.js +18 -2
- package/helpers/cms-preset-nodes.d.ts +13 -3
- package/helpers/cms-preset-nodes.js +3 -2
- package/helpers/money-amount.d.ts +48 -0
- package/helpers/money-amount.js +131 -0
- package/helpers/page-layout-check.js +15 -2
- package/helpers/record-fields.d.ts +18 -5
- package/helpers/record-fields.js +38 -13
- package/module-records.d.ts +6 -3
- package/module-records.js +4 -2
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/module.d.ts +1 -1
- package/plugins/runtime-modules/app/module.d.ts +1 -1
- package/plugins/runtime-modules/asset/services/collection.js +1 -0
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -2
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +3 -0
- package/plugins/runtime-modules/builder/offered-page-catalog.js +3 -3
- package/plugins/runtime-modules/builder/options-providers.js +7 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -3
- package/plugins/runtime-modules/contracts.d.ts +1 -1
- package/plugins/runtime-modules/core/definition.d.ts +43 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +43 -0
- package/plugins/runtime-modules/core/widgets/breadcrumb/client.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/breadcrumb/client.js +6 -5
- package/plugins/runtime-modules/core/widgets/breadcrumb/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/breadcrumb/server.d.ts +9 -1
- package/plugins/runtime-modules/core/widgets/breadcrumb/server.js +29 -3
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/cascader/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/cascader/config.d.ts +8 -2
- package/plugins/runtime-modules/core/widgets/cascader/config.js +22 -0
- package/plugins/runtime-modules/core/widgets/checkbox-group/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/gallery/authoring.js +12 -3
- package/plugins/runtime-modules/core/widgets/gallery/client.js +10 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/multi-select/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +8 -2
- package/plugins/runtime-modules/core/widgets/record/config.js +4 -0
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/select-box/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/authoring.js +2 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/client.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/client.js +45 -24
- package/plugins/runtime-modules/core/widgets/slot-upload/config.d.ts +12 -4
- package/plugins/runtime-modules/core/widgets/slot-upload/config.js +18 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/plugin.js +4 -2
- package/plugins/runtime-modules/core/widgets/slot-upload/server.d.ts +9 -3
- package/plugins/runtime-modules/core/widgets/slot-upload/server.js +17 -3
- package/plugins/runtime-modules/core/widgets/steps/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
- package/plugins/runtime-modules/descriptor-compiler.d.ts +11 -1
- package/plugins/runtime-modules/descriptor-compiler.js +49 -8
- package/plugins/runtime-modules/groups/definition.d.ts +1 -1
- package/plugins/runtime-modules/groups/forms.d.ts +18 -0
- package/plugins/runtime-modules/groups/forms.js +2 -2
- package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +6 -4
- package/plugins/runtime-modules/public/module.d.ts +1 -1
- package/plugins/runtime-modules/resolver.js +5 -0
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +4 -2
- package/plugins/runtime-modules/user-management/controller/client.js +6 -1
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +3 -3
- package/runtime-render-client.d.ts +1 -1
- package/runtime-render-client.js +2 -1
- package/server-helpers/cms-page-record.d.ts +2 -2
- package/server-helpers/cms-page-record.js +15 -5
- package/server-helpers/record-fields.d.ts +1 -1
- package/server-helpers/record-fields.js +1 -2
- package/server-helpers/record-samples.d.ts +4 -4
- package/server-helpers/record-samples.js +10 -2
- package/types/cms-module-descriptors.d.ts +3 -0
- package/types/cms-plugins.d.ts +8 -0
- package/types/collection-provider.d.ts +7 -0
- package/types/core-widget-placements.d.ts +32 -0
- package/types/record-provider.d.ts +19 -3
- package/types/table-widget.d.ts +33 -1
- package/types/table-widget.js +1 -0
- package/types/tree-widget.d.ts +7 -0
- package/types/widget-runtime.d.ts +1 -1
- package/types.d.ts +1 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import type { PhiBlockRuntime } from "../types";
|
|
3
3
|
import type { PhiCmsRuntimeRenderRegistry } from "../types/cms-plugins";
|
|
4
|
-
import type { PhiCmsPageRecordDescriptor } from "../types/record-provider";
|
|
5
|
-
import type { PhiRuntimeDataProviderBinding } from "../types/runtime-data-provider";
|
|
4
|
+
import type { PhiCmsPageRecordDescriptor, PhiPageRecordBinding } from "../types/record-provider";
|
|
6
5
|
type PhiRecordSamplesRegistry = Pick<PhiCmsRuntimeRenderRegistry, "recordSamplesLoadersByKey">;
|
|
7
6
|
/**
|
|
8
7
|
* The record the Builder's Preview shows a template with (MODULES.md, "The fields of a record, and the
|
|
9
8
|
* record a Page is about"): the first sample the route's record Provider offers, as the binding a Page
|
|
10
|
-
* about a record carries
|
|
9
|
+
* about a record carries -- with the route's `titleField` and `descriptionField`, so the Preview takes the
|
|
10
|
+
* same fields the live Page does.
|
|
11
11
|
*
|
|
12
12
|
* A sample's `params` are the Provider's own parameters (`{ slug: "chair" }`), not the route's, so they
|
|
13
13
|
* become the binding as they are. `null` is a Provider that offers no samples or none now, or one whose
|
|
@@ -17,5 +17,5 @@ export declare function resolvePhiPageRecordSampleBinding({ registry, runtime, p
|
|
|
17
17
|
registry: PhiRecordSamplesRegistry;
|
|
18
18
|
runtime: PhiBlockRuntime;
|
|
19
19
|
pageRecord: PhiCmsPageRecordDescriptor;
|
|
20
|
-
}): Promise<
|
|
20
|
+
}): Promise<PhiPageRecordBinding | null>;
|
|
21
21
|
export {};
|
|
@@ -4,7 +4,8 @@ import { phiRuntime } from "./phi-runtime";
|
|
|
4
4
|
/**
|
|
5
5
|
* The record the Builder's Preview shows a template with (MODULES.md, "The fields of a record, and the
|
|
6
6
|
* record a Page is about"): the first sample the route's record Provider offers, as the binding a Page
|
|
7
|
-
* about a record carries
|
|
7
|
+
* about a record carries -- with the route's `titleField` and `descriptionField`, so the Preview takes the
|
|
8
|
+
* same fields the live Page does.
|
|
8
9
|
*
|
|
9
10
|
* A sample's `params` are the Provider's own parameters (`{ slug: "chair" }`), not the route's, so they
|
|
10
11
|
* become the binding as they are. `null` is a Provider that offers no samples or none now, or one whose
|
|
@@ -26,7 +27,14 @@ export async function resolvePhiPageRecordSampleBinding({ registry, runtime, pag
|
|
|
26
27
|
runtime,
|
|
27
28
|
});
|
|
28
29
|
const sample = samples[0];
|
|
29
|
-
return sample
|
|
30
|
+
return sample
|
|
31
|
+
? {
|
|
32
|
+
providerKey: pageRecord.providerKey,
|
|
33
|
+
params: sample.params,
|
|
34
|
+
...(pageRecord.titleField ? { titleField: pageRecord.titleField } : {}),
|
|
35
|
+
...(pageRecord.descriptionField ? { descriptionField: pageRecord.descriptionField } : {}),
|
|
36
|
+
}
|
|
37
|
+
: null;
|
|
30
38
|
}
|
|
31
39
|
catch (error) {
|
|
32
40
|
logRuntimeEvent("warn", "cms.record.samples_failed", {
|
|
@@ -7,6 +7,7 @@ import type { PhiThemeFontsBlock, PhiThemeGroundBlock, PhiThemeSetBlock, PhiThem
|
|
|
7
7
|
import type { PhiViewerAccessPolicy } from "./access";
|
|
8
8
|
import type { PhiSignalRoute } from "./signals";
|
|
9
9
|
import type { PhiCmsInstanceId } from "./cms-instance-id";
|
|
10
|
+
import type { PhiRuntimeModuleFormDefinition } from "../components/forms/form-registry";
|
|
10
11
|
export type PhiRuntimeModuleId = `${string}/${string}`;
|
|
11
12
|
export type PhiCmsPresetIdentity = {
|
|
12
13
|
ownerModuleId: PhiRuntimeModuleId;
|
|
@@ -472,6 +473,8 @@ export type PhiCmsCompiledDescriptorCatalog = {
|
|
|
472
473
|
themeBlockByKey: ReadonlyMap<string, PhiCmsThemeBlockBinding>;
|
|
473
474
|
/** Each Module's source language: the one the text its descriptors ship is written in. */
|
|
474
475
|
sourceLocaleByModuleId: ReadonlyMap<PhiRuntimeModuleId, string>;
|
|
476
|
+
/** The Forms the Modules ship, by id: what the tree contract reads a dialog's Form from. */
|
|
477
|
+
formDefinitionsById: ReadonlyMap<string, PhiRuntimeModuleFormDefinition>;
|
|
475
478
|
};
|
|
476
479
|
export type PhiCmsActiveRouteTable = {
|
|
477
480
|
area: PhiCmsAreaKey;
|
package/types/cms-plugins.d.ts
CHANGED
|
@@ -596,6 +596,14 @@ export type PhiCmsRuntimeRenderRegistry = {
|
|
|
596
596
|
recordFieldsLoadersByKey: ReadonlyMap<PhiRuntimeDataProviderKey, () => Promise<import("./record-provider").PhiRuntimeRecordFieldsReader>>;
|
|
597
597
|
/** The sample readers of the `record` Providers that offer samples, by key: what the Builder previews a template with. */
|
|
598
598
|
recordSamplesLoadersByKey: ReadonlyMap<PhiRuntimeDataProviderKey, () => Promise<import("./record-provider").PhiRuntimeRecordSamplesReader>>;
|
|
599
|
+
/**
|
|
600
|
+
* What each active Module's `record` Providers that declare fields consist of, by key: whose the record
|
|
601
|
+
* is and its declared fields. Keyed off the active set like the loaders, and apart from
|
|
602
|
+
* `dataProviderDescriptorsByKey`, which holds only what the trees make the browser mount and so never a
|
|
603
|
+
* `record` Provider.
|
|
604
|
+
*/
|
|
605
|
+
recordDeclarationsByKey: ReadonlyMap<PhiRuntimeDataProviderKey, import("./record-provider").PhiRecordDeclaration>;
|
|
606
|
+
/** The Providers the trees make the browser mount, by key; a `record` Provider is never one of them. */
|
|
599
607
|
dataProviderDescriptorsByKey: ReadonlyMap<PhiRuntimeDataProviderKey, PhiRuntimeModuleDataProviderDescriptor>;
|
|
600
608
|
formDefinitionsById: ReadonlyMap<string, PhiRuntimeModuleFormDefinition>;
|
|
601
609
|
};
|
|
@@ -81,6 +81,13 @@ export type PhiCollectionProviderQueryRequest = {
|
|
|
81
81
|
resourceKey: string;
|
|
82
82
|
query: PhiCollectionProviderQuery;
|
|
83
83
|
params?: Record<string, unknown>;
|
|
84
|
+
/**
|
|
85
|
+
* The reader's language and the Site's time zone (`usePhiIntlLocale`, `usePhiIntlTimeZone`), filled by
|
|
86
|
+
* the binding, for a Provider that writes words, amounts or dates into what it answers. Part of the
|
|
87
|
+
* binding's load key: a live language switch asks again.
|
|
88
|
+
*/
|
|
89
|
+
locale: string;
|
|
90
|
+
timeZone: string;
|
|
84
91
|
signal: AbortSignal;
|
|
85
92
|
};
|
|
86
93
|
export type PhiCollectionProviderActionRequest = {
|
|
@@ -16,6 +16,9 @@ import type { PhiMediaImageSourceConfig } from "./media";
|
|
|
16
16
|
import type { PhiViewerAccessPolicy } from "./access";
|
|
17
17
|
import type { PhiWidgetFontFamilyKey, PhiWidgetFontSizeKey } from "./site-theme";
|
|
18
18
|
import type { PhiTableQuery, PhiTableWidgetConfig, PhiTableWidgetFeatures, PhiTableWidgetPresentation } from "./table-widget";
|
|
19
|
+
import type { PhiRecordWidgetConfig, PhiRecordWidgetPresentation } from "./record-widget";
|
|
20
|
+
import type { PhiChoiceOptionsConfig, PhiChoiceValueMode } from "../components/widgets/config/choice-shared";
|
|
21
|
+
import type { PhiCmsTabBarWidgetConfig } from "../components/widgets/config/stack-tabs";
|
|
19
22
|
import type { PhiButtonVariant } from "../components/widgets/config/button-variant";
|
|
20
23
|
import type { PhiThemeGradientKey } from "../theme/phi-theme-gradients";
|
|
21
24
|
import type { PhiTextTone } from "../components/widgets/config/text-tone";
|
|
@@ -164,6 +167,32 @@ export type PhiTableWidgetPlacement = PhiWidgetPlacementBase & {
|
|
|
164
167
|
fixedFilters?: PhiTableWidgetConfig["fixedFilters"];
|
|
165
168
|
source?: PhiProviderResourceSource | null;
|
|
166
169
|
};
|
|
170
|
+
/** Which row it shows arrives as a signal from a row action; the placement says how to read it. */
|
|
171
|
+
export type PhiRecordWidgetPlacement = PhiWidgetPlacementBase & {
|
|
172
|
+
source?: PhiRecordWidgetConfig["source"];
|
|
173
|
+
openActionKey?: PhiRecordWidgetConfig["openActionKey"];
|
|
174
|
+
presentation?: Partial<PhiRecordWidgetPresentation>;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Where a file goes: the Add-on, its table and the slot. What the slot takes is the Add-on's schema
|
|
178
|
+
* descriptor's answer and is not placed. Written out here rather than read off the Widget's config,
|
|
179
|
+
* because the Foundation does not import a Module, not even for a type.
|
|
180
|
+
*/
|
|
181
|
+
export type PhiSlotUploadWidgetPlacement = PhiWidgetPlacementBase & {
|
|
182
|
+
/** What the field is called where it stands; translated like every text written into a config. */
|
|
183
|
+
label?: string;
|
|
184
|
+
/** The Add-on that owns the table, by package name -- `@scope/name`. */
|
|
185
|
+
addon?: string;
|
|
186
|
+
table?: string;
|
|
187
|
+
slot?: string;
|
|
188
|
+
/** Which binding parameter carries the row; `id` where none is named. */
|
|
189
|
+
ownerParam?: string;
|
|
190
|
+
};
|
|
191
|
+
export type PhiTabBarWidgetPlacement = PhiWidgetPlacementBase & PhiControlPlacement & Partial<PhiChoiceOptionsConfig> & {
|
|
192
|
+
value?: string;
|
|
193
|
+
valueMode?: PhiChoiceValueMode;
|
|
194
|
+
placement?: PhiCmsTabBarWidgetConfig["placement"];
|
|
195
|
+
};
|
|
167
196
|
/**
|
|
168
197
|
* Whether this placement draws the form's own submit.
|
|
169
198
|
*
|
|
@@ -436,6 +465,9 @@ export type PhiCoreWidgetPlacements = {
|
|
|
436
465
|
spacer: PhiSpacerWidgetPlacement;
|
|
437
466
|
html: PhiHtmlWidgetPlacement;
|
|
438
467
|
table: PhiTableWidgetPlacement;
|
|
468
|
+
record: PhiRecordWidgetPlacement;
|
|
469
|
+
"slot-upload": PhiSlotUploadWidgetPlacement;
|
|
470
|
+
"tab-bar": PhiTabBarWidgetPlacement;
|
|
439
471
|
form: PhiFormWidgetPlacement;
|
|
440
472
|
"collection-view": PhiCollectionViewWidgetPlacement;
|
|
441
473
|
"command-toolbar": PhiCommandToolbarWidgetPlacement;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { PhisPaymentMoney } from "@phis/contracts/payments";
|
|
1
2
|
import type { PhiRecordFieldKind } from "../constants/record-field-kinds";
|
|
2
|
-
import type { PhiRuntimeDataProviderKey } from "./runtime-data-provider";
|
|
3
|
+
import type { PhiRuntimeDataProviderBinding, PhiRuntimeDataProviderKey } from "./runtime-data-provider";
|
|
3
4
|
import type { PhiBlockRuntime } from "./widget-runtime";
|
|
4
5
|
/** What a record Provider is asked with, besides its parameters: whose Site, in which language. */
|
|
5
6
|
export type PhiRuntimeRecordProviderContext = {
|
|
@@ -56,8 +57,10 @@ export type PhiRecordLink = {
|
|
|
56
57
|
label?: string;
|
|
57
58
|
};
|
|
58
59
|
/**
|
|
59
|
-
* What a field of each kind holds. A `date` is an ISO instant
|
|
60
|
-
*
|
|
60
|
+
* What a field of each kind holds. A `date` is an ISO instant, a `number` a number and a `money` the
|
|
61
|
+
* payment contract's amount (`{ currency, minor }`, `minor` an integer string of minor units): Core writes
|
|
62
|
+
* all three in the page's language -- a date in the Site's time zone, money with its currency's own
|
|
63
|
+
* places (`formatPhisMoney`). What a domain formats itself is a `text`.
|
|
61
64
|
*/
|
|
62
65
|
export type PhiRecordFieldValueByKind = {
|
|
63
66
|
text: string;
|
|
@@ -68,6 +71,7 @@ export type PhiRecordFieldValueByKind = {
|
|
|
68
71
|
tag: PhiRecordTag;
|
|
69
72
|
date: string;
|
|
70
73
|
number: number;
|
|
74
|
+
money: PhisPaymentMoney;
|
|
71
75
|
link: PhiRecordLink;
|
|
72
76
|
};
|
|
73
77
|
export type PhiRecordFieldDescriptor = {
|
|
@@ -112,4 +116,16 @@ export type PhiCmsPageRecordDescriptor = {
|
|
|
112
116
|
titleField?: string;
|
|
113
117
|
descriptionField?: string;
|
|
114
118
|
};
|
|
119
|
+
/**
|
|
120
|
+
* The record a Page is about, as `runtime.page.record` carries it: the Provider and the parameters the
|
|
121
|
+
* address filled in, plus the names of the fields the route's `pageRecord` makes the Page's title and
|
|
122
|
+
* description. Absent where the route names none, never empty.
|
|
123
|
+
*
|
|
124
|
+
* The two names say what the Page takes from the record, not what is asked of the Provider, so they are no
|
|
125
|
+
* part of what a read is keyed by. A Table or Form binding stays the general `PhiRuntimeDataProviderBinding`.
|
|
126
|
+
*/
|
|
127
|
+
export type PhiPageRecordBinding = PhiRuntimeDataProviderBinding & {
|
|
128
|
+
titleField?: string;
|
|
129
|
+
descriptionField?: string;
|
|
130
|
+
};
|
|
115
131
|
export type { PhiRecordFieldKind } from "../constants/record-field-kinds";
|
package/types/table-widget.d.ts
CHANGED
|
@@ -49,7 +49,25 @@ export type PhiTableQuery = {
|
|
|
49
49
|
* How a Provider value is drawn. Named rather than written into the column, because a record of the
|
|
50
50
|
* same rows draws the same values and must mean the same thing by `datetime` as the table does.
|
|
51
51
|
*/
|
|
52
|
-
export type PhiTableValueRenderer = "text" | "email" | "date" | "datetime" | "badge" | "tags" | "link" | "code" | "json" | "switch" | "checkbox" | "icon"
|
|
52
|
+
export type PhiTableValueRenderer = "text" | "email" | "date" | "datetime" | "badge" | "tags" | "link" | "code" | "json" | "switch" | "checkbox" | "icon"
|
|
53
|
+
/**
|
|
54
|
+
* An amount of money, `{ currency, minor }` -- the payment contract's `PhisPaymentMoney`, with `minor`
|
|
55
|
+
* an integer string or a safe integer of minor units -- written in the reader's language with the
|
|
56
|
+
* currency's own number of places (`formatPhisMoney`). Bound to a `json` field.
|
|
57
|
+
*/
|
|
58
|
+
| "money"
|
|
59
|
+
/**
|
|
60
|
+
* How long a period is, `PhiIntervalValue` (`{ unit: "month", count: 3 }`), in Core's words: "per
|
|
61
|
+
* month", "every 3 months". Bound to a `json` field.
|
|
62
|
+
*/
|
|
63
|
+
| "interval";
|
|
64
|
+
/** The unit of a `PhiIntervalValue`. */
|
|
65
|
+
export type PhiIntervalUnit = "day" | "week" | "month" | "year";
|
|
66
|
+
/** A period of `count` (a whole number, one or more) `unit`s, as the `interval` renderer draws it. */
|
|
67
|
+
export type PhiIntervalValue = {
|
|
68
|
+
unit: PhiIntervalUnit;
|
|
69
|
+
count: number;
|
|
70
|
+
};
|
|
53
71
|
export type PhiTableColumnDefinition = {
|
|
54
72
|
key: string;
|
|
55
73
|
title: string;
|
|
@@ -532,12 +550,26 @@ export type PhiTableProviderQueryRequest = {
|
|
|
532
550
|
resourceKey: string;
|
|
533
551
|
query: PhiTableQuery;
|
|
534
552
|
params?: Record<string, unknown>;
|
|
553
|
+
/**
|
|
554
|
+
* The reader's language and the Site's time zone (`usePhiIntlLocale`, `usePhiIntlTimeZone`), filled by
|
|
555
|
+
* the binding, for a Provider that writes words, amounts or dates into what it answers. Part of the
|
|
556
|
+
* binding's load key: a live language switch asks again.
|
|
557
|
+
*/
|
|
558
|
+
locale: string;
|
|
559
|
+
timeZone: string;
|
|
535
560
|
signal: AbortSignal;
|
|
536
561
|
};
|
|
537
562
|
export type PhiTableProviderRecordRequest = {
|
|
538
563
|
resourceKey: string;
|
|
539
564
|
rowIdentity: PhiTableRowIdentity | null;
|
|
540
565
|
params?: Record<string, unknown>;
|
|
566
|
+
/**
|
|
567
|
+
* The reader's language and the Site's time zone (`usePhiIntlLocale`, `usePhiIntlTimeZone`), filled by
|
|
568
|
+
* the binding, for a Provider that writes words, amounts or dates into what it answers. Part of the
|
|
569
|
+
* binding's load key: a live language switch asks again.
|
|
570
|
+
*/
|
|
571
|
+
locale: string;
|
|
572
|
+
timeZone: string;
|
|
541
573
|
signal: AbortSignal;
|
|
542
574
|
};
|
|
543
575
|
export type PhiTableProviderMutationInvalidation = "none" | "view" | "resource";
|
package/types/table-widget.js
CHANGED
|
@@ -334,6 +334,7 @@ export function validatePhiTableWidgetBinding(config, resource) {
|
|
|
334
334
|
((column.renderer === "date" || column.renderer === "datetime") && field?.type === column.renderer) ||
|
|
335
335
|
(column.renderer === "json" && field?.type === "json") ||
|
|
336
336
|
(column.renderer === "tags" && (field?.type === "json" || field?.type === "enum[]")) ||
|
|
337
|
+
((column.renderer === "money" || column.renderer === "interval") && field?.type === "json") ||
|
|
337
338
|
((column.renderer === "email" || column.renderer === "link" || column.renderer === "code" ||
|
|
338
339
|
column.renderer === "badge") && (field?.type === "string" || field?.type === "enum"));
|
|
339
340
|
if (!rendererCompatible) {
|
package/types/tree-widget.d.ts
CHANGED
|
@@ -56,6 +56,13 @@ export type PhiTreeProviderQueryRequest = {
|
|
|
56
56
|
resourceKey: string;
|
|
57
57
|
query: PhiTreeQuery;
|
|
58
58
|
params?: Record<string, unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* The reader's language and the Site's time zone (`usePhiIntlLocale`, `usePhiIntlTimeZone`), filled by
|
|
61
|
+
* the binding, for a Provider that writes words, amounts or dates into what it answers. Part of the
|
|
62
|
+
* binding's load key: a live language switch asks again.
|
|
63
|
+
*/
|
|
64
|
+
locale: string;
|
|
65
|
+
timeZone: string;
|
|
59
66
|
signal: AbortSignal;
|
|
60
67
|
};
|
|
61
68
|
export type PhiTreeProviderQueryResult = {
|
|
@@ -118,7 +118,7 @@ export type PhiBlockRuntimePage = {
|
|
|
118
118
|
* The record this Page is about, as a binding: the Provider and the parameters the address filled in.
|
|
119
119
|
* Present on a route that names a `pageRecord`; a Widget reads the record's fields through it.
|
|
120
120
|
*/
|
|
121
|
-
record?: import("./
|
|
121
|
+
record?: import("./record-provider").PhiPageRecordBinding;
|
|
122
122
|
};
|
|
123
123
|
/**
|
|
124
124
|
* What a Widget knows about the request it renders in. It holds nothing only the server may know: a
|
package/types.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export type * from "./types/slot-size-policy";
|
|
|
26
26
|
export type * from "./types/runtime-data-provider";
|
|
27
27
|
export { isPhiRuntimeDataProviderKey, readPhiRuntimeDataProviderBinding } from "./types/runtime-data-provider";
|
|
28
28
|
export type * from "./types/table-widget";
|
|
29
|
+
export type * from "./types/record-widget";
|
|
29
30
|
export type * from "./types/tree-widget";
|
|
30
31
|
export type * from "./types/collection-provider";
|
|
31
32
|
export type * from "./types/form-descriptor";
|