@plasmicpkgs/antd5 0.0.124 → 0.0.126

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 (70) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/antd.esm.js +339 -233
  3. package/dist/antd.esm.js.map +1 -1
  4. package/dist/index.js +339 -233
  5. package/dist/index.js.map +1 -1
  6. package/dist/registerForm.d.ts +18 -15
  7. package/dist/utils.d.ts +2 -1
  8. package/package.json +4 -4
  9. package/skinny/registerAvatar.cjs.js +1 -1
  10. package/skinny/registerAvatar.esm.js +1 -1
  11. package/skinny/registerButton.cjs.js +1 -1
  12. package/skinny/registerButton.esm.js +1 -1
  13. package/skinny/registerCheckbox.cjs.js +1 -1
  14. package/skinny/registerCheckbox.esm.js +1 -1
  15. package/skinny/registerCollapse.cjs.js +1 -1
  16. package/skinny/registerCollapse.esm.js +1 -1
  17. package/skinny/registerColorPicker.cjs.js +1 -1
  18. package/skinny/registerColorPicker.esm.js +1 -1
  19. package/skinny/registerConfigProvider.cjs.js +1 -1
  20. package/skinny/registerConfigProvider.esm.js +1 -1
  21. package/skinny/registerDatePicker.cjs.js +1 -1
  22. package/skinny/registerDatePicker.esm.js +1 -1
  23. package/skinny/registerDrawer.cjs.js +1 -1
  24. package/skinny/registerDrawer.esm.js +1 -1
  25. package/skinny/registerDropdown.cjs.js +1 -1
  26. package/skinny/registerDropdown.esm.js +1 -1
  27. package/skinny/registerForm.cjs.js +304 -230
  28. package/skinny/registerForm.cjs.js.map +1 -1
  29. package/skinny/registerForm.d.ts +18 -15
  30. package/skinny/registerForm.esm.js +304 -230
  31. package/skinny/registerForm.esm.js.map +1 -1
  32. package/skinny/registerInput.cjs.js +1 -1
  33. package/skinny/registerInput.esm.js +1 -1
  34. package/skinny/registerMenu.cjs.js +1 -1
  35. package/skinny/registerMenu.esm.js +1 -1
  36. package/skinny/registerModal.cjs.js +1 -1
  37. package/skinny/registerModal.esm.js +1 -1
  38. package/skinny/registerPopover.cjs.js +1 -1
  39. package/skinny/registerPopover.esm.js +1 -1
  40. package/skinny/registerRadio.cjs.js +1 -1
  41. package/skinny/registerRadio.esm.js +1 -1
  42. package/skinny/registerRate.cjs.js +1 -1
  43. package/skinny/registerRate.esm.js +1 -1
  44. package/skinny/{registerSelect-3273fe93.esm.js → registerSelect-d2c8e1c0.esm.js} +2 -2
  45. package/skinny/{registerSelect-3273fe93.esm.js.map → registerSelect-d2c8e1c0.esm.js.map} +1 -1
  46. package/skinny/{registerSelect-f0e24345.cjs.js → registerSelect-dfdd1699.cjs.js} +2 -2
  47. package/skinny/{registerSelect-f0e24345.cjs.js.map → registerSelect-dfdd1699.cjs.js.map} +1 -1
  48. package/skinny/registerSelect.cjs.js +2 -2
  49. package/skinny/registerSelect.esm.js +2 -2
  50. package/skinny/registerSteps.cjs.js +1 -1
  51. package/skinny/registerSteps.esm.js +1 -1
  52. package/skinny/registerSwitch.cjs.js +1 -1
  53. package/skinny/registerSwitch.esm.js +1 -1
  54. package/skinny/registerTable.cjs.js +1 -1
  55. package/skinny/registerTable.esm.js +1 -1
  56. package/skinny/registerTabs.cjs.js +1 -1
  57. package/skinny/registerTabs.esm.js +1 -1
  58. package/skinny/registerTooltip.cjs.js +1 -1
  59. package/skinny/registerTooltip.esm.js +1 -1
  60. package/skinny/registerTree.cjs.js +1 -1
  61. package/skinny/registerTree.esm.js +1 -1
  62. package/skinny/registerUpload.cjs.js +1 -1
  63. package/skinny/registerUpload.esm.js +1 -1
  64. package/skinny/{utils-c2d6f0e8.cjs.js → utils-174b9d45.cjs.js} +39 -6
  65. package/skinny/utils-174b9d45.cjs.js.map +1 -0
  66. package/skinny/{utils-040cbe4d.esm.js → utils-7d8f2418.esm.js} +39 -7
  67. package/skinny/utils-7d8f2418.esm.js.map +1 -0
  68. package/skinny/utils.d.ts +2 -1
  69. package/skinny/utils-040cbe4d.esm.js.map +0 -1
  70. package/skinny/utils-c2d6f0e8.cjs.js.map +0 -1
@@ -2,13 +2,13 @@ import { usePlasmicCanvasContext, DataProvider, repeatedElement } from '@plasmic
2
2
  import { Form, Input, InputNumber, Radio } from 'antd';
3
3
  import equal from 'fast-deep-equal';
4
4
  import React, { isValidElement, cloneElement } from 'react';
5
- import { A as AntdSelect, r as reactNodeToString, m as mergeProps, s as selectComponentName } from './registerSelect-3273fe93.esm.js';
5
+ import { A as AntdSelect, r as reactNodeToString, m as mergeProps, s as selectComponentName } from './registerSelect-d2c8e1c0.esm.js';
6
6
  import { buttonComponentName } from './registerButton.esm.js';
7
7
  import { AntdCheckbox, checkboxComponentName } from './registerCheckbox.esm.js';
8
8
  import { inputComponentName, textAreaComponentName, inputNumberComponentName, passwordComponentName } from './registerInput.esm.js';
9
9
  import { AntdRadioGroup, radioGroupComponentName } from './registerRadio.esm.js';
10
10
  import { switchComponentName } from './registerSwitch.esm.js';
11
- import { E as ErrorBoundary, o as omit, s as setFieldsToUndefined, u as usePrevious, e as ensureArray, g as get, r as registerComponentHelper, a as arrayEq } from './utils-040cbe4d.esm.js';
11
+ import { E as ErrorBoundary, o as omit, s as setFieldsToUndefined, p as pick, u as usePrevious, e as ensureArray, g as get, r as registerComponentHelper, a as arrayEq } from './utils-7d8f2418.esm.js';
12
12
  import { normalizeData, deriveFieldConfigs, usePlasmicDataOp } from '@plasmicapp/data-sources';
13
13
  import { AntdDatePicker } from './registerDatePicker.esm.js';
14
14
  import 'classnames';
@@ -74,20 +74,22 @@ const InternalFormInstanceContext = React.createContext(void 0);
74
74
  const FormLayoutContext = React.createContext(void 0);
75
75
  const Internal = React.forwardRef(
76
76
  (props, ref) => {
77
- var _b, _c, _d, _e, _f;
77
+ var _b, _c, _d, _e;
78
78
  const [form] = Form.useForm();
79
79
  const values = form.getFieldsValue(true);
80
80
  const lastValue = React.useRef(values);
81
81
  const _a = props, {
82
82
  extendedOnValuesChange,
83
83
  forceRemount,
84
- setRegisteredFields,
85
- registeredFields
84
+ formLayout,
85
+ internalFieldCtx,
86
+ setInternalFieldCtx
86
87
  } = _a, rest = __objRest(_a, [
87
88
  "extendedOnValuesChange",
88
89
  "forceRemount",
89
- "setRegisteredFields",
90
- "registeredFields"
90
+ "formLayout",
91
+ "internalFieldCtx",
92
+ "setInternalFieldCtx"
91
93
  ]);
92
94
  let childrenNode;
93
95
  if (props.mode !== "simplified") {
@@ -130,16 +132,6 @@ const Internal = React.forwardRef(
130
132
  React.useEffect(() => {
131
133
  fireOnValuesChange();
132
134
  }, []);
133
- const formLayout = React.useMemo(
134
- () => {
135
- var _a2;
136
- return {
137
- layout: props.layout,
138
- labelSpan: (_a2 = props.labelCol) == null ? void 0 : _a2.span
139
- };
140
- },
141
- [props.layout, (_c = props.labelCol) == null ? void 0 : _c.span]
142
- );
143
135
  React.useImperativeHandle(ref, () => ({
144
136
  formInstance: form,
145
137
  setFieldsValue: (newValues) => {
@@ -168,12 +160,28 @@ const Internal = React.forwardRef(
168
160
  extendedOnValuesChange == null ? void 0 : extendedOnValuesChange(form.getFieldsValue(true));
169
161
  }
170
162
  }));
171
- const registerField = React.useCallback((fieldEntity) => {
172
- setRegisteredFields((f) => [...f, fieldEntity]);
173
- return () => {
174
- setRegisteredFields((f) => f.filter((ent) => ent !== fieldEntity));
175
- };
176
- }, []);
163
+ const registerField = React.useCallback(
164
+ (fieldEntity) => {
165
+ setInternalFieldCtx((ctx) => ({
166
+ registeredFields: [...ctx.registeredFields, fieldEntity],
167
+ preservedRegisteredFields: [
168
+ ...ctx.preservedRegisteredFields,
169
+ fieldEntity
170
+ ]
171
+ }));
172
+ return () => {
173
+ setInternalFieldCtx((ctx) => ({
174
+ registeredFields: ctx.registeredFields.filter(
175
+ (ent) => ent !== fieldEntity
176
+ ),
177
+ preservedRegisteredFields: ctx.preservedRegisteredFields.filter(
178
+ (ent) => ent !== fieldEntity || fieldEntity.preserve
179
+ )
180
+ }));
181
+ };
182
+ },
183
+ [setInternalFieldCtx]
184
+ );
177
185
  return /* @__PURE__ */ React.createElement(
178
186
  InternalFormInstanceContext.Provider,
179
187
  {
@@ -182,8 +190,8 @@ const Internal = React.forwardRef(
182
190
  fireOnValuesChange,
183
191
  forceRemount,
184
192
  registerField,
185
- registeredFields,
186
- initialValues: (_d = props.initialValues) != null ? _d : {}
193
+ internalFieldCtx,
194
+ initialValues: (_c = props.initialValues) != null ? _c : {}
187
195
  }
188
196
  },
189
197
  /* @__PURE__ */ React.createElement(FormLayoutContext.Provider, { value: formLayout }, /* @__PURE__ */ React.createElement(
@@ -197,11 +205,19 @@ const Internal = React.forwardRef(
197
205
  },
198
206
  onFinish: () => {
199
207
  var _a2;
200
- (_a2 = props.onFinish) == null ? void 0 : _a2.call(props, form.getFieldsValue(true));
208
+ (_a2 = props.onFinish) == null ? void 0 : _a2.call(
209
+ props,
210
+ pick(
211
+ form.getFieldsValue(true),
212
+ ...internalFieldCtx.preservedRegisteredFields.map(
213
+ (field) => field.fullPath
214
+ )
215
+ )
216
+ );
201
217
  },
202
218
  form,
203
- labelCol: ((_e = props.labelCol) == null ? void 0 : _e.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.labelCol,
204
- wrapperCol: ((_f = props.wrapperCol) == null ? void 0 : _f.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.wrapperCol
219
+ labelCol: ((_d = props.labelCol) == null ? void 0 : _d.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.labelCol,
220
+ wrapperCol: ((_e = props.wrapperCol) == null ? void 0 : _e.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.wrapperCol
205
221
  }),
206
222
  /* @__PURE__ */ React.createElement("style", null, `
207
223
  .ant-form-item-explain + div, .ant-form-item-margin-offset {
@@ -213,17 +229,16 @@ const Internal = React.forwardRef(
213
229
  );
214
230
  }
215
231
  );
216
- function useFormItemDefinitions(rawData, props, formRef, registeredFields) {
232
+ function useFormItemDefinitions(rawData, props, formRef, commonFormCtxData) {
217
233
  const { mode, dataFormItems, setControlContextData } = props;
218
234
  const formInstance = formRef == null ? void 0 : formRef.formInstance;
219
235
  return React.useMemo(() => {
220
236
  const data = rawData && normalizeData(rawData);
221
237
  const schema = data && (data == null ? void 0 : data.schema);
222
238
  if (mode !== "simplified" || !rawData || rawData.isLoading || rawData.error || !data || !schema || !data.data) {
223
- setControlContextData == null ? void 0 : setControlContextData({
224
- formInstance,
225
- registeredFields
226
- });
239
+ setControlContextData == null ? void 0 : setControlContextData(__spreadValues({
240
+ formInstance
241
+ }, commonFormCtxData));
227
242
  return void 0;
228
243
  }
229
244
  const row = data.data.length > 0 ? data.data[0] : void 0;
@@ -245,15 +260,21 @@ function useFormItemDefinitions(rawData, props, formRef, registeredFields) {
245
260
  });
246
261
  }
247
262
  );
248
- setControlContextData == null ? void 0 : setControlContextData({
263
+ setControlContextData == null ? void 0 : setControlContextData(__spreadValues({
249
264
  schema: data.schema,
250
265
  minimalFullLengthFields,
251
266
  mergedFields,
252
- formInstance,
253
- registeredFields
254
- });
267
+ formInstance
268
+ }, commonFormCtxData));
255
269
  return mergedFields;
256
- }, [mode, setControlContextData, dataFormItems, rawData, formInstance]);
270
+ }, [
271
+ mode,
272
+ setControlContextData,
273
+ dataFormItems,
274
+ rawData,
275
+ formInstance,
276
+ commonFormCtxData
277
+ ]);
257
278
  }
258
279
  const useRawData = (props) => {
259
280
  const rawData = usePlasmicDataOp(props.data);
@@ -261,6 +282,7 @@ const useRawData = (props) => {
261
282
  };
262
283
  const FormWrapper = React.forwardRef(
263
284
  (props, ref) => {
285
+ var _a;
264
286
  const [remountKey, setRemountKey] = React.useState(0);
265
287
  const forceRemount = React.useCallback(
266
288
  () => setRemountKey((k) => k + 1),
@@ -273,17 +295,37 @@ const FormWrapper = React.forwardRef(
273
295
  forceRemount();
274
296
  }
275
297
  }, [previousInitialValues, props.initialValues]);
276
- const [registeredFields, setRegisteredFields] = React.useState([]);
298
+ const [internalFieldCtx, setInternalFieldCtx] = React.useState({
299
+ registeredFields: [],
300
+ preservedRegisteredFields: []
301
+ });
277
302
  React.useImperativeHandle(
278
303
  ref,
279
304
  () => wrapperRef.current ? __spreadValues({}, wrapperRef.current) : {}
280
305
  );
306
+ const formLayout = React.useMemo(
307
+ () => {
308
+ var _a2;
309
+ return {
310
+ layout: props.layout,
311
+ labelSpan: (_a2 = props.labelCol) == null ? void 0 : _a2.span
312
+ };
313
+ },
314
+ [props.layout, (_a = props.labelCol) == null ? void 0 : _a.span]
315
+ );
316
+ const commonFormCtxData = React.useMemo(
317
+ () => ({
318
+ layout: formLayout,
319
+ internalFieldCtx
320
+ }),
321
+ [formLayout, internalFieldCtx]
322
+ );
281
323
  const rawData = useRawData(props);
282
324
  const formItemDefinitions = useFormItemDefinitions(
283
325
  rawData,
284
326
  props,
285
327
  wrapperRef.current,
286
- registeredFields
328
+ commonFormCtxData
287
329
  );
288
330
  React.useEffect(() => {
289
331
  if (rawData && !rawData.isLoading) {
@@ -296,7 +338,7 @@ const FormWrapper = React.forwardRef(
296
338
  forceRemount();
297
339
  }
298
340
  }, [props.data]);
299
- const _a = props, { dataFormItems, formItems, data } = _a, rest = __objRest(_a, ["dataFormItems", "formItems", "data"]);
341
+ const _b = props, { dataFormItems, formItems, data } = _b, rest = __objRest(_b, ["dataFormItems", "formItems", "data"]);
300
342
  const actualFormItems = props.mode === "simplified" && formItemDefinitions ? formItemDefinitions : data ? dataFormItems : formItems;
301
343
  const previousFormItems = React.useRef([]);
302
344
  React.useEffect(() => {
@@ -315,8 +357,9 @@ const FormWrapper = React.forwardRef(
315
357
  key: remountKey
316
358
  }, rest), {
317
359
  forceRemount,
318
- setRegisteredFields,
319
- registeredFields,
360
+ formLayout,
361
+ internalFieldCtx,
362
+ setInternalFieldCtx,
320
363
  formItems: rawData && rawData.isLoading ? previousFormItems.current : actualFormItems,
321
364
  ref: wrapperRef,
322
365
  style: isSchemaForm && isLoadingData ? {
@@ -789,7 +832,7 @@ function useFormInstanceMaybe() {
789
832
  return Form.useFormInstance();
790
833
  }
791
834
  function FormItemWrapper(props) {
792
- var _b;
835
+ var _b, _c, _d;
793
836
  const _a = props, {
794
837
  rules: plasmicRules,
795
838
  description,
@@ -813,6 +856,7 @@ function FormItemWrapper(props) {
813
856
  const fullFormItemName = useFormItemFullName(name);
814
857
  const pathCtx = React.useContext(PathContext);
815
858
  const fieldEntity = React.useRef({
859
+ preserve: (_b = props.preserve) != null ? _b : true,
816
860
  fullPath: pathCtx.fullPath,
817
861
  name
818
862
  }).current;
@@ -823,30 +867,26 @@ function FormItemWrapper(props) {
823
867
  ) : void 0;
824
868
  const layoutContext = React.useContext(FormLayoutContext);
825
869
  const inCanvas = !!usePlasmicCanvasContext();
870
+ const {
871
+ fireOnValuesChange,
872
+ forceRemount,
873
+ registerField,
874
+ initialValues,
875
+ internalFieldCtx
876
+ } = (_c = React.useContext(InternalFormInstanceContext)) != null ? _c : {};
826
877
  if (inCanvas) {
827
878
  const form = useFormInstanceMaybe();
828
879
  const prevPropValues = React.useRef({
829
880
  initialValue: props.initialValue,
830
881
  name: props.name
831
882
  });
832
- const fullPath = React.useContext(PathContext).fullPath;
833
- const internalFormCtx = React.useContext(InternalFormInstanceContext);
834
- const { fireOnValuesChange, forceRemount, registerField, initialValues } = internalFormCtx != null ? internalFormCtx : {};
835
- (_b = props.setControlContextData) == null ? void 0 : _b.call(props, {
836
- internalFormCtx,
883
+ (_d = props.setControlContextData) == null ? void 0 : _d.call(props, {
884
+ internalFieldCtx,
837
885
  formInstance: form,
838
- parentFormItemPath: fullPath
886
+ parentFormItemPath: pathCtx.fullPath,
887
+ layout: layoutContext
839
888
  });
840
889
  React.useEffect(() => {
841
- const unregister = registerField == null ? void 0 : registerField(fieldEntity);
842
- return () => unregister == null ? void 0 : unregister();
843
- }, []);
844
- React.useEffect(() => {
845
- fieldEntity.fullPath = [
846
- ...pathCtx.fullPath,
847
- ...props.name != null ? [props.name] : []
848
- ];
849
- fieldEntity.name = props.name;
850
890
  if (prevPropValues.current.name !== props.name) {
851
891
  forceRemount == null ? void 0 : forceRemount();
852
892
  }
@@ -856,8 +896,27 @@ function FormItemWrapper(props) {
856
896
  form == null ? void 0 : form.setFieldValue(fullFormItemName, props.initialValue);
857
897
  prevPropValues.current.initialValue = props.initialValue;
858
898
  fireOnValuesChange == null ? void 0 : fireOnValuesChange();
859
- }, [form, props.initialValue, fullFormItemName]);
899
+ }, [
900
+ form,
901
+ props.initialValue,
902
+ pathCtx.fullPath,
903
+ props.name,
904
+ props.preserve
905
+ ]);
860
906
  }
907
+ React.useEffect(() => {
908
+ var _a2;
909
+ fieldEntity.fullPath = [
910
+ ...pathCtx.fullPath,
911
+ ...props.name != null ? [props.name] : []
912
+ ];
913
+ fieldEntity.name = props.name;
914
+ fieldEntity.preserve = (_a2 = props.preserve) != null ? _a2 : true;
915
+ }, [pathCtx.fullPath, props.name, props.preserve]);
916
+ React.useEffect(() => {
917
+ const unregister = registerField == null ? void 0 : registerField(fieldEntity);
918
+ return () => unregister == null ? void 0 : unregister();
919
+ }, []);
861
920
  return /* @__PURE__ */ React.createElement(
862
921
  FormItem,
863
922
  __spreadProps(__spreadValues({}, rest), {
@@ -982,185 +1041,200 @@ const mapPlumeTypeToInputType = /* @__PURE__ */ new Map([
982
1041
  ["checkbox", "Checkbox" /* Checkbox */],
983
1042
  ["switch", "Checkbox" /* Checkbox */]
984
1043
  ]);
985
- const commonFormItemProps = (usage) => ({
986
- name: {
987
- type: "string",
988
- required: true,
989
- validator: (value, _props, ctx) => {
990
- var _a, _b, _c;
991
- const currFullPath = [...(_a = ctx == null ? void 0 : ctx.parentFormItemPath) != null ? _a : [], value];
992
- const nameCounter = ((_c = (_b = ctx == null ? void 0 : ctx.internalFormCtx) == null ? void 0 : _b.registeredFields) != null ? _c : []).filter(
993
- (formItem) => arrayEq(formItem.fullPath, currFullPath)
994
- ).length;
995
- return nameCounter === 1 ? true : `Repeated form item name: ${currFullPath.join(" \u2192 ")}`;
1044
+ function commonFormItemProps(usage) {
1045
+ const getFormItemProps = (ps, _ctx, { item }) => {
1046
+ if (usage === "simplified-form-item") {
1047
+ return item;
1048
+ } else {
1049
+ return ps;
1050
+ }
1051
+ };
1052
+ return {
1053
+ name: {
1054
+ type: "string",
1055
+ required: true,
1056
+ validator: (value, _ps, ctx) => {
1057
+ var _a, _b, _c;
1058
+ let currFullPath = [];
1059
+ if (usage === "simplified-form-item") {
1060
+ currFullPath = [value];
1061
+ } else {
1062
+ const formItemCtx = ctx;
1063
+ currFullPath = [...(_a = formItemCtx == null ? void 0 : formItemCtx.parentFormItemPath) != null ? _a : [], value];
1064
+ }
1065
+ const nameCounter = ((_c = (_b = ctx == null ? void 0 : ctx.internalFieldCtx) == null ? void 0 : _b.registeredFields) != null ? _c : []).filter((formItem) => arrayEq(formItem.fullPath, currFullPath)).length;
1066
+ return nameCounter === 1 ? true : `Repeated form item name: ${currFullPath.join(" \u2192 ")}`;
1067
+ },
1068
+ defaultValueHint: getDefaultValueHint("name")
996
1069
  },
997
- defaultValueHint: getDefaultValueHint("name")
998
- },
999
- initialValue: {
1000
- type: "dynamic",
1001
- control: (ps, ctx, {
1002
- item,
1003
- path
1004
- }) => {
1005
- var _a, _b, _c, _d;
1006
- let inputType = "Unkown" /* Unknown */;
1007
- if (usage === "simplified-form-item") {
1008
- inputType = item.inputType;
1009
- if (!ps.data) {
1070
+ initialValue: {
1071
+ type: "dynamic",
1072
+ control: (ps, ctx, {
1073
+ item,
1074
+ path
1075
+ }) => {
1076
+ var _a, _b, _c, _d;
1077
+ let inputType = "Unkown" /* Unknown */;
1078
+ if (usage === "simplified-form-item") {
1010
1079
  inputType = item.inputType;
1011
- } else if (path != null && typeof path[1] === "number") {
1012
- inputType = (_b = (_a = ctx == null ? void 0 : ctx.mergedFields) == null ? void 0 : _a[path[1]].inputType) != null ? _b : "Unkown" /* Unknown */;
1013
- }
1014
- } else {
1015
- if (!React.isValidElement(ps.children) || typeof ps.children.type === "string") {
1016
- inputType = "Unkown" /* Unknown */;
1080
+ if (!ps.data) {
1081
+ inputType = item.inputType;
1082
+ } else if (path != null && typeof path[1] === "number") {
1083
+ inputType = (_b = (_a = ctx == null ? void 0 : ctx.mergedFields) == null ? void 0 : _a[path[1]].inputType) != null ? _b : "Unkown" /* Unknown */;
1084
+ }
1017
1085
  } else {
1018
- if (mapAntdComponentToInputType.has(ps.children.type)) {
1019
- inputType = (_c = mapAntdComponentToInputType.get(ps.children.type)) != null ? _c : "Unkown" /* Unknown */;
1020
- } else if ("__plumeType" in ps.children.type) {
1021
- inputType = (_d = mapPlumeTypeToInputType.get(
1022
- ps.children.type.__plumeType
1023
- )) != null ? _d : "Unkown" /* Unknown */;
1086
+ if (!React.isValidElement(ps.children) || typeof ps.children.type === "string") {
1087
+ inputType = "Unkown" /* Unknown */;
1088
+ } else {
1089
+ if (mapAntdComponentToInputType.has(ps.children.type)) {
1090
+ inputType = (_c = mapAntdComponentToInputType.get(ps.children.type)) != null ? _c : "Unkown" /* Unknown */;
1091
+ } else if ("__plumeType" in ps.children.type) {
1092
+ inputType = (_d = mapPlumeTypeToInputType.get(
1093
+ ps.children.type.__plumeType
1094
+ )) != null ? _d : "Unkown" /* Unknown */;
1095
+ }
1024
1096
  }
1025
1097
  }
1098
+ if ([
1099
+ "Text" /* Text */,
1100
+ "Text Area" /* TextArea */,
1101
+ "Password" /* Password */,
1102
+ "Select" /* Select */,
1103
+ "Radio Group" /* RadioGroup */
1104
+ ].includes(inputType)) {
1105
+ return {
1106
+ type: "string",
1107
+ defaultValueHint: getDefaultValueHint("initialValue")
1108
+ };
1109
+ } else if ("Number" /* Number */ === inputType) {
1110
+ return {
1111
+ type: "number",
1112
+ defaultValueHint: getDefaultValueHint("initialValue")
1113
+ };
1114
+ } else if ("Checkbox" /* Checkbox */ === inputType) {
1115
+ return {
1116
+ type: "boolean",
1117
+ defaultValueHint: getDefaultValueHint("initialValue")
1118
+ };
1119
+ } else if ("DatePicker" /* DatePicker */ === inputType) {
1120
+ return {
1121
+ type: "dateString",
1122
+ defaultValueHint: getDefaultValueHint("initialValue")
1123
+ };
1124
+ } else {
1125
+ return {
1126
+ type: "exprEditor",
1127
+ defaultValueHint: getDefaultValueHint("initialValue")
1128
+ };
1129
+ }
1026
1130
  }
1027
- if ([
1028
- "Text" /* Text */,
1029
- "Text Area" /* TextArea */,
1030
- "Password" /* Password */,
1031
- "Select" /* Select */,
1032
- "Radio Group" /* RadioGroup */
1033
- ].includes(inputType)) {
1034
- return {
1035
- type: "string",
1036
- defaultValueHint: getDefaultValueHint("initialValue")
1037
- };
1038
- } else if ("Number" /* Number */ === inputType) {
1039
- return {
1040
- type: "number",
1041
- defaultValueHint: getDefaultValueHint("initialValue")
1042
- };
1043
- } else if ("Checkbox" /* Checkbox */ === inputType) {
1044
- return {
1045
- type: "boolean",
1046
- defaultValueHint: getDefaultValueHint("initialValue")
1047
- };
1048
- } else if ("DatePicker" /* DatePicker */ === inputType) {
1049
- return {
1050
- type: "dateString",
1051
- defaultValueHint: getDefaultValueHint("initialValue")
1052
- };
1053
- } else {
1054
- return {
1055
- type: "exprEditor",
1056
- defaultValueHint: getDefaultValueHint("initialValue")
1057
- };
1131
+ },
1132
+ rules: {
1133
+ displayName: "Validation rules",
1134
+ type: "formValidationRules"
1135
+ },
1136
+ valuePropName: {
1137
+ type: "string",
1138
+ advanced: true,
1139
+ defaultValueHint: "value",
1140
+ description: "The prop name for specifying the value of the form control component"
1141
+ },
1142
+ trigger: {
1143
+ type: "string",
1144
+ displayName: "Trigger prop name",
1145
+ advanced: true,
1146
+ defaultValueHint: "onChange",
1147
+ description: "The prop name of event handler that is called when value is changed"
1148
+ },
1149
+ noLabel: {
1150
+ type: "boolean",
1151
+ advanced: true
1152
+ },
1153
+ alignLabellessWithControls: {
1154
+ type: "boolean",
1155
+ displayName: "Align with controls?",
1156
+ description: "Aligns the content with form controls in the grid",
1157
+ hidden: (ps, ctx, extras) => {
1158
+ var _a;
1159
+ const formItem = getFormItemProps(ps, ctx, extras);
1160
+ return !(formItem == null ? void 0 : formItem.noLabel) || ((_a = ctx == null ? void 0 : ctx.layout) == null ? void 0 : _a.layout) !== "horizontal";
1161
+ },
1162
+ defaultValueHint: true
1163
+ },
1164
+ colon: {
1165
+ type: "boolean",
1166
+ defaultValueHint: true,
1167
+ advanced: true,
1168
+ hidden: () => true
1169
+ },
1170
+ labelAlign: {
1171
+ type: "choice",
1172
+ options: ["left", "right"],
1173
+ advanced: true,
1174
+ hidden: (ps, ctx, extras) => {
1175
+ var _a;
1176
+ const formItem = getFormItemProps(ps, ctx, extras);
1177
+ return !!(formItem == null ? void 0 : formItem.noLabel) || ((_a = ctx == null ? void 0 : ctx.layout) == null ? void 0 : _a.layout) !== "horizontal";
1058
1178
  }
1059
- }
1060
- },
1061
- rules: {
1062
- displayName: "Validation rules",
1063
- type: "formValidationRules"
1064
- },
1065
- valuePropName: {
1066
- type: "string",
1067
- advanced: true,
1068
- defaultValueHint: "value",
1069
- description: "The prop name for specifying the value of the form control component"
1070
- },
1071
- trigger: {
1072
- type: "string",
1073
- displayName: "Trigger prop name",
1074
- advanced: true,
1075
- defaultValueHint: "onChange",
1076
- description: "The prop name of event handler that is called when value is changed"
1077
- },
1078
- noLabel: {
1079
- type: "boolean",
1080
- advanced: true
1081
- },
1082
- alignLabellessWithControls: {
1083
- type: "boolean",
1084
- displayName: "Align with controls?",
1085
- description: "Aligns the content with form controls in the grid",
1086
- hidden: (ps, ctx) => {
1087
- var _a;
1088
- return !ps.noLabel || ((_a = ctx == null ? void 0 : ctx.internalFormCtx) == null ? void 0 : _a.layout.layout) !== "horizontal";
1089
1179
  },
1090
- defaultValueHint: true
1091
- },
1092
- colon: {
1093
- type: "boolean",
1094
- defaultValueHint: true,
1095
- advanced: true,
1096
- hidden: () => true
1097
- },
1098
- labelAlign: {
1099
- type: "choice",
1100
- options: ["left", "right"],
1101
- advanced: true,
1102
- hidden: (ps, ctx) => {
1103
- var _a;
1104
- return !!ps.noLabel || ((_a = ctx == null ? void 0 : ctx.internalFormCtx) == null ? void 0 : _a.layout.layout) !== "horizontal";
1105
- }
1106
- },
1107
- hidden: {
1108
- type: "boolean",
1109
- advanced: true,
1110
- defaultValueHint: getDefaultValueHint("hidden")
1111
- },
1112
- validateTrigger: {
1113
- type: "choice",
1114
- options: ["onSubmit", "onChange", "onBlur"],
1115
- multiSelect: true,
1116
- advanced: true
1117
- },
1118
- shouldUpdate: {
1119
- type: "boolean",
1120
- advanced: true,
1121
- displayName: "Always re-render",
1122
- description: "Form fields normally only re-render when the corresponding form value changes, for performance. This forces it to always re-render."
1123
- },
1124
- dependencies: {
1125
- type: "array",
1126
- advanced: true,
1127
- displayName: "Dependencies",
1128
- description: "Form fields can depend on other form fields. This forces it to re-evaluate the validation rules when the other form fields changes."
1129
- },
1130
- hideValidationMessage: {
1131
- type: "boolean",
1132
- displayName: "Hide validation message?",
1133
- description: "If true, will hide the validation error message",
1134
- defaultValueHint: false,
1135
- advanced: true
1136
- },
1137
- customizeProps: {
1138
- type: "function",
1139
- description: "Customize the props passed into the wrapped field component. Takes the current status ('success', 'warning', 'error', or 'validating').)",
1140
- argNames: ["fieldData"],
1141
- argValues: (_ps, ctx) => {
1142
- var _a;
1143
- return [
1144
- {
1145
- status: (_a = ctx == null ? void 0 : ctx.status) == null ? void 0 : _a.status
1146
- }
1147
- ];
1180
+ hidden: {
1181
+ type: "boolean",
1182
+ advanced: true,
1183
+ defaultValueHint: getDefaultValueHint("hidden")
1148
1184
  },
1149
- advanced: true
1150
- },
1151
- noStyle: {
1152
- type: "boolean",
1153
- displayName: "Field control only",
1154
- description: "Don't render anything but the field control - so no label, help text, validation error, etc.",
1155
- advanced: true
1156
- },
1157
- preserve: {
1158
- type: "boolean",
1159
- advanced: true,
1160
- defaultValueHint: true,
1161
- description: "Keep field value even when field removed."
1162
- }
1163
- });
1185
+ validateTrigger: {
1186
+ type: "choice",
1187
+ options: ["onSubmit", "onChange", "onBlur"],
1188
+ multiSelect: true,
1189
+ advanced: true
1190
+ },
1191
+ shouldUpdate: {
1192
+ type: "boolean",
1193
+ advanced: true,
1194
+ displayName: "Always re-render",
1195
+ description: "Form fields normally only re-render when the corresponding form value changes, for performance. This forces it to always re-render."
1196
+ },
1197
+ dependencies: {
1198
+ type: "array",
1199
+ advanced: true,
1200
+ displayName: "Dependencies",
1201
+ description: "Form fields can depend on other form fields. This forces it to re-evaluate the validation rules when the other form fields changes."
1202
+ },
1203
+ hideValidationMessage: {
1204
+ type: "boolean",
1205
+ displayName: "Hide validation message?",
1206
+ description: "If true, will hide the validation error message",
1207
+ defaultValueHint: false,
1208
+ advanced: true
1209
+ },
1210
+ customizeProps: {
1211
+ type: "function",
1212
+ description: "Customize the props passed into the wrapped field component. Takes the current status ('success', 'warning', 'error', or 'validating').)",
1213
+ argNames: ["fieldData"],
1214
+ argValues: (_ps, ctx) => {
1215
+ var _a;
1216
+ return [
1217
+ {
1218
+ status: (_a = ctx == null ? void 0 : ctx.status) == null ? void 0 : _a.status
1219
+ }
1220
+ ];
1221
+ },
1222
+ advanced: true
1223
+ },
1224
+ noStyle: {
1225
+ type: "boolean",
1226
+ displayName: "Field control only",
1227
+ description: "Don't render anything but the field control - so no label, help text, validation error, etc.",
1228
+ advanced: true
1229
+ },
1230
+ preserve: {
1231
+ type: "boolean",
1232
+ advanced: true,
1233
+ defaultValueHint: true,
1234
+ description: "Keep field value even when field removed."
1235
+ }
1236
+ };
1237
+ }
1164
1238
  const commonSimplifiedFormArrayItemType = (propName) => ({
1165
1239
  type: "object",
1166
1240
  fields: __spreadValues({