viewkitjs 0.31.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +198 -0
- package/MIGRATION.md +40 -6
- package/README.md +1 -1
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/query/evaluate.d.ts +7 -0
- package/fields/dist/query/exact-number.d.ts +8 -2
- package/fields/dist/query/exact-number.js +14 -1
- package/fields/dist/query/index.d.ts +2 -0
- package/fields/dist/query/index.js +2 -0
- package/fields/dist/query/list-request.d.ts +148 -0
- package/fields/dist/query/list-request.js +125 -0
- package/fields/dist/query/saved-view.d.ts +15 -0
- package/fields/dist/query/saved-view.js +11 -0
- package/fields/dist/query/settings.d.ts +9 -0
- package/fields/dist/query/settings.js +9 -0
- package/fields/dist/query/sort.js +13 -10
- package/fields/dist/registry.js +5 -1
- package/fields/dist/types.d.ts +4 -1
- package/fields/dist/zod.d.ts +5 -0
- package/fields/dist/zod.js +10 -1
- package/fields/docs/guides/contact-values.md +12 -0
- package/fields/docs/guides/field-types.md +1 -1
- package/fields/docs/guides/queries.md +3 -1
- package/fields/docs/reference/fields.md +1 -0
- package/fields/docs/reference/query.md +66 -0
- package/package.json +5 -1
- package/postgres/README.md +1 -0
- package/postgres/dist/check.js +4 -1
- package/postgres/dist/definitions/formula-forms.js +3 -1
- package/postgres/dist/definitions/money.js +2 -1
- package/postgres/dist/handler.d.ts +53 -0
- package/postgres/dist/handler.js +211 -0
- package/postgres/dist/ids.d.ts +1 -1
- package/postgres/dist/ids.js +19 -1
- package/postgres/dist/index.d.ts +1 -0
- package/postgres/dist/index.js +1 -0
- package/postgres/dist/limits.d.ts +3 -1
- package/postgres/dist/limits.js +1 -1
- package/postgres/dist/list-fields.d.ts +10 -0
- package/postgres/dist/list-fields.js +36 -0
- package/postgres/dist/page.js +6 -3
- package/postgres/dist/readable.d.ts +4 -0
- package/postgres/dist/readable.js +4 -0
- package/postgres/dist/refusals.d.ts +9 -2
- package/postgres/dist/refusals.js +6 -0
- package/postgres/dist/rules.d.ts +15 -1
- package/postgres/dist/rules.js +16 -0
- package/postgres/dist/sort.js +7 -2
- package/postgres/docs/guides/definitions.md +1 -1
- package/postgres/docs/guides/field-map.md +3 -3
- package/postgres/docs/guides/list-handler.md +99 -0
- package/postgres/docs/index.md +1 -0
- package/postgres/docs/reference/definitions.md +1 -1
- package/postgres/docs/reference/postgres.md +12 -4
- package/views/README.md +2 -2
- package/views/dist/atoms/RowMenu.d.ts +7 -0
- package/views/dist/atoms/RowMenu.js +18 -16
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +4 -3
- package/views/dist/atoms/carried.d.ts +5 -0
- package/views/dist/atoms/carried.js +7 -0
- package/views/dist/atoms/frame-parts.d.ts +6 -0
- package/views/dist/atoms/frame-parts.js +15 -0
- package/views/dist/atoms/types.d.ts +19 -7
- package/views/dist/cells/cell-title.d.ts +3 -1
- package/views/dist/cells/cell-title.js +2 -2
- package/views/dist/cells/cell-values.js +2 -2
- package/views/dist/contract.d.ts +56 -11
- package/views/dist/contract.js +148 -0
- package/views/dist/controls/alert-dialog/alert-dialog.js +2 -1
- package/views/dist/controls/atoms.d.ts +2 -0
- package/views/dist/controls/atoms.js +2 -0
- package/views/dist/controls/avatar/avatar.d.ts +3 -3
- package/views/dist/controls/avatar/avatar.js +1 -1
- package/views/dist/controls/avatar/tokens.d.ts +44 -0
- package/views/dist/controls/avatar/tokens.js +11 -0
- package/views/dist/controls/avatar.css +22 -5
- package/views/dist/controls/button/map-button.js +2 -0
- package/views/dist/controls/checkbox/checkbox.d.ts +3 -2
- package/views/dist/controls/checkbox/checkbox.js +2 -2
- package/views/dist/controls/choice/tokens.d.ts +0 -4
- package/views/dist/controls/choice/tokens.js +0 -1
- package/views/dist/controls/choice.css +3 -3
- package/views/dist/controls/compound-editor/compound-editor.d.ts +1 -1
- package/views/dist/controls/compound-editor/name-parts.js +4 -4
- package/views/dist/controls/compound-editor/place-parts.js +19 -19
- package/views/dist/controls/compound-editor/range-parts.js +14 -14
- package/views/dist/controls/compound-editor/row.d.ts +3 -1
- package/views/dist/controls/compound-editor/row.js +2 -2
- package/views/dist/controls/controls.d.ts +8 -0
- package/views/dist/controls/controls.js +12 -2
- package/views/dist/controls/customize/customize.js +37 -35
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
- package/views/dist/controls/customize/map-customize-body.js +5 -1
- package/views/dist/controls/date-editor/date-days.js +2 -2
- package/views/dist/controls/date-editor/date-editor.js +18 -18
- package/views/dist/controls/date-editor/date-parts.js +6 -6
- package/views/dist/controls/date-editor/map-calendar.js +1 -1
- package/views/dist/controls/date-editor.css +2 -2
- package/views/dist/controls/field/field.d.ts +22 -4
- package/views/dist/controls/field/field.js +63 -5
- package/views/dist/controls/field/tokens.d.ts +4 -0
- package/views/dist/controls/field/tokens.js +1 -0
- package/views/dist/controls/field.css +41 -16
- package/views/dist/controls/filter-editor/block.d.ts +2 -2
- package/views/dist/controls/filter-editor/block.js +5 -5
- package/views/dist/controls/filter-editor/filter-editor.js +31 -33
- package/views/dist/controls/filter-editor/how.d.ts +3 -1
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -3
- package/views/dist/controls/filter-editor/map-rules.js +1 -1
- package/views/dist/controls/filter-editor/parts.js +2 -1
- package/views/dist/controls/glyphs/glyphs.d.ts +10 -0
- package/views/dist/controls/glyphs/glyphs.js +173 -0
- package/views/dist/controls/group-editor/group-editor.js +15 -13
- package/views/dist/controls/index.d.ts +4 -1
- package/views/dist/controls/index.js +3 -1
- package/views/dist/controls/input/input.js +6 -3
- package/views/dist/controls/input/map-input.js +2 -0
- package/views/dist/controls/input/tokens.d.ts +4 -0
- package/views/dist/controls/input/tokens.js +1 -0
- package/views/dist/controls/input.css +31 -3
- package/views/dist/controls/internal/editor-parts.js +1 -1
- package/views/dist/controls/internal/icons.js +10 -0
- package/views/dist/controls/internal/keep-focus.d.ts +2 -0
- package/views/dist/controls/internal/keep-focus.js +17 -0
- package/views/dist/controls/internal/map-panel-controls.d.ts +8 -0
- package/views/dist/controls/internal/map-panel-controls.js +20 -0
- package/views/dist/controls/internal/panel-controls.d.ts +50 -0
- package/views/dist/controls/internal/panel-controls.js +197 -0
- package/views/dist/controls/internal/part-slot.d.ts +12 -0
- package/views/dist/controls/internal/part-slot.js +5 -0
- package/views/dist/controls/internal/watch-frame.d.ts +2 -0
- package/views/dist/controls/internal/watch-frame.js +33 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +1 -1
- package/views/dist/controls/links-editor/links-editor.js +27 -27
- package/views/dist/controls/markdown/map-markdown.d.ts +4 -0
- package/views/dist/controls/markdown/map-markdown.js +5 -0
- package/views/dist/controls/menu/map-menu.d.ts +2 -2
- package/views/dist/controls/menu/map-menu.js +15 -12
- package/views/dist/controls/menu/menu.d.ts +2 -0
- package/views/dist/controls/menu/menu.js +3 -3
- package/views/dist/controls/menu-list/menu-list.d.ts +17 -4
- package/views/dist/controls/menu-list/menu-list.js +27 -25
- package/views/dist/controls/modal/modal.js +5 -1
- package/views/dist/controls/notice/notice.d.ts +3 -1
- package/views/dist/controls/notice/notice.js +2 -2
- package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
- package/views/dist/controls/number-editor/number-editor.js +13 -13
- package/views/dist/controls/number-field/number-field.js +5 -3
- package/views/dist/controls/pane/pane.d.ts +4 -2
- package/views/dist/controls/pane/pane.js +6 -5
- package/views/dist/controls/phone-header/header-bar.d.ts +5 -1
- package/views/dist/controls/phone-header/header-bar.js +2 -2
- package/views/dist/controls/phone-header.css +11 -1
- package/views/dist/controls/picker/map-picker.js +3 -0
- package/views/dist/controls/picker/picker.d.ts +16 -0
- package/views/dist/controls/picker/picker.js +61 -40
- package/views/dist/controls/picker/rows.d.ts +4 -0
- package/views/dist/controls/picker.css +2 -0
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +4 -2
- package/views/dist/controls/popover/popover.js +2 -1
- package/views/dist/controls/quick-filters/quick-filters.js +4 -4
- package/views/dist/controls/radio/radio.d.ts +8 -3
- package/views/dist/controls/radio/radio.js +22 -5
- package/views/dist/controls/radio/tokens.d.ts +44 -0
- package/views/dist/controls/radio/tokens.js +11 -0
- package/views/dist/controls/radio.css +79 -1
- package/views/dist/controls/select/map-select.d.ts +3 -0
- package/views/dist/controls/select/map-select.js +8 -0
- package/views/dist/controls/select/select.d.ts +7 -0
- package/views/dist/controls/select/select.js +12 -6
- package/views/dist/controls/select/tokens.d.ts +8 -0
- package/views/dist/controls/select/tokens.js +2 -0
- package/views/dist/controls/select.css +17 -0
- package/views/dist/controls/setting-row/looks.d.ts +1 -1
- package/views/dist/controls/setting-row/looks.js +9 -4
- package/views/dist/controls/setting-row/setting-row.d.ts +45 -10
- package/views/dist/controls/setting-row/setting-row.js +82 -15
- package/views/dist/controls/setting-row/tokens.d.ts +74 -2
- package/views/dist/controls/setting-row/tokens.js +19 -1
- package/views/dist/controls/setting-row.css +135 -14
- package/views/dist/controls/sheet/bottom-sheet.d.ts +14 -2
- package/views/dist/controls/sheet/bottom-sheet.js +6 -3
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/sheet.css +4 -1
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +1 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +7 -3
- package/views/dist/controls/sort-editor/sort-editor.js +25 -26
- package/views/dist/controls/sort-editor.css +13 -2
- package/views/dist/controls/switch-row/tokens.d.ts +0 -12
- package/views/dist/controls/switch-row/tokens.js +0 -3
- package/views/dist/controls/switch-row.css +3 -7
- package/views/dist/controls/switch.css +17 -7
- package/views/dist/controls/tag/tag.d.ts +3 -1
- package/views/dist/controls/tag/tag.js +2 -2
- package/views/dist/controls/tag/tokens.d.ts +4 -0
- package/views/dist/controls/tag/tokens.js +1 -0
- package/views/dist/controls/tag-field/tag-field.d.ts +5 -1
- package/views/dist/controls/tag-field/tag-field.js +11 -5
- package/views/dist/controls/tag-field/tokens.d.ts +16 -0
- package/views/dist/controls/tag-field/tokens.js +4 -0
- package/views/dist/controls/tag-field.css +19 -0
- package/views/dist/controls/tag.css +2 -0
- package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
- package/views/dist/controls/text-editor/text-editor.js +8 -8
- package/views/dist/controls/toolbar/toolbar.d.ts +15 -3
- package/views/dist/controls/toolbar/toolbar.js +22 -15
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +14 -0
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +52 -0
- package/views/dist/controls/toolbar-button/toolbar-button.d.ts +1 -1
- package/views/dist/controls/toolbar-button/toolbar-button.js +2 -3
- package/views/dist/controls/toolbar-button.css +4 -0
- package/views/dist/controls/toolbar.css +5 -0
- package/views/dist/controls/values-editor/values-editor.d.ts +1 -1
- package/views/dist/controls/values-editor/values-editor.js +22 -22
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -0
- package/views/dist/controls/views-list/map-view-menu.js +25 -0
- package/views/dist/controls/views-list/map-views-list-body.d.ts +28 -1
- package/views/dist/controls/views-list/map-views-list-body.js +39 -21
- package/views/dist/controls/views-list/rules.d.ts +2 -0
- package/views/dist/controls/views-list/view-menu.d.ts +7 -0
- package/views/dist/controls/views-list/view-menu.js +33 -29
- package/views/dist/controls/views-list/views-list.js +4 -4
- package/views/dist/controls/views-list/words.d.ts +2 -0
- package/views/dist/controls/views-list/words.js +1 -1
- package/views/dist/editors/EditorPanel.js +3 -2
- package/views/dist/editors/edit-session.js +2 -5
- package/views/dist/field-row/FieldRow.d.ts +4 -2
- package/views/dist/field-row/FieldRow.js +80 -20
- package/views/dist/field-row/FieldRowLane.d.ts +7 -2
- package/views/dist/field-row/FieldRowLane.js +4 -3
- package/views/dist/field-row/editors/RowEditor.d.ts +12 -0
- package/views/dist/field-row/editors/RowEditor.js +31 -1
- package/views/dist/field-row/editors/RowValueListEditor.d.ts +5 -1
- package/views/dist/field-row/editors/RowValueListEditor.js +4 -1
- package/views/dist/field-row/field-row-button.d.ts +5 -0
- package/views/dist/field-row/field-row-button.js +2 -0
- package/views/dist/fields/binding.d.ts +3 -2
- package/views/dist/fields/binding.js +38 -5
- package/views/dist/fields/money.d.ts +5 -2
- package/views/dist/fields/money.js +14 -2
- package/views/dist/grid/chrome/GridColumnMenu.d.ts +4 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +3 -2
- package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -1
- package/views/dist/grid/chrome/GridGroupMenu.js +4 -3
- package/views/dist/grid/chrome/GridHeader.d.ts +4 -1
- package/views/dist/grid/chrome/GridHeader.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +6 -5
- package/views/dist/grid/chrome/GridRowCells.js +6 -9
- package/views/dist/grid/chrome/GridStructure.d.ts +4 -1
- package/views/dist/grid/chrome/GridStructure.js +4 -4
- package/views/dist/grid/chrome/GridTable.js +9 -3
- package/views/dist/grid/chrome/cell-clipboard.d.ts +4 -2
- package/views/dist/grid/chrome/cell-clipboard.js +2 -2
- package/views/dist/grid/chrome/cells.js +3 -1
- package/views/dist/grid/chrome/grid-column-menu-items.js +1 -1
- package/views/dist/grid/chrome/grid-row-menu-items.d.ts +27 -3
- package/views/dist/grid/chrome/grid-row-menu-items.js +93 -7
- package/views/dist/grid/chrome/grid-row-props.d.ts +7 -2
- package/views/dist/grid/chrome/grid-rows-menu.js +34 -6
- package/views/dist/grid/chrome/grid-table-props.d.ts +38 -7
- package/views/dist/grid/chrome/useGridBatchApi.d.ts +3 -1
- package/views/dist/grid/chrome/useGridBatchApi.js +4 -2
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +7 -2
- package/views/dist/grid/chrome/useGridKeyboard.js +43 -14
- package/views/dist/grid/chrome/useGridPendingReconciliation.js +1 -2
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +20 -7
- package/views/dist/grid/core/clipboard-model.d.ts +3 -1
- package/views/dist/grid/core/clipboard-model.js +9 -8
- package/views/dist/grid/core/commit-model.d.ts +20 -2
- package/views/dist/grid/core/editing-controller.d.ts +21 -0
- package/views/dist/grid/core/editing-controller.js +194 -42
- package/views/dist/grid/core/editing-model.d.ts +3 -0
- package/views/dist/grid/core/editing-model.js +3 -0
- package/views/dist/grid/core/edits-sink.d.ts +19 -0
- package/views/dist/grid/core/edits-sink.js +2 -0
- package/views/dist/grid/core/save-path.d.ts +24 -0
- package/views/dist/grid/core/save-path.js +122 -0
- package/views/dist/grid/core/spreadsheet-operations.d.ts +3 -0
- package/views/dist/grid/core/spreadsheet-operations.js +24 -1
- package/views/dist/grid/core/useGridEditing.d.ts +5 -0
- package/views/dist/grid/core/useGridEditing.js +6 -0
- package/views/dist/grid/index.d.ts +3 -2
- package/views/dist/grid/index.js +1 -0
- package/views/dist/internal/field-rows.d.ts +26 -0
- package/views/dist/internal/field-rows.js +8 -0
- package/views/dist/internal/page-close.d.ts +7 -0
- package/views/dist/internal/page-close.js +43 -0
- package/views/dist/list/answer.d.ts +40 -0
- package/views/dist/list/answer.js +43 -0
- package/views/dist/list/browser-views-store.d.ts +10 -0
- package/views/dist/list/browser-views-store.js +182 -0
- package/views/dist/list/bulk-bar.d.ts +7 -0
- package/views/dist/list/bulk-bar.js +10 -0
- package/views/dist/list/columns.d.ts +24 -0
- package/views/dist/list/columns.js +27 -0
- package/views/dist/list/edits.d.ts +19 -0
- package/views/dist/list/edits.js +56 -0
- package/views/dist/list/grid.d.ts +11 -0
- package/views/dist/list/grid.js +76 -0
- package/views/dist/list/index.d.ts +36 -0
- package/views/dist/list/index.js +11 -0
- package/views/dist/list/link.d.ts +8 -0
- package/views/dist/list/link.js +78 -0
- package/views/dist/list/list.d.ts +70 -0
- package/views/dist/list/list.js +14 -0
- package/views/dist/list/menu.d.ts +31 -0
- package/views/dist/list/menu.js +76 -0
- package/views/dist/list/parts.d.ts +6 -0
- package/views/dist/list/parts.js +66 -0
- package/views/dist/list/registry.d.ts +11 -0
- package/views/dist/list/registry.js +31 -0
- package/views/dist/list/root-base.d.ts +46 -0
- package/views/dist/list/root-base.js +137 -0
- package/views/dist/list/root.d.ts +41 -0
- package/views/dist/list/root.js +168 -0
- package/views/dist/list/slot.d.ts +14 -0
- package/views/dist/list/slot.js +22 -0
- package/views/dist/list/source-answers.d.ts +39 -0
- package/views/dist/list/source-answers.js +225 -0
- package/views/dist/list/source.d.ts +11 -0
- package/views/dist/list/source.js +31 -0
- package/views/dist/list/store.d.ts +119 -0
- package/views/dist/list/store.js +146 -0
- package/views/dist/list/toolbar.d.ts +7 -0
- package/views/dist/list/toolbar.js +371 -0
- package/views/dist/list/views-axis.d.ts +5 -0
- package/views/dist/list/views-axis.js +98 -0
- package/views/dist/list/views-store.d.ts +41 -0
- package/views/dist/list/views-store.js +1 -0
- package/views/dist/list/views.d.ts +72 -0
- package/views/dist/list/views.js +411 -0
- package/views/dist/model/column-capabilities.d.ts +13 -0
- package/views/dist/model/column-capabilities.js +23 -2
- package/views/dist/model/column-schema.d.ts +11 -1
- package/views/dist/model/preferences.js +1 -1
- package/views/dist/model/prefs-buckets.js +1 -1
- package/views/dist/model/view-rules.js +1 -0
- package/views/dist/panels/index.d.ts +3 -1
- package/views/dist/panels/index.js +1 -0
- package/views/dist/panels/model.d.ts +2 -0
- package/views/dist/panels/react/customize-body.js +1 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +47 -4
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +6 -326
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +17 -2
- package/views/dist/panels/react/toolbar/Toolbar.js +43 -23
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -4
- package/views/dist/panels/react/toolbar/ToolbarButton.js +7 -1
- package/views/dist/panels/react/toolbar/ToolbarFilter.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarNew.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
- package/views/dist/panels/react/toolbar/context.d.ts +20 -3
- package/views/dist/panels/react/toolbar/context.js +3 -1
- package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
- package/views/dist/panels/react/toolbar/panel-part.js +5 -3
- package/views/dist/panels/react/views-row/FoldingViewRow.d.ts +1 -1
- package/views/dist/panels/react/views-row/FoldingViewRow.js +15 -4
- package/views/dist/panels/react/views-row/PillGroup.d.ts +5 -2
- package/views/dist/panels/react/views-row/PillGroup.js +16 -7
- package/views/dist/panels/react/views-row/ViewPicker.js +2 -12
- package/views/dist/panels/react/views-row/ViewPickerRow.d.ts +4 -2
- package/views/dist/panels/react/views-row/ViewPickerRow.js +9 -5
- package/views/dist/panels/react.d.ts +2 -2
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/panels/toolbar/edit-view.d.ts +7 -1
- package/views/dist/panels/toolbar/edit-view.js +14 -0
- package/views/dist/panels/toolbar/model.d.ts +5 -0
- package/views/dist/panels/toolbar/model.js +7 -3
- package/views/dist/panels/view-state.d.ts +5 -3
- package/views/dist/panels/views-row/model.d.ts +19 -2
- package/views/dist/panels/views-row/model.js +14 -0
- package/views/dist/provider/ViewsProvider.d.ts +21 -8
- package/views/dist/provider/ViewsProvider.js +40 -5
- package/views/dist/provider/components.d.ts +102 -2
- package/views/dist/provider/components.js +1 -1
- package/views/dist/provider/context.d.ts +6 -2
- package/views/dist/provider/context.js +1 -1
- package/views/dist/provider/own-control.d.ts +4 -0
- package/views/dist/provider/own-control.js +7 -0
- package/views/dist/provider/ports.d.ts +19 -12
- package/views/dist/provider/ports.js +69 -1
- package/views/dist/provider/select-items.d.ts +3 -0
- package/views/dist/provider/select-items.js +6 -0
- package/views/dist/react.d.ts +4 -2
- package/views/dist/react.js +2 -0
- package/views/dist/styles.css +503 -136
- package/views/dist/styles.unlayered.css +503 -136
- package/views/docs/contract.md +292 -34
- package/views/docs/controls/avatar.md +11 -0
- package/views/docs/controls/choice.md +0 -1
- package/views/docs/controls/compound-editor.md +4 -0
- package/views/docs/controls/customize.md +6 -0
- package/views/docs/controls/date-editor.md +4 -0
- package/views/docs/controls/field.md +7 -0
- package/views/docs/controls/filter-editor.md +8 -0
- package/views/docs/controls/group-editor.md +6 -0
- package/views/docs/controls/input.md +5 -0
- package/views/docs/controls/links-editor.md +4 -0
- package/views/docs/controls/menu-list.md +8 -0
- package/views/docs/controls/menu.md +4 -0
- package/views/docs/controls/notice.md +4 -0
- package/views/docs/controls/number-editor.md +4 -0
- package/views/docs/controls/pane.md +4 -0
- package/views/docs/controls/picker.md +8 -0
- package/views/docs/controls/quick-filters.md +6 -0
- package/views/docs/controls/radio.md +20 -1
- package/views/docs/controls/select.md +10 -0
- package/views/docs/controls/setting-row.md +18 -0
- package/views/docs/controls/sheet.md +4 -0
- package/views/docs/controls/sort-editor.md +8 -0
- package/views/docs/controls/switch-row.md +0 -3
- package/views/docs/controls/tag-field.md +4 -0
- package/views/docs/controls/tag.md +1 -0
- package/views/docs/controls/text-editor.md +4 -0
- package/views/docs/controls/values-editor.md +4 -0
- package/views/docs/controls/views-list.md +6 -0
- package/views/docs/getting-started.md +2 -2
- package/views/docs/guides/atoms.md +2 -2
- package/views/docs/guides/columns.md +1 -1
- package/views/docs/guides/ports.md +1 -1
- package/views/docs/guides/the-grid.md +36 -9
- package/views/docs/guides/the-provider.md +22 -3
- package/views/docs/index.md +1 -0
- package/views/docs/reference/controls.md +41 -29
- package/views/docs/reference/editors-session.md +1 -1
- package/views/docs/reference/field-row.md +9 -1
- package/views/docs/reference/grid.md +15 -9
- package/views/docs/reference/list.md +357 -0
- package/views/docs/reference/looks.md +1 -1
- package/views/docs/reference/panels-react.md +17 -12
- package/views/docs/reference/panels.md +8 -5
- package/views/docs/reference/react.md +24 -16
- package/views/docs/reference/views.md +10 -6
- package/views/docs/reshaping.md +6 -1
- package/views/skills/views/SKILL.md +9 -6
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { ListPersonalLayer, ListRow, ListSettings, ListSettingsChange } from "viewkitjs/fields/query";
|
|
2
|
+
import type { ActivePanel } from "../panels/model.js";
|
|
3
|
+
import type { Pending } from "../panels/react/filter/editor-ctx.js";
|
|
4
|
+
import type { CollectionViewState } from "../panels/view-state.js";
|
|
5
|
+
import type { GridEditsState } from "../grid/core/edits-sink.js";
|
|
6
|
+
import type { ListColumn } from "../model/column-schema.js";
|
|
7
|
+
import type { ListAnswerState } from "./answer.js";
|
|
8
|
+
import type { ListViewsState } from "./views.js";
|
|
9
|
+
/** One list's state, as a part selects it (`useList((s) => …)`). */
|
|
10
|
+
export type ListState = {
|
|
11
|
+
/** The list's id (`ListRoot`'s). */
|
|
12
|
+
id: string;
|
|
13
|
+
/** The settings as the person edits them, their own layer over them, and the shared view this list shows (null:
|
|
14
|
+
* none). */
|
|
15
|
+
view: {
|
|
16
|
+
settings: ListSettings;
|
|
17
|
+
layer: ListPersonalLayer;
|
|
18
|
+
shared: CollectionViewState | null;
|
|
19
|
+
};
|
|
20
|
+
panels: {
|
|
21
|
+
/** The one panel open in this list, by its key; null, none. */
|
|
22
|
+
open: string | null;
|
|
23
|
+
/** The page each panel stands on, by its key: the open one's, or one set for a panel about to open. */
|
|
24
|
+
pages: Readonly<Record<string, ActivePanel>>;
|
|
25
|
+
/** The filter rule held until whole, shared by Filter on the row and the filter bar. */
|
|
26
|
+
held: Pending | null;
|
|
27
|
+
/** The filter bar shows (the toolbar says, as it draws). */
|
|
28
|
+
barShown: boolean;
|
|
29
|
+
/** Clear and Save stand in Customize's foot, not at the bar's end (the toolbar says, as it draws). */
|
|
30
|
+
footHere: boolean;
|
|
31
|
+
sortFilter: "right" | "bar";
|
|
32
|
+
bar: "added" | "always";
|
|
33
|
+
};
|
|
34
|
+
/** The picked rows: their ids, or every matching row (`all`), and how many (null: every matching row, before the
|
|
35
|
+
* list knows its total). */
|
|
36
|
+
selection: {
|
|
37
|
+
ids: readonly string[];
|
|
38
|
+
all: boolean;
|
|
39
|
+
count: number | null;
|
|
40
|
+
};
|
|
41
|
+
/** The list's saved views where the root keeps them through a store (VK-196); null in memory mode. */
|
|
42
|
+
views: ListViewsState | null;
|
|
43
|
+
/** The list's columns, from its fields (the root's `fields`); null where the root holds none. */
|
|
44
|
+
columns: ListColumn<ListRow>[] | null;
|
|
45
|
+
/** The rows the list shows; null where the root holds none (no `rows`). */
|
|
46
|
+
answer: ListAnswerState | null;
|
|
47
|
+
/** The grid's edits: a write still out, and whether an undo or a redo has anything to take. */
|
|
48
|
+
edits: GridEditsState;
|
|
49
|
+
/** A change to the settings, handed to the app. */
|
|
50
|
+
setSettings: (change: ListSettingsChange) => void;
|
|
51
|
+
/** A patch to the person's layer, handed to the app. */
|
|
52
|
+
setLayer: (patch: ListPersonalLayer) => void;
|
|
53
|
+
/** Opens a panel and closes any other; on `page` where handed, else on the page it holds. */
|
|
54
|
+
openPanel: (key: string, page?: ActivePanel) => void;
|
|
55
|
+
/** Closes a panel, if it is the one open; its page, or a page waiting for it, is forgotten. */
|
|
56
|
+
closePanel: (key: string) => void;
|
|
57
|
+
/** A panel's page: the open one's, or kept for a panel until another opens. */
|
|
58
|
+
setPage: (key: string, page: ActivePanel) => void;
|
|
59
|
+
hold: (held: Pending | null) => void;
|
|
60
|
+
/** Picks these rows, or every matching row (`"all"`); `[]` picks none. */
|
|
61
|
+
select: (ids: readonly string[] | "all") => void;
|
|
62
|
+
/** The shared view's Save for everyone; nothing without a shared view. */
|
|
63
|
+
saveView: () => void;
|
|
64
|
+
/** The shared view's Reset; nothing without a shared view. */
|
|
65
|
+
resetView: () => void;
|
|
66
|
+
/** Takes back the list's last edit; nothing until the list holds edits. */
|
|
67
|
+
undo: () => void;
|
|
68
|
+
/** Puts back the last edit undone; nothing until there is one. */
|
|
69
|
+
redo: () => void;
|
|
70
|
+
/** The list's next page, where its rows come from a source and there is one; nothing in memory. */
|
|
71
|
+
loadMore: () => void;
|
|
72
|
+
/** A group's next page, likewise. */
|
|
73
|
+
loadGroup: (key: string) => void;
|
|
74
|
+
};
|
|
75
|
+
/** What the app hands the root: synced in on every render. */
|
|
76
|
+
export type ListSync = {
|
|
77
|
+
settings: ListSettings;
|
|
78
|
+
layer: ListPersonalLayer;
|
|
79
|
+
onChange: (change: ListSettingsChange) => void;
|
|
80
|
+
onLayerChange: (patch: ListPersonalLayer) => void;
|
|
81
|
+
view?: CollectionViewState;
|
|
82
|
+
sortFilter?: "right" | "bar";
|
|
83
|
+
bar?: "added" | "always";
|
|
84
|
+
};
|
|
85
|
+
export type ListStore = {
|
|
86
|
+
get: () => ListState;
|
|
87
|
+
subscribe: (listener: () => void) => () => void;
|
|
88
|
+
/** Takes the app's latest props without telling anyone; `flush` tells. */
|
|
89
|
+
sync: (props: ListSync) => void;
|
|
90
|
+
flush: () => void;
|
|
91
|
+
/** Takes the root's latest columns and answer, worked out as it renders, without telling anyone; `flush` tells. */
|
|
92
|
+
syncData: (data: {
|
|
93
|
+
columns: ListColumn<ListRow>[] | null;
|
|
94
|
+
answer: ListAnswerState | null;
|
|
95
|
+
}) => void;
|
|
96
|
+
/** The toolbar's published bar (`barShown`, `footHere`), and the root's saved views. The ready List widens it with its
|
|
97
|
+
* answer and edits. */
|
|
98
|
+
patch: (patch: {
|
|
99
|
+
panels?: Partial<Pick<ListState["panels"], "barShown" | "footHere">>;
|
|
100
|
+
views?: ListViewsState | null;
|
|
101
|
+
columns?: ListColumn<ListRow>[] | null;
|
|
102
|
+
answer?: ListAnswerState | null;
|
|
103
|
+
edits?: GridEditsState;
|
|
104
|
+
selection?: ListState["selection"];
|
|
105
|
+
}) => void;
|
|
106
|
+
/** The grid wires its edits' undo and redo here, and its selection's `select`. */
|
|
107
|
+
wire: (handlers: Wired) => void;
|
|
108
|
+
};
|
|
109
|
+
type Wired = {
|
|
110
|
+
undo?: () => void;
|
|
111
|
+
redo?: () => void;
|
|
112
|
+
select?: (ids: readonly string[] | "all") => void;
|
|
113
|
+
/** Every matching row picked, where the rows in hand aren't all of them (a source's). */
|
|
114
|
+
selectAll?: () => void;
|
|
115
|
+
loadMore?: () => void;
|
|
116
|
+
loadGroup?: (key: string) => void;
|
|
117
|
+
};
|
|
118
|
+
export declare function createListStore(id: string, props: ListSync): ListStore;
|
|
119
|
+
export {};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
const NO_EDITS = { saving: false, canUndo: false, canRedo: false };
|
|
2
|
+
const sameKeys = (a, b) => Object.keys(b).every((key) => Object.is(a[key], b[key]));
|
|
3
|
+
const sameIds = (a, b) => a.length === b.length && a.every((id, i) => id === b[i]);
|
|
4
|
+
const sameSelection = (a, b) => a.all === b.all && a.count === b.count && sameIds(a.ids, b.ids);
|
|
5
|
+
export function createListStore(id, props) {
|
|
6
|
+
let latest = props;
|
|
7
|
+
let wired = {};
|
|
8
|
+
const listeners = new Set();
|
|
9
|
+
let dirty = false;
|
|
10
|
+
const viewOf = (from) => ({
|
|
11
|
+
settings: from.settings,
|
|
12
|
+
layer: from.layer,
|
|
13
|
+
shared: from.view ?? null,
|
|
14
|
+
});
|
|
15
|
+
const actions = {
|
|
16
|
+
setSettings: (change) => latest.onChange(change),
|
|
17
|
+
setLayer: (patch) => latest.onLayerChange(patch),
|
|
18
|
+
openPanel: (key, page) => {
|
|
19
|
+
const { panels } = state;
|
|
20
|
+
const kept = page ?? panels.pages[key];
|
|
21
|
+
if (panels.open === key && panels.pages[key] === kept)
|
|
22
|
+
return;
|
|
23
|
+
write({ panels: { ...panels, open: key, pages: kept ? { [key]: kept } : {} } });
|
|
24
|
+
},
|
|
25
|
+
closePanel: (key) => {
|
|
26
|
+
const { panels } = state;
|
|
27
|
+
if (panels.open !== key && !(key in panels.pages))
|
|
28
|
+
return;
|
|
29
|
+
const { [key]: _forgotten, ...waiting } = panels.pages;
|
|
30
|
+
write({ panels: { ...panels, open: panels.open === key ? null : panels.open, pages: waiting } });
|
|
31
|
+
},
|
|
32
|
+
setPage: (key, page) => {
|
|
33
|
+
const { panels } = state;
|
|
34
|
+
if (panels.pages[key] === page)
|
|
35
|
+
return;
|
|
36
|
+
write({ panels: { ...panels, pages: { ...panels.pages, [key]: page } } });
|
|
37
|
+
},
|
|
38
|
+
hold: (held) => {
|
|
39
|
+
if (state.panels.held === held)
|
|
40
|
+
return;
|
|
41
|
+
write({ panels: { ...state.panels, held } });
|
|
42
|
+
},
|
|
43
|
+
select: (ids) => {
|
|
44
|
+
if (ids === "all" && wired.selectAll)
|
|
45
|
+
return wired.selectAll();
|
|
46
|
+
if (wired.select)
|
|
47
|
+
return wired.select(ids);
|
|
48
|
+
const { selection } = state;
|
|
49
|
+
if (ids === "all" ? selection.all : !selection.all && sameIds(selection.ids, ids))
|
|
50
|
+
return;
|
|
51
|
+
write({ selection: ids === "all" ? { ids: [], all: true, count: null } : { ids, all: false, count: ids.length } });
|
|
52
|
+
},
|
|
53
|
+
saveView: () => latest.view?.onPublish(),
|
|
54
|
+
resetView: () => latest.view?.onReset(),
|
|
55
|
+
undo: () => wired.undo?.(),
|
|
56
|
+
redo: () => wired.redo?.(),
|
|
57
|
+
loadMore: () => wired.loadMore?.(),
|
|
58
|
+
loadGroup: (key) => wired.loadGroup?.(key),
|
|
59
|
+
};
|
|
60
|
+
const data = {
|
|
61
|
+
id,
|
|
62
|
+
view: viewOf(props),
|
|
63
|
+
panels: {
|
|
64
|
+
open: null,
|
|
65
|
+
pages: {},
|
|
66
|
+
held: null,
|
|
67
|
+
barShown: false,
|
|
68
|
+
footHere: false,
|
|
69
|
+
sortFilter: props.sortFilter ?? "right",
|
|
70
|
+
bar: props.bar ?? "added",
|
|
71
|
+
},
|
|
72
|
+
selection: { ids: [], all: false, count: 0 },
|
|
73
|
+
views: null,
|
|
74
|
+
columns: null,
|
|
75
|
+
answer: null,
|
|
76
|
+
edits: NO_EDITS,
|
|
77
|
+
};
|
|
78
|
+
let state = { ...data, ...actions };
|
|
79
|
+
function swap(next) {
|
|
80
|
+
state = { ...state, ...next };
|
|
81
|
+
}
|
|
82
|
+
function write(next) {
|
|
83
|
+
swap(next);
|
|
84
|
+
for (const listener of [...listeners])
|
|
85
|
+
listener();
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
get: () => state,
|
|
89
|
+
subscribe: (listener) => {
|
|
90
|
+
listeners.add(listener);
|
|
91
|
+
return () => listeners.delete(listener);
|
|
92
|
+
},
|
|
93
|
+
sync: (next) => {
|
|
94
|
+
latest = next;
|
|
95
|
+
const changed = {};
|
|
96
|
+
const view = viewOf(next);
|
|
97
|
+
if (!sameKeys(state.view, view))
|
|
98
|
+
changed.view = view;
|
|
99
|
+
const panels = { sortFilter: next.sortFilter ?? "right", bar: next.bar ?? "added" };
|
|
100
|
+
if (!sameKeys(state.panels, panels))
|
|
101
|
+
changed.panels = { ...state.panels, ...panels };
|
|
102
|
+
if (Object.keys(changed).length === 0)
|
|
103
|
+
return;
|
|
104
|
+
swap(changed);
|
|
105
|
+
dirty = true;
|
|
106
|
+
},
|
|
107
|
+
syncData: (data) => {
|
|
108
|
+
const changed = {};
|
|
109
|
+
if (!Object.is(state.columns, data.columns))
|
|
110
|
+
changed.columns = data.columns;
|
|
111
|
+
if (!Object.is(state.answer, data.answer))
|
|
112
|
+
changed.answer = data.answer;
|
|
113
|
+
if (Object.keys(changed).length === 0)
|
|
114
|
+
return;
|
|
115
|
+
swap(changed);
|
|
116
|
+
dirty = true;
|
|
117
|
+
},
|
|
118
|
+
flush: () => {
|
|
119
|
+
if (!dirty)
|
|
120
|
+
return;
|
|
121
|
+
dirty = false;
|
|
122
|
+
for (const listener of [...listeners])
|
|
123
|
+
listener();
|
|
124
|
+
},
|
|
125
|
+
patch: (patch) => {
|
|
126
|
+
const next = {};
|
|
127
|
+
if (patch.panels && !sameKeys(state.panels, patch.panels))
|
|
128
|
+
next.panels = { ...state.panels, ...patch.panels };
|
|
129
|
+
if (patch.views !== undefined && !Object.is(state.views, patch.views))
|
|
130
|
+
next.views = patch.views;
|
|
131
|
+
if (patch.columns !== undefined && !Object.is(state.columns, patch.columns))
|
|
132
|
+
next.columns = patch.columns;
|
|
133
|
+
if (patch.answer !== undefined && !Object.is(state.answer, patch.answer))
|
|
134
|
+
next.answer = patch.answer;
|
|
135
|
+
if (patch.edits && !sameKeys(state.edits, patch.edits))
|
|
136
|
+
next.edits = patch.edits;
|
|
137
|
+
if (patch.selection && !sameSelection(state.selection, patch.selection))
|
|
138
|
+
next.selection = patch.selection;
|
|
139
|
+
if (Object.keys(next).length > 0)
|
|
140
|
+
write(next);
|
|
141
|
+
},
|
|
142
|
+
wire: (handlers) => {
|
|
143
|
+
wired = { ...wired, ...handlers };
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { ReadyToolbarProps } from "../panels/react/toolbar/ReadyToolbar.js";
|
|
3
|
+
/** `ReadyToolbar`'s props but those the root holds: the settings and the layer with their callbacks, the shared view,
|
|
4
|
+
* `sortFilter` and `bar`. `columns`, `groupHeads` and `filterData` default to the root's, where it holds a list's
|
|
5
|
+
* fields and rows; handed, they win. */
|
|
6
|
+
export type ListToolbarProps<Row> = Omit<ReadyToolbarProps<Row>, "settings" | "layer" | "onChange" | "onLayerChange" | "view" | "sortFilter" | "bar" | "columns"> & Partial<Pick<ReadyToolbarProps<Row>, "columns">>;
|
|
7
|
+
export declare function ListToolbar<Row>(props: ListToolbarProps<Row>): ReactNode;
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { settingsChange } from "viewkitjs/fields/query";
|
|
4
|
+
import { useLayoutEffect } from "react";
|
|
5
|
+
import { barItemsOf } from "../filters/filter-tree.js";
|
|
6
|
+
import { useViews } from "../provider/context.js";
|
|
7
|
+
import { useDesktop } from "../provider/desktop.js";
|
|
8
|
+
import { getViewOptionAvailability } from "../panels/availability.js";
|
|
9
|
+
import { settingsPanels } from "../panels/settings/settings-panels.js";
|
|
10
|
+
import { settingsCleared } from "../panels/toolbar/clear.js";
|
|
11
|
+
import { countsToggle, groupShown, showCountsChange, showCountsOf } from "../panels/toolbar/counts.js";
|
|
12
|
+
import { withEditView, withViewMenu } from "../panels/toolbar/edit-view.js";
|
|
13
|
+
import { splitViewAxes } from "../panels/views-row/model.js";
|
|
14
|
+
import { heldStands } from "../panels/react/filter/editor-ctx.js";
|
|
15
|
+
import { Toolbar, ToolbarSeparator } from "../panels/react/toolbar/Toolbar.js";
|
|
16
|
+
import { ToolbarFilter } from "../panels/react/toolbar/ToolbarFilter.js";
|
|
17
|
+
import { ToolbarFilterAdd } from "../panels/react/toolbar/ToolbarFilterAdd.js";
|
|
18
|
+
import { ToolbarFilters, foldableFilters } from "../panels/react/toolbar/ToolbarFilters.js";
|
|
19
|
+
import { ToolbarNew } from "../panels/react/toolbar/ToolbarNew.js";
|
|
20
|
+
import { ToolbarOptions } from "../panels/react/toolbar/ToolbarOptions.js";
|
|
21
|
+
import { ToolbarQuickFilters } from "../panels/react/toolbar/ToolbarQuickFilters.js";
|
|
22
|
+
import { ToolbarSave } from "../panels/react/toolbar/ToolbarSave.js";
|
|
23
|
+
import { ToolbarSearch } from "../panels/react/toolbar/ToolbarSearch.js";
|
|
24
|
+
import { ToolbarSort } from "../panels/react/toolbar/ToolbarSort.js";
|
|
25
|
+
import { ToolbarSortPill } from "../panels/react/toolbar/ToolbarSortPill.js";
|
|
26
|
+
import { ToolbarAdvancedFilters } from "../panels/react/toolbar/ToolbarAdvancedFilters.js";
|
|
27
|
+
import { ToolbarViews } from "../panels/react/toolbar/ToolbarViews.js";
|
|
28
|
+
import { applyParts } from "./parts.js";
|
|
29
|
+
import { useList, useListPanel, useListStore } from "./root-base.js";
|
|
30
|
+
import { useListViewsAxis } from "./views-axis.js";
|
|
31
|
+
export function ListToolbar(props) {
|
|
32
|
+
const { views: viewsHanded, viewsLayout, onAdd, addItems, addLabel, fieldEditor, searchPlaceholder, searching, hosts, narrow, className, viewName, onRenameView, onCopyLink, onExport, exportCount, menus, toolbarParts, } = props;
|
|
33
|
+
const storeViews = useListViewsAxis(props.layouts);
|
|
34
|
+
const rootColumns = useList((s) => s.columns);
|
|
35
|
+
const answer = useList((s) => s.answer);
|
|
36
|
+
const views = viewsHanded ?? storeViews;
|
|
37
|
+
const store = useListStore();
|
|
38
|
+
const settings = useList((s) => s.view.settings);
|
|
39
|
+
const layer = useList((s) => s.view.layer);
|
|
40
|
+
const onChange = useList((s) => s.setSettings);
|
|
41
|
+
const onLayerChange = useList((s) => s.setLayer);
|
|
42
|
+
const view = useList((s) => s.view.shared) ?? undefined;
|
|
43
|
+
const sortFilter = useList((s) => s.panels.sortFilter);
|
|
44
|
+
const bar = useList((s) => s.panels.bar);
|
|
45
|
+
const customizeOwn = {
|
|
46
|
+
...(viewName !== undefined && { viewName }),
|
|
47
|
+
...(onRenameView && { onRenameView }),
|
|
48
|
+
...(onCopyLink && { onCopyLink }),
|
|
49
|
+
...(onExport && { onExport }),
|
|
50
|
+
...(exportCount !== undefined && { exportCount }),
|
|
51
|
+
};
|
|
52
|
+
const { icons, messages, conventions } = useViews();
|
|
53
|
+
const desktop = useDesktop();
|
|
54
|
+
const phone = props.phone ?? !desktop;
|
|
55
|
+
const options = useListPanel("options");
|
|
56
|
+
const sortState = useListPanel("sort");
|
|
57
|
+
const filterState = useListPanel("filter");
|
|
58
|
+
const sortAdd = useListPanel("sort-add");
|
|
59
|
+
const filterAdd = useListPanel("filter-add");
|
|
60
|
+
const quickOwn = useListPanel("quick");
|
|
61
|
+
const quickState = props.quickFiltersOpen !== undefined && props.onQuickFiltersOpenChange
|
|
62
|
+
? { open: props.quickFiltersOpen, onOpenChange: props.onQuickFiltersOpenChange }
|
|
63
|
+
: quickOwn;
|
|
64
|
+
const held = useList((s) => s.panels.held);
|
|
65
|
+
const setHeld = useList((s) => s.hold);
|
|
66
|
+
const show = showCountsOf(settings);
|
|
67
|
+
const setShow = (next) => {
|
|
68
|
+
const change = showCountsChange(settings, next);
|
|
69
|
+
if (Object.keys(change).length > 0)
|
|
70
|
+
onChange(change);
|
|
71
|
+
};
|
|
72
|
+
const several = props.severalSorts ?? true;
|
|
73
|
+
const { toolbarParts: _placed, ...settingsProps } = props;
|
|
74
|
+
const input = {
|
|
75
|
+
...settingsProps,
|
|
76
|
+
columns: props.columns ?? rootColumns ?? [],
|
|
77
|
+
groupHeads: props.groupHeads ?? answer?.groupHeads,
|
|
78
|
+
filterData: props.filterData ?? answer?.filterValues,
|
|
79
|
+
settings,
|
|
80
|
+
layer,
|
|
81
|
+
onChange,
|
|
82
|
+
onLayerChange,
|
|
83
|
+
severalSorts: several,
|
|
84
|
+
filterGroups: props.filterGroups ?? true,
|
|
85
|
+
resolve: props.resolve ?? messages,
|
|
86
|
+
conventions: props.conventions ?? conventions,
|
|
87
|
+
};
|
|
88
|
+
const panels = settingsPanels(input);
|
|
89
|
+
const counts = countsToggle(views, props.toggles, show, setShow, messages);
|
|
90
|
+
const toggles = counts ? [...(props.toggles ?? []), counts] : props.toggles;
|
|
91
|
+
const inputs = {
|
|
92
|
+
filters: panels.filters,
|
|
93
|
+
sort: panels.sort,
|
|
94
|
+
sorts: panels.sorts,
|
|
95
|
+
filterTree: panels.filterTree,
|
|
96
|
+
group: groupShown(panels.group, panels.layout, phone),
|
|
97
|
+
layout: panels.layout,
|
|
98
|
+
toggles,
|
|
99
|
+
};
|
|
100
|
+
const clear = (scope) => () => {
|
|
101
|
+
const change = settingsCleared(input, scope, { phone });
|
|
102
|
+
if (change)
|
|
103
|
+
onChange(change);
|
|
104
|
+
};
|
|
105
|
+
const Edit = icons.options;
|
|
106
|
+
const editable = getViewOptionAvailability(inputs).desktop
|
|
107
|
+
? withEditView(views, {
|
|
108
|
+
key: "edit-view",
|
|
109
|
+
label: messages({ key: "views.panels.edit-view" }),
|
|
110
|
+
icon: _jsx(Edit, { className: "h-4 w-4" }),
|
|
111
|
+
onSelect: () => options.onOpenChange(true),
|
|
112
|
+
})
|
|
113
|
+
: views;
|
|
114
|
+
const shownViews = withViewMenu(editable, menus?.view);
|
|
115
|
+
const ownNew = !addItems && onAdd ? { key: "new", label: addLabel ?? messages({ key: "views.panels.toolbar-new" }), onSelect: onAdd } : null;
|
|
116
|
+
const shapedNew = menus?.add ? menus.add(addItems ?? (ownNew ? [ownNew] : [])) : addItems;
|
|
117
|
+
const newItems = ownNew && shapedNew?.length === 1 && shapedNew[0] === ownNew ? undefined : shapedNew;
|
|
118
|
+
const search = settings.search ?? "";
|
|
119
|
+
const searchNode = (_jsx(ToolbarSearch, { value: search, placeholder: searchPlaceholder, searching: searching, onChange: (next) => {
|
|
120
|
+
const change = settingsChange(settings, { ...settings, search: next === "" ? undefined : next });
|
|
121
|
+
if (Object.keys(change).length > 0)
|
|
122
|
+
onChange(change);
|
|
123
|
+
} }));
|
|
124
|
+
const sortNode = several && panels.sorts ? (_jsx(ToolbarSortPill, { sorts: panels.sorts, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort, addAfter: props.addAfter })) : (_jsx(ToolbarSort, { sort: panels.sort, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort }));
|
|
125
|
+
const filterNode = (_jsx(ToolbarFilter, { filters: panels.filters, filterTree: panels.filterTree, onClear: clear("filters"), open: filterState.open, onOpenChange: filterState.onOpenChange, page: filterState.page, onPageChange: filterState.onPageChange, host: hosts?.filter }));
|
|
126
|
+
const holdCounts = answer?.holdCounts;
|
|
127
|
+
const quick = props.quickFilters?.fields.length
|
|
128
|
+
? {
|
|
129
|
+
...props.quickFilters,
|
|
130
|
+
showCounts: props.quickFilters.showCounts ?? show,
|
|
131
|
+
...(holdCounts && {
|
|
132
|
+
fields: props.quickFilters.fields.map((field) => field.counts === undefined && holdCounts[field.key] ? { ...field, counts: holdCounts[field.key] } : field),
|
|
133
|
+
}),
|
|
134
|
+
}
|
|
135
|
+
: null;
|
|
136
|
+
const quickNode = quick ? (_jsx(ToolbarQuickFilters, { quickFilters: quick, open: quickState.open, onOpenChange: quickState.onOpenChange, host: hosts?.quick })) : null;
|
|
137
|
+
const arrangement = props.arrangement ?? "kit";
|
|
138
|
+
const kit = arrangement === "kit";
|
|
139
|
+
const placed = (parts) => (toolbarParts ? applyParts(parts, toolbarParts, { arrangement, phone }) : parts);
|
|
140
|
+
const { viewAxes, stackedAxes } = splitViewAxes(shownViews, viewsLayout);
|
|
141
|
+
const tree = panels.filterTree;
|
|
142
|
+
const mihais = sortFilter === "right" && !phone;
|
|
143
|
+
const always = bar === "always";
|
|
144
|
+
const filtered = tree ? barItemsOf(tree.tree).length > 0 || !!heldStands(held, tree.tree) : false;
|
|
145
|
+
const barShown = always || !!stackedAxes || filtered;
|
|
146
|
+
const footHere = phone || (mihais && !barShown);
|
|
147
|
+
const barPublished = kit && !phone && (sortFilter === "bar" || barShown);
|
|
148
|
+
const footPublished = kit ? footHere : true;
|
|
149
|
+
useLayoutEffect(() => store.patch({ panels: { barShown: barPublished, footHere: footPublished } }), [store, barPublished, footPublished]);
|
|
150
|
+
if (kit) {
|
|
151
|
+
const clearable = !view && settingsCleared(input, "options", { phone }) !== null;
|
|
152
|
+
const tabs = !phone && viewAxes?.length === 1 ? Math.max(0, viewAxes[0].options.length - 1) : 0;
|
|
153
|
+
const Sort = icons.sort;
|
|
154
|
+
const Filter = icons.filter;
|
|
155
|
+
const QuickGlyph = icons.filterCategory;
|
|
156
|
+
const hasFilter = panels.filters.length > 0;
|
|
157
|
+
const filterMenu = {
|
|
158
|
+
label: messages({ key: "views.panels.filter" }),
|
|
159
|
+
icon: _jsx(Filter, { className: "h-4 w-4" }),
|
|
160
|
+
onSelect: () => filterState.onOpenChange(true),
|
|
161
|
+
};
|
|
162
|
+
const filterParts = tree && !phone
|
|
163
|
+
? [
|
|
164
|
+
{
|
|
165
|
+
key: "filters",
|
|
166
|
+
line: 2,
|
|
167
|
+
...(barItemsOf(tree.tree).length === 0 && !heldStands(held, tree.tree)
|
|
168
|
+
? { shed: true, fold: true, menu: filterMenu }
|
|
169
|
+
: { filters: foldableFilters(tree.tree, held) }),
|
|
170
|
+
node: (_jsx(ToolbarFilters, { filterTree: tree, open: filterState.open, onOpenChange: filterState.onOpenChange, held: held, onHeldChange: setHeld, host: hosts?.filter })),
|
|
171
|
+
},
|
|
172
|
+
]
|
|
173
|
+
: [
|
|
174
|
+
{ key: "filter", line: 2, shed: true, fold: true, menu: filterMenu, node: filterNode },
|
|
175
|
+
...(tree
|
|
176
|
+
? [
|
|
177
|
+
{
|
|
178
|
+
key: "advanced-filters",
|
|
179
|
+
line: 2,
|
|
180
|
+
node: _jsx(ToolbarAdvancedFilters, { filterTree: tree, host: hosts?.filter }),
|
|
181
|
+
},
|
|
182
|
+
]
|
|
183
|
+
: []),
|
|
184
|
+
];
|
|
185
|
+
const kitParts = [
|
|
186
|
+
...(shownViews
|
|
187
|
+
? [{ key: "views", tabs, node: _jsx(ToolbarViews, { views: shownViews, viewsLayout: viewsLayout, showCounts: show }) }]
|
|
188
|
+
: []),
|
|
189
|
+
...(shownViews && stackedAxes && !phone
|
|
190
|
+
? [
|
|
191
|
+
{
|
|
192
|
+
key: "views-stacked",
|
|
193
|
+
line: 2,
|
|
194
|
+
node: _jsx(ToolbarViews, { views: shownViews, viewsLayout: viewsLayout, showCounts: show, stacked: true }),
|
|
195
|
+
},
|
|
196
|
+
]
|
|
197
|
+
: []),
|
|
198
|
+
{
|
|
199
|
+
key: "options",
|
|
200
|
+
shed: true,
|
|
201
|
+
fold: true,
|
|
202
|
+
menu: {
|
|
203
|
+
label: messages({ key: "views.panels.toolbar-options" }),
|
|
204
|
+
icon: _jsx(Edit, { className: "h-4 w-4" }),
|
|
205
|
+
onSelect: () => options.onOpenChange(true),
|
|
206
|
+
},
|
|
207
|
+
node: (_jsx(ToolbarOptions, { ...inputs, view: view, viewFoot: !footHere ? "none" : view ? undefined : "kit", footClear: footHere && clearable ? clear("options") : undefined, fieldEditor: fieldEditor, onClear: view ? view.onReset : clear("options"), open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: hosts?.options, ...customizeOwn })),
|
|
208
|
+
},
|
|
209
|
+
...(quickNode
|
|
210
|
+
? [
|
|
211
|
+
{
|
|
212
|
+
key: "quick",
|
|
213
|
+
side: "end",
|
|
214
|
+
shed: true,
|
|
215
|
+
fold: true,
|
|
216
|
+
menu: {
|
|
217
|
+
label: quick?.label ?? messages({ key: "views.panels.quick-filters" }),
|
|
218
|
+
icon: _jsx(QuickGlyph, { className: "h-4 w-4" }),
|
|
219
|
+
onSelect: () => quickState.onOpenChange(true),
|
|
220
|
+
},
|
|
221
|
+
node: quickNode,
|
|
222
|
+
},
|
|
223
|
+
]
|
|
224
|
+
: []),
|
|
225
|
+
{ key: "search", side: "end", role: "search", words: "icon", node: searchNode },
|
|
226
|
+
{ key: "new", side: "end", shed: true, node: _jsx(ToolbarNew, { onAdd: onAdd, items: newItems, label: addLabel }) },
|
|
227
|
+
{
|
|
228
|
+
key: "sort",
|
|
229
|
+
line: 2,
|
|
230
|
+
shed: true,
|
|
231
|
+
fold: true,
|
|
232
|
+
menu: {
|
|
233
|
+
label: messages({ key: "views.panels.sort" }),
|
|
234
|
+
icon: _jsx(Sort, { className: "h-4 w-4" }),
|
|
235
|
+
onSelect: () => sortState.onOpenChange(true),
|
|
236
|
+
},
|
|
237
|
+
node: sortNode,
|
|
238
|
+
},
|
|
239
|
+
...(hasFilter ? [{ key: "sep", line: 2, role: "separator", node: _jsx(ToolbarSeparator, {}) }] : []),
|
|
240
|
+
...filterParts,
|
|
241
|
+
...(!phone
|
|
242
|
+
? [
|
|
243
|
+
{
|
|
244
|
+
key: "save",
|
|
245
|
+
line: 2,
|
|
246
|
+
side: "end",
|
|
247
|
+
node: _jsx(ToolbarSave, { view: view, onClear: clearable ? clear("options") : undefined }),
|
|
248
|
+
},
|
|
249
|
+
]
|
|
250
|
+
: []),
|
|
251
|
+
];
|
|
252
|
+
if (phone) {
|
|
253
|
+
const quickHere = kitParts.find((part) => part.key === "quick");
|
|
254
|
+
const phoneParts = quickHere
|
|
255
|
+
? [...kitParts.filter((part) => part !== quickHere), { ...quickHere, line: 2, side: "start" }]
|
|
256
|
+
: kitParts;
|
|
257
|
+
return _jsx(Toolbar, { parts: placed(phoneParts), phone: true, fold: true, more: menus?.more, className: className });
|
|
258
|
+
}
|
|
259
|
+
if (sortFilter === "bar")
|
|
260
|
+
return _jsx(Toolbar, { parts: placed(kitParts), phone: phone, fold: true, more: menus?.more, className: className });
|
|
261
|
+
const rowSort = {
|
|
262
|
+
key: "sort",
|
|
263
|
+
side: "end",
|
|
264
|
+
shed: true,
|
|
265
|
+
fold: true,
|
|
266
|
+
menu: {
|
|
267
|
+
label: messages({ key: "views.panels.sort" }),
|
|
268
|
+
icon: _jsx(Sort, { className: "h-4 w-4" }),
|
|
269
|
+
onSelect: () => sortAdd.onOpenChange(true),
|
|
270
|
+
},
|
|
271
|
+
node: panels.sorts ? (_jsx(ToolbarSortPill, { row: true, sorts: panels.sorts, open: sortAdd.open, onOpenChange: sortAdd.onOpenChange, host: hosts?.sort })) : (_jsx(ToolbarSort, { sort: panels.sort, open: sortAdd.open, onOpenChange: sortAdd.onOpenChange, host: hosts?.sort })),
|
|
272
|
+
};
|
|
273
|
+
const rowFilter = tree
|
|
274
|
+
? {
|
|
275
|
+
key: "filter-add",
|
|
276
|
+
side: "end",
|
|
277
|
+
shed: true,
|
|
278
|
+
fold: true,
|
|
279
|
+
menu: { ...filterMenu, onSelect: () => filterAdd.onOpenChange(true) },
|
|
280
|
+
node: (_jsx(ToolbarFilterAdd, { filterTree: tree, onHeldChange: setHeld, open: filterAdd.open, onOpenChange: filterAdd.onOpenChange, host: hosts?.filter })),
|
|
281
|
+
}
|
|
282
|
+
: { key: "filter", side: "end", shed: true, fold: true, menu: filterMenu, node: filterNode };
|
|
283
|
+
const pill = always && panels.sorts ? (_jsx(ToolbarSortPill, { sorts: panels.sorts, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort, addAfter: false })) : null;
|
|
284
|
+
const stackedPart = kitParts.find((part) => part.key === "views-stacked");
|
|
285
|
+
const barParts = barShown
|
|
286
|
+
? [
|
|
287
|
+
...(stackedPart ? [stackedPart] : []),
|
|
288
|
+
...(pill ? [{ key: "sort-pill", line: 2, node: pill }] : []),
|
|
289
|
+
...(pill && (filtered || always) ? [{ key: "sep", line: 2, role: "separator", node: _jsx(ToolbarSeparator, {}) }] : []),
|
|
290
|
+
...(tree
|
|
291
|
+
? [
|
|
292
|
+
{
|
|
293
|
+
key: "filters",
|
|
294
|
+
line: 2,
|
|
295
|
+
filters: foldableFilters(tree.tree, held),
|
|
296
|
+
node: (_jsx(ToolbarFilters, { filterTree: tree, open: filterState.open, onOpenChange: filterState.onOpenChange, held: held, onHeldChange: setHeld, host: hosts?.filter, emptyPlace: always })),
|
|
297
|
+
},
|
|
298
|
+
]
|
|
299
|
+
: []),
|
|
300
|
+
{
|
|
301
|
+
key: "save",
|
|
302
|
+
line: 2,
|
|
303
|
+
side: "end",
|
|
304
|
+
node: _jsx(ToolbarSave, { view: view, onClear: clearable ? clear("options") : undefined }),
|
|
305
|
+
},
|
|
306
|
+
]
|
|
307
|
+
: [];
|
|
308
|
+
const at = (key) => kitParts.find((part) => part.key === key);
|
|
309
|
+
const quickPart = at("quick");
|
|
310
|
+
const mihaisParts = [
|
|
311
|
+
...kitParts.filter((part) => (part.line ?? 1) === 1 && !["quick", "search", "new", "sort", "filter", "filters"].includes(part.key)),
|
|
312
|
+
rowSort,
|
|
313
|
+
rowFilter,
|
|
314
|
+
...(quickPart && quick
|
|
315
|
+
? [
|
|
316
|
+
{
|
|
317
|
+
...quickPart,
|
|
318
|
+
words: "icon",
|
|
319
|
+
node: (_jsx(ToolbarQuickFilters, { quickFilters: quick, open: quickState.open, onOpenChange: quickState.onOpenChange, host: hosts?.quick, word: null })),
|
|
320
|
+
},
|
|
321
|
+
]
|
|
322
|
+
: []),
|
|
323
|
+
at("search"),
|
|
324
|
+
at("new"),
|
|
325
|
+
...barParts,
|
|
326
|
+
];
|
|
327
|
+
return _jsx(Toolbar, { parts: placed(mihaisParts), phone: phone, fold: true, more: menus?.more, className: className });
|
|
328
|
+
}
|
|
329
|
+
const parts = [
|
|
330
|
+
...(shownViews
|
|
331
|
+
? [
|
|
332
|
+
{ key: "views", node: _jsx(ToolbarViews, { views: shownViews, viewsLayout: viewsLayout, showCounts: show }) },
|
|
333
|
+
{ key: "views-stacked", line: 2, node: _jsx(ToolbarViews, { views: shownViews, viewsLayout: viewsLayout, showCounts: show, stacked: true }) },
|
|
334
|
+
]
|
|
335
|
+
: []),
|
|
336
|
+
{
|
|
337
|
+
key: "search",
|
|
338
|
+
side: "end",
|
|
339
|
+
role: "search",
|
|
340
|
+
words: "icon",
|
|
341
|
+
node: searchNode,
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
key: "sort",
|
|
345
|
+
side: "end",
|
|
346
|
+
node: sortNode,
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
key: "filter",
|
|
350
|
+
side: "end",
|
|
351
|
+
node: filterNode,
|
|
352
|
+
},
|
|
353
|
+
...(panels.filterTree
|
|
354
|
+
? [
|
|
355
|
+
{
|
|
356
|
+
key: "advanced-filters",
|
|
357
|
+
side: "end",
|
|
358
|
+
node: _jsx(ToolbarAdvancedFilters, { filterTree: panels.filterTree, host: hosts?.filter }),
|
|
359
|
+
},
|
|
360
|
+
]
|
|
361
|
+
: []),
|
|
362
|
+
...(quickNode ? [{ key: "quick", side: "end", node: quickNode }] : []),
|
|
363
|
+
{
|
|
364
|
+
key: "options",
|
|
365
|
+
side: "end",
|
|
366
|
+
node: (_jsx(ToolbarOptions, { ...inputs, view: view, fieldEditor: fieldEditor, onClear: view ? view.onReset : clear("options"), open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: hosts?.options, ...customizeOwn })),
|
|
367
|
+
},
|
|
368
|
+
{ key: "new", side: "end", node: _jsx(ToolbarNew, { onAdd: onAdd, items: newItems, label: addLabel }) },
|
|
369
|
+
];
|
|
370
|
+
return _jsx(Toolbar, { parts: placed(parts), phone: phone, narrow: narrow, className: className });
|
|
371
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ListLayout } from "viewkitjs/fields/query";
|
|
2
|
+
import type { CollectionViewsConfig } from "../panels/views-row/model.js";
|
|
3
|
+
/** The toolbar's views axis from the root's store (not on the door): undefined in memory mode, and while the store
|
|
4
|
+
* hasn't answered. `layouts`: what a new view can take, the toolbar's own `layouts`; none handed, a table. */
|
|
5
|
+
export declare function useListViewsAxis(layouts?: readonly ListLayout[]): CollectionViewsConfig<string> | undefined;
|