@ccs-ui/rc-pro 2.3.6-alpha-10 → 2.3.6-alpha-12
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/cascader/index.js +4 -4
- package/es/ccs.d.ts +4 -9
- package/es/dialog/button.d.ts +1 -1
- package/es/dialog/button.js +3 -3
- package/es/ellipsis/useResizeEffect.js +10 -24
- package/es/group-form-item/index.js +3 -3
- package/es/hooks/use-selection.js +1 -1
- package/es/pro-table/form-item.d.ts +4 -2
- package/es/pro-table/form-item.js +3 -2
- package/es/pro-table/head.js +80 -61
- package/es/pro-table/index.less +14 -4
- package/es/pro-table/table.js +3 -3
- package/es/pro-table/tree.js +2 -2
- package/es/select/index.d.ts +2 -1
- package/es/select/index.js +9 -9
- package/es/table/index.js +0 -3
- package/package.json +1 -1
package/es/cascader/index.js
CHANGED
|
@@ -19,7 +19,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
19
19
|
import { useRequest } from 'ahooks';
|
|
20
20
|
import { Cascader } from 'antd';
|
|
21
21
|
import { useEffect } from 'react';
|
|
22
|
-
import {
|
|
22
|
+
import { getDataByNamePath } from "../select";
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
24
|
function onIsArray(data) {
|
|
25
25
|
if (Array.isArray(data)) return data;
|
|
@@ -67,9 +67,9 @@ function ApiCascader(_ref) {
|
|
|
67
67
|
break;
|
|
68
68
|
}
|
|
69
69
|
result.forEach(function (r) {
|
|
70
|
-
r.label =
|
|
71
|
-
r.value =
|
|
72
|
-
r.children =
|
|
70
|
+
r.label = getDataByNamePath(r, labelField);
|
|
71
|
+
r.value = getDataByNamePath(r, valueField);
|
|
72
|
+
r.children = getDataByNamePath(r, childrenField);
|
|
73
73
|
});
|
|
74
74
|
return _context.abrupt("break", 15);
|
|
75
75
|
case 9:
|
package/es/ccs.d.ts
CHANGED
|
@@ -94,11 +94,11 @@ type ShowDependType = {
|
|
|
94
94
|
name: string;
|
|
95
95
|
value: any;
|
|
96
96
|
};
|
|
97
|
-
type
|
|
97
|
+
export type TableFormItem = {
|
|
98
98
|
/** label 标题 */
|
|
99
99
|
label?: string;
|
|
100
100
|
/** form name */
|
|
101
|
-
name?:
|
|
101
|
+
name?: NamePath;
|
|
102
102
|
/** form item element */
|
|
103
103
|
value: ReactElement;
|
|
104
104
|
/** 数据依赖、依赖项对应的name数组 */
|
|
@@ -109,14 +109,9 @@ type FormItemType = {
|
|
|
109
109
|
rules?: Rule[];
|
|
110
110
|
/** 在发起请求时调用方法,格式化值 */
|
|
111
111
|
onFormat?: (e: any) => any;
|
|
112
|
-
/**
|
|
113
|
-
|
|
112
|
+
/** 分组表单项,将解构name,生成独立的字段值,如时间范围选择,将数组结果解构成独立的字段值 */
|
|
113
|
+
isGroupItem?: boolean;
|
|
114
114
|
};
|
|
115
|
-
export type TableFormItem = ({
|
|
116
|
-
name: string;
|
|
117
|
-
} & Partial<FormItemType>) | ({
|
|
118
|
-
groupItemNames: NamePath[];
|
|
119
|
-
} & Partial<FormItemType>);
|
|
120
115
|
type TableFormItems = TableFormItem[];
|
|
121
116
|
type TableInstanceRef<T = any> = MutableRefObject<TableInstance<T> | undefined> | React.RefObject<TableInstance<T>>;
|
|
122
117
|
type TableColumns<RecordType = any> = TableColumn<RecordType>[];
|
package/es/dialog/button.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type DialogButtonsProps<T> = Pick<CcsDialogModalProps, 'okText' | 'onClos
|
|
|
16
16
|
export type DialogButtonRef = {
|
|
17
17
|
onSetButtons: (e: React.ReactElement) => void;
|
|
18
18
|
};
|
|
19
|
-
export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "
|
|
19
|
+
export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "request" | "onClose" | "onOk" | "auth" | "extraBtn" | "requestFieldNames" | "preventRequestHandle"> & {
|
|
20
20
|
formRef: React.RefObject<DialogFormRef<TParams>>;
|
|
21
21
|
formInitialValues: FormProps['initialValues'];
|
|
22
22
|
buttonRef: RefObject<DialogButtonRef>;
|
package/es/dialog/button.js
CHANGED
|
@@ -18,7 +18,7 @@ import { Button, Form } from 'antd';
|
|
|
18
18
|
import React, { useEffect, useImperativeHandle, useState } from 'react';
|
|
19
19
|
import CcsDialog from '.';
|
|
20
20
|
import { useDialogFields } from "../hooks/use-app";
|
|
21
|
-
import {
|
|
21
|
+
import { getDataByNamePath } from "../select";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
24
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -110,9 +110,9 @@ export var DialogButtonHolder = function DialogButtonHolder(_ref) {
|
|
|
110
110
|
var fieldNames = _objectSpread(_objectSpread({}, globalFieldNames), requestFieldNames);
|
|
111
111
|
|
|
112
112
|
// 获取成功标识
|
|
113
|
-
var success =
|
|
113
|
+
var success = getDataByNamePath(result, fieldNames.success);
|
|
114
114
|
// 获取异常信息
|
|
115
|
-
var msg =
|
|
115
|
+
var msg = getDataByNamePath(result, fieldNames.errorMsg);
|
|
116
116
|
if (success === fieldNames.successTag) {
|
|
117
117
|
// 关闭对话框
|
|
118
118
|
onHandleClose(values, result);
|
|
@@ -1,28 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useDebounceEffect, useMemoizedFn, useSize } from 'ahooks';
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
export function useResizeEffect(effect, targetRef) {
|
|
4
|
-
var ref = useRef(0);
|
|
5
4
|
var fn = useMemoizedFn(effect);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return fn(target);
|
|
16
|
-
});
|
|
17
|
-
ref.current = target === null || target === void 0 ? void 0 : target.clientWidth;
|
|
18
|
-
});
|
|
19
|
-
observer.observe(target);
|
|
20
|
-
return function () {
|
|
21
|
-
window.cancelAnimationFrame(animationFrame);
|
|
22
|
-
observer.disconnect();
|
|
23
|
-
};
|
|
24
|
-
} else {
|
|
25
|
-
fn(target);
|
|
26
|
-
}
|
|
27
|
-
}, [targetRef]);
|
|
5
|
+
var widthRef = useRef();
|
|
6
|
+
var size = useSize(targetRef);
|
|
7
|
+
useDebounceEffect(function () {
|
|
8
|
+
if ((size === null || size === void 0 ? void 0 : size.width) === 0 || (size === null || size === void 0 ? void 0 : size.width) === widthRef.current) return;
|
|
9
|
+
fn(targetRef.current);
|
|
10
|
+
widthRef.current = size === null || size === void 0 ? void 0 : size.width;
|
|
11
|
+
}, [size === null || size === void 0 ? void 0 : size.width], {
|
|
12
|
+
wait: 500
|
|
13
|
+
});
|
|
28
14
|
}
|
|
@@ -20,7 +20,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
20
20
|
import { useUpdateEffect } from 'ahooks';
|
|
21
21
|
import { Form } from 'antd';
|
|
22
22
|
import { useEffect, useState } from 'react';
|
|
23
|
-
import {
|
|
23
|
+
import { getDataByNamePath } from "../select";
|
|
24
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
25
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
26
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -38,7 +38,7 @@ var FormUpdateItem = function FormUpdateItem(_ref) {
|
|
|
38
38
|
|
|
39
39
|
// 根据子项初始值设置name的默认值
|
|
40
40
|
groupItemNames.forEach(function (item) {
|
|
41
|
-
initNameValue.push(
|
|
41
|
+
initNameValue.push(getDataByNamePath(initialValues, item));
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
// 如果子项有初始值,则设置name的默认值
|
|
@@ -50,7 +50,7 @@ var FormUpdateItem = function FormUpdateItem(_ref) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// 如果子项没有初始值,主项有初始值
|
|
53
|
-
var groupNameValue =
|
|
53
|
+
var groupNameValue = getDataByNamePath(initialValues, name);
|
|
54
54
|
if (Array.isArray(groupNameValue)) {
|
|
55
55
|
groupItemNames.forEach(function (item, index) {
|
|
56
56
|
setFieldValue(item, groupNameValue[index]);
|
|
@@ -96,7 +96,7 @@ export default function useTableSelection(props) {
|
|
|
96
96
|
return (_ref2 = newValue || []) === null || _ref2 === void 0 ? void 0 : _ref2.includes(row[keyField]);
|
|
97
97
|
});
|
|
98
98
|
selectionRef.current = {
|
|
99
|
-
selectedRowKeys: newValue,
|
|
99
|
+
selectedRowKeys: newValue === undefined && isMultiple ? [] : newValue,
|
|
100
100
|
selectedRows: rows,
|
|
101
101
|
info: {
|
|
102
102
|
type: 'none'
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { NamePath } from 'antd/es/form/interface';
|
|
1
2
|
import { TableFormItem } from '../ccs';
|
|
2
|
-
import { CcsProTableProps } from './table';
|
|
3
3
|
type PropsType = TableFormItem & {
|
|
4
4
|
dependParam?: any;
|
|
5
|
-
|
|
5
|
+
groupItemNames?: NamePath[];
|
|
6
|
+
formItemLabelWidth?: number | string;
|
|
7
|
+
};
|
|
6
8
|
export default function HeadFormItem({ label, name, rules, value, dependParam, groupItemNames, formItemLabelWidth, }: PropsType): import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -19,7 +19,6 @@ export default function HeadFormItem(_ref) {
|
|
|
19
19
|
groupItemNames = _ref.groupItemNames,
|
|
20
20
|
formItemLabelWidth = _ref.formItemLabelWidth;
|
|
21
21
|
var props = {
|
|
22
|
-
name: name,
|
|
23
22
|
rules: rules,
|
|
24
23
|
className: "".concat(classPrefix, "-form-label"),
|
|
25
24
|
label: formItemLabelWidth ? /*#__PURE__*/_jsx("div", {
|
|
@@ -36,7 +35,9 @@ export default function HeadFormItem(_ref) {
|
|
|
36
35
|
}));
|
|
37
36
|
}
|
|
38
37
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
39
|
-
children: /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({
|
|
38
|
+
children: /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({
|
|
39
|
+
name: name
|
|
40
|
+
}, props), {}, {
|
|
40
41
|
children: dependParam ? /*#__PURE__*/cloneElement(value, dependParam) : value
|
|
41
42
|
}))
|
|
42
43
|
});
|
package/es/pro-table/head.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
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); }
|
|
1
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
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."); }
|
|
3
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); }
|
|
@@ -5,11 +11,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
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; } }
|
|
6
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
13
|
import { DownOutlined, UpOutlined } from '@ant-design/icons';
|
|
8
|
-
import { useUpdateEffect } from 'ahooks';
|
|
9
14
|
import { Button, Form, theme } from 'antd';
|
|
10
15
|
import _debounce from 'lodash.debounce';
|
|
11
16
|
import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
12
17
|
import { CcsResizeObserver } from '..';
|
|
18
|
+
import { getDataByNamePath } from "../select";
|
|
13
19
|
import { getShowDpends } from "./_utils";
|
|
14
20
|
import HeadFormItem from "./form-item";
|
|
15
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -33,8 +39,10 @@ function HeadComponent(_ref) {
|
|
|
33
39
|
var formItemsRef = useRef(null);
|
|
34
40
|
// 根据位置判断是否换行ref
|
|
35
41
|
var endItemRef = useRef(null);
|
|
42
|
+
// 查询按钮ref
|
|
43
|
+
var searchBtnRef = useRef(null);
|
|
36
44
|
// 查询条件是否展开
|
|
37
|
-
var _useState = useState(
|
|
45
|
+
var _useState = useState(false),
|
|
38
46
|
_useState2 = _slicedToArray(_useState, 2),
|
|
39
47
|
isExpand = _useState2[0],
|
|
40
48
|
setIsExpand = _useState2[1];
|
|
@@ -42,9 +50,11 @@ function HeadComponent(_ref) {
|
|
|
42
50
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
51
|
hasMore = _useState4[0],
|
|
44
52
|
onToggle = _useState4[1];
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
useEffect(function () {
|
|
54
|
+
if (hasMore && expandForm) {
|
|
55
|
+
setIsExpand(true);
|
|
56
|
+
}
|
|
57
|
+
}, [hasMore]);
|
|
48
58
|
useImperativeHandle(formRef, function () {
|
|
49
59
|
return form;
|
|
50
60
|
});
|
|
@@ -62,9 +72,19 @@ function HeadComponent(_ref) {
|
|
|
62
72
|
|
|
63
73
|
// 判断是否有更多条件无法一行显示
|
|
64
74
|
var onEventMore = function onEventMore() {
|
|
65
|
-
var _endItemRef$current, _formItemsRef$current;
|
|
66
|
-
if (!endItemRef.current || !formItemsRef.current
|
|
67
|
-
var
|
|
75
|
+
var _endItemRef$current, _formItemsRef$current, _searchBtnRef$current, _endItemRef$current2, _formItemsRef$current2;
|
|
76
|
+
if (!endItemRef.current || !formItemsRef.current) return;
|
|
77
|
+
var endTop = (_endItemRef$current = endItemRef.current) === null || _endItemRef$current === void 0 || (_endItemRef$current = _endItemRef$current.getClientRects()[0]) === null || _endItemRef$current === void 0 ? void 0 : _endItemRef$current.top;
|
|
78
|
+
var formTop = (_formItemsRef$current = formItemsRef.current) === null || _formItemsRef$current === void 0 || (_formItemsRef$current = _formItemsRef$current.getClientRects()[0]) === null || _formItemsRef$current === void 0 ? void 0 : _formItemsRef$current.top;
|
|
79
|
+
var searchtTop = (_searchBtnRef$current = searchBtnRef.current) === null || _searchBtnRef$current === void 0 || (_searchBtnRef$current = _searchBtnRef$current.getClientRects()[0]) === null || _searchBtnRef$current === void 0 ? void 0 : _searchBtnRef$current.top;
|
|
80
|
+
|
|
81
|
+
// 都在一行,则没有更多和展开
|
|
82
|
+
if (endTop === formTop && endTop === searchtTop) {
|
|
83
|
+
onToggle(false);
|
|
84
|
+
setIsExpand(false);
|
|
85
|
+
}
|
|
86
|
+
if (isExpand) return;
|
|
87
|
+
var hasMore = ((_endItemRef$current2 = endItemRef.current) === null || _endItemRef$current2 === void 0 || (_endItemRef$current2 = _endItemRef$current2.getClientRects()[0]) === null || _endItemRef$current2 === void 0 ? void 0 : _endItemRef$current2.top) !== ((_formItemsRef$current2 = formItemsRef.current) === null || _formItemsRef$current2 === void 0 || (_formItemsRef$current2 = _formItemsRef$current2.getClientRects()[0]) === null || _formItemsRef$current2 === void 0 ? void 0 : _formItemsRef$current2.top);
|
|
68
88
|
onToggle(hasMore);
|
|
69
89
|
};
|
|
70
90
|
|
|
@@ -86,6 +106,7 @@ function HeadComponent(_ref) {
|
|
|
86
106
|
textAlign: 'right',
|
|
87
107
|
flex: isExpand && hasMore ? '1 1 auto' : '0 0 auto'
|
|
88
108
|
},
|
|
109
|
+
ref: searchBtnRef,
|
|
89
110
|
children: [hasMore && /*#__PURE__*/_jsx(Button, {
|
|
90
111
|
type: "link",
|
|
91
112
|
icon: isExpand ? /*#__PURE__*/_jsx(UpOutlined, {}) : /*#__PURE__*/_jsx(DownOutlined, {}),
|
|
@@ -109,60 +130,53 @@ function HeadComponent(_ref) {
|
|
|
109
130
|
var depends = _ref2.depends,
|
|
110
131
|
showDepends = _ref2.showDepends,
|
|
111
132
|
name = _ref2.name,
|
|
112
|
-
|
|
133
|
+
isGroupItem = _ref2.isGroupItem,
|
|
113
134
|
label = _ref2.label,
|
|
114
135
|
rules = _ref2.rules,
|
|
115
136
|
value = _ref2.value;
|
|
137
|
+
var itemProps = {
|
|
138
|
+
name: name,
|
|
139
|
+
label: label,
|
|
140
|
+
rules: rules,
|
|
141
|
+
value: value,
|
|
142
|
+
formItemLabelWidth: formItemLabelWidth,
|
|
143
|
+
groupItemNames: isGroupItem ? name : undefined
|
|
144
|
+
};
|
|
145
|
+
var itemContent = /*#__PURE__*/_jsx(React.Fragment, {
|
|
146
|
+
children: /*#__PURE__*/_jsx(HeadFormItem, _objectSpread({}, itemProps))
|
|
147
|
+
}, index);
|
|
116
148
|
if (depends || showDepends) {
|
|
117
|
-
return /*#__PURE__*/_jsx(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return getFieldValue(i.name) === i.value;
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
var itemContent = /*#__PURE__*/_jsx(HeadFormItem, {
|
|
141
|
-
name: name,
|
|
142
|
-
groupItemNames: groupItemNames,
|
|
143
|
-
label: label,
|
|
144
|
-
rules: rules,
|
|
145
|
-
value: value,
|
|
146
|
-
dependParam: dependParam,
|
|
147
|
-
formItemLabelWidth: formItemLabelWidth
|
|
149
|
+
return /*#__PURE__*/_jsx(Form.Item, {
|
|
150
|
+
noStyle: true,
|
|
151
|
+
shouldUpdate: function shouldUpdate(l, n) {
|
|
152
|
+
return (depends === null || depends === void 0 ? void 0 : depends.some(function (i) {
|
|
153
|
+
return getDataByNamePath(l, i) !== getDataByNamePath(n, i);
|
|
154
|
+
})) || (showDepends === null || showDepends === void 0 ? void 0 : showDepends.some(function (i) {
|
|
155
|
+
return getDataByNamePath(l, i.name) !== getDataByNamePath(n, i.name);
|
|
156
|
+
})) || false;
|
|
157
|
+
},
|
|
158
|
+
children: function children(_ref3) {
|
|
159
|
+
var getFieldValue = _ref3.getFieldValue;
|
|
160
|
+
var dependParam = {};
|
|
161
|
+
depends === null || depends === void 0 || depends.forEach(function (i) {
|
|
162
|
+
var value = getFieldValue(i);
|
|
163
|
+
dependParam[i] = value;
|
|
164
|
+
});
|
|
165
|
+
var isShow = true;
|
|
166
|
+
if (showDepends && showDepends.length > 0) {
|
|
167
|
+
isShow = showDepends === null || showDepends === void 0 ? void 0 : showDepends.every(function (i) {
|
|
168
|
+
return getFieldValue(i.name) === i.value;
|
|
148
169
|
});
|
|
149
|
-
if (!isShow) return null;
|
|
150
|
-
return itemContent;
|
|
151
170
|
}
|
|
152
|
-
|
|
153
|
-
|
|
171
|
+
var itemContent = /*#__PURE__*/_jsx(HeadFormItem, _objectSpread(_objectSpread({}, itemProps), {}, {
|
|
172
|
+
dependParam: dependParam
|
|
173
|
+
}));
|
|
174
|
+
if (!isShow) return null;
|
|
175
|
+
return itemContent;
|
|
176
|
+
}
|
|
177
|
+
}, index);
|
|
154
178
|
}
|
|
155
|
-
|
|
156
|
-
groupItemNames: groupItemNames,
|
|
157
|
-
name: name,
|
|
158
|
-
value: value,
|
|
159
|
-
rules: rules,
|
|
160
|
-
label: label,
|
|
161
|
-
formItemLabelWidth: formItemLabelWidth
|
|
162
|
-
});
|
|
163
|
-
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
164
|
-
children: itemContent
|
|
165
|
-
}, index);
|
|
179
|
+
return itemContent;
|
|
166
180
|
});
|
|
167
181
|
};
|
|
168
182
|
var formStyles = {
|
|
@@ -183,16 +197,21 @@ function HeadComponent(_ref) {
|
|
|
183
197
|
onFinish: onSearch,
|
|
184
198
|
layout: "inline",
|
|
185
199
|
style: formStyles,
|
|
186
|
-
children: [/*#__PURE__*/
|
|
200
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
187
201
|
style: {
|
|
188
|
-
justifyContent: isExpand && hasMore ? 'flex-start' : 'flex-end',
|
|
189
202
|
height: isExpand ? 'auto' : controlHeight
|
|
190
203
|
},
|
|
191
204
|
className: "ccs-pl-adaptation-form",
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
ref:
|
|
195
|
-
|
|
205
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
206
|
+
className: "ccs-pl-form-".concat(isExpand && hasMore ? 'expand' : 'collapse'),
|
|
207
|
+
ref: formItemsRef,
|
|
208
|
+
children: [renderFormItems(), /*#__PURE__*/_jsx("div", {
|
|
209
|
+
style: {
|
|
210
|
+
height: 1
|
|
211
|
+
},
|
|
212
|
+
ref: endItemRef
|
|
213
|
+
}), isExpand && renderSearchBtn]
|
|
214
|
+
})
|
|
196
215
|
}), !isExpand && /*#__PURE__*/_jsx("div", {
|
|
197
216
|
style: {
|
|
198
217
|
flex: '0 0 auto'
|
package/es/pro-table/index.less
CHANGED
|
@@ -62,12 +62,22 @@
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
&-
|
|
66
|
-
flex: 1 1 auto;
|
|
65
|
+
&-form-collapse {
|
|
67
66
|
display: flex;
|
|
68
67
|
justify-content: flex-end;
|
|
69
68
|
flex-wrap: wrap;
|
|
70
|
-
gap:
|
|
69
|
+
column-gap: 10px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&-form-expand {
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: flex-start;
|
|
75
|
+
flex-wrap: wrap;
|
|
76
|
+
column-gap: 10px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&-adaptation-form {
|
|
80
|
+
flex: 1 1 auto;
|
|
71
81
|
overflow: hidden;
|
|
72
82
|
|
|
73
83
|
&::-webkit-scrollbar {
|
|
@@ -76,7 +86,7 @@
|
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
.ant-form-item {
|
|
79
|
-
margin-bottom:
|
|
89
|
+
margin-bottom: 10px;
|
|
80
90
|
}
|
|
81
91
|
|
|
82
92
|
&-form {
|
package/es/pro-table/table.js
CHANGED
|
@@ -24,7 +24,7 @@ import _debounce from 'lodash.debounce';
|
|
|
24
24
|
import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
25
25
|
import { CcsResizeObserver, useAppConfig, useCcsPage } from '..';
|
|
26
26
|
import { useProTableFields } from "../hooks/use-app";
|
|
27
|
-
import {
|
|
27
|
+
import { getDataByNamePath } from "../select";
|
|
28
28
|
import CcsTable from "../table";
|
|
29
29
|
import { getAllChildrenId, getDataById, onTableInModalOrDrawer, onTableInTabItem } from "./_utils";
|
|
30
30
|
import HeadComponent from "./head";
|
|
@@ -319,11 +319,11 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
319
319
|
break;
|
|
320
320
|
}
|
|
321
321
|
// 获取table数据
|
|
322
|
-
dataSource =
|
|
322
|
+
dataSource = getDataByNamePath(requestResult, fieldNames.dataSource); // 默认添加一条数据
|
|
323
323
|
if (table !== null && table !== void 0 && table.emptyDefaultOne && dataSource && dataSource.length === 0) {
|
|
324
324
|
dataSource.push(_defineProperty({}, rowKey || 'id', '0'));
|
|
325
325
|
}
|
|
326
|
-
total =
|
|
326
|
+
total = getDataByNamePath(requestResult, fieldNames.total);
|
|
327
327
|
if (!(total === undefined || dataSource === undefined)) {
|
|
328
328
|
_context2.next = 33;
|
|
329
329
|
break;
|
package/es/pro-table/tree.js
CHANGED
|
@@ -21,7 +21,7 @@ import CcsUtils from '@ccs-ui/utils';
|
|
|
21
21
|
import { useImperativeHandle, useState } from 'react';
|
|
22
22
|
import { CcsTable } from '..';
|
|
23
23
|
import { useProTableTreeFields } from "../hooks/use-app";
|
|
24
|
-
import {
|
|
24
|
+
import { getDataByNamePath } from "../select";
|
|
25
25
|
import { TableEvent } from "./table";
|
|
26
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
27
|
var TableTree = function TableTree(props) {
|
|
@@ -104,7 +104,7 @@ var TableTree = function TableTree(props) {
|
|
|
104
104
|
// 请求结果
|
|
105
105
|
if (requestResult) {
|
|
106
106
|
// 获取table数据
|
|
107
|
-
dataSource =
|
|
107
|
+
dataSource = getDataByNamePath(requestResult, fieldNames.dataSource); // 判断非叶子节点,添加children
|
|
108
108
|
if (leafNode && dataSource && Array.isArray(dataSource)) {
|
|
109
109
|
dataSource.forEach(function (d) {
|
|
110
110
|
if (typeof leafNode === 'string' && !d[leafNode]) {
|
package/es/select/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { SelectProps } from 'antd';
|
|
2
|
+
import { NamePath } from 'antd/es/form/interface';
|
|
2
3
|
import ModalSelect from './ modal';
|
|
3
4
|
import ApiSelect from './api';
|
|
4
5
|
import CustomizeSelect from './customize';
|
|
5
|
-
export declare function
|
|
6
|
+
export declare function getDataByNamePath(data: Record<string, any>, name: NamePath): any;
|
|
6
7
|
export interface CcsSelectProps extends Omit<SelectProps, 'fieldNames'> {
|
|
7
8
|
/** 配置全部选项 */
|
|
8
9
|
showAll?: boolean | {
|
package/es/select/index.js
CHANGED
|
@@ -20,13 +20,16 @@ import ModalSelect from "./ modal";
|
|
|
20
20
|
import ApiSelect from "./api";
|
|
21
21
|
import CustomizeSelect from "./customize";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
-
export function
|
|
24
|
-
if (!data ||
|
|
25
|
-
|
|
23
|
+
export function getDataByNamePath(data, name) {
|
|
24
|
+
if (!data || !name) return;
|
|
25
|
+
if (typeof name === 'string') {
|
|
26
|
+
return data[name];
|
|
27
|
+
}
|
|
28
|
+
var newFields = _toConsumableArray(name);
|
|
26
29
|
var field = newFields.shift();
|
|
27
30
|
var newData = data[field];
|
|
28
31
|
if (_typeof(newData) === 'object' && newFields.length > 0) {
|
|
29
|
-
return
|
|
32
|
+
return getDataByNamePath(newData, newFields);
|
|
30
33
|
}
|
|
31
34
|
return newData;
|
|
32
35
|
}
|
|
@@ -64,8 +67,8 @@ function InternalSelect(_ref) {
|
|
|
64
67
|
while (labelField.length > 0 || valueField.length > 0) {
|
|
65
68
|
if (Array.isArray(ops)) {
|
|
66
69
|
ops.forEach(function (r) {
|
|
67
|
-
r.label =
|
|
68
|
-
r.value =
|
|
70
|
+
r.label = getDataByNamePath(r, labelField);
|
|
71
|
+
r.value = getDataByNamePath(r, valueField);
|
|
69
72
|
});
|
|
70
73
|
break;
|
|
71
74
|
}
|
|
@@ -87,9 +90,6 @@ function InternalSelect(_ref) {
|
|
|
87
90
|
}, [options]);
|
|
88
91
|
return /*#__PURE__*/_jsx(Select, _objectSpread({
|
|
89
92
|
options: selectOptions,
|
|
90
|
-
style: {
|
|
91
|
-
width: '100%'
|
|
92
|
-
},
|
|
93
93
|
filterOption: onFilterOption,
|
|
94
94
|
placeholder: "\u8BF7\u9009\u62E9",
|
|
95
95
|
allowClear: true,
|
package/es/table/index.js
CHANGED
|
@@ -124,9 +124,6 @@ var CustomTable = function CustomTable(props) {
|
|
|
124
124
|
onFixedThead();
|
|
125
125
|
}, [total]);
|
|
126
126
|
|
|
127
|
-
// 监听窗口变化
|
|
128
|
-
// useEventListener('resize', onFixedThead, { target: window });
|
|
129
|
-
|
|
130
127
|
// 监听列筛选事件
|
|
131
128
|
useImperativeHandle(tableRef, function () {
|
|
132
129
|
return {
|