cosey 0.4.17 → 0.4.19

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.
@@ -52,6 +52,6 @@ export interface UseExternalUpsertReturn<Row extends Record<string, any>, Data>
52
52
  edit: (...args: any[]) => void;
53
53
  setData: (data: Data) => void;
54
54
  expose: Readonly<ShallowRef<UseUpsertExpose<Row, Data> | null>>;
55
- ref: string;
55
+ ref: (_expose: any) => void;
56
56
  }
57
57
  export declare function useOuterUpsert<Row extends Record<string, any>, Data>(options: UseExternalUpsertOptions): UseExternalUpsertReturn<Row, Data>;
@@ -1,9 +1,9 @@
1
1
  import { ElMessage } from 'element-plus';
2
2
  import { cloneDeep, pick } from 'lodash-es';
3
- import { useTemplateRef, onMounted, computed, unref, ref, reactive, shallowRef, readonly } from 'vue';
3
+ import { ref, computed, unref, reactive, useTemplateRef, shallowRef, readonly } from 'vue';
4
4
  import { toRefs } from '@vueuse/core';
5
- import { uuid } from '../utils/string.js';
6
5
  import { useLocale } from './useLocale.js';
6
+ import { uuid } from '../utils/string.js';
7
7
  import { deepAssign } from '../utils/object.js';
8
8
 
9
9
  const mapTypeTitle = {
@@ -49,10 +49,10 @@ function useUpsert(options) {
49
49
  let res;
50
50
  if (type.value === "add") {
51
51
  res = await unref(addFetch)?.();
52
- ElMessage.success(unref(addSuccessText) || t("co.common.addSuccess"));
52
+ ElMessage.success(unref(addSuccessText) || t("co.common.operateSuccess"));
53
53
  } else {
54
54
  res = await unref(editFetch)?.();
55
- ElMessage.success(unref(editSuccessText) || t("co.common.editSuccess"));
55
+ ElMessage.success(unref(editSuccessText) || t("co.common.operateSuccess"));
56
56
  }
57
57
  unref(success)?.(res);
58
58
  exposeOptions?.success?.();
@@ -112,8 +112,13 @@ function useUpsert(options) {
112
112
  return result;
113
113
  }
114
114
  function useOuterUpsert(options) {
115
- const refKey = uuid();
116
- const expose = useTemplateRef(refKey);
115
+ const expose = ref(null);
116
+ const vnodeRef = (_expose) => {
117
+ expose.value = _expose;
118
+ if (_expose) {
119
+ _expose.setOptions(options);
120
+ }
121
+ };
117
122
  const add = (...args) => {
118
123
  expose.value?.add(...args);
119
124
  };
@@ -123,15 +128,12 @@ function useOuterUpsert(options) {
123
128
  const setData = (data) => {
124
129
  expose.value?.setData(data);
125
130
  };
126
- onMounted(() => {
127
- expose.value?.setOptions(options);
128
- });
129
131
  const result = {
130
132
  add,
131
133
  edit,
132
134
  setData,
133
135
  expose,
134
- ref: refKey
136
+ ref: vnodeRef
135
137
  };
136
138
  return result;
137
139
  }
@@ -1,4 +1,4 @@
1
- import { defineComponent, useTemplateRef, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, renderSlot } from 'vue';
1
+ import { defineComponent, useTemplateRef, ref, onMounted, nextTick, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, renderSlot } from 'vue';
2
2
  import { useLayoutStore } from '../../store/layout.js';
3
3
  import stdin_default$1 from './style/index.js';
4
4
  import { useDir } from '../../hooks/useDir.js';
@@ -19,12 +19,19 @@ var stdin_default = /* @__PURE__ */defineComponent({
19
19
  const layoutStore = useLayoutStore();
20
20
  const sidebarRef = useTemplateRef("sidebar");
21
21
  const dir = useDir(sidebarRef);
22
+ const isMounted = ref(false);
23
+ onMounted(() => {
24
+ nextTick(() => {
25
+ isMounted.value = true;
26
+ });
27
+ });
22
28
  const sidebarStyle = computed(() => {
23
29
  const marginBlockStart = layoutStore.isMobile || !layoutStore.includeHorizontal ? 0 : layoutStore.topbarHeight;
24
30
  return {
25
31
  marginBlockStart: marginBlockStart + "px",
26
32
  height: `calc(100vh - ${marginBlockStart}px)`,
27
- transform: !layoutStore.sidebarVisible ? `translateX(${dir.value === "ltr" ? "-100%" : "100%"})` : void 0
33
+ transform: !layoutStore.sidebarVisible ? `translateX(${dir.value === "ltr" ? "-100%" : "100%"})` : void 0,
34
+ transition: isMounted.value ? void 0 : "none"
28
35
  };
29
36
  });
30
37
  return (_ctx, _cache) => {
@@ -10,6 +10,7 @@ declare const _default: {
10
10
  reload: string;
11
11
  addSuccess: string;
12
12
  editSuccess: string;
13
+ operateSuccess: string;
13
14
  exportSuccess: string;
14
15
  add: string;
15
16
  edit: string;
package/locale/lang/ar.js CHANGED
@@ -13,6 +13,7 @@ var stdin_default = {
13
13
  reload: "\u062A\u062D\u062F\u064A\u062B",
14
14
  addSuccess: "\u062A\u0645\u062A \u0627\u0644\u0625\u0636\u0627\u0641\u0629 \u0628\u0646\u062C\u0627\u062D",
15
15
  editSuccess: "\u062A\u0645 \u0627\u0644\u062A\u0639\u062F\u064A\u0644 \u0628\u0646\u062C\u0627\u062D",
16
+ operateSuccess: "\u062A\u0645\u062A \u0627\u0644\u0639\u0645\u0644\u064A\u0629 \u0628\u0646\u062C\u0627\u062D",
16
17
  exportSuccess: "\u062A\u0645 \u0627\u0644\u062A\u0635\u062F\u064A\u0631 \u0628\u0646\u062C\u0627\u062D",
17
18
  add: "\u0625\u0636\u0627\u0641\u0629",
18
19
  edit: "\u062A\u0639\u062F\u064A\u0644",
@@ -9,6 +9,7 @@ declare const _default: {
9
9
  noData: string;
10
10
  addSuccess: string;
11
11
  editSuccess: string;
12
+ operateSuccess: string;
12
13
  exportSuccess: string;
13
14
  add: string;
14
15
  edit: string;
package/locale/lang/en.js CHANGED
@@ -12,6 +12,7 @@ var stdin_default = {
12
12
  noData: "No Data",
13
13
  addSuccess: "Add successfully",
14
14
  editSuccess: "Edit successfully",
15
+ operateSuccess: "Operation successfully",
15
16
  exportSuccess: "Export successfully",
16
17
  add: "Add",
17
18
  edit: "Edit",
@@ -10,6 +10,7 @@ declare const _default: {
10
10
  reload: string;
11
11
  addSuccess: string;
12
12
  editSuccess: string;
13
+ operateSuccess: string;
13
14
  exportSuccess: string;
14
15
  add: string;
15
16
  edit: string;
@@ -13,6 +13,7 @@ var stdin_default = {
13
13
  reload: "\u5237\u65B0",
14
14
  addSuccess: "\u65B0\u589E\u6210\u529F",
15
15
  editSuccess: "\u7F16\u8F91\u6210\u529F",
16
+ operateSuccess: "\u64CD\u4F5C\u6210\u529F",
16
17
  exportSuccess: "\u5BFC\u51FA\u6210\u529F",
17
18
  add: "\u65B0\u589E",
18
19
  edit: "\u7F16\u8F91",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.4.17",
3
+ "version": "0.4.19",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",