@jiovan-labs/ant-buddy-pro 2.0.2 → 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.
@@ -1,17 +1,25 @@
1
1
  import React from 'react';
2
- import { type BadgeProps, type DropdownProps, type ListProps, type TabsProps } from 'antd';
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 = Omit<ListItemMetaProps, 'children'> & {
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?: ListProps<any>;
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)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_condition.If, { condition: typeof item.avatar === "string", validation: false, children: [
79
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_condition.If.Then, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Avatar, { className: `${clazzPrefix}-list-item-avatar`, src: item.avatar }) }),
80
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_condition.If.Else, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${clazzPrefix}-list-item-icon`, children: item.avatar }) })
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: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
91
- import_antd.List.Item.Meta,
92
- {
93
- className: `${clazzPrefix}-list-item-meta`,
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
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_condition.If, { condition: item.extra, validation: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${clazzPrefix}-list-item-extra`, children: item.extra }) })
91
+ !!item.extra && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${clazzPrefix}-list-item-extra`, children: item.extra })
98
92
  ] }),
99
- description: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
100
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_condition.If, { condition: item.description, validation: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${clazzPrefix}-list-item-description`, children: item.description }) }),
101
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_condition.If, { condition: item.timestamp, validation: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${clazzPrefix}-list-item-timestamp`, children: item.timestamp }) })
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
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_condition.If, { condition: showClear, validation: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
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
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_condition.If, { condition: showMore, validation: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
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 empty = !((_a3 = tab.listProps) == null ? void 0 : _a3.dataSource) || Array.isArray(tab.listProps.dataSource) && !tab.listProps.dataSource.length;
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.jsx)(
154
- import_antd.List,
155
- {
156
- className: (0, import_classnames.default)(`${clazzPrefix}-tab-list`, (_b2 = tab.listProps) == null ? void 0 : _b2.className),
157
- ...!(tab == null ? void 0 : tab.listProps) ? {} : (0, import_util.omit)(tab.listProps, ["className", "footer", "renderItem"]),
158
- footer: renderListFooter(tab),
159
- renderItem: (item, index) => {
160
- var _a4;
161
- if ((_a4 = tab.listProps) == null ? void 0 : _a4.renderItem) {
162
- return tab.listProps.renderItem(item, index);
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
- [`${token.antCls}-list-footer`]: {
58
- paddingBottom: 0
63
+ // Listy 默认已为每项写入 borderBottom(文档「基础用法」效果),这里只去掉最后一项的底线
64
+ [`${token.antCls}-listy-item:last-child`]: {
65
+ borderBottom: "none"
59
66
  }
60
67
  },
61
- [`${token.componentCls}-list-item`]: {
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: (event) => {
97
- var _a2, _b2;
98
- if (simpleName) {
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: (event) => {
122
- var _a2, _b2;
123
- if (props == null ? void 0 : props.name) {
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" | "disabled" | "fieldProps" | "placeholder" | "readonly" | "fieldRef"> & {
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;
@@ -53,8 +53,8 @@ export declare const AvatarUpload: React.ForwardRefExoticComponent<Omit<ProFormF
53
53
  imageSrc?: string | undefined;
54
54
  fallbackSrc?: string | undefined;
55
55
  shape?: CircleSquareShape | undefined;
56
- avatarProps?: Omit<AvatarProps, "children" | "shape" | "src" | "srcSet"> | undefined;
57
- imageProps?: Omit<ImageProps, "title" | "width" | "height" | "src" | "srcSet" | "fallback" | "preview"> | undefined;
56
+ avatarProps?: Omit<AvatarProps, "children" | "src" | "srcSet" | "shape"> | undefined;
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
- return before && addonPos === "before" || !before && addonPos === "after" ? addonEntryDom : void 0;
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" ? "pointer" : void 0,
139
- cursorAfter: addonPos === "after" ? "pointer" : void 0,
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" ? "pointer" : void 0,
167
- cursorAfter: addonPos === "after" ? "pointer" : void 0,
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.List,
397
+ import_antd.Listy,
394
398
  {
395
- className: `${clazzPrefix}-popup-list`,
396
- dataSource: tagInputs,
397
- bordered: true,
398
- size: "small",
399
- renderItem: (item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.List.Item, { className: `${clazzPrefix}-popup-list-item`, children: item })
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" | "disabled" | "fieldProps" | "placeholder" | "readonly" | "fieldRef"> & Omit<ProFormFieldRemoteProps, "request" | "valueEnum"> & {
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;
@@ -41,6 +41,7 @@ export { ApartTitle, type ApartTitleProps } from './layout/ApartTitle';
41
41
  export { BorderBox, type BorderBoxProps } from './layout/BorderBox';
42
42
  export { CardTabs, type CardTabsProps } from './layout/CardTabs';
43
43
  export { CodePreview, type CodePreviewProps } from './layout/CodePreview';
44
+ export { EvenDescriptions, type EvenDescriptionsProps } from './layout/EvenDescriptions';
44
45
  export { FlexBox, type FlexBoxProps } from './layout/FlexBox';
45
46
  export { FoldSection, type FoldSectionProps } from './layout/FoldSection';
46
47
  export { LoginPortal, type LoginPortalProps } from './layout/LoginPortal';
package/dist/cjs/index.js CHANGED
@@ -46,6 +46,7 @@ __export(src_exports, {
46
46
  DivideSelect: () => import_DivideSelect.DivideSelect,
47
47
  DragModal: () => import_DragModal.DragModal,
48
48
  ElementUtils: () => import_ElementUtils.ElementUtils,
49
+ EvenDescriptions: () => import_EvenDescriptions.EvenDescriptions,
49
50
  ExactInput: () => import_ExactInput.ExactInput,
50
51
  FallbackImage: () => import_FallbackImage.FallbackImage,
51
52
  FieldUtils: () => import_FieldUtils.FieldUtils,
@@ -135,6 +136,7 @@ var import_ApartTitle = require("./layout/ApartTitle");
135
136
  var import_BorderBox = require("./layout/BorderBox");
136
137
  var import_CardTabs = require("./layout/CardTabs");
137
138
  var import_CodePreview = require("./layout/CodePreview");
139
+ var import_EvenDescriptions = require("./layout/EvenDescriptions");
138
140
  var import_FlexBox = require("./layout/FlexBox");
139
141
  var import_FoldSection = require("./layout/FoldSection");
140
142
  var import_LoginPortal = require("./layout/LoginPortal");
@@ -193,6 +195,7 @@ __reExport(src_exports, require("./type/design-token"), module.exports);
193
195
  DivideSelect,
194
196
  DragModal,
195
197
  ElementUtils,
198
+ EvenDescriptions,
196
199
  ExactInput,
197
200
  FallbackImage,
198
201
  FieldUtils,
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { type DescriptionsProps } from 'antd';
3
+ import { type ProDescriptionsProps } from '@ant-design/pro-components';
4
+ export type EvenDescriptionsProps = ProDescriptionsProps & {
5
+ clazzPrefix?: string;
6
+ fixed?: boolean;
7
+ proField?: boolean;
8
+ items?: DescriptionsProps['items'];
9
+ };
10
+ export declare const EvenDescriptions: React.FC<EvenDescriptionsProps>;
@@ -0,0 +1,63 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/layout/EvenDescriptions/index.tsx
30
+ var EvenDescriptions_exports = {};
31
+ __export(EvenDescriptions_exports, {
32
+ EvenDescriptions: () => EvenDescriptions
33
+ });
34
+ module.exports = __toCommonJS(EvenDescriptions_exports);
35
+ var import_antd = require("antd");
36
+ var import_pro_components = require("@ant-design/pro-components");
37
+ var import_util = require("@rc-component/util");
38
+ var import_classnames = __toESM(require("classnames"));
39
+ var import_styles = require("./styles");
40
+ var import_jsx_runtime = require("react/jsx-runtime");
41
+ var EvenDescriptions = (props) => {
42
+ const clazzPrefix = (props == null ? void 0 : props.clazzPrefix) ?? "abp-even-descriptions";
43
+ const {
44
+ fixed = true,
45
+ proField = true
46
+ } = props ?? {};
47
+ const fieldStyle = (0, import_styles.useFieldStyle)(clazzPrefix);
48
+ const entryClazz = (0, import_classnames.default)(clazzPrefix, fieldStyle.hashId, !fixed ? void 0 : `${clazzPrefix}-fixed`, props == null ? void 0 : props.className);
49
+ const selfProps = ["className", "clazzPrefix", "fixed", "proField"];
50
+ if (proField) {
51
+ const restProps2 = !props ? {} : (0, import_util.omit)(props, selfProps);
52
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_pro_components.ProDescriptions, { ...restProps2, className: entryClazz });
53
+ }
54
+ const proOnlyProps = ["params", "onRequestError", "request", "columns", "actionRef", "loading", "onLoadingChange", "tooltip", "formProps", "editable", "dataSource", "onDataSourceChange", "emptyText"];
55
+ const restProps = !props ? {} : (0, import_util.omit)(props, [...selfProps, "styles", ...proOnlyProps]);
56
+ const styles = props == null ? void 0 : props.styles;
57
+ const mergedStyles = typeof styles === "function" ? styles : { ...styles, content: { minWidth: 0, ...styles == null ? void 0 : styles.content } };
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Descriptions, { ...restProps, styles: mergedStyles, className: entryClazz });
59
+ };
60
+ // Annotate the CommonJS export names for ESM import in node:
61
+ 0 && (module.exports = {
62
+ EvenDescriptions
63
+ });
@@ -0,0 +1,2 @@
1
+ import { type UseStyleResult } from '@ant-design/pro-components';
2
+ export declare function useFieldStyle(prefixCls: string): UseStyleResult;