@magicbe/antd-crud 0.0.39 → 0.0.41
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/Add.js +5 -1
- package/dist/components/Edit.js +5 -1
- package/dist/components/Filter.js +6 -2
- package/dist/interface.d.ts +2 -0
- package/package.json +53 -54
package/dist/components/Add.js
CHANGED
|
@@ -25,7 +25,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
25
25
|
import React, { useImperativeHandle } from "react";
|
|
26
26
|
import { Form as AntdForm, Empty } from "antd";
|
|
27
27
|
import Field from "./Field";
|
|
28
|
-
import { isObject, isString } from "lodash";
|
|
28
|
+
import { get, isObject, isString } from "lodash";
|
|
29
29
|
import { useTableContext } from "./Context";
|
|
30
30
|
var AddForm = React.forwardRef(function (_a, ref) {
|
|
31
31
|
var default_data = _a.default_data;
|
|
@@ -46,6 +46,10 @@ var AddForm = React.forwardRef(function (_a, ref) {
|
|
|
46
46
|
return Object.assign(column, { field: add });
|
|
47
47
|
}
|
|
48
48
|
return column;
|
|
49
|
+
}).sort(function (_a, _b) {
|
|
50
|
+
var field_a = _a.field;
|
|
51
|
+
var field_b = _b.field;
|
|
52
|
+
return (Number(get(field_a, "order")) - Number(get(field_b, "order")));
|
|
49
53
|
});
|
|
50
54
|
if (!(fields === null || fields === void 0 ? void 0 : fields.length)) {
|
|
51
55
|
return _jsx(Empty, { description: "暂无数据字段!" });
|
package/dist/components/Edit.js
CHANGED
|
@@ -25,7 +25,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
25
25
|
import React, { useImperativeHandle } from "react";
|
|
26
26
|
import { Form as AntdForm, Empty } from "antd";
|
|
27
27
|
import { useTableContext } from "./Context";
|
|
28
|
-
import { isObject, isString } from "lodash";
|
|
28
|
+
import { get, isObject, isString } from "lodash";
|
|
29
29
|
import Field from "./Field";
|
|
30
30
|
var EditForm = React.forwardRef(function (_a, ref) {
|
|
31
31
|
var _b = _a.default_data, default_data = _b === void 0 ? {} : _b;
|
|
@@ -46,6 +46,10 @@ var EditForm = React.forwardRef(function (_a, ref) {
|
|
|
46
46
|
return Object.assign(column, { field: edit });
|
|
47
47
|
}
|
|
48
48
|
return column;
|
|
49
|
+
}).sort(function (_a, _b) {
|
|
50
|
+
var field_a = _a.field;
|
|
51
|
+
var field_b = _b.field;
|
|
52
|
+
return (Number(get(field_a, "order")) - Number(get(field_b, "order")));
|
|
49
53
|
});
|
|
50
54
|
if (!(fields === null || fields === void 0 ? void 0 : fields.length)) {
|
|
51
55
|
return _jsx(Empty, { description: "暂无数据字段!" });
|
|
@@ -32,7 +32,7 @@ import Field from "./Field";
|
|
|
32
32
|
import { Button, Form, Space } from "antd";
|
|
33
33
|
import createEmotion from "@emotion/css/create-instance";
|
|
34
34
|
import { SearchOutlined, UndoOutlined } from "@ant-design/icons";
|
|
35
|
-
import { isObject, isString } from "lodash";
|
|
35
|
+
import { get, isObject, isString } from "lodash";
|
|
36
36
|
var _a = createEmotion({ key: "filter" }), css = _a.css, cx = _a.cx;
|
|
37
37
|
var wrapper_css = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-bottom: 25px;\n"], ["\n margin-bottom: 25px;\n"])));
|
|
38
38
|
var Filter = function (_a, ref) {
|
|
@@ -53,6 +53,10 @@ var Filter = function (_a, ref) {
|
|
|
53
53
|
return Object.assign(column, { field: filter });
|
|
54
54
|
}
|
|
55
55
|
return column;
|
|
56
|
+
}).sort(function (_a, _b) {
|
|
57
|
+
var field_a = _a.field;
|
|
58
|
+
var field_b = _b.field;
|
|
59
|
+
return (Number(get(field_a, "order")) - Number(get(field_b, "order")));
|
|
56
60
|
});
|
|
57
61
|
var onFinish = function (value) {
|
|
58
62
|
var _a, _b;
|
|
@@ -67,7 +71,7 @@ var Filter = function (_a, ref) {
|
|
|
67
71
|
var initialValues;
|
|
68
72
|
if (!(filters === null || filters === void 0 ? void 0 : filters.length))
|
|
69
73
|
return _jsx(Fragment, {});
|
|
70
|
-
return (_jsxs(Form, { layout: "inline", onFinish: onFinish, className: wrapper_css, form: form, initialValues: initialValues, children: [filters === null || filters === void 0 ? void 0 : filters.map(function (filter) { return _createElement(Field, __assign({}, filter, { key: String(filter.dataIndex) })); }), _jsxs(Space, { children: [_jsxs(Button, { htmlType: "submit", type: "primary", children: [_jsx(SearchOutlined, {}), "\u67E5\u8BE2"] }), _jsxs(Button, { htmlType: "reset", children: [_jsx(UndoOutlined, {}), "\u91CD\u7F6E"] })] })] }));
|
|
74
|
+
return (_jsxs(Form, { layout: "inline", onFinish: onFinish, className: wrapper_css, form: form, initialValues: initialValues, children: [filters === null || filters === void 0 ? void 0 : filters.map(function (filter) { return _createElement(Field, __assign({}, filter, { key: String(filter.dataIndex) })); }), _jsxs(Space, { size: 14, children: [_jsxs(Button, { htmlType: "submit", type: "primary", children: [_jsx(SearchOutlined, {}), "\u67E5\u8BE2"] }), _jsxs(Button, { htmlType: "reset", children: [_jsx(UndoOutlined, {}), "\u91CD\u7F6E"] })] })] }));
|
|
71
75
|
};
|
|
72
76
|
export default React.forwardRef(Filter);
|
|
73
77
|
var templateObject_1;
|
package/dist/interface.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface BaseColumnField<T extends string, O = any> {
|
|
|
11
11
|
type: T;
|
|
12
12
|
option?: O;
|
|
13
13
|
rules?: Rule[];
|
|
14
|
+
order?: number;
|
|
14
15
|
}
|
|
15
16
|
/**隐藏字段 */
|
|
16
17
|
export interface ColumnHiddenField extends BaseColumnField<"Hidden"> {
|
|
@@ -82,6 +83,7 @@ export interface CustormColumnField {
|
|
|
82
83
|
type: React.FC;
|
|
83
84
|
option?: any;
|
|
84
85
|
rules?: Rule[];
|
|
86
|
+
order?: number;
|
|
85
87
|
}
|
|
86
88
|
export type ColumnField = ColumnHiddenField | ColumnInputField | ColumnInputPasswordField | ColumnTextAreaField | ColumnInputNumberField | ColumnSelectField | ColumnCascaderField | ColumnTreeSelectField | ColumnCheckboxField | ColumnCheckboxGroupField | ColumnDatePickerField | ColumnDatePickerYearPickerField | ColumnDatePickerMonthPickerField | ColumnDatePickerWeekPickerField | ColumnDatePickerTimePickerField | ColumnDatePickerRangePickerField | ColumnDatePickerQuarterPickerField | ColumnTimePickerField | ColumnTimePickerRangePickerField | ColumnRadioField | ColumnRadioGroupField | ColumnSwitchField | CustormColumnField;
|
|
87
89
|
export type ColumnFieldKeys = ColumnHiddenField["type"] | ColumnInputField["type"] | ColumnInputPasswordField["type"] | ColumnTextAreaField["type"] | ColumnInputNumberField["type"] | ColumnSelectField["type"] | ColumnCascaderField["type"] | ColumnTreeSelectField["type"] | ColumnCheckboxField["type"] | ColumnCheckboxGroupField["type"] | ColumnDatePickerField["type"] | ColumnDatePickerYearPickerField["type"] | ColumnDatePickerMonthPickerField["type"] | ColumnDatePickerWeekPickerField["type"] | ColumnDatePickerTimePickerField["type"] | ColumnDatePickerRangePickerField["type"] | ColumnDatePickerQuarterPickerField["type"] | ColumnTimePickerField["type"] | ColumnTimePickerRangePickerField["type"] | ColumnRadioField["type"] | ColumnRadioGroupField["type"] | ColumnSwitchField["type"];
|
package/package.json
CHANGED
|
@@ -1,57 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
"pre-commit": "yarn lint"
|
|
55
|
-
}
|
|
2
|
+
"name": "@magicbe/antd-crud",
|
|
3
|
+
"version": "0.0.41",
|
|
4
|
+
"description": "antd crud table",
|
|
5
|
+
"author": "wang quan",
|
|
6
|
+
"private": false,
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"Component",
|
|
13
|
+
"UI",
|
|
14
|
+
"React"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "http://www.wangquan.top",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@ant-design/icons": "^5.4.0",
|
|
22
|
+
"@emotion/css": "^11.13.0",
|
|
23
|
+
"antd": "5.22.5",
|
|
24
|
+
"deepmerge": "^4.3.1",
|
|
25
|
+
"lodash": "^4.17.21",
|
|
26
|
+
"react": "^18.2.0",
|
|
27
|
+
"react-dom": "^18.2.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@storybook/addon-docs": "^9.1.2",
|
|
31
|
+
"@storybook/addon-onboarding": "^9.1.2",
|
|
32
|
+
"@storybook/preset-create-react-app": "^9.1.2",
|
|
33
|
+
"@storybook/react-webpack5": "^9.1.2",
|
|
34
|
+
"@types/lodash": "^4.17.7",
|
|
35
|
+
"@types/node": "^16.18.10",
|
|
36
|
+
"@types/react": "^18.0.26",
|
|
37
|
+
"@types/react-dom": "^18.0.9",
|
|
38
|
+
"http-proxy-middleware": "^3.0.0",
|
|
39
|
+
"prop-types": "^15.8.1",
|
|
40
|
+
"react-scripts": "^5.0.1",
|
|
41
|
+
"storybook": "^9.1.2",
|
|
42
|
+
"typescript": "5.7.3",
|
|
43
|
+
"webpack": "^5.101.2"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"lint": "eslint --ext js,ts,tsx src --max-warnings 5",
|
|
47
|
+
"build": "tsc -p tsconfig.build.json",
|
|
48
|
+
"storybook": "storybook dev -p 6006",
|
|
49
|
+
"build-storybook": "storybook build"
|
|
50
|
+
},
|
|
51
|
+
"husky": {
|
|
52
|
+
"hooks": {
|
|
53
|
+
"pre-commit": "yarn lint"
|
|
56
54
|
}
|
|
55
|
+
}
|
|
57
56
|
}
|