@viewkitjs/views 0.2.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 +571 -0
- package/README.md +5 -3
- package/dist/atoms/LoadMore.js +11 -1
- package/dist/atoms/RowMenu.js +5 -2
- 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 +50 -9
- package/dist/contract.js +33 -5
- package/dist/display/converted.d.ts +19 -0
- package/dist/display/converted.js +12 -0
- package/dist/display/index.d.ts +1 -0
- package/dist/display/index.js +1 -0
- package/dist/display/link-click.d.ts +11 -0
- package/dist/display/link-click.js +3 -0
- package/dist/display/link.js +7 -3
- package/dist/display/multi-value.d.ts +1 -1
- package/dist/display/multi-value.js +1 -1
- package/dist/display/options.d.ts +7 -1
- package/dist/display/phone.js +3 -1
- package/dist/editors/ChipsEditor.d.ts +9 -4
- package/dist/editors/ChipsEditor.js +6 -2
- 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 +14 -6
- package/dist/editors/NameEditor.d.ts +3 -0
- package/dist/editors/NameEditor.js +11 -7
- package/dist/editors/NumberEditor.d.ts +3 -0
- package/dist/editors/NumberEditor.js +6 -6
- package/dist/editors/RangeEditor.d.ts +16 -1
- package/dist/editors/RangeEditor.js +21 -5
- 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 +3 -0
- package/dist/editors/ValueListEditor.js +4 -2
- package/dist/editors/edit-cores.d.ts +12 -9
- 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 +6 -1
- package/dist/fields/binding.js +13 -6
- 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 +5 -0
- package/dist/fields/money.js +10 -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/grid/chrome/GridAddColumn.js +1 -1
- package/dist/grid/chrome/GridAggregateMenu.d.ts +1 -1
- package/dist/grid/chrome/GridAggregateMenu.js +8 -6
- package/dist/grid/chrome/GridCellEditors.d.ts +7 -0
- package/dist/grid/chrome/GridCellEditors.js +87 -16
- package/dist/grid/chrome/GridCellOutline.d.ts +22 -43
- package/dist/grid/chrome/GridCellOutline.js +2 -7
- package/dist/grid/chrome/GridChipsEditor.d.ts +16 -6
- package/dist/grid/chrome/GridChipsEditor.js +21 -26
- package/dist/grid/chrome/GridColumnMenu.d.ts +1 -1
- package/dist/grid/chrome/GridColumnMenu.js +7 -3
- package/dist/grid/chrome/GridDateEditor.d.ts +23 -11
- package/dist/grid/chrome/GridDateEditor.js +13 -25
- package/dist/grid/chrome/GridFooter.d.ts +12 -2
- package/dist/grid/chrome/GridFooter.js +10 -6
- package/dist/grid/chrome/GridGroupMenu.js +20 -13
- package/dist/grid/chrome/GridHeader.d.ts +9 -4
- package/dist/grid/chrome/GridHeader.js +15 -10
- package/dist/grid/chrome/GridLongTextEditor.d.ts +28 -9
- package/dist/grid/chrome/GridLongTextEditor.js +16 -74
- package/dist/grid/chrome/GridNameEditor.d.ts +11 -6
- package/dist/grid/chrome/GridNameEditor.js +12 -27
- package/dist/grid/chrome/GridNumberEditor.d.ts +20 -6
- package/dist/grid/chrome/GridNumberEditor.js +46 -20
- package/dist/grid/chrome/GridPlaceEditor.d.ts +26 -0
- package/dist/grid/chrome/GridPlaceEditor.js +22 -0
- package/dist/grid/chrome/GridRangeEditor.d.ts +15 -5
- package/dist/grid/chrome/GridRangeEditor.js +16 -20
- package/dist/grid/chrome/GridRelationEditor.d.ts +38 -14
- package/dist/grid/chrome/GridRelationEditor.js +86 -24
- package/dist/grid/chrome/GridRow.d.ts +7 -1
- package/dist/grid/chrome/GridRow.js +57 -14
- package/dist/grid/chrome/GridRowActions.js +1 -1
- package/dist/grid/chrome/GridRowCells.js +18 -23
- package/dist/grid/chrome/GridSelectEditor.d.ts +19 -4
- package/dist/grid/chrome/GridSelectEditor.js +21 -27
- package/dist/grid/chrome/GridStructure.d.ts +9 -10
- package/dist/grid/chrome/GridStructure.js +10 -14
- package/dist/grid/chrome/GridTable.js +97 -30
- package/dist/grid/chrome/GridTableSurface.d.ts +39 -2
- package/dist/grid/chrome/GridTableSurface.js +12 -3
- package/dist/grid/chrome/GridTextEditor.d.ts +35 -1
- package/dist/grid/chrome/GridTextEditor.js +35 -37
- package/dist/grid/chrome/GridValueListEditor.d.ts +15 -3
- package/dist/grid/chrome/GridValueListEditor.js +10 -27
- 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.js +1 -2
- package/dist/grid/chrome/checks.d.ts +2 -5
- package/dist/grid/chrome/checks.js +15 -5
- package/dist/grid/chrome/editors.d.ts +1 -1
- package/dist/grid/chrome/editors.js +1 -1
- package/dist/grid/chrome/grid-cell-classes.d.ts +2 -8
- package/dist/grid/chrome/grid-cell-classes.js +10 -8
- 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-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 +16 -4
- 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 +4 -1
- package/dist/grid/chrome/grid-styles.js +1 -0
- package/dist/grid/chrome/grid-table-props.d.ts +2 -3
- package/dist/grid/chrome/useGridFocus.d.ts +45 -0
- package/dist/grid/chrome/useGridFocus.js +122 -0
- package/dist/grid/chrome/useGridKeyboard.d.ts +21 -4
- package/dist/grid/chrome/useGridKeyboard.js +214 -38
- package/dist/grid/chrome/useGridRangeActions.d.ts +3 -1
- package/dist/grid/chrome/useGridRangeActions.js +17 -10
- package/dist/grid/chrome/useGridRangeGestures.js +68 -21
- package/dist/grid/chrome/useGridRowContextMenu.d.ts +4 -2
- package/dist/grid/chrome/useGridRowContextMenu.js +28 -2
- package/dist/grid/chrome/useGridScaleStyles.d.ts +3 -1
- package/dist/grid/chrome/useGridScaleStyles.js +6 -7
- package/dist/grid/chrome/useGridScrollArea.d.ts +21 -0
- package/dist/grid/chrome/useGridScrollArea.js +65 -0
- package/dist/grid/chrome/useGridTableInteractionModel.d.ts +28 -5
- package/dist/grid/chrome/useGridTableInteractionModel.js +66 -14
- package/dist/grid/chrome/useHeaderDragReorder.d.ts +2 -2
- package/dist/grid/core/clipboard-model.d.ts +2 -0
- package/dist/grid/core/clipboard-model.js +1 -1
- package/dist/grid/core/commit-model.d.ts +7 -0
- package/dist/grid/core/edge-scroll.d.ts +21 -0
- package/dist/grid/core/edge-scroll.js +23 -0
- package/dist/grid/core/editing-controller.d.ts +2 -1
- package/dist/grid/core/editing-controller.js +35 -9
- package/dist/grid/core/editing-model.d.ts +9 -0
- package/dist/grid/core/editing-model.js +12 -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/nav.d.ts +2 -2
- package/dist/grid/core/pending-reconciliation.d.ts +3 -0
- package/dist/grid/core/pending-reconciliation.js +5 -3
- 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 +17 -1
- package/dist/grid/core/spreadsheet-operations.js +33 -6
- package/dist/grid/core/useGridEditing.d.ts +3 -0
- package/dist/grid/core/useGridEditing.js +6 -3
- package/dist/grid/core/value-equality.d.ts +23 -1
- package/dist/grid/core/value-equality.js +46 -0
- package/dist/grid/useGridTablePrefs.d.ts +0 -1
- package/dist/grid/useGridTablePrefs.js +1 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/viewport.d.ts +0 -2
- package/dist/internal/viewport.js +0 -14
- package/dist/model/column-capabilities.d.ts +2 -1
- 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-types.d.ts +3 -1
- package/dist/model/column-types.js +1 -1
- package/dist/model/preferences.d.ts +0 -4
- 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 +5 -1
- package/dist/provider/ViewsProvider.js +9 -3
- package/dist/provider/components.d.ts +19 -1
- package/dist/provider/components.js +4 -2
- package/dist/provider/context.d.ts +5 -2
- package/dist/provider/desktop.d.ts +9 -0
- package/dist/provider/desktop.js +22 -0
- package/dist/provider/plain-input.d.ts +8 -0
- package/dist/provider/plain-input.js +5 -0
- package/dist/react.d.ts +2 -1
- 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 +93 -35
- package/docs/guides/atoms.md +1 -1
- package/docs/guides/cells.md +2 -2
- package/docs/guides/columns.md +3 -2
- package/docs/guides/display.md +1 -0
- package/docs/guides/editors.md +71 -13
- package/docs/guides/the-grid.md +32 -13
- package/docs/guides/the-provider.md +3 -1
- package/docs/index.md +3 -1
- package/docs/install.md +1 -1
- package/docs/reference/cells.md +1 -1
- package/docs/reference/display.md +3 -1
- package/docs/reference/editors-chips.md +2 -2
- package/docs/reference/editors-date.md +3 -3
- package/docs/reference/editors-location.md +1 -1
- package/docs/reference/editors-number.md +1 -1
- package/docs/reference/editors-open-values.md +1 -0
- package/docs/reference/editors-panel.md +12 -0
- package/docs/reference/editors-range.md +1 -1
- package/docs/reference/editors-relation.md +6 -3
- package/docs/reference/editors-select.md +3 -2
- package/docs/reference/editors-session.md +4 -2
- package/docs/reference/editors-text.md +9 -0
- package/docs/reference/editors-value-list.md +1 -1
- package/docs/reference/editors.md +2 -2
- package/docs/reference/field-row.md +16 -0
- package/docs/reference/grid.md +3 -3
- package/docs/reference/react.md +8 -5
- package/docs/reference/views.md +36 -15
- package/package.json +23 -4
- package/skills/views/SKILL.md +4 -4
- package/dist/grid/chrome/useGridScrollSync.d.ts +0 -38
- package/dist/grid/chrome/useGridScrollSync.js +0 -176
|
@@ -4,13 +4,19 @@ import { useMemo } from "react";
|
|
|
4
4
|
import { resolveViewsMessage } from "../contract.js";
|
|
5
5
|
import { DEFAULT_VIEWS_ATOMS } from "../atoms/defaults.js";
|
|
6
6
|
import { ViewsContext } from "./context.js";
|
|
7
|
+
import { PlainInput } from "./plain-input.js";
|
|
7
8
|
import { withSettledGroups } from "./menu-groups.js";
|
|
9
|
+
import { DEFAULT_DESKTOP_QUERY } from "./desktop.js";
|
|
8
10
|
import { browserConfirm } from "./ports.js";
|
|
9
11
|
export { useViews } from "./context.js";
|
|
10
|
-
export function ViewsProvider({ children, components, conventions, icons, ports, atoms, messages = resolveViewsMessage, presentation, }) {
|
|
12
|
+
export function ViewsProvider({ children, components, conventions, icons, ports, atoms, messages = resolveViewsMessage, presentation, desktopQuery = DEFAULT_DESKTOP_QUERY, }) {
|
|
11
13
|
const merged = useMemo(() => ({ ...DEFAULT_VIEWS_ATOMS, ...atoms }), [atoms]);
|
|
12
|
-
const settled = useMemo(() => ({
|
|
14
|
+
const settled = useMemo(() => ({
|
|
15
|
+
...components,
|
|
16
|
+
Menu: withSettledGroups(components.Menu),
|
|
17
|
+
Input: components.Input ?? PlainInput,
|
|
18
|
+
}), [components]);
|
|
13
19
|
const resolved = useMemo(() => (ports.confirm ? ports : { ...ports, confirm: browserConfirm }), [ports]);
|
|
14
|
-
const value = useMemo(() => ({ components: settled, atoms: merged, conventions, icons, ports: resolved, messages, presentation }), [settled, merged, conventions, icons, resolved, messages, presentation]);
|
|
20
|
+
const value = useMemo(() => ({ components: settled, atoms: merged, conventions, icons, ports: resolved, messages, presentation, desktopQuery }), [settled, merged, conventions, icons, resolved, messages, presentation, desktopQuery]);
|
|
15
21
|
return _jsx(ViewsContext.Provider, { value: value, children: children });
|
|
16
22
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentType, CSSProperties, KeyboardEvent as ReactKeyboardEvent, MouseEvent as ReactMouseEvent, ReactElement, ReactNode, Ref, RefObject } from "react";
|
|
1
|
+
import type { ComponentPropsWithRef, ComponentType, CSSProperties, KeyboardEvent as ReactKeyboardEvent, MouseEvent as ReactMouseEvent, ReactElement, ReactNode, Ref, RefObject } from "react";
|
|
2
2
|
/** Where a floating part attaches: an element, a ref to one, or a point (a context menu). */
|
|
3
3
|
export type ViewsAnchor = HTMLElement | RefObject<HTMLElement | null> | {
|
|
4
4
|
x: number;
|
|
@@ -127,6 +127,10 @@ export type ViewsCommandParts = {
|
|
|
127
127
|
filter?: (value: string, search: string) => number;
|
|
128
128
|
/** The arrows wrap from the last item to the first and back. Default false. */
|
|
129
129
|
loop?: boolean;
|
|
130
|
+
/** The item highlighted as the list opens, by its value. Without it, the first item; while no item has it (a
|
|
131
|
+
* remote page that doesn't hold it), none, until a key or typed text moves the highlight: never the first, which
|
|
132
|
+
* in a relation picker is None. A list that ignores it opens on its first item. */
|
|
133
|
+
defaultValue?: string;
|
|
130
134
|
}>;
|
|
131
135
|
Input: ComponentType<{
|
|
132
136
|
value: string;
|
|
@@ -202,6 +206,13 @@ export type ViewsSheetProps = {
|
|
|
202
206
|
className?: string;
|
|
203
207
|
children: ReactNode;
|
|
204
208
|
};
|
|
209
|
+
/** A single-line text box. Forward every prop to the element, `ref` included: the editors focus the
|
|
210
|
+
* box, place its caret and read its value through it. */
|
|
211
|
+
export type ViewsInputProps = Omit<ComponentPropsWithRef<"input">, "children"> & {
|
|
212
|
+
/** `bare`: the box draws no frame of its own (a grid cell, a panel that frames it). `field`: it
|
|
213
|
+
* wears the app's field frame, as a form's input does. Default `bare`. */
|
|
214
|
+
chrome?: "bare" | "field";
|
|
215
|
+
};
|
|
205
216
|
export type ViewsComponents = {
|
|
206
217
|
Button: ComponentType<ViewsButtonProps>;
|
|
207
218
|
Popover: ComponentType<ViewsPopoverProps>;
|
|
@@ -227,4 +238,11 @@ export type ViewsComponents = {
|
|
|
227
238
|
source: string;
|
|
228
239
|
className?: string;
|
|
229
240
|
}>;
|
|
241
|
+
/** Optional: every editor's single-line box draws through it. Left out, the provider draws a
|
|
242
|
+
* plain `<input>`. */
|
|
243
|
+
Input?: ComponentType<ViewsInputProps>;
|
|
244
|
+
};
|
|
245
|
+
/** The map as the views read it: the optional slots filled, the app's or the package's default. */
|
|
246
|
+
export type ViewsResolvedComponents = ViewsComponents & {
|
|
247
|
+
Input: ComponentType<ViewsInputProps>;
|
|
230
248
|
};
|
|
@@ -2,11 +2,12 @@ import type { FieldConventions } from "@viewkitjs/fields";
|
|
|
2
2
|
import type { ViewsMessageResolver } from "../contract.js";
|
|
3
3
|
import type { ViewsAtoms } from "../atoms/types.js";
|
|
4
4
|
import type { FieldPresentation } from "../display/options.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ViewsResolvedComponents } from "./components.js";
|
|
6
6
|
import type { ViewsIcons } from "./icons.js";
|
|
7
7
|
import type { ViewsResolvedPorts } from "./ports.js";
|
|
8
8
|
export type ViewsContextValue = {
|
|
9
|
-
components:
|
|
9
|
+
/** The app's components, with the optional ones filled: the app's own, or the package's plain default. */
|
|
10
|
+
components: ViewsResolvedComponents;
|
|
10
11
|
atoms: ViewsAtoms;
|
|
11
12
|
icons: ViewsIcons;
|
|
12
13
|
/** The app's ports, with `confirm` always a function (the browser's where the app handed none). */
|
|
@@ -15,6 +16,8 @@ export type ViewsContextValue = {
|
|
|
15
16
|
conventions: FieldConventions;
|
|
16
17
|
/** The app's formatting: given the package's defaults, return the app's. */
|
|
17
18
|
presentation?: (defaults: FieldPresentation) => FieldPresentation;
|
|
19
|
+
/** The media query that means a desktop: the app's own, or `DEFAULT_DESKTOP_QUERY`. */
|
|
20
|
+
desktopQuery: string;
|
|
18
21
|
};
|
|
19
22
|
export declare const ViewsContext: import("react").Context<ViewsContextValue | null>;
|
|
20
23
|
export declare function useViews(): ViewsContextValue;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The width a desktop starts at, unless the app hands in its own query. */
|
|
2
|
+
export declare const DEFAULT_DESKTOP_QUERY = "(min-width: 1024px)";
|
|
3
|
+
/** Whether the screen is a desktop by `query`, asked now: true where there is no `matchMedia`. For
|
|
4
|
+
* an answer at the moment of a gesture, where a subscription would redraw its reader on a change.
|
|
5
|
+
* The package's own: no entry point exports it. */
|
|
6
|
+
export declare function isDesktopNow(query: string): boolean;
|
|
7
|
+
/** Whether the screen is a desktop, by the provider's `desktopQuery`: true where there is no
|
|
8
|
+
* `matchMedia`. It follows the query's changes. The package's own: no entry point exports it. */
|
|
9
|
+
export declare function useDesktop(): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
3
|
+
import { useViews } from "./context.js";
|
|
4
|
+
export const DEFAULT_DESKTOP_QUERY = "(min-width: 1024px)";
|
|
5
|
+
function canAsk() {
|
|
6
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function";
|
|
7
|
+
}
|
|
8
|
+
export function isDesktopNow(query) {
|
|
9
|
+
return canAsk() ? window.matchMedia(query).matches : true;
|
|
10
|
+
}
|
|
11
|
+
export function useDesktop() {
|
|
12
|
+
const { desktopQuery } = useViews();
|
|
13
|
+
const subscribe = useCallback((onChange) => {
|
|
14
|
+
if (!canAsk())
|
|
15
|
+
return () => { };
|
|
16
|
+
const list = window.matchMedia(desktopQuery);
|
|
17
|
+
list.addEventListener("change", onChange);
|
|
18
|
+
return () => list.removeEventListener("change", onChange);
|
|
19
|
+
}, [desktopQuery]);
|
|
20
|
+
const read = () => isDesktopNow(desktopQuery);
|
|
21
|
+
return useSyncExternalStore(subscribe, read, () => true);
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ViewsInputProps } from "./components.js";
|
|
3
|
+
/**
|
|
4
|
+
* The package's own `Input`, for an app that hands none: a bare `<input>` carrying exactly what the
|
|
5
|
+
* editor hands it, `ref` included, and no look of its own. `chrome` is a hint for an app's frame, so
|
|
6
|
+
* it never reaches the element.
|
|
7
|
+
*/
|
|
8
|
+
export declare function PlainInput({ chrome: _chrome, ...props }: ViewsInputProps): ReactNode;
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ViewsProvider, useViews } from "./provider/ViewsProvider.js";
|
|
2
2
|
export type { ViewsContextValue, ViewsProviderProps } from "./provider/ViewsProvider.js";
|
|
3
|
-
export
|
|
3
|
+
export { DEFAULT_DESKTOP_QUERY } from "./provider/desktop.js";
|
|
4
|
+
export type { ViewsAlign, ViewsAnchor, ViewsButtonProps, ViewsCalendarProps, ViewsCheckboxProps, ViewsCloseReason, ViewsCollapseProps, ViewsCommandParts, ViewsComponents, ViewsInputProps, ViewsMenuItem, ViewsMenuProps, ViewsOpenChange, ViewsPopoverProps, ViewsResolvedComponents, ViewsSheetProps, ViewsSide, ViewsTooltipProps, } from "./provider/components.js";
|
|
4
5
|
export type { ViewsIconProps, ViewsIcons } from "./provider/icons.js";
|
|
5
6
|
export { NOOP_PORTS } from "./provider/ports.js";
|
|
6
7
|
export type { ViewsClipboardPort, ViewsConfirmPort, ViewsConfirmRequest, ViewsHapticsPort, ViewsPorts, ViewsPrefsPort, ViewsResolvedPorts, ViewsToastPort, } from "./provider/ports.js";
|
package/dist/react.js
CHANGED
|
@@ -6,6 +6,8 @@ type SelectCheckboxProps = {
|
|
|
6
6
|
onChange: (next: boolean, shift: boolean) => void;
|
|
7
7
|
"aria-label"?: string;
|
|
8
8
|
className?: string;
|
|
9
|
+
/** -1 takes it out of the Tab order, where a surface reaches it by its own keys (the grid's ←). */
|
|
10
|
+
tabIndex?: number;
|
|
9
11
|
};
|
|
10
12
|
/**
|
|
11
13
|
* Row selection checkbox: the app's checkbox (in the portal, its neutral selection skin).
|
|
@@ -13,5 +15,5 @@ type SelectCheckboxProps = {
|
|
|
13
15
|
* holds it) is hovered — not the whole row — and reads the shift key off the press that changed
|
|
14
16
|
* it, for range selection.
|
|
15
17
|
*/
|
|
16
|
-
export declare function SelectCheckbox({ checked, revealed, onChange, className, "aria-label": ariaLabel, }: SelectCheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function SelectCheckbox({ checked, revealed, onChange, className, tabIndex, "aria-label": ariaLabel, }: SelectCheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export {};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cx } from "../internal/cx.js";
|
|
4
4
|
import { useViews } from "../provider/context.js";
|
|
5
|
-
export function SelectCheckbox({ checked, revealed, onChange, className, "aria-label": ariaLabel, }) {
|
|
5
|
+
export function SelectCheckbox({ checked, revealed, onChange, className, tabIndex, "aria-label": ariaLabel, }) {
|
|
6
6
|
const { Checkbox } = useViews().components;
|
|
7
|
-
return (_jsx(Checkbox, { checked: checked, "aria-label": ariaLabel, onCheckedChange: (next, details) => onChange(next, pressedWithShift(details?.event)), className: cx("opacity-0 group-hover/selzone:opacity-100", revealed && "opacity-100", checked && "opacity-100", className) }));
|
|
7
|
+
return (_jsx(Checkbox, { checked: checked, tabIndex: tabIndex, "aria-label": ariaLabel, onCheckedChange: (next, details) => onChange(next, pressedWithShift(details?.event)), className: cx("opacity-0 group-hover/selzone:opacity-100", revealed && "opacity-100", checked && "opacity-100", className) }));
|
|
8
8
|
}
|
|
9
9
|
function pressedWithShift(event) {
|
|
10
10
|
return event !== undefined && "shiftKey" in event && event.shiftKey === true;
|
|
@@ -3,8 +3,8 @@ import { useCallback, useEffect, useRef, } from "react";
|
|
|
3
3
|
export const ROW_CHECK_ATTR = "data-row-check";
|
|
4
4
|
const EDGE_PX = 40;
|
|
5
5
|
const MAX_STEP_PX = 24;
|
|
6
|
-
function verticalScrollerOf(
|
|
7
|
-
let node =
|
|
6
|
+
function verticalScrollerOf(from) {
|
|
7
|
+
let node = from;
|
|
8
8
|
while (node && node !== document.body) {
|
|
9
9
|
const oy = getComputedStyle(node).overflowY;
|
|
10
10
|
if ((oy === "auto" || oy === "scroll") && node.scrollHeight > node.clientHeight)
|
|
@@ -92,8 +92,8 @@ export function useCheckDragSelect({ enabled, rootRef, rowIds, rowIdOf = (attr)
|
|
|
92
92
|
raf = requestAnimationFrame(tick);
|
|
93
93
|
};
|
|
94
94
|
const maybeScroll = (d) => {
|
|
95
|
-
if (!scroller
|
|
96
|
-
scroller = verticalScrollerOf(
|
|
95
|
+
if (!scroller)
|
|
96
|
+
scroller = verticalScrollerOf(d.rowEl);
|
|
97
97
|
if (!scroller || raf != null)
|
|
98
98
|
return;
|
|
99
99
|
if (edgeStep(d.lastY, scroller) !== 0)
|
|
@@ -139,7 +139,7 @@ export function useCheckDragSelect({ enabled, rootRef, rowIds, rowIdOf = (attr)
|
|
|
139
139
|
return false;
|
|
140
140
|
const rowEl = target.closest("[data-row-id]");
|
|
141
141
|
const attr = rowEl?.getAttribute("data-row-id");
|
|
142
|
-
if (!attr)
|
|
142
|
+
if (!rowEl || !attr)
|
|
143
143
|
return false;
|
|
144
144
|
const rowId = rowIdOfRef.current(attr);
|
|
145
145
|
draggedRef.current = false;
|
|
@@ -149,6 +149,7 @@ export function useCheckDragSelect({ enabled, rootRef, rowIds, rowIdOf = (attr)
|
|
|
149
149
|
lastX: e.clientX,
|
|
150
150
|
lastY: e.clientY,
|
|
151
151
|
rowId,
|
|
152
|
+
rowEl,
|
|
152
153
|
value: !isSelectedRef.current(rowId),
|
|
153
154
|
active: false,
|
|
154
155
|
original: new Map(),
|
package/docs/contract.md
CHANGED
|
@@ -22,12 +22,17 @@ use; the prefix keeps that selector from reaching an element of the app's own.
|
|
|
22
22
|
|
|
23
23
|
| slot | the element |
|
|
24
24
|
| ------------------------------------ | --------------------------------------------------------- |
|
|
25
|
-
| `data-slot="vk-grid"` | the grid's frame: the
|
|
25
|
+
| `data-slot="vk-grid"` | the grid's frame: fills the box the app gives it |
|
|
26
|
+
| `data-slot="vk-grid-scroll"` | the grid's one scroll area, both ways |
|
|
27
|
+
| `data-slot="vk-grid-head"` | an ungrouped grid's pinned head: its header row |
|
|
26
28
|
| `data-slot="vk-grid-header"` | the header row |
|
|
27
29
|
| `data-slot="vk-grid-header-cell"` | one column's header |
|
|
28
30
|
| `data-slot="vk-grid-row"` | one record's row |
|
|
31
|
+
| `data-slot="vk-grid-rows"` | a group's rows: only those on screen are drawn |
|
|
32
|
+
| `data-slot="vk-grid-gap"` | the rows not drawn, as tall as they are |
|
|
29
33
|
| `data-slot="vk-grid-cell"` | one value |
|
|
30
34
|
| `data-slot="vk-grid-group"` | one group's band and its rows |
|
|
35
|
+
| `data-slot="vk-grid-group-head"` | a group's pinned head: its name bar and its header row |
|
|
31
36
|
| `data-slot="vk-grid-group-header"` | a group's name and figures |
|
|
32
37
|
| `data-slot="vk-grid-footer"` | the footer row |
|
|
33
38
|
| `data-slot="vk-grid-footer-cell"` | one column's figure |
|
|
@@ -96,10 +101,7 @@ frame from its scale and its state; a skin reads them and an app overrides them
|
|
|
96
101
|
| `--vk-footer-h` | footer height |
|
|
97
102
|
| `--vk-label-h` | group band height |
|
|
98
103
|
| `--vk-line-h` | a cell's line height |
|
|
99
|
-
| `--vk-chrome-h` | the chrome above the first row |
|
|
100
104
|
| `--vk-px` | horizontal cell padding |
|
|
101
|
-
| `--vk-cell-py` | vertical cell padding |
|
|
102
|
-
| `--vk-tail-py` | the tail button's vertical padding |
|
|
103
105
|
| `--vk-tail-pl` | the tail button's left padding |
|
|
104
106
|
| `--vk-rail-w` | the left rail's width |
|
|
105
107
|
| `--vk-rail-gap` | the gap between rail and first cell |
|
|
@@ -161,14 +163,23 @@ corners come from the app's Tailwind radius scale.
|
|
|
161
163
|
**The page gutter is the app's, if it has one.** `--vk-gutter` is the side padding a page gives its
|
|
162
164
|
content: the grid's rows run edge to edge and line their content up with it. An app that pads its
|
|
163
165
|
pages declares it once, onto its own padding; undeclared, the grid reads `0px` and sits flush with its
|
|
164
|
-
container. `--vk-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
container. `--vk-scroll-inset-bottom` is how much of the grid's foot the app covers with something it
|
|
167
|
+
floats there (a phone's bottom bar): the grid's scroll area runs underneath it, its last row scrolls
|
|
168
|
+
clear of it and a revealed cell stops above it. An app declares it on the grid's box or an ancestor;
|
|
169
|
+
undeclared, the grid reads `0px`.
|
|
170
|
+
|
|
171
|
+
**The grid scrolls inside itself.** Its frame fills the box its app gives it: a definite height, or
|
|
172
|
+
a flex column (the frame is `height: 100%`, `flex: 1 1 0` and `min-height: 0`). Inside the frame one
|
|
173
|
+
scroll area holds the table both ways, and each group's name bar and header row pin at the area's
|
|
174
|
+
top, so nothing the app pins above the grid concerns it. A box with no height gets a grid that grows
|
|
175
|
+
to its rows: the page scrolls it, and its heads don't pin. The grid's rows and frozen columns sit
|
|
176
|
+
inside your `Collapse`'s clip, so the clip must crop without scrolling (`overflow: clip`, never
|
|
177
|
+
`hidden`): a clip that scrolls takes the frozen columns' sticky edge with it.
|
|
168
178
|
|
|
169
179
|
**The grid's own variables are not public.** The grid sets `--vk-drag-shift` (a header cell's
|
|
170
|
-
offset while its column is dragged to a new place)
|
|
171
|
-
width, one per column)
|
|
180
|
+
offset while its column is dragged to a new place), `--vk-col-w-<id>` (one column's resolved
|
|
181
|
+
width, one per column) and `--vk-cols` (the columns' template on its scroll area, which every row
|
|
182
|
+
reads) for itself. They carry the prefix because they share the global namespace;
|
|
172
183
|
an app neither sets nor reads them, and they may change in any release.
|
|
173
184
|
|
|
174
185
|
## The components map
|
|
@@ -183,15 +194,18 @@ both fill every one.
|
|
|
183
194
|
|
|
184
195
|
`Button` · `Popover` · `Tooltip` · `Checkbox` · `Menu` · `Command` · `Calendar` · `Collapse` · `Sheet` · `AppIcon` · `Markdown`
|
|
185
196
|
|
|
197
|
+
`Input`, optional: a single-line text box, `ViewsInputProps`. Every editor's text box draws through it; without it the editors draw a plain `<input>`. Forward every prop to your element, `ref` included. `chrome` is `bare` (the default: a grid cell, a panel that frames the box) or `field` (your field's frame). `OPTIONAL_COMPONENT_NAMES` lists it apart from `COMPONENT_NAMES`, which lists the slots you must fill.
|
|
198
|
+
|
|
186
199
|
The popover takes `alignOffset`, `initialFocus` (false keeps focus where it was when the popup
|
|
187
|
-
opens; the editor that then takes focus does so with `preventScroll`, so
|
|
188
|
-
|
|
200
|
+
opens; the editor that then takes focus does so with `preventScroll`, so the package's own focus
|
|
201
|
+
never moves the page while your popup is placed; what your `Command` does as it mounts is yours, in
|
|
202
|
+
"Writing an adapter"), and two vetoes, `onOutsidePress`
|
|
189
203
|
and `onEscape`, each returning `false` to keep it open. `onOutsidePress` is handed the pointer press, its `target` where the press landed, also when the
|
|
190
204
|
focus that press moves is what would close the popup: a vetoed press holds against its focus too,
|
|
191
205
|
and focus leaving by keyboard (a Tab out) closes without asking. Its
|
|
192
206
|
`chrome` is `panel` (the app's card popover) or `menu` (the app's menu panel, for a list); a panel
|
|
193
207
|
click reaches `onPanelClick`, and `panelData` sets `data-*` attributes on the popup; its `style` carries what a class cannot say, a width that follows a cell. The command
|
|
194
|
-
list's root takes `shouldFilter`, `filter
|
|
208
|
+
list's root takes `shouldFilter`, `filter`, `loop` (the arrows wrap) and `defaultValue` (the value of the item highlighted as the list opens, and none while no item has it; the relation editor opens on the linked record through it, and a list that ignores it opens on its first row); an item takes `chosen`: the app colours the item as
|
|
195
209
|
its chosen row, and the package's row inside draws the check, so the item draws no tick of its own; its input takes a `ref` (the place editor focuses its search through it), `onKeyDown`, and `chrome`
|
|
196
210
|
`search` or `bare` (the input without the search row); its empty state and groups take a class. The
|
|
197
211
|
calendar takes a controlled `month` (`YYYY-MM`) with `onMonthChange`, a `dropdown` caption, and the
|
|
@@ -221,7 +235,8 @@ What a Base UI adapter over shadcn copies does where its copies stop short of a
|
|
|
221
235
|
|
|
222
236
|
**The menu.** The map's `Menu` has an anchor and no trigger, and no flyouts. Build it from the menu
|
|
223
237
|
library's root, positioner and popup, handing the anchor to the positioner, where your copy's content
|
|
224
|
-
doesn't forward one; with no flyouts, a root needs no trigger of its own.
|
|
238
|
+
doesn't forward one; with no flyouts, a root needs no trigger of its own. Opened, it puts focus on its
|
|
239
|
+
first row, as your `Popover` does by default: a row's menu opened by a key starts there.
|
|
225
240
|
|
|
226
241
|
**A disabled group.** Nothing to do: its rows reach you already `disabled`.
|
|
227
242
|
|
|
@@ -232,6 +247,15 @@ menu classes over it.
|
|
|
232
247
|
**The command item's chosen mark.** Colour the item as your chosen row; the row inside draws the
|
|
233
248
|
check. Where your copy's item draws a tick of its own, hide it.
|
|
234
249
|
|
|
250
|
+
**A command list that scrolls as it mounts.** The chips, select and relation editors, and the grid's
|
|
251
|
+
Add column and group menu, mount a `Command.Root` with its rows in the frame the popover opens, before
|
|
252
|
+
your popover has placed its popup. A command library that scrolls its selected item into view on mount
|
|
253
|
+
(cmdk does, with `scrollIntoView`) scrolls the page towards the popup's unplaced spot, which at a
|
|
254
|
+
library's default positioning can be the page's top, and `preventScroll` on the focus doesn't reach
|
|
255
|
+
that scroll. Keep such a popover `fixed`, where the unplaced popup already sits inside the viewport, or
|
|
256
|
+
stop your `Command` scrolling on mount. Your library's default positioning is safe only for a
|
|
257
|
+
`Command` that doesn't.
|
|
258
|
+
|
|
235
259
|
**`chrome: "bare"`.** The input alone, without the search row's glyph and divider. Where your copy
|
|
236
260
|
has only the search row, reach the command library's own input.
|
|
237
261
|
|
|
@@ -258,7 +282,7 @@ container: the inset a run of rows sits in, inside a panel or a command list's g
|
|
|
258
282
|
a button or, with `interactive={false}`, a static line), `RowContent` (a row's inside, for inside a
|
|
259
283
|
command list's item, which owns the element and the highlight), `TickBox` (a paint-only tick box),
|
|
260
284
|
`StatusBadge` (a pill by status slot), `StatusMarker` (an attention badge that opens its reason) and
|
|
261
|
-
`Tag` (a category chip, removable, with an optional leading glyph), `CommandMenu` (a `command` cell's verb menu, opened from the trigger the cell drew; the default is the components map's `Menu`), `RowMenu` (the row's right-click menu, around the row: Open page, the rows the rendering builds, Delete; the default is the components map's `Menu` at the pointer, opened by a right-click or the row's ⋯ (`data-slot="vk-grid-row-more"`), wrapped in `data-slot="vk-row-menu"`; its Delete asks the `confirm` port with `views.menus.row-delete-confirm` (the browser's own confirm when you hand none), and a delete that rejects says so through the toast port's `error` with `views.menus.row-delete-failed`; a long-press on a phone opens nothing) and `RelationLink` (where a relation chip goes, around the chip the display drew; the default goes nowhere), `Loading` (a wait: the list reloading, or more rows arriving; the default is a plain ring) `LoadMore` (how a list asks for its next page; the default watches a sentinel past the last row) and `PlatformMark` (a link's platform, drawn before it, read from its address with the conventions' platforms; the default draws nothing, so a link looks plain, and the package ships no brand art, so an app that wants marks draws its own by the platform's key into `data-slot="vk-platform"`). Each ships as a default, exported as `DEFAULT_VIEWS_ATOMS`, drawn
|
|
285
|
+
`Tag` (a category chip, removable, with an optional leading glyph), `CommandMenu` (a `command` cell's verb menu, opened from the trigger the cell drew; the default is the components map's `Menu`), `RowMenu` (the row's right-click menu, around the row: Open page, the rows the rendering builds, Delete; the default is the components map's `Menu` at the pointer, opened by a right-click or the row's ⋯ (`data-slot="vk-grid-row-more"`), wrapped in `data-slot="vk-row-menu"`; the grid's row-menu keys send a cell the same right-click, with no press before it, so a `RowMenu` of your own opens on any `contextmenu` and doesn't wait for a press; its Delete asks the `confirm` port with `views.menus.row-delete-confirm` (the browser's own confirm when you hand none), and a delete that rejects says so through the toast port's `error` with `views.menus.row-delete-failed`; a long-press on a phone opens nothing) and `RelationLink` (where a relation chip goes, around the chip the display drew; the default goes nowhere), `Loading` (a wait: the list reloading, or more rows arriving; the default is a plain ring) `LoadMore` (how a list asks for its next page; the default watches a sentinel past the last row) and `PlatformMark` (a link's platform, drawn before it, read from its address with the conventions' platforms; the default draws nothing, so a link looks plain, and the package ships no brand art, so an app that wants marks draws its own by the platform's key into `data-slot="vk-platform"`). Each ships as a default, exported as `DEFAULT_VIEWS_ATOMS`, drawn
|
|
262
286
|
from the app's colours; an app swaps any of them through the provider's `atoms`, and the rest
|
|
263
287
|
stay the defaults.
|
|
264
288
|
|
|
@@ -281,6 +305,18 @@ with the states `data-chosen`, `data-disabled`, `data-muted`, `data-checked`, `d
|
|
|
281
305
|
Lists that scroll wear the class `scrollbar-overlay`, which an app may define (to show the OS
|
|
282
306
|
overlay scrollbar, say); without it the class does nothing.
|
|
283
307
|
|
|
308
|
+
## The editor panel
|
|
309
|
+
|
|
310
|
+
`EditorPanel` (`@viewkitjs/views/editors/panel`) opens an editor in the components map's `Popover` on
|
|
311
|
+
a desktop and its `Sheet` on a phone, and marks its parts with these slots:
|
|
312
|
+
|
|
313
|
+
| slot | the element |
|
|
314
|
+
| ---------------------------------- | ------------------------------------------------------------- |
|
|
315
|
+
| `data-slot="vk-editor-panel"` | the popover's panel, or the sheet's body, an editor sits in |
|
|
316
|
+
| `data-slot="vk-editor-bar"` | the sheet's bar: its ✕ and its ✓ |
|
|
317
|
+
| `data-slot="vk-editor-refusal"` | the reason a refused value gave, under the editor |
|
|
318
|
+
| `data-slot="vk-text-editor"` | the text editor's box (`@viewkitjs/views/editors/text`), unless its host names its own |
|
|
319
|
+
|
|
284
320
|
## Ports
|
|
285
321
|
|
|
286
322
|
Runtime services the app hands in through the provider, typed in `src/provider/ports.ts`:
|
|
@@ -314,7 +350,7 @@ message, read from the conventions the provider carries. The package's are a clo
|
|
|
314
350
|
`views.editors.*`, `views.menus.*` and `views.display.*`: `views.editors.tag-remove` (`{ label }`),
|
|
315
351
|
`views.editors.marker-resolve`, `views.editors.marker-no-reason`, `views.editors.range-low` and
|
|
316
352
|
`views.editors.range-high` (a range editor's two boxes, "From" and "To"), and `views.editors.name-given`,
|
|
317
|
-
`views.editors.name-family` and `views.editors.name-full` (a name editor's three boxes); `views.editors.values-add` ("Add"), `views.editors.values-label` ("Label"), `views.editors.values-main` ("Main", the main value's mark), `views.editors.values-make-main` (`{ value }`, "Make {value} the main one") and `views.editors.values-remove` (`{ value }`, "Remove {value}") (a value list editor's rows); the place editor's: `views.editors.place-country` ("Country"), `views.editors.place-country-search` ("Search countries"), `views.editors.place-change-country` ("Change country"), `views.editors.place-region-search` ("Search"), `views.editors.place-line1` ("Address line 1"), `views.editors.place-line2` ("Address line 2"), `views.editors.place-required` (`{ label }`, "{label} *", a part its country asks for), the region's words `views.editors.place-region-area`, `views.editors.place-region-county`, `views.editors.place-region-department`, `views.editors.place-region-district`, `views.editors.place-region-do-si`, `views.editors.place-region-emirate`, `views.editors.place-region-island`, `views.editors.place-region-oblast`, `views.editors.place-region-parish`, `views.editors.place-region-prefecture`, `views.editors.place-region-province` and `views.editors.place-region-state`, the city's `views.editors.place-city-city`, `views.editors.place-city-district`, `views.editors.place-city-post-town` and `views.editors.place-city-suburb`, and the postal code's `views.editors.place-postal-eircode`, `views.editors.place-postal-pin`, `views.editors.place-postal-postal` and `views.editors.place-postal-zip` (each its word in English: "County", "Do/Si", "Post town", "PIN code", "ZIP code"); `placeWordKey(kind, word)` gives the key for a word `placeFormat` names; `views.editors.place-region` ("Region") beside the place editor's `views.editors.place-country`,
|
|
353
|
+
`views.editors.name-family` and `views.editors.name-full` (a name editor's three boxes); `views.editors.values-add` ("Add"), `views.editors.values-label` ("Label"), `views.editors.values-main` ("Main", the main value's mark), `views.editors.values-make-main` (`{ value }`, "Make {value} the main one") and `views.editors.values-remove` (`{ value }`, "Remove {value}") (a value list editor's rows); `views.editors.discard` ("Discard", the editor sheet's ✕) and `views.editors.save` ("Save", its ✓); `views.editors.open-email`, `views.editors.open-phone` and `views.editors.open-link` (`{ value }`, "Email {value}", "Call {value}", "Open {value}", the open action beside a stored value in a phone's sheet); the place editor's: `views.editors.place-country` ("Country"), `views.editors.place-country-search` ("Search countries"), `views.editors.place-change-country` ("Change country"), `views.editors.place-region-search` ("Search"), `views.editors.place-line1` ("Address line 1"), `views.editors.place-line2` ("Address line 2"), `views.editors.place-required` (`{ label }`, "{label} *", a part its country asks for), the region's words `views.editors.place-region-area`, `views.editors.place-region-county`, `views.editors.place-region-department`, `views.editors.place-region-district`, `views.editors.place-region-do-si`, `views.editors.place-region-emirate`, `views.editors.place-region-island`, `views.editors.place-region-oblast`, `views.editors.place-region-parish`, `views.editors.place-region-prefecture`, `views.editors.place-region-province` and `views.editors.place-region-state`, the city's `views.editors.place-city-city`, `views.editors.place-city-district`, `views.editors.place-city-post-town` and `views.editors.place-city-suburb`, and the postal code's `views.editors.place-postal-eircode`, `views.editors.place-postal-pin`, `views.editors.place-postal-postal` and `views.editors.place-postal-zip` (each its word in English: "County", "Do/Si", "Post town", "PIN code", "ZIP code"); `placeWordKey(kind, word)` gives the key for a word `placeFormat` names; `views.editors.place-region` ("Region") beside the place editor's `views.editors.place-country`,
|
|
318
354
|
`views.editors.place-city-city` and `views.editors.place-postal-postal`, a place's parts in a panel;
|
|
319
355
|
`views.menus.part-row` (`{ field, part }`, one part's row in a panel: "Location · Country");
|
|
320
356
|
the grid's column menu: `views.menus.sort-asc` ("Sort ascending"), `views.menus.sort-desc`, `views.menus.sort-clear`
|
|
@@ -341,7 +377,8 @@ the grid's own: `views.grid.figure` (`{ kind }`, a footer figure's name, `"none"
|
|
|
341
377
|
`views.grid.change-value`, `views.grid.value` and `views.grid.edit-value` (a long text's box, read-only or not),
|
|
342
378
|
`views.grid.read-only` and `views.grid.read-only-why` (a locked list's badge and its title); its refusals
|
|
343
379
|
`views.grid.locked` (`{ field }`), `views.grid.not-clearable`, `views.grid.computed` (`{ from }`),
|
|
344
|
-
`views.grid.cell-read-only
|
|
380
|
+
`views.grid.cell-read-only`, `views.grid.clear-none` and `views.grid.clear-required` (`{ fields }`, the fields a clear
|
|
381
|
+
over several cells left because they can't be empty, already joined in the viewer's locale); its write gate's `views.grid.write-not-list`,
|
|
345
382
|
`views.grid.write-not-boolean`, `views.grid.write-marker`, `views.grid.write-not-email`, `views.grid.write-not-url`, `views.grid.write-not-link` and
|
|
346
383
|
`views.grid.write-not-linkable`; a paste's `views.grid.paste-refused`, `views.grid.paste-empty`,
|
|
347
384
|
`views.grid.paste-not-number`, `views.grid.paste-not-duration`, `views.grid.paste-not-date`,
|
|
@@ -361,7 +398,9 @@ record in another currency) and `views.grid.paste-not-range`; a paste or a fill
|
|
|
361
398
|
(`{ value }`, `"true"` or `"false"` as text so a catalog's `select` reads it: a text boolean with no words of its own), `views.display.show-all` (`{ count }`), and
|
|
362
399
|
`views.display.show-more` and `views.display.show-less` (rich text folded in a drawer), and
|
|
363
400
|
`views.display.phone-extension` (`{ extension }`, "ext. 12" after a phone) and `views.display.phone-as-typed`
|
|
364
|
-
(the title on a phone stored as typed).
|
|
401
|
+
(the title on a phone stored as typed), and `views.display.converted-from` (`{ code }`, "Converted from USD", the
|
|
402
|
+
title on a money figure shown in another currency than its record's) and `views.display.as-shown` ("as shown",
|
|
403
|
+
after that figure under a money editor).
|
|
365
404
|
A span behind now is fields' own `time.ago`. The provider's `messages` resolves them; it defaults to the
|
|
366
405
|
package's English, `resolveViewsMessage`; an app's resolver that words only some keys calls
|
|
367
406
|
`resolveViewsMessage` for the rest, since the provider does not fall back for it. A new key is a
|
|
@@ -374,8 +413,8 @@ A value takes up to four shapes on its way through a view: **stored** (what the
|
|
|
374
413
|
|
|
375
414
|
| type | stored | draft | commit | display |
|
|
376
415
|
| -------------------------------------------- | --------------------------------------------------------- | ---------------------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
377
|
-
| `text` | a string | the
|
|
378
|
-
| `url`, `domain`, `email`, `phone` | a string (a phone `{ number, extension }`) | the
|
|
416
|
+
| `text` | a string | the text editor's box | a string | the text; a long text folds |
|
|
417
|
+
| `url`, `domain`, `email`, `phone` | a string (a phone `{ number, extension }`) | the text editor's box | the typed text, which fields' `acceptFieldCommit` reads | a link (`tel:` for a phone) |
|
|
379
418
|
| the same, `multiple` | `{ value, label, main }[]`, the main one first | a row each | the whole list (`editors/value-list`) | the main value, and the rest on demand |
|
|
380
419
|
| `number`, `percent`, `currency` | a number (a currency's code fixed, or in a sibling field) | the typed text | `NumberCommit`: `{ value, unit? }` | the figure in the conventions' locale; a percent appended, never multiplied |
|
|
381
420
|
| `date` | `"2026-09-15"` | the picked day | `"2026-09-15"` | the day in the column's style |
|
|
@@ -383,16 +422,16 @@ A value takes up to four shapes on its way through a view: **stored** (what the
|
|
|
383
422
|
| `boolean` | a boolean | none | a boolean, from the display control itself | a checkbox, an icon, a marker or text |
|
|
384
423
|
| `select`, `status` | the option's code | none: a pick commits | the option's code, or `""` for None on a field that may be emptied | a badge, a status by its semantic slot |
|
|
385
424
|
| `multiselect` | the codes | the chosen codes | the whole set | badges |
|
|
386
|
-
| `relation`, `user` | an id or null (ids for a many relation) | the picked id
|
|
425
|
+
| `relation`, `user` | an id or null (ids for a many relation) | the picked id; a many relation's set | an id, a ref `{ kind, id }`, or `null` for unlinked; a many relation's whole set as stored | a chip `{ id, label, entity, avatarUrl }` the host resolves |
|
|
387
426
|
| `range` | `{ low, high }` | two boxes | `{ low, high }`, an empty box an open end | "11–50" with its unit and period |
|
|
388
427
|
| `name` | `{ full, given, family }` | three boxes | `{ full, given, family }`, or `null` | the full name, else the parts, else the host's fallback |
|
|
389
|
-
| `location` | the place's parts in its country's order | the country, then its parts | the place, or `null`
|
|
428
|
+
| `location` | the place's parts in its country's order | the country, then its parts | the place, or `null` | the place written whole |
|
|
390
429
|
| `rich_text` | a markdown string | the host's own input; in the grid, the long-text panel | the markdown string | folded text |
|
|
391
430
|
| `actor`, `lookup`, `rollup`, `formula` | set by the system, or derived | none | none: no editor opens | a chip, the far field, the result |
|
|
392
431
|
|
|
393
432
|
A clear is the one exception to the commit column. Delete, Cut, the grid row menu's Clear and a clear over a range commit `""` for every type above but three, on a field that may be emptied: a relation (and a member) commits `null` and a multiselect `[]`, and a boolean commits `false`, whether or not it may be emptied. So a cleared number, date, name, range, select or text reaches the binding's `write` as `""`, and the `write` maps it to what the row stores for nothing.
|
|
394
433
|
|
|
395
|
-
A derived field (a lookup, a rollup, a formula) has no commit at all: no edit core, and fields' `zodFor` refuses it. `EDIT_CORES` (`@viewkitjs/views/editors`) answers which types open an edit core; `null` is the answer for a type with none,
|
|
434
|
+
A derived field (a lookup, a rollup, a formula) has no commit at all: no edit core, and fields' `zodFor` refuses it. `EDIT_CORES` (`@viewkitjs/views/editors`) answers which types open an edit core; `null` is the answer for a type with none, such as `boolean`, which its display control flips. The text-like types (`text`, `rich_text`, `url`, `domain`, `email`, `phone`) share one, `TextEditor`.
|
|
396
435
|
|
|
397
436
|
## What an edit core never does
|
|
398
437
|
|
|
@@ -408,14 +447,14 @@ A field whose changes are transitions with rules of their own (a lost deal needs
|
|
|
408
447
|
|
|
409
448
|
## The doors
|
|
410
449
|
|
|
411
|
-
|
|
450
|
+
Twenty-one doors, and nothing else is importable but `./package.json`. What each holds is summarised here; each door's reference page names every export, one line each, starting at [`reference/views.md`](reference/views.md).
|
|
412
451
|
|
|
413
452
|
`@viewkitjs/views`, no React at runtime, holds two things. The rendering contract, every name listed:
|
|
414
453
|
the constants `VK_PREFIX`, `GRID_SLOTS`, `GRID_STATES`, `VK_TOKENS`, `VK_COLOURS`,
|
|
415
|
-
`VK_OPTIONAL_COLOURS`, `VK_OPTIONAL_LAYOUT`, `COMPONENT_NAMES`, `ATOM_NAMES`, `ATOM_SLOTS`, `ATOM_STATES`, `PORT_NAMES`,
|
|
454
|
+
`VK_OPTIONAL_COLOURS`, `VK_OPTIONAL_LAYOUT`, `COMPONENT_NAMES`, `OPTIONAL_COMPONENT_NAMES`, `ATOM_NAMES`, `ATOM_SLOTS`, `ATOM_STATES`, `EDITOR_SLOTS`, `PORT_NAMES`,
|
|
416
455
|
`ICON_NAMES`, `MESSAGE_NAMESPACES` and `VIEWS_MESSAGE_KEYS`; the functions `resolveViewsMessage` and `placeWordKey`; and
|
|
417
|
-
the types `GridSlot`, `GridState`, `VkToken`, `VkColour`, `VkOptionalColour`, `VkOptionalLayout`, `ComponentName`,
|
|
418
|
-
`AtomName`, `AtomSlot`, `AtomState`, `PortName`, `ViewsIconName`, `ViewsMessageNamespace`,
|
|
456
|
+
the types `GridSlot`, `GridState`, `VkToken`, `VkColour`, `VkOptionalColour`, `VkOptionalLayout`, `ComponentName`, `OptionalComponentName`,
|
|
457
|
+
`AtomName`, `AtomSlot`, `AtomState`, `EditorSlot`, `PortName`, `ViewsIconName`, `ViewsMessageNamespace`,
|
|
419
458
|
`ViewsMessageKey`, `ViewsMessage`, `ViewsMessageResolver` and `PlaceWordKey`.
|
|
420
459
|
|
|
421
460
|
And the model, by module: every export of `model/index.ts` (the column vocabulary — what a column is,
|
|
@@ -425,16 +464,18 @@ of the five model modules that barrel does not carry (`card-density`, `card-layo
|
|
|
425
464
|
money reading),
|
|
426
465
|
`filters/` (the filter registry and its types, the text, number and date rules, the filter config
|
|
427
466
|
types and their guards), `figures.ts`, `grouping/` (`ListGroup` and the group sort) and `fields/`
|
|
428
|
-
(the binding, money and currency, denomination, the write preparation, the
|
|
467
|
+
(the binding, money and currency, denomination, the write preparation, the write target (`EntityWriteTarget`,
|
|
468
|
+
`EntityWriteReceipt`, `FieldWriteAdmission`, `FieldWriteAdmissionGuard`, `LockedResolver`, `FieldNote`,
|
|
469
|
+
`FieldWriteReconciliationRequired`), the edit-core types, number
|
|
429
470
|
edit, the format knobs and the relation source types, the host's verb-menu types (`FieldMenus`, `FieldRowMenuItem`)). A name exported by one of those modules is
|
|
430
471
|
public; nothing else at the root door is.
|
|
431
472
|
|
|
432
473
|
`@viewkitjs/views/react`, which opens with the client directive: `ViewsProvider`, `useViews()` and
|
|
433
474
|
`NOOP_PORTS`; the provider's types `ViewsProviderProps` and `ViewsContextValue`; the adapter's types
|
|
434
|
-
`ViewsComponents`, `ViewsPorts`, `ViewsIcons` and `ViewsIconProps`; the components' props
|
|
475
|
+
`ViewsComponents`, `ViewsResolvedComponents` (the map as `useViews()` hands it on, `Input` always there), `ViewsPorts`, `ViewsIcons` and `ViewsIconProps`; the components' props
|
|
435
476
|
`ViewsButtonProps`, `ViewsPopoverProps`, `ViewsTooltipProps`, `ViewsCheckboxProps`, `ViewsMenuProps`,
|
|
436
|
-
`ViewsMenuItem`, `ViewsCommandParts`, `ViewsCalendarProps`, `ViewsCollapseProps
|
|
437
|
-
`ViewsSheetProps`, with their shared shapes `ViewsAnchor`, `ViewsSide`, `ViewsAlign`,
|
|
477
|
+
`ViewsMenuItem`, `ViewsCommandParts`, `ViewsCalendarProps`, `ViewsCollapseProps`,
|
|
478
|
+
`ViewsSheetProps` and `ViewsInputProps`, with their shared shapes `ViewsAnchor`, `ViewsSide`, `ViewsAlign`,
|
|
438
479
|
`ViewsCloseReason` and `ViewsOpenChange`; the ports' types `ViewsToastPort`, `ViewsHapticsPort`,
|
|
439
480
|
`ViewsClipboardPort`, `ViewsPrefsPort`, `ViewsConfirmPort`, `ViewsConfirmRequest` and `ViewsResolvedPorts` (the
|
|
440
481
|
ports `useViews()` hands on, `confirm` always there); the atoms' `DEFAULT_VIEWS_ATOMS` and types `ViewsAtoms`,
|
|
@@ -455,9 +496,11 @@ formatters `formatDateValue`, `formatNumberValue` and `formatMoney`, `DEFAULT_FI
|
|
|
455
496
|
formatter handed no viewer reads the neutral conventions, never the runtime's.
|
|
456
497
|
|
|
457
498
|
`@viewkitjs/views/editors`, no client directive on the door: `EDIT_CORES` (one editor per storage
|
|
458
|
-
type, `null` where a type has
|
|
499
|
+
type, `null` where a type has none of its own) and `hasEditCore`. One door per editor, each opening with the
|
|
459
500
|
client directive: `@viewkitjs/views/editors/select` (`SelectEditor`, `SelectEditorHandle`,
|
|
460
|
-
`pickerOptionsFromField`, `PickerOption`), `@viewkitjs/views/editors/
|
|
501
|
+
`pickerOptionsFromField`, `PickerOption`, `SELECT_SEARCH_PAST`), `@viewkitjs/views/editors/text` (`TextEditor`,
|
|
502
|
+
`TextEditorHandle`, `TextEditorProps`, `TextEditorType`, `TEXT_INPUT_TYPE`: one box for text, a link, an email,
|
|
503
|
+
a phone, a domain, long text and rich text), `@viewkitjs/views/editors/relation` (`RelationEditor`,
|
|
461
504
|
`RelationEditorHandle`, `RelationCreate`, `RELATION_PAGE_SIZE`, `RELATION_SEARCH_DEBOUNCE_MS`, and
|
|
462
505
|
the relation source types), `@viewkitjs/views/editors/number` (`NumberEditor`, `NumberEditorHandle`,
|
|
463
506
|
`NumberEditValue`), `@viewkitjs/views/editors/range` (`RangeEditor`, `RangeEditorHandle`: two boxes,
|
|
@@ -473,16 +516,31 @@ messages, read from the provider's conventions unless the host hands `message`.
|
|
|
473
516
|
|
|
474
517
|
`@viewkitjs/views/editors/session`, opening with the client directive: `useAnchoredEditSession` and
|
|
475
518
|
`EDITOR_EXIT_MS` — the one-answer guard and the exit gap every host that opens an editor over a value
|
|
476
|
-
shares
|
|
519
|
+
shares; Escape always discards through it, and a refused attempt's reason comes back as `refusal`
|
|
520
|
+
(`EditSession`, `EditSessionAttempt`). Its own door, so a host that needs the session does not load the six editors.
|
|
521
|
+
|
|
522
|
+
`@viewkitjs/views/editors/panel`, opening with the client directive: `EditorPanel`, `EditorPanelProps`
|
|
523
|
+
and `EditorSurface` — an editor opened as the components map's `Popover` on a desktop and its `Sheet`
|
|
524
|
+
on a phone, by the provider's `desktopQuery`, chosen once when the session opens.
|
|
477
525
|
|
|
478
526
|
`@viewkitjs/views/editors/open-values`, opening with the client directive: `OpenValuesProvider`,
|
|
479
|
-
`useOpenValues(field)
|
|
527
|
+
`useOpenValues(field)`, `offeredValues(field, known, seen)` and `takesNewValues(field)`. An open field's values (what its records
|
|
480
528
|
hold, which the app's list answers) reach every editor of it: the app provides them above a surface, and
|
|
481
529
|
a host reads them, asking once for a field's values when its editor mounts. A closed field, or no
|
|
482
530
|
provider, reads none and asks nothing. `offeredValues` is what a host offers: the declared options, then
|
|
483
531
|
the known values, then those seen, each once. `useOpenValuesContext()` reads the nearest provider whole: what a host
|
|
484
532
|
hands `buildRelationFilters` as `farValues`.
|
|
485
533
|
|
|
534
|
+
`@viewkitjs/views/field-row`, opening with the client directive: `FieldRow` (`FieldRowProps`), one field of a
|
|
535
|
+
record drawn as its label, its value and, on a click, its type's editor in place, with `RowEditor` and `ROW_HOSTS`
|
|
536
|
+
(`RowEditorProps`, `RowEditorAttempt`, `RowClosed`, `RowHostProps`), the host each type mounts; and
|
|
537
|
+
`useFieldWrite` (`FieldWriteOptions`, `EditTiming`), the write path that admits a commit at once, queues one
|
|
538
|
+
record's writes, settles each on the save's receipt and rolls a failure back, with `FieldWriteRefusal`,
|
|
539
|
+
and, re-exported from the root door that holds them as the model, `FieldWriteReconciliationRequired` and the shapes it
|
|
540
|
+
writes through (`EntityWriteTarget`, `EntityWriteReceipt`, `FieldWriteAdmission`, `FieldWriteAdmissionGuard`,
|
|
541
|
+
`LockedResolver`, `FieldNote`). The panel around the rows
|
|
542
|
+
(its sections, its related records) is the app's.
|
|
543
|
+
|
|
486
544
|
A relation's Related records row (`buildRelationFilters`) offers a far relation, user or actor by name
|
|
487
545
|
only when its target names it (`RelationFilterTarget.named`, from the host's builder) and the host hands
|
|
488
546
|
`farValues`, the values its list answers keyed by path: `farPathOf(relationKey, farKey)`, the two joined by
|
package/docs/guides/atoms.md
CHANGED
|
@@ -150,7 +150,7 @@ Swap it for a menu of your own, or for a long-press that selects: `onToggleSelec
|
|
|
150
150
|
|
|
151
151
|
## Waits
|
|
152
152
|
|
|
153
|
-
`Loading` takes a `placement` and a `label`: `body` while the whole list reloads, `footer` while more rows arrive. The default is a ring with one turning arc, larger in the body. `LoadMore` is how a list asks for its next page: it takes `onReveal`, and an optional `label` drawn in place of the wait. The default watches a sentinel past the last row and calls `onReveal` as it comes within 600px of the viewport, drawing your `Loading` meanwhile; with no `IntersectionObserver` (a server render) it asks for nothing. Swap `LoadMore` for a button, or a different distance. [The grid guide](the-grid.md) shows the grid's `loadMore` prop that drives it.
|
|
153
|
+
`Loading` takes a `placement` and a `label`: `body` while the whole list reloads, `footer` while more rows arrive. The default is a ring with one turning arc, larger in the body. `LoadMore` is how a list asks for its next page: it takes `onReveal`, and an optional `label` drawn in place of the wait. The default watches a sentinel past the last row and calls `onReveal` as it comes within 600px of the end of what it scrolls in (the grid's own scroll area, else the viewport), drawing your `Loading` meanwhile; with no `IntersectionObserver` (a server render) it asks for nothing. Swap `LoadMore` for a button, or a different distance. [The grid guide](the-grid.md) shows the grid's `loadMore` prop that drives it.
|
|
154
154
|
|
|
155
155
|
## Handing them in
|
|
156
156
|
|
package/docs/guides/cells.md
CHANGED
|
@@ -75,7 +75,7 @@ What it does with a column depends on what the column is:
|
|
|
75
75
|
- A `title` column draws the row's title cell, the hotspot that opens the row (`data-cell-open`), with the column's `indicator` beside the name. A title whose field is a number, a percent, a currency, a date, a datetime or a name draws through that field, so a dated identity reads as a date; any other title draws as its text.
|
|
76
76
|
- A relation chip goes where your `RelationLink` atom says, the app-wide answer for each kind of record. `onOpenRelation` overrides it for one surface and is handed the chip that was pressed, which matters when a cell holds several.
|
|
77
77
|
- A `command` column handed `commandItems` opens your `CommandMenu` atom: the verbs for this row in place of an editor. The trigger is the value itself, or a chevron beside it where the value is a control of its own (a relation, a user, a link, an email, a phone or a domain). Without `commandItems` the cell is a plain value. [A command field](../contract.md#a-command-field) in the contract says where the verbs come from.
|
|
78
|
-
- Any other column draws its field's display, in the code `resolveRowCurrency` finds for a money value.
|
|
78
|
+
- Any other column draws its field's display, in the code `resolveRowCurrency` finds for a money value. A money figure the column reads converted from the row's own currency (`convertedFromOf`) comes back marked: ≈ before it and a title naming the currency it came from (`ConvertedFigure`).
|
|
79
79
|
|
|
80
80
|
```tsx
|
|
81
81
|
import { renderIdentityValue, renderTypedCellValue } from "@viewkitjs/views/cells";
|
|
@@ -91,7 +91,7 @@ The options, `GridCellOptions`, are all optional, and the grid fills the same on
|
|
|
91
91
|
- How it reads: `viewer` and `presentation` (both default to the provider's), `dateStyle`, `durationStyle`, `decimals`, `withTime`, `percentDisplay`, `optionColors`, and `wrap`, which lets text wrap instead of truncating.
|
|
92
92
|
- The row's answers: `currency`, `valueOverride` and `markerReason`.
|
|
93
93
|
- The verbs: `onToggle` (a two-way boolean is clickable only when it is given), `onResolve` (clears a marker), `commandItems` and `onOpenRelation`.
|
|
94
|
-
- Your host's: `entityIcon`, your glyph for a kind of record, and `slotOwnsClick`, for a host whose own element is the button (a calendar's event card): every cell inside it draws bare content, with no link, button or popover trigger of its own.
|
|
94
|
+
- Your host's: `entityIcon`, your glyph for a kind of record, and `slotOwnsClick`, for a host whose own element is the button (a calendar's event card): every cell inside it draws bare content, with no link, button or popover trigger of its own. `hostOwnsPlainClick`, for a host whose plain click on a value is its own (the grid, where it selects the cell): an email, phone, url or domain stays a link, marked `data-cell-link`, and lets the click through for your host to decide.
|
|
95
95
|
|
|
96
96
|
[The cells reference](../reference/cells.md) has each one.
|
|
97
97
|
|