@erxes/ui 4.0.0-v2.13 → 4.0.0-v2.15

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.
Files changed (78) hide show
  1. package/CATALOG.md +15 -8
  2. package/README.md +1 -1
  3. package/dist/index.d.ts +6 -6
  4. package/dist/index.js +4 -3
  5. package/dist/modules/conditions/ConditionsEditor.d.ts +5 -3
  6. package/dist/modules/conditions/ConditionsEditor.js +139 -177
  7. package/dist/modules/conditions/DateEditors.d.ts +8 -0
  8. package/dist/modules/conditions/DateEditors.js +188 -0
  9. package/dist/modules/conditions/FieldPicker.d.ts +17 -0
  10. package/dist/modules/conditions/FieldPicker.js +99 -0
  11. package/dist/modules/conditions/RuleParts.d.ts +30 -0
  12. package/dist/modules/conditions/RuleParts.js +78 -0
  13. package/dist/modules/conditions/RuleRow.d.ts +27 -0
  14. package/dist/modules/conditions/RuleRow.js +156 -0
  15. package/dist/modules/conditions/TypedInput.d.ts +13 -0
  16. package/dist/modules/conditions/TypedInput.js +36 -0
  17. package/dist/modules/conditions/ValueEditor.d.ts +18 -0
  18. package/dist/modules/conditions/ValueEditor.js +169 -0
  19. package/dist/modules/conditions/conditions.d.ts +21 -12
  20. package/dist/modules/conditions/conditions.js +8 -75
  21. package/dist/modules/conditions/fieldIcons.d.ts +6 -0
  22. package/dist/modules/conditions/fieldIcons.js +21 -0
  23. package/dist/modules/conditions/fieldOptions.d.ts +15 -0
  24. package/dist/modules/conditions/fieldOptions.js +38 -0
  25. package/dist/modules/conditions/filterRule.d.ts +45 -0
  26. package/dist/modules/conditions/filterRule.js +171 -0
  27. package/dist/modules/conditions/filterText.d.ts +16 -0
  28. package/dist/modules/conditions/filterText.js +156 -0
  29. package/dist/modules/filter/components/Filter.d.ts +1 -1
  30. package/dist/modules/filter/components/Filter.js +1 -1
  31. package/dist/modules/list/ListFilter.d.ts +22 -10
  32. package/dist/modules/list/ListFilter.js +53 -20
  33. package/dist/modules/list/ViewBar.d.ts +2 -0
  34. package/dist/modules/list/ViewBar.js +21 -10
  35. package/dist/modules/list/filter/AddFilter.d.ts +10 -0
  36. package/dist/modules/list/filter/AddFilter.js +140 -0
  37. package/dist/modules/list/filter/AdvancedPopover.d.ts +8 -0
  38. package/dist/modules/list/filter/AdvancedPopover.js +103 -0
  39. package/dist/modules/list/filter/ListFilterBar.d.ts +3 -3
  40. package/dist/modules/list/filter/ListFilterBar.js +109 -205
  41. package/dist/modules/list/filter/RuleChips.d.ts +12 -2
  42. package/dist/modules/list/filter/RuleChips.js +132 -134
  43. package/dist/modules/list/filter/SearchChip.d.ts +6 -0
  44. package/dist/modules/list/filter/SearchChip.js +69 -0
  45. package/dist/modules/list/filter/filterRules.d.ts +15 -40
  46. package/dist/modules/list/filter/filterRules.js +27 -156
  47. package/dist/modules/list/filter/listFilterContext.d.ts +25 -18
  48. package/dist/modules/list/filter/listFilterContext.js +8 -24
  49. package/dist/modules/list/filter/listFilterQuery.d.ts +4 -0
  50. package/dist/modules/list/filter/listFilterQuery.js +10 -2
  51. package/dist/modules/pickers/LookupPicker.d.ts +6 -0
  52. package/dist/modules/pickers/LookupPicker.js +32 -1
  53. package/dist/modules/record-list/RecordList.d.ts +2 -1
  54. package/dist/modules/record-list/RecordList.js +2 -1
  55. package/dist/modules/record-list/RecordListRoot.d.ts +3 -1
  56. package/dist/modules/record-list/RecordListRoot.js +53 -37
  57. package/dist/modules/record-table/components/RecordTableHead.d.ts +7 -2
  58. package/dist/modules/record-table/components/RecordTableHead.js +73 -6
  59. package/dist/modules/record-table/components/RecordTableProvider.d.ts +22 -1
  60. package/dist/modules/record-table/components/RecordTableProvider.js +12 -1
  61. package/dist/modules/records/contacts.d.ts +18 -0
  62. package/dist/modules/records/openRecord.d.ts +35 -1
  63. package/dist/modules/records/openRecord.js +27 -4
  64. package/dist/theme.css +3 -2
  65. package/dist/types/UIConfig.d.ts +47 -100
  66. package/dist/types/UIConfig.js +14 -0
  67. package/exports.txt +10 -3
  68. package/package.json +1 -1
  69. package/dist/modules/conditions/ConditionValueInput.d.ts +0 -10
  70. package/dist/modules/conditions/ConditionValueInput.js +0 -166
  71. package/dist/modules/conditions/PathPicker.d.ts +0 -8
  72. package/dist/modules/conditions/PathPicker.js +0 -56
  73. package/dist/modules/list/filter/AdvancedFilterDialog.d.ts +0 -5
  74. package/dist/modules/list/filter/AdvancedFilterDialog.js +0 -52
  75. package/dist/modules/list/filter/FieldMenus.d.ts +0 -5
  76. package/dist/modules/list/filter/FieldMenus.js +0 -184
  77. package/dist/modules/list/filter/fieldIcons.d.ts +0 -7
  78. package/dist/modules/list/filter/fieldIcons.js +0 -16
package/CATALOG.md CHANGED
@@ -32,8 +32,9 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
32
32
 
33
33
  - `<DisplayMenu list displays>` The Display menu in a list's filter bar: table, board or grouped list.
34
34
  - `EnumCursorDirection` Which way a cursor-paged table loads more rows: forward or backward.
35
- - `Filter.{Trigger, Popover, Item, CommandItem, View, …}` Parts of a filter popover and bar, which `ListFilter` is built from.
36
- - `<ListFilter recordType>` A list's filter bar, with a field menu, search and conditions as chips.
35
+ - `Filter.{Trigger, Popover, Item, CommandItem, View, …}` Parts of a filter popover and bar, for a page without saved views.
36
+ - `<ListFilter recordType>` A list's filter: a view bar button, and a chip row while it filters.
37
+ - `<ListFilterEmpty records fallback>` A list's empty state while `ListFilter` filters it, with Clear filters.
37
38
  - `listFilterQuery` The URL params holding a list's filter, as nuqs parsers.
38
39
  - `<ListViewsProvider views>` Gives every list with a `recordType` saved views, as core's lists have.
39
40
  - `RecordList.{Provider, Skeleton, useSelection}` Rows grouped under headers that fold away, such as tasks by status.
@@ -46,6 +47,7 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
46
47
  - `type TListFilterProps` The props of `ListFilter`: its `id`, `fields`, lookups and record count.
47
48
  - `type TListViews { Tabs, Changes }` The host's saved views for a list.
48
49
  - `type TPluginListType` A plugin's list: its record type, `<plugin>:<record>` (`sales:deal`).
50
+ - `type TRecordTableSort { by, direction }` The order a list's rows come in: by a column, either way.
49
51
  - `type TViewTabsProps { recordType, allLabel }` The props of the host's saved-view tabs: the list and its "All …" label.
50
52
  - `useFilterContext()` Controls of the enclosing `Filter`: open or close it and switch views.
51
53
  - `useListDisplay(list, displays)` The display a list shows, as picked in its Display menu.
@@ -59,6 +61,8 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
59
61
  - `companyTitle(company)` A company's name, else its email or phone.
60
62
  - `<ContactLink contentType contentId contacts placeholder>` A customer or company as a chip: its avatar and name.
61
63
  - `type ContactQueries { customer, company }` Where customers and companies come from, as TanStack query options.
64
+ - `type ContactSearch { search, ids }` What a contact search asks for: matches, or the contacts with these ids.
65
+ - `type ContactSearchQueries { customers, companies }` Where a filter's `customer` and `company` fields search contacts.
62
66
  - `type CustomerContact { id, firstName, middleName, lastName, primaryEmail, … }` What a customer reads as: core's `Customer` has these fields and more.
63
67
  - `customerTitle(customer)` A customer's name, else its email or phone.
64
68
  - `<PanelDescriptionEditor value scope readonly isHTML onSave>` A record's description as a full-size tab.
@@ -70,8 +74,10 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
70
74
  - `<PanelFormRow label icon required error hint>` One field of a form in the side panel, laid out like `PanelField`.
71
75
  - `<PanelLabel tooltip>` A side panel label cut at two lines, with the full text on hover.
72
76
  - `<PanelSection title icon nested>` A plain heading that groups the side panel's rows.
73
- - `<RecordOpenerProvider open openNew>` The host app's way to open records, which `useOpenRecord` calls.
77
+ - `<RecordOpenerProvider open openNew current dismiss>` The host app's way to open records, which `useOpenRecord` calls.
74
78
  - `RecordPage` A record on its own page, as core draws a customer's.
79
+ - `type RecordPanelControls { record, tab, setTab, close, dismiss, … }` What a record shown in core's panel, or on its own page, can do to it.
80
+ - `RecordPanelProvider` Web gives each record it shows its controls.
75
81
  - `type RecordRef { contentType, contentId }` A record the host can open, by `contentType` and `contentId`.
76
82
  - `RecordTimeline` Core's timeline of notes, calls and events for a plugin's record.
77
83
  - `type RecordTimelineProps { type, id }` Which record `RecordTimeline` shows: its timeline type and id.
@@ -80,6 +86,7 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
80
86
  - `type TContactContentType` The customer or company types `ContactLink` shows.
81
87
  - `useOpenRecord()` Opens a record, or a new draft, in core's side panel.
82
88
  - `usePanelExpanded()` Whether the record shows at full size on its own page.
89
+ - `useRecordPanel()` The record a slot is in, and what the slot can do to it.
83
90
 
84
91
  ## Fields and pickers
85
92
 
@@ -112,7 +119,7 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
112
119
  - `type TagsQuery` TanStack query options for the tags of one record type.
113
120
  - `type TConditionField { path, label, type, options, group, … }` A field conditions can use: a record's, or an earlier step's output.
114
121
  - `type TConditionGroup { match, rules }` Rules (or nested groups) that must all, or any, hold.
115
- - `type TConditionLookups { members, tags }` Where `member` and `tags` values pick from.
122
+ - `type TConditionLookups { members, tags, contacts }` Where `member`, `tags`, `customer` and `company` values pick from.
116
123
  - `type TConditionRule { path, op, value }` One rule of a condition: a `path`, an operator and maybe a value.
117
124
  - `<TextField placeholder value scope onSave onValueChange>` A text value in a table cell or panel row that edits in a popover.
118
125
  - `useMemberOptions(members, enabled, picked)` The active team members as picker options.
@@ -195,10 +202,11 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
195
202
  ## Plugin runtime
196
203
 
197
204
  - `addPluginStyles(plugin, css)` Adds a plugin UI's compiled Tailwind to the page, minus what web has.
205
+ - `DASHBOARD_WIDGET_PREVIEWS` Every schematic the widget catalog can draw for a dashboard widget.
198
206
  - `type FileStorageAdapter { upload, remove }` Where erxes-ui's upload hooks and components send files.
199
207
  - `getPluginAssetsUrl(pluginName, url)` A file's URL in a plugin UI's deployed `assets` folder.
200
208
  - `getPluginRuntime()` The host's plugin runtime, or null outside erxes.
201
- - `type IUIConfig { name, path, icon, recordSections, recordTypes, … }` A plugin UI's `CONFIG`, exported from its `./config` remote.
209
+ - `type IUIConfig { name, path, icon, settings, recordSections, … }` A plugin UI's `CONFIG`, exported from its `./config` remote.
202
210
  - `pluginFetch(plugin, path, init)` `fetch` against a plugin's API as the signed-in member.
203
211
  - `pluginJson(plugin, path, schema, init)` JSON in, JSON out, checked against `schema`.
204
212
  - `type PluginLiveMessage` A message on core's live stream: a plugin's changed topics, or resync.
@@ -206,11 +214,10 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
206
214
  - `type PluginSession { token, expiresAt, apiUrl }` A member's short-lived token for one plugin's API, and its address.
207
215
  - `setFileStorage(next)` Sets where uploads go; web calls it at startup and plugins don't.
208
216
  - `setPluginRuntime(next)` Sets the plugin runtime; web calls it at startup and plugins don't.
209
- - `type TActivityRowProps { activity }` Props of a plugin's activity row component in `widgets.activityRows`.
217
+ - `type TDashboardWidget { name, title, description, icon, preview, … }` A plugin's tile for core's home dashboard.
210
218
  - `type TDashboardWidgetPreview` The schematic a dashboard widget shows in the widget catalog.
211
219
  - `type TPanelRecordType { contentType, title, icon, detailPath, Title, … }` A record type a plugin shows in core's side panel.
212
- - `type TPropertyInputMeta` A property input's own settings, stored with the custom field.
213
- - `type TPropertyInputProps { value, onValueChange, meta, onMetaChange, disabled }` Props of a custom property input in `widgets.propertyInputs`.
220
+ - `type TPluginSettingsPage { path, label, icon }` A plugin's settings page, linked from core's settings sidebar.
214
221
  - `type TRecordContacts { customerIds, companyIds }` The customers and companies a record is about.
215
222
  - `type TRecordDraftProps { defaults, onCreated, onCancel }` Props of a plugin record type's `New` slot, the draft form.
216
223
  - `type TRecordSection { contentType, title, icon, component }` A plugin's section on a customer's or company's detail in core's panel.
package/README.md CHANGED
@@ -41,7 +41,7 @@ Only what something uses:
41
41
  `PanelField`, `PanelFormRow`, `PanelFormLayout`, `PanelLabel`, the description field and
42
42
  editor, and `usePanelExpanded`. The panel itself (header, tabs, resize) is web's.
43
43
  - a list's bar in `src/modules/list`: `ViewBar`, `DisplayMenu` with `useListDisplay`, and
44
- `ListFilter` with `useListFilterParams`. `ListFilter` draws core's filter bar itself, with or
44
+ `ListFilter` with `useListFilterParams` and its empty state `ListFilterEmpty`. `ListFilter` draws core's filter bar itself, with or
45
45
  without web: its `member` fields pick from `members` (`memberQueries` from
46
46
  `@erxes/core-contract/client`) and its `tags` fields from `tags` (a tags query of the record
47
47
  type); a plugin outside erxes passes its own. Web's lists and the automation builder use the
package/dist/index.d.ts CHANGED
@@ -99,11 +99,11 @@ import { PhoneInput } from "./modules/record-field/meta-inputs/components/PhoneI
99
99
  import { RecordList } from "./modules/record-list/RecordList.js";
100
100
  import { RecordListGroup } from "./modules/record-list/RecordListRoot.js";
101
101
  import { RecordTable } from "./modules/record-table/components/RecordTable.js";
102
- import { RecordTableColumnDef } from "./modules/record-table/components/RecordTableProvider.js";
102
+ import { RecordTableColumnDef, TRecordTableSort } from "./modules/record-table/components/RecordTableProvider.js";
103
103
  import { RecordTableInlineCell } from "./modules/record-table/components/RecordTableCellInline.js";
104
104
  import { EnumCursorDirection } from "./modules/record-table/types/RecordTableCursorTypes.js";
105
105
  import { DisplayMenu, TListDisplay, useListDisplay } from "./modules/list/DisplayMenu.js";
106
- import { ListFilter, TListFilterField, TListFilterProps, useListFilterParams } from "./modules/list/ListFilter.js";
106
+ import { ListFilter, ListFilterEmpty, TListFilterField, TListFilterProps, useListFilterParams } from "./modules/list/ListFilter.js";
107
107
  import { listFilterQuery } from "./modules/list/filter/listFilterQuery.js";
108
108
  import { TConditionField, TConditionGroup, TConditionLookups, TConditionRule, isRule } from "./modules/conditions/conditions.js";
109
109
  import { ConditionsEditor } from "./modules/conditions/LazyConditionsEditor.js";
@@ -116,11 +116,11 @@ import { PanelLabel } from "./modules/record-panel/PanelLabel.js";
116
116
  import { PanelSection } from "./modules/record-panel/PanelSection.js";
117
117
  import { PanelExpansionContext, usePanelExpanded } from "./modules/record-panel/panelExpansion.js";
118
118
  import { ContactLink } from "./modules/records/ContactLink.js";
119
- import { CompanyContact, ContactQueries, CustomerContact, TContactContentType, companyTitle, customerTitle } from "./modules/records/contacts.js";
120
- import { RecordOpenerProvider, RecordPage, RecordRef, setRecordPage, useOpenRecord } from "./modules/records/openRecord.js";
119
+ import { CompanyContact, ContactQueries, ContactSearch, ContactSearchQueries, CustomerContact, TContactContentType, companyTitle, customerTitle } from "./modules/records/contacts.js";
120
+ import { RecordOpenerProvider, RecordPage, RecordPanelControls, RecordPanelProvider, RecordRef, setRecordPage, useOpenRecord, useRecordPanel } from "./modules/records/openRecord.js";
121
121
  import { ThemeOption, themeState } from "./state/themeState.js";
122
122
  import { SexCode } from "./types/SexCode.js";
123
- import { IUIConfig, TActivityRowProps, TDashboardWidgetPreview, TPanelRecordType, TPropertyInputMeta, TPropertyInputProps, TRecordContacts, TRecordDraftProps, TRecordSection, TRecordSectionProps, TRecordSlotProps, TRecordTab, TRelationTab, TRelationTabProps } from "./types/UIConfig.js";
123
+ import { DASHBOARD_WIDGET_PREVIEWS, IUIConfig, TDashboardWidget, TDashboardWidgetPreview, TPanelRecordType, TPluginSettingsPage, TRecordContacts, TRecordDraftProps, TRecordSection, TRecordSectionProps, TRecordSlotProps, TRecordTab, TRelationTab, TRelationTabProps } from "./types/UIConfig.js";
124
124
  import { isUndefinedOrNull } from "./utils/IsUndefinedOrNull.js";
125
125
  import { readImage } from "./utils/core.js";
126
126
  import { FileStorageAdapter, setFileStorage } from "./utils/file-storage.js";
@@ -130,4 +130,4 @@ import { jsonOf } from "./utils/json.js";
130
130
  import { PluginLiveMessage, PluginRuntime, PluginSession, getPluginRuntime, pluginFetch, pluginJson, setPluginRuntime, useLiveSignal } from "./utils/plugin-runtime.js";
131
131
  import { addPluginStyles } from "./utils/plugin-styles.js";
132
132
  import { RecordTimeline, RecordTimelineProps, setRecordTimeline } from "./utils/record-timeline.js";
133
- export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, type AvatarProps, BackgroundGradientAnimation, Badge, type BadgeProps, Breadcrumb, Button, type ButtonProps, Calendar, type CalendarProps, Card, type ChartConfig, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, type CompanyContact, ConditionsEditor, ContactLink, type ContactQueries, ContextMenu, CopyText, type CustomerContact, DateInput, DatePicker, Dialog, DisplayMenu, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, type FileStorageAdapter, Filter, Form, FullNameField, FullNameValue, HoverCard, type IUIConfig, IconComponent, IconPicker, IconTip, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, ListFilter, ListViewsProvider, LookupPicker, type Member, MemberInline, type MemberQueries, type MultiSelectOption, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PanelDescriptionEditor, PanelDescriptionField, PanelExpansionContext, PanelField, PanelFieldTrigger, PanelFormLayout, PanelFormRow, PanelLabel, PanelSection, PhoneDisplay, PhoneField, PhoneInput, type PluginLiveMessage, type PluginRuntime, type PluginSession, Popover, PopoverScoped, RadioGroup, RecordList, type RecordListGroup, RecordOpenerProvider, RecordPage, type RecordRef, RecordTable, type RecordTableColumnDef, RecordTableInlineCell, RecordTimeline, type RecordTimelineProps, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, type TActivityRowProps, type TConditionField, type TConditionGroup, type TConditionLookups, type TConditionRule, type TContactContentType, type TDashboardWidgetPreview, type TListDisplay, type TListFilterField, type TListFilterProps, type TListViews, type TPanelRecordType, type TPluginListType, type TPropertyInputMeta, type TPropertyInputProps, type TRecordContacts, type TRecordDraftProps, type TRecordSection, type TRecordSectionProps, type TRecordSlotProps, type TRecordTab, type TRelationTab, type TRelationTabProps, type TViewTabsProps, TabButton, Table, Tabs, type Tag, type TagsQuery, TextField, TextOverflowTooltip, Textarea, ThemeOption, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, ViewBar, addPluginStyles, amountStep, badgeVariants, buttonVariants, cn, companyTitle, customerTitle, editorText, formatMoney, formatPhoneNumber, formatter, fromAmountInput, getPluginAssetsUrl, getPluginRuntime, isRule, isUndefinedOrNull, jsonOf, listFilterQuery, localTimeZone, memberName, oneOf, pluginFetch, pluginJson, readImage, setFileStorage, setPluginRuntime, setRecordPage, setRecordTimeline, stored, storedFamily, textOf, themeState, toAmountInput, toIsoDay, toast, useConfirm, useFieldControl, useFilterContext, useFocusFirstField, useFormat, useItemKeys, useListDisplay, useListFilterParams, useListViews, useLiveSignal, useMemberOptions, useMembersById, useMoney, useOpenRecord, usePageHotkey, usePanelExpanded, usePreviousHotkeyScope, useScopedHotkeys, useTagOptions, useToast, useUpload, zoneOffset };
133
+ export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, type AvatarProps, BackgroundGradientAnimation, Badge, type BadgeProps, Breadcrumb, Button, type ButtonProps, Calendar, type CalendarProps, Card, type ChartConfig, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, type CompanyContact, ConditionsEditor, ContactLink, type ContactQueries, type ContactSearch, type ContactSearchQueries, ContextMenu, CopyText, type CustomerContact, DASHBOARD_WIDGET_PREVIEWS, DateInput, DatePicker, Dialog, DisplayMenu, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, type FileStorageAdapter, Filter, Form, FullNameField, FullNameValue, HoverCard, type IUIConfig, IconComponent, IconPicker, IconTip, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, ListFilter, ListFilterEmpty, ListViewsProvider, LookupPicker, type Member, MemberInline, type MemberQueries, type MultiSelectOption, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PanelDescriptionEditor, PanelDescriptionField, PanelExpansionContext, PanelField, PanelFieldTrigger, PanelFormLayout, PanelFormRow, PanelLabel, PanelSection, PhoneDisplay, PhoneField, PhoneInput, type PluginLiveMessage, type PluginRuntime, type PluginSession, Popover, PopoverScoped, RadioGroup, RecordList, type RecordListGroup, RecordOpenerProvider, RecordPage, type RecordPanelControls, RecordPanelProvider, type RecordRef, RecordTable, type RecordTableColumnDef, RecordTableInlineCell, RecordTimeline, type RecordTimelineProps, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, type TConditionField, type TConditionGroup, type TConditionLookups, type TConditionRule, type TContactContentType, type TDashboardWidget, type TDashboardWidgetPreview, type TListDisplay, type TListFilterField, type TListFilterProps, type TListViews, type TPanelRecordType, type TPluginListType, type TPluginSettingsPage, type TRecordContacts, type TRecordDraftProps, type TRecordSection, type TRecordSectionProps, type TRecordSlotProps, type TRecordTab, type TRecordTableSort, type TRelationTab, type TRelationTabProps, type TViewTabsProps, TabButton, Table, Tabs, type Tag, type TagsQuery, TextField, TextOverflowTooltip, Textarea, ThemeOption, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, ViewBar, addPluginStyles, amountStep, badgeVariants, buttonVariants, cn, companyTitle, customerTitle, editorText, formatMoney, formatPhoneNumber, formatter, fromAmountInput, getPluginAssetsUrl, getPluginRuntime, isRule, isUndefinedOrNull, jsonOf, listFilterQuery, localTimeZone, memberName, oneOf, pluginFetch, pluginJson, readImage, setFileStorage, setPluginRuntime, setRecordPage, setRecordTimeline, stored, storedFamily, textOf, themeState, toAmountInput, toIsoDay, toast, useConfirm, useFieldControl, useFilterContext, useFocusFirstField, useFormat, useItemKeys, useListDisplay, useListFilterParams, useListViews, useLiveSignal, useMemberOptions, useMembersById, useMoney, useOpenRecord, usePageHotkey, usePanelExpanded, usePreviousHotkeyScope, useRecordPanel, useScopedHotkeys, useTagOptions, useToast, useUpload, zoneOffset };
package/dist/index.js CHANGED
@@ -99,7 +99,7 @@ import { RecordTable } from "./modules/record-table/components/RecordTable.js";
99
99
  import { RecordTableInlineCell } from "./modules/record-table/components/RecordTableCellInline.js";
100
100
  import { EnumCursorDirection } from "./modules/record-table/types/RecordTableCursorTypes.js";
101
101
  import { DisplayMenu, useListDisplay } from "./modules/list/DisplayMenu.js";
102
- import { ListFilter, useListFilterParams } from "./modules/list/ListFilter.js";
102
+ import { ListFilter, ListFilterEmpty, useListFilterParams } from "./modules/list/ListFilter.js";
103
103
  import { listFilterQuery } from "./modules/list/filter/listFilterQuery.js";
104
104
  import { isRule } from "./modules/conditions/conditions.js";
105
105
  import { ConditionsEditor } from "./modules/conditions/LazyConditionsEditor.js";
@@ -113,9 +113,10 @@ import { PanelSection } from "./modules/record-panel/PanelSection.js";
113
113
  import { PanelExpansionContext, usePanelExpanded } from "./modules/record-panel/panelExpansion.js";
114
114
  import { ContactLink } from "./modules/records/ContactLink.js";
115
115
  import { companyTitle, customerTitle } from "./modules/records/contacts.js";
116
- import { RecordOpenerProvider, RecordPage, setRecordPage, useOpenRecord } from "./modules/records/openRecord.js";
116
+ import { RecordOpenerProvider, RecordPage, RecordPanelProvider, setRecordPage, useOpenRecord, useRecordPanel } from "./modules/records/openRecord.js";
117
117
  import { ThemeOption, themeState } from "./state/themeState.js";
118
118
  import { SexCode } from "./types/SexCode.js";
119
+ import { DASHBOARD_WIDGET_PREVIEWS } from "./types/UIConfig.js";
119
120
  import { isUndefinedOrNull } from "./utils/IsUndefinedOrNull.js";
120
121
  import { readImage } from "./utils/core.js";
121
122
  import { setFileStorage } from "./utils/file-storage.js";
@@ -125,4 +126,4 @@ import { jsonOf } from "./utils/json.js";
125
126
  import { getPluginRuntime, pluginFetch, pluginJson, setPluginRuntime, useLiveSignal } from "./utils/plugin-runtime.js";
126
127
  import { addPluginStyles } from "./utils/plugin-styles.js";
127
128
  import { RecordTimeline, setRecordTimeline } from "./utils/record-timeline.js";
128
- export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, BackgroundGradientAnimation, Badge, Breadcrumb, Button, Calendar, Card, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, ConditionsEditor, ContactLink, ContextMenu, CopyText, DateInput, DatePicker, Dialog, DisplayMenu, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, Filter, Form, FullNameField, FullNameValue, HoverCard, IconComponent, IconPicker, IconTip, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, ListFilter, ListViewsProvider, LookupPicker, MemberInline, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PanelDescriptionEditor, PanelDescriptionField, PanelExpansionContext, PanelField, PanelFieldTrigger, PanelFormLayout, PanelFormRow, PanelLabel, PanelSection, PhoneDisplay, PhoneField, PhoneInput, Popover, PopoverScoped, RadioGroup, RecordList, RecordOpenerProvider, RecordPage, RecordTable, RecordTableInlineCell, RecordTimeline, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, TabButton, Table, Tabs, TextField, TextOverflowTooltip, Textarea, ThemeOption, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, ViewBar, addPluginStyles, amountStep, badgeVariants, buttonVariants, cn, companyTitle, customerTitle, editorText, formatMoney, formatPhoneNumber, formatter, fromAmountInput, getPluginAssetsUrl, getPluginRuntime, isRule, isUndefinedOrNull, jsonOf, listFilterQuery, localTimeZone, memberName, oneOf, pluginFetch, pluginJson, readImage, setFileStorage, setPluginRuntime, setRecordPage, setRecordTimeline, stored, storedFamily, textOf, themeState, toAmountInput, toIsoDay, toast, useConfirm, useFieldControl, useFilterContext, useFocusFirstField, useFormat, useItemKeys, useListDisplay, useListFilterParams, useListViews, useLiveSignal, useMemberOptions, useMembersById, useMoney, useOpenRecord, usePageHotkey, usePanelExpanded, usePreviousHotkeyScope, useScopedHotkeys, useTagOptions, useToast, useUpload, zoneOffset };
129
+ export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, BackgroundGradientAnimation, Badge, Breadcrumb, Button, Calendar, Card, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, ConditionsEditor, ContactLink, ContextMenu, CopyText, DASHBOARD_WIDGET_PREVIEWS, DateInput, DatePicker, Dialog, DisplayMenu, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, Filter, Form, FullNameField, FullNameValue, HoverCard, IconComponent, IconPicker, IconTip, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, ListFilter, ListFilterEmpty, ListViewsProvider, LookupPicker, MemberInline, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PanelDescriptionEditor, PanelDescriptionField, PanelExpansionContext, PanelField, PanelFieldTrigger, PanelFormLayout, PanelFormRow, PanelLabel, PanelSection, PhoneDisplay, PhoneField, PhoneInput, Popover, PopoverScoped, RadioGroup, RecordList, RecordOpenerProvider, RecordPage, RecordPanelProvider, RecordTable, RecordTableInlineCell, RecordTimeline, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, TabButton, Table, Tabs, TextField, TextOverflowTooltip, Textarea, ThemeOption, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, ViewBar, addPluginStyles, amountStep, badgeVariants, buttonVariants, cn, companyTitle, customerTitle, editorText, formatMoney, formatPhoneNumber, formatter, fromAmountInput, getPluginAssetsUrl, getPluginRuntime, isRule, isUndefinedOrNull, jsonOf, listFilterQuery, localTimeZone, memberName, oneOf, pluginFetch, pluginJson, readImage, setFileStorage, setPluginRuntime, setRecordPage, setRecordTimeline, stored, storedFamily, textOf, themeState, toAmountInput, toIsoDay, toast, useConfirm, useFieldControl, useFilterContext, useFocusFirstField, useFormat, useItemKeys, useListDisplay, useListFilterParams, useListViews, useLiveSignal, useMemberOptions, useMembersById, useMoney, useOpenRecord, usePageHotkey, usePanelExpanded, usePreviousHotkeyScope, useRecordPanel, useScopedHotkeys, useTagOptions, useToast, useUpload, zoneOffset };
@@ -1,11 +1,13 @@
1
1
  import { TConditionField, TConditionGroup, TConditionLookups } from "./conditions.js";
2
2
  /**
3
- * Conditions: rows "<field> <operator> <value>", all or any, with nested groups, on `fields`
4
- * (grouped in the picker when they have a `group`); `members` and `tags` feed their pickers.
3
+ * Conditions as rows "Where <field> <operator> <value>", joined by "and" or "or", with nested
4
+ * groups, on `fields`; `members` and `tags` feed their pickers. Fields and values pick from the
5
+ * same menus as a list's filter chips. With `customPath`, a typed path is a field too.
5
6
  */
6
- export declare const ConditionsEditor: ({ value, onChange, disabled, fields, ...lookups }: TConditionLookups & {
7
+ export declare const ConditionsEditor: ({ value, onChange, disabled, fields, customPath, ...lookups }: TConditionLookups & {
7
8
  value: TConditionGroup | undefined;
8
9
  onChange: (next: TConditionGroup | undefined) => void;
9
10
  disabled?: boolean;
10
11
  fields: TConditionField[];
12
+ customPath?: boolean;
11
13
  }) => import("react").JSX.Element;
@@ -1,139 +1,98 @@
1
1
  import { Button } from "../../components/button.js";
2
+ import { Popover } from "../../components/popover.js";
2
3
  import { Select } from "../../components/select.js";
3
4
  import { useItemKeys } from "../../hooks/use-item-keys.js";
4
- import { oneOf } from "../../lib/text.js";
5
- import { cn } from "../../lib/utils.js";
6
- import { CONDITION_OPERATORS, NO_VALUE, OPERATOR_LABELS, isRule, operatorsFor, withOperator } from "./conditions.js";
7
- import { ConditionValueInput } from "./ConditionValueInput.js";
8
- import { PathPicker } from "./PathPicker.js";
9
- import { IconBraces, IconPlus, IconX } from "@tabler/icons-react";
5
+ import { NO_VALUE, isRule } from "./conditions.js";
6
+ import { isFilterRule, ruleFor } from "./filterRule.js";
7
+ import { FieldPicker } from "./FieldPicker.js";
8
+ import { RemoveButton, RuleRow } from "./RuleRow.js";
9
+ import { IconBraces, IconPlus } from "@tabler/icons-react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
+ import { useState } from "react";
11
12
  import { useTranslation } from "react-i18next";
12
13
  // src/modules/conditions/ConditionsEditor.tsx
13
- /** Field and operator side by side, remove at the end; the value takes its own full line. */
14
- const RuleRow = ({ rule, fields, disabled, lookups, onChange, onRemove }) => {
15
- const { t } = useTranslation("automations");
16
- const field = fields.find((one) => one.path === rule.path);
17
- return /* @__PURE__ */ jsxs("div", {
18
- className: "grid grid-cols-condition items-center gap-2",
19
- children: [
20
- /* @__PURE__ */ jsx(PathPicker, {
21
- value: rule.path,
22
- fields,
23
- disabled,
24
- onChange: (path) => onChange(fields.find((one) => one.path === path)?.type === field?.type ? {
25
- ...rule,
26
- path
27
- } : {
28
- ...rule,
29
- path,
30
- value: void 0
31
- })
32
- }),
33
- /* @__PURE__ */ jsxs(Select, {
34
- value: rule.op,
35
- onValueChange: (next) => {
36
- const op = oneOf(CONDITION_OPERATORS, next);
37
- if (op) onChange(withOperator(rule, op));
38
- },
39
- disabled,
40
- children: [/* @__PURE__ */ jsx(Select.Trigger, {
41
- className: "h-8 w-full min-w-0",
42
- "aria-label": t("operator", "Operator"),
43
- children: /* @__PURE__ */ jsx(Select.Value, {})
44
- }), /* @__PURE__ */ jsx(Select.Content, { children: operatorsFor(field?.type).map((op) => /* @__PURE__ */ jsx(Select.Item, {
45
- value: op,
46
- children: t(`op.${op}`, OPERATOR_LABELS[op])
47
- }, op)) })]
48
- }),
49
- /* @__PURE__ */ jsx(Button, {
50
- size: "icon",
51
- variant: "ghost",
52
- tone: "muted",
53
- className: "size-8",
54
- disabled,
55
- onClick: onRemove,
56
- "aria-label": t("remove", "Remove"),
57
- children: /* @__PURE__ */ jsx(IconX, { className: "size-4" })
58
- }),
59
- !NO_VALUE.has(rule.op) && /* @__PURE__ */ jsx("div", {
60
- className: "col-span-2 flex min-w-0",
61
- children: /* @__PURE__ */ jsx(ConditionValueInput, {
62
- rule,
63
- field,
64
- disabled,
65
- ...lookups,
66
- onChange: (value) => onChange({
67
- ...rule,
68
- value
69
- })
70
- })
71
- })
72
- ]
14
+ /** "Where" first; the second row picks "and" or "or" for the group; the rest repeat it. */
15
+ const Conjunction = ({ index, group, disabled, onChange }) => {
16
+ const { t } = useTranslation("views", { keyPrefix: "filter" });
17
+ const word = group.match === "all" ? t("and", "And") : t("or", "Or");
18
+ if (index === 0) return /* @__PURE__ */ jsx("span", {
19
+ className: "px-2 text-sm text-muted-foreground",
20
+ children: t("where", "Where")
73
21
  });
74
- };
75
- const MatchSelect = ({ group, onChange, onRemove, disabled }) => {
76
- const { t } = useTranslation("automations");
77
- return /* @__PURE__ */ jsxs("div", {
78
- className: "flex items-center gap-2 text-sm",
79
- children: [
80
- /* @__PURE__ */ jsx("span", { children: t("match-prefix", "Match") }),
81
- /* @__PURE__ */ jsxs(Select, {
82
- value: group.match,
83
- onValueChange: (match) => onChange({
84
- ...group,
85
- match: match === "any" ? "any" : "all"
86
- }),
87
- disabled,
88
- children: [/* @__PURE__ */ jsx(Select.Trigger, {
89
- className: "h-8 w-24",
90
- "aria-label": t("match-prefix", "Match"),
91
- children: /* @__PURE__ */ jsx(Select.Value, {})
92
- }), /* @__PURE__ */ jsxs(Select.Content, { children: [/* @__PURE__ */ jsx(Select.Item, {
93
- value: "all",
94
- children: t("match-all", "all")
95
- }), /* @__PURE__ */ jsx(Select.Item, {
96
- value: "any",
97
- children: t("match-any", "any")
98
- })] })]
99
- }),
100
- /* @__PURE__ */ jsx("span", { children: t("match-suffix", "of these") }),
101
- onRemove && /* @__PURE__ */ jsx(Button, {
102
- size: "sm",
103
- variant: "ghost",
104
- className: "ml-auto",
105
- disabled,
106
- onClick: onRemove,
107
- children: /* @__PURE__ */ jsx(IconX, {})
108
- })
109
- ]
22
+ if (index > 1 || disabled) return /* @__PURE__ */ jsx("span", {
23
+ className: "px-2 text-sm text-muted-foreground",
24
+ children: word
25
+ });
26
+ return /* @__PURE__ */ jsxs(Select, {
27
+ value: group.match,
28
+ onValueChange: (match) => onChange({
29
+ ...group,
30
+ match: match === "any" ? "any" : "all"
31
+ }),
32
+ children: [/* @__PURE__ */ jsx(Select.Trigger, {
33
+ className: "h-8 w-full",
34
+ "aria-label": t("conjunction", "And or or"),
35
+ children: /* @__PURE__ */ jsx(Select.Value, { children: word })
36
+ }), /* @__PURE__ */ jsxs(Select.Content, { children: [/* @__PURE__ */ jsx(Select.Item, {
37
+ value: "all",
38
+ children: t("and", "And")
39
+ }), /* @__PURE__ */ jsx(Select.Item, {
40
+ value: "any",
41
+ children: t("or", "Or")
42
+ })] })]
110
43
  });
111
44
  };
112
- const AddButtons = ({ newRule, newGroup, disabled, onAdd }) => {
113
- const { t } = useTranslation("automations");
45
+ /** "Add filter rule" opens the field picker; "Add filter group", while groups may still nest. */
46
+ const AddButtons = ({ fields, disabled, customPath, canGroup, onAdd }) => {
47
+ const { t } = useTranslation("views", { keyPrefix: "filter" });
48
+ const [open, setOpen] = useState(false);
114
49
  return /* @__PURE__ */ jsxs("div", {
115
- className: "flex gap-2",
116
- children: [/* @__PURE__ */ jsxs(Button, {
117
- size: "sm",
118
- variant: "outline",
119
- disabled,
120
- onClick: () => onAdd(newRule),
121
- children: [/* @__PURE__ */ jsx(IconPlus, {}), t("add-condition", "Add condition")]
122
- }), newGroup && /* @__PURE__ */ jsxs(Button, {
50
+ className: "flex gap-1",
51
+ children: [/* @__PURE__ */ jsxs(Popover, {
52
+ open,
53
+ onOpenChange: setOpen,
54
+ children: [/* @__PURE__ */ jsxs(Popover.Trigger, {
55
+ render: /* @__PURE__ */ jsx(Button, {
56
+ size: "sm",
57
+ variant: "ghost",
58
+ tone: "muted",
59
+ disabled
60
+ }),
61
+ children: [/* @__PURE__ */ jsx(IconPlus, {}), t("add-rule", "Add filter rule")]
62
+ }), /* @__PURE__ */ jsx(Popover.Content, {
63
+ variant: "flush",
64
+ align: "start",
65
+ className: "w-72",
66
+ children: /* @__PURE__ */ jsx(FieldPicker, {
67
+ fields,
68
+ customPath,
69
+ onSelect: (field) => {
70
+ setOpen(false);
71
+ onAdd(ruleFor(field));
72
+ }
73
+ })
74
+ })]
75
+ }), canGroup && /* @__PURE__ */ jsxs(Button, {
123
76
  size: "sm",
124
77
  variant: "ghost",
78
+ tone: "muted",
125
79
  disabled,
126
- onClick: () => onAdd(newGroup),
127
- children: [/* @__PURE__ */ jsx(IconBraces, {}), t("add-group", "Add group")]
80
+ onClick: () => onAdd({
81
+ match: "all",
82
+ rules: []
83
+ }),
84
+ children: [/* @__PURE__ */ jsx(IconBraces, {}), t("add-group", "Add filter group")]
128
85
  })]
129
86
  });
130
87
  };
131
- /** One group: "all"/"any" of its rules and nested groups (up to three levels). */
132
- const GroupEditor = ({ group, onChange, onRemove, fields, disabled, depth, lookups }) => {
88
+ /** One group: its rows and nested groups (three levels in all), then the add buttons. */
89
+ const GroupEditor = ({ group, onChange, depth, ...shared }) => {
90
+ const { t } = useTranslation("views", { keyPrefix: "filter" });
133
91
  const keys = useItemKeys(group.rules.length);
134
- const update = (index, rule) => onChange({
92
+ const [fresh, setFresh] = useState(null);
93
+ const update = (index, node) => onChange({
135
94
  ...group,
136
- rules: group.rules.map((item, at) => at === index ? rule : item)
95
+ rules: group.rules.map((item, at) => at === index ? node : item)
137
96
  });
138
97
  const remove = (index) => {
139
98
  keys.removed(index);
@@ -142,68 +101,71 @@ const GroupEditor = ({ group, onChange, onRemove, fields, disabled, depth, looku
142
101
  rules: group.rules.filter((_, at) => at !== index)
143
102
  });
144
103
  };
145
- const add = (rule) => {
146
- keys.added();
147
- onChange({
148
- ...group,
149
- rules: [...group.rules, rule]
150
- });
151
- };
104
+ const lead = (index) => /* @__PURE__ */ jsx(Conjunction, {
105
+ index,
106
+ group,
107
+ disabled: shared.disabled,
108
+ onChange
109
+ });
152
110
  return /* @__PURE__ */ jsxs("div", {
153
- className: cn("space-y-2", depth > 0 && "rounded-md border border-dashed p-2"),
154
- children: [
155
- /* @__PURE__ */ jsx(MatchSelect, {
156
- group,
157
- onChange,
158
- onRemove,
159
- disabled
160
- }),
161
- group.rules.map((rule, index) => isRule(rule) ? /* @__PURE__ */ jsx(RuleRow, {
162
- rule,
163
- fields,
164
- disabled,
165
- lookups,
166
- onChange: (next) => update(index, next),
167
- onRemove: () => remove(index)
168
- }, keys.keyAt(index)) : /* @__PURE__ */ jsx(GroupEditor, {
169
- group: rule,
170
- fields,
171
- disabled,
172
- lookups,
173
- depth: depth + 1,
174
- onChange: (next) => update(index, next),
175
- onRemove: () => remove(index)
176
- }, keys.keyAt(index))),
177
- /* @__PURE__ */ jsx(AddButtons, {
178
- newRule: {
179
- path: fields[3]?.path ?? "subject.primaryEmail",
180
- op: "exists"
181
- },
182
- newGroup: depth < 2 ? {
183
- match: group.match === "all" ? "any" : "all",
184
- rules: []
185
- } : null,
186
- disabled,
187
- onAdd: add
188
- })
189
- ]
111
+ className: "flex flex-col gap-1.5",
112
+ children: [group.rules.map((node, index) => isFilterRule(node) ? /* @__PURE__ */ jsx(RuleRow, {
113
+ ...shared,
114
+ rule: node,
115
+ lead: lead(index),
116
+ fresh: fresh === index,
117
+ onChange: (next) => update(index, next),
118
+ onRemove: () => remove(index)
119
+ }, keys.keyAt(index)) : /* @__PURE__ */ jsxs("div", {
120
+ className: "grid grid-cols-condition items-start gap-1.5",
121
+ children: [
122
+ lead(index),
123
+ /* @__PURE__ */ jsx("div", {
124
+ className: "col-span-3 rounded-md border bg-muted/40 p-2",
125
+ children: /* @__PURE__ */ jsx(GroupEditor, {
126
+ ...shared,
127
+ group: node,
128
+ depth: depth + 1,
129
+ onChange: (next) => update(index, next)
130
+ })
131
+ }),
132
+ /* @__PURE__ */ jsx(RemoveButton, {
133
+ label: t("remove-group", "Remove group"),
134
+ disabled: shared.disabled,
135
+ onRemove: () => remove(index)
136
+ })
137
+ ]
138
+ }, keys.keyAt(index))), /* @__PURE__ */ jsx(AddButtons, {
139
+ fields: shared.fields,
140
+ disabled: shared.disabled,
141
+ customPath: shared.customPath,
142
+ canGroup: depth < 2,
143
+ onAdd: (node) => {
144
+ keys.added();
145
+ setFresh(isRule(node) && !NO_VALUE.has(node.op) ? group.rules.length : null);
146
+ onChange({
147
+ ...group,
148
+ rules: [...group.rules, node]
149
+ });
150
+ }
151
+ })]
190
152
  });
191
153
  };
192
154
  /**
193
- * Conditions: rows "<field> <operator> <value>", all or any, with nested groups, on `fields`
194
- * (grouped in the picker when they have a `group`); `members` and `tags` feed their pickers.
155
+ * Conditions as rows "Where <field> <operator> <value>", joined by "and" or "or", with nested
156
+ * groups, on `fields`; `members` and `tags` feed their pickers. Fields and values pick from the
157
+ * same menus as a list's filter chips. With `customPath`, a typed path is a field too.
195
158
  */
196
- const ConditionsEditor = ({ value, onChange, disabled, fields, ...lookups }) => {
197
- return /* @__PURE__ */ jsx(GroupEditor, {
198
- group: value ?? {
199
- match: "all",
200
- rules: []
201
- },
202
- fields,
203
- disabled,
204
- lookups,
205
- depth: 0,
206
- onChange: (next) => onChange(next.rules.length ? next : void 0)
207
- });
208
- };
159
+ const ConditionsEditor = ({ value, onChange, disabled, fields, customPath, ...lookups }) => /* @__PURE__ */ jsx(GroupEditor, {
160
+ group: value ?? {
161
+ match: "all",
162
+ rules: []
163
+ },
164
+ fields,
165
+ lookups,
166
+ disabled,
167
+ customPath,
168
+ depth: 0,
169
+ onChange: (next) => onChange(next.rules.length ? next : void 0)
170
+ });
209
171
  export { ConditionsEditor };
@@ -0,0 +1,8 @@
1
+ import { TConditionRule } from "./conditions.js";
2
+ import { ValueEditorProps } from "./ValueEditor.js";
3
+ /** "In the last 30 days": the usual spans in one pick, or any amount and unit. */
4
+ export declare const RelativeEditor: (props: Omit<ValueEditorProps, 'rule' | 'field' | 'lookups'> & {
5
+ rule: TConditionRule;
6
+ }) => import("react").JSX.Element;
7
+ /** A day (before, on, after) or a range of days, on erxes-ui's date picker. */
8
+ export declare const DayEditor: ({ rule, onChange, onDone }: ValueEditorProps) => import("react").JSX.Element;