@ebiz/designer-components 0.1.113 → 0.1.114

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/dist/index.mjs CHANGED
@@ -84461,16 +84461,17 @@ const nmt = {
84461
84461
  "error",
84462
84462
  "cancel",
84463
84463
  "detail-loaded",
84464
- "detail-error"
84464
+ "detail-error",
84465
+ "update:data"
84465
84466
  ],
84466
84467
  setup(e, { expose: t, emit: n }) {
84467
84468
  const r = e, a = n, o = W(null), i = W(!1), l = W(null), u = W({}), s = W(r.data || {}), c = R(() => r.rules);
84468
84469
  he(() => r.data, (C) => {
84469
- C && typeof C == "object" && (Object.keys(s.value).forEach((O) => {
84470
- delete s.value[O];
84471
- }), Object.keys(C).forEach((O) => {
84470
+ C && Object.keys(C).forEach((O) => {
84472
84471
  s.value[O] = C[O];
84473
- }));
84472
+ });
84473
+ }, { deep: !0 }), he(s, (C) => {
84474
+ a("update:data", { ...C });
84474
84475
  }, { deep: !0 });
84475
84476
  const d = (C, O = "提交失败") => {
84476
84477
  if (!C) return `${O}: 未知错误`;
@@ -84693,7 +84694,7 @@ const nmt = {
84693
84694
  _: 3
84694
84695
  }, 8, ["class", "colon", "data", "disabled", "label-align", "label-width", "layout", "reset-type", "reset-on-semi-controlled", "rules", "scroll-to-first-error", "show-error-message", "status-icon", "style"]));
84695
84696
  }
84696
- }), bmt = /* @__PURE__ */ mt(ymt, [["__scopeId", "data-v-53fc98bf"]]), wmt = { class: "ebiz-tdesign-button-dialog" }, Cmt = { key: 0 }, Smt = { key: 1 }, Omt = { key: 0 }, xmt = { key: 0 }, Emt = { key: 1 }, kmt = { key: 2 }, Dmt = { class: "delete-confirm-content" }, Pmt = { class: "delete-message" }, _mt = {
84697
+ }), bmt = /* @__PURE__ */ mt(ymt, [["__scopeId", "data-v-7b910ada"]]), wmt = { class: "ebiz-tdesign-button-dialog" }, Cmt = { key: 0 }, Smt = { key: 1 }, Omt = { key: 0 }, xmt = { key: 0 }, Emt = { key: 1 }, kmt = { key: 2 }, Dmt = { class: "delete-confirm-content" }, Pmt = { class: "delete-message" }, _mt = {
84697
84698
  __name: "index",
84698
84699
  props: {
84699
84700
  // 弹窗类型
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebiz/designer-components",
3
- "version": "0.1.113",
3
+ "version": "0.1.114",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -240,7 +240,8 @@ const emit = defineEmits([
240
240
  'error',
241
241
  'cancel',
242
242
  'detail-loaded',
243
- 'detail-error'
243
+ 'detail-error',
244
+ 'update:data'
244
245
  ]);
245
246
 
246
247
  const formRef = ref(null);
@@ -252,21 +253,20 @@ const localFormData = ref(props.data || {});
252
253
  // 合并rules并监听变化
253
254
  const formRules = computed(() => props.rules);
254
255
 
255
- // 监听props的data变化,同步到localFormData
256
- watch(() => props.data, (newData) => {
257
- // 如果外部传入的数据变化,同步更新本地数据
258
- if (newData && typeof newData === 'object') {
259
- // 清空现有数据
260
- Object.keys(localFormData.value).forEach(key => {
261
- delete localFormData.value[key];
262
- });
263
256
 
264
- // 写入新数据
265
- Object.keys(newData).forEach(key => {
266
- localFormData.value[key] = newData[key];
267
- });
268
- }
269
- }, { deep: true });
257
+ // 监听props的data变化,同步到localFormData
258
+ watch(() => props.data, (newFormData) => {
259
+ if (newFormData) {
260
+ // 合并新的表单数据到本地数据
261
+ Object.keys(newFormData).forEach(key => {
262
+ localFormData.value[key] = newFormData[key]
263
+ })
264
+ }
265
+ }, { deep: true })
266
+
267
+ watch(localFormData, (newValue) => {
268
+ emit('update:data', { ...newValue })
269
+ }, { deep: true })
270
270
 
271
271
  /**
272
272
  * 获取错误消息