xmirror-components 1.0.39 → 1.0.40-alpha.2

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 (67) hide show
  1. package/build/dist/index.cjs +31 -109
  2. package/build/dist/index.mjs +3940 -10397
  3. package/build/es/components/AntdApp/index.d.ts +1 -2
  4. package/build/es/components/AntdApp/index.js +2 -5
  5. package/build/es/components/CheckboxValue/index.d.ts +1 -1
  6. package/build/es/components/CheckboxValue/index.js +2 -2
  7. package/build/es/components/ConfigProvider/index.d.ts +1 -1
  8. package/build/es/components/ConfigProvider/index.js +3 -3
  9. package/build/es/components/GlobalLoading/index.d.ts +1 -2
  10. package/build/es/components/GlobalLoading/index.js +8 -19
  11. package/build/es/components/IconButton/index.js +5 -6
  12. package/build/es/components/IconFont/index.js +5 -5
  13. package/build/es/components/IntlProvider/index.d.ts +1 -1
  14. package/build/es/components/IntlProvider/index.js +3 -2
  15. package/build/es/components/SearchArea/Item/index.d.ts +2 -2
  16. package/build/es/components/SearchArea/Item/index.js +4 -2
  17. package/build/es/components/SearchArea/ToggleButton/index.d.ts +1 -2
  18. package/build/es/components/SearchArea/ToggleButton/index.js +3 -4
  19. package/build/es/components/SearchArea/index.js +13 -24
  20. package/build/es/components/SwitchValue/index.d.ts +1 -1
  21. package/build/es/components/SwitchValue/index.js +2 -2
  22. package/build/es/components/Table/Footer/index.d.ts +1 -2
  23. package/build/es/components/Table/Footer/index.js +10 -20
  24. package/build/es/components/Table/PopoverSetColumns/index.d.ts +1 -2
  25. package/build/es/components/Table/PopoverSetColumns/index.js +9 -12
  26. package/build/es/components/Table/PopoverSetColumns/styles.d.ts +0 -4
  27. package/build/es/components/Table/PopoverSetColumns/styles.js +2 -3
  28. package/build/es/components/Table/ResizableColumns/index.js +4 -5
  29. package/build/es/components/Table/index.js +8 -11
  30. package/build/es/components/TagGroup/index.d.ts +40 -0
  31. package/build/es/components/TagGroup/index.js +33 -0
  32. package/build/es/hooks/useSearchParams/index.js +38 -17
  33. package/build/es/hooks/useTable/index.js +30 -14
  34. package/build/lib/components/AntdApp/index.js +2 -5
  35. package/build/lib/components/CheckboxValue/index.js +2 -5
  36. package/build/lib/components/ConfigProvider/index.js +3 -3
  37. package/build/lib/components/GlobalLoading/index.js +8 -52
  38. package/build/lib/components/IconButton/index.js +5 -6
  39. package/build/lib/components/IconFont/index.js +5 -38
  40. package/build/lib/components/IntlProvider/index.js +3 -2
  41. package/build/lib/components/SearchArea/Item/index.js +4 -2
  42. package/build/lib/components/SearchArea/ToggleButton/index.js +3 -37
  43. package/build/lib/components/SearchArea/index.js +13 -57
  44. package/build/lib/components/SwitchValue/index.js +2 -5
  45. package/build/lib/components/Table/Footer/index.js +10 -53
  46. package/build/lib/components/Table/PopoverSetColumns/index.js +9 -45
  47. package/build/lib/components/Table/PopoverSetColumns/styles.js +3 -4
  48. package/build/lib/components/Table/ResizableColumns/index.js +4 -38
  49. package/build/lib/components/Table/index.js +8 -44
  50. package/build/lib/components/TagGroup/index.js +35 -0
  51. package/build/lib/hooks/useSearchParams/index.js +36 -18
  52. package/build/lib/hooks/useTable/index.js +30 -14
  53. package/build/lib/index.d.ts +9 -7
  54. package/build/package.json +13 -12
  55. package/build/types/components/AntdApp/index.d.ts +1 -2
  56. package/build/types/components/CheckboxValue/index.d.ts +1 -1
  57. package/build/types/components/ConfigProvider/index.d.ts +1 -1
  58. package/build/types/components/GlobalLoading/index.d.ts +1 -2
  59. package/build/types/components/IntlProvider/index.d.ts +1 -1
  60. package/build/types/components/SearchArea/Item/index.d.ts +2 -2
  61. package/build/types/components/SearchArea/ToggleButton/index.d.ts +1 -2
  62. package/build/types/components/SwitchValue/index.d.ts +1 -1
  63. package/build/types/components/Table/Footer/index.d.ts +1 -2
  64. package/build/types/components/Table/PopoverSetColumns/index.d.ts +1 -2
  65. package/build/types/components/Table/PopoverSetColumns/styles.d.ts +0 -4
  66. package/build/types/components/TagGroup/index.d.ts +40 -0
  67. package/package.json +13 -12
@@ -46,13 +46,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
46
46
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
47
  }
48
48
  };
49
- var __importDefault = (this && this.__importDefault) || function (mod) {
50
- return (mod && mod.__esModule) ? mod : { "default": mod };
51
- };
52
49
  Object.defineProperty(exports, "__esModule", { value: true });
53
50
  var react_1 = require("react");
54
51
  var react_router_dom_1 = require("react-router-dom");
55
- var use_url_state_1 = __importDefault(require("@ahooksjs/use-url-state"));
56
52
  var ahooks_1 = require("ahooks");
57
53
  var lodash_es_1 = require("lodash-es");
58
54
  var util_1 = require("./util");
@@ -69,9 +65,29 @@ var useSearchParams = function (initialValue, options) {
69
65
  var update = (0, ahooks_1.useUpdate)();
70
66
  var navigator = (0, react_router_dom_1.useNavigate)();
71
67
  var location = (0, react_router_dom_1.useLocation)();
72
- var _e = (0, use_url_state_1.default)((0, util_1.encodeParams)(__assign(__assign({}, initialSearchParams), initialValue)), {
73
- navigateMode: 'replace'
74
- }), urlParams = _e[0], setUrlParams = _e[1];
68
+ var _e = (0, react_router_dom_1.useSearchParams)(), routerSearchParams = _e[0], setRouterSearchParams = _e[1];
69
+ var urlParams = (0, react_1.useMemo)(function () {
70
+ var params = {};
71
+ routerSearchParams.forEach(function (value, key) {
72
+ params[key] = value;
73
+ });
74
+ return params;
75
+ }, [routerSearchParams]);
76
+ var setUrlParams = (0, react_1.useCallback)(function (params) {
77
+ var nextParams = new URLSearchParams(routerSearchParams);
78
+ Object.entries(params).forEach(function (_a) {
79
+ var key = _a[0], value = _a[1];
80
+ if (value === undefined || value === null || value === '') {
81
+ nextParams.delete(key);
82
+ }
83
+ else {
84
+ nextParams.set(key, String(value));
85
+ }
86
+ });
87
+ setRouterSearchParams(nextParams, {
88
+ replace: true
89
+ });
90
+ }, [routerSearchParams, setRouterSearchParams]);
75
91
  var initialDecodedParams = storage === 'url'
76
92
  ? (0, util_1.decodeParams)(urlParams)
77
93
  : (((_a = location.state) === null || _a === void 0 ? void 0 : _a[stateKey]) || {});
@@ -92,21 +108,23 @@ var useSearchParams = function (initialValue, options) {
92
108
  * 根据配置更新存储
93
109
  */
94
110
  var persistParams = function (params) { return __awaiter(void 0, void 0, void 0, function () {
95
- var payload, params_1, search, key, value;
96
- var _a, _b;
97
- return __generator(this, function (_c) {
111
+ var payload, params_1, urlSearchParams, _i, _a, _b, key, value, search;
112
+ var _c, _d;
113
+ return __generator(this, function (_e) {
98
114
  payload = __assign(__assign({}, params), { y: window.scrollY });
99
115
  if (storage === 'url') {
100
116
  params_1 = (0, util_1.encodeParams)(payload);
101
117
  setUrlParams(params_1);
102
- search = '';
103
- for (key in params_1) {
104
- value = params_1[key];
105
- search += "".concat(key, "=").concat(value, "&");
118
+ urlSearchParams = new URLSearchParams();
119
+ for (_i = 0, _a = Object.entries(params_1); _i < _a.length; _i++) {
120
+ _b = _a[_i], key = _b[0], value = _b[1];
121
+ if (value !== undefined && value !== null && value !== '') {
122
+ urlSearchParams.set(key, String(value));
123
+ }
106
124
  }
107
- search = search.slice(0, -1);
125
+ search = urlSearchParams.toString();
108
126
  window.routerHistory.set(location.pathname, {
109
- path: "".concat(location.pathname, "?").concat(search),
127
+ path: search ? "".concat(location.pathname, "?").concat(search) : location.pathname,
110
128
  replace: true,
111
129
  });
112
130
  return [2 /*return*/];
@@ -114,11 +132,11 @@ var useSearchParams = function (initialValue, options) {
114
132
  window.routerHistory.set(location.pathname, {
115
133
  path: location.pathname,
116
134
  replace: true,
117
- state: __assign(__assign({}, (location.state || {})), (_a = {}, _a[stateKey] = payload, _a)),
135
+ state: __assign(__assign({}, (location.state || {})), (_c = {}, _c[stateKey] = payload, _c)),
118
136
  });
119
137
  navigator(location.pathname, {
120
138
  replace: true,
121
- state: __assign(__assign({}, location.state), (_b = {}, _b[stateKey] = payload, _b))
139
+ state: __assign(__assign({}, location.state), (_d = {}, _d[stateKey] = payload, _d))
122
140
  });
123
141
  return [2 /*return*/];
124
142
  });
@@ -87,6 +87,7 @@ function useTable(request, options) {
87
87
  var intl = (0, IntlProvider_1.useIntl)();
88
88
  var _a = __assign(__assign({}, defaultOptions), options), rowKey = _a.rowKey, interval = _a.interval, immediate = _a.immediate, defaultPagination = _a.defaultPagination, showRowSelection = _a.showRowSelection, multiPageSelection = _a.multiPageSelection, onBeforeRequest = _a.onBeforeRequest, onAfterRequest = _a.onAfterRequest;
89
89
  var tableTimerRef = (0, react_1.useRef)(null);
90
+ var latestRequestIdRef = (0, react_1.useRef)(0);
90
91
  var _b = (0, react_1.useState)(false), loading = _b[0], setLoading = _b[1];
91
92
  var _c = (0, react_1.useState)([]), tableData = _c[0], setTableData = _c[1];
92
93
  var _d = (0, react_1.useState)(__assign({ current: 1, pageSize: 10, total: 0 }, defaultPagination)), pagination = _d[0], setPagination = _d[1];
@@ -112,7 +113,7 @@ function useTable(request, options) {
112
113
  args_1[_i] = arguments[_i];
113
114
  }
114
115
  return __awaiter(_this, __spreadArray([], args_1, true), void 0, function (page, pageSize, auto) {
115
- var requestParams, params, finalParams, response, _a, records, total, current, size, data, list, maxPage, error_1, errorMessage;
116
+ var requestId, requestParams, params, finalParams, response, _a, records, total_1, current_1, size_1, data, list, maxPage, error_1, errorMessage;
116
117
  if (page === void 0) { page = 1; }
117
118
  if (pageSize === void 0) { pageSize = 10; }
118
119
  return __generator(this, function (_b) {
@@ -126,6 +127,7 @@ function useTable(request, options) {
126
127
  resetTableTimer(page, pageSize);
127
128
  return [2 /*return*/];
128
129
  }
130
+ requestId = ++latestRequestIdRef.current;
129
131
  _b.label = 1;
130
132
  case 1:
131
133
  _b.trys.push([1, 5, 6, 7]);
@@ -137,35 +139,48 @@ function useTable(request, options) {
137
139
  return [4 /*yield*/, request(finalParams)];
138
140
  case 3:
139
141
  response = _b.sent();
140
- _a = response.data, records = _a.records, total = _a.total, current = _a.current, size = _a.size;
142
+ _a = response.data, records = _a.records, total_1 = _a.total, current_1 = _a.current, size_1 = _a.size;
141
143
  return [4 /*yield*/, (onAfterRequest === null || onAfterRequest === void 0 ? void 0 : onAfterRequest(response))];
142
144
  case 4:
143
145
  data = _b.sent();
144
146
  list = Array.isArray(data) ? data : records;
145
- setTableData(list);
146
- if (current !== pagination.current ||
147
- pageSize !== pagination.pageSize ||
148
- total !== pagination.total) {
149
- setPagination({
150
- current: current,
151
- pageSize: size,
152
- total: total
153
- });
147
+ // 仅处理最新请求,避免并发请求导致旧数据覆盖新状态
148
+ if (requestId !== latestRequestIdRef.current) {
149
+ return [2 /*return*/];
154
150
  }
155
- if (list.length === 0 && current && current > 1 && total && total > 0) {
156
- maxPage = Math.ceil(total / size);
151
+ setTableData(list);
152
+ setPagination(function (prev) {
153
+ if (current_1 === prev.current &&
154
+ size_1 === prev.pageSize &&
155
+ total_1 === prev.total) {
156
+ return prev;
157
+ }
158
+ return {
159
+ current: current_1,
160
+ pageSize: size_1,
161
+ total: total_1
162
+ };
163
+ });
164
+ if (list.length === 0 && current_1 && current_1 > 1 && total_1 && total_1 > 0) {
165
+ maxPage = Math.ceil(total_1 / size_1);
157
166
  initList(maxPage, pageSize, auto);
158
167
  }
159
168
  else {
160
- resetTableTimer(current, size);
169
+ resetTableTimer(current_1, size_1);
161
170
  }
162
171
  return [3 /*break*/, 7];
163
172
  case 5:
164
173
  error_1 = _b.sent();
174
+ if (requestId !== latestRequestIdRef.current) {
175
+ return [2 /*return*/];
176
+ }
165
177
  errorMessage = error_1 instanceof Error ? error_1.message : '请求失败';
166
178
  AntdApp_1.message.error(errorMessage);
167
179
  return [3 /*break*/, 7];
168
180
  case 6:
181
+ if (requestId !== latestRequestIdRef.current) {
182
+ return [2 /*return*/];
183
+ }
169
184
  if (!multiPageSelection) {
170
185
  setSelectedRows([]);
171
186
  }
@@ -295,6 +310,7 @@ function useTable(request, options) {
295
310
  // 使用当前分页值作为默认值,处理可能为 undefined 的情况
296
311
  var currentPage = (_b = pagination.current) !== null && _b !== void 0 ? _b : paginationRef.current.current;
297
312
  var currentPageSize = (_c = pagination.pageSize) !== null && _c !== void 0 ? _c : paginationRef.current.pageSize;
313
+ setPagination(function (prev) { return (__assign(__assign({}, prev), { current: currentPage, pageSize: currentPageSize })); });
298
314
  initList(currentPage, currentPageSize);
299
315
  }, [initList, searchParams]);
300
316
  var reset = function () {
@@ -7,6 +7,7 @@ import { ColumnTitleProps } from 'antd/es/table/interface';
7
7
  import { default as default_2 } from 'react';
8
8
  import { FormItemProps } from 'antd';
9
9
  import { FormProps } from 'antd';
10
+ import { JSX } from 'react/jsx-runtime';
10
11
  import { MessageInstance } from 'antd/es/message/interface';
11
12
  import { ModalStaticFunctions } from 'antd/es/modal/confirm';
12
13
  import { NotificationInstance } from 'antd/es/notification/interface';
@@ -21,7 +22,7 @@ import { TableProps } from 'antd';
21
22
 
22
23
  export declare function App({ children, config, ...props }: AppProps & {
23
24
  config?: ConfigProviderConfigProps;
24
- }): default_2.JSX.Element;
25
+ }): JSX.Element;
25
26
 
26
27
  declare interface ButtonTooltipProps {
27
28
  /**
@@ -47,7 +48,7 @@ declare interface ButtonTooltipProps {
47
48
  children?: default_2.ReactNode;
48
49
  }
49
50
 
50
- export declare const CheckboxValue: <T = any, F = any>({ checked, onChange, trueValue, falseValue, trueLabel, falseLabel, children, ...props }: CheckboxValueProps<T, F>) => default_2.JSX.Element;
51
+ export declare const CheckboxValue: <T = any, F = any>({ checked, onChange, trueValue, falseValue, trueLabel, falseLabel, children, ...props }: CheckboxValueProps<T, F>) => JSX.Element;
51
52
 
52
53
  /**
53
54
  * checkbox 可自定义 value 和 label
@@ -128,7 +129,7 @@ declare interface ConfigContextProps {
128
129
  useSearchParams: UseSearchParamsOptions;
129
130
  }
130
131
 
131
- export declare function ConfigProvider({ children, config }: ConfigProviderProps): default_2.JSX.Element;
132
+ export declare function ConfigProvider({ children, config }: ConfigProviderProps): JSX.Element;
132
133
 
133
134
  declare type ConfigProviderConfigProps = Partial<ConfigContextProps>;
134
135
 
@@ -137,7 +138,7 @@ declare interface ConfigProviderProps {
137
138
  config: ConfigProviderConfigProps;
138
139
  }
139
140
 
140
- export declare function GlobalLoading(): default_2.JSX.Element;
141
+ export declare function GlobalLoading(): JSX.Element;
141
142
 
142
143
  export declare const IconButton: default_2.ForwardRefExoticComponent<IconButtonProps & default_2.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
143
144
 
@@ -210,10 +211,11 @@ declare type IconFontProps = (IconFontCommonProps & default_2.SVGProps<SVGSVGEle
210
211
  /**
211
212
  * 筛选项
212
213
  * @param props
214
+ * @param children
213
215
  * @return {JSX.Element}
214
216
  * @constructor
215
217
  */
216
- declare function Index({ children, ...props }: FormItemProps): default_2.JSX.Element;
218
+ declare function Index({ children, ...props }: FormItemProps): JSX.Element;
217
219
 
218
220
  declare interface InternalSearchAreaProps extends FormProps<any> {
219
221
  loading?: boolean;
@@ -400,7 +402,7 @@ export declare let setGlobalLoading: (_value: boolean) => void;
400
402
  /**
401
403
  * Switch 可自定义 value
402
404
  */
403
- export declare const SwitchValue: ({ checked, onChange, trueValue, falseValue, ...props }: SwitchValueProps) => default_2.JSX.Element;
405
+ export declare const SwitchValue: ({ checked, onChange, trueValue, falseValue, ...props }: SwitchValueProps) => JSX.Element;
404
406
 
405
407
  /**
406
408
  * Switch 可自定义 value
@@ -460,7 +462,7 @@ declare interface TableComponentProps<RecordType = AnyObject> extends Omit<Table
460
462
  * @return {JSX.Element}
461
463
  * @constructor
462
464
  */
463
- declare function ToggleButton({ panel, onChange }: ToggleButtonProps): default_2.JSX.Element;
465
+ declare function ToggleButton({ panel, onChange }: ToggleButtonProps): JSX.Element;
464
466
 
465
467
  declare interface ToggleButtonProps {
466
468
  panel: {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmirror-components",
3
- "version": "1.0.39",
3
+ "version": "1.0.40-alpha.2",
4
4
  "type": "module",
5
5
  "main": "build/lib/index.js",
6
6
  "module": "build/es/index.js",
@@ -23,16 +23,15 @@
23
23
  "publish:dev": "npm publish --access public --tag dev"
24
24
  },
25
25
  "peerDependencies": {
26
- "@ahooksjs/use-url-state": "^3.5.1",
27
26
  "@ant-design/icons": ">=5.0.0",
28
- "ahooks": ">=3.0.0",
29
- "antd": "^5.29.2",
27
+ "ahooks": ">=3.9.7",
28
+ "antd": "^6.3.4",
30
29
  "lodash-es": ">=4.17.0",
31
- "react": ">=18.0.0",
32
- "react-dom": ">=18.0.0",
33
- "react-intl": "^7.1.14",
30
+ "react": ">=19.0.0",
31
+ "react-dom": ">=19.0.0",
32
+ "react-intl": "^10.1.0",
34
33
  "react-router-dom": "^6.30.2",
35
- "react-transition-group": ">=4.4.0"
34
+ "react-transition-group": ">=4.4.5"
36
35
  },
37
36
  "dependencies": {
38
37
  "@emotion/react": "^11.14.0",
@@ -44,18 +43,20 @@
44
43
  "devDependencies": {
45
44
  "@types/lodash-es": "^4.17.12",
46
45
  "@types/node": "^22.13.10",
47
- "@types/react": "^18.2.0",
48
- "@types/react-dom": "^18.2.0",
46
+ "@types/react": "^19.2.14",
47
+ "@types/react-dom": "^19.2.3",
49
48
  "@types/react-transition-group": "^4.4.12",
50
- "@vitejs/plugin-react-swc": "^3.8.0",
49
+ "@vitejs/plugin-react-swc": "^4.3.0",
51
50
  "eslint": "^9.21.0",
52
51
  "eslint-plugin-react-hooks": "^5.1.0",
53
52
  "eslint-plugin-react-refresh": "^0.4.19",
54
53
  "globals": "^15.15.0",
55
54
  "less": "^4.3.0",
55
+ "react": "^19.2.4",
56
+ "react-dom": "^19.2.4",
56
57
  "typescript": "~5.7.2",
57
58
  "typescript-eslint": "^8.24.1",
58
- "vite": "^6.2.0",
59
+ "vite": "^8.0.3",
59
60
  "vite-plugin-dts": "^4.5.3"
60
61
  },
61
62
  "keywords": [
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { type AppProps } from 'antd';
3
2
  import { type MessageInstance } from 'antd/es/message/interface';
4
3
  import { type NotificationInstance } from 'antd/es/notification/interface';
@@ -9,6 +8,6 @@ declare let notification: NotificationInstance;
9
8
  declare let modal: Omit<ModalStaticFunctions, 'warn'>;
10
9
  declare function Index({ children, config, ...props }: AppProps & {
11
10
  config?: ConfigProviderConfigProps;
12
- }): React.JSX.Element;
11
+ }): import("react/jsx-runtime").JSX.Element;
13
12
  export { message, notification, modal };
14
13
  export default Index;
@@ -36,5 +36,5 @@ interface CheckboxValueProps<T = any, F = any> extends Omit<React.ComponentProps
36
36
  */
37
37
  children?: React.ReactNode;
38
38
  }
39
- declare const CheckboxValue: <T = any, F = any>({ checked, onChange, trueValue, falseValue, trueLabel, falseLabel, children, ...props }: CheckboxValueProps<T, F>) => React.JSX.Element;
39
+ declare const CheckboxValue: <T = any, F = any>({ checked, onChange, trueValue, falseValue, trueLabel, falseLabel, children, ...props }: CheckboxValueProps<T, F>) => import("react/jsx-runtime").JSX.Element;
40
40
  export default CheckboxValue;
@@ -6,4 +6,4 @@ interface ConfigProviderProps {
6
6
  children: React.ReactNode;
7
7
  config: ConfigProviderConfigProps;
8
8
  }
9
- export default function ConfigProvider({ children, config }: ConfigProviderProps): React.JSX.Element;
9
+ export default function ConfigProvider({ children, config }: ConfigProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
1
  declare let setGlobalLoading: (_value: boolean) => void;
3
- declare function GlobalLoading(): React.JSX.Element;
2
+ declare function GlobalLoading(): import("react/jsx-runtime").JSX.Element;
4
3
  export { setGlobalLoading };
5
4
  export default GlobalLoading;
@@ -8,5 +8,5 @@ interface IntlProviderProps {
8
8
  children: React.ReactNode;
9
9
  config: IntlProviderConfigProps;
10
10
  }
11
- export default function IntlProvider({ children, config }: IntlProviderProps): React.JSX.Element;
11
+ export default function IntlProvider({ children, config }: IntlProviderProps): import("react/jsx-runtime").JSX.Element;
12
12
  export { FormattedMessage, useIntl };
@@ -1,10 +1,10 @@
1
- import React from 'react';
2
1
  import { type FormItemProps } from 'antd';
3
2
  /**
4
3
  * 筛选项
5
4
  * @param props
5
+ * @param children
6
6
  * @return {JSX.Element}
7
7
  * @constructor
8
8
  */
9
- declare function Index({ children, ...props }: FormItemProps): React.JSX.Element;
9
+ declare function Index({ children, ...props }: FormItemProps): import("react/jsx-runtime").JSX.Element;
10
10
  export default Index;
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  interface ToggleButtonProps {
3
2
  panel: {
4
3
  show: boolean;
@@ -11,5 +10,5 @@ interface ToggleButtonProps {
11
10
  * @return {JSX.Element}
12
11
  * @constructor
13
12
  */
14
- declare function ToggleButton({ panel, onChange }: ToggleButtonProps): React.JSX.Element;
13
+ declare function ToggleButton({ panel, onChange }: ToggleButtonProps): import("react/jsx-runtime").JSX.Element;
15
14
  export default ToggleButton;
@@ -26,5 +26,5 @@ interface SwitchValueProps<T = boolean | string | number, F = boolean | string |
26
26
  /**
27
27
  * Switch 可自定义 value
28
28
  */
29
- declare const Index: ({ checked, onChange, trueValue, falseValue, ...props }: SwitchValueProps) => React.JSX.Element;
29
+ declare const Index: ({ checked, onChange, trueValue, falseValue, ...props }: SwitchValueProps) => import("react/jsx-runtime").JSX.Element;
30
30
  export default Index;
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import type { TableComponentProps } from '../types';
3
- declare function Index(props: TableComponentProps): React.JSX.Element;
2
+ declare function Index(props: TableComponentProps): import("react/jsx-runtime").JSX.Element;
4
3
  export default Index;
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { type TableComponentProps } from '../types';
3
2
  interface PopoverSetColumnsProps {
4
3
  order: string[];
@@ -9,5 +8,5 @@ interface PopoverSetColumnsProps {
9
8
  columnsSort: TableComponentProps['columnsSort'];
10
9
  onChangeVisible: (newVisibleItems: string[]) => void;
11
10
  }
12
- declare function PopoverSetColumns({ order, visibleItems, columns, onChangeOrder, columnsVisible, columnsSort, onChangeVisible }: PopoverSetColumnsProps): React.JSX.Element;
11
+ declare function PopoverSetColumns({ order, visibleItems, columns, onChangeOrder, columnsVisible, columnsSort, onChangeVisible }: PopoverSetColumnsProps): import("react/jsx-runtime").JSX.Element;
13
12
  export default PopoverSetColumns;
@@ -1,7 +1,3 @@
1
- export declare const PopoverWrapper: import("@emotion/styled").StyledComponent<{
2
- theme?: import("@emotion/react").Theme;
3
- as?: React.ElementType;
4
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
5
1
  export declare const ColumnsSettingWrapper: import("@emotion/styled").StyledComponent<{
6
2
  theme?: import("@emotion/react").Theme;
7
3
  as?: React.ElementType;
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { Checkbox } from 'antd';
3
+ import { type CheckboxChangeEvent } from 'antd/es/checkbox';
4
+ /**
5
+ * checkbox 可自定义 value 和 label
6
+ * 使用场景:
7
+ * 1. 需要自定义 value 和 label
8
+ */
9
+ interface CheckboxValueProps<T = any, F = any> extends Omit<React.ComponentProps<typeof Checkbox>, 'checked' | 'onChange'> {
10
+ /**
11
+ * 选中值
12
+ */
13
+ trueValue?: T;
14
+ /**
15
+ * 未选中值
16
+ */
17
+ falseValue?: F;
18
+ /**
19
+ * 选中值
20
+ */
21
+ checked?: T | F;
22
+ /**
23
+ * 选中事件
24
+ */
25
+ onChange?: (value: T | F, event: CheckboxChangeEvent) => void;
26
+ /**
27
+ * 选中标签
28
+ */
29
+ trueLabel?: string;
30
+ /**
31
+ * 未选中标签
32
+ */
33
+ falseLabel?: string;
34
+ /**
35
+ * 子元素
36
+ */
37
+ children?: React.ReactNode;
38
+ }
39
+ declare const CheckboxValue: <T = any, F = any>({ checked, onChange, trueValue, falseValue, trueLabel, falseLabel, children, ...props }: CheckboxValueProps<T, F>) => import("react/jsx-runtime").JSX.Element;
40
+ export default CheckboxValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmirror-components",
3
- "version": "1.0.39",
3
+ "version": "1.0.40-alpha.2",
4
4
  "type": "module",
5
5
  "main": "build/lib/index.js",
6
6
  "module": "build/es/index.js",
@@ -23,16 +23,15 @@
23
23
  "publish:dev": "npm publish --access public --tag dev"
24
24
  },
25
25
  "peerDependencies": {
26
- "@ahooksjs/use-url-state": "^3.5.1",
27
26
  "@ant-design/icons": ">=5.0.0",
28
- "ahooks": ">=3.0.0",
29
- "antd": "^5.29.2",
27
+ "ahooks": ">=3.9.7",
28
+ "antd": "^6.3.4",
30
29
  "lodash-es": ">=4.17.0",
31
- "react": ">=18.0.0",
32
- "react-dom": ">=18.0.0",
33
- "react-intl": "^7.1.14",
30
+ "react": ">=19.0.0",
31
+ "react-dom": ">=19.0.0",
32
+ "react-intl": "^10.1.0",
34
33
  "react-router-dom": "^6.30.2",
35
- "react-transition-group": ">=4.4.0"
34
+ "react-transition-group": ">=4.4.5"
36
35
  },
37
36
  "dependencies": {
38
37
  "@emotion/react": "^11.14.0",
@@ -44,18 +43,20 @@
44
43
  "devDependencies": {
45
44
  "@types/lodash-es": "^4.17.12",
46
45
  "@types/node": "^22.13.10",
47
- "@types/react": "^18.2.0",
48
- "@types/react-dom": "^18.2.0",
46
+ "@types/react": "^19.2.14",
47
+ "@types/react-dom": "^19.2.3",
49
48
  "@types/react-transition-group": "^4.4.12",
50
- "@vitejs/plugin-react-swc": "^3.8.0",
49
+ "@vitejs/plugin-react-swc": "^4.3.0",
51
50
  "eslint": "^9.21.0",
52
51
  "eslint-plugin-react-hooks": "^5.1.0",
53
52
  "eslint-plugin-react-refresh": "^0.4.19",
54
53
  "globals": "^15.15.0",
55
54
  "less": "^4.3.0",
55
+ "react": "^19.2.4",
56
+ "react-dom": "^19.2.4",
56
57
  "typescript": "~5.7.2",
57
58
  "typescript-eslint": "^8.24.1",
58
- "vite": "^6.2.0",
59
+ "vite": "^8.0.3",
59
60
  "vite-plugin-dts": "^4.5.3"
60
61
  },
61
62
  "keywords": [