@viewkitjs/views 0.0.0-stage → 0.2.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 +615 -0
- package/LICENSE.md +7 -0
- package/README.md +99 -2
- package/dist/atoms/CommandMenu.d.ts +2 -0
- package/dist/atoms/CommandMenu.js +20 -0
- package/dist/atoms/List.d.ts +2 -0
- package/dist/atoms/List.js +6 -0
- package/dist/atoms/LoadMore.d.ts +2 -0
- package/dist/atoms/LoadMore.js +25 -0
- package/dist/atoms/Loading.d.ts +2 -0
- package/dist/atoms/Loading.js +7 -0
- package/dist/atoms/PlatformMark.d.ts +2 -0
- package/dist/atoms/PlatformMark.js +4 -0
- package/dist/atoms/RelationLink.d.ts +2 -0
- package/dist/atoms/RelationLink.js +6 -0
- package/dist/atoms/Row.d.ts +3 -0
- package/dist/atoms/Row.js +30 -0
- package/dist/atoms/RowMenu.d.ts +2 -0
- package/dist/atoms/RowMenu.js +112 -0
- package/dist/atoms/StatusBadge.d.ts +2 -0
- package/dist/atoms/StatusBadge.js +7 -0
- package/dist/atoms/StatusMarker.d.ts +2 -0
- package/dist/atoms/StatusMarker.js +19 -0
- package/dist/atoms/Tag.d.ts +2 -0
- package/dist/atoms/Tag.js +13 -0
- package/dist/atoms/TickBox.d.ts +2 -0
- package/dist/atoms/TickBox.js +8 -0
- package/dist/atoms/defaults.d.ts +2 -0
- package/dist/atoms/defaults.js +27 -0
- package/dist/atoms/tones.d.ts +5 -0
- package/dist/atoms/tones.js +28 -0
- package/dist/atoms/types.d.ts +178 -0
- package/dist/atoms/types.js +3 -0
- package/dist/cells/cell-format.d.ts +138 -0
- package/dist/cells/cell-format.js +16 -0
- package/dist/cells/cell-title.d.ts +17 -0
- package/dist/cells/cell-title.js +8 -0
- package/dist/cells/cell-values.d.ts +28 -0
- package/dist/cells/cell-values.js +87 -0
- package/dist/cells/index.d.ts +4 -0
- package/dist/cells/index.js +4 -0
- package/dist/cells/legacy-field.d.ts +52 -0
- package/dist/cells/legacy-field.js +164 -0
- package/dist/cells/relation-wrap.d.ts +3 -0
- package/dist/cells/relation-wrap.js +24 -0
- package/dist/cells/use-cell-format.d.ts +5 -0
- package/dist/cells/use-cell-format.js +10 -0
- package/dist/contract.d.ts +461 -0
- package/dist/contract.js +682 -0
- package/dist/display/actor.d.ts +4 -0
- package/dist/display/actor.js +26 -0
- package/dist/display/boolean.d.ts +18 -0
- package/dist/display/boolean.js +43 -0
- package/dist/display/breakdown.d.ts +15 -0
- package/dist/display/breakdown.js +32 -0
- package/dist/display/currency.d.ts +9 -0
- package/dist/display/currency.js +29 -0
- package/dist/display/date.d.ts +12 -0
- package/dist/display/date.js +26 -0
- package/dist/display/display-cores.d.ts +31 -0
- package/dist/display/display-cores.js +57 -0
- package/dist/display/entity-chip.d.ts +26 -0
- package/dist/display/entity-chip.js +9 -0
- package/dist/display/format.d.ts +66 -0
- package/dist/display/format.js +190 -0
- package/dist/display/index.d.ts +8 -0
- package/dist/display/index.js +7 -0
- package/dist/display/link.d.ts +29 -0
- package/dist/display/link.js +50 -0
- package/dist/display/location.d.ts +8 -0
- package/dist/display/location.js +22 -0
- package/dist/display/multi-value.d.ts +18 -0
- package/dist/display/multi-value.js +28 -0
- package/dist/display/name.d.ts +6 -0
- package/dist/display/name.js +14 -0
- package/dist/display/number.d.ts +11 -0
- package/dist/display/number.js +27 -0
- package/dist/display/options.d.ts +153 -0
- package/dist/display/options.js +1 -0
- package/dist/display/percent.d.ts +4 -0
- package/dist/display/percent.js +40 -0
- package/dist/display/phone.d.ts +11 -0
- package/dist/display/phone.js +45 -0
- package/dist/display/range.d.ts +6 -0
- package/dist/display/range.js +29 -0
- package/dist/display/relation.d.ts +4 -0
- package/dist/display/relation.js +29 -0
- package/dist/display/rich-text.d.ts +10 -0
- package/dist/display/rich-text.js +34 -0
- package/dist/display/select.d.ts +6 -0
- package/dist/display/select.js +38 -0
- package/dist/display/text-class.d.ts +23 -0
- package/dist/display/text-class.js +5 -0
- package/dist/display/text.d.ts +19 -0
- package/dist/display/text.js +8 -0
- package/dist/display/use-display-options.d.ts +2 -0
- package/dist/display/use-display-options.js +14 -0
- package/dist/display/user.d.ts +11 -0
- package/dist/display/user.js +10 -0
- package/dist/display/value-list.d.ts +10 -0
- package/dist/display/value-list.js +12 -0
- package/dist/display/viewer.d.ts +4 -0
- package/dist/display/viewer.js +11 -0
- package/dist/display/web-href.d.ts +8 -0
- package/dist/display/web-href.js +12 -0
- package/dist/editors/ChipsEditor.d.ts +59 -0
- package/dist/editors/ChipsEditor.js +73 -0
- package/dist/editors/DateEditor.d.ts +25 -0
- package/dist/editors/DateEditor.js +122 -0
- package/dist/editors/LocationEditor.d.ts +22 -0
- package/dist/editors/LocationEditor.js +228 -0
- package/dist/editors/NameEditor.d.ts +22 -0
- package/dist/editors/NameEditor.js +92 -0
- package/dist/editors/NumberEditor.d.ts +67 -0
- package/dist/editors/NumberEditor.js +86 -0
- package/dist/editors/RangeEditor.d.ts +22 -0
- package/dist/editors/RangeEditor.js +70 -0
- package/dist/editors/RelationEditor.d.ts +65 -0
- package/dist/editors/RelationEditor.js +64 -0
- package/dist/editors/SelectEditor.d.ts +72 -0
- package/dist/editors/SelectEditor.js +59 -0
- package/dist/editors/ValueListEditor.d.ts +38 -0
- package/dist/editors/ValueListEditor.js +217 -0
- package/dist/editors/edit-cores.d.ts +83 -0
- package/dist/editors/edit-cores.js +38 -0
- package/dist/editors/edit-session.d.ts +74 -0
- package/dist/editors/edit-session.js +35 -0
- package/dist/editors/open-values.d.ts +28 -0
- package/dist/editors/open-values.js +26 -0
- package/dist/editors/relation-source.d.ts +66 -0
- package/dist/editors/relation-source.js +102 -0
- package/dist/fields/binding.d.ts +87 -0
- package/dist/fields/binding.js +117 -0
- package/dist/fields/currency.d.ts +82 -0
- package/dist/fields/currency.js +41 -0
- package/dist/fields/denomination.d.ts +42 -0
- package/dist/fields/denomination.js +11 -0
- package/dist/fields/edit-core-types.d.ts +40 -0
- package/dist/fields/edit-core-types.js +29 -0
- package/dist/fields/format-knobs.d.ts +34 -0
- package/dist/fields/format-knobs.js +36 -0
- package/dist/fields/menus.d.ts +28 -0
- package/dist/fields/menus.js +1 -0
- package/dist/fields/money.d.ts +60 -0
- package/dist/fields/money.js +78 -0
- package/dist/fields/number-edit.d.ts +11 -0
- package/dist/fields/number-edit.js +17 -0
- package/dist/fields/prepare-write.d.ts +55 -0
- package/dist/fields/prepare-write.js +67 -0
- package/dist/fields/relation-source-types.d.ts +54 -0
- package/dist/fields/relation-source-types.js +1 -0
- package/dist/figures.d.ts +52 -0
- package/dist/figures.js +63 -0
- package/dist/filters/date-filter.d.ts +2 -0
- package/dist/filters/date-filter.js +1 -0
- package/dist/filters/filter-model.d.ts +176 -0
- package/dist/filters/filter-model.js +41 -0
- package/dist/filters/number-filter.d.ts +2 -0
- package/dist/filters/number-filter.js +1 -0
- package/dist/filters/range-filter.d.ts +2 -0
- package/dist/filters/range-filter.js +1 -0
- package/dist/filters/registry.d.ts +103 -0
- package/dist/filters/registry.js +8 -0
- package/dist/filters/relation-filter.d.ts +16 -0
- package/dist/filters/relation-filter.js +53 -0
- package/dist/filters/text-filter.d.ts +2 -0
- package/dist/filters/text-filter.js +1 -0
- package/dist/grid/chrome/GridAddColumn.d.ts +11 -0
- package/dist/grid/chrome/GridAddColumn.js +29 -0
- package/dist/grid/chrome/GridAggregateMenu.d.ts +31 -0
- package/dist/grid/chrome/GridAggregateMenu.js +27 -0
- package/dist/grid/chrome/GridCellEditors.d.ts +64 -0
- package/dist/grid/chrome/GridCellEditors.js +55 -0
- package/dist/grid/chrome/GridCellOutline.d.ts +70 -0
- package/dist/grid/chrome/GridCellOutline.js +21 -0
- package/dist/grid/chrome/GridChipsEditor.d.ts +28 -0
- package/dist/grid/chrome/GridChipsEditor.js +40 -0
- package/dist/grid/chrome/GridColumnColorSection.d.ts +11 -0
- package/dist/grid/chrome/GridColumnColorSection.js +40 -0
- package/dist/grid/chrome/GridColumnDateSection.d.ts +23 -0
- package/dist/grid/chrome/GridColumnDateSection.js +23 -0
- package/dist/grid/chrome/GridColumnDurationSection.d.ts +19 -0
- package/dist/grid/chrome/GridColumnDurationSection.js +24 -0
- package/dist/grid/chrome/GridColumnMenu.d.ts +101 -0
- package/dist/grid/chrome/GridColumnMenu.js +99 -0
- package/dist/grid/chrome/GridColumnNumberSection.d.ts +25 -0
- package/dist/grid/chrome/GridColumnNumberSection.js +27 -0
- package/dist/grid/chrome/GridColumnPercentSection.d.ts +15 -0
- package/dist/grid/chrome/GridColumnPercentSection.js +16 -0
- package/dist/grid/chrome/GridColumnSortSection.d.ts +18 -0
- package/dist/grid/chrome/GridColumnSortSection.js +16 -0
- package/dist/grid/chrome/GridDateEditor.d.ts +22 -0
- package/dist/grid/chrome/GridDateEditor.js +31 -0
- package/dist/grid/chrome/GridFlyout.d.ts +44 -0
- package/dist/grid/chrome/GridFlyout.js +80 -0
- package/dist/grid/chrome/GridFooter.d.ts +23 -0
- package/dist/grid/chrome/GridFooter.js +81 -0
- package/dist/grid/chrome/GridGroupMenu.d.ts +37 -0
- package/dist/grid/chrome/GridGroupMenu.js +57 -0
- package/dist/grid/chrome/GridHeader.d.ts +61 -0
- package/dist/grid/chrome/GridHeader.js +37 -0
- package/dist/grid/chrome/GridLongTextEditor.d.ts +36 -0
- package/dist/grid/chrome/GridLongTextEditor.js +127 -0
- package/dist/grid/chrome/GridMenuRow.d.ts +15 -0
- package/dist/grid/chrome/GridMenuRow.js +15 -0
- package/dist/grid/chrome/GridNameEditor.d.ts +19 -0
- package/dist/grid/chrome/GridNameEditor.js +36 -0
- package/dist/grid/chrome/GridNumberEditor.d.ts +35 -0
- package/dist/grid/chrome/GridNumberEditor.js +25 -0
- package/dist/grid/chrome/GridRangeEditor.d.ts +20 -0
- package/dist/grid/chrome/GridRangeEditor.js +25 -0
- package/dist/grid/chrome/GridRelationEditor.d.ts +21 -0
- package/dist/grid/chrome/GridRelationEditor.js +30 -0
- package/dist/grid/chrome/GridResizeHandle.d.ts +19 -0
- package/dist/grid/chrome/GridResizeHandle.js +19 -0
- package/dist/grid/chrome/GridRow.d.ts +25 -0
- package/dist/grid/chrome/GridRow.js +136 -0
- package/dist/grid/chrome/GridRowActions.d.ts +32 -0
- package/dist/grid/chrome/GridRowActions.js +25 -0
- package/dist/grid/chrome/GridRowCells.d.ts +4 -0
- package/dist/grid/chrome/GridRowCells.js +133 -0
- package/dist/grid/chrome/GridRowGlyph.d.ts +12 -0
- package/dist/grid/chrome/GridRowGlyph.js +13 -0
- package/dist/grid/chrome/GridSelectEditor.d.ts +18 -0
- package/dist/grid/chrome/GridSelectEditor.js +49 -0
- package/dist/grid/chrome/GridStructure.d.ts +48 -0
- package/dist/grid/chrome/GridStructure.js +45 -0
- package/dist/grid/chrome/GridTable.d.ts +4 -0
- package/dist/grid/chrome/GridTable.js +125 -0
- package/dist/grid/chrome/GridTableSurface.d.ts +15 -0
- package/dist/grid/chrome/GridTableSurface.js +6 -0
- package/dist/grid/chrome/GridTextEditor.d.ts +11 -0
- package/dist/grid/chrome/GridTextEditor.js +40 -0
- package/dist/grid/chrome/GridValueListEditor.d.ts +18 -0
- package/dist/grid/chrome/GridValueListEditor.js +36 -0
- package/dist/grid/chrome/StuckMarker.d.ts +16 -0
- package/dist/grid/chrome/StuckMarker.js +34 -0
- package/dist/grid/chrome/cell-clipboard.d.ts +9 -0
- package/dist/grid/chrome/cell-clipboard.js +28 -0
- package/dist/grid/chrome/cells.d.ts +21 -0
- package/dist/grid/chrome/cells.js +20 -0
- package/dist/grid/chrome/checks.d.ts +35 -0
- package/dist/grid/chrome/checks.js +22 -0
- package/dist/grid/chrome/column-glyph.d.ts +14 -0
- package/dist/grid/chrome/column-glyph.js +44 -0
- package/dist/grid/chrome/editors.d.ts +9 -0
- package/dist/grid/chrome/editors.js +10 -0
- package/dist/grid/chrome/grid-cell-classes.d.ts +59 -0
- package/dist/grid/chrome/grid-cell-classes.js +30 -0
- package/dist/grid/chrome/grid-menu-search.d.ts +7 -0
- package/dist/grid/chrome/grid-menu-search.js +7 -0
- package/dist/grid/chrome/grid-row-props.d.ts +131 -0
- package/dist/grid/chrome/grid-row-props.js +1 -0
- package/dist/grid/chrome/grid-styles.d.ts +37 -0
- package/dist/grid/chrome/grid-styles.js +8 -0
- package/dist/grid/chrome/grid-table-props.d.ts +173 -0
- package/dist/grid/chrome/grid-table-props.js +1 -0
- package/dist/grid/chrome/useGridBatchApi.d.ts +34 -0
- package/dist/grid/chrome/useGridBatchApi.js +35 -0
- package/dist/grid/chrome/useGridColumnLayout.d.ts +30 -0
- package/dist/grid/chrome/useGridColumnLayout.js +206 -0
- package/dist/grid/chrome/useGridHeaderDrag.d.ts +20 -0
- package/dist/grid/chrome/useGridHeaderDrag.js +37 -0
- package/dist/grid/chrome/useGridKeyboard.d.ts +47 -0
- package/dist/grid/chrome/useGridKeyboard.js +274 -0
- package/dist/grid/chrome/useGridPendingReconciliation.d.ts +12 -0
- package/dist/grid/chrome/useGridPendingReconciliation.js +32 -0
- package/dist/grid/chrome/useGridRailReveal.d.ts +57 -0
- package/dist/grid/chrome/useGridRailReveal.js +67 -0
- package/dist/grid/chrome/useGridRangeActions.d.ts +49 -0
- package/dist/grid/chrome/useGridRangeActions.js +188 -0
- package/dist/grid/chrome/useGridRangeGestures.d.ts +32 -0
- package/dist/grid/chrome/useGridRangeGestures.js +190 -0
- package/dist/grid/chrome/useGridRowContextMenu.d.ts +35 -0
- package/dist/grid/chrome/useGridRowContextMenu.js +127 -0
- package/dist/grid/chrome/useGridScaleStyles.d.ts +1 -0
- package/dist/grid/chrome/useGridScaleStyles.js +29 -0
- package/dist/grid/chrome/useGridScrollSync.d.ts +38 -0
- package/dist/grid/chrome/useGridScrollSync.js +176 -0
- package/dist/grid/chrome/useGridTableInteractionModel.d.ts +55 -0
- package/dist/grid/chrome/useGridTableInteractionModel.js +197 -0
- package/dist/grid/chrome/useGridTableSelection.d.ts +29 -0
- package/dist/grid/chrome/useGridTableSelection.js +55 -0
- package/dist/grid/chrome/useHeaderDragReorder.d.ts +21 -0
- package/dist/grid/chrome/useHeaderDragReorder.js +216 -0
- package/dist/grid/core/clipboard-model.d.ts +81 -0
- package/dist/grid/core/clipboard-model.js +291 -0
- package/dist/grid/core/column-values.d.ts +27 -0
- package/dist/grid/core/column-values.js +76 -0
- package/dist/grid/core/commit-model.d.ts +34 -0
- package/dist/grid/core/commit-model.js +3 -0
- package/dist/grid/core/coordinates.d.ts +48 -0
- package/dist/grid/core/coordinates.js +27 -0
- package/dist/grid/core/edit-values.d.ts +9 -0
- package/dist/grid/core/edit-values.js +1 -0
- package/dist/grid/core/editing-controller.d.ts +59 -0
- package/dist/grid/core/editing-controller.js +240 -0
- package/dist/grid/core/editing-model.d.ts +78 -0
- package/dist/grid/core/editing-model.js +136 -0
- package/dist/grid/core/grid-scale.d.ts +14 -0
- package/dist/grid/core/grid-scale.js +8 -0
- package/dist/grid/core/nav.d.ts +94 -0
- package/dist/grid/core/nav.js +92 -0
- package/dist/grid/core/pending-reconciliation.d.ts +50 -0
- package/dist/grid/core/pending-reconciliation.js +49 -0
- package/dist/grid/core/range-model.d.ts +25 -0
- package/dist/grid/core/range-model.js +59 -0
- package/dist/grid/core/spreadsheet-operations.d.ts +85 -0
- package/dist/grid/core/spreadsheet-operations.js +253 -0
- package/dist/grid/core/useGridEditing.d.ts +43 -0
- package/dist/grid/core/useGridEditing.js +90 -0
- package/dist/grid/core/useGridRange.d.ts +20 -0
- package/dist/grid/core/useGridRange.js +24 -0
- package/dist/grid/core/value-equality.d.ts +32 -0
- package/dist/grid/core/value-equality.js +34 -0
- package/dist/grid/index.d.ts +18 -0
- package/dist/grid/index.js +5 -0
- package/dist/grid/useGridTablePrefs.d.ts +50 -0
- package/dist/grid/useGridTablePrefs.js +101 -0
- package/dist/grouping/sort-groups.d.ts +18 -0
- package/dist/grouping/sort-groups.js +33 -0
- package/dist/grouping/types.d.ts +10 -0
- package/dist/grouping/types.js +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +28 -0
- package/dist/internal/chip.d.ts +4 -0
- package/dist/internal/chip.js +3 -0
- package/dist/internal/cx.d.ts +3 -0
- package/dist/internal/cx.js +3 -0
- package/dist/internal/viewport.d.ts +5 -0
- package/dist/internal/viewport.js +29 -0
- package/dist/model/aggregates.d.ts +59 -0
- package/dist/model/aggregates.js +186 -0
- package/dist/model/card-density.d.ts +8 -0
- package/dist/model/card-density.js +10 -0
- package/dist/model/card-layout.d.ts +85 -0
- package/dist/model/card-layout.js +90 -0
- package/dist/model/column-capabilities.d.ts +162 -0
- package/dist/model/column-capabilities.js +233 -0
- package/dist/model/column-filters.d.ts +106 -0
- package/dist/model/column-filters.js +321 -0
- package/dist/model/column-format.d.ts +103 -0
- package/dist/model/column-format.js +1 -0
- package/dist/model/column-from.d.ts +28 -0
- package/dist/model/column-from.js +160 -0
- package/dist/model/column-inspect.d.ts +18 -0
- package/dist/model/column-inspect.js +6 -0
- package/dist/model/column-knobs.d.ts +20 -0
- package/dist/model/column-knobs.js +16 -0
- package/dist/model/column-money.d.ts +13 -0
- package/dist/model/column-money.js +27 -0
- package/dist/model/column-order.d.ts +36 -0
- package/dist/model/column-order.js +68 -0
- package/dist/model/column-schema.d.ts +335 -0
- package/dist/model/column-schema.js +1 -0
- package/dist/model/column-sort.d.ts +17 -0
- package/dist/model/column-sort.js +11 -0
- package/dist/model/column-state.d.ts +77 -0
- package/dist/model/column-state.js +95 -0
- package/dist/model/column-types.d.ts +109 -0
- package/dist/model/column-types.js +50 -0
- package/dist/model/column-warnings.d.ts +44 -0
- package/dist/model/column-warnings.js +24 -0
- package/dist/model/density.d.ts +3 -0
- package/dist/model/density.js +13 -0
- package/dist/model/field-type-of.d.ts +21 -0
- package/dist/model/field-type-of.js +11 -0
- package/dist/model/filter-capabilities.d.ts +1 -0
- package/dist/model/filter-capabilities.js +1 -0
- package/dist/model/index.d.ts +38 -0
- package/dist/model/index.js +20 -0
- package/dist/model/part-rows.d.ts +28 -0
- package/dist/model/part-rows.js +40 -0
- package/dist/model/preferences.d.ts +155 -0
- package/dist/model/preferences.js +84 -0
- package/dist/model/prefs-buckets.d.ts +173 -0
- package/dist/model/prefs-buckets.js +71 -0
- package/dist/model/relation-filters.d.ts +45 -0
- package/dist/model/relation-filters.js +78 -0
- package/dist/model/render-count.d.ts +2 -0
- package/dist/model/render-count.js +24 -0
- package/dist/model/row-icon.d.ts +23 -0
- package/dist/model/row-icon.js +5 -0
- package/dist/model/view-rules.d.ts +73 -0
- package/dist/model/view-rules.js +216 -0
- package/dist/provider/ViewsProvider.d.ts +26 -0
- package/dist/provider/ViewsProvider.js +16 -0
- package/dist/provider/components.d.ts +230 -0
- package/dist/provider/components.js +3 -0
- package/dist/provider/context.d.ts +20 -0
- package/dist/provider/context.js +10 -0
- package/dist/provider/icons.d.ts +6 -0
- package/dist/provider/icons.js +1 -0
- package/dist/provider/menu-groups.d.ts +8 -0
- package/dist/provider/menu-groups.js +38 -0
- package/dist/provider/ports.d.ts +57 -0
- package/dist/provider/ports.js +9 -0
- package/dist/react.d.ts +9 -0
- package/dist/react.js +4 -0
- package/dist/selection/SelectCheckbox.d.ts +17 -0
- package/dist/selection/SelectCheckbox.js +11 -0
- package/dist/selection/index.d.ts +7 -0
- package/dist/selection/index.js +6 -0
- package/dist/selection/model.d.ts +55 -0
- package/dist/selection/model.js +86 -0
- package/dist/selection/row-click.d.ts +35 -0
- package/dist/selection/row-click.js +20 -0
- package/dist/selection/types.d.ts +17 -0
- package/dist/selection/types.js +1 -0
- package/dist/selection/useCheckDragSelect.d.ts +61 -0
- package/dist/selection/useCheckDragSelect.js +165 -0
- package/dist/selection/useListSelection.d.ts +39 -0
- package/dist/selection/useListSelection.js +48 -0
- package/dist/selection/useListSelectionShortcuts.d.ts +6 -0
- package/dist/selection/useListSelectionShortcuts.js +14 -0
- package/dist/selection/useRestIntent.d.ts +18 -0
- package/dist/selection/useRestIntent.js +35 -0
- package/docs/contract.md +525 -0
- package/docs/getting-started.md +250 -0
- package/docs/guides/atoms.md +245 -0
- package/docs/guides/cells.md +302 -0
- package/docs/guides/columns.md +412 -0
- package/docs/guides/display.md +203 -0
- package/docs/guides/editors.md +404 -0
- package/docs/guides/ports.md +246 -0
- package/docs/guides/selection.md +270 -0
- package/docs/guides/the-grid.md +677 -0
- package/docs/guides/the-provider.md +446 -0
- package/docs/index.md +50 -0
- package/docs/install.md +67 -0
- package/docs/reference/cells.md +28 -0
- package/docs/reference/display.md +42 -0
- package/docs/reference/editors-chips.md +6 -0
- package/docs/reference/editors-date.md +6 -0
- package/docs/reference/editors-location.md +10 -0
- package/docs/reference/editors-name.md +6 -0
- package/docs/reference/editors-number.md +11 -0
- package/docs/reference/editors-open-values.md +9 -0
- package/docs/reference/editors-range.md +6 -0
- package/docs/reference/editors-relation.md +9 -0
- package/docs/reference/editors-select.md +8 -0
- package/docs/reference/editors-session.md +9 -0
- package/docs/reference/editors-value-list.md +6 -0
- package/docs/reference/editors.md +5 -0
- package/docs/reference/grid.md +39 -0
- package/docs/reference/react.md +86 -0
- package/docs/reference/selection.md +33 -0
- package/docs/reference/views.md +601 -0
- package/docs/reshaping.md +19 -0
- package/package.json +118 -3
- package/skills/views/SKILL.md +102 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { FilterRelationRule } from "@viewkitjs/fields/query";
|
|
3
|
+
import { type TextFilterRule } from "./text-filter.js";
|
|
4
|
+
import { type NumberFilterRule } from "./number-filter.js";
|
|
5
|
+
import { type DateFilterRule } from "./date-filter.js";
|
|
6
|
+
import { type RangeFilterRule } from "./range-filter.js";
|
|
7
|
+
/**
|
|
8
|
+
* The filter dimension contracts — one variant per editor.
|
|
9
|
+
*
|
|
10
|
+
* Split out of `model.ts` because the union grew a member per column type
|
|
11
|
+
* (options, text, number, date) and kept growing; the rest of the view-control
|
|
12
|
+
* contracts have nothing to do with it. Server-safe, like its parent: no
|
|
13
|
+
* `"use client"`, no hooks, no JSX.
|
|
14
|
+
*/
|
|
15
|
+
export type FilterOption<T extends string = string> = {
|
|
16
|
+
value: T;
|
|
17
|
+
label: string;
|
|
18
|
+
icon?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
export type FilterKind = "status" | "category" | "metric" | "entity";
|
|
21
|
+
export type FilterConfigBase = {
|
|
22
|
+
key: string;
|
|
23
|
+
label: string;
|
|
24
|
+
icon?: ReactNode;
|
|
25
|
+
/** Drives the default row icon via the shared kind-to-icon map. */
|
|
26
|
+
kind?: FilterKind;
|
|
27
|
+
countsAsFilter?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The dimension is LISTED but not openable — it has no editor on this
|
|
30
|
+
* surface yet. Used by the column-derived filter list so a table's full set
|
|
31
|
+
* of columns reads as one inventory (the way Notion lists every property)
|
|
32
|
+
* instead of silently hiding the ones whose type has no filter editor.
|
|
33
|
+
* A disabled row is never active, never counted, never cleared.
|
|
34
|
+
*/
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Renders the row under its own labelled section instead of the plain list.
|
|
38
|
+
* Same shape and intent as `ToggleConfig.section`. Rows sharing a section
|
|
39
|
+
* string group together; unsectioned rows always render first.
|
|
40
|
+
*/
|
|
41
|
+
section?: string;
|
|
42
|
+
/** Overrides the derived right-hand summary ("All types", "3 selected"). */
|
|
43
|
+
valueLabel?: string;
|
|
44
|
+
/** The row's detail opened (POR-845): a host may ask for what it offers — an open field's values, read from
|
|
45
|
+
* the database rather than the rows on screen. Called once per opening. */
|
|
46
|
+
onOpen?: () => void;
|
|
47
|
+
};
|
|
48
|
+
export type FilterConfigSingle<T extends string = string> = FilterConfigBase & {
|
|
49
|
+
/** Declared absent so `editor` discriminates the union — without it, a filter
|
|
50
|
+
* literal that omits `editor` is ambiguous and its `onChange` parameter
|
|
51
|
+
* silently loses its type. */
|
|
52
|
+
editor?: undefined;
|
|
53
|
+
multi?: false;
|
|
54
|
+
value: T;
|
|
55
|
+
onChange: (value: T) => void;
|
|
56
|
+
options: FilterOption<T>[];
|
|
57
|
+
allValue?: T;
|
|
58
|
+
allLabel?: string;
|
|
59
|
+
hideAllOption?: boolean;
|
|
60
|
+
renderOption?: (option: FilterOption<T>) => ReactNode;
|
|
61
|
+
renderLeading?: (option: FilterOption<T>) => ReactNode;
|
|
62
|
+
renderTrailing?: (option: FilterOption<T>) => ReactNode;
|
|
63
|
+
contentClassName?: string;
|
|
64
|
+
};
|
|
65
|
+
export type FilterConfigMulti<T extends string = string> = FilterConfigBase & {
|
|
66
|
+
editor?: undefined;
|
|
67
|
+
multi: true;
|
|
68
|
+
value: T[];
|
|
69
|
+
onChange: (value: T[]) => void;
|
|
70
|
+
options: FilterOption<T>[];
|
|
71
|
+
emptyLabel?: string;
|
|
72
|
+
renderOption?: (option: FilterOption<T>) => ReactNode;
|
|
73
|
+
renderLeading?: (option: FilterOption<T>) => ReactNode;
|
|
74
|
+
renderTrailing?: (option: FilterOption<T>) => ReactNode;
|
|
75
|
+
contentClassName?: string;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* A free-text dimension: one operator + one query, against one text column.
|
|
79
|
+
* Its `value` is a RULE rather than a chosen option, which is why it can't be
|
|
80
|
+
* expressed as an option filter — see `text-filter.ts` for why that rule is
|
|
81
|
+
* data and not a predicate.
|
|
82
|
+
*/
|
|
83
|
+
export type FilterConfigText = FilterConfigBase & {
|
|
84
|
+
editor: "text";
|
|
85
|
+
/** Absent on the option variants, so `editor` discriminates the union. */
|
|
86
|
+
multi?: undefined;
|
|
87
|
+
value: TextFilterRule | null;
|
|
88
|
+
onChange: (next: TextFilterRule | null) => void;
|
|
89
|
+
};
|
|
90
|
+
/** A numeric dimension: an operator plus one bound, or two for a range. */
|
|
91
|
+
export type FilterConfigNumber = FilterConfigBase & {
|
|
92
|
+
editor: "number";
|
|
93
|
+
multi?: undefined;
|
|
94
|
+
value: NumberFilterRule | null;
|
|
95
|
+
onChange: (next: NumberFilterRule | null) => void;
|
|
96
|
+
/** Displayed decimals, so equality rounds the way the cell does. */
|
|
97
|
+
decimals?: number;
|
|
98
|
+
/** Shown inside the box: a currency code, "%", "s", nothing. */
|
|
99
|
+
unit?: string;
|
|
100
|
+
/**
|
|
101
|
+
* How the box READS and WRITES its bound. Names only what actually differs —
|
|
102
|
+
* `duration` parses `2m 30s` into the milliseconds the rule stores and prints
|
|
103
|
+
* them back the same way — rather than restating the column's whole style
|
|
104
|
+
* union, which this layer sits below and must not import.
|
|
105
|
+
*/
|
|
106
|
+
numberStyle?: "plain" | "duration";
|
|
107
|
+
/**
|
|
108
|
+
* `duration` only: the unit the RULE is kept in — the column's stored unit
|
|
109
|
+
* (spec §8.4), `ms` unless the field says `s`. The box still reads and writes
|
|
110
|
+
* `2m 30s`; this is what it converts to, so the rule compares against what
|
|
111
|
+
* the cell holds.
|
|
112
|
+
*/
|
|
113
|
+
durationUnit?: "ms" | "s";
|
|
114
|
+
};
|
|
115
|
+
/** A date dimension: absolute operators, a range, or a relative window. */
|
|
116
|
+
export type FilterConfigDate = FilterConfigBase & {
|
|
117
|
+
editor: "date";
|
|
118
|
+
multi?: undefined;
|
|
119
|
+
value: DateFilterRule | null;
|
|
120
|
+
onChange: (next: DateFilterRule | null) => void;
|
|
121
|
+
};
|
|
122
|
+
/** A deliberate refusal. A stale persisted rule keeps this row active only so
|
|
123
|
+
* the user can see and clear it; it is never evaluated as a predicate. */
|
|
124
|
+
export type FilterConfigUnavailable = FilterConfigBase & {
|
|
125
|
+
editor: "unavailable";
|
|
126
|
+
multi?: undefined;
|
|
127
|
+
reason: string;
|
|
128
|
+
stale: boolean;
|
|
129
|
+
onClear: () => void;
|
|
130
|
+
};
|
|
131
|
+
/** A range dimension: an operator and up to two bounds, and the presets as quick picks. */
|
|
132
|
+
export type FilterConfigRange = FilterConfigBase & {
|
|
133
|
+
editor: "range";
|
|
134
|
+
multi?: undefined;
|
|
135
|
+
value: RangeFilterRule | null;
|
|
136
|
+
onChange: (next: RangeFilterRule | null) => void;
|
|
137
|
+
/** Shown beside the boxes: "%", a currency code, nothing. */
|
|
138
|
+
unit?: string;
|
|
139
|
+
presets?: readonly {
|
|
140
|
+
key: string;
|
|
141
|
+
label: string;
|
|
142
|
+
low: number | null;
|
|
143
|
+
high: number | null;
|
|
144
|
+
}[];
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* A relation's dimension (POR-704): which far records must match — any, none or every — and the far fields'
|
|
148
|
+
* own rows as its Where. Its `value` is the saved view's relation rule itself; each Where row edits one rule
|
|
149
|
+
* inside `value.where`.
|
|
150
|
+
*/
|
|
151
|
+
export type FilterConfigRelation = FilterConfigBase & {
|
|
152
|
+
editor: "relation";
|
|
153
|
+
multi?: undefined;
|
|
154
|
+
value: FilterRelationRule | null;
|
|
155
|
+
onChange: (next: FilterRelationRule | null) => void;
|
|
156
|
+
/** The far record, one and many: "campaign" / "campaigns". */
|
|
157
|
+
noun: {
|
|
158
|
+
one: string;
|
|
159
|
+
many: string;
|
|
160
|
+
};
|
|
161
|
+
/** What the list's rows are, plural and lower case: "clients". */
|
|
162
|
+
subject: string;
|
|
163
|
+
/** The far fields' rows, each editing one rule inside `value.where`. */
|
|
164
|
+
where: FilterConfig<string>[];
|
|
165
|
+
/** Whether Every may be chosen: Where holds a rule. */
|
|
166
|
+
canEvery: boolean;
|
|
167
|
+
};
|
|
168
|
+
export type FilterConfig<T extends string = string> = FilterConfigSingle<T> | FilterConfigMulti<T> | FilterConfigText | FilterConfigNumber | FilterConfigDate | FilterConfigRange | FilterConfigUnavailable | FilterConfigRelation;
|
|
169
|
+
export declare function isUnavailableFilter<T extends string>(filter: FilterConfig<T>): filter is FilterConfigUnavailable;
|
|
170
|
+
/** Narrow before touching `.multi` / `.options` — a text filter has neither. */
|
|
171
|
+
export declare function isTextFilter<T extends string>(filter: FilterConfig<T>): filter is FilterConfigText;
|
|
172
|
+
export declare function isNumberFilter<T extends string>(filter: FilterConfig<T>): filter is FilterConfigNumber;
|
|
173
|
+
export declare function isDateFilter<T extends string>(filter: FilterConfig<T>): filter is FilterConfigDate;
|
|
174
|
+
export declare function isRangeFilter<T extends string>(filter: FilterConfig<T>): filter is FilterConfigRange;
|
|
175
|
+
export declare function isRelationFilter<T extends string>(filter: FilterConfig<T>): filter is FilterConfigRelation;
|
|
176
|
+
export declare function isFilterActive<T extends string>(filter: FilterConfig<T>): boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { isTextRuleActive } from "./text-filter.js";
|
|
2
|
+
import { isNumberRuleActive } from "./number-filter.js";
|
|
3
|
+
import { isDateRuleActive } from "./date-filter.js";
|
|
4
|
+
import { isRangeRuleActive } from "./range-filter.js";
|
|
5
|
+
export function isUnavailableFilter(filter) {
|
|
6
|
+
return filter.editor === "unavailable";
|
|
7
|
+
}
|
|
8
|
+
export function isTextFilter(filter) {
|
|
9
|
+
return filter.editor === "text";
|
|
10
|
+
}
|
|
11
|
+
export function isNumberFilter(filter) {
|
|
12
|
+
return filter.editor === "number";
|
|
13
|
+
}
|
|
14
|
+
export function isDateFilter(filter) {
|
|
15
|
+
return filter.editor === "date";
|
|
16
|
+
}
|
|
17
|
+
export function isRangeFilter(filter) {
|
|
18
|
+
return filter.editor === "range";
|
|
19
|
+
}
|
|
20
|
+
export function isRelationFilter(filter) {
|
|
21
|
+
return filter.editor === "relation";
|
|
22
|
+
}
|
|
23
|
+
export function isFilterActive(filter) {
|
|
24
|
+
if (filter.disabled)
|
|
25
|
+
return false;
|
|
26
|
+
if (isUnavailableFilter(filter))
|
|
27
|
+
return filter.stale;
|
|
28
|
+
if (isRelationFilter(filter))
|
|
29
|
+
return filter.value !== null;
|
|
30
|
+
if (isTextFilter(filter))
|
|
31
|
+
return isTextRuleActive(filter.value);
|
|
32
|
+
if (isNumberFilter(filter))
|
|
33
|
+
return isNumberRuleActive(filter.value);
|
|
34
|
+
if (isRangeFilter(filter))
|
|
35
|
+
return isRangeRuleActive(filter.value);
|
|
36
|
+
if (isDateFilter(filter))
|
|
37
|
+
return isDateRuleActive(filter.value);
|
|
38
|
+
if (filter.multi)
|
|
39
|
+
return filter.value.length > 0;
|
|
40
|
+
return filter.value !== (filter.allValue ?? "all");
|
|
41
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { DEFAULT_NUMBER_FILTER_RULE, NUMBER_FILTER_OPERATORS, durationUnitToMs, formatDurationInput, isNumberRuleActive, matchesNumberRule, msToDurationUnit, numberFilterInputs, numberFilterOperatorLabel, numberRuleLabel, parseDurationInput, parseNumber, } from "@viewkitjs/fields/query";
|
|
2
|
+
export type { DurationUnit, NumberFilterOperator, NumberFilterRule } from "@viewkitjs/fields/query";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DEFAULT_NUMBER_FILTER_RULE, NUMBER_FILTER_OPERATORS, durationUnitToMs, formatDurationInput, isNumberRuleActive, matchesNumberRule, msToDurationUnit, numberFilterInputs, numberFilterOperatorLabel, numberRuleLabel, parseDurationInput, parseNumber, } from "@viewkitjs/fields/query";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { DEFAULT_RANGE_FILTER_RULE, RANGE_FILTER_OPERATORS, isRangeRuleActive, matchesRangeRule, rangeFilterInputs, rangeFilterOperatorLabel, rangeRuleLabel, } from "@viewkitjs/fields/query";
|
|
2
|
+
export type { RangeFilterOperator, RangeFilterRule } from "@viewkitjs/fields/query";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DEFAULT_RANGE_FILTER_RULE, RANGE_FILTER_OPERATORS, isRangeRuleActive, matchesRangeRule, rangeFilterInputs, rangeFilterOperatorLabel, rangeRuleLabel, } from "@viewkitjs/fields/query";
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a list is willing to filter AT THE SOURCE — the one fact the grid cannot
|
|
3
|
+
* work out for itself.
|
|
4
|
+
*
|
|
5
|
+
* The grid knows a column is called `cost` and holds a number. It cannot know
|
|
6
|
+
* that `cost` is `total_cost_usd` on `automations.executions`, and it must not:
|
|
7
|
+
* a component that knew database column names could not be lifted into another
|
|
8
|
+
* application, which is a standing constraint on this subsystem. So the mapping
|
|
9
|
+
* lives with the HOST, in a plain data object, and this file gives that object a
|
|
10
|
+
* shape and a name.
|
|
11
|
+
*
|
|
12
|
+
* ## Why this is a standard rather than a per-list pattern
|
|
13
|
+
*
|
|
14
|
+
* Filtering server-side is the difference between "a page of 50" meaning 50 rows
|
|
15
|
+
* and meaning "50 candidates, some of which you'll see". Every paginated list
|
|
16
|
+
* needs it eventually, so the cost of adopting it has to be near zero:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* export const MY_FILTERS = defineGridFilters({
|
|
20
|
+
* outcome: "outcome",
|
|
21
|
+
* cost: "total_cost_usd",
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* That is the whole declaration. Everything else follows from what the rule
|
|
26
|
+
* already carries — a rule knows whether it is text, a number, a date or a set
|
|
27
|
+
* of options, so nothing restates the column's type.
|
|
28
|
+
*
|
|
29
|
+
* ## The two defaults, and why they are the right way round
|
|
30
|
+
*
|
|
31
|
+
* **A column not named here filters in the BROWSER.** Absence is the opt-out, so
|
|
32
|
+
* there is no flag to forget and no way to accidentally promise a pushdown that
|
|
33
|
+
* doesn't happen. A column whose value is derived after the fetch (a label
|
|
34
|
+
* resolved across three tables) simply isn't in the object and keeps working
|
|
35
|
+
* exactly as it does today.
|
|
36
|
+
*
|
|
37
|
+
* **A column IS assumed nullable.** Getting this wrong in the safe direction
|
|
38
|
+
* costs one redundant `is.null` leg in a query; getting it wrong the other way
|
|
39
|
+
* silently drops every row where the value is absent.
|
|
40
|
+
*/
|
|
41
|
+
/** A date column's storage, because the two are filtered differently: a real
|
|
42
|
+
* `date` compares against calendar days, a `timestamptz` against instants. */
|
|
43
|
+
export type GridFilterColumnType = "auto" | "date" | "timestamptz";
|
|
44
|
+
export type GridFilterEntry = {
|
|
45
|
+
/** The physical column, or a PostgREST json path (`entity_refs->>niche`).
|
|
46
|
+
* Absent only for a `resolved` entry, which has no column to name. */
|
|
47
|
+
column?: string;
|
|
48
|
+
/**
|
|
49
|
+
* This column IS filtered at the source, but by the host's own code rather
|
|
50
|
+
* than by the generic translator — because the value the cell shows isn't a
|
|
51
|
+
* column on the queried table at all.
|
|
52
|
+
*
|
|
53
|
+
* The worked case: a grid shows `workflow_name`, joined from another table,
|
|
54
|
+
* while the queried table holds only `workflow_id`. The host resolves the rule
|
|
55
|
+
* against the (small) set of workflow names and narrows the id constraint
|
|
56
|
+
* itself. There is no predicate this file could emit for that.
|
|
57
|
+
*
|
|
58
|
+
* Declaring it here rather than leaving the column out is what makes the rest
|
|
59
|
+
* work: the rule survives the boundary parse (the registry is the allowlist),
|
|
60
|
+
* it is counted as server-handled, so the browser does not filter it a second
|
|
61
|
+
* time.
|
|
62
|
+
*/
|
|
63
|
+
resolved?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Only worth setting for a genuine `date` column. Everything else is decided
|
|
66
|
+
* by the rule that arrives — a text rule filters text, a number rule filters
|
|
67
|
+
* numbers — so there is no type to keep in step here.
|
|
68
|
+
*/
|
|
69
|
+
type?: GridFilterColumnType;
|
|
70
|
+
/** Set false ONLY for a NOT NULL column. It removes the null-handling legs a
|
|
71
|
+
* negative text operator needs, which is a query-shape saving and nothing
|
|
72
|
+
* more. Wrong here means missing rows. */
|
|
73
|
+
nullable?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The column is an ARRAY (a multiselect's codes). The translator then
|
|
76
|
+
* compiles `is_any_of` as `ov` (overlaps) and `is_none_of` as `not.ov`,
|
|
77
|
+
* never `in`, which tests the whole array against one value.
|
|
78
|
+
*/
|
|
79
|
+
array?: boolean;
|
|
80
|
+
};
|
|
81
|
+
/** Keyed by GRID column id, never by database column. */
|
|
82
|
+
export type ListFilterRegistry = Record<string, GridFilterEntry>;
|
|
83
|
+
/** A column's answer in the Filter panel (`buildColumnFilters`): the column shows greyed with
|
|
84
|
+
* its reason (a saved view's column with no field behind it), so a stale rule can be cleared.
|
|
85
|
+
* A column with no entry filters as any column does. */
|
|
86
|
+
export type ListFilterCapability = {
|
|
87
|
+
mode: "unavailable";
|
|
88
|
+
reason: string;
|
|
89
|
+
};
|
|
90
|
+
export type ListFilterCapabilities = Record<string, ListFilterCapability>;
|
|
91
|
+
/** The shorthand a list actually writes: a bare string when the grid's column id
|
|
92
|
+
* and the database column differ only in name, an object when they don't. */
|
|
93
|
+
export type GridFilterRegistryInput = Record<string, string | GridFilterEntry>;
|
|
94
|
+
/** Declare a column the HOST filters at the source itself — see `resolved`. */
|
|
95
|
+
export declare const RESOLVED_AT_SOURCE: GridFilterEntry;
|
|
96
|
+
/**
|
|
97
|
+
* Normalise a list's declaration into the registry every other piece consumes.
|
|
98
|
+
*
|
|
99
|
+
* A function rather than a bare object literal so the shorthand can exist and so
|
|
100
|
+
* there is one obvious thing to search for when asking "which lists filter at
|
|
101
|
+
* the source".
|
|
102
|
+
*/
|
|
103
|
+
export declare function defineGridFilters(input: GridFilterRegistryInput): ListFilterRegistry;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const RESOLVED_AT_SOURCE = { resolved: true };
|
|
2
|
+
export function defineGridFilters(input) {
|
|
3
|
+
const out = {};
|
|
4
|
+
for (const [columnId, entry] of Object.entries(input)) {
|
|
5
|
+
out[columnId] = typeof entry === "string" ? { column: entry } : entry;
|
|
6
|
+
}
|
|
7
|
+
return out;
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type FieldDef } from "@viewkitjs/fields";
|
|
2
|
+
import { type FilterRelationRule } from "@viewkitjs/fields/query";
|
|
3
|
+
import type { ListFilterRule, ListFilterRuleState } from "../model/preferences.js";
|
|
4
|
+
export type RelationQuantifier = FilterRelationRule["quantifier"];
|
|
5
|
+
/** "Every campaign" with no condition matches every row: no filter. Offered only once Where holds a rule
|
|
6
|
+
* that constrains something. */
|
|
7
|
+
export declare function canChooseEvery(rule: FilterRelationRule | null, farFields?: Readonly<Record<string, FieldDef>>): boolean;
|
|
8
|
+
/** Pick a quantifier. The chosen one again clears the rule; Every with no Where rule is refused (the rule stays). */
|
|
9
|
+
export declare function chooseQuantifier(fieldKey: string, rule: FilterRelationRule | null, quantifier: RelationQuantifier): FilterRelationRule | null;
|
|
10
|
+
/** The Where rules the panel edits, by far field key. */
|
|
11
|
+
export declare function whereRulesOf(rule: FilterRelationRule | null, farFields: Readonly<Record<string, FieldDef>>): ListFilterRuleState;
|
|
12
|
+
/** Replace (or drop, on null) the Where rule on one far field. No rule yet: an Any rule starts. The last
|
|
13
|
+
* Where rule of an Every rule gone (or left unfilled, given the far fields): the rule goes. */
|
|
14
|
+
export declare function withWhereRule(fieldKey: string, rule: FilterRelationRule | null, farField: FieldDef, listRule: ListFilterRule | null, farFields?: Readonly<Record<string, FieldDef>>): FilterRelationRule | null;
|
|
15
|
+
/** The set of relation rules with one replaced, or dropped on null. */
|
|
16
|
+
export declare function setRelationRule(rules: Readonly<Record<string, FilterRelationRule>>, fieldKey: string, rule: FilterRelationRule | null): Record<string, FilterRelationRule>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { valueTypeOf } from "@viewkitjs/fields";
|
|
2
|
+
import { isFilterGroup, isRelationRule, ruleIsActive, } from "@viewkitjs/fields/query";
|
|
3
|
+
import { fromListFilterRule, toListFilterRule } from "../model/view-rules.js";
|
|
4
|
+
const empty = () => ({ op: "and", items: [] });
|
|
5
|
+
function heldRules(items, farFields) {
|
|
6
|
+
if (!farFields)
|
|
7
|
+
return items.length;
|
|
8
|
+
return items.filter((item) => {
|
|
9
|
+
if (isFilterGroup(item) || isRelationRule(item))
|
|
10
|
+
return true;
|
|
11
|
+
const def = farFields[item.fieldKey];
|
|
12
|
+
return !def || ruleIsActive(valueTypeOf(def), item);
|
|
13
|
+
}).length;
|
|
14
|
+
}
|
|
15
|
+
export function canChooseEvery(rule, farFields) {
|
|
16
|
+
return !!rule && heldRules(rule.where.items, farFields) > 0;
|
|
17
|
+
}
|
|
18
|
+
export function chooseQuantifier(fieldKey, rule, quantifier) {
|
|
19
|
+
if (rule?.quantifier === quantifier)
|
|
20
|
+
return null;
|
|
21
|
+
if (quantifier === "every" && !canChooseEvery(rule))
|
|
22
|
+
return rule;
|
|
23
|
+
return { fieldKey, quantifier, where: rule?.where ?? empty() };
|
|
24
|
+
}
|
|
25
|
+
export function whereRulesOf(rule, farFields) {
|
|
26
|
+
const out = {};
|
|
27
|
+
for (const item of rule?.where.items ?? []) {
|
|
28
|
+
if (isFilterGroup(item) || isRelationRule(item))
|
|
29
|
+
continue;
|
|
30
|
+
const def = farFields[item.fieldKey];
|
|
31
|
+
if (!def)
|
|
32
|
+
continue;
|
|
33
|
+
const listRule = toListFilterRule(valueTypeOf(def), item);
|
|
34
|
+
if (listRule)
|
|
35
|
+
out[item.fieldKey] = listRule;
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
export function withWhereRule(fieldKey, rule, farField, listRule, farFields) {
|
|
40
|
+
const where = rule?.where ?? empty();
|
|
41
|
+
const kept = where.items.filter((item) => isFilterGroup(item) || isRelationRule(item) || item.fieldKey !== farField.key);
|
|
42
|
+
const next = listRule ? fromListFilterRule(farField.key, valueTypeOf(farField), listRule) : null;
|
|
43
|
+
const items = next ? [...kept, next] : kept;
|
|
44
|
+
if (!rule)
|
|
45
|
+
return next ? { fieldKey, quantifier: "any", where: { op: where.op, items } } : null;
|
|
46
|
+
if (rule.quantifier === "every" && heldRules(items, farFields) === 0)
|
|
47
|
+
return null;
|
|
48
|
+
return { ...rule, where: { op: where.op, items } };
|
|
49
|
+
}
|
|
50
|
+
export function setRelationRule(rules, fieldKey, rule) {
|
|
51
|
+
const { [fieldKey]: _gone, ...rest } = rules;
|
|
52
|
+
return rule ? { ...rest, [fieldKey]: rule } : rest;
|
|
53
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { DEFAULT_TEXT_FILTER_RULE, TEXT_FILTER_OPERATORS, isTextRuleActive, matchesTextRule, nextTextRule, textFilterNeedsQuery, textFilterOperatorLabel, textRuleLabel, } from "@viewkitjs/fields/query";
|
|
2
|
+
export type { TextFilterOperator, TextFilterRule } from "@viewkitjs/fields/query";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DEFAULT_TEXT_FILTER_RULE, TEXT_FILTER_OPERATORS, isTextRuleActive, matchesTextRule, nextTextRule, textFilterNeedsQuery, textFilterOperatorLabel, textRuleLabel, } from "@viewkitjs/fields/query";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ListColumnsConfig } from "../../model/column-state.js";
|
|
2
|
+
/**
|
|
3
|
+
* "+ ADD COLUMN" ON EVERY GRID: the header row's last cell, for anyone who reads the list. It lists the columns
|
|
4
|
+
* this view hides and can show, and shows the one picked: a choice about the reader's own view, never a change
|
|
5
|
+
* to a field, so it needs no admin and no server. Where a host mounts its own field editor, the header draws
|
|
6
|
+
* the host's instead (a relation's ›, Create new field), in the same look. Hiding is a column's own menu, the
|
|
7
|
+
* order is dragging the header, and the whole list is the host's column list.
|
|
8
|
+
*/
|
|
9
|
+
export declare function GridAddColumn({ columns }: {
|
|
10
|
+
columns: ListColumnsConfig;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { useViews } from "../../provider/context.js";
|
|
5
|
+
import { cx } from "../../internal/cx.js";
|
|
6
|
+
export function GridAddColumn({ columns }) {
|
|
7
|
+
const [open, setOpen] = useState(false);
|
|
8
|
+
const [query, setQuery] = useState("");
|
|
9
|
+
const [anchor, setAnchor] = useState(null);
|
|
10
|
+
const { atoms, components, icons, messages } = useViews();
|
|
11
|
+
const { Popover, Command } = components;
|
|
12
|
+
const { List, RowContent } = atoms;
|
|
13
|
+
const Add = icons.add;
|
|
14
|
+
const wanted = query.trim().toLowerCase();
|
|
15
|
+
const rows = columns.items.filter((item) => item.hidden && !item.fixed && item.label.toLowerCase().includes(wanted));
|
|
16
|
+
const close = (reason = "none") => {
|
|
17
|
+
setOpen(false);
|
|
18
|
+
setQuery("");
|
|
19
|
+
if (reason !== "outside-press" && reason !== "focus-out")
|
|
20
|
+
anchor?.focus({ preventScroll: true });
|
|
21
|
+
};
|
|
22
|
+
const focusSearch = useCallback((el) => el?.focus({ preventScroll: true }), []);
|
|
23
|
+
return (_jsxs(_Fragment, { children: [_jsxs("button", { ref: setAnchor, type: "button", "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => (open ? close() : setOpen(true)), className: cx("flex h-full w-(--vk-tail-w) min-w-0 max-w-full flex-none items-center gap-1.5 px-(--vk-px) text-(length:--vk-head-text) hover:bg-(color:--vk-hovered)", open ? "bg-(color:--vk-pressed) text-(color:--vk-fg)" : "text-(color:--vk-fg-subtle)"), children: [_jsx(Add, { className: "h-(--vk-head-glyph) w-(--vk-head-glyph) shrink-0 opacity-70" }), _jsx("span", { className: "truncate", children: messages({ key: "views.grid.add-column" }) })] }), _jsx(Popover, { open: open, onOpenChange: (next, details) => (next ? setOpen(true) : close(details?.reason)), anchor: anchor, side: "bottom", align: "end", sideOffset: 4, chrome: "menu", initialFocus: false, className: "flex w-60 flex-col", onOutsidePress: (event) => (anchor?.contains(event.target) ? false : undefined), children: _jsxs(Command.Root, { shouldFilter: false, loop: true, label: messages({ key: "views.menus.add-column-search" }), children: [_jsx("div", { className: "flex h-10 shrink-0 items-center border-b border-(color:--vk-border)", children: _jsx(Command.Input, { chrome: "bare", value: query, onValueChange: setQuery, placeholder: messages({ key: "views.menus.add-column-search" }), ref: focusSearch, className: "h-full min-w-0 flex-1 bg-transparent px-3.5 text-base text-(color:--vk-fg) outline-hidden placeholder:text-(color:--vk-fg-subtlest) md:text-sm" }) }), _jsx(Command.List, { className: "max-h-80 min-h-0 overflow-y-auto overscroll-contain", children: _jsx(Command.Group, { className: "p-0", children: _jsxs(List, { children: [rows.map((item) => (_jsx(Command.Item, { value: item.id, onSelect: () => {
|
|
24
|
+
columns.onToggleHidden(item.id, false);
|
|
25
|
+
close("item-press");
|
|
26
|
+
}, children: _jsx(RowContent, { label: item.label, leading: _jsx("span", { className: "flex size-4 shrink-0 items-center justify-center text-(color:--vk-fg-subtle)", children: item.icon }) }) }, item.id))), rows.length === 0 && (_jsx("p", { className: "px-2 py-2 text-sm text-(color:--vk-fg-subtle)", children: wanted
|
|
27
|
+
? messages({ key: "views.menus.add-column-no-match", values: { query: query.trim() } })
|
|
28
|
+
: messages({ key: "views.menus.add-column-all-shown" }) }))] }) }) })] }) })] }));
|
|
29
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type MouseEvent as ReactMouseEvent, type ReactElement, type Ref } from "react";
|
|
2
|
+
import type { ListAggregateKind, ListColumn } from "../../model/column-schema.js";
|
|
3
|
+
/** What the menu sets on the footer cell it opens from. */
|
|
4
|
+
type TriggerProps = {
|
|
5
|
+
ref?: Ref<HTMLElement>;
|
|
6
|
+
onClick?: (event: ReactMouseEvent<HTMLElement>) => void;
|
|
7
|
+
role?: "button";
|
|
8
|
+
"aria-haspopup"?: "dialog";
|
|
9
|
+
"aria-expanded"?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The footer cell's Calculate popover — pick the aggregate function for one
|
|
13
|
+
* column (numeric columns get sum/avg/min/max/count; everything else
|
|
14
|
+
* count/filled/unique; a source list's footer offers what the database answers,
|
|
15
|
+
* handed in as `options`). The trigger is the WHOLE footer cell, passed as the
|
|
16
|
+
* child: the map's popover anchors on it, in its slot; selection commits
|
|
17
|
+
* through the host's persisted `gridAggregates` pref.
|
|
18
|
+
*/
|
|
19
|
+
export declare function GridAggregateMenu<Row>({ column, options, current, onChange, align, children, }: {
|
|
20
|
+
column: ListColumn<Row>;
|
|
21
|
+
/** The picks to offer — a source list's footer offers what the database
|
|
22
|
+
* answers (`aggregateOptions(column, sourced)`). Default: the column's own. */
|
|
23
|
+
options?: ListAggregateKind[];
|
|
24
|
+
current: ListAggregateKind;
|
|
25
|
+
onChange: (kind: ListAggregateKind) => void;
|
|
26
|
+
/** Match the column's alignment so the popover hugs the value. */
|
|
27
|
+
align: "start" | "center" | "end";
|
|
28
|
+
/** The footer cell. The menu sets its `ref`, so it must carry none of its own. */
|
|
29
|
+
children: ReactElement<TriggerProps>;
|
|
30
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cloneElement, useState, } from "react";
|
|
4
|
+
import { aggregateLabel, aggregateOptions } from "../../model/aggregates.js";
|
|
5
|
+
import { useViews } from "../../provider/context.js";
|
|
6
|
+
export function GridAggregateMenu({ column, options, current, onChange, align, children, }) {
|
|
7
|
+
const [open, setOpen] = useState(false);
|
|
8
|
+
const [anchor, setAnchor] = useState(null);
|
|
9
|
+
const { atoms, components, messages } = useViews();
|
|
10
|
+
const { Popover } = components;
|
|
11
|
+
const { List, Row } = atoms;
|
|
12
|
+
const trigger = cloneElement(children, {
|
|
13
|
+
ref: setAnchor,
|
|
14
|
+
onClick: (event) => {
|
|
15
|
+
children.props.onClick?.(event);
|
|
16
|
+
setOpen((was) => !was);
|
|
17
|
+
},
|
|
18
|
+
role: "button",
|
|
19
|
+
"aria-haspopup": "dialog",
|
|
20
|
+
"aria-expanded": open,
|
|
21
|
+
});
|
|
22
|
+
return (_jsxs(_Fragment, { children: [trigger, _jsx(Popover, { open: open, onOpenChange: setOpen, anchor: anchor, side: "bottom", align: align, sideOffset: 4, chrome: "menu", panelData: { "data-slot": "vk-grid-aggregate-menu" }, className: "w-40", onOutsidePress: (event) => (anchor?.contains(event.target) ? false : undefined), children: _jsx(List, { children: (options ?? aggregateOptions(column)).map((kind) => (_jsx(Row, { chosen: kind === current, label: aggregateLabel(kind, messages), onClick: () => {
|
|
23
|
+
setOpen(false);
|
|
24
|
+
if (kind !== current)
|
|
25
|
+
onChange(kind);
|
|
26
|
+
} }, kind))) }) })] }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { GridEditorId } from "../../model/column-types.js";
|
|
3
|
+
import type { ListColumn, ListSelectColor } from "../../model/column-schema.js";
|
|
4
|
+
/** Everything an editor needs about the cell it is mounting into. */
|
|
5
|
+
export type GridCellEditorContext<Row> = {
|
|
6
|
+
row: Row;
|
|
7
|
+
rowId: string;
|
|
8
|
+
col: ListColumn<Row>;
|
|
9
|
+
editorKind: GridEditorId | null;
|
|
10
|
+
/** The cell opened to be READ, not written: a long text the column, the
|
|
11
|
+
* workspace or the list will not let this user edit. The panel shows the
|
|
12
|
+
* value read-only and never commits. */
|
|
13
|
+
readOnly: boolean;
|
|
14
|
+
/** The value the editor opens on — pending overlay applied. */
|
|
15
|
+
baseline: unknown;
|
|
16
|
+
/** Type-to-replace seed: the character that opened this editor, or null. */
|
|
17
|
+
editSeed?: string | null;
|
|
18
|
+
decimals?: number;
|
|
19
|
+
selectValues?: string[];
|
|
20
|
+
optionColors?: Record<string, ListSelectColor>;
|
|
21
|
+
/** This app's glyph for an entity kind — the relation picker dresses its
|
|
22
|
+
* candidates with it, so a row in the list carries the same icon the cell
|
|
23
|
+
* will show once it is picked. */
|
|
24
|
+
entityIcon?: (kind: string | undefined) => ReactNode;
|
|
25
|
+
onCommitCell: (row: Row, rowId: string, columnId: string, prev: unknown, next: unknown, opts?: {
|
|
26
|
+
overlay?: boolean;
|
|
27
|
+
}) => void;
|
|
28
|
+
onCancel: () => void;
|
|
29
|
+
onTab: (backwards: boolean) => void;
|
|
30
|
+
onEnter: () => void;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The INLINE editors — the ones that replace the cell's own content while open.
|
|
34
|
+
*
|
|
35
|
+
* Returns null for every other case so the caller can fall through to the
|
|
36
|
+
* cell's normal render. In particular `text` is matched explicitly, never as a
|
|
37
|
+
* bare else: it is the last arm of the chain, and an unguarded fallback would
|
|
38
|
+
* mount a text input on top of an open picker, and on any editor-less type that
|
|
39
|
+
* ever reaches `editing`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function GridCellInlineEditor<Row>({ ctx }: {
|
|
42
|
+
ctx: GridCellEditorContext<Row>;
|
|
43
|
+
}): ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* The ANCHORED editors (select popover, date calendar). They hang off the END
|
|
46
|
+
* of the cell rather than wrapping its value, because the value has to keep its
|
|
47
|
+
* DOM NODE across the editing boundary.
|
|
48
|
+
*
|
|
49
|
+
* Both leave the cell's own content on screen behind an anchored overlay, so
|
|
50
|
+
* the natural shape is `<>{value}{editor}</>` while editing and a bare
|
|
51
|
+
* `{value}` otherwise. Those are different element types at the same position:
|
|
52
|
+
* React tears the value's node down on every commit and mounts a fresh one
|
|
53
|
+
* already showing the new value — so `transition-colors` on a status/category
|
|
54
|
+
* badge has no "from" state and the change SNAPS instead of fading. (The batch
|
|
55
|
+
* path never enters an editor, which is why it always faded.) Rendered as a
|
|
56
|
+
* sibling, the value's branch is identical whether or not the cell is editing,
|
|
57
|
+
* the node survives, and the commit is a plain className change it can animate.
|
|
58
|
+
*
|
|
59
|
+
* Position is free: both are absolutely-anchored and portal their content, so
|
|
60
|
+
* they contribute no layout. Do not "tidy" them back into the inline chain.
|
|
61
|
+
*/
|
|
62
|
+
export declare function GridCellAnchoredEditor<Row>({ ctx, }: {
|
|
63
|
+
ctx: GridCellEditorContext<Row>;
|
|
64
|
+
}): ReactNode;
|