@teamix/pro 1.2.14 → 1.2.15

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 (43) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +439 -213
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog.js +3 -1
  6. package/es/card/index.d.ts +4 -1
  7. package/es/card/index.js +8 -2
  8. package/es/card/index.scss +4 -0
  9. package/es/form/Filter/index2.js +124 -128
  10. package/es/form/Filter/index2.scss +1 -1
  11. package/es/form/SchemaForm/reactions.js +2 -6
  12. package/es/form/typing.d.ts +6 -0
  13. package/es/index.d.ts +1 -1
  14. package/es/index.js +1 -1
  15. package/es/page-header/index.js +2 -11
  16. package/es/table/components/ToolBar/FilterColumnIcon.js +52 -17
  17. package/es/table/components/ToolBar/index.scss +1 -0
  18. package/es/table/index.js +7 -1
  19. package/es/table/typing.d.ts +4 -2
  20. package/es/table/utils/columnRender.js +27 -6
  21. package/es/table/utils/index.js +7 -1
  22. package/es/utils/message.d.ts +1 -1
  23. package/es/utils/message.js +7 -7
  24. package/lib/actions/dialog.js +3 -1
  25. package/lib/card/index.d.ts +4 -1
  26. package/lib/card/index.js +9 -2
  27. package/lib/card/index.scss +4 -0
  28. package/lib/form/Filter/index2.js +124 -128
  29. package/lib/form/Filter/index2.scss +1 -1
  30. package/lib/form/SchemaForm/reactions.js +1 -5
  31. package/lib/form/typing.d.ts +6 -0
  32. package/lib/index.d.ts +1 -1
  33. package/lib/index.js +1 -1
  34. package/lib/page-header/index.js +3 -12
  35. package/lib/table/components/ToolBar/FilterColumnIcon.js +52 -17
  36. package/lib/table/components/ToolBar/index.scss +1 -0
  37. package/lib/table/index.js +7 -1
  38. package/lib/table/typing.d.ts +4 -2
  39. package/lib/table/utils/columnRender.js +27 -6
  40. package/lib/table/utils/index.js +7 -1
  41. package/lib/utils/message.d.ts +1 -1
  42. package/lib/utils/message.js +7 -7
  43. package/package.json +1 -1
@@ -1,3 +1,11 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+
7
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
+
1
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
10
 
3
11
  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."); }
@@ -121,10 +129,23 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
121
129
 
122
130
 
123
131
  var moveUp = function moveUp(e, dataIndex) {
132
+ var _newColumns$filter, _newColumns$filter2;
133
+
124
134
  e.stopPropagation();
125
- var keyNewColumns = cloneDeep(newColumns);
126
- var index = keyNewColumns.findIndex(function (_ref) {
127
- var index = _ref.dataIndex;
135
+ var keyNewColumns = cloneDeep(newColumns).filter(function (_ref) {
136
+ var lock = _ref.lock;
137
+ return !lock;
138
+ });
139
+ var headLock = cloneDeep((_newColumns$filter = newColumns.filter(function (_ref2) {
140
+ var lock = _ref2.lock;
141
+ return lock === true || lock === 'left';
142
+ })) !== null && _newColumns$filter !== void 0 ? _newColumns$filter : []);
143
+ var tailLock = cloneDeep((_newColumns$filter2 = newColumns.filter(function (_ref3) {
144
+ var lock = _ref3.lock;
145
+ return lock === 'right';
146
+ })) !== null && _newColumns$filter2 !== void 0 ? _newColumns$filter2 : []);
147
+ var index = keyNewColumns.findIndex(function (_ref4) {
148
+ var index = _ref4.dataIndex;
128
149
  return index === dataIndex;
129
150
  });
130
151
 
@@ -134,15 +155,28 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
134
155
  keyNewColumns.push(keyNewColumns.shift());
135
156
  }
136
157
 
137
- notifyTableRender(keyNewColumns);
158
+ notifyTableRender([].concat(_toConsumableArray(headLock), _toConsumableArray(keyNewColumns), _toConsumableArray(tailLock)));
138
159
  }; // 向下
139
160
 
140
161
 
141
162
  var moveDown = function moveDown(e, dataIndex) {
163
+ var _newColumns$filter3, _newColumns$filter4;
164
+
142
165
  e.stopPropagation();
143
- var keyNewColumns = cloneDeep(newColumns);
144
- var index = keyNewColumns.findIndex(function (_ref2) {
145
- var index = _ref2.dataIndex;
166
+ var keyNewColumns = cloneDeep(newColumns).filter(function (_ref5) {
167
+ var lock = _ref5.lock;
168
+ return !lock;
169
+ });
170
+ var headLock = cloneDeep((_newColumns$filter3 = newColumns.filter(function (_ref6) {
171
+ var lock = _ref6.lock;
172
+ return lock === true || lock === 'left';
173
+ })) !== null && _newColumns$filter3 !== void 0 ? _newColumns$filter3 : []);
174
+ var tailLock = cloneDeep((_newColumns$filter4 = newColumns.filter(function (_ref7) {
175
+ var lock = _ref7.lock;
176
+ return lock === 'right';
177
+ })) !== null && _newColumns$filter4 !== void 0 ? _newColumns$filter4 : []);
178
+ var index = keyNewColumns.findIndex(function (_ref8) {
179
+ var index = _ref8.dataIndex;
146
180
  return index === dataIndex;
147
181
  });
148
182
 
@@ -152,7 +186,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
152
186
  keyNewColumns.unshift(keyNewColumns.splice(index, 1)[0]);
153
187
  }
154
188
 
155
- notifyTableRender(keyNewColumns);
189
+ notifyTableRender([].concat(_toConsumableArray(headLock), _toConsumableArray(keyNewColumns), _toConsumableArray(tailLock)));
156
190
  }; // 通知表格渲染
157
191
 
158
192
 
@@ -220,23 +254,24 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
220
254
  type: "primary"
221
255
  }, getMessage('reset'))), /*#__PURE__*/React.createElement(Menu.Divider, {
222
256
  key: "divider"
223
- }), newColumns.map(function (_ref3, index) {
257
+ }), newColumns.map(function (_ref9, index) {
224
258
  var _newColumns$find;
225
259
 
226
- var dataIndex = _ref3.dataIndex,
227
- title = _ref3.title,
228
- columnFiltersDisabled = _ref3.columnFiltersDisabled;
260
+ var dataIndex = _ref9.dataIndex,
261
+ title = _ref9.title,
262
+ columnFiltersDisabled = _ref9.columnFiltersDisabled,
263
+ lock = _ref9.lock;
229
264
  return /*#__PURE__*/React.createElement(CheckboxItem, {
230
265
  key: index,
231
- checked: (_newColumns$find = newColumns.find(function (_ref4) {
232
- var key = _ref4.dataIndex;
266
+ checked: (_newColumns$find = newColumns.find(function (_ref10) {
267
+ var key = _ref10.dataIndex;
233
268
  return key === dataIndex;
234
269
  })) === null || _newColumns$find === void 0 ? void 0 : _newColumns$find.columnFilters,
235
270
  onChange: function onChange(check) {
236
271
  return onChangeColumns(check, dataIndex);
237
272
  },
238
273
  disabled: columnFiltersDisabled
239
- }, title, /*#__PURE__*/React.createElement("div", {
274
+ }, title, !lock && /*#__PURE__*/React.createElement("div", {
240
275
  className: cls({
241
276
  sort: true
242
277
  })
@@ -293,8 +328,8 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
293
328
  key: index,
294
329
  className: cls('col')
295
330
  }, /*#__PURE__*/React.createElement(Checkbox, {
296
- checked: (_newColumns$find2 = newColumns.find(function (_ref5) {
297
- var key = _ref5.dataIndex;
331
+ checked: (_newColumns$find2 = newColumns.find(function (_ref11) {
332
+ var key = _ref11.dataIndex;
298
333
  return key === dataIndex;
299
334
  })) === null || _newColumns$find2 === void 0 ? void 0 : _newColumns$find2.columnFilters,
300
335
  onChange: function onChange(check) {
@@ -40,6 +40,7 @@
40
40
  visibility: visible;
41
41
  cursor: pointer;
42
42
  }
43
+
43
44
  }
44
45
  }
45
46
  .next-menu-item-text {
package/es/table/index.js CHANGED
@@ -564,7 +564,11 @@ var ProTable = function ProTable(props) {
564
564
  }
565
565
 
566
566
  useEffect(function () {
567
- // 监听 浏览器变化 更吸底状态
567
+ var _actionRef$current5, _actionRef$current5$i;
568
+
569
+ // 初始化 state 状态
570
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$i = _actionRef$current5.initState) === null || _actionRef$current5$i === void 0 ? void 0 : _actionRef$current5$i.call(_actionRef$current5); // 监听 浏览器变化 更吸底状态
571
+
568
572
  if (footerSuction) {
569
573
  getFooterSuctionState();
570
574
 
@@ -585,6 +589,8 @@ var ProTable = function ProTable(props) {
585
589
  if (window.onresize) {
586
590
  window.onresize = null;
587
591
  }
592
+
593
+ actionRef.current = undefined;
588
594
  };
589
595
  }, []);
590
596
 
@@ -178,10 +178,12 @@ export declare type ProTableActionType = {
178
178
  } & ProTableActionTypeMutations;
179
179
  /** action State 定义 */
180
180
  export declare type ProTableActionTypeMutations = {
181
- /** 获取state状态 */
181
+ /** 获取state 状态 */
182
182
  getState?: () => ProTableActionTypeState;
183
- /** 设置state状态 */
183
+ /** 设置state 状态 */
184
184
  setState?: (key: string, value: any) => void;
185
+ /** 初始化 state 状态 */
186
+ initState?: () => void;
185
187
  /** 设置全屏状态 */
186
188
  setFullScreenState?: (state: boolean) => void;
187
189
  /** 绑定state监听事件 */
@@ -40,10 +40,10 @@ export var renderColumnsTitle = function renderColumnsTitle(item, actionRef) {
40
40
  var filterMode = item.filterMode,
41
41
  filters = item.filters,
42
42
  dataIndex = item.dataIndex,
43
- dataSource = item.dataSource;
43
+ dataSource = item.dataSource; // 为列过滤添加状态标题
44
44
 
45
- var getItemLable = function getItemLable() {
46
- if (filterMode !== 'multiple') {
45
+ var getItemLabel = function getItemLabel() {
46
+ if (filters && filterMode !== 'multiple') {
47
47
  var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2;
48
48
 
49
49
  var selectedItem = (_actionRef$current$ge = (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ge2 = _actionRef$current.getState) === null || _actionRef$current$ge2 === void 0 ? void 0 : _actionRef$current$ge2.call(_actionRef$current).filterRules) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {};
@@ -66,16 +66,37 @@ export var renderColumnsTitle = function renderColumnsTitle(item, actionRef) {
66
66
 
67
67
  return item.value === ((_selectedItem$dataInd2 = selectedItem[dataIndex]) === null || _selectedItem$dataInd2 === void 0 ? void 0 : _selectedItem$dataInd2.params);
68
68
  })) === null || _targetFilters$find === void 0 ? void 0 : _targetFilters$find.label;
69
- return "".concat(item.title, " (").concat(label, ")");
69
+ var value = "".concat(item.title, " (").concat(label, ")");
70
+ return /*#__PURE__*/React.createElement(ProField, {
71
+ style: {
72
+ display: 'inline-flex'
73
+ },
74
+ value: value,
75
+ type: "text",
76
+ render: {
77
+ ellipsis: true,
78
+ color: 'var(--table-th-color,#848484)'
79
+ }
80
+ });
70
81
  }
71
82
  }
72
83
  }
73
84
 
74
- return item.title;
85
+ return /*#__PURE__*/React.createElement(ProField, {
86
+ style: {
87
+ display: 'inline-flex'
88
+ },
89
+ value: item.title,
90
+ type: "text",
91
+ render: {
92
+ ellipsis: true,
93
+ color: 'var(--table-th-color,#848484)'
94
+ }
95
+ });
75
96
  };
76
97
 
77
98
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LabelIconTip, {
78
- label: getItemLable(),
99
+ label: getItemLabel(),
79
100
  tooltip: item.tooltip,
80
101
  icon: item.tooltipIcon
81
102
  }), item.filters && /*#__PURE__*/React.createElement(Filter, {
@@ -22,7 +22,10 @@ var state = {
22
22
  fullScreenState: false,
23
23
  filterRules: {},
24
24
  filterColumns: []
25
- }; // 组件内全局监听事件
25
+ };
26
+
27
+ var _initState = cloneDeepLodash(state); // 组件内全局监听事件
28
+
26
29
 
27
30
  var callback = {
28
31
  fullScreenState: {}
@@ -40,6 +43,9 @@ var mutations = {
40
43
  mutations[key] = value;
41
44
  }
42
45
  },
46
+ initState: function initState() {
47
+ state = cloneDeepLodash(_initState);
48
+ },
43
49
  filterColumns: state.filterColumns,
44
50
  setFullScreenState: function setFullScreenState(fullScreenState) {
45
51
  state.fullScreenState = fullScreenState;
@@ -1,3 +1,3 @@
1
1
  import { MessageProps } from '@alicloudfe/components/types/message';
2
2
  export declare type ProMessageProps = MessageProps | string;
3
- export declare const renderProMessage: (message: ProMessageProps) => JSX.Element;
3
+ export declare const renderProMessage: (message?: ProMessageProps | undefined, defaultProps?: MessageProps | undefined) => JSX.Element | null;
@@ -6,14 +6,14 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
6
6
 
7
7
  import React from 'react';
8
8
  import { Message } from '@alicloudfe/components';
9
- export var renderProMessage = function renderProMessage(message) {
9
+ export var renderProMessage = function renderProMessage(message, defaultProps) {
10
+ if (!message) {
11
+ return null;
12
+ }
13
+
10
14
  if (typeof message === 'string') {
11
- return /*#__PURE__*/React.createElement(Message, {
12
- type: "notice"
13
- }, message);
15
+ return /*#__PURE__*/React.createElement(Message, _objectSpread({}, defaultProps), message);
14
16
  }
15
17
 
16
- return /*#__PURE__*/React.createElement(Message, _objectSpread({
17
- type: "notice"
18
- }, message));
18
+ return /*#__PURE__*/React.createElement(Message, _objectSpread(_objectSpread({}, defaultProps), message));
19
19
  };
@@ -251,7 +251,9 @@ function useDialogAction(action, actionContext) {
251
251
  className: "teamix-pro-dialog-before-content"
252
252
  }, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/_react.default.createElement("div", {
253
253
  className: "teamix-pro-dialog-message"
254
- }, (0, _message.renderProMessage)(message)), dialogContent, afterContent && /*#__PURE__*/_react.default.createElement("div", {
254
+ }, (0, _message.renderProMessage)(message, {
255
+ type: 'notice'
256
+ })), dialogContent, afterContent && /*#__PURE__*/_react.default.createElement("div", {
255
257
  className: "teamix-pro-dialog-after-content"
256
258
  }, addContextForReactNode(afterContent, dialogContext)), footerDescription && /*#__PURE__*/_react.default.createElement("div", {
257
259
  className: (0, _classnames.default)('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ProTagItem } from '@teamix/utils';
3
+ import { ProMessageProps } from '../utils/message';
3
4
  import { ProActionGroupProps } from '../actions';
4
5
  import './index.scss';
5
6
  export * from './card-container';
@@ -24,6 +25,8 @@ export interface ProCardProps extends Omit<React.HTMLAttributes<HTMLElement>, 't
24
25
  actions?: React.ReactNode | ProActionGroupProps;
25
26
  /** 卡片背景图 */
26
27
  image?: string;
28
+ /** 位于弹窗内容上方的消息提示区 */
29
+ message?: ProMessageProps;
27
30
  /** 卡片标题下方是否有分割线 */
28
31
  divider?: boolean;
29
32
  /**
@@ -87,7 +90,7 @@ export declare const ProCard: {
87
90
  Selectable: {
88
91
  (props: import("./selectable").ProCardSelectableProps): JSX.Element;
89
92
  defaultProps: {
90
- hoveredShadow: boolean;
93
+ hoveredShadow: boolean; /** 标签组 */
91
94
  };
92
95
  isProCard: boolean;
93
96
  };
package/lib/card/index.js CHANGED
@@ -20,6 +20,8 @@ var _icon = _interopRequireDefault(require("@teamix/icon"));
20
20
 
21
21
  var _utils = require("@teamix/utils");
22
22
 
23
+ var _message = require("../utils/message");
24
+
23
25
  var _skeleton = require("../skeleton");
24
26
 
25
27
  var _actions = require("../actions");
@@ -48,7 +50,7 @@ Object.keys(_cardContainer).forEach(function (key) {
48
50
  });
49
51
  });
50
52
  var _excluded = ["context"],
51
- _excluded2 = ["children", "title", "subTitle", "tooltip", "tooltipIcon", "tags", "description", "extra", "actions", "style", "className", "image", "hoveredShadow", "divider", "bordered", "compacted", "centered", "loading", "empty", "borderColor", "backgroundColor", "contentClassName", "contentStyle", "direction", "wrap", "spacing", "split", "collapsible", "defaultCollapsed", "collapsed", "onCollapse", "context"];
53
+ _excluded2 = ["children", "title", "subTitle", "tooltip", "tooltipIcon", "tags", "description", "extra", "actions", "message", "style", "className", "image", "hoveredShadow", "divider", "bordered", "compacted", "centered", "loading", "empty", "borderColor", "backgroundColor", "contentClassName", "contentStyle", "direction", "wrap", "spacing", "split", "collapsible", "defaultCollapsed", "collapsed", "onCollapse", "context"];
52
54
 
53
55
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
54
56
 
@@ -117,6 +119,7 @@ var ProCard = function ProCard(props) {
117
119
  description = props.description,
118
120
  extra = props.extra,
119
121
  actions = props.actions,
122
+ message = props.message,
120
123
  style = props.style,
121
124
  className = props.className,
122
125
  image = props.image,
@@ -287,7 +290,11 @@ var ProCard = function ProCard(props) {
287
290
  style: {
288
291
  padding: '50px 0 60px'
289
292
  }
290
- })), !empty && childrenModified)));
293
+ })), !empty && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, message && /*#__PURE__*/_react.default.createElement("div", {
294
+ className: cls('content-message')
295
+ }, (0, _message.renderProMessage)(message, {
296
+ type: 'notice'
297
+ })), childrenModified))));
291
298
  };
292
299
 
293
300
  exports.ProCard = ProCard;
@@ -151,6 +151,10 @@
151
151
  }
152
152
  }
153
153
  }
154
+
155
+ &-message {
156
+ margin-bottom: var(--s-2);
157
+ }
154
158
  }
155
159
 
156
160
  &-tab {