@teamix/pro 1.2.4 → 1.2.8

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 (126) hide show
  1. package/dist/212.js +1 -1
  2. package/dist/pro.css +1 -1
  3. package/dist/pro.js +1182 -512
  4. package/dist/pro.min.css +1 -1
  5. package/dist/pro.min.js +1 -1
  6. package/es/actions/dialog-component.js +2 -1
  7. package/es/actions/dialog-form.js +2 -1
  8. package/es/actions/dialog.js +2 -1
  9. package/es/actions/index.js +3 -2
  10. package/es/actions/index.scss +3 -0
  11. package/es/actions/utils.d.ts +1 -0
  12. package/es/actions/utils.js +27 -0
  13. package/es/card/card-container.d.ts +18 -0
  14. package/es/card/card-container.js +24 -0
  15. package/es/card/divider.d.ts +6 -0
  16. package/es/card/divider.js +16 -0
  17. package/es/card/index.d.ts +68 -32
  18. package/es/card/index.js +194 -107
  19. package/es/card/index.scss +174 -9
  20. package/es/card/selectable.d.ts +13 -0
  21. package/es/card/selectable.js +45 -0
  22. package/es/card/utils.d.ts +9 -0
  23. package/es/card/utils.js +30 -0
  24. package/es/form/Components/ProField/index.js +2 -7
  25. package/es/form/Filter/index.js +5 -5
  26. package/es/form/ProForm/index.js +43 -17
  27. package/es/form/ProForm/index.scss +0 -1
  28. package/es/form/ProForm/useAutoSubmit.d.ts +1 -1
  29. package/es/form/ProForm/useAutoSubmit.js +3 -3
  30. package/es/form/ProForm/useInitialRequest.d.ts +1 -1
  31. package/es/form/ProForm/useInitialRequest.js +2 -2
  32. package/es/form/SchemaForm/initializeDataSource.js +1 -1
  33. package/es/form/SchemaForm/initializeFormButton.js +3 -2
  34. package/es/form/SchemaForm/initializeRequest.js +6 -3
  35. package/es/form/SchemaForm/initializeRules.js +1 -1
  36. package/es/form/SchemaForm/reactions.d.ts +5 -4
  37. package/es/form/SchemaForm/reactions.js +20 -11
  38. package/es/form/locales/validate.d.ts +159 -0
  39. package/es/form/locales/validate.js +158 -0
  40. package/es/form/typing.d.ts +4 -3
  41. package/es/index.d.ts +1 -1
  42. package/es/index.js +7 -4
  43. package/es/info/components/InfoGroup/index.js +5 -2
  44. package/es/info/components/InfoValueItem/index.js +4 -6
  45. package/es/info/components/baseInfo/index.js +4 -2
  46. package/es/info/components/tableInfo/index.js +10 -6
  47. package/es/info/index.js +25 -11
  48. package/es/info/typing.d.ts +6 -0
  49. package/es/nocode/configurators/Card.js +39 -12
  50. package/es/sidebar/components/sidebar-container/index.d.ts +5 -0
  51. package/es/sidebar/components/sidebar-container/index.js +77 -0
  52. package/es/sidebar/components/sidebar-container/index.scss +18 -0
  53. package/es/sidebar/components/tree/index.d.ts +4 -0
  54. package/es/sidebar/components/tree/index.js +95 -0
  55. package/es/sidebar/index.d.ts +5 -0
  56. package/es/sidebar/index.js +66 -0
  57. package/es/sidebar/index.scss +3 -0
  58. package/es/sidebar/typing.d.ts +51 -0
  59. package/es/sidebar/typing.js +1 -0
  60. package/es/table/components/Layout/index.js +1 -1
  61. package/es/table/components/ToolBar/FilterColumnIcon.js +2 -24
  62. package/es/table/components/ToolBar/index.scss +0 -3
  63. package/es/table/index.js +26 -9
  64. package/es/table/index.scss +1 -0
  65. package/es/table/typing.d.ts +6 -4
  66. package/lib/actions/dialog-component.js +3 -1
  67. package/lib/actions/dialog-form.js +3 -1
  68. package/lib/actions/dialog.js +3 -1
  69. package/lib/actions/index.js +3 -2
  70. package/lib/actions/index.scss +3 -0
  71. package/lib/actions/utils.d.ts +1 -0
  72. package/lib/actions/utils.js +33 -0
  73. package/lib/card/card-container.d.ts +18 -0
  74. package/lib/card/card-container.js +37 -0
  75. package/lib/card/divider.d.ts +6 -0
  76. package/lib/card/divider.js +26 -0
  77. package/lib/card/index.d.ts +68 -32
  78. package/lib/card/index.js +215 -110
  79. package/lib/card/index.scss +174 -9
  80. package/lib/card/selectable.d.ts +13 -0
  81. package/lib/card/selectable.js +60 -0
  82. package/lib/card/utils.d.ts +9 -0
  83. package/lib/card/utils.js +41 -0
  84. package/lib/form/Components/ProField/index.js +1 -6
  85. package/lib/form/Filter/index.js +5 -6
  86. package/lib/form/ProForm/index.js +41 -14
  87. package/lib/form/ProForm/index.scss +0 -1
  88. package/lib/form/ProForm/useAutoSubmit.d.ts +1 -1
  89. package/lib/form/ProForm/useAutoSubmit.js +3 -3
  90. package/lib/form/ProForm/useInitialRequest.d.ts +1 -1
  91. package/lib/form/ProForm/useInitialRequest.js +2 -2
  92. package/lib/form/SchemaForm/initializeDataSource.js +1 -1
  93. package/lib/form/SchemaForm/initializeFormButton.js +5 -2
  94. package/lib/form/SchemaForm/initializeRequest.js +5 -2
  95. package/lib/form/SchemaForm/initializeRules.js +1 -1
  96. package/lib/form/SchemaForm/reactions.d.ts +5 -4
  97. package/lib/form/SchemaForm/reactions.js +23 -12
  98. package/lib/form/locales/validate.d.ts +159 -0
  99. package/lib/form/locales/validate.js +165 -0
  100. package/lib/form/typing.d.ts +4 -3
  101. package/lib/index.d.ts +1 -1
  102. package/lib/index.js +3 -1
  103. package/lib/info/components/InfoGroup/index.js +5 -2
  104. package/lib/info/components/InfoValueItem/index.js +4 -6
  105. package/lib/info/components/baseInfo/index.js +4 -2
  106. package/lib/info/components/tableInfo/index.js +10 -6
  107. package/lib/info/index.js +24 -10
  108. package/lib/info/typing.d.ts +6 -0
  109. package/lib/nocode/configurators/Card.js +39 -12
  110. package/lib/sidebar/components/sidebar-container/index.d.ts +5 -0
  111. package/lib/sidebar/components/sidebar-container/index.js +93 -0
  112. package/lib/sidebar/components/sidebar-container/index.scss +18 -0
  113. package/lib/sidebar/components/tree/index.d.ts +4 -0
  114. package/lib/sidebar/components/tree/index.js +112 -0
  115. package/lib/sidebar/index.d.ts +5 -0
  116. package/lib/sidebar/index.js +87 -0
  117. package/lib/sidebar/index.scss +3 -0
  118. package/lib/sidebar/typing.d.ts +51 -0
  119. package/lib/sidebar/typing.js +5 -0
  120. package/lib/table/components/Layout/index.js +1 -1
  121. package/lib/table/components/ToolBar/FilterColumnIcon.js +2 -24
  122. package/lib/table/components/ToolBar/index.scss +0 -3
  123. package/lib/table/index.js +27 -9
  124. package/lib/table/index.scss +1 -0
  125. package/lib/table/typing.d.ts +6 -4
  126. package/package.json +4 -4
@@ -40,31 +40,196 @@
40
40
  }
41
41
  }
42
42
 
43
+ &-title {
44
+ display: flex;
45
+ align-items: center;
46
+
47
+ & > div {
48
+ display: flex;
49
+ align-items: center;
50
+ &:not(:last-child) {
51
+ margin-right: var(--s-2, 8px);
52
+ }
53
+ }
54
+
55
+ &-collapse {
56
+ cursor: pointer;
57
+
58
+ & > i {
59
+ transition: transform 0.2s;
60
+ color: var(--color-text1-8, #848484);
61
+ margin-right: var(--s-2, 8px);
62
+ }
63
+
64
+ &.collapsed {
65
+ & > i {
66
+ transform: rotate(-90deg);
67
+ }
68
+ }
69
+ }
70
+
71
+ &-description,
72
+ &-tooltip {
73
+ color: var(--color-text1-8, #848484);
74
+ font-weight: normal;
75
+ }
76
+
77
+ &-description {
78
+ font-size: 12px;
79
+ }
80
+ }
81
+
82
+ &-divider {
83
+ flex: none;
84
+ background-color: var(--color-line1-1, #eaeaea);
85
+ }
86
+
43
87
  &-content {
44
88
  &.centered {
45
89
  display: flex;
46
90
  align-items: center;
47
91
  justify-content: center;
48
92
  }
93
+
94
+ &.contain-pro-card {
95
+ display: flex;
96
+
97
+ &.flex-wrap {
98
+ flex-wrap: wrap;
99
+ }
100
+
101
+ &.flex-direction {
102
+ &-row {
103
+ flex-direction: row;
104
+
105
+ .teamix-pro-card-divider {
106
+ width: 1px;
107
+ }
108
+ }
109
+
110
+ &-row-reverse {
111
+ flex-direction: row-reverse;
112
+ .teamix-pro-card-divider {
113
+ width: 1px;
114
+ }
115
+ }
116
+
117
+ &-column {
118
+ flex-direction: column;
119
+ .teamix-pro-card-divider {
120
+ height: 1px;
121
+ }
122
+ }
123
+
124
+ &-column-reverse {
125
+ flex-direction: column-reverse;
126
+ .teamix-pro-card-divider {
127
+ height: 1px;
128
+ }
129
+ }
130
+ }
131
+
132
+ &.split-horizontal,
133
+ &.split-vertical {
134
+ & > .teamix-pro-card-col > .teamix-pro-card {
135
+ border: none;
136
+ }
137
+ }
138
+
139
+ &.split-horizontal {
140
+ & > .teamix-pro-card-col {
141
+ &:not(:last-child) {
142
+ border-right: 1px solid var(--color-line1-1, #eaeaea);
143
+ }
144
+ }
145
+ }
146
+ &.split-vertical {
147
+ & > .teamix-pro-card-col {
148
+ &:not(:last-child) {
149
+ border-bottom: 1px solid var(--color-line1-1, #eaeaea);
150
+ }
151
+ }
152
+ }
153
+ }
49
154
  }
50
155
 
51
- &.noBorder {
52
- border: none;
156
+ & > .next-card-actions {
157
+ & > .teamix-pro-actions {
158
+ & > .next-btn {
159
+ margin-right: 0;
160
+ flex-grow: 1;
161
+ }
162
+
163
+ & > .next-divider {
164
+ margin: 0;
165
+ }
166
+ }
167
+ }
168
+
169
+ &.hoverable {
170
+ &:hover {
171
+ box-shadow: var(--shadow-3, 0px 6px 24px 0px rgba(0, 0, 0, 0.1));
172
+ }
53
173
  }
54
174
 
55
175
  &.compacted {
56
176
  border: none;
57
- --card-body-padding-bottom: 0px;
58
- --card-padding-lr: 0px;
59
177
 
60
- .next-card-content-container {
61
- --card-body-show-divider-padding-top: 0px;
178
+ & > .next-card-header {
179
+ margin-top: 0;
180
+ padding: 0;
181
+ }
182
+ & > .next-card-content-container {
183
+ margin: 0;
184
+ padding: 0;
62
185
  }
63
186
  }
64
187
 
65
- &.noHoveredShadow {
66
- &:hover {
67
- box-shadow: none;
188
+ &.border {
189
+ &-blue {
190
+ border-color: var(--color-notice-5);
191
+ }
192
+
193
+ &-orange {
194
+ border-color: var(--color-warning-5);
195
+ }
196
+
197
+ &-yellow {
198
+ border-color: var(--color-help-5);
199
+ }
200
+
201
+ &-red {
202
+ border-color: var(--color-error-5);
203
+ }
204
+
205
+ &-green {
206
+ border-color: var(--color-success-5);
207
+ }
208
+
209
+ &-grey {
210
+ border-color: var(--color-line1-1);
211
+ }
212
+
213
+ &-transparent {
214
+ border-color: transparent;
215
+ }
216
+
217
+ &-none {
218
+ border: none;
219
+ }
220
+ }
221
+
222
+ &-selectable {
223
+ cursor: pointer;
224
+
225
+ &-icon {
226
+ &-selected {
227
+ color: var(--color-notice-5);
228
+ }
229
+
230
+ &-unselected {
231
+ color: var(--color-line1-1);
232
+ }
68
233
  }
69
234
  }
70
235
 
@@ -0,0 +1,13 @@
1
+ import { ProCardProps } from './index';
2
+ export interface ProCardSelectableProps extends Omit<ProCardProps, 'onSelect'> {
3
+ selected?: boolean;
4
+ onSelect?: (selected: boolean) => void;
5
+ }
6
+ declare const ProCardSelectable: {
7
+ (props: ProCardSelectableProps): JSX.Element;
8
+ defaultProps: {
9
+ hoveredShadow: boolean;
10
+ };
11
+ isProCard: boolean;
12
+ };
13
+ export default ProCardSelectable;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+
12
+ var _icon = _interopRequireDefault(require("@teamix/icon"));
13
+
14
+ var _utils = require("@teamix/utils");
15
+
16
+ var _index = require("./index");
17
+
18
+ var _excluded = ["selected", "onSelect", "className", "onClick"];
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23
+
24
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
+
26
+ 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; }
27
+
28
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
29
+
30
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
31
+
32
+ var cls = (0, _utils.baseClass)('teamix-pro-card-selectable');
33
+
34
+ var ProCardSelectable = function ProCardSelectable(props) {
35
+ var selected = props.selected,
36
+ onSelect = props.onSelect,
37
+ className = props.className,
38
+ _onClick = props.onClick,
39
+ others = _objectWithoutProperties(props, _excluded);
40
+
41
+ return /*#__PURE__*/_react.default.createElement(_index.ProCard, _objectSpread({
42
+ className: (0, _classnames.default)(cls(), className),
43
+ borderColor: selected ? 'blue' : 'grey',
44
+ extra: /*#__PURE__*/_react.default.createElement(_icon.default, {
45
+ className: cls('icon', selected ? 'icon-selected' : 'icon-unselected'),
46
+ type: selected ? 'success-fill' : 'circle-line'
47
+ }),
48
+ onClick: function onClick(e) {
49
+ _onClick && _onClick(e);
50
+ onSelect && onSelect(!selected);
51
+ }
52
+ }, others));
53
+ };
54
+
55
+ ProCardSelectable.defaultProps = {
56
+ hoveredShadow: true
57
+ };
58
+ ProCardSelectable.isProCard = true;
59
+ var _default = ProCardSelectable;
60
+ exports.default = _default;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ export declare function formatSpacing(spacing?: [number, number] | number): {
3
+ horizonal: number;
4
+ vertical: number;
5
+ };
6
+ export declare function getColClassAndStyle(col?: number | string): {
7
+ className?: string;
8
+ style: React.CSSProperties;
9
+ };
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatSpacing = formatSpacing;
7
+ exports.getColClassAndStyle = getColClassAndStyle;
8
+
9
+ var _utils = require("@teamix/utils");
10
+
11
+ var cls = (0, _utils.baseClass)('teamix-pro-card');
12
+
13
+ function formatSpacing(spacing) {
14
+ var spacingArray = spacing instanceof Array ? spacing : [spacing || 0, spacing || 0];
15
+ return {
16
+ horizonal: spacingArray[0] / 2,
17
+ vertical: spacingArray[1] / 2
18
+ };
19
+ }
20
+
21
+ function getColClassAndStyle(col) {
22
+ if (!col) {
23
+ return {
24
+ style: {}
25
+ };
26
+ }
27
+
28
+ if (typeof col === 'number') {
29
+ return {
30
+ className: cls("col-".concat(col)),
31
+ style: {}
32
+ };
33
+ }
34
+
35
+ return {
36
+ style: {
37
+ width: col,
38
+ flexShrink: 0
39
+ }
40
+ };
41
+ }
@@ -40,12 +40,7 @@ var componentBuilder = function componentBuilder(type) {
40
40
  return /*#__PURE__*/_react.default.createElement(_field.default, _objectSpread(_objectSpread({}, props), {}, {
41
41
  type: type
42
42
  }));
43
- }, (0, _react2.mapProps)(_utils.mapSize, _utils.mapStatus, _utils.mapDataSource, _utils.mapMode), (0, _react2.mapReadPretty)(function (props) {
44
- return /*#__PURE__*/_react.default.createElement(_field.default, _objectSpread(_objectSpread({}, props), {}, {
45
- type: type,
46
- mode: "read"
47
- }));
48
- }));
43
+ }, (0, _react2.mapProps)(_utils.mapSize, _utils.mapStatus, _utils.mapDataSource, _utils.mapMode));
49
44
  };
50
45
 
51
46
  var _default = function () {
@@ -50,8 +50,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
50
50
 
51
51
  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; }
52
52
 
53
- var searchText = (0, _utils.getMessage)('search');
54
-
55
53
  var getEventProps = function getEventProps(triggerType, onFilter) {
56
54
  var keydownEvent = {
57
55
  onSubmit: onFilter
@@ -200,7 +198,8 @@ var AdvancedFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
200
198
  onResetValidateSuccess: onReset,
201
199
  style: _objectSpread({}, triggerType === 'submit' ? {} : {
202
200
  marginRight: -16
203
- })
201
+ }),
202
+ children: (0, _utils.getMessage)('reset')
204
203
  }
205
204
  }, {
206
205
  component: 'Submit',
@@ -209,9 +208,9 @@ var AdvancedFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
209
208
  marginRight: -8
210
209
  } : {
211
210
  display: 'none'
212
- })
213
- },
214
- content: searchText
211
+ }),
212
+ children: (0, _utils.getMessage)('search')
213
+ }
215
214
  }]
216
215
  }]
217
216
  }])
@@ -27,9 +27,11 @@ var _useAutoSubmit = _interopRequireDefault(require("./useAutoSubmit"));
27
27
 
28
28
  var _useInitialRequest = _interopRequireDefault(require("./useInitialRequest"));
29
29
 
30
+ var _validate = _interopRequireDefault(require("../locales/validate"));
31
+
30
32
  require("./index.scss");
31
33
 
32
- var _excluded = ["form", "initialValues", "initialRequest", "schema", "scope", "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", "className"];
33
35
 
34
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
37
 
@@ -47,12 +49,14 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
47
49
 
48
50
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
49
51
 
52
+ (0, _core.registerValidateLocale)(_validate.default);
50
53
  var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
51
54
  var outerForm = _ref.form,
52
55
  initialValues = _ref.initialValues,
53
56
  initialRequest = _ref.initialRequest,
54
57
  schema = _ref.schema,
55
58
  scope = _ref.scope,
59
+ context = _ref.context,
56
60
  components = _ref.components,
57
61
  children = _ref.children,
58
62
  layout = _ref.layout,
@@ -68,11 +72,18 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
68
72
  otherProps = _objectWithoutProperties(_ref, _excluded);
69
73
 
70
74
  var form = (0, _react.useMemo)(function () {
71
- return outerForm || (0, _core.createForm)();
75
+ return outerForm || (0, _core.createForm)({
76
+ validateFirst: true
77
+ });
72
78
  }, []);
73
79
  var prefixCls = (0, _utils.usePrefixCls)('', {
74
80
  prefix: 'teamix-pro-form'
75
81
  });
82
+ var mergedScope = (0, _react.useMemo)(function () {
83
+ return _objectSpread(_objectSpread({}, scope), {}, {
84
+ context: context
85
+ });
86
+ }, [scope, context]);
76
87
  var onAutoSubmit = (0, _useAutoSubmit.default)(onSubmit);
77
88
  var getTeamixLayout = (0, _react.useMemo)(function () {
78
89
  return breakpoints ? {
@@ -110,17 +121,12 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
110
121
  form.setInitialValues(values);
111
122
  });
112
123
  }
124
+ }, []); // 配置国际化
125
+
126
+ (0, _react.useEffect)(function () {
127
+ (0, _core.setValidateLanguage)((0, _utils.getLanguage)() || 'zh-cn');
113
128
  }, []);
114
- return outerForm === false ?
115
- /*#__PURE__*/
116
- // 特殊表单,无需渲染form实例,例如FormDialog等
117
- _react.default.createElement(_formily.FormLayout, _objectSpread(_objectSpread({
118
- className: (0, _classnames.default)(prefixCls, className)
119
- }, otherProps), getTeamixLayout), /*#__PURE__*/_react.default.createElement(_SchemaForm.default, {
120
- schema: schema,
121
- scope: scope,
122
- components: components
123
- }), children) : /*#__PURE__*/_react.default.createElement(_formily.Form, _objectSpread(_objectSpread(_objectSpread({
129
+ return /*#__PURE__*/_react.default.createElement(_formily.Form, _objectSpread(_objectSpread(_objectSpread({
124
130
  className: (0, _classnames.default)(prefixCls, className)
125
131
  }, otherProps), getTeamixLayout), {}, {
126
132
  form: form,
@@ -128,9 +134,30 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
128
134
  onAutoSubmitFailed: onSubmitFailed
129
135
  }), /*#__PURE__*/_react.default.createElement(_SchemaForm.default, {
130
136
  schema: schema,
131
- scope: scope,
137
+ scope: mergedScope,
132
138
  components: components
133
- }), children);
139
+ }), children); // return outerForm === false ? ( // 特殊表单,无需渲染form实例,例如FormDialog等
140
+ // <FormLayout
141
+ // className={cls(prefixCls, className)}
142
+ // {...otherProps}
143
+ // {...getTeamixLayout}
144
+ // >
145
+ // <SchemaForm schema={schema} scope={scope} components={components} />
146
+ // {children}
147
+ // </FormLayout>
148
+ // ) : (
149
+ // <Form
150
+ // className={cls(prefixCls, className)}
151
+ // {...otherProps}
152
+ // {...getTeamixLayout}
153
+ // form={form}
154
+ // onAutoSubmit={onAutoSubmit}
155
+ // onAutoSubmitFailed={onSubmitFailed}
156
+ // >
157
+ // <SchemaForm schema={schema} scope={scope} components={components} />
158
+ // {children}
159
+ // </Form>
160
+ // );
134
161
  });
135
162
  ProForm.defaultProps = {
136
163
  colon: false,
@@ -244,7 +244,6 @@
244
244
  right: 0;
245
245
  width: 100% !important;
246
246
  height: 56px !important;
247
- padding-left: 24px;
248
247
  background: var(--color-fill1-1, #fff) !important;
249
248
  box-shadow: 0 -1px 5px 0 rgba(38, 38, 38, 0.14);
250
249
  z-index: 2;
@@ -1,6 +1,6 @@
1
1
  import { CommonRequestConfig } from '@teamix/utils';
2
2
  interface IUseAutoSubmit {
3
- (onSubmit?: ((values: any) => any) | CommonRequestConfig): any;
3
+ (onSubmit?: ((values: any) => any) | CommonRequestConfig, context?: any): any;
4
4
  }
5
5
  declare const useAutoSubmit: IUseAutoSubmit;
6
6
  export default useAutoSubmit;
@@ -15,7 +15,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
15
15
 
16
16
  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; }
17
17
 
18
- var useAutoSubmit = function useAutoSubmit(onSubmit) {
18
+ var useAutoSubmit = function useAutoSubmit(onSubmit, context) {
19
19
  if ((0, _utils.isObj)(onSubmit)) {
20
20
  var history = (0, _reactRouterDom.useHistory)();
21
21
  var submitConfig = onSubmit;
@@ -24,9 +24,9 @@ var useAutoSubmit = function useAutoSubmit(onSubmit) {
24
24
  method: 'POST'
25
25
  }, submitConfig), {}, {
26
26
  params: _objectSpread(_objectSpread({}, values), submitConfig.params || {})
27
- }), {
27
+ }), _objectSpread({
28
28
  fields: values
29
- }, history);
29
+ }, context), history);
30
30
  };
31
31
  }
32
32
 
@@ -1,6 +1,6 @@
1
1
  import { CommonRequestConfig } from '@teamix/utils';
2
2
  interface IUseInitialRequest {
3
- (initialRequest: CommonRequestConfig): Promise<any>;
3
+ (initialRequest: CommonRequestConfig, context?: any): Promise<any>;
4
4
  }
5
5
  declare const useInitialRequest: IUseInitialRequest;
6
6
  export default useInitialRequest;
@@ -13,10 +13,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
13
13
 
14
14
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
15
 
16
- var useInitialRequest = function useInitialRequest(initialRequest) {
16
+ var useInitialRequest = function useInitialRequest(initialRequest, context) {
17
17
  return (0, _utils.doCommonRequest)(_objectSpread({
18
18
  method: 'GET'
19
- }, initialRequest));
19
+ }, initialRequest), context);
20
20
  };
21
21
 
22
22
  var _default = useInitialRequest;
@@ -21,7 +21,7 @@ var initializeDataSource = function initializeDataSource(dataSource) {
21
21
  var requestScopeName = (0, _utils2.getRandomName)('$request');
22
22
  var dataSourceScopeName = (0, _utils2.getRandomName)('$dataSource');
23
23
  return {
24
- reactions: ["{{".concat(dataSourceScopeName, "(").concat(requestScopeName, ",").concat(requestConfig.onComplete, ")}}")],
24
+ reactions: ["{{".concat(dataSourceScopeName, "(").concat(requestScopeName, ",").concat(requestConfig.onComplete, ",context)}}")],
25
25
  scope: (_scope = {}, _defineProperty(_scope, requestScopeName, (0, _reactions.$request)(requestConfig)), _defineProperty(_scope, dataSourceScopeName, _reactions.$dataSource), _scope)
26
26
  };
27
27
  }
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
8
+ var _utils = require("@teamix/utils");
9
+
7
10
  var _excluded = ["sticky", "container", "onAffix"];
8
11
 
9
12
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
@@ -17,8 +20,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
17
20
  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; }
18
21
 
19
22
  var buttonTextMap = {
20
- Submit: '提交',
21
- Reset: '重置'
23
+ Submit: (0, _utils.getMessage)('submit'),
24
+ Reset: (0, _utils.getMessage)('reset')
22
25
  };
23
26
 
24
27
  var initializeButton = function initializeButton(item) {
@@ -13,10 +13,13 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
13
13
 
14
14
  var initializeRequest = function initializeRequest(requestConfig) {
15
15
  if (requestConfig) {
16
+ var _scope;
17
+
16
18
  var requestScopeName = (0, _utils.getRandomName)('$request');
19
+ var contextScopeName = (0, _utils.getRandomName)('$context');
17
20
  return {
18
- reactions: ["{{".concat(requestScopeName, "}}")],
19
- scope: _defineProperty({}, requestScopeName, (0, _reactions.$request)(requestConfig))
21
+ reactions: ["{{".concat(contextScopeName, "(").concat(requestScopeName, ",").concat(requestConfig.onComplete, ",context)}}")],
22
+ scope: (_scope = {}, _defineProperty(_scope, requestScopeName, (0, _reactions.$request)(requestConfig)), _defineProperty(_scope, contextScopeName, _reactions.$context), _scope)
20
23
  };
21
24
  }
22
25
 
@@ -41,7 +41,7 @@ var initializeRules = function initializeRules(rules) {
41
41
  var validatorScopeName = (0, _utils2.getRandomName)('$validator');
42
42
  return {
43
43
  rules: _objectSpread(_objectSpread({}, rule), {}, {
44
- validator: "{{".concat(validatorScopeName, "(").concat(requestScopeName, ",").concat(validator.onComplete, ")}}")
44
+ validator: "{{".concat(validatorScopeName, "(").concat(requestScopeName, ",").concat(validator.onComplete, ",context)}}")
45
45
  }),
46
46
  scope: (_scope = {}, _defineProperty(_scope, requestScopeName, (0, _reactions.$request)(validator)), _defineProperty(_scope, validatorScopeName, _reactions2.$validator), _scope)
47
47
  };
@@ -1,5 +1,6 @@
1
1
  import type { ProFormRequestConfig } from '../typing';
2
- declare const $request: (requestConfig: ProFormRequestConfig) => (field: any) => Promise<unknown>;
3
- declare const $validator: (services: any, onComplete?: any) => (value: any, rules: any, { field }: any) => any;
4
- declare const $dataSource: (services: any, onComplete?: any) => (field: any) => any;
5
- export { $request, $dataSource, $validator };
2
+ declare const $request: (requestConfig: ProFormRequestConfig) => (field: any, context: any) => Promise<unknown>;
3
+ declare const $context: (services: any, onComplete: any, context: any) => (field: any) => any;
4
+ declare const $validator: (services: any, onComplete: any, context: any) => (value: any, rules: any, { field }: any) => any;
5
+ declare const $dataSource: (services: any, onComplete: any, context: any) => (field: any) => any;
6
+ export { $request, $context, $dataSource, $validator };