@teamix/pro 1.2.34 → 1.3.2

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 (101) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +1542 -1149
  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/Components/ProField/mapDateFormat.d.ts +3 -0
  8. package/es/form/Components/ProField/mapDateFormat.js +113 -0
  9. package/es/form/Filter/AdvancedFilter.js +4 -4
  10. package/es/form/Filter/LightFilter.js +22 -15
  11. package/es/form/Filter/index.js +171 -133
  12. package/es/form/Filter/useSpecialProps.d.ts +1 -1
  13. package/es/form/Filter/useSpecialProps.js +9 -9
  14. package/es/form/ProForm/customComponent.js +2 -1
  15. package/es/form/ProForm/index.scss +8 -8
  16. package/es/form/SchemaForm/index.js +2 -2
  17. package/es/form/SchemaForm/initializeRequest.js +1 -2
  18. package/es/form/SchemaForm/reactions.d.ts +2 -2
  19. package/es/form/SchemaForm/reactions.js +32 -21
  20. package/es/form/fieldTypeMap.d.ts +3 -0
  21. package/es/form/fieldTypeMap.js +3 -0
  22. package/es/form/typing.d.ts +8 -1
  23. package/es/index.d.ts +4 -4
  24. package/es/index.js +4 -4
  25. package/es/nocode/configurators/PageHeader.js +2 -2
  26. package/es/page-header/index.js +7 -3
  27. package/es/table/components/Layout/index.js +2 -2
  28. package/es/table/components/Pagination/index.js +11 -1
  29. package/es/table/components/ToolBar/DensityIcon.js +5 -3
  30. package/es/table/components/ToolBar/FilterColumnIcon.js +12 -3
  31. package/es/table/components/ToolBar/Fullscreen.js +6 -6
  32. package/es/table/components/ToolBar/index.scss +2 -2
  33. package/es/table/index.js +40 -21
  34. package/es/table/index.scss +6 -0
  35. package/es/table/typing.d.ts +13 -6
  36. package/es/table/utils/columnRender.js +6 -0
  37. package/es/timeline/ProTimeLineItem/index.d.ts +5 -0
  38. package/es/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.js +59 -72
  39. package/es/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.scss +34 -86
  40. package/es/timeline/index.d.ts +10 -0
  41. package/es/{step → timeline}/index.js +33 -57
  42. package/es/timeline/index.scss +7 -0
  43. package/es/timeline/typing.d.ts +101 -0
  44. package/es/{step → timeline}/typing.js +0 -0
  45. package/lib/actions/dialog-form.d.ts +9 -4
  46. package/lib/actions/dialog-form.js +16 -9
  47. package/lib/form/Components/ProField/mapDateFormat.d.ts +3 -0
  48. package/lib/form/Components/ProField/mapDateFormat.js +125 -0
  49. package/lib/form/Filter/AdvancedFilter.js +4 -4
  50. package/lib/form/Filter/LightFilter.js +21 -15
  51. package/lib/form/Filter/index.js +170 -132
  52. package/lib/form/Filter/useSpecialProps.d.ts +1 -1
  53. package/lib/form/Filter/useSpecialProps.js +8 -8
  54. package/lib/form/ProForm/customComponent.js +3 -1
  55. package/lib/form/ProForm/index.scss +8 -8
  56. package/lib/form/SchemaForm/index.js +2 -2
  57. package/lib/form/SchemaForm/initializeRequest.js +1 -2
  58. package/lib/form/SchemaForm/reactions.d.ts +2 -2
  59. package/lib/form/SchemaForm/reactions.js +31 -20
  60. package/lib/form/fieldTypeMap.d.ts +3 -0
  61. package/lib/form/fieldTypeMap.js +5 -1
  62. package/lib/form/typing.d.ts +8 -1
  63. package/lib/index.d.ts +4 -4
  64. package/lib/index.js +10 -10
  65. package/lib/nocode/configurators/PageHeader.js +2 -2
  66. package/lib/page-header/index.js +6 -2
  67. package/lib/table/components/Layout/index.js +2 -2
  68. package/lib/table/components/Pagination/index.js +10 -0
  69. package/lib/table/components/ToolBar/DensityIcon.js +5 -3
  70. package/lib/table/components/ToolBar/FilterColumnIcon.js +11 -2
  71. package/lib/table/components/ToolBar/Fullscreen.js +6 -6
  72. package/lib/table/components/ToolBar/index.scss +2 -2
  73. package/lib/table/index.js +40 -21
  74. package/lib/table/index.scss +6 -0
  75. package/lib/table/typing.d.ts +13 -6
  76. package/lib/table/utils/columnRender.js +6 -0
  77. package/lib/timeline/ProTimeLineItem/index.d.ts +5 -0
  78. package/lib/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.js +58 -72
  79. package/lib/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.scss +34 -86
  80. package/lib/timeline/index.d.ts +10 -0
  81. package/lib/{step → timeline}/index.js +38 -58
  82. package/lib/timeline/index.scss +7 -0
  83. package/lib/timeline/typing.d.ts +101 -0
  84. package/lib/{step → timeline}/typing.js +0 -0
  85. package/package.json +1 -1
  86. package/es/step/ProStepItem/components/HozStepItem/index.d.ts +0 -5
  87. package/es/step/ProStepItem/components/HozStepItem/index.js +0 -235
  88. package/es/step/ProStepItem/components/HozStepItem/index.scss +0 -279
  89. package/es/step/ProStepItem/components/VerStepItem/index.d.ts +0 -5
  90. package/es/step/ProStepItem/index.d.ts +0 -4
  91. package/es/step/ProStepItem/index.js +0 -57
  92. package/es/step/index.d.ts +0 -9
  93. package/es/step/typing.d.ts +0 -96
  94. package/lib/step/ProStepItem/components/HozStepItem/index.d.ts +0 -5
  95. package/lib/step/ProStepItem/components/HozStepItem/index.js +0 -258
  96. package/lib/step/ProStepItem/components/HozStepItem/index.scss +0 -279
  97. package/lib/step/ProStepItem/components/VerStepItem/index.d.ts +0 -5
  98. package/lib/step/ProStepItem/index.d.ts +0 -4
  99. package/lib/step/ProStepItem/index.js +0 -69
  100. package/lib/step/index.d.ts +0 -9
  101. package/lib/step/typing.d.ts +0 -96
@@ -103,16 +103,41 @@ 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
+ */
108
132
 
109
- var _onFormInit = function onFormInit(form, _ref, configFilterItem) {
133
+ var filterEnable = (0, _react.useRef)('waiting');
134
+
135
+ var _onFormInit = function onFormInit(form, _ref) {
110
136
  var initialRequest = _ref.initialRequest,
111
- initialValues = _ref.initialValues,
112
- onInit = _ref.onInit;
137
+ initialValues = _ref.initialValues;
113
138
 
114
139
  if (!form.mounted) {
115
- // form的loading为自定义属性
140
+ // 借用form的loading属性来判断initialValues和initialRequest是否完成
116
141
  form.setState({
117
142
  loading: !!initialRequest || !!initialValues
118
143
  });
@@ -120,32 +145,37 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
120
145
 
121
146
  var loadingField = Object.values(form.fields).filter(function (field) {
122
147
  return !!field.loading;
123
- });
148
+ }); // 等待表单mounted + 字段loading结束 + form默认值初始化 => 表单初始化完成
124
149
 
125
- if (form.mounted) {
126
- if (loadingField.length === 0 && !form.loading) {
127
- // 仅执行一次onInit
128
- _onFormInit = function onFormInit() {};
150
+ if (form.mounted && !loadingField.length && !form.loading) {
151
+ _onFormInit = function onFormInit() {}; // init后销毁 isFormInit 方法
129
152
 
130
- var onInitResult = onInit === null || onInit === void 0 ? void 0 : onInit((0, _reactive.toJS)(form.values));
131
153
 
132
- if (onInitResult) {
133
- // 根据onInit返回值,判断是否使用该事件执行筛选,使用过则添加筛选标签
134
- configFilterItem === null || configFilterItem === void 0 ? void 0 : configFilterItem(form);
135
- configTag();
136
- } // 防止onInit前后的无效onFilter
154
+ var values = (0, _utils.getValidValues)(form.values);
137
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);
138
162
 
139
- if (!Object.keys(form.initialValues).length) {
140
- // 如果没有默认值,直接开启onFilter
141
- filterEnable.current = true;
142
- } else {
143
- // 否则,拿onFilter的值与默认值进行比较
144
- filterEnable.current = form.initialValues;
163
+ if (mode === 'panel') {
164
+ // 移除lightForm的默认值
165
+ // 设置Tag
166
+ configFilterItem(advancedForm);
167
+
168
+ if (!panelVisible) {
169
+ setTimeout(function () {
170
+ configTag();
171
+ }, 0);
172
+ }
145
173
  }
174
+ } else {
175
+ filterEnable.current = 'initialized';
146
176
  }
147
177
  }
148
- }; // 设置当前form
178
+ }; // 配置当前激活的form实例
149
179
 
150
180
 
151
181
  var setCurrentForm = function setCurrentForm(formName) {
@@ -155,9 +185,11 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
155
185
  var form = formMap[formName];
156
186
  formRef.current = form;
157
187
 
158
- formRef.current.updateTags = function () {
159
- configFilterItem(form);
160
- };
188
+ if (!formRef.current.updateTags) {
189
+ formRef.current.updateTags = function () {
190
+ configFilterItem(form);
191
+ };
192
+ }
161
193
  }
162
194
  }; // 创建简单筛选表单实例
163
195
 
@@ -167,7 +199,9 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
167
199
  validateFirst: true,
168
200
  effects: function effects() {
169
201
  (0, _core.onFormReact)(function (form) {
170
- _onFormInit(form, props);
202
+ if (mode === 'inline') {
203
+ _onFormInit(form, props);
204
+ }
171
205
  });
172
206
  }
173
207
  });
@@ -178,7 +212,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
178
212
  validateFirst: true,
179
213
  effects: function effects() {
180
214
  (0, _core.onFormInputChange)(function () {
181
- setCurrentForm('light');
215
+ setCurrentForm('light'); // 主动修改轻量筛选值
182
216
  });
183
217
  }
184
218
  });
@@ -189,11 +223,12 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
189
223
  validateFirst: true,
190
224
  effects: function effects() {
191
225
  (0, _core.onFormReact)(function (form) {
192
- _onFormInit(form, props, configFilterItem);
226
+ if (mode === 'panel') {
227
+ _onFormInit(form, props);
228
+ }
193
229
  });
194
230
  (0, _core.onFormInputChange)(function (form) {
195
- // 主动修改高级筛选值
196
- setCurrentForm('advanced');
231
+ setCurrentForm('advanced'); // 主动修改高级筛选值
197
232
  });
198
233
  }
199
234
  });
@@ -202,35 +237,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
202
237
  simple: simpleForm,
203
238
  light: lightForm,
204
239
  advanced: advancedForm
205
- };
206
-
207
- var _useSpecialProps = (0, _useSpecialProps2.default)(props),
208
- hasDefault = _useSpecialProps.hasDefault,
209
- hasAsyncDefault = _useSpecialProps.hasAsyncDefault,
210
- hasRequired = _useSpecialProps.hasRequired;
211
-
212
- var hasDefaultOrRequired = hasDefault || hasAsyncDefault || hasRequired;
213
-
214
- var _useState = (0, _react.useState)(!!expand),
215
- _useState2 = _slicedToArray(_useState, 2),
216
- advancedFilterVisible = _useState2[0],
217
- setAdvancedFilterVisible = _useState2[1];
218
-
219
- var _useState3 = (0, _react.useState)([]),
220
- _useState4 = _slicedToArray(_useState3, 2),
221
- tagDataSource = _useState4[0],
222
- setTagDataSource = _useState4[1];
223
-
224
- var filterItem = (0, _react.useRef)([]);
225
- var currentForm = (0, _react.useRef)(mode === 'panel' ? advancedFilterVisible ? 'advanced' : 'light' : 'simple');
226
- var filterEnable = (0, _react.useRef)(false);
227
- var prefixCls = (0, _utils.usePrefixCls)('', {
228
- prefix: 'teamix-pro-form-query-filter'
229
- }); // 设置筛选数据
230
-
231
- var configFilterItem = (0, _react.useCallback)(function (form) {
232
- filterItem.current = getFilterDisplayValues(form);
233
- }, []); // 获取筛选数据Label
240
+ }; // 获取筛选数据Label
234
241
 
235
242
  var getFilterDisplayValues = (0, _react.useCallback)(function (form) {
236
243
  var displayValues = (0, _useFormDisplayValues.getFormDisplayValues)(form);
@@ -258,7 +265,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
258
265
  index: index
259
266
  });
260
267
  });
261
- } else if ((0, _utils.isSignificative)(value)) {
268
+ } else if ((0, _utils.isUsable)(value)) {
262
269
  filterData.push({
263
270
  key: key,
264
271
  type: _fieldTypeMap.default[component] || 'text',
@@ -268,43 +275,34 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
268
275
  }
269
276
  });
270
277
  return filterData;
278
+ }, []); // 设置筛选数据
279
+
280
+ var configFilterItem = (0, _react.useCallback)(function (form) {
281
+ filterItem.current = getFilterDisplayValues(form);
271
282
  }, []); // 设置标签数据
272
283
 
273
284
  var configTag = (0, _react.useCallback)(function () {
274
285
  setTagDataSource(filterItem.current);
275
- }, [filterItem.current]); // 展开收起高级筛选
286
+ }, []); // 展开收起高级筛选
276
287
 
277
288
  var toggleAdvancedFilter = (0, _react.useCallback)(function () {
278
- var result = !advancedFilterVisible;
289
+ var result = !panelVisible;
279
290
 
280
291
  if (result) {
281
292
  // 展开高级筛选,Light回填Advanced
282
293
  if (currentForm.current === 'light') {
283
- advancedForm.setValues(lightForm.values);
294
+ var key = activeFilterValueRef.current;
295
+ var value = lightForm.values[key];
296
+ advancedForm.setValuesIn(key, value);
284
297
  }
285
298
  } else {
286
299
  // 收起高级筛选,配置标签数据
287
300
  configTag();
288
301
  }
289
302
 
290
- setAdvancedFilterVisible(result);
303
+ setPanelVisible(result);
291
304
  onExpand === null || onExpand === void 0 ? void 0 : onExpand(result);
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
-
305
+ }, [panelVisible, configTag]); // 简单搜索Filter
308
306
 
309
307
  var onSimpleFilter = (0, _react.useCallback)( /*#__PURE__*/function () {
310
308
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(values) {
@@ -312,19 +310,18 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
312
310
  while (1) {
313
311
  switch (_context.prev = _context.next) {
314
312
  case 0:
315
- if (enableFilter(values)) {
316
- _context.next = 2;
313
+ if (!(currentForm.current === 'simple')) {
314
+ _context.next = 14;
317
315
  break;
318
316
  }
319
317
 
320
- return _context.abrupt("return");
321
-
322
- case 2:
323
- if (!(currentForm.current === 'simple')) {
324
- _context.next = 7;
318
+ if (!(filterEnable.current === 'initialized')) {
319
+ _context.next = 9;
325
320
  break;
326
321
  }
327
322
 
323
+ filterEnable.current = 'filter';
324
+
328
325
  if (!hasRequired) {
329
326
  _context.next = 6;
330
327
  break;
@@ -334,9 +331,28 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
334
331
  return simpleForm.validate();
335
332
 
336
333
  case 6:
334
+ onInit === null || onInit === void 0 ? void 0 : onInit(values);
335
+ _context.next = 14;
336
+ break;
337
+
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:
337
353
  onFilter === null || onFilter === void 0 ? void 0 : onFilter(values);
338
354
 
339
- case 7:
355
+ case 14:
340
356
  case "end":
341
357
  return _context.stop();
342
358
  }
@@ -347,37 +363,81 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
347
363
  return function (_x) {
348
364
  return _ref4.apply(this, arguments);
349
365
  };
350
- }(), [onFilter, currentForm.current, hasRequired, enableFilter]); // 轻量搜索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的值
351
400
 
352
- 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 () {
353
407
  var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(values) {
354
408
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
355
409
  while (1) {
356
410
  switch (_context2.prev = _context2.next) {
357
411
  case 0:
358
- if (enableFilter(values)) {
359
- _context2.next = 2;
412
+ if (!(currentForm.current === 'advanced')) {
413
+ _context2.next = 9;
360
414
  break;
361
415
  }
362
416
 
363
- return _context2.abrupt("return");
417
+ if (!(filterEnable.current === 'initialized')) {
418
+ _context2.next = 9;
419
+ break;
420
+ }
364
421
 
365
- case 2:
366
- if (!(currentForm.current === 'light')) {
367
- _context2.next = 8;
422
+ filterEnable.current = 'filter';
423
+
424
+ if (!hasRequired) {
425
+ _context2.next = 6;
368
426
  break;
369
427
  }
370
428
 
371
- onFilter === null || onFilter === void 0 ? void 0 : onFilter(values);
372
429
  _context2.next = 6;
373
- return advancedForm.reset();
430
+ return advancedForm.validate();
374
431
 
375
432
  case 6:
376
- // 不会触发高级筛选的onReset回调函数
433
+ onInit === null || onInit === void 0 ? void 0 : onInit(values);
377
434
  configFilterItem(advancedForm);
378
- configTag();
379
435
 
380
- case 8:
436
+ if (!panelVisible) {
437
+ configTag();
438
+ }
439
+
440
+ case 9:
381
441
  case "end":
382
442
  return _context2.stop();
383
443
  }
@@ -388,31 +448,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
388
448
  return function (_x2) {
389
449
  return _ref5.apply(this, arguments);
390
450
  };
391
- }(), [onFilter, currentForm.current, enableFilter]); // 高级搜索Filter
392
-
393
- var onAdvancedFilter = (0, _react.useCallback)(function (values) {
394
- if (!enableFilter(values)) {
395
- return;
396
- }
397
-
398
- setCurrentForm('advanced');
399
- onFilter === null || onFilter === void 0 ? void 0 : onFilter(values);
400
- configFilterItem(advancedForm);
401
- lightForm.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
409
-
410
- var onAdvancedReset = (0, _react.useCallback)(function () {
411
- setCurrentForm('advanced');
412
- onReset === null || onReset === void 0 ? void 0 : onReset((0, _reactive.toJS)(advancedForm.values));
413
- configFilterItem(advancedForm);
414
- lightForm.reset();
415
- }, [onReset]); // 关闭标签清空表单字段值
451
+ }(), [hasRequired, onInit]); // 关闭标签清空表单字段值
416
452
 
417
453
  var onTagClose = (0, _react.useCallback)(function (key, index) {
418
454
  var newValue = undefined;
@@ -426,13 +462,14 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
426
462
  configFilterItem(advancedForm);
427
463
  configTag();
428
464
  onFilter === null || onFilter === void 0 ? void 0 : onFilter((0, _reactive.toJS)(advancedForm.values));
429
- }, []); // initialValues和initialRequest的回调
465
+ }, [onFilter]); // initialValues和initialRequest的回调
430
466
 
431
467
  var onInitialComplete = (0, _react.useCallback)(function (form) {
432
468
  form.setState({
433
469
  loading: false
434
470
  });
435
- }, []);
471
+ }, []); // 组件挂载
472
+
436
473
  (0, _react.useEffect)(function () {
437
474
  setCurrentForm(currentForm.current);
438
475
  }, []);
@@ -440,13 +477,14 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
440
477
  className: (0, _classnames.default)(prefixCls, props.className),
441
478
  addonBefore: addonBefore,
442
479
  addonAfter: addonAfter,
443
- expand: advancedFilterVisible,
480
+ expand: panelVisible,
444
481
  onExpand: toggleAdvancedFilter,
445
482
  count: tagDataSource.length,
446
483
  inlineContent: mode === 'panel' ? /*#__PURE__*/_react.default.createElement("div", {
447
- 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") : '')
448
485
  }, /*#__PURE__*/_react.default.createElement(_LightFilter.default, _objectSpread(_objectSpread({}, otherProps), {}, {
449
486
  defaultFilterValue: defaultFilterValue,
487
+ activeFilterValueRef: activeFilterValueRef,
450
488
  form: lightForm,
451
489
  onChange: (0, _lodash.default)(onLightFilter, filterDebounce)
452
490
  }))) : /*#__PURE__*/_react.default.createElement("div", {
@@ -464,7 +502,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
464
502
  onReset: onAdvancedReset,
465
503
  onInitialComplete: onInitialComplete
466
504
  })) : null
467
- }, mode === 'panel' && !advancedFilterVisible ? /*#__PURE__*/_react.default.createElement(_components.Tag.Group, null, tagDataSource.map(function (_ref6) {
505
+ }, mode === 'panel' && !panelVisible ? /*#__PURE__*/_react.default.createElement(_components.Tag.Group, null, tagDataSource.map(function (_ref6) {
468
506
  var key = _ref6.key,
469
507
  label = _ref6.label,
470
508
  value = _ref6.value,
@@ -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
  };
@@ -9,6 +9,8 @@ var _react = require("@formily/react");
9
9
 
10
10
  var _reactive = require("@formily/reactive");
11
11
 
12
+ var _utils = require("../utils");
13
+
12
14
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
15
 
14
16
  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; }
@@ -22,7 +24,7 @@ var customComponent = function customComponent(component) {
22
24
  form: field.form,
23
25
  values: (0, _reactive.toJS)(field.form.values)
24
26
  });
25
- }));
27
+ }, _utils.mapSize, _utils.mapStatus, _utils.mapDataSource));
26
28
  };
27
29
 
28
30
  exports.customComponent = customComponent;
@@ -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
@@ -44,9 +44,8 @@ var initializeRequest = function initializeRequest(requestConfig, suffix) {
44
44
  };
45
45
  } else {
46
46
  var requestConfigName = "$requestConfig_".concat(suffix);
47
- var requestIndex = (/\d{1,}\w(\d{0,})/g.exec(suffix) || [])[1];
48
47
  return {
49
- reactions: ["{{$common($request,".concat(requestConfigName, ",context,").concat(requestIndex, ")}}")],
48
+ reactions: ["{{$common($request,".concat(requestConfigName, ",context)}}")],
50
49
  scope: _defineProperty({}, requestConfigName, requestConfig)
51
50
  };
52
51
  }
@@ -1,6 +1,6 @@
1
1
  import type { ProFormRequestConfig } from '../typing';
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;
2
+ declare const $request: (field: any, requestConfig: ProFormRequestConfig, context: any, type: 'request' | 'validator' | 'dataSource') => Promise<unknown>;
3
+ declare const $common: (services: any, requestConfig: ProFormRequestConfig, context: any) => (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 };