viewkitjs 0.29.0 → 0.30.1
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 +127 -6
- package/MIGRATION.md +97 -8
- package/package.json +1 -1
- package/views/dist/cells/cell-format.d.ts +2 -2
- package/views/dist/cells/cell-values.js +0 -2
- package/views/dist/contract.d.ts +15 -18
- package/views/dist/contract.js +13 -27
- package/views/dist/controls/button/map-button.d.ts +5 -3
- package/views/dist/controls/button/map-button.js +14 -7
- package/views/dist/controls/controls.d.ts +2 -4
- package/views/dist/controls/controls.js +2 -2
- package/views/dist/controls/customize/customize.d.ts +51 -0
- package/views/dist/controls/customize/customize.js +128 -23
- package/views/dist/controls/customize/map-customize-body.d.ts +0 -3
- package/views/dist/controls/customize/map-customize-body.js +46 -11
- package/views/dist/controls/customize/map-ranges.d.ts +23 -0
- package/views/dist/controls/customize/map-ranges.js +41 -0
- package/views/dist/controls/customize/rules.d.ts +17 -1
- package/views/dist/controls/customize/rules.js +2 -0
- package/views/dist/controls/customize/words.d.ts +7 -0
- package/views/dist/controls/customize/words.js +5 -0
- package/views/dist/controls/customize.css +3 -0
- package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +1 -0
- package/views/dist/controls/filter-editor/rules.d.ts +1 -2
- package/views/dist/controls/index.d.ts +8 -8
- package/views/dist/controls/index.js +8 -8
- package/views/dist/controls/menu-list/menu-list.d.ts +16 -1
- package/views/dist/controls/menu-list/menu-list.js +26 -8
- package/views/dist/controls/menu-list.css +8 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +1 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +6 -3
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/text-editor/map-text-body.d.ts +1 -1
- package/views/dist/controls/text-editor/map-text-body.js +2 -2
- package/views/dist/controls/text-editor/text-editor.d.ts +3 -0
- package/views/dist/controls/text-editor/text-editor.js +16 -2
- package/views/dist/controls/text-editor.css +11 -0
- package/views/dist/controls/values-editor/values.js +6 -2
- package/views/dist/display/options.d.ts +1 -1
- package/views/dist/display/rich-text.js +0 -1
- package/views/dist/editors/ChipsEditor.d.ts +4 -5
- package/views/dist/editors/ChipsEditor.js +12 -78
- package/views/dist/editors/DateEditor.d.ts +12 -16
- package/views/dist/editors/DateEditor.js +40 -191
- package/views/dist/editors/EditorPanel.d.ts +2 -6
- package/views/dist/editors/EditorPanel.js +2 -2
- package/views/dist/editors/LocationEditor.d.ts +11 -19
- package/views/dist/editors/LocationEditor.js +19 -211
- package/views/dist/editors/NameEditor.d.ts +8 -16
- package/views/dist/editors/NameEditor.js +11 -100
- package/views/dist/editors/NumberEditor.d.ts +14 -21
- package/views/dist/editors/NumberEditor.js +22 -49
- package/views/dist/editors/RangeEditor.d.ts +9 -33
- package/views/dist/editors/RangeEditor.js +12 -97
- package/views/dist/editors/RelationEditor.d.ts +6 -9
- package/views/dist/editors/RelationEditor.js +11 -30
- package/views/dist/editors/RelationSetEditor.d.ts +13 -24
- package/views/dist/editors/RelationSetEditor.js +33 -101
- package/views/dist/editors/SelectEditor.d.ts +15 -17
- package/views/dist/editors/SelectEditor.js +15 -94
- package/views/dist/editors/TextEditor.d.ts +23 -26
- package/views/dist/editors/TextEditor.js +11 -48
- package/views/dist/editors/ValueListEditor.d.ts +14 -23
- package/views/dist/editors/ValueListEditor.js +16 -202
- package/views/dist/editors/body-panel.d.ts +13 -7
- package/views/dist/editors/body-panel.js +3 -7
- package/views/dist/editors/edit-cores.d.ts +15 -15
- package/views/dist/editors/edit-cores.js +14 -14
- package/views/dist/editors/number-body.d.ts +1 -1
- package/views/dist/editors/number-step.d.ts +0 -34
- package/views/dist/editors/number-step.js +0 -37
- package/views/dist/editors/option-add-flow.d.ts +1 -13
- package/views/dist/editors/option-add-flow.js +0 -22
- package/views/dist/editors/relation-links-body.d.ts +2 -3
- package/views/dist/editors/relation-picker.d.ts +13 -3
- package/views/dist/editors/relation-source.d.ts +0 -22
- package/views/dist/editors/relation-source.js +0 -21
- package/views/dist/field-row/FieldRow.js +5 -6
- package/views/dist/field-row/FieldRowLane.js +0 -1
- package/views/dist/field-row/editors/RowChipsEditor.js +2 -2
- package/views/dist/field-row/editors/RowDateEditor.d.ts +2 -2
- package/views/dist/field-row/editors/RowDateEditor.js +2 -2
- package/views/dist/field-row/editors/RowNameEditor.d.ts +2 -5
- package/views/dist/field-row/editors/RowNameEditor.js +7 -12
- package/views/dist/field-row/editors/RowNumberEditor.d.ts +1 -1
- package/views/dist/field-row/editors/RowNumberEditor.js +4 -4
- package/views/dist/field-row/editors/RowPlaceEditor.js +3 -3
- package/views/dist/field-row/editors/RowRangeEditor.d.ts +2 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +7 -14
- package/views/dist/field-row/editors/RowRelationEditor.js +3 -3
- package/views/dist/field-row/editors/RowSelectEditor.js +2 -2
- package/views/dist/field-row/editors/RowTextEditor.d.ts +1 -1
- package/views/dist/field-row/editors/RowTextEditor.js +3 -4
- package/views/dist/field-row/editors/RowValueListEditor.js +5 -5
- package/views/dist/field-row/field-row-button.d.ts +6 -9
- package/views/dist/field-row/field-row-button.js +1 -6
- package/views/dist/field-row/field-row-checkbox.d.ts +1 -1
- package/views/dist/field-row/row-target.d.ts +0 -7
- package/views/dist/field-row/row-target.js +0 -2
- package/views/dist/grid/chrome/GridAddColumn.d.ts +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +8 -66
- package/views/dist/grid/chrome/GridAggregateMenu.d.ts +5 -7
- package/views/dist/grid/chrome/GridAggregateMenu.js +20 -39
- package/views/dist/grid/chrome/GridCellEditors.d.ts +2 -2
- package/views/dist/grid/chrome/GridCellEditors.js +12 -12
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -3
- package/views/dist/grid/chrome/GridColumnMenu.d.ts +11 -12
- package/views/dist/grid/chrome/GridColumnMenu.js +32 -93
- package/views/dist/grid/chrome/GridDateEditor.d.ts +6 -6
- package/views/dist/grid/chrome/GridDateEditor.js +3 -3
- package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -6
- package/views/dist/grid/chrome/GridGroupMenu.js +21 -62
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -2
- package/views/dist/grid/chrome/GridHeader.js +2 -2
- package/views/dist/grid/chrome/GridLongTextEditor.d.ts +17 -38
- package/views/dist/grid/chrome/GridLongTextEditor.js +6 -7
- package/views/dist/grid/chrome/GridNameEditor.js +4 -4
- package/views/dist/grid/chrome/GridNumberEditor.d.ts +4 -5
- package/views/dist/grid/chrome/GridNumberEditor.js +3 -4
- package/views/dist/grid/chrome/GridPlaceEditor.d.ts +2 -5
- package/views/dist/grid/chrome/GridPlaceEditor.js +5 -5
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +6 -12
- package/views/dist/grid/chrome/GridRangeEditor.js +7 -15
- package/views/dist/grid/chrome/GridRelationEditor.js +5 -5
- package/views/dist/grid/chrome/GridRow.js +0 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +1 -1
- package/views/dist/grid/chrome/GridRowActions.js +0 -5
- package/views/dist/grid/chrome/GridRowCells.js +9 -6
- package/views/dist/grid/chrome/GridSelectEditor.js +3 -3
- package/views/dist/grid/chrome/GridStructure.js +0 -1
- package/views/dist/grid/chrome/GridTable.js +1 -1
- package/views/dist/grid/chrome/GridTextEditor.d.ts +5 -7
- package/views/dist/grid/chrome/GridTextEditor.js +4 -17
- package/views/dist/grid/chrome/GridValueListEditor.js +4 -4
- package/views/dist/grid/chrome/grid-body-place.d.ts +2 -3
- package/views/dist/grid/chrome/grid-body-place.js +4 -8
- package/views/dist/grid/chrome/grid-button.d.ts +7 -10
- package/views/dist/grid/chrome/grid-button.js +1 -6
- package/views/dist/grid/chrome/grid-cell-classes.js +1 -1
- package/views/dist/grid/chrome/grid-column-menu-items.d.ts +4 -4
- package/views/dist/grid/chrome/grid-column-menu-items.js +10 -6
- package/views/dist/grid/chrome/grid-group-menu-parts.d.ts +5 -9
- package/views/dist/grid/chrome/grid-group-menu-parts.js +1 -3
- package/views/dist/grid/chrome/grid-hover.js +0 -1
- package/views/dist/grid/chrome/grid-menu-focus.d.ts +7 -31
- package/views/dist/grid/chrome/grid-menu-focus.js +7 -47
- package/views/dist/grid/chrome/grid-styles.d.ts +0 -3
- package/views/dist/grid/chrome/grid-styles.js +0 -1
- package/views/dist/grid/chrome/grid-table-props.d.ts +6 -10
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -4
- package/views/dist/grid/core/editing-controller.d.ts +2 -1
- package/views/dist/grid/core/editing-controller.js +10 -2
- package/views/dist/grid/core/refusal-sentence.d.ts +3 -0
- package/views/dist/grid/core/refusal-sentence.js +2 -2
- package/views/dist/grid/core/write-states.d.ts +3 -1
- package/views/dist/grid/core/write-states.js +6 -2
- package/views/dist/grid/grid.css +1 -1
- package/views/dist/model/body-frame.d.ts +0 -32
- package/views/dist/model/body-frame.js +1 -15
- package/views/dist/model/column-inspect.d.ts +5 -5
- package/views/dist/model/column-inspect.js +2 -2
- package/views/dist/panels/customize-body.d.ts +1 -10
- package/views/dist/panels/customize-body.js +0 -3
- package/views/dist/panels/filter/MenuSelect.js +0 -5
- package/views/dist/panels/filter/RangeFilterBody.js +0 -1
- package/views/dist/panels/filter/details.d.ts +1 -5
- package/views/dist/panels/filter/details.js +0 -13
- package/views/dist/panels/filter/filter-list.d.ts +0 -1
- package/views/dist/panels/filter/filter-list.js +1 -1
- package/views/dist/panels/panel-button.d.ts +10 -12
- package/views/dist/panels/panel-button.js +1 -6
- package/views/dist/panels/react/chrome.d.ts +0 -17
- package/views/dist/panels/react/chrome.js +0 -8
- package/views/dist/panels/react/customize-body.d.ts +9 -12
- package/views/dist/panels/react/customize-body.js +57 -11
- package/views/dist/panels/react/customize.d.ts +9 -12
- package/views/dist/panels/react/customize.js +3 -112
- package/views/dist/panels/react/filter/FilterEditor.d.ts +4 -18
- package/views/dist/panels/react/filter/FilterEditor.js +6 -330
- package/views/dist/panels/react/filter/FilterFieldList.d.ts +1 -1
- package/views/dist/panels/react/filter/FilterFieldList.js +27 -59
- package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +1 -11
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +8 -144
- package/views/dist/panels/react/filter/editor-ctx.d.ts +1 -33
- package/views/dist/panels/react/filter/editor-ctx.js +5 -33
- package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -6
- package/views/dist/panels/react/filter/filter-part-body.js +0 -5
- package/views/dist/panels/react/filter/rule-writes.d.ts +1 -26
- package/views/dist/panels/react/filter/rule-writes.js +4 -95
- package/views/dist/panels/react/order-details.d.ts +1 -26
- package/views/dist/panels/react/order-details.js +3 -69
- package/views/dist/panels/react/panel-header.js +0 -1
- package/views/dist/panels/react/popover.d.ts +4 -7
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +2 -4
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +16 -137
- package/views/dist/panels/react/sort/SortEditor.d.ts +4 -4
- package/views/dist/panels/react/sort/SortEditor.js +8 -245
- package/views/dist/panels/react/sort/SortFieldList.d.ts +1 -1
- package/views/dist/panels/react/sort/SortFieldList.js +11 -25
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -16
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +0 -4
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +0 -1
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +3 -3
- package/views/dist/panels/react/view-actions.js +0 -1
- package/views/dist/panels/react/views-row/FoldingViewRow.js +5 -9
- package/views/dist/panels/react/views-row/ViewCreatePill.js +0 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +7 -43
- package/views/dist/panels/react/views-row/ViewPickerRow.js +0 -2
- package/views/dist/panels/react/views-row/menu-classes.d.ts +0 -4
- package/views/dist/panels/react/views-row/menu-classes.js +0 -2
- package/views/dist/panels/react.d.ts +5 -12
- package/views/dist/panels/react.js +5 -12
- package/views/dist/provider/ViewsProvider.d.ts +2 -46
- package/views/dist/provider/ViewsProvider.js +2 -22
- package/views/dist/provider/components.d.ts +153 -106
- package/views/dist/provider/context.d.ts +1 -21
- package/views/dist/provider/missing-slot.d.ts +3 -7
- package/views/dist/provider/missing-slot.js +2 -9
- package/views/dist/react.d.ts +1 -2
- package/views/dist/selection/SelectionBar.js +2 -3
- package/views/dist/styles.css +40 -168
- package/views/dist/styles.unlayered.css +40 -168
- package/views/docs/contract.md +99 -123
- package/views/docs/getting-started.md +222 -2
- package/views/docs/guides/cells.md +222 -2
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/editors.md +235 -20
- package/views/docs/guides/ports.md +1 -1
- package/views/docs/guides/selection.md +1 -1
- package/views/docs/guides/the-grid.md +14 -16
- package/views/docs/guides/the-provider.md +9 -15
- package/views/docs/reference/cells.md +1 -1
- package/views/docs/reference/controls.md +28 -15
- package/views/docs/reference/editors-chips.md +2 -2
- package/views/docs/reference/editors-date.md +4 -4
- package/views/docs/reference/editors-location.md +4 -7
- package/views/docs/reference/editors-name.md +3 -5
- package/views/docs/reference/editors-number.md +10 -10
- package/views/docs/reference/editors-panel.md +3 -3
- package/views/docs/reference/editors-range.md +3 -5
- package/views/docs/reference/editors-relation.md +4 -4
- package/views/docs/reference/editors-select.md +3 -3
- package/views/docs/reference/editors-text.md +3 -4
- package/views/docs/reference/editors-value-list.md +3 -3
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -2
- package/views/docs/reference/panels-react.md +20 -34
- package/views/docs/reference/react.md +11 -18
- package/views/docs/reference/views.md +5 -5
- package/views/skills/views/SKILL.md +1 -1
- package/views/dist/editors/relation-panel.d.ts +0 -69
- package/views/dist/editors/relation-panel.js +0 -46
- package/views/dist/grid/chrome/GridColumnColorSection.d.ts +0 -13
- package/views/dist/grid/chrome/GridColumnColorSection.js +0 -40
- package/views/dist/grid/chrome/GridColumnDateSection.d.ts +0 -28
- package/views/dist/grid/chrome/GridColumnDateSection.js +0 -23
- package/views/dist/grid/chrome/GridColumnDurationSection.d.ts +0 -23
- package/views/dist/grid/chrome/GridColumnDurationSection.js +0 -24
- package/views/dist/grid/chrome/GridColumnNumberSection.d.ts +0 -29
- package/views/dist/grid/chrome/GridColumnNumberSection.js +0 -27
- package/views/dist/grid/chrome/GridColumnPercentSection.d.ts +0 -16
- package/views/dist/grid/chrome/GridColumnPercentSection.js +0 -16
- package/views/dist/grid/chrome/GridColumnSortSection.d.ts +0 -38
- package/views/dist/grid/chrome/GridColumnSortSection.js +0 -33
- package/views/dist/grid/chrome/GridFlyout.d.ts +0 -44
- package/views/dist/grid/chrome/GridFlyout.js +0 -80
- package/views/dist/grid/chrome/GridMenuRow.d.ts +0 -15
- package/views/dist/grid/chrome/GridMenuRow.js +0 -15
- package/views/dist/grid/chrome/grid-menu-search.d.ts +0 -7
- package/views/dist/grid/chrome/grid-menu-search.js +0 -7
- package/views/dist/panels/react/GroupBucketsList.d.ts +0 -16
- package/views/dist/panels/react/GroupBucketsList.js +0 -44
- package/views/dist/panels/react/LayoutColumnsList.d.ts +0 -24
- package/views/dist/panels/react/LayoutColumnsList.js +0 -101
- package/views/dist/panels/react/PopoverColumnDetail.d.ts +0 -11
- package/views/dist/panels/react/PopoverColumnDetail.js +0 -24
- package/views/dist/panels/react/drag.d.ts +0 -2
- package/views/dist/panels/react/drag.js +0 -5
- package/views/dist/panels/react/layout-detail.d.ts +0 -4
- package/views/dist/panels/react/layout-detail.js +0 -29
- package/views/dist/panels/react/root-list.d.ts +0 -6
- package/views/dist/panels/react/root-list.js +0 -31
- package/views/dist/panels/react/sort/use-sort-drag.d.ts +0 -17
- package/views/dist/panels/react/sort/use-sort-drag.js +0 -39
- package/views/dist/panels/react/view-footer.d.ts +0 -20
- package/views/dist/panels/react/view-footer.js +0 -41
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { LayoutColumnsConfig } from "../model.js";
|
|
2
|
-
import type { PanelFieldEditor } from "./field-editor.js";
|
|
3
|
-
type LayoutColumnsVariant = "compact" | "comfortable";
|
|
4
|
-
/**
|
|
5
|
-
* The Columns editor, a vertical sortable: a grip to reorder, an eye to show or hide, the row's body to open
|
|
6
|
-
* the column's own settings, and Reset when any column differs from the view. Presentation only: the host
|
|
7
|
-
* list owns the column state.
|
|
8
|
-
*
|
|
9
|
-
* Runs on both surfaces: a desktop panel (`compact`) and a phone's sheet (`comfortable`).
|
|
10
|
-
*/
|
|
11
|
-
export declare function LayoutColumnsList({ columns, variant, onOpenColumn, canOpen, showNewLine, fieldEditor, }: {
|
|
12
|
-
columns: LayoutColumnsConfig;
|
|
13
|
-
variant?: LayoutColumnsVariant;
|
|
14
|
-
/** Opens a column's settings drill-in. Omit and rows aren't clickable. */
|
|
15
|
-
onOpenColumn?: (id: string) => void;
|
|
16
|
-
/** Which rows open their settings; every row when absent. A phone opens only a row the field editor acts on. */
|
|
17
|
-
canOpen?: (id: string) => boolean;
|
|
18
|
-
/** Show the per-field "starts a new line" toggle (`columns.newLine`). The CALLER gates it by the active
|
|
19
|
-
* view: this list can't know which view's drill-in it is serving. */
|
|
20
|
-
showNewLine?: boolean;
|
|
21
|
-
/** The app's field editor: its footer (Add field, the archived fields) draws under the rows. */
|
|
22
|
-
fieldEditor?: PanelFieldEditor | null;
|
|
23
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
export {};
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cx } from "../../internal/cx.js";
|
|
4
|
-
import { useViews } from "../../provider/context.js";
|
|
5
|
-
import { DRAGGING_CLASS, PANEL_ROW_CLASS, PANEL_SEPARATOR_CLASS, SHEET_ROW_CLASS, SHEET_ROW_GROUND_CLASS, } from "./chrome.js";
|
|
6
|
-
import { DisabledReason } from "../../atoms/DisabledReason.js";
|
|
7
|
-
import { drawPanelButton } from "../panel-button.js";
|
|
8
|
-
import { columnToggleRefusal, newLineRefusal } from "./column-refusals.js";
|
|
9
|
-
import { usePanelListSensors } from "./drag.js";
|
|
10
|
-
import { moveItem, SortableFrame, useDragKit, useSortableItem } from "./drag-kit.js";
|
|
11
|
-
function columnRowValueLabel(item) {
|
|
12
|
-
const first = item.settings?.choices?.[0];
|
|
13
|
-
if (!first)
|
|
14
|
-
return undefined;
|
|
15
|
-
return first.options.find((o) => o.value === first.value)?.label ?? first.value;
|
|
16
|
-
}
|
|
17
|
-
export function LayoutColumnsList({ columns, variant = "compact", onOpenColumn, canOpen, showNewLine = false, fieldEditor, }) {
|
|
18
|
-
const { atoms, messages } = useViews();
|
|
19
|
-
const kit = useDragKit();
|
|
20
|
-
const sensors = usePanelListSensors(kit);
|
|
21
|
-
const footer = fieldEditor?.fieldsFooter(columns) ?? null;
|
|
22
|
-
const visibleCount = columns.items.filter((i) => !i.hidden).length;
|
|
23
|
-
const handleDragEnd = (event) => {
|
|
24
|
-
const { active, over } = event;
|
|
25
|
-
if (!over || active.id === over.id)
|
|
26
|
-
return;
|
|
27
|
-
const ids = columns.items.map((i) => i.id);
|
|
28
|
-
const from = ids.indexOf(String(active.id));
|
|
29
|
-
const to = ids.indexOf(String(over.id));
|
|
30
|
-
if (from === -1 || to === -1)
|
|
31
|
-
return;
|
|
32
|
-
columns.onReorder(moveItem(ids, from, to));
|
|
33
|
-
};
|
|
34
|
-
return (_jsxs("div", { children: [_jsx(SortableFrame, { kit: kit, sensors: sensors, items: columns.items.map((i) => i.id), axis: "y", onDragEnd: handleDragEnd, nameOf: (id) => columns.items.find((item) => item.id === id)?.label ?? id, children: columns.items.map((item) => (_jsx(SortableColumnRow, { item: item, variant: variant, toggleRefusal: columnToggleRefusal(item, visibleCount, messages), onToggleHidden: columns.onToggleHidden, newLine: showNewLine ? columns.newLine : undefined, onOpen: onOpenColumn && (canOpen?.(item.id) ?? true) ? onOpenColumn : undefined }, item.id))) }), columns.dirty && columns.onReset && variant === "compact" && (_jsxs(_Fragment, { children: [_jsx("div", { className: PANEL_SEPARATOR_CLASS }), _jsx(atoms.ChoiceRow, { label: messages({ key: "views.panels.columns-reset" }), onClick: columns.onReset })] })), footer && (_jsxs(_Fragment, { children: [_jsx("div", { className: PANEL_SEPARATOR_CLASS }), footer] }))] }));
|
|
35
|
-
}
|
|
36
|
-
function SortableColumnRow({ item, variant, toggleRefusal, onToggleHidden, newLine, onOpen, }) {
|
|
37
|
-
const views = useViews();
|
|
38
|
-
const { icons, messages } = views;
|
|
39
|
-
const { attributes, listeners, setNodeRef, isDragging, style } = useSortableItem({
|
|
40
|
-
id: item.id,
|
|
41
|
-
disabled: item.fixed,
|
|
42
|
-
axis: "y",
|
|
43
|
-
});
|
|
44
|
-
const comfortable = variant === "comfortable";
|
|
45
|
-
const glyph = comfortable ? "h-4 w-4" : "h-3.5 w-3.5";
|
|
46
|
-
const value = columnRowValueLabel(item);
|
|
47
|
-
const canToggle = toggleRefusal === null;
|
|
48
|
-
const newLineReason = newLine ? newLineRefusal(item, newLine.firstFieldId, messages) : null;
|
|
49
|
-
const inertNewLine = newLineReason !== null;
|
|
50
|
-
const Grip = icons.drag;
|
|
51
|
-
const NewLine = icons.enter;
|
|
52
|
-
const Eye = item.hidden ? icons.hide : icons.show;
|
|
53
|
-
const Chevron = icons.chevronRight;
|
|
54
|
-
const iconFrame = cx("shrink-0", comfortable ? "h-7 w-7" : "h-5 w-5");
|
|
55
|
-
const nameClass = cx("font-medium", comfortable ? "text-(length:--vk-sheet-text,15px)" : "text-sm", item.hidden ? "text-(color:--vk-fg-subtlest)" : "text-(color:--vk-fg)");
|
|
56
|
-
return (_jsxs("div", { ref: setNodeRef, "data-vs-row": true, style: style, className: cx(comfortable ? SHEET_ROW_CLASS : PANEL_ROW_CLASS, comfortable && !isDragging && SHEET_ROW_GROUND_CLASS, isDragging && DRAGGING_CLASS), children: [!item.fixed && (_jsx("span", { ...attributes, ...listeners, "data-base-ui-swipe-ignore": true, className: "flex shrink-0 cursor-grab items-center text-(color:--vk-fg-subtlest) transition-colors hover:text-(color:--vk-fg-subtle) active:cursor-grabbing", style: { touchAction: "none" }, children: _jsx(Grip, { className: glyph }) })), _jsxs(RowBody, { onOpen: onOpen ? () => onOpen(item.id) : undefined, children: [_jsx("span", { className: cx("flex shrink-0 items-center justify-center", comfortable ? "h-7 w-7" : "h-4 w-4", item.hidden ? "text-(color:--vk-fg-subtlest)" : "text-(color:--vk-fg-subtle)"), children: item.icon }), value ? (_jsxs("span", { className: "flex min-w-0 flex-auto items-center gap-2.5 overflow-hidden", children: [_jsx("span", { className: cx("shrink-0 max-w-full truncate", nameClass), children: item.label }), _jsx("span", { className: cx("min-w-0 ml-auto truncate text-(color:--vk-fg-subtle)", comfortable ? "max-w-[35vw] text-(length:--vk-sheet-text,15px)" : "max-w-[120px] text-xs"), children: value })] })) : (_jsx("span", { className: cx("min-w-0 flex-auto truncate", nameClass), children: item.label }))] }), newLine && (_jsx(DisabledReason, { reason: newLineReason, side: "top", className: "inline-flex shrink-0", children: drawPanelButton(views, {
|
|
57
|
-
own: cx("flex shrink-0 items-center justify-center rounded-sm transition-colors", comfortable ? "h-7 w-7" : "h-5 w-5", inertNewLine
|
|
58
|
-
? "cursor-default text-(color:--vk-fg-subtlest)"
|
|
59
|
-
: newLine.has(item.id)
|
|
60
|
-
? "text-(color:--vk-fg) hover:bg-(color:--vk-hovered)"
|
|
61
|
-
: "text-(color:--vk-fg-subtlest) hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)"),
|
|
62
|
-
frame: iconFrame,
|
|
63
|
-
variant: "ghost",
|
|
64
|
-
size: "icon",
|
|
65
|
-
disabled: inertNewLine,
|
|
66
|
-
onClick: () => newLine.onToggle(item.id),
|
|
67
|
-
"aria-label": messages(newLine.has(item.id)
|
|
68
|
-
? { key: "views.panels.new-line-on", values: { label: item.label } }
|
|
69
|
-
: { key: "views.panels.new-line-start", values: { label: item.label } }),
|
|
70
|
-
"aria-pressed": newLine.has(item.id),
|
|
71
|
-
children: _jsx(NewLine, { className: glyph }),
|
|
72
|
-
}) })), !item.fixed && (_jsx(DisabledReason, { reason: toggleRefusal, side: "top", className: "inline-flex shrink-0", children: drawPanelButton(views, {
|
|
73
|
-
own: cx("flex shrink-0 items-center justify-center rounded-sm transition-colors", comfortable ? "h-7 w-7" : "h-5 w-5", canToggle
|
|
74
|
-
? "text-(color:--vk-fg-subtle) hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)"
|
|
75
|
-
: "cursor-default text-(color:--vk-fg-subtlest)"),
|
|
76
|
-
frame: iconFrame,
|
|
77
|
-
variant: "ghost",
|
|
78
|
-
size: "icon",
|
|
79
|
-
disabled: !canToggle,
|
|
80
|
-
onClick: () => onToggleHidden(item.id, !item.hidden),
|
|
81
|
-
"aria-label": messages({
|
|
82
|
-
key: item.hidden ? "views.panels.show" : "views.panels.hide",
|
|
83
|
-
values: { label: item.label },
|
|
84
|
-
}),
|
|
85
|
-
children: _jsx(Eye, { className: glyph }),
|
|
86
|
-
}) })), onOpen && _jsx(Chevron, { className: cx("shrink-0 text-(color:--vk-fg-subtlest)", glyph) })] }));
|
|
87
|
-
}
|
|
88
|
-
function RowBody({ onOpen, children }) {
|
|
89
|
-
const views = useViews();
|
|
90
|
-
const className = "flex min-w-0 flex-1 items-center gap-2.5 text-left";
|
|
91
|
-
if (!onOpen)
|
|
92
|
-
return _jsx("span", { className: className, children: children });
|
|
93
|
-
return drawPanelButton(views, {
|
|
94
|
-
own: className,
|
|
95
|
-
frame: "h-auto min-w-0 flex-1 justify-start gap-2.5 p-0 text-left [font:inherit]",
|
|
96
|
-
variant: "ghost",
|
|
97
|
-
size: "sm",
|
|
98
|
-
onClick: onOpen,
|
|
99
|
-
children,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { LayoutColumnItem, LayoutColumnsConfig } from "../model.js";
|
|
2
|
-
import type { PanelFieldEditor } from "./field-editor.js";
|
|
3
|
-
export declare function PopoverColumnDetail({ column, columns, onDone, fieldEditor, }: {
|
|
4
|
-
column: LayoutColumnItem;
|
|
5
|
-
columns: LayoutColumnsConfig;
|
|
6
|
-
/** Called once a field editor's row has opened its window: the panel steps out of the way. */
|
|
7
|
-
onDone?: () => void;
|
|
8
|
-
/** The app's field editor: its rows for this column's field (Edit field, Archive field), so a hidden field
|
|
9
|
-
* is edited from here without being shown first. */
|
|
10
|
-
fieldEditor?: PanelFieldEditor | null;
|
|
11
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { cx } from "../../internal/cx.js";
|
|
4
|
-
import { useViews } from "../../provider/context.js";
|
|
5
|
-
import { PANEL_LIST_CLASS, PANEL_SEPARATOR_CLASS, SECTION_HEADING_CLASS, SECTION_RULE_CLASS } from "./chrome.js";
|
|
6
|
-
import { columnToggleRefusal } from "./column-refusals.js";
|
|
7
|
-
const noop = () => { };
|
|
8
|
-
export function PopoverColumnDetail({ column, columns, onDone, fieldEditor, }) {
|
|
9
|
-
const { atoms, icons, messages } = useViews();
|
|
10
|
-
const { RadioRow, ToggleRow } = atoms;
|
|
11
|
-
const Eye = icons.show;
|
|
12
|
-
const editorRows = fieldEditor?.columnMenu(column.id, onDone ?? noop) ?? null;
|
|
13
|
-
const visibleCount = columns.items.filter((item) => !item.hidden).length;
|
|
14
|
-
const toggleRefusal = columnToggleRefusal(column, visibleCount, messages);
|
|
15
|
-
const choices = column.settings?.choices ?? [];
|
|
16
|
-
const allToggles = column.settings?.toggles ?? [];
|
|
17
|
-
const toggles = allToggles.filter((toggle) => !toggle.section);
|
|
18
|
-
const toggleSections = [
|
|
19
|
-
...new Set(allToggles.filter((toggle) => toggle.section).map((toggle) => toggle.section)),
|
|
20
|
-
];
|
|
21
|
-
return (_jsxs("div", { "data-vs-detail": true, className: cx("max-h-96", PANEL_LIST_CLASS), children: [!column.fixed && (_jsx(ToggleRow, { icon: _jsx(Eye, { className: "h-3.5 w-3.5" }), label: messages({ key: "views.panels.column-visible" }), active: !column.hidden, disabled: toggleRefusal !== null, disabledReason: toggleRefusal ?? undefined, onClick: () => columns.onToggleHidden(column.id, !column.hidden) })), choices.map((choice) => (_jsxs("div", { children: [_jsx("div", { className: SECTION_RULE_CLASS }), _jsx("div", { className: SECTION_HEADING_CLASS, children: choice.label }), choice.options.map((option) => (_jsx(RadioRow, { selected: choice.value === option.value, label: option.label, onClick: () => choice.onChange(option.value) }, option.value)))] }, choice.key))), toggles.length > 0 && _jsx("div", { className: SECTION_RULE_CLASS }), toggles.map((toggle) => (_jsx(ToggleRow, { label: toggle.label, active: toggle.value, onClick: () => toggle.onChange(!toggle.value) }, toggle.key))), toggleSections.map((section) => (_jsxs("div", { children: [_jsx("div", { className: SECTION_RULE_CLASS }), _jsx("div", { className: SECTION_HEADING_CLASS, children: section }), allToggles
|
|
22
|
-
.filter((toggle) => toggle.section === section)
|
|
23
|
-
.map((toggle) => (_jsx(ToggleRow, { label: toggle.label, active: toggle.value, onClick: () => toggle.onChange(!toggle.value) }, toggle.key)))] }, section))), editorRows && (_jsxs(_Fragment, { children: [_jsx("div", { className: PANEL_SEPARATOR_CLASS }), editorRows] }))] }));
|
|
24
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cx } from "../../internal/cx.js";
|
|
4
|
-
import { useViews } from "../../provider/context.js";
|
|
5
|
-
import { resolvePersonalSection } from "../availability.js";
|
|
6
|
-
import { drawPanelButton } from "../panel-button.js";
|
|
7
|
-
import { PANEL_LIST_CLASS, SECTION_HEADING_CLASS, SECTION_RULE_CLASS } from "./chrome.js";
|
|
8
|
-
const GLYPH = "h-3.5 w-3.5";
|
|
9
|
-
const noPick = () => undefined;
|
|
10
|
-
export function CompactLayoutDetail({ layout }) {
|
|
11
|
-
const views = useViews();
|
|
12
|
-
const { atoms, icons, messages } = views;
|
|
13
|
-
const { RadioRow, ToggleRow } = atoms;
|
|
14
|
-
const Options = icons.options;
|
|
15
|
-
const Person = icons.person;
|
|
16
|
-
const showSub = !layout.subOptionsFor || layout.value === layout.subOptionsFor;
|
|
17
|
-
const hasToggles = showSub && !!layout.toggles && layout.toggles.length > 0;
|
|
18
|
-
const density = !layout.densityFor || layout.densityFor.includes(layout.value) ? layout.density : undefined;
|
|
19
|
-
const choices = (layout.choices ?? []).filter((choice) => !choice.views || choice.views.includes(layout.value));
|
|
20
|
-
const personal = resolvePersonalSection(layout, messages);
|
|
21
|
-
return (_jsxs("div", { "data-vs-detail": true, className: cx("max-h-64", PANEL_LIST_CLASS), children: [layout.options.map((opt) => (_jsx(RadioRow, { mark: "box", selected: layout.value === opt.value, label: opt.label, onClick: () => layout.onChange(opt.value) }, opt.value))), layout.refused?.map((refusal) => (_jsx(RadioRow, { mark: "box", selected: false, disabled: true, label: refusal.label, disabledReason: refusal.reason, onClick: noPick }, refusal.value))), hasToggles && (_jsxs(_Fragment, { children: [_jsx("div", { className: SECTION_RULE_CLASS }), _jsx("div", { className: SECTION_HEADING_CLASS, children: messages({ key: "views.panels.layout-options" }) }), layout.toggles.map((t) => (_jsx(ToggleRow, { icon: t.icon ?? _jsx(Options, { className: GLYPH }), label: t.label, active: t.value, onClick: () => t.onChange(!t.value), reset: t.reset }, t.key)))] })), choices.map((choice) => (_jsxs("div", { children: [_jsx("div", { className: SECTION_RULE_CLASS }), _jsx("div", { className: SECTION_HEADING_CLASS, children: choice.label }), choice.options.map((opt) => (_jsx(RadioRow, { mark: "box", selected: choice.value === opt.value, label: opt.label, onClick: () => choice.onChange(opt.value) }, opt.value)))] }, choice.key))), density && (_jsxs(_Fragment, { children: [_jsx("div", { className: SECTION_RULE_CLASS }), _jsx("div", { className: SECTION_HEADING_CLASS, children: messages({ key: "views.panels.layout-density" }) }), density.options.map((opt) => (_jsx(RadioRow, { mark: "box", selected: density.value === opt.value, label: opt.label, onClick: () => density.onChange(opt.value) }, opt.value)))] })), personal && (_jsxs(_Fragment, { children: [_jsx("div", { className: SECTION_RULE_CLASS }), _jsx("div", { className: SECTION_HEADING_CLASS, children: personal.label }), personal.toggles.map((t) => (_jsx(ToggleRow, { icon: t.icon ?? _jsx(Person, { className: GLYPH }), label: t.label, active: t.value, onClick: () => t.onChange(!t.value) }, t.key))), personal.choices.map((choice) => (_jsxs("div", { children: [_jsx("div", { className: "px-3 pt-1.5 pb-1 text-(length:--vk-caption-text,10px) font-medium text-(color:--vk-fg-subtle)", children: choice.label }), choice.options.map((opt) => (_jsx(RadioRow, { mark: "box", selected: choice.value === opt.value, label: opt.label, onClick: () => choice.onChange(opt.value) }, opt.value)))] }, choice.key))), personal.onReset && (drawPanelButton(views, {
|
|
22
|
-
own: "w-full px-3 py-1.5 text-left text-xs text-(color:--vk-fg-subtle) transition-colors hover:text-(color:--vk-fg)",
|
|
23
|
-
frame: "h-auto w-full justify-start px-3 py-1.5 text-left",
|
|
24
|
-
variant: "ghost",
|
|
25
|
-
size: "sm",
|
|
26
|
-
onClick: personal.onReset,
|
|
27
|
-
children: messages({ key: "views.panels.personal-reset" }),
|
|
28
|
-
}))] }))] }));
|
|
29
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type ActivePanel, type ViewOptionInputs } from "../model.js";
|
|
2
|
-
/** The ordered root menu shared by popover and full-height overlay hosts. */
|
|
3
|
-
export declare function PopoverRootList<S extends string = string, G extends string = string, T extends string = string>({ filters, sort, group, timeScopeConfig, dateRangeConfigs, toggles, layout, onOpenPanel, foldFilters, }: ViewOptionInputs<S, G, T> & {
|
|
4
|
-
onOpenPanel: (panel: ActivePanel) => void;
|
|
5
|
-
foldFilters?: boolean;
|
|
6
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useViews } from "../../provider/context.js";
|
|
4
|
-
import { dimensionRows } from "../filter/filter-list.js";
|
|
5
|
-
import { filterRowValueLabel, groupValueLabel, layoutValueLabel, sortValueLabel } from "../labels.js";
|
|
6
|
-
import { countActiveFilters, isGroupActive, isSortActive } from "../model.js";
|
|
7
|
-
const GLYPH = "h-3.5 w-3.5";
|
|
8
|
-
const ROOT_LIST_CLASS = "p-(--vk-panel-padding,0.375rem)";
|
|
9
|
-
export function PopoverRootList({ filters, sort, group, timeScopeConfig, dateRangeConfigs, toggles, layout, onOpenPanel, foldFilters = true, }) {
|
|
10
|
-
const { atoms, icons, messages } = useViews();
|
|
11
|
-
const { MenuRow, ToggleRow } = atoms;
|
|
12
|
-
const hasToggles = !!toggles && toggles.length > 0;
|
|
13
|
-
const showSubOptions = !layout?.subOptionsFor || layout.value === layout.subOptionsFor;
|
|
14
|
-
const showColumns = layout?.columnsFor ? layout.columnsFor.includes(layout.value) : showSubOptions;
|
|
15
|
-
const hasColumns = showColumns && !!layout?.columns && layout.columns.items.length > 0;
|
|
16
|
-
const hasAnyFilter = (filters?.length ?? 0) > 0 || !!timeScopeConfig || (dateRangeConfigs?.length ?? 0) > 0;
|
|
17
|
-
const activeFilterCount = countActiveFilters({ filters, dateRangeConfigs });
|
|
18
|
-
const layoutRow = layout && (_jsx(MenuRow, { icon: _jsx(icons.layout, { className: GLYPH }), label: layout.label ?? messages({ key: "views.panels.layout" }), value: layoutValueLabel(layout), active: false, onClick: () => onOpenPanel({ type: "layout" }) }));
|
|
19
|
-
const columnsRow = hasColumns && (_jsx(MenuRow, { icon: _jsx(icons.columns, { className: GLYPH }), label: layout.columnsLabelByView?.[layout.value] ?? messages({ key: "views.panels.columns" }), value: messages({
|
|
20
|
-
key: "views.panels.columns-shown",
|
|
21
|
-
values: { count: layout.columns.items.filter((column) => !column.hidden).length },
|
|
22
|
-
}), active: false, onClick: () => onOpenPanel({ type: "columns" }) }));
|
|
23
|
-
const sortRow = sort && (_jsx(MenuRow, { icon: _jsx(icons.sort, { className: GLYPH }), label: sort.label ?? messages({ key: "views.panels.sort" }), value: sortValueLabel(sort, messages), active: isSortActive(sort), onClick: () => onOpenPanel({ type: "sort" }) }));
|
|
24
|
-
const groupRow = group && (_jsx(MenuRow, { icon: _jsx(icons.group, { className: GLYPH }), label: group.label ?? messages({ key: "views.panels.group" }), value: groupValueLabel(group, messages), active: isGroupActive(group), onClick: () => onOpenPanel({ type: "group" }) }));
|
|
25
|
-
const toggleRows = hasToggles &&
|
|
26
|
-
toggles.map((toggle) => (_jsx(ToggleRow, { icon: toggle.icon, label: toggle.label, active: toggle.value, onClick: () => toggle.onChange(!toggle.value), reset: toggle.reset }, toggle.key)));
|
|
27
|
-
if (foldFilters) {
|
|
28
|
-
return (_jsxs("div", { "data-vs-detail": true, className: ROOT_LIST_CLASS, children: [layoutRow, columnsRow, hasAnyFilter && (_jsx(MenuRow, { icon: _jsx(icons.filter, { className: GLYPH }), label: messages({ key: "views.panels.filter" }), value: filterRowValueLabel(activeFilterCount, messages), active: activeFilterCount > 0, onClick: () => onOpenPanel({ type: "filters" }) })), sortRow, groupRow, toggleRows] }));
|
|
29
|
-
}
|
|
30
|
-
return (_jsxs("div", { "data-vs-detail": true, className: ROOT_LIST_CLASS, children: [layoutRow, columnsRow, dimensionRows(filters, undefined, undefined, onOpenPanel), sortRow, groupRow, dimensionRows(undefined, timeScopeConfig, dateRangeConfigs, onOpenPanel), toggleRows] }));
|
|
31
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { DragEndEvent } from "@dnd-kit/core";
|
|
2
|
-
import { type KeyboardEventHandler } from "react";
|
|
3
|
-
import { type DragKit, type DragSensors } from "../drag-kit.js";
|
|
4
|
-
/** The mouse moves this far before a press becomes a drag, as the panels' lists: a press on a grip stays a press. */
|
|
5
|
-
export declare const SORT_DRAG_DISTANCE = 8;
|
|
6
|
-
export declare function useSortDrag(o: {
|
|
7
|
-
/** The loaded drag kit (`useDragKit`); null, the rules move by the keys alone. */
|
|
8
|
-
kit: DragKit | null;
|
|
9
|
-
count: number;
|
|
10
|
-
/** The rules' ids, in order: what a drag's `active` and `over` name. */
|
|
11
|
-
ids: readonly string[];
|
|
12
|
-
onMove: (from: number, to: number) => void;
|
|
13
|
-
}): {
|
|
14
|
-
sensors: DragSensors;
|
|
15
|
-
onDragEnd: (event: Pick<DragEndEvent, "active" | "over">) => void;
|
|
16
|
-
gripKeyDown: (i: number) => KeyboardEventHandler<HTMLElement>;
|
|
17
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useLayoutEffect, useRef } from "react";
|
|
3
|
-
import { useDragSensors } from "../drag-kit.js";
|
|
4
|
-
export const SORT_DRAG_DISTANCE = 8;
|
|
5
|
-
export function useSortDrag(o) {
|
|
6
|
-
const { kit, count, ids, onMove } = o;
|
|
7
|
-
const sensors = useDragSensors(kit, { mouse: SORT_DRAG_DISTANCE, touch: true });
|
|
8
|
-
const follow = useRef(null);
|
|
9
|
-
useLayoutEffect(() => {
|
|
10
|
-
const to = follow.current;
|
|
11
|
-
if (!to)
|
|
12
|
-
return;
|
|
13
|
-
follow.current = null;
|
|
14
|
-
to.list
|
|
15
|
-
?.querySelectorAll('[data-slot="vk-sort-rule"]')[to.at]?.querySelector("button")
|
|
16
|
-
?.focus({ preventScroll: true });
|
|
17
|
-
});
|
|
18
|
-
const onDragEnd = ({ active, over }) => {
|
|
19
|
-
if (!over || active.id === over.id)
|
|
20
|
-
return;
|
|
21
|
-
const from = ids.indexOf(String(active.id));
|
|
22
|
-
const to = ids.indexOf(String(over.id));
|
|
23
|
-
if (from < 0 || to < 0)
|
|
24
|
-
return;
|
|
25
|
-
onMove(from, to);
|
|
26
|
-
};
|
|
27
|
-
const gripKeyDown = (i) => (event) => {
|
|
28
|
-
const to = event.key === "ArrowUp" ? i - 1 : event.key === "ArrowDown" ? i + 1 : null;
|
|
29
|
-
if (to === null)
|
|
30
|
-
return;
|
|
31
|
-
event.preventDefault();
|
|
32
|
-
event.stopPropagation();
|
|
33
|
-
if (to < 0 || to >= count)
|
|
34
|
-
return;
|
|
35
|
-
follow.current = { list: event.currentTarget.closest('[data-slot="vk-sort-editor"]'), at: to };
|
|
36
|
-
onMove(i, to);
|
|
37
|
-
};
|
|
38
|
-
return { sensors, onDragEnd, gripKeyDown };
|
|
39
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { CollectionViewState } from "../view-state.js";
|
|
2
|
-
/**
|
|
3
|
-
* Linear's footer, one for one: their "Set default for everyone" sits under the display options, and nothing
|
|
4
|
-
* anywhere else says "unsaved".
|
|
5
|
-
*
|
|
6
|
-
* Drawn only while `changes` is above zero: a panel over a view that matches everyone's has nothing to reset
|
|
7
|
-
* and nothing to publish, and an always-on footer would be the persistent prompt this replaces. A member sees
|
|
8
|
-
* Reset alone: a control that cannot be pressed teaches nothing, so the missing verb is simply not there.
|
|
9
|
-
*
|
|
10
|
-
* `className` replaces the footer's side inset (`px-3`, the rows' own), so a host with wider rows (a phone
|
|
11
|
-
* sheet's `px-4`) lines it up with them.
|
|
12
|
-
*/
|
|
13
|
-
export declare function ViewFooter({ view, onClear, words, className, }: {
|
|
14
|
-
view?: CollectionViewState;
|
|
15
|
-
/** With no shared view: Clear alone, which this takes the list back with. */
|
|
16
|
-
onClear?: () => void;
|
|
17
|
-
/** `kit`: Clear and Save, the toolbar's words for them, in place of Reset and Save for everyone. */
|
|
18
|
-
words?: "kit";
|
|
19
|
-
className?: string;
|
|
20
|
-
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cx } from "../../internal/cx.js";
|
|
4
|
-
import { useViews } from "../../provider/context.js";
|
|
5
|
-
import { drawPanelButton } from "../panel-button.js";
|
|
6
|
-
export function ViewFooter({ view, onClear, words, className, }) {
|
|
7
|
-
const views = useViews();
|
|
8
|
-
const { messages } = views;
|
|
9
|
-
const kit = words === "kit";
|
|
10
|
-
if (!view) {
|
|
11
|
-
if (!onClear)
|
|
12
|
-
return null;
|
|
13
|
-
return (_jsx("div", { "data-vs-footer": true, "data-vs-inset": true, className: cx(className ?? "px-3", "py-2"), children: drawPanelButton(views, {
|
|
14
|
-
own: "text-sm text-(color:--vk-fg-subtle) transition-colors hover:text-(color:--vk-fg) disabled:opacity-50",
|
|
15
|
-
frame: "h-auto p-0",
|
|
16
|
-
variant: "ghost",
|
|
17
|
-
size: "sm",
|
|
18
|
-
onClick: onClear,
|
|
19
|
-
children: messages({ key: kit ? "views.panels.view-clear" : "views.panels.view-reset" }),
|
|
20
|
-
}) }));
|
|
21
|
-
}
|
|
22
|
-
if (view.changes === 0)
|
|
23
|
-
return null;
|
|
24
|
-
return (_jsx("div", { "data-vs-footer": true, "data-vs-inset": true, className: cx(className ?? "px-3", "py-2"), children: _jsxs("div", { className: "flex min-w-0 flex-col items-start gap-1", children: [view.stale && (_jsx("p", { className: "m-0 text-xs text-(color:--vk-fg-subtle)", children: messages({ key: "views.panels.view-stale" }) })), _jsxs("div", { className: "flex items-center gap-4", children: [view.canPublish && (drawPanelButton(views, {
|
|
25
|
-
own: "text-sm font-medium text-(color:--vk-fg-brand) transition-opacity hover:opacity-80 disabled:opacity-50",
|
|
26
|
-
frame: "h-auto p-0",
|
|
27
|
-
variant: "ghost",
|
|
28
|
-
size: "sm",
|
|
29
|
-
disabled: view.pending,
|
|
30
|
-
onClick: view.onPublish,
|
|
31
|
-
children: messages({ key: kit ? "views.panels.view-save" : "views.panels.view-publish" }),
|
|
32
|
-
})), drawPanelButton(views, {
|
|
33
|
-
own: "text-sm text-(color:--vk-fg-subtle) transition-colors hover:text-(color:--vk-fg) disabled:opacity-50",
|
|
34
|
-
frame: "h-auto p-0",
|
|
35
|
-
variant: "ghost",
|
|
36
|
-
size: "sm",
|
|
37
|
-
disabled: view.pending,
|
|
38
|
-
onClick: view.onReset,
|
|
39
|
-
children: messages({ key: kit ? "views.panels.view-clear" : "views.panels.view-reset" }),
|
|
40
|
-
})] })] }) }));
|
|
41
|
-
}
|