@jswork/antd-components 1.0.220 → 1.0.222
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 +65 -44
- package/dist/main.d.ts +65 -44
- package/dist/main.esm.js +1 -1
- package/dist/main.esm.js.map +1 -1
- package/package.json +2 -1
- package/src/lib/extra-search.tsx +1 -1
- package/src/lib/init-widgets.ts +2 -0
- package/src/lib/markdown-editor.tsx +44 -0
- package/src/lib/table.tsx +2 -2
- package/src/main.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jswork/antd-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.222",
|
|
4
4
|
"main": "dist/main.cjs.js",
|
|
5
5
|
"module": "dist/main.esm.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"@jswork/react-list": "^1.4.3",
|
|
69
69
|
"@jswork/url-sync-flat": "^1.0.8",
|
|
70
70
|
"@jswork/weibo2res": "^1.0.4",
|
|
71
|
+
"@uiw/react-markdown-editor": "^6.1.4",
|
|
71
72
|
"fast-deep-equal": "^3.1.3",
|
|
72
73
|
"nanoid": "*",
|
|
73
74
|
"react-input-autosize": "^3.0.0",
|
package/src/lib/extra-search.tsx
CHANGED
|
@@ -47,7 +47,7 @@ export const AcExtraSearch: FC<AcExtraSearchProps> = (props) => {
|
|
|
47
47
|
const searchParams = readSearchString(routerType);
|
|
48
48
|
const defaultQuery = searchParams.get(queryKey) || '';
|
|
49
49
|
const [value, setValue] = React.useState(defaultQuery);
|
|
50
|
-
const defaultParams = Object.fromEntries(searchParams.entries());
|
|
50
|
+
const defaultParams = Object.fromEntries((searchParams as any).entries() as Iterable<[string, string]>);
|
|
51
51
|
const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
52
52
|
const q = e.target.value;
|
|
53
53
|
setValue(q);
|
package/src/lib/init-widgets.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { AcInputHiddenFc } from './input-hidden';
|
|
|
18
18
|
import { AcInputNumberFc } from './input-number';
|
|
19
19
|
import { AcInputTagsFc } from './input-tags';
|
|
20
20
|
import { AcInputTokenFc } from './input-token';
|
|
21
|
+
import { AcMarkdownEditorFc } from './markdown-editor';
|
|
21
22
|
import { AcPreSelectFc } from './pre-select';
|
|
22
23
|
import { AcRadioGroupFc } from './radio-group';
|
|
23
24
|
import { AcRangePickerFc } from './range-picker';
|
|
@@ -50,6 +51,7 @@ export const widgets = {
|
|
|
50
51
|
'ac:input-number': AcInputNumberFc,
|
|
51
52
|
'ac:input-tags': AcInputTagsFc,
|
|
52
53
|
'ac:input-token': AcInputTokenFc,
|
|
54
|
+
'ac:markdown-editor': AcMarkdownEditorFc,
|
|
53
55
|
'ac:pre-select': AcPreSelectFc,
|
|
54
56
|
'ac:radio-group': AcRadioGroupFc,
|
|
55
57
|
'ac:range-picker': AcRangePickerFc,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import MarkdownEditor from '@uiw/react-markdown-editor';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
const CLASS_NAME = 'ac-markdown-editor';
|
|
6
|
+
type StdEventTarget = { target: { value: any } };
|
|
7
|
+
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
8
|
+
|
|
9
|
+
export type AcMarkdownEditorProps = {
|
|
10
|
+
className?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
onChange?: StdCallback;
|
|
13
|
+
} & React.ComponentProps<typeof MarkdownEditor>;
|
|
14
|
+
|
|
15
|
+
export class AcMarkdownEditor extends React.Component<AcMarkdownEditorProps> {
|
|
16
|
+
static displayName = CLASS_NAME;
|
|
17
|
+
static formSchema = CLASS_NAME;
|
|
18
|
+
static defaultProps = {};
|
|
19
|
+
|
|
20
|
+
handleChange = (inValue: string) => {
|
|
21
|
+
const { onChange } = this.props;
|
|
22
|
+
onChange?.({ target: { value: inValue } });
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
render() {
|
|
26
|
+
const { className, value, onChange, ...props } = this.props;
|
|
27
|
+
// 确保 value 不是 null 或 undefined
|
|
28
|
+
const safeValue = value ?? '';
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<MarkdownEditor
|
|
32
|
+
data-component={CLASS_NAME}
|
|
33
|
+
className={cx(CLASS_NAME, className)}
|
|
34
|
+
value={safeValue}
|
|
35
|
+
onChange={this.handleChange}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const AcMarkdownEditorFc = (props: AcMarkdownEditorProps) => {
|
|
43
|
+
return <AcMarkdownEditor {...props} />;
|
|
44
|
+
};
|
package/src/lib/table.tsx
CHANGED
|
@@ -174,13 +174,13 @@ export class AcTable extends React.Component<AcTableProps, AcTableState> {
|
|
|
174
174
|
get calculateColumnsAction() {
|
|
175
175
|
const { name, columnsAction, columnsActionParams, lang } = this.props;
|
|
176
176
|
if (typeof columnsAction !== 'undefined') return columnsAction;
|
|
177
|
-
return tableAction({ name, lang, ...columnsActionParams });
|
|
177
|
+
return [tableAction({ name, lang, ...columnsActionParams })];
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
get calculateColumns() {
|
|
181
181
|
const { columnsFields, columns } = this.props;
|
|
182
182
|
if (columns && columns.length > 0) return columns;
|
|
183
|
-
return [...columnsFields!, this.calculateColumnsAction] as TableProps['columns'];
|
|
183
|
+
return [...columnsFields!, ...this.calculateColumnsAction] as TableProps['columns'];
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
constructor(props: AcTableProps) {
|
package/src/main.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { AcInputHidden, AcInputHiddenFc } from './lib/input-hidden';
|
|
|
15
15
|
import { AcInputNumber, AcInputNumberFc } from './lib/input-number';
|
|
16
16
|
import { AcInputTags, AcInputTagsFc } from './lib/input-tags';
|
|
17
17
|
import { AcInputToken, AcInputTokenFc } from './lib/input-token';
|
|
18
|
+
import { AcMarkdownEditor, AcMarkdownEditorFc } from './lib/markdown-editor';
|
|
18
19
|
import { AcPreSelect, AcPreSelectFc } from './lib/pre-select';
|
|
19
20
|
import { AcRadioGroup, AcRadioGroupFc } from './lib/radio-group';
|
|
20
21
|
import { AcRangePicker, AcRangePickerFc } from './lib/range-picker';
|
|
@@ -53,6 +54,7 @@ import type { AcInputProps } from './lib/input';
|
|
|
53
54
|
import type { AcInputNumberProps } from './lib/input-number';
|
|
54
55
|
import type { AcInputTagsProps } from './lib/input-tags';
|
|
55
56
|
import type { AcInputTokenProps } from './lib/input-token';
|
|
57
|
+
import type { AcMarkdownEditorProps } from './lib/markdown-editor';
|
|
56
58
|
import type { AcPreSelectProps } from './lib/pre-select';
|
|
57
59
|
import type { AcRadioGroupProps } from './lib/radio-group';
|
|
58
60
|
import type { AcRangePickerProps } from './lib/range-picker';
|
|
@@ -146,6 +148,9 @@ export {
|
|
|
146
148
|
AcInputToken,
|
|
147
149
|
AcInputTokenFc,
|
|
148
150
|
AcInputTokenProps,
|
|
151
|
+
AcMarkdownEditor,
|
|
152
|
+
AcMarkdownEditorFc,
|
|
153
|
+
AcMarkdownEditorProps,
|
|
149
154
|
AcPreSelect,
|
|
150
155
|
AcPreSelectFc,
|
|
151
156
|
AcPreSelectProps,
|