@erxes/ui 4.0.0-v2.17 → 4.0.0-v2.18
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 +3 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/modules/pickers/SelectMember.d.ts +16 -1
- package/dist/modules/pickers/SelectMember.js +56 -2
- package/dist/modules/records/ContactLink.js +9 -37
- package/dist/modules/records/MemberLink.d.ts +12 -0
- package/dist/modules/records/MemberLink.js +25 -0
- package/dist/modules/records/RecordChip.d.ts +13 -0
- package/dist/modules/records/RecordChip.js +46 -0
- package/exports.txt +2 -0
- package/package.json +1 -1
package/CATALOG.md
CHANGED
|
@@ -68,6 +68,8 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
|
|
|
68
68
|
- `type ContactSearchQueries { customers, companies }` Where a filter's `customer` and `company` fields search contacts.
|
|
69
69
|
- `type CustomerContact { id, firstName, middleName, lastName, primaryEmail, … }` What a customer reads as: core's `Customer` has these fields and more.
|
|
70
70
|
- `customerTitle(customer)` A customer's name, else its email or phone.
|
|
71
|
+
- `MEMBER_CONTENT_TYPE` The content type core's side panel opens team members as.
|
|
72
|
+
- `<MemberLink memberId members>` A team member as a chip: their avatar and name.
|
|
71
73
|
- `<PanelDescriptionEditor value scope readonly isHTML onSave>` A record's description as a full-size tab.
|
|
72
74
|
- `<PanelDescriptionField label value scope readonly isHTML>` A rich-text description row in the side panel, across its width.
|
|
73
75
|
- `PanelExpansionContext` Provided by the host's record panel; erxes-ui's panel parts read it.
|
|
@@ -116,7 +118,7 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
|
|
|
116
118
|
- `<PhoneField recordId onValueChange onValidationStatusChange primaryPhone phones>` An editable list of a record's phones, each with its own menu.
|
|
117
119
|
- `<PhoneInput value onChange defaultCountry placeholder onEnter>` A phone input with a country flag picker that formats as you type.
|
|
118
120
|
- `RelativeDateDisplay.{Value}` A date as how long ago it was, with the date and time on hover.
|
|
119
|
-
- `SelectMember` The member picker
|
|
121
|
+
- `SelectMember` The member picker: a table cell, a field, or a row opening the member.
|
|
120
122
|
- `<SexDisplay value>` A sex code as its label, or nothing when it is not known.
|
|
121
123
|
- `<SexField value onValueChange>` A searchable list to pick a sex code, for a popover or cell editor.
|
|
122
124
|
- `type Tag { id, name }` A tag as the pickers show one: core's `Tag` has these fields and more.
|
package/dist/index.d.ts
CHANGED
|
@@ -116,6 +116,7 @@ import { PanelLabel } from "./modules/record-panel/PanelLabel.js";
|
|
|
116
116
|
import { PanelSection } from "./modules/record-panel/PanelSection.js";
|
|
117
117
|
import { PanelExpansionContext, usePanelExpanded } from "./modules/record-panel/panelExpansion.js";
|
|
118
118
|
import { ContactLink } from "./modules/records/ContactLink.js";
|
|
119
|
+
import { MEMBER_CONTENT_TYPE, MemberLink } from "./modules/records/MemberLink.js";
|
|
119
120
|
import { CompanyContact, ContactQueries, ContactSearch, ContactSearchQueries, CustomerContact, TContactContentType, companyTitle, customerTitle } from "./modules/records/contacts.js";
|
|
120
121
|
import { RecordOpenerProvider, RecordPage, RecordPageProps, RecordPanelControls, RecordPanelProvider, RecordRef, setRecordPage, useOpenRecord, useRecordPanel } from "./modules/records/openRecord.js";
|
|
121
122
|
import { ThemeOption, themeState } from "./state/themeState.js";
|
|
@@ -130,4 +131,4 @@ import { jsonOf } from "./utils/json.js";
|
|
|
130
131
|
import { PluginLiveMessage, PluginRuntime, PluginSession, getPluginRuntime, pluginFetch, pluginJson, setPluginRuntime, useLiveSignal } from "./utils/plugin-runtime.js";
|
|
131
132
|
import { addPluginStyles } from "./utils/plugin-styles.js";
|
|
132
133
|
import { RecordTimeline, RecordTimelineProps, setRecordTimeline } from "./utils/record-timeline.js";
|
|
133
|
-
export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, type AvatarProps, BackgroundGradientAnimation, Badge, type BadgeProps, Breadcrumb, Button, type ButtonProps, Calendar, type CalendarProps, Card, type ChartConfig, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, type CompanyContact, ConditionsEditor, ContactLink, type ContactQueries, type ContactSearch, type ContactSearchQueries, ContextMenu, CopyText, type CustomerContact, DASHBOARD_WIDGET_PREVIEWS, DateInput, DatePicker, Dialog, DisplayMenu, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, type FileStorageAdapter, Filter, Form, FullNameField, FullNameValue, HoverCard, type IUIConfig, IconComponent, IconPicker, IconTip, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, ListFilter, ListFilterEmpty, ListViewsProvider, LookupPicker, type Member, MemberInline, type MemberQueries, type MultiSelectOption, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PanelDescriptionEditor, PanelDescriptionField, PanelExpansionContext, PanelField, PanelFieldTrigger, PanelFormLayout, PanelFormRow, PanelLabel, PanelSection, PhoneDisplay, PhoneField, PhoneInput, type PluginLiveMessage, type PluginRuntime, type PluginSession, Popover, PopoverScoped, RadioGroup, RecordList, type RecordListGroup, RecordOpenerProvider, RecordPage, type RecordPageProps, type RecordPanelControls, RecordPanelProvider, type RecordRef, RecordTable, type RecordTableColumnDef, RecordTableInlineCell, RecordTimeline, type RecordTimelineProps, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, type TConditionField, type TConditionGroup, type TConditionLookups, type TConditionRule, type TContactContentType, type TDashboardWidget, type TDashboardWidgetPreview, type TListDisplay, type TListDisplayOption, type TListFilterField, type TListFilterProps, type TListViews, type TPanelRecordType, type TPluginListType, type TPluginSettingsPage, type TPropertyValue, type TRecordContacts, type TRecordDraftProps, type TRecordProperties, type TRecordSection, type TRecordSectionProps, type TRecordSlotProps, type TRecordTab, type TRecordTableSort, type TRelationTab, type TRelationTabProps, type TViewTabsProps, TabButton, Table, Tabs, type Tag, type TagsQuery, TextField, TextOverflowTooltip, Textarea, ThemeOption, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, ViewBar, addPluginStyles, amountStep, badgeVariants, buttonVariants, cn, companyTitle, customerTitle, editorText, formatMoney, formatPhoneNumber, formatter, fromAmountInput, getPluginAssetsUrl, getPluginRuntime, isRule, isUndefinedOrNull, jsonOf, listFilterQuery, localTimeZone, memberName, oneOf, pluginFetch, pluginJson, readImage, setFileStorage, setPluginRuntime, setRecordPage, setRecordTimeline, stored, storedFamily, textOf, themeState, toAmountInput, toIsoDay, toast, useConfirm, useFieldControl, useFilterContext, useFocusFirstField, useFormat, useItemKeys, useListDisplay, useListFilterParams, useListViews, useLiveSignal, useMemberOptions, useMembersById, useMoney, useOpenRecord, usePageHotkey, usePanelExpanded, usePreviousHotkeyScope, useRecordPanel, useScopedHotkeys, useTagOptions, useToast, useUpload, zoneOffset };
|
|
134
|
+
export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, type AvatarProps, BackgroundGradientAnimation, Badge, type BadgeProps, Breadcrumb, Button, type ButtonProps, Calendar, type CalendarProps, Card, type ChartConfig, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, type CompanyContact, ConditionsEditor, ContactLink, type ContactQueries, type ContactSearch, type ContactSearchQueries, ContextMenu, CopyText, type CustomerContact, DASHBOARD_WIDGET_PREVIEWS, DateInput, DatePicker, Dialog, DisplayMenu, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, type FileStorageAdapter, Filter, Form, FullNameField, FullNameValue, HoverCard, type IUIConfig, IconComponent, IconPicker, IconTip, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, ListFilter, ListFilterEmpty, ListViewsProvider, LookupPicker, MEMBER_CONTENT_TYPE, type Member, MemberInline, MemberLink, type MemberQueries, type MultiSelectOption, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PanelDescriptionEditor, PanelDescriptionField, PanelExpansionContext, PanelField, PanelFieldTrigger, PanelFormLayout, PanelFormRow, PanelLabel, PanelSection, PhoneDisplay, PhoneField, PhoneInput, type PluginLiveMessage, type PluginRuntime, type PluginSession, Popover, PopoverScoped, RadioGroup, RecordList, type RecordListGroup, RecordOpenerProvider, RecordPage, type RecordPageProps, type RecordPanelControls, RecordPanelProvider, type RecordRef, RecordTable, type RecordTableColumnDef, RecordTableInlineCell, RecordTimeline, type RecordTimelineProps, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, type TConditionField, type TConditionGroup, type TConditionLookups, type TConditionRule, type TContactContentType, type TDashboardWidget, type TDashboardWidgetPreview, type TListDisplay, type TListDisplayOption, type TListFilterField, type TListFilterProps, type TListViews, type TPanelRecordType, type TPluginListType, type TPluginSettingsPage, type TPropertyValue, type TRecordContacts, type TRecordDraftProps, type TRecordProperties, type TRecordSection, type TRecordSectionProps, type TRecordSlotProps, type TRecordTab, type TRecordTableSort, type TRelationTab, type TRelationTabProps, type TViewTabsProps, TabButton, Table, Tabs, type Tag, type TagsQuery, TextField, TextOverflowTooltip, Textarea, ThemeOption, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, ViewBar, addPluginStyles, amountStep, badgeVariants, buttonVariants, cn, companyTitle, customerTitle, editorText, formatMoney, formatPhoneNumber, formatter, fromAmountInput, getPluginAssetsUrl, getPluginRuntime, isRule, isUndefinedOrNull, jsonOf, listFilterQuery, localTimeZone, memberName, oneOf, pluginFetch, pluginJson, readImage, setFileStorage, setPluginRuntime, setRecordPage, setRecordTimeline, stored, storedFamily, textOf, themeState, toAmountInput, toIsoDay, toast, useConfirm, useFieldControl, useFilterContext, useFocusFirstField, useFormat, useItemKeys, useListDisplay, useListFilterParams, useListViews, useLiveSignal, useMemberOptions, useMembersById, useMoney, useOpenRecord, usePageHotkey, usePanelExpanded, usePreviousHotkeyScope, useRecordPanel, useScopedHotkeys, useTagOptions, useToast, useUpload, zoneOffset };
|
package/dist/index.js
CHANGED
|
@@ -112,6 +112,7 @@ import { PanelLabel } from "./modules/record-panel/PanelLabel.js";
|
|
|
112
112
|
import { PanelSection } from "./modules/record-panel/PanelSection.js";
|
|
113
113
|
import { PanelExpansionContext, usePanelExpanded } from "./modules/record-panel/panelExpansion.js";
|
|
114
114
|
import { ContactLink } from "./modules/records/ContactLink.js";
|
|
115
|
+
import { MEMBER_CONTENT_TYPE, MemberLink } from "./modules/records/MemberLink.js";
|
|
115
116
|
import { companyTitle, customerTitle } from "./modules/records/contacts.js";
|
|
116
117
|
import { RecordOpenerProvider, RecordPage, RecordPanelProvider, setRecordPage, useOpenRecord, useRecordPanel } from "./modules/records/openRecord.js";
|
|
117
118
|
import { ThemeOption, themeState } from "./state/themeState.js";
|
|
@@ -126,4 +127,4 @@ import { jsonOf } from "./utils/json.js";
|
|
|
126
127
|
import { getPluginRuntime, pluginFetch, pluginJson, setPluginRuntime, useLiveSignal } from "./utils/plugin-runtime.js";
|
|
127
128
|
import { addPluginStyles } from "./utils/plugin-styles.js";
|
|
128
129
|
import { RecordTimeline, setRecordTimeline } from "./utils/record-timeline.js";
|
|
129
|
-
export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, BackgroundGradientAnimation, Badge, Breadcrumb, Button, Calendar, Card, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, ConditionsEditor, ContactLink, ContextMenu, CopyText, DASHBOARD_WIDGET_PREVIEWS, DateInput, DatePicker, Dialog, DisplayMenu, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, Filter, Form, FullNameField, FullNameValue, HoverCard, IconComponent, IconPicker, IconTip, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, ListFilter, ListFilterEmpty, ListViewsProvider, LookupPicker, MemberInline, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PanelDescriptionEditor, PanelDescriptionField, PanelExpansionContext, PanelField, PanelFieldTrigger, PanelFormLayout, PanelFormRow, PanelLabel, PanelSection, PhoneDisplay, PhoneField, PhoneInput, Popover, PopoverScoped, RadioGroup, RecordList, RecordOpenerProvider, RecordPage, RecordPanelProvider, RecordTable, RecordTableInlineCell, RecordTimeline, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, TabButton, Table, Tabs, TextField, TextOverflowTooltip, Textarea, ThemeOption, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, ViewBar, addPluginStyles, amountStep, badgeVariants, buttonVariants, cn, companyTitle, customerTitle, editorText, formatMoney, formatPhoneNumber, formatter, fromAmountInput, getPluginAssetsUrl, getPluginRuntime, isRule, isUndefinedOrNull, jsonOf, listFilterQuery, localTimeZone, memberName, oneOf, pluginFetch, pluginJson, readImage, setFileStorage, setPluginRuntime, setRecordPage, setRecordTimeline, stored, storedFamily, textOf, themeState, toAmountInput, toIsoDay, toast, useConfirm, useFieldControl, useFilterContext, useFocusFirstField, useFormat, useItemKeys, useListDisplay, useListFilterParams, useListViews, useLiveSignal, useMemberOptions, useMembersById, useMoney, useOpenRecord, usePageHotkey, usePanelExpanded, usePreviousHotkeyScope, useRecordPanel, useScopedHotkeys, useTagOptions, useToast, useUpload, zoneOffset };
|
|
130
|
+
export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, BackgroundGradientAnimation, Badge, Breadcrumb, Button, Calendar, Card, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, ConditionsEditor, ContactLink, ContextMenu, CopyText, DASHBOARD_WIDGET_PREVIEWS, DateInput, DatePicker, Dialog, DisplayMenu, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, Filter, Form, FullNameField, FullNameValue, HoverCard, IconComponent, IconPicker, IconTip, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, ListFilter, ListFilterEmpty, ListViewsProvider, LookupPicker, MEMBER_CONTENT_TYPE, MemberInline, MemberLink, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PanelDescriptionEditor, PanelDescriptionField, PanelExpansionContext, PanelField, PanelFieldTrigger, PanelFormLayout, PanelFormRow, PanelLabel, PanelSection, PhoneDisplay, PhoneField, PhoneInput, Popover, PopoverScoped, RadioGroup, RecordList, RecordOpenerProvider, RecordPage, RecordPanelProvider, RecordTable, RecordTableInlineCell, RecordTimeline, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, TabButton, Table, Tabs, TextField, TextOverflowTooltip, Textarea, ThemeOption, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, ViewBar, addPluginStyles, amountStep, badgeVariants, buttonVariants, cn, companyTitle, customerTitle, editorText, formatMoney, formatPhoneNumber, formatter, fromAmountInput, getPluginAssetsUrl, getPluginRuntime, isRule, isUndefinedOrNull, jsonOf, listFilterQuery, localTimeZone, memberName, oneOf, pluginFetch, pluginJson, readImage, setFileStorage, setPluginRuntime, setRecordPage, setRecordTimeline, stored, storedFamily, textOf, themeState, toAmountInput, toIsoDay, toast, useConfirm, useFieldControl, useFilterContext, useFocusFirstField, useFormat, useItemKeys, useListDisplay, useListFilterParams, useListViews, useLiveSignal, useMemberOptions, useMembersById, useMoney, useOpenRecord, usePageHotkey, usePanelExpanded, usePreviousHotkeyScope, useRecordPanel, useScopedHotkeys, useTagOptions, useToast, useUpload, zoneOffset };
|
|
@@ -33,9 +33,24 @@ declare const SelectMemberInlineCell: ({ ref, value, onValueChange, members, non
|
|
|
33
33
|
} & RefAttributes<ComponentRef<typeof RecordTableInlineCell.Trigger>>) => import("react").JSX.Element;
|
|
34
34
|
/** A member picker button; its other props (an id, `Form.Control`'s aria wiring) go to the button. */
|
|
35
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
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* A record panel's member row: the member as a chip that opens them in core's side panel, and a
|
|
38
|
+
* button, shown on hover, to pick another; with none, "+ Add". Read-only without `onValueChange`.
|
|
39
|
+
*/
|
|
40
|
+
declare const SelectMemberLinked: ({ value, onValueChange, members, noneLabel, scope, addLabel, changeLabel, emptyLabel }: Omit<SelectMemberProps, 'onValueChange' | 'placeholder'> & {
|
|
41
|
+
onValueChange?: (id: string | null) => void;
|
|
42
|
+
scope?: string;
|
|
43
|
+
/** The button's words while no member is picked. */
|
|
44
|
+
addLabel?: string;
|
|
45
|
+
/** The hover button's name for screen readers once one is. */
|
|
46
|
+
changeLabel?: string;
|
|
47
|
+
/** Read-only and empty. */
|
|
48
|
+
emptyLabel?: string;
|
|
49
|
+
}) => import("react").JSX.Element;
|
|
50
|
+
/** The member picker: a table cell, a field, or a row opening the member. */
|
|
37
51
|
export declare const SelectMember: {
|
|
38
52
|
InlineCell: typeof SelectMemberInlineCell;
|
|
39
53
|
Field: typeof SelectMemberField;
|
|
54
|
+
Linked: typeof SelectMemberLinked;
|
|
40
55
|
};
|
|
41
56
|
export {};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { Avatar } from "../../components/avatar.js";
|
|
2
2
|
import { Badge } from "../../components/badge.js";
|
|
3
|
+
import { Button } from "../../components/button.js";
|
|
3
4
|
import { Combobox } from "../../components/combobox.js";
|
|
4
5
|
import { Popover } from "../../components/popover.js";
|
|
5
6
|
import { cn } from "../../lib/utils.js";
|
|
6
7
|
import { readImage } from "../../utils/core.js";
|
|
7
8
|
import { PopoverScoped } from "../hotkey/components/PopoverScoped.js";
|
|
8
9
|
import { RecordTableInlineCell } from "../record-table/components/RecordTableCellInline.js";
|
|
10
|
+
import { MemberLink } from "../records/MemberLink.js";
|
|
9
11
|
import { EntityPicker } from "./EntityPicker.js";
|
|
10
12
|
import { memberName, useMembersById } from "./members.js";
|
|
13
|
+
import { IconPlus } from "@tabler/icons-react";
|
|
11
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
15
|
import { useState } from "react";
|
|
13
16
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -114,9 +117,60 @@ const SelectMemberField = ({ value, onValueChange, members, noneLabel, placehold
|
|
|
114
117
|
}) })]
|
|
115
118
|
});
|
|
116
119
|
};
|
|
117
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* A record panel's member row: the member as a chip that opens them in core's side panel, and a
|
|
122
|
+
* button, shown on hover, to pick another; with none, "+ Add". Read-only without `onValueChange`.
|
|
123
|
+
*/
|
|
124
|
+
const SelectMemberLinked = ({ value, onValueChange, members, noneLabel, scope, addLabel = "Add", changeLabel = "Change", emptyLabel = "Not specified" }) => {
|
|
125
|
+
const [open, setOpen] = useState(false);
|
|
126
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
127
|
+
className: "group/relations flex min-h-7 min-w-0 items-center gap-1 px-1",
|
|
128
|
+
children: [
|
|
129
|
+
value && /* @__PURE__ */ jsx("div", {
|
|
130
|
+
className: "flex min-w-0 overflow-hidden",
|
|
131
|
+
children: /* @__PURE__ */ jsx(MemberLink, {
|
|
132
|
+
memberId: value,
|
|
133
|
+
members
|
|
134
|
+
})
|
|
135
|
+
}),
|
|
136
|
+
!value && !onValueChange && /* @__PURE__ */ jsx("span", {
|
|
137
|
+
className: "px-1 text-xs text-muted-foreground",
|
|
138
|
+
children: emptyLabel
|
|
139
|
+
}),
|
|
140
|
+
onValueChange && /* @__PURE__ */ jsxs(PopoverScoped, {
|
|
141
|
+
scope,
|
|
142
|
+
open,
|
|
143
|
+
onOpenChange: setOpen,
|
|
144
|
+
children: [/* @__PURE__ */ jsxs(Popover.Trigger, {
|
|
145
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
146
|
+
variant: "ghost",
|
|
147
|
+
size: "xs",
|
|
148
|
+
tone: "muted",
|
|
149
|
+
"data-panel-inline": "",
|
|
150
|
+
"aria-label": value ? changeLabel : addLabel,
|
|
151
|
+
className: cn("shrink-0 [&>svg]:size-3.5", value && "opacity-0 group-hover/relations:opacity-100 focus-visible:opacity-100 data-popup-open:opacity-100")
|
|
152
|
+
}),
|
|
153
|
+
children: [/* @__PURE__ */ jsx(IconPlus, { "aria-hidden": "true" }), !value && /* @__PURE__ */ jsx("span", {
|
|
154
|
+
className: "font-normal",
|
|
155
|
+
children: addLabel
|
|
156
|
+
})]
|
|
157
|
+
}), /* @__PURE__ */ jsx(Combobox.Content, { children: /* @__PURE__ */ jsx(MemberList, {
|
|
158
|
+
value,
|
|
159
|
+
members,
|
|
160
|
+
noneLabel,
|
|
161
|
+
onPick: (next) => {
|
|
162
|
+
onValueChange(next);
|
|
163
|
+
setOpen(false);
|
|
164
|
+
}
|
|
165
|
+
}) })]
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
/** The member picker: a table cell, a field, or a row opening the member. */
|
|
118
171
|
const SelectMember = {
|
|
119
172
|
InlineCell: SelectMemberInlineCell,
|
|
120
|
-
Field: SelectMemberField
|
|
173
|
+
Field: SelectMemberField,
|
|
174
|
+
Linked: SelectMemberLinked
|
|
121
175
|
};
|
|
122
176
|
export { MemberInline, SelectMember };
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { Avatar } from "../../components/avatar.js";
|
|
2
|
-
import { Skeleton } from "../../components/skeleton.js";
|
|
3
|
-
import { cn } from "../../lib/utils.js";
|
|
4
|
-
import { readImage } from "../../utils/core.js";
|
|
5
1
|
import { companyTitle, customerTitle } from "./contacts.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { RecordChip } from "./RecordChip.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
4
|
import { useQuery } from "@tanstack/react-query";
|
|
10
5
|
// src/modules/records/ContactLink.tsx
|
|
11
6
|
/** The customer's or company's title and avatar. */
|
|
@@ -32,46 +27,23 @@ const useContact = (contentType, contentId, contacts) => {
|
|
|
32
27
|
error: company.error
|
|
33
28
|
};
|
|
34
29
|
};
|
|
35
|
-
const CHIP = "group/chip inline-flex h-6 max-w-full items-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium";
|
|
36
30
|
/**
|
|
37
31
|
* A customer or company as a chip: its avatar and name. Inside erxes, clicking it opens the
|
|
38
32
|
* record in core's side panel beside the page; elsewhere it is only the name.
|
|
39
33
|
* `contacts` is `contactQueries` from `@erxes/core-contract/client`.
|
|
40
34
|
*/
|
|
41
35
|
const ContactLink = ({ contentType, contentId, contacts, placeholder }) => {
|
|
42
|
-
const { open, canOpen } = useOpenRecord();
|
|
43
36
|
const contact = useContact(contentType, contentId, contacts);
|
|
44
|
-
if (contact.isPending) return /* @__PURE__ */ jsx(Skeleton, {
|
|
45
|
-
radius: "sm",
|
|
46
|
-
className: "h-5 w-20"
|
|
47
|
-
});
|
|
48
37
|
const name = contact.error?.message || contact.title || placeholder || (contentType === "core:customer" ? "Unnamed customer" : "Unnamed company");
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
className: "size-4 flex-none",
|
|
52
|
-
children: [/* @__PURE__ */ jsx(Avatar.Image, { src: readImage(contact.avatarUrl ?? void 0) }), /* @__PURE__ */ jsx(Avatar.Fallback, { children: name.charAt(0) })]
|
|
53
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
54
|
-
className: cn("truncate", contact.error && "text-destructive"),
|
|
55
|
-
children: name
|
|
56
|
-
})] });
|
|
57
|
-
if (!canOpen) return /* @__PURE__ */ jsx("span", {
|
|
58
|
-
title: name,
|
|
59
|
-
className: CHIP,
|
|
60
|
-
children: face
|
|
61
|
-
});
|
|
62
|
-
return /* @__PURE__ */ jsxs("button", {
|
|
63
|
-
type: "button",
|
|
64
|
-
onClick: () => open({
|
|
38
|
+
return /* @__PURE__ */ jsx(RecordChip, {
|
|
39
|
+
record: {
|
|
65
40
|
contentType,
|
|
66
41
|
contentId
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
className: "size-3 flex-none text-muted-foreground opacity-0 transition-opacity group-hover/chip:opacity-100 group-focus-visible/chip:opacity-100",
|
|
73
|
-
"aria-hidden": "true"
|
|
74
|
-
})]
|
|
42
|
+
},
|
|
43
|
+
name,
|
|
44
|
+
avatarUrl: contact.avatarUrl,
|
|
45
|
+
loading: contact.isPending,
|
|
46
|
+
failed: Boolean(contact.error)
|
|
75
47
|
});
|
|
76
48
|
};
|
|
77
49
|
export { ContactLink };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MemberQueries } from "../pickers/members.js";
|
|
2
|
+
/** The content type core's side panel opens team members as. */
|
|
3
|
+
export declare const MEMBER_CONTENT_TYPE = "core:user";
|
|
4
|
+
/**
|
|
5
|
+
* A team member as a chip: their avatar and name. Inside erxes, clicking it opens the member in
|
|
6
|
+
* core's side panel beside the page (their detail and what they did); elsewhere it is only
|
|
7
|
+
* the name. `members` is `memberQueries` from `@erxes/core-contract/client`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MemberLink: ({ memberId, members }: {
|
|
10
|
+
memberId: string;
|
|
11
|
+
members: MemberQueries;
|
|
12
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { memberName, useMembersById } from "../pickers/members.js";
|
|
2
|
+
import { RecordChip } from "./RecordChip.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/modules/records/MemberLink.tsx
|
|
5
|
+
/** The content type core's side panel opens team members as. */
|
|
6
|
+
const MEMBER_CONTENT_TYPE = "core:user";
|
|
7
|
+
/**
|
|
8
|
+
* A team member as a chip: their avatar and name. Inside erxes, clicking it opens the member in
|
|
9
|
+
* core's side panel beside the page (their detail and what they did); elsewhere it is only
|
|
10
|
+
* the name. `members` is `memberQueries` from `@erxes/core-contract/client`.
|
|
11
|
+
*/
|
|
12
|
+
const MemberLink = ({ memberId, members }) => {
|
|
13
|
+
const member = useMembersById([memberId], members).get(memberId);
|
|
14
|
+
return /* @__PURE__ */ jsx(RecordChip, {
|
|
15
|
+
record: {
|
|
16
|
+
contentType: MEMBER_CONTENT_TYPE,
|
|
17
|
+
contentId: memberId
|
|
18
|
+
},
|
|
19
|
+
name: member ? memberName(member) : "",
|
|
20
|
+
avatarUrl: member?.avatarUrl,
|
|
21
|
+
loading: !member,
|
|
22
|
+
failed: false
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export { MEMBER_CONTENT_TYPE, MemberLink };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RecordRef } from "./openRecord.js";
|
|
2
|
+
/**
|
|
3
|
+
* A record as a chip: its avatar and name. Inside erxes, clicking it opens the record in core's
|
|
4
|
+
* side panel beside the page; elsewhere it is only the name. A record that can't be read says
|
|
5
|
+
* why, and still opens to show it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const RecordChip: ({ record, name, avatarUrl, loading, failed }: {
|
|
8
|
+
record: RecordRef;
|
|
9
|
+
name: string;
|
|
10
|
+
avatarUrl: string | null | undefined;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
failed: boolean;
|
|
13
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Avatar } from "../../components/avatar.js";
|
|
2
|
+
import { Skeleton } from "../../components/skeleton.js";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { readImage } from "../../utils/core.js";
|
|
5
|
+
import { useOpenRecord } from "./openRecord.js";
|
|
6
|
+
import { IconArrowUpRight } from "@tabler/icons-react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/modules/records/RecordChip.tsx
|
|
9
|
+
const CHIP = "group/chip inline-flex h-6 max-w-full items-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium";
|
|
10
|
+
/**
|
|
11
|
+
* A record as a chip: its avatar and name. Inside erxes, clicking it opens the record in core's
|
|
12
|
+
* side panel beside the page; elsewhere it is only the name. A record that can't be read says
|
|
13
|
+
* why, and still opens to show it.
|
|
14
|
+
*/
|
|
15
|
+
const RecordChip = ({ record, name, avatarUrl, loading, failed }) => {
|
|
16
|
+
const { open, canOpen } = useOpenRecord();
|
|
17
|
+
if (loading) return /* @__PURE__ */ jsx(Skeleton, {
|
|
18
|
+
radius: "sm",
|
|
19
|
+
className: "h-5 w-20"
|
|
20
|
+
});
|
|
21
|
+
const face = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Avatar, {
|
|
22
|
+
size: "sm",
|
|
23
|
+
className: "size-4 flex-none",
|
|
24
|
+
children: [/* @__PURE__ */ jsx(Avatar.Image, { src: readImage(avatarUrl ?? void 0) }), /* @__PURE__ */ jsx(Avatar.Fallback, { children: name.charAt(0) })]
|
|
25
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
26
|
+
className: cn("truncate", failed && "text-destructive"),
|
|
27
|
+
children: name
|
|
28
|
+
})] });
|
|
29
|
+
if (!canOpen) return /* @__PURE__ */ jsx("span", {
|
|
30
|
+
title: name,
|
|
31
|
+
className: CHIP,
|
|
32
|
+
children: face
|
|
33
|
+
});
|
|
34
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
35
|
+
type: "button",
|
|
36
|
+
onClick: () => open(record),
|
|
37
|
+
title: name,
|
|
38
|
+
"data-panel-inline": "",
|
|
39
|
+
className: cn(CHIP, "hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),
|
|
40
|
+
children: [face, /* @__PURE__ */ jsx(IconArrowUpRight, {
|
|
41
|
+
className: "size-3 flex-none text-muted-foreground opacity-0 transition-opacity group-hover/chip:opacity-100 group-focus-visible/chip:opacity-100",
|
|
42
|
+
"aria-hidden": "true"
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
export { RecordChip };
|
package/exports.txt
CHANGED
|
@@ -125,7 +125,9 @@ value ListFilter
|
|
|
125
125
|
value ListFilterEmpty
|
|
126
126
|
value ListViewsProvider
|
|
127
127
|
value LookupPicker
|
|
128
|
+
value MEMBER_CONTENT_TYPE
|
|
128
129
|
value MemberInline
|
|
130
|
+
value MemberLink
|
|
129
131
|
value MultipleSelector
|
|
130
132
|
value NavigationMenuLinkItem
|
|
131
133
|
value NumberField
|