@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
@@ -2,39 +2,34 @@ import { TContactContentType } from "../modules/records/contacts.js";
2
2
  import { RecordRef } from "../modules/records/openRecord.js";
3
3
  import { Icon } from "@tabler/icons-react";
4
4
  import { UseQueryOptions } from "@tanstack/react-query";
5
+ /** Every schematic the widget catalog can draw for a dashboard widget. */
6
+ export declare const DASHBOARD_WIDGET_PREVIEWS: readonly ['bar', 'line', 'area', 'pie', 'table', 'list', 'kpi', 'heatmap', 'progress'];
7
+ /** The schematic a dashboard widget shows in the widget catalog. */
8
+ export type TDashboardWidgetPreview = (typeof DASHBOARD_WIDGET_PREVIEWS)[number];
5
9
  /**
6
- * A property input's own settings, stored with the custom field.
7
- * Each input defines its keys.
8
- */
9
- export type TPropertyInputMeta = Record<string, unknown>;
10
- /**
11
- * Props of a plugin's activity row component in `widgets.activityRows`.
12
- * The shape comes from erxes 3.x; web doesn't read `widgets` from a plugin's config.
10
+ * A plugin's tile for core's home dashboard.
11
+ * It shows in the widget catalog, under the plugin's name, to members who may use the plugin.
12
+ * A member places it at most once.
13
13
  */
14
- export type TActivityRowProps = {
15
- activity: {
16
- _id: string;
17
- activityType: string;
18
- sourcePlugin?: string;
19
- createdAt: string | Date;
20
- /** The plugin's own payload for the row. */
21
- metadata?: Record<string, unknown>;
14
+ export type TDashboardWidget = {
15
+ /** Unique within the plugin, e.g. `open-tickets`: a saved tile names it. */
16
+ name: string;
17
+ title: string;
18
+ description?: string;
19
+ icon: React.ElementType;
20
+ /** The schematic the catalog draws; the icon when left out. */
21
+ preview?: TDashboardWidgetPreview;
22
+ /** Grid units on a 12-column grid when placed; 6 × 6 when left out. */
23
+ size?: {
24
+ w: number;
25
+ h: number;
22
26
  };
27
+ /**
28
+ * The tile's body, under core's header with the title; it scrolls when taller than the tile.
29
+ * A `lazy` one loads when the tile first shows.
30
+ */
31
+ component: React.ComponentType;
23
32
  };
24
- /**
25
- * Props of a custom property input in `widgets.propertyInputs`.
26
- * It edits the field's value as text and its own settings as `meta`. The shape comes from
27
- * erxes 3.x; web doesn't read `widgets` from a plugin's config.
28
- */
29
- export type TPropertyInputProps = {
30
- value: string;
31
- onValueChange: (value: string) => void;
32
- meta?: TPropertyInputMeta;
33
- onMetaChange: (meta: TPropertyInputMeta) => void;
34
- disabled?: boolean;
35
- };
36
- /** The schematic a dashboard widget shows in the widget catalog. */
37
- export type TDashboardWidgetPreview = 'bar' | 'line' | 'area' | 'pie' | 'table' | 'list' | 'kpi' | 'heatmap' | 'progress';
38
33
  /** What a record section is given: the customer or company it shows on. */
39
34
  export type TRecordSectionProps = {
40
35
  contentType: TContactContentType;
@@ -82,10 +77,29 @@ export type TRecordDraftProps = {
82
77
  /** Leaves the draft: back to the record it came from, else closes the panel. */
83
78
  onCancel: () => void;
84
79
  };
80
+ /**
81
+ * A custom field's value: text, number, date, yes/no or options.
82
+ * A date is `YYYY-MM-DD`; several options are a list.
83
+ */
84
+ export type TPropertyValue = string | number | boolean | string[];
85
+ /**
86
+ * Custom fields on a plugin record type, whose values the plugin keeps.
87
+ * Core keeps the fields of `type` (Settings › Properties, under the plugin) and draws the
88
+ * record's Properties tab; the plugin keeps each record's values by field id, checks a patch
89
+ * with core's `fields.check` and saves the values it answers.
90
+ */
91
+ export type TRecordProperties = {
92
+ /** The record type the fields are defined on, `<plugin>.<type>`, e.g. `operation.task`. */
93
+ type: string;
94
+ /** The record's values by field id, as query options; core refetches them after a save. */
95
+ values: (contentId: string) => UseQueryOptions<Record<string, TPropertyValue>>;
96
+ /** Saves a patch of values by field id; `null` clears one. */
97
+ save: (contentId: string, patch: Record<string, TPropertyValue | null>) => Promise<unknown>;
98
+ };
85
99
  /**
86
100
  * A record type a plugin shows in core's side panel. Core draws the panel as it draws a
87
101
  * customer's: header with Back, expand and close, the tabs (Detail, the type's own `tabs`,
88
- * every allowed plugin's relation tabs for it, Activity), resizing, the address
102
+ * Properties, every allowed plugin's relation tabs for it, Activity), resizing, the address
89
103
  * `?panel=/detail/<contentType>/<id>`, drafts. The plugin fills the slots. Open one with
90
104
  * `useOpenRecord().open({ contentType, contentId })`, a draft with `openNew(contentType)`.
91
105
  */
@@ -116,6 +130,8 @@ export type TPanelRecordType = {
116
130
  contacts?: (contentId: string) => UseQueryOptions<TRecordContacts, Error, TRecordContacts>;
117
131
  /** A timeline type of the plugin's manifest (`timelines`): core's Activity tab shows it. */
118
132
  activity?: string;
133
+ /** Custom fields: core adds a Properties tab and a settings page for them. */
134
+ properties?: TRecordProperties;
119
135
  };
120
136
  /** Props of a relation tab: the record it shows on, and its contacts. */
121
137
  export type TRelationTabProps = TRecordSlotProps & TRecordContacts;
@@ -135,25 +151,44 @@ export type TRelationTab = {
135
151
  hosts?: string[];
136
152
  component: React.ComponentType<TRelationTabProps>;
137
153
  };
154
+ /**
155
+ * A plugin's settings page, linked from core's settings sidebar.
156
+ * The page is a route of the plugin's own, under its `path`, e.g. `/frontline/settings/tags`.
157
+ */
158
+ export type TPluginSettingsPage = {
159
+ /** The page's address, under the plugin's `path`. */
160
+ path: string;
161
+ label: string;
162
+ icon?: React.ElementType;
163
+ };
138
164
  /**
139
165
  * A plugin UI's `CONFIG`, exported from its `./config` remote.
140
- * web reads `name`, `path`, `icon`, `modules`, `checkAccess`, `recordSections`, `recordTypes`
141
- * and `relationTabs`; its first module renders under `/<path>/*`. The other fields come from
142
- * erxes 3.x and web ignores them.
166
+ * web reads `name`, `path`, `icon`, `modules`, `checkAccess`, `recordSections`, `recordTypes`,
167
+ * `relationTabs`, `settings`, `dashboardWidgets` and `floatingWidget`; its first module renders
168
+ * under `/<path>/*`. The other fields come from erxes 3.x and web ignores them.
143
169
  */
144
170
  export type IUIConfig = {
145
171
  name: string;
146
172
  path: string;
147
173
  icon?: React.ElementType;
174
+ /** The plugin's settings pages, in core's settings sidebar for members who may use the plugin. */
175
+ settings?: TPluginSettingsPage[];
148
176
  /** Sections on core's customer and company detail, shown to members who may use the plugin. */
149
177
  recordSections?: TRecordSection[];
150
178
  /** The plugin's records core's side panel opens, for members who may use the plugin. */
151
179
  recordTypes?: TPanelRecordType[];
152
180
  /** Tabs on other records' panels listing the plugin's records of their contacts. */
153
181
  relationTabs?: TRelationTab[];
182
+ /** Tiles in core's home dashboard catalog, for members who may use the plugin. */
183
+ dashboardWidgets?: TDashboardWidget[];
184
+ /**
185
+ * One component web mounts once beside the app shell, on every page, for members who may use
186
+ * the plugin, and keeps mounted across navigation (a softphone). It sits in the bottom-right
187
+ * corner above the page.
188
+ */
189
+ floatingWidget?: React.ComponentType;
154
190
  i18n?: boolean;
155
191
  i18nNamespace?: string;
156
- hasFloatingWidget?: boolean;
157
192
  /**
158
193
  * erxes platform versions this plugin is built for, as a semver range
159
194
  * (e.g. `'~3.2'`, `'>=3.2.25 <3.4'`). Core warns, and still loads the
@@ -175,79 +210,12 @@ export type IUIConfig = {
175
210
  */
176
211
  subGroup?: () => React.ReactNode;
177
212
  };
178
- widgets?: {
179
- relationWidgets?: {
180
- name: string;
181
- icon?: React.ElementType;
182
- label?: string;
183
- contentTypes?: string[];
184
- }[];
185
- relationSettingsWidgets?: {
186
- name: string;
187
- icon?: React.ElementType;
188
- label?: string;
189
- }[];
190
- recordPickerWidgets?: {
191
- name: string;
192
- contentType: string;
193
- }[];
194
- recordPanels?: {
195
- contentType: string;
196
- properties?: boolean;
197
- draftTitle?: boolean;
198
- tabs?: {
199
- value: string;
200
- label: string;
201
- labelKey?: string;
202
- icon?: Icon;
203
- after?: 'detail' | 'properties' | 'activity';
204
- }[];
205
- detailPath?: (recordId: string, pathname: string) => string;
206
- }[];
207
- contactWidgets?: {
208
- name: string;
209
- label?: string;
210
- icon?: React.ElementType;
211
- }[];
212
- customerDetailWidgets?: {
213
- name: string;
214
- }[];
215
- dashboardWidgets?: {
216
- name: string;
217
- label: string;
218
- description?: string;
219
- icon?: React.ElementType;
220
- defaultSize: {
221
- w: number;
222
- h: number;
223
- };
224
- minSize?: {
225
- w: number;
226
- h: number;
227
- };
228
- maxSize?: {
229
- w: number;
230
- h: number;
231
- };
232
- configurable?: boolean;
233
- singleton?: boolean;
234
- preview?: TDashboardWidgetPreview;
235
- }[];
236
- formWidgets?: {
237
- name: string;
238
- contentType: string;
239
- icon?: React.ElementType;
240
- }[];
241
- propertyInputs?: Record<string, React.ComponentType<TPropertyInputProps>>;
242
- activityRows?: Record<string, React.ComponentType<TActivityRowProps>>;
243
- };
244
213
  modules?: {
245
214
  name: string;
246
215
  icon?: React.ElementType;
247
216
  path: string;
248
217
  hasAutomation?: boolean;
249
218
  hasRelationWidget?: boolean;
250
- hasFloatingWidget?: boolean;
251
219
  hasSegmentConfigWidget?: boolean;
252
220
  }[];
253
221
  };
@@ -0,0 +1,14 @@
1
+ // src/types/UIConfig.ts
2
+ /** Every schematic the widget catalog can draw for a dashboard widget. */
3
+ const DASHBOARD_WIDGET_PREVIEWS = [
4
+ "bar",
5
+ "line",
6
+ "area",
7
+ "pie",
8
+ "table",
9
+ "list",
10
+ "kpi",
11
+ "heatmap",
12
+ "progress"
13
+ ];
14
+ export { DASHBOARD_WIDGET_PREVIEWS };
package/exports.txt CHANGED
@@ -21,6 +21,8 @@ type CalendarProps
21
21
  type ChartConfig
22
22
  type CompanyContact
23
23
  type ContactQueries
24
+ type ContactSearch
25
+ type ContactSearchQueries
24
26
  type CustomerContact
25
27
  type FileStorageAdapter
26
28
  type IUIConfig
@@ -31,15 +33,17 @@ type PluginLiveMessage
31
33
  type PluginRuntime
32
34
  type PluginSession
33
35
  type RecordListGroup
36
+ type RecordPageProps
37
+ type RecordPanelControls
34
38
  type RecordRef
35
39
  type RecordTableColumnDef
36
40
  type RecordTimelineProps
37
- type TActivityRowProps
38
41
  type TConditionField
39
42
  type TConditionGroup
40
43
  type TConditionLookups
41
44
  type TConditionRule
42
45
  type TContactContentType
46
+ type TDashboardWidget
43
47
  type TDashboardWidgetPreview
44
48
  type TListDisplay
45
49
  type TListFilterField
@@ -47,14 +51,16 @@ type TListFilterProps
47
51
  type TListViews
48
52
  type TPanelRecordType
49
53
  type TPluginListType
50
- type TPropertyInputMeta
51
- type TPropertyInputProps
54
+ type TPluginSettingsPage
55
+ type TPropertyValue
52
56
  type TRecordContacts
53
57
  type TRecordDraftProps
58
+ type TRecordProperties
54
59
  type TRecordSection
55
60
  type TRecordSectionProps
56
61
  type TRecordSlotProps
57
62
  type TRecordTab
63
+ type TRecordTableSort
58
64
  type TRelationTab
59
65
  type TRelationTabProps
60
66
  type TViewTabsProps
@@ -86,6 +92,7 @@ value ConditionsEditor
86
92
  value ContactLink
87
93
  value ContextMenu
88
94
  value CopyText
95
+ value DASHBOARD_WIDGET_PREVIEWS
89
96
  value DateInput
90
97
  value DatePicker
91
98
  value Dialog
@@ -142,6 +149,7 @@ value RadioGroup
142
149
  value RecordList
143
150
  value RecordOpenerProvider
144
151
  value RecordPage
152
+ value RecordPanelProvider
145
153
  value RecordTable
146
154
  value RecordTableInlineCell
147
155
  value RecordTimeline
@@ -227,6 +235,7 @@ value useOpenRecord
227
235
  value usePageHotkey
228
236
  value usePanelExpanded
229
237
  value usePreviousHotkeyScope
238
+ value useRecordPanel
230
239
  value useScopedHotkeys
231
240
  value useTagOptions
232
241
  value useToast
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erxes/ui",
3
- "version": "4.0.0-v2.14",
3
+ "version": "4.0.0-v2.16",
4
4
  "private": false,
5
5
  "description": "erxes design system: UI primitives, layout, hooks and shared frontend state",
6
6
  "license": "AGPL-3.0-only",