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
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import { useRef, useState } from "react";
|
|
4
4
|
import { useViews } from "../../../provider/context.js";
|
|
5
5
|
import { addSortRule, canAddSortRule, isSortRulesActive, openSortPlaces, sortRulesLabel, } from "../../settings/sorts.js";
|
|
6
|
-
import { useSheetPanels } from "../panel-sheet.js";
|
|
6
|
+
import { useSheetDrawsClose, useSheetPanels } from "../panel-sheet.js";
|
|
7
7
|
import { SortEditor, useSortEditor } from "../sort/SortEditor.js";
|
|
8
8
|
import { SortFieldList } from "../sort/SortFieldList.js";
|
|
9
9
|
import { useFoldAnchor, useToolbarPanel } from "./context.js";
|
|
@@ -13,13 +13,14 @@ export function ToolbarSortPill(props) {
|
|
|
13
13
|
const phone = useSheetPanels();
|
|
14
14
|
if (props.sorts.options.length === 0)
|
|
15
15
|
return null;
|
|
16
|
-
return (_jsx("span", { "data-slot": "vk-toolbar-sort-pill", className: "relative inline-flex shrink-0 items-center gap-1", children: phone ? _jsx(PhonePill, { ...props }) : _jsx(ComputerPill, { ...props }) }));
|
|
16
|
+
return (_jsx("span", { "data-slot": props.row ? "vk-toolbar-sort-row" : "vk-toolbar-sort-pill", className: "relative inline-flex shrink-0 items-center gap-1", children: phone ? _jsx(PhonePill, { ...props }) : _jsx(ComputerPill, { ...props }) }));
|
|
17
17
|
}
|
|
18
|
-
function ComputerPill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host: Host, addAfter = true, }) {
|
|
18
|
+
function ComputerPill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host: Host, addAfter: addAfterIn = true, row = false, }) {
|
|
19
|
+
const addAfter = row ? false : addAfterIn;
|
|
19
20
|
const { components, icons, messages } = useViews();
|
|
20
21
|
const { Popover } = components;
|
|
21
22
|
const panel = useToolbarPanel("sort", openIn !== undefined && onOpenChangeIn ? { open: openIn, onOpenChange: onOpenChangeIn } : undefined);
|
|
22
|
-
const [
|
|
23
|
+
const [pressed, setOpens] = useState({ what: "editor", at: "pill" });
|
|
23
24
|
const pill = useRef(null);
|
|
24
25
|
const add = useRef(null);
|
|
25
26
|
const hangsAt = useFoldAnchor(pill);
|
|
@@ -27,6 +28,7 @@ function ComputerPill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host:
|
|
|
27
28
|
const asideOnly = !named && (sorts.setAside?.length ?? 0) > 0;
|
|
28
29
|
const places = openSortPlaces(sorts);
|
|
29
30
|
const can = canAddSortRule(sorts.rules, places);
|
|
31
|
+
const opens = row ? { what: named || asideOnly ? "editor" : "fields", at: "pill", addSort: true } : pressed;
|
|
30
32
|
const Glyph = icons.sort;
|
|
31
33
|
const Plus = icons.add;
|
|
32
34
|
const name = messages({ key: "views.panels.sort" });
|
|
@@ -62,7 +64,13 @@ function ComputerPill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host:
|
|
|
62
64
|
sorts.onChange(next);
|
|
63
65
|
close(true, opens.at === "add" && canAddSortRule(next, places));
|
|
64
66
|
}, onDone: () => close() }));
|
|
65
|
-
return (_jsxs("span", { className: "contents", "data-open": hangsAt.fold && panel.open ? "" : undefined, children: [_jsx(ToolbarButton, { ref: pill, icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, empty: !
|
|
67
|
+
return (_jsxs("span", { className: "contents", "data-open": hangsAt.fold && panel.open ? "" : undefined, children: [_jsx(ToolbarButton, { ref: pill, icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, empty: !row && !named && !asideOnly, aside: asideOnly, changed: row ? !!named : isSortRulesActive(sorts), more: row
|
|
68
|
+
? sorts.rules.length > 1
|
|
69
|
+
? String(sorts.rules.length)
|
|
70
|
+
: undefined
|
|
71
|
+
: named && named.more > 0
|
|
72
|
+
? messages({ key: "views.panels.sort-more", values: { count: named.more } })
|
|
73
|
+
: undefined, popup: "dialog", open: panel.open && opens.at === "pill", onPointerDown: pressStart("pill"), onClick: press({ what: named || asideOnly ? "editor" : "fields", at: "pill", addSort: asideOnly || !addAfter }), children: named && !row ? (_jsxs(_Fragment, { children: [messages({ key: "views.panels.sorted-by" }), " ", _jsx("b", { children: named.first })] })) : (name) }), addAfter && named && can && (_jsx("span", { "data-slot": "vk-toolbar-sort-add", className: "inline-flex", children: _jsx(ToolbarButton, { ref: add, icon: _jsx(Plus, { className: "h-4 w-4 shrink-0" }), label: messages({ key: "views.panels.sort-add-one" }), word: null, popup: "dialog", open: panel.open && opens.at === "add", onPointerDown: pressStart("add"), onClick: press({ what: "fields", at: "add" }) }) })), Host ? (_jsx(Host, { open: panel.open, onOpenChange: panel.onOpenChange, title: name, children: content })) : (_jsx(Popover, { open: panel.open, onOpenChange: (next, details) => {
|
|
66
74
|
if (!next)
|
|
67
75
|
close(details?.reason !== "outside-press" && details?.reason !== "focus-out");
|
|
68
76
|
}, anchor: hangsAt.hidden ? hangsAt.anchor : opens.at === "add" ? add : pill, align: "start", sideOffset: 8, chrome: "menu", panelData: { "data-slot": "vk-toolbar-sort-panel" }, children: content }))] }));
|
|
@@ -74,8 +82,9 @@ function PhonePill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host })
|
|
|
74
82
|
const open = holds ? openIn : held;
|
|
75
83
|
const onOpenChange = holds ? onOpenChangeIn : setHeld;
|
|
76
84
|
const editor = useSortEditor({ sorts, form: "phone", open, onDone: () => onOpenChange(false) });
|
|
85
|
+
const headDraws = useSheetDrawsClose();
|
|
77
86
|
const Glyph = icons.sort;
|
|
78
87
|
const name = messages({ key: "views.panels.sort" });
|
|
79
88
|
const n = sorts.rules.length;
|
|
80
|
-
return (_jsx(ToolbarPanelPart, { panelKey: "sort", slot: "vk-toolbar-sort", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, more: n > 0 ? String(n) : undefined, changed: isSortRulesActive(sorts), open: open, onOpenChange: onOpenChange, host: host, sheetActions: editor.head, children: ({ fill, closeButton }) => (_jsx("div", { className: fill ? "flex h-full min-h-0 flex-col" : "flex flex-col", children: editor.body(closeButton) })) }));
|
|
89
|
+
return (_jsx(ToolbarPanelPart, { panelKey: "sort", slot: "vk-toolbar-sort", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, more: n > 0 ? String(n) : undefined, changed: isSortRulesActive(sorts), open: open, onOpenChange: onOpenChange, host: host, sheetActions: editor.head, ...(headDraws && editor.title !== undefined && { sheetTitle: editor.title }), onSheetEscape: editor.escapeBack, children: ({ fill, closeButton }) => (_jsx("div", { className: fill ? "flex h-full min-h-0 flex-col" : "flex flex-col", children: editor.body(closeButton) })) }));
|
|
81
90
|
}
|
|
@@ -13,7 +13,7 @@ export type ToolbarPanelHost = ComponentType<{
|
|
|
13
13
|
opener?: RefObject<HTMLElement | null>;
|
|
14
14
|
children: ReactNode;
|
|
15
15
|
}>;
|
|
16
|
-
export declare function ToolbarPanelPart({ panelKey, slot, icon, label, word, count, onClear, dot, changed, open: openIn, onOpenChange: onOpenChangeIn, host: Host, popoverClassName, words, more, empty, disabled, disabledReason, sheetActions, children, }: {
|
|
16
|
+
export declare function ToolbarPanelPart({ panelKey, slot, icon, label, word, count, onClear, dot, changed, open: openIn, onOpenChange: onOpenChangeIn, host: Host, popoverClassName, words, more, empty, disabled, disabledReason, sheetActions, sheetTitle, onSheetEscape, children, }: {
|
|
17
17
|
/** The radio's name for it. */
|
|
18
18
|
panelKey: string;
|
|
19
19
|
/** Its place's `data-slot`; the popover, or the panel's box in a sheet, is marked `${slot}-panel`. */
|
|
@@ -41,6 +41,10 @@ export declare function ToolbarPanelPart({ panelKey, slot, icon, label, word, co
|
|
|
41
41
|
/** The panel's own ✕ and ✓ for a phone's sheet: with `sheetActions: "head"` the sheet's head draws them; with
|
|
42
42
|
* `bar` (`closeButton` true) the panel draws its own. */
|
|
43
43
|
sheetActions?: ViewsSheetActions;
|
|
44
|
+
/** The sheet's title while the panel's body stands on a step of its own, in place of `label` (VK-721). */
|
|
45
|
+
sheetTitle?: string;
|
|
46
|
+
/** The sheet's Escape, asked first: true when the panel answered it (a step gone back), and the sheet stays open. */
|
|
47
|
+
onSheetEscape?: () => boolean;
|
|
44
48
|
/** The panel. `close` dismisses it (its ✕, a column's Done); `closeButton` is false in a sheet whose head draws the
|
|
45
49
|
* ✕ (`sheetActions: "head"`), where the panel draws none of its own. */
|
|
46
50
|
children: (args: PanelArgs) => ReactNode;
|
|
@@ -5,7 +5,7 @@ import { useViews } from "../../../provider/context.js";
|
|
|
5
5
|
import { PanelSheet, useSheetDrawsClose, useSheetPanels } from "../panel-sheet.js";
|
|
6
6
|
import { useFoldAnchor, useToolbarPanel } from "./context.js";
|
|
7
7
|
import { ToolbarButton } from "./ToolbarButton.js";
|
|
8
|
-
export function ToolbarPanelPart({ panelKey, slot, icon, label, word, count, onClear, dot, changed, open: openIn, onOpenChange: onOpenChangeIn, host: Host, popoverClassName, words, more, empty, disabled, disabledReason, sheetActions, children, }) {
|
|
8
|
+
export function ToolbarPanelPart({ panelKey, slot, icon, label, word, count, onClear, dot, changed, open: openIn, onOpenChange: onOpenChangeIn, host: Host, popoverClassName, words, more, empty, disabled, disabledReason, sheetActions, sheetTitle, onSheetEscape, children, }) {
|
|
9
9
|
const { components } = useViews();
|
|
10
10
|
const sheet = useSheetPanels();
|
|
11
11
|
const headCloses = useSheetDrawsClose();
|
|
@@ -37,7 +37,7 @@ export function ToolbarPanelPart({ panelKey, slot, icon, label, word, count, onC
|
|
|
37
37
|
const wasOpen = Host || sheet ? open : event.detail === 0 ? open : openAtPress.current;
|
|
38
38
|
openAtPress.current = false;
|
|
39
39
|
onOpenChange(!wasOpen);
|
|
40
|
-
} }), Host ? (_jsx(Host, { open: open, onOpenChange: onOpenChange, title: label, opener: hangsAt.anchor, children: _jsx(PanelBody, { render: children, args: { fill: true, close, closeButton: true } }) })) : sheet ? (_jsx(PanelSheet, { open: open, onOpenChange: onOpenChange, title: label, snap: "full", slot: `${slot}-panel`, headed: true, actions: sheetActions, children: _jsx(PanelBody, { render: children, args: { fill: true, close, closeButton: !headCloses } }) })) : (_jsx(Popover, { open: open, onOpenChange: (next, details) => {
|
|
40
|
+
} }), Host ? (_jsx(Host, { open: open, onOpenChange: onOpenChange, title: label, opener: hangsAt.anchor, children: _jsx(PanelBody, { render: children, args: { fill: true, close, closeButton: true } }) })) : sheet ? (_jsx(PanelSheet, { open: open, onOpenChange: onOpenChange, title: label, snap: "full", slot: `${slot}-panel`, headed: true, actions: sheetActions, ...(sheetTitle !== undefined && { sheetTitle }), ...(onSheetEscape && { onSheetEscape }), children: _jsx(PanelBody, { render: children, args: { fill: true, close, closeButton: !headCloses } }) })) : (_jsx(Popover, { open: open, onOpenChange: (next, details) => {
|
|
41
41
|
onOpenChange(next);
|
|
42
42
|
const reason = details?.reason;
|
|
43
43
|
if (!next && reason !== "outside-press" && reason !== "focus-out")
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { barAddRefusal } from "../../../filters/filter-tree.js";
|
|
2
|
+
import type { FilterTree } from "viewkitjs/fields/query";
|
|
3
|
+
import type { FilterEditorField, FilterTreeConfig } from "../../model.js";
|
|
4
|
+
import type { Pending } from "../filter/editor-ctx.js";
|
|
5
|
+
export declare function useFilterAdd({ filterTree, hold, write, }: {
|
|
6
|
+
/** The builder's filter tree: `settingsPanels(…).filterTree`. */
|
|
7
|
+
filterTree: FilterTreeConfig;
|
|
8
|
+
/** Holds a yes/no until its value is picked. */
|
|
9
|
+
hold: (held: Pending) => void;
|
|
10
|
+
/** Writes the tree with the new filter; absent, `filterTree.onChange`. The bar writes through its editor. */
|
|
11
|
+
write?: (edit: (current: FilterTree) => FilterTree | null) => void;
|
|
12
|
+
}): {
|
|
13
|
+
refusal: ReturnType<typeof barAddRefusal>;
|
|
14
|
+
reason: string | undefined;
|
|
15
|
+
onPick: (picked: FilterEditorField, far?: FilterEditorField) => void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useViews } from "../../../provider/context.js";
|
|
3
|
+
import { addOnBar, barAddRefusal } from "../../../filters/filter-tree.js";
|
|
4
|
+
import { heldUntilWhole, newRelationRuleFor, newRuleFor } from "../../settings/filter-groups.js";
|
|
5
|
+
export function useFilterAdd({ filterTree, hold, write, }) {
|
|
6
|
+
const { messages } = useViews();
|
|
7
|
+
const refusal = barAddRefusal(filterTree.tree);
|
|
8
|
+
const reason = refusal === "or-full"
|
|
9
|
+
? messages({ key: "views.panels.filter-or-full" })
|
|
10
|
+
: refusal === "too-many"
|
|
11
|
+
? messages({ key: "views.panels.filter-too-many" })
|
|
12
|
+
: undefined;
|
|
13
|
+
const onPick = (picked, far) => {
|
|
14
|
+
const node = far ? newRelationRuleFor(picked, far) : newRuleFor(picked);
|
|
15
|
+
if (heldUntilWhole(far ?? picked)) {
|
|
16
|
+
hold({ container: [], node });
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const edit = (current) => {
|
|
20
|
+
const out = addOnBar(current, node);
|
|
21
|
+
return "tree" in out ? out.tree : null;
|
|
22
|
+
};
|
|
23
|
+
if (write) {
|
|
24
|
+
write(edit);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const next = edit(filterTree.tree);
|
|
28
|
+
if (next)
|
|
29
|
+
filterTree.onChange(next);
|
|
30
|
+
};
|
|
31
|
+
return { refusal, reason, onPick };
|
|
32
|
+
}
|
|
@@ -14,7 +14,7 @@ export declare function ViewFooter({ view, onClear, words, className, }: {
|
|
|
14
14
|
view?: CollectionViewState;
|
|
15
15
|
/** With no shared view: Clear alone, which this takes the list back with. */
|
|
16
16
|
onClear?: () => void;
|
|
17
|
-
/** `kit`: Clear and Save, the toolbar's words for them, in place of Reset and
|
|
17
|
+
/** `kit`: Clear and Save, the toolbar's words for them, in place of Reset and Save for everyone. */
|
|
18
18
|
words?: "kit";
|
|
19
19
|
className?: string;
|
|
20
20
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo, useRef, useState } from "react";
|
|
3
|
+
import { useCallback, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { cx } from "../../../internal/cx.js";
|
|
5
5
|
import { useViews } from "../../../provider/context.js";
|
|
6
6
|
import { formatCount } from "../../../internal/count.js";
|
|
@@ -8,6 +8,7 @@ import { VIEWS_LIST_CLASS, VIEWS_LIST_LABEL_CLASS, VIEWS_LIST_SEPARATOR_CLASS }
|
|
|
8
8
|
import { viewsListOrderFits, viewsListPickFits, } from "../../views-row/model.js";
|
|
9
9
|
import { PanelButton } from "../../panel-button.js";
|
|
10
10
|
import { PanelSheet, useSheetDrawsClose, useSheetPanels } from "../panel-sheet.js";
|
|
11
|
+
import { usePanelStep } from "../panel-step.js";
|
|
11
12
|
import { useAnchoredToggle } from "./use-anchored-toggle.js";
|
|
12
13
|
import { ToolbarButton } from "../toolbar/ToolbarButton.js";
|
|
13
14
|
import { useViewsRowInFrame } from "./in-frame.js";
|
|
@@ -26,6 +27,11 @@ export function ViewPicker({ axis, className }) {
|
|
|
26
27
|
const sheet = useSheetPanels();
|
|
27
28
|
const sheetDrawsClose = useSheetDrawsClose();
|
|
28
29
|
const [query, setQuery] = useState("");
|
|
30
|
+
const step = usePanelStep();
|
|
31
|
+
const holding = useRef(false);
|
|
32
|
+
const onHold = useCallback((on) => {
|
|
33
|
+
holding.current = on;
|
|
34
|
+
}, []);
|
|
29
35
|
const active = axis.options.find((option) => option.value === axis.value);
|
|
30
36
|
const { shared, personal } = useMemo(() => {
|
|
31
37
|
const q = query.trim().toLowerCase();
|
|
@@ -62,7 +68,10 @@ export function ViewPicker({ axis, className }) {
|
|
|
62
68
|
...(!axis.hideCounts && typeof option.count === "number" && { count: option.count }),
|
|
63
69
|
...(option.private !== undefined && { private: option.private }),
|
|
64
70
|
...(option.menu !== undefined && { menu: option.menu }),
|
|
65
|
-
|
|
71
|
+
...(option.layout !== undefined && { layout: option.layout }),
|
|
72
|
+
...(option.changed !== undefined && { changed: option.changed }),
|
|
73
|
+
...(option.favorite !== undefined && { favorite: option.favorite }),
|
|
74
|
+
})), ...(axis.verbs && { verbs: axis.verbs }), ...(sheet ? { onStepChange: step.onStepChange } : { onHold }), value: axis.value, form: sheet ? "phone" : "computer", onViewChange: (value) => {
|
|
66
75
|
if (viewsListPickFits(axis.options, value))
|
|
67
76
|
axis.onChange(value);
|
|
68
77
|
}, ...(onCreate && {
|
|
@@ -77,7 +86,13 @@ export function ViewPicker({ axis, className }) {
|
|
|
77
86
|
onReorder(orderedIds);
|
|
78
87
|
},
|
|
79
88
|
...(axis.canDrag && { canDrag: axis.canDrag }),
|
|
80
|
-
}), onDone: close, ...(sheet &&
|
|
89
|
+
}), onDone: close, ...(sheet &&
|
|
90
|
+
!sheetDrawsClose && {
|
|
91
|
+
actions: {
|
|
92
|
+
close: { label: messages({ key: "views.panels.close" }), onPress: close },
|
|
93
|
+
...(step.back && { back: { label: messages({ key: "views.panels.back" }), onPress: step.back } }),
|
|
94
|
+
},
|
|
95
|
+
}) })) : (_jsxs(_Fragment, { children: [axis.options.length >= SEARCH_FROM && (_jsx("div", { className: "px-1.5 pt-1.5", children: _jsx(atoms.PanelSearch, { value: query, onChange: setQuery, placeholder: messages({ key: "views.panels.views-search" }), autoFocus: !sheet }) })), _jsxs("div", { role: "listbox", "aria-label": messages({ key: "views.panels.views-list" }), className: VIEWS_LIST_CLASS, children: [shared.length > 0 && personal.length > 0 && (_jsx("div", { className: VIEWS_LIST_LABEL_CLASS, children: messages({ key: "views.panels.views-shared" }) })), rows(shared), personal.length > 0 && (_jsxs(_Fragment, { children: [shared.length > 0 && (_jsx("div", { className: VIEWS_LIST_LABEL_CLASS, children: messages({ key: "views.panels.views-personal" }) })), rows(personal)] })), shared.length + personal.length === 0 && (_jsx("div", { className: "px-2 py-3 text-sm text-(color:--vk-fg-subtle)", children: messages({ key: "views.panels.views-none" }) })), axis.onCreate && (_jsxs(_Fragment, { children: [_jsx("div", { className: VIEWS_LIST_SEPARATOR_CLASS }), _jsx(atoms.ChoiceRow, { label: messages({
|
|
81
96
|
key: "views.panels.view-create-row",
|
|
82
97
|
values: { label: axis.createLabel ?? messages({ key: "views.panels.view-create" }) },
|
|
83
98
|
}), leading: _jsx(Add, { className: "h-4 w-4 shrink-0 text-(color:--vk-fg-subtle)" }), onClick: () => {
|
|
@@ -108,5 +123,11 @@ export function ViewPicker({ axis, className }) {
|
|
|
108
123
|
toggle.setOpen(next);
|
|
109
124
|
if (!next)
|
|
110
125
|
setQuery("");
|
|
111
|
-
}, title: messages({ key: "views.panels.views-list" }), snap: "auto",
|
|
126
|
+
}, title: messages({ key: "views.panels.views-list" }), snap: "auto", ...(step.title !== undefined && { sheetTitle: step.title || listLabel, headed: !sheetDrawsClose }), ...(step.back &&
|
|
127
|
+
sheetDrawsClose && {
|
|
128
|
+
actions: {
|
|
129
|
+
close: { label: messages({ key: "views.panels.close" }), onPress: () => toggle.setOpen(false) },
|
|
130
|
+
back: { label: messages({ key: "views.panels.back" }), onPress: step.back },
|
|
131
|
+
},
|
|
132
|
+
}), onSheetEscape: step.escapeBack, children: list })) : (_jsx(Popover, { open: toggle.open, onOpenChange: onOpenChange, anchor: anchor, align: "start", sideOffset: 6, chrome: "menu", className: "w-72", onOutsidePress: () => (holding.current ? false : undefined), onEscape: () => (holding.current ? false : undefined), children: list }))] }));
|
|
112
133
|
}
|
|
@@ -51,6 +51,7 @@ export { QuickFiltersPanel } from "./react/quick/QuickFiltersPanel.js";
|
|
|
51
51
|
export { QuickFiltersReminder } from "./react/quick/QuickFiltersReminder.js";
|
|
52
52
|
export { ToolbarAdvancedFilters } from "./react/toolbar/ToolbarAdvancedFilters.js";
|
|
53
53
|
export { ToolbarFilters, foldableFilters } from "./react/toolbar/ToolbarFilters.js";
|
|
54
|
+
export { ToolbarFilterAdd } from "./react/toolbar/ToolbarFilterAdd.js";
|
|
54
55
|
export type { Pending } from "./react/filter/editor-ctx.js";
|
|
55
56
|
export { FilterEditor } from "./react/filter/FilterEditor.js";
|
|
56
57
|
export { PhoneFilterEditor, usePhoneFilterEditor } from "./react/filter/PhoneFilterEditor.js";
|
|
@@ -46,6 +46,7 @@ export { QuickFiltersPanel } from "./react/quick/QuickFiltersPanel.js";
|
|
|
46
46
|
export { QuickFiltersReminder } from "./react/quick/QuickFiltersReminder.js";
|
|
47
47
|
export { ToolbarAdvancedFilters } from "./react/toolbar/ToolbarAdvancedFilters.js";
|
|
48
48
|
export { ToolbarFilters, foldableFilters } from "./react/toolbar/ToolbarFilters.js";
|
|
49
|
+
export { ToolbarFilterAdd } from "./react/toolbar/ToolbarFilterAdd.js";
|
|
49
50
|
export { FilterEditor } from "./react/filter/FilterEditor.js";
|
|
50
51
|
export { PhoneFilterEditor, usePhoneFilterEditor } from "./react/filter/PhoneFilterEditor.js";
|
|
51
52
|
export { FilterFieldList } from "./react/filter/FilterFieldList.js";
|
|
@@ -34,6 +34,9 @@ export declare function takesValue(operator: FilterOperator): boolean;
|
|
|
34
34
|
/** The fields a rule can name: the Filter panel's own rows that open (columns, and the parts a place keeps), in the
|
|
35
35
|
* person's column order; then each relation the list filters across, its usable far fields one level in. */
|
|
36
36
|
export declare function filterEditorFields<Row>(input: SettingsPanelsInput<Row>): FilterEditorField[];
|
|
37
|
+
/** What a field list shows (`FilterTreeConfig.listed`): `fields`, and in their places the columns the list can't filter,
|
|
38
|
+
* greyed with their reason (VK-880). Absent `listed`, a tree's `fields`. */
|
|
39
|
+
export declare function listedFieldsOf(tree: Pick<FilterTreeConfig, "fields" | "listed">): readonly FilterEditorField[];
|
|
37
40
|
/** The builder's filter tree (VK-531): the tree, its fields, its writer, and each rule's value as its body edits it.
|
|
38
41
|
* `write` is the build's shared writer (`filterWriter`), so the editor's writes and the Filter rows' add up. */
|
|
39
42
|
export declare function settingsFilterTree<Row>(input: SettingsPanelsInput<Row>, write: (tree: FilterTree) => void): FilterTreeConfig;
|
|
@@ -4,9 +4,10 @@ import { resolveViewsMessage } from "../../contract.js";
|
|
|
4
4
|
import { columnLabel } from "../../model/column-capabilities.js";
|
|
5
5
|
import { booleanFilterOptions, buildColumnFilters } from "../../model/column-filters.js";
|
|
6
6
|
import { columnMark } from "../../model/column-mark.js";
|
|
7
|
-
import { farWhereInputs, relationFilterKey } from "../../model/relation-filters.js";
|
|
7
|
+
import { farPathOf, farWhereInputs, relationFilterKey } from "../../model/relation-filters.js";
|
|
8
8
|
import { columnStateOf } from "../../model/settings-columns.js";
|
|
9
9
|
import { fieldKeyOf, fromListFilterRule, toListFilterRule } from "../../model/view-rules.js";
|
|
10
|
+
import { viewFilterCapabilities } from "./filters.js";
|
|
10
11
|
const TEXT_TYPES = new Set([
|
|
11
12
|
"text",
|
|
12
13
|
"url",
|
|
@@ -108,22 +109,50 @@ function markOf(column) {
|
|
|
108
109
|
const mark = columnMark(column);
|
|
109
110
|
return mark ? { mark } : {};
|
|
110
111
|
}
|
|
112
|
+
function spokenOf(input) {
|
|
113
|
+
const messages = input.filterData?.messages ?? input.resolve;
|
|
114
|
+
const conventions = input.filterData?.conventions ?? input.conventions;
|
|
115
|
+
return { ...(messages ? { messages } : {}), ...(conventions ? { conventions } : {}) };
|
|
116
|
+
}
|
|
111
117
|
export function filterEditorFields(input) {
|
|
118
|
+
return editorFields(input).filter((field) => field.disabled === undefined);
|
|
119
|
+
}
|
|
120
|
+
export function listedFieldsOf(tree) {
|
|
121
|
+
return tree.listed ?? tree.fields;
|
|
122
|
+
}
|
|
123
|
+
function editorFields(input) {
|
|
112
124
|
const { columns, settings, filterData, relationFilters } = input;
|
|
125
|
+
const spoken = spokenOf(input);
|
|
113
126
|
const whole = columns.filter((column) => !column.partOf);
|
|
114
127
|
const rows = buildColumnFilters({
|
|
115
128
|
...filterData,
|
|
129
|
+
...spoken,
|
|
116
130
|
declared: [],
|
|
117
131
|
columns: whole,
|
|
118
132
|
order: columnStateOf(settings, input.layer, columns).order,
|
|
119
133
|
rules: {},
|
|
134
|
+
capabilities: viewFilterCapabilities(input),
|
|
120
135
|
});
|
|
136
|
+
const notOffered = (spoken.messages ?? resolveViewsMessage)({ key: "views.panels.filter-not-offered" });
|
|
121
137
|
const own = rows.flatMap((row) => {
|
|
122
|
-
|
|
123
|
-
return [];
|
|
138
|
+
const reason = row.editor === "unavailable" ? row.reason : row.disabled ? (row.disabledReason ?? notOffered) : null;
|
|
124
139
|
const direct = whole.find((column) => column.id === row.key);
|
|
125
140
|
const { id, part } = direct ? { id: row.key, part: undefined } : parsePartKey(row.key);
|
|
126
141
|
const column = direct ?? whole.find((candidate) => candidate.id === id);
|
|
142
|
+
if (reason !== null) {
|
|
143
|
+
if (!column)
|
|
144
|
+
return [];
|
|
145
|
+
return [
|
|
146
|
+
{
|
|
147
|
+
key: row.key,
|
|
148
|
+
label: row.label,
|
|
149
|
+
fieldKey: fieldKeyOf(column),
|
|
150
|
+
type: column.field ? valueTypeOf(column.field) : "text",
|
|
151
|
+
...markOf(column),
|
|
152
|
+
disabled: reason,
|
|
153
|
+
},
|
|
154
|
+
];
|
|
155
|
+
}
|
|
127
156
|
if (!column?.field)
|
|
128
157
|
return [];
|
|
129
158
|
return [
|
|
@@ -174,9 +203,8 @@ function ruleFromBody(type, rule, next) {
|
|
|
174
203
|
}
|
|
175
204
|
export function settingsFilterTree(input, write) {
|
|
176
205
|
const { columns, filterData, relationFilters } = input;
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
const spoken = { ...(messages ? { messages } : {}), ...(conventions ? { conventions } : {}) };
|
|
206
|
+
const spoken = spokenOf(input);
|
|
207
|
+
const messages = spoken.messages;
|
|
180
208
|
const whole = columns.filter((column) => !column.partOf);
|
|
181
209
|
const valueOf = (rule, writeRule, relation) => {
|
|
182
210
|
if (rule.setAside || !takesValue(rule.operator))
|
|
@@ -227,12 +255,49 @@ export function settingsFilterTree(input, write) {
|
|
|
227
255
|
});
|
|
228
256
|
return built.find((config) => config.key === key) ?? null;
|
|
229
257
|
};
|
|
258
|
+
const optionsOf = (fieldKey, part, relation) => {
|
|
259
|
+
const target = relation !== undefined ? relationFilters?.targets[relation] : undefined;
|
|
260
|
+
if (relation !== undefined && !target)
|
|
261
|
+
return undefined;
|
|
262
|
+
const column = relation !== undefined && target
|
|
263
|
+
? farWhereInputs(relation, target, relationFilters?.farValues).columns.find((c) => c.id === fieldKey)
|
|
264
|
+
: whole.find((c) => fieldKeyOf(c) === fieldKey);
|
|
265
|
+
const type = column?.field ? valueTypeOf(column.field) : undefined;
|
|
266
|
+
const country = relation === undefined && type === "location" && part === "countryCode";
|
|
267
|
+
if (!column || !type || (part !== undefined && !country) || (!country && !CHOICE_TYPES.has(type)))
|
|
268
|
+
return undefined;
|
|
269
|
+
const config = valueOf({ fieldKey, ...(country ? { part } : {}), operator: "is_any_of", value: [] }, () => { }, relation);
|
|
270
|
+
if (!config || config.editor !== undefined || !("options" in config))
|
|
271
|
+
return undefined;
|
|
272
|
+
const declared = column.field.options ?? [];
|
|
273
|
+
const held = relation !== undefined
|
|
274
|
+
? relationFilters?.farValues?.values[farPathOf(relation, fieldKey)] !== undefined || declared.length > 0
|
|
275
|
+
: filterData?.knownValues?.[country ? partKey(column.id, "countryCode") : column.id] !== undefined;
|
|
276
|
+
if (config.onOpen && !held)
|
|
277
|
+
return undefined;
|
|
278
|
+
const kind = column.field.relation?.kind;
|
|
279
|
+
return config.options.map((o) => {
|
|
280
|
+
const d = declared.find((x) => x.value === o.value);
|
|
281
|
+
return {
|
|
282
|
+
value: o.value,
|
|
283
|
+
label: o.label,
|
|
284
|
+
...(d?.slot !== undefined ? { slot: d.slot } : {}),
|
|
285
|
+
...(d?.color !== undefined ? { color: d.color } : {}),
|
|
286
|
+
...(d?.icon !== undefined ? { icon: d.icon } : {}),
|
|
287
|
+
...(type === "user" || type === "actor" ? { avatarUrl: null } : {}),
|
|
288
|
+
...(type === "relation" ? { avatarUrl: null, ...(kind ? { kind } : {}) } : {}),
|
|
289
|
+
};
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
const listed = editorFields(input);
|
|
230
293
|
return {
|
|
231
294
|
tree: input.settings.filter,
|
|
232
|
-
fields:
|
|
295
|
+
fields: listed.filter((field) => field.disabled === undefined),
|
|
296
|
+
listed,
|
|
233
297
|
...(input.goneFields ? { gone: input.goneFields } : {}),
|
|
234
298
|
onChange: write,
|
|
235
299
|
valueOf,
|
|
300
|
+
optionsOf,
|
|
236
301
|
};
|
|
237
302
|
}
|
|
238
303
|
export function filterPartChangeFits(field, was, next) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type FilterTree } from "viewkitjs/fields/query";
|
|
2
2
|
import { type FilterConfig } from "../../filters/filter-model.js";
|
|
3
|
+
import type { ListFilterCapabilities } from "../../model/filter-capabilities.js";
|
|
3
4
|
import type { SettingsPanelsInput } from "./input.js";
|
|
4
5
|
/** One draft of a list's filter tree that every write of one burst adds up on: the Filter rows' and the filter
|
|
5
6
|
* editor's alike (VK-416, VK-531). */
|
|
@@ -14,6 +15,10 @@ export type FilterWriter = {
|
|
|
14
15
|
* it ends, a later write starts again from the settings, so a write the app refused or hasn't applied yet never rides
|
|
15
16
|
* in the next one. */
|
|
16
17
|
export declare function filterWriter<Row>(input: SettingsPanelsInput<Row>): FilterWriter;
|
|
18
|
+
/** What the list's columns can be filtered by, as a saved list sees them: the app's own capabilities, and a column with no
|
|
19
|
+
* field unavailable, since a saved list keeps only what it can name. The Filter rows and the filter editor's fields read
|
|
20
|
+
* the same (VK-880). */
|
|
21
|
+
export declare function viewFilterCapabilities<Row>(input: Pick<SettingsPanelsInput<Row>, "columns" | "filterData" | "resolve">): ListFilterCapabilities;
|
|
17
22
|
/** The Filter panel's rows: one per column (a column with no field shown as one a view can't filter on), then one
|
|
18
23
|
* per relation the list filters across. `writer`: the build's shared draft, so the rows' writes and the filter
|
|
19
24
|
* editor's add up; absent, the rows keep their own. */
|
|
@@ -2,7 +2,7 @@ import { isRelationRule, parsePartKey, settingsChange, } from "viewkitjs/fields/
|
|
|
2
2
|
import { resolveViewsMessage as defaultWords } from "../../contract.js";
|
|
3
3
|
import { isFilterActive } from "../../filters/filter-model.js";
|
|
4
4
|
import { canGroupAt, groupAt, orLevelWrapped, settled } from "../../filters/filter-tree.js";
|
|
5
|
-
import { columnManagedByView
|
|
5
|
+
import { columnManagedByView } from "../../model/column-capabilities.js";
|
|
6
6
|
import { setRelationRule } from "../../filters/relation-filter.js";
|
|
7
7
|
import { buildColumnFilters } from "../../model/column-filters.js";
|
|
8
8
|
import { buildRelationFilters, relationFilterKey } from "../../model/relation-filters.js";
|
|
@@ -38,6 +38,16 @@ function rootRelationIndexes(tree) {
|
|
|
38
38
|
});
|
|
39
39
|
return out;
|
|
40
40
|
}
|
|
41
|
+
export function viewFilterCapabilities(input) {
|
|
42
|
+
const capabilities = { ...input.filterData?.capabilities };
|
|
43
|
+
const word = input.filterData?.messages ?? input.resolve ?? defaultWords;
|
|
44
|
+
let reason;
|
|
45
|
+
for (const column of input.columns) {
|
|
46
|
+
if (!column.partOf && !columnManagedByView(column) && !capabilities[column.id])
|
|
47
|
+
capabilities[column.id] = { mode: "unavailable", reason: (reason ??= word({ key: "views.panels.filter-fieldless" })) };
|
|
48
|
+
}
|
|
49
|
+
return capabilities;
|
|
50
|
+
}
|
|
41
51
|
export function settingsFilters(input, writer) {
|
|
42
52
|
const { settings, columns, filterData, relationFilters } = input;
|
|
43
53
|
const groups = !!input.filterGroups;
|
|
@@ -51,12 +61,8 @@ export function settingsFilters(input, writer) {
|
|
|
51
61
|
const now = draft();
|
|
52
62
|
return groups ? (orLevelWrapped(now) ?? now) : now;
|
|
53
63
|
};
|
|
54
|
-
const capabilities =
|
|
64
|
+
const capabilities = viewFilterCapabilities(input);
|
|
55
65
|
const whole = columns.filter((column) => !column.partOf);
|
|
56
|
-
for (const column of whole) {
|
|
57
|
-
if (!columnManagedByView(column) && !capabilities[column.id])
|
|
58
|
-
capabilities[column.id] = { mode: "unavailable", reason: VIEW_FIELDLESS_FILTER_REASON };
|
|
59
|
-
}
|
|
60
66
|
const onRuleChange = (rowKey, rule) => {
|
|
61
67
|
const direct = columns.find((column) => column.id === rowKey);
|
|
62
68
|
const { id, part } = direct ? { id: rowKey, part: undefined } : parsePartKey(rowKey);
|
|
@@ -23,6 +23,7 @@ export function groupEntries(heads, group) {
|
|
|
23
23
|
label: head.label,
|
|
24
24
|
empty: head.hidden && !hiddenByReader.has(head.key),
|
|
25
25
|
hidden: hiddenByReader.has(head.key),
|
|
26
|
+
count: head.count,
|
|
26
27
|
}));
|
|
27
28
|
return [...entries.filter((entry) => !entry.hidden), ...entries.filter((entry) => entry.hidden)];
|
|
28
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StatusSlot } from "viewkitjs/fields/design/status-slots";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
|
-
import type { ViewsMenuItem } from "../../provider/components.js";
|
|
3
|
+
import type { ViewsMenuItem, ViewsViewVerbs } from "../../provider/components.js";
|
|
4
4
|
export type ViewTabOption<V extends string> = {
|
|
5
5
|
value: V;
|
|
6
6
|
label: string;
|
|
@@ -24,6 +24,12 @@ export type ViewTabOption<V extends string> = {
|
|
|
24
24
|
* to the view the list is showing.
|
|
25
25
|
*/
|
|
26
26
|
menu?: ViewsMenuItem[];
|
|
27
|
+
/** Its layout, by the axis's `verbs.layouts`' id: what Save as new view and New view start from. */
|
|
28
|
+
layout?: string;
|
|
29
|
+
/** It holds changes not saved: its menu offers Save for everyone, Reset and Save as new view. */
|
|
30
|
+
changed?: boolean;
|
|
31
|
+
/** One of the reader's favorites. */
|
|
32
|
+
favorite?: boolean;
|
|
27
33
|
};
|
|
28
34
|
/** One option of a `PillGroup`: any row of pills, a views row's or a tab row's. */
|
|
29
35
|
export type PillOption<T extends string = string> = {
|
|
@@ -77,6 +83,9 @@ export type CollectionViewsConfig<V extends string = string> = {
|
|
|
77
83
|
onReorder?: (orderedIds: V[]) => void;
|
|
78
84
|
/** Which pills may be picked up — a member cannot move the views everyone sees. Default: all. */
|
|
79
85
|
canDrag?: (value: V) => boolean;
|
|
86
|
+
/** A view's verbs: handed, a views list that can draw a view's menu (CONTROLS) draws Rename, New view, the delete question
|
|
87
|
+
* and Undo from them; left out, a view's menu is its `menu` rows. */
|
|
88
|
+
verbs?: ViewsViewVerbs;
|
|
80
89
|
};
|
|
81
90
|
/** Whether a view an app's views list hands back (`ViewsListBody`, VK-554) is one of the axis's views. One that isn't
|
|
82
91
|
* is never picked. */
|
|
@@ -98,6 +98,12 @@ export type ViewsProviderProps = {
|
|
|
98
98
|
* week from today). The date editor hands exactly these to your `DateBody`, and its own panel draws the same.
|
|
99
99
|
* Default: `today`, `tomorrow` and `next-monday`, as on 0.5.0. Pass a module-level array. */
|
|
100
100
|
datePicks?: ViewsDatePicks;
|
|
101
|
+
/** The moment every date counts from: relative dates, the column menu's samples, the date editors' quick days and
|
|
102
|
+
* today. Hand the server's, and the server and the browser draw the same text on first load. Absent, the provider
|
|
103
|
+
* reads the clock just after the page loads, then once a minute and when the tab comes back into view, never
|
|
104
|
+
* while rendering; until the first read a date that needs it draws its full form. A moment you hand is kept as it is:
|
|
105
|
+
* hand a new one to move it. */
|
|
106
|
+
now?: Date;
|
|
101
107
|
children: ReactNode;
|
|
102
108
|
};
|
|
103
|
-
export declare function ViewsProvider({ children, components, conventions, icons, ports, atoms, messages, presentation, desktopQuery, sheetActions, escape, oneValue, sayRefusals, menus, gridButtons, severalValues, gridCheckboxes, fieldRowButtons, fieldRowCheckboxes, panelButtons, bodyFrame, gridBodyPlace, selectionBar, datePicks, }: ViewsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
109
|
+
export declare function ViewsProvider({ children, components, conventions, icons, ports, atoms, messages, presentation, desktopQuery, sheetActions, escape, oneValue, sayRefusals, menus, gridButtons, severalValues, gridCheckboxes, fieldRowButtons, fieldRowCheckboxes, panelButtons, bodyFrame, gridBodyPlace, selectionBar, datePicks, now, }: ViewsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,18 +1,41 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo } from "react";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { resolveViewsMessage } from "../contract.js";
|
|
5
5
|
import { DEFAULT_VIEWS_ATOMS } from "../atoms/defaults.js";
|
|
6
6
|
import { ViewsContext } from "./context.js";
|
|
7
|
+
import { HasMomentContext, MomentContext } from "./moment.js";
|
|
7
8
|
import { PlainInput } from "./plain-input.js";
|
|
8
9
|
import { missingComponent, missingParts } from "./missing-slot.js";
|
|
9
10
|
import { withSettledGroups } from "./menu-groups.js";
|
|
10
11
|
import { DEFAULT_DESKTOP_QUERY, PhoneLine } from "../internal/phone-line.js";
|
|
11
|
-
import { browserConfirm } from "./ports.js";
|
|
12
|
+
import { browserConfirm, NOOP_TOAST } from "./ports.js";
|
|
12
13
|
export { useViews } from "./context.js";
|
|
13
14
|
const MISSING_COMMAND_PARTS = missingParts("Command");
|
|
14
15
|
const MISSING_CALENDAR_COMPONENT = missingComponent("Calendar");
|
|
15
|
-
|
|
16
|
+
const NO_SUBSCRIBE = () => () => { };
|
|
17
|
+
const IN_BROWSER = () => true;
|
|
18
|
+
const ON_SERVER = () => false;
|
|
19
|
+
export function ViewsProvider({ children, components, conventions, icons, ports, atoms, messages = resolveViewsMessage, presentation, desktopQuery = DEFAULT_DESKTOP_QUERY, sheetActions = "bar", escape, oneValue, sayRefusals = false, menus = "popover", gridButtons = "own", severalValues = "fit", gridCheckboxes = "own", fieldRowButtons = "own", fieldRowCheckboxes = "own", panelButtons = "own", bodyFrame = "views", gridBodyPlace = "under", selectionBar, datePicks, now, }) {
|
|
20
|
+
const [readNow, setReadNow] = useState(null);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (now)
|
|
23
|
+
return;
|
|
24
|
+
const read = () => setReadNow(new Date());
|
|
25
|
+
const onVisible = () => {
|
|
26
|
+
if (document.visibilityState !== "hidden")
|
|
27
|
+
read();
|
|
28
|
+
};
|
|
29
|
+
read();
|
|
30
|
+
const minute = setInterval(read, 60_000);
|
|
31
|
+
document.addEventListener("visibilitychange", onVisible);
|
|
32
|
+
return () => {
|
|
33
|
+
clearInterval(minute);
|
|
34
|
+
document.removeEventListener("visibilitychange", onVisible);
|
|
35
|
+
};
|
|
36
|
+
}, [now]);
|
|
37
|
+
const nowTime = now?.getTime();
|
|
38
|
+
const moment = useMemo(() => (nowTime != null ? new Date(nowTime) : readNow), [nowTime, readNow]);
|
|
16
39
|
const merged = useMemo(() => ({ ...DEFAULT_VIEWS_ATOMS, ...atoms }), [atoms]);
|
|
17
40
|
const settled = useMemo(() => ({
|
|
18
41
|
...components,
|
|
@@ -21,13 +44,31 @@ export function ViewsProvider({ children, components, conventions, icons, ports,
|
|
|
21
44
|
Command: components.Command ?? MISSING_COMMAND_PARTS,
|
|
22
45
|
Calendar: components.Calendar ?? MISSING_CALENDAR_COMPONENT,
|
|
23
46
|
}), [components]);
|
|
24
|
-
const
|
|
47
|
+
const hosted = useRef({});
|
|
48
|
+
const mounted = useSyncExternalStore(NO_SUBSCRIBE, IN_BROWSER, ON_SERVER);
|
|
49
|
+
const onHostReady = useCallback((p) => {
|
|
50
|
+
hosted.current = p;
|
|
51
|
+
}, []);
|
|
52
|
+
const resolved = useMemo(() => ({
|
|
53
|
+
...ports,
|
|
54
|
+
toast: ports.toast ?? {
|
|
55
|
+
success: (message, options) => (hosted.current.toast ?? NOOP_TOAST).success(message, options),
|
|
56
|
+
error: (message) => (hosted.current.toast ?? NOOP_TOAST).error(message),
|
|
57
|
+
info: (message) => (hosted.current.toast ?? NOOP_TOAST).info(message),
|
|
58
|
+
warning: (message, options) => (hosted.current.toast ?? NOOP_TOAST).warning(message, options),
|
|
59
|
+
},
|
|
60
|
+
confirm: ports.confirm ?? ((request) => (hosted.current.confirm ?? browserConfirm)(request)),
|
|
61
|
+
}), [ports]);
|
|
62
|
+
const PortsHost = components.PortsHost;
|
|
63
|
+
const host = mounted && PortsHost && (!ports.toast || !ports.confirm) ? (_jsx(PortsHost, { toast: !ports.toast, confirm: !ports.confirm, onReady: onHostReady })) : null;
|
|
25
64
|
const value = useMemo(() => ({
|
|
26
65
|
components: settled,
|
|
27
66
|
atoms: merged,
|
|
28
67
|
conventions,
|
|
29
68
|
icons,
|
|
30
69
|
ports: resolved,
|
|
70
|
+
confirmFallback: !ports.confirm && !components.PortsHost,
|
|
71
|
+
toastFallback: !ports.toast && !components.PortsHost,
|
|
31
72
|
messages,
|
|
32
73
|
presentation,
|
|
33
74
|
desktopQuery,
|
|
@@ -52,6 +93,9 @@ export function ViewsProvider({ children, components, conventions, icons, ports,
|
|
|
52
93
|
conventions,
|
|
53
94
|
icons,
|
|
54
95
|
resolved,
|
|
96
|
+
ports.confirm,
|
|
97
|
+
ports.toast,
|
|
98
|
+
components.PortsHost,
|
|
55
99
|
messages,
|
|
56
100
|
presentation,
|
|
57
101
|
desktopQuery,
|
|
@@ -71,5 +115,5 @@ export function ViewsProvider({ children, components, conventions, icons, ports,
|
|
|
71
115
|
selectionBar,
|
|
72
116
|
datePicks,
|
|
73
117
|
]);
|
|
74
|
-
return (_jsx(ViewsContext.Provider, { value: value, children: _jsx(PhoneLine.Provider, { value: desktopQuery, children: children }) }));
|
|
118
|
+
return (_jsx(ViewsContext.Provider, { value: value, children: _jsx(MomentContext.Provider, { value: moment, children: _jsx(HasMomentContext.Provider, { value: moment != null, children: _jsxs(PhoneLine.Provider, { value: desktopQuery, children: [children, host] }) }) }) }));
|
|
75
119
|
}
|