dynamic-mui 2.5.0 → 2.5.1
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/README.md +61 -0
- package/dist/{AIForm-Czsvpf7g.mjs → AIForm-BVJ7qhP5.mjs} +2712 -2521
- package/dist/AIForm-D8_6RVmA.js +44 -0
- package/dist/{accordion-8p1FoyfL.js → accordion-B3fSXKqC.js} +1 -1
- package/dist/{accordion-CQ4Vldth.mjs → accordion-BxTjyh5y.mjs} +1 -1
- package/dist/{addressfield-N7DifI3i.mjs → addressfield-C9VaV9xw.mjs} +1 -1
- package/dist/{addressfield-T4e_d87q.js → addressfield-Cv8zK_sb.js} +1 -1
- package/dist/ai/index.cjs +1 -1
- package/dist/ai/index.mjs +1 -1
- package/dist/{asyncautocomplete-BB_MyjIj.mjs → asyncautocomplete-BveFRqpV.mjs} +1 -1
- package/dist/{asyncautocomplete-CpO6EO3W.js → asyncautocomplete-CoOb7mtv.js} +1 -1
- package/dist/{bar-CbpJ-MEV.mjs → bar-BfMaIpfo.mjs} +1 -1
- package/dist/{bar-BOse0ZkP.js → bar-CE_D8esp.js} +1 -1
- package/dist/{cascadeselect-PzCw6JHX.mjs → cascadeselect-C53hT-C-.mjs} +1 -1
- package/dist/{cascadeselect-C30RVgmc.js → cascadeselect-CWECmehh.js} +1 -1
- package/dist/collection-Cf87KWZM.js +1 -0
- package/dist/collection-HUYkt74J.mjs +1140 -0
- package/dist/{colorpicker-CMhVJNQT.mjs → colorpicker-BRQPl_IL.mjs} +1 -1
- package/dist/{colorpicker-DoNrfUY7.js → colorpicker-zE3r16Gc.js} +1 -1
- package/dist/components/controls/Collection/CollectionList.d.ts +22 -0
- package/dist/components/controls/Collection/ItemDialog.d.ts +20 -0
- package/dist/components/controls/Collection/collection.d.ts +9 -0
- package/dist/components/controls/Collection/parts.d.ts +39 -0
- package/dist/components/controls/Collection/tree.d.ts +18 -0
- package/dist/components/controls/Collection/ui.d.ts +49 -0
- package/dist/components/controls/index.d.ts +1 -0
- package/dist/{consentfield-Bp1dXs7L.js → consentfield-CEddOmCa.js} +1 -1
- package/dist/{consentfield-DIa3sXrr.mjs → consentfield-Cylid9il.mjs} +1 -1
- package/dist/{datatable-CyfyY3Wh.js → datatable-3MUZQhnx.js} +1 -1
- package/dist/{datatable-CO0Iv6R6.mjs → datatable-BWimO7zD.mjs} +1 -1
- package/dist/dynamic-mui.cjs +1 -1
- package/dist/dynamic-mui.mjs +2 -2
- package/dist/{editabletable-CCDJ2BPB.js → editabletable--ow4E3bB.js} +1 -1
- package/dist/{editabletable-C_MA7QEb.mjs → editabletable-CVJ14zrm.mjs} +1 -1
- package/dist/{fileupload-WV5shCIK.js → fileupload-B7f6VOb0.js} +1 -1
- package/dist/{fileupload-DX3dxKFN.mjs → fileupload-DHiYLdJ5.mjs} +1 -1
- package/dist/{formrepeater-D5K8qgAA.mjs → formrepeater-BGZGTcVb.mjs} +1 -1
- package/dist/{formrepeater-Cxu8Dk8P.js → formrepeater-CvWeLug8.js} +1 -1
- package/dist/{formwizard-B-HCfrnp.mjs → formwizard-BeJK5mqc.mjs} +1 -1
- package/dist/{formwizard-HRF3hTyF.js → formwizard-DrHKFPfN.js} +1 -1
- package/dist/{geofield-DlqMZ_hl.mjs → geofield-Bchfb6__.mjs} +1 -1
- package/dist/{geofield-0k7PkHRa.js → geofield-thoXisie.js} +1 -1
- package/dist/{group-mONe185y.js → group-B3QBe0YI.js} +1 -1
- package/dist/{group-BFDXdAfg.mjs → group-DUnv46e_.mjs} +1 -1
- package/dist/{intlphone-Bbk2UF9T.mjs → intlphone-BY59PVDg.mjs} +1 -1
- package/dist/{intlphone-zZ0xd-DG.js → intlphone-CMXEolsT.js} +1 -1
- package/dist/{keyvaluefield-BynOkgTq.mjs → keyvaluefield-BAYbTkCY.mjs} +1 -1
- package/dist/{keyvaluefield-B6oRZzic.js → keyvaluefield-FBaHQ8Ak.js} +1 -1
- package/dist/{line-ChQNdVfl.js → line-Bk15u06y.js} +1 -1
- package/dist/{line-DebtzkF3.mjs → line-Bzbkzk7f.mjs} +1 -1
- package/dist/{lineitemlist-CI0LwIUz.js → lineitemlist-8NL2THwe.js} +1 -1
- package/dist/{lineitemlist-CjFNpqI5.mjs → lineitemlist-PsoQ4LU4.mjs} +1 -1
- package/dist/{list-B5wBsflP.mjs → list-BGzVPlgh.mjs} +1 -1
- package/dist/{list-CJFKxKyN.js → list-BmGiSIoi.js} +1 -1
- package/dist/{locationfield-CrOMF7jt.js → locationfield-BG76gNbD.js} +1 -1
- package/dist/{locationfield-DQj3yDCa.mjs → locationfield-CupDmXsM.mjs} +1 -1
- package/dist/{markdowneditor-emqJhQV7.mjs → markdowneditor-4StkbrKV.mjs} +1 -1
- package/dist/{markdowneditor-Jaz7uTyZ.js → markdowneditor-vDHguMtU.js} +1 -1
- package/dist/{matrixfield-j5mf9lh5.mjs → matrixfield-CeROIIAj.mjs} +1 -1
- package/dist/{matrixfield-BPJsawGk.js → matrixfield-Vptf0zNH.js} +1 -1
- package/dist/{multitextbox-CyZiTd_E.mjs → multitextbox-DeVv6uzi.mjs} +1 -1
- package/dist/{multitextbox-DQbcEqkM.js → multitextbox-DtSydHcv.js} +1 -1
- package/dist/{npsscale-BIkJMD4Z.mjs → npsscale-Cd7PoCJS.mjs} +1 -1
- package/dist/{npsscale-oUUyPdxP.js → npsscale-Dwp2T0DQ.js} +1 -1
- package/dist/{numberstepper-thjufBMI.mjs → numberstepper-BFNTu3Ii.mjs} +1 -1
- package/dist/{numberstepper-DRIvgtcH.js → numberstepper-DBKq7hUm.js} +1 -1
- package/dist/{pie-COA-uozf.js → pie-CE4QV82D.js} +1 -1
- package/dist/{pie-4SHUYmRs.mjs → pie-DKRRH37e.mjs} +1 -1
- package/dist/{richtexteditor-BSV7hG6d.js → richtexteditor-B6lK2iIt.js} +1 -1
- package/dist/{richtexteditor-CvZ3Y7X1.mjs → richtexteditor-DdIfi0-T.mjs} +1 -1
- package/dist/schema.d.ts +10 -2
- package/dist/{signature-6QvVbfkT.js → signature-B_drsWTj.js} +1 -1
- package/dist/{signature-DeDxnc8U.mjs → signature-D9B8bFqg.mjs} +1 -1
- package/dist/{stepper-CDsErlLH.js → stepper-CO6XiIaw.js} +1 -1
- package/dist/{stepper-Sx3SWXTM.mjs → stepper-D6e9yWIr.mjs} +1 -1
- package/dist/{summaryfield-CAJjGmE2.mjs → summaryfield-BIA2gc1w.mjs} +1 -1
- package/dist/{summaryfield-DxzQ3g6Z.js → summaryfield-CR3aNMZU.js} +1 -1
- package/dist/{tabs-CnDP2ngC.js → tabs-B4ZbZQvt.js} +1 -1
- package/dist/{tabs-CvHNZU5o.mjs → tabs-PgOpdVX1.mjs} +1 -1
- package/dist/{tagsinput-DZcLPuX1.js → tagsinput-DtNb1IuV.js} +1 -1
- package/dist/{tagsinput-bWU3Mem0.mjs → tagsinput-G_M0DbpI.mjs} +1 -1
- package/dist/types.d.ts +188 -0
- package/dist/util/collection.d.ts +82 -0
- package/package.json +1 -1
- package/dist/AIForm-LoeI18mO.js +0 -43
package/dist/types.d.ts
CHANGED
|
@@ -81,6 +81,194 @@ export interface FormField {
|
|
|
81
81
|
optionsMap?: Record<string, any[]>;
|
|
82
82
|
[key: string]: any;
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Text shown on a `collection` item card: a field id (`'customerName'`), a
|
|
86
|
+
* template (`'{city}, {state} {zip}'`), a list of ids joined with " · ", or a
|
|
87
|
+
* function of the item.
|
|
88
|
+
*/
|
|
89
|
+
export type CollectionTextSpec = string | string[] | ((item: Record<string, any>) => string);
|
|
90
|
+
/** A theme palette name, or any CSS colour (`'#0ea5e9'`). */
|
|
91
|
+
export type CollectionColor = 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error' | (string & {});
|
|
92
|
+
/** One labelled fact on an item card: icon in front, then label and value. */
|
|
93
|
+
export interface CollectionDetailSpec {
|
|
94
|
+
/** Field id whose value is shown. */
|
|
95
|
+
field: string;
|
|
96
|
+
/** Label override (defaults to the field's own label). */
|
|
97
|
+
label?: string;
|
|
98
|
+
/** Material icon name shown in front (defaults to one based on the field type). */
|
|
99
|
+
icon?: string;
|
|
100
|
+
/** Grid columns this detail spans (grid layout). */
|
|
101
|
+
span?: number;
|
|
102
|
+
}
|
|
103
|
+
/** Responsive column count, e.g. `{ xs: 1, sm: 2, md: 4 }`. */
|
|
104
|
+
export type CollectionColumns = number | Partial<Record<'xs' | 'sm' | 'md' | 'lg' | 'xl', number>>;
|
|
105
|
+
/** How a `collection` item is summarised on its card / row. */
|
|
106
|
+
export interface CollectionDisplay {
|
|
107
|
+
/** Card heading / first table column. Defaults to the first field. */
|
|
108
|
+
title?: CollectionTextSpec;
|
|
109
|
+
/** Heading of the title column in the table layout (defaults to `itemLabel`). */
|
|
110
|
+
titleLabel?: string;
|
|
111
|
+
/** Optional secondary line under the title. */
|
|
112
|
+
subtitle?: CollectionTextSpec;
|
|
113
|
+
/** Material icon in front of the subtitle (e.g. `'place'` for an address). */
|
|
114
|
+
subtitleIcon?: string;
|
|
115
|
+
/** A status pill. `colors` maps a raw value (or its label) to a colour;
|
|
116
|
+
* `label` heads its column in the table layout. */
|
|
117
|
+
badge?: string | {
|
|
118
|
+
field: string;
|
|
119
|
+
label?: string;
|
|
120
|
+
colors?: Record<string, CollectionColor | 'default'>;
|
|
121
|
+
};
|
|
122
|
+
/** Leading avatar on cards: initials of the title, the collection icon, the item number, or none (default). */
|
|
123
|
+
avatar?: 'initials' | 'icon' | 'index' | 'none';
|
|
124
|
+
/**
|
|
125
|
+
* The labelled facts under the title. Defaults to every filled field not
|
|
126
|
+
* already in the title/subtitle/badge. List ids or `{ field, label, icon, span }`
|
|
127
|
+
* to choose and order them, or `false` to hide them.
|
|
128
|
+
*/
|
|
129
|
+
details?: (string | CollectionDetailSpec)[] | false;
|
|
130
|
+
/** `grid` (icon tiles), `list` (one row per fact) or `inline` (a wrapping line). */
|
|
131
|
+
detailsLayout?: 'grid' | 'list' | 'inline';
|
|
132
|
+
/** Grid columns. Defaults to as many as fit `minColumnWidth`. */
|
|
133
|
+
columns?: CollectionColumns;
|
|
134
|
+
/** Narrowest grid column in px when `columns` is not set (default 180). */
|
|
135
|
+
minColumnWidth?: number;
|
|
136
|
+
/** Show the icon in front of each detail (default true). */
|
|
137
|
+
showIcons?: boolean;
|
|
138
|
+
}
|
|
139
|
+
/** The add button of a collection level. */
|
|
140
|
+
export interface CollectionAddButton {
|
|
141
|
+
/** `header` (beside the title, default), `footer` (below the list), `both`, or `none`. */
|
|
142
|
+
position?: 'header' | 'footer' | 'both' | 'none';
|
|
143
|
+
/** `contained` (top-level default), `outlined` (nested default), `text`, `soft` (tinted) or `dashed` (full-width tile). */
|
|
144
|
+
variant?: 'dashed' | 'soft' | 'contained' | 'outlined' | 'text';
|
|
145
|
+
/** Material icon name (default `'add'`). */
|
|
146
|
+
icon?: string;
|
|
147
|
+
size?: 'small' | 'medium' | 'large';
|
|
148
|
+
fullWidth?: boolean;
|
|
149
|
+
}
|
|
150
|
+
/** Which item actions are offered. Edit and delete are on by default;
|
|
151
|
+
* duplicate, move (up/down) and collapse are opt-in. */
|
|
152
|
+
export interface CollectionActions {
|
|
153
|
+
edit?: boolean;
|
|
154
|
+
delete?: boolean;
|
|
155
|
+
duplicate?: boolean;
|
|
156
|
+
move?: boolean;
|
|
157
|
+
/** Collapse/expand toggle on items that own nested collections. */
|
|
158
|
+
collapse?: boolean;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Every user-facing string, so labels can be reworded or translated from JSON.
|
|
162
|
+
* Placeholders: `{label}` item label, `{labelLower}`, `{plural}`, `{pluralLower}`,
|
|
163
|
+
* `{title}` item title, `{max}`, `{detail}`. Nested levels inherit their parent's texts.
|
|
164
|
+
*/
|
|
165
|
+
export interface CollectionTexts {
|
|
166
|
+
add?: string;
|
|
167
|
+
addMore?: string;
|
|
168
|
+
emptyTitle?: string;
|
|
169
|
+
emptyText?: string;
|
|
170
|
+
edit?: string;
|
|
171
|
+
duplicate?: string;
|
|
172
|
+
moveUp?: string;
|
|
173
|
+
moveDown?: string;
|
|
174
|
+
delete?: string;
|
|
175
|
+
more?: string;
|
|
176
|
+
collapse?: string;
|
|
177
|
+
expand?: string;
|
|
178
|
+
editAria?: string;
|
|
179
|
+
deleteAria?: string;
|
|
180
|
+
viewAria?: string;
|
|
181
|
+
moreAria?: string;
|
|
182
|
+
collapseAria?: string;
|
|
183
|
+
expandAria?: string;
|
|
184
|
+
maxReached?: string;
|
|
185
|
+
dialogAddTitle?: string;
|
|
186
|
+
dialogEditTitle?: string;
|
|
187
|
+
dialogViewTitle?: string;
|
|
188
|
+
/** Line under a nested dialog title naming the parent, e.g. "For {parent}". */
|
|
189
|
+
dialogContext?: string;
|
|
190
|
+
save?: string;
|
|
191
|
+
saveChanges?: string;
|
|
192
|
+
saveAndAddAnother?: string;
|
|
193
|
+
cancel?: string;
|
|
194
|
+
close?: string;
|
|
195
|
+
closeAria?: string;
|
|
196
|
+
shortcut?: string;
|
|
197
|
+
deleteTitle?: string;
|
|
198
|
+
deleteMessage?: string;
|
|
199
|
+
deleteDetail?: string;
|
|
200
|
+
deleteConfirm?: string;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Named parts of a collection level that take an MUI `sx` override from JSON.
|
|
204
|
+
* The override is merged over the built-in style, so any look can be changed.
|
|
205
|
+
*/
|
|
206
|
+
export type CollectionSlot = 'root' | 'header' | 'headerIcon' | 'headerTitle' | 'headerCount' | 'headerDescription' | 'error' | 'list' | 'addButton' | 'empty' | 'emptyTitle' | 'emptyText' | 'item' | 'itemHeader' | 'avatar' | 'itemTitle' | 'badge' | 'subtitle' | 'actions' | 'actionButton' | 'counts' | 'details' | 'detail' | 'detailIcon' | 'detailLabel' | 'detailValue' | 'sections' | 'section' | 'table' | 'tableHead' | 'tableHeadCell' | 'tableRow' | 'tableCell' | 'rowActions' | 'mobileRow' | 'dialog' | 'dialogHeader' | 'dialogTitle' | 'dialogDescription' | 'dialogContext' | 'dialogContent' | 'dialogActions' | 'dialogCancel' | 'dialogSaveAnother' | 'dialogSave' | 'menu' | 'menuItem' | 'confirm' | 'confirmTitle' | 'confirmText' | 'confirmCancel' | 'confirmDelete';
|
|
207
|
+
export type CollectionStyles = Partial<Record<CollectionSlot, Record<string, any>>>;
|
|
208
|
+
/**
|
|
209
|
+
* One level of a `collection` field: a list of items added/edited through a
|
|
210
|
+
* dialog, rendered as cards. Each item can own nested `collections` (e.g. a
|
|
211
|
+
* Customer Location with Services and Backflow devices), to any depth.
|
|
212
|
+
* Everything — content, layout, wording and styling — is set from JSON.
|
|
213
|
+
* Output: `[{ ...itemFields, [child.id]: [{ ...childFields }] }]`.
|
|
214
|
+
*/
|
|
215
|
+
export interface CollectionConfig {
|
|
216
|
+
/** Key of this list in its parent item (the field id at the root). */
|
|
217
|
+
id: string;
|
|
218
|
+
/** Singular name, e.g. "Customer Location" → "Add Customer Location". */
|
|
219
|
+
itemLabel?: string;
|
|
220
|
+
/** Section heading. Defaults to the plural of `itemLabel`. */
|
|
221
|
+
title?: string;
|
|
222
|
+
/** Helper text under the heading. */
|
|
223
|
+
description?: string;
|
|
224
|
+
/** Material icon name for the section, dialog and item avatars. */
|
|
225
|
+
icon?: string;
|
|
226
|
+
/** Accent colour for this level (palette name or any CSS colour). */
|
|
227
|
+
color?: CollectionColor;
|
|
228
|
+
/** The fields of the add/edit dialog (any FormGenerator schema). */
|
|
229
|
+
fields: FormField[];
|
|
230
|
+
/** Card summary configuration. */
|
|
231
|
+
display?: CollectionDisplay;
|
|
232
|
+
/** Nested lists owned by each item. */
|
|
233
|
+
collections?: CollectionConfig[];
|
|
234
|
+
/** Columns for this level's nested sections inside an item (default 1 = stacked rows). */
|
|
235
|
+
sectionColumns?: CollectionColumns;
|
|
236
|
+
/** How items are shown: `cards` (top-level default) or `table` (nested
|
|
237
|
+
* default — one row per item, one column per detail; stacked rows on phones). */
|
|
238
|
+
layout?: 'cards' | 'table';
|
|
239
|
+
/** Card look: `outlined` (default, thin border), `card` (soft shadow) or `flat`. */
|
|
240
|
+
variant?: 'card' | 'outlined' | 'flat';
|
|
241
|
+
/** Add button placement and look. */
|
|
242
|
+
addButton?: CollectionAddButton;
|
|
243
|
+
/** Which item actions are offered. */
|
|
244
|
+
actions?: CollectionActions;
|
|
245
|
+
/** Minimum / maximum number of items at this level (validated on submit). */
|
|
246
|
+
min?: number;
|
|
247
|
+
max?: number;
|
|
248
|
+
minMessage?: string;
|
|
249
|
+
maxMessage?: string;
|
|
250
|
+
/** Dialog options. `addAnother` shows "Save & add another" (default true);
|
|
251
|
+
* `fullScreen` is `'mobile'` (default), `true` or `false`. */
|
|
252
|
+
dialog?: {
|
|
253
|
+
maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
254
|
+
description?: string;
|
|
255
|
+
addAnother?: boolean;
|
|
256
|
+
fullScreen?: boolean | 'mobile';
|
|
257
|
+
/** Grid spacing of the dialog form. */
|
|
258
|
+
spacing?: number;
|
|
259
|
+
};
|
|
260
|
+
/** Ask before deleting an item (default true). */
|
|
261
|
+
confirmDelete?: boolean;
|
|
262
|
+
/** Start items collapsed (default false). */
|
|
263
|
+
defaultCollapsed?: boolean;
|
|
264
|
+
/** Show a message when the list is empty. Defaults: true at the top level,
|
|
265
|
+
* false when nested (an empty nested section is just its title + add button). */
|
|
266
|
+
showEmpty?: boolean;
|
|
267
|
+
/** Reword / translate any text (inherited by nested levels). */
|
|
268
|
+
texts?: CollectionTexts;
|
|
269
|
+
/** Per-part `sx` overrides — see `CollectionSlot`. */
|
|
270
|
+
styles?: CollectionStyles;
|
|
271
|
+
}
|
|
84
272
|
/** An unmet validation rule reported back through `onSubmit`. */
|
|
85
273
|
export interface FormError extends ValidationRule {
|
|
86
274
|
id?: string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { CollectionConfig, CollectionTextSpec, FormField } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Pure helpers for the `collection` control (nested, dialog-edited lists such as
|
|
4
|
+
* Customer Locations → Services / Backflow devices). Kept free of React/MUI so
|
|
5
|
+
* FormGenerator can use them for validation and the review summary without
|
|
6
|
+
* pulling the (lazy) collection UI into the main bundle.
|
|
7
|
+
*/
|
|
8
|
+
/** A structural problem in a collection tree. `path` locates the offending
|
|
9
|
+
* LIST: `[]` is the root list, `[0, 'services']` is item 0's services list. */
|
|
10
|
+
export interface CollectionIssue {
|
|
11
|
+
path: (string | number)[];
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
14
|
+
/** Naive English plural for default headings/labels ("Service" → "Services",
|
|
15
|
+
* "Address" → "Addresses", "Facility" → "Facilities"). */
|
|
16
|
+
export declare const pluralize: (word: string, count?: number) => string;
|
|
17
|
+
/** Singular item label for a collection level ("Customer Location"). */
|
|
18
|
+
export declare const itemLabelOf: (config: Partial<CollectionConfig>) => string;
|
|
19
|
+
/** Section heading for a collection level ("Customer Locations"). */
|
|
20
|
+
export declare const titleOf: (config: Partial<CollectionConfig>) => string;
|
|
21
|
+
export declare const toItems: (value: any) => Record<string, any>[];
|
|
22
|
+
/** Find a field definition by id, following `subforms` branches. */
|
|
23
|
+
export declare const findField: (fields: FormField[] | undefined, id: string) => FormField | undefined;
|
|
24
|
+
/** Human-readable label of a field definition. */
|
|
25
|
+
export declare const fieldLabel: (field: FormField | undefined) => string;
|
|
26
|
+
/** Human-readable text for one stored value: option labels for selects/radios,
|
|
27
|
+
* Yes/No for booleans, formatted dates, joined arrays. */
|
|
28
|
+
export declare const formatValue: (field: FormField | undefined, value: any) => string;
|
|
29
|
+
/** Resolve a display spec against an item. A spec is a field id (`'name'`), a
|
|
30
|
+
* template (`'{city}, {state} {zip}'`), a list of ids joined with " · ", or a
|
|
31
|
+
* function `(item) => string`. */
|
|
32
|
+
export declare const resolveText: (spec: CollectionTextSpec | undefined, item: Record<string, any>, fields?: FormField[]) => string;
|
|
33
|
+
export interface ItemDetail {
|
|
34
|
+
id: string;
|
|
35
|
+
label: string;
|
|
36
|
+
value: string;
|
|
37
|
+
icon: string;
|
|
38
|
+
span?: number;
|
|
39
|
+
}
|
|
40
|
+
export declare const defaultIconFor: (field: FormField | undefined) => string;
|
|
41
|
+
/**
|
|
42
|
+
* Everything an item card shows: its title, optional subtitle, and the
|
|
43
|
+
* labelled `details` (icon + label + value) of its other filled fields — so
|
|
44
|
+
* every record is readable at a glance. Fields already in the title, subtitle
|
|
45
|
+
* or badge are not repeated. `display.details` lists ids or
|
|
46
|
+
* `{ field, label, icon, span }` to choose and order them, or is `false`.
|
|
47
|
+
*/
|
|
48
|
+
export declare const describeItem: (item: Record<string, any>, config: Partial<CollectionConfig>, index: number) => {
|
|
49
|
+
title: string;
|
|
50
|
+
subtitle: string;
|
|
51
|
+
details: ItemDetail[];
|
|
52
|
+
};
|
|
53
|
+
/** The field ids the title shows: from `display.title`, else the first field. */
|
|
54
|
+
export declare const titleFieldIds: (config: Partial<CollectionConfig>) => string[];
|
|
55
|
+
/**
|
|
56
|
+
* The facts a level shows for each item (and the columns of its table view),
|
|
57
|
+
* in order: `display.details` when given, else every field not already in the
|
|
58
|
+
* title, subtitle or badge. Labels/icons default from the field definitions.
|
|
59
|
+
*/
|
|
60
|
+
export declare const detailSpecs: (config: Partial<CollectionConfig>) => Omit<ItemDetail, "value">[];
|
|
61
|
+
/** Title + subtitle only (see `describeItem`). */
|
|
62
|
+
export declare const summarize: (item: Record<string, any>, config: Partial<CollectionConfig>, index: number) => {
|
|
63
|
+
title: string;
|
|
64
|
+
subtitle: string;
|
|
65
|
+
};
|
|
66
|
+
/** Count every nested item under `item`, per child collection (for delete
|
|
67
|
+
* confirmations: "also removes 2 services and 1 backflow"). */
|
|
68
|
+
export declare const describeDescendants: (item: Record<string, any>, config: Partial<CollectionConfig>) => string;
|
|
69
|
+
/**
|
|
70
|
+
* Walk a collection tree and report every level that breaks its `min`/`max`.
|
|
71
|
+
* `required` (from a mandatory rule) enforces at least one root item.
|
|
72
|
+
*/
|
|
73
|
+
export declare const collectionIssues: (value: any, config: Partial<CollectionConfig>, opts?: {
|
|
74
|
+
required?: boolean;
|
|
75
|
+
requiredMessage?: string;
|
|
76
|
+
}, path?: (string | number)[]) => CollectionIssue[];
|
|
77
|
+
/** Label/value rows for the review summary, print view and PDF export.
|
|
78
|
+
* Nested items are prefixed with their parent ("Customer Location 1 › Service 2"). */
|
|
79
|
+
export declare const collectionReviewRows: (value: any, config: Partial<CollectionConfig>, prefix?: string) => {
|
|
80
|
+
label: string;
|
|
81
|
+
value: string;
|
|
82
|
+
}[];
|