viewkitjs 0.27.0 → 0.29.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 +178 -0
- package/MIGRATION.md +123 -5
- package/fields/dist/derived.d.ts +2 -1
- package/fields/dist/derived.js +9 -3
- package/fields/dist/entities.js +41 -3
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/messages.d.ts +8 -2
- package/fields/dist/messages.js +3 -0
- package/fields/dist/range.d.ts +6 -0
- package/fields/dist/range.js +8 -0
- package/fields/dist/registry.js +11 -1
- package/fields/dist/spec-changes.js +1 -0
- package/fields/dist/types.d.ts +23 -1
- package/fields/docs/guides/derived-fields.md +7 -5
- package/fields/docs/guides/field-types.md +2 -2
- package/fields/docs/guides/the-index.md +1 -1
- package/fields/docs/reference/fields.md +3 -1
- package/fields/docs/reference/types.md +3 -1
- package/fields/skills/viewkit/SKILL.md +1 -1
- package/package.json +2 -1
- package/postgres/dist/definitions/build.js +29 -5
- package/postgres/dist/definitions/label.d.ts +7 -0
- package/postgres/dist/definitions/label.js +9 -1
- package/postgres/dist/definitions/lookup.js +6 -2
- package/postgres/dist/definitions/place.d.ts +6 -3
- package/postgres/dist/definitions/rollup.js +5 -1
- package/postgres/dist/definitions/storage.d.ts +15 -0
- package/postgres/dist/definitions/storage.js +52 -1
- package/postgres/dist/definitions/stored.js +21 -0
- package/postgres/dist/phone.d.ts +13 -1
- package/postgres/dist/phone.js +23 -3
- package/postgres/dist/search-indexes.d.ts +6 -1
- package/postgres/dist/search-indexes.js +71 -25
- package/postgres/dist/search.js +3 -3
- package/postgres/docs/guides/definitions.md +22 -5
- package/postgres/docs/guides/field-map.md +5 -4
- package/postgres/docs/reference/definitions.md +3 -3
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/cells/cell-format.d.ts +3 -1
- package/views/dist/cells/cell-format.js +3 -3
- package/views/dist/cells/cell-values.js +9 -10
- package/views/dist/cells/use-cell-format.d.ts +8 -1
- package/views/dist/cells/use-cell-format.js +13 -2
- package/views/dist/contract.d.ts +218 -5
- package/views/dist/contract.js +233 -1
- package/views/dist/controls/alert/alert.d.ts +46 -0
- package/views/dist/controls/alert/alert.js +11 -0
- package/views/dist/controls/alert/looks.d.ts +4 -0
- package/views/dist/controls/alert/looks.js +19 -0
- package/views/dist/controls/alert/tokens.d.ts +92 -0
- package/views/dist/controls/alert/tokens.js +25 -0
- package/views/dist/controls/alert-dialog/alert-dialog.d.ts +50 -0
- package/views/dist/controls/alert-dialog/alert-dialog.js +67 -0
- package/views/dist/controls/alert-dialog/confirm.d.ts +13 -0
- package/views/dist/controls/alert-dialog/confirm.js +11 -0
- package/views/dist/controls/alert-dialog/looks.d.ts +4 -0
- package/views/dist/controls/alert-dialog/looks.js +17 -0
- package/views/dist/controls/alert-dialog/tokens.d.ts +119 -0
- package/views/dist/controls/alert-dialog/tokens.js +32 -0
- package/views/dist/controls/alert-dialog.css +95 -0
- package/views/dist/controls/alert.css +51 -0
- package/views/dist/controls/bulk-bar/bulk-bar-of.d.ts +66 -0
- package/views/dist/controls/bulk-bar/bulk-bar-of.js +22 -0
- package/views/dist/controls/bulk-bar/bulk-bar.d.ts +40 -0
- package/views/dist/controls/bulk-bar/bulk-bar.js +278 -0
- package/views/dist/controls/bulk-bar/looks.d.ts +10 -0
- package/views/dist/controls/bulk-bar/looks.js +14 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.d.ts +19 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.js +57 -0
- package/views/dist/controls/bulk-bar/tokens.d.ts +136 -0
- package/views/dist/controls/bulk-bar/tokens.js +36 -0
- package/views/dist/controls/bulk-bar/words.d.ts +50 -0
- package/views/dist/controls/bulk-bar/words.js +19 -0
- package/views/dist/controls/bulk-bar.css +96 -0
- package/views/dist/controls/button/button.js +3 -1
- package/views/dist/controls/button.css +5 -4
- package/views/dist/controls/checkbox/checkbox.js +3 -1
- package/views/dist/controls/checkbox.css +1 -1
- package/views/dist/controls/choice/tokens.d.ts +79 -0
- package/views/dist/controls/choice/tokens.js +22 -0
- package/views/dist/controls/choice.css +31 -0
- package/views/dist/controls/collapsible/collapsible.d.ts +39 -0
- package/views/dist/controls/collapsible/collapsible.js +18 -0
- package/views/dist/controls/collapsible/looks.d.ts +4 -0
- package/views/dist/controls/collapsible/looks.js +5 -0
- package/views/dist/controls/collapsible/map-collapse.d.ts +2 -0
- package/views/dist/controls/collapsible/map-collapse.js +6 -0
- package/views/dist/controls/collapsible/tokens.d.ts +68 -0
- package/views/dist/controls/collapsible/tokens.js +19 -0
- package/views/dist/controls/collapsible.css +83 -0
- package/views/dist/controls/compound-editor/looks.js +1 -1
- package/views/dist/controls/compound-editor/place-parts.js +5 -1
- package/views/dist/controls/controls.d.ts +19 -0
- package/views/dist/controls/controls.js +17 -0
- package/views/dist/controls/customize/customize.d.ts +125 -0
- package/views/dist/controls/customize/customize.js +243 -0
- package/views/dist/controls/customize/glide.d.ts +10 -0
- package/views/dist/controls/customize/glide.js +55 -0
- package/views/dist/controls/customize/looks.d.ts +13 -0
- package/views/dist/controls/customize/looks.js +11 -0
- package/views/dist/controls/customize/map-customize-body.d.ts +18 -0
- package/views/dist/controls/customize/map-customize-body.js +160 -0
- package/views/dist/controls/customize/rules.d.ts +23 -0
- package/views/dist/controls/customize/rules.js +19 -0
- package/views/dist/controls/customize/tokens.d.ts +40 -0
- package/views/dist/controls/customize/tokens.js +12 -0
- package/views/dist/controls/customize/words.d.ts +58 -0
- package/views/dist/controls/customize/words.js +37 -0
- package/views/dist/controls/customize.css +54 -0
- package/views/dist/controls/date-editor/date-editor.d.ts +2 -1
- package/views/dist/controls/date-editor/looks.js +1 -1
- package/views/dist/controls/date-editor/map-calendar.js +3 -1
- package/views/dist/controls/filter-editor/block.d.ts +31 -0
- package/views/dist/controls/filter-editor/block.js +27 -0
- package/views/dist/controls/filter-editor/filter-editor.d.ts +58 -0
- package/views/dist/controls/filter-editor/filter-editor.js +250 -0
- package/views/dist/controls/filter-editor/how.d.ts +23 -0
- package/views/dist/controls/filter-editor/how.js +14 -0
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +33 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +190 -0
- package/views/dist/controls/filter-editor/map-rules.d.ts +101 -0
- package/views/dist/controls/filter-editor/map-rules.js +304 -0
- package/views/dist/controls/filter-editor/parts.d.ts +46 -0
- package/views/dist/controls/filter-editor/parts.js +75 -0
- package/views/dist/controls/filter-editor/rules.d.ts +142 -0
- package/views/dist/controls/filter-editor/rules.js +201 -0
- package/views/dist/controls/filter-editor/tokens.d.ts +83 -0
- package/views/dist/controls/filter-editor/tokens.js +23 -0
- package/views/dist/controls/filter-editor/words.d.ts +74 -0
- package/views/dist/controls/filter-editor/words.js +46 -0
- package/views/dist/controls/filter-editor.css +142 -0
- package/views/dist/controls/group-editor/group-editor.d.ts +56 -0
- package/views/dist/controls/group-editor/group-editor.js +126 -0
- package/views/dist/controls/group-editor/map-group-body.d.ts +19 -0
- package/views/dist/controls/group-editor/map-group-body.js +106 -0
- package/views/dist/controls/group-editor/rules.d.ts +48 -0
- package/views/dist/controls/group-editor/rules.js +41 -0
- package/views/dist/controls/group-editor/tokens.d.ts +15 -0
- package/views/dist/controls/group-editor/tokens.js +6 -0
- package/views/dist/controls/group-editor/words.d.ts +39 -0
- package/views/dist/controls/group-editor/words.js +21 -0
- package/views/dist/controls/group-editor.css +20 -0
- package/views/dist/controls/index.d.ts +45 -3
- package/views/dist/controls/index.js +44 -3
- package/views/dist/controls/inline-input/looks.js +1 -1
- package/views/dist/controls/input/input.js +10 -4
- package/views/dist/controls/internal/editor-parts.d.ts +8 -1
- package/views/dist/controls/internal/editor-parts.js +5 -0
- package/views/dist/controls/internal/phone.d.ts +5 -4
- package/views/dist/controls/internal/phone.js +7 -7
- package/views/dist/controls/internal/scroll.js +5 -1
- package/views/dist/controls/internal/step-return.d.ts +9 -0
- package/views/dist/controls/internal/step-return.js +27 -0
- package/views/dist/controls/internal/typed-run.d.ts +2 -0
- package/views/dist/controls/internal/typed-run.js +5 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +5 -3
- package/views/dist/controls/links-editor/links-editor.js +38 -17
- package/views/dist/controls/links-editor/map-links-body.js +4 -1
- package/views/dist/controls/links-editor.css +1 -1
- package/views/dist/controls/menu/map-menu.js +2 -2
- package/views/dist/controls/menu-list/menu-list.d.ts +17 -2
- package/views/dist/controls/menu-list/menu-list.js +25 -16
- package/views/dist/controls/modal/looks.d.ts +4 -0
- package/views/dist/controls/modal/looks.js +25 -0
- package/views/dist/controls/modal/modal.d.ts +69 -0
- package/views/dist/controls/modal/modal.js +62 -0
- package/views/dist/controls/modal/tokens.d.ts +192 -0
- package/views/dist/controls/modal/tokens.js +50 -0
- package/views/dist/controls/modal.css +130 -0
- package/views/dist/controls/notice/notice.d.ts +49 -0
- package/views/dist/controls/notice/notice.js +35 -0
- package/views/dist/controls/notice/tokens.d.ts +99 -0
- package/views/dist/controls/notice/tokens.js +27 -0
- package/views/dist/controls/notice.css +100 -0
- package/views/dist/controls/number-editor/looks.js +1 -1
- package/views/dist/controls/number-editor/number-editor.js +1 -1
- package/views/dist/controls/option/option.js +3 -1
- package/views/dist/controls/option.css +1 -1
- package/views/dist/controls/pane/looks.d.ts +4 -0
- package/views/dist/controls/pane/looks.js +11 -0
- package/views/dist/controls/pane/pane.d.ts +67 -0
- package/views/dist/controls/pane/pane.js +99 -0
- package/views/dist/controls/pane/state.d.ts +14 -0
- package/views/dist/controls/pane/state.js +7 -0
- package/views/dist/controls/pane/tokens.d.ts +79 -0
- package/views/dist/controls/pane/tokens.js +22 -0
- package/views/dist/controls/pane.css +104 -0
- package/views/dist/controls/picker/looks.js +1 -1
- package/views/dist/controls/picker/map-picker.d.ts +6 -2
- package/views/dist/controls/picker/map-picker.js +4 -2
- package/views/dist/controls/picker/picker.d.ts +7 -0
- package/views/dist/controls/picker/picker.js +57 -8
- package/views/dist/controls/picker/rows.d.ts +4 -2
- package/views/dist/controls/picker/rows.js +4 -3
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +2 -2
- package/views/dist/controls/popover/popover.js +2 -1
- package/views/dist/controls/popover.css +3 -0
- package/views/dist/controls/ports-host/map-ports-host.d.ts +7 -0
- package/views/dist/controls/ports-host/map-ports-host.js +43 -0
- package/views/dist/controls/press/tokens.d.ts +8 -0
- package/views/dist/controls/press/tokens.js +4 -0
- package/views/dist/controls/press.css +44 -0
- package/views/dist/controls/quick-filters/looks.d.ts +11 -0
- package/views/dist/controls/quick-filters/looks.js +9 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +31 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +56 -0
- package/views/dist/controls/quick-filters/quick-filters.d.ts +37 -0
- package/views/dist/controls/quick-filters/quick-filters.js +89 -0
- package/views/dist/controls/quick-filters/reminder.d.ts +18 -0
- package/views/dist/controls/quick-filters/reminder.js +41 -0
- package/views/dist/controls/quick-filters/rules.d.ts +89 -0
- package/views/dist/controls/quick-filters/rules.js +52 -0
- package/views/dist/controls/quick-filters/tokens.d.ts +112 -0
- package/views/dist/controls/quick-filters/tokens.js +30 -0
- package/views/dist/controls/quick-filters/words.d.ts +25 -0
- package/views/dist/controls/quick-filters/words.js +13 -0
- package/views/dist/controls/quick-filters.css +118 -0
- package/views/dist/controls/sheet/bottom-sheet.d.ts +9 -4
- package/views/dist/controls/sheet/bottom-sheet.js +4 -4
- package/views/dist/controls/sheet/map-sheet.d.ts +4 -1
- package/views/dist/controls/sheet/map-sheet.js +19 -6
- package/views/dist/controls/sheet/sheet-parts.d.ts +10 -0
- package/views/dist/controls/sheet/sheet-parts.js +2 -0
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +9 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +81 -0
- package/views/dist/controls/sort-editor/rules.d.ts +48 -0
- package/views/dist/controls/sort-editor/rules.js +24 -0
- package/views/dist/controls/sort-editor/sort-editor.d.ts +58 -0
- package/views/dist/controls/sort-editor/sort-editor.js +180 -0
- package/views/dist/controls/sort-editor/tokens.d.ts +79 -0
- package/views/dist/controls/sort-editor/tokens.js +22 -0
- package/views/dist/controls/sort-editor/words.d.ts +48 -0
- package/views/dist/controls/sort-editor/words.js +25 -0
- package/views/dist/controls/sort-editor.css +96 -0
- package/views/dist/controls/switch-row/switch-row.d.ts +15 -0
- package/views/dist/controls/switch-row/switch-row.js +9 -0
- package/views/dist/controls/switch-row/tokens.d.ts +51 -0
- package/views/dist/controls/switch-row/tokens.js +15 -0
- package/views/dist/controls/switch-row.css +39 -0
- package/views/dist/controls/switch.css +1 -1
- package/views/dist/controls/tag/tag.js +3 -1
- package/views/dist/controls/tag-field/tag-field.d.ts +20 -0
- package/views/dist/controls/tag-field/tag-field.js +19 -0
- package/views/dist/controls/tag-field/tokens.d.ts +7 -0
- package/views/dist/controls/tag-field/tokens.js +4 -0
- package/views/dist/controls/tag-field.css +13 -0
- package/views/dist/controls/text-editor/looks.js +1 -1
- package/views/dist/controls/text-editor/text-editor.js +1 -5
- package/views/dist/controls/toast/toast.d.ts +79 -0
- package/views/dist/controls/toast/toast.js +101 -0
- package/views/dist/controls/toast/tokens.d.ts +100 -0
- package/views/dist/controls/toast/tokens.js +27 -0
- package/views/dist/controls/toast.css +93 -0
- package/views/dist/controls/tokens.js +38 -0
- package/views/dist/controls/toolbar/keys.d.ts +3 -0
- package/views/dist/controls/toolbar/keys.js +11 -0
- package/views/dist/controls/toolbar/looks.d.ts +10 -0
- package/views/dist/controls/toolbar/looks.js +40 -0
- package/views/dist/controls/toolbar/tokens.d.ts +28 -0
- package/views/dist/controls/toolbar/tokens.js +9 -0
- package/views/dist/controls/toolbar/toolbar.d.ts +111 -0
- package/views/dist/controls/toolbar/toolbar.js +370 -0
- package/views/dist/controls/toolbar/words.d.ts +28 -0
- package/views/dist/controls/toolbar/words.js +17 -0
- package/views/dist/controls/toolbar-button/looks.d.ts +4 -0
- package/views/dist/controls/toolbar-button/looks.js +21 -0
- package/views/dist/controls/toolbar-button/tokens.d.ts +103 -0
- package/views/dist/controls/toolbar-button/tokens.js +28 -0
- package/views/dist/controls/toolbar-button/toolbar-button.d.ts +66 -0
- package/views/dist/controls/toolbar-button/toolbar-button.js +51 -0
- package/views/dist/controls/toolbar-button.css +75 -0
- package/views/dist/controls/toolbar.css +65 -0
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +2 -2
- package/views/dist/controls/tooltip/tooltip.d.ts +3 -1
- package/views/dist/controls/tooltip/tooltip.js +2 -2
- package/views/dist/controls/values-editor/looks.js +1 -1
- package/views/dist/controls/values-editor/values-editor.js +7 -1
- package/views/dist/controls/views-list/map-views-list-body.d.ts +4 -1
- package/views/dist/controls/views-list/map-views-list-body.js +128 -4
- package/views/dist/controls/views-list/rules.d.ts +26 -0
- package/views/dist/controls/views-list/rules.js +63 -0
- package/views/dist/controls/views-list/view-menu.d.ts +84 -0
- package/views/dist/controls/views-list/view-menu.js +201 -0
- package/views/dist/controls/views-list/views-list.d.ts +8 -1
- package/views/dist/controls/views-list/views-list.js +18 -3
- package/views/dist/controls/views-list/words.d.ts +54 -0
- package/views/dist/controls/views-list/words.js +10 -1
- package/views/dist/controls/views-list.css +5 -1
- package/views/dist/display/date.js +5 -5
- package/views/dist/display/format.d.ts +6 -0
- package/views/dist/display/format.js +13 -2
- package/views/dist/display/index.d.ts +1 -1
- package/views/dist/display/index.js +1 -1
- package/views/dist/display/options.d.ts +3 -1
- package/views/dist/display/range.d.ts +2 -1
- package/views/dist/display/range.js +4 -1
- package/views/dist/display/use-display-options.d.ts +3 -0
- package/views/dist/display/use-display-options.js +10 -2
- package/views/dist/display/viewer.d.ts +1 -1
- package/views/dist/display/viewer.js +1 -1
- package/views/dist/editors/DateEditor.js +11 -9
- package/views/dist/editors/relation-panel.js +7 -1
- package/views/dist/editors/relation-picker.d.ts +2 -1
- package/views/dist/editors/relation-picker.js +4 -3
- package/views/dist/editors/relation-source.d.ts +4 -1
- package/views/dist/editors/relation-source.js +5 -2
- package/views/dist/field-row/editors/RowNumberEditor.js +2 -2
- package/views/dist/fields/number-edit.d.ts +6 -0
- package/views/dist/fields/number-edit.js +8 -1
- package/views/dist/grid/chrome/GridCellEditors.js +2 -2
- package/views/dist/grid/chrome/GridColumnDateSection.d.ts +4 -3
- package/views/dist/grid/chrome/GridColumnDateSection.js +4 -4
- package/views/dist/grid/chrome/GridColumnDurationSection.js +2 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +6 -4
- package/views/dist/grid/chrome/GridFooter.js +2 -2
- package/views/dist/grid/chrome/GridHeader.js +2 -1
- package/views/dist/grid/chrome/GridNumberEditor.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +2 -1
- package/views/dist/grid/chrome/GridTextEditor.js +2 -2
- package/views/dist/grid/chrome/grid-column-menu-items.js +4 -2
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -1
- package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +7 -1
- package/views/dist/grid/chrome/grid-fitted-box.js +4 -4
- package/views/dist/grid/chrome/useGridBandFigures.js +2 -2
- package/views/dist/grid/chrome/useGridFittedWidths.d.ts +3 -0
- package/views/dist/grid/chrome/useGridFittedWidths.js +9 -3
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +5 -2
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -1
- package/views/dist/grid/core/clipboard-model.js +9 -4
- package/views/dist/grid/core/commit-model.d.ts +7 -0
- package/views/dist/grid/core/commit-model.js +5 -1
- package/views/dist/grid/core/editing-controller.js +10 -2
- package/views/dist/grid/core/editing-model.js +3 -7
- package/views/dist/grid/core/undo-owner.d.ts +6 -0
- package/views/dist/grid/core/undo-owner.js +13 -0
- package/views/dist/grid/core/useGridEditing.d.ts +2 -0
- package/views/dist/grid/core/useGridEditing.js +4 -0
- package/views/dist/grid/grid.css +240 -0
- package/views/dist/grid/looks.d.ts +5 -1
- package/views/dist/grid/looks.js +20 -12
- package/views/dist/grid-tokens.d.ts +109 -0
- package/views/dist/grid-tokens.js +29 -0
- package/views/dist/looks/index.d.ts +10 -0
- package/views/dist/looks/index.js +10 -0
- package/views/dist/looks/pieces.js +20 -0
- package/views/dist/model/column-capabilities.d.ts +2 -0
- package/views/dist/model/column-filters.d.ts +2 -1
- package/views/dist/model/column-from.js +2 -2
- package/views/dist/model/relation-filters.d.ts +2 -0
- package/views/dist/panels/index.d.ts +2 -2
- package/views/dist/panels/index.js +2 -2
- package/views/dist/panels/labels.d.ts +4 -0
- package/views/dist/panels/labels.js +8 -0
- package/views/dist/panels/model.d.ts +14 -1
- package/views/dist/panels/quick/model.d.ts +4 -0
- package/views/dist/panels/react/customize-body.d.ts +12 -5
- package/views/dist/panels/react/customize-body.js +41 -13
- package/views/dist/panels/react/customize.d.ts +8 -1
- package/views/dist/panels/react/customize.js +11 -6
- package/views/dist/panels/react/filter/FilterEditor.js +6 -6
- package/views/dist/panels/react/filter/FilterFieldList.js +10 -2
- package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +8 -2
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +12 -9
- package/views/dist/panels/react/filter/filter-body.d.ts +8 -5
- package/views/dist/panels/react/filter/filter-body.js +21 -7
- package/views/dist/panels/react/filter/filter-part-body.d.ts +4 -1
- package/views/dist/panels/react/filter/filter-part-body.js +3 -1
- package/views/dist/panels/react/panel-sheet.d.ts +5 -1
- package/views/dist/panels/react/panel-sheet.js +6 -2
- package/views/dist/panels/react/panel-step.d.ts +15 -0
- package/views/dist/panels/react/panel-step.js +27 -0
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +1 -0
- package/views/dist/panels/react/sort/SortEditor.d.ts +4 -0
- package/views/dist/panels/react/sort/SortEditor.js +5 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +18 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +93 -4
- package/views/dist/panels/react/toolbar/Toolbar.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +15 -5
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +16 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +50 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +3 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +38 -23
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +12 -4
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +5 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +15 -6
- package/views/dist/panels/react/toolbar/panel-part.d.ts +5 -1
- package/views/dist/panels/react/toolbar/panel-part.js +2 -2
- package/views/dist/panels/react/toolbar/use-filter-add.d.ts +16 -0
- package/views/dist/panels/react/toolbar/use-filter-add.js +32 -0
- package/views/dist/panels/react/view-footer.d.ts +1 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +25 -4
- package/views/dist/panels/react.d.ts +1 -0
- package/views/dist/panels/react.js +1 -0
- package/views/dist/panels/settings/filter-groups.d.ts +3 -0
- package/views/dist/panels/settings/filter-groups.js +72 -7
- package/views/dist/panels/settings/filters.d.ts +5 -0
- package/views/dist/panels/settings/filters.js +12 -6
- package/views/dist/panels/settings/group-buckets.js +1 -0
- package/views/dist/panels/views-row/model.d.ts +10 -1
- package/views/dist/provider/ViewsProvider.d.ts +7 -1
- package/views/dist/provider/ViewsProvider.js +50 -6
- package/views/dist/provider/components.d.ts +178 -11
- package/views/dist/provider/context.d.ts +6 -0
- package/views/dist/provider/moment.d.ts +6 -0
- package/views/dist/provider/moment.js +10 -0
- package/views/dist/provider/ports.d.ts +18 -6
- package/views/dist/provider/ports.js +2 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/react.js +1 -1
- package/views/dist/selection/SelectionBar.d.ts +2 -16
- package/views/dist/selection/SelectionBar.js +4 -1
- package/views/dist/selection/bar-props.d.ts +26 -0
- package/views/dist/selection/bar-props.js +1 -0
- package/views/dist/selection/index.d.ts +1 -1
- package/views/dist/selection/verbs.d.ts +32 -5
- package/views/dist/styles.css +1499 -73
- package/views/dist/styles.unlayered.css +1497 -70
- package/views/docs/contract.md +56 -23
- package/views/docs/controls/alert-dialog.md +37 -0
- package/views/docs/controls/alert.md +30 -0
- package/views/docs/controls/bulk-bar.md +41 -0
- package/views/docs/controls/choice.md +25 -0
- package/views/docs/controls/collapsible.md +22 -0
- package/views/docs/controls/customize.md +17 -0
- package/views/docs/controls/filter-editor.md +28 -0
- package/views/docs/controls/group-editor.md +11 -0
- package/views/docs/controls/modal.md +55 -0
- package/views/docs/controls/notice.md +32 -0
- package/views/docs/controls/pane.md +25 -0
- package/views/docs/controls/popover.md +2 -0
- package/views/docs/controls/press.md +9 -0
- package/views/docs/controls/quick-filters.md +35 -0
- package/views/docs/controls/radio.md +1 -1
- package/views/docs/controls/sort-editor.md +27 -0
- package/views/docs/controls/switch-row.md +18 -0
- package/views/docs/controls/tag-field.md +7 -0
- package/views/docs/controls/toast.md +32 -0
- package/views/docs/controls/toolbar-button.md +31 -0
- package/views/docs/controls/toolbar.md +14 -0
- package/views/docs/guides/atoms.md +2 -2
- package/views/docs/guides/cells.md +3 -3
- package/views/docs/guides/display.md +3 -3
- package/views/docs/guides/looks.md +8 -2
- package/views/docs/guides/ports.md +6 -6
- package/views/docs/guides/selection.md +5 -1
- package/views/docs/guides/the-grid.md +2 -2
- package/views/docs/guides/the-provider.md +21 -2
- package/views/docs/install.md +4 -1
- package/views/docs/reference/cells.md +3 -3
- package/views/docs/reference/controls.md +403 -16
- package/views/docs/reference/display.md +3 -2
- package/views/docs/reference/editors-relation.md +1 -1
- package/views/docs/reference/looks.md +35 -11
- package/views/docs/reference/panels-react.md +11 -10
- package/views/docs/reference/panels.md +9 -7
- package/views/docs/reference/react.md +20 -13
- package/views/docs/reference/selection.md +4 -2
- package/views/docs/reference/views.md +8 -6
- package/views/skills/views/SKILL.md +2 -2
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { useViews } from "../provider/context.js";
|
|
4
|
+
import { useMoment } from "../provider/moment.js";
|
|
4
5
|
import { DEFAULT_FIELD_PRESENTATION } from "./format.js";
|
|
5
6
|
import { viewerFrom } from "./viewer.js";
|
|
6
|
-
|
|
7
|
+
function useDisplayOptionsAt(opts, now) {
|
|
7
8
|
const { conventions, messages, presentation } = useViews();
|
|
8
9
|
const appPresentation = useMemo(() => presentation?.(DEFAULT_FIELD_PRESENTATION), [presentation]);
|
|
10
|
+
const viewer = useMemo(() => viewerFrom(conventions, messages, now), [conventions, messages, now]);
|
|
9
11
|
return {
|
|
10
12
|
...opts,
|
|
11
13
|
presentation: opts?.presentation ?? appPresentation,
|
|
12
|
-
viewer: opts?.viewer ??
|
|
14
|
+
viewer: opts?.viewer ?? viewer,
|
|
13
15
|
};
|
|
14
16
|
}
|
|
17
|
+
export function useDisplayOptions(opts) {
|
|
18
|
+
return useDisplayOptionsAt(opts, null);
|
|
19
|
+
}
|
|
20
|
+
export function useDateDisplayOptions(opts) {
|
|
21
|
+
return useDisplayOptionsAt(opts, useMoment());
|
|
22
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { FieldConventions } from "viewkitjs/fields";
|
|
2
2
|
import { type ViewsMessageResolver } from "../contract.js";
|
|
3
3
|
import type { FieldViewerContext } from "./options.js";
|
|
4
|
-
export declare function viewerFrom(conventions: FieldConventions, messages?: ViewsMessageResolver, now?: Date): FieldViewerContext;
|
|
4
|
+
export declare function viewerFrom(conventions: FieldConventions, messages?: ViewsMessageResolver, now?: Date | null): FieldViewerContext;
|
|
@@ -5,7 +5,7 @@ export function viewerFrom(conventions, messages = resolveViewsMessage, now = ne
|
|
|
5
5
|
language: conventions.language,
|
|
6
6
|
timeZone: conventions.timeZone,
|
|
7
7
|
...(conventions.region ? { region: conventions.region } : {}),
|
|
8
|
-
now,
|
|
8
|
+
...(now ? { now } : {}),
|
|
9
9
|
fieldMessages: conventions.messages,
|
|
10
10
|
messages,
|
|
11
11
|
};
|
|
@@ -6,6 +6,7 @@ import { fromDayKey, toDayKey } from "viewkitjs/fields/query";
|
|
|
6
6
|
import { cx } from "../internal/cx.js";
|
|
7
7
|
import { ELEMENT_RESET } from "../internal/reset.js";
|
|
8
8
|
import { useViews } from "../provider/context.js";
|
|
9
|
+
import { useMoment } from "../provider/moment.js";
|
|
9
10
|
import { isDesktopNow } from "../provider/desktop.js";
|
|
10
11
|
import { usePickerForm } from "./picker-slot.js";
|
|
11
12
|
import { tabbable, tabEnds } from "./tab-ends.js";
|
|
@@ -16,11 +17,11 @@ const QUICK_DAYS = {
|
|
|
16
17
|
"next-monday": { key: "date.next-monday", offset: (weekday) => (8 - weekday) % 7 || 7 },
|
|
17
18
|
"in-a-week": { key: "date.in-a-week", offset: () => 7 },
|
|
18
19
|
};
|
|
19
|
-
function todayOf(timeZone) {
|
|
20
|
-
return fromDayKey(todayIn(timeZone));
|
|
20
|
+
function todayOf(timeZone, now) {
|
|
21
|
+
return fromDayKey(todayIn(timeZone, now));
|
|
21
22
|
}
|
|
22
|
-
function quickDay(offset, timeZone) {
|
|
23
|
-
const today = todayOf(timeZone);
|
|
23
|
+
function quickDay(offset, timeZone, now) {
|
|
24
|
+
const today = todayOf(timeZone, now);
|
|
24
25
|
return new Date(today.getFullYear(), today.getMonth(), today.getDate() + offset(today.getDay()));
|
|
25
26
|
}
|
|
26
27
|
const CALENDAR_START = "1900-01";
|
|
@@ -65,6 +66,7 @@ export const DateEditor = forwardRef(function DateEditor({ initial, timeOptional
|
|
|
65
66
|
const timeRef = useRef(null);
|
|
66
67
|
const dateRef = useRef(null);
|
|
67
68
|
const views = useViews();
|
|
69
|
+
const now = useMoment() ?? undefined;
|
|
68
70
|
const words = message ?? views.conventions.messages;
|
|
69
71
|
const { Calendar, Input, DateBody } = views.components;
|
|
70
72
|
const { List, Row } = views.atoms;
|
|
@@ -125,7 +127,7 @@ export const DateEditor = forwardRef(function DateEditor({ initial, timeOptional
|
|
|
125
127
|
}, []);
|
|
126
128
|
const applyDateText = () => {
|
|
127
129
|
const current = dayRef.current ?? valid;
|
|
128
|
-
const typed = parseDateText(dateTextRef.current, (current ?? todayOf(timeZone)).getFullYear());
|
|
130
|
+
const typed = parseDateText(dateTextRef.current, (current ?? todayOf(timeZone, now)).getFullYear());
|
|
129
131
|
if (typed) {
|
|
130
132
|
dayRef.current = typed;
|
|
131
133
|
setDay(typed);
|
|
@@ -141,7 +143,7 @@ export const DateEditor = forwardRef(function DateEditor({ initial, timeOptional
|
|
|
141
143
|
return { kind: "cancel" };
|
|
142
144
|
if (clearedRef.current)
|
|
143
145
|
return valid ? { kind: "commit", payload: "" } : { kind: "noop" };
|
|
144
|
-
const year = (dayRef.current ?? valid ?? todayOf(timeZone)).getFullYear();
|
|
146
|
+
const year = (dayRef.current ?? valid ?? todayOf(timeZone, now)).getFullYear();
|
|
145
147
|
const typed = parseDateText(dateTextRef.current, year);
|
|
146
148
|
const d = typed ?? dayRef.current ?? valid;
|
|
147
149
|
if (dayOnly) {
|
|
@@ -239,7 +241,7 @@ export const DateEditor = forwardRef(function DateEditor({ initial, timeOptional
|
|
|
239
241
|
}
|
|
240
242
|
onTabOut(event);
|
|
241
243
|
};
|
|
242
|
-
return (_jsx("div", { "data-slot": "vk-date-editor", className: "contents", onKeyDownCapture: onBodyKey, onPointerDownCapture: () => (enteredRef.current = false), onBlurCapture: onTabAway, children: _jsx(DateBody, { label: label ?? words({ key: "date.label" }), value: bodyValue, onValueChange: takeBodyValue, onDone: () => onRequestClose(enteredRef.current ? "enter" : "pick"), time: !dayOnly, empty: clearable, picks: clearable ? [...quickPicks, "none"] : [...quickPicks], today: todayIn(timeZone), typed: seed, autoFocus: focusDate || seed != null, form: form }) }));
|
|
244
|
+
return (_jsx("div", { "data-slot": "vk-date-editor", className: "contents", onKeyDownCapture: onBodyKey, onPointerDownCapture: () => (enteredRef.current = false), onBlurCapture: onTabAway, children: _jsx(DateBody, { label: label ?? words({ key: "date.label" }), value: bodyValue, onValueChange: takeBodyValue, onDone: () => onRequestClose(enteredRef.current ? "enter" : "pick"), time: !dayOnly, empty: clearable, picks: clearable ? [...quickPicks, "none"] : [...quickPicks], today: todayIn(timeZone, now), typed: seed, autoFocus: focusDate || seed != null, form: form }) }));
|
|
243
245
|
}
|
|
244
246
|
return (_jsxs("div", { "data-slot": "vk-date-editor", className: "contents", onKeyDownCapture: onTabOut, onBlurCapture: onTabAway, children: [_jsxs("div", { className: "flex items-center gap-1.5 border-b border-(color:--vk-border) p-2", children: [_jsxs("div", { className: "flex h-8 min-w-0 flex-1 items-center gap-2 rounded-lg bg-(color:--vk-neutral) px-2.5 focus-within:bg-(color:--vk-neutral-hovered)", children: [_jsx(DateGlyph, { className: "h-3.5 w-3.5 shrink-0 text-(color:--vk-fg-subtlest)" }), _jsx(Input, { ref: dateRef, type: "text", value: dateVal, onChange: (e) => {
|
|
245
247
|
touchedRef.current = true;
|
|
@@ -286,14 +288,14 @@ export const DateEditor = forwardRef(function DateEditor({ initial, timeOptional
|
|
|
286
288
|
}, className: cx(ELEMENT_RESET, "w-full px-3 py-1.5 text-left text-sm tabular-nums hover:bg-(color:--vk-hovered)", active ? "bg-(color:--vk-neutral) font-medium text-(color:--vk-fg)" : "text-(color:--vk-fg-subtle)"), children: t }, t));
|
|
287
289
|
}) }))] }))] }), _jsx("div", { className: "flex gap-1 px-2 pt-2", children: quickPicks.map((pick) => (_jsx("button", { type: "button", onClick: (e) => {
|
|
288
290
|
e.stopPropagation();
|
|
289
|
-
chooseDay(quickDay(QUICK_DAYS[pick].offset, timeZone));
|
|
291
|
+
chooseDay(quickDay(QUICK_DAYS[pick].offset, timeZone, now));
|
|
290
292
|
}, className: cx(ELEMENT_RESET, "h-7 rounded-md bg-(color:--vk-neutral) px-2 text-xs text-(color:--vk-fg-subtle) hover:bg-(color:--vk-neutral-hovered) hover:text-(color:--vk-fg)"), children: words({ key: QUICK_DAYS[pick].key }) }, pick))) }), _jsx(Calendar, { locale: views.conventions.locale, ...(fill ? { className: "w-full" } : {}), value: (day ?? valid) ? toDayKey((day ?? valid)) : null, onChange: (picked) => {
|
|
291
293
|
const d = picked ? fromDayKey(picked) : null;
|
|
292
294
|
if (d)
|
|
293
295
|
chooseDay(d);
|
|
294
296
|
else if (dayOnly && dayRef.current)
|
|
295
297
|
chooseDay(dayRef.current);
|
|
296
|
-
}, month: toDayKey(month ?? todayOf(timeZone)).slice(0, 7), onMonthChange: (next) => setMonth(fromDayKey(`${next}-01`) ?? undefined), captionLayout: "dropdown", startMonth: CALENDAR_START, endMonth: CALENDAR_END }), clearable && (_jsx("div", { ref: clearRef, className: "border-t border-(color:--vk-border) py-1", children: _jsx(List, { children: _jsx(Row, { size: "compact", tone: "muted", label: words({ key: "date.clear" }), onClick: () => {
|
|
298
|
+
}, month: toDayKey(month ?? todayOf(timeZone, now)).slice(0, 7), onMonthChange: (next) => setMonth(fromDayKey(`${next}-01`) ?? undefined), captionLayout: "dropdown", startMonth: CALENDAR_START, endMonth: CALENDAR_END }), clearable && (_jsx("div", { ref: clearRef, className: "border-t border-(color:--vk-border) py-1", children: _jsx(List, { children: _jsx(Row, { size: "compact", tone: "muted", label: words({ key: "date.clear" }), onClick: () => {
|
|
297
299
|
clearedRef.current = true;
|
|
298
300
|
onRequestClose("pick");
|
|
299
301
|
} }) }) }))] }));
|
|
@@ -36,5 +36,11 @@ export function RelationPanel({ candidates, query, onQueryChange, searchRef, onS
|
|
|
36
36
|
: (value, search) => {
|
|
37
37
|
const label = rows.find((candidate) => candidate.id === value)?.label ?? labels?.get(value) ?? "";
|
|
38
38
|
return label.toLowerCase().includes(search.toLowerCase()) ? 1 : 0;
|
|
39
|
-
}, children: [_jsx(Command.Input, { ref: searchRef, placeholder: words({ key: "editor.search" }), className: "h-9 text-(length:--vk-input-text,13px)", value: query, onValueChange: onQueryChange, onKeyDown:
|
|
39
|
+
}, children: [_jsx(Command.Input, { ref: searchRef, placeholder: words({ key: "editor.search" }), className: "h-9 text-(length:--vk-input-text,13px)", value: query, onValueChange: onQueryChange, onKeyDown: (event) => {
|
|
40
|
+
if (remote && page.searching && event.key === "Enter") {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
onSearchKeyDown?.(event);
|
|
45
|
+
} }), _jsxs(Command.List, { className: "max-h-72 overscroll-contain scrollbar-overlay", children: [remote ? (status && (_jsx("div", { role: "status", className: "py-4 text-center text-xs text-(color:--vk-fg-subtle)", children: status }))) : (_jsx(Command.Empty, { className: "py-4 text-center text-xs text-(color:--vk-fg-subtle)", children: words({ key: "editor.nothing-matches" }) })), _jsx(Command.Group, { className: "p-0", children: _jsxs(List, { children: [before?.({ glyphs, glyph }), shown.map((candidate) => (_jsx(Command.Item, { value: candidate.id, onSelect: () => onSelect(candidate), chosen: isChosen(candidate.id), children: _jsx(RowContent, { size: "compact", leading: glyph(candidate.icon ?? kindGlyph), leadingLane: glyphs, label: candidate.label, description: candidate.sublabel, trailing: candidate.badge ? (_jsx("span", { className: "ml-2 shrink-0 rounded-sm border border-(color:--vk-border) px-1.5 py-0.5 text-(length:--vk-caption-text,10px) font-medium uppercase tracking-wide text-(color:--vk-fg-subtle)", children: candidate.badge })) : undefined, chosen: isChosen(candidate.id), chosenTint: false }) }, candidate.id)))] }) }), paging && _jsx(EndOfListSentinel, { onReveal: page.loadMore }), moreStatus && (_jsx("div", { role: "status", className: "py-3 text-center text-xs text-(color:--vk-fg-subtle)", children: moreStatus }))] }), creates && creates.length > 0 && (_jsx("div", { className: "border-t border-(color:--vk-border)", children: creates.map((create, index) => (_jsx(Row, { size: "compact", tone: "muted", leading: _jsx(Add, { className: "h-3.5 w-3.5 shrink-0" }), label: create.label(query.trim()), onClick: () => onCreate(create, query.trim()) }, index))) }))] }));
|
|
40
46
|
}
|
|
@@ -11,7 +11,8 @@ export type RelationHeld = {
|
|
|
11
11
|
};
|
|
12
12
|
/** What a relation's list hands the app's body, worked out once for its `Picker` and its `LinksBody`: the rows (held
|
|
13
13
|
* records first, while they match the query), the ids it handed out, a handed id's candidate, the page's states and
|
|
14
|
-
* the host's create rows as actions. ViewKit filters a static source and fetches a remote one.
|
|
14
|
+
* the host's create rows as actions. ViewKit filters a static source and fetches a remote one. While a remote list searches,
|
|
15
|
+
* the rows are the held records that match alone: no row of the last answer is handed, so none can be picked. */
|
|
15
16
|
export declare function useRelationRows({ candidates, query, held, kindGlyph, creates, onCreate, }: {
|
|
16
17
|
candidates: RelationSource;
|
|
17
18
|
query: string;
|
|
@@ -9,7 +9,8 @@ export function useRelationRows({ candidates, query, held, kindGlyph, creates, o
|
|
|
9
9
|
const Add = views.icons.add;
|
|
10
10
|
const remote = candidates.kind === "remote";
|
|
11
11
|
const page = useRemotePage(candidates, query);
|
|
12
|
-
const
|
|
12
|
+
const searching = remote && page.searching;
|
|
13
|
+
const rows = candidates.kind === "static" ? candidates.items.filter((candidate) => matches(candidate.label, query)) : searching ? [] : page.items;
|
|
13
14
|
const heldIds = new Set(held.map((record) => record.id));
|
|
14
15
|
const shownHeld = held.filter((record) => matches(record.label, query));
|
|
15
16
|
const byId = new Map();
|
|
@@ -34,9 +35,9 @@ export function useRelationRows({ candidates, query, held, kindGlyph, creates, o
|
|
|
34
35
|
items,
|
|
35
36
|
handed: new Set([...items.map((item) => item.value), ...heldIds]),
|
|
36
37
|
found: (id) => byId.get(id),
|
|
37
|
-
doing: !remote ? undefined :
|
|
38
|
+
doing: !remote ? undefined : searching ? "searching" : page.failed && page.items.length === 0 ? "failed" : undefined,
|
|
38
39
|
onRetry: remote && page.failed && page.items.length === 0 ? page.retry : undefined,
|
|
39
|
-
onMore: remote && !page.exhausted && page.items.length > 0 ? page.loadMore : undefined,
|
|
40
|
+
onMore: remote && !searching && !page.exhausted && page.items.length > 0 ? page.loadMore : undefined,
|
|
40
41
|
actions: creates?.map((create, index) => ({
|
|
41
42
|
key: `create-${index}`,
|
|
42
43
|
label: create.label(trimmed),
|
|
@@ -21,8 +21,11 @@ export type RemotePage = {
|
|
|
21
21
|
/** Every row of every page loaded for the current query, in order. Kept on
|
|
22
22
|
* screen while the next query's first page loads. */
|
|
23
23
|
items: RelationCandidate[];
|
|
24
|
-
/** The
|
|
24
|
+
/** The list on screen isn't the answer to the query typed: from the keystroke, through the debounce and the first
|
|
25
|
+
* page's request (VK-821). Its rows are the last query's meanwhile, so nothing may be taken from them. */
|
|
25
26
|
searching: boolean;
|
|
27
|
+
/** The query whose first page was last asked; null before any. Required: every page state carries it. */
|
|
28
|
+
asked: string | null;
|
|
26
29
|
/** A LATER page is in flight — the rows stay, a line appears under them. */
|
|
27
30
|
loadingMore: boolean;
|
|
28
31
|
/** The last request failed. A first page's failure clears the rows; a later
|
|
@@ -5,6 +5,7 @@ export const RELATION_SEARCH_DEBOUNCE_MS = 200;
|
|
|
5
5
|
export const RELATION_PAGE_SIZE = 20;
|
|
6
6
|
const EMPTY = {
|
|
7
7
|
items: [],
|
|
8
|
+
asked: null,
|
|
8
9
|
loadingMore: false,
|
|
9
10
|
failed: false,
|
|
10
11
|
offset: 0,
|
|
@@ -35,12 +36,14 @@ export function useRemotePage(source, query) {
|
|
|
35
36
|
searching: !append,
|
|
36
37
|
loadingMore: append,
|
|
37
38
|
failed: false,
|
|
39
|
+
asked: append ? previous.asked : nextQuery,
|
|
38
40
|
}));
|
|
39
41
|
search(nextQuery, controller.signal, offset).then((items) => {
|
|
40
42
|
if (controller.signal.aborted)
|
|
41
43
|
return;
|
|
42
44
|
setPage((previous) => ({
|
|
43
45
|
items: append ? [...previous.items, ...items] : items,
|
|
46
|
+
asked: previous.asked,
|
|
44
47
|
searching: false,
|
|
45
48
|
loadingMore: false,
|
|
46
49
|
failed: false,
|
|
@@ -74,7 +77,7 @@ export function useRemotePage(source, query) {
|
|
|
74
77
|
}, [remote, query, run]);
|
|
75
78
|
const loadMore = useCallback(() => {
|
|
76
79
|
const current = pageRef.current;
|
|
77
|
-
if (!remote || current.searching || current.loadingMore || current.exhausted)
|
|
80
|
+
if (!remote || current.searching || current.loadingMore || current.exhausted || queryRef.current !== current.asked)
|
|
78
81
|
return;
|
|
79
82
|
run(queryRef.current, current.offset);
|
|
80
83
|
}, [remote, run]);
|
|
@@ -84,7 +87,7 @@ export function useRemotePage(source, query) {
|
|
|
84
87
|
abortRef.current?.abort();
|
|
85
88
|
run(queryRef.current, 0);
|
|
86
89
|
}, [remote, run]);
|
|
87
|
-
return { ...page, loadMore, retry };
|
|
90
|
+
return { ...page, searching: remote && (page.searching || query !== page.asked), loadMore, retry };
|
|
88
91
|
}
|
|
89
92
|
export function EndOfListSentinel({ onReveal }) {
|
|
90
93
|
const ref = useRef(null);
|
|
@@ -6,7 +6,7 @@ import { ConversionLine } from "../../display/converted.js";
|
|
|
6
6
|
import { EditorPanel } from "../../editors/EditorPanel.js";
|
|
7
7
|
import { NumberEditor } from "../../editors/NumberEditor.js";
|
|
8
8
|
import { numberBounds } from "../../editors/number-body.js";
|
|
9
|
-
import { durationUnitOf, numberEditCode, numberEditDecimals } from "../../fields/number-edit.js";
|
|
9
|
+
import { durationUnitOf, numberEditCode, numberEditDecimals, numberEditInitial } from "../../fields/number-edit.js";
|
|
10
10
|
import { useViews } from "../../provider/context.js";
|
|
11
11
|
import { ROW_BOX_FRAME } from "./row-frame.js";
|
|
12
12
|
import { RowRefusal, useRowEditSession } from "./row-session.js";
|
|
@@ -23,7 +23,7 @@ export function RowNumberEditor({ binding, row, field, initial, conversion, onAt
|
|
|
23
23
|
const read = acceptFieldCommit(field, { value, ...(unit === undefined ? {} : { unit }) }, { conventions, unitOptions });
|
|
24
24
|
return read.ok ? null : read.reason;
|
|
25
25
|
};
|
|
26
|
-
return (_jsxs(EditorPanel, { session: session, title: field.label, anchor: anchorRef, inPlace: true, children: [_jsx(NumberEditor, { ref: editorRef, boxClassName: ROW_BOX_FRAME, initial:
|
|
26
|
+
return (_jsxs(EditorPanel, { session: session, title: field.label, anchor: anchorRef, inPlace: true, children: [_jsx(NumberEditor, { ref: editorRef, boxClassName: ROW_BOX_FRAME, initial: numberEditInitial(initial), unit: binding.unit?.read(row), unitOptions: unitOptions, code: binding.unit ? undefined : numberEditCode(field), decimals: decimals, durationUnit: durationUnit, allowEmpty: !!field.nullable, align: "start", conventions: conventions, ...numberBounds(field), ...(body
|
|
27
27
|
? {
|
|
28
28
|
type: field.type,
|
|
29
29
|
label: field.label,
|
|
@@ -15,3 +15,9 @@ export declare function numberEditDecimals(field: FieldDef): number;
|
|
|
15
15
|
export declare function numberEditCode(field: FieldDef): string | undefined;
|
|
16
16
|
/** The unit a duration field STORES (spec §8.4) — `undefined` for anything else. */
|
|
17
17
|
export declare function durationUnitOf(field: FieldDef): DurationUnit | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* What a number editor opens on: the number, or a stored decimal's text read as one (`"120.50"` → 120.5, a
|
|
20
|
+
* `storage: "decimal"` field's row value, VK-817); anything else is empty (NaN). The text is read for drawing the
|
|
21
|
+
* box, never for arithmetic: the save still goes through the field's own write.
|
|
22
|
+
*/
|
|
23
|
+
export declare function numberEditInitial(value: unknown): number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isIntegerField, presentedDef, valueTypeOf, } from "viewkitjs/fields";
|
|
1
|
+
import { isIntegerField, numberOfDecimalText, presentedDef, valueTypeOf, } from "viewkitjs/fields";
|
|
2
2
|
export function numberEditDecimals(field) {
|
|
3
3
|
if (isIntegerField(field))
|
|
4
4
|
return 0;
|
|
@@ -19,3 +19,10 @@ export function durationUnitOf(field) {
|
|
|
19
19
|
? (def.format.unit ?? "ms")
|
|
20
20
|
: undefined;
|
|
21
21
|
}
|
|
22
|
+
export function numberEditInitial(value) {
|
|
23
|
+
if (typeof value === "number")
|
|
24
|
+
return value;
|
|
25
|
+
if (typeof value === "string")
|
|
26
|
+
return numberOfDecimalText(value) ?? Number.NaN;
|
|
27
|
+
return Number.NaN;
|
|
28
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
import { numberEditCode, numberEditDecimals } from "../../fields/number-edit.js";
|
|
4
|
+
import { numberEditCode, numberEditDecimals, numberEditInitial } from "../../fields/number-edit.js";
|
|
5
5
|
import { numberBounds } from "../../editors/number-body.js";
|
|
6
6
|
import { convertedFromOf } from "../../fields/money.js";
|
|
7
7
|
import { renderTypedCellValue } from "../../cells/cell-values.js";
|
|
@@ -53,7 +53,7 @@ function InlineEditor({ ctx }) {
|
|
|
53
53
|
const durationUnit = col.format?.style === "duration" ? (col.format.unit ?? "ms") : undefined;
|
|
54
54
|
const field = col.field ?? legacyFieldFromColumn(col);
|
|
55
55
|
const valueType = valueTypeOf(field);
|
|
56
|
-
return (_jsx(GridNumberEditor, { title: col.header, initial:
|
|
56
|
+
return (_jsx(GridNumberEditor, { title: col.header, initial: numberEditInitial(baseline), seed: ctx.editSeed ?? undefined, unit: col.editUnit?.value(row), unitOptions: col.editUnit?.options, code: col.editUnit ? undefined : numberEditCode(field), type: valueType === "currency" || valueType === "percent" ? valueType : "number", bounds: numberBounds(field), decimals: integer ? 0 : (ctx.decimals ?? fallback), durationUnit: durationUnit, allowEmpty: !!col.clearable, unitLeft: col.align === "right", conversion: convertedFromOf(col, row) ? renderTypedCellValue(col, row, { decimals: ctx.decimals }) : undefined, refuse: (payload) => refusal(payload, cellPrevPayload(col, baseline, col.editUnit?.value(row))), onCommit: (payload) => onCommitCell(row, rowId, col.id, cellPrevPayload(col, baseline, col.editUnit?.value(row)), payload, { overlay: gridFigureDrawsAtOnce(col, row, payload) ? "figure" : false }), onCancel: onCancel, onTab: onTab, onEnter: onEnter }));
|
|
57
57
|
}
|
|
58
58
|
if (ctx.editorKind === "range") {
|
|
59
59
|
const def = col.field?.type === "range" ? col.field : undefined;
|
|
@@ -2,9 +2,10 @@ import type { ListColumn } from "../../model/column-schema.js";
|
|
|
2
2
|
import type { ListDateStyle } from "../../model/column-format.js";
|
|
3
3
|
import { type GridFlyouts } from "./GridFlyout.js";
|
|
4
4
|
export declare const DATE_STYLES: ListDateStyle[];
|
|
5
|
-
/** The live sample beside each style: a few days
|
|
6
|
-
*
|
|
7
|
-
|
|
5
|
+
/** The live sample beside each style: a few days before the provider's moment, so Relative reads as a real "3d ago"
|
|
6
|
+
* rather than the "now" it would say of the moment it opened. None before the provider has a moment: the clock is
|
|
7
|
+
* never read while drawing. */
|
|
8
|
+
export declare const sampleDate: (now: Date | undefined) => Date | null;
|
|
8
9
|
/**
|
|
9
10
|
* The date-column row in the header menu — one Format row whose flyout holds
|
|
10
11
|
* the styles (each beside a live sample) and, on a date-time, Show time —
|
|
@@ -8,15 +8,15 @@ import { useViews } from "../../provider/context.js";
|
|
|
8
8
|
import { GridFlyoutRow } from "./GridFlyout.js";
|
|
9
9
|
import { GridMenuSeparator, KnobGlyph } from "./GridMenuRow.js";
|
|
10
10
|
export const DATE_STYLES = ["short", "long", "numeric", "relative"];
|
|
11
|
-
export const sampleDate = () => new Date(
|
|
11
|
+
export const sampleDate = (now) => now ? new Date(now.getTime() - 3 * 86_400_000) : null;
|
|
12
12
|
export function GridColumnDateSection({ column, dateStyle, onDateStyleChange, showTime, onShowTimeChange, flyouts, onClose, }) {
|
|
13
13
|
const activeDateStyle = dateStyle ?? column.format?.dateStyle ?? "short";
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const { viewer, presentation } = useCellFormat();
|
|
15
|
+
const sample = sampleDate(viewer.now);
|
|
16
16
|
const { atoms, messages } = useViews();
|
|
17
17
|
const { Row } = atoms;
|
|
18
18
|
const styleLabel = (style) => messages({ key: "views.menus.date-style", values: { style } });
|
|
19
|
-
return (_jsxs(GridFlyoutRow, { id: "date-format", flyouts: flyouts, label: messages({ key: "views.menus.format" }), detail: styleLabel(activeDateStyle), leading: _jsx(KnobGlyph, { name: "calendar" }), children: [DATE_STYLES.map((style) => (_jsx(Row, { chosen: activeDateStyle === style, label: styleLabel(style), detail: _jsx("span", { className: "max-w-30 truncate", children: formatDate(sample, column, style, false, viewer) }), onClick: () => {
|
|
19
|
+
return (_jsxs(GridFlyoutRow, { id: "date-format", flyouts: flyouts, label: messages({ key: "views.menus.format" }), detail: styleLabel(activeDateStyle), leading: _jsx(KnobGlyph, { name: "calendar" }), children: [DATE_STYLES.map((style) => (_jsx(Row, { chosen: activeDateStyle === style, label: styleLabel(style), detail: _jsx("span", { className: "max-w-30 truncate", children: sample && formatDate(sample, column, style, false, viewer, presentation) }), onClick: () => {
|
|
20
20
|
onDateStyleChange(fieldKeyOf(column), style);
|
|
21
21
|
onClose();
|
|
22
22
|
} }, style))), onShowTimeChange && temporalKindOf(column) === "datetime" && (_jsxs(_Fragment, { children: [_jsx(GridMenuSeparator, {}), _jsx(Row, { chosen: !!showTime, label: messages({ key: "views.menus.show-time" }), onClick: () => onShowTimeChange(fieldKeyOf(column), !showTime) })] }))] }));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { fieldKeyOf } from "../../model/view-rules.js";
|
|
4
4
|
import { formatNumber } from "./cells.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useUndatedCellFormat } from "../../cells/use-cell-format.js";
|
|
6
6
|
import { useViews } from "../../provider/context.js";
|
|
7
7
|
import { GridFlyoutRow } from "./GridFlyout.js";
|
|
8
8
|
import { KnobGlyph } from "./GridMenuRow.js";
|
|
@@ -10,7 +10,7 @@ export const DURATION_STYLES = ["adaptive", "clock", "units"];
|
|
|
10
10
|
export const DURATION_SAMPLE_MS = 5_904_000;
|
|
11
11
|
export function GridColumnDurationSection({ column, durationStyle, onDurationStyleChange, flyouts, onClose, }) {
|
|
12
12
|
const activeDurationStyle = durationStyle ?? column.format?.durationStyle ?? "adaptive";
|
|
13
|
-
const cellFormat =
|
|
13
|
+
const cellFormat = useUndatedCellFormat();
|
|
14
14
|
const { atoms, messages } = useViews();
|
|
15
15
|
const { Row } = atoms;
|
|
16
16
|
const styleLabel = (style) => messages({ key: "views.menus.duration-style", values: { style } });
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cloneElement, useState, } from "react";
|
|
3
|
+
import { cloneElement, use, useState, } from "react";
|
|
4
4
|
import { columnLabel } from "../../model/column-capabilities.js";
|
|
5
5
|
import { columnKnobs } from "../../model/column-knobs.js";
|
|
6
|
-
import {
|
|
6
|
+
import { cellFormatAt, useUndatedCellFormat } from "../../cells/use-cell-format.js";
|
|
7
7
|
import { useViews } from "../../provider/context.js";
|
|
8
|
+
import { MomentContext } from "../../provider/moment.js";
|
|
8
9
|
import { columnMenuGates, gridColumnMenuItems } from "./grid-column-menu-items.js";
|
|
9
10
|
import { GridColumnColorSection } from "./GridColumnColorSection.js";
|
|
10
11
|
import { GridColumnDateSection } from "./GridColumnDateSection.js";
|
|
@@ -30,7 +31,8 @@ export function GridColumnMenu({ column, values, viewBacked = false, sort, group
|
|
|
30
31
|
const [anchor, setAnchor] = useState(null);
|
|
31
32
|
const menuFocus = useGridMenuFocus(open, anchor);
|
|
32
33
|
const press = useGridMenuPress(open);
|
|
33
|
-
const cellFormat =
|
|
34
|
+
const cellFormat = useUndatedCellFormat();
|
|
35
|
+
const moment = open ? use(MomentContext) : null;
|
|
34
36
|
const { atoms, components, icons, messages, menus } = useViews();
|
|
35
37
|
const { Popover, Menu } = components;
|
|
36
38
|
const { List } = atoms;
|
|
@@ -74,7 +76,7 @@ export function GridColumnMenu({ column, values, viewBacked = false, sort, group
|
|
|
74
76
|
if (!offers)
|
|
75
77
|
return _jsx(_Fragment, { children: children });
|
|
76
78
|
const items = open
|
|
77
|
-
? gridColumnMenuItems(column, { ...offer, optionColors, dateStyle, showTime, durationStyle, percentDisplay, numberFormat, onHide, appItems }, gates, { messages, icons, cellFormat, close })
|
|
79
|
+
? gridColumnMenuItems(column, { ...offer, optionColors, dateStyle, showTime, durationStyle, percentDisplay, numberFormat, onHide, appItems }, gates, { messages, icons, cellFormat: cellFormatAt(cellFormat, moment), close })
|
|
78
80
|
: [];
|
|
79
81
|
const menuTrigger = cloneElement(children, {
|
|
80
82
|
ref: setAnchor,
|
|
@@ -4,7 +4,7 @@ import { cx } from "../../internal/cx.js";
|
|
|
4
4
|
import { CellSuffix } from "../../display/format.js";
|
|
5
5
|
import { aggregateLabel, aggregateOptions, resolveAggregateKind } from "../../model/aggregates.js";
|
|
6
6
|
import { DEFAULT_DISPLAY_CURRENCY } from "../../fields/currency.js";
|
|
7
|
-
import {
|
|
7
|
+
import { useUndatedCellFormat } from "../../cells/use-cell-format.js";
|
|
8
8
|
import { gridFigureValue } from "./grid-figure-value.js";
|
|
9
9
|
import { useViews } from "../../provider/context.js";
|
|
10
10
|
import { GridAggregateMenu } from "./GridAggregateMenu.js";
|
|
@@ -18,7 +18,7 @@ export function gridFooterShown({ interactive, hostCells, }) {
|
|
|
18
18
|
}
|
|
19
19
|
export function GridFooter({ group, columns, selecting, aggregates, numberFormats, renderAggregate, onAggregateChange, viewBacked = false, frozenCount = 0, frozenLeft, continuation, defaultCurrency = DEFAULT_DISPLAY_CURRENCY, pageOnly = false, pin, ariaRowIndex, ariaLevel, ariaColOffset = 0, }) {
|
|
20
20
|
const interactive = !!onAggregateChange;
|
|
21
|
-
const cellFormat =
|
|
21
|
+
const cellFormat = useUndatedCellFormat();
|
|
22
22
|
const { messages } = useViews();
|
|
23
23
|
const hostCells = columns.map((column) => renderAggregate?.(column.id, group) ?? null);
|
|
24
24
|
const sourced = group.figures
|
|
@@ -15,6 +15,7 @@ import { gridColumnGlyph } from "./column-glyph.js";
|
|
|
15
15
|
import { gridFocusOnPress } from "./useGridFocus.js";
|
|
16
16
|
import { columnSortParts, effectiveSortKey, sortPartOf } from "../../model/column-sort.js";
|
|
17
17
|
import { columnPlacedByView } from "../../model/column-capabilities.js";
|
|
18
|
+
import { timeShown } from "../../display/format.js";
|
|
18
19
|
export function GridHeader({ showAddColumn = false, addColumnAt = "end", checkbox, checkColumnId, groupKey, ariaRowIndex, ariaLevel, ariaColOffset = 0, ariaTailIndex, columns, columnManager, minWidth, sort, sortMark = false, selectValues, optionColors, onOptionColorChange, dateStyles, onDateStyleChange, durationStyles, onDurationStyleChange, numberFormats, onNumberFormatChange, showTimeOverrides, onShowTimeChange, percentDisplays, onPercentDisplayChange, columnStateEnabled, listConfig, groupBy, resizingId, startResize, moveResize, endResize, resetColumnWidth, hideColumn, moveColumn, headerDrag, frozenCount = 0, frozenLeft, verticalBorders = true, headerVerticalBorders = false, viewBacked = false, formatsWritable, renderAddColumn, renderColumnMenuRows, columnMenuItems, openColumnMenu, onOpenColumnMenuChange, }) {
|
|
19
20
|
const { icons, components, messages } = useViews();
|
|
20
21
|
const headId = useId();
|
|
@@ -52,7 +53,7 @@ export function GridHeader({ showAddColumn = false, addColumnAt = "end", checkbo
|
|
|
52
53
|
: "relative"), children: [withCheck && checkbox, gridColumnGlyph({ icons, AppIcon: components.AppIcon }, column, "h-(--vk-head-glyph) w-(--vk-head-glyph) shrink-0 text-(color:--vk-head-glyph-fg,currentColor) opacity-70"), column.header ? (_jsx("span", { id: nameId, className: "truncate", children: column.header })) : null, sortMark && sortedAs && (_jsx("span", { "aria-hidden": true, className: "inline-flex shrink-0", children: _jsx(Mark, { className: "h-(--vk-head-glyph) w-(--vk-head-glyph)" }) })), withAddColumn && titleAddColumn, columnStateEnabled && (_jsx(GridResizeHandle, { active: resizingId === column.id, onResizeStart: (event) => startResize(column, event), onResizeMove: moveResize, onResizeEnd: endResize, onReset: () => resetColumnWidth(column) }))] }, column.id));
|
|
53
54
|
if (!menuEnabled)
|
|
54
55
|
return cell;
|
|
55
|
-
return (_jsx(GridColumnMenu, { column: column, values: selectValues[column.id] ?? [], viewBacked: viewBacked, sort: sort, groupBy: groupBy, optionColors: optionColors?.[fieldKeyOf(column)], onOptionColorChange: onOptionColorChange, dateStyle: dateStyles?.[fieldKeyOf(column)], onDateStyleChange: onDateStyleChange, durationStyle: durationStyles?.[fieldKeyOf(column)], onDurationStyleChange: onDurationStyleChange, numberFormat: numberFormats?.[fieldKeyOf(column)], onNumberFormatChange: onNumberFormatChange, showTime: showTimeOverrides?.[fieldKeyOf(column)]
|
|
56
|
+
return (_jsx(GridColumnMenu, { column: column, values: selectValues[column.id] ?? [], viewBacked: viewBacked, sort: sort, groupBy: groupBy, optionColors: optionColors?.[fieldKeyOf(column)], onOptionColorChange: onOptionColorChange, dateStyle: dateStyles?.[fieldKeyOf(column)], onDateStyleChange: onDateStyleChange, durationStyle: durationStyles?.[fieldKeyOf(column)], onDurationStyleChange: onDurationStyleChange, numberFormat: numberFormats?.[fieldKeyOf(column)], onNumberFormatChange: onNumberFormatChange, showTime: timeShown(column.format?.withTime, showTimeOverrides?.[fieldKeyOf(column)]), onShowTimeChange: column.type === "datetime" ? onShowTimeChange : undefined, percentDisplay: percentDisplays?.[fieldKeyOf(column)], onPercentDisplayChange: onPercentDisplayChange, onMoveLeft: canMove && index > 0 ? () => moveColumn(column, -1) : undefined, onMoveRight: canMove && index < columns.length - 1 ? () => moveColumn(column, 1) : undefined, onHide: canHide ? () => hideColumn(column) : undefined, formatsWritable: formatsWritable, renderColumnMenuRows: column.partOf ? undefined : renderColumnMenuRows, columnMenuItems: column.partOf ? undefined : columnMenuItems, open: openColumnMenu === undefined ? undefined : openColumnMenu === column.id, onOpenChange: onOpenColumnMenuChange ? (next) => onOpenColumnMenuChange(next ? column.id : null) : undefined, children: cell }, column.id));
|
|
56
57
|
}), _jsxs("div", { "data-slot": "vk-grid-tail", role: "columnheader", "aria-colindex": ariaTailIndex, style: GRID_TAIL_PLACE, className: cx("flex h-(--vk-head-h) min-w-0 items-center gap-2 border-b border-(color:--vk-border-subtle)", addColumn ? "pl-0" : "pl-(--vk-px)"), children: [listConfig?.readOnly && (_jsxs("span", { title: messages({ key: "views.grid.read-only-why" }), className: cx("inline-flex shrink-0 items-center gap-1 whitespace-nowrap text-(length:--vk-head-text) text-(color:--vk-fg-subtle)", !!addColumn && "pl-(--vk-px)"), children: [_jsx(icons.lock, { className: "h-3 w-3" }), messages({ key: "views.grid.read-only" })] })), addColumn && _jsx("div", { className: "flex h-full min-w-0 flex-1 items-stretch", children: addColumn })] })] }));
|
|
57
58
|
return (_jsx("div", { "data-slot": "vk-grid-header", "data-group-key": groupKey, role: "row", "aria-rowindex": ariaRowIndex, "aria-level": ariaLevel, className: cx("group/gridhead grid grid-cols-(--vk-cols)", GRID_ONE_LINE, GRID_CONTENT_PAD), style: { minWidth }, children: cells }));
|
|
58
59
|
}
|
|
@@ -7,7 +7,7 @@ import { ConversionLine } from "../../display/converted.js";
|
|
|
7
7
|
import { useKeepInside } from "../../editors/keep-inside.js";
|
|
8
8
|
import { cx } from "../../internal/cx.js";
|
|
9
9
|
import { useViews } from "../../provider/context.js";
|
|
10
|
-
import { GRID_EDITOR_LAYER } from "./grid-editor-layer.js";
|
|
10
|
+
import { BODY_FIGURE_ROOM_PX, GRID_EDITOR_LAYER } from "./grid-editor-layer.js";
|
|
11
11
|
import { GridFittedBox } from "./grid-fitted-box.js";
|
|
12
12
|
import { GridRefusal, UNDER_CELL_CLASS, useGridEditSession } from "./grid-edit-session.js";
|
|
13
13
|
export function GridNumberEditor({ title, initial, seed, unit, unitOptions, code, decimals = 2, durationUnit, allowEmpty = false, unitLeft = false, conversion, onCommit, onCancel, onTab, onEnter, refuse, type, bounds, }) {
|
|
@@ -33,7 +33,7 @@ export function GridNumberEditor({ title, initial, seed, unit, unitOptions, code
|
|
|
33
33
|
form: surface === "sheet" ? "phone" : "computer",
|
|
34
34
|
}
|
|
35
35
|
: {}), onRequestClose: close }));
|
|
36
|
-
return (_jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, inPlace: true, sheetOnPhone: true, children: (surface) => body ? (surface === "sheet" ? (_jsxs("div", { className: "px-2 pb-3", children: [editor(surface), conversion ? _jsx(ConversionLine, { figure: conversion, className: "pt-1.5" }) : null] })) : (_jsxs("span", {
|
|
36
|
+
return (_jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, inPlace: true, sheetOnPhone: true, children: (surface) => body ? (surface === "sheet" ? (_jsxs("div", { className: "px-2 pb-3", children: [editor(surface), conversion ? _jsx(ConversionLine, { figure: conversion, className: "pt-1.5" }) : null] })) : (_jsxs("span", { "data-slot": "vk-grid-editor", "data-grown": "", className: cx(GRID_EDITOR_LAYER, unitLeft && "justify-end"), children: [_jsx(GridFittedBox, { boxRef: anchorRef, edge: false, room: BODY_FIGURE_ROOM_PX, children: editor(surface) }), _jsx(GridRefusal, { reason: session.refusal }), conversion && !session.refusal ? _jsx(UnderCellConversion, { figure: conversion }) : null] }))) : surface === "sheet" ? (_jsxs("div", { className: "px-2 pb-3", children: [_jsx("div", { className: "flex h-10 min-w-0 items-center rounded-md border border-(color:--vk-border) px-2", children: editor(surface) }), conversion ? _jsx(ConversionLine, { figure: conversion, className: "pt-1.5" }) : null] })) : (_jsxs("span", { "data-slot": "vk-grid-editor", className: cx("relative flex h-full w-full min-w-0", unitLeft && "justify-end"), children: [_jsx(GridFittedBox, { boxRef: anchorRef, children: editor(surface) }), _jsx(GridRefusal, { reason: session.refusal }), conversion && !session.refusal ? _jsx(UnderCellConversion, { figure: conversion }) : null] })) }));
|
|
37
37
|
}
|
|
38
38
|
function UnderCellConversion({ figure }) {
|
|
39
39
|
const ref = useRef(null);
|
|
@@ -21,6 +21,7 @@ import { GridRowGlyph } from "./GridRowGlyph.js";
|
|
|
21
21
|
import { GridNameCheck } from "./checks.js";
|
|
22
22
|
import { SelectCheckbox } from "../../selection/SelectCheckbox.js";
|
|
23
23
|
import { requestedSettlementTitle } from "viewkitjs/fields";
|
|
24
|
+
import { timeShown } from "../../display/format.js";
|
|
24
25
|
function FillDot({ enabled }) {
|
|
25
26
|
return (_jsx("span", { "data-fill-dot": enabled ? "" : undefined, className: cx("absolute bottom-[-7px] right-[-7px] z-10 hidden h-3 w-3 rounded-full border-(length:--vk-thick-line,2px) border-(color:--vk-ground) bg-(color:--vk-brand)", "[@media(hover:hover)_and_(pointer:fine)]:block", enabled ? "cursor-crosshair" : "pointer-events-none") }));
|
|
26
27
|
}
|
|
@@ -48,7 +49,7 @@ export function GridRowCells({ props }) {
|
|
|
48
49
|
: null;
|
|
49
50
|
const fieldKey = fieldKeyOf(col);
|
|
50
51
|
const numberFormat = numberFormats?.[fieldKey];
|
|
51
|
-
const showTime =
|
|
52
|
+
const showTime = timeShown(col.format?.withTime, showTimeOverrides?.[fieldKey]);
|
|
52
53
|
const onResolve = editingEnabled &&
|
|
53
54
|
columnEffectiveWritable(col, listConfig) &&
|
|
54
55
|
gridBooleanMode(col) === "marker"
|
|
@@ -7,7 +7,7 @@ import { TextEditor, } from "../../editors/TextEditor.js";
|
|
|
7
7
|
import { cx } from "../../internal/cx.js";
|
|
8
8
|
import { useViews } from "../../provider/context.js";
|
|
9
9
|
import { GridRefusal, useGridEditSession } from "./grid-edit-session.js";
|
|
10
|
-
import { GRID_EDITOR_LAYER } from "./grid-editor-layer.js";
|
|
10
|
+
import { BODY_FIGURE_ROOM_PX, GRID_EDITOR_LAYER } from "./grid-editor-layer.js";
|
|
11
11
|
import { GridFittedBox } from "./grid-fitted-box.js";
|
|
12
12
|
const TEXT_TYPES = new Set([
|
|
13
13
|
"text",
|
|
@@ -46,6 +46,6 @@ export function GridTextEditor({ initial, seed, type = "text", paragraph = false
|
|
|
46
46
|
: {}), boxData: { "data-slot": "vk-grid-editor", "data-grid-editor": "" }, onRequestClose: close, className: surface === "sheet"
|
|
47
47
|
? "w-full min-w-0 select-text"
|
|
48
48
|
: cx("h-full w-full min-w-0 select-text bg-transparent text-(length:--vk-text) text-(color:--vk-fg) outline-hidden placeholder:text-(color:--vk-fg-subtlest)", strong && "font-medium") }));
|
|
49
|
-
return surface === "sheet" ? (open ? (_jsxs("div", { className: "flex items-center gap-2 px-4 pb-4", onInput: (e) => setStored(e.target.value === initial), children: [_jsx("div", { className: "min-w-0 flex-1", children: editor }), stored && _jsx(OpenValueAction, { type: open.type, value: open.value, label: initial })] })) : (_jsx("div", { className: "px-4 pb-4", children: editor }))) : TextBody ? (_jsxs("span", { "data-grown": "", className: GRID_EDITOR_LAYER, children: [editor, _jsx(GridRefusal, { reason: session.refusal })] })) : (_jsxs("span", { className: "relative flex h-full w-full min-w-0", children: [_jsx(GridFittedBox, { boxRef: boxRef, children: editor }), _jsx(GridRefusal, { reason: session.refusal })] }));
|
|
49
|
+
return surface === "sheet" ? (open ? (_jsxs("div", { className: "flex items-center gap-2 px-4 pb-4", onInput: (e) => setStored(e.target.value === initial), children: [_jsx("div", { className: "min-w-0 flex-1", children: editor }), stored && _jsx(OpenValueAction, { type: open.type, value: open.value, label: initial })] })) : (_jsx("div", { className: "px-4 pb-4", children: editor }))) : TextBody ? (_jsxs("span", { "data-grown": "", className: GRID_EDITOR_LAYER, children: [_jsx(GridFittedBox, { boxRef: boxRef, edge: false, room: BODY_FIGURE_ROOM_PX, children: editor }), _jsx(GridRefusal, { reason: session.refusal })] })) : (_jsxs("span", { className: "relative flex h-full w-full min-w-0", children: [_jsx(GridFittedBox, { boxRef: boxRef, children: editor }), _jsx(GridRefusal, { reason: session.refusal })] }));
|
|
50
50
|
} }));
|
|
51
51
|
}
|
|
@@ -140,7 +140,7 @@ export function gridColumnMenuItems(column, props, gates, deps) {
|
|
|
140
140
|
if (gates.canDate) {
|
|
141
141
|
const active = props.dateStyle ?? column.format?.dateStyle ?? "short";
|
|
142
142
|
const word = (style) => messages({ key: "views.menus.date-style", values: { style } });
|
|
143
|
-
const sample = sampleDate();
|
|
143
|
+
const sample = sampleDate(cellFormat.viewer.now);
|
|
144
144
|
knobs.push({
|
|
145
145
|
key: "date-format",
|
|
146
146
|
label: messages({ key: "views.menus.format" }),
|
|
@@ -150,7 +150,9 @@ export function gridColumnMenuItems(column, props, gates, deps) {
|
|
|
150
150
|
children: DATE_STYLES.map((style) => ({
|
|
151
151
|
key: `date-format:${style}`,
|
|
152
152
|
label: word(style),
|
|
153
|
-
detail:
|
|
153
|
+
detail: sample
|
|
154
|
+
? formatDate(sample, column, style, false, cellFormat.viewer, cellFormat.presentation)
|
|
155
|
+
: undefined,
|
|
154
156
|
checked: active === style,
|
|
155
157
|
onSelect: then(() => props.onDateStyleChange(key, style)),
|
|
156
158
|
})),
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* The layer an app's text or number body (`TextBody`, `NumberBody`) stands in while its cell edits on a computer:
|
|
3
3
|
* absolute on the cell, 1px past each edge so the body covers the cell's lines, above the cell's outline (layer 1).
|
|
4
4
|
* The cell keeps its padding. `data-grown` on the layer still lifts the cell over the rows below and the frozen columns
|
|
5
|
-
* (`gridCellClassName`).
|
|
5
|
+
* (`gridCellClassName`). The body stands in a fitted box inside it (`GridFittedBox`, no frame of its own), which grows past
|
|
6
|
+
* the cell, leftward in a right-aligned column, when its unit or country leaves the value too little room.
|
|
6
7
|
*/
|
|
7
8
|
export declare const GRID_EDITOR_LAYER = "absolute -inset-px z-2 flex min-w-0";
|
|
9
|
+
/** The least room a body's value keeps beside its unit's button or a phone's country, empty or not: a few digits and
|
|
10
|
+
* the caret. */
|
|
11
|
+
export declare const BODY_FIGURE_ROOM_PX = 48;
|
|
@@ -8,8 +8,14 @@ import { type ReactNode, type RefObject } from "react";
|
|
|
8
8
|
* again at every keystroke: the input says by how much its text overflows it, and the box takes that
|
|
9
9
|
* much more. Grown, it draws the editing cell's frame around itself, over the cell's own, so the editor
|
|
10
10
|
* reads as one box, and the cell rises over the frozen columns (`data-grown`, `gridCellClassName`).
|
|
11
|
+
* An app's body (`edge={false}`) draws its own edge, which grows with the box, so the box draws none; its value shares the
|
|
12
|
+
* box with a unit or a country, so it keeps `room` to type in even when empty.
|
|
11
13
|
*/
|
|
12
|
-
export declare function GridFittedBox({ boxRef, children, }: {
|
|
14
|
+
export declare function GridFittedBox({ boxRef, edge, room, children, }: {
|
|
13
15
|
boxRef: RefObject<HTMLSpanElement | null>;
|
|
16
|
+
/** The editing cell's frame round the grown box: false where what it holds draws its own edge. */
|
|
17
|
+
edge?: boolean;
|
|
18
|
+
/** The pixels the input keeps at least, its value or not: a box that shares the cell with a unit's button. */
|
|
19
|
+
room?: number;
|
|
14
20
|
children: ReactNode;
|
|
15
21
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,14 +4,14 @@ import { useCallback, useLayoutEffect } from "react";
|
|
|
4
4
|
import { cx } from "../../internal/cx.js";
|
|
5
5
|
import { GRID_EDITING_SHADOW, GRID_GROUND } from "./grid-styles.js";
|
|
6
6
|
const FITTED_MAX_PX = 320;
|
|
7
|
-
export function GridFittedBox({ boxRef, children, }) {
|
|
7
|
+
export function GridFittedBox({ boxRef, edge = true, room = 0, children, }) {
|
|
8
8
|
const fit = useCallback(() => {
|
|
9
9
|
const box = boxRef.current;
|
|
10
10
|
const input = box?.querySelector("input");
|
|
11
11
|
if (!box || !input)
|
|
12
12
|
return;
|
|
13
13
|
box.style.minWidth = "";
|
|
14
|
-
const over = input.scrollWidth - input.clientWidth;
|
|
14
|
+
const over = Math.max(input.scrollWidth, room) - input.clientWidth;
|
|
15
15
|
const width = over > 0 ? Math.min(box.offsetWidth + over + 1, FITTED_MAX_PX) : 0;
|
|
16
16
|
if (width > box.offsetWidth) {
|
|
17
17
|
box.style.minWidth = `${width}px`;
|
|
@@ -20,7 +20,7 @@ export function GridFittedBox({ boxRef, children, }) {
|
|
|
20
20
|
else {
|
|
21
21
|
delete box.dataset.grown;
|
|
22
22
|
}
|
|
23
|
-
}, [boxRef]);
|
|
23
|
+
}, [boxRef, room]);
|
|
24
24
|
useLayoutEffect(fit, [fit]);
|
|
25
|
-
return (_jsxs("span", { ref: boxRef, onInput: fit, className: "group/fitted relative flex h-full w-full min-w-0 shrink-0 data-grown:z-2", children: [_jsx("span", { "aria-hidden": true, className: cx("pointer-events-none absolute inset-y-0 -inset-x-(--vk-px) -z-1 hidden rounded-sm border border-(color:--vk-border-brand) group-data-grown/fitted:block", GRID_EDITING_SHADOW, GRID_GROUND) }), children] }));
|
|
25
|
+
return (_jsxs("span", { ref: boxRef, onInput: fit, className: "group/fitted relative flex h-full w-full min-w-0 shrink-0 data-grown:z-2", children: [edge && (_jsx("span", { "aria-hidden": true, className: cx("pointer-events-none absolute inset-y-0 -inset-x-(--vk-px) -z-1 hidden rounded-sm border border-(color:--vk-border-brand) group-data-grown/fitted:block", GRID_EDITING_SHADOW, GRID_GROUND) })), children] }));
|
|
26
26
|
}
|
|
@@ -3,11 +3,11 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import { columnLabel } from "../../model/column-capabilities.js";
|
|
4
4
|
import { DEFAULT_DISPLAY_CURRENCY } from "../../fields/currency.js";
|
|
5
5
|
import { CellSuffix } from "../../display/format.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useUndatedCellFormat } from "../../cells/use-cell-format.js";
|
|
7
7
|
import { gridFigureValue } from "./grid-figure-value.js";
|
|
8
8
|
const words = (label) => typeof label === "string" || typeof label === "number" ? String(label) : undefined;
|
|
9
9
|
export function useGridBandFigures(figures, { columns, numberFormats, defaultCurrency = DEFAULT_DISPLAY_CURRENCY, renderAggregate, }) {
|
|
10
|
-
const cellFormat =
|
|
10
|
+
const cellFormat = useUndatedCellFormat();
|
|
11
11
|
const drawn = [];
|
|
12
12
|
for (const figure of figures ?? []) {
|
|
13
13
|
if ("render" in figure) {
|