iglooform 2.5.38 → 2.5.40

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.
@@ -185,9 +185,33 @@ var AddableSection = function AddableSection(_ref) {
185
185
  children: _jsx(_Row, {
186
186
  gutter: [32, preview ? 16 : 24],
187
187
  children: elements.map(function (child, index) {
188
+ var _child = _objectSpread({}, child);
189
+
190
+ if (Array.isArray(child.asserts)) {
191
+ _child.asserts = child.asserts.map(function (assert) {
192
+ return _objectSpread(_objectSpread({}, assert), {}, {
193
+ field: calcNamePath(parentName, assert.field)
194
+ });
195
+ });
196
+ }
197
+
198
+ if (Array.isArray(child.requiredAsserts)) {
199
+ _child.requiredAsserts = child.requiredAsserts.map(function (assert) {
200
+ return _objectSpread(_objectSpread({}, assert), {}, {
201
+ field: calcNamePath(parentName, assert.field)
202
+ });
203
+ });
204
+ }
205
+
206
+ if (Array.isArray(child.dependencies)) {
207
+ _child.dependencies = child.dependencies.map(function (path) {
208
+ return calcNamePath(parentName, path);
209
+ });
210
+ }
211
+
188
212
  return _jsx(Element, {
189
213
  parentName: parentName,
190
- config: child,
214
+ config: _child,
191
215
  disabled: elementProps.disabled || disabled,
192
216
  preview: preview,
193
217
  setShowStepButton: setShowStepButton
@@ -64,7 +64,7 @@ var Element = function Element(_ref) {
64
64
  var type = config.type,
65
65
  label = config.label,
66
66
  previewLabel = config.previewLabel;
67
- invariant(!(config.selectValue || config.copyValue || config.initialValue) || config.name, 'Form item with selectValue/copyValue/initialValue should have a name.');
67
+ invariant(!(config.selectValue || config.copyValue || config.initialValue) || config.name !== undefined, 'Form item with selectValue/copyValue/initialValue should have a name.');
68
68
 
69
69
  var _useContext = useContext(FormContext),
70
70
  form = _useContext.form,
@@ -66,7 +66,7 @@ var useComponent = function useComponent(config) {
66
66
  return {
67
67
  Component: Component,
68
68
  formItemProps: formItemProps,
69
- withoutForm: type === 'Divider' || Boolean(config.withoutForm) || !config.name
69
+ withoutForm: type === 'Divider' || Boolean(config.withoutForm) || config.name === undefined
70
70
  };
71
71
  }, [config.type]);
72
72
  };
@@ -202,10 +202,34 @@ var AddableSection = function AddableSection(props) {
202
202
  return children.map(function (c, index) {
203
203
  var _c$type;
204
204
 
205
+ var _child = _objectSpread({}, c.props);
206
+
207
+ if (Array.isArray(_child.asserts)) {
208
+ _child.asserts = _child.asserts.map(function (assert) {
209
+ return _objectSpread(_objectSpread({}, assert), {}, {
210
+ field: calcNamePath(parentName, assert.field)
211
+ });
212
+ });
213
+ }
214
+
215
+ if (Array.isArray(_child.requiredAsserts)) {
216
+ _child.requiredAsserts = _child.requiredAsserts.map(function (assert) {
217
+ return _objectSpread(_objectSpread({}, assert), {}, {
218
+ field: calcNamePath(parentName, assert.field)
219
+ });
220
+ });
221
+ }
222
+
223
+ if (Array.isArray(_child.dependencies)) {
224
+ _child.dependencies = _child.dependencies.map(function (path) {
225
+ return calcNamePath(parentName, path);
226
+ });
227
+ }
228
+
205
229
  if (['Igloo_Free_Form_Item', 'Igloo_Free_Form_Section', 'Igloo_Free_Form_AddableSection'].includes(c === null || c === void 0 ? void 0 : (_c$type = c.type) === null || _c$type === void 0 ? void 0 : _c$type.displayName)) {
206
230
  return /*#__PURE__*/cloneElement(c, _objectSpread(_objectSpread({
207
231
  key: index
208
- }, c.props), {}, {
232
+ }, _child), {}, {
209
233
  parentName: parentName,
210
234
  setShowStepButton: setShowStepButton,
211
235
  preview: preview,
@@ -217,12 +241,41 @@ var AddableSection = function AddableSection(props) {
217
241
  });
218
242
  }
219
243
 
220
- return /*#__PURE__*/isValidElement(children) ? /*#__PURE__*/cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, {
221
- parentName: parentName,
222
- setShowStepButton: setShowStepButton,
223
- preview: preview,
224
- disabledFromParent: elementProps.disabled
225
- })) : children;
244
+ if ( /*#__PURE__*/isValidElement(children)) {
245
+ var _child = _objectSpread({}, children.props);
246
+
247
+ if (Array.isArray(_child.asserts)) {
248
+ _child.asserts = _child.asserts.map(function (assert) {
249
+ return _objectSpread(_objectSpread({}, assert), {}, {
250
+ field: calcNamePath(parentName, assert.field)
251
+ });
252
+ });
253
+ }
254
+
255
+ if (Array.isArray(_child.requiredAsserts)) {
256
+ _child.requiredAsserts = _child.requiredAsserts.map(function (assert) {
257
+ return _objectSpread(_objectSpread({}, assert), {}, {
258
+ field: calcNamePath(parentName, assert.field)
259
+ });
260
+ });
261
+ }
262
+
263
+ if (Array.isArray(_child.dependencies)) {
264
+ _child.dependencies = _child.dependencies.map(function (path) {
265
+ return calcNamePath(parentName, path);
266
+ });
267
+ }
268
+
269
+ return /*#__PURE__*/cloneElement(children, _objectSpread(_objectSpread({}, _child), {}, {
270
+ // @ts-ignore
271
+ parentName: parentName,
272
+ setShowStepButton: setShowStepButton,
273
+ preview: preview,
274
+ disabledFromParent: elementProps.disabled
275
+ }));
276
+ }
277
+
278
+ return children;
226
279
  };
227
280
 
228
281
  if (!display) {
package/es/table/index.js CHANGED
@@ -83,6 +83,7 @@ var getDropDownMenu = function getDropDownMenu(allButtons, rowData, actionButton
83
83
  return _jsx(Button, {
84
84
  type: "text",
85
85
  onClick: function onClick(e) {
86
+ e.stopPropagation();
86
87
  item.onClick(rowData);
87
88
  setActionListVisible({
88
89
  type: actionIndex,
@@ -162,7 +162,7 @@ export var calcFormItemProps = function calcFormItemProps(config, extraProps, fo
162
162
  relativeRangeEnd = config.relativeRangeEnd,
163
163
  rest = _objectWithoutProperties(config, _excluded);
164
164
 
165
- invariant(nameProp || type === 'Divider' || type === 'Section' || type === 'Typography' || !type, "name property is required for form item config (type: ".concat(type, ")"));
165
+ invariant(nameProp !== undefined || type === 'Divider' || type === 'Section' || type === 'Typography' || !type, "name property is required for form item config (type: ".concat(type, ")"));
166
166
  invariant(!previewFormater || typeof previewFormater === 'function', 'previewFormater property should be a function');
167
167
  invariant(!shouldRender || typeof shouldRender === 'function', 'shouldRender property should be a function');
168
168
 
@@ -210,9 +210,33 @@ var AddableSection = function AddableSection(_ref) {
210
210
  children: (0, _jsxRuntime.jsx)(_row.default, {
211
211
  gutter: [32, preview ? 16 : 24],
212
212
  children: elements.map(function (child, index) {
213
+ var _child = _objectSpread({}, child);
214
+
215
+ if (Array.isArray(child.asserts)) {
216
+ _child.asserts = child.asserts.map(function (assert) {
217
+ return _objectSpread(_objectSpread({}, assert), {}, {
218
+ field: (0, _formUtils.calcNamePath)(parentName, assert.field)
219
+ });
220
+ });
221
+ }
222
+
223
+ if (Array.isArray(child.requiredAsserts)) {
224
+ _child.requiredAsserts = child.requiredAsserts.map(function (assert) {
225
+ return _objectSpread(_objectSpread({}, assert), {}, {
226
+ field: (0, _formUtils.calcNamePath)(parentName, assert.field)
227
+ });
228
+ });
229
+ }
230
+
231
+ if (Array.isArray(child.dependencies)) {
232
+ _child.dependencies = child.dependencies.map(function (path) {
233
+ return (0, _formUtils.calcNamePath)(parentName, path);
234
+ });
235
+ }
236
+
213
237
  return (0, _jsxRuntime.jsx)(_element.default, {
214
238
  parentName: parentName,
215
- config: child,
239
+ config: _child,
216
240
  disabled: elementProps.disabled || disabled,
217
241
  preview: preview,
218
242
  setShowStepButton: setShowStepButton
@@ -93,7 +93,7 @@ var Element = function Element(_ref) {
93
93
  var type = config.type,
94
94
  label = config.label,
95
95
  previewLabel = config.previewLabel;
96
- (0, _invariant.default)(!(config.selectValue || config.copyValue || config.initialValue) || config.name, 'Form item with selectValue/copyValue/initialValue should have a name.');
96
+ (0, _invariant.default)(!(config.selectValue || config.copyValue || config.initialValue) || config.name !== undefined, 'Form item with selectValue/copyValue/initialValue should have a name.');
97
97
 
98
98
  var _useContext = (0, _react.useContext)(_formContext.default),
99
99
  form = _useContext.form,
@@ -96,7 +96,7 @@ var useComponent = function useComponent(config) {
96
96
  return {
97
97
  Component: Component,
98
98
  formItemProps: formItemProps,
99
- withoutForm: type === 'Divider' || Boolean(config.withoutForm) || !config.name
99
+ withoutForm: type === 'Divider' || Boolean(config.withoutForm) || config.name === undefined
100
100
  };
101
101
  }, [config.type]);
102
102
  };
@@ -226,10 +226,34 @@ var AddableSection = function AddableSection(props) {
226
226
  return children.map(function (c, index) {
227
227
  var _c$type;
228
228
 
229
+ var _child = _objectSpread({}, c.props);
230
+
231
+ if (Array.isArray(_child.asserts)) {
232
+ _child.asserts = _child.asserts.map(function (assert) {
233
+ return _objectSpread(_objectSpread({}, assert), {}, {
234
+ field: (0, _formUtils.calcNamePath)(parentName, assert.field)
235
+ });
236
+ });
237
+ }
238
+
239
+ if (Array.isArray(_child.requiredAsserts)) {
240
+ _child.requiredAsserts = _child.requiredAsserts.map(function (assert) {
241
+ return _objectSpread(_objectSpread({}, assert), {}, {
242
+ field: (0, _formUtils.calcNamePath)(parentName, assert.field)
243
+ });
244
+ });
245
+ }
246
+
247
+ if (Array.isArray(_child.dependencies)) {
248
+ _child.dependencies = _child.dependencies.map(function (path) {
249
+ return (0, _formUtils.calcNamePath)(parentName, path);
250
+ });
251
+ }
252
+
229
253
  if (['Igloo_Free_Form_Item', 'Igloo_Free_Form_Section', 'Igloo_Free_Form_AddableSection'].includes(c === null || c === void 0 ? void 0 : (_c$type = c.type) === null || _c$type === void 0 ? void 0 : _c$type.displayName)) {
230
254
  return /*#__PURE__*/(0, _react.cloneElement)(c, _objectSpread(_objectSpread({
231
255
  key: index
232
- }, c.props), {}, {
256
+ }, _child), {}, {
233
257
  parentName: parentName,
234
258
  setShowStepButton: setShowStepButton,
235
259
  preview: preview,
@@ -241,12 +265,41 @@ var AddableSection = function AddableSection(props) {
241
265
  });
242
266
  }
243
267
 
244
- return /*#__PURE__*/(0, _react.isValidElement)(children) ? /*#__PURE__*/(0, _react.cloneElement)(children, _objectSpread(_objectSpread({}, children.props), {}, {
245
- parentName: parentName,
246
- setShowStepButton: setShowStepButton,
247
- preview: preview,
248
- disabledFromParent: elementProps.disabled
249
- })) : children;
268
+ if ( /*#__PURE__*/(0, _react.isValidElement)(children)) {
269
+ var _child = _objectSpread({}, children.props);
270
+
271
+ if (Array.isArray(_child.asserts)) {
272
+ _child.asserts = _child.asserts.map(function (assert) {
273
+ return _objectSpread(_objectSpread({}, assert), {}, {
274
+ field: (0, _formUtils.calcNamePath)(parentName, assert.field)
275
+ });
276
+ });
277
+ }
278
+
279
+ if (Array.isArray(_child.requiredAsserts)) {
280
+ _child.requiredAsserts = _child.requiredAsserts.map(function (assert) {
281
+ return _objectSpread(_objectSpread({}, assert), {}, {
282
+ field: (0, _formUtils.calcNamePath)(parentName, assert.field)
283
+ });
284
+ });
285
+ }
286
+
287
+ if (Array.isArray(_child.dependencies)) {
288
+ _child.dependencies = _child.dependencies.map(function (path) {
289
+ return (0, _formUtils.calcNamePath)(parentName, path);
290
+ });
291
+ }
292
+
293
+ return /*#__PURE__*/(0, _react.cloneElement)(children, _objectSpread(_objectSpread({}, _child), {}, {
294
+ // @ts-ignore
295
+ parentName: parentName,
296
+ setShowStepButton: setShowStepButton,
297
+ preview: preview,
298
+ disabledFromParent: elementProps.disabled
299
+ }));
300
+ }
301
+
302
+ return children;
250
303
  };
251
304
 
252
305
  if (!display) {
@@ -122,6 +122,7 @@ var getDropDownMenu = function getDropDownMenu(allButtons, rowData, actionButton
122
122
  return (0, _jsxRuntime.jsx)(_button.default, {
123
123
  type: "text",
124
124
  onClick: function onClick(e) {
125
+ e.stopPropagation();
125
126
  item.onClick(rowData);
126
127
  setActionListVisible({
127
128
  type: actionIndex,
@@ -181,7 +181,7 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
181
181
  relativeRangeEnd = config.relativeRangeEnd,
182
182
  rest = _objectWithoutProperties(config, _excluded);
183
183
 
184
- (0, _invariant.default)(nameProp || type === 'Divider' || type === 'Section' || type === 'Typography' || !type, "name property is required for form item config (type: ".concat(type, ")"));
184
+ (0, _invariant.default)(nameProp !== undefined || type === 'Divider' || type === 'Section' || type === 'Typography' || !type, "name property is required for form item config (type: ".concat(type, ")"));
185
185
  (0, _invariant.default)(!previewFormater || typeof previewFormater === 'function', 'previewFormater property should be a function');
186
186
  (0, _invariant.default)(!shouldRender || typeof shouldRender === 'function', 'shouldRender property should be a function');
187
187
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "2.5.38",
3
+ "version": "2.5.40",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",