doui-react 2.0.6 → 2.0.8
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/api/component/global-style.js +1 -1
- package/es/color-picker/component/index.d.ts +2 -0
- package/es/color-picker/component/index.js +17 -0
- package/es/color-picker/index.d.ts +2 -0
- package/es/color-picker/index.js +2 -0
- package/es/color-picker/type/index.d.ts +7 -0
- package/es/color-picker/type/index.js +1 -0
- package/es/form/component/form-item-map.d.ts +2 -0
- package/es/form/component/form-item-map.js +2 -0
- package/es/form/component/utils.d.ts +16 -16
- package/es/grid/component/pagination.d.ts +12 -12
- package/es/icon/hook/index.d.ts +95 -95
- package/es/index.d.ts +2 -1
- package/es/index.js +1 -0
- package/es/open-modal/component/modal.js +5 -15
- package/es/open-modal/style/index.js +1 -1
- package/es/open-modal/style/wrap.js +1 -1
- package/es/radio/component/abstract-box.d.ts +30 -30
- package/es/table/component/display-column.d.ts +2 -0
- package/es/table/component/display-column.js +95 -0
- package/es/table/component/index.d.ts +2 -0
- package/es/table/component/index.js +3 -1
- package/es/table/component/table.js +6 -3
- package/es/table/component/utils.d.ts +2 -2
- package/es/table/component/utils.js +37 -20
- package/es/table/style/index.d.ts +1 -0
- package/es/table/style/index.js +3 -2
- package/es/table/type/display-column.d.ts +9 -0
- package/es/table/type/display-column.js +1 -0
- package/es/table/type/index.d.ts +6 -0
- package/es/table/type/index.js +1 -0
- package/es/tabs/component/utils.d.ts +7 -7
- package/es/tooltip/component/index.d.ts +13 -14
- package/lib/api/component/global-style.js +1 -1
- package/lib/color-picker/component/index.d.ts +2 -0
- package/lib/color-picker/component/index.js +24 -0
- package/lib/color-picker/index.d.ts +2 -0
- package/lib/color-picker/index.js +27 -0
- package/lib/color-picker/type/index.d.ts +7 -0
- package/lib/color-picker/type/index.js +5 -0
- package/lib/form/component/form-item-map.d.ts +2 -0
- package/lib/form/component/form-item-map.js +2 -0
- package/lib/form/component/utils.d.ts +16 -16
- package/lib/grid/component/pagination.d.ts +12 -12
- package/lib/icon/hook/index.d.ts +95 -95
- package/lib/index.d.ts +2 -1
- package/lib/index.js +8 -0
- package/lib/open-modal/component/modal.js +3 -13
- package/lib/open-modal/style/index.js +1 -1
- package/lib/open-modal/style/wrap.js +1 -1
- package/lib/radio/component/abstract-box.d.ts +30 -30
- package/lib/table/component/display-column.d.ts +2 -0
- package/lib/table/component/display-column.js +102 -0
- package/lib/table/component/index.d.ts +2 -0
- package/lib/table/component/index.js +3 -1
- package/lib/table/component/table.js +5 -2
- package/lib/table/component/utils.d.ts +2 -2
- package/lib/table/component/utils.js +38 -20
- package/lib/table/style/index.d.ts +1 -0
- package/lib/table/style/index.js +3 -2
- package/lib/table/type/display-column.d.ts +9 -0
- package/lib/table/type/display-column.js +5 -0
- package/lib/table/type/index.d.ts +6 -0
- package/lib/table/type/index.js +11 -0
- package/lib/tabs/component/utils.d.ts +7 -7
- package/lib/tooltip/component/index.d.ts +13 -14
- package/package.json +1 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import { getClassName } from "../../api";
|
|
3
2
|
import { Form } from "../../form";
|
|
4
3
|
import { Text } from "../../text";
|
|
5
|
-
import { Modal as AntdModal
|
|
4
|
+
import { Modal as AntdModal } from 'antd';
|
|
6
5
|
import { ModalProvider } from "../hook";
|
|
7
6
|
import { Footer } from "./footer";
|
|
8
7
|
import { Title } from "./title";
|
|
9
8
|
import { useModal } from "./use-modal";
|
|
10
|
-
import { jsx as _jsx
|
|
9
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
11
10
|
export var Modal = function Modal(props) {
|
|
12
11
|
var _useModal = useModal(props),
|
|
13
12
|
context = _useModal.context,
|
|
@@ -18,7 +17,7 @@ export var Modal = function Modal(props) {
|
|
|
18
17
|
ok = context.ok,
|
|
19
18
|
close = context.close;
|
|
20
19
|
return _jsx(ModalProvider, _objectSpread(_objectSpread({}, context), {}, {
|
|
21
|
-
children:
|
|
20
|
+
children: _jsx(AntdModal, _objectSpread(_objectSpread({
|
|
22
21
|
open: open,
|
|
23
22
|
destroyOnHidden: true
|
|
24
23
|
}, modalProps), {}, {
|
|
@@ -28,18 +27,9 @@ export var Modal = function Modal(props) {
|
|
|
28
27
|
confirmLoading: confirmLoading,
|
|
29
28
|
onCancel: close,
|
|
30
29
|
onOk: ok,
|
|
31
|
-
children:
|
|
32
|
-
style: {
|
|
33
|
-
margin: '15px 0 24px'
|
|
34
|
-
}
|
|
35
|
-
}), _jsx(Form, _objectSpread(_objectSpread({}, formProps), {}, {
|
|
30
|
+
children: _jsx(Form, _objectSpread(_objectSpread({}, formProps), {}, {
|
|
36
31
|
context: context
|
|
37
|
-
}))
|
|
38
|
-
className: getClassName('footer-divider'),
|
|
39
|
-
style: {
|
|
40
|
-
margin: '15px 0 20px'
|
|
41
|
-
}
|
|
42
|
-
})]
|
|
32
|
+
}))
|
|
43
33
|
}))
|
|
44
34
|
}));
|
|
45
35
|
};
|
|
@@ -12,7 +12,7 @@ var style = {
|
|
|
12
12
|
wrapper: function wrapper(_ref) {
|
|
13
13
|
var bodyBottomMargin = _ref.bodyBottomMargin,
|
|
14
14
|
titleCenter = _ref.titleCenter;
|
|
15
|
-
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .ant-modal-title {\n font-size: 16px;\n ", "\n }\n\n .ant-modal-body {\n
|
|
15
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .ant-modal-title {\n font-size: 16px;\n ", "\n }\n\n .ant-modal-body {\n overflow: hidden auto;\n max-height: calc(100vh - 300px);\n border-top: 1px solid #f0f0f0;\n border-bottom: 1px solid #f0f0f0;\n margin: 15px 0 20px;\n padding: 20px 0 ", ";\n }\n\n .do-table-wrapper {\n height: unset;\n }\n\n &:not(:has(.ant-modal-footer)) {\n .", " {\n display: none;\n }\n }\n "])), titleStyle(titleCenter), bodyBottomMargin, getClassName('footer-divider'));
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
export default style;
|
|
@@ -2,5 +2,5 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLit
|
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { css } from '@emotion/css';
|
|
4
4
|
export function getWrapStyle(wrapStyle) {
|
|
5
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n "])), wrapStyle);
|
|
5
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n * {\n box-sizing: border-box;\n }\n\n ", "\n "])), wrapStyle);
|
|
6
6
|
}
|
|
@@ -8,8 +8,8 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
|
|
|
8
8
|
color?: string | undefined;
|
|
9
9
|
title?: import("react").ReactNode | import("antd/es/_util/getRenderPropValue").RenderFunction;
|
|
10
10
|
overlay?: import("react").ReactNode | import("antd/es/_util/getRenderPropValue").RenderFunction;
|
|
11
|
-
styles?: Partial<Record<"
|
|
12
|
-
classNames?: Partial<Record<"
|
|
11
|
+
styles?: Partial<Record<"root" | "body", import("react").CSSProperties>> | undefined;
|
|
12
|
+
classNames?: Partial<Record<"root" | "body", string>> | undefined;
|
|
13
13
|
style?: import("react").CSSProperties | undefined;
|
|
14
14
|
className?: string | undefined;
|
|
15
15
|
rootClassName?: string | undefined;
|
|
@@ -36,26 +36,26 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
|
|
|
36
36
|
defaultVisible?: boolean | undefined;
|
|
37
37
|
onVisibleChange?: ((visible: boolean) => void) | undefined;
|
|
38
38
|
afterVisibleChange?: ((visible: boolean) => void) | undefined;
|
|
39
|
-
align?: import("@rc-component/trigger").AlignType | undefined;
|
|
40
|
-
id?: string | undefined;
|
|
41
39
|
prefixCls?: string | undefined;
|
|
42
|
-
|
|
40
|
+
onPopupAlign?: ((element: HTMLElement, align: import("@rc-component/trigger").AlignType) => void) | undefined;
|
|
41
|
+
fresh?: boolean | undefined;
|
|
42
|
+
mouseLeaveDelay?: number | undefined;
|
|
43
|
+
mouseEnterDelay?: number | undefined;
|
|
44
|
+
forceRender?: boolean | undefined;
|
|
45
|
+
popupVisible?: boolean | undefined;
|
|
46
|
+
trigger?: import("@rc-component/trigger").ActionType | import("@rc-component/trigger").ActionType[] | undefined;
|
|
47
|
+
transitionName?: string | undefined;
|
|
43
48
|
animation?: string | undefined;
|
|
44
49
|
motion?: import("rc-motion").CSSMotionProps | undefined;
|
|
45
|
-
transitionName?: string | undefined;
|
|
46
|
-
mouseEnterDelay?: number | undefined;
|
|
47
|
-
mouseLeaveDelay?: number | undefined;
|
|
48
|
-
onPopupAlign?: ((element: HTMLElement, align: import("@rc-component/trigger").AlignType) => void) | undefined;
|
|
49
|
-
overlayClassName?: string | undefined;
|
|
50
50
|
overlayStyle?: import("react").CSSProperties | undefined;
|
|
51
|
-
|
|
52
|
-
popupVisible?: boolean | undefined;
|
|
53
|
-
forceRender?: boolean | undefined;
|
|
54
|
-
fresh?: boolean | undefined;
|
|
51
|
+
overlayClassName?: string | undefined;
|
|
55
52
|
getTooltipContainer?: ((node: HTMLElement) => HTMLElement) | undefined;
|
|
53
|
+
align?: import("@rc-component/trigger").AlignType | undefined;
|
|
56
54
|
showArrow?: boolean | import("@rc-component/trigger").ArrowType | undefined;
|
|
57
55
|
arrowContent?: import("react").ReactNode;
|
|
56
|
+
id?: string | undefined;
|
|
58
57
|
overlayInnerStyle?: import("react").CSSProperties | undefined;
|
|
58
|
+
zIndex?: number | undefined;
|
|
59
59
|
};
|
|
60
60
|
boxProps: {
|
|
61
61
|
onChange(e: CheckboxChangeEvent): void;
|
|
@@ -65,40 +65,40 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
|
|
|
65
65
|
value?: any;
|
|
66
66
|
boxTooltip?: import("react").ReactNode | import("antd").TooltipProps;
|
|
67
67
|
inGroup?: boolean | undefined;
|
|
68
|
-
|
|
68
|
+
prefixCls?: string | undefined;
|
|
69
|
+
disabled?: boolean | undefined;
|
|
69
70
|
className?: string | undefined;
|
|
70
|
-
|
|
71
|
+
style?: import("react").CSSProperties | undefined;
|
|
72
|
+
id?: string | undefined;
|
|
73
|
+
rootClassName?: string | undefined;
|
|
71
74
|
checked?: boolean | undefined;
|
|
72
|
-
disabled?: boolean | undefined;
|
|
73
75
|
name?: string | undefined;
|
|
74
76
|
required?: boolean | undefined;
|
|
77
|
+
type?: string | undefined;
|
|
75
78
|
defaultChecked?: boolean | undefined;
|
|
76
79
|
autoFocus?: boolean | undefined;
|
|
77
|
-
id?: string | undefined;
|
|
78
|
-
style?: import("react").CSSProperties | undefined;
|
|
79
80
|
tabIndex?: number | undefined;
|
|
81
|
+
title?: string | undefined;
|
|
80
82
|
onKeyDown?: import("react").KeyboardEventHandler<HTMLElement> | undefined;
|
|
81
83
|
onKeyPress?: import("react").KeyboardEventHandler<HTMLElement> | undefined;
|
|
82
84
|
onClick?: import("react").MouseEventHandler<HTMLElement> | undefined;
|
|
83
85
|
onMouseEnter?: import("react").MouseEventHandler<HTMLElement> | undefined;
|
|
84
86
|
onMouseLeave?: import("react").MouseEventHandler<HTMLElement> | undefined;
|
|
85
|
-
prefixCls?: string | undefined;
|
|
86
|
-
rootClassName?: string | undefined;
|
|
87
87
|
indeterminate?: boolean | undefined;
|
|
88
88
|
skipGroup?: boolean | undefined;
|
|
89
|
-
hidden?: boolean | undefined;
|
|
90
|
-
onSelect?: import("react").ReactEventHandler<HTMLElement> | undefined;
|
|
91
|
-
rows?: number | false | undefined;
|
|
92
89
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
90
|
+
color?: string | undefined;
|
|
91
|
+
rows?: number | false | undefined;
|
|
93
92
|
suppressContentEditableWarning?: boolean | undefined;
|
|
94
93
|
suppressHydrationWarning?: boolean | undefined;
|
|
95
94
|
accessKey?: string | undefined;
|
|
96
|
-
autoCapitalize?: (string & {}) | "
|
|
95
|
+
autoCapitalize?: (string & {}) | "none" | "off" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
97
96
|
contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
|
|
98
97
|
contextMenu?: string | undefined;
|
|
99
98
|
dir?: string | undefined;
|
|
100
99
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
101
100
|
enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
101
|
+
hidden?: boolean | undefined;
|
|
102
102
|
lang?: string | undefined;
|
|
103
103
|
nonce?: string | undefined;
|
|
104
104
|
slot?: string | undefined;
|
|
@@ -119,7 +119,6 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
|
|
|
119
119
|
vocab?: string | undefined;
|
|
120
120
|
autoCorrect?: string | undefined;
|
|
121
121
|
autoSave?: string | undefined;
|
|
122
|
-
color?: string | undefined;
|
|
123
122
|
itemProp?: string | undefined;
|
|
124
123
|
itemScope?: boolean | undefined;
|
|
125
124
|
itemType?: string | undefined;
|
|
@@ -128,7 +127,7 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
|
|
|
128
127
|
results?: number | undefined;
|
|
129
128
|
security?: string | undefined;
|
|
130
129
|
unselectable?: "off" | "on" | undefined;
|
|
131
|
-
inputMode?: "search" | "
|
|
130
|
+
inputMode?: "search" | "none" | "text" | "email" | "tel" | "url" | "numeric" | "decimal" | undefined;
|
|
132
131
|
is?: string | undefined;
|
|
133
132
|
exportparts?: string | undefined;
|
|
134
133
|
part?: string | undefined;
|
|
@@ -144,7 +143,7 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
|
|
|
144
143
|
"aria-colindextext"?: string | undefined;
|
|
145
144
|
"aria-colspan"?: number | undefined;
|
|
146
145
|
"aria-controls"?: string | undefined;
|
|
147
|
-
"aria-current"?: boolean | "step" | "
|
|
146
|
+
"aria-current"?: boolean | "step" | "true" | "false" | "page" | "location" | "date" | "time" | undefined;
|
|
148
147
|
"aria-describedby"?: string | undefined;
|
|
149
148
|
"aria-description"?: string | undefined;
|
|
150
149
|
"aria-details"?: string | undefined;
|
|
@@ -154,7 +153,7 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
|
|
|
154
153
|
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
155
154
|
"aria-flowto"?: string | undefined;
|
|
156
155
|
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
157
|
-
"aria-haspopup"?: boolean | "
|
|
156
|
+
"aria-haspopup"?: boolean | "true" | "false" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
|
158
157
|
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
159
158
|
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
160
159
|
"aria-keyshortcuts"?: string | undefined;
|
|
@@ -171,7 +170,7 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
|
|
|
171
170
|
"aria-posinset"?: number | undefined;
|
|
172
171
|
"aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
173
172
|
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
174
|
-
"aria-relevant"?: "
|
|
173
|
+
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
|
|
175
174
|
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
176
175
|
"aria-roledescription"?: string | undefined;
|
|
177
176
|
"aria-rowcount"?: number | undefined;
|
|
@@ -298,6 +297,7 @@ export declare function useAbstractBox({ refs, boxTooltip, value, onChange, inGr
|
|
|
298
297
|
onMouseOverCapture?: import("react").MouseEventHandler<HTMLElement> | undefined;
|
|
299
298
|
onMouseUp?: import("react").MouseEventHandler<HTMLElement> | undefined;
|
|
300
299
|
onMouseUpCapture?: import("react").MouseEventHandler<HTMLElement> | undefined;
|
|
300
|
+
onSelect?: import("react").ReactEventHandler<HTMLElement> | undefined;
|
|
301
301
|
onSelectCapture?: import("react").ReactEventHandler<HTMLElement> | undefined;
|
|
302
302
|
onTouchCancel?: import("react").TouchEventHandler<HTMLElement> | undefined;
|
|
303
303
|
onTouchCancelCapture?: import("react").TouchEventHandler<HTMLElement> | undefined;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
var _excluded = ["value", "onChange", "storageKey"];
|
|
5
|
+
import { getPopupContainer } from "../../api";
|
|
6
|
+
import { Button } from "../../button";
|
|
7
|
+
import { Checkbox } from "../../checkbox";
|
|
8
|
+
import { useTableContext } from "./..";
|
|
9
|
+
import { SettingOutlined } from '@ant-design/icons';
|
|
10
|
+
import { Popover } from 'antd';
|
|
11
|
+
import _ from 'lodash';
|
|
12
|
+
import { useEffect } from 'react';
|
|
13
|
+
import { useLocalStorage } from 'react-use';
|
|
14
|
+
import style from "../style";
|
|
15
|
+
import { isActionsColumn } from "./utils";
|
|
16
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
17
|
+
function useControllableState(_ref) {
|
|
18
|
+
var value = _ref.value,
|
|
19
|
+
onChange = _ref.onChange,
|
|
20
|
+
_ref$storageKey = _ref.storageKey,
|
|
21
|
+
storageKey = _ref$storageKey === void 0 ? 'default' : _ref$storageKey,
|
|
22
|
+
defaultOptions = _ref.defaultOptions;
|
|
23
|
+
var finalStorageKey = "table-display-column-".concat(storageKey);
|
|
24
|
+
var _useLocalStorage = useLocalStorage(finalStorageKey, defaultOptions),
|
|
25
|
+
_useLocalStorage2 = _slicedToArray(_useLocalStorage, 2),
|
|
26
|
+
internalValue = _useLocalStorage2[0],
|
|
27
|
+
setInternalValue = _useLocalStorage2[1];
|
|
28
|
+
var _useTableContext = useTableContext(),
|
|
29
|
+
setContext = _useTableContext.setContext;
|
|
30
|
+
var finalValue = value !== null && value !== void 0 ? value : internalValue;
|
|
31
|
+
useEffect(function () {
|
|
32
|
+
setContext({
|
|
33
|
+
displayColumnKeys: finalValue
|
|
34
|
+
});
|
|
35
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
|
+
}, [finalValue]);
|
|
37
|
+
return {
|
|
38
|
+
value: finalValue,
|
|
39
|
+
onChange: onChange !== null && onChange !== void 0 ? onChange : setInternalValue
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function useOptions() {
|
|
43
|
+
var _useTableContext2 = useTableContext(),
|
|
44
|
+
columns = _useTableContext2.columns;
|
|
45
|
+
var options = _.filter(columns, function (column) {
|
|
46
|
+
return column.title && !isActionsColumn(column);
|
|
47
|
+
}).map(function (column) {
|
|
48
|
+
return {
|
|
49
|
+
label: column.title,
|
|
50
|
+
value: column.dataIndex
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
options: options,
|
|
55
|
+
defaultOptions: _.map(options, 'value')
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function Content(props) {
|
|
59
|
+
var _useOptions = useOptions(),
|
|
60
|
+
options = _useOptions.options,
|
|
61
|
+
defaultOptions = _useOptions.defaultOptions;
|
|
62
|
+
var _useControllableState = useControllableState(_objectSpread(_objectSpread({}, props), {}, {
|
|
63
|
+
defaultOptions: defaultOptions
|
|
64
|
+
})),
|
|
65
|
+
value = _useControllableState.value,
|
|
66
|
+
onChange = _useControllableState.onChange;
|
|
67
|
+
return _jsx(Checkbox, {
|
|
68
|
+
value: value,
|
|
69
|
+
onChange: onChange,
|
|
70
|
+
options: options,
|
|
71
|
+
sort: false,
|
|
72
|
+
css: style.displayColumn
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export function DisplayColumn(_ref2) {
|
|
76
|
+
var value = _ref2.value,
|
|
77
|
+
onChange = _ref2.onChange,
|
|
78
|
+
storageKey = _ref2.storageKey,
|
|
79
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
80
|
+
return _jsx(Popover, {
|
|
81
|
+
placement: "bottomRight",
|
|
82
|
+
arrow: false,
|
|
83
|
+
trigger: "click",
|
|
84
|
+
forceRender: true,
|
|
85
|
+
getPopupContainer: getPopupContainer,
|
|
86
|
+
content: _jsx(Content, {
|
|
87
|
+
value: value,
|
|
88
|
+
onChange: onChange,
|
|
89
|
+
storageKey: storageKey
|
|
90
|
+
}),
|
|
91
|
+
children: _jsx(Button, _objectSpread({
|
|
92
|
+
icon: _jsx(SettingOutlined, {})
|
|
93
|
+
}, props))
|
|
94
|
+
});
|
|
95
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ActionButton } from './action-button';
|
|
2
|
+
import { DisplayColumn } from './display-column';
|
|
2
3
|
import { Table as InternalTable } from './table';
|
|
3
4
|
type TableType = typeof InternalTable & {
|
|
4
5
|
ActionButton: typeof ActionButton;
|
|
6
|
+
DisplayColumn: typeof DisplayColumn;
|
|
5
7
|
};
|
|
6
8
|
export declare const Table: TableType;
|
|
7
9
|
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ActionButton } from "./action-button";
|
|
2
|
+
import { DisplayColumn } from "./display-column";
|
|
2
3
|
import { Table as InternalTable } from "./table";
|
|
3
4
|
export var Table = InternalTable;
|
|
4
|
-
Table.ActionButton = ActionButton;
|
|
5
|
+
Table.ActionButton = ActionButton;
|
|
6
|
+
Table.DisplayColumn = DisplayColumn;
|
|
@@ -7,11 +7,12 @@ var _excluded = ["rowKey", "loading", "columns", "dataSource", "editorValueKey"]
|
|
|
7
7
|
_excluded2 = ["onlyLoading"],
|
|
8
8
|
_excluded3 = ["onRowClick", "width", "emptyText"],
|
|
9
9
|
_excluded4 = ["useFormWrapper", "context", "maxHeight"];
|
|
10
|
-
import { executeFunction, includesNonStrictMode } from "../../api";
|
|
10
|
+
import { executeFunction, getClassName, includesNonStrictMode } from "../../api";
|
|
11
11
|
import { Empty } from "../../empty";
|
|
12
12
|
import { Form, useFormContext } from "../../form";
|
|
13
13
|
import { useListOperation } from "../../hooks";
|
|
14
14
|
import { TableProvider, useSearchColumn } from "./..";
|
|
15
|
+
import { cx } from '@emotion/css';
|
|
15
16
|
import _ from 'lodash';
|
|
16
17
|
import { useEffect, useState } from 'react';
|
|
17
18
|
import { useSetState } from 'react-use';
|
|
@@ -103,6 +104,7 @@ function useInit(_ref2) {
|
|
|
103
104
|
},
|
|
104
105
|
operation: operation,
|
|
105
106
|
rowKey: rowKey,
|
|
107
|
+
columns: columns,
|
|
106
108
|
editorValueKey: editorValueKey
|
|
107
109
|
});
|
|
108
110
|
function updateSelectedStatus(keys) {
|
|
@@ -187,7 +189,8 @@ export function useTable(_ref4) {
|
|
|
187
189
|
columns: _.reject(restProps.columns, {
|
|
188
190
|
type: 'selection'
|
|
189
191
|
}),
|
|
190
|
-
getSearchColumn: getSearchColumn
|
|
192
|
+
getSearchColumn: getSearchColumn,
|
|
193
|
+
context: params.context
|
|
191
194
|
});
|
|
192
195
|
return _objectSpread(_objectSpread(_objectSpread({
|
|
193
196
|
onRow: function onRow(record) {
|
|
@@ -233,7 +236,7 @@ export function Table(props) {
|
|
|
233
236
|
}
|
|
234
237
|
return _jsx("div", {
|
|
235
238
|
css: styles.wrapper(maxHeight),
|
|
236
|
-
className: formProps.className,
|
|
239
|
+
className: cx(getClassName('table-wrapper'), formProps.className),
|
|
237
240
|
style: formProps.style,
|
|
238
241
|
children: _jsx(TableBody, _objectSpread({}, restProps))
|
|
239
242
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FormInstance, FormProps } from "../../form";
|
|
2
|
-
import type { ColumnType } from 'antd/es/table';
|
|
3
2
|
import type { TableRowSelection } from 'antd/es/table/interface';
|
|
4
3
|
import { Column, DataSource, GetSearchColumn, TableContext, TableProps } from '../type';
|
|
5
4
|
import { Actions } from './actions';
|
|
@@ -20,7 +19,8 @@ export declare const componentMap: {
|
|
|
20
19
|
editor: typeof Editor;
|
|
21
20
|
default: (props: any) => any;
|
|
22
21
|
};
|
|
23
|
-
export declare function
|
|
22
|
+
export declare function isActionsColumn(column: Column): boolean;
|
|
23
|
+
export declare function generateColumns({ columns, getSearchColumn, context }: GenerateColumnsProps): Column[];
|
|
24
24
|
interface RowSelectionProps {
|
|
25
25
|
rowKey: string;
|
|
26
26
|
columns: Column[];
|
|
@@ -27,9 +27,22 @@ export var componentMap = {
|
|
|
27
27
|
return props.children;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
|
|
30
|
+
function isHiddenColumn(_ref) {
|
|
31
|
+
var context = _ref.context,
|
|
32
|
+
column = _ref.column;
|
|
33
|
+
var displayColumnKeys = _.get(context, 'displayColumnKeys');
|
|
34
|
+
if (!displayColumnKeys || isActionsColumn(column)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
return !_.includes(displayColumnKeys, column.dataIndex);
|
|
38
|
+
}
|
|
39
|
+
export function isActionsColumn(column) {
|
|
40
|
+
return column.type === 'actions';
|
|
41
|
+
}
|
|
42
|
+
export function generateColumns(_ref2) {
|
|
43
|
+
var columns = _ref2.columns,
|
|
44
|
+
getSearchColumn = _ref2.getSearchColumn,
|
|
45
|
+
context = _ref2.context;
|
|
33
46
|
return _.map(columns, function (column) {
|
|
34
47
|
var newColumn = _.clone(column);
|
|
35
48
|
var dataIndex = newColumn.dataIndex,
|
|
@@ -55,7 +68,7 @@ export function generateColumns(_ref) {
|
|
|
55
68
|
if (!_.isEmpty(filters)) {
|
|
56
69
|
_.assign(newColumn, getFilterColumn(newColumn));
|
|
57
70
|
}
|
|
58
|
-
if (newColumn
|
|
71
|
+
if (isActionsColumn(newColumn)) {
|
|
59
72
|
var _newColumn$fixed;
|
|
60
73
|
(_newColumn$fixed = newColumn.fixed) !== null && _newColumn$fixed !== void 0 ? _newColumn$fixed : newColumn.fixed = 'right';
|
|
61
74
|
}
|
|
@@ -84,6 +97,10 @@ export function generateColumns(_ref) {
|
|
|
84
97
|
};
|
|
85
98
|
return _objectSpread(_objectSpread({}, newColumn), {}, {
|
|
86
99
|
dataIndex: transformNameToPath(dataIndex),
|
|
100
|
+
hidden: isHiddenColumn({
|
|
101
|
+
context: context,
|
|
102
|
+
column: newColumn
|
|
103
|
+
}),
|
|
87
104
|
align: align,
|
|
88
105
|
render: render
|
|
89
106
|
});
|
|
@@ -110,10 +127,10 @@ function renderComponent(props) {
|
|
|
110
127
|
children: _jsx(Component, _objectSpread({}, props))
|
|
111
128
|
}));
|
|
112
129
|
}
|
|
113
|
-
function getColumnWidth(
|
|
114
|
-
var width =
|
|
115
|
-
minWidth =
|
|
116
|
-
maxWidth =
|
|
130
|
+
function getColumnWidth(_ref3) {
|
|
131
|
+
var width = _ref3.width,
|
|
132
|
+
minWidth = _ref3.minWidth,
|
|
133
|
+
maxWidth = _ref3.maxWidth;
|
|
117
134
|
var style;
|
|
118
135
|
if (_.isNil(width)) {
|
|
119
136
|
style = {
|
|
@@ -132,10 +149,10 @@ function getColumnWidth(_ref2) {
|
|
|
132
149
|
}
|
|
133
150
|
};
|
|
134
151
|
}
|
|
135
|
-
export function getRowSelection(
|
|
136
|
-
var rowKey =
|
|
137
|
-
columns =
|
|
138
|
-
context =
|
|
152
|
+
export function getRowSelection(_ref4) {
|
|
153
|
+
var rowKey = _ref4.rowKey,
|
|
154
|
+
columns = _ref4.columns,
|
|
155
|
+
context = _ref4.context;
|
|
139
156
|
var column = _.find(columns, {
|
|
140
157
|
type: 'selection'
|
|
141
158
|
});
|
|
@@ -196,10 +213,10 @@ export function getTableAndFormProps(props) {
|
|
|
196
213
|
tableProps: tableProps
|
|
197
214
|
};
|
|
198
215
|
}
|
|
199
|
-
export function isUseFormWrapper(
|
|
200
|
-
var columns =
|
|
201
|
-
context =
|
|
202
|
-
form =
|
|
216
|
+
export function isUseFormWrapper(_ref5) {
|
|
217
|
+
var columns = _ref5.columns,
|
|
218
|
+
context = _ref5.context,
|
|
219
|
+
form = _ref5.form;
|
|
203
220
|
// 在 Form 中时,将 context 挂载给 formContext
|
|
204
221
|
if (form) {
|
|
205
222
|
_.assign(form.getContext(), context);
|
|
@@ -209,10 +226,10 @@ export function isUseFormWrapper(_ref4) {
|
|
|
209
226
|
type: 'editor'
|
|
210
227
|
});
|
|
211
228
|
}
|
|
212
|
-
export function getTableFormInitialValues(
|
|
213
|
-
var rowKey =
|
|
214
|
-
columns =
|
|
215
|
-
dataSource =
|
|
229
|
+
export function getTableFormInitialValues(_ref6) {
|
|
230
|
+
var rowKey = _ref6.rowKey,
|
|
231
|
+
columns = _ref6.columns,
|
|
232
|
+
dataSource = _ref6.dataSource;
|
|
216
233
|
var dataIndex = _.map(columns, function (col) {
|
|
217
234
|
return col.type === 'editor' && col.dataIndex;
|
|
218
235
|
});
|
|
@@ -5,5 +5,6 @@ declare const style: {
|
|
|
5
5
|
ellipsisText: (rows: number) => import("@emotion/react").SerializedStyles;
|
|
6
6
|
editor: import("@emotion/react").SerializedStyles;
|
|
7
7
|
divider: import("@emotion/react").SerializedStyles;
|
|
8
|
+
displayColumn: import("@emotion/react").SerializedStyles;
|
|
8
9
|
};
|
|
9
10
|
export default style;
|
package/es/table/style/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
3
3
|
import { transformValueWithStyleUnit } from "../../api";
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
var style = {
|
|
@@ -11,6 +11,7 @@ var style = {
|
|
|
11
11
|
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n -webkit-line-clamp: ", " !important;\n "])), rows);
|
|
12
12
|
},
|
|
13
13
|
editor: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-bottom: 0;\n\n .ant-form-item-label {\n display: none !important;\n }\n "]))),
|
|
14
|
-
divider: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: 0;\n "])))
|
|
14
|
+
divider: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: 0;\n "]))),
|
|
15
|
+
displayColumn: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n & {\n flex-direction: column;\n max-width: 200px;\n }\n\n .do-checkbox-all {\n padding-bottom: 10px;\n border-bottom: 1px solid #f0f0f0;\n }\n\n .ant-checkbox-group {\n flex-direction: column;\n width: 100%;\n }\n\n .do-checkbox,\n .do-box-label {\n width: 100%;\n }\n "])))
|
|
15
16
|
};
|
|
16
17
|
export default style;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/table/type/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { TableProps as AntdTableProps } from 'antd';
|
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
7
|
export * from './action';
|
|
8
8
|
export * from './column';
|
|
9
|
+
export * from './display-column';
|
|
9
10
|
export type DataSource = any[];
|
|
10
11
|
export interface TableContext {
|
|
11
12
|
/**
|
|
@@ -37,8 +38,13 @@ export interface TableContext {
|
|
|
37
38
|
* @description 设置表格上下文
|
|
38
39
|
*/
|
|
39
40
|
setContext(state: any): void;
|
|
41
|
+
/**
|
|
42
|
+
* @description 列配置
|
|
43
|
+
*/
|
|
44
|
+
columns: Column[];
|
|
40
45
|
rowKey: string;
|
|
41
46
|
editorValueKey: string;
|
|
47
|
+
displayColumnKeys?: string[];
|
|
42
48
|
[key: string]: any;
|
|
43
49
|
}
|
|
44
50
|
export interface RefreshProps {
|
package/es/table/type/index.js
CHANGED
|
@@ -6,19 +6,19 @@ export declare function getRenderTabBar({ type, items, size, tabBarGutter, tabBa
|
|
|
6
6
|
export declare function generateTabItems({ items }: TabsProps): {
|
|
7
7
|
label: import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
8
|
key: string;
|
|
9
|
-
|
|
9
|
+
prefixCls?: string | undefined;
|
|
10
10
|
disabled?: boolean | undefined;
|
|
11
|
-
|
|
11
|
+
className?: string | undefined;
|
|
12
12
|
style?: import("react").CSSProperties | undefined;
|
|
13
13
|
children?: import("react").ReactNode;
|
|
14
|
-
prefixCls?: string | undefined;
|
|
15
|
-
closable?: boolean | undefined;
|
|
16
|
-
closeIcon?: import("react").ReactNode;
|
|
17
|
-
active?: boolean | undefined;
|
|
18
|
-
icon?: import("react").ReactNode;
|
|
19
14
|
forceRender?: boolean | undefined;
|
|
15
|
+
id?: string | undefined;
|
|
20
16
|
destroyInactiveTabPane?: boolean | undefined;
|
|
21
17
|
animated?: boolean | undefined;
|
|
18
|
+
closable?: boolean | undefined;
|
|
19
|
+
closeIcon?: import("react").ReactNode;
|
|
20
|
+
icon?: import("react").ReactNode;
|
|
22
21
|
tabKey?: string | undefined;
|
|
22
|
+
active?: boolean | undefined;
|
|
23
23
|
}[];
|
|
24
24
|
export {};
|