@erxes/ui 4.0.0-v2.13 → 4.0.0-v2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CATALOG.md +15 -8
- package/README.md +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +4 -3
- package/dist/modules/conditions/ConditionsEditor.d.ts +5 -3
- package/dist/modules/conditions/ConditionsEditor.js +139 -177
- package/dist/modules/conditions/DateEditors.d.ts +8 -0
- package/dist/modules/conditions/DateEditors.js +188 -0
- package/dist/modules/conditions/FieldPicker.d.ts +17 -0
- package/dist/modules/conditions/FieldPicker.js +99 -0
- package/dist/modules/conditions/RuleParts.d.ts +30 -0
- package/dist/modules/conditions/RuleParts.js +78 -0
- package/dist/modules/conditions/RuleRow.d.ts +27 -0
- package/dist/modules/conditions/RuleRow.js +156 -0
- package/dist/modules/conditions/TypedInput.d.ts +13 -0
- package/dist/modules/conditions/TypedInput.js +36 -0
- package/dist/modules/conditions/ValueEditor.d.ts +18 -0
- package/dist/modules/conditions/ValueEditor.js +169 -0
- package/dist/modules/conditions/conditions.d.ts +21 -12
- package/dist/modules/conditions/conditions.js +8 -75
- package/dist/modules/conditions/fieldIcons.d.ts +6 -0
- package/dist/modules/conditions/fieldIcons.js +21 -0
- package/dist/modules/conditions/fieldOptions.d.ts +15 -0
- package/dist/modules/conditions/fieldOptions.js +38 -0
- package/dist/modules/conditions/filterRule.d.ts +45 -0
- package/dist/modules/conditions/filterRule.js +171 -0
- package/dist/modules/conditions/filterText.d.ts +16 -0
- package/dist/modules/conditions/filterText.js +156 -0
- package/dist/modules/filter/components/Filter.d.ts +1 -1
- package/dist/modules/filter/components/Filter.js +1 -1
- package/dist/modules/list/ListFilter.d.ts +22 -10
- package/dist/modules/list/ListFilter.js +53 -20
- package/dist/modules/list/ViewBar.d.ts +2 -0
- package/dist/modules/list/ViewBar.js +21 -10
- package/dist/modules/list/filter/AddFilter.d.ts +10 -0
- package/dist/modules/list/filter/AddFilter.js +140 -0
- package/dist/modules/list/filter/AdvancedPopover.d.ts +8 -0
- package/dist/modules/list/filter/AdvancedPopover.js +103 -0
- package/dist/modules/list/filter/ListFilterBar.d.ts +3 -3
- package/dist/modules/list/filter/ListFilterBar.js +109 -205
- package/dist/modules/list/filter/RuleChips.d.ts +12 -2
- package/dist/modules/list/filter/RuleChips.js +132 -134
- package/dist/modules/list/filter/SearchChip.d.ts +6 -0
- package/dist/modules/list/filter/SearchChip.js +69 -0
- package/dist/modules/list/filter/filterRules.d.ts +15 -40
- package/dist/modules/list/filter/filterRules.js +27 -156
- package/dist/modules/list/filter/listFilterContext.d.ts +25 -18
- package/dist/modules/list/filter/listFilterContext.js +8 -24
- package/dist/modules/list/filter/listFilterQuery.d.ts +4 -0
- package/dist/modules/list/filter/listFilterQuery.js +10 -2
- package/dist/modules/pickers/LookupPicker.d.ts +6 -0
- package/dist/modules/pickers/LookupPicker.js +32 -1
- package/dist/modules/record-list/RecordList.d.ts +2 -1
- package/dist/modules/record-list/RecordList.js +2 -1
- package/dist/modules/record-list/RecordListRoot.d.ts +3 -1
- package/dist/modules/record-list/RecordListRoot.js +53 -37
- package/dist/modules/record-table/components/RecordTableHead.d.ts +7 -2
- package/dist/modules/record-table/components/RecordTableHead.js +73 -6
- package/dist/modules/record-table/components/RecordTableProvider.d.ts +22 -1
- package/dist/modules/record-table/components/RecordTableProvider.js +12 -1
- package/dist/modules/records/contacts.d.ts +18 -0
- package/dist/modules/records/openRecord.d.ts +35 -1
- package/dist/modules/records/openRecord.js +27 -4
- package/dist/theme.css +3 -2
- package/dist/types/UIConfig.d.ts +47 -100
- package/dist/types/UIConfig.js +14 -0
- package/exports.txt +10 -3
- package/package.json +1 -1
- package/dist/modules/conditions/ConditionValueInput.d.ts +0 -10
- package/dist/modules/conditions/ConditionValueInput.js +0 -166
- package/dist/modules/conditions/PathPicker.d.ts +0 -8
- package/dist/modules/conditions/PathPicker.js +0 -56
- package/dist/modules/list/filter/AdvancedFilterDialog.d.ts +0 -5
- package/dist/modules/list/filter/AdvancedFilterDialog.js +0 -52
- package/dist/modules/list/filter/FieldMenus.d.ts +0 -5
- package/dist/modules/list/filter/FieldMenus.js +0 -184
- package/dist/modules/list/filter/fieldIcons.d.ts +0 -7
- package/dist/modules/list/filter/fieldIcons.js +0 -16
|
@@ -10,11 +10,18 @@ const ignore = () => void 0;
|
|
|
10
10
|
* record so Back returns to it. erxes-ui is a Module Federation singleton, so every plugin
|
|
11
11
|
* reads the host's.
|
|
12
12
|
*/
|
|
13
|
-
const RecordOpenerProvider = ({ open, openNew = ignore, children }) => {
|
|
13
|
+
const RecordOpenerProvider = ({ open, openNew = ignore, current = null, dismiss = ignore, children }) => {
|
|
14
14
|
const opener = useMemo(() => ({
|
|
15
15
|
open,
|
|
16
|
-
openNew
|
|
17
|
-
|
|
16
|
+
openNew,
|
|
17
|
+
current,
|
|
18
|
+
dismiss
|
|
19
|
+
}), [
|
|
20
|
+
open,
|
|
21
|
+
openNew,
|
|
22
|
+
current,
|
|
23
|
+
dismiss
|
|
24
|
+
]);
|
|
18
25
|
return /* @__PURE__ */ jsx(RecordOpenerContext, {
|
|
19
26
|
value: opener,
|
|
20
27
|
children
|
|
@@ -27,15 +34,31 @@ const RecordOpenerProvider = ({ open, openNew = ignore, children }) => {
|
|
|
27
34
|
* `openNew('sales:deal', { stageId })` opens a draft that becomes the record on Save. Any
|
|
28
35
|
* type core or an installed plugin registers opens (`IUIConfig.recordTypes`). `canOpen` is
|
|
29
36
|
* false outside erxes (a plugin page rendered on its own), where both do nothing.
|
|
37
|
+
*
|
|
38
|
+
* `current` is the record the panel shows now (null when it shows none or a draft), for a list
|
|
39
|
+
* that marks it or steps to the next (j/k). `dismiss(record)` takes a record out of the panel,
|
|
40
|
+
* shown or behind Back, e.g. one the list just deleted. Inside a record, `useRecordPanel`.
|
|
30
41
|
*/
|
|
31
42
|
const useOpenRecord = () => {
|
|
32
43
|
const opener = use(RecordOpenerContext);
|
|
33
44
|
return {
|
|
34
45
|
open: opener?.open ?? ignore,
|
|
35
46
|
openNew: opener?.openNew ?? ignore,
|
|
47
|
+
current: opener?.current ?? null,
|
|
48
|
+
dismiss: opener?.dismiss ?? ignore,
|
|
36
49
|
canOpen: opener !== null
|
|
37
50
|
};
|
|
38
51
|
};
|
|
52
|
+
const RecordPanelContext = createContext(null);
|
|
53
|
+
/** Web gives each record it shows its controls. */
|
|
54
|
+
const RecordPanelProvider = RecordPanelContext;
|
|
55
|
+
/**
|
|
56
|
+
* The record a slot is in, and what the slot can do to it.
|
|
57
|
+
* Any slot (`Title`, `Actions`, `Detail`, a tab, a relation tab): `const panel = useRecordPanel()`, then `panel?.dismiss()` after a delete,
|
|
58
|
+
* `panel?.replace({ contentType: 'tasks:task', contentId })`, `panel?.setTab('detail')`.
|
|
59
|
+
* Null outside a record (a plugin page on its own).
|
|
60
|
+
*/
|
|
61
|
+
const useRecordPanel = () => use(RecordPanelContext);
|
|
39
62
|
const page = hostComponent();
|
|
40
63
|
/** Web registers how a record draws on its own page. */
|
|
41
64
|
const setRecordPage = page.set;
|
|
@@ -45,4 +68,4 @@ const setRecordPage = page.set;
|
|
|
45
68
|
* routes its record type's `listPath/:id` to `<RecordPage contentType="sales:deal" contentId={id} />`.
|
|
46
69
|
*/
|
|
47
70
|
const RecordPage = page.Host;
|
|
48
|
-
export { RecordOpenerProvider, RecordPage, setRecordPage, useOpenRecord };
|
|
71
|
+
export { RecordOpenerProvider, RecordPage, RecordPanelProvider, setRecordPage, useOpenRecord, useRecordPanel };
|
package/dist/theme.css
CHANGED
|
@@ -126,8 +126,9 @@
|
|
|
126
126
|
--grid-template-columns-field: 6.5rem minmax(0, 1fr);
|
|
127
127
|
/* A side column of 18 to 24rem beside the content. */
|
|
128
128
|
--grid-template-columns-aside: minmax(18rem, 24rem) minmax(0, 1fr);
|
|
129
|
-
/* A condition row: field
|
|
130
|
-
|
|
129
|
+
/* A condition row: "Where", "And" or "Or", the field, the operator, the value, then remove. */
|
|
130
|
+
/* 5.5rem holds the And/Or picker in Mongolian ("Эсвэл"). */
|
|
131
|
+
--grid-template-columns-condition: 5.5rem minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1.2fr) auto;
|
|
131
132
|
|
|
132
133
|
/* Panels and sidebars sliding open or shut. */
|
|
133
134
|
--ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
|
package/dist/types/UIConfig.d.ts
CHANGED
|
@@ -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
|
|
7
|
-
*
|
|
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
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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;
|
|
@@ -135,25 +130,44 @@ export type TRelationTab = {
|
|
|
135
130
|
hosts?: string[];
|
|
136
131
|
component: React.ComponentType<TRelationTabProps>;
|
|
137
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* A plugin's settings page, linked from core's settings sidebar.
|
|
135
|
+
* The page is a route of the plugin's own, under its `path`, e.g. `/frontline/settings/tags`.
|
|
136
|
+
*/
|
|
137
|
+
export type TPluginSettingsPage = {
|
|
138
|
+
/** The page's address, under the plugin's `path`. */
|
|
139
|
+
path: string;
|
|
140
|
+
label: string;
|
|
141
|
+
icon?: React.ElementType;
|
|
142
|
+
};
|
|
138
143
|
/**
|
|
139
144
|
* A plugin UI's `CONFIG`, exported from its `./config` remote.
|
|
140
|
-
* web reads `name`, `path`, `icon`, `modules`, `checkAccess`, `recordSections`, `recordTypes
|
|
141
|
-
* and `
|
|
142
|
-
* erxes 3.x and web ignores them.
|
|
145
|
+
* web reads `name`, `path`, `icon`, `modules`, `checkAccess`, `recordSections`, `recordTypes`,
|
|
146
|
+
* `relationTabs`, `settings`, `dashboardWidgets` and `floatingWidget`; its first module renders
|
|
147
|
+
* under `/<path>/*`. The other fields come from erxes 3.x and web ignores them.
|
|
143
148
|
*/
|
|
144
149
|
export type IUIConfig = {
|
|
145
150
|
name: string;
|
|
146
151
|
path: string;
|
|
147
152
|
icon?: React.ElementType;
|
|
153
|
+
/** The plugin's settings pages, in core's settings sidebar for members who may use the plugin. */
|
|
154
|
+
settings?: TPluginSettingsPage[];
|
|
148
155
|
/** Sections on core's customer and company detail, shown to members who may use the plugin. */
|
|
149
156
|
recordSections?: TRecordSection[];
|
|
150
157
|
/** The plugin's records core's side panel opens, for members who may use the plugin. */
|
|
151
158
|
recordTypes?: TPanelRecordType[];
|
|
152
159
|
/** Tabs on other records' panels listing the plugin's records of their contacts. */
|
|
153
160
|
relationTabs?: TRelationTab[];
|
|
161
|
+
/** Tiles in core's home dashboard catalog, for members who may use the plugin. */
|
|
162
|
+
dashboardWidgets?: TDashboardWidget[];
|
|
163
|
+
/**
|
|
164
|
+
* One component web mounts once beside the app shell, on every page, for members who may use
|
|
165
|
+
* the plugin, and keeps mounted across navigation (a softphone). It sits in the bottom-right
|
|
166
|
+
* corner above the page.
|
|
167
|
+
*/
|
|
168
|
+
floatingWidget?: React.ComponentType;
|
|
154
169
|
i18n?: boolean;
|
|
155
170
|
i18nNamespace?: string;
|
|
156
|
-
hasFloatingWidget?: boolean;
|
|
157
171
|
/**
|
|
158
172
|
* erxes platform versions this plugin is built for, as a semver range
|
|
159
173
|
* (e.g. `'~3.2'`, `'>=3.2.25 <3.4'`). Core warns, and still loads the
|
|
@@ -175,79 +189,12 @@ export type IUIConfig = {
|
|
|
175
189
|
*/
|
|
176
190
|
subGroup?: () => React.ReactNode;
|
|
177
191
|
};
|
|
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
192
|
modules?: {
|
|
245
193
|
name: string;
|
|
246
194
|
icon?: React.ElementType;
|
|
247
195
|
path: string;
|
|
248
196
|
hasAutomation?: boolean;
|
|
249
197
|
hasRelationWidget?: boolean;
|
|
250
|
-
hasFloatingWidget?: boolean;
|
|
251
198
|
hasSegmentConfigWidget?: boolean;
|
|
252
199
|
}[];
|
|
253
200
|
};
|
package/dist/types/UIConfig.js
CHANGED
|
@@ -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,16 @@ type PluginLiveMessage
|
|
|
31
33
|
type PluginRuntime
|
|
32
34
|
type PluginSession
|
|
33
35
|
type RecordListGroup
|
|
36
|
+
type RecordPanelControls
|
|
34
37
|
type RecordRef
|
|
35
38
|
type RecordTableColumnDef
|
|
36
39
|
type RecordTimelineProps
|
|
37
|
-
type TActivityRowProps
|
|
38
40
|
type TConditionField
|
|
39
41
|
type TConditionGroup
|
|
40
42
|
type TConditionLookups
|
|
41
43
|
type TConditionRule
|
|
42
44
|
type TContactContentType
|
|
45
|
+
type TDashboardWidget
|
|
43
46
|
type TDashboardWidgetPreview
|
|
44
47
|
type TListDisplay
|
|
45
48
|
type TListFilterField
|
|
@@ -47,14 +50,14 @@ type TListFilterProps
|
|
|
47
50
|
type TListViews
|
|
48
51
|
type TPanelRecordType
|
|
49
52
|
type TPluginListType
|
|
50
|
-
type
|
|
51
|
-
type TPropertyInputProps
|
|
53
|
+
type TPluginSettingsPage
|
|
52
54
|
type TRecordContacts
|
|
53
55
|
type TRecordDraftProps
|
|
54
56
|
type TRecordSection
|
|
55
57
|
type TRecordSectionProps
|
|
56
58
|
type TRecordSlotProps
|
|
57
59
|
type TRecordTab
|
|
60
|
+
type TRecordTableSort
|
|
58
61
|
type TRelationTab
|
|
59
62
|
type TRelationTabProps
|
|
60
63
|
type TViewTabsProps
|
|
@@ -86,6 +89,7 @@ value ConditionsEditor
|
|
|
86
89
|
value ContactLink
|
|
87
90
|
value ContextMenu
|
|
88
91
|
value CopyText
|
|
92
|
+
value DASHBOARD_WIDGET_PREVIEWS
|
|
89
93
|
value DateInput
|
|
90
94
|
value DatePicker
|
|
91
95
|
value Dialog
|
|
@@ -114,6 +118,7 @@ value Kbd
|
|
|
114
118
|
value LANGUAGES
|
|
115
119
|
value Label
|
|
116
120
|
value ListFilter
|
|
121
|
+
value ListFilterEmpty
|
|
117
122
|
value ListViewsProvider
|
|
118
123
|
value LookupPicker
|
|
119
124
|
value MemberInline
|
|
@@ -141,6 +146,7 @@ value RadioGroup
|
|
|
141
146
|
value RecordList
|
|
142
147
|
value RecordOpenerProvider
|
|
143
148
|
value RecordPage
|
|
149
|
+
value RecordPanelProvider
|
|
144
150
|
value RecordTable
|
|
145
151
|
value RecordTableInlineCell
|
|
146
152
|
value RecordTimeline
|
|
@@ -226,6 +232,7 @@ value useOpenRecord
|
|
|
226
232
|
value usePageHotkey
|
|
227
233
|
value usePanelExpanded
|
|
228
234
|
value usePreviousHotkeyScope
|
|
235
|
+
value useRecordPanel
|
|
229
236
|
value useScopedHotkeys
|
|
230
237
|
value useTagOptions
|
|
231
238
|
value useToast
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { TConditionField, TConditionLookups, TConditionRule } from "./conditions.js";
|
|
2
|
-
type ValueProps = TConditionLookups & {
|
|
3
|
-
rule: TConditionRule;
|
|
4
|
-
field?: TConditionField;
|
|
5
|
-
onChange: (value: unknown) => void;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
};
|
|
8
|
-
/** The value side of a rule, shaped by the operator and the field's type. */
|
|
9
|
-
export declare const ConditionValueInput: (props: ValueProps) => import("react").JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { Input } from "../../components/input.js";
|
|
2
|
-
import { Select } from "../../components/select.js";
|
|
3
|
-
import { amountStep, fromAmountInput, toAmountInput } from "../../lib/money.js";
|
|
4
|
-
import { oneOf, textOf } from "../../lib/text.js";
|
|
5
|
-
import { LookupPicker, useMemberOptions, useTagOptions } from "../pickers/LookupPicker.js";
|
|
6
|
-
import { LIST_VALUE, RELATIVE, RELATIVE_UNITS } from "./conditions.js";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { useState } from "react";
|
|
9
|
-
import { z } from "zod";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
|
-
// src/modules/conditions/ConditionValueInput.tsx
|
|
12
|
-
/** What the rule holds so far: a half-typed amount is still shown. */
|
|
13
|
-
const RelativeValue = z.object({
|
|
14
|
-
amount: z.number().optional(),
|
|
15
|
-
unit: z.enum(RELATIVE_UNITS).optional()
|
|
16
|
-
});
|
|
17
|
-
const RelativeInput = ({ rule, onChange, disabled }) => {
|
|
18
|
-
const { t } = useTranslation("automations");
|
|
19
|
-
const current = RelativeValue.safeParse(rule.value).data ?? {};
|
|
20
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
21
|
-
className: "flex w-full items-center gap-1",
|
|
22
|
-
children: [/* @__PURE__ */ jsx(Input, {
|
|
23
|
-
className: "h-8 w-20",
|
|
24
|
-
type: "number",
|
|
25
|
-
min: 0,
|
|
26
|
-
disabled,
|
|
27
|
-
value: current.amount ?? "",
|
|
28
|
-
onChange: (event) => onChange({
|
|
29
|
-
unit: "days",
|
|
30
|
-
...current,
|
|
31
|
-
amount: Math.max(0, Number(event.target.value) || 0)
|
|
32
|
-
})
|
|
33
|
-
}), rule.op === "anniversary_within" ? /* @__PURE__ */ jsx("span", {
|
|
34
|
-
className: "text-sm text-muted-foreground",
|
|
35
|
-
children: t("days", "days")
|
|
36
|
-
}) : /* @__PURE__ */ jsxs(Select, {
|
|
37
|
-
value: current.unit ?? "days",
|
|
38
|
-
disabled,
|
|
39
|
-
onValueChange: (next) => {
|
|
40
|
-
const unit = oneOf(RELATIVE_UNITS, next);
|
|
41
|
-
if (unit) onChange({
|
|
42
|
-
amount: 0,
|
|
43
|
-
...current,
|
|
44
|
-
unit
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
children: [/* @__PURE__ */ jsx(Select.Trigger, {
|
|
48
|
-
className: "h-8 w-28 shrink-0",
|
|
49
|
-
children: /* @__PURE__ */ jsx(Select.Value, {})
|
|
50
|
-
}), /* @__PURE__ */ jsx(Select.Content, { children: RELATIVE_UNITS.map((unit) => /* @__PURE__ */ jsx(Select.Item, {
|
|
51
|
-
value: unit,
|
|
52
|
-
children: t(unit, unit)
|
|
53
|
-
}, unit)) })]
|
|
54
|
-
})]
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
/** A team member ("me" first) or a tag of the subject. */
|
|
58
|
-
const LookupInput = ({ rule, field, onChange, disabled, ...lookups }) => {
|
|
59
|
-
const { t } = useTranslation("automations");
|
|
60
|
-
const isMember = field?.type === "member";
|
|
61
|
-
const value = textOf(rule.value);
|
|
62
|
-
const members = useMemberOptions(lookups.members, isMember, value ? [value] : []);
|
|
63
|
-
const tags = useTagOptions(lookups.tags, !isMember);
|
|
64
|
-
const lookup = isMember ? members : tags;
|
|
65
|
-
return /* @__PURE__ */ jsx(LookupPicker, {
|
|
66
|
-
lookup: isMember ? {
|
|
67
|
-
...lookup,
|
|
68
|
-
options: [{
|
|
69
|
-
value: "me",
|
|
70
|
-
label: t("me", "Me")
|
|
71
|
-
}, ...lookup.options]
|
|
72
|
-
} : lookup,
|
|
73
|
-
value: value ? [value] : [],
|
|
74
|
-
onValueChange: ([next]) => onChange(next ?? ""),
|
|
75
|
-
disabled,
|
|
76
|
-
placeholder: t("choose", "Choose…"),
|
|
77
|
-
className: "h-8 w-full min-w-0"
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
const ListInput = ({ rule, onChange, disabled }) => {
|
|
81
|
-
const { t } = useTranslation("automations");
|
|
82
|
-
return /* @__PURE__ */ jsx(Input, {
|
|
83
|
-
className: "h-8 w-full min-w-0",
|
|
84
|
-
disabled,
|
|
85
|
-
placeholder: t("list-placeholder", "a, b, c"),
|
|
86
|
-
value: Array.isArray(rule.value) ? rule.value.join(", ") : textOf(rule.value),
|
|
87
|
-
onChange: (event) => onChange(event.target.value.split(",").map((item) => item.trim()).filter(Boolean))
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
const BooleanInput = ({ rule, onChange, disabled }) => {
|
|
91
|
-
const { t } = useTranslation("automations");
|
|
92
|
-
return /* @__PURE__ */ jsxs(Select, {
|
|
93
|
-
value: textOf(rule.value ?? "true"),
|
|
94
|
-
onValueChange: (value) => onChange(value === "true"),
|
|
95
|
-
disabled,
|
|
96
|
-
children: [/* @__PURE__ */ jsx(Select.Trigger, {
|
|
97
|
-
className: "h-8 w-28 shrink-0",
|
|
98
|
-
children: /* @__PURE__ */ jsx(Select.Value, {})
|
|
99
|
-
}), /* @__PURE__ */ jsxs(Select.Content, { children: [/* @__PURE__ */ jsx(Select.Item, {
|
|
100
|
-
value: "true",
|
|
101
|
-
children: t("yes", "yes")
|
|
102
|
-
}), /* @__PURE__ */ jsx(Select.Item, {
|
|
103
|
-
value: "false",
|
|
104
|
-
children: t("no", "no")
|
|
105
|
-
})] })]
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
const OptionInput = ({ rule, options, onChange, disabled }) => /* @__PURE__ */ jsxs(Select, {
|
|
109
|
-
value: textOf(rule.value),
|
|
110
|
-
onValueChange: onChange,
|
|
111
|
-
disabled,
|
|
112
|
-
children: [/* @__PURE__ */ jsx(Select.Trigger, {
|
|
113
|
-
className: "h-8 w-full min-w-0",
|
|
114
|
-
children: /* @__PURE__ */ jsx(Select.Value, {})
|
|
115
|
-
}), /* @__PURE__ */ jsx(Select.Content, { children: options.map((option) => /* @__PURE__ */ jsx(Select.Item, {
|
|
116
|
-
value: option,
|
|
117
|
-
children: option
|
|
118
|
-
}, option)) })]
|
|
119
|
-
});
|
|
120
|
-
const TextInput = ({ rule, field, onChange, disabled }) => {
|
|
121
|
-
const { t } = useTranslation("automations");
|
|
122
|
-
return /* @__PURE__ */ jsx(Input, {
|
|
123
|
-
className: "h-8 w-full min-w-0",
|
|
124
|
-
type: field?.type === "date" ? "date" : field?.type === "number" ? "number" : "text",
|
|
125
|
-
disabled,
|
|
126
|
-
placeholder: t("value-placeholder", "value"),
|
|
127
|
-
value: textOf(rule.value),
|
|
128
|
-
onChange: (event) => onChange(field?.type === "number" ? Number(event.target.value) : event.target.value)
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
/** An amount typed in the currency's major unit (12.50), kept in its smallest (1250); the text is kept while typing. */
|
|
132
|
-
const MoneyInput = ({ rule, onChange, disabled, currency }) => {
|
|
133
|
-
const { t } = useTranslation("automations");
|
|
134
|
-
const stored = Number(rule.value);
|
|
135
|
-
const [text, setText] = useState(rule.value === void 0 || !Number.isFinite(stored) ? "" : toAmountInput(stored, currency));
|
|
136
|
-
return /* @__PURE__ */ jsx(Input, {
|
|
137
|
-
className: "h-8 w-full min-w-0",
|
|
138
|
-
type: "number",
|
|
139
|
-
step: amountStep(currency),
|
|
140
|
-
disabled,
|
|
141
|
-
placeholder: t("value-placeholder", "value"),
|
|
142
|
-
value: text,
|
|
143
|
-
onChange: (event) => {
|
|
144
|
-
setText(event.target.value);
|
|
145
|
-
onChange(fromAmountInput(event.target.value, currency));
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
/** The value side of a rule, shaped by the operator and the field's type. */
|
|
150
|
-
const ConditionValueInput = (props) => {
|
|
151
|
-
const { rule, field } = props;
|
|
152
|
-
if (RELATIVE.has(rule.op)) return /* @__PURE__ */ jsx(RelativeInput, { ...props });
|
|
153
|
-
if (field?.currency && field.type === "number" && !LIST_VALUE.has(rule.op)) return /* @__PURE__ */ jsx(MoneyInput, {
|
|
154
|
-
...props,
|
|
155
|
-
currency: field.currency
|
|
156
|
-
});
|
|
157
|
-
if (LIST_VALUE.has(rule.op)) return /* @__PURE__ */ jsx(ListInput, { ...props });
|
|
158
|
-
if (field?.type === "member" || field?.type === "tags") return /* @__PURE__ */ jsx(LookupInput, { ...props });
|
|
159
|
-
if (field?.type === "boolean") return /* @__PURE__ */ jsx(BooleanInput, { ...props });
|
|
160
|
-
if (field?.options?.length) return /* @__PURE__ */ jsx(OptionInput, {
|
|
161
|
-
...props,
|
|
162
|
-
options: field.options
|
|
163
|
-
});
|
|
164
|
-
return /* @__PURE__ */ jsx(TextInput, { ...props });
|
|
165
|
-
};
|
|
166
|
-
export { ConditionValueInput };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { TConditionField } from "./conditions.js";
|
|
2
|
-
/** A field from the catalog, or any path typed by hand (`event.payload.amount`, `steps.x.output.y`). */
|
|
3
|
-
export declare const PathPicker: ({ value, fields, onChange, disabled }: {
|
|
4
|
-
value: string;
|
|
5
|
-
fields: TConditionField[];
|
|
6
|
-
onChange: (path: string) => void;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}) => import("react").JSX.Element;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Input } from "../../components/input.js";
|
|
2
|
-
import { Select } from "../../components/select.js";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
|
-
// src/modules/conditions/PathPicker.tsx
|
|
6
|
-
const GROUP_LABELS = {
|
|
7
|
-
fields: "Fields",
|
|
8
|
-
lead: "Lead",
|
|
9
|
-
custom: "Properties",
|
|
10
|
-
company: "Company",
|
|
11
|
-
activity: "Activity"
|
|
12
|
-
};
|
|
13
|
-
const CUSTOM_PATH = "__custom__";
|
|
14
|
-
/** A heading per group, and one per `groupLabel` (a plugin's fields under its title). */
|
|
15
|
-
const groupOf = (field) => field.groupLabel ? `label:${field.groupLabel}` : field.group ?? "fields";
|
|
16
|
-
const FieldItems = ({ fields }) => fields.map((field) => /* @__PURE__ */ jsx(Select.Item, {
|
|
17
|
-
value: field.path,
|
|
18
|
-
children: field.label
|
|
19
|
-
}, field.path));
|
|
20
|
-
const GroupedFieldItems = ({ fields }) => {
|
|
21
|
-
const { t } = useTranslation("automations");
|
|
22
|
-
return [...new Set(fields.map(groupOf))].map((group) => {
|
|
23
|
-
const inGroup = fields.filter((field) => groupOf(field) === group);
|
|
24
|
-
const label = inGroup[0]?.groupLabel;
|
|
25
|
-
return /* @__PURE__ */ jsxs(Select.Group, { children: [/* @__PURE__ */ jsx(Select.Label, { children: label ?? t(`field-group.${group}`, GROUP_LABELS[group] ?? group) }), /* @__PURE__ */ jsx(FieldItems, { fields: inGroup })] }, group);
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
/** A field from the catalog, or any path typed by hand (`event.payload.amount`, `steps.x.output.y`). */
|
|
29
|
-
const PathPicker = ({ value, fields, onChange, disabled }) => {
|
|
30
|
-
const { t } = useTranslation("automations");
|
|
31
|
-
const known = fields.some((field) => field.path === value);
|
|
32
|
-
const grouped = fields.some((field) => field.group);
|
|
33
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
34
|
-
className: "flex min-w-0 gap-1",
|
|
35
|
-
children: [/* @__PURE__ */ jsxs(Select, {
|
|
36
|
-
value: known ? value : CUSTOM_PATH,
|
|
37
|
-
onValueChange: (path) => onChange(path === CUSTOM_PATH ? "" : path),
|
|
38
|
-
disabled,
|
|
39
|
-
children: [/* @__PURE__ */ jsx(Select.Trigger, {
|
|
40
|
-
className: "h-8 w-full min-w-0",
|
|
41
|
-
children: /* @__PURE__ */ jsx(Select.Value, {})
|
|
42
|
-
}), /* @__PURE__ */ jsxs(Select.Content, { children: [grouped ? /* @__PURE__ */ jsx(GroupedFieldItems, { fields }) : /* @__PURE__ */ jsx(FieldItems, { fields }), !grouped && /* @__PURE__ */ jsx(Select.Item, {
|
|
43
|
-
value: CUSTOM_PATH,
|
|
44
|
-
children: t("custom-path", "Another value…")
|
|
45
|
-
})] })]
|
|
46
|
-
}), !known && /* @__PURE__ */ jsx(Input, {
|
|
47
|
-
text: "code",
|
|
48
|
-
className: "h-8 w-full min-w-0",
|
|
49
|
-
placeholder: "event.payload.amount",
|
|
50
|
-
value,
|
|
51
|
-
disabled,
|
|
52
|
-
onChange: (event) => onChange(event.target.value)
|
|
53
|
-
})]
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
export { PathPicker };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Button } from "../../../components/button.js";
|
|
2
|
-
import { Dialog } from "../../../components/dialog.js";
|
|
3
|
-
import { ConditionsEditor } from "../../conditions/ConditionsEditor.js";
|
|
4
|
-
import { useListFilter } from "./listFilterContext.js";
|
|
5
|
-
import { useListConditions } from "./listFilterQuery.js";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { useState } from "react";
|
|
8
|
-
import { useTranslation } from "react-i18next";
|
|
9
|
-
// src/modules/list/filter/AdvancedFilterDialog.tsx
|
|
10
|
-
/** Mounted each time the dialog opens, so the draft starts from the list's filter. */
|
|
11
|
-
const AdvancedFilterForm = ({ onDone }) => {
|
|
12
|
-
const { t } = useTranslation("views", { keyPrefix: "filter" });
|
|
13
|
-
const { fields, lookups } = useListFilter();
|
|
14
|
-
const { advanced, setAdvanced } = useListConditions();
|
|
15
|
-
const [draft, setDraft] = useState(advanced);
|
|
16
|
-
const apply = (next) => {
|
|
17
|
-
setAdvanced(next);
|
|
18
|
-
onDone();
|
|
19
|
-
};
|
|
20
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ConditionsEditor, {
|
|
21
|
-
fields: fields.map(({ options, ...field }) => ({
|
|
22
|
-
...field,
|
|
23
|
-
options: options?.map((option) => option.value)
|
|
24
|
-
})),
|
|
25
|
-
...lookups,
|
|
26
|
-
value: draft ?? void 0,
|
|
27
|
-
onChange: (next) => setDraft(next ?? null)
|
|
28
|
-
}), /* @__PURE__ */ jsxs(Dialog.Footer, { children: [/* @__PURE__ */ jsx(Button, {
|
|
29
|
-
variant: "ghost",
|
|
30
|
-
onClick: () => apply(null),
|
|
31
|
-
children: t("clear", "Clear")
|
|
32
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
33
|
-
onClick: () => apply(draft),
|
|
34
|
-
children: t("apply", "Apply")
|
|
35
|
-
})] })] });
|
|
36
|
-
};
|
|
37
|
-
/** The full builder (every field, and/or groups), for what the filter menu can't say. */
|
|
38
|
-
const AdvancedFilterDialog = ({ open, onOpenChange }) => {
|
|
39
|
-
const { t } = useTranslation("views", { keyPrefix: "filter" });
|
|
40
|
-
return /* @__PURE__ */ jsx(Dialog, {
|
|
41
|
-
open,
|
|
42
|
-
onOpenChange,
|
|
43
|
-
children: /* @__PURE__ */ jsxs(Dialog.Content, {
|
|
44
|
-
className: "sm:max-w-3xl",
|
|
45
|
-
children: [/* @__PURE__ */ jsx(Dialog.HeaderCombined, {
|
|
46
|
-
title: t("advanced", "Advanced filter"),
|
|
47
|
-
description: t("advanced-title", "Show records where")
|
|
48
|
-
}), /* @__PURE__ */ jsx(AdvancedFilterForm, { onDone: () => onOpenChange(false) })]
|
|
49
|
-
})
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
export { AdvancedFilterDialog };
|