@ccs-ui/rc-pro 1.2.1-beta-4 → 2.0.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.
- package/es/auth/auth-button.d.ts +3 -1
- package/es/auth/auth-button.js +40 -5
- package/es/auth/index.d.ts +2 -1
- package/es/ccs.d.ts +27 -66
- package/es/color-picker/index.d.ts +2 -4
- package/es/config.d.ts +5 -3
- package/es/config.js +98 -9
- package/es/context/index.d.ts +13 -9
- package/es/context/index.js +2 -2
- package/es/dialog/DialogRequestButton.d.ts +1 -1
- package/es/dialog/DialogSelfOkButton.d.ts +1 -1
- package/es/dialog/button.d.ts +3 -3
- package/es/dialog/drawer-footer.d.ts +2 -3
- package/es/dialog/hook.d.ts +4 -0
- package/es/dialog/hook.js +13 -7
- package/es/editor/index.d.ts +2 -4
- package/es/hooks/use-app.d.ts +6 -0
- package/es/hooks/use-app.js +15 -0
- package/es/index.d.ts +2 -3
- package/es/index.js +2 -3
- package/es/layout-keep-alive/index.d.ts +1 -1
- package/es/layout-keep-alive/index.js +14 -18
- package/es/layout-keep-alive/page.d.ts +1 -0
- package/es/layout-single-page/index.d.ts +1 -1
- package/es/layout-single-page/index.js +7 -23
- package/es/pro-grid/index.d.ts +4 -9
- package/es/pro-table/head.d.ts +2 -2
- package/es/pro-table/index.less +0 -27
- package/es/pro-table/table.d.ts +8 -16
- package/es/pro-table/table.js +6 -33
- package/es/result/index.js +3 -1
- package/es/trigger/index.d.ts +2 -8
- package/es/upload/index.d.ts +4 -3
- package/es/upload/index.js +48 -10
- package/es/upload/upload-image.d.ts +1 -1
- package/es/upload/upload-image.js +50 -16
- package/es/virtual-list/index.d.ts +3 -4
- package/es/water-mark/index.d.ts +3 -10
- package/package.json +5 -6
- package/es/hooks/use-global.d.ts +0 -4
- package/es/hooks/use-global.js +0 -10
- package/es/pro-table/search.d.ts +0 -17
- package/es/pro-table/search.js +0 -312
- package/es/theme.d.ts +0 -12
- package/es/theme.js +0 -66
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["
|
|
2
|
+
var _excluded = ["uploadText", "maxCount", "maxFileSize", "crop", "uploadRequest", "onChange"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -17,7 +17,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
17
17
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
18
18
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
19
19
|
import { PlusOutlined } from '@ant-design/icons';
|
|
20
|
-
import {
|
|
20
|
+
import { message, Upload } from 'antd';
|
|
21
21
|
import ImgCrop from 'antd-img-crop';
|
|
22
22
|
import { useState } from 'react';
|
|
23
23
|
import CcsDialog from "../dialog";
|
|
@@ -37,13 +37,13 @@ var getBase64 = function getBase64(file) {
|
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
export function ImageUpload(_ref) {
|
|
40
|
-
var
|
|
41
|
-
tokenKey = _ref.tokenKey,
|
|
42
|
-
uploadText = _ref.uploadText,
|
|
40
|
+
var uploadText = _ref.uploadText,
|
|
43
41
|
_ref$maxCount = _ref.maxCount,
|
|
44
42
|
maxCount = _ref$maxCount === void 0 ? 1 : _ref$maxCount,
|
|
45
43
|
_ref$maxFileSize = _ref.maxFileSize,
|
|
46
44
|
maxFileSize = _ref$maxFileSize === void 0 ? 10 : _ref$maxFileSize,
|
|
45
|
+
crop = _ref.crop,
|
|
46
|
+
uploadRequest = _ref.uploadRequest,
|
|
47
47
|
onChange = _ref.onChange,
|
|
48
48
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
49
49
|
var _useState = useState([]),
|
|
@@ -51,14 +51,19 @@ export function ImageUpload(_ref) {
|
|
|
51
51
|
files = _useState2[0],
|
|
52
52
|
setFiles = _useState2[1];
|
|
53
53
|
var _CcsDialog$useDialog = CcsDialog.useDialog(),
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
contextHolder = _CcsDialog$useDialog.contextHolder,
|
|
55
|
+
openModal = _CcsDialog$useDialog.openModal;
|
|
56
56
|
var handleOnChange = function handleOnChange(_ref2) {
|
|
57
57
|
var fileList = _ref2.fileList;
|
|
58
58
|
setFiles(fileList.filter(function (f) {
|
|
59
59
|
return f.status;
|
|
60
60
|
}));
|
|
61
61
|
if (!onChange) return;
|
|
62
|
+
|
|
63
|
+
// 文件上传中,不更新结果
|
|
64
|
+
if (fileList.find(function (f) {
|
|
65
|
+
return f.status === 'uploading';
|
|
66
|
+
})) return;
|
|
62
67
|
if (maxCount === 1) {
|
|
63
68
|
var _fileList$;
|
|
64
69
|
// 只能上传一个文件
|
|
@@ -117,13 +122,42 @@ export function ImageUpload(_ref) {
|
|
|
117
122
|
return _ref3.apply(this, arguments);
|
|
118
123
|
};
|
|
119
124
|
}();
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
var onCustomRequest = /*#__PURE__*/function () {
|
|
126
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref4) {
|
|
127
|
+
var file, onSuccess, onError, result;
|
|
128
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
129
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
130
|
+
case 0:
|
|
131
|
+
file = _ref4.file, onSuccess = _ref4.onSuccess, onError = _ref4.onError;
|
|
132
|
+
_context2.next = 3;
|
|
133
|
+
return uploadRequest(file);
|
|
134
|
+
case 3:
|
|
135
|
+
result = _context2.sent;
|
|
136
|
+
// 上传成功
|
|
137
|
+
if (result.success && onSuccess) {
|
|
138
|
+
onSuccess(result);
|
|
139
|
+
}
|
|
140
|
+
// 上传失败
|
|
141
|
+
if (!result.success && onError) {
|
|
142
|
+
onError({
|
|
143
|
+
status: 500,
|
|
144
|
+
name: '出错了',
|
|
145
|
+
message: result.msg || '上传失败'
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
case 6:
|
|
149
|
+
case "end":
|
|
150
|
+
return _context2.stop();
|
|
151
|
+
}
|
|
152
|
+
}, _callee2);
|
|
153
|
+
}));
|
|
154
|
+
return function onCustomRequest(_x2) {
|
|
155
|
+
return _ref5.apply(this, arguments);
|
|
156
|
+
};
|
|
157
|
+
}();
|
|
158
|
+
var renderUpload = /*#__PURE__*/_jsx(Upload, _objectSpread(_objectSpread({
|
|
159
|
+
customRequest: onCustomRequest,
|
|
160
|
+
name: "fileName",
|
|
127
161
|
onChange: handleOnChange,
|
|
128
162
|
beforeUpload: beforeUpload,
|
|
129
163
|
fileList: files,
|
|
@@ -141,10 +175,10 @@ export function ImageUpload(_ref) {
|
|
|
141
175
|
})
|
|
142
176
|
}));
|
|
143
177
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
144
|
-
children: [crop ? /*#__PURE__*/_jsx(ImgCrop, {
|
|
178
|
+
children: [contextHolder, crop ? /*#__PURE__*/_jsx(ImgCrop, {
|
|
145
179
|
minZoom: 0.5,
|
|
146
180
|
rotationSlider: true,
|
|
147
181
|
children: renderUpload
|
|
148
|
-
}) : renderUpload
|
|
182
|
+
}) : renderUpload]
|
|
149
183
|
});
|
|
150
184
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
import { PropsWithCss } from '../ccs';
|
|
2
3
|
type Position = {
|
|
3
4
|
left: number;
|
|
4
5
|
top: number;
|
|
@@ -10,7 +11,7 @@ export type RowRendererProps = {
|
|
|
10
11
|
export type VirtualInstance = {
|
|
11
12
|
scrollTop: (top: number) => void;
|
|
12
13
|
};
|
|
13
|
-
export type VirtualListProps = {
|
|
14
|
+
export type VirtualListProps = PropsWithCss & {
|
|
14
15
|
/** 容器高度 */
|
|
15
16
|
height?: number;
|
|
16
17
|
/** 记录条数 */
|
|
@@ -28,8 +29,6 @@ export type VirtualListProps = {
|
|
|
28
29
|
rowCountChangeScrollTop?: boolean;
|
|
29
30
|
/** instance */
|
|
30
31
|
virtualRef?: RefObject<VirtualInstance>;
|
|
31
|
-
style?: CSSProperties;
|
|
32
|
-
className?: string;
|
|
33
32
|
/** 渲染row */
|
|
34
33
|
rowRenderer: ({ rowHeight, index }: RowRendererProps) => ReactNode;
|
|
35
34
|
/** scroll event */
|
package/es/water-mark/index.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import React
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PropsWithCss, PropsWithNodeChildren } from '../ccs';
|
|
3
|
+
export type WaterMarkProps = PropsWithNodeChildren & PropsWithCss & {
|
|
3
4
|
/** 水印文字内容 */
|
|
4
5
|
content?: string;
|
|
5
|
-
/** 类名 */
|
|
6
|
-
className?: string;
|
|
7
|
-
/** 样式 */
|
|
8
|
-
style?: React.CSSProperties;
|
|
9
6
|
/** 水印样式 */
|
|
10
7
|
markStyle?: React.CSSProperties;
|
|
11
8
|
/** 水印类名 */
|
|
@@ -55,10 +52,6 @@ export type WaterMarkProps = {
|
|
|
55
52
|
* @default 16
|
|
56
53
|
*/
|
|
57
54
|
fontSize?: number | string;
|
|
58
|
-
/**
|
|
59
|
-
* 组件 children
|
|
60
|
-
*/
|
|
61
|
-
children?: ReactNode;
|
|
62
55
|
};
|
|
63
56
|
/**
|
|
64
57
|
* 水印组件
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ccs-ui/rc-pro",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
|
-
"name": "Hong"
|
|
8
|
-
"url": "https://xz7.gitee.io/rc-pro"
|
|
7
|
+
"name": "Hong"
|
|
9
8
|
},
|
|
10
9
|
"module": "es/index.js",
|
|
11
10
|
"types": "es/index.d.ts",
|
|
@@ -93,7 +92,7 @@
|
|
|
93
92
|
"@types/shortid": "^0.0.29",
|
|
94
93
|
"@umijs/lint": "^4.0.0",
|
|
95
94
|
"ahooks": "^3.7.7",
|
|
96
|
-
"antd": "^5.
|
|
95
|
+
"antd": "^5.22.7",
|
|
97
96
|
"classnames": "^2.3.2",
|
|
98
97
|
"cross-env": "^7.0.3",
|
|
99
98
|
"dayjs": "^1.11.7",
|
|
@@ -120,7 +119,7 @@
|
|
|
120
119
|
"@ant-design/icons": "^5.1.4",
|
|
121
120
|
"@ccs-ui/utils": "^0.0.2",
|
|
122
121
|
"ahooks": "^3.7.7",
|
|
123
|
-
"antd": "^5.
|
|
122
|
+
"antd": "^5.22.0",
|
|
124
123
|
"classnames": "^2.3.2",
|
|
125
124
|
"dayjs": "^1.11.7",
|
|
126
125
|
"rc-menu": "^9.15.1",
|
package/es/hooks/use-global.d.ts
DELETED
package/es/hooks/use-global.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { GlobalContext } from "../context";
|
|
3
|
-
var useGlobal = function useGlobal() {
|
|
4
|
-
var context = useContext(GlobalContext);
|
|
5
|
-
if (context === undefined) {
|
|
6
|
-
throw new Error('GlobalContext not found');
|
|
7
|
-
}
|
|
8
|
-
return context;
|
|
9
|
-
};
|
|
10
|
-
export default useGlobal;
|
package/es/pro-table/search.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FormInstance } from 'antd/lib/form';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
3
|
-
import { CcsProTableProps } from './table';
|
|
4
|
-
type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formInitValues' | 'expandForm' | 'formItemLabelWidth' | 'formItemLayout' | 'formItemCol' | 'title'> & {
|
|
5
|
-
/** 更多查询条件 */
|
|
6
|
-
hasMore?: boolean;
|
|
7
|
-
/** 标题边框 */
|
|
8
|
-
titleBordered?: boolean;
|
|
9
|
-
form: FormInstance<any>;
|
|
10
|
-
children?: ReactElement;
|
|
11
|
-
/** table 操作栏 */
|
|
12
|
-
tableOperation: ReactElement;
|
|
13
|
-
onSearch: () => void;
|
|
14
|
-
};
|
|
15
|
-
/** 操作按钮、查询,重置、列筛选、 */
|
|
16
|
-
declare function SearchComponent<T>(props: PropsType<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export default SearchComponent;
|
package/es/pro-table/search.js
DELETED
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import { MoreOutlined, UpOutlined } from '@ant-design/icons';
|
|
14
|
-
import { Button, Card, Col, Form, Row } from 'antd';
|
|
15
|
-
import React, { cloneElement, useMemo, useRef, useState } from 'react';
|
|
16
|
-
import { getShowDpends } from "./_utils";
|
|
17
|
-
import { classPrefix } from "./table";
|
|
18
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
21
|
-
import { createElement as _createElement } from "react";
|
|
22
|
-
var DefaultItemCol = {
|
|
23
|
-
xs: 24,
|
|
24
|
-
sm: 12,
|
|
25
|
-
md: 8,
|
|
26
|
-
lg: 8,
|
|
27
|
-
xl: 6
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/** 操作按钮、查询,重置、列筛选、 */
|
|
31
|
-
function SearchComponent(props) {
|
|
32
|
-
var form = props.form,
|
|
33
|
-
title = props.title,
|
|
34
|
-
toolbar = props.toolbar,
|
|
35
|
-
children = props.children,
|
|
36
|
-
expandForm = props.expandForm,
|
|
37
|
-
titleBordered = props.titleBordered,
|
|
38
|
-
_props$formItems = props.formItems,
|
|
39
|
-
formItems = _props$formItems === void 0 ? [] : _props$formItems,
|
|
40
|
-
formInitValues = props.formInitValues,
|
|
41
|
-
_props$formItemLayout = props.formItemLayout,
|
|
42
|
-
formItemLayout = _props$formItemLayout === void 0 ? 'horizontal' : _props$formItemLayout,
|
|
43
|
-
_props$formItemCol = props.formItemCol,
|
|
44
|
-
formItemCol = _props$formItemCol === void 0 ? DefaultItemCol : _props$formItemCol,
|
|
45
|
-
formItemLabelWidth = props.formItemLabelWidth,
|
|
46
|
-
tableOperation = props.tableOperation,
|
|
47
|
-
onSearch = props.onSearch;
|
|
48
|
-
var _useState = useState(expandForm),
|
|
49
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
-
isShowMore = _useState2[0],
|
|
51
|
-
setIsShowMore = _useState2[1];
|
|
52
|
-
var operationRef = useRef(null);
|
|
53
|
-
var cardRef = useRef(null);
|
|
54
|
-
var onHasMore = function onHasMore() {
|
|
55
|
-
var hasMain = formItems.filter(function (f) {
|
|
56
|
-
return f.isMain;
|
|
57
|
-
});
|
|
58
|
-
// 所有都是主条件,tradition模式不显示more
|
|
59
|
-
if (hasMain.length === formItems.length) {
|
|
60
|
-
// 收起已展开
|
|
61
|
-
if (isShowMore === true) {
|
|
62
|
-
setIsShowMore(false);
|
|
63
|
-
}
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// 条件数大于1,有更多
|
|
68
|
-
return formItems.length > 1;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// 处理form item 依赖
|
|
72
|
-
var allFormItems = useMemo(function () {
|
|
73
|
-
formItems.forEach(function (item) {
|
|
74
|
-
var depend = item.showDepends || [];
|
|
75
|
-
if (depend && depend.length > 0) {
|
|
76
|
-
getShowDpends(formItems, item, depend);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
return formItems;
|
|
80
|
-
}, [formItems]);
|
|
81
|
-
|
|
82
|
-
// 操作按钮
|
|
83
|
-
var renderOperation = /*#__PURE__*/_jsxs("div", {
|
|
84
|
-
className: "".concat(classPrefix, "-header-buttons"),
|
|
85
|
-
ref: operationRef,
|
|
86
|
-
children: [/*#__PURE__*/_jsx(Button, {
|
|
87
|
-
type: "primary",
|
|
88
|
-
onClick: function onClick() {
|
|
89
|
-
return form.submit();
|
|
90
|
-
},
|
|
91
|
-
style: {
|
|
92
|
-
marginRight: 4
|
|
93
|
-
},
|
|
94
|
-
children: "\u67E5\u8BE2"
|
|
95
|
-
}), onHasMore() && !expandForm && /*#__PURE__*/_jsx(Button, {
|
|
96
|
-
onClick: function onClick() {
|
|
97
|
-
setIsShowMore(!isShowMore);
|
|
98
|
-
},
|
|
99
|
-
icon: isShowMore ? /*#__PURE__*/_jsx(UpOutlined, {
|
|
100
|
-
className: "".concat(classPrefix, "-icon")
|
|
101
|
-
}) : /*#__PURE__*/_jsx(MoreOutlined, {
|
|
102
|
-
className: "".concat(classPrefix, "-icon")
|
|
103
|
-
}),
|
|
104
|
-
type: "text",
|
|
105
|
-
style: {
|
|
106
|
-
width: 24
|
|
107
|
-
}
|
|
108
|
-
}), tableOperation]
|
|
109
|
-
});
|
|
110
|
-
var renderLabel = function renderLabel(label) {
|
|
111
|
-
if (formItemLabelWidth) {
|
|
112
|
-
return /*#__PURE__*/_jsx("div", {
|
|
113
|
-
style: {
|
|
114
|
-
width: formItemLabelWidth
|
|
115
|
-
},
|
|
116
|
-
children: label
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
return label;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// 主查询条件
|
|
123
|
-
var renderFormItem = function renderFormItem(items) {
|
|
124
|
-
if (!items) return [];
|
|
125
|
-
return items.map(function (item) {
|
|
126
|
-
return item.depends || item.showDepends ? /*#__PURE__*/_jsx(Form.Item, {
|
|
127
|
-
noStyle: true,
|
|
128
|
-
shouldUpdate: function shouldUpdate(l, n) {
|
|
129
|
-
var _item$depends, _item$showDepends;
|
|
130
|
-
return ((_item$depends = item.depends) === null || _item$depends === void 0 ? void 0 : _item$depends.some(function (i) {
|
|
131
|
-
return l[i] !== n[i];
|
|
132
|
-
})) || ((_item$showDepends = item.showDepends) === null || _item$showDepends === void 0 ? void 0 : _item$showDepends.some(function (i) {
|
|
133
|
-
return l[i.name] !== n[i.name];
|
|
134
|
-
})) || false;
|
|
135
|
-
},
|
|
136
|
-
children: function children(_ref) {
|
|
137
|
-
var _item$depends2;
|
|
138
|
-
var getFieldValue = _ref.getFieldValue;
|
|
139
|
-
var dependParam = {};
|
|
140
|
-
(_item$depends2 = item.depends) === null || _item$depends2 === void 0 || _item$depends2.forEach(function (i) {
|
|
141
|
-
var value = getFieldValue(i);
|
|
142
|
-
dependParam[i] = value;
|
|
143
|
-
});
|
|
144
|
-
var isShow = true;
|
|
145
|
-
if (item.showDepends && item.showDepends.length > 0) {
|
|
146
|
-
var _item$showDepends2;
|
|
147
|
-
isShow = (_item$showDepends2 = item.showDepends) === null || _item$showDepends2 === void 0 ? void 0 : _item$showDepends2.every(function (i) {
|
|
148
|
-
return getFieldValue(i.name) === i.value;
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
return isShow ? /*#__PURE__*/_jsx(Form.Item, {
|
|
152
|
-
name: "".concat(item.name),
|
|
153
|
-
label: item.label,
|
|
154
|
-
rules: item.rules,
|
|
155
|
-
children: /*#__PURE__*/cloneElement(item.value, dependParam)
|
|
156
|
-
}, item.name) : null;
|
|
157
|
-
}
|
|
158
|
-
}, item.name) : /*#__PURE__*/_jsx(Form.Item, {
|
|
159
|
-
name: item.name,
|
|
160
|
-
label: item.label,
|
|
161
|
-
rules: item.rules,
|
|
162
|
-
children: item.value
|
|
163
|
-
}, item.name);
|
|
164
|
-
});
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
// 查询部分
|
|
168
|
-
var renderSearch = function renderSearch() {
|
|
169
|
-
if (!formItems.length) return /*#__PURE__*/_jsx(Form.Item, {});
|
|
170
|
-
// 主条件
|
|
171
|
-
var mainItems = allFormItems.filter(function (f) {
|
|
172
|
-
return f.isMain;
|
|
173
|
-
});
|
|
174
|
-
var initFormItems = mainItems.length > 0 ? mainItems : [allFormItems[0]];
|
|
175
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
176
|
-
children: !isShowMore && !expandForm && renderFormItem(initFormItems)
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
var renderMoreForm = function renderMoreForm() {
|
|
180
|
-
// 需要使用row布局
|
|
181
|
-
var hasRow = formItemLayout !== 'inline';
|
|
182
|
-
var isArray = Array.isArray(formItemCol);
|
|
183
|
-
var renderItems = allFormItems.map(function (item, index) {
|
|
184
|
-
var colSpan = isArray ? formItemCol[index] || DefaultItemCol : formItemCol;
|
|
185
|
-
if (item.depends || item.showDepends) {
|
|
186
|
-
return /*#__PURE__*/_jsx(Form.Item, {
|
|
187
|
-
noStyle: true,
|
|
188
|
-
shouldUpdate: function shouldUpdate(l, n) {
|
|
189
|
-
var _item$depends3, _item$showDepends3;
|
|
190
|
-
return ((_item$depends3 = item.depends) === null || _item$depends3 === void 0 ? void 0 : _item$depends3.some(function (i) {
|
|
191
|
-
return l[i] !== n[i];
|
|
192
|
-
})) || ((_item$showDepends3 = item.showDepends) === null || _item$showDepends3 === void 0 ? void 0 : _item$showDepends3.some(function (i) {
|
|
193
|
-
return l[i.name] !== n[i.name];
|
|
194
|
-
})) || false;
|
|
195
|
-
},
|
|
196
|
-
children: function children(_ref2) {
|
|
197
|
-
var _item$depends4;
|
|
198
|
-
var getFieldValue = _ref2.getFieldValue;
|
|
199
|
-
var dependParam = {};
|
|
200
|
-
(_item$depends4 = item.depends) === null || _item$depends4 === void 0 || _item$depends4.forEach(function (i) {
|
|
201
|
-
var value = getFieldValue(i);
|
|
202
|
-
dependParam[i] = value;
|
|
203
|
-
});
|
|
204
|
-
var isShow = true;
|
|
205
|
-
if (item.showDepends && item.showDepends.length > 0) {
|
|
206
|
-
var _item$showDepends4;
|
|
207
|
-
isShow = (_item$showDepends4 = item.showDepends) === null || _item$showDepends4 === void 0 ? void 0 : _item$showDepends4.every(function (i) {
|
|
208
|
-
return getFieldValue(i.name) === i.value;
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
var itemContent = /*#__PURE__*/_jsx(Form.Item, {
|
|
212
|
-
className: "".concat(classPrefix, "-form-label"),
|
|
213
|
-
label: renderLabel(item.label),
|
|
214
|
-
name: item.name,
|
|
215
|
-
rules: item.rules,
|
|
216
|
-
children: /*#__PURE__*/cloneElement(item.value, dependParam)
|
|
217
|
-
});
|
|
218
|
-
if (!isShow) return null;
|
|
219
|
-
return hasRow ? /*#__PURE__*/_jsx(Col, _objectSpread(_objectSpread({}, colSpan), {}, {
|
|
220
|
-
children: itemContent
|
|
221
|
-
})) : itemContent;
|
|
222
|
-
}
|
|
223
|
-
}, item.name);
|
|
224
|
-
}
|
|
225
|
-
var itemContent = /*#__PURE__*/_jsx(Form.Item, {
|
|
226
|
-
className: "".concat(classPrefix, "-form-label"),
|
|
227
|
-
rules: item.rules,
|
|
228
|
-
label: renderLabel(item.label),
|
|
229
|
-
name: item.name,
|
|
230
|
-
children: item.value
|
|
231
|
-
});
|
|
232
|
-
if (hasRow) {
|
|
233
|
-
return /*#__PURE__*/_createElement(Col, _objectSpread(_objectSpread({}, colSpan), {}, {
|
|
234
|
-
key: item.name
|
|
235
|
-
}), itemContent);
|
|
236
|
-
}
|
|
237
|
-
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
238
|
-
children: itemContent
|
|
239
|
-
}, item.name);
|
|
240
|
-
});
|
|
241
|
-
var style = {
|
|
242
|
-
overflow: 'hidden'
|
|
243
|
-
};
|
|
244
|
-
if (isShowMore || expandForm) {
|
|
245
|
-
style.marginBottom = 16;
|
|
246
|
-
} else {
|
|
247
|
-
style.maxHeight = 0;
|
|
248
|
-
style.marginBottom = 0;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// 非row布局
|
|
252
|
-
if (!hasRow) {
|
|
253
|
-
style = _objectSpread(_objectSpread({}, style), {}, {
|
|
254
|
-
width: '100%',
|
|
255
|
-
display: 'flex',
|
|
256
|
-
gap: 10,
|
|
257
|
-
flexWrap: 'wrap'
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
return /*#__PURE__*/_jsx("div", {
|
|
261
|
-
style: style,
|
|
262
|
-
children: hasRow ? /*#__PURE__*/_jsx(Row, {
|
|
263
|
-
gutter: [10, 10],
|
|
264
|
-
style: {
|
|
265
|
-
width: '100%'
|
|
266
|
-
},
|
|
267
|
-
children: renderItems
|
|
268
|
-
}) : renderItems
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
// table是否有边框
|
|
273
|
-
var hasBorder = titleBordered === true;
|
|
274
|
-
// 查询条件已展开
|
|
275
|
-
var isExpand = onHasMore() || expandForm;
|
|
276
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
277
|
-
children: [/*#__PURE__*/_jsx(Card, {
|
|
278
|
-
style: _objectSpread({
|
|
279
|
-
borderRadius: 0,
|
|
280
|
-
boxShadow: 'none'
|
|
281
|
-
}, hasBorder ? {
|
|
282
|
-
borderBottom: 0
|
|
283
|
-
} : {}),
|
|
284
|
-
styles: {
|
|
285
|
-
body: {
|
|
286
|
-
padding: 16
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
bordered: hasBorder,
|
|
290
|
-
title: title,
|
|
291
|
-
ref: cardRef,
|
|
292
|
-
children: /*#__PURE__*/_jsxs(Form, {
|
|
293
|
-
initialValues: formInitValues,
|
|
294
|
-
form: form,
|
|
295
|
-
onFinish: onSearch,
|
|
296
|
-
layout: isExpand ? formItemLayout : 'inline',
|
|
297
|
-
labelWrap: isExpand,
|
|
298
|
-
children: [isExpand && renderMoreForm(), /*#__PURE__*/_jsxs("div", {
|
|
299
|
-
className: "".concat(classPrefix, "-header"),
|
|
300
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
301
|
-
className: "".concat(classPrefix, "-toolbar"),
|
|
302
|
-
children: toolbar
|
|
303
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
304
|
-
className: "".concat(classPrefix, "-form ").concat(props.formItemLayout),
|
|
305
|
-
children: [renderSearch(), renderOperation]
|
|
306
|
-
})]
|
|
307
|
-
})]
|
|
308
|
-
})
|
|
309
|
-
}), children]
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
export default SearchComponent;
|
package/es/theme.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ThemeConfig } from 'antd';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
3
|
-
import { GlobalConfig } from './ccs';
|
|
4
|
-
/** 主题设置 */
|
|
5
|
-
type AppThemeProps = {
|
|
6
|
-
theme: GlobalConfig['AppTheme'];
|
|
7
|
-
themeConfig?: ThemeConfig;
|
|
8
|
-
children: ReactElement;
|
|
9
|
-
};
|
|
10
|
-
/** 主题设置 */
|
|
11
|
-
export default function AppTheme({ theme, themeConfig, children, }: AppThemeProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
package/es/theme.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import { darkTheme, defaultTheme } from '@ant-design/compatible';
|
|
14
|
-
import { App, ConfigProvider, Modal, message, notification } from 'antd';
|
|
15
|
-
import zhCN from 'antd/locale/zh_CN';
|
|
16
|
-
import { useState } from 'react';
|
|
17
|
-
import ThemeDialog from "./theme-dialog";
|
|
18
|
-
|
|
19
|
-
/** 主题设置 */
|
|
20
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
-
/** 主题设置 */
|
|
23
|
-
export default function AppTheme(_ref) {
|
|
24
|
-
var theme = _ref.theme,
|
|
25
|
-
themeConfig = _ref.themeConfig,
|
|
26
|
-
children = _ref.children;
|
|
27
|
-
var _message$useMessage = message.useMessage(),
|
|
28
|
-
_message$useMessage2 = _slicedToArray(_message$useMessage, 2),
|
|
29
|
-
messageApi = _message$useMessage2[0],
|
|
30
|
-
contextMsgHolder = _message$useMessage2[1];
|
|
31
|
-
var _notification$useNoti = notification.useNotification(),
|
|
32
|
-
_notification$useNoti2 = _slicedToArray(_notification$useNoti, 2),
|
|
33
|
-
noticeApi = _notification$useNoti2[0],
|
|
34
|
-
contextNotifHolder = _notification$useNoti2[1];
|
|
35
|
-
var _Modal$useModal = Modal.useModal(),
|
|
36
|
-
_Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
|
|
37
|
-
modalApi = _Modal$useModal2[0],
|
|
38
|
-
contextModalHolder = _Modal$useModal2[1];
|
|
39
|
-
useState(function () {
|
|
40
|
-
ThemeDialog.setConfig(messageApi, noticeApi, modalApi);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// 主题
|
|
44
|
-
var appTheme = theme === 'dark' ? darkTheme : defaultTheme;
|
|
45
|
-
|
|
46
|
-
// 合并token
|
|
47
|
-
var token = _objectSpread(_objectSpread(_objectSpread({}, appTheme.token), themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.token), {}, {
|
|
48
|
-
_appTheme: theme
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// 暗黑模式背景色
|
|
52
|
-
if (theme === 'dark') token.colorBgContainer = 'rgb(36, 37, 37)';
|
|
53
|
-
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
54
|
-
locale: zhCN,
|
|
55
|
-
theme: _objectSpread(_objectSpread({}, appTheme), {}, {
|
|
56
|
-
token: token,
|
|
57
|
-
components: _objectSpread(_objectSpread({}, appTheme.components), themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.components)
|
|
58
|
-
}),
|
|
59
|
-
children: /*#__PURE__*/_jsxs(App, {
|
|
60
|
-
style: {
|
|
61
|
-
height: '100%'
|
|
62
|
-
},
|
|
63
|
-
children: [children, contextMsgHolder, contextNotifHolder, contextModalHolder]
|
|
64
|
-
})
|
|
65
|
-
});
|
|
66
|
-
}
|