@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/dist/contract.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
export const VK_PREFIX = "vk";
|
|
2
2
|
export const GRID_SLOTS = [
|
|
3
3
|
"vk-grid",
|
|
4
|
+
"vk-grid-scroll",
|
|
5
|
+
"vk-grid-head",
|
|
4
6
|
"vk-grid-header",
|
|
5
7
|
"vk-grid-header-cell",
|
|
6
8
|
"vk-grid-row",
|
|
9
|
+
"vk-grid-rows",
|
|
10
|
+
"vk-grid-gap",
|
|
7
11
|
"vk-grid-cell",
|
|
8
12
|
"vk-grid-group",
|
|
13
|
+
"vk-grid-group-head",
|
|
9
14
|
"vk-grid-group-header",
|
|
10
15
|
"vk-grid-footer",
|
|
11
16
|
"vk-grid-footer-cell",
|
|
@@ -41,10 +46,8 @@ export const VK_TOKENS = [
|
|
|
41
46
|
"--vk-footer-h",
|
|
42
47
|
"--vk-label-h",
|
|
43
48
|
"--vk-line-h",
|
|
44
|
-
"--vk-chrome-h",
|
|
45
49
|
"--vk-px",
|
|
46
|
-
"--vk-
|
|
47
|
-
"--vk-tail-py",
|
|
50
|
+
"--vk-tail-pl",
|
|
48
51
|
"--vk-rail-w",
|
|
49
52
|
"--vk-rail-gap",
|
|
50
53
|
"--vk-tail-w",
|
|
@@ -60,6 +63,9 @@ export const VK_TOKENS = [
|
|
|
60
63
|
"--vk-scrolled",
|
|
61
64
|
"--vk-parked",
|
|
62
65
|
"--vk-frozen-on",
|
|
66
|
+
"--vk-row-py",
|
|
67
|
+
"--vk-head-mb",
|
|
68
|
+
"--vk-row-gap",
|
|
63
69
|
];
|
|
64
70
|
export const VK_COLOURS = [
|
|
65
71
|
"--vk-fg",
|
|
@@ -95,7 +101,9 @@ export const VK_OPTIONAL_COLOURS = [
|
|
|
95
101
|
"--vk-label-pink",
|
|
96
102
|
"--vk-label-teal",
|
|
97
103
|
];
|
|
98
|
-
export const VK_OPTIONAL_LAYOUT = ["--vk-gutter"];
|
|
104
|
+
export const VK_OPTIONAL_LAYOUT = ["--vk-gutter", "--vk-scroll-inset-bottom"];
|
|
105
|
+
export const VK_INTERNAL = ["--vk-drag-shift", "--vk-cols"];
|
|
106
|
+
export const VK_INTERNAL_FAMILIES = ["--vk-col-w-"];
|
|
99
107
|
export const COMPONENT_NAMES = [
|
|
100
108
|
"Button",
|
|
101
109
|
"Popover",
|
|
@@ -109,6 +117,7 @@ export const COMPONENT_NAMES = [
|
|
|
109
117
|
"AppIcon",
|
|
110
118
|
"Markdown",
|
|
111
119
|
];
|
|
120
|
+
export const OPTIONAL_COMPONENT_NAMES = ["Input"];
|
|
112
121
|
export const ATOM_NAMES = ["Row", "RowContent", "TickBox", "StatusBadge", "StatusMarker", "Tag", "List", "CommandMenu", "RelationLink", "Loading", "LoadMore", "PlatformMark", "RowMenu"];
|
|
113
122
|
export const ATOM_SLOTS = [
|
|
114
123
|
"vk-row",
|
|
@@ -125,8 +134,9 @@ export const ATOM_SLOTS = [
|
|
|
125
134
|
"vk-platform",
|
|
126
135
|
"vk-row-menu",
|
|
127
136
|
];
|
|
137
|
+
export const EDITOR_SLOTS = ["vk-editor-panel", "vk-editor-bar", "vk-editor-refusal", "vk-text-editor"];
|
|
128
138
|
export const ATOM_STATES = ["chosen", "disabled", "muted", "checked", "open", "status", "platform"];
|
|
129
|
-
export const PORT_NAMES = ["toast", "haptics", "clipboard", "viewPrefs"];
|
|
139
|
+
export const PORT_NAMES = ["toast", "haptics", "clipboard", "viewPrefs", "confirm"];
|
|
130
140
|
export const ICON_NAMES = [
|
|
131
141
|
"text",
|
|
132
142
|
"longText",
|
|
@@ -213,6 +223,11 @@ export const VIEWS_MESSAGE_KEYS = [
|
|
|
213
223
|
"views.editors.values-main",
|
|
214
224
|
"views.editors.values-make-main",
|
|
215
225
|
"views.editors.values-remove",
|
|
226
|
+
"views.editors.discard",
|
|
227
|
+
"views.editors.save",
|
|
228
|
+
"views.editors.open-email",
|
|
229
|
+
"views.editors.open-phone",
|
|
230
|
+
"views.editors.open-link",
|
|
216
231
|
"views.editors.place-country",
|
|
217
232
|
"views.editors.place-country-search",
|
|
218
233
|
"views.editors.place-change-country",
|
|
@@ -279,6 +294,7 @@ export const VIEWS_MESSAGE_KEYS = [
|
|
|
279
294
|
"views.menus.row-select",
|
|
280
295
|
"views.menus.row-delete",
|
|
281
296
|
"views.menus.row-delete-confirm",
|
|
297
|
+
"views.menus.row-delete-failed",
|
|
282
298
|
"views.grid.figure",
|
|
283
299
|
"views.grid.figure-pick",
|
|
284
300
|
"views.grid.add-column",
|
|
@@ -299,6 +315,7 @@ export const VIEWS_MESSAGE_KEYS = [
|
|
|
299
315
|
"views.grid.computed",
|
|
300
316
|
"views.grid.cell-read-only",
|
|
301
317
|
"views.grid.clear-none",
|
|
318
|
+
"views.grid.clear-required",
|
|
302
319
|
"views.grid.write-not-list",
|
|
303
320
|
"views.grid.write-not-boolean",
|
|
304
321
|
"views.grid.write-marker",
|
|
@@ -312,10 +329,13 @@ export const VIEWS_MESSAGE_KEYS = [
|
|
|
312
329
|
"views.grid.paste-not-duration",
|
|
313
330
|
"views.grid.paste-not-date",
|
|
314
331
|
"views.grid.paste-not-option",
|
|
332
|
+
"views.grid.paste-ambiguous-option",
|
|
333
|
+
"views.grid.paste-other-currency",
|
|
315
334
|
"views.grid.paste-pick",
|
|
316
335
|
"views.grid.paste-not-linkable",
|
|
317
336
|
"views.grid.paste-not-range",
|
|
318
|
-
"views.grid.paste-
|
|
337
|
+
"views.grid.paste-skipped",
|
|
338
|
+
"views.grid.fill-skipped",
|
|
319
339
|
"views.grid.changed-elsewhere",
|
|
320
340
|
"views.grid.changed-elsewhere-cells",
|
|
321
341
|
"views.grid.saved-value",
|
|
@@ -335,6 +355,8 @@ export const VIEWS_MESSAGE_KEYS = [
|
|
|
335
355
|
"views.display.show-less",
|
|
336
356
|
"views.display.phone-extension",
|
|
337
357
|
"views.display.phone-as-typed",
|
|
358
|
+
"views.display.converted-from",
|
|
359
|
+
"views.display.as-shown",
|
|
338
360
|
];
|
|
339
361
|
const _everyKeyListed = true;
|
|
340
362
|
void _everyKeyListed;
|
|
@@ -386,6 +408,7 @@ const DURATION_STYLE_WORDS = {
|
|
|
386
408
|
units: "Units",
|
|
387
409
|
};
|
|
388
410
|
const PERCENT_DISPLAY_WORDS = { text: "Number", bar: "Bar", ring: "Ring" };
|
|
411
|
+
const cellsWerent = (count) => (count === 1 ? "1 cell wasn't" : `${count} cells weren't`);
|
|
389
412
|
export function resolveViewsMessage(message) {
|
|
390
413
|
switch (message.key) {
|
|
391
414
|
case "views.editors.tag-remove":
|
|
@@ -414,6 +437,16 @@ export function resolveViewsMessage(message) {
|
|
|
414
437
|
return `Make ${message.values.value} the main one`;
|
|
415
438
|
case "views.editors.values-remove":
|
|
416
439
|
return `Remove ${message.values.value}`;
|
|
440
|
+
case "views.editors.discard":
|
|
441
|
+
return "Discard";
|
|
442
|
+
case "views.editors.save":
|
|
443
|
+
return "Save";
|
|
444
|
+
case "views.editors.open-email":
|
|
445
|
+
return `Email ${message.values.value}`;
|
|
446
|
+
case "views.editors.open-phone":
|
|
447
|
+
return `Call ${message.values.value}`;
|
|
448
|
+
case "views.editors.open-link":
|
|
449
|
+
return `Open ${message.values.value}`;
|
|
417
450
|
case "views.editors.place-country":
|
|
418
451
|
return "Country";
|
|
419
452
|
case "views.editors.place-country-search":
|
|
@@ -546,6 +579,8 @@ export function resolveViewsMessage(message) {
|
|
|
546
579
|
return "Delete";
|
|
547
580
|
case "views.menus.row-delete-confirm":
|
|
548
581
|
return "Delete this row?";
|
|
582
|
+
case "views.menus.row-delete-failed":
|
|
583
|
+
return "Failed to delete the row";
|
|
549
584
|
case "views.grid.figure":
|
|
550
585
|
return FIGURE_WORDS[message.values.kind];
|
|
551
586
|
case "views.grid.figure-pick":
|
|
@@ -586,6 +621,8 @@ export function resolveViewsMessage(message) {
|
|
|
586
621
|
return "Cell is read-only";
|
|
587
622
|
case "views.grid.clear-none":
|
|
588
623
|
return "Nothing in this selection can be emptied — the fields are required";
|
|
624
|
+
case "views.grid.clear-required":
|
|
625
|
+
return `Not emptied: ${message.values.fields} can't be empty`;
|
|
589
626
|
case "views.grid.write-not-list":
|
|
590
627
|
return "Not a list of values";
|
|
591
628
|
case "views.grid.write-not-boolean":
|
|
@@ -612,14 +649,20 @@ export function resolveViewsMessage(message) {
|
|
|
612
649
|
return "Not a date";
|
|
613
650
|
case "views.grid.paste-not-option":
|
|
614
651
|
return `“${message.values.value}” is not an option here`;
|
|
652
|
+
case "views.grid.paste-ambiguous-option":
|
|
653
|
+
return `“${message.values.value}” names more than one option`;
|
|
654
|
+
case "views.grid.paste-other-currency":
|
|
655
|
+
return `This record is in ${message.values.currency}`;
|
|
615
656
|
case "views.grid.paste-pick":
|
|
616
657
|
return `“${message.values.value}” can't be pasted here — pick it from the list`;
|
|
617
658
|
case "views.grid.paste-not-linkable":
|
|
618
659
|
return `“${message.values.value}” is not linkable here`;
|
|
619
660
|
case "views.grid.paste-not-range":
|
|
620
661
|
return "Not a range — try 11–50, 200+ or up to 50";
|
|
621
|
-
case "views.grid.paste-
|
|
622
|
-
return
|
|
662
|
+
case "views.grid.paste-skipped":
|
|
663
|
+
return `${cellsWerent(message.values.count)} pasted: ${message.values.reason}`;
|
|
664
|
+
case "views.grid.fill-skipped":
|
|
665
|
+
return `${cellsWerent(message.values.count)} filled: ${message.values.reason}`;
|
|
623
666
|
case "views.grid.changed-elsewhere":
|
|
624
667
|
return `${message.values.field} was changed elsewhere`;
|
|
625
668
|
case "views.grid.changed-elsewhere-cells":
|
|
@@ -659,5 +702,9 @@ export function resolveViewsMessage(message) {
|
|
|
659
702
|
return `ext. ${message.values.extension}`;
|
|
660
703
|
case "views.display.phone-as-typed":
|
|
661
704
|
return "Not yet in international form";
|
|
705
|
+
case "views.display.converted-from":
|
|
706
|
+
return `Converted from ${message.values.code}`;
|
|
707
|
+
case "views.display.as-shown":
|
|
708
|
+
return "as shown";
|
|
662
709
|
}
|
|
663
710
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A MONEY FIGURE SHOWN IN ANOTHER CURRENCY THAN ITS RECORD'S OWN. A surface reading a money column in a chosen
|
|
4
|
+
* currency draws the converted amount, while every editor opens on the amount the record stores, in the record's
|
|
5
|
+
* own currency. These two pieces are how the two read as one value, drawn the same way on every surface: the
|
|
6
|
+
* figure carries ≈ and a title naming the currency it came from, and the editor names the figure under the amount
|
|
7
|
+
* it opens on. `convertedFromOf` says when a column's figure is converted.
|
|
8
|
+
*/
|
|
9
|
+
/** The figure, marked: ≈ before it, and a title naming the currency it was converted from. */
|
|
10
|
+
export declare function ConvertedFigure({ from, children }: {
|
|
11
|
+
from: string;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}): ReactNode;
|
|
14
|
+
/** Under a money editor: the figure as the surface showed it, so the amount being edited and the one the person
|
|
15
|
+
* clicked read as one value. `figure` is the marked figure. */
|
|
16
|
+
export declare function ConversionLine({ figure, className }: {
|
|
17
|
+
figure: ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
}): ReactNode;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../internal/cx.js";
|
|
4
|
+
import { useViews } from "../provider/context.js";
|
|
5
|
+
export function ConvertedFigure({ from, children }) {
|
|
6
|
+
const { messages } = useViews();
|
|
7
|
+
return (_jsxs("span", { "data-converted": "", title: messages({ key: "views.display.converted-from", values: { code: from } }), className: "inline-flex min-w-0 max-w-full items-baseline gap-1 whitespace-nowrap", children: [_jsx("span", { className: "text-(color:--vk-fg-subtle)", children: "\u2248" }), children] }));
|
|
8
|
+
}
|
|
9
|
+
export function ConversionLine({ figure, className }) {
|
|
10
|
+
const { messages } = useViews();
|
|
11
|
+
return (_jsxs("p", { "data-slot": "vk-conversion", className: cx("flex items-baseline gap-1 text-xs text-(color:--vk-fg-subtle)", className), children: [figure, _jsx("span", { children: messages({ key: "views.display.as-shown" }) })] }));
|
|
12
|
+
}
|
package/dist/display/format.d.ts
CHANGED
|
@@ -36,12 +36,27 @@ export declare function formatNumberValue(value: number, format: NumberLikeForma
|
|
|
36
36
|
* both and the caller resolves which style won.
|
|
37
37
|
*/
|
|
38
38
|
export declare function formatDateValue(value: unknown, dateStyle: DateStyle | undefined, withTime?: boolean, kind?: TemporalKind, opts?: Pick<DisplayOptions, "presentation" | "viewer">): string;
|
|
39
|
+
/**
|
|
40
|
+
* An amount rendered in its OWN currency, with the right symbol and placement.
|
|
41
|
+
*
|
|
42
|
+
* Replaces four hand-rolled copies of `currency === "EUR" ? "€" : "$"`, which
|
|
43
|
+
* printed every RON amount as dollars — so a €53 Vodafone bill charged as 280
|
|
44
|
+
* RON rendered "$280.00" in the drawer, the hero and the history tab.
|
|
45
|
+
*
|
|
46
|
+
* Written as a money cell writes it (`formatNumberValue`, through the
|
|
47
|
+
* presentation's `number` for the viewer): hand it the display options a cell
|
|
48
|
+
* gets, and the amount reads in the viewer's locale and the app's look. With
|
|
49
|
+
* none, the default presentation and the neutral conventions (`en-GB`). The
|
|
50
|
+
* catch covers a code `Intl` doesn't accept, so a row with junk in the column
|
|
51
|
+
* still renders its number instead of throwing.
|
|
52
|
+
*/
|
|
53
|
+
export declare function formatMoney(amount: number | null | undefined, currency: string | null | undefined, decimals?: number, opts?: Pick<DisplayOptions, "presentation" | "viewer">): string;
|
|
39
54
|
/**
|
|
40
55
|
* THE unit-suffix look (a "/mo" after a price). Any renderer — a typed core, a
|
|
41
56
|
* custom cell, a group aggregate — uses this, so suffixes never diverge in style.
|
|
42
57
|
*
|
|
43
58
|
* Built with `createElement` rather than JSX because this module is the FORMAT
|
|
44
|
-
* module: its other
|
|
59
|
+
* module: its other exports are pure string functions that a Node-side
|
|
45
60
|
* consumer can import, and one 3-line node is not worth turning the file into a
|
|
46
61
|
* component module to get angle brackets.
|
|
47
62
|
*/
|
package/dist/display/format.js
CHANGED
|
@@ -174,8 +174,17 @@ export function formatDateValue(value, dateStyle, withTime, kind = "datetime", o
|
|
|
174
174
|
}
|
|
175
175
|
return out;
|
|
176
176
|
}
|
|
177
|
+
export function formatMoney(amount, currency, decimals = 2, opts) {
|
|
178
|
+
const code = (currency || "EUR").toUpperCase();
|
|
179
|
+
try {
|
|
180
|
+
return formatNumberValue(amount ?? 0, { style: "currency", currency: code }, { presentation: opts?.presentation, viewer: opts?.viewer, currency: code, decimals });
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
return `${code} ${(amount ?? 0).toFixed(decimals)}`;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
177
186
|
export function CellSuffix({ children }) {
|
|
178
187
|
return createElement("span", {
|
|
179
|
-
className: "ml-1 text-(length:--
|
|
188
|
+
className: "ml-1 text-(length:--vk-text-xs,0.75rem) font-normal text-(color:--vk-fg-subtlest)",
|
|
180
189
|
}, children);
|
|
181
190
|
}
|
package/dist/display/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { DISPLAY_CORES, renderFieldValue, type DisplayCore } from "./display-cores.js";
|
|
2
2
|
export { webHref } from "./web-href.js";
|
|
3
3
|
export type { DisplayOptions, FieldPresentation, FieldViewerContext, NumberLikeFormat, RelationWrap, } from "./options.js";
|
|
4
|
-
export { CellSuffix, DEFAULT_FIELD_PRESENTATION, formatDateValue, formatNumberValue } from "./format.js";
|
|
4
|
+
export { CellSuffix, DEFAULT_FIELD_PRESENTATION, formatDateValue, formatMoney, formatNumberValue, } from "./format.js";
|
|
5
5
|
export { viewerFrom } from "./viewer.js";
|
|
6
6
|
export { cellTextClass } from "./text-class.js";
|
|
7
7
|
export { MultiValueCell } from "./multi-value.js";
|
|
8
|
+
export { ConversionLine, ConvertedFigure } from "./converted.js";
|
|
8
9
|
export { CHIP_BASE, CHIP_INTERACTIVE } from "../internal/chip.js";
|
package/dist/display/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { DISPLAY_CORES, renderFieldValue } from "./display-cores.js";
|
|
2
2
|
export { webHref } from "./web-href.js";
|
|
3
|
-
export { CellSuffix, DEFAULT_FIELD_PRESENTATION, formatDateValue, formatNumberValue } from "./format.js";
|
|
3
|
+
export { CellSuffix, DEFAULT_FIELD_PRESENTATION, formatDateValue, formatMoney, formatNumberValue, } from "./format.js";
|
|
4
4
|
export { viewerFrom } from "./viewer.js";
|
|
5
5
|
export { cellTextClass } from "./text-class.js";
|
|
6
6
|
export { MultiValueCell } from "./multi-value.js";
|
|
7
|
+
export { ConversionLine, ConvertedFigure } from "./converted.js";
|
|
7
8
|
export { CHIP_BASE, CHIP_INTERACTIVE } from "../internal/chip.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DisplayOptions } from "./options.js";
|
|
2
|
+
/**
|
|
3
|
+
* A link whose plain click the host owns (`hostOwnsPlainClick`, the grid): marked as the cell's own, so the host
|
|
4
|
+
* tells it from a control, and not draggable, so a press on it is never the browser's link drag. Such a link carries no `data-no-nav`
|
|
5
|
+
* and stops no click: the click reaches the host, which follows the link only on a ⌘- or Ctrl-click. Null where the
|
|
6
|
+
* link owns its click, as by default.
|
|
7
|
+
*/
|
|
8
|
+
export declare function cellLinkProps(opts: DisplayOptions | undefined): {
|
|
9
|
+
"data-cell-link": "";
|
|
10
|
+
draggable: false;
|
|
11
|
+
} | null;
|
package/dist/display/link.js
CHANGED
|
@@ -4,6 +4,7 @@ import { useContext } from "react";
|
|
|
4
4
|
import { linkPlatform } from "@viewkitjs/fields";
|
|
5
5
|
import { cx } from "../internal/cx.js";
|
|
6
6
|
import { ViewsContext } from "../provider/context.js";
|
|
7
|
+
import { cellLinkProps } from "./link-click.js";
|
|
7
8
|
import { cellTextClass } from "./text-class.js";
|
|
8
9
|
import { renderValueList } from "./value-list.js";
|
|
9
10
|
import { webHref } from "./web-href.js";
|
|
@@ -19,7 +20,7 @@ function WebAddress({ address, opts }) {
|
|
|
19
20
|
const views = useContext(ViewsContext);
|
|
20
21
|
const label = address.replace(/^https?:\/\//, "");
|
|
21
22
|
const href = webHref(address);
|
|
22
|
-
const link = opts?.slotOwnsClick || href === null ? (_jsx("span", { className: cellTextClass(opts?.wrap), children: label })) : (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", "data-no-nav": true, className: cx(cellTextClass(opts?.wrap), "text-(color:--vk-fg-brand) hover:underline"), children: label }));
|
|
23
|
+
const link = opts?.slotOwnsClick || href === null ? (_jsx("span", { className: cellTextClass(opts?.wrap), children: label })) : (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", ...(cellLinkProps(opts) ?? { "data-no-nav": true }), className: cx(cellTextClass(opts?.wrap), "text-(color:--vk-fg-brand) hover:underline"), children: label }));
|
|
23
24
|
const platform = views && href !== null ? linkPlatform(address, views.conventions) : null;
|
|
24
25
|
if (!platform || !views)
|
|
25
26
|
return link;
|
|
@@ -34,15 +35,20 @@ function domainLink(domain, opts) {
|
|
|
34
35
|
const href = webHref(domain);
|
|
35
36
|
if (opts?.slotOwnsClick || href === null)
|
|
36
37
|
return _jsx("span", { className: cellTextClass(opts?.wrap), children: domain });
|
|
37
|
-
return (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", "data-no-nav": true, className: cx(cellTextClass(opts?.wrap), "text-(color:--vk-fg-brand) hover:underline"), children: domain }));
|
|
38
|
+
return (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", ...(cellLinkProps(opts) ?? { "data-no-nav": true }), className: cx(cellTextClass(opts?.wrap), "text-(color:--vk-fg-brand) hover:underline"), children: domain }));
|
|
38
39
|
}
|
|
39
40
|
export function renderEmail(_field, value, opts) {
|
|
40
41
|
if (Array.isArray(value))
|
|
41
|
-
return renderValueList(value, (one) => renderEmailAddress(String(one)), opts);
|
|
42
|
+
return renderValueList(value, (one) => renderEmailAddress(String(one), opts), opts);
|
|
42
43
|
if (value == null || value === "")
|
|
43
44
|
return null;
|
|
44
|
-
return renderValueList([value], (one) => renderEmailAddress(String(one)), opts);
|
|
45
|
+
return renderValueList([value], (one) => renderEmailAddress(String(one), opts), opts);
|
|
45
46
|
}
|
|
46
|
-
function renderEmailAddress(address) {
|
|
47
|
-
|
|
47
|
+
function renderEmailAddress(address, opts) {
|
|
48
|
+
if (opts?.slotOwnsClick)
|
|
49
|
+
return _jsx("span", { children: address });
|
|
50
|
+
return (_jsx("a", { href: `mailto:${address}`, ...(cellLinkProps(opts) ?? {
|
|
51
|
+
"data-no-nav": true,
|
|
52
|
+
onClick: (event) => event.stopPropagation(),
|
|
53
|
+
}), className: "text-(color:--vk-fg) underline decoration-dotted decoration-(color:--vk-fg-subtle)/40 decoration-1 underline-offset-[3px] transition-colors hover:decoration-(color:--vk-fg-subtle)/60", children: address }));
|
|
48
54
|
}
|
|
@@ -2,6 +2,7 @@ import { type FieldDefOf } from "@viewkitjs/fields";
|
|
|
2
2
|
import type { DisplayOptions } from "./options.js";
|
|
3
3
|
/** A place remains structured until the display boundary, then reads as one line. A cell draws it short, its city
|
|
4
4
|
* and its country (`locationShort`); a host with room for the whole value (`wrap: "full"`) draws the whole place
|
|
5
|
-
* (`locationText`). The country is named in the viewer's language
|
|
6
|
-
*
|
|
7
|
-
|
|
5
|
+
* (`locationText`). The country is named in the viewer's language: the host's viewer, else the provider's
|
|
6
|
+
* conventions, as the place editor names it (VK-120). A list of places (a lookup through a many relation, VK-63)
|
|
7
|
+
* draws through the several-values layout, each place written so. */
|
|
8
|
+
export declare function renderLocation(field: FieldDefOf<"location">, value: unknown, opts?: DisplayOptions): import("react/jsx-runtime").JSX.Element | null;
|
package/dist/display/location.js
CHANGED
|
@@ -2,14 +2,21 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { locationShort, locationText } from "@viewkitjs/fields";
|
|
4
4
|
import { MultiValueCell } from "./multi-value.js";
|
|
5
|
+
import { useDisplayOptions } from "./use-display-options.js";
|
|
5
6
|
export function renderLocation(field, value, opts) {
|
|
6
7
|
void field;
|
|
7
8
|
const write = opts?.wrap === "full" ? locationText : locationShort;
|
|
9
|
+
if (Array.isArray(value) ? !value.some((place) => write(place)) : !write(value))
|
|
10
|
+
return null;
|
|
11
|
+
return _jsx(PlaceValue, { value: value, opts: opts });
|
|
12
|
+
}
|
|
13
|
+
function PlaceValue({ value, opts: given }) {
|
|
14
|
+
const opts = useDisplayOptions(given);
|
|
15
|
+
const write = opts.wrap === "full" ? locationText : locationShort;
|
|
16
|
+
const locale = opts.viewer?.locale;
|
|
8
17
|
if (Array.isArray(value)) {
|
|
9
|
-
const places = value.map((place) => write(place,
|
|
10
|
-
|
|
11
|
-
return null;
|
|
12
|
-
return (_jsx(MultiValueCell, { items: places, wrap: !!opts?.wrap, title: places.join(", "), slotOwnsClick: opts?.slotOwnsClick }));
|
|
18
|
+
const places = value.map((place) => write(place, locale)).filter(Boolean);
|
|
19
|
+
return (_jsx(MultiValueCell, { items: places, wrap: !!opts.wrap, title: places.join(", "), slotOwnsClick: opts.slotOwnsClick }));
|
|
13
20
|
}
|
|
14
|
-
return write(value,
|
|
21
|
+
return write(value, locale);
|
|
15
22
|
}
|
|
@@ -6,7 +6,7 @@ export declare function MultiValueCell({ items, details, wrap, title, slotOwnsCl
|
|
|
6
6
|
items: ReactNode[];
|
|
7
7
|
/** One word per value drawn beside it in the popover (a value's label), never in the cell. */
|
|
8
8
|
details?: (string | null)[];
|
|
9
|
-
/**
|
|
9
|
+
/** Whether the values may flow onto more rows. BINARY here, unlike `DisplayOptions.wrap`
|
|
10
10
|
* — a chip list either flows onto more rows or does not; there is no
|
|
11
11
|
* uncapped state to ask for, because the overflow is a count, not a clip. */
|
|
12
12
|
wrap?: boolean;
|
|
@@ -15,7 +15,7 @@ export function MultiValueCell({ items, details, wrap, title, slotOwnsClick, })
|
|
|
15
15
|
return null;
|
|
16
16
|
const shown = items.slice(0, wrap ? VISIBLE_WRAPPED : VISIBLE_FLAT);
|
|
17
17
|
const hidden = items.length - shown.length;
|
|
18
|
-
const content = (_jsxs("span", { ref: anchor, className: cx("flex min-w-0 items-center gap-1", wrap && "flex-wrap gap-y-0.5"), title: title, children: [shown.map((item, index) => (_jsx("span", { className: "flex min-w-0 items-center truncate", children: item }, index))), hidden > 0 &&
|
|
18
|
+
const content = (_jsxs("span", { ref: anchor, className: cx("flex min-w-0 items-center gap-1", wrap && "flex-wrap gap-y-0.5"), title: title, children: [shown.map((item, index) => (_jsx("span", { className: "flex min-w-0 items-center truncate *:min-w-0 *:truncate", children: typeof item === "string" || typeof item === "number" ? _jsx("span", { children: item }) : item }, index))), hidden > 0 &&
|
|
19
19
|
(slotOwnsClick ? (_jsxs("span", { className: "shrink-0 text-[10px] leading-[0.9rem] text-(color:--vk-fg-subtle)", children: ["+", hidden] })) : (_jsxs("button", { ref: trigger, type: "button", tabIndex: -1, "data-no-nav": true, "aria-label": messages({ key: "views.display.show-all", values: { count: items.length } }), "aria-haspopup": "dialog", "aria-expanded": open, onClick: (event) => {
|
|
20
20
|
event.stopPropagation();
|
|
21
21
|
setOpen((current) => !current);
|
|
@@ -98,7 +98,7 @@ export type DisplayOptions = {
|
|
|
98
98
|
optionColors?: Record<string, CategoryColor>;
|
|
99
99
|
/**
|
|
100
100
|
* select/multiselect: the LIST's pre-registry label rule for a value no option
|
|
101
|
-
* names. Absent, a stray value renders as the muted "unknown" chip (
|
|
101
|
+
* names. Absent, a stray value renders as the muted "unknown" chip (fields' docs/guides/options.md)
|
|
102
102
|
* — a registry field never invents a label for a code its vocabulary refuses.
|
|
103
103
|
*/
|
|
104
104
|
labelFallback?: (value: string) => string;
|
|
@@ -114,7 +114,7 @@ export type DisplayOptions = {
|
|
|
114
114
|
/** percent: the workspace's display choice — wins over the field's `format.display`. */
|
|
115
115
|
percentDisplay?: PercentDisplay;
|
|
116
116
|
/**
|
|
117
|
-
* The
|
|
117
|
+
* The host's wrap: text-bearing values clamp to three lines instead of
|
|
118
118
|
* truncating. `"full"` is the third state — the whole value, newlines kept,
|
|
119
119
|
* no cap — which only a host with room asks for (`FieldRow`, for a
|
|
120
120
|
* `format.long` text field). See `cellTextClass`.
|
|
@@ -150,4 +150,10 @@ export type DisplayOptions = {
|
|
|
150
150
|
* shows its glyph with no toggle. Set once by the host, never per field.
|
|
151
151
|
*/
|
|
152
152
|
slotOwnsClick?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* A host whose plain click on a value is its own — the grid, where a click selects the cell. An email, a phone,
|
|
155
|
+
* a url and a domain still draw as links, marked `data-cell-link`, but no longer stop the click: it reaches the
|
|
156
|
+
* host, which follows the link only on a ⌘- or Ctrl-click. Set once by the host, never per field.
|
|
157
|
+
*/
|
|
158
|
+
hostOwnsPlainClick?: boolean;
|
|
153
159
|
};
|
package/dist/display/percent.js
CHANGED
|
@@ -24,10 +24,17 @@ function PercentValue({ field, n, opts: given }) {
|
|
|
24
24
|
return (_jsxs("span", { className: cx(cellTextClass(opts?.wrap), "tabular-nums", toneClass), children: [figure, _jsx(CellSuffix, { children: "%" })] }));
|
|
25
25
|
}
|
|
26
26
|
const clamped = Math.max(0, Math.min(100, n));
|
|
27
|
-
const figureSlot =
|
|
28
|
-
|
|
27
|
+
const figureSlot = `calc(${3 + decimals + (decimals > 0 ? 0.5 : 0) + 1.25}ch + 0.25rem)`;
|
|
28
|
+
const figureRoom = "calc(100% + var(--vk-px, 0px))";
|
|
29
|
+
const figureNode = (bar) => (_jsxs("span", { className: cx("shrink-0 text-right tabular-nums", bar && "truncate", toneClass), style: bar
|
|
30
|
+
? { width: "max-content", minWidth: `min(${figureSlot}, ${figureRoom})`, maxWidth: figureRoom }
|
|
31
|
+
: { width: figureSlot }, children: [figure, _jsx(CellSuffix, { children: "%" })] }));
|
|
32
|
+
if (display === "bar") {
|
|
33
|
+
return (_jsxs("span", { className: "flex h-lh w-full min-w-0 flex-1 flex-row-reverse flex-wrap content-start items-center gap-x-2 overflow-y-clip", style: { maxWidth: `calc(6rem + 0.5rem + ${figureSlot})` }, children: [figureNode(true), _jsx("span", { className: "h-1.5 min-w-6 flex-1 overflow-hidden rounded-full bg-(color:--vk-neutral)", "aria-hidden": true, children: _jsx("span", { className: "block h-full bg-(color:--vk-brand)", style: { width: `${clamped}%` } }) })] }));
|
|
34
|
+
}
|
|
35
|
+
return (_jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [_jsx("span", { className: "h-4 w-4 shrink-0 rounded-full", style: {
|
|
29
36
|
background: `conic-gradient(var(--vk-brand) ${clamped}%, var(--vk-neutral) 0)`,
|
|
30
37
|
WebkitMaskImage: RING_MASK,
|
|
31
38
|
maskImage: RING_MASK,
|
|
32
|
-
}, "aria-hidden": true })
|
|
39
|
+
}, "aria-hidden": true }), figureNode(false)] }));
|
|
33
40
|
}
|
package/dist/display/phone.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { DisplayOptions } from "./options.js";
|
|
|
5
5
|
* A phone in its international form, written the way its country writes it for a viewer at home (the viewer's
|
|
6
6
|
* region, from the conventions) and internationally for anyone else, its extension in the package's words after
|
|
7
7
|
* it, dialled by its RFC 3966 link. A phone stored as typed, before phones had one form, is drawn as before (its
|
|
8
|
-
* text, a link of its digits and a leading `+`) and flagged as not yet in the international form.
|
|
8
|
+
* text, a link of its digits and a leading `+`) and flagged as not yet in the international form. The viewer is
|
|
9
|
+
* the host's, else the provider's conventions and words (VK-120).
|
|
9
10
|
*/
|
|
10
11
|
export declare function renderPhone(_field: FieldDefOf<"phone">, value: unknown, opts?: DisplayOptions): ReactNode;
|
package/dist/display/phone.js
CHANGED
|
@@ -4,11 +4,19 @@ import { phoneHref, phoneText, readPhone } from "@viewkitjs/fields/phone";
|
|
|
4
4
|
import { resolveViewsMessage } from "../contract.js";
|
|
5
5
|
import { cx } from "../internal/cx.js";
|
|
6
6
|
import { CHIP_INTERACTIVE } from "../internal/chip.js";
|
|
7
|
+
import { cellLinkProps } from "./link-click.js";
|
|
7
8
|
import { cellTextClass } from "./text-class.js";
|
|
9
|
+
import { useDisplayOptions } from "./use-display-options.js";
|
|
8
10
|
import { renderValueList } from "./value-list.js";
|
|
9
11
|
export function renderPhone(_field, value, opts) {
|
|
12
|
+
if (!Array.isArray(value) && !readPhone(value))
|
|
13
|
+
return null;
|
|
14
|
+
return _jsx(PhoneValue, { value: value, opts: opts });
|
|
15
|
+
}
|
|
16
|
+
function PhoneValue({ value, opts: given }) {
|
|
17
|
+
const opts = useDisplayOptions(given);
|
|
10
18
|
if (Array.isArray(value))
|
|
11
|
-
return renderValueList(value, (one) => phoneNode(one,
|
|
19
|
+
return renderValueList(value, (one) => phoneNode(one, { ...opts, wrap: false }), opts, (one) => phoneLine(one, opts) ?? String(one));
|
|
12
20
|
return phoneNode(value, opts);
|
|
13
21
|
}
|
|
14
22
|
function phoneLine(value, opts) {
|
|
@@ -34,5 +42,6 @@ function phoneNode(value, opts) {
|
|
|
34
42
|
if (opts?.slotOwnsClick) {
|
|
35
43
|
return (_jsx("span", { className: cellTextClass(opts?.wrap), ...asTyped, children: text }));
|
|
36
44
|
}
|
|
37
|
-
|
|
45
|
+
const owned = cellLinkProps(opts);
|
|
46
|
+
return (_jsx("a", { href: phoneHref(value) ?? undefined, ...(owned ?? { "data-no-nav": true, onClick: (event) => event.stopPropagation() }), className: CHIP_INTERACTIVE, ...asTyped, children: _jsx("span", { className: cx("min-w-0", cellTextClass(opts?.wrap)), children: text }) }));
|
|
38
47
|
}
|
package/dist/display/relation.js
CHANGED
|
@@ -13,7 +13,7 @@ export function renderRelation(field, value, opts) {
|
|
|
13
13
|
.filter((entry) => entry != null));
|
|
14
14
|
if (chips.length === 0)
|
|
15
15
|
return null;
|
|
16
|
-
return (_jsx(MultiValueCell, { items: chips.map((chip) => _jsx(RelationChip, { relation: chip, opts: opts })), wrap: !!opts?.wrap, title: chips.map((chip) => chip.label).join(", "), slotOwnsClick: opts?.slotOwnsClick }));
|
|
16
|
+
return (_jsx(MultiValueCell, { items: chips.map((chip) => _jsx(RelationChip, { relation: chip, opts: opts }, `${chip.entity ?? ""}:${chip.id}`)), wrap: !!opts?.wrap, title: chips.map((chip) => chip.label).join(", "), slotOwnsClick: opts?.slotOwnsClick }));
|
|
17
17
|
}
|
|
18
18
|
const relation = resolveRelationValue(value, relationKinds(field)[0]);
|
|
19
19
|
if (!relation)
|
|
@@ -23,10 +23,12 @@ import type { PickerOption } from "./SelectEditor.js";
|
|
|
23
23
|
* through them. That is also why a pick does NOT close this core — it is the
|
|
24
24
|
* one that never sees the `pick` reason.
|
|
25
25
|
*
|
|
26
|
-
* ## Its close rule
|
|
26
|
+
* ## Its close rule
|
|
27
27
|
*
|
|
28
|
-
* An outside click COMMITS (you built a set; leaving keeps it) and
|
|
29
|
-
*
|
|
28
|
+
* An outside click COMMITS (you built a set; leaving keeps it), Tab and
|
|
29
|
+
* Shift-Tab commit too and move on, and Escape DISCARDS, as the date editor's
|
|
30
|
+
* does. The pickers that end on a pick (the
|
|
31
|
+
* select, the relation) cancel on both. Closing unchanged is a noop —
|
|
30
32
|
* the dirty check is `sameListValue`, the same one the commit path uses, so
|
|
31
33
|
* opening a cell to look at it never writes to it.
|
|
32
34
|
*/
|
|
@@ -52,8 +54,11 @@ export declare const ChipsEditor: import("react").ForwardRefExoticComponent<{
|
|
|
52
54
|
* added value goes through it on the way in — the same function the route
|
|
53
55
|
* applies, so `Ops Team` and `ops-team` cannot come apart. */
|
|
54
56
|
normalize?: (raw: string) => string;
|
|
55
|
-
/** The core saw a key that means "done" (Escape). Picks never close it. */
|
|
57
|
+
/** The core saw a key that means "done" (Escape, Tab, Shift-Tab). Picks never close it. */
|
|
56
58
|
onRequestClose: (reason: CloseReason) => void;
|
|
57
59
|
/** The host's words for this panel (fields' messages); default: the provider's conventions. */
|
|
58
60
|
message?: FieldMessageResolver;
|
|
61
|
+
/** Offer a row that adds the typed text when nothing held or offered is it. Default true; a closed
|
|
62
|
+
* vocabulary passes false, and its search only filters what it offers. */
|
|
63
|
+
creatable?: boolean;
|
|
59
64
|
} & import("react").RefAttributes<ChipsEditorHandle>>;
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState, } from "react";
|
|
4
4
|
import { sameListValue, } from "@viewkitjs/fields";
|
|
5
5
|
import { useViews } from "../provider/context.js";
|
|
6
|
-
export const ChipsEditor = forwardRef(function ChipsEditor({ values, suggestions, resolve, normalize, onRequestClose, message }, ref) {
|
|
6
|
+
export const ChipsEditor = forwardRef(function ChipsEditor({ values, suggestions, resolve, normalize, onRequestClose, message, creatable = true }, ref) {
|
|
7
7
|
const [draft, setDraft] = useState(values);
|
|
8
8
|
const [search, setSearch] = useState("");
|
|
9
9
|
const inputRef = useRef(null);
|
|
@@ -27,7 +27,7 @@ export const ChipsEditor = forwardRef(function ChipsEditor({ values, suggestions
|
|
|
27
27
|
setDraft(next);
|
|
28
28
|
};
|
|
29
29
|
useEffect(() => {
|
|
30
|
-
inputRef.current?.focus();
|
|
30
|
+
inputRef.current?.focus({ preventScroll: true });
|
|
31
31
|
}, []);
|
|
32
32
|
const clean = (raw) => (normalize ? normalize(raw) : raw.trim());
|
|
33
33
|
const rows = useMemo(() => suggestions.filter((value) => !draft.includes(value)), [suggestions, draft]);
|
|
@@ -37,7 +37,7 @@ export const ChipsEditor = forwardRef(function ChipsEditor({ values, suggestions
|
|
|
37
37
|
: rows;
|
|
38
38
|
const typed = clean(search);
|
|
39
39
|
const needle = typed.toLowerCase();
|
|
40
|
-
const canAdd = typed !== "" && ![...draft, ...rows].some((value) => value.toLowerCase() === needle);
|
|
40
|
+
const canAdd = creatable && typed !== "" && ![...draft, ...rows].some((value) => value.toLowerCase() === needle);
|
|
41
41
|
const add = (value) => {
|
|
42
42
|
if (!draftRef.current.includes(value))
|
|
43
43
|
setBoth([...draftRef.current, value]);
|
|
@@ -66,6 +66,10 @@ export const ChipsEditor = forwardRef(function ChipsEditor({ values, suggestions
|
|
|
66
66
|
onFieldKeyDown(event);
|
|
67
67
|
if (event.key === "Escape")
|
|
68
68
|
onRequestClose("escape");
|
|
69
|
+
if (event.key === "Tab") {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
onRequestClose(event.shiftKey ? "shift-tab" : "tab");
|
|
72
|
+
}
|
|
69
73
|
}, placeholder: draft.length === 0 ? words({ key: "chips.add-placeholder" }) : "", className: "h-5 min-w-20 flex-1 bg-transparent text-[13px] outline-hidden placeholder:text-(color:--vk-fg-subtlest)" })] }), _jsxs(Command.List, { className: "max-h-64 overscroll-contain scrollbar-overlay", children: [visible.length === 0 && !canAdd && (_jsx(Command.Empty, { className: "py-4 text-center text-xs text-(color:--vk-fg-subtle)", children: rows.length === 0 ? words({ key: "chips.everything-picked" }) : words({ key: "editor.nothing-matches" }) })), _jsx(Command.Group, { className: "p-0", children: _jsxs(List, { children: [visible.map((value) => {
|
|
70
74
|
const option = resolve(value);
|
|
71
75
|
return (_jsx(Command.Item, { value: value, onSelect: () => add(value), children: _jsx(RowContent, { size: "compact", label: _jsx(Tag, { label: option.label, color: option.color ?? "gray" }) }) }, value));
|