@viewkitjs/views 0.1.0 → 0.3.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 +767 -1
- package/README.md +92 -41
- package/dist/atoms/LoadMore.js +11 -1
- package/dist/atoms/Row.js +1 -1
- package/dist/atoms/RowMenu.d.ts +1 -1
- package/dist/atoms/RowMenu.js +20 -6
- package/dist/atoms/types.d.ts +4 -4
- package/dist/cells/cell-format.d.ts +3 -3
- package/dist/cells/cell-title.d.ts +1 -2
- package/dist/cells/cell-title.js +2 -2
- package/dist/cells/cell-values.js +6 -3
- package/dist/contract.d.ts +79 -8
- package/dist/contract.js +55 -8
- package/dist/display/converted.d.ts +19 -0
- package/dist/display/converted.js +12 -0
- package/dist/display/format.d.ts +16 -1
- package/dist/display/format.js +10 -1
- package/dist/display/index.d.ts +2 -1
- package/dist/display/index.js +2 -1
- package/dist/display/link-click.d.ts +11 -0
- package/dist/display/link-click.js +3 -0
- package/dist/display/link.js +12 -6
- package/dist/display/location.d.ts +4 -3
- package/dist/display/location.js +12 -5
- package/dist/display/multi-value.d.ts +1 -1
- package/dist/display/multi-value.js +1 -1
- package/dist/display/options.d.ts +8 -2
- package/dist/display/percent.js +10 -3
- package/dist/display/phone.d.ts +2 -1
- package/dist/display/phone.js +11 -2
- package/dist/display/relation.js +1 -1
- package/dist/editors/ChipsEditor.d.ts +9 -4
- package/dist/editors/ChipsEditor.js +7 -3
- package/dist/editors/DateEditor.d.ts +21 -6
- package/dist/editors/DateEditor.js +118 -30
- package/dist/editors/EditorPanel.d.ts +61 -0
- package/dist/editors/EditorPanel.js +54 -0
- package/dist/editors/LocationEditor.d.ts +3 -0
- package/dist/editors/LocationEditor.js +28 -21
- package/dist/editors/NameEditor.d.ts +3 -0
- package/dist/editors/NameEditor.js +15 -10
- package/dist/editors/NumberEditor.d.ts +3 -0
- package/dist/editors/NumberEditor.js +7 -7
- package/dist/editors/RangeEditor.d.ts +16 -1
- package/dist/editors/RangeEditor.js +22 -6
- package/dist/editors/RelationEditor.d.ts +13 -28
- package/dist/editors/RelationEditor.js +17 -40
- package/dist/editors/RelationSetEditor.d.ts +53 -0
- package/dist/editors/RelationSetEditor.js +112 -0
- package/dist/editors/SelectEditor.d.ts +21 -3
- package/dist/editors/SelectEditor.js +55 -9
- package/dist/editors/TextEditor.d.ts +51 -0
- package/dist/editors/TextEditor.js +81 -0
- package/dist/editors/ValueListEditor.d.ts +5 -2
- package/dist/editors/ValueListEditor.js +11 -9
- package/dist/editors/edit-cores.d.ts +13 -10
- package/dist/editors/edit-cores.js +7 -6
- package/dist/editors/edit-session.d.ts +21 -11
- package/dist/editors/edit-session.js +19 -5
- package/dist/editors/keep-inside.d.ts +12 -0
- package/dist/editors/keep-inside.js +20 -0
- package/dist/editors/open-value.d.ts +21 -0
- package/dist/editors/open-value.js +36 -0
- package/dist/editors/open-values.d.ts +4 -0
- package/dist/editors/open-values.js +7 -0
- package/dist/editors/relation-kinds.d.ts +7 -0
- package/dist/editors/relation-kinds.js +21 -0
- package/dist/editors/relation-panel.d.ts +69 -0
- package/dist/editors/relation-panel.js +40 -0
- package/dist/field-row/FieldNoteLine.d.ts +14 -0
- package/dist/field-row/FieldNoteLine.js +14 -0
- package/dist/field-row/FieldRow.d.ts +73 -0
- package/dist/field-row/FieldRow.js +157 -0
- package/dist/field-row/FieldRowLane.d.ts +19 -0
- package/dist/field-row/FieldRowLane.js +11 -0
- package/dist/field-row/editors/RowChipsEditor.d.ts +11 -0
- package/dist/field-row/editors/RowChipsEditor.js +25 -0
- package/dist/field-row/editors/RowDateEditor.d.ts +16 -0
- package/dist/field-row/editors/RowDateEditor.js +18 -0
- package/dist/field-row/editors/RowEditor.d.ts +39 -0
- package/dist/field-row/editors/RowEditor.js +64 -0
- package/dist/field-row/editors/RowNameEditor.d.ts +4 -0
- package/dist/field-row/editors/RowNameEditor.js +15 -0
- package/dist/field-row/editors/RowNumberEditor.d.ts +12 -0
- package/dist/field-row/editors/RowNumberEditor.js +18 -0
- package/dist/field-row/editors/RowPlaceEditor.d.ts +8 -0
- package/dist/field-row/editors/RowPlaceEditor.js +18 -0
- package/dist/field-row/editors/RowRangeEditor.d.ts +4 -0
- package/dist/field-row/editors/RowRangeEditor.js +15 -0
- package/dist/field-row/editors/RowRelationEditor.d.ts +20 -0
- package/dist/field-row/editors/RowRelationEditor.js +77 -0
- package/dist/field-row/editors/RowSelectEditor.d.ts +13 -0
- package/dist/field-row/editors/RowSelectEditor.js +23 -0
- package/dist/field-row/editors/RowTextEditor.d.ts +15 -0
- package/dist/field-row/editors/RowTextEditor.js +16 -0
- package/dist/field-row/editors/RowValueListEditor.d.ts +4 -0
- package/dist/field-row/editors/RowValueListEditor.js +21 -0
- package/dist/field-row/editors/host.d.ts +59 -0
- package/dist/field-row/editors/host.js +1 -0
- package/dist/field-row/editors/row-session.d.ts +49 -0
- package/dist/field-row/editors/row-session.js +49 -0
- package/dist/field-row/index.d.ts +5 -0
- package/dist/field-row/index.js +5 -0
- package/dist/field-row/row-target.d.ts +20 -0
- package/dist/field-row/row-target.js +3 -0
- package/dist/field-row/useFieldWrite.d.ts +45 -0
- package/dist/field-row/useFieldWrite.js +190 -0
- package/dist/field-row/useRowSettlement.d.ts +33 -0
- package/dist/field-row/useRowSettlement.js +23 -0
- package/dist/fields/binding.d.ts +7 -2
- package/dist/fields/binding.js +13 -6
- package/dist/fields/currency.d.ts +0 -10
- package/dist/fields/currency.js +0 -14
- package/dist/fields/edit-core-types.d.ts +9 -9
- package/dist/fields/edit-core-types.js +6 -6
- package/dist/fields/money.d.ts +6 -0
- package/dist/fields/money.js +11 -0
- package/dist/fields/number-edit.d.ts +6 -0
- package/dist/fields/number-edit.js +4 -0
- package/dist/fields/prepare-write.js +6 -1
- package/dist/fields/relation-source-types.d.ts +12 -0
- package/dist/fields/write-target.d.ts +50 -0
- package/dist/fields/write-target.js +10 -0
- package/dist/filters/filter-model.d.ts +0 -1
- package/dist/filters/registry.d.ts +3 -36
- package/dist/filters/registry.js +0 -38
- 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 +29 -0
- package/dist/grid/chrome/GridCellEditors.d.ts +71 -0
- package/dist/grid/chrome/GridCellEditors.js +126 -0
- package/dist/grid/chrome/GridCellOutline.d.ts +49 -0
- package/dist/grid/chrome/GridCellOutline.js +16 -0
- package/dist/grid/chrome/GridChipsEditor.d.ts +38 -0
- package/dist/grid/chrome/GridChipsEditor.js +35 -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 +103 -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 +34 -0
- package/dist/grid/chrome/GridDateEditor.js +19 -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 +33 -0
- package/dist/grid/chrome/GridFooter.js +85 -0
- package/dist/grid/chrome/GridGroupMenu.d.ts +37 -0
- package/dist/grid/chrome/GridGroupMenu.js +64 -0
- package/dist/grid/chrome/GridHeader.d.ts +66 -0
- package/dist/grid/chrome/GridHeader.js +42 -0
- package/dist/grid/chrome/GridLongTextEditor.d.ts +55 -0
- package/dist/grid/chrome/GridLongTextEditor.js +69 -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 +24 -0
- package/dist/grid/chrome/GridNameEditor.js +21 -0
- package/dist/grid/chrome/GridNumberEditor.d.ts +49 -0
- package/dist/grid/chrome/GridNumberEditor.js +51 -0
- package/dist/grid/chrome/GridPlaceEditor.d.ts +26 -0
- package/dist/grid/chrome/GridPlaceEditor.js +22 -0
- package/dist/grid/chrome/GridRangeEditor.d.ts +30 -0
- package/dist/grid/chrome/GridRangeEditor.js +21 -0
- package/dist/grid/chrome/GridRelationEditor.d.ts +45 -0
- package/dist/grid/chrome/GridRelationEditor.js +92 -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 +31 -0
- package/dist/grid/chrome/GridRow.js +179 -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 +128 -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 +33 -0
- package/dist/grid/chrome/GridSelectEditor.js +43 -0
- package/dist/grid/chrome/GridStructure.d.ts +47 -0
- package/dist/grid/chrome/GridStructure.js +41 -0
- package/dist/grid/chrome/GridTable.d.ts +4 -0
- package/dist/grid/chrome/GridTable.js +192 -0
- package/dist/grid/chrome/GridTableSurface.d.ts +52 -0
- package/dist/grid/chrome/GridTableSurface.js +15 -0
- package/dist/grid/chrome/GridTextEditor.d.ts +45 -0
- package/dist/grid/chrome/GridTextEditor.js +38 -0
- package/dist/grid/chrome/GridValueListEditor.d.ts +30 -0
- package/dist/grid/chrome/GridValueListEditor.js +19 -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/cell-cut-off.d.ts +11 -0
- package/dist/grid/chrome/cell-cut-off.js +20 -0
- package/dist/grid/chrome/cells.d.ts +21 -0
- package/dist/grid/chrome/cells.js +19 -0
- package/dist/grid/chrome/checks.d.ts +32 -0
- package/dist/grid/chrome/checks.js +32 -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 +53 -0
- package/dist/grid/chrome/grid-cell-classes.js +32 -0
- package/dist/grid/chrome/grid-cell-link.d.ts +13 -0
- package/dist/grid/chrome/grid-cell-link.js +9 -0
- package/dist/grid/chrome/grid-edit-session.d.ts +63 -0
- package/dist/grid/chrome/grid-edit-session.js +118 -0
- package/dist/grid/chrome/grid-hover.d.ts +60 -0
- package/dist/grid/chrome/grid-hover.js +81 -0
- package/dist/grid/chrome/grid-menu-focus.d.ts +43 -0
- package/dist/grid/chrome/grid-menu-focus.js +93 -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-menu-key.d.ts +15 -0
- package/dist/grid/chrome/grid-row-menu-key.js +36 -0
- package/dist/grid/chrome/grid-row-props.d.ts +143 -0
- package/dist/grid/chrome/grid-row-props.js +1 -0
- package/dist/grid/chrome/grid-row-window.d.ts +61 -0
- package/dist/grid/chrome/grid-row-window.js +212 -0
- package/dist/grid/chrome/grid-scroll-owner.d.ts +38 -0
- package/dist/grid/chrome/grid-scroll-owner.js +75 -0
- package/dist/grid/chrome/grid-styles.d.ts +40 -0
- package/dist/grid/chrome/grid-styles.js +9 -0
- package/dist/grid/chrome/grid-table-props.d.ts +172 -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/useGridFocus.d.ts +45 -0
- package/dist/grid/chrome/useGridFocus.js +122 -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 +64 -0
- package/dist/grid/chrome/useGridKeyboard.js +450 -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 +51 -0
- package/dist/grid/chrome/useGridRangeActions.js +195 -0
- package/dist/grid/chrome/useGridRangeGestures.d.ts +32 -0
- package/dist/grid/chrome/useGridRangeGestures.js +237 -0
- package/dist/grid/chrome/useGridRowContextMenu.d.ts +37 -0
- package/dist/grid/chrome/useGridRowContextMenu.js +153 -0
- package/dist/grid/chrome/useGridScaleStyles.d.ts +3 -0
- package/dist/grid/chrome/useGridScaleStyles.js +28 -0
- package/dist/grid/chrome/useGridScrollArea.d.ts +21 -0
- package/dist/grid/chrome/useGridScrollArea.js +65 -0
- package/dist/grid/chrome/useGridTableInteractionModel.d.ts +78 -0
- package/dist/grid/chrome/useGridTableInteractionModel.js +249 -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 +83 -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 +41 -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/edge-scroll.d.ts +21 -0
- package/dist/grid/core/edge-scroll.js +23 -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 +60 -0
- package/dist/grid/core/editing-controller.js +266 -0
- package/dist/grid/core/editing-model.d.ts +87 -0
- package/dist/grid/core/editing-model.js +148 -0
- package/dist/grid/core/flat-rows.d.ts +35 -0
- package/dist/grid/core/flat-rows.js +20 -0
- package/dist/grid/core/grid-aria.d.ts +27 -0
- package/dist/grid/core/grid-aria.js +39 -0
- package/dist/grid/core/grid-focus.d.ts +54 -0
- package/dist/grid/core/grid-focus.js +148 -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 +53 -0
- package/dist/grid/core/pending-reconciliation.js +51 -0
- package/dist/grid/core/range-model.d.ts +25 -0
- package/dist/grid/core/range-model.js +59 -0
- package/dist/grid/core/row-window.d.ts +40 -0
- package/dist/grid/core/row-window.js +43 -0
- package/dist/grid/core/spreadsheet-operations.d.ts +101 -0
- package/dist/grid/core/spreadsheet-operations.js +280 -0
- package/dist/grid/core/useGridEditing.d.ts +46 -0
- package/dist/grid/core/useGridEditing.js +93 -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 +54 -0
- package/dist/grid/core/value-equality.js +80 -0
- package/dist/grid/index.d.ts +18 -0
- package/dist/grid/index.js +5 -0
- package/dist/grid/useGridTablePrefs.d.ts +49 -0
- package/dist/grid/useGridTablePrefs.js +99 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/viewport.d.ts +3 -0
- package/dist/internal/viewport.js +15 -0
- package/dist/model/column-capabilities.d.ts +3 -2
- package/dist/model/column-capabilities.js +28 -8
- package/dist/model/column-from.js +3 -0
- package/dist/model/column-inspect.d.ts +10 -2
- package/dist/model/column-inspect.js +9 -0
- package/dist/model/column-schema.d.ts +6 -1
- package/dist/model/column-state.d.ts +1 -1
- package/dist/model/column-types.d.ts +3 -1
- package/dist/model/column-types.js +1 -1
- package/dist/model/density.js +3 -3
- package/dist/model/filter-capabilities.d.ts +1 -1
- package/dist/model/filter-capabilities.js +1 -1
- package/dist/model/index.d.ts +4 -6
- package/dist/model/index.js +0 -1
- package/dist/model/preferences.d.ts +7 -7
- package/dist/model/preferences.js +0 -1
- package/dist/model/prefs-buckets.d.ts +0 -1
- package/dist/model/prefs-buckets.js +0 -3
- package/dist/model/render-count.d.ts +6 -0
- package/dist/model/render-count.js +11 -0
- package/dist/provider/ViewsProvider.d.ts +6 -2
- package/dist/provider/ViewsProvider.js +12 -2
- package/dist/provider/components.d.ts +35 -9
- package/dist/provider/components.js +4 -2
- package/dist/provider/context.d.ts +8 -4
- package/dist/provider/desktop.d.ts +9 -0
- package/dist/provider/desktop.js +22 -0
- package/dist/provider/menu-groups.d.ts +8 -0
- package/dist/provider/menu-groups.js +38 -0
- package/dist/provider/plain-input.d.ts +8 -0
- package/dist/provider/plain-input.js +5 -0
- package/dist/provider/ports.d.ts +22 -0
- package/dist/provider/ports.js +1 -0
- package/dist/react.d.ts +3 -2
- package/dist/react.js +1 -0
- package/dist/selection/SelectCheckbox.d.ts +3 -1
- package/dist/selection/SelectCheckbox.js +2 -2
- package/dist/selection/useCheckDragSelect.js +6 -5
- package/docs/contract.md +202 -72
- 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 +413 -0
- package/docs/guides/display.md +204 -0
- package/docs/guides/editors.md +462 -0
- package/docs/guides/ports.md +246 -0
- package/docs/guides/selection.md +270 -0
- package/docs/guides/the-grid.md +696 -0
- package/docs/guides/the-provider.md +448 -0
- package/docs/index.md +52 -0
- package/docs/install.md +9 -47
- package/docs/reference/cells.md +28 -0
- package/docs/reference/display.md +44 -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 +10 -0
- package/docs/reference/editors-panel.md +12 -0
- package/docs/reference/editors-range.md +6 -0
- package/docs/reference/editors-relation.md +12 -0
- package/docs/reference/editors-select.md +9 -0
- package/docs/reference/editors-session.md +11 -0
- package/docs/reference/editors-text.md +9 -0
- package/docs/reference/editors-value-list.md +6 -0
- package/docs/reference/editors.md +5 -0
- package/docs/reference/field-row.md +16 -0
- package/docs/reference/grid.md +39 -0
- package/docs/reference/react.md +89 -0
- package/docs/reference/selection.md +33 -0
- package/docs/reference/views.md +622 -0
- package/package.json +27 -4
- package/skills/views/SKILL.md +20 -5
- package/dist/filters/types.d.ts +0 -27
- package/dist/filters/types.js +0 -1
- package/dist/model/filter-pushdown.d.ts +0 -106
- package/dist/model/filter-pushdown.js +0 -147
package/README.md
CHANGED
|
@@ -1,51 +1,102 @@
|
|
|
1
1
|
# ViewKit views
|
|
2
2
|
|
|
3
|
-
The grid,
|
|
4
|
-
|
|
5
|
-
`
|
|
6
|
-
|
|
7
|
-
**Status: 0.1.** The rendering contract, the provider, the model, the field display, the editors, the
|
|
8
|
-
cells and selection are here; the grid's rendering follows in 0.2, then the board.
|
|
9
|
-
|
|
10
|
-
## What is here
|
|
11
|
-
|
|
12
|
-
| door | holds |
|
|
13
|
-
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
14
|
-
| `@viewkitjs/views` | the rendering contract: slots, states, tokens, the components map, the atom names, ports, icon names, the message keys and their English resolver — `docs/contract.md` |
|
|
15
|
-
| `@viewkitjs/views/react` | `ViewsProvider`, `useViews`, the default atoms, and the types an adapter implements |
|
|
16
|
-
| `@viewkitjs/views/display` | the field display: one renderer per storage type, the string formatters, the viewer |
|
|
17
|
-
| `@viewkitjs/views/editors`, `/editors/<name>`, `/editors/session`, `/editors/open-values` | the edit registry, each field editor (select, relation, number, range, name, value list, date, chips), the anchored edit session, and an open field's values carried to its editors |
|
|
18
|
-
| `@viewkitjs/views/cells` | a column's typed cell, and its column-shaped string formatters |
|
|
19
|
-
| `@viewkitjs/views/selection` | a list's selection: the model, the hook, the row checkbox, drag-select and the row-click rules |
|
|
20
|
-
|
|
21
|
-
## Actor, rich text, range, name and lookup
|
|
22
|
-
|
|
23
|
-
The display draws every field type the fields package defines. An `actor` is a chip with a member's
|
|
24
|
-
avatar, or a glyph for an automation, an API key or the system; a `rich_text` is one line in a cell and
|
|
25
|
-
folded text in a drawer; a `range` is "11–50" with its unit and period; a `name` is the full name as
|
|
26
|
-
written, else the given and family names, else the words the host gives an empty one
|
|
27
|
-
(`DisplayOptions.nameFallback`, or a column's `nameFallback(row)`), and it may be a record's title; a
|
|
28
|
-
`lookup` is drawn as the field it shows; a rollup with a breakdown is a segmented bar or a sparkline
|
|
29
|
-
beside its headline. The range has its own editor at `@viewkitjs/views/editors/range` (two boxes) and a
|
|
30
|
-
range filter; the name has its own at `@viewkitjs/views/editors/name` (given, family and full, the full
|
|
31
|
-
box filled from the parts once one is edited, until a person types in it); a place has its own at
|
|
32
|
-
`@viewkitjs/views/editors/location` (the country first, then that country's parts in its order, a region picked
|
|
33
|
-
from its list). An app hands the
|
|
34
|
-
provider a `Markdown` component in the components map, its own markdown renderer, which draws rich
|
|
35
|
-
text; the package renders no markdown itself.
|
|
3
|
+
The grid, its cells, the field display and the editors over typed fields: a headless engine every app installs and never edits, and a default rendering written to skin discipline — markup, classes and slots only, states as `data-*` attributes, primitives handed in by the app, geometry through `--vk-*` variables. By Sheaf.
|
|
4
|
+
|
|
5
|
+
`@viewkitjs/fields` says what a value is; this package draws it and edits it. It ships no UI library of its own: your app hands in its button, popover, menu, command list and calendar through a components map, its icons by meaning, its toast, clipboard and per-device store as ports, and its wording as messages, so every view wears your app's look.
|
|
36
6
|
|
|
37
7
|
## Install
|
|
38
8
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @viewkitjs/views @viewkitjs/fields zod
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
ESM only. Node 20 or later. `react` and `react-dom` 19 and `@viewkitjs/fields` are peer dependencies. Add one `@source` line so Tailwind sees the package, and map its colours onto your theme: [docs/install.md](./docs/install.md).
|
|
14
|
+
|
|
15
|
+
## Getting started
|
|
16
|
+
|
|
17
|
+
Fields bound to your rows become the grid's columns. This block runs as written; [the getting-started page](./docs/getting-started.md) carries on from it to your primitives, the provider and the grid on screen.
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import assert from "node:assert/strict";
|
|
21
|
+
import { defineFields } from "@viewkitjs/fields";
|
|
22
|
+
import { bindFields, columnFrom, columnWritable } from "@viewkitjs/views";
|
|
23
|
+
|
|
24
|
+
const DEAL_FIELDS = defineFields({
|
|
25
|
+
entity: "deal",
|
|
26
|
+
identity: "title",
|
|
27
|
+
fields: {
|
|
28
|
+
title: { type: "text", label: "Title", required: true },
|
|
29
|
+
value: { type: "currency", label: "Value", code: { fixed: "EUR" } },
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
type Deal = { id: string; title: string; value: number };
|
|
34
|
+
|
|
35
|
+
// How each field reads on your row, and how an edit maps onto your request's body.
|
|
36
|
+
const DEAL_BINDINGS = bindFields<Deal, typeof DEAL_FIELDS>(DEAL_FIELDS, {
|
|
37
|
+
title: { read: (deal) => deal.title, write: (_deal, commit) => ({ body: { title: commit } }) },
|
|
38
|
+
value: { read: (deal) => deal.value },
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// A column is what the grid draws: its type, format and edits come from the field and the binding.
|
|
42
|
+
const title = columnFrom(DEAL_BINDINGS.title, { id: "title", width: 240, editable: true });
|
|
43
|
+
const value = columnFrom(DEAL_BINDINGS.value, { id: "value", width: 120 });
|
|
44
|
+
|
|
45
|
+
assert.equal(title.type, "title");
|
|
46
|
+
assert.equal(columnWritable(title), true);
|
|
47
|
+
assert.equal(columnWritable(value), false); // no write: read-only on every surface
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Then mount `ViewsProvider` once with your primitives and draw `GridTable` from `@viewkitjs/views/grid` with the rows, the columns, each row's id and what opening a row does.
|
|
42
51
|
|
|
43
|
-
##
|
|
52
|
+
## Documentation
|
|
44
53
|
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
The package ships its documentation in `docs/`, starting at [docs/index.md](./docs/index.md). Every example in it is compiled and run against the packed package before each release.
|
|
55
|
+
|
|
56
|
+
- [Getting started](./docs/getting-started.md): install, fields bound to your rows, columns, your primitives, the provider and the grid.
|
|
57
|
+
- [Install](./docs/install.md): the Tailwind line and the colour block.
|
|
58
|
+
|
|
59
|
+
Guides:
|
|
60
|
+
|
|
61
|
+
- [The provider](./docs/guides/the-provider.md): mounting it once, your adapter over your own primitives, icons, messages and presentation.
|
|
62
|
+
- [Ports](./docs/guides/ports.md): your toast, haptics, clipboard, per-device store and confirm dialog.
|
|
63
|
+
- [Atoms](./docs/guides/atoms.md): the small pieces every view is built from, and swapping them for your own.
|
|
64
|
+
- [The display](./docs/guides/display.md): one renderer per field type, and the string formatters.
|
|
65
|
+
- [Editors and the edit session](./docs/guides/editors.md): one editor per field type, what an editor owns and what its host owns.
|
|
66
|
+
- [Columns](./docs/guides/columns.md): a field bound to your row, the column built from it, and what may be done to it.
|
|
67
|
+
- [Cells](./docs/guides/cells.md): a column's value drawn in a cell, outside the grid too.
|
|
68
|
+
- [Selection](./docs/guides/selection.md): a list's selection, its checkbox, drag-select and the row-click rules.
|
|
69
|
+
- [The grid](./docs/guides/the-grid.md): grouping, sorting, writes, preferences, figures and the editing rules.
|
|
70
|
+
- [The rendering contract](./docs/contract.md): every public name and what each door holds; [reshaping a view](./docs/reshaping.md): the cheapest change first.
|
|
71
|
+
|
|
72
|
+
References, one per door, each naming every export: [`@viewkitjs/views`](./docs/reference/views.md), [`/react`](./docs/reference/react.md), [`/display`](./docs/reference/display.md), [`/editors`](./docs/reference/editors.md), [`/editors/select`](./docs/reference/editors-select.md), [`/editors/text`](./docs/reference/editors-text.md), [`/editors/relation`](./docs/reference/editors-relation.md), [`/editors/number`](./docs/reference/editors-number.md), [`/editors/range`](./docs/reference/editors-range.md), [`/editors/name`](./docs/reference/editors-name.md), [`/editors/location`](./docs/reference/editors-location.md), [`/editors/value-list`](./docs/reference/editors-value-list.md), [`/editors/date`](./docs/reference/editors-date.md), [`/editors/chips`](./docs/reference/editors-chips.md), [`/editors/session`](./docs/reference/editors-session.md), [`/editors/panel`](./docs/reference/editors-panel.md), [`/editors/open-values`](./docs/reference/editors-open-values.md), [`/field-row`](./docs/reference/field-row.md), [`/cells`](./docs/reference/cells.md), [`/selection`](./docs/reference/selection.md), [`/grid`](./docs/reference/grid.md).
|
|
73
|
+
|
|
74
|
+
## Doors
|
|
75
|
+
|
|
76
|
+
| Import | Holds |
|
|
77
|
+
| ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
|
|
78
|
+
| `@viewkitjs/views` | the rendering contract (slots, states, tokens, the components map, atom and icon names, ports, message keys and their English resolver) and the model: columns, preferences, filters, figures, groups, bindings and money. No React at runtime |
|
|
79
|
+
| `@viewkitjs/views/react` | `ViewsProvider`, `useViews`, the default atoms, and the types an adapter implements |
|
|
80
|
+
| `@viewkitjs/views/display` | the field display: one renderer per storage type, the string formatters, the viewer |
|
|
81
|
+
| `@viewkitjs/views/editors` | the edit registry: which editor each type opens |
|
|
82
|
+
| `@viewkitjs/views/editors/<name>` | one editor each: `select`, `text`, `relation`, `number`, `range`, `name`, `location`, `value-list`, `date`, `chips` |
|
|
83
|
+
| `@viewkitjs/views/editors/session`, `/editors/open-values` | the anchored edit session every host shares, and an open field's values carried to its editors |
|
|
84
|
+
| `@viewkitjs/views/editors/panel` | an editor opened as your popover on the desktop and your sheet on the phone |
|
|
85
|
+
| `@viewkitjs/views/field-row` | a record's field row: its label, its value and its editor in place, with the write path that admits, queues and settles each edit |
|
|
86
|
+
| `@viewkitjs/views/cells` | a column's typed cell, and its column-shaped string formatters |
|
|
87
|
+
| `@viewkitjs/views/selection` | a list's selection: the model, the hook, the row checkbox, drag-select and the row-click rules |
|
|
88
|
+
| `@viewkitjs/views/grid` | the grid: the table, its props, its preferences, and the helpers a host shares with it |
|
|
89
|
+
|
|
90
|
+
Twenty-one doors; there are no other subpaths.
|
|
47
91
|
|
|
48
92
|
## For coding agents
|
|
49
93
|
|
|
50
|
-
The package ships a usage skill at `skills/views/SKILL.md
|
|
51
|
-
|
|
94
|
+
The package ships a usage skill at `skills/views/SKILL.md`. Its example is compiled against the published artifact on every release.
|
|
95
|
+
|
|
96
|
+
## Status
|
|
97
|
+
|
|
98
|
+
`0.x`: the API may change between minor versions.
|
|
99
|
+
|
|
100
|
+
## Licence
|
|
101
|
+
|
|
102
|
+
Proprietary. See [LICENSE.md](./LICENSE.md).
|
package/dist/atoms/LoadMore.js
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useRef } from "react";
|
|
4
4
|
import { useViews } from "../provider/context.js";
|
|
5
|
+
const SCROLLS_Y = new Set(["auto", "scroll", "overlay"]);
|
|
6
|
+
function nearestScrollArea(element) {
|
|
7
|
+
for (let el = element.parentElement; el; el = el.parentElement) {
|
|
8
|
+
if (el === document.body || el === document.documentElement)
|
|
9
|
+
break;
|
|
10
|
+
if (SCROLLS_Y.has(getComputedStyle(el).overflowY) && el.scrollHeight > el.clientHeight)
|
|
11
|
+
return el;
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
5
15
|
export function DefaultLoadMore({ onReveal, label }) {
|
|
6
16
|
const { Loading } = useViews().atoms;
|
|
7
17
|
const ref = useRef(null);
|
|
@@ -17,7 +27,7 @@ export function DefaultLoadMore({ onReveal, label }) {
|
|
|
17
27
|
for (const entry of entries)
|
|
18
28
|
if (entry.isIntersecting)
|
|
19
29
|
onRevealRef.current();
|
|
20
|
-
}, { rootMargin: "600px 0px" });
|
|
30
|
+
}, { root: nearestScrollArea(element), rootMargin: "600px 0px" });
|
|
21
31
|
observer.observe(element);
|
|
22
32
|
return () => observer.disconnect();
|
|
23
33
|
}, []);
|
package/dist/atoms/Row.js
CHANGED
|
@@ -26,5 +26,5 @@ export function DefaultRow({ onClick, onMouseDown, disabled, interactive = true,
|
|
|
26
26
|
if (!interactive) {
|
|
27
27
|
return (_jsx("div", { "data-slot": "vk-row", title: title, className: cx(frame, className), children: body }));
|
|
28
28
|
}
|
|
29
|
-
return (_jsx("button", { type: "button", "data-slot": "vk-row", "data-disabled": disabled || undefined, "data-open": open || undefined, "aria-haspopup": opens ? "
|
|
29
|
+
return (_jsx("button", { type: "button", "data-slot": "vk-row", "data-disabled": disabled || undefined, "data-open": open || undefined, "aria-haspopup": opens ? "dialog" : undefined, "aria-expanded": opens ? Boolean(open) : undefined, disabled: disabled, onClick: onClick, onMouseDown: onMouseDown, title: title, role: role, "aria-selected": role ? ariaSelected : undefined, className: cx(frame, "group/row transition-colors hover:bg-(color:--vk-hovered) data-open:bg-(color:--vk-pressed) disabled:pointer-events-none disabled:opacity-50", className), children: body }));
|
|
30
30
|
}
|
package/dist/atoms/RowMenu.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ViewsRowMenuProps } from "./types.js";
|
|
2
|
-
export declare function DefaultRowMenu({ children, rowId, items, openHref, onDelete }: ViewsRowMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function DefaultRowMenu({ children, rowId, items, openHref, onDelete, deleteLabel }: ViewsRowMenuProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/atoms/RowMenu.js
CHANGED
|
@@ -34,8 +34,8 @@ function hostEntry(item, index) {
|
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
export function DefaultRowMenu({ children, rowId, items, openHref, onDelete }) {
|
|
38
|
-
const { components, icons, messages } = useViews();
|
|
37
|
+
export function DefaultRowMenu({ children, rowId, items, openHref, onDelete, deleteLabel }) {
|
|
38
|
+
const { components, icons, messages, ports } = useViews();
|
|
39
39
|
const { Menu } = components;
|
|
40
40
|
const [point, setPoint] = useState(null);
|
|
41
41
|
const openedAt = useRef(0);
|
|
@@ -68,8 +68,19 @@ export function DefaultRowMenu({ children, rowId, items, openHref, onDelete }) {
|
|
|
68
68
|
icon: _jsx(Delete, { className: "h-4 w-4" }),
|
|
69
69
|
destructive: true,
|
|
70
70
|
onSelect: () => {
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
const request = {
|
|
72
|
+
message: messages({ key: "views.menus.row-delete-confirm" }),
|
|
73
|
+
confirmLabel: messages({ key: "views.menus.row-delete" }),
|
|
74
|
+
...(deleteLabel !== undefined && { subject: deleteLabel }),
|
|
75
|
+
destructive: true,
|
|
76
|
+
};
|
|
77
|
+
void new Promise((resolve) => resolve(ports.confirm(request)))
|
|
78
|
+
.catch(() => false)
|
|
79
|
+
.then((yes) => {
|
|
80
|
+
if (!yes)
|
|
81
|
+
return;
|
|
82
|
+
return new Promise((resolve) => resolve(onDelete(rowId))).catch(() => ports.toast.error(messages({ key: "views.menus.row-delete-failed" })));
|
|
83
|
+
});
|
|
73
84
|
},
|
|
74
85
|
},
|
|
75
86
|
});
|
|
@@ -79,14 +90,17 @@ export function DefaultRowMenu({ children, rowId, items, openHref, onDelete }) {
|
|
|
79
90
|
setPoint(null);
|
|
80
91
|
return (_jsxs("div", { ref: wrapper, "data-slot": "vk-row-menu", onPointerDownCapture: (event) => {
|
|
81
92
|
lastPress.current = event.pointerType;
|
|
93
|
+
}, onKeyDownCapture: () => {
|
|
94
|
+
lastPress.current = undefined;
|
|
82
95
|
}, onContextMenu: (event) => {
|
|
83
96
|
const fromMore = event.target.closest?.('[data-slot="vk-grid-row-more"]');
|
|
84
|
-
const
|
|
97
|
+
const pressed = lastPress.current;
|
|
98
|
+
const touched = pressed === "touch";
|
|
85
99
|
lastPress.current = undefined;
|
|
86
100
|
if (touched && !fromMore)
|
|
87
101
|
return;
|
|
88
102
|
event.preventDefault();
|
|
89
|
-
openedAt.current = performance.now();
|
|
103
|
+
openedAt.current = pressed === undefined ? -Infinity : performance.now();
|
|
90
104
|
setPoint({ x: event.clientX, y: event.clientY });
|
|
91
105
|
}, onPointerUpCapture: (event) => {
|
|
92
106
|
if (!point || !inGrace())
|
package/dist/atoms/types.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export type ViewsRowProps = ViewsRowContentProps & {
|
|
|
40
40
|
disabled?: boolean;
|
|
41
41
|
/** Default true. False draws a line that is read, not pressed. */
|
|
42
42
|
interactive?: boolean;
|
|
43
|
-
/** The row opens a flyout beside its menu: `aria-haspopup="
|
|
43
|
+
/** The row opens a flyout beside its menu, a dialog: `aria-haspopup="dialog"`, and `aria-expanded` from `open`. */
|
|
44
44
|
opens?: boolean;
|
|
45
45
|
/** The flyout this row opens is up now: `aria-expanded`, `data-open` and the pressed ground. */
|
|
46
46
|
open?: boolean;
|
|
@@ -143,8 +143,8 @@ export type ViewsRowMenuItem = {
|
|
|
143
143
|
};
|
|
144
144
|
/** The row's right-click menu, around the row it opens on. The rendering builds `items` (the cell's
|
|
145
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
|
|
147
|
-
*
|
|
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
148
|
export type ViewsRowMenuProps = {
|
|
149
149
|
/** The row: right-click on it, or the row's ⋯, opens the menu. */
|
|
150
150
|
children: ReactNode;
|
|
@@ -155,7 +155,7 @@ export type ViewsRowMenuProps = {
|
|
|
155
155
|
openHref?: string;
|
|
156
156
|
/** Absent: no Delete row. */
|
|
157
157
|
onDelete?: (rowId: string) => Promise<void>;
|
|
158
|
-
/** What Delete removes,
|
|
158
|
+
/** What Delete removes, handed to the confirm port as its `subject`. */
|
|
159
159
|
deleteLabel?: string;
|
|
160
160
|
/** Flips the row's selection, for an app whose long-press selects. Absent when the list can't select.
|
|
161
161
|
* The default doesn't use it: on a phone the ⋯ is the way in. */
|
|
@@ -36,9 +36,6 @@ export type GridCellOptions = {
|
|
|
36
36
|
withTime?: boolean;
|
|
37
37
|
/** Percent columns: the workspace's display — wins over `format.percentDisplay`. */
|
|
38
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
39
|
/** Optimistic pending value (Tier 3) — wins over `accessor(row)` when defined.
|
|
43
40
|
* Only typed cells honor it; custom `render` columns show confirmed data. */
|
|
44
41
|
valueOverride?: unknown;
|
|
@@ -105,6 +102,9 @@ export type GridCellOptions = {
|
|
|
105
102
|
* controls inside the slot's own button would be invalid markup.
|
|
106
103
|
*/
|
|
107
104
|
slotOwnsClick?: boolean;
|
|
105
|
+
/** A host whose plain click on a value is its own (the grid selects the cell): links stay links but let the
|
|
106
|
+
* click through, and the host follows one only on a ⌘- or Ctrl-click (`DisplayOptions.hostOwnsPlainClick`). */
|
|
107
|
+
hostOwnsPlainClick?: boolean;
|
|
108
108
|
};
|
|
109
109
|
/**
|
|
110
110
|
* Fold the code a money cell is drawn in into the render options, so the
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type { GridCellOptions } from "./cell-format.js";
|
|
3
2
|
import type { ListColumn } from "../model/column-schema.js";
|
|
4
3
|
/**
|
|
5
4
|
* THE TITLE CELL — the one typed cell the list owns, not a field.
|
|
@@ -14,4 +13,4 @@ import type { ListColumn } from "../model/column-schema.js";
|
|
|
14
13
|
* generic indicator lane for this type: the adornment has to sit inside the
|
|
15
14
|
* cell's own layout rules about where the click target ends.
|
|
16
15
|
*/
|
|
17
|
-
export declare function renderTitleCell<Row>(col: ListColumn<Row>, row: Row, content: ReactNode
|
|
16
|
+
export declare function renderTitleCell<Row>(col: ListColumn<Row>, row: Row, content: ReactNode): ReactNode;
|
package/dist/cells/cell-title.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cellTextClass } from "../display/text-class.js";
|
|
4
4
|
import { cx } from "../internal/cx.js";
|
|
5
|
-
export function renderTitleCell(col, row, content
|
|
5
|
+
export function renderTitleCell(col, row, content) {
|
|
6
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(
|
|
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()), children: content }), indicator] }));
|
|
8
8
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { valueTypeOf } from "@viewkitjs/fields";
|
|
4
|
+
import { ConvertedFigure } from "../display/converted.js";
|
|
4
5
|
import { renderFieldValue } from "../display/display-cores.js";
|
|
6
|
+
import { convertedFromOf } from "../fields/money.js";
|
|
5
7
|
import { columnLabel } from "../model/column-capabilities.js";
|
|
6
8
|
import { prettifyOptionValue } from "../model/column-state.js";
|
|
7
9
|
import { useViews } from "../provider/context.js";
|
|
@@ -19,13 +21,14 @@ export function renderTypedCellValue(col, row, opts) {
|
|
|
19
21
|
if (!col.type)
|
|
20
22
|
return null;
|
|
21
23
|
if (col.type === "title")
|
|
22
|
-
return renderTitleCell(col, row, identityContent(col, row, value, opts)
|
|
24
|
+
return renderTitleCell(col, row, identityContent(col, row, value, opts));
|
|
23
25
|
const field = col.field ?? legacyFieldFromColumn(col);
|
|
24
26
|
const cell = renderFieldValue(field, value, displayOptionsFor(col, row, opts));
|
|
25
27
|
if (col.command && opts?.commandItems?.length) {
|
|
26
28
|
return _jsx(CommandCell, { col: col, cell: cell, items: opts.commandItems });
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
const from = cell == null ? null : convertedFromOf(col, row);
|
|
31
|
+
return from ? _jsx(ConvertedFigure, { from: from, children: cell }) : cell;
|
|
29
32
|
}
|
|
30
33
|
const TITLE_THROUGH_CORE = new Set(["number", "percent", "currency", "date", "datetime", "name"]);
|
|
31
34
|
function identityContent(col, row, value, opts) {
|
|
@@ -74,7 +77,6 @@ function displayOptionsFor(col, row, opts) {
|
|
|
74
77
|
nameFallback: col.nameFallback?.(row) ?? undefined,
|
|
75
78
|
withTime: opts?.withTime,
|
|
76
79
|
percentDisplay: opts?.percentDisplay,
|
|
77
|
-
wrap: opts?.wrap,
|
|
78
80
|
booleanIcon: col.format?.icon,
|
|
79
81
|
marker: col.marker,
|
|
80
82
|
markerReason: opts?.markerReason,
|
|
@@ -82,6 +84,7 @@ function displayOptionsFor(col, row, opts) {
|
|
|
82
84
|
onToggle: opts?.onToggle,
|
|
83
85
|
entityIcon: opts?.entityIcon,
|
|
84
86
|
slotOwnsClick: opts?.slotOwnsClick,
|
|
87
|
+
hostOwnsPlainClick: opts?.hostOwnsPlainClick,
|
|
85
88
|
relationWrap: listRelationWrap(opts),
|
|
86
89
|
};
|
|
87
90
|
}
|
package/dist/contract.d.ts
CHANGED
|
@@ -10,13 +10,14 @@ export declare const VK_PREFIX: "vk";
|
|
|
10
10
|
/** The parts of the grid, as `data-slot` values. `data-slot` is one attribute shared by
|
|
11
11
|
* every component copy in an app, so each value carries the prefix. Board's arrive with
|
|
12
12
|
* the board. */
|
|
13
|
-
export declare const GRID_SLOTS: readonly ["vk-grid", "vk-grid-header", "vk-grid-header-cell", "vk-grid-row", "vk-grid-cell", "vk-grid-group", "vk-grid-group-header", "vk-grid-footer", "vk-grid-footer-cell", "vk-grid-rail", "vk-grid-tail", "vk-grid-row-more", "vk-grid-editor", "vk-grid-outline", "vk-grid-resize-handle", "vk-grid-column-menu", "vk-grid-flyout", "vk-grid-group-menu", "vk-grid-aggregate-menu"];
|
|
13
|
+
export declare const GRID_SLOTS: readonly ["vk-grid", "vk-grid-scroll", "vk-grid-head", "vk-grid-header", "vk-grid-header-cell", "vk-grid-row", "vk-grid-rows", "vk-grid-gap", "vk-grid-cell", "vk-grid-group", "vk-grid-group-head", "vk-grid-group-header", "vk-grid-footer", "vk-grid-footer-cell", "vk-grid-rail", "vk-grid-tail", "vk-grid-row-more", "vk-grid-editor", "vk-grid-outline", "vk-grid-resize-handle", "vk-grid-column-menu", "vk-grid-flyout", "vk-grid-group-menu", "vk-grid-aggregate-menu"];
|
|
14
14
|
export type GridSlot = (typeof GRID_SLOTS)[number];
|
|
15
15
|
/** The flags the rendering styles, as `data-*` attributes present when true. */
|
|
16
16
|
export declare const GRID_STATES: readonly ["focused", "selected", "editing", "in-range", "range-edge", "pending", "invalid", "dragging", "empty", "frozen", "scrolled", "parked"];
|
|
17
17
|
export type GridState = (typeof GRID_STATES)[number];
|
|
18
|
-
/** The CSS variables the package owns: geometry and density. Its colours are `VK_COLOURS`, which the app declares.
|
|
19
|
-
|
|
18
|
+
/** The CSS variables the package owns: geometry and density. Its colours are `VK_COLOURS`, which the app declares.
|
|
19
|
+
* The last three are `densityStyle`'s, written on the root of a rows view an app draws itself. */
|
|
20
|
+
export declare const VK_TOKENS: readonly ["--vk-scale", "--vk-row-h", "--vk-head-h", "--vk-footer-h", "--vk-label-h", "--vk-line-h", "--vk-px", "--vk-tail-pl", "--vk-rail-w", "--vk-rail-gap", "--vk-tail-w", "--vk-indent", "--vk-frozen-w", "--vk-scroll-mt", "--vk-glyph", "--vk-head-glyph", "--vk-text", "--vk-text-xs", "--vk-text-10", "--vk-head-text", "--vk-scrolled", "--vk-parked", "--vk-frozen-on", "--vk-row-py", "--vk-head-mb", "--vk-row-gap"];
|
|
20
21
|
export type VkToken = (typeof VK_TOKENS)[number];
|
|
21
22
|
/** The colours the rendering paints, each a CSS variable the APP declares — the package
|
|
22
23
|
* sets none, and names no variable of the app's own. An app maps each onto its tokens once
|
|
@@ -31,24 +32,44 @@ export declare const VK_OPTIONAL_COLOURS: readonly ["--vk-success", "--vk-warnin
|
|
|
31
32
|
export type VkOptionalColour = (typeof VK_OPTIONAL_COLOURS)[number];
|
|
32
33
|
/** Layout the APP may declare, read with a built-in fallback. `--vk-gutter` is the side padding the
|
|
33
34
|
* page gives its content: the grid's rows run edge to edge and line their content up with it.
|
|
34
|
-
* Undeclared, it reads `0px` — a grid flush with its container.
|
|
35
|
-
|
|
35
|
+
* Undeclared, it reads `0px` — a grid flush with its container. `--vk-scroll-inset-bottom` is how
|
|
36
|
+
* much of the grid's foot the app covers with something it floats there (a phone's bottom bar):
|
|
37
|
+
* the grid's scroll area runs underneath it and its last row scrolls clear of it. Undeclared, it
|
|
38
|
+
* reads `0px`. The grid's headers pin inside its own scroll area, so nothing the app pins outside
|
|
39
|
+
* it concerns the grid. */
|
|
40
|
+
export declare const VK_OPTIONAL_LAYOUT: readonly ["--vk-gutter", "--vk-scroll-inset-bottom"];
|
|
36
41
|
export type VkOptionalLayout = (typeof VK_OPTIONAL_LAYOUT)[number];
|
|
42
|
+
/** The grid's own machinery, set and read by the grid alone: prefixed because they share the
|
|
43
|
+
* global namespace, and not public. An app neither sets nor reads them, and they may change in
|
|
44
|
+
* any release. `--vk-drag-shift` is a header cell's offset while its column is dragged;
|
|
45
|
+
* `--vk-cols` is the columns' template, set on the scroll area and read by every row. */
|
|
46
|
+
export declare const VK_INTERNAL: readonly ["--vk-drag-shift", "--vk-cols"];
|
|
47
|
+
export type VkInternal = (typeof VK_INTERNAL)[number];
|
|
48
|
+
/** Internal families: a prefix, one variable per key after it. `--vk-col-w-<id>` is one
|
|
49
|
+
* column's resolved width, set on the grid's root for every visible column. */
|
|
50
|
+
export declare const VK_INTERNAL_FAMILIES: readonly ["--vk-col-w-"];
|
|
37
51
|
/** The primitives an app hands in through the provider. */
|
|
38
52
|
export declare const COMPONENT_NAMES: readonly ["Button", "Popover", "Tooltip", "Checkbox", "Menu", "Command", "Calendar", "Collapse", "Sheet", "AppIcon", "Markdown"];
|
|
39
53
|
export type ComponentName = (typeof COMPONENT_NAMES)[number];
|
|
54
|
+
/** The primitives an app may hand in, each with a plain default the provider fills: apart from
|
|
55
|
+
* `COMPONENT_NAMES`, which lists the ones it must. */
|
|
56
|
+
export declare const OPTIONAL_COMPONENT_NAMES: readonly ["Input"];
|
|
57
|
+
export type OptionalComponentName = (typeof OPTIONAL_COMPONENT_NAMES)[number];
|
|
40
58
|
/** The pieces the rendering is built from, and the app's own pieces it cannot draw itself (a command cell's verb menu, the row's right-click menu, where a relation goes, a wait, how a list asks for more). Each ships as a default; an app swaps any of them through the provider's `atoms`. */
|
|
41
59
|
export declare const ATOM_NAMES: readonly ["Row", "RowContent", "TickBox", "StatusBadge", "StatusMarker", "Tag", "List", "CommandMenu", "RelationLink", "Loading", "LoadMore", "PlatformMark", "RowMenu"];
|
|
42
60
|
export type AtomName = (typeof ATOM_NAMES)[number];
|
|
43
61
|
/** The default atoms' `data-slot` values: prefixed, like the grid's. */
|
|
44
62
|
export declare const ATOM_SLOTS: readonly ["vk-row", "vk-row-content", "vk-tick", "vk-status", "vk-marker", "vk-tag", "vk-list", "vk-command-menu", "vk-relation-link", "vk-loading", "vk-load-more", "vk-platform", "vk-row-menu"];
|
|
45
63
|
export type AtomSlot = (typeof ATOM_SLOTS)[number];
|
|
64
|
+
/** The editor panel's `data-slot` values: prefixed, like the grid's. */
|
|
65
|
+
export declare const EDITOR_SLOTS: readonly ["vk-editor-panel", "vk-editor-bar", "vk-editor-refusal", "vk-text-editor"];
|
|
66
|
+
export type EditorSlot = (typeof EDITOR_SLOTS)[number];
|
|
46
67
|
/** The default atoms' states. `chosen`, `disabled`, `muted`, `checked` and `open` are
|
|
47
68
|
* flags present when true; `status` carries the slot's name. */
|
|
48
69
|
export declare const ATOM_STATES: readonly ["chosen", "disabled", "muted", "checked", "open", "status", "platform"];
|
|
49
70
|
export type AtomState = (typeof ATOM_STATES)[number];
|
|
50
71
|
/** The runtime services an app hands in through the provider. */
|
|
51
|
-
export declare const PORT_NAMES: readonly ["toast", "haptics", "clipboard", "viewPrefs"];
|
|
72
|
+
export declare const PORT_NAMES: readonly ["toast", "haptics", "clipboard", "viewPrefs", "confirm"];
|
|
52
73
|
export type PortName = (typeof PORT_NAMES)[number];
|
|
53
74
|
/** The glyphs the rendering asks the app for, by what they mean, never by a
|
|
54
75
|
* library's name. The app maps each to its own icon component. */
|
|
@@ -97,6 +118,25 @@ export type ViewsMessage = {
|
|
|
97
118
|
values: {
|
|
98
119
|
value: string;
|
|
99
120
|
};
|
|
121
|
+
} | {
|
|
122
|
+
key: "views.editors.discard";
|
|
123
|
+
} | {
|
|
124
|
+
key: "views.editors.save";
|
|
125
|
+
} | {
|
|
126
|
+
key: "views.editors.open-email";
|
|
127
|
+
values: {
|
|
128
|
+
value: string;
|
|
129
|
+
};
|
|
130
|
+
} | {
|
|
131
|
+
key: "views.editors.open-phone";
|
|
132
|
+
values: {
|
|
133
|
+
value: string;
|
|
134
|
+
};
|
|
135
|
+
} | {
|
|
136
|
+
key: "views.editors.open-link";
|
|
137
|
+
values: {
|
|
138
|
+
value: string;
|
|
139
|
+
};
|
|
100
140
|
} | {
|
|
101
141
|
key: "views.editors.place-country";
|
|
102
142
|
} | {
|
|
@@ -257,6 +297,8 @@ export type ViewsMessage = {
|
|
|
257
297
|
key: "views.menus.row-delete";
|
|
258
298
|
} | {
|
|
259
299
|
key: "views.menus.row-delete-confirm";
|
|
300
|
+
} | {
|
|
301
|
+
key: "views.menus.row-delete-failed";
|
|
260
302
|
} | {
|
|
261
303
|
key: "views.grid.figure";
|
|
262
304
|
values: {
|
|
@@ -306,6 +348,11 @@ export type ViewsMessage = {
|
|
|
306
348
|
key: "views.grid.cell-read-only";
|
|
307
349
|
} | {
|
|
308
350
|
key: "views.grid.clear-none";
|
|
351
|
+
} | {
|
|
352
|
+
key: "views.grid.clear-required";
|
|
353
|
+
values: {
|
|
354
|
+
fields: string;
|
|
355
|
+
};
|
|
309
356
|
} | {
|
|
310
357
|
key: "views.grid.write-not-list";
|
|
311
358
|
} | {
|
|
@@ -335,6 +382,16 @@ export type ViewsMessage = {
|
|
|
335
382
|
values: {
|
|
336
383
|
value: string;
|
|
337
384
|
};
|
|
385
|
+
} | {
|
|
386
|
+
key: "views.grid.paste-ambiguous-option";
|
|
387
|
+
values: {
|
|
388
|
+
value: string;
|
|
389
|
+
};
|
|
390
|
+
} | {
|
|
391
|
+
key: "views.grid.paste-other-currency";
|
|
392
|
+
values: {
|
|
393
|
+
currency: string;
|
|
394
|
+
};
|
|
338
395
|
} | {
|
|
339
396
|
key: "views.grid.paste-pick";
|
|
340
397
|
values: {
|
|
@@ -348,9 +405,16 @@ export type ViewsMessage = {
|
|
|
348
405
|
} | {
|
|
349
406
|
key: "views.grid.paste-not-range";
|
|
350
407
|
} | {
|
|
351
|
-
key: "views.grid.paste-
|
|
408
|
+
key: "views.grid.paste-skipped";
|
|
352
409
|
values: {
|
|
353
410
|
count: number;
|
|
411
|
+
reason: string;
|
|
412
|
+
};
|
|
413
|
+
} | {
|
|
414
|
+
key: "views.grid.fill-skipped";
|
|
415
|
+
values: {
|
|
416
|
+
count: number;
|
|
417
|
+
reason: string;
|
|
354
418
|
};
|
|
355
419
|
} | {
|
|
356
420
|
key: "views.grid.changed-elsewhere";
|
|
@@ -413,6 +477,13 @@ export type ViewsMessage = {
|
|
|
413
477
|
};
|
|
414
478
|
} | {
|
|
415
479
|
key: "views.display.phone-as-typed";
|
|
480
|
+
} | {
|
|
481
|
+
key: "views.display.converted-from";
|
|
482
|
+
values: {
|
|
483
|
+
code: string;
|
|
484
|
+
};
|
|
485
|
+
} | {
|
|
486
|
+
key: "views.display.as-shown";
|
|
416
487
|
};
|
|
417
488
|
export type ViewsMessageKey = ViewsMessage["key"];
|
|
418
489
|
/** A place's word, as a message key: the region, city or postal-code word a country's format names
|
|
@@ -422,7 +493,7 @@ export type PlaceWordKey = Extract<ViewsMessageKey, `views.editors.place-${"regi
|
|
|
422
493
|
export declare function placeWordKey(kind: "region", word: RegionWord): PlaceWordKey;
|
|
423
494
|
export declare function placeWordKey(kind: "city", word: CityWord): PlaceWordKey;
|
|
424
495
|
export declare function placeWordKey(kind: "postal", word: PostalWord): PlaceWordKey;
|
|
425
|
-
export declare const VIEWS_MESSAGE_KEYS: readonly ["views.editors.tag-remove", "views.editors.marker-resolve", "views.editors.marker-no-reason", "views.editors.range-low", "views.editors.range-high", "views.editors.name-given", "views.editors.name-family", "views.editors.name-full", "views.editors.values-add", "views.editors.values-label", "views.editors.values-main", "views.editors.values-make-main", "views.editors.values-remove", "views.editors.place-country", "views.editors.place-country-search", "views.editors.place-change-country", "views.editors.place-region-search", "views.editors.place-line1", "views.editors.place-line2", "views.editors.place-region-area", "views.editors.place-region-county", "views.editors.place-region-department", "views.editors.place-region-district", "views.editors.place-region-do-si", "views.editors.place-region-emirate", "views.editors.place-region-island", "views.editors.place-region-oblast", "views.editors.place-region-parish", "views.editors.place-region-prefecture", "views.editors.place-region-province", "views.editors.place-region-state", "views.editors.place-city-city", "views.editors.place-city-district", "views.editors.place-city-post-town", "views.editors.place-city-suburb", "views.editors.place-postal-eircode", "views.editors.place-postal-pin", "views.editors.place-postal-postal", "views.editors.place-postal-zip", "views.editors.place-required", "views.editors.place-region", "views.menus.part-row", "views.menus.sort-asc", "views.menus.sort-desc", "views.menus.sort-clear", "views.menus.group-by", "views.menus.ungroup", "views.menus.move-left", "views.menus.move-right", "views.menus.hide-column", "views.menus.format", "views.menus.date-style", "views.menus.show-time", "views.menus.duration-style", "views.menus.decimals", "views.menus.automatic", "views.menus.currency", "views.menus.percent-display", "views.menus.percent-display-option", "views.menus.colour", "views.menus.colours-reset", "views.menus.group-options", "views.menus.group-sort", "views.menus.search", "views.menus.group-show", "views.menus.group-count", "views.menus.group-hide", "views.menus.add-column-search", "views.menus.add-column-no-match", "views.menus.add-column-all-shown", "views.menus.copy", "views.menus.cut", "views.menus.paste", "views.menus.clear", "views.menus.edit", "views.menus.row-open", "views.menus.row-select", "views.menus.row-delete", "views.menus.row-delete-confirm", "views.grid.figure", "views.grid.figure-pick", "views.grid.add-column", "views.grid.loading", "views.grid.select-row", "views.grid.select-group", "views.grid.select-all", "views.grid.row-menu", "views.grid.group-expand", "views.grid.group-collapse", "views.grid.change-value", "views.grid.value", "views.grid.edit-value", "views.grid.read-only", "views.grid.read-only-why", "views.grid.locked", "views.grid.not-clearable", "views.grid.computed", "views.grid.cell-read-only", "views.grid.clear-none", "views.grid.write-not-list", "views.grid.write-not-boolean", "views.grid.write-marker", "views.grid.write-not-email", "views.grid.write-not-url", "views.grid.write-not-link", "views.grid.write-not-linkable", "views.grid.paste-refused", "views.grid.paste-empty", "views.grid.paste-not-number", "views.grid.paste-not-duration", "views.grid.paste-not-date", "views.grid.paste-not-option", "views.grid.paste-pick", "views.grid.paste-not-linkable", "views.grid.paste-not-range", "views.grid.paste-
|
|
496
|
+
export declare const VIEWS_MESSAGE_KEYS: readonly ["views.editors.tag-remove", "views.editors.marker-resolve", "views.editors.marker-no-reason", "views.editors.range-low", "views.editors.range-high", "views.editors.name-given", "views.editors.name-family", "views.editors.name-full", "views.editors.values-add", "views.editors.values-label", "views.editors.values-main", "views.editors.values-make-main", "views.editors.values-remove", "views.editors.discard", "views.editors.save", "views.editors.open-email", "views.editors.open-phone", "views.editors.open-link", "views.editors.place-country", "views.editors.place-country-search", "views.editors.place-change-country", "views.editors.place-region-search", "views.editors.place-line1", "views.editors.place-line2", "views.editors.place-region-area", "views.editors.place-region-county", "views.editors.place-region-department", "views.editors.place-region-district", "views.editors.place-region-do-si", "views.editors.place-region-emirate", "views.editors.place-region-island", "views.editors.place-region-oblast", "views.editors.place-region-parish", "views.editors.place-region-prefecture", "views.editors.place-region-province", "views.editors.place-region-state", "views.editors.place-city-city", "views.editors.place-city-district", "views.editors.place-city-post-town", "views.editors.place-city-suburb", "views.editors.place-postal-eircode", "views.editors.place-postal-pin", "views.editors.place-postal-postal", "views.editors.place-postal-zip", "views.editors.place-required", "views.editors.place-region", "views.menus.part-row", "views.menus.sort-asc", "views.menus.sort-desc", "views.menus.sort-clear", "views.menus.group-by", "views.menus.ungroup", "views.menus.move-left", "views.menus.move-right", "views.menus.hide-column", "views.menus.format", "views.menus.date-style", "views.menus.show-time", "views.menus.duration-style", "views.menus.decimals", "views.menus.automatic", "views.menus.currency", "views.menus.percent-display", "views.menus.percent-display-option", "views.menus.colour", "views.menus.colours-reset", "views.menus.group-options", "views.menus.group-sort", "views.menus.search", "views.menus.group-show", "views.menus.group-count", "views.menus.group-hide", "views.menus.add-column-search", "views.menus.add-column-no-match", "views.menus.add-column-all-shown", "views.menus.copy", "views.menus.cut", "views.menus.paste", "views.menus.clear", "views.menus.edit", "views.menus.row-open", "views.menus.row-select", "views.menus.row-delete", "views.menus.row-delete-confirm", "views.menus.row-delete-failed", "views.grid.figure", "views.grid.figure-pick", "views.grid.add-column", "views.grid.loading", "views.grid.select-row", "views.grid.select-group", "views.grid.select-all", "views.grid.row-menu", "views.grid.group-expand", "views.grid.group-collapse", "views.grid.change-value", "views.grid.value", "views.grid.edit-value", "views.grid.read-only", "views.grid.read-only-why", "views.grid.locked", "views.grid.not-clearable", "views.grid.computed", "views.grid.cell-read-only", "views.grid.clear-none", "views.grid.clear-required", "views.grid.write-not-list", "views.grid.write-not-boolean", "views.grid.write-marker", "views.grid.write-not-email", "views.grid.write-not-url", "views.grid.write-not-link", "views.grid.write-not-linkable", "views.grid.paste-refused", "views.grid.paste-empty", "views.grid.paste-not-number", "views.grid.paste-not-duration", "views.grid.paste-not-date", "views.grid.paste-not-option", "views.grid.paste-ambiguous-option", "views.grid.paste-other-currency", "views.grid.paste-pick", "views.grid.paste-not-linkable", "views.grid.paste-not-range", "views.grid.paste-skipped", "views.grid.fill-skipped", "views.grid.changed-elsewhere", "views.grid.changed-elsewhere-cells", "views.grid.saved-value", "views.grid.saved-values", "views.grid.row-left", "views.display.just-now", "views.display.in", "views.display.today", "views.display.yesterday", "views.display.tomorrow", "views.display.month", "views.display.not-an-option", "views.display.needs-attention", "views.display.boolean", "views.display.show-all", "views.display.show-more", "views.display.show-less", "views.display.phone-extension", "views.display.phone-as-typed", "views.display.converted-from", "views.display.as-shown"];
|
|
426
497
|
/** What an app hands in: its wording for every message. A resolver that words
|
|
427
498
|
* only some keys calls `resolveViewsMessage` for the rest; the provider does not. */
|
|
428
499
|
export type ViewsMessageResolver = (message: ViewsMessage) => string;
|