@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.
@@ -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;
@@ -223,7 +223,7 @@ var processRenderFunction = function processRenderFunction() {
223
223
  var index = arguments.length > 2 ? arguments[2] : undefined;
224
224
  var record = arguments.length > 3 ? arguments[3] : undefined;
225
225
  // 当 ProField render 类型为 function 时。需要表格预先处理以塞入 record
226
- var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick'];
226
+ var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick', 'extra', 'prefixExtra'];
227
227
  return Object.fromEntries(Object.entries(render).map(function (_ref3) {
228
228
  var _ref4 = _slicedToArray(_ref3, 2),
229
229
  k = _ref4[0],
@@ -108,10 +108,14 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
108
108
 
109
109
  var _onFormInit = function onFormInit(form, _ref, configFilterItem) {
110
110
  var initialRequest = _ref.initialRequest,
111
+ initialValues = _ref.initialValues,
111
112
  onInit = _ref.onInit;
112
113
 
113
114
  if (!form.mounted) {
114
- form.loading = !!initialRequest;
115
+ // formloading为自定义属性
116
+ form.setState({
117
+ loading: !!initialRequest || !!initialValues
118
+ });
115
119
  }
116
120
 
117
121
  var loadingField = Object.values(form.fields).filter(function (field) {
@@ -120,14 +124,25 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
120
124
 
121
125
  if (form.mounted) {
122
126
  if (loadingField.length === 0 && !form.loading) {
123
- var onInitResult = onInit && onInit((0, _reactive.toJS)(form.values));
127
+ // 仅执行一次onInit
128
+ _onFormInit = function onFormInit() {};
129
+
130
+ var onInitResult = onInit === null || onInit === void 0 ? void 0 : onInit((0, _reactive.toJS)(form.values));
124
131
 
125
132
  if (onInitResult) {
126
133
  // 根据onInit返回值,判断是否使用该事件执行筛选,使用过则添加筛选标签
127
- configFilterItem && configFilterItem(form);
128
- }
134
+ configFilterItem === null || configFilterItem === void 0 ? void 0 : configFilterItem(form);
135
+ configTag();
136
+ } // 防止onInit前后的无效onFilter
129
137
 
130
- _onFormInit = function onFormInit() {};
138
+
139
+ if (!Object.keys(form.initialValues).length) {
140
+ // 如果没有默认值,直接开启onFilter
141
+ filterEnable.current = true;
142
+ } else {
143
+ // 否则,拿onFilter的值与默认值进行比较
144
+ filterEnable.current = form.initialValues;
145
+ }
131
146
  }
132
147
  }
133
148
  }; // 设置当前form
@@ -208,6 +223,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
208
223
 
209
224
  var filterItem = (0, _react.useRef)([]);
210
225
  var currentForm = (0, _react.useRef)(mode === 'panel' ? advancedFilterVisible ? 'advanced' : 'light' : 'simple');
226
+ var filterEnable = (0, _react.useRef)(false);
211
227
  var prefixCls = (0, _utils.usePrefixCls)('', {
212
228
  prefix: 'teamix-pro-form-query-filter'
213
229
  }); // 设置筛选数据
@@ -273,7 +289,22 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
273
289
 
274
290
  setAdvancedFilterVisible(result);
275
291
  onExpand === null || onExpand === void 0 ? void 0 : onExpand(result);
276
- }, [advancedFilterVisible, configTag, currentForm.current]); // 简单搜索Filter
292
+ }, [advancedFilterVisible, configTag, currentForm.current]); // 是否开启onFilter
293
+
294
+ var enableFilter = function enableFilter(values) {
295
+ var initialValues = JSON.stringify((0, _utils.getValidValues)(filterEnable.current));
296
+ var changeValues = JSON.stringify((0, _utils.getValidValues)(values));
297
+
298
+ if (filterEnable.current === true) {
299
+ return true;
300
+ } else if (initialValues === changeValues) {
301
+ filterEnable.current = true;
302
+ return false;
303
+ }
304
+
305
+ return false;
306
+ }; // 简单搜索Filter
307
+
277
308
 
278
309
  var onSimpleFilter = (0, _react.useCallback)( /*#__PURE__*/function () {
279
310
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(values) {
@@ -281,23 +312,31 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
281
312
  while (1) {
282
313
  switch (_context.prev = _context.next) {
283
314
  case 0:
315
+ if (enableFilter(values)) {
316
+ _context.next = 2;
317
+ break;
318
+ }
319
+
320
+ return _context.abrupt("return");
321
+
322
+ case 2:
284
323
  if (!(currentForm.current === 'simple')) {
285
- _context.next = 5;
324
+ _context.next = 7;
286
325
  break;
287
326
  }
288
327
 
289
328
  if (!hasRequired) {
290
- _context.next = 4;
329
+ _context.next = 6;
291
330
  break;
292
331
  }
293
332
 
294
- _context.next = 4;
333
+ _context.next = 6;
295
334
  return simpleForm.validate();
296
335
 
297
- case 4:
298
- onFilter && onFilter(values);
336
+ case 6:
337
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter(values);
299
338
 
300
- case 5:
339
+ case 7:
301
340
  case "end":
302
341
  return _context.stop();
303
342
  }
@@ -308,7 +347,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
308
347
  return function (_x) {
309
348
  return _ref4.apply(this, arguments);
310
349
  };
311
- }(), [onFilter, currentForm.current, hasRequired]); // 轻量搜索Filter
350
+ }(), [onFilter, currentForm.current, hasRequired, enableFilter]); // 轻量搜索Filter
312
351
 
313
352
  var onLightFilter = (0, _react.useCallback)( /*#__PURE__*/function () {
314
353
  var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(values) {
@@ -316,21 +355,29 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
316
355
  while (1) {
317
356
  switch (_context2.prev = _context2.next) {
318
357
  case 0:
358
+ if (enableFilter(values)) {
359
+ _context2.next = 2;
360
+ break;
361
+ }
362
+
363
+ return _context2.abrupt("return");
364
+
365
+ case 2:
319
366
  if (!(currentForm.current === 'light')) {
320
- _context2.next = 6;
367
+ _context2.next = 8;
321
368
  break;
322
369
  }
323
370
 
324
- onFilter && onFilter(values);
325
- _context2.next = 4;
371
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter(values);
372
+ _context2.next = 6;
326
373
  return advancedForm.reset();
327
374
 
328
- case 4:
375
+ case 6:
329
376
  // 不会触发高级筛选的onReset回调函数
330
377
  configFilterItem(advancedForm);
331
378
  configTag();
332
379
 
333
- case 6:
380
+ case 8:
334
381
  case "end":
335
382
  return _context2.stop();
336
383
  }
@@ -341,18 +388,28 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
341
388
  return function (_x2) {
342
389
  return _ref5.apply(this, arguments);
343
390
  };
344
- }(), [onFilter, currentForm.current]); // 高级搜索Filter
391
+ }(), [onFilter, currentForm.current, enableFilter]); // 高级搜索Filter
345
392
 
346
393
  var onAdvancedFilter = (0, _react.useCallback)(function (values) {
394
+ if (!enableFilter(values)) {
395
+ return;
396
+ }
397
+
347
398
  setCurrentForm('advanced');
348
- onFilter && onFilter(values);
399
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter(values);
349
400
  configFilterItem(advancedForm);
350
401
  lightForm.reset();
351
- }, [onFilter, currentForm.current]); // 高级搜索Reset
402
+ }, [onFilter, currentForm.current, enableFilter]); // 高级搜索Change
403
+
404
+ var onAdvancedChange = (0, _react.useCallback)(function (values) {
405
+ if (!enableFilter(values)) {
406
+ return;
407
+ }
408
+ }, [enableFilter]); // 高级搜索Reset
352
409
 
353
410
  var onAdvancedReset = (0, _react.useCallback)(function () {
354
411
  setCurrentForm('advanced');
355
- onReset && onReset((0, _reactive.toJS)(advancedForm.values));
412
+ onReset === null || onReset === void 0 ? void 0 : onReset((0, _reactive.toJS)(advancedForm.values));
356
413
  configFilterItem(advancedForm);
357
414
  lightForm.reset();
358
415
  }, [onReset]); // 关闭标签清空表单字段值
@@ -368,11 +425,10 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
368
425
  advancedForm.setValuesIn(key, newValue);
369
426
  configFilterItem(advancedForm);
370
427
  configTag();
371
- onFilter && onFilter((0, _reactive.toJS)(advancedForm.values));
372
- }, []); // 异步默认值回调,设置form的loading状态为false
428
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter((0, _reactive.toJS)(advancedForm.values));
429
+ }, []); // initialValues和initialRequest的回调
373
430
 
374
- var onInitialRequestComplete = (0, _react.useCallback)(function (_, __, _ref6) {
375
- var form = _ref6.form;
431
+ var onInitialComplete = (0, _react.useCallback)(function (form) {
376
432
  form.setState({
377
433
  loading: false
378
434
  });
@@ -398,22 +454,22 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
398
454
  }, /*#__PURE__*/_react.default.createElement(_SimpleFilter.default, _objectSpread(_objectSpread({}, otherProps), {}, {
399
455
  form: simpleForm,
400
456
  onChange: (0, _lodash.default)(onSimpleFilter, filterDebounce),
401
- onSubmit: onSimpleFilter
457
+ onSubmit: onSimpleFilter,
458
+ onInitialComplete: onInitialComplete
402
459
  }))),
403
460
  panelContent: mode === 'panel' ? /*#__PURE__*/_react.default.createElement(_AdvancedFilter.default, _objectSpread(_objectSpread({}, otherProps), {}, {
404
- initialRequest: otherProps.initialRequest ? _objectSpread(_objectSpread({}, otherProps.initialRequest), {}, {
405
- onComplete: onInitialRequestComplete
406
- }) : undefined,
407
461
  form: advancedForm,
462
+ onChange: (0, _lodash.default)(onAdvancedChange, filterDebounce),
408
463
  onSubmit: onAdvancedFilter,
409
- onReset: onAdvancedReset
464
+ onReset: onAdvancedReset,
465
+ onInitialComplete: onInitialComplete
410
466
  })) : null
411
- }, mode === 'panel' && !advancedFilterVisible ? /*#__PURE__*/_react.default.createElement(_components.Tag.Group, null, tagDataSource.map(function (_ref7) {
412
- var key = _ref7.key,
413
- label = _ref7.label,
414
- value = _ref7.value,
415
- type = _ref7.type,
416
- index = _ref7.index;
467
+ }, mode === 'panel' && !advancedFilterVisible ? /*#__PURE__*/_react.default.createElement(_components.Tag.Group, null, tagDataSource.map(function (_ref6) {
468
+ var key = _ref6.key,
469
+ label = _ref6.label,
470
+ value = _ref6.value,
471
+ type = _ref6.type,
472
+ index = _ref6.index;
417
473
  return /*#__PURE__*/_react.default.createElement(_components.Tag.Closeable, {
418
474
  key: (0, _utils.isNum)(index) ? key + label : key,
419
475
  afterClose: function afterClose() {
@@ -31,7 +31,7 @@ var _validate = _interopRequireDefault(require("../locales/validate"));
31
31
 
32
32
  require("./index.scss");
33
33
 
34
- var _excluded = ["form", "initialValues", "initialRequest", "schema", "scope", "context", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed", "className"];
34
+ var _excluded = ["form", "initialValues", "initialRequest", "schema", "scope", "context", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed", "onInitialComplete", "className"];
35
35
 
36
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
37
 
@@ -68,6 +68,7 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
68
68
  onChange = _ref.onChange,
69
69
  onSubmit = _ref.onSubmit,
70
70
  onSubmitFailed = _ref.onSubmitFailed,
71
+ onInitialComplete = _ref.onInitialComplete,
71
72
  className = _ref.className,
72
73
  otherProps = _objectWithoutProperties(_ref, _excluded);
73
74
 
@@ -118,13 +119,12 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
118
119
  (0, _react.useEffect)(function () {
119
120
  if (initialValues) {
120
121
  form.setInitialValues(initialValues);
122
+ onInitialComplete === null || onInitialComplete === void 0 ? void 0 : onInitialComplete(form);
121
123
  } else if (initialRequest) {
122
124
  (0, _useInitialRequest.default)(initialRequest).then(function (values) {
123
125
  form.setInitialValues(values);
124
126
  }).finally(function () {
125
- initialRequest.onComplete && initialRequest.onComplete(undefined, undefined, {
126
- form: form
127
- });
127
+ onInitialComplete === null || onInitialComplete === void 0 ? void 0 : onInitialComplete(form);
128
128
  });
129
129
  }
130
130
  }, []); // 配置国际化
@@ -1,6 +1,6 @@
1
1
  import type { ProFormRequestConfig } from '../typing';
2
2
  interface IInitializeRequest {
3
- (requestConfig?: ProFormRequestConfig, suffix?: string): {
3
+ (requestConfig?: ProFormRequestConfig | ProFormRequestConfig[], suffix?: string): {
4
4
  reactions: any[];
5
5
  scope: {
6
6
  [x: string]: any;
@@ -5,15 +5,51 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _utils = require("@teamix/utils");
9
+
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; }
11
+
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; }
13
+
8
14
  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; }
9
15
 
16
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
17
+
18
+ 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."); }
19
+
20
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
+
22
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
23
+
24
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
25
+
26
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
27
+
10
28
  var initializeRequest = function initializeRequest(requestConfig, suffix) {
11
29
  if (requestConfig) {
12
- var requestConfigName = "$requestConfig_".concat(suffix);
13
- return {
14
- reactions: ["{{$common($request,".concat(requestConfigName, ",context)}}")],
15
- scope: _defineProperty({}, requestConfigName, requestConfig)
16
- };
30
+ if ((0, _utils.isArr)(requestConfig)) {
31
+ var reactionsMap = [];
32
+ var scopeMap = {};
33
+ requestConfig.forEach(function (item, index) {
34
+ var _initializeRequest = initializeRequest(item, "".concat(suffix).concat(index)),
35
+ reactions = _initializeRequest.reactions,
36
+ scope = _initializeRequest.scope;
37
+
38
+ reactionsMap = [].concat(_toConsumableArray(reactionsMap), _toConsumableArray(reactions));
39
+ scopeMap = _objectSpread(_objectSpread({}, scopeMap), scope);
40
+ });
41
+ return {
42
+ reactions: reactionsMap,
43
+ scope: scopeMap
44
+ };
45
+ } else {
46
+ var requestConfigName = "$requestConfig_".concat(suffix);
47
+ var requestIndex = (/\d{1,}\w(\d{0,})/g.exec(suffix) || [])[1];
48
+ return {
49
+ reactions: ["{{$common($request,".concat(requestConfigName, ",context,").concat(requestIndex, ")}}")],
50
+ scope: _defineProperty({}, requestConfigName, requestConfig)
51
+ };
52
+ }
17
53
  }
18
54
 
19
55
  return {
@@ -1,6 +1,6 @@
1
1
  import type { ProFormRequestConfig } from '../typing';
2
- declare const $request: (field: any, requestConfig: ProFormRequestConfig, context: any) => Promise<unknown>;
3
- declare const $common: (services: any, requestConfig: ProFormRequestConfig, context: any) => (field: any) => any;
2
+ declare const $request: (field: any, requestConfig: ProFormRequestConfig, context: any, type: string | number) => Promise<unknown>;
3
+ declare const $common: (services: any, requestConfig: ProFormRequestConfig, context: any, index: string) => (field: any) => any;
4
4
  declare const $validator: (services: any, requestConfig: ProFormRequestConfig, context: any) => (value: any, rules: any, { field }: any) => any;
5
5
  declare const $dataSource: (services: any, requestConfig: ProFormRequestConfig, context: any) => (field: any) => any;
6
6
  export { $request, $common, $dataSource, $validator };
@@ -14,10 +14,17 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
14
14
  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; }
15
15
 
16
16
  // 配置请求
17
- var $request = function $request(field, requestConfig, context) {
17
+ var $request = function $request(field, requestConfig, context, type) {
18
18
  var _field$data;
19
19
 
20
- var refresh = field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
20
+ // let refresh
21
+ // if(isStr(type)){
22
+ // refresh = field.data?.refreshMap?.[type]
23
+ // }else if(isNum(type)){
24
+ // }else{
25
+ // refresh = field.data?.refresh;
26
+ // }
27
+ var refresh = (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
21
28
  var beforeRequest = requestConfig.beforeRequest,
22
29
  onSuccess = requestConfig.onSuccess;
23
30
  var refreshResult = (0, _utils.isPlainObj)(refresh) ? refresh : {};
@@ -36,9 +43,9 @@ var $request = function $request(field, requestConfig, context) {
36
43
 
37
44
  exports.$request = $request;
38
45
 
39
- var $common = function $common(services, requestConfig, context) {
46
+ var $common = function $common(services, requestConfig, context, index) {
40
47
  return function (field) {
41
- return services(field, requestConfig, context).then(function (res) {
48
+ return services(field, requestConfig, context, index || 'common').then(function (res) {
42
49
  return requestConfig.onComplete && requestConfig.onComplete(res, field, context);
43
50
  });
44
51
  };
@@ -50,7 +57,7 @@ exports.$common = $common;
50
57
  var $validator = function $validator(services, requestConfig, context) {
51
58
  return function (value, rules, _ref) {
52
59
  var field = _ref.field;
53
- return services(field, requestConfig, context).then(function (res) {
60
+ return services(field, requestConfig, context, 'validator').then(function (res) {
54
61
  return requestConfig.onComplete && requestConfig.onComplete(res, field, context);
55
62
  });
56
63
  };
@@ -65,7 +72,7 @@ var $dataSource = function $dataSource(services, requestConfig, context) {
65
72
  loading: true,
66
73
  readOnly: true
67
74
  });
68
- return services(field, requestConfig, context).then(function (res) {
75
+ return services(field, requestConfig, context, 'dataSource').then(function (res) {
69
76
  var isValueInDataSource = (0, _utils.getValueByValue)(res, field.value);
70
77
  var clearValue = isValueInDataSource ? {} : {
71
78
  value: undefined
@@ -44,7 +44,7 @@ export interface ProFormSchemaItem {
44
44
  readPretty?: boolean | string;
45
45
  pattern?: FieldPatternTypes;
46
46
  default?: any;
47
- request?: ProFormRequestConfig;
47
+ request?: ProFormRequestConfig | ProFormRequestConfig[];
48
48
  data?: AnyObject;
49
49
  }
50
50
  export declare type ProFormSchema = ProFormSchemaItem[];
@@ -63,6 +63,7 @@ export interface ProFormProps extends IFormLayoutProps {
63
63
  onChange?: (values: any, fieldValue?: any, fieldName?: any) => any;
64
64
  onSubmit?: ((values: any) => any) | CommonRequestConfig;
65
65
  onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
66
+ onInitialComplete?: (form: FormType) => void;
66
67
  }
67
68
  export interface FilterProps extends ProFormProps {
68
69
  form: FormType;
package/lib/index.d.ts CHANGED
@@ -24,5 +24,5 @@ export * from './skeleton';
24
24
  export * from './table';
25
25
  export * from './utils';
26
26
  export * from './step';
27
- declare const version = "1.2.33";
27
+ declare const version = "1.2.34";
28
28
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProStep, hooks, nocode, templates, utils, };
package/lib/index.js CHANGED
@@ -285,5 +285,5 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
285
285
  // 设置图标源
286
286
  _icon.default.setConfig(_utils.default.getTeamixIconConfig());
287
287
 
288
- var version = '1.2.33';
288
+ var version = '1.2.34';
289
289
  exports.version = version;
@@ -25,7 +25,8 @@ var FullScreen = function FullScreen(props) {
25
25
  actionRef = props.actionRef;
26
26
  var _actionRef$current = actionRef.current,
27
27
  normalDataFilterForm = _actionRef$current.normalDataFilterForm,
28
- fullscreenDataFilterForm = _actionRef$current.fullscreenDataFilterForm;
28
+ fullscreenDataFilterForm = _actionRef$current.fullscreenDataFilterForm,
29
+ filterEnableRef = _actionRef$current.filterEnableRef;
29
30
 
30
31
  var closeByESC = function closeByESC(e) {
31
32
  if (visible && e.code === 'Escape') {
@@ -44,12 +45,38 @@ var FullScreen = function FullScreen(props) {
44
45
  }, [visible, actionRef]);
45
46
 
46
47
  var afterClose = function afterClose() {
47
- normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.setValues(fullscreenDataFilterForm.values);
48
+ // 判断全屏前后筛选表单值是否有改变
49
+ var n = JSON.stringify((0, _utils.getValidValues)(normalDataFilterForm.values));
50
+ var f = JSON.stringify((0, _utils.getValidValues)(fullscreenDataFilterForm.values));
51
+
52
+ if (n === f) {
53
+ // 关闭全屏后,表单值未变化,开启普通表单onFilter
54
+ filterEnableRef.current.normal = true;
55
+ } else {
56
+ // 关闭全屏后,表单值有变化,修改表单值
57
+ normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.setValues(fullscreenDataFilterForm.values);
58
+ } // 关闭全屏后,关闭全屏表单onFilter
59
+
60
+
61
+ filterEnableRef.current.fullscreen = false;
48
62
  }; // 全屏开启之后
49
63
 
50
64
 
51
65
  var afterOpen = function afterOpen() {
52
- fullscreenDataFilterForm.setValues(normalDataFilterForm.values);
66
+ // 判断全屏前后筛选表单值是否有改变
67
+ var n = JSON.stringify((0, _utils.getValidValues)(normalDataFilterForm.values));
68
+ var f = JSON.stringify((0, _utils.getValidValues)(fullscreenDataFilterForm.values));
69
+
70
+ if (n === f) {
71
+ // 全屏后,表单值未变化,开启全屏表单onFilter
72
+ filterEnableRef.current.fullscreen = true;
73
+ } else {
74
+ // 全屏后,表单值变化,修改表单值
75
+ fullscreenDataFilterForm === null || fullscreenDataFilterForm === void 0 ? void 0 : fullscreenDataFilterForm.setValues(normalDataFilterForm.values);
76
+ } // 全屏后,关闭普通表单onFilter
77
+
78
+
79
+ filterEnableRef.current.normal = false; // 消息提示
53
80
 
54
81
  _components.Message.show({
55
82
  type: 'notice',