@erxes/ui 4.0.0-v2.14 → 4.0.0-v2.16

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 (38) hide show
  1. package/CATALOG.md +15 -6
  2. package/dist/components/form-layout.d.ts +3 -1
  3. package/dist/components/form-layout.js +4 -3
  4. package/dist/components/input-group.js +1 -1
  5. package/dist/index.d.ts +5 -5
  6. package/dist/index.js +3 -2
  7. package/dist/modules/blocks/components/Editor.d.ts +1 -1
  8. package/dist/modules/blocks/components/Editor.js +5 -2
  9. package/dist/modules/blocks/hooks/useBlockEditor.d.ts +3 -0
  10. package/dist/modules/blocks/hooks/useBlockEditor.js +21 -2
  11. package/dist/modules/blocks/types/TextEditor.d.ts +3 -1
  12. package/dist/modules/conditions/ValueEditor.js +9 -4
  13. package/dist/modules/conditions/conditions.d.ts +7 -3
  14. package/dist/modules/conditions/conditions.js +8 -1
  15. package/dist/modules/conditions/fieldIcons.js +3 -1
  16. package/dist/modules/conditions/fieldOptions.d.ts +7 -5
  17. package/dist/modules/conditions/fieldOptions.js +22 -10
  18. package/dist/modules/conditions/filterRule.js +3 -1
  19. package/dist/modules/list/ListFilter.d.ts +6 -5
  20. package/dist/modules/list/ListFilter.js +3 -3
  21. package/dist/modules/list/filter/ListFilterBar.js +8 -3
  22. package/dist/modules/pickers/LookupPicker.d.ts +6 -0
  23. package/dist/modules/pickers/LookupPicker.js +32 -1
  24. package/dist/modules/record-list/RecordList.d.ts +2 -1
  25. package/dist/modules/record-list/RecordList.js +2 -1
  26. package/dist/modules/record-list/RecordListRoot.d.ts +3 -1
  27. package/dist/modules/record-list/RecordListRoot.js +53 -37
  28. package/dist/modules/record-table/components/RecordTableHead.d.ts +7 -2
  29. package/dist/modules/record-table/components/RecordTableHead.js +73 -6
  30. package/dist/modules/record-table/components/RecordTableProvider.d.ts +22 -1
  31. package/dist/modules/record-table/components/RecordTableProvider.js +12 -1
  32. package/dist/modules/records/contacts.d.ts +18 -0
  33. package/dist/modules/records/openRecord.d.ts +46 -4
  34. package/dist/modules/records/openRecord.js +28 -5
  35. package/dist/types/UIConfig.d.ts +69 -101
  36. package/dist/types/UIConfig.js +14 -0
  37. package/exports.txt +12 -3
  38. package/package.json +1 -1
package/CATALOG.md CHANGED
@@ -47,6 +47,7 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
47
47
  - `type TListFilterProps` The props of `ListFilter`: its `id`, `fields`, lookups and record count.
48
48
  - `type TListViews { Tabs, Changes }` The host's saved views for a list.
49
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.
50
51
  - `type TViewTabsProps { recordType, allLabel }` The props of the host's saved-view tabs: the list and its "All …" label.
51
52
  - `useFilterContext()` Controls of the enclosing `Filter`: open or close it and switch views.
52
53
  - `useListDisplay(list, displays)` The display a list shows, as picked in its Display menu.
@@ -60,6 +61,8 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
60
61
  - `companyTitle(company)` A company's name, else its email or phone.
61
62
  - `<ContactLink contentType contentId contacts placeholder>` A customer or company as a chip: its avatar and name.
62
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.
63
66
  - `type CustomerContact { id, firstName, middleName, lastName, primaryEmail, … }` What a customer reads as: core's `Customer` has these fields and more.
64
67
  - `customerTitle(customer)` A customer's name, else its email or phone.
65
68
  - `<PanelDescriptionEditor value scope readonly isHTML onSave>` A record's description as a full-size tab.
@@ -71,8 +74,11 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
71
74
  - `<PanelFormRow label icon required error hint>` One field of a form in the side panel, laid out like `PanelField`.
72
75
  - `<PanelLabel tooltip>` A side panel label cut at two lines, with the full text on hover.
73
76
  - `<PanelSection title icon nested>` A plain heading that groups the side panel's rows.
74
- - `<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.
75
78
  - `RecordPage` A record on its own page, as core draws a customer's.
79
+ - `type RecordPageProps { listPath }` A `RecordPage`'s record, and the list it goes back to.
80
+ - `type RecordPanelControls { record, tab, setTab, close, dismiss, … }` What a record shown in core's panel, or on its own page, can do to it.
81
+ - `RecordPanelProvider` Web gives each record it shows its controls.
76
82
  - `type RecordRef { contentType, contentId }` A record the host can open, by `contentType` and `contentId`.
77
83
  - `RecordTimeline` Core's timeline of notes, calls and events for a plugin's record.
78
84
  - `type RecordTimelineProps { type, id }` Which record `RecordTimeline` shows: its timeline type and id.
@@ -81,6 +87,7 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
81
87
  - `type TContactContentType` The customer or company types `ContactLink` shows.
82
88
  - `useOpenRecord()` Opens a record, or a new draft, in core's side panel.
83
89
  - `usePanelExpanded()` Whether the record shows at full size on its own page.
90
+ - `useRecordPanel()` The record a slot is in, and what the slot can do to it.
84
91
 
85
92
  ## Fields and pickers
86
93
 
@@ -113,7 +120,7 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
113
120
  - `type TagsQuery` TanStack query options for the tags of one record type.
114
121
  - `type TConditionField { path, label, type, options, group, … }` A field conditions can use: a record's, or an earlier step's output.
115
122
  - `type TConditionGroup { match, rules }` Rules (or nested groups) that must all, or any, hold.
116
- - `type TConditionLookups { members, tags }` Where `member` and `tags` values pick from.
123
+ - `type TConditionLookups { members, tags, contacts }` Where `member`, `tags`, `customer` and `company` values pick from.
117
124
  - `type TConditionRule { path, op, value }` One rule of a condition: a `path`, an operator and maybe a value.
118
125
  - `<TextField placeholder value scope onSave onValueChange>` A text value in a table cell or panel row that edits in a popover.
119
126
  - `useMemberOptions(members, enabled, picked)` The active team members as picker options.
@@ -196,10 +203,11 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
196
203
  ## Plugin runtime
197
204
 
198
205
  - `addPluginStyles(plugin, css)` Adds a plugin UI's compiled Tailwind to the page, minus what web has.
206
+ - `DASHBOARD_WIDGET_PREVIEWS` Every schematic the widget catalog can draw for a dashboard widget.
199
207
  - `type FileStorageAdapter { upload, remove }` Where erxes-ui's upload hooks and components send files.
200
208
  - `getPluginAssetsUrl(pluginName, url)` A file's URL in a plugin UI's deployed `assets` folder.
201
209
  - `getPluginRuntime()` The host's plugin runtime, or null outside erxes.
202
- - `type IUIConfig { name, path, icon, recordSections, recordTypes, … }` A plugin UI's `CONFIG`, exported from its `./config` remote.
210
+ - `type IUIConfig { name, path, icon, settings, recordSections, … }` A plugin UI's `CONFIG`, exported from its `./config` remote.
203
211
  - `pluginFetch(plugin, path, init)` `fetch` against a plugin's API as the signed-in member.
204
212
  - `pluginJson(plugin, path, schema, init)` JSON in, JSON out, checked against `schema`.
205
213
  - `type PluginLiveMessage` A message on core's live stream: a plugin's changed topics, or resync.
@@ -207,13 +215,14 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
207
215
  - `type PluginSession { token, expiresAt, apiUrl }` A member's short-lived token for one plugin's API, and its address.
208
216
  - `setFileStorage(next)` Sets where uploads go; web calls it at startup and plugins don't.
209
217
  - `setPluginRuntime(next)` Sets the plugin runtime; web calls it at startup and plugins don't.
210
- - `type TActivityRowProps { activity }` Props of a plugin's activity row component in `widgets.activityRows`.
218
+ - `type TDashboardWidget { name, title, description, icon, preview, … }` A plugin's tile for core's home dashboard.
211
219
  - `type TDashboardWidgetPreview` The schematic a dashboard widget shows in the widget catalog.
212
220
  - `type TPanelRecordType { contentType, title, icon, detailPath, Title, … }` A record type a plugin shows in core's side panel.
213
- - `type TPropertyInputMeta` A property input's own settings, stored with the custom field.
214
- - `type TPropertyInputProps { value, onValueChange, meta, onMetaChange, disabled }` Props of a custom property input in `widgets.propertyInputs`.
221
+ - `type TPluginSettingsPage { path, label, icon }` A plugin's settings page, linked from core's settings sidebar.
222
+ - `type TPropertyValue` A custom field's value: text, number, date, yes/no or options.
215
223
  - `type TRecordContacts { customerIds, companyIds }` The customers and companies a record is about.
216
224
  - `type TRecordDraftProps { defaults, onCreated, onCancel }` Props of a plugin record type's `New` slot, the draft form.
225
+ - `type TRecordProperties { type, values, save }` Custom fields on a plugin record type, whose values the plugin keeps.
217
226
  - `type TRecordSection { contentType, title, icon, component }` A plugin's section on a customer's or company's detail in core's panel.
218
227
  - `type TRecordSectionProps { contentType, contentId }` What a record section is given: the customer or company it shows on.
219
228
  - `type TRecordSlotProps` What each slot of a plugin record is given: the record.
@@ -1,10 +1,12 @@
1
1
  import { ReactNode } from "react";
2
2
  /** A card of a settings page or a record's own page: a title, a line about it, then its fields. */
3
- export declare const FormSection: ({ title, description, action, children }: {
3
+ export declare const FormSection: ({ title, description, action, variant, children }: {
4
4
  title: ReactNode;
5
5
  description?: ReactNode;
6
6
  /** A control beside the title, such as a status badge. */
7
7
  action?: ReactNode;
8
+ /** `destructive`: a red card for what can't be undone, such as deleting a team. */
9
+ variant?: 'default' | 'destructive';
8
10
  children: ReactNode;
9
11
  }) => import("react").JSX.Element;
10
12
  /**
@@ -1,3 +1,4 @@
1
+ import { cn } from "../lib/utils.js";
1
2
  import { Button } from "./button.js";
2
3
  import { Spinner } from "./spinner.js";
3
4
  import { IconDeviceFloppy } from "@tabler/icons-react";
@@ -6,14 +7,14 @@ import { useTranslation } from "react-i18next";
6
7
  import { useFormContext, useFormState } from "react-hook-form";
7
8
  // src/components/form-layout.tsx
8
9
  /** A card of a settings page or a record's own page: a title, a line about it, then its fields. */
9
- const FormSection = ({ title, description, action, children }) => /* @__PURE__ */ jsxs("section", {
10
- className: "space-y-4 rounded-lg border bg-background p-5",
10
+ const FormSection = ({ title, description, action, variant = "default", children }) => /* @__PURE__ */ jsxs("section", {
11
+ className: cn("space-y-4 rounded-lg border bg-background p-5", variant === "destructive" && "border-destructive/40"),
11
12
  children: [/* @__PURE__ */ jsxs("div", {
12
13
  className: "flex items-start justify-between gap-4",
13
14
  children: [/* @__PURE__ */ jsxs("div", {
14
15
  className: "min-w-0 space-y-0.5",
15
16
  children: [/* @__PURE__ */ jsx("h2", {
16
- className: "text-base font-semibold",
17
+ className: cn("text-base font-semibold", variant === "destructive" && "text-(--destructive-text)"),
17
18
  children: title
18
19
  }), description && /* @__PURE__ */ jsx("p", {
19
20
  className: "text-sm text-muted-foreground",
@@ -9,7 +9,7 @@ const InputGroupRoot = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
9
9
  className: cn("group/input-group relative flex h-7 w-full min-w-0 items-center rounded-sm bg-background shadow-xs transition has-[>textarea]:h-auto has-[>:is(input,textarea):focus-visible]:shadow-focus has-[>:is(input,textarea):disabled]:opacity-50", "has-[>[data-align=start]]:[&>:is(input,textarea)]:pl-1.5 has-[>[data-align=end]]:[&>:is(input,textarea)]:pr-1.5", className),
10
10
  ...props
11
11
  });
12
- const addonVariants = cva("flex h-full shrink-0 items-center text-muted-foreground group-has-[>textarea]/input-group:h-auto group-has-[>textarea]/input-group:self-start group-has-[>textarea]/input-group:pt-1.5", {
12
+ const addonVariants = cva("flex h-full shrink-0 items-center text-sm text-muted-foreground group-has-[>textarea]/input-group:h-auto group-has-[>textarea]/input-group:self-start group-has-[>textarea]/input-group:pt-1.5", {
13
13
  variants: { align: {
14
14
  start: "order-first pl-2.5",
15
15
  end: "order-last pr-1.5"
package/dist/index.d.ts CHANGED
@@ -99,7 +99,7 @@ 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";
@@ -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, RecordPageProps, 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, TPropertyValue, TRecordContacts, TRecordDraftProps, TRecordProperties, 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, 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 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 RecordPageProps, 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 TPropertyValue, type TRecordContacts, type TRecordDraftProps, type TRecordProperties, 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
@@ -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, 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, 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,2 +1,2 @@
1
1
  import { BlockEditorProps, IEditorProps } from "../types/TextEditor.js";
2
- export declare const Editor: ({ onChange, initialContent, scope, className, isHTML, uploadFile, label, variant, ...props }: Omit<BlockEditorProps, 'editor' | 'onChange'> & IEditorProps) => import("react").JSX.Element;
2
+ export declare const Editor: ({ onChange, initialContent, scope, className, isHTML, uploadFile, label, placeholder, variant, ...props }: Omit<BlockEditorProps, 'editor' | 'onChange'> & IEditorProps) => import("react").JSX.Element;
@@ -1,15 +1,18 @@
1
1
  import { useBlockEditor } from "../hooks/useBlockEditor.js";
2
2
  import { useEditorValue } from "../hooks/useEditorValue.js";
3
3
  import { BlockEditor } from "./BlockEditor.js";
4
+ import { useFieldControl } from "../../../components/field-control.js";
4
5
  import { cn } from "../../../lib/utils.js";
5
6
  import { parseBlocks } from "../utils/parseBlocks.js";
6
7
  import { jsx } from "react/jsx-runtime";
7
8
  // src/modules/blocks/components/Editor.tsx
8
- const Editor = ({ onChange, initialContent, scope, className, isHTML = false, uploadFile, label, variant = "outline", ...props }) => {
9
+ const Editor = ({ onChange, initialContent, scope, className, isHTML = false, uploadFile, label, placeholder, variant = "outline", ...props }) => {
9
10
  const editor = useBlockEditor({
10
11
  initialContent: parseBlocks(initialContent ?? "") || void 0,
11
12
  uploadFile,
12
- label
13
+ label,
14
+ placeholder,
15
+ field: useFieldControl()
13
16
  });
14
17
  const handleChange = useEditorValue({
15
18
  editor,
@@ -1,3 +1,4 @@
1
+ import { FieldControlProps } from "../../../components/field-control.js";
1
2
  import { IBlockEditor } from "../types/TextEditor.js";
2
3
  import { Block } from "@blocknote/core";
3
4
  export declare const useBlockEditor: (args?: {
@@ -6,4 +7,6 @@ export declare const useBlockEditor: (args?: {
6
7
  /** What screen readers call the editor; the placeholder when not given. */
7
8
  label?: string;
8
9
  uploadFile?: (file: File) => Promise<string>;
10
+ /** The form row it's in (`useFieldControl()`): its label names the editor. */
11
+ field?: FieldControlProps;
9
12
  }) => IBlockEditor;
@@ -7,7 +7,7 @@ import { useEffect } from "react";
7
7
  import { useCreateBlockNote } from "@blocknote/react";
8
8
  // src/modules/blocks/hooks/useBlockEditor.tsx
9
9
  const useBlockEditor = (args) => {
10
- const { initialContent, placeholder, label, uploadFile } = args ?? {};
10
+ const { initialContent, placeholder, label, uploadFile, field = {} } = args ?? {};
11
11
  const { toast } = useToast();
12
12
  const defaultUploadFile = async (file) => {
13
13
  try {
@@ -29,12 +29,31 @@ const useBlockEditor = (args) => {
29
29
  domAttributes: { editor: {
30
30
  role: "textbox",
31
31
  "aria-multiline": "true",
32
- "aria-label": label || defaultPlaceholder
32
+ ...field["aria-labelledby"] && !label ? { "aria-labelledby": field["aria-labelledby"] } : { "aria-label": label || defaultPlaceholder }
33
33
  } },
34
34
  uploadFile: uploadFile ?? defaultUploadFile,
35
35
  resolveFileUrl: (url) => Promise.resolve(readImage(url)),
36
36
  initialContent
37
37
  });
38
+ const describedBy = field["aria-describedby"];
39
+ const invalid = field["aria-invalid"];
40
+ const required = field["aria-required"];
41
+ useEffect(() => {
42
+ const element = editor.domElement;
43
+ if (!element) return;
44
+ const state = {
45
+ "aria-describedby": describedBy,
46
+ "aria-invalid": invalid ? "true" : void 0,
47
+ "aria-required": required ? "true" : void 0
48
+ };
49
+ for (const [name, value] of Object.entries(state)) if (value) element.setAttribute(name, value);
50
+ else element.removeAttribute(name);
51
+ }, [
52
+ editor,
53
+ describedBy,
54
+ invalid,
55
+ required
56
+ ]);
38
57
  useEffect(() => {
39
58
  const exportHTML = editor.blocksToHTMLLossy.bind(editor);
40
59
  editor.blocksToHTMLLossy = (blocks) => removeCodeFormattingFromHTML(exportHTML(blocks));
@@ -23,8 +23,10 @@ export interface IEditorProps {
23
23
  initialContent?: string;
24
24
  scope?: string;
25
25
  isHTML?: boolean;
26
- /** What screen readers call the editor. */
26
+ /** What screen readers call the editor; in a `PanelFormRow`, its label does. */
27
27
  label?: string;
28
+ /** Shown while it's empty, e.g. "Leave a comment…"; "Type '/' for commands..." without it. */
29
+ placeholder?: string;
28
30
  uploadFile?: (file: File) => Promise<string>;
29
31
  }
30
32
  export type IBlockEditor = typeof BLOCK_SCHEMA.BlockNoteEditor;
@@ -3,20 +3,24 @@ import { Command } from "../../components/command.js";
3
3
  import { amountStep, fromAmountInput, toAmountInput } from "../../lib/money.js";
4
4
  import { textOf } from "../../lib/text.js";
5
5
  import { EntityPicker } from "../pickers/EntityPicker.js";
6
- import { LIST_VALUE, NO_VALUE, RELATIVE, isRule } from "./conditions.js";
6
+ import { LIST_VALUE, LOOKUP_TYPES, NO_VALUE, RELATIVE, isRule } from "./conditions.js";
7
7
  import { between, valuesBetween } from "./filterRule.js";
8
8
  import { DayEditor, RelativeEditor } from "./DateEditors.js";
9
9
  import { useFieldOptions } from "./fieldOptions.js";
10
10
  import { valuesOf } from "./filterText.js";
11
11
  import { TypedInput } from "./TypedInput.js";
12
12
  import { jsx, jsxs } from "react/jsx-runtime";
13
+ import { useState } from "react";
13
14
  import { useTranslation } from "react-i18next";
15
+ import { useDebouncedCallback } from "use-debounce";
14
16
  // src/modules/conditions/ValueEditor.tsx
15
17
  /** Options (a choice, members, tags) by their labels: "is any of" picks several, others one. */
16
18
  const OptionsEditor = ({ rule, field, lookups, onChange, onDone }) => {
17
19
  const picked = valuesOf(rule);
18
- const { options, loading, error } = useFieldOptions(field, lookups, picked);
20
+ const [search, setSearch] = useState("");
21
+ const { options, loading, error, searched } = useFieldOptions(field, lookups, picked, search);
19
22
  const multiple = LIST_VALUE.has(rule.op);
23
+ const onSearchChange = useDebouncedCallback(setSearch, 250);
20
24
  return /* @__PURE__ */ jsx(EntityPicker, {
21
25
  multiple,
22
26
  items: options,
@@ -34,6 +38,7 @@ const OptionsEditor = ({ rule, field, lookups, onChange, onDone }) => {
34
38
  },
35
39
  loading,
36
40
  error,
41
+ onSearchChange: searched ? onSearchChange : void 0,
37
42
  searchPlaceholder: field?.label
38
43
  });
39
44
  };
@@ -137,7 +142,7 @@ const isTypedValue = (rule, field) => {
137
142
  if (!isRule(rule)) return field?.type !== "date";
138
143
  if (NO_VALUE.has(rule.op) || RELATIVE.has(rule.op)) return false;
139
144
  const type = field?.type;
140
- if (type === "date" || type === "boolean" || type === "member" || type === "tags") return false;
145
+ if (type === "date" || type === "boolean" || LOOKUP_TYPES.has(type ?? "")) return false;
141
146
  return !field?.options?.length;
142
147
  };
143
148
  /**
@@ -158,7 +163,7 @@ const ValueEditor = (props) => {
158
163
  if (type === "date") return /* @__PURE__ */ jsx(DayEditor, { ...props });
159
164
  if (type === "number") return /* @__PURE__ */ jsx(NumberEditor, { ...props });
160
165
  if (type === "boolean") return /* @__PURE__ */ jsx(BooleanEditor, { ...ruleProps });
161
- if (type === "member" || type === "tags" || field?.options?.length) return /* @__PURE__ */ jsx(OptionsEditor, { ...ruleProps });
166
+ if (LOOKUP_TYPES.has(type ?? "") || field?.options?.length) return /* @__PURE__ */ jsx(OptionsEditor, { ...ruleProps });
162
167
  return /* @__PURE__ */ jsx(TextEditor, { ...ruleProps });
163
168
  };
164
169
  export { ValueEditor, isTypedValue };
@@ -1,5 +1,6 @@
1
1
  import { TagsQuery } from "../pickers/LookupPicker.js";
2
2
  import { MemberQueries } from "../pickers/members.js";
3
+ import { ContactSearchQueries } from "../records/contacts.js";
3
4
  import { ElementType } from "react";
4
5
  import { z } from "zod";
5
6
  export declare const CONDITION_OPERATORS: readonly ['eq', 'neq', 'gt', 'gte', 'lt', 'lte', 'contains', 'not_contains', 'starts_with', 'in', 'not_in', 'exists', 'not_exists', 'within_last', 'more_than_ago', 'within_next', 'anniversary_within'];
@@ -57,14 +58,17 @@ export type TConditionField = {
57
58
  currency?: string;
58
59
  };
59
60
  /**
60
- * Where `member` and `tags` values pick from. In erxes: `memberQueries` from
61
- * `@erxes/core-contract/client`, and web's tags query for the record type. Without one, the
62
- * picker has nothing to offer.
61
+ * Where `member`, `tags`, `customer` and `company` values pick from. In erxes: `memberQueries`
62
+ * and `contactSearchQueries` from `@erxes/core-contract/client`, and web's tags query for the
63
+ * record type. Without one, the picker has nothing to offer.
63
64
  */
64
65
  export type TConditionLookups = {
65
66
  members?: MemberQueries;
66
67
  tags?: TagsQuery;
68
+ contacts?: ContactSearchQueries;
67
69
  };
70
+ /** Field types whose values are ids picked from a lookup, not typed. */
71
+ export declare const LOOKUP_TYPES: Set<string>;
68
72
  export declare const NO_VALUE: Set<string>;
69
73
  export declare const RELATIVE: Set<string>;
70
74
  export declare const LIST_VALUE: Set<string>;
@@ -49,6 +49,13 @@ const RelativeAmount = z.object({
49
49
  amount: z.int().min(0).max(MAX_AMOUNT),
50
50
  unit: z.enum(RELATIVE_UNITS).default("days")
51
51
  });
52
+ /** Field types whose values are ids picked from a lookup, not typed. */
53
+ const LOOKUP_TYPES = /* @__PURE__ */ new Set([
54
+ "member",
55
+ "tags",
56
+ "customer",
57
+ "company"
58
+ ]);
52
59
  const NO_VALUE = /* @__PURE__ */ new Set(["exists", "not_exists"]);
53
60
  const RELATIVE = /* @__PURE__ */ new Set([
54
61
  "within_last",
@@ -59,4 +66,4 @@ const RELATIVE = /* @__PURE__ */ new Set([
59
66
  const LIST_VALUE = /* @__PURE__ */ new Set(["in", "not_in"]);
60
67
  /** Whether a condition entry is a rule rather than a nested group. */
61
68
  const isRule = (rule) => !("match" in rule);
62
- export { CONDITION_OPERATORS, ConditionGroup, LIST_VALUE, NO_VALUE, RELATIVE, RELATIVE_UNITS, RelativeAmount, isRule };
69
+ export { CONDITION_OPERATORS, ConditionGroup, LIST_VALUE, LOOKUP_TYPES, NO_VALUE, RELATIVE, RELATIVE_UNITS, RelativeAmount, isRule };
@@ -1,4 +1,4 @@
1
- import { IconCalendar, IconHash, IconLetterCase, IconList, IconSelector, IconTags, IconToggleLeft, IconUser } from "@tabler/icons-react";
1
+ import { IconBuilding, IconCalendar, IconHash, IconLetterCase, IconList, IconSelector, IconTags, IconToggleLeft, IconUser, IconUserCircle } from "@tabler/icons-react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  // src/modules/conditions/fieldIcons.tsx
4
4
  const FIELD_ICONS = {
@@ -9,6 +9,8 @@ const FIELD_ICONS = {
9
9
  select: IconSelector,
10
10
  member: IconUser,
11
11
  tags: IconTags,
12
+ customer: IconUserCircle,
13
+ company: IconBuilding,
12
14
  list: IconList
13
15
  };
14
16
  /** A field's icon in the pickers and on its chips: its own, else its type's. */
@@ -1,13 +1,15 @@
1
1
  import { TConditionField, TConditionLookups } from "./conditions.js";
2
2
  /**
3
- * What a choice field picks from, with labels: its `options`, the team ("Me" first), or the
4
- * record type's tags. `picked` are the ids a rule holds, so a member who left still has a name.
3
+ * What a choice field picks from, with labels: its `options`, the team ("Me" first), the
4
+ * record type's tags, or customers or companies matching `search` (`searched`: the server
5
+ * searches). `picked` are the ids a rule holds, so a member who left still has a name.
5
6
  */
6
- export declare const useFieldOptions: (field: TConditionField | undefined, lookups: TConditionLookups, picked?: readonly string[]) => {
7
+ export declare const useFieldOptions: (field: TConditionField | undefined, lookups: TConditionLookups, picked?: readonly string[], search?: string) => {
8
+ loading: boolean;
9
+ error: Error | null;
7
10
  options: {
8
11
  value: string;
9
12
  label: string;
10
13
  }[];
11
- loading: boolean;
12
- error: Error | null;
14
+ searched: boolean;
13
15
  };
@@ -1,26 +1,38 @@
1
- import { useMemberOptions, useTagOptions } from "../pickers/LookupPicker.js";
1
+ import { useContactOptions, useMemberOptions, useTagOptions } from "../pickers/LookupPicker.js";
2
2
  import { useTranslation } from "react-i18next";
3
3
  // src/modules/conditions/fieldOptions.ts
4
4
  /**
5
- * What a choice field picks from, with labels: its `options`, the team ("Me" first), or the
6
- * record type's tags. `picked` are the ids a rule holds, so a member who left still has a name.
5
+ * What a choice field picks from, with labels: its `options`, the team ("Me" first), the
6
+ * record type's tags, or customers or companies matching `search` (`searched`: the server
7
+ * searches). `picked` are the ids a rule holds, so a member who left still has a name.
7
8
  */
8
- const useFieldOptions = (field, lookups, picked = []) => {
9
+ const useFieldOptions = (field, lookups, picked = [], search = "") => {
9
10
  const { t } = useTranslation("views", { keyPrefix: "filter" });
10
- const members = useMemberOptions(lookups.members, field?.type === "member", picked);
11
- const tags = useTagOptions(lookups.tags, field?.type === "tags");
12
- if (field?.type === "member") return {
11
+ const type = field?.type;
12
+ const members = useMemberOptions(lookups.members, type === "member", picked);
13
+ const tags = useTagOptions(lookups.tags, type === "tags");
14
+ const contacts = useContactOptions(lookups.contacts, type === "customer" || type === "company" ? type : null, picked, search);
15
+ if (type === "member") return {
13
16
  ...members,
14
17
  options: [{
15
18
  value: "me",
16
19
  label: t("me", "Me")
17
- }, ...members.options]
20
+ }, ...members.options],
21
+ searched: false
22
+ };
23
+ if (type === "tags") return {
24
+ ...tags,
25
+ searched: false
26
+ };
27
+ if (type === "customer" || type === "company") return {
28
+ ...contacts,
29
+ searched: true
18
30
  };
19
- if (field?.type === "tags") return tags;
20
31
  return {
21
32
  options: field?.options ?? [],
22
33
  loading: false,
23
- error: null
34
+ error: null,
35
+ searched: false
24
36
  };
25
37
  };
26
38
  export { useFieldOptions };
@@ -48,7 +48,9 @@ const operatorsFor = (type) => {
48
48
  ];
49
49
  case "select":
50
50
  case "member":
51
- case "tags": return [
51
+ case "tags":
52
+ case "customer":
53
+ case "company": return [
52
54
  "in",
53
55
  "not_in",
54
56
  "exists",
@@ -11,9 +11,10 @@ export type TListFilterField = {
11
11
  label: string;
12
12
  /**
13
13
  * How it compares: contains (text), ranges (number), relative dates, yes/no, a pick from
14
- * `options`, a team member (from `members`), a tag (from `tags`).
14
+ * `options`, a team member (from `members`), a tag (from `tags`), a customer or company
15
+ * (searched in `contacts`). The rule's value is the picked ids.
15
16
  */
16
- type: 'text' | 'number' | 'date' | 'boolean' | 'select' | 'member' | 'tags';
17
+ type: 'text' | 'number' | 'date' | 'boolean' | 'select' | 'member' | 'tags' | 'customer' | 'company';
17
18
  /** A `select`'s choices. */
18
19
  options?: {
19
20
  value: string;
@@ -56,9 +57,9 @@ export type TListFilterProps = TConditionLookups & {
56
57
  * "Where / And / Or" rows. Each chip is one condition whose field, operator and value open in
57
58
  * place. The conditions and search live in the address (shared links and reloads keep them);
58
59
  * `useListFilterParams()` reads them for the list's query. `member` fields pick
59
- * from `members` and `tags` fields from `tags`: in erxes `memberQueries` from
60
- * `@erxes/core-contract/client` and the tags query of the record type; outside erxes, the
61
- * plugin's own.
60
+ * from `members`, `tags` fields from `tags`, `customer` and `company` fields from `contacts`: in
61
+ * erxes `memberQueries` and `contactSearchQueries` from `@erxes/core-contract/client` and the
62
+ * tags query of the record type; outside erxes, the plugin's own.
62
63
  */
63
64
  export declare const ListFilter: ({ recordType, ...props }: TListFilterProps) => import("react").JSX.Element;
64
65
  /**
@@ -19,9 +19,9 @@ const ListFilterBar = lazy(async () => ({ default: (await import("./filter/ListF
19
19
  * "Where / And / Or" rows. Each chip is one condition whose field, operator and value open in
20
20
  * place. The conditions and search live in the address (shared links and reloads keep them);
21
21
  * `useListFilterParams()` reads them for the list's query. `member` fields pick
22
- * from `members` and `tags` fields from `tags`: in erxes `memberQueries` from
23
- * `@erxes/core-contract/client` and the tags query of the record type; outside erxes, the
24
- * plugin's own.
22
+ * from `members`, `tags` fields from `tags`, `customer` and `company` fields from `contacts`: in
23
+ * erxes `memberQueries` and `contactSearchQueries` from `@erxes/core-contract/client` and the
24
+ * tags query of the record type; outside erxes, the plugin's own.
25
25
  */
26
26
  const ListFilter = ({ recordType, ...props }) => {
27
27
  const [barRef] = useAutoAnimate({ duration: 150 });
@@ -91,14 +91,19 @@ const FilterRow = ({ status }) => {
91
91
  });
92
92
  };
93
93
  /** The filter's shared state: the conditions from the address, the open pickers. */
94
- const useListFilterState = ({ fields, members, tags, totalCount, totalCapped, loading, error }) => {
94
+ const useListFilterState = ({ fields, members, tags, contacts, totalCount, totalCapped, loading, error }) => {
95
95
  const { advanced, setAdvanced } = useListConditions();
96
96
  const [adding, setAdding] = useState(null);
97
97
  const [advancedOpen, setAdvancedOpen] = useState(false);
98
98
  const lookups = useMemo(() => ({
99
99
  members,
100
- tags
101
- }), [members, tags]);
100
+ tags,
101
+ contacts
102
+ }), [
103
+ members,
104
+ tags,
105
+ contacts
106
+ ]);
102
107
  const parts = useMemo(() => partsOf(advanced), [advanced]);
103
108
  return {
104
109
  fields,
@@ -1,3 +1,4 @@
1
+ import { ContactSearchQueries } from "../records/contacts.js";
1
2
  import { MemberQueries } from "./members.js";
2
3
  import { UseQueryOptions } from "@tanstack/react-query";
3
4
  /** A tag as the pickers show one: core's `Tag` has these fields and more. */
@@ -36,6 +37,11 @@ export declare const useMemberOptions: (members: MemberQueries | undefined, enab
36
37
  label: string;
37
38
  }[];
38
39
  };
40
+ /**
41
+ * Customers or companies matching `search` as picker options, the `picked` ones first so their
42
+ * names show whatever is searched; none without `contacts` or a `type`.
43
+ */
44
+ export declare const useContactOptions: (contacts: ContactSearchQueries | undefined, type: 'customer' | 'company' | null, picked?: readonly string[], search?: string) => LookupOptions;
39
45
  /** A record type's tags as picker options; none without `tags`. */
40
46
  export declare const useTagOptions: (tags: TagsQuery | undefined, enabled?: boolean) => LookupOptions;
41
47
  /** A button that picks members or tags, one or several with `multiple`. */