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
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type MenuEntry } from "../menu-list/menu-list.js";
|
|
3
|
+
import { type PickerItem } from "../picker/picker.js";
|
|
4
|
+
import { type ListView, type ViewsListChange, type ViewsListLayout } from "./rules.js";
|
|
5
|
+
import { LOCK, useViewsListWorn } from "./views-list.js";
|
|
6
|
+
import { type ViewMenuWords } from "./words.js";
|
|
7
|
+
/** The delete question as the menu asks it of its holder (an app's `confirm` port takes the same shape: the map checks it). */
|
|
8
|
+
export type ViewMenuAsk = {
|
|
9
|
+
message: string;
|
|
10
|
+
confirmLabel: string;
|
|
11
|
+
subject?: string;
|
|
12
|
+
detail?: string;
|
|
13
|
+
destructive?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** What a page shows standing open: Rename, New view, or the delete question. */
|
|
16
|
+
export type ViewMenuShows = {
|
|
17
|
+
what: "rename";
|
|
18
|
+
id: string;
|
|
19
|
+
} | {
|
|
20
|
+
what: "new";
|
|
21
|
+
layout?: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
from?: string;
|
|
24
|
+
} | {
|
|
25
|
+
what: "delete";
|
|
26
|
+
id: string;
|
|
27
|
+
};
|
|
28
|
+
export interface ViewMenuProps {
|
|
29
|
+
views: ListView[];
|
|
30
|
+
open: string;
|
|
31
|
+
layouts: ViewsListLayout[];
|
|
32
|
+
/** The fields a board's columns can follow, and the one filled in. */
|
|
33
|
+
columns?: {
|
|
34
|
+
fields: PickerItem[];
|
|
35
|
+
value: string;
|
|
36
|
+
};
|
|
37
|
+
/** What the list holds, in the delete question's line ("deals"). */
|
|
38
|
+
records: string;
|
|
39
|
+
onChange: (change: ViewsListChange) => void;
|
|
40
|
+
/** A change opened a view, ended in the Toast, or asked for Customize (Edit view…): what holds the list closes it. */
|
|
41
|
+
onDone?: () => void;
|
|
42
|
+
/** Which form; by default the phone's in a phone's window or in a PhoneHost screen, else the computer's. */
|
|
43
|
+
form?: "computer" | "phone";
|
|
44
|
+
/** For a page that shows one standing: a Modal or the question standing open, where, and standing. */
|
|
45
|
+
shows?: ViewMenuShows;
|
|
46
|
+
container?: HTMLElement | null;
|
|
47
|
+
standing?: boolean;
|
|
48
|
+
/** Its words, over the English. */
|
|
49
|
+
words?: Partial<ViewMenuWords>;
|
|
50
|
+
/** On a computer, asks the delete question here (an app's `confirm` port) in place of drawing its own alert dialog. */
|
|
51
|
+
ask?: (request: ViewMenuAsk) => Promise<boolean>;
|
|
52
|
+
/** Says a view was deleted here (an app's `toast` port's `success`) in place of `useToast()`. */
|
|
53
|
+
report?: (message: string, options: {
|
|
54
|
+
undo: () => void;
|
|
55
|
+
}) => void;
|
|
56
|
+
/** On a phone, its caller draws `step` in its one Sheet: the menu, Rename, New view and the delete question become steps. Left
|
|
57
|
+
* out, a phone's Rename, New view and delete question open as today (the kit's sheets), and `step` stays null.
|
|
58
|
+
* CONTROLS.ViewsListBody hands it. */
|
|
59
|
+
steps?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** On a phone, what stands in the list's one Sheet in place of the list: the view's menu, Rename, New view, or the delete
|
|
62
|
+
* question. Back goes one step back. */
|
|
63
|
+
export type ViewMenuStep = {
|
|
64
|
+
title: string;
|
|
65
|
+
body: React.ReactNode;
|
|
66
|
+
onBack: () => void;
|
|
67
|
+
};
|
|
68
|
+
export interface ViewMenuParts {
|
|
69
|
+
/** A view's menu, as the Picker's row hands it (`PickerItem.menu`) or a Menu opens it. */
|
|
70
|
+
entries: (id: string) => MenuEntry[];
|
|
71
|
+
/** New view's Modal, opened; Save as new view… opens it from a view, that view's layout picked. */
|
|
72
|
+
startNew: (from?: string) => void;
|
|
73
|
+
/** The Modals and the question: what the holder renders beside the list. */
|
|
74
|
+
dialogs: React.ReactNode;
|
|
75
|
+
/** One of them stands open. */
|
|
76
|
+
asking: boolean;
|
|
77
|
+
/** On a phone with `steps`: opens a view's menu as a step (a row's ⋯). */
|
|
78
|
+
openMenu: (id: string) => void;
|
|
79
|
+
/** On a phone with `steps`: the step standing, or null while the list stands. Always null on a computer and without `steps`. */
|
|
80
|
+
step: ViewMenuStep | null;
|
|
81
|
+
}
|
|
82
|
+
export { LOCK, useViewsListWorn };
|
|
83
|
+
/** A view's menu's state, its entries, and what it opens. */
|
|
84
|
+
export declare function useViewMenu(props: ViewMenuProps): ViewMenuParts;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Alert } from "../alert/alert.js";
|
|
4
|
+
import { AlertDialog } from "../alert-dialog/alert-dialog.js";
|
|
5
|
+
import { Button } from "../button/button.js";
|
|
6
|
+
import { Field } from "../field/field.js";
|
|
7
|
+
import { Input } from "../input/input.js";
|
|
8
|
+
import { asSelect, OnTop } from "../internal/editor-parts.js";
|
|
9
|
+
import { Icon } from "../internal/icons.js";
|
|
10
|
+
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
11
|
+
import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
|
|
12
|
+
import { MenuList, tilesOf, useMenuListOption, useMenuListRows } from "../menu-list/menu-list.js";
|
|
13
|
+
import { Modal } from "../modal/modal.js";
|
|
14
|
+
import { Picker } from "../picker/picker.js";
|
|
15
|
+
import { Radio, RadioGroup } from "../radio/radio.js";
|
|
16
|
+
import { Select } from "../select/select.js";
|
|
17
|
+
import { useInToast, useToast } from "../toast/toast.js";
|
|
18
|
+
import { canDelete, deleteLine } from "./rules.js";
|
|
19
|
+
import { LOCK, useViewsListWorn } from "./views-list.js";
|
|
20
|
+
import { VIEW_MENU_WORDS } from "./words.js";
|
|
21
|
+
export { LOCK, useViewsListWorn };
|
|
22
|
+
function ToastBridge({ onSend }) {
|
|
23
|
+
const toast = useToast();
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
onSend(toast);
|
|
26
|
+
return () => onSend(null);
|
|
27
|
+
}, [toast, onSend]);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
export function useViewMenu(props) {
|
|
31
|
+
const { views, open, layouts, columns, records, onChange, onDone, ask: askPort, report } = props;
|
|
32
|
+
const w = React.useMemo(() => ({ ...VIEW_MENU_WORDS, ...props.words }), [props.words]);
|
|
33
|
+
const screen = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (screen || small ? "phone" : "computer")) === "phone";
|
|
34
|
+
const stepping = phone && !!props.steps;
|
|
35
|
+
const [mark, setMark] = React.useState(null), worn = useViewsListWorn(mark);
|
|
36
|
+
const closeShown = useMenuListOption(mark, "close"), rowsAre = useMenuListRows(mark), closeRow = closeShown === "shown" && rowsAre !== "words";
|
|
37
|
+
const inToast = useInToast(), send = React.useRef(null);
|
|
38
|
+
const onSend = React.useCallback((s) => { send.current = s; }, []);
|
|
39
|
+
const now = React.useRef({ views, open });
|
|
40
|
+
React.useLayoutEffect(() => { now.current = { views, open }; });
|
|
41
|
+
const viewOf = (id) => views.find((v) => v.id === id);
|
|
42
|
+
const [asked, setAsked] = React.useState(props.shows ?? null), [shown, setShown] = React.useState(!!props.shows);
|
|
43
|
+
const ask = (a) => { setAsked(a); setShown(true); };
|
|
44
|
+
const close = () => setShown(false);
|
|
45
|
+
const toList = () => { setAsked(null); setShown(false); };
|
|
46
|
+
const [name, setName] = React.useState(() => (props.shows?.what === "rename" ? viewOf(props.shows.id)?.name ?? "" : props.shows?.what === "new" ? props.shows.name ?? "" : ""));
|
|
47
|
+
const [layout, setLayout] = React.useState(() => (props.shows?.what === "new" ? props.shows.layout ?? layouts[0]?.id : layouts[0]?.id) ?? "");
|
|
48
|
+
const [column, setColumn] = React.useState(columns?.value ?? "");
|
|
49
|
+
const [picking, setPicking] = React.useState(null);
|
|
50
|
+
const [making, setMaking] = React.useState(null);
|
|
51
|
+
const rename = (id) => { setName(viewOf(id)?.name ?? ""); ask({ what: "rename", id }); };
|
|
52
|
+
const startNew = (from) => {
|
|
53
|
+
setName("");
|
|
54
|
+
setLayout((from && viewOf(from)?.layout) || layouts[0]?.id || "");
|
|
55
|
+
setColumn(columns?.value ?? "");
|
|
56
|
+
setMaking({ from });
|
|
57
|
+
ask({ what: "new", from });
|
|
58
|
+
};
|
|
59
|
+
const box = React.useRef(null);
|
|
60
|
+
const naming = shown && !props.standing && (asked?.what === "rename" || asked?.what === "new") ? asked.what : null;
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
if (!naming)
|
|
63
|
+
return;
|
|
64
|
+
const frame = requestAnimationFrame(() => { const el = box.current; if (el) {
|
|
65
|
+
el.focus({ preventScroll: true });
|
|
66
|
+
if (naming === "rename")
|
|
67
|
+
el.select();
|
|
68
|
+
} });
|
|
69
|
+
return () => cancelAnimationFrame(frame);
|
|
70
|
+
}, [naming]);
|
|
71
|
+
const saveName = () => {
|
|
72
|
+
if (asked?.what !== "rename")
|
|
73
|
+
return;
|
|
74
|
+
const typed = name.trim(), was = viewOf(asked.id)?.name;
|
|
75
|
+
if (typed && typed !== was)
|
|
76
|
+
onChange({ kind: "rename", id: asked.id, name: typed });
|
|
77
|
+
};
|
|
78
|
+
const chosen = layouts.find((l) => l.id === layout);
|
|
79
|
+
const create = () => {
|
|
80
|
+
if (asked?.what !== "new" || !name.trim())
|
|
81
|
+
return;
|
|
82
|
+
onChange({ kind: "create", layout, name: name.trim(), ...(chosen?.columns && column ? { columns: column } : {}), ...(asked.from ? { from: asked.from } : {}) });
|
|
83
|
+
onDone?.();
|
|
84
|
+
};
|
|
85
|
+
const enter = (run) => (e) => {
|
|
86
|
+
if (e.key !== "Enter" || !name.trim())
|
|
87
|
+
return;
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
run();
|
|
90
|
+
if (stepping)
|
|
91
|
+
toList();
|
|
92
|
+
else
|
|
93
|
+
close();
|
|
94
|
+
};
|
|
95
|
+
const say = (message, undo) => {
|
|
96
|
+
if (report)
|
|
97
|
+
report(message, { undo });
|
|
98
|
+
else
|
|
99
|
+
send.current?.({ words: message, undo });
|
|
100
|
+
};
|
|
101
|
+
const remove = (id) => {
|
|
102
|
+
const at = now.current.views.findIndex((v) => v.id === id), view = now.current.views[at];
|
|
103
|
+
if (!view)
|
|
104
|
+
return;
|
|
105
|
+
const wasOpen = now.current.open === id;
|
|
106
|
+
onChange({ kind: "delete", id });
|
|
107
|
+
onDone?.();
|
|
108
|
+
say(w.deleted(view.name), () => onChange({ kind: "restore", view, at, open: wasOpen }));
|
|
109
|
+
};
|
|
110
|
+
const lineOf = (v) => deleteLine(worn.privateViews ? v : { ...v, private: false }, records, { stay: w.stay, goes: w.goes });
|
|
111
|
+
const askDelete = (id) => {
|
|
112
|
+
const v = viewOf(id);
|
|
113
|
+
if (!stepping && askPort && v) {
|
|
114
|
+
void Promise.resolve(askPort({ message: w.deleteTitle(v.name), detail: lineOf(v), confirmLabel: w.delete, subject: v.name, destructive: true }))
|
|
115
|
+
.then((yes) => { if (yes)
|
|
116
|
+
remove(id); }, () => { });
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
ask({ what: "delete", id });
|
|
120
|
+
};
|
|
121
|
+
const entries = (id) => {
|
|
122
|
+
const v = viewOf(id);
|
|
123
|
+
if (!v)
|
|
124
|
+
return [];
|
|
125
|
+
const icon = (n) => _jsx(Icon, { name: n });
|
|
126
|
+
const changed = v.changed ? [
|
|
127
|
+
{ icon: icon("check"), label: w.saveEveryone, onSelect: () => onChange({ kind: "save", id }) },
|
|
128
|
+
{ icon: icon("undo"), label: w.reset, onSelect: () => onChange({ kind: "reset", id }) },
|
|
129
|
+
{ icon: icon("plus"), label: w.saveNew, onSelect: () => startNew(id) },
|
|
130
|
+
] : [];
|
|
131
|
+
const favorite = worn.favorites ? [{ icon: icon(v.favorite ? "star-filled" : "star"), label: v.favorite ? w.unfavorite : w.favorite, onSelect: () => onChange({ kind: "favorite", id, on: !v.favorite }) }] : [];
|
|
132
|
+
const privately = worn.privateViews ? [{ kind: "check", label: w.privateView, ...(phone ? { icon: LOCK } : {}), checked: !!v.private, onCheckedChange: (on) => onChange({ kind: "private", id, on }) }] : [];
|
|
133
|
+
const edit = { icon: icon("settings"), label: w.edit, onSelect: () => { onChange({ kind: "edit", id }); onDone?.(); } };
|
|
134
|
+
const link = { icon: icon("link"), label: phone ? w.copyLinkShort : w.copyLink, onSelect: () => onChange({ kind: "link", id }) };
|
|
135
|
+
const duplicate = { icon: icon("copy"), label: phone ? w.duplicateShort : w.duplicate, onSelect: () => { onChange({ kind: "duplicate", id }); onDone?.(); } };
|
|
136
|
+
const del = { icon: icon("trash"), label: w.delete, danger: true, ...(canDelete(views) ? {} : { disabled: w.keepOne }), onSelect: () => askDelete(id) };
|
|
137
|
+
if (phone)
|
|
138
|
+
return [
|
|
139
|
+
link, ...favorite, { icon: icon("rename"), label: w.renameShort, onSelect: () => rename(id) }, duplicate,
|
|
140
|
+
...(changed.length ? [{ kind: "group", heading: w.unsaved, entries: changed }] : []),
|
|
141
|
+
{ kind: "group", heading: w.thisView, entries: [...privately, edit] },
|
|
142
|
+
{ kind: "separator" }, del,
|
|
143
|
+
];
|
|
144
|
+
return [
|
|
145
|
+
{ icon: icon("rename"), label: w.rename, onSelect: () => rename(id) }, edit, ...privately,
|
|
146
|
+
{ kind: "separator" }, ...(changed.length ? [...changed, { kind: "separator" }] : []),
|
|
147
|
+
link, ...favorite,
|
|
148
|
+
{ kind: "separator" }, duplicate, del,
|
|
149
|
+
];
|
|
150
|
+
};
|
|
151
|
+
const where = props.container ?? undefined, standing = props.standing;
|
|
152
|
+
const target = asked && (asked.what === "rename" || asked.what === "delete" || asked.what === "menu") ? viewOf(asked.id) : undefined;
|
|
153
|
+
const asking = shown;
|
|
154
|
+
const nameField = (run) => (_jsx(Field, { label: w.name, children: _jsx(Input, { ref: box, value: name, onValueChange: (v) => setName(v), onKeyDown: enter(run), autoComplete: "off" }) }));
|
|
155
|
+
const columnsField = chosen?.columns && columns && (phone
|
|
156
|
+
? _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: w.columns(chosen.name), entries: [{ kind: "choices", icon: null, label: w.columns(chosen.name), value: column, choices: columns.fields.map((f) => ({ value: f.value, label: f.label })) }], onOpen: () => (stepping ? ask({ what: "columns" }) : setPicking({ open: true })) }) })
|
|
157
|
+
: _jsx(Field, { label: w.columns(chosen.name), nativeLabel: false, children: _jsx(Select, { "aria-label": w.columns(chosen.name), items: asSelect(columns.fields), value: column, onValueChange: (v) => { if (typeof v === "string")
|
|
158
|
+
setColumn(v); } }) }));
|
|
159
|
+
const newForm = (_jsxs("div", { className: "o-views-list-form", children: [_jsx(RadioGroup, { row: true, label: w.layout, value: layout, onValueChange: (v) => { if (typeof v === "string")
|
|
160
|
+
setLayout(v); }, children: layouts.map((l) => _jsx(Radio, { value: l.id, mark: l.mark, label: l.name, note: l.line }, l.id)) }), nameField(create), columnsField] }));
|
|
161
|
+
const modalWords = { close: w.close };
|
|
162
|
+
const stepOf = () => {
|
|
163
|
+
if (!stepping || !asked || !shown)
|
|
164
|
+
return null;
|
|
165
|
+
const done = (run, disabled, label) => (_jsx("div", { className: "o-views-list-step-foot", children: _jsx(Button, { kind: "primary", className: "o-views-list-step-act", disabled: disabled, onClick: () => { run(); toList(); }, children: label }) }));
|
|
166
|
+
if (asked.what === "menu" && target) {
|
|
167
|
+
const leaving = (list) => list.map((e) => e.kind === undefined || e.kind === "action" ? { ...e, onSelect: () => { toList(); e.onSelect?.(); } } : e.kind === "group" ? { ...e, entries: leaving(e.entries) } : e);
|
|
168
|
+
return { title: target.name, onBack: toList, body: _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: target.name, ...tilesOf(leaving(entries(target.id))), ...(closeRow ? { onClose: toList } : {}), closeWord: w.close }) }) };
|
|
169
|
+
}
|
|
170
|
+
if (asked.what === "rename" && target)
|
|
171
|
+
return { title: w.renameTitle, onBack: () => ask({ what: "menu", id: target.id }), body: _jsxs(_Fragment, { children: [_jsx("div", { className: "o-views-list-form", children: nameField(saveName) }), done(saveName, !name.trim(), w.save)] }) };
|
|
172
|
+
if (asked.what === "new")
|
|
173
|
+
return { title: w.newView, onBack: making?.from ? () => ask({ what: "menu", id: making.from }) : toList, body: _jsxs(_Fragment, { children: [newForm, done(create, !name.trim(), w.createView)] }) };
|
|
174
|
+
if (asked.what === "columns" && chosen && columns)
|
|
175
|
+
return {
|
|
176
|
+
title: w.columns(chosen.name), onBack: () => ask({ what: "new", ...(making?.from ? { from: making.from } : {}) }),
|
|
177
|
+
body: _jsx(Picker, { label: w.columns(chosen.name), items: columns.fields, value: column, onValueChange: (v) => { if (typeof v === "string")
|
|
178
|
+
setColumn(v); ask({ what: "new", ...(making?.from ? { from: making.from } : {}) }); } }),
|
|
179
|
+
};
|
|
180
|
+
if (asked.what === "delete" && target)
|
|
181
|
+
return {
|
|
182
|
+
title: "", onBack: () => ask({ what: "menu", id: target.id }),
|
|
183
|
+
body: _jsx(Alert, { title: w.deleteTitle(target.name), line: lineOf(target), action: w.delete, kind: "danger", cancel: w.cancel, phone: true, shell: "sheet", words: { tryAgain: w.tryAgain }, onAnswer: (yes) => { if (yes) {
|
|
184
|
+
toList();
|
|
185
|
+
remove(target.id);
|
|
186
|
+
}
|
|
187
|
+
else
|
|
188
|
+
ask({ what: "menu", id: target.id }); } }),
|
|
189
|
+
};
|
|
190
|
+
return null;
|
|
191
|
+
};
|
|
192
|
+
const bridge = !report && inToast ? _jsx(ToastBridge, { onSend: onSend }) : null;
|
|
193
|
+
const dialogs = stepping ? (_jsxs(_Fragment, { children: [_jsx("span", { ref: setMark, hidden: true }), bridge] })) : (_jsxs(_Fragment, { children: [_jsx("span", { ref: setMark, hidden: true }), bridge, asked?.what === "rename" && (_jsx(Modal, { open: shown, onOpenChange: (o) => { if (!o)
|
|
194
|
+
close(); }, title: w.renameTitle, size: "sm", action: { label: w.save, disabled: !name.trim(), run: saveName }, cancel: w.cancel, words: modalWords, container: where, standing: standing, children: nameField(saveName) })), asked?.what === "new" && (_jsxs(Modal, { open: shown, onOpenChange: (o) => { if (!o)
|
|
195
|
+
close(); }, title: w.newView, size: "md", action: { label: w.createView, disabled: !name.trim(), run: create }, cancel: w.cancel, words: modalWords, container: where, standing: standing, children: [newForm, phone && picking && chosen && columns && (_jsx(OnTop, { open: picking.open, onOpenChange: (o) => setPicking(o ? { open: true } : { open: false }), onGone: () => setPicking(null), title: w.columns(chosen.name), container: where ?? screen, standing: !!standing, picker: { label: w.columns(chosen.name), items: columns.fields, value: column, onValueChange: (v) => { if (typeof v === "string")
|
|
196
|
+
setColumn(v); } } }))] })), asked?.what === "delete" && target && (_jsx(AlertDialog, { open: shown, onAnswer: (yes) => { close(); if (yes)
|
|
197
|
+
remove(target.id); }, title: w.deleteTitle(target.name), line: lineOf(target), action: w.delete, kind: "danger", cancel: w.cancel, words: { close: w.close, failed: w.failed, tryAgain: w.tryAgain }, container: where, standing: standing }))] }));
|
|
198
|
+
const openMenu = (id) => { if (stepping)
|
|
199
|
+
ask({ what: "menu", id }); };
|
|
200
|
+
return { entries, startNew, dialogs, asking, openMenu, step: stepOf() };
|
|
201
|
+
}
|
|
@@ -2,6 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import type { MenuEntry } from "../menu-list/menu-list.js";
|
|
3
3
|
import { type PickerParts } from "../picker/picker.js";
|
|
4
4
|
import { type ListView, type ViewsListChange, type ViewsListLayout } from "./rules.js";
|
|
5
|
+
import type { ViewMenuStep } from "./view-menu.js";
|
|
5
6
|
import { type ViewsListWords } from "./words.js";
|
|
6
7
|
/** Held back from the controls door until VK-727: `viewkitjs/views/react`'s atom already has the name. */
|
|
7
8
|
export interface ViewsListProps {
|
|
@@ -22,6 +23,12 @@ export interface ViewsListProps {
|
|
|
22
23
|
entries?: (id: string) => MenuEntry[];
|
|
23
24
|
/** New view, the list's action; left out, no action. */
|
|
24
25
|
onNew?: () => void;
|
|
26
|
+
/** On a phone, a view's ⋯ hands its id here and opens no menu sheet of its own: the holder turns the list into the view's menu
|
|
27
|
+
* (`step`). On a computer it changes nothing. */
|
|
28
|
+
onMenu?: (id: string) => void;
|
|
29
|
+
/** On a phone, what stands in the Sheet in place of the list (a view's menu, Rename, New view, the delete question): its body,
|
|
30
|
+
* and its title and Back in the Sheet's head. Null or left out, the list stands. */
|
|
31
|
+
step?: ViewMenuStep | null;
|
|
25
32
|
/** Shared and Just me, a private view's lock; left out, the Private views option worn round it. */
|
|
26
33
|
privateViews?: boolean;
|
|
27
34
|
/** false: no row moves. */
|
|
@@ -30,7 +37,7 @@ export interface ViewsListProps {
|
|
|
30
37
|
}
|
|
31
38
|
export interface ViewsListParts {
|
|
32
39
|
body: React.ReactNode;
|
|
33
|
-
/** On a phone, the Sheet head's buttons, the Picker's; {} on a computer. */
|
|
40
|
+
/** On a phone, the Sheet head's buttons, the Picker's; {} on a computer. On a step, its Back and its title. */
|
|
34
41
|
head: PickerParts["head"];
|
|
35
42
|
}
|
|
36
43
|
/** A private view's lock, as the list draws it after its name. */
|
|
@@ -5,6 +5,8 @@ import { Icon } from "../internal/icons.js";
|
|
|
5
5
|
import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
6
6
|
import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
|
|
7
7
|
import { usePicker } from "../picker/picker.js";
|
|
8
|
+
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
9
|
+
import { openerAt, useStepReturn } from "../internal/step-return.js";
|
|
8
10
|
import { VIEWS_LIST_ATTRS, viewsListWornOf } from "./looks.js";
|
|
9
11
|
import { listed } from "./rules.js";
|
|
10
12
|
import { viewsListWords } from "./words.js";
|
|
@@ -28,6 +30,7 @@ export function useViewsList(props) {
|
|
|
28
30
|
const screen = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (screen || small ? "phone" : "computer")) === "phone";
|
|
29
31
|
const [root, setRoot] = React.useState(null), worn = useViewsListWorn(props.privateViews === undefined ? root : null);
|
|
30
32
|
const privateViews = props.privateViews ?? worn.privateViews;
|
|
33
|
+
const [opener, setOpener] = React.useState(null);
|
|
31
34
|
const markOf = (layout) => {
|
|
32
35
|
const mark = layouts.find((l) => l.id === layout)?.mark;
|
|
33
36
|
return mark == null ? {} : { as: { mark: _jsx("span", { className: "o-views-list-mark", children: mark }) } };
|
|
@@ -44,12 +47,24 @@ export function useViewsList(props) {
|
|
|
44
47
|
onChange({ kind: "open", id: v }); },
|
|
45
48
|
onDone,
|
|
46
49
|
...(props.reorder !== false ? { onOrderChange: (ids) => onChange({ kind: "order", ids }) } : {}),
|
|
47
|
-
...(props.onNew ? { actions: [{ id: "new", label: w.newView, icon: _jsx(Icon, { name: "plus" }), onSelect: props.onNew }] } : {}),
|
|
50
|
+
...(props.onNew ? { actions: [{ id: "new", label: w.newView, icon: _jsx(Icon, { name: "plus" }), onSelect: () => { setOpener(null); props.onNew(); } }] } : {}),
|
|
48
51
|
search: phone ? w.find : w.search, searchShown: true, heldInPlace: true, actionsUnder: true, fromHeld: true,
|
|
49
|
-
...(w.none ? { none: w.none } : {}), ...(w.picker ? { words: w.picker } : {}),
|
|
52
|
+
...(w.none ? { none: w.none } : {}), ...(w.picker ? { words: w.picker } : {}), ...(w.menu ? { menuWords: w.menu } : {}),
|
|
50
53
|
menuFrame: MENU_LIST_CARD_FRAME,
|
|
54
|
+
...(phone && props.onMenu ? { onRowMenu: (id) => { setOpener(views.find((v) => v.id === id)?.name ?? null); props.onMenu(id); } } : {}),
|
|
51
55
|
});
|
|
52
|
-
const
|
|
56
|
+
const step = phone ? props.step ?? null : null;
|
|
57
|
+
const rootRef = React.useRef(null);
|
|
58
|
+
const placeRoot = React.useCallback((el) => { rootRef.current = el; setRoot(el); }, [setRoot]);
|
|
59
|
+
useStepReturn(rootRef, step && opener ? [openerAt(() => `[role="option"][data-name="${CSS.escape(opener)}"] .o-picker-row-menu`)] : []);
|
|
60
|
+
if (step) {
|
|
61
|
+
const back = _jsx(SheetButton, { "aria-label": w.back, className: "o-sheet-back", icon: _jsx(Icon, { name: "left" }), onClick: step.onBack });
|
|
62
|
+
return {
|
|
63
|
+
body: _jsx("div", { ref: placeRoot, className: "o-views-list", "data-kit": "views-list", "data-views-form": "phone", "data-views-step": "", ...phoneMark(!!screen || small), children: step.body }),
|
|
64
|
+
head: { left: back, children: step.title, right: _jsx("span", {}) },
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-views-list", "data-kit": "views-list", "data-views-form": phone ? "phone" : "computer", ...phoneMark(!!screen || small), children: picker.body }));
|
|
53
68
|
return { body, head: picker.head };
|
|
54
69
|
}
|
|
55
70
|
export function ViewsList(props) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MenuWords } from "../menu/menu.js";
|
|
1
2
|
import type { PickerWords } from "../picker/picker.js";
|
|
2
3
|
export interface ViewsListWords {
|
|
3
4
|
/** What it lists: the list's name to a screen reader. */
|
|
@@ -16,7 +17,60 @@ export interface ViewsListWords {
|
|
|
16
17
|
none?: string;
|
|
17
18
|
/** The words of the list itself. */
|
|
18
19
|
picker?: Partial<PickerWords>;
|
|
20
|
+
/** A phone's step's way back to the list (a view's menu, Rename…); left out, "Back". */
|
|
21
|
+
back?: string;
|
|
22
|
+
/** A view's menu's own words (a sheet's ✕ and Back, the Close row, a level's search). */
|
|
23
|
+
menu?: MenuWords;
|
|
19
24
|
}
|
|
20
25
|
export declare const VIEWS_LIST_WORDS: ViewsListWords;
|
|
21
26
|
/** The words handed over the English. */
|
|
22
27
|
export declare const viewsListWords: (given?: Partial<ViewsListWords>) => ViewsListWords;
|
|
28
|
+
/** A view's menu's words (VK-823): its entries (a computer's, a phone's shorter tiles and its two headings), Rename's and New view's
|
|
29
|
+
* Modals, the delete question, the Toast's report, a copy's name, the delete question's line and a board's columns. English unless
|
|
30
|
+
* handed, the Outright kit's as drawn; CONTROLS.ViewsListBody hands them in the app's words, from its messages. */
|
|
31
|
+
export interface ViewMenuWords {
|
|
32
|
+
rename: string;
|
|
33
|
+
/** A phone's tile. */
|
|
34
|
+
renameShort: string;
|
|
35
|
+
edit: string;
|
|
36
|
+
privateView: string;
|
|
37
|
+
saveEveryone: string;
|
|
38
|
+
reset: string;
|
|
39
|
+
saveNew: string;
|
|
40
|
+
copyLink: string;
|
|
41
|
+
/** A phone's tile. */
|
|
42
|
+
copyLinkShort: string;
|
|
43
|
+
favorite: string;
|
|
44
|
+
unfavorite: string;
|
|
45
|
+
duplicate: string;
|
|
46
|
+
/** A phone's tile. */
|
|
47
|
+
duplicateShort: string;
|
|
48
|
+
delete: string;
|
|
49
|
+
/** Why Delete can't be pressed: the list's last view. */
|
|
50
|
+
keepOne: string;
|
|
51
|
+
/** A phone's heading over Save for everyone, Reset and Save as new view. */
|
|
52
|
+
unsaved: string;
|
|
53
|
+
/** A phone's heading over Private view and Edit view. */
|
|
54
|
+
thisView: string;
|
|
55
|
+
renameTitle: string;
|
|
56
|
+
save: string;
|
|
57
|
+
newView: string;
|
|
58
|
+
createView: string;
|
|
59
|
+
layout: string;
|
|
60
|
+
name: string;
|
|
61
|
+
/** Each Modal's way out, the delete question's too. */
|
|
62
|
+
cancel: string;
|
|
63
|
+
/** A Modal's and the alert dialog's X. */
|
|
64
|
+
close: string;
|
|
65
|
+
/** What a failure says when its work threw no words; its action, once it failed. */
|
|
66
|
+
failed: string;
|
|
67
|
+
tryAgain: string;
|
|
68
|
+
deleteTitle: (name: string) => string;
|
|
69
|
+
deleted: (name: string) => string;
|
|
70
|
+
copyOf: (name: string) => string;
|
|
71
|
+
stay: (records: string) => string;
|
|
72
|
+
goes: string;
|
|
73
|
+
columns: (layout: string) => string;
|
|
74
|
+
}
|
|
75
|
+
/** A view's menu's words in English. */
|
|
76
|
+
export declare const VIEW_MENU_WORDS: ViewMenuWords;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import { JUST_ME, SHARED } from "./rules.js";
|
|
2
|
-
export const VIEWS_LIST_WORDS = { label: "Views", search: "Search views", find: "Find a view", newView: "New view", shared: SHARED, justMe: JUST_ME };
|
|
2
|
+
export const VIEWS_LIST_WORDS = { label: "Views", search: "Search views", find: "Find a view", newView: "New view", shared: SHARED, justMe: JUST_ME, back: "Back" };
|
|
3
3
|
export const viewsListWords = (given) => (given ? { ...VIEWS_LIST_WORDS, ...given } : VIEWS_LIST_WORDS);
|
|
4
|
+
export const VIEW_MENU_WORDS = {
|
|
5
|
+
rename: "Rename…", renameShort: "Rename", edit: "Edit view…", privateView: "Private view", saveEveryone: "Save for everyone", reset: "Reset",
|
|
6
|
+
saveNew: "Save as new view…", copyLink: "Copy link to view", copyLinkShort: "Copy link", favorite: "Favorite", unfavorite: "Unfavorite",
|
|
7
|
+
duplicate: "Duplicate view", duplicateShort: "Duplicate", delete: "Delete view", keepOne: "A list keeps one view", unsaved: "Unsaved changes",
|
|
8
|
+
thisView: "This view", renameTitle: "Rename view", save: "Save", newView: "New view", createView: "Create view", layout: "Layout", name: "Name",
|
|
9
|
+
cancel: "Cancel", close: "Close", failed: "That didn't go through. Nothing changed.", tryAgain: "Try again",
|
|
10
|
+
deleteTitle: (name) => `Delete ${name}?`, deleted: (name) => `${name} was deleted`, copyOf: (name) => `Copy of ${name}`,
|
|
11
|
+
stay: (records) => `The ${records} in it stay as they are.`, goes: "The view goes for everyone who uses it.", columns: (layout) => `${layout} columns`,
|
|
12
|
+
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/* The views list (VK-723, from the Outright kit's KIT-678): only what is its own. Its list is the Picker, its menus the Menu, each as
|
|
2
|
-
it is. Here: a view's layout mark at a row's icon size (16 on a computer, 20 on a phone, the subtle text)
|
|
2
|
+
it is. Here: a view's layout mark at a row's icon size (16 on a computer, 20 on a phone, the subtle text); a view's menu's own (VK-823):
|
|
3
|
+
New view's and Rename's form, its fields one under another, 16 apart, and on a phone's step its action the step's width under them. */
|
|
3
4
|
@layer components {
|
|
4
5
|
.o-views-list { display: contents; }
|
|
5
6
|
.o-views-list-mark { display: inline-grid; place-items: center; color: var(--vk-fg-subtle); }
|
|
6
7
|
.o-views-list-mark > svg { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); }
|
|
7
8
|
.o-picker[data-picker-form="phone"] .o-views-list-mark > svg { width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); }
|
|
9
|
+
.o-views-list-form { display: grid; gap: calc(var(--vk-spacing) * 4); }
|
|
10
|
+
.o-views-list-step-foot { margin-top: calc(var(--vk-spacing) * 4); }
|
|
11
|
+
:where([data-vk-phone], [data-vk-phone] *).o-views-list-step-act { width: 100%; }
|
|
8
12
|
}
|
|
@@ -4,14 +4,14 @@ import { useState } from "react";
|
|
|
4
4
|
import { fromDayKey } from "viewkitjs/fields/query";
|
|
5
5
|
import { cx } from "../internal/cx.js";
|
|
6
6
|
import { useViews } from "../provider/context.js";
|
|
7
|
-
import { formatDateValue } from "./format.js";
|
|
7
|
+
import { formatDateValue, timeShown } from "./format.js";
|
|
8
8
|
import { cellTextClass } from "./text-class.js";
|
|
9
|
-
import {
|
|
9
|
+
import { useDateDisplayOptions } from "./use-display-options.js";
|
|
10
10
|
export function renderDate(field, value, opts) {
|
|
11
11
|
return _jsx(DateValue, { field: field, value: value, opts: opts });
|
|
12
12
|
}
|
|
13
13
|
function DateValue({ field, value, opts: given, }) {
|
|
14
|
-
const opts =
|
|
14
|
+
const opts = useDateDisplayOptions(given);
|
|
15
15
|
const { Tooltip } = useViews().components;
|
|
16
16
|
const [pointed, setPointed] = useState(false);
|
|
17
17
|
const [pressed, setPressed] = useState(false);
|
|
@@ -25,10 +25,10 @@ function DateValue({ field, value, opts: given, }) {
|
|
|
25
25
|
window.addEventListener("pointerup", release, true);
|
|
26
26
|
window.addEventListener("pointercancel", release, true);
|
|
27
27
|
};
|
|
28
|
-
const withTime =
|
|
28
|
+
const withTime = field.type === "datetime" ? timeShown(field.format?.withTime, opts.withTime) : false;
|
|
29
29
|
const cell = (_jsx("span", { className: cx(cellTextClass(opts.wrap), "tabular-nums text-(color:--vk-fg)"), onPointerMove: pointed
|
|
30
30
|
? undefined
|
|
31
|
-
: (event) => event.pointerType !== "touch" && event.buttons === 0 && setPointed(true),
|
|
31
|
+
: (event) => event.pointerType !== "touch" && event.buttons === 0 && setPointed(true), onPointerDownCapture: pointed || pressed ? undefined : (event) => event.pointerType !== "touch" && hold(), children: formatDateValue(value, opts.dateStyle ?? field.format?.dateStyle, withTime, field.type, opts) }));
|
|
32
32
|
const d = field.type === "date" && typeof value === "string"
|
|
33
33
|
? fromDayKey(value)
|
|
34
34
|
: value instanceof Date
|
|
@@ -28,6 +28,12 @@ export declare const DEFAULT_FIELD_PRESENTATION: FieldPresentation;
|
|
|
28
28
|
* the caller's answer, then the field's single declared code.
|
|
29
29
|
*/
|
|
30
30
|
export declare function formatNumberValue(value: number, format: NumberLikeFormat | undefined, opts?: NumberOverrides): string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether a date-and-time shows its time: the reader's choice, else what its field or column declares, else yes. A
|
|
33
|
+
* date-and-time is one because its time matters, and a time typed then not shown reads as lost. A calendar day has no
|
|
34
|
+
* time, whatever this says.
|
|
35
|
+
*/
|
|
36
|
+
export declare function timeShown(declared?: boolean, chosen?: boolean): boolean;
|
|
31
37
|
/**
|
|
32
38
|
* A date or an instant, in the style asked for.
|
|
33
39
|
*
|
|
@@ -52,6 +52,8 @@ function numberFormat(locale, options) {
|
|
|
52
52
|
return format;
|
|
53
53
|
}
|
|
54
54
|
function viewerToday(context) {
|
|
55
|
+
if (!context.now)
|
|
56
|
+
return null;
|
|
55
57
|
const parts = dateFormat("en-US", {
|
|
56
58
|
timeZone: context.timeZone ?? DEFAULT_CONVENTIONS.timeZone,
|
|
57
59
|
year: "numeric",
|
|
@@ -85,7 +87,7 @@ function absoluteDay({ year, month, day }, style, today, context, time) {
|
|
|
85
87
|
? `${pad2(day)}/${pad2(month)}/${year}`
|
|
86
88
|
: style === "long"
|
|
87
89
|
? `${day} ${name("long")} ${year}`
|
|
88
|
-
: `${pad2(day)} ${name("short")}${year === today
|
|
90
|
+
: `${pad2(day)} ${name("short")}${year === today?.year ? "" : ` ${year}`}`;
|
|
89
91
|
return time ? `${date}, ${time}` : date;
|
|
90
92
|
}
|
|
91
93
|
function instantParts(instant, timeZone) {
|
|
@@ -164,6 +166,9 @@ export function formatNumberValue(value, format, opts) {
|
|
|
164
166
|
return formatted;
|
|
165
167
|
return `${value >= 0 ? "+" : "−"} ${formatted}`;
|
|
166
168
|
}
|
|
169
|
+
export function timeShown(declared, chosen) {
|
|
170
|
+
return chosen ?? declared ?? true;
|
|
171
|
+
}
|
|
167
172
|
export function formatDateValue(value, dateStyle, withTime, kind = "datetime", opts) {
|
|
168
173
|
const d = kind === "date" && typeof value === "string"
|
|
169
174
|
? fromDayKey(value)
|
|
@@ -176,7 +181,13 @@ export function formatDateValue(value, dateStyle, withTime, kind = "datetime", o
|
|
|
176
181
|
const { implementation, context } = presentation(opts);
|
|
177
182
|
const day = typeof value === "string" ? value : toDayKey(d);
|
|
178
183
|
let out;
|
|
179
|
-
if (style === "relative") {
|
|
184
|
+
if (style === "relative" && !context.now) {
|
|
185
|
+
out =
|
|
186
|
+
kind === "date"
|
|
187
|
+
? implementation.calendarDay({ day, style: "short", context })
|
|
188
|
+
: implementation.instant({ instant: d, style: "short", withTime: true, context });
|
|
189
|
+
}
|
|
190
|
+
else if (style === "relative") {
|
|
180
191
|
out =
|
|
181
192
|
kind === "date"
|
|
182
193
|
? implementation.relativeCalendarDay({ day, context })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { DISPLAY_CORES, renderFieldValue, type DisplayCore } from "./display-cores.js";
|
|
2
2
|
export { emailHref, webHref } from "./web-href.js";
|
|
3
3
|
export type { DisplayOptions, FieldPresentation, FieldViewerContext, NumberLikeFormat, RelationWrap, } from "./options.js";
|
|
4
|
-
export { CellSuffix, DEFAULT_FIELD_PRESENTATION, formatDateValue, formatMoney, formatNumberValue, } from "./format.js";
|
|
4
|
+
export { CellSuffix, DEFAULT_FIELD_PRESENTATION, formatDateValue, timeShown, formatMoney, formatNumberValue, } from "./format.js";
|
|
5
5
|
export { viewerFrom } from "./viewer.js";
|
|
6
6
|
export { cellTextClass } from "./text-class.js";
|
|
7
7
|
export { MultiValueCell } from "./multi-value.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DISPLAY_CORES, renderFieldValue } from "./display-cores.js";
|
|
2
2
|
export { emailHref, webHref } from "./web-href.js";
|
|
3
|
-
export { CellSuffix, DEFAULT_FIELD_PRESENTATION, formatDateValue, formatMoney, formatNumberValue, } from "./format.js";
|
|
3
|
+
export { CellSuffix, DEFAULT_FIELD_PRESENTATION, formatDateValue, timeShown, formatMoney, formatNumberValue, } from "./format.js";
|
|
4
4
|
export { viewerFrom } from "./viewer.js";
|
|
5
5
|
export { cellTextClass } from "./text-class.js";
|
|
6
6
|
export { MultiValueCell } from "./multi-value.js";
|
|
@@ -52,7 +52,9 @@ export type FieldViewerContext = {
|
|
|
52
52
|
timeZone?: string;
|
|
53
53
|
/** The viewer's country, from the conventions: a phone of that country is written as at home. */
|
|
54
54
|
region?: string;
|
|
55
|
-
|
|
55
|
+
/** The moment relative dates count from: the provider's. Absent before the provider has one (`ViewsProvider`'s
|
|
56
|
+
* `now`, or its one read after mount): a date that needs it draws its full form. */
|
|
57
|
+
now?: Date;
|
|
56
58
|
/** Fields' own words (`time.ago`). Default: fields' English. */
|
|
57
59
|
fieldMessages?: FieldMessageResolver;
|
|
58
60
|
/** The views package's words (`views.display.*`). Default: the package's English. */
|
|
@@ -2,5 +2,6 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
import { type FieldDefOf } from "viewkitjs/fields";
|
|
3
3
|
import type { DisplayOptions } from "./options.js";
|
|
4
4
|
/** A low and a high end — "11–50", "10,001+", "up to 50" — then the code and
|
|
5
|
-
* the period of an amount range
|
|
5
|
+
* the period of an amount range; or the band's name when the ends are exactly a preset's ("Small"), its numbers on
|
|
6
|
+
* hover. */
|
|
6
7
|
export declare function renderRange(field: FieldDefOf<"range">, value: unknown, opts?: DisplayOptions): ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { rangeText } from "viewkitjs/fields";
|
|
3
|
+
import { exactPresetOf, rangeText } from "viewkitjs/fields";
|
|
4
4
|
import { rangePeriodShort, rangeUnit } from "../fields/range-unit.js";
|
|
5
5
|
import { useViews } from "../provider/context.js";
|
|
6
6
|
import { CellSuffix } from "./format.js";
|
|
@@ -15,5 +15,8 @@ function RangeValueCell({ field, value, opts, }) {
|
|
|
15
15
|
return null;
|
|
16
16
|
const unit = rangeUnit(field);
|
|
17
17
|
const period = rangePeriodShort(field);
|
|
18
|
+
const band = exactPresetOf(field, value);
|
|
19
|
+
if (band)
|
|
20
|
+
return _jsx("span", { className: cellTextClass(opts?.wrap), title: [text, unit, period].filter(Boolean).join(" "), children: band.label });
|
|
18
21
|
return (_jsxs("span", { className: cellTextClass(opts?.wrap), title: text, children: [_jsx("span", { className: "tabular-nums", children: text }), unit && _jsx(CellSuffix, { children: unit }), period && _jsx(CellSuffix, { children: period })] }));
|
|
19
22
|
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { DisplayOptions } from "./options.js";
|
|
2
|
+
/** For a value that draws no date: its viewer carries no moment, so a minute's read of the clock doesn't redraw it. */
|
|
2
3
|
export declare function useDisplayOptions(opts: DisplayOptions | undefined): DisplayOptions;
|
|
4
|
+
/** For a date: its viewer counts from the provider's moment, and redraws when it moves. */
|
|
5
|
+
export declare function useDateDisplayOptions(opts: DisplayOptions | undefined): DisplayOptions;
|