@teamix/pro 1.2.30 → 1.2.34

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 (97) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +16740 -17360
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog-form.js +58 -9
  6. package/es/common.scss +22 -0
  7. package/es/form/Filter/SimpleFilter.js +10 -3
  8. package/es/form/Filter/index.d.ts +5 -9
  9. package/es/form/Filter/index.js +427 -154
  10. package/es/form/Filter/index.scss +33 -11
  11. package/es/form/Filter/index2.d.ts +9 -5
  12. package/es/form/Filter/index2.js +154 -370
  13. package/es/form/Filter/index2.scss +11 -33
  14. package/es/form/ProForm/index.js +4 -4
  15. package/es/form/ProForm/index.scss +5 -0
  16. package/es/form/SchemaForm/index.js +4 -4
  17. package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
  18. package/es/form/SchemaForm/initializeRequest.js +41 -5
  19. package/es/form/SchemaForm/reactions.d.ts +2 -2
  20. package/es/form/SchemaForm/reactions.js +13 -6
  21. package/es/form/index.d.ts +3 -3
  22. package/es/form/index.js +3 -3
  23. package/es/form/typing.d.ts +8 -2
  24. package/es/index.d.ts +1 -1
  25. package/es/index.js +1 -1
  26. package/es/info/components/InfoValueItem/index.js +38 -12
  27. package/es/info/components/InfoValueItem/index.scss +1 -0
  28. package/es/info/components/ProInfoItem/index.js +6 -3
  29. package/es/info/components/ProInfoItem/index.scss +9 -0
  30. package/es/info/components/baseInfo/index.js +4 -2
  31. package/es/info/components/headerInfo/index.js +2 -1
  32. package/es/info/components/tableInfo/index.js +2 -1
  33. package/es/info/index.scss +2 -0
  34. package/es/info/typing.d.ts +3 -0
  35. package/es/table/components/Filter/index.js +6 -6
  36. package/es/table/components/Layout/index.js +29 -23
  37. package/es/table/components/Layout/index.scss +7 -0
  38. package/es/table/components/ToolBar/Fullscreen.js +39 -15
  39. package/es/table/components/ToolBar/index.scss +1 -0
  40. package/es/table/index.js +122 -54
  41. package/es/table/typing.d.ts +3 -2
  42. package/es/table/utils/columnRender.js +2 -2
  43. package/es/table/utils/index.d.ts +2 -1
  44. package/es/table/utils/index.js +62 -113
  45. package/lib/actions/dialog-form.js +57 -10
  46. package/lib/common.scss +22 -0
  47. package/lib/form/Filter/SimpleFilter.js +8 -1
  48. package/lib/form/Filter/index.d.ts +5 -9
  49. package/lib/form/Filter/index.js +440 -154
  50. package/lib/form/Filter/index.scss +33 -11
  51. package/lib/form/Filter/index2.d.ts +9 -5
  52. package/lib/form/Filter/index2.js +154 -383
  53. package/lib/form/Filter/index2.scss +11 -33
  54. package/lib/form/ProForm/index.js +4 -4
  55. package/lib/form/ProForm/index.scss +5 -0
  56. package/lib/form/SchemaForm/index.js +4 -4
  57. package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
  58. package/lib/form/SchemaForm/initializeRequest.js +41 -5
  59. package/lib/form/SchemaForm/reactions.d.ts +2 -2
  60. package/lib/form/SchemaForm/reactions.js +13 -6
  61. package/lib/form/index.d.ts +3 -3
  62. package/lib/form/index.js +8 -8
  63. package/lib/form/typing.d.ts +8 -2
  64. package/lib/index.d.ts +1 -1
  65. package/lib/index.js +1 -1
  66. package/lib/info/components/InfoValueItem/index.js +38 -12
  67. package/lib/info/components/InfoValueItem/index.scss +1 -0
  68. package/lib/info/components/ProInfoItem/index.js +6 -3
  69. package/lib/info/components/ProInfoItem/index.scss +9 -0
  70. package/lib/info/components/baseInfo/index.js +4 -2
  71. package/lib/info/components/headerInfo/index.js +2 -1
  72. package/lib/info/components/tableInfo/index.js +2 -1
  73. package/lib/info/index.scss +2 -0
  74. package/lib/info/typing.d.ts +3 -0
  75. package/lib/table/components/Filter/index.js +6 -6
  76. package/lib/table/components/Layout/index.js +29 -23
  77. package/lib/table/components/Layout/index.scss +7 -0
  78. package/lib/table/components/ToolBar/Fullscreen.js +37 -14
  79. package/lib/table/components/ToolBar/index.scss +1 -0
  80. package/lib/table/index.js +121 -53
  81. package/lib/table/typing.d.ts +3 -2
  82. package/lib/table/utils/columnRender.js +2 -2
  83. package/lib/table/utils/index.d.ts +2 -1
  84. package/lib/table/utils/index.js +63 -112
  85. package/package.json +1 -1
  86. package/dist/212.js +0 -155705
  87. package/dist/fonts/codicon.ttf +0 -0
  88. package/es/form/Components/SelectTable/index.d.ts +0 -24
  89. package/es/form/Components/SelectTable/index.js +0 -135
  90. package/es/form/Components/SelectTable/index.scss +0 -28
  91. package/es/form/Components/SelectTable/table.d.ts +0 -6
  92. package/es/form/Components/SelectTable/table.js +0 -64
  93. package/lib/form/Components/SelectTable/index.d.ts +0 -24
  94. package/lib/form/Components/SelectTable/index.js +0 -157
  95. package/lib/form/Components/SelectTable/index.scss +0 -28
  96. package/lib/form/Components/SelectTable/table.d.ts +0 -6
  97. package/lib/form/Components/SelectTable/table.js +0 -76
@@ -16,129 +16,76 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
16
16
 
17
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
18
 
19
- import cloneDeepLodash from 'lodash.clonedeep'; // 组件内全局状态 每次初始化 ActionRef 会重新深拷贝对象
20
-
21
- var state = {
22
- fullScreenState: false,
23
- filterRules: {},
24
- filterColumns: []
25
- };
26
-
27
- var _initState = cloneDeepLodash(state); // state监听事件 每次初始化 ActionRef 会重新深拷贝对象
28
-
29
-
30
- var callback = {
31
- fullScreenState: {}
32
- };
33
- var initCallback = cloneDeepLodash(callback); // 所有 ProTable 组件公用一套组件内事件转发机制
34
-
35
- var tableCallback = {}; // 组件内监听事件
36
- // 组件内对全局状态的更改
37
-
38
- var mutations = {
39
- getState: function getState() {
40
- return state;
41
- },
42
- setState: function setState(key, value) {
43
- state[key] = value;
44
- useOn(key, value);
45
-
46
- if (mutations.hasOwnProperty(key)) {
47
- mutations[key] = value;
48
- }
49
- },
50
- initState: function initState() {
51
- state = cloneDeepLodash(_initState);
52
- },
53
- filterColumns: state.filterColumns,
54
- setFullScreenState: function setFullScreenState(fullScreenState) {
55
- state.fullScreenState = fullScreenState;
56
- useOn('fullScreenState', fullScreenState);
57
- },
58
-
59
- /**
60
- * 设置筛选列规则
61
- * @param rules 规则
62
- * @param dataIndex column.dataIndex
63
- */
64
- setFilterRules: function setFilterRules(rules) {
65
- state.filterRules = rules;
66
- },
67
-
68
- /**
69
- * 获取筛选规则。为params
70
- */
71
- getFilterRules: function getFilterRules() {
72
- var result = {};
73
-
74
- if (state.filterRules) {
75
- result = Object.entries(state.filterRules).map(function (_ref) {
76
- var _ref2 = _slicedToArray(_ref, 2),
77
- k = _ref2[0],
78
- v = _ref2[1];
79
-
80
- return _defineProperty({}, k, v.params);
81
- }).reduce(function (acc, cur) {
82
- acc = _objectSpread(_objectSpread({}, acc), cur);
83
- return acc;
84
- }, {});
85
- }
19
+ import cloneDeepLodash from 'lodash.clonedeep'; // 所有 ProTable 组件公用一套组件内事件转发机制
20
+
21
+ var tableCallback = {}; // 组件内对全局状态的更改
22
+
23
+ var getMutations = function getMutations(actionRef) {
24
+ var _actionRef$current2, _actionRef$current2$g, _actionRef$current2$g2;
25
+
26
+ return {
27
+ setFullScreenState: function setFullScreenState(fullScreenState) {
28
+ var _actionRef$current, _actionRef$current$se;
29
+
30
+ (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setState) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, 'fullScreenState', fullScreenState);
31
+ },
32
+ filterColumns: (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$g = _actionRef$current2.getState) === null || _actionRef$current2$g === void 0 ? void 0 : (_actionRef$current2$g2 = _actionRef$current2$g.call(_actionRef$current2)) === null || _actionRef$current2$g2 === void 0 ? void 0 : _actionRef$current2$g2.filterColumns,
33
+
34
+ /**
35
+ * 设置筛选列规则
36
+ * @param rules 规则
37
+ * @param dataIndex column.dataIndex
38
+ */
39
+ setFilterRules: function setFilterRules(rules) {
40
+ var _actionRef$current3, _actionRef$current3$s;
41
+
42
+ (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setState) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, 'filterRules', rules);
43
+ },
44
+
45
+ /**
46
+ * 获取筛选规则。为params
47
+ */
48
+ getFilterRules: function getFilterRules() {
49
+ var _actionRef$current4, _actionRef$current4$g;
50
+
51
+ var result = {};
52
+ var filterRules = (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$g = _actionRef$current4.getState) === null || _actionRef$current4$g === void 0 ? void 0 : _actionRef$current4$g.call(_actionRef$current4).filterRules;
53
+
54
+ if (filterRules) {
55
+ result = Object.entries(filterRules).map(function (_ref) {
56
+ var _ref2 = _slicedToArray(_ref, 2),
57
+ k = _ref2[0],
58
+ v = _ref2[1];
59
+
60
+ return _defineProperty({}, k, v.params);
61
+ }).reduce(function (acc, cur) {
62
+ acc = _objectSpread(_objectSpread({}, acc), cur);
63
+ return acc;
64
+ }, {});
65
+ }
86
66
 
87
- return result;
88
- },
89
-
90
- /**
91
- * 绑定监听函数
92
- * @param fun 监听函数
93
- * @param state 需要监听的state
94
- * @param name 监听名(作为销毁唯一id使用)
95
- */
96
- on: function on(fun, state, name) {
97
- if (!callback[state]) {
98
- callback[state] = {};
67
+ return result;
99
68
  }
100
-
101
- callback[state][name] = fun;
102
- },
103
- off: function off(name) {
104
- callback = Object.fromEntries(Object.entries(callback).map(function (_ref4) {
105
- var _ref5 = _slicedToArray(_ref4, 2),
106
- k = _ref5[0],
107
- v = _ref5[1];
108
-
109
- var filterV = Object.fromEntries(Object.entries(v).filter(function (_ref6) {
110
- var _ref7 = _slicedToArray(_ref6, 1),
111
- k = _ref7[0];
112
-
113
- return k !== name;
114
- }));
115
- return [k, filterV];
116
- }));
117
- }
69
+ };
118
70
  }; // 调用绑定的监听函数
119
71
 
120
- var useOn = function useOn(state) {
121
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
122
- args[_key - 1] = arguments[_key];
72
+
73
+ export function actionRefUseStateOn(callback, state) {
74
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
75
+ args[_key - 2] = arguments[_key];
123
76
  }
124
77
 
125
78
  if (callback[state]) {
126
- Object.entries(callback[state]).forEach(function (_ref8) {
127
- var _ref9 = _slicedToArray(_ref8, 2),
128
- k = _ref9[0],
129
- v = _ref9[1];
79
+ Object.entries(callback[state]).forEach(function (_ref4) {
80
+ var _ref5 = _slicedToArray(_ref4, 2),
81
+ k = _ref5[0],
82
+ v = _ref5[1];
130
83
 
131
84
  if (v) {
132
85
  v === null || v === void 0 ? void 0 : v.apply(void 0, args);
133
86
  }
134
87
  });
135
88
  }
136
- }; // 初始化 actionRef
137
-
138
-
139
- export function initActionRef() {
140
- state = cloneDeepLodash(_initState);
141
- callback = cloneDeepLodash(initCallback);
142
89
  }
143
90
  /** table 组件内监听 不对外暴露 */
144
91
 
@@ -165,12 +112,14 @@ export function emit(key) {
165
112
  fun.apply(void 0, args);
166
113
  }
167
114
  }
168
- export function useActionType(ref, action) {
169
- // 合并自定义事件
170
- var userAction = _objectSpread(_objectSpread({}, action), mutations);
115
+ export function initActionRef(ref, action) {
116
+ var userAction = _objectSpread(_objectSpread({}, action), getMutations(ref));
171
117
 
172
118
  ref.current = userAction;
173
119
  }
120
+ export function useActionType(ref, action) {
121
+ ref.current = _objectSpread(_objectSpread({}, ref.current), action);
122
+ }
174
123
  export function cloneDeep(obj) {
175
124
  return cloneDeepLodash(obj);
176
125
  }
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
@@ -25,7 +23,7 @@ var _dialog = _interopRequireDefault(require("./dialog"));
25
23
  var _utils2 = require("./utils");
26
24
 
27
25
  var _excluded = ["schema"],
28
- _excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish"];
26
+ _excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "beforeRequest"];
29
27
 
30
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
29
 
@@ -33,6 +31,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
33
31
 
34
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
33
 
34
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
35
+
36
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
37
+
38
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
39
+
36
40
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
37
41
 
38
42
  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."); }
@@ -157,6 +161,7 @@ function useDialogFormAction(action, context) {
157
161
  _action$size = action.size,
158
162
  size = _action$size === void 0 ? 'small' : _action$size,
159
163
  _onFinish = action.onFinish,
164
+ propsBeforeRequest = action.beforeRequest,
160
165
  others = _objectWithoutProperties(action, _excluded2);
161
166
 
162
167
  var formRef = /*#__PURE__*/(0, _react.createRef)();
@@ -177,13 +182,55 @@ function useDialogFormAction(action, context) {
177
182
  }, dialogFormProps));
178
183
  },
179
184
  extendParams: useFieldValuesForRequest ? '{{fields}}' : undefined,
180
- beforeRequest: function beforeRequest() {
181
- return new Promise(function (resolve) {
182
- formRef.current.validate().then(function () {
183
- resolve({
184
- fields: formRef.current.values
185
- });
186
- }).catch(function () {
185
+ beforeRequest: function beforeRequest(context) {
186
+ return new Promise(function (resolve, reject) {
187
+ formRef.current.validate().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
188
+ var beforeRequestContext, requestContext;
189
+ return regeneratorRuntime.wrap(function _callee$(_context) {
190
+ while (1) {
191
+ switch (_context.prev = _context.next) {
192
+ case 0:
193
+ if (!propsBeforeRequest) {
194
+ _context.next = 13;
195
+ break;
196
+ }
197
+
198
+ _context.prev = 1;
199
+ _context.next = 4;
200
+ return (0, _utils.resolveMaybePromiseMethod)(propsBeforeRequest, context);
201
+
202
+ case 4:
203
+ beforeRequestContext = _context.sent;
204
+ _context.next = 10;
205
+ break;
206
+
207
+ case 7:
208
+ _context.prev = 7;
209
+ _context.t0 = _context["catch"](1);
210
+ beforeRequestContext = false;
211
+
212
+ case 10:
213
+ if (!(beforeRequestContext === false)) {
214
+ _context.next = 13;
215
+ break;
216
+ }
217
+
218
+ reject(false);
219
+ return _context.abrupt("return");
220
+
221
+ case 13:
222
+ requestContext = Object.assign({
223
+ fields: formRef.current.values
224
+ }, _typeof(beforeRequestContext) === 'object' ? beforeRequestContext : {});
225
+ resolve(requestContext);
226
+
227
+ case 15:
228
+ case "end":
229
+ return _context.stop();
230
+ }
231
+ }
232
+ }, _callee, null, [[1, 7]]);
233
+ }))).catch(function () {
187
234
  resolve(false);
188
235
  });
189
236
  });
@@ -0,0 +1,22 @@
1
+ // 容器滚动条样式
2
+ @mixin hybridcloud-scrollbar {
3
+ &::-webkit-scrollbar {
4
+ width: 12px;
5
+ height: 12px;
6
+ }
7
+ &::-webkit-scrollbar-thumb {
8
+ border-color: transparent;
9
+ border-style: solid;
10
+ border-width: 4px;
11
+ background-clip: content-box;
12
+ border-radius: 6px;
13
+ background-color: var(--scrollbar-thumb-bg);
14
+ &:hover {
15
+ border-width: 3px;
16
+ background-color: var(--scrollbar-thumb-hover-bg);
17
+ }
18
+ }
19
+ &::-webkit-scrollbar-track {
20
+ background-color: transparent;
21
+ }
22
+ }
@@ -35,7 +35,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
35
35
 
36
36
  // 初始化Search组件,内置部分属性
37
37
  var initializeSearch = function initializeSearch(schema) {
38
- var searchName;
38
+ var searchName = '';
39
39
  var initializedSchema = schema.map(function (item) {
40
40
  if (item.component === 'Search') {
41
41
  searchName = item.name;
@@ -104,6 +104,13 @@ var SimpleFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
104
104
  onChange === null || onChange === void 0 ? void 0 : onChange(values, name, value);
105
105
  }
106
106
  }, [searchName, searchValue.current]);
107
+ (0, _react.useEffect)(function () {
108
+ var _props$form$initialVa, _props$form$initialVa2;
109
+
110
+ // 处理Search组件,缓存input的默认值
111
+ var searchDefaultValue = (_props$form$initialVa = props.form.initialValues) === null || _props$form$initialVa === void 0 ? void 0 : (_props$form$initialVa2 = _props$form$initialVa[searchName]) === null || _props$form$initialVa2 === void 0 ? void 0 : _props$form$initialVa2[1];
112
+ searchValue.current = (0, _utils.isValid)(searchDefaultValue) ? searchDefaultValue : '';
113
+ }, []);
107
114
  return /*#__PURE__*/_react.default.createElement(_ProForm.default, _objectSpread(_objectSpread({}, otherProps), {}, {
108
115
  className: (0, _classnames.default)(prefixCls, props.className),
109
116
  schema: simpleSchema,
@@ -1,13 +1,9 @@
1
1
  import React from 'react';
2
- import type { IFilterProps } from '../typing';
2
+ import { QueryFilterLayout } from './Layout';
3
+ import type { QueryFilterProps } from '../typing';
3
4
  import './index.scss';
4
5
  /**
5
- * 简单筛选
6
+ * 查询筛选
6
7
  */
7
- declare const SimpleFilter: React.FC<IFilterProps>;
8
- /**
9
- * 高级筛选
10
- */
11
- declare const AdvancedFilter: React.FC<IFilterProps>;
12
- export { AdvancedFilter, SimpleFilter };
13
- export default AdvancedFilter;
8
+ declare const QueryFilter: React.FC<QueryFilterProps>;
9
+ export { QueryFilter, QueryFilterLayout };