viewkitjs 0.31.0 → 0.33.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 +198 -0
- package/MIGRATION.md +40 -6
- package/README.md +1 -1
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/query/evaluate.d.ts +7 -0
- package/fields/dist/query/exact-number.d.ts +8 -2
- package/fields/dist/query/exact-number.js +14 -1
- package/fields/dist/query/index.d.ts +2 -0
- package/fields/dist/query/index.js +2 -0
- package/fields/dist/query/list-request.d.ts +148 -0
- package/fields/dist/query/list-request.js +125 -0
- package/fields/dist/query/saved-view.d.ts +15 -0
- package/fields/dist/query/saved-view.js +11 -0
- package/fields/dist/query/settings.d.ts +9 -0
- package/fields/dist/query/settings.js +9 -0
- package/fields/dist/query/sort.js +13 -10
- package/fields/dist/registry.js +5 -1
- package/fields/dist/types.d.ts +4 -1
- package/fields/dist/zod.d.ts +5 -0
- package/fields/dist/zod.js +10 -1
- package/fields/docs/guides/contact-values.md +12 -0
- package/fields/docs/guides/field-types.md +1 -1
- package/fields/docs/guides/queries.md +3 -1
- package/fields/docs/reference/fields.md +1 -0
- package/fields/docs/reference/query.md +66 -0
- package/package.json +5 -1
- package/postgres/README.md +1 -0
- package/postgres/dist/check.js +4 -1
- package/postgres/dist/definitions/formula-forms.js +3 -1
- package/postgres/dist/definitions/money.js +2 -1
- package/postgres/dist/handler.d.ts +53 -0
- package/postgres/dist/handler.js +211 -0
- package/postgres/dist/ids.d.ts +1 -1
- package/postgres/dist/ids.js +19 -1
- package/postgres/dist/index.d.ts +1 -0
- package/postgres/dist/index.js +1 -0
- package/postgres/dist/limits.d.ts +3 -1
- package/postgres/dist/limits.js +1 -1
- package/postgres/dist/list-fields.d.ts +10 -0
- package/postgres/dist/list-fields.js +36 -0
- package/postgres/dist/page.js +6 -3
- package/postgres/dist/readable.d.ts +4 -0
- package/postgres/dist/readable.js +4 -0
- package/postgres/dist/refusals.d.ts +9 -2
- package/postgres/dist/refusals.js +6 -0
- package/postgres/dist/rules.d.ts +15 -1
- package/postgres/dist/rules.js +16 -0
- package/postgres/dist/sort.js +7 -2
- package/postgres/docs/guides/definitions.md +1 -1
- package/postgres/docs/guides/field-map.md +3 -3
- package/postgres/docs/guides/list-handler.md +99 -0
- package/postgres/docs/index.md +1 -0
- package/postgres/docs/reference/definitions.md +1 -1
- package/postgres/docs/reference/postgres.md +12 -4
- package/views/README.md +2 -2
- package/views/dist/atoms/RowMenu.d.ts +7 -0
- package/views/dist/atoms/RowMenu.js +18 -16
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +4 -3
- package/views/dist/atoms/carried.d.ts +5 -0
- package/views/dist/atoms/carried.js +7 -0
- package/views/dist/atoms/frame-parts.d.ts +6 -0
- package/views/dist/atoms/frame-parts.js +15 -0
- package/views/dist/atoms/types.d.ts +19 -7
- package/views/dist/cells/cell-title.d.ts +3 -1
- package/views/dist/cells/cell-title.js +2 -2
- package/views/dist/cells/cell-values.js +2 -2
- package/views/dist/contract.d.ts +56 -11
- package/views/dist/contract.js +148 -0
- package/views/dist/controls/alert-dialog/alert-dialog.js +2 -1
- package/views/dist/controls/atoms.d.ts +2 -0
- package/views/dist/controls/atoms.js +2 -0
- package/views/dist/controls/avatar/avatar.d.ts +3 -3
- package/views/dist/controls/avatar/avatar.js +1 -1
- package/views/dist/controls/avatar/tokens.d.ts +44 -0
- package/views/dist/controls/avatar/tokens.js +11 -0
- package/views/dist/controls/avatar.css +22 -5
- package/views/dist/controls/button/map-button.js +2 -0
- package/views/dist/controls/checkbox/checkbox.d.ts +3 -2
- package/views/dist/controls/checkbox/checkbox.js +2 -2
- package/views/dist/controls/choice/tokens.d.ts +0 -4
- package/views/dist/controls/choice/tokens.js +0 -1
- package/views/dist/controls/choice.css +3 -3
- package/views/dist/controls/compound-editor/compound-editor.d.ts +1 -1
- package/views/dist/controls/compound-editor/name-parts.js +4 -4
- package/views/dist/controls/compound-editor/place-parts.js +19 -19
- package/views/dist/controls/compound-editor/range-parts.js +14 -14
- package/views/dist/controls/compound-editor/row.d.ts +3 -1
- package/views/dist/controls/compound-editor/row.js +2 -2
- package/views/dist/controls/controls.d.ts +8 -0
- package/views/dist/controls/controls.js +12 -2
- package/views/dist/controls/customize/customize.js +37 -35
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
- package/views/dist/controls/customize/map-customize-body.js +5 -1
- package/views/dist/controls/date-editor/date-days.js +2 -2
- package/views/dist/controls/date-editor/date-editor.js +18 -18
- package/views/dist/controls/date-editor/date-parts.js +6 -6
- package/views/dist/controls/date-editor/map-calendar.js +1 -1
- package/views/dist/controls/date-editor.css +2 -2
- package/views/dist/controls/field/field.d.ts +22 -4
- package/views/dist/controls/field/field.js +63 -5
- package/views/dist/controls/field/tokens.d.ts +4 -0
- package/views/dist/controls/field/tokens.js +1 -0
- package/views/dist/controls/field.css +41 -16
- package/views/dist/controls/filter-editor/block.d.ts +2 -2
- package/views/dist/controls/filter-editor/block.js +5 -5
- package/views/dist/controls/filter-editor/filter-editor.js +31 -33
- package/views/dist/controls/filter-editor/how.d.ts +3 -1
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -3
- package/views/dist/controls/filter-editor/map-rules.js +1 -1
- package/views/dist/controls/filter-editor/parts.js +2 -1
- package/views/dist/controls/glyphs/glyphs.d.ts +10 -0
- package/views/dist/controls/glyphs/glyphs.js +173 -0
- package/views/dist/controls/group-editor/group-editor.js +15 -13
- package/views/dist/controls/index.d.ts +4 -1
- package/views/dist/controls/index.js +3 -1
- package/views/dist/controls/input/input.js +6 -3
- package/views/dist/controls/input/map-input.js +2 -0
- package/views/dist/controls/input/tokens.d.ts +4 -0
- package/views/dist/controls/input/tokens.js +1 -0
- package/views/dist/controls/input.css +31 -3
- package/views/dist/controls/internal/editor-parts.js +1 -1
- package/views/dist/controls/internal/icons.js +10 -0
- package/views/dist/controls/internal/keep-focus.d.ts +2 -0
- package/views/dist/controls/internal/keep-focus.js +17 -0
- package/views/dist/controls/internal/map-panel-controls.d.ts +8 -0
- package/views/dist/controls/internal/map-panel-controls.js +20 -0
- package/views/dist/controls/internal/panel-controls.d.ts +50 -0
- package/views/dist/controls/internal/panel-controls.js +197 -0
- package/views/dist/controls/internal/part-slot.d.ts +12 -0
- package/views/dist/controls/internal/part-slot.js +5 -0
- package/views/dist/controls/internal/watch-frame.d.ts +2 -0
- package/views/dist/controls/internal/watch-frame.js +33 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +1 -1
- package/views/dist/controls/links-editor/links-editor.js +27 -27
- package/views/dist/controls/markdown/map-markdown.d.ts +4 -0
- package/views/dist/controls/markdown/map-markdown.js +5 -0
- package/views/dist/controls/menu/map-menu.d.ts +2 -2
- package/views/dist/controls/menu/map-menu.js +15 -12
- package/views/dist/controls/menu/menu.d.ts +2 -0
- package/views/dist/controls/menu/menu.js +3 -3
- package/views/dist/controls/menu-list/menu-list.d.ts +17 -4
- package/views/dist/controls/menu-list/menu-list.js +27 -25
- package/views/dist/controls/modal/modal.js +5 -1
- package/views/dist/controls/notice/notice.d.ts +3 -1
- package/views/dist/controls/notice/notice.js +2 -2
- package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
- package/views/dist/controls/number-editor/number-editor.js +13 -13
- package/views/dist/controls/number-field/number-field.js +5 -3
- package/views/dist/controls/pane/pane.d.ts +4 -2
- package/views/dist/controls/pane/pane.js +6 -5
- package/views/dist/controls/phone-header/header-bar.d.ts +5 -1
- package/views/dist/controls/phone-header/header-bar.js +2 -2
- package/views/dist/controls/phone-header.css +11 -1
- package/views/dist/controls/picker/map-picker.js +3 -0
- package/views/dist/controls/picker/picker.d.ts +16 -0
- package/views/dist/controls/picker/picker.js +61 -40
- package/views/dist/controls/picker/rows.d.ts +4 -0
- package/views/dist/controls/picker.css +2 -0
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +4 -2
- package/views/dist/controls/popover/popover.js +2 -1
- package/views/dist/controls/quick-filters/quick-filters.js +4 -4
- package/views/dist/controls/radio/radio.d.ts +8 -3
- package/views/dist/controls/radio/radio.js +22 -5
- package/views/dist/controls/radio/tokens.d.ts +44 -0
- package/views/dist/controls/radio/tokens.js +11 -0
- package/views/dist/controls/radio.css +79 -1
- package/views/dist/controls/select/map-select.d.ts +3 -0
- package/views/dist/controls/select/map-select.js +8 -0
- package/views/dist/controls/select/select.d.ts +7 -0
- package/views/dist/controls/select/select.js +12 -6
- package/views/dist/controls/select/tokens.d.ts +8 -0
- package/views/dist/controls/select/tokens.js +2 -0
- package/views/dist/controls/select.css +17 -0
- package/views/dist/controls/setting-row/looks.d.ts +1 -1
- package/views/dist/controls/setting-row/looks.js +9 -4
- package/views/dist/controls/setting-row/setting-row.d.ts +45 -10
- package/views/dist/controls/setting-row/setting-row.js +82 -15
- package/views/dist/controls/setting-row/tokens.d.ts +74 -2
- package/views/dist/controls/setting-row/tokens.js +19 -1
- package/views/dist/controls/setting-row.css +135 -14
- package/views/dist/controls/sheet/bottom-sheet.d.ts +14 -2
- package/views/dist/controls/sheet/bottom-sheet.js +6 -3
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/sheet.css +4 -1
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +1 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +7 -3
- package/views/dist/controls/sort-editor/sort-editor.js +25 -26
- package/views/dist/controls/sort-editor.css +13 -2
- package/views/dist/controls/switch-row/tokens.d.ts +0 -12
- package/views/dist/controls/switch-row/tokens.js +0 -3
- package/views/dist/controls/switch-row.css +3 -7
- package/views/dist/controls/switch.css +17 -7
- package/views/dist/controls/tag/tag.d.ts +3 -1
- package/views/dist/controls/tag/tag.js +2 -2
- package/views/dist/controls/tag/tokens.d.ts +4 -0
- package/views/dist/controls/tag/tokens.js +1 -0
- package/views/dist/controls/tag-field/tag-field.d.ts +5 -1
- package/views/dist/controls/tag-field/tag-field.js +11 -5
- package/views/dist/controls/tag-field/tokens.d.ts +16 -0
- package/views/dist/controls/tag-field/tokens.js +4 -0
- package/views/dist/controls/tag-field.css +19 -0
- package/views/dist/controls/tag.css +2 -0
- package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
- package/views/dist/controls/text-editor/text-editor.js +8 -8
- package/views/dist/controls/toolbar/toolbar.d.ts +15 -3
- package/views/dist/controls/toolbar/toolbar.js +22 -15
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +14 -0
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +52 -0
- package/views/dist/controls/toolbar-button/toolbar-button.d.ts +1 -1
- package/views/dist/controls/toolbar-button/toolbar-button.js +2 -3
- package/views/dist/controls/toolbar-button.css +4 -0
- package/views/dist/controls/toolbar.css +5 -0
- package/views/dist/controls/values-editor/values-editor.d.ts +1 -1
- package/views/dist/controls/values-editor/values-editor.js +22 -22
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -0
- package/views/dist/controls/views-list/map-view-menu.js +25 -0
- package/views/dist/controls/views-list/map-views-list-body.d.ts +28 -1
- package/views/dist/controls/views-list/map-views-list-body.js +39 -21
- package/views/dist/controls/views-list/rules.d.ts +2 -0
- package/views/dist/controls/views-list/view-menu.d.ts +7 -0
- package/views/dist/controls/views-list/view-menu.js +33 -29
- package/views/dist/controls/views-list/views-list.js +4 -4
- package/views/dist/controls/views-list/words.d.ts +2 -0
- package/views/dist/controls/views-list/words.js +1 -1
- package/views/dist/editors/EditorPanel.js +3 -2
- package/views/dist/editors/edit-session.js +2 -5
- package/views/dist/field-row/FieldRow.d.ts +4 -2
- package/views/dist/field-row/FieldRow.js +80 -20
- package/views/dist/field-row/FieldRowLane.d.ts +7 -2
- package/views/dist/field-row/FieldRowLane.js +4 -3
- package/views/dist/field-row/editors/RowEditor.d.ts +12 -0
- package/views/dist/field-row/editors/RowEditor.js +31 -1
- package/views/dist/field-row/editors/RowValueListEditor.d.ts +5 -1
- package/views/dist/field-row/editors/RowValueListEditor.js +4 -1
- package/views/dist/field-row/field-row-button.d.ts +5 -0
- package/views/dist/field-row/field-row-button.js +2 -0
- package/views/dist/fields/binding.d.ts +3 -2
- package/views/dist/fields/binding.js +38 -5
- package/views/dist/fields/money.d.ts +5 -2
- package/views/dist/fields/money.js +14 -2
- package/views/dist/grid/chrome/GridColumnMenu.d.ts +4 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +3 -2
- package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -1
- package/views/dist/grid/chrome/GridGroupMenu.js +4 -3
- package/views/dist/grid/chrome/GridHeader.d.ts +4 -1
- package/views/dist/grid/chrome/GridHeader.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +6 -5
- package/views/dist/grid/chrome/GridRowCells.js +6 -9
- package/views/dist/grid/chrome/GridStructure.d.ts +4 -1
- package/views/dist/grid/chrome/GridStructure.js +4 -4
- package/views/dist/grid/chrome/GridTable.js +9 -3
- package/views/dist/grid/chrome/cell-clipboard.d.ts +4 -2
- package/views/dist/grid/chrome/cell-clipboard.js +2 -2
- package/views/dist/grid/chrome/cells.js +3 -1
- package/views/dist/grid/chrome/grid-column-menu-items.js +1 -1
- package/views/dist/grid/chrome/grid-row-menu-items.d.ts +27 -3
- package/views/dist/grid/chrome/grid-row-menu-items.js +93 -7
- package/views/dist/grid/chrome/grid-row-props.d.ts +7 -2
- package/views/dist/grid/chrome/grid-rows-menu.js +34 -6
- package/views/dist/grid/chrome/grid-table-props.d.ts +38 -7
- package/views/dist/grid/chrome/useGridBatchApi.d.ts +3 -1
- package/views/dist/grid/chrome/useGridBatchApi.js +4 -2
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +7 -2
- package/views/dist/grid/chrome/useGridKeyboard.js +43 -14
- package/views/dist/grid/chrome/useGridPendingReconciliation.js +1 -2
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +20 -7
- package/views/dist/grid/core/clipboard-model.d.ts +3 -1
- package/views/dist/grid/core/clipboard-model.js +9 -8
- package/views/dist/grid/core/commit-model.d.ts +20 -2
- package/views/dist/grid/core/editing-controller.d.ts +21 -0
- package/views/dist/grid/core/editing-controller.js +194 -42
- package/views/dist/grid/core/editing-model.d.ts +3 -0
- package/views/dist/grid/core/editing-model.js +3 -0
- package/views/dist/grid/core/edits-sink.d.ts +19 -0
- package/views/dist/grid/core/edits-sink.js +2 -0
- package/views/dist/grid/core/save-path.d.ts +24 -0
- package/views/dist/grid/core/save-path.js +122 -0
- package/views/dist/grid/core/spreadsheet-operations.d.ts +3 -0
- package/views/dist/grid/core/spreadsheet-operations.js +24 -1
- package/views/dist/grid/core/useGridEditing.d.ts +5 -0
- package/views/dist/grid/core/useGridEditing.js +6 -0
- package/views/dist/grid/index.d.ts +3 -2
- package/views/dist/grid/index.js +1 -0
- package/views/dist/internal/field-rows.d.ts +26 -0
- package/views/dist/internal/field-rows.js +8 -0
- package/views/dist/internal/page-close.d.ts +7 -0
- package/views/dist/internal/page-close.js +43 -0
- package/views/dist/list/answer.d.ts +40 -0
- package/views/dist/list/answer.js +43 -0
- package/views/dist/list/browser-views-store.d.ts +10 -0
- package/views/dist/list/browser-views-store.js +182 -0
- package/views/dist/list/bulk-bar.d.ts +7 -0
- package/views/dist/list/bulk-bar.js +10 -0
- package/views/dist/list/columns.d.ts +24 -0
- package/views/dist/list/columns.js +27 -0
- package/views/dist/list/edits.d.ts +19 -0
- package/views/dist/list/edits.js +56 -0
- package/views/dist/list/grid.d.ts +11 -0
- package/views/dist/list/grid.js +76 -0
- package/views/dist/list/index.d.ts +36 -0
- package/views/dist/list/index.js +11 -0
- package/views/dist/list/link.d.ts +8 -0
- package/views/dist/list/link.js +78 -0
- package/views/dist/list/list.d.ts +70 -0
- package/views/dist/list/list.js +14 -0
- package/views/dist/list/menu.d.ts +31 -0
- package/views/dist/list/menu.js +76 -0
- package/views/dist/list/parts.d.ts +6 -0
- package/views/dist/list/parts.js +66 -0
- package/views/dist/list/registry.d.ts +11 -0
- package/views/dist/list/registry.js +31 -0
- package/views/dist/list/root-base.d.ts +46 -0
- package/views/dist/list/root-base.js +137 -0
- package/views/dist/list/root.d.ts +41 -0
- package/views/dist/list/root.js +168 -0
- package/views/dist/list/slot.d.ts +14 -0
- package/views/dist/list/slot.js +22 -0
- package/views/dist/list/source-answers.d.ts +39 -0
- package/views/dist/list/source-answers.js +225 -0
- package/views/dist/list/source.d.ts +11 -0
- package/views/dist/list/source.js +31 -0
- package/views/dist/list/store.d.ts +119 -0
- package/views/dist/list/store.js +146 -0
- package/views/dist/list/toolbar.d.ts +7 -0
- package/views/dist/list/toolbar.js +371 -0
- package/views/dist/list/views-axis.d.ts +5 -0
- package/views/dist/list/views-axis.js +98 -0
- package/views/dist/list/views-store.d.ts +41 -0
- package/views/dist/list/views-store.js +1 -0
- package/views/dist/list/views.d.ts +72 -0
- package/views/dist/list/views.js +411 -0
- package/views/dist/model/column-capabilities.d.ts +13 -0
- package/views/dist/model/column-capabilities.js +23 -2
- package/views/dist/model/column-schema.d.ts +11 -1
- package/views/dist/model/preferences.js +1 -1
- package/views/dist/model/prefs-buckets.js +1 -1
- package/views/dist/model/view-rules.js +1 -0
- package/views/dist/panels/index.d.ts +3 -1
- package/views/dist/panels/index.js +1 -0
- package/views/dist/panels/model.d.ts +2 -0
- package/views/dist/panels/react/customize-body.js +1 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +47 -4
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +6 -326
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +17 -2
- package/views/dist/panels/react/toolbar/Toolbar.js +43 -23
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -4
- package/views/dist/panels/react/toolbar/ToolbarButton.js +7 -1
- package/views/dist/panels/react/toolbar/ToolbarFilter.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarNew.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
- package/views/dist/panels/react/toolbar/context.d.ts +20 -3
- package/views/dist/panels/react/toolbar/context.js +3 -1
- package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
- package/views/dist/panels/react/toolbar/panel-part.js +5 -3
- package/views/dist/panels/react/views-row/FoldingViewRow.d.ts +1 -1
- package/views/dist/panels/react/views-row/FoldingViewRow.js +15 -4
- package/views/dist/panels/react/views-row/PillGroup.d.ts +5 -2
- package/views/dist/panels/react/views-row/PillGroup.js +16 -7
- package/views/dist/panels/react/views-row/ViewPicker.js +2 -12
- package/views/dist/panels/react/views-row/ViewPickerRow.d.ts +4 -2
- package/views/dist/panels/react/views-row/ViewPickerRow.js +9 -5
- package/views/dist/panels/react.d.ts +2 -2
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/panels/toolbar/edit-view.d.ts +7 -1
- package/views/dist/panels/toolbar/edit-view.js +14 -0
- package/views/dist/panels/toolbar/model.d.ts +5 -0
- package/views/dist/panels/toolbar/model.js +7 -3
- package/views/dist/panels/view-state.d.ts +5 -3
- package/views/dist/panels/views-row/model.d.ts +19 -2
- package/views/dist/panels/views-row/model.js +14 -0
- package/views/dist/provider/ViewsProvider.d.ts +21 -8
- package/views/dist/provider/ViewsProvider.js +40 -5
- package/views/dist/provider/components.d.ts +102 -2
- package/views/dist/provider/components.js +1 -1
- package/views/dist/provider/context.d.ts +6 -2
- package/views/dist/provider/context.js +1 -1
- package/views/dist/provider/own-control.d.ts +4 -0
- package/views/dist/provider/own-control.js +7 -0
- package/views/dist/provider/ports.d.ts +19 -12
- package/views/dist/provider/ports.js +69 -1
- package/views/dist/provider/select-items.d.ts +3 -0
- package/views/dist/provider/select-items.js +6 -0
- package/views/dist/react.d.ts +4 -2
- package/views/dist/react.js +2 -0
- package/views/dist/styles.css +503 -136
- package/views/dist/styles.unlayered.css +503 -136
- package/views/docs/contract.md +292 -34
- package/views/docs/controls/avatar.md +11 -0
- package/views/docs/controls/choice.md +0 -1
- package/views/docs/controls/compound-editor.md +4 -0
- package/views/docs/controls/customize.md +6 -0
- package/views/docs/controls/date-editor.md +4 -0
- package/views/docs/controls/field.md +7 -0
- package/views/docs/controls/filter-editor.md +8 -0
- package/views/docs/controls/group-editor.md +6 -0
- package/views/docs/controls/input.md +5 -0
- package/views/docs/controls/links-editor.md +4 -0
- package/views/docs/controls/menu-list.md +8 -0
- package/views/docs/controls/menu.md +4 -0
- package/views/docs/controls/notice.md +4 -0
- package/views/docs/controls/number-editor.md +4 -0
- package/views/docs/controls/pane.md +4 -0
- package/views/docs/controls/picker.md +8 -0
- package/views/docs/controls/quick-filters.md +6 -0
- package/views/docs/controls/radio.md +20 -1
- package/views/docs/controls/select.md +10 -0
- package/views/docs/controls/setting-row.md +18 -0
- package/views/docs/controls/sheet.md +4 -0
- package/views/docs/controls/sort-editor.md +8 -0
- package/views/docs/controls/switch-row.md +0 -3
- package/views/docs/controls/tag-field.md +4 -0
- package/views/docs/controls/tag.md +1 -0
- package/views/docs/controls/text-editor.md +4 -0
- package/views/docs/controls/values-editor.md +4 -0
- package/views/docs/controls/views-list.md +6 -0
- package/views/docs/getting-started.md +2 -2
- package/views/docs/guides/atoms.md +2 -2
- package/views/docs/guides/columns.md +1 -1
- package/views/docs/guides/ports.md +1 -1
- package/views/docs/guides/the-grid.md +36 -9
- package/views/docs/guides/the-provider.md +22 -3
- package/views/docs/index.md +1 -0
- package/views/docs/reference/controls.md +41 -29
- package/views/docs/reference/editors-session.md +1 -1
- package/views/docs/reference/field-row.md +9 -1
- package/views/docs/reference/grid.md +15 -9
- package/views/docs/reference/list.md +357 -0
- package/views/docs/reference/looks.md +1 -1
- package/views/docs/reference/panels-react.md +17 -12
- package/views/docs/reference/panels.md +8 -5
- package/views/docs/reference/react.md +24 -16
- package/views/docs/reference/views.md +10 -6
- package/views/docs/reshaping.md +6 -1
- package/views/skills/views/SKILL.md +9 -6
|
@@ -4,8 +4,8 @@ let clipboard = null;
|
|
|
4
4
|
export function getGridClipboard() {
|
|
5
5
|
return clipboard;
|
|
6
6
|
}
|
|
7
|
-
export async function copyCell(write, col, baseline, unit, shown = baseline) {
|
|
8
|
-
const text = cellCopyText(col, shown);
|
|
7
|
+
export async function copyCell(write, col, baseline, unit, shown = baseline, language) {
|
|
8
|
+
const text = cellCopyText(col, shown, language);
|
|
9
9
|
clipboard = { text, value: baseline, type: col.type, unit };
|
|
10
10
|
try {
|
|
11
11
|
await write(text);
|
|
@@ -7,7 +7,9 @@ export function renderTypedCell(col, row, opts) {
|
|
|
7
7
|
const cell = renderTypedCellValue(col, row, opts);
|
|
8
8
|
if (col.type === "title")
|
|
9
9
|
return cell;
|
|
10
|
-
const indicator = col.indicator?.(row
|
|
10
|
+
const indicator = col.indicator?.(row, {
|
|
11
|
+
value: opts?.valueOverride !== undefined ? opts.valueOverride : col.accessor?.(row),
|
|
12
|
+
});
|
|
11
13
|
if (!indicator)
|
|
12
14
|
return cell;
|
|
13
15
|
return (_jsxs("span", { className: "flex h-(--vk-line-h) min-w-0 flex-1 flex-wrap content-start items-center gap-x-1.5 overflow-hidden leading-(--vk-line-h)", children: [_jsx("span", { className: "max-w-full flex-none truncate", children: cell }), indicator] }));
|
|
@@ -26,7 +26,7 @@ export function columnMenuGates(column, offer) {
|
|
|
26
26
|
const sortKey = effectiveSortKey(column, viewBacked);
|
|
27
27
|
const sortParts = sort ? columnSortParts(column, viewBacked) : [];
|
|
28
28
|
const sortable = !!(sortKey && sort) || sortParts.length > 0;
|
|
29
|
-
const groupable = !!groupBy &&
|
|
29
|
+
const groupable = !!groupBy && columnGroupable(column);
|
|
30
30
|
const grouped = groupable && groupBy.fieldKey === column.field.key;
|
|
31
31
|
const knobs = columnKnobs(column);
|
|
32
32
|
const canPercent = formatsWritable && knobs.has("percentDisplay") && !!offer.onPercentDisplayChange;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import type { useViews } from "../../provider/context.js";
|
|
2
2
|
import type { ViewsRowMenuItem } from "../../atoms/types.js";
|
|
3
|
+
import type { ViewsMenuItem } from "../../provider/components.js";
|
|
3
4
|
import type { ListCellAction, ListColumn } from "../../model/column-schema.js";
|
|
4
5
|
import type { GridRowRangeSpan } from "../core/useGridRange.js";
|
|
5
6
|
import type { GridCommitOverlay } from "../core/useGridEditing.js";
|
|
7
|
+
/** The row menu's rows as menu items, each by its key (one of the app's without one, by its label), a rule becoming the
|
|
8
|
+
* next row's divider. */
|
|
9
|
+
export declare function rowMenuItemsOf(rows: readonly ViewsRowMenuItem[]): ViewsMenuItem[];
|
|
10
|
+
/** Menu items back as the row menu's rows: a divider a rule before its row. The row menu draws a row's words, icon,
|
|
11
|
+
* keys, disabled and danger; a group, a tick, a link and a drawn row (`render`) draw their words alone. */
|
|
12
|
+
export declare function rowMenuRows(items: readonly ViewsMenuItem[]): ViewsRowMenuItem[];
|
|
6
13
|
/** What the menu's items read from the provider. */
|
|
7
14
|
export type GridRowMenuViews = Pick<ReturnType<typeof useViews>, "conventions" | "ports" | "messages" | "icons">;
|
|
8
15
|
/** The fields of a row's props its menu reads (`GridRowProps` carries them all). */
|
|
@@ -21,10 +28,22 @@ export type GridRowMenuRow<Row> = {
|
|
|
21
28
|
selected: boolean;
|
|
22
29
|
toggle: (id: string, next?: boolean) => void;
|
|
23
30
|
editingEnabled: boolean;
|
|
31
|
+
/** The grid's `rowWritable` answer for this row: false, and its cell rows write nothing. Default true. */
|
|
32
|
+
rowWritable?: boolean;
|
|
24
33
|
pendingByCol?: Record<string, unknown>;
|
|
25
34
|
selectValues?: Record<string, string[]>;
|
|
26
35
|
rowRange?: GridRowRangeSpan[];
|
|
27
36
|
contextMenu?: (row: Row) => ViewsRowMenuItem[];
|
|
37
|
+
/** The app's function from the menu's rows to the rows it shows (`menus.row`), at once or later. With it, Open page
|
|
38
|
+
* and Delete are among the rows it is handed (`row-open`, `row-delete`). */
|
|
39
|
+
rowMenuReshape?: (items: ViewsMenuItem[], ctx: {
|
|
40
|
+
row: Row;
|
|
41
|
+
}) => ViewsMenuItem[] | Promise<ViewsMenuItem[]>;
|
|
42
|
+
/** The row's own page: Open page, a row of the menu's under `menus.row`. */
|
|
43
|
+
rowHref?: (row: Row) => string | undefined;
|
|
44
|
+
/** Delete, a row of the menu's under `menus.row`, asking the confirm port first. */
|
|
45
|
+
onRowDelete?: (id: string) => Promise<void>;
|
|
46
|
+
deleteLabel?: string;
|
|
28
47
|
inActiveRange: (rowId: string, columnId: string) => boolean;
|
|
29
48
|
rangeCanClear: () => boolean;
|
|
30
49
|
onRangeCopy: () => void;
|
|
@@ -43,7 +62,12 @@ export type GridRowMenuRow<Row> = {
|
|
|
43
62
|
*/
|
|
44
63
|
export declare function gridRowMenuColumnAt<Row>(menuRow: GridRowMenuRow<Row>, target: Element | null): string | null;
|
|
45
64
|
/**
|
|
46
|
-
* One row's menu
|
|
47
|
-
* actions, then the host's own
|
|
65
|
+
* One row's menu before the app's `menus.row`: the cell's rows (copy, cut, paste, clear, or the range's), Select, the
|
|
66
|
+
* name's actions, then the host's own; where the app hands `menus.row`, Open page first and Delete last, as rows it can
|
|
67
|
+
* drop (the `RowMenu` then draws neither of its own). Built only for the row a menu opens on, never for every drawn row.
|
|
48
68
|
*/
|
|
49
|
-
export declare function gridRowMenuItems<Row>(menuRow: GridRowMenuRow<Row>, menuColumnId: string | null,
|
|
69
|
+
export declare function gridRowMenuItems<Row>(menuRow: GridRowMenuRow<Row>, menuColumnId: string | null, views: GridRowMenuViews): ViewsRowMenuItem[];
|
|
70
|
+
/** The row the menu holds while the app's `menus.row` answers: greyed, the app's `loading` glyph (ViewKit's Spinner). */
|
|
71
|
+
export declare function rowMenuWaiting({ messages, icons }: Pick<GridRowMenuViews, "messages" | "icons">): ViewsRowMenuItem[];
|
|
72
|
+
/** The menu's rows as the app's `menus.row` reshapes them: at once, or a promise of them when it answers later. */
|
|
73
|
+
export declare function reshapeRowMenu<Row>(reshape: NonNullable<GridRowMenuRow<Row>["rowMenuReshape"]>, rows: readonly ViewsRowMenuItem[], row: Row): ViewsRowMenuItem[] | Promise<ViewsRowMenuItem[]>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { deleteAsking } from "../../atoms/RowMenu.js";
|
|
3
4
|
import { columnClearRefusal, columnEditRefusal, columnWritable, gridBooleanMode, } from "../../model/column-capabilities.js";
|
|
4
5
|
import { cellClearPrev, cellCopyShown, cellEditBaseline, cellPrevPayload, coercePaste, copyCell, gridFigureOverlay, getGridClipboard, rowHoldsCurrency, } from "./cell-clipboard.js";
|
|
5
6
|
function nameActionItems(row, actions, hostItems) {
|
|
@@ -17,10 +18,39 @@ function nameActionItems(row, actions, hostItems) {
|
|
|
17
18
|
if (!icon)
|
|
18
19
|
continue;
|
|
19
20
|
const run = action.onClick;
|
|
20
|
-
items.push({ label, icon, onClick: () => run(row) });
|
|
21
|
+
items.push({ key: `action:${action.id}`, label, icon, onClick: () => run(row) });
|
|
21
22
|
}
|
|
22
23
|
return items.length > 0 ? [...items, { separator: true }] : [];
|
|
23
24
|
}
|
|
25
|
+
export function rowMenuItemsOf(rows) {
|
|
26
|
+
const items = [];
|
|
27
|
+
let rule = false;
|
|
28
|
+
for (const row of rows) {
|
|
29
|
+
if (row.separator) {
|
|
30
|
+
rule = items.length > 0;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const { key, onClick, separator: _, ...rest } = row;
|
|
34
|
+
items.push({ ...rest, key: key ?? row.label, onSelect: onClick, ...(rule && { separatorBefore: true }) });
|
|
35
|
+
rule = false;
|
|
36
|
+
}
|
|
37
|
+
return items;
|
|
38
|
+
}
|
|
39
|
+
export function rowMenuRows(items) {
|
|
40
|
+
return items.flatMap((item, at) => {
|
|
41
|
+
const row = {
|
|
42
|
+
key: item.key,
|
|
43
|
+
label: item.label,
|
|
44
|
+
onClick: item.onSelect ?? (() => { }),
|
|
45
|
+
...(item.icon !== undefined && { icon: item.icon }),
|
|
46
|
+
...(item.destructive && { destructive: true }),
|
|
47
|
+
...(item.disabled && { disabled: true }),
|
|
48
|
+
...(item.disabledReason !== undefined && { disabledReason: item.disabledReason }),
|
|
49
|
+
...(item.shortcut !== undefined && { shortcut: item.shortcut }),
|
|
50
|
+
};
|
|
51
|
+
return item.separatorBefore && at > 0 ? [{ separator: true }, row] : [row];
|
|
52
|
+
});
|
|
53
|
+
}
|
|
24
54
|
export function gridRowMenuColumnAt(menuRow, target) {
|
|
25
55
|
const { columns, selecting, rowRange, rowKey, onFocusCell } = menuRow;
|
|
26
56
|
const columnId = target?.closest("[data-col-id]")?.getAttribute("data-col-id");
|
|
@@ -33,8 +63,9 @@ export function gridRowMenuColumnAt(menuRow, target) {
|
|
|
33
63
|
}
|
|
34
64
|
return column?.id ?? null;
|
|
35
65
|
}
|
|
36
|
-
export function gridRowMenuItems(menuRow, menuColumnId,
|
|
37
|
-
const {
|
|
66
|
+
export function gridRowMenuItems(menuRow, menuColumnId, views) {
|
|
67
|
+
const { conventions, ports, messages, icons } = views;
|
|
68
|
+
const { row, id, rowKey, columns, rowActions, selecting, selectable, selected, toggle, editingEnabled, rowWritable = true, pendingByCol, selectValues, contextMenu, rowMenuReshape, inActiveRange, rangeCanClear, onRangeCopy, onRangeCut, onRangePaste, onRangeClear, onPasteAtCell, onCommitCell, } = menuRow;
|
|
38
69
|
const copyLabel = messages({ key: "views.menus.copy" });
|
|
39
70
|
const cutLabel = messages({ key: "views.menus.cut" });
|
|
40
71
|
const pasteLabel = messages({ key: "views.menus.paste" });
|
|
@@ -43,14 +74,15 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
43
74
|
? columns.find((column) => column.id === menuColumnId)
|
|
44
75
|
: undefined;
|
|
45
76
|
const editBaseline = (column) => cellEditBaseline(column, row, pendingByCol);
|
|
46
|
-
const copy = (column, unit) => void copyCell(ports.clipboard.writeText, column, editBaseline(column), unit, cellCopyShown(column, row, pendingByCol));
|
|
47
|
-
const canEdit = (column) => editingEnabled && columnWritable(column);
|
|
77
|
+
const copy = (column, unit) => void copyCell(ports.clipboard.writeText, column, editBaseline(column), unit, cellCopyShown(column, row, pendingByCol), conventions.language);
|
|
78
|
+
const canEdit = (column) => editingEnabled && rowWritable && columnWritable(column);
|
|
48
79
|
const off = (reason) => reason === null ? { disabled: false } : { disabled: true, disabledReason: reason };
|
|
49
80
|
const nothingToPaste = messages({ key: "views.grid.paste-empty" });
|
|
50
81
|
const cellItems = [];
|
|
51
82
|
if (menuColumn && !selecting && inActiveRange(rowKey, menuColumn.id)) {
|
|
52
83
|
const clipboard = getGridClipboard();
|
|
53
84
|
cellItems.push({
|
|
85
|
+
key: "copy",
|
|
54
86
|
label: copyLabel,
|
|
55
87
|
icon: _jsx(icons.copy, { className: "h-4 w-4" }),
|
|
56
88
|
shortcut: "⌘C",
|
|
@@ -59,18 +91,21 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
59
91
|
if (editingEnabled) {
|
|
60
92
|
const clearOff = off(rangeCanClear() ? null : messages({ key: "views.menus.range-not-clearable" }));
|
|
61
93
|
cellItems.push({
|
|
94
|
+
key: "cut",
|
|
62
95
|
label: cutLabel,
|
|
63
96
|
icon: _jsx(icons.cut, { className: "h-4 w-4" }),
|
|
64
97
|
shortcut: "⌘X",
|
|
65
98
|
...clearOff,
|
|
66
99
|
onClick: onRangeCut,
|
|
67
100
|
}, {
|
|
101
|
+
key: "paste",
|
|
68
102
|
label: pasteLabel,
|
|
69
103
|
icon: _jsx(icons.paste, { className: "h-4 w-4" }),
|
|
70
104
|
shortcut: "⌘V",
|
|
71
105
|
...off(clipboard ? null : nothingToPaste),
|
|
72
106
|
onClick: onRangePaste,
|
|
73
107
|
}, {
|
|
108
|
+
key: "clear",
|
|
74
109
|
label: clearLabel,
|
|
75
110
|
icon: _jsx(icons.clear, { className: "h-4 w-4" }),
|
|
76
111
|
...clearOff,
|
|
@@ -85,7 +120,8 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
85
120
|
const canClear = canWrite && (!!menuColumn.clearable || gridBooleanMode(menuColumn) != null);
|
|
86
121
|
const editRefusal = canWrite
|
|
87
122
|
? null
|
|
88
|
-
: (columnEditRefusal(menuColumn, conventions, messages) ??
|
|
123
|
+
: ((columnWritable(menuColumn) ? undefined : columnEditRefusal(menuColumn, conventions, messages)) ??
|
|
124
|
+
messages({ key: "views.grid.cell-read-only" }));
|
|
89
125
|
const clearOff = off(editRefusal ?? (canClear ? null : columnClearRefusal(menuColumn, messages)));
|
|
90
126
|
const clipboard = getGridClipboard();
|
|
91
127
|
const paste = canWrite && clipboard && !clipboard.matrix
|
|
@@ -99,6 +135,7 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
99
135
|
})
|
|
100
136
|
: null;
|
|
101
137
|
cellItems.push({
|
|
138
|
+
key: "copy",
|
|
102
139
|
label: copyLabel,
|
|
103
140
|
icon: _jsx(icons.copy, { className: "h-4 w-4" }),
|
|
104
141
|
shortcut: "⌘C",
|
|
@@ -106,6 +143,7 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
106
143
|
});
|
|
107
144
|
if (editingEnabled) {
|
|
108
145
|
cellItems.push({
|
|
146
|
+
key: "cut",
|
|
109
147
|
label: cutLabel,
|
|
110
148
|
icon: _jsx(icons.cut, { className: "h-4 w-4" }),
|
|
111
149
|
shortcut: "⌘X",
|
|
@@ -115,6 +153,7 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
115
153
|
onCommitCell(row, id, menuColumn.id, cellClearPrev(menuColumn, row, pendingByCol), "");
|
|
116
154
|
},
|
|
117
155
|
}, {
|
|
156
|
+
key: "paste",
|
|
118
157
|
label: pasteLabel,
|
|
119
158
|
icon: _jsx(icons.paste, { className: "h-4 w-4" }),
|
|
120
159
|
shortcut: "⌘V",
|
|
@@ -130,6 +169,7 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
130
169
|
}
|
|
131
170
|
},
|
|
132
171
|
}, {
|
|
172
|
+
key: "clear",
|
|
133
173
|
label: clearLabel,
|
|
134
174
|
icon: _jsx(icons.clear, { className: "h-4 w-4" }),
|
|
135
175
|
...clearOff,
|
|
@@ -141,6 +181,7 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
141
181
|
const selectItems = selectable
|
|
142
182
|
? [
|
|
143
183
|
{
|
|
184
|
+
key: "row-select",
|
|
144
185
|
label: messages({ key: "views.menus.row-select", values: { selected: selected ? "true" : "false" } }),
|
|
145
186
|
icon: _jsx(icons.selectRow, { className: "h-4 w-4" }),
|
|
146
187
|
onClick: () => toggle(id),
|
|
@@ -155,5 +196,50 @@ export function gridRowMenuItems(menuRow, menuColumnId, { conventions, ports, me
|
|
|
155
196
|
...nameActionItems(row, rowActions, hostItems),
|
|
156
197
|
...hostItems,
|
|
157
198
|
];
|
|
158
|
-
|
|
199
|
+
if (!rowMenuReshape)
|
|
200
|
+
return contextItems;
|
|
201
|
+
const href = menuRow.rowHref?.(row);
|
|
202
|
+
const onDelete = menuRow.onRowDelete;
|
|
203
|
+
const deleteLabel = menuRow.deleteLabel;
|
|
204
|
+
return [
|
|
205
|
+
...(href
|
|
206
|
+
? [
|
|
207
|
+
{
|
|
208
|
+
key: "row-open",
|
|
209
|
+
label: messages({ key: "views.menus.row-open" }),
|
|
210
|
+
icon: _jsx(icons.open, { className: "h-4 w-4" }),
|
|
211
|
+
onClick: () => void window.open(href, "_blank", "noopener,noreferrer"),
|
|
212
|
+
},
|
|
213
|
+
{ separator: true },
|
|
214
|
+
]
|
|
215
|
+
: []),
|
|
216
|
+
...contextItems,
|
|
217
|
+
...(onDelete
|
|
218
|
+
? [
|
|
219
|
+
{ separator: true },
|
|
220
|
+
{
|
|
221
|
+
key: "row-delete",
|
|
222
|
+
label: messages({ key: "views.menus.row-delete" }),
|
|
223
|
+
icon: _jsx(icons.delete, { className: "h-4 w-4" }),
|
|
224
|
+
destructive: true,
|
|
225
|
+
onClick: () => deleteAsking(views, onDelete, id, deleteLabel),
|
|
226
|
+
},
|
|
227
|
+
]
|
|
228
|
+
: []),
|
|
229
|
+
];
|
|
230
|
+
}
|
|
231
|
+
export function rowMenuWaiting({ messages, icons }) {
|
|
232
|
+
return [
|
|
233
|
+
{
|
|
234
|
+
key: "row-waiting",
|
|
235
|
+
label: messages({ key: "views.menus.row-waiting" }),
|
|
236
|
+
icon: _jsx(icons.loading, { className: "h-4 w-4" }),
|
|
237
|
+
disabled: true,
|
|
238
|
+
onClick: () => { },
|
|
239
|
+
},
|
|
240
|
+
];
|
|
241
|
+
}
|
|
242
|
+
export function reshapeRowMenu(reshape, rows, row) {
|
|
243
|
+
const shaped = reshape(rowMenuItemsOf(rows), { row });
|
|
244
|
+
return Array.isArray(shaped) ? rowMenuRows(shaped) : Promise.resolve(shaped).then(rowMenuRows);
|
|
159
245
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GridMenus } from "./grid-table-props.js";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
3
|
import type { ViewsRowMenuItem } from "../../atoms/types.js";
|
|
3
4
|
import type { FieldMenus } from "../../fields/menus.js";
|
|
@@ -35,6 +36,8 @@ export type GridRowProps<Row> = {
|
|
|
35
36
|
toggle: (id: string, next?: boolean) => void;
|
|
36
37
|
toggleRange: (id: string) => void;
|
|
37
38
|
contextMenu?: (row: Row) => ViewsRowMenuItem[];
|
|
39
|
+
/** The app's function for the row's menu (`GridMenus.row`). */
|
|
40
|
+
rowMenuReshape?: GridMenus<Row>["row"];
|
|
38
41
|
rowClassName?: (row: Row) => string | undefined;
|
|
39
42
|
rowHref?: (row: Row) => string | undefined;
|
|
40
43
|
/** Opens the row from the cell at `at` (its key and column), which the grid's opener turns into the app's `from`. */
|
|
@@ -99,13 +102,15 @@ export type GridRowProps<Row> = {
|
|
|
99
102
|
/** Workspace-settings capability locks (table read-only / per-column) — subtracts from
|
|
100
103
|
* what the columns declare. Memo-stable: threaded straight from the host. */
|
|
101
104
|
listConfig?: ListSettingsConfig;
|
|
105
|
+
/** The grid's `rowWritable` answer for THIS row: false, and none of its cells writes. Default true. */
|
|
106
|
+
rowWritable?: boolean;
|
|
102
107
|
onFocusCell: (rowId: string, columnId: string) => void;
|
|
103
108
|
/** Open a cell's editor. `seed`: the character that opened it (type-to-replace). `whole`: the
|
|
104
109
|
* text was cut off in its cell, so it opens whole in the panel over the cell. */
|
|
105
110
|
onStartEdit: (rowId: string, columnId: string, seed?: string | null, whole?: boolean) => void;
|
|
106
111
|
/** A second click or a double-click on a cell that opens nothing: the grid
|
|
107
|
-
* says why it can't be edited (or nothing, when it can be written). */
|
|
108
|
-
onRefuseEdit?: (columnId: string) => void;
|
|
112
|
+
* says why it can't be edited (or nothing, when it can be written); `rowOk` false: the row is refused. */
|
|
113
|
+
onRefuseEdit?: (columnId: string, rowOk?: boolean) => void;
|
|
109
114
|
/** Tab out of an editor → next/prev cell in reading order (grid-owned so it
|
|
110
115
|
* matches Tab-while-focused; wraps rows). */
|
|
111
116
|
onEditorTab: (rowId: string, columnId: string, backwards: boolean) => void;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cloneElement, createContext, useEffect, useLayoutEffect, useRef, useState, } from "react";
|
|
4
4
|
import { useViews } from "../../provider/context.js";
|
|
5
|
-
import { gridRowMenuColumnAt, gridRowMenuItems } from "./grid-row-menu-items.js";
|
|
5
|
+
import { gridRowMenuColumnAt, gridRowMenuItems, reshapeRowMenu, rowMenuWaiting } from "./grid-row-menu-items.js";
|
|
6
6
|
const ROW = '[data-slot="vk-grid-row"]';
|
|
7
7
|
function rowKeyAt(container, target) {
|
|
8
8
|
const row = target instanceof Element ? target.closest(ROW) : null;
|
|
@@ -16,6 +16,9 @@ export function GridRowsMenu({ rowPropsFor, selectable, answerHeldPress, childre
|
|
|
16
16
|
const RowMenu = views.atoms.RowMenu;
|
|
17
17
|
const [aim, setAim] = useState(null);
|
|
18
18
|
const [menuColumnId, setMenuColumnId] = useState(null);
|
|
19
|
+
const [opening, setOpening] = useState(null);
|
|
20
|
+
const openings = useRef(0);
|
|
21
|
+
const [answer, setAnswer] = useState(null);
|
|
19
22
|
const aimRef = useRef(null);
|
|
20
23
|
const touchTimer = useRef(null);
|
|
21
24
|
const settle = () => {
|
|
@@ -29,20 +32,45 @@ export function GridRowsMenu({ rowPropsFor, selectable, answerHeldPress, childre
|
|
|
29
32
|
aimRef.current = key;
|
|
30
33
|
setAim(key);
|
|
31
34
|
setMenuColumnId(columnId);
|
|
35
|
+
setOpening(null);
|
|
32
36
|
};
|
|
33
|
-
const latest = useRef({ rowPropsFor, aimAt, aim });
|
|
37
|
+
const latest = useRef({ rowPropsFor, aimAt, aim, views });
|
|
34
38
|
useLayoutEffect(() => {
|
|
35
|
-
latest.current = { rowPropsFor, aimAt, aim };
|
|
39
|
+
latest.current = { rowPropsFor, aimAt, aim, views };
|
|
36
40
|
});
|
|
37
41
|
const [aimByRow] = useState(() => (rowKey, event) => {
|
|
38
42
|
const aimed = latest.current.rowPropsFor(rowKey);
|
|
39
43
|
if (!aimed)
|
|
40
44
|
return;
|
|
41
45
|
AIMED.add(event.nativeEvent);
|
|
42
|
-
|
|
46
|
+
const columnId = gridRowMenuColumnAt(aimed, event.target instanceof Element ? event.target : null);
|
|
47
|
+
latest.current.aimAt(rowKey, columnId);
|
|
48
|
+
openings.current += 1;
|
|
49
|
+
const opened = openings.current;
|
|
50
|
+
setOpening(opened);
|
|
51
|
+
const shape = aimed.rowMenuReshape;
|
|
52
|
+
if (!shape)
|
|
53
|
+
return;
|
|
54
|
+
const rows = gridRowMenuItems(aimed, columnId, latest.current.views);
|
|
55
|
+
const shaped = reshapeRowMenu(shape, rows, aimed.row);
|
|
56
|
+
if (Array.isArray(shaped)) {
|
|
57
|
+
setAnswer({ opening: opened, rows: "now" });
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
setAnswer({ opening: opened, rows: null });
|
|
61
|
+
const land = (answered) => setAnswer((current) => (current?.opening === opened ? { opening: opened, rows: answered } : current));
|
|
62
|
+
shaped.then(land, () => land(rows));
|
|
43
63
|
});
|
|
44
64
|
const props = aim != null ? rowPropsFor(aim) : null;
|
|
45
|
-
const
|
|
65
|
+
const reshape = props?.rowMenuReshape;
|
|
66
|
+
const own = props ? gridRowMenuItems(props, menuColumnId, views) : [];
|
|
67
|
+
const opened = props && reshape ? opening : null;
|
|
68
|
+
let items = own;
|
|
69
|
+
if (props && reshape) {
|
|
70
|
+
const rows = answer && answer.opening === opened ? answer.rows : null;
|
|
71
|
+
const now = rows === "now" ? reshapeRowMenu(reshape, own, props.row) : rows;
|
|
72
|
+
items = Array.isArray(now) ? now : rowMenuWaiting(views);
|
|
73
|
+
}
|
|
46
74
|
const [target] = useState(() => ({
|
|
47
75
|
onPointerDownCapture: (event) => {
|
|
48
76
|
const key = rowKeyAt(event.currentTarget, event.target);
|
|
@@ -73,7 +101,7 @@ export function GridRowsMenu({ rowPropsFor, selectable, answerHeldPress, childre
|
|
|
73
101
|
},
|
|
74
102
|
}));
|
|
75
103
|
const rows = cloneElement(children, target);
|
|
76
|
-
return (_jsx(GridRowMenuAimContext.Provider, { value: aimByRow, children: _jsx(RowMenu, { rowId: props?.id ?? "", items: items, openHref: props ? props.rowHref?.(props.row) : undefined, onDelete: props?.onRowDelete, deleteLabel: props?.deleteLabel, onToggleSelect: selectable
|
|
104
|
+
return (_jsx(GridRowMenuAimContext.Provider, { value: aimByRow, children: _jsx(RowMenu, { rowId: props?.id ?? "", items: items, openHref: props && !reshape ? props.rowHref?.(props.row) : undefined, onDelete: reshape ? undefined : props?.onRowDelete, deleteLabel: props?.deleteLabel, onToggleSelect: selectable
|
|
77
105
|
? () => {
|
|
78
106
|
if (answerHeldPress?.())
|
|
79
107
|
return;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import type { FieldDef } from "viewkitjs/fields";
|
|
2
3
|
import type { DisplayCurrency } from "../../fields/currency.js";
|
|
3
4
|
import type { ViewsRowMenuItem } from "../../atoms/types.js";
|
|
4
5
|
import type { ViewsMenuItem } from "../../provider/components.js";
|
|
@@ -17,6 +18,28 @@ import type { GridCellCommitFn, GridCellsCommitFn } from "../core/commit-model.j
|
|
|
17
18
|
import type { GridGroupByState, GridSortState } from "./GridColumnMenu.js";
|
|
18
19
|
import type { GridGroupSortOption } from "./GridGroupMenu.js";
|
|
19
20
|
import type { GridGroupMenuPart } from "./grid-group-menu-parts.js";
|
|
21
|
+
/** Each of the grid's menus as a function from its default items to the items it shows (`menu.drop`, `menu.rename`,
|
|
22
|
+
* `menu.add` and `menu.move` on `viewkitjs/views/list` do the usual changes). `column` gets the column and its field,
|
|
23
|
+
* `row` the row, `group` the group its band names. Each reshapes a menu the grid opens: a column or band whose menu holds
|
|
24
|
+
* none of the grid's rows stays without one. Called while a menu draws: keep them pure and cheap.
|
|
25
|
+
*
|
|
26
|
+
* `row` is asked as a row's menu opens (a right-click, the row's ⋯, the menu key), never for a row drawn or pressed, and
|
|
27
|
+
* may answer later: a promise is asked once per opening, the menu holding one greyed row that waits (`row-waiting`) until
|
|
28
|
+
* it answers, an answer that an opening since has outrun dropped, and one that fails drawing the grid's own rows. Its
|
|
29
|
+
* items hold Open page and Delete (`row-open`, `row-delete`, from `rowHref` and `onRowDelete`): drop `row-delete` for a
|
|
30
|
+
* row that can't be deleted. */
|
|
31
|
+
export type GridMenus<Row> = {
|
|
32
|
+
column?: (items: ViewsMenuItem[], ctx: {
|
|
33
|
+
field: FieldDef | undefined;
|
|
34
|
+
column: ListColumn<Row>;
|
|
35
|
+
}) => ViewsMenuItem[];
|
|
36
|
+
row?: (items: ViewsMenuItem[], ctx: {
|
|
37
|
+
row: Row;
|
|
38
|
+
}) => ViewsMenuItem[] | Promise<ViewsMenuItem[]>;
|
|
39
|
+
group?: (items: ViewsMenuItem[], ctx: {
|
|
40
|
+
group: ListGroup<Row>;
|
|
41
|
+
}) => ViewsMenuItem[];
|
|
42
|
+
};
|
|
20
43
|
/** A group count's noun, singular and plural ("company", "companies"): "2 companies". None: a bare
|
|
21
44
|
* count. */
|
|
22
45
|
export type GroupCountNoun = {
|
|
@@ -167,15 +190,16 @@ export type GridTableProps<Row> = {
|
|
|
167
190
|
sort?: GridSortState;
|
|
168
191
|
/** A sorted column's header wears `icons.sortAsc` or `icons.sortDesc` after its name. Default false. */
|
|
169
192
|
sortMark?: boolean;
|
|
170
|
-
/** The
|
|
171
|
-
*
|
|
193
|
+
/** The list's group, for a column menu's Group by and Ungroup, wherever you keep it (a saved view, the page's
|
|
194
|
+
* address): handed, every column whose field can split the list offers them, as `sort` offers Sort. */
|
|
172
195
|
groupBy?: GridGroupByState;
|
|
173
196
|
sortOptions?: GridGroupSortOption[];
|
|
174
197
|
/** Which figures ride beside a group name — a set, not a choice. */
|
|
175
198
|
groupSummary?: ListGroupSummaryPart[];
|
|
176
199
|
aggregates?: Record<string, ListAggregateKind>;
|
|
177
200
|
onAggregateChange?: (columnId: string, kind: ListAggregateKind) => void;
|
|
178
|
-
/**
|
|
201
|
+
/** The grid shows a saved view: Sort on every bound column, columns placed by the view, and figures only for
|
|
202
|
+
* field-backed columns. It doesn't decide Group by, which follows `groupBy` alone. */
|
|
179
203
|
viewBacked?: boolean;
|
|
180
204
|
onGroupSummaryChange?: (part: ListGroupSummaryPart, next: boolean) => void;
|
|
181
205
|
/** The figures a group header can show, in the list's order: each declared by its column and kind, or drawn
|
|
@@ -228,10 +252,11 @@ export type GridTableProps<Row> = {
|
|
|
228
252
|
* a sort's `fieldKey` and `by`), copies, edits and pastes as its part; an edit commits the whole column's id and
|
|
229
253
|
* the whole value with that part replaced, locked, refused and limited as its whole. Off by default. */
|
|
230
254
|
parts?: boolean;
|
|
231
|
-
/**
|
|
232
|
-
*
|
|
233
|
-
|
|
234
|
-
/** The host's rows for a column's field, as data, drawn just above Hide
|
|
255
|
+
/** Each menu's items reshaped by your function: a column's, a row's and a group band's (`GridMenus`). Without it, each
|
|
256
|
+
* menu holds the grid's rows and what `columnMenuItems`, `rowMenu`, `contextMenu` and `groupMenu` add. */
|
|
257
|
+
menus?: GridMenus<Row>;
|
|
258
|
+
/** The host's rows for a column's field, as data, drawn just above Hide (the old route: `menus.column` reshapes the
|
|
259
|
+
* whole menu); null or an empty
|
|
235
260
|
* list for a field the host adds nothing to. Their keys must not reuse the package's own (`sort-asc`,
|
|
236
261
|
* `hide-column` and the rest). It is called while the grid renders, for every column: keep it pure and cheap. */
|
|
237
262
|
columnMenuItems?: (fieldKey: string) => ViewsMenuItem[] | null;
|
|
@@ -263,6 +288,12 @@ export type GridTableProps<Row> = {
|
|
|
263
288
|
* `declaration → config → prefs` — it may only SUBTRACT from what the
|
|
264
289
|
* columns declare. UI constraint only; the host's API guards its own writes. */
|
|
265
290
|
listConfig?: ListSettingsConfig;
|
|
291
|
+
/** Whether a row's cells write, per row: a row it answers false for opens no editor, takes no typing, paste, fill,
|
|
292
|
+
* clear, cut or bulk-bar write, says "Cell is read-only" when a person tries, and marks its cells `aria-readonly`,
|
|
293
|
+
* as a read-only column's are. It only takes away: a column that doesn't write stays read-only on every row. Absent:
|
|
294
|
+
* every row writes as its columns say. Called while the grid renders, for every row: keep it pure and cheap. A
|
|
295
|
+
* constraint on the screen, while your API guards its own writes. */
|
|
296
|
+
rowWritable?: (row: Row) => boolean;
|
|
266
297
|
/** A row drawn as under the pointer, by its id: its tint, its rail's box, its ⋯ and the name's actions, as a real
|
|
267
298
|
* hover draws them, and `data-hovered` on the row. A real pointer still hovers any row beside it. Every copy of a
|
|
268
299
|
* record a grouping draws twice. Drawn, as a hover is, only on a screen whose pointer hovers (`any-hover`). Absent
|
|
@@ -16,12 +16,14 @@ import type { ListColumn } from "../../model/column-schema.js";
|
|
|
16
16
|
* oversized-debt ceiling whose policy says split the responsibility rather than
|
|
17
17
|
* raise the number.
|
|
18
18
|
*/
|
|
19
|
-
export declare function useGridBatchApi<Row>({ enabled, columns, listConfig, rows, getRowId, pendingByRow, commitBatch, }: {
|
|
19
|
+
export declare function useGridBatchApi<Row>({ enabled, columns, listConfig, rowWritable, rows, getRowId, pendingByRow, commitBatch, }: {
|
|
20
20
|
/** The grid can write at all (the host passed a commit handler). */
|
|
21
21
|
enabled: boolean;
|
|
22
22
|
/** Visible columns — the id resolves against what the user can actually see. */
|
|
23
23
|
columns: ListColumn<Row>[];
|
|
24
24
|
listConfig: ListSettingsConfig | undefined;
|
|
25
|
+
/** The grid's `rowWritable`: a row it refuses is passed over. */
|
|
26
|
+
rowWritable?: (row: Row) => boolean;
|
|
25
27
|
/** Every loaded row, for resolving selected ids to row objects. */
|
|
26
28
|
rows: Row[];
|
|
27
29
|
getRowId: (row: Row) => string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { cellEditBaseline, cellPrevPayload, gridFigureOverlay, gridPasteOverlay } from "./cell-clipboard.js";
|
|
4
4
|
import { columnEffectiveWritable } from "../../model/column-capabilities.js";
|
|
5
|
-
export function useGridBatchApi({ enabled, columns, listConfig, rows, getRowId, pendingByRow, commitBatch, }) {
|
|
5
|
+
export function useGridBatchApi({ enabled, columns, listConfig, rowWritable, rows, getRowId, pendingByRow, commitBatch, }) {
|
|
6
6
|
return useMemo(() => {
|
|
7
7
|
if (!enabled)
|
|
8
8
|
return undefined;
|
|
@@ -18,6 +18,8 @@ export function useGridBatchApi({ enabled, columns, listConfig, rows, getRowId,
|
|
|
18
18
|
const row = byId.get(rowId);
|
|
19
19
|
if (row == null)
|
|
20
20
|
continue;
|
|
21
|
+
if (rowWritable && !rowWritable(row))
|
|
22
|
+
continue;
|
|
21
23
|
const prev = cellPrevPayload(col, cellEditBaseline(col, row, pendingByRow.get(rowId)), col.editUnit?.value(row));
|
|
22
24
|
edits.push({
|
|
23
25
|
row,
|
|
@@ -32,5 +34,5 @@ export function useGridBatchApi({ enabled, columns, listConfig, rows, getRowId,
|
|
|
32
34
|
return commitBatch(edits);
|
|
33
35
|
},
|
|
34
36
|
};
|
|
35
|
-
}, [enabled, columns, listConfig, rows, getRowId, pendingByRow, commitBatch]);
|
|
37
|
+
}, [enabled, columns, listConfig, rowWritable, rows, getRowId, pendingByRow, commitBatch]);
|
|
36
38
|
}
|
|
@@ -3,9 +3,10 @@ import { type GridCellPos } from "../core/coordinates.js";
|
|
|
3
3
|
import type { GridCellRange } from "../core/useGridRange.js";
|
|
4
4
|
import type { ListSettingsConfig } from "../../model/column-capabilities.js";
|
|
5
5
|
import type { ListColumn } from "../../model/column-schema.js";
|
|
6
|
+
import { type GridEditsState } from "../core/edits-sink.js";
|
|
6
7
|
import type { GridRangeVerbs } from "./useGridRangeActions.js";
|
|
7
8
|
import { type GridChromeTarget, type GridFocusShape } from "../core/grid-focus.js";
|
|
8
|
-
export declare function useGridKeyboard<Row>({ rootRef, focusedCell, editingCell, editingEnabled, listConfig, visibleRowIds, rowByKey, visibleColIds, visibleColumns, rows, getRowId, pendingByRow, rangeVerbsRef, focusCell, clearFocus, startEdit, cancelEdit, commitEdit, refuseEdit, undo, redo, isLastEdited, rangeSetRect, rangeExtendTo, ranges, revealCell, releaseToFrame, lastCellRef, chrome, setChrome, shape, toggleGroup, }: {
|
|
9
|
+
export declare function useGridKeyboard<Row>({ rootRef, focusedCell, editingCell, editingEnabled, listConfig, rowWritable, visibleRowIds, rowByKey, visibleColIds, visibleColumns, rows, getRowId, pendingByRow, rangeVerbsRef, focusCell, clearFocus, startEdit, cancelEdit, commitEdit, refuseEdit, undo, redo, isLastEdited, editsState, rangeSetRect, rangeExtendTo, ranges, revealCell, releaseToFrame, lastCellRef, chrome, setChrome, shape, toggleGroup, }: {
|
|
9
10
|
rootRef: RefObject<HTMLDivElement | null>;
|
|
10
11
|
/** A column name, a footer cell, a bar or a checkbox holding the focus (`useGridFocus`); null: a data cell, or
|
|
11
12
|
* nothing. */
|
|
@@ -29,6 +30,8 @@ export declare function useGridKeyboard<Row>({ rootRef, focusedCell, editingCell
|
|
|
29
30
|
/** Workspace-settings capability config — the keyboard routes ask the same effective
|
|
30
31
|
* write gate the cells do, so a lock holds here too. */
|
|
31
32
|
listConfig?: ListSettingsConfig;
|
|
33
|
+
/** The grid's per-row answer: a row it refuses takes no edit from a key, as a locked column doesn't. */
|
|
34
|
+
rowWritable?: (row: Row) => boolean;
|
|
32
35
|
visibleRowIds: string[];
|
|
33
36
|
/** Row key → the rendered row and its DATA id. Focus is a KEY; a commit needs
|
|
34
37
|
* the record and the id behind it. */
|
|
@@ -55,12 +58,14 @@ export declare function useGridKeyboard<Row>({ rootRef, focusedCell, editingCell
|
|
|
55
58
|
cancelEdit: () => void;
|
|
56
59
|
commitEdit: (row: Row, rowId: string, columnId: string, previous: unknown, next: unknown) => void;
|
|
57
60
|
/** Say why a cell can't be written; answers whether it said anything. */
|
|
58
|
-
refuseEdit: (columnId: string) => boolean;
|
|
61
|
+
refuseEdit: (columnId: string, rowOk?: boolean) => boolean;
|
|
59
62
|
undo: (resolveRow: (rowId: string) => Row | undefined, onApply?: (pos: GridCellPos) => void) => boolean;
|
|
60
63
|
redo: (resolveRow: (rowId: string) => Row | undefined, onApply?: (pos: GridCellPos) => void) => boolean;
|
|
61
64
|
/** This grid is the one the page edited last (`useGridEditing`'s `isLastEdited`): with the focus in no grid's frame,
|
|
62
65
|
* only it answers ⌘Z. Absent: it always is. */
|
|
63
66
|
isLastEdited?: () => boolean;
|
|
67
|
+
/** The edits' state a sink above the grid reads (`GridEditsSinkContext`). Absent: nothing to tell. */
|
|
68
|
+
editsState?: () => GridEditsState;
|
|
64
69
|
}): {
|
|
65
70
|
onEditorTab: (rowId: string, columnId: string, backwards: boolean) => void;
|
|
66
71
|
onEditorEnter: (rowId: string, columnId: string) => void;
|