@jswork/antd-components 1.0.222 → 1.0.223
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.cjs.js.map +1 -1
- package/dist/main.d.mts +324 -493
- package/dist/main.d.ts +324 -493
- package/dist/main.esm.js +1 -1
- package/dist/main.esm.js.map +1 -1
- package/package.json +2 -3
- package/src/lib/_abstract-upload.tsx +1 -5
- package/src/lib/alert.tsx +16 -28
- package/src/lib/breadcrumb.tsx +1 -2
- package/src/lib/button.tsx +18 -20
- package/src/lib/card-extras.tsx +3 -8
- package/src/lib/checkable-dropdown.tsx +2 -3
- package/src/lib/checkable-tag-list.tsx +2 -3
- package/src/lib/checkable-tag.tsx +1 -2
- package/src/lib/checkbox-group.tsx +1 -3
- package/src/lib/checkbox.tsx +1 -2
- package/src/lib/color-picker.tsx +2 -3
- package/src/lib/confirm-button.tsx +2 -1
- package/src/lib/date-picker.tsx +2 -3
- package/src/lib/editable-tag-group.tsx +1 -2
- package/src/lib/extra-search.tsx +2 -8
- package/src/lib/form-actions.tsx +2 -1
- package/src/lib/input-number.tsx +1 -2
- package/src/lib/input-tags.tsx +1 -2
- package/src/lib/input-token.tsx +1 -2
- package/src/lib/input.tsx +1 -2
- package/src/lib/interactive-list.tsx +1 -7
- package/src/lib/markdown-editor.tsx +1 -2
- package/src/lib/radio-group.tsx +1 -3
- package/src/lib/range-picker.tsx +1 -3
- package/src/lib/rate.tsx +1 -2
- package/src/lib/search.tsx +1 -4
- package/src/lib/select.tsx +1 -4
- package/src/lib/slider-range.tsx +1 -2
- package/src/lib/slider.tsx +1 -2
- package/src/lib/switch.tsx +1 -2
- package/src/lib/table-links.tsx +4 -9
- package/src/lib/table-status-switcher.tsx +0 -6
- package/src/lib/table-toggle-switcher.tsx +0 -6
- package/src/lib/table.tsx +3 -16
- package/src/lib/textarea.tsx +1 -2
- package/src/lib/time-picker.tsx +1 -2
- package/src/lib/transfer.tsx +2 -4
- package/src/lib/tree-select.tsx +1 -2
- package/src/lib/types.ts +136 -0
- package/src/lib/upload-dragger.tsx +1 -2
- package/src/lib/upload.tsx +1 -3
- package/src/lib/use-table-command.ts +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jswork/antd-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.223",
|
|
4
4
|
"main": "dist/main.cjs.js",
|
|
5
5
|
"module": "dist/main.esm.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -35,12 +35,11 @@
|
|
|
35
35
|
"@types/react-dom": "^18.2.13",
|
|
36
36
|
"antd": "^5.29.2",
|
|
37
37
|
"autoprefixer": "^10.4.16",
|
|
38
|
-
"baseline-browser-mapping": "^2.9.
|
|
38
|
+
"baseline-browser-mapping": "^2.9.19",
|
|
39
39
|
"classnames": "^2.5.1",
|
|
40
40
|
"cssnano": "^6.0.1",
|
|
41
41
|
"dayjs": "^1.11.12",
|
|
42
42
|
"esbuild-plugin-copy": "^2.1.1",
|
|
43
|
-
"lodash": "^4.17.21",
|
|
44
43
|
"postcss": "^8.5.3",
|
|
45
44
|
"react": "^18.2.0",
|
|
46
45
|
"react-dom": "^18.2.0",
|
|
@@ -5,17 +5,13 @@ import { UploadChangeParam } from 'antd/es/upload/interface';
|
|
|
5
5
|
import React, { ReactNode } from 'react';
|
|
6
6
|
import { flushSync } from 'react-dom';
|
|
7
7
|
import Sortable from 'sortablejs';
|
|
8
|
-
|
|
9
|
-
import '@jswork/next-gpid';
|
|
8
|
+
import type { StdCallback } from './types';
|
|
10
9
|
|
|
11
10
|
const styleOpts = { id: 'viewer-style' };
|
|
12
11
|
const scriptOpts = { id: 'viewerjs' };
|
|
13
12
|
const styleURL = 'https://unpkg.com/viewerjs@1.11.1/dist/viewer.min.css';
|
|
14
13
|
const scriptURL = 'https://unpkg.com/viewerjs@1.11.1/dist/viewer.min.js';
|
|
15
14
|
|
|
16
|
-
type StdEventTarget = { target: { value: any } };
|
|
17
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
18
|
-
|
|
19
15
|
export type AcAbstractUploadProps = {
|
|
20
16
|
className?: string;
|
|
21
17
|
value?: any[] | [];
|
package/src/lib/alert.tsx
CHANGED
|
@@ -1,60 +1,48 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Input, InputProps, message, Modal } from 'antd';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
err: (inMessage: string) => any;
|
|
7
|
-
msg: (inMessage: string) => any;
|
|
8
|
-
info: (inMessage: string) => any;
|
|
9
|
-
alert: (inMessage: string, inTitle?: String) => any;
|
|
10
|
-
confirm: (inMessage: string, inTitle?: String) => any;
|
|
11
|
-
prompt: (inMessage: string, inOptions?: InputProps) => any;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const msg = (inMessage: string) => {
|
|
16
|
-
return message.success(inMessage);
|
|
4
|
+
export const msg = (msg: string) => {
|
|
5
|
+
return message.success(msg);
|
|
17
6
|
};
|
|
18
7
|
|
|
19
|
-
export const info = (
|
|
20
|
-
return message.info(
|
|
8
|
+
export const info = (msg: string) => {
|
|
9
|
+
return message.info(msg);
|
|
21
10
|
};
|
|
22
11
|
|
|
23
|
-
export const err = (
|
|
24
|
-
return message.error(
|
|
12
|
+
export const err = (msg: string) => {
|
|
13
|
+
return message.error(msg);
|
|
25
14
|
};
|
|
26
15
|
|
|
27
|
-
|
|
28
|
-
export const alert = (inMessage: string, inTitle?: String) => {
|
|
16
|
+
export const alert = (msg: string, title?: String) => {
|
|
29
17
|
return Modal.info({
|
|
30
|
-
title:
|
|
31
|
-
content:
|
|
18
|
+
title: title || 'Tips',
|
|
19
|
+
content: msg,
|
|
32
20
|
});
|
|
33
21
|
};
|
|
34
22
|
|
|
35
|
-
export const confirm = (
|
|
23
|
+
export const confirm = (msg: string, title?: String) => {
|
|
36
24
|
return new Promise((resolve) => {
|
|
37
25
|
Modal.confirm({
|
|
38
|
-
title:
|
|
39
|
-
content:
|
|
26
|
+
title: title || 'Confirm',
|
|
27
|
+
content: msg,
|
|
40
28
|
onOk: () => resolve(true),
|
|
41
29
|
onCancel: () => resolve(false),
|
|
42
30
|
});
|
|
43
31
|
});
|
|
44
32
|
};
|
|
45
33
|
|
|
46
|
-
export const prompt = (
|
|
34
|
+
export const prompt = (msg: string, options?: InputProps) => {
|
|
47
35
|
let value = '';
|
|
48
36
|
return new Promise((resolve) => {
|
|
49
37
|
Modal.confirm({
|
|
50
|
-
title:
|
|
38
|
+
title: msg || 'Prompt',
|
|
51
39
|
content: (
|
|
52
40
|
<Input
|
|
53
41
|
type="text"
|
|
54
|
-
placeholder={
|
|
42
|
+
placeholder={msg}
|
|
55
43
|
defaultValue={value}
|
|
56
44
|
onChange={(e) => (value = e.target.value)}
|
|
57
|
-
{...
|
|
45
|
+
{...options}
|
|
58
46
|
/>
|
|
59
47
|
),
|
|
60
48
|
onOk: () => resolve(value),
|
package/src/lib/breadcrumb.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { Breadcrumb, BreadcrumbProps } from 'antd';
|
|
|
3
3
|
import ReactList, { TemplateArgs } from '@jswork/react-list';
|
|
4
4
|
import { breadcrumbDefault } from '../tpls/breadcrumb';
|
|
5
5
|
import cx from 'classnames';
|
|
6
|
+
import type { StdCallback } from './types';
|
|
6
7
|
|
|
7
8
|
// hack for react-list
|
|
8
9
|
// Warning: [antd: Breadcrumb] Only accepts Breadcrumb.Item and Breadcrumb.Separator as it's children
|
|
@@ -10,8 +11,6 @@ import cx from 'classnames';
|
|
|
10
11
|
// ReactList['__ANT_BREADCRUMB_ITEM'] = true;
|
|
11
12
|
|
|
12
13
|
const CLASS_NAME = 'ac-breadcrumb';
|
|
13
|
-
type StdEventTarget = { target: { value: any } };
|
|
14
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
15
14
|
|
|
16
15
|
export type AcBreadcrumbProps = {
|
|
17
16
|
className?: string;
|
package/src/lib/button.tsx
CHANGED
|
@@ -22,9 +22,7 @@ import {
|
|
|
22
22
|
} from '@ant-design/icons';
|
|
23
23
|
import { Button, ButtonProps } from 'antd';
|
|
24
24
|
import React, { FC } from 'react';
|
|
25
|
-
|
|
26
|
-
// 类型定义
|
|
27
|
-
export type Locale = 'zh-CN' | 'en-US';
|
|
25
|
+
import type { AppLocale } from './types';
|
|
28
26
|
type ActionType =
|
|
29
27
|
| 'create'
|
|
30
28
|
| 'edit'
|
|
@@ -42,7 +40,7 @@ type ActionType =
|
|
|
42
40
|
| 'copy';
|
|
43
41
|
|
|
44
42
|
// 文案
|
|
45
|
-
const locals: Record<
|
|
43
|
+
const locals: Record<AppLocale, Record<ActionType, string>> = {
|
|
46
44
|
'zh-CN': {
|
|
47
45
|
create: '添加',
|
|
48
46
|
edit: '编辑',
|
|
@@ -96,14 +94,14 @@ const iconMap: Record<ActionType, React.ReactNode> = {
|
|
|
96
94
|
};
|
|
97
95
|
|
|
98
96
|
// 国际化工具函数
|
|
99
|
-
const t = (locale:
|
|
97
|
+
const t = (locale: AppLocale, key: ActionType): string => {
|
|
100
98
|
return locals[locale]?.[key] ?? key;
|
|
101
99
|
};
|
|
102
100
|
|
|
103
101
|
// 通用按钮组件
|
|
104
102
|
interface ActionButtonProps extends ButtonProps {
|
|
105
103
|
action: ActionType;
|
|
106
|
-
lang?:
|
|
104
|
+
lang?: AppLocale;
|
|
107
105
|
}
|
|
108
106
|
|
|
109
107
|
const ActionButton: FC<ActionButtonProps> = ({
|
|
@@ -123,45 +121,45 @@ const ActionButton: FC<ActionButtonProps> = ({
|
|
|
123
121
|
};
|
|
124
122
|
|
|
125
123
|
// 导出具体命名的按钮(保持 API 兼容)
|
|
126
|
-
export const BtnCreate = (props: ButtonProps & { lang?:
|
|
124
|
+
export const BtnCreate = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
127
125
|
<ActionButton action="create" {...props} />
|
|
128
126
|
);
|
|
129
|
-
export const BtnEdit = (props: ButtonProps & { lang?:
|
|
127
|
+
export const BtnEdit = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
130
128
|
<ActionButton action="edit" {...props} />
|
|
131
129
|
);
|
|
132
|
-
export const BtnDelete = (props: ButtonProps & { lang?:
|
|
130
|
+
export const BtnDelete = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
133
131
|
<ActionButton action="del" {...props} />
|
|
134
132
|
);
|
|
135
|
-
export const BtnView = (props: ButtonProps & { lang?:
|
|
133
|
+
export const BtnView = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
136
134
|
<ActionButton action="view" {...props} />
|
|
137
135
|
);
|
|
138
|
-
export const BtnPreview = (props: ButtonProps & { lang?:
|
|
136
|
+
export const BtnPreview = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
139
137
|
<ActionButton action="preview" {...props} />
|
|
140
138
|
);
|
|
141
|
-
export const BtnSave = (props: ButtonProps & { lang?:
|
|
139
|
+
export const BtnSave = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
142
140
|
<ActionButton action="save" {...props} />
|
|
143
141
|
);
|
|
144
|
-
export const BtnExport = (props: ButtonProps & { lang?:
|
|
142
|
+
export const BtnExport = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
145
143
|
<ActionButton action="export" {...props} />
|
|
146
144
|
);
|
|
147
|
-
export const BtnImport = (props: ButtonProps & { lang?:
|
|
145
|
+
export const BtnImport = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
148
146
|
<ActionButton action="imp" {...props} />
|
|
149
147
|
);
|
|
150
|
-
export const BtnRefresh = (props: ButtonProps & { lang?:
|
|
148
|
+
export const BtnRefresh = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
151
149
|
<ActionButton action="refresh" {...props} />
|
|
152
150
|
);
|
|
153
|
-
export const BtnBack = (props: ButtonProps & { lang?:
|
|
151
|
+
export const BtnBack = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
154
152
|
<ActionButton action="back" {...props} />
|
|
155
153
|
);
|
|
156
|
-
export const BtnSubmit = (props: ButtonProps & { lang?:
|
|
154
|
+
export const BtnSubmit = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
157
155
|
<ActionButton action="submit" {...props} />
|
|
158
156
|
);
|
|
159
|
-
export const BtnCancel = (props: ButtonProps & { lang?:
|
|
157
|
+
export const BtnCancel = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
160
158
|
<ActionButton action="cancel" {...props} />
|
|
161
159
|
);
|
|
162
|
-
export const BtnSync = (props: ButtonProps & { lang?:
|
|
160
|
+
export const BtnSync = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
163
161
|
<ActionButton action="sync" {...props} />
|
|
164
162
|
);
|
|
165
|
-
export const BtnCopy = (props: ButtonProps & { lang?:
|
|
163
|
+
export const BtnCopy = (props: ButtonProps & { lang?: AppLocale }) => (
|
|
166
164
|
<ActionButton action="copy" {...props} />
|
|
167
165
|
);
|
package/src/lib/card-extras.tsx
CHANGED
|
@@ -7,17 +7,12 @@
|
|
|
7
7
|
import nx from '@jswork/next';
|
|
8
8
|
import { Space, SpaceProps } from 'antd';
|
|
9
9
|
import React, { FC, Fragment } from 'react';
|
|
10
|
-
import { BtnBack, BtnCreate, BtnRefresh
|
|
11
|
-
|
|
12
|
-
declare global {
|
|
13
|
-
interface NxStatic {
|
|
14
|
-
$event: any;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
10
|
+
import { BtnBack, BtnCreate, BtnRefresh } from './button';
|
|
11
|
+
import type { AppLocale } from './types';
|
|
17
12
|
|
|
18
13
|
export type AcCardExtrasProps = SpaceProps & {
|
|
19
14
|
name: string;
|
|
20
|
-
lang?:
|
|
15
|
+
lang?: AppLocale;
|
|
21
16
|
as?: React.ComponentType<any>;
|
|
22
17
|
extraBefore?: React.ReactNode;
|
|
23
18
|
extraAfter?: React.ReactNode;
|
|
@@ -3,15 +3,14 @@ import '@jswork/next-dom-event';
|
|
|
3
3
|
import { Button, Checkbox, Dropdown, MenuProps } from 'antd';
|
|
4
4
|
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import type { AppLocale, StdCallback } from './types';
|
|
6
7
|
|
|
7
8
|
const CLASS_NAME = 'ac-checkable-dropdown';
|
|
8
9
|
const locales = { 'zh-CN': { selectAll: '全部' }, 'en-US': { selectAll: 'All' } };
|
|
9
|
-
type StdEventTarget = { target: { value: any } };
|
|
10
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
11
10
|
|
|
12
11
|
export type AcCheckableDropdownProps = {
|
|
13
12
|
className?: string;
|
|
14
|
-
lang?:
|
|
13
|
+
lang?: AppLocale;
|
|
15
14
|
items?: any[];
|
|
16
15
|
value?: any[];
|
|
17
16
|
width?: number;
|
|
@@ -3,14 +3,13 @@ import { Button, Space } from 'antd';
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { AcCheckableTag } from './checkable-tag';
|
|
6
|
+
import type { AppLocale, StdCallback } from './types';
|
|
6
7
|
|
|
7
8
|
const CLASS_NAME = 'ac-checkable-tag-list';
|
|
8
9
|
const locales = {
|
|
9
10
|
'zh-CN': { selectAll: '全部' },
|
|
10
11
|
'en-US': { selectAll: 'All' },
|
|
11
12
|
};
|
|
12
|
-
type StdEventTarget = { target: { value: any } };
|
|
13
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
14
13
|
|
|
15
14
|
export type AcCheckableTagListProps = {
|
|
16
15
|
/**
|
|
@@ -20,7 +19,7 @@ export type AcCheckableTagListProps = {
|
|
|
20
19
|
/**
|
|
21
20
|
* The language key.
|
|
22
21
|
*/
|
|
23
|
-
lang?:
|
|
22
|
+
lang?: AppLocale;
|
|
24
23
|
/**
|
|
25
24
|
* The component data soruce.
|
|
26
25
|
*/
|
|
@@ -3,11 +3,10 @@ import { Tag } from 'antd';
|
|
|
3
3
|
import { CheckableTagProps } from 'antd/es/tag';
|
|
4
4
|
import cx from 'classnames';
|
|
5
5
|
import React, { ReactNode } from 'react';
|
|
6
|
+
import type { StdCallback } from './types';
|
|
6
7
|
|
|
7
8
|
const CLASS_NAME = 'ac-checkable-tag';
|
|
8
9
|
const { CheckableTag } = Tag;
|
|
9
|
-
type StdEventTarget = { target: { value: any } };
|
|
10
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* @see https://ant.design/components/tag-cn/#Tag.CheckableTag
|
|
@@ -4,11 +4,9 @@ import { CheckboxGroupProps } from 'antd/es/checkbox';
|
|
|
4
4
|
import cx from 'classnames';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { checkboxKv } from '../tpls/kv';
|
|
7
|
+
import type { StdCallback, TemplateCallback } from './types';
|
|
7
8
|
|
|
8
9
|
const CLASS_NAME = 'ac-checkbox-group';
|
|
9
|
-
type StdEventTarget = { target: { value: any } };
|
|
10
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
11
|
-
type TemplateCallback = (item: { item: any; index: number }) => React.ReactNode;
|
|
12
10
|
|
|
13
11
|
export type AcCheckboxGroupProps = {
|
|
14
12
|
className?: string;
|
package/src/lib/checkbox.tsx
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Checkbox, CheckboxProps } from 'antd';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import React, { HTMLAttributes } from 'react';
|
|
4
|
+
import type { StdCallback } from './types';
|
|
4
5
|
|
|
5
6
|
const CLASS_NAME = 'ac-checkbox';
|
|
6
|
-
type StdEventTarget = { target: { value: any } };
|
|
7
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
8
7
|
|
|
9
8
|
export type AcCheckboxProps = {
|
|
10
9
|
className?: string;
|
package/src/lib/color-picker.tsx
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { ColorPicker, ColorPickerProps } from 'antd';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import type { StdCallback } from './types';
|
|
4
5
|
|
|
5
6
|
const CLASS_NAME = 'ac-color-picker';
|
|
6
|
-
type StdEventTarget = { target: { value: string } };
|
|
7
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
8
7
|
|
|
9
8
|
export type AcColorPickerProps = {
|
|
10
9
|
className?: string;
|
|
11
10
|
value?: string;
|
|
12
|
-
onChange?: StdCallback
|
|
11
|
+
onChange?: StdCallback<string>;
|
|
13
12
|
} & Omit<ColorPickerProps, 'value' | 'onChange'>;
|
|
14
13
|
|
|
15
14
|
export class AcColorPicker extends React.Component<AcColorPickerProps> {
|
|
@@ -2,6 +2,7 @@ import type { ButtonProps, PopconfirmProps } from 'antd';
|
|
|
2
2
|
import { Button, message, Popconfirm } from 'antd';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import React, { Component } from 'react';
|
|
5
|
+
import type { AppLocale } from './types';
|
|
5
6
|
|
|
6
7
|
const CLASS_NAME = 'ac-confirm-button';
|
|
7
8
|
const locals = {
|
|
@@ -17,7 +18,7 @@ const locals = {
|
|
|
17
18
|
|
|
18
19
|
export interface AcConfirmButtonProps extends Omit<PopconfirmProps, 'title'> {
|
|
19
20
|
className?: string;
|
|
20
|
-
lang?:
|
|
21
|
+
lang?: AppLocale;
|
|
21
22
|
title?: string;
|
|
22
23
|
type?: ButtonProps['type'] | 'raw' | 'anchor';
|
|
23
24
|
childProps?: ButtonProps;
|
package/src/lib/date-picker.tsx
CHANGED
|
@@ -2,16 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import { DatePicker, DatePickerProps } from 'antd';
|
|
4
4
|
import cx from 'classnames';
|
|
5
|
+
import type { StdCallback } from './types';
|
|
5
6
|
|
|
6
7
|
const CLASS_NAME = 'ac-date-picker';
|
|
7
8
|
const STD_FORMAT = 'YYYY-MM-DD HH:mm:ss';
|
|
8
|
-
type StdEventTarget = { target: { value: string } };
|
|
9
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
10
9
|
|
|
11
10
|
export type AcDatePickerProps = Omit<DatePickerProps, 'value' | 'onChange' | 'ref'> & {
|
|
12
11
|
className?: string;
|
|
13
12
|
value?: any;
|
|
14
|
-
onChange?: StdCallback
|
|
13
|
+
onChange?: StdCallback<string>;
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
const DATA_FORMAT_HOOKS = {
|
|
@@ -6,10 +6,9 @@ import deepEqual from 'fast-deep-equal';
|
|
|
6
6
|
import React, { createRef } from 'react';
|
|
7
7
|
import AutosizeInput from 'react-input-autosize';
|
|
8
8
|
import { AcInteractiveList } from './interactive-list';
|
|
9
|
+
import type { StdCallback } from './types';
|
|
9
10
|
|
|
10
11
|
const CLASS_NAME = 'ac-editable-tag-group';
|
|
11
|
-
type StdEventTarget = { target: { value: any } };
|
|
12
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
13
12
|
|
|
14
13
|
export type AcEditableTagGroupProps = {
|
|
15
14
|
/**
|
package/src/lib/extra-search.tsx
CHANGED
|
@@ -9,17 +9,11 @@ import { readSearchString, writeSearchString } from '@jswork/url-sync-flat';
|
|
|
9
9
|
import nx from '@jswork/next';
|
|
10
10
|
import { Input } from 'antd';
|
|
11
11
|
import { SearchProps } from 'antd/es/input';
|
|
12
|
-
|
|
13
|
-
declare global {
|
|
14
|
-
interface NxStatic {
|
|
15
|
-
$event: any;
|
|
16
|
-
$api: Record<string, any>;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
12
|
+
import type { AppLocale } from './types';
|
|
19
13
|
|
|
20
14
|
export type AcExtraSearchProps = SearchProps & {
|
|
21
15
|
name: string;
|
|
22
|
-
lang?:
|
|
16
|
+
lang?: AppLocale;
|
|
23
17
|
queryKey?: string;
|
|
24
18
|
routerType?: 'hash' | 'browser';
|
|
25
19
|
}
|
package/src/lib/form-actions.tsx
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, { RefObject } from 'react';
|
|
8
8
|
import { Button, ButtonProps, Space, SpaceProps } from 'antd';
|
|
9
|
+
import type { AppLocale } from './types';
|
|
9
10
|
|
|
10
11
|
export type FormActionsProps = SpaceProps & {
|
|
11
|
-
lang?:
|
|
12
|
+
lang?: AppLocale;
|
|
12
13
|
actions?: string[];
|
|
13
14
|
okText?: string;
|
|
14
15
|
cancelText?: string;
|
package/src/lib/input-number.tsx
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { InputNumber, InputNumberProps } from 'antd';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import type { StdCallback } from './types';
|
|
4
5
|
|
|
5
6
|
const CLASS_NAME = 'ac-input-number';
|
|
6
|
-
type StdEventTarget = { target: { value: any } };
|
|
7
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
8
7
|
|
|
9
8
|
export type AcInputNumberProps = {
|
|
10
9
|
className?: string;
|
package/src/lib/input-tags.tsx
CHANGED
|
@@ -2,13 +2,12 @@ import { Tag } from 'antd';
|
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import fde from 'fast-deep-equal';
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import type { StdCallback } from './types';
|
|
5
6
|
|
|
6
7
|
const CLASS_NAME = 'ac-input-tags';
|
|
7
8
|
const TRIGGER_KEYS = ['Tab', 'Enter', 'Space'];
|
|
8
9
|
|
|
9
10
|
// @ https://cdpn.io/iamqamarali/fullpage/qyawoR?anon=true&view=
|
|
10
|
-
type StdEventTarget = { target: { value: any } };
|
|
11
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
12
11
|
|
|
13
12
|
export type AcInputTagsProps = {
|
|
14
13
|
className?: string;
|
package/src/lib/input-token.tsx
CHANGED
|
@@ -3,10 +3,9 @@ import { Button, Input, InputProps, Space } from 'antd';
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import { nanoid } from 'nanoid';
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import type { StdCallback } from './types';
|
|
6
7
|
|
|
7
8
|
const CLASS_NAME = 'ac-input-token';
|
|
8
|
-
type StdEventTarget = { target: { value: any } };
|
|
9
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
10
9
|
|
|
11
10
|
export type AcInputTokenProps = {
|
|
12
11
|
className?: string;
|
package/src/lib/input.tsx
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Input, InputProps } from 'antd';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import type { StdCallback } from './types';
|
|
4
5
|
|
|
5
6
|
const CLASS_NAME = 'ac-input';
|
|
6
|
-
type StdEventTarget = { target: { value: any } };
|
|
7
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
8
7
|
|
|
9
8
|
export type AcInputProps = {
|
|
10
9
|
className?: string;
|
|
@@ -2,16 +2,10 @@ import ReactList from '@jswork/react-list';
|
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import deepEqual from 'fast-deep-equal';
|
|
4
4
|
import React, { Component, HTMLAttributes } from 'react';
|
|
5
|
+
import type { StdCallback, StdEventTarget, TemplateCallbackWithItems } from './types';
|
|
5
6
|
|
|
6
7
|
const CLASS_NAME = 'ac-interactive-list';
|
|
7
8
|
|
|
8
|
-
type StdEventTarget = { target: { value: any } };
|
|
9
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
10
|
-
type TemplateCallback = (
|
|
11
|
-
item: { item: any; index: number; items: any[] },
|
|
12
|
-
cb: any
|
|
13
|
-
) => React.ReactNode;
|
|
14
|
-
|
|
15
9
|
export type ReactInteractiveListProps = {
|
|
16
10
|
/**
|
|
17
11
|
* The extended className for component.
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import MarkdownEditor from '@uiw/react-markdown-editor';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import type { StdCallback } from './types';
|
|
4
5
|
|
|
5
6
|
const CLASS_NAME = 'ac-markdown-editor';
|
|
6
|
-
type StdEventTarget = { target: { value: any } };
|
|
7
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
8
7
|
|
|
9
8
|
export type AcMarkdownEditorProps = {
|
|
10
9
|
className?: string;
|
package/src/lib/radio-group.tsx
CHANGED
|
@@ -3,11 +3,9 @@ import { Radio, RadioGroupProps } from 'antd';
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import React, { HTMLAttributes } from 'react';
|
|
5
5
|
import { radioKv } from '../tpls/kv';
|
|
6
|
+
import type { StdCallback, TemplateCallback } from './types';
|
|
6
7
|
|
|
7
8
|
const CLASS_NAME = 'ac-radio-group';
|
|
8
|
-
type StdEventTarget = { target: { value: any } };
|
|
9
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
10
|
-
type TemplateCallback = (item: { item: any; index: number }, opts?: any) => React.ReactNode;
|
|
11
9
|
|
|
12
10
|
export type AcRadioGroupProps = {
|
|
13
11
|
className?: string;
|
package/src/lib/range-picker.tsx
CHANGED
|
@@ -3,14 +3,12 @@ import { RangePickerProps } from 'antd/es/date-picker';
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import moment from 'dayjs';
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import type { StdCallback } from './types';
|
|
6
7
|
|
|
7
8
|
const CLASS_NAME = 'ac-range-picker';
|
|
8
9
|
const STD_FORMAT = 'YYYY-MM-DD HH:mm:ss';
|
|
9
10
|
const { RangePicker } = DatePicker;
|
|
10
11
|
|
|
11
|
-
type StdEventTarget = { target: { value: any } };
|
|
12
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
13
|
-
|
|
14
12
|
export type AcRangePickerProps = {
|
|
15
13
|
className?: string;
|
|
16
14
|
value?: any;
|
package/src/lib/rate.tsx
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Rate, RateProps } from 'antd';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import type { StdCallback } from './types';
|
|
4
5
|
|
|
5
6
|
const CLASS_NAME = 'ac-rate';
|
|
6
|
-
type StdEventTarget = { target: { value: any } };
|
|
7
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
8
7
|
|
|
9
8
|
export type AcRateProps = {
|
|
10
9
|
className?: string;
|
package/src/lib/search.tsx
CHANGED
|
@@ -2,10 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { Input } from 'antd';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import { SearchProps } from 'antd/es/input';
|
|
5
|
+
import type { StdCallback } from './types';
|
|
5
6
|
|
|
6
7
|
const CLASS_NAME = 'ac-search';
|
|
7
|
-
type StdEventTarget = { target: { value: any } };
|
|
8
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
9
8
|
|
|
10
9
|
export type AcSearchProps = {
|
|
11
10
|
value?: string;
|
|
@@ -47,5 +46,3 @@ export class AcSearch extends React.Component<AcSearchProps> {
|
|
|
47
46
|
export const AcSearchFc = (props: AcSearchProps) => {
|
|
48
47
|
return <AcSearch {...props} />;
|
|
49
48
|
};
|
|
50
|
-
|
|
51
|
-
|
package/src/lib/select.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { Select, SelectProps } from 'antd';
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { kv as KvTmpl, selectKv } from '../tpls/kv';
|
|
6
|
+
import type { StdCallback, StdEventTarget, TemplateCallback } from './types';
|
|
6
7
|
|
|
7
8
|
const CLASS_NAME = 'ac-select';
|
|
8
9
|
const DEFAULT_KV = {
|
|
@@ -10,10 +11,6 @@ const DEFAULT_KV = {
|
|
|
10
11
|
value: 'value',
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
type StdEventTarget = { target: { value: any } };
|
|
14
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
15
|
-
type TemplateCallback = (item: { item: any; index: number }) => React.ReactNode;
|
|
16
|
-
|
|
17
14
|
export type AcSelectProps = {
|
|
18
15
|
className?: string;
|
|
19
16
|
items?: any[];
|
package/src/lib/slider-range.tsx
CHANGED
|
@@ -2,10 +2,9 @@ import { Slider } from 'antd';
|
|
|
2
2
|
import { SliderRangeProps } from 'antd/es/slider';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import type { StdCallback } from './types';
|
|
5
6
|
|
|
6
7
|
const CLASS_NAME = 'ac-slider-range';
|
|
7
|
-
type StdEventTarget = { target: { value: any } };
|
|
8
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
9
8
|
|
|
10
9
|
export type AcSliderRangeProps = {
|
|
11
10
|
className?: string;
|
package/src/lib/slider.tsx
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Slider, SliderSingleProps } from 'antd';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import type { StdCallback } from './types';
|
|
4
5
|
|
|
5
6
|
const CLASS_NAME = 'ac-slider';
|
|
6
|
-
type StdEventTarget = { target: { value: any } };
|
|
7
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
8
7
|
|
|
9
8
|
export type AcSliderProps = {
|
|
10
9
|
className?: string;
|
package/src/lib/switch.tsx
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Switch, SwitchProps } from 'antd';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import type { StdCallback } from './types';
|
|
4
5
|
|
|
5
6
|
const CLASS_NAME = 'ac-switch';
|
|
6
|
-
type StdEventTarget = { target: { value: any } };
|
|
7
|
-
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
8
7
|
|
|
9
8
|
export type AcSwitchProps = {
|
|
10
9
|
className?: string;
|