@viewkitjs/views 0.4.0 → 0.6.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 +768 -0
- package/README.md +5 -3
- package/dist/atoms/Avatar.d.ts +2 -0
- package/dist/atoms/Avatar.js +13 -0
- package/dist/atoms/CellMore.d.ts +2 -0
- package/dist/atoms/CellMore.js +4 -0
- package/dist/atoms/DisabledReason.d.ts +11 -0
- package/dist/atoms/DisabledReason.js +10 -0
- package/dist/atoms/DrillRows.d.ts +3 -0
- package/dist/atoms/DrillRows.js +27 -0
- package/dist/atoms/Loading.d.ts +6 -0
- package/dist/atoms/Loading.js +4 -1
- package/dist/atoms/PanelRows.d.ts +5 -0
- package/dist/atoms/PanelRows.js +38 -0
- package/dist/atoms/PanelSearch.d.ts +2 -0
- package/dist/atoms/PanelSearch.js +21 -0
- package/dist/atoms/Pill.d.ts +2 -0
- package/dist/atoms/Pill.js +25 -0
- package/dist/atoms/RangeCalendar.d.ts +8 -0
- package/dist/atoms/RangeCalendar.js +30 -0
- package/dist/atoms/RelationRoles.js +2 -2
- package/dist/atoms/SelectionSheet.d.ts +3 -0
- package/dist/atoms/SelectionSheet.js +31 -0
- package/dist/atoms/ToolbarButton.d.ts +2 -0
- package/dist/atoms/ToolbarButton.js +18 -0
- package/dist/atoms/defaults.js +22 -0
- package/dist/atoms/types.d.ts +257 -1
- package/dist/cells/cell-format.d.ts +10 -1
- package/dist/cells/cell-title.d.ts +5 -1
- package/dist/cells/cell-title.js +2 -2
- package/dist/cells/cell-values.js +22 -7
- package/dist/cells/relation-wrap.js +1 -1
- package/dist/contract.d.ts +515 -18
- package/dist/contract.js +660 -5
- package/dist/display/actor.js +1 -1
- package/dist/display/boolean.js +5 -0
- package/dist/display/entity-chip.d.ts +12 -9
- package/dist/display/entity-chip.js +4 -5
- package/dist/display/fit-values.d.ts +34 -0
- package/dist/display/fit-values.js +45 -0
- package/dist/display/location.js +1 -1
- package/dist/display/multi-value.js +72 -8
- package/dist/display/options.d.ts +9 -1
- package/dist/display/relation.js +1 -1
- package/dist/display/rich-text.js +17 -6
- package/dist/display/select.js +6 -4
- package/dist/display/status-steps.d.ts +8 -0
- package/dist/display/status-steps.js +18 -0
- package/dist/display/viewer.js +1 -0
- package/dist/editors/BodyFrame.d.ts +29 -0
- package/dist/editors/BodyFrame.js +80 -0
- package/dist/editors/DateEditor.js +13 -17
- package/dist/editors/LocationEditor.d.ts +2 -0
- package/dist/editors/LocationEditor.js +29 -5
- package/dist/editors/NameEditor.d.ts +2 -0
- package/dist/editors/NameEditor.js +27 -7
- package/dist/editors/NumberEditor.d.ts +18 -0
- package/dist/editors/NumberEditor.js +29 -2
- package/dist/editors/RangeEditor.d.ts +2 -0
- package/dist/editors/RangeEditor.js +29 -4
- package/dist/editors/SelectEditor.d.ts +5 -0
- package/dist/editors/SelectEditor.js +3 -2
- package/dist/editors/TextEditor.d.ts +11 -1
- package/dist/editors/TextEditor.js +25 -8
- package/dist/editors/ValueListEditor.d.ts +7 -0
- package/dist/editors/ValueListEditor.js +60 -48
- package/dist/editors/body-panel.d.ts +7 -0
- package/dist/editors/body-panel.js +8 -0
- package/dist/editors/edit-session.d.ts +20 -3
- package/dist/editors/edit-session.js +43 -3
- package/dist/editors/leave-scope.d.ts +23 -0
- package/dist/editors/leave-scope.js +28 -0
- package/dist/editors/number-body.d.ts +29 -0
- package/dist/editors/number-body.js +37 -0
- package/dist/editors/parts-body.d.ts +66 -0
- package/dist/editors/parts-body.js +114 -0
- package/dist/editors/tab-ends.d.ts +5 -0
- package/dist/editors/tab-ends.js +7 -0
- package/dist/editors/text-body.d.ts +16 -0
- package/dist/editors/text-body.js +30 -0
- package/dist/editors/values-body.d.ts +47 -0
- package/dist/editors/values-body.js +140 -0
- package/dist/field-row/FieldRow.d.ts +7 -0
- package/dist/field-row/FieldRow.js +44 -24
- package/dist/field-row/FieldRowLane.js +12 -4
- package/dist/field-row/editors/RowChipsEditor.js +3 -1
- package/dist/field-row/editors/RowEditor.js +2 -1
- package/dist/field-row/editors/RowNameEditor.d.ts +5 -2
- package/dist/field-row/editors/RowNameEditor.js +12 -5
- package/dist/field-row/editors/RowNumberEditor.js +18 -2
- package/dist/field-row/editors/RowPlaceEditor.js +4 -2
- package/dist/field-row/editors/RowRangeEditor.d.ts +5 -2
- package/dist/field-row/editors/RowRangeEditor.js +13 -6
- package/dist/field-row/editors/RowRelationEditor.js +5 -2
- package/dist/field-row/editors/RowSelectEditor.js +4 -1
- package/dist/field-row/editors/RowTextEditor.d.ts +1 -1
- package/dist/field-row/editors/RowTextEditor.js +12 -3
- package/dist/field-row/editors/RowValueListEditor.d.ts +2 -1
- package/dist/field-row/editors/RowValueListEditor.js +17 -4
- package/dist/field-row/editors/host.d.ts +3 -0
- package/dist/field-row/editors/row-session.d.ts +12 -1
- package/dist/field-row/editors/row-session.js +52 -2
- package/dist/field-row/field-row-button.d.ts +40 -0
- package/dist/field-row/field-row-button.js +18 -0
- package/dist/field-row/field-row-checkbox.d.ts +9 -0
- package/dist/field-row/field-row-checkbox.js +7 -0
- package/dist/figures.d.ts +5 -48
- package/dist/figures.js +1 -63
- package/dist/filters/filter-model.d.ts +2 -0
- package/dist/grid/chrome/GridAddColumn.js +17 -3
- package/dist/grid/chrome/GridAggregateMenu.d.ts +2 -0
- package/dist/grid/chrome/GridAggregateMenu.js +2 -0
- package/dist/grid/chrome/GridCellEditors.js +16 -6
- package/dist/grid/chrome/GridCellOutline.d.ts +7 -4
- package/dist/grid/chrome/GridCellOutline.js +4 -2
- package/dist/grid/chrome/GridChipsEditor.js +3 -1
- package/dist/grid/chrome/GridColumnMenu.d.ts +7 -4
- package/dist/grid/chrome/GridColumnMenu.js +5 -3
- package/dist/grid/chrome/GridColumnSortSection.d.ts +23 -3
- package/dist/grid/chrome/GridColumnSortSection.js +18 -1
- package/dist/grid/chrome/GridFooter.d.ts +4 -1
- package/dist/grid/chrome/GridFooter.js +6 -4
- package/dist/grid/chrome/GridGroupMenu.d.ts +7 -3
- package/dist/grid/chrome/GridGroupMenu.js +30 -8
- package/dist/grid/chrome/GridHeader.d.ts +5 -1
- package/dist/grid/chrome/GridHeader.js +9 -5
- package/dist/grid/chrome/GridLongTextEditor.js +15 -11
- package/dist/grid/chrome/GridNameEditor.js +4 -2
- package/dist/grid/chrome/GridNumberEditor.d.ts +8 -1
- package/dist/grid/chrome/GridNumberEditor.js +15 -3
- package/dist/grid/chrome/GridPager.d.ts +7 -0
- package/dist/grid/chrome/GridPager.js +34 -0
- package/dist/grid/chrome/GridPlaceEditor.js +4 -2
- package/dist/grid/chrome/GridRangeEditor.js +12 -4
- package/dist/grid/chrome/GridRelationEditor.js +5 -2
- package/dist/grid/chrome/GridRow.js +18 -6
- package/dist/grid/chrome/GridRowActions.d.ts +8 -3
- package/dist/grid/chrome/GridRowActions.js +16 -6
- package/dist/grid/chrome/GridRowCells.js +23 -7
- package/dist/grid/chrome/GridRowGlyph.d.ts +3 -1
- package/dist/grid/chrome/GridRowGlyph.js +7 -2
- package/dist/grid/chrome/GridSelectEditor.js +6 -3
- package/dist/grid/chrome/GridStructure.d.ts +6 -1
- package/dist/grid/chrome/GridStructure.js +32 -8
- package/dist/grid/chrome/GridTable.js +36 -24
- package/dist/grid/chrome/GridTableSurface.d.ts +5 -1
- package/dist/grid/chrome/GridTableSurface.js +5 -2
- package/dist/grid/chrome/GridTextEditor.d.ts +5 -1
- package/dist/grid/chrome/GridTextEditor.js +13 -3
- package/dist/grid/chrome/GridValueListEditor.d.ts +12 -4
- package/dist/grid/chrome/GridValueListEditor.js +11 -3
- package/dist/grid/chrome/StuckMarker.d.ts +3 -1
- package/dist/grid/chrome/StuckMarker.js +6 -2
- package/dist/grid/chrome/cells.d.ts +4 -2
- package/dist/grid/chrome/cells.js +2 -2
- package/dist/grid/chrome/grid-add-column-items.d.ts +1 -1
- package/dist/grid/chrome/grid-add-column-items.js +8 -1
- package/dist/grid/chrome/grid-button.d.ts +32 -0
- package/dist/grid/chrome/grid-button.js +12 -0
- package/dist/grid/chrome/grid-cell-classes.d.ts +38 -0
- package/dist/grid/chrome/grid-cell-classes.js +30 -0
- package/dist/grid/chrome/grid-column-menu-items.d.ts +3 -0
- package/dist/grid/chrome/grid-column-menu-items.js +32 -3
- package/dist/grid/chrome/grid-columns-template.d.ts +27 -0
- package/dist/grid/chrome/grid-columns-template.js +13 -0
- package/dist/grid/chrome/grid-edit-session.d.ts +4 -1
- package/dist/grid/chrome/grid-edit-session.js +11 -1
- package/dist/grid/chrome/grid-group-menu-items.d.ts +8 -1
- package/dist/grid/chrome/grid-group-menu-items.js +17 -0
- package/dist/grid/chrome/grid-group-menu-parts.d.ts +10 -6
- package/dist/grid/chrome/grid-group-menu-parts.js +4 -2
- package/dist/grid/chrome/grid-hover.d.ts +4 -1
- package/dist/grid/chrome/grid-hover.js +16 -6
- package/dist/grid/chrome/grid-pages.d.ts +15 -0
- package/dist/grid/chrome/grid-pages.js +9 -0
- package/dist/grid/chrome/grid-row-menu-items.js +18 -10
- package/dist/grid/chrome/grid-row-props.d.ts +6 -2
- package/dist/grid/chrome/grid-row-window.d.ts +7 -0
- package/dist/grid/chrome/grid-row-window.js +35 -1
- package/dist/grid/chrome/grid-table-props.d.ts +38 -4
- package/dist/grid/chrome/useGridColumnLayout.d.ts +3 -1
- package/dist/grid/chrome/useGridColumnLayout.js +29 -9
- package/dist/grid/chrome/useGridPartColumns.js +1 -1
- package/dist/grid/chrome/useGridScrollArea.js +2 -0
- package/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -0
- package/dist/grid/chrome/useGridTableInteractionModel.js +5 -3
- package/dist/grid/chrome/useGridTableSelection.d.ts +3 -1
- package/dist/grid/chrome/useGridTableSelection.js +2 -2
- package/dist/grid/chrome/useHeaderDragReorder.js +2 -0
- package/dist/grid/core/editing-controller.d.ts +36 -11
- package/dist/grid/core/editing-controller.js +92 -25
- package/dist/grid/core/grid-aria.d.ts +4 -0
- package/dist/grid/core/grid-aria.js +6 -4
- package/dist/grid/core/grid-focus.d.ts +6 -0
- package/dist/grid/core/grid-focus.js +28 -5
- package/dist/grid/core/useGridEditing.d.ts +11 -2
- package/dist/grid/core/useGridEditing.js +9 -5
- package/dist/grid/core/write-states.d.ts +20 -0
- package/dist/grid/core/write-states.js +21 -0
- package/dist/grid/grid-format-props.d.ts +26 -0
- package/dist/grid/grid-format-props.js +65 -0
- package/dist/grid/index.d.ts +3 -1
- package/dist/grid/index.js +1 -0
- package/dist/grid/useGridTablePrefs.d.ts +20 -21
- package/dist/grid/useGridTablePrefs.js +6 -58
- package/dist/grid/useGridTableSettings.d.ts +60 -0
- package/dist/grid/useGridTableSettings.js +61 -0
- package/dist/grouping/sort-groups.d.ts +6 -7
- package/dist/internal/count.d.ts +3 -0
- package/dist/internal/count.js +3 -0
- package/dist/model/aggregates.d.ts +3 -3
- package/dist/model/aggregates.js +17 -71
- package/dist/model/body-frame.d.ts +16 -0
- package/dist/model/body-frame.js +5 -0
- package/dist/model/column-capabilities.d.ts +4 -1
- package/dist/model/column-capabilities.js +4 -1
- package/dist/model/column-filters.d.ts +7 -4
- package/dist/model/column-filters.js +26 -18
- package/dist/model/column-inspect.d.ts +3 -2
- package/dist/model/column-inspect.js +3 -1
- package/dist/model/column-order.d.ts +2 -2
- package/dist/model/column-schema.d.ts +6 -7
- package/dist/model/column-sort.d.ts +11 -0
- package/dist/model/column-sort.js +14 -0
- package/dist/model/column-state.d.ts +3 -20
- package/dist/model/column-state.js +1 -4
- package/dist/model/column-types.d.ts +1 -15
- package/dist/model/column-types.js +1 -1
- package/dist/model/one-value.d.ts +6 -0
- package/dist/model/one-value.js +5 -0
- package/dist/model/part-columns.d.ts +1 -6
- package/dist/model/part-columns.js +1 -1
- package/dist/model/part-rows.d.ts +2 -9
- package/dist/model/part-rows.js +1 -10
- package/dist/model/part-write.js +1 -1
- package/dist/model/place-parts.d.ts +6 -0
- package/dist/model/place-parts.js +14 -0
- package/dist/model/preferences.d.ts +3 -23
- package/dist/model/preferences.js +1 -17
- package/dist/model/prefs-buckets.d.ts +0 -27
- package/dist/model/prefs-buckets.js +1 -1
- package/dist/model/relation-filters.d.ts +13 -3
- package/dist/model/relation-filters.js +9 -4
- package/dist/model/row-icon.d.ts +17 -11
- package/dist/model/settings-columns.d.ts +34 -0
- package/dist/model/settings-columns.js +146 -0
- package/dist/model/settings-look.d.ts +17 -0
- package/dist/model/settings-look.js +23 -0
- package/dist/model/view-rules.d.ts +32 -6
- package/dist/model/view-rules.js +99 -23
- package/dist/panels/availability.d.ts +26 -0
- package/dist/panels/availability.js +28 -0
- package/dist/panels/filter/DateFilterBody.d.ts +42 -0
- package/dist/panels/filter/DateFilterBody.js +64 -0
- package/dist/panels/filter/DateFilterCalendar.d.ts +19 -0
- package/dist/panels/filter/DateFilterCalendar.js +37 -0
- package/dist/panels/filter/DateFilterInput.d.ts +16 -0
- package/dist/panels/filter/DateFilterInput.js +37 -0
- package/dist/panels/filter/FilterIcon.d.ts +7 -0
- package/dist/panels/filter/FilterIcon.js +15 -0
- package/dist/panels/filter/MenuSelect.d.ts +12 -0
- package/dist/panels/filter/MenuSelect.js +34 -0
- package/dist/panels/filter/NumberFilterBody.d.ts +21 -0
- package/dist/panels/filter/NumberFilterBody.js +76 -0
- package/dist/panels/filter/RangeFilterBody.d.ts +19 -0
- package/dist/panels/filter/RangeFilterBody.js +71 -0
- package/dist/panels/filter/RelationFilterBody.d.ts +17 -0
- package/dist/panels/filter/RelationFilterBody.js +20 -0
- package/dist/panels/filter/TextFilterBody.d.ts +31 -0
- package/dist/panels/filter/TextFilterBody.js +44 -0
- package/dist/panels/filter/TimeScopeDetail.d.ts +6 -0
- package/dist/panels/filter/TimeScopeDetail.js +47 -0
- package/dist/panels/filter/details.d.ts +17 -0
- package/dist/panels/filter/details.js +73 -0
- package/dist/panels/filter/filter-list.d.ts +23 -0
- package/dist/panels/filter/filter-list.js +38 -0
- package/dist/panels/group-sort.d.ts +24 -0
- package/dist/panels/group-sort.js +58 -0
- package/dist/panels/index.d.ts +24 -0
- package/dist/panels/index.js +17 -0
- package/dist/panels/labels.d.ts +37 -0
- package/dist/panels/labels.js +166 -0
- package/dist/panels/model.d.ts +343 -0
- package/dist/panels/model.js +77 -0
- package/dist/panels/react/GroupBucketsList.d.ts +16 -0
- package/dist/panels/react/GroupBucketsList.js +38 -0
- package/dist/panels/react/LayoutColumnsList.d.ts +24 -0
- package/dist/panels/react/LayoutColumnsList.js +71 -0
- package/dist/panels/react/PopoverColumnDetail.d.ts +11 -0
- package/dist/panels/react/PopoverColumnDetail.js +24 -0
- package/dist/panels/react/chrome.d.ts +17 -0
- package/dist/panels/react/chrome.js +8 -0
- package/dist/panels/react/column-refusals.d.ts +7 -0
- package/dist/panels/react/column-refusals.js +14 -0
- package/dist/panels/react/customize.d.ts +26 -0
- package/dist/panels/react/customize.js +98 -0
- package/dist/panels/react/drag.d.ts +2 -0
- package/dist/panels/react/drag.js +6 -0
- package/dist/panels/react/field-editor.d.ts +10 -0
- package/dist/panels/react/field-editor.js +1 -0
- package/dist/panels/react/filter-panel.d.ts +15 -0
- package/dist/panels/react/filter-panel.js +48 -0
- package/dist/panels/react/layout-detail.d.ts +4 -0
- package/dist/panels/react/layout-detail.js +21 -0
- package/dist/panels/react/order-details.d.ts +32 -0
- package/dist/panels/react/order-details.js +81 -0
- package/dist/panels/react/panel-header.d.ts +10 -0
- package/dist/panels/react/panel-header.js +12 -0
- package/dist/panels/react/panel-sheet.d.ts +19 -0
- package/dist/panels/react/panel-sheet.js +22 -0
- package/dist/panels/react/popover.d.ts +71 -0
- package/dist/panels/react/popover.js +47 -0
- package/dist/panels/react/root-list.d.ts +6 -0
- package/dist/panels/react/root-list.js +31 -0
- package/dist/panels/react/toolbar/ReadyToolbar.d.ts +42 -0
- package/dist/panels/react/toolbar/ReadyToolbar.js +92 -0
- package/dist/panels/react/toolbar/Toolbar.d.ts +16 -0
- package/dist/panels/react/toolbar/Toolbar.js +34 -0
- package/dist/panels/react/toolbar/ToolbarButton.d.ts +5 -0
- package/dist/panels/react/toolbar/ToolbarButton.js +9 -0
- package/dist/panels/react/toolbar/ToolbarFilter.d.ts +19 -0
- package/dist/panels/react/toolbar/ToolbarFilter.js +32 -0
- package/dist/panels/react/toolbar/ToolbarNew.d.ts +12 -0
- package/dist/panels/react/toolbar/ToolbarNew.js +21 -0
- package/dist/panels/react/toolbar/ToolbarOptions.d.ts +25 -0
- package/dist/panels/react/toolbar/ToolbarOptions.js +33 -0
- package/dist/panels/react/toolbar/ToolbarSearch.d.ts +9 -0
- package/dist/panels/react/toolbar/ToolbarSearch.js +41 -0
- package/dist/panels/react/toolbar/ToolbarSort.d.ts +12 -0
- package/dist/panels/react/toolbar/ToolbarSort.js +16 -0
- package/dist/panels/react/toolbar/ToolbarViews.d.ts +13 -0
- package/dist/panels/react/toolbar/ToolbarViews.js +24 -0
- package/dist/panels/react/toolbar/context.d.ts +29 -0
- package/dist/panels/react/toolbar/context.js +49 -0
- package/dist/panels/react/toolbar/panel-part.d.ts +37 -0
- package/dist/panels/react/toolbar/panel-part.js +37 -0
- package/dist/panels/react/toolbar/panel-state.d.ts +9 -0
- package/dist/panels/react/toolbar/panel-state.js +12 -0
- package/dist/panels/react/toolbar/use-box-narrow.d.ts +2 -0
- package/dist/panels/react/toolbar/use-box-narrow.js +18 -0
- package/dist/panels/react/toolbar/use-list-settings-state.d.ts +10 -0
- package/dist/panels/react/toolbar/use-list-settings-state.js +10 -0
- package/dist/panels/react/view-actions.d.ts +4 -0
- package/dist/panels/react/view-actions.js +37 -0
- package/dist/panels/react/view-footer.d.ts +16 -0
- package/dist/panels/react/view-footer.js +11 -0
- package/dist/panels/react/views-row/FoldingViewRow.d.ts +4 -0
- package/dist/panels/react/views-row/FoldingViewRow.js +105 -0
- package/dist/panels/react/views-row/HScrollRow.d.ts +7 -0
- package/dist/panels/react/views-row/HScrollRow.js +42 -0
- package/dist/panels/react/views-row/PillGroup.d.ts +30 -0
- package/dist/panels/react/views-row/PillGroup.js +86 -0
- package/dist/panels/react/views-row/ViewAxes.d.ts +6 -0
- package/dist/panels/react/views-row/ViewAxes.js +16 -0
- package/dist/panels/react/views-row/ViewCreatePill.d.ts +7 -0
- package/dist/panels/react/views-row/ViewCreatePill.js +11 -0
- package/dist/panels/react/views-row/ViewPicker.d.ts +5 -0
- package/dist/panels/react/views-row/ViewPicker.js +65 -0
- package/dist/panels/react/views-row/ViewPickerRow.d.ts +7 -0
- package/dist/panels/react/views-row/ViewPickerRow.js +18 -0
- package/dist/panels/react/views-row/ViewTabs.d.ts +31 -0
- package/dist/panels/react/views-row/ViewTabs.js +29 -0
- package/dist/panels/react/views-row/menu-classes.d.ts +6 -0
- package/dist/panels/react/views-row/menu-classes.js +3 -0
- package/dist/panels/react/views-row/use-anchored-toggle.d.ts +19 -0
- package/dist/panels/react/views-row/use-anchored-toggle.js +31 -0
- package/dist/panels/react.d.ts +51 -0
- package/dist/panels/react.js +43 -0
- package/dist/panels/settings/axes.d.ts +28 -0
- package/dist/panels/settings/axes.js +71 -0
- package/dist/panels/settings/filters.d.ts +5 -0
- package/dist/panels/settings/filters.js +62 -0
- package/dist/panels/settings/group-buckets.d.ts +23 -0
- package/dist/panels/settings/group-buckets.js +73 -0
- package/dist/panels/settings/input.d.ts +69 -0
- package/dist/panels/settings/input.js +1 -0
- package/dist/panels/settings/layout.d.ts +5 -0
- package/dist/panels/settings/layout.js +244 -0
- package/dist/panels/settings/order.d.ts +19 -0
- package/dist/panels/settings/order.js +271 -0
- package/dist/panels/settings/settings-panels.d.ts +17 -0
- package/dist/panels/settings/settings-panels.js +28 -0
- package/dist/panels/toolbar/clear.d.ts +9 -0
- package/dist/panels/toolbar/clear.js +26 -0
- package/dist/panels/toolbar/counts.d.ts +15 -0
- package/dist/panels/toolbar/counts.js +21 -0
- package/dist/panels/toolbar/edit-view.d.ts +5 -0
- package/dist/panels/toolbar/edit-view.js +18 -0
- package/dist/panels/toolbar/model.d.ts +34 -0
- package/dist/panels/toolbar/model.js +52 -0
- package/dist/panels/use-filter-opened.d.ts +8 -0
- package/dist/panels/use-filter-opened.js +11 -0
- package/dist/panels/view-state.d.ts +38 -0
- package/dist/panels/view-state.js +1 -0
- package/dist/panels/views-row/model.d.ts +131 -0
- package/dist/panels/views-row/model.js +14 -0
- package/dist/provider/ViewsProvider.d.ts +50 -6
- package/dist/provider/ViewsProvider.js +33 -2
- package/dist/provider/components.d.ts +274 -11
- package/dist/provider/context.d.ts +23 -2
- package/dist/provider/desktop.d.ts +3 -0
- package/dist/provider/desktop.js +7 -4
- package/dist/react.d.ts +5 -2
- package/dist/selection/SelectionBar.d.ts +18 -0
- package/dist/selection/SelectionBar.js +98 -0
- package/dist/selection/SelectionBarPhone.d.ts +3 -0
- package/dist/selection/SelectionBarPhone.js +14 -0
- package/dist/selection/bar-overflow.d.ts +12 -0
- package/dist/selection/bar-overflow.js +55 -0
- package/dist/selection/bar-parts.d.ts +17 -0
- package/dist/selection/bar-parts.js +19 -0
- package/dist/selection/index.d.ts +2 -0
- package/dist/selection/index.js +1 -0
- package/dist/selection/types.d.ts +3 -2
- package/dist/selection/useListSelectionShortcuts.d.ts +3 -2
- package/dist/selection/useListSelectionShortcuts.js +1 -1
- package/dist/selection/verbs.d.ts +41 -0
- package/dist/selection/verbs.js +1 -0
- package/docs/contract.md +355 -35
- package/docs/getting-started.md +1 -1
- package/docs/guides/atoms.md +39 -6
- package/docs/guides/columns.md +1 -1
- package/docs/guides/display.md +3 -2
- package/docs/guides/editors.md +4 -3
- package/docs/guides/selection.md +35 -21
- package/docs/guides/the-grid.md +24 -13
- package/docs/guides/the-provider.md +24 -6
- package/docs/index.md +2 -0
- package/docs/install.md +3 -1
- package/docs/reference/cells.md +1 -1
- package/docs/reference/display.md +5 -4
- package/docs/reference/editors-location.md +3 -1
- package/docs/reference/editors-name.md +3 -1
- package/docs/reference/editors-number.md +1 -0
- package/docs/reference/editors-range.md +3 -1
- package/docs/reference/editors-session.md +1 -0
- package/docs/reference/editors-text.md +2 -2
- package/docs/reference/editors-value-list.md +1 -1
- package/docs/reference/field-row.md +2 -2
- package/docs/reference/grid.md +10 -7
- package/docs/reference/panels-react.md +101 -0
- package/docs/reference/panels.md +123 -0
- package/docs/reference/react.md +45 -12
- package/docs/reference/selection.md +11 -3
- package/docs/reference/views.md +41 -38
- package/package.json +33 -4
- package/skills/views/SKILL.md +5 -4
package/docs/reference/react.md
CHANGED
|
@@ -7,29 +7,31 @@ Import from `@viewkitjs/views/react` in a client component: the door opens with
|
|
|
7
7
|
Guide: [the provider](../guides/the-provider.md).
|
|
8
8
|
|
|
9
9
|
- `ViewsProvider` — the provider every view reads: mount it once at your app's client root, above every view, with its components, icons, ports and conventions. It lays your atoms over the defaults, hands your `Menu` its items with every row under a disabled group already disabled, and fills in the browser's own confirm where your ports carry no `confirm`. It hands its views one context value per distinct set of inputs, so pass module-level objects: a new one on each render re-renders every view.
|
|
10
|
-
- `ViewsProviderProps` — what the provider takes. Its optional `desktopQuery` is the media query that means a desktop, so an editor opens as a popover there and as a sheet elsewhere
|
|
10
|
+
- `ViewsProviderProps` — what the provider takes. Its optional `desktopQuery` is the media query that means a desktop, so an editor opens as a popover there and as a sheet elsewhere, as do the toolbar's panels and the views picker outside a `Toolbar`; hand in the one your own shell switches on. Default `DEFAULT_DESKTOP_QUERY`. Its optional `sheetActions` (`ViewsSheetActionsPlace`, default `bar`) says where an editor's ✕ and ✓, and a toolbar panel's ✕, stand in that sheet. Its optional `escape` (`ViewsEscapeRules`) says what Escape does in an editor of each field type on a desktop, `"keep"` or `"cancel"`, a type left out cancelling. Its optional `sayRefusals` (default false) has the grid say, through the toast port's `error`, why your app refused an edit it sent. Its optional `menus` (`ViewsMenuRoute`, default `popover`) says how the grid opens its own menus: in your `Popover` with ViewKit's rows, or through your `Menu`. Its optional `gridButtons` (`ViewsGridButtons`, default `own`) says who draws the buttons the grid draws itself: ViewKit, or your `Button`. Its optional `gridCheckboxes` (`ViewsGridCheckboxes`, default `own`) says who draws a yes/no cell's box in the grid: ViewKit's tick box, or your `Checkbox`. Its optional `fieldRowButtons` (`ViewsFieldRowButtons`, default `own`) and `fieldRowCheckboxes` (`ViewsFieldRowCheckboxes`, default `own`) say the same for a field row's own buttons and its yes/no. Its optional `selectionBar` (`ViewsSelectionBarSettings`) says where the selection bar sits. Its optional `oneValue` (`ViewsOneValueEditors`) says whether a single email or domain opens the text box in its cell (the default) or the value list holding one value, in the grid and a field row alike. Its optional `bodyFrame` (`ViewsBodyFrame`, default `views`) says who sets the width and padding of the popover around a whole body your app hands: ViewKit, or, at `popover`, your `Popover`, the popover marked `data-vk-body`. Its optional `datePicks` (`ViewsDatePicks`) names the quick days the date editors offer, in order; absent, today, tomorrow and next Monday.
|
|
11
11
|
- `EditEscape` — `"cancel" | "keep"`: what Escape does in an edit session (`@viewkitjs/views/editors/session` hands it on too).
|
|
12
12
|
- `ViewsEscapeRules` — `Partial<Record<FieldType, EditEscape>>`, the provider's `escape`.
|
|
13
|
+
- `ViewsOneValueEditors` — `Partial<Record<"email" | "domain", "text" | "list">>`, the provider's `oneValue`.
|
|
14
|
+
- `ViewsBodyFrame` — `"views" | "popover"`, the provider's `bodyFrame`.
|
|
13
15
|
- `DEFAULT_DESKTOP_QUERY` — `(min-width: 1024px)`: the width a desktop starts at when the provider is handed no `desktopQuery`. Where the screen can't be asked (a server render, a browser with no `matchMedia`), it is a desktop.
|
|
14
16
|
- Required: `components` (your primitives, `ViewsComponents`), `icons` (your glyphs by meaning, `ViewsIcons`), `ports` (your runtime services, `ViewsPorts`), `conventions` (the `FieldConventions` of `@viewkitjs/fields` every value is read with) and `children`.
|
|
15
17
|
- Optional: `atoms`, any of your own atoms, each laid over the default of its name; `messages`, your wording for the package's own messages, defaulting to `resolveViewsMessage` (the package's English); `presentation`, `(defaults: FieldPresentation) => FieldPresentation`, how your numbers, dates and durations read: given the package's defaults in the conventions' locale, return yours. It is called where a value is drawn, so your provider imports none of the display.
|
|
16
18
|
- `useViews` — reads the nearest provider's value inside a view or an atom of your own. It throws an error that says where to mount one when no `ViewsProvider` is above it.
|
|
17
|
-
- `ViewsContextValue` — what `useViews` returns: the `components` (your `Menu` wrapped to settle disabled groups), the merged `atoms`, the `icons`, the `ports` as `ViewsResolvedPorts` (`confirm` always a function), the `messages` resolver, the `conventions`, your `presentation` when you handed one, and the `desktopQuery` in force (yours or `DEFAULT_DESKTOP_QUERY`); `escape` and `sayRefusals` when you handed them; and `menus`, how the grid opens its own menus (absent means `popover`).
|
|
19
|
+
- `ViewsContextValue` — what `useViews` returns: the `components` (your `Menu` wrapped to settle disabled groups), the merged `atoms`, the `icons`, the `ports` as `ViewsResolvedPorts` (`confirm` always a function), the `messages` resolver, the `conventions`, your `presentation` when you handed one, and the `desktopQuery` in force (yours or `DEFAULT_DESKTOP_QUERY`); `escape`, `oneValue` and `sayRefusals` when you handed them; and `menus`, how the grid opens its own menus (absent means `popover`); `gridButtons`, who draws the grid's own buttons (absent means `own`); `gridCheckboxes`, who draws a yes/no cell's box (absent means `own`); `fieldRowButtons` and `fieldRowCheckboxes`, the same for a field row (absent means `own`); `selectionBar` and `datePicks` when you handed them.
|
|
18
20
|
- `NOOP_PORTS` — ports that do nothing, for a server render, a test or an app without a device: the toasts and haptics are empty, the clipboard writes nothing (resolving `false`) and reads `null`, and the prefs store keeps nothing. It carries no `confirm`, so the provider falls back to the browser's.
|
|
19
21
|
|
|
20
22
|
## The components map
|
|
21
23
|
|
|
22
24
|
The primitives your app hands in, modelled on Base UI's shapes: a controlled `open` with `onOpenChange(open, details)`, an `anchor` rather than a trigger child on the popover and the menu, and no `asChild`. An adapter on Base UI wraps its copies thinly; one on Radix absorbs the difference. The package ships none of them and depends on neither library. The [contract](../contract.md) says what each slot promises and how to write an adapter.
|
|
23
25
|
|
|
24
|
-
- `ViewsComponents` — the map itself, one key per name of the contract's components: `Button`, `Popover`, `Tooltip`, `Checkbox`, `Menu`, `Collapse`, `Sheet`, `AppIcon` and `Markdown`. `AppIcon` is your own icon component, taking `name` and `className`, for the glyphs a host declares (a row's icon, a binding's icon); it draws on the first paint, because rows are measured as they mount, so map its names from a static record. `Markdown` is your markdown renderer, handed the stored text whole as `source`; the package parses no markdown itself.
|
|
26
|
+
- `ViewsComponents` — the map itself, one key per name of the contract's components: `Button`, `Popover`, `Tooltip`, `Checkbox`, `Menu`, `Collapse`, `Sheet`, `AppIcon` and `Markdown`. `AppIcon` is your own icon component, taking `name` and `className`, for the glyphs a host declares (a row's icon, a binding's icon); it draws on the first paint, because rows are measured as they mount, so map its names from a static record. `Markdown` is your markdown renderer, handed the stored text whole as `source`; the package parses no markdown itself. Nine keys are optional: `Input` (leave it out and the editors draw a plain `<input>`), `Command` (the command list's parts; a list reached without one throws an error naming it; with `Picker` and `menus: "menu"`, none is needed), `Picker` (a whole pick list your app draws; leave it out and the select, several-values, place and relation editors draw from `Command`), `Calendar` (the date editor's month; reached without one, it throws an error naming it; handed `DateBody`, it is never reached), `DateBody` (a whole date body your app draws; handed one, the date editor opens it) `PartsBody` (a whole body for a field made of parts; handed one, the name, place and range editors open it), `ValuesBody` (a whole body for several emails, phones, links or domains; handed one, the value list editor opens it), `TextBody` (a whole body for a text typed as one string; handed one, the text editors open it) and `NumberBody` (a whole body for a number, money or a percent; handed one, the number editors open it).
|
|
25
27
|
- `ViewsResolvedComponents` — the map as `useViews()` hands it on: yours, with `Input` always there, your own or the plain one, and `Command` and `Calendar` always there, yours or a stand-in that throws an error naming the slot when it is reached.
|
|
26
|
-
- `ViewsButtonProps` — a button: its `children`, `onClick`, `disabled`, a `variant` (`default`, `ghost`, `outline`, `destructive`), a `size` (`default`, `sm`, `icon`), its `type`, a class, `aria-label` and `title`.
|
|
28
|
+
- `ViewsButtonProps` — a button: its `children`, `onClick`, `disabled`, a `variant` (`default`, `ghost`, `outline`, `destructive`), a `size` (`default`, `sm`, `icon`), its `type`, a class, `aria-label` and `title`; and a `ref`, `tabIndex`, `aria-haspopup`, `aria-expanded`, `data-slot` and `data-open`, which the grid hands its own buttons when the provider's `gridButtons` is `button`: forward each to your element; and `aria-disabled`, which a field row's edit target is handed while its write is pending when the provider's `fieldRowButtons` is `button`.
|
|
27
29
|
- `ViewsPopoverProps` — a popover opened at an `anchor`, controlled by `open` and `onOpenChange`, placed by `side`, `align`, `sideOffset` and `alignOffset`.
|
|
28
30
|
- Focus: `initialFocus` false keeps focus where it was when the popup opens, for an editor that focuses its own input (with `preventScroll`). Default true.
|
|
29
31
|
- Vetoes: `onOutsidePress` is handed the pointer press, its `target` where it landed, and returns `false` to keep the popup open, also against the focus that press moves; focus leaving by keyboard closes without asking. `onEscape` does the same for Escape.
|
|
30
32
|
- Look: `chrome` is `panel` (your card popover, the default) or `menu` (your menu panel's surface, for a popover that holds a list: no inset, no card width). `onPanelClick` takes a click inside the popup, `panelData` sets `data-*` attributes on it, and `style` carries what a class cannot say, such as a width that follows a cell.
|
|
31
33
|
- `ViewsTooltipProps` — a tooltip around the element it wraps (`children`), showing `content`, with `side`, `align`, `delayMs` and a class. Your app mounts one tooltip provider above the views; a tooltip never mounts its own.
|
|
32
|
-
- `ViewsCheckboxProps` — a checkbox: `checked`, and `indeterminate` for a box ticked partly, whose press hands `true` while `checked` is false. `onCheckedChange` hands the new value and, where your library reports it, `{ event }`, the press that changed it (a list reads its shift key for a range). `partialTone` colours the partial mark, `muted` by default or `brand` for a select-all with a live selection; with `disabled`, a class, `tabIndex` and `aria-label`.
|
|
34
|
+
- `ViewsCheckboxProps` — a checkbox: `checked`, and `indeterminate` for a box ticked partly, whose press hands `true` while `checked` is false. `onCheckedChange` hands the new value and, where your library reports it, `{ event }`, the press that changed it (a list reads its shift key for a range). `partialTone` colours the partial mark, `muted` by default or `brand` for a select-all with a live selection; with `disabled`, `readOnly` (shown as it is and not pressable: a yes/no the grid or a field row can't write while the provider's `gridCheckboxes` or `fieldRowCheckboxes` is `checkbox`), a class, `tabIndex` and `aria-label`.
|
|
33
35
|
- `ViewsMenuProps` — a menu opened at an `anchor`, with no trigger child (a group opens beside it only where it asks to and your menu can), controlled by `open` and `onOpenChange`, drawing its `items`, placed by `side` and `align`, and named by `label`, its accessible name, which every menu the package opens hands. On Base UI it is the menu's root, positioner and popup, the anchor handed to the positioner.
|
|
34
36
|
- `ViewsMenuItem` — one row of a menu, as data your `Menu` draws: its `key`, `label` (always words), `icon`, `onSelect`, `disabled` with an optional `disabledReason` (why, for you to show), and `destructive`, a `separatorBefore`, a `shortcut` hint drawn at its end and never bound, and an `href` that makes it a link (with `onSelect` still firing). A `checked` row is checkable and closes the menu like any row, unless it carries `keepOpen`. A row with `children` is a group: its rows drawn in place under its label, unless it carries `beside` (open them one level in), its own `onSelect`, `href` and `checked` ignored; a disabled group's rows reach your `Menu` already `disabled`, with the group's reason where they give none. Any row may carry `detail`, its current value in words, for its end. All three are hints: a menu that draws none of them keeps every group in place and every row closing.
|
|
35
37
|
- `ViewsCommandParts` — the command list's parts, the shape cmdk-based copies already have: `Root` (taking `label`, `shouldFilter` false to hand filtering to the host, a scoring `filter`, `loop` to wrap the arrows, and `defaultValue`, the value of the item highlighted as the list opens, none while no item has it), `Input` (a controlled `value` with `onValueChange`, a `placeholder`, `autoFocus`, a `ref`, `onKeyDown`, and `chrome` `search` for your search row or `bare` for the input alone), `List`, `Empty`, `Group` (with a `heading`) and `Item` (a `value`, `onSelect`, `disabled`, and `chosen`, which you colour as your chosen row while the package's row inside draws the check).
|
|
@@ -37,14 +39,30 @@ The primitives your app hands in, modelled on Base UI's shapes: a controlled `op
|
|
|
37
39
|
- `ViewsPickerItem` — one row of a picker body, as data: its `value` and `label`, a status `slot` (draw your status badge) or a category `color` (draw your option chip), an `icon` (your glyph's name, as `AppIcon` draws it), a quieter `line`, the `group` it stands under, `disabled`, and for a relation's record a `badge` (a word telling kinds apart), a `glyph` (the record's own, unsized), an `avatarUrl` and its `kind`.
|
|
38
40
|
- `ViewsPickerAction` — a row of a picker body that does something rather than pick (create a record with what was typed): its `key`, `label`, an optional `icon`, and `onSelect`; picking it closes the editor, then runs it.
|
|
39
41
|
- `ViewsCalendarProps` — a calendar over ISO days (`YYYY-MM-DD`): its `value` and `onChange`, `min` and `max`, a `month` (`YYYY-MM`) controlled with `onMonthChange`, a `captionLayout` of `label` or `dropdown`, the `startMonth` and `endMonth` its pickers offer, and `locale`, the conventions' locale, in which it draws its month and weekday names and starts its week (an adapter may keep its calendar's own). Your date library stays your own.
|
|
40
|
-
- `ViewsDateBodyProps` — a whole date body your app draws, its typed line, days, quick picks and time: its `label` (the field's name), `value` (on the local calendar, a day `YYYY-MM-DD`, a day and time `YYYY-MM-DDTHH:MM`, or `null`), `onValueChange` (every change as it is made, a typed day once it reads as one, `null` for the empty pick; nothing is saved until the editor closes), `onDone` (a pick that finishes the edit: a day on a field with no time, the empty pick), `time`, `empty`, `picks` (`ViewsDatePick`s, in order), `today` (`YYYY-MM-DD`, local), `typed` (what was typed on what opened it), `autoFocus` and `form` (`phone`: draw no ✕, ✓ or Cancel of your own, and hand every change as it is made). The editor around it keeps the draft, Tab, Escape, the save and the phone's ✕ and ✓.
|
|
41
|
-
- `ViewsDatePick` — a quick pick a date body offers: `today`, `tomorrow`, `next-monday` (the Monday after today, a week on when today is one) or `none`, which empties the field.
|
|
42
|
+
- `ViewsDateBodyProps` — a whole date body your app draws, its typed line, days, quick picks and time: its `label` (the field's name), `value` (on the local calendar, a day `YYYY-MM-DD`, a day and time `YYYY-MM-DDTHH:MM`, or `null`), `onValueChange` (every change as it is made, a typed day once it reads as one, `null` for the empty pick; nothing is saved until the editor closes), `onDone` (a pick that finishes the edit: a day on a field with no time, the empty pick), `time`, `empty`, `picks` (`ViewsDatePick`s, in order: the provider's `datePicks`, then `none` where it may be emptied), `today` (`YYYY-MM-DD`, local), `typed` (what was typed on what opened it), `autoFocus` and `form` (`phone`: draw no ✕, ✓ or Cancel of your own, and hand every change as it is made). The editor around it keeps the draft, Tab, Escape, the save and the phone's ✕ and ✓.
|
|
43
|
+
- `ViewsDatePick` — a quick pick a date body offers: `today`, `tomorrow`, `next-monday` (the Monday after today, a week on when today is one), `in-a-week` (today + 7 on the local calendar) or `none`, which empties the field.
|
|
44
|
+
- `ViewsDatePicks` — the provider's `datePicks`: the quick days the date editors offer, in order, any `ViewsDatePick` but `none`. The date editor hands exactly these to your `DateBody` and its own panel draws the same; absent, `today`, `tomorrow` and `next-monday`.
|
|
45
|
+
- `ViewsPartsBodyProps` — a whole body for a field made of parts your app draws, by `kind`. Every kind: `label` (the field's name), `onDone` (no argument closes as Enter does, `"pick"` as a pick), `empty`, `typed`, `autoFocus` and `form` (`phone`: draw no ✕, ✓ or Cancel of your own). `name`: `value` and `onValueChange` over `{ given, family, full }`, `full` handed back as handed unless typed. `place`: `value` and `onValueChange` over `ViewsPlaceParts` (its `regionCode` the editor's), `parts`, `rows`, `words`, `required`, `countries`, `regions` and `opens`. `range`: `value` and `onValueChange` over `{ low, high }`, `decimals`, `unit` and `bands` (drawn as picks, each handing its ends, then `onDone("pick")`). Hand every change as it is made; the editor keeps the draft, Tab, Escape, the save and the phone's ✕ and ✓.
|
|
46
|
+
- `ViewsPlacePart` — a box of a place, besides its country and its region's code: `line1`, `line2`, `postalCode`, `city` or `region`.
|
|
47
|
+
- `ViewsPlaceParts` — a place's parts as a parts body holds them: each `ViewsPlacePart`, `regionCode` and `countryCode`, a string where it holds one.
|
|
48
|
+
- `ViewsValuesBodyProps` — a whole body for a field holding several emails, phones, links or domains your app draws: `label`, `kind` (`email`, `phone`, `url` or `domain`), `value` and `onValueChange` over `ViewsValueLine`s (the whole list, every change as it is made; `[]` for none), `onDone` (closes as Enter does), `check` (a value's reason, or null), `labels`, `holds` (`one` or `several`), `region` (a phone's country), `empty`, `typed`, `autoFocus` and `form` (`phone`: draw no ✕, ✓ or Cancel of your own). The editor keeps the draft, which value is kept as stored, Tab, Escape, the write check, the save and the phone's ✕ and ✓.
|
|
49
|
+
- `ViewsTextBodyProps` — a whole body for a field typed as one string your app draws: `label`, `kind` (`text`, `url`, `domain`, `email`, `phone` or `rich_text`), `paragraph`, `value` and `onValueChange` (the whole text, every change as it is made), `onDone` (closes as Enter does), `check` (a value's reason, or null), `region` (a phone's country), `typed`, `autoFocus` and `form` (`phone`: draw no ✕, ✓ or Cancel of your own). The editor keeps the draft, Tab, Escape, ⌘ or Ctrl Enter, the close's tidy, the write check, the save and the phone's ✕ and ✓.
|
|
50
|
+
- `ViewsNumberBodyProps` — a whole body for a number, money or a percent your app draws: `label`, `kind` (`number`, `money` or `percent`), `value` (a number, `null` empty, `NaN` unreadable) and `onValueChange` (the number and, when it is one of `units`, the unit; every change as it is made), `unit` and `units`, `onDone` (closes as Enter does), `check` (a value's reason, or null), `decimals`, `min`, `max`, `locale`, `decimal`, `empty`, `align`, `typed`, `autoFocus` and `form` (`phone`: draw no ✕, ✓ or Cancel of your own). The editor keeps the draft, the rounding, Tab, Escape, ⌘ or Ctrl Enter, the write check, the save and the phone's ✕ and ✓.
|
|
51
|
+
- `ViewsValueLine` — one value of a values body's list: `value` (its text), `label` where it has one, and `main`.
|
|
42
52
|
- `ViewsCollapseProps` — a box that opens and closes its `children` with `open`, over `durationMs`, with a class and a `clipClassName` on the box that crops the content.
|
|
43
|
-
- `ViewsSheetProps` — a phone sheet, controlled by `open` and `onOpenChange`, with a `title`, a `label` (the title in words whenever the title is words: its accessible name, and the title of a head that takes only text), a `description`, a class, its `children`, and `snap` (`full`, `half`, `peek`, `auto`), a hint a sheet with no snap points ignores. With the provider's `sheetActions` at `head` it is handed `actions
|
|
44
|
-
- `ViewsSheetActions` — the editor panel's ✕ and ✓, handed to a sheet that draws them in its head: `close`, which throws the edit away as a swipe does, and `done`, which closes it as done, absent where the body saves on its pick.
|
|
53
|
+
- `ViewsSheetProps` — a phone sheet, controlled by `open` and `onOpenChange`, with a `title`, a `label` (the title in words whenever the title is words: its accessible name, and the title of a head that takes only text), a `description`, a class, its `children`, and `snap` (`full`, `half`, `peek`, `auto`), a hint a sheet with no snap points ignores. With the provider's `sheetActions` at `head` it is handed `actions` to draw in its own head: the editor panel's ✕ and ✓, or a toolbar panel's ✕ alone.
|
|
54
|
+
- `ViewsSheetActions` — the editor panel's ✕ and ✓, handed to a sheet that draws them in its head: `close`, which throws the edit away as a swipe does, and `done`, which closes it as done, absent where the body saves on its pick. A toolbar panel's sheet is handed `close` alone, which closes it.
|
|
45
55
|
- `ViewsSheetAction` — one of them: its `label` (the accessible name) and `onPress`. The glyph is yours.
|
|
46
56
|
- `ViewsMenuRoute` — `"popover" | "menu"`, the provider's `menus`: how the grid opens its own menus (a column's, a footer's figure picker, a group's ⋯, Add column). `popover` (the default) draws ViewKit's rows in your `Popover`; `menu` hands your `Menu` its rows as data. The row menu and a command cell's menu always go through your `Menu`.
|
|
47
|
-
- `
|
|
57
|
+
- `ViewsSeveralValues` — `"first" | "fit"`, the provider's `severalValues`: how a cell of several values draws on one line. `first` (the default) draws its first value and a count at any width, as on 0.5.0; `fit` draws as many whole values as fit its width, then the count, following a column resize.
|
|
58
|
+
- `ViewsGridButtons` — `"own" | "button"`, the provider's `gridButtons`: who draws the buttons the grid draws itself (a group's fold and ⋯, "+ Add column", a row's ⋯, the name's actions, an action column's buttons, a pick-list cell's ▾, a command cell's ▾ and trigger). `own` (the default) draws ViewKit's own, as on 0.5.0; `button` draws your `Button`, handed the grid's box in `className`.
|
|
59
|
+
- `ViewsGridCheckboxes` — `"own" | "checkbox"`, the provider's `gridCheckboxes`: who draws a yes/no cell's box in the grid (the checkbox style). `own` (the default) draws ViewKit's tick box in its own switch button, as on 0.5.0; `checkbox` draws your `Checkbox`, handed `checked`, the column's name, `tabIndex` -1 and `onCheckedChange`, or `readOnly` where the grid can't write.
|
|
60
|
+
- `ViewsFieldRowButtons` — `"own" | "button"`, the provider's `fieldRowButtons`: who draws a field row's own buttons (its edit target, the verb trigger around a value, the lane's ▾, rich text's Show more). `own` (the default) draws ViewKit's, as on 0.5.0; `button` draws your `Button`.
|
|
61
|
+
- `ViewsFieldRowCheckboxes` — `"own" | "checkbox"`, the provider's `fieldRowCheckboxes`: who draws a field row's yes/no box. `own` (the default) draws ViewKit's tick box in its own switch button; `checkbox` draws your `Checkbox`, a Tab stop, or `readOnly` where the row can't write.
|
|
62
|
+
- `ViewsSelectionBarSettings` — the provider's `selectionBar`: `phoneQuery` (the media query under which the bar is the phone's pill; without it, wherever `desktopQuery` does not match), `desktop` and `phone`, each a `ViewsBarPlacement`, and `chip`, a `ViewsSelectionChip`.
|
|
63
|
+
- `ViewsSelectionChip` — `"own" | "button"`, the provider's `selectionBar`'s `chip`: who draws the selection bar's count chip on the desktop. `own` (the default) draws ViewKit's own, as on 0.5.0; `button` draws your `Button`, `outline`, `sm`, handed its box in `className`.
|
|
64
|
+
- `ViewsBarPlacement` — where the selection bar's fixed box sits on one form: `bottom` (a CSS length, default `calc(1rem + env(safe-area-inset-bottom))`), `zIndex` (default 50) and `className` (your own classes on the box).
|
|
65
|
+
- `ViewsSheetActionsPlace` — where the ✕ and ✓ stand on a phone, the provider's `sheetActions`: `bar` (the default, the panel's own bar, or a toolbar panel's own ✕, inside your sheet) or `head` (handed to your sheet as `actions`, and none drawn inside).
|
|
48
66
|
- `ViewsInputProps` — a single-line text box: every prop of an `<input>`, `ref` included, which your element must receive, and `chrome`, `bare` (the default: a grid cell, a panel that frames the box) or `field` (your field's frame).
|
|
49
67
|
- `ViewsAnchor` — where a floating part attaches: an element, a ref to one, a point `{ x, y }` (a context menu), or `null`.
|
|
50
68
|
- `ViewsSide` — the side a floating part opens on: `top`, `right`, `bottom` or `left`.
|
|
@@ -81,21 +99,36 @@ Guide: [atoms](../guides/atoms.md).
|
|
|
81
99
|
The pieces the rendering is built from, and your app's own pieces it cannot draw itself. Each ships as a default, drawn from your app's colours and marked with its own `data-slot`; your app swaps any of them through the provider's `atoms`, and the rest stay the defaults. A swapped atom marks itself as your app does. The [contract](../contract.md) lists their slots and states.
|
|
82
100
|
|
|
83
101
|
- `DEFAULT_VIEWS_ATOMS` — the atoms every app starts with, one default per name of `ViewsAtoms`; the provider lays your `atoms` over it.
|
|
84
|
-
- `ViewsAtoms` — the full set, one component per atom: `List`, `Row`, `RowContent`, `TickBox`, `StatusBadge`, `StatusMarker`, `Tag`, `CommandMenu`, `RelationLink`, `RelationRoles`, `Loading`, `LoadMore`, `PlatformMark` and `
|
|
102
|
+
- `ViewsAtoms` — the full set, one component per atom: `List`, `Row`, `RowContent`, `TickBox`, `Avatar`, `StatusBadge`, `StatusMarker`, `Tag`, `CommandMenu`, `RelationLink`, `RelationRoles`, `CellMore`, `Loading`, `LoadMore`, `PlatformMark`, `RowMenu`, and the panels' rows `ChoiceRow`, `CheckRow`, `RadioRow`, `DirectionButton`, `MenuRow`, `ToggleRow` and `PanelSearch`, the selection's `SelectionSheet`, the filter panel's month `RangeCalendar`, the views row's `Pill`, and the toolbar's `ToolbarButton`. The provider's `atoms` takes any part of it.
|
|
103
|
+
- `ViewsChoiceRowProps` — a panel's value row: `label`, a `description` under it, a right-hand `meta` (a sample, a count; a row with one draws no check), `leading`, `trailing`, `selected`, `onClick`, `onMouseDown`, `disabled`, `role` and `aria-selected`.
|
|
104
|
+
- `ViewsCheckRowProps` — toggles one of many, a tick box on the left: `checked`, `onClick`, its `children`, `leading`, `trailing`, `disabled`.
|
|
105
|
+
- `ViewsRadioRowProps` — picks one of a set: `selected`, `label`, `onClick`, `leading`, `trailing`, `mark` (`"check"` or `"box"`), `disabled` and the `disabledReason` your `Tooltip` shows, and class hooks for the check and the label.
|
|
106
|
+
- `ViewsDirectionButtonProps` — a sort's direction arrow: `dir` (`"asc"` or `"desc"`) and `onClick`; a press never reaches the row around it.
|
|
107
|
+
- `ViewsMenuRowProps` — a drill-in row: `icon`, `label`, `value` (where the section stands), `active`, `disabled` and the `disabledReason` your `Tooltip` shows, `onClick`.
|
|
108
|
+
- `ViewsToggleRowProps` — a boolean flipped in place: `icon`, `label`, `active`, `disabled` and the `disabledReason` your `Tooltip` shows, `onClick`, and `reset` (`{ onReset }`), the way back to the reader's default.
|
|
109
|
+
- `ViewsPanelSearchProps` — a panel's text box: `value`, `onChange`, `onClear`, `placeholder`, `autoFocus`, `onKeyDown`, `onFocus`, `inputRef`, `leading` (`null` drops the magnifier), `suffix` and `inputMode`.
|
|
110
|
+
- `ViewsPillProps` — one option of a row of pills: `active`, `variant` (`solid` or `plain`), `size` (`default` or `sm`), `leading` and `leadingSlot`, your own `activeClassName` and `hoverClassName`, `onClick`, `onContextMenu`, `onPointerDown`, `menuOpen` (it opens a menu) and `ref`.
|
|
111
|
+
- `ViewsToolbarButtonProps` — a toolbar's button: its `icon`, its `label` (its name, and the word a dress shows unless `word` says another, or `null` for none), a `count` in its corner that becomes a ✕ badge clearing what it counts when handed `onClear`, a `dot` drawn instead of a count, `open`, `changed`, `edge` (the row's outermost button), `disabled`, `size` (`md` or `sm`), `popup` (`menu` or `dialog`, with `aria-expanded` from `open`), `onClick`, `onPointerDown` and `ref`.
|
|
85
112
|
- `ViewsListProps` — the rows' container, the inset a run of rows sits in inside a panel or a command list's group: its `children` and a class.
|
|
86
113
|
- `ViewsRowContentProps` — a row's inside, all the row is inside a command list's item, which owns the element, the highlight and the keyboard.
|
|
87
114
|
- What it says: a `label` (text truncates to one line, any other node is laid out in a row so it centres; `wrap` lets a long label break), a `description` line under it, a `leading` glyph (with `leadingLane` to keep its width when there is none), `trailing` content after the label, and a `detail` at its right edge in the subtle colour, such as a setting's current choice.
|
|
88
115
|
- How it reads: `chosen` draws a trailing check (a chosen row with a `detail` draws the detail in the brand colour and no check), `chosenTint` false keeps a badge label's own colour, `tone` `muted` for a row that offers rather than lists (none, create, add), and `size` `compact` (13px) or `regular` (your menu size, the default).
|
|
89
116
|
- `ViewsRowProps` — a whole row: everything `ViewsRowContentProps` takes, as a button, or with `interactive` false a static line. It adds `onClick`, `onMouseDown` (for a row inside an editor that keeps its input focused), `disabled`, `title`, a `role` with `aria-selected`, and `opens` and `open` for a row that opens a flyout beside its menu.
|
|
90
117
|
- `ViewsTickBoxProps` — a paint-only tick box: `checked` and a class. The control around it is the caller's.
|
|
91
|
-
- `
|
|
118
|
+
- `ViewsAvatarProps` — a person's or a record's picture, drawn in a user's, a relation's and an actor's chip (`size: "chip"`) and before the name when the list's `rowIcon` hands the row's `avatar` (`size: "glyph"`, sized by `--vk-glyph`): `label` (whose picture it is, for initials), `avatarUrl` (the picture, when there is one), `kind` (the record's kind as your app names it: a relation's `entity`, `user` for a member, an actor's type) and `fallback` (the glyph the chip or the name draws without a picture). The default draws the picture while it loads and the fallback otherwise; yours may hand back the fallback for a kind it doesn't dress. It only paints: what wraps the chip owns the click.
|
|
119
|
+
- `ViewsStatusBadgeProps` — a pill coloured by a status slot of `@viewkitjs/fields`: its `slot` and `label`, a `leading` mark that replaces the slot's own, a `title`, a `size` (`compact`, 11px, the default, as a status value is drawn in a cell; or `regular`) and a class. It is handed `place` wherever a field's option is drawn (a cell, the select editor, the selection bar): where the status stands among the field's steps.
|
|
120
|
+
- `ViewsStatusPlace` — a status's `place`: `options`, the field's active options in their order (the same array for every cell of a field), and `index`, this one's place in them. A stray or archived value, and a badge that is no option, are handed none.
|
|
121
|
+
- `ViewsStatusOption` — one of those options as a badge is handed it: `value`, `label` and its `slot`.
|
|
92
122
|
- `ViewsStatusMarkerProps` — an attention badge that opens its reason in a popover: its `label`, its `title` (the panel's heading and the marker's accessible name), a `slot` (`warning` by default), the `reason`, the `emptyReason` shown when there is none (the package's wording by default), and `onResolve` with its `resolveLabel`; without `onResolve` the marker is read-only.
|
|
93
123
|
- `ViewsTagProps` — a category chip: its `label` and category `color`, a `leading` glyph (an option's icon, drawn by your `AppIcon`), a class, and `onRemove`, which draws a remove control, named by `removeLabel` (the package's wording by default).
|
|
94
124
|
- `ViewsCommandMenuProps` — a `command` cell's verb menu: the `trigger` the cell drew (a button), the host's `items` as `FieldRowMenuItem`s, and `align`. The default is your components map's `Menu`; your app may swap in its own action menu.
|
|
125
|
+
- `ViewsRangeCalendarProps` — the filter panel's month, in ISO days: `mode` (`single` or `range`), `from`, `to`, `onSelect` (the selection a press makes, and the day pressed), `armed` (the end the next press sets), `limit`, a painted `window`, `minNights`, a `footer`, `cellSize`, `locale` and `className`. The default is the map's one-day `Calendar` on the end being picked; hand your own to paint a range.
|
|
126
|
+
- `ViewsSelectionSheetProps` — the phone's sheet of a selection's verbs, opened by the selection bar's Actions: `open`, `onOpenChange`, `title` ("3 selected"), the `verbs`, `onDelete` and `deleteLabel` for the bar's own delete, drawn last, and `busy`. The default draws a disabled verb's `disabledReason` as its row's second line, none while `busy`. Picking a row closes the sheet, then runs it.
|
|
95
127
|
- `ViewsRowMenuProps` — the row's right-click menu, around the row it opens on (`children`): opened by a right-click on the row or by its ⋯, it lists an Open page row for `openHref` (a new tab), the `items` the rendering built, and a Delete row when `onDelete` is given, called with `rowId` once the confirm port says yes, with `deleteLabel` as its `subject`. A delete that rejects says so through the toast port's `error`. `onToggleSelect` flips the row's selection, for an app whose long-press selects; the default doesn't use it, and a long-press on a phone opens nothing.
|
|
96
128
|
- `ViewsRowMenuItem` — one row of the row's menu, the shape a host's own row-menu items already have: a rule (`{ separator: true }`), or a row with its `label`, `icon`, `onClick`, `destructive`, `disabled` and a `shortcut` hint drawn at its end and never bound.
|
|
97
129
|
- `ViewsRelationLinkProps` — where a relation chip goes: the `relation` value and the chip the display drew as `children`, for your app's own link around it. The default goes nowhere, since a relation is a fact as often as a destination.
|
|
98
130
|
- `ViewsRelationRolesProps` — a link's roles, drawn inside its chip after the record's name, on a `many` relation that declares `links`: the `relation` value and its `roles` in order, each its stored `value` and its `label` (the field's, else the value). Handed only when the link holds one or more. The default draws the labels in the subtle colour after a middle dot, cut before the name in a narrow cell, and names the record and every role on hover.
|
|
131
|
+
- `ViewsCellMoreProps` — the count after a cell's shown values: `count`, how many are not shown, and `inert`, true where the host owns the click (the count is plain text, and nothing opens). Drawn inside `data-slot="vk-cell-more"`, a button that opens the whole list. The default, `DefaultCellMore`, draws "+" and the number, and ViewKit keeps its own frame on that element only for it; yours draws inside a bare button (or span), so a count tag of yours stands there alone.
|
|
99
132
|
- `ViewsLoadingProps` — a wait: `placement` `body` (the whole list reloading) or `footer` (more rows arriving), and the `label` read to assistive technology. The default is a plain ring, larger in the body.
|
|
100
133
|
- `ViewsLoadMoreProps` — how a list asks for its next page once its end comes near: `onReveal`, and an optional `label` drawn while it waits. The default watches a sentinel past the last row, calls `onReveal` as it comes within 600px of the end of what it scrolls in (the grid's own scroll area, else the viewport), and draws your `Loading` (or the label) meanwhile.
|
|
101
134
|
- `ViewsPlatformMarkProps` — a link's platform, drawn before the link: the `platform` (its key says which, its name what to call it) and a class. The default draws nothing, so a link looks plain; the package ships no brand art, so an app that wants marks draws its own.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@viewkitjs/views/selection`
|
|
2
2
|
|
|
3
|
-
Import from `@viewkitjs/views/selection` to let people pick rows of a list: the selection over the rows' visual order with a range anchor, the row checkbox, the drag down its lane, the rules a row click follows,
|
|
3
|
+
Import from `@viewkitjs/views/selection` to let people pick rows of a list: the selection over the rows' visual order with a range anchor, the row checkbox, the drag down its lane, the rules a row click follows, the rest that starts a record's read before the click, and the bar a selection opens. The door carries no client directive; each hook and component file behind it carries its own, and they read the provider's components and haptics. What the bar's verbs do stays your app's.
|
|
4
4
|
|
|
5
5
|
## The selection
|
|
6
6
|
|
|
@@ -9,10 +9,18 @@ Guide: [selection](../guides/selection.md).
|
|
|
9
9
|
- `useListSelection` — a list's selection: takes `orderedIds` (the ids in visual order, after filter, sort and grouping), an optional `retention` (`"ordered"` by default) and an optional `resetKey`, and returns a `UseListSelectionResult`. A new `resetKey` empties it. Turning rows on or off ticks the provider's `haptics.selection()`; selecting all gives a medium impact; `clear` is silent.
|
|
10
10
|
- `UseListSelectionResult` — what `useListSelection` returns: `selectedIds`, `count`, `isSelected(id)`, `anchorId`, `allSelected` and `someSelected` (some but not all, for an indeterminate box), and the verbs `toggle(id, next?)` (sets the range anchor), `toggleRange(id)` (adds the run from the anchor to `id`), `toggleMany(ids)` (selects them all, or clears them when all are selected), `selectAll()`, `clear()` (also resets the anchor) and `setSelected(ids)`.
|
|
11
11
|
- `SelectionRetention` — what happens to a selected id that leaves the visual order: `"ordered"` drops it; `"external"` keeps it, for a selection across a whole query whose rows need not all be loaded. Either way the range anchor must stay visible to count.
|
|
12
|
-
- `useEscapeToClear` — while `active` is true, Escape anywhere in the window calls `clear
|
|
13
|
-
- `ListSelectionConfig` — what a list or table takes to be selectable (the grid's `selection`): `resetKey` (the selection clears when it changes)
|
|
12
|
+
- `useEscapeToClear` — while `active` is true, Escape anywhere in the window calls `clear`, unless something open already took it (`defaultPrevented`, as a menu or popover closing on it marks it).
|
|
13
|
+
- `ListSelectionConfig` — what a list or table takes to be selectable (the grid's `selection`): `resetKey` (the selection clears when it changes), with optional `renderBar` (draws the bar from the selection and, when the renderer can write, a `ListBatchApi`; left out, rows still tick and no bar is drawn), `orderedIds` and `retention`.
|
|
14
14
|
- `ListBatchApi` — the batch write a renderer with an editing model hands your bar: `setColumnValue(rowIds, columnId, value)`, resolving to whether the write landed. The grid's resolves `false` for a column it cannot write, and skips an id whose row is not loaded.
|
|
15
15
|
|
|
16
|
+
## The bar
|
|
17
|
+
|
|
18
|
+
- `SelectionBar` — the bar a selection opens, portalled to the body and placed by the provider's `selectionBar`. On a desktop, an island: the count chip (a press clears the selection; its tooltip names Escape; ViewKit's own, or your `Button` with `selectionBar`'s `chip: "button"`), the first four verbs, the trash when `onDelete` is handed, a hairline and More, always drawn (disabled when nothing spills into it), holding the rest (a group or an options verb opening its rows beside it). On a phone, a pill reading the count, Actions and ✕; Actions opens the `SelectionSheet` atom. It draws nothing while `count` is zero.
|
|
19
|
+
- `SelectionBarProps` — what `SelectionBar` takes: `count`, `onClear`, `verbs` (`SelectionVerb`s, in order), optional `busy` (disables every control), `onDelete` (the bar's own verb, the trailing trash; never a verb in `verbs`) and `deleteLabel` (the trash's name; default the `views.selection.delete` message).
|
|
20
|
+
- `SelectionVerb` — one verb, as data: `{ kind: "action" }` with a `SelectionVerbItem`'s fields; `{ kind: "group", label, icon?, disabled?, disabledReason?, items }`, a button opening a menu of `SelectionVerbItem`s, whose rows that give no reason carry the group's; or a `SelectionOptionsVerb`.
|
|
21
|
+
- `SelectionVerbItem` — an action: `label`, optional `icon` (your glyph), `onClick`, `destructive` (the danger colour), `disabled`, and `disabledReason`, why it is disabled: More's row, the bar's button and the phone's sheet carry it.
|
|
22
|
+
- `SelectionOptionsVerb` — one field set on every selected row: `{ kind: "options", label, icon?, disabled?, disabledReason?, options, onSelect }`, its `options` `PickerOption`s drawn as the badges a cell shows, `onSelect` handed the value picked. It closes, then runs.
|
|
23
|
+
|
|
16
24
|
## Picking rows with the pointer
|
|
17
25
|
|
|
18
26
|
- `selectFromClick` — the modifier click on a row: takes the click, the row's id and the selection's `toggle` and `toggleRange`. Cmd or Ctrl toggles the row, Shift extends the range, and it returns `true` when it handled the click, so your handler stops before opening the row.
|
package/docs/reference/views.md
CHANGED
|
@@ -11,7 +11,7 @@ Guide: [the provider](../guides/the-provider.md).
|
|
|
11
11
|
- `VK_PREFIX` — the prefix `"vk"`, worn by everything that shares a global namespace: the CSS variables (`--vk-*`) and the `data-slot` values (`vk-grid-row`). States are bare `data-*` attributes, and message keys live under `views.*` ([the contract](../contract.md)).
|
|
12
12
|
- `GRID_SLOTS` — every `data-slot` value the grid draws, from `vk-grid` (the frame) to `vk-grid-aggregate-menu`, in the order of the [contract's Slots table](../contract.md#slots). A skin styles a part through its slot, never through a class name the package happens to use.
|
|
13
13
|
- `GridSlot` — one member of `GRID_SLOTS`.
|
|
14
|
-
- `GRID_STATES` — the flags the grid styles, each a `data-*` attribute present when true (`focused`, `selected`, `editing`, `in-range`, `range-edge`, `pending`, `invalid`, `dragging`, `empty`, `frozen`, `scrolled`, `parked`), as the [contract's States table](../contract.md#states) lists them with where each sits.
|
|
14
|
+
- `GRID_STATES` — the flags the grid styles, each a `data-*` attribute present when true (`focused`, `selected`, `editing`, `in-range`, `range-edge`, `pending`, `invalid`, `dragging`, `empty`, `frozen`, `scrolled`, `parked`, `collapsed`, `stuck`, `open`), as the [contract's States table](../contract.md#states) lists them with where each sits.
|
|
15
15
|
- `GridState` — one member of `GRID_STATES`.
|
|
16
16
|
- `VK_TOKENS` — the CSS variables the package owns and sets on the grid's frame: geometry and density (`--vk-scale`, `--vk-row-h`, the paddings, the text sizes, the 0-or-1 flags `--vk-scrolled`, `--vk-parked` and `--vk-frozen-on`). A skin reads them and an app overrides them on the frame ([Tokens](../contract.md#tokens)).
|
|
17
17
|
- `VkToken` — one member of `VK_TOKENS`.
|
|
@@ -19,28 +19,32 @@ Guide: [the provider](../guides/the-provider.md).
|
|
|
19
19
|
- `VkColour` — one member of `VK_COLOURS`.
|
|
20
20
|
- `VK_OPTIONAL_COLOURS` — the status hues (`--vk-success`, `--vk-warning`, `--vk-info`) and the category hues (`--vk-label-blue` to `--vk-label-teal`) the default atoms and the display read when your app declares them, each with a built-in fallback ([Tokens](../contract.md#tokens)).
|
|
21
21
|
- `VkOptionalColour` — one member of `VK_OPTIONAL_COLOURS`.
|
|
22
|
-
- `VK_OPTIONAL_LAYOUT` — the layout your app may declare, each read with a
|
|
22
|
+
- `VK_OPTIONAL_LAYOUT` — the layout your app may declare, each read with a fallback: `--vk-gutter` (`0px`), the side padding your page gives its content, which the grid's rows line their content up with; `--vk-scroll-inset-bottom` (`0px`), how much of the grid's foot your app covers with something it floats there (a phone's bottom bar), so the grid's scroll area runs underneath it and its last row scrolls clear of it; and `--vk-panel-padding` (`0.375rem`), the inset a panel's list keeps from the panel's edge ([Tokens](../contract.md#tokens)).
|
|
23
23
|
- `VkOptionalLayout` — one member of `VK_OPTIONAL_LAYOUT`.
|
|
24
24
|
- `VK_INTERNAL` — the grid's own variables, set and read by the grid alone: `--vk-drag-shift`, a header cell's offset while its column is dragged. Prefixed because they share the global namespace, and not public: your app neither sets nor reads them, and they may change in any release.
|
|
25
25
|
- `VkInternal` — one member of `VK_INTERNAL`.
|
|
26
26
|
- `VK_INTERNAL_FAMILIES` — the grid's internal variable families, a prefix with one variable per key after it: `--vk-col-w-<id>`, one column's resolved width, set on the grid's root for every visible column. Not public, like `VK_INTERNAL`.
|
|
27
27
|
- `COMPONENT_NAMES` — the primitives your app hands in through the provider: `Button`, `Popover`, `Tooltip`, `Checkbox`, `Menu`, `Collapse`, `Sheet`, `AppIcon` and `Markdown` ([the components map](../contract.md#the-components-map)).
|
|
28
28
|
- `ComponentName` — one member of `COMPONENT_NAMES`.
|
|
29
|
-
- `OPTIONAL_COMPONENT_NAMES` — the primitives your app may leave out: `Input` (a plain default), `Command` (reached without one, it throws an error naming it), `Picker` (without one, the lists draw from `Command`), `Calendar` (reached without one, it throws an error naming it)
|
|
29
|
+
- `OPTIONAL_COMPONENT_NAMES` — the primitives your app may leave out: `Input` (a plain default), `Command` (reached without one, it throws an error naming it), `Picker` (without one, the lists draw from `Command`), `Calendar` (reached without one, it throws an error naming it), `DateBody` (without one, the date editor draws its own around `Calendar`), `PartsBody` (without one, the name, place and range editors draw their own boxes), `ValuesBody` (without one, the value list editor draws its own rows), `TextBody` (without one, the text editors draw their own box) and `NumberBody` (without one, the number editors draw their own box) ([the components map](../contract.md#the-components-map)).
|
|
30
30
|
- `OptionalComponentName` — one member of `OPTIONAL_COMPONENT_NAMES`.
|
|
31
|
-
- `ATOM_NAMES` — the pieces the rendering is built from, and the pieces of your app's own it cannot draw itself (a command cell's verb menu, the row's right-click menu, where a relation goes, a wait, how a list asks for more). Each ships as a default, and your app swaps any of them through the provider's `atoms` ([the atoms](../contract.md#the-atoms)).
|
|
31
|
+
- `ATOM_NAMES` — the pieces the rendering is built from, and the pieces of your app's own it cannot draw itself (a command cell's verb menu, the row's right-click menu, where a relation goes, a wait, how a list asks for more), and the panels' rows. Each ships as a default, and your app swaps any of them through the provider's `atoms` ([the atoms](../contract.md#the-atoms)).
|
|
32
32
|
- `AtomName` — one member of `ATOM_NAMES`.
|
|
33
33
|
- `ATOM_SLOTS` — the `data-slot` values the default atoms mark themselves with, prefixed like the grid's (`vk-row`, `vk-tick`, `vk-status`, `vk-row-menu` …) ([the atoms](../contract.md#the-atoms)).
|
|
34
34
|
- `AtomSlot` — one member of `ATOM_SLOTS`.
|
|
35
35
|
- `EDITOR_SLOTS` — the `data-slot` values the editor panel marks its parts with, prefixed like the grid's (`vk-editor-panel`, `vk-editor-bar`, `vk-editor-refusal`) ([the editor panel](../contract.md#the-editor-panel)).
|
|
36
36
|
- `EditorSlot` — one member of `EDITOR_SLOTS`.
|
|
37
|
+
- `EDITOR_STATES` — the states the editor panel's popover carries: `vk-body`, the app's own body it holds (`picker`, `parts` or `values`), set only when the provider's `bodyFrame` is `popover`.
|
|
38
|
+
- `EditorState` — one member of `EDITOR_STATES`.
|
|
39
|
+
- `SELECTION_SLOTS` — the `data-slot` values the selection bar marks its parts with, prefixed like the grid's (`vk-selection-bar`, `vk-selection-pill`, `vk-selection-chip`) ([slots](../contract.md#slots)).
|
|
40
|
+
- `SelectionSlot` — one member of `SELECTION_SLOTS`.
|
|
37
41
|
- `ATOM_STATES` — the default atoms' states: `chosen`, `disabled`, `muted`, `checked` and `open` are flags present when true, `status` carries the status slot's name and `platform` a link's platform key ([the atoms](../contract.md#the-atoms)).
|
|
38
42
|
- `AtomState` — one member of `ATOM_STATES`.
|
|
39
43
|
- `PORT_NAMES` — the runtime services your app hands in through the provider: `toast`, `haptics`, `clipboard`, `viewPrefs` and `confirm` ([Ports](../contract.md#ports)).
|
|
40
44
|
- `PortName` — one member of `PORT_NAMES`.
|
|
41
|
-
- `ICON_NAMES` — the glyphs the rendering asks your app for, by what they mean, never by a library's name: the field types, who did it, the actions, navigation and order, the figures
|
|
45
|
+
- `ICON_NAMES` — the glyphs the rendering asks your app for, by what they mean, never by a library's name: the field types, who did it, the actions, navigation and order, the figures, the grid's menus and the panels' (`search`, `reset`). Your app maps each to its own icon component ([Icons](../contract.md#icons)).
|
|
42
46
|
- `ViewsIconName` — one member of `ICON_NAMES`.
|
|
43
|
-
- `MESSAGE_NAMESPACES` — the
|
|
47
|
+
- `MESSAGE_NAMESPACES` — the six namespaces every visible string the package owns is keyed under: `views.grid`, `views.editors`, `views.menus`, `views.display`, `views.selection` and `views.panels`.
|
|
44
48
|
- `ViewsMessageNamespace` — one member of `MESSAGE_NAMESPACES`.
|
|
45
49
|
- `ViewsMessage` — a message the package emits: its `key` and, where it has any, the `values` a resolver may interpolate (`{ key: "views.editors.tag-remove", values: { label } }`), never a sentence. The union is closed, so a new key is a compile error in every exhaustive resolver that has not worded it. A string `@viewkitjs/fields` already keys stays a fields message. The keys and their values are listed in [the contract](../contract.md#message-keys).
|
|
46
50
|
- `ViewsMessageKey` — the key of a `ViewsMessage`: the union of every message key.
|
|
@@ -74,7 +78,6 @@ A column is plain data: what a list shows in one place for every row, how it rea
|
|
|
74
78
|
- `RenderedValue` — what the grid hands a custom `render` beside the row: `value`, the column's figure as its `accessor` reads it, and `code`, the currency that figure is in. A custom money cell draws that reading and converts nothing.
|
|
75
79
|
- `ListColumnOption` — one option of a select, status or multiselect column: its `value`, and optionally its `label`, its status `slot`, its category `color`, its stage `mark` (when the option is a position on a ladder, drawn in place of the plain dot) and `archived` (out of every picker, still drawn on a row that holds it).
|
|
76
80
|
- `ListSelectColor` — an option's category colour: one of the design palette's category hues.
|
|
77
|
-
- `ListStatusSlot` — a status slot from the design palette, as an option or a cell action names it.
|
|
78
81
|
- `ListRelationValue` — one relation value, already resolved by your host: the contract's `RelationValue` (`id` compared and committed but never shown, `label` shown, sorted and copied, `entity` handed back when the chip is opened, `avatarUrl`) plus an optional per-value `icon`, for a column whose rows point at different kinds. The grid never turns an id into a label itself.
|
|
79
82
|
- `ListCellAction` — a button drawn in a cell: its `id`, an `icon` for the row, and optionally a `label`, an `onClick` handed the row and the click, and a `status` slot that tints it.
|
|
80
83
|
- `ListCardZone` — where a column lands on a card: `title`, `chips`, `figures`, `footer` or `body`. The board's type defaults decide it for almost every column; `card.zone` overrides it. `body` is prose, never a default, and draws only on a card laid out roomy enough for a sentence.
|
|
@@ -115,14 +118,13 @@ What the machinery may do with each column type, declared once per type so a new
|
|
|
115
118
|
- `GridPasteKind` — how a pasted clipboard cell becomes a commit: `text`, `option` (the pasted text matched against an offered option's label or key, exact before ignoring case, an in-grid copy landing on the exact option it copied, a label two options share refused), `number`, `date`, `boolean`, `relation` (the pasted label matched against the candidates, committing the id), `list` (the text split into several values, each read as an `option` is on a column of options), `range` (an in-grid pair, or text read as a range is written: "11–50", "10,001+", "up to 50"), or `none` (the type refuses paste).
|
|
116
119
|
- `GridValueKind` — what a written value must look like for a type: `any`, `email`, `url`, `boolean`, `relation` or `list`. `gridNormalizeWrite` holds a value to it.
|
|
117
120
|
- `gridPasteKind` — how a paste becomes this column's value. A `multiple` column pastes as a `list` when it presents a field of a type that keeps several values, and takes no paste otherwise; any other column answers with its type's rule. Returns `null` for a column with no type.
|
|
118
|
-
- `resolveGridRelation` — reads a raw relation value as a `ListRelationValue`, filling in the column's default kind (`relation.entity`) where the value names none; a value's own `entity` wins. Returns `null` for a value that is not a relation.
|
|
119
121
|
- `gridRelationSource` — the candidates the relation picker offers for a column: its `relation.source`, or a static list of its `relation.options`. Given an `entityIcon` resolver, each candidate without an icon of its own wears its kind's glyph, both in a static list and in each page a remote search returns; without one, the candidates come back untouched.
|
|
120
122
|
|
|
121
123
|
## What may be done to a column
|
|
122
124
|
|
|
123
125
|
Three layers decide a write, and each may only take away from the one before: the column's declaration, the workspace's settings for the list (`ListSettingsConfig`), and a person's preferences. The `columnEffective…` and `gridColumnEffective…` answers apply the first two together, and are the ones a write gate asks.
|
|
124
126
|
|
|
125
|
-
- `gridEditorKind` — the editor a column mounts, or `null`: none unless the column is `editable` and typed. A `multiple` column mounts `values` for the four types that keep several values and nothing for any other; a `title` whose field is a name mounts `name`; a `location` column mounts `place` when its field is a place, whose parts the editor reads, and nothing without one; any other column mounts its type's editor.
|
|
127
|
+
- `gridEditorKind` — the editor a column mounts, or `null`: none unless the column is `editable` and typed. A `multiple` column mounts `values` for the four types that keep several values and nothing for any other; a single `email` or `domain` column mounts `values` where its optional second argument, the provider's `oneValue`, says `list` for its type; a `title` whose field is a name mounts `name`; a `location` column mounts `place` when its field is a place, whose parts the editor reads, and nothing without one; any other column mounts its type's editor.
|
|
126
128
|
- `gridColumnHasEditor` — whether a column mounts an editor: the question a click, a double-click, Enter or typing asks. A boolean answers false and is still writable, which is why `columnWritable` is a separate answer.
|
|
127
129
|
- `columnWritable` — whether a column can be written by any route (an editor, Delete, Clear, a fill, a paste), by its declaration alone: false for a derived (`custom`) or `command` column and for one not `editable`; otherwise true when it mounts an editor or is a boolean. Gate sites ask `columnEffectiveWritable`, which adds the workspace's locks.
|
|
128
130
|
- `gridBooleanMode` — a boolean column's write model: `marker` (one-way, true to false) for a `marker` display, `toggle` for every other; `null` for a column that is not a boolean.
|
|
@@ -147,7 +149,7 @@ Three layers decide a write, and each may only take away from the one before: th
|
|
|
147
149
|
- `isLongTextColumn` — whether a column holds a paragraph rather than a phrase: a `text` column with `format.long`, or a `rich_text` column. It reads and edits in the anchored long-text panel rather than the one-line input.
|
|
148
150
|
- `gridColumnInspectable` — whether a cell opens a panel to be read in full, whatever its write state, so a long text that can't be edited can still be read. Long text is the one kind that always does; a cut-off line does when its cell cuts it off (`isWholeTextColumn`).
|
|
149
151
|
- `isWholeTextColumn` — whether a column's text opens whole in that panel when its cell cuts it off: a plain `text` (not a paragraph) and a `title` that is text, not a person's name. Links, emails, phones and domains keep their one-line box.
|
|
150
|
-
- `gridTextOpensBox(column, whole)` — whether an open text cell is drawn in the panel over the cell rather than in the cell: a paragraph always, a line when it was opened `whole` (cut off when it opened).
|
|
152
|
+
- `gridTextOpensBox(column, whole, inCell?)` — whether an open text cell is drawn in the panel over the cell rather than in the cell: a paragraph always, a line when it was opened `whole` (cut off when it opened); never with `inCell` (an app's `TextBody` is handed and the cell is writable: the body stands in the cell).
|
|
151
153
|
|
|
152
154
|
## Column state
|
|
153
155
|
|
|
@@ -163,9 +165,7 @@ What a person changes about the columns (which are shown, in what order, at what
|
|
|
163
165
|
- `resolveColumnOrder` — the declared columns in a stored order: the ids the order names first (an unknown id dropped), and each column the order leaves out placed after its nearest declared neighbour that is placed. An empty order returns the declaration.
|
|
164
166
|
- `resolveVisibleColumns` — the columns a view draws: in the state's order, without the hidden ones, and never none (the first column stays when every column is hidden).
|
|
165
167
|
- `resolveColumnWidths` — each visible column's width by id: its stored width, held to its bounds, or its declared `width`.
|
|
166
|
-
- `clampColumnWidth` — a width held between a column's `grid.minWidth` (
|
|
167
|
-
- `LIST_DEFAULT_MIN_WIDTH` — the narrowest a column can be dragged when it states no `grid.minWidth`: 60 pixels.
|
|
168
|
-
- `computeMinWidth` — the width a set of columns needs: their widths summed, plus the gutter you pass.
|
|
168
|
+
- `clampColumnWidth` — a width held between a column's `grid.minWidth` (60 pixels when it states none) and its `grid.maxWidth`, rounded to a whole pixel.
|
|
169
169
|
- `ListDensity` — the density every view shares: `compact`, `default` or `spacious`. Each view spends it its own way; the grid scales its pixels, the rows views widen their padding.
|
|
170
170
|
- `prettifyOptionValue` — a stored code made readable: underscores and hyphens become spaces and each word starts with a capital (`on_hold` reads `On Hold`).
|
|
171
171
|
|
|
@@ -179,7 +179,9 @@ What a person changes about the columns (which are shown, in what order, at what
|
|
|
179
179
|
|
|
180
180
|
## Sorting and grouping
|
|
181
181
|
|
|
182
|
-
- `effectiveSortKey` — the key a column sorts by, or `undefined`. `sortable: false` offers none; a declared `sortKey` always wins. Without one, on a saved view (`viewBacked`), a bound column with an `accessor` sorts by its field's key, except a location or rich text, which
|
|
182
|
+
- `effectiveSortKey` — the key a column sorts by, or `undefined`. `sortable: false` offers none; a declared `sortKey` always wins. Without one, on a saved view (`viewBacked`), a bound column with an `accessor` sorts by its field's key, except a location, which sorts only by one of its parts (`columnSortParts`), or rich text, which has no order; off a saved view a column sorts only by a declared key, since your host owns the comparator there.
|
|
183
|
+
- `columnSortParts` — the parts a place column sorts by, from its header and the Sort panel: `city`, `region`, `countryCode` and `postalCode`, narrowed to the parts its field holds. Offered on the terms of a field's own sort (a saved view, an `accessor`, no declared `sortKey`, not `sortable: false`); `[]` for any other column. A sort by one is the part key `partKey(fieldKey, part)`.
|
|
184
|
+
- `sortPartOf` — the part a place column sorts by while a sort value is one of its part keys (`sortPartOf(value, fieldKey, parts)`), else `undefined`.
|
|
183
185
|
- `sortableColumns` — the Sort options a saved view offers, one per sort key in the columns' order (the first column that presents a key keeps it). With `parts: true`, each order of a value beyond its whole sort follows its column, keyed `partKey(fieldKey, by)`. Returns `SortableEntry` items.
|
|
184
186
|
- `SortableEntry` — one Sort option: its `key`, the `column` it sorts by and, for one order of a value, that order (`by`). The sort a host stores is `{ fieldKey, direction, by }`.
|
|
185
187
|
- `columnGroupable` — whether a column offers Group by on a saved view: it presents a field of a type that can split a list, and the list has not set `bucketable: false`.
|
|
@@ -197,10 +199,10 @@ The filter panel's rows come from the columns themselves: every column is listed
|
|
|
197
199
|
- Reading: `decimals` (what each number cell shows, so equality rounds as the eye does), `columnState` and `viewId` (what "hidden" means for this view), `icon` (each row's glyph), `messages` and `conventions`.
|
|
198
200
|
- `parts: true` adds one row per part of a value right under its column ("Location · Country"), keyed `partKey(columnId, part)`; a location's whole-value row gives way to its parts.
|
|
199
201
|
- `filterEditor` — the filter editor a column's type opens (`ListFilterEditor`), or `null` for an untyped column.
|
|
200
|
-
- `booleanFilterOptions` — a boolean column's two filter choices, worded as its cell is: a marker reads its `marker.label` (or its header) and "Not …", a `text` display reads its two option labels (True and False by default), and a checkbox reads Checked and Unchecked.
|
|
202
|
+
- `booleanFilterOptions` — a boolean column's two filter choices, worded as its cell is: a marker reads its `marker.label` (or its header) and "Not …", a `text` display reads its two option labels (`views.display.boolean`'s True and False by default), and a checkbox reads Checked and Unchecked. Its optional second argument, a `ViewsMessageResolver`, words them: `views.panels.boolean-checked`, `views.panels.boolean-unchecked` and `views.panels.boolean-not` (`{ label }`).
|
|
201
203
|
- `numberDecimals` — the decimals a number cell shows, so a filter's equality rounds to what is on screen: `0` on an integer field, else the override for its field key, else its `format.decimals`, else `2`.
|
|
202
204
|
- `rowMatchesRules` — whether one row satisfies every filter rule, reading each value through its column's `accessor`. Rules join with AND and an inactive rule matches everything. A column with no accessor is skipped, and a key that is no column's id is read as a part row's. An absent boolean counts as false; picked options join with OR, and a multiselect matches when any of its values was picked; a relation compares by id and an actor by its key. Takes the row, the rules, the columns, the decimals each cell shows and the conventions.
|
|
203
|
-
- `HIDDEN_COLUMN_SECTION` — the section label, "Hidden columns"
|
|
205
|
+
- `HIDDEN_COLUMN_SECTION` — the section label in the package's English, "Hidden columns". `buildColumnFilters` files a hidden column's row under `views.panels.hidden-columns`, worded by its `messages`, which this is without them.
|
|
204
206
|
|
|
205
207
|
## Declaration warnings
|
|
206
208
|
|
|
@@ -212,8 +214,8 @@ Mistakes a column declaration can make that nothing else catches, returned as li
|
|
|
212
214
|
## The row icon
|
|
213
215
|
|
|
214
216
|
- `ListRowIconAccessor` — what a list declares as `rowIcon` for the leading glyph in each row's title cell: a function from a row to an icon name for the neutral default, a `ListRowIcon` to tint it, or `null` to draw none for that row.
|
|
215
|
-
- `ListRowIcon` — a row icon as a descriptor: `icon`, your app's own name for the glyph, which your `AppIcon` draws, and an optional `tone
|
|
216
|
-
- `
|
|
217
|
+
- `ListRowIcon` — a row icon as a descriptor: `icon`, your app's own name for the glyph, which your `AppIcon` draws, and an optional `tone`, a status slot asked for by name, because a coloured row icon says something about state. Without one the glyph draws in the secondary text colour. The grid owns its size and colour, and an optional `avatar`, a `ListRowAvatar`: with it the grid draws the row's picture through your `Avatar` atom at the glyph's size, the glyph its fallback.
|
|
218
|
+
- `ListRowAvatar` — a row's picture before its name, as data: `label` (whose picture it is), `avatarUrl` when there is one and `kind` (the record's kind as your app names it), handed to your `Avatar` atom.
|
|
217
219
|
- `normalizeRowIcon` — reads either answer a `ListRowIconAccessor` gives as a `ListRowIcon`: a bare name becomes `{ icon }`, a descriptor stays as it is, and `null` stays `null`.
|
|
218
220
|
|
|
219
221
|
## Render counting
|
|
@@ -435,7 +437,7 @@ Each rule is data, an operator and its values, so the same rule is judged in mem
|
|
|
435
437
|
One row of the Filter panel is one `FilterConfig`, the union of what each editor needs, told apart by `editor`. They are types and pure functions, safe on a server.
|
|
436
438
|
|
|
437
439
|
- `FilterConfig` — one Filter panel row: an option row picking one value or several (`editor` absent), or a text, number, date, range, relation or unavailable row. It is generic over the option value's type.
|
|
438
|
-
- `FilterConfigBase` — what every row carries: `key`, `label` and optionally `icon` and `kind`. `disabled` lists a row that cannot be opened, so a table's every column reads as one inventory; it is never active, counted or cleared. `section` puts the row under a labelled section, with unsectioned rows first. `valueLabel` replaces the derived summary on the right ("All types", "3 selected"). `onOpen` is called once each time the row's detail opens, so the host can fetch the values it offers. `countsAsFilter` is optional too.
|
|
440
|
+
- `FilterConfigBase` — what every row carries: `key`, `label` and optionally `icon` and `kind`. `disabled` lists a row that cannot be opened, with its `disabledReason` shown on the row, so a table's every column reads as one inventory; it is never active, counted or cleared. `section` puts the row under a labelled section, with unsectioned rows first. `valueLabel` replaces the derived summary on the right ("All types", "3 selected"). `onOpen` is called once each time the row's detail opens, so the host can fetch the values it offers. `countsAsFilter` is optional too.
|
|
439
441
|
- `FilterKind` — what a row filters, which its default icon is chosen by: `status`, `category`, `metric` or `entity`.
|
|
440
442
|
- `FilterOption` — one choice in an option row: its `value`, its `label` and optionally an `icon`.
|
|
441
443
|
- `FilterConfigSingle` — an option row with one choice: `value`, `onChange` and `options`. Optionally the value that means every value (`allValue`, `"all"` when unstated) and its label, whether that choice is hidden, render hooks for an option and its leading and trailing parts, and the list's class name.
|
|
@@ -469,12 +471,11 @@ A relation rule says which far records must match, any, none or every, and holds
|
|
|
469
471
|
|
|
470
472
|
One Filter panel row per relation the list's source can look across, under the section Related records, with the far fields as its Where rows. The Where rows are the column filter's own (`buildColumnFilters`) over columns made from the far fields, so a far status, number, date or text opens the editor it opens everywhere.
|
|
471
473
|
|
|
472
|
-
- `buildRelationFilters` — builds the Related records rows, one `FilterConfigRelation` per target. It takes `targets` keyed by the relation's field key, the current `rules`, `onRuleChange(fieldKey, rule)`, the `subject` (what the list's rows are, plural and lower case), optionally an `icon` for the rows and a `fieldIcon` for each Where row, and `
|
|
473
|
-
- `RelationFilterTarget` — one relation the list can filter across: the far entity's `kind` ("campaign"), the relation's own `label` on the list's entity ("Campaigns"), the far `fields` a Where rule may name,
|
|
474
|
+
- `buildRelationFilters` — builds the Related records rows, one `FilterConfigRelation` per target. It takes `targets` keyed by the relation's field key, the current `rules`, `onRuleChange(fieldKey, rule)`, the `subject` (what the list's rows are, plural and lower case), optionally an `icon` for the rows and a `fieldIcon` for each Where row, `farValues`, and `messages` and `conventions`, which word its Related records heading (`views.panels.related-records`) and reach its Where rows. A far relation, user or actor is offered only when its target names it and `farValues` answers it; without, it is listed greyed, as is a place and an option field that declares no options.
|
|
475
|
+
- `RelationFilterTarget` — one relation the list can filter across: the far entity's `kind` ("campaign"), the relation's own `label` on the list's entity ("Campaigns"), the far `fields` a Where rule may name, `named`, the far relations, users or actors whose values the host answers by name, and an optional `noun` (`{ one, many }`), the far record's noun in your words; absent, the kind with its hyphens as spaces and the label lower-cased in the conventions' locale. A far field it leaves out stays greyed.
|
|
474
476
|
- `FarValues` — the far values a host hands as `farValues`, keyed by `farPathOf`: `values`, each path's values; optionally `labels`, each path's values to their names; and `onWanted(path)`, called when a named far field's row opens, so the host can fetch its values.
|
|
475
477
|
- `farPathOf` — a far field's path, as the host keys its values: the relation's key (itself a two-hop path, `a.b`, for a rollup's second hop), `FAR_PATH_SEPARATOR` and the far field's key, such as `deals.owner`.
|
|
476
478
|
- `FAR_PATH_SEPARATOR` — `.`, what separates a far path's hops and its far field; a field key never holds one.
|
|
477
|
-
- `RELATED_RECORDS_SECTION` — `"Related records"`, the section every relation row sits under.
|
|
478
479
|
- `relationFilterKey` — a Related records row's key, from the relation's field key: the key with `relation:` before it.
|
|
479
480
|
- `relationFieldKeyOf` — the relation's field key, back from a Related records row's key; a key without the prefix comes back as it is.
|
|
480
481
|
|
|
@@ -521,9 +522,8 @@ A list keeps its preferences in separate buckets, by what each follows. The layo
|
|
|
521
522
|
- `StoredViewLayout` — what is stored for one view: only the keys someone set. A key that is absent follows the reader's default, so a key is written only where the view means to differ.
|
|
522
523
|
- `ListLayoutBucket` — a list's layouts, `{ views }`, the stored layout of each view by view id.
|
|
523
524
|
- `EMPTY_LAYOUT_BUCKET` — a layout bucket with no views.
|
|
524
|
-
- `LIST_LAYOUT_DEFAULTS` — the shipped layout: no column state, the default density, the row icon on and every other switch off.
|
|
525
525
|
- `layoutKey` — the key a list's layout bucket is stored under: `list:<listKey>:layout`.
|
|
526
|
-
- `readViewLayout` — resolves one view's layout from the bucket, key by key: a stored value wins (a stored `false` included), vertical borders fall to the reader's defaults, the rest to
|
|
526
|
+
- `readViewLayout` — resolves one view's layout from the bucket, key by key: a stored value wins (a stored `false` included), vertical borders fall to the reader's defaults, the rest to the shipped layout: no column state, the default density, the row icon on and every other switch off. The calendar's and the board's keys appear only when stored.
|
|
527
527
|
- `writeViewLayout` — patches one view's stored layout and returns a new bucket, every other view untouched. The patch lands on what is stored, never on the resolved layout; vertical borders set to the reader's default and any key set to `undefined` are dropped, so the view follows the default again.
|
|
528
528
|
- `ListDefaults` — the reader's own defaults, which every view without an answer of its own follows: whether a table draws rules between its columns (`verticalBorders`).
|
|
529
529
|
- `LIST_DEFAULTS_KEY` — the key the reader's defaults are stored under, `list:defaults`, one per person across devices.
|
|
@@ -531,20 +531,28 @@ A list keeps its preferences in separate buckets, by what each follows. The layo
|
|
|
531
531
|
- `ListMoneyBucket` — the reader's money readings for one list, `{ gridCurrencies }`, by field key: one per list, so a pick in a money column's header means the same on every view.
|
|
532
532
|
- `EMPTY_MONEY_BUCKET` — a money bucket with no readings, frozen.
|
|
533
533
|
- `moneyKey` — the key a list's money bucket is stored under: `list:<listKey>:money`.
|
|
534
|
-
- `ListFieldFormatPrefs` — how one field reads, the host's shared answer for every view and every member: decimals, currency, date style, duration style, whether a date shows its time, option colours and percent display. The flat maps of `ListViewPrefs` are this shape spread out by field key.
|
|
535
534
|
- `hoistLegacyPrefs` — reads a flat preferences blob into a layout bucket, `{ layout }`: the columns, density and five switches it carries go to the `table` view (a key it lacks stays unset), and the `list` view starts empty. Filters, sort, grouping and formats are left where they are. It is pure, so a host may run it on every read and store the bucket only once the person changes something.
|
|
536
535
|
|
|
537
536
|
## The view rules
|
|
538
537
|
|
|
539
538
|
A saved view's filter is a tree of rules keyed by field key; the Filter panel edits its root level as `ListFilterRule`s keyed by column id. These convert between the two and read a list's rows the way a view names them. With `parts: true`, a rule on one part of a value is edited by its own row, under its part key (`partKey`).
|
|
540
539
|
|
|
540
|
+
`filterPanelFromTree` and `treeFromFilterPanel` are the one conversion between a panel and a tree, and the quick values read and write through the same one. A root rule is drawn on a row only when writing the row's rule back gives the same rule; everything else stays in the state's `rest`, whole, so a round trip loses no rule. A between with an end still empty keeps it empty (`null`), so it filters nothing until both ends are in.
|
|
541
|
+
|
|
542
|
+
- `FilterPanelState` — a filter tree as a panel edits it: the root's `op`, one rule per row in `rules` (a column's whole value under its id, a part row's under its part key), and every root item no row draws in `rest`, in its order: and/or/not groups, relation rules, a second rule on a row already drawn, and a rule no row can show.
|
|
543
|
+
- `filterPanelFromTree` — reads a tree into a `FilterPanelState` over a list's columns, part rows included with `parts: true`.
|
|
544
|
+
- `treeFromFilterPanel` — the tree a `FilterPanelState` says: the rows' rules in column order, then the rest. A rule that asks nothing (none ticked, yes and no both ticked) writes nothing, nor does a key no row names. Reading the tree it writes gives the same state.
|
|
545
|
+
- `QuickValues` — a quick-filter panel's picks by field key: an option's codes, a yes/no field's `"true"` or `"false"`.
|
|
546
|
+
- `QuickValueField` — a field a quick-filter panel offers: its key, and the type its value is read as, one whose rule picks options.
|
|
547
|
+
- `quickValuesFromTree` — the picks a quick-filter panel draws: each offered field's root rule that picks options, as its values.
|
|
548
|
+
- `withQuickValues` — the tree with the offered fields' picks written as ordinary root rules, a field with none picked left with none; every other item kept, a rule on an offered field the panel can't show (an `is_none_of`) among them.
|
|
549
|
+
|
|
541
550
|
- `fieldKeyOf` — the key a column is known by off the grid: its field's key, or its own id when it has no field.
|
|
542
|
-
- `fromListFilterRule` — converts a panel rule into a view's rule for one field key and field type, the part it reads when given one. Returns `null` for a rule that asks nothing: options with none ticked, or a yes/no field with both ticked.
|
|
551
|
+
- `fromListFilterRule` — converts a panel rule into a view's rule for one field key and field type, the part it reads when given one. Returns `null` for a rule that asks nothing: options with none ticked, or a yes/no field with both ticked. A between's end still empty stays `null`, and an operator that takes no value (is empty, is not empty) stores `null`.
|
|
543
552
|
- `toListFilterRule` — converts a view's rule into the panel rule that edits it, or `null` when no editor can show it: a place, a derived field's raw type, an operator its editor does not offer. A rule on one part of a value maps only with `parts: true`, to a checklist for a part that opens on `is_any_of` (a place's country) and to text otherwise.
|
|
544
|
-
- `rootRulesByColumn` — the root rules the panel can edit, by column id (and part key, with `parts`). Groups, relation rules and rules on a field no column carries are left out.
|
|
545
|
-
- `
|
|
546
|
-
- `
|
|
547
|
-
- `rootRelationRules` — the root relation rules, by relation field key: what the panel's related-records rows edit.
|
|
553
|
+
- `rootRulesByColumn` — the root rules the panel can edit, by column id (and part key, with `parts`). Groups, relation rules, set-aside rules and rules on a field no column carries are left out.
|
|
554
|
+
- `withRootRule` — the tree with one column's root rule, or its rule on one part, replaced, or dropped when handed `null`; groups, relation rules, set-aside rules and rules the row never showed stay.
|
|
555
|
+
- `rootRelationRules` — the root relation rules, by relation field key: what the panel's related-records rows edit. A set-aside one is left out, and `withRootRelationRules` keeps it.
|
|
548
556
|
- `withRootRelationRules` — the tree with its root relation rules replaced by the ones given, every other rule and group untouched.
|
|
549
557
|
- `viewReaderFrom` — builds the `ViewFieldReader` a view reads a list's rows through, from its columns and the decimals map (by field key). It reads what the cell draws, so a filter, a sort and a group agree with the column on screen; a column that draws itself is read through its edit accessor. Decimals come from the map or the column's format, and a number's currency from the column.
|
|
550
558
|
|
|
@@ -552,8 +560,7 @@ A saved view's filter is a tree of rules keyed by field key; the Filter panel ed
|
|
|
552
560
|
|
|
553
561
|
One part of a value can have a row of its own in the Filter, Sort and Group menus: "Location · Country", "Name · Given name". A host turns these rows on with `parts: true`; the tables say which parts of which types get one.
|
|
554
562
|
|
|
555
|
-
- `
|
|
556
|
-
- `partKey` — a part row's key: a column id (Filter) or a field key (Sort, Group), the separator, then the part.
|
|
563
|
+
- `partKey` — a part row's key: a column id (Filter) or a field key (Sort, Group), `::`, then the part.
|
|
557
564
|
- `parsePartKey` — splits a key at its last separator: `{ id }` for a whole value, `{ id, part }` for a part.
|
|
558
565
|
- `FILTER_PART_ROWS` — the parts each type offers a Filter row for, in their order: a place's country, region, city and postal code; a name's given and family name; a range's low and high end, each a number row.
|
|
559
566
|
- `SORT_PART_ROWS` — the orders each type offers beyond sorting by the whole value: a place by city, region, country or postal code; a name by family or given name; a range by its low or its high end.
|
|
@@ -572,8 +579,6 @@ Guide: [the grid](../guides/the-grid.md).
|
|
|
572
579
|
A column's footer shows one figure, the pick the reader made from the ones the column offers. A list whose rows come a page at a time (a source list) has its figures counted by the database instead; `SourcedAggregates` tells these functions which ones it answered.
|
|
573
580
|
|
|
574
581
|
- `aggregateLabel` — a pick's name, through `views.grid.figure`. Messages default to `resolveViewsMessage`.
|
|
575
|
-
- `LIST_AGGREGATE_LABELS` — every pick's name but `none`, in the package's English. A grid words them through `aggregateLabel` with the host's messages.
|
|
576
|
-
- `gridColumnIsNumericAgg` — says whether a column totals as numbers: it declares a figure to total (`aggAccessor`) or holds a number, a percent or money.
|
|
577
582
|
- `aggregateOptions` — the picks a column offers, `none` first. A numeric column offers sum, average, min, max and count; a percent never sums, and offers ratio only when the column carries its two parts; any other column offers count, filled and unique. On a source list it offers what the database can answer: count everywhere, and the numeric picks where it can total the column. A column that names its picks (`footerKinds`) offers only those.
|
|
578
583
|
- `resolveAggregateKind` — the pick a column's footer shows: the reader's, when the column offers it; else ratio for a ratio column; else the column's declared default, when offered (on a source list, only when the database totalled it); else `none`.
|
|
579
584
|
- `computeAggregate` — a pick's figure over the rows in hand, or `null` for nothing to show. Count is the rows; filled and unique read a place, a name and a phone by their text, and several values as a set; ratio is sum over sum as a whole percent, `null` on an empty denominator; the numeric picks skip blanks and are `null` over no values.
|
|
@@ -601,7 +606,7 @@ A board or calendar card is laid out in zones: the title, a row of chips, a stri
|
|
|
601
606
|
|
|
602
607
|
## A group's figures
|
|
603
608
|
|
|
604
|
-
A source list holds a page, not the list, so its footer and its group headers read figures the database counted over the whole group. Four numbers per totalled key, the sum, the count of values present, the smallest and the largest, answer every pick the database can and combine exactly when parts fold into one group. These names
|
|
609
|
+
A source list holds a page, not the list, so its footer and its group headers read figures the database counted over the whole group. Four numbers per totalled key, the sum, the count of values present, the smallest and the largest, answer every pick the database can and combine exactly when parts fold into one group. These names are `@viewkitjs/fields/query`'s own, free of React, so a server may use them.
|
|
605
610
|
|
|
606
611
|
- `FigureKind` — the footer picks, as `ListAggregateKind` names them.
|
|
607
612
|
- `ColumnFigure` — one key's four numbers: `sum`, `count`, `min` and `max`, a `null` meaning no value.
|
|
@@ -618,9 +623,7 @@ A source list holds a page, not the list, so its footer and its group headers re
|
|
|
618
623
|
Guide: [the grid](../guides/the-grid.md).
|
|
619
624
|
|
|
620
625
|
- `ListGroup` — one group of rows, already filtered, sorted and grouped by the host: its `key`, its `label` (`null` for none), its `items` and, when the database counted them, its `figures` over the whole group.
|
|
621
|
-
- `
|
|
622
|
-
- `OrderDir` — `asc` or `desc`.
|
|
623
|
-
- `OrderChoice` — a mode and a direction, `{ mode, dir }`.
|
|
626
|
+
- `OrderChoice` — a mode and a direction, `{ mode, dir }`: fields' `BucketOrderMode` (`lifecycle`, the order the host states; `count`, most rows first; `name`; or `manual`, the reader's stored positions, which only a source list orders by and `sortGroupEntries` treats as `name`) and `SortDirection` (`asc` or `desc`).
|
|
624
627
|
- `defaultDirFor` — a mode's natural direction, for seeding a new pick: `desc` for `count`, `asc` for the others.
|
|
625
628
|
- `sortGroupEntries` — sorts `[key, rows]` entries by an `OrderChoice` and returns a new array. It takes the lifecycle positions (a key without one sorts after), a label for each key and the key of the uncategorised group, which always sorts last; ties fall back to the label.
|
|
626
629
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewkitjs/views",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "ViewKit views — the grid, board, calendar and list over typed fields: a headless engine and a default rendering written to skin discipline. By Sheaf.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -101,6 +101,14 @@
|
|
|
101
101
|
"types": "./dist/grid/index.d.ts",
|
|
102
102
|
"default": "./dist/grid/index.js"
|
|
103
103
|
},
|
|
104
|
+
"./panels": {
|
|
105
|
+
"types": "./dist/panels/index.d.ts",
|
|
106
|
+
"default": "./dist/panels/index.js"
|
|
107
|
+
},
|
|
108
|
+
"./panels/react": {
|
|
109
|
+
"types": "./dist/panels/react.d.ts",
|
|
110
|
+
"default": "./dist/panels/react.js"
|
|
111
|
+
},
|
|
104
112
|
"./package.json": "./package.json"
|
|
105
113
|
},
|
|
106
114
|
"publishConfig": {
|
|
@@ -108,12 +116,29 @@
|
|
|
108
116
|
"access": "public"
|
|
109
117
|
},
|
|
110
118
|
"peerDependencies": {
|
|
111
|
-
"@
|
|
119
|
+
"@dnd-kit/core": "^6.3.1",
|
|
120
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
121
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
122
|
+
"@viewkitjs/fields": "^0.13.0",
|
|
112
123
|
"react": "^19.0.0",
|
|
113
124
|
"react-dom": "^19.0.0",
|
|
114
125
|
"zod": "^4.1.12"
|
|
115
126
|
},
|
|
127
|
+
"peerDependenciesMeta": {
|
|
128
|
+
"@dnd-kit/core": {
|
|
129
|
+
"optional": true
|
|
130
|
+
},
|
|
131
|
+
"@dnd-kit/sortable": {
|
|
132
|
+
"optional": true
|
|
133
|
+
},
|
|
134
|
+
"@dnd-kit/utilities": {
|
|
135
|
+
"optional": true
|
|
136
|
+
}
|
|
137
|
+
},
|
|
116
138
|
"devDependencies": {
|
|
139
|
+
"@dnd-kit/core": "^6.3.1",
|
|
140
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
141
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
117
142
|
"@tailwindcss/postcss": "^4.3.3",
|
|
118
143
|
"@testing-library/react": "^16.3.2",
|
|
119
144
|
"@types/node": "^20",
|
|
@@ -128,13 +153,17 @@
|
|
|
128
153
|
"typescript": "^5",
|
|
129
154
|
"vitest": "^4.1.5",
|
|
130
155
|
"zod": "^4.1.12",
|
|
131
|
-
"@viewkitjs/fields": "0.
|
|
156
|
+
"@viewkitjs/fields": "0.13.0"
|
|
132
157
|
},
|
|
133
158
|
"scripts": {
|
|
134
159
|
"typecheck": "tsc -p tsconfig.json",
|
|
135
160
|
"build": "node ../../../scripts/clean-package-dist.mjs viewkit/views && tsc -p tsconfig.build.json && tsc -p tsconfig.types.json && node ../../../scripts/finalize-package-declarations.mjs viewkit/views",
|
|
136
161
|
"check": "node ../../../scripts/check-views-package.mjs",
|
|
137
162
|
"bench": "node bench/run.ts",
|
|
138
|
-
"bench:pin": "node bench/pin-check.ts"
|
|
163
|
+
"bench:pin": "node bench/pin-check.ts",
|
|
164
|
+
"bench:fill-width": "node bench/fill-width-check.ts",
|
|
165
|
+
"bench:pages": "node bench/pages-check.ts",
|
|
166
|
+
"bench:chip": "node bench/chip-check.ts",
|
|
167
|
+
"bench:shift": "node bench/shift-check.ts"
|
|
139
168
|
}
|
|
140
169
|
}
|