@teamix/pro 1.3.15 → 1.3.16

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 (39) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +4953 -730
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/form/Filter/index.js +46 -29
  6. package/es/form/Filter/layout.scss +4 -0
  7. package/es/form/Filter/useBindUrl.d.ts +2 -0
  8. package/es/form/Filter/useBindUrl.js +118 -0
  9. package/es/form/ProForm/index.js +5 -3
  10. package/es/form/ProForm/useFieldSchema.js +53 -32
  11. package/es/form/SchemaForm/reactions.js +9 -3
  12. package/es/form/typing.d.ts +3 -0
  13. package/es/form/utils.d.ts +9 -1
  14. package/es/form/utils.js +6 -30
  15. package/es/global.scss +45 -0
  16. package/es/index.d.ts +2 -1
  17. package/es/index.js +3 -2
  18. package/es/page-header/index.d.ts +2 -0
  19. package/es/page-header/index.js +13 -3
  20. package/es/page-header/index.scss +8 -0
  21. package/es/table/components/Layout/index.scss +5 -5
  22. package/lib/form/Filter/index.js +47 -29
  23. package/lib/form/Filter/layout.scss +4 -0
  24. package/lib/form/Filter/useBindUrl.d.ts +2 -0
  25. package/lib/form/Filter/useBindUrl.js +129 -0
  26. package/lib/form/ProForm/index.js +5 -3
  27. package/lib/form/ProForm/useFieldSchema.js +52 -31
  28. package/lib/form/SchemaForm/reactions.js +9 -3
  29. package/lib/form/typing.d.ts +3 -0
  30. package/lib/form/utils.d.ts +9 -1
  31. package/lib/form/utils.js +5 -29
  32. package/lib/global.scss +45 -0
  33. package/lib/index.d.ts +2 -1
  34. package/lib/index.js +3 -1
  35. package/lib/page-header/index.d.ts +2 -0
  36. package/lib/page-header/index.js +12 -2
  37. package/lib/page-header/index.scss +8 -0
  38. package/lib/table/components/Layout/index.scss +5 -5
  39. package/package.json +1 -1
package/es/global.scss ADDED
@@ -0,0 +1,45 @@
1
+ // transition 切换主题优化,暂时先写到 pro 里,后面加到基础组件里
2
+
3
+ // table 行背景色
4
+ tr.next-table-row{
5
+ transition: color 0s;
6
+ }
7
+
8
+ // normal 按钮
9
+ button.next-btn.next-medium.next-btn-normal {
10
+ transition: color 0s;
11
+ }
12
+
13
+ // input 背景色
14
+ .next-input.next-medium {
15
+ transition: color 0s;
16
+ }
17
+
18
+ // radio 背景色
19
+ .next-radio-wrapper.checked .next-radio-inner:after {
20
+ transition: color 0s;
21
+ }
22
+
23
+ .next-radio-wrapper .next-radio-inner {
24
+ transition: color 0s;
25
+ }
26
+
27
+ // checkbox 背景色
28
+ .next-checkbox-wrapper .next-checkbox-inner {
29
+ transition: color 0s;
30
+ }
31
+
32
+ // 侧导背景色
33
+ .next-menu-item.next-nav-item {
34
+ transition: color 0s;
35
+ }
36
+
37
+ // 标签背景色
38
+ .next-tag {
39
+ transition: color 0s;
40
+ }
41
+
42
+ // 可关闭tag
43
+ .next-tag.next-tag.next-tag.next-tag-closable.next-tag-level-normal.next-tag-closable {
44
+ transition: color 0s;
45
+ }
package/es/index.d.ts CHANGED
@@ -13,6 +13,7 @@ import ProSidebar from './sidebar';
13
13
  import { ProTimeline } from './timeline';
14
14
  import * as nocode from './nocode';
15
15
  import * as templates from './templates';
16
+ import './global.scss';
16
17
  export * from './actions';
17
18
  export * from './card';
18
19
  export * from './field';
@@ -26,5 +27,5 @@ export * from './table';
26
27
  export * from './sidebar';
27
28
  export * from './utils';
28
29
  export * from './timeline';
29
- declare const version = "1.3.15";
30
+ declare const version = "1.3.16";
30
31
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils, };
package/es/index.js CHANGED
@@ -14,7 +14,8 @@ import ProSidebar from './sidebar';
14
14
  import { ProTimeline } from './timeline';
15
15
  import * as nocode from './nocode';
16
16
  import * as templates from './templates';
17
- import TeamixIcon from '@teamix/icon'; // 设置图标源
17
+ import TeamixIcon from '@teamix/icon';
18
+ import './global.scss'; // 设置图标源
18
19
 
19
20
  TeamixIcon.setConfig(utils.getTeamixIconConfig());
20
21
  export * from './actions';
@@ -31,6 +32,6 @@ export * from './sidebar';
31
32
  export * from './utils'; // export * from './sidebar';
32
33
 
33
34
  export * from './timeline';
34
- var version = '1.3.15';
35
+ var version = '1.3.16';
35
36
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
36
37
  ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils };
@@ -20,6 +20,8 @@ export declare type ProPageHeaderDataItem = {
20
20
  export declare type ProPageHeaderProps = {
21
21
  /** 标题 */
22
22
  title?: React.ReactNode;
23
+ /** 标题说明 */
24
+ titleTooltip?: React.ReactNode;
23
25
  /** 描述 */
24
26
  description?: React.ReactNode;
25
27
  /** 图标 */
@@ -1,6 +1,6 @@
1
1
  var _excluded = ["text", "children"],
2
2
  _excluded2 = ["color", "title", "num", "className"],
3
- _excluded3 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style", "tabs"];
3
+ _excluded3 = ["title", "titleTooltip", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style", "tabs"];
4
4
 
5
5
  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; }
6
6
 
@@ -16,13 +16,14 @@ import React from 'react';
16
16
  import { useHistory } from 'react-router-dom';
17
17
  import classnames from 'classnames';
18
18
  import TeamixIcon from '@teamix/icon';
19
- import { Breadcrumb } from '@alicloudfe/components';
19
+ import { Breadcrumb, Balloon } from '@alicloudfe/components';
20
20
  import { baseClass, goToLink, renderTags, isPresetColor, getColor, getColorClassName, getBackgroundColorClassName, CapsuleTab } from '@teamix/utils';
21
21
  import { ProActionGroup } from '../actions';
22
22
  import { ProSkeletonRaw } from '../skeleton';
23
23
  import ProInfo from '../info';
24
24
  import './index.scss';
25
25
  var cls = baseClass('teamix-pro-page-header');
26
+ var Tooltip = Balloon.Tooltip;
26
27
 
27
28
  var renderNav = function renderNav(breadcrumbs) {
28
29
  if (breadcrumbs && breadcrumbs.length) {
@@ -133,6 +134,7 @@ var renderTabs = function renderTabs(tabs) {
133
134
 
134
135
  var ProPageHeader = function ProPageHeader(props) {
135
136
  var title = props.title,
137
+ titleTooltip = props.titleTooltip,
136
138
  description = props.description,
137
139
  icon = props.icon,
138
140
  iconColor = props.iconColor,
@@ -200,7 +202,15 @@ var ProPageHeader = function ProPageHeader(props) {
200
202
  size: "large"
201
203
  }) : /*#__PURE__*/React.createElement(React.Fragment, null, icon)), /*#__PURE__*/React.createElement("span", {
202
204
  className: cls('title-name')
203
- }, title), renderTags(tags, 'large'), renderTabs(tabs !== null && tabs !== void 0 ? tabs : {}));
205
+ }, title, titleTooltip && /*#__PURE__*/React.createElement(Tooltip, {
206
+ trigger: /*#__PURE__*/React.createElement("span", {
207
+ className: cls('title-tooltip-icon')
208
+ }, /*#__PURE__*/React.createElement(TeamixIcon, {
209
+ type: "info-circle-line",
210
+ size: "xs"
211
+ })),
212
+ align: "t"
213
+ }, titleTooltip)), renderTags(tags, 'large'), renderTabs(tabs !== null && tabs !== void 0 ? tabs : {}));
204
214
  };
205
215
 
206
216
  return /*#__PURE__*/React.createElement("header", _objectSpread({
@@ -43,6 +43,7 @@ $prefix: 'teamix-pro-page-header';
43
43
  font-weight: 500;
44
44
  align-items: center;
45
45
  word-break: break-all;
46
+ color: var(--color-text1-4);
46
47
 
47
48
  &-name {
48
49
  white-space: nowrap;
@@ -50,6 +51,13 @@ $prefix: 'teamix-pro-page-header';
50
51
  text-overflow: ellipsis;
51
52
  }
52
53
 
54
+ &-tooltip-icon {
55
+ position: relative;
56
+ margin-left: 2px;
57
+ display: inline-flex;
58
+ top: -7px;
59
+ }
60
+
53
61
  &-icon {
54
62
  padding: var(--s-1, 4px);
55
63
  }
@@ -32,11 +32,11 @@ $prefix: 'teamix-pro-table-layout';
32
32
  &-filter-btn:not(:first-child) {
33
33
  margin-left: 8px;
34
34
  }
35
- &-panel-filter {
36
- margin: 8px 0;
37
- padding: 16px;
38
- background: var(--panel-filter-bg, var(--color-fill1-2));
39
- }
35
+ // &-panel-filter {
36
+ // margin: 8px 0;
37
+ // padding: 16px;
38
+ // background: var(--panel-filter-bg, var(--color-fill1-2));
39
+ // }
40
40
  &-main-action {
41
41
  margin-bottom: 8px;
42
42
  }
@@ -43,9 +43,11 @@ var _Layout = require("./Layout");
43
43
 
44
44
  var _useSpecialProps2 = _interopRequireDefault(require("./useSpecialProps"));
45
45
 
46
+ var _useBindUrl2 = _interopRequireDefault(require("./useBindUrl"));
47
+
46
48
  require("./index.scss");
47
49
 
48
- var _excluded = ["addonAfter", "addonBefore", "mode", "purePanel", "expand", "formRef", "defaultFilterValue", "filterValues", "filterDebounce", "onFilter", "onInit", "onReset", "onExpand", "onChange"];
50
+ var _excluded = ["addonAfter", "addonBefore", "mode", "purePanel", "expand", "formRef", "defaultFilterValue", "filterValues", "filterDebounce", "bindUrl", "onFilter", "onInit", "onReset", "onExpand", "onChange"];
49
51
 
50
52
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
51
53
 
@@ -100,9 +102,10 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
100
102
  defaultFilterValue = props.defaultFilterValue,
101
103
  filterValues = props.filterValues,
102
104
  filterDebounce = props.filterDebounce,
103
- onFilter = props.onFilter,
104
- onInit = props.onInit,
105
- onReset = props.onReset,
105
+ bindUrl = props.bindUrl,
106
+ outerFilter = props.onFilter,
107
+ outerInit = props.onInit,
108
+ outerReset = props.onReset,
106
109
  onExpand = props.onExpand,
107
110
  onChange = props.onChange,
108
111
  otherProps = _objectWithoutProperties(props, _excluded);
@@ -121,15 +124,27 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
121
124
  setTagDataSource = _useState4[1];
122
125
 
123
126
  var filterItem = (0, _react.useRef)([]);
124
- var defaultForm = mode === 'panel' ? 'advanced' : 'simple';
125
- var currentForm = (0, _react.useRef)(defaultForm);
127
+ var defaultFormName = mode === 'panel' ? 'advanced' : 'simple';
128
+ var currentFormName = (0, _react.useRef)(defaultFormName);
129
+ var currentForm = (0, _react.useRef)();
126
130
  var activeFilterValueRef = (0, _react.useRef)();
127
131
  var prefixCls = (0, _utils.usePrefixCls)('', {
128
132
  prefix: 'teamix-pro-form-query-filter'
129
133
  });
130
134
  var debounceFun = (0, _lodash.default)(function (fun, props) {
131
135
  return fun(props);
132
- }, filterDebounce); // onInit
136
+ }, filterDebounce); // 绑定URL
137
+
138
+ var _useBindUrl = (0, _useBindUrl2.default)(bindUrl, {
139
+ onInit: outerInit,
140
+ onFilter: outerFilter,
141
+ onReset: outerReset
142
+ }, currentForm),
143
+ setValuesByUrlState = _useBindUrl.setValuesByUrlState,
144
+ onInit = _useBindUrl.onInit,
145
+ onFilter = _useBindUrl.onFilter,
146
+ onReset = _useBindUrl.onReset; // onInit
147
+
133
148
 
134
149
  var initialRequestRef = (0, _react.useRef)(!!(props === null || props === void 0 ? void 0 : props.initialRequest));
135
150
  var filterEnable = (0, _react.useRef)('waiting');
@@ -150,29 +165,31 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
150
165
  }); // 等待mounted + 字段loading结束 + initialRequest结束 => 表单默认值初始化完成
151
166
 
152
167
  if (!(form.mounted && !loadingField.length && !form.loading)) {
153
- _context.next = 9;
168
+ _context.next = 10;
154
169
  break;
155
170
  }
156
171
 
157
172
  onFormInit = undefined; // init后销毁 isFormInit 方法
158
173
 
159
- if (!onInit) {
160
- _context.next = 9;
174
+ setValuesByUrlState(form); // 配置URL参数到表单
175
+
176
+ if (!outerInit) {
177
+ _context.next = 10;
161
178
  break;
162
179
  }
163
180
 
164
- _context.next = 7;
181
+ _context.next = 8;
165
182
  return form.validate();
166
183
 
167
- case 7:
168
- onInit === null || onInit === void 0 ? void 0 : onInit((0, _reactive.toJS)(form.values)); // 设置Tag
184
+ case 8:
185
+ onInit((0, _reactive.toJS)(form.values)); // 设置Tag
169
186
 
170
187
  if (mode === 'panel') {
171
188
  configFilterItem(advancedForm);
172
189
  !panelVisible && configTag();
173
190
  }
174
191
 
175
- case 9:
192
+ case 10:
176
193
  case "end":
177
194
  return _context.stop();
178
195
  }
@@ -187,10 +204,11 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
187
204
 
188
205
 
189
206
  var setCurrentForm = function setCurrentForm(formName) {
190
- currentForm.current = formName;
207
+ currentFormName.current = formName;
208
+ currentForm.current = formMap[formName];
209
+ var form = currentForm.current;
191
210
 
192
211
  if (formRef) {
193
- var form = formMap[formName];
194
212
  formRef.current = form; // 自定义updateTags方法
195
213
 
196
214
  if (!formRef.current.updateTags) {
@@ -218,7 +236,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
218
236
  return form.validate();
219
237
 
220
238
  case 4:
221
- onFilter === null || onFilter === void 0 ? void 0 : onFilter((0, _reactive.toJS)(form.values));
239
+ onFilter((0, _reactive.toJS)(form.values));
222
240
  updateTags(form);
223
241
 
224
242
  case 6:
@@ -246,7 +264,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
246
264
  return form.validate();
247
265
 
248
266
  case 2:
249
- onFilter === null || onFilter === void 0 ? void 0 : onFilter((0, _reactive.toJS)(form.values));
267
+ onFilter((0, _reactive.toJS)(form.values));
250
268
 
251
269
  if (formName === 'advanced') {
252
270
  updateTags(form);
@@ -274,7 +292,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
274
292
  advancedForm.reset('*', config);
275
293
 
276
294
  if (formName === 'advanced') {
277
- onReset === null || onReset === void 0 ? void 0 : onReset((0, _reactive.toJS)(advancedForm.values));
295
+ onReset((0, _reactive.toJS)(advancedForm.values));
278
296
  updateTags(form);
279
297
  }
280
298
 
@@ -404,7 +422,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
404
422
 
405
423
  if (result) {
406
424
  // 展开高级筛选,Light回填Advanced
407
- if (currentForm.current === 'light') {
425
+ if (currentFormName.current === 'light') {
408
426
  var key = activeFilterValueRef.current;
409
427
  var value = lightForm.values[key];
410
428
  advancedForm.setValuesIn(key, value);
@@ -428,7 +446,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
428
446
  return simpleForm.validate();
429
447
 
430
448
  case 2:
431
- onFilter === null || onFilter === void 0 ? void 0 : onFilter(values);
449
+ onFilter(values);
432
450
 
433
451
  case 3:
434
452
  case "end":
@@ -444,7 +462,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
444
462
  }(), [onFilter]); // 简单搜索Change
445
463
 
446
464
  var onSimpleChange = (0, _react.useCallback)(function (values, fieldValue, fieldName) {
447
- if (currentForm.current === 'simple') {
465
+ if (currentFormName.current === 'simple') {
448
466
  onChange === null || onChange === void 0 ? void 0 : onChange(values, fieldValue, fieldName);
449
467
 
450
468
  if (filterEnable.current === 'filter') {
@@ -456,7 +474,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
456
474
  var onLightFilter = (0, _react.useCallback)(function (values) {
457
475
  var _Object$keys;
458
476
 
459
- onFilter === null || onFilter === void 0 ? void 0 : onFilter(values); // 清空advancedForm的值
477
+ onFilter(values); // 清空advancedForm的值
460
478
 
461
479
  var clearKeys = {};
462
480
  (_Object$keys = Object.keys(advancedForm.values)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.forEach(function (key) {
@@ -467,7 +485,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
467
485
  }, [onFilter]); // 轻量搜索Change
468
486
 
469
487
  var onLightChange = (0, _react.useCallback)(function (values, fieldValue, fieldName) {
470
- if (currentForm.current === 'light') {
488
+ if (currentFormName.current === 'light') {
471
489
  onChange === null || onChange === void 0 ? void 0 : onChange(values, fieldValue, fieldName);
472
490
 
473
491
  if (filterEnable.current === 'filter') {
@@ -478,7 +496,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
478
496
 
479
497
  var onAdvancedFilter = (0, _react.useCallback)(function (values) {
480
498
  setCurrentForm('advanced');
481
- onFilter === null || onFilter === void 0 ? void 0 : onFilter(values);
499
+ onFilter(values);
482
500
  configFilterItem(advancedForm); // 清空lightForm的值
483
501
 
484
502
  lightForm.reset('*', {
@@ -488,7 +506,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
488
506
 
489
507
  var onAdvancedReset = (0, _react.useCallback)(function () {
490
508
  setCurrentForm('advanced');
491
- onReset === null || onReset === void 0 ? void 0 : onReset((0, _reactive.toJS)(advancedForm.values));
509
+ onReset((0, _reactive.toJS)(advancedForm.values));
492
510
  configFilterItem(advancedForm); // 清空lightForm的值
493
511
 
494
512
  lightForm.reset('*', {
@@ -497,7 +515,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
497
515
  }, [onReset]); // 高级搜索Change
498
516
 
499
517
  var onAdvancedChange = (0, _react.useCallback)(function (values, fieldValue, fieldName) {
500
- if (currentForm.current === 'advanced') {
518
+ if (currentFormName.current === 'advanced') {
501
519
  onChange === null || onChange === void 0 ? void 0 : onChange(values, fieldValue, fieldName);
502
520
  }
503
521
  }, [onChange]); // 关闭标签清空表单字段值
@@ -512,7 +530,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
512
530
 
513
531
  advancedForm.setValuesIn(key, newValue);
514
532
  updateTags(advancedForm);
515
- onFilter === null || onFilter === void 0 ? void 0 : onFilter((0, _reactive.toJS)(advancedForm.values));
533
+ onFilter((0, _reactive.toJS)(advancedForm.values));
516
534
  }, [onFilter]); // initialRequest 的回调
517
535
 
518
536
  var onInitialComplete = (0, _react.useCallback)(function (form) {
@@ -523,7 +541,7 @@ var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
523
541
  }, []); // 组件挂载
524
542
 
525
543
  (0, _react.useEffect)(function () {
526
- setCurrentForm(currentForm.current);
544
+ setCurrentForm(currentFormName.current);
527
545
  }, []);
528
546
  return /*#__PURE__*/_react.default.createElement(_Layout.QueryFilterLayout, {
529
547
  className: (0, _classnames.default)(prefixCls, props.className),
@@ -6,6 +6,10 @@ $query-filter-layout: #{$teamix-pro-form}-query-filter-layout;
6
6
  --panel-filter-bg: #1f1f1f;
7
7
  }
8
8
 
9
+ .theme-hybridcloud {
10
+ --panel-filter-bg: var(--color-fill1-2);
11
+ }
12
+
9
13
  .#{$query-filter-layout} {
10
14
  .#{$query-filter-layout}-inline {
11
15
  display: flex;
@@ -0,0 +1,2 @@
1
+ declare const _default: (bindUrl: any, functions: any, formRef: any) => any;
2
+ export default _default;
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _hooks = require("@teamix/hooks");
9
+
10
+ var _utils = require("@teamix/utils");
11
+
12
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
+
14
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
+
16
+ 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); }
17
+
18
+ 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; }
19
+
20
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
21
+
22
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
+
24
+ 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; }
25
+
26
+ 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; }
27
+
28
+ 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; }
29
+
30
+ var _default = function _default(bindUrl, functions, formRef) {
31
+ // 预处理 bindUrl 参数(主要兼容 SelectGroup 组件)
32
+ var initializeBindUrl = function initializeBindUrl(options) {
33
+ return options ? _objectSpread(_objectSpread({}, options), {}, {
34
+ beforeStringify: function beforeStringify(values) {
35
+ var _Object$entries;
36
+
37
+ var beforeStringify = options.beforeStringify;
38
+
39
+ var newValues = _objectSpread({}, values);
40
+
41
+ (_Object$entries = Object.entries(values)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.forEach(function (_ref) {
42
+ var _form$query;
43
+
44
+ var _ref2 = _slicedToArray(_ref, 2),
45
+ key = _ref2[0],
46
+ value = _ref2[1];
47
+
48
+ var form = formRef.current;
49
+ var field = (_form$query = form.query(key)) === null || _form$query === void 0 ? void 0 : _form$query.take();
50
+
51
+ if ((field === null || field === void 0 ? void 0 : field.component[0]) === 'SelectGroup') {
52
+ newValues[key] = value.map(function (_ref3) {
53
+ var key = _ref3.key,
54
+ value = _ref3.value;
55
+ return key && value ? "".concat(key, "||").concat(value === null || value === void 0 ? void 0 : value.join('|')) : '';
56
+ });
57
+ }
58
+ });
59
+ return beforeStringify ? beforeStringify(newValues) : newValues;
60
+ }
61
+ }) : options;
62
+ }; // 通过 useUrlState 获取 url 上的参数和 url 配置方法
63
+
64
+
65
+ var _useUrlState = (0, _hooks.useUrlState)(undefined, initializeBindUrl(bindUrl)),
66
+ _useUrlState2 = _slicedToArray(_useUrlState, 2),
67
+ urlState = _useUrlState2[0],
68
+ setUrlState = _useUrlState2[1]; // 输出配置url参数的函数
69
+
70
+
71
+ var initializedFunctions = Object.entries(functions).reduce(function (prev, _ref4) {
72
+ var _ref5 = _slicedToArray(_ref4, 2),
73
+ key = _ref5[0],
74
+ fun = _ref5[1];
75
+
76
+ prev[key] = function (values) {
77
+ fun === null || fun === void 0 ? void 0 : fun(values);
78
+ setUrlState(values);
79
+ };
80
+
81
+ return prev;
82
+ }, {}); // 使用 url 参数配置 QueryFilter 默认值(移除非表单值,兼容数组数据,兼容 SelectGroup 组件)
83
+
84
+ var setValuesByUrlState = function setValuesByUrlState(form) {
85
+ if (urlState) {
86
+ var _Object$entries2;
87
+
88
+ (_Object$entries2 = Object.entries(urlState)) === null || _Object$entries2 === void 0 ? void 0 : _Object$entries2.forEach(function (_ref6) {
89
+ var _form$query2;
90
+
91
+ var _ref7 = _slicedToArray(_ref6, 2),
92
+ key = _ref7[0],
93
+ value = _ref7[1];
94
+
95
+ var field = (_form$query2 = form.query(key)) === null || _form$query2 === void 0 ? void 0 : _form$query2.take();
96
+
97
+ if (field) {
98
+ var newValue = value;
99
+
100
+ if (field.displayName === 'ArrayField') {
101
+ newValue = [].concat((0, _utils.isUsable)(newValue) ? newValue : []);
102
+ }
103
+
104
+ if (field.component[0] === 'SelectGroup') {
105
+ newValue = newValue.map(function (item) {
106
+ var _item$split = item === null || item === void 0 ? void 0 : item.split('||'),
107
+ _item$split2 = _slicedToArray(_item$split, 2),
108
+ key = _item$split2[0],
109
+ value = _item$split2[1];
110
+
111
+ return {
112
+ key: key,
113
+ value: value === null || value === void 0 ? void 0 : value.split('|')
114
+ };
115
+ });
116
+ }
117
+
118
+ form.setValuesIn(key, newValue);
119
+ }
120
+ });
121
+ }
122
+ };
123
+
124
+ return _objectSpread({
125
+ setValuesByUrlState: setValuesByUrlState
126
+ }, initializedFunctions);
127
+ };
128
+
129
+ exports.default = _default;
@@ -135,7 +135,7 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
135
135
 
136
136
  var mergedComponents = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, globalComponents), components), formilyComponents), _ProField.default);
137
137
 
138
- var onAutoSubmit = (0, _useAutoSubmit.default)(onSubmit); // todo 需要formily支持断点下的属性更新
138
+ var onAutoSubmit = (0, _useAutoSubmit.default)(onSubmit, context); // todo 需要formily支持断点下的属性更新
139
139
 
140
140
  var getTeamixLayout = (0, _react.useMemo)(function () {
141
141
  return breakpoints ? {
@@ -160,7 +160,7 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
160
160
  if (initialValues) {
161
161
  form.setInitialValues(initialValues);
162
162
  } else if (initialRequest) {
163
- (0, _useInitialRequest.default)(initialRequest).then(function (values) {
163
+ (0, _useInitialRequest.default)(initialRequest, context).then(function (values) {
164
164
  form.setInitialValues(values);
165
165
  }).finally(function () {
166
166
  onInitialComplete === null || onInitialComplete === void 0 ? void 0 : onInitialComplete(form);
@@ -205,10 +205,12 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
205
205
  }) : null, otherProps === null || otherProps === void 0 ? void 0 : otherProps.children);
206
206
  });
207
207
 
208
- ProForm.Field = function () {
208
+ var Field = function Field() {
209
209
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
210
210
  };
211
211
 
212
+ Field.displayName = 'ProFormField';
213
+ ProForm.Field = Field;
212
214
  ProForm.defaultProps = {
213
215
  colon: false,
214
216
  labelAlign: 'left',