@teamix/pro 1.2.33 → 1.3.1

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 (93) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +17242 -17233
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog-form.d.ts +9 -4
  6. package/es/actions/dialog-form.js +16 -9
  7. package/es/form/Filter/AdvancedFilter.js +4 -4
  8. package/es/form/Filter/LightFilter.js +22 -15
  9. package/es/form/Filter/index.js +200 -106
  10. package/es/form/Filter/useSpecialProps.d.ts +1 -1
  11. package/es/form/Filter/useSpecialProps.js +9 -9
  12. package/es/form/ProForm/index.js +4 -4
  13. package/es/form/ProForm/index.scss +8 -8
  14. package/es/form/SchemaForm/index.js +4 -4
  15. package/es/form/SchemaForm/initializeDataSource.d.ts +1 -1
  16. package/es/form/SchemaForm/initializeDataSource.js +2 -2
  17. package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
  18. package/es/form/SchemaForm/initializeRequest.js +40 -5
  19. package/es/form/SchemaForm/reactions.d.ts +2 -2
  20. package/es/form/SchemaForm/reactions.js +39 -21
  21. package/es/form/typing.d.ts +10 -2
  22. package/es/index.d.ts +4 -4
  23. package/es/index.js +4 -4
  24. package/es/nocode/configurators/PageHeader.js +2 -2
  25. package/es/page-header/index.js +7 -3
  26. package/es/table/components/Layout/index.js +2 -2
  27. package/es/table/components/Pagination/index.js +11 -1
  28. package/es/table/components/ToolBar/Fullscreen.js +32 -4
  29. package/es/table/index.js +70 -40
  30. package/es/table/index.scss +6 -0
  31. package/es/table/typing.d.ts +10 -6
  32. package/es/table/utils/columnRender.js +1 -1
  33. package/es/timeline/ProTimeLineItem/index.d.ts +5 -0
  34. package/es/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.js +59 -72
  35. package/es/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.scss +34 -86
  36. package/es/timeline/index.d.ts +10 -0
  37. package/es/{step → timeline}/index.js +33 -57
  38. package/es/timeline/index.scss +7 -0
  39. package/es/timeline/typing.d.ts +101 -0
  40. package/es/{step → timeline}/typing.js +0 -0
  41. package/lib/actions/dialog-form.d.ts +9 -4
  42. package/lib/actions/dialog-form.js +16 -9
  43. package/lib/form/Filter/AdvancedFilter.js +4 -4
  44. package/lib/form/Filter/LightFilter.js +21 -15
  45. package/lib/form/Filter/index.js +199 -105
  46. package/lib/form/Filter/useSpecialProps.d.ts +1 -1
  47. package/lib/form/Filter/useSpecialProps.js +8 -8
  48. package/lib/form/ProForm/index.js +4 -4
  49. package/lib/form/ProForm/index.scss +8 -8
  50. package/lib/form/SchemaForm/index.js +4 -4
  51. package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -1
  52. package/lib/form/SchemaForm/initializeDataSource.js +2 -2
  53. package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
  54. package/lib/form/SchemaForm/initializeRequest.js +40 -5
  55. package/lib/form/SchemaForm/reactions.d.ts +2 -2
  56. package/lib/form/SchemaForm/reactions.js +38 -20
  57. package/lib/form/typing.d.ts +10 -2
  58. package/lib/index.d.ts +4 -4
  59. package/lib/index.js +10 -10
  60. package/lib/nocode/configurators/PageHeader.js +2 -2
  61. package/lib/page-header/index.js +6 -2
  62. package/lib/table/components/Layout/index.js +2 -2
  63. package/lib/table/components/Pagination/index.js +10 -0
  64. package/lib/table/components/ToolBar/Fullscreen.js +30 -3
  65. package/lib/table/index.js +70 -40
  66. package/lib/table/index.scss +6 -0
  67. package/lib/table/typing.d.ts +10 -6
  68. package/lib/table/utils/columnRender.js +1 -1
  69. package/lib/timeline/ProTimeLineItem/index.d.ts +5 -0
  70. package/lib/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.js +58 -72
  71. package/lib/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.scss +34 -86
  72. package/lib/timeline/index.d.ts +10 -0
  73. package/lib/{step → timeline}/index.js +38 -58
  74. package/lib/timeline/index.scss +7 -0
  75. package/lib/timeline/typing.d.ts +101 -0
  76. package/lib/{step → timeline}/typing.js +0 -0
  77. package/package.json +1 -1
  78. package/es/step/ProStepItem/components/HozStepItem/index.d.ts +0 -5
  79. package/es/step/ProStepItem/components/HozStepItem/index.js +0 -235
  80. package/es/step/ProStepItem/components/HozStepItem/index.scss +0 -279
  81. package/es/step/ProStepItem/components/VerStepItem/index.d.ts +0 -5
  82. package/es/step/ProStepItem/index.d.ts +0 -4
  83. package/es/step/ProStepItem/index.js +0 -57
  84. package/es/step/index.d.ts +0 -9
  85. package/es/step/typing.d.ts +0 -96
  86. package/lib/step/ProStepItem/components/HozStepItem/index.d.ts +0 -5
  87. package/lib/step/ProStepItem/components/HozStepItem/index.js +0 -258
  88. package/lib/step/ProStepItem/components/HozStepItem/index.scss +0 -279
  89. package/lib/step/ProStepItem/components/VerStepItem/index.d.ts +0 -5
  90. package/lib/step/ProStepItem/index.d.ts +0 -4
  91. package/lib/step/ProStepItem/index.js +0 -69
  92. package/lib/step/index.d.ts +0 -9
  93. package/lib/step/typing.d.ts +0 -96
@@ -40,7 +40,7 @@ import debounce from 'lodash.debounce';
40
40
  import { Tag } from '@alicloudfe/components';
41
41
  import { createForm, onFormReact, onFormInputChange } from '@formily/core';
42
42
  import { toJS } from '@formily/reactive';
43
- import { usePrefixCls, isSignificative, isNum } from '@teamix/utils';
43
+ import { usePrefixCls, isUsable, isNum, getValidValues } from '@teamix/utils';
44
44
  import ProField from '../../field/index';
45
45
  import fieldTypeMap from '../fieldTypeMap';
46
46
  import { getFormDisplayValues } from '../ProForm/useFormDisplayValues';
@@ -67,34 +67,79 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
67
67
  onInit = props.onInit,
68
68
  onReset = props.onReset,
69
69
  onExpand = props.onExpand,
70
- otherProps = _objectWithoutProperties(props, _excluded); // 表单默认值初始化回调
70
+ otherProps = _objectWithoutProperties(props, _excluded);
71
71
 
72
+ var _useSpecialProps = useSpecialProps(props),
73
+ hasChangeDefault = _useSpecialProps.hasChangeDefault,
74
+ hasRequired = _useSpecialProps.hasRequired;
75
+
76
+ var _useState = useState(!!expand),
77
+ _useState2 = _slicedToArray(_useState, 2),
78
+ panelVisible = _useState2[0],
79
+ setPanelVisible = _useState2[1];
80
+
81
+ var _useState3 = useState([]),
82
+ _useState4 = _slicedToArray(_useState3, 2),
83
+ tagDataSource = _useState4[0],
84
+ setTagDataSource = _useState4[1];
85
+
86
+ var filterItem = useRef([]);
87
+ var defaultForm = mode === 'panel' ? 'advanced' : 'simple';
88
+ var currentForm = useRef(defaultForm);
89
+ var activeFilterValueRef = useRef();
90
+ var prefixCls = usePrefixCls('', {
91
+ prefix: 'teamix-pro-form-query-filter'
92
+ });
93
+ /**
94
+ * 处理onInit与onFilter事件的触发问题
95
+ */
96
+
97
+ var filterEnable = useRef('waiting');
72
98
 
73
- var _onFormInit = function onFormInit(form, _ref, configFilterItem) {
99
+ var _onFormInit = function onFormInit(form, _ref) {
74
100
  var initialRequest = _ref.initialRequest,
75
- onInit = _ref.onInit;
101
+ initialValues = _ref.initialValues;
76
102
 
77
103
  if (!form.mounted) {
78
- form.loading = !!initialRequest;
104
+ // 借用formloading属性来判断initialValues和initialRequest是否完成
105
+ form.setState({
106
+ loading: !!initialRequest || !!initialValues
107
+ });
79
108
  }
80
109
 
81
110
  var loadingField = Object.values(form.fields).filter(function (field) {
82
111
  return !!field.loading;
83
- });
112
+ }); // 等待表单mounted + 字段loading结束 + form默认值初始化 => 表单初始化完成
84
113
 
85
- if (form.mounted) {
86
- if (loadingField.length === 0 && !form.loading) {
87
- var onInitResult = onInit && onInit(toJS(form.values));
114
+ if (form.mounted && !loadingField.length && !form.loading) {
115
+ _onFormInit = function onFormInit() {}; // init后销毁 isFormInit 方法
88
116
 
89
- if (onInitResult) {
90
- // 根据onInit返回值,判断是否使用该事件执行筛选,使用过则添加筛选标签
91
- configFilterItem && configFilterItem(form);
92
- }
93
117
 
94
- _onFormInit = function onFormInit() {};
118
+ var values = getValidValues(form.values);
119
+
120
+ if (!isUsable(values) || !hasChangeDefault) {
121
+ // 表单无默认值 或 无触发onChange的默认值配置,不会触发onFilter内的onInit,所以主动触发onInit
122
+ filterEnable.current = 'filter';
123
+ setTimeout(function () {
124
+ onInit === null || onInit === void 0 ? void 0 : onInit(toJS(form.values));
125
+ }, 0);
126
+
127
+ if (mode === 'panel') {
128
+ // 移除lightForm的默认值
129
+ // 设置Tag
130
+ configFilterItem(advancedForm);
131
+
132
+ if (!panelVisible) {
133
+ setTimeout(function () {
134
+ configTag();
135
+ }, 0);
136
+ }
137
+ }
138
+ } else {
139
+ filterEnable.current = 'initialized';
95
140
  }
96
141
  }
97
- }; // 设置当前form
142
+ }; // 配置当前激活的form实例
98
143
 
99
144
 
100
145
  var setCurrentForm = function setCurrentForm(formName) {
@@ -104,9 +149,11 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
104
149
  var form = formMap[formName];
105
150
  formRef.current = form;
106
151
 
107
- formRef.current.updateTags = function () {
108
- configFilterItem(form);
109
- };
152
+ if (!formRef.current.updateTags) {
153
+ formRef.current.updateTags = function () {
154
+ configFilterItem(form);
155
+ };
156
+ }
110
157
  }
111
158
  }; // 创建简单筛选表单实例
112
159
 
@@ -116,7 +163,9 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
116
163
  validateFirst: true,
117
164
  effects: function effects() {
118
165
  onFormReact(function (form) {
119
- _onFormInit(form, props);
166
+ if (mode === 'inline') {
167
+ _onFormInit(form, props);
168
+ }
120
169
  });
121
170
  }
122
171
  });
@@ -127,7 +176,7 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
127
176
  validateFirst: true,
128
177
  effects: function effects() {
129
178
  onFormInputChange(function () {
130
- setCurrentForm('light');
179
+ setCurrentForm('light'); // 主动修改轻量筛选值
131
180
  });
132
181
  }
133
182
  });
@@ -138,11 +187,12 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
138
187
  validateFirst: true,
139
188
  effects: function effects() {
140
189
  onFormReact(function (form) {
141
- _onFormInit(form, props, configFilterItem);
190
+ if (mode === 'panel') {
191
+ _onFormInit(form, props);
192
+ }
142
193
  });
143
194
  onFormInputChange(function (form) {
144
- // 主动修改高级筛选值
145
- setCurrentForm('advanced');
195
+ setCurrentForm('advanced'); // 主动修改高级筛选值
146
196
  });
147
197
  }
148
198
  });
@@ -151,34 +201,7 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
151
201
  simple: simpleForm,
152
202
  light: lightForm,
153
203
  advanced: advancedForm
154
- };
155
-
156
- var _useSpecialProps = useSpecialProps(props),
157
- hasDefault = _useSpecialProps.hasDefault,
158
- hasAsyncDefault = _useSpecialProps.hasAsyncDefault,
159
- hasRequired = _useSpecialProps.hasRequired;
160
-
161
- var hasDefaultOrRequired = hasDefault || hasAsyncDefault || hasRequired;
162
-
163
- var _useState = useState(!!expand),
164
- _useState2 = _slicedToArray(_useState, 2),
165
- advancedFilterVisible = _useState2[0],
166
- setAdvancedFilterVisible = _useState2[1];
167
-
168
- var _useState3 = useState([]),
169
- _useState4 = _slicedToArray(_useState3, 2),
170
- tagDataSource = _useState4[0],
171
- setTagDataSource = _useState4[1];
172
-
173
- var filterItem = useRef([]);
174
- var currentForm = useRef(mode === 'panel' ? advancedFilterVisible ? 'advanced' : 'light' : 'simple');
175
- var prefixCls = usePrefixCls('', {
176
- prefix: 'teamix-pro-form-query-filter'
177
- }); // 设置筛选数据
178
-
179
- var configFilterItem = useCallback(function (form) {
180
- filterItem.current = getFilterDisplayValues(form);
181
- }, []); // 获取筛选数据Label
204
+ }; // 获取筛选数据Label
182
205
 
183
206
  var getFilterDisplayValues = useCallback(function (form) {
184
207
  var displayValues = getFormDisplayValues(form);
@@ -206,7 +229,7 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
206
229
  index: index
207
230
  });
208
231
  });
209
- } else if (isSignificative(value)) {
232
+ } else if (isUsable(value)) {
210
233
  filterData.push({
211
234
  key: key,
212
235
  type: fieldTypeMap[component] || 'text',
@@ -216,28 +239,34 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
216
239
  }
217
240
  });
218
241
  return filterData;
242
+ }, []); // 设置筛选数据
243
+
244
+ var configFilterItem = useCallback(function (form) {
245
+ filterItem.current = getFilterDisplayValues(form);
219
246
  }, []); // 设置标签数据
220
247
 
221
248
  var configTag = useCallback(function () {
222
249
  setTagDataSource(filterItem.current);
223
- }, [filterItem.current]); // 展开收起高级筛选
250
+ }, []); // 展开收起高级筛选
224
251
 
225
252
  var toggleAdvancedFilter = useCallback(function () {
226
- var result = !advancedFilterVisible;
253
+ var result = !panelVisible;
227
254
 
228
255
  if (result) {
229
256
  // 展开高级筛选,Light回填Advanced
230
257
  if (currentForm.current === 'light') {
231
- advancedForm.setValues(lightForm.values);
258
+ var key = activeFilterValueRef.current;
259
+ var value = lightForm.values[key];
260
+ advancedForm.setValuesIn(key, value);
232
261
  }
233
262
  } else {
234
263
  // 收起高级筛选,配置标签数据
235
264
  configTag();
236
265
  }
237
266
 
238
- setAdvancedFilterVisible(result);
267
+ setPanelVisible(result);
239
268
  onExpand === null || onExpand === void 0 ? void 0 : onExpand(result);
240
- }, [advancedFilterVisible, configTag, currentForm.current]); // 简单搜索Filter
269
+ }, [panelVisible, configTag]); // 简单搜索Filter
241
270
 
242
271
  var onSimpleFilter = useCallback( /*#__PURE__*/function () {
243
272
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(values) {
@@ -246,22 +275,48 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
246
275
  switch (_context.prev = _context.next) {
247
276
  case 0:
248
277
  if (!(currentForm.current === 'simple')) {
249
- _context.next = 5;
278
+ _context.next = 14;
279
+ break;
280
+ }
281
+
282
+ if (!(filterEnable.current === 'initialized')) {
283
+ _context.next = 9;
250
284
  break;
251
285
  }
252
286
 
287
+ filterEnable.current = 'filter';
288
+
253
289
  if (!hasRequired) {
254
- _context.next = 4;
290
+ _context.next = 6;
255
291
  break;
256
292
  }
257
293
 
258
- _context.next = 4;
294
+ _context.next = 6;
259
295
  return simpleForm.validate();
260
296
 
261
- case 4:
262
- onFilter && onFilter(values);
297
+ case 6:
298
+ onInit === null || onInit === void 0 ? void 0 : onInit(values);
299
+ _context.next = 14;
300
+ break;
263
301
 
264
- case 5:
302
+ case 9:
303
+ if (!(filterEnable.current === 'filter')) {
304
+ _context.next = 14;
305
+ break;
306
+ }
307
+
308
+ if (!hasRequired) {
309
+ _context.next = 13;
310
+ break;
311
+ }
312
+
313
+ _context.next = 13;
314
+ return simpleForm.validate();
315
+
316
+ case 13:
317
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter(values);
318
+
319
+ case 14:
265
320
  case "end":
266
321
  return _context.stop();
267
322
  }
@@ -272,29 +327,81 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
272
327
  return function (_x) {
273
328
  return _ref4.apply(this, arguments);
274
329
  };
275
- }(), [onFilter, currentForm.current, hasRequired]); // 轻量搜索Filter
330
+ }(), [onFilter, hasRequired, onInit]); // 轻量搜索Filter
331
+
332
+ var onLightFilter = useCallback(function (values) {
333
+ if (currentForm.current === 'light') {
334
+ if (filterEnable.current === 'filter') {
335
+ var _Object$keys;
336
+
337
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter(values); // 清空advancedForm的值,配置Tag
338
+
339
+ var clearKeys = {};
340
+ (_Object$keys = Object.keys(advancedForm.values)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.forEach(function (key) {
341
+ clearKeys[key] = undefined;
342
+ });
343
+ advancedForm.setValues(clearKeys);
344
+ configFilterItem(advancedForm);
345
+ configTag();
346
+ }
347
+ }
348
+ }, [onFilter]); // 高级搜索Filter by Submit
349
+
350
+ var onAdvancedFilter = useCallback(function (values) {
351
+ setCurrentForm('advanced');
352
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter(values);
353
+ configFilterItem(advancedForm); // 清空lightForm的值
354
+
355
+ lightForm.reset('*', {
356
+ forceClear: true
357
+ });
358
+ }, [onFilter]); // 高级搜索Reset
359
+
360
+ var onAdvancedReset = useCallback(function () {
361
+ setCurrentForm('advanced');
362
+ onReset === null || onReset === void 0 ? void 0 : onReset(toJS(advancedForm.values));
363
+ configFilterItem(advancedForm); // 清空lightForm的值
276
364
 
277
- var onLightFilter = useCallback( /*#__PURE__*/function () {
365
+ lightForm.reset('*', {
366
+ forceClear: true
367
+ });
368
+ }, [onReset]); // 高级搜索Filter by Change
369
+
370
+ var onAdvancedChange = useCallback( /*#__PURE__*/function () {
278
371
  var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(values) {
279
372
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
280
373
  while (1) {
281
374
  switch (_context2.prev = _context2.next) {
282
375
  case 0:
283
- if (!(currentForm.current === 'light')) {
376
+ if (!(currentForm.current === 'advanced')) {
377
+ _context2.next = 9;
378
+ break;
379
+ }
380
+
381
+ if (!(filterEnable.current === 'initialized')) {
382
+ _context2.next = 9;
383
+ break;
384
+ }
385
+
386
+ filterEnable.current = 'filter';
387
+
388
+ if (!hasRequired) {
284
389
  _context2.next = 6;
285
390
  break;
286
391
  }
287
392
 
288
- onFilter && onFilter(values);
289
- _context2.next = 4;
290
- return advancedForm.reset();
393
+ _context2.next = 6;
394
+ return advancedForm.validate();
291
395
 
292
- case 4:
293
- // 不会触发高级筛选的onReset回调函数
396
+ case 6:
397
+ onInit === null || onInit === void 0 ? void 0 : onInit(values);
294
398
  configFilterItem(advancedForm);
295
- configTag();
296
399
 
297
- case 6:
400
+ if (!panelVisible) {
401
+ configTag();
402
+ }
403
+
404
+ case 9:
298
405
  case "end":
299
406
  return _context2.stop();
300
407
  }
@@ -305,21 +412,7 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
305
412
  return function (_x2) {
306
413
  return _ref5.apply(this, arguments);
307
414
  };
308
- }(), [onFilter, currentForm.current]); // 高级搜索Filter
309
-
310
- var onAdvancedFilter = useCallback(function (values) {
311
- setCurrentForm('advanced');
312
- onFilter && onFilter(values);
313
- configFilterItem(advancedForm);
314
- lightForm.reset();
315
- }, [onFilter, currentForm.current]); // 高级搜索Reset
316
-
317
- var onAdvancedReset = useCallback(function () {
318
- setCurrentForm('advanced');
319
- onReset && onReset(toJS(advancedForm.values));
320
- configFilterItem(advancedForm);
321
- lightForm.reset();
322
- }, [onReset]); // 关闭标签清空表单字段值
415
+ }(), [hasRequired, onInit]); // 关闭标签清空表单字段值
323
416
 
324
417
  var onTagClose = useCallback(function (key, index) {
325
418
  var newValue = undefined;
@@ -332,15 +425,15 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
332
425
  advancedForm.setValuesIn(key, newValue);
333
426
  configFilterItem(advancedForm);
334
427
  configTag();
335
- onFilter && onFilter(toJS(advancedForm.values));
336
- }, []); // 异步默认值回调,设置form的loading状态为false
428
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter(toJS(advancedForm.values));
429
+ }, [onFilter]); // initialValues和initialRequest的回调
337
430
 
338
- var onInitialRequestComplete = useCallback(function (_, __, _ref6) {
339
- var form = _ref6.form;
431
+ var onInitialComplete = useCallback(function (form) {
340
432
  form.setState({
341
433
  loading: false
342
434
  });
343
- }, []);
435
+ }, []); // 组件挂载
436
+
344
437
  useEffect(function () {
345
438
  setCurrentForm(currentForm.current);
346
439
  }, []);
@@ -348,13 +441,14 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
348
441
  className: cls(prefixCls, props.className),
349
442
  addonBefore: addonBefore,
350
443
  addonAfter: addonAfter,
351
- expand: advancedFilterVisible,
444
+ expand: panelVisible,
352
445
  onExpand: toggleAdvancedFilter,
353
446
  count: tagDataSource.length,
354
447
  inlineContent: mode === 'panel' ? /*#__PURE__*/React.createElement("div", {
355
- className: cls("".concat(prefixCls, "-inline"), purePanel || hasDefaultOrRequired ? "".concat(prefixCls, "-inline-hidden") : '')
448
+ className: cls("".concat(prefixCls, "-inline"), purePanel || hasRequired ? "".concat(prefixCls, "-inline-hidden") : '')
356
449
  }, /*#__PURE__*/React.createElement(LightFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
357
450
  defaultFilterValue: defaultFilterValue,
451
+ activeFilterValueRef: activeFilterValueRef,
358
452
  form: lightForm,
359
453
  onChange: debounce(onLightFilter, filterDebounce)
360
454
  }))) : /*#__PURE__*/React.createElement("div", {
@@ -362,22 +456,22 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
362
456
  }, /*#__PURE__*/React.createElement(SimpleFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
363
457
  form: simpleForm,
364
458
  onChange: debounce(onSimpleFilter, filterDebounce),
365
- onSubmit: onSimpleFilter
459
+ onSubmit: onSimpleFilter,
460
+ onInitialComplete: onInitialComplete
366
461
  }))),
367
462
  panelContent: mode === 'panel' ? /*#__PURE__*/React.createElement(AdvancedFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
368
- initialRequest: otherProps.initialRequest ? _objectSpread(_objectSpread({}, otherProps.initialRequest), {}, {
369
- onComplete: onInitialRequestComplete
370
- }) : undefined,
371
463
  form: advancedForm,
464
+ onChange: debounce(onAdvancedChange, filterDebounce),
372
465
  onSubmit: onAdvancedFilter,
373
- onReset: onAdvancedReset
466
+ onReset: onAdvancedReset,
467
+ onInitialComplete: onInitialComplete
374
468
  })) : null
375
- }, mode === 'panel' && !advancedFilterVisible ? /*#__PURE__*/React.createElement(Tag.Group, null, tagDataSource.map(function (_ref7) {
376
- var key = _ref7.key,
377
- label = _ref7.label,
378
- value = _ref7.value,
379
- type = _ref7.type,
380
- index = _ref7.index;
469
+ }, mode === 'panel' && !panelVisible ? /*#__PURE__*/React.createElement(Tag.Group, null, tagDataSource.map(function (_ref6) {
470
+ var key = _ref6.key,
471
+ label = _ref6.label,
472
+ value = _ref6.value,
473
+ type = _ref6.type,
474
+ index = _ref6.index;
381
475
  return /*#__PURE__*/React.createElement(Tag.Closeable, {
382
476
  key: isNum(index) ? key + label : key,
383
477
  afterClose: function afterClose() {
@@ -1,6 +1,6 @@
1
1
  declare const useSpecialProps: (props: any) => {
2
2
  hasDefault: boolean;
3
- hasAsyncDefault: boolean;
3
+ hasChangeDefault: boolean;
4
4
  hasRequired: boolean;
5
5
  };
6
6
  export default useSpecialProps;
@@ -1,10 +1,11 @@
1
- import { isSignificative, isStr, isPlainObj } from '@teamix/utils'; // 获取Schema是否包含默认值、异步默认值、必选校验等
1
+ import { isUsable, isStr, isPureObj } from '@teamix/utils'; // 获取Schema是否包含默认值、异步默认值、必选校验等
2
2
 
3
3
  var useSpecialProps = function useSpecialProps(props) {
4
4
  var initialValues = props.initialValues,
5
5
  initialRequest = props.initialRequest;
6
- var hasDefault = !!initialValues;
7
- var hasAsyncDefault = !!initialRequest;
6
+ var hasChangeDefault = !!initialValues || !!initialRequest; // 会触发onChange的默认值
7
+
8
+ var hasDefault = hasChangeDefault;
8
9
  var hasRequired = false;
9
10
 
10
11
  var hasDefaultOrRule = function hasDefaultOrRule(schema) {
@@ -12,13 +13,12 @@ var useSpecialProps = function useSpecialProps(props) {
12
13
  var value = item.default,
13
14
  required = item.required,
14
15
  rules = item.rules,
15
- request = item.request,
16
16
  dataSource = item.dataSource,
17
- children = item.children;
18
- hasDefault = hasDefault || isSignificative(value);
17
+ children = item.children; // 字符串变量配置default值会触发onChange
18
+
19
+ hasChangeDefault = hasChangeDefault || !!(isPureObj(dataSource) && isStr(value) && value.indexOf('.dataSource'));
20
+ hasDefault = hasDefault || isUsable(value);
19
21
  hasRequired = hasRequired || required || !!rules;
20
- hasAsyncDefault = hasAsyncDefault || !!request || // 如果dataSource是异步且default取自dataSource
21
- !!(isPlainObj(dataSource) && isStr(value) && value.indexOf('.dataSource'));
22
22
 
23
23
  if (children === null || children === void 0 ? void 0 : children.length) {
24
24
  hasDefaultOrRule(children);
@@ -29,7 +29,7 @@ var useSpecialProps = function useSpecialProps(props) {
29
29
  hasDefaultOrRule(props.schema);
30
30
  return {
31
31
  hasDefault: hasDefault,
32
- hasAsyncDefault: hasAsyncDefault,
32
+ hasChangeDefault: hasChangeDefault,
33
33
  hasRequired: hasRequired
34
34
  };
35
35
  };
@@ -1,4 +1,4 @@
1
- var _excluded = ["form", "initialValues", "initialRequest", "schema", "scope", "context", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed", "className"];
1
+ var _excluded = ["form", "initialValues", "initialRequest", "schema", "scope", "context", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed", "onInitialComplete", "className"];
2
2
 
3
3
  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; }
4
4
 
@@ -41,6 +41,7 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
41
41
  onChange = _ref.onChange,
42
42
  onSubmit = _ref.onSubmit,
43
43
  onSubmitFailed = _ref.onSubmitFailed,
44
+ onInitialComplete = _ref.onInitialComplete,
44
45
  className = _ref.className,
45
46
  otherProps = _objectWithoutProperties(_ref, _excluded);
46
47
 
@@ -91,13 +92,12 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
91
92
  useEffect(function () {
92
93
  if (initialValues) {
93
94
  form.setInitialValues(initialValues);
95
+ onInitialComplete === null || onInitialComplete === void 0 ? void 0 : onInitialComplete(form);
94
96
  } else if (initialRequest) {
95
97
  useInitialRequest(initialRequest).then(function (values) {
96
98
  form.setInitialValues(values);
97
99
  }).finally(function () {
98
- initialRequest.onComplete && initialRequest.onComplete(undefined, undefined, {
99
- form: form
100
- });
100
+ onInitialComplete === null || onInitialComplete === void 0 ? void 0 : onInitialComplete(form);
101
101
  });
102
102
  }
103
103
  }, []); // 配置国际化
@@ -197,14 +197,14 @@
197
197
  margin-right: 4px;
198
198
  }
199
199
  }
200
- // 数组类ArrayItem Icon 居中
201
- .#{$form-array}-items-item-inner {
202
- .#{$css-prefix}space-item {
203
- > .#{$css-prefix}formily-icon {
204
- margin-top: 9px;
205
- }
206
- }
207
- }
200
+ // 数组类ArrayItem Icon 居中(移除,通过align:center配置)
201
+ // .#{$form-array}-items-item-inner {
202
+ // .#{$css-prefix}space-item {
203
+ // > .#{$css-prefix}formily-icon {
204
+ // margin-top: 9px;
205
+ // }
206
+ // }
207
+ // }
208
208
 
209
209
  // Editable预览态行高
210
210
  .#{$css-prefix}formily-editable-content {
@@ -106,10 +106,10 @@ export default /*#__PURE__*/memo(function (_ref) {
106
106
  }, [scope]); // 格式化 schema
107
107
 
108
108
  var formatSchema = useCallback(function (schema) {
109
- var suffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
109
+ var parentSuffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
110
110
  var schemaProperties = {};
111
111
  schema === null || schema === void 0 ? void 0 : schema.forEach(function (item, index) {
112
- suffix = "".concat(suffix).concat(index);
112
+ var suffix = "".concat(parentSuffix).concat(index);
113
113
  var newItem = warning(item);
114
114
  var _newItem = newItem,
115
115
  originalComponent = _newItem.component; // 根据component的不同,初始化为内置的item
@@ -200,10 +200,10 @@ export default /*#__PURE__*/memo(function (_ref) {
200
200
 
201
201
  var _initializeRequest = initializeRequest(request, "".concat(suffix, "r")),
202
202
  requestReactions = _initializeRequest.reactions,
203
- requestScope = _initializeRequest.scope; // 初始化dataSource
203
+ requestScope = _initializeRequest.scope; // 初始化dataSource,如果readPretty为字符串表达式将失去loading等状态,仍可配置dataSource
204
204
 
205
205
 
206
- var _initializeDataSource = initializeDataSource(dataSource, "".concat(suffix, "d")),
206
+ var _initializeDataSource = initializeDataSource(dataSource, "".concat(suffix, "d"), newItem.readPretty),
207
207
  defaultDataSource = _initializeDataSource.dataSource,
208
208
  dataSourceReactions = _initializeDataSource.reactions,
209
209
  dataSourceScope = _initializeDataSource.scope; // 初始化rules validator
@@ -1,6 +1,6 @@
1
1
  import type { ProFormRequestConfig } from '../typing';
2
2
  interface IInitializeDataSource {
3
- (requestConfig?: ProFormRequestConfig | any, suffix?: string): {
3
+ (requestConfig?: ProFormRequestConfig | any, suffix?: string, readPretty?: string | boolean): {
4
4
  dataSource?: any[];
5
5
  reactions: any[];
6
6
  scope: {
@@ -2,12 +2,12 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
2
2
 
3
3
  import { isPlainObj } from '@teamix/utils';
4
4
 
5
- var initializeDataSource = function initializeDataSource(dataSource, suffix) {
5
+ var initializeDataSource = function initializeDataSource(dataSource, suffix, readPretty) {
6
6
  if (isPlainObj(dataSource)) {
7
7
  var requestConfig = dataSource;
8
8
  var requestConfigName = "$requestConfig_".concat(suffix);
9
9
  return {
10
- reactions: ["{{$dataSource($request,".concat(requestConfigName, ",context)}}")],
10
+ reactions: ["{{$dataSource($request,".concat(requestConfigName, ",context,").concat(readPretty, ")}}")],
11
11
  scope: _defineProperty({}, requestConfigName, requestConfig)
12
12
  };
13
13
  }
@@ -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;