@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,178 @@
|
|
|
1
|
+
import type { ComponentType, MouseEventHandler, ReactElement, ReactNode } from "react";
|
|
2
|
+
import type { LinkPlatform, RelationValue } from "@viewkitjs/fields";
|
|
3
|
+
import type { CategoryColor } from "@viewkitjs/fields/design/category-colors";
|
|
4
|
+
import type { StatusSlot } from "@viewkitjs/fields/design/status-slots";
|
|
5
|
+
import type { FieldRowMenuItem } from "../fields/menus.js";
|
|
6
|
+
/** A row's inside. Inside a command list's item it is all the row is: the item owns
|
|
7
|
+
* the element, the highlight and the keyboard. */
|
|
8
|
+
export type ViewsRowContentProps = {
|
|
9
|
+
/** Text truncates to one line; any other node (a badge, a link) is laid out in a row so it centres. */
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
/** A second line under the label. */
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
/** A glyph before the label. */
|
|
14
|
+
leading?: ReactNode;
|
|
15
|
+
/** Keep the leading lane's width with no glyph in it, so rows with and without one align. */
|
|
16
|
+
leadingLane?: boolean;
|
|
17
|
+
/** After the label, before the chosen check. */
|
|
18
|
+
trailing?: ReactNode;
|
|
19
|
+
/** What the row says at its right edge, in the subtle colour: a setting's current choice, or a live sample. A chosen
|
|
20
|
+
* row draws it in the brand colour and no check, so a column of samples stays in line. */
|
|
21
|
+
detail?: ReactNode;
|
|
22
|
+
/** The value this row stands for is the current one: a trailing check. */
|
|
23
|
+
chosen?: boolean;
|
|
24
|
+
/** A chosen row also takes the chosen colour. Default true; a row whose label is a badge keeps its own. */
|
|
25
|
+
chosenTint?: boolean;
|
|
26
|
+
/** `muted` for a row that offers rather than lists (none, create, add). */
|
|
27
|
+
tone?: "default" | "muted";
|
|
28
|
+
/** `compact` draws the label at 13px — a command list's row, a list of values; `regular`
|
|
29
|
+
* (default) at the app's menu size. */
|
|
30
|
+
size?: "compact" | "regular";
|
|
31
|
+
/** Break a long label instead of truncating it — a list that exists to make values readable. */
|
|
32
|
+
wrap?: boolean;
|
|
33
|
+
className?: string;
|
|
34
|
+
};
|
|
35
|
+
/** A whole row: a button, or with `interactive={false}` a static line. */
|
|
36
|
+
export type ViewsRowProps = ViewsRowContentProps & {
|
|
37
|
+
onClick?: () => void;
|
|
38
|
+
/** For a row inside an editor that must keep its input focused. */
|
|
39
|
+
onMouseDown?: MouseEventHandler<HTMLButtonElement>;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
/** Default true. False draws a line that is read, not pressed. */
|
|
42
|
+
interactive?: boolean;
|
|
43
|
+
/** The row opens a flyout beside its menu, a dialog: `aria-haspopup="dialog"`, and `aria-expanded` from `open`. */
|
|
44
|
+
opens?: boolean;
|
|
45
|
+
/** The flyout this row opens is up now: `aria-expanded`, `data-open` and the pressed ground. */
|
|
46
|
+
open?: boolean;
|
|
47
|
+
title?: string;
|
|
48
|
+
/** A role for a row that is not a plain button (an option, a tab); `aria-selected` rides only with one. */
|
|
49
|
+
role?: string;
|
|
50
|
+
"aria-selected"?: boolean;
|
|
51
|
+
};
|
|
52
|
+
/** A paint-only tick box: the control around it is the caller's. */
|
|
53
|
+
export type ViewsTickBoxProps = {
|
|
54
|
+
checked: boolean;
|
|
55
|
+
className?: string;
|
|
56
|
+
};
|
|
57
|
+
/** The rows' container: the inset a run of rows sits in, inside a panel or a command group. */
|
|
58
|
+
export type ViewsListProps = {
|
|
59
|
+
children: ReactNode;
|
|
60
|
+
className?: string;
|
|
61
|
+
};
|
|
62
|
+
export type ViewsStatusBadgeProps = {
|
|
63
|
+
slot: StatusSlot;
|
|
64
|
+
label: ReactNode;
|
|
65
|
+
/** Replaces the slot's own mark. */
|
|
66
|
+
leading?: ReactNode;
|
|
67
|
+
title?: string;
|
|
68
|
+
/** Default `compact` (11px), the size a status value is drawn at in a cell. */
|
|
69
|
+
size?: "compact" | "regular";
|
|
70
|
+
className?: string;
|
|
71
|
+
};
|
|
72
|
+
export type ViewsStatusMarkerProps = {
|
|
73
|
+
/** Default `warning`: a marker is attention. */
|
|
74
|
+
slot?: StatusSlot;
|
|
75
|
+
label: string;
|
|
76
|
+
/** The panel's heading and the marker's accessible name. */
|
|
77
|
+
title: string;
|
|
78
|
+
reason?: string | null;
|
|
79
|
+
/** Shown when there is no reason; defaults to the package's wording. */
|
|
80
|
+
emptyReason?: string;
|
|
81
|
+
/** Absent: a read-only marker. */
|
|
82
|
+
onResolve?: () => void;
|
|
83
|
+
resolveLabel?: string;
|
|
84
|
+
};
|
|
85
|
+
export type ViewsTagProps = {
|
|
86
|
+
label: string;
|
|
87
|
+
color: CategoryColor;
|
|
88
|
+
/** A glyph before the label — an option's icon, drawn by the app's AppIcon. */
|
|
89
|
+
leading?: ReactNode;
|
|
90
|
+
/** Draws a remove control inside the tag. */
|
|
91
|
+
onRemove?: () => void;
|
|
92
|
+
/** The remove control's accessible name; defaults to the package's wording. */
|
|
93
|
+
removeLabel?: string;
|
|
94
|
+
className?: string;
|
|
95
|
+
};
|
|
96
|
+
/** A `command` cell's verb menu: the host's verbs, opened from the trigger the cell drew. The
|
|
97
|
+
* default is the app's menu primitive (the components map's `Menu`); an app swaps in its own
|
|
98
|
+
* action menu. */
|
|
99
|
+
export type ViewsCommandMenuProps = {
|
|
100
|
+
/** What opens the menu — the cell draws it, a button. */
|
|
101
|
+
trigger: ReactElement;
|
|
102
|
+
items: readonly FieldRowMenuItem[];
|
|
103
|
+
align?: "start" | "center" | "end";
|
|
104
|
+
};
|
|
105
|
+
/** Where a relation chip goes: the app's own link around the chip the display drew. The default
|
|
106
|
+
* goes nowhere — a relation is a fact as often as a destination. */
|
|
107
|
+
export type ViewsRelationLinkProps = {
|
|
108
|
+
relation: RelationValue;
|
|
109
|
+
children: ReactNode;
|
|
110
|
+
};
|
|
111
|
+
/** A wait: the whole list reloading (`body`), or more rows arriving (`footer`). The default is a
|
|
112
|
+
* plain ring; an app swaps in its own loader. */
|
|
113
|
+
export type ViewsLoadingProps = {
|
|
114
|
+
placement: "body" | "footer";
|
|
115
|
+
label: string;
|
|
116
|
+
};
|
|
117
|
+
/** How a list asks for its next page once its end comes near. The default watches a sentinel past
|
|
118
|
+
* the last row and draws `Loading` (or the host's words) while it waits; an app swaps in its own —
|
|
119
|
+
* a button, a different distance. */
|
|
120
|
+
export type ViewsLoadMoreProps = {
|
|
121
|
+
onReveal: () => void;
|
|
122
|
+
label?: string;
|
|
123
|
+
};
|
|
124
|
+
/** A link's platform, drawn before the link (`linkPlatform`): its key says which, its name what to call it.
|
|
125
|
+
* The default draws nothing, so a link looks plain; an app swaps in its own marks. */
|
|
126
|
+
export type ViewsPlatformMarkProps = {
|
|
127
|
+
platform: LinkPlatform;
|
|
128
|
+
className?: string;
|
|
129
|
+
};
|
|
130
|
+
/** One row of the row's menu: a rule, or a labelled row with its click. The shape a host's own row-menu
|
|
131
|
+
* items already have, so a host hands its list through unchanged. */
|
|
132
|
+
export type ViewsRowMenuItem = {
|
|
133
|
+
separator: true;
|
|
134
|
+
} | {
|
|
135
|
+
separator?: false;
|
|
136
|
+
label: string;
|
|
137
|
+
icon?: ReactNode;
|
|
138
|
+
onClick: () => void;
|
|
139
|
+
destructive?: boolean;
|
|
140
|
+
disabled?: boolean;
|
|
141
|
+
/** A keyboard hint drawn at the row's end, never bound by the menu. */
|
|
142
|
+
shortcut?: string;
|
|
143
|
+
};
|
|
144
|
+
/** The row's right-click menu, around the row it opens on. The rendering builds `items` (the cell's
|
|
145
|
+
* clipboard rows, Select, the host's verbs); the menu adds the page link before them and Delete after.
|
|
146
|
+
* The default is the components map's `Menu` at the pointer, its Delete asking the confirm port; an
|
|
147
|
+
* app swaps in its own (a long-press that selects). */
|
|
148
|
+
export type ViewsRowMenuProps = {
|
|
149
|
+
/** The row: right-click on it, or the row's ⋯, opens the menu. */
|
|
150
|
+
children: ReactNode;
|
|
151
|
+
/** The row's data id: what `onDelete` is called with. */
|
|
152
|
+
rowId: string;
|
|
153
|
+
items: readonly ViewsRowMenuItem[];
|
|
154
|
+
/** The row's own page, opened in a new tab. Absent: no Open page row. */
|
|
155
|
+
openHref?: string;
|
|
156
|
+
/** Absent: no Delete row. */
|
|
157
|
+
onDelete?: (rowId: string) => Promise<void>;
|
|
158
|
+
/** What Delete removes, handed to the confirm port as its `subject`. */
|
|
159
|
+
deleteLabel?: string;
|
|
160
|
+
/** Flips the row's selection, for an app whose long-press selects. Absent when the list can't select.
|
|
161
|
+
* The default doesn't use it: on a phone the ⋯ is the way in. */
|
|
162
|
+
onToggleSelect?: () => void;
|
|
163
|
+
};
|
|
164
|
+
export type ViewsAtoms = {
|
|
165
|
+
List: ComponentType<ViewsListProps>;
|
|
166
|
+
Row: ComponentType<ViewsRowProps>;
|
|
167
|
+
RowContent: ComponentType<ViewsRowContentProps>;
|
|
168
|
+
TickBox: ComponentType<ViewsTickBoxProps>;
|
|
169
|
+
StatusBadge: ComponentType<ViewsStatusBadgeProps>;
|
|
170
|
+
StatusMarker: ComponentType<ViewsStatusMarkerProps>;
|
|
171
|
+
Tag: ComponentType<ViewsTagProps>;
|
|
172
|
+
CommandMenu: ComponentType<ViewsCommandMenuProps>;
|
|
173
|
+
RelationLink: ComponentType<ViewsRelationLinkProps>;
|
|
174
|
+
Loading: ComponentType<ViewsLoadingProps>;
|
|
175
|
+
LoadMore: ComponentType<ViewsLoadMoreProps>;
|
|
176
|
+
PlatformMark: ComponentType<ViewsPlatformMarkProps>;
|
|
177
|
+
RowMenu: ComponentType<ViewsRowMenuProps>;
|
|
178
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { PercentDisplay } from "@viewkitjs/fields";
|
|
3
|
+
import type { FieldPresentation, FieldViewerContext } from "../display/options.js";
|
|
4
|
+
import type { FieldRowMenuItem } from "../fields/menus.js";
|
|
5
|
+
import type { ListColumn, ListRelationValue, ListSelectColor } from "../model/column-schema.js";
|
|
6
|
+
import type { ListDateStyle, ListDurationStyle } from "../model/column-format.js";
|
|
7
|
+
/**
|
|
8
|
+
* COLUMN-SHAPED FORMATTING — the two string formatters that still take a column,
|
|
9
|
+
* and the per-row currency only this layer can resolve.
|
|
10
|
+
*
|
|
11
|
+
* The formatting itself is the display's (`../display/format.ts`), which turns a VALUE
|
|
12
|
+
* plus a field's `format` block into a string. These two stay because three
|
|
13
|
+
* consumers hold a column rather than a field — the footer aggregates
|
|
14
|
+
* (`GridFooter`) and the column menu's two live format previews
|
|
15
|
+
* (`GridColumnDateSection`, `GridColumnDurationSection`) — and asking each of
|
|
16
|
+
* them to synthesize a def would put the same translation in three places.
|
|
17
|
+
*
|
|
18
|
+
* The viewer is the caller's: these never read the runtime's locale or zone, nor any
|
|
19
|
+
* app's state. The grid's callers hand the provider's through `useCellFormat()`.
|
|
20
|
+
*/
|
|
21
|
+
/** Per-column render context threaded from GridTable (user overrides). */
|
|
22
|
+
export type GridCellOptions = {
|
|
23
|
+
presentation?: FieldPresentation;
|
|
24
|
+
viewer?: FieldViewerContext;
|
|
25
|
+
optionColors?: Record<string, ListSelectColor>;
|
|
26
|
+
dateStyle?: ListDateStyle;
|
|
27
|
+
durationStyle?: ListDurationStyle;
|
|
28
|
+
/** Number columns: the workspace's decimals override (header menu) — wins
|
|
29
|
+
* over the column's declared `format`. */
|
|
30
|
+
decimals?: number;
|
|
31
|
+
/** The code a value is drawn in when the CALLER knows it and the column's
|
|
32
|
+
* format does not — a per-row column's row code (`resolveRowCurrency`), a
|
|
33
|
+
* total's currency. Never a reader override: a reading lives on the column. */
|
|
34
|
+
currency?: string;
|
|
35
|
+
/** Date columns: per-user show-time override — wins over `format.withTime`. */
|
|
36
|
+
withTime?: boolean;
|
|
37
|
+
/** Percent columns: the workspace's display — wins over `format.percentDisplay`. */
|
|
38
|
+
percentDisplay?: PercentDisplay;
|
|
39
|
+
/** Per-user "Wrap columns" toggle: text-bearing cells wrap instead of
|
|
40
|
+
* truncating. See `cellTextClass` in the display. */
|
|
41
|
+
wrap?: boolean;
|
|
42
|
+
/** Optimistic pending value (Tier 3) — wins over `accessor(row)` when defined.
|
|
43
|
+
* Only typed cells honor it; custom `render` columns show confirmed data. */
|
|
44
|
+
valueOverride?: unknown;
|
|
45
|
+
/** `marker` booleans: the row's reason sentence (from `col.marker.reason`). */
|
|
46
|
+
markerReason?: string | null;
|
|
47
|
+
/**
|
|
48
|
+
* `marker` booleans: clear the exception. The only BEHAVIORAL entry in an
|
|
49
|
+
* otherwise display-only bag — deliberate. The alternative (rendering the
|
|
50
|
+
* marker from GridRow, the way editors are mounted) would split one type's
|
|
51
|
+
* rendering across two files to keep this one field out.
|
|
52
|
+
*/
|
|
53
|
+
onResolve?: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* Two-way (`checkbox` / `icon`) booleans: flip the value. The twin of
|
|
56
|
+
* `onResolve` — that one is hardcoded `true → false`, this one carries the
|
|
57
|
+
* value, which is what a two-way column needs. Its PRESENCE is also what
|
|
58
|
+
* makes the cell interactive: without it the boolean renders as a plain,
|
|
59
|
+
* unclickable glyph, so a read-only or settings-locked column can't be toggled.
|
|
60
|
+
*/
|
|
61
|
+
onToggle?: (next: boolean) => void;
|
|
62
|
+
/**
|
|
63
|
+
* `command` columns: the verbs this row offers INSTEAD of an editor, already
|
|
64
|
+
* resolved for the row (`FieldMenus<Row>[key](row)`). Behavioral, like the two
|
|
65
|
+
* above, and for the same reason it sits here rather than in the row chrome:
|
|
66
|
+
* the cell IS the trigger, so the menu is part of how the value is drawn. Its
|
|
67
|
+
* PRESENCE is the affordance — a command column whose host wired no verbs is
|
|
68
|
+
* a read-only badge, never an empty dropdown.
|
|
69
|
+
*/
|
|
70
|
+
commandItems?: readonly FieldRowMenuItem[];
|
|
71
|
+
/**
|
|
72
|
+
* `relation` cells: open the entity this row POINTS AT — which is a different
|
|
73
|
+
* entity from the one `onOpenRow` opens, and the reason this can't reuse the
|
|
74
|
+
* row's own handler.
|
|
75
|
+
*
|
|
76
|
+
* Takes the CLICKED value rather than nothing, because a one-to-many cell has
|
|
77
|
+
* several and the caller can't re-derive which one you pressed: reading the
|
|
78
|
+
* accessor again would only ever hand back the first.
|
|
79
|
+
*
|
|
80
|
+
* An OVERRIDE, not the affordance. A relation is clickable by default — the
|
|
81
|
+
* chip resolves its own destination from the entity kind (drawer if that kind
|
|
82
|
+
* has one, else its page, else inert). Pass this only for a list whose
|
|
83
|
+
* relations go somewhere the app-wide answer cannot know: an execution's
|
|
84
|
+
* `thread` lands in the inbox, and its pre-collapse `prospect` goes nowhere.
|
|
85
|
+
*
|
|
86
|
+
* It used to be the affordance, and that is the bug it caused: every renderer
|
|
87
|
+
* builds this bag by hand, so whether a relation was clickable depended on
|
|
88
|
+
* which VIEW you were looking at — grid chips worked, board cards were dead.
|
|
89
|
+
*/
|
|
90
|
+
onOpenRelation?: (value: ListRelationValue) => void;
|
|
91
|
+
/**
|
|
92
|
+
* `relation` cells: this app's glyph for an entity KIND.
|
|
93
|
+
*
|
|
94
|
+
* The portable chip has no entity registry of its own; Portal's list binding
|
|
95
|
+
* supplies this resolver by default, and another host can supply its own.
|
|
96
|
+
*/
|
|
97
|
+
entityIcon?: (kind: string | undefined) => ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* A host whose own slot already owns the click and the drag — a calendar
|
|
100
|
+
* event card, whose outer element (not any cell inside it) is the button.
|
|
101
|
+
* Every typed cell draws its bare content only: a relation is its icon and
|
|
102
|
+
* label with no anchor or button wrapper, an overflow count is plain text
|
|
103
|
+
* with no popover trigger, a two-way boolean shows its glyph with no toggle.
|
|
104
|
+
* Set once by the host, never per column — a card that nested one of these
|
|
105
|
+
* controls inside the slot's own button would be invalid markup.
|
|
106
|
+
*/
|
|
107
|
+
slotOwnsClick?: boolean;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Fold the code a money cell is drawn in into the render options, so the
|
|
111
|
+
* formatter keeps its plain string contract and only the RESOLUTION moves up
|
|
112
|
+
* here — this is the only layer that has the row.
|
|
113
|
+
*
|
|
114
|
+
* There is no reader override here any more. A reader's choice is a READING on
|
|
115
|
+
* the column (`readMoneyColumn`): a converted column arrives with its
|
|
116
|
+
* `format.currency` already set and no `currencyAccessor`, a column read in
|
|
117
|
+
* Original with the row's code and no `format.currency`. Both are stamped: the
|
|
118
|
+
* row's own code onto a row's own figure, the reading's code onto a figure the
|
|
119
|
+
* reading converted — never a code onto a number it does not describe.
|
|
120
|
+
*
|
|
121
|
+
* The reading's code has to travel this way because a registry field with a
|
|
122
|
+
* per-row code (`code: { field }`, Deals' Value) has no fixed code for the core
|
|
123
|
+
* to fall back on: only a field-less column's def is synthesized from
|
|
124
|
+
* `format.currency`. Left out, the formatter draws EUR over a RON figure
|
|
125
|
+
* (POR-602). `shownCodeOf` is the same answer a custom `render` cell is handed.
|
|
126
|
+
*/
|
|
127
|
+
export declare function resolveRowCurrency<Row>(col: ListColumn<Row>, row: Row, opts?: GridCellOptions): GridCellOptions | undefined;
|
|
128
|
+
/** A date column's value as text — the column's `dateStyle`/`withTime` with the
|
|
129
|
+
* user's overrides on top, handed to the one date formatter, in the caller's viewer. */
|
|
130
|
+
export declare function formatDate(value: unknown, col: ListColumn<never>, override: ListDateStyle | undefined, withTimeOverride: boolean | undefined, viewer: FieldViewerContext): string;
|
|
131
|
+
/** Exported for the footer aggregates — sum/avg/min/max print with the same
|
|
132
|
+
* format (currency, decimals, display-currency override) as the cells. The
|
|
133
|
+
* column's format is read in the display layer's wider vocabulary, so a legacy
|
|
134
|
+
* percent or currency column's total prints as its cells do. The viewer and the
|
|
135
|
+
* presentation are the caller's (`useCellFormat`). */
|
|
136
|
+
export declare function formatNumber(value: number, col: ListColumn<never>, opts: GridCellOptions & {
|
|
137
|
+
viewer: FieldViewerContext;
|
|
138
|
+
}): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { formatDateValue, formatNumberValue } from "../display/format.js";
|
|
2
|
+
import { shownCodeOf } from "../fields/money.js";
|
|
3
|
+
import { temporalKindOf } from "../model/field-type-of.js";
|
|
4
|
+
import { legacyNumberLikeFormat } from "./legacy-field.js";
|
|
5
|
+
export function resolveRowCurrency(col, row, opts) {
|
|
6
|
+
if (col.currencyAccessor)
|
|
7
|
+
return { ...opts, currency: col.currencyAccessor(row) };
|
|
8
|
+
const code = shownCodeOf(col, row);
|
|
9
|
+
return code ? { ...opts, currency: code } : opts;
|
|
10
|
+
}
|
|
11
|
+
export function formatDate(value, col, override, withTimeOverride, viewer) {
|
|
12
|
+
return formatDateValue(value, override ?? col.format?.dateStyle, withTimeOverride ?? col.format?.withTime, temporalKindOf(col), { viewer });
|
|
13
|
+
}
|
|
14
|
+
export function formatNumber(value, col, opts) {
|
|
15
|
+
return formatNumberValue(value, legacyNumberLikeFormat(col), opts);
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { GridCellOptions } from "./cell-format.js";
|
|
3
|
+
import type { ListColumn } from "../model/column-schema.js";
|
|
4
|
+
/**
|
|
5
|
+
* THE TITLE CELL — the one typed cell the list owns, not a field.
|
|
6
|
+
*
|
|
7
|
+
* `title` is a column ROLE, not a storage type: the value it draws is text (or
|
|
8
|
+
* a number, or a date), and what makes the cell a title is that clicking it
|
|
9
|
+
* OPENS THE ROW. That is a fact about the list, not about the value, so this
|
|
10
|
+
* arm stays here; its content arrives drawn — text as itself, a figure or a
|
|
11
|
+
* moment through its field's core (`cell-values.tsx`).
|
|
12
|
+
*
|
|
13
|
+
* It also places its own `indicator`, which is why `renderTypedCell` skips its
|
|
14
|
+
* generic indicator lane for this type: the adornment has to sit inside the
|
|
15
|
+
* cell's own layout rules about where the click target ends.
|
|
16
|
+
*/
|
|
17
|
+
export declare function renderTitleCell<Row>(col: ListColumn<Row>, row: Row, content: ReactNode, opts?: GridCellOptions): ReactNode;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cellTextClass } from "../display/text-class.js";
|
|
4
|
+
import { cx } from "../internal/cx.js";
|
|
5
|
+
export function renderTitleCell(col, row, content, opts) {
|
|
6
|
+
const indicator = col.indicator?.(row);
|
|
7
|
+
return (_jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: [_jsx("span", { "data-cell-open": true, className: cx("min-w-0 cursor-pointer font-medium text-(color:--vk-fg)", cellTextClass(opts?.wrap)), children: content }), indicator] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ListColumn } from "../model/column-schema.js";
|
|
3
|
+
import { type GridCellOptions } from "./cell-format.js";
|
|
4
|
+
/**
|
|
5
|
+
* THE ADAPTER — a column, its row, and the user's overrides, handed to the
|
|
6
|
+
* shared display cores.
|
|
7
|
+
*
|
|
8
|
+
* This file used to BE the renderer: one exhaustive switch, one house treatment
|
|
9
|
+
* per column type. Every one of those treatments now lives in
|
|
10
|
+
* the display, keyed by STORAGE type rather than by column type, so
|
|
11
|
+
* the grid, the board, the calendar and (next) the detail panel draw a value
|
|
12
|
+
* the same way instead of four times. What is left here is the translation, and
|
|
13
|
+
* it is only three sentences long:
|
|
14
|
+
*
|
|
15
|
+
* 1. the value — the pending override, else the column's accessor;
|
|
16
|
+
* 2. the field — the module's registry def, else one synthesized from the
|
|
17
|
+
* column (`legacyFieldFromColumn`);
|
|
18
|
+
* 3. the options — what a field cannot know, which is everything the ROW and
|
|
19
|
+
* the USER contribute.
|
|
20
|
+
*
|
|
21
|
+
* `title` is a column ROLE, not a storage type (see `cell-title.tsx`): its cell
|
|
22
|
+
* is the list's, and only a figure's or a moment's identity reaches a core for
|
|
23
|
+
* its content (`identityContent`).
|
|
24
|
+
*/
|
|
25
|
+
export declare function renderTypedCellValue<Row>(col: ListColumn<Row>, row: Row, opts?: GridCellOptions): ReactNode;
|
|
26
|
+
/** An identity's value without the title cell — for a host that draws the name in its own chrome
|
|
27
|
+
* (the rows look's phone card). Empty draws nothing, as every typed cell does. */
|
|
28
|
+
export declare function renderIdentityValue<Row>(col: ListColumn<Row>, row: Row, opts?: GridCellOptions): ReactNode;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { valueTypeOf } from "@viewkitjs/fields";
|
|
4
|
+
import { renderFieldValue } from "../display/display-cores.js";
|
|
5
|
+
import { columnLabel } from "../model/column-capabilities.js";
|
|
6
|
+
import { prettifyOptionValue } from "../model/column-state.js";
|
|
7
|
+
import { useViews } from "../provider/context.js";
|
|
8
|
+
import { renderTitleCell } from "./cell-title.js";
|
|
9
|
+
import { resolveRowCurrency } from "./cell-format.js";
|
|
10
|
+
import { legacyFieldFromColumn } from "./legacy-field.js";
|
|
11
|
+
import { listRelationWrap } from "./relation-wrap.js";
|
|
12
|
+
export function renderTypedCellValue(col, row, opts) {
|
|
13
|
+
const value = opts?.valueOverride !== undefined ? opts.valueOverride : col.accessor?.(row);
|
|
14
|
+
if (col.type !== "boolean" &&
|
|
15
|
+
!hasNameFallback(col, row) &&
|
|
16
|
+
(value == null || value === "" || (Array.isArray(value) && value.length === 0))) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
if (!col.type)
|
|
20
|
+
return null;
|
|
21
|
+
if (col.type === "title")
|
|
22
|
+
return renderTitleCell(col, row, identityContent(col, row, value, opts), opts);
|
|
23
|
+
const field = col.field ?? legacyFieldFromColumn(col);
|
|
24
|
+
const cell = renderFieldValue(field, value, displayOptionsFor(col, row, opts));
|
|
25
|
+
if (col.command && opts?.commandItems?.length) {
|
|
26
|
+
return _jsx(CommandCell, { col: col, cell: cell, items: opts.commandItems });
|
|
27
|
+
}
|
|
28
|
+
return cell;
|
|
29
|
+
}
|
|
30
|
+
const TITLE_THROUGH_CORE = new Set(["number", "percent", "currency", "date", "datetime", "name"]);
|
|
31
|
+
function identityContent(col, row, value, opts) {
|
|
32
|
+
return col.field && TITLE_THROUGH_CORE.has(valueTypeOf(col.field))
|
|
33
|
+
? renderFieldValue(col.field, value, displayOptionsFor(col, row, opts))
|
|
34
|
+
: String(value);
|
|
35
|
+
}
|
|
36
|
+
export function renderIdentityValue(col, row, opts) {
|
|
37
|
+
const value = opts?.valueOverride !== undefined ? opts.valueOverride : col.accessor?.(row);
|
|
38
|
+
if ((value == null || value === "") && !hasNameFallback(col, row))
|
|
39
|
+
return null;
|
|
40
|
+
return identityContent(col, row, value, opts);
|
|
41
|
+
}
|
|
42
|
+
function hasNameFallback(col, row) {
|
|
43
|
+
return !!col.field && valueTypeOf(col.field) === "name" && !!col.nameFallback?.(row);
|
|
44
|
+
}
|
|
45
|
+
const CONTROL_VALUES = new Set([
|
|
46
|
+
"relation",
|
|
47
|
+
"user",
|
|
48
|
+
"url",
|
|
49
|
+
"email",
|
|
50
|
+
"phone",
|
|
51
|
+
"domain",
|
|
52
|
+
]);
|
|
53
|
+
function CommandCell({ col, cell, items, }) {
|
|
54
|
+
const { atoms, icons } = useViews();
|
|
55
|
+
const { CommandMenu } = atoms;
|
|
56
|
+
const Chevron = icons.chevronDown;
|
|
57
|
+
const verbs = items.map((item) => ({ ...item }));
|
|
58
|
+
if (CONTROL_VALUES.has(col.type)) {
|
|
59
|
+
return (_jsxs("span", { className: "flex min-w-0 items-center gap-1", children: [cell, _jsx(CommandMenu, { items: verbs, align: "start", trigger: _jsx("button", { type: "button", "aria-label": columnLabel(col), className: "shrink-0 -m-1 p-1", children: _jsx(Chevron, { className: "h-3 w-3 opacity-60" }) }) })] }));
|
|
60
|
+
}
|
|
61
|
+
return (_jsx(CommandMenu, { items: verbs, align: "start", trigger: _jsxs("button", { type: "button", "aria-label": columnLabel(col), className: "flex min-w-0 items-center gap-1 text-left", children: [cell, _jsx(Chevron, { className: "h-3 w-3 opacity-60" })] }) }));
|
|
62
|
+
}
|
|
63
|
+
function displayOptionsFor(col, row, opts) {
|
|
64
|
+
const resolved = resolveRowCurrency(col, row, opts);
|
|
65
|
+
return {
|
|
66
|
+
presentation: opts?.presentation,
|
|
67
|
+
viewer: opts?.viewer,
|
|
68
|
+
optionColors: opts?.optionColors,
|
|
69
|
+
labelFallback: col.field ? undefined : prettifyOptionValue,
|
|
70
|
+
dateStyle: opts?.dateStyle,
|
|
71
|
+
durationStyle: opts?.durationStyle,
|
|
72
|
+
decimals: opts?.decimals,
|
|
73
|
+
currency: resolved?.currency,
|
|
74
|
+
nameFallback: col.nameFallback?.(row) ?? undefined,
|
|
75
|
+
withTime: opts?.withTime,
|
|
76
|
+
percentDisplay: opts?.percentDisplay,
|
|
77
|
+
wrap: opts?.wrap,
|
|
78
|
+
booleanIcon: col.format?.icon,
|
|
79
|
+
marker: col.marker,
|
|
80
|
+
markerReason: opts?.markerReason,
|
|
81
|
+
onResolve: opts?.onResolve,
|
|
82
|
+
onToggle: opts?.onToggle,
|
|
83
|
+
entityIcon: opts?.entityIcon,
|
|
84
|
+
slotOwnsClick: opts?.slotOwnsClick,
|
|
85
|
+
relationWrap: listRelationWrap(opts),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { renderIdentityValue, renderTypedCellValue } from "./cell-values.js";
|
|
2
|
+
export { formatDate, formatNumber, resolveRowCurrency, type GridCellOptions } from "./cell-format.js";
|
|
3
|
+
export { useCellFormat } from "./use-cell-format.js";
|
|
4
|
+
export { legacyFieldFromColumn, legacyNumberLikeFormat } from "./legacy-field.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { renderIdentityValue, renderTypedCellValue } from "./cell-values.js";
|
|
2
|
+
export { formatDate, formatNumber, resolveRowCurrency } from "./cell-format.js";
|
|
3
|
+
export { useCellFormat } from "./use-cell-format.js";
|
|
4
|
+
export { legacyFieldFromColumn, legacyNumberLikeFormat } from "./legacy-field.js";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type CurrencyFormat, type FieldDef, type NumberFormat } from "@viewkitjs/fields";
|
|
2
|
+
import type { NumberLikeFormat } from "../display/options.js";
|
|
3
|
+
import type { ListColumn } from "../model/column-schema.js";
|
|
4
|
+
import type { ListColumnFormat } from "../model/column-format.js";
|
|
5
|
+
/**
|
|
6
|
+
* A COLUMN THAT PREDATES THE REGISTRY, READ AS A FIELD.
|
|
7
|
+
*
|
|
8
|
+
* `columnFrom` turns a field into a column; this is the other direction, for the
|
|
9
|
+
* hundreds of columns no module has bound yet. It exists so there is ONE
|
|
10
|
+
* rendering path rather than two: the adapter hands every column a `FieldDef`,
|
|
11
|
+
* and the display cores read the value's type, vocabulary and format off that
|
|
12
|
+
* def whether a registry wrote it or this file did.
|
|
13
|
+
*
|
|
14
|
+
* DISPLAY ONLY. The synthesized def carries what a core reads and nothing else —
|
|
15
|
+
* no write policy, no validation, no `normalize`. A column's editability is
|
|
16
|
+
* still the column's own answer (`gridColumnHasEditor`), because a def invented
|
|
17
|
+
* here has no binding behind it and nothing to commit through.
|
|
18
|
+
*
|
|
19
|
+
* The mapping is the IDENTITY on the type: `ListColumnType` is the value-type
|
|
20
|
+
* vocabulary plus the one role, so every arm below returns the def of the same
|
|
21
|
+
* name. The bridge's job is filling what a field REQUIRES and a column never
|
|
22
|
+
* had to declare — a label, a status option's slot, a select's empty
|
|
23
|
+
* vocabulary, a currency's code. The one arm that cannot be symmetric:
|
|
24
|
+
* - `title` throws. It is a column ROLE (this cell opens the row), not a
|
|
25
|
+
* storage type, so the list keeps drawing it and never asks for a def.
|
|
26
|
+
*/
|
|
27
|
+
export declare function legacyFieldFromColumn<Row>(col: ListColumn<Row>): FieldDef;
|
|
28
|
+
/**
|
|
29
|
+
* A NUMBER field's format — plain or duration. Percent and currency are types,
|
|
30
|
+
* so they leave through `legacyFieldFromColumn`'s own arms and never reach
|
|
31
|
+
* here.
|
|
32
|
+
*
|
|
33
|
+
* ONE cast, and it is `signed` / `signedTone` on a duration: `NumberFormat`
|
|
34
|
+
* declares them on the plain variant only, while a list column may pair them
|
|
35
|
+
* with any style. The readers reach those knobs through `in` checks, so a
|
|
36
|
+
* variant carrying them reads correctly; it is the union that cannot spell it.
|
|
37
|
+
*/
|
|
38
|
+
export declare function legacyNumberFormat(format: ListColumnFormat | undefined): NumberFormat | undefined;
|
|
39
|
+
/** A CURRENCY field's format: the knobs minus the code, which is `code.fixed`. */
|
|
40
|
+
export declare function legacyCurrencyFormat(format: ListColumnFormat | undefined): CurrencyFormat;
|
|
41
|
+
/**
|
|
42
|
+
* The column's number format in the DISPLAY layer's wider vocabulary — the one
|
|
43
|
+
* shape `formatNumberValue` prints, percent and currency included. Read off
|
|
44
|
+
* the column's TYPE (a bound column's field, a field-less column's own), so a
|
|
45
|
+
* percent or currency column prints as one whatever its `format` says.
|
|
46
|
+
*
|
|
47
|
+
* Exported because `cell-format.ts` needs this translation for the three
|
|
48
|
+
* consumers that hold a column rather than a field (the footer aggregates and
|
|
49
|
+
* the column menu's two live previews) — one mapping, so a cell and its own
|
|
50
|
+
* column total can never print the same number two ways.
|
|
51
|
+
*/
|
|
52
|
+
export declare function legacyNumberLikeFormat(col: ListColumn<never>): NumberLikeFormat | undefined;
|