@erxes/ui 4.0.0-v2.1 → 4.0.0-v2.11

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 (318) hide show
  1. package/AGENTS.md +58 -0
  2. package/CATALOG.md +251 -0
  3. package/README.md +25 -2
  4. package/dist/components/accordion.d.ts +1 -0
  5. package/dist/components/accordion.js +1 -0
  6. package/dist/components/alert-dialog.d.ts +4 -0
  7. package/dist/components/alert-dialog.js +4 -0
  8. package/dist/components/alert.d.ts +1 -0
  9. package/dist/components/alert.js +1 -0
  10. package/dist/components/avatar.d.ts +2 -0
  11. package/dist/components/avatar.js +1 -0
  12. package/dist/components/background-gradient-animation.d.ts +4 -1
  13. package/dist/components/background-gradient-animation.js +4 -1
  14. package/dist/components/badge.d.ts +3 -0
  15. package/dist/components/badge.js +2 -0
  16. package/dist/components/breadcrumb.d.ts +1 -0
  17. package/dist/components/breadcrumb.js +1 -0
  18. package/dist/components/button.d.ts +6 -1
  19. package/dist/components/button.js +5 -1
  20. package/dist/components/calendar.d.ts +5 -0
  21. package/dist/components/calendar.js +4 -0
  22. package/dist/components/card.d.ts +1 -0
  23. package/dist/components/card.js +1 -0
  24. package/dist/components/chart-config.d.ts +4 -1
  25. package/dist/components/charts.d.ts +6 -0
  26. package/dist/components/charts.js +12 -3
  27. package/dist/components/checkbox.d.ts +1 -0
  28. package/dist/components/checkbox.js +1 -0
  29. package/dist/components/choicebox-group.d.ts +1 -0
  30. package/dist/components/choicebox-group.js +1 -0
  31. package/dist/components/collapsible.d.ts +1 -0
  32. package/dist/components/collapsible.js +1 -0
  33. package/dist/components/color-picker.d.ts +1 -0
  34. package/dist/components/color-picker.js +13 -6
  35. package/dist/components/combobox.d.ts +6 -1
  36. package/dist/components/combobox.js +9 -1
  37. package/dist/components/command-bar.d.ts +4 -0
  38. package/dist/components/command-bar.js +4 -0
  39. package/dist/components/command.d.ts +4 -0
  40. package/dist/components/command.js +4 -0
  41. package/dist/components/context-menu.d.ts +1 -0
  42. package/dist/components/context-menu.js +1 -0
  43. package/dist/components/copy-text.d.ts +1 -0
  44. package/dist/components/copy-text.js +1 -0
  45. package/dist/components/date-picker-value.d.ts +5 -9
  46. package/dist/components/date-picker-value.js +15 -34
  47. package/dist/components/date-picker.d.ts +4 -4
  48. package/dist/components/date-picker.js +9 -7
  49. package/dist/components/date-text-input.d.ts +2 -4
  50. package/dist/components/date-text-input.js +11 -9
  51. package/dist/components/dialog.d.ts +4 -0
  52. package/dist/components/dialog.js +5 -1
  53. package/dist/components/drag-handle.d.ts +1 -0
  54. package/dist/components/drag-handle.js +1 -0
  55. package/dist/components/dropdown-menu.d.ts +1 -0
  56. package/dist/components/dropdown-menu.js +1 -0
  57. package/dist/components/empty.d.ts +6 -1
  58. package/dist/components/empty.js +25 -2
  59. package/dist/components/form.d.ts +6 -2
  60. package/dist/components/form.js +8 -2
  61. package/dist/components/hover-card.d.ts +1 -0
  62. package/dist/components/hover-card.js +1 -0
  63. package/dist/components/icon-tip.d.ts +7 -0
  64. package/dist/components/icon-tip.js +16 -0
  65. package/dist/components/info-card.d.ts +4 -0
  66. package/dist/components/info-card.js +4 -0
  67. package/dist/components/input-group.d.ts +5 -4
  68. package/dist/components/input-group.js +5 -4
  69. package/dist/components/input.d.ts +1 -0
  70. package/dist/components/input.js +1 -0
  71. package/dist/components/kbd.d.ts +2 -1
  72. package/dist/components/kbd.js +2 -1
  73. package/dist/components/label.d.ts +1 -1
  74. package/dist/components/label.js +1 -1
  75. package/dist/components/multiselect.d.ts +1 -0
  76. package/dist/components/multiselect.js +3 -2
  77. package/dist/components/on-demand.d.ts +6 -0
  78. package/dist/components/on-demand.js +6 -0
  79. package/dist/components/popover.d.ts +4 -0
  80. package/dist/components/popover.js +4 -0
  81. package/dist/components/radio-group.d.ts +1 -0
  82. package/dist/components/radio-group.js +1 -0
  83. package/dist/components/scroll-area.d.ts +1 -0
  84. package/dist/components/scroll-area.js +1 -0
  85. package/dist/components/select.d.ts +5 -1
  86. package/dist/components/select.js +7 -1
  87. package/dist/components/separator.d.ts +4 -0
  88. package/dist/components/separator.js +4 -0
  89. package/dist/components/sheet.d.ts +4 -0
  90. package/dist/components/sheet.js +8 -4
  91. package/dist/components/sidebar/panel.js +29 -7
  92. package/dist/components/sidebar.d.ts +1 -0
  93. package/dist/components/sidebar.js +1 -0
  94. package/dist/components/skeleton.d.ts +1 -0
  95. package/dist/components/skeleton.js +1 -0
  96. package/dist/components/spinner.d.ts +1 -0
  97. package/dist/components/spinner.js +1 -0
  98. package/dist/components/string-array.js +1 -0
  99. package/dist/components/switch.d.ts +1 -0
  100. package/dist/components/switch.js +1 -0
  101. package/dist/components/table.d.ts +4 -0
  102. package/dist/components/table.js +4 -0
  103. package/dist/components/tabs.d.ts +8 -1
  104. package/dist/components/tabs.js +8 -1
  105. package/dist/components/text-overflow.d.ts +4 -1
  106. package/dist/components/text-overflow.js +4 -1
  107. package/dist/components/textarea.d.ts +1 -0
  108. package/dist/components/textarea.js +1 -0
  109. package/dist/components/toaster.d.ts +4 -1
  110. package/dist/components/toaster.js +5 -2
  111. package/dist/components/toggle-group.d.ts +5 -0
  112. package/dist/components/toggle-group.js +19 -11
  113. package/dist/components/toggle.d.ts +1 -0
  114. package/dist/components/toggle.js +1 -0
  115. package/dist/components/tooltip.d.ts +4 -0
  116. package/dist/components/tooltip.js +4 -0
  117. package/dist/components/upload.d.ts +4 -0
  118. package/dist/components/upload.js +20 -11
  119. package/dist/federation.d.ts +8 -1
  120. package/dist/federation.js +12 -2
  121. package/dist/hooks/use-item-keys.d.ts +11 -0
  122. package/dist/hooks/use-item-keys.js +24 -0
  123. package/dist/hooks/use-page-hotkey.d.ts +12 -0
  124. package/dist/hooks/use-page-hotkey.js +22 -0
  125. package/dist/hooks/use-toast.d.ts +5 -0
  126. package/dist/hooks/use-toast.js +5 -0
  127. package/dist/index.d.ts +33 -6
  128. package/dist/index.js +31 -4
  129. package/dist/lib/format.d.ts +60 -0
  130. package/dist/lib/format.js +86 -0
  131. package/dist/lib/money.d.ts +13 -0
  132. package/dist/lib/money.js +21 -0
  133. package/dist/lib/stored.d.ts +13 -0
  134. package/dist/lib/stored.js +41 -0
  135. package/dist/lib/text.d.ts +11 -0
  136. package/dist/lib/text.js +18 -0
  137. package/dist/modules/attachments/use-carousel.js +5 -10
  138. package/dist/modules/blocks/hooks/useBarcodeSizeForm.d.ts +1 -1
  139. package/dist/modules/blocks/utils/parseBlocks.d.ts +1 -1
  140. package/dist/modules/blocks/utils/parseBlocks.js +1 -1
  141. package/dist/modules/conditions/ConditionValueInput.d.ts +10 -0
  142. package/dist/modules/conditions/ConditionValueInput.js +166 -0
  143. package/dist/modules/conditions/ConditionsEditor.d.ts +11 -0
  144. package/dist/modules/conditions/ConditionsEditor.js +209 -0
  145. package/dist/modules/conditions/LazyConditionsEditor.d.ts +10 -0
  146. package/dist/modules/conditions/LazyConditionsEditor.js +11 -0
  147. package/dist/modules/conditions/PathPicker.d.ts +8 -0
  148. package/dist/modules/conditions/PathPicker.js +51 -0
  149. package/dist/modules/conditions/conditions.d.ts +66 -0
  150. package/dist/modules/conditions/conditions.js +136 -0
  151. package/dist/modules/display/components/EmailDisplay.d.ts +4 -0
  152. package/dist/modules/display/components/EmailDisplay.js +6 -3
  153. package/dist/modules/display/components/PhoneDisplay.d.ts +4 -0
  154. package/dist/modules/display/components/PhoneDisplay.js +4 -0
  155. package/dist/modules/display/components/RelativeDateDisplay.d.ts +7 -5
  156. package/dist/modules/display/components/RelativeDateDisplay.js +10 -8
  157. package/dist/modules/display/components/SexDisplay.d.ts +1 -0
  158. package/dist/modules/display/components/SexDisplay.js +1 -0
  159. package/dist/modules/filter/components/Filter.d.ts +4 -0
  160. package/dist/modules/filter/components/Filter.js +4 -0
  161. package/dist/modules/filter/components/FilterBar.js +5 -7
  162. package/dist/modules/filter/components/FilterDialog.js +4 -5
  163. package/dist/modules/filter/components/FilterPopover.js +1 -1
  164. package/dist/modules/filter/components/FilterProvider.d.ts +1 -2
  165. package/dist/modules/filter/components/FilterProvider.js +22 -16
  166. package/dist/modules/filter/hooks/useFilterContext.d.ts +1 -0
  167. package/dist/modules/filter/hooks/useFilterContext.js +1 -0
  168. package/dist/modules/filter/types/filter.d.ts +0 -1
  169. package/dist/modules/hotkey/components/PopoverScoped.d.ts +5 -0
  170. package/dist/modules/hotkey/components/PopoverScoped.js +5 -0
  171. package/dist/modules/hotkey/hooks/usePreviousHotkeyScope.d.ts +1 -0
  172. package/dist/modules/hotkey/hooks/usePreviousHotkeyScope.js +1 -0
  173. package/dist/modules/hotkey/hooks/useScopedHotkeys.d.ts +5 -1
  174. package/dist/modules/hotkey/hooks/useScopedHotkeys.js +5 -1
  175. package/dist/modules/icons/components/IconComponent.d.ts +4 -0
  176. package/dist/modules/icons/components/IconComponent.js +4 -0
  177. package/dist/modules/icons/components/IconPicker.d.ts +4 -0
  178. package/dist/modules/icons/components/IconPicker.js +7 -5
  179. package/dist/modules/icons/providers/IconsProvider.d.ts +1 -0
  180. package/dist/modules/icons/providers/IconsProvider.js +1 -0
  181. package/dist/modules/inputs/components/EmailField.d.ts +4 -1
  182. package/dist/modules/inputs/components/EmailField.js +4 -1
  183. package/dist/modules/inputs/components/FullNameField.d.ts +6 -0
  184. package/dist/modules/inputs/components/FullNameField.js +20 -8
  185. package/dist/modules/inputs/components/PhoneField.d.ts +4 -1
  186. package/dist/modules/inputs/components/PhoneField.js +4 -1
  187. package/dist/modules/inputs/components/SexField.d.ts +1 -0
  188. package/dist/modules/inputs/components/SexField.js +1 -0
  189. package/dist/modules/layout/components/AppLayout.d.ts +6 -6
  190. package/dist/modules/layout/components/AppLayout.js +12 -13
  191. package/dist/modules/layout/components/AppLayoutResizeHandle.d.ts +5 -12
  192. package/dist/modules/layout/components/AppLayoutResizeHandle.js +15 -18
  193. package/dist/modules/layout/components/Page.d.ts +5 -0
  194. package/dist/modules/layout/components/Page.js +5 -0
  195. package/dist/modules/layout/components/PageHeader.d.ts +4 -1
  196. package/dist/modules/layout/components/PageHeader.js +9 -3
  197. package/dist/modules/list/DisplayMenu.d.ts +24 -0
  198. package/dist/modules/list/DisplayMenu.js +87 -0
  199. package/dist/modules/list/ListFilter.d.ts +63 -0
  200. package/dist/modules/list/ListFilter.js +44 -0
  201. package/dist/modules/list/ViewBar.d.ts +13 -0
  202. package/dist/modules/list/ViewBar.js +30 -0
  203. package/dist/modules/list/filter/AdvancedFilterDialog.d.ts +5 -0
  204. package/dist/modules/list/filter/AdvancedFilterDialog.js +52 -0
  205. package/dist/modules/list/filter/FieldMenus.d.ts +5 -0
  206. package/dist/modules/list/filter/FieldMenus.js +184 -0
  207. package/dist/modules/list/filter/ListFilterBar.d.ts +6 -0
  208. package/dist/modules/list/filter/ListFilterBar.js +246 -0
  209. package/dist/modules/list/filter/RecordCount.d.ts +7 -0
  210. package/dist/modules/list/filter/RecordCount.js +22 -0
  211. package/dist/modules/list/filter/RuleChips.d.ts +2 -0
  212. package/dist/modules/list/filter/RuleChips.js +157 -0
  213. package/dist/modules/list/filter/fieldIcons.d.ts +7 -0
  214. package/dist/modules/list/filter/fieldIcons.js +16 -0
  215. package/dist/modules/list/filter/filterRules.d.ts +46 -0
  216. package/dist/modules/list/filter/filterRules.js +166 -0
  217. package/dist/modules/list/filter/listFilterContext.d.ts +29 -0
  218. package/dist/modules/list/filter/listFilterContext.js +34 -0
  219. package/dist/modules/list/filter/listFilterQuery.d.ts +16 -0
  220. package/dist/modules/list/filter/listFilterQuery.js +22 -0
  221. package/dist/modules/navigation-menu/components/NavigationMenu.d.ts +4 -3
  222. package/dist/modules/navigation-menu/components/NavigationMenu.js +7 -7
  223. package/dist/modules/pickers/EntityPicker.d.ts +37 -0
  224. package/dist/modules/pickers/EntityPicker.js +67 -0
  225. package/dist/modules/pickers/LookupPicker.d.ts +51 -0
  226. package/dist/modules/pickers/LookupPicker.js +84 -0
  227. package/dist/modules/pickers/SelectMember.d.ts +41 -0
  228. package/dist/modules/pickers/SelectMember.js +122 -0
  229. package/dist/modules/pickers/members.d.ts +30 -0
  230. package/dist/modules/pickers/members.js +18 -0
  231. package/dist/modules/record-field/components/NumberField.d.ts +5 -0
  232. package/dist/modules/record-field/components/NumberField.js +14 -7
  233. package/dist/modules/record-field/components/TextField.d.ts +4 -0
  234. package/dist/modules/record-field/components/TextField.js +14 -3
  235. package/dist/modules/record-field/meta-inputs/components/PhoneInput.d.ts +5 -0
  236. package/dist/modules/record-field/meta-inputs/components/PhoneInput.js +5 -0
  237. package/dist/modules/record-list/RecordList.d.ts +18 -0
  238. package/dist/modules/record-list/RecordList.js +23 -0
  239. package/dist/modules/record-list/RecordListProvider.d.ts +30 -0
  240. package/dist/modules/record-list/RecordListProvider.js +57 -0
  241. package/dist/modules/record-list/RecordListRoot.d.ts +28 -0
  242. package/dist/modules/record-list/RecordListRoot.js +124 -0
  243. package/dist/modules/record-list/selection.d.ts +22 -0
  244. package/dist/modules/record-list/selection.js +54 -0
  245. package/dist/modules/record-panel/PanelDescriptionEditor.d.ts +9 -0
  246. package/dist/modules/record-panel/PanelDescriptionEditor.js +39 -0
  247. package/dist/modules/record-panel/PanelDescriptionField.d.ts +13 -0
  248. package/dist/modules/record-panel/PanelDescriptionField.js +39 -0
  249. package/dist/modules/record-panel/PanelField.d.ts +17 -0
  250. package/dist/modules/record-panel/PanelField.js +47 -0
  251. package/dist/modules/record-panel/PanelForm.d.ts +28 -0
  252. package/dist/modules/record-panel/PanelForm.js +88 -0
  253. package/dist/modules/record-panel/PanelLabel.d.ts +10 -0
  254. package/dist/modules/record-panel/PanelLabel.js +55 -0
  255. package/dist/modules/record-panel/PanelSection.d.ts +12 -0
  256. package/dist/modules/record-panel/PanelSection.js +24 -0
  257. package/dist/modules/record-panel/panelExpansion.d.ts +10 -0
  258. package/dist/modules/record-panel/panelExpansion.js +7 -0
  259. package/dist/modules/record-panel/useSaveOnLeave.d.ts +14 -0
  260. package/dist/modules/record-panel/useSaveOnLeave.js +42 -0
  261. package/dist/modules/record-table/components/RecordTable.d.ts +6 -0
  262. package/dist/modules/record-table/components/RecordTable.js +6 -0
  263. package/dist/modules/record-table/components/RecordTableCell.d.ts +9 -0
  264. package/dist/modules/record-table/components/RecordTableCell.js +16 -2
  265. package/dist/modules/record-table/components/RecordTableCellInline.d.ts +5 -0
  266. package/dist/modules/record-table/components/RecordTableCellInline.js +8 -7
  267. package/dist/modules/record-table/components/RecordTableCursor.js +30 -28
  268. package/dist/modules/record-table/components/RecordTableProvider.js +12 -7
  269. package/dist/modules/record-table/hooks/useTablePreferences.d.ts +1 -1
  270. package/dist/modules/record-table/hooks/useTablePreferences.js +18 -31
  271. package/dist/modules/record-table/states/RecordTableCursorState.d.ts +21 -1
  272. package/dist/modules/record-table/states/RecordTableCursorState.js +21 -3
  273. package/dist/modules/record-table/types/RecordTableCursorTypes.d.ts +1 -0
  274. package/dist/modules/record-table/types/RecordTableCursorTypes.js +1 -0
  275. package/dist/modules/records/ContactLink.d.ts +13 -0
  276. package/dist/modules/records/ContactLink.js +77 -0
  277. package/dist/modules/records/contacts.d.ts +35 -0
  278. package/dist/modules/records/contacts.js +10 -0
  279. package/dist/modules/records/openRecord.d.ts +44 -0
  280. package/dist/modules/records/openRecord.js +48 -0
  281. package/dist/state/sidebarPanelState.d.ts +5 -1
  282. package/dist/state/sidebarPanelState.js +11 -3
  283. package/dist/state/themeState.d.ts +13 -2
  284. package/dist/state/themeState.js +18 -4
  285. package/dist/theme.css +5 -2
  286. package/dist/types/SexCode.d.ts +1 -0
  287. package/dist/types/SexCode.js +1 -0
  288. package/dist/types/UIConfig.d.ts +131 -3
  289. package/dist/utils/IsUndefinedOrNull.d.ts +1 -0
  290. package/dist/utils/IsUndefinedOrNull.js +1 -0
  291. package/dist/utils/file-storage.d.ts +1 -0
  292. package/dist/utils/file-storage.js +1 -0
  293. package/dist/utils/format/formatPhoneNumber.d.ts +4 -0
  294. package/dist/utils/format/formatPhoneNumber.js +4 -0
  295. package/dist/utils/getPluginAssetsUrl.d.ts +5 -0
  296. package/dist/utils/getPluginAssetsUrl.js +5 -0
  297. package/dist/utils/host-component.d.ts +10 -0
  298. package/dist/utils/host-component.js +34 -0
  299. package/dist/utils/json.d.ts +3 -2
  300. package/dist/utils/json.js +3 -2
  301. package/dist/utils/plugin-runtime.d.ts +21 -17
  302. package/dist/utils/plugin-runtime.js +59 -12
  303. package/dist/utils/plugin-styles.d.ts +7 -0
  304. package/dist/utils/plugin-styles.js +54 -0
  305. package/dist/utils/record-timeline.d.ts +10 -9
  306. package/dist/utils/record-timeline.js +12 -17
  307. package/exports.txt +226 -0
  308. package/package.json +13 -3
  309. package/dist/constants/IntlLanguages.d.ts +0 -74
  310. package/dist/constants/IntlLanguages.js +0 -76
  311. package/dist/hooks/use-query-state.d.ts +0 -16
  312. package/dist/hooks/use-query-state.js +0 -122
  313. package/dist/modules/filter/hooks/useFilterQueryState.d.ts +0 -4
  314. package/dist/modules/filter/hooks/useFilterQueryState.js +0 -14
  315. package/dist/types/Theme.d.ts +0 -1
  316. package/dist/types/Theme.js +0 -0
  317. package/dist/utils/localization/formatDateISOStringToRelativeDate.d.ts +0 -2
  318. package/dist/utils/localization/formatDateISOStringToRelativeDate.js +0 -16
@@ -0,0 +1,46 @@
1
+ import { RelativeAmount, TConditionGroup, TConditionRule } from "../../conditions/conditions.js";
2
+ import { TListFilterField } from "../ListFilter.js";
3
+ /** One thing the list's filter requires: a rule, or a group of rules (from the advanced filter). */
4
+ export type FilterPart = TConditionRule | TConditionGroup;
5
+ type Operator = TConditionRule['op'];
6
+ /** The list's filter as parts that must all hold; an "any" group of several rules is one part. */
7
+ export declare const partsOf: (group: TConditionGroup | null) => FilterPart[];
8
+ /** Parts back to the list's filter: null when there are none. */
9
+ export declare const groupOf: (parts: FilterPart[]) => TConditionGroup | null;
10
+ /**
11
+ * Replaces the part at `index`, appends when `index` is null, removes when
12
+ * `next` is null. Parts stay distinct: a part already there isn't added twice.
13
+ */
14
+ export declare const withPart: (parts: FilterPart[], index: number | null, next: FilterPart | null) => FilterPart[];
15
+ /** Comparisons of a number, as the menu writes them. */
16
+ export declare const NUMBER_OPS: readonly ['eq', 'neq', 'gt', 'gte', 'lt', 'lte'];
17
+ export declare const NUMBER_SYMBOLS: Record<(typeof NUMBER_OPS)[number], string>;
18
+ /** Whether the menu can show and edit this rule. */
19
+ export declare const inMenu: (rule: TConditionRule, field: TListFilterField | undefined) => boolean;
20
+ /** Which part the menu of `field` changes: the one being edited, else its existing single rule, else a new one. */
21
+ export declare const targetOf: (parts: FilterPart[], field: TListFilterField, editing: number | null) => number | null;
22
+ /**
23
+ * The values a rule picks: the list of "is any of", or the one of "is". A value that isn't text or
24
+ * numbers (a date range, a relative amount) picks nothing.
25
+ */
26
+ export declare const valuesOf: (rule: TConditionRule | undefined) => string[];
27
+ /** An "is any of" rule; null when nothing is picked. */
28
+ export declare const anyOf: (path: string, values: string[]) => TConditionRule | null;
29
+ /**
30
+ * Date filters in one pick, on the relative operators (they stay current in a saved view);
31
+ * `label` is the English for the `views` namespace's `filter.date.<key>`.
32
+ */
33
+ export declare const DATE_PRESETS: {
34
+ key: string;
35
+ label: string;
36
+ op: Operator;
37
+ value?: RelativeAmount;
38
+ }[];
39
+ /** The preset a rule is, if any. */
40
+ export declare const presetOf: (rule: TConditionRule | undefined) => {
41
+ key: string;
42
+ label: string;
43
+ op: Operator;
44
+ value?: RelativeAmount;
45
+ } | undefined;
46
+ export {};
@@ -0,0 +1,166 @@
1
+ import { isRule } from "../../conditions/conditions.js";
2
+ import { z } from "zod";
3
+ // src/modules/list/filter/filterRules.ts
4
+ /** The list's filter as parts that must all hold; an "any" group of several rules is one part. */
5
+ const partsOf = (group) => !group ? [] : group.match === "all" || group.rules.length < 2 ? group.rules : [group];
6
+ /** Parts back to the list's filter: null when there are none. */
7
+ const groupOf = (parts) => parts.length ? {
8
+ match: "all",
9
+ rules: parts
10
+ } : null;
11
+ const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
12
+ /**
13
+ * Replaces the part at `index`, appends when `index` is null, removes when
14
+ * `next` is null. Parts stay distinct: a part already there isn't added twice.
15
+ */
16
+ const withPart = (parts, index, next) => {
17
+ if (next && parts.some((part, at) => at !== index && same(part, next))) return index === null ? parts : parts.filter((_, at) => at !== index);
18
+ if (index === null) return next ? [...parts, next] : parts;
19
+ return next ? parts.map((part, at) => at === index ? next : part) : parts.filter((_, at) => at !== index);
20
+ };
21
+ /** Comparisons of a number, as the menu writes them. */
22
+ const NUMBER_OPS = [
23
+ "eq",
24
+ "neq",
25
+ "gt",
26
+ "gte",
27
+ "lt",
28
+ "lte"
29
+ ];
30
+ const NUMBER_SYMBOLS = {
31
+ eq: "=",
32
+ neq: "≠",
33
+ gt: ">",
34
+ gte: "≥",
35
+ lt: "<",
36
+ lte: "≤"
37
+ };
38
+ /** The operators the filter menu shows and edits for each kind of field; other rules open the advanced filter. */
39
+ const MENU_OPS = {
40
+ select: ["in", "eq"],
41
+ member: ["in", "eq"],
42
+ tags: ["in", "eq"],
43
+ boolean: ["eq"],
44
+ date: [
45
+ "within_last",
46
+ "more_than_ago",
47
+ "within_next",
48
+ "exists",
49
+ "not_exists"
50
+ ],
51
+ number: NUMBER_OPS,
52
+ text: ["contains"]
53
+ };
54
+ /** Whether the menu can show and edit this rule. */
55
+ const inMenu = (rule, field) => !!field && MENU_OPS[field.type].includes(rule.op);
56
+ /** Fields with one value at a time (a choice, a yes/no, a date range): picking again changes it rather than adding one. */
57
+ const SINGLE = /* @__PURE__ */ new Set([
58
+ "select",
59
+ "member",
60
+ "tags",
61
+ "boolean",
62
+ "date"
63
+ ]);
64
+ /** Which part the menu of `field` changes: the one being edited, else its existing single rule, else a new one. */
65
+ const targetOf = (parts, field, editing) => {
66
+ if (editing !== null) return editing;
67
+ if (!SINGLE.has(field.type)) return null;
68
+ const index = parts.findIndex((part) => isRule(part) && part.path === field.path && inMenu(part, field));
69
+ return index < 0 ? null : index;
70
+ };
71
+ const Values = z.array(z.union([z.string(), z.number()]).transform(String));
72
+ /**
73
+ * The values a rule picks: the list of "is any of", or the one of "is". A value that isn't text or
74
+ * numbers (a date range, a relative amount) picks nothing.
75
+ */
76
+ const valuesOf = (rule) => {
77
+ if (!rule || rule.value === void 0 || rule.value === null) return [];
78
+ return Values.safeParse(rule.op === "in" ? rule.value : [rule.value]).data ?? [];
79
+ };
80
+ /** An "is any of" rule; null when nothing is picked. */
81
+ const anyOf = (path, values) => values.length ? {
82
+ path,
83
+ op: "in",
84
+ value: values
85
+ } : null;
86
+ const days = (amount) => ({
87
+ amount,
88
+ unit: "days"
89
+ });
90
+ const months = (amount) => ({
91
+ amount,
92
+ unit: "months"
93
+ });
94
+ /**
95
+ * Date filters in one pick, on the relative operators (they stay current in a saved view);
96
+ * `label` is the English for the `views` namespace's `filter.date.<key>`.
97
+ */
98
+ const DATE_PRESETS = [
99
+ {
100
+ key: "past-day",
101
+ label: "Past day",
102
+ op: "within_last",
103
+ value: days(1)
104
+ },
105
+ {
106
+ key: "past-week",
107
+ label: "Past 7 days",
108
+ op: "within_last",
109
+ value: days(7)
110
+ },
111
+ {
112
+ key: "past-month",
113
+ label: "Past 30 days",
114
+ op: "within_last",
115
+ value: days(30)
116
+ },
117
+ {
118
+ key: "past-quarter",
119
+ label: "Past 3 months",
120
+ op: "within_last",
121
+ value: months(3)
122
+ },
123
+ {
124
+ key: "past-year",
125
+ label: "Past year",
126
+ op: "within_last",
127
+ value: months(12)
128
+ },
129
+ {
130
+ key: "older-month",
131
+ label: "More than 30 days ago",
132
+ op: "more_than_ago",
133
+ value: days(30)
134
+ },
135
+ {
136
+ key: "older-year",
137
+ label: "More than a year ago",
138
+ op: "more_than_ago",
139
+ value: months(12)
140
+ },
141
+ {
142
+ key: "next-week",
143
+ label: "Next 7 days",
144
+ op: "within_next",
145
+ value: days(7)
146
+ },
147
+ {
148
+ key: "next-month",
149
+ label: "Next 30 days",
150
+ op: "within_next",
151
+ value: days(30)
152
+ },
153
+ {
154
+ key: "set",
155
+ label: "Is set",
156
+ op: "exists"
157
+ },
158
+ {
159
+ key: "empty",
160
+ label: "Is empty",
161
+ op: "not_exists"
162
+ }
163
+ ];
164
+ /** The preset a rule is, if any. */
165
+ const presetOf = (rule) => rule && DATE_PRESETS.find((preset) => preset.op === rule.op && JSON.stringify(preset.value) === JSON.stringify(rule.value));
166
+ export { DATE_PRESETS, NUMBER_OPS, NUMBER_SYMBOLS, anyOf, groupOf, inMenu, partsOf, presetOf, targetOf, valuesOf, withPart };
@@ -0,0 +1,29 @@
1
+ import { TConditionLookups } from "../../conditions/conditions.js";
2
+ import { TListFilterField } from "../ListFilter.js";
3
+ import { FilterPart } from "./filterRules.js";
4
+ /** What the filter menu, its chips and the advanced filter share. */
5
+ export interface ListFilterState {
6
+ fields: TListFilterField[];
7
+ /** Where `member` and `tags` fields pick from. */
8
+ lookups: TConditionLookups;
9
+ /** The list's filter as parts that must all hold (`partsOf`). */
10
+ parts: FilterPart[];
11
+ /** Changes the filter as `withPart` does. */
12
+ setPart: (index: number | null, next: FilterPart | null) => void;
13
+ /** The part a chip opened the menu on. */
14
+ editing: number | null;
15
+ /** Opens the menu on a chip's part, or the advanced filter when the menu can't show it. */
16
+ edit: (index: number) => void;
17
+ openAdvanced: () => void;
18
+ }
19
+ export declare const ListFilterContext: import("react").Context<ListFilterState | null>;
20
+ export declare const useListFilter: () => ListFilterState;
21
+ /** What a choice field picks from: its options, the team ("Me" first), or the list's tags. */
22
+ export declare const useFieldOptions: (field: TListFilterField) => {
23
+ options: {
24
+ value: string;
25
+ label: string;
26
+ }[];
27
+ loading: boolean;
28
+ error: Error | null;
29
+ };
@@ -0,0 +1,34 @@
1
+ import { isRule } from "../../conditions/conditions.js";
2
+ import { useMemberOptions, useTagOptions } from "../../pickers/LookupPicker.js";
3
+ import { valuesOf } from "./filterRules.js";
4
+ import { createContext, useContext } from "react";
5
+ import { useTranslation } from "react-i18next";
6
+ // src/modules/list/filter/listFilterContext.ts
7
+ const ListFilterContext = createContext(null);
8
+ const useListFilter = () => {
9
+ const state = useContext(ListFilterContext);
10
+ if (!state) throw new Error("useListFilter is only available inside <ListFilter>");
11
+ return state;
12
+ };
13
+ /** What a choice field picks from: its options, the team ("Me" first), or the list's tags. */
14
+ const useFieldOptions = (field) => {
15
+ const { t } = useTranslation("views", { keyPrefix: "filter" });
16
+ const { lookups, parts } = useListFilter();
17
+ const picked = parts.flatMap((part) => isRule(part) && part.path === field.path ? valuesOf(part) : []);
18
+ const members = useMemberOptions(lookups.members, field.type === "member", picked);
19
+ const tags = useTagOptions(lookups.tags, field.type === "tags");
20
+ if (field.type === "member") return {
21
+ ...members,
22
+ options: [{
23
+ value: "me",
24
+ label: t("me", "Me")
25
+ }, ...members.options]
26
+ };
27
+ if (field.type === "tags") return tags;
28
+ return {
29
+ options: field.options ?? [],
30
+ loading: false,
31
+ error: null
32
+ };
33
+ };
34
+ export { ListFilterContext, useFieldOptions, useListFilter };
@@ -0,0 +1,16 @@
1
+ import { TConditionGroup } from "../../conditions/conditions.js";
2
+ /**
3
+ * The URL params holding a list's filter, as nuqs parsers.
4
+ * Shared links and reloads keep the filter: `advanced` is the condition group as JSON, and
5
+ * `searchValue` the search.
6
+ */
7
+ export declare const listFilterQuery: {
8
+ advanced: import("nuqs").SingleParserBuilder<TConditionGroup>;
9
+ searchValue: import("nuqs").SingleParserBuilder<string>;
10
+ };
11
+ /** The list's conditions (null without any) and search, and how the bar changes them. */
12
+ export declare const useListConditions: () => {
13
+ advanced: TConditionGroup | null;
14
+ search: string | null;
15
+ setAdvanced: (next: TConditionGroup | null) => undefined;
16
+ };
@@ -0,0 +1,22 @@
1
+ import { ConditionGroup } from "../../conditions/conditions.js";
2
+ import { parseAsJson, parseAsString, useQueryStates } from "nuqs";
3
+ // src/modules/list/filter/listFilterQuery.ts
4
+ /**
5
+ * The URL params holding a list's filter, as nuqs parsers.
6
+ * Shared links and reloads keep the filter: `advanced` is the condition group as JSON, and
7
+ * `searchValue` the search.
8
+ */
9
+ const listFilterQuery = {
10
+ advanced: parseAsJson((value) => ConditionGroup.safeParse(value).data ?? null),
11
+ searchValue: parseAsString
12
+ };
13
+ /** The list's conditions (null without any) and search, and how the bar changes them. */
14
+ const useListConditions = () => {
15
+ const [{ advanced, searchValue }, setQueries] = useQueryStates(listFilterQuery, { history: "replace" });
16
+ return {
17
+ advanced: advanced?.rules.length ? advanced : null,
18
+ search: searchValue,
19
+ setAdvanced: (next) => void setQueries({ advanced: next?.rules.length ? next : null })
20
+ };
21
+ };
22
+ export { listFilterQuery, useListConditions };
@@ -1,9 +1,10 @@
1
1
  import { Sidebar } from "../../../components/sidebar.js";
2
- export declare const NavigationMenuLinkItem: ({ ref, name, icon: IconComponent, path, pathPrefix, children, className, isActive: isActiveProp, label, action, itemClassName, ...props }: React.ComponentProps<typeof Sidebar.MenuButton> & {
2
+ /** A sidebar link that lights up while the address is under its `to`. */
3
+ export declare const NavigationMenuLinkItem: ({ ref, name, icon: IconComponent, to, children, className, isActive: isActiveProp, label, action, itemClassName, ...props }: React.ComponentProps<typeof Sidebar.MenuButton> & {
3
4
  name: string;
4
5
  icon?: React.ElementType;
5
- path: string;
6
- pathPrefix?: string;
6
+ /** The address, from the app's paths. */
7
+ to: string;
7
8
  isActive?: boolean;
8
9
  label?: React.ReactNode;
9
10
  action?: React.ReactNode;
@@ -4,15 +4,15 @@ import { useNavigationMenuItemControls } from "./NavigationMenuItemControls.js";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { Link, useLocation } from "react-router-dom";
6
6
  // src/modules/navigation-menu/components/NavigationMenu.tsx
7
- const NavigationMenuLinkItem = ({ ref, name, icon: IconComponent, path, pathPrefix, children, className, isActive: isActiveProp, label, action, itemClassName, ...props }) => {
7
+ /** A sidebar link that lights up while the address is under its `to`. */
8
+ const NavigationMenuLinkItem = ({ ref, name, icon: IconComponent, to, children, className, isActive: isActiveProp, label, action, itemClassName, ...props }) => {
8
9
  const { pathname } = useLocation();
9
- const fullPath = `/${pathPrefix ? `${pathPrefix.replace(/\/$/, "")}/` : ""}${path.replace(/^\//, "")}`.replace(/\/$/, "") || "/";
10
- const isActive = pathname.startsWith(fullPath);
10
+ const isActive = pathname.startsWith(to);
11
11
  const controls = useNavigationMenuItemControls();
12
- const order = controls?.getOrder(fullPath);
12
+ const order = controls?.getOrder(to);
13
13
  return /* @__PURE__ */ jsxs(Sidebar.MenuItem, {
14
14
  className: cn(itemClassName, order !== void 0 && "order-(--order)"),
15
- "data-nav-path": controls ? fullPath : void 0,
15
+ "data-nav-path": controls ? to : void 0,
16
16
  style: { "--order": order },
17
17
  children: [
18
18
  /* @__PURE__ */ jsxs(Sidebar.MenuButton, {
@@ -20,7 +20,7 @@ const NavigationMenuLinkItem = ({ ref, name, icon: IconComponent, path, pathPref
20
20
  ref,
21
21
  className,
22
22
  ...props,
23
- render: /* @__PURE__ */ jsx(Link, { to: fullPath }),
23
+ render: /* @__PURE__ */ jsx(Link, { to }),
24
24
  children: [
25
25
  IconComponent && /* @__PURE__ */ jsx(IconComponent, { className: cn("text-accent-foreground", isActive && "text-primary-text") }),
26
26
  label || /* @__PURE__ */ jsx("span", {
@@ -33,7 +33,7 @@ const NavigationMenuLinkItem = ({ ref, name, icon: IconComponent, path, pathPref
33
33
  action,
34
34
  controls?.renderActions({
35
35
  name,
36
- path: fullPath,
36
+ path: to,
37
37
  icon: IconComponent
38
38
  })
39
39
  ]
@@ -0,0 +1,37 @@
1
+ import { ReactNode } from "react";
2
+ interface EntityPickerProps<T, K extends string> {
3
+ items: T[];
4
+ /** The id and the text a search matches. */
5
+ itemKey: (item: T) => {
6
+ id: K;
7
+ label: string;
8
+ };
9
+ /** How an item reads in the list; its label by default. */
10
+ renderItem?: (item: T) => ReactNode;
11
+ value: K[];
12
+ /** The picked ids. One pick replaces the value unless `multiple`, where it toggles. */
13
+ onValueChange: (ids: K[]) => void;
14
+ multiple?: boolean;
15
+ /** Items keep their order (a tree reads top down); otherwise the picked ones come first. */
16
+ keepOrder?: boolean;
17
+ loading?: boolean;
18
+ error?: Error | null;
19
+ /** Searching on the server: `items` are already the matches, so they are not filtered here. */
20
+ onSearchChange?: (search: string) => void;
21
+ searchPlaceholder?: string;
22
+ /** A first row that picks nothing. */
23
+ noneLabel?: string;
24
+ /** Above the list, e.g. the picked tags as badges. */
25
+ header?: ReactNode;
26
+ /** A row for what was searched, e.g. "Add tag: VIP"; `clear` empties the search. */
27
+ renderCreate?: (search: string, clear: () => void) => ReactNode;
28
+ }
29
+ /**
30
+ * The searchable list behind every record picker; build a picker on it.
31
+ * It serves members, contacts, tags and a plugin's own records: search, the picked ones first, a
32
+ * check on each, and optional "none" and "create" rows. Each picker brings its own trigger (a
33
+ * table cell, a form control, a button) and its items, usually from
34
+ * `useQuery(orpc.<group>.list.queryOptions(...))`.
35
+ */
36
+ export declare const EntityPicker: <T, K extends string = string>({ items, itemKey, renderItem, value, onValueChange, multiple, keepOrder, loading, error, onSearchChange, searchPlaceholder, noneLabel, header, renderCreate }: EntityPickerProps<T, K>) => import("react").JSX.Element;
37
+ export {};
@@ -0,0 +1,67 @@
1
+ import { Combobox } from "../../components/combobox.js";
2
+ import { Command } from "../../components/command.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { useState } from "react";
5
+ // src/modules/pickers/EntityPicker.tsx
6
+ /**
7
+ * The searchable list behind every record picker; build a picker on it.
8
+ * It serves members, contacts, tags and a plugin's own records: search, the picked ones first, a
9
+ * check on each, and optional "none" and "create" rows. Each picker brings its own trigger (a
10
+ * table cell, a form control, a button) and its items, usually from
11
+ * `useQuery(orpc.<group>.list.queryOptions(...))`.
12
+ */
13
+ const EntityPicker = ({ items, itemKey, renderItem, value, onValueChange, multiple, keepOrder, loading, error, onSearchChange, searchPlaceholder, noneLabel, header, renderCreate }) => {
14
+ const [search, setSearch] = useState("");
15
+ const [pickedAtOpen] = useState(value);
16
+ const term = search.trim().toLowerCase();
17
+ const matches = items.map((item) => ({
18
+ item,
19
+ ...itemKey(item)
20
+ })).filter((row) => onSearchChange !== void 0 || row.label.toLowerCase().includes(term));
21
+ const rows = keepOrder ? matches : matches.toSorted((a, b) => Number(pickedAtOpen.includes(b.id)) - Number(pickedAtOpen.includes(a.id)));
22
+ const pick = (id) => onValueChange(!multiple ? [id] : value.includes(id) ? value.filter((item) => item !== id) : [...value, id]);
23
+ const changeSearch = (next) => {
24
+ setSearch(next);
25
+ onSearchChange?.(next);
26
+ };
27
+ return /* @__PURE__ */ jsxs(Command, {
28
+ shouldFilter: false,
29
+ children: [
30
+ /* @__PURE__ */ jsx(Command.Input, {
31
+ value: search,
32
+ onValueChange: changeSearch,
33
+ placeholder: searchPlaceholder,
34
+ variant: "secondary",
35
+ wrapperClassName: "flex-auto",
36
+ focusOnMount: true
37
+ }),
38
+ header,
39
+ error && /* @__PURE__ */ jsx("p", {
40
+ role: "alert",
41
+ className: "text-destructive px-3 py-2 text-sm",
42
+ children: error.message
43
+ }),
44
+ /* @__PURE__ */ jsxs(Command.List, {
45
+ className: "max-h-75 overflow-y-auto",
46
+ children: [
47
+ noneLabel && !term && /* @__PURE__ */ jsxs(Command.Item, {
48
+ value: "__none__",
49
+ onSelect: () => onValueChange([]),
50
+ children: [/* @__PURE__ */ jsx("span", {
51
+ className: "text-muted-foreground",
52
+ children: noneLabel
53
+ }), /* @__PURE__ */ jsx(Combobox.Check, { checked: value.length === 0 })]
54
+ }),
55
+ renderCreate?.(search.trim(), () => changeSearch("")),
56
+ !error && /* @__PURE__ */ jsx(Combobox.Empty, { loading }),
57
+ rows.map(({ item, id, label }) => /* @__PURE__ */ jsxs(Command.Item, {
58
+ value: id,
59
+ onSelect: () => pick(id),
60
+ children: [renderItem ? renderItem(item) : label, /* @__PURE__ */ jsx(Combobox.Check, { checked: value.includes(id) })]
61
+ }, id))
62
+ ]
63
+ })
64
+ ]
65
+ });
66
+ };
67
+ export { EntityPicker };
@@ -0,0 +1,51 @@
1
+ import { MemberQueries } from "./members.js";
2
+ import { UseQueryOptions } from "@tanstack/react-query";
3
+ /** A tag as the pickers show one: core's `Tag` has these fields and more. */
4
+ export interface Tag {
5
+ id: string;
6
+ name: string;
7
+ }
8
+ /**
9
+ * TanStack query options for the tags of one record type.
10
+ * In erxes, web's query for `orpc.tags.list` with the type (`{ type: 'customer' }`).
11
+ */
12
+ export type TagsQuery = RowsQuery<Tag>;
13
+ type LookupOptions = {
14
+ options: {
15
+ value: string;
16
+ label: string;
17
+ }[];
18
+ loading: boolean;
19
+ error: Error | null;
20
+ };
21
+ type RowsQuery<T> = UseQueryOptions<{
22
+ data: T[];
23
+ }, Error, {
24
+ data: T[];
25
+ }>;
26
+ /**
27
+ * The active team members as picker options.
28
+ * It adds the `picked` members outside it (a disabled member a filter still names), so their
29
+ * names show; none without `members`.
30
+ */
31
+ export declare const useMemberOptions: (members: MemberQueries | undefined, enabled?: boolean, picked?: readonly string[]) => {
32
+ loading: boolean;
33
+ error: Error | null;
34
+ options: {
35
+ value: string;
36
+ label: string;
37
+ }[];
38
+ };
39
+ /** A record type's tags as picker options; none without `tags`. */
40
+ export declare const useTagOptions: (tags: TagsQuery | undefined, enabled?: boolean) => LookupOptions;
41
+ /** A button that picks members or tags, one or several with `multiple`. */
42
+ export declare const LookupPicker: ({ lookup: { options, loading, error }, value, onValueChange, multiple, placeholder, disabled, className }: {
43
+ lookup: LookupOptions;
44
+ value: string[];
45
+ onValueChange: (values: string[]) => void;
46
+ multiple?: boolean;
47
+ placeholder: string;
48
+ disabled?: boolean;
49
+ className?: string;
50
+ }) => import("react").JSX.Element;
51
+ export {};
@@ -0,0 +1,84 @@
1
+ import { Combobox } from "../../components/combobox.js";
2
+ import { Popover } from "../../components/popover.js";
3
+ import { EntityPicker } from "./EntityPicker.js";
4
+ import { memberName } from "./members.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { useMemo, useState } from "react";
7
+ import { skipToken, useQuery } from "@tanstack/react-query";
8
+ // src/modules/pickers/LookupPicker.tsx
9
+ const useLookup = (query, enabled, option) => {
10
+ const options = query ? {
11
+ ...query,
12
+ enabled
13
+ } : {
14
+ queryKey: ["erxes-ui", "no-lookup"],
15
+ queryFn: skipToken
16
+ };
17
+ const result = useQuery(options);
18
+ return {
19
+ options: useMemo(() => (result.data?.data ?? []).map(option), [result.data, option]),
20
+ loading: enabled && !!query && result.isPending,
21
+ error: result.error
22
+ };
23
+ };
24
+ const memberOption = (member) => ({
25
+ value: member.id,
26
+ label: memberName(member)
27
+ });
28
+ const tagOption = (tag) => ({
29
+ value: tag.id,
30
+ label: tag.name
31
+ });
32
+ /**
33
+ * The active team members as picker options.
34
+ * It adds the `picked` members outside it (a disabled member a filter still names), so their
35
+ * names show; none without `members`.
36
+ */
37
+ const useMemberOptions = (members, enabled = true, picked = []) => {
38
+ const team = useLookup(members?.team, enabled, memberOption);
39
+ const known = new Set(team.options.map((option) => option.value));
40
+ const missing = [...new Set(picked)].filter((id) => id !== "me" && !known.has(id)).toSorted((a, b) => a.localeCompare(b));
41
+ const others = useLookup(members && missing.length ? members.byIds(missing) : void 0, enabled && !team.loading && missing.length > 0, memberOption);
42
+ return {
43
+ ...team,
44
+ options: [...team.options, ...others.options]
45
+ };
46
+ };
47
+ /** A record type's tags as picker options; none without `tags`. */
48
+ const useTagOptions = (tags, enabled = true) => useLookup(tags, enabled, tagOption);
49
+ /** A button that picks members or tags, one or several with `multiple`. */
50
+ const LookupPicker = ({ lookup: { options, loading, error }, value, onValueChange, multiple, placeholder, disabled, className }) => {
51
+ const [open, setOpen] = useState(false);
52
+ const items = [...value.filter((id) => !options.some((option) => option.value === id)).map((id) => ({
53
+ value: id,
54
+ label: id
55
+ })), ...options];
56
+ const labels = value.map((id) => items.find((option) => option.value === id)?.label ?? id);
57
+ return /* @__PURE__ */ jsxs(Popover, {
58
+ open,
59
+ onOpenChange: setOpen,
60
+ children: [/* @__PURE__ */ jsx(Combobox.Trigger, {
61
+ disabled,
62
+ className,
63
+ children: /* @__PURE__ */ jsx(Combobox.Value, {
64
+ value: labels.join(", "),
65
+ placeholder
66
+ })
67
+ }), /* @__PURE__ */ jsx(Combobox.Content, { children: /* @__PURE__ */ jsx(EntityPicker, {
68
+ multiple,
69
+ items,
70
+ itemKey: (option) => ({
71
+ id: option.value,
72
+ label: option.label
73
+ }),
74
+ value,
75
+ onValueChange: (next) => {
76
+ onValueChange(next);
77
+ if (!multiple) setOpen(false);
78
+ },
79
+ loading,
80
+ error
81
+ }) })]
82
+ });
83
+ };
84
+ export { LookupPicker, useMemberOptions, useTagOptions };
@@ -0,0 +1,41 @@
1
+ import { AvatarProps } from "../../components/avatar.js";
2
+ import { Combobox } from "../../components/combobox.js";
3
+ import { RecordTableInlineCell } from "../record-table/components/RecordTableCellInline.js";
4
+ import { MemberQueries } from "./members.js";
5
+ import { ComponentProps, ComponentRef, RefAttributes } from "react";
6
+ /** A member's avatar and name by id, or a placeholder without one. */
7
+ export declare const MemberInline: ({ memberId, members, placeholder, size, className }: {
8
+ memberId: string | null | undefined;
9
+ members: MemberQueries;
10
+ placeholder?: string;
11
+ size?: AvatarProps['size'];
12
+ className?: string;
13
+ }) => import("react").JSX.Element;
14
+ interface SelectMemberProps {
15
+ value: string | null | undefined;
16
+ onValueChange: (id: string | null) => void;
17
+ /** Where the members come from: `memberQueries` from `@erxes/core-contract/client`. */
18
+ members: MemberQueries;
19
+ placeholder?: string;
20
+ /** A first row that picks no member, e.g. "Anyone" on a filter. */
21
+ noneLabel?: string;
22
+ }
23
+ /** The member as a record table cell; click to pick another. */
24
+ declare const SelectMemberInlineCell: ({ ref, value, onValueChange, members, noneLabel, scope, placeholder, size, className, variant, id, 'aria-label': ariaLabel }: SelectMemberProps & {
25
+ scope?: string;
26
+ size?: AvatarProps['size'];
27
+ className?: string;
28
+ /** `field` beside its label in a side panel; a table cell by default. */
29
+ variant?: ComponentProps<typeof RecordTableInlineCell.Trigger>['variant'];
30
+ id?: string;
31
+ /** Names the picker while it shows no member. */
32
+ 'aria-label'?: string;
33
+ } & RefAttributes<ComponentRef<typeof RecordTableInlineCell.Trigger>>) => import("react").JSX.Element;
34
+ /** A member picker button; its other props (an id, `Form.Control`'s aria wiring) go to the button. */
35
+ declare const SelectMemberField: ({ value, onValueChange, members, noneLabel, placeholder, className, ...trigger }: SelectMemberProps & Omit<ComponentProps<typeof Combobox.Trigger>, 'value' | 'children' | 'placeholder'>) => import("react").JSX.Element;
36
+ /** The member picker as a table cell and as a field. */
37
+ export declare const SelectMember: {
38
+ InlineCell: typeof SelectMemberInlineCell;
39
+ Field: typeof SelectMemberField;
40
+ };
41
+ export {};