@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
|
@@ -28,9 +28,12 @@ export declare const GRID_CELL_HOVER_SHADOW = "hover:shadow-[0_1px_2px_rgb(0_0_0
|
|
|
28
28
|
* redraw. Applied to the cell by `gridCellClassName`, gated with
|
|
29
29
|
* GRID_CELL_HOVER_SHADOW: the line and the lift always appear together.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* The corners are `--vk-outline-radius`, shared with the selection ring so an
|
|
32
|
+
* app that straightens one straightens both; undeclared, the app's own
|
|
33
|
+
* `--radius-sm`, exactly what `rounded-sm` drew (a softened rectangle, 4px in
|
|
34
|
+
* the portal). Not a larger named radius: on a 37px-tall cell that reads as a
|
|
35
|
+
* lozenge. The line's colour is `--vk-outline-hover`, undeclared the strong
|
|
36
|
+
* line rung below.
|
|
34
37
|
*
|
|
35
38
|
* The outward shadow is on the cell itself (GRID_CELL_HOVER_SHADOW), not here:
|
|
36
39
|
* this ring sits at inset-0, exactly the cell's padding box, and a resting cell
|
|
@@ -42,7 +45,7 @@ export declare const GRID_CELL_HOVER_SHADOW = "hover:shadow-[0_1px_2px_rgb(0_0_0
|
|
|
42
45
|
* hovered cell reads as an edge among hairlines. This ring is the token's only
|
|
43
46
|
* consumer (hairlines ratchet).
|
|
44
47
|
*/
|
|
45
|
-
export declare const GRID_CELL_HOVER_RING = "hover:after:pointer-events-none hover:after:absolute hover:after:inset-0 hover:after:z-1 hover:after:rounded-sm hover:after:border hover:after:border-(color:--vk-border-bold)";
|
|
48
|
+
export declare const GRID_CELL_HOVER_RING = "hover:after:pointer-events-none hover:after:absolute hover:after:inset-0 hover:after:z-1 hover:after:rounded-(--vk-outline-radius,var(--radius-sm)) hover:after:border hover:after:border-(color:--vk-outline-hover,var(--vk-border-bold))";
|
|
46
49
|
/** The selection ring, in the same geometry the hover ring draws. */
|
|
47
50
|
export declare function GridCellOutline({ editing, }: {
|
|
48
51
|
/** Lifts the cell with a drop shadow to read as a live input. */
|
|
@@ -20,7 +20,9 @@ export function gridFrozenBg(selected, on) {
|
|
|
20
20
|
: cx(GRID_GROUND, GRID_FROZEN_HOVER);
|
|
21
21
|
}
|
|
22
22
|
export const GRID_CELL_HOVER_SHADOW = "hover:shadow-[0_1px_2px_rgb(0_0_0/0.05)] dark:hover:shadow-[0_1px_2px_rgb(0_0_0/0.22)]";
|
|
23
|
-
export const GRID_CELL_HOVER_RING = "hover:after:pointer-events-none hover:after:absolute hover:after:inset-0 hover:after:z-1 hover:after:rounded-sm hover:after:border hover:after:border-(color:--vk-border-bold)";
|
|
23
|
+
export const GRID_CELL_HOVER_RING = "hover:after:pointer-events-none hover:after:absolute hover:after:inset-0 hover:after:z-1 hover:after:rounded-(--vk-outline-radius,var(--radius-sm)) hover:after:border hover:after:border-(color:--vk-outline-hover,var(--vk-border-bold))";
|
|
24
24
|
export function GridCellOutline({ editing = false, }) {
|
|
25
|
-
return (_jsx("span", { "aria-hidden": true, "data-slot": "vk-grid-outline", className: cx("pointer-events-none absolute inset-0 z-1 rounded-
|
|
25
|
+
return (_jsx("span", { "aria-hidden": true, "data-slot": "vk-grid-outline", className: cx("pointer-events-none absolute inset-0 z-1 rounded-(--vk-outline-radius,var(--radius-sm)) border", editing
|
|
26
|
+
? "border-(color:--vk-outline-active,var(--vk-border-brand))"
|
|
27
|
+
: "border-(color:--vk-outline,var(--vk-fg-subtle)) group-hover/gridcell:border-(color:--vk-outline-active,var(--vk-border-brand))", editing && "shadow-lg shadow-black/20 dark:shadow-black/50") }));
|
|
26
28
|
}
|
|
@@ -8,7 +8,9 @@ import { prettifyOptionValue } from "../../model/column-state.js";
|
|
|
8
8
|
import { optionValues } from "@viewkitjs/fields";
|
|
9
9
|
import { offeredValues, takesNewValues, useOpenValues } from "../../editors/open-values.js";
|
|
10
10
|
import { useGridEditSession } from "./grid-edit-session.js";
|
|
11
|
+
import { useBodyPanel } from "../../editors/body-panel.js";
|
|
11
12
|
export function GridChipsEditor({ column, title, values, suggestions, optionColors, refuse, onCommit, onCancel, onTab, }) {
|
|
13
|
+
const panel = useBodyPanel("picker", "w-64", "z-90");
|
|
12
14
|
const editorRef = useRef(null);
|
|
13
15
|
const anchorRef = useRef(null);
|
|
14
16
|
const { session, close } = useGridEditSession({
|
|
@@ -31,5 +33,5 @@ export function GridChipsEditor({ column, title, values, suggestions, optionColo
|
|
|
31
33
|
label: column.options?.find((option) => option.value === value)?.label ?? prettifyOptionValue(value),
|
|
32
34
|
color: resolveCategoryColor(value, column.options, optionColors),
|
|
33
35
|
});
|
|
34
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, panelData: { "data-slot": "vk-grid-editor" }, onPanelClick: (event) => event.stopPropagation(), chrome: "menu", className:
|
|
36
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, panelData: { "data-slot": "vk-grid-editor", ...panel.data }, onPanelClick: (event) => event.stopPropagation(), chrome: "menu", className: panel.className, children: _jsx(ChipsEditor, { ref: editorRef, values: values, suggestions: offered, resolve: resolve, normalize: column.chips?.normalize, creatable: open, onRequestClose: close, label: typeof title === "string" ? title : undefined }) })] }));
|
|
35
37
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type MouseEvent as ReactMouseEvent, type ReactElement, type ReactNode, type Ref } from "react";
|
|
2
2
|
import type { PercentDisplay } from "@viewkitjs/fields";
|
|
3
|
-
import type {
|
|
3
|
+
import type { SortDirection } from "@viewkitjs/fields/query";
|
|
4
4
|
import type { ListColumn, ListSelectColor } from "../../model/column-schema.js";
|
|
5
5
|
import type { ListDateStyle, ListDurationStyle, ListNumberFormatState } from "../../model/column-format.js";
|
|
6
6
|
import type { ViewsMenuItem } from "../../provider/components.js";
|
|
@@ -12,15 +12,17 @@ type TriggerProps = {
|
|
|
12
12
|
role?: "button" | "columnheader";
|
|
13
13
|
"aria-haspopup"?: "dialog" | "menu";
|
|
14
14
|
"aria-expanded"?: boolean;
|
|
15
|
+
/** The contract's `open` state: present while the menu is open. */
|
|
16
|
+
"data-open"?: "";
|
|
15
17
|
};
|
|
16
18
|
/** The list's sort state, threaded from its controller — the menu is a second
|
|
17
19
|
* remote control for the SAME persisted sort the view-options popover drives. */
|
|
18
20
|
export type GridSortState = {
|
|
19
21
|
value: string;
|
|
20
|
-
dir:
|
|
22
|
+
dir: SortDirection;
|
|
21
23
|
onChange: (next: {
|
|
22
24
|
value: string;
|
|
23
|
-
dir:
|
|
25
|
+
dir: SortDirection;
|
|
24
26
|
}) => void;
|
|
25
27
|
};
|
|
26
28
|
/** The view's group, as the header asks it: which field, and a writer that
|
|
@@ -40,7 +42,8 @@ export declare function gridColumnMenuEnabled<Row>(col: ListColumn<Row>): boolea
|
|
|
40
42
|
* order, every block derived and none by hand:
|
|
41
43
|
*
|
|
42
44
|
* - Sort is offered where `effectiveSortKey` names a key (a declared
|
|
43
|
-
* `sortKey`, or the field itself on a saved view)
|
|
45
|
+
* `sortKey`, or the field itself on a saved view), or, for a place, by
|
|
46
|
+
* each of its parts (`columnSortParts`), flying out beside the menu. Clear sort appears only
|
|
44
47
|
* while this column IS the sort.
|
|
45
48
|
* - Group by is offered on a saved view for a field whose type groups
|
|
46
49
|
* (`columnGroupable`, the rule the toolbar's Group menu reads too); Ungroup
|
|
@@ -11,7 +11,7 @@ import { GridColumnDateSection } from "./GridColumnDateSection.js";
|
|
|
11
11
|
import { GridColumnDurationSection } from "./GridColumnDurationSection.js";
|
|
12
12
|
import { GridColumnNumberSection } from "./GridColumnNumberSection.js";
|
|
13
13
|
import { GridColumnPercentSection } from "./GridColumnPercentSection.js";
|
|
14
|
-
import { GridColumnSortSection } from "./GridColumnSortSection.js";
|
|
14
|
+
import { GridColumnSortPartsSection, GridColumnSortSection } from "./GridColumnSortSection.js";
|
|
15
15
|
import { insideGridFlyout, useGridFlyouts } from "./GridFlyout.js";
|
|
16
16
|
import { GridMenuRow, GridMenuSeparator } from "./GridMenuRow.js";
|
|
17
17
|
import { gridMenuArrows, useGridMenuFocus, useGridMenuPress } from "./grid-menu-focus.js";
|
|
@@ -44,7 +44,7 @@ export function GridColumnMenu({ column, values, viewBacked = false, sort, group
|
|
|
44
44
|
onMoveRight,
|
|
45
45
|
};
|
|
46
46
|
const gates = columnMenuGates(column, offer);
|
|
47
|
-
const { key, sortKey, sortable, groupable, grouped, canPercent, canDate, canDuration, canDecimals, canCurrency } = gates;
|
|
47
|
+
const { key, sortKey, sortParts, sortable, groupable, grouped, canPercent, canDate, canDuration, canDecimals, canCurrency } = gates;
|
|
48
48
|
const { canColor, canMove, canKnobs } = gates;
|
|
49
49
|
const knobs = columnKnobs(column);
|
|
50
50
|
const close = () => {
|
|
@@ -85,6 +85,7 @@ export function GridColumnMenu({ column, values, viewBacked = false, sort, group
|
|
|
85
85
|
role: children.props.role ?? "button",
|
|
86
86
|
"aria-haspopup": "menu",
|
|
87
87
|
"aria-expanded": open,
|
|
88
|
+
"data-open": open ? "" : undefined,
|
|
88
89
|
});
|
|
89
90
|
return (_jsxs(_Fragment, { children: [menuTrigger, _jsx(Menu, { open: open, onOpenChange: handleOpenChange, anchor: anchor, side: "bottom", align: "start", label: messages({ key: "views.menus.column-menu", values: { field: columnLabel(column) } }), items: items })] }));
|
|
90
91
|
}
|
|
@@ -118,8 +119,9 @@ export function GridColumnMenu({ column, values, viewBacked = false, sort, group
|
|
|
118
119
|
role: children.props.role ?? "button",
|
|
119
120
|
"aria-haspopup": "dialog",
|
|
120
121
|
"aria-expanded": open,
|
|
122
|
+
"data-open": open ? "" : undefined,
|
|
121
123
|
});
|
|
122
|
-
return (_jsxs(_Fragment, { children: [trigger, _jsx(Popover, { open: open, onOpenChange: handleOpenChange, anchor: anchor, side: "bottom", align: "start", sideOffset: 2, initialFocus: menuFocus.initialFocus, chrome: "menu", panelData: { "data-slot": "vk-grid-column-menu" }, className: "w-52", onOutsidePress: (event) => anchor?.contains(event.target) || insideGridFlyout(event) ? false : undefined, children: _jsx("div", { onPointerOver: flyouts.onListPointerOver, onKeyDown: gridMenuArrows, children: _jsxs(List, { children: [sortable && (_jsxs(_Fragment, { children: [divider(0), _jsx(GridColumnSortSection, { sortKey: sortKey, value: sort.value, dir: sort.dir, onChange: sort.onChange, onClose: close })] })), groupable && (_jsxs(_Fragment, { children: [divider(1), grouped ? (_jsx(GridMenuRow, { label: messages({ key: "views.menus.ungroup" }), icon: "group", active: true, onClick: () => {
|
|
124
|
+
return (_jsxs(_Fragment, { children: [trigger, _jsx(Popover, { open: open, onOpenChange: handleOpenChange, anchor: anchor, side: "bottom", align: "start", sideOffset: 2, initialFocus: menuFocus.initialFocus, chrome: "menu", panelData: { "data-slot": "vk-grid-column-menu" }, className: "w-52", onOutsidePress: (event) => anchor?.contains(event.target) || insideGridFlyout(event) ? false : undefined, children: _jsx("div", { onPointerOver: flyouts.onListPointerOver, onKeyDown: gridMenuArrows, children: _jsxs(List, { children: [sortable && (_jsxs(_Fragment, { children: [divider(0), sortParts.length > 0 ? (_jsx(GridColumnSortPartsSection, { fieldKey: column.field.key, parts: sortParts, value: sort.value, dir: sort.dir, onChange: sort.onChange, flyouts: flyouts, onClose: close })) : (_jsx(GridColumnSortSection, { sortKey: sortKey, value: sort.value, dir: sort.dir, onChange: sort.onChange, onClose: close }))] })), groupable && (_jsxs(_Fragment, { children: [divider(1), grouped ? (_jsx(GridMenuRow, { label: messages({ key: "views.menus.ungroup" }), icon: "group", active: true, onClick: () => {
|
|
123
125
|
groupBy.onChange(null);
|
|
124
126
|
close();
|
|
125
127
|
} })) : (_jsx(GridMenuRow, { label: messages({
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SortDirection } from "@viewkitjs/fields/query";
|
|
2
|
+
import { type GridFlyouts } from "./GridFlyout.js";
|
|
3
|
+
/**
|
|
4
|
+
* A place column's sort rows in the header menu: ascending and descending each fly out its parts, the part
|
|
5
|
+
* in force the row's detail, and Clear sort while this column sorts by any of them. A pick writes the part key
|
|
6
|
+
* (`partKey(fieldKey, part)`), which a host reads with `parsePartKey`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function GridColumnSortPartsSection({ fieldKey, parts, value, dir, onChange, flyouts, onClose, }: {
|
|
9
|
+
/** The place's field key: the part key's whole. */
|
|
10
|
+
fieldKey: string;
|
|
11
|
+
/** The parts this column sorts by (`columnSortParts`). */
|
|
12
|
+
parts: readonly string[];
|
|
13
|
+
value: string;
|
|
14
|
+
dir: SortDirection;
|
|
15
|
+
onChange: (next: {
|
|
16
|
+
value: string;
|
|
17
|
+
dir: SortDirection;
|
|
18
|
+
}) => void;
|
|
19
|
+
flyouts: GridFlyouts;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
2
22
|
/**
|
|
3
23
|
* The sort rows in the header menu — ascending, descending, and Clear sort
|
|
4
24
|
* while this column IS the sort. Split out of GridColumnMenu for the line
|
|
@@ -9,10 +29,10 @@ export declare function GridColumnSortSection({ sortKey, value, dir, onChange, o
|
|
|
9
29
|
sortKey: string;
|
|
10
30
|
/** The list's current sort key and direction. */
|
|
11
31
|
value: string;
|
|
12
|
-
dir:
|
|
32
|
+
dir: SortDirection;
|
|
13
33
|
onChange: (next: {
|
|
14
34
|
value: string;
|
|
15
|
-
dir:
|
|
35
|
+
dir: SortDirection;
|
|
16
36
|
}) => void;
|
|
17
37
|
onClose: () => void;
|
|
18
38
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { sortPartOf } from "../../model/column-sort.js";
|
|
4
|
+
import { partKey, partWord } from "../../model/part-rows.js";
|
|
3
5
|
import { useViews } from "../../provider/context.js";
|
|
4
|
-
import {
|
|
6
|
+
import { GridFlyoutRow } from "./GridFlyout.js";
|
|
7
|
+
import { GridMenuRow, KnobGlyph } from "./GridMenuRow.js";
|
|
8
|
+
export function GridColumnSortPartsSection({ fieldKey, parts, value, dir, onChange, flyouts, onClose, }) {
|
|
9
|
+
const { atoms, messages } = useViews();
|
|
10
|
+
const { Row } = atoms;
|
|
11
|
+
const active = sortPartOf(value, fieldKey, parts);
|
|
12
|
+
const word = (part) => partWord("location", part, messages) ?? part;
|
|
13
|
+
const direction = (next) => (_jsx(GridFlyoutRow, { id: `sort-${next}`, flyouts: flyouts, label: messages({ key: next === "asc" ? "views.menus.sort-asc" : "views.menus.sort-desc" }), detail: active !== undefined && dir === next ? word(active) : undefined, leading: _jsx(KnobGlyph, { name: next === "asc" ? "sortRowsUp" : "sortRowsDown" }), children: parts.map((part) => (_jsx(Row, { chosen: active === part && dir === next, label: word(part), onClick: () => {
|
|
14
|
+
onChange({ value: partKey(fieldKey, part), dir: next });
|
|
15
|
+
onClose();
|
|
16
|
+
} }, part))) }));
|
|
17
|
+
return (_jsxs(_Fragment, { children: [direction("asc"), direction("desc"), active !== undefined && (_jsx(GridMenuRow, { label: messages({ key: "views.menus.sort-clear" }), icon: "clearSort", onClick: () => {
|
|
18
|
+
onChange({ value: "", dir: "asc" });
|
|
19
|
+
onClose();
|
|
20
|
+
} }))] }));
|
|
21
|
+
}
|
|
5
22
|
export function GridColumnSortSection({ sortKey, value, dir, onChange, onClose, }) {
|
|
6
23
|
const { messages } = useViews();
|
|
7
24
|
const active = value === sortKey;
|
|
@@ -9,7 +9,7 @@ export declare function gridFooterShown({ interactive, hostCells, }: {
|
|
|
9
9
|
interactive: boolean;
|
|
10
10
|
hostCells: readonly ReactNode[];
|
|
11
11
|
}): boolean;
|
|
12
|
-
export declare function GridFooter<Row>({ group, columns, selecting, aggregates, numberFormats, renderAggregate, onAggregateChange, viewBacked, frozenCount, frozenLeft, continuation, defaultCurrency, ariaRowIndex, ariaLevel, ariaColOffset, }: {
|
|
12
|
+
export declare function GridFooter<Row>({ group, columns, selecting, aggregates, numberFormats, renderAggregate, onAggregateChange, viewBacked, frozenCount, frozenLeft, continuation, defaultCurrency, pageOnly, ariaRowIndex, ariaLevel, ariaColOffset, }: {
|
|
13
13
|
/** What a screen reader reads (`core/grid-aria.ts`): the row's number, its level in a tree grid, and the columns
|
|
14
14
|
* before the first data column (the checkbox lane). */
|
|
15
15
|
ariaRowIndex?: number;
|
|
@@ -30,4 +30,7 @@ export declare function GridFooter<Row>({ group, columns, selecting, aggregates,
|
|
|
30
30
|
continuation?: ReactNode;
|
|
31
31
|
/** The reader's default currency (the host's answer): a money column read in Original totals in it. */
|
|
32
32
|
defaultCurrency?: DisplayCurrency;
|
|
33
|
+
/** The rows are one page of a grid in pages: a figure the group does not carry in `figures` is not computed (a page's
|
|
34
|
+
* own sum is not the view's), and no column offers one. The row is still drawn, as without it. */
|
|
35
|
+
pageOnly?: boolean;
|
|
33
36
|
}): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
@@ -14,7 +14,7 @@ import { gridFocusOnPress } from "./useGridFocus.js";
|
|
|
14
14
|
export function gridFooterShown({ interactive, hostCells, }) {
|
|
15
15
|
return interactive || hostCells.some((cell) => cell != null);
|
|
16
16
|
}
|
|
17
|
-
export function GridFooter({ group, columns, selecting, aggregates, numberFormats, renderAggregate, onAggregateChange, viewBacked = false, frozenCount = 0, frozenLeft, continuation, defaultCurrency = DEFAULT_DISPLAY_CURRENCY, ariaRowIndex, ariaLevel, ariaColOffset = 0, }) {
|
|
17
|
+
export function GridFooter({ group, columns, selecting, aggregates, numberFormats, renderAggregate, onAggregateChange, viewBacked = false, frozenCount = 0, frozenLeft, continuation, defaultCurrency = DEFAULT_DISPLAY_CURRENCY, pageOnly = false, ariaRowIndex, ariaLevel, ariaColOffset = 0, }) {
|
|
18
18
|
const interactive = !!onAggregateChange;
|
|
19
19
|
const cellFormat = useCellFormat();
|
|
20
20
|
const { messages } = useViews();
|
|
@@ -25,8 +25,9 @@ export function GridFooter({ group, columns, selecting, aggregates, numberFormat
|
|
|
25
25
|
if (!gridFooterShown({ interactive, hostCells }))
|
|
26
26
|
return continuation;
|
|
27
27
|
const footer = (_jsxs("div", { "data-slot": "vk-grid-footer", "data-group-key": group.key, role: "row", "aria-rowindex": ariaRowIndex, "aria-level": ariaLevel, className: cx("grid grid-cols-(--vk-cols)", GRID_CONTENT_PAD), children: [_jsx(GridRailSpacer, { selecting: selecting }), columns.map((column, index) => {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
28
|
+
const pageOwn = pageOnly && !sourced;
|
|
29
|
+
const kind = pageOwn ? "none" : resolveAggregateKind(column, aggregates, sourced);
|
|
30
|
+
const columnInteractive = !pageOwn && interactive && (!viewBacked || column.field != null);
|
|
30
31
|
const host = hostCells[index];
|
|
31
32
|
const figure = host == null
|
|
32
33
|
? gridFigureValue({ column, group, kind, numberFormats, defaultCurrency, cellFormat })
|
|
@@ -35,7 +36,8 @@ export function GridFooter({ group, columns, selecting, aggregates, numberFormat
|
|
|
35
36
|
const label = host == null && kind !== "none" ? aggregateLabel(kind, messages) : null;
|
|
36
37
|
const suffix = figure?.suffix ?? null;
|
|
37
38
|
const frozen = index < frozenCount && !!frozenLeft;
|
|
38
|
-
const
|
|
39
|
+
const offers = value == null && columnInteractive;
|
|
40
|
+
const cell = (_jsx("div", { "data-slot": "vk-grid-footer-cell", "data-footcell": column.id, "data-empty": offers ? "" : undefined, role: "gridcell", "aria-colindex": ariaColOffset + index + 1, tabIndex: -1, onPointerDown: (event) => gridFocusOnPress(event, "[data-footcell]"), style: frozen ? { left: `calc(var(--vk-stick,1) * ${frozenLeft(index)} + var(--vk-hold-x,0px))` } : undefined, className: cx("group/gridagg flex h-(--vk-footer-h) min-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap px-(--vk-px)", GRID_CHROME_FOCUS, column.align === "right" && "justify-end", column.align === "center" && "justify-center", columnInteractive && "cursor-pointer select-none hover:bg-(color:--vk-hovered)", frozen ? cx("[position:var(--vk-pin,sticky)] z-7", GRID_GROUND) : "relative"), children: value != null ? (_jsxs(_Fragment, { children: [label && (_jsx("span", { "data-slot": "vk-grid-figure-label", className: "text-(length:--vk-text-10) uppercase tracking-wide text-(color:--vk-fg-subtlest)", children: label })), _jsxs("span", { "data-slot": "vk-grid-figure-value", className: "text-(length:--vk-text) font-medium tabular-nums", children: [value, suffix && _jsx(CellSuffix, { children: suffix })] })] })) : offers ? (_jsx("span", { "data-slot": "vk-grid-figure-pick", className: "text-(length:--vk-text-10) uppercase tracking-wide text-(color:--vk-fg-subtlest) opacity-0 group-hover/gridagg:opacity-100", children: messages({ key: "views.grid.figure-pick" }) })) : null }, column.id));
|
|
39
41
|
if (!columnInteractive)
|
|
40
42
|
return cell;
|
|
41
43
|
return (_jsx(GridAggregateMenu, { column: column, options: aggregateOptions(column, sourced), current: kind, onChange: (next) => onAggregateChange(column.id, next), align: column.align === "right" ? "end" : column.align === "center" ? "center" : "start", children: cell }, column.id));
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { SortDirection } from "@viewkitjs/fields/query";
|
|
3
3
|
import type { GridSortState } from "./GridColumnMenu.js";
|
|
4
4
|
import type { ListGroupSummaryPart } from "../../model/preferences.js";
|
|
5
5
|
import { type GridGroupMenuPart } from "./grid-group-menu-parts.js";
|
|
6
|
+
import { type GridGroupMenuSelect } from "./grid-group-menu-items.js";
|
|
6
7
|
/** A sortable column, mirrored from the list's SortConfig options. */
|
|
7
8
|
export type GridGroupSortOption = {
|
|
8
9
|
value: string;
|
|
9
10
|
label: string;
|
|
10
|
-
defaultDir?:
|
|
11
|
+
defaultDir?: SortDirection;
|
|
11
12
|
};
|
|
12
13
|
/**
|
|
13
14
|
* The group-header `…` menu — a second remote for the list's row sort (all
|
|
@@ -17,7 +18,10 @@ export type GridGroupSortOption = {
|
|
|
17
18
|
* `menus`), the map's Menu with those choices beside it and no search. Clicks
|
|
18
19
|
* stop propagation so the group's collapse toggle stays put.
|
|
19
20
|
*/
|
|
20
|
-
export declare function GridGroupMenu({ sort, sortOptions, summary, onSummaryChange, figures, onHide, groupMenu, }: {
|
|
21
|
+
export declare function GridGroupMenu({ sort, sortOptions, summary, onSummaryChange, figures, onHide, groupMenu, select, }: {
|
|
22
|
+
/** The group's Select all in group, where the grid selects rows: whether all its rows are picked, and the pick.
|
|
23
|
+
* Drawn only when `groupMenu` names `"select"`. */
|
|
24
|
+
select?: GridGroupMenuSelect;
|
|
21
25
|
/** Which parts the menu holds (`groupMenuParts`). Absent: sort and Hide as given, the figure toggles with them,
|
|
22
26
|
* and, on the `popover` route, a search past eight sort choices. */
|
|
23
27
|
groupMenu?: readonly GridGroupMenuPart[];
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx,
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useRef, useState } from "react";
|
|
4
4
|
import { useViews } from "../../provider/context.js";
|
|
5
5
|
import { cx } from "../../internal/cx.js";
|
|
6
|
-
import {
|
|
6
|
+
import { drawGridButton } from "./grid-button.js";
|
|
7
7
|
import { GridMenuRow, GridMenuSeparator } from "./GridMenuRow.js";
|
|
8
8
|
import { matchMenuOptions } from "./grid-menu-search.js";
|
|
9
9
|
import { groupMenuParts } from "./grid-group-menu-parts.js";
|
|
10
10
|
import { GRID_CHROME_FOCUS } from "./grid-styles.js";
|
|
11
11
|
import { gridMenuArrows, gridMenuSearchArrows, useGridMenuFocus, useGridMenuPress } from "./grid-menu-focus.js";
|
|
12
12
|
import { gridGroupMenuItems } from "./grid-group-menu-items.js";
|
|
13
|
+
const GROUP_MORE_REVEAL = "md:opacity-0 md:group-hover/gridlabel:opacity-100 aria-expanded:opacity-100 md:focus-visible:opacity-100";
|
|
13
14
|
const EYEBROW = "px-2 pb-1 pt-2 text-[11px] font-medium uppercase tracking-wide text-(color:--vk-fg-subtle)";
|
|
14
|
-
export function GridGroupMenu({ sort, sortOptions, summary, onSummaryChange, figures = [], onHide, groupMenu, }) {
|
|
15
|
+
export function GridGroupMenu({ sort, sortOptions, summary, onSummaryChange, figures = [], onHide, groupMenu, select, }) {
|
|
15
16
|
const [open, setOpen] = useState(false);
|
|
16
17
|
const [anchor, setAnchor] = useState(null);
|
|
17
18
|
const menuFocus = useGridMenuFocus(open, anchor);
|
|
18
19
|
const press = useGridMenuPress(open);
|
|
19
20
|
const rowsBox = useRef(null);
|
|
20
21
|
const searchField = useRef(null);
|
|
21
|
-
const
|
|
22
|
+
const views = useViews();
|
|
23
|
+
const { atoms, components, icons, messages, menus } = views;
|
|
22
24
|
const { Popover, Command, Menu } = components;
|
|
23
25
|
const { List, Row, RowContent } = atoms;
|
|
24
26
|
const More = icons.more;
|
|
@@ -34,6 +36,7 @@ export function GridGroupMenu({ sort, sortOptions, summary, onSummaryChange, fig
|
|
|
34
36
|
figureCount: figures.length,
|
|
35
37
|
canToggleFigures: !!onSummaryChange,
|
|
36
38
|
canHide: !!onHide,
|
|
39
|
+
canSelect: !!select,
|
|
37
40
|
});
|
|
38
41
|
const offered = parts.sort ? sortOptions : [];
|
|
39
42
|
const searchable = parts.command;
|
|
@@ -56,7 +59,14 @@ export function GridGroupMenu({ sort, sortOptions, summary, onSummaryChange, fig
|
|
|
56
59
|
return (_jsx(Glyph, { className: cx("size-3.5", active ? "text-(color:--vk-fg-brand)" : "text-(color:--vk-fg-subtlest)") }));
|
|
57
60
|
};
|
|
58
61
|
const menuRoute = (menus ?? "popover") === "menu";
|
|
59
|
-
return (_jsxs(_Fragment, { children: [
|
|
62
|
+
return (_jsxs(_Fragment, { children: [drawGridButton(views, {
|
|
63
|
+
ref: setAnchor,
|
|
64
|
+
tabIndex: -1,
|
|
65
|
+
"aria-label": messages({ key: "views.menus.group-options" }),
|
|
66
|
+
"aria-haspopup": menuRoute ? "menu" : "dialog",
|
|
67
|
+
"aria-expanded": open,
|
|
68
|
+
onPointerDownCapture: menuRoute ? press.notePress : undefined,
|
|
69
|
+
onClick: (e) => {
|
|
60
70
|
e.stopPropagation();
|
|
61
71
|
if ((menuRoute && press.pressedOpen(e)) || open)
|
|
62
72
|
close();
|
|
@@ -64,9 +74,21 @@ export function GridGroupMenu({ sort, sortOptions, summary, onSummaryChange, fig
|
|
|
64
74
|
menuFocus.noteOpen(e);
|
|
65
75
|
setOpen(true);
|
|
66
76
|
}
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
|
|
77
|
+
},
|
|
78
|
+
own: cx("inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-(color:--vk-fg-subtle)", "transition-opacity hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)", GROUP_MORE_REVEAL, GRID_CHROME_FOCUS),
|
|
79
|
+
frame: cx("h-6 w-6 shrink-0 transition-opacity", GROUP_MORE_REVEAL),
|
|
80
|
+
variant: "ghost",
|
|
81
|
+
size: "icon",
|
|
82
|
+
children: _jsx(More, { className: "h-3.5 w-3.5" }),
|
|
83
|
+
}), menuRoute ? (_jsx("span", { className: "contents", onClick: (e) => e.stopPropagation(), children: _jsx(Menu, { open: open, onOpenChange: (next) => (next ? setOpen(true) : close()), anchor: anchor, side: "bottom", align: "start", label: messages({ key: "views.menus.group-options" }), items: open
|
|
84
|
+
? gridGroupMenuItems(parts, { ...(sort && { sort }), sortOptions: offered, ...(summary && { summary }), ...(onSummaryChange && { onSummaryChange }), figures, ...(onHide && { onHide }), ...(select && { select }) }, { messages, icons, close })
|
|
85
|
+
: [] }) })) : (_jsx(Popover, { open: open, onOpenChange: (next) => (next ? setOpen(true) : close()), anchor: anchor, side: "bottom", align: "start", sideOffset: 4, initialFocus: menuFocus.initialFocus, chrome: "menu", panelData: { "data-slot": "vk-grid-group-menu" }, onPanelClick: (e) => e.stopPropagation(), className: "w-52", onOutsidePress: (event) => (anchor?.contains(event.target) ? false : undefined), children: _jsx("div", { ref: rowsBox, onKeyDown: (e) => gridMenuArrows(e, searchField.current), children: _jsxs(List, { children: [parts.select && select && (_jsxs(_Fragment, { children: [_jsx(GridMenuRow, { label: messages({
|
|
86
|
+
key: "views.menus.group-select",
|
|
87
|
+
values: { selected: select.allSelected ? "true" : "false" },
|
|
88
|
+
}), icon: "selectRow", onClick: () => {
|
|
89
|
+
select.onToggle();
|
|
90
|
+
close();
|
|
91
|
+
} }), (parts.sort || parts.figures || parts.hide) && _jsx(GridMenuSeparator, {})] })), offered.length > 0 && _jsx("div", { className: EYEBROW, children: messages({ key: "views.menus.group-sort" }) }), searchable ? (_jsxs(Command.Root, { shouldFilter: false, loop: true, label: messages({ key: "views.menus.search" }), children: [_jsx(Command.Input, { ref: searchField, onKeyDown: (e) => gridMenuSearchArrows(e, rowsBox.current), value: query, onValueChange: setQuery, placeholder: messages({ key: "views.menus.search" }) }), _jsx(Command.List, { className: "max-h-64 overscroll-contain", children: _jsx(Command.Group, { className: "p-0", children: sorts.map((opt) => {
|
|
70
92
|
const active = sort.value === opt.value;
|
|
71
93
|
return (_jsx(Command.Item, { value: opt.value, onSelect: () => pick(opt), chosen: active, children: _jsx(RowContent, { label: opt.label, leading: sortGlyph(opt), chosen: active }) }, opt.value));
|
|
72
94
|
}) }) })] })) : (sorts.map((opt) => (_jsx(Row, { chosen: sort.value === opt.value, label: opt.label, leading: sortGlyph(opt), onClick: () => pick(opt) }, opt.value)))), parts.figures && onSummaryChange && (_jsxs(_Fragment, { children: [offered.length > 0 && _jsx(GridMenuSeparator, {}), _jsx("div", { className: EYEBROW, children: messages({ key: "views.menus.group-show" }) }), [
|
|
@@ -8,7 +8,7 @@ import { type GridGroupByState, type GridSortState } from "./GridColumnMenu.js";
|
|
|
8
8
|
import type { ViewsMenuItem } from "../../provider/components.js";
|
|
9
9
|
import type { useHeaderDragReorder } from "./useHeaderDragReorder.js";
|
|
10
10
|
type HeaderDrag = ReturnType<typeof useHeaderDragReorder>;
|
|
11
|
-
export declare function GridHeader<Row>({ showAddColumn, checkbox, groupKey, ariaRowIndex, ariaLevel, ariaColOffset, ariaTailIndex, columns, columnManager, minWidth, sort, selectValues, optionColors, onOptionColorChange, dateStyles, onDateStyleChange, durationStyles, onDurationStyleChange, numberFormats, onNumberFormatChange, showTimeOverrides, onShowTimeChange, percentDisplays, onPercentDisplayChange, columnStateEnabled, listConfig, groupBy, resizingId, startResize, moveResize, endResize, resetColumnWidth, hideColumn, moveColumn, headerDrag, frozenCount, frozenLeft, viewBacked, formatsWritable, renderAddColumn, renderColumnMenuRows, columnMenuItems, }: {
|
|
11
|
+
export declare function GridHeader<Row>({ showAddColumn, checkbox, groupKey, ariaRowIndex, ariaLevel, ariaColOffset, ariaTailIndex, columns, columnManager, minWidth, sort, selectValues, optionColors, onOptionColorChange, dateStyles, onDateStyleChange, durationStyles, onDurationStyleChange, numberFormats, onNumberFormatChange, showTimeOverrides, onShowTimeChange, percentDisplays, onPercentDisplayChange, columnStateEnabled, listConfig, groupBy, resizingId, startResize, moveResize, endResize, resetColumnWidth, hideColumn, moveColumn, headerDrag, frozenCount, frozenLeft, verticalBorders, headerVerticalBorders, viewBacked, formatsWritable, renderAddColumn, renderColumnMenuRows, columnMenuItems, }: {
|
|
12
12
|
/** The table sized the tail for "+ Add column": the desktop strip of a grid with column state. */
|
|
13
13
|
showAddColumn?: boolean;
|
|
14
14
|
checkbox?: ReactNode;
|
|
@@ -58,6 +58,10 @@ export declare function GridHeader<Row>({ showAddColumn, checkbox, groupKey, ari
|
|
|
58
58
|
/** Sticky `left` for the frozen column at visible index i — a calc() over the
|
|
59
59
|
* width vars, so live resize re-lays the frozen stack without React. */
|
|
60
60
|
frozenLeft?: (i: number) => string;
|
|
61
|
+
/** The rows' rules between columns (grid-table-props); the header draws them only with `headerVerticalBorders`. */
|
|
62
|
+
verticalBorders?: boolean;
|
|
63
|
+
/** The header's columns ruled as the rows' are, the last bare: the app's word, off by default. */
|
|
64
|
+
headerVerticalBorders?: boolean;
|
|
61
65
|
viewBacked?: boolean;
|
|
62
66
|
/** The host's rules and slots, passed on from the grid's props (grid-table-props). */
|
|
63
67
|
formatsWritable?: boolean;
|
|
@@ -11,9 +11,9 @@ import { GRID_CHROME_FOCUS, GRID_CONTENT_PAD, GRID_HEADER_BG_FROZEN, GRID_HEADER
|
|
|
11
11
|
import { useViews } from "../../provider/context.js";
|
|
12
12
|
import { gridColumnGlyph } from "./column-glyph.js";
|
|
13
13
|
import { gridFocusOnPress } from "./useGridFocus.js";
|
|
14
|
-
import { effectiveSortKey } from "../../model/column-sort.js";
|
|
14
|
+
import { columnSortParts, effectiveSortKey, sortPartOf } from "../../model/column-sort.js";
|
|
15
15
|
import { columnPlacedByView } from "../../model/column-capabilities.js";
|
|
16
|
-
export function GridHeader({ showAddColumn = false, checkbox, groupKey, ariaRowIndex, ariaLevel, ariaColOffset = 0, ariaTailIndex, columns, columnManager, minWidth, sort, selectValues, optionColors, onOptionColorChange, dateStyles, onDateStyleChange, durationStyles, onDurationStyleChange, numberFormats, onNumberFormatChange, showTimeOverrides, onShowTimeChange, percentDisplays, onPercentDisplayChange, columnStateEnabled, listConfig, groupBy, resizingId, startResize, moveResize, endResize, resetColumnWidth, hideColumn, moveColumn, headerDrag, frozenCount = 0, frozenLeft, viewBacked = false, formatsWritable, renderAddColumn, renderColumnMenuRows, columnMenuItems, }) {
|
|
16
|
+
export function GridHeader({ showAddColumn = false, checkbox, groupKey, ariaRowIndex, ariaLevel, ariaColOffset = 0, ariaTailIndex, columns, columnManager, minWidth, sort, selectValues, optionColors, onOptionColorChange, dateStyles, onDateStyleChange, durationStyles, onDurationStyleChange, numberFormats, onNumberFormatChange, showTimeOverrides, onShowTimeChange, percentDisplays, onPercentDisplayChange, columnStateEnabled, listConfig, groupBy, resizingId, startResize, moveResize, endResize, resetColumnWidth, hideColumn, moveColumn, headerDrag, frozenCount = 0, frozenLeft, verticalBorders = true, headerVerticalBorders = false, viewBacked = false, formatsWritable, renderAddColumn, renderColumnMenuRows, columnMenuItems, }) {
|
|
17
17
|
const { icons, components, messages } = useViews();
|
|
18
18
|
const addColumn = columnManager && showAddColumn ? gridAddColumnNode(renderAddColumn, columnManager) : null;
|
|
19
19
|
const cells = (_jsxs(_Fragment, { children: [checkbox ?? _jsx(GridRailSpacer, { selecting: false, bordered: true }), columns.map((column, index) => {
|
|
@@ -21,7 +21,10 @@ export function GridHeader({ showAddColumn = false, checkbox, groupKey, ariaRowI
|
|
|
21
21
|
const canHide = canMove && columnHideable(column) && columns.length > 1;
|
|
22
22
|
const menuEnabled = gridColumnMenuEnabled(column);
|
|
23
23
|
const frozen = index < frozenCount && !!frozenLeft;
|
|
24
|
-
const cell = (_jsxs("div", { "data-slot": "vk-grid-header-cell", "data-headcell": column.id, tabIndex: -1, role: "columnheader", "aria-colindex": ariaColOffset + index + 1, "aria-sort": sort &&
|
|
24
|
+
const cell = (_jsxs("div", { "data-slot": "vk-grid-header-cell", "data-headcell": column.id, "data-frozen": frozen ? "" : undefined, tabIndex: -1, role: "columnheader", "aria-colindex": ariaColOffset + index + 1, "aria-sort": sort &&
|
|
25
|
+
(sort.value === effectiveSortKey(column, viewBacked) ||
|
|
26
|
+
(!!column.field &&
|
|
27
|
+
sortPartOf(sort.value, column.field.key, columnSortParts(column, viewBacked)) !== undefined))
|
|
25
28
|
? sort.dir === "asc"
|
|
26
29
|
? "ascending"
|
|
27
30
|
: "descending"
|
|
@@ -31,9 +34,10 @@ export function GridHeader({ showAddColumn = false, checkbox, groupKey, ariaRowI
|
|
|
31
34
|
}, onPointerDown: (event) => {
|
|
32
35
|
gridFocusOnPress(event, "[data-headcell]");
|
|
33
36
|
headerDrag.onCellPointerDown(column.id, index)(event);
|
|
34
|
-
}, onPointerMove: headerDrag.onCellPointerMove, onPointerUp: headerDrag.onCellPointerUp, onPointerCancel: headerDrag.onCellPointerCancel, onClickCapture: headerDrag.onCellClickCapture, className: cx("flex h-(--vk-head-h) min-w-0 select-none items-center gap-1.5 overflow-hidden whitespace-nowrap border-b border-(color:--vk-border-subtle) px-(--vk-px) text-(length:--vk-head-text) text-(color:--vk-fg-subtle)", GRID_CHROME_FOCUS, !frozen && "hover:bg-(color:--vk-hovered)",
|
|
37
|
+
}, onPointerMove: headerDrag.onCellPointerMove, onPointerUp: headerDrag.onCellPointerUp, onPointerCancel: headerDrag.onCellPointerCancel, onClickCapture: headerDrag.onCellClickCapture, className: cx("flex h-(--vk-head-h) min-w-0 select-none items-center gap-1.5 overflow-hidden whitespace-nowrap border-b border-(color:--vk-border-subtle) px-(--vk-px) text-(length:--vk-head-text) text-(color:--vk-fg-subtle)", GRID_CHROME_FOCUS, !frozen && "hover:bg-(color:--vk-hovered)", headerVerticalBorders &&
|
|
38
|
+
cx("border-r", (!verticalBorders || index === columns.length - 1) && "border-r-transparent"), column.align === "center" && "justify-center", menuEnabled ? "cursor-pointer" : "cursor-default", "translate-x-(--vk-drag-shift,0px)", frozen
|
|
35
39
|
? cx("[position:var(--vk-pin,sticky)] z-7", GRID_HEADER_BG_FROZEN, GRID_HEADER_BG_FROZEN_HOVER)
|
|
36
|
-
: "relative"), children: [gridColumnGlyph({ icons, AppIcon: components.AppIcon }, column, "h-(--vk-head-glyph) w-(--vk-head-glyph) shrink-0 opacity-70"), column.header ? _jsx("span", { className: "truncate", children: column.header }) : null, columnStateEnabled && (_jsx(GridResizeHandle, { active: resizingId === column.id, onResizeStart: (event) => startResize(column, event), onResizeMove: moveResize, onResizeEnd: endResize, onReset: () => resetColumnWidth(column) }))] }, column.id));
|
|
40
|
+
: "relative"), children: [gridColumnGlyph({ icons, AppIcon: components.AppIcon }, column, "h-(--vk-head-glyph) w-(--vk-head-glyph) shrink-0 text-(color:--vk-head-glyph-fg,currentColor) opacity-70"), column.header ? _jsx("span", { className: "truncate", children: column.header }) : null, columnStateEnabled && (_jsx(GridResizeHandle, { active: resizingId === column.id, onResizeStart: (event) => startResize(column, event), onResizeMove: moveResize, onResizeEnd: endResize, onReset: () => resetColumnWidth(column) }))] }, column.id));
|
|
37
41
|
if (!menuEnabled)
|
|
38
42
|
return cell;
|
|
39
43
|
return (_jsx(GridColumnMenu, { column: column, values: selectValues[column.id] ?? [], viewBacked: viewBacked, sort: sort, groupBy: groupBy, optionColors: optionColors?.[fieldKeyOf(column)], onOptionColorChange: onOptionColorChange, dateStyle: dateStyles?.[fieldKeyOf(column)], onDateStyleChange: onDateStyleChange, durationStyle: durationStyles?.[fieldKeyOf(column)], onDurationStyleChange: onDurationStyleChange, numberFormat: numberFormats?.[fieldKeyOf(column)], onNumberFormatChange: onNumberFormatChange, showTime: showTimeOverrides?.[fieldKeyOf(column)] ?? column.format?.withTime ?? false, onShowTimeChange: column.type === "datetime" ? onShowTimeChange : undefined, percentDisplay: percentDisplays?.[fieldKeyOf(column)], onPercentDisplayChange: onPercentDisplayChange, onMoveLeft: canMove && index > 0 ? () => moveColumn(column, -1) : undefined, onMoveRight: canMove && index < columns.length - 1 ? () => moveColumn(column, 1) : undefined, onHide: canHide ? () => hideColumn(column) : undefined, formatsWritable: formatsWritable, renderColumnMenuRows: column.partOf ? undefined : renderColumnMenuRows, columnMenuItems: column.partOf ? undefined : columnMenuItems, children: cell }, column.id));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useLayoutEffect, useRef, useState } from "react";
|
|
4
4
|
import { EditorPanel } from "../../editors/EditorPanel.js";
|
|
5
|
-
import { TextEditor } from "../../editors/TextEditor.js";
|
|
5
|
+
import { TextEditor, } from "../../editors/TextEditor.js";
|
|
6
6
|
import { useViews } from "../../provider/context.js";
|
|
7
7
|
import { cx } from "../../internal/cx.js";
|
|
8
8
|
import { useGridEditSession } from "./grid-edit-session.js";
|
|
@@ -28,16 +28,20 @@ export function GridLongTextEditor({ initial, seed, readOnly = false, markdown =
|
|
|
28
28
|
});
|
|
29
29
|
const width = cell ? Math.min(MAX_W, Math.max(MIN_W, cell.width)) : MIN_W;
|
|
30
30
|
const padY = cell ? Math.max(0, (cell.height - cell.lineHeight) / 2 - 1) : 8;
|
|
31
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title ?? "", anchor: anchorRef, align: "start", sideOffset: cell ? -cell.height : 0, initialFocus: false, panelData: { "data-slot": "vk-grid-editor" }, onPanelClick: (e) => e.stopPropagation(), chrome: "menu", className: cx("z-90 rounded-sm p-0", readOnly ? "border-(color:--vk-border)" : "border-(color:--vk-border-brand)"), style: { width }, children: (surface) =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title ?? "", anchor: anchorRef, align: "start", sideOffset: cell ? -cell.height : 0, initialFocus: false, panelData: { "data-slot": "vk-grid-editor" }, onPanelClick: (e) => e.stopPropagation(), chrome: "menu", className: cx("z-90 rounded-sm p-0", readOnly ? "border-(color:--vk-border)" : "border-(color:--vk-border-brand)"), style: { width }, children: (surface) => {
|
|
32
|
+
const framed = surface === "sheet" && paragraph;
|
|
33
|
+
const editor = (_jsx(TextEditor, { ref: editorRef, type: type ?? (markdown ? "rich_text" : "text"), multiline: paragraph, wraps: !paragraph, initial: initial, seed: seed, readOnly: readOnly, ...(framed ? { rows: 3 } : {}), closeOnBlur: false, label: messages({ key: readOnly ? "views.grid.value" : "views.grid.edit-value" }), boxData: { "data-grid-editor": "" }, onRequestClose: close, style: cell && surface === "popover"
|
|
34
|
+
? {
|
|
35
|
+
paddingLeft: cell.paddingX,
|
|
36
|
+
paddingRight: cell.paddingX,
|
|
37
|
+
paddingTop: padY,
|
|
38
|
+
paddingBottom: padY,
|
|
39
|
+
fontSize: cell.fontSize,
|
|
40
|
+
lineHeight: `${cell.lineHeight}px`,
|
|
41
|
+
}
|
|
42
|
+
: undefined, className: cx("block w-full resize-none select-text bg-transparent text-(color:--vk-fg) outline-hidden", "overflow-y-auto overscroll-contain", surface === "sheet" && !framed && "px-4 py-2", framed && "rounded-md px-3 py-2 ring-1 ring-(color:--vk-border)", framed && !readOnly && "focus:ring-(color:--vk-border-brand)") }));
|
|
43
|
+
return framed ? _jsx("div", { className: "px-4 pb-4", children: editor }) : editor;
|
|
44
|
+
} })] }));
|
|
41
45
|
}
|
|
42
46
|
function measureCell(anchor) {
|
|
43
47
|
const box = anchor.getBoundingClientRect();
|
|
@@ -4,7 +4,9 @@ import { useRef } from "react";
|
|
|
4
4
|
import { EditorPanel } from "../../editors/EditorPanel.js";
|
|
5
5
|
import { NameEditor } from "../../editors/NameEditor.js";
|
|
6
6
|
import { useGridEditSession } from "./grid-edit-session.js";
|
|
7
|
+
import { useBodyPanel } from "../../editors/body-panel.js";
|
|
7
8
|
export function GridNameEditor({ title, initial, seed, allowEmpty = false, onCommit, onCancel, onTab, onEnter, }) {
|
|
9
|
+
const panel = useBodyPanel("parts", "w-80 p-2", "z-90");
|
|
8
10
|
const anchorRef = useRef(null);
|
|
9
11
|
const editorRef = useRef(null);
|
|
10
12
|
const { session, close } = useGridEditSession({
|
|
@@ -14,8 +16,8 @@ export function GridNameEditor({ title, initial, seed, allowEmpty = false, onCom
|
|
|
14
16
|
onTab,
|
|
15
17
|
onEnter,
|
|
16
18
|
});
|
|
17
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, panelData: { "data-slot": "vk-grid-editor" }, onPanelClick: (e) => e.stopPropagation(), chrome: "menu", className:
|
|
18
|
-
const editor = (_jsx(NameEditor, { ref: editorRef, initial: initial, seed: seed, allowEmpty: allowEmpty, chrome: surface === "sheet" ? "field" : "bare", onRequestClose: close }));
|
|
19
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, panelData: { "data-slot": "vk-grid-editor", ...panel.data }, onPanelClick: (e) => e.stopPropagation(), chrome: "menu", className: panel.className, children: (surface) => {
|
|
20
|
+
const editor = (_jsx(NameEditor, { ref: editorRef, initial: initial, seed: seed, allowEmpty: allowEmpty, chrome: surface === "sheet" ? "field" : "bare", label: typeof title === "string" ? title : undefined, onRequestClose: close }));
|
|
19
21
|
return surface === "sheet" ? _jsx("div", { className: "px-4 pb-4", children: editor }) : editor;
|
|
20
22
|
} })] }));
|
|
21
23
|
}
|
|
@@ -14,7 +14,7 @@ import type { GridNumberEditValue } from "../core/edit-values.js";
|
|
|
14
14
|
* the sheet (a cell is too small to type into under a finger), and the answer
|
|
15
15
|
* waits for the sheet to slide away.
|
|
16
16
|
*/
|
|
17
|
-
export declare function GridNumberEditor({ title, initial, seed, unit, unitOptions, code, decimals, durationUnit, allowEmpty, unitLeft, conversion, onCommit, onCancel, onTab, onEnter, refuse, }: {
|
|
17
|
+
export declare function GridNumberEditor({ title, initial, seed, unit, unitOptions, code, decimals, durationUnit, allowEmpty, unitLeft, conversion, onCommit, onCancel, onTab, onEnter, refuse, type, bounds, }: {
|
|
18
18
|
/** The field's name: the sheet's title on a phone. */
|
|
19
19
|
title: ReactNode;
|
|
20
20
|
/** Signed raw value (e.g. -47.50 for an "out" transaction in its own currency). */
|
|
@@ -46,4 +46,11 @@ export declare function GridNumberEditor({ title, initial, seed, unit, unitOptio
|
|
|
46
46
|
/** The grid's judgement of a value before it is written: its reason when it would refuse it.
|
|
47
47
|
* A refused value keeps the editor open with that reason. */
|
|
48
48
|
refuse?: (value: GridNumberEditValue) => string | null;
|
|
49
|
+
/** The field's type: an app's `NumberBody` is handed it as its kind. Default `number`. */
|
|
50
|
+
type?: "number" | "percent" | "currency";
|
|
51
|
+
/** The field's limits (`numberBounds`): handed to an app's `NumberBody`. */
|
|
52
|
+
bounds?: {
|
|
53
|
+
min?: number;
|
|
54
|
+
max?: number;
|
|
55
|
+
};
|
|
49
56
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,9 +6,10 @@ import { EditorPanel } from "../../editors/EditorPanel.js";
|
|
|
6
6
|
import { ConversionLine } from "../../display/converted.js";
|
|
7
7
|
import { useKeepInside } from "../../editors/keep-inside.js";
|
|
8
8
|
import { cx } from "../../internal/cx.js";
|
|
9
|
+
import { useViews } from "../../provider/context.js";
|
|
9
10
|
import { GridFittedBox } from "./grid-fitted-box.js";
|
|
10
11
|
import { GridRefusal, UNDER_CELL_CLASS, useGridEditSession } from "./grid-edit-session.js";
|
|
11
|
-
export function GridNumberEditor({ title, initial, seed, unit, unitOptions, code, decimals = 2, durationUnit, allowEmpty = false, unitLeft = false, conversion, onCommit, onCancel, onTab, onEnter, refuse, }) {
|
|
12
|
+
export function GridNumberEditor({ title, initial, seed, unit, unitOptions, code, decimals = 2, durationUnit, allowEmpty = false, unitLeft = false, conversion, onCommit, onCancel, onTab, onEnter, refuse, type, bounds, }) {
|
|
12
13
|
const editorRef = useRef(null);
|
|
13
14
|
const anchorRef = useRef(null);
|
|
14
15
|
const { session, close } = useGridEditSession({
|
|
@@ -20,8 +21,19 @@ export function GridNumberEditor({ title, initial, seed, unit, unitOptions, code
|
|
|
20
21
|
onTab,
|
|
21
22
|
onEnter,
|
|
22
23
|
});
|
|
23
|
-
const
|
|
24
|
-
|
|
24
|
+
const body = !!useViews().components.NumberBody && !durationUnit;
|
|
25
|
+
const editor = (surface) => (_jsx(NumberEditor, { ref: editorRef, initial: initial, seed: seed, unit: unit, unitOptions: unitOptions, code: code, decimals: decimals, durationUnit: durationUnit, allowEmpty: allowEmpty, unitLeft: unitLeft, ...(body
|
|
26
|
+
? {
|
|
27
|
+
type,
|
|
28
|
+
...bounds,
|
|
29
|
+
label: typeof title === "string" ? title : undefined,
|
|
30
|
+
check: refuse && ((value, unit) => refuse({ value, unit })),
|
|
31
|
+
escapeKeeps: session.keeps ?? false,
|
|
32
|
+
closeOnBlur: surface === "in-place",
|
|
33
|
+
form: surface === "sheet" ? "phone" : "computer",
|
|
34
|
+
}
|
|
35
|
+
: {}), onRequestClose: close }));
|
|
36
|
+
return (_jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, inPlace: true, sheetOnPhone: true, children: (surface) => body ? (surface === "sheet" ? (_jsxs("div", { className: "px-2 pb-3", children: [editor(surface), conversion ? _jsx(ConversionLine, { figure: conversion, className: "pt-1.5" }) : null] })) : (_jsxs("span", { ref: anchorRef, "data-slot": "vk-grid-editor", "data-grown": "", className: cx("relative flex h-full w-full min-w-0", unitLeft && "justify-end"), children: [editor(surface), _jsx(GridRefusal, { reason: session.refusal }), conversion && !session.refusal ? _jsx(UnderCellConversion, { figure: conversion }) : null] }))) : surface === "sheet" ? (_jsxs("div", { className: "px-2 pb-3", children: [_jsx("div", { className: "flex h-10 min-w-0 items-center rounded-md border border-(color:--vk-border) px-2", children: editor(surface) }), conversion ? _jsx(ConversionLine, { figure: conversion, className: "pt-1.5" }) : null] })) : (_jsxs("span", { "data-slot": "vk-grid-editor", className: cx("relative flex h-full w-full min-w-0", unitLeft && "justify-end"), children: [_jsx(GridFittedBox, { boxRef: anchorRef, children: editor(surface) }), _jsx(GridRefusal, { reason: session.refusal }), conversion && !session.refusal ? _jsx(UnderCellConversion, { figure: conversion }) : null] })) }));
|
|
25
37
|
}
|
|
26
38
|
function UnderCellConversion({ figure }) {
|
|
27
39
|
const ref = useRef(null);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import type { GridPages } from "./grid-table-props.js";
|
|
3
|
+
export type GridPagerProps = {
|
|
4
|
+
pages: GridPages;
|
|
5
|
+
rowsOnPage: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function GridPager({ pages, rowsOnPage }: GridPagerProps): ReactElement;
|