@erxes/ui 4.0.0-v2.10 → 4.0.0-v2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CATALOG.md
CHANGED
|
@@ -62,7 +62,7 @@ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the r
|
|
|
62
62
|
- `<PanelField label icon placeholder htmlFor cell>` A side panel row: icon and label, then the value as a table cell.
|
|
63
63
|
- `<PanelFieldTrigger>` A table cell trigger with the side panel's rounded hover.
|
|
64
64
|
- `<PanelFormLayout onCancel saving saveLabel>` A new record's form in the side panel: its rows, then Cancel and Save.
|
|
65
|
-
- `<PanelFormRow label icon required error>` One field of a
|
|
65
|
+
- `<PanelFormRow label icon required error hint>` One field of a form in the side panel, laid out like `PanelField`.
|
|
66
66
|
- `<PanelLabel tooltip>` A side panel label cut at two lines, with the full text on hover.
|
|
67
67
|
- `<PanelSection title icon nested>` A plain heading that groups the side panel's rows.
|
|
68
68
|
- `<RecordOpenerProvider open openNew>` The host app's way to open records, which `useOpenRecord` calls.
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { Icon } from "@tabler/icons-react";
|
|
2
2
|
/**
|
|
3
|
-
* One field of a
|
|
4
|
-
*
|
|
3
|
+
* One field of a form in the side panel, laid out like `PanelField`.
|
|
4
|
+
* Icon and label, then the control, with its error, or else its hint, under it. A long label wraps to two lines (the
|
|
5
|
+
* full text on hover) instead of being cut. `htmlFor` names the control by its id, so a click
|
|
6
|
+
* on the label focuses it and a switch toggles.
|
|
5
7
|
*/
|
|
6
|
-
export declare const PanelFormRow: ({ label, icon: Icon, required, error, children }: {
|
|
8
|
+
export declare const PanelFormRow: ({ label, icon: Icon, required, error, hint, htmlFor, children }: {
|
|
7
9
|
label: React.ReactNode;
|
|
8
10
|
icon?: Icon;
|
|
9
11
|
required?: boolean;
|
|
10
12
|
error?: string;
|
|
13
|
+
/** What the field takes or does, under the control while it has no error. */
|
|
14
|
+
hint?: React.ReactNode;
|
|
15
|
+
/** The control's id. */
|
|
16
|
+
htmlFor?: string;
|
|
11
17
|
children: React.ReactNode;
|
|
12
18
|
}) => import("react").JSX.Element;
|
|
13
19
|
/**
|
|
@@ -8,17 +8,20 @@ import { useId } from "react";
|
|
|
8
8
|
import { useTranslation } from "react-i18next";
|
|
9
9
|
// src/modules/record-panel/PanelForm.tsx
|
|
10
10
|
/**
|
|
11
|
-
* One field of a
|
|
12
|
-
*
|
|
11
|
+
* One field of a form in the side panel, laid out like `PanelField`.
|
|
12
|
+
* Icon and label, then the control, with its error, or else its hint, under it. A long label wraps to two lines (the
|
|
13
|
+
* full text on hover) instead of being cut. `htmlFor` names the control by its id, so a click
|
|
14
|
+
* on the label focuses it and a switch toggles.
|
|
13
15
|
*/
|
|
14
|
-
const PanelFormRow = ({ label, icon: Icon = IconForms, required, error, children }) => {
|
|
16
|
+
const PanelFormRow = ({ label, icon: Icon = IconForms, required, error, hint, htmlFor, children }) => {
|
|
15
17
|
const labelId = useId();
|
|
16
18
|
return /* @__PURE__ */ jsxs("div", {
|
|
17
|
-
className: "grid grid-cols-field items-
|
|
19
|
+
className: "grid grid-cols-field items-start gap-x-2 gap-y-0.5",
|
|
18
20
|
children: [
|
|
19
|
-
/* @__PURE__ */ jsxs("span", {
|
|
21
|
+
/* @__PURE__ */ jsxs(htmlFor ? "label" : "span", {
|
|
20
22
|
id: labelId,
|
|
21
|
-
|
|
23
|
+
htmlFor,
|
|
24
|
+
className: "flex min-h-7 min-w-0 items-center gap-1.5 text-xs font-medium text-accent-foreground",
|
|
22
25
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
23
26
|
className: "size-3.5 shrink-0",
|
|
24
27
|
"aria-hidden": "true"
|
|
@@ -31,7 +34,7 @@ const PanelFormRow = ({ label, icon: Icon = IconForms, required, error, children
|
|
|
31
34
|
})]
|
|
32
35
|
}),
|
|
33
36
|
/* @__PURE__ */ jsxs("div", {
|
|
34
|
-
className: "group/panel-value relative min-w-0 text-xs [&_button:not([role=switch])]:text-xs [&_input:placeholder-shown]:pl-7",
|
|
37
|
+
className: "group/panel-value relative flex min-h-7 min-w-0 flex-col justify-center text-xs [&_button:not([role=switch])]:text-xs [&_input:placeholder-shown]:pl-7",
|
|
35
38
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
36
39
|
className: "pointer-events-none absolute left-2 top-1/2 z-1 hidden size-3.5 -translate-y-1/2 text-muted-foreground group-has-[input:placeholder-shown]/panel-value:block",
|
|
37
40
|
"aria-hidden": "true"
|
|
@@ -40,9 +43,13 @@ const PanelFormRow = ({ label, icon: Icon = IconForms, required, error, children
|
|
|
40
43
|
children
|
|
41
44
|
})]
|
|
42
45
|
}),
|
|
43
|
-
error
|
|
46
|
+
error ? /* @__PURE__ */ jsx("span", {
|
|
47
|
+
role: "alert",
|
|
44
48
|
className: "col-start-2 text-xs text-destructive",
|
|
45
49
|
children: error
|
|
50
|
+
}) : hint && /* @__PURE__ */ jsx("span", {
|
|
51
|
+
className: "col-start-2 text-xs text-muted-foreground",
|
|
52
|
+
children: hint
|
|
46
53
|
})
|
|
47
54
|
]
|
|
48
55
|
});
|
package/dist/types/UIConfig.d.ts
CHANGED
|
@@ -121,17 +121,17 @@ export type TPanelRecordType = {
|
|
|
121
121
|
export type TRelationTabProps = TRecordSlotProps & TRecordContacts;
|
|
122
122
|
/**
|
|
123
123
|
* A plugin's tab on other records' panels, listing its own records.
|
|
124
|
-
* It lists the plugin's own records of the same customers and companies: a customer's deals
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
124
|
+
* It lists the plugin's own records of the same customers and companies: a customer's deals.
|
|
125
|
+
* Shown on core's customers and companies (their contacts are themselves), and on the plugin
|
|
126
|
+
* record types `hosts` names that give `contacts` (a task's deals). A record clicked in it opens
|
|
127
|
+
* on top in the same panel (`useOpenRecord().open`), and Back returns.
|
|
128
128
|
*/
|
|
129
129
|
export type TRelationTab = {
|
|
130
130
|
/** Unique within the plugin, e.g. `deals`. */
|
|
131
131
|
name: string;
|
|
132
132
|
title: string;
|
|
133
133
|
icon: Icon;
|
|
134
|
-
/**
|
|
134
|
+
/** Plugin record types it also shows on (`tasks:task`); customers and companies always. */
|
|
135
135
|
hosts?: string[];
|
|
136
136
|
component: React.ComponentType<TRelationTabProps>;
|
|
137
137
|
};
|