@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
@@ -103,34 +103,79 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
103
103
  onInit = props.onInit,
104
104
  onReset = props.onReset,
105
105
  onExpand = props.onExpand,
106
- otherProps = _objectWithoutProperties(props, _excluded); // 表单默认值初始化回调
106
+ otherProps = _objectWithoutProperties(props, _excluded);
107
107
 
108
+ var _useSpecialProps = (0, _useSpecialProps2.default)(props),
109
+ hasChangeDefault = _useSpecialProps.hasChangeDefault,
110
+ hasRequired = _useSpecialProps.hasRequired;
111
+
112
+ var _useState = (0, _react.useState)(!!expand),
113
+ _useState2 = _slicedToArray(_useState, 2),
114
+ panelVisible = _useState2[0],
115
+ setPanelVisible = _useState2[1];
116
+
117
+ var _useState3 = (0, _react.useState)([]),
118
+ _useState4 = _slicedToArray(_useState3, 2),
119
+ tagDataSource = _useState4[0],
120
+ setTagDataSource = _useState4[1];
121
+
122
+ var filterItem = (0, _react.useRef)([]);
123
+ var defaultForm = mode === 'panel' ? 'advanced' : 'simple';
124
+ var currentForm = (0, _react.useRef)(defaultForm);
125
+ var activeFilterValueRef = (0, _react.useRef)();
126
+ var prefixCls = (0, _utils.usePrefixCls)('', {
127
+ prefix: 'teamix-pro-form-query-filter'
128
+ });
129
+ /**
130
+ * 处理onInit与onFilter事件的触发问题
131
+ */
132
+
133
+ var filterEnable = (0, _react.useRef)('waiting');
108
134
 
109
- var _onFormInit = function onFormInit(form, _ref, configFilterItem) {
135
+ var _onFormInit = function onFormInit(form, _ref) {
110
136
  var initialRequest = _ref.initialRequest,
111
- onInit = _ref.onInit;
137
+ initialValues = _ref.initialValues;
112
138
 
113
139
  if (!form.mounted) {
114
- form.loading = !!initialRequest;
140
+ // 借用formloading属性来判断initialValues和initialRequest是否完成
141
+ form.setState({
142
+ loading: !!initialRequest || !!initialValues
143
+ });
115
144
  }
116
145
 
117
146
  var loadingField = Object.values(form.fields).filter(function (field) {
118
147
  return !!field.loading;
119
- });
148
+ }); // 等待表单mounted + 字段loading结束 + form默认值初始化 => 表单初始化完成
120
149
 
121
- if (form.mounted) {
122
- if (loadingField.length === 0 && !form.loading) {
123
- var onInitResult = onInit && onInit((0, _reactive.toJS)(form.values));
150
+ if (form.mounted && !loadingField.length && !form.loading) {
151
+ _onFormInit = function onFormInit() {}; // init后销毁 isFormInit 方法
124
152
 
125
- if (onInitResult) {
126
- // 根据onInit返回值,判断是否使用该事件执行筛选,使用过则添加筛选标签
127
- configFilterItem && configFilterItem(form);
128
- }
129
153
 
130
- _onFormInit = function onFormInit() {};
154
+ var values = (0, _utils.getValidValues)(form.values);
155
+
156
+ if (!(0, _utils.isUsable)(values) || !hasChangeDefault) {
157
+ // 表单无默认值 或 无触发onChange的默认值配置,不会触发onFilter内的onInit,所以主动触发onInit
158
+ filterEnable.current = 'filter';
159
+ setTimeout(function () {
160
+ onInit === null || onInit === void 0 ? void 0 : onInit((0, _reactive.toJS)(form.values));
161
+ }, 0);
162
+
163
+ if (mode === 'panel') {
164
+ // 移除lightForm的默认值
165
+ // 设置Tag
166
+ configFilterItem(advancedForm);
167
+
168
+ if (!panelVisible) {
169
+ setTimeout(function () {
170
+ configTag();
171
+ }, 0);
172
+ }
173
+ }
174
+ } else {
175
+ filterEnable.current = 'initialized';
131
176
  }
132
177
  }
133
- }; // 设置当前form
178
+ }; // 配置当前激活的form实例
134
179
 
135
180
 
136
181
  var setCurrentForm = function setCurrentForm(formName) {
@@ -140,9 +185,11 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
140
185
  var form = formMap[formName];
141
186
  formRef.current = form;
142
187
 
143
- formRef.current.updateTags = function () {
144
- configFilterItem(form);
145
- };
188
+ if (!formRef.current.updateTags) {
189
+ formRef.current.updateTags = function () {
190
+ configFilterItem(form);
191
+ };
192
+ }
146
193
  }
147
194
  }; // 创建简单筛选表单实例
148
195
 
@@ -152,7 +199,9 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
152
199
  validateFirst: true,
153
200
  effects: function effects() {
154
201
  (0, _core.onFormReact)(function (form) {
155
- _onFormInit(form, props);
202
+ if (mode === 'inline') {
203
+ _onFormInit(form, props);
204
+ }
156
205
  });
157
206
  }
158
207
  });
@@ -163,7 +212,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
163
212
  validateFirst: true,
164
213
  effects: function effects() {
165
214
  (0, _core.onFormInputChange)(function () {
166
- setCurrentForm('light');
215
+ setCurrentForm('light'); // 主动修改轻量筛选值
167
216
  });
168
217
  }
169
218
  });
@@ -174,11 +223,12 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
174
223
  validateFirst: true,
175
224
  effects: function effects() {
176
225
  (0, _core.onFormReact)(function (form) {
177
- _onFormInit(form, props, configFilterItem);
226
+ if (mode === 'panel') {
227
+ _onFormInit(form, props);
228
+ }
178
229
  });
179
230
  (0, _core.onFormInputChange)(function (form) {
180
- // 主动修改高级筛选值
181
- setCurrentForm('advanced');
231
+ setCurrentForm('advanced'); // 主动修改高级筛选值
182
232
  });
183
233
  }
184
234
  });
@@ -187,34 +237,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
187
237
  simple: simpleForm,
188
238
  light: lightForm,
189
239
  advanced: advancedForm
190
- };
191
-
192
- var _useSpecialProps = (0, _useSpecialProps2.default)(props),
193
- hasDefault = _useSpecialProps.hasDefault,
194
- hasAsyncDefault = _useSpecialProps.hasAsyncDefault,
195
- hasRequired = _useSpecialProps.hasRequired;
196
-
197
- var hasDefaultOrRequired = hasDefault || hasAsyncDefault || hasRequired;
198
-
199
- var _useState = (0, _react.useState)(!!expand),
200
- _useState2 = _slicedToArray(_useState, 2),
201
- advancedFilterVisible = _useState2[0],
202
- setAdvancedFilterVisible = _useState2[1];
203
-
204
- var _useState3 = (0, _react.useState)([]),
205
- _useState4 = _slicedToArray(_useState3, 2),
206
- tagDataSource = _useState4[0],
207
- setTagDataSource = _useState4[1];
208
-
209
- var filterItem = (0, _react.useRef)([]);
210
- var currentForm = (0, _react.useRef)(mode === 'panel' ? advancedFilterVisible ? 'advanced' : 'light' : 'simple');
211
- var prefixCls = (0, _utils.usePrefixCls)('', {
212
- prefix: 'teamix-pro-form-query-filter'
213
- }); // 设置筛选数据
214
-
215
- var configFilterItem = (0, _react.useCallback)(function (form) {
216
- filterItem.current = getFilterDisplayValues(form);
217
- }, []); // 获取筛选数据Label
240
+ }; // 获取筛选数据Label
218
241
 
219
242
  var getFilterDisplayValues = (0, _react.useCallback)(function (form) {
220
243
  var displayValues = (0, _useFormDisplayValues.getFormDisplayValues)(form);
@@ -242,7 +265,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
242
265
  index: index
243
266
  });
244
267
  });
245
- } else if ((0, _utils.isSignificative)(value)) {
268
+ } else if ((0, _utils.isUsable)(value)) {
246
269
  filterData.push({
247
270
  key: key,
248
271
  type: _fieldTypeMap.default[component] || 'text',
@@ -252,28 +275,34 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
252
275
  }
253
276
  });
254
277
  return filterData;
278
+ }, []); // 设置筛选数据
279
+
280
+ var configFilterItem = (0, _react.useCallback)(function (form) {
281
+ filterItem.current = getFilterDisplayValues(form);
255
282
  }, []); // 设置标签数据
256
283
 
257
284
  var configTag = (0, _react.useCallback)(function () {
258
285
  setTagDataSource(filterItem.current);
259
- }, [filterItem.current]); // 展开收起高级筛选
286
+ }, []); // 展开收起高级筛选
260
287
 
261
288
  var toggleAdvancedFilter = (0, _react.useCallback)(function () {
262
- var result = !advancedFilterVisible;
289
+ var result = !panelVisible;
263
290
 
264
291
  if (result) {
265
292
  // 展开高级筛选,Light回填Advanced
266
293
  if (currentForm.current === 'light') {
267
- advancedForm.setValues(lightForm.values);
294
+ var key = activeFilterValueRef.current;
295
+ var value = lightForm.values[key];
296
+ advancedForm.setValuesIn(key, value);
268
297
  }
269
298
  } else {
270
299
  // 收起高级筛选,配置标签数据
271
300
  configTag();
272
301
  }
273
302
 
274
- setAdvancedFilterVisible(result);
303
+ setPanelVisible(result);
275
304
  onExpand === null || onExpand === void 0 ? void 0 : onExpand(result);
276
- }, [advancedFilterVisible, configTag, currentForm.current]); // 简单搜索Filter
305
+ }, [panelVisible, configTag]); // 简单搜索Filter
277
306
 
278
307
  var onSimpleFilter = (0, _react.useCallback)( /*#__PURE__*/function () {
279
308
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(values) {
@@ -282,22 +311,48 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
282
311
  switch (_context.prev = _context.next) {
283
312
  case 0:
284
313
  if (!(currentForm.current === 'simple')) {
285
- _context.next = 5;
314
+ _context.next = 14;
315
+ break;
316
+ }
317
+
318
+ if (!(filterEnable.current === 'initialized')) {
319
+ _context.next = 9;
286
320
  break;
287
321
  }
288
322
 
323
+ filterEnable.current = 'filter';
324
+
289
325
  if (!hasRequired) {
290
- _context.next = 4;
326
+ _context.next = 6;
291
327
  break;
292
328
  }
293
329
 
294
- _context.next = 4;
330
+ _context.next = 6;
295
331
  return simpleForm.validate();
296
332
 
297
- case 4:
298
- onFilter && onFilter(values);
333
+ case 6:
334
+ onInit === null || onInit === void 0 ? void 0 : onInit(values);
335
+ _context.next = 14;
336
+ break;
299
337
 
300
- case 5:
338
+ case 9:
339
+ if (!(filterEnable.current === 'filter')) {
340
+ _context.next = 14;
341
+ break;
342
+ }
343
+
344
+ if (!hasRequired) {
345
+ _context.next = 13;
346
+ break;
347
+ }
348
+
349
+ _context.next = 13;
350
+ return simpleForm.validate();
351
+
352
+ case 13:
353
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter(values);
354
+
355
+ case 14:
301
356
  case "end":
302
357
  return _context.stop();
303
358
  }
@@ -308,29 +363,81 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
308
363
  return function (_x) {
309
364
  return _ref4.apply(this, arguments);
310
365
  };
311
- }(), [onFilter, currentForm.current, hasRequired]); // 轻量搜索Filter
366
+ }(), [onFilter, hasRequired, onInit]); // 轻量搜索Filter
367
+
368
+ var onLightFilter = (0, _react.useCallback)(function (values) {
369
+ if (currentForm.current === 'light') {
370
+ if (filterEnable.current === 'filter') {
371
+ var _Object$keys;
372
+
373
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter(values); // 清空advancedForm的值,配置Tag
374
+
375
+ var clearKeys = {};
376
+ (_Object$keys = Object.keys(advancedForm.values)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.forEach(function (key) {
377
+ clearKeys[key] = undefined;
378
+ });
379
+ advancedForm.setValues(clearKeys);
380
+ configFilterItem(advancedForm);
381
+ configTag();
382
+ }
383
+ }
384
+ }, [onFilter]); // 高级搜索Filter by Submit
385
+
386
+ var onAdvancedFilter = (0, _react.useCallback)(function (values) {
387
+ setCurrentForm('advanced');
388
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter(values);
389
+ configFilterItem(advancedForm); // 清空lightForm的值
390
+
391
+ lightForm.reset('*', {
392
+ forceClear: true
393
+ });
394
+ }, [onFilter]); // 高级搜索Reset
395
+
396
+ var onAdvancedReset = (0, _react.useCallback)(function () {
397
+ setCurrentForm('advanced');
398
+ onReset === null || onReset === void 0 ? void 0 : onReset((0, _reactive.toJS)(advancedForm.values));
399
+ configFilterItem(advancedForm); // 清空lightForm的值
312
400
 
313
- var onLightFilter = (0, _react.useCallback)( /*#__PURE__*/function () {
401
+ lightForm.reset('*', {
402
+ forceClear: true
403
+ });
404
+ }, [onReset]); // 高级搜索Filter by Change
405
+
406
+ var onAdvancedChange = (0, _react.useCallback)( /*#__PURE__*/function () {
314
407
  var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(values) {
315
408
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
316
409
  while (1) {
317
410
  switch (_context2.prev = _context2.next) {
318
411
  case 0:
319
- if (!(currentForm.current === 'light')) {
412
+ if (!(currentForm.current === 'advanced')) {
413
+ _context2.next = 9;
414
+ break;
415
+ }
416
+
417
+ if (!(filterEnable.current === 'initialized')) {
418
+ _context2.next = 9;
419
+ break;
420
+ }
421
+
422
+ filterEnable.current = 'filter';
423
+
424
+ if (!hasRequired) {
320
425
  _context2.next = 6;
321
426
  break;
322
427
  }
323
428
 
324
- onFilter && onFilter(values);
325
- _context2.next = 4;
326
- return advancedForm.reset();
429
+ _context2.next = 6;
430
+ return advancedForm.validate();
327
431
 
328
- case 4:
329
- // 不会触发高级筛选的onReset回调函数
432
+ case 6:
433
+ onInit === null || onInit === void 0 ? void 0 : onInit(values);
330
434
  configFilterItem(advancedForm);
331
- configTag();
332
435
 
333
- case 6:
436
+ if (!panelVisible) {
437
+ configTag();
438
+ }
439
+
440
+ case 9:
334
441
  case "end":
335
442
  return _context2.stop();
336
443
  }
@@ -341,21 +448,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
341
448
  return function (_x2) {
342
449
  return _ref5.apply(this, arguments);
343
450
  };
344
- }(), [onFilter, currentForm.current]); // 高级搜索Filter
345
-
346
- var onAdvancedFilter = (0, _react.useCallback)(function (values) {
347
- setCurrentForm('advanced');
348
- onFilter && onFilter(values);
349
- configFilterItem(advancedForm);
350
- lightForm.reset();
351
- }, [onFilter, currentForm.current]); // 高级搜索Reset
352
-
353
- var onAdvancedReset = (0, _react.useCallback)(function () {
354
- setCurrentForm('advanced');
355
- onReset && onReset((0, _reactive.toJS)(advancedForm.values));
356
- configFilterItem(advancedForm);
357
- lightForm.reset();
358
- }, [onReset]); // 关闭标签清空表单字段值
451
+ }(), [hasRequired, onInit]); // 关闭标签清空表单字段值
359
452
 
360
453
  var onTagClose = (0, _react.useCallback)(function (key, index) {
361
454
  var newValue = undefined;
@@ -368,15 +461,15 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
368
461
  advancedForm.setValuesIn(key, newValue);
369
462
  configFilterItem(advancedForm);
370
463
  configTag();
371
- onFilter && onFilter((0, _reactive.toJS)(advancedForm.values));
372
- }, []); // 异步默认值回调,设置form的loading状态为false
464
+ onFilter === null || onFilter === void 0 ? void 0 : onFilter((0, _reactive.toJS)(advancedForm.values));
465
+ }, [onFilter]); // initialValues和initialRequest的回调
373
466
 
374
- var onInitialRequestComplete = (0, _react.useCallback)(function (_, __, _ref6) {
375
- var form = _ref6.form;
467
+ var onInitialComplete = (0, _react.useCallback)(function (form) {
376
468
  form.setState({
377
469
  loading: false
378
470
  });
379
- }, []);
471
+ }, []); // 组件挂载
472
+
380
473
  (0, _react.useEffect)(function () {
381
474
  setCurrentForm(currentForm.current);
382
475
  }, []);
@@ -384,13 +477,14 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
384
477
  className: (0, _classnames.default)(prefixCls, props.className),
385
478
  addonBefore: addonBefore,
386
479
  addonAfter: addonAfter,
387
- expand: advancedFilterVisible,
480
+ expand: panelVisible,
388
481
  onExpand: toggleAdvancedFilter,
389
482
  count: tagDataSource.length,
390
483
  inlineContent: mode === 'panel' ? /*#__PURE__*/_react.default.createElement("div", {
391
- className: (0, _classnames.default)("".concat(prefixCls, "-inline"), purePanel || hasDefaultOrRequired ? "".concat(prefixCls, "-inline-hidden") : '')
484
+ className: (0, _classnames.default)("".concat(prefixCls, "-inline"), purePanel || hasRequired ? "".concat(prefixCls, "-inline-hidden") : '')
392
485
  }, /*#__PURE__*/_react.default.createElement(_LightFilter.default, _objectSpread(_objectSpread({}, otherProps), {}, {
393
486
  defaultFilterValue: defaultFilterValue,
487
+ activeFilterValueRef: activeFilterValueRef,
394
488
  form: lightForm,
395
489
  onChange: (0, _lodash.default)(onLightFilter, filterDebounce)
396
490
  }))) : /*#__PURE__*/_react.default.createElement("div", {
@@ -398,22 +492,22 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
398
492
  }, /*#__PURE__*/_react.default.createElement(_SimpleFilter.default, _objectSpread(_objectSpread({}, otherProps), {}, {
399
493
  form: simpleForm,
400
494
  onChange: (0, _lodash.default)(onSimpleFilter, filterDebounce),
401
- onSubmit: onSimpleFilter
495
+ onSubmit: onSimpleFilter,
496
+ onInitialComplete: onInitialComplete
402
497
  }))),
403
498
  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
499
  form: advancedForm,
500
+ onChange: (0, _lodash.default)(onAdvancedChange, filterDebounce),
408
501
  onSubmit: onAdvancedFilter,
409
- onReset: onAdvancedReset
502
+ onReset: onAdvancedReset,
503
+ onInitialComplete: onInitialComplete
410
504
  })) : 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;
505
+ }, mode === 'panel' && !panelVisible ? /*#__PURE__*/_react.default.createElement(_components.Tag.Group, null, tagDataSource.map(function (_ref6) {
506
+ var key = _ref6.key,
507
+ label = _ref6.label,
508
+ value = _ref6.value,
509
+ type = _ref6.type,
510
+ index = _ref6.index;
417
511
  return /*#__PURE__*/_react.default.createElement(_components.Tag.Closeable, {
418
512
  key: (0, _utils.isNum)(index) ? key + label : key,
419
513
  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;
@@ -11,8 +11,9 @@ var _utils = require("@teamix/utils");
11
11
  var useSpecialProps = function useSpecialProps(props) {
12
12
  var initialValues = props.initialValues,
13
13
  initialRequest = props.initialRequest;
14
- var hasDefault = !!initialValues;
15
- var hasAsyncDefault = !!initialRequest;
14
+ var hasChangeDefault = !!initialValues || !!initialRequest; // 会触发onChange的默认值
15
+
16
+ var hasDefault = hasChangeDefault;
16
17
  var hasRequired = false;
17
18
 
18
19
  var hasDefaultOrRule = function hasDefaultOrRule(schema) {
@@ -20,13 +21,12 @@ var useSpecialProps = function useSpecialProps(props) {
20
21
  var value = item.default,
21
22
  required = item.required,
22
23
  rules = item.rules,
23
- request = item.request,
24
24
  dataSource = item.dataSource,
25
- children = item.children;
26
- hasDefault = hasDefault || (0, _utils.isSignificative)(value);
25
+ children = item.children; // 字符串变量配置default值会触发onChange
26
+
27
+ hasChangeDefault = hasChangeDefault || !!((0, _utils.isPureObj)(dataSource) && (0, _utils.isStr)(value) && value.indexOf('.dataSource'));
28
+ hasDefault = hasDefault || (0, _utils.isUsable)(value);
27
29
  hasRequired = hasRequired || required || !!rules;
28
- hasAsyncDefault = hasAsyncDefault || !!request || // 如果dataSource是异步且default取自dataSource
29
- !!((0, _utils.isPlainObj)(dataSource) && (0, _utils.isStr)(value) && value.indexOf('.dataSource'));
30
30
 
31
31
  if (children === null || children === void 0 ? void 0 : children.length) {
32
32
  hasDefaultOrRule(children);
@@ -37,7 +37,7 @@ var useSpecialProps = function useSpecialProps(props) {
37
37
  hasDefaultOrRule(props.schema);
38
38
  return {
39
39
  hasDefault: hasDefault,
40
- hasAsyncDefault: hasAsyncDefault,
40
+ hasChangeDefault: hasChangeDefault,
41
41
  hasRequired: hasRequired
42
42
  };
43
43
  };
@@ -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
  }, []); // 配置国际化
@@ -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 {
@@ -150,10 +150,10 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
150
150
  }, [scope]); // 格式化 schema
151
151
 
152
152
  var formatSchema = (0, _react.useCallback)(function (schema) {
153
- var suffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
153
+ var parentSuffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
154
154
  var schemaProperties = {};
155
155
  schema === null || schema === void 0 ? void 0 : schema.forEach(function (item, index) {
156
- suffix = "".concat(suffix).concat(index);
156
+ var suffix = "".concat(parentSuffix).concat(index);
157
157
  var newItem = (0, _warning.default)(item);
158
158
  var _newItem = newItem,
159
159
  originalComponent = _newItem.component; // 根据component的不同,初始化为内置的item
@@ -244,10 +244,10 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
244
244
 
245
245
  var _initializeRequest = (0, _initializeRequest2.default)(request, "".concat(suffix, "r")),
246
246
  requestReactions = _initializeRequest.reactions,
247
- requestScope = _initializeRequest.scope; // 初始化dataSource
247
+ requestScope = _initializeRequest.scope; // 初始化dataSource,如果readPretty为字符串表达式将失去loading等状态,仍可配置dataSource
248
248
 
249
249
 
250
- var _initializeDataSource = (0, _initializeDataSource2.default)(dataSource, "".concat(suffix, "d")),
250
+ var _initializeDataSource = (0, _initializeDataSource2.default)(dataSource, "".concat(suffix, "d"), newItem.readPretty),
251
251
  defaultDataSource = _initializeDataSource.dataSource,
252
252
  dataSourceReactions = _initializeDataSource.reactions,
253
253
  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: {
@@ -9,12 +9,12 @@ var _utils = require("@teamix/utils");
9
9
 
10
10
  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; }
11
11
 
12
- var initializeDataSource = function initializeDataSource(dataSource, suffix) {
12
+ var initializeDataSource = function initializeDataSource(dataSource, suffix, readPretty) {
13
13
  if ((0, _utils.isPlainObj)(dataSource)) {
14
14
  var requestConfig = dataSource;
15
15
  var requestConfigName = "$requestConfig_".concat(suffix);
16
16
  return {
17
- reactions: ["{{$dataSource($request,".concat(requestConfigName, ",context)}}")],
17
+ reactions: ["{{$dataSource($request,".concat(requestConfigName, ",context,").concat(readPretty, ")}}")],
18
18
  scope: _defineProperty({}, requestConfigName, requestConfig)
19
19
  };
20
20
  }
@@ -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;