@ccs-ui/rc-pro 1.1.21 → 1.1.22-beta-2
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/date-picker/index.js
CHANGED
|
@@ -17,7 +17,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
17
17
|
import { DatePicker } from 'antd';
|
|
18
18
|
import dayjs from 'dayjs';
|
|
19
19
|
import _isArray from 'lodash/isArray';
|
|
20
|
-
import
|
|
20
|
+
import { useState } from 'react';
|
|
21
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
22
|
function CcsDatePicker(_ref) {
|
|
23
23
|
var value = _ref.value,
|
|
@@ -46,7 +46,9 @@ function RangePicker(_ref2) {
|
|
|
46
46
|
restProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
47
47
|
var _useState3 = useState(function () {
|
|
48
48
|
if (_isArray(value)) {
|
|
49
|
-
|
|
49
|
+
var st = value[0] ? dayjs(value[0]) : value[0];
|
|
50
|
+
var et = value[1] ? dayjs(value[1]) : value[1];
|
|
51
|
+
return [st, et];
|
|
50
52
|
}
|
|
51
53
|
}),
|
|
52
54
|
_useState4 = _slicedToArray(_useState3, 2),
|
package/es/dialog/HookModal.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { FormProps } from 'antd';
|
|
3
3
|
import { DialogFormRef } from './form';
|
|
4
4
|
import { CcsDialogModal, CcsDialogModalProps } from './hook';
|
|
5
|
-
export declare const DialogSelfButton: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "
|
|
5
|
+
export declare const DialogSelfButton: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "auth" | "request" | "onRequestBefore" | "onCancel"> & {
|
|
6
6
|
formRef: React.RefObject<DialogFormRef>;
|
|
7
7
|
formInitialValues: FormProps['initialValues'];
|
|
8
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/es/pro-table/search.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { EventEmitter } from 'ahooks/lib/useEventEmitter';
|
|
|
2
2
|
import { FormInstance } from 'antd/lib/form';
|
|
3
3
|
import { ReactElement } from 'react';
|
|
4
4
|
import { CcsProTableProps } from './table';
|
|
5
|
-
type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formInitValues' | 'expandForm' | '
|
|
5
|
+
type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formInitValues' | 'expandForm' | 'formItemLabelWidth' | 'formItemLayout' | 'formItemCol' | 'title'> & {
|
|
6
6
|
/** 显示列 */
|
|
7
7
|
columns?: any;
|
|
8
8
|
/** 更多查询条件 */
|
|
@@ -18,5 +18,5 @@ type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formIni
|
|
|
18
18
|
event$: EventEmitter<any>;
|
|
19
19
|
};
|
|
20
20
|
/** 操作按钮、查询,重置、列筛选、 */
|
|
21
|
-
declare function SearchComponent<T>({ form, title, event$, toolbar, columns, children, expandForm, titleBordered, formItems, formInitValues, isInModalOrDrawer, formItemLabelWidth,
|
|
21
|
+
declare function SearchComponent<T>({ form, title, event$, toolbar, columns, children, expandForm, titleBordered, formItems, formInitValues, formItemLayout, formItemCol, isInModalOrDrawer, formItemLabelWidth, onReset, onSearch, }: PropsType<T>): import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
export default SearchComponent;
|
package/es/pro-table/search.js
CHANGED
|
@@ -16,9 +16,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
17
|
import { MoreOutlined, RedoOutlined, SettingOutlined, UpOutlined } from '@ant-design/icons';
|
|
18
18
|
import { Button, Card, Checkbox, Col, Dropdown, Form, Row, Tooltip } from 'antd';
|
|
19
|
-
import
|
|
20
|
-
import ResizeObserver from 'rc-resize-observer';
|
|
21
|
-
import { cloneElement, useMemo, useRef, useState } from 'react';
|
|
19
|
+
import React, { cloneElement, useMemo, useRef, useState } from 'react';
|
|
22
20
|
import { CcsFullScreenButton } from '..';
|
|
23
21
|
import { classPrefix } from "./table";
|
|
24
22
|
|
|
@@ -26,6 +24,7 @@ import { classPrefix } from "./table";
|
|
|
26
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
25
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
26
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
27
|
+
import { createElement as _createElement } from "react";
|
|
29
28
|
var getShowDpends = function getShowDpends(items, item, depends) {
|
|
30
29
|
var showDepends = item.showDepends;
|
|
31
30
|
if (showDepends) {
|
|
@@ -47,6 +46,14 @@ var getShowDpends = function getShowDpends(items, item, depends) {
|
|
|
47
46
|
}
|
|
48
47
|
return depends;
|
|
49
48
|
};
|
|
49
|
+
var DefaultItemCol = {
|
|
50
|
+
xs: 24,
|
|
51
|
+
sm: 12,
|
|
52
|
+
md: 8,
|
|
53
|
+
lg: 8,
|
|
54
|
+
xl: 6
|
|
55
|
+
};
|
|
56
|
+
|
|
50
57
|
/** 操作按钮、查询,重置、列筛选、 */
|
|
51
58
|
function SearchComponent(_ref) {
|
|
52
59
|
var form = _ref.form,
|
|
@@ -60,9 +67,12 @@ function SearchComponent(_ref) {
|
|
|
60
67
|
_ref$formItems = _ref.formItems,
|
|
61
68
|
formItems = _ref$formItems === void 0 ? [] : _ref$formItems,
|
|
62
69
|
formInitValues = _ref.formInitValues,
|
|
70
|
+
_ref$formItemLayout = _ref.formItemLayout,
|
|
71
|
+
formItemLayout = _ref$formItemLayout === void 0 ? 'horizontal' : _ref$formItemLayout,
|
|
72
|
+
_ref$formItemCol = _ref.formItemCol,
|
|
73
|
+
formItemCol = _ref$formItemCol === void 0 ? DefaultItemCol : _ref$formItemCol,
|
|
63
74
|
isInModalOrDrawer = _ref.isInModalOrDrawer,
|
|
64
75
|
formItemLabelWidth = _ref.formItemLabelWidth,
|
|
65
|
-
disableCollapseForm = _ref.disableCollapseForm,
|
|
66
76
|
onReset = _ref.onReset,
|
|
67
77
|
onSearch = _ref.onSearch;
|
|
68
78
|
var _useState = useState(false),
|
|
@@ -78,15 +88,10 @@ function SearchComponent(_ref) {
|
|
|
78
88
|
isShowMore = _useState6[0],
|
|
79
89
|
setIsShowMore = _useState6[1];
|
|
80
90
|
var ref = useRef(null);
|
|
81
|
-
var _useState7 = useState(6),
|
|
82
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
83
|
-
colSpan = _useState8[0],
|
|
84
|
-
setColSpan = _useState8[1];
|
|
85
91
|
var onHasMore = function onHasMore() {
|
|
86
92
|
var hasMain = formItems.filter(function (f) {
|
|
87
93
|
return f.isMain;
|
|
88
94
|
});
|
|
89
|
-
|
|
90
95
|
// 所有都是主条件
|
|
91
96
|
if (hasMain.length === formItems.length) {
|
|
92
97
|
// 收起已展开
|
|
@@ -123,14 +128,14 @@ function SearchComponent(_ref) {
|
|
|
123
128
|
return c.hidden;
|
|
124
129
|
}));
|
|
125
130
|
};
|
|
126
|
-
var
|
|
131
|
+
var _useState7 = useState(true),
|
|
132
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
133
|
+
isCheckAll = _useState8[0],
|
|
134
|
+
setIsCheckAll = _useState8[1];
|
|
135
|
+
var _useState9 = useState(getHalfCheckState),
|
|
127
136
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
var _useState11 = useState(getHalfCheckState),
|
|
131
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
132
|
-
isHalfCheck = _useState12[0],
|
|
133
|
-
setIsHalfCheck = _useState12[1];
|
|
137
|
+
isHalfCheck = _useState10[0],
|
|
138
|
+
setIsHalfCheck = _useState10[1];
|
|
134
139
|
|
|
135
140
|
// 列选中事件
|
|
136
141
|
var onCheckChange = function onCheckChange(checked, index) {
|
|
@@ -217,7 +222,7 @@ function SearchComponent(_ref) {
|
|
|
217
222
|
// 操作按钮
|
|
218
223
|
var renderOperation = /*#__PURE__*/_jsxs("div", {
|
|
219
224
|
className: "".concat(classPrefix, "-header-buttons"),
|
|
220
|
-
children: [onHasMore() && !
|
|
225
|
+
children: [onHasMore() && !expandForm && /*#__PURE__*/_jsx(Button, {
|
|
221
226
|
onClick: function onClick() {
|
|
222
227
|
return setIsShowMore(!isShowMore);
|
|
223
228
|
},
|
|
@@ -341,101 +346,84 @@ function SearchComponent(_ref) {
|
|
|
341
346
|
})]
|
|
342
347
|
});
|
|
343
348
|
};
|
|
344
|
-
|
|
345
|
-
// 重设尺寸,当组件位于弹框中,根据容器宽度决定显示尺寸
|
|
346
|
-
var resizeFn = _debounce(function (width) {
|
|
347
|
-
if (!ref.current) return;
|
|
348
|
-
if (width === 0) return;
|
|
349
|
-
if (width > 1000) {
|
|
350
|
-
if (colSpan !== 6) setColSpan(6);
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
if (width < 300) {
|
|
354
|
-
if (colSpan !== 24) setColSpan(24);
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
if (width < 500) {
|
|
358
|
-
if (colSpan !== 12) setColSpan(12);
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
if (width < 1000) {
|
|
362
|
-
if (colSpan !== 8) setColSpan(8);
|
|
363
|
-
}
|
|
364
|
-
}, 500);
|
|
365
|
-
var onResize = function onResize(size) {
|
|
366
|
-
if (size.width === 0) return;
|
|
367
|
-
resizeFn(size.width);
|
|
368
|
-
};
|
|
369
349
|
var renderMoreForm = function renderMoreForm() {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
350
|
+
// 需要使用row布局
|
|
351
|
+
var hasRow = formItemLayout !== 'inline';
|
|
352
|
+
var isArray = Array.isArray(formItemCol);
|
|
353
|
+
var renderItems = allFormItems.map(function (item, index) {
|
|
354
|
+
var colSpan = isArray ? formItemCol[index] || DefaultItemCol : formItemCol;
|
|
355
|
+
if (item.depends || item.showDepends) {
|
|
356
|
+
return /*#__PURE__*/_jsx(Form.Item, {
|
|
357
|
+
noStyle: true,
|
|
358
|
+
shouldUpdate: function shouldUpdate(l, n) {
|
|
359
|
+
var _item$depends3, _item$showDepends3;
|
|
360
|
+
return ((_item$depends3 = item.depends) === null || _item$depends3 === void 0 ? void 0 : _item$depends3.some(function (i) {
|
|
361
|
+
return l[i] !== n[i];
|
|
362
|
+
})) || ((_item$showDepends3 = item.showDepends) === null || _item$showDepends3 === void 0 ? void 0 : _item$showDepends3.some(function (i) {
|
|
363
|
+
return l[i.name] !== n[i.name];
|
|
364
|
+
})) || false;
|
|
365
|
+
},
|
|
366
|
+
children: function children(_ref3) {
|
|
367
|
+
var _item$depends4;
|
|
368
|
+
var getFieldValue = _ref3.getFieldValue;
|
|
369
|
+
var dependParam = {};
|
|
370
|
+
(_item$depends4 = item.depends) === null || _item$depends4 === void 0 ? void 0 : _item$depends4.forEach(function (i) {
|
|
371
|
+
var value = getFieldValue(i);
|
|
372
|
+
dependParam[i] = value;
|
|
373
|
+
});
|
|
374
|
+
var isShow = true;
|
|
375
|
+
if (item.showDepends && item.showDepends.length > 0) {
|
|
376
|
+
var _item$showDepends4;
|
|
377
|
+
isShow = (_item$showDepends4 = item.showDepends) === null || _item$showDepends4 === void 0 ? void 0 : _item$showDepends4.every(function (i) {
|
|
378
|
+
return getFieldValue(i.name) === i.value;
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
var itemContent = /*#__PURE__*/_jsx(Form.Item, {
|
|
382
|
+
className: "".concat(classPrefix, "-form-label"),
|
|
383
|
+
label: renderLabel(item.label),
|
|
384
|
+
name: item.name,
|
|
385
|
+
rules: item.rules,
|
|
386
|
+
children: /*#__PURE__*/cloneElement(item.value, dependParam)
|
|
387
|
+
});
|
|
388
|
+
if (!isShow) return null;
|
|
389
|
+
return hasRow ? /*#__PURE__*/_jsx(Col, _objectSpread(_objectSpread({}, colSpan), {}, {
|
|
390
|
+
children: itemContent
|
|
391
|
+
})) : itemContent;
|
|
392
|
+
}
|
|
393
|
+
}, item.name);
|
|
394
|
+
}
|
|
395
|
+
var itemContent = /*#__PURE__*/_jsx(Form.Item, {
|
|
396
|
+
className: "".concat(classPrefix, "-form-label"),
|
|
397
|
+
rules: item.rules,
|
|
398
|
+
label: renderLabel(item.label),
|
|
399
|
+
name: item.name,
|
|
400
|
+
children: item.value
|
|
401
|
+
});
|
|
402
|
+
if (hasRow) {
|
|
403
|
+
return /*#__PURE__*/_createElement(Col, _objectSpread(_objectSpread({}, colSpan), {}, {
|
|
404
|
+
key: item.name
|
|
405
|
+
}), itemContent);
|
|
406
|
+
}
|
|
407
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
408
|
+
children: itemContent
|
|
409
|
+
}, item.name);
|
|
410
|
+
});
|
|
411
|
+
return /*#__PURE__*/_jsx("div", {
|
|
412
|
+
className: "".concat(classPrefix, "-high-form"),
|
|
413
|
+
ref: ref,
|
|
414
|
+
style: {
|
|
415
|
+
maxHeight: isShowMore ? 500 : 0,
|
|
416
|
+
overflow: 'hidden',
|
|
417
|
+
marginBottom: isShowMore ? 10 : 0
|
|
418
|
+
},
|
|
419
|
+
children: /*#__PURE__*/_jsx(Form, {
|
|
420
|
+
initialValues: formInitValues,
|
|
421
|
+
form: form,
|
|
422
|
+
onFinish: onSearch,
|
|
423
|
+
layout: formItemLayout,
|
|
424
|
+
children: /*#__PURE__*/_jsx(Row, {
|
|
425
|
+
gutter: 16,
|
|
426
|
+
children: renderItems
|
|
439
427
|
})
|
|
440
428
|
})
|
|
441
429
|
});
|
package/es/pro-table/table.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { TableProps } from 'antd';
|
|
1
|
+
import { ColProps, TableProps } from 'antd';
|
|
2
|
+
import { FormLayout } from 'antd/es/form/Form';
|
|
2
3
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
3
4
|
import CCS from '..';
|
|
4
5
|
import { HttpPageResult } from '../ccs';
|
|
@@ -34,6 +35,10 @@ export type CcsProTableProps<T> = {
|
|
|
34
35
|
title?: string;
|
|
35
36
|
/** 查询条件集合 */
|
|
36
37
|
formItems?: CCS.TableFormItems;
|
|
38
|
+
/** 查询条件布局模式,默认:horizontal */
|
|
39
|
+
formItemLayout?: FormLayout;
|
|
40
|
+
/** 查询条件栅格配置,默认:{ xs: 24, sm: 12, md: 8, lg: 8, xl: 6 } */
|
|
41
|
+
formItemCol?: ColProps | ColProps[];
|
|
37
42
|
/** form item label 宽度 */
|
|
38
43
|
formItemLabelWidth?: number | string;
|
|
39
44
|
/** 查询form 初始值 */
|
|
@@ -44,8 +49,6 @@ export type CcsProTableProps<T> = {
|
|
|
44
49
|
toolbarExtra?: ReactElement;
|
|
45
50
|
/** 展开查询条件,默认false */
|
|
46
51
|
expandForm?: boolean;
|
|
47
|
-
/** 禁止收起条件,默认false */
|
|
48
|
-
disableCollapseForm?: boolean;
|
|
49
52
|
/** table 数据区域 */
|
|
50
53
|
table?: CcsTableProps<T>;
|
|
51
54
|
/** table style */
|
package/es/pro-table/table.js
CHANGED
|
@@ -485,7 +485,8 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
485
485
|
formInitValues: formInitValues,
|
|
486
486
|
isInModalOrDrawer: isInModalOrDrawer,
|
|
487
487
|
formItemLabelWidth: props.formItemLabelWidth,
|
|
488
|
-
|
|
488
|
+
formItemLayout: props.formItemLayout,
|
|
489
|
+
formItemCol: props.formItemCol,
|
|
489
490
|
event$: event$,
|
|
490
491
|
onSearch: _onSearch,
|
|
491
492
|
onReset: _onReset,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ccs-ui/rc-pro",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.1.22-beta-2",
|
|
4
|
+
"description": "CcsDatePicker.RangePicker参数bug;CcsProTable删除disableCollapseForm参数;CcsProTable添加formItemLayout,formItemCol参数适应自定义布局",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Hong",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"lint": "npm run lint:es && npm run lint:css",
|
|
22
22
|
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
|
23
23
|
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
24
|
+
"prepare": "husky install && dumi setup",
|
|
24
25
|
"prepublishOnly": "father doctor && npm run build",
|
|
25
26
|
"publish:beta": "father build && npm publish --tag=beta && cnpm sync @ccs-ui/rc-pro",
|
|
26
27
|
"publish:prod": "father build && npm publish && cnpm sync @ccs-ui/rc-pro",
|