doui-react 2.0.7 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/es/color-picker/component/index.d.ts +2 -0
  2. package/es/color-picker/component/index.js +17 -0
  3. package/es/color-picker/index.d.ts +2 -0
  4. package/es/color-picker/index.js +2 -0
  5. package/es/color-picker/type/index.d.ts +7 -0
  6. package/es/color-picker/type/index.js +1 -0
  7. package/es/form/component/form-item-map.d.ts +2 -0
  8. package/es/form/component/form-item-map.js +2 -0
  9. package/es/form/component/utils.d.ts +8 -8
  10. package/es/index.d.ts +2 -1
  11. package/es/index.js +1 -0
  12. package/es/open-modal/style/index.js +1 -1
  13. package/es/radio/component/abstract-box.d.ts +30 -30
  14. package/es/table/component/display-column.d.ts +2 -0
  15. package/es/table/component/display-column.js +95 -0
  16. package/es/table/component/index.d.ts +2 -0
  17. package/es/table/component/index.js +3 -1
  18. package/es/table/component/table.js +59 -63
  19. package/es/table/component/utils.d.ts +2 -2
  20. package/es/table/component/utils.js +37 -20
  21. package/es/table/style/index.d.ts +1 -0
  22. package/es/table/style/index.js +3 -2
  23. package/es/table/type/display-column.d.ts +9 -0
  24. package/es/table/type/display-column.js +1 -0
  25. package/es/table/type/index.d.ts +6 -0
  26. package/es/table/type/index.js +1 -0
  27. package/es/tabs/component/utils.d.ts +7 -7
  28. package/lib/color-picker/component/index.d.ts +2 -0
  29. package/lib/color-picker/component/index.js +24 -0
  30. package/lib/color-picker/index.d.ts +2 -0
  31. package/lib/color-picker/index.js +27 -0
  32. package/lib/color-picker/type/index.d.ts +7 -0
  33. package/lib/color-picker/type/index.js +5 -0
  34. package/lib/form/component/form-item-map.d.ts +2 -0
  35. package/lib/form/component/form-item-map.js +2 -0
  36. package/lib/form/component/utils.d.ts +8 -8
  37. package/lib/index.d.ts +2 -1
  38. package/lib/index.js +8 -0
  39. package/lib/open-modal/style/index.js +1 -1
  40. package/lib/radio/component/abstract-box.d.ts +30 -30
  41. package/lib/table/component/display-column.d.ts +2 -0
  42. package/lib/table/component/display-column.js +102 -0
  43. package/lib/table/component/index.d.ts +2 -0
  44. package/lib/table/component/index.js +3 -1
  45. package/lib/table/component/table.js +58 -62
  46. package/lib/table/component/utils.d.ts +2 -2
  47. package/lib/table/component/utils.js +38 -20
  48. package/lib/table/style/index.d.ts +1 -0
  49. package/lib/table/style/index.js +3 -2
  50. package/lib/table/type/display-column.d.ts +9 -0
  51. package/lib/table/type/display-column.js +5 -0
  52. package/lib/table/type/index.d.ts +6 -0
  53. package/lib/table/type/index.js +11 -0
  54. package/lib/tabs/component/utils.d.ts +7 -7
  55. package/package.json +1 -1
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.DisplayColumn = DisplayColumn;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ var _api = require("../../api");
12
+ var _button = require("../../button");
13
+ var _checkbox = require("../../checkbox");
14
+ var _2 = require("./..");
15
+ var _icons = require("@ant-design/icons");
16
+ var _antd = require("antd");
17
+ var _lodash = _interopRequireDefault(require("lodash"));
18
+ var _react = require("react");
19
+ var _reactUse = require("react-use");
20
+ var _style = _interopRequireDefault(require("../style"));
21
+ var _utils = require("./utils");
22
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
23
+ var _excluded = ["value", "onChange", "storageKey"];
24
+ function useControllableState(_ref) {
25
+ var value = _ref.value,
26
+ onChange = _ref.onChange,
27
+ _ref$storageKey = _ref.storageKey,
28
+ storageKey = _ref$storageKey === void 0 ? 'default' : _ref$storageKey,
29
+ defaultOptions = _ref.defaultOptions;
30
+ var finalStorageKey = "table-display-column-".concat(storageKey);
31
+ var _useLocalStorage = (0, _reactUse.useLocalStorage)(finalStorageKey, defaultOptions),
32
+ _useLocalStorage2 = (0, _slicedToArray2.default)(_useLocalStorage, 2),
33
+ internalValue = _useLocalStorage2[0],
34
+ setInternalValue = _useLocalStorage2[1];
35
+ var _useTableContext = (0, _2.useTableContext)(),
36
+ setContext = _useTableContext.setContext;
37
+ var finalValue = value !== null && value !== void 0 ? value : internalValue;
38
+ (0, _react.useEffect)(function () {
39
+ setContext({
40
+ displayColumnKeys: finalValue
41
+ });
42
+ // eslint-disable-next-line react-hooks/exhaustive-deps
43
+ }, [finalValue]);
44
+ return {
45
+ value: finalValue,
46
+ onChange: onChange !== null && onChange !== void 0 ? onChange : setInternalValue
47
+ };
48
+ }
49
+ function useOptions() {
50
+ var _useTableContext2 = (0, _2.useTableContext)(),
51
+ columns = _useTableContext2.columns;
52
+ var options = _lodash.default.filter(columns, function (column) {
53
+ return column.title && !(0, _utils.isActionsColumn)(column);
54
+ }).map(function (column) {
55
+ return {
56
+ label: column.title,
57
+ value: column.dataIndex
58
+ };
59
+ });
60
+ return {
61
+ options: options,
62
+ defaultOptions: _lodash.default.map(options, 'value')
63
+ };
64
+ }
65
+ function Content(props) {
66
+ var _useOptions = useOptions(),
67
+ options = _useOptions.options,
68
+ defaultOptions = _useOptions.defaultOptions;
69
+ var _useControllableState = useControllableState((0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
70
+ defaultOptions: defaultOptions
71
+ })),
72
+ value = _useControllableState.value,
73
+ onChange = _useControllableState.onChange;
74
+ return (0, _jsxRuntime.jsx)(_checkbox.Checkbox, {
75
+ value: value,
76
+ onChange: onChange,
77
+ options: options,
78
+ sort: false,
79
+ css: _style.default.displayColumn
80
+ });
81
+ }
82
+ function DisplayColumn(_ref2) {
83
+ var value = _ref2.value,
84
+ onChange = _ref2.onChange,
85
+ storageKey = _ref2.storageKey,
86
+ props = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
87
+ return (0, _jsxRuntime.jsx)(_antd.Popover, {
88
+ placement: "bottomRight",
89
+ arrow: false,
90
+ trigger: "click",
91
+ forceRender: true,
92
+ getPopupContainer: _api.getPopupContainer,
93
+ content: (0, _jsxRuntime.jsx)(Content, {
94
+ value: value,
95
+ onChange: onChange,
96
+ storageKey: storageKey
97
+ }),
98
+ children: (0, _jsxRuntime.jsx)(_button.Button, (0, _objectSpread2.default)({
99
+ icon: (0, _jsxRuntime.jsx)(_icons.SettingOutlined, {})
100
+ }, props))
101
+ });
102
+ }
@@ -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 {};
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Table = void 0;
7
7
  var _actionButton = require("./action-button");
8
+ var _displayColumn = require("./display-column");
8
9
  var _table = require("./table");
9
10
  var Table = exports.Table = _table.Table;
10
- Table.ActionButton = _actionButton.ActionButton;
11
+ Table.ActionButton = _actionButton.ActionButton;
12
+ Table.DisplayColumn = _displayColumn.DisplayColumn;
@@ -95,11 +95,51 @@ function useInit(_ref2) {
95
95
  value: dataSource,
96
96
  onChange: setDataSource
97
97
  });
98
-
99
- // eslint-disable-next-line react-hooks/exhaustive-deps
100
- (0, _react.useEffect)(function () {
101
- return void refresh();
102
- }, [data]);
98
+ var updateSelectedStatus = (0, _hooks.useMemoFn)(function (keys) {
99
+ var data = _lodash.default.map(dataSource, function (item) {
100
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
101
+ __selected__: (0, _api.includesNonStrictMode)(keys, item[rowKey])
102
+ });
103
+ });
104
+ setDataSource(data);
105
+ });
106
+ var refresh = (0, _hooks.useMemoFn)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
107
+ var _ref4,
108
+ onlyLoading,
109
+ params,
110
+ _yield$Promise$all,
111
+ _yield$Promise$all2,
112
+ res,
113
+ _args2 = arguments;
114
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
115
+ while (1) switch (_context2.prev = _context2.next) {
116
+ case 0:
117
+ _ref4 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, onlyLoading = _ref4.onlyLoading, params = (0, _objectWithoutProperties2.default)(_ref4, _excluded2);
118
+ setLoading(true);
119
+ if (!onlyLoading) {
120
+ _context2.next = 4;
121
+ break;
122
+ }
123
+ return _context2.abrupt("return");
124
+ case 4:
125
+ _context2.prev = 4;
126
+ _context2.next = 7;
127
+ return Promise.all([(0, _api.executeFunction)(data, params), getInitialContext(params)]);
128
+ case 7:
129
+ _yield$Promise$all = _context2.sent;
130
+ _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1);
131
+ res = _yield$Promise$all2[0];
132
+ setDataSource(res || []);
133
+ case 11:
134
+ _context2.prev = 11;
135
+ setLoading(false);
136
+ return _context2.finish(11);
137
+ case 14:
138
+ case "end":
139
+ return _context2.stop();
140
+ }
141
+ }, _callee2, null, [[4,, 11, 14]]);
142
+ })));
103
143
  var context = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, contexts), {}, {
104
144
  refresh: refresh,
105
145
  dataSource: dataSource,
@@ -112,59 +152,14 @@ function useInit(_ref2) {
112
152
  },
113
153
  operation: operation,
114
154
  rowKey: rowKey,
155
+ columns: columns,
115
156
  editorValueKey: editorValueKey
116
157
  });
117
- function updateSelectedStatus(keys) {
118
- var data = _lodash.default.map(dataSource, function (item) {
119
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
120
- __selected__: (0, _api.includesNonStrictMode)(keys, item[rowKey])
121
- });
122
- });
123
- setDataSource(data);
124
- }
125
- function refresh() {
126
- return _refresh.apply(this, arguments);
127
- }
128
- function _refresh() {
129
- _refresh = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
130
- var _ref3,
131
- onlyLoading,
132
- params,
133
- _yield$Promise$all,
134
- _yield$Promise$all2,
135
- res,
136
- _args2 = arguments;
137
- return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
138
- while (1) switch (_context2.prev = _context2.next) {
139
- case 0:
140
- _ref3 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, onlyLoading = _ref3.onlyLoading, params = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
141
- setLoading(true);
142
- if (!onlyLoading) {
143
- _context2.next = 4;
144
- break;
145
- }
146
- return _context2.abrupt("return");
147
- case 4:
148
- _context2.prev = 4;
149
- _context2.next = 7;
150
- return Promise.all([(0, _api.executeFunction)(data, params), getInitialContext(params)]);
151
- case 7:
152
- _yield$Promise$all = _context2.sent;
153
- _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1);
154
- res = _yield$Promise$all2[0];
155
- setDataSource(res || []);
156
- case 11:
157
- _context2.prev = 11;
158
- setLoading(false);
159
- return _context2.finish(11);
160
- case 14:
161
- case "end":
162
- return _context2.stop();
163
- }
164
- }, _callee2, null, [[4,, 11, 14]]);
165
- }));
166
- return _refresh.apply(this, arguments);
167
- }
158
+
159
+ // eslint-disable-next-line react-hooks/exhaustive-deps
160
+ (0, _react.useEffect)(function () {
161
+ return void refresh();
162
+ }, [data]);
168
163
  var rowSelection = (0, _utils.getRowSelection)({
169
164
  rowKey: rowKey,
170
165
  columns: columns,
@@ -184,11 +179,11 @@ function useInit(_ref2) {
184
179
  useFormWrapper: useFormWrapper
185
180
  };
186
181
  }
187
- function useTable(_ref4) {
188
- var onRowClick = _ref4.onRowClick,
189
- width = _ref4.width,
190
- emptyText = _ref4.emptyText,
191
- restProps = (0, _objectWithoutProperties2.default)(_ref4, _excluded3);
182
+ function useTable(_ref5) {
183
+ var onRowClick = _ref5.onRowClick,
184
+ width = _ref5.width,
185
+ emptyText = _ref5.emptyText,
186
+ restProps = (0, _objectWithoutProperties2.default)(_ref5, _excluded3);
192
187
  var params = useInit(restProps);
193
188
  var _useSearchColumn = (0, _2.useSearchColumn)(),
194
189
  getSearchColumn = _useSearchColumn.getSearchColumn;
@@ -196,7 +191,8 @@ function useTable(_ref4) {
196
191
  columns: _lodash.default.reject(restProps.columns, {
197
192
  type: 'selection'
198
193
  }),
199
- getSearchColumn: getSearchColumn
194
+ getSearchColumn: getSearchColumn,
195
+ context: params.context
200
196
  });
201
197
  return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
202
198
  onRow: function onRow(record) {
@@ -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 generateColumns({ columns, getSearchColumn }: GenerateColumnsProps): ColumnType<any>[];
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[];
@@ -9,6 +9,7 @@ exports.generateColumns = generateColumns;
9
9
  exports.getRowSelection = getRowSelection;
10
10
  exports.getTableAndFormProps = getTableAndFormProps;
11
11
  exports.getTableFormInitialValues = getTableFormInitialValues;
12
+ exports.isActionsColumn = isActionsColumn;
12
13
  exports.isUseFormWrapper = isUseFormWrapper;
13
14
  exports.updateDataSourceByFormValues = updateDataSourceByFormValues;
14
15
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -40,9 +41,22 @@ var componentMap = exports.componentMap = {
40
41
  return props.children;
41
42
  }
42
43
  };
43
- function generateColumns(_ref) {
44
- var columns = _ref.columns,
45
- getSearchColumn = _ref.getSearchColumn;
44
+ function isHiddenColumn(_ref) {
45
+ var context = _ref.context,
46
+ column = _ref.column;
47
+ var displayColumnKeys = _lodash.default.get(context, 'displayColumnKeys');
48
+ if (!displayColumnKeys || isActionsColumn(column)) {
49
+ return;
50
+ }
51
+ return !_lodash.default.includes(displayColumnKeys, column.dataIndex);
52
+ }
53
+ function isActionsColumn(column) {
54
+ return column.type === 'actions';
55
+ }
56
+ function generateColumns(_ref2) {
57
+ var columns = _ref2.columns,
58
+ getSearchColumn = _ref2.getSearchColumn,
59
+ context = _ref2.context;
46
60
  return _lodash.default.map(columns, function (column) {
47
61
  var newColumn = _lodash.default.clone(column);
48
62
  var dataIndex = newColumn.dataIndex,
@@ -68,7 +82,7 @@ function generateColumns(_ref) {
68
82
  if (!_lodash.default.isEmpty(filters)) {
69
83
  _lodash.default.assign(newColumn, (0, _filter.getFilterColumn)(newColumn));
70
84
  }
71
- if (newColumn.type === 'actions') {
85
+ if (isActionsColumn(newColumn)) {
72
86
  var _newColumn$fixed;
73
87
  (_newColumn$fixed = newColumn.fixed) !== null && _newColumn$fixed !== void 0 ? _newColumn$fixed : newColumn.fixed = 'right';
74
88
  }
@@ -97,6 +111,10 @@ function generateColumns(_ref) {
97
111
  };
98
112
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, newColumn), {}, {
99
113
  dataIndex: (0, _utils.transformNameToPath)(dataIndex),
114
+ hidden: isHiddenColumn({
115
+ context: context,
116
+ column: newColumn
117
+ }),
100
118
  align: align,
101
119
  render: render
102
120
  });
@@ -123,10 +141,10 @@ function renderComponent(props) {
123
141
  children: (0, _jsxRuntime.jsx)(Component, (0, _objectSpread2.default)({}, props))
124
142
  }));
125
143
  }
126
- function getColumnWidth(_ref2) {
127
- var width = _ref2.width,
128
- minWidth = _ref2.minWidth,
129
- maxWidth = _ref2.maxWidth;
144
+ function getColumnWidth(_ref3) {
145
+ var width = _ref3.width,
146
+ minWidth = _ref3.minWidth,
147
+ maxWidth = _ref3.maxWidth;
130
148
  var style;
131
149
  if (_lodash.default.isNil(width)) {
132
150
  style = {
@@ -145,10 +163,10 @@ function getColumnWidth(_ref2) {
145
163
  }
146
164
  };
147
165
  }
148
- function getRowSelection(_ref3) {
149
- var rowKey = _ref3.rowKey,
150
- columns = _ref3.columns,
151
- context = _ref3.context;
166
+ function getRowSelection(_ref4) {
167
+ var rowKey = _ref4.rowKey,
168
+ columns = _ref4.columns,
169
+ context = _ref4.context;
152
170
  var column = _lodash.default.find(columns, {
153
171
  type: 'selection'
154
172
  });
@@ -209,10 +227,10 @@ function getTableAndFormProps(props) {
209
227
  tableProps: tableProps
210
228
  };
211
229
  }
212
- function isUseFormWrapper(_ref4) {
213
- var columns = _ref4.columns,
214
- context = _ref4.context,
215
- form = _ref4.form;
230
+ function isUseFormWrapper(_ref5) {
231
+ var columns = _ref5.columns,
232
+ context = _ref5.context,
233
+ form = _ref5.form;
216
234
  // 在 Form 中时,将 context 挂载给 formContext
217
235
  if (form) {
218
236
  _lodash.default.assign(form.getContext(), context);
@@ -222,10 +240,10 @@ function isUseFormWrapper(_ref4) {
222
240
  type: 'editor'
223
241
  });
224
242
  }
225
- function getTableFormInitialValues(_ref5) {
226
- var rowKey = _ref5.rowKey,
227
- columns = _ref5.columns,
228
- dataSource = _ref5.dataSource;
243
+ function getTableFormInitialValues(_ref6) {
244
+ var rowKey = _ref6.rowKey,
245
+ columns = _ref6.columns,
246
+ dataSource = _ref6.dataSource;
229
247
  var dataIndex = _lodash.default.map(columns, function (col) {
230
248
  return col.type === 'editor' && col.dataIndex;
231
249
  });
@@ -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;
@@ -8,7 +8,7 @@ exports.default = void 0;
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _api = require("../../api");
10
10
  var _react = require("@emotion/react");
11
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
11
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
12
12
  var style = {
13
13
  wrapper: function wrapper(maxHeight) {
14
14
  return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n\n .ant-table-wrapper,\n .ant-spin-nested-loading,\n .ant-spin-container,\n .ant-table,\n .ant-table-container {\n width: 100%;\n max-height: 100%;\n display: flex;\n flex-direction: column;\n min-height: 0;\n }\n\n .ant-table-content {\n overflow: auto !important;\n width: calc(100% + 1px); // \u4FEE\u590D\u7A7A\u6570\u636E\u65F6\uFF0C\u51FA\u73B0\u6EDA\u52A8\u6761\u7684 bug\n max-height: ", ";\n }\n\n .ant-table-thead {\n position: sticky;\n top: 0;\n z-index: 10;\n }\n\n .ant-table-pagination.ant-pagination {\n margin-bottom: 0;\n }\n "])), (0, _api.transformValueWithStyleUnit)(maxHeight));
@@ -18,6 +18,7 @@ var style = {
18
18
  return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n -webkit-line-clamp: ", " !important;\n "])), rows);
19
19
  },
20
20
  editor: (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n margin-bottom: 0;\n\n .ant-form-item-label {\n display: none !important;\n }\n "]))),
21
- divider: (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0;\n "])))
21
+ divider: (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0;\n "]))),
22
+ displayColumn: (0, _react.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\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 "])))
22
23
  };
23
24
  var _default = exports.default = style;
@@ -0,0 +1,9 @@
1
+ import { ButtonProps } from "../../button";
2
+ export interface DisplayColumnProps extends Omit<ButtonProps, 'onChange'> {
3
+ /**
4
+ * @description 缓存列时, 需要保证key唯一
5
+ */
6
+ storageKey?: string;
7
+ value?: string[];
8
+ onChange?: (keys: string[]) => void;
9
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -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 {
@@ -24,4 +24,15 @@ Object.keys(_column).forEach(function (key) {
24
24
  return _column[key];
25
25
  }
26
26
  });
27
+ });
28
+ var _displayColumn = require("./display-column");
29
+ Object.keys(_displayColumn).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _displayColumn[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _displayColumn[key];
36
+ }
37
+ });
27
38
  });
@@ -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
- children?: import("react").ReactNode;
9
+ prefixCls?: string | undefined;
10
+ disabled?: boolean | undefined;
10
11
  className?: string | undefined;
11
12
  style?: import("react").CSSProperties | undefined;
12
- closable?: boolean | undefined;
13
- prefixCls?: string | undefined;
14
- closeIcon?: import("react").ReactNode;
13
+ children?: import("react").ReactNode;
15
14
  forceRender?: boolean | undefined;
16
15
  id?: string | undefined;
17
- disabled?: boolean | undefined;
18
- icon?: import("react").ReactNode;
19
- active?: boolean | 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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doui-react",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "A React UI library based on Ant Design",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",