@jiovan-labs/ant-buddy-pro 2.0.3 → 2.0.4
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/dist/cjs/field/NotifyBadge/index.d.ts +13 -4
- package/dist/cjs/field/NotifyBadge/index.js +39 -42
- package/dist/cjs/field/NotifyBadge/styles.js +29 -17
- package/dist/cjs/form/AddonInput/index.js +44 -17
- package/dist/cjs/form/AvatarUpload/index.d.ts +2 -2
- package/dist/cjs/form/LocaleInput/index.js +15 -11
- package/dist/cjs/form/LocaleInput/styles.js +19 -10
- package/dist/cjs/form/TagInput/index.d.ts +1 -1
- package/dist/esm/field/NotifyBadge/index.d.ts +13 -4
- package/dist/esm/field/NotifyBadge/index.js +64 -85
- package/dist/esm/field/NotifyBadge/styles.js +24 -18
- package/dist/esm/form/AddonInput/index.js +60 -26
- package/dist/esm/form/AvatarUpload/index.d.ts +2 -2
- package/dist/esm/form/LocaleInput/index.js +24 -13
- package/dist/esm/form/LocaleInput/styles.js +16 -8
- package/dist/esm/form/TagInput/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type BadgeProps, type DropdownProps, type
|
|
3
|
-
import { ListItemMetaProps } from 'antd/es/list/Item';
|
|
2
|
+
import { type BadgeProps, type DropdownProps, type ListyProps, type TabsProps } from 'antd';
|
|
4
3
|
import { type TabPlacement } from 'antd/es/tabs';
|
|
5
4
|
import { type Tab as RcTab } from '@rc-component/tabs/es/interface';
|
|
6
5
|
import { type WithFalse, type ReadonlyTabsType } from "../../type/declaration";
|
|
7
6
|
export type NotifyPresetStyle = WithFalse<'notice' | 'task'>;
|
|
8
7
|
export type NotifyTabPosition = Exclude<TabPlacement, 'bottom'>;
|
|
9
|
-
export type NotifyDataItem =
|
|
8
|
+
export type NotifyDataItem = {
|
|
10
9
|
id?: string;
|
|
10
|
+
avatar?: React.ReactNode;
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
description?: React.ReactNode;
|
|
11
13
|
extra?: React.ReactNode;
|
|
12
14
|
read?: boolean;
|
|
13
15
|
timestamp?: string;
|
|
14
16
|
};
|
|
17
|
+
export type NotifyListProps = Omit<ListyProps<any>, 'itemRender' | 'rowKey'> & {
|
|
18
|
+
dataSource?: any[];
|
|
19
|
+
renderItem?: (item: any, index: number) => React.ReactNode;
|
|
20
|
+
rowKey?: ListyProps<any>['rowKey'];
|
|
21
|
+
footer?: React.ReactNode;
|
|
22
|
+
};
|
|
15
23
|
export type HyperlinkProps = {
|
|
16
24
|
clazz?: string;
|
|
17
25
|
style?: React.CSSProperties;
|
|
@@ -20,8 +28,9 @@ export type HyperlinkProps = {
|
|
|
20
28
|
rel?: string;
|
|
21
29
|
};
|
|
22
30
|
export type MixinTabProps = Omit<RcTab, 'children'> & {
|
|
31
|
+
bordered?: boolean;
|
|
23
32
|
labelBadgeProps?: Omit<BadgeProps, 'children'>;
|
|
24
|
-
listProps?:
|
|
33
|
+
listProps?: NotifyListProps;
|
|
25
34
|
listPlaceholder?: React.ReactNode;
|
|
26
35
|
showClear?: boolean | (() => boolean);
|
|
27
36
|
showMore?: boolean | (() => boolean);
|
|
@@ -35,7 +35,6 @@ module.exports = __toCommonJS(NotifyBadge_exports);
|
|
|
35
35
|
var import_antd = require("antd");
|
|
36
36
|
var import_icons = require("@ant-design/icons");
|
|
37
37
|
var import_pro_components = require("@ant-design/pro-components");
|
|
38
|
-
var import_react_condition = require("@jiovan-labs/react-condition");
|
|
39
38
|
var import_ts_lang_utils = require("@jiovan-labs/ts-lang-utils");
|
|
40
39
|
var import_util = require("@rc-component/util");
|
|
41
40
|
var import_classnames = __toESM(require("classnames"));
|
|
@@ -75,35 +74,27 @@ var NotifyBadge = (props) => {
|
|
|
75
74
|
return !tab.labelBadgeProps ? label : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Badge, { count: unreadCount, ...omitProps, children: label });
|
|
76
75
|
};
|
|
77
76
|
const renderPresetList = (item, index, tab) => {
|
|
78
|
-
const avatar = !item.avatar ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
] }) });
|
|
82
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
83
|
-
import_antd.List.Item,
|
|
77
|
+
const avatar = !item.avatar ? void 0 : typeof item.avatar === "string" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Avatar, { className: `${clazzPrefix}-list-item-avatar`, src: item.avatar }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${clazzPrefix}-list-item-icon`, children: item.avatar });
|
|
78
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
79
|
+
"div",
|
|
84
80
|
{
|
|
85
81
|
className: (0, import_classnames.default)(`${clazzPrefix}-list-item`, `${clazzPrefix}-list-item-${item.read ? "read" : "unread"}`),
|
|
86
82
|
onClick: (event) => {
|
|
87
83
|
var _a2;
|
|
88
84
|
return (_a2 = tab.onClick) == null ? void 0 : _a2.call(tab, event, item.key || item.id || index);
|
|
89
85
|
},
|
|
90
|
-
children:
|
|
91
|
-
|
|
92
|
-
{
|
|
93
|
-
className: `${clazzPrefix}-list-item-
|
|
94
|
-
avatar,
|
|
95
|
-
title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `${clazzPrefix}-list-item-title`, children: [
|
|
86
|
+
children: [
|
|
87
|
+
!!avatar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${clazzPrefix}-list-item-avatar-wrapper`, children: avatar }),
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `${clazzPrefix}-list-item-meta`, children: [
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `${clazzPrefix}-list-item-title`, children: [
|
|
96
90
|
item.title,
|
|
97
|
-
|
|
91
|
+
!!item.extra && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${clazzPrefix}-list-item-extra`, children: item.extra })
|
|
98
92
|
] }),
|
|
99
|
-
description
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
)
|
|
105
|
-
},
|
|
106
|
-
item.key || item.id || index
|
|
93
|
+
!!item.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${clazzPrefix}-list-item-description`, children: item.description }),
|
|
94
|
+
!!item.timestamp && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${clazzPrefix}-list-item-timestamp`, children: item.timestamp })
|
|
95
|
+
] })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
107
98
|
);
|
|
108
99
|
};
|
|
109
100
|
const renderListFooter = (tab) => {
|
|
@@ -115,8 +106,8 @@ var NotifyBadge = (props) => {
|
|
|
115
106
|
}
|
|
116
107
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
117
108
|
(_b2 = tab.listProps) == null ? void 0 : _b2.footer,
|
|
118
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `${clazzPrefix}-builtin-footer`, children: [
|
|
119
|
-
|
|
109
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_classnames.default)(`${clazzPrefix}-builtin-footer`, tab.bordered ? void 0 : `${clazzPrefix}-builtin-footer-bordered`), children: [
|
|
110
|
+
showClear && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
111
|
"div",
|
|
121
112
|
{
|
|
122
113
|
className: `${clazzPrefix}-action-button`,
|
|
@@ -126,8 +117,8 @@ var NotifyBadge = (props) => {
|
|
|
126
117
|
},
|
|
127
118
|
children: import_ts_lang_utils.ObjectUtils.firstNotNil((_c2 = props == null ? void 0 : props.localeProps) == null ? void 0 : _c2.clear, import_locales.intlLocales.get([locale, "clear"]), import_locales.intlLocales.get(["en_US", "clear"]))
|
|
128
119
|
}
|
|
129
|
-
)
|
|
130
|
-
|
|
120
|
+
),
|
|
121
|
+
showMore && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
131
122
|
"div",
|
|
132
123
|
{
|
|
133
124
|
className: `${clazzPrefix}-action-button`,
|
|
@@ -137,7 +128,7 @@ var NotifyBadge = (props) => {
|
|
|
137
128
|
},
|
|
138
129
|
children: import_ts_lang_utils.ObjectUtils.firstNotNil((_d = props == null ? void 0 : props.localeProps) == null ? void 0 : _d.more, import_locales.intlLocales.get([locale, "more"]), import_locales.intlLocales.get(["en_US", "more"]))
|
|
139
130
|
}
|
|
140
|
-
)
|
|
131
|
+
)
|
|
141
132
|
] })
|
|
142
133
|
] });
|
|
143
134
|
};
|
|
@@ -147,24 +138,30 @@ var NotifyBadge = (props) => {
|
|
|
147
138
|
return void 0;
|
|
148
139
|
}
|
|
149
140
|
return props.tabsProps.items.map((tab) => {
|
|
150
|
-
var _a3, _b2;
|
|
151
|
-
const
|
|
141
|
+
var _a3, _b2, _c2, _d;
|
|
142
|
+
const listItems = ((_a3 = tab.listProps) == null ? void 0 : _a3.items) ?? ((_b2 = tab.listProps) == null ? void 0 : _b2.dataSource);
|
|
143
|
+
const empty = !listItems || Array.isArray(listItems) && !listItems.length;
|
|
152
144
|
const placeholder = tab.listPlaceholder ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Empty, { image: import_antd.Empty.PRESENTED_IMAGE_SIMPLE });
|
|
153
|
-
const content = empty ? placeholder : /* @__PURE__ */ (0, import_jsx_runtime.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
145
|
+
const content = empty ? placeholder : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `${clazzPrefix}-tab-list-wrapper`, children: [
|
|
146
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
147
|
+
import_antd.Listy,
|
|
148
|
+
{
|
|
149
|
+
className: (0, import_classnames.default)(`${clazzPrefix}-tab-list`, tab.bordered ? `${clazzPrefix}-tab-list-bordered` : void 0, (_c2 = tab.listProps) == null ? void 0 : _c2.className),
|
|
150
|
+
items: listItems,
|
|
151
|
+
rowKey: ((_d = tab.listProps) == null ? void 0 : _d.rowKey) ?? ((item) => (item == null ? void 0 : item.key) ?? (item == null ? void 0 : item.id)),
|
|
152
|
+
classNames: { item: `${clazzPrefix}-listy-item` },
|
|
153
|
+
...!(tab == null ? void 0 : tab.listProps) ? {} : (0, import_util.omit)(tab.listProps, ["className", "footer", "renderItem", "dataSource", "items", "rowKey", "classNames"]),
|
|
154
|
+
itemRender: (item, index) => {
|
|
155
|
+
var _a4;
|
|
156
|
+
if ((_a4 = tab.listProps) == null ? void 0 : _a4.renderItem) {
|
|
157
|
+
return tab.listProps.renderItem(item, index);
|
|
158
|
+
}
|
|
159
|
+
return tab.presetStyle === "notice" || tab.presetStyle === "task" ? renderPresetList(item, index, tab) : void 0;
|
|
163
160
|
}
|
|
164
|
-
return tab.presetStyle === "notice" || tab.presetStyle === "task" ? renderPresetList(item, index, tab) : void 0;
|
|
165
161
|
}
|
|
166
|
-
|
|
167
|
-
|
|
162
|
+
),
|
|
163
|
+
renderListFooter(tab)
|
|
164
|
+
] });
|
|
168
165
|
return {
|
|
169
166
|
key: tab.key ?? tab.presetStyle,
|
|
170
167
|
label: renderTabLabel(tab),
|
|
@@ -48,26 +48,41 @@ var buildFieldStyle = (token) => {
|
|
|
48
48
|
[`${token.antCls}-tabs-content-right ${token.antCls}-tabs-tabpane`]: {
|
|
49
49
|
paddingRight: token.paddingXS
|
|
50
50
|
},
|
|
51
|
-
[`${token.componentCls}-tab-list`]: {
|
|
51
|
+
[`${token.componentCls}-tab-list-wrapper`]: {
|
|
52
52
|
maxHeight: 400,
|
|
53
53
|
overflow: "auto",
|
|
54
54
|
[`&::-webkit-scrollbar`]: {
|
|
55
55
|
display: "none"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
[`${token.componentCls}-tab-list`]: {
|
|
59
|
+
[`&${token.componentCls}-tab-list-bordered`]: {
|
|
60
|
+
border: `${(0, import_cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
|
61
|
+
borderRadius: token.borderRadius
|
|
56
62
|
},
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
// Listy 默认已为每项写入 borderBottom(文档「基础用法」效果),这里只去掉最后一项的底线
|
|
64
|
+
[`${token.antCls}-listy-item:last-child`]: {
|
|
65
|
+
borderBottom: "none"
|
|
59
66
|
}
|
|
60
67
|
},
|
|
61
|
-
[`${token.componentCls}-
|
|
62
|
-
borderRadius: token.borderRadius,
|
|
68
|
+
[`${token.componentCls}-listy-item`]: {
|
|
63
69
|
cursor: "pointer",
|
|
64
|
-
paddingRight: token.paddingXS,
|
|
65
|
-
paddingLeft: token.paddingXS,
|
|
66
|
-
overflow: "hidden",
|
|
67
70
|
transition: "all 0.3s",
|
|
71
|
+
[`&:hover`]: {
|
|
72
|
+
backgroundColor: token.controlItemBgActive
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
[`${token.componentCls}-list-item`]: {
|
|
76
|
+
display: "flex",
|
|
77
|
+
alignItems: "flex-start",
|
|
78
|
+
gap: token.paddingXS,
|
|
79
|
+
overflow: "hidden",
|
|
68
80
|
[`&&-read`]: {
|
|
69
81
|
opacity: 0.4
|
|
70
82
|
},
|
|
83
|
+
[`&-avatar-wrapper`]: {
|
|
84
|
+
flex: "none"
|
|
85
|
+
},
|
|
71
86
|
[`&-avatar`]: {
|
|
72
87
|
backgroundColor: token.colorBgContainer,
|
|
73
88
|
marginTop: token.marginXXS
|
|
@@ -87,7 +102,8 @@ var buildFieldStyle = (token) => {
|
|
|
87
102
|
},
|
|
88
103
|
[`&-timestamp`]: {
|
|
89
104
|
marginTop: token.marginXXS,
|
|
90
|
-
fontSize: token.fontSizeSM
|
|
105
|
+
fontSize: token.fontSizeSM,
|
|
106
|
+
color: token.colorTextTertiary
|
|
91
107
|
},
|
|
92
108
|
[`&-extra`]: {
|
|
93
109
|
float: "right",
|
|
@@ -95,12 +111,6 @@ var buildFieldStyle = (token) => {
|
|
|
95
111
|
marginRight: 0,
|
|
96
112
|
color: token.colorTextSecondary,
|
|
97
113
|
fontWeight: "normal"
|
|
98
|
-
},
|
|
99
|
-
[`&:hover`]: {
|
|
100
|
-
backgroundColor: token.controlItemBgActive
|
|
101
|
-
},
|
|
102
|
-
[`&:last-child`]: {
|
|
103
|
-
borderBottom: "none !important"
|
|
104
114
|
}
|
|
105
115
|
},
|
|
106
116
|
[`${token.componentCls}-builtin-footer`]: {
|
|
@@ -109,9 +119,11 @@ var buildFieldStyle = (token) => {
|
|
|
109
119
|
display: "flex",
|
|
110
120
|
alignItems: "start",
|
|
111
121
|
textAlign: "center",
|
|
112
|
-
borderTop: `${(0, import_cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
|
113
|
-
borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`,
|
|
114
122
|
transition: "all 0.3s",
|
|
123
|
+
[`&${token.componentCls}-builtin-footer-bordered`]: {
|
|
124
|
+
borderTop: `${(0, import_cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
|
125
|
+
borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
|
|
126
|
+
},
|
|
115
127
|
[`${token.componentCls}-action-button`]: {
|
|
116
128
|
display: "flex",
|
|
117
129
|
flex: 1,
|
|
@@ -55,6 +55,9 @@ var AddonInput = (props) => {
|
|
|
55
55
|
proField = true
|
|
56
56
|
} = props ?? {};
|
|
57
57
|
const fieldStyle = (0, import_styles.useFieldStyle)(clazzPrefix);
|
|
58
|
+
const compositionRef = import_react.default.useRef(false);
|
|
59
|
+
const [composingValue, setComposingValue] = import_react.default.useState(void 0);
|
|
60
|
+
const webkitBrowser = navigator.userAgent.indexOf("WebKit") !== -1;
|
|
58
61
|
const addonBeforeDom = typeof (props == null ? void 0 : props.addonBefore) === "function" ? props.addonBefore() : props == null ? void 0 : props.addonBefore;
|
|
59
62
|
const addonAfterDom = typeof (props == null ? void 0 : props.addonAfter) === "function" ? props.addonAfter() : props == null ? void 0 : props.addonAfter;
|
|
60
63
|
const addonBeforeStyle = {
|
|
@@ -77,7 +80,39 @@ var AddonInput = (props) => {
|
|
|
77
80
|
const widthBlockClazz = !widthBlock ? void 0 : `${clazzPrefix}-width-block`;
|
|
78
81
|
const entryReadModeClazz = !entryReadMode ? void 0 : `${clazzPrefix}-read-mode`;
|
|
79
82
|
const entryImmutableClazz = !entryImmutable ? void 0 : `${clazzPrefix}-immutable`;
|
|
80
|
-
const omitFieldProps = !(props == null ? void 0 : props.fieldProps) ? {} : (0, import_util.omit)(props == null ? void 0 : props.fieldProps, ["className", "name", "id", "placeholder", "allowClear", "readOnly", "disabled", "value", "onChange"]);
|
|
83
|
+
const omitFieldProps = !(props == null ? void 0 : props.fieldProps) ? {} : (0, import_util.omit)(props == null ? void 0 : props.fieldProps, ["className", "name", "id", "placeholder", "allowClear", "readOnly", "disabled", "value", "onChange", "onCompositionStart", "onCompositionEnd"]);
|
|
84
|
+
const setFieldValue = (value) => {
|
|
85
|
+
if (simpleName) {
|
|
86
|
+
form == null ? void 0 : form.setFieldValue(simpleName, value);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const handleChange = (event) => {
|
|
90
|
+
var _a2, _b2;
|
|
91
|
+
if (compositionRef.current) {
|
|
92
|
+
setComposingValue(event.target.value);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (!simpleName) {
|
|
96
|
+
setComposingValue(event.target.value);
|
|
97
|
+
}
|
|
98
|
+
setFieldValue(event.target.value);
|
|
99
|
+
(_b2 = (_a2 = props == null ? void 0 : props.fieldProps) == null ? void 0 : _a2.onChange) == null ? void 0 : _b2.call(_a2, event);
|
|
100
|
+
};
|
|
101
|
+
const handleCompositionStart = (event) => {
|
|
102
|
+
var _a2, _b2;
|
|
103
|
+
compositionRef.current = true;
|
|
104
|
+
(_b2 = (_a2 = props == null ? void 0 : props.fieldProps) == null ? void 0 : _a2.onCompositionStart) == null ? void 0 : _b2.call(_a2, event);
|
|
105
|
+
};
|
|
106
|
+
const handleCompositionEnd = (event) => {
|
|
107
|
+
var _a2, _b2;
|
|
108
|
+
compositionRef.current = false;
|
|
109
|
+
(_b2 = (_a2 = props == null ? void 0 : props.fieldProps) == null ? void 0 : _a2.onCompositionEnd) == null ? void 0 : _b2.call(_a2, event);
|
|
110
|
+
const finalValue = event.currentTarget.value;
|
|
111
|
+
setComposingValue(simpleName ? void 0 : finalValue);
|
|
112
|
+
if (webkitBrowser) {
|
|
113
|
+
setFieldValue(finalValue);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
81
116
|
if (proField) {
|
|
82
117
|
const restProps = !props ? {} : (0, import_util.omit)(props, ["className", "name", "allowClear", "fieldProps", "proFieldProps", "clazzPrefix", "addonBefore", "addonAfter", "cursorBefore", "cursorAfter", "paddingBefore", "paddingAfter", "widthBlock", "proField"]);
|
|
83
118
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_classnames.default)(clazzPrefix, fieldStyle.hashId, proFieldClazz, widthBlockClazz, entryReadModeClazz, entryImmutableClazz), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_pro_components.ProForm.Item, { name: simpleName, ...restProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Space.Compact, { className: `${clazzPrefix}-space`, style: { width: "100%" }, children: [
|
|
@@ -88,18 +123,14 @@ var AddonInput = (props) => {
|
|
|
88
123
|
className: (0, import_classnames.default)(`${clazzPrefix}-input`, (_i = props == null ? void 0 : props.fieldProps) == null ? void 0 : _i.className),
|
|
89
124
|
placeholder: import_ts_lang_utils.StringUtils.join(props == null ? void 0 : props.placeholder) ?? ((_j = props == null ? void 0 : props.fieldProps) == null ? void 0 : _j.placeholder),
|
|
90
125
|
name: simpleName,
|
|
91
|
-
value: entryReadMode ? fieldValue || ((_k = props == null ? void 0 : props.proFieldProps) == null ? void 0 : _k.emptyText) || "-" : fieldValue,
|
|
126
|
+
value: composingValue ?? (entryReadMode ? fieldValue || ((_k = props == null ? void 0 : props.proFieldProps) == null ? void 0 : _k.emptyText) || "-" : fieldValue),
|
|
92
127
|
allowClear: !entryImmutable && (props == null ? void 0 : props.allowClear) !== false && ((_l = props == null ? void 0 : props.fieldProps) == null ? void 0 : _l.allowClear) !== false,
|
|
93
128
|
readOnly: entryReadMode || entryReadonly,
|
|
94
129
|
disabled: entryDisabled,
|
|
95
130
|
style: !inputWidth ? void 0 : { width: inputWidth },
|
|
96
|
-
onChange:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
form == null ? void 0 : form.setFieldValue(simpleName, event.target.value);
|
|
100
|
-
}
|
|
101
|
-
(_b2 = (_a2 = props == null ? void 0 : props.fieldProps) == null ? void 0 : _a2.onChange) == null ? void 0 : _b2.call(_a2, event);
|
|
102
|
-
},
|
|
131
|
+
onChange: handleChange,
|
|
132
|
+
onCompositionStart: handleCompositionStart,
|
|
133
|
+
onCompositionEnd: handleCompositionEnd,
|
|
103
134
|
...omitFieldProps
|
|
104
135
|
}
|
|
105
136
|
),
|
|
@@ -114,17 +145,13 @@ var AddonInput = (props) => {
|
|
|
114
145
|
className: (0, import_classnames.default)(`${clazzPrefix}-input`, (_n = props == null ? void 0 : props.fieldProps) == null ? void 0 : _n.className),
|
|
115
146
|
name: simpleName,
|
|
116
147
|
placeholder: import_ts_lang_utils.StringUtils.join(props == null ? void 0 : props.placeholder) ?? ((_o = props == null ? void 0 : props.fieldProps) == null ? void 0 : _o.placeholder),
|
|
117
|
-
value: entryReadMode ? fieldValue || ((_p = props == null ? void 0 : props.proFieldProps) == null ? void 0 : _p.emptyText) || "-" : fieldValue,
|
|
148
|
+
value: composingValue ?? (entryReadMode ? fieldValue || ((_p = props == null ? void 0 : props.proFieldProps) == null ? void 0 : _p.emptyText) || "-" : fieldValue),
|
|
118
149
|
readOnly: entryReadMode || entryReadonly,
|
|
119
150
|
disabled: entryDisabled,
|
|
120
151
|
style: !inputWidth ? void 0 : { width: inputWidth },
|
|
121
|
-
onChange:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
form == null ? void 0 : form.setFieldValue(props.name, event.target.value);
|
|
125
|
-
}
|
|
126
|
-
(_b2 = (_a2 = props == null ? void 0 : props.fieldProps) == null ? void 0 : _a2.onChange) == null ? void 0 : _b2.call(_a2, event);
|
|
127
|
-
},
|
|
152
|
+
onChange: handleChange,
|
|
153
|
+
onCompositionStart: handleCompositionStart,
|
|
154
|
+
onCompositionEnd: handleCompositionEnd,
|
|
128
155
|
...omitFieldProps
|
|
129
156
|
}
|
|
130
157
|
),
|
|
@@ -45,7 +45,7 @@ export type AvatarUploadProps = Omit<ProFormFieldItemProps, 'children' | 'fieldR
|
|
|
45
45
|
locale?: string;
|
|
46
46
|
localeProps?: IntlLocaleProps;
|
|
47
47
|
};
|
|
48
|
-
export declare const AvatarUpload: React.ForwardRefExoticComponent<Omit<ProFormFieldItemProps, "children" | "
|
|
48
|
+
export declare const AvatarUpload: React.ForwardRefExoticComponent<Omit<ProFormFieldItemProps, "children" | "placeholder" | "fieldProps" | "disabled" | "readonly" | "fieldRef"> & {
|
|
49
49
|
clazzPrefix?: string | undefined;
|
|
50
50
|
containerClazz?: string | undefined;
|
|
51
51
|
containerStyle?: React.CSSProperties | undefined;
|
|
@@ -54,7 +54,7 @@ export declare const AvatarUpload: React.ForwardRefExoticComponent<Omit<ProFormF
|
|
|
54
54
|
fallbackSrc?: string | undefined;
|
|
55
55
|
shape?: CircleSquareShape | undefined;
|
|
56
56
|
avatarProps?: Omit<AvatarProps, "children" | "src" | "srcSet" | "shape"> | undefined;
|
|
57
|
-
imageProps?: Omit<ImageProps, "title" | "src" | "
|
|
57
|
+
imageProps?: Omit<ImageProps, "title" | "src" | "fallback" | "preview" | "height" | "srcSet" | "width"> | undefined;
|
|
58
58
|
uploadEnabled?: boolean | undefined;
|
|
59
59
|
uploadProps?: FileUploadProps | undefined;
|
|
60
60
|
cropEnabled?: boolean | undefined;
|
|
@@ -115,8 +115,12 @@ var LocaleInput = (props) => {
|
|
|
115
115
|
(0, import_ahooks.useEventListener)("resize", handleWindowResize);
|
|
116
116
|
const addonEntryDom = typeof addon === "function" ? addon() : addon;
|
|
117
117
|
const buildEntryAddonDom = (before) => {
|
|
118
|
-
|
|
118
|
+
if (!(before && addonPos === "before" || !before && addonPos === "after")) {
|
|
119
|
+
return void 0;
|
|
120
|
+
}
|
|
121
|
+
return multilingual ? addonEntryDom : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${clazzPrefix}-entry-addon-disabled`, children: addonEntryDom });
|
|
119
122
|
};
|
|
123
|
+
const entryAddonCursor = multilingual ? "pointer" : "not-allowed";
|
|
120
124
|
const renderEntryReadonly = (dom) => {
|
|
121
125
|
var _a2;
|
|
122
126
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_classnames.default)(clazzPrefix, fieldStyle.hashId, `${clazzPrefix}-entry-readonly`, addonPos ? `${clazzPrefix}-entry-readonly-${addonPos}` : void 0), children: [
|
|
@@ -135,8 +139,8 @@ var LocaleInput = (props) => {
|
|
|
135
139
|
{
|
|
136
140
|
addonBefore: buildEntryAddonDom(true),
|
|
137
141
|
addonAfter: buildEntryAddonDom(false),
|
|
138
|
-
cursorBefore: addonPos === "before" ?
|
|
139
|
-
cursorAfter: addonPos === "after" ?
|
|
142
|
+
cursorBefore: addonPos === "before" ? entryAddonCursor : void 0,
|
|
143
|
+
cursorAfter: addonPos === "after" ? entryAddonCursor : void 0,
|
|
140
144
|
fieldProps: {
|
|
141
145
|
className: (0, import_classnames.default)(`${clazzPrefix}-entry-${fieldId}`, (props == null ? void 0 : props.className) ?? ((_a2 = props == null ? void 0 : props.fieldProps) == null ? void 0 : _a2.className)),
|
|
142
146
|
allowClear: (props == null ? void 0 : props.allowClear) || ((_b2 = props == null ? void 0 : props.fieldProps) == null ? void 0 : _b2.allowClear),
|
|
@@ -163,8 +167,8 @@ var LocaleInput = (props) => {
|
|
|
163
167
|
placeholder: import_ts_lang_utils.StringUtils.join(props == null ? void 0 : props.placeholder) ?? ((_d2 = props == null ? void 0 : props.fieldProps) == null ? void 0 : _d2.placeholder),
|
|
164
168
|
addonBefore: buildEntryAddonDom(true),
|
|
165
169
|
addonAfter: buildEntryAddonDom(false),
|
|
166
|
-
cursorBefore: addonPos === "before" ?
|
|
167
|
-
cursorAfter: addonPos === "after" ?
|
|
170
|
+
cursorBefore: addonPos === "before" ? entryAddonCursor : void 0,
|
|
171
|
+
cursorAfter: addonPos === "after" ? entryAddonCursor : void 0,
|
|
168
172
|
proField,
|
|
169
173
|
onChange: (event) => {
|
|
170
174
|
var _a3, _b3;
|
|
@@ -390,13 +394,13 @@ var LocaleInput = (props) => {
|
|
|
390
394
|
}, 200);
|
|
391
395
|
},
|
|
392
396
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
393
|
-
import_antd.
|
|
397
|
+
import_antd.Listy,
|
|
394
398
|
{
|
|
395
|
-
className: `${clazzPrefix}-popup-list`,
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
399
|
+
className: (0, import_classnames.default)(`${clazzPrefix}-popup-list`, `${clazzPrefix}-popup-list-bordered`),
|
|
400
|
+
items: tagInputs,
|
|
401
|
+
rowKey: (_item, index) => index,
|
|
402
|
+
classNames: { item: `${clazzPrefix}-popup-listy-item` },
|
|
403
|
+
itemRender: (item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${clazzPrefix}-popup-list-item`, children: item })
|
|
400
404
|
}
|
|
401
405
|
)
|
|
402
406
|
}
|
|
@@ -33,6 +33,16 @@ var buildFieldStyle = (token) => {
|
|
|
33
33
|
boxShadow: token.boxShadow,
|
|
34
34
|
zIndex: token.zIndexPopupBase,
|
|
35
35
|
[`${token.componentCls}-popup-list`]: {
|
|
36
|
+
[`&${token.componentCls}-popup-list-bordered`]: {
|
|
37
|
+
border: `${(0, import_cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
|
38
|
+
borderRadius: token.borderRadiusLG
|
|
39
|
+
},
|
|
40
|
+
[`${token.componentCls}-popup-listy-item`]: {
|
|
41
|
+
borderBottom: `${(0, import_cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
|
42
|
+
[`&:last-of-type`]: {
|
|
43
|
+
borderBottom: "none"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
36
46
|
[`${token.componentCls}-popup-list-item`]: {
|
|
37
47
|
[`&:hover`]: {
|
|
38
48
|
backgroundColor: token.controlItemBgHover
|
|
@@ -46,6 +56,10 @@ var buildFieldStyle = (token) => {
|
|
|
46
56
|
}
|
|
47
57
|
}
|
|
48
58
|
},
|
|
59
|
+
// ProForm.Item 自带 feedback 区域,去掉 Listy item 的下 padding 让 feedback 充当下方留白,保持上下间距对称
|
|
60
|
+
[`&${token.componentCls}-popup-pro-field ${token.componentCls}-popup-listy-item`]: {
|
|
61
|
+
paddingBottom: 0
|
|
62
|
+
},
|
|
49
63
|
[`&${token.componentCls}-popup-immutable ${token.componentCls}-popup-list ${token.componentCls}-popup-list-item ${token.antCls}-form-item`]: {
|
|
50
64
|
marginBottom: `0 !important`,
|
|
51
65
|
[`${token.componentCls}-locale-tag`]: {
|
|
@@ -85,18 +99,13 @@ var buildFieldStyle = (token) => {
|
|
|
85
99
|
padding: `2px ${token.paddingXS}px`,
|
|
86
100
|
fontSize: token.fontSizeSM
|
|
87
101
|
}
|
|
88
|
-
},
|
|
89
|
-
[`&${token.componentCls}-popup-pro-field:not(${token.componentCls}-popup-immutable)`]: {
|
|
90
|
-
[`${token.componentCls}-popup-list ${token.componentCls}-popup-list-item:first-of-type`]: {
|
|
91
|
-
paddingTop: token.paddingMD
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
[`&:not(${token.componentCls}-popup-pro-field)`]: {
|
|
95
|
-
[`${token.componentCls}-popup-list ${token.componentCls}-popup-list-item:first-of-type`]: {
|
|
96
|
-
paddingTop: token.paddingXS
|
|
97
|
-
}
|
|
98
102
|
}
|
|
99
103
|
},
|
|
104
|
+
// 单语言模式下 addon 无可打开的弹层,呈灰色禁用态
|
|
105
|
+
[`${token.componentCls}-entry-addon-disabled`]: {
|
|
106
|
+
color: token.colorTextDisabled,
|
|
107
|
+
cursor: "not-allowed"
|
|
108
|
+
},
|
|
100
109
|
[`${token.componentCls}-entry-readonly`]: {
|
|
101
110
|
display: "flex",
|
|
102
111
|
flexFlow: "row nowrap",
|
|
@@ -36,7 +36,7 @@ export type TagInputProps = Omit<ProFormFieldItemProps, 'children' | 'fieldRef'
|
|
|
36
36
|
locale?: string;
|
|
37
37
|
localeProps?: IntlLocaleProps;
|
|
38
38
|
};
|
|
39
|
-
export declare const TagInput: React.ForwardRefExoticComponent<Omit<ProFormFieldItemProps, "children" | "
|
|
39
|
+
export declare const TagInput: React.ForwardRefExoticComponent<Omit<ProFormFieldItemProps, "children" | "placeholder" | "fieldProps" | "disabled" | "readonly" | "fieldRef"> & Omit<ProFormFieldRemoteProps, "request" | "valueEnum"> & {
|
|
40
40
|
clazzPrefix?: string | undefined;
|
|
41
41
|
containerClazz?: string | undefined;
|
|
42
42
|
containerStyle?: React.CSSProperties | undefined;
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type BadgeProps, type DropdownProps, type
|
|
3
|
-
import { ListItemMetaProps } from 'antd/es/list/Item';
|
|
2
|
+
import { type BadgeProps, type DropdownProps, type ListyProps, type TabsProps } from 'antd';
|
|
4
3
|
import { type TabPlacement } from 'antd/es/tabs';
|
|
5
4
|
import { type Tab as RcTab } from '@rc-component/tabs/es/interface';
|
|
6
5
|
import { type WithFalse, type ReadonlyTabsType } from "../../type/declaration";
|
|
7
6
|
export type NotifyPresetStyle = WithFalse<'notice' | 'task'>;
|
|
8
7
|
export type NotifyTabPosition = Exclude<TabPlacement, 'bottom'>;
|
|
9
|
-
export type NotifyDataItem =
|
|
8
|
+
export type NotifyDataItem = {
|
|
10
9
|
id?: string;
|
|
10
|
+
avatar?: React.ReactNode;
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
description?: React.ReactNode;
|
|
11
13
|
extra?: React.ReactNode;
|
|
12
14
|
read?: boolean;
|
|
13
15
|
timestamp?: string;
|
|
14
16
|
};
|
|
17
|
+
export type NotifyListProps = Omit<ListyProps<any>, 'itemRender' | 'rowKey'> & {
|
|
18
|
+
dataSource?: any[];
|
|
19
|
+
renderItem?: (item: any, index: number) => React.ReactNode;
|
|
20
|
+
rowKey?: ListyProps<any>['rowKey'];
|
|
21
|
+
footer?: React.ReactNode;
|
|
22
|
+
};
|
|
15
23
|
export type HyperlinkProps = {
|
|
16
24
|
clazz?: string;
|
|
17
25
|
style?: React.CSSProperties;
|
|
@@ -20,8 +28,9 @@ export type HyperlinkProps = {
|
|
|
20
28
|
rel?: string;
|
|
21
29
|
};
|
|
22
30
|
export type MixinTabProps = Omit<RcTab, 'children'> & {
|
|
31
|
+
bordered?: boolean;
|
|
23
32
|
labelBadgeProps?: Omit<BadgeProps, 'children'>;
|
|
24
|
-
listProps?:
|
|
33
|
+
listProps?: NotifyListProps;
|
|
25
34
|
listPlaceholder?: React.ReactNode;
|
|
26
35
|
showClear?: boolean | (() => boolean);
|
|
27
36
|
showMore?: boolean | (() => boolean);
|
|
@@ -5,10 +5,9 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import { Avatar, Badge, Dropdown, Empty,
|
|
8
|
+
import { Avatar, Badge, Dropdown, Empty, Listy, Tabs } from 'antd';
|
|
9
9
|
import { BellOutlined } from '@ant-design/icons';
|
|
10
10
|
import { useIntl } from '@ant-design/pro-components';
|
|
11
|
-
import { If } from '@jiovan-labs/react-condition';
|
|
12
11
|
import { ArrayUtils, BooleanUtils, ObjectUtils } from '@jiovan-labs/ts-lang-utils';
|
|
13
12
|
import { omit } from '@rc-component/util';
|
|
14
13
|
import classnames from 'classnames';
|
|
@@ -67,62 +66,39 @@ export var NotifyBadge = function NotifyBadge(props) {
|
|
|
67
66
|
}));
|
|
68
67
|
};
|
|
69
68
|
var renderPresetList = function renderPresetList(item, index, tab) {
|
|
70
|
-
var avatar = !item.avatar ? undefined : /*#__PURE__*/_jsx(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
className: "".concat(clazzPrefix, "-list-item-avatar"),
|
|
77
|
-
src: item.avatar
|
|
78
|
-
})
|
|
79
|
-
}), /*#__PURE__*/_jsx(If.Else, {
|
|
80
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
81
|
-
className: "".concat(clazzPrefix, "-list-item-icon"),
|
|
82
|
-
children: item.avatar
|
|
83
|
-
})
|
|
84
|
-
})]
|
|
85
|
-
})
|
|
69
|
+
var avatar = !item.avatar ? undefined : typeof item.avatar === 'string' ? /*#__PURE__*/_jsx(Avatar, {
|
|
70
|
+
className: "".concat(clazzPrefix, "-list-item-avatar"),
|
|
71
|
+
src: item.avatar
|
|
72
|
+
}) : /*#__PURE__*/_jsx("span", {
|
|
73
|
+
className: "".concat(clazzPrefix, "-list-item-icon"),
|
|
74
|
+
children: item.avatar
|
|
86
75
|
});
|
|
87
|
-
return /*#__PURE__*/
|
|
76
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
88
77
|
className: classnames("".concat(clazzPrefix, "-list-item"), "".concat(clazzPrefix, "-list-item-").concat(item.read ? 'read' : 'unread')),
|
|
89
78
|
onClick: function onClick(event) {
|
|
90
79
|
var _tab$onClick;
|
|
91
80
|
return (_tab$onClick = tab.onClick) === null || _tab$onClick === void 0 ? void 0 : _tab$onClick.call(tab, event, item.key || item.id || index);
|
|
92
81
|
},
|
|
93
|
-
children: /*#__PURE__*/_jsx(
|
|
82
|
+
children: [!!avatar && /*#__PURE__*/_jsx("div", {
|
|
83
|
+
className: "".concat(clazzPrefix, "-list-item-avatar-wrapper"),
|
|
84
|
+
children: avatar
|
|
85
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
94
86
|
className: "".concat(clazzPrefix, "-list-item-meta"),
|
|
95
|
-
|
|
96
|
-
title: /*#__PURE__*/_jsxs("div", {
|
|
87
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
97
88
|
className: "".concat(clazzPrefix, "-list-item-title"),
|
|
98
|
-
children: [item.title, /*#__PURE__*/_jsx(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
102
|
-
className: "".concat(clazzPrefix, "-list-item-extra"),
|
|
103
|
-
children: item.extra
|
|
104
|
-
})
|
|
105
|
-
})]
|
|
106
|
-
}),
|
|
107
|
-
description: /*#__PURE__*/_jsxs(_Fragment, {
|
|
108
|
-
children: [/*#__PURE__*/_jsx(If, {
|
|
109
|
-
condition: item.description,
|
|
110
|
-
validation: false,
|
|
111
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
112
|
-
className: "".concat(clazzPrefix, "-list-item-description"),
|
|
113
|
-
children: item.description
|
|
114
|
-
})
|
|
115
|
-
}), /*#__PURE__*/_jsx(If, {
|
|
116
|
-
condition: item.timestamp,
|
|
117
|
-
validation: false,
|
|
118
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
119
|
-
className: "".concat(clazzPrefix, "-list-item-timestamp"),
|
|
120
|
-
children: item.timestamp
|
|
121
|
-
})
|
|
89
|
+
children: [item.title, !!item.extra && /*#__PURE__*/_jsx("div", {
|
|
90
|
+
className: "".concat(clazzPrefix, "-list-item-extra"),
|
|
91
|
+
children: item.extra
|
|
122
92
|
})]
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
|
|
93
|
+
}), !!item.description && /*#__PURE__*/_jsx("div", {
|
|
94
|
+
className: "".concat(clazzPrefix, "-list-item-description"),
|
|
95
|
+
children: item.description
|
|
96
|
+
}), !!item.timestamp && /*#__PURE__*/_jsx("div", {
|
|
97
|
+
className: "".concat(clazzPrefix, "-list-item-timestamp"),
|
|
98
|
+
children: item.timestamp
|
|
99
|
+
})]
|
|
100
|
+
})]
|
|
101
|
+
});
|
|
126
102
|
};
|
|
127
103
|
var renderListFooter = function renderListFooter(tab) {
|
|
128
104
|
var _tab$listProps3, _props$localeProps, _props$localeProps2;
|
|
@@ -134,29 +110,21 @@ export var NotifyBadge = function NotifyBadge(props) {
|
|
|
134
110
|
}
|
|
135
111
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
136
112
|
children: [(_tab$listProps3 = tab.listProps) === null || _tab$listProps3 === void 0 ? void 0 : _tab$listProps3.footer, /*#__PURE__*/_jsxs("div", {
|
|
137
|
-
className: "".concat(clazzPrefix, "-builtin-footer"),
|
|
138
|
-
children: [/*#__PURE__*/_jsx(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
153
|
-
className: "".concat(clazzPrefix, "-action-button"),
|
|
154
|
-
onClick: function onClick(event) {
|
|
155
|
-
var _tab$onMore, _tab$key2;
|
|
156
|
-
return (_tab$onMore = tab.onMore) === null || _tab$onMore === void 0 ? void 0 : _tab$onMore.call(tab, event, (_tab$key2 = tab.key) !== null && _tab$key2 !== void 0 ? _tab$key2 : tab.presetStyle);
|
|
157
|
-
},
|
|
158
|
-
children: ObjectUtils.firstNotNil(props === null || props === void 0 || (_props$localeProps2 = props.localeProps) === null || _props$localeProps2 === void 0 ? void 0 : _props$localeProps2.more, intlLocales.get([locale, 'more']), intlLocales.get(['en_US', 'more']))
|
|
159
|
-
})
|
|
113
|
+
className: classnames("".concat(clazzPrefix, "-builtin-footer"), tab.bordered ? undefined : "".concat(clazzPrefix, "-builtin-footer-bordered")),
|
|
114
|
+
children: [showClear && /*#__PURE__*/_jsx("div", {
|
|
115
|
+
className: "".concat(clazzPrefix, "-action-button"),
|
|
116
|
+
onClick: function onClick(event) {
|
|
117
|
+
var _tab$onClear, _tab$key;
|
|
118
|
+
return (_tab$onClear = tab.onClear) === null || _tab$onClear === void 0 ? void 0 : _tab$onClear.call(tab, event, (_tab$key = tab.key) !== null && _tab$key !== void 0 ? _tab$key : tab.presetStyle);
|
|
119
|
+
},
|
|
120
|
+
children: ObjectUtils.firstNotNil(props === null || props === void 0 || (_props$localeProps = props.localeProps) === null || _props$localeProps === void 0 ? void 0 : _props$localeProps.clear, intlLocales.get([locale, 'clear']), intlLocales.get(['en_US', 'clear']))
|
|
121
|
+
}), showMore && /*#__PURE__*/_jsx("div", {
|
|
122
|
+
className: "".concat(clazzPrefix, "-action-button"),
|
|
123
|
+
onClick: function onClick(event) {
|
|
124
|
+
var _tab$onMore, _tab$key2;
|
|
125
|
+
return (_tab$onMore = tab.onMore) === null || _tab$onMore === void 0 ? void 0 : _tab$onMore.call(tab, event, (_tab$key2 = tab.key) !== null && _tab$key2 !== void 0 ? _tab$key2 : tab.presetStyle);
|
|
126
|
+
},
|
|
127
|
+
children: ObjectUtils.firstNotNil(props === null || props === void 0 || (_props$localeProps2 = props.localeProps) === null || _props$localeProps2 === void 0 ? void 0 : _props$localeProps2.more, intlLocales.get([locale, 'more']), intlLocales.get(['en_US', 'more']))
|
|
160
128
|
})]
|
|
161
129
|
})]
|
|
162
130
|
});
|
|
@@ -167,23 +135,34 @@ export var NotifyBadge = function NotifyBadge(props) {
|
|
|
167
135
|
return undefined;
|
|
168
136
|
}
|
|
169
137
|
return props.tabsProps.items.map(function (tab) {
|
|
170
|
-
var _tab$listProps4, _tab$listPlaceholder, _tab$
|
|
171
|
-
var
|
|
138
|
+
var _tab$listProps$items, _tab$listProps4, _tab$listProps5, _tab$listPlaceholder, _tab$listProps6, _tab$listProps$rowKey, _tab$listProps7, _tab$key3;
|
|
139
|
+
var listItems = (_tab$listProps$items = (_tab$listProps4 = tab.listProps) === null || _tab$listProps4 === void 0 ? void 0 : _tab$listProps4.items) !== null && _tab$listProps$items !== void 0 ? _tab$listProps$items : (_tab$listProps5 = tab.listProps) === null || _tab$listProps5 === void 0 ? void 0 : _tab$listProps5.dataSource;
|
|
140
|
+
var empty = !listItems || Array.isArray(listItems) && !listItems.length;
|
|
172
141
|
var placeholder = (_tab$listPlaceholder = tab.listPlaceholder) !== null && _tab$listPlaceholder !== void 0 ? _tab$listPlaceholder : /*#__PURE__*/_jsx(Empty, {
|
|
173
142
|
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
174
143
|
});
|
|
175
|
-
var content = empty ? placeholder : /*#__PURE__*/
|
|
176
|
-
className:
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return
|
|
144
|
+
var content = empty ? placeholder : /*#__PURE__*/_jsxs("div", {
|
|
145
|
+
className: "".concat(clazzPrefix, "-tab-list-wrapper"),
|
|
146
|
+
children: [/*#__PURE__*/_jsx(Listy, _objectSpread(_objectSpread({
|
|
147
|
+
className: classnames("".concat(clazzPrefix, "-tab-list"), tab.bordered ? "".concat(clazzPrefix, "-tab-list-bordered") : undefined, (_tab$listProps6 = tab.listProps) === null || _tab$listProps6 === void 0 ? void 0 : _tab$listProps6.className),
|
|
148
|
+
items: listItems,
|
|
149
|
+
rowKey: (_tab$listProps$rowKey = (_tab$listProps7 = tab.listProps) === null || _tab$listProps7 === void 0 ? void 0 : _tab$listProps7.rowKey) !== null && _tab$listProps$rowKey !== void 0 ? _tab$listProps$rowKey : function (item) {
|
|
150
|
+
var _item$key;
|
|
151
|
+
return (_item$key = item === null || item === void 0 ? void 0 : item.key) !== null && _item$key !== void 0 ? _item$key : item === null || item === void 0 ? void 0 : item.id;
|
|
152
|
+
},
|
|
153
|
+
classNames: {
|
|
154
|
+
item: "".concat(clazzPrefix, "-listy-item")
|
|
183
155
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
156
|
+
}, !(tab !== null && tab !== void 0 && tab.listProps) ? {} : omit(tab.listProps, ['className', 'footer', 'renderItem', 'dataSource', 'items', 'rowKey', 'classNames'])), {}, {
|
|
157
|
+
itemRender: function itemRender(item, index) {
|
|
158
|
+
var _tab$listProps8;
|
|
159
|
+
if ((_tab$listProps8 = tab.listProps) !== null && _tab$listProps8 !== void 0 && _tab$listProps8.renderItem) {
|
|
160
|
+
return tab.listProps.renderItem(item, index);
|
|
161
|
+
}
|
|
162
|
+
return tab.presetStyle === 'notice' || tab.presetStyle === 'task' ? renderPresetList(item, index, tab) : undefined;
|
|
163
|
+
}
|
|
164
|
+
})), renderListFooter(tab)]
|
|
165
|
+
});
|
|
187
166
|
return _objectSpread(_objectSpread({
|
|
188
167
|
key: (_tab$key3 = tab.key) !== null && _tab$key3 !== void 0 ? _tab$key3 : tab.presetStyle,
|
|
189
168
|
label: renderTabLabel(tab)
|
|
@@ -16,28 +16,36 @@ var buildFieldStyle = function buildFieldStyle(token) {
|
|
|
16
16
|
}, "&:hover", {
|
|
17
17
|
backgroundColor: 'unset !important',
|
|
18
18
|
cursor: 'unset !important'
|
|
19
|
-
})), "".concat(token.componentCls, "-tabs"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(token.antCls, "-tabs-content-top ").concat(token.antCls, "-tabs-tab"), {
|
|
19
|
+
})), "".concat(token.componentCls, "-tabs"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(token.antCls, "-tabs-content-top ").concat(token.antCls, "-tabs-tab"), {
|
|
20
20
|
paddingTop: 2
|
|
21
21
|
}), "".concat(token.antCls, "-tabs-content-left ").concat(token.antCls, "-tabs-tabpane"), {
|
|
22
22
|
paddingLeft: token.paddingXS
|
|
23
23
|
}), "".concat(token.antCls, "-tabs-content-right ").concat(token.antCls, "-tabs-tabpane"), {
|
|
24
24
|
paddingRight: token.paddingXS
|
|
25
|
-
}), "".concat(token.componentCls, "-tab-list"), _defineProperty(
|
|
25
|
+
}), "".concat(token.componentCls, "-tab-list-wrapper"), _defineProperty({
|
|
26
26
|
maxHeight: 400,
|
|
27
27
|
overflow: 'auto'
|
|
28
28
|
}, "&::-webkit-scrollbar", {
|
|
29
29
|
display: 'none'
|
|
30
|
-
}), "".concat(token.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
})), "".concat(token.componentCls, "-tab-list"), _defineProperty(_defineProperty({}, "&".concat(token.componentCls, "-tab-list-bordered"), {
|
|
31
|
+
border: "".concat(unit(token.lineWidth), " ").concat(token.lineType, " ").concat(token.colorSplit),
|
|
32
|
+
borderRadius: token.borderRadius
|
|
33
|
+
}), "".concat(token.antCls, "-listy-item:last-child"), {
|
|
34
|
+
borderBottom: 'none'
|
|
35
|
+
})), "".concat(token.componentCls, "-listy-item"), _defineProperty({
|
|
34
36
|
cursor: 'pointer',
|
|
35
|
-
paddingRight: token.paddingXS,
|
|
36
|
-
paddingLeft: token.paddingXS,
|
|
37
|
-
overflow: 'hidden',
|
|
38
37
|
transition: 'all 0.3s'
|
|
38
|
+
}, "&:hover", {
|
|
39
|
+
backgroundColor: token.controlItemBgActive
|
|
40
|
+
})), "".concat(token.componentCls, "-list-item"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
41
|
+
display: 'flex',
|
|
42
|
+
alignItems: 'flex-start',
|
|
43
|
+
gap: token.paddingXS,
|
|
44
|
+
overflow: 'hidden'
|
|
39
45
|
}, "&&-read", {
|
|
40
46
|
opacity: 0.4
|
|
47
|
+
}), "&-avatar-wrapper", {
|
|
48
|
+
flex: 'none'
|
|
41
49
|
}), "&-avatar", {
|
|
42
50
|
backgroundColor: token.colorBgContainer,
|
|
43
51
|
marginTop: token.marginXXS
|
|
@@ -52,27 +60,25 @@ var buildFieldStyle = function buildFieldStyle(token) {
|
|
|
52
60
|
fontSize: token.fontSize - 1
|
|
53
61
|
}), "&-timestamp", {
|
|
54
62
|
marginTop: token.marginXXS,
|
|
55
|
-
fontSize: token.fontSizeSM
|
|
63
|
+
fontSize: token.fontSizeSM,
|
|
64
|
+
color: token.colorTextTertiary
|
|
56
65
|
}), "&-extra", {
|
|
57
66
|
float: 'right',
|
|
58
67
|
marginTop: -1.5,
|
|
59
68
|
marginRight: 0,
|
|
60
69
|
color: token.colorTextSecondary,
|
|
61
70
|
fontWeight: 'normal'
|
|
62
|
-
}), "
|
|
63
|
-
backgroundColor: token.controlItemBgActive
|
|
64
|
-
}), "&:last-child", {
|
|
65
|
-
borderBottom: 'none !important'
|
|
66
|
-
})), "".concat(token.componentCls, "-builtin-footer"), _defineProperty({
|
|
71
|
+
})), "".concat(token.componentCls, "-builtin-footer"), _defineProperty(_defineProperty({
|
|
67
72
|
height: 38,
|
|
68
73
|
color: token.colorPrimaryText,
|
|
69
74
|
display: 'flex',
|
|
70
75
|
alignItems: 'start',
|
|
71
76
|
textAlign: 'center',
|
|
72
|
-
borderTop: "".concat(unit(token.lineWidth), " ").concat(token.lineType, " ").concat(token.colorSplit),
|
|
73
|
-
borderRadius: "0 0 ".concat(token.borderRadius, "px ").concat(token.borderRadius, "px"),
|
|
74
77
|
transition: 'all 0.3s'
|
|
75
|
-
}, "".concat(token.componentCls, "-
|
|
78
|
+
}, "&".concat(token.componentCls, "-builtin-footer-bordered"), {
|
|
79
|
+
borderTop: "".concat(unit(token.lineWidth), " ").concat(token.lineType, " ").concat(token.colorSplit),
|
|
80
|
+
borderRadius: "0 0 ".concat(token.borderRadius, "px ").concat(token.borderRadius, "px")
|
|
81
|
+
}), "".concat(token.componentCls, "-action-button"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
76
82
|
display: 'flex',
|
|
77
83
|
flex: 1,
|
|
78
84
|
cursor: 'pointer',
|
|
@@ -6,10 +6,14 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
8
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
9
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
10
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
14
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
17
|
import React from 'react';
|
|
14
18
|
import { Form, Input, Space } from 'antd';
|
|
15
19
|
import { ProForm, FormListContext } from '@ant-design/pro-components';
|
|
@@ -37,6 +41,12 @@ export var AddonInput = function AddonInput(props) {
|
|
|
37
41
|
_ref$proField = _ref.proField,
|
|
38
42
|
proField = _ref$proField === void 0 ? true : _ref$proField;
|
|
39
43
|
var fieldStyle = useFieldStyle(clazzPrefix);
|
|
44
|
+
var compositionRef = React.useRef(false);
|
|
45
|
+
var _React$useState = React.useState(undefined),
|
|
46
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
47
|
+
composingValue = _React$useState2[0],
|
|
48
|
+
setComposingValue = _React$useState2[1];
|
|
49
|
+
var webkitBrowser = navigator.userAgent.indexOf('WebKit') !== -1;
|
|
40
50
|
var addonBeforeDom = typeof (props === null || props === void 0 ? void 0 : props.addonBefore) === 'function' ? props.addonBefore() : props === null || props === void 0 ? void 0 : props.addonBefore;
|
|
41
51
|
var addonAfterDom = typeof (props === null || props === void 0 ? void 0 : props.addonAfter) === 'function' ? props.addonAfter() : props === null || props === void 0 ? void 0 : props.addonAfter;
|
|
42
52
|
var addonBeforeStyle = {
|
|
@@ -59,9 +69,41 @@ export var AddonInput = function AddonInput(props) {
|
|
|
59
69
|
var widthBlockClazz = !widthBlock ? undefined : "".concat(clazzPrefix, "-width-block");
|
|
60
70
|
var entryReadModeClazz = !entryReadMode ? undefined : "".concat(clazzPrefix, "-read-mode");
|
|
61
71
|
var entryImmutableClazz = !entryImmutable ? undefined : "".concat(clazzPrefix, "-immutable");
|
|
62
|
-
var omitFieldProps = !(props !== null && props !== void 0 && props.fieldProps) ? {} : omit(props === null || props === void 0 ? void 0 : props.fieldProps, ['className', 'name', 'id', 'placeholder', 'allowClear', 'readOnly', 'disabled', 'value', 'onChange']);
|
|
72
|
+
var omitFieldProps = !(props !== null && props !== void 0 && props.fieldProps) ? {} : omit(props === null || props === void 0 ? void 0 : props.fieldProps, ['className', 'name', 'id', 'placeholder', 'allowClear', 'readOnly', 'disabled', 'value', 'onChange', 'onCompositionStart', 'onCompositionEnd']);
|
|
73
|
+
var setFieldValue = function setFieldValue(value) {
|
|
74
|
+
if (simpleName) {
|
|
75
|
+
form === null || form === void 0 || form.setFieldValue(simpleName, value);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
var handleChange = function handleChange(event) {
|
|
79
|
+
var _props$fieldProps6, _props$fieldProps6$on;
|
|
80
|
+
if (compositionRef.current) {
|
|
81
|
+
setComposingValue(event.target.value);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (!simpleName) {
|
|
85
|
+
setComposingValue(event.target.value);
|
|
86
|
+
}
|
|
87
|
+
setFieldValue(event.target.value);
|
|
88
|
+
props === null || props === void 0 || (_props$fieldProps6 = props.fieldProps) === null || _props$fieldProps6 === void 0 || (_props$fieldProps6$on = _props$fieldProps6.onChange) === null || _props$fieldProps6$on === void 0 || _props$fieldProps6$on.call(_props$fieldProps6, event);
|
|
89
|
+
};
|
|
90
|
+
var handleCompositionStart = function handleCompositionStart(event) {
|
|
91
|
+
var _props$fieldProps7, _props$fieldProps7$on;
|
|
92
|
+
compositionRef.current = true;
|
|
93
|
+
props === null || props === void 0 || (_props$fieldProps7 = props.fieldProps) === null || _props$fieldProps7 === void 0 || (_props$fieldProps7$on = _props$fieldProps7.onCompositionStart) === null || _props$fieldProps7$on === void 0 || _props$fieldProps7$on.call(_props$fieldProps7, event);
|
|
94
|
+
};
|
|
95
|
+
var handleCompositionEnd = function handleCompositionEnd(event) {
|
|
96
|
+
var _props$fieldProps8, _props$fieldProps8$on;
|
|
97
|
+
compositionRef.current = false;
|
|
98
|
+
props === null || props === void 0 || (_props$fieldProps8 = props.fieldProps) === null || _props$fieldProps8 === void 0 || (_props$fieldProps8$on = _props$fieldProps8.onCompositionEnd) === null || _props$fieldProps8$on === void 0 || _props$fieldProps8$on.call(_props$fieldProps8, event);
|
|
99
|
+
var finalValue = event.currentTarget.value;
|
|
100
|
+
setComposingValue(simpleName ? undefined : finalValue);
|
|
101
|
+
if (webkitBrowser) {
|
|
102
|
+
setFieldValue(finalValue);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
63
105
|
if (proField) {
|
|
64
|
-
var _props$
|
|
106
|
+
var _props$fieldProps9, _StringUtils$join, _props$fieldProps10, _props$proFieldProps3, _props$fieldProps11;
|
|
65
107
|
var restProps = !props ? {} : omit(props, ['className', 'name', 'allowClear', 'fieldProps', 'proFieldProps', 'clazzPrefix', 'addonBefore', 'addonAfter', 'cursorBefore', 'cursorAfter', 'paddingBefore', 'paddingAfter', 'widthBlock', 'proField']);
|
|
66
108
|
return /*#__PURE__*/_jsx("div", {
|
|
67
109
|
className: classnames(clazzPrefix, fieldStyle.hashId, proFieldClazz, widthBlockClazz, entryReadModeClazz, entryImmutableClazz),
|
|
@@ -78,23 +120,19 @@ export var AddonInput = function AddonInput(props) {
|
|
|
78
120
|
style: addonBeforeStyle,
|
|
79
121
|
children: addonBeforeDom
|
|
80
122
|
}), /*#__PURE__*/_jsx(Input, _objectSpread({
|
|
81
|
-
className: classnames("".concat(clazzPrefix, "-input"), props === null || props === void 0 || (_props$
|
|
82
|
-
placeholder: (_StringUtils$join = StringUtils.join(props === null || props === void 0 ? void 0 : props.placeholder)) !== null && _StringUtils$join !== void 0 ? _StringUtils$join : props === null || props === void 0 || (_props$
|
|
123
|
+
className: classnames("".concat(clazzPrefix, "-input"), props === null || props === void 0 || (_props$fieldProps9 = props.fieldProps) === null || _props$fieldProps9 === void 0 ? void 0 : _props$fieldProps9.className),
|
|
124
|
+
placeholder: (_StringUtils$join = StringUtils.join(props === null || props === void 0 ? void 0 : props.placeholder)) !== null && _StringUtils$join !== void 0 ? _StringUtils$join : props === null || props === void 0 || (_props$fieldProps10 = props.fieldProps) === null || _props$fieldProps10 === void 0 ? void 0 : _props$fieldProps10.placeholder,
|
|
83
125
|
name: simpleName,
|
|
84
|
-
value: entryReadMode ? fieldValue || (props === null || props === void 0 || (_props$proFieldProps3 = props.proFieldProps) === null || _props$proFieldProps3 === void 0 ? void 0 : _props$proFieldProps3.emptyText) || '-' : fieldValue,
|
|
85
|
-
allowClear: !entryImmutable && (props === null || props === void 0 ? void 0 : props.allowClear) !== false && (props === null || props === void 0 || (_props$
|
|
126
|
+
value: composingValue !== null && composingValue !== void 0 ? composingValue : entryReadMode ? fieldValue || (props === null || props === void 0 || (_props$proFieldProps3 = props.proFieldProps) === null || _props$proFieldProps3 === void 0 ? void 0 : _props$proFieldProps3.emptyText) || '-' : fieldValue,
|
|
127
|
+
allowClear: !entryImmutable && (props === null || props === void 0 ? void 0 : props.allowClear) !== false && (props === null || props === void 0 || (_props$fieldProps11 = props.fieldProps) === null || _props$fieldProps11 === void 0 ? void 0 : _props$fieldProps11.allowClear) !== false,
|
|
86
128
|
readOnly: entryReadMode || entryReadonly,
|
|
87
129
|
disabled: entryDisabled,
|
|
88
130
|
style: !inputWidth ? undefined : {
|
|
89
131
|
width: inputWidth
|
|
90
132
|
},
|
|
91
|
-
onChange:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
form === null || form === void 0 || form.setFieldValue(simpleName, event.target.value);
|
|
95
|
-
}
|
|
96
|
-
props === null || props === void 0 || (_props$fieldProps9 = props.fieldProps) === null || _props$fieldProps9 === void 0 || (_props$fieldProps9$on = _props$fieldProps9.onChange) === null || _props$fieldProps9$on === void 0 || _props$fieldProps9$on.call(_props$fieldProps9, event);
|
|
97
|
-
}
|
|
133
|
+
onChange: handleChange,
|
|
134
|
+
onCompositionStart: handleCompositionStart,
|
|
135
|
+
onCompositionEnd: handleCompositionEnd
|
|
98
136
|
}, omitFieldProps)), !!addonAfterDom && /*#__PURE__*/_jsx(Space.Addon, {
|
|
99
137
|
className: "".concat(clazzPrefix, "-compact-after"),
|
|
100
138
|
style: addonAfterStyle,
|
|
@@ -104,9 +142,9 @@ export var AddonInput = function AddonInput(props) {
|
|
|
104
142
|
}))
|
|
105
143
|
});
|
|
106
144
|
} else {
|
|
107
|
-
var _props$className, _props$
|
|
145
|
+
var _props$className, _props$fieldProps12, _props$fieldProps13, _StringUtils$join2, _props$fieldProps14, _props$proFieldProps4;
|
|
108
146
|
return /*#__PURE__*/_jsx("div", {
|
|
109
|
-
className: classnames(clazzPrefix, fieldStyle.hashId, proFieldClazz, widthBlockClazz, entryReadModeClazz, entryImmutableClazz, (_props$className = props === null || props === void 0 ? void 0 : props.className) !== null && _props$className !== void 0 ? _props$className : props === null || props === void 0 || (_props$
|
|
147
|
+
className: classnames(clazzPrefix, fieldStyle.hashId, proFieldClazz, widthBlockClazz, entryReadModeClazz, entryImmutableClazz, (_props$className = props === null || props === void 0 ? void 0 : props.className) !== null && _props$className !== void 0 ? _props$className : props === null || props === void 0 || (_props$fieldProps12 = props.fieldProps) === null || _props$fieldProps12 === void 0 ? void 0 : _props$fieldProps12.className),
|
|
110
148
|
children: /*#__PURE__*/_jsxs(Space.Compact, {
|
|
111
149
|
className: "".concat(clazzPrefix, "-space"),
|
|
112
150
|
style: {
|
|
@@ -117,22 +155,18 @@ export var AddonInput = function AddonInput(props) {
|
|
|
117
155
|
style: addonBeforeStyle,
|
|
118
156
|
children: addonBeforeDom
|
|
119
157
|
}), /*#__PURE__*/_jsx(Input, _objectSpread({
|
|
120
|
-
className: classnames("".concat(clazzPrefix, "-input"), props === null || props === void 0 || (_props$
|
|
158
|
+
className: classnames("".concat(clazzPrefix, "-input"), props === null || props === void 0 || (_props$fieldProps13 = props.fieldProps) === null || _props$fieldProps13 === void 0 ? void 0 : _props$fieldProps13.className),
|
|
121
159
|
name: simpleName,
|
|
122
|
-
placeholder: (_StringUtils$join2 = StringUtils.join(props === null || props === void 0 ? void 0 : props.placeholder)) !== null && _StringUtils$join2 !== void 0 ? _StringUtils$join2 : props === null || props === void 0 || (_props$
|
|
123
|
-
value: entryReadMode ? fieldValue || (props === null || props === void 0 || (_props$proFieldProps4 = props.proFieldProps) === null || _props$proFieldProps4 === void 0 ? void 0 : _props$proFieldProps4.emptyText) || '-' : fieldValue,
|
|
160
|
+
placeholder: (_StringUtils$join2 = StringUtils.join(props === null || props === void 0 ? void 0 : props.placeholder)) !== null && _StringUtils$join2 !== void 0 ? _StringUtils$join2 : props === null || props === void 0 || (_props$fieldProps14 = props.fieldProps) === null || _props$fieldProps14 === void 0 ? void 0 : _props$fieldProps14.placeholder,
|
|
161
|
+
value: composingValue !== null && composingValue !== void 0 ? composingValue : entryReadMode ? fieldValue || (props === null || props === void 0 || (_props$proFieldProps4 = props.proFieldProps) === null || _props$proFieldProps4 === void 0 ? void 0 : _props$proFieldProps4.emptyText) || '-' : fieldValue,
|
|
124
162
|
readOnly: entryReadMode || entryReadonly,
|
|
125
163
|
disabled: entryDisabled,
|
|
126
164
|
style: !inputWidth ? undefined : {
|
|
127
165
|
width: inputWidth
|
|
128
166
|
},
|
|
129
|
-
onChange:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
form === null || form === void 0 || form.setFieldValue(props.name, event.target.value);
|
|
133
|
-
}
|
|
134
|
-
props === null || props === void 0 || (_props$fieldProps13 = props.fieldProps) === null || _props$fieldProps13 === void 0 || (_props$fieldProps13$o = _props$fieldProps13.onChange) === null || _props$fieldProps13$o === void 0 || _props$fieldProps13$o.call(_props$fieldProps13, event);
|
|
135
|
-
}
|
|
167
|
+
onChange: handleChange,
|
|
168
|
+
onCompositionStart: handleCompositionStart,
|
|
169
|
+
onCompositionEnd: handleCompositionEnd
|
|
136
170
|
}, omitFieldProps)), !!addonAfterDom && /*#__PURE__*/_jsx(Space.Addon, {
|
|
137
171
|
className: "".concat(clazzPrefix, "-compact-after"),
|
|
138
172
|
style: addonAfterStyle,
|
|
@@ -45,7 +45,7 @@ export type AvatarUploadProps = Omit<ProFormFieldItemProps, 'children' | 'fieldR
|
|
|
45
45
|
locale?: string;
|
|
46
46
|
localeProps?: IntlLocaleProps;
|
|
47
47
|
};
|
|
48
|
-
export declare const AvatarUpload: React.ForwardRefExoticComponent<Omit<ProFormFieldItemProps, "children" | "
|
|
48
|
+
export declare const AvatarUpload: React.ForwardRefExoticComponent<Omit<ProFormFieldItemProps, "children" | "placeholder" | "fieldProps" | "disabled" | "readonly" | "fieldRef"> & {
|
|
49
49
|
clazzPrefix?: string | undefined;
|
|
50
50
|
containerClazz?: string | undefined;
|
|
51
51
|
containerStyle?: React.CSSProperties | undefined;
|
|
@@ -54,7 +54,7 @@ export declare const AvatarUpload: React.ForwardRefExoticComponent<Omit<ProFormF
|
|
|
54
54
|
fallbackSrc?: string | undefined;
|
|
55
55
|
shape?: CircleSquareShape | undefined;
|
|
56
56
|
avatarProps?: Omit<AvatarProps, "children" | "src" | "srcSet" | "shape"> | undefined;
|
|
57
|
-
imageProps?: Omit<ImageProps, "title" | "src" | "
|
|
57
|
+
imageProps?: Omit<ImageProps, "title" | "src" | "fallback" | "preview" | "height" | "srcSet" | "width"> | undefined;
|
|
58
58
|
uploadEnabled?: boolean | undefined;
|
|
59
59
|
uploadProps?: FileUploadProps | undefined;
|
|
60
60
|
cropEnabled?: boolean | undefined;
|
|
@@ -16,7 +16,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
16
16
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
18
|
import React from 'react';
|
|
19
|
-
import { ConfigProvider, Form,
|
|
19
|
+
import { ConfigProvider, Form, Listy, Popconfirm, Space, Tooltip } from 'antd';
|
|
20
20
|
import { TranslationOutlined, SelectOutlined } from '@ant-design/icons';
|
|
21
21
|
import { useIntl } from '@ant-design/pro-components';
|
|
22
22
|
import { EditOrReadOnlyContext } from '@ant-design/pro-components/es/form/BaseForm/EditOrReadOnlyContext.js';
|
|
@@ -121,8 +121,15 @@ export var LocaleInput = function LocaleInput(props) {
|
|
|
121
121
|
useEventListener('resize', handleWindowResize);
|
|
122
122
|
var addonEntryDom = typeof addon === 'function' ? addon() : addon;
|
|
123
123
|
var buildEntryAddonDom = function buildEntryAddonDom(before) {
|
|
124
|
-
|
|
124
|
+
if (!(before && addonPos === 'before' || !before && addonPos === 'after')) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
return multilingual ? addonEntryDom : /*#__PURE__*/_jsx("span", {
|
|
128
|
+
className: "".concat(clazzPrefix, "-entry-addon-disabled"),
|
|
129
|
+
children: addonEntryDom
|
|
130
|
+
});
|
|
125
131
|
};
|
|
132
|
+
var entryAddonCursor = multilingual ? 'pointer' : 'not-allowed';
|
|
126
133
|
var renderEntryReadonly = function renderEntryReadonly(dom) {
|
|
127
134
|
var _props$proFieldProps;
|
|
128
135
|
return /*#__PURE__*/_jsxs("div", {
|
|
@@ -157,8 +164,8 @@ export var LocaleInput = function LocaleInput(props) {
|
|
|
157
164
|
children: /*#__PURE__*/_jsx(AddonInput, _objectSpread({
|
|
158
165
|
addonBefore: buildEntryAddonDom(true),
|
|
159
166
|
addonAfter: buildEntryAddonDom(false),
|
|
160
|
-
cursorBefore: addonPos === 'before' ?
|
|
161
|
-
cursorAfter: addonPos === 'after' ?
|
|
167
|
+
cursorBefore: addonPos === 'before' ? entryAddonCursor : undefined,
|
|
168
|
+
cursorAfter: addonPos === 'after' ? entryAddonCursor : undefined,
|
|
162
169
|
fieldProps: _objectSpread(_objectSpread({
|
|
163
170
|
className: classnames("".concat(clazzPrefix, "-entry-").concat(fieldId), (_props$className = props === null || props === void 0 ? void 0 : props.className) !== null && _props$className !== void 0 ? _props$className : props === null || props === void 0 || (_props$fieldProps = props.fieldProps) === null || _props$fieldProps === void 0 ? void 0 : _props$fieldProps.className),
|
|
164
171
|
allowClear: (props === null || props === void 0 ? void 0 : props.allowClear) || (props === null || props === void 0 || (_props$fieldProps2 = props.fieldProps) === null || _props$fieldProps2 === void 0 ? void 0 : _props$fieldProps2.allowClear)
|
|
@@ -184,8 +191,8 @@ export var LocaleInput = function LocaleInput(props) {
|
|
|
184
191
|
placeholder: (_StringUtils$join = StringUtils.join(props === null || props === void 0 ? void 0 : props.placeholder)) !== null && _StringUtils$join !== void 0 ? _StringUtils$join : props === null || props === void 0 || (_props$fieldProps4 = props.fieldProps) === null || _props$fieldProps4 === void 0 ? void 0 : _props$fieldProps4.placeholder,
|
|
185
192
|
addonBefore: buildEntryAddonDom(true),
|
|
186
193
|
addonAfter: buildEntryAddonDom(false),
|
|
187
|
-
cursorBefore: addonPos === 'before' ?
|
|
188
|
-
cursorAfter: addonPos === 'after' ?
|
|
194
|
+
cursorBefore: addonPos === 'before' ? entryAddonCursor : undefined,
|
|
195
|
+
cursorAfter: addonPos === 'after' ? entryAddonCursor : undefined,
|
|
189
196
|
proField: proField,
|
|
190
197
|
onChange: function onChange(event) {
|
|
191
198
|
var _props$fieldProps5, _props$fieldProps5$on;
|
|
@@ -435,13 +442,17 @@ export var LocaleInput = function LocaleInput(props) {
|
|
|
435
442
|
props === null || props === void 0 || (_props$triggerProps = props.triggerProps) === null || _props$triggerProps === void 0 || (_props$triggerProps$o = _props$triggerProps.onOpenChange) === null || _props$triggerProps$o === void 0 || _props$triggerProps$o.call(_props$triggerProps, false);
|
|
436
443
|
}, 200);
|
|
437
444
|
},
|
|
438
|
-
children: /*#__PURE__*/_jsx(
|
|
439
|
-
className: "".concat(clazzPrefix, "-popup-list"),
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
+
children: /*#__PURE__*/_jsx(Listy, {
|
|
446
|
+
className: classnames("".concat(clazzPrefix, "-popup-list"), "".concat(clazzPrefix, "-popup-list-bordered")),
|
|
447
|
+
items: tagInputs,
|
|
448
|
+
rowKey: function rowKey(_item, index) {
|
|
449
|
+
return index;
|
|
450
|
+
},
|
|
451
|
+
classNames: {
|
|
452
|
+
item: "".concat(clazzPrefix, "-popup-listy-item")
|
|
453
|
+
},
|
|
454
|
+
itemRender: function itemRender(item) {
|
|
455
|
+
return /*#__PURE__*/_jsx("div", {
|
|
445
456
|
className: "".concat(clazzPrefix, "-popup-list-item"),
|
|
446
457
|
children: item
|
|
447
458
|
});
|
|
@@ -8,19 +8,28 @@ import { unit } from '@ant-design/cssinjs';
|
|
|
8
8
|
import { useStyle } from '@ant-design/pro-components';
|
|
9
9
|
import { PackageConst } from "../../constant/PackageConst";
|
|
10
10
|
var buildFieldStyle = function buildFieldStyle(token) {
|
|
11
|
-
return _defineProperty(_defineProperty({}, "".concat(token.componentCls, "-popup"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(
|
|
11
|
+
return _defineProperty(_defineProperty(_defineProperty({}, "".concat(token.componentCls, "-popup"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
12
12
|
backgroundColor: token.colorBgContainer,
|
|
13
13
|
borderRadius: token.borderRadiusLG,
|
|
14
14
|
boxShadow: token.boxShadow,
|
|
15
15
|
zIndex: token.zIndexPopupBase
|
|
16
|
-
}, "".concat(token.componentCls, "-popup-list"), _defineProperty({}, "".concat(token.componentCls, "-popup-list-
|
|
16
|
+
}, "".concat(token.componentCls, "-popup-list"), _defineProperty(_defineProperty(_defineProperty({}, "&".concat(token.componentCls, "-popup-list-bordered"), {
|
|
17
|
+
border: "".concat(unit(token.lineWidth), " ").concat(token.lineType, " ").concat(token.colorSplit),
|
|
18
|
+
borderRadius: token.borderRadiusLG
|
|
19
|
+
}), "".concat(token.componentCls, "-popup-listy-item"), _defineProperty({
|
|
20
|
+
borderBottom: "".concat(unit(token.lineWidth), " ").concat(token.lineType, " ").concat(token.colorSplit)
|
|
21
|
+
}, "&:last-of-type", {
|
|
22
|
+
borderBottom: 'none'
|
|
23
|
+
})), "".concat(token.componentCls, "-popup-list-item"), _defineProperty(_defineProperty(_defineProperty({}, "&:hover", {
|
|
17
24
|
backgroundColor: token.controlItemBgHover
|
|
18
25
|
}), "> ".concat(token.antCls, "-form-item"), {
|
|
19
26
|
width: '100%'
|
|
20
27
|
}), "".concat(token.componentCls, "-locale-tag"), {
|
|
21
28
|
color: token.colorTextSecondary,
|
|
22
29
|
fontSize: token.fontSize - 1
|
|
23
|
-
}))), "&".concat(token.componentCls, "-popup-
|
|
30
|
+
}))), "&".concat(token.componentCls, "-popup-pro-field ").concat(token.componentCls, "-popup-listy-item"), {
|
|
31
|
+
paddingBottom: 0
|
|
32
|
+
}), "&".concat(token.componentCls, "-popup-immutable ").concat(token.componentCls, "-popup-list ").concat(token.componentCls, "-popup-list-item ").concat(token.antCls, "-form-item"), _defineProperty(_defineProperty(_defineProperty({
|
|
24
33
|
marginBottom: "0 !important"
|
|
25
34
|
}, "".concat(token.componentCls, "-locale-tag"), {
|
|
26
35
|
backgroundColor: token.controlItemBgHover,
|
|
@@ -51,11 +60,10 @@ var buildFieldStyle = function buildFieldStyle(token) {
|
|
|
51
60
|
color: token.colorTextSecondary,
|
|
52
61
|
padding: "2px ".concat(token.paddingXS, "px"),
|
|
53
62
|
fontSize: token.fontSizeSM
|
|
54
|
-
}))
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}))), "".concat(token.componentCls, "-entry-readonly"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
63
|
+
}))), "".concat(token.componentCls, "-entry-addon-disabled"), {
|
|
64
|
+
color: token.colorTextDisabled,
|
|
65
|
+
cursor: 'not-allowed'
|
|
66
|
+
}), "".concat(token.componentCls, "-entry-readonly"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
59
67
|
display: 'flex',
|
|
60
68
|
flexFlow: 'row nowrap',
|
|
61
69
|
alignItems: 'center'
|
|
@@ -36,7 +36,7 @@ export type TagInputProps = Omit<ProFormFieldItemProps, 'children' | 'fieldRef'
|
|
|
36
36
|
locale?: string;
|
|
37
37
|
localeProps?: IntlLocaleProps;
|
|
38
38
|
};
|
|
39
|
-
export declare const TagInput: React.ForwardRefExoticComponent<Omit<ProFormFieldItemProps, "children" | "
|
|
39
|
+
export declare const TagInput: React.ForwardRefExoticComponent<Omit<ProFormFieldItemProps, "children" | "placeholder" | "fieldProps" | "disabled" | "readonly" | "fieldRef"> & Omit<ProFormFieldRemoteProps, "request" | "valueEnum"> & {
|
|
40
40
|
clazzPrefix?: string | undefined;
|
|
41
41
|
containerClazz?: string | undefined;
|
|
42
42
|
containerStyle?: React.CSSProperties | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jiovan-labs/ant-buddy-pro",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"title": "Ant Buddy Pro",
|
|
5
5
|
"description": "Awesome components based on Ant Design & Ant ProComponents",
|
|
6
6
|
"homepage": "https://jiovan-labs.github.io/ant-buddy-pro",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@eslint/eslintrc": "^3.3.7",
|
|
68
68
|
"@eslint/js": "^10.0.1",
|
|
69
69
|
"@types/object-hash": "^3.0.6",
|
|
70
|
-
"@types/react": "^19.3.
|
|
70
|
+
"@types/react": "^19.3.2",
|
|
71
71
|
"@types/react-dom": "^19.3.0",
|
|
72
72
|
"@types/zxcvbn": "^4.4.5",
|
|
73
73
|
"@jiovan-labs/babel-plugin-remove-comment": "^2.0.0",
|