@teamix/pro 1.2.17 → 1.2.18

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.
@@ -5,18 +5,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
7
  import { useField } from '@formily/react';
8
- import { isPlainObj } from '@teamix/utils';
9
8
  export default (function () {
10
9
  var field = useField();
11
10
 
12
11
  var refresh = function refresh() {
13
- if (!isPlainObj(field.data)) {
14
- field.data = {
15
- refresh: {}
16
- };
17
- } else {
18
- field.data.refresh = _objectSpread({}, field.data.refresh);
19
- }
12
+ field.data.refresh = _objectSpread({}, field.data.refresh);
20
13
  };
21
14
 
22
15
  return {
@@ -223,7 +223,9 @@ export default /*#__PURE__*/memo(function (_ref) {
223
223
  rules: defaultRules,
224
224
  reactions: defaultReactions,
225
225
  dataSource: defaultDataSource,
226
- data: data
226
+ data: data || {
227
+ placeholder: true
228
+ }
227
229
  })); // 递归子组件
228
230
 
229
231
  var recursiveProperties = (children === null || children === void 0 ? void 0 : children.length) ? {
package/es/index.d.ts CHANGED
@@ -21,5 +21,5 @@ export * from './page-container';
21
21
  export * from './page-header';
22
22
  export * from './skeleton';
23
23
  export * from './table';
24
- declare const version = "1.2.16";
24
+ declare const version = "1.2.17";
25
25
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
package/es/index.js CHANGED
@@ -27,7 +27,7 @@ export * from './page-header';
27
27
  export * from './skeleton';
28
28
  export * from './table'; // export * from './sidebar';
29
29
 
30
- var version = '1.2.16';
30
+ var version = '1.2.17';
31
31
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
32
32
  ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
33
33
  hooks, nocode, templates, utils };
package/es/table/index.js CHANGED
@@ -381,6 +381,15 @@ var ProTable = function ProTable(props) {
381
381
  },
382
382
  request: function request(params) {
383
383
  if (dataFilterForm.validate()) {
384
+ // 如果请求中还有翻页相关信息,需要自动设置到指定页
385
+ if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
386
+ setCurrentPage(params[targetPageKey]);
387
+ }
388
+
389
+ if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
390
+ setPageSize(params[targetPageSizeKey]);
391
+ }
392
+
384
393
  _request(params);
385
394
  }
386
395
  },
@@ -411,6 +420,7 @@ var ProTable = function ProTable(props) {
411
420
  targetPageSizeKey: targetPageSizeKey,
412
421
  pageSize: pageSize
413
422
  },
423
+ data: data,
414
424
  dataFilterForm: dataFilterForm,
415
425
  resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
416
426
  getHeaderHeight().then(function (height) {
@@ -609,6 +619,10 @@ var ProTable = function ProTable(props) {
609
619
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(_objectSpread({}, toJS(dataFilterForm.values))));
610
620
 
611
621
  if (dataFilterForm.validate()) {
622
+ var _actionRef$current6, _actionRef$current6$c;
623
+
624
+ // 搜索变化时,暂时先清空选择
625
+ (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$c = _actionRef$current6.clearRowSelection) === null || _actionRef$current6$c === void 0 ? void 0 : _actionRef$current6$c.call(_actionRef$current6);
612
626
  setCurrentPage(1); // const { mode, schema } = propsDataFilter as ProTableDataFilterProps;
613
627
  // TODO: 针对 inline 模式下的 search 组件做一下处理,如果空值切换下拉的时候不触发请求
614
628
  // if (mode === 'inline') {
@@ -705,15 +719,21 @@ var ProTable = function ProTable(props) {
705
719
 
706
720
  var renderFooter = function renderFooter() {
707
721
  function onChangePagination(currentPage) {
722
+ var _actionRef$current7, _actionRef$current7$c;
723
+
708
724
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
725
+ // 翻页暂时先清空选择
726
+ (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
709
727
  setCurrentPage(currentPage);
710
728
 
711
729
  _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
712
730
  }
713
731
 
714
732
  function onChangePaginationSize(currentPageSize) {
715
- var _request5;
733
+ var _actionRef$current8, _actionRef$current8$c, _request5;
716
734
 
735
+ // 翻页暂时先清空选择
736
+ (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
717
737
  setPageSize(currentPageSize);
718
738
  setCurrentPage(1);
719
739
 
@@ -129,6 +129,7 @@ export declare type rowSelectionType = {
129
129
  onSelect?: (selected: boolean, record: any, records: Array<any>) => void;
130
130
  onSelectAll?: (selected: boolean, records: Array<any>) => void;
131
131
  selectedRowKeys?: Array<any>;
132
+ selectedRecords?: any[];
132
133
  mode?: 'single' | 'multiple';
133
134
  titleProps?: () => any;
134
135
  columnProps?: () => any;
@@ -177,6 +178,8 @@ export declare type ProTableActionType = {
177
178
  resetPage?: () => void;
178
179
  /** 获取数据过滤区表单实例 */
179
180
  dataFilterForm?: FormType;
181
+ /** 表格当前的数据 */
182
+ data?: any[];
180
183
  } & ProTableActionTypeMutations;
181
184
  /** action State 定义 */
182
185
  export declare type ProTableActionTypeMutations = {
@@ -7,8 +7,6 @@ exports.default = void 0;
7
7
 
8
8
  var _react = require("@formily/react");
9
9
 
10
- var _utils = require("@teamix/utils");
11
-
12
10
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
11
 
14
12
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -19,13 +17,7 @@ var _default = function _default() {
19
17
  var field = (0, _react.useField)();
20
18
 
21
19
  var refresh = function refresh() {
22
- if (!(0, _utils.isPlainObj)(field.data)) {
23
- field.data = {
24
- refresh: {}
25
- };
26
- } else {
27
- field.data.refresh = _objectSpread({}, field.data.refresh);
28
- }
20
+ field.data.refresh = _objectSpread({}, field.data.refresh);
29
21
  };
30
22
 
31
23
  return {
@@ -266,7 +266,9 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
266
266
  rules: defaultRules,
267
267
  reactions: defaultReactions,
268
268
  dataSource: defaultDataSource,
269
- data: data
269
+ data: data || {
270
+ placeholder: true
271
+ }
270
272
  })); // 递归子组件
271
273
 
272
274
  var recursiveProperties = (children === null || children === void 0 ? void 0 : children.length) ? {
package/lib/index.d.ts CHANGED
@@ -21,5 +21,5 @@ export * from './page-container';
21
21
  export * from './page-header';
22
22
  export * from './skeleton';
23
23
  export * from './table';
24
- declare const version = "1.2.16";
24
+ declare const version = "1.2.17";
25
25
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
package/lib/index.js CHANGED
@@ -253,5 +253,5 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
253
253
  _icon.default.setConfig(_utils.default.getTeamixIconConfig());
254
254
 
255
255
  // export * from './sidebar';
256
- var version = '1.2.16';
256
+ var version = '1.2.17';
257
257
  exports.version = version;
@@ -425,6 +425,15 @@ var ProTable = function ProTable(props) {
425
425
  },
426
426
  request: function request(params) {
427
427
  if (dataFilterForm.validate()) {
428
+ // 如果请求中还有翻页相关信息,需要自动设置到指定页
429
+ if (params === null || params === void 0 ? void 0 : params[targetPageKey]) {
430
+ setCurrentPage(params[targetPageKey]);
431
+ }
432
+
433
+ if (params === null || params === void 0 ? void 0 : params[targetPageSizeKey]) {
434
+ setPageSize(params[targetPageSizeKey]);
435
+ }
436
+
428
437
  _request(params);
429
438
  }
430
439
  },
@@ -455,6 +464,7 @@ var ProTable = function ProTable(props) {
455
464
  targetPageSizeKey: targetPageSizeKey,
456
465
  pageSize: pageSize
457
466
  },
467
+ data: data,
458
468
  dataFilterForm: dataFilterForm,
459
469
  resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
460
470
  getHeaderHeight().then(function (height) {
@@ -653,6 +663,10 @@ var ProTable = function ProTable(props) {
653
663
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(_objectSpread({}, toJS(dataFilterForm.values))));
654
664
 
655
665
  if (dataFilterForm.validate()) {
666
+ var _actionRef$current6, _actionRef$current6$c;
667
+
668
+ // 搜索变化时,暂时先清空选择
669
+ (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$c = _actionRef$current6.clearRowSelection) === null || _actionRef$current6$c === void 0 ? void 0 : _actionRef$current6$c.call(_actionRef$current6);
656
670
  setCurrentPage(1); // const { mode, schema } = propsDataFilter as ProTableDataFilterProps;
657
671
  // TODO: 针对 inline 模式下的 search 组件做一下处理,如果空值切换下拉的时候不触发请求
658
672
  // if (mode === 'inline') {
@@ -749,15 +763,21 @@ var ProTable = function ProTable(props) {
749
763
 
750
764
  var renderFooter = function renderFooter() {
751
765
  function onChangePagination(currentPage) {
766
+ var _actionRef$current7, _actionRef$current7$c;
767
+
752
768
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
769
+ // 翻页暂时先清空选择
770
+ (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
753
771
  setCurrentPage(currentPage);
754
772
 
755
773
  _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
756
774
  }
757
775
 
758
776
  function onChangePaginationSize(currentPageSize) {
759
- var _request5;
777
+ var _actionRef$current8, _actionRef$current8$c, _request5;
760
778
 
779
+ // 翻页暂时先清空选择
780
+ (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
761
781
  setPageSize(currentPageSize);
762
782
  setCurrentPage(1);
763
783
 
@@ -129,6 +129,7 @@ export declare type rowSelectionType = {
129
129
  onSelect?: (selected: boolean, record: any, records: Array<any>) => void;
130
130
  onSelectAll?: (selected: boolean, records: Array<any>) => void;
131
131
  selectedRowKeys?: Array<any>;
132
+ selectedRecords?: any[];
132
133
  mode?: 'single' | 'multiple';
133
134
  titleProps?: () => any;
134
135
  columnProps?: () => any;
@@ -177,6 +178,8 @@ export declare type ProTableActionType = {
177
178
  resetPage?: () => void;
178
179
  /** 获取数据过滤区表单实例 */
179
180
  dataFilterForm?: FormType;
181
+ /** 表格当前的数据 */
182
+ data?: any[];
180
183
  } & ProTableActionTypeMutations;
181
184
  /** action State 定义 */
182
185
  export declare type ProTableActionTypeMutations = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamix/pro",
3
- "version": "1.2.17",
3
+ "version": "1.2.18",
4
4
  "description": "TeamixPro大包",
5
5
  "repository": "http://gitlab.alibaba-inc.com/teamix/pro",
6
6
  "author": "Velociraptor(迅猛龙)",