@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,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useMemo } from "react";
|
|
3
|
+
import { normalizeGroupSummary, settingsChange, } from "@viewkitjs/fields/query";
|
|
4
|
+
import { withPartColumns } from "../model/part-columns.js";
|
|
5
|
+
import { LIST_VIEW_PREF_DEFAULTS } from "../model/preferences.js";
|
|
6
|
+
import { aggregatesOf, columnsChangeOf, columnStateOf, figuresChangeOf, } from "../model/settings-columns.js";
|
|
7
|
+
import { seenLook } from "../model/settings-look.js";
|
|
8
|
+
import { GRID_SCALE_MULTIPLIER } from "./core/grid-scale.js";
|
|
9
|
+
import { useGridFormatProps } from "./grid-format-props.js";
|
|
10
|
+
export function useGridTableSettings({ settings, layer, columns, parts = false, onChange, onLayerChange, defaults, formats, setFormats, }) {
|
|
11
|
+
const formatProps = useGridFormatProps(formats, setFormats, columns);
|
|
12
|
+
const drawn = useMemo(() => (parts ? withPartColumns(columns) : columns), [parts, columns]);
|
|
13
|
+
const look = useMemo(() => seenLook(settings, layer, defaults), [settings, layer, defaults]);
|
|
14
|
+
const columnState = useMemo(() => columnStateOf(settings, layer, drawn), [settings, layer, drawn]);
|
|
15
|
+
const aggregates = useMemo(() => aggregatesOf(settings, drawn), [settings, drawn]);
|
|
16
|
+
const groupSummary = useMemo(() => settings.groupFigures
|
|
17
|
+
? normalizeGroupSummary(settings.groupFigures)
|
|
18
|
+
: normalizeGroupSummary(LIST_VIEW_PREF_DEFAULTS.groupSummary), [settings.groupFigures]);
|
|
19
|
+
const write = useCallback((change) => {
|
|
20
|
+
if (Object.keys(change).length > 0)
|
|
21
|
+
onChange(change);
|
|
22
|
+
}, [onChange]);
|
|
23
|
+
const onColumnStateChange = useCallback((next) => {
|
|
24
|
+
const { change, layer: widths } = columnsChangeOf(settings, layer, next, drawn);
|
|
25
|
+
write(change);
|
|
26
|
+
if (widths)
|
|
27
|
+
onLayerChange(widths);
|
|
28
|
+
}, [settings, layer, drawn, write, onLayerChange]);
|
|
29
|
+
const onGroupSummaryChange = useCallback((part, on) => {
|
|
30
|
+
const groupFigures = on
|
|
31
|
+
? Array.from(new Set([...groupSummary, part]))
|
|
32
|
+
: groupSummary.filter((held) => held !== part);
|
|
33
|
+
write(settingsChange(settings, { ...settings, groupFigures }));
|
|
34
|
+
}, [groupSummary, settings, write]);
|
|
35
|
+
const onAggregateChange = useCallback((columnId, kind) => write(figuresChangeOf(settings, { ...aggregates, [columnId]: kind }, drawn)), [settings, aggregates, drawn, write]);
|
|
36
|
+
const gridProps = useMemo(() => ({
|
|
37
|
+
verticalBorders: look.verticalBorders,
|
|
38
|
+
showRowIcon: look.rowIcon,
|
|
39
|
+
freezeIdentity: look.freezeIdentity,
|
|
40
|
+
alwaysCheckboxes: look.alwaysCheckboxes,
|
|
41
|
+
scale: GRID_SCALE_MULTIPLIER[look.density],
|
|
42
|
+
...formatProps,
|
|
43
|
+
columnState,
|
|
44
|
+
onColumnStateChange,
|
|
45
|
+
groupSummary,
|
|
46
|
+
onGroupSummaryChange,
|
|
47
|
+
aggregates,
|
|
48
|
+
onAggregateChange,
|
|
49
|
+
viewBacked: true,
|
|
50
|
+
}), [
|
|
51
|
+
look,
|
|
52
|
+
formatProps,
|
|
53
|
+
columnState,
|
|
54
|
+
onColumnStateChange,
|
|
55
|
+
groupSummary,
|
|
56
|
+
onGroupSummaryChange,
|
|
57
|
+
aggregates,
|
|
58
|
+
onAggregateChange,
|
|
59
|
+
]);
|
|
60
|
+
return { gridProps };
|
|
61
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Who sets the width and padding of the popover around a whole body your app hands: ViewKit (`views`, the default) or
|
|
2
|
+
* your `Popover` (`popover`). */
|
|
3
|
+
export type ViewsBodyFrame = "views" | "popover";
|
|
4
|
+
/** Which of the app's whole bodies an editor opens: its `Picker`, its `PartsBody` or its `ValuesBody`. */
|
|
5
|
+
export type ViewsBodyKind = "picker" | "parts" | "values";
|
|
6
|
+
/**
|
|
7
|
+
* The class and the data a host hands its popover. `body` is the app's body the editor opens, or null when it draws
|
|
8
|
+
* ViewKit's own; `viewkit` is ViewKit's width and padding, `kept` what isn't look (the layer, a screen cap). At
|
|
9
|
+
* `popover` with a body, only `kept` and the mark `data-vk-body`; otherwise today's classes and no mark.
|
|
10
|
+
*/
|
|
11
|
+
export declare function bodyPanel(frame: ViewsBodyFrame | undefined, body: ViewsBodyKind | null, viewkit: string, kept: string): {
|
|
12
|
+
className: string;
|
|
13
|
+
data: {
|
|
14
|
+
"data-vk-body"?: ViewsBodyKind;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { type FieldConventions } from "@viewkitjs/fields";
|
|
2
2
|
import { type ViewsMessageResolver } from "../contract.js";
|
|
3
|
+
import { type ViewsOneValueEditors } from "./one-value.js";
|
|
3
4
|
import type { ListColumn } from "./column-schema.js";
|
|
4
5
|
import { type GridEditorId } from "./column-types.js";
|
|
5
6
|
export type { GridEditorId };
|
|
6
|
-
|
|
7
|
+
/** The editor a column opens. `oneValue` is the provider's rule for a single email or domain (`ViewsProvider`'s
|
|
8
|
+
* `oneValue`): where it says `list`, the value list holding one value. */
|
|
9
|
+
export declare function gridEditorKind<Row>(col: ListColumn<Row>, oneValue?: ViewsOneValueEditors): GridEditorId | null;
|
|
7
10
|
export declare function gridColumnHasEditor<Row>(col: ListColumn<Row>): boolean;
|
|
8
11
|
/**
|
|
9
12
|
* The grid's WRITE policy — what a column accepts, and in what shape.
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { acceptFieldCommit, isMultipleType, lockReason, relationIdOf, valueTypeOf, } from "@viewkitjs/fields";
|
|
2
2
|
import { resolveViewsMessage } from "../contract.js";
|
|
3
|
+
import { opensAsList } from "./one-value.js";
|
|
3
4
|
import { prettifyOptionValue, resolveColumnOrder } from "./column-state.js";
|
|
4
5
|
import { typeRule } from "./column-types.js";
|
|
5
6
|
import { fieldKeyOf } from "./view-rules.js";
|
|
6
|
-
export function gridEditorKind(col) {
|
|
7
|
+
export function gridEditorKind(col, oneValue) {
|
|
7
8
|
if (!col.editable || !col.type)
|
|
8
9
|
return null;
|
|
9
10
|
if (col.partOf?.part === "countryCode")
|
|
10
11
|
return "select";
|
|
11
12
|
if (col.multiple)
|
|
12
13
|
return col.field && col.type && isMultipleType(col.type) ? "values" : null;
|
|
14
|
+
if (col.field && opensAsList(col.field.type, false, oneValue))
|
|
15
|
+
return "values";
|
|
13
16
|
if (col.type === "title" && col.field && valueTypeOf(col.field) === "name")
|
|
14
17
|
return "name";
|
|
15
18
|
if (col.type === "location")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { type FieldConventions } from "@viewkitjs/fields";
|
|
3
|
-
import type
|
|
3
|
+
import { type ViewsMessageResolver } from "../contract.js";
|
|
4
4
|
import type { FilterConfig } from "../filters/filter-model.js";
|
|
5
5
|
import type { ListColumn, ListRelationValue } from "./column-schema.js";
|
|
6
6
|
import { type ListFilterEditor } from "./column-types.js";
|
|
@@ -25,7 +25,8 @@ import type { ListFilterCapabilities } from "./filter-capabilities.js";
|
|
|
25
25
|
* type in `column-types.ts`, beside that type's editor and paste rules. */
|
|
26
26
|
export type { ListFilterEditor };
|
|
27
27
|
export declare function filterEditor<Row>(col: ListColumn<Row>): ListFilterEditor | null;
|
|
28
|
-
/** Section label for filters whose column is currently hidden from the table
|
|
28
|
+
/** Section label for filters whose column is currently hidden from the table, in the package's English: the builder
|
|
29
|
+
* words it through `views.panels.hidden-columns`, so an app's `messages` name it in its own words (VK-505). */
|
|
29
30
|
export declare const HIDDEN_COLUMN_SECTION = "Hidden columns";
|
|
30
31
|
/** The decimals the cell is showing: the workspace's per-FIELD override wins
|
|
31
32
|
* over the column's declared default, so equality rounds to what is on
|
|
@@ -39,7 +40,9 @@ export declare function numberDecimals<Row>(col: ListColumn<Row>, overrides?: Re
|
|
|
39
40
|
* you translate between the two. `format.booleanDisplay` already decides how
|
|
40
41
|
* the cell reads, so it decides how the filter reads.
|
|
41
42
|
*/
|
|
42
|
-
export declare function booleanFilterOptions<Row>(col: ListColumn<Row
|
|
43
|
+
export declare function booleanFilterOptions<Row>(col: ListColumn<Row>,
|
|
44
|
+
/** The app's words for the choices (VK-507); the package's English by default. */
|
|
45
|
+
messages?: ViewsMessageResolver): {
|
|
43
46
|
value: string;
|
|
44
47
|
label: string;
|
|
45
48
|
}[];
|
|
@@ -98,7 +101,7 @@ export declare function buildColumnFilters<Row>({ columns, order, declared, icon
|
|
|
98
101
|
parts?: boolean;
|
|
99
102
|
/** Words for part rows; the package's English by default. */
|
|
100
103
|
messages?: ViewsMessageResolver;
|
|
101
|
-
/** The
|
|
104
|
+
/** The language a country's name is read in (`conventions.language`); English by default. */
|
|
102
105
|
conventions?: FieldConventions;
|
|
103
106
|
}): FilterConfig<string>[];
|
|
104
107
|
export declare function rowMatchesRules<Row>(row: Row, rules: ListFilterRuleState, columns: ListColumn<Row>[],
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { actorKey, COUNTRY_CODES, countryName, isIntegerField, isMultipleType, isOpenVocabulary, presentedDef, relationKey, scalarOf, valueItems, valueTypeOf, } from "@viewkitjs/fields";
|
|
2
2
|
import { matchesRule, operatorsFor } from "@viewkitjs/fields/query";
|
|
3
|
+
import { resolveViewsMessage } from "../contract.js";
|
|
3
4
|
import { rangeUnit } from "../fields/range-unit.js";
|
|
4
5
|
import { rangeEndFormat } from "./part-columns.js";
|
|
5
6
|
import { FILTER_PART_ROWS, parsePartKey, partKey, partLabel } from "./part-rows.js";
|
|
7
|
+
import { keptParts } from "./place-parts.js";
|
|
6
8
|
import { phoneFilterOperand, phoneMatchText, readPhone } from "@viewkitjs/fields/phone";
|
|
7
9
|
import { isTextRuleActive, matchesTextRule } from "../filters/text-filter.js";
|
|
8
10
|
import { matchesNameRule } from "@viewkitjs/fields/query";
|
|
@@ -19,7 +21,7 @@ export function filterEditor(col) {
|
|
|
19
21
|
}
|
|
20
22
|
const WIRED_EDITORS = new Set(["text", "options", "boolean", "number", "date", "range"]);
|
|
21
23
|
const NAMED_VALUE_TYPES = new Set(["relation", "user", "actor"]);
|
|
22
|
-
function relationOptions(known, names, onScreen) {
|
|
24
|
+
function relationOptions(known, names, onScreen, locale) {
|
|
23
25
|
const byId = new Map();
|
|
24
26
|
for (const id of known ?? []) {
|
|
25
27
|
const name = names?.[id];
|
|
@@ -31,7 +33,7 @@ function relationOptions(known, names, onScreen) {
|
|
|
31
33
|
byId.set(value.id, value.label);
|
|
32
34
|
return [...byId]
|
|
33
35
|
.map(([value, label]) => ({ value, label }))
|
|
34
|
-
.sort((a, b) => a.label.localeCompare(b.label));
|
|
36
|
+
.sort((a, b) => a.label.localeCompare(b.label, locale));
|
|
35
37
|
}
|
|
36
38
|
export const HIDDEN_COLUMN_SECTION = "Hidden columns";
|
|
37
39
|
export function numberDecimals(col, overrides) {
|
|
@@ -53,28 +55,29 @@ function numberUnit(col) {
|
|
|
53
55
|
function rangeEndDecimals(field, key, overrides) {
|
|
54
56
|
return overrides?.[key] ?? rangeEndFormat(field).decimals ?? 2;
|
|
55
57
|
}
|
|
56
|
-
export function booleanFilterOptions(col) {
|
|
58
|
+
export function booleanFilterOptions(col, messages = resolveViewsMessage) {
|
|
57
59
|
const display = col.format?.booleanDisplay ?? "checkbox";
|
|
58
60
|
if (display === "marker") {
|
|
59
61
|
const label = col.marker?.label ?? columnLabel(col).toLowerCase();
|
|
60
62
|
return [
|
|
61
63
|
{ value: "true", label: label.charAt(0).toUpperCase() + label.slice(1) },
|
|
62
|
-
{ value: "false", label:
|
|
64
|
+
{ value: "false", label: messages({ key: "views.panels.boolean-not", values: { label } }) },
|
|
63
65
|
];
|
|
64
66
|
}
|
|
65
67
|
if (display === "text") {
|
|
66
|
-
const labelFor = (value
|
|
68
|
+
const labelFor = (value) => col.options?.find((o) => o.value === value)?.label ?? messages({ key: "views.display.boolean", values: { value } });
|
|
67
69
|
return [
|
|
68
|
-
{ value: "true", label: labelFor("true"
|
|
69
|
-
{ value: "false", label: labelFor("false"
|
|
70
|
+
{ value: "true", label: labelFor("true") },
|
|
71
|
+
{ value: "false", label: labelFor("false") },
|
|
70
72
|
];
|
|
71
73
|
}
|
|
72
74
|
return [
|
|
73
|
-
{ value: "true", label: "
|
|
74
|
-
{ value: "false", label: "
|
|
75
|
+
{ value: "true", label: messages({ key: "views.panels.boolean-checked" }) },
|
|
76
|
+
{ value: "false", label: messages({ key: "views.panels.boolean-unchecked" }) },
|
|
75
77
|
];
|
|
76
78
|
}
|
|
77
79
|
export function buildColumnFilters({ columns, order, declared = [], icon, rules = {}, onRuleChange, selectValues = {}, relationValues = {}, decimals, columnState, viewId, capabilities, knownValues = {}, knownLabels = {}, onValuesWanted, parts = false, messages, conventions, }) {
|
|
80
|
+
const word = messages ?? resolveViewsMessage;
|
|
78
81
|
const declaredByKey = new Map(declared.map((f) => [f.key, f]));
|
|
79
82
|
const claimed = new Set();
|
|
80
83
|
const buildOne = (col) => {
|
|
@@ -135,7 +138,7 @@ export function buildColumnFilters({ columns, order, declared = [], icon, rules
|
|
|
135
138
|
icon: icon?.(col),
|
|
136
139
|
editor: "range",
|
|
137
140
|
value: rule ? { operator: rule.operator, value: rule.value, value2: rule.value2 } : null,
|
|
138
|
-
unit: range
|
|
141
|
+
unit: range ? rangeUnit(range) : undefined,
|
|
139
142
|
presets: range?.presets,
|
|
140
143
|
onChange: (next) => onRuleChange?.(col.id, next ? { editor: "range", ...next } : null),
|
|
141
144
|
};
|
|
@@ -167,10 +170,10 @@ export function buildColumnFilters({ columns, order, declared = [], icon, rules
|
|
|
167
170
|
const values = open ? [...new Set([...(knownValues[col.id] ?? []), ...onScreen])] : onScreen;
|
|
168
171
|
const named = !!col.field && NAMED_VALUE_TYPES.has(col.field.type);
|
|
169
172
|
const options = editor === "boolean"
|
|
170
|
-
? booleanFilterOptions(col)
|
|
173
|
+
? booleanFilterOptions(col, word)
|
|
171
174
|
:
|
|
172
175
|
col.type === "relation" || col.type === "user" || col.type === "actor"
|
|
173
|
-
? relationOptions(knownValues[col.id], knownLabels[col.id], relationValues[col.id])
|
|
176
|
+
? relationOptions(knownValues[col.id], knownLabels[col.id], relationValues[col.id], conventions?.locale)
|
|
174
177
|
: values.map((value) => ({
|
|
175
178
|
value,
|
|
176
179
|
label: col.options?.find((o) => o.value === value)?.label ??
|
|
@@ -185,7 +188,7 @@ export function buildColumnFilters({ columns, order, declared = [], icon, rules
|
|
|
185
188
|
value: stored?.editor === "options" ? stored.values : [],
|
|
186
189
|
options,
|
|
187
190
|
onChange: (next) => onRuleChange?.(col.id, next.length ? { editor: "options", values: next } : null),
|
|
188
|
-
emptyLabel:
|
|
191
|
+
emptyLabel: word({ key: "views.panels.filter-all-of", values: { field: columnLabel(col) } }),
|
|
189
192
|
};
|
|
190
193
|
}
|
|
191
194
|
return {
|
|
@@ -197,7 +200,12 @@ export function buildColumnFilters({ columns, order, declared = [], icon, rules
|
|
|
197
200
|
options: [],
|
|
198
201
|
onChange: () => { },
|
|
199
202
|
disabled: !wired,
|
|
200
|
-
...(wired
|
|
203
|
+
...(wired
|
|
204
|
+
? {}
|
|
205
|
+
: {
|
|
206
|
+
valueLabel: "—",
|
|
207
|
+
disabledReason: word({ key: "views.panels.filter-not-offered" }),
|
|
208
|
+
}),
|
|
201
209
|
};
|
|
202
210
|
};
|
|
203
211
|
const buildPartRows = (col) => {
|
|
@@ -207,13 +215,13 @@ export function buildColumnFilters({ columns, order, declared = [], icon, rules
|
|
|
207
215
|
return [];
|
|
208
216
|
const field = col.field;
|
|
209
217
|
const type = valueTypeOf(field);
|
|
210
|
-
return (FILTER_PART_ROWS[type] ?? []).map((part) => {
|
|
218
|
+
return keptParts(field, FILTER_PART_ROWS[type] ?? []).map((part) => {
|
|
211
219
|
const key = partKey(col.id, part);
|
|
212
220
|
const label = partLabel(columnLabel(col), type, part, messages);
|
|
213
221
|
const stored = rules[key];
|
|
214
222
|
if (operatorsFor(type, part)[0] === "is_any_of") {
|
|
215
223
|
const offered = [...new Set([...(knownValues[key] ?? []), ...(selectValues[key] ?? [])])];
|
|
216
|
-
const locale = conventions?.
|
|
224
|
+
const locale = conventions?.language;
|
|
217
225
|
return {
|
|
218
226
|
key,
|
|
219
227
|
label,
|
|
@@ -255,7 +263,7 @@ export function buildColumnFilters({ columns, order, declared = [], icon, rules
|
|
|
255
263
|
const partRows = buildPartRows(col);
|
|
256
264
|
const own = partRows.length && col.field && valueTypeOf(col.field) === "location" ? [] : [buildOne(col)];
|
|
257
265
|
const hidden = isColumnHidden(col, columnState, viewId);
|
|
258
|
-
return [...own, ...partRows].map((built) => built.section || !hidden ? built : { ...built, section:
|
|
266
|
+
return [...own, ...partRows].map((built) => built.section || !hidden ? built : { ...built, section: word({ key: "views.panels.hidden-columns" }) });
|
|
259
267
|
});
|
|
260
268
|
return [...derived, ...declared.filter((f) => !claimed.has(f.key))];
|
|
261
269
|
}
|
|
@@ -287,7 +295,7 @@ function partRuleMatches(row, key, rule, columns, decimals, conventions) {
|
|
|
287
295
|
if (!col?.field || !col.accessor)
|
|
288
296
|
return true;
|
|
289
297
|
const type = valueTypeOf(col.field);
|
|
290
|
-
if (!FILTER_PART_ROWS[type]
|
|
298
|
+
if (!keptParts(col.field, FILTER_PART_ROWS[type] ?? []).includes(part))
|
|
291
299
|
return true;
|
|
292
300
|
const filterRule = fromListFilterRule(fieldKeyOf(col), type, rule, part);
|
|
293
301
|
const shown = type === "range" ? { decimals: rangeEndDecimals(col.field, key, decimals) } : {};
|
|
@@ -23,5 +23,6 @@ export declare function gridColumnInspectable<Row>(col: ListColumn<Row>): boolea
|
|
|
23
23
|
* measure (`gridCellCutOff`). */
|
|
24
24
|
export declare function isWholeTextColumn<Row>(col: ListColumn<Row>): boolean;
|
|
25
25
|
/** Whether an open text cell is drawn in the panel over the cell rather than in the cell: a
|
|
26
|
-
* paragraph always, a line when it opened `whole` (cut off when it was opened).
|
|
27
|
-
|
|
26
|
+
* paragraph always, a line when it opened `whole` (cut off when it was opened). `inCell`: an app's text body is
|
|
27
|
+
* handed and the cell is writable: the body stands in the cell, so nothing opens the panel. */
|
|
28
|
+
export declare function gridTextOpensBox<Row>(col: ListColumn<Row>, whole: boolean, inCell?: boolean): boolean;
|
|
@@ -10,6 +10,8 @@ export function isWholeTextColumn(col) {
|
|
|
10
10
|
return !col.format?.long;
|
|
11
11
|
return col.type === "title" && !(col.field && valueTypeOf(col.field) === "name");
|
|
12
12
|
}
|
|
13
|
-
export function gridTextOpensBox(col, whole) {
|
|
13
|
+
export function gridTextOpensBox(col, whole, inCell = false) {
|
|
14
|
+
if (inCell)
|
|
15
|
+
return false;
|
|
14
16
|
return isLongTextColumn(col) || (whole && isWholeTextColumn(col));
|
|
15
17
|
}
|
|
@@ -15,3 +15,14 @@ import type { ListColumn } from "./column-schema.js";
|
|
|
15
15
|
* nothing to compare.
|
|
16
16
|
*/
|
|
17
17
|
export declare function effectiveSortKey<Row>(col: ListColumn<Row>, viewBacked: boolean): string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* THE PARTS A PLACE COLUMN SORTS BY, from its header and the Sort panel.
|
|
20
|
+
*
|
|
21
|
+
* A place has no whole sort (`effectiveSortKey`), but it sorts by one of its parts: the sort's value is the part
|
|
22
|
+
* key `partKey(field.key, part)`, which a host reads back with `parsePartKey`. Offered on the same terms as a
|
|
23
|
+
* field's own sort (a saved view, a display read, no declared `sortKey`, not `sortable: false`), and narrowed to the
|
|
24
|
+
* parts the field states it holds.
|
|
25
|
+
*/
|
|
26
|
+
export declare function columnSortParts<Row>(col: ListColumn<Row>, viewBacked: boolean): readonly string[];
|
|
27
|
+
/** The part a place column sorts by while `value` (a list's sort value) is one of its part keys; else undefined. */
|
|
28
|
+
export declare function sortPartOf(value: string, fieldKey: string, parts: readonly string[]): string | undefined;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { valueTypeOf } from "@viewkitjs/fields";
|
|
2
|
+
import { SORT_PART_ROWS, parsePartKey } from "./part-rows.js";
|
|
3
|
+
import { keptParts } from "./place-parts.js";
|
|
2
4
|
export function effectiveSortKey(col, viewBacked) {
|
|
3
5
|
if (col.sortable === false)
|
|
4
6
|
return undefined;
|
|
@@ -9,3 +11,15 @@ export function effectiveSortKey(col, viewBacked) {
|
|
|
9
11
|
const type = valueTypeOf(col.field);
|
|
10
12
|
return type === "location" || type === "rich_text" ? undefined : col.field.key;
|
|
11
13
|
}
|
|
14
|
+
export function columnSortParts(col, viewBacked) {
|
|
15
|
+
if (col.sortable === false || col.sortKey || !viewBacked || !col.field || !col.accessor)
|
|
16
|
+
return [];
|
|
17
|
+
const field = col.field;
|
|
18
|
+
if (valueTypeOf(field) !== "location")
|
|
19
|
+
return [];
|
|
20
|
+
return keptParts(field, SORT_PART_ROWS.location ?? []);
|
|
21
|
+
}
|
|
22
|
+
export function sortPartOf(value, fieldKey, parts) {
|
|
23
|
+
const { id, part } = parsePartKey(value);
|
|
24
|
+
return id === fieldKey && part !== undefined && parts.includes(part) ? part : undefined;
|
|
25
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FieldType } from "@viewkitjs/fields";
|
|
2
|
+
/** Whether a field holding one email or one domain opens the text box in its cell (`text`, the default) or the value list
|
|
3
|
+
* holding one value (`list`). */
|
|
4
|
+
export type ViewsOneValueEditors = Partial<Record<"email" | "domain", "text" | "list">>;
|
|
5
|
+
/** A single (not `multiple`) email or domain field the provider's rule opens as a list of one. */
|
|
6
|
+
export declare function opensAsList(type: FieldType | undefined, multiple: boolean | undefined, rules: ViewsOneValueEditors | undefined): boolean;
|
package/dist/model/part-write.js
CHANGED
|
@@ -35,7 +35,7 @@ export function gridPartWrite(part, wholeStored, next, conventions, options = {}
|
|
|
35
35
|
}
|
|
36
36
|
else if (type === "location") {
|
|
37
37
|
if (of.part === "countryCode" && typeof value === "string")
|
|
38
|
-
value = countryCodeOf(value, [conventions.locale, "en"]) ?? value.trim();
|
|
38
|
+
value = countryCodeOf(value, [conventions.language, conventions.locale, "en"]) ?? value.trim();
|
|
39
39
|
whole = withLocationPart(wholeStored, of.part, value == null ? null : String(value));
|
|
40
40
|
}
|
|
41
41
|
else if (type === "range") {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type FieldDef } from "@viewkitjs/fields";
|
|
2
|
+
/** The field a lookup reaches at the end of its chain (`target` after `target`); any other field, itself. */
|
|
3
|
+
export declare function farField(field: FieldDef): FieldDef;
|
|
4
|
+
/** `offered` narrowed to the parts the column's place keeps: its own field's `parts`, or, for a lookup, its far
|
|
5
|
+
* field's. A field that is no place, or a place that names no parts, keeps `offered` as it is. */
|
|
6
|
+
export declare function keptParts(field: FieldDef, offered: readonly string[]): readonly string[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { valueTypeOf } from "@viewkitjs/fields";
|
|
2
|
+
export function farField(field) {
|
|
3
|
+
let at = field;
|
|
4
|
+
while (at.type === "lookup" && at.target)
|
|
5
|
+
at = at.target;
|
|
6
|
+
return at;
|
|
7
|
+
}
|
|
8
|
+
export function keptParts(field, offered) {
|
|
9
|
+
if (valueTypeOf(field) !== "location")
|
|
10
|
+
return offered;
|
|
11
|
+
const place = farField(field);
|
|
12
|
+
const held = place.type === "location" ? place.parts : undefined;
|
|
13
|
+
return held ? offered.filter((part) => held.includes(part)) : offered;
|
|
14
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { type FieldDef } from "@viewkitjs/fields";
|
|
2
|
+
import { type FieldConventions, type FieldDef } from "@viewkitjs/fields";
|
|
3
3
|
import type { FilterRelationRule } from "@viewkitjs/fields/query";
|
|
4
|
+
import { type ViewsMessageResolver } from "../contract.js";
|
|
4
5
|
import type { FilterConfigRelation } from "../filters/filter-model.js";
|
|
5
6
|
import type { ListColumn } from "./column-schema.js";
|
|
6
7
|
export type RelationFilterTarget = {
|
|
@@ -13,6 +14,12 @@ export type RelationFilterTarget = {
|
|
|
13
14
|
/** The far fields whose values the list's route answers by name (POR-1548): a far relation, user or actor the
|
|
14
15
|
* builder can name. A far field left out stays greyed. */
|
|
15
16
|
named?: readonly string[];
|
|
17
|
+
/** The far record's noun in the app's words, one and many: "campaign", "campaigns" (VK-507). Absent, it is the
|
|
18
|
+
* kind with its hyphens as spaces, and the label lower-cased in the conventions' locale. */
|
|
19
|
+
noun?: {
|
|
20
|
+
one: string;
|
|
21
|
+
many: string;
|
|
22
|
+
};
|
|
16
23
|
};
|
|
17
24
|
/** What separates a far path's hops and its far field (POR-1548): `executions.campaign`. A field key never holds one. */
|
|
18
25
|
export declare const FAR_PATH_SEPARATOR = ".";
|
|
@@ -30,7 +37,7 @@ export type FarValues = {
|
|
|
30
37
|
labels?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
31
38
|
onWanted: (path: string) => void;
|
|
32
39
|
};
|
|
33
|
-
export declare function buildRelationFilters({ targets, rules, onRuleChange, subject, icon, fieldIcon, farValues, }: {
|
|
40
|
+
export declare function buildRelationFilters({ targets, rules, onRuleChange, subject, icon, fieldIcon, farValues, messages, conventions, }: {
|
|
34
41
|
targets: Readonly<Record<string, RelationFilterTarget>>;
|
|
35
42
|
rules: Readonly<Record<string, FilterRelationRule>>;
|
|
36
43
|
onRuleChange: (fieldKey: string, rule: FilterRelationRule | null) => void;
|
|
@@ -40,5 +47,9 @@ export declare function buildRelationFilters({ targets, rules, onRuleChange, sub
|
|
|
40
47
|
fieldIcon?: (col: ListColumn<FarRow>) => ReactNode;
|
|
41
48
|
/** The far values the host answers by path (POR-1548). Absent: every far relation, user or actor stays greyed. */
|
|
42
49
|
farValues?: FarValues;
|
|
50
|
+
/** The app's words, for the section and the Where rows; the package's English by default. */
|
|
51
|
+
messages?: ViewsMessageResolver;
|
|
52
|
+
/** The reader's conventions, for the Where rows (a far place's country names); English by default. */
|
|
53
|
+
conventions?: FieldConventions;
|
|
43
54
|
}): FilterConfigRelation[];
|
|
44
55
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { presentedDef, valueTypeOf } from "@viewkitjs/fields";
|
|
2
|
+
import { resolveViewsMessage } from "../contract.js";
|
|
2
3
|
import { canChooseEvery, whereRulesOf, withWhereRule } from "../filters/relation-filter.js";
|
|
3
4
|
import { buildColumnFilters } from "./column-filters.js";
|
|
4
5
|
export const FAR_PATH_SEPARATOR = ".";
|
|
5
6
|
export function farPathOf(relationKey, farKey) {
|
|
6
7
|
return `${relationKey}${FAR_PATH_SEPARATOR}${farKey}`;
|
|
7
8
|
}
|
|
8
|
-
const RELATED_RECORDS_SECTION = "Related records";
|
|
9
9
|
const RELATION_KEY_PREFIX = "relation:";
|
|
10
10
|
export function relationFilterKey(fieldKey) {
|
|
11
11
|
return `${RELATION_KEY_PREFIX}${fieldKey}`;
|
|
@@ -32,7 +32,7 @@ function farColumn(key, def, named) {
|
|
|
32
32
|
...(greyed ? {} : { accessor: (row) => row[def.key] }),
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
export function buildRelationFilters({ targets, rules, onRuleChange, subject, icon, fieldIcon, farValues, }) {
|
|
35
|
+
export function buildRelationFilters({ targets, rules, onRuleChange, subject, icon, fieldIcon, farValues, messages, conventions, }) {
|
|
36
36
|
return Object.entries(targets).map(([key, target]) => {
|
|
37
37
|
const rule = rules[key] ?? null;
|
|
38
38
|
const named = new Set(farValues ? (target.named ?? []) : []);
|
|
@@ -50,6 +50,8 @@ export function buildRelationFilters({ targets, rules, onRuleChange, subject, ic
|
|
|
50
50
|
rules: whereRulesOf(rule, target.fields),
|
|
51
51
|
onRuleChange: (farKey, listRule) => onRuleChange(key, withWhereRule(key, rule, target.fields[farKey], listRule, target.fields)),
|
|
52
52
|
icon: fieldIcon,
|
|
53
|
+
...(messages ? { messages } : {}),
|
|
54
|
+
...(conventions ? { conventions } : {}),
|
|
53
55
|
...(farValues && named.size
|
|
54
56
|
? {
|
|
55
57
|
knownValues: byFarKey((path) => farValues.values[path]),
|
|
@@ -65,11 +67,14 @@ export function buildRelationFilters({ targets, rules, onRuleChange, subject, ic
|
|
|
65
67
|
key: relationFilterKey(key),
|
|
66
68
|
label: target.label,
|
|
67
69
|
icon,
|
|
68
|
-
section:
|
|
70
|
+
section: (messages ?? resolveViewsMessage)({ key: "views.panels.related-records" }),
|
|
69
71
|
editor: "relation",
|
|
70
72
|
value: rule,
|
|
71
73
|
onChange: (next) => onRuleChange(key, next),
|
|
72
|
-
noun:
|
|
74
|
+
noun: target.noun ?? {
|
|
75
|
+
one: target.kind.replaceAll("-", " "),
|
|
76
|
+
many: target.label.toLocaleLowerCase(conventions?.locale),
|
|
77
|
+
},
|
|
73
78
|
subject,
|
|
74
79
|
where,
|
|
75
80
|
canEvery: canChooseEvery(rule, target.fields),
|
package/dist/model/row-icon.d.ts
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import type { StatusSlot } from "@viewkitjs/fields/design/status-slots";
|
|
2
|
-
/** A
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
/** A row's own picture before its name: whose it is, its url and its kind, handed to the app's `Avatar` atom
|
|
3
|
+
* at the glyph's size. A record's logo, a person's photo, or initials when the app's Avatar draws them. */
|
|
4
|
+
export type ListRowAvatar = {
|
|
5
|
+
label: string;
|
|
6
|
+
avatarUrl?: string | null;
|
|
7
|
+
kind?: string;
|
|
8
|
+
};
|
|
9
|
+
/** A glyph, optionally tinted, optionally the row's picture. `tone` takes
|
|
10
|
+
* semantic slots only — a row icon that carries color is saying something
|
|
11
|
+
* about STATE, which is the one thing worth spending color on here. Omit it
|
|
12
|
+
* (the overwhelmingly common case) and the chassis draws the glyph in its
|
|
13
|
+
* secondary text colour. With `avatar`, the app's `Avatar` draws the row's
|
|
14
|
+
* picture, sized by `--vk-glyph`, and the glyph is what it draws without one. */
|
|
7
15
|
export type ListRowIcon = {
|
|
8
16
|
icon: string;
|
|
9
17
|
tone?: StatusSlot;
|
|
18
|
+
avatar?: ListRowAvatar;
|
|
10
19
|
};
|
|
11
20
|
/**
|
|
12
21
|
* What a list declares. Return the icon alone for the neutral default, or the
|
|
13
|
-
* descriptor object to tint it. `null` skips the
|
|
22
|
+
* descriptor object to tint it or to draw the row's picture. `null` skips the
|
|
23
|
+
* glyph for that row.
|
|
14
24
|
*/
|
|
15
25
|
export type ListRowIconAccessor<Row> = (row: Row) => string | ListRowIcon | null;
|
|
16
26
|
/** Collapses both accepted return shapes into the descriptor form. A bare glyph
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ListColumnState, type ListPersonalLayer, type ListSettings, type ListSettingsChange } from "@viewkitjs/fields/query";
|
|
2
|
+
import type { ListAggregateKind, ListColumn } from "./column-schema.js";
|
|
3
|
+
/** Which settings column a grid column is: its field's key and, for a part column, the part. */
|
|
4
|
+
export type SettingsColumnRef = {
|
|
5
|
+
key: string;
|
|
6
|
+
part?: string;
|
|
7
|
+
};
|
|
8
|
+
/** Which settings column a grid column is. A column with no field is named by its id (a computed column's). */
|
|
9
|
+
export declare function columnRefOf<Row>(column: ListColumn<Row>): SettingsColumnRef;
|
|
10
|
+
/** A settings column's id, as a person's layer keys its width: its key, or its key and part (`partKey`). */
|
|
11
|
+
export declare function settingsColumnId(ref: SettingsColumnRef): string;
|
|
12
|
+
/** Whether the settings may place a grid column: a field's column, a part of one, or a computed column. */
|
|
13
|
+
export declare function isSettingsColumn<Row>(column: ListColumn<Row> | undefined): column is ListColumn<Row>;
|
|
14
|
+
/** The settings' columns as the grid's column state: the order the settings place them in, which are hidden (and
|
|
15
|
+
* which hidden-by-default ones are shown), the line breaks, and every width, the person's over the view's. Keyed by
|
|
16
|
+
* the grid's column ids; a settings column no grid column draws is left out. */
|
|
17
|
+
export declare function columnStateOf<Row>(settings: ListSettings, layer: ListPersonalLayer, columns: readonly ListColumn<Row>[]): ListColumnState;
|
|
18
|
+
/** A column state the grid or the Columns panel hands back, as what it changes in the settings and in the person's
|
|
19
|
+
* layer. The settings' columns follow the state's order, visibility and line breaks, keeping each column's default
|
|
20
|
+
* width and figure; a field placed for the first time takes its column's own figure. A width that differs from what
|
|
21
|
+
* the person sees goes to their layer, merged over the widths it holds; nothing else does. */
|
|
22
|
+
export declare function columnsChangeOf<Row>(settings: ListSettings, layer: ListPersonalLayer, state: ListColumnState, columns: readonly ListColumn<Row>[]): {
|
|
23
|
+
change: ListSettingsChange;
|
|
24
|
+
layer: ListPersonalLayer | null;
|
|
25
|
+
};
|
|
26
|
+
/** Each placed column's figure by grid column id; `none` where the view keeps none for a column that declares a
|
|
27
|
+
* default, since the absence of a figure is the view's answer there. */
|
|
28
|
+
export declare function aggregatesOf<Row>(settings: ListSettings, columns: readonly ListColumn<Row>[]): Record<string, ListAggregateKind>;
|
|
29
|
+
/** The figures picked per grid column id, as a change to the settings' columns. A computed column is never totalled;
|
|
30
|
+
* `none` and `ratio` keep no figure. */
|
|
31
|
+
export declare function figuresChangeOf<Row>(settings: ListSettings, aggregates: Readonly<Record<string, ListAggregateKind>>, columns: readonly ListColumn<Row>[]): ListSettingsChange;
|
|
32
|
+
/** The Columns panel's reset, as a change: every column the settings place shown unless hidden by default, no line
|
|
33
|
+
* breaks, the order, widths and figures kept. Empty when the settings already are that. */
|
|
34
|
+
export declare function columnsReset<Row>(settings: ListSettings, columns: readonly ListColumn<Row>[]): ListSettingsChange;
|