viewkitjs 0.28.0 → 0.30.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 +218 -0
- package/MIGRATION.md +181 -11
- package/fields/dist/derived.d.ts +2 -1
- package/fields/dist/derived.js +9 -3
- package/fields/dist/entities.js +41 -3
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/messages.d.ts +8 -2
- package/fields/dist/messages.js +3 -0
- package/fields/dist/range.d.ts +6 -0
- package/fields/dist/range.js +8 -0
- package/fields/dist/registry.js +11 -1
- package/fields/dist/spec-changes.js +1 -0
- package/fields/dist/types.d.ts +23 -1
- package/fields/docs/guides/derived-fields.md +7 -5
- package/fields/docs/guides/field-types.md +2 -2
- package/fields/docs/guides/the-index.md +1 -1
- package/fields/docs/reference/fields.md +3 -1
- package/fields/docs/reference/types.md +3 -1
- package/fields/skills/viewkit/SKILL.md +1 -1
- package/package.json +2 -1
- package/postgres/dist/definitions/build.js +29 -5
- package/postgres/dist/definitions/label.d.ts +7 -0
- package/postgres/dist/definitions/label.js +9 -1
- package/postgres/dist/definitions/lookup.js +6 -2
- package/postgres/dist/definitions/place.d.ts +6 -3
- package/postgres/dist/definitions/rollup.js +5 -1
- package/postgres/dist/definitions/storage.d.ts +15 -0
- package/postgres/dist/definitions/storage.js +52 -1
- package/postgres/dist/definitions/stored.js +21 -0
- package/postgres/dist/phone.d.ts +13 -1
- package/postgres/dist/phone.js +23 -3
- package/postgres/dist/search-indexes.d.ts +6 -1
- package/postgres/dist/search-indexes.js +71 -25
- package/postgres/dist/search.js +3 -3
- package/postgres/docs/guides/definitions.md +22 -5
- package/postgres/docs/guides/field-map.md +5 -4
- package/postgres/docs/reference/definitions.md +3 -3
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/cells/cell-format.d.ts +2 -2
- package/views/dist/cells/cell-format.js +2 -2
- package/views/dist/cells/cell-values.js +9 -12
- package/views/dist/contract.d.ts +161 -18
- package/views/dist/contract.js +170 -28
- package/views/dist/controls/bulk-bar/bulk-bar-of.d.ts +66 -0
- package/views/dist/controls/bulk-bar/bulk-bar-of.js +22 -0
- package/views/dist/controls/bulk-bar/bulk-bar.d.ts +40 -0
- package/views/dist/controls/bulk-bar/bulk-bar.js +278 -0
- package/views/dist/controls/bulk-bar/looks.d.ts +10 -0
- package/views/dist/controls/bulk-bar/looks.js +14 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.d.ts +19 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.js +57 -0
- package/views/dist/controls/bulk-bar/tokens.d.ts +136 -0
- package/views/dist/controls/bulk-bar/tokens.js +36 -0
- package/views/dist/controls/bulk-bar/words.d.ts +50 -0
- package/views/dist/controls/bulk-bar/words.js +19 -0
- package/views/dist/controls/bulk-bar.css +96 -0
- package/views/dist/controls/button/button.js +3 -1
- package/views/dist/controls/button.css +5 -4
- package/views/dist/controls/checkbox/checkbox.js +3 -1
- package/views/dist/controls/checkbox.css +1 -1
- package/views/dist/controls/choice/tokens.d.ts +79 -0
- package/views/dist/controls/choice/tokens.js +22 -0
- package/views/dist/controls/choice.css +31 -0
- package/views/dist/controls/compound-editor/looks.js +1 -1
- package/views/dist/controls/controls.d.ts +8 -0
- package/views/dist/controls/controls.js +8 -0
- package/views/dist/controls/customize/customize.d.ts +176 -0
- package/views/dist/controls/customize/customize.js +348 -0
- package/views/dist/controls/customize/glide.d.ts +10 -0
- package/views/dist/controls/customize/glide.js +55 -0
- package/views/dist/controls/customize/looks.d.ts +13 -0
- package/views/dist/controls/customize/looks.js +11 -0
- package/views/dist/controls/customize/map-customize-body.d.ts +15 -0
- package/views/dist/controls/customize/map-customize-body.js +195 -0
- package/views/dist/controls/customize/map-ranges.d.ts +23 -0
- package/views/dist/controls/customize/map-ranges.js +41 -0
- package/views/dist/controls/customize/rules.d.ts +39 -0
- package/views/dist/controls/customize/rules.js +21 -0
- package/views/dist/controls/customize/tokens.d.ts +40 -0
- package/views/dist/controls/customize/tokens.js +12 -0
- package/views/dist/controls/customize/words.d.ts +65 -0
- package/views/dist/controls/customize/words.js +42 -0
- package/views/dist/controls/customize.css +57 -0
- package/views/dist/controls/date-editor/looks.js +1 -1
- package/views/dist/controls/filter-editor/block.d.ts +31 -0
- package/views/dist/controls/filter-editor/block.js +27 -0
- package/views/dist/controls/filter-editor/filter-editor.d.ts +4 -0
- package/views/dist/controls/filter-editor/filter-editor.js +86 -43
- package/views/dist/controls/filter-editor/how.d.ts +1 -1
- package/views/dist/controls/filter-editor/how.js +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +16 -1
- package/views/dist/controls/filter-editor/map-filter-body.js +39 -13
- package/views/dist/controls/filter-editor/map-rules.d.ts +27 -11
- package/views/dist/controls/filter-editor/map-rules.js +73 -42
- package/views/dist/controls/filter-editor/rules.d.ts +42 -5
- package/views/dist/controls/filter-editor/rules.js +55 -2
- package/views/dist/controls/filter-editor/words.d.ts +15 -0
- package/views/dist/controls/filter-editor/words.js +6 -0
- package/views/dist/controls/filter-editor.css +18 -0
- package/views/dist/controls/index.d.ts +33 -9
- package/views/dist/controls/index.js +32 -9
- package/views/dist/controls/inline-input/looks.js +1 -1
- package/views/dist/controls/input/input.js +10 -4
- package/views/dist/controls/internal/phone.d.ts +5 -4
- package/views/dist/controls/internal/phone.js +7 -7
- package/views/dist/controls/internal/scroll.js +5 -1
- package/views/dist/controls/internal/typed-run.d.ts +2 -0
- package/views/dist/controls/internal/typed-run.js +5 -0
- package/views/dist/controls/menu/map-menu.js +2 -2
- package/views/dist/controls/menu-list/menu-list.d.ts +16 -1
- package/views/dist/controls/menu-list/menu-list.js +26 -8
- package/views/dist/controls/menu-list.css +8 -0
- package/views/dist/controls/number-editor/looks.js +1 -1
- package/views/dist/controls/option/option.js +3 -1
- package/views/dist/controls/option.css +1 -1
- package/views/dist/controls/pane/pane.d.ts +4 -0
- package/views/dist/controls/pane/pane.js +2 -1
- package/views/dist/controls/picker/looks.js +1 -1
- package/views/dist/controls/picker/map-picker.d.ts +6 -2
- package/views/dist/controls/picker/map-picker.js +4 -2
- package/views/dist/controls/picker/picker.d.ts +7 -0
- package/views/dist/controls/picker/picker.js +57 -8
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +2 -2
- package/views/dist/controls/popover/popover.js +2 -1
- package/views/dist/controls/popover.css +3 -0
- package/views/dist/controls/ports-host/map-ports-host.d.ts +7 -0
- package/views/dist/controls/ports-host/map-ports-host.js +43 -0
- package/views/dist/controls/press/tokens.d.ts +8 -0
- package/views/dist/controls/press/tokens.js +4 -0
- package/views/dist/controls/press.css +44 -0
- package/views/dist/controls/quick-filters/looks.d.ts +11 -0
- package/views/dist/controls/quick-filters/looks.js +9 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +31 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +59 -0
- package/views/dist/controls/quick-filters/quick-filters.d.ts +37 -0
- package/views/dist/controls/quick-filters/quick-filters.js +89 -0
- package/views/dist/controls/quick-filters/reminder.d.ts +18 -0
- package/views/dist/controls/quick-filters/reminder.js +41 -0
- package/views/dist/controls/quick-filters/rules.d.ts +89 -0
- package/views/dist/controls/quick-filters/rules.js +52 -0
- package/views/dist/controls/quick-filters/tokens.d.ts +112 -0
- package/views/dist/controls/quick-filters/tokens.js +30 -0
- package/views/dist/controls/quick-filters/words.d.ts +25 -0
- package/views/dist/controls/quick-filters/words.js +13 -0
- package/views/dist/controls/quick-filters.css +118 -0
- package/views/dist/controls/sheet/bottom-sheet.d.ts +9 -4
- package/views/dist/controls/sheet/bottom-sheet.js +4 -4
- package/views/dist/controls/sheet/map-sheet.d.ts +4 -1
- package/views/dist/controls/sheet/map-sheet.js +19 -6
- package/views/dist/controls/sheet/sheet-parts.d.ts +10 -0
- package/views/dist/controls/sheet/sheet-parts.js +2 -0
- package/views/dist/controls/switch-row/switch-row.d.ts +15 -0
- package/views/dist/controls/switch-row/switch-row.js +9 -0
- package/views/dist/controls/switch-row/tokens.d.ts +51 -0
- package/views/dist/controls/switch-row/tokens.js +15 -0
- package/views/dist/controls/switch-row.css +39 -0
- package/views/dist/controls/switch.css +1 -1
- package/views/dist/controls/tag/tag.js +3 -1
- package/views/dist/controls/tag-field/tag-field.d.ts +20 -0
- package/views/dist/controls/tag-field/tag-field.js +19 -0
- package/views/dist/controls/tag-field/tokens.d.ts +7 -0
- package/views/dist/controls/tag-field/tokens.js +4 -0
- package/views/dist/controls/tag-field.css +13 -0
- package/views/dist/controls/text-editor/looks.js +1 -1
- package/views/dist/controls/text-editor/map-text-body.d.ts +1 -1
- package/views/dist/controls/text-editor/map-text-body.js +2 -2
- package/views/dist/controls/text-editor/text-editor.d.ts +3 -0
- package/views/dist/controls/text-editor/text-editor.js +17 -7
- package/views/dist/controls/text-editor.css +11 -0
- package/views/dist/controls/toast/toast.d.ts +5 -1
- package/views/dist/controls/toast/toast.js +5 -3
- package/views/dist/controls/tokens.js +18 -0
- package/views/dist/controls/toolbar/keys.d.ts +3 -0
- package/views/dist/controls/toolbar/keys.js +11 -0
- package/views/dist/controls/toolbar/looks.d.ts +10 -0
- package/views/dist/controls/toolbar/looks.js +40 -0
- package/views/dist/controls/toolbar/tokens.d.ts +28 -0
- package/views/dist/controls/toolbar/tokens.js +9 -0
- package/views/dist/controls/toolbar/toolbar.d.ts +111 -0
- package/views/dist/controls/toolbar/toolbar.js +370 -0
- package/views/dist/controls/toolbar/words.d.ts +28 -0
- package/views/dist/controls/toolbar/words.js +17 -0
- package/views/dist/controls/toolbar-button/looks.d.ts +4 -0
- package/views/dist/controls/toolbar-button/looks.js +21 -0
- package/views/dist/controls/toolbar-button/tokens.d.ts +103 -0
- package/views/dist/controls/toolbar-button/tokens.js +28 -0
- package/views/dist/controls/toolbar-button/toolbar-button.d.ts +66 -0
- package/views/dist/controls/toolbar-button/toolbar-button.js +51 -0
- package/views/dist/controls/toolbar-button.css +75 -0
- package/views/dist/controls/toolbar.css +65 -0
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +2 -2
- package/views/dist/controls/tooltip/tooltip.d.ts +3 -1
- package/views/dist/controls/tooltip/tooltip.js +2 -2
- package/views/dist/controls/values-editor/looks.js +1 -1
- package/views/dist/controls/values-editor/values.js +6 -2
- package/views/dist/controls/views-list/map-views-list-body.d.ts +4 -1
- package/views/dist/controls/views-list/map-views-list-body.js +128 -4
- package/views/dist/controls/views-list/rules.d.ts +26 -0
- package/views/dist/controls/views-list/rules.js +63 -0
- package/views/dist/controls/views-list/view-menu.d.ts +84 -0
- package/views/dist/controls/views-list/view-menu.js +201 -0
- package/views/dist/controls/views-list/views-list.d.ts +8 -1
- package/views/dist/controls/views-list/views-list.js +18 -3
- package/views/dist/controls/views-list/words.d.ts +54 -0
- package/views/dist/controls/views-list/words.js +10 -1
- package/views/dist/controls/views-list.css +5 -1
- package/views/dist/display/date.js +3 -3
- package/views/dist/display/format.d.ts +6 -0
- package/views/dist/display/format.js +3 -0
- package/views/dist/display/index.d.ts +1 -1
- package/views/dist/display/index.js +1 -1
- package/views/dist/display/options.d.ts +1 -1
- package/views/dist/display/range.d.ts +2 -1
- package/views/dist/display/range.js +4 -1
- package/views/dist/display/rich-text.js +0 -1
- package/views/dist/editors/ChipsEditor.d.ts +4 -5
- package/views/dist/editors/ChipsEditor.js +12 -78
- package/views/dist/editors/DateEditor.d.ts +12 -16
- package/views/dist/editors/DateEditor.js +40 -191
- package/views/dist/editors/EditorPanel.d.ts +2 -6
- package/views/dist/editors/EditorPanel.js +2 -2
- package/views/dist/editors/LocationEditor.d.ts +11 -19
- package/views/dist/editors/LocationEditor.js +19 -211
- package/views/dist/editors/NameEditor.d.ts +8 -16
- package/views/dist/editors/NameEditor.js +11 -100
- package/views/dist/editors/NumberEditor.d.ts +14 -21
- package/views/dist/editors/NumberEditor.js +22 -49
- package/views/dist/editors/RangeEditor.d.ts +9 -33
- package/views/dist/editors/RangeEditor.js +12 -97
- package/views/dist/editors/RelationEditor.d.ts +6 -9
- package/views/dist/editors/RelationEditor.js +11 -30
- package/views/dist/editors/RelationSetEditor.d.ts +13 -24
- package/views/dist/editors/RelationSetEditor.js +33 -101
- package/views/dist/editors/SelectEditor.d.ts +15 -17
- package/views/dist/editors/SelectEditor.js +15 -94
- package/views/dist/editors/TextEditor.d.ts +23 -26
- package/views/dist/editors/TextEditor.js +11 -48
- package/views/dist/editors/ValueListEditor.d.ts +14 -23
- package/views/dist/editors/ValueListEditor.js +16 -202
- package/views/dist/editors/body-panel.d.ts +13 -7
- package/views/dist/editors/body-panel.js +3 -7
- package/views/dist/editors/edit-cores.d.ts +15 -15
- package/views/dist/editors/edit-cores.js +14 -14
- package/views/dist/editors/number-body.d.ts +1 -1
- package/views/dist/editors/number-step.d.ts +0 -34
- package/views/dist/editors/number-step.js +0 -37
- package/views/dist/editors/option-add-flow.d.ts +1 -13
- package/views/dist/editors/option-add-flow.js +0 -22
- package/views/dist/editors/relation-links-body.d.ts +2 -3
- package/views/dist/editors/relation-picker.d.ts +13 -3
- package/views/dist/editors/relation-source.d.ts +0 -22
- package/views/dist/editors/relation-source.js +0 -21
- package/views/dist/field-row/FieldRow.js +5 -6
- package/views/dist/field-row/FieldRowLane.js +0 -1
- package/views/dist/field-row/editors/RowChipsEditor.js +2 -2
- package/views/dist/field-row/editors/RowDateEditor.d.ts +2 -2
- package/views/dist/field-row/editors/RowDateEditor.js +2 -2
- package/views/dist/field-row/editors/RowNameEditor.d.ts +2 -5
- package/views/dist/field-row/editors/RowNameEditor.js +7 -12
- package/views/dist/field-row/editors/RowNumberEditor.d.ts +1 -1
- package/views/dist/field-row/editors/RowNumberEditor.js +4 -4
- package/views/dist/field-row/editors/RowPlaceEditor.js +3 -3
- package/views/dist/field-row/editors/RowRangeEditor.d.ts +2 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +7 -14
- package/views/dist/field-row/editors/RowRelationEditor.js +3 -3
- package/views/dist/field-row/editors/RowSelectEditor.js +2 -2
- package/views/dist/field-row/editors/RowTextEditor.d.ts +1 -1
- package/views/dist/field-row/editors/RowTextEditor.js +3 -4
- package/views/dist/field-row/editors/RowValueListEditor.js +5 -5
- package/views/dist/field-row/field-row-button.d.ts +6 -9
- package/views/dist/field-row/field-row-button.js +1 -6
- package/views/dist/field-row/field-row-checkbox.d.ts +1 -1
- package/views/dist/field-row/row-target.d.ts +0 -7
- package/views/dist/field-row/row-target.js +0 -2
- package/views/dist/grid/chrome/GridAddColumn.d.ts +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +8 -66
- package/views/dist/grid/chrome/GridAggregateMenu.d.ts +5 -7
- package/views/dist/grid/chrome/GridAggregateMenu.js +20 -39
- package/views/dist/grid/chrome/GridCellEditors.d.ts +2 -2
- package/views/dist/grid/chrome/GridCellEditors.js +12 -12
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -3
- package/views/dist/grid/chrome/GridColumnMenu.d.ts +11 -12
- package/views/dist/grid/chrome/GridColumnMenu.js +32 -93
- package/views/dist/grid/chrome/GridDateEditor.d.ts +6 -6
- package/views/dist/grid/chrome/GridDateEditor.js +3 -3
- package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -6
- package/views/dist/grid/chrome/GridGroupMenu.js +21 -62
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -2
- package/views/dist/grid/chrome/GridHeader.js +3 -2
- package/views/dist/grid/chrome/GridLongTextEditor.d.ts +17 -38
- package/views/dist/grid/chrome/GridLongTextEditor.js +6 -7
- package/views/dist/grid/chrome/GridNameEditor.js +4 -4
- package/views/dist/grid/chrome/GridNumberEditor.d.ts +4 -5
- package/views/dist/grid/chrome/GridNumberEditor.js +5 -6
- package/views/dist/grid/chrome/GridPlaceEditor.d.ts +2 -5
- package/views/dist/grid/chrome/GridPlaceEditor.js +5 -5
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +6 -12
- package/views/dist/grid/chrome/GridRangeEditor.js +7 -15
- package/views/dist/grid/chrome/GridRelationEditor.js +5 -5
- package/views/dist/grid/chrome/GridRow.js +0 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +1 -1
- package/views/dist/grid/chrome/GridRowActions.js +0 -5
- package/views/dist/grid/chrome/GridRowCells.js +11 -7
- package/views/dist/grid/chrome/GridSelectEditor.js +3 -3
- package/views/dist/grid/chrome/GridStructure.js +0 -1
- package/views/dist/grid/chrome/GridTable.js +1 -1
- package/views/dist/grid/chrome/GridTextEditor.d.ts +5 -7
- package/views/dist/grid/chrome/GridTextEditor.js +5 -18
- package/views/dist/grid/chrome/GridValueListEditor.js +4 -4
- package/views/dist/grid/chrome/grid-body-place.d.ts +2 -3
- package/views/dist/grid/chrome/grid-body-place.js +4 -8
- package/views/dist/grid/chrome/grid-button.d.ts +7 -10
- package/views/dist/grid/chrome/grid-button.js +1 -6
- package/views/dist/grid/chrome/grid-cell-classes.js +1 -1
- package/views/dist/grid/chrome/grid-column-menu-items.d.ts +4 -4
- package/views/dist/grid/chrome/grid-column-menu-items.js +10 -6
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -1
- package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +7 -1
- package/views/dist/grid/chrome/grid-fitted-box.js +4 -4
- package/views/dist/grid/chrome/grid-group-menu-parts.d.ts +5 -9
- package/views/dist/grid/chrome/grid-group-menu-parts.js +1 -3
- package/views/dist/grid/chrome/grid-hover.js +0 -1
- package/views/dist/grid/chrome/grid-menu-focus.d.ts +7 -31
- package/views/dist/grid/chrome/grid-menu-focus.js +7 -47
- package/views/dist/grid/chrome/grid-styles.d.ts +0 -3
- package/views/dist/grid/chrome/grid-styles.js +0 -1
- package/views/dist/grid/chrome/grid-table-props.d.ts +6 -10
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -4
- package/views/dist/grid/core/clipboard-model.js +9 -4
- package/views/dist/grid/core/editing-controller.d.ts +2 -1
- package/views/dist/grid/core/editing-controller.js +10 -2
- package/views/dist/grid/core/refusal-sentence.d.ts +3 -0
- package/views/dist/grid/core/refusal-sentence.js +2 -2
- package/views/dist/grid/core/write-states.d.ts +3 -1
- package/views/dist/grid/core/write-states.js +6 -2
- package/views/dist/grid/grid.css +240 -0
- package/views/dist/grid/looks.d.ts +5 -1
- package/views/dist/grid/looks.js +20 -12
- package/views/dist/grid-tokens.d.ts +109 -0
- package/views/dist/grid-tokens.js +29 -0
- package/views/dist/looks/index.d.ts +5 -0
- package/views/dist/looks/index.js +5 -0
- package/views/dist/looks/pieces.js +10 -0
- package/views/dist/model/body-frame.d.ts +0 -32
- package/views/dist/model/body-frame.js +1 -15
- package/views/dist/model/column-capabilities.d.ts +2 -0
- package/views/dist/model/column-filters.d.ts +2 -1
- package/views/dist/model/column-from.js +2 -2
- package/views/dist/model/column-inspect.d.ts +5 -5
- package/views/dist/model/column-inspect.js +2 -2
- package/views/dist/model/relation-filters.d.ts +2 -0
- package/views/dist/panels/customize-body.d.ts +1 -10
- package/views/dist/panels/customize-body.js +0 -3
- package/views/dist/panels/filter/MenuSelect.js +0 -5
- package/views/dist/panels/filter/RangeFilterBody.js +0 -1
- package/views/dist/panels/filter/details.d.ts +1 -5
- package/views/dist/panels/filter/details.js +0 -13
- package/views/dist/panels/filter/filter-list.d.ts +0 -1
- package/views/dist/panels/filter/filter-list.js +1 -1
- package/views/dist/panels/index.d.ts +2 -2
- package/views/dist/panels/index.js +2 -2
- package/views/dist/panels/labels.d.ts +4 -0
- package/views/dist/panels/labels.js +8 -0
- package/views/dist/panels/model.d.ts +10 -2
- package/views/dist/panels/panel-button.d.ts +10 -12
- package/views/dist/panels/panel-button.js +1 -6
- package/views/dist/panels/quick/model.d.ts +4 -0
- package/views/dist/panels/react/chrome.d.ts +0 -17
- package/views/dist/panels/react/chrome.js +0 -8
- package/views/dist/panels/react/customize-body.d.ts +14 -12
- package/views/dist/panels/react/customize-body.js +93 -19
- package/views/dist/panels/react/customize.d.ts +16 -12
- package/views/dist/panels/react/customize.js +4 -110
- package/views/dist/panels/react/filter/FilterEditor.d.ts +4 -18
- package/views/dist/panels/react/filter/FilterEditor.js +6 -330
- package/views/dist/panels/react/filter/FilterFieldList.d.ts +1 -1
- package/views/dist/panels/react/filter/FilterFieldList.js +27 -51
- package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +1 -11
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +8 -144
- package/views/dist/panels/react/filter/editor-ctx.d.ts +1 -33
- package/views/dist/panels/react/filter/editor-ctx.js +5 -33
- package/views/dist/panels/react/filter/filter-body.js +5 -2
- package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -6
- package/views/dist/panels/react/filter/filter-part-body.js +0 -5
- package/views/dist/panels/react/filter/rule-writes.d.ts +1 -26
- package/views/dist/panels/react/filter/rule-writes.js +4 -95
- package/views/dist/panels/react/order-details.d.ts +1 -26
- package/views/dist/panels/react/order-details.js +3 -69
- package/views/dist/panels/react/panel-header.js +0 -1
- package/views/dist/panels/react/panel-step.d.ts +3 -0
- package/views/dist/panels/react/panel-step.js +2 -1
- package/views/dist/panels/react/popover.d.ts +4 -7
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +2 -4
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +16 -136
- package/views/dist/panels/react/sort/SortEditor.d.ts +4 -4
- package/views/dist/panels/react/sort/SortEditor.js +8 -245
- package/views/dist/panels/react/sort/SortFieldList.d.ts +1 -1
- package/views/dist/panels/react/sort/SortFieldList.js +11 -25
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +10 -3
- package/views/dist/panels/react/toolbar/Toolbar.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +16 -18
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +3 -3
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +12 -4
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +0 -4
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +0 -1
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +3 -3
- package/views/dist/panels/react/view-actions.js +0 -1
- package/views/dist/panels/react/views-row/FoldingViewRow.js +2 -5
- package/views/dist/panels/react/views-row/ViewCreatePill.js +0 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +30 -45
- package/views/dist/panels/react/views-row/ViewPickerRow.js +0 -2
- package/views/dist/panels/react/views-row/menu-classes.d.ts +0 -4
- package/views/dist/panels/react/views-row/menu-classes.js +0 -2
- package/views/dist/panels/react.d.ts +5 -12
- package/views/dist/panels/react.js +5 -12
- package/views/dist/panels/settings/filter-groups.d.ts +3 -0
- package/views/dist/panels/settings/filter-groups.js +40 -9
- package/views/dist/panels/settings/filters.d.ts +5 -0
- package/views/dist/panels/settings/filters.js +12 -6
- package/views/dist/panels/views-row/model.d.ts +10 -1
- package/views/dist/provider/ViewsProvider.d.ts +2 -46
- package/views/dist/provider/ViewsProvider.js +31 -27
- package/views/dist/provider/components.d.ts +295 -107
- package/views/dist/provider/context.d.ts +7 -21
- package/views/dist/provider/missing-slot.d.ts +3 -7
- package/views/dist/provider/missing-slot.js +2 -9
- package/views/dist/provider/ports.d.ts +18 -6
- package/views/dist/provider/ports.js +2 -1
- package/views/dist/react.d.ts +2 -3
- package/views/dist/react.js +1 -1
- package/views/dist/selection/SelectionBar.d.ts +2 -16
- package/views/dist/selection/SelectionBar.js +6 -4
- package/views/dist/selection/bar-props.d.ts +26 -0
- package/views/dist/selection/bar-props.js +1 -0
- package/views/dist/selection/index.d.ts +1 -1
- package/views/dist/selection/verbs.d.ts +32 -5
- package/views/dist/styles.css +694 -191
- package/views/dist/styles.unlayered.css +691 -188
- package/views/docs/contract.md +133 -130
- package/views/docs/controls/bulk-bar.md +41 -0
- package/views/docs/controls/choice.md +25 -0
- package/views/docs/controls/customize.md +17 -0
- package/views/docs/controls/popover.md +2 -0
- package/views/docs/controls/press.md +9 -0
- package/views/docs/controls/quick-filters.md +35 -0
- package/views/docs/controls/radio.md +1 -1
- package/views/docs/controls/switch-row.md +18 -0
- package/views/docs/controls/tag-field.md +7 -0
- package/views/docs/controls/toolbar-button.md +31 -0
- package/views/docs/controls/toolbar.md +14 -0
- package/views/docs/getting-started.md +222 -2
- package/views/docs/guides/atoms.md +2 -2
- package/views/docs/guides/cells.md +224 -4
- package/views/docs/guides/display.md +3 -3
- package/views/docs/guides/editors.md +235 -20
- package/views/docs/guides/looks.md +8 -2
- package/views/docs/guides/ports.md +7 -7
- package/views/docs/guides/selection.md +5 -1
- package/views/docs/guides/the-grid.md +15 -17
- package/views/docs/guides/the-provider.md +9 -15
- package/views/docs/install.md +4 -1
- package/views/docs/reference/cells.md +2 -2
- package/views/docs/reference/controls.md +215 -21
- package/views/docs/reference/display.md +1 -0
- package/views/docs/reference/editors-chips.md +2 -2
- package/views/docs/reference/editors-date.md +4 -4
- package/views/docs/reference/editors-location.md +4 -7
- package/views/docs/reference/editors-name.md +3 -5
- package/views/docs/reference/editors-number.md +10 -10
- package/views/docs/reference/editors-panel.md +3 -3
- package/views/docs/reference/editors-range.md +3 -5
- package/views/docs/reference/editors-relation.md +4 -4
- package/views/docs/reference/editors-select.md +3 -3
- package/views/docs/reference/editors-text.md +3 -4
- package/views/docs/reference/editors-value-list.md +3 -3
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -2
- package/views/docs/reference/looks.md +25 -11
- package/views/docs/reference/panels-react.md +23 -37
- package/views/docs/reference/panels.md +8 -6
- package/views/docs/reference/react.md +24 -24
- package/views/docs/reference/selection.md +4 -2
- package/views/docs/reference/views.md +12 -11
- package/views/skills/views/SKILL.md +2 -2
- package/views/dist/editors/relation-panel.d.ts +0 -69
- package/views/dist/editors/relation-panel.js +0 -46
- package/views/dist/grid/chrome/GridColumnColorSection.d.ts +0 -13
- package/views/dist/grid/chrome/GridColumnColorSection.js +0 -40
- package/views/dist/grid/chrome/GridColumnDateSection.d.ts +0 -28
- package/views/dist/grid/chrome/GridColumnDateSection.js +0 -23
- package/views/dist/grid/chrome/GridColumnDurationSection.d.ts +0 -23
- package/views/dist/grid/chrome/GridColumnDurationSection.js +0 -24
- package/views/dist/grid/chrome/GridColumnNumberSection.d.ts +0 -29
- package/views/dist/grid/chrome/GridColumnNumberSection.js +0 -27
- package/views/dist/grid/chrome/GridColumnPercentSection.d.ts +0 -16
- package/views/dist/grid/chrome/GridColumnPercentSection.js +0 -16
- package/views/dist/grid/chrome/GridColumnSortSection.d.ts +0 -38
- package/views/dist/grid/chrome/GridColumnSortSection.js +0 -33
- package/views/dist/grid/chrome/GridFlyout.d.ts +0 -44
- package/views/dist/grid/chrome/GridFlyout.js +0 -80
- package/views/dist/grid/chrome/GridMenuRow.d.ts +0 -15
- package/views/dist/grid/chrome/GridMenuRow.js +0 -15
- package/views/dist/grid/chrome/grid-menu-search.d.ts +0 -7
- package/views/dist/grid/chrome/grid-menu-search.js +0 -7
- package/views/dist/panels/react/GroupBucketsList.d.ts +0 -16
- package/views/dist/panels/react/GroupBucketsList.js +0 -44
- package/views/dist/panels/react/LayoutColumnsList.d.ts +0 -24
- package/views/dist/panels/react/LayoutColumnsList.js +0 -101
- package/views/dist/panels/react/PopoverColumnDetail.d.ts +0 -11
- package/views/dist/panels/react/PopoverColumnDetail.js +0 -24
- package/views/dist/panels/react/drag.d.ts +0 -2
- package/views/dist/panels/react/drag.js +0 -5
- package/views/dist/panels/react/layout-detail.d.ts +0 -4
- package/views/dist/panels/react/layout-detail.js +0 -29
- package/views/dist/panels/react/root-list.d.ts +0 -6
- package/views/dist/panels/react/root-list.js +0 -31
- package/views/dist/panels/react/sort/use-sort-drag.d.ts +0 -17
- package/views/dist/panels/react/sort/use-sort-drag.js +0 -39
- package/views/dist/panels/react/view-footer.d.ts +0 -20
- package/views/dist/panels/react/view-footer.js +0 -41
|
@@ -71,10 +71,10 @@ assert.equal(columns.stage.command, true); // a command field's column
|
|
|
71
71
|
|
|
72
72
|
What it does with a column depends on what the column is:
|
|
73
73
|
|
|
74
|
-
- An empty value draws nothing, `null`, so a card can leave the line out. A boolean draws its off state instead, which is what a person clicks to turn it on.
|
|
74
|
+
- An empty value draws nothing, `null`, so a card can leave the line out. A boolean draws its off state instead, which is what a person clicks to turn it on, and a `command` column handed `commandItems` draws its chevron alone, so its verbs are still one click away.
|
|
75
75
|
- A `title` column draws the row's title cell, the hotspot that opens the row (`data-cell-open`), with the column's `indicator` beside the name. A title whose field is a number, a percent, a currency, a date, a datetime or a name draws through that field, so a dated identity reads as a date; any other title draws as its text.
|
|
76
76
|
- A relation chip goes where your `RelationLink` atom says, the app-wide answer for each kind of record. `onOpenRelation` overrides it for one surface and is handed the chip that was pressed, which matters when a cell holds several.
|
|
77
|
-
- A `command` column handed `commandItems` opens your `CommandMenu` atom: the verbs for this row in place of an editor. The trigger is the value itself, or a chevron beside it where the value is a control of its own (a relation, a
|
|
77
|
+
- A `command` column handed `commandItems` opens your `CommandMenu` atom: the verbs for this row in place of an editor. The trigger is the value itself, or a chevron beside it where the value is a control of its own (a relation, a link, an email, a phone or a domain). A member is no control there: its chip is drawn inert inside the trigger, so a click on the name opens the verbs, not the member. Without `commandItems` the cell is a plain value. [A command field](../contract.md#a-command-field) in the contract says where the verbs come from.
|
|
78
78
|
- Any other column draws its field's display, in the code `resolveRowCurrency` finds for a money value. A money figure the column reads converted from the row's own currency (`convertedFromOf`) comes back marked: ≈ before it and a title naming the currency it came from (`ConvertedFigure`).
|
|
79
79
|
|
|
80
80
|
```tsx
|
|
@@ -184,8 +184,9 @@ import { NOOP_PORTS, ViewsProvider, type ViewsComponents, type ViewsIcons } from
|
|
|
184
184
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
185
185
|
|
|
186
186
|
const components: ViewsComponents = {
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
// It draws every button ViewKit draws itself, so it forwards the ref and every prop it is handed to its element.
|
|
188
|
+
Button: ({ children, variant: _variant, size: _size, type = "button", ...rest }) => (
|
|
189
|
+
<button type={type} {...rest}>
|
|
189
190
|
{children}
|
|
190
191
|
</button>
|
|
191
192
|
),
|
|
@@ -236,6 +237,225 @@ const components: ViewsComponents = {
|
|
|
236
237
|
Sheet: ({ open, children }) => (open ? <div role="dialog">{children}</div> : null),
|
|
237
238
|
AppIcon: ({ name, className }) => <i data-icon={name} className={className} />,
|
|
238
239
|
Markdown: ({ source, className }) => <div className={className}>{source}</div>,
|
|
240
|
+
// The required bodies: a box for a text and one for a number, each handing every change as it is made, a pick list, a
|
|
241
|
+
// relation's links, a date, a name, a place or a range, and several values.
|
|
242
|
+
TextBody: ({ label, value, onValueChange, onDone }) => (
|
|
243
|
+
<input
|
|
244
|
+
aria-label={label}
|
|
245
|
+
value={value}
|
|
246
|
+
onChange={(event) => onValueChange(event.target.value)}
|
|
247
|
+
onKeyDown={(event) => event.key === "Enter" && onDone()}
|
|
248
|
+
/>
|
|
249
|
+
),
|
|
250
|
+
NumberBody: ({ label, value, onValueChange, onDone }) => (
|
|
251
|
+
<input
|
|
252
|
+
aria-label={label}
|
|
253
|
+
inputMode="decimal"
|
|
254
|
+
value={value == null || Number.isNaN(value) ? "" : String(value)}
|
|
255
|
+
onChange={(event) => onValueChange(event.target.value === "" ? null : Number(event.target.value))}
|
|
256
|
+
onKeyDown={(event) => event.key === "Enter" && onDone()}
|
|
257
|
+
/>
|
|
258
|
+
),
|
|
259
|
+
// A pick list: a row per item handed, a press picking one (or ticking it in a list of several).
|
|
260
|
+
Picker: ({ label, items, value, onValueChange, onDone, multiple }) => {
|
|
261
|
+
const held = Array.isArray(value) ? value : value === null ? [] : [value];
|
|
262
|
+
return (
|
|
263
|
+
<div role="listbox" aria-label={label}>
|
|
264
|
+
{items.map((item) => (
|
|
265
|
+
<div
|
|
266
|
+
key={item.value}
|
|
267
|
+
role="option"
|
|
268
|
+
aria-selected={held.includes(item.value)}
|
|
269
|
+
onClick={() => {
|
|
270
|
+
if (!multiple) return onValueChange(item.value), onDone();
|
|
271
|
+
onValueChange(held.includes(item.value) ? held.filter((v) => v !== item.value) : [...held, item.value]);
|
|
272
|
+
}}
|
|
273
|
+
>
|
|
274
|
+
{item.label}
|
|
275
|
+
</div>
|
|
276
|
+
))}
|
|
277
|
+
</div>
|
|
278
|
+
);
|
|
279
|
+
},
|
|
280
|
+
// A relation's links: a row per record, a press linking or unlinking it, and Done.
|
|
281
|
+
LinksBody: ({ label, items, links, onLinksChange, onDone }) => (
|
|
282
|
+
<div role="listbox" aria-label={label}>
|
|
283
|
+
{items.map((item) => {
|
|
284
|
+
const linked = links.some((link) => link.value === item.value);
|
|
285
|
+
return (
|
|
286
|
+
<div
|
|
287
|
+
key={item.value}
|
|
288
|
+
role="option"
|
|
289
|
+
aria-selected={linked}
|
|
290
|
+
onClick={() =>
|
|
291
|
+
onLinksChange(linked ? links.filter((link) => link.value !== item.value) : [...links, { value: item.value, roles: [] }])
|
|
292
|
+
}
|
|
293
|
+
>
|
|
294
|
+
{item.label}
|
|
295
|
+
</div>
|
|
296
|
+
);
|
|
297
|
+
})}
|
|
298
|
+
<button type="button" onClick={onDone}>
|
|
299
|
+
Done
|
|
300
|
+
</button>
|
|
301
|
+
</div>
|
|
302
|
+
),
|
|
303
|
+
// A date: a line holding the day ("YYYY-MM-DD", or with "THH:MM"), Enter for done.
|
|
304
|
+
// Uncontrolled: the editor takes only a whole date, so a line it held would undo every key typed on the way to one.
|
|
305
|
+
DateBody: ({ label, value, onValueChange, onDone }) => (
|
|
306
|
+
<input
|
|
307
|
+
aria-label={label}
|
|
308
|
+
defaultValue={value ?? ""}
|
|
309
|
+
onChange={(event) => onValueChange(event.target.value === "" ? null : event.target.value)}
|
|
310
|
+
onKeyDown={(event) => event.key === "Enter" && onDone()}
|
|
311
|
+
/>
|
|
312
|
+
),
|
|
313
|
+
// A name, a place or a range: a box per part, Enter for done.
|
|
314
|
+
PartsBody: (props) => {
|
|
315
|
+
const done = (event: { key: string }) => event.key === "Enter" && props.onDone();
|
|
316
|
+
if (props.kind === "range") {
|
|
317
|
+
const { value, onValueChange } = props;
|
|
318
|
+
const end = (text: string) => (text === "" ? null : Number(text));
|
|
319
|
+
return (
|
|
320
|
+
<div role="group" aria-label={props.label}>
|
|
321
|
+
<input aria-label="From" value={value.low ?? ""} onChange={(event) => onValueChange({ ...value, low: end(event.target.value) })} onKeyDown={done} />
|
|
322
|
+
<input aria-label="To" value={value.high ?? ""} onChange={(event) => onValueChange({ ...value, high: end(event.target.value) })} onKeyDown={done} />
|
|
323
|
+
</div>
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
if (props.kind === "name") {
|
|
327
|
+
const { value, onValueChange } = props;
|
|
328
|
+
return (
|
|
329
|
+
<div role="group" aria-label={props.label}>
|
|
330
|
+
{(["given", "family", "full"] as const).map((part) => (
|
|
331
|
+
<input key={part} aria-label={part} value={value[part]} onChange={(event) => onValueChange({ ...value, [part]: event.target.value })} onKeyDown={done} />
|
|
332
|
+
))}
|
|
333
|
+
</div>
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
const { value, onValueChange } = props;
|
|
337
|
+
return (
|
|
338
|
+
<div role="group" aria-label={props.label}>
|
|
339
|
+
{props.parts.map((part) => (
|
|
340
|
+
<input key={part} aria-label={props.words[part]} value={value[part] ?? ""} onChange={(event) => onValueChange({ ...value, [part]: event.target.value })} onKeyDown={done} />
|
|
341
|
+
))}
|
|
342
|
+
</div>
|
|
343
|
+
);
|
|
344
|
+
},
|
|
345
|
+
// Several emails, phones, links or domains: a box per value, and a line that adds one on Enter (Enter on it empty is done).
|
|
346
|
+
ValuesBody: ({ label, value, onValueChange, onDone }) => (
|
|
347
|
+
<div role="group" aria-label={label}>
|
|
348
|
+
{value.map((line, at) => (
|
|
349
|
+
<input
|
|
350
|
+
key={at}
|
|
351
|
+
aria-label={label}
|
|
352
|
+
value={line.value}
|
|
353
|
+
onChange={(event) => onValueChange(value.map((each, i) => (i === at ? { ...each, value: event.target.value } : each)))}
|
|
354
|
+
/>
|
|
355
|
+
))}
|
|
356
|
+
<input
|
|
357
|
+
aria-label={`Add to ${label}`}
|
|
358
|
+
onKeyDown={(event) => {
|
|
359
|
+
if (event.key !== "Enter") return;
|
|
360
|
+
const text = event.currentTarget.value.trim();
|
|
361
|
+
if (text === "") return onDone();
|
|
362
|
+
onValueChange([...value, { value: text, main: value.length === 0 }]);
|
|
363
|
+
event.currentTarget.value = "";
|
|
364
|
+
}}
|
|
365
|
+
/>
|
|
366
|
+
</div>
|
|
367
|
+
),
|
|
368
|
+
// The toolbar's panels: your app draws each whole body (CONTROLS hands ViewKit's own). Here, each at its plainest.
|
|
369
|
+
SortBody: ({ label, options, onRulesChange, onDone }) => (
|
|
370
|
+
<div role="group" aria-label={label}>
|
|
371
|
+
{options.map((option) => (
|
|
372
|
+
<button key={option.value} type="button" onClick={() => onRulesChange([{ value: option.value, dir: "asc" }])}>
|
|
373
|
+
{option.label}
|
|
374
|
+
</button>
|
|
375
|
+
))}
|
|
376
|
+
<button type="button" onClick={onDone}>
|
|
377
|
+
Done
|
|
378
|
+
</button>
|
|
379
|
+
</div>
|
|
380
|
+
),
|
|
381
|
+
FilterBody: ({ label, filter, onFilterChange, onDone }) => (
|
|
382
|
+
<div role="group" aria-label={label}>
|
|
383
|
+
<button type="button" onClick={() => onFilterChange({ ...filter, items: [] })}>
|
|
384
|
+
Clear all
|
|
385
|
+
</button>
|
|
386
|
+
<button type="button" onClick={onDone}>
|
|
387
|
+
Done
|
|
388
|
+
</button>
|
|
389
|
+
</div>
|
|
390
|
+
),
|
|
391
|
+
FilterPartBody: ({ label, rule, ways, onRuleChange, onDone }) => (
|
|
392
|
+
<div role="group" aria-label={label}>
|
|
393
|
+
{ways.map((way) => (
|
|
394
|
+
<button key={way.value} type="button" onClick={() => onRuleChange({ ...rule, operator: way.value })}>
|
|
395
|
+
{way.label}
|
|
396
|
+
</button>
|
|
397
|
+
))}
|
|
398
|
+
<button type="button" onClick={onDone}>
|
|
399
|
+
Done
|
|
400
|
+
</button>
|
|
401
|
+
</div>
|
|
402
|
+
),
|
|
403
|
+
FieldsBody: ({ label, fields, onPick }) => (
|
|
404
|
+
<div role="listbox" aria-label={label}>
|
|
405
|
+
{fields.map((field) => (
|
|
406
|
+
<div key={field.key} role="option" aria-selected={false} onClick={() => onPick(field.key)}>
|
|
407
|
+
{field.label}
|
|
408
|
+
</div>
|
|
409
|
+
))}
|
|
410
|
+
</div>
|
|
411
|
+
),
|
|
412
|
+
QuickFiltersBody: ({ label, fields, onHoldChange }) => (
|
|
413
|
+
<div role="group" aria-label={label}>
|
|
414
|
+
{fields.flatMap((field) =>
|
|
415
|
+
field.values.map((value) => (
|
|
416
|
+
<button
|
|
417
|
+
key={`${field.key}:${value.value}`}
|
|
418
|
+
type="button"
|
|
419
|
+
aria-pressed={value.held}
|
|
420
|
+
onClick={() => onHoldChange([{ fieldKey: field.key, values: [value.value] }])}
|
|
421
|
+
>
|
|
422
|
+
{value.label}
|
|
423
|
+
</button>
|
|
424
|
+
))
|
|
425
|
+
)}
|
|
426
|
+
</div>
|
|
427
|
+
),
|
|
428
|
+
ViewsListBody: ({ label, views, value, onViewChange, onDone }) => (
|
|
429
|
+
<div role="listbox" aria-label={label}>
|
|
430
|
+
{views.map((view) => (
|
|
431
|
+
<div
|
|
432
|
+
key={view.value}
|
|
433
|
+
role="option"
|
|
434
|
+
aria-selected={view.value === value}
|
|
435
|
+
onClick={() => {
|
|
436
|
+
onViewChange(view.value);
|
|
437
|
+
onDone();
|
|
438
|
+
}}
|
|
439
|
+
>
|
|
440
|
+
{view.label}
|
|
441
|
+
</div>
|
|
442
|
+
))}
|
|
443
|
+
</div>
|
|
444
|
+
),
|
|
445
|
+
// Customize: your app draws its whole body (CONTROLS.CustomizeBody is ViewKit's own). Here, its name, the layout's toggles and Done.
|
|
446
|
+
CustomizeBody: ({ label, layout, onDone }) => (
|
|
447
|
+
<div role="group" aria-label={label}>
|
|
448
|
+
{(layout?.toggles ?? []).map((toggle) => (
|
|
449
|
+
<label key={toggle.key}>
|
|
450
|
+
<input type="checkbox" checked={toggle.value} onChange={(event) => toggle.onChange(event.target.checked)} />
|
|
451
|
+
{toggle.label}
|
|
452
|
+
</label>
|
|
453
|
+
))}
|
|
454
|
+
<button type="button" onClick={onDone}>
|
|
455
|
+
Done
|
|
456
|
+
</button>
|
|
457
|
+
</div>
|
|
458
|
+
),
|
|
239
459
|
};
|
|
240
460
|
|
|
241
461
|
const icons = Object.fromEntries(
|
|
@@ -73,7 +73,7 @@ assert.equal(DISPLAY_CORES.date, DISPLAY_CORES.datetime);
|
|
|
73
73
|
- **number**: plain or a duration, in tabular figures. An integer field draws whole numbers whatever the reader's decimals. A `suffix` trails in the small subtle unit style. A `signed` format shows the sign and tints a positive figure as a success, unless its `signedTone` is `neutral`; a field's `bands` tint the figure by the band it falls in, ahead of the sign. A value that is not a number draws as its own text.
|
|
74
74
|
- **currency**: in the field's fixed code, or the code you hand in `currency` (the row's own, for a field whose code comes from the row), which wins. Two decimals unless the field says otherwise or holds whole amounts.
|
|
75
75
|
- **percent**: stored as 0 to 100 and drawn as it is, never multiplied, with its `%` in the unit style. The field's `format.display`, or the reader's `percentDisplay`, adds a bar or a ring.
|
|
76
|
-
- **date** and **datetime**: in the reader's `dateStyle`, else the field's, else `short`; `withTime`
|
|
76
|
+
- **date** and **datetime**: in the reader's `dateStyle`, else the field's, else `short`; an instant shows its time unless `withTime` says `false`, the options' answer winning over the field's (`timeShown`), and only an instant has a time. Hovering for a second shows the full date (and time, for an instant) through your components map's `Tooltip`, so a relative "3d ago" can be pinned to a moment. A value that doesn't parse draws as its own text.
|
|
77
77
|
- **boolean**: four looks, the field's `format.style`. `checkbox` (the default) draws the `TickBox` atom, and `icon` your `booleanIcon(on)`; either becomes a real switch only when you hand `onToggle`, and is a plain glyph otherwise. `text` draws the option's label for the value, or the package's words. `marker` draws only when true, as the `StatusMarker` atom with your `marker` words, `markerReason` and `onResolve`.
|
|
78
78
|
- **select**, **status** and **multiselect**: a select is a category and draws the `Tag` atom in its colour (a reader's `optionColors` first, then the option's declared colour, then one derived from the value). A status is a state and draws the `StatusBadge` atom in its option's slot. A multiselect draws a tag per value, through the several-values layout. A value no option names draws as the raw value, muted, with a hover saying it is not an option, unless you hand a `labelFallback`; an open (`custom-values`) vocabulary's values are their own labels. An option's `icon` is drawn through your `AppIcon`.
|
|
79
79
|
- **relation** and **user**: a chip, the record's avatar when it has one, else your `entityIcon(kind)`, else the relation glyph, then its label, then, on a `many` relation that declares `links`, the link's roles, drawn by the `RelationRoles` atom ([atoms](atoms.md)). Where it goes is yours (`relationWrap`); without one the chip is inert. Several draw through the several-values layout, the lead link first. A user is drawn as a relation to a member, so the two never differ.
|
|
@@ -82,7 +82,7 @@ assert.equal(DISPLAY_CORES.date, DISPLAY_CORES.datetime);
|
|
|
82
82
|
- **name**: the full name as written, else the given and family names, else `nameFallback`, else nothing.
|
|
83
83
|
- **actor**: a chip like a relation's that opens nothing, since an actor records who did something rather than pointing at a record: a member's avatar when your value carries an `avatarUrl` beside it, and your glyph for an automation, an API key or the system.
|
|
84
84
|
- **rich_text**: the first line with words in it, on one line; with `wrap: true`, its plain lines, clamped; with `wrap: "full"`, your components map's `Markdown`, folded past 160px behind Show more.
|
|
85
|
-
- **range**: its two ends as text ("11–50", "10,001+", "up to 50"), then its unit (`%`, its currency code or its suffix) and its period ("/mo").
|
|
85
|
+
- **range**: its two ends as text ("11–50", "10,001+", "up to 50"), then its unit (`%`, its currency code or its suffix) and its period ("/mo"); a value whose ends are exactly one of the field's `presets` reads as that preset's label alone, the whole value on hover.
|
|
86
86
|
- **lookup** and **formula**: as the field their result is. A **rollup** grouped by an option draws a segmented bar beside its headline, and one grouped by time a sparkline, the current bucket faded.
|
|
87
87
|
|
|
88
88
|
A value that holds several, of any of these types, uses `MultiValueCell`: as many as fit on one line, or three when wrapped, then a `+N` count that opens all of them in a list. It is exported for your own cells; [the display reference](../reference/display.md) has its props.
|
|
@@ -94,7 +94,7 @@ A field says what the value is. The rest arrives in `DisplayOptions`, from the s
|
|
|
94
94
|
|
|
95
95
|
- The row's answers: `currency` (the code this value is in), `nameFallback` (the words for an empty name, say the person's email), `labelFallback` and `optionColors`.
|
|
96
96
|
- The reader's choices: `dateStyle`, `durationStyle`, `decimals`, `withTime`, `percentDisplay` and `wrap`.
|
|
97
|
-
- A boolean's verbs and words: `onToggle`, `booleanDisabled`, `booleanIcon`, `booleanCheckbox`, `marker`, `markerReason` and `onResolve`. `booleanCheckbox` is a checkbox control of yours (the components map's `Checkbox`): handed one, the checkbox style draws it alone in place of the tick box and its switch, as the grid
|
|
97
|
+
- A boolean's verbs and words: `onToggle`, `booleanDisabled`, `booleanIcon`, `booleanCheckbox`, `marker`, `markerReason` and `onResolve`. `booleanCheckbox` is a checkbox control of yours (the components map's `Checkbox`): handed one, the checkbox style draws it alone in place of the tick box and its switch, as the grid and a field row do.
|
|
98
98
|
- A relation's: `entityIcon` and `relationWrap`.
|
|
99
99
|
- `slotOwnsClick`, for a host whose own element is already the button, such as a calendar card: every core then draws bare content, with no link, no toggle and a count that opens nothing.
|
|
100
100
|
- `hostOwnsPlainClick`, for a host whose plain click on a value is its own, as the grid's click selects its cell: an email, phone, url or domain stays a link, marked `data-cell-link`, but no longer stops its click, so your host decides (the grid follows it only on a ⌘- or Ctrl-click).
|
|
@@ -14,13 +14,13 @@ A member that is `null` is a decision: the type has no editor of its own. A `boo
|
|
|
14
14
|
import assert from "node:assert/strict";
|
|
15
15
|
import { EDIT_CORES, hasEditCore } from "viewkitjs/views/editors";
|
|
16
16
|
import { SelectEditor } from "viewkitjs/views/editors/select";
|
|
17
|
-
import {
|
|
17
|
+
import { TextEditorHost } from "viewkitjs/views/editors/text";
|
|
18
18
|
|
|
19
19
|
assert.equal(EDIT_CORES.status, EDIT_CORES.select);
|
|
20
20
|
assert.equal(EDIT_CORES.select, SelectEditor);
|
|
21
21
|
assert.equal(EDIT_CORES.percent, EDIT_CORES.number);
|
|
22
|
-
assert.equal(EDIT_CORES.text,
|
|
23
|
-
assert.equal(EDIT_CORES.phone,
|
|
22
|
+
assert.equal(EDIT_CORES.text, TextEditorHost);
|
|
23
|
+
assert.equal(EDIT_CORES.phone, TextEditorHost);
|
|
24
24
|
assert.equal(EDIT_CORES.boolean, null);
|
|
25
25
|
|
|
26
26
|
assert.equal(hasEditCore("currency"), true);
|
|
@@ -44,25 +44,18 @@ What an editor hands back is a commit, which is not always the shape your row st
|
|
|
44
44
|
| `viewkitjs/views/editors/name` | `name` | `{ full, given, family }`, or `null` |
|
|
45
45
|
| `viewkitjs/views/editors/location` | `location` | the place's parts, or `null` |
|
|
46
46
|
| `viewkitjs/views/editors/value-list` | a `multiple` email, phone, url or domain | a list of `{ value, label, main }`, the main one first, or `null` |
|
|
47
|
-
| `viewkitjs/views/editors/date` | `date`, `datetime` | `YYYY-MM-DD`, or `YYYY-MM-DDTHH:MM` with a time; `""` from
|
|
47
|
+
| `viewkitjs/views/editors/date` | `date`, `datetime` | `YYYY-MM-DD`, or `YYYY-MM-DDTHH:MM` with a time; `""` from No date |
|
|
48
48
|
| `viewkitjs/views/editors/chips` | `multiselect` | the list of values, a `string[]` |
|
|
49
49
|
|
|
50
50
|
The value-list editor has no member in `EDIT_CORES`: a list of emails is still an `email` field, whose single value is a plain input. Each editor's reference page has its props and its close rule in full: [select](../reference/editors-select.md), [text](../reference/editors-text.md), [relation](../reference/editors-relation.md), [number](../reference/editors-number.md), [range](../reference/editors-range.md), [name](../reference/editors-name.md), [location](../reference/editors-location.md), [value list](../reference/editors-value-list.md), [date](../reference/editors-date.md) and [chips](../reference/editors-chips.md).
|
|
51
51
|
|
|
52
52
|
## A text box
|
|
53
53
|
|
|
54
|
-
`
|
|
55
|
-
|
|
56
|
-
```tsx
|
|
57
|
-
import { TEXT_INPUT_TYPE } from "viewkitjs/views/editors/text";
|
|
58
|
-
|
|
59
|
-
assert.equal(TEXT_INPUT_TYPE.phone, "tel");
|
|
60
|
-
assert.equal(TEXT_INPUT_TYPE.domain, "url");
|
|
61
|
-
```
|
|
54
|
+
`TextEditorHost`, from `viewkitjs/views/editors/text`, is the one editor for every text-like value: text, a link, an email, a phone, a domain, long text and rich text. It opens your `TextBody` (`CONTROLS.TextBody` is ViewKit's own), which draws the box and brings each type's own phone keyboard, and keeps the draft: it tidies what was typed (trimmed; rich text tidied only at its edges, so its first line keeps its indent) and answers `noop` when the tidied text equals the tidied stored value. A line closes on Enter; a paragraph (`multiline`, the default for rich text) takes Enter as a newline and closes on ⌘ or Ctrl Enter. Escape discards, Tab and Shift-Tab close with their reason, and leaving the body closes it unless you pass `closeOnBlur={false}`, which a host inside a popover or a sheet does, so a tap on ✕ or ✓ is not a close. A text opened only to be read (`readOnly`) has no body form: it draws ViewKit's own textarea, and every close is a `noop`.
|
|
62
55
|
|
|
63
56
|
## What an editor owns, and what you own
|
|
64
57
|
|
|
65
|
-
An editor owns its panel and what a close means. The select editor owns its rows and decides that a pick commits and every other close discards; the date editor
|
|
58
|
+
An editor owns its panel and what a close means. The select editor owns its rows and decides that a pick commits and every other close discards; the date editor opens your app's `DateBody`, keeping the draft, and decides that Escape discards and every other close commits a changed draft. You own everything around the panel: the popover it sits in, the anchor that popover opens on, where focus goes, when a close happens, and the write. Where it opens your app's own body (`Picker`, `PartsBody`, `ValuesBody` or `LinksBody`), the popover around it stands at your `Popover`'s own width, marked `data-vk-body` ([the provider](the-provider.md)).
|
|
66
59
|
|
|
67
60
|
The two speak through one handshake, the `CloseReason` and `CloseResolution` of `viewkitjs/fields`:
|
|
68
61
|
|
|
@@ -124,8 +117,9 @@ type Deal = { id: string; title: string; stage: string; industry: string | null;
|
|
|
124
117
|
const conventions = defineConventions({ locale: "en-GB", timeZone: "Europe/Bucharest" });
|
|
125
118
|
|
|
126
119
|
const components: ViewsComponents = {
|
|
127
|
-
|
|
128
|
-
|
|
120
|
+
// It draws every button ViewKit draws itself, so it forwards the ref and every prop it is handed to its element.
|
|
121
|
+
Button: ({ children, variant: _variant, size: _size, type = "button", ...rest }) => (
|
|
122
|
+
<button type={type} {...rest}>
|
|
129
123
|
{children}
|
|
130
124
|
</button>
|
|
131
125
|
),
|
|
@@ -176,6 +170,227 @@ const components: ViewsComponents = {
|
|
|
176
170
|
Sheet: ({ open, children }) => (open ? <div role="dialog">{children}</div> : null),
|
|
177
171
|
AppIcon: ({ name, className }) => <i data-icon={name} className={className} />,
|
|
178
172
|
Markdown: ({ source, className }) => <div className={className}>{source}</div>,
|
|
173
|
+
// The required bodies: a box for a text and one for a number, each handing every change as it is made, a pick list, a
|
|
174
|
+
// relation's links, a date, a name, a place or a range, and several values.
|
|
175
|
+
TextBody: ({ label, value, onValueChange, onDone }) => (
|
|
176
|
+
<input
|
|
177
|
+
aria-label={label}
|
|
178
|
+
value={value}
|
|
179
|
+
onChange={(event) => onValueChange(event.target.value)}
|
|
180
|
+
onKeyDown={(event) => event.key === "Enter" && onDone()}
|
|
181
|
+
/>
|
|
182
|
+
),
|
|
183
|
+
NumberBody: ({ label, value, onValueChange, onDone }) => (
|
|
184
|
+
<input
|
|
185
|
+
aria-label={label}
|
|
186
|
+
inputMode="decimal"
|
|
187
|
+
value={value == null || Number.isNaN(value) ? "" : String(value)}
|
|
188
|
+
onChange={(event) => onValueChange(event.target.value === "" ? null : Number(event.target.value))}
|
|
189
|
+
onKeyDown={(event) => event.key === "Enter" && onDone()}
|
|
190
|
+
/>
|
|
191
|
+
),
|
|
192
|
+
// A pick list: a row per item handed, a press picking one (or ticking it in a list of several).
|
|
193
|
+
Picker: ({ label, items, value, onValueChange, onDone, multiple }) => {
|
|
194
|
+
const held = Array.isArray(value) ? value : value === null ? [] : [value];
|
|
195
|
+
return (
|
|
196
|
+
<div role="listbox" aria-label={label}>
|
|
197
|
+
{items.map((item) => (
|
|
198
|
+
<div
|
|
199
|
+
key={item.value}
|
|
200
|
+
role="option"
|
|
201
|
+
aria-selected={held.includes(item.value)}
|
|
202
|
+
data-status={item.slot}
|
|
203
|
+
data-chosen={held.includes(item.value) || undefined}
|
|
204
|
+
onClick={() => {
|
|
205
|
+
if (!multiple) return onValueChange(item.value), onDone();
|
|
206
|
+
onValueChange(held.includes(item.value) ? held.filter((v) => v !== item.value) : [...held, item.value]);
|
|
207
|
+
}}
|
|
208
|
+
>
|
|
209
|
+
{item.label}
|
|
210
|
+
</div>
|
|
211
|
+
))}
|
|
212
|
+
</div>
|
|
213
|
+
);
|
|
214
|
+
},
|
|
215
|
+
// A relation's links: a row per record, a press linking or unlinking it, and Done.
|
|
216
|
+
LinksBody: ({ label, items, links, onLinksChange, onDone }) => (
|
|
217
|
+
<div role="listbox" aria-label={label}>
|
|
218
|
+
{items.map((item) => {
|
|
219
|
+
const linked = links.some((link) => link.value === item.value);
|
|
220
|
+
return (
|
|
221
|
+
<div
|
|
222
|
+
key={item.value}
|
|
223
|
+
role="option"
|
|
224
|
+
aria-selected={linked}
|
|
225
|
+
onClick={() =>
|
|
226
|
+
onLinksChange(linked ? links.filter((link) => link.value !== item.value) : [...links, { value: item.value, roles: [] }])
|
|
227
|
+
}
|
|
228
|
+
>
|
|
229
|
+
{item.label}
|
|
230
|
+
</div>
|
|
231
|
+
);
|
|
232
|
+
})}
|
|
233
|
+
<button type="button" onClick={onDone}>
|
|
234
|
+
Done
|
|
235
|
+
</button>
|
|
236
|
+
</div>
|
|
237
|
+
),
|
|
238
|
+
// A date: a line holding the day ("YYYY-MM-DD", or with "THH:MM"), Enter for done.
|
|
239
|
+
// Uncontrolled: the editor takes only a whole date, so a line it held would undo every key typed on the way to one.
|
|
240
|
+
DateBody: ({ label, value, onValueChange, onDone }) => (
|
|
241
|
+
<input
|
|
242
|
+
aria-label={label}
|
|
243
|
+
defaultValue={value ?? ""}
|
|
244
|
+
onChange={(event) => onValueChange(event.target.value === "" ? null : event.target.value)}
|
|
245
|
+
onKeyDown={(event) => event.key === "Enter" && onDone()}
|
|
246
|
+
/>
|
|
247
|
+
),
|
|
248
|
+
// A name, a place or a range: a box per part, Enter for done.
|
|
249
|
+
PartsBody: (props) => {
|
|
250
|
+
const done = (event: { key: string }) => event.key === "Enter" && props.onDone();
|
|
251
|
+
if (props.kind === "range") {
|
|
252
|
+
const { value, onValueChange } = props;
|
|
253
|
+
const end = (text: string) => (text === "" ? null : Number(text));
|
|
254
|
+
return (
|
|
255
|
+
<div role="group" aria-label={props.label}>
|
|
256
|
+
<input aria-label="From" value={value.low ?? ""} onChange={(event) => onValueChange({ ...value, low: end(event.target.value) })} onKeyDown={done} />
|
|
257
|
+
<input aria-label="To" value={value.high ?? ""} onChange={(event) => onValueChange({ ...value, high: end(event.target.value) })} onKeyDown={done} />
|
|
258
|
+
</div>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
if (props.kind === "name") {
|
|
262
|
+
const { value, onValueChange } = props;
|
|
263
|
+
return (
|
|
264
|
+
<div role="group" aria-label={props.label}>
|
|
265
|
+
{(["given", "family", "full"] as const).map((part) => (
|
|
266
|
+
<input key={part} aria-label={part} value={value[part]} onChange={(event) => onValueChange({ ...value, [part]: event.target.value })} onKeyDown={done} />
|
|
267
|
+
))}
|
|
268
|
+
</div>
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
const { value, onValueChange } = props;
|
|
272
|
+
return (
|
|
273
|
+
<div role="group" aria-label={props.label}>
|
|
274
|
+
{props.parts.map((part) => (
|
|
275
|
+
<input key={part} aria-label={props.words[part]} value={value[part] ?? ""} onChange={(event) => onValueChange({ ...value, [part]: event.target.value })} onKeyDown={done} />
|
|
276
|
+
))}
|
|
277
|
+
</div>
|
|
278
|
+
);
|
|
279
|
+
},
|
|
280
|
+
// Several emails, phones, links or domains: a box per value, and a line that adds one on Enter (Enter on it empty is done).
|
|
281
|
+
ValuesBody: ({ label, value, onValueChange, onDone }) => (
|
|
282
|
+
<div role="group" aria-label={label}>
|
|
283
|
+
{value.map((line, at) => (
|
|
284
|
+
<input
|
|
285
|
+
key={at}
|
|
286
|
+
aria-label={label}
|
|
287
|
+
value={line.value}
|
|
288
|
+
onChange={(event) => onValueChange(value.map((each, i) => (i === at ? { ...each, value: event.target.value } : each)))}
|
|
289
|
+
/>
|
|
290
|
+
))}
|
|
291
|
+
<input
|
|
292
|
+
aria-label={`Add to ${label}`}
|
|
293
|
+
onKeyDown={(event) => {
|
|
294
|
+
if (event.key !== "Enter") return;
|
|
295
|
+
const text = event.currentTarget.value.trim();
|
|
296
|
+
if (text === "") return onDone();
|
|
297
|
+
onValueChange([...value, { value: text, main: value.length === 0 }]);
|
|
298
|
+
event.currentTarget.value = "";
|
|
299
|
+
}}
|
|
300
|
+
/>
|
|
301
|
+
</div>
|
|
302
|
+
),
|
|
303
|
+
// The toolbar's panels: your app draws each whole body (CONTROLS hands ViewKit's own). Here, each at its plainest.
|
|
304
|
+
SortBody: ({ label, options, onRulesChange, onDone }) => (
|
|
305
|
+
<div role="group" aria-label={label}>
|
|
306
|
+
{options.map((option) => (
|
|
307
|
+
<button key={option.value} type="button" onClick={() => onRulesChange([{ value: option.value, dir: "asc" }])}>
|
|
308
|
+
{option.label}
|
|
309
|
+
</button>
|
|
310
|
+
))}
|
|
311
|
+
<button type="button" onClick={onDone}>
|
|
312
|
+
Done
|
|
313
|
+
</button>
|
|
314
|
+
</div>
|
|
315
|
+
),
|
|
316
|
+
FilterBody: ({ label, filter, onFilterChange, onDone }) => (
|
|
317
|
+
<div role="group" aria-label={label}>
|
|
318
|
+
<button type="button" onClick={() => onFilterChange({ ...filter, items: [] })}>
|
|
319
|
+
Clear all
|
|
320
|
+
</button>
|
|
321
|
+
<button type="button" onClick={onDone}>
|
|
322
|
+
Done
|
|
323
|
+
</button>
|
|
324
|
+
</div>
|
|
325
|
+
),
|
|
326
|
+
FilterPartBody: ({ label, rule, ways, onRuleChange, onDone }) => (
|
|
327
|
+
<div role="group" aria-label={label}>
|
|
328
|
+
{ways.map((way) => (
|
|
329
|
+
<button key={way.value} type="button" onClick={() => onRuleChange({ ...rule, operator: way.value })}>
|
|
330
|
+
{way.label}
|
|
331
|
+
</button>
|
|
332
|
+
))}
|
|
333
|
+
<button type="button" onClick={onDone}>
|
|
334
|
+
Done
|
|
335
|
+
</button>
|
|
336
|
+
</div>
|
|
337
|
+
),
|
|
338
|
+
FieldsBody: ({ label, fields, onPick }) => (
|
|
339
|
+
<div role="listbox" aria-label={label}>
|
|
340
|
+
{fields.map((field) => (
|
|
341
|
+
<div key={field.key} role="option" aria-selected={false} onClick={() => onPick(field.key)}>
|
|
342
|
+
{field.label}
|
|
343
|
+
</div>
|
|
344
|
+
))}
|
|
345
|
+
</div>
|
|
346
|
+
),
|
|
347
|
+
QuickFiltersBody: ({ label, fields, onHoldChange }) => (
|
|
348
|
+
<div role="group" aria-label={label}>
|
|
349
|
+
{fields.flatMap((field) =>
|
|
350
|
+
field.values.map((value) => (
|
|
351
|
+
<button
|
|
352
|
+
key={`${field.key}:${value.value}`}
|
|
353
|
+
type="button"
|
|
354
|
+
aria-pressed={value.held}
|
|
355
|
+
onClick={() => onHoldChange([{ fieldKey: field.key, values: [value.value] }])}
|
|
356
|
+
>
|
|
357
|
+
{value.label}
|
|
358
|
+
</button>
|
|
359
|
+
))
|
|
360
|
+
)}
|
|
361
|
+
</div>
|
|
362
|
+
),
|
|
363
|
+
ViewsListBody: ({ label, views, value, onViewChange, onDone }) => (
|
|
364
|
+
<div role="listbox" aria-label={label}>
|
|
365
|
+
{views.map((view) => (
|
|
366
|
+
<div
|
|
367
|
+
key={view.value}
|
|
368
|
+
role="option"
|
|
369
|
+
aria-selected={view.value === value}
|
|
370
|
+
onClick={() => {
|
|
371
|
+
onViewChange(view.value);
|
|
372
|
+
onDone();
|
|
373
|
+
}}
|
|
374
|
+
>
|
|
375
|
+
{view.label}
|
|
376
|
+
</div>
|
|
377
|
+
))}
|
|
378
|
+
</div>
|
|
379
|
+
),
|
|
380
|
+
// Customize: your app draws its whole body (CONTROLS.CustomizeBody is ViewKit's own). Here, its name, the layout's toggles and Done.
|
|
381
|
+
CustomizeBody: ({ label, layout, onDone }) => (
|
|
382
|
+
<div role="group" aria-label={label}>
|
|
383
|
+
{(layout?.toggles ?? []).map((toggle) => (
|
|
384
|
+
<label key={toggle.key}>
|
|
385
|
+
<input type="checkbox" checked={toggle.value} onChange={(event) => toggle.onChange(event.target.checked)} />
|
|
386
|
+
{toggle.label}
|
|
387
|
+
</label>
|
|
388
|
+
))}
|
|
389
|
+
<button type="button" onClick={onDone}>
|
|
390
|
+
Done
|
|
391
|
+
</button>
|
|
392
|
+
</div>
|
|
393
|
+
),
|
|
179
394
|
};
|
|
180
395
|
|
|
181
396
|
const icons = Object.fromEntries(
|
|
@@ -250,7 +465,7 @@ function DealStageEditor({
|
|
|
250
465
|
}
|
|
251
466
|
```
|
|
252
467
|
|
|
253
|
-
Rendered inside the provider, the panel
|
|
468
|
+
Rendered inside the provider, the panel hands your `Picker` each option with its status slot and the stage the deal holds.
|
|
254
469
|
|
|
255
470
|
```tsx
|
|
256
471
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
@@ -265,8 +480,8 @@ const stageHtml = renderToStaticMarkup(
|
|
|
265
480
|
);
|
|
266
481
|
|
|
267
482
|
assert.ok(stageHtml.includes("Won") && stageHtml.includes("Lost"));
|
|
268
|
-
assert.ok(stageHtml.includes('data-status="success"')); // each option
|
|
269
|
-
assert.ok(stageHtml.includes("data-chosen")); // the stage the deal holds
|
|
483
|
+
assert.ok(stageHtml.includes('data-status="success"')); // each option is handed its slot
|
|
484
|
+
assert.ok(stageHtml.includes("data-chosen")); // and the stage the deal holds
|
|
270
485
|
```
|
|
271
486
|
|
|
272
487
|
A pick of Won calls `close("pick")`; the editor answers `{ kind: "commit", payload: "won" }`, `saveDeal` sends `{ stage: "won" }`, and 160 milliseconds later `onClosed` runs. A pick of New, which the deal already holds, answers `noop`, and an outside press or Escape answers `cancel`: nothing is sent either way, and the popover still closes.
|
|
@@ -381,7 +596,7 @@ function IndustryPanel({
|
|
|
381
596
|
|
|
382
597
|
## Adding an option from a cell
|
|
383
598
|
|
|
384
|
-
When a field's options belong to your app (a workspace's own list, kept in your data), a word typed in its cell that no option holds can become a new option. Hand the field's binding an `addOption`: ViewKit
|
|
599
|
+
When a field's options belong to your app (a workspace's own list, kept in your data), a word typed in its cell that no option holds can become a new option. Hand the field's binding an `addOption`: ViewKit hands the select's and several-values' `Picker` **+ Add** (`onAdd`, `adding`, `addRefused`), in the grid and in a record's field row, asks your add, and picks (one) or adds and checks (several) the option it returns. A word an option already names, ignoring spaces at either end, case and accents, picks that option and never asks. `CONTROLS.Picker` doesn't draw + Add yet: an app that wants it hands a Picker of its own that reads `onAdd`.
|
|
385
600
|
|
|
386
601
|
```tsx
|
|
387
602
|
import { bindField, type OptionAdd } from "viewkitjs/views";
|
|
@@ -461,7 +676,7 @@ assert.equal(RELATION_PAGE_SIZE, 20); // a page, when the source names no pageSi
|
|
|
461
676
|
|
|
462
677
|
A page shorter than `pageSize` is how the panel knows the list has ended, so `pageSize` must be what your search really asks its route for: a mismatch ends the list early, or asks once more for nothing.
|
|
463
678
|
|
|
464
|
-
The editor itself takes the source as `candidates`, the linked id as `initial`, and `clearable` for
|
|
679
|
+
The editor itself takes the source as `candidates`, the linked id as `initial`, and `clearable` for the Picker's empty row. It commits the picked id, or `null` for the empty row, and only on a pick; every other close discards. Its host is the stage host above with `RelationEditorHandle` in place of `SelectEditorHandle`:
|
|
465
680
|
|
|
466
681
|
```tsx
|
|
467
682
|
function CompanyPanel({
|
|
@@ -4,7 +4,7 @@ A piece's look is what an app sets once for every copy of the piece it draws: th
|
|
|
4
4
|
|
|
5
5
|
## Options and looks
|
|
6
6
|
|
|
7
|
-
An option is a closed set of values with a default: the grid's `columns` is `all`, `none` or `pinned`. A look is a named set of picks, one value for every option: the grid's `attio` look
|
|
7
|
+
An option is a closed set of values with a default: the grid's `columns` is `all`, `none` or `pinned`. A look is a named set of picks, one value for every option: the grid's `attio` look is Attio's table, its `portal` look ViewKit's own grid as the portal draws it. Nothing picked wears each option's default, the Outright look's (My preset's), which no look matches whole. The ids are public and stay as they are, since an app saves picks by them; the words beside them (`name`) may change.
|
|
8
8
|
|
|
9
9
|
## Picking the grid's look
|
|
10
10
|
|
|
@@ -22,7 +22,13 @@ console.log(frame["data-grid-columns"], props.verticalBorders, props.fillWidth);
|
|
|
22
22
|
|
|
23
23
|
A pick its option doesn't have (one saved by an older version, say) wears the option's default, so saved picks never break a grid. Where the picks live on the page rather than in your state, `gridLookWornOf(element)` reads them back from the closest frame.
|
|
24
24
|
|
|
25
|
-
Fourteen of the grid's options are read by its code. Eleven become its props through `gridLookProps`; three you wire yourself, as the Showcase does: `more` (`"pages"`: hand `GridTable` its `pages`), `figures` (`"value"`: the footer's figure words through your provider's messages) and `wait` (`"kept"`: hand the components map a `RowsWait`). The other eleven (the header's words, the rows' lines, the pinned edge, picked rows and cells, the cells' frames, names and phones) are its look stylesheet's alone
|
|
25
|
+
Fourteen of the grid's options are read by its code. Eleven become its props through `gridLookProps`; three you wire yourself, as the Showcase does: `more` (`"pages"`: hand `GridTable` its `pages`), `figures` (`"value"`: the footer's figure words through your provider's messages) and `wait` (`"kept"`: hand the components map a `RowsWait`). The other eleven (the header's words, the rows' lines, the pinned edge, picked rows and cells, the cells' frames, names and phones) are its look stylesheet's alone: `viewkitjs/views/grid.css`, already inside the ready stylesheet (`viewkitjs/views/styles.css`). An app that imports ViewKit's stylesheets one by one adds it after ViewKit's own classes:
|
|
26
|
+
|
|
27
|
+
```css
|
|
28
|
+
@import "viewkitjs/views/grid.css";
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
It reads the grid's look tokens (`VK_GRID_TOKENS`), which the ready stylesheet declares at the Outright look's values; an app on its own tokens declares each once. A grid with no frame round it wears each option's default.
|
|
26
32
|
|
|
27
33
|
## A piece of your own
|
|
28
34
|
|