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
|
@@ -73,6 +73,7 @@ export function viewMenuWordsOf(say) {
|
|
|
73
73
|
edit: say({ key: "views.panels.view-edit" }),
|
|
74
74
|
privateView: say({ key: "views.panels.view-private-toggle" }),
|
|
75
75
|
saveEveryone: say({ key: "views.panels.view-save-everyone" }),
|
|
76
|
+
saveOwn: say({ key: "views.panels.view-save-own" }),
|
|
76
77
|
reset: say({ key: "views.panels.view-reset" }),
|
|
77
78
|
saveNew: say({ key: "views.panels.view-save-new" }),
|
|
78
79
|
copyLink: say({ key: "views.panels.copy-link" }),
|
|
@@ -137,53 +138,70 @@ function Plain(props) {
|
|
|
137
138
|
function leavingFirst(list, leave) {
|
|
138
139
|
return list.map((e) => e.kind === undefined || e.kind === "action" ? { ...e, onSelect: () => { leave(); e.onSelect?.(); } } : e.kind === "group" ? { ...e, entries: leavingFirst(e.entries, leave) } : e);
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
-
const { verbs } =
|
|
141
|
+
export function useVerbsMenu(p) {
|
|
142
|
+
const { verbs } = p;
|
|
142
143
|
const context = React.useContext(ViewsContext);
|
|
143
144
|
const say = context?.messages ?? resolveViewsMessage;
|
|
144
145
|
const AppIcon = context?.components.AppIcon;
|
|
145
|
-
const words = React.useMemo(() => ({ ...viewsListWordsOf(say, props.createLabel), back: say({ key: "views.panels.back" }) }), [say, props.createLabel]);
|
|
146
146
|
const menuWords = React.useMemo(() => viewMenuWordsOf(say), [say]);
|
|
147
|
-
const
|
|
147
|
+
const icons = [...new Set(p.views.flatMap((v) => (v.icon ? [v.icon] : [])))];
|
|
148
148
|
const layouts = [
|
|
149
149
|
...verbs.layouts.map((l) => ({ id: l.id, name: l.name, line: l.line, ...(l.columns ? { columns: true } : {}), mark: AppIcon ? _jsx(AppIcon, { name: l.icon }) : null })),
|
|
150
|
-
...
|
|
150
|
+
...(AppIcon ? icons.filter((icon) => !verbs.layouts.some((v) => v.id === icon)).map((icon) => ({ id: icon, name: icon, line: "", mark: _jsx(AppIcon, { name: icon }) })) : []),
|
|
151
151
|
];
|
|
152
|
-
const views =
|
|
152
|
+
const views = p.views.map((v) => ({
|
|
153
153
|
id: v.value, name: v.label, layout: v.layout ?? v.icon ?? "",
|
|
154
154
|
...(v.private ? { private: true } : {}), ...(v.favorite ? { favorite: true } : {}), ...(v.changed ? { changed: true } : {}),
|
|
155
|
-
...(typeof v.count === "number" ? { count: v.count } : {}),
|
|
155
|
+
...(v.readOnly ? { readOnly: true } : {}), ...(typeof v.count === "number" ? { count: v.count } : {}),
|
|
156
156
|
}));
|
|
157
157
|
const ports = context?.ports;
|
|
158
|
-
const computer = props.form === "computer";
|
|
159
158
|
const menu = useViewMenu({
|
|
160
|
-
views, open:
|
|
159
|
+
views, open: p.value, layouts,
|
|
161
160
|
...(verbs.columns ? { columns: { fields: verbs.columns.fields.map((f) => ({ value: f.value, label: f.label })), value: verbs.columns.value } } : {}),
|
|
162
161
|
records: verbs.records,
|
|
163
162
|
onChange: (c) => {
|
|
164
|
-
if (c.kind === "open")
|
|
165
|
-
|
|
166
|
-
else if (c.kind === "order") {
|
|
167
|
-
const block = orderToWrite(props.views, c.ids, props.canDrag);
|
|
168
|
-
if (block)
|
|
169
|
-
props.onReorder?.(block);
|
|
170
|
-
}
|
|
163
|
+
if (c.kind === "open" || c.kind === "order")
|
|
164
|
+
p.onListChange?.(c);
|
|
171
165
|
else
|
|
172
166
|
verbs.onChange(c);
|
|
173
167
|
},
|
|
174
|
-
onDone:
|
|
175
|
-
...(
|
|
176
|
-
|
|
168
|
+
...(p.onDone ? { onDone: p.onDone } : {}), ...(p.shows ? { shows: p.shows } : {}), form: p.form, ...(p.steps ? { steps: true } : {}), words: menuWords,
|
|
169
|
+
...(verbs.menu ? { reshape: (items, id) => {
|
|
170
|
+
const view = p.views.find((v) => v.value === id);
|
|
171
|
+
return view && verbs.menu ? verbs.menu(items, { view }) : items;
|
|
172
|
+
} } : {}),
|
|
173
|
+
...(p.form === "computer" && ports && !context.confirmFallback ? { ask: async (request) => {
|
|
174
|
+
p.onHold?.(true);
|
|
177
175
|
try {
|
|
178
176
|
return await ports.confirm(request);
|
|
179
177
|
}
|
|
180
178
|
finally {
|
|
181
|
-
requestAnimationFrame(() =>
|
|
179
|
+
requestAnimationFrame(() => p.onHold?.(false));
|
|
182
180
|
}
|
|
183
181
|
} } : {}),
|
|
184
182
|
...(ports && !context.toastFallback ? { report: (message, options) => ports.toast.success(message, options) } : {}),
|
|
185
183
|
});
|
|
186
|
-
|
|
184
|
+
return { ...menu, views, layouts };
|
|
185
|
+
}
|
|
186
|
+
function WithVerbs(props) {
|
|
187
|
+
const context = React.useContext(ViewsContext);
|
|
188
|
+
const say = context?.messages ?? resolveViewsMessage;
|
|
189
|
+
const words = React.useMemo(() => ({ ...viewsListWordsOf(say, props.createLabel), back: say({ key: "views.panels.back" }) }), [say, props.createLabel]);
|
|
190
|
+
const base = viewsListPropsOf(props, words, say({ key: "views.menus.not-now" }), context?.components.AppIcon);
|
|
191
|
+
const menu = useVerbsMenu({
|
|
192
|
+
views: props.views, value: props.value, verbs: props.verbs, form: props.form, steps: true,
|
|
193
|
+
onListChange: (c) => {
|
|
194
|
+
if (c.kind === "open")
|
|
195
|
+
props.onViewChange(c.id);
|
|
196
|
+
else {
|
|
197
|
+
const block = orderToWrite(props.views, c.ids, props.canDrag);
|
|
198
|
+
if (block)
|
|
199
|
+
props.onReorder?.(block);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
onDone: props.onDone, ...(props.onHold ? { onHold: props.onHold } : {}),
|
|
203
|
+
});
|
|
204
|
+
const list = useViewsList({ ...base, layouts: menu.layouts, views: menu.views, entries: menu.entries, ...(props.onCreate ? { onNew: () => menu.startNew() } : {}), onMenu: menu.openMenu, step: menu.step });
|
|
187
205
|
const head = useStepHead(menu.step, props);
|
|
188
206
|
return _jsxs(_Fragment, { children: [head, list.body, menu.dialogs] });
|
|
189
207
|
}
|
|
@@ -8,6 +8,8 @@ export interface ListView {
|
|
|
8
8
|
favorite?: boolean;
|
|
9
9
|
changed?: boolean;
|
|
10
10
|
count?: number;
|
|
11
|
+
/** A view this reader can't change: no Rename, Delete, Private view or Save in its menu; Reset, Save as new view, Copy link and Duplicate stay. */
|
|
12
|
+
readOnly?: boolean;
|
|
11
13
|
}
|
|
12
14
|
/** A layout a new view can take: its mark, its name, its one line; `columns` where it asks which field makes its columns (a board). */
|
|
13
15
|
export interface ViewsListLayout {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { ViewsMenuItem } from "../../provider/components.js";
|
|
2
3
|
import { type MenuEntry } from "../menu-list/menu-list.js";
|
|
3
4
|
import { type PickerItem } from "../picker/picker.js";
|
|
4
5
|
import { type ListView, type ViewsListChange, type ViewsListLayout } from "./rules.js";
|
|
@@ -57,6 +58,10 @@ export interface ViewMenuProps {
|
|
|
57
58
|
* out, a phone's Rename, New view and delete question open as today (the kit's sheets), and `step` stays null.
|
|
58
59
|
* CONTROLS.ViewsListBody hands it. */
|
|
59
60
|
steps?: boolean;
|
|
61
|
+
/** Its items as data (VK-741): handed the view's default items, keyed, and its id, it hands back the items drawn. The keys:
|
|
62
|
+
* `rename`, `edit`, `private`, `save`, `reset`, `save-new`, `copy-link`, `favorite`, `duplicate`, `delete`; on a phone the
|
|
63
|
+
* first three of the unsaved ones under `unsaved`, `private` and `edit` under `this-view`. */
|
|
64
|
+
reshape?: (items: ViewsMenuItem[], id: string) => ViewsMenuItem[];
|
|
60
65
|
}
|
|
61
66
|
/** On a phone, what stands in the list's one Sheet in place of the list: the view's menu, Rename, New view, or the delete
|
|
62
67
|
* question. Back goes one step back. */
|
|
@@ -68,6 +73,8 @@ export type ViewMenuStep = {
|
|
|
68
73
|
export interface ViewMenuParts {
|
|
69
74
|
/** A view's menu, as the Picker's row hands it (`PickerItem.menu`) or a Menu opens it. */
|
|
70
75
|
entries: (id: string) => MenuEntry[];
|
|
76
|
+
/** The same menu as data, reshaped by the holder's `reshape`: what an app's `Menu` draws (a views row's pill, VK-947). */
|
|
77
|
+
items: (id: string) => ViewsMenuItem[];
|
|
71
78
|
/** New view's Modal, opened; Save as new view… opens it from a view, that view's layout picked. */
|
|
72
79
|
startNew: (from?: string) => void;
|
|
73
80
|
/** The Modals and the question: what the holder renders beside the list. */
|
|
@@ -8,6 +8,7 @@ import { Input } from "../input/input.js";
|
|
|
8
8
|
import { asSelect, OnTop } from "../internal/editor-parts.js";
|
|
9
9
|
import { Icon } from "../internal/icons.js";
|
|
10
10
|
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
11
|
+
import { menuEntries } from "../menu/map-menu.js";
|
|
11
12
|
import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
|
|
12
13
|
import { MenuList, tilesOf, useMenuListOption, useMenuListRows } from "../menu-list/menu-list.js";
|
|
13
14
|
import { Modal } from "../modal/modal.js";
|
|
@@ -118,51 +119,54 @@ export function useViewMenu(props) {
|
|
|
118
119
|
}
|
|
119
120
|
ask({ what: "delete", id });
|
|
120
121
|
};
|
|
121
|
-
const
|
|
122
|
+
const items = (id) => {
|
|
122
123
|
const v = viewOf(id);
|
|
123
124
|
if (!v)
|
|
124
125
|
return [];
|
|
125
126
|
const icon = (n) => _jsx(Icon, { name: n });
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
{ icon: icon("
|
|
127
|
+
const mine = !v.readOnly;
|
|
128
|
+
const rule = (on) => (on ? { separatorBefore: true } : {});
|
|
129
|
+
const changed = (ruled) => v.changed ? [
|
|
130
|
+
...(mine ? [{ key: "save", icon: icon("check"), label: v.private ? w.saveOwn : w.saveEveryone, ...rule(ruled), onSelect: () => onChange({ kind: "save", id }) }] : []),
|
|
131
|
+
{ key: "reset", icon: icon("undo"), label: w.reset, ...rule(ruled && !mine), onSelect: () => onChange({ kind: "reset", id }) },
|
|
132
|
+
{ key: "save-new", icon: icon("plus"), label: w.saveNew, onSelect: () => startNew(id) },
|
|
130
133
|
] : [];
|
|
131
|
-
const favorite = worn.favorites ? [{ icon: icon(v.favorite ? "star-filled" : "star"), label: v.favorite ? w.unfavorite : w.favorite, onSelect: () => onChange({ kind: "favorite", id, on: !v.favorite }) }] : [];
|
|
132
|
-
const privately = worn.privateViews ? [{
|
|
133
|
-
const edit = { icon: icon("settings"), label: w.edit, onSelect: () => { onChange({ kind: "edit", id }); onDone?.(); } };
|
|
134
|
-
const link = { icon: icon("link"), label: phone ? w.copyLinkShort : w.copyLink, onSelect: () => onChange({ kind: "link", id }) };
|
|
135
|
-
const duplicate = { icon: icon("copy"), label: phone ? w.duplicateShort : w.duplicate, onSelect: () => { onChange({ kind: "duplicate", id }); onDone?.(); } };
|
|
136
|
-
const del = { icon: icon("trash"), label: w.delete,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
{ kind: "separator" }, duplicate, del,
|
|
134
|
+
const favorite = worn.favorites ? [{ key: "favorite", icon: icon(v.favorite ? "star-filled" : "star"), label: v.favorite ? w.unfavorite : w.favorite, onSelect: () => onChange({ kind: "favorite", id, on: !v.favorite }) }] : [];
|
|
135
|
+
const privately = worn.privateViews && mine ? [{ key: "private", label: w.privateView, ...(phone ? { icon: LOCK } : {}), checked: !!v.private, keepOpen: true, onSelect: () => onChange({ kind: "private", id, on: !v.private }) }] : [];
|
|
136
|
+
const edit = { key: "edit", icon: icon("settings"), label: w.edit, onSelect: () => { onChange({ kind: "edit", id }); onDone?.(); } };
|
|
137
|
+
const link = (ruled) => ({ key: "copy-link", icon: icon("link"), label: phone ? w.copyLinkShort : w.copyLink, ...rule(ruled), onSelect: () => onChange({ kind: "link", id }) });
|
|
138
|
+
const duplicate = (ruled) => ({ key: "duplicate", icon: icon("copy"), label: phone ? w.duplicateShort : w.duplicate, ...rule(ruled), onSelect: () => { onChange({ kind: "duplicate", id }); onDone?.(); } });
|
|
139
|
+
const del = (ruled) => ({ key: "delete", icon: icon("trash"), label: w.delete, destructive: true, ...rule(ruled), ...(canDelete(views) ? {} : { disabled: true, disabledReason: w.keepOne }), onSelect: () => askDelete(id) });
|
|
140
|
+
const unsaved = changed(false);
|
|
141
|
+
const all = phone ? [
|
|
142
|
+
link(false), ...favorite, ...(mine ? [{ key: "rename", icon: icon("rename"), label: w.renameShort, onSelect: () => rename(id) }] : []), duplicate(false),
|
|
143
|
+
...(unsaved.length ? [{ key: "unsaved", label: w.unsaved, children: unsaved }] : []),
|
|
144
|
+
{ key: "this-view", label: w.thisView, children: [...privately, edit] },
|
|
145
|
+
...(mine ? [del(true)] : []),
|
|
146
|
+
] : [
|
|
147
|
+
...(mine ? [{ key: "rename", icon: icon("rename"), label: w.rename, onSelect: () => rename(id) }] : []), edit, ...privately,
|
|
148
|
+
...changed(true),
|
|
149
|
+
link(true), ...favorite,
|
|
150
|
+
duplicate(true), ...(mine ? [del(false)] : []),
|
|
149
151
|
];
|
|
152
|
+
return props.reshape ? props.reshape(all, id) : all;
|
|
150
153
|
};
|
|
154
|
+
const entries = (id) => menuEntries(items(id), undefined, "vk-view-menu-row");
|
|
151
155
|
const where = props.container ?? undefined, standing = props.standing;
|
|
152
156
|
const target = asked && (asked.what === "rename" || asked.what === "delete" || asked.what === "menu") ? viewOf(asked.id) : undefined;
|
|
153
157
|
const asking = shown;
|
|
154
|
-
const nameField = (run) => (_jsx(Field, { label: w.name, children: _jsx(Input, { ref: box, value: name, onValueChange: (v) => setName(v), onKeyDown: enter(run), autoComplete: "off" }) }));
|
|
158
|
+
const nameField = (run) => (_jsx(Field, { label: w.name, children: _jsx(Input, { ref: box, "data-slot": "vk-view-menu-name", value: name, onValueChange: (v) => setName(v), onKeyDown: enter(run), autoComplete: "off" }) }));
|
|
155
159
|
const columnsField = chosen?.columns && columns && (phone
|
|
156
|
-
? _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: w.columns(chosen.name), entries: [{ kind: "choices", icon: null, label: w.columns(chosen.name), value: column, choices: columns.fields.map((f) => ({ value: f.value, label: f.label })) }], onOpen: () => (stepping ? ask({ what: "columns" }) : setPicking({ open: true })) }) })
|
|
157
|
-
: _jsx(Field, { label: w.columns(chosen.name), nativeLabel: false, children: _jsx(Select, { "aria-label": w.columns(chosen.name), items: asSelect(columns.fields), value: column, onValueChange: (v) => { if (typeof v === "string")
|
|
160
|
+
? _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: w.columns(chosen.name), entries: [{ kind: "choices", icon: null, label: w.columns(chosen.name), value: column, slot: { slot: "vk-view-menu-columns" }, choices: columns.fields.map((f) => ({ value: f.value, label: f.label })) }], onOpen: () => (stepping ? ask({ what: "columns" }) : setPicking({ open: true })) }) })
|
|
161
|
+
: _jsx(Field, { label: w.columns(chosen.name), nativeLabel: false, children: _jsx(Select, { "aria-label": w.columns(chosen.name), "data-slot": "vk-view-menu-columns", items: asSelect(columns.fields), value: column, onValueChange: (v) => { if (typeof v === "string")
|
|
158
162
|
setColumn(v); } }) }));
|
|
159
163
|
const newForm = (_jsxs("div", { className: "o-views-list-form", children: [_jsx(RadioGroup, { row: true, label: w.layout, value: layout, onValueChange: (v) => { if (typeof v === "string")
|
|
160
|
-
setLayout(v); }, children: layouts.map((l) => _jsx(Radio, { value: l.id, mark: l.mark, label: l.name, note: l.line }, l.id)) }), nameField(create), columnsField] }));
|
|
164
|
+
setLayout(v); }, children: layouts.map((l) => _jsx(Radio, { value: l.id, mark: l.mark, label: l.name, note: l.line, "data-slot": "vk-view-menu-layout", "data-key": l.id }, l.id)) }), nameField(create), columnsField] }));
|
|
161
165
|
const modalWords = { close: w.close };
|
|
162
166
|
const stepOf = () => {
|
|
163
167
|
if (!stepping || !asked || !shown)
|
|
164
168
|
return null;
|
|
165
|
-
const done = (run, disabled, label) => (_jsx("div", { className: "o-views-list-step-foot", children: _jsx(Button, { kind: "primary", className: "o-views-list-step-act", disabled: disabled, onClick: () => { run(); toList(); }, children: label }) }));
|
|
169
|
+
const done = (run, disabled, label) => (_jsx("div", { className: "o-views-list-step-foot", children: _jsx(Button, { kind: "primary", className: "o-views-list-step-act", "data-slot": "vk-view-menu-act", disabled: disabled, onClick: () => { run(); toList(); }, children: label }) }));
|
|
166
170
|
if (asked.what === "menu" && target) {
|
|
167
171
|
const leaving = (list) => list.map((e) => e.kind === undefined || e.kind === "action" ? { ...e, onSelect: () => { toList(); e.onSelect?.(); } } : e.kind === "group" ? { ...e, entries: leaving(e.entries) } : e);
|
|
168
172
|
return { title: target.name, onBack: toList, body: _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: target.name, ...tilesOf(leaving(entries(target.id))), ...(closeRow ? { onClose: toList } : {}), closeWord: w.close }) }) };
|
|
@@ -197,5 +201,5 @@ export function useViewMenu(props) {
|
|
|
197
201
|
remove(target.id); }, title: w.deleteTitle(target.name), line: lineOf(target), action: w.delete, kind: "danger", cancel: w.cancel, words: { close: w.close, failed: w.failed, tryAgain: w.tryAgain }, container: where, standing: standing }))] }));
|
|
198
202
|
const openMenu = (id) => { if (stepping)
|
|
199
203
|
ask({ what: "menu", id }); };
|
|
200
|
-
return { entries, startNew, dialogs, asking, openMenu, step: stepOf() };
|
|
204
|
+
return { entries, items, startNew, dialogs, asking, openMenu, step: stepOf() };
|
|
201
205
|
}
|
|
@@ -36,7 +36,7 @@ export function useViewsList(props) {
|
|
|
36
36
|
return mark == null ? {} : { as: { mark: _jsx("span", { className: "o-views-list-mark", children: mark }) } };
|
|
37
37
|
};
|
|
38
38
|
const items = listed(views, privateViews).map((v) => ({
|
|
39
|
-
value: v.id, label: v.name, ...markOf(v.layout),
|
|
39
|
+
value: v.id, label: v.name, ...markOf(v.layout), slot: { slot: "vk-views-list-row", key: v.id },
|
|
40
40
|
...(props.entries ? { menu: props.entries(v.id) } : {}),
|
|
41
41
|
...(typeof v.count === "number" ? { count: v.count } : {}),
|
|
42
42
|
...(privateViews ? { group: v.private ? w.justMe : w.shared, ...(v.private ? { after: LOCK } : {}) } : {}),
|
|
@@ -50,7 +50,7 @@ export function useViewsList(props) {
|
|
|
50
50
|
...(props.onNew ? { actions: [{ id: "new", label: w.newView, icon: _jsx(Icon, { name: "plus" }), onSelect: () => { setOpener(null); props.onNew(); } }] } : {}),
|
|
51
51
|
search: phone ? w.find : w.search, searchShown: true, heldInPlace: true, actionsUnder: true, fromHeld: true,
|
|
52
52
|
...(w.none ? { none: w.none } : {}), ...(w.picker ? { words: w.picker } : {}), ...(w.menu ? { menuWords: w.menu } : {}),
|
|
53
|
-
menuFrame: MENU_LIST_CARD_FRAME,
|
|
53
|
+
menuFrame: MENU_LIST_CARD_FRAME, menuSlot: "vk-view-menu",
|
|
54
54
|
...(phone && props.onMenu ? { onRowMenu: (id) => { setOpener(views.find((v) => v.id === id)?.name ?? null); props.onMenu(id); } } : {}),
|
|
55
55
|
});
|
|
56
56
|
const step = phone ? props.step ?? null : null;
|
|
@@ -60,11 +60,11 @@ export function useViewsList(props) {
|
|
|
60
60
|
if (step) {
|
|
61
61
|
const back = _jsx(SheetButton, { "aria-label": w.back, className: "o-sheet-back", icon: _jsx(Icon, { name: "left" }), onClick: step.onBack });
|
|
62
62
|
return {
|
|
63
|
-
body: _jsx("div", { ref: placeRoot, className: "o-views-list", "data-kit": "views-list", "data-views-form": "phone", "data-views-step": "", ...phoneMark(!!screen || small), children: step.body }),
|
|
63
|
+
body: _jsx("div", { ref: placeRoot, className: "o-views-list", "data-slot": "vk-views-list", "data-kit": "views-list", "data-views-form": "phone", "data-views-step": "", ...phoneMark(!!screen || small), children: step.body }),
|
|
64
64
|
head: { left: back, children: step.title, right: _jsx("span", {}) },
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
const body = (_jsx("div", { ref: placeRoot, className: "o-views-list", "data-kit": "views-list", "data-views-form": phone ? "phone" : "computer", ...phoneMark(!!screen || small), children: picker.body }));
|
|
67
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-views-list", "data-slot": "vk-views-list", "data-kit": "views-list", "data-views-form": phone ? "phone" : "computer", ...phoneMark(!!screen || small), children: picker.body }));
|
|
68
68
|
return { body, head: picker.head };
|
|
69
69
|
}
|
|
70
70
|
export function ViewsList(props) {
|
|
@@ -2,7 +2,7 @@ import { JUST_ME, SHARED } from "./rules.js";
|
|
|
2
2
|
export const VIEWS_LIST_WORDS = { label: "Views", search: "Search views", find: "Find a view", newView: "New view", shared: SHARED, justMe: JUST_ME, back: "Back" };
|
|
3
3
|
export const viewsListWords = (given) => (given ? { ...VIEWS_LIST_WORDS, ...given } : VIEWS_LIST_WORDS);
|
|
4
4
|
export const VIEW_MENU_WORDS = {
|
|
5
|
-
rename: "Rename…", renameShort: "Rename", edit: "Edit view…", privateView: "Private view", saveEveryone: "Save for everyone", reset: "Reset",
|
|
5
|
+
rename: "Rename…", renameShort: "Rename", edit: "Edit view…", privateView: "Private view", saveEveryone: "Save for everyone", saveOwn: "Save", reset: "Reset",
|
|
6
6
|
saveNew: "Save as new view…", copyLink: "Copy link to view", copyLinkShort: "Copy link", favorite: "Favorite", unfavorite: "Unfavorite",
|
|
7
7
|
duplicate: "Duplicate view", duplicateShort: "Duplicate", delete: "Delete view", keepOne: "A list keeps one view", unsaved: "Unsaved changes",
|
|
8
8
|
thisView: "This view", renameTitle: "Rename view", save: "Save", newView: "New view", createView: "Create view", layout: "Layout", name: "Name",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
4
|
+
import { OutOfFieldRows } from "../internal/field-rows.js";
|
|
4
5
|
import { cx } from "../internal/cx.js";
|
|
5
6
|
import { useDesktop } from "../provider/desktop.js";
|
|
6
7
|
import { useViews } from "../provider/context.js";
|
|
@@ -36,7 +37,7 @@ export function EditorPanel({ session, title, anchor, inPlace = false, sheetOnPh
|
|
|
36
37
|
const [surface] = useState(() => desktop ? (inPlace ? "in-place" : "popover") : inPlace && !sheetOnPhone ? "in-place" : "sheet");
|
|
37
38
|
const { open, close, refusal } = session;
|
|
38
39
|
const escapedRef = useRef(false);
|
|
39
|
-
const editor = typeof children === "function" ? children(surface) : children;
|
|
40
|
+
const editor = _jsx(OutOfFieldRows, { children: typeof children === "function" ? children(surface) : children });
|
|
40
41
|
const [step, setStep] = useState(null);
|
|
41
42
|
const stepRef = useRef(null);
|
|
42
43
|
const answeredRef = useRef(false);
|
|
@@ -154,5 +155,5 @@ export function EditorPanel({ session, title, anchor, inPlace = false, sheetOnPh
|
|
|
154
155
|
if (details?.reason === "escape-key" && (inMarkedStep(document.activeElement) || goBack()))
|
|
155
156
|
return;
|
|
156
157
|
close("escape");
|
|
157
|
-
}, title: sheetTitle, ...(typeof sheetTitle === "string" || typeof sheetTitle === "number" ? { label: String(sheetTitle) } : {}), ...(actions && { actions }), snap: snap, children: _jsxs("div", { ref: panelRef, "data-slot": "vk-editor-panel", children: [actions ? null : (_jsxs("div", { "data-slot": "vk-editor-bar", className: "flex items-center justify-between px-2 pb-1", children: [step ? (_jsx(Button, { variant: "ghost", size: "icon", "aria-label": backLabel, onClick: back, children: _jsx(Back, { className: "size-4" }) })) : (_jsx(Button, { variant: "ghost", size: "icon", "aria-label": discardLabel, onClick: () => close("escape"), children: _jsx(Discard, { className: "size-4" }) })), _jsx(Button, { variant: "ghost", size: "icon", "aria-label": saveLabel, onClick: () => close("enter"), children: _jsx(Save, { className: "size-4" }) })] })), _jsx(BodyStepContext.Provider, { value: hold, children: editor }), reason] }) }) }));
|
|
158
|
+
}, title: sheetTitle, ...(typeof sheetTitle === "string" || typeof sheetTitle === "number" ? { label: String(sheetTitle) } : {}), ...(actions && { actions }), snap: snap, children: _jsxs("div", { ref: panelRef, "data-slot": "vk-editor-panel", children: [actions ? null : (_jsxs("div", { "data-slot": "vk-editor-bar", className: "flex items-center justify-between px-2 pb-1", children: [step ? (_jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-back", "aria-label": backLabel, onClick: back, children: _jsx(Back, { className: "size-4" }) })) : (_jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-close", "aria-label": discardLabel, onClick: () => close("escape"), children: _jsx(Discard, { className: "size-4" }) })), _jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-save", "aria-label": saveLabel, onClick: () => close("enter"), children: _jsx(Save, { className: "size-4" }) })] })), _jsx(BodyStepContext.Provider, { value: hold, children: editor }), reason] }) }) }));
|
|
158
159
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useContext, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { onPageClose } from "../internal/page-close.js";
|
|
3
4
|
import { ViewsContext } from "../provider/context.js";
|
|
4
5
|
import { DEFAULT_DESKTOP_QUERY, isDesktopNow } from "../provider/desktop.js";
|
|
5
6
|
import { EditLeaveContext } from "./leave-scope.js";
|
|
@@ -86,11 +87,7 @@ export function useAnchoredEditSession(args) {
|
|
|
86
87
|
useLayoutEffect(() => {
|
|
87
88
|
leaveRef.current = leave;
|
|
88
89
|
});
|
|
89
|
-
useEffect(() =>
|
|
90
|
-
const onHide = () => leaveRef.current();
|
|
91
|
-
window.addEventListener("pagehide", onHide);
|
|
92
|
-
return () => window.removeEventListener("pagehide", onHide);
|
|
93
|
-
}, []);
|
|
90
|
+
useEffect(() => onPageClose(() => leaveRef.current(), "drafts"), []);
|
|
94
91
|
const scope = useContext(EditLeaveContext);
|
|
95
92
|
useLayoutEffect(() => scope?.add(() => leaveRef.current()), [scope]);
|
|
96
93
|
return { open, close, refusal, keeps };
|
|
@@ -53,13 +53,15 @@ export declare function fieldRowMenuItems(menu: readonly FieldRowMenuItem[] | un
|
|
|
53
53
|
* popover under the value on a desktop and in the sheet on a phone, a typed
|
|
54
54
|
* value in its own box on every width.
|
|
55
55
|
*
|
|
56
|
-
* The frame is glyph · `w-32`
|
|
56
|
+
* The frame is glyph · label column (`--vk-field-row-label-w`, `w-32` undeclared) · value on a desktop, so the rows of a section,
|
|
57
57
|
* and any hand-written row an app draws on the same frame, line up down one column;
|
|
58
58
|
* below the provider's desktop line the label stands above the value.
|
|
59
59
|
* Under the value it may draw a NOTE — the sentence that explains it — outside
|
|
60
60
|
* the click target, so the value stays the thing a click edits.
|
|
61
61
|
*/
|
|
62
|
-
declare function FieldRowImpl<Row>({ binding, row, value, editValue, writable, ready, unread, refusal, onCommit, opts, menu, meta, note, kindIcon, }: FieldRowProps<Row>
|
|
62
|
+
declare function FieldRowImpl<Row>({ binding, row, value, editValue, writable, ready, unread, refusal, onCommit, opts, menu, meta, note, kindIcon, inCard, }: FieldRowProps<Row> & {
|
|
63
|
+
inCard?: boolean;
|
|
64
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
63
65
|
/**
|
|
64
66
|
* Memoized — with an honest account of what that buys, which is less than it
|
|
65
67
|
* looks. `editing` and `pending` are the row's OWN state, so one row writing
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { memo, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { memo, useContext, useEffect, useLayoutEffect, useRef, useState, } from "react";
|
|
4
4
|
import { optimisticDisplay, phoneText, presentedDef, resolveFieldMessage, } from "viewkitjs/fields";
|
|
5
5
|
import { ConvertedFigure } from "../display/converted.js";
|
|
6
6
|
import { renderFieldValue } from "../display/display-cores.js";
|
|
7
|
+
import { FieldRowsCardContext, OutOfFieldRows } from "../internal/field-rows.js";
|
|
7
8
|
import { cx } from "../internal/cx.js";
|
|
9
|
+
import { ROW_INTERACTIVE_SELECTOR as OWN_PRESS } from "../selection/row-click.js";
|
|
8
10
|
import { ELEMENT_RESET } from "../internal/reset.js";
|
|
9
11
|
import { useViews } from "../provider/context.js";
|
|
10
12
|
import { useDesktop } from "../provider/desktop.js";
|
|
11
|
-
import { RowEditor } from "./editors/RowEditor.js";
|
|
13
|
+
import { RowEditor, rowOpensSheet } from "./editors/RowEditor.js";
|
|
12
14
|
import { drawnText } from "./drawn-text.js";
|
|
13
15
|
import { FieldNoteLine } from "./FieldNoteLine.js";
|
|
14
16
|
import { FieldRowCheckbox } from "./field-row-checkbox.js";
|
|
15
|
-
import { FIELD_ROW_FRAME, FIELD_ROW_FRAME_BESIDE, FIELD_ROW_FRAME_UNDER, FieldRowButton, drawFieldRowButton, } from "./field-row-button.js";
|
|
17
|
+
import { FIELD_ROW_FRAME, FIELD_ROW_FRAME_BESIDE, FIELD_ROW_FRAME_ROWS, FIELD_ROW_FRAME_ROWS_UNDER, FIELD_ROW_FRAME_UNDER, FieldRowButton, drawFieldRowButton, } from "./field-row-button.js";
|
|
16
18
|
import { FieldRowLane } from "./FieldRowLane.js";
|
|
17
19
|
import { FieldWriteReconciliationRequired, } from "../fields/write-target.js";
|
|
18
20
|
import { OpenValueAction, isOpenableType } from "../editors/open-value.js";
|
|
19
21
|
import { FIELD_ROW_TARGET as TARGET } from "./row-target.js";
|
|
20
22
|
import { settlementAttributes, useRowSettlement } from "./useRowSettlement.js";
|
|
21
23
|
import { EditLeaveContext, useEditLeaveScope } from "../editors/leave-scope.js";
|
|
24
|
+
const FIELD_ROW_FRAME_READS = "gap-x-(--vk-field-row-gap,calc(var(--spacing)*3)) min-h-(--vk-field-row-h,auto) py-(--vk-field-row-py,calc(var(--spacing)*2.5)) border-b-(length:--vk-field-row-line-w,1px) border-(color:--vk-field-row-line,var(--vk-border)) last:border-0";
|
|
22
25
|
const EDITOR_PANEL = '[data-slot="vk-editor-panel"]';
|
|
23
26
|
export function fieldRowMenuItems(menu, ready, messages) {
|
|
24
27
|
return (menu ?? []).map((item) => {
|
|
@@ -32,11 +35,12 @@ export function fieldRowMenuItems(menu, ready, messages) {
|
|
|
32
35
|
return { ...item, disabled: true, disabledReason: reason, onClick };
|
|
33
36
|
});
|
|
34
37
|
}
|
|
35
|
-
function FieldRowImpl({ binding, row, value, editValue, writable, ready = true, unread = false, refusal, onCommit, opts, menu, meta, note, kindIcon, }) {
|
|
38
|
+
function FieldRowImpl({ binding, row, value, editValue, writable, ready = true, unread = false, refusal, onCommit, opts, menu, meta, note, kindIcon, inCard = false, }) {
|
|
36
39
|
const { field } = binding;
|
|
37
40
|
const views = useViews();
|
|
38
41
|
const desktop = useDesktop();
|
|
39
|
-
const
|
|
42
|
+
const inRows = inCard && !desktop;
|
|
43
|
+
const { atoms, components, conventions, icons, messages, oneValue } = views;
|
|
40
44
|
const { CommandMenu } = atoms;
|
|
41
45
|
const { AppIcon } = components;
|
|
42
46
|
const [editing, setEditing] = useState(false);
|
|
@@ -193,29 +197,81 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
|
|
|
193
197
|
const value = renderFieldValue(field, shown, displayOpts);
|
|
194
198
|
return convertedFrom ? _jsx(ConvertedFigure, { from: convertedFrom, children: value }) : value;
|
|
195
199
|
};
|
|
196
|
-
const body = unread ? null : isEmpty ? (shownDef.type === "boolean" ? (renderFieldValue(field, shown, displayOpts)) : writable ? (_jsx("span", { className: "text-(color:--vk-fg-subtle)", children:
|
|
200
|
+
const body = unread ? null : isEmpty ? (shownDef.type === "boolean" ? (renderFieldValue(field, shown, displayOpts)) : writable ? (_jsx("span", { className: "text-(color:--vk-fg-subtle)", children: inRows
|
|
201
|
+
? messages({ key: "views.field-row.set", values: { label: field.label } })
|
|
202
|
+
: messages({ key: "views.field-row.empty" }) })) : (_jsx("span", { className: "text-(color:--vk-fg-subtle)", children: "\u2014" }))) : (drawn());
|
|
197
203
|
const TypeGlyph = icons[field.type];
|
|
198
204
|
const glyph = binding.icon ? (_jsx(AppIcon, { name: binding.icon, className: "h-3.5 w-3.5 text-(color:--vk-fg-subtlest)" })) : (_jsx(TypeGlyph, { className: "h-3.5 w-3.5 text-(color:--vk-fg-subtlest)" }));
|
|
199
205
|
const menuItems = fieldRowMenuItems(menu, ready, messages);
|
|
200
206
|
const valueNode = (_jsxs("span", { ref: valueRef, className: "flex min-w-0 flex-1 items-center gap-2", children: [_jsx("span", { className: "min-w-0 wrap-break-word", children: body }), meta ? _jsx("span", { className: "shrink-0 text-xs text-(color:--vk-fg-subtle)", children: meta }) : null] }));
|
|
201
|
-
const
|
|
207
|
+
const handOver = () => {
|
|
208
|
+
const row = rowRef.current;
|
|
209
|
+
if (!row || !buttonRef.current || document.activeElement !== buttonRef.current)
|
|
210
|
+
return;
|
|
211
|
+
row.tabIndex = -1;
|
|
212
|
+
row.style.outline = "none";
|
|
213
|
+
row.focus({ preventScroll: true });
|
|
214
|
+
row.addEventListener("blur", () => {
|
|
215
|
+
row.removeAttribute("tabindex");
|
|
216
|
+
row.style.removeProperty("outline");
|
|
217
|
+
}, { once: true });
|
|
218
|
+
};
|
|
219
|
+
const open = (byKey) => {
|
|
220
|
+
if (pending)
|
|
221
|
+
return;
|
|
222
|
+
handOver();
|
|
223
|
+
setError(null);
|
|
224
|
+
setByKey(byKey);
|
|
225
|
+
setEditing(true);
|
|
226
|
+
};
|
|
227
|
+
const frameOf = (shape) => inRows
|
|
228
|
+
? shape === "under"
|
|
229
|
+
? FIELD_ROW_FRAME_ROWS_UNDER
|
|
230
|
+
: shape === "beside"
|
|
231
|
+
? cx(FIELD_ROW_FRAME_ROWS, "flex-1")
|
|
232
|
+
: FIELD_ROW_FRAME_ROWS
|
|
233
|
+
: shape === "under"
|
|
202
234
|
? FIELD_ROW_FRAME_UNDER
|
|
203
235
|
: shape === "beside"
|
|
204
236
|
? FIELD_ROW_FRAME_BESIDE
|
|
205
|
-
: FIELD_ROW_FRAME
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
237
|
+
: FIELD_ROW_FRAME;
|
|
238
|
+
const editButton = (shape, children) => (_jsx(FieldRowButton, { views: views, frame: cx(frameOf(shape), "disabled:pointer-events-none aria-disabled:pointer-events-none", shape !== "under" && pending && "opacity-70"), variant: "ghost", size: "sm", ref: buttonRef, "aria-label": unread || shape === "under" || !shownText ? field.label : `${field.label}, ${shownText}`, disabled: !ready, "aria-disabled": pending ? true : undefined, onClick: (event) => open(event.detail === 0), children: children }));
|
|
239
|
+
const rowRef = useRef(null);
|
|
240
|
+
const downWhileEditing = useRef(false);
|
|
241
|
+
const pressOpens = inRows && writable && shownDef.type !== "boolean" && !hasMenu && !unread && !editing && !pending && ready;
|
|
242
|
+
const onRowPress = (event) => {
|
|
243
|
+
const closedByIt = downWhileEditing.current;
|
|
244
|
+
downWhileEditing.current = false;
|
|
245
|
+
if (!pressOpens || closedByIt)
|
|
246
|
+
return;
|
|
247
|
+
const target = event.target;
|
|
248
|
+
const row = rowRef.current;
|
|
249
|
+
if (!(target instanceof Element) || !row || !row.contains(target))
|
|
250
|
+
return;
|
|
251
|
+
if (target.closest(EDITOR_PANEL))
|
|
252
|
+
return;
|
|
253
|
+
const control = target.closest(OWN_PRESS);
|
|
254
|
+
if (control && row.contains(control))
|
|
255
|
+
return;
|
|
256
|
+
open(false);
|
|
257
|
+
};
|
|
258
|
+
const sheet = inRows && writable && shownDef.type !== "boolean" && !hasMenu && !unread && rowOpensSheet(field, oneValue);
|
|
259
|
+
return (_jsx(EditLeaveContext.Provider, { value: leaveScope, children: _jsxs("div", { ref: rowRef, className: cx(inRows
|
|
260
|
+
?
|
|
261
|
+
cx("o-field-row py-3", pressOpens && "cursor-pointer")
|
|
262
|
+
: desktop
|
|
263
|
+
? "grid grid-cols-[auto_var(--vk-field-row-label-w,calc(var(--spacing)*32))_minmax(0,1fr)_auto] content-center items-start"
|
|
264
|
+
: "grid grid-cols-[auto_minmax(0,1fr)_auto] content-center items-start gap-y-1", !inRows && FIELD_ROW_FRAME_READS), "aria-busy": pending ? "true" : undefined, onClick: inRows ? onRowPress : undefined, onPointerDown: inRows
|
|
265
|
+
? () => {
|
|
266
|
+
downWhileEditing.current = editing;
|
|
267
|
+
}
|
|
268
|
+
: undefined, children: [_jsx("span", { className: inRows ? "o-field-row-glyph" : "flex h-5 w-3.5 shrink-0 items-center justify-center", children: glyph }), _jsx("span", { className: inRows
|
|
269
|
+
? "o-field-row-label"
|
|
270
|
+
: "text-sm leading-5 text-(color:--vk-field-row-label-fg,var(--vk-fg-subtle))", children: field.label }), _jsxs("div", { className: cx(inRows ? "min-w-0 flex-1" : "min-w-0 flex-1 text-sm leading-5 text-(color:--vk-fg)", !desktop && !inRows && "col-span-2 col-start-2 row-start-2", settlement.requested && "italic opacity-80"), ...settlementAttributes(settlement.requested, field.provenance, conventions), children: [editing ? (_jsx("div", { children: _jsx(RowEditor, { binding: binding, row: row, initial: retryDraft ? retryDraft.commit : editValue, refused: retryDraft?.reason, shown: shown, conversion: convertedFrom ? body : undefined, anchor: inRows ? (_jsx("span", { className: "flex min-w-0", children: valueNode })) : (_jsx("span", { className: cx(TARGET, "bg-(color:--vk-neutral)"), children: valueNode })), onAttempt: (resolution) => {
|
|
215
271
|
watchLeaving();
|
|
216
272
|
return attempt(resolution);
|
|
217
273
|
}, onClose: closed, message: message, kindIcon: kindIcon, openedByKey: byKey }) })) : hasMenu && !verbsInLane ? (_jsx(CommandMenu, { trigger: drawFieldRowButton(views, {
|
|
218
|
-
frame: FIELD_ROW_FRAME,
|
|
274
|
+
frame: inRows ? FIELD_ROW_FRAME_ROWS : FIELD_ROW_FRAME,
|
|
219
275
|
variant: "ghost",
|
|
220
276
|
size: "sm",
|
|
221
277
|
"aria-label": field.label,
|
|
@@ -226,6 +282,10 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
|
|
|
226
282
|
const retried = attempt({ kind: "commit", payload: retryDraft.commit });
|
|
227
283
|
if (!retried.accepted)
|
|
228
284
|
setError(retried.reason);
|
|
229
|
-
}, className: cx(ELEMENT_RESET, "hover:underline"), children: error }) })) : null] }), _jsx(FieldRowLane, { label: field.label, verbsInLane: verbsInLane, hasMenu: hasMenu, items: menuItems, ready: ready, writable: writable, refusal: refusal })] }) }));
|
|
285
|
+
}, className: cx(ELEMENT_RESET, "hover:underline"), children: error }) })) : null] }), _jsx(FieldRowLane, { label: field.label, verbsInLane: verbsInLane, hasMenu: hasMenu, items: menuItems, ready: ready, writable: writable, refusal: refusal, rows: inRows, sheet: sheet })] }) }));
|
|
286
|
+
}
|
|
287
|
+
function FieldRowPlace(props) {
|
|
288
|
+
const inCard = useContext(FieldRowsCardContext) !== null;
|
|
289
|
+
return _jsx(OutOfFieldRows, { children: _jsx(FieldRowImpl, { ...props, inCard: inCard }) });
|
|
230
290
|
}
|
|
231
|
-
export const FieldRow = memo(
|
|
291
|
+
export const FieldRow = memo(FieldRowPlace);
|
|
@@ -5,9 +5,10 @@ import type { FieldRowMenuItem } from "../fields/menus.js";
|
|
|
5
5
|
* a relation) and so cannot be the menu's trigger; the ellipsis, when the value
|
|
6
6
|
* IS the trigger; or the lock with its reason, when the row is read-only. It is
|
|
7
7
|
* always drawn, at one width, so every value in the section ends on the same
|
|
8
|
-
* edge whether or not its row has a mark.
|
|
8
|
+
* edge whether or not its row has a mark. In a Field rows card the lane is 16 wide and, where the row's press opens a
|
|
9
|
+
* sheet, holds the › that says so.
|
|
9
10
|
*/
|
|
10
|
-
export declare function FieldRowLane({ label, verbsInLane, hasMenu, items, ready, writable, refusal, }: {
|
|
11
|
+
export declare function FieldRowLane({ label, verbsInLane, hasMenu, items, ready, writable, refusal, rows, sheet, }: {
|
|
11
12
|
/** The FIELD's label — what the verb trigger announces. */
|
|
12
13
|
label: string;
|
|
13
14
|
verbsInLane: boolean;
|
|
@@ -16,4 +17,8 @@ export declare function FieldRowLane({ label, verbsInLane, hasMenu, items, ready
|
|
|
16
17
|
ready: boolean;
|
|
17
18
|
writable: boolean;
|
|
18
19
|
refusal?: string;
|
|
20
|
+
/** The row stands in a Field rows card. */
|
|
21
|
+
rows?: boolean;
|
|
22
|
+
/** Its press opens the editor in a sheet: a › when nothing else stands here. */
|
|
23
|
+
sheet?: boolean;
|
|
19
24
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,19 +2,20 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useViews } from "../provider/context.js";
|
|
4
4
|
import { drawFieldRowButton } from "./field-row-button.js";
|
|
5
|
-
export function FieldRowLane({ label, verbsInLane, hasMenu, items, ready, writable, refusal, }) {
|
|
5
|
+
export function FieldRowLane({ label, verbsInLane, hasMenu, items, ready, writable, refusal, rows = false, sheet = false, }) {
|
|
6
6
|
const views = useViews();
|
|
7
7
|
const { atoms, icons } = views;
|
|
8
8
|
const { CommandMenu } = atoms;
|
|
9
9
|
const Chevron = icons.chevronDown;
|
|
10
10
|
const More = icons.more;
|
|
11
11
|
const Lock = icons.lock;
|
|
12
|
-
|
|
12
|
+
const Next = icons.chevronRight;
|
|
13
|
+
return (_jsx("span", { className: rows ? "flex size-4 shrink-0 items-center justify-center" : "flex h-5 w-3 shrink-0 items-center justify-center", children: verbsInLane ? (_jsx(CommandMenu, { trigger: drawFieldRowButton(views, {
|
|
13
14
|
frame: "group -m-1 size-5 shrink-0",
|
|
14
15
|
variant: "ghost",
|
|
15
16
|
size: "icon",
|
|
16
17
|
"aria-label": label,
|
|
17
18
|
disabled: !ready,
|
|
18
19
|
children: (_jsx(Chevron, { className: "h-3 w-3 text-(color:--vk-fg-subtlest) transition-colors group-hover:text-(color:--vk-fg-subtle)" })),
|
|
19
|
-
}), items: items, align: "end", label: label })) : hasMenu ? (_jsx(More, { className: "h-3 w-3 text-(color:--vk-fg-subtlest)" })) : !writable && refusal ? (_jsx("span", { title: refusal, className: "leading-none", children: _jsx(Lock, { className: "h-3 w-3 text-(color:--vk-fg-subtlest)" }) })) : null }));
|
|
20
|
+
}), items: items, align: "end", label: label })) : hasMenu ? (_jsx(More, { className: "h-3 w-3 text-(color:--vk-fg-subtlest)" })) : !writable && refusal ? (_jsx("span", { title: refusal, className: "leading-none", children: _jsx(Lock, { className: "h-3 w-3 text-(color:--vk-fg-subtlest)" }) })) : sheet ? (_jsx(Next, { className: "size-4 text-(color:--vk-fg-subtlest)" })) : null }));
|
|
20
21
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import type { FieldDef, FieldType } from "viewkitjs/fields";
|
|
3
|
+
import type { ViewsOneValueEditors } from "../../model/one-value.js";
|
|
2
4
|
import type { RowEditorProps } from "./host.js";
|
|
3
5
|
import { RowChipsEditor } from "./RowChipsEditor.js";
|
|
4
6
|
import { RowDateEditor } from "./RowDateEditor.js";
|
|
@@ -36,4 +38,14 @@ export declare const ROW_HOSTS: {
|
|
|
36
38
|
rollup: null;
|
|
37
39
|
formula: null;
|
|
38
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* WHERE EACH TYPE'S HOST OPENS ON A PHONE, beside the hosts, keyed by the same union so a new type needs its answer:
|
|
43
|
+
* in the sheet, in its own box where it stands, in the sheet only as a list (`rowOpensList`), or nowhere (no host). A row in
|
|
44
|
+
* a Field rows card shows its › exactly where its press opens a sheet.
|
|
45
|
+
*/
|
|
46
|
+
export declare const ROW_SURFACES: {
|
|
47
|
+
[K in FieldType]: "sheet" | "in-place" | "list" | null;
|
|
48
|
+
};
|
|
49
|
+
/** Whether pressing a row of this field opens its editor in the sheet on a phone. */
|
|
50
|
+
export declare function rowOpensSheet(field: FieldDef, oneValue: ViewsOneValueEditors | undefined): boolean;
|
|
39
51
|
export declare function RowEditor<Row>(props: RowEditorProps<Row>): ReactNode;
|