@dt-frames/ui 2.0.22 → 2.0.24

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.
@@ -906,6 +906,7 @@ function useFormEvents({
906
906
  }
907
907
  function _setValue(data, isReset = false) {
908
908
  data = isArray(data) ? data : [data];
909
+ let oldValues = getFormValues();
909
910
  let obj = {};
910
911
  data.map((it) => {
911
912
  let name = isArray(it.name) ? it.name[0] : it.name;
@@ -917,15 +918,24 @@ function useFormEvents({
917
918
  obj[name] = props.defaultValue;
918
919
  });
919
920
  if (isReset) {
920
- let oldValues = getFormValues();
921
921
  let oldObj = {};
922
922
  Object.keys(oldValues).map((key) => oldObj[key] = null);
923
923
  obj = {
924
924
  ...oldObj,
925
925
  ...obj
926
926
  };
927
+ setFormValues(obj);
928
+ } else {
929
+ Object.keys(obj).forEach((key) => {
930
+ if (obj[key] !== null) {
931
+ obj[key];
932
+ }
933
+ });
934
+ setFormValues({
935
+ ...obj,
936
+ ...oldValues
937
+ });
927
938
  }
928
- setFormValues(obj);
929
939
  }
930
940
  async function clearValidate(name) {
931
941
  await unref(formElRef)?.clearValidate(name);
@@ -1051,7 +1061,7 @@ function useFormValues({
1051
1061
  if (!isObject(model))
1052
1062
  return {};
1053
1063
  const vals = {};
1054
- let comMap = getComMap();
1064
+ let comMap = getComMap(), extraNames = [];
1055
1065
  for (let [key, val] of Object.entries(model)) {
1056
1066
  let component = comMap.get(key)?.component;
1057
1067
  if (!key || Array.isArray(val) && val.length === 0 || isFunction(val)) {
@@ -1059,11 +1069,12 @@ function useFormValues({
1059
1069
  }
1060
1070
  if (component) {
1061
1071
  if (SINGLE_DATA_TYPE.includes(component)) {
1062
- val = dayjs(val).valueOf();
1072
+ val = val ? dayjs(val).valueOf() : null;
1063
1073
  } else if (MULTIFY_DATA_TYPE.includes(component)) {
1064
1074
  val = (val || []).map((it) => dayjs(it).valueOf());
1065
1075
  if (comMap.get(key).extraName?.length) {
1066
1076
  comMap.get(key).extraName.map((it, i) => {
1077
+ extraNames.push(it);
1067
1078
  set(vals, it, val.length > 0 ? val[i] : null);
1068
1079
  });
1069
1080
  }
@@ -1072,7 +1083,9 @@ function useFormValues({
1072
1083
  if (isString(val)) {
1073
1084
  val = val.trim();
1074
1085
  }
1075
- set(vals, key, val);
1086
+ if (!extraNames.includes(key)) {
1087
+ set(vals, key, val);
1088
+ }
1076
1089
  }
1077
1090
  return vals;
1078
1091
  }
@@ -16,7 +16,7 @@ export declare const BasicProps: {
16
16
  default: () => {};
17
17
  };
18
18
  layout: {
19
- type: PropType<"vertical" | "inline" | "horizontal">;
19
+ type: PropType<"inline" | "horizontal" | "vertical">;
20
20
  default: string;
21
21
  };
22
22
  labelWidth: {
@@ -41,8 +41,8 @@ export declare const BasicProps: {
41
41
  };
42
42
  rowProps: {
43
43
  type: PropType<Partial<import("vue").ExtractPropTypes<{
44
- align: PropType<"middle" | "top" | "bottom" | "stretch">;
45
- justify: PropType<"center" | "space-around" | "space-between" | "end" | "start">;
44
+ align: PropType<"stretch" | "bottom" | "top" | "middle">;
45
+ justify: PropType<"space-around" | "space-between" | "center" | "end" | "start">;
46
46
  prefixCls: StringConstructor;
47
47
  gutter: {
48
48
  type: PropType<import("ant-design-vue/lib/grid/Row").Gutter | [import("ant-design-vue/lib/grid/Row").Gutter, import("ant-design-vue/lib/grid/Row").Gutter]>;
@@ -62,7 +62,7 @@ export declare const BasicProps: {
62
62
  type: NumberConstructor;
63
63
  };
64
64
  size: {
65
- type: PropType<"small" | "large" | "middle">;
65
+ type: PropType<"large" | "small" | "middle">;
66
66
  };
67
67
  disabled: {
68
68
  type: BooleanConstructor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dt-frames/ui",
3
- "version": "2.0.22",
3
+ "version": "2.0.24",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./src/index.ts",