@skyfox2000/webui 1.4.8 → 1.4.9

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.
package/lib/webui.es.js CHANGED
@@ -1760,11 +1760,13 @@ const fl = /* @__PURE__ */ C({
1760
1760
  { immediate: !0 }
1761
1761
  );
1762
1762
  const d = () => {
1763
- const r = i.value.reduce(
1763
+ let r;
1764
+ e.selectList && e.selectList.length > 0 ? (r = { ...e.value }, i.value.forEach((v) => {
1765
+ v.field && (r[v.field] = v.value);
1766
+ })) : r = i.value.reduce(
1764
1767
  (v, u) => (u.field && (v[u.field] = u.value), v),
1765
1768
  {}
1766
- );
1767
- c = !0, t("update:value", r);
1769
+ ), c = !0, t("update:value", r);
1768
1770
  }, o = () => {
1769
1771
  i.value.push({
1770
1772
  id: Date.now() + Math.random(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyfox2000/webui",
3
- "version": "1.4.8",
3
+ "version": "1.4.9",
4
4
  "description": "后台前端通用组件定义",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -80,15 +80,29 @@ watch(
80
80
  );
81
81
 
82
82
  const updateConfig = () => {
83
- const newConfig = configList.value.reduce(
84
- (acc: Record<string, string>, item: PropConfigItem) => {
83
+ let newConfig: Record<string, string>;
84
+
85
+ if (props.selectList && props.selectList.length > 0) {
86
+ // 有selectList时,只更新selectList中定义的字段,保留其他字段不变
87
+ newConfig = { ...props.value };
88
+ configList.value.forEach((item: PropConfigItem) => {
85
89
  if (item.field) {
86
- acc[item.field] = item.value;
90
+ newConfig[item.field] = item.value;
87
91
  }
88
- return acc;
89
- },
90
- {} as Record<string, string>,
91
- );
92
+ });
93
+ } else {
94
+ // 没有selectList时,更新所有字段
95
+ newConfig = configList.value.reduce(
96
+ (acc: Record<string, string>, item: PropConfigItem) => {
97
+ if (item.field) {
98
+ acc[item.field] = item.value;
99
+ }
100
+ return acc;
101
+ },
102
+ {} as Record<string, string>,
103
+ );
104
+ }
105
+
92
106
  isInnerChange = true;
93
107
  emit('update:value', newConfig);
94
108
  };