@guo514360255/antd-lib 1.4.1

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.
Files changed (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -0
  3. package/dist/CustomDetailModal/detailModal.d.ts +72 -0
  4. package/dist/CustomDetailModal/index.d.ts +5 -0
  5. package/dist/CustomDetailModal/index.js +183 -0
  6. package/dist/CustomDetailModal/index.less +6 -0
  7. package/dist/CustomFormModal/formModal.d.ts +78 -0
  8. package/dist/CustomFormModal/index.d.ts +5 -0
  9. package/dist/CustomFormModal/index.js +293 -0
  10. package/dist/CustomFormModal/index.less +29 -0
  11. package/dist/CustomTable/index.d.ts +5 -0
  12. package/dist/CustomTable/index.js +412 -0
  13. package/dist/CustomTable/index.less +69 -0
  14. package/dist/CustomTable/table.d.ts +143 -0
  15. package/dist/CustomTag/index.d.ts +3 -0
  16. package/dist/CustomTag/index.js +27 -0
  17. package/dist/CustomTag/tag.d.ts +19 -0
  18. package/dist/CustomUpload/index.d.ts +22 -0
  19. package/dist/CustomUpload/index.js +197 -0
  20. package/dist/DynamicIcon/index.d.ts +9 -0
  21. package/dist/DynamicIcon/index.js +34 -0
  22. package/dist/FormItem/index.d.ts +9 -0
  23. package/dist/FormItem/index.js +47 -0
  24. package/dist/compontent.d.ts +86 -0
  25. package/dist/hooks/index.d.ts +2 -0
  26. package/dist/hooks/index.js +7 -0
  27. package/dist/hooks/useFullscreen.d.ts +6 -0
  28. package/dist/hooks/useFullscreen.js +77 -0
  29. package/dist/index.d.ts +13 -0
  30. package/dist/index.js +9 -0
  31. package/dist/utils/index.d.ts +3 -0
  32. package/dist/utils/index.js +8 -0
  33. package/dist/utils/rememberPwd.d.ts +34 -0
  34. package/dist/utils/rememberPwd.js +112 -0
  35. package/dist/utils/util.d.ts +54 -0
  36. package/dist/utils/util.js +119 -0
  37. package/package.json +90 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 514360255@qq.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # react-antd-lib
2
+ react antd design library
3
+
4
+ [![NPM version](https://img.shields.io/npm/v/antDesign5.svg?style=flat)](https://npmjs.org/package/antDesign5)
5
+ [![NPM downloads](http://img.shields.io/npm/dm/antDesign5.svg?style=flat)](https://npmjs.org/package/antDesign5)
6
+
7
+ react design 5 lib
8
+
9
+ ## Usage
10
+
11
+ TODO
12
+
13
+ ## Options
14
+
15
+ TODO
16
+
17
+ ## Development
18
+
19
+ ```bash
20
+ # install dependencies
21
+ $ yarn install
22
+
23
+ # develop library by docs demo
24
+ $ yarn start
25
+
26
+ # build library source code
27
+ $ yarn run build
28
+
29
+ # build library source code in watch mode
30
+ $ yarn run build:watch
31
+
32
+ # build docs
33
+ $ yarn run docs:build
34
+
35
+ # Locally preview the production build.
36
+ $ yarn run docs:preview
37
+
38
+ # check your project for potential problems
39
+ $ yarn run doctor
40
+ ```
41
+
42
+ ## LICENSE
43
+
44
+ MIT
@@ -0,0 +1,72 @@
1
+ /*
2
+ * @Author: 郭郭
3
+ * @Date: 2025/11/5
4
+ * @Description:
5
+ */
6
+
7
+ import { CustomColumnProps } from '../compontent';
8
+
9
+ /**
10
+ * 详情props
11
+ */
12
+ interface CustomDetailModalProps {
13
+ /**
14
+ * 标题
15
+ */
16
+ title?: string | undefined;
17
+
18
+ /**
19
+ * 弹窗类型
20
+ */
21
+ type?: 'modal' | 'drawer' | 'detail';
22
+
23
+ /**
24
+ * 宽度
25
+ */
26
+ width?: number | string;
27
+
28
+ /**
29
+ * 表单字段
30
+ */
31
+ columns?: CustomColumnProps[];
32
+
33
+ /**
34
+ * form列表
35
+ */
36
+ formList?: {
37
+ [key: string]: any;
38
+ };
39
+
40
+ /**
41
+ * 表单默认值
42
+ */
43
+ values?: { [key: string]: any };
44
+
45
+ /**
46
+ * 处理form数据
47
+ */
48
+ handleDetailData?: (data: any) => any;
49
+
50
+ /**
51
+ * desc参数
52
+ */
53
+ descProps?: { [key: string]: any };
54
+
55
+ /**
56
+ * 详情
57
+ * @param data
58
+ */
59
+ detailRequest?: (data: any) => any;
60
+
61
+ /**
62
+ * 其它参数
63
+ */
64
+ [key: string]: any;
65
+
66
+ /**
67
+ * descriptions参数
68
+ */
69
+ detailDescProps?: {
70
+ [key: string]: any;
71
+ };
72
+ }
@@ -0,0 +1,5 @@
1
+ import { CustomDetailModalProps } from "./detailModal";
2
+ import React from 'react';
3
+ import './index.less';
4
+ declare const CustomModal: React.ForwardRefExoticComponent<Omit<CustomDetailModalProps, "ref"> & React.RefAttributes<any>>;
5
+ export default CustomModal;
@@ -0,0 +1,183 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
4
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
5
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
+ var _excluded = ["type", "columns", "detailRequest", "handleDetailData", "title", "descProps"];
8
+ /*
9
+ * @Author: 郭郭
10
+ * @Date: 2025/8/15
11
+ * @Description:
12
+ */
13
+
14
+ import { findTreeNodeByKey, isEmptyValue } from "../utils/util";
15
+ import { Button, Descriptions, Drawer, Modal, Spin } from 'antd';
16
+ import { isNumber, isString } from 'lodash';
17
+ import isObject from 'lodash/isObject';
18
+ import React, { forwardRef, useImperativeHandle, useState } from 'react';
19
+ import "./index.less";
20
+ var CustomModal = /*#__PURE__*/forwardRef(function (props, ref) {
21
+ var type = props.type,
22
+ columns = props.columns,
23
+ detailRequest = props.detailRequest,
24
+ handleDetailData = props.handleDetailData,
25
+ title = props.title,
26
+ descProps = props.descProps,
27
+ other = _objectWithoutProperties(props, _excluded);
28
+ var _useState = useState(false),
29
+ _useState2 = _slicedToArray(_useState, 2),
30
+ open = _useState2[0],
31
+ setOpen = _useState2[1];
32
+ var _useState3 = useState(false),
33
+ _useState4 = _slicedToArray(_useState3, 2),
34
+ loading = _useState4[0],
35
+ setLoading = _useState4[1];
36
+ var _useState5 = useState({}),
37
+ _useState6 = _slicedToArray(_useState5, 2),
38
+ detail = _useState6[0],
39
+ setDetail = _useState6[1];
40
+ var modalType = {
41
+ modal: Modal,
42
+ drawer: Drawer
43
+ };
44
+ var Component = modalType[type || 'drawer'];
45
+ var getDetail = /*#__PURE__*/function () {
46
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(id) {
47
+ var data;
48
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
49
+ while (1) switch (_context.prev = _context.next) {
50
+ case 0:
51
+ if (!(!isString(id) && !isNumber(id))) {
52
+ _context.next = 3;
53
+ break;
54
+ }
55
+ console.warn('Invalid id parameter:', id);
56
+ return _context.abrupt("return");
57
+ case 3:
58
+ if (!loading) {
59
+ _context.next = 5;
60
+ break;
61
+ }
62
+ return _context.abrupt("return");
63
+ case 5:
64
+ setLoading(true);
65
+ _context.prev = 6;
66
+ _context.next = 9;
67
+ return detailRequest(id);
68
+ case 9:
69
+ data = _context.sent;
70
+ setDetail(handleDetailData ? handleDetailData(data) : data);
71
+ _context.next = 16;
72
+ break;
73
+ case 13:
74
+ _context.prev = 13;
75
+ _context.t0 = _context["catch"](6);
76
+ console.error('Failed to fetch detail:', _context.t0);
77
+ case 16:
78
+ _context.prev = 16;
79
+ setLoading(false);
80
+ return _context.finish(16);
81
+ case 19:
82
+ case "end":
83
+ return _context.stop();
84
+ }
85
+ }, _callee, null, [[6, 13, 16, 19]]);
86
+ }));
87
+ return function getDetail(_x) {
88
+ return _ref.apply(this, arguments);
89
+ };
90
+ }();
91
+ useImperativeHandle(ref, function () {
92
+ return {
93
+ open: function open(values) {
94
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
95
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
96
+ while (1) switch (_context2.prev = _context2.next) {
97
+ case 0:
98
+ setOpen(true);
99
+ if (!(values.id && detailRequest)) {
100
+ _context2.next = 6;
101
+ break;
102
+ }
103
+ _context2.next = 4;
104
+ return getDetail(values.id);
105
+ case 4:
106
+ _context2.next = 7;
107
+ break;
108
+ case 6:
109
+ setDetail(values);
110
+ case 7:
111
+ case "end":
112
+ return _context2.stop();
113
+ }
114
+ }, _callee2);
115
+ }))();
116
+ }
117
+ };
118
+ });
119
+ var close = function close() {
120
+ setOpen(false);
121
+ };
122
+ var handleDetailValue = function handleDetailValue(column, value, index) {
123
+ if (isEmptyValue(value)) return value;
124
+ var fieldProps = column.fieldProps,
125
+ valueEnum = column.valueEnum;
126
+ var _ref2 = fieldProps || {},
127
+ options = _ref2.options;
128
+ if (column.render) {
129
+ return column.render(value, detail, index, {}, column);
130
+ } else if (['select', 'radio'].includes(column.type)) {
131
+ var valuesEnum = _objectSpread({}, valueEnum);
132
+ var values = "".concat(value).split(',');
133
+ var result = [];
134
+ if (Object.keys(valuesEnum).length > 0 && isObject(valuesEnum)) {
135
+ values.forEach(function (item) {
136
+ var _item;
137
+ result.push((_item = valuesEnum[item]) === null || _item === void 0 ? void 0 : _item.text);
138
+ });
139
+ return result.join(',');
140
+ } else if (Array.isArray(options) && options.length > 0) {
141
+ values.forEach(function (item) {
142
+ var _ref3 = findTreeNodeByKey(options, item) || {},
143
+ label = _ref3.label;
144
+ result.push(label);
145
+ });
146
+ return result.join(',');
147
+ }
148
+ return value;
149
+ }
150
+ return value;
151
+ };
152
+ var footer = [/*#__PURE__*/React.createElement(Button, {
153
+ key: "cancel",
154
+ size: "large",
155
+ onClick: close
156
+ }, "\u786E\u5B9A")];
157
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Component, _extends({
158
+ width: other.width || 600,
159
+ footer: footer,
160
+ title: "".concat(title || '', "\u8BE6\u60C5")
161
+ }, other, {
162
+ open: open,
163
+ onClose: close,
164
+ className: "detailContainer"
165
+ }), /*#__PURE__*/React.createElement(Descriptions, _extends({
166
+ column: 2,
167
+ bordered: true
168
+ }, descProps || {}), columns === null || columns === void 0 ? void 0 : columns.filter(function (item) {
169
+ return !item.hideInDetail;
170
+ }).map(function (item, index) {
171
+ var _item$fieldProps;
172
+ return /*#__PURE__*/React.createElement(React.Fragment, {
173
+ key: item.dataIndex
174
+ }, /*#__PURE__*/React.createElement(Descriptions.Item, _extends({
175
+ key: item.dataIndex,
176
+ label: "".concat(item.title)
177
+ }, ((_item$fieldProps = item.fieldProps) === null || _item$fieldProps === void 0 ? void 0 : _item$fieldProps.descriptionsItemProps) || {}), handleDetailValue(item, detail[item.dataIndex], index)));
178
+ }))), /*#__PURE__*/React.createElement(Spin, {
179
+ spinning: loading,
180
+ fullscreen: true
181
+ }));
182
+ });
183
+ export default CustomModal;
@@ -0,0 +1,6 @@
1
+ .detailContainer{
2
+ .ant-drawer-footer{
3
+ display: flex;
4
+ gap: 16px;
5
+ }
6
+ }
@@ -0,0 +1,78 @@
1
+ /*
2
+ * @Author: 郭郭
3
+ * @Date: 2025/11/5
4
+ * @Description:
5
+ */
6
+
7
+ import { CustomColumnProps } from '../compontent';
8
+
9
+ /**
10
+ * form props
11
+ */
12
+ interface CustomFormModalProps {
13
+ /**
14
+ * 标题
15
+ */
16
+ title?: string | undefined;
17
+
18
+ /**
19
+ * 弹窗类型
20
+ */
21
+ type?: 'modal' | 'drawer' | 'detail';
22
+
23
+ /**
24
+ * 提交成功后事件
25
+ * @param data
26
+ */
27
+ onSubmit?: (data?: { [key: string]: any } | boolean) => void;
28
+
29
+ /**
30
+ * 宽度
31
+ */
32
+ width?: number | string;
33
+
34
+ /**
35
+ * 表单字段
36
+ */
37
+ columns?: CustomColumnProps[];
38
+
39
+ /**
40
+ * form列表
41
+ */
42
+ formList?: {
43
+ [key: string]: any;
44
+ };
45
+
46
+ /**
47
+ * 表单默认值
48
+ */
49
+ values?: { [key: string]: any };
50
+
51
+ /**
52
+ * 处理form数据
53
+ */
54
+ handleData?: (data: any) => any;
55
+
56
+ /**
57
+ * 保存
58
+ * @param data
59
+ */
60
+ saveRequest?: (data: any) => any;
61
+
62
+ /**
63
+ * 修改
64
+ * @param data
65
+ */
66
+ updateRequest?: (data: any) => any;
67
+
68
+ /**
69
+ * 详情
70
+ * @param data
71
+ */
72
+ detailRequest?: (data: any) => any;
73
+
74
+ /**
75
+ * 其它参数
76
+ */
77
+ [key: string]: any;
78
+ }
@@ -0,0 +1,5 @@
1
+ import { CustomFormModalProps } from "./formModal";
2
+ import React from 'react';
3
+ import './index.less';
4
+ declare const CustomFormModal: React.ForwardRefExoticComponent<Omit<CustomFormModalProps, "ref"> & React.RefAttributes<any>>;
5
+ export default CustomFormModal;