@teamix/pro 1.2.33 → 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.
@@ -165,7 +165,7 @@ var globalFormatSort = function globalFormatSort(sort) {
165
165
  };
166
166
 
167
167
  var ProTable = function ProTable(props) {
168
- var _rowSelection$selecte, _dataFilterForm4;
168
+ var _rowSelection$selecte;
169
169
 
170
170
  var header = props.header,
171
171
  className = props.className,
@@ -331,9 +331,14 @@ var ProTable = function ProTable(props) {
331
331
  var _useState27 = (0, _react.useState)(false),
332
332
  _useState28 = _slicedToArray(_useState27, 2),
333
333
  fullscreenState = _useState28[0],
334
- setFullscreenState = _useState28[1]; // 非全屏状态下的
334
+ setFullscreenState = _useState28[1]; // 切换全屏搜索开关
335
335
 
336
336
 
337
+ var filterEnableRef = (0, _react.useRef)({
338
+ fullscreen: false,
339
+ normal: true
340
+ }); // 非全屏状态下的
341
+
337
342
  var normalDataFilterFormRef = (0, _react.useRef)();
338
343
  var fullscreenDataFilterFormRef = (0, _react.useRef)();
339
344
  var normalDataFilterForm = normalDataFilterFormRef.current;
@@ -549,12 +554,12 @@ var ProTable = function ProTable(props) {
549
554
  _request(params);
550
555
  },
551
556
  reset: function reset() {
552
- var _actionRef$current4, _actionRef$current4$s, _dataFilterForm;
557
+ var _actionRef$current4, _actionRef$current4$s;
553
558
 
554
559
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
555
560
 
556
561
  (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, {});
557
- (_dataFilterForm = dataFilterForm) === null || _dataFilterForm === void 0 ? void 0 : _dataFilterForm.reset();
562
+ dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.reset();
558
563
  setCurrentPage(1);
559
564
 
560
565
  _request(_defineProperty({}, targetPageKey, 1));
@@ -579,6 +584,7 @@ var ProTable = function ProTable(props) {
579
584
  dataFilterForm: dataFilterForm,
580
585
  normalDataFilterForm: normalDataFilterForm,
581
586
  fullscreenDataFilterForm: fullscreenDataFilterForm,
587
+ filterEnableRef: filterEnableRef,
582
588
  resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
583
589
  getHeaderHeight().then(function (height) {
584
590
  setHeaderHeight(height);
@@ -667,8 +673,8 @@ var ProTable = function ProTable(props) {
667
673
  }
668
674
  }); // 请求函数
669
675
 
670
- function _request(params, noLoading) {
671
- var _dataFilterForm2, _actionRef$current$ge, _actionRef$current5, _actionRef$current5$g, _objectSpread2;
676
+ function _request(params, noLoading, filterParams) {
677
+ var _actionRef$current$ge, _actionRef$current5, _actionRef$current5$g, _objectSpread2;
672
678
 
673
679
  // 如果没有传 url 且没有 customRequest,直接返回
674
680
  if (!url && !customRequest) {
@@ -681,7 +687,7 @@ var ProTable = function ProTable(props) {
681
687
 
682
688
  var sortParams = targetFormatSort(sort); // 筛选区请求参数
683
689
 
684
- var dataFilterParams = toJS((_dataFilterForm2 = dataFilterForm) === null || _dataFilterForm2 === void 0 ? void 0 : _dataFilterForm2.values); // 列过滤请求参数
690
+ var dataFilterParams = filterParams !== null && filterParams !== void 0 ? filterParams : dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.values; // 列过滤请求参数
685
691
 
686
692
  var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$g = _actionRef$current5.getFilterRules) === null || _actionRef$current5$g === void 0 ? void 0 : _actionRef$current5$g.call(_actionRef$current5)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
687
693
 
@@ -732,31 +738,24 @@ var ProTable = function ProTable(props) {
732
738
  }
733
739
 
734
740
  (0, _react.useEffect)(function () {
735
- dataFilterForm = dataFilterFormRef.current; // 监听 浏览器变化 更吸底状态
741
+ var _propsDataFilter$sche, _propsDataFilter$sche2;
736
742
 
743
+ // 监听 浏览器变化 更吸底状态
737
744
  if (footerSuction) {
738
745
  getFooterSuctionState();
739
746
 
740
747
  window.onresize = function () {
741
748
  getFooterSuctionState();
742
749
  };
743
- }
750
+ } // 如果不传 dataFilter,则在这里初始化请求
744
751
 
745
- if (propsDataFilter) {
746
- var _dataFilterForm3;
747
752
 
748
- if (requestWhenMount && ((_dataFilterForm3 = dataFilterForm) === null || _dataFilterForm3 === void 0 ? void 0 : _dataFilterForm3.id)) {
749
- // 在请求发送之前 处理漏斗默认数据
750
- (0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
753
+ var hasDataFilter = (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche = propsDataFilter.schema) === null || _propsDataFilter$sche === void 0 ? void 0 : _propsDataFilter$sche.length) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche2 = propsDataFilter.schema) === null || _propsDataFilter$sche2 === void 0 ? void 0 : _propsDataFilter$sche2.length) > 0;
751
754
 
752
- _request();
753
- }
754
- } else {
755
- if (requestWhenMount) {
756
- (0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
755
+ if (requestWhenMount && !hasDataFilter) {
756
+ (0, _utils2.processDefaultFilter)(propsColumns, actionRef, defaultFilterParams);
757
757
 
758
- _request();
759
- }
758
+ _request();
760
759
  }
761
760
 
762
761
  return function () {
@@ -770,7 +769,7 @@ var ProTable = function ProTable(props) {
770
769
 
771
770
  actionRef.current = undefined;
772
771
  };
773
- }, [(_dataFilterForm4 = dataFilterForm) === null || _dataFilterForm4 === void 0 ? void 0 : _dataFilterForm4.id]);
772
+ }, []);
774
773
 
775
774
  function onSort(dataIndex, order) {
776
775
  var nextSort = _defineProperty({}, dataIndex, order);
@@ -784,24 +783,40 @@ var ProTable = function ProTable(props) {
784
783
  var dataFilter = _objectSpread(_objectSpread({
785
784
  mode: 'inline'
786
785
  }, propsDataFilter), {}, {
786
+ onInit: function onInit(values) {
787
+ // 表单初始化请求处理
788
+ (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit(values));
789
+ !fullscreenState && _request({}, false, values);
790
+ return true;
791
+ },
787
792
  onFilter: function onFilter(values) {
788
793
  var _actionRef$current6, _actionRef$current6$c;
789
794
 
795
+ // 全屏状态,判断全屏表单onFilter是否禁用
796
+ if (fullscreenState && !filterEnableRef.current.fullscreen) {
797
+ filterEnableRef.current.fullscreen = true;
798
+ return;
799
+ } // 非全屏状态,判断普通表单onFiler是否禁用
800
+
801
+
802
+ if (!fullscreenState && !filterEnableRef.current.normal) {
803
+ filterEnableRef.current.normal = true;
804
+ return;
805
+ }
806
+
790
807
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values)); // 搜索变化时,暂时先清空选择
791
808
 
792
809
  (_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);
793
810
  setCurrentPage(1);
794
811
 
795
- _request(_defineProperty({}, targetPageKey, 1));
812
+ _request(_defineProperty({}, targetPageKey, 1), false, values);
796
813
  },
797
- onReset: function onReset() {
798
- var _dataFilterForm5;
799
-
814
+ onReset: function onReset(values) {
800
815
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
801
- (_dataFilterForm5 = dataFilterForm) === null || _dataFilterForm5 === void 0 ? void 0 : _dataFilterForm5.reset();
816
+ dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.reset();
802
817
  setCurrentPage(1);
803
818
 
804
- _request(_defineProperty({}, targetPageKey, 1));
819
+ _request(_defineProperty({}, targetPageKey, 1), false, values);
805
820
  }
806
821
  });
807
822
 
@@ -192,6 +192,7 @@ export declare type ProTableActionType = {
192
192
  dataFilterForm?: FormType;
193
193
  normalDataFilterForm?: FormType;
194
194
  fullscreenDataFilterForm?: FormType;
195
+ filterEnableRef?: any;
195
196
  /** 表格当前的数据 */
196
197
  data?: any[];
197
198
  } & ProTableActionTypeMutations;
@@ -239,7 +239,7 @@ var processRenderFunction = function processRenderFunction() {
239
239
  var index = arguments.length > 2 ? arguments[2] : undefined;
240
240
  var record = arguments.length > 3 ? arguments[3] : undefined;
241
241
  // 当 ProField render 类型为 function 时。需要表格预先处理以塞入 record
242
- var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick'];
242
+ var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick', 'extra', 'prefixExtra'];
243
243
  return Object.fromEntries(Object.entries(render).map(function (_ref3) {
244
244
  var _ref4 = _slicedToArray(_ref3, 2),
245
245
  k = _ref4[0],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamix/pro",
3
- "version": "1.2.33",
3
+ "version": "1.2.34",
4
4
  "description": "TeamixPro大包",
5
5
  "repository": "http://gitlab.alibaba-inc.com/teamix/pro",
6
6
  "author": "Velociraptor(迅猛龙)",