@jswork/antd-components 1.0.176 → 1.0.178
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.cjs.js +1 -1
- package/dist/main.d.mts +3 -2
- package/dist/main.d.ts +3 -2
- package/dist/main.esm.js +1 -1
- package/dist/main.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/lib/table-extra-search.tsx +7 -5
- package/src/lib/use-table-command.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jswork/antd-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.178",
|
|
4
4
|
"main": "dist/main.cjs.js",
|
|
5
5
|
"module": "dist/main.esm.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@jswork/noop": "^1.0.0",
|
|
63
63
|
"@jswork/react-codeflask": "^1.1.2",
|
|
64
64
|
"@jswork/react-list": "^1.4.3",
|
|
65
|
-
"@jswork/url-sync-flat": "^1.0.
|
|
65
|
+
"@jswork/url-sync-flat": "^1.0.8",
|
|
66
66
|
"@jswork/weibo2res": "^1.0.4",
|
|
67
67
|
"fast-deep-equal": "^3.1.3",
|
|
68
68
|
"nanoid": "5.0.9",
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @Author: aric.zheng 1290657123@qq.com
|
|
3
3
|
* @Date: 2025-10-29 10:54:41
|
|
4
4
|
* @LastEditors: aric.zheng 1290657123@qq.com
|
|
5
|
-
* @LastEditTime: 2025-10-29
|
|
5
|
+
* @LastEditTime: 2025-10-29 14:03:38
|
|
6
6
|
*/
|
|
7
7
|
import React, { FC } from 'react';
|
|
8
8
|
import { AcSearch, AcSearchProps } from './search';
|
|
9
|
-
import {
|
|
9
|
+
import { readSearchString } from '@jswork/url-sync-flat';
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
declare global {
|
|
@@ -20,6 +20,7 @@ export type AcTableExtraSearchProps = AcSearchProps & {
|
|
|
20
20
|
name: string;
|
|
21
21
|
lang?: string;
|
|
22
22
|
queryKey?: string;
|
|
23
|
+
routerType?: 'hash' | 'browser';
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
const locales = {
|
|
@@ -34,12 +35,13 @@ const locales = {
|
|
|
34
35
|
const defaultProps = {
|
|
35
36
|
lang: 'zh-CN',
|
|
36
37
|
queryKey: 'keywords',
|
|
38
|
+
routerType: 'hash' as const,
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
export const AcTableExtraSearch: FC<AcTableExtraSearchProps> = (props) => {
|
|
40
|
-
const { name, lang, queryKey, ...rest } = { ...defaultProps, ...props };
|
|
42
|
+
const { name, lang, queryKey, routerType, ...rest } = { ...defaultProps, ...props };
|
|
41
43
|
const t = (key: string) => locales[lang!][key];
|
|
42
|
-
const
|
|
44
|
+
const searchParams = readSearchString(routerType);
|
|
43
45
|
const defaultQuery = searchParams.get(queryKey) || '';
|
|
44
46
|
const defaultParams = Object.fromEntries(searchParams.entries());
|
|
45
47
|
|
|
@@ -52,7 +54,7 @@ export const AcTableExtraSearch: FC<AcTableExtraSearchProps> = (props) => {
|
|
|
52
54
|
placeholder={t('placeholder')}
|
|
53
55
|
onSearch={(e) => {
|
|
54
56
|
const q = e.target.value;
|
|
55
|
-
nx.$event
|
|
57
|
+
nx.$event?.emit?.(`${name}:load`, { page: 1, ...defaultParams, [queryKey]: q });
|
|
56
58
|
}}
|
|
57
59
|
{...rest}
|
|
58
60
|
/>
|
|
@@ -10,7 +10,7 @@ const useCommand = (inName?: string) => {
|
|
|
10
10
|
const listen: ListenFn = (cmd, callback) => AcTable.event?.on(`${name}:${cmd}`, callback);
|
|
11
11
|
|
|
12
12
|
// the command repository:
|
|
13
|
-
const load = () => execute('load');
|
|
13
|
+
const load = (payload: Payload) => execute('load', payload);
|
|
14
14
|
const refetch = () => execute('refetch');
|
|
15
15
|
const reset = () => execute('reset');
|
|
16
16
|
const add = () => execute('add');
|