@erxes/ui 4.0.0-v2.5 → 4.0.0-v2.7
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/README.md +13 -0
- package/dist/components/icon-tip.d.ts +7 -0
- package/dist/components/icon-tip.js +16 -0
- package/dist/hooks/use-page-hotkey.d.ts +11 -0
- package/dist/hooks/use-page-hotkey.js +21 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +16 -1
- package/dist/modules/list/DisplayMenu.d.ts +13 -0
- package/dist/modules/list/DisplayMenu.js +66 -0
- package/dist/modules/list/ListFilter.d.ts +44 -0
- package/dist/modules/list/ListFilter.js +39 -0
- package/dist/modules/list/ViewBar.d.ts +13 -0
- package/dist/modules/list/ViewBar.js +30 -0
- package/dist/modules/record-panel/PanelDescriptionEditor.d.ts +9 -0
- package/dist/modules/record-panel/PanelDescriptionEditor.js +39 -0
- package/dist/modules/record-panel/PanelDescriptionField.d.ts +9 -0
- package/dist/modules/record-panel/PanelDescriptionField.js +35 -0
- package/dist/modules/record-panel/PanelField.d.ts +11 -0
- package/dist/modules/record-panel/PanelField.js +41 -0
- package/dist/modules/record-panel/PanelForm.d.ts +22 -0
- package/dist/modules/record-panel/PanelForm.js +81 -0
- package/dist/modules/record-panel/PanelLabel.d.ts +5 -0
- package/dist/modules/record-panel/PanelLabel.js +50 -0
- package/dist/modules/record-panel/PanelSection.d.ts +9 -0
- package/dist/modules/record-panel/PanelSection.js +21 -0
- package/dist/modules/record-panel/panelExpansion.d.ts +10 -0
- package/dist/modules/record-panel/panelExpansion.js +7 -0
- package/dist/modules/record-panel/useSaveOnLeave.d.ts +14 -0
- package/dist/modules/record-panel/useSaveOnLeave.js +42 -0
- package/dist/modules/records/ContactLink.d.ts +13 -0
- package/dist/modules/records/ContactLink.js +77 -0
- package/dist/modules/records/contacts.d.ts +35 -0
- package/dist/modules/records/contacts.js +10 -0
- package/dist/modules/records/openRecord.d.ts +39 -0
- package/dist/modules/records/openRecord.js +46 -0
- package/dist/types/UIConfig.d.ts +101 -0
- package/dist/utils/host-component.d.ts +10 -0
- package/dist/utils/host-component.js +34 -0
- package/dist/utils/plugin-runtime.d.ts +3 -1
- package/dist/utils/plugin-runtime.js +51 -9
- package/dist/utils/record-timeline.d.ts +2 -4
- package/dist/utils/record-timeline.js +4 -17
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -30,6 +30,19 @@ Only what something uses:
|
|
|
30
30
|
- the pickers in `src/modules/pickers`: `EntityPicker`, and `SelectMember`, `MemberInline` and
|
|
31
31
|
`useMembersById`, which take `memberQueries` from `@erxes/core-contract/client`. They read
|
|
32
32
|
through TanStack query options, so erxes-ui imports nothing from core.
|
|
33
|
+
- core's records in `src/modules/records`: `ContactLink` (a customer or company by id, read
|
|
34
|
+
through `contactQueries` from `@erxes/core-contract/client`) and `useOpenRecord`, which open a
|
|
35
|
+
record or a draft in web's side panel through the `RecordOpenerProvider` web mounts, and
|
|
36
|
+
`RecordPage`, a record on its own page.
|
|
37
|
+
- the record panel's rows in `src/modules/record-panel`, which web's side panel and the slots
|
|
38
|
+
of a plugin's record types (`IUIConfig.recordTypes`) both fill it with: `PanelSection`,
|
|
39
|
+
`PanelField`, `PanelFormRow`, `PanelFormLayout`, `PanelLabel`, the description field and
|
|
40
|
+
editor, and `usePanelExpanded`. The panel itself (header, tabs, resize) is web's.
|
|
41
|
+
- a list's bar in `src/modules/list`: `ViewBar`, `DisplayMenu` with `useListDisplay`, and
|
|
42
|
+
`ListFilter` with `useListFilterParams`.
|
|
43
|
+
- what the host app provides at startup, rendered through `hostComponent`
|
|
44
|
+
(`src/utils/host-component.tsx`): `setRecordTimeline`, `setRecordPage` and `setListFilter`.
|
|
45
|
+
Outside erxes they render nothing.
|
|
33
46
|
|
|
34
47
|
Anything else is removed, not kept "in case". Before you remove an export, check the HR plugin
|
|
35
48
|
UI and `.agents/skills/plugin-contract/SKILL.md`.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
/** The hover label of an icon-only button, with its shortcut when it has one. */
|
|
3
|
+
export declare const IconTip: ({ label, hotkey, children }: {
|
|
4
|
+
label: string;
|
|
5
|
+
hotkey?: string;
|
|
6
|
+
children: ReactElement;
|
|
7
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Kbd } from "./kbd.js";
|
|
2
|
+
import { Tooltip } from "./tooltip.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/icon-tip.tsx
|
|
5
|
+
/** The hover label of an icon-only button, with its shortcut when it has one. */
|
|
6
|
+
const IconTip = ({ label, hotkey, children }) => /* @__PURE__ */ jsx(Tooltip.Provider, {
|
|
7
|
+
delay: 300,
|
|
8
|
+
children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(Tooltip.Trigger, { render: children }), /* @__PURE__ */ jsx(Tooltip.Content, {
|
|
9
|
+
side: "bottom",
|
|
10
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
11
|
+
className: "flex items-center gap-1.5",
|
|
12
|
+
children: [label, hotkey && /* @__PURE__ */ jsx(Kbd, { children: hotkey })]
|
|
13
|
+
})
|
|
14
|
+
})] })
|
|
15
|
+
});
|
|
16
|
+
export { IconTip };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Keys } from "react-hotkeys-hook";
|
|
2
|
+
/**
|
|
3
|
+
* A page shortcut (`c` adds, `f` filters, `/` focuses the description, `mod+shift+enter`
|
|
4
|
+
* expands the panel): runs `action` unless someone is typing or a dialog or menu is open.
|
|
5
|
+
* `when` decides per key press whether this hook takes it at all, so another one may.
|
|
6
|
+
* `useKey` matches the character typed instead of the key's position (`/` on any layout).
|
|
7
|
+
*/
|
|
8
|
+
export declare const usePageHotkey: (keys: Keys, action: () => void, { when, useKey }?: {
|
|
9
|
+
when?: () => boolean;
|
|
10
|
+
useKey?: boolean;
|
|
11
|
+
}) => import("react").RefCallback<HTMLElement | null>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useHotkeys } from "react-hotkeys-hook";
|
|
2
|
+
// src/hooks/use-page-hotkey.ts
|
|
3
|
+
const OVERLAY = "[role=\"dialog\"], [role=\"alertdialog\"], [role=\"menu\"], [role=\"listbox\"]";
|
|
4
|
+
/**
|
|
5
|
+
* Keys meant for something else: a repeat, an IME composition, a key a handler already took,
|
|
6
|
+
* one typed into a text box, or any key while an overlay is shown. react-hotkeys-hook already
|
|
7
|
+
* skips inputs, textareas, selects and contenteditable editors.
|
|
8
|
+
*/
|
|
9
|
+
const meantElsewhere = (event) => event.repeat || event.isComposing || event.defaultPrevented || event.target instanceof Element && event.target.closest("[role=\"textbox\"]") !== null || Array.from(document.querySelectorAll(OVERLAY)).some((overlay) => overlay.getClientRects().length > 0);
|
|
10
|
+
/**
|
|
11
|
+
* A page shortcut (`c` adds, `f` filters, `/` focuses the description, `mod+shift+enter`
|
|
12
|
+
* expands the panel): runs `action` unless someone is typing or a dialog or menu is open.
|
|
13
|
+
* `when` decides per key press whether this hook takes it at all, so another one may.
|
|
14
|
+
* `useKey` matches the character typed instead of the key's position (`/` on any layout).
|
|
15
|
+
*/
|
|
16
|
+
const usePageHotkey = (keys, action, { when, useKey } = {}) => useHotkeys(keys, action, {
|
|
17
|
+
useKey,
|
|
18
|
+
preventDefault: true,
|
|
19
|
+
ignoreEventWhen: (event) => meantElsewhere(event) || when?.() === false
|
|
20
|
+
});
|
|
21
|
+
export { usePageHotkey };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ import { DropdownMenu } from "./components/dropdown-menu.js";
|
|
|
27
27
|
import { Empty } from "./components/empty.js";
|
|
28
28
|
import { Form } from "./components/form.js";
|
|
29
29
|
import { HoverCard } from "./components/hover-card.js";
|
|
30
|
+
import { IconTip } from "./components/icon-tip.js";
|
|
30
31
|
import { InfoCard } from "./components/info-card.js";
|
|
31
32
|
import { Input } from "./components/input.js";
|
|
32
33
|
import { InputGroup } from "./components/input-group.js";
|
|
@@ -55,6 +56,7 @@ import { Toggle } from "./components/toggle.js";
|
|
|
55
56
|
import { Tooltip } from "./components/tooltip.js";
|
|
56
57
|
import { Upload } from "./components/upload.js";
|
|
57
58
|
import { useConfirm } from "./hooks/use-confirm.js";
|
|
59
|
+
import { usePageHotkey } from "./hooks/use-page-hotkey.js";
|
|
58
60
|
import { toast, useToast } from "./hooks/use-toast.js";
|
|
59
61
|
import { useUpload } from "./hooks/use-upload.js";
|
|
60
62
|
import { cn } from "./lib/utils.js";
|
|
@@ -92,9 +94,22 @@ import { RecordTable } from "./modules/record-table/components/RecordTable.js";
|
|
|
92
94
|
import { RecordTableColumnDef } from "./modules/record-table/components/RecordTableProvider.js";
|
|
93
95
|
import { RecordTableInlineCell } from "./modules/record-table/components/RecordTableCellInline.js";
|
|
94
96
|
import { EnumCursorDirection } from "./modules/record-table/types/RecordTableCursorTypes.js";
|
|
97
|
+
import { DisplayMenu, TListDisplay, useListDisplay } from "./modules/list/DisplayMenu.js";
|
|
98
|
+
import { ListFilter, TListFilterField, TListFilterProps, setListFilter, useListFilterParams } from "./modules/list/ListFilter.js";
|
|
99
|
+
import { ViewBar } from "./modules/list/ViewBar.js";
|
|
100
|
+
import { PanelDescriptionEditor } from "./modules/record-panel/PanelDescriptionEditor.js";
|
|
101
|
+
import { PanelDescriptionField } from "./modules/record-panel/PanelDescriptionField.js";
|
|
102
|
+
import { PanelField, PanelFieldTrigger } from "./modules/record-panel/PanelField.js";
|
|
103
|
+
import { PanelFormLayout, PanelFormRow } from "./modules/record-panel/PanelForm.js";
|
|
104
|
+
import { PanelLabel } from "./modules/record-panel/PanelLabel.js";
|
|
105
|
+
import { PanelSection } from "./modules/record-panel/PanelSection.js";
|
|
106
|
+
import { PanelExpansionContext, usePanelExpanded } from "./modules/record-panel/panelExpansion.js";
|
|
107
|
+
import { ContactLink } from "./modules/records/ContactLink.js";
|
|
108
|
+
import { CompanyContact, ContactQueries, CustomerContact, TContactContentType, companyTitle, customerTitle } from "./modules/records/contacts.js";
|
|
109
|
+
import { RecordOpenerProvider, RecordPage, RecordRef, setRecordPage, useOpenRecord } from "./modules/records/openRecord.js";
|
|
95
110
|
import { ThemeOption, themeState } from "./state/themeState.js";
|
|
96
111
|
import { SexCode } from "./types/SexCode.js";
|
|
97
|
-
import { IUIConfig, TActivityRowProps, TDashboardWidgetPreview, TPropertyInputMeta, TPropertyInputProps } from "./types/UIConfig.js";
|
|
112
|
+
import { IUIConfig, TActivityRowProps, TDashboardWidgetPreview, TPanelRecordType, TPropertyInputMeta, TPropertyInputProps, TRecordContacts, TRecordDraftProps, TRecordSection, TRecordSectionProps, TRecordSlotProps, TRecordTab, TRelationTab, TRelationTabProps } from "./types/UIConfig.js";
|
|
98
113
|
import { isUndefinedOrNull } from "./utils/IsUndefinedOrNull.js";
|
|
99
114
|
import { readImage } from "./utils/core.js";
|
|
100
115
|
import { FileStorageAdapter, setFileStorage } from "./utils/file-storage.js";
|
|
@@ -104,4 +119,4 @@ import { jsonOf } from "./utils/json.js";
|
|
|
104
119
|
import { PluginLiveMessage, PluginRuntime, PluginSession, getPluginRuntime, pluginFetch, pluginJson, setPluginRuntime, useLiveSignal } from "./utils/plugin-runtime.js";
|
|
105
120
|
import { addPluginStyles } from "./utils/plugin-styles.js";
|
|
106
121
|
import { RecordTimeline, RecordTimelineProps, setRecordTimeline } from "./utils/record-timeline.js";
|
|
107
|
-
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, ContextMenu, CopyText, DateInput, DatePicker, Dialog, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, type FileStorageAdapter, Filter, Form, FullNameField, FullNameValue, HoverCard, type IUIConfig, IconComponent, IconPicker, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, type Member, MemberInline, type MemberQueries, type MultiSelectOption, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PhoneDisplay, PhoneField, PhoneInput, type PluginLiveMessage, type PluginRuntime, type PluginSession, Popover, PopoverScoped, RadioGroup, RecordTable, type RecordTableColumnDef, RecordTableInlineCell, RecordTimeline, type RecordTimelineProps, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, type TActivityRowProps, type TDashboardWidgetPreview, type TPropertyInputMeta, type TPropertyInputProps, TabButton, Table, Tabs, TextField, TextOverflowTooltip, Textarea, ThemeOption, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, addPluginStyles, badgeVariants, buttonVariants, cn, editorText, formatPhoneNumber, formatter, getPluginAssetsUrl, getPluginRuntime, isUndefinedOrNull, jsonOf, localTimeZone, memberName, pluginFetch, pluginJson, readImage, setFileStorage, setPluginRuntime, setRecordTimeline, stored, storedFamily, themeState, toIsoDay, toast, useConfirm, useFilterContext, useFormat, useLiveSignal, useMembersById, usePreviousHotkeyScope, useScopedHotkeys, useToast, useUpload, zoneOffset };
|
|
122
|
+
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, ContactLink, type ContactQueries, ContextMenu, CopyText, type CustomerContact, DateInput, DatePicker, Dialog, DisplayMenu, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, type FileStorageAdapter, Filter, Form, FullNameField, FullNameValue, HoverCard, type IUIConfig, IconComponent, IconPicker, IconTip, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, ListFilter, 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, RecordOpenerProvider, RecordPage, type RecordRef, RecordTable, type RecordTableColumnDef, RecordTableInlineCell, RecordTimeline, type RecordTimelineProps, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, type TActivityRowProps, type TContactContentType, type TDashboardWidgetPreview, type TListDisplay, type TListFilterField, type TListFilterProps, type TPanelRecordType, type TPropertyInputMeta, type TPropertyInputProps, type TRecordContacts, type TRecordDraftProps, type TRecordSection, type TRecordSectionProps, type TRecordSlotProps, type TRecordTab, type TRelationTab, type TRelationTabProps, TabButton, Table, Tabs, TextField, TextOverflowTooltip, Textarea, ThemeOption, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, ViewBar, addPluginStyles, badgeVariants, buttonVariants, cn, companyTitle, customerTitle, editorText, formatPhoneNumber, formatter, getPluginAssetsUrl, getPluginRuntime, isUndefinedOrNull, jsonOf, localTimeZone, memberName, pluginFetch, pluginJson, readImage, setFileStorage, setListFilter, setPluginRuntime, setRecordPage, setRecordTimeline, stored, storedFamily, themeState, toIsoDay, toast, useConfirm, useFilterContext, useFormat, useListDisplay, useListFilterParams, useLiveSignal, useMembersById, useOpenRecord, usePageHotkey, usePanelExpanded, usePreviousHotkeyScope, useScopedHotkeys, useToast, useUpload, zoneOffset };
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import { DropdownMenu } from "./components/dropdown-menu.js";
|
|
|
26
26
|
import { Empty } from "./components/empty.js";
|
|
27
27
|
import { Form } from "./components/form.js";
|
|
28
28
|
import { HoverCard } from "./components/hover-card.js";
|
|
29
|
+
import { IconTip } from "./components/icon-tip.js";
|
|
29
30
|
import { InfoCard } from "./components/info-card.js";
|
|
30
31
|
import { Input } from "./components/input.js";
|
|
31
32
|
import { InputGroup } from "./components/input-group.js";
|
|
@@ -53,6 +54,7 @@ import { Toggle } from "./components/toggle.js";
|
|
|
53
54
|
import { Tooltip } from "./components/tooltip.js";
|
|
54
55
|
import { Upload } from "./components/upload.js";
|
|
55
56
|
import { useConfirm } from "./hooks/use-confirm.js";
|
|
57
|
+
import { usePageHotkey } from "./hooks/use-page-hotkey.js";
|
|
56
58
|
import { toast, useToast } from "./hooks/use-toast.js";
|
|
57
59
|
import { useUpload } from "./hooks/use-upload.js";
|
|
58
60
|
import { cn } from "./lib/utils.js";
|
|
@@ -89,6 +91,19 @@ import { PhoneInput } from "./modules/record-field/meta-inputs/components/PhoneI
|
|
|
89
91
|
import { RecordTable } from "./modules/record-table/components/RecordTable.js";
|
|
90
92
|
import { RecordTableInlineCell } from "./modules/record-table/components/RecordTableCellInline.js";
|
|
91
93
|
import { EnumCursorDirection } from "./modules/record-table/types/RecordTableCursorTypes.js";
|
|
94
|
+
import { DisplayMenu, useListDisplay } from "./modules/list/DisplayMenu.js";
|
|
95
|
+
import { ListFilter, setListFilter, useListFilterParams } from "./modules/list/ListFilter.js";
|
|
96
|
+
import { ViewBar } from "./modules/list/ViewBar.js";
|
|
97
|
+
import { PanelDescriptionEditor } from "./modules/record-panel/PanelDescriptionEditor.js";
|
|
98
|
+
import { PanelDescriptionField } from "./modules/record-panel/PanelDescriptionField.js";
|
|
99
|
+
import { PanelField, PanelFieldTrigger } from "./modules/record-panel/PanelField.js";
|
|
100
|
+
import { PanelFormLayout, PanelFormRow } from "./modules/record-panel/PanelForm.js";
|
|
101
|
+
import { PanelLabel } from "./modules/record-panel/PanelLabel.js";
|
|
102
|
+
import { PanelSection } from "./modules/record-panel/PanelSection.js";
|
|
103
|
+
import { PanelExpansionContext, usePanelExpanded } from "./modules/record-panel/panelExpansion.js";
|
|
104
|
+
import { ContactLink } from "./modules/records/ContactLink.js";
|
|
105
|
+
import { companyTitle, customerTitle } from "./modules/records/contacts.js";
|
|
106
|
+
import { RecordOpenerProvider, RecordPage, setRecordPage, useOpenRecord } from "./modules/records/openRecord.js";
|
|
92
107
|
import { ThemeOption, themeState } from "./state/themeState.js";
|
|
93
108
|
import { SexCode } from "./types/SexCode.js";
|
|
94
109
|
import { isUndefinedOrNull } from "./utils/IsUndefinedOrNull.js";
|
|
@@ -100,4 +115,4 @@ import { jsonOf } from "./utils/json.js";
|
|
|
100
115
|
import { getPluginRuntime, pluginFetch, pluginJson, setPluginRuntime, useLiveSignal } from "./utils/plugin-runtime.js";
|
|
101
116
|
import { addPluginStyles } from "./utils/plugin-styles.js";
|
|
102
117
|
import { RecordTimeline, setRecordTimeline } from "./utils/record-timeline.js";
|
|
103
|
-
export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, BackgroundGradientAnimation, Badge, Breadcrumb, Button, Calendar, Card, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, ContextMenu, CopyText, DateInput, DatePicker, Dialog, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, Filter, Form, FullNameField, FullNameValue, HoverCard, IconComponent, IconPicker, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, MemberInline, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PhoneDisplay, PhoneField, PhoneInput, Popover, PopoverScoped, RadioGroup, 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, addPluginStyles, badgeVariants, buttonVariants, cn, editorText, formatPhoneNumber, formatter, getPluginAssetsUrl, getPluginRuntime, isUndefinedOrNull, jsonOf, localTimeZone, memberName, pluginFetch, pluginJson, readImage, setFileStorage, setPluginRuntime, setRecordTimeline, stored, storedFamily, themeState, toIsoDay, toast, useConfirm, useFilterContext, useFormat, useLiveSignal, useMembersById, usePreviousHotkeyScope, useScopedHotkeys, useToast, useUpload, zoneOffset };
|
|
118
|
+
export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, BackgroundGradientAnimation, Badge, Breadcrumb, Button, Calendar, Card, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, ContactLink, ContextMenu, CopyText, DateInput, DatePicker, Dialog, DisplayMenu, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, Filter, Form, FullNameField, FullNameValue, HoverCard, IconComponent, IconPicker, IconTip, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, ListFilter, MemberInline, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PanelDescriptionEditor, PanelDescriptionField, PanelExpansionContext, PanelField, PanelFieldTrigger, PanelFormLayout, PanelFormRow, PanelLabel, PanelSection, PhoneDisplay, PhoneField, PhoneInput, Popover, PopoverScoped, RadioGroup, RecordOpenerProvider, RecordPage, RecordTable, RecordTableInlineCell, RecordTimeline, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, TabButton, Table, Tabs, TextField, TextOverflowTooltip, Textarea, ThemeOption, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, ViewBar, addPluginStyles, badgeVariants, buttonVariants, cn, companyTitle, customerTitle, editorText, formatPhoneNumber, formatter, getPluginAssetsUrl, getPluginRuntime, isUndefinedOrNull, jsonOf, localTimeZone, memberName, pluginFetch, pluginJson, readImage, setFileStorage, setListFilter, setPluginRuntime, setRecordPage, setRecordTimeline, stored, storedFamily, themeState, toIsoDay, toast, useConfirm, useFilterContext, useFormat, useListDisplay, useListFilterParams, useLiveSignal, useMembersById, useOpenRecord, usePageHotkey, usePanelExpanded, usePreviousHotkeyScope, useScopedHotkeys, useToast, useUpload, zoneOffset };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const LIST_DISPLAYS: readonly ['table', 'board'];
|
|
2
|
+
/** How a list shows its records: rows in a table, or cards on a board. */
|
|
3
|
+
export type TListDisplay = (typeof LIST_DISPLAYS)[number];
|
|
4
|
+
/**
|
|
5
|
+
* `const [display] = useListDisplay('sales-deals')`: the table or board a list shows, chosen
|
|
6
|
+
* under its Display menu and remembered in this browser, one choice per list.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useListDisplay: (list: string) => ["board" | "table", (args_0: "board" | "table" | typeof import("jotai/utils").RESET | ((prev: "board" | "table") => "board" | "table" | typeof import("jotai/utils").RESET)) => void];
|
|
9
|
+
/** "Display" in a list's filter bar: table or board (`useListDisplay(list)` reads the choice). */
|
|
10
|
+
export declare const DisplayMenu: ({ list }: {
|
|
11
|
+
list: string;
|
|
12
|
+
}) => import("react").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Button } from "../../components/button.js";
|
|
2
|
+
import { IconTip } from "../../components/icon-tip.js";
|
|
3
|
+
import { Popover } from "../../components/popover.js";
|
|
4
|
+
import { storedFamily } from "../../lib/stored.js";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
|
+
import { IconAdjustmentsHorizontal, IconLayoutKanban, IconTable } from "@tabler/icons-react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useAtom } from "jotai";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { useTranslation } from "react-i18next";
|
|
11
|
+
// src/modules/list/DisplayMenu.tsx
|
|
12
|
+
const listDisplayFamily = storedFamily({
|
|
13
|
+
key: "erxes:list-display",
|
|
14
|
+
schema: z.enum(["table", "board"]),
|
|
15
|
+
initial: "table"
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* `const [display] = useListDisplay('sales-deals')`: the table or board a list shows, chosen
|
|
19
|
+
* under its Display menu and remembered in this browser, one choice per list.
|
|
20
|
+
*/
|
|
21
|
+
const useListDisplay = (list) => useAtom(listDisplayFamily(list));
|
|
22
|
+
const DISPLAYS = [{
|
|
23
|
+
value: "table",
|
|
24
|
+
label: "table",
|
|
25
|
+
fallback: "Table",
|
|
26
|
+
icon: IconTable
|
|
27
|
+
}, {
|
|
28
|
+
value: "board",
|
|
29
|
+
label: "board",
|
|
30
|
+
fallback: "Board",
|
|
31
|
+
icon: IconLayoutKanban
|
|
32
|
+
}];
|
|
33
|
+
/** "Display" in a list's filter bar: table or board (`useListDisplay(list)` reads the choice). */
|
|
34
|
+
const DisplayMenu = ({ list }) => {
|
|
35
|
+
const [current, setDisplay] = useListDisplay(list);
|
|
36
|
+
const { t } = useTranslation("views", { keyPrefix: "display" });
|
|
37
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(IconTip, {
|
|
38
|
+
label: t("label", "Display"),
|
|
39
|
+
children: /* @__PURE__ */ jsx(Popover.Trigger, {
|
|
40
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
41
|
+
variant: "ghost",
|
|
42
|
+
size: "icon",
|
|
43
|
+
"aria-label": t("label", "Display"),
|
|
44
|
+
tone: "muted"
|
|
45
|
+
}),
|
|
46
|
+
children: /* @__PURE__ */ jsx(IconAdjustmentsHorizontal, { className: "size-4" })
|
|
47
|
+
})
|
|
48
|
+
}), /* @__PURE__ */ jsxs(Popover.Content, {
|
|
49
|
+
align: "end",
|
|
50
|
+
className: "w-64",
|
|
51
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
52
|
+
className: "mb-2 text-xs font-medium text-muted-foreground",
|
|
53
|
+
children: t("view", "View")
|
|
54
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
55
|
+
className: "grid grid-cols-2 gap-2",
|
|
56
|
+
children: DISPLAYS.map(({ value, label, fallback, icon: Icon }) => /* @__PURE__ */ jsxs("button", {
|
|
57
|
+
type: "button",
|
|
58
|
+
"aria-pressed": current === value,
|
|
59
|
+
onClick: () => setDisplay(value),
|
|
60
|
+
className: cn("flex flex-col items-center gap-1.5 rounded-lg border p-3 text-sm text-muted-foreground transition-colors hover:bg-accent", current === value && "border-primary bg-primary/5 font-medium text-foreground"),
|
|
61
|
+
children: [/* @__PURE__ */ jsx(Icon, { className: "size-5" }), t(label, fallback)]
|
|
62
|
+
}, value))
|
|
63
|
+
})]
|
|
64
|
+
})] });
|
|
65
|
+
};
|
|
66
|
+
export { DisplayMenu, useListDisplay };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ElementType, ReactNode } from "react";
|
|
2
|
+
/** A field a plugin's list filters by, as its menu, chip and the advanced filter show it. */
|
|
3
|
+
export type TListFilterField = {
|
|
4
|
+
/** The rules' `path` in the filter the list's API gets: `subject.<column>`, e.g. `subject.stageId`. */
|
|
5
|
+
path: `subject.${string}`;
|
|
6
|
+
label: string;
|
|
7
|
+
/** How it compares: contains (text), ranges (number), relative dates, yes/no, a pick. */
|
|
8
|
+
type: 'text' | 'number' | 'date' | 'boolean' | 'select' | 'member';
|
|
9
|
+
/** A `select`'s choices. */
|
|
10
|
+
options?: {
|
|
11
|
+
value: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}[];
|
|
14
|
+
/** Instead of the type's icon. */
|
|
15
|
+
icon?: ElementType;
|
|
16
|
+
};
|
|
17
|
+
export type TListFilterProps = {
|
|
18
|
+
/** Unique per list, e.g. `sales-deals`: its menu's hotkey scope. */
|
|
19
|
+
id: string;
|
|
20
|
+
fields: TListFilterField[];
|
|
21
|
+
/** How many records match, shown after the chips; undefined while it loads. */
|
|
22
|
+
totalCount?: number | null;
|
|
23
|
+
/** The count stopped at its cap ("1,000+"). */
|
|
24
|
+
totalCapped?: boolean;
|
|
25
|
+
/** The list's own controls, before the menu: `DisplayMenu`, an Archived toggle. */
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
};
|
|
28
|
+
/** Web registers core's filter bar. */
|
|
29
|
+
export declare const setListFilter: (component: import("react").ComponentType<TListFilterProps> | null) => void;
|
|
30
|
+
/**
|
|
31
|
+
* A plugin list's filter bar, core's own: the menu of `fields` (`F`), search, the advanced
|
|
32
|
+
* filter, and each condition as a chip. The conditions and search live in the address (shared
|
|
33
|
+
* links and reloads keep them); `useListFilterParams()` reads them for the list's query.
|
|
34
|
+
*/
|
|
35
|
+
export declare const ListFilter: (props: TListFilterProps) => import("react").JSX.Element | null;
|
|
36
|
+
/**
|
|
37
|
+
* What `ListFilter` holds, for the list's API: `filter`, core's condition group
|
|
38
|
+
* (`ConditionGroup` from `@erxes/core-contract`) as JSON, its rules on the fields' paths,
|
|
39
|
+
* and `search`. Both are undefined when unset.
|
|
40
|
+
*/
|
|
41
|
+
export declare const useListFilterParams: () => {
|
|
42
|
+
filter: string | undefined;
|
|
43
|
+
search: string | undefined;
|
|
44
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { hostComponent } from "../../utils/host-component.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { parseAsString, useQueryStates } from "nuqs";
|
|
4
|
+
// src/modules/list/ListFilter.tsx
|
|
5
|
+
const listFilter = hostComponent();
|
|
6
|
+
/** Web registers core's filter bar. */
|
|
7
|
+
const setListFilter = listFilter.set;
|
|
8
|
+
/**
|
|
9
|
+
* A plugin list's filter bar, core's own: the menu of `fields` (`F`), search, the advanced
|
|
10
|
+
* filter, and each condition as a chip. The conditions and search live in the address (shared
|
|
11
|
+
* links and reloads keep them); `useListFilterParams()` reads them for the list's query.
|
|
12
|
+
*/
|
|
13
|
+
const ListFilter = listFilter.Host;
|
|
14
|
+
const FilterGroup = z.looseObject({ rules: z.array(z.unknown()).min(1) });
|
|
15
|
+
/** The filter as JSON text when it has a condition; anything else in the address reads as none. */
|
|
16
|
+
const filterText = (text) => {
|
|
17
|
+
if (!text) return void 0;
|
|
18
|
+
try {
|
|
19
|
+
return FilterGroup.safeParse(JSON.parse(text)).success ? text : void 0;
|
|
20
|
+
} catch {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* What `ListFilter` holds, for the list's API: `filter`, core's condition group
|
|
26
|
+
* (`ConditionGroup` from `@erxes/core-contract`) as JSON, its rules on the fields' paths,
|
|
27
|
+
* and `search`. Both are undefined when unset.
|
|
28
|
+
*/
|
|
29
|
+
const useListFilterParams = () => {
|
|
30
|
+
const [{ advanced, searchValue }] = useQueryStates({
|
|
31
|
+
advanced: parseAsString,
|
|
32
|
+
searchValue: parseAsString
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
filter: filterText(advanced),
|
|
36
|
+
search: searchValue || void 0
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export { ListFilter, setListFilter, useListFilterParams };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A list's one bar, under its page header: its views on the left, its filter on the right
|
|
4
|
+
* (`ListFilter`, with `DisplayMenu` inside it). The first tab's icon lines up with the page
|
|
5
|
+
* header's first crumb. Without `tabs` the list has one view, "All …" (`allLabel`).
|
|
6
|
+
*/
|
|
7
|
+
export declare const ViewBar: ({ allLabel, tabs, children }: {
|
|
8
|
+
allLabel: string;
|
|
9
|
+
/** Saved views as tabs; core's own lists pass theirs. */
|
|
10
|
+
tabs?: ReactNode;
|
|
11
|
+
/** The list's filter. */
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TabButton } from "../../components/tabs.js";
|
|
2
|
+
import { IconLayoutList } from "@tabler/icons-react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useAutoAnimate } from "@formkit/auto-animate/react";
|
|
5
|
+
// src/modules/list/ViewBar.tsx
|
|
6
|
+
/**
|
|
7
|
+
* A list's one bar, under its page header: its views on the left, its filter on the right
|
|
8
|
+
* (`ListFilter`, with `DisplayMenu` inside it). The first tab's icon lines up with the page
|
|
9
|
+
* header's first crumb. Without `tabs` the list has one view, "All …" (`allLabel`).
|
|
10
|
+
*/
|
|
11
|
+
const ViewBar = ({ allLabel, tabs, children }) => {
|
|
12
|
+
const [tabsRef] = useAutoAnimate({ duration: 150 });
|
|
13
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
14
|
+
className: "flex h-10 shrink-0 items-center gap-3 border-b bg-background pr-3",
|
|
15
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
16
|
+
ref: tabsRef,
|
|
17
|
+
className: "flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto p-1 hide-scroll",
|
|
18
|
+
children: tabs ?? /* @__PURE__ */ jsxs(TabButton, {
|
|
19
|
+
type: "button",
|
|
20
|
+
"aria-current": "page",
|
|
21
|
+
active: true,
|
|
22
|
+
children: [/* @__PURE__ */ jsx(IconLayoutList, {}), allLabel]
|
|
23
|
+
})
|
|
24
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: "flex min-w-0 max-w-13/20 shrink-0 items-center justify-end",
|
|
26
|
+
children
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
export { ViewBar };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** A record's description as a full-size tab, saved when the editor loses focus. */
|
|
2
|
+
export declare const PanelDescriptionEditor: ({ value, scope, readonly, isHTML, onSave }: {
|
|
3
|
+
value: string;
|
|
4
|
+
scope: string;
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
/** Stores HTML instead of the editor's blocks. */
|
|
7
|
+
isHTML?: boolean;
|
|
8
|
+
onSave: (description: string) => void;
|
|
9
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { usePageHotkey } from "../../hooks/use-page-hotkey.js";
|
|
2
|
+
import { Editor } from "../blocks/components/LazyEditor.js";
|
|
3
|
+
import { useSaveOnLeave } from "./useSaveOnLeave.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/modules/record-panel/PanelDescriptionEditor.tsx
|
|
6
|
+
/** The editor inside `container`, when it is shown (an inactive tab's panel is `hidden`). */
|
|
7
|
+
const visibleEditor = (container) => {
|
|
8
|
+
const editor = container?.querySelector("[contenteditable=\"true\"]");
|
|
9
|
+
if (!editor?.getClientRects().length) return null;
|
|
10
|
+
return editor.closest("[hidden], [inert]") ? null : editor;
|
|
11
|
+
};
|
|
12
|
+
/** `/` focuses the description editor, unless it is read-only or not shown (another panel's may be). */
|
|
13
|
+
const useSlashFocus = (containerRef, readonly) => usePageHotkey("/", () => visibleEditor(containerRef.current)?.focus(), {
|
|
14
|
+
useKey: true,
|
|
15
|
+
when: () => !readonly && visibleEditor(containerRef.current) !== null
|
|
16
|
+
});
|
|
17
|
+
/** A record's description as a full-size tab, saved when the editor loses focus. */
|
|
18
|
+
const PanelDescriptionEditor = ({ value, scope, readonly, isHTML, onSave }) => {
|
|
19
|
+
const { containerRef, onChange } = useSaveOnLeave({
|
|
20
|
+
value,
|
|
21
|
+
readonly,
|
|
22
|
+
onSave
|
|
23
|
+
});
|
|
24
|
+
useSlashFocus(containerRef, readonly);
|
|
25
|
+
return /* @__PURE__ */ jsx("div", {
|
|
26
|
+
ref: containerRef,
|
|
27
|
+
className: "flex min-h-0 flex-1 flex-col p-3",
|
|
28
|
+
children: /* @__PURE__ */ jsx(Editor, {
|
|
29
|
+
initialContent: value,
|
|
30
|
+
onChange,
|
|
31
|
+
scope,
|
|
32
|
+
readonly,
|
|
33
|
+
isHTML,
|
|
34
|
+
variant: "default",
|
|
35
|
+
className: "h-full min-h-0 flex-1 [&_.bn-container]:h-full [&_.bn-editor]:min-h-full"
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export { PanelDescriptionEditor };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const PanelDescriptionField: ({ label, value, scope, readonly, isHTML, onSave }: {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
scope: string;
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
/** Stores HTML instead of the editor's blocks. */
|
|
7
|
+
isHTML?: boolean;
|
|
8
|
+
onSave: (value: string) => void;
|
|
9
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Editor } from "../blocks/components/LazyEditor.js";
|
|
2
|
+
import { useSaveOnLeave } from "./useSaveOnLeave.js";
|
|
3
|
+
import { IconAlignLeft } from "@tabler/icons-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/modules/record-panel/PanelDescriptionField.tsx
|
|
6
|
+
const PanelDescriptionField = ({ label, value, scope, readonly, isHTML, onSave }) => {
|
|
7
|
+
const { containerRef, onChange } = useSaveOnLeave({
|
|
8
|
+
value,
|
|
9
|
+
readonly,
|
|
10
|
+
onSave
|
|
11
|
+
});
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
13
|
+
className: "flex flex-col gap-1.5 pt-2",
|
|
14
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
15
|
+
className: "flex items-center gap-1.5 text-xs font-medium text-accent-foreground",
|
|
16
|
+
children: [/* @__PURE__ */ jsx(IconAlignLeft, {
|
|
17
|
+
className: "size-3.5 shrink-0",
|
|
18
|
+
"aria-hidden": "true"
|
|
19
|
+
}), label]
|
|
20
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
21
|
+
ref: containerRef,
|
|
22
|
+
children: /* @__PURE__ */ jsx(Editor, {
|
|
23
|
+
initialContent: value,
|
|
24
|
+
onChange,
|
|
25
|
+
scope,
|
|
26
|
+
label,
|
|
27
|
+
readonly,
|
|
28
|
+
isHTML,
|
|
29
|
+
variant: "ghost",
|
|
30
|
+
className: "h-auto min-h-20"
|
|
31
|
+
})
|
|
32
|
+
})]
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export { PanelDescriptionField };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RecordTableInlineCell } from "../record-table/components/RecordTableCellInline.js";
|
|
2
|
+
import { Icon } from "@tabler/icons-react";
|
|
3
|
+
export declare const PanelField: ({ label, icon: Icon, children, placeholder, htmlFor, cell }: {
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
icon?: Icon;
|
|
6
|
+
placeholder?: React.ReactNode;
|
|
7
|
+
htmlFor?: string;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
cell?: boolean;
|
|
10
|
+
}) => import("react").JSX.Element;
|
|
11
|
+
export declare const PanelFieldTrigger: (props: React.ComponentProps<typeof RecordTableInlineCell.Trigger>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Label } from "../../components/label.js";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { RecordTableInlineCell } from "../record-table/components/RecordTableCellInline.js";
|
|
4
|
+
import { PanelLabel } from "./PanelLabel.js";
|
|
5
|
+
import { IconForms } from "@tabler/icons-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useId } from "react";
|
|
8
|
+
// src/modules/record-panel/PanelField.tsx
|
|
9
|
+
const PanelField = ({ label, icon: Icon = IconForms, children, placeholder, htmlFor, cell = true }) => {
|
|
10
|
+
const labelId = useId();
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
12
|
+
className: "grid grid-cols-field items-center gap-x-2 min-h-7",
|
|
13
|
+
children: [/* @__PURE__ */ jsxs(Label, {
|
|
14
|
+
id: labelId,
|
|
15
|
+
htmlFor,
|
|
16
|
+
variant: "muted",
|
|
17
|
+
className: "flex min-w-0 items-center",
|
|
18
|
+
children: [Icon && /* @__PURE__ */ jsx(Icon, {
|
|
19
|
+
className: "size-3.5 shrink-0",
|
|
20
|
+
"aria-hidden": "true"
|
|
21
|
+
}), /* @__PURE__ */ jsx(PanelLabel, { children: label })]
|
|
22
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
23
|
+
className: cn("relative min-w-0", cell && "text-xs [&_button:not([role=switch],[data-panel-inline])]:h-7 [&_button:not([role=switch])]:text-xs [&_input]:text-xs"),
|
|
24
|
+
children: [/* @__PURE__ */ jsx(RecordTableInlineCell.LabelledBy, {
|
|
25
|
+
value: labelId,
|
|
26
|
+
children
|
|
27
|
+
}), placeholder && /* @__PURE__ */ jsxs("span", {
|
|
28
|
+
className: "pointer-events-none absolute inset-y-0 left-2 flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
29
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
30
|
+
className: "size-3.5 shrink-0",
|
|
31
|
+
"aria-hidden": "true"
|
|
32
|
+
}), placeholder]
|
|
33
|
+
})]
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const PanelFieldTrigger = (props) => /* @__PURE__ */ jsx(RecordTableInlineCell.Trigger, {
|
|
38
|
+
variant: "field",
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
export { PanelField, PanelFieldTrigger };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Icon } from "@tabler/icons-react";
|
|
2
|
+
/**
|
|
3
|
+
* One field of a record not created yet, laid out like `PanelField`: its
|
|
4
|
+
* label, then the input, with the field's error under it.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PanelFormRow: ({ label, icon: Icon, required, error, children }: {
|
|
7
|
+
label: React.ReactNode;
|
|
8
|
+
icon?: Icon;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
error?: string;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}) => import("react").JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* The body and footer of a new record's form in the side panel: its rows,
|
|
15
|
+
* then Cancel and Save. Nothing is saved until Save.
|
|
16
|
+
*/
|
|
17
|
+
export declare const PanelFormLayout: ({ children, onCancel, saving, saveLabel }: {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
onCancel: () => void;
|
|
20
|
+
saving?: boolean;
|
|
21
|
+
saveLabel?: string;
|
|
22
|
+
}) => import("react").JSX.Element;
|