@jiovan-labs/ant-buddy-pro 2.0.3 → 2.0.5

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.
Files changed (37) hide show
  1. package/dist/cjs/field/NotifyBadge/index.d.ts +13 -4
  2. package/dist/cjs/field/NotifyBadge/index.js +39 -42
  3. package/dist/cjs/field/NotifyBadge/styles.js +29 -17
  4. package/dist/cjs/field/RemoteField/index.js +21 -17
  5. package/dist/cjs/form/AddonInput/index.js +47 -18
  6. package/dist/cjs/form/AvatarUpload/index.d.ts +2 -2
  7. package/dist/cjs/form/CaptchaInput/index.js +6 -2
  8. package/dist/cjs/form/CollapseForm/index.js +1 -3
  9. package/dist/cjs/form/CronInput/index.js +3 -3
  10. package/dist/cjs/form/DivideSelect/index.js +23 -20
  11. package/dist/cjs/form/LocaleInput/index.js +16 -12
  12. package/dist/cjs/form/LocaleInput/styles.js +19 -10
  13. package/dist/cjs/form/MathInput/index.js +3 -1
  14. package/dist/cjs/form/SegmentRadio/index.js +23 -20
  15. package/dist/cjs/form/TagInput/index.d.ts +1 -1
  16. package/dist/cjs/form/TagInput/index.js +36 -32
  17. package/dist/cjs/layout/MenuTabs/index.js +18 -20
  18. package/dist/cjs/layout/PageFooter/index.js +1 -1
  19. package/dist/esm/field/NotifyBadge/index.d.ts +13 -4
  20. package/dist/esm/field/NotifyBadge/index.js +64 -85
  21. package/dist/esm/field/NotifyBadge/styles.js +24 -18
  22. package/dist/esm/field/RemoteField/index.js +21 -18
  23. package/dist/esm/form/AddonInput/index.js +65 -27
  24. package/dist/esm/form/AvatarUpload/index.d.ts +2 -2
  25. package/dist/esm/form/CaptchaInput/index.js +9 -3
  26. package/dist/esm/form/CollapseForm/index.js +3 -3
  27. package/dist/esm/form/CronInput/index.js +3 -3
  28. package/dist/esm/form/DivideSelect/index.js +24 -22
  29. package/dist/esm/form/LocaleInput/index.js +28 -17
  30. package/dist/esm/form/LocaleInput/styles.js +16 -8
  31. package/dist/esm/form/MathInput/index.js +5 -1
  32. package/dist/esm/form/SegmentRadio/index.js +24 -22
  33. package/dist/esm/form/TagInput/index.d.ts +1 -1
  34. package/dist/esm/form/TagInput/index.js +37 -34
  35. package/dist/esm/layout/MenuTabs/index.js +20 -20
  36. package/dist/esm/layout/PageFooter/index.js +1 -1
  37. package/package.json +2 -2
@@ -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,
@@ -58,23 +58,27 @@ var RemoteField = import_react.default.forwardRef((props, ref) => {
58
58
  setRefreshId(import_ts_lang_utils.NanoidUtils.getPopularId());
59
59
  }
60
60
  }));
61
- if (props == null ? void 0 : props.request) {
62
- const { run } = (0, import_pro_components.useDebounceFn)(props.request, (props == null ? void 0 : props.debounceTime) ?? 0);
63
- import_react.default.useEffect(() => {
64
- if (autoStart) {
65
- run(props == null ? void 0 : props.params).then((data) => {
66
- setOutcome(data);
67
- }).catch(() => {
68
- });
69
- }
70
- }, []);
71
- import_react.default.useEffect(() => {
72
- run(props == null ? void 0 : props.params).then((data) => {
73
- setOutcome(data);
74
- }).catch(() => {
75
- });
76
- }, [refreshId]);
77
- }
61
+ const { run } = (0, import_pro_components.useDebounceFn)((params) => {
62
+ return !(props == null ? void 0 : props.request) ? Promise.resolve(void 0) : props.request(params);
63
+ }, (props == null ? void 0 : props.debounceTime) ?? 0);
64
+ import_react.default.useEffect(() => {
65
+ if (!(props == null ? void 0 : props.request) || !autoStart) {
66
+ return;
67
+ }
68
+ run(props == null ? void 0 : props.params).then((data) => {
69
+ setOutcome(data);
70
+ }).catch(() => {
71
+ });
72
+ }, []);
73
+ import_react.default.useEffect(() => {
74
+ if (!(props == null ? void 0 : props.request)) {
75
+ return;
76
+ }
77
+ run(props == null ? void 0 : props.params).then((data) => {
78
+ setOutcome(data);
79
+ }).catch(() => {
80
+ });
81
+ }, [refreshId]);
78
82
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
79
83
  "div",
80
84
  {
@@ -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 = {
@@ -67,7 +70,9 @@ var AddonInput = (props) => {
67
70
  };
68
71
  const simpleName = (props == null ? void 0 : props.name) ?? ((_a = props == null ? void 0 : props.fieldProps) == null ? void 0 : _a.name);
69
72
  const fieldName = !simpleName ? void 0 : (formListContext == null ? void 0 : formListContext.listName) ? [...formListContext.listName, simpleName] : simpleName;
70
- const fieldValue = simpleName && form ? import_antd.Form.useWatch(fieldName, form) : (_b = props == null ? void 0 : props.fieldProps) == null ? void 0 : _b.value;
73
+ const [fallbackForm] = import_antd.Form.useForm();
74
+ const watchedValue = import_antd.Form.useWatch(fieldName ?? "__abp_watch_placeholder__", form ?? fallbackForm);
75
+ const fieldValue = !simpleName ? (_b = props == null ? void 0 : props.fieldProps) == null ? void 0 : _b.value : watchedValue;
71
76
  const inputWidth = !widthBlock ? void 0 : import_PropUtils.PropUtils.calculateWidth((props == null ? void 0 : props.width) ?? (typeof ((_d = (_c = props == null ? void 0 : props.fieldProps) == null ? void 0 : _c.style) == null ? void 0 : _d.width) === "string" ? props.fieldProps.style.width : void 0));
72
77
  const entryReadMode = editContext.mode === "read" || ((_e = props == null ? void 0 : props.proFieldProps) == null ? void 0 : _e.mode) === "read";
73
78
  const entryReadonly = ((_f = props == null ? void 0 : props.fieldProps) == null ? void 0 : _f.readOnly) || ((_g = props == null ? void 0 : props.proFieldProps) == null ? void 0 : _g.readonly);
@@ -77,7 +82,39 @@ var AddonInput = (props) => {
77
82
  const widthBlockClazz = !widthBlock ? void 0 : `${clazzPrefix}-width-block`;
78
83
  const entryReadModeClazz = !entryReadMode ? void 0 : `${clazzPrefix}-read-mode`;
79
84
  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"]);
85
+ 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"]);
86
+ const setFieldValue = (value) => {
87
+ if (simpleName) {
88
+ form == null ? void 0 : form.setFieldValue(simpleName, value);
89
+ }
90
+ };
91
+ const handleChange = (event) => {
92
+ var _a2, _b2;
93
+ if (compositionRef.current) {
94
+ setComposingValue(event.target.value);
95
+ return;
96
+ }
97
+ if (!simpleName) {
98
+ setComposingValue(event.target.value);
99
+ }
100
+ setFieldValue(event.target.value);
101
+ (_b2 = (_a2 = props == null ? void 0 : props.fieldProps) == null ? void 0 : _a2.onChange) == null ? void 0 : _b2.call(_a2, event);
102
+ };
103
+ const handleCompositionStart = (event) => {
104
+ var _a2, _b2;
105
+ compositionRef.current = true;
106
+ (_b2 = (_a2 = props == null ? void 0 : props.fieldProps) == null ? void 0 : _a2.onCompositionStart) == null ? void 0 : _b2.call(_a2, event);
107
+ };
108
+ const handleCompositionEnd = (event) => {
109
+ var _a2, _b2;
110
+ compositionRef.current = false;
111
+ (_b2 = (_a2 = props == null ? void 0 : props.fieldProps) == null ? void 0 : _a2.onCompositionEnd) == null ? void 0 : _b2.call(_a2, event);
112
+ const finalValue = event.currentTarget.value;
113
+ setComposingValue(simpleName ? void 0 : finalValue);
114
+ if (webkitBrowser) {
115
+ setFieldValue(finalValue);
116
+ }
117
+ };
81
118
  if (proField) {
82
119
  const restProps = !props ? {} : (0, import_util.omit)(props, ["className", "name", "allowClear", "fieldProps", "proFieldProps", "clazzPrefix", "addonBefore", "addonAfter", "cursorBefore", "cursorAfter", "paddingBefore", "paddingAfter", "widthBlock", "proField"]);
83
120
  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 +125,14 @@ var AddonInput = (props) => {
88
125
  className: (0, import_classnames.default)(`${clazzPrefix}-input`, (_i = props == null ? void 0 : props.fieldProps) == null ? void 0 : _i.className),
89
126
  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
127
  name: simpleName,
91
- value: entryReadMode ? fieldValue || ((_k = props == null ? void 0 : props.proFieldProps) == null ? void 0 : _k.emptyText) || "-" : fieldValue,
128
+ value: composingValue ?? (entryReadMode ? fieldValue || ((_k = props == null ? void 0 : props.proFieldProps) == null ? void 0 : _k.emptyText) || "-" : fieldValue),
92
129
  allowClear: !entryImmutable && (props == null ? void 0 : props.allowClear) !== false && ((_l = props == null ? void 0 : props.fieldProps) == null ? void 0 : _l.allowClear) !== false,
93
130
  readOnly: entryReadMode || entryReadonly,
94
131
  disabled: entryDisabled,
95
132
  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
- },
133
+ onChange: handleChange,
134
+ onCompositionStart: handleCompositionStart,
135
+ onCompositionEnd: handleCompositionEnd,
103
136
  ...omitFieldProps
104
137
  }
105
138
  ),
@@ -114,17 +147,13 @@ var AddonInput = (props) => {
114
147
  className: (0, import_classnames.default)(`${clazzPrefix}-input`, (_n = props == null ? void 0 : props.fieldProps) == null ? void 0 : _n.className),
115
148
  name: simpleName,
116
149
  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,
150
+ value: composingValue ?? (entryReadMode ? fieldValue || ((_p = props == null ? void 0 : props.proFieldProps) == null ? void 0 : _p.emptyText) || "-" : fieldValue),
118
151
  readOnly: entryReadMode || entryReadonly,
119
152
  disabled: entryDisabled,
120
153
  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
- },
154
+ onChange: handleChange,
155
+ onCompositionStart: handleCompositionStart,
156
+ onCompositionEnd: handleCompositionEnd,
128
157
  ...omitFieldProps
129
158
  }
130
159
  ),
@@ -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;
@@ -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" | "width" | "height" | "srcSet" | "preview" | "fallback"> | 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;
@@ -94,7 +94,10 @@ var CaptchaInputField = import_react.default.forwardRef((props, ref) => {
94
94
  return timing;
95
95
  },
96
96
  startTimer: () => {
97
- validateDependFields().then(() => {
97
+ validateDependFields().then((validated) => {
98
+ if (!validated) {
99
+ return;
100
+ }
98
101
  setTiming(true);
99
102
  }).catch(() => {
100
103
  });
@@ -129,7 +132,8 @@ var CaptchaInputField = import_react.default.forwardRef((props, ref) => {
129
132
  const watchFields = import_react.default.useMemo(() => {
130
133
  return [props == null ? void 0 : props.phoneName, props == null ? void 0 : props.dependName].flat().filter((item) => !!item);
131
134
  }, [props == null ? void 0 : props.phoneName, props == null ? void 0 : props.dependName]);
132
- const watchValues = !(props == null ? void 0 : props.autoValidate) ? [] : import_pro_components.ProForm.useWatch([], { form, preserve: true });
135
+ const [fallbackForm] = import_antd.Form.useForm();
136
+ const watchValues = import_pro_components.ProForm.useWatch([], { form: form ?? fallbackForm, preserve: true });
133
137
  const checkSubmittable = () => {
134
138
  if (import_ts_lang_utils.ArrayUtils.isNotEmpty(watchFields)) {
135
139
  form == null ? void 0 : form.validateFields([...watchFields], {
@@ -79,9 +79,7 @@ var CollapseForm = import_react.default.forwardRef((props, ref) => {
79
79
  setFormOpen(false);
80
80
  }
81
81
  };
82
- if (closeOnBlur) {
83
- (0, import_ahooks.useEventListener)(["keydown", "mousedown"], restoreLayout);
84
- }
82
+ (0, import_ahooks.useEventListener)(["keydown", "mousedown"], restoreLayout, { enable: closeOnBlur });
85
83
  const buildEntryDom = () => {
86
84
  if (formOpen) {
87
85
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -314,9 +314,6 @@ var CronInput = import_react.default.forwardRef((props, ref) => {
314
314
  ] }) });
315
315
  }
316
316
  };
317
- if (entryImmutable) {
318
- return buildEntryDom();
319
- }
320
317
  const handleWindowResize = () => {
321
318
  const inspect = document.querySelector(`.${clazzPrefix}-entry-${fieldId}`);
322
319
  const sponsor = document.querySelector(`.${clazzPrefix}-popup-${fieldId}`);
@@ -326,6 +323,9 @@ var CronInput = import_react.default.forwardRef((props, ref) => {
326
323
  }
327
324
  };
328
325
  (0, import_ahooks.useEventListener)("resize", handleWindowResize);
326
+ if (entryImmutable) {
327
+ return buildEntryDom();
328
+ }
329
329
  const buildPopupDom = () => {
330
330
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n, _o, _p, _q, _r, _s, _t, _u, _v;
331
331
  const tabItems = [
@@ -63,27 +63,30 @@ var DivideSelect = (props) => {
63
63
  const enumOptions = import_FieldUtils.FieldUtils.valueEnumToSelectOptions(props == null ? void 0 : props.valueEnum) ?? [];
64
64
  return [...rawOptions, ...enumOptions];
65
65
  });
66
- if ((props == null ? void 0 : props.request) && (props == null ? void 0 : props.requestOptionPlace) !== false) {
67
- const { run } = (0, import_pro_components.useDebounceFn)(props.request, (props == null ? void 0 : props.debounceTime) ?? 0);
68
- import_react.default.useEffect(() => {
69
- run(props == null ? void 0 : props.params).then((values) => {
70
- if (!values) {
71
- if ((props == null ? void 0 : props.requestOptionPlace) === "override") {
72
- setOptionItems(void 0);
73
- }
74
- return;
75
- }
76
- if ((props == null ? void 0 : props.requestOptionPlace) === void 0 || (props == null ? void 0 : props.requestOptionPlace) === "override") {
77
- setOptionItems(values);
78
- } else if ((props == null ? void 0 : props.requestOptionPlace) === "before") {
79
- setOptionItems([...values, ...optionItems ?? []]);
80
- } else if ((props == null ? void 0 : props.requestOptionPlace) === "after") {
81
- setOptionItems([...optionItems ?? [], ...values]);
66
+ const { run } = (0, import_pro_components.useDebounceFn)((params) => {
67
+ return !(props == null ? void 0 : props.request) ? Promise.resolve(void 0) : props.request(params, void 0);
68
+ }, (props == null ? void 0 : props.debounceTime) ?? 0);
69
+ import_react.default.useEffect(() => {
70
+ if (!(props == null ? void 0 : props.request) || (props == null ? void 0 : props.requestOptionPlace) === false) {
71
+ return;
72
+ }
73
+ run(props == null ? void 0 : props.params).then((values) => {
74
+ if (!values) {
75
+ if ((props == null ? void 0 : props.requestOptionPlace) === "override") {
76
+ setOptionItems(void 0);
82
77
  }
83
- }).catch(() => {
84
- });
85
- }, []);
86
- }
78
+ return;
79
+ }
80
+ if ((props == null ? void 0 : props.requestOptionPlace) === void 0 || (props == null ? void 0 : props.requestOptionPlace) === "override") {
81
+ setOptionItems(values);
82
+ } else if ((props == null ? void 0 : props.requestOptionPlace) === "before") {
83
+ setOptionItems([...values, ...optionItems ?? []]);
84
+ } else if ((props == null ? void 0 : props.requestOptionPlace) === "after") {
85
+ setOptionItems([...optionItems ?? [], ...values]);
86
+ }
87
+ }).catch(() => {
88
+ });
89
+ }, []);
87
90
  const renderContent = (item, before) => {
88
91
  var _a2, _b2, _c2, _d2, _e2, _f2;
89
92
  if (!item) {
@@ -83,6 +83,7 @@ var LocaleInput = (props) => {
83
83
  const [fieldId] = import_react.default.useState(import_ts_lang_utils.NanoidUtils.getPopularId());
84
84
  const [triggerOpen, setTriggerOpen] = import_react.default.useState((props == null ? void 0 : props.defaultOpen) ?? false);
85
85
  const [triggerOffset, setTriggerOffset] = import_react.default.useState(4);
86
+ const [confirmOpen, setConfirmOpen] = import_react.default.useState();
86
87
  const compositionRef = import_react.default.useRef(false);
87
88
  const closeTimerRef = import_react.default.useRef(null);
88
89
  const fieldStyle = (0, import_styles.useFieldStyle)(clazzPrefix);
@@ -115,8 +116,12 @@ var LocaleInput = (props) => {
115
116
  (0, import_ahooks.useEventListener)("resize", handleWindowResize);
116
117
  const addonEntryDom = typeof addon === "function" ? addon() : addon;
117
118
  const buildEntryAddonDom = (before) => {
118
- return before && addonPos === "before" || !before && addonPos === "after" ? addonEntryDom : void 0;
119
+ if (!(before && addonPos === "before" || !before && addonPos === "after")) {
120
+ return void 0;
121
+ }
122
+ return multilingual ? addonEntryDom : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${clazzPrefix}-entry-addon-disabled`, children: addonEntryDom });
119
123
  };
124
+ const entryAddonCursor = multilingual ? "pointer" : "not-allowed";
120
125
  const renderEntryReadonly = (dom) => {
121
126
  var _a2;
122
127
  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 +140,8 @@ var LocaleInput = (props) => {
135
140
  {
136
141
  addonBefore: buildEntryAddonDom(true),
137
142
  addonAfter: buildEntryAddonDom(false),
138
- cursorBefore: addonPos === "before" ? "pointer" : void 0,
139
- cursorAfter: addonPos === "after" ? "pointer" : void 0,
143
+ cursorBefore: addonPos === "before" ? entryAddonCursor : void 0,
144
+ cursorAfter: addonPos === "after" ? entryAddonCursor : void 0,
140
145
  fieldProps: {
141
146
  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
147
  allowClear: (props == null ? void 0 : props.allowClear) || ((_b2 = props == null ? void 0 : props.fieldProps) == null ? void 0 : _b2.allowClear),
@@ -163,8 +168,8 @@ var LocaleInput = (props) => {
163
168
  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
169
  addonBefore: buildEntryAddonDom(true),
165
170
  addonAfter: buildEntryAddonDom(false),
166
- cursorBefore: addonPos === "before" ? "pointer" : void 0,
167
- cursorAfter: addonPos === "after" ? "pointer" : void 0,
171
+ cursorBefore: addonPos === "before" ? entryAddonCursor : void 0,
172
+ cursorAfter: addonPos === "after" ? entryAddonCursor : void 0,
168
173
  proField,
169
174
  onChange: (event) => {
170
175
  var _a3, _b3;
@@ -182,7 +187,6 @@ var LocaleInput = (props) => {
182
187
  if (!multilingual || !(props == null ? void 0 : props.popupInputProps) && !(props == null ? void 0 : props.popupQuickTags)) {
183
188
  return buildEntryDom();
184
189
  }
185
- const [confirmOpen, setConfirmOpen] = import_react.default.useState();
186
190
  const entryImmutable = editContext.mode === "read" || ((_a = props == null ? void 0 : props.proFieldProps) == null ? void 0 : _a.mode) === "read" || ((_b = props == null ? void 0 : props.fieldProps) == null ? void 0 : _b.readOnly) || ((_c = props == null ? void 0 : props.proFieldProps) == null ? void 0 : _c.readonly) || (props == null ? void 0 : props.disabled) || ((_d = props == null ? void 0 : props.fieldProps) == null ? void 0 : _d.disabled);
187
191
  const handleSetAsDefault = (tagId) => {
188
192
  const inspect = document.querySelector(`[data-locale-input-id='${fieldId}']`);
@@ -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
  }