cosey 0.4.26 → 0.4.28

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.
@@ -192,7 +192,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
192
192
  }
193
193
  });
194
194
  onMounted(() => {
195
- if (props.immediate) {
195
+ if (props.immediate && props.api) {
196
196
  execute();
197
197
  }
198
198
  });
@@ -16,6 +16,9 @@ export interface UseUpsertOptions<Model, Row = Model> {
16
16
  onAdd?: (...args: any[]) => void;
17
17
  onEdit?: (row: Row, ...args: any[]) => void;
18
18
  onShow?: () => void;
19
+ onShown?: () => void;
20
+ onShownAdd?: (...args: any[]) => void;
21
+ onShownEdit?: (...args: any[]) => void;
19
22
  detailsFetch?: (row: Row) => any;
20
23
  beforeFill?: (row: Row) => any;
21
24
  addFetch?: () => any;
@@ -1,6 +1,6 @@
1
1
  import { ElMessage } from 'element-plus';
2
2
  import { cloneDeep, pick } from 'lodash-es';
3
- import { ref, computed, unref, reactive, useTemplateRef, shallowRef, readonly } from 'vue';
3
+ import { ref, computed, unref, reactive, useTemplateRef, shallowRef, readonly, nextTick } from 'vue';
4
4
  import { toRefs } from '@vueuse/core';
5
5
  import { useLocale } from './useLocale.js';
6
6
  import { uuid } from '../utils/string.js';
@@ -20,6 +20,9 @@ function useUpsert(options) {
20
20
  onAdd,
21
21
  onEdit,
22
22
  onShow,
23
+ onShown,
24
+ onShownAdd,
25
+ onShownEdit,
23
26
  detailsFetch,
24
27
  beforeFill,
25
28
  addFetch,
@@ -73,6 +76,10 @@ function useUpsert(options) {
73
76
  unref(onEdit)?.(...args);
74
77
  visible.value = true;
75
78
  unref(onShow)?.();
79
+ nextTick(() => {
80
+ unref(onShown)?.();
81
+ unref(onShownEdit)?.(...args);
82
+ });
76
83
  let filledRow = row.value;
77
84
  if (unref(detailsFetch)) {
78
85
  filledRow = await unref(detailsFetch)(row.value);
@@ -88,6 +95,10 @@ function useUpsert(options) {
88
95
  unref(onAdd)?.(...args);
89
96
  visible.value = true;
90
97
  unref(onShow)?.();
98
+ nextTick(() => {
99
+ unref(onShown)?.();
100
+ unref(onShownAdd)?.(...args);
101
+ });
91
102
  },
92
103
  setData: (_data) => {
93
104
  data.value = _data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.4.26",
3
+ "version": "0.4.28",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",