@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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { FilterConfigNumber } from "../../filters/filter-model.js";
|
|
3
|
+
/**
|
|
4
|
+
* The numeric dimension's editor: the bound(s), then the operator list. Same
|
|
5
|
+
* shape as the text one — one body for both surfaces, box above the operators.
|
|
6
|
+
*
|
|
7
|
+
* `between` grows a second box rather than opening a sub-panel: a range is one
|
|
8
|
+
* thought, and splitting it across a drill-in makes you leave the screen to
|
|
9
|
+
* finish the sentence you started.
|
|
10
|
+
*/
|
|
11
|
+
export declare function NumberFilterBody({ filter, rowClassName, rowBorderClassName, labelClassName, checkClassName, fieldClassName, wrapRows, autoFocus, }: {
|
|
12
|
+
filter: FilterConfigNumber;
|
|
13
|
+
rowClassName?: string;
|
|
14
|
+
rowBorderClassName?: string;
|
|
15
|
+
labelClassName?: string;
|
|
16
|
+
checkClassName?: string;
|
|
17
|
+
/** The boxes' padding, in place of the default. */
|
|
18
|
+
fieldClassName?: string;
|
|
19
|
+
wrapRows?: (rows: ReactNode) => ReactNode;
|
|
20
|
+
autoFocus?: boolean;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { cx } from "../../internal/cx.js";
|
|
5
|
+
import { useViews } from "../../provider/context.js";
|
|
6
|
+
import { FIELD_PADDING } from "./TextFilterBody.js";
|
|
7
|
+
import { formatDurationMs } from "@viewkitjs/fields/format/time";
|
|
8
|
+
import { DEFAULT_NUMBER_FILTER_RULE, NUMBER_FILTER_OPERATORS, numberFilterOperatorLabel, durationUnitToMs, msToDurationUnit, numberFilterInputs, parseDurationInput, parseNumber, } from "@viewkitjs/fields/query";
|
|
9
|
+
const asDraft = (value, style, unit, cv) => {
|
|
10
|
+
if (value == null)
|
|
11
|
+
return "";
|
|
12
|
+
if (style === "duration")
|
|
13
|
+
return formatDurationMs(durationUnitToMs(value, unit));
|
|
14
|
+
return cv.decimal === "," ? String(value).replace(".", ",") : String(value);
|
|
15
|
+
};
|
|
16
|
+
export function NumberFilterBody({ filter, rowClassName, rowBorderClassName, labelClassName, checkClassName, fieldClassName, wrapRows, autoFocus = false, }) {
|
|
17
|
+
const { atoms, conventions, messages } = useViews();
|
|
18
|
+
const { RadioRow, PanelSearch } = atoms;
|
|
19
|
+
const rule = filter.value ?? DEFAULT_NUMBER_FILTER_RULE;
|
|
20
|
+
const inputs = numberFilterInputs(rule.operator);
|
|
21
|
+
const parse = (raw) => {
|
|
22
|
+
if (filter.numberStyle !== "duration")
|
|
23
|
+
return parseNumber(raw, conventions);
|
|
24
|
+
const ms = parseDurationInput(raw, conventions);
|
|
25
|
+
return ms == null ? null : msToDurationUnit(ms, filter.durationUnit);
|
|
26
|
+
};
|
|
27
|
+
const draftOf = (value) => asDraft(value, filter.numberStyle, filter.durationUnit, conventions);
|
|
28
|
+
const [draft, setDraft] = useState(draftOf(rule.value));
|
|
29
|
+
const [draft2, setDraft2] = useState(draftOf(rule.value2));
|
|
30
|
+
const committed = useRef({ a: draftOf(rule.value), b: draftOf(rule.value2) });
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const same = (typed, value) => parse(typed) === (value ?? null);
|
|
33
|
+
if (!same(committed.current.a, rule.value)) {
|
|
34
|
+
const a = draftOf(rule.value);
|
|
35
|
+
committed.current.a = a;
|
|
36
|
+
setDraft(a);
|
|
37
|
+
}
|
|
38
|
+
if (!same(committed.current.b, rule.value2)) {
|
|
39
|
+
const b = draftOf(rule.value2);
|
|
40
|
+
committed.current.b = b;
|
|
41
|
+
setDraft2(b);
|
|
42
|
+
}
|
|
43
|
+
}, [rule.value, rule.value2]);
|
|
44
|
+
const commit = (a, b, operator = rule.operator) => {
|
|
45
|
+
committed.current = { a, b };
|
|
46
|
+
const next = {
|
|
47
|
+
operator,
|
|
48
|
+
value: parse(a),
|
|
49
|
+
...(numberFilterInputs(operator) === 2 ? { value2: parse(b) } : {}),
|
|
50
|
+
};
|
|
51
|
+
filter.onChange(next);
|
|
52
|
+
};
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (draft === committed.current.a && draft2 === committed.current.b)
|
|
55
|
+
return;
|
|
56
|
+
const id = setTimeout(() => commit(draft, draft2), 200);
|
|
57
|
+
return () => clearTimeout(id);
|
|
58
|
+
}, [draft, draft2]);
|
|
59
|
+
const box = (value, onValue, placeholder, focus) => (_jsx(PanelSearch, { value: value, onChange: onValue, onClear: () => {
|
|
60
|
+
const cleared = value === draft ? ["", draft2] : [draft, ""];
|
|
61
|
+
setDraft(cleared[0]);
|
|
62
|
+
setDraft2(cleared[1]);
|
|
63
|
+
commit(cleared[0], cleared[1]);
|
|
64
|
+
}, onKeyDown: (e) => {
|
|
65
|
+
if (e.key === "Enter")
|
|
66
|
+
commit(draft, draft2);
|
|
67
|
+
}, placeholder: placeholder, autoFocus: focus, leading: null, suffix: filter.unit, inputMode: "decimal" }));
|
|
68
|
+
const rows = NUMBER_FILTER_OPERATORS.map((op, index) => (_jsx(RadioRow, { selected: op.value === rule.operator, label: numberFilterOperatorLabel(op.value, conventions), onClick: () => {
|
|
69
|
+
const a = op.inputs === 0 ? "" : draft;
|
|
70
|
+
const b = op.inputs === 2 ? draft2 : "";
|
|
71
|
+
setDraft(a);
|
|
72
|
+
setDraft2(b);
|
|
73
|
+
commit(a, b, op.value);
|
|
74
|
+
}, className: cx(rowClassName, index > 0 && rowBorderClassName), labelClassName: labelClassName, checkClassName: checkClassName }, op.value)));
|
|
75
|
+
return (_jsxs(_Fragment, { children: [inputs > 0 && (_jsxs("div", { "data-vs-inset": true, className: cx("flex items-center gap-2", fieldClassName ?? FIELD_PADDING), children: [_jsx("div", { className: "min-w-0 flex-1", children: box(draft, setDraft, messages({ key: inputs === 2 ? "views.panels.bound-from" : "views.panels.bound-value" }), autoFocus) }), inputs === 2 && (_jsxs(_Fragment, { children: [_jsx("span", { className: "shrink-0 text-xs text-(color:--vk-fg-subtle)", children: "\u2013" }), _jsx("div", { className: "min-w-0 flex-1", children: box(draft2, setDraft2, messages({ key: "views.panels.bound-to" }), false) })] }))] })), wrapRows ? wrapRows(rows) : rows] }));
|
|
76
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { FilterConfigRange } from "../../filters/filter-model.js";
|
|
3
|
+
/**
|
|
4
|
+
* The range dimension's editor: the presets as quick picks, the bound(s), then
|
|
5
|
+
* the operator list — the number body's shape. A two-box operator ("any part
|
|
6
|
+
* between", "entirely within") filters once either box is typed: an empty box
|
|
7
|
+
* is an open end, never a missing rule.
|
|
8
|
+
*/
|
|
9
|
+
export declare function RangeFilterBody({ filter, rowClassName, rowBorderClassName, labelClassName, checkClassName, fieldClassName, wrapRows, autoFocus, }: {
|
|
10
|
+
filter: FilterConfigRange;
|
|
11
|
+
rowClassName?: string;
|
|
12
|
+
rowBorderClassName?: string;
|
|
13
|
+
labelClassName?: string;
|
|
14
|
+
checkClassName?: string;
|
|
15
|
+
/** The presets' and the boxes' padding, in place of the defaults. */
|
|
16
|
+
fieldClassName?: string;
|
|
17
|
+
wrapRows?: (rows: ReactNode) => ReactNode;
|
|
18
|
+
autoFocus?: boolean;
|
|
19
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { cx } from "../../internal/cx.js";
|
|
5
|
+
import { ELEMENT_RESET } from "../../internal/reset.js";
|
|
6
|
+
import { useViews } from "../../provider/context.js";
|
|
7
|
+
import { FIELD_PADDING } from "./TextFilterBody.js";
|
|
8
|
+
import { DEFAULT_RANGE_FILTER_RULE, RANGE_FILTER_OPERATORS, rangeFilterOperatorLabel, parseNumber, rangeFilterInputs, } from "@viewkitjs/fields/query";
|
|
9
|
+
const asDraft = (value, cv) => value == null ? "" : cv.decimal === "," ? String(value).replace(".", ",") : String(value);
|
|
10
|
+
const PRESETS_PADDING = "px-2 pt-2";
|
|
11
|
+
export function RangeFilterBody({ filter, rowClassName, rowBorderClassName, labelClassName, checkClassName, fieldClassName, wrapRows, autoFocus = false, }) {
|
|
12
|
+
const { atoms, conventions, messages } = useViews();
|
|
13
|
+
const { RadioRow, PanelSearch } = atoms;
|
|
14
|
+
const rule = filter.value ?? DEFAULT_RANGE_FILTER_RULE;
|
|
15
|
+
const inputs = rangeFilterInputs(rule.operator);
|
|
16
|
+
const parse = (raw) => raw.trim() === "" ? null : parseNumber(raw, conventions);
|
|
17
|
+
const [draft, setDraft] = useState(asDraft(rule.value, conventions));
|
|
18
|
+
const [draft2, setDraft2] = useState(asDraft(rule.value2, conventions));
|
|
19
|
+
const committed = useRef({ a: asDraft(rule.value, conventions), b: asDraft(rule.value2, conventions) });
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const same = (typed, value) => parse(typed) === (value ?? null);
|
|
22
|
+
if (!same(committed.current.a, rule.value)) {
|
|
23
|
+
const a = asDraft(rule.value, conventions);
|
|
24
|
+
committed.current.a = a;
|
|
25
|
+
setDraft(a);
|
|
26
|
+
}
|
|
27
|
+
if (!same(committed.current.b, rule.value2)) {
|
|
28
|
+
const b = asDraft(rule.value2, conventions);
|
|
29
|
+
committed.current.b = b;
|
|
30
|
+
setDraft2(b);
|
|
31
|
+
}
|
|
32
|
+
}, [rule.value, rule.value2]);
|
|
33
|
+
const commit = (a, b, operator = rule.operator) => {
|
|
34
|
+
committed.current = { a, b };
|
|
35
|
+
const next = {
|
|
36
|
+
operator,
|
|
37
|
+
value: parse(a),
|
|
38
|
+
...(rangeFilterInputs(operator) === 2 ? { value2: parse(b) } : {}),
|
|
39
|
+
};
|
|
40
|
+
filter.onChange(next);
|
|
41
|
+
};
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (draft === committed.current.a && draft2 === committed.current.b)
|
|
44
|
+
return;
|
|
45
|
+
const id = setTimeout(() => commit(draft, draft2), 200);
|
|
46
|
+
return () => clearTimeout(id);
|
|
47
|
+
}, [draft, draft2]);
|
|
48
|
+
const box = (value, onValue, placeholder, focus) => (_jsx(PanelSearch, { value: value, onChange: onValue, onClear: () => {
|
|
49
|
+
const cleared = value === draft ? ["", draft2] : [draft, ""];
|
|
50
|
+
setDraft(cleared[0]);
|
|
51
|
+
setDraft2(cleared[1]);
|
|
52
|
+
commit(cleared[0], cleared[1]);
|
|
53
|
+
}, onKeyDown: (e) => {
|
|
54
|
+
if (e.key === "Enter")
|
|
55
|
+
commit(draft, draft2);
|
|
56
|
+
}, placeholder: placeholder, autoFocus: focus, leading: null, suffix: filter.unit, inputMode: "decimal" }));
|
|
57
|
+
const rows = RANGE_FILTER_OPERATORS.map((op, index) => (_jsx(RadioRow, { selected: op.value === rule.operator, label: rangeFilterOperatorLabel(op.value, conventions), onClick: () => {
|
|
58
|
+
const a = op.inputs === 0 ? "" : draft;
|
|
59
|
+
const b = op.inputs === 2 ? draft2 : "";
|
|
60
|
+
setDraft(a);
|
|
61
|
+
setDraft2(b);
|
|
62
|
+
commit(a, b, op.value);
|
|
63
|
+
}, className: cx(rowClassName, index > 0 && rowBorderClassName), labelClassName: labelClassName, checkClassName: checkClassName }, op.value)));
|
|
64
|
+
return (_jsxs(_Fragment, { children: [filter.presets?.length ? (_jsx("div", { "data-vs-inset": true, className: cx("flex flex-wrap gap-1.5", fieldClassName ?? PRESETS_PADDING), children: filter.presets.map((p) => (_jsx("button", { type: "button", onClick: () => {
|
|
65
|
+
const a = p.low == null ? "" : String(p.low);
|
|
66
|
+
const b = p.high == null ? "" : String(p.high);
|
|
67
|
+
setDraft(a);
|
|
68
|
+
setDraft2(b);
|
|
69
|
+
commit(a, b, "overlaps");
|
|
70
|
+
}, className: cx(ELEMENT_RESET, "rounded-md border border-(color:--vk-border) px-2 py-0.5 text-xs text-(color:--vk-fg) hover:bg-(color:--vk-hovered)"), children: p.label }, p.key))) })) : null, inputs > 0 && (_jsxs("div", { "data-vs-inset": true, className: cx("flex items-center gap-2", fieldClassName ?? FIELD_PADDING), children: [_jsx("div", { className: "min-w-0 flex-1", children: box(draft, setDraft, messages({ key: inputs === 2 ? "views.panels.bound-from" : "views.panels.bound-value" }), autoFocus) }), inputs === 2 && (_jsxs(_Fragment, { children: [_jsx("span", { className: "shrink-0 text-xs text-(color:--vk-fg-subtle)", children: "\u2013" }), _jsx("div", { className: "min-w-0 flex-1", children: box(draft2, setDraft2, messages({ key: "views.panels.bound-to" }), false) })] }))] })), wrapRows ? wrapRows(rows) : rows] }));
|
|
71
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { FilterConfig, FilterConfigRelation } from "../../filters/filter-model.js";
|
|
3
|
+
export declare function RelationFilterBody({ filter, renderWhere, renderWhereHeading, rowClassName, rowBorderClassName, labelClassName, checkClassName, wrapRows, sentenceClassName, }: {
|
|
4
|
+
filter: FilterConfigRelation;
|
|
5
|
+
/** Each surface draws its own Where rows (desktop `MenuRow`, phone `ViewMenuRow` in a card). */
|
|
6
|
+
renderWhere: (rows: FilterConfig<string>[]) => ReactNode;
|
|
7
|
+
/** The heading above the Where rows, in the surface's own style. */
|
|
8
|
+
renderWhereHeading: () => ReactNode;
|
|
9
|
+
rowClassName?: string;
|
|
10
|
+
rowBorderClassName?: string;
|
|
11
|
+
labelClassName?: string;
|
|
12
|
+
checkClassName?: string;
|
|
13
|
+
/** The sheet puts the quantifier rows in a `DetailCard`. */
|
|
14
|
+
wrapRows?: (rows: ReactNode) => ReactNode;
|
|
15
|
+
/** The sentence's padding and size, in place of the defaults. */
|
|
16
|
+
sentenceClassName?: string;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { chooseQuantifier } from "../../filters/relation-filter.js";
|
|
4
|
+
import { relationFieldKeyOf } from "../../model/relation-filters.js";
|
|
5
|
+
import { cx } from "../../internal/cx.js";
|
|
6
|
+
import { useViews } from "../../provider/context.js";
|
|
7
|
+
import { relationSentence } from "../labels.js";
|
|
8
|
+
const CHOICES = ["any", "none", "every"];
|
|
9
|
+
const SENTENCE_BOX = "px-3 pt-2 pb-2.5 text-xs leading-relaxed";
|
|
10
|
+
export function RelationFilterBody({ filter, renderWhere, renderWhereHeading, rowClassName, rowBorderClassName, labelClassName, checkClassName, wrapRows, sentenceClassName, }) {
|
|
11
|
+
const { atoms, conventions, messages } = useViews();
|
|
12
|
+
const { RadioRow } = atoms;
|
|
13
|
+
const fieldKey = relationFieldKeyOf(filter.key);
|
|
14
|
+
const one = filter.noun.one;
|
|
15
|
+
const rows = CHOICES.map((quantifier, index) => {
|
|
16
|
+
const disabled = quantifier === "every" && !filter.canEvery;
|
|
17
|
+
return (_jsx(RadioRow, { selected: filter.value?.quantifier === quantifier, label: messages({ key: "views.panels.relation-choice", values: { quantifier, one } }), disabled: disabled, disabledReason: disabled ? messages({ key: "views.panels.relation-every-needs-where", values: { one } }) : undefined, onClick: () => filter.onChange(chooseQuantifier(fieldKey, filter.value, quantifier)), className: cx(rowClassName, index > 0 && rowBorderClassName), labelClassName: labelClassName, checkClassName: checkClassName }, quantifier));
|
|
18
|
+
});
|
|
19
|
+
return (_jsxs(_Fragment, { children: [wrapRows ? wrapRows(rows) : rows, _jsx("p", { className: cx("text-(color:--vk-fg-subtle)", sentenceClassName ?? SENTENCE_BOX), children: relationSentence(filter, conventions, messages) }), renderWhereHeading(), renderWhere(filter.where)] }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { FilterConfigText } from "../../filters/filter-model.js";
|
|
3
|
+
/** The padding around a body's box. A host's `fieldClassName` replaces it, since the package joins
|
|
4
|
+
* classes without merging them (the sheet sets its own). */
|
|
5
|
+
export declare const FIELD_PADDING = "px-2 pt-2 pb-1.5";
|
|
6
|
+
/**
|
|
7
|
+
* The text dimension's editor: the query box, then the operator list.
|
|
8
|
+
*
|
|
9
|
+
* ONE body for both surfaces — the desktop popover and the mobile sheet pour it
|
|
10
|
+
* into their own chrome and pass their own row classes. The alternative (a leaf
|
|
11
|
+
* per surface) is how the two drift: an operator added to one and not the other
|
|
12
|
+
* is invisible until someone opens the same filter on a phone.
|
|
13
|
+
*
|
|
14
|
+
* The box is deliberately ABOVE the operators. Picking an operator is a
|
|
15
|
+
* one-tap, done action; typing is where the user lingers, and on mobile the
|
|
16
|
+
* keyboard covers the lower half of the sheet.
|
|
17
|
+
*/
|
|
18
|
+
export declare function TextFilterBody({ filter, rowClassName, rowBorderClassName, labelClassName, checkClassName, fieldClassName, wrapRows, autoFocus, }: {
|
|
19
|
+
filter: FilterConfigText;
|
|
20
|
+
rowClassName?: string;
|
|
21
|
+
rowBorderClassName?: string;
|
|
22
|
+
labelClassName?: string;
|
|
23
|
+
checkClassName?: string;
|
|
24
|
+
/** The box's padding, in place of the default (`FIELD_PADDING`). */
|
|
25
|
+
fieldClassName?: string;
|
|
26
|
+
/** The sheet puts its operator rows in a `DetailCard`; the field stays
|
|
27
|
+
* outside it, since a well nested inside a filled card reads as a hole. */
|
|
28
|
+
wrapRows?: (rows: ReactNode) => ReactNode;
|
|
29
|
+
/** Desktop only. On mobile the sheet owns focus (see useSheetAutofocus). */
|
|
30
|
+
autoFocus?: boolean;
|
|
31
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { cx } from "../../internal/cx.js";
|
|
5
|
+
import { useViews } from "../../provider/context.js";
|
|
6
|
+
import { DEFAULT_TEXT_FILTER_RULE, TEXT_FILTER_OPERATORS, textFilterOperatorLabel, nextTextRule, textFilterNeedsQuery, } from "@viewkitjs/fields/query";
|
|
7
|
+
export const FIELD_PADDING = "px-2 pt-2 pb-1.5";
|
|
8
|
+
export function TextFilterBody({ filter, rowClassName, rowBorderClassName, labelClassName, checkClassName, fieldClassName, wrapRows, autoFocus = false, }) {
|
|
9
|
+
const { atoms, conventions, messages } = useViews();
|
|
10
|
+
const { RadioRow, PanelSearch } = atoms;
|
|
11
|
+
const rule = filter.value ?? DEFAULT_TEXT_FILTER_RULE;
|
|
12
|
+
const needsQuery = textFilterNeedsQuery(rule.operator);
|
|
13
|
+
const [draft, setDraft] = useState(rule.query);
|
|
14
|
+
const committed = useRef(rule.query);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (rule.query !== committed.current) {
|
|
17
|
+
committed.current = rule.query;
|
|
18
|
+
setDraft(rule.query);
|
|
19
|
+
}
|
|
20
|
+
}, [rule.query]);
|
|
21
|
+
const commit = (query, operator = rule.operator) => {
|
|
22
|
+
const next = nextTextRule(operator, query);
|
|
23
|
+
committed.current = next.query;
|
|
24
|
+
filter.onChange(next);
|
|
25
|
+
};
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (draft === committed.current)
|
|
28
|
+
return;
|
|
29
|
+
const id = setTimeout(() => commit(draft), 200);
|
|
30
|
+
return () => clearTimeout(id);
|
|
31
|
+
}, [draft]);
|
|
32
|
+
const rows = TEXT_FILTER_OPERATORS.map((op, index) => (_jsx(RadioRow, { selected: op.value === rule.operator, label: textFilterOperatorLabel(op.value, conventions), onClick: () => {
|
|
33
|
+
if (!op.needsQuery)
|
|
34
|
+
setDraft("");
|
|
35
|
+
commit(draft, op.value);
|
|
36
|
+
}, className: cx(rowClassName, index > 0 && rowBorderClassName), labelClassName: labelClassName, checkClassName: checkClassName }, op.value)));
|
|
37
|
+
return (_jsxs(_Fragment, { children: [needsQuery && (_jsx("div", { "data-vs-inset": true, className: fieldClassName ?? FIELD_PADDING, children: _jsx(PanelSearch, { value: draft, onChange: setDraft, onClear: () => {
|
|
38
|
+
setDraft("");
|
|
39
|
+
commit("");
|
|
40
|
+
}, autoFocus: autoFocus, onKeyDown: (e) => {
|
|
41
|
+
if (e.key === "Enter")
|
|
42
|
+
commit(draft);
|
|
43
|
+
}, placeholder: messages({ key: "views.panels.filter-placeholder", values: { field: filter.label } }) }) })), wrapRows ? wrapRows(rows) : rows] }));
|
|
44
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TimeScopeConfig } from "../model.js";
|
|
2
|
+
export declare function CompactTimeScopeDetail<T extends string>({ timeScopeConfig, onBack, registerBackHandler, }: {
|
|
3
|
+
timeScopeConfig: TimeScopeConfig<T>;
|
|
4
|
+
onBack: () => void;
|
|
5
|
+
registerBackHandler?: (fn: (() => boolean) | null) => void;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { cx } from "../../internal/cx.js";
|
|
5
|
+
import { useViews } from "../../provider/context.js";
|
|
6
|
+
import { timeScopeRowValueLabel } from "../labels.js";
|
|
7
|
+
import { dateOf, dayOf } from "./details.js";
|
|
8
|
+
import { PANEL_SCROLL } from "./filter-list.js";
|
|
9
|
+
export function CompactTimeScopeDetail({ timeScopeConfig, onBack, registerBackHandler, }) {
|
|
10
|
+
const { atoms, conventions, icons, messages } = useViews();
|
|
11
|
+
const { RadioRow } = atoms;
|
|
12
|
+
const Chevron = icons.chevronRight;
|
|
13
|
+
const customEnabled = timeScopeConfig.enableCustom === true && timeScopeConfig.customValue !== undefined;
|
|
14
|
+
const customSelected = customEnabled && timeScopeConfig.value === timeScopeConfig.customValue;
|
|
15
|
+
const [view, setView] = useState(customSelected ? "calendar" : "presets");
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (!registerBackHandler)
|
|
18
|
+
return;
|
|
19
|
+
if (view === "calendar") {
|
|
20
|
+
registerBackHandler(() => {
|
|
21
|
+
setView("presets");
|
|
22
|
+
return true;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
registerBackHandler(null);
|
|
27
|
+
}
|
|
28
|
+
return () => registerBackHandler(null);
|
|
29
|
+
}, [view, registerBackHandler]);
|
|
30
|
+
if (view === "calendar" && customEnabled) {
|
|
31
|
+
const { from, to } = timeScopeConfig.customRange ?? { from: null, to: null };
|
|
32
|
+
return (_jsx(atoms.RangeCalendar, { mode: "range", from: dayOf(from), to: dayOf(to), minNights: 1, locale: conventions.locale, onSelect: (next, day) => {
|
|
33
|
+
const current = timeScopeConfig.customRange ?? { from: null, to: null };
|
|
34
|
+
if (current.from && current.to && day) {
|
|
35
|
+
timeScopeConfig.onCustomRangeChange?.({ from: dateOf(day), to: null });
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
timeScopeConfig.onCustomRangeChange?.({ from: dateOf(next.from), to: dateOf(next.to) });
|
|
39
|
+
} }));
|
|
40
|
+
}
|
|
41
|
+
return (_jsxs("div", { "data-vs-detail": true, className: cx("max-h-64", PANEL_SCROLL), children: [timeScopeConfig.options.map((opt) => (_jsx(RadioRow, { mark: "box", selected: opt.value === timeScopeConfig.value, label: opt.label, onClick: () => {
|
|
42
|
+
timeScopeConfig.onChange(opt.value);
|
|
43
|
+
onBack();
|
|
44
|
+
} }, opt.value))), customEnabled && (_jsx(RadioRow, { mark: "box", selected: customSelected, label: customSelected
|
|
45
|
+
? timeScopeRowValueLabel(timeScopeConfig, messages, conventions)
|
|
46
|
+
: (timeScopeConfig.customLabel ?? messages({ key: "views.panels.time-scope-custom" })), onClick: () => setView("calendar"), trailing: _jsx(Chevron, { className: "h-3.5 w-3.5 shrink-0 text-(color:--vk-fg-subtlest)" }) }, "__custom"))] }));
|
|
47
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type FilterConfig } from "../../filters/filter-model.js";
|
|
2
|
+
import { type DateRangeConfig, type ToggleConfig } from "../model.js";
|
|
3
|
+
export declare function CompactFilterDetail<T extends string>({ filter, onOpenField, }: {
|
|
4
|
+
filter: FilterConfig<T>;
|
|
5
|
+
/** A relation's Where row opens its far field one level down (POR-704). */
|
|
6
|
+
onOpenField?: (field: string) => void;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function CompactToggleDetail({ toggle, onBack, }: {
|
|
9
|
+
toggle: ToggleConfig;
|
|
10
|
+
onBack: () => void;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/** A `Date` as the month's ISO day, and back, on the local calendar. */
|
|
13
|
+
export declare const dayOf: (date: Date | null) => string | null;
|
|
14
|
+
export declare const dateOf: (key: string | null) => Date | null;
|
|
15
|
+
export declare function CompactDateRangeDetail({ dateRangeConfig }: {
|
|
16
|
+
dateRangeConfig: DateRangeConfig;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { fromDayKey, toDayKey } from "@viewkitjs/fields/query";
|
|
4
|
+
import { isDateFilter, isFilterActive, isNumberFilter, isRangeFilter, isRelationFilter, isTextFilter, isUnavailableFilter, } from "../../filters/filter-model.js";
|
|
5
|
+
import { cx } from "../../internal/cx.js";
|
|
6
|
+
import { ELEMENT_RESET } from "../../internal/reset.js";
|
|
7
|
+
import { useViews } from "../../provider/context.js";
|
|
8
|
+
import { filterValueLabel } from "../labels.js";
|
|
9
|
+
import { isDateRangeActive } from "../model.js";
|
|
10
|
+
import { useFilterOpened } from "../use-filter-opened.js";
|
|
11
|
+
import { DateFilterBody } from "./DateFilterBody.js";
|
|
12
|
+
import { FilterIcon } from "./FilterIcon.js";
|
|
13
|
+
import { FilterSectionHeading, PANEL_SCROLL } from "./filter-list.js";
|
|
14
|
+
import { NumberFilterBody } from "./NumberFilterBody.js";
|
|
15
|
+
import { RangeFilterBody } from "./RangeFilterBody.js";
|
|
16
|
+
import { RelationFilterBody } from "./RelationFilterBody.js";
|
|
17
|
+
import { TextFilterBody } from "./TextFilterBody.js";
|
|
18
|
+
export function CompactFilterDetail({ filter, onOpenField, }) {
|
|
19
|
+
const { atoms, conventions, messages } = useViews();
|
|
20
|
+
const { CheckRow, MenuRow, RadioRow } = atoms;
|
|
21
|
+
useFilterOpened(filter);
|
|
22
|
+
if (isRelationFilter(filter)) {
|
|
23
|
+
return (_jsx("div", { "data-vs-detail": true, className: cx("max-h-96", PANEL_SCROLL), children: _jsx(RelationFilterBody, { filter: filter, renderWhereHeading: () => _jsx(FilterSectionHeading, { children: messages({ key: "views.panels.where" }) }), renderWhere: (rows) => rows.map((w) => (_jsx(MenuRow, { icon: _jsx(FilterIcon, { filter: w, className: "h-3.5 w-3.5" }), label: w.label, value: filterValueLabel(w, conventions, messages), active: isFilterActive(w), disabled: w.disabled, disabledReason: w.disabledReason, onClick: () => onOpenField?.(w.key) }, w.key))) }) }));
|
|
24
|
+
}
|
|
25
|
+
if (isUnavailableFilter(filter)) {
|
|
26
|
+
return (_jsxs("div", { "data-vs-detail": true, className: "space-y-3 px-3 py-3 text-sm text-(color:--vk-fg-subtle)", children: [_jsx("p", { children: filter.reason }), filter.stale && (_jsx("button", { type: "button", className: cx(ELEMENT_RESET, "font-medium text-(color:--vk-fg-brand)"), onClick: filter.onClear, children: messages({ key: "views.panels.filter-clear-saved" }) }))] }));
|
|
27
|
+
}
|
|
28
|
+
if (isTextFilter(filter)) {
|
|
29
|
+
return (_jsx("div", { "data-vs-detail": true, className: cx("max-h-80", PANEL_SCROLL), children: _jsx(TextFilterBody, { filter: filter, autoFocus: true }) }));
|
|
30
|
+
}
|
|
31
|
+
if (isNumberFilter(filter)) {
|
|
32
|
+
return (_jsx("div", { "data-vs-detail": true, className: cx("max-h-80", PANEL_SCROLL), children: _jsx(NumberFilterBody, { filter: filter, autoFocus: true }) }));
|
|
33
|
+
}
|
|
34
|
+
if (isRangeFilter(filter)) {
|
|
35
|
+
return (_jsx("div", { "data-vs-detail": true, className: cx("max-h-80", PANEL_SCROLL), children: _jsx(RangeFilterBody, { filter: filter, autoFocus: true }) }));
|
|
36
|
+
}
|
|
37
|
+
if (isDateFilter(filter)) {
|
|
38
|
+
return (_jsx("div", { "data-vs-detail": true, className: cx("max-h-96", PANEL_SCROLL), children: _jsx(DateFilterBody, { filter: filter }) }));
|
|
39
|
+
}
|
|
40
|
+
if (filter.options.length === 0 && (filter.multi || filter.hideAllOption)) {
|
|
41
|
+
return (_jsx("div", { "data-vs-detail": true, className: "px-3 py-3 text-sm text-(color:--vk-fg-subtle)", children: messages({ key: "views.panels.filter-no-options" }) }));
|
|
42
|
+
}
|
|
43
|
+
if (filter.multi) {
|
|
44
|
+
const toggle = (v) => {
|
|
45
|
+
filter.onChange(filter.value.includes(v) ? filter.value.filter((x) => x !== v) : [...filter.value, v]);
|
|
46
|
+
};
|
|
47
|
+
return (_jsx("div", { "data-vs-detail": true, className: cx("max-h-64", PANEL_SCROLL), children: filter.options.map((opt) => {
|
|
48
|
+
const checked = filter.value.includes(opt.value);
|
|
49
|
+
return (_jsx(CheckRow, { checked: checked, onClick: () => toggle(opt.value), leading: filter.renderLeading?.(opt), trailing: filter.renderTrailing?.(opt), children: filter.renderOption ? (filter.renderOption(opt)) : (_jsx("span", { className: "text-sm truncate flex-1", children: opt.label })) }, opt.value));
|
|
50
|
+
}) }));
|
|
51
|
+
}
|
|
52
|
+
const allValue = (filter.allValue ?? "all");
|
|
53
|
+
const hideAllOption = filter.hideAllOption ?? false;
|
|
54
|
+
return (_jsxs("div", { "data-vs-detail": true, className: cx("max-h-64", PANEL_SCROLL), children: [!hideAllOption && (_jsx(RadioRow, { mark: "box", selected: filter.value === allValue, label: filter.allLabel ?? messages({ key: "views.panels.filter-all-of", values: { field: filter.label } }), onClick: () => filter.onChange(allValue) })), filter.options.map((opt) => (_jsx(RadioRow, { mark: "box", selected: filter.value === opt.value, label: opt.label, onClick: () => filter.onChange(opt.value) }, opt.value)))] }));
|
|
55
|
+
}
|
|
56
|
+
export function CompactToggleDetail({ toggle, onBack, }) {
|
|
57
|
+
const { atoms, messages } = useViews();
|
|
58
|
+
const { RadioRow } = atoms;
|
|
59
|
+
return (_jsxs("div", { "data-vs-detail": true, className: cx("max-h-64", PANEL_SCROLL), children: [_jsx(RadioRow, { mark: "box", selected: toggle.value === true, label: messages({ key: "views.panels.toggle-on" }), onClick: () => {
|
|
60
|
+
toggle.onChange(true);
|
|
61
|
+
onBack();
|
|
62
|
+
} }), _jsx(RadioRow, { mark: "box", selected: toggle.value === false, label: messages({ key: "views.panels.toggle-off" }), onClick: () => {
|
|
63
|
+
toggle.onChange(false);
|
|
64
|
+
onBack();
|
|
65
|
+
} })] }));
|
|
66
|
+
}
|
|
67
|
+
export const dayOf = (date) => (date ? toDayKey(date) : null);
|
|
68
|
+
export const dateOf = (key) => (key ? fromDayKey(key) : null);
|
|
69
|
+
export function CompactDateRangeDetail({ dateRangeConfig }) {
|
|
70
|
+
const { atoms, conventions, messages } = useViews();
|
|
71
|
+
const { from, to } = dateRangeConfig.value;
|
|
72
|
+
return (_jsx(atoms.RangeCalendar, { mode: "range", from: dayOf(from), to: dayOf(to), locale: conventions.locale, onSelect: (next) => dateRangeConfig.onChange({ from: dateOf(next.from), to: dateOf(next.to) }), footer: isDateRangeActive(dateRangeConfig) ? (_jsx("div", { className: "flex justify-end", children: _jsx("button", { type: "button", onClick: () => dateRangeConfig.onChange({ from: null, to: null }), className: cx(ELEMENT_RESET, "text-xs text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg) transition-colors"), children: messages({ key: "views.panels.date-range-clear" }) }) })) : undefined }));
|
|
73
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ActivePanel, ViewOptionInputs } from "../model.js";
|
|
2
|
+
/**
|
|
3
|
+
* The filter DIMENSION rows for the desktop popover — shared so the unfolded
|
|
4
|
+
* root list and the folded "Filter" drill-in render the same rows in the same
|
|
5
|
+
* order. The fold changes WHERE they live, never how they look or behave.
|
|
6
|
+
*
|
|
7
|
+
* Its own module because the rows now GROUP: a column the user has hidden
|
|
8
|
+
* still carries a filter row (and a rule on it still narrows the list), but it
|
|
9
|
+
* reads under its own heading so the panel matches the table you're looking at
|
|
10
|
+
* before it offers everything else.
|
|
11
|
+
*/
|
|
12
|
+
/** The scroll box a panel's detail sits in, its inset the app's `--vk-panel-padding` (0.375rem undeclared). */
|
|
13
|
+
export declare const PANEL_SCROLL = "overflow-y-auto overscroll-contain p-(--vk-panel-padding,0.375rem)";
|
|
14
|
+
/** A section's rule and heading in the desktop filter panel: the filter list's sections, and the Where
|
|
15
|
+
* heading inside a relation's filter (POR-704). One component, so the two read as one panel. */
|
|
16
|
+
export declare function FilterSectionHeading({ children }: {
|
|
17
|
+
children: string;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function dimensionRows<S extends string, G extends string, T extends string>(filters: ViewOptionInputs<S, G, T>["filters"], timeScopeConfig: ViewOptionInputs<S, G, T>["timeScopeConfig"], dateRangeConfigs: ViewOptionInputs<S, G, T>["dateRangeConfigs"], onOpenPanel: (p: ActivePanel) => void): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
/** The consolidated Filter drill-in — the same dimension rows, one level down. */
|
|
21
|
+
export declare function CompactFilterList<S extends string, G extends string, T extends string>({ filters, timeScopeConfig, dateRangeConfigs, onOpenPanel, }: Pick<ViewOptionInputs<S, G, T>, "filters" | "timeScopeConfig" | "dateRangeConfigs"> & {
|
|
22
|
+
onOpenPanel: (p: ActivePanel) => void;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { isDateRangeActive } from "../model.js";
|
|
4
|
+
import { isFilterActive } from "../../filters/filter-model.js";
|
|
5
|
+
import { dateRangeValueLabel, filterValueLabel, timeScopeRowValueLabel } from "../labels.js";
|
|
6
|
+
import { useViews } from "../../provider/context.js";
|
|
7
|
+
import { FilterIcon } from "./FilterIcon.js";
|
|
8
|
+
export const PANEL_SCROLL = "overflow-y-auto overscroll-contain p-(--vk-panel-padding,0.375rem)";
|
|
9
|
+
function FilterRow({ filter, onOpenPanel }) {
|
|
10
|
+
const { atoms, conventions, messages } = useViews();
|
|
11
|
+
return (_jsx(atoms.MenuRow, { icon: _jsx(FilterIcon, { filter: filter, className: "h-3.5 w-3.5" }), label: filter.label, value: filterValueLabel(filter, conventions, messages), active: (filter.countsAsFilter ?? true) && isFilterActive(filter), disabled: filter.disabled, disabledReason: filter.disabledReason, onClick: () => onOpenPanel({ type: "filter", key: filter.key }) }));
|
|
12
|
+
}
|
|
13
|
+
export function FilterSectionHeading({ children }) {
|
|
14
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "border-t border-(color:--vk-border) my-1" }), _jsx("div", { className: "px-3 pt-1.5 pb-1 text-[10px] font-bold uppercase tracking-[0.15em] text-(color:--vk-fg-subtlest)", children: children })] }));
|
|
15
|
+
}
|
|
16
|
+
function filterSectionNames(filters) {
|
|
17
|
+
return [...new Set((filters ?? []).filter((f) => f.section).map((f) => f.section))];
|
|
18
|
+
}
|
|
19
|
+
function TimeScopeRow({ config, onOpenPanel, }) {
|
|
20
|
+
const { atoms, conventions, icons, messages } = useViews();
|
|
21
|
+
const Clock = icons.time;
|
|
22
|
+
return (_jsx(atoms.MenuRow, { icon: _jsx(Clock, { className: "h-3.5 w-3.5" }), label: config.label ?? messages({ key: "views.panels.time-scope-label" }), value: timeScopeRowValueLabel(config, messages, conventions), active: false, onClick: () => onOpenPanel({ type: "timeScope" }) }));
|
|
23
|
+
}
|
|
24
|
+
function DateRangeRows({ configs, onOpenPanel, }) {
|
|
25
|
+
const { atoms, conventions, icons, messages } = useViews();
|
|
26
|
+
const Calendar = icons.date;
|
|
27
|
+
return (_jsx(_Fragment, { children: configs.map((d) => (_jsx(atoms.MenuRow, { icon: _jsx(Calendar, { className: "h-3.5 w-3.5" }), label: d.label ?? messages({ key: "views.panels.date-range-label" }), value: dateRangeValueLabel(d, messages, conventions), active: isDateRangeActive(d), onClick: () => onOpenPanel({ type: "dateRange", key: d.key }) }, d.key))) }));
|
|
28
|
+
}
|
|
29
|
+
export function dimensionRows(filters, timeScopeConfig, dateRangeConfigs, onOpenPanel) {
|
|
30
|
+
const plain = (filters ?? []).filter((f) => !f.section);
|
|
31
|
+
const sections = filterSectionNames(filters);
|
|
32
|
+
return (_jsxs(_Fragment, { children: [plain.map((f) => (_jsx(FilterRow, { filter: f, onOpenPanel: onOpenPanel }, f.key))), sections.map((section) => (_jsxs("div", { children: [_jsx(FilterSectionHeading, { children: section }), (filters ?? [])
|
|
33
|
+
.filter((f) => f.section === section)
|
|
34
|
+
.map((f) => (_jsx(FilterRow, { filter: f, onOpenPanel: onOpenPanel }, f.key)))] }, section))), timeScopeConfig && _jsx(TimeScopeRow, { config: timeScopeConfig, onOpenPanel: onOpenPanel }), dateRangeConfigs && _jsx(DateRangeRows, { configs: dateRangeConfigs, onOpenPanel: onOpenPanel })] }));
|
|
35
|
+
}
|
|
36
|
+
export function CompactFilterList({ filters, timeScopeConfig, dateRangeConfigs, onOpenPanel, }) {
|
|
37
|
+
return (_jsx("div", { "data-vs-detail": true, className: `max-h-72 ${PANEL_SCROLL}`, children: dimensionRows(filters, timeScopeConfig, dateRangeConfigs, onOpenPanel) }));
|
|
38
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type OrderChoice } from "../grouping/sort-groups.js";
|
|
2
|
+
import { type ViewsMessageResolver } from "../contract.js";
|
|
3
|
+
import type { GroupConfig, GroupDimension } from "./model.js";
|
|
4
|
+
/** One pick in the Group panel's Sort (POR-498): an order in one direction. */
|
|
5
|
+
type GroupSortChoice = {
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
order: OrderChoice;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Each of the dimension's orders in both directions — its own first — then
|
|
12
|
+
* Manual, unless `manual` is false. A dimension that declares none offers its
|
|
13
|
+
* default order. A date dimension is one with granularities.
|
|
14
|
+
*/
|
|
15
|
+
export declare function groupSortChoices(dimension: GroupDimension, { manual }?: {
|
|
16
|
+
manual: boolean;
|
|
17
|
+
}, messages?: ViewsMessageResolver): GroupSortChoice[];
|
|
18
|
+
/** Whether the Group panel's Sort offers Manual: only where its groups can be
|
|
19
|
+
* dragged — a panel with a Groups section — or where Manual is already the
|
|
20
|
+
* order, so the current choice stays named and checked. */
|
|
21
|
+
export declare function offersManualOrder<D extends string>(group: GroupConfig<D>): boolean;
|
|
22
|
+
/** A choice's key: the mode and direction, or "manual" — Manual has no direction. */
|
|
23
|
+
export declare function groupSortValue(order: OrderChoice): string;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { defaultDirFor } from "../grouping/sort-groups.js";
|
|
2
|
+
import { resolveViewsMessage } from "../contract.js";
|
|
3
|
+
const flip = (dir) => (dir === "asc" ? "desc" : "asc");
|
|
4
|
+
function labelFor(option, dir, isDate, messages) {
|
|
5
|
+
if (option.value === "count") {
|
|
6
|
+
return messages({ key: dir === "desc" ? "views.panels.group-order-most" : "views.panels.group-order-fewest" });
|
|
7
|
+
}
|
|
8
|
+
if (option.value === "name") {
|
|
9
|
+
if (isDate) {
|
|
10
|
+
return messages({ key: dir === "desc" ? "views.panels.group-order-newest" : "views.panels.group-order-oldest" });
|
|
11
|
+
}
|
|
12
|
+
return messages({
|
|
13
|
+
key: dir === "asc" ? "views.panels.group-order-alphabetical" : "views.panels.group-order-reverse-alphabetical",
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return dir === "asc" ? option.label : messages({ key: "views.panels.group-order-reversed", values: { label: option.label } });
|
|
17
|
+
}
|
|
18
|
+
function fallbackLabel(mode, messages) {
|
|
19
|
+
if (mode === "count")
|
|
20
|
+
return messages({ key: "views.panels.group-order-count" });
|
|
21
|
+
if (mode === "name")
|
|
22
|
+
return messages({ key: "views.panels.group-order-name" });
|
|
23
|
+
return messages({ key: "views.panels.group-order-default" });
|
|
24
|
+
}
|
|
25
|
+
export function groupSortChoices(dimension, { manual } = { manual: true }, messages = resolveViewsMessage) {
|
|
26
|
+
const isDate = (dimension.granularities?.length ?? 0) > 0;
|
|
27
|
+
const declared = dimension.orderOptions.filter((option) => option.value !== "manual");
|
|
28
|
+
const options = declared.length > 0
|
|
29
|
+
? declared
|
|
30
|
+
: [
|
|
31
|
+
{
|
|
32
|
+
value: dimension.defaultOrder,
|
|
33
|
+
label: fallbackLabel(dimension.defaultOrder, messages),
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
const choices = options.flatMap((option) => {
|
|
37
|
+
const first = option.defaultDir ?? defaultDirFor(option.value);
|
|
38
|
+
return [first, flip(first)].map((dir) => ({
|
|
39
|
+
value: groupSortValue({ mode: option.value, dir }),
|
|
40
|
+
label: labelFor(option, dir, isDate, messages),
|
|
41
|
+
order: { mode: option.value, dir },
|
|
42
|
+
}));
|
|
43
|
+
});
|
|
44
|
+
if (!manual)
|
|
45
|
+
return choices;
|
|
46
|
+
return [
|
|
47
|
+
...choices,
|
|
48
|
+
{ value: "manual", label: messages({ key: "views.panels.group-order-manual" }), order: { mode: "manual", dir: "asc" } },
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
export function offersManualOrder(group) {
|
|
52
|
+
if (group.groups)
|
|
53
|
+
return true;
|
|
54
|
+
return group.value !== "none" && group.order[group.value]?.mode === "manual";
|
|
55
|
+
}
|
|
56
|
+
export function groupSortValue(order) {
|
|
57
|
+
return order.mode === "manual" ? "manual" : `${order.mode}:${order.dir}`;
|
|
58
|
+
}
|