@nutui/nutui-react 2.7.0 → 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +39 -10
  2. package/dist/esm/Form/style/style.css +1 -1
  3. package/dist/esm/Form.js +3 -3
  4. package/dist/esm/FormItem/style/style.css +1 -1
  5. package/dist/esm/Table/style/style.css +1 -1
  6. package/dist/esm/TextArea.js +2 -2
  7. package/dist/esm/Toast/style/index.js +1 -1
  8. package/dist/esm/Toast/style/style.css +1 -1
  9. package/dist/esm/Uploader/style/style.css +1 -1
  10. package/dist/esm/Uploader.js +4 -2
  11. package/dist/esm/formitem2.js +136 -76
  12. package/dist/locales/base.js +1 -1
  13. package/dist/locales/en-US.js +1 -1
  14. package/dist/locales/id-ID.js +1 -1
  15. package/dist/locales/tr-TR.js +1 -1
  16. package/dist/locales/zh-CN.js +1 -1
  17. package/dist/locales/zh-TW.js +1 -1
  18. package/dist/locales/zh-UG.js +1 -1
  19. package/dist/nutui.react.es.js +172 -103
  20. package/dist/nutui.react.umd.js +172 -103
  21. package/dist/packages/form/form.scss +0 -68
  22. package/dist/packages/formitem/formitem.scss +90 -21
  23. package/dist/packages/table/table.scss +1 -0
  24. package/dist/packages/toast/toast.scss +1 -0
  25. package/dist/packages/uploader/uploader.scss +2 -1
  26. package/dist/style.css +1 -1
  27. package/dist/types/packages/form/form.d.ts +10 -0
  28. package/dist/types/packages/form/form.taro.d.ts +2 -0
  29. package/dist/types/packages/form/types.d.ts +2 -1
  30. package/dist/types/packages/formitem/formitem.d.ts +1 -0
  31. package/dist/types/packages/formitem/formitem.taro.d.ts +1 -0
  32. package/dist/types/packages/infiniteloading/infiniteloading.d.ts +1 -1
  33. package/dist/types/utils/merge.d.ts +1 -0
  34. package/dist/types/utils/to-array.d.ts +1 -0
  35. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.nutui = {}, global2.React, global2.ReactDOM));
3
3
  })(this, function(exports2, React, ReactDOM) {
4
4
  "use strict";/*!
5
- * @nutui/nutui-react v2.7.0 Fri Nov 01 2024 15:59:16 GMT+0800 (China Standard Time)
5
+ * @nutui/nutui-react v2.7.2 Fri Dec 06 2024 16:20:01 GMT+0800 (中国标准时间)
6
6
  * (c) 2023 @jdf2e.
7
7
  * Released under the MIT License.
8
8
  */
@@ -5332,7 +5332,7 @@
5332
5332
  }
5333
5333
  }
5334
5334
  }
5335
- const toArray = (a) => is.und(a) ? [] : is.arr(a) ? a : [a];
5335
+ const toArray$1 = (a) => is.und(a) ? [] : is.arr(a) ? a : [a];
5336
5336
  function flush(queue, iterator) {
5337
5337
  if (queue.size) {
5338
5338
  const items = Array.from(queue);
@@ -6340,7 +6340,7 @@
6340
6340
  function callProp(value, ...args) {
6341
6341
  return is.fun(value) ? value(...args) : value;
6342
6342
  }
6343
- const matchProp = (value, key) => value === true || !!(key && value && (is.fun(value) ? value(key) : toArray(value).includes(key)));
6343
+ const matchProp = (value, key) => value === true || !!(key && value && (is.fun(value) ? value(key) : toArray$1(value).includes(key)));
6344
6344
  const resolveProp = (prop, key) => is.obj(prop) ? key && prop[key] : prop;
6345
6345
  const getDefaultProp = (props, key) => props.default === true ? props[key] : props.default ? props.default[key] : void 0;
6346
6346
  const noopTransform = (value) => value;
@@ -6882,7 +6882,7 @@
6882
6882
  } = anim;
6883
6883
  const payload = getPayload(anim.to);
6884
6884
  if (!payload && hasFluidValue(anim.to)) {
6885
- toValues = toArray(getFluidValue(anim.to));
6885
+ toValues = toArray$1(getFluidValue(anim.to));
6886
6886
  }
6887
6887
  anim.values.forEach((node2, i2) => {
6888
6888
  if (node2.done) return;
@@ -7235,7 +7235,7 @@
7235
7235
  if (!hasAsyncTo) {
7236
7236
  if (started || hasFluidValue(prevTo)) {
7237
7237
  anim.values = node.getPayload();
7238
- anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray(goal);
7238
+ anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray$1(goal);
7239
7239
  }
7240
7240
  if (anim.immediate != immediate) {
7241
7241
  anim.immediate = immediate;
@@ -7508,7 +7508,7 @@
7508
7508
  queue
7509
7509
  } = this;
7510
7510
  if (props) {
7511
- queue = toArray(props).map(createUpdate);
7511
+ queue = toArray$1(props).map(createUpdate);
7512
7512
  } else {
7513
7513
  this.queue = [];
7514
7514
  }
@@ -7524,7 +7524,7 @@
7524
7524
  }
7525
7525
  if (keys) {
7526
7526
  const springs = this.springs;
7527
- each(toArray(keys), (key) => springs[key].stop(!!arg));
7527
+ each(toArray$1(keys), (key) => springs[key].stop(!!arg));
7528
7528
  } else {
7529
7529
  stopAsync(this._state, this._lastAsyncId);
7530
7530
  this.each((spring) => spring.stop(!!arg));
@@ -7538,7 +7538,7 @@
7538
7538
  });
7539
7539
  } else {
7540
7540
  const springs = this.springs;
7541
- each(toArray(keys), (key) => springs[key].pause());
7541
+ each(toArray$1(keys), (key) => springs[key].pause());
7542
7542
  }
7543
7543
  return this;
7544
7544
  }
@@ -7549,7 +7549,7 @@
7549
7549
  });
7550
7550
  } else {
7551
7551
  const springs = this.springs;
7552
- each(toArray(keys), (key) => springs[key].resume());
7552
+ each(toArray$1(keys), (key) => springs[key].resume());
7553
7553
  }
7554
7554
  return this;
7555
7555
  }
@@ -7700,7 +7700,7 @@
7700
7700
  function getSprings(ctrl, props) {
7701
7701
  const springs = _extends$1({}, ctrl.springs);
7702
7702
  if (props) {
7703
- each(toArray(props), (props2) => {
7703
+ each(toArray$1(props), (props2) => {
7704
7704
  if (is.und(props2.keys)) {
7705
7705
  props2 = createUpdate(props2);
7706
7706
  }
@@ -7972,7 +7972,7 @@
7972
7972
  }
7973
7973
  }
7974
7974
  _get() {
7975
- const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray(getFluidValue(this.source));
7975
+ const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray$1(getFluidValue(this.source));
7976
7976
  return this.calc(...inputs);
7977
7977
  }
7978
7978
  _start() {
@@ -7991,7 +7991,7 @@
7991
7991
  }
7992
7992
  _attach() {
7993
7993
  let priority2 = 1;
7994
- each(toArray(this.source), (source) => {
7994
+ each(toArray$1(this.source), (source) => {
7995
7995
  if (hasFluidValue(source)) {
7996
7996
  addFluidObserver(source, this);
7997
7997
  }
@@ -8006,7 +8006,7 @@
8006
8006
  this._start();
8007
8007
  }
8008
8008
  _detach() {
8009
- each(toArray(this.source), (source) => {
8009
+ each(toArray$1(this.source), (source) => {
8010
8010
  if (hasFluidValue(source)) {
8011
8011
  removeFluidObserver(source, this);
8012
8012
  }
@@ -8025,7 +8025,7 @@
8025
8025
  } else if (event.type == "idle") {
8026
8026
  this._active.delete(event.parent);
8027
8027
  } else if (event.type == "priority") {
8028
- this.priority = toArray(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0);
8028
+ this.priority = toArray$1(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0);
8029
8029
  }
8030
8030
  }
8031
8031
  }
@@ -8187,7 +8187,7 @@
8187
8187
  delete style[key];
8188
8188
  if (is.und(value)) return;
8189
8189
  const unit = pxTransforms.test(key) ? "px" : degTransforms.test(key) ? "deg" : "";
8190
- inputs.push(toArray(value));
8190
+ inputs.push(toArray$1(value));
8191
8191
  transforms.push(key === "rotate3d" ? ([x2, y2, z2, deg]) => [`rotate3d(${x2},${y2},${z2},${addUnit(deg, unit)})`, isValueIdentity(deg, 0)] : (input) => [`${key}(${input.map((v) => addUnit(v, unit)).join(",")})`, isValueIdentity(input, key.startsWith("scale") ? 1 : 0)]);
8192
8192
  }
8193
8193
  });
@@ -13719,6 +13719,25 @@
13719
13719
  Schema.warning = warning;
13720
13720
  Schema.messages = messages;
13721
13721
  Schema.validators = validators;
13722
+ function merge(...objects) {
13723
+ const result = Array.isArray(objects[0]) ? [] : {};
13724
+ function mergeHelper(obj, path = []) {
13725
+ for (const [key, value] of Object.entries(obj)) {
13726
+ const newPath = [...path, key];
13727
+ if (Array.isArray(value)) {
13728
+ result[key] = [...value];
13729
+ } else if (typeof value === "object" && value !== null) {
13730
+ if (path.some((p2) => p2 === value)) continue;
13731
+ if (!result[key]) result[key] = {};
13732
+ mergeHelper(value, newPath);
13733
+ } else {
13734
+ result[key] = value;
13735
+ }
13736
+ }
13737
+ }
13738
+ objects.filter((obj) => !!obj).forEach((obj) => mergeHelper(obj));
13739
+ return result;
13740
+ }
13722
13741
  const SECRET = "NUT_FORM_INTERNAL";
13723
13742
  class FormStore {
13724
13743
  constructor() {
@@ -13751,17 +13770,16 @@
13751
13770
  });
13752
13771
  return fieldsValue;
13753
13772
  };
13754
- this.setInitialValues = (values, init) => {
13773
+ this.setInitialValues = (initialValues, init) => {
13774
+ this.initialValues = initialValues || {};
13755
13775
  if (init) {
13756
- this.initialValues = values;
13757
- this.store = values;
13776
+ const nextStore = merge(initialValues, this.store);
13777
+ this.updateStore(nextStore);
13758
13778
  }
13759
13779
  };
13760
- this.setFieldsValue = (newStore, needValidate = true) => {
13761
- this.store = {
13762
- ...this.store,
13763
- ...newStore
13764
- };
13780
+ this.setFieldsValue = (newStore) => {
13781
+ const nextStore = merge(this.store, newStore);
13782
+ this.updateStore(nextStore);
13765
13783
  this.fieldEntities.forEach((entity) => {
13766
13784
  const { name } = entity.props;
13767
13785
  Object.keys(newStore).forEach((key) => {
@@ -13779,7 +13797,12 @@
13779
13797
  item.entity.onStoreChange("update");
13780
13798
  }
13781
13799
  });
13782
- needValidate && this.validateFields();
13800
+ };
13801
+ this.setFieldValue = (name, value) => {
13802
+ const store = {
13803
+ [name]: value
13804
+ };
13805
+ this.setFieldsValue(store);
13783
13806
  };
13784
13807
  this.setCallback = (callback) => {
13785
13808
  this.callbacks = {
@@ -13787,46 +13810,55 @@
13787
13810
  ...callback
13788
13811
  };
13789
13812
  };
13790
- this.validateFields = async (nameList) => {
13813
+ this.validateEntities = async (entity, errs) => {
13791
13814
  var _a;
13792
- let filterEntitys = [];
13793
- const errs = [];
13815
+ const { name, rules: rules2 = [] } = entity.props;
13816
+ if (!name) {
13817
+ console.warn("Form field missing name property");
13818
+ return;
13819
+ }
13820
+ const descriptor = {};
13821
+ if (rules2.length) {
13822
+ if (rules2.length > 1) {
13823
+ descriptor[name] = [];
13824
+ rules2.forEach((v) => {
13825
+ descriptor[name].push(v);
13826
+ });
13827
+ } else {
13828
+ descriptor[name] = rules2[0];
13829
+ }
13830
+ }
13831
+ const validator = new Schema(descriptor);
13832
+ try {
13833
+ await validator.validate({ [name]: (_a = this.store) == null ? void 0 : _a[name] });
13834
+ } catch ({ errors }) {
13835
+ if (errors) {
13836
+ errs.push(...errors);
13837
+ this.errors[name] = errors;
13838
+ }
13839
+ } finally {
13840
+ if (!errs || errs.length === 0) {
13841
+ this.errors[name] = [];
13842
+ }
13843
+ }
13844
+ entity.onStoreChange("validate");
13845
+ };
13846
+ this.validateFields = async (nameList) => {
13847
+ let filterEntities = [];
13794
13848
  this.errors.length = 0;
13795
13849
  if (!nameList || nameList.length === 0) {
13796
- filterEntitys = this.fieldEntities;
13850
+ filterEntities = this.fieldEntities;
13797
13851
  } else {
13798
- filterEntitys = this.fieldEntities.filter(
13852
+ filterEntities = this.fieldEntities.filter(
13799
13853
  ({ props: { name } }) => nameList.includes(name)
13800
13854
  );
13801
13855
  }
13802
- for (const entity of filterEntitys) {
13803
- const { name, rules: rules2 = [] } = entity.props;
13804
- const descriptor = {};
13805
- if (rules2.length) {
13806
- if (rules2.length > 1) {
13807
- descriptor[name] = [];
13808
- rules2.forEach((v) => {
13809
- descriptor[name].push(v);
13810
- });
13811
- } else {
13812
- descriptor[name] = rules2[0];
13813
- }
13814
- }
13815
- const validator = new Schema(descriptor);
13816
- try {
13817
- await validator.validate({ [name]: (_a = this.store) == null ? void 0 : _a[name] });
13818
- } catch ({ errors }) {
13819
- if (errors) {
13820
- errs.push(...errors);
13821
- this.errors[name] = errors;
13822
- }
13823
- } finally {
13824
- if (!errs || errs.length === 0) {
13825
- this.errors[name] = [];
13826
- }
13827
- }
13828
- entity.onStoreChange("validate");
13829
- }
13856
+ const errs = [];
13857
+ await Promise.all(
13858
+ filterEntities.map(async (entity) => {
13859
+ await this.validateEntities(entity, errs);
13860
+ })
13861
+ );
13830
13862
  return errs;
13831
13863
  };
13832
13864
  this.submit = async () => {
@@ -13840,7 +13872,8 @@
13840
13872
  };
13841
13873
  this.resetFields = () => {
13842
13874
  this.errors.length = 0;
13843
- this.store = this.initialValues;
13875
+ const nextStore = merge({}, this.initialValues);
13876
+ this.updateStore(nextStore);
13844
13877
  this.fieldEntities.forEach((entity) => {
13845
13878
  entity.onStoreChange("reset");
13846
13879
  });
@@ -13875,6 +13908,7 @@
13875
13908
  getFieldValue: this.getFieldValue,
13876
13909
  getFieldsValue: this.getFieldsValue,
13877
13910
  setFieldsValue: this.setFieldsValue,
13911
+ setFieldValue: this.setFieldValue,
13878
13912
  resetFields: this.resetFields,
13879
13913
  validateFields: this.validateFields,
13880
13914
  submit: this.submit,
@@ -13889,6 +13923,9 @@
13889
13923
  }
13890
13924
  };
13891
13925
  }
13926
+ updateStore(nextStore) {
13927
+ this.store = nextStore;
13928
+ }
13892
13929
  }
13893
13930
  const useForm = (form) => {
13894
13931
  const formRef = React.useRef();
@@ -13906,7 +13943,9 @@
13906
13943
  ...ComponentDefaults,
13907
13944
  labelPosition: "right",
13908
13945
  starPosition: "left",
13946
+ disabled: false,
13909
13947
  divider: false,
13948
+ validateTrigger: "onChange",
13910
13949
  onFinish: (values) => {
13911
13950
  },
13912
13951
  onFinishFailed: (values, errorFields) => {
@@ -13927,8 +13966,10 @@
13927
13966
  children,
13928
13967
  initialValues,
13929
13968
  divider,
13969
+ disabled,
13930
13970
  onFinish,
13931
13971
  onFinishFailed,
13972
+ validateTrigger,
13932
13973
  labelPosition,
13933
13974
  starPosition,
13934
13975
  form
@@ -13975,7 +14016,13 @@
13975
14016
  resetFields();
13976
14017
  }
13977
14018
  },
13978
- /* @__PURE__ */ React.createElement(Cell.Group, { divider }, /* @__PURE__ */ React.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React.createElement(Cell, { className: `${classPrefix2}-footer` }, footer) : null)
14019
+ /* @__PURE__ */ React.createElement(Cell.Group, { divider }, /* @__PURE__ */ React.createElement(
14020
+ Context.Provider,
14021
+ {
14022
+ value: { formInstance, labelPosition, disabled, validateTrigger }
14023
+ },
14024
+ children
14025
+ ), footer ? /* @__PURE__ */ React.createElement(Cell, { className: `${classPrefix2}-footer` }, footer) : null)
13979
14026
  );
13980
14027
  }
13981
14028
  );
@@ -13989,6 +14036,12 @@
13989
14036
  }
13990
14037
  ).$$typeof === component.type.$$typeof;
13991
14038
  }
14039
+ function toArray(value) {
14040
+ if (value === void 0 || value === null) {
14041
+ return [];
14042
+ }
14043
+ return Array.isArray(value) ? value : [value];
14044
+ }
13992
14045
  const defaultProps$W = {
13993
14046
  ...ComponentDefaults,
13994
14047
  required: false,
@@ -13996,7 +14049,6 @@
13996
14049
  label: "",
13997
14050
  rules: [{ required: false, message: "" }],
13998
14051
  errorMessageAlign: "left",
13999
- validateTrigger: "onChange",
14000
14052
  shouldUpdate: false,
14001
14053
  noStyle: false
14002
14054
  };
@@ -14005,15 +14057,14 @@
14005
14057
  super(props);
14006
14058
  this.getControlled = (children) => {
14007
14059
  var _a;
14008
- const { setFieldsValue, getFieldValue } = this.context;
14009
- const { dispatch } = this.context.getInternal(SECRET);
14060
+ const { setFieldsValue, getFieldValue } = this.context.formInstance;
14061
+ const { dispatch } = this.context.formInstance.getInternal(SECRET);
14010
14062
  const { name = "" } = this.props;
14011
- if ((_a = children == null ? void 0 : children.props) == null ? void 0 : _a.defaultValue) {
14012
- console.warn("通过 initialValue 设置初始值");
14013
- }
14063
+ if ((_a = children == null ? void 0 : children.props) == null ? void 0 : _a.defaultValue) ;
14014
14064
  const fieldValue = getFieldValue(name);
14015
14065
  const controlled = {
14016
14066
  ...children.props,
14067
+ className: children.props.className,
14017
14068
  [this.props.valuePropName || "value"]: fieldValue !== void 0 ? fieldValue : this.props.initialValue,
14018
14069
  [this.props.trigger || "onChange"]: (...args) => {
14019
14070
  const originOnChange = children.props[this.props.trigger || "onChange"];
@@ -14024,27 +14075,25 @@
14024
14075
  if (this.props.getValueFromEvent) {
14025
14076
  next = this.props.getValueFromEvent(...args);
14026
14077
  }
14027
- setFieldsValue({ [name]: next }, false);
14078
+ setFieldsValue({ [name]: next });
14028
14079
  }
14029
14080
  };
14030
14081
  const { validateTrigger } = this.props;
14031
- let validateTriggers = [this.props.trigger || "onChange"];
14032
- if (validateTrigger) {
14033
- validateTriggers = typeof validateTrigger === "string" ? [validateTrigger] : [...validateTrigger];
14034
- validateTriggers.forEach((trigger) => {
14035
- const originTrigger = controlled[trigger];
14036
- controlled[trigger] = (...args) => {
14037
- if (originTrigger) {
14038
- originTrigger(...args);
14039
- }
14040
- if (this.props.rules && this.props.rules.length) {
14041
- dispatch({
14042
- name: this.props.name
14043
- });
14044
- }
14045
- };
14046
- });
14047
- }
14082
+ const mergedValidateTrigger = validateTrigger || this.context.validateTrigger;
14083
+ const validateTriggers = toArray(mergedValidateTrigger);
14084
+ validateTriggers.forEach((trigger) => {
14085
+ const originTrigger = controlled[trigger];
14086
+ controlled[trigger] = (...args) => {
14087
+ if (originTrigger) {
14088
+ originTrigger(...args);
14089
+ }
14090
+ if (this.props.rules && this.props.rules.length) {
14091
+ dispatch({
14092
+ name: this.props.name
14093
+ });
14094
+ }
14095
+ };
14096
+ });
14048
14097
  if (isForwardRefComponent(children)) {
14049
14098
  controlled.ref = (componentInstance) => {
14050
14099
  const originRef = children.ref;
@@ -14068,7 +14117,7 @@
14068
14117
  };
14069
14118
  this.onStoreChange = (type) => {
14070
14119
  if (type === "reset") {
14071
- this.context.errors[this.props.name] = [];
14120
+ this.context.formInstance.errors[this.props.name] = [];
14072
14121
  this.refresh();
14073
14122
  } else {
14074
14123
  this.forceUpdate();
@@ -14089,27 +14138,40 @@
14089
14138
  ...this.props
14090
14139
  };
14091
14140
  const requiredInRules = rules2 == null ? void 0 : rules2.some((rule) => rule.required);
14092
- const item = name ? this.context.errors[name] : [];
14093
- const { starPosition } = this.context;
14094
- const renderStar = (required || requiredInRules) && /* @__PURE__ */ React.createElement("i", { className: "required" });
14095
- const renderLabel = /* @__PURE__ */ React.createElement(React.Fragment, null, starPosition === "left" ? renderStar : null, label, starPosition === "right" ? renderStar : null);
14141
+ const item = name ? this.context.formInstance.errors[name] : [];
14142
+ const { starPosition } = this.context.formInstance;
14143
+ const renderStar = (required || requiredInRules) && /* @__PURE__ */ React.createElement("div", { className: "nut-form-item-label-required required" }, "*");
14144
+ const renderLabel = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { className: "nut-form-item-labeltxt" }, starPosition === "left" ? renderStar : null, label), starPosition === "right" ? renderStar : null);
14096
14145
  return /* @__PURE__ */ React.createElement(
14097
14146
  Cell,
14098
14147
  {
14099
- className: `nut-form-item ${className}`,
14148
+ className: `${this.getClassNameWithDirection("nut-form-item")} ${className}`,
14100
14149
  style,
14101
14150
  align,
14102
14151
  onClick: (e) => this.props.onClick && this.props.onClick(e, this.componentRef)
14103
14152
  },
14104
- label ? /* @__PURE__ */ React.createElement("div", { className: "nut-cell-title nut-form-item-label" }, renderLabel) : null,
14105
- /* @__PURE__ */ React.createElement("div", { className: "nut-cell-value nut-form-item-body" }, /* @__PURE__ */ React.createElement("div", { className: "nut-form-item-body-slots" }, childNode), item && item.length > 0 && /* @__PURE__ */ React.createElement(
14153
+ label ? /* @__PURE__ */ React.createElement(
14106
14154
  "div",
14107
14155
  {
14108
- className: "nut-form-item-body-tips",
14109
- style: { textAlign: errorMessageAlign }
14156
+ className: `nut-cell-title ${this.getClassNameWithDirection("nut-form-item-label")}`
14110
14157
  },
14111
- item[0].message
14112
- ))
14158
+ renderLabel
14159
+ ) : null,
14160
+ /* @__PURE__ */ React.createElement(
14161
+ "div",
14162
+ {
14163
+ className: `nut-cell-value ${this.getClassNameWithDirection("nut-form-item-body")}`
14164
+ },
14165
+ /* @__PURE__ */ React.createElement("div", { className: "nut-form-item-body-slots" }, childNode),
14166
+ item && item.length > 0 && /* @__PURE__ */ React.createElement(
14167
+ "div",
14168
+ {
14169
+ className: "nut-form-item-body-tips",
14170
+ style: { textAlign: errorMessageAlign }
14171
+ },
14172
+ item[0].message
14173
+ )
14174
+ )
14113
14175
  );
14114
14176
  };
14115
14177
  this.componentRef = React.createRef();
@@ -14118,14 +14180,14 @@
14118
14180
  };
14119
14181
  }
14120
14182
  componentDidMount() {
14121
- const { store = {}, setInitialValues } = this.context.getInternal(SECRET);
14183
+ const { store = {}, setInitialValues } = this.context.formInstance.getInternal(SECRET);
14122
14184
  if (this.props.initialValue && this.props.name && !Object.keys(store).includes(this.props.name)) {
14123
14185
  setInitialValues(
14124
14186
  { ...store, [this.props.name]: this.props.initialValue },
14125
14187
  true
14126
14188
  );
14127
14189
  }
14128
- const { registerField, registerUpdate } = this.context.getInternal(SECRET);
14190
+ const { registerField, registerUpdate } = this.context.formInstance.getInternal(SECRET);
14129
14191
  this.cancelRegister = registerField(this);
14130
14192
  this.eventOff = registerUpdate(this, this.props.shouldUpdate);
14131
14193
  }
@@ -14137,6 +14199,12 @@
14137
14199
  this.eventOff();
14138
14200
  }
14139
14201
  }
14202
+ getClassNameWithDirection(className) {
14203
+ if (className && this.context.labelPosition) {
14204
+ return `${className} ${className}-${this.context.labelPosition}`;
14205
+ }
14206
+ return className;
14207
+ }
14140
14208
  render() {
14141
14209
  const { children } = this.props;
14142
14210
  const child = Array.isArray(children) ? children[0] : children;
@@ -14147,9 +14215,9 @@
14147
14215
  this.getControlled(child)
14148
14216
  );
14149
14217
  } else {
14150
- returnChildNode = child(this.context);
14218
+ returnChildNode = child(this.context.formInstance);
14151
14219
  }
14152
- return /* @__PURE__ */ React.createElement(React.Fragment, { key: this.state.resetCount }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode));
14220
+ return /* @__PURE__ */ React.createElement(React.Fragment, { key: this.state.resetCount }, /* @__PURE__ */ React.createElement("div", { className: this.context.disabled ? "nut-form-item-disabled" : "" }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode)));
14153
14221
  }
14154
14222
  };
14155
14223
  _FormItem.defaultProps = defaultProps$W;
@@ -16302,7 +16370,6 @@
16302
16370
  showCount: false,
16303
16371
  rows: 2,
16304
16372
  maxLength: 140,
16305
- placeholder: "",
16306
16373
  readOnly: false,
16307
16374
  disabled: false,
16308
16375
  autoSize: false
@@ -16402,7 +16469,7 @@
16402
16469
  },
16403
16470
  rows,
16404
16471
  maxLength: maxLength === -1 ? void 0 : maxLength,
16405
- placeholder: placeholder || locale.placeholder,
16472
+ placeholder: placeholder === void 0 ? locale.placeholder : placeholder,
16406
16473
  ...rest
16407
16474
  }
16408
16475
  ),
@@ -16903,6 +16970,7 @@
16903
16970
  }
16904
16971
  };
16905
16972
  const readFile = (files) => {
16973
+ const results = [];
16906
16974
  files.forEach((file, index) => {
16907
16975
  var _a;
16908
16976
  const formData = new FormData();
@@ -16919,13 +16987,14 @@
16919
16987
  const reader = new FileReader();
16920
16988
  reader.onload = (event) => {
16921
16989
  fileItem.url = event.target.result;
16922
- setFileList([...fileList, fileItem]);
16990
+ results.push(fileItem);
16923
16991
  };
16924
16992
  reader.readAsDataURL(file);
16925
16993
  } else {
16926
- setFileList([...fileList, fileItem]);
16994
+ results.push(fileItem);
16927
16995
  }
16928
16996
  });
16997
+ setFileList([...fileList, ...results]);
16929
16998
  };
16930
16999
  const filterFiles = (files) => {
16931
17000
  const maximum = maxCount * 1;
@@ -1,68 +0,0 @@
1
-
2
- .form-layout-right .nut-form-item-label {
3
- text-align: right;
4
- padding-right: 24px;
5
- white-space: nowrap;
6
- }
7
-
8
- .form-layout-left .nut-form-item-label {
9
- position: relative;
10
- text-align: left;
11
- padding-left: 12px;
12
- white-space: nowrap;
13
-
14
- .required {
15
- display: block;
16
- line-height: 1.5;
17
- position: absolute;
18
- left: 0.1em;
19
- }
20
- }
21
-
22
- .form-layout-top .nut-form-item {
23
- flex-direction: column;
24
- align-items: flex-start;
25
- white-space: nowrap;
26
- }
27
-
28
- .form-layout-top .nut-form-item-label {
29
- padding-bottom: 4px;
30
- display: block;
31
- padding-right: 24px;
32
- }
33
-
34
- .form-layout-top .nut-form-item-body {
35
- margin-left: 0;
36
- width: 100%;
37
- }
38
-
39
- [dir='rtl'] .form-layout-right .nut-form-item-label,
40
- .nut-rtl .form-layout-right .nut-form-item-label {
41
- text-align: left;
42
- padding-right: 0;
43
- padding-left: 24px;
44
- }
45
-
46
- [dir='rtl'] .form-layout-left .nut-form-item-label,
47
- .nut-rtl .form-layout-left .nut-form-item-label {
48
- text-align: right;
49
- padding-left: 0;
50
- padding-right: 12px;
51
-
52
- .required {
53
- left: auto;
54
- right: 0.1em;
55
- }
56
- }
57
-
58
- [dir='rtl'] .form-layout-top .nut-form-item-label,
59
- .nut-rtl .form-layout-top .nut-form-item-label {
60
- padding-right: 0;
61
- padding-left: 24px;
62
- }
63
-
64
- [dir='rtl'] .form-layout-top .nut-form-item-body,
65
- .nut-rtl .form-layout-top .nut-form-item-body {
66
- margin-left: 0;
67
- margin-right: 0;
68
- }