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
|
@@ -10,6 +10,7 @@ import { activeRangeHead, gridNavIntent, nextCellLinear, nextCellPos, resolveNav
|
|
|
10
10
|
import { moveCaretToLineEdge } from "./grid-caret-keys.js";
|
|
11
11
|
import { copyCell } from "./cell-clipboard.js";
|
|
12
12
|
import { GridWaitContext } from "./grid-wait.js";
|
|
13
|
+
import { GridEditsSinkContext } from "../core/edits-sink.js";
|
|
13
14
|
import { GRID_KEY_OWNING_SURFACES, gridFocusElement } from "./useGridFocus.js";
|
|
14
15
|
import { isGridRowMenuKey, openGridRowMenu } from "./grid-row-menu-key.js";
|
|
15
16
|
import { openGridEditEscape } from "./grid-edit-escape.js";
|
|
@@ -23,6 +24,8 @@ const NAV_KEYS = {
|
|
|
23
24
|
};
|
|
24
25
|
const KEY_OWNING_SURFACES = GRID_KEY_OWNING_SURFACES;
|
|
25
26
|
const INTERACTIVE = 'button, a[href], [role="button"], [tabindex]:not([tabindex="-1"])';
|
|
27
|
+
const NO_HISTORY = { undo: () => false, redo: () => false };
|
|
28
|
+
const NO_EDITS = { saving: false, canUndo: false, canRedo: false };
|
|
26
29
|
function eventBelongsElsewhere(target, root) {
|
|
27
30
|
if (!target?.closest)
|
|
28
31
|
return false;
|
|
@@ -30,8 +33,8 @@ function eventBelongsElsewhere(target, root) {
|
|
|
30
33
|
return true;
|
|
31
34
|
return !!target.closest(INTERACTIVE) && !root?.contains(target);
|
|
32
35
|
}
|
|
33
|
-
export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnabled, listConfig, visibleRowIds, rowByKey, visibleColIds, visibleColumns, rows, getRowId, pendingByRow, rangeVerbsRef, focusCell, clearFocus, startEdit, cancelEdit, commitEdit, refuseEdit, undo, redo, isLastEdited = () => true, rangeSetRect, rangeExtendTo, ranges, revealCell, releaseToFrame, lastCellRef, chrome = null, setChrome = () => { }, shape, toggleGroup, }) {
|
|
34
|
-
const { ports, messages } = useViews();
|
|
36
|
+
export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnabled, listConfig, rowWritable, visibleRowIds, rowByKey, visibleColIds, visibleColumns, rows, getRowId, pendingByRow, rangeVerbsRef, focusCell, clearFocus, startEdit, cancelEdit, commitEdit, refuseEdit, undo, redo, isLastEdited = () => true, editsState, rangeSetRect, rangeExtendTo, ranges, revealCell, releaseToFrame, lastCellRef, chrome = null, setChrome = () => { }, shape, toggleGroup, }) {
|
|
37
|
+
const { ports, messages, conventions } = useViews();
|
|
35
38
|
const navFromEditorRef = useRef({ tab: () => { }, enter: () => { } });
|
|
36
39
|
const onEditorTab = useCallback((rowId, columnId, backwards) => navFromEditorRef.current.tab(rowId, columnId, backwards), []);
|
|
37
40
|
const onEditorEnter = useCallback((rowId, columnId) => navFromEditorRef.current.enter(rowId, columnId), []);
|
|
@@ -56,9 +59,20 @@ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnab
|
|
|
56
59
|
};
|
|
57
60
|
}, [focusCell, revealCell, visibleColIds, visibleRowIds]);
|
|
58
61
|
const rowsWait = useContext(GridWaitContext);
|
|
62
|
+
const historyRef = useRef(NO_HISTORY);
|
|
63
|
+
const editsStateRef = useRef(editsState);
|
|
64
|
+
editsStateRef.current = editsState;
|
|
65
|
+
const sink = useContext(GridEditsSinkContext);
|
|
59
66
|
useEffect(() => {
|
|
60
|
-
if (!
|
|
67
|
+
if (!sink)
|
|
61
68
|
return;
|
|
69
|
+
return sink.attach({
|
|
70
|
+
undo: () => historyRef.current.undo(),
|
|
71
|
+
redo: () => historyRef.current.redo(),
|
|
72
|
+
state: () => editsStateRef.current?.() ?? NO_EDITS,
|
|
73
|
+
});
|
|
74
|
+
}, [sink]);
|
|
75
|
+
useEffect(() => {
|
|
62
76
|
const scrollToCell = ({ rowId, columnId }) => {
|
|
63
77
|
const key = rowByKey.has(rowId) ? rowId : visibleRowIds.find((k) => gridRowIdFromKey(k) === rowId);
|
|
64
78
|
if (key == null)
|
|
@@ -67,6 +81,15 @@ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnab
|
|
|
67
81
|
focusCell(key, columnId);
|
|
68
82
|
requestAnimationFrame(() => revealCell(pos, "smooth"));
|
|
69
83
|
};
|
|
84
|
+
const resolveRow = (rowId) => rows.find((row) => getRowId(row) === rowId);
|
|
85
|
+
historyRef.current = editingEnabled
|
|
86
|
+
? {
|
|
87
|
+
undo: () => !rowsWait?.waiting.current && undo(resolveRow, scrollToCell),
|
|
88
|
+
redo: () => !rowsWait?.waiting.current && redo(resolveRow, scrollToCell),
|
|
89
|
+
}
|
|
90
|
+
: NO_HISTORY;
|
|
91
|
+
if (!editingEnabled)
|
|
92
|
+
return;
|
|
70
93
|
const onKeyDown = (event) => {
|
|
71
94
|
if (!(event.metaKey || event.ctrlKey) || event.altKey || event.key.toLowerCase() !== "z") {
|
|
72
95
|
return;
|
|
@@ -78,7 +101,6 @@ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnab
|
|
|
78
101
|
const holder = event.target?.closest?.('[data-slot="vk-grid"]') ?? null;
|
|
79
102
|
if (holder ? holder !== rootRef.current : !isLastEdited())
|
|
80
103
|
return;
|
|
81
|
-
const resolveRow = (rowId) => rows.find((row) => getRowId(row) === rowId);
|
|
82
104
|
const handled = event.shiftKey
|
|
83
105
|
? redo(resolveRow, scrollToCell)
|
|
84
106
|
: undo(resolveRow, scrollToCell);
|
|
@@ -247,6 +269,11 @@ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnab
|
|
|
247
269
|
};
|
|
248
270
|
function handleCellKey(event, focusedCell, leave) {
|
|
249
271
|
const resolveFocused = () => resolveFocusedAt(focusedCell);
|
|
272
|
+
const rowOk = () => {
|
|
273
|
+
const { row } = resolveFocused();
|
|
274
|
+
return row == null || (rowWritable?.(row) ?? true);
|
|
275
|
+
};
|
|
276
|
+
const cellWrites = (column) => columnEffectiveWritable(column, listConfig) && rowOk();
|
|
250
277
|
const mod = (event.metaKey || event.ctrlKey) && !event.shiftKey && !event.altKey;
|
|
251
278
|
const bare = !event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey;
|
|
252
279
|
const navDirection = NAV_KEYS[event.key];
|
|
@@ -329,7 +356,7 @@ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnab
|
|
|
329
356
|
isWholeTextColumn(column) &&
|
|
330
357
|
gridCellCutOff(findGridCell(rootRef.current, focusedCell));
|
|
331
358
|
if (column &&
|
|
332
|
-
((editingEnabled && gridColumnHasEditor(column) &&
|
|
359
|
+
((editingEnabled && gridColumnHasEditor(column) && cellWrites(column)) ||
|
|
333
360
|
gridColumnInspectable(column) ||
|
|
334
361
|
whole)) {
|
|
335
362
|
startEdit(focusedCell.rowId, focusedCell.columnId, undefined, whole, true);
|
|
@@ -338,7 +365,7 @@ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnab
|
|
|
338
365
|
if (column &&
|
|
339
366
|
editingEnabled &&
|
|
340
367
|
gridBooleanMode(column) === "toggle" &&
|
|
341
|
-
|
|
368
|
+
cellWrites(column)) {
|
|
342
369
|
const { row, rowId } = resolveFocused();
|
|
343
370
|
if (row != null) {
|
|
344
371
|
const on = cellEditBaseline(column, row, pendingByRow.get(rowId)) === true;
|
|
@@ -346,7 +373,7 @@ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnab
|
|
|
346
373
|
return;
|
|
347
374
|
}
|
|
348
375
|
}
|
|
349
|
-
if (column && refuseEdit(column.id))
|
|
376
|
+
if (column && refuseEdit(column.id, rowOk()))
|
|
350
377
|
return;
|
|
351
378
|
const next = nextCellPos(focusedCell, "down", visibleRowIds, visibleColIds);
|
|
352
379
|
if (!next)
|
|
@@ -365,7 +392,7 @@ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnab
|
|
|
365
392
|
return;
|
|
366
393
|
const pending = pendingByRow.get(rowId);
|
|
367
394
|
const baseline = cellEditBaseline(column, row, pending);
|
|
368
|
-
void copyCell(ports.clipboard.writeText, column, baseline, column.editUnit?.value(row), cellCopyShown(column, row, pending));
|
|
395
|
+
void copyCell(ports.clipboard.writeText, column, baseline, column.editUnit?.value(row), cellCopyShown(column, row, pending), conventions.language);
|
|
369
396
|
}
|
|
370
397
|
else if (mod && event.key.toLowerCase() === "x" && !editingCell) {
|
|
371
398
|
event.preventDefault();
|
|
@@ -377,13 +404,13 @@ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnab
|
|
|
377
404
|
const { column, row, rowId } = resolveFocused();
|
|
378
405
|
if (!column || row == null)
|
|
379
406
|
return;
|
|
380
|
-
if (!editingEnabled || !
|
|
407
|
+
if (!editingEnabled || !cellWrites(column))
|
|
381
408
|
return;
|
|
382
409
|
if (!gridBooleanMode(column) && !column.clearable)
|
|
383
410
|
return;
|
|
384
411
|
const pending = pendingByRow.get(rowId);
|
|
385
412
|
const baseline = cellEditBaseline(column, row, pending);
|
|
386
|
-
void copyCell(ports.clipboard.writeText, column, baseline, column.editUnit?.value(row), cellCopyShown(column, row, pending));
|
|
413
|
+
void copyCell(ports.clipboard.writeText, column, baseline, column.editUnit?.value(row), cellCopyShown(column, row, pending), conventions.language);
|
|
387
414
|
commitEdit(row, rowId, column.id, cellClearPrev(column, row, pendingByRow.get(rowId)), "");
|
|
388
415
|
}
|
|
389
416
|
else if ((event.key === "Delete" || event.key === "Backspace") && !editingCell) {
|
|
@@ -396,8 +423,8 @@ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnab
|
|
|
396
423
|
const { column, row, rowId } = resolveFocused();
|
|
397
424
|
if (!column || row == null || !editingEnabled)
|
|
398
425
|
return;
|
|
399
|
-
if (!
|
|
400
|
-
if (!refuseEdit(column.id))
|
|
426
|
+
if (!cellWrites(column)) {
|
|
427
|
+
if (!refuseEdit(column.id, rowOk()))
|
|
401
428
|
ports.toast.error(gridClearRefusal(column, listConfig, messages));
|
|
402
429
|
return;
|
|
403
430
|
}
|
|
@@ -417,8 +444,8 @@ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnab
|
|
|
417
444
|
const column = visibleColumns.find((item) => item.id === focusedCell.columnId);
|
|
418
445
|
if (!column)
|
|
419
446
|
return;
|
|
420
|
-
if (!
|
|
421
|
-
if (refuseEdit(column.id))
|
|
447
|
+
if (!cellWrites(column)) {
|
|
448
|
+
if (refuseEdit(column.id, rowOk()))
|
|
422
449
|
event.preventDefault();
|
|
423
450
|
return;
|
|
424
451
|
}
|
|
@@ -433,6 +460,7 @@ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnab
|
|
|
433
460
|
return () => root.removeEventListener("keydown", onKeyDown);
|
|
434
461
|
}, [
|
|
435
462
|
cancelEdit,
|
|
463
|
+
conventions.language,
|
|
436
464
|
chrome,
|
|
437
465
|
clearFocus,
|
|
438
466
|
commitEdit,
|
|
@@ -444,6 +472,7 @@ export function useGridKeyboard({ rootRef, focusedCell, editingCell, editingEnab
|
|
|
444
472
|
getRowId,
|
|
445
473
|
lastCellRef,
|
|
446
474
|
listConfig,
|
|
475
|
+
rowWritable,
|
|
447
476
|
releaseToFrame,
|
|
448
477
|
messages,
|
|
449
478
|
pendingByRow,
|
|
@@ -26,7 +26,6 @@ export function useGridPendingReconciliation({ rows, columns, getRowId, pendingB
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
const matched = findGridPendingMatches(rows, columns, getRowId, pendingByRow, hasInflight);
|
|
29
|
-
|
|
30
|
-
reconcile(matched);
|
|
29
|
+
reconcile(matched);
|
|
31
30
|
}, [columns, getRowId, hasInflight, messages, pendingBaseline, pendingByRow, ports, reconcile, rows]);
|
|
32
31
|
}
|
|
@@ -72,7 +72,7 @@ export declare function useGridTableInteractionModel<Row>({ rootRef, props, rows
|
|
|
72
72
|
commitBatch: (edits: (GridEditCell<Row> & {
|
|
73
73
|
row: Row;
|
|
74
74
|
})[]) => Promise<boolean>;
|
|
75
|
-
refuseEdit: (columnId: string) => boolean;
|
|
75
|
+
refuseEdit: (columnId: string, rowOk?: boolean) => boolean;
|
|
76
76
|
onExtendCell: (rowId: string, columnId: string) => void;
|
|
77
77
|
onAddCell: (rowId: string, columnId: string) => void;
|
|
78
78
|
handleRootPointerDown: (event: React.PointerEvent) => void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { useViews } from "../../provider/context.js";
|
|
4
4
|
import { useGridEditing } from "../core/useGridEditing.js";
|
|
5
|
+
import { GridEditsSinkContext } from "../core/edits-sink.js";
|
|
5
6
|
import { useGridRange } from "../core/useGridRange.js";
|
|
6
7
|
import { gridRefusalSentence } from "../core/refusal-sentence.js";
|
|
7
8
|
import { columnEffectiveWritable, columnLabel, gridColumnLocked, gridEditRefusal, gridNormalizeWrite, } from "../../model/column-capabilities.js";
|
|
@@ -20,7 +21,7 @@ import { useGridRangeGestures } from "./useGridRangeGestures.js";
|
|
|
20
21
|
import { useGridCellPick } from "./useGridCellPick.js";
|
|
21
22
|
const REFUSAL_REPEAT_MS = 600;
|
|
22
23
|
export function useGridTableInteractionModel({ rootRef, props, rows, visibleRows, heldRows, rowIndex, visibleColumns, selecting, revealRow, focusShape, groupOfRow, }) {
|
|
23
|
-
const { columns, getRowId, listConfig } = props;
|
|
24
|
+
const { columns, getRowId, listConfig, rowWritable } = props;
|
|
24
25
|
const { conventions, ports, messages } = useViews();
|
|
25
26
|
const editingEnabled = !!props.onCellCommit;
|
|
26
27
|
const sayRefusal = useCallback((refusal) => {
|
|
@@ -33,7 +34,7 @@ export function useGridTableInteractionModel({ rootRef, props, rows, visibleRows
|
|
|
33
34
|
const columnById = useMemo(() => new Map([...columns, ...visibleColumns].map((column) => [column.id, column])), [columns, visibleColumns]);
|
|
34
35
|
const partOfWhole = useCallback((wholeId) => [...columnById.values()].find((column) => column.partOf?.column === wholeId)?.partOf, [columnById]);
|
|
35
36
|
const keepsSent = useCallback((columnId) => partOfWhole(columnId) != null, [partOfWhole]);
|
|
36
|
-
const { focused: focusedCell, editing: editingCell, pendingByRow, pendingOf, settlementByRow, writeStateByRow, focusCell, clearFocus, startEdit, cancelEdit, closeEdit, commitEdit: commitEditRaw, commitBatch: commitBatchRaw, undo, redo, reconcile, hasInflight, pendingBaseline, sent, sentCells, forgetSent, isLastEdited, } = useGridEditing(props.onCellCommit, props.onCellsCommit, sayRefusal, keepsSent);
|
|
37
|
+
const { focused: focusedCell, editing: editingCell, pendingByRow, pendingOf, settlementByRow, writeStateByRow, focusCell, clearFocus, startEdit, cancelEdit, closeEdit, commitEdit: commitEditRaw, commitBatch: commitBatchRaw, undo, redo, reconcile, canUndo: canUndoNow, canRedo: canRedoNow, saving: savingNow, hasInflight, pendingBaseline, sent, sentCells, forgetSent, isLastEdited, } = useGridEditing(props.onCellCommit, props.onCellsCommit, sayRefusal, keepsSent);
|
|
37
38
|
const wholeStored = useCallback((rowId, wholeId, row) => {
|
|
38
39
|
const part = partOfWhole(wholeId);
|
|
39
40
|
const overlay = pendingOf(rowId);
|
|
@@ -133,13 +134,17 @@ export function useGridTableInteractionModel({ rootRef, props, rows, visibleRows
|
|
|
133
134
|
return commitBatchRaw(kept);
|
|
134
135
|
}, [columnById, commitBatchRaw, conventions, messages, ports, lockedRefusal, wholeStored]);
|
|
135
136
|
const lastRefusalRef = useRef(null);
|
|
136
|
-
const refuseEdit = useCallback((columnId) => {
|
|
137
|
+
const refuseEdit = useCallback((columnId, rowOk = true) => {
|
|
137
138
|
if (!editingEnabled)
|
|
138
139
|
return false;
|
|
139
140
|
const col = visibleColumns.find((c) => c.id === columnId);
|
|
140
|
-
if (!col
|
|
141
|
+
if (!col)
|
|
141
142
|
return false;
|
|
142
|
-
const reason =
|
|
143
|
+
const reason = !columnEffectiveWritable(col, listConfig)
|
|
144
|
+
? gridEditRefusal(col, listConfig, conventions, messages)
|
|
145
|
+
: rowOk
|
|
146
|
+
? undefined
|
|
147
|
+
: messages({ key: "views.grid.cell-read-only" });
|
|
143
148
|
if (!reason)
|
|
144
149
|
return false;
|
|
145
150
|
const now = Date.now();
|
|
@@ -229,7 +234,8 @@ export function useGridTableInteractionModel({ rootRef, props, rows, visibleRows
|
|
|
229
234
|
conventions,
|
|
230
235
|
messages,
|
|
231
236
|
listConfig,
|
|
232
|
-
|
|
237
|
+
rowWritable,
|
|
238
|
+
}), [rows, rowIndex, visibleRows, visibleColumns, pendingByRow, conventions, messages, listConfig, rowWritable]);
|
|
233
239
|
const revealCell = useCallback((pos, behavior) => revealGridCell(rootRef.current, pos, behavior, revealRow), [revealRow, rootRef]);
|
|
234
240
|
const finishFillRef = useRef(() => { });
|
|
235
241
|
const { fillTargetRow, onExtendCell, onAddCell, handleRootPointerDown, handleRootPointerDownCapture, handleRootClickCapture, } = useGridRangeGestures({
|
|
@@ -263,6 +269,11 @@ export function useGridTableInteractionModel({ rootRef, props, rows, visibleRows
|
|
|
263
269
|
useEffect(() => {
|
|
264
270
|
finishFillRef.current = rangeActions.finishFill;
|
|
265
271
|
}, [rangeActions.finishFill]);
|
|
272
|
+
const editsState = useCallback(() => ({ saving: savingNow(), canUndo: canUndoNow(), canRedo: canRedoNow() }), [savingNow, canUndoNow, canRedoNow]);
|
|
273
|
+
const editsSink = useContext(GridEditsSinkContext);
|
|
274
|
+
useEffect(() => {
|
|
275
|
+
editsSink?.changed();
|
|
276
|
+
}, [editsSink, pendingByRow, writeStateByRow]);
|
|
266
277
|
const keyboard = useGridKeyboard({
|
|
267
278
|
releaseToFrame: focus.releaseToFrame,
|
|
268
279
|
lastCellRef: focus.lastCellRef,
|
|
@@ -275,6 +286,7 @@ export function useGridTableInteractionModel({ rootRef, props, rows, visibleRows
|
|
|
275
286
|
editingCell,
|
|
276
287
|
editingEnabled,
|
|
277
288
|
listConfig,
|
|
289
|
+
rowWritable,
|
|
278
290
|
visibleRowIds: visibleRows,
|
|
279
291
|
visibleColIds: visibleColumnIds,
|
|
280
292
|
visibleColumns,
|
|
@@ -292,6 +304,7 @@ export function useGridTableInteractionModel({ rootRef, props, rows, visibleRows
|
|
|
292
304
|
undo,
|
|
293
305
|
redo,
|
|
294
306
|
isLastEdited,
|
|
307
|
+
editsState,
|
|
295
308
|
rangeSetRect,
|
|
296
309
|
rangeExtendTo,
|
|
297
310
|
ranges,
|
|
@@ -35,7 +35,9 @@ export declare function cellEditBaseline<Row>(col: ListColumn<Row>, row: Row, pe
|
|
|
35
35
|
* paste stays exact. A pending value is the cell's own, and a cell that draws itself has no shown value to read.
|
|
36
36
|
*/
|
|
37
37
|
export declare function cellCopyShown<Row>(col: ListColumn<Row>, row: Row, pendingByCol?: Readonly<Record<string, unknown>>): unknown;
|
|
38
|
-
|
|
38
|
+
/** A cell's copied text. `language` is the names language (`conventions.language`) a place's country is named in, as
|
|
39
|
+
* its cell shows it; English without one. */
|
|
40
|
+
export declare function cellCopyText<Row>(col: ListColumn<Row>, baseline: unknown, language?: string): string;
|
|
39
41
|
/** Parse external plain text as a spreadsheet matrix. */
|
|
40
42
|
export declare function parseTsvText(text: string): {
|
|
41
43
|
text: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { actorLabel, formatLocalMinute, isActorValue, isBreakdown, isRangeValue, isValueItem, listValues, locationText, nameText, parseNumber, rangeShownText, relationIdOf, relationKey, relationLinksOf, relationStoredOf, utcDay, } from "viewkitjs/fields";
|
|
1
|
+
import { actorLabel, formatLocalMinute, isActorValue, isBreakdown, isIntegerField, isRangeValue, isValueItem, listValues, locationText, nameText, parseNumber, rangeShownText, relationIdOf, relationKey, relationLinksOf, relationStoredOf, roundTo, utcDay, } from "viewkitjs/fields";
|
|
2
2
|
import { phoneText } from "viewkitjs/fields/phone";
|
|
3
3
|
import { msToDurationUnit, parseDateInput, parseDurationInput } from "viewkitjs/fields/query";
|
|
4
4
|
import { calendarDayOf } from "./value-equality.js";
|
|
@@ -20,22 +20,22 @@ export function cellCopyShown(col, row, pendingByCol) {
|
|
|
20
20
|
return col.accessor(row);
|
|
21
21
|
return cellEditBaseline(col, row, pendingByCol);
|
|
22
22
|
}
|
|
23
|
-
export function cellCopyText(col, baseline) {
|
|
23
|
+
export function cellCopyText(col, baseline, language) {
|
|
24
24
|
if (baseline == null)
|
|
25
25
|
return "";
|
|
26
26
|
if (Array.isArray(baseline))
|
|
27
27
|
return (baseline.some(isValueItem) ? listValues(baseline) : baseline)
|
|
28
|
-
.map((entry) => cellValueText(col, entry))
|
|
28
|
+
.map((entry) => cellValueText(col, entry, language))
|
|
29
29
|
.join(", ");
|
|
30
|
-
return cellValueText(col, baseline);
|
|
30
|
+
return cellValueText(col, baseline, language);
|
|
31
31
|
}
|
|
32
|
-
function cellValueText(col, value) {
|
|
32
|
+
function cellValueText(col, value, language) {
|
|
33
33
|
if (value == null)
|
|
34
34
|
return "";
|
|
35
35
|
if (isValueItem(value))
|
|
36
|
-
return cellValueText(col, value.value);
|
|
36
|
+
return cellValueText(col, value.value, language);
|
|
37
37
|
if (fieldTypeOf(col) === "location")
|
|
38
|
-
return locationText(value);
|
|
38
|
+
return locationText(value, language);
|
|
39
39
|
if (fieldTypeOf(col) === "name")
|
|
40
40
|
return nameText(value);
|
|
41
41
|
if (fieldTypeOf(col) === "phone") {
|
|
@@ -250,11 +250,12 @@ export function coercePaste(col, source, opts) {
|
|
|
250
250
|
reason: messages({ key: duration ? "views.grid.paste-not-duration" : "views.grid.paste-not-number" }),
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
|
+
const figure = col.field && isIntegerField(col.field) ? roundTo(value, 0) : value;
|
|
253
254
|
const unit = pasteUnit(source.unit, opts.currentUnit, col.editUnit?.options, fieldTypeOf(col) === "currency" && (opts.holdsCurrency ?? true));
|
|
254
255
|
if ("refuse" in unit) {
|
|
255
256
|
return { ok: false, reason: messages({ key: "views.grid.paste-other-currency", values: { currency: unit.refuse } }) };
|
|
256
257
|
}
|
|
257
|
-
const next = { value, unit: unit.unit };
|
|
258
|
+
const next = { value: figure, unit: unit.unit };
|
|
258
259
|
return { ok: true, next, overlay };
|
|
259
260
|
}
|
|
260
261
|
case "date": {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { FieldSettlement } from "viewkitjs/fields";
|
|
2
2
|
/** `reload: false`: the commit's own reload is skipped because its caller reloads once after a second
|
|
3
|
-
* write — a board drop under manual order saves the order next, and that reload shows both.
|
|
3
|
+
* write — a board drop under manual order saves the order next, and that reload shows both.
|
|
4
|
+
* `closing`: the page is going (`pagehide`): send it so it outlives the page (`fetch(…, { keepalive: true })`). */
|
|
4
5
|
export type GridCommitContext = {
|
|
5
6
|
kind: "commit";
|
|
6
7
|
reload?: false;
|
|
8
|
+
closing?: true;
|
|
7
9
|
} | {
|
|
8
10
|
kind: "restore";
|
|
9
11
|
expected: unknown;
|
|
12
|
+
closing?: true;
|
|
10
13
|
};
|
|
11
14
|
export type GridCommitOutcome = {
|
|
12
15
|
status: "confirmed";
|
|
@@ -22,7 +25,8 @@ export type GridCommitOutcome = {
|
|
|
22
25
|
* as null): the value as the row now reads it in this column. Present, even
|
|
23
26
|
* as null, the cell shows it in place of what was typed, undo and redo
|
|
24
27
|
* restore from it (unless `history` says otherwise), and the rows that carry
|
|
25
|
-
* it next clear the cell without a word.
|
|
28
|
+
* it next clear the cell without a word. On an undo or a redo the cell shows it
|
|
29
|
+
* until the rows carry it; the history is left as it was. */
|
|
26
30
|
stored?: unknown;
|
|
27
31
|
} | {
|
|
28
32
|
status: "unconfirmed";
|
|
@@ -31,6 +35,20 @@ export type GridCommitOutcome = {
|
|
|
31
35
|
status: "failed";
|
|
32
36
|
error?: unknown;
|
|
33
37
|
};
|
|
38
|
+
/** One record's change, as an app's save receives it: the record's id, its row as the grid holds it, the values to
|
|
39
|
+
* write (one key or more per cell, merged), and whether the page is going (send it so it outlives the page). */
|
|
40
|
+
export type ListChange<Row> = {
|
|
41
|
+
id: string;
|
|
42
|
+
row: Row;
|
|
43
|
+
values: Record<string, unknown>;
|
|
44
|
+
closing?: boolean;
|
|
45
|
+
};
|
|
46
|
+
/** The one function an app gives to save a change to a record: an edit, a paste, a fill, an undo or a redo. It
|
|
47
|
+
* resolves once the record holds the values, with what was kept where the server stored something else; it rejects
|
|
48
|
+
* to refuse the change. */
|
|
49
|
+
export type ListSave<Row> = (change: ListChange<Row>) => Promise<void | {
|
|
50
|
+
stored?: Partial<Row>;
|
|
51
|
+
}>;
|
|
34
52
|
/** One write the app refused, as the editing core reports it: the columns of the cells that failed, in order, how many,
|
|
35
53
|
* and the first failure's error (or the call's rejection). */
|
|
36
54
|
export type GridCommitRefusal = {
|
|
@@ -58,6 +58,9 @@ export declare class GridEditingController<Row> {
|
|
|
58
58
|
setCallbacks(callbacks: GridEditingCallbacks<Row>): void;
|
|
59
59
|
canUndo(): boolean;
|
|
60
60
|
canRedo(): boolean;
|
|
61
|
+
/** Is any write still out, in any cell? An overlay outlives its write until the rows show the value (`reconcile`), so
|
|
62
|
+
* the overlays can't answer this; an undo or a redo pressed and not yet sent counts as on its way. */
|
|
63
|
+
saving(): boolean;
|
|
61
64
|
getPendingByRow(): ReadonlyMap<string, Record<string, unknown>>;
|
|
62
65
|
/**
|
|
63
66
|
* Resolves TRUE once every cell has landed on the server, false if any
|
|
@@ -68,6 +71,10 @@ export declare class GridEditingController<Row> {
|
|
|
68
71
|
* as success: a caller awaiting this should confirm, not report a failure.
|
|
69
72
|
*/
|
|
70
73
|
commit(cells: GridCommitCell<Row>[]): Promise<boolean>;
|
|
74
|
+
/** The rows were read again, and these cells now show their overlay's value (or have moved past it). A press's
|
|
75
|
+
* overlay not yet sent is held: rows that show what it puts back before its write went out may be rows the edit it
|
|
76
|
+
* takes back hasn't reached yet. It is cleared when its restore is confirmed, if the latest rows still showed it:
|
|
77
|
+
* every pass says again what the rows show, the press sent or not. */
|
|
71
78
|
reconcile(matchedKeys: readonly string[]): void;
|
|
72
79
|
undo(resolveRow: ResolveRow<Row>, onApply?: (pos: GridCellPos) => void): boolean;
|
|
73
80
|
redo(resolveRow: ResolveRow<Row>, onApply?: (pos: GridCellPos) => void): boolean;
|
|
@@ -136,7 +143,21 @@ export declare class GridEditingController<Row> {
|
|
|
136
143
|
private performBatch;
|
|
137
144
|
private inflightFor;
|
|
138
145
|
private enqueueApply;
|
|
146
|
+
/** Takes a press's overlay off these cells where it still stands, putting back what it covered; a later press that
|
|
147
|
+
* covered it covers what it covered instead. */
|
|
148
|
+
private liftPress;
|
|
149
|
+
/** What a waiting press covered follows the overlay it covered: gone with a refused write, the kept value with a
|
|
150
|
+
* stored one, marked with a `requested` one. */
|
|
151
|
+
private reviseCovered;
|
|
152
|
+
/** Is this cell's overlay a press's own, not yet sent? */
|
|
153
|
+
private unsentPressOn;
|
|
139
154
|
private applyPin;
|
|
155
|
+
/** Decides what a press writes and hands it to the app, synchronously up to the call: after the wait for the edit
|
|
156
|
+
* it takes back, or inside the page's close. Null when it sends nothing. */
|
|
157
|
+
private sendPin;
|
|
158
|
+
/** The page is going: a press still waiting for the edit it takes back is sent now, inside the event, or never. Its
|
|
159
|
+
* answer settles it as usual if the page stays (the back-forward cache). */
|
|
160
|
+
private sendAtClose;
|
|
140
161
|
/** A press that applied hands what it put back to the first edit written over each of its cells since: that edit
|
|
141
162
|
* was typed over what the press took back, so its own undo has to put back what the press put back. */
|
|
142
163
|
private carryPutBack;
|