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
|
@@ -17,7 +17,8 @@ import { Select } from "../select/select.js";
|
|
|
17
17
|
import { Tooltip } from "../tooltip/tooltip.js";
|
|
18
18
|
import { HOW, wayOf } from "./how.js";
|
|
19
19
|
import { PairValue } from "./parts.js";
|
|
20
|
-
import {
|
|
20
|
+
import { BlockHead, GroupMenu, MenuStep } from "./block.js";
|
|
21
|
+
import { addRule, blockAround, canExclude, setExclude, canGroup, changeRule, clearAll, everyFits, fieldOf, fieldsIn, isBlock, isGroup, isOwnWay, isPair, isWhole, itemOf, putBack, QUANTIFIERS, relationOf, removeRule, rulesOf, setJoin, setQuantifier, toBlock, toGroup } from "./rules.js";
|
|
21
22
|
import { filterWords } from "./words.js";
|
|
22
23
|
const GROUP = ["M4 7a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-10a3 3 0 0 1 -3 -3z", "M8 9h8", "M8 13h5"];
|
|
23
24
|
const TURNS = ["M7 4l-3 3l3 3", "M4 7h13", "M17 20l3 -3l-3 -3", "M20 17h-13"];
|
|
@@ -82,8 +83,10 @@ export function useFilterEditor(props) {
|
|
|
82
83
|
const opener = (id) => (o) => setOpen((x) => (o ? id : x === id ? null : x));
|
|
83
84
|
const back = () => setStep(null);
|
|
84
85
|
useStepReturn(root, !phone || !step ? [] : [step.list === "add" ? ((group) => openerAt(() => `[data-add-to="${CSS.escape(group)}"]`))(step.group)
|
|
85
|
-
: ((
|
|
86
|
-
:
|
|
86
|
+
: step.list === "quantifier" ? ((group) => openerAt(() => `[data-block-head="${CSS.escape(group)}"] .o-select-field`))(step.group)
|
|
87
|
+
: step.list === "menu" ? ((item) => openerAt(() => `[data-more-of="${CSS.escape(item)}"]`))(step.item)
|
|
88
|
+
: ((id, list) => openerAt(() => (list === "value" ? `[data-value-of="${CSS.escape(id)}"] :is(.o-select-field, input, button)`
|
|
89
|
+
: `.o-filter-editor-rule[data-rule="${CSS.escape(id)}"] .o-filter-editor-${list} .o-select-field`)))(step.rule, step.list)]);
|
|
87
90
|
const add = (group, field) => {
|
|
88
91
|
if (typeof field !== "string")
|
|
89
92
|
return;
|
|
@@ -109,20 +112,34 @@ export function useFilterEditor(props) {
|
|
|
109
112
|
const placeRoot = React.useCallback((el) => { setRoot(el); placed(el); }, [placed]);
|
|
110
113
|
const room = useStandingRoom(root, "[data-filter-shown]", phone, [standing, props.at]);
|
|
111
114
|
const [adding, setAdding] = React.useState(null);
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
const gone = filter.relation?.gone;
|
|
116
|
+
const addButton = (group, kind, size) => {
|
|
117
|
+
const add = (_jsx(Button, { kind: kind, size: size, icon: glyph(PLUS), className: "o-filter-editor-add", "data-add-to": group, "aria-haspopup": "dialog", "aria-disabled": gone ? true : undefined, "aria-expanded": phone ? step?.list === "add" && step.group === group : adding?.group === group, onClick: (e) => { if (gone)
|
|
118
|
+
return; const at = e.currentTarget; if (phone)
|
|
119
|
+
setStep({ list: "add", group });
|
|
120
|
+
else
|
|
121
|
+
setAdding((a) => (a?.group === group ? null : { group, at })); }, children: w.add }));
|
|
122
|
+
return gone ? _jsx(Tooltip, { label: gone, reason: true, side: "bottom", children: _jsx("span", { className: "o-filter-editor-why", children: add }) }) : add;
|
|
123
|
+
};
|
|
124
|
+
const stepRule = step && "rule" in step ? rulesOf(filter).find((x) => x.id === step.rule) : undefined;
|
|
117
125
|
const stepField = stepRule ? fieldOf(fields, stepRule.field) : undefined;
|
|
118
|
-
|
|
119
|
-
|
|
126
|
+
const stepGroup = step && "group" in step ? itemOf(filter, step.group) : undefined;
|
|
127
|
+
const stepItem = step?.list === "menu" ? itemOf(filter, step.item) : undefined;
|
|
128
|
+
const stepGone = !!step && ("rule" in step ? !stepRule : step.list === "menu" ? !stepItem : !stepGroup || !isGroup(stepGroup) || (step.list === "quantifier" && !stepGroup.relation));
|
|
129
|
+
React.useEffect(() => { if (stepGone)
|
|
130
|
+
setStep(null); }, [stepGone]);
|
|
120
131
|
const stepTakes = stepRule && stepField ? wayOf(stepField.type, stepRule.how)?.takes : undefined;
|
|
121
132
|
const stepOwn = stepRule && step?.list === "value" ? ownOf(stepRule) : null;
|
|
122
133
|
const stepDate = !!stepRule && step?.list === "value" && !stepOwn && stepField?.type === "date";
|
|
123
134
|
const several = stepTakes === "several";
|
|
124
135
|
const stepValue = stepRule && stepField?.choices ? (several ? (Array.isArray(stepRule.value) && !isPair(stepRule.value) ? stepRule.value : []) : typeof stepRule.value === "string" ? stepRule.value : null) : null;
|
|
125
136
|
const waysOf = (f) => HOW[f.type].map((x) => ({ value: x.value, label: w.way(x.value), divider: x.takes === "none" && x.value === "empty" }));
|
|
137
|
+
const blockLabel = (g) => g.relation?.label ?? (g.relation ? itemLabel(fields, g.relation.field) : "");
|
|
138
|
+
const quantifiersOf = (g) => {
|
|
139
|
+
const every = everyFits(g.rules, fieldsIn(filter, g.id, fields));
|
|
140
|
+
return QUANTIFIERS.map((q) => ({ value: q, label: w.quantifier(q), ...(q === "every" && !every ? { disabled: true, line: w.everyNeedsWhere(blockLabel(g).toLocaleLowerCase()) } : {}) }));
|
|
141
|
+
};
|
|
142
|
+
const stepFields = step?.list === "add" ? fieldsIn(filter, step.group, fields) : stepRule ? fieldsIn(filter, stepRule.id, fields) : fields;
|
|
126
143
|
const stepList = usePicker(step?.list === "how" && stepRule && stepField
|
|
127
144
|
? { label: w.howOf(nameOf(stepRule.field)), items: waysOf(stepField), value: isOwnWay(stepRule.how) ? null : stepRule.how, searchShown: false, fromHeld: true, form: "phone", onDone: back,
|
|
128
145
|
onValueChange: (v) => { if (typeof v === "string" && v !== stepRule.how)
|
|
@@ -131,25 +148,34 @@ export function useFilterEditor(props) {
|
|
|
131
148
|
? { label: nameOf(stepRule.field), items: stepField.choices, multiple: several, value: stepValue, searchShown: false, fromHeld: true, form: "phone", onDone: back, draft: "shell",
|
|
132
149
|
onValueChange: (v) => { set(stepRule.id)(several ? (Array.isArray(v) ? v : []) : typeof v === "string" ? v : null); if (!several)
|
|
133
150
|
back(); }, ...words }
|
|
134
|
-
:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
+
: step?.list === "quantifier" && stepGroup && isGroup(stepGroup) && stepGroup.relation
|
|
152
|
+
? { label: blockLabel(stepGroup), items: quantifiersOf(stepGroup), value: stepGroup.relation.quantifier, searchShown: false, fromHeld: true, form: "phone", onDone: back,
|
|
153
|
+
onValueChange: (v) => { if (typeof v === "string" && v !== stepGroup.relation?.quantifier)
|
|
154
|
+
change(setQuantifier(now.current, stepGroup.id, v)); back(); }, ...words }
|
|
155
|
+
: { label: step?.list === "field" ? w.field : w.add, items: stepFields, value: step?.list === "field" && stepRule ? stepRule.field : null, search: w.search, searchShown: true, form: "phone",
|
|
156
|
+
onDone: () => setStep((s) => (s?.list === "add" || s?.list === "field" ? null : s)),
|
|
157
|
+
onValueChange: (v) => {
|
|
158
|
+
if (typeof v !== "string")
|
|
159
|
+
return;
|
|
160
|
+
if (step?.list === "field" && stepRule) {
|
|
161
|
+
if (v !== stepRule.field || stepRule.aside)
|
|
162
|
+
pointAt(stepRule.id, v);
|
|
163
|
+
back();
|
|
164
|
+
}
|
|
165
|
+
else if (step?.list === "add")
|
|
166
|
+
add(step.group, v);
|
|
167
|
+
}, ...words });
|
|
168
|
+
const stepTitle = phone && step && !stepGone ? (step.list === "add" ? w.add
|
|
169
|
+
: step.list === "quantifier" ? blockLabel(stepGroup)
|
|
170
|
+
: step.list === "menu" ? (stepItem && isGroup(stepItem) ? w.groupActions : w.ruleOf(labelOf(stepItem)))
|
|
171
|
+
: !stepRule ? undefined : step.list === "field" ? w.field : step.list === "how" ? w.howOf(labelOf(stepRule)) : labelOf(stepRule)) : undefined;
|
|
172
|
+
const stepBody = step?.list === "menu" && stepItem && stepTitle !== undefined
|
|
173
|
+
? _jsx(MenuStep, { label: stepTitle, entries: isGroup(stepItem) ? groupEntries(stepItem) : ruleEntries(stepItem), onClose: back, words: w.list })
|
|
174
|
+
: stepOwn ? stepOwn.body
|
|
175
|
+
: stepDate && stepRule ? _jsx(DateStep, { name: labelOf(stepRule), value: typeof stepRule.value === "string" ? stepRule.value : null, onValue: set(stepRule.id), onDone: back })
|
|
176
|
+
: stepList.body;
|
|
151
177
|
const size = phone ? "lg" : "sm";
|
|
152
|
-
const
|
|
178
|
+
const moreStep = (id, label) => (_jsx(Button, { kind: "quiet", shape: "icon", size: "40x44", look: DOTS_LOOK, className: "o-filter-editor-more", "data-more-of": id, "aria-label": label, "aria-haspopup": "dialog", icon: glyph(DOTS), onClick: () => setStep({ list: "menu", item: id }) }));
|
|
153
179
|
const stepOf = (s) => (phone ? { open: false, onOpenChange: (o) => { if (o)
|
|
154
180
|
setStep(s); } } : {});
|
|
155
181
|
const valueBox = (r, field, takes, own) => {
|
|
@@ -171,38 +197,55 @@ export function useFilterEditor(props) {
|
|
|
171
197
|
return _jsx(NumberField, { size: size, steppers: false, "aria-label": name, placeholder: w.typeNumber, value: typeof r.value === "number" ? r.value : null, onValueChange: (v) => set(r.id)(v ?? null) });
|
|
172
198
|
return _jsx(Input, { size: size, "aria-label": name, placeholder: w.typeValue, value: typeof r.value === "string" ? r.value : "", onChange: (e) => set(r.id)(e.target.value) });
|
|
173
199
|
};
|
|
200
|
+
function groupEntries(g) {
|
|
201
|
+
const can = canExclude(filter, g.id);
|
|
202
|
+
return [{ kind: "check", label: w.exclude, checked: !!g.exclude, ...(can ? {} : { disabled: w.excludeNeedsAnd }),
|
|
203
|
+
onCheckedChange: (on) => change(setExclude(now.current, g.id, on)) }];
|
|
204
|
+
}
|
|
205
|
+
function ruleEntries(r) {
|
|
206
|
+
const aside = r.aside;
|
|
207
|
+
if (aside)
|
|
208
|
+
return [{ icon: null, label: aside.why, disabled: aside.why },
|
|
209
|
+
...(aside.putBack ? [{ icon: null, label: w.putBack, onSelect: () => change(putBack(now.current, r.id)) }] : []),
|
|
210
|
+
{ icon: glyph(TRASH), label: w.deleteRule, danger: true, onSelect: () => remove(r.id) }];
|
|
211
|
+
const blockable = !!relationOf(fields, r.field) && !blockAround(filter, r.id) && canGroup(filter, r.id, levels);
|
|
212
|
+
return [...(canGroup(filter, r.id, levels) ? [{ icon: glyph(GROUP), label: w.toGroup, onSelect: () => change(toGroup(now.current, r.id, ids, levels)) }] : []),
|
|
213
|
+
...(blockable ? [{ kind: "separator" }, { kind: "pick", value: "any", choices: QUANTIFIERS.filter((q) => q !== "every" || isWhole(r, fields)).map((q) => ({ value: q, label: w.quantifier(q) })),
|
|
214
|
+
onChoose: (q) => change(toBlock(now.current, r.id, q, fields, ids, levels)) }, { kind: "separator" }] : []),
|
|
215
|
+
{ icon: glyph(TRASH), label: w.deleteRule, danger: true, onSelect: () => remove(r.id) }];
|
|
216
|
+
}
|
|
174
217
|
const ruleRow = (r) => {
|
|
175
218
|
const field = fieldOf(fields, r.field), own = ownOf(r), aside = r.aside, name = labelOf(r);
|
|
176
219
|
const kitWay = field ? wayOf(field.type, r.how) : undefined, takes = kitWay ? kitWay.takes : own && !aside && own.body != null ? "one" : undefined;
|
|
177
220
|
const ways = field ? waysOf(field) : [];
|
|
178
|
-
const entries =
|
|
179
|
-
? [{ icon: null, label: aside.why, disabled: aside.why },
|
|
180
|
-
...(aside.putBack ? [{ icon: null, label: w.putBack, onSelect: () => change(putBack(now.current, r.id)) }] : []),
|
|
181
|
-
{ icon: glyph(TRASH), label: w.deleteRule, danger: true, onSelect: () => remove(r.id) }]
|
|
182
|
-
: [...(canGroup(filter, r.id, levels) ? [{ icon: glyph(GROUP), label: w.toGroup, onSelect: () => change(toGroup(now.current, r.id, ids, levels)) }] : []),
|
|
183
|
-
{ icon: glyph(TRASH), label: w.deleteRule, danger: true, onSelect: () => remove(r.id) }];
|
|
221
|
+
const entries = ruleEntries(r), fieldItems = asSelect(fieldsIn(filter, r.id, fields));
|
|
184
222
|
const why = (node) => (aside ? _jsx(Tooltip, { label: aside.why, reason: true, side: "bottom", children: _jsx("span", { className: "o-filter-editor-why", children: node }) }) : node);
|
|
185
223
|
const wayPlaceholder = own && !kitWay ? own.way : w.way(r.how);
|
|
186
224
|
return (_jsxs("div", { className: "o-filter-editor-rule", "data-rule": r.id, "data-whole": (field || own) && isWhole(r, fields) ? "" : undefined, "data-set-aside": aside || (!field && !own) ? "" : undefined, "data-aside": aside ? "" : undefined, children: [_jsxs("div", { className: "o-filter-editor-boxes", children: [_jsx("div", { className: "o-filter-editor-field", children: why(_jsx(Select, { size: size, listWidth: "rows", "aria-label": w.field, items: fieldItems, value: field && !aside ? r.field : null, placeholder: name, search: w.search, ...stepOf({ list: "field", rule: r.id }), onValueChange: (v) => { if (typeof v === "string" && (v !== r.field || aside))
|
|
187
225
|
pointAt(r.id, v); } })) }), _jsx("div", { className: "o-filter-editor-how", children: why(_jsx(Select, { size: size, listWidth: "rows", "aria-label": w.how, items: ways, value: field && kitWay && !aside ? r.how : null, placeholder: wayPlaceholder, disabled: !!aside || (!field && !!own), ...(field || !own ? stepOf({ list: "how", rule: r.id }) : {}), onValueChange: (v) => { if (typeof v === "string" && v !== r.how)
|
|
188
|
-
change(changeRule(now.current, r.id, { how: v }, fields)); } })) }), aside && own?.value != null && (_jsx("div", { className: "o-filter-editor-value", "data-value-of": r.id, "data-value-box": "own", children: why(_jsx(Input, { readOnly: true, disabled: true, size: size, "aria-label": name, value: own.value, className: "o-filter-editor-own-box" })) })), !aside && takes && takes !== "none" && (field || own) && (_jsx("div", { className: "o-filter-editor-value", "data-value-of": r.id, "data-value-box": own ? "own" : field?.choices ? "choice" : takes === "two" ? "pair" : field?.type === "date" ? "date" : "typed", children: valueBox(r, field ?? { value: r.field, label: name, type: "text" }, takes, own) }))] }),
|
|
189
|
-
|
|
226
|
+
change(changeRule(now.current, r.id, { how: v }, fields)); } })) }), aside && own?.value != null && (_jsx("div", { className: "o-filter-editor-value", "data-value-of": r.id, "data-value-box": "own", children: why(_jsx(Input, { readOnly: true, disabled: true, size: size, "aria-label": name, value: own.value, className: "o-filter-editor-own-box" })) })), !aside && takes && takes !== "none" && (field || own) && (_jsx("div", { className: "o-filter-editor-value", "data-value-of": r.id, "data-value-box": own ? "own" : field?.choices ? "choice" : takes === "two" ? "pair" : field?.type === "date" ? "date" : "typed", children: valueBox(r, field ?? { value: r.field, label: name, type: "text" }, takes, own) }))] }), phone ? moreStep(r.id, w.ruleOf(name))
|
|
227
|
+
: _jsx(Menu, { label: w.ruleOf(name), align: "end", entries: entries, trigger: _jsx(Button, { kind: "quiet", shape: "icon", size: "xs", look: MORE_LOOK, className: "o-filter-editor-more", "aria-label": w.ruleOf(name), icon: glyph(DOTS_UP) }) })] }));
|
|
190
228
|
};
|
|
191
229
|
const lead = (g, i) => i === 0 ? _jsx("span", { className: "o-filter-editor-where", children: w.where })
|
|
192
|
-
: i === 1 ? _jsx(Button, { kind: "outline", size: "sm", className: "o-filter-editor-join", iconEnd: glyph(TURNS), onClick: () => change(setJoin(now.current, g.id, g.join === "and" ? "or" : "and")), children: w.join(g.join) })
|
|
230
|
+
: i === 1 && !g.exclude ? _jsx(Button, { kind: "outline", size: "sm", className: "o-filter-editor-join", iconEnd: glyph(TURNS), onClick: () => change(setJoin(now.current, g.id, g.join === "and" ? "or" : "and")), children: w.join(g.join) })
|
|
193
231
|
: _jsx("span", { className: "o-filter-editor-joined", children: w.join(g.join) });
|
|
194
|
-
const
|
|
232
|
+
const blockHead = (g) => g.relation && (_jsx(BlockHead, { id: g.id, label: blockLabel(g), items: quantifiersOf(g), value: g.relation.quantifier, size: size, onPick: (q) => change(setQuantifier(now.current, g.id, q)), ...(phone ? { step: { open: false, onOpenChange: (o) => { if (o)
|
|
233
|
+
setStep({ list: "quantifier", group: g.id }); } } } : {}) }));
|
|
234
|
+
const groupMore = (g) => (phone ? moreStep(g.id, w.groupActions) : _jsx(GroupMenu, { entries: groupEntries(g), words: w }));
|
|
235
|
+
const top = _jsxs(_Fragment, { children: [filter.exclude && _jsx("p", { className: "o-filter-editor-excluded", children: w.excluded }), blockHead(filter)] });
|
|
236
|
+
const level = (g, depth) => (_jsx("div", { className: "o-filter-editor-rules", role: "list", "aria-label": depth ? w.group : label, children: g.rules.map((item, i) => (_jsxs("div", { role: "listitem", className: "o-filter-editor-item", children: [lead(g, i), isBlock(item) ? (_jsxs("div", { className: "o-filter-editor-group o-filter-editor-block", "data-group": item.id, "data-block": item.id, children: [blockHead(item), level(item, depth + 1), _jsxs("div", { className: "o-filter-editor-foot", children: [addButton(item.id, stacked ? "quiet" : "outline", phone ? "44" : "sm"), _jsx(Button, { kind: "quiet", size: phone ? "44" : "sm", className: "o-filter-editor-delete", onClick: () => remove(item.id), children: w.deleteRule })] })] })) : isGroup(item) ? (_jsxs("div", { className: "o-filter-editor-group", "data-group": item.id, children: [item.exclude && _jsx("p", { className: "o-filter-editor-excluded", children: w.excluded }), level(item, depth + 1), _jsxs("div", { className: "o-filter-editor-foot", children: [addButton(item.id, stacked ? "quiet" : "outline", phone ? "44" : "sm"), _jsx(Button, { kind: "quiet", size: phone ? "44" : "sm", className: "o-filter-editor-delete", onClick: () => remove(item.id), children: w.deleteGroup }), groupMore(item)] })] })) : ruleRow(item)] }, item.id))) }));
|
|
195
237
|
const addingPopover = !standing && (_jsx(Popover, { open: !!adding, onOpenChange: (o) => { if (!o)
|
|
196
|
-
setAdding(null); }, anchor: adding?.at, className: "w-fit min-w-[calc(var(--vk-spacing,var(--spacing))*48)]", "aria-label": w.add, children: adding && _jsx(Picker, { label: w.add, items: fields, value: null, onValueChange: (v) => add(adding.group, v), onDone: () => setAdding(null), search: w.search, searchShown: true, form: "computer", ...words }) }));
|
|
238
|
+
setAdding(null); }, anchor: adding?.at, className: "w-fit min-w-[calc(var(--vk-spacing,var(--spacing))*48)]", "aria-label": w.add, children: adding && _jsx(Picker, { label: w.add, items: fieldsIn(filter, adding.group, fields), value: null, onValueChange: (v) => add(adding.group, v), onDone: () => setAdding(null), search: w.search, searchShown: true, form: "computer", ...words }) }));
|
|
197
239
|
if (stacked) {
|
|
198
|
-
const body = (_jsx("div", { ref: placeRoot, className: "o-filter-editor", "data-kit": "filter-editor", "data-filter-form": way, role: phone ? undefined : "group", "aria-label": phone ? undefined : label, tabIndex: -1, style: room ? { paddingBottom: room } : undefined, ...phoneMark(!!screen || small), "data-filter-step": stepTitle !== undefined ? step?.list : undefined, children: stepTitle !== undefined ? stepBody : _jsxs(_Fragment, { children: [filter.rules.length ? level(filter, 0)
|
|
199
|
-
: _jsxs("div", { className: "o-filter-editor-none", children: [_jsx("p", { className: "o-filter-editor-none-head", children: w.none }), _jsx("p", { className: "o-filter-editor-none-line", children: w.noneLine })] }), _jsxs("div", { className: "o-filter-editor-acts", children: [addButton(filter.id, filter.rules.length ? "outline" : "primary", phone ? "44" : "sm"), filter.rules.length > 0 && _jsx(Button, { kind: "quiet", size: phone ? "44" : "sm", className: "o-filter-editor-clear", onClick: clear, children: w.clearAll })] }), !phone && addingPopover] }) }));
|
|
240
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-filter-editor", "data-kit": "filter-editor", "data-filter-form": way, role: phone ? undefined : "group", "aria-label": phone ? undefined : label, tabIndex: -1, style: room ? { paddingBottom: room } : undefined, ...phoneMark(!!screen || small), "data-filter-step": stepTitle !== undefined ? step?.list : undefined, children: stepTitle !== undefined ? stepBody : _jsxs(_Fragment, { children: [top, filter.rules.length ? level(filter, 0)
|
|
241
|
+
: _jsxs("div", { className: "o-filter-editor-none", children: [_jsx("p", { className: "o-filter-editor-none-head", children: w.none }), _jsx("p", { className: "o-filter-editor-none-line", children: w.noneLine })] }), _jsxs("div", { className: "o-filter-editor-acts", children: [addButton(filter.id, filter.rules.length ? "outline" : "primary", phone ? "44" : "sm"), filter.rules.length > 0 && _jsx(Button, { kind: "quiet", size: phone ? "44" : "sm", className: "o-filter-editor-clear", onClick: clear, children: w.clearAll }), props.excludable && groupMore(filter)] }), !phone && addingPopover] }) }));
|
|
200
242
|
return { body, head: !phone ? {} : stepTitle !== undefined ? { onBack: back } : decide.head, ...(stepTitle !== undefined ? { title: stepTitle } : {}) };
|
|
201
243
|
}
|
|
202
|
-
const fieldsAlone = !filter.rules.length;
|
|
203
|
-
const body = (_jsx("div", { ref: placeRoot, className: "o-filter-editor", "data-kit": "filter-editor", "data-filter-form": "computer", role: "group", "aria-label": label, tabIndex: -1, "data-filter-fields": fieldsAlone ? "" : undefined, style: room ? { paddingBottom: room } : undefined, ...phoneMark(!!screen || small), children: !fieldsAlone ? _jsxs(_Fragment, { children: [level(filter, 0), _jsxs("div", { className: "o-filter-editor-foot", children: [addButton(filter.id, "outline", "sm"), _jsx(Button, { kind: "quiet", size: "sm", className: "o-filter-editor-clear", onClick: clear, children: w.clearAllFilters })] }), addingPopover] }) : (_jsx(Picker, { label: label, items: fields, value: null, onValueChange: (v) => add(filter.id, v), search: w.search, searchShown: true, form: "computer", ...words })) }));
|
|
244
|
+
const fieldsAlone = !filter.rules.length && !filter.relation;
|
|
245
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-filter-editor", "data-kit": "filter-editor", "data-filter-form": "computer", role: "group", "aria-label": label, tabIndex: -1, "data-filter-fields": fieldsAlone ? "" : undefined, style: room ? { paddingBottom: room } : undefined, ...phoneMark(!!screen || small), children: !fieldsAlone ? _jsxs(_Fragment, { children: [top, level(filter, 0), _jsxs("div", { className: "o-filter-editor-foot", children: [addButton(filter.id, "outline", "sm"), _jsx(Button, { kind: "quiet", size: "sm", className: "o-filter-editor-clear", onClick: clear, children: w.clearAllFilters }), props.excludable && groupMore(filter)] }), addingPopover] }) : (_jsx(Picker, { label: label, items: fields, value: null, onValueChange: (v) => add(filter.id, v), search: w.search, searchShown: true, form: "computer", ...words })) }));
|
|
204
246
|
return { body, head: {} };
|
|
205
247
|
}
|
|
248
|
+
export const useFilterEditorParts = useFilterEditor;
|
|
206
249
|
export function FilterEditor(props) {
|
|
207
250
|
return _jsx(_Fragment, { children: useFilterEditor(props).body });
|
|
208
251
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PickerItem } from "../picker/rows.js";
|
|
2
|
-
export type FieldType = "status" | "select" | "person" | "record" | "number" | "text" | "date" | "checkbox" | "range";
|
|
2
|
+
export type FieldType = "status" | "select" | "person" | "record" | "number" | "text" | "longtext" | "date" | "checkbox" | "range";
|
|
3
3
|
/** What a way takes: one value, several (a choice's), two (a range's From and To), or none. */
|
|
4
4
|
export type Takes = "one" | "several" | "two" | "none";
|
|
5
5
|
/** One way a type compares: its value in a rule, its words, what it takes. */
|
|
@@ -5,6 +5,7 @@ export const HOW = {
|
|
|
5
5
|
status: CHOICE, select: CHOICE, person: CHOICE, record: CHOICE,
|
|
6
6
|
number: [way("is", "one"), way("is not", "one"), way("less than", "one"), way("greater than", "one"), ...EMPTINESS],
|
|
7
7
|
text: [way("contains", "one"), way("does not contain", "one"), way("starts with", "one"), way("ends with", "one"), way("is", "one"), way("is not", "one"), ...EMPTINESS],
|
|
8
|
+
longtext: [way("contains", "one"), way("does not contain", "one"), ...EMPTINESS],
|
|
8
9
|
date: [way("is", "one"), way("is not", "one"), way("before", "one"), way("after", "one"), ...EMPTINESS],
|
|
9
10
|
checkbox: [way("is", "one")],
|
|
10
11
|
range: [way("any part between", "two"), way("entirely within", "two"), way("includes", "one"), way("at least", "one"), way("at most", "one"), ...EMPTINESS],
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
import type { FilterRule as ViewKitRule } from "viewkitjs/fields/query";
|
|
2
3
|
import { type ViewsMessageResolver } from "../../contract.js";
|
|
3
4
|
import type { ViewsFilterBodyProps, ViewsFilterPartBodyProps } from "../../provider/components.js";
|
|
5
|
+
import { type FilterOwn } from "./filter-editor.js";
|
|
4
6
|
import { type ChoicesOf, type KitFields } from "./map-rules.js";
|
|
5
|
-
import { type FilterGroup as KitGroup } from "./rules.js";
|
|
7
|
+
import { type FilterGroup as KitGroup, type FilterRule as KitRule } from "./rules.js";
|
|
6
8
|
import type { FilterEditorWords } from "./words.js";
|
|
9
|
+
/** The app's icon, as the Picker's rows draw it. */
|
|
10
|
+
type AppIcon = React.ComponentType<{
|
|
11
|
+
name: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}>;
|
|
7
14
|
/** The filter editor's words in the app's messages. */
|
|
8
15
|
export declare function filterWordsOf(say: ViewsMessageResolver): FilterEditorWords;
|
|
16
|
+
/** ViewKit's filter body's props as the filter editor's parts, the level turned both ways. */
|
|
17
|
+
export declare function useMapFilterBody(p: ViewsFilterBodyProps, words: FilterEditorWords, say: ViewsMessageResolver, AppIcon: AppIcon | undefined, wayWord: (operator: string) => string): {
|
|
18
|
+
kit: KitFields;
|
|
19
|
+
filter: KitGroup;
|
|
20
|
+
change: (next: KitGroup) => void;
|
|
21
|
+
own: (rule: KitRule) => FilterOwn | null;
|
|
22
|
+
};
|
|
9
23
|
export declare function MapFilterBody(props: ViewsFilterBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
10
24
|
/** The rule as a one-rule kit filter, with the kit's fields for it; null where the kit draws no rule of it, or where a choice has no
|
|
11
25
|
* values to offer, which ViewKit's own body then draws. */
|
|
@@ -16,3 +30,4 @@ export declare function partOf(rule: ViewKitRule, field: ViewsFilterPartBodyProp
|
|
|
16
30
|
/** The kit filter's one rule as ViewKit's, naming the field and part the rule handed did; null where it holds none. */
|
|
17
31
|
export declare function ruleBack(next: KitGroup, rule: ViewKitRule, kit: KitFields): ViewKitRule | null;
|
|
18
32
|
export declare function MapFilterPartBody(props: ViewsFilterPartBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export {};
|
|
@@ -10,7 +10,7 @@ import { pickerItemsOf, pickerWordsOf } from "../picker/map-picker.js";
|
|
|
10
10
|
import { Picker } from "../picker/picker.js";
|
|
11
11
|
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
12
12
|
import { useFilterEditor } from "./filter-editor.js";
|
|
13
|
-
import { kitFieldsOf, kitFilterOf, rulesFor, viewKitFilterOf, writeRules, CHOICE } from "./map-rules.js";
|
|
13
|
+
import { kitFieldsOf, kitFilterOf, rulesFor, viewKitFilterOf, writeRules, CHOICE, RELATION_WAY } from "./map-rules.js";
|
|
14
14
|
import { FilterPartBody } from "./parts.js";
|
|
15
15
|
import { changeRule, fieldOf, isOwnWay, rulesOf } from "./rules.js";
|
|
16
16
|
const BACK = ["M5 12l14 0", "M5 12l6 6", "M5 12l6 -6"];
|
|
@@ -47,7 +47,14 @@ export function filterWordsOf(say) {
|
|
|
47
47
|
close: say({ key: "views.panels.close" }),
|
|
48
48
|
save: say({ key: "views.panels.filter-done" }),
|
|
49
49
|
putBack: say({ key: "views.panels.put-back" }),
|
|
50
|
+
quantifier: (quantifier) => say({ key: "views.panels.filter-relation-way", values: { quantifier } }),
|
|
51
|
+
everyNeedsWhere: (one) => say({ key: "views.panels.relation-every-needs-where", values: { one } }),
|
|
52
|
+
groupActions: say({ key: "views.panels.filter-group-actions" }),
|
|
53
|
+
exclude: say({ key: "views.panels.filter-exclude" }),
|
|
54
|
+
excludeNeedsAnd: say({ key: "views.panels.filter-exclude-needs-and" }),
|
|
55
|
+
excluded: say({ key: "views.panels.filter-excluded" }),
|
|
50
56
|
picker: pickerWordsOf(say),
|
|
57
|
+
list: { on: say({ key: "views.panels.toggle-on" }), off: say({ key: "views.panels.toggle-off" }) },
|
|
51
58
|
};
|
|
52
59
|
}
|
|
53
60
|
function BodyHead({ title, left, right }) {
|
|
@@ -62,35 +69,54 @@ function choicesOf(fields, AppIcon) {
|
|
|
62
69
|
if (g.options)
|
|
63
70
|
far.set(`${f.fieldKey}\u0000${g.fieldKey}`, pickerItemsOf(g.options, { AppIcon }));
|
|
64
71
|
}
|
|
65
|
-
else if (f.options
|
|
66
|
-
own.set(f.fieldKey
|
|
72
|
+
else if (f.options)
|
|
73
|
+
own.set(f.part === undefined ? f.fieldKey : `${f.fieldKey}\u0000${f.part}`, pickerItemsOf(f.options, { AppIcon }));
|
|
67
74
|
}
|
|
68
|
-
return (fieldKey, relation) => (relation !== undefined ? far.get(`${relation}\u0000${fieldKey}`) : own.get(fieldKey));
|
|
75
|
+
return (fieldKey, relation, part) => (relation !== undefined ? far.get(`${relation}\u0000${fieldKey}`) : own.get(part === undefined ? fieldKey : `${fieldKey}\u0000${part}`));
|
|
69
76
|
}
|
|
70
77
|
function listed(fields, rule, relation) {
|
|
71
78
|
const at = relation !== undefined ? fields.find((f) => f.far && f.fieldKey === relation)?.far ?? [] : fields.filter((f) => !f.far);
|
|
72
|
-
return at.some((f) => f.fieldKey === rule.fieldKey && (f.part ?? undefined) === (rule.part ?? undefined));
|
|
79
|
+
return at.some((f) => f.disabled === undefined && f.fieldKey === rule.fieldKey && (f.part ?? undefined) === (rule.part ?? undefined));
|
|
73
80
|
}
|
|
74
|
-
function useMapFilterBody(p, words, say, AppIcon, wayWord) {
|
|
81
|
+
export function useMapFilterBody(p, words, say, AppIcon, wayWord) {
|
|
75
82
|
const within = p.relation?.fieldKey;
|
|
76
83
|
const choices = React.useMemo(() => choicesOf(p.fields, AppIcon), [p.fields, AppIcon]);
|
|
77
84
|
const kit = React.useMemo(() => kitFieldsOf(p.fields, choices, within), [p.fields, choices, within]);
|
|
78
85
|
const [, redraw] = React.useReducer((n) => n + 1, 0);
|
|
79
86
|
const own = React.useRef(new Map()).current;
|
|
80
87
|
const asideWords = (rule, relation) => {
|
|
88
|
+
if (isRelation(rule)) {
|
|
89
|
+
const far = p.fields.find((f) => f.far && f.fieldKey === rule.fieldKey);
|
|
90
|
+
const fits = !!rule.setAside && !!far;
|
|
91
|
+
const why = !rule.setAside ? say({ key: "views.panels.filter-relation-gone" }) : fits ? say({ key: "views.panels.filter-set-aside-back" })
|
|
92
|
+
: say({ key: "views.panels.filter-set-aside-why", values: { reason: rule.setAside.reason } });
|
|
93
|
+
return { label: far?.label ?? rule.fieldKey, why, putBack: fits };
|
|
94
|
+
}
|
|
81
95
|
const at = relation ?? within, back = rule.setAside?.reason === "missing-field" && listed(p.fields, rule, at);
|
|
82
96
|
const why = back ? say({ key: "views.panels.filter-set-aside-back" }) : say({ key: "views.panels.filter-set-aside-why", values: { reason: rule.setAside?.reason ?? "missing-field" } });
|
|
83
97
|
const own = (at !== undefined ? p.fields.find((f) => f.far && f.fieldKey === at)?.far ?? [] : p.fields).find((f) => f.fieldKey === rule.fieldKey && (f.part ?? undefined) === (rule.part ?? undefined));
|
|
84
98
|
return { label: p.ruleWords?.(rule, at).field ?? own?.label ?? rule.fieldKey, why, putBack: back };
|
|
85
99
|
};
|
|
86
|
-
const
|
|
87
|
-
const
|
|
100
|
+
const cached = rulesFor(p.filter, kit, own, asideWords);
|
|
101
|
+
const read = p.relation ? { ...cached, filter: { ...cached.filter, relation: { field: p.relation.fieldKey, label: p.relation.label, quantifier: p.relation.quantifier,
|
|
102
|
+
...(p.relation.gone !== undefined ? { gone: p.relation.gone } : {}) } } } : cached;
|
|
103
|
+
const write = (next, raw = read.raw) => {
|
|
104
|
+
const { relation, ...rules } = next;
|
|
105
|
+
p.onFilterChange(writeRules(rules, kit, read.kept, own, raw), p.relation ? relation?.quantifier : undefined);
|
|
106
|
+
redraw();
|
|
107
|
+
};
|
|
88
108
|
const ownOf = (rule) => {
|
|
89
|
-
const
|
|
90
|
-
if (node && (rule.aside || isOwnWay(rule.how))) {
|
|
91
|
-
|
|
109
|
+
const held = read.raw.get(rule.id), node = held?.node;
|
|
110
|
+
if (held && node && (rule.aside || isOwnWay(rule.how))) {
|
|
111
|
+
if (isRelation(node) && rule.how === RELATION_WAY)
|
|
112
|
+
return { field: rule.aside?.label ?? node.fieldKey, way: say({ key: "views.panels.filter-relation-way", values: { quantifier: node.quantifier } }), value: null, body: null };
|
|
113
|
+
const inner = isRelation(node) ? node.where.items[0] : node, relation = isRelation(node) ? node.fieldKey : held.relation ?? within;
|
|
92
114
|
const said = p.ruleWords?.(inner, relation);
|
|
93
|
-
const put = (next) => {
|
|
115
|
+
const put = (next) => {
|
|
116
|
+
const raw = new Map(read.raw);
|
|
117
|
+
raw.set(rule.id, { ...held, node: isRelation(node) ? { ...node, where: { ...node.where, items: [next] } } : next });
|
|
118
|
+
write(read.filter, raw);
|
|
119
|
+
};
|
|
94
120
|
return { field: said?.field ?? inner.fieldKey, way: said?.way ?? wayWord(inner.operator), value: said?.value ?? null, body: rule.aside ? null : p.ruleValue(inner, put, relation) };
|
|
95
121
|
}
|
|
96
122
|
const f = fieldOf(kit.fields, rule.field);
|
|
@@ -117,7 +143,7 @@ export function MapFilterBody(props) {
|
|
|
117
143
|
const wayWord = (operator) => (views?.conventions ? views.conventions.messages({ key: "filter.operator", values: { operator } }) : operator.replace(/_/g, " "));
|
|
118
144
|
const map = useMapFilterBody(props, words, say, views?.components.AppIcon, wayWord);
|
|
119
145
|
const parts = useFilterEditor({ label: props.label, fields: map.kit.fields, filter: map.filter, levels: props.levels, form: props.form, onDone: props.onDone,
|
|
120
|
-
onFilterChange: map.change, own: map.own, words });
|
|
146
|
+
onFilterChange: map.change, own: map.own, words, excludable: props.excludable });
|
|
121
147
|
useToldStep(parts, props.onStepChange);
|
|
122
148
|
const { actions } = props;
|
|
123
149
|
if (!actions)
|
|
@@ -18,15 +18,21 @@ export type Kept = Record<string, {
|
|
|
18
18
|
order: string[];
|
|
19
19
|
}>;
|
|
20
20
|
/** The ViewKit node each rule the kit draws but can't word stood for (a set-aside rule, a `vk:` way), by its kit id. */
|
|
21
|
-
export type Raw = ReadonlyMap<string,
|
|
21
|
+
export type Raw = ReadonlyMap<string, RawNode>;
|
|
22
|
+
/** The node a kit rule stood for, and the relation's field key when it stood inside a block (its where). */
|
|
23
|
+
export type RawNode = {
|
|
24
|
+
node: FilterRule | FilterRelationRule;
|
|
25
|
+
relation?: string;
|
|
26
|
+
};
|
|
22
27
|
/** A set-aside rule in words: its field's name, why, and whether Put back fits. `relation`: the relation's field key, for a far rule. */
|
|
23
|
-
export type AsideWords = (rule: FilterRule, relation?: string) => FilterAside;
|
|
28
|
+
export type AsideWords = (rule: FilterRule | FilterRelationRule, relation?: string) => FilterAside;
|
|
24
29
|
/** The kit types whose value is picked from choices. */
|
|
25
30
|
export declare const CHOICE: ReadonlySet<KitType>;
|
|
26
|
-
/** A field's type as the kit's filter editor draws it; null for one it doesn't (a place whole, a
|
|
31
|
+
/** A field's type as the kit's filter editor draws it; null for one it doesn't (a place whole, a lookup…), whose rules are ViewKit's to
|
|
32
|
+
* word (`own:`). */
|
|
27
33
|
export declare const kitTypeOf: (type: FieldType) => KitType | null;
|
|
28
34
|
/** A part's type as the kit draws it, by fields' operators for it (operatorsFor): a place's city, region and postal code are words;
|
|
29
|
-
* its country, compared as options,
|
|
35
|
+
* its country, compared as options, a choice of country names (VK-735); a range's end is a number. ViewKit hands a part with its whole field's
|
|
30
36
|
* type; any other type ignores its part. */
|
|
31
37
|
export declare function kitPartTypeOf(type: FieldType, part: string | undefined): KitType | null;
|
|
32
38
|
/** Where a kit field's rule goes in ViewKit's filter: its field, its part, and for a related record's field, the relation's field key. */
|
|
@@ -35,13 +41,16 @@ export type FieldAt = {
|
|
|
35
41
|
part?: string;
|
|
36
42
|
relation?: string;
|
|
37
43
|
};
|
|
38
|
-
/** The kit's fields, and where each one's rule goes (a
|
|
44
|
+
/** The kit's fields, and where each one's rule goes (a part the kit lists no field for, too: its rules are ViewKit's to word). */
|
|
39
45
|
export type KitFields = {
|
|
40
46
|
fields: FilterField[];
|
|
41
47
|
at: ReadonlyMap<string, FieldAt>;
|
|
48
|
+
/** Each relation's kit field (its Related records row), by ViewKit's field key. */
|
|
49
|
+
relations: ReadonlyMap<string, string>;
|
|
42
50
|
};
|
|
43
|
-
/** A field's values to pick from, by its key, and for a related record's field, its relation's
|
|
44
|
-
|
|
51
|
+
/** A field's values to pick from, by its key, and for a related record's field, its relation's; a part's (a place's country) by
|
|
52
|
+
* its part. */
|
|
53
|
+
export type ChoicesOf = (fieldKey: string, relation?: string, part?: string) => PickerItem[] | undefined;
|
|
45
54
|
/** The heading the related records stand under, ViewKit's own English (views.panels.related-records). */
|
|
46
55
|
export declare const RELATED = "Related records";
|
|
47
56
|
/** A related record's field as one value of the kit's: the relation's row and the far field's key; and back. */
|
|
@@ -53,19 +62,26 @@ export declare const pathParts: (value: string) => [string, string?];
|
|
|
53
62
|
* but its place is known, so a rule on it is ViewKit's to word. Open on a relation's where (`relation`, its field key), that
|
|
54
63
|
* relation's far fields alone, as plain fields. */
|
|
55
64
|
export declare function kitFieldsOf(fields: readonly ViewsFilterBodyField[], choices: ChoicesOf, relation?: string): KitFields;
|
|
65
|
+
/** The field a rule the kit has no type for names: ViewKit's to word (`own:<fieldKey>~<part>`). */
|
|
66
|
+
export declare const OWN_FIELD = "own:";
|
|
67
|
+
/** The way of a relation rule drawn as one row (set aside, or on a relation the fields don't list). */
|
|
68
|
+
export declare const RELATION_WAY = "vk:relation";
|
|
56
69
|
/** The kit's filter as a level of ViewKit's: its join (`not` again where the level read excluded its matches), its rules in fields'
|
|
57
70
|
* operators, its groups, each rule the kit can't word as the node it was read from (`raw`), and what was kept back in each group in
|
|
58
71
|
* its place, a group the kit took away handing its kept to the nearest one left. */
|
|
59
72
|
export declare function viewKitFilterOf(filter: KitGroup, fields: KitFields, kept: Kept, raw?: Raw): FilterGroup;
|
|
60
73
|
/** A level of ViewKit's filter as the kit's: its rules and groups, ids `root`, then `v1`… and `r1`… in reading order; a set-aside rule
|
|
61
74
|
* carrying its words (`asideWords`), a rule on a way or a place's part the kit can't word on its `vk:` way, each with the node it was
|
|
62
|
-
* read from in `raw
|
|
63
|
-
*
|
|
64
|
-
*
|
|
75
|
+
* read from in `raw`. A `not` group is a kit group that excludes its matches (`exclude`, joined by And), or a date's "is not" an
|
|
76
|
+
* older view holds; the level itself too. A relation rule with "any" and one plain rule in its where, on a far field, is the kit's
|
|
77
|
+
* rule on its path, as drawn flat; any other a block (`relation`), its where's rules on its relation's fields; one set aside, or on
|
|
78
|
+
* a relation the fields don't list, one row in its words (VK-827). A rule on a field the kit has no type for is ViewKit's to word
|
|
79
|
+
* (`own:`). What is kept by the group it stands in, with the item it followed, is left to a group holding nothing and a relation
|
|
80
|
+
* rule inside a where, which fields refuses: nothing a person's filter holds is out of sight. */
|
|
65
81
|
export declare function kitFilterOf(level: FilterGroup, fields: KitFields, asideWords?: AsideWords): {
|
|
66
82
|
filter: KitGroup;
|
|
67
83
|
kept: Kept;
|
|
68
|
-
raw: Map<string,
|
|
84
|
+
raw: Map<string, RawNode>;
|
|
69
85
|
};
|
|
70
86
|
/** What one level was written from: the kit's rules, what it kept, and the nodes of the rules it can't word. */
|
|
71
87
|
type Read = {
|