viewkitjs 0.29.0 → 0.30.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 +111 -0
- 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/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 +2 -5
- 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 +26 -13
- 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,22 +1,19 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ViewsCustomizeBodyProps, ViewsCustomizeFields } from "../../provider/components.js";
|
|
3
3
|
import { useViews } from "../../provider/context.js";
|
|
4
|
-
import type { GroupConfig } from "../model.js";
|
|
5
4
|
import type { ViewOptionsPanelContentProps } from "./customize.js";
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
onStepChange?: (step: ViewsBodyStep | null) => void;
|
|
13
|
-
}): ReactNode;
|
|
5
|
+
/** A list's per-field filters, its time range and its date ranges as a Customize body's `fields` (VK-891), as ViewKit's own
|
|
6
|
+
* Customize lists them: each filter (none where the list has a filter tree, which holds them), the time range, each date range;
|
|
7
|
+
* folded behind Filter where the list folds them. A choice of one or several is handed as its options; any other kind as ViewKit's
|
|
8
|
+
* own body for its value. Each writes through its config's own change; the time range's Custom keeps the older page's rule: a press
|
|
9
|
+
* after a whole range starts a new one, and the first press stays a partial range. */
|
|
10
|
+
export declare function customizeFieldsOf(props: Pick<ViewOptionsPanelContentProps, "filters" | "filterTree" | "timeScopeConfig" | "dateRangeConfigs" | "foldFilters">, { icons, messages, conventions }: Pick<ReturnType<typeof useViews>, "icons" | "messages" | "conventions">): ViewsCustomizeFields | undefined;
|
|
14
11
|
/** Customize's own props as a body is handed them: the view's settings as data, the page mapped onto the body's, the ✕ on a
|
|
15
12
|
* phone only where the sheet's head doesn't draw it. */
|
|
16
13
|
export declare function customizeBodyPropsOf(props: ViewOptionsPanelContentProps & {
|
|
17
14
|
form: "computer" | "phone";
|
|
18
|
-
}, { components, icons, messages }: Pick<ReturnType<typeof useViews>, "components" | "icons" | "messages">): ViewsCustomizeBodyProps;
|
|
19
|
-
/** The app's `CustomizeBody` over Customize's own props (customizeBodyPropsOf).
|
|
15
|
+
}, { components, icons, messages, conventions }: Pick<ReturnType<typeof useViews>, "components" | "icons" | "messages" | "conventions">): ViewsCustomizeBodyProps;
|
|
16
|
+
/** The app's `CustomizeBody` over Customize's own props (customizeBodyPropsOf). */
|
|
20
17
|
export declare function AppCustomizeBody(props: ViewOptionsPanelContentProps & {
|
|
21
18
|
form: "computer" | "phone";
|
|
22
19
|
}): ReactNode;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { FILTER_TREE_MAX_UI_DEPTH } from "viewkitjs/fields/query";
|
|
3
|
+
import { FILTER_TREE_MAX_UI_DEPTH, fromDayKey, toDayKey } from "viewkitjs/fields/query";
|
|
4
4
|
import { useContext } from "react";
|
|
5
|
+
import { isDateFilter, isFilterActive, isNumberFilter, isRangeFilter, isRelationFilter, isTextFilter, isUnavailableFilter } from "../../filters/filter-model.js";
|
|
6
|
+
import { dateRangeValueLabel, filterValueLabel, timeScopeRowValueLabel } from "../labels.js";
|
|
7
|
+
import { isDateRangeActive } from "../model.js";
|
|
8
|
+
import { FilterIcon } from "../filter/FilterIcon.js";
|
|
5
9
|
import { useViews } from "../../provider/context.js";
|
|
6
10
|
import { activePanelOf, customizeColumnsOf, customizeLayoutOf, customizePageOf, customizeSortOf, customizeToggleOf, groupBodyProps, } from "../customize-body.js";
|
|
7
11
|
import { filterBodyChangeFits, listedFieldsOf, takesValue } from "../settings/filter-groups.js";
|
|
@@ -9,13 +13,6 @@ import { sortBodyOptions } from "../sort-body-options.js";
|
|
|
9
13
|
import { PanelStepHold } from "./panel-step.js";
|
|
10
14
|
import { filterBodyFields } from "./filter/filter-body.js";
|
|
11
15
|
import { FilterValueBody } from "./filter/FilterValueBody.js";
|
|
12
|
-
export function AppGroupBody({ group, form, onDone, onStepChange, }) {
|
|
13
|
-
const { components, messages } = useViews();
|
|
14
|
-
const GroupBody = components.GroupBody;
|
|
15
|
-
if (!GroupBody)
|
|
16
|
-
return null;
|
|
17
|
-
return _jsx(GroupBody, { ...groupBodyProps(group, messages), form: form, onDone: onDone, ...(onStepChange && { onStepChange }) });
|
|
18
|
-
}
|
|
19
16
|
function customizeFilterOf(filterTree, messages) {
|
|
20
17
|
const level = { op: filterTree.tree.op, items: filterTree.tree.items };
|
|
21
18
|
const levels = FILTER_TREE_MAX_UI_DEPTH;
|
|
@@ -38,9 +35,59 @@ function customizeFilterOf(filterTree, messages) {
|
|
|
38
35
|
},
|
|
39
36
|
};
|
|
40
37
|
}
|
|
41
|
-
|
|
38
|
+
const dayOf = (date) => (date ? toDayKey(date) : null);
|
|
39
|
+
const dateOf = (day) => (day ? fromDayKey(day) : null);
|
|
40
|
+
export function customizeFieldsOf(props, { icons, messages, conventions }) {
|
|
41
|
+
const { filters, filterTree, timeScopeConfig: time, dateRangeConfigs } = props;
|
|
42
|
+
const fieldOf = (f) => {
|
|
43
|
+
const base = {
|
|
44
|
+
key: f.key, label: f.label, icon: _jsx(FilterIcon, { filter: f, className: "h-3.5 w-3.5" }),
|
|
45
|
+
...(f.section !== undefined && { section: f.section }),
|
|
46
|
+
says: filterValueLabel(f, conventions, messages), inForce: (f.countsAsFilter ?? true) && isFilterActive(f),
|
|
47
|
+
...(f.disabled && { disabled: f.disabledReason ?? "" }), place: "filters", ...(f.onOpen && { onOpen: f.onOpen }),
|
|
48
|
+
};
|
|
49
|
+
if (isTextFilter(f) || isNumberFilter(f) || isRangeFilter(f) || isDateFilter(f) || isRelationFilter(f) || isUnavailableFilter(f)
|
|
50
|
+
|| f.renderOption || f.renderTrailing)
|
|
51
|
+
return { ...base, body: _jsx(FilterValueBody, { filter: f }) };
|
|
52
|
+
const options = f.options.map((o) => ({ value: o.value, label: o.label, ...(f.renderLeading && { mark: f.renderLeading(o) }) }));
|
|
53
|
+
if (f.multi)
|
|
54
|
+
return { ...base, check: { value: f.value, options, onChange: (v) => f.onChange([...v]) } };
|
|
55
|
+
const all = f.hideAllOption ? [] : [{ value: f.allValue ?? "all", label: f.allLabel ?? messages({ key: "views.panels.filter-all-of", values: { field: f.label } }) }];
|
|
56
|
+
return { ...base, pick: { value: f.value, options: [...all, ...options], onChange: (v) => f.onChange(v) } };
|
|
57
|
+
};
|
|
58
|
+
const items = [
|
|
59
|
+
...(filterTree ? [] : (filters ?? []).map((f) => fieldOf(f))),
|
|
60
|
+
...(time ? [{
|
|
61
|
+
key: "time-scope", label: time.label ?? messages({ key: "views.panels.time-scope-label" }), icon: _jsx(icons.time, { className: "h-3.5 w-3.5" }),
|
|
62
|
+
says: timeScopeRowValueLabel(time, messages, conventions), inForce: false, place: "after",
|
|
63
|
+
time: {
|
|
64
|
+
value: time.value, options: time.options, onChange: (v) => time.onChange(v),
|
|
65
|
+
...(time.enableCustom === true && time.customValue !== undefined && { custom: {
|
|
66
|
+
label: time.customLabel ?? messages({ key: "views.panels.time-scope-custom" }),
|
|
67
|
+
...(time.value === time.customValue && { says: timeScopeRowValueLabel(time, messages, conventions) }),
|
|
68
|
+
on: time.value === time.customValue, from: dayOf(time.customRange?.from ?? null), to: dayOf(time.customRange?.to ?? null),
|
|
69
|
+
onPress: (next, day) => {
|
|
70
|
+
const now = time.customRange ?? { from: null, to: null };
|
|
71
|
+
if (now.from && now.to && day)
|
|
72
|
+
time.onCustomRangeChange?.({ from: dateOf(day), to: null });
|
|
73
|
+
else
|
|
74
|
+
time.onCustomRangeChange?.({ from: dateOf(next.from), to: dateOf(next.to) });
|
|
75
|
+
},
|
|
76
|
+
} }),
|
|
77
|
+
},
|
|
78
|
+
}] : []),
|
|
79
|
+
...(dateRangeConfigs ?? []).map((d) => ({
|
|
80
|
+
key: `date-range:${d.key}`, label: d.label ?? messages({ key: "views.panels.date-range-label" }), icon: _jsx(icons.date, { className: "h-3.5 w-3.5" }),
|
|
81
|
+
says: dateRangeValueLabel(d, messages, conventions), inForce: isDateRangeActive(d), place: "after",
|
|
82
|
+
dates: { from: dayOf(d.value.from), to: dayOf(d.value.to), onChange: (next) => d.onChange({ from: dateOf(next.from), to: dateOf(next.to) }) },
|
|
83
|
+
})),
|
|
84
|
+
];
|
|
85
|
+
return items.length ? { folded: props.foldFilters ?? true, items } : undefined;
|
|
86
|
+
}
|
|
87
|
+
export function customizeBodyPropsOf(props, { components, icons, messages, conventions }) {
|
|
42
88
|
const { layout, filterTree, group, toggles, activePanel, onOpenPanel, anyActive, clearAll, onClose, closeButton = true, view, viewFoot, footClear, fieldEditor, form, viewName, onRenameView, onCopyLink, onExport, exportCount, } = props;
|
|
43
89
|
const columns = layout ? customizeColumnsOf(layout, fieldEditor, messages) : undefined;
|
|
90
|
+
const fields = customizeFieldsOf(props, { icons, messages, conventions });
|
|
44
91
|
const unmarked = customizeSortOf(props, messages);
|
|
45
92
|
const sort = unmarked && {
|
|
46
93
|
...unmarked,
|
|
@@ -53,6 +100,7 @@ export function customizeBodyPropsOf(props, { components, icons, messages }) {
|
|
|
53
100
|
...(layout && { layout: customizeLayoutOf(layout, messages) }),
|
|
54
101
|
...(columns && { columns }),
|
|
55
102
|
...(filterTree && { filter: customizeFilterOf(filterTree, messages) }),
|
|
103
|
+
...(fields && { fields }),
|
|
56
104
|
...(sort && { sort }),
|
|
57
105
|
...(group && { group: groupBodyProps(group, messages) }),
|
|
58
106
|
toggles: (toggles ?? []).map(customizeToggleOf),
|
|
@@ -85,7 +133,5 @@ export function AppCustomizeBody(props) {
|
|
|
85
133
|
const views = useViews();
|
|
86
134
|
const step = useContext(PanelStepHold);
|
|
87
135
|
const CustomizeBody = views.components.CustomizeBody;
|
|
88
|
-
if (!CustomizeBody)
|
|
89
|
-
return null;
|
|
90
136
|
return _jsx(CustomizeBody, { ...customizeBodyPropsOf(props, views), ...(props.form === "phone" && step && { onStepChange: step.onStepChange }) });
|
|
91
137
|
}
|
|
@@ -7,30 +7,27 @@ export type ViewOptionsPanelContentProps<S extends string = string, G extends st
|
|
|
7
7
|
onOpenPanel: (p: ActivePanel) => void;
|
|
8
8
|
anyActive: boolean;
|
|
9
9
|
clearAll: () => void;
|
|
10
|
-
/** The shared view this list shows, when it shows one
|
|
11
|
-
*
|
|
10
|
+
/** The shared view this list shows, when it shows one, handed to the body as `view` (its Reset and Publish); present,
|
|
11
|
+
* the body is handed no Clear all. See `CollectionViewState`. */
|
|
12
12
|
view?: CollectionViewState;
|
|
13
13
|
/** The foot's words: `kit` for Clear and Save, `none` for no foot (they stand elsewhere, on a toolbar's bar);
|
|
14
14
|
* absent, Reset and Save for everyone. */
|
|
15
15
|
viewFoot?: "kit" | "none";
|
|
16
16
|
/** With no shared view, the foot's Clear, taking the list back to its default; absent, no foot. */
|
|
17
17
|
footClear?: () => void;
|
|
18
|
-
/**
|
|
19
|
-
* dimension is a root row (dashboards). */
|
|
18
|
+
/** The body's `fields` folded behind one Filter row (list pages); off, each is a row of its own (dashboards). */
|
|
20
19
|
foldFilters?: boolean;
|
|
21
|
-
/** Dismisses the whole panel
|
|
22
|
-
* renders no ✕ rather than a dead one. */
|
|
20
|
+
/** Dismisses the whole panel: the body's `onDone`, and on a phone its ✕. */
|
|
23
21
|
onClose?: () => void;
|
|
24
|
-
/** Whether
|
|
25
|
-
* dismisses the panel from inside
|
|
22
|
+
/** Whether a phone's body is handed its ✕ (default true): false in a sheet whose own head draws it, where `onClose` still
|
|
23
|
+
* dismisses the panel from inside. */
|
|
26
24
|
closeButton?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* their content. */
|
|
25
|
+
/** @deprecated Read by nothing: the app's body sizes itself in its host. It drew ViewKit's older Customize full height. */
|
|
29
26
|
fill?: boolean;
|
|
30
|
-
/** The list's field editor (Add field, Edit field), handed to the
|
|
27
|
+
/** The list's field editor (Add field, Edit field), handed to the body's columns as `columnMenu` and `footer`. */
|
|
31
28
|
fieldEditor?: PanelFieldEditor | null;
|
|
32
29
|
/** What an app hands Customize through the toolbar, each drawn by a `CustomizeBody` only where handed: the view's name with
|
|
33
|
-
* its rename, Copy link, and Export CSV with its count.
|
|
30
|
+
* its rename, Copy link, and Export CSV with its count. */
|
|
34
31
|
viewName?: string;
|
|
35
32
|
onRenameView?: (name: string) => void;
|
|
36
33
|
onCopyLink?: () => void;
|
|
@@ -1,118 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx
|
|
3
|
-
import {
|
|
4
|
-
import { isRelationFilter } from "../../filters/filter-model.js";
|
|
5
|
-
import { cx } from "../../internal/cx.js";
|
|
6
|
-
import { useViews } from "../../provider/context.js";
|
|
7
|
-
import { CompactDateRangeDetail, CompactFilterDetail, CompactToggleDetail } from "../filter/details.js";
|
|
8
|
-
import { CompactFilterList } from "../filter/filter-list.js";
|
|
9
|
-
import { CompactTimeScopeDetail } from "../filter/TimeScopeDetail.js";
|
|
10
|
-
import { customizePageOf, perFieldFiltersOnly } from "../customize-body.js";
|
|
11
|
-
import { drawPanelButton } from "../panel-button.js";
|
|
12
|
-
import { PANEL_LIST_CLASS } from "./chrome.js";
|
|
13
|
-
import { AppCustomizeBody, AppGroupBody, customizeBodyPropsOf } from "./customize-body.js";
|
|
14
|
-
import { CompactLayoutDetail } from "./layout-detail.js";
|
|
15
|
-
import { LayoutColumnsList } from "./LayoutColumnsList.js";
|
|
16
|
-
import { PanelHeader } from "./panel-header.js";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { AppCustomizeBody } from "./customize-body.js";
|
|
17
4
|
import { useSheetPanels } from "./panel-sheet.js";
|
|
18
|
-
import { PanelStepHold, usePanelStep } from "./panel-step.js";
|
|
19
|
-
import { CompactGroupByDetail, CompactGroupDateByDetail, CompactGroupDetail, CompactGroupSortDetail, CompactSortDetail, } from "./order-details.js";
|
|
20
|
-
import { PopoverColumnDetail } from "./PopoverColumnDetail.js";
|
|
21
|
-
import { PopoverRootList } from "./root-list.js";
|
|
22
|
-
import { ViewFooter } from "./view-footer.js";
|
|
23
5
|
export function ViewOptionsPanelContent(props) {
|
|
24
|
-
const { filters, sort, group, timeScopeConfig, dateRangeConfigs, toggles, layout, activePanel, onOpenPanel, anyActive, clearAll, foldFilters = true, onClose, closeButton = true, fill = false, view, viewFoot, footClear, fieldEditor, } = props;
|
|
25
|
-
const views = useViews();
|
|
26
|
-
const { messages } = views;
|
|
27
6
|
const sheet = useSheetPanels();
|
|
28
|
-
const ownStep = usePanelStep();
|
|
29
|
-
const groupStep = useContext(PanelStepHold) ?? ownStep;
|
|
30
|
-
const [backHandler, setBackHandlerRaw] = useState(null);
|
|
31
|
-
const setBackHandler = useCallback((fn) => {
|
|
32
|
-
setBackHandlerRaw(fn ? { fn } : null);
|
|
33
|
-
}, []);
|
|
34
|
-
const isFilterDimension = activePanel?.type === "filter" || activePanel?.type === "timeScope" || activePanel?.type === "dateRange";
|
|
35
|
-
const onBackClick = () => {
|
|
36
|
-
if (backHandler?.fn())
|
|
37
|
-
return;
|
|
38
|
-
if (activePanel?.type === "filter" && activePanel.field) {
|
|
39
|
-
onOpenPanel({ type: "filter", key: activePanel.key });
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (foldFilters && isFilterDimension) {
|
|
43
|
-
onOpenPanel({ type: "filters" });
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (activePanel?.type === "column") {
|
|
47
|
-
onOpenPanel({ type: "columns" });
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (activePanel?.type === "groupBy" || activePanel?.type === "groupSort" || activePanel?.type === "groupDateBy") {
|
|
51
|
-
onOpenPanel(views.components.GroupBody ? null : { type: "group" });
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
onOpenPanel(null);
|
|
55
|
-
};
|
|
56
|
-
const activeFilter = activePanel?.type === "filter" ? (filters?.find((f) => f.key === activePanel.key) ?? null) : null;
|
|
57
|
-
const activeField = activePanel?.type === "filter" && activePanel.field && activeFilter && isRelationFilter(activeFilter)
|
|
58
|
-
? (activeFilter.where.find((w) => w.key === activePanel.field) ?? null)
|
|
59
|
-
: null;
|
|
60
|
-
const activeToggle = activePanel?.type === "toggle" ? (toggles?.find((t) => t.key === activePanel.key) ?? null) : null;
|
|
61
|
-
const activeDateRange = activePanel?.type === "dateRange" ? (dateRangeConfigs?.find((d) => d.key === activePanel.key) ?? null) : null;
|
|
62
|
-
const activeColumn = activePanel?.type === "column" ? (layout?.columns?.items.find((c) => c.id === activePanel.key) ?? null) : null;
|
|
63
|
-
const panelTitle = activePanel?.type === "filters"
|
|
64
|
-
? messages({ key: "views.panels.filter" })
|
|
65
|
-
: activePanel?.type === "columns"
|
|
66
|
-
? (layout?.columnsLabelByView?.[layout.value] ?? messages({ key: "views.panels.columns" }))
|
|
67
|
-
: activePanel?.type === "column"
|
|
68
|
-
? (activeColumn?.label ?? messages({ key: "views.panels.column" }))
|
|
69
|
-
: activePanel?.type === "layout"
|
|
70
|
-
? (layout?.label ?? messages({ key: "views.panels.layout" }))
|
|
71
|
-
: activeField && activeFilter
|
|
72
|
-
? messages({
|
|
73
|
-
key: "views.panels.where-field-title",
|
|
74
|
-
values: { relation: activeFilter.label, field: activeField.label },
|
|
75
|
-
})
|
|
76
|
-
: activePanel?.type === "filter" && activeFilter
|
|
77
|
-
? activeFilter.label
|
|
78
|
-
: activePanel?.type === "sort"
|
|
79
|
-
? (sort?.label ?? messages({ key: "views.panels.sort" }))
|
|
80
|
-
: activePanel?.type === "group"
|
|
81
|
-
? (group?.label ?? messages({ key: "views.panels.group" }))
|
|
82
|
-
: activePanel?.type === "groupBy"
|
|
83
|
-
? messages({ key: "views.panels.group-by" })
|
|
84
|
-
: activePanel?.type === "groupSort"
|
|
85
|
-
? messages({ key: "views.panels.sort" })
|
|
86
|
-
: activePanel?.type === "groupDateBy"
|
|
87
|
-
? messages({ key: "views.panels.date-by" })
|
|
88
|
-
: activePanel?.type === "timeScope"
|
|
89
|
-
? (timeScopeConfig?.label ?? messages({ key: "views.panels.time-scope-label" }))
|
|
90
|
-
: activeDateRange
|
|
91
|
-
? (activeDateRange.label ?? messages({ key: "views.panels.date-range-label" }))
|
|
92
|
-
: activePanel?.type === "toggle" && activeToggle
|
|
93
|
-
? activeToggle.label
|
|
94
|
-
: null;
|
|
95
|
-
const panelKey = activePanel?.type === "filter"
|
|
96
|
-
? `filter-${activePanel.key}${activePanel.field ? `-${activePanel.field}` : ""}`
|
|
97
|
-
: activePanel?.type === "toggle"
|
|
98
|
-
? `toggle-${activePanel.key}`
|
|
99
|
-
: activePanel?.type === "dateRange"
|
|
100
|
-
? `dateRange-${activePanel.key}`
|
|
101
|
-
: activePanel?.type === "column"
|
|
102
|
-
? `column-${activePanel.key}`
|
|
103
|
-
: (activePanel?.type ?? "root");
|
|
104
|
-
const appBody = views.components.CustomizeBody;
|
|
105
7
|
const bodyProps = props;
|
|
106
|
-
|
|
107
|
-
return _jsx(AppCustomizeBody, { ...bodyProps, form: sheet ? "phone" : "computer" });
|
|
108
|
-
return (_jsxs("div", { className: cx("flex flex-col", fill && "h-full min-h-0"), children: [_jsx(PanelHeader, { title: activePanel ? (groupStep.title ?? panelTitle) : messages({ key: "views.panels.customize-title" }), onBack: activePanel ? (groupStep.back ?? onBackClick) : undefined, onClose: closeButton ? onClose : undefined, trailing: !activePanel &&
|
|
109
|
-
!view &&
|
|
110
|
-
anyActive && (drawPanelButton(views, {
|
|
111
|
-
own: "shrink-0 text-xs text-(color:--vk-fg-brand) transition-colors",
|
|
112
|
-
frame: "h-auto shrink-0 p-0",
|
|
113
|
-
variant: "ghost",
|
|
114
|
-
size: "sm",
|
|
115
|
-
onClick: clearAll,
|
|
116
|
-
children: messages({ key: "views.panels.clear-all" }),
|
|
117
|
-
})) }), _jsx("div", { className: cx("animate-in fade-in-0 slide-in-from-right-2 duration-(--vk-duration,150ms)", fill && "flex-1 min-h-0 overflow-y-auto overscroll-contain **:data-vs-detail:max-h-none"), children: activePanel?.type === "layout" && layout ? (_jsx(CompactLayoutDetail, { layout: layout })) : views.components.GroupBody && group && customizePageOf(activePanel) === "group" ? (_jsx(AppGroupBody, { group: group, form: sheet ? "phone" : "computer", onDone: () => onOpenPanel(null), onStepChange: groupStep.onStepChange })) : activePanel?.type === "group" && group ? (_jsx(CompactGroupDetail, { group: group, onOpenPanel: onOpenPanel })) : activePanel?.type === "groupBy" && group ? (_jsx(CompactGroupByDetail, { group: group, onBack: () => onOpenPanel({ type: "group" }) })) : activePanel?.type === "groupSort" && group ? (_jsx(CompactGroupSortDetail, { group: group, onBack: () => onOpenPanel({ type: "group" }) })) : activePanel?.type === "groupDateBy" && group ? (_jsx(CompactGroupDateByDetail, { group: group, onBack: () => onOpenPanel({ type: "group" }) })) : activePanel?.type === "sort" && sort ? (_jsx(CompactSortDetail, { sort: sort })) : activePanel?.type === "timeScope" && timeScopeConfig ? (_jsx(CompactTimeScopeDetail, { timeScopeConfig: timeScopeConfig, onBack: () => onOpenPanel(null), registerBackHandler: setBackHandler })) : activeDateRange ? (_jsx(CompactDateRangeDetail, { dateRangeConfig: activeDateRange })) : activeToggle ? (_jsx(CompactToggleDetail, { toggle: activeToggle, onBack: () => onOpenPanel(null) })) : activeField ? (_jsx(CompactFilterDetail, { filter: activeField })) : activeFilter ? (_jsx(CompactFilterDetail, { filter: activeFilter, onOpenField: (field) => onOpenPanel({ type: "filter", key: activeFilter.key, field }), onConverted: sheet ? undefined : () => onOpenPanel({ type: "filters" }) })) : activePanel?.type === "columns" && layout?.columns ? (_jsx("div", { "data-vs-detail": true, className: cx("max-h-96", PANEL_LIST_CLASS), children: _jsx(LayoutColumnsList, { columns: layout.columns, showNewLine: !!layout.columns.newLine?.views.includes(layout.value), onOpenColumn: (id) => onOpenPanel({ type: "column", key: id }), fieldEditor: fieldEditor }) })) : activeColumn && layout?.columns ? (_jsx(PopoverColumnDetail, { column: activeColumn, columns: layout.columns, onDone: onClose ?? (() => onOpenPanel({ type: "columns" })), fieldEditor: fieldEditor })) : activePanel?.type === "filters" ? (_jsx(CompactFilterList, { filters: filters, timeScopeConfig: timeScopeConfig, dateRangeConfigs: dateRangeConfigs, onOpenPanel: onOpenPanel })) : (_jsx(PopoverRootList, { filters: filters, sort: sort, group: group, timeScopeConfig: timeScopeConfig, dateRangeConfigs: dateRangeConfigs, toggles: toggles, layout: layout, onOpenPanel: onOpenPanel, foldFilters: foldFilters })) }, panelKey), !activePanel && viewFoot !== "none" && (view || footClear) && (_jsx(ViewFooter, { view: view, onClear: view ? undefined : footClear, words: viewFoot === "kit" ? "kit" : undefined }))] }));
|
|
8
|
+
return _jsx(AppCustomizeBody, { ...bodyProps, form: sheet ? "phone" : "computer" });
|
|
118
9
|
}
|
|
@@ -1,24 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { type Ctx } from "./editor-ctx.js";
|
|
6
|
-
export declare function FilterEditor({ filterTree, at, onDone, onRemoved, }: {
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { FilterPath } from "../../../filters/filter-tree.js";
|
|
3
|
+
import type { FilterTreeConfig } from "../../model.js";
|
|
4
|
+
export declare function FilterEditorHost({ filterTree, at, onDone, onRemoved, }: {
|
|
7
5
|
filterTree: FilterTreeConfig;
|
|
8
6
|
at: FilterPath;
|
|
9
7
|
onDone?: () => void;
|
|
10
8
|
/** A delete took a node away: the outermost one that went, so the pills' keys follow. */
|
|
11
9
|
onRemoved?: (removed: FilterPath) => void;
|
|
12
10
|
}): ReactNode;
|
|
13
|
-
export declare function Excluded(): ReactNode;
|
|
14
|
-
/** A level of rules: the editor's own, a group's or a relation's where; a pending rule held at its end. On a phone
|
|
15
|
-
* each rule stands under its lead, a line between rules. */
|
|
16
|
-
export declare function Level({ ctx, items, rel, join, relation, onAdd, }: {
|
|
17
|
-
ctx: Ctx;
|
|
18
|
-
items: readonly FilterNode[];
|
|
19
|
-
rel: FilterPath;
|
|
20
|
-
join: "and" | "or" | "not";
|
|
21
|
-
/** The relation whose where this level is: its rules name its far fields. */
|
|
22
|
-
relation?: FilterEditorField;
|
|
23
|
-
onAdd: (id: string) => void;
|
|
24
|
-
}): ReactNode;
|