@arim-aisdc/public-components 2.0.6 → 2.0.8
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/components/CustomForm/CustomForm.d.ts +1 -1
- package/dist/components/CustomForm/CustomForm.js +18 -10
- package/dist/components/CustomForm/type.d.ts +5 -1
- package/dist/components/QueryFilter/QueryFilter.d.ts +1 -1
- package/dist/components/QueryFilter/QueryFilter.js +8 -8
- package/dist/components/QueryFilter/type.d.ts +1 -3
- package/package.json +103 -102
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './index.less';
|
|
3
3
|
import { CustomFormProps } from './type';
|
|
4
|
-
declare const _default: React.
|
|
4
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<CustomFormProps & React.RefAttributes<unknown>>>;
|
|
5
5
|
export default _default;
|
|
@@ -14,7 +14,7 @@ import { useDebounceFn } from 'ahooks';
|
|
|
14
14
|
import { AutoComplete, Badge, Button, Cascader, Checkbox, Col, DatePicker, Form, Input, InputNumber, Radio, Row, Select, Spin, Switch } from 'antd';
|
|
15
15
|
import dayjs from 'dayjs';
|
|
16
16
|
import { debounce } from 'lodash';
|
|
17
|
-
import React, { useEffect, useMemo,
|
|
17
|
+
import React, { forwardRef, useEffect, useMemo, useState } from 'react';
|
|
18
18
|
import ColorSelector from "../ColorSelector";
|
|
19
19
|
import "./index.less";
|
|
20
20
|
import { CustomFormItemType } from "./type";
|
|
@@ -74,7 +74,7 @@ var getSpanConfig = function getSpanConfig(layout, width, span) {
|
|
|
74
74
|
layout: breakPoint[2]
|
|
75
75
|
};
|
|
76
76
|
};
|
|
77
|
-
var CustomForm = function CustomForm(_ref) {
|
|
77
|
+
var CustomForm = function CustomForm(_ref, ref) {
|
|
78
78
|
var data = _ref.data,
|
|
79
79
|
initialValues = _ref.initialValues,
|
|
80
80
|
_ref$labelCol = _ref.labelCol,
|
|
@@ -117,12 +117,14 @@ var CustomForm = function CustomForm(_ref) {
|
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
/**初始化表单 */
|
|
120
|
-
|
|
120
|
+
// const FormRef = useRef<FormInstance>(null);
|
|
121
121
|
useEffect(function () {
|
|
122
|
+
var _form$resetFields;
|
|
122
123
|
/**回显异步初始值 */
|
|
123
|
-
if (FormRef && FormRef.current) {
|
|
124
|
-
|
|
125
|
-
}
|
|
124
|
+
// if (FormRef && FormRef.current) {
|
|
125
|
+
// FormRef.current.resetFields();
|
|
126
|
+
// }
|
|
127
|
+
(_form$resetFields = form.resetFields) === null || _form$resetFields === void 0 || _form$resetFields.call(form);
|
|
126
128
|
|
|
127
129
|
// 更新表单数据
|
|
128
130
|
setFormValues(initialValues || {});
|
|
@@ -273,6 +275,7 @@ var CustomForm = function CustomForm(_ref) {
|
|
|
273
275
|
break;
|
|
274
276
|
case CustomFormItemType.Select:
|
|
275
277
|
element = /*#__PURE__*/_jsx(Select, {
|
|
278
|
+
mode: item.mode ? item.mode : undefined,
|
|
276
279
|
showSearch: item.showSearch,
|
|
277
280
|
placeholder: item.inputTips,
|
|
278
281
|
allowClear: item.allowClear === false ? false : true,
|
|
@@ -297,6 +300,9 @@ var CustomForm = function CustomForm(_ref) {
|
|
|
297
300
|
notFoundContent: ((_item$setting = item.setting) === null || _item$setting === void 0 ? void 0 : _item$setting.length) >= 0 ? null : /*#__PURE__*/_jsx(Spin, {
|
|
298
301
|
size: "small"
|
|
299
302
|
}),
|
|
303
|
+
maxTagCount: item.maxTagCount,
|
|
304
|
+
optionFilterProp: item.optionFilterProp || 'value',
|
|
305
|
+
optionLabelProp: item.optionLabelProp || 'children',
|
|
300
306
|
children: item.setting.map(function (el, num) {
|
|
301
307
|
var _el$options;
|
|
302
308
|
if (el !== null && el !== void 0 && el.options && (el === null || el === void 0 || (_el$options = el.options) === null || _el$options === void 0 ? void 0 : _el$options.length) > 0) {
|
|
@@ -369,8 +375,10 @@ var CustomForm = function CustomForm(_ref) {
|
|
|
369
375
|
break;
|
|
370
376
|
case CustomFormItemType.DateTime:
|
|
371
377
|
element = /*#__PURE__*/_jsx(DatePicker, {
|
|
372
|
-
showTime: true
|
|
373
|
-
format
|
|
378
|
+
showTime: true
|
|
379
|
+
// format="YYYY-MM-DD HH:mm:ss"
|
|
380
|
+
,
|
|
381
|
+
format: (item === null || item === void 0 ? void 0 : item.defaultFormat) || 'YYYY-MM-DD HH:mm:ss',
|
|
374
382
|
style: {
|
|
375
383
|
width: '100%'
|
|
376
384
|
},
|
|
@@ -601,7 +609,7 @@ var CustomForm = function CustomForm(_ref) {
|
|
|
601
609
|
return /*#__PURE__*/_jsx("div", {
|
|
602
610
|
id: "CustomForm",
|
|
603
611
|
children: /*#__PURE__*/_jsx(Form, {
|
|
604
|
-
ref:
|
|
612
|
+
ref: ref,
|
|
605
613
|
form: form,
|
|
606
614
|
layout: layout,
|
|
607
615
|
name: 'customForm',
|
|
@@ -673,4 +681,4 @@ var CustomForm = function CustomForm(_ref) {
|
|
|
673
681
|
})
|
|
674
682
|
});
|
|
675
683
|
};
|
|
676
|
-
export default /*#__PURE__*/React.memo(CustomForm);
|
|
684
|
+
export default /*#__PURE__*/React.memo( /*#__PURE__*/forwardRef(CustomForm));
|
|
@@ -75,6 +75,7 @@ export type CustomSearchFieldType = {
|
|
|
75
75
|
min?: number;
|
|
76
76
|
max?: number;
|
|
77
77
|
step?: number;
|
|
78
|
+
precision?: number;
|
|
78
79
|
showSearch?: boolean;
|
|
79
80
|
handleSearch?: () => void;
|
|
80
81
|
suffix?: string;
|
|
@@ -84,6 +85,9 @@ export type CustomSearchFieldType = {
|
|
|
84
85
|
mode?: 'multiple' | 'tags';
|
|
85
86
|
maxTagCount?: number | 'responsive';
|
|
86
87
|
span?: number;
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated 不建议使用,使用required替代
|
|
90
|
+
*/
|
|
87
91
|
is_null?: number;
|
|
88
92
|
required?: boolean;
|
|
89
93
|
labelCol?: number;
|
|
@@ -100,7 +104,7 @@ export interface CustomFormProps {
|
|
|
100
104
|
isOkText?: string;
|
|
101
105
|
/**取消按钮 text */
|
|
102
106
|
cancelText?: string;
|
|
103
|
-
|
|
107
|
+
/**修改值以及点击提交按钮,都会触发的方法 */
|
|
104
108
|
handleSubmit: (...args: any[]) => void;
|
|
105
109
|
/**重置方法 */
|
|
106
110
|
handleCancel: MouseEventHandler<HTMLElement>;
|
|
@@ -23,5 +23,5 @@ export declare function useDynamicSearchFiled(searchField: Array<any>, dynamicFi
|
|
|
23
23
|
settingHandler: (items: Array<any>) => Array<any>;
|
|
24
24
|
params?: any;
|
|
25
25
|
}>): any[];
|
|
26
|
-
declare const _default: React.
|
|
26
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<QueryFilterProps & React.RefAttributes<unknown>>>;
|
|
27
27
|
export default _default;
|
|
@@ -20,7 +20,7 @@ import { AutoComplete, Badge, Button, Cascader, Checkbox, DatePicker, Form, Inpu
|
|
|
20
20
|
import TextArea from 'antd/lib/input/TextArea';
|
|
21
21
|
import dayjs from 'dayjs';
|
|
22
22
|
import { debounce } from 'lodash';
|
|
23
|
-
import React, {
|
|
23
|
+
import React, { forwardRef, useEffect, useState } from 'react';
|
|
24
24
|
import "./index.less";
|
|
25
25
|
import { FormItemType, TimeFormatType } from "./type";
|
|
26
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -31,7 +31,7 @@ export var typeList = {
|
|
|
31
31
|
start: 'start',
|
|
32
32
|
end: 'end'
|
|
33
33
|
};
|
|
34
|
-
var QueryFilter = function QueryFilter(_ref) {
|
|
34
|
+
var QueryFilter = function QueryFilter(_ref, ref) {
|
|
35
35
|
var data = _ref.data,
|
|
36
36
|
initialValues = _ref.initialValues,
|
|
37
37
|
_ref$isOkText = _ref.isOkText,
|
|
@@ -46,9 +46,8 @@ var QueryFilter = function QueryFilter(_ref) {
|
|
|
46
46
|
_ref$submitLoading = _ref.submitLoading,
|
|
47
47
|
submitLoading = _ref$submitLoading === void 0 ? false : _ref$submitLoading,
|
|
48
48
|
_ref$renderButton = _ref.renderButton,
|
|
49
|
-
renderButton = _ref$renderButton === void 0 ? null : _ref$renderButton
|
|
50
|
-
|
|
51
|
-
var _Form$useForm = Form.useForm(initForm),
|
|
49
|
+
renderButton = _ref$renderButton === void 0 ? null : _ref$renderButton;
|
|
50
|
+
var _Form$useForm = Form.useForm(),
|
|
52
51
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
53
52
|
form = _Form$useForm2[0];
|
|
54
53
|
var Option = Select.Option;
|
|
@@ -82,7 +81,8 @@ var QueryFilter = function QueryFilter(_ref) {
|
|
|
82
81
|
var handledInitValues = getHandledInitValues();
|
|
83
82
|
|
|
84
83
|
/**初始化表单 */
|
|
85
|
-
|
|
84
|
+
// const FormRef = useRef<FormInstance>(null);
|
|
85
|
+
|
|
86
86
|
useEffect(function () {
|
|
87
87
|
/**回显异步初始值 */
|
|
88
88
|
// FormRef && FormRef.current && FormRef.current.resetFields();
|
|
@@ -565,7 +565,7 @@ var QueryFilter = function QueryFilter(_ref) {
|
|
|
565
565
|
return /*#__PURE__*/_jsx("div", {
|
|
566
566
|
id: "QueryFilter",
|
|
567
567
|
children: /*#__PURE__*/_jsxs(Form, {
|
|
568
|
-
ref:
|
|
568
|
+
ref: ref,
|
|
569
569
|
form: form
|
|
570
570
|
// name={styles.customForm}
|
|
571
571
|
,
|
|
@@ -725,4 +725,4 @@ export function useDynamicSearchFiled(searchField, dynamicField) {
|
|
|
725
725
|
setWrapSearchField = _useState4[1];
|
|
726
726
|
return wrapSearchField;
|
|
727
727
|
}
|
|
728
|
-
export default /*#__PURE__*/React.memo(QueryFilter);
|
|
728
|
+
export default /*#__PURE__*/React.memo( /*#__PURE__*/forwardRef(QueryFilter));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FormProps } from 'antd';
|
|
2
|
-
import { FormInstance } from 'antd/es/form';
|
|
3
2
|
import { MouseEventHandler } from 'react';
|
|
4
3
|
export declare enum FormItemType {
|
|
5
4
|
Text = "text",
|
|
@@ -100,7 +99,7 @@ export interface QueryFilterProps {
|
|
|
100
99
|
isOkText?: string;
|
|
101
100
|
/**取消按钮 text */
|
|
102
101
|
cancelText?: string;
|
|
103
|
-
|
|
102
|
+
/**修改值以及点击提交按钮,都会触发的方法 */
|
|
104
103
|
handleSubmit: ({ data }: {
|
|
105
104
|
data: any;
|
|
106
105
|
}, item?: fieldType, type?: inputValueType) => void;
|
|
@@ -115,5 +114,4 @@ export interface QueryFilterProps {
|
|
|
115
114
|
submitLoading?: boolean;
|
|
116
115
|
buttonRender?: any;
|
|
117
116
|
renderButton?: any;
|
|
118
|
-
initForm?: FormInstance;
|
|
119
117
|
}
|
package/package.json
CHANGED
|
@@ -1,102 +1,103 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@arim-aisdc/public-components",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "前端组件库",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"module": "dist/index.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
|
-
"files": [
|
|
10
|
-
"dist"
|
|
11
|
-
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "father build",
|
|
14
|
-
"build:watch": "father dev",
|
|
15
|
-
"dev": "dumi dev",
|
|
16
|
-
"docs:build": "dumi build",
|
|
17
|
-
"doctor": "father doctor",
|
|
18
|
-
"lint": "npm run lint:es && npm run lint:css",
|
|
19
|
-
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
|
20
|
-
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
21
|
-
"local": "dumi dev",
|
|
22
|
-
"prepare": "husky install && dumi setup",
|
|
23
|
-
"prepublishOnly": "father doctor && npm run build",
|
|
24
|
-
"start": "npm run dev"
|
|
25
|
-
},
|
|
26
|
-
"commitlint": {
|
|
27
|
-
"extends": [
|
|
28
|
-
"@commitlint/config-conventional"
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
"lint-staged": {
|
|
32
|
-
"*.{md,json}": [
|
|
33
|
-
"prettier --write --no-error-on-unmatched-pattern"
|
|
34
|
-
],
|
|
35
|
-
"*.{css,less}": [
|
|
36
|
-
"stylelint --fix",
|
|
37
|
-
"prettier --write"
|
|
38
|
-
],
|
|
39
|
-
"*.{js,jsx}": [
|
|
40
|
-
"eslint --fix",
|
|
41
|
-
"prettier --write"
|
|
42
|
-
],
|
|
43
|
-
"*.{ts,tsx}": [
|
|
44
|
-
"eslint --fix",
|
|
45
|
-
"prettier --parser=typescript --write"
|
|
46
|
-
]
|
|
47
|
-
},
|
|
48
|
-
"dependencies": {
|
|
49
|
-
"@ant-design/icons": "^5.3.7",
|
|
50
|
-
"@ant-design/pro-components": "^2.7.10",
|
|
51
|
-
"@tanstack/match-sorter-utils": "^8.8.4",
|
|
52
|
-
"@tanstack/react-table": "^8.9.1",
|
|
53
|
-
"ahooks": "^3.7.8",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"react-
|
|
64
|
-
"react-dnd
|
|
65
|
-
"react-
|
|
66
|
-
"react-
|
|
67
|
-
"react-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"@commitlint/
|
|
72
|
-
"@
|
|
73
|
-
"@types/react
|
|
74
|
-
"@
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"less
|
|
82
|
-
"less-
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"prettier
|
|
87
|
-
"prettier-plugin-
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"
|
|
93
|
-
"react
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@arim-aisdc/public-components",
|
|
3
|
+
"version": "2.0.8",
|
|
4
|
+
"description": "前端组件库",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "father build",
|
|
14
|
+
"build:watch": "father dev",
|
|
15
|
+
"dev": "dumi dev",
|
|
16
|
+
"docs:build": "dumi build",
|
|
17
|
+
"doctor": "father doctor",
|
|
18
|
+
"lint": "npm run lint:es && npm run lint:css",
|
|
19
|
+
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
|
20
|
+
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
21
|
+
"local": "dumi dev",
|
|
22
|
+
"prepare": "husky install && dumi setup",
|
|
23
|
+
"prepublishOnly": "father doctor && npm run build",
|
|
24
|
+
"start": "npm run dev"
|
|
25
|
+
},
|
|
26
|
+
"commitlint": {
|
|
27
|
+
"extends": [
|
|
28
|
+
"@commitlint/config-conventional"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"lint-staged": {
|
|
32
|
+
"*.{md,json}": [
|
|
33
|
+
"prettier --write --no-error-on-unmatched-pattern"
|
|
34
|
+
],
|
|
35
|
+
"*.{css,less}": [
|
|
36
|
+
"stylelint --fix",
|
|
37
|
+
"prettier --write"
|
|
38
|
+
],
|
|
39
|
+
"*.{js,jsx}": [
|
|
40
|
+
"eslint --fix",
|
|
41
|
+
"prettier --write"
|
|
42
|
+
],
|
|
43
|
+
"*.{ts,tsx}": [
|
|
44
|
+
"eslint --fix",
|
|
45
|
+
"prettier --parser=typescript --write"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@ant-design/icons": "^5.3.7",
|
|
50
|
+
"@ant-design/pro-components": "^2.7.10",
|
|
51
|
+
"@tanstack/match-sorter-utils": "^8.8.4",
|
|
52
|
+
"@tanstack/react-table": "^8.9.1",
|
|
53
|
+
"ahooks": "^3.7.8",
|
|
54
|
+
"antd": "^5.18.3",
|
|
55
|
+
"classnames": "^2.5.1",
|
|
56
|
+
"css-vars-ponyfill": "^2.4.8",
|
|
57
|
+
"dayjs": "^1.11.11",
|
|
58
|
+
"fs": "^0.0.1-security",
|
|
59
|
+
"immer": "^10.0.3",
|
|
60
|
+
"jsep": "^1.3.8",
|
|
61
|
+
"lodash": "^4.17.21",
|
|
62
|
+
"path": "^0.12.7",
|
|
63
|
+
"react-color": "^2.19.3",
|
|
64
|
+
"react-dnd": "^16.0.1",
|
|
65
|
+
"react-dnd-html5-backend": "^16.0.1",
|
|
66
|
+
"react-draggable": "^4.4.6",
|
|
67
|
+
"react-router-dom": "^6.22.3",
|
|
68
|
+
"react-split-pane": "^0.1.92"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@commitlint/cli": "^17.1.2",
|
|
72
|
+
"@commitlint/config-conventional": "^17.1.0",
|
|
73
|
+
"@types/react": "^18.0.0",
|
|
74
|
+
"@types/react-dom": "^18.0.0",
|
|
75
|
+
"@umijs/lint": "^4.0.0",
|
|
76
|
+
"babel-plugin-import": "^1.13.8",
|
|
77
|
+
"dumi": "^2.2.13",
|
|
78
|
+
"eslint": "^8.23.0",
|
|
79
|
+
"father": "^4.1.0",
|
|
80
|
+
"husky": "^8.0.1",
|
|
81
|
+
"less": "^4.1.3",
|
|
82
|
+
"less-loader": "^11.1.0",
|
|
83
|
+
"less-vars-to-js": "^1.3.0",
|
|
84
|
+
"lint-staged": "^13.0.3",
|
|
85
|
+
"mockjs": "^1.1.0",
|
|
86
|
+
"prettier": "^2.7.1",
|
|
87
|
+
"prettier-plugin-organize-imports": "^3.0.0",
|
|
88
|
+
"prettier-plugin-packagejson": "^2.2.18",
|
|
89
|
+
"stylelint": "^14.9.1"
|
|
90
|
+
},
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"antd": "^5.18.3",
|
|
93
|
+
"react": ">=17.0.1",
|
|
94
|
+
"react-dom": ">=17.0.1",
|
|
95
|
+
"umi-request": "^1.4.0"
|
|
96
|
+
},
|
|
97
|
+
"publishConfig": {
|
|
98
|
+
"access": "public"
|
|
99
|
+
},
|
|
100
|
+
"authors": [
|
|
101
|
+
"na.xu2278@foxmail.com"
|
|
102
|
+
]
|
|
103
|
+
}
|