@viewkitjs/views 0.5.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 +620 -0
- package/README.md +4 -2
- 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 +2 -2
- package/dist/atoms/DrillRows.js +7 -5
- package/dist/atoms/Loading.d.ts +6 -0
- package/dist/atoms/Loading.js +4 -1
- package/dist/atoms/PanelRows.js +3 -5
- 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.js +5 -4
- package/dist/atoms/ToolbarButton.d.ts +2 -0
- package/dist/atoms/ToolbarButton.js +18 -0
- package/dist/atoms/defaults.js +10 -0
- package/dist/atoms/types.d.ts +141 -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 +351 -15
- package/dist/contract.js +482 -4
- 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/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 +4 -1
- package/dist/grid/chrome/GridColumnMenu.js +5 -3
- package/dist/grid/chrome/GridColumnSortSection.d.ts +20 -0
- 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 +5 -1
- 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 +19 -20
- package/dist/grid/useGridTablePrefs.js +6 -58
- package/dist/grid/useGridTableSettings.d.ts +60 -0
- package/dist/grid/useGridTableSettings.js +61 -0
- package/dist/internal/count.d.ts +3 -0
- package/dist/internal/count.js +3 -0
- 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-sort.d.ts +11 -0
- package/dist/model/column-sort.js +14 -0
- package/dist/model/one-value.d.ts +6 -0
- package/dist/model/one-value.js +5 -0
- 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/relation-filters.d.ts +13 -2
- package/dist/model/relation-filters.js +9 -4
- package/dist/model/row-icon.d.ts +16 -6
- 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.js +6 -2
- 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 +46 -6
- package/dist/provider/ViewsProvider.js +32 -2
- package/dist/provider/components.d.ts +258 -11
- package/dist/provider/context.d.ts +21 -2
- package/dist/react.d.ts +5 -2
- package/dist/selection/SelectionBar.js +13 -7
- package/dist/selection/bar-overflow.js +14 -1
- package/dist/selection/bar-parts.d.ts +4 -2
- package/dist/selection/bar-parts.js +5 -3
- package/dist/selection/useListSelectionShortcuts.d.ts +3 -2
- package/dist/selection/useListSelectionShortcuts.js +1 -1
- package/dist/selection/verbs.d.ts +7 -0
- package/docs/contract.md +307 -41
- package/docs/getting-started.md +1 -1
- package/docs/guides/atoms.md +37 -5
- 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 +4 -2
- package/docs/guides/the-grid.md +21 -11
- package/docs/guides/the-provider.md +22 -6
- package/docs/index.md +2 -2
- package/docs/install.md +2 -3
- 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 +8 -5
- package/docs/reference/panels-react.md +101 -0
- package/docs/reference/panels.md +123 -0
- package/docs/reference/react.md +39 -16
- package/docs/reference/selection.md +5 -5
- package/docs/reference/views.md +17 -12
- package/package.json +16 -6
- package/skills/views/SKILL.md +4 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { clearViewOptions, countActiveFilters, countActiveViewOptions, groupOrderFor, isDateRangeActive, isGroupActive, isSortActive, } from "./model.js";
|
|
2
|
+
export { getViewOptionAvailability, resolvePersonalSection } from "./availability.js";
|
|
3
|
+
export { groupSortChoices, groupSortValue, offersManualOrder } from "./group-sort.js";
|
|
4
|
+
export { useFilterOpened } from "./use-filter-opened.js";
|
|
5
|
+
export { GROUP_BY_SEARCH_AFTER, activeGroupDimension, dateRangeValueLabel, filterRowValueLabel, filterValueLabel, groupDateByLabel, groupSortLabel, groupValueLabel, layoutValueLabel, matchGroupDimensions, matchSortOptions, relationSentence, sortValueLabel, timeScopeRowValueLabel, } from "./labels.js";
|
|
6
|
+
export { splitViewAxes, toViewAxes } from "./views-row/model.js";
|
|
7
|
+
export { settingsPanels } from "./settings/settings-panels.js";
|
|
8
|
+
export { settingsFilters } from "./settings/filters.js";
|
|
9
|
+
export { groupDimensionFor, settingsGroup, settingsGroupBy, settingsSort, } from "./settings/order.js";
|
|
10
|
+
export { settingsLayout } from "./settings/layout.js";
|
|
11
|
+
export { aggregatesOf, columnsChangeOf, columnsReset, columnStateOf, figuresChangeOf, } from "../model/settings-columns.js";
|
|
12
|
+
export { lookChange, seenLook } from "../model/settings-look.js";
|
|
13
|
+
export { boardFieldOf, calendarFieldOf } from "./settings/axes.js";
|
|
14
|
+
export { TOOLBAR_NARROW_BELOW, arrangeToolbar, toolbarForm } from "./toolbar/model.js";
|
|
15
|
+
export { SHOW_COUNTS_KEY, countsToggle, groupShown, withCounts } from "./toolbar/counts.js";
|
|
16
|
+
export { withEditView } from "./toolbar/edit-view.js";
|
|
17
|
+
export { settingsCleared } from "./toolbar/clear.js";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type DateRangeConfig, type GroupConfig, type LayoutConfig, type SortConfig, type TimeScopeConfig } from "./model.js";
|
|
2
|
+
import { type FilterConfig, type FilterConfigRelation } from "../filters/filter-model.js";
|
|
3
|
+
import { type FieldConventions } from "@viewkitjs/fields";
|
|
4
|
+
import { type ViewsMessageResolver } from "../contract.js";
|
|
5
|
+
/**
|
|
6
|
+
* What a relation's filter keeps, in one sentence (POR-704): "Clients with at least one campaign where
|
|
7
|
+
* status is Active." Read beside the quantifier rows, so a reader never has to work out what "None" with a
|
|
8
|
+
* condition means.
|
|
9
|
+
*/
|
|
10
|
+
export declare function relationSentence(filter: FilterConfigRelation, cv: FieldConventions, messages?: ViewsMessageResolver): string;
|
|
11
|
+
export declare function filterValueLabel<T extends string>(filter: FilterConfig<T>, cv: FieldConventions, messages?: ViewsMessageResolver): string;
|
|
12
|
+
export declare function dateRangeValueLabel(dateRange: DateRangeConfig, messages?: ViewsMessageResolver, cv?: FieldConventions): string;
|
|
13
|
+
export declare function timeScopeRowValueLabel<T extends string>(config: TimeScopeConfig<T>, messages?: ViewsMessageResolver, cv?: FieldConventions): string;
|
|
14
|
+
export declare function sortValueLabel<V extends string>(sort: SortConfig<V>, messages?: ViewsMessageResolver): string;
|
|
15
|
+
export declare function groupValueLabel<D extends string>(group: GroupConfig<D>, messages?: ViewsMessageResolver): string;
|
|
16
|
+
/** The active dimension of a grouped config, or null. */
|
|
17
|
+
export declare function activeGroupDimension<D extends string>(group: GroupConfig<D>): import("./model.js").GroupDimension<D> | null;
|
|
18
|
+
/** How many dimensions a Group by page, or options a Sort page, lists before it offers a search —
|
|
19
|
+
* on the popover and the phone sheet alike (POR-498, POR-372). */
|
|
20
|
+
export declare const GROUP_BY_SEARCH_AFTER = 8;
|
|
21
|
+
/** The dimensions a Group by page lists for a search: every one while the
|
|
22
|
+
* search is empty, else those whose label holds it. */
|
|
23
|
+
export declare function matchGroupDimensions<D extends string>(dimensions: GroupConfig<D>["dimensions"], query: string): GroupConfig<D>["dimensions"];
|
|
24
|
+
/** The sort options a Sort page lists for a search: every one while the search is empty, else those whose label
|
|
25
|
+
* holds it. */
|
|
26
|
+
export declare function matchSortOptions<O extends {
|
|
27
|
+
label: string;
|
|
28
|
+
}>(options: readonly O[], query: string): O[];
|
|
29
|
+
/** The Group panel's Sort row value: the current choice's words (POR-498). */
|
|
30
|
+
export declare function groupSortLabel<D extends string>(group: GroupConfig<D>, messages?: ViewsMessageResolver): string;
|
|
31
|
+
/** The Group panel's Date by row value: the active granularity's label. */
|
|
32
|
+
export declare function groupDateByLabel<D extends string>(group: GroupConfig<D>): string;
|
|
33
|
+
export declare function layoutValueLabel(layout: LayoutConfig): string;
|
|
34
|
+
/** The consolidated Filter row's value: how many dimensions are actually
|
|
35
|
+
* filtering. "None" rather than an empty string — the row always states where
|
|
36
|
+
* it stands, the same as every other row in the panel. */
|
|
37
|
+
export declare function filterRowValueLabel(count: number, messages?: ViewsMessageResolver): string;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { groupOrderFor, } from "./model.js";
|
|
2
|
+
import { isDateFilter, isNumberFilter, isRangeFilter, isRelationFilter, isTextFilter, isUnavailableFilter, isFilterActive, } from "../filters/filter-model.js";
|
|
3
|
+
import { dateRuleLabel, numberRuleLabel, rangeRuleLabel, textRuleLabel } from "@viewkitjs/fields/query";
|
|
4
|
+
import { groupSortChoices, groupSortValue } from "./group-sort.js";
|
|
5
|
+
import { DEFAULT_CONVENTIONS } from "@viewkitjs/fields";
|
|
6
|
+
import { resolveViewsMessage } from "../contract.js";
|
|
7
|
+
function heldWhere(filter) {
|
|
8
|
+
return filter.where.filter((w) => isFilterActive(w));
|
|
9
|
+
}
|
|
10
|
+
function condition(w, cv, messages) {
|
|
11
|
+
if (w.multi) {
|
|
12
|
+
const options = w.value
|
|
13
|
+
.map((v) => w.options.find((o) => o.value === v)?.label ?? String(v))
|
|
14
|
+
.join(messages({ key: "views.panels.join-or" }));
|
|
15
|
+
return messages({ key: "views.panels.relation-condition-options", values: { field: w.label, options } });
|
|
16
|
+
}
|
|
17
|
+
return messages({
|
|
18
|
+
key: "views.panels.relation-condition",
|
|
19
|
+
values: { field: w.label, value: filterValueLabel(w, cv, messages) },
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function relationSentence(filter, cv, messages = resolveViewsMessage) {
|
|
23
|
+
const { subject, noun } = filter;
|
|
24
|
+
const rule = filter.value;
|
|
25
|
+
const words = { subject, one: noun.one, many: noun.many };
|
|
26
|
+
if (!rule)
|
|
27
|
+
return messages({ key: "views.panels.relation-sentence", values: { rule: "all", ...words, conditions: "" } });
|
|
28
|
+
const conditions = heldWhere(filter)
|
|
29
|
+
.map((w) => condition(w, cv, messages))
|
|
30
|
+
.join(messages({ key: "views.panels.join-and" }));
|
|
31
|
+
const said = rule.quantifier === "every" && !conditions ? "every-unmatched" : rule.quantifier;
|
|
32
|
+
return messages({ key: "views.panels.relation-sentence", values: { rule: said, ...words, conditions } });
|
|
33
|
+
}
|
|
34
|
+
export function filterValueLabel(filter, cv, messages = resolveViewsMessage) {
|
|
35
|
+
if (filter.valueLabel !== undefined)
|
|
36
|
+
return filter.valueLabel;
|
|
37
|
+
if (isUnavailableFilter(filter)) {
|
|
38
|
+
return filter.stale ? messages({ key: "views.panels.filter-unavailable" }) : filter.reason;
|
|
39
|
+
}
|
|
40
|
+
if (isRelationFilter(filter)) {
|
|
41
|
+
if (!filter.value)
|
|
42
|
+
return messages({ key: "views.panels.filter-all" });
|
|
43
|
+
const held = heldWhere(filter);
|
|
44
|
+
const quantifier = messages({ key: "views.panels.quantifier", values: { quantifier: filter.value.quantifier } });
|
|
45
|
+
if (held.length === 0)
|
|
46
|
+
return quantifier;
|
|
47
|
+
if (held.length === 1) {
|
|
48
|
+
return messages({
|
|
49
|
+
key: "views.panels.relation-value-one",
|
|
50
|
+
values: { quantifier, field: held[0].label, value: filterValueLabel(held[0], cv, messages) },
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return messages({ key: "views.panels.relation-value-many", values: { quantifier, count: held.length } });
|
|
54
|
+
}
|
|
55
|
+
if (isTextFilter(filter))
|
|
56
|
+
return textRuleLabel(filter.value, cv);
|
|
57
|
+
if (isNumberFilter(filter))
|
|
58
|
+
return numberRuleLabel(filter.value, filter.decimals, filter.unit, cv);
|
|
59
|
+
if (isRangeFilter(filter))
|
|
60
|
+
return rangeRuleLabel(filter.value, cv);
|
|
61
|
+
if (isDateFilter(filter))
|
|
62
|
+
return dateRuleLabel(filter.value, cv);
|
|
63
|
+
if (filter.multi) {
|
|
64
|
+
if (filter.value.length === 0) {
|
|
65
|
+
return filter.emptyLabel ?? messages({ key: "views.panels.filter-all-of", values: { field: filter.label } });
|
|
66
|
+
}
|
|
67
|
+
if (filter.value.length === 1) {
|
|
68
|
+
return (filter.options.find((option) => option.value === filter.value[0])?.label ??
|
|
69
|
+
String(filter.value[0]));
|
|
70
|
+
}
|
|
71
|
+
return messages({ key: "views.panels.filter-selected", values: { count: filter.value.length } });
|
|
72
|
+
}
|
|
73
|
+
const allValue = (filter.allValue ?? "all");
|
|
74
|
+
if (filter.value === allValue) {
|
|
75
|
+
return filter.allLabel ?? messages({ key: "views.panels.filter-all-of", values: { field: filter.label } });
|
|
76
|
+
}
|
|
77
|
+
return (filter.options.find((option) => option.value === filter.value)?.label ?? String(filter.value));
|
|
78
|
+
}
|
|
79
|
+
export function dateRangeValueLabel(dateRange, messages = resolveViewsMessage, cv = DEFAULT_CONVENTIONS) {
|
|
80
|
+
const { from, to } = dateRange.value;
|
|
81
|
+
if (!from && !to)
|
|
82
|
+
return messages({ key: "views.panels.date-range-all" });
|
|
83
|
+
if (from && to) {
|
|
84
|
+
return messages({
|
|
85
|
+
key: "views.panels.date-range-between",
|
|
86
|
+
values: { from: formatRangeDate(from, cv), to: formatRangeDate(to, cv) },
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (from)
|
|
90
|
+
return messages({ key: "views.panels.date-range-from", values: { from: formatRangeDate(from, cv) } });
|
|
91
|
+
return messages({ key: "views.panels.date-range-until", values: { to: formatRangeDate(to, cv) } });
|
|
92
|
+
}
|
|
93
|
+
function formatRangeDate(date, cv) {
|
|
94
|
+
return date.toLocaleDateString(cv.locale, { month: "short", day: "numeric" });
|
|
95
|
+
}
|
|
96
|
+
export function timeScopeRowValueLabel(config, messages = resolveViewsMessage, cv = DEFAULT_CONVENTIONS) {
|
|
97
|
+
if (config.enableCustom &&
|
|
98
|
+
config.customValue !== undefined &&
|
|
99
|
+
config.value === config.customValue) {
|
|
100
|
+
const { from, to } = config.customRange ?? { from: null, to: null };
|
|
101
|
+
if (from && to) {
|
|
102
|
+
return messages({
|
|
103
|
+
key: "views.panels.date-range-between",
|
|
104
|
+
values: { from: formatRangeDate(from, cv), to: formatRangeDate(to, cv) },
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return config.customLabel ?? messages({ key: "views.panels.time-scope-custom" });
|
|
108
|
+
}
|
|
109
|
+
return (config.options.find((option) => option.value === config.value)?.label ?? String(config.value));
|
|
110
|
+
}
|
|
111
|
+
export function sortValueLabel(sort, messages = resolveViewsMessage) {
|
|
112
|
+
const label = sort.options.find((option) => option.value === sort.value)?.label ?? String(sort.value);
|
|
113
|
+
if (!label)
|
|
114
|
+
return messages({ key: "views.panels.sort-none" });
|
|
115
|
+
return messages({ key: "views.panels.sort-value", values: { label, dir: sort.dir === "asc" ? "asc" : "desc" } });
|
|
116
|
+
}
|
|
117
|
+
export function groupValueLabel(group, messages = resolveViewsMessage) {
|
|
118
|
+
if (group.value === "none")
|
|
119
|
+
return messages({ key: "views.panels.group-none" });
|
|
120
|
+
return (group.dimensions.find((dimension) => dimension.value === group.value)?.label ??
|
|
121
|
+
String(group.value));
|
|
122
|
+
}
|
|
123
|
+
export function activeGroupDimension(group) {
|
|
124
|
+
if (group.value === "none")
|
|
125
|
+
return null;
|
|
126
|
+
return group.dimensions.find((dimension) => dimension.value === group.value) ?? null;
|
|
127
|
+
}
|
|
128
|
+
export const GROUP_BY_SEARCH_AFTER = 8;
|
|
129
|
+
export function matchGroupDimensions(dimensions, query) {
|
|
130
|
+
const needle = query.trim().toLowerCase();
|
|
131
|
+
if (!needle)
|
|
132
|
+
return dimensions;
|
|
133
|
+
return dimensions.filter((dimension) => dimension.label.toLowerCase().includes(needle));
|
|
134
|
+
}
|
|
135
|
+
export function matchSortOptions(options, query) {
|
|
136
|
+
const needle = query.trim().toLowerCase();
|
|
137
|
+
if (!needle)
|
|
138
|
+
return [...options];
|
|
139
|
+
return options.filter((option) => option.label.toLowerCase().includes(needle));
|
|
140
|
+
}
|
|
141
|
+
export function groupSortLabel(group, messages = resolveViewsMessage) {
|
|
142
|
+
const dimension = activeGroupDimension(group);
|
|
143
|
+
if (!dimension)
|
|
144
|
+
return "";
|
|
145
|
+
const order = group.order[dimension.value] ?? groupOrderFor(dimension);
|
|
146
|
+
const value = groupSortValue(order);
|
|
147
|
+
const offered = groupSortChoices(dimension, undefined, messages).find((choice) => choice.value === value);
|
|
148
|
+
if (offered)
|
|
149
|
+
return offered.label;
|
|
150
|
+
return (groupSortChoices({ ...dimension, orderOptions: [{ value: order.mode, label: messages({ key: "views.panels.group-order-default" }) }] }, undefined, messages).find((choice) => choice.value === value)?.label ?? messages({ key: "views.panels.group-order-manual" }));
|
|
151
|
+
}
|
|
152
|
+
export function groupDateByLabel(group) {
|
|
153
|
+
const dimension = activeGroupDimension(group);
|
|
154
|
+
if (!dimension?.granularities?.length)
|
|
155
|
+
return "";
|
|
156
|
+
const value = group.granularity?.[dimension.value] ??
|
|
157
|
+
dimension.defaultGranularity ??
|
|
158
|
+
dimension.granularities[0].value;
|
|
159
|
+
return dimension.granularities.find((choice) => choice.value === value)?.label ?? value;
|
|
160
|
+
}
|
|
161
|
+
export function layoutValueLabel(layout) {
|
|
162
|
+
return (layout.options.find((option) => option.value === layout.value)?.label ?? String(layout.value));
|
|
163
|
+
}
|
|
164
|
+
export function filterRowValueLabel(count, messages = resolveViewsMessage) {
|
|
165
|
+
return messages({ key: "views.panels.filter-count", values: { count } });
|
|
166
|
+
}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { BucketOrderMode, SortDirection } from "@viewkitjs/fields/query";
|
|
3
|
+
import { type OrderChoice } from "../grouping/sort-groups.js";
|
|
4
|
+
import type { ListColumnItem, ListColumnsConfig } from "../model/column-state.js";
|
|
5
|
+
import { type FilterConfig } from "../filters/filter-model.js";
|
|
6
|
+
/**
|
|
7
|
+
* Server-safe contracts for the shared view-control system.
|
|
8
|
+
*
|
|
9
|
+
* Keep this module free of `"use client"`, hooks, JSX, and renderer imports.
|
|
10
|
+
* Feature code can describe a view without pulling a client component into its
|
|
11
|
+
* dependency graph.
|
|
12
|
+
*/
|
|
13
|
+
export type SortOption<V extends string = string> = {
|
|
14
|
+
value: V;
|
|
15
|
+
label: string;
|
|
16
|
+
defaultDir: SortDirection;
|
|
17
|
+
};
|
|
18
|
+
export type SortConfig<V extends string = string> = {
|
|
19
|
+
options: SortOption<V>[];
|
|
20
|
+
value: V;
|
|
21
|
+
dir: SortDirection;
|
|
22
|
+
defaultValue: V;
|
|
23
|
+
onChange: (next: {
|
|
24
|
+
value: V;
|
|
25
|
+
dir: SortDirection;
|
|
26
|
+
}) => void;
|
|
27
|
+
label?: string;
|
|
28
|
+
};
|
|
29
|
+
type GroupGranularity = {
|
|
30
|
+
value: string;
|
|
31
|
+
label: string;
|
|
32
|
+
};
|
|
33
|
+
/** One way a dimension's groups can be ordered. `defaultDir` is the direction
|
|
34
|
+
* the order opens in when picked — a date's Date opens newest first — as a
|
|
35
|
+
* sort option's does; absent, the mode's own (`defaultDirFor`). */
|
|
36
|
+
export type GroupOrderOption = {
|
|
37
|
+
value: BucketOrderMode;
|
|
38
|
+
label: string;
|
|
39
|
+
defaultDir?: SortDirection;
|
|
40
|
+
};
|
|
41
|
+
export type GroupDimension<D extends string = string> = {
|
|
42
|
+
value: D;
|
|
43
|
+
label: string;
|
|
44
|
+
orderOptions: GroupOrderOption[];
|
|
45
|
+
defaultOrder: BucketOrderMode;
|
|
46
|
+
/** Optional secondary grouping choice, such as Relative or Monthly. */
|
|
47
|
+
granularities?: GroupGranularity[];
|
|
48
|
+
defaultGranularity?: string;
|
|
49
|
+
};
|
|
50
|
+
/** One group as the Group panel lists it (POR-498). `empty`: hidden only by
|
|
51
|
+
* Hide empty groups; `hidden`: the reader hid it. */
|
|
52
|
+
export type GroupListEntry = {
|
|
53
|
+
key: string;
|
|
54
|
+
label: string;
|
|
55
|
+
empty: boolean;
|
|
56
|
+
hidden: boolean;
|
|
57
|
+
};
|
|
58
|
+
export type GroupConfig<D extends string = string> = {
|
|
59
|
+
dimensions: GroupDimension<D>[];
|
|
60
|
+
value: D | "none";
|
|
61
|
+
order: Partial<Record<D, OrderChoice>>;
|
|
62
|
+
granularity?: Partial<Record<D, string>>;
|
|
63
|
+
onChange: (next: {
|
|
64
|
+
value: D | "none";
|
|
65
|
+
order: Partial<Record<D, OrderChoice>>;
|
|
66
|
+
granularity?: Partial<Record<D, string>>;
|
|
67
|
+
}) => void;
|
|
68
|
+
label?: string;
|
|
69
|
+
/** The view's "Hide empty groups" — present while grouped (POR-498). */
|
|
70
|
+
hideEmpty?: {
|
|
71
|
+
value: boolean;
|
|
72
|
+
onChange: (next: boolean) => void;
|
|
73
|
+
};
|
|
74
|
+
/** The groups to show, hide and drag — present while grouped and the host
|
|
75
|
+
* hands the panel its groups (POR-498). */
|
|
76
|
+
groups?: {
|
|
77
|
+
entries: GroupListEntry[];
|
|
78
|
+
onToggle: (key: string, visible: boolean) => void;
|
|
79
|
+
onShowAll: () => void;
|
|
80
|
+
onHideAll: () => void;
|
|
81
|
+
onReorder: (keys: string[]) => void;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
/** The order a dimension opens in under `mode` — its default order when none
|
|
85
|
+
* is named: that choice's own direction, else the mode's. The one answer the
|
|
86
|
+
* desktop panel, the phone sheet and a saved view's first group all read. */
|
|
87
|
+
export declare function groupOrderFor<D extends string>(dimension: GroupDimension<D>, mode?: BucketOrderMode): OrderChoice;
|
|
88
|
+
export type ToggleConfig = {
|
|
89
|
+
key: string;
|
|
90
|
+
label: string;
|
|
91
|
+
value: boolean;
|
|
92
|
+
onChange: (next: boolean) => void;
|
|
93
|
+
icon?: ReactNode;
|
|
94
|
+
/** Omit controls that only exist on desktop from the mobile sheet. */
|
|
95
|
+
desktopOnly?: boolean;
|
|
96
|
+
/** Back to the reader's default for this one knob — drawn on the row, beside
|
|
97
|
+
* the switch. Present only while the view has an answer of its own. */
|
|
98
|
+
reset?: {
|
|
99
|
+
onReset: () => void;
|
|
100
|
+
};
|
|
101
|
+
/** Renders the toggle under its own labelled section instead of the plain
|
|
102
|
+
* toggles card — for rows that are a different KIND of thing than their
|
|
103
|
+
* neighbours (e.g. the org-wide "Lock column" admin toggle vs personal
|
|
104
|
+
* display prefs). Toggles sharing a section string group together. */
|
|
105
|
+
section?: string;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* One pick-one setting on a column (display currency, decimals…), rendered as
|
|
109
|
+
* a labelled radio section inside that column's drill-in. Deliberately generic
|
|
110
|
+
* — the grid's number-format types stay with the grid, this file stays
|
|
111
|
+
* presentation-only.
|
|
112
|
+
*/
|
|
113
|
+
export type LayoutColumnChoice = {
|
|
114
|
+
key: string;
|
|
115
|
+
label: string;
|
|
116
|
+
value: string;
|
|
117
|
+
options: {
|
|
118
|
+
value: string;
|
|
119
|
+
label: string;
|
|
120
|
+
}[];
|
|
121
|
+
onChange: (value: string) => void;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* A pick-one setting belonging to the ACTIVE VIEW rather than to a column —
|
|
125
|
+
* rendered as its own labelled section in the Layout drill-in, under the view
|
|
126
|
+
* radios where Density sits.
|
|
127
|
+
*
|
|
128
|
+
* `views` gates it exactly as `densityFor` gates Density: absent means every
|
|
129
|
+
* view, and a list names the views the setting means something on. That gate is
|
|
130
|
+
* what keeps this generic — the panel never learns what any particular setting
|
|
131
|
+
* is for, only which views admit it.
|
|
132
|
+
*/
|
|
133
|
+
export type LayoutViewChoice<V extends string = string> = LayoutColumnChoice & {
|
|
134
|
+
views?: V[];
|
|
135
|
+
};
|
|
136
|
+
/** The views package's column item, with the drill-in's settings: the grid's "+ Add column" takes either. */
|
|
137
|
+
export type LayoutColumnItem = ListColumnItem & {
|
|
138
|
+
/**
|
|
139
|
+
* Per-column display settings surfaced when the column is opened: pick-one
|
|
140
|
+
* choices (date style, display currency, decimals) and booleans (show time).
|
|
141
|
+
* Columns with none still open — the drill-in always carries Visible.
|
|
142
|
+
*/
|
|
143
|
+
settings?: {
|
|
144
|
+
choices?: LayoutColumnChoice[];
|
|
145
|
+
toggles?: ToggleConfig[];
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
/** The views package's `ListColumnsConfig`, with the toolbar's items and the card's line breaks. */
|
|
149
|
+
export type LayoutColumnsConfig = Omit<ListColumnsConfig, "items"> & {
|
|
150
|
+
items: LayoutColumnItem[];
|
|
151
|
+
/**
|
|
152
|
+
* Per-field "starts a new line" — the card-layout control for the card-
|
|
153
|
+
* bearing views (board, calendar), supplied by a binding with at least one
|
|
154
|
+
* of those capabilities. `views` names the views whose Columns drill-in
|
|
155
|
+
* shows the toggle (the same config serves the table's drill-in, where a
|
|
156
|
+
* line break means nothing).
|
|
157
|
+
*/
|
|
158
|
+
newLine?: {
|
|
159
|
+
views: string[];
|
|
160
|
+
has: (id: string) => boolean;
|
|
161
|
+
onToggle: (id: string) => void;
|
|
162
|
+
/** The field that opens the card — a break there has no line above it to
|
|
163
|
+
* end, so the control is shown inert rather than accepting a click that
|
|
164
|
+
* changes nothing. */
|
|
165
|
+
firstFieldId?: string;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
export type LayoutDensityConfig = {
|
|
169
|
+
value: string;
|
|
170
|
+
options: {
|
|
171
|
+
value: string;
|
|
172
|
+
label: string;
|
|
173
|
+
}[];
|
|
174
|
+
onChange: (value: string) => void;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* The settings that belong to the READER rather than to the view — their row
|
|
178
|
+
* density, their row icon, their phone's layout, their display currency.
|
|
179
|
+
*
|
|
180
|
+
* Same shapes as the view's own knobs, deliberately: they render identically
|
|
181
|
+
* and only the heading differs, because the difference that matters is not how
|
|
182
|
+
* a control looks but who feels it. A list with saved views passes this; every
|
|
183
|
+
* other list passes nothing and the section does not exist.
|
|
184
|
+
*/
|
|
185
|
+
export type LayoutPersonalConfig<V extends string = string> = {
|
|
186
|
+
/** Defaults to "For you". */
|
|
187
|
+
label?: string;
|
|
188
|
+
toggles?: ToggleConfig[];
|
|
189
|
+
choices?: LayoutViewChoice<V>[];
|
|
190
|
+
/** Back to what the view says. Absent when nothing is overridden. */
|
|
191
|
+
onReset?: () => void;
|
|
192
|
+
};
|
|
193
|
+
export type LayoutConfig<V extends string = string> = {
|
|
194
|
+
label?: string;
|
|
195
|
+
value: V;
|
|
196
|
+
/** The layouts this list can draw — the ones a reader may pick. */
|
|
197
|
+
options: {
|
|
198
|
+
value: V;
|
|
199
|
+
label: string;
|
|
200
|
+
}[];
|
|
201
|
+
onChange(value: V): void;
|
|
202
|
+
/** The layouts this list could draw and cannot, each with the reason a reader
|
|
203
|
+
* is shown. Drawn greyed after `options`, never choosable. */
|
|
204
|
+
refused?: LayoutRefusal<V>[];
|
|
205
|
+
toggles?: ToggleConfig[];
|
|
206
|
+
columns?: LayoutColumnsConfig;
|
|
207
|
+
/** Views whose root Columns row shows. Absent → the `subOptionsFor` gate
|
|
208
|
+
* (the pre-board behavior: columns were the spreadsheet's business). The
|
|
209
|
+
* board consumes the same column state as card FIELDS, so it lists itself
|
|
210
|
+
* here without inheriting the grid-only toggles. */
|
|
211
|
+
columnsFor?: V[];
|
|
212
|
+
/** Per-view label for the Columns row + drill-in title — the board says
|
|
213
|
+
* "Fields", because a card has no columns. Falls back to "Columns". */
|
|
214
|
+
columnsLabelByView?: Partial<Record<V, string>>;
|
|
215
|
+
/** Pick-one settings of the active view (the calendar's date axis is the
|
|
216
|
+
* first), each gated by its own `views` list. Rendered as labelled radio
|
|
217
|
+
* sections between the toggles and Density. */
|
|
218
|
+
choices?: LayoutViewChoice<V>[];
|
|
219
|
+
/** Views on which the list's Group by is not offered — a board is laid out by
|
|
220
|
+
* its own field, and the table's grouping stays saved, untouched. */
|
|
221
|
+
hidesGroupFor?: V[];
|
|
222
|
+
/** Row spacing for the ACTIVE view. */
|
|
223
|
+
density?: LayoutDensityConfig;
|
|
224
|
+
/** Views whose Density section shows. Absent → every view (the pre-board
|
|
225
|
+
* behavior). The board has one card spacing and offers no density. */
|
|
226
|
+
densityFor?: V[];
|
|
227
|
+
/** The reader's own overrides of this view — rendered under their own
|
|
228
|
+
* heading beneath everything above. See `LayoutPersonalConfig`. */
|
|
229
|
+
personal?: LayoutPersonalConfig<V>;
|
|
230
|
+
desktopOnly?: boolean;
|
|
231
|
+
mobileValue?: V;
|
|
232
|
+
onMobileChange?(value: V): void;
|
|
233
|
+
/** The views offerable on a PHONE, when they differ from the desktop's.
|
|
234
|
+
* Defaults to `options`. */
|
|
235
|
+
mobileOptions?: {
|
|
236
|
+
value: V;
|
|
237
|
+
label: string;
|
|
238
|
+
}[];
|
|
239
|
+
/** The phone's own refusals, when they differ from the desktop's. Defaults
|
|
240
|
+
* to `refused`. */
|
|
241
|
+
mobileRefused?: LayoutRefusal<V>[];
|
|
242
|
+
subOptionsFor?: V;
|
|
243
|
+
};
|
|
244
|
+
/** A layout the list cannot draw, and why — `"No date field"`. */
|
|
245
|
+
type LayoutRefusal<V extends string = string> = {
|
|
246
|
+
value: V;
|
|
247
|
+
label: string;
|
|
248
|
+
reason: string;
|
|
249
|
+
};
|
|
250
|
+
export type DateRangeValue = {
|
|
251
|
+
from: Date | null;
|
|
252
|
+
to: Date | null;
|
|
253
|
+
};
|
|
254
|
+
export type TimeScopeConfig<T extends string = string> = {
|
|
255
|
+
label?: string;
|
|
256
|
+
value: T;
|
|
257
|
+
options: {
|
|
258
|
+
value: T;
|
|
259
|
+
label: string;
|
|
260
|
+
}[];
|
|
261
|
+
onChange: (value: T) => void;
|
|
262
|
+
enableCustom?: boolean;
|
|
263
|
+
customValue?: T;
|
|
264
|
+
customRange?: DateRangeValue;
|
|
265
|
+
onCustomRangeChange?: (next: DateRangeValue) => void;
|
|
266
|
+
customLabel?: string;
|
|
267
|
+
};
|
|
268
|
+
export type DateRangeConfig = {
|
|
269
|
+
key: string;
|
|
270
|
+
label?: string;
|
|
271
|
+
value: DateRangeValue;
|
|
272
|
+
onChange: (next: DateRangeValue) => void;
|
|
273
|
+
};
|
|
274
|
+
export type ActivePanel = {
|
|
275
|
+
type: "filter";
|
|
276
|
+
key: string;
|
|
277
|
+
/** A Where field opened inside a relation's filter (POR-704). */
|
|
278
|
+
field?: string;
|
|
279
|
+
} | {
|
|
280
|
+
type: "group";
|
|
281
|
+
} | {
|
|
282
|
+
type: "sort";
|
|
283
|
+
} | {
|
|
284
|
+
type: "timeScope";
|
|
285
|
+
} | {
|
|
286
|
+
type: "dateRange";
|
|
287
|
+
key: string;
|
|
288
|
+
} | {
|
|
289
|
+
type: "toggle";
|
|
290
|
+
key: string;
|
|
291
|
+
} | {
|
|
292
|
+
type: "layout";
|
|
293
|
+
}
|
|
294
|
+
/** The consolidated Filter drill-in — the list of filter dimensions
|
|
295
|
+
* (filters + time scope + date ranges) shown when `foldFilters` is on. */
|
|
296
|
+
| {
|
|
297
|
+
type: "filters";
|
|
298
|
+
}
|
|
299
|
+
/** The Columns editor as a first-class panel (visibility + reorder). */
|
|
300
|
+
| {
|
|
301
|
+
type: "columns";
|
|
302
|
+
}
|
|
303
|
+
/** One column's own settings, one level under the Columns list. */
|
|
304
|
+
| {
|
|
305
|
+
type: "column";
|
|
306
|
+
key: string;
|
|
307
|
+
}
|
|
308
|
+
/** The field to group by — one level under Group (POR-498). */
|
|
309
|
+
| {
|
|
310
|
+
type: "groupBy";
|
|
311
|
+
}
|
|
312
|
+
/** How the groups are ordered — one level under Group (POR-498). */
|
|
313
|
+
| {
|
|
314
|
+
type: "groupSort";
|
|
315
|
+
}
|
|
316
|
+
/** A date group's granularity — one level under Group (POR-498). */
|
|
317
|
+
| {
|
|
318
|
+
type: "groupDateBy";
|
|
319
|
+
} | null;
|
|
320
|
+
export type ViewOptionInputs<S extends string = string, G extends string = string, T extends string = string> = {
|
|
321
|
+
filters?: FilterConfig<string>[];
|
|
322
|
+
sort?: SortConfig<S>;
|
|
323
|
+
group?: GroupConfig<G>;
|
|
324
|
+
timeScopeConfig?: TimeScopeConfig<T>;
|
|
325
|
+
dateRangeConfigs?: DateRangeConfig[];
|
|
326
|
+
toggles?: ToggleConfig[];
|
|
327
|
+
layout?: LayoutConfig;
|
|
328
|
+
};
|
|
329
|
+
export type { CollectionViewState } from "./view-state.js";
|
|
330
|
+
export declare function isSortActive<V extends string>(sort: SortConfig<V>): boolean;
|
|
331
|
+
export declare function isGroupActive<D extends string>(group: GroupConfig<D>): boolean;
|
|
332
|
+
export declare function isDateRangeActive(dateRange: DateRangeConfig): boolean;
|
|
333
|
+
/** One active-count contract for every view-options trigger. Toggles, layout,
|
|
334
|
+
* and time scope have no declared default, so they do not enter the badge. */
|
|
335
|
+
/** Just the FILTER dimensions — what the consolidated Filter row reports.
|
|
336
|
+
* Sort and group are view SHAPE, not filtering, so they stay out of it. */
|
|
337
|
+
export declare function countActiveFilters(args: {
|
|
338
|
+
filters?: FilterConfig<string>[];
|
|
339
|
+
dateRangeConfigs?: DateRangeConfig[];
|
|
340
|
+
}): number;
|
|
341
|
+
export declare function countActiveViewOptions<S extends string, G extends string, T extends string>({ filters, sort, group, dateRangeConfigs, }: ViewOptionInputs<S, G, T>): number;
|
|
342
|
+
/** Clear refinements while preserving group order and granularity preferences. */
|
|
343
|
+
export declare function clearViewOptions<S extends string, G extends string, T extends string>({ filters, sort, group, dateRangeConfigs, }: ViewOptionInputs<S, G, T>): void;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { defaultDirFor } from "../grouping/sort-groups.js";
|
|
2
|
+
import { isDateFilter, isFilterActive, isNumberFilter, isRangeFilter, isRelationFilter, isTextFilter, } from "../filters/filter-model.js";
|
|
3
|
+
import { isDateRuleActive, isNumberRuleActive, isRangeRuleActive, isTextRuleActive, } from "@viewkitjs/fields/query";
|
|
4
|
+
export function groupOrderFor(dimension, mode = dimension.defaultOrder) {
|
|
5
|
+
const option = dimension.orderOptions.find((candidate) => candidate.value === mode);
|
|
6
|
+
return { mode, dir: option?.defaultDir ?? defaultDirFor(mode) };
|
|
7
|
+
}
|
|
8
|
+
export function isSortActive(sort) {
|
|
9
|
+
const defaultOption = sort.options.find((option) => option.value === sort.defaultValue);
|
|
10
|
+
return sort.value !== sort.defaultValue || sort.dir !== (defaultOption?.defaultDir ?? "asc");
|
|
11
|
+
}
|
|
12
|
+
export function isGroupActive(group) {
|
|
13
|
+
return group.value !== "none";
|
|
14
|
+
}
|
|
15
|
+
export function isDateRangeActive(dateRange) {
|
|
16
|
+
return dateRange.value.from !== null || dateRange.value.to !== null;
|
|
17
|
+
}
|
|
18
|
+
export function countActiveFilters(args) {
|
|
19
|
+
const filterCount = (args.filters ?? []).filter((f) => (f.countsAsFilter ?? true) && isFilterActive(f)).length;
|
|
20
|
+
const dateRangeCount = (args.dateRangeConfigs ?? []).filter(isDateRangeActive).length;
|
|
21
|
+
return filterCount + dateRangeCount;
|
|
22
|
+
}
|
|
23
|
+
export function countActiveViewOptions({ filters, sort, group, dateRangeConfigs, }) {
|
|
24
|
+
return ((filters ?? []).filter((filter) => (filter.countsAsFilter ?? true) && isFilterActive(filter))
|
|
25
|
+
.length +
|
|
26
|
+
(sort && isSortActive(sort) ? 1 : 0) +
|
|
27
|
+
(group && isGroupActive(group) ? 1 : 0) +
|
|
28
|
+
(dateRangeConfigs ?? []).filter(isDateRangeActive).length);
|
|
29
|
+
}
|
|
30
|
+
export function clearViewOptions({ filters, sort, group, dateRangeConfigs, }) {
|
|
31
|
+
for (const filter of (filters ?? []).filter((item) => item.countsAsFilter !== false && !item.disabled)) {
|
|
32
|
+
if (filter.editor === "unavailable") {
|
|
33
|
+
if (filter.stale)
|
|
34
|
+
filter.onClear();
|
|
35
|
+
}
|
|
36
|
+
else if (isTextFilter(filter)) {
|
|
37
|
+
if (isTextRuleActive(filter.value))
|
|
38
|
+
filter.onChange(null);
|
|
39
|
+
}
|
|
40
|
+
else if (isNumberFilter(filter)) {
|
|
41
|
+
if (isNumberRuleActive(filter.value))
|
|
42
|
+
filter.onChange(null);
|
|
43
|
+
}
|
|
44
|
+
else if (isDateFilter(filter)) {
|
|
45
|
+
if (isDateRuleActive(filter.value))
|
|
46
|
+
filter.onChange(null);
|
|
47
|
+
}
|
|
48
|
+
else if (isRangeFilter(filter)) {
|
|
49
|
+
if (isRangeRuleActive(filter.value))
|
|
50
|
+
filter.onChange(null);
|
|
51
|
+
}
|
|
52
|
+
else if (isRelationFilter(filter)) {
|
|
53
|
+
if (filter.value)
|
|
54
|
+
filter.onChange(null);
|
|
55
|
+
}
|
|
56
|
+
else if (filter.multi) {
|
|
57
|
+
if (filter.value.length > 0)
|
|
58
|
+
filter.onChange([]);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const allValue = filter.allValue ?? "all";
|
|
62
|
+
if (filter.value !== allValue)
|
|
63
|
+
filter.onChange(allValue);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (sort) {
|
|
67
|
+
const option = sort.options.find((item) => item.value === sort.defaultValue);
|
|
68
|
+
sort.onChange({ value: sort.defaultValue, dir: option?.defaultDir ?? "asc" });
|
|
69
|
+
}
|
|
70
|
+
if (group) {
|
|
71
|
+
group.onChange({ value: "none", order: group.order, granularity: group.granularity });
|
|
72
|
+
}
|
|
73
|
+
for (const dateRange of dateRangeConfigs ?? []) {
|
|
74
|
+
if (isDateRangeActive(dateRange))
|
|
75
|
+
dateRange.onChange({ from: null, to: null });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GroupConfig } from "../model.js";
|
|
2
|
+
type Groups = NonNullable<GroupConfig["groups"]>;
|
|
3
|
+
/**
|
|
4
|
+
* THE GROUP PANEL'S GROUPS: every group of the list in the panel's order (shown, then empty, then hidden),
|
|
5
|
+
* each with a grip to drag it and an eye to show or hide it. The same row chrome, grip and sensors as the
|
|
6
|
+
* Columns list (`LayoutColumnsList`), so the two editors read as one; `comfortable` is the phone sheet's
|
|
7
|
+
* taller row.
|
|
8
|
+
*
|
|
9
|
+
* An empty group is dimmed (Hide empty groups hides it, the eye is still open); a group the reader hid is
|
|
10
|
+
* dimmed with a crossed eye. Dragging one sets the list's order by hand.
|
|
11
|
+
*/
|
|
12
|
+
export declare function GroupBucketsList({ groups, variant, }: {
|
|
13
|
+
groups: Groups;
|
|
14
|
+
variant?: "compact" | "comfortable";
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|