@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
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { GridEditorId } from "../../model/column-types.js";
|
|
3
|
+
import { type ListSettingsConfig } from "../../model/column-capabilities.js";
|
|
4
|
+
import type { ListColumn, ListSelectColor } from "../../model/column-schema.js";
|
|
5
|
+
/** Everything an editor needs about the cell it is mounting into. */
|
|
6
|
+
export type GridCellEditorContext<Row> = {
|
|
7
|
+
row: Row;
|
|
8
|
+
rowId: string;
|
|
9
|
+
col: ListColumn<Row>;
|
|
10
|
+
editorKind: GridEditorId | null;
|
|
11
|
+
/** The cell opened to be READ, not written: a long text the column, the
|
|
12
|
+
* workspace or the list will not let this user edit. The panel shows the
|
|
13
|
+
* value read-only and never commits. */
|
|
14
|
+
readOnly: boolean;
|
|
15
|
+
/** The value the editor opens on — pending overlay applied. */
|
|
16
|
+
baseline: unknown;
|
|
17
|
+
/** Type-to-replace seed: the character that opened this editor, or null. */
|
|
18
|
+
editSeed?: string | null;
|
|
19
|
+
/** The text was cut off in its cell when it opened: it shows whole in the panel over the cell
|
|
20
|
+
* (`gridTextOpensBox`), editable or read-only. Default false. */
|
|
21
|
+
whole?: boolean;
|
|
22
|
+
decimals?: number;
|
|
23
|
+
selectValues?: string[];
|
|
24
|
+
optionColors?: Record<string, ListSelectColor>;
|
|
25
|
+
/** This app's glyph for an entity kind — the relation picker dresses its
|
|
26
|
+
* candidates with it, so a row in the list carries the same icon the cell
|
|
27
|
+
* will show once it is picked. */
|
|
28
|
+
entityIcon?: (kind: string | undefined) => ReactNode;
|
|
29
|
+
/** The list's settings, read when the editor closes: a column locked while its editor was open
|
|
30
|
+
* keeps the editor open with the lock's sentence. */
|
|
31
|
+
listConfig?: ListSettingsConfig;
|
|
32
|
+
onCommitCell: (row: Row, rowId: string, columnId: string, prev: unknown, next: unknown, opts?: {
|
|
33
|
+
overlay?: boolean;
|
|
34
|
+
}) => void;
|
|
35
|
+
onCancel: () => void;
|
|
36
|
+
onTab: (backwards: boolean) => void;
|
|
37
|
+
onEnter: () => void;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The INLINE editors — the ones that replace the cell's own content while open.
|
|
41
|
+
*
|
|
42
|
+
* Returns null for every other case so the caller can fall through to the
|
|
43
|
+
* cell's normal render. In particular `text` is matched explicitly, never as a
|
|
44
|
+
* bare else: it is the last arm of the chain, and an unguarded fallback would
|
|
45
|
+
* mount a text input on top of an open picker, and on any editor-less type that
|
|
46
|
+
* ever reaches `editing`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function GridCellInlineEditor<Row>({ ctx }: {
|
|
49
|
+
ctx: GridCellEditorContext<Row>;
|
|
50
|
+
}): ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* The ANCHORED editors (select popover, date calendar). They hang off the END
|
|
53
|
+
* of the cell rather than wrapping its value, because the value has to keep its
|
|
54
|
+
* DOM NODE across the editing boundary.
|
|
55
|
+
*
|
|
56
|
+
* Both leave the cell's own content on screen behind an anchored overlay, so
|
|
57
|
+
* the natural shape is `<>{value}{editor}</>` while editing and a bare
|
|
58
|
+
* `{value}` otherwise. Those are different element types at the same position:
|
|
59
|
+
* React tears the value's node down on every commit and mounts a fresh one
|
|
60
|
+
* already showing the new value — so `transition-colors` on a status/category
|
|
61
|
+
* badge has no "from" state and the change SNAPS instead of fading. (The batch
|
|
62
|
+
* path never enters an editor, which is why it always faded.) Rendered as a
|
|
63
|
+
* sibling, the value's branch is identical whether or not the cell is editing,
|
|
64
|
+
* the node survives, and the commit is a plain className change it can animate.
|
|
65
|
+
*
|
|
66
|
+
* Position is free: both are absolutely-anchored and portal their content, so
|
|
67
|
+
* they contribute no layout. Do not "tidy" them back into the inline chain.
|
|
68
|
+
*/
|
|
69
|
+
export declare function GridCellAnchoredEditor<Row>({ ctx, }: {
|
|
70
|
+
ctx: GridCellEditorContext<Row>;
|
|
71
|
+
}): ReactNode;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { numberEditCode, numberEditDecimals } from "../../fields/number-edit.js";
|
|
5
|
+
import { convertedFromOf } from "../../fields/money.js";
|
|
6
|
+
import { renderTypedCellValue } from "../../cells/cell-values.js";
|
|
7
|
+
import { legacyFieldFromColumn } from "../../cells/legacy-field.js";
|
|
8
|
+
import { isOpenableType } from "../../editors/open-value.js";
|
|
9
|
+
import { isIntegerField, isMultipleType, isNameValue, isRangeValue, phoneText, rangeDecimals, relationIdOf, relationKey, relationLinksOf, relationStoredOf, valueTypeOf, } from "@viewkitjs/fields";
|
|
10
|
+
import { GridNameEditor } from "./GridNameEditor.js";
|
|
11
|
+
import { GridPlaceEditor } from "./GridPlaceEditor.js";
|
|
12
|
+
import { GridValueListEditor } from "./GridValueListEditor.js";
|
|
13
|
+
import { cellPrevPayload } from "./cell-clipboard.js";
|
|
14
|
+
import { GridChipsEditor, GridDateEditor, GridLongTextEditor, GridNumberEditor, GridRangeEditor, GridRelationEditor, GridRelationSetEditor, GridSelectEditor, GridTextEditor, } from "./editors.js";
|
|
15
|
+
import { gridTextEditorType } from "./GridTextEditor.js";
|
|
16
|
+
import { gridTextOpensBox, isLongTextColumn } from "../../model/column-inspect.js";
|
|
17
|
+
import { gridClearRefusal, gridColumnEffectiveClearable, gridColumnLocked, gridEditRefusal, gridNormalizeWrite, } from "../../model/column-capabilities.js";
|
|
18
|
+
import { useViews } from "../../provider/context.js";
|
|
19
|
+
import { gridRelationSource } from "../../model/column-types.js";
|
|
20
|
+
function useCellRefusal(col, listConfig, region) {
|
|
21
|
+
const { conventions, messages } = useViews();
|
|
22
|
+
return (next, prev) => {
|
|
23
|
+
if (gridColumnLocked(col, listConfig))
|
|
24
|
+
return gridEditRefusal(col, listConfig, conventions, messages) ?? null;
|
|
25
|
+
const result = gridNormalizeWrite(col, next, conventions, { messages, stored: prev, region });
|
|
26
|
+
return result.ok ? null : result.reason;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function GridCellInlineEditor({ ctx }) {
|
|
30
|
+
const { row, rowId, col, baseline, onCommitCell, onCancel, onTab, onEnter } = ctx;
|
|
31
|
+
const refusal = useCellRefusal(col, ctx.listConfig, col.region?.(row));
|
|
32
|
+
if (ctx.editorKind === "number") {
|
|
33
|
+
const integer = col.field ? isIntegerField(col.field) : false;
|
|
34
|
+
const fallback = col.field ? numberEditDecimals(col.field) : (col.format?.decimals ?? 2);
|
|
35
|
+
const durationUnit = col.format?.style === "duration" ? (col.format.unit ?? "ms") : undefined;
|
|
36
|
+
return (_jsx(GridNumberEditor, { title: col.header, initial: typeof baseline === "number" ? baseline : Number.NaN, seed: ctx.editSeed ?? undefined, unit: col.editUnit?.value(row), unitOptions: col.editUnit?.options, code: col.editUnit ? undefined : numberEditCode(col.field ?? legacyFieldFromColumn(col)), decimals: integer ? 0 : (ctx.decimals ?? fallback), durationUnit: durationUnit, allowEmpty: !!col.clearable, unitLeft: col.align === "right", conversion: convertedFromOf(col, row) ? renderTypedCellValue(col, row, { decimals: ctx.decimals }) : undefined, refuse: (payload) => refusal(payload, cellPrevPayload(col, baseline, col.editUnit?.value(row))), onCommit: (payload) => onCommitCell(row, rowId, col.id, cellPrevPayload(col, baseline, col.editUnit?.value(row)), payload, { overlay: false }), onCancel: onCancel, onTab: onTab, onEnter: onEnter }));
|
|
37
|
+
}
|
|
38
|
+
if (ctx.editorKind === "range") {
|
|
39
|
+
const def = col.field?.type === "range" ? col.field : undefined;
|
|
40
|
+
return (_jsx(GridRangeEditor, { title: col.header, initial: isRangeValue(baseline) ? baseline : null, seed: ctx.editSeed ?? undefined, decimals: def ? rangeDecimals(def) : 0, allowEmpty: !!col.clearable, suffix: def?.of === "percent" ? "%" : def?.of === "currency" ? def.code?.fixed : undefined, bands: def?.presets, refuse: (payload) => refusal(payload, baseline), onCommit: (payload) => onCommitCell(row, rowId, col.id, baseline, payload, { overlay: false }), onCancel: onCancel, onTab: onTab, onEnter: onEnter }));
|
|
41
|
+
}
|
|
42
|
+
if (ctx.editorKind === "text" && !gridTextOpensBox(col, !!ctx.whole)) {
|
|
43
|
+
const phone = col.type === "phone";
|
|
44
|
+
const stored = phone ? phoneText(baseline, null) : String(baseline ?? "");
|
|
45
|
+
return (_jsx(GridTextEditor, { initial: stored, seed: ctx.editSeed ?? undefined, type: gridTextEditorType(col.type), title: col.header, strong: col.type === "title", open: isOpenableType(col.type) && baseline != null && baseline !== ""
|
|
46
|
+
? { type: col.type, value: baseline }
|
|
47
|
+
: undefined, refuse: (value) => refusal(value, phone ? baseline : stored), onCommit: (value) => onCommitCell(row, rowId, col.id, phone ? baseline : stored, value), onCancel: onCancel, onTab: onTab, onEnter: onEnter }));
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
export function GridCellAnchoredEditor({ ctx, }) {
|
|
52
|
+
const { row, rowId, col, baseline, onCommitCell, onCancel } = ctx;
|
|
53
|
+
const region = col.region?.(row);
|
|
54
|
+
const refusal = useCellRefusal(col, ctx.listConfig, region);
|
|
55
|
+
const { messages } = useViews();
|
|
56
|
+
const relationSource = useMemo(() => gridRelationSource(col, ctx.entityIcon), [col, ctx.entityIcon]);
|
|
57
|
+
if (ctx.editorKind === "text" && gridTextOpensBox(col, !!ctx.whole)) {
|
|
58
|
+
const paragraph = isLongTextColumn(col);
|
|
59
|
+
return (_jsx(GridLongTextEditor, { paragraph: paragraph, type: paragraph ? undefined : gridTextEditorType(col.type), initial: String(baseline ?? ""), seed: ctx.editSeed ?? undefined, readOnly: ctx.readOnly, markdown: col.type === "rich_text", title: col.header, refuse: (value) => refusal(value, String(baseline ?? "")), onCommit: (value) => onCommitCell(row, rowId, col.id, String(baseline ?? ""), value), onCancel: onCancel, onTab: ctx.onTab, onEnter: ctx.onEnter }));
|
|
60
|
+
}
|
|
61
|
+
if (ctx.editorKind === "select") {
|
|
62
|
+
return (_jsx(GridSelectEditor, { column: col, title: col.header, values: ctx.selectValues ?? (col.options ?? []).map((o) => o.value), current: String(baseline ?? ""), clearable: !!col.clearable, seed: ctx.editSeed ?? undefined, optionColors: ctx.optionColors, refuse: (value) => refusal(value, String(baseline ?? "")), onCommit: (value) => onCommitCell(row, rowId, col.id, String(baseline ?? ""), value), onCancel: onCancel }));
|
|
63
|
+
}
|
|
64
|
+
if (ctx.editorKind === "chips") {
|
|
65
|
+
const current = Array.isArray(baseline) ? baseline.map(String) : [];
|
|
66
|
+
return (_jsx(GridChipsEditor, { column: col, title: col.header, values: current, suggestions: ctx.selectValues ?? (col.options ?? []).map((option) => option.value), optionColors: ctx.optionColors, refuse: (next) => refusal(next, current), onCommit: (next) => onCommitCell(row, rowId, col.id, current, next), onCancel: onCancel, onTab: ctx.onTab }));
|
|
67
|
+
}
|
|
68
|
+
if (ctx.editorKind === "relation") {
|
|
69
|
+
const field = col.field?.type === "relation" ? col.field : undefined;
|
|
70
|
+
const create = field ? col.relation?.create : undefined;
|
|
71
|
+
const prev = field ? storedPrev(field, baseline) : relationIdOf(baseline);
|
|
72
|
+
const write = (next, from = prev) => onCommitCell(row, rowId, col.id, from, next, { overlay: false });
|
|
73
|
+
if (field?.cardinality === "many") {
|
|
74
|
+
const stored = (links) => relationStoredOf(field, links);
|
|
75
|
+
return (_jsx(GridRelationSetEditor, { title: col.header, candidates: relationSource, current: relationSetItems(field, baseline, col.accessor?.(row), relationSource, ctx.entityIcon, col.relation?.entity), lead: field.links?.primary === "flag", seed: ctx.editSeed ?? undefined, create: create, refuse: (links) => refusal(stored(links), prev), onCommit: (links) => write(stored(links)), onLink: (base, added) => write(stored([...base, added]), stored(base)), onCancel: onCancel, onTab: ctx.onTab }));
|
|
76
|
+
}
|
|
77
|
+
const one = (id, kind) => field
|
|
78
|
+
? relationStoredOf(field, id == null ? [] : [{ id, ...(kind !== undefined ? { kind } : {}) }])
|
|
79
|
+
: id;
|
|
80
|
+
return (_jsx(GridRelationEditor, { title: col.header, candidates: relationSource, current: relationIdOf(baseline), clearable: !!col.clearable, seed: ctx.editSeed ?? undefined, create: create, refuse: (id, kind) => refusal(one(id, kind), prev), onCommit: (id, kind) => write(one(id, kind)), onLink: (id, kind) => write(one(id, kind)), onCancel: onCancel }));
|
|
81
|
+
}
|
|
82
|
+
if (ctx.editorKind === "name") {
|
|
83
|
+
return (_jsx(GridNameEditor, { title: col.header, initial: isNameValue(baseline) ? baseline : null, seed: ctx.editSeed ?? undefined, allowEmpty: !!col.clearable, onCommit: (payload) => onCommitCell(row, rowId, col.id, baseline, payload, { overlay: false }), onCancel: onCancel, onTab: ctx.onTab, onEnter: ctx.onEnter }));
|
|
84
|
+
}
|
|
85
|
+
if (ctx.editorKind === "values" && col.field && isMultipleType(col.field.type)) {
|
|
86
|
+
return (_jsx(GridValueListEditor, { field: col.field, title: col.header, initial: baseline, labels: col.labels !== false, region: region, allowEmpty: true, refuse: (payload) => payload == null && !gridColumnEffectiveClearable(col, ctx.listConfig)
|
|
87
|
+
? gridClearRefusal(col, ctx.listConfig, messages)
|
|
88
|
+
: refusal(payload, baseline), onCommit: (payload) => onCommitCell(row, rowId, col.id, baseline, payload, { overlay: false }), onCancel: onCancel, onTab: ctx.onTab, onEnter: ctx.onEnter }));
|
|
89
|
+
}
|
|
90
|
+
if (ctx.editorKind === "place" && col.field && valueTypeOf(col.field) === "location") {
|
|
91
|
+
const initial = baseline && typeof baseline === "object" && !Array.isArray(baseline)
|
|
92
|
+
? baseline
|
|
93
|
+
: null;
|
|
94
|
+
return (_jsx(GridPlaceEditor, { field: col.field, title: col.header, initial: initial, refuse: (place) => place === null && !gridColumnEffectiveClearable(col, ctx.listConfig)
|
|
95
|
+
? gridClearRefusal(col, ctx.listConfig, messages)
|
|
96
|
+
: refusal(place, baseline), onCommit: (place) => onCommitCell(row, rowId, col.id, baseline, place, { overlay: false }), onCancel: onCancel, onTab: ctx.onTab, onEnter: ctx.onEnter }));
|
|
97
|
+
}
|
|
98
|
+
if (ctx.editorKind === "date") {
|
|
99
|
+
return (_jsx(GridDateEditor, { title: col.header, initial: String(baseline ?? "") || undefined, dayOnly: col.field?.type === "date", clearable: gridColumnEffectiveClearable(col, ctx.listConfig), seed: ctx.editSeed ?? undefined, refuse: (ymd) => ymd === "" && !gridColumnEffectiveClearable(col, ctx.listConfig)
|
|
100
|
+
? gridClearRefusal(col, ctx.listConfig, messages)
|
|
101
|
+
: refusal(ymd, cellPrevPayload(col, baseline)), onCommit: (ymd) => onCommitCell(row, rowId, col.id, cellPrevPayload(col, baseline), ymd, ymd === "" ? undefined : { overlay: false }), onCancel: onCancel, onTab: ctx.onTab }));
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
function storedPrev(field, baseline) {
|
|
106
|
+
const shown = Array.isArray(baseline)
|
|
107
|
+
? baseline.some((item) => relationKey(item) != null)
|
|
108
|
+
: relationKey(baseline) != null;
|
|
109
|
+
return shown ? relationStoredOf(field, relationLinksOf(field, baseline)) : baseline;
|
|
110
|
+
}
|
|
111
|
+
function relationSetItems(field, baseline, shown, source, entityIcon, defaultKind) {
|
|
112
|
+
const labels = new Map();
|
|
113
|
+
if (source.kind === "static")
|
|
114
|
+
for (const item of source.items)
|
|
115
|
+
labels.set(item.id, { label: item.label, icon: item.icon });
|
|
116
|
+
for (const item of Array.isArray(shown) ? shown : [shown]) {
|
|
117
|
+
const id = relationKey(item);
|
|
118
|
+
if (id != null)
|
|
119
|
+
labels.set(id, { ...labels.get(id), label: item.label });
|
|
120
|
+
}
|
|
121
|
+
return relationLinksOf(field, baseline).map((link) => {
|
|
122
|
+
const known = labels.get(link.id);
|
|
123
|
+
const icon = known?.icon ?? entityIcon?.(link.kind ?? defaultKind);
|
|
124
|
+
return { ...link, label: known?.label ?? link.id, ...(icon != null ? { icon } : {}) };
|
|
125
|
+
});
|
|
126
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** A frozen cell's paint for its row's state: the ground and the row's hover, or, on a selected
|
|
2
|
+
* row, the ground with the selection tint and its own hover. One answer per state, so no class has
|
|
3
|
+
* to beat another (`cx` joins, it does not merge). */
|
|
4
|
+
export declare function gridFrozenBg(selected: boolean): string;
|
|
5
|
+
/**
|
|
6
|
+
* NOTE: the frozen block has NO edge treatment on ANY surface — header, rows and
|
|
7
|
+
* footer all end flat, and a frozen cell renders exactly like an unfrozen one.
|
|
8
|
+
* Nothing advertises that a column is pinned.
|
|
9
|
+
*
|
|
10
|
+
* The header used to fade its last frozen cell out over 72px (a mask, so the
|
|
11
|
+
* cell's whole output ramped down together — background, hover tint, border and
|
|
12
|
+
* label). It was removed: rows and footer were always flat, so the soft edge
|
|
13
|
+
* made the header the odd one out, and the mask took the resize hairline with it
|
|
14
|
+
* (alpha ~0 at the cell's right edge, where the handle lives).
|
|
15
|
+
*
|
|
16
|
+
* Rows had already rejected the same idea for their own reason: a mask fades the
|
|
17
|
+
* row's `border-b` and hover tint too, leaving a notch in every horizontal rule
|
|
18
|
+
* and a pale patch in the highlight at the Name column's edge — multiplied by
|
|
19
|
+
* the row count.
|
|
20
|
+
*/
|
|
21
|
+
export declare const GRID_CELL_HOVER_SHADOW = "hover:shadow-[0_1px_2px_rgb(0_0_0/0.05)] dark:hover:shadow-[0_1px_2px_rgb(0_0_0/0.22)]";
|
|
22
|
+
/**
|
|
23
|
+
* The quiet pointer affordance: a 1px neutral ring on the cell under the
|
|
24
|
+
* pointer, drawn as the hovered cell's OWN `::after`. The pseudo-element exists
|
|
25
|
+
* only while the cell is hovered, so no cell carries an element for it: one
|
|
26
|
+
* ring for the whole table, wherever the pointer is, with no script and no
|
|
27
|
+
* redraw. Applied to the cell by `gridCellClassName`, gated with
|
|
28
|
+
* GRID_CELL_HOVER_SHADOW: the line and the lift always appear together.
|
|
29
|
+
*
|
|
30
|
+
* Literal 4px radius (`rounded-sm`): this repo's named radius tokens start at
|
|
31
|
+
* 10px, which on a 37px-tall cell reads as a lozenge, not a softened rectangle.
|
|
32
|
+
* Do not swap it for a token.
|
|
33
|
+
*
|
|
34
|
+
* The outward shadow is on the cell itself (GRID_CELL_HOVER_SHADOW), not here:
|
|
35
|
+
* this ring sits at inset-0, exactly the cell's padding box, and a resting cell
|
|
36
|
+
* is `overflow-hidden`, so an outward shadow declared on it would paint outside
|
|
37
|
+
* the clip and render as nothing. An element's own box-shadow is not clipped by
|
|
38
|
+
* its own overflow — hence the split.
|
|
39
|
+
*
|
|
40
|
+
* The strong line rung: a step louder than the cell rules around it, so the
|
|
41
|
+
* hovered cell reads as an edge among hairlines. This ring is the token's only
|
|
42
|
+
* consumer (hairlines ratchet).
|
|
43
|
+
*/
|
|
44
|
+
export declare const GRID_CELL_HOVER_RING = "hover:after:pointer-events-none hover:after:absolute hover:after:inset-0 hover:after:z-1 hover:after:rounded-sm hover:after:border hover:after:border-(color:--vk-border-bold)";
|
|
45
|
+
/** The selection ring, in the same geometry the hover ring draws. */
|
|
46
|
+
export declare function GridCellOutline({ editing, }: {
|
|
47
|
+
/** Lifts the cell with a drop shadow to read as a live input. */
|
|
48
|
+
editing?: boolean;
|
|
49
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../../internal/cx.js";
|
|
3
|
+
import { GRID_GROUND } from "./grid-styles.js";
|
|
4
|
+
const GRID_FROZEN_HOVER = "group-hover/gridrow:bg-[linear-gradient(var(--vk-hovered),var(--vk-hovered))]";
|
|
5
|
+
const GRID_FROZEN_BG_SELECTED = "bg-[linear-gradient(var(--vk-brand-subtlest),var(--vk-brand-subtlest))]";
|
|
6
|
+
const GRID_FROZEN_BG_SELECTED_HOVER = "group-hover/gridrow:bg-[linear-gradient(color-mix(in_oklab,_var(--vk-brand)_10%,_transparent),color-mix(in_oklab,_var(--vk-brand)_10%,_transparent)),linear-gradient(var(--vk-brand-subtlest),var(--vk-brand-subtlest))]";
|
|
7
|
+
export function gridFrozenBg(selected) {
|
|
8
|
+
return selected
|
|
9
|
+
? cx(GRID_GROUND, GRID_FROZEN_BG_SELECTED, GRID_FROZEN_BG_SELECTED_HOVER)
|
|
10
|
+
: cx(GRID_GROUND, GRID_FROZEN_HOVER);
|
|
11
|
+
}
|
|
12
|
+
export const GRID_CELL_HOVER_SHADOW = "hover:shadow-[0_1px_2px_rgb(0_0_0/0.05)] dark:hover:shadow-[0_1px_2px_rgb(0_0_0/0.22)]";
|
|
13
|
+
export const GRID_CELL_HOVER_RING = "hover:after:pointer-events-none hover:after:absolute hover:after:inset-0 hover:after:z-1 hover:after:rounded-sm hover:after:border hover:after:border-(color:--vk-border-bold)";
|
|
14
|
+
export function GridCellOutline({ editing = false, }) {
|
|
15
|
+
return (_jsx("span", { "aria-hidden": true, "data-slot": "vk-grid-outline", className: cx("pointer-events-none absolute inset-0 z-1 rounded-sm border", editing ? "border-(color:--vk-border-brand)" : "border-(color:--vk-fg-subtle) group-hover/gridcell:border-(color:--vk-border-brand)", editing && "shadow-lg shadow-black/20 dark:shadow-black/50") }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { ListColumn, ListSelectColor } from "../../model/column-schema.js";
|
|
3
|
+
/**
|
|
4
|
+
* The GRID's host around the shared `ChipsEditor` (`@viewkitjs/views/editors/chips`) —
|
|
5
|
+
* the set-editing panel is one component across every surface. The edit session
|
|
6
|
+
* owns the one-answer guard and the exit gap; the editor panel opens the popover on
|
|
7
|
+
* a desktop and the sheet on a phone. This host owns the anchor on the cell rect,
|
|
8
|
+
* the labels and colours, and the write.
|
|
9
|
+
*
|
|
10
|
+
* Telling Escape from an outside click matters more here than anywhere else,
|
|
11
|
+
* because the two mean OPPOSITE things for a set: Escape discards the session,
|
|
12
|
+
* an outside click keeps what you built. The panel tells them apart before
|
|
13
|
+
* either reaches the popover's `onOpenChange`; on a phone ✓ keeps the set and
|
|
14
|
+
* ✕ or a swipe discards it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function GridChipsEditor<Row>({ column, title, values, suggestions, optionColors, refuse, onCommit, onCancel, onTab, }: {
|
|
17
|
+
/** Read for its declared `options` — the labels and colours the cell uses. */
|
|
18
|
+
column: ListColumn<Row>;
|
|
19
|
+
/** The field's name: the sheet's title on a phone. */
|
|
20
|
+
title: ReactNode;
|
|
21
|
+
/** The cell's current values. */
|
|
22
|
+
values: string[];
|
|
23
|
+
/** What this column holds on screen, from `deriveGridSelectValues`. An open
|
|
24
|
+
* field's values the list's source answers come first (`useOpenValues`), as
|
|
25
|
+
* the Filter panel offers them, so a value you can set is one you can then
|
|
26
|
+
* filter for. */
|
|
27
|
+
suggestions: string[];
|
|
28
|
+
/** This column's per-user colour overrides, so a badge here is the badge the
|
|
29
|
+
* cell draws. */
|
|
30
|
+
optionColors?: Record<string, ListSelectColor>;
|
|
31
|
+
onCommit: (next: string[]) => void;
|
|
32
|
+
onCancel: () => void;
|
|
33
|
+
/** Tab and Shift-Tab saved the set: the grid moves to the next cell, or the one before. */
|
|
34
|
+
onTab?: (backwards: boolean) => void;
|
|
35
|
+
/** The grid's judgement of a value before it is written: its reason when it would refuse it.
|
|
36
|
+
* A refused value keeps the editor open with that reason. */
|
|
37
|
+
refuse?: (value: string[]) => string | null;
|
|
38
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import { ChipsEditor } from "../../editors/ChipsEditor.js";
|
|
5
|
+
import { EditorPanel } from "../../editors/EditorPanel.js";
|
|
6
|
+
import { resolveCategoryColor } from "@viewkitjs/fields/design/category-colors";
|
|
7
|
+
import { prettifyOptionValue } from "../../model/column-state.js";
|
|
8
|
+
import { optionValues } from "@viewkitjs/fields";
|
|
9
|
+
import { offeredValues, takesNewValues, useOpenValues } from "../../editors/open-values.js";
|
|
10
|
+
import { useGridEditSession } from "./grid-edit-session.js";
|
|
11
|
+
export function GridChipsEditor({ column, title, values, suggestions, optionColors, refuse, onCommit, onCancel, onTab, }) {
|
|
12
|
+
const editorRef = useRef(null);
|
|
13
|
+
const anchorRef = useRef(null);
|
|
14
|
+
const { session, close } = useGridEditSession({
|
|
15
|
+
editorRef,
|
|
16
|
+
refuse: refuse && ((value) => refuse(value)),
|
|
17
|
+
onCommit: (next) => onCommit(next),
|
|
18
|
+
onCancel,
|
|
19
|
+
onTab,
|
|
20
|
+
});
|
|
21
|
+
const known = useOpenValues(column.field);
|
|
22
|
+
const field = column.field?.type === "multiselect" ? column.field : undefined;
|
|
23
|
+
const open = field ? takesNewValues(field) : true;
|
|
24
|
+
const offered = !column.field
|
|
25
|
+
? suggestions
|
|
26
|
+
: field && !open
|
|
27
|
+
? optionValues(field)
|
|
28
|
+
: offeredValues(column.field, known, suggestions);
|
|
29
|
+
const resolve = (value) => ({
|
|
30
|
+
value,
|
|
31
|
+
label: column.options?.find((option) => option.value === value)?.label ?? prettifyOptionValue(value),
|
|
32
|
+
color: resolveCategoryColor(value, column.options, optionColors),
|
|
33
|
+
});
|
|
34
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, panelData: { "data-slot": "vk-grid-editor" }, onPanelClick: (event) => event.stopPropagation(), chrome: "menu", className: "w-64 z-90", children: _jsx(ChipsEditor, { ref: editorRef, values: values, suggestions: offered, resolve: resolve, normalize: column.chips?.normalize, creatable: open, onRequestClose: close }) })] }));
|
|
35
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ListColumn, ListSelectColor } from "../../model/column-schema.js";
|
|
2
|
+
import { type GridFlyouts } from "./GridFlyout.js";
|
|
3
|
+
export declare function GridColumnColorSection<Row>({ column, values, optionColors, flyouts, onOptionColorChange, onClose, }: {
|
|
4
|
+
column: ListColumn<Row>;
|
|
5
|
+
values: string[];
|
|
6
|
+
optionColors?: Record<string, ListSelectColor>;
|
|
7
|
+
flyouts: GridFlyouts;
|
|
8
|
+
/** Called with the FIELD key — the format map's key on every surface. */
|
|
9
|
+
onOptionColorChange: (key: string, value: string, color: ListSelectColor | null) => void;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { CATEGORY_DOT_CLASSES, resolveCategoryColor, } from "@viewkitjs/fields/design/category-colors";
|
|
4
|
+
import { prettifyOptionValue } from "../../model/column-state.js";
|
|
5
|
+
import { fieldKeyOf } from "../../model/view-rules.js";
|
|
6
|
+
import { useViews } from "../../provider/context.js";
|
|
7
|
+
import { cx } from "../../internal/cx.js";
|
|
8
|
+
import { GridFlyoutRow } from "./GridFlyout.js";
|
|
9
|
+
import { GridMenuSeparator } from "./GridMenuRow.js";
|
|
10
|
+
const COLOR_DOTS = CATEGORY_DOT_CLASSES;
|
|
11
|
+
const ALL_COLORS = [
|
|
12
|
+
"gray",
|
|
13
|
+
"blue",
|
|
14
|
+
"green",
|
|
15
|
+
"amber",
|
|
16
|
+
"red",
|
|
17
|
+
"purple",
|
|
18
|
+
"pink",
|
|
19
|
+
"teal",
|
|
20
|
+
];
|
|
21
|
+
export function GridColumnColorSection({ column, values, optionColors, flyouts, onOptionColorChange, onClose, }) {
|
|
22
|
+
const { atoms, messages } = useViews();
|
|
23
|
+
const { Row, Tag } = atoms;
|
|
24
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "max-h-72 overflow-y-auto overscroll-contain", children: values.map((value) => {
|
|
25
|
+
const resolved = resolveCategoryColor(value, column.options, optionColors);
|
|
26
|
+
return (_jsxs(GridFlyoutRow, { id: `color:${value}`, flyouts: flyouts, title: prettifyOptionValue(value), label: _jsx(Tag, { label: column.options?.find((option) => option.value === value)?.label ??
|
|
27
|
+
prettifyOptionValue(value), color: resolved }), children: [_jsx(Row, { chosen: !optionColors?.[value], label: messages({ key: "views.menus.automatic" }), leading: _jsx("span", { className: "h-2.5 w-2.5 rounded-full border border-(color:--vk-border)" }), onClick: () => {
|
|
28
|
+
onOptionColorChange(fieldKeyOf(column), value, null);
|
|
29
|
+
flyouts.close();
|
|
30
|
+
} }), ALL_COLORS.map((color) => (_jsx(Row, { chosen: resolved === color, label: messages({ key: "views.menus.colour", values: { colour: color } }), leading: _jsx("span", { className: cx("h-2.5 w-2.5 rounded-full", COLOR_DOTS[color]) }), onClick: () => {
|
|
31
|
+
onOptionColorChange(fieldKeyOf(column), value, color);
|
|
32
|
+
flyouts.close();
|
|
33
|
+
} }, color)))] }, value));
|
|
34
|
+
}) }), optionColors && Object.keys(optionColors).length > 0 && (_jsxs(_Fragment, { children: [_jsx(GridMenuSeparator, {}), _jsx(Row, { label: messages({ key: "views.menus.colours-reset" }), onClick: () => {
|
|
35
|
+
for (const value of Object.keys(optionColors)) {
|
|
36
|
+
onOptionColorChange(fieldKeyOf(column), value, null);
|
|
37
|
+
}
|
|
38
|
+
onClose();
|
|
39
|
+
} })] }))] }));
|
|
40
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ListColumn } from "../../model/column-schema.js";
|
|
2
|
+
import type { ListDateStyle } from "../../model/column-format.js";
|
|
3
|
+
import { type GridFlyouts } from "./GridFlyout.js";
|
|
4
|
+
/**
|
|
5
|
+
* The date-column row in the header menu — one Format row whose flyout holds
|
|
6
|
+
* the styles (each beside a live sample) and, on a date-time, Show time —
|
|
7
|
+
* split out of GridColumnMenu because that file is held under the component
|
|
8
|
+
* ratchet's line ceiling rather than grown to hold them; the policy there is
|
|
9
|
+
* split, not raise (the same reason GridColumnColorSection and
|
|
10
|
+
* GridColumnDurationSection are their own files rather than inline).
|
|
11
|
+
*/
|
|
12
|
+
export declare function GridColumnDateSection<Row>({ column, dateStyle, onDateStyleChange, showTime, onShowTimeChange, flyouts, onClose, }: {
|
|
13
|
+
column: ListColumn<Row>;
|
|
14
|
+
/** This column's date-style override. */
|
|
15
|
+
dateStyle?: ListDateStyle;
|
|
16
|
+
/** Both handlers are called with the FIELD key — the format map's key. */
|
|
17
|
+
onDateStyleChange: (key: string, style: ListDateStyle) => void;
|
|
18
|
+
/** Resolved show-time (override → declared `format.withTime`). */
|
|
19
|
+
showTime?: boolean;
|
|
20
|
+
onShowTimeChange?: (key: string, show: boolean) => void;
|
|
21
|
+
flyouts: GridFlyouts;
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { temporalKindOf } from "../../model/field-type-of.js";
|
|
4
|
+
import { fieldKeyOf } from "../../model/view-rules.js";
|
|
5
|
+
import { formatDate } from "./cells.js";
|
|
6
|
+
import { useCellFormat } from "../../cells/use-cell-format.js";
|
|
7
|
+
import { useViews } from "../../provider/context.js";
|
|
8
|
+
import { GridFlyoutRow } from "./GridFlyout.js";
|
|
9
|
+
import { GridMenuSeparator, KnobGlyph } from "./GridMenuRow.js";
|
|
10
|
+
const DATE_STYLES = ["short", "long", "numeric", "relative"];
|
|
11
|
+
const sampleDate = () => new Date(Date.now() - 3 * 86_400_000);
|
|
12
|
+
export function GridColumnDateSection({ column, dateStyle, onDateStyleChange, showTime, onShowTimeChange, flyouts, onClose, }) {
|
|
13
|
+
const activeDateStyle = dateStyle ?? column.format?.dateStyle ?? "short";
|
|
14
|
+
const sample = sampleDate();
|
|
15
|
+
const { viewer } = useCellFormat();
|
|
16
|
+
const { atoms, messages } = useViews();
|
|
17
|
+
const { Row } = atoms;
|
|
18
|
+
const styleLabel = (style) => messages({ key: "views.menus.date-style", values: { style } });
|
|
19
|
+
return (_jsxs(GridFlyoutRow, { id: "date-format", flyouts: flyouts, label: messages({ key: "views.menus.format" }), detail: styleLabel(activeDateStyle), leading: _jsx(KnobGlyph, { name: "calendar" }), children: [DATE_STYLES.map((style) => (_jsx(Row, { chosen: activeDateStyle === style, label: styleLabel(style), detail: _jsx("span", { className: "max-w-30 truncate", children: formatDate(sample, column, style, false, viewer) }), onClick: () => {
|
|
20
|
+
onDateStyleChange(fieldKeyOf(column), style);
|
|
21
|
+
onClose();
|
|
22
|
+
} }, style))), onShowTimeChange && temporalKindOf(column) === "datetime" && (_jsxs(_Fragment, { children: [_jsx(GridMenuSeparator, {}), _jsx(Row, { chosen: !!showTime, label: messages({ key: "views.menus.show-time" }), onClick: () => onShowTimeChange(fieldKeyOf(column), !showTime) })] }))] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ListColumn } from "../../model/column-schema.js";
|
|
2
|
+
import type { ListDurationStyle } from "../../model/column-format.js";
|
|
3
|
+
import { type GridFlyouts } from "./GridFlyout.js";
|
|
4
|
+
/**
|
|
5
|
+
* The duration-column row in the header menu — one Format row whose flyout
|
|
6
|
+
* holds the styles — split out of GridColumnMenu because that file is held
|
|
7
|
+
* under the component ratchet's line ceiling rather than grown to hold them;
|
|
8
|
+
* the policy there is split, not raise (the same reason GridColumnColorSection
|
|
9
|
+
* is its own file rather than inline).
|
|
10
|
+
*/
|
|
11
|
+
export declare function GridColumnDurationSection<Row>({ column, durationStyle, onDurationStyleChange, flyouts, onClose, }: {
|
|
12
|
+
column: ListColumn<Row>;
|
|
13
|
+
/** This column's duration-rendering override. */
|
|
14
|
+
durationStyle?: ListDurationStyle;
|
|
15
|
+
/** Called with the FIELD key — the format map's key on every surface. */
|
|
16
|
+
onDurationStyleChange: (key: string, style: ListDurationStyle) => void;
|
|
17
|
+
flyouts: GridFlyouts;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { fieldKeyOf } from "../../model/view-rules.js";
|
|
4
|
+
import { formatNumber } from "./cells.js";
|
|
5
|
+
import { useCellFormat } from "../../cells/use-cell-format.js";
|
|
6
|
+
import { useViews } from "../../provider/context.js";
|
|
7
|
+
import { GridFlyoutRow } from "./GridFlyout.js";
|
|
8
|
+
import { KnobGlyph } from "./GridMenuRow.js";
|
|
9
|
+
const DURATION_STYLES = ["adaptive", "clock", "units"];
|
|
10
|
+
const DURATION_SAMPLE_MS = 5_904_000;
|
|
11
|
+
export function GridColumnDurationSection({ column, durationStyle, onDurationStyleChange, flyouts, onClose, }) {
|
|
12
|
+
const activeDurationStyle = durationStyle ?? column.format?.durationStyle ?? "adaptive";
|
|
13
|
+
const cellFormat = useCellFormat();
|
|
14
|
+
const { atoms, messages } = useViews();
|
|
15
|
+
const { Row } = atoms;
|
|
16
|
+
const styleLabel = (style) => messages({ key: "views.menus.duration-style", values: { style } });
|
|
17
|
+
return (_jsx(GridFlyoutRow, { id: "duration-format", flyouts: flyouts, label: messages({ key: "views.menus.format" }), detail: styleLabel(activeDurationStyle), leading: _jsx(KnobGlyph, { name: "duration" }), children: DURATION_STYLES.map((style) => (_jsx(Row, { chosen: activeDurationStyle === style, label: styleLabel(style), detail: _jsx("span", { className: "max-w-30 truncate", children: formatNumber(DURATION_SAMPLE_MS, column, {
|
|
18
|
+
...cellFormat,
|
|
19
|
+
durationStyle: style,
|
|
20
|
+
}) }), onClick: () => {
|
|
21
|
+
onDurationStyleChange(fieldKeyOf(column), style);
|
|
22
|
+
onClose();
|
|
23
|
+
} }, style))) }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type MouseEvent as ReactMouseEvent, type ReactElement, type ReactNode, type Ref } from "react";
|
|
2
|
+
import type { PercentDisplay } from "@viewkitjs/fields";
|
|
3
|
+
import type { OrderDir } from "../../grouping/sort-groups.js";
|
|
4
|
+
import type { ListColumn, ListSelectColor } from "../../model/column-schema.js";
|
|
5
|
+
import type { ListDateStyle, ListDurationStyle, ListNumberFormatState } from "../../model/column-format.js";
|
|
6
|
+
/** What the menu sets on the header cell it opens from. */
|
|
7
|
+
type TriggerProps = {
|
|
8
|
+
ref?: Ref<HTMLElement>;
|
|
9
|
+
onClick?: (event: ReactMouseEvent<HTMLElement>) => void;
|
|
10
|
+
role?: "button" | "columnheader";
|
|
11
|
+
"aria-haspopup"?: "dialog";
|
|
12
|
+
"aria-expanded"?: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** The list's sort state, threaded from its controller — the menu is a second
|
|
15
|
+
* remote control for the SAME persisted sort the view-options popover drives. */
|
|
16
|
+
export type GridSortState = {
|
|
17
|
+
value: string;
|
|
18
|
+
dir: OrderDir;
|
|
19
|
+
onChange: (next: {
|
|
20
|
+
value: string;
|
|
21
|
+
dir: OrderDir;
|
|
22
|
+
}) => void;
|
|
23
|
+
};
|
|
24
|
+
/** The view's group, as the header asks it: which field, and a writer that
|
|
25
|
+
* takes a field key (or null to ungroup). */
|
|
26
|
+
export type GridGroupByState = {
|
|
27
|
+
fieldKey: string | null;
|
|
28
|
+
onChange: (fieldKey: string | null) => void;
|
|
29
|
+
};
|
|
30
|
+
/** The cheap OUTER gate: action columns declare "no header menu knobs" by
|
|
31
|
+
* contract, so they never get one. Everything else may — whether it actually
|
|
32
|
+
* does is `hasContent` inside the component, which is the only place that knows
|
|
33
|
+
* every per-knob gate. Two levels because this one runs per header cell per
|
|
34
|
+
* render and the other needs the full prop set. */
|
|
35
|
+
export declare function gridColumnMenuEnabled<Row>(col: ListColumn<Row>): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* THE HEADER MENU — sort · group · the type's knobs · move · hide, in that
|
|
38
|
+
* order, every block derived and none by hand:
|
|
39
|
+
*
|
|
40
|
+
* - Sort is offered where `effectiveSortKey` names a key (a declared
|
|
41
|
+
* `sortKey`, or the field itself on a saved view). Clear sort appears only
|
|
42
|
+
* while this column IS the sort.
|
|
43
|
+
* - Group by is offered on a saved view for a field whose type groups
|
|
44
|
+
* (`columnGroupable`, the rule the toolbar's Group menu reads too); Ungroup
|
|
45
|
+
* while it is the group.
|
|
46
|
+
* - The knobs are `columnKnobs`' answer — the same one the Columns drill-in
|
|
47
|
+
* reads, so the two doors cannot disagree. Every knob writes under the
|
|
48
|
+
* FIELD key: it is the workspace's setting for the field, shared by every
|
|
49
|
+
* surface that draws it. Each knob is ONE row — its name, its current
|
|
50
|
+
* value, a chevron — whose choices fly out beside the menu (`GridFlyoutRow`),
|
|
51
|
+
* so a money column's menu is a short list of settings, not every choice
|
|
52
|
+
* of every setting.
|
|
53
|
+
* - Move left / right swap with the visible neighbour; hide is last.
|
|
54
|
+
* - The host's rows for this column's field (a field editor's Edit field,
|
|
55
|
+
* Archive field) sit just above hide (`renderColumnMenuRows`).
|
|
56
|
+
*
|
|
57
|
+
* No admin block: a lock is the workspace's rule about who may WRITE a field,
|
|
58
|
+
* and it lives in Settings → Modules → Tables and the Columns drill-in, not
|
|
59
|
+
* beside the knobs about how the field READS.
|
|
60
|
+
*/
|
|
61
|
+
export declare function GridColumnMenu<Row>({ column, values, viewBacked, sort, groupBy, optionColors, onOptionColorChange, dateStyle, onDateStyleChange, durationStyle, onDurationStyleChange, showTime, onShowTimeChange, percentDisplay, onPercentDisplayChange, numberFormat, onNumberFormatChange, onMoveLeft, onMoveRight, onHide, formatsWritable, renderColumnMenuRows, children, }: {
|
|
62
|
+
column: ListColumn<Row>;
|
|
63
|
+
/** Distinct option values for select columns (declared + discovered), in display order. */
|
|
64
|
+
values: string[];
|
|
65
|
+
/** On a saved view a bound column sorts and groups by its field. */
|
|
66
|
+
viewBacked?: boolean;
|
|
67
|
+
sort?: GridSortState;
|
|
68
|
+
groupBy?: GridGroupByState;
|
|
69
|
+
/** The workspace's colour overrides for this column's option values. */
|
|
70
|
+
optionColors?: Record<string, ListSelectColor>;
|
|
71
|
+
onOptionColorChange?: (key: string, value: string, color: ListSelectColor | null) => void;
|
|
72
|
+
dateStyle?: ListDateStyle;
|
|
73
|
+
onDateStyleChange?: (key: string, style: ListDateStyle) => void;
|
|
74
|
+
durationStyle?: ListDurationStyle;
|
|
75
|
+
onDurationStyleChange?: (key: string, style: ListDurationStyle) => void;
|
|
76
|
+
showTime?: boolean;
|
|
77
|
+
onShowTimeChange?: (key: string, show: boolean) => void;
|
|
78
|
+
percentDisplay?: PercentDisplay;
|
|
79
|
+
onPercentDisplayChange?: (key: string, display: PercentDisplay) => void;
|
|
80
|
+
/** Number columns: current decimals / display-currency state (host-owned). */
|
|
81
|
+
numberFormat?: ListNumberFormatState;
|
|
82
|
+
/** `decimals: null` = the field's own (Automatic). */
|
|
83
|
+
onNumberFormatChange?: (key: string, patch: {
|
|
84
|
+
decimals?: number | null;
|
|
85
|
+
currency?: string;
|
|
86
|
+
}) => void;
|
|
87
|
+
/** Present when there is a visible neighbour on that side. */
|
|
88
|
+
onMoveLeft?: () => void;
|
|
89
|
+
onMoveRight?: () => void;
|
|
90
|
+
/** Renders the "Hide from view" row. The grid passes it only when hiding is
|
|
91
|
+
* allowed (hideable column, more than one visible, host persists state). */
|
|
92
|
+
onHide?: () => void;
|
|
93
|
+
/** Whether a format knob can be stored; the reader's own currency reading stays either way. */
|
|
94
|
+
formatsWritable?: boolean;
|
|
95
|
+
/** The host's rows for this column's field, above Hide; null for a field it adds nothing to. */
|
|
96
|
+
renderColumnMenuRows?: (fieldKey: string, close: () => void) => ReactNode;
|
|
97
|
+
/** The header cell: the menu's anchor, and a press on it opens or closes the menu. The menu
|
|
98
|
+
* sets its `ref`, so it must carry none of its own. */
|
|
99
|
+
children: ReactElement<TriggerProps>;
|
|
100
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
101
|
+
export {};
|