@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,14 +12,16 @@ import { AUTOMATIC_SAMPLE, DECIMALS_SAMPLE } from "./GridColumnNumberSection.js"
|
|
|
12
12
|
import { DISPLAYS } from "./GridColumnPercentSection.js";
|
|
13
13
|
import { columnGroupable } from "../../model/column-order.js";
|
|
14
14
|
import { columnKnobs } from "../../model/column-knobs.js";
|
|
15
|
-
import { effectiveSortKey } from "../../model/column-sort.js";
|
|
15
|
+
import { columnSortParts, effectiveSortKey, sortPartOf } from "../../model/column-sort.js";
|
|
16
|
+
import { partKey, partWord } from "../../model/part-rows.js";
|
|
16
17
|
import { fieldKeyOf } from "../../model/view-rules.js";
|
|
17
18
|
import { temporalKindOf } from "../../model/field-type-of.js";
|
|
18
19
|
export function columnMenuGates(column, offer) {
|
|
19
20
|
const { values, viewBacked = false, sort, groupBy, formatsWritable = true } = offer;
|
|
20
21
|
const key = fieldKeyOf(column);
|
|
21
22
|
const sortKey = effectiveSortKey(column, viewBacked);
|
|
22
|
-
const
|
|
23
|
+
const sortParts = sort ? columnSortParts(column, viewBacked) : [];
|
|
24
|
+
const sortable = !!(sortKey && sort) || sortParts.length > 0;
|
|
23
25
|
const groupable = !!groupBy && viewBacked && columnGroupable(column);
|
|
24
26
|
const grouped = groupable && groupBy.fieldKey === column.field.key;
|
|
25
27
|
const knobs = columnKnobs(column);
|
|
@@ -39,6 +41,7 @@ export function columnMenuGates(column, offer) {
|
|
|
39
41
|
return {
|
|
40
42
|
key,
|
|
41
43
|
sortKey,
|
|
44
|
+
sortParts,
|
|
42
45
|
sortable,
|
|
43
46
|
groupable,
|
|
44
47
|
grouped,
|
|
@@ -65,7 +68,33 @@ export function gridColumnMenuItems(column, props, gates, deps) {
|
|
|
65
68
|
close();
|
|
66
69
|
};
|
|
67
70
|
const blocks = [];
|
|
68
|
-
if (gates.
|
|
71
|
+
if (gates.sortParts.length > 0) {
|
|
72
|
+
const sort = props.sort;
|
|
73
|
+
const fieldKey = column.field.key;
|
|
74
|
+
const active = sortPartOf(sort.value, fieldKey, gates.sortParts);
|
|
75
|
+
const word = (part) => partWord("location", part, messages) ?? part;
|
|
76
|
+
const direction = (dir, icon) => ({
|
|
77
|
+
key: `sort-${dir}`,
|
|
78
|
+
label: messages({ key: dir === "asc" ? "views.menus.sort-asc" : "views.menus.sort-desc" }),
|
|
79
|
+
icon: glyph(icon),
|
|
80
|
+
beside: true,
|
|
81
|
+
...(active !== undefined && sort.dir === dir && { detail: word(active) }),
|
|
82
|
+
children: gates.sortParts.map((part) => ({
|
|
83
|
+
key: `sort-${dir}:${part}`,
|
|
84
|
+
label: word(part),
|
|
85
|
+
checked: active === part && sort.dir === dir,
|
|
86
|
+
onSelect: then(() => sort.onChange({ value: partKey(fieldKey, part), dir })),
|
|
87
|
+
})),
|
|
88
|
+
});
|
|
89
|
+
blocks.push([
|
|
90
|
+
direction("asc", "sortRowsUp"),
|
|
91
|
+
direction("desc", "sortRowsDown"),
|
|
92
|
+
...(active !== undefined
|
|
93
|
+
? [{ key: "sort-clear", label: messages({ key: "views.menus.sort-clear" }), icon: glyph("clearSort"), onSelect: then(() => sort.onChange({ value: "", dir: "asc" })) }]
|
|
94
|
+
: []),
|
|
95
|
+
]);
|
|
96
|
+
}
|
|
97
|
+
else if (gates.sortable) {
|
|
69
98
|
const sort = props.sort;
|
|
70
99
|
const active = sort.value === gates.sortKey;
|
|
71
100
|
const pick = (dir) => then(() => sort.onChange({ value: gates.sortKey, dir }));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The columns' template, `--vk-cols`: a 0px lead track, one track per visible column, then the tail ("+ Add column"
|
|
3
|
+
* and a row's ⋯). Every row, column-name row, footer and group head reads it.
|
|
4
|
+
*
|
|
5
|
+
* By default every data column is a fixed track — never `1fr`. A flexible column gives its slack back when a
|
|
6
|
+
* neighbour grows, so dragging one border moved the border on the column's other side too. The tail is the ONLY
|
|
7
|
+
* track that absorbs leftover space, which is what makes a resize push everything to its right and nothing to its
|
|
8
|
+
* left. Its MINIMUM is the control's own width, not 0: an overflowing table shrinks the 1fr to its minimum, and at 0
|
|
9
|
+
* the tail collapses — the right gutter disappears and the control spills over the page edge. The layout's
|
|
10
|
+
* `minWidth` carries the same term; the two must agree or the tail lands outside the horizontal scroll.
|
|
11
|
+
*
|
|
12
|
+
* With `fillWidth`, a column that may grow is `minmax(<its width>, <its width>fr)`: the leftover is shared in
|
|
13
|
+
* proportion to each column's own width, and no column shrinks below it. A table already wider than the grid has no
|
|
14
|
+
* leftover, so every column is drawn at exactly its width variable, as without the option (which is why the frozen
|
|
15
|
+
* columns' sticky offsets, sums of those variables, still hold once it scrolls sideways). A column stays fixed when
|
|
16
|
+
* it is in `fixed` (a width the person set, or the one being dragged) or declares `grid.maxWidth`, since a growing
|
|
17
|
+
* track can't be capped. While any column grows the tail stands at its own width; when none can, it takes the rest.
|
|
18
|
+
*/
|
|
19
|
+
export declare function gridColumnsTemplate(columns: readonly {
|
|
20
|
+
id: string;
|
|
21
|
+
grid?: {
|
|
22
|
+
maxWidth?: number;
|
|
23
|
+
};
|
|
24
|
+
}[], widths: Readonly<Record<string, number>>, options?: {
|
|
25
|
+
fillWidth?: boolean;
|
|
26
|
+
fixed?: ReadonlySet<string>;
|
|
27
|
+
}): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { gridWidthVar } from "../core/grid-scale.js";
|
|
2
|
+
export function gridColumnsTemplate(columns, widths, options) {
|
|
3
|
+
let growing = false;
|
|
4
|
+
const tracks = columns.map((col) => {
|
|
5
|
+
const own = `calc(var(${gridWidthVar(col.id)}) * var(--vk-scale))`;
|
|
6
|
+
const grows = !!options?.fillWidth && !options.fixed?.has(col.id) && col.grid?.maxWidth == null;
|
|
7
|
+
if (!grows)
|
|
8
|
+
return own;
|
|
9
|
+
growing = true;
|
|
10
|
+
return `minmax(${own},${widths[col.id]}fr)`;
|
|
11
|
+
});
|
|
12
|
+
return ["0px", ...tracks, growing ? "var(--vk-tail-w)" : "minmax(var(--vk-tail-w),1fr)"].join(" ");
|
|
13
|
+
}
|
|
@@ -41,7 +41,10 @@ export type GridEditSession = {
|
|
|
41
41
|
* Tab moves the focus at once all the same, and a key in the gap writes the answer first. Left mid-exit (the cell
|
|
42
42
|
* unmounted first), the answer is still written, and the focus stays where the person put it. Left
|
|
43
43
|
* while a refusal stands (another cell clicked), nothing is written and the reason is said in a toast,
|
|
44
|
-
* as the grid says every refusal it can't show in an editor.
|
|
44
|
+
* as the grid says every refusal it can't show in an editor. Left with the editor open because the page goes
|
|
45
|
+
* (`pagehide`) or the grid itself goes (its leave scope, `GridTableContent`), the draft is written as a press outside
|
|
46
|
+
* writes it, and the focus moves nowhere; in the sheet nothing is written, as its backdrop. The grid's own end of an
|
|
47
|
+
* edit (Escape on the cell, a row gone stale) unmounts only this editor, never the grid, and stays a discard.
|
|
45
48
|
*/
|
|
46
49
|
export declare function useGridEditSession<P>(args: GridEditSessionArgs<P>): GridEditSession;
|
|
47
50
|
/**
|
|
@@ -23,6 +23,7 @@ export function useGridEditSession(args) {
|
|
|
23
23
|
const refusedRef = useRef(null);
|
|
24
24
|
const movedRef = useRef(false);
|
|
25
25
|
const flushRef = useRef(null);
|
|
26
|
+
const leavingRef = useRef(false);
|
|
26
27
|
const stopFlush = () => {
|
|
27
28
|
if (flushRef.current)
|
|
28
29
|
document.removeEventListener("keydown", flushRef.current, true);
|
|
@@ -50,6 +51,8 @@ export function useGridEditSession(args) {
|
|
|
50
51
|
};
|
|
51
52
|
const keep = (answer) => {
|
|
52
53
|
keptRef.current = answer;
|
|
54
|
+
if (leavingRef.current)
|
|
55
|
+
return;
|
|
53
56
|
if (sheet || (viaRef.current !== "enter" && viaRef.current !== "tab" && viaRef.current !== "shift-tab"))
|
|
54
57
|
return;
|
|
55
58
|
movedRef.current = true;
|
|
@@ -68,6 +71,11 @@ export function useGridEditSession(args) {
|
|
|
68
71
|
mapPayload,
|
|
69
72
|
escape,
|
|
70
73
|
exitMs: sheet ? GRID_SHEET_EXIT_MS : undefined,
|
|
74
|
+
leave: sheet ? "discard" : "outside",
|
|
75
|
+
onLeave: () => {
|
|
76
|
+
leavingRef.current = true;
|
|
77
|
+
viaRef.current = null;
|
|
78
|
+
},
|
|
71
79
|
onAttempt: (answer) => {
|
|
72
80
|
const reason = answer.kind === "commit" ? (latest.current.refuse?.(answer.payload) ?? null) : null;
|
|
73
81
|
refusedRef.current = reason;
|
|
@@ -81,7 +89,7 @@ export function useGridEditSession(args) {
|
|
|
81
89
|
},
|
|
82
90
|
onClose: () => {
|
|
83
91
|
if (keptRef.current)
|
|
84
|
-
write(keptRef.current,
|
|
92
|
+
write(keptRef.current, !leavingRef.current);
|
|
85
93
|
},
|
|
86
94
|
});
|
|
87
95
|
useEffect(() => () => {
|
|
@@ -94,6 +102,7 @@ export function useGridEditSession(args) {
|
|
|
94
102
|
const close = (reason) => {
|
|
95
103
|
if (sheet && reason === "blur")
|
|
96
104
|
return;
|
|
105
|
+
leavingRef.current = false;
|
|
97
106
|
viaRef.current = reason;
|
|
98
107
|
session.close(reason);
|
|
99
108
|
};
|
|
@@ -107,6 +116,7 @@ export function useGridEditSession(args) {
|
|
|
107
116
|
return registerGridEditEscape(() => closeRef.current("escape"));
|
|
108
117
|
}, [session.open, session.keeps]);
|
|
109
118
|
const closeFromPanel = (reason) => {
|
|
119
|
+
leavingRef.current = false;
|
|
110
120
|
if (session.open)
|
|
111
121
|
viaRef.current = null;
|
|
112
122
|
session.close(reason);
|
|
@@ -12,8 +12,14 @@ export type GridGroupMenuFigure = {
|
|
|
12
12
|
label: ReactNode;
|
|
13
13
|
text?: string;
|
|
14
14
|
};
|
|
15
|
+
/** A group's Select all in group: whether every row of it is picked, and the pick (all, or none when all are). */
|
|
16
|
+
export type GridGroupMenuSelect = {
|
|
17
|
+
allSelected: boolean;
|
|
18
|
+
onToggle: () => void;
|
|
19
|
+
};
|
|
15
20
|
/**
|
|
16
|
-
* The rows in today's order, each part after the first behind a divider:
|
|
21
|
+
* The rows in today's order, each part after the first behind a divider: Select all in group (Deselect all in group
|
|
22
|
+
* when every row is picked), leading as a row's menu leads with Select; the sort choices a group beside the menu
|
|
17
23
|
* (the current one ticked and named as its detail; a pick of the ticked one flips its direction), with no search
|
|
18
24
|
* field; the Show figures a group in place, each a tick that keeps the menu open; Hide.
|
|
19
25
|
*/
|
|
@@ -24,6 +30,7 @@ export declare function gridGroupMenuItems(parts: GridGroupMenuParts, input: {
|
|
|
24
30
|
onSummaryChange?: (part: ListGroupSummaryPart, next: boolean) => void;
|
|
25
31
|
figures: GridGroupMenuFigure[];
|
|
26
32
|
onHide?: () => void;
|
|
33
|
+
select?: GridGroupMenuSelect;
|
|
27
34
|
}, deps: {
|
|
28
35
|
messages: ViewsMessageResolver;
|
|
29
36
|
icons: ViewsIcons;
|
|
@@ -9,6 +9,23 @@ export function gridGroupMenuItems(parts, input, deps) {
|
|
|
9
9
|
return _jsx(Glyph, { className: "size-4" });
|
|
10
10
|
};
|
|
11
11
|
const blocks = [];
|
|
12
|
+
if (parts.select && input.select) {
|
|
13
|
+
const select = input.select;
|
|
14
|
+
blocks.push([
|
|
15
|
+
{
|
|
16
|
+
key: "group-select",
|
|
17
|
+
label: messages({
|
|
18
|
+
key: "views.menus.group-select",
|
|
19
|
+
values: { selected: select.allSelected ? "true" : "false" },
|
|
20
|
+
}),
|
|
21
|
+
icon: glyph("selectRow"),
|
|
22
|
+
onSelect: () => {
|
|
23
|
+
select.onToggle();
|
|
24
|
+
close();
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
12
29
|
if (parts.sort && input.sort && input.sortOptions.length > 0) {
|
|
13
30
|
const sort = input.sort;
|
|
14
31
|
const current = input.sortOptions.find((opt) => opt.value === sort.value);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
/** A part of a group band's ⋯ menu:
|
|
2
|
-
* Hide. */
|
|
3
|
-
export type GridGroupMenuPart = "sort" | "figures" | "hide";
|
|
1
|
+
/** A part of a group band's ⋯ menu: Select all in group (it picks the group's rows, or clears them when all are
|
|
2
|
+
* picked), its sort choices, the band's figure toggles (the count and each figure), Hide. */
|
|
3
|
+
export type GridGroupMenuPart = "select" | "sort" | "figures" | "hide";
|
|
4
4
|
/** The parts a band's ⋯ holds, whether its sort list searches through the app's `Command`, and whether there is
|
|
5
5
|
* a ⋯ at all. */
|
|
6
6
|
export type GridGroupMenuParts = {
|
|
7
|
+
select: boolean;
|
|
7
8
|
sort: boolean;
|
|
8
9
|
figures: boolean;
|
|
9
10
|
hide: boolean;
|
|
@@ -14,14 +15,17 @@ export type GridGroupMenuParts = {
|
|
|
14
15
|
* Without `groupMenu`, the rule every grid had before it: sort choices or Hide open the ⋯, the figure toggles
|
|
15
16
|
* ride along whenever the menu is drawn, and the sort list searches through `Command` past eight choices. With it, each part
|
|
16
17
|
* it lists that the grid can fill (sort needs a sort and its choices, the figures need figures and a way to turn
|
|
17
|
-
* them on, Hide a way to hide), and the sort list always searches through `Command`. `command` is read on the
|
|
18
|
-
* `popover` route only: on the `menu` route the sort choices open beside the menu with no search.
|
|
18
|
+
* them on, Hide a way to hide, Select a grid that selects), and the sort list always searches through `Command`. `command` is read on the
|
|
19
|
+
* `popover` route only: on the `menu` route the sort choices open beside the menu with no search. Select is never
|
|
20
|
+
* offered without `groupMenu`, so a menu the app did not name stays as it was.
|
|
19
21
|
*/
|
|
20
|
-
export declare function groupMenuParts({ groupMenu, hasSort, sortCount, figureCount, canToggleFigures, canHide, }: {
|
|
22
|
+
export declare function groupMenuParts({ groupMenu, hasSort, sortCount, figureCount, canToggleFigures, canHide, canSelect, }: {
|
|
21
23
|
groupMenu?: readonly GridGroupMenuPart[];
|
|
22
24
|
hasSort: boolean;
|
|
23
25
|
sortCount: number;
|
|
24
26
|
figureCount: number;
|
|
25
27
|
canToggleFigures: boolean;
|
|
26
28
|
canHide: boolean;
|
|
29
|
+
/** The grid selects rows. */
|
|
30
|
+
canSelect: boolean;
|
|
27
31
|
}): GridGroupMenuParts;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { GRID_MENU_SEARCH_AFTER } from "./grid-menu-search.js";
|
|
2
|
-
export function groupMenuParts({ groupMenu, hasSort, sortCount, figureCount, canToggleFigures, canHide, }) {
|
|
2
|
+
export function groupMenuParts({ groupMenu, hasSort, sortCount, figureCount, canToggleFigures, canHide, canSelect, }) {
|
|
3
3
|
const sortable = hasSort && sortCount > 0;
|
|
4
4
|
const toggles = figureCount > 0 && canToggleFigures;
|
|
5
5
|
if (!groupMenu) {
|
|
6
6
|
const open = sortable || canHide;
|
|
7
7
|
return {
|
|
8
|
+
select: false,
|
|
8
9
|
sort: sortable,
|
|
9
10
|
figures: toggles,
|
|
10
11
|
hide: canHide,
|
|
@@ -15,5 +16,6 @@ export function groupMenuParts({ groupMenu, hasSort, sortCount, figureCount, can
|
|
|
15
16
|
const sort = groupMenu.includes("sort") && sortable;
|
|
16
17
|
const figures = groupMenu.includes("figures") && toggles;
|
|
17
18
|
const hide = groupMenu.includes("hide") && canHide;
|
|
18
|
-
|
|
19
|
+
const select = groupMenu.includes("select") && canSelect;
|
|
20
|
+
return { select, sort, figures, hide, command: sort, open: select || sort || figures || hide };
|
|
19
21
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PointerEvent as ReactPointerEvent } from "react";
|
|
2
2
|
import type { ListCellAction } from "../../model/column-schema.js";
|
|
3
|
+
import { type GridButtonViews } from "./grid-button.js";
|
|
3
4
|
/**
|
|
4
5
|
* WHERE THE POINTER IS, for the two things a row draws only there: the name's
|
|
5
6
|
* actions (on the row under the pointer) and a pick-list's ▾ (on the cell under
|
|
@@ -38,7 +39,9 @@ export declare function useGridRowHoverHandlers(rowKey: string): {
|
|
|
38
39
|
onPointerLeave(event: ReactPointerEvent<HTMLElement>): void;
|
|
39
40
|
};
|
|
40
41
|
/** The name's action lane, drawn only on the row under the pointer. */
|
|
41
|
-
export declare function GridRowHoverActions<Row>({ rowKey, row, selected, actions, }: {
|
|
42
|
+
export declare function GridRowHoverActions<Row>({ views, rowKey, row, selected, actions, }: {
|
|
43
|
+
/** The provider's Button and who draws, handed down from the row's cells. */
|
|
44
|
+
views: GridButtonViews;
|
|
42
45
|
rowKey: string;
|
|
43
46
|
row: Row;
|
|
44
47
|
selected: boolean;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useContext, useSyncExternalStore, } from "react";
|
|
4
4
|
import { cx } from "../../internal/cx.js";
|
|
5
|
-
import { ELEMENT_RESET } from "../../internal/reset.js";
|
|
6
5
|
import { useDesktop } from "../../provider/desktop.js";
|
|
7
6
|
import { useViews } from "../../provider/context.js";
|
|
8
7
|
import { GridRowActions } from "./GridRowActions.js";
|
|
8
|
+
import { drawGridButton } from "./grid-button.js";
|
|
9
9
|
export function createGridHoverStore() {
|
|
10
10
|
let current = null;
|
|
11
11
|
const listeners = new Set();
|
|
@@ -70,10 +70,10 @@ export function useGridRowHoverHandlers(rowKey) {
|
|
|
70
70
|
onPointerLeave: clearOwn,
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
export function GridRowHoverActions({ rowKey, row, selected, actions, }) {
|
|
73
|
+
export function GridRowHoverActions({ views, rowKey, row, selected, actions, }) {
|
|
74
74
|
if (!useGridRowHovered(rowKey))
|
|
75
75
|
return null;
|
|
76
|
-
return _jsx(GridRowActions, { row: row, selected: selected, actions: actions });
|
|
76
|
+
return _jsx(GridRowActions, { views: views, row: row, selected: selected, actions: actions });
|
|
77
77
|
}
|
|
78
78
|
export function GridPickerCaret({ rowKey, colId, editing, onOpen, }) {
|
|
79
79
|
const hovered = useGridCellHovered(rowKey, colId);
|
|
@@ -82,12 +82,22 @@ export function GridPickerCaret({ rowKey, colId, editing, onOpen, }) {
|
|
|
82
82
|
return _jsx(PickerCaretButton, { editing: editing, onOpen: onOpen });
|
|
83
83
|
}
|
|
84
84
|
function PickerCaretButton({ editing, onOpen }) {
|
|
85
|
-
const
|
|
85
|
+
const views = useViews();
|
|
86
|
+
const { icons, messages } = views;
|
|
86
87
|
if (!useDesktop())
|
|
87
88
|
return null;
|
|
88
|
-
return (
|
|
89
|
+
return drawGridButton(views, {
|
|
90
|
+
tabIndex: -1,
|
|
91
|
+
"aria-label": messages({ key: "views.grid.change-value" }),
|
|
92
|
+
onClick: (e) => {
|
|
89
93
|
e.stopPropagation();
|
|
90
94
|
if (!editing)
|
|
91
95
|
onOpen();
|
|
92
|
-
},
|
|
96
|
+
},
|
|
97
|
+
own: cx("absolute right-1 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center hover:text-(color:--vk-fg)", editing ? "text-(color:--vk-fg)" : "text-(color:--vk-fg-subtlest)"),
|
|
98
|
+
frame: "absolute right-1 top-1/2 h-5 w-5 -translate-y-1/2",
|
|
99
|
+
variant: "ghost",
|
|
100
|
+
size: "icon",
|
|
101
|
+
children: _jsx(icons.caretDown, { className: cx("h-3 w-3 transition-transform duration-100", editing && "rotate-180") }),
|
|
102
|
+
});
|
|
93
103
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GridPages } from "./grid-table-props.js";
|
|
2
|
+
/** The page sizes the pager offers when the app names none. */
|
|
3
|
+
export declare const GRID_PAGE_SIZES: readonly number[];
|
|
4
|
+
/** Where a page stands: its first and last row's places (0 and 0 for none), the last page (null when the count is
|
|
5
|
+
* capped), and whether there is a page before and after it. */
|
|
6
|
+
export type GridPageSpan = {
|
|
7
|
+
from: number;
|
|
8
|
+
to: number;
|
|
9
|
+
last: number | null;
|
|
10
|
+
hasPrevious: boolean;
|
|
11
|
+
hasNext: boolean;
|
|
12
|
+
};
|
|
13
|
+
/** Where `pages.page` stands, holding `rowsOnPage` rows. Under a capped count the last page is unknown, so a full page
|
|
14
|
+
* offers the next and a short one ends the pages. */
|
|
15
|
+
export declare function gridPageSpan(pages: Pick<GridPages, "page" | "size" | "total" | "exact">, rowsOnPage: number): GridPageSpan;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const GRID_PAGE_SIZES = [25, 50, 100];
|
|
2
|
+
export function gridPageSpan(pages, rowsOnPage) {
|
|
3
|
+
const { page, size, total, exact = true } = pages;
|
|
4
|
+
const from = rowsOnPage === 0 ? 0 : (page - 1) * size + 1;
|
|
5
|
+
const to = rowsOnPage === 0 ? 0 : from + rowsOnPage - 1;
|
|
6
|
+
const last = exact ? Math.max(1, Math.ceil(total / size)) : null;
|
|
7
|
+
const hasNext = last === null ? rowsOnPage === size : page < last;
|
|
8
|
+
return { from, to, last, hasPrevious: page > 1, hasNext };
|
|
9
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { columnClearRefusal, columnEditRefusal, columnWritable, gridBooleanMode, } from "../../model/column-capabilities.js";
|
|
4
4
|
import { cellClearPrev, cellEditBaseline, cellPrevPayload, coercePaste, copyCell, getGridClipboard, rowHoldsCurrency, } from "./cell-clipboard.js";
|
|
5
5
|
function nameActionItems(row, actions, hostItems) {
|
|
6
6
|
if (!actions?.length)
|
|
@@ -43,7 +43,9 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
43
43
|
? columns.find((column) => column.id === menuColumnId)
|
|
44
44
|
: undefined;
|
|
45
45
|
const editBaseline = (column) => cellEditBaseline(column, row, pendingByCol);
|
|
46
|
-
const canEdit = (column) => editingEnabled &&
|
|
46
|
+
const canEdit = (column) => editingEnabled && columnWritable(column);
|
|
47
|
+
const off = (reason) => reason === null ? { disabled: false } : { disabled: true, disabledReason: reason };
|
|
48
|
+
const nothingToPaste = messages({ key: "views.grid.paste-empty" });
|
|
47
49
|
const cellItems = [];
|
|
48
50
|
if (menuColumn && !selecting && inActiveRange(rowKey, menuColumn.id)) {
|
|
49
51
|
const clipboard = getGridClipboard();
|
|
@@ -54,23 +56,23 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
54
56
|
onClick: onRangeCopy,
|
|
55
57
|
});
|
|
56
58
|
if (editingEnabled) {
|
|
57
|
-
const
|
|
59
|
+
const clearOff = off(rangeCanClear() ? null : messages({ key: "views.menus.range-not-clearable" }));
|
|
58
60
|
cellItems.push({
|
|
59
61
|
label: cutLabel,
|
|
60
62
|
icon: _jsx(icons.cut, { className: "h-4 w-4" }),
|
|
61
63
|
shortcut: "⌘X",
|
|
62
|
-
|
|
64
|
+
...clearOff,
|
|
63
65
|
onClick: onRangeCut,
|
|
64
66
|
}, {
|
|
65
67
|
label: pasteLabel,
|
|
66
68
|
icon: _jsx(icons.paste, { className: "h-4 w-4" }),
|
|
67
69
|
shortcut: "⌘V",
|
|
68
|
-
|
|
70
|
+
...off(clipboard ? null : nothingToPaste),
|
|
69
71
|
onClick: onRangePaste,
|
|
70
72
|
}, {
|
|
71
73
|
label: clearLabel,
|
|
72
74
|
icon: _jsx(icons.clear, { className: "h-4 w-4" }),
|
|
73
|
-
|
|
75
|
+
...clearOff,
|
|
74
76
|
onClick: onRangeClear,
|
|
75
77
|
});
|
|
76
78
|
}
|
|
@@ -79,7 +81,11 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
79
81
|
else if (menuColumn && !selecting) {
|
|
80
82
|
const unit = menuColumn.editUnit?.value(row);
|
|
81
83
|
const canWrite = canEdit(menuColumn);
|
|
82
|
-
const canClear = canWrite && !!menuColumn.clearable;
|
|
84
|
+
const canClear = canWrite && (!!menuColumn.clearable || gridBooleanMode(menuColumn) != null);
|
|
85
|
+
const editRefusal = canWrite
|
|
86
|
+
? null
|
|
87
|
+
: (columnEditRefusal(menuColumn, conventions, messages) ?? messages({ key: "views.grid.cell-read-only" }));
|
|
88
|
+
const clearOff = off(editRefusal ?? (canClear ? null : columnClearRefusal(menuColumn, messages)));
|
|
83
89
|
const clipboard = getGridClipboard();
|
|
84
90
|
const paste = canWrite && clipboard && !clipboard.matrix
|
|
85
91
|
? coercePaste(menuColumn, clipboard, {
|
|
@@ -102,7 +108,7 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
102
108
|
label: cutLabel,
|
|
103
109
|
icon: _jsx(icons.cut, { className: "h-4 w-4" }),
|
|
104
110
|
shortcut: "⌘X",
|
|
105
|
-
|
|
111
|
+
...clearOff,
|
|
106
112
|
onClick: () => {
|
|
107
113
|
void copyCell(ports.clipboard.writeText, menuColumn, editBaseline(menuColumn), unit);
|
|
108
114
|
onCommitCell(row, id, menuColumn.id, cellClearPrev(menuColumn, row, pendingByCol), "");
|
|
@@ -111,7 +117,9 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
111
117
|
label: pasteLabel,
|
|
112
118
|
icon: _jsx(icons.paste, { className: "h-4 w-4" }),
|
|
113
119
|
shortcut: "⌘V",
|
|
114
|
-
|
|
120
|
+
...off(clipboard?.matrix
|
|
121
|
+
? null
|
|
122
|
+
: (editRefusal ?? (!clipboard ? nothingToPaste : paste && !paste.ok ? paste.reason : null))),
|
|
115
123
|
onClick: () => {
|
|
116
124
|
if (clipboard?.matrix) {
|
|
117
125
|
onPasteAtCell(rowKey, menuColumn.id);
|
|
@@ -123,7 +131,7 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
123
131
|
}, {
|
|
124
132
|
label: clearLabel,
|
|
125
133
|
icon: _jsx(icons.clear, { className: "h-4 w-4" }),
|
|
126
|
-
|
|
134
|
+
...clearOff,
|
|
127
135
|
onClick: () => onCommitCell(row, id, menuColumn.id, cellClearPrev(menuColumn, row, pendingByCol), ""),
|
|
128
136
|
});
|
|
129
137
|
}
|
|
@@ -7,6 +7,7 @@ import type { ListDateStyleOverrides, ListDurationStyleOverrides, ListNumberForm
|
|
|
7
7
|
import type { ListRowIconAccessor } from "../../model/row-icon.js";
|
|
8
8
|
import type { GridRowRangeSpan } from "../core/useGridRange.js";
|
|
9
9
|
import type { GridCellPos } from "../core/coordinates.js";
|
|
10
|
+
import type { GridWriteState } from "../core/write-states.js";
|
|
10
11
|
export type GridRowProps<Row> = {
|
|
11
12
|
row: Row;
|
|
12
13
|
/** The DATA id — what a write, the optimistic overlay and selection address.
|
|
@@ -39,8 +40,8 @@ export type GridRowProps<Row> = {
|
|
|
39
40
|
deleteLabel?: string;
|
|
40
41
|
/** Per-row actions in the title cell's hover lane, before the built-in Edit. */
|
|
41
42
|
rowActions?: ListCellAction<Row>[];
|
|
42
|
-
/** Leading ICON at the START of the title cell — a
|
|
43
|
-
*
|
|
43
|
+
/** Leading ICON at the START of the title cell — a glyph, or the row's picture
|
|
44
|
+
* through the app's Avatar atom (see GridTableProps.rowIcon). Undefined = the user
|
|
44
45
|
* turned the "Row icon" toggle off, or the list has no icon to draw. */
|
|
45
46
|
rowIcon?: ListRowIconAccessor<Row>;
|
|
46
47
|
verticalBorders?: boolean;
|
|
@@ -64,6 +65,9 @@ export type GridRowProps<Row> = {
|
|
|
64
65
|
/** columnId → `requested` for a pending value saved here but not yet accepted
|
|
65
66
|
* by the provider that owns it (spec §11.2) — drawn as the cell's pending state. */
|
|
66
67
|
settlementByCol?: Record<string, "requested">;
|
|
68
|
+
/** columnId → where the cell's writes stand (`data-pending`, `data-invalid`); undefined when no cell of this row
|
|
69
|
+
* has one. Kept the same object while this row's cells don't change, so the memoized row doesn't redraw. */
|
|
70
|
+
writeStateByCol?: Readonly<Record<string, GridWriteState>>;
|
|
67
71
|
/** columnId → option values for status/select editors (declared + discovered).
|
|
68
72
|
* One memo-stable object shared by every row. */
|
|
69
73
|
selectValues?: Record<string, string[]>;
|
|
@@ -25,6 +25,13 @@ export type GridRowWindowStore = {
|
|
|
25
25
|
/** Marks one row as revealed (kept drawn) and clears the last one. */
|
|
26
26
|
reveal(place: GridRowPlace | null): void;
|
|
27
27
|
subscribe(groupKey: string, listener: () => void): () => void;
|
|
28
|
+
/** Watches an undrawn stretch (a spacer) for as long as it is drawn: the row window redraws when one reaches the
|
|
29
|
+
* screen. Returns its unwatch. */
|
|
30
|
+
watchGap(gap: Element): () => void;
|
|
31
|
+
/** The observer that watches the spacers, or null while none runs: it is handed every spacer drawn now and later.
|
|
32
|
+
* Handed the same observer again, it watches every spacer afresh, so each reports where it stands on the next
|
|
33
|
+
* frame. */
|
|
34
|
+
setGapObserver(observer: IntersectionObserver | null): void;
|
|
28
35
|
};
|
|
29
36
|
export declare function createGridRowWindowStore(): GridRowWindowStore;
|
|
30
37
|
export declare const GridRowWindowContext: import("react").Context<GridRowWindowStore | null>;
|
|
@@ -11,6 +11,8 @@ export function createGridRowWindowStore() {
|
|
|
11
11
|
const snapshots = new Map();
|
|
12
12
|
const listeners = new Map();
|
|
13
13
|
let revealed = null;
|
|
14
|
+
const gaps = new Set();
|
|
15
|
+
let gapObserver = null;
|
|
14
16
|
const notify = (groupKey) => {
|
|
15
17
|
for (const listener of listeners.get(groupKey) ?? [])
|
|
16
18
|
listener();
|
|
@@ -61,6 +63,23 @@ export function createGridRowWindowStore() {
|
|
|
61
63
|
set.delete(listener);
|
|
62
64
|
};
|
|
63
65
|
},
|
|
66
|
+
watchGap(gap) {
|
|
67
|
+
gaps.add(gap);
|
|
68
|
+
gapObserver?.observe(gap);
|
|
69
|
+
return () => {
|
|
70
|
+
gaps.delete(gap);
|
|
71
|
+
gapObserver?.unobserve(gap);
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
setGapObserver(observer) {
|
|
75
|
+
if (observer && observer === gapObserver)
|
|
76
|
+
for (const gap of gaps)
|
|
77
|
+
observer.unobserve(gap);
|
|
78
|
+
gapObserver = observer;
|
|
79
|
+
if (observer)
|
|
80
|
+
for (const gap of gaps)
|
|
81
|
+
observer.observe(gap);
|
|
82
|
+
},
|
|
64
83
|
};
|
|
65
84
|
}
|
|
66
85
|
export const GridRowWindowContext = createContext(null);
|
|
@@ -206,11 +225,24 @@ export function useGridRowWindow({ rootRef, flat, rowHeight, recorderRef, boxes
|
|
|
206
225
|
});
|
|
207
226
|
view.observe(area);
|
|
208
227
|
}
|
|
228
|
+
let gaps = null;
|
|
229
|
+
if (typeof IntersectionObserver !== "undefined") {
|
|
230
|
+
gaps = new IntersectionObserver((entries) => {
|
|
231
|
+
if (!entries.some((entry) => entry.isIntersecting))
|
|
232
|
+
return;
|
|
233
|
+
measure();
|
|
234
|
+
if (apply(ranges()))
|
|
235
|
+
store.setGapObserver(gaps);
|
|
236
|
+
});
|
|
237
|
+
store.setGapObserver(gaps);
|
|
238
|
+
}
|
|
209
239
|
return () => {
|
|
210
240
|
document.removeEventListener("scroll", onScroll, { capture: true });
|
|
211
241
|
window.removeEventListener("resize", onScroll);
|
|
212
242
|
observer?.disconnect();
|
|
213
243
|
view?.disconnect();
|
|
244
|
+
store.setGapObserver(null);
|
|
245
|
+
gaps?.disconnect();
|
|
214
246
|
};
|
|
215
247
|
}, [content, measure, ranges, rootRef, store, recorderRef, boxes]);
|
|
216
248
|
const revealRow = useCallback((rowKey, columnId) => {
|
|
@@ -229,13 +261,15 @@ export function useGridRowWindow({ rootRef, flat, rowHeight, recorderRef, boxes
|
|
|
229
261
|
export const GRID_GAP_LINES = "repeating-linear-gradient(to bottom, transparent 0 calc(var(--vk-row-h) - 1px), var(--vk-border-subtle) calc(var(--vk-row-h) - 1px) var(--vk-row-h))";
|
|
230
262
|
export function GridWindowRows({ groupKey, items, collapsed, kept, renderRow, ...container }) {
|
|
231
263
|
const snapshot = useGridGroupWindow(groupKey);
|
|
264
|
+
const store = useContext(GridRowWindowContext);
|
|
265
|
+
const watchGap = useCallback((gap) => (gap && store ? store.watchGap(gap) : undefined), [store]);
|
|
232
266
|
const range = snapshot.range === undefined ? fallbackRange(items.length, collapsed) : snapshot.range;
|
|
233
267
|
const { revealed } = snapshot;
|
|
234
268
|
const segments = gridRowSegments(items.length, range, revealed == null ? kept : [...kept, revealed]);
|
|
235
269
|
const children = [];
|
|
236
270
|
for (const segment of segments) {
|
|
237
271
|
if (segment.kind === "gap") {
|
|
238
|
-
children.push(_jsx("div", { "data-slot": "vk-grid-gap", "aria-hidden": true, style: { height: `calc(var(--vk-row-h) * ${segment.end - segment.start})`, background: GRID_GAP_LINES } }, `gap-${segment.end}`));
|
|
272
|
+
children.push(_jsx("div", { ref: watchGap, "data-slot": "vk-grid-gap", "aria-hidden": true, style: { height: `calc(var(--vk-row-h) * ${segment.end - segment.start})`, background: GRID_GAP_LINES } }, `gap-${segment.end}`));
|
|
239
273
|
continue;
|
|
240
274
|
}
|
|
241
275
|
for (let index = segment.start; index < segment.end; index++) {
|