@viewkitjs/views 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +768 -0
- package/README.md +5 -3
- package/dist/atoms/Avatar.d.ts +2 -0
- package/dist/atoms/Avatar.js +13 -0
- package/dist/atoms/CellMore.d.ts +2 -0
- package/dist/atoms/CellMore.js +4 -0
- package/dist/atoms/DisabledReason.d.ts +11 -0
- package/dist/atoms/DisabledReason.js +10 -0
- package/dist/atoms/DrillRows.d.ts +3 -0
- package/dist/atoms/DrillRows.js +27 -0
- package/dist/atoms/Loading.d.ts +6 -0
- package/dist/atoms/Loading.js +4 -1
- package/dist/atoms/PanelRows.d.ts +5 -0
- package/dist/atoms/PanelRows.js +38 -0
- package/dist/atoms/PanelSearch.d.ts +2 -0
- package/dist/atoms/PanelSearch.js +21 -0
- package/dist/atoms/Pill.d.ts +2 -0
- package/dist/atoms/Pill.js +25 -0
- package/dist/atoms/RangeCalendar.d.ts +8 -0
- package/dist/atoms/RangeCalendar.js +30 -0
- package/dist/atoms/RelationRoles.js +2 -2
- package/dist/atoms/SelectionSheet.d.ts +3 -0
- package/dist/atoms/SelectionSheet.js +31 -0
- package/dist/atoms/ToolbarButton.d.ts +2 -0
- package/dist/atoms/ToolbarButton.js +18 -0
- package/dist/atoms/defaults.js +22 -0
- package/dist/atoms/types.d.ts +257 -1
- package/dist/cells/cell-format.d.ts +10 -1
- package/dist/cells/cell-title.d.ts +5 -1
- package/dist/cells/cell-title.js +2 -2
- package/dist/cells/cell-values.js +22 -7
- package/dist/cells/relation-wrap.js +1 -1
- package/dist/contract.d.ts +515 -18
- package/dist/contract.js +660 -5
- package/dist/display/actor.js +1 -1
- package/dist/display/boolean.js +5 -0
- package/dist/display/entity-chip.d.ts +12 -9
- package/dist/display/entity-chip.js +4 -5
- package/dist/display/fit-values.d.ts +34 -0
- package/dist/display/fit-values.js +45 -0
- package/dist/display/location.js +1 -1
- package/dist/display/multi-value.js +72 -8
- package/dist/display/options.d.ts +9 -1
- package/dist/display/relation.js +1 -1
- package/dist/display/rich-text.js +17 -6
- package/dist/display/select.js +6 -4
- package/dist/display/status-steps.d.ts +8 -0
- package/dist/display/status-steps.js +18 -0
- package/dist/display/viewer.js +1 -0
- package/dist/editors/BodyFrame.d.ts +29 -0
- package/dist/editors/BodyFrame.js +80 -0
- package/dist/editors/DateEditor.js +13 -17
- package/dist/editors/LocationEditor.d.ts +2 -0
- package/dist/editors/LocationEditor.js +29 -5
- package/dist/editors/NameEditor.d.ts +2 -0
- package/dist/editors/NameEditor.js +27 -7
- package/dist/editors/NumberEditor.d.ts +18 -0
- package/dist/editors/NumberEditor.js +29 -2
- package/dist/editors/RangeEditor.d.ts +2 -0
- package/dist/editors/RangeEditor.js +29 -4
- package/dist/editors/SelectEditor.d.ts +5 -0
- package/dist/editors/SelectEditor.js +3 -2
- package/dist/editors/TextEditor.d.ts +11 -1
- package/dist/editors/TextEditor.js +25 -8
- package/dist/editors/ValueListEditor.d.ts +7 -0
- package/dist/editors/ValueListEditor.js +60 -48
- package/dist/editors/body-panel.d.ts +7 -0
- package/dist/editors/body-panel.js +8 -0
- package/dist/editors/edit-session.d.ts +20 -3
- package/dist/editors/edit-session.js +43 -3
- package/dist/editors/leave-scope.d.ts +23 -0
- package/dist/editors/leave-scope.js +28 -0
- package/dist/editors/number-body.d.ts +29 -0
- package/dist/editors/number-body.js +37 -0
- package/dist/editors/parts-body.d.ts +66 -0
- package/dist/editors/parts-body.js +114 -0
- package/dist/editors/tab-ends.d.ts +5 -0
- package/dist/editors/tab-ends.js +7 -0
- package/dist/editors/text-body.d.ts +16 -0
- package/dist/editors/text-body.js +30 -0
- package/dist/editors/values-body.d.ts +47 -0
- package/dist/editors/values-body.js +140 -0
- package/dist/field-row/FieldRow.d.ts +7 -0
- package/dist/field-row/FieldRow.js +44 -24
- package/dist/field-row/FieldRowLane.js +12 -4
- package/dist/field-row/editors/RowChipsEditor.js +3 -1
- package/dist/field-row/editors/RowEditor.js +2 -1
- package/dist/field-row/editors/RowNameEditor.d.ts +5 -2
- package/dist/field-row/editors/RowNameEditor.js +12 -5
- package/dist/field-row/editors/RowNumberEditor.js +18 -2
- package/dist/field-row/editors/RowPlaceEditor.js +4 -2
- package/dist/field-row/editors/RowRangeEditor.d.ts +5 -2
- package/dist/field-row/editors/RowRangeEditor.js +13 -6
- package/dist/field-row/editors/RowRelationEditor.js +5 -2
- package/dist/field-row/editors/RowSelectEditor.js +4 -1
- package/dist/field-row/editors/RowTextEditor.d.ts +1 -1
- package/dist/field-row/editors/RowTextEditor.js +12 -3
- package/dist/field-row/editors/RowValueListEditor.d.ts +2 -1
- package/dist/field-row/editors/RowValueListEditor.js +17 -4
- package/dist/field-row/editors/host.d.ts +3 -0
- package/dist/field-row/editors/row-session.d.ts +12 -1
- package/dist/field-row/editors/row-session.js +52 -2
- package/dist/field-row/field-row-button.d.ts +40 -0
- package/dist/field-row/field-row-button.js +18 -0
- package/dist/field-row/field-row-checkbox.d.ts +9 -0
- package/dist/field-row/field-row-checkbox.js +7 -0
- package/dist/figures.d.ts +5 -48
- package/dist/figures.js +1 -63
- package/dist/filters/filter-model.d.ts +2 -0
- package/dist/grid/chrome/GridAddColumn.js +17 -3
- package/dist/grid/chrome/GridAggregateMenu.d.ts +2 -0
- package/dist/grid/chrome/GridAggregateMenu.js +2 -0
- package/dist/grid/chrome/GridCellEditors.js +16 -6
- package/dist/grid/chrome/GridCellOutline.d.ts +7 -4
- package/dist/grid/chrome/GridCellOutline.js +4 -2
- package/dist/grid/chrome/GridChipsEditor.js +3 -1
- package/dist/grid/chrome/GridColumnMenu.d.ts +7 -4
- package/dist/grid/chrome/GridColumnMenu.js +5 -3
- package/dist/grid/chrome/GridColumnSortSection.d.ts +23 -3
- package/dist/grid/chrome/GridColumnSortSection.js +18 -1
- package/dist/grid/chrome/GridFooter.d.ts +4 -1
- package/dist/grid/chrome/GridFooter.js +6 -4
- package/dist/grid/chrome/GridGroupMenu.d.ts +7 -3
- package/dist/grid/chrome/GridGroupMenu.js +30 -8
- package/dist/grid/chrome/GridHeader.d.ts +5 -1
- package/dist/grid/chrome/GridHeader.js +9 -5
- package/dist/grid/chrome/GridLongTextEditor.js +15 -11
- package/dist/grid/chrome/GridNameEditor.js +4 -2
- package/dist/grid/chrome/GridNumberEditor.d.ts +8 -1
- package/dist/grid/chrome/GridNumberEditor.js +15 -3
- package/dist/grid/chrome/GridPager.d.ts +7 -0
- package/dist/grid/chrome/GridPager.js +34 -0
- package/dist/grid/chrome/GridPlaceEditor.js +4 -2
- package/dist/grid/chrome/GridRangeEditor.js +12 -4
- package/dist/grid/chrome/GridRelationEditor.js +5 -2
- package/dist/grid/chrome/GridRow.js +18 -6
- package/dist/grid/chrome/GridRowActions.d.ts +8 -3
- package/dist/grid/chrome/GridRowActions.js +16 -6
- package/dist/grid/chrome/GridRowCells.js +23 -7
- package/dist/grid/chrome/GridRowGlyph.d.ts +3 -1
- package/dist/grid/chrome/GridRowGlyph.js +7 -2
- package/dist/grid/chrome/GridSelectEditor.js +6 -3
- package/dist/grid/chrome/GridStructure.d.ts +6 -1
- package/dist/grid/chrome/GridStructure.js +32 -8
- package/dist/grid/chrome/GridTable.js +36 -24
- package/dist/grid/chrome/GridTableSurface.d.ts +5 -1
- package/dist/grid/chrome/GridTableSurface.js +5 -2
- package/dist/grid/chrome/GridTextEditor.d.ts +5 -1
- package/dist/grid/chrome/GridTextEditor.js +13 -3
- package/dist/grid/chrome/GridValueListEditor.d.ts +12 -4
- package/dist/grid/chrome/GridValueListEditor.js +11 -3
- package/dist/grid/chrome/StuckMarker.d.ts +3 -1
- package/dist/grid/chrome/StuckMarker.js +6 -2
- package/dist/grid/chrome/cells.d.ts +4 -2
- package/dist/grid/chrome/cells.js +2 -2
- package/dist/grid/chrome/grid-add-column-items.d.ts +1 -1
- package/dist/grid/chrome/grid-add-column-items.js +8 -1
- package/dist/grid/chrome/grid-button.d.ts +32 -0
- package/dist/grid/chrome/grid-button.js +12 -0
- package/dist/grid/chrome/grid-cell-classes.d.ts +38 -0
- package/dist/grid/chrome/grid-cell-classes.js +30 -0
- package/dist/grid/chrome/grid-column-menu-items.d.ts +3 -0
- package/dist/grid/chrome/grid-column-menu-items.js +32 -3
- package/dist/grid/chrome/grid-columns-template.d.ts +27 -0
- package/dist/grid/chrome/grid-columns-template.js +13 -0
- package/dist/grid/chrome/grid-edit-session.d.ts +4 -1
- package/dist/grid/chrome/grid-edit-session.js +11 -1
- package/dist/grid/chrome/grid-group-menu-items.d.ts +8 -1
- package/dist/grid/chrome/grid-group-menu-items.js +17 -0
- package/dist/grid/chrome/grid-group-menu-parts.d.ts +10 -6
- package/dist/grid/chrome/grid-group-menu-parts.js +4 -2
- package/dist/grid/chrome/grid-hover.d.ts +4 -1
- package/dist/grid/chrome/grid-hover.js +16 -6
- package/dist/grid/chrome/grid-pages.d.ts +15 -0
- package/dist/grid/chrome/grid-pages.js +9 -0
- package/dist/grid/chrome/grid-row-menu-items.js +18 -10
- package/dist/grid/chrome/grid-row-props.d.ts +6 -2
- package/dist/grid/chrome/grid-row-window.d.ts +7 -0
- package/dist/grid/chrome/grid-row-window.js +35 -1
- package/dist/grid/chrome/grid-table-props.d.ts +38 -4
- package/dist/grid/chrome/useGridColumnLayout.d.ts +3 -1
- package/dist/grid/chrome/useGridColumnLayout.js +29 -9
- package/dist/grid/chrome/useGridPartColumns.js +1 -1
- package/dist/grid/chrome/useGridScrollArea.js +2 -0
- package/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -0
- package/dist/grid/chrome/useGridTableInteractionModel.js +5 -3
- package/dist/grid/chrome/useGridTableSelection.d.ts +3 -1
- package/dist/grid/chrome/useGridTableSelection.js +2 -2
- package/dist/grid/chrome/useHeaderDragReorder.js +2 -0
- package/dist/grid/core/editing-controller.d.ts +36 -11
- package/dist/grid/core/editing-controller.js +92 -25
- package/dist/grid/core/grid-aria.d.ts +4 -0
- package/dist/grid/core/grid-aria.js +6 -4
- package/dist/grid/core/grid-focus.d.ts +6 -0
- package/dist/grid/core/grid-focus.js +28 -5
- package/dist/grid/core/useGridEditing.d.ts +11 -2
- package/dist/grid/core/useGridEditing.js +9 -5
- package/dist/grid/core/write-states.d.ts +20 -0
- package/dist/grid/core/write-states.js +21 -0
- package/dist/grid/grid-format-props.d.ts +26 -0
- package/dist/grid/grid-format-props.js +65 -0
- package/dist/grid/index.d.ts +3 -1
- package/dist/grid/index.js +1 -0
- package/dist/grid/useGridTablePrefs.d.ts +20 -21
- package/dist/grid/useGridTablePrefs.js +6 -58
- package/dist/grid/useGridTableSettings.d.ts +60 -0
- package/dist/grid/useGridTableSettings.js +61 -0
- package/dist/grouping/sort-groups.d.ts +6 -7
- package/dist/internal/count.d.ts +3 -0
- package/dist/internal/count.js +3 -0
- package/dist/model/aggregates.d.ts +3 -3
- package/dist/model/aggregates.js +17 -71
- package/dist/model/body-frame.d.ts +16 -0
- package/dist/model/body-frame.js +5 -0
- package/dist/model/column-capabilities.d.ts +4 -1
- package/dist/model/column-capabilities.js +4 -1
- package/dist/model/column-filters.d.ts +7 -4
- package/dist/model/column-filters.js +26 -18
- package/dist/model/column-inspect.d.ts +3 -2
- package/dist/model/column-inspect.js +3 -1
- package/dist/model/column-order.d.ts +2 -2
- package/dist/model/column-schema.d.ts +6 -7
- package/dist/model/column-sort.d.ts +11 -0
- package/dist/model/column-sort.js +14 -0
- package/dist/model/column-state.d.ts +3 -20
- package/dist/model/column-state.js +1 -4
- package/dist/model/column-types.d.ts +1 -15
- package/dist/model/column-types.js +1 -1
- package/dist/model/one-value.d.ts +6 -0
- package/dist/model/one-value.js +5 -0
- package/dist/model/part-columns.d.ts +1 -6
- package/dist/model/part-columns.js +1 -1
- package/dist/model/part-rows.d.ts +2 -9
- package/dist/model/part-rows.js +1 -10
- package/dist/model/part-write.js +1 -1
- package/dist/model/place-parts.d.ts +6 -0
- package/dist/model/place-parts.js +14 -0
- package/dist/model/preferences.d.ts +3 -23
- package/dist/model/preferences.js +1 -17
- package/dist/model/prefs-buckets.d.ts +0 -27
- package/dist/model/prefs-buckets.js +1 -1
- package/dist/model/relation-filters.d.ts +13 -3
- package/dist/model/relation-filters.js +9 -4
- package/dist/model/row-icon.d.ts +17 -11
- package/dist/model/settings-columns.d.ts +34 -0
- package/dist/model/settings-columns.js +146 -0
- package/dist/model/settings-look.d.ts +17 -0
- package/dist/model/settings-look.js +23 -0
- package/dist/model/view-rules.d.ts +32 -6
- package/dist/model/view-rules.js +99 -23
- package/dist/panels/availability.d.ts +26 -0
- package/dist/panels/availability.js +28 -0
- package/dist/panels/filter/DateFilterBody.d.ts +42 -0
- package/dist/panels/filter/DateFilterBody.js +64 -0
- package/dist/panels/filter/DateFilterCalendar.d.ts +19 -0
- package/dist/panels/filter/DateFilterCalendar.js +37 -0
- package/dist/panels/filter/DateFilterInput.d.ts +16 -0
- package/dist/panels/filter/DateFilterInput.js +37 -0
- package/dist/panels/filter/FilterIcon.d.ts +7 -0
- package/dist/panels/filter/FilterIcon.js +15 -0
- package/dist/panels/filter/MenuSelect.d.ts +12 -0
- package/dist/panels/filter/MenuSelect.js +34 -0
- package/dist/panels/filter/NumberFilterBody.d.ts +21 -0
- package/dist/panels/filter/NumberFilterBody.js +76 -0
- package/dist/panels/filter/RangeFilterBody.d.ts +19 -0
- package/dist/panels/filter/RangeFilterBody.js +71 -0
- package/dist/panels/filter/RelationFilterBody.d.ts +17 -0
- package/dist/panels/filter/RelationFilterBody.js +20 -0
- package/dist/panels/filter/TextFilterBody.d.ts +31 -0
- package/dist/panels/filter/TextFilterBody.js +44 -0
- package/dist/panels/filter/TimeScopeDetail.d.ts +6 -0
- package/dist/panels/filter/TimeScopeDetail.js +47 -0
- package/dist/panels/filter/details.d.ts +17 -0
- package/dist/panels/filter/details.js +73 -0
- package/dist/panels/filter/filter-list.d.ts +23 -0
- package/dist/panels/filter/filter-list.js +38 -0
- package/dist/panels/group-sort.d.ts +24 -0
- package/dist/panels/group-sort.js +58 -0
- package/dist/panels/index.d.ts +24 -0
- package/dist/panels/index.js +17 -0
- package/dist/panels/labels.d.ts +37 -0
- package/dist/panels/labels.js +166 -0
- package/dist/panels/model.d.ts +343 -0
- package/dist/panels/model.js +77 -0
- package/dist/panels/react/GroupBucketsList.d.ts +16 -0
- package/dist/panels/react/GroupBucketsList.js +38 -0
- package/dist/panels/react/LayoutColumnsList.d.ts +24 -0
- package/dist/panels/react/LayoutColumnsList.js +71 -0
- package/dist/panels/react/PopoverColumnDetail.d.ts +11 -0
- package/dist/panels/react/PopoverColumnDetail.js +24 -0
- package/dist/panels/react/chrome.d.ts +17 -0
- package/dist/panels/react/chrome.js +8 -0
- package/dist/panels/react/column-refusals.d.ts +7 -0
- package/dist/panels/react/column-refusals.js +14 -0
- package/dist/panels/react/customize.d.ts +26 -0
- package/dist/panels/react/customize.js +98 -0
- package/dist/panels/react/drag.d.ts +2 -0
- package/dist/panels/react/drag.js +6 -0
- package/dist/panels/react/field-editor.d.ts +10 -0
- package/dist/panels/react/field-editor.js +1 -0
- package/dist/panels/react/filter-panel.d.ts +15 -0
- package/dist/panels/react/filter-panel.js +48 -0
- package/dist/panels/react/layout-detail.d.ts +4 -0
- package/dist/panels/react/layout-detail.js +21 -0
- package/dist/panels/react/order-details.d.ts +32 -0
- package/dist/panels/react/order-details.js +81 -0
- package/dist/panels/react/panel-header.d.ts +10 -0
- package/dist/panels/react/panel-header.js +12 -0
- package/dist/panels/react/panel-sheet.d.ts +19 -0
- package/dist/panels/react/panel-sheet.js +22 -0
- package/dist/panels/react/popover.d.ts +71 -0
- package/dist/panels/react/popover.js +47 -0
- package/dist/panels/react/root-list.d.ts +6 -0
- package/dist/panels/react/root-list.js +31 -0
- package/dist/panels/react/toolbar/ReadyToolbar.d.ts +42 -0
- package/dist/panels/react/toolbar/ReadyToolbar.js +92 -0
- package/dist/panels/react/toolbar/Toolbar.d.ts +16 -0
- package/dist/panels/react/toolbar/Toolbar.js +34 -0
- package/dist/panels/react/toolbar/ToolbarButton.d.ts +5 -0
- package/dist/panels/react/toolbar/ToolbarButton.js +9 -0
- package/dist/panels/react/toolbar/ToolbarFilter.d.ts +19 -0
- package/dist/panels/react/toolbar/ToolbarFilter.js +32 -0
- package/dist/panels/react/toolbar/ToolbarNew.d.ts +12 -0
- package/dist/panels/react/toolbar/ToolbarNew.js +21 -0
- package/dist/panels/react/toolbar/ToolbarOptions.d.ts +25 -0
- package/dist/panels/react/toolbar/ToolbarOptions.js +33 -0
- package/dist/panels/react/toolbar/ToolbarSearch.d.ts +9 -0
- package/dist/panels/react/toolbar/ToolbarSearch.js +41 -0
- package/dist/panels/react/toolbar/ToolbarSort.d.ts +12 -0
- package/dist/panels/react/toolbar/ToolbarSort.js +16 -0
- package/dist/panels/react/toolbar/ToolbarViews.d.ts +13 -0
- package/dist/panels/react/toolbar/ToolbarViews.js +24 -0
- package/dist/panels/react/toolbar/context.d.ts +29 -0
- package/dist/panels/react/toolbar/context.js +49 -0
- package/dist/panels/react/toolbar/panel-part.d.ts +37 -0
- package/dist/panels/react/toolbar/panel-part.js +37 -0
- package/dist/panels/react/toolbar/panel-state.d.ts +9 -0
- package/dist/panels/react/toolbar/panel-state.js +12 -0
- package/dist/panels/react/toolbar/use-box-narrow.d.ts +2 -0
- package/dist/panels/react/toolbar/use-box-narrow.js +18 -0
- package/dist/panels/react/toolbar/use-list-settings-state.d.ts +10 -0
- package/dist/panels/react/toolbar/use-list-settings-state.js +10 -0
- package/dist/panels/react/view-actions.d.ts +4 -0
- package/dist/panels/react/view-actions.js +37 -0
- package/dist/panels/react/view-footer.d.ts +16 -0
- package/dist/panels/react/view-footer.js +11 -0
- package/dist/panels/react/views-row/FoldingViewRow.d.ts +4 -0
- package/dist/panels/react/views-row/FoldingViewRow.js +105 -0
- package/dist/panels/react/views-row/HScrollRow.d.ts +7 -0
- package/dist/panels/react/views-row/HScrollRow.js +42 -0
- package/dist/panels/react/views-row/PillGroup.d.ts +30 -0
- package/dist/panels/react/views-row/PillGroup.js +86 -0
- package/dist/panels/react/views-row/ViewAxes.d.ts +6 -0
- package/dist/panels/react/views-row/ViewAxes.js +16 -0
- package/dist/panels/react/views-row/ViewCreatePill.d.ts +7 -0
- package/dist/panels/react/views-row/ViewCreatePill.js +11 -0
- package/dist/panels/react/views-row/ViewPicker.d.ts +5 -0
- package/dist/panels/react/views-row/ViewPicker.js +65 -0
- package/dist/panels/react/views-row/ViewPickerRow.d.ts +7 -0
- package/dist/panels/react/views-row/ViewPickerRow.js +18 -0
- package/dist/panels/react/views-row/ViewTabs.d.ts +31 -0
- package/dist/panels/react/views-row/ViewTabs.js +29 -0
- package/dist/panels/react/views-row/menu-classes.d.ts +6 -0
- package/dist/panels/react/views-row/menu-classes.js +3 -0
- package/dist/panels/react/views-row/use-anchored-toggle.d.ts +19 -0
- package/dist/panels/react/views-row/use-anchored-toggle.js +31 -0
- package/dist/panels/react.d.ts +51 -0
- package/dist/panels/react.js +43 -0
- package/dist/panels/settings/axes.d.ts +28 -0
- package/dist/panels/settings/axes.js +71 -0
- package/dist/panels/settings/filters.d.ts +5 -0
- package/dist/panels/settings/filters.js +62 -0
- package/dist/panels/settings/group-buckets.d.ts +23 -0
- package/dist/panels/settings/group-buckets.js +73 -0
- package/dist/panels/settings/input.d.ts +69 -0
- package/dist/panels/settings/input.js +1 -0
- package/dist/panels/settings/layout.d.ts +5 -0
- package/dist/panels/settings/layout.js +244 -0
- package/dist/panels/settings/order.d.ts +19 -0
- package/dist/panels/settings/order.js +271 -0
- package/dist/panels/settings/settings-panels.d.ts +17 -0
- package/dist/panels/settings/settings-panels.js +28 -0
- package/dist/panels/toolbar/clear.d.ts +9 -0
- package/dist/panels/toolbar/clear.js +26 -0
- package/dist/panels/toolbar/counts.d.ts +15 -0
- package/dist/panels/toolbar/counts.js +21 -0
- package/dist/panels/toolbar/edit-view.d.ts +5 -0
- package/dist/panels/toolbar/edit-view.js +18 -0
- package/dist/panels/toolbar/model.d.ts +34 -0
- package/dist/panels/toolbar/model.js +52 -0
- package/dist/panels/use-filter-opened.d.ts +8 -0
- package/dist/panels/use-filter-opened.js +11 -0
- package/dist/panels/view-state.d.ts +38 -0
- package/dist/panels/view-state.js +1 -0
- package/dist/panels/views-row/model.d.ts +131 -0
- package/dist/panels/views-row/model.js +14 -0
- package/dist/provider/ViewsProvider.d.ts +50 -6
- package/dist/provider/ViewsProvider.js +33 -2
- package/dist/provider/components.d.ts +274 -11
- package/dist/provider/context.d.ts +23 -2
- package/dist/provider/desktop.d.ts +3 -0
- package/dist/provider/desktop.js +7 -4
- package/dist/react.d.ts +5 -2
- package/dist/selection/SelectionBar.d.ts +18 -0
- package/dist/selection/SelectionBar.js +98 -0
- package/dist/selection/SelectionBarPhone.d.ts +3 -0
- package/dist/selection/SelectionBarPhone.js +14 -0
- package/dist/selection/bar-overflow.d.ts +12 -0
- package/dist/selection/bar-overflow.js +55 -0
- package/dist/selection/bar-parts.d.ts +17 -0
- package/dist/selection/bar-parts.js +19 -0
- package/dist/selection/index.d.ts +2 -0
- package/dist/selection/index.js +1 -0
- package/dist/selection/types.d.ts +3 -2
- package/dist/selection/useListSelectionShortcuts.d.ts +3 -2
- package/dist/selection/useListSelectionShortcuts.js +1 -1
- package/dist/selection/verbs.d.ts +41 -0
- package/dist/selection/verbs.js +1 -0
- package/docs/contract.md +355 -35
- package/docs/getting-started.md +1 -1
- package/docs/guides/atoms.md +39 -6
- package/docs/guides/columns.md +1 -1
- package/docs/guides/display.md +3 -2
- package/docs/guides/editors.md +4 -3
- package/docs/guides/selection.md +35 -21
- package/docs/guides/the-grid.md +24 -13
- package/docs/guides/the-provider.md +24 -6
- package/docs/index.md +2 -0
- package/docs/install.md +3 -1
- package/docs/reference/cells.md +1 -1
- package/docs/reference/display.md +5 -4
- package/docs/reference/editors-location.md +3 -1
- package/docs/reference/editors-name.md +3 -1
- package/docs/reference/editors-number.md +1 -0
- package/docs/reference/editors-range.md +3 -1
- package/docs/reference/editors-session.md +1 -0
- package/docs/reference/editors-text.md +2 -2
- package/docs/reference/editors-value-list.md +1 -1
- package/docs/reference/field-row.md +2 -2
- package/docs/reference/grid.md +10 -7
- package/docs/reference/panels-react.md +101 -0
- package/docs/reference/panels.md +123 -0
- package/docs/reference/react.md +45 -12
- package/docs/reference/selection.md +11 -3
- package/docs/reference/views.md +41 -38
- package/package.json +33 -4
- package/skills/views/SKILL.md +5 -4
|
@@ -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
|
+
}
|
package/dist/figures.d.ts
CHANGED
|
@@ -1,52 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A GROUP'S FIGURES, AS THE DATABASE COUNTED THEM (POR-470).
|
|
3
3
|
*
|
|
4
|
-
* A source list holds a page, not the list, so a footer or a group header that
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* footer pick the database can answer is read from them. Four, not one per
|
|
9
|
-
* pick: two parts' sums, counts, mins and maxes combine exactly, so a group
|
|
10
|
-
* folded from many discovery rows (the days of a week, a row under each of its
|
|
11
|
-
* tags) still answers an average, which a mean of the parts' means does not.
|
|
12
|
-
* Pure and free of the engine: the chassis reads it, the engine produces it.
|
|
13
|
-
*
|
|
14
|
-
* It imports NOTHING, not even a type: the source engine runs on the server,
|
|
15
|
-
* and the list model (`model/`) reaches browser modules — a type import is an
|
|
16
|
-
* edge the library ratchet follows (L004). So the footer picks are named here,
|
|
17
|
-
* and every caller hands a `ListAggregateKind`: a pick added there and not
|
|
18
|
-
* here fails the checker at the footer's call.
|
|
19
|
-
*/
|
|
20
|
-
/** The footer picks, as `model/column-schema.ts` names them (`ListAggregateKind`). */
|
|
21
|
-
export type FigureKind = "none" | "sum" | "avg" | "min" | "max" | "count" | "filled" | "unique" | "ratio";
|
|
22
|
-
export type ColumnFigure = {
|
|
23
|
-
sum: number | null;
|
|
24
|
-
count: number;
|
|
25
|
-
min: number | null;
|
|
26
|
-
max: number | null;
|
|
27
|
-
};
|
|
28
|
-
/** A group's — or the whole list's — figures: its rows, and each totalled key's figure. */
|
|
29
|
-
export type GroupFigures = {
|
|
30
|
-
rows: number;
|
|
31
|
-
fields: Record<string, ColumnFigure>;
|
|
32
|
-
};
|
|
33
|
-
export declare const EMPTY_FIGURE: ColumnFigure;
|
|
34
|
-
/** Two parts' figures as the figure of both. A null is a value absent, never a zero. */
|
|
35
|
-
export declare function combineFigure(a: ColumnFigure, b: ColumnFigure): ColumnFigure;
|
|
36
|
-
/** The figure of some values, a blank not counted. */
|
|
37
|
-
export declare function figureOf(values: readonly (number | null | undefined)[]): ColumnFigure;
|
|
38
|
-
/**
|
|
39
|
-
* The number a footer pick shows, or null for nothing to show. Follows the
|
|
40
|
-
* browser's own aggregate (`computeAggregate`): over no values, sum, avg, min
|
|
41
|
-
* and max are null; Count is the group's rows; Filled is the values present.
|
|
42
|
-
* Unique and Ratio are not the database's to answer.
|
|
43
|
-
*/
|
|
44
|
-
export declare function figureFor(kind: FigureKind, figures: GroupFigures, key: string): number | null;
|
|
45
|
-
/**
|
|
46
|
-
* A ratio formula's footer from its two parts' figures: sum over sum, as a
|
|
47
|
-
* percent (0–100), divided once — the browser's own `ratio` over the same
|
|
48
|
-
* rows. Null when either part was not totalled or the denominator is empty.
|
|
4
|
+
* A source list holds a page, not the list, so a footer or a group header that totals the rows in hand is wrong past
|
|
5
|
+
* the first page: it reads the figures the database answered for the whole group. Their shape and rules are
|
|
6
|
+
* `@viewkitjs/fields`' (the query entry's figures), which answers the same shape in memory, so the browser and a
|
|
7
|
+
* database are held to one answer. Re-exported here under the names the grid and the apps already read.
|
|
49
8
|
*/
|
|
50
|
-
export
|
|
51
|
-
/** Whether an answer's field is a `GroupFigures` — the hook hands a first page's own fields over untyped. */
|
|
52
|
-
export declare function isGroupFigures(value: unknown): value is GroupFigures;
|
|
9
|
+
export { EMPTY_FIGURE, combineFigure, figureFor, figureOf, isGroupFigures, ratioFigure, type ColumnFigure, type FigureKind, type GroupFigures, } from "@viewkitjs/fields/query";
|
package/dist/figures.js
CHANGED
|
@@ -1,63 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
function either(a, b, both) {
|
|
3
|
-
return a == null ? b : b == null ? a : both(a, b);
|
|
4
|
-
}
|
|
5
|
-
export function combineFigure(a, b) {
|
|
6
|
-
return {
|
|
7
|
-
sum: either(a.sum, b.sum, (x, y) => x + y),
|
|
8
|
-
count: a.count + b.count,
|
|
9
|
-
min: either(a.min, b.min, Math.min),
|
|
10
|
-
max: either(a.max, b.max, Math.max),
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export function figureOf(values) {
|
|
14
|
-
let figure = EMPTY_FIGURE;
|
|
15
|
-
for (const value of values) {
|
|
16
|
-
if (value == null || Number.isNaN(value))
|
|
17
|
-
continue;
|
|
18
|
-
figure = combineFigure(figure, { sum: value, count: 1, min: value, max: value });
|
|
19
|
-
}
|
|
20
|
-
return figure;
|
|
21
|
-
}
|
|
22
|
-
export function figureFor(kind, figures, key) {
|
|
23
|
-
if (kind === "none" || kind === "unique" || kind === "ratio")
|
|
24
|
-
return null;
|
|
25
|
-
if (kind === "count")
|
|
26
|
-
return figures.rows;
|
|
27
|
-
const figure = figures.fields[key];
|
|
28
|
-
if (!figure)
|
|
29
|
-
return null;
|
|
30
|
-
if (kind === "filled")
|
|
31
|
-
return figure.count;
|
|
32
|
-
if (figure.count === 0)
|
|
33
|
-
return null;
|
|
34
|
-
if (kind === "sum")
|
|
35
|
-
return figure.sum;
|
|
36
|
-
if (kind === "avg")
|
|
37
|
-
return figure.sum == null ? null : figure.sum / figure.count;
|
|
38
|
-
return kind === "min" ? figure.min : figure.max;
|
|
39
|
-
}
|
|
40
|
-
export function ratioFigure(figures, numerator, denominator) {
|
|
41
|
-
const num = figures.fields[numerator];
|
|
42
|
-
const den = figures.fields[denominator];
|
|
43
|
-
if (!num || !den)
|
|
44
|
-
return null;
|
|
45
|
-
const denominatorSum = den.sum ?? 0;
|
|
46
|
-
return denominatorSum > 0 ? Math.round(((num.sum ?? 0) / denominatorSum) * 100) : null;
|
|
47
|
-
}
|
|
48
|
-
const isFigure = (value) => !!value &&
|
|
49
|
-
typeof value === "object" &&
|
|
50
|
-
typeof value.count === "number" &&
|
|
51
|
-
["sum", "min", "max"].every((part) => {
|
|
52
|
-
const at = value[part];
|
|
53
|
-
return at === null || typeof at === "number";
|
|
54
|
-
});
|
|
55
|
-
export function isGroupFigures(value) {
|
|
56
|
-
if (!value || typeof value !== "object")
|
|
57
|
-
return false;
|
|
58
|
-
const { rows, fields } = value;
|
|
59
|
-
return (typeof rows === "number" &&
|
|
60
|
-
!!fields &&
|
|
61
|
-
typeof fields === "object" &&
|
|
62
|
-
Object.values(fields).every(isFigure));
|
|
63
|
-
}
|
|
1
|
+
export { EMPTY_FIGURE, combineFigure, figureFor, figureOf, isGroupFigures, ratioFigure, } from "@viewkitjs/fields/query";
|
|
@@ -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)
|