@nutui/nutui-react 2.7.1 → 2.7.3

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 (42) hide show
  1. package/CHANGELOG.md +36 -10
  2. package/dist/esm/Animate/style/style.css +1 -1
  3. package/dist/esm/Empty.js +9 -1
  4. package/dist/esm/Form/style/style.css +1 -1
  5. package/dist/esm/Form.js +3 -3
  6. package/dist/esm/FormItem/style/style.css +1 -1
  7. package/dist/esm/Popover/style/style.css +1 -1
  8. package/dist/esm/Table/style/style.css +1 -1
  9. package/dist/esm/Tour/style/style.css +1 -1
  10. package/dist/esm/Uploader/style/style.css +1 -1
  11. package/dist/esm/Uploader.js +4 -2
  12. package/dist/esm/Video.js +14 -2
  13. package/dist/esm/formitem2.js +136 -76
  14. package/dist/locales/base.js +1 -1
  15. package/dist/locales/en-US.js +1 -1
  16. package/dist/locales/id-ID.js +1 -1
  17. package/dist/locales/tr-TR.js +1 -1
  18. package/dist/locales/zh-CN.js +1 -1
  19. package/dist/locales/zh-TW.js +1 -1
  20. package/dist/locales/zh-UG.js +1 -1
  21. package/dist/nutui.react.es.js +198 -107
  22. package/dist/nutui.react.umd.js +198 -107
  23. package/dist/packages/animate/animate.scss +0 -3
  24. package/dist/packages/form/form.scss +0 -68
  25. package/dist/packages/formitem/formitem.scss +90 -21
  26. package/dist/packages/popover/popover.scss +16 -11
  27. package/dist/packages/table/table.scss +1 -0
  28. package/dist/packages/uploader/uploader.scss +2 -1
  29. package/dist/style.css +1 -1
  30. package/dist/styles/variables.scss +1 -0
  31. package/dist/types/packages/configprovider/types.d.ts +1 -1
  32. package/dist/types/packages/empty/types.d.ts +10 -1
  33. package/dist/types/packages/empty/utils.d.ts +2 -0
  34. package/dist/types/packages/form/form.d.ts +10 -0
  35. package/dist/types/packages/form/form.taro.d.ts +2 -0
  36. package/dist/types/packages/form/types.d.ts +2 -1
  37. package/dist/types/packages/formitem/formitem.d.ts +1 -0
  38. package/dist/types/packages/formitem/formitem.taro.d.ts +1 -0
  39. package/dist/types/packages/video/video.d.ts +6 -2
  40. package/dist/types/utils/merge.d.ts +1 -0
  41. package/dist/types/utils/to-array.d.ts +1 -0
  42. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.7.1 Fri Nov 22 2024 15:44:59 GMT+0800 (Central Standard Time)
2
+ * @nutui/nutui-react v2.7.3 Fri Dec 13 2024 15:50:56 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -5314,7 +5314,7 @@ function eachProp(obj, fn, ctx2) {
5314
5314
  }
5315
5315
  }
5316
5316
  }
5317
- const toArray = (a) => is.und(a) ? [] : is.arr(a) ? a : [a];
5317
+ const toArray$1 = (a) => is.und(a) ? [] : is.arr(a) ? a : [a];
5318
5318
  function flush(queue, iterator) {
5319
5319
  if (queue.size) {
5320
5320
  const items = Array.from(queue);
@@ -6322,7 +6322,7 @@ function _extends$1() {
6322
6322
  function callProp(value, ...args) {
6323
6323
  return is.fun(value) ? value(...args) : value;
6324
6324
  }
6325
- const matchProp = (value, key) => value === true || !!(key && value && (is.fun(value) ? value(key) : toArray(value).includes(key)));
6325
+ const matchProp = (value, key) => value === true || !!(key && value && (is.fun(value) ? value(key) : toArray$1(value).includes(key)));
6326
6326
  const resolveProp = (prop, key) => is.obj(prop) ? key && prop[key] : prop;
6327
6327
  const getDefaultProp = (props, key) => props.default === true ? props[key] : props.default ? props.default[key] : void 0;
6328
6328
  const noopTransform = (value) => value;
@@ -6864,7 +6864,7 @@ class SpringValue extends FrameValue {
6864
6864
  } = anim;
6865
6865
  const payload = getPayload(anim.to);
6866
6866
  if (!payload && hasFluidValue(anim.to)) {
6867
- toValues = toArray(getFluidValue(anim.to));
6867
+ toValues = toArray$1(getFluidValue(anim.to));
6868
6868
  }
6869
6869
  anim.values.forEach((node2, i2) => {
6870
6870
  if (node2.done) return;
@@ -7217,7 +7217,7 @@ class SpringValue extends FrameValue {
7217
7217
  if (!hasAsyncTo) {
7218
7218
  if (started || hasFluidValue(prevTo)) {
7219
7219
  anim.values = node.getPayload();
7220
- anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray(goal);
7220
+ anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray$1(goal);
7221
7221
  }
7222
7222
  if (anim.immediate != immediate) {
7223
7223
  anim.immediate = immediate;
@@ -7490,7 +7490,7 @@ class Controller2 {
7490
7490
  queue
7491
7491
  } = this;
7492
7492
  if (props) {
7493
- queue = toArray(props).map(createUpdate);
7493
+ queue = toArray$1(props).map(createUpdate);
7494
7494
  } else {
7495
7495
  this.queue = [];
7496
7496
  }
@@ -7506,7 +7506,7 @@ class Controller2 {
7506
7506
  }
7507
7507
  if (keys) {
7508
7508
  const springs = this.springs;
7509
- each(toArray(keys), (key) => springs[key].stop(!!arg));
7509
+ each(toArray$1(keys), (key) => springs[key].stop(!!arg));
7510
7510
  } else {
7511
7511
  stopAsync(this._state, this._lastAsyncId);
7512
7512
  this.each((spring) => spring.stop(!!arg));
@@ -7520,7 +7520,7 @@ class Controller2 {
7520
7520
  });
7521
7521
  } else {
7522
7522
  const springs = this.springs;
7523
- each(toArray(keys), (key) => springs[key].pause());
7523
+ each(toArray$1(keys), (key) => springs[key].pause());
7524
7524
  }
7525
7525
  return this;
7526
7526
  }
@@ -7531,7 +7531,7 @@ class Controller2 {
7531
7531
  });
7532
7532
  } else {
7533
7533
  const springs = this.springs;
7534
- each(toArray(keys), (key) => springs[key].resume());
7534
+ each(toArray$1(keys), (key) => springs[key].resume());
7535
7535
  }
7536
7536
  return this;
7537
7537
  }
@@ -7682,7 +7682,7 @@ async function flushUpdate(ctrl, props, isLoop) {
7682
7682
  function getSprings(ctrl, props) {
7683
7683
  const springs = _extends$1({}, ctrl.springs);
7684
7684
  if (props) {
7685
- each(toArray(props), (props2) => {
7685
+ each(toArray$1(props), (props2) => {
7686
7686
  if (is.und(props2.keys)) {
7687
7687
  props2 = createUpdate(props2);
7688
7688
  }
@@ -7954,7 +7954,7 @@ class Interpolation extends FrameValue {
7954
7954
  }
7955
7955
  }
7956
7956
  _get() {
7957
- const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray(getFluidValue(this.source));
7957
+ const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray$1(getFluidValue(this.source));
7958
7958
  return this.calc(...inputs);
7959
7959
  }
7960
7960
  _start() {
@@ -7973,7 +7973,7 @@ class Interpolation extends FrameValue {
7973
7973
  }
7974
7974
  _attach() {
7975
7975
  let priority2 = 1;
7976
- each(toArray(this.source), (source) => {
7976
+ each(toArray$1(this.source), (source) => {
7977
7977
  if (hasFluidValue(source)) {
7978
7978
  addFluidObserver(source, this);
7979
7979
  }
@@ -7988,7 +7988,7 @@ class Interpolation extends FrameValue {
7988
7988
  this._start();
7989
7989
  }
7990
7990
  _detach() {
7991
- each(toArray(this.source), (source) => {
7991
+ each(toArray$1(this.source), (source) => {
7992
7992
  if (hasFluidValue(source)) {
7993
7993
  removeFluidObserver(source, this);
7994
7994
  }
@@ -8007,7 +8007,7 @@ class Interpolation extends FrameValue {
8007
8007
  } else if (event.type == "idle") {
8008
8008
  this._active.delete(event.parent);
8009
8009
  } else if (event.type == "priority") {
8010
- this.priority = toArray(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0);
8010
+ this.priority = toArray$1(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0);
8011
8011
  }
8012
8012
  }
8013
8013
  }
@@ -8169,7 +8169,7 @@ class AnimatedStyle extends AnimatedObject {
8169
8169
  delete style[key];
8170
8170
  if (is.und(value)) return;
8171
8171
  const unit = pxTransforms.test(key) ? "px" : degTransforms.test(key) ? "deg" : "";
8172
- inputs.push(toArray(value));
8172
+ inputs.push(toArray$1(value));
8173
8173
  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)]);
8174
8174
  }
8175
8175
  });
@@ -13701,6 +13701,25 @@ Schema.register = function register(type4, validator) {
13701
13701
  Schema.warning = warning;
13702
13702
  Schema.messages = messages;
13703
13703
  Schema.validators = validators;
13704
+ function merge(...objects) {
13705
+ const result = Array.isArray(objects[0]) ? [] : {};
13706
+ function mergeHelper(obj, path = []) {
13707
+ for (const [key, value] of Object.entries(obj)) {
13708
+ const newPath = [...path, key];
13709
+ if (Array.isArray(value)) {
13710
+ result[key] = [...value];
13711
+ } else if (typeof value === "object" && value !== null) {
13712
+ if (path.some((p2) => p2 === value)) continue;
13713
+ if (!result[key]) result[key] = {};
13714
+ mergeHelper(value, newPath);
13715
+ } else {
13716
+ result[key] = value;
13717
+ }
13718
+ }
13719
+ }
13720
+ objects.filter((obj) => !!obj).forEach((obj) => mergeHelper(obj));
13721
+ return result;
13722
+ }
13704
13723
  const SECRET = "NUT_FORM_INTERNAL";
13705
13724
  class FormStore {
13706
13725
  constructor() {
@@ -13733,17 +13752,16 @@ class FormStore {
13733
13752
  });
13734
13753
  return fieldsValue;
13735
13754
  };
13736
- this.setInitialValues = (values, init) => {
13755
+ this.setInitialValues = (initialValues, init) => {
13756
+ this.initialValues = initialValues || {};
13737
13757
  if (init) {
13738
- this.initialValues = values;
13739
- this.store = values;
13758
+ const nextStore = merge(initialValues, this.store);
13759
+ this.updateStore(nextStore);
13740
13760
  }
13741
13761
  };
13742
- this.setFieldsValue = (newStore, needValidate = true) => {
13743
- this.store = {
13744
- ...this.store,
13745
- ...newStore
13746
- };
13762
+ this.setFieldsValue = (newStore) => {
13763
+ const nextStore = merge(this.store, newStore);
13764
+ this.updateStore(nextStore);
13747
13765
  this.fieldEntities.forEach((entity) => {
13748
13766
  const { name } = entity.props;
13749
13767
  Object.keys(newStore).forEach((key) => {
@@ -13761,7 +13779,12 @@ class FormStore {
13761
13779
  item.entity.onStoreChange("update");
13762
13780
  }
13763
13781
  });
13764
- needValidate && this.validateFields();
13782
+ };
13783
+ this.setFieldValue = (name, value) => {
13784
+ const store = {
13785
+ [name]: value
13786
+ };
13787
+ this.setFieldsValue(store);
13765
13788
  };
13766
13789
  this.setCallback = (callback) => {
13767
13790
  this.callbacks = {
@@ -13769,46 +13792,55 @@ class FormStore {
13769
13792
  ...callback
13770
13793
  };
13771
13794
  };
13772
- this.validateFields = async (nameList) => {
13795
+ this.validateEntities = async (entity, errs) => {
13773
13796
  var _a;
13774
- let filterEntitys = [];
13775
- const errs = [];
13797
+ const { name, rules: rules2 = [] } = entity.props;
13798
+ if (!name) {
13799
+ console.warn("Form field missing name property");
13800
+ return;
13801
+ }
13802
+ const descriptor = {};
13803
+ if (rules2.length) {
13804
+ if (rules2.length > 1) {
13805
+ descriptor[name] = [];
13806
+ rules2.forEach((v) => {
13807
+ descriptor[name].push(v);
13808
+ });
13809
+ } else {
13810
+ descriptor[name] = rules2[0];
13811
+ }
13812
+ }
13813
+ const validator = new Schema(descriptor);
13814
+ try {
13815
+ await validator.validate({ [name]: (_a = this.store) == null ? void 0 : _a[name] });
13816
+ } catch ({ errors }) {
13817
+ if (errors) {
13818
+ errs.push(...errors);
13819
+ this.errors[name] = errors;
13820
+ }
13821
+ } finally {
13822
+ if (!errs || errs.length === 0) {
13823
+ this.errors[name] = [];
13824
+ }
13825
+ }
13826
+ entity.onStoreChange("validate");
13827
+ };
13828
+ this.validateFields = async (nameList) => {
13829
+ let filterEntities = [];
13776
13830
  this.errors.length = 0;
13777
13831
  if (!nameList || nameList.length === 0) {
13778
- filterEntitys = this.fieldEntities;
13832
+ filterEntities = this.fieldEntities;
13779
13833
  } else {
13780
- filterEntitys = this.fieldEntities.filter(
13834
+ filterEntities = this.fieldEntities.filter(
13781
13835
  ({ props: { name } }) => nameList.includes(name)
13782
13836
  );
13783
13837
  }
13784
- for (const entity of filterEntitys) {
13785
- const { name, rules: rules2 = [] } = entity.props;
13786
- const descriptor = {};
13787
- if (rules2.length) {
13788
- if (rules2.length > 1) {
13789
- descriptor[name] = [];
13790
- rules2.forEach((v) => {
13791
- descriptor[name].push(v);
13792
- });
13793
- } else {
13794
- descriptor[name] = rules2[0];
13795
- }
13796
- }
13797
- const validator = new Schema(descriptor);
13798
- try {
13799
- await validator.validate({ [name]: (_a = this.store) == null ? void 0 : _a[name] });
13800
- } catch ({ errors }) {
13801
- if (errors) {
13802
- errs.push(...errors);
13803
- this.errors[name] = errors;
13804
- }
13805
- } finally {
13806
- if (!errs || errs.length === 0) {
13807
- this.errors[name] = [];
13808
- }
13809
- }
13810
- entity.onStoreChange("validate");
13811
- }
13838
+ const errs = [];
13839
+ await Promise.all(
13840
+ filterEntities.map(async (entity) => {
13841
+ await this.validateEntities(entity, errs);
13842
+ })
13843
+ );
13812
13844
  return errs;
13813
13845
  };
13814
13846
  this.submit = async () => {
@@ -13822,7 +13854,8 @@ class FormStore {
13822
13854
  };
13823
13855
  this.resetFields = () => {
13824
13856
  this.errors.length = 0;
13825
- this.store = this.initialValues;
13857
+ const nextStore = merge({}, this.initialValues);
13858
+ this.updateStore(nextStore);
13826
13859
  this.fieldEntities.forEach((entity) => {
13827
13860
  entity.onStoreChange("reset");
13828
13861
  });
@@ -13857,6 +13890,7 @@ class FormStore {
13857
13890
  getFieldValue: this.getFieldValue,
13858
13891
  getFieldsValue: this.getFieldsValue,
13859
13892
  setFieldsValue: this.setFieldsValue,
13893
+ setFieldValue: this.setFieldValue,
13860
13894
  resetFields: this.resetFields,
13861
13895
  validateFields: this.validateFields,
13862
13896
  submit: this.submit,
@@ -13871,6 +13905,9 @@ class FormStore {
13871
13905
  }
13872
13906
  };
13873
13907
  }
13908
+ updateStore(nextStore) {
13909
+ this.store = nextStore;
13910
+ }
13874
13911
  }
13875
13912
  const useForm = (form) => {
13876
13913
  const formRef = useRef();
@@ -13888,7 +13925,9 @@ const defaultProps$X = {
13888
13925
  ...ComponentDefaults,
13889
13926
  labelPosition: "right",
13890
13927
  starPosition: "left",
13928
+ disabled: false,
13891
13929
  divider: false,
13930
+ validateTrigger: "onChange",
13892
13931
  onFinish: (values) => {
13893
13932
  },
13894
13933
  onFinishFailed: (values, errorFields) => {
@@ -13909,8 +13948,10 @@ const Form = React__default.forwardRef(
13909
13948
  children,
13910
13949
  initialValues,
13911
13950
  divider,
13951
+ disabled,
13912
13952
  onFinish,
13913
13953
  onFinishFailed,
13954
+ validateTrigger,
13914
13955
  labelPosition,
13915
13956
  starPosition,
13916
13957
  form
@@ -13957,7 +13998,13 @@ const Form = React__default.forwardRef(
13957
13998
  resetFields();
13958
13999
  }
13959
14000
  },
13960
- /* @__PURE__ */ React__default.createElement(Cell.Group, { divider }, /* @__PURE__ */ React__default.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React__default.createElement(Cell, { className: `${classPrefix2}-footer` }, footer) : null)
14001
+ /* @__PURE__ */ React__default.createElement(Cell.Group, { divider }, /* @__PURE__ */ React__default.createElement(
14002
+ Context.Provider,
14003
+ {
14004
+ value: { formInstance, labelPosition, disabled, validateTrigger }
14005
+ },
14006
+ children
14007
+ ), footer ? /* @__PURE__ */ React__default.createElement(Cell, { className: `${classPrefix2}-footer` }, footer) : null)
13961
14008
  );
13962
14009
  }
13963
14010
  );
@@ -13971,6 +14018,12 @@ function isForwardRefComponent(component) {
13971
14018
  }
13972
14019
  ).$$typeof === component.type.$$typeof;
13973
14020
  }
14021
+ function toArray(value) {
14022
+ if (value === void 0 || value === null) {
14023
+ return [];
14024
+ }
14025
+ return Array.isArray(value) ? value : [value];
14026
+ }
13974
14027
  const defaultProps$W = {
13975
14028
  ...ComponentDefaults,
13976
14029
  required: false,
@@ -13978,7 +14031,6 @@ const defaultProps$W = {
13978
14031
  label: "",
13979
14032
  rules: [{ required: false, message: "" }],
13980
14033
  errorMessageAlign: "left",
13981
- validateTrigger: "onChange",
13982
14034
  shouldUpdate: false,
13983
14035
  noStyle: false
13984
14036
  };
@@ -13987,15 +14039,14 @@ const _FormItem = class _FormItem extends React__default.Component {
13987
14039
  super(props);
13988
14040
  this.getControlled = (children) => {
13989
14041
  var _a;
13990
- const { setFieldsValue, getFieldValue } = this.context;
13991
- const { dispatch } = this.context.getInternal(SECRET);
14042
+ const { setFieldsValue, getFieldValue } = this.context.formInstance;
14043
+ const { dispatch } = this.context.formInstance.getInternal(SECRET);
13992
14044
  const { name = "" } = this.props;
13993
- if ((_a = children == null ? void 0 : children.props) == null ? void 0 : _a.defaultValue) {
13994
- console.warn("通过 initialValue 设置初始值");
13995
- }
14045
+ if ((_a = children == null ? void 0 : children.props) == null ? void 0 : _a.defaultValue) ;
13996
14046
  const fieldValue = getFieldValue(name);
13997
14047
  const controlled = {
13998
14048
  ...children.props,
14049
+ className: children.props.className,
13999
14050
  [this.props.valuePropName || "value"]: fieldValue !== void 0 ? fieldValue : this.props.initialValue,
14000
14051
  [this.props.trigger || "onChange"]: (...args) => {
14001
14052
  const originOnChange = children.props[this.props.trigger || "onChange"];
@@ -14006,27 +14057,25 @@ const _FormItem = class _FormItem extends React__default.Component {
14006
14057
  if (this.props.getValueFromEvent) {
14007
14058
  next = this.props.getValueFromEvent(...args);
14008
14059
  }
14009
- setFieldsValue({ [name]: next }, false);
14060
+ setFieldsValue({ [name]: next });
14010
14061
  }
14011
14062
  };
14012
14063
  const { validateTrigger } = this.props;
14013
- let validateTriggers = [this.props.trigger || "onChange"];
14014
- if (validateTrigger) {
14015
- validateTriggers = typeof validateTrigger === "string" ? [validateTrigger] : [...validateTrigger];
14016
- validateTriggers.forEach((trigger) => {
14017
- const originTrigger = controlled[trigger];
14018
- controlled[trigger] = (...args) => {
14019
- if (originTrigger) {
14020
- originTrigger(...args);
14021
- }
14022
- if (this.props.rules && this.props.rules.length) {
14023
- dispatch({
14024
- name: this.props.name
14025
- });
14026
- }
14027
- };
14028
- });
14029
- }
14064
+ const mergedValidateTrigger = validateTrigger || this.context.validateTrigger;
14065
+ const validateTriggers = toArray(mergedValidateTrigger);
14066
+ validateTriggers.forEach((trigger) => {
14067
+ const originTrigger = controlled[trigger];
14068
+ controlled[trigger] = (...args) => {
14069
+ if (originTrigger) {
14070
+ originTrigger(...args);
14071
+ }
14072
+ if (this.props.rules && this.props.rules.length) {
14073
+ dispatch({
14074
+ name: this.props.name
14075
+ });
14076
+ }
14077
+ };
14078
+ });
14030
14079
  if (isForwardRefComponent(children)) {
14031
14080
  controlled.ref = (componentInstance) => {
14032
14081
  const originRef = children.ref;
@@ -14050,7 +14099,7 @@ const _FormItem = class _FormItem extends React__default.Component {
14050
14099
  };
14051
14100
  this.onStoreChange = (type4) => {
14052
14101
  if (type4 === "reset") {
14053
- this.context.errors[this.props.name] = [];
14102
+ this.context.formInstance.errors[this.props.name] = [];
14054
14103
  this.refresh();
14055
14104
  } else {
14056
14105
  this.forceUpdate();
@@ -14071,27 +14120,40 @@ const _FormItem = class _FormItem extends React__default.Component {
14071
14120
  ...this.props
14072
14121
  };
14073
14122
  const requiredInRules = rules2 == null ? void 0 : rules2.some((rule) => rule.required);
14074
- const item = name ? this.context.errors[name] : [];
14075
- const { starPosition } = this.context;
14076
- const renderStar = (required4 || requiredInRules) && /* @__PURE__ */ React__default.createElement("i", { className: "required" });
14077
- const renderLabel = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, starPosition === "left" ? renderStar : null, label, starPosition === "right" ? renderStar : null);
14123
+ const item = name ? this.context.formInstance.errors[name] : [];
14124
+ const { starPosition } = this.context.formInstance;
14125
+ const renderStar = (required4 || requiredInRules) && /* @__PURE__ */ React__default.createElement("div", { className: "nut-form-item-label-required required" }, "*");
14126
+ const renderLabel = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("span", { className: "nut-form-item-labeltxt" }, starPosition === "left" ? renderStar : null, label), starPosition === "right" ? renderStar : null);
14078
14127
  return /* @__PURE__ */ React__default.createElement(
14079
14128
  Cell,
14080
14129
  {
14081
- className: `nut-form-item ${className}`,
14130
+ className: `${this.getClassNameWithDirection("nut-form-item")} ${className}`,
14082
14131
  style,
14083
14132
  align,
14084
14133
  onClick: (e) => this.props.onClick && this.props.onClick(e, this.componentRef)
14085
14134
  },
14086
- label ? /* @__PURE__ */ React__default.createElement("div", { className: "nut-cell-title nut-form-item-label" }, renderLabel) : null,
14087
- /* @__PURE__ */ React__default.createElement("div", { className: "nut-cell-value nut-form-item-body" }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-form-item-body-slots" }, childNode), item && item.length > 0 && /* @__PURE__ */ React__default.createElement(
14135
+ label ? /* @__PURE__ */ React__default.createElement(
14136
+ "div",
14137
+ {
14138
+ className: `nut-cell-title ${this.getClassNameWithDirection("nut-form-item-label")}`
14139
+ },
14140
+ renderLabel
14141
+ ) : null,
14142
+ /* @__PURE__ */ React__default.createElement(
14088
14143
  "div",
14089
14144
  {
14090
- className: "nut-form-item-body-tips",
14091
- style: { textAlign: errorMessageAlign }
14145
+ className: `nut-cell-value ${this.getClassNameWithDirection("nut-form-item-body")}`
14092
14146
  },
14093
- item[0].message
14094
- ))
14147
+ /* @__PURE__ */ React__default.createElement("div", { className: "nut-form-item-body-slots" }, childNode),
14148
+ item && item.length > 0 && /* @__PURE__ */ React__default.createElement(
14149
+ "div",
14150
+ {
14151
+ className: "nut-form-item-body-tips",
14152
+ style: { textAlign: errorMessageAlign }
14153
+ },
14154
+ item[0].message
14155
+ )
14156
+ )
14095
14157
  );
14096
14158
  };
14097
14159
  this.componentRef = React__default.createRef();
@@ -14100,14 +14162,14 @@ const _FormItem = class _FormItem extends React__default.Component {
14100
14162
  };
14101
14163
  }
14102
14164
  componentDidMount() {
14103
- const { store = {}, setInitialValues } = this.context.getInternal(SECRET);
14165
+ const { store = {}, setInitialValues } = this.context.formInstance.getInternal(SECRET);
14104
14166
  if (this.props.initialValue && this.props.name && !Object.keys(store).includes(this.props.name)) {
14105
14167
  setInitialValues(
14106
14168
  { ...store, [this.props.name]: this.props.initialValue },
14107
14169
  true
14108
14170
  );
14109
14171
  }
14110
- const { registerField, registerUpdate } = this.context.getInternal(SECRET);
14172
+ const { registerField, registerUpdate } = this.context.formInstance.getInternal(SECRET);
14111
14173
  this.cancelRegister = registerField(this);
14112
14174
  this.eventOff = registerUpdate(this, this.props.shouldUpdate);
14113
14175
  }
@@ -14119,6 +14181,12 @@ const _FormItem = class _FormItem extends React__default.Component {
14119
14181
  this.eventOff();
14120
14182
  }
14121
14183
  }
14184
+ getClassNameWithDirection(className) {
14185
+ if (className && this.context.labelPosition) {
14186
+ return `${className} ${className}-${this.context.labelPosition}`;
14187
+ }
14188
+ return className;
14189
+ }
14122
14190
  render() {
14123
14191
  const { children } = this.props;
14124
14192
  const child = Array.isArray(children) ? children[0] : children;
@@ -14129,9 +14197,9 @@ const _FormItem = class _FormItem extends React__default.Component {
14129
14197
  this.getControlled(child)
14130
14198
  );
14131
14199
  } else {
14132
- returnChildNode = child(this.context);
14200
+ returnChildNode = child(this.context.formInstance);
14133
14201
  }
14134
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: this.state.resetCount }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode));
14202
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: this.state.resetCount }, /* @__PURE__ */ React__default.createElement("div", { className: this.context.disabled ? "nut-form-item-disabled" : "" }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode)));
14135
14203
  }
14136
14204
  };
14137
14205
  _FormItem.defaultProps = defaultProps$W;
@@ -16884,6 +16952,7 @@ const InternalUploader = (props, ref) => {
16884
16952
  }
16885
16953
  };
16886
16954
  const readFile = (files) => {
16955
+ const results = [];
16887
16956
  files.forEach((file, index) => {
16888
16957
  var _a;
16889
16958
  const formData = new FormData();
@@ -16900,13 +16969,14 @@ const InternalUploader = (props, ref) => {
16900
16969
  const reader = new FileReader();
16901
16970
  reader.onload = (event) => {
16902
16971
  fileItem.url = event.target.result;
16903
- setFileList([...fileList, fileItem]);
16972
+ results.push(fileItem);
16904
16973
  };
16905
16974
  reader.readAsDataURL(file);
16906
16975
  } else {
16907
- setFileList([...fileList, fileItem]);
16976
+ results.push(fileItem);
16908
16977
  }
16909
16978
  });
16979
+ setFileList([...fileList, ...results]);
16910
16980
  };
16911
16981
  const filterFiles = (files) => {
16912
16982
  const maximum = maxCount * 1;
@@ -17578,6 +17648,12 @@ const Drag = (props) => {
17578
17648
  );
17579
17649
  };
17580
17650
  Drag.displayName = "NutDrag";
17651
+ const getButtonType = (actions, index) => {
17652
+ if (!actions || actions.length === 0) return "default";
17653
+ const action = actions[index];
17654
+ if (action.type) return action.type;
17655
+ return actions.length > 1 && index === 0 ? "default" : "primary";
17656
+ };
17581
17657
  const defaultStatus = {
17582
17658
  empty: "https://storage.360buyimg.com/imgtools/30186cfda0-0d3eee40-c0ac-11ee-9382-9125782aa3b8.png",
17583
17659
  error: "https://storage.360buyimg.com/imgtools/f3278d0ebb-0ce360c0-c0ac-11ee-8375-193101bb1a46.png",
@@ -17641,10 +17717,13 @@ const Empty = (props) => {
17641
17717
  [`${classPrefix$e}-actions-right`]: actions.length === 1,
17642
17718
  [`${classPrefix$e}-actions-left`]: actions.length > 1 && index === 0
17643
17719
  }),
17644
- type: `${actions.length > 1 && index === 0 ? "default" : "primary"}`,
17645
- size: "small",
17646
- fill: "outline",
17647
- key: `action-${index}`
17720
+ style: item.style,
17721
+ type: getButtonType(actions, index),
17722
+ size: item.size || "small",
17723
+ fill: item.fill || "outline",
17724
+ disabled: item.disabled || false,
17725
+ key: `action-${index}`,
17726
+ onClick: item.onClick || (() => void 0)
17648
17727
  },
17649
17728
  item == null ? void 0 : item.text
17650
17729
  );
@@ -20558,7 +20637,7 @@ const defaultProps$j = {
20558
20637
  }
20559
20638
  };
20560
20639
  const classPrefix$4 = `nut-video`;
20561
- const Video = (props) => {
20640
+ const Video = React__default.forwardRef((props, ref) => {
20562
20641
  const {
20563
20642
  children,
20564
20643
  source,
@@ -20603,6 +20682,18 @@ const Video = (props) => {
20603
20682
  });
20604
20683
  }
20605
20684
  };
20685
+ const pause = () => {
20686
+ var _a;
20687
+ (_a = rootRef == null ? void 0 : rootRef.current) == null ? void 0 : _a.pause();
20688
+ };
20689
+ const play = () => {
20690
+ var _a;
20691
+ (_a = rootRef == null ? void 0 : rootRef.current) == null ? void 0 : _a.play();
20692
+ };
20693
+ React__default.useImperativeHandle(ref, () => ({
20694
+ pause,
20695
+ play
20696
+ }));
20606
20697
  return /* @__PURE__ */ React__default.createElement("div", { className: classes, ...restProps }, /* @__PURE__ */ React__default.createElement(
20607
20698
  "video",
20608
20699
  {
@@ -20618,7 +20709,7 @@ const Video = (props) => {
20618
20709
  /* @__PURE__ */ React__default.createElement("source", { src: source.src, type: source.type }),
20619
20710
  /* @__PURE__ */ React__default.createElement("track", { kind: "captions" })
20620
20711
  ));
20621
- };
20712
+ });
20622
20713
  Video.displayName = "NutVideo";
20623
20714
  const defaultProps$i = {
20624
20715
  total: 3,