@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
|
@@ -8,6 +8,7 @@ import { useKnownKinds } from "../../editors/relation-kinds.js";
|
|
|
8
8
|
import { useViews } from "../../provider/context.js";
|
|
9
9
|
import { OPTION_ROW_INSET } from "./host.js";
|
|
10
10
|
import { useRowEditSession } from "./row-session.js";
|
|
11
|
+
import { useBodyPanel } from "../../editors/body-panel.js";
|
|
11
12
|
export function RowRelationEditor(props) {
|
|
12
13
|
const { field } = props;
|
|
13
14
|
if (field.type === "relation" && field.cardinality === "many")
|
|
@@ -21,6 +22,7 @@ function useKindGlyph(field, kindIcon) {
|
|
|
21
22
|
return named ? (_jsx(components.AppIcon, { name: named, className: "h-3.5 w-3.5" })) : (_jsx(TypeGlyph, { className: "h-3.5 w-3.5" }));
|
|
22
23
|
}
|
|
23
24
|
function RowRelationOneEditor({ binding, field, initial, anchor, onAttempt, onClose, message, kindIcon, }) {
|
|
25
|
+
const panel = useBodyPanel("picker", "w-64", "z-90");
|
|
24
26
|
const editorRef = useRef(null);
|
|
25
27
|
const anchorRef = useRef(null);
|
|
26
28
|
const kindGlyph = useKindGlyph(field, kindIcon);
|
|
@@ -38,9 +40,10 @@ function RowRelationOneEditor({ binding, field, initial, anchor, onAttempt, onCl
|
|
|
38
40
|
});
|
|
39
41
|
if (!binding.relation)
|
|
40
42
|
return null;
|
|
41
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { session: session, title: field.label, anchor: anchorRef, align: "start", alignOffset: -OPTION_ROW_INSET, sideOffset: 4, initialFocus: false, chrome: "menu", className:
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { panelData: panel.data, session: session, title: field.label, anchor: anchorRef, align: "start", alignOffset: -OPTION_ROW_INSET, sideOffset: 4, initialFocus: false, chrome: "menu", className: panel.className, savesOnPick: true, children: _jsx(RelationEditor, { ref: editorRef, candidates: candidates, initial: relationIdOf(initial), clearable: !!field.nullable, kindGlyph: kindGlyph, focusSearch: !sheet, onRequestClose: close, message: message, label: field.label }) })] }));
|
|
42
44
|
}
|
|
43
45
|
function RowRelationSetEditor({ binding, field, initial, shown, anchor, onAttempt, onClose, message, kindIcon, }) {
|
|
46
|
+
const panel = useBodyPanel("picker", "w-64", "z-90");
|
|
44
47
|
const editorRef = useRef(null);
|
|
45
48
|
const anchorRef = useRef(null);
|
|
46
49
|
const kindGlyph = useKindGlyph(field, kindIcon);
|
|
@@ -53,7 +56,7 @@ function RowRelationSetEditor({ binding, field, initial, shown, anchor, onAttemp
|
|
|
53
56
|
const candidates = binding.relation;
|
|
54
57
|
if (!candidates)
|
|
55
58
|
return null;
|
|
56
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { session: session, title: field.label, anchor: anchorRef, align: "start", alignOffset: -OPTION_ROW_INSET, sideOffset: 4, initialFocus: false, chrome: "menu", className:
|
|
59
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { panelData: panel.data, session: session, title: field.label, anchor: anchorRef, align: "start", alignOffset: -OPTION_ROW_INSET, sideOffset: 4, initialFocus: false, chrome: "menu", className: panel.className, children: _jsx(RelationSetEditor, { ref: editorRef, candidates: candidates, initial: setItems(field, initial, shown, candidates), lead: field.links?.primary === "flag", kindGlyph: kindGlyph, focusSearch: !sheet, onRequestClose: close, message: message, label: field.label }) })] }));
|
|
57
60
|
}
|
|
58
61
|
function setItems(field, initial, shown, candidates) {
|
|
59
62
|
const labels = new Map();
|
|
@@ -3,11 +3,14 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import { useMemo, useRef } from "react";
|
|
4
4
|
import { isOpenVocabulary } from "@viewkitjs/fields";
|
|
5
5
|
import { EditorPanel } from "../../editors/EditorPanel.js";
|
|
6
|
+
import { statusSteps } from "../../display/status-steps.js";
|
|
6
7
|
import { useOpenValues } from "../../editors/open-values.js";
|
|
7
8
|
import { SelectEditor, pickerOptionsFromField, } from "../../editors/SelectEditor.js";
|
|
8
9
|
import { OPTION_ROW_INSET } from "./host.js";
|
|
9
10
|
import { useRowEditSession } from "./row-session.js";
|
|
11
|
+
import { useBodyPanel } from "../../editors/body-panel.js";
|
|
10
12
|
export function RowSelectEditor({ field, initial, anchor, onAttempt, onClose, message, openedByKey = false, }) {
|
|
13
|
+
const panel = useBodyPanel("picker", "w-56", "z-90");
|
|
11
14
|
const editorRef = useRef(null);
|
|
12
15
|
const anchorRef = useRef(null);
|
|
13
16
|
const known = useOpenValues(field);
|
|
@@ -19,5 +22,5 @@ export function RowSelectEditor({ field, initial, anchor, onAttempt, onClose, me
|
|
|
19
22
|
onClose,
|
|
20
23
|
mapPayload: (payload) => (payload === "" ? null : payload),
|
|
21
24
|
});
|
|
22
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { session: session, title: field.label, anchor: anchorRef, align: "start", alignOffset: -OPTION_ROW_INSET, sideOffset: 4, initialFocus: false, chrome: "menu", className:
|
|
25
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { panelData: panel.data, session: session, title: field.label, anchor: anchorRef, align: "start", alignOffset: -OPTION_ROW_INSET, sideOffset: 4, initialFocus: false, chrome: "menu", className: panel.className, savesOnPick: true, children: _jsx(SelectEditor, { ref: editorRef, options: options, steps: statusSteps(field), initial: current, clearable: !!field.nullable, creatable: isOpenVocabulary(field), focusSearch: !sheet, focusList: openedByKey && !sheet, onRequestClose: close, message: message, label: field.label }) })] }));
|
|
23
26
|
}
|
|
@@ -12,4 +12,4 @@ import type { RowHostProps } from "./host.js";
|
|
|
12
12
|
* and ⌘/Ctrl+Enter closes. The row's session asks whether the answer may
|
|
13
13
|
* close: a refused one keeps the box open with its draft and its reason under it.
|
|
14
14
|
*/
|
|
15
|
-
export declare function RowTextEditor<Row>({ field, initial, onAttempt, onClose, }: RowHostProps<Row, "text" | "url" | "domain" | "email" | "phone" | "rich_text">): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function RowTextEditor<Row>({ field, binding, row, initial, onAttempt, onClose, }: RowHostProps<Row, "text" | "url" | "domain" | "email" | "phone" | "rich_text">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useRef } from "react";
|
|
4
|
-
import { phoneText } from "@viewkitjs/fields";
|
|
4
|
+
import { acceptFieldCommit, phoneText } from "@viewkitjs/fields";
|
|
5
5
|
import { EditorPanel } from "../../editors/EditorPanel.js";
|
|
6
6
|
import { TextEditor } from "../../editors/TextEditor.js";
|
|
7
7
|
import { cx } from "../../internal/cx.js";
|
|
8
|
+
import { useViews } from "../../provider/context.js";
|
|
8
9
|
import { RowRefusal, useRowEditSession } from "./row-session.js";
|
|
9
|
-
export function RowTextEditor({ field, initial, onAttempt, onClose, }) {
|
|
10
|
+
export function RowTextEditor({ field, binding, row, initial, onAttempt, onClose, }) {
|
|
10
11
|
const editorRef = useRef(null);
|
|
11
12
|
const anchorRef = useRef(null);
|
|
12
13
|
const baseline = field.type === "phone" ? phoneText(initial, null) : typeof initial === "string" ? initial : "";
|
|
13
14
|
const long = (field.type === "text" && !!field.format?.long) || field.type === "rich_text";
|
|
14
15
|
const { session, close } = useRowEditSession({ editorRef, inPlace: true, onAttempt, onClose });
|
|
15
|
-
|
|
16
|
+
const { components, conventions } = useViews();
|
|
17
|
+
const region = binding.region?.(row) ?? undefined;
|
|
18
|
+
const check = (text) => {
|
|
19
|
+
if (text.trim() === "" || text === baseline)
|
|
20
|
+
return null;
|
|
21
|
+
const read = acceptFieldCommit(field, text, { conventions, region, stored: initial });
|
|
22
|
+
return read.ok ? null : read.reason;
|
|
23
|
+
};
|
|
24
|
+
return (_jsxs(EditorPanel, { session: session, title: field.label, anchor: anchorRef, inPlace: true, children: [_jsx(TextEditor, { ref: editorRef, type: field.type, multiline: long, initial: baseline, label: field.label, rows: long ? 4 : undefined, maxLines: long ? 4 : undefined, onRequestClose: close, ...(components.TextBody ? { check, region, escapeKeeps: session.keeps ?? false } : {}), className: cx("w-full min-w-0 bg-transparent text-sm text-(color:--vk-fg) outline-hidden rounded-md px-2 -mx-2 py-1 -my-1", "ring-1 ring-(color:--vk-border) focus:ring-(color:--vk-border-brand)", long && "resize-y") }), _jsx(RowRefusal, { text: session.refusal })] }));
|
|
16
25
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MultipleType } from "@viewkitjs/fields";
|
|
2
2
|
import type { RowHostProps } from "./host.js";
|
|
3
|
-
/** Several values edit in the list editor; one edits in the row's own text box
|
|
3
|
+
/** Several values edit in the list editor; one edits in the row's own text box, unless the app opens a single email or
|
|
4
|
+
* domain as a list of one (`ViewsProvider`'s `oneValue`), as the grid does. */
|
|
4
5
|
export declare function RowListOrText<Row>(props: RowHostProps<Row, MultipleType>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,20 +2,33 @@
|
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useRef } from "react";
|
|
4
4
|
import { EditorPanel } from "../../editors/EditorPanel.js";
|
|
5
|
+
import { opensAsList } from "../../model/one-value.js";
|
|
5
6
|
import { ValueListEditor } from "../../editors/ValueListEditor.js";
|
|
7
|
+
import { listOfOne, oneOfList } from "../../editors/values-body.js";
|
|
8
|
+
import { useViews } from "../../provider/context.js";
|
|
6
9
|
import { RowTextEditor } from "./RowTextEditor.js";
|
|
7
10
|
import { useRowEditSession } from "./row-session.js";
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
import { useBodyPanel } from "../../editors/body-panel.js";
|
|
12
|
+
function RowValueListEditor({ field, binding, row, initial, anchor, onAttempt, onClose, holds = "several", }) {
|
|
13
|
+
const panel = useBodyPanel("values", "w-96", "z-90 max-w-[calc(100vw-2rem)]");
|
|
14
|
+
const listRef = useRef(null);
|
|
15
|
+
const one = holds === "one";
|
|
16
|
+
const oneRef = useRef({ resolveClose: (reason) => oneOfList(listRef.current.resolveClose(reason)) });
|
|
17
|
+
const editorRef = one ? oneRef : listRef;
|
|
10
18
|
const anchorRef = useRef(null);
|
|
11
19
|
const { session, close } = useRowEditSession({ editorRef, onAttempt, onClose });
|
|
12
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { session: session, title: field.label, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, chrome: "menu", className:
|
|
13
|
-
const editor = (_jsx(ValueListEditor, { ref:
|
|
20
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { panelData: panel.data, session: session, title: field.label, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, chrome: "menu", className: panel.className, children: (surface) => {
|
|
21
|
+
const editor = (_jsx(ValueListEditor, { ref: listRef, field: field, label: field.label, initial: one ? listOfOne(initial) : initial, labels: binding.labels !== false && !one, holds: holds, allowEmpty: true, region: binding.region?.(row), openLinks: surface === "sheet", escapeKeeps: session.keeps ?? false, onRequestClose: close }));
|
|
22
|
+
if (surface !== "sheet" && panel.data["data-vk-body"])
|
|
23
|
+
return editor;
|
|
14
24
|
return _jsx("div", { className: surface === "sheet" ? "px-4 pb-4" : "p-1.5", children: editor });
|
|
15
25
|
} })] }));
|
|
16
26
|
}
|
|
17
27
|
export function RowListOrText(props) {
|
|
28
|
+
const { oneValue } = useViews();
|
|
18
29
|
if ("multiple" in props.field && props.field.multiple)
|
|
19
30
|
return _jsx(RowValueListEditor, { ...props });
|
|
31
|
+
if (opensAsList(props.field.type, false, oneValue))
|
|
32
|
+
return _jsx(RowValueListEditor, { ...props, holds: "one" });
|
|
20
33
|
return _jsx(RowTextEditor, { ...props });
|
|
21
34
|
}
|
|
@@ -15,6 +15,9 @@ export type RowEditorProps<Row> = {
|
|
|
15
15
|
row: Row;
|
|
16
16
|
/** The stored value the editor opens on. */
|
|
17
17
|
initial: unknown;
|
|
18
|
+
/** The reason the server refused the value the editor opens on (`initial`, the row's kept draft): the editor shows
|
|
19
|
+
* it as its refusal until that value changes or a close is asked. Default: none. */
|
|
20
|
+
refused?: string;
|
|
18
21
|
/**
|
|
19
22
|
* The row's DISPLAY value, as drawn — what an ANCHORED host keeps on screen
|
|
20
23
|
* under its popover. The grid keeps a cell's content under its editor for
|
|
@@ -17,8 +17,19 @@ import type { RowEditorProps } from "./host.js";
|
|
|
17
17
|
* editor held the focus, or the row's button did before the editor took its place, and either is gone once it
|
|
18
18
|
* closes: the focus fell to the page and the next Tab started again from the top. A popover's blur is a Tab out of
|
|
19
19
|
* it, so it counts too; in place a blur is a press elsewhere, and an outside press, which leave the focus where
|
|
20
|
-
* they put it
|
|
20
|
+
* they put it;
|
|
21
|
+
* - left with the editor open, because the page goes (`pagehide`) or the row itself goes (`FieldRow`'s leave scope: a
|
|
22
|
+
* drawer the app closes, a route), the draft is asked as a press outside asks it, and the row writes it at the
|
|
23
|
+
* attempt; in a sheet nothing is, as its backdrop. A refused draft there writes nothing and says nothing;
|
|
24
|
+
* - reopened on a value the server refused after its save (`RowRefusedContext`, the row's kept draft), the session
|
|
25
|
+
* says the server's reason as its refusal until the value changes: until the editor's answer to a press outside
|
|
26
|
+
* differs from the one it opened with (read at open, or before the first key, press or input in it), read on the
|
|
27
|
+
* tick after each input, change, click or key-up, or until a close is asked. The editor had closed before the server answered, as it does for every key, so this is where the
|
|
28
|
+
* reason meets the value again.
|
|
21
29
|
*/
|
|
30
|
+
/** The server's reason for the refused value a row's editor reopens on: provided by `RowEditor` from its
|
|
31
|
+
* `refused`, read once by the session when it opens. */
|
|
32
|
+
export declare const RowRefusedContext: import("react").Context<string | undefined>;
|
|
22
33
|
/** The gap a row waits after its sheet closes before it reports: a sheet slides away for about half a second. */
|
|
23
34
|
export declare const ROW_SHEET_EXIT_MS = 500;
|
|
24
35
|
type ResolvableHandle<P> = {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useContext, useRef, useState } from "react";
|
|
3
|
+
import { createContext, useContext, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { useAnchoredEditSession } from "../../editors/edit-session.js";
|
|
5
5
|
import { EditFieldTypeContext, useEscapeRule } from "../../editors/escape-rule.js";
|
|
6
6
|
import { useDesktop } from "../../provider/desktop.js";
|
|
7
|
+
export const RowRefusedContext = createContext(undefined);
|
|
8
|
+
const CHANGE_EVENTS = ["input", "change", "click", "keyup"];
|
|
9
|
+
const BEFORE_EVENTS = ["keydown", "pointerdown", "beforeinput", "paste"];
|
|
7
10
|
export const ROW_SHEET_EXIT_MS = 500;
|
|
8
11
|
const RETURNS_FOCUS = new Set(["tab", "shift-tab", "escape", "enter", "pick"]);
|
|
9
12
|
export function useRowEditSession({ editorRef, mapPayload, inPlace = false, onAttempt, onClose, }) {
|
|
@@ -28,8 +31,55 @@ export function useRowEditSession({ editorRef, mapPayload, inPlace = false, onAt
|
|
|
28
31
|
},
|
|
29
32
|
onClose: () => onClose(closedRef.current),
|
|
30
33
|
exitMs: inPlace ? 0 : sheet ? ROW_SHEET_EXIT_MS : undefined,
|
|
34
|
+
leave: sheet ? "discard" : "outside",
|
|
31
35
|
});
|
|
36
|
+
const opened = useContext(RowRefusedContext);
|
|
37
|
+
const [refused, setRefused] = useState(() => opened ?? null);
|
|
38
|
+
const standing = refused !== null;
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!standing)
|
|
41
|
+
return;
|
|
42
|
+
const answer = () => {
|
|
43
|
+
const handle = editorRef.current;
|
|
44
|
+
return handle ? JSON.stringify(handle.resolveClose("outside")) : null;
|
|
45
|
+
};
|
|
46
|
+
let start = answer();
|
|
47
|
+
const settle = () => {
|
|
48
|
+
if (start === null)
|
|
49
|
+
start = answer();
|
|
50
|
+
};
|
|
51
|
+
const late = window.setTimeout(settle, 0);
|
|
52
|
+
let timer = null;
|
|
53
|
+
const check = () => {
|
|
54
|
+
if (timer !== null)
|
|
55
|
+
return;
|
|
56
|
+
timer = window.setTimeout(() => {
|
|
57
|
+
timer = null;
|
|
58
|
+
if (start === null) {
|
|
59
|
+
settle();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const now = answer();
|
|
63
|
+
if (now !== null && now !== start)
|
|
64
|
+
setRefused(null);
|
|
65
|
+
}, 0);
|
|
66
|
+
};
|
|
67
|
+
for (const type of BEFORE_EVENTS)
|
|
68
|
+
document.addEventListener(type, settle, true);
|
|
69
|
+
for (const type of CHANGE_EVENTS)
|
|
70
|
+
document.addEventListener(type, check, true);
|
|
71
|
+
return () => {
|
|
72
|
+
for (const type of BEFORE_EVENTS)
|
|
73
|
+
document.removeEventListener(type, settle, true);
|
|
74
|
+
for (const type of CHANGE_EVENTS)
|
|
75
|
+
document.removeEventListener(type, check, true);
|
|
76
|
+
window.clearTimeout(late);
|
|
77
|
+
if (timer !== null)
|
|
78
|
+
window.clearTimeout(timer);
|
|
79
|
+
};
|
|
80
|
+
}, [standing, editorRef]);
|
|
32
81
|
const ask = (reason) => {
|
|
82
|
+
setRefused(null);
|
|
33
83
|
reasonRef.current = reason;
|
|
34
84
|
try {
|
|
35
85
|
session.close(reason);
|
|
@@ -43,7 +93,7 @@ export function useRowEditSession({ editorRef, mapPayload, inPlace = false, onAt
|
|
|
43
93
|
return;
|
|
44
94
|
ask(reason);
|
|
45
95
|
};
|
|
46
|
-
return { session: { ...session, close: ask }, close, sheet };
|
|
96
|
+
return { session: { ...session, close: ask, refusal: session.refusal ?? refused }, close, sheet };
|
|
47
97
|
}
|
|
48
98
|
export function RowRefusal({ text }) {
|
|
49
99
|
if (!text)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { MouseEvent as ReactMouseEvent, ReactElement, ReactNode, Ref } from "react";
|
|
2
|
+
import type { ViewsContextValue } from "../provider/context.js";
|
|
3
|
+
/** What a field row's button reads from the provider: the app's `Button` and who draws. */
|
|
4
|
+
export type FieldRowButtonViews = Pick<ViewsContextValue, "components" | "fieldRowButtons">;
|
|
5
|
+
/** One button a field row draws itself, as each of its places describes it. */
|
|
6
|
+
export type FieldRowButtonDraw = {
|
|
7
|
+
/** Today's classes, without `ELEMENT_RESET`: drawn on ViewKit's own `<button>`. */
|
|
8
|
+
own: string;
|
|
9
|
+
/** The box ViewKit keeps on the app's `Button`: its size and its place. The look is the app's. */
|
|
10
|
+
frame: string;
|
|
11
|
+
variant: "ghost";
|
|
12
|
+
size: "sm" | "icon";
|
|
13
|
+
ref?: Ref<HTMLButtonElement>;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
"aria-disabled"?: boolean;
|
|
16
|
+
"aria-label"?: string;
|
|
17
|
+
"data-slot"?: string;
|
|
18
|
+
/** Marks the press as the host's own: `data-no-nav` on ViewKit's button, on a `display: contents` span around the
|
|
19
|
+
* app's. */
|
|
20
|
+
noNav?: boolean;
|
|
21
|
+
onClick?: (event: ReactMouseEvent<HTMLButtonElement>) => void;
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
};
|
|
24
|
+
/** The row's edit target on the app's `Button`: the target's own box (padded out and pulled back by the same amount),
|
|
25
|
+
* a height that grows with a wrapped value, and the row's own type, so the value reads as it does unpressed. */
|
|
26
|
+
export declare const FIELD_ROW_FRAME = "-mx-2 -my-1 flex h-auto min-h-7 w-[calc(100%+1rem)] min-w-0 items-center justify-start whitespace-normal px-2 py-1 text-left [font:inherit]";
|
|
27
|
+
/** The same, sharing its line with a link's open action beside it. */
|
|
28
|
+
export declare const FIELD_ROW_FRAME_BESIDE = "-ml-2 -my-1 flex h-auto min-h-7 min-w-0 flex-1 items-center justify-start whitespace-normal px-2 py-1 text-left [font:inherit]";
|
|
29
|
+
/** The empty target laid under a rich text, filling the value's footprint. */
|
|
30
|
+
export declare const FIELD_ROW_FRAME_UNDER = "absolute -inset-x-2 -inset-y-1 h-auto w-auto p-0";
|
|
31
|
+
/** The same drawing as an element, for a button that carries a ref: the ref passes as a prop, never read while the
|
|
32
|
+
* row renders. */
|
|
33
|
+
export declare function FieldRowButton({ views, ...draw }: FieldRowButtonDraw & {
|
|
34
|
+
views: FieldRowButtonViews;
|
|
35
|
+
}): ReactElement;
|
|
36
|
+
/**
|
|
37
|
+
* Draws a button a field row draws itself: ViewKit's own `<button>` by default (the provider's `fieldRowButtons` is
|
|
38
|
+
* `own`), exactly as on 0.5.0, or the app's `Button` with `fieldRowButtons: "button"`. A plain function, never a hook.
|
|
39
|
+
*/
|
|
40
|
+
export declare function drawFieldRowButton(views: FieldRowButtonViews, { own, frame, variant, size, noNav, children, ...props }: FieldRowButtonDraw): ReactElement;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../internal/cx.js";
|
|
4
|
+
import { ELEMENT_RESET } from "../internal/reset.js";
|
|
5
|
+
export const FIELD_ROW_FRAME = "-mx-2 -my-1 flex h-auto min-h-7 w-[calc(100%+1rem)] min-w-0 items-center justify-start whitespace-normal px-2 py-1 text-left [font:inherit]";
|
|
6
|
+
export const FIELD_ROW_FRAME_BESIDE = "-ml-2 -my-1 flex h-auto min-h-7 min-w-0 flex-1 items-center justify-start whitespace-normal px-2 py-1 text-left [font:inherit]";
|
|
7
|
+
export const FIELD_ROW_FRAME_UNDER = "absolute -inset-x-2 -inset-y-1 h-auto w-auto p-0";
|
|
8
|
+
export function FieldRowButton({ views, ...draw }) {
|
|
9
|
+
return drawFieldRowButton(views, draw);
|
|
10
|
+
}
|
|
11
|
+
export function drawFieldRowButton(views, { own, frame, variant, size, noNav, children, ...props }) {
|
|
12
|
+
if (views.fieldRowButtons !== "button") {
|
|
13
|
+
return (_jsx("button", { type: "button", ...props, "data-no-nav": noNav || undefined, className: cx(ELEMENT_RESET, own), children: children }));
|
|
14
|
+
}
|
|
15
|
+
const { Button } = views.components;
|
|
16
|
+
const button = (_jsx(Button, { type: "button", variant: variant, size: size, className: frame, ...props, children: children }));
|
|
17
|
+
return noNav ? (_jsx("span", { className: "contents", "data-no-nav": true, children: button })) : (button);
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { ViewsCheckboxProps } from "../provider/components.js";
|
|
3
|
+
/**
|
|
4
|
+
* A field row's yes/no as the app's `Checkbox` (the provider's `fieldRowCheckboxes` is `checkbox`). The display core
|
|
5
|
+
* hands its box `tabIndex` -1, right in a grid cell, whose own key flips it; a field row has no such key, so its box
|
|
6
|
+
* stays a Tab stop, as the row's own switch is. One component at module level, so a redrawn row keeps the same
|
|
7
|
+
* element type and the box stays mounted.
|
|
8
|
+
*/
|
|
9
|
+
export declare function FieldRowCheckbox({ tabIndex: _cellOnly, ...props }: ViewsCheckboxProps): ReactElement;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useViews } from "../provider/context.js";
|
|
4
|
+
export function FieldRowCheckbox({ tabIndex: _cellOnly, ...props }) {
|
|
5
|
+
const { Checkbox } = useViews().components;
|
|
6
|
+
return _jsx(Checkbox, { ...props });
|
|
7
|
+
}
|
|
@@ -33,6 +33,8 @@ export type FilterConfigBase = {
|
|
|
33
33
|
* A disabled row is never active, never counted, never cleared.
|
|
34
34
|
*/
|
|
35
35
|
disabled?: boolean;
|
|
36
|
+
/** Why a `disabled` row can't be opened, shown on the row. */
|
|
37
|
+
disabledReason?: string;
|
|
36
38
|
/**
|
|
37
39
|
* Renders the row under its own labelled section instead of the plain list.
|
|
38
40
|
* Same shape and intent as `ToggleConfig.section`. Rows sharing a section
|
|
@@ -4,7 +4,7 @@ import { useCallback, useState } from "react";
|
|
|
4
4
|
import { useViews } from "../../provider/context.js";
|
|
5
5
|
import { useDesktop } from "../../provider/desktop.js";
|
|
6
6
|
import { cx } from "../../internal/cx.js";
|
|
7
|
-
import {
|
|
7
|
+
import { drawGridButton } from "./grid-button.js";
|
|
8
8
|
import { gridAddColumnItems } from "./grid-add-column-items.js";
|
|
9
9
|
import { useGridMenuPress } from "./grid-menu-focus.js";
|
|
10
10
|
export function gridAddColumnDrawn(render, columns) {
|
|
@@ -45,7 +45,8 @@ export function GridAddColumn({ columns }) {
|
|
|
45
45
|
const [open, setOpen] = useState(false);
|
|
46
46
|
const [query, setQuery] = useState("");
|
|
47
47
|
const [anchor, setAnchor] = useState(null);
|
|
48
|
-
const
|
|
48
|
+
const views = useViews();
|
|
49
|
+
const { atoms, components, icons, messages, menus } = views;
|
|
49
50
|
const { Popover, Command, Sheet, Menu } = components;
|
|
50
51
|
const press = useGridMenuPress(open);
|
|
51
52
|
const menuRoute = (menus ?? "popover") === "menu";
|
|
@@ -82,5 +83,18 @@ export function GridAddColumn({ columns }) {
|
|
|
82
83
|
}), !rows.some((row) => row.kind !== "back") && (_jsx("p", { className: "px-2 py-2 text-sm text-(color:--vk-fg-subtle)", children: wanted
|
|
83
84
|
? messages({ key: "views.menus.add-column-no-match", values: { query: query.trim() } })
|
|
84
85
|
: messages({ key: "views.menus.add-column-all-shown" }) }))] }) }) })] }));
|
|
85
|
-
return (_jsxs(_Fragment, { children: [
|
|
86
|
+
return (_jsxs(_Fragment, { children: [drawGridButton(views, {
|
|
87
|
+
ref: setAnchor,
|
|
88
|
+
tabIndex: -1,
|
|
89
|
+
"aria-haspopup": menuRoute ? "menu" : "dialog",
|
|
90
|
+
"aria-expanded": open,
|
|
91
|
+
"data-open": open ? "" : undefined,
|
|
92
|
+
onPointerDownCapture: menuRoute ? press.notePress : undefined,
|
|
93
|
+
onClick: (e) => ((menuRoute && press.pressedOpen(e)) || open ? close() : setOpen(true)),
|
|
94
|
+
own: cx("flex h-full w-(--vk-tail-w) min-w-0 max-w-full flex-none items-center gap-1.5 px-(--vk-px) text-(length:--vk-head-text) hover:bg-(color:--vk-hovered)", open ? "bg-(color:--vk-pressed) text-(color:--vk-fg)" : "text-(color:--vk-fg-subtle)"),
|
|
95
|
+
frame: "h-full w-(--vk-tail-w) min-w-0 max-w-full flex-none justify-start gap-1.5 px-(--vk-px) text-(length:--vk-head-text)",
|
|
96
|
+
variant: "ghost",
|
|
97
|
+
size: "sm",
|
|
98
|
+
children: (_jsxs(_Fragment, { children: [_jsx(Add, { className: "h-(--vk-head-glyph) w-(--vk-head-glyph) shrink-0 opacity-70" }), _jsx("span", { className: "truncate", children: messages({ key: "views.grid.add-column" }) })] })),
|
|
99
|
+
}), menuRoute ? (_jsx(Menu, { open: open, onOpenChange: (next, details) => (next ? setOpen(true) : close(details?.reason)), anchor: anchor, side: "bottom", align: "end", label: word, items: open ? gridAddColumnItems(columns, { messages, close: () => close("item-press") }) : [] })) : desktop ? (_jsx(Popover, { open: open, onOpenChange: (next, details) => (next ? setOpen(true) : close(details?.reason)), anchor: anchor, side: "bottom", align: "end", sideOffset: 4, chrome: "menu", initialFocus: false, className: "flex w-60 flex-col", onOutsidePress: (event) => (anchor?.contains(event.target) ? false : undefined), children: list })) : (_jsx(Sheet, { open: open, onOpenChange: (next, details) => (next ? setOpen(true) : close(details?.reason)), title: word, label: word, snap: "half", children: list }))] }));
|
|
86
100
|
}
|
|
@@ -8,6 +8,8 @@ type TriggerProps = {
|
|
|
8
8
|
role?: "button" | "gridcell";
|
|
9
9
|
"aria-haspopup"?: "dialog" | "menu";
|
|
10
10
|
"aria-expanded"?: boolean;
|
|
11
|
+
/** The contract's `open` state: present while the menu is open. */
|
|
12
|
+
"data-open"?: "";
|
|
11
13
|
};
|
|
12
14
|
/**
|
|
13
15
|
* The footer cell's Calculate popover — pick the aggregate function for one
|
|
@@ -28,6 +28,7 @@ export function GridAggregateMenu({ column, options, current, onChange, align, c
|
|
|
28
28
|
role: children.props.role ?? "button",
|
|
29
29
|
"aria-haspopup": "menu",
|
|
30
30
|
"aria-expanded": open,
|
|
31
|
+
"data-open": open ? "" : undefined,
|
|
31
32
|
});
|
|
32
33
|
return (_jsxs(_Fragment, { children: [menuTrigger, _jsx(Menu, { open: open, onOpenChange: (next) => setOpen(next), anchor: anchor, side: "bottom", align: align, label: messages({ key: "views.menus.figure-menu", values: { field: columnLabel(column) } }), items: figures.map((kind) => ({
|
|
33
34
|
key: kind,
|
|
@@ -49,6 +50,7 @@ export function GridAggregateMenu({ column, options, current, onChange, align, c
|
|
|
49
50
|
role: children.props.role ?? "button",
|
|
50
51
|
"aria-haspopup": "dialog",
|
|
51
52
|
"aria-expanded": open,
|
|
53
|
+
"data-open": open ? "" : undefined,
|
|
52
54
|
});
|
|
53
55
|
return (_jsxs(_Fragment, { children: [trigger, _jsx(Popover, { open: open, onOpenChange: setOpen, anchor: anchor, side: "bottom", align: align, sideOffset: 4, chrome: "menu", panelData: { "data-slot": "vk-grid-aggregate-menu" }, className: "w-40", onOutsidePress: (event) => (anchor?.contains(event.target) ? false : undefined), children: _jsx("div", { onKeyDown: gridMenuArrows, children: _jsx(List, { children: figures.map((kind) => (_jsx(Row, { chosen: kind === current, label: aggregateLabel(kind, messages), onClick: () => {
|
|
54
56
|
setOpen(false);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { numberEditCode, numberEditDecimals } from "../../fields/number-edit.js";
|
|
5
|
+
import { numberBounds } from "../../editors/number-body.js";
|
|
5
6
|
import { convertedFromOf } from "../../fields/money.js";
|
|
6
7
|
import { renderTypedCellValue } from "../../cells/cell-values.js";
|
|
7
8
|
import { legacyFieldFromColumn } from "../../cells/legacy-field.js";
|
|
@@ -42,21 +43,25 @@ export function gridEscapeType(col) {
|
|
|
42
43
|
}
|
|
43
44
|
function InlineEditor({ ctx }) {
|
|
44
45
|
const { row, rowId, col, baseline, onCommitCell, onCancel, onTab, onEnter } = ctx;
|
|
45
|
-
const
|
|
46
|
+
const region = col.region?.(row);
|
|
47
|
+
const refusal = useCellRefusal(col, ctx.listConfig, region, row);
|
|
48
|
+
const inCell = !!useViews().components.TextBody && !ctx.readOnly;
|
|
46
49
|
if (ctx.editorKind === "number") {
|
|
47
50
|
const integer = col.field ? isIntegerField(col.field) : false;
|
|
48
51
|
const fallback = col.field ? numberEditDecimals(col.field) : (col.format?.decimals ?? 2);
|
|
49
52
|
const durationUnit = col.format?.style === "duration" ? (col.format.unit ?? "ms") : undefined;
|
|
50
|
-
|
|
53
|
+
const field = col.field ?? legacyFieldFromColumn(col);
|
|
54
|
+
const valueType = valueTypeOf(field);
|
|
55
|
+
return (_jsx(GridNumberEditor, { title: col.header, initial: typeof baseline === "number" ? baseline : Number.NaN, seed: ctx.editSeed ?? undefined, unit: col.editUnit?.value(row), unitOptions: col.editUnit?.options, code: col.editUnit ? undefined : numberEditCode(field), type: valueType === "currency" || valueType === "percent" ? valueType : "number", bounds: numberBounds(field), decimals: integer ? 0 : (ctx.decimals ?? fallback), durationUnit: durationUnit, allowEmpty: !!col.clearable, unitLeft: col.align === "right", conversion: convertedFromOf(col, row) ? renderTypedCellValue(col, row, { decimals: ctx.decimals }) : undefined, refuse: (payload) => refusal(payload, cellPrevPayload(col, baseline, col.editUnit?.value(row))), onCommit: (payload) => onCommitCell(row, rowId, col.id, cellPrevPayload(col, baseline, col.editUnit?.value(row)), payload, { overlay: false }), onCancel: onCancel, onTab: onTab, onEnter: onEnter }));
|
|
51
56
|
}
|
|
52
57
|
if (ctx.editorKind === "range") {
|
|
53
58
|
const def = col.field?.type === "range" ? col.field : undefined;
|
|
54
59
|
return (_jsx(GridRangeEditor, { title: col.header, initial: isRangeValue(baseline) ? baseline : null, seed: ctx.editSeed ?? undefined, decimals: def ? rangeDecimals(def) : 0, allowEmpty: !!col.clearable, suffix: def?.of === "percent" ? "%" : def?.of === "currency" ? def.code?.fixed : undefined, bands: def?.presets, refuse: (payload) => refusal(payload, baseline), onCommit: (payload) => onCommitCell(row, rowId, col.id, baseline, payload, { overlay: false }), onCancel: onCancel, onTab: onTab, onEnter: onEnter }));
|
|
55
60
|
}
|
|
56
|
-
if (ctx.editorKind === "text" && !gridTextOpensBox(col, !!ctx.whole)) {
|
|
61
|
+
if (ctx.editorKind === "text" && !gridTextOpensBox(col, !!ctx.whole, inCell)) {
|
|
57
62
|
const phone = col.type === "phone";
|
|
58
63
|
const stored = phone ? phoneText(baseline, null) : String(baseline ?? "");
|
|
59
|
-
return (_jsx(GridTextEditor, { initial: stored, seed: ctx.editSeed ?? undefined, type: gridTextEditorType(col.type), title: col.header, strong: col.type === "title", open: isOpenableType(col.type) && baseline != null && baseline !== ""
|
|
64
|
+
return (_jsx(GridTextEditor, { initial: stored, seed: ctx.editSeed ?? undefined, type: gridTextEditorType(col.type), paragraph: isLongTextColumn(col), region: region ?? undefined, title: col.header, strong: col.type === "title", open: isOpenableType(col.type) && baseline != null && baseline !== ""
|
|
60
65
|
? { type: col.type, value: baseline }
|
|
61
66
|
: undefined, refuse: (value) => refusal(value, phone ? baseline : stored), onCommit: (value) => onCommitCell(row, rowId, col.id, phone ? baseline : stored, value), onCancel: onCancel, onTab: onTab, onEnter: onEnter }));
|
|
62
67
|
}
|
|
@@ -69,9 +74,10 @@ function AnchoredEditor({ ctx }) {
|
|
|
69
74
|
const { row, rowId, col, baseline, onCommitCell, onCancel } = ctx;
|
|
70
75
|
const region = col.region?.(row);
|
|
71
76
|
const refusal = useCellRefusal(col, ctx.listConfig, region, row);
|
|
72
|
-
const { messages } = useViews();
|
|
77
|
+
const { messages, components } = useViews();
|
|
78
|
+
const inCell = !!components.TextBody && !ctx.readOnly;
|
|
73
79
|
const relationSource = useMemo(() => gridRelationSource(col, ctx.entityIcon), [col, ctx.entityIcon]);
|
|
74
|
-
if (ctx.editorKind === "text" && gridTextOpensBox(col, !!ctx.whole)) {
|
|
80
|
+
if (ctx.editorKind === "text" && gridTextOpensBox(col, !!ctx.whole, inCell)) {
|
|
75
81
|
const paragraph = isLongTextColumn(col);
|
|
76
82
|
return (_jsx(GridLongTextEditor, { paragraph: paragraph, type: paragraph ? undefined : gridTextEditorType(col.type), initial: String(baseline ?? ""), seed: ctx.editSeed ?? undefined, readOnly: ctx.readOnly, markdown: col.type === "rich_text", title: col.header, refuse: (value) => refusal(value, String(baseline ?? "")), onCommit: (value) => onCommitCell(row, rowId, col.id, String(baseline ?? ""), value), onCancel: onCancel, onTab: ctx.onTab, onEnter: ctx.onEnter }));
|
|
77
83
|
}
|
|
@@ -99,6 +105,10 @@ function AnchoredEditor({ ctx }) {
|
|
|
99
105
|
if (ctx.editorKind === "name") {
|
|
100
106
|
return (_jsx(GridNameEditor, { title: col.header, initial: isNameValue(baseline) ? baseline : null, seed: ctx.editSeed ?? undefined, allowEmpty: !!col.clearable, onCommit: (payload) => onCommitCell(row, rowId, col.id, baseline, payload, { overlay: false }), onCancel: onCancel, onTab: ctx.onTab, onEnter: ctx.onEnter }));
|
|
101
107
|
}
|
|
108
|
+
if (ctx.editorKind === "values" && col.field && isMultipleType(col.field.type) && !col.multiple) {
|
|
109
|
+
const stored = String(baseline ?? "");
|
|
110
|
+
return (_jsx(GridValueListEditor, { field: col.field, title: col.header, initial: baseline, labels: false, region: region, holds: "one", seed: ctx.editSeed ?? undefined, allowEmpty: true, refuse: (value) => refusal(value, stored), onCommit: (value) => onCommitCell(row, rowId, col.id, stored, value), onCancel: onCancel, onTab: ctx.onTab, onEnter: ctx.onEnter }));
|
|
111
|
+
}
|
|
102
112
|
if (ctx.editorKind === "values" && col.field && isMultipleType(col.field.type)) {
|
|
103
113
|
return (_jsx(GridValueListEditor, { field: col.field, title: col.header, initial: baseline, labels: col.labels !== false, region: region, allowEmpty: true, refuse: (payload) => payload == null && !gridColumnEffectiveClearable(col, ctx.listConfig)
|
|
104
114
|
? gridClearRefusal(col, ctx.listConfig, messages)
|
|
@@ -28,9 +28,12 @@ export declare const GRID_CELL_HOVER_SHADOW = "hover:shadow-[0_1px_2px_rgb(0_0_0
|
|
|
28
28
|
* redraw. Applied to the cell by `gridCellClassName`, gated with
|
|
29
29
|
* GRID_CELL_HOVER_SHADOW: the line and the lift always appear together.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* The corners are `--vk-outline-radius`, shared with the selection ring so an
|
|
32
|
+
* app that straightens one straightens both; undeclared, the app's own
|
|
33
|
+
* `--radius-sm`, exactly what `rounded-sm` drew (a softened rectangle, 4px in
|
|
34
|
+
* the portal). Not a larger named radius: on a 37px-tall cell that reads as a
|
|
35
|
+
* lozenge. The line's colour is `--vk-outline-hover`, undeclared the strong
|
|
36
|
+
* line rung below.
|
|
34
37
|
*
|
|
35
38
|
* The outward shadow is on the cell itself (GRID_CELL_HOVER_SHADOW), not here:
|
|
36
39
|
* this ring sits at inset-0, exactly the cell's padding box, and a resting cell
|
|
@@ -42,7 +45,7 @@ export declare const GRID_CELL_HOVER_SHADOW = "hover:shadow-[0_1px_2px_rgb(0_0_0
|
|
|
42
45
|
* hovered cell reads as an edge among hairlines. This ring is the token's only
|
|
43
46
|
* consumer (hairlines ratchet).
|
|
44
47
|
*/
|
|
45
|
-
export declare const GRID_CELL_HOVER_RING = "hover:after:pointer-events-none hover:after:absolute hover:after:inset-0 hover:after:z-1 hover:after:rounded-sm hover:after:border hover:after:border-(color:--vk-border-bold)";
|
|
48
|
+
export declare const GRID_CELL_HOVER_RING = "hover:after:pointer-events-none hover:after:absolute hover:after:inset-0 hover:after:z-1 hover:after:rounded-(--vk-outline-radius,var(--radius-sm)) hover:after:border hover:after:border-(color:--vk-outline-hover,var(--vk-border-bold))";
|
|
46
49
|
/** The selection ring, in the same geometry the hover ring draws. */
|
|
47
50
|
export declare function GridCellOutline({ editing, }: {
|
|
48
51
|
/** Lifts the cell with a drop shadow to read as a live input. */
|
|
@@ -20,7 +20,9 @@ export function gridFrozenBg(selected, on) {
|
|
|
20
20
|
: cx(GRID_GROUND, GRID_FROZEN_HOVER);
|
|
21
21
|
}
|
|
22
22
|
export const GRID_CELL_HOVER_SHADOW = "hover:shadow-[0_1px_2px_rgb(0_0_0/0.05)] dark:hover:shadow-[0_1px_2px_rgb(0_0_0/0.22)]";
|
|
23
|
-
export const GRID_CELL_HOVER_RING = "hover:after:pointer-events-none hover:after:absolute hover:after:inset-0 hover:after:z-1 hover:after:rounded-sm hover:after:border hover:after:border-(color:--vk-border-bold)";
|
|
23
|
+
export const GRID_CELL_HOVER_RING = "hover:after:pointer-events-none hover:after:absolute hover:after:inset-0 hover:after:z-1 hover:after:rounded-(--vk-outline-radius,var(--radius-sm)) hover:after:border hover:after:border-(color:--vk-outline-hover,var(--vk-border-bold))";
|
|
24
24
|
export function GridCellOutline({ editing = false, }) {
|
|
25
|
-
return (_jsx("span", { "aria-hidden": true, "data-slot": "vk-grid-outline", className: cx("pointer-events-none absolute inset-0 z-1 rounded-
|
|
25
|
+
return (_jsx("span", { "aria-hidden": true, "data-slot": "vk-grid-outline", className: cx("pointer-events-none absolute inset-0 z-1 rounded-(--vk-outline-radius,var(--radius-sm)) border", editing
|
|
26
|
+
? "border-(color:--vk-outline-active,var(--vk-border-brand))"
|
|
27
|
+
: "border-(color:--vk-outline,var(--vk-fg-subtle)) group-hover/gridcell:border-(color:--vk-outline-active,var(--vk-border-brand))", editing && "shadow-lg shadow-black/20 dark:shadow-black/50") }));
|
|
26
28
|
}
|
|
@@ -8,7 +8,9 @@ import { prettifyOptionValue } from "../../model/column-state.js";
|
|
|
8
8
|
import { optionValues } from "@viewkitjs/fields";
|
|
9
9
|
import { offeredValues, takesNewValues, useOpenValues } from "../../editors/open-values.js";
|
|
10
10
|
import { useGridEditSession } from "./grid-edit-session.js";
|
|
11
|
+
import { useBodyPanel } from "../../editors/body-panel.js";
|
|
11
12
|
export function GridChipsEditor({ column, title, values, suggestions, optionColors, refuse, onCommit, onCancel, onTab, }) {
|
|
13
|
+
const panel = useBodyPanel("picker", "w-64", "z-90");
|
|
12
14
|
const editorRef = useRef(null);
|
|
13
15
|
const anchorRef = useRef(null);
|
|
14
16
|
const { session, close } = useGridEditSession({
|
|
@@ -31,5 +33,5 @@ export function GridChipsEditor({ column, title, values, suggestions, optionColo
|
|
|
31
33
|
label: column.options?.find((option) => option.value === value)?.label ?? prettifyOptionValue(value),
|
|
32
34
|
color: resolveCategoryColor(value, column.options, optionColors),
|
|
33
35
|
});
|
|
34
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, panelData: { "data-slot": "vk-grid-editor" }, onPanelClick: (event) => event.stopPropagation(), chrome: "menu", className:
|
|
36
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, panelData: { "data-slot": "vk-grid-editor", ...panel.data }, onPanelClick: (event) => event.stopPropagation(), chrome: "menu", className: panel.className, children: _jsx(ChipsEditor, { ref: editorRef, values: values, suggestions: offered, resolve: resolve, normalize: column.chips?.normalize, creatable: open, onRequestClose: close, label: typeof title === "string" ? title : undefined }) })] }));
|
|
35
37
|
}
|
|
@@ -12,6 +12,8 @@ type TriggerProps = {
|
|
|
12
12
|
role?: "button" | "columnheader";
|
|
13
13
|
"aria-haspopup"?: "dialog" | "menu";
|
|
14
14
|
"aria-expanded"?: boolean;
|
|
15
|
+
/** The contract's `open` state: present while the menu is open. */
|
|
16
|
+
"data-open"?: "";
|
|
15
17
|
};
|
|
16
18
|
/** The list's sort state, threaded from its controller — the menu is a second
|
|
17
19
|
* remote control for the SAME persisted sort the view-options popover drives. */
|
|
@@ -40,7 +42,8 @@ export declare function gridColumnMenuEnabled<Row>(col: ListColumn<Row>): boolea
|
|
|
40
42
|
* order, every block derived and none by hand:
|
|
41
43
|
*
|
|
42
44
|
* - Sort is offered where `effectiveSortKey` names a key (a declared
|
|
43
|
-
* `sortKey`, or the field itself on a saved view)
|
|
45
|
+
* `sortKey`, or the field itself on a saved view), or, for a place, by
|
|
46
|
+
* each of its parts (`columnSortParts`), flying out beside the menu. Clear sort appears only
|
|
44
47
|
* while this column IS the sort.
|
|
45
48
|
* - Group by is offered on a saved view for a field whose type groups
|
|
46
49
|
* (`columnGroupable`, the rule the toolbar's Group menu reads too); Ungroup
|