@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
|
@@ -12,6 +12,7 @@ export type GridAriaLayout = {
|
|
|
12
12
|
colCount: number;
|
|
13
13
|
/** 1-based; undefined for a part the section doesn't draw (a shut group's column names, rows and footer). */
|
|
14
14
|
barIndex: (groupKey: string) => number | undefined;
|
|
15
|
+
/** A section's column names; with `oneHead`, the one row's (`GRID_HEAD_KEY`), and none in a section. */
|
|
15
16
|
headIndex: (groupKey: string) => number | undefined;
|
|
16
17
|
rowIndex: (groupKey: string, index: number) => number | undefined;
|
|
17
18
|
footIndex: (groupKey: string) => number | undefined;
|
|
@@ -24,4 +25,7 @@ export declare function gridAriaLayout(input: {
|
|
|
24
25
|
selectable: boolean;
|
|
25
26
|
columnIds: readonly string[];
|
|
26
27
|
more: boolean;
|
|
28
|
+
/** A grouped grid draws one column names' row over every group (`oneHeader`): it is row 1, and no section has
|
|
29
|
+
* its own. Ignored ungrouped. */
|
|
30
|
+
oneHead?: boolean;
|
|
27
31
|
}): GridAriaLayout;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { GRID_RAIL_COLUMN } from "./grid-focus.js";
|
|
1
|
+
import { GRID_HEAD_KEY, GRID_RAIL_COLUMN } from "./grid-focus.js";
|
|
2
2
|
export function gridAriaLayout(input) {
|
|
3
3
|
const bySection = new Map();
|
|
4
|
-
|
|
4
|
+
const oneHead = !!input.oneHead && input.grouped;
|
|
5
|
+
let next = oneHead ? 2 : 1;
|
|
5
6
|
for (const section of input.sections) {
|
|
6
7
|
const rows = { count: section.count };
|
|
7
8
|
if (input.grouped)
|
|
8
9
|
rows.bar = next++;
|
|
9
10
|
if (!section.collapsed || !input.grouped) {
|
|
10
|
-
|
|
11
|
+
if (!oneHead)
|
|
12
|
+
rows.head = next++;
|
|
11
13
|
rows.firstRow = next;
|
|
12
14
|
next += section.count;
|
|
13
15
|
if (section.footer)
|
|
@@ -26,7 +28,7 @@ export function gridAriaLayout(input) {
|
|
|
26
28
|
rowCount: input.more ? -1 : next - 1,
|
|
27
29
|
colCount: columns.size,
|
|
28
30
|
barIndex: (groupKey) => bySection.get(groupKey)?.bar,
|
|
29
|
-
headIndex: (groupKey) => bySection.get(groupKey)?.head,
|
|
31
|
+
headIndex: (groupKey) => (oneHead ? (groupKey === GRID_HEAD_KEY ? 1 : undefined) : bySection.get(groupKey)?.head),
|
|
30
32
|
rowIndex: (groupKey, index) => {
|
|
31
33
|
const rows = bySection.get(groupKey);
|
|
32
34
|
if (rows?.firstRow == null || index < 0 || index >= rows.count)
|
|
@@ -4,6 +4,9 @@ import { type GridNavDirection } from "./nav.js";
|
|
|
4
4
|
export declare const GRID_RAIL_COLUMN = "__rail__";
|
|
5
5
|
/** "+ Add column", the column names' row's last cell where the header draws it. */
|
|
6
6
|
export declare const GRID_ADD_COLUMN = "__add__";
|
|
7
|
+
/** The key of the one column names' row a grouped grid draws over every group with `oneHeader`: its head target and
|
|
8
|
+
* its `data-group-key`. */
|
|
9
|
+
export declare const GRID_HEAD_KEY = "__head__";
|
|
7
10
|
export type GridChromeTarget = {
|
|
8
11
|
kind: "bar";
|
|
9
12
|
groupKey: string;
|
|
@@ -40,6 +43,9 @@ export type GridFocusShape = {
|
|
|
40
43
|
selectable: boolean;
|
|
41
44
|
columnIds: readonly string[];
|
|
42
45
|
addColumn: boolean;
|
|
46
|
+
/** A grouped grid draws one column names' row over every group (`GRID_HEAD_KEY`), none in a section
|
|
47
|
+
* (`oneHeader`). Ignored ungrouped. */
|
|
48
|
+
oneHead?: boolean;
|
|
43
49
|
};
|
|
44
50
|
/** One arrow from `from`; null where nothing lies that way. A bar's ←/→ that collapse or open are not moves:
|
|
45
51
|
* `gridBarArrow` answers those first. */
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { nextCellLinear, nextCellPos } from "./nav.js";
|
|
2
2
|
export const GRID_RAIL_COLUMN = "__rail__";
|
|
3
3
|
export const GRID_ADD_COLUMN = "__add__";
|
|
4
|
+
export const GRID_HEAD_KEY = "__head__";
|
|
5
|
+
const oneHead = (shape) => !!shape.oneHead && shape.grouped;
|
|
4
6
|
const cell = (rowId, columnId) => ({ kind: "cell", pos: { rowId, columnId } });
|
|
5
7
|
function locate(shape, rowKey) {
|
|
6
8
|
for (let s = 0; s < shape.sections.length; s++) {
|
|
@@ -56,7 +58,7 @@ function prevBottom(shape, s) {
|
|
|
56
58
|
const last = prev.rowKeys[prev.rowKeys.length - 1];
|
|
57
59
|
if (last != null)
|
|
58
60
|
return cell(last, first);
|
|
59
|
-
return { kind: "head", groupKey: prev.groupKey, columnId: first };
|
|
61
|
+
return oneHead(shape) ? gridBarOf(prev.groupKey) : { kind: "head", groupKey: prev.groupKey, columnId: first };
|
|
60
62
|
}
|
|
61
63
|
function belowRows(shape, s, columnId) {
|
|
62
64
|
const section = shape.sections[s];
|
|
@@ -89,7 +91,19 @@ export function gridFocusStep(from, dir, shape) {
|
|
|
89
91
|
}
|
|
90
92
|
return null;
|
|
91
93
|
}
|
|
92
|
-
|
|
94
|
+
if (dir === "up")
|
|
95
|
+
return oneHead(shape) ? gridBarOf(section.groupKey) : onHead(shape, section.groupKey, columnId);
|
|
96
|
+
return belowRows(shape, at.s, columnId);
|
|
97
|
+
}
|
|
98
|
+
if (from.kind === "head" && oneHead(shape) && from.groupKey === GRID_HEAD_KEY) {
|
|
99
|
+
if (horizontal) {
|
|
100
|
+
const next = stepAlong(headColumns(shape), from.columnId, dir);
|
|
101
|
+
return next == null ? null : { kind: "head", groupKey: from.groupKey, columnId: next };
|
|
102
|
+
}
|
|
103
|
+
if (dir === "up")
|
|
104
|
+
return null;
|
|
105
|
+
const first = shape.sections[0];
|
|
106
|
+
return first ? gridBarOf(first.groupKey) : null;
|
|
93
107
|
}
|
|
94
108
|
const s = sectionIndex(shape, from.groupKey);
|
|
95
109
|
if (s < 0)
|
|
@@ -113,7 +127,9 @@ export function gridFocusStep(from, dir, shape) {
|
|
|
113
127
|
if (dir === "down")
|
|
114
128
|
return nextTop(shape, s);
|
|
115
129
|
const last = section.rowKeys[section.rowKeys.length - 1];
|
|
116
|
-
|
|
130
|
+
if (last != null)
|
|
131
|
+
return onRow(shape, last, from.columnId);
|
|
132
|
+
return oneHead(shape) ? gridBarOf(section.groupKey) : onHead(shape, section.groupKey, from.columnId);
|
|
117
133
|
}
|
|
118
134
|
if (horizontal) {
|
|
119
135
|
if (dir === "right" && from.part === "name" && section.menu)
|
|
@@ -122,10 +138,17 @@ export function gridFocusStep(from, dir, shape) {
|
|
|
122
138
|
return gridBarOf(from.groupKey);
|
|
123
139
|
return null;
|
|
124
140
|
}
|
|
125
|
-
if (dir === "up")
|
|
126
|
-
|
|
141
|
+
if (dir === "up") {
|
|
142
|
+
const above = prevBottom(shape, s);
|
|
143
|
+
return above ?? (oneHead(shape) ? onHead(shape, GRID_HEAD_KEY, shape.columnIds[0] ?? "") : null);
|
|
144
|
+
}
|
|
127
145
|
if (section.collapsed)
|
|
128
146
|
return nextTop(shape, s);
|
|
147
|
+
if (oneHead(shape)) {
|
|
148
|
+
const firstColumn = shape.columnIds[0] ?? "";
|
|
149
|
+
const firstRow = section.rowKeys[0];
|
|
150
|
+
return firstRow != null ? onRow(shape, firstRow, firstColumn) : belowRows(shape, s, firstColumn);
|
|
151
|
+
}
|
|
129
152
|
return { kind: "head", groupKey: section.groupKey, columnId: shape.columnIds[0] ?? "" };
|
|
130
153
|
}
|
|
131
154
|
export function gridFocusTab(from, backwards, shape) {
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import type { GridCellCommitFn, GridCellsCommitFn, GridCommitRefusal } from "./commit-model.js";
|
|
2
2
|
import { type GridCellPos } from "./coordinates.js";
|
|
3
3
|
import { type GridEditCell, type GridSettlementByRow } from "./editing-model.js";
|
|
4
|
+
import type { GridWriteStateByRow } from "./write-states.js";
|
|
4
5
|
export type { GridEditCell } from "./editing-model.js";
|
|
5
6
|
type GridEditingApi<Row> = {
|
|
6
7
|
focused: GridCellPos | null;
|
|
7
8
|
editing: GridCellPos | null;
|
|
8
9
|
pendingByRow: ReadonlyMap<string, Record<string, unknown>>;
|
|
10
|
+
/** One row's pending values as the controller holds them NOW, by a callback that keeps its identity: a commit
|
|
11
|
+
* reads it without depending on `pendingByRow`, which changes on every send and would redraw every row. */
|
|
12
|
+
pendingOf: (rowId: string) => Record<string, unknown> | undefined;
|
|
9
13
|
/** The subset of pending cells whose write is only `requested` of its
|
|
10
14
|
* provider — drawn as a visible pending state (spec §11.2). */
|
|
11
15
|
settlementByRow: GridSettlementByRow;
|
|
16
|
+
/** Each cell's writes, for its `data-pending` and `data-invalid` — see `write-states.ts`. */
|
|
17
|
+
writeStateByRow: GridWriteStateByRow;
|
|
12
18
|
focusCell: (rowId: string, columnId: string) => void;
|
|
13
19
|
clearFocus: () => void;
|
|
14
20
|
startEdit: (rowId: string, columnId: string) => void;
|
|
@@ -42,7 +48,8 @@ type GridEditingApi<Row> = {
|
|
|
42
48
|
hasInflight: (rowId: string, columnId: string) => boolean;
|
|
43
49
|
/** What the cell held before its pending write — see GridPendingEntry.baseline. */
|
|
44
50
|
pendingBaseline: (rowId: string, columnId: string) => unknown;
|
|
45
|
-
/** The
|
|
51
|
+
/** The newest value this grid sent for a cell that still stands, and what it was built on — see
|
|
52
|
+
* GridEditingController.sent. */
|
|
46
53
|
sent: (rowId: string, columnId: string) => {
|
|
47
54
|
value: unknown;
|
|
48
55
|
builtOn: unknown;
|
|
@@ -57,4 +64,6 @@ type GridEditingApi<Row> = {
|
|
|
57
64
|
};
|
|
58
65
|
export declare function useGridEditing<Row>(onCellCommit?: GridCellCommitFn<Row>, onCellsCommit?: GridCellsCommitFn<Row>,
|
|
59
66
|
/** Told once per write the app refused (`GridEditingCallbacks.onRefused`). */
|
|
60
|
-
onRefused?: (refusal: GridCommitRefusal) => void
|
|
67
|
+
onRefused?: (refusal: GridCommitRefusal) => void,
|
|
68
|
+
/** Which columns' sent values are kept for a part edit to build on (`GridEditingCallbacks.keepsSent`). */
|
|
69
|
+
keepsSent?: (columnId: string) => boolean): GridEditingApi<Row>;
|
|
@@ -3,19 +3,20 @@ import { gridRowIdFromKey } from "./coordinates.js";
|
|
|
3
3
|
import { GridEditingController } from "./editing-controller.js";
|
|
4
4
|
import { sameListValue } from "@viewkitjs/fields";
|
|
5
5
|
import { prepareGridCommitCells, } from "./editing-model.js";
|
|
6
|
-
export function useGridEditing(onCellCommit, onCellsCommit, onRefused) {
|
|
6
|
+
export function useGridEditing(onCellCommit, onCellsCommit, onRefused, keepsSent) {
|
|
7
7
|
const [focused, setFocused] = useState(null);
|
|
8
8
|
const [editing, setEditing] = useState(null);
|
|
9
9
|
const [pendingByRow, setPendingByRow] = useState(() => new Map());
|
|
10
10
|
const [settlementByRow, setSettlementByRow] = useState(() => new Map());
|
|
11
|
-
const [
|
|
11
|
+
const [writeStateByRow, setWriteStateByRow] = useState(() => new Map());
|
|
12
|
+
const [controller] = useState(() => new GridEditingController({ onCellCommit, onCellsCommit, onRefused, keepsSent }, (pending, settlement) => {
|
|
12
13
|
setPendingByRow(pending);
|
|
13
14
|
setSettlementByRow(settlement);
|
|
14
|
-
}));
|
|
15
|
+
}, setWriteStateByRow));
|
|
15
16
|
useEffect(() => {
|
|
16
|
-
const callbacks = { onCellCommit, onCellsCommit, onRefused };
|
|
17
|
+
const callbacks = { onCellCommit, onCellsCommit, onRefused, keepsSent };
|
|
17
18
|
controller.setCallbacks(callbacks);
|
|
18
|
-
}, [controller, onCellCommit, onCellsCommit, onRefused]);
|
|
19
|
+
}, [controller, onCellCommit, onCellsCommit, onRefused, keepsSent]);
|
|
19
20
|
const focusCell = useCallback((rowId, columnId) => {
|
|
20
21
|
setFocused({ rowId, columnId });
|
|
21
22
|
setEditing(null);
|
|
@@ -72,6 +73,7 @@ export function useGridEditing(onCellCommit, onCellsCommit, onRefused) {
|
|
|
72
73
|
const reconcile = useCallback((matchedKeys) => controller.reconcile(matchedKeys), [controller]);
|
|
73
74
|
const hasInflight = useCallback((rowId, columnId) => controller.hasInflight(rowId, columnId), [controller]);
|
|
74
75
|
const pendingBaseline = useCallback((rowId, columnId) => controller.pendingBaseline(rowId, columnId), [controller]);
|
|
76
|
+
const pendingOf = useCallback((rowId) => controller.getPendingByRow().get(rowId), [controller]);
|
|
75
77
|
const sent = useCallback((rowId, columnId) => controller.sent(rowId, columnId), [controller]);
|
|
76
78
|
const sentCells = useCallback(() => controller.sentCells(), [controller]);
|
|
77
79
|
const forgetSent = useCallback((rowId, columnId) => controller.forgetSent(rowId, columnId), [controller]);
|
|
@@ -79,7 +81,9 @@ export function useGridEditing(onCellCommit, onCellsCommit, onRefused) {
|
|
|
79
81
|
focused,
|
|
80
82
|
editing,
|
|
81
83
|
pendingByRow,
|
|
84
|
+
pendingOf,
|
|
82
85
|
settlementByRow,
|
|
86
|
+
writeStateByRow,
|
|
83
87
|
focusCell,
|
|
84
88
|
clearFocus,
|
|
85
89
|
startEdit,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where each cell's writes stand, as the grid's states say it (`data-pending`, `data-invalid`): a write to it is
|
|
3
|
+
* still in flight, and the latest one sent was refused. Both can hold at once: an older write still out while the
|
|
4
|
+
* newest was refused. A cell with neither is absent, and a row with no such cell is absent.
|
|
5
|
+
*/
|
|
6
|
+
export type GridWriteState = {
|
|
7
|
+
readonly pending: boolean;
|
|
8
|
+
readonly invalid: boolean;
|
|
9
|
+
};
|
|
10
|
+
/** By record id, then column id. A row with none is absent. */
|
|
11
|
+
export type GridWriteStateByRow = ReadonlyMap<string, Readonly<Record<string, GridWriteState>>>;
|
|
12
|
+
/**
|
|
13
|
+
* Sets (or, with null or neither flag, clears) each cell's state. Returns `byRow` itself when nothing changed, and
|
|
14
|
+
* keeps the record of every row it didn't touch, so a memoized row with no change keeps its props.
|
|
15
|
+
*/
|
|
16
|
+
export declare function setGridWriteStates(byRow: GridWriteStateByRow, cells: readonly {
|
|
17
|
+
rowId: string;
|
|
18
|
+
columnId: string;
|
|
19
|
+
state: GridWriteState | null;
|
|
20
|
+
}[]): GridWriteStateByRow;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const sameState = (a, b) => a == null ? b == null : b != null && a.pending === b.pending && a.invalid === b.invalid;
|
|
2
|
+
export function setGridWriteStates(byRow, cells) {
|
|
3
|
+
let next = null;
|
|
4
|
+
for (const { rowId, columnId, state } of cells) {
|
|
5
|
+
const given = state && (state.pending || state.invalid) ? state : null;
|
|
6
|
+
const current = (next ?? byRow).get(rowId);
|
|
7
|
+
if (sameState(current?.[columnId], given))
|
|
8
|
+
continue;
|
|
9
|
+
next ??= new Map(byRow);
|
|
10
|
+
const record = { ...current };
|
|
11
|
+
if (given)
|
|
12
|
+
record[columnId] = { pending: given.pending, invalid: given.invalid };
|
|
13
|
+
else
|
|
14
|
+
delete record[columnId];
|
|
15
|
+
if (Object.keys(record).length > 0)
|
|
16
|
+
next.set(rowId, record);
|
|
17
|
+
else
|
|
18
|
+
next.delete(rowId);
|
|
19
|
+
}
|
|
20
|
+
return next ?? byRow;
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PercentDisplay } from "@viewkitjs/fields";
|
|
2
|
+
import type { ListColumn, ListSelectColor } from "../model/column-schema.js";
|
|
3
|
+
import type { ListDateStyle, ListDurationStyle, ListNumberFormatOverrides } from "../model/column-format.js";
|
|
4
|
+
import { type ListViewPrefs } from "../model/preferences.js";
|
|
5
|
+
/** How a list's fields read: a select's colours, a date's and a duration's style, a time shown, a percent's look,
|
|
6
|
+
* a number's decimals and a money column's display currency. Not settings: they describe a field in every view. */
|
|
7
|
+
export type GridFormatPrefs = Pick<ListViewPrefs, "gridOptionColors" | "gridDateStyles" | "gridDurationStyles" | "gridShowTime" | "gridPercentDisplays" | "gridDecimals" | "gridCurrencies">;
|
|
8
|
+
/** The grid's format props and the handlers that write them back through `setFormats`. Every format is keyed by the
|
|
9
|
+
* FIELD key (`fieldKeyOf(column)`), the name every surface shares. */
|
|
10
|
+
export declare function useGridFormatProps<Row>(formats: GridFormatPrefs, setFormats: (patch: Partial<GridFormatPrefs>) => void, columns: ListColumn<Row>[]): {
|
|
11
|
+
optionColors: import("../model/column-schema.js").ListOptionColorOverrides;
|
|
12
|
+
onOptionColorChange: (key: string, value: string, color: ListSelectColor | null) => void;
|
|
13
|
+
dateStyles: import("../model/column-format.js").ListDateStyleOverrides;
|
|
14
|
+
onDateStyleChange: (key: string, style: ListDateStyle) => void;
|
|
15
|
+
durationStyles: import("../model/column-format.js").ListDurationStyleOverrides;
|
|
16
|
+
onDurationStyleChange: (key: string, style: ListDurationStyle) => void;
|
|
17
|
+
showTimeOverrides: import("../model/column-format.js").ListShowTimeOverrides;
|
|
18
|
+
onShowTimeChange: (key: string, show: boolean) => void;
|
|
19
|
+
percentDisplays: import("../model/column-format.js").ListPercentDisplayOverrides;
|
|
20
|
+
onPercentDisplayChange: (key: string, display: PercentDisplay) => void;
|
|
21
|
+
numberFormats: ListNumberFormatOverrides;
|
|
22
|
+
onNumberFormatChange: (key: string, patch: {
|
|
23
|
+
decimals?: number | null;
|
|
24
|
+
currency?: string;
|
|
25
|
+
}) => void;
|
|
26
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useMemo } from "react";
|
|
3
|
+
import { fieldKeyOf } from "../model/view-rules.js";
|
|
4
|
+
import { setCurrency, setDateStyle, setDecimals, setDurationStyle, setOptionColor, setPercentDisplay, setShowTime, } from "../model/preferences.js";
|
|
5
|
+
import { moneyReadingOf } from "../fields/money.js";
|
|
6
|
+
import { isMoneyReading, MONEY_READING_OPTIONS } from "../fields/currency.js";
|
|
7
|
+
export function useGridFormatProps(formats, setFormats, columns) {
|
|
8
|
+
const { gridOptionColors, gridDateStyles, gridDurationStyles, gridShowTime, gridPercentDisplays, gridDecimals, gridCurrencies, } = formats;
|
|
9
|
+
const onOptionColorChange = useCallback((key, value, color) => {
|
|
10
|
+
setFormats({ gridOptionColors: setOptionColor(gridOptionColors, key, value, color) });
|
|
11
|
+
}, [gridOptionColors, setFormats]);
|
|
12
|
+
const onDateStyleChange = useCallback((key, style) => setFormats({ gridDateStyles: setDateStyle(gridDateStyles, key, style) }), [gridDateStyles, setFormats]);
|
|
13
|
+
const onDurationStyleChange = useCallback((key, style) => setFormats({ gridDurationStyles: setDurationStyle(gridDurationStyles, key, style) }), [gridDurationStyles, setFormats]);
|
|
14
|
+
const onShowTimeChange = useCallback((key, show) => setFormats({ gridShowTime: setShowTime(gridShowTime, key, show) }), [gridShowTime, setFormats]);
|
|
15
|
+
const onPercentDisplayChange = useCallback((key, display) => setFormats({ gridPercentDisplays: setPercentDisplay(gridPercentDisplays, key, display) }), [gridPercentDisplays, setFormats]);
|
|
16
|
+
const numberFormats = useMemo(() => {
|
|
17
|
+
const out = {};
|
|
18
|
+
for (const col of columns) {
|
|
19
|
+
const key = fieldKeyOf(col);
|
|
20
|
+
const reading = moneyReadingOf(col);
|
|
21
|
+
if (gridDecimals[key] === undefined && !reading)
|
|
22
|
+
continue;
|
|
23
|
+
out[key] = {
|
|
24
|
+
decimals: gridDecimals[key],
|
|
25
|
+
...(reading ? { currency: reading, currencyOptions: MONEY_READING_OPTIONS } : {}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}, [columns, gridDecimals]);
|
|
30
|
+
const onNumberFormatChange = useCallback((key, patch) => {
|
|
31
|
+
if (patch.currency != null && isMoneyReading(patch.currency))
|
|
32
|
+
setFormats({ gridCurrencies: setCurrency(gridCurrencies, key, patch.currency) });
|
|
33
|
+
if (patch.decimals === null)
|
|
34
|
+
setFormats({ gridDecimals: { [key]: null } });
|
|
35
|
+
else if (patch.decimals !== undefined)
|
|
36
|
+
setFormats({ gridDecimals: setDecimals(gridDecimals, key, patch.decimals) });
|
|
37
|
+
}, [gridCurrencies, gridDecimals, setFormats]);
|
|
38
|
+
return useMemo(() => ({
|
|
39
|
+
optionColors: gridOptionColors,
|
|
40
|
+
onOptionColorChange,
|
|
41
|
+
dateStyles: gridDateStyles,
|
|
42
|
+
onDateStyleChange,
|
|
43
|
+
durationStyles: gridDurationStyles,
|
|
44
|
+
onDurationStyleChange,
|
|
45
|
+
showTimeOverrides: gridShowTime,
|
|
46
|
+
onShowTimeChange,
|
|
47
|
+
percentDisplays: gridPercentDisplays,
|
|
48
|
+
onPercentDisplayChange,
|
|
49
|
+
numberFormats,
|
|
50
|
+
onNumberFormatChange,
|
|
51
|
+
}), [
|
|
52
|
+
gridOptionColors,
|
|
53
|
+
onOptionColorChange,
|
|
54
|
+
gridDateStyles,
|
|
55
|
+
onDateStyleChange,
|
|
56
|
+
gridDurationStyles,
|
|
57
|
+
onDurationStyleChange,
|
|
58
|
+
gridShowTime,
|
|
59
|
+
onShowTimeChange,
|
|
60
|
+
gridPercentDisplays,
|
|
61
|
+
onPercentDisplayChange,
|
|
62
|
+
numberFormats,
|
|
63
|
+
onNumberFormatChange,
|
|
64
|
+
]);
|
|
65
|
+
}
|
package/dist/grid/index.d.ts
CHANGED
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
* baseline, the title link's class.
|
|
9
9
|
*/
|
|
10
10
|
export { useGridTablePrefs } from "./useGridTablePrefs.js";
|
|
11
|
+
export { useGridTableSettings } from "./useGridTableSettings.js";
|
|
12
|
+
export type { GridFormatPrefs } from "./grid-format-props.js";
|
|
11
13
|
export { GridTable, type GridTableProps } from "./chrome/GridTable.js";
|
|
12
14
|
export type { GridGroupByState, GridSortState } from "./chrome/GridColumnMenu.js";
|
|
13
15
|
export type { GridGroupSortOption } from "./chrome/GridGroupMenu.js";
|
|
14
16
|
export type { GridGroupMenuPart } from "./chrome/grid-group-menu-parts.js";
|
|
15
17
|
export type { GridRowOpenedFrom } from "./core/row-opened-from.js";
|
|
16
|
-
export type { GridDeclaredFigure, GridDrawnFigure, GridGroupFigure, GroupCountNoun, } from "./chrome/grid-table-props.js";
|
|
18
|
+
export type { GridDeclaredFigure, GridDrawnFigure, GridGroupFigure, GridPages, GroupCountNoun, } from "./chrome/grid-table-props.js";
|
|
17
19
|
export type { GridCellCommitFn, GridCellsCommitFn, GridCommitContext, GridCommitOutcome, } from "./core/commit-model.js";
|
|
18
20
|
export { deriveGridRelationValues, deriveGridSelectValues } from "./core/column-values.js";
|
|
19
21
|
export { cellCopyText, cellEditBaseline } from "./core/clipboard-model.js";
|
package/dist/grid/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useGridTablePrefs } from "./useGridTablePrefs.js";
|
|
2
|
+
export { useGridTableSettings } from "./useGridTableSettings.js";
|
|
2
3
|
export { GridTable } from "./chrome/GridTable.js";
|
|
3
4
|
export { deriveGridRelationValues, deriveGridSelectValues } from "./core/column-values.js";
|
|
4
5
|
export { cellCopyText, cellEditBaseline } from "./core/clipboard-model.js";
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type { ListAggregateKind, ListColumn
|
|
2
|
-
import type { ListDateStyle, ListDurationStyle, ListNumberFormatOverrides } from "../model/column-format.js";
|
|
1
|
+
import type { ListAggregateKind, ListColumn } from "../model/column-schema.js";
|
|
3
2
|
import type { ListColumnState } from "../model/column-state.js";
|
|
4
3
|
import { type ListGroupSummaryPart, type ListViewPrefs } from "../model/preferences.js";
|
|
5
|
-
import type { PercentDisplay } from "@viewkitjs/fields";
|
|
6
4
|
/**
|
|
7
5
|
* THE standard wiring between a list's view-prefs blob and the grid: hands back
|
|
8
6
|
* `gridProps` to spread onto `<GridTable>` (all the per-user knobs + handlers).
|
|
9
7
|
* A host's layout panel is its own, built from the same handlers. Active-view
|
|
10
|
-
* selection and list-level filters belong to the binding.
|
|
8
|
+
* selection and list-level filters belong to the binding. A list kept as
|
|
9
|
+
* ViewKit's settings and a person's layer takes `useGridTableSettings` instead.
|
|
11
10
|
*/
|
|
12
11
|
export declare function useGridTablePrefs<Row>({ prefs, setPrefs, columns, viewBacked, }: {
|
|
13
12
|
prefs: ListViewPrefs;
|
|
@@ -18,32 +17,32 @@ export declare function useGridTablePrefs<Row>({ prefs, setPrefs, columns, viewB
|
|
|
18
17
|
viewBacked?: boolean;
|
|
19
18
|
}): {
|
|
20
19
|
gridProps: {
|
|
21
|
-
verticalBorders: boolean;
|
|
22
|
-
showRowIcon: boolean;
|
|
23
|
-
freezeIdentity: boolean;
|
|
24
|
-
alwaysCheckboxes: boolean;
|
|
25
|
-
scale: number;
|
|
26
|
-
optionColors: import("../model/column-schema.js").ListOptionColorOverrides;
|
|
27
|
-
onOptionColorChange: (key: string, value: string, color: ListSelectColor | null) => void;
|
|
28
|
-
dateStyles: import("../model/column-format.js").ListDateStyleOverrides;
|
|
29
|
-
onDateStyleChange: (key: string, style: ListDateStyle) => void;
|
|
30
|
-
durationStyles: import("../model/column-format.js").ListDurationStyleOverrides;
|
|
31
|
-
onDurationStyleChange: (key: string, style: ListDurationStyle) => void;
|
|
32
|
-
showTimeOverrides: import("../model/column-format.js").ListShowTimeOverrides;
|
|
33
|
-
onShowTimeChange: (key: string, show: boolean) => void;
|
|
34
|
-
percentDisplays: import("../model/column-format.js").ListPercentDisplayOverrides;
|
|
35
|
-
onPercentDisplayChange: (key: string, display: PercentDisplay) => void;
|
|
36
20
|
columnState: ListColumnState;
|
|
37
21
|
onColumnStateChange: (next: ListColumnState) => void;
|
|
38
22
|
groupSummary: ListGroupSummaryPart[];
|
|
39
23
|
onGroupSummaryChange: (part: ListGroupSummaryPart, next: boolean) => void;
|
|
40
|
-
aggregates: Record<string,
|
|
24
|
+
aggregates: Record<string, import("@viewkitjs/fields/query").FigureKind>;
|
|
41
25
|
onAggregateChange: (columnId: string, kind: ListAggregateKind) => void;
|
|
42
26
|
viewBacked: boolean;
|
|
43
|
-
|
|
27
|
+
optionColors: import("../model/column-schema.js").ListOptionColorOverrides;
|
|
28
|
+
onOptionColorChange: (key: string, value: string, color: import("../model/column-schema.js").ListSelectColor | null) => void;
|
|
29
|
+
dateStyles: import("../model/column-format.js").ListDateStyleOverrides;
|
|
30
|
+
onDateStyleChange: (key: string, style: import("../model/column-format.js").ListDateStyle) => void;
|
|
31
|
+
durationStyles: import("../model/column-format.js").ListDurationStyleOverrides;
|
|
32
|
+
onDurationStyleChange: (key: string, style: import("../model/column-format.js").ListDurationStyle) => void;
|
|
33
|
+
showTimeOverrides: import("../model/column-format.js").ListShowTimeOverrides;
|
|
34
|
+
onShowTimeChange: (key: string, show: boolean) => void;
|
|
35
|
+
percentDisplays: import("../model/column-format.js").ListPercentDisplayOverrides;
|
|
36
|
+
onPercentDisplayChange: (key: string, display: import("@viewkitjs/fields").PercentDisplay) => void;
|
|
37
|
+
numberFormats: import("../model/column-format.js").ListNumberFormatOverrides;
|
|
44
38
|
onNumberFormatChange: (key: string, patch: {
|
|
45
39
|
decimals?: number | null;
|
|
46
40
|
currency?: string;
|
|
47
41
|
}) => void;
|
|
42
|
+
verticalBorders: boolean;
|
|
43
|
+
showRowIcon: boolean;
|
|
44
|
+
freezeIdentity: boolean;
|
|
45
|
+
alwaysCheckboxes: boolean;
|
|
46
|
+
scale: number;
|
|
48
47
|
};
|
|
49
48
|
};
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCallback, useMemo } from "react";
|
|
3
|
-
import { fieldKeyOf } from "../model/view-rules.js";
|
|
4
3
|
import { GRID_SCALE_MULTIPLIER } from "./core/grid-scale.js";
|
|
5
|
-
import { normalizeGroupSummary, setAggregate,
|
|
6
|
-
import {
|
|
7
|
-
import { isMoneyReading, MONEY_READING_OPTIONS } from "../fields/currency.js";
|
|
4
|
+
import { normalizeGroupSummary, setAggregate, } from "../model/preferences.js";
|
|
5
|
+
import { useGridFormatProps } from "./grid-format-props.js";
|
|
8
6
|
export function useGridTablePrefs({ prefs, setPrefs, columns, viewBacked = false, }) {
|
|
9
|
-
const { gridVerticalBorders, gridRowIcon, gridFreezeIdentity, gridAlwaysCheckboxes,
|
|
10
|
-
const
|
|
11
|
-
setPrefs({ gridOptionColors: setOptionColor(gridOptionColors, key, value, color) });
|
|
12
|
-
}, [gridOptionColors, setPrefs]);
|
|
13
|
-
const onDateStyleChange = useCallback((key, style) => setPrefs({ gridDateStyles: setDateStyle(gridDateStyles, key, style) }), [gridDateStyles, setPrefs]);
|
|
14
|
-
const onDurationStyleChange = useCallback((key, style) => setPrefs({ gridDurationStyles: setDurationStyle(gridDurationStyles, key, style) }), [gridDurationStyles, setPrefs]);
|
|
15
|
-
const onShowTimeChange = useCallback((key, show) => setPrefs({ gridShowTime: setShowTime(gridShowTime, key, show) }), [gridShowTime, setPrefs]);
|
|
16
|
-
const onPercentDisplayChange = useCallback((key, display) => setPrefs({ gridPercentDisplays: setPercentDisplay(gridPercentDisplays, key, display) }), [gridPercentDisplays, setPrefs]);
|
|
7
|
+
const { gridVerticalBorders, gridRowIcon, gridFreezeIdentity, gridAlwaysCheckboxes, gridAggregates, gridColumns, gridScale, groupSummary, } = prefs;
|
|
8
|
+
const formats = useGridFormatProps(prefs, setPrefs, columns);
|
|
17
9
|
const onColumnStateChange = useCallback((next) => setPrefs({ gridColumns: next }), [setPrefs]);
|
|
18
10
|
const summaryParts = useMemo(() => normalizeGroupSummary(groupSummary), [groupSummary]);
|
|
19
11
|
const onGroupSummaryChange = useCallback((part, next) => setPrefs({
|
|
@@ -22,44 +14,13 @@ export function useGridTablePrefs({ prefs, setPrefs, columns, viewBacked = false
|
|
|
22
14
|
: normalizeGroupSummary(groupSummary).filter((p) => p !== part),
|
|
23
15
|
}), [groupSummary, setPrefs]);
|
|
24
16
|
const onAggregateChange = useCallback((columnId, kind) => setPrefs({ gridAggregates: setAggregate(gridAggregates, columnId, kind) }), [gridAggregates, setPrefs]);
|
|
25
|
-
const numberFormats = useMemo(() => {
|
|
26
|
-
const out = {};
|
|
27
|
-
for (const col of columns) {
|
|
28
|
-
const key = fieldKeyOf(col);
|
|
29
|
-
const reading = moneyReadingOf(col);
|
|
30
|
-
if (gridDecimals[key] === undefined && !reading)
|
|
31
|
-
continue;
|
|
32
|
-
out[key] = {
|
|
33
|
-
decimals: gridDecimals[key],
|
|
34
|
-
...(reading ? { currency: reading, currencyOptions: MONEY_READING_OPTIONS } : {}),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
return out;
|
|
38
|
-
}, [columns, gridDecimals]);
|
|
39
|
-
const onNumberFormatChange = useCallback((key, patch) => {
|
|
40
|
-
if (patch.currency != null && isMoneyReading(patch.currency))
|
|
41
|
-
setPrefs({ gridCurrencies: setCurrency(gridCurrencies, key, patch.currency) });
|
|
42
|
-
if (patch.decimals === null)
|
|
43
|
-
setPrefs({ gridDecimals: { [key]: null } });
|
|
44
|
-
else if (patch.decimals !== undefined)
|
|
45
|
-
setPrefs({ gridDecimals: setDecimals(gridDecimals, key, patch.decimals) });
|
|
46
|
-
}, [gridCurrencies, gridDecimals, setPrefs]);
|
|
47
17
|
const gridProps = useMemo(() => ({
|
|
48
18
|
verticalBorders: gridVerticalBorders,
|
|
49
19
|
showRowIcon: gridRowIcon,
|
|
50
20
|
freezeIdentity: gridFreezeIdentity,
|
|
51
21
|
alwaysCheckboxes: gridAlwaysCheckboxes,
|
|
52
22
|
scale: GRID_SCALE_MULTIPLIER[gridScale],
|
|
53
|
-
|
|
54
|
-
onOptionColorChange,
|
|
55
|
-
dateStyles: gridDateStyles,
|
|
56
|
-
onDateStyleChange,
|
|
57
|
-
durationStyles: gridDurationStyles,
|
|
58
|
-
onDurationStyleChange,
|
|
59
|
-
showTimeOverrides: gridShowTime,
|
|
60
|
-
onShowTimeChange,
|
|
61
|
-
percentDisplays: gridPercentDisplays,
|
|
62
|
-
onPercentDisplayChange,
|
|
23
|
+
...formats,
|
|
63
24
|
columnState: gridColumns,
|
|
64
25
|
onColumnStateChange,
|
|
65
26
|
groupSummary: summaryParts,
|
|
@@ -67,24 +28,13 @@ export function useGridTablePrefs({ prefs, setPrefs, columns, viewBacked = false
|
|
|
67
28
|
aggregates: gridAggregates,
|
|
68
29
|
onAggregateChange,
|
|
69
30
|
viewBacked,
|
|
70
|
-
numberFormats,
|
|
71
|
-
onNumberFormatChange,
|
|
72
31
|
}), [
|
|
73
32
|
gridVerticalBorders,
|
|
74
33
|
gridRowIcon,
|
|
75
34
|
gridFreezeIdentity,
|
|
76
35
|
gridAlwaysCheckboxes,
|
|
77
36
|
gridScale,
|
|
78
|
-
|
|
79
|
-
onOptionColorChange,
|
|
80
|
-
gridDateStyles,
|
|
81
|
-
onDateStyleChange,
|
|
82
|
-
gridDurationStyles,
|
|
83
|
-
onDurationStyleChange,
|
|
84
|
-
gridShowTime,
|
|
85
|
-
onShowTimeChange,
|
|
86
|
-
gridPercentDisplays,
|
|
87
|
-
onPercentDisplayChange,
|
|
37
|
+
formats,
|
|
88
38
|
gridColumns,
|
|
89
39
|
onColumnStateChange,
|
|
90
40
|
summaryParts,
|
|
@@ -92,8 +42,6 @@ export function useGridTablePrefs({ prefs, setPrefs, columns, viewBacked = false
|
|
|
92
42
|
gridAggregates,
|
|
93
43
|
onAggregateChange,
|
|
94
44
|
viewBacked,
|
|
95
|
-
numberFormats,
|
|
96
|
-
onNumberFormatChange,
|
|
97
45
|
]);
|
|
98
46
|
return { gridProps };
|
|
99
47
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ListColumnState, type ListGroupSummaryPart, type ListPersonalLayer, type ListSettings, type ListSettingsChange } from "@viewkitjs/fields/query";
|
|
2
|
+
import type { ListAggregateKind, ListColumn } from "../model/column-schema.js";
|
|
3
|
+
import type { ListDefaults } from "../model/prefs-buckets.js";
|
|
4
|
+
import { type GridFormatPrefs } from "./grid-format-props.js";
|
|
5
|
+
/**
|
|
6
|
+
* THE GRID OVER A LIST'S SETTINGS AND A PERSON'S LAYER: hands back `gridProps` to spread onto `<GridTable>`, as
|
|
7
|
+
* `useGridTablePrefs` does for a prefs blob. A column hidden, moved or given a figure, or a group header's figures,
|
|
8
|
+
* comes back through `onChange` as a `ListSettingsChange`; a resize through `onLayerChange` as the person's width. How
|
|
9
|
+
* the fields read (their formats) stays the app's, through `setFormats`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useGridTableSettings<Row>({ settings, layer, columns, parts, onChange, onLayerChange, defaults, formats, setFormats, }: {
|
|
12
|
+
/** The view as the person edits it. */
|
|
13
|
+
settings: ListSettings;
|
|
14
|
+
/** Their own layer over it. */
|
|
15
|
+
layer: ListPersonalLayer;
|
|
16
|
+
/** The list's declared columns: the number formats read each one's money. */
|
|
17
|
+
columns: ListColumn<Row>[];
|
|
18
|
+
/** The same `parts` the grid takes: a part column the settings place is shown, moved and resized as the grid draws
|
|
19
|
+
* it. */
|
|
20
|
+
parts?: boolean;
|
|
21
|
+
/** Each change to what the view shows, never empty. */
|
|
22
|
+
onChange: (change: ListSettingsChange) => void;
|
|
23
|
+
/** Each change to the person's layer. */
|
|
24
|
+
onLayerChange: (patch: ListPersonalLayer) => void;
|
|
25
|
+
/** The reader's own list defaults (vertical borders). */
|
|
26
|
+
defaults?: ListDefaults;
|
|
27
|
+
/** How the list's fields read, and where a change to that goes. */
|
|
28
|
+
formats: GridFormatPrefs;
|
|
29
|
+
setFormats: (patch: Partial<GridFormatPrefs>) => void;
|
|
30
|
+
}): {
|
|
31
|
+
gridProps: {
|
|
32
|
+
columnState: ListColumnState;
|
|
33
|
+
onColumnStateChange: (next: ListColumnState) => void;
|
|
34
|
+
groupSummary: ListGroupSummaryPart[];
|
|
35
|
+
onGroupSummaryChange: (part: ListGroupSummaryPart, on: boolean) => void;
|
|
36
|
+
aggregates: Record<string, import("@viewkitjs/fields/query").FigureKind>;
|
|
37
|
+
onAggregateChange: (columnId: string, kind: ListAggregateKind) => void;
|
|
38
|
+
viewBacked: true;
|
|
39
|
+
optionColors: import("../model/column-schema.js").ListOptionColorOverrides;
|
|
40
|
+
onOptionColorChange: (key: string, value: string, color: import("../model/column-schema.js").ListSelectColor | null) => void;
|
|
41
|
+
dateStyles: import("../model/column-format.js").ListDateStyleOverrides;
|
|
42
|
+
onDateStyleChange: (key: string, style: import("../model/column-format.js").ListDateStyle) => void;
|
|
43
|
+
durationStyles: import("../model/column-format.js").ListDurationStyleOverrides;
|
|
44
|
+
onDurationStyleChange: (key: string, style: import("../model/column-format.js").ListDurationStyle) => void;
|
|
45
|
+
showTimeOverrides: import("../model/column-format.js").ListShowTimeOverrides;
|
|
46
|
+
onShowTimeChange: (key: string, show: boolean) => void;
|
|
47
|
+
percentDisplays: import("../model/column-format.js").ListPercentDisplayOverrides;
|
|
48
|
+
onPercentDisplayChange: (key: string, display: import("@viewkitjs/fields").PercentDisplay) => void;
|
|
49
|
+
numberFormats: import("../model/column-format.js").ListNumberFormatOverrides;
|
|
50
|
+
onNumberFormatChange: (key: string, patch: {
|
|
51
|
+
decimals?: number | null;
|
|
52
|
+
currency?: string;
|
|
53
|
+
}) => void;
|
|
54
|
+
verticalBorders: boolean;
|
|
55
|
+
showRowIcon: boolean;
|
|
56
|
+
freezeIdentity: boolean;
|
|
57
|
+
alwaysCheckboxes: boolean;
|
|
58
|
+
scale: number;
|
|
59
|
+
};
|
|
60
|
+
};
|