viewkitjs 0.28.0 → 0.29.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 +107 -0
- package/MIGRATION.md +85 -4
- package/fields/dist/derived.d.ts +2 -1
- package/fields/dist/derived.js +9 -3
- package/fields/dist/entities.js +41 -3
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/messages.d.ts +8 -2
- package/fields/dist/messages.js +3 -0
- package/fields/dist/range.d.ts +6 -0
- package/fields/dist/range.js +8 -0
- package/fields/dist/registry.js +11 -1
- package/fields/dist/spec-changes.js +1 -0
- package/fields/dist/types.d.ts +23 -1
- package/fields/docs/guides/derived-fields.md +7 -5
- package/fields/docs/guides/field-types.md +2 -2
- package/fields/docs/guides/the-index.md +1 -1
- package/fields/docs/reference/fields.md +3 -1
- package/fields/docs/reference/types.md +3 -1
- package/fields/skills/viewkit/SKILL.md +1 -1
- package/package.json +2 -1
- package/postgres/dist/definitions/build.js +29 -5
- package/postgres/dist/definitions/label.d.ts +7 -0
- package/postgres/dist/definitions/label.js +9 -1
- package/postgres/dist/definitions/lookup.js +6 -2
- package/postgres/dist/definitions/place.d.ts +6 -3
- package/postgres/dist/definitions/rollup.js +5 -1
- package/postgres/dist/definitions/storage.d.ts +15 -0
- package/postgres/dist/definitions/storage.js +52 -1
- package/postgres/dist/definitions/stored.js +21 -0
- package/postgres/dist/phone.d.ts +13 -1
- package/postgres/dist/phone.js +23 -3
- package/postgres/dist/search-indexes.d.ts +6 -1
- package/postgres/dist/search-indexes.js +71 -25
- package/postgres/dist/search.js +3 -3
- package/postgres/docs/guides/definitions.md +22 -5
- package/postgres/docs/guides/field-map.md +5 -4
- package/postgres/docs/reference/definitions.md +3 -3
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/cells/cell-format.js +2 -2
- package/views/dist/cells/cell-values.js +9 -10
- package/views/dist/contract.d.ts +149 -3
- package/views/dist/contract.js +157 -1
- package/views/dist/controls/bulk-bar/bulk-bar-of.d.ts +66 -0
- package/views/dist/controls/bulk-bar/bulk-bar-of.js +22 -0
- package/views/dist/controls/bulk-bar/bulk-bar.d.ts +40 -0
- package/views/dist/controls/bulk-bar/bulk-bar.js +278 -0
- package/views/dist/controls/bulk-bar/looks.d.ts +10 -0
- package/views/dist/controls/bulk-bar/looks.js +14 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.d.ts +19 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.js +57 -0
- package/views/dist/controls/bulk-bar/tokens.d.ts +136 -0
- package/views/dist/controls/bulk-bar/tokens.js +36 -0
- package/views/dist/controls/bulk-bar/words.d.ts +50 -0
- package/views/dist/controls/bulk-bar/words.js +19 -0
- package/views/dist/controls/bulk-bar.css +96 -0
- package/views/dist/controls/button/button.js +3 -1
- package/views/dist/controls/button.css +5 -4
- package/views/dist/controls/checkbox/checkbox.js +3 -1
- package/views/dist/controls/checkbox.css +1 -1
- package/views/dist/controls/choice/tokens.d.ts +79 -0
- package/views/dist/controls/choice/tokens.js +22 -0
- package/views/dist/controls/choice.css +31 -0
- package/views/dist/controls/compound-editor/looks.js +1 -1
- package/views/dist/controls/controls.d.ts +10 -0
- package/views/dist/controls/controls.js +8 -0
- package/views/dist/controls/customize/customize.d.ts +125 -0
- package/views/dist/controls/customize/customize.js +243 -0
- package/views/dist/controls/customize/glide.d.ts +10 -0
- package/views/dist/controls/customize/glide.js +55 -0
- package/views/dist/controls/customize/looks.d.ts +13 -0
- package/views/dist/controls/customize/looks.js +11 -0
- package/views/dist/controls/customize/map-customize-body.d.ts +18 -0
- package/views/dist/controls/customize/map-customize-body.js +160 -0
- package/views/dist/controls/customize/rules.d.ts +23 -0
- package/views/dist/controls/customize/rules.js +19 -0
- package/views/dist/controls/customize/tokens.d.ts +40 -0
- package/views/dist/controls/customize/tokens.js +12 -0
- package/views/dist/controls/customize/words.d.ts +58 -0
- package/views/dist/controls/customize/words.js +37 -0
- package/views/dist/controls/customize.css +54 -0
- package/views/dist/controls/date-editor/looks.js +1 -1
- package/views/dist/controls/filter-editor/block.d.ts +31 -0
- package/views/dist/controls/filter-editor/block.js +27 -0
- package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +85 -43
- package/views/dist/controls/filter-editor/how.d.ts +1 -1
- package/views/dist/controls/filter-editor/how.js +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +16 -1
- package/views/dist/controls/filter-editor/map-filter-body.js +39 -13
- package/views/dist/controls/filter-editor/map-rules.d.ts +27 -11
- package/views/dist/controls/filter-editor/map-rules.js +73 -42
- package/views/dist/controls/filter-editor/rules.d.ts +43 -5
- package/views/dist/controls/filter-editor/rules.js +55 -2
- package/views/dist/controls/filter-editor/words.d.ts +15 -0
- package/views/dist/controls/filter-editor/words.js +6 -0
- package/views/dist/controls/filter-editor.css +18 -0
- package/views/dist/controls/index.d.ts +26 -2
- package/views/dist/controls/index.js +25 -2
- package/views/dist/controls/inline-input/looks.js +1 -1
- package/views/dist/controls/input/input.js +10 -4
- package/views/dist/controls/internal/phone.d.ts +5 -4
- package/views/dist/controls/internal/phone.js +7 -7
- package/views/dist/controls/internal/scroll.js +5 -1
- package/views/dist/controls/internal/typed-run.d.ts +2 -0
- package/views/dist/controls/internal/typed-run.js +5 -0
- package/views/dist/controls/menu/map-menu.js +2 -2
- package/views/dist/controls/number-editor/looks.js +1 -1
- package/views/dist/controls/option/option.js +3 -1
- package/views/dist/controls/option.css +1 -1
- package/views/dist/controls/pane/pane.d.ts +4 -0
- package/views/dist/controls/pane/pane.js +2 -1
- package/views/dist/controls/picker/looks.js +1 -1
- package/views/dist/controls/picker/map-picker.d.ts +6 -2
- package/views/dist/controls/picker/map-picker.js +4 -2
- package/views/dist/controls/picker/picker.d.ts +7 -0
- package/views/dist/controls/picker/picker.js +57 -8
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +2 -2
- package/views/dist/controls/popover/popover.js +2 -1
- package/views/dist/controls/popover.css +3 -0
- package/views/dist/controls/ports-host/map-ports-host.d.ts +7 -0
- package/views/dist/controls/ports-host/map-ports-host.js +43 -0
- package/views/dist/controls/press/tokens.d.ts +8 -0
- package/views/dist/controls/press/tokens.js +4 -0
- package/views/dist/controls/press.css +44 -0
- package/views/dist/controls/quick-filters/looks.d.ts +11 -0
- package/views/dist/controls/quick-filters/looks.js +9 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +31 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +56 -0
- package/views/dist/controls/quick-filters/quick-filters.d.ts +37 -0
- package/views/dist/controls/quick-filters/quick-filters.js +89 -0
- package/views/dist/controls/quick-filters/reminder.d.ts +18 -0
- package/views/dist/controls/quick-filters/reminder.js +41 -0
- package/views/dist/controls/quick-filters/rules.d.ts +89 -0
- package/views/dist/controls/quick-filters/rules.js +52 -0
- package/views/dist/controls/quick-filters/tokens.d.ts +112 -0
- package/views/dist/controls/quick-filters/tokens.js +30 -0
- package/views/dist/controls/quick-filters/words.d.ts +25 -0
- package/views/dist/controls/quick-filters/words.js +13 -0
- package/views/dist/controls/quick-filters.css +118 -0
- package/views/dist/controls/sheet/bottom-sheet.d.ts +9 -4
- package/views/dist/controls/sheet/bottom-sheet.js +4 -4
- package/views/dist/controls/sheet/map-sheet.d.ts +4 -1
- package/views/dist/controls/sheet/map-sheet.js +19 -6
- package/views/dist/controls/sheet/sheet-parts.d.ts +10 -0
- package/views/dist/controls/sheet/sheet-parts.js +2 -0
- package/views/dist/controls/switch-row/switch-row.d.ts +15 -0
- package/views/dist/controls/switch-row/switch-row.js +9 -0
- package/views/dist/controls/switch-row/tokens.d.ts +51 -0
- package/views/dist/controls/switch-row/tokens.js +15 -0
- package/views/dist/controls/switch-row.css +39 -0
- package/views/dist/controls/switch.css +1 -1
- package/views/dist/controls/tag/tag.js +3 -1
- package/views/dist/controls/tag-field/tag-field.d.ts +20 -0
- package/views/dist/controls/tag-field/tag-field.js +19 -0
- package/views/dist/controls/tag-field/tokens.d.ts +7 -0
- package/views/dist/controls/tag-field/tokens.js +4 -0
- package/views/dist/controls/tag-field.css +13 -0
- package/views/dist/controls/text-editor/looks.js +1 -1
- package/views/dist/controls/text-editor/text-editor.js +1 -5
- package/views/dist/controls/toast/toast.d.ts +5 -1
- package/views/dist/controls/toast/toast.js +5 -3
- package/views/dist/controls/tokens.js +18 -0
- package/views/dist/controls/toolbar/keys.d.ts +3 -0
- package/views/dist/controls/toolbar/keys.js +11 -0
- package/views/dist/controls/toolbar/looks.d.ts +10 -0
- package/views/dist/controls/toolbar/looks.js +40 -0
- package/views/dist/controls/toolbar/tokens.d.ts +28 -0
- package/views/dist/controls/toolbar/tokens.js +9 -0
- package/views/dist/controls/toolbar/toolbar.d.ts +111 -0
- package/views/dist/controls/toolbar/toolbar.js +370 -0
- package/views/dist/controls/toolbar/words.d.ts +28 -0
- package/views/dist/controls/toolbar/words.js +17 -0
- package/views/dist/controls/toolbar-button/looks.d.ts +4 -0
- package/views/dist/controls/toolbar-button/looks.js +21 -0
- package/views/dist/controls/toolbar-button/tokens.d.ts +103 -0
- package/views/dist/controls/toolbar-button/tokens.js +28 -0
- package/views/dist/controls/toolbar-button/toolbar-button.d.ts +66 -0
- package/views/dist/controls/toolbar-button/toolbar-button.js +51 -0
- package/views/dist/controls/toolbar-button.css +75 -0
- package/views/dist/controls/toolbar.css +65 -0
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +2 -2
- package/views/dist/controls/tooltip/tooltip.d.ts +3 -1
- package/views/dist/controls/tooltip/tooltip.js +2 -2
- package/views/dist/controls/values-editor/looks.js +1 -1
- package/views/dist/controls/views-list/map-views-list-body.d.ts +4 -1
- package/views/dist/controls/views-list/map-views-list-body.js +128 -4
- package/views/dist/controls/views-list/rules.d.ts +26 -0
- package/views/dist/controls/views-list/rules.js +63 -0
- package/views/dist/controls/views-list/view-menu.d.ts +84 -0
- package/views/dist/controls/views-list/view-menu.js +201 -0
- package/views/dist/controls/views-list/views-list.d.ts +8 -1
- package/views/dist/controls/views-list/views-list.js +18 -3
- package/views/dist/controls/views-list/words.d.ts +54 -0
- package/views/dist/controls/views-list/words.js +10 -1
- package/views/dist/controls/views-list.css +5 -1
- package/views/dist/display/date.js +3 -3
- package/views/dist/display/format.d.ts +6 -0
- package/views/dist/display/format.js +3 -0
- package/views/dist/display/index.d.ts +1 -1
- package/views/dist/display/index.js +1 -1
- package/views/dist/display/range.d.ts +2 -1
- package/views/dist/display/range.js +4 -1
- package/views/dist/grid/chrome/GridHeader.js +2 -1
- package/views/dist/grid/chrome/GridNumberEditor.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +2 -1
- package/views/dist/grid/chrome/GridTextEditor.js +2 -2
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -1
- package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +7 -1
- package/views/dist/grid/chrome/grid-fitted-box.js +4 -4
- package/views/dist/grid/core/clipboard-model.js +9 -4
- package/views/dist/grid/grid.css +240 -0
- package/views/dist/grid/looks.d.ts +5 -1
- package/views/dist/grid/looks.js +20 -12
- package/views/dist/grid-tokens.d.ts +109 -0
- package/views/dist/grid-tokens.js +29 -0
- package/views/dist/looks/index.d.ts +5 -0
- package/views/dist/looks/index.js +5 -0
- package/views/dist/looks/pieces.js +10 -0
- package/views/dist/model/column-capabilities.d.ts +2 -0
- package/views/dist/model/column-filters.d.ts +2 -1
- package/views/dist/model/column-from.js +2 -2
- package/views/dist/model/relation-filters.d.ts +2 -0
- package/views/dist/panels/index.d.ts +2 -2
- package/views/dist/panels/index.js +2 -2
- package/views/dist/panels/labels.d.ts +4 -0
- package/views/dist/panels/labels.js +8 -0
- package/views/dist/panels/model.d.ts +10 -2
- package/views/dist/panels/quick/model.d.ts +4 -0
- package/views/dist/panels/react/customize-body.d.ts +9 -4
- package/views/dist/panels/react/customize-body.js +39 -11
- package/views/dist/panels/react/customize.d.ts +8 -1
- package/views/dist/panels/react/customize.js +9 -6
- package/views/dist/panels/react/filter/FilterEditor.js +4 -4
- package/views/dist/panels/react/filter/FilterFieldList.js +10 -2
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +3 -3
- package/views/dist/panels/react/filter/filter-body.js +5 -2
- package/views/dist/panels/react/panel-step.d.ts +3 -0
- package/views/dist/panels/react/panel-step.js +2 -1
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +1 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +10 -3
- package/views/dist/panels/react/toolbar/Toolbar.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +13 -3
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +3 -3
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +12 -4
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -2
- package/views/dist/panels/react/view-footer.d.ts +1 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +25 -4
- package/views/dist/panels/settings/filter-groups.d.ts +3 -0
- package/views/dist/panels/settings/filter-groups.js +40 -9
- package/views/dist/panels/settings/filters.d.ts +5 -0
- package/views/dist/panels/settings/filters.js +12 -6
- package/views/dist/panels/views-row/model.d.ts +10 -1
- package/views/dist/provider/ViewsProvider.js +29 -5
- package/views/dist/provider/components.d.ts +149 -8
- package/views/dist/provider/context.d.ts +6 -0
- package/views/dist/provider/ports.d.ts +18 -6
- package/views/dist/provider/ports.js +2 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/react.js +1 -1
- package/views/dist/selection/SelectionBar.d.ts +2 -16
- package/views/dist/selection/SelectionBar.js +4 -1
- package/views/dist/selection/bar-props.d.ts +26 -0
- package/views/dist/selection/bar-props.js +1 -0
- package/views/dist/selection/index.d.ts +1 -1
- package/views/dist/selection/verbs.d.ts +32 -5
- package/views/dist/styles.css +656 -25
- package/views/dist/styles.unlayered.css +653 -22
- package/views/docs/contract.md +44 -17
- package/views/docs/controls/bulk-bar.md +41 -0
- package/views/docs/controls/choice.md +25 -0
- package/views/docs/controls/customize.md +17 -0
- package/views/docs/controls/popover.md +2 -0
- package/views/docs/controls/press.md +9 -0
- package/views/docs/controls/quick-filters.md +35 -0
- package/views/docs/controls/radio.md +1 -1
- package/views/docs/controls/switch-row.md +18 -0
- package/views/docs/controls/tag-field.md +7 -0
- package/views/docs/controls/toolbar-button.md +31 -0
- package/views/docs/controls/toolbar.md +14 -0
- package/views/docs/guides/atoms.md +2 -2
- package/views/docs/guides/cells.md +2 -2
- package/views/docs/guides/display.md +2 -2
- package/views/docs/guides/looks.md +8 -2
- package/views/docs/guides/ports.md +6 -6
- package/views/docs/guides/selection.md +5 -1
- package/views/docs/guides/the-grid.md +1 -1
- package/views/docs/guides/the-provider.md +2 -2
- package/views/docs/install.md +4 -1
- package/views/docs/reference/cells.md +1 -1
- package/views/docs/reference/controls.md +194 -13
- package/views/docs/reference/display.md +1 -0
- package/views/docs/reference/looks.md +25 -11
- package/views/docs/reference/panels-react.md +7 -7
- package/views/docs/reference/panels.md +8 -6
- package/views/docs/reference/react.md +13 -6
- package/views/docs/reference/selection.md +4 -2
- package/views/docs/reference/views.md +7 -6
- package/views/skills/views/SKILL.md +2 -2
|
@@ -18,15 +18,21 @@ export type Kept = Record<string, {
|
|
|
18
18
|
order: string[];
|
|
19
19
|
}>;
|
|
20
20
|
/** The ViewKit node each rule the kit draws but can't word stood for (a set-aside rule, a `vk:` way), by its kit id. */
|
|
21
|
-
export type Raw = ReadonlyMap<string,
|
|
21
|
+
export type Raw = ReadonlyMap<string, RawNode>;
|
|
22
|
+
/** The node a kit rule stood for, and the relation's field key when it stood inside a block (its where). */
|
|
23
|
+
export type RawNode = {
|
|
24
|
+
node: FilterRule | FilterRelationRule;
|
|
25
|
+
relation?: string;
|
|
26
|
+
};
|
|
22
27
|
/** A set-aside rule in words: its field's name, why, and whether Put back fits. `relation`: the relation's field key, for a far rule. */
|
|
23
|
-
export type AsideWords = (rule: FilterRule, relation?: string) => FilterAside;
|
|
28
|
+
export type AsideWords = (rule: FilterRule | FilterRelationRule, relation?: string) => FilterAside;
|
|
24
29
|
/** The kit types whose value is picked from choices. */
|
|
25
30
|
export declare const CHOICE: ReadonlySet<KitType>;
|
|
26
|
-
/** A field's type as the kit's filter editor draws it; null for one it doesn't (a place whole, a
|
|
31
|
+
/** A field's type as the kit's filter editor draws it; null for one it doesn't (a place whole, a lookup…), whose rules are ViewKit's to
|
|
32
|
+
* word (`own:`). */
|
|
27
33
|
export declare const kitTypeOf: (type: FieldType) => KitType | null;
|
|
28
34
|
/** A part's type as the kit draws it, by fields' operators for it (operatorsFor): a place's city, region and postal code are words;
|
|
29
|
-
* its country, compared as options,
|
|
35
|
+
* its country, compared as options, a choice of country names (VK-735); a range's end is a number. ViewKit hands a part with its whole field's
|
|
30
36
|
* type; any other type ignores its part. */
|
|
31
37
|
export declare function kitPartTypeOf(type: FieldType, part: string | undefined): KitType | null;
|
|
32
38
|
/** Where a kit field's rule goes in ViewKit's filter: its field, its part, and for a related record's field, the relation's field key. */
|
|
@@ -35,13 +41,16 @@ export type FieldAt = {
|
|
|
35
41
|
part?: string;
|
|
36
42
|
relation?: string;
|
|
37
43
|
};
|
|
38
|
-
/** The kit's fields, and where each one's rule goes (a
|
|
44
|
+
/** The kit's fields, and where each one's rule goes (a part the kit lists no field for, too: its rules are ViewKit's to word). */
|
|
39
45
|
export type KitFields = {
|
|
40
46
|
fields: FilterField[];
|
|
41
47
|
at: ReadonlyMap<string, FieldAt>;
|
|
48
|
+
/** Each relation's kit field (its Related records row), by ViewKit's field key. */
|
|
49
|
+
relations: ReadonlyMap<string, string>;
|
|
42
50
|
};
|
|
43
|
-
/** A field's values to pick from, by its key, and for a related record's field, its relation's
|
|
44
|
-
|
|
51
|
+
/** A field's values to pick from, by its key, and for a related record's field, its relation's; a part's (a place's country) by
|
|
52
|
+
* its part. */
|
|
53
|
+
export type ChoicesOf = (fieldKey: string, relation?: string, part?: string) => PickerItem[] | undefined;
|
|
45
54
|
/** The heading the related records stand under, ViewKit's own English (views.panels.related-records). */
|
|
46
55
|
export declare const RELATED = "Related records";
|
|
47
56
|
/** A related record's field as one value of the kit's: the relation's row and the far field's key; and back. */
|
|
@@ -53,19 +62,26 @@ export declare const pathParts: (value: string) => [string, string?];
|
|
|
53
62
|
* but its place is known, so a rule on it is ViewKit's to word. Open on a relation's where (`relation`, its field key), that
|
|
54
63
|
* relation's far fields alone, as plain fields. */
|
|
55
64
|
export declare function kitFieldsOf(fields: readonly ViewsFilterBodyField[], choices: ChoicesOf, relation?: string): KitFields;
|
|
65
|
+
/** The field a rule the kit has no type for names: ViewKit's to word (`own:<fieldKey>~<part>`). */
|
|
66
|
+
export declare const OWN_FIELD = "own:";
|
|
67
|
+
/** The way of a relation rule drawn as one row (set aside, or on a relation the fields don't list). */
|
|
68
|
+
export declare const RELATION_WAY = "vk:relation";
|
|
56
69
|
/** The kit's filter as a level of ViewKit's: its join (`not` again where the level read excluded its matches), its rules in fields'
|
|
57
70
|
* operators, its groups, each rule the kit can't word as the node it was read from (`raw`), and what was kept back in each group in
|
|
58
71
|
* its place, a group the kit took away handing its kept to the nearest one left. */
|
|
59
72
|
export declare function viewKitFilterOf(filter: KitGroup, fields: KitFields, kept: Kept, raw?: Raw): FilterGroup;
|
|
60
73
|
/** A level of ViewKit's filter as the kit's: its rules and groups, ids `root`, then `v1`… and `r1`… in reading order; a set-aside rule
|
|
61
74
|
* carrying its words (`asideWords`), a rule on a way or a place's part the kit can't word on its `vk:` way, each with the node it was
|
|
62
|
-
* read from in `raw
|
|
63
|
-
*
|
|
64
|
-
*
|
|
75
|
+
* read from in `raw`. A `not` group is a kit group that excludes its matches (`exclude`, joined by And), or a date's "is not" an
|
|
76
|
+
* older view holds; the level itself too. A relation rule with "any" and one plain rule in its where, on a far field, is the kit's
|
|
77
|
+
* rule on its path, as drawn flat; any other a block (`relation`), its where's rules on its relation's fields; one set aside, or on
|
|
78
|
+
* a relation the fields don't list, one row in its words (VK-827). A rule on a field the kit has no type for is ViewKit's to word
|
|
79
|
+
* (`own:`). What is kept by the group it stands in, with the item it followed, is left to a group holding nothing and a relation
|
|
80
|
+
* rule inside a where, which fields refuses: nothing a person's filter holds is out of sight. */
|
|
65
81
|
export declare function kitFilterOf(level: FilterGroup, fields: KitFields, asideWords?: AsideWords): {
|
|
66
82
|
filter: KitGroup;
|
|
67
83
|
kept: Kept;
|
|
68
|
-
raw: Map<string,
|
|
84
|
+
raw: Map<string, RawNode>;
|
|
69
85
|
};
|
|
70
86
|
/** What one level was written from: the kit's rules, what it kept, and the nodes of the rules it can't word. */
|
|
71
87
|
type Read = {
|
|
@@ -2,10 +2,10 @@ import { findItem } from "../picker/rows.js";
|
|
|
2
2
|
import { CHECKED } from "./how.js";
|
|
3
3
|
import { isOwnWay, isPair, OWN_WAY, rulesOf } from "./rules.js";
|
|
4
4
|
const TYPES = {
|
|
5
|
-
status: "status", select: "select", multiselect: "select", user: "person", relation: "record",
|
|
5
|
+
status: "status", select: "select", multiselect: "select", user: "person", actor: "person", relation: "record",
|
|
6
6
|
number: "number", currency: "number", percent: "number",
|
|
7
7
|
text: "text", email: "text", url: "text", domain: "text", phone: "text", name: "text",
|
|
8
|
-
date: "date", datetime: "date", boolean: "checkbox", range: "range",
|
|
8
|
+
date: "date", datetime: "date", boolean: "checkbox", range: "range", rich_text: "longtext",
|
|
9
9
|
};
|
|
10
10
|
export const CHOICE = new Set(["status", "select", "person", "record"]);
|
|
11
11
|
export const kitTypeOf = (type) => TYPES[type] ?? null;
|
|
@@ -13,7 +13,7 @@ export function kitPartTypeOf(type, part) {
|
|
|
13
13
|
if (part === undefined)
|
|
14
14
|
return kitTypeOf(type);
|
|
15
15
|
if (type === "location")
|
|
16
|
-
return part === "city" || part === "region" || part === "postalCode" ? "text" : null;
|
|
16
|
+
return part === "city" || part === "region" || part === "postalCode" ? "text" : part === "countryCode" ? "select" : null;
|
|
17
17
|
if (type === "range")
|
|
18
18
|
return "number";
|
|
19
19
|
return kitTypeOf(type);
|
|
@@ -30,24 +30,30 @@ export function kitFieldsOf(fields, choices, relation) {
|
|
|
30
30
|
const at = new Map();
|
|
31
31
|
const field = (f, value, place, from) => {
|
|
32
32
|
const type = kitPartTypeOf(f.type, f.part);
|
|
33
|
+
if (f.disabled !== undefined)
|
|
34
|
+
return [{ value, label: f.label, type: type ?? "text", disabled: true, line: f.disabled }];
|
|
33
35
|
if (!type) {
|
|
34
36
|
if (f.part !== undefined)
|
|
35
37
|
at.set(value, place);
|
|
36
38
|
return [];
|
|
37
39
|
}
|
|
38
|
-
const values = type === "checkbox" ? CHECKED : CHOICE.has(type)
|
|
40
|
+
const values = type === "checkbox" ? CHECKED : CHOICE.has(type) ? choices(f.fieldKey, from, f.part) : undefined;
|
|
39
41
|
at.set(value, place);
|
|
40
42
|
return [{ value, label: f.label, type, ...(values ? { choices: values } : {}) }];
|
|
41
43
|
};
|
|
42
44
|
const own = (f, from) => field(f, f.key, { fieldKey: f.fieldKey, ...(f.part !== undefined ? { part: f.part } : {}) }, from);
|
|
45
|
+
const relations = new Map();
|
|
43
46
|
if (relation !== undefined)
|
|
44
|
-
return { fields: (fields.find((f) => f.far && f.fieldKey === relation)?.far ?? []).flatMap((f) => own(f, relation)), at };
|
|
47
|
+
return { fields: (fields.find((f) => f.far && f.fieldKey === relation)?.far ?? []).flatMap((f) => own(f, relation)), at, relations };
|
|
45
48
|
const list = fields.filter((f) => !f.far).flatMap((f) => own(f));
|
|
46
49
|
const related = fields.filter((f) => f.far).flatMap((r) => {
|
|
47
50
|
const level = (r.far ?? []).flatMap((f) => field(f, pathOf(r.key, f.key), { fieldKey: f.fieldKey, ...(f.part !== undefined ? { part: f.part } : {}), relation: r.fieldKey }, r.fieldKey));
|
|
48
|
-
|
|
51
|
+
if (!level.length)
|
|
52
|
+
return [];
|
|
53
|
+
relations.set(r.fieldKey, r.key);
|
|
54
|
+
return [{ value: r.key, label: r.label, type: "record", group: RELATED, level }];
|
|
49
55
|
});
|
|
50
|
-
return { fields: [...list, ...related], at };
|
|
56
|
+
return { fields: [...list, ...related], at, relations };
|
|
51
57
|
}
|
|
52
58
|
const none = { write: () => null, read: () => null };
|
|
53
59
|
const list = (v) => (Array.isArray(v) ? v.map(String) : typeof v === "string" ? [v] : []);
|
|
@@ -74,6 +80,7 @@ const WAYS = {
|
|
|
74
80
|
text: [{ how: "contains", operator: "contains", ...words }, { how: "does-not-contain", operator: "not_contains", ...words },
|
|
75
81
|
{ how: "starts-with", operator: "starts_with", ...words }, { how: "ends-with", operator: "ends_with", ...words },
|
|
76
82
|
{ how: "is", operator: "is", ...words }, { how: "is-not", operator: "is_not", ...words }, ...EMPTINESS],
|
|
83
|
+
longtext: [{ how: "contains", operator: "contains", ...words }, { how: "does-not-contain", operator: "not_contains", ...words }, ...EMPTINESS],
|
|
77
84
|
date: [{ how: "is", operator: "is", ...day }, { how: "is-not", operator: "is_not", ...day }, { how: "before", operator: "is_before", ...day },
|
|
78
85
|
{ how: "after", operator: "is_after", ...day }, ...EMPTINESS],
|
|
79
86
|
checkbox: [{ how: "is", operator: "is", ...yesNo }],
|
|
@@ -81,6 +88,8 @@ const WAYS = {
|
|
|
81
88
|
{ how: "at-least", operator: "at_least", ...figure }, { how: "at-most", operator: "at_most", ...figure }, ...EMPTINESS],
|
|
82
89
|
};
|
|
83
90
|
const ASIDE_FIELD = "aside:";
|
|
91
|
+
export const OWN_FIELD = "own:";
|
|
92
|
+
export const RELATION_WAY = `${OWN_WAY}relation`;
|
|
84
93
|
const typeOf = (f, key) => findItem(f.fields, key)?.item.type;
|
|
85
94
|
const isGroup = (n) => "op" in n;
|
|
86
95
|
const isKitGroup = (x) => "rules" in x;
|
|
@@ -112,15 +121,15 @@ export function viewKitFilterOf(filter, fields, kept, raw = new Map()) {
|
|
|
112
121
|
to = kept[to]?.parent ?? null;
|
|
113
122
|
(orphans[to ?? filter.id] ??= []).push({ op: k.op, items: k.nodes.map((n) => n.node) });
|
|
114
123
|
}
|
|
115
|
-
|
|
116
|
-
return { ...levelOf(filter, fields, kept, raw, orphans), op: top };
|
|
124
|
+
return levelOf(filter, fields, kept, raw, orphans);
|
|
117
125
|
}
|
|
118
126
|
function withoutAside(n) {
|
|
119
127
|
const { setAside: _gone, ...rest } = n;
|
|
120
128
|
return isRelation(n) ? { ...rest, where: { ...n.where, items: n.where.items.map((i) => (isGroup(i) || isRelation(i) ? i : withoutAside(i))) } } : rest;
|
|
121
129
|
}
|
|
122
|
-
function ruleNodes(x, fields, raw) {
|
|
123
|
-
const
|
|
130
|
+
function ruleNodes(x, fields, raw, inRelation) {
|
|
131
|
+
const held = raw.get(x.id)?.node;
|
|
132
|
+
const was = held && inRelation !== undefined && isRelation(held) && held.fieldKey === inRelation ? held.where.items[0] : held;
|
|
124
133
|
if (was && x.aside)
|
|
125
134
|
return [was];
|
|
126
135
|
if (was && isOwnWay(x.how))
|
|
@@ -131,9 +140,10 @@ function ruleNodes(x, fields, raw) {
|
|
|
131
140
|
if (!way || !place || value === undefined)
|
|
132
141
|
return [];
|
|
133
142
|
const rule = { fieldKey: place.fieldKey, ...(place.part !== undefined ? { part: place.part } : {}), operator: way.operator, value };
|
|
134
|
-
return [place.relation !== undefined ? { fieldKey: place.relation, quantifier: "any", where: { op: "and", items: [rule] } } : rule];
|
|
143
|
+
return [place.relation !== undefined && place.relation !== inRelation ? { fieldKey: place.relation, quantifier: "any", where: { op: "and", items: [rule] } } : rule];
|
|
135
144
|
}
|
|
136
|
-
|
|
145
|
+
const relationKeyOf = (fields, field) => [...fields.relations].find(([, value]) => value === field)?.[0];
|
|
146
|
+
function levelOf(filter, fields, kept, raw, orphans, inRelation) {
|
|
137
147
|
const k = kept[filter.id];
|
|
138
148
|
const after = new Map();
|
|
139
149
|
for (const n of k?.nodes ?? []) {
|
|
@@ -142,62 +152,76 @@ function levelOf(filter, fields, kept, raw, orphans) {
|
|
|
142
152
|
}
|
|
143
153
|
const items = [...(after.get(null) ?? [])];
|
|
144
154
|
for (const x of filter.rules) {
|
|
145
|
-
items.push(...(isKitGroup(x) ?
|
|
155
|
+
items.push(...(isKitGroup(x) ? groupNodes(x, fields, kept, raw, orphans, inRelation) : ruleNodes(x, fields, raw, inRelation)), ...(after.get(x.id) ?? []));
|
|
146
156
|
}
|
|
147
|
-
return { op: filter.join, items: [...items, ...(orphans[filter.id] ?? [])] };
|
|
157
|
+
return { op: filter.exclude ? "not" : filter.join, items: [...items, ...(orphans[filter.id] ?? [])] };
|
|
158
|
+
}
|
|
159
|
+
function groupNodes(x, fields, kept, raw, orphans, inRelation) {
|
|
160
|
+
if (!x.relation)
|
|
161
|
+
return [levelOf(x, fields, kept, raw, orphans, inRelation)];
|
|
162
|
+
const key = relationKeyOf(fields, x.relation.field);
|
|
163
|
+
if (key === undefined)
|
|
164
|
+
return [];
|
|
165
|
+
const where = levelOf(x, fields, kept, raw, orphans, key);
|
|
166
|
+
return [{ fieldKey: key, quantifier: x.relation.quantifier, where: { op: where.op === "or" ? "or" : "and", items: where.items } }];
|
|
148
167
|
}
|
|
149
168
|
export function kitFilterOf(level, fields, asideWords) {
|
|
150
169
|
const kept = {}, raw = new Map();
|
|
151
170
|
let groups = 0, rules = 0;
|
|
152
171
|
const back = new Map([...fields.at].map(([value, place]) => [placeOf(place), value]));
|
|
153
172
|
const valueOf = (n, relation) => back.get(placeOf({ fieldKey: n.fieldKey, ...(n.part !== undefined ? { part: n.part } : {}), ...(relation !== undefined ? { relation } : {}) }));
|
|
173
|
+
const hold = (id, node, inBlock) => raw.set(id, isRelation(node) || inBlock === undefined ? { node } : { node, relation: inBlock });
|
|
154
174
|
const read = (n, relation, how) => {
|
|
155
175
|
const value = valueOf(n, relation), type = value && typeOf(fields, value), way = type && WAYS[type].find(how ?? ((w) => w.operator === n.operator));
|
|
156
176
|
return value && way ? { id: `r${++rules}`, field: value, how: way.how, value: way.read(n.value) } : null;
|
|
157
177
|
};
|
|
158
|
-
const readOwn = (n, node, relation) => {
|
|
178
|
+
const readOwn = (n, node, relation, inBlock) => {
|
|
159
179
|
const value = valueOf(n, relation);
|
|
160
180
|
if (!value)
|
|
161
181
|
return null;
|
|
162
182
|
const id = `r${++rules}`;
|
|
163
|
-
|
|
183
|
+
hold(id, node, inBlock);
|
|
164
184
|
return { id, field: value, how: `${OWN_WAY}${n.operator}`, value: null };
|
|
165
185
|
};
|
|
166
|
-
const
|
|
186
|
+
const readTheirs = (n, inBlock) => {
|
|
187
|
+
const id = `r${++rules}`;
|
|
188
|
+
hold(id, n, inBlock);
|
|
189
|
+
return { id, field: `${OWN_FIELD}${n.fieldKey}${n.part !== undefined ? `~${n.part}` : ""}`, how: `${OWN_WAY}${n.operator}`, value: null };
|
|
190
|
+
};
|
|
191
|
+
const readAside = (n, relation, node = n, inBlock) => {
|
|
167
192
|
const value = valueOf(n, relation), type = value && typeOf(fields, value), way = type && WAYS[type].find((w) => w.operator === n.operator);
|
|
168
193
|
const id = `r${++rules}`;
|
|
169
|
-
|
|
194
|
+
hold(id, node, inBlock);
|
|
170
195
|
return {
|
|
171
196
|
id, field: value ?? `${ASIDE_FIELD}${n.fieldKey}${n.part !== undefined ? `~${n.part}` : ""}`,
|
|
172
197
|
how: way ? way.how : `${OWN_WAY}${n.operator}`, value: way ? way.read(n.value) : null,
|
|
173
198
|
aside: asideWords?.(n, relation) ?? { label: n.fieldKey, why: "", putBack: false },
|
|
174
199
|
};
|
|
175
200
|
};
|
|
176
|
-
const
|
|
201
|
+
const readAsideRelation = (n) => {
|
|
202
|
+
const id = `r${++rules}`;
|
|
203
|
+
hold(id, n);
|
|
204
|
+
return { id, field: `${ASIDE_FIELD}${n.fieldKey}`, how: RELATION_WAY, value: null, aside: asideWords?.(n) ?? { label: n.fieldKey, why: "", putBack: false } };
|
|
205
|
+
};
|
|
206
|
+
const dateIsNot = (n, relation) => {
|
|
177
207
|
const [only] = n.items;
|
|
178
208
|
if (n.op !== "not" || n.items.length !== 1 || !only || !plainRule(only) || only.operator !== "is")
|
|
179
209
|
return null;
|
|
180
|
-
const value = valueOf(only);
|
|
181
|
-
return value && typeOf(fields, value) === "date" ? read(only,
|
|
210
|
+
const value = valueOf(only, relation);
|
|
211
|
+
return value && typeOf(fields, value) === "date" ? read(only, relation, (w) => w.how === "is-not") : null;
|
|
182
212
|
};
|
|
183
|
-
const walk = (g, id, parent) => {
|
|
213
|
+
const walk = (g, id, parent, inBlock) => {
|
|
184
214
|
const out = [];
|
|
185
215
|
const place = () => (kept[id] ??= { parent, op: g.op, nodes: [], order: [] });
|
|
186
216
|
const keep = (n) => { place().nodes.push({ node: n, after: out.at(-1)?.id ?? null }); };
|
|
187
|
-
if (g.op === "not")
|
|
188
|
-
place();
|
|
189
217
|
for (const n of g.items) {
|
|
190
218
|
if (isGroup(n)) {
|
|
191
|
-
const not = dateIsNot(n);
|
|
219
|
+
const not = dateIsNot(n, inBlock);
|
|
192
220
|
if (not) {
|
|
193
221
|
out.push(not);
|
|
194
222
|
continue;
|
|
195
223
|
}
|
|
196
|
-
|
|
197
|
-
keep(n);
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
const inner = walk(n, `v${++groups}`, id);
|
|
224
|
+
const inner = walk(n, `v${++groups}`, id, inBlock);
|
|
201
225
|
if (inner.rules.length)
|
|
202
226
|
out.push(inner);
|
|
203
227
|
else {
|
|
@@ -207,25 +231,32 @@ export function kitFilterOf(level, fields, asideWords) {
|
|
|
207
231
|
continue;
|
|
208
232
|
}
|
|
209
233
|
if (isRelation(n)) {
|
|
234
|
+
if (inBlock !== undefined) {
|
|
235
|
+
keep(n);
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
210
238
|
const [only] = n.where.items;
|
|
211
239
|
const one = n.quantifier === "any" && n.where.items.length === 1 && !!only && !isGroup(only) && !isRelation(only) && only.part === undefined;
|
|
212
240
|
const aside = one && (n.setAside || only.setAside) ? readAside({ ...only, ...(only.setAside ?? n.setAside ? { setAside: only.setAside ?? n.setAside } : {}) }, n.fieldKey, n) : null;
|
|
213
|
-
const
|
|
214
|
-
if (
|
|
215
|
-
out.push(
|
|
216
|
-
|
|
217
|
-
|
|
241
|
+
const flat = aside ?? (one && plainRule(only) ? read(only, n.fieldKey) ?? readOwn(only, n, n.fieldKey) : null);
|
|
242
|
+
if (flat) {
|
|
243
|
+
out.push(flat);
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
const relation = fields.relations.get(n.fieldKey);
|
|
247
|
+
if (n.setAside || relation === undefined) {
|
|
248
|
+
out.push(readAsideRelation(n));
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
const block = walk(n.where, `v${++groups}`, id, n.fieldKey);
|
|
252
|
+
out.push({ ...block, relation: { field: relation, quantifier: n.quantifier } });
|
|
218
253
|
continue;
|
|
219
254
|
}
|
|
220
|
-
|
|
221
|
-
if (drawn)
|
|
222
|
-
out.push(drawn);
|
|
223
|
-
else
|
|
224
|
-
keep(n);
|
|
255
|
+
out.push(n.setAside ? readAside(n, inBlock, n, inBlock) : read(n, inBlock) ?? readOwn(n, n, inBlock, inBlock) ?? readTheirs(n, inBlock));
|
|
225
256
|
}
|
|
226
257
|
if (kept[id])
|
|
227
258
|
kept[id].order = out.map((x) => x.id);
|
|
228
|
-
return { id, join: g.op === "or" ? "or" : "and", rules: out };
|
|
259
|
+
return { id, join: g.op === "or" ? "or" : "and", rules: out, ...(g.op === "not" ? { exclude: true } : {}) };
|
|
229
260
|
};
|
|
230
261
|
return { filter: walk(level, "root", null), kept, raw };
|
|
231
262
|
}
|
|
@@ -20,11 +20,24 @@ export interface FilterAside {
|
|
|
20
20
|
export declare const OWN_WAY = "vk:";
|
|
21
21
|
/** Whether a rule's way is one only ViewKit words: the kit has no word for it. */
|
|
22
22
|
export declare const isOwnWay: (how: string) => boolean;
|
|
23
|
-
/**
|
|
23
|
+
/** How a relation rule's block holds its related records: any, none or every of them match its rules. */
|
|
24
|
+
export type Quantifier = "any" | "none" | "every";
|
|
25
|
+
export declare const QUANTIFIERS: readonly Quantifier[];
|
|
26
|
+
/** A level of rules, joined by its one join; the filter itself is one. `exclude`: it keeps what its rules don't match (a `not`
|
|
27
|
+
* group, joined by And alone). `relation`: a relation rule's block, its rules on that relation's fields: the kit field of the
|
|
28
|
+
* relation (its Related records row; open on a relation's where, ViewKit's field key), its name where the fields don't hold
|
|
29
|
+
* it, its quantifier, and why nothing can be added (`gone`). */
|
|
24
30
|
export interface FilterGroup {
|
|
25
31
|
id: string;
|
|
26
32
|
join: "and" | "or";
|
|
27
33
|
rules: (FilterRule | FilterGroup)[];
|
|
34
|
+
exclude?: true;
|
|
35
|
+
relation?: {
|
|
36
|
+
field: string;
|
|
37
|
+
label?: string;
|
|
38
|
+
quantifier: Quantifier;
|
|
39
|
+
gone?: string;
|
|
40
|
+
};
|
|
28
41
|
}
|
|
29
42
|
export type FilterItem = FilterRule | FilterGroup;
|
|
30
43
|
/** How many levels deep rules stand at most, the filter itself the first: a rule three deep can't become a group. */
|
|
@@ -32,6 +45,10 @@ export declare const FILTER_DEPTH = 3;
|
|
|
32
45
|
/** The filter with nothing in it. */
|
|
33
46
|
export declare const NO_FILTER: FilterGroup;
|
|
34
47
|
export declare const isGroup: (x: FilterItem) => x is FilterGroup;
|
|
48
|
+
/** Whether an item is a relation rule's block. */
|
|
49
|
+
export declare const isBlock: (x: FilterItem) => x is FilterGroup & {
|
|
50
|
+
relation: NonNullable<FilterGroup["relation"]>;
|
|
51
|
+
};
|
|
35
52
|
/** Whether a value is a range's From and To: two ends, each a number or none. */
|
|
36
53
|
export declare const isPair: (v: FilterRule["value"]) => v is [number | null, number | null];
|
|
37
54
|
/** The field a rule reads, at the top or one level in; nothing once it is gone. */
|
|
@@ -48,11 +65,11 @@ export declare function addRule(f: FilterGroup, field: string, fields: FilterFie
|
|
|
48
65
|
filter: FilterGroup;
|
|
49
66
|
id: string;
|
|
50
67
|
};
|
|
51
|
-
/** The filter with the rule or group `id` taken away, and any group it leaves with no rules with it
|
|
52
|
-
* leaves it empty. */
|
|
68
|
+
/** The filter with the rule or group `id` taken away, and any group it leaves with no rules with it (never one that held none
|
|
69
|
+
* before); the filter's own last rule leaves it empty. */
|
|
53
70
|
export declare function removeRule(f: FilterGroup, id: string): FilterGroup;
|
|
54
|
-
/** The group `groupId`'s join, which is every join at its level. */
|
|
55
|
-
export declare
|
|
71
|
+
/** The group `groupId`'s join, which is every join at its level; a group that excludes its matches stays joined by And. */
|
|
72
|
+
export declare function setJoin(f: FilterGroup, groupId: string, join: FilterGroup["join"]): FilterGroup;
|
|
56
73
|
/** How many levels hold `id`: the filter itself 0, a rule or group in it 1, one in a group in it 2; -1 if it isn't there. */
|
|
57
74
|
export declare function depthOf(f: FilterGroup, id: string, at?: number): number;
|
|
58
75
|
/** Whether the rule `id` can become a group: a rule standing less than `levels` deep (three unless said; an advanced filter's group,
|
|
@@ -61,6 +78,27 @@ export declare const canGroup: (f: FilterGroup, id: string, levels?: number) =>
|
|
|
61
78
|
/** The rule `ruleId` turned into a group of its own, joined by And, holding it, its id never one in the filter or in `taken`; a rule
|
|
62
79
|
* `levels` deep, or a group, stays as it is. */
|
|
63
80
|
export declare function toGroup(f: FilterGroup, ruleId: string, taken?: readonly string[], levels?: number): FilterGroup;
|
|
81
|
+
/** The block `id` stands in, itself included; none outside one. */
|
|
82
|
+
export declare const blockAround: (f: FilterGroup, id: string) => FilterGroup | undefined;
|
|
83
|
+
/** The field a rule's field stands under one level in (a deal's Company for Company › Region); none at the top. */
|
|
84
|
+
export declare function relationOf(fields: FilterField[], field: string): FilterField | undefined;
|
|
85
|
+
/** The fields a rule in group `id` may name: a block's relation's own (its `level`; none where the fields don't list it, so
|
|
86
|
+
* nothing outside the relation is offered), else every field. The filter itself open on a relation's where (`relation` on the
|
|
87
|
+
* root) holds that relation's fields as its own. */
|
|
88
|
+
export declare function fieldsIn(f: FilterGroup, id: string, fields: FilterField[]): FilterField[];
|
|
89
|
+
/** Whether the group `id` can exclude its matches: a group, not a block, joined by And. The filter itself answers so too: whether
|
|
90
|
+
* it may (an advanced filter's own group, not a whole filter) is its holder's to say (`excludable`). */
|
|
91
|
+
export declare const canExclude: (f: FilterGroup, id: string) => boolean;
|
|
92
|
+
/** The group `id` excluding its matches or not; only a group joined by And takes it, and setting it on an Or group changes nothing. */
|
|
93
|
+
export declare function setExclude(f: FilterGroup, id: string, exclude: boolean): FilterGroup;
|
|
94
|
+
/** The block `id`'s quantifier. */
|
|
95
|
+
export declare const setQuantifier: (f: FilterGroup, id: string, quantifier: Quantifier) => FilterGroup;
|
|
96
|
+
/** The rule `ruleId`, on a related field and not inside a block, turned into a block of that relation with `quantifier`, holding
|
|
97
|
+
* it, its id never one in the filter or in `taken`; anything else, or a rule `levels` deep, stays. "any" changes nothing. */
|
|
98
|
+
export declare function toBlock(f: FilterGroup, ruleId: string, quantifier: Quantifier, fields: FilterField[], taken?: readonly string[], levels?: number): FilterGroup;
|
|
99
|
+
/** Whether Every fits a block's rules: at least one of them, at any depth, is whole (isWhole) and not set aside, as ViewKit's
|
|
100
|
+
* everyBlocked counts. */
|
|
101
|
+
export declare const everyFits: (rules: FilterItem[], fields: FilterField[]) => boolean;
|
|
64
102
|
/** A set-aside rule put back: its `aside` dropped, so it is written as a rule again; anything else stays. */
|
|
65
103
|
export declare function putBack(f: FilterGroup, id: string): FilterGroup;
|
|
66
104
|
/** The filter with nothing in it, its id and join kept. */
|
|
@@ -3,9 +3,11 @@ import { findItem, itemLabel } from "../picker/rows.js";
|
|
|
3
3
|
import { HOW, wayOf } from "./how.js";
|
|
4
4
|
export const OWN_WAY = "vk:";
|
|
5
5
|
export const isOwnWay = (how) => how.startsWith(OWN_WAY);
|
|
6
|
+
export const QUANTIFIERS = ["any", "none", "every"];
|
|
6
7
|
export const FILTER_DEPTH = 3;
|
|
7
8
|
export const NO_FILTER = { id: "root", join: "and", rules: [] };
|
|
8
9
|
export const isGroup = (x) => "rules" in x;
|
|
10
|
+
export const isBlock = (x) => isGroup(x) && !!x.relation;
|
|
9
11
|
export const isPair = (v) => Array.isArray(v) && v.length === 2 && v.every((n) => n === null || typeof n === "number");
|
|
10
12
|
export const fieldOf = (fields, field) => findItem(fields, field)?.item;
|
|
11
13
|
export const idsOf = (g) => [g.id, ...g.rules.flatMap((r) => (isGroup(r) ? idsOf(r) : [r.id]))];
|
|
@@ -42,10 +44,18 @@ export function addRule(f, field, fields, into = f.id, taken = []) {
|
|
|
42
44
|
export function removeRule(f, id) {
|
|
43
45
|
if (f.id === id)
|
|
44
46
|
return clearAll(f);
|
|
45
|
-
const without = (g) => ({ ...g, rules: g.rules.filter((r) => r.id !== id).
|
|
47
|
+
const without = (g) => ({ ...g, rules: g.rules.filter((r) => r.id !== id).flatMap((r) => {
|
|
48
|
+
if (!isGroup(r))
|
|
49
|
+
return [r];
|
|
50
|
+
const next = without(r);
|
|
51
|
+
return next.rules.length === 0 && r.rules.length > 0 ? [] : [next];
|
|
52
|
+
}) });
|
|
46
53
|
return without(f);
|
|
47
54
|
}
|
|
48
|
-
export
|
|
55
|
+
export function setJoin(f, groupId, join) {
|
|
56
|
+
const g = itemOf(f, groupId);
|
|
57
|
+
return g && isGroup(g) && g.exclude ? f : inGroup(f, groupId, (x) => ({ ...x, join }));
|
|
58
|
+
}
|
|
49
59
|
export function depthOf(f, id, at = 0) {
|
|
50
60
|
if (f.id === id)
|
|
51
61
|
return at;
|
|
@@ -68,6 +78,49 @@ export function toGroup(f, ruleId, taken = [], levels = FILTER_DEPTH) {
|
|
|
68
78
|
const wrap = (g) => ({ ...g, rules: g.rules.map((r) => (r.id === ruleId ? { id, join: "and", rules: [r] } : isGroup(r) ? wrap(r) : r)) });
|
|
69
79
|
return wrap(f);
|
|
70
80
|
}
|
|
81
|
+
function groupsAround(f, id) {
|
|
82
|
+
if (f.id === id)
|
|
83
|
+
return [f];
|
|
84
|
+
for (const r of f.rules) {
|
|
85
|
+
if (r.id === id)
|
|
86
|
+
return isGroup(r) ? [f, r] : [f];
|
|
87
|
+
if (isGroup(r)) {
|
|
88
|
+
const inner = groupsAround(r, id);
|
|
89
|
+
if (inner.length)
|
|
90
|
+
return [f, ...inner];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
export const blockAround = (f, id) => groupsAround(f, id).reverse().find((g) => !!g.relation);
|
|
96
|
+
export function relationOf(fields, field) {
|
|
97
|
+
return findItem(fields, field)?.path[0];
|
|
98
|
+
}
|
|
99
|
+
export function fieldsIn(f, id, fields) {
|
|
100
|
+
const block = blockAround(f, id);
|
|
101
|
+
if (!block || block === f)
|
|
102
|
+
return fields;
|
|
103
|
+
return fieldOf(fields, block.relation.field)?.level ?? [];
|
|
104
|
+
}
|
|
105
|
+
export const canExclude = (f, id) => { const g = itemOf(f, id); return !!g && isGroup(g) && !g.relation && g.join === "and"; };
|
|
106
|
+
export function setExclude(f, id, exclude) {
|
|
107
|
+
if (!canExclude(f, id))
|
|
108
|
+
return f;
|
|
109
|
+
return inGroup(f, id, ({ exclude: _was, ...g }) => (exclude ? { ...g, exclude: true } : g));
|
|
110
|
+
}
|
|
111
|
+
export const setQuantifier = (f, id, quantifier) => inGroup(f, id, (g) => (g.relation ? { ...g, relation: { ...g.relation, quantifier } } : g));
|
|
112
|
+
export function toBlock(f, ruleId, quantifier, fields, taken = [], levels = FILTER_DEPTH) {
|
|
113
|
+
const r = itemOf(f, ruleId);
|
|
114
|
+
if (quantifier === "any" || !r || isGroup(r) || blockAround(f, ruleId) || !canGroup(f, ruleId, levels))
|
|
115
|
+
return f;
|
|
116
|
+
const relation = relationOf(fields, r.field);
|
|
117
|
+
if (!relation)
|
|
118
|
+
return f;
|
|
119
|
+
const id = nextId(f, "g", taken);
|
|
120
|
+
const wrap = (g) => ({ ...g, rules: g.rules.map((x) => (x.id === ruleId ? { id, join: "and", relation: { field: relation.value, quantifier }, rules: [x] } : isGroup(x) ? wrap(x) : x)) });
|
|
121
|
+
return wrap(f);
|
|
122
|
+
}
|
|
123
|
+
export const everyFits = (rules, fields) => rules.some((r) => (isGroup(r) ? everyFits(r.rules, fields) : !r.aside && isWhole(r, fields)));
|
|
71
124
|
export function putBack(f, id) {
|
|
72
125
|
const walk = (g) => ({ ...g, rules: g.rules.map((r) => (isGroup(r) ? walk(r) : r.id === id && r.aside ? (({ aside: _gone, ...rest }) => rest)(r) : r)) });
|
|
73
126
|
return walk(f);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { MenuListWords } from "../menu-list/menu-list.js";
|
|
1
2
|
import type { PickerWords } from "../picker/picker.js";
|
|
3
|
+
import type { Quantifier } from "./rules.js";
|
|
2
4
|
export interface FilterEditorWords {
|
|
3
5
|
/** What stands before a level's first rule. */
|
|
4
6
|
where: string;
|
|
@@ -51,8 +53,21 @@ export interface FilterEditorWords {
|
|
|
51
53
|
save: string;
|
|
52
54
|
/** A set-aside rule's menu row putting it back. */
|
|
53
55
|
putBack: string;
|
|
56
|
+
/** A block's quantifier, as its box and a related rule's ⋮ say it ("none where"). */
|
|
57
|
+
quantifier: (q: Quantifier) => string;
|
|
58
|
+
/** Why Every can't be picked yet, by the relation's name in lower case. */
|
|
59
|
+
everyNeedsWhere: (one: string) => string;
|
|
60
|
+
/** A group's ⋮, to a screen reader, and its menu's (or its phone step's) name. */
|
|
61
|
+
groupActions: string;
|
|
62
|
+
/** A group's ⋮ row that keeps what its rules don't match, and why it can't (an Or group). */
|
|
63
|
+
exclude: string;
|
|
64
|
+
excludeNeedsAnd: string;
|
|
65
|
+
/** What an excluded group says at its top. */
|
|
66
|
+
excluded: string;
|
|
54
67
|
/** The lists' own words (the Picker's). */
|
|
55
68
|
picker?: Partial<PickerWords>;
|
|
69
|
+
/** A ⋯'s rows on a phone's step (a group's Exclude matches its Switch): the Menu list's own words. */
|
|
70
|
+
list?: Partial<MenuListWords>;
|
|
56
71
|
}
|
|
57
72
|
export declare const FILTER_EDITOR_WORDS: FilterEditorWords;
|
|
58
73
|
/** The filter editor's words: the handed ones over the English. */
|
|
@@ -36,5 +36,11 @@ export const FILTER_EDITOR_WORDS = {
|
|
|
36
36
|
close: "Close",
|
|
37
37
|
save: "Save",
|
|
38
38
|
putBack: "Put back",
|
|
39
|
+
quantifier: (q) => `${q} where`,
|
|
40
|
+
everyNeedsWhere: (one) => `Pick a ${one} field under Where first`,
|
|
41
|
+
groupActions: "Actions for this group",
|
|
42
|
+
exclude: "Exclude matches",
|
|
43
|
+
excludeNeedsAnd: "Join by And to exclude matches",
|
|
44
|
+
excluded: "Not all of these",
|
|
39
45
|
};
|
|
40
46
|
export const filterWords = (given) => (given ? { ...FILTER_EDITOR_WORDS, ...given } : FILTER_EDITOR_WORDS);
|
|
@@ -121,4 +121,22 @@
|
|
|
121
121
|
.o-filter-editor-why { display: flex; width: 100%; }
|
|
122
122
|
.o-filter-editor-why > .o-select { width: 100%; }
|
|
123
123
|
[data-filter-form="computer"] .o-filter-editor-value[data-value-box="own"] { width: calc(var(--vk-spacing) * 52); }
|
|
124
|
+
|
|
125
|
+
/* ── VK-827: a group that excludes its matches says so over its rules; a relation rule's block is a group's well with a head, its
|
|
126
|
+
relation's name and its quantifier's box, laid out as ViewKit's own block (Mihai, 29 Nov 2026: built from the kit's parts); a
|
|
127
|
+
group's ⋮ ends its foot, after Delete group, as a rule's ends its row ─────────────────────────────────────────────────────── */
|
|
128
|
+
.o-filter-editor-excluded {
|
|
129
|
+
margin: 0; color: var(--vk-fg-subtle); font-size: var(--vk-font-size-xs); font-weight: var(--vk-font-weight-medium);
|
|
130
|
+
line-height: calc(var(--vk-font-size-xs) * var(--vk-line-height-xs));
|
|
131
|
+
}
|
|
132
|
+
.o-filter-editor-block-head { display: flex; align-items: center; gap: calc(var(--vk-spacing) * 2); min-width: 0; }
|
|
133
|
+
.o-filter-editor-relation {
|
|
134
|
+
flex: none; color: var(--vk-fg); font-size: var(--vk-font-size-sm); font-weight: var(--vk-font-weight-medium);
|
|
135
|
+
line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm));
|
|
136
|
+
}
|
|
137
|
+
.o-filter-editor-block-head > .o-select { flex: 0 1 auto; min-width: 0; }
|
|
138
|
+
.o-filter-editor-block-head .o-select-field { width: max-content; max-width: 100%; }
|
|
139
|
+
:is([data-filter-form="phone"], [data-filter-form="narrow"]) :is(.o-filter-editor-block-head, .o-filter-editor-excluded) { padding: 0 calc(var(--vk-spacing) * 3); }
|
|
140
|
+
[data-filter-form="phone"] .o-filter-editor-group > .o-filter-editor-block-head { padding-top: calc(var(--vk-spacing) * 2.5); }
|
|
141
|
+
.o-filter-editor-acts .o-filter-editor-more { justify-self: end; width: auto; }
|
|
124
142
|
}
|
|
@@ -54,14 +54,16 @@ export { listSide, type ListSide } from "./select/side.js";
|
|
|
54
54
|
export { chipsThatFit } from "./select/fit.js";
|
|
55
55
|
export { filledMatch } from "./select/filled.js";
|
|
56
56
|
export { Pane, PaneBody, PaneClose, PaneFoot, PaneHead, PaneTitle, paneAfter, usePane, type PaneChangeDetails, type PaneCloseReason, type PanePress, type PaneProps, type PaneState } from "./pane/pane.js";
|
|
57
|
+
export { InToolbar, ToolbarButtonControl, useToolbarButtonWorn, type ToolbarButtonGround, type ToolbarButtonProps, type ToolbarButtonSize, type ToolbarButtonSmoothing, type ToolbarButtonWords, } from "./toolbar-button/toolbar-button.js";
|
|
57
58
|
export { Radio, RadioGroup, type RadioGroupProps, type RadioProps } from "./radio/radio.js";
|
|
58
59
|
export { sortableFields, useSortEditor as useSortEditorParts, type SortEditorOpens, type SortEditorParts, type SortEditorProps } from "./sort-editor/sort-editor.js";
|
|
59
60
|
export { SORT_MAX, addSort, canAddSort, dropAside, openPlaces, putBack, repoint, sortLabel, sortedFields, takenBy, type FieldOf, type SortAside } from "./sort-editor/rules.js";
|
|
60
61
|
export { SORT_EDITOR_WORDS, sortWords, type SortEditorWords } from "./sort-editor/words.js";
|
|
61
62
|
export { LOCK, useViewsList, useViewsListWorn, ViewsList, type ViewsListParts } from "./views-list/views-list.js";
|
|
62
|
-
export { JUST_ME, listed, SHARED, type ListView, type ViewsListChange, type ViewsListLayout } from "./views-list/rules.js";
|
|
63
|
+
export { canDelete, columnsLabel, copyName, deleteLine, JUST_ME, listed, SHARED, viewsAfter, type DeleteLineWords, type ListView, type ViewsListChange, type ViewsListLayout, type ViewsState } from "./views-list/rules.js";
|
|
63
64
|
export { VIEWS_LIST_ATTRS, viewsListWornOf, type ViewsListWorn } from "./views-list/looks.js";
|
|
64
|
-
export { VIEWS_LIST_WORDS, viewsListWords, type ViewsListWords } from "./views-list/words.js";
|
|
65
|
+
export { VIEW_MENU_WORDS, VIEWS_LIST_WORDS, viewsListWords, type ViewMenuWords, type ViewsListWords } from "./views-list/words.js";
|
|
66
|
+
export { useViewMenu, type ViewMenuAsk, type ViewMenuParts, type ViewMenuProps, type ViewMenuShows, type ViewMenuStep } from "./views-list/view-menu.js";
|
|
65
67
|
export { useFilterEditor as useFilterEditorParts, type FilterEditorParts, type FilterEditorProps, type FilterOwn } from "./filter-editor/filter-editor.js";
|
|
66
68
|
export { FILTER_SEARCH, FilterPartBody, PairValue, valuePlaceholder, type FilterPart, type FilterPartProps } from "./filter-editor/parts.js";
|
|
67
69
|
export { CHECKED, HOW, wayOf, type FilterField, type FilterWay, type Takes } from "./filter-editor/how.js";
|
|
@@ -70,12 +72,32 @@ export { FILTER_EDITOR_WORDS, filterWords, type FilterEditorWords } from "./filt
|
|
|
70
72
|
export { useGroupEditor, type GroupEditorLevel, type GroupEditorParts, type GroupEditorProps, type GroupEditorValue } from "./group-editor/group-editor.js";
|
|
71
73
|
export { directionTurns, groupLabel, groupOrders, hideAllGroups, moveGroup, noneShown, orderedGroups, setGroupShown, showAllGroups, startGroup, type GroupDirection, type GroupOrder, type GroupValue } from "./group-editor/rules.js";
|
|
72
74
|
export { GROUP_EDITOR_WORDS, groupWords, type GroupEditorWords } from "./group-editor/words.js";
|
|
75
|
+
export { layoutMark, useCustomize, useCustomizeWorn, type CustomizeChoice, type CustomizeLayout, type CustomizeLayoutSettings, type CustomizeParts, type CustomizeProps, type CustomizeScreen, type CustomizeSection, type CustomizeToggle, type CustomizeView } from "./customize/customize.js";
|
|
76
|
+
export { columnsSay, findColumns, hideAll, moveColumn, setShown, showAll, type CustomizeColumn } from "./customize/rules.js";
|
|
77
|
+
export { reduced, slideTime, useGlide } from "./customize/glide.js";
|
|
78
|
+
export { CUSTOMIZE_ATTRS, customizeWornOf, type CustomizeWorn } from "./customize/looks.js";
|
|
79
|
+
export { CUSTOMIZE_WORDS, customizeWords, type CustomizeWords } from "./customize/words.js";
|
|
80
|
+
export type { CustomizeBodyOwn } from "./customize/map-customize-body.js";
|
|
81
|
+
export { SheetPartsFrom, type SheetParts } from "./sheet/sheet-parts.js";
|
|
73
82
|
export { MODAL_WORDS, Modal, type ModalAction, type ModalFoot, type ModalProps, type ModalSize, type ModalState, type ModalWords } from "./modal/modal.js";
|
|
74
83
|
export { ALERT_DIALOG_WORDS, AlertDialog, AlertDialogHost, AlertDialogPanel, confirm, type AlertDialogPanelProps, type AlertDialogProps, type AlertDialogWords } from "./alert-dialog/alert-dialog.js";
|
|
75
84
|
export { TOAST_WORDS, Toast, ToastShown, createToastManager, useToast, type ToastManager, type ToastOptions, type ToastWords } from "./toast/toast.js";
|
|
76
85
|
export { Collapsible, CollapsiblePanel, CollapsibleTrigger, type CollapsiblePanelProps, type CollapsibleProps, type CollapsibleTriggerProps } from "./collapsible/collapsible.js";
|
|
77
86
|
export { ALERT_WORDS, Alert, type AlertAsk, type AlertKind, type AlertProps, type AlertState, type AlertWords } from "./alert/alert.js";
|
|
78
87
|
export { NOTICE_ICONS, NOTICE_WORDS, Notice, type NoticeAction, type NoticeMeaning, type NoticeProps, type NoticeWords } from "./notice/notice.js";
|
|
88
|
+
export { QuickFilters, type QuickField, type QuickFiltersProps, type QuickHolding, type QuickHolds, type QuickMark, type QuickPress, type QuickValue } from "./quick-filters/quick-filters.js";
|
|
89
|
+
export { QUICK_FILTERS_RULES } from "./quick-filters/rules.js";
|
|
90
|
+
export { QUICK_FILTERS_ATTRS, quickFiltersWornOf } from "./quick-filters/looks.js";
|
|
91
|
+
export { QUICK_FILTERS_WORDS, quickFiltersWords, type QuickFiltersWords } from "./quick-filters/words.js";
|
|
92
|
+
export { quickFiltersFieldsOf, quickHoldsOf, quickListHoldOf, type QuickFiltersFieldIn } from "./quick-filters/map-quick-filters-body.js";
|
|
93
|
+
export { ToolbarControl, ToolbarFolds, ToolbarInput, ToolbarSeparatorControl, ToolbarSpacer, toolbarSteps, useToolbarWorn, type ToolbarAt, type ToolbarFoldsProps, type ToolbarInputProps, type ToolbarPlace, type ToolbarProps, } from "./toolbar/toolbar.js";
|
|
94
|
+
export { TOOLBAR_ATTRS, toolbarWornOf } from "./toolbar/looks.js";
|
|
95
|
+
export { TOOLBAR_WORDS, toolbarWords, type ToolbarWords } from "./toolbar/words.js";
|
|
96
|
+
export { QuickFiltersReminderControl, type QuickFiltersReminderProps } from "./quick-filters/reminder.js";
|
|
97
|
+
export { QUICK_FILTERS_REMINDER_WORDS, quickFiltersReminderWords, type QuickFiltersReminderWords } from "./quick-filters/words.js";
|
|
98
|
+
export { BulkBar, useBulkBarWorn, type BulkBarProps, type BulkDone, type BulkNoun, type BulkRun, type BulkVerb, type BulkVerbItem } from "./bulk-bar/bulk-bar.js";
|
|
99
|
+
export { BULK_BAR_ATTRS, bulkBarWornOf } from "./bulk-bar/looks.js";
|
|
100
|
+
export { BULK_BAR_WORDS, bulkBarWords, type BulkBarWords } from "./bulk-bar/words.js";
|
|
79
101
|
export { useTextEditor, type TextEditorParts } from "./text-editor/text-editor.js";
|
|
80
102
|
export { TEXT_KEYS, enterDoes, kept, lineOf, midWord, ownChange, textRefusal, tidy, type TextKeys, type TextKind } from "./text-editor/check.js";
|
|
81
103
|
export { DIALS, countryName, dialOf, exampleOf, patternOf, phoneHanded, phoneOf, phoneParts, type Dial } from "./text-editor/phone-number.js";
|
|
@@ -107,3 +129,5 @@ export { VALUES_EDITOR_WORDS, valuesWords, type ValuesEditorWords } from "./valu
|
|
|
107
129
|
export { LinksEditor, useLinksEditor, type LinksEditorAction, type LinksEditorLead, type LinksEditorOpens, type LinksEditorParts, type LinksEditorProps, } from "./links-editor/links-editor.js";
|
|
108
130
|
export { found, heldOf, leadAfter, offered, removed, said, saidShort, setValue, ticked, type LinkChoice, type LinkField, type LinkFieldKind, type LinkValue, } from "./links-editor/links.js";
|
|
109
131
|
export { LINKS_EDITOR_WORDS, linksWords, type LinksEditorWords } from "./links-editor/words.js";
|
|
132
|
+
export { TagField, type TagFieldProps } from "./tag-field/tag-field.js";
|
|
133
|
+
export { SwitchRow, SwitchRows, type SwitchRowProps } from "./switch-row/switch-row.js";
|