viewkitjs 0.32.0 → 0.34.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 +98 -0
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/query/evaluate.d.ts +7 -0
- package/fields/dist/query/exact-number.d.ts +8 -2
- package/fields/dist/query/exact-number.js +14 -1
- package/fields/dist/query/sort.js +13 -10
- package/fields/dist/registry.js +5 -1
- package/fields/dist/types.d.ts +4 -1
- package/fields/dist/zod.d.ts +5 -0
- package/fields/dist/zod.js +10 -1
- package/fields/docs/guides/contact-values.md +12 -0
- package/fields/docs/guides/field-types.md +1 -1
- package/fields/docs/guides/queries.md +3 -1
- package/fields/docs/reference/fields.md +1 -0
- package/package.json +1 -1
- package/postgres/dist/check.js +4 -1
- package/postgres/dist/definitions/formula-forms.js +3 -1
- package/postgres/dist/definitions/money.js +2 -1
- package/postgres/dist/page.js +6 -3
- package/postgres/dist/rules.d.ts +15 -1
- package/postgres/dist/rules.js +16 -0
- package/postgres/dist/sort.js +7 -2
- package/postgres/docs/guides/definitions.md +1 -1
- package/postgres/docs/guides/field-map.md +1 -1
- package/postgres/docs/reference/definitions.md +1 -1
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +4 -3
- package/views/dist/atoms/frame-parts.d.ts +6 -0
- package/views/dist/atoms/frame-parts.js +15 -0
- package/views/dist/atoms/types.d.ts +16 -7
- package/views/dist/cells/cell-title.d.ts +3 -1
- package/views/dist/cells/cell-title.js +2 -2
- package/views/dist/cells/cell-values.js +2 -2
- package/views/dist/contract.d.ts +46 -11
- package/views/dist/contract.js +157 -0
- package/views/dist/controls/alert/alert.js +2 -1
- package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
- package/views/dist/controls/bulk-bar/bulk-bar.js +25 -22
- package/views/dist/controls/button/map-button.js +2 -0
- package/views/dist/controls/checkbox/checkbox.d.ts +3 -2
- package/views/dist/controls/checkbox/checkbox.js +2 -2
- package/views/dist/controls/compound-editor/compound-editor.d.ts +1 -1
- package/views/dist/controls/compound-editor/name-parts.js +4 -4
- package/views/dist/controls/compound-editor/place-parts.js +19 -19
- package/views/dist/controls/compound-editor/range-parts.js +14 -14
- package/views/dist/controls/compound-editor/row.d.ts +3 -1
- package/views/dist/controls/compound-editor/row.js +2 -2
- package/views/dist/controls/controls.d.ts +4 -0
- package/views/dist/controls/controls.js +4 -0
- package/views/dist/controls/customize/customize.js +43 -39
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
- package/views/dist/controls/customize/map-customize-body.js +7 -2
- package/views/dist/controls/date-editor/date-days.js +2 -2
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
- package/views/dist/controls/date-editor/date-editor.js +27 -21
- package/views/dist/controls/date-editor/date-parts.js +6 -6
- package/views/dist/controls/date-editor/map-calendar.js +3 -1
- package/views/dist/controls/date-editor/map-date-body.d.ts +1 -1
- package/views/dist/controls/date-editor/map-date-body.js +7 -3
- package/views/dist/controls/date-editor.css +2 -2
- package/views/dist/controls/field/field.d.ts +3 -0
- package/views/dist/controls/field/field.js +6 -6
- package/views/dist/controls/filter-editor/block.d.ts +2 -2
- package/views/dist/controls/filter-editor/block.js +5 -5
- package/views/dist/controls/filter-editor/filter-editor.js +31 -33
- package/views/dist/controls/filter-editor/how.d.ts +3 -1
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +3 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +11 -4
- package/views/dist/controls/filter-editor/map-rules.js +1 -1
- package/views/dist/controls/filter-editor/parts.d.ts +3 -1
- package/views/dist/controls/filter-editor/parts.js +8 -6
- package/views/dist/controls/group-editor/group-editor.js +17 -14
- package/views/dist/controls/group-editor/map-group-body.d.ts +1 -0
- package/views/dist/controls/group-editor/map-group-body.js +5 -1
- package/views/dist/controls/index.d.ts +2 -0
- package/views/dist/controls/index.js +1 -0
- package/views/dist/controls/input/input.js +4 -3
- package/views/dist/controls/input/map-input.js +2 -0
- package/views/dist/controls/internal/editor-parts.js +1 -1
- package/views/dist/controls/internal/head-button.d.ts +9 -0
- package/views/dist/controls/internal/head-button.js +13 -0
- package/views/dist/controls/internal/map-panel-controls.d.ts +8 -0
- package/views/dist/controls/internal/map-panel-controls.js +20 -0
- package/views/dist/controls/internal/panel-controls.d.ts +58 -0
- package/views/dist/controls/internal/panel-controls.js +240 -0
- package/views/dist/controls/internal/part-slot.d.ts +12 -0
- package/views/dist/controls/internal/part-slot.js +5 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +1 -1
- package/views/dist/controls/links-editor/links-editor.js +27 -27
- package/views/dist/controls/menu/map-menu.d.ts +2 -2
- package/views/dist/controls/menu/map-menu.js +15 -12
- package/views/dist/controls/menu/menu.d.ts +3 -0
- package/views/dist/controls/menu/menu.js +5 -5
- package/views/dist/controls/menu-list/menu-list.d.ts +14 -4
- package/views/dist/controls/menu-list/menu-list.js +23 -22
- package/views/dist/controls/modal/modal.js +5 -3
- package/views/dist/controls/notice/notice.d.ts +3 -1
- package/views/dist/controls/notice/notice.js +2 -2
- package/views/dist/controls/number-editor/map-number-body.js +5 -1
- package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
- package/views/dist/controls/number-editor/number-editor.js +16 -16
- package/views/dist/controls/number-field/number-field.js +5 -3
- package/views/dist/controls/pane/map-pane.d.ts +3 -0
- package/views/dist/controls/pane/map-pane.js +5 -0
- package/views/dist/controls/pane/pane.d.ts +4 -2
- package/views/dist/controls/pane/pane.js +4 -4
- package/views/dist/controls/picker/map-fields-body.js +25 -1
- package/views/dist/controls/picker/picker.d.ts +2 -0
- package/views/dist/controls/picker/picker.js +37 -36
- package/views/dist/controls/picker/rows.d.ts +4 -0
- package/views/dist/controls/picker.css +10 -1
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +4 -2
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +2 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +7 -3
- package/views/dist/controls/quick-filters/quick-filters.js +8 -6
- package/views/dist/controls/radio/radio.d.ts +3 -0
- package/views/dist/controls/radio/radio.js +4 -3
- package/views/dist/controls/select/map-select.d.ts +3 -0
- package/views/dist/controls/select/map-select.js +8 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +3 -3
- package/views/dist/controls/setting-row/looks.js +5 -5
- package/views/dist/controls/setting-row/setting-row.d.ts +3 -1
- package/views/dist/controls/setting-row/setting-row.js +3 -1
- package/views/dist/controls/setting-row.css +3 -2
- package/views/dist/controls/sheet/bottom-sheet.d.ts +8 -2
- package/views/dist/controls/sheet/bottom-sheet.js +4 -4
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +1 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +8 -4
- package/views/dist/controls/sort-editor/sort-editor.js +24 -26
- package/views/dist/controls/sort-editor.css +5 -0
- package/views/dist/controls/text-editor/map-text-body.js +5 -1
- package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
- package/views/dist/controls/text-editor/text-editor.js +11 -10
- package/views/dist/controls/toolbar/toolbar.d.ts +4 -2
- package/views/dist/controls/toolbar/toolbar.js +2 -2
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +3 -3
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +7 -6
- package/views/dist/controls/values-editor/values-editor.d.ts +1 -1
- package/views/dist/controls/values-editor/values-editor.js +22 -22
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -2
- package/views/dist/controls/views-list/map-view-menu.js +7 -3
- package/views/dist/controls/views-list/map-views-list-body.d.ts +2 -1
- package/views/dist/controls/views-list/map-views-list-body.js +6 -5
- package/views/dist/controls/views-list/view-menu.js +9 -10
- package/views/dist/controls/views-list/views-list.js +6 -6
- package/views/dist/editors/EditorPanel.js +4 -4
- package/views/dist/field-row/FieldRow.js +13 -0
- package/views/dist/fields/money.d.ts +5 -2
- package/views/dist/fields/money.js +14 -2
- package/views/dist/grid/chrome/GridTable.js +4 -1
- package/views/dist/grid/chrome/cell-clipboard.d.ts +4 -2
- package/views/dist/grid/chrome/cell-clipboard.js +2 -2
- package/views/dist/grid/chrome/cells.js +3 -1
- package/views/dist/grid/chrome/grid-row-menu-items.js +1 -1
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +29 -6
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +9 -2
- package/views/dist/grid/core/clipboard-model.d.ts +3 -1
- package/views/dist/grid/core/clipboard-model.js +9 -8
- package/views/dist/grid/core/editing-controller.d.ts +3 -0
- package/views/dist/grid/core/editing-controller.js +6 -0
- package/views/dist/grid/core/edits-sink.d.ts +19 -0
- package/views/dist/grid/core/edits-sink.js +2 -0
- package/views/dist/grid/core/spreadsheet-operations.js +1 -1
- package/views/dist/grid/core/useGridEditing.d.ts +5 -0
- package/views/dist/grid/core/useGridEditing.js +6 -0
- package/views/dist/list/answer.d.ts +40 -0
- package/views/dist/list/answer.js +43 -0
- package/views/dist/list/bulk-bar.d.ts +7 -0
- package/views/dist/list/bulk-bar.js +10 -0
- package/views/dist/list/columns.d.ts +24 -0
- package/views/dist/list/columns.js +27 -0
- package/views/dist/list/edits.d.ts +19 -0
- package/views/dist/list/edits.js +56 -0
- package/views/dist/list/grid.d.ts +11 -0
- package/views/dist/list/grid.js +76 -0
- package/views/dist/list/index.d.ts +14 -1
- package/views/dist/list/index.js +4 -1
- package/views/dist/list/link.d.ts +8 -0
- package/views/dist/list/link.js +78 -0
- package/views/dist/list/list.d.ts +74 -0
- package/views/dist/list/list.js +18 -0
- package/views/dist/list/parts.js +11 -3
- package/views/dist/list/root-base.d.ts +46 -0
- package/views/dist/list/root-base.js +137 -0
- package/views/dist/list/root.d.ts +35 -34
- package/views/dist/list/root.js +153 -113
- package/views/dist/list/source-answers.d.ts +39 -0
- package/views/dist/list/source-answers.js +225 -0
- package/views/dist/list/store.d.ts +37 -5
- package/views/dist/list/store.js +31 -0
- package/views/dist/list/toolbar.d.ts +3 -2
- package/views/dist/list/toolbar.js +23 -5
- package/views/dist/list/views-axis.js +4 -2
- package/views/dist/list/views.d.ts +7 -2
- package/views/dist/list/views.js +16 -5
- package/views/dist/model/column-capabilities.d.ts +13 -0
- package/views/dist/model/column-capabilities.js +23 -2
- package/views/dist/model/column-schema.d.ts +11 -1
- package/views/dist/model/view-rules.js +1 -0
- package/views/dist/panels/model.d.ts +2 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +21 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +2 -2
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +12 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +20 -6
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +4 -3
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -4
- package/views/dist/panels/react/toolbar/ToolbarButton.js +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilter.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +4 -3
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +5 -4
- package/views/dist/panels/react/toolbar/ToolbarNew.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +8 -5
- package/views/dist/panels/react/toolbar/context.d.ts +31 -1
- package/views/dist/panels/react/toolbar/context.js +4 -0
- package/views/dist/panels/react/toolbar/pane-host.d.ts +6 -0
- package/views/dist/panels/react/toolbar/pane-host.js +17 -0
- package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
- package/views/dist/panels/react/toolbar/panel-part.js +7 -4
- package/views/dist/panels/react.d.ts +1 -1
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/provider/ViewsProvider.d.ts +7 -2
- package/views/dist/provider/ViewsProvider.js +18 -1
- package/views/dist/provider/components.d.ts +90 -2
- package/views/dist/provider/components.js +1 -1
- package/views/dist/provider/context.d.ts +4 -1
- package/views/dist/provider/own-control.d.ts +4 -0
- package/views/dist/provider/own-control.js +7 -0
- package/views/dist/provider/select-items.d.ts +3 -0
- package/views/dist/provider/select-items.js +6 -0
- package/views/dist/react.d.ts +4 -2
- package/views/dist/react.js +2 -0
- package/views/dist/styles.css +107 -80
- package/views/dist/styles.unlayered.css +107 -80
- package/views/docs/contract.md +310 -7
- package/views/docs/controls/alert-dialog.md +4 -0
- package/views/docs/controls/alert.md +4 -0
- package/views/docs/controls/bulk-bar.md +4 -0
- package/views/docs/controls/compound-editor.md +4 -0
- package/views/docs/controls/customize.md +8 -0
- package/views/docs/controls/date-editor.md +6 -0
- package/views/docs/controls/field.md +4 -0
- package/views/docs/controls/filter-editor.md +8 -0
- package/views/docs/controls/group-editor.md +8 -0
- package/views/docs/controls/input.md +4 -0
- package/views/docs/controls/links-editor.md +4 -0
- package/views/docs/controls/menu-list.md +8 -0
- package/views/docs/controls/menu.md +6 -0
- package/views/docs/controls/modal.md +4 -0
- package/views/docs/controls/notice.md +4 -0
- package/views/docs/controls/number-editor.md +6 -0
- package/views/docs/controls/pane.md +4 -0
- package/views/docs/controls/picker.md +8 -0
- package/views/docs/controls/quick-filters.md +8 -0
- package/views/docs/controls/radio.md +4 -0
- package/views/docs/controls/select.md +8 -0
- package/views/docs/controls/sheet.md +4 -0
- package/views/docs/controls/sort-editor.md +8 -0
- package/views/docs/controls/text-editor.md +6 -0
- package/views/docs/controls/toolbar.md +4 -0
- package/views/docs/controls/values-editor.md +4 -0
- package/views/docs/controls/views-list.md +8 -0
- package/views/docs/guides/the-grid.md +2 -2
- package/views/docs/guides/the-provider.md +19 -2
- package/views/docs/reference/controls.md +11 -7
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +1 -1
- package/views/docs/reference/list.md +143 -11
- package/views/docs/reference/looks.md +1 -1
- package/views/docs/reference/panels-react.md +6 -5
- package/views/docs/reference/react.md +19 -12
- package/views/docs/reference/views.md +11 -5
- package/views/docs/reshaping.md +17 -1
- package/views/skills/views/SKILL.md +1 -1
|
@@ -37,6 +37,9 @@ export type ViewsButtonProps = {
|
|
|
37
37
|
"aria-expanded"?: boolean;
|
|
38
38
|
/** The part's name, `vk-grid-row-more` on a row's ⋯. */
|
|
39
39
|
"data-slot"?: string;
|
|
40
|
+
/** Which one of a part that repeats, beside its `data-slot` (VK-1013: inside ViewKit's panels, under `panelControls`): a
|
|
41
|
+
* rule's field, an action's verb. Forward it to your element. */
|
|
42
|
+
"data-key"?: string;
|
|
40
43
|
/** A state flag: `""` (present, no value) while the menu this button opens is open; absent when closed. */
|
|
41
44
|
"data-open"?: "";
|
|
42
45
|
/** True while a field row's write is pending: the button keeps its focus and takes no press. Forward it to your
|
|
@@ -87,6 +90,8 @@ export type ViewsPopoverProps = {
|
|
|
87
90
|
/** The popup's own style, where a class cannot say it: a width that follows the cell it opens on. */
|
|
88
91
|
style?: CSSProperties;
|
|
89
92
|
className?: string;
|
|
93
|
+
/** Its name to a screen reader (VK-1013: Add sort's fields, inside a panel under `panelControls`): your popup's `aria-label`. */
|
|
94
|
+
label?: string;
|
|
90
95
|
children: ReactNode;
|
|
91
96
|
};
|
|
92
97
|
/** The app mounts one tooltip provider above the views; a tooltip never mounts its own. Its child may be a plain
|
|
@@ -161,6 +166,9 @@ export type ViewsMenuItem = {
|
|
|
161
166
|
* to find it). Called while the menu draws: return elements, call no hooks in it. Honoured on a plain row: a group, a
|
|
162
167
|
* tick and a link draw as they are. A hint: an adapter that ignores it draws the label. */
|
|
163
168
|
render?: () => ReactNode;
|
|
169
|
+
/** The row's public name where ViewKit names it (VK-1013: `vk-sort-rule-action`, a panel's menu under `panelControls`), its
|
|
170
|
+
* `key` saying which one: draw them on your row as its `data-slot` and `data-key`. */
|
|
171
|
+
slot?: string;
|
|
164
172
|
};
|
|
165
173
|
/** Opens at `anchor`, with no trigger child; a group opens beside it only where it asks to and the
|
|
166
174
|
* adapter can. On Base UI, the menu's root, positioner and popup, the anchor handed to the positioner. */
|
|
@@ -175,6 +183,9 @@ export type ViewsMenuProps = {
|
|
|
175
183
|
* menu the package opens hands one. */
|
|
176
184
|
label?: string;
|
|
177
185
|
className?: string;
|
|
186
|
+
/** The menu's public name where ViewKit names it (VK-988: `vk-view-menu`): draw it on your popup as its `data-slot`. ViewKit's
|
|
187
|
+
* own Menu also names each row `<name>-row`, which one by its item's `data-key`. */
|
|
188
|
+
"data-slot"?: string;
|
|
178
189
|
};
|
|
179
190
|
/** The command list's parts, the shape both cmdk-based shadcn copies already have. */
|
|
180
191
|
export type ViewsCommandParts = {
|
|
@@ -390,7 +401,9 @@ export type ViewsLinksBodyProps = {
|
|
|
390
401
|
/** In the phone's sheet: the step of your own you stand on (a link's roles), or `null` once you are back. */
|
|
391
402
|
onStepChange?: (step: ViewsBodyStep | null) => void;
|
|
392
403
|
};
|
|
393
|
-
/** A calendar over ISO days (`YYYY-MM-DD`) and months (`YYYY-MM`); the app's date library stays its own.
|
|
404
|
+
/** A calendar over ISO days (`YYYY-MM-DD`) and months (`YYYY-MM`); the app's date library stays its own. The filter's range
|
|
405
|
+
* calendar draws it as it is; inside the field editors (VK-1021) it draws the date editor's month, its head and its days, only
|
|
406
|
+
* where the provider's `panelControls` names `Calendar`. */
|
|
394
407
|
export type ViewsCalendarProps = {
|
|
395
408
|
value: string | null;
|
|
396
409
|
onChange: (day: string | null) => void;
|
|
@@ -408,6 +421,9 @@ export type ViewsCalendarProps = {
|
|
|
408
421
|
* its week as this locale does; an adapter may ignore it and keep its calendar's own. */
|
|
409
422
|
locale: string;
|
|
410
423
|
className?: string;
|
|
424
|
+
/** The part's public name where ViewKit names it (VK-1021: `vk-calendar`, the date editor's month under the provider's
|
|
425
|
+
* `panelControls`): draw it on your calendar's root as its `data-slot`. */
|
|
426
|
+
"data-slot"?: string;
|
|
411
427
|
};
|
|
412
428
|
/** A quick pick a date body offers: a day the editor names, or `none`, which empties the field. `next-monday` is the
|
|
413
429
|
* Monday after today (a week on when today is one); `in-a-week` is a week from today (today + 7 on the
|
|
@@ -673,6 +689,9 @@ export type ViewsCollapseProps = {
|
|
|
673
689
|
export type ViewsSheetAction = {
|
|
674
690
|
label: string;
|
|
675
691
|
onPress: () => void;
|
|
692
|
+
/** The action's public name (VK-1021): `vk-editor-close`, `vk-editor-save` or `vk-editor-back` on an editor panel's ✕, ✓
|
|
693
|
+
* and Back. Draw it on your button as its `data-slot`. */
|
|
694
|
+
slot?: string;
|
|
676
695
|
};
|
|
677
696
|
/** The editor panel's ✕ and ✓. `close` throws the edit away, as a swipe does; `done` closes it as
|
|
678
697
|
* done, and is absent where the body saves on its pick (a pick of one), which needs no ✓. A toolbar panel's sheet
|
|
@@ -812,6 +831,8 @@ export type ViewsFilterBodyField = {
|
|
|
812
831
|
type: keyof typeof FILTER_OPERATORS;
|
|
813
832
|
/** A relation's far fields, one level in: a rule on one is a relation rule (any, none or every where …). */
|
|
814
833
|
far?: readonly ViewsFilterBodyField[];
|
|
834
|
+
/** A number field that holds whole numbers only (`isIntegerField`): your body's box takes whole numbers. Absent, any. */
|
|
835
|
+
integer?: true;
|
|
815
836
|
/** A choice field's values (a status's, a select's, a person's, a record's), or a place's country's names (its `countryCode`
|
|
816
837
|
* part, VK-735), each as the Picker draws it, where ViewKit holds
|
|
817
838
|
* them as the list opens: your body may list them in the rule's value box. Absent where its values are read on demand, or the
|
|
@@ -1518,6 +1539,51 @@ export type ViewsInputProps = Omit<ComponentPropsWithRef<"input">, "children"> &
|
|
|
1518
1539
|
* wears the app's field frame, as a form's input does. Default `bare`. */
|
|
1519
1540
|
chrome?: "bare" | "field";
|
|
1520
1541
|
};
|
|
1542
|
+
/** One row of a Select's list (VK-1013). `level` holds the rows one level in, under a row that is never picked itself (a
|
|
1543
|
+
* deal's Company › Region): draw them in place, or flatten them with `flatSelectItems`, each named by its path. */
|
|
1544
|
+
export type ViewsSelectItem = {
|
|
1545
|
+
value: string;
|
|
1546
|
+
label: string;
|
|
1547
|
+
/** Its mark before the words: a field's type, a direction's arrow. */
|
|
1548
|
+
icon?: ReactNode;
|
|
1549
|
+
/** A second line under the words ("Sorted"). */
|
|
1550
|
+
line?: string;
|
|
1551
|
+
/** The heading it stands under. */
|
|
1552
|
+
group?: string;
|
|
1553
|
+
/** It can't be picked: greyed, passed over by the keys. */
|
|
1554
|
+
disabled?: boolean;
|
|
1555
|
+
level?: ViewsSelectItem[];
|
|
1556
|
+
};
|
|
1557
|
+
/** The components map's `Select` (VK-1013): pick one value, or several, from a list. ViewKit's panels draw it under the
|
|
1558
|
+
* provider's `panelControls` for the boxes that pick (the sort's field and direction, the filter's field, way and choices, New
|
|
1559
|
+
* view's columns). */
|
|
1560
|
+
export type ViewsSelectProps = {
|
|
1561
|
+
items: ViewsSelectItem[];
|
|
1562
|
+
/** One value, several (with `multiple`), or none. */
|
|
1563
|
+
value: string | string[] | null;
|
|
1564
|
+
/** A pick: one value, or the values now picked. */
|
|
1565
|
+
onValueChange: (value: string | string[] | null) => void;
|
|
1566
|
+
multiple?: boolean;
|
|
1567
|
+
/** What the box says with nothing picked. */
|
|
1568
|
+
placeholder?: string;
|
|
1569
|
+
disabled?: boolean;
|
|
1570
|
+
/** Its list held open or shut from outside, told every press that would open or shut it. On a phone a panel holds it
|
|
1571
|
+
* shut and turns its sheet to a step of its own on `onOpenChange(true)`: honour both when handed. */
|
|
1572
|
+
open?: boolean;
|
|
1573
|
+
onOpenChange?: (open: boolean) => void;
|
|
1574
|
+
/** The words of the search ViewKit's own Select shows over a long list ("Search deal fields"); yours may show one. */
|
|
1575
|
+
search?: string;
|
|
1576
|
+
size?: "sm" | "default";
|
|
1577
|
+
className?: string;
|
|
1578
|
+
"aria-label"?: string;
|
|
1579
|
+
/** The part's public name (`vk-sort-field`) and which one: draw them on the box a person presses. */
|
|
1580
|
+
"data-slot"?: string;
|
|
1581
|
+
"data-key"?: string;
|
|
1582
|
+
};
|
|
1583
|
+
/** The controls ViewKit's panels and field editors can draw as the app's own, under the provider's `panelControls` (VK-1013;
|
|
1584
|
+
* `Calendar`, the date editor's month, VK-1021). */
|
|
1585
|
+
export type PanelControlName = "Button" | "Select" | "Menu" | "Popover" | "Input" | "Calendar";
|
|
1586
|
+
export declare const PANEL_CONTROL_NAMES: readonly PanelControlName[];
|
|
1521
1587
|
/** What the components map's `RowsWait` is handed: a grid's rows, and whether new ones are loading. */
|
|
1522
1588
|
export type ViewsRowsWaitProps = {
|
|
1523
1589
|
/** New rows are loading: `children` are the old ones, inert. Draw how they wait (a bar along the top, the rows
|
|
@@ -1567,6 +1633,9 @@ export type ViewsComponents = {
|
|
|
1567
1633
|
/** Optional: every editor's single-line box draws through it. Left out, the provider draws a
|
|
1568
1634
|
* plain `<input>`. */
|
|
1569
1635
|
Input?: ComponentType<ViewsInputProps>;
|
|
1636
|
+
/** Optional: the panels' boxes that pick (VK-1013), drawn only inside ViewKit's panels and only where the provider's
|
|
1637
|
+
* `panelControls` names `Select`. Left out, the panels draw ViewKit's own (`CONTROLS.Select`). */
|
|
1638
|
+
Select?: ComponentType<ViewsSelectProps>;
|
|
1570
1639
|
/** Required: a whole pick list your app draws (`CONTROLS.Picker` is ViewKit's own). The select, several-values,
|
|
1571
1640
|
* place and relation editors open it, handed their rows as data. */
|
|
1572
1641
|
Picker: ComponentType<ViewsPickerProps>;
|
|
@@ -1633,11 +1702,30 @@ export type ViewsComponents = {
|
|
|
1633
1702
|
* draws it in its own place, in the box that holds it, at every count (zero included, so it can leave), handed its props;
|
|
1634
1703
|
* left out, ViewKit draws its own bar, portalled to the screen's foot. */
|
|
1635
1704
|
SelectionBar?: ComponentType<ViewsSelectionBarProps>;
|
|
1705
|
+
/** Optional: the Pane (CONTROLS: ViewKit's), a panel standing at the right edge of the list's box, the list in use beside
|
|
1706
|
+
* it. Handed one, a toolbar with `customizeIn: "pane"` opens Customize in it on a computer; left out, Customize opens in
|
|
1707
|
+
* the `Popover` as before. */
|
|
1708
|
+
Pane?: ComponentType<ViewsPaneProps>;
|
|
1709
|
+
};
|
|
1710
|
+
/** What the components map's `Pane` is handed (VK-1026): a toolbar panel standing at the right edge of the list's box, under
|
|
1711
|
+
* the toolbar, the list in use beside it, on a computer (`customizeIn: "pane"`: Customize). */
|
|
1712
|
+
export type ViewsPaneProps = {
|
|
1713
|
+
open: boolean;
|
|
1714
|
+
/** It closes from inside (Escape, its ✕): set `open` from it. */
|
|
1715
|
+
onOpenChange: (open: boolean) => void;
|
|
1716
|
+
/** The list's box it stands in: positioned, holding the grid, never scrolling itself. Null until it is on the page: draw
|
|
1717
|
+
* nothing. */
|
|
1718
|
+
container: HTMLElement | null;
|
|
1719
|
+
/** The part's button that opened it (⋯ while the part is folded into it): give it the focus back as it closes from inside. */
|
|
1720
|
+
opener: HTMLElement | null;
|
|
1721
|
+
/** Its name to a screen reader: the part's label. */
|
|
1722
|
+
label: string;
|
|
1723
|
+
children: ReactNode;
|
|
1636
1724
|
};
|
|
1637
1725
|
/** The selection bar's props, as your `SelectionBar` is handed them: ViewKit's `SelectionBar`'s own. */
|
|
1638
1726
|
export type ViewsSelectionBarProps = SelectionBarProps;
|
|
1639
1727
|
/** The map as the views read it: `Input` and `Calendar` always filled, the app's or the
|
|
1640
|
-
* package's own; `RowsWait`, `GroupBody`, `SearchField`, `PortsHost`, `SelectionBar` and `
|
|
1728
|
+
* package's own; `RowsWait`, `GroupBody`, `SearchField`, `PortsHost`, `SelectionBar`, `ViewMenu` and `Pane` as the app handed them. */
|
|
1641
1729
|
export type ViewsResolvedComponents = ViewsComponents & {
|
|
1642
1730
|
Input: ComponentType<ViewsInputProps>;
|
|
1643
1731
|
Calendar: ComponentType<ViewsCalendarProps>;
|
|
@@ -2,7 +2,7 @@ import type { FieldConventions } from "viewkitjs/fields";
|
|
|
2
2
|
import type { ViewsMessageResolver } from "../contract.js";
|
|
3
3
|
import type { ViewsAtoms } from "../atoms/types.js";
|
|
4
4
|
import type { FieldPresentation } from "../display/options.js";
|
|
5
|
-
import type { ViewsDatePicks, ViewsResolvedComponents, ViewsSelectionBarSettings, ViewsSheetActionsPlace } from "./components.js";
|
|
5
|
+
import type { PanelControlName, ViewsDatePicks, ViewsResolvedComponents, ViewsSelectionBarSettings, ViewsSheetActionsPlace } from "./components.js";
|
|
6
6
|
import type { ViewsIcons } from "./icons.js";
|
|
7
7
|
import type { ViewsResolvedPorts } from "./ports.js";
|
|
8
8
|
import type { ViewsEscapeRules } from "../editors/escape-rule.js";
|
|
@@ -40,6 +40,9 @@ export type ViewsContextValue = {
|
|
|
40
40
|
selectionBar?: ViewsSelectionBarSettings;
|
|
41
41
|
/** The quick days the date editors offer (`ViewsProvider`'s `datePicks`); absent, today, tomorrow and next Monday. */
|
|
42
42
|
datePicks?: ViewsDatePicks;
|
|
43
|
+
/** The controls ViewKit's panels draw as the app's own (`ViewsProvider`'s `panelControls`, VK-1013): each name opted in whose
|
|
44
|
+
* control in `components` is the app's, never one of ViewKit's own. Empty unless the app opts in. */
|
|
45
|
+
panelControls: ReadonlySet<PanelControlName>;
|
|
43
46
|
};
|
|
44
47
|
export declare const ViewsContext: import("react").Context<ViewsContextValue | null>;
|
|
45
48
|
export declare function useViews(): ViewsContextValue;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const OWN_CONTROL = Symbol.for("viewkitjs.views.own-control");
|
|
2
|
+
export function markOwnControl(control) {
|
|
3
|
+
return Object.defineProperty(control, OWN_CONTROL, { value: true, enumerable: false });
|
|
4
|
+
}
|
|
5
|
+
export function isOwnControl(control) {
|
|
6
|
+
return (typeof control === "function" || (typeof control === "object" && control !== null)) && control[OWN_CONTROL] === true;
|
|
7
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function flatSelectItems(items) {
|
|
2
|
+
return flatUnder(items, []);
|
|
3
|
+
}
|
|
4
|
+
function flatUnder(items, path) {
|
|
5
|
+
return items.flatMap(({ level, ...row }) => level ? flatUnder(level, [...path, row.label]) : [path.length ? { ...row, label: [...path, row.label].join(" › ") } : row]);
|
|
6
|
+
}
|
package/views/dist/react.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ export type { ViewsContextValue, ViewsProviderProps } from "./provider/ViewsProv
|
|
|
3
3
|
export type { EditEscape, EditEscapeByEditor, ViewsEscapeRules } from "./editors/escape-rule.js";
|
|
4
4
|
export type { ViewsOneValueEditors } from "./model/one-value.js";
|
|
5
5
|
export { DEFAULT_DESKTOP_QUERY } from "./provider/desktop.js";
|
|
6
|
+
export { PANEL_CONTROL_NAMES } from "./provider/components.js";
|
|
7
|
+
export { flatSelectItems } from "./provider/select-items.js";
|
|
6
8
|
export type { ViewsSeveralValues } from "./display/fit-values.js";
|
|
7
|
-
export type { ViewsAlign, ViewsAnchor, ViewsBarPlacement, ViewsButtonProps, ViewsCalendarProps, ViewsCheckboxProps, ViewsCloseReason, ViewsCollapseProps, ViewsCommandParts, ViewsComponents, ViewsCustomizeBodyProps, ViewsCustomizeChoice, ViewsCustomizeColumn, ViewsCustomizeColumns, ViewsCustomizeField, ViewsCustomizeFields, ViewsCustomizeLayout, ViewsCustomizePage, ViewsCustomizeToggle, ViewsDateBodyProps, ViewsDatePick, ViewsDatePicks, ViewsInputProps, ViewsFieldsBodyField, ViewsFieldsBodyProps, ViewsFilterBodyField, ViewsFilterBodyProps, ViewsFilterPartBodyProps, ViewsGroupBodyProps, ViewsGroupDimension, ViewsGroupEntry, ViewsGroupValue, ViewsMenuItem, ViewsMenuProps, ViewsNumberBodyProps, ViewsOpenChange, ViewsPartsBodyProps, ViewsPickerAction, ViewsPickerItem, ViewsPickerProps, ViewsLink, ViewsLinkRole, ViewsLinksBodyProps, ViewsPlacePart, ViewsPlaceParts, ViewsPopoverProps, ViewsPortsHostProps, ViewsSelectionBarProps, ViewsQuickFiltersBodyProps, ViewsResolvedComponents, ViewsRowsWaitProps, ViewsSearchFieldProps, ViewsSelectionBarSettings, ViewsSheetAction, ViewsSheetActions, ViewsBodyStep, ViewsSheetActionsPlace, ViewsSheetProps, ViewsSide, ViewsSortBodyProps, ViewsTextBodyProps, ViewsTooltipProps, ViewsValueLine, ViewsValuesBodyProps, ViewsViewsListBodyProps, ViewsViewsListItem, ViewsViewChange, ViewsViewLayout, ViewsViewMenuProps, ViewsViewRecord, ViewsViewVerbs, } from "./provider/components.js";
|
|
9
|
+
export type { ViewsAlign, ViewsAnchor, ViewsBarPlacement, ViewsButtonProps, ViewsCalendarProps, ViewsCheckboxProps, ViewsCloseReason, ViewsCollapseProps, ViewsCommandParts, ViewsComponents, ViewsCustomizeBodyProps, ViewsCustomizeChoice, ViewsCustomizeColumn, ViewsCustomizeColumns, ViewsCustomizeField, ViewsCustomizeFields, ViewsCustomizeLayout, ViewsCustomizePage, ViewsCustomizeToggle, ViewsDateBodyProps, ViewsDatePick, ViewsDatePicks, ViewsInputProps, ViewsFieldsBodyField, ViewsFieldsBodyProps, ViewsFilterBodyField, ViewsFilterBodyProps, ViewsFilterPartBodyProps, ViewsGroupBodyProps, ViewsGroupDimension, ViewsGroupEntry, ViewsGroupValue, ViewsMenuItem, ViewsMenuProps, ViewsNumberBodyProps, ViewsOpenChange, ViewsPartsBodyProps, ViewsPickerAction, ViewsPickerItem, ViewsPickerProps, ViewsLink, ViewsLinkRole, ViewsLinksBodyProps, ViewsPlacePart, ViewsPlaceParts, ViewsPopoverProps, ViewsPortsHostProps, PanelControlName, ViewsSelectionBarProps, ViewsSelectItem, ViewsSelectProps, ViewsQuickFiltersBodyProps, ViewsResolvedComponents, ViewsRowsWaitProps, ViewsSearchFieldProps, ViewsSelectionBarSettings, ViewsSheetAction, ViewsSheetActions, ViewsBodyStep, ViewsSheetActionsPlace, ViewsSheetProps, ViewsSide, ViewsSortBodyProps, ViewsTextBodyProps, ViewsTooltipProps, ViewsValueLine, ViewsValuesBodyProps, ViewsViewsListBodyProps, ViewsViewsListItem, ViewsViewChange, ViewsViewLayout, ViewsViewMenuProps, ViewsPaneProps, ViewsViewRecord, ViewsViewVerbs, } from "./provider/components.js";
|
|
8
10
|
export type { ViewsIconProps, ViewsIcons } from "./provider/icons.js";
|
|
9
11
|
export { NOOP_PORTS, NOOP_TOAST } from "./provider/ports.js";
|
|
10
12
|
export type { ViewsClipboardPort, ViewsConfirmPort, ViewsConfirmRequest, ViewsHapticsPort, ViewsPorts, ViewsPrefsPort, ViewsResolvedPorts, ViewsToastPort, } from "./provider/ports.js";
|
|
11
13
|
export { DEFAULT_VIEWS_ATOMS } from "./atoms/defaults.js";
|
|
12
|
-
export type { ViewsAtoms, ViewsAvatarProps, ViewsCommandMenuProps, ViewsRowMenuItem, ViewsRowMenuProps, ViewsListProps, ViewsRelationLinkProps, ViewsRelationRolesProps, ViewsCellMoreProps, ViewsLoadingProps, ViewsLoadMoreProps, ViewsPlatformMarkProps, ViewsRowContentProps, ViewsRowProps, ViewsSelectionSheetProps, ViewsStatusBadgeProps, ViewsStatusOption, ViewsStatusPlace, ViewsStatusMarkerProps, ViewsTagProps, ViewsTickBoxProps, ViewsChoiceRowProps, ViewsCheckRowProps, ViewsRadioRowProps, ViewsDirectionButtonProps, ViewsMenuRowProps, ViewsToggleRowProps, ViewsPanelSearchProps, ViewsPillProps, ViewsRangeCalendarProps, ViewsToolbarButtonProps, ViewsToolbarButtonPart, } from "./atoms/types.js";
|
|
14
|
+
export type { ViewsAtoms, ViewsAvatarProps, ViewsCommandMenuProps, ViewsRowMenuItem, ViewsRowMenuProps, ViewsListProps, ViewsRelationLinkProps, ViewsRelationRolesProps, ViewsCellMoreProps, ViewsLoadingProps, ViewsLoadMoreProps, ViewsPlatformMarkProps, ViewsRowContentProps, ViewsRowProps, ViewsSelectionSheetProps, ViewsStatusBadgeProps, ViewsStatusOption, ViewsStatusPlace, ViewsStatusMarkerProps, ViewsTagProps, ViewsTickBoxProps, ViewsChoiceRowProps, ViewsCheckRowProps, ViewsRadioRowProps, ViewsDirectionButtonProps, ViewsMenuRowProps, ViewsToggleRowProps, ViewsPanelSearchProps, ViewsPillProps, ViewsRangeCalendarProps, ViewsToolbarButtonProps, ViewsToolbarButtonPart, ViewsFramePart, } from "./atoms/types.js";
|
|
13
15
|
export type { ComponentName, PortName, ViewsIconName, ViewsMessage, ViewsMessageResolver } from "./contract.js";
|
package/views/dist/react.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
export { ViewsProvider, useViews } from "./provider/ViewsProvider.js";
|
|
3
3
|
export { DEFAULT_DESKTOP_QUERY } from "./provider/desktop.js";
|
|
4
|
+
export { PANEL_CONTROL_NAMES } from "./provider/components.js";
|
|
5
|
+
export { flatSelectItems } from "./provider/select-items.js";
|
|
4
6
|
export { NOOP_PORTS, NOOP_TOAST } from "./provider/ports.js";
|
|
5
7
|
export { DEFAULT_VIEWS_ATOMS } from "./atoms/defaults.js";
|