cosey 0.2.5 → 0.2.7

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.
@@ -1,5 +1,5 @@
1
- import { type TableSlots, type TableExpose } from './table';
2
1
  import { type PaginationProps } from 'element-plus';
2
+ import { type TableSlots, type TableExpose } from './table';
3
3
  import { type TableColumnProps } from './table-column/table-column';
4
4
  type __VLS_Slots = TableSlots;
5
5
  declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
@@ -1,13 +1,13 @@
1
- import { defineComponent, useSlots, computed, unref, useTemplateRef, mergeProps, ref, watch, resolveComponent, resolveDirective, withDirectives, createElementBlock, openBlock, normalizeStyle, normalizeClass, createCommentVNode, createElementVNode, createVNode, createBlock, renderSlot, withCtx, createSlots, Fragment, renderList, normalizeProps, guardReactiveProps } from 'vue';
1
+ import { defineComponent, useSlots, unref, computed, ref, useTemplateRef, mergeProps, watch, resolveComponent, resolveDirective, withDirectives, createElementBlock, openBlock, normalizeStyle, normalizeClass, createCommentVNode, createElementVNode, createVNode, createBlock, renderSlot, withCtx, createSlots, Fragment, renderList, normalizeProps, guardReactiveProps } from 'vue';
2
2
  import { merge, cloneDeep, get } from 'lodash-es';
3
- import { tableProps, defaultTableConfig, elSlotsName, omittedTableProps, defaultPaginationProps, tableExposeKeys } from './table.js';
3
+ import { reactiveComputed, reactiveOmit } from '@vueuse/core';
4
4
  import { useZIndex, ElButton } from 'element-plus';
5
+ import { tableProps, defaultTableConfig, elSlotsName, omittedTableProps, defaultPaginationProps, tableExposeKeys } from './table.js';
5
6
  import stdin_default$6 from './table-column/table-column.vue.js';
6
7
  import stdin_default$5 from './table-column-editor/table-column-editor.vue.js';
7
8
  import stdin_default$2 from './table-query/table-query.vue.js';
8
9
  import stdin_default$4 from './table-export/table-export.vue.js';
9
10
  import stdin_default$3 from '../icon/icon.vue.js';
10
- import { reactiveOmit } from '@vueuse/core';
11
11
  import { filterEmptyFormValue } from './utils.js';
12
12
  import stdin_default$1 from './style/index.js';
13
13
  import { useComponentConfig, useConfig } from '../config-provider/config-provider.js';
@@ -54,17 +54,17 @@ var stdin_default = /* @__PURE__ */defineComponent({
54
54
  const {
55
55
  table
56
56
  } = useConfig();
57
- const tableKeys = computed(() => {
57
+ const tableKeys = reactiveComputed(() => {
58
58
  return merge({}, defaultTableConfig.keys, unref(table)?.keys, props.keys);
59
59
  });
60
60
  const passedElSlotsName = computed(() => {
61
61
  return elSlotsName.filter(name => !!slots[name]);
62
62
  });
63
- const elTableRef = useTemplateRef("table");
63
+ const elTableRef = ref();
64
64
  const tableQueryRef = useTemplateRef("tableQuery");
65
65
  const mapOrderType = {
66
- ascending: tableKeys.value.asc,
67
- descending: tableKeys.value.desc
66
+ ascending: tableKeys.asc,
67
+ descending: tableKeys.desc
68
68
  };
69
69
  let orderParams = null;
70
70
  const onSortChange = ({
@@ -72,8 +72,8 @@ var stdin_default = /* @__PURE__ */defineComponent({
72
72
  order
73
73
  }) => {
74
74
  orderParams = order ? {
75
- [tableKeys.value.orderBy]: prop,
76
- [tableKeys.value.orderType]: mapOrderType[order]
75
+ [tableKeys.orderBy]: prop,
76
+ [tableKeys.orderType]: mapOrderType[order]
77
77
  } : null;
78
78
  page.value = 1;
79
79
  execute();
@@ -106,8 +106,8 @@ var stdin_default = /* @__PURE__ */defineComponent({
106
106
  execute
107
107
  } = useFetch(() => {
108
108
  let params = {
109
- [tableKeys.value.page]: page.value,
110
- [tableKeys.value.pageSize]: pageSize.value,
109
+ [tableKeys.page]: page.value,
110
+ [tableKeys.pageSize]: pageSize.value,
111
111
  ...orderParams,
112
112
  ...filterEmptyFormValue(tableQueryRef.value?.getFieldsValue() || {})
113
113
  };
@@ -117,8 +117,8 @@ var stdin_default = /* @__PURE__ */defineComponent({
117
117
  immediate: props.immediate,
118
118
  onSuccess(res) {
119
119
  res = props.afterFetch?.(res) || res;
120
- tableData.value = (tableKeys.value.list ? get(res, tableKeys.value.list) : res) || [];
121
- total.value = get(res, tableKeys.value.total) || 0;
120
+ tableData.value = (tableKeys.list ? get(res, tableKeys.list) : res) || [];
121
+ total.value = +get(res, tableKeys.total) || 0;
122
122
  elTableRef.value?.setScrollTop(0);
123
123
  },
124
124
  onFinally() {
@@ -345,8 +345,8 @@ var stdin_default = /* @__PURE__ */defineComponent({
345
345
  /* CLASS */)) : createCommentVNode("v-if", true), createElementVNode("div", {
346
346
  class: normalizeClass(`${unref(prefixCls)}-table`)
347
347
  }, [createVNode(_component_el_table, mergeProps({
348
- ref_key: "table",
349
- ref: table
348
+ ref_key: "elTableRef",
349
+ ref: elTableRef
350
350
  }, elTableProps.value, {
351
351
  data: tableData.value,
352
352
  "expand-row-keys": innerExpandRowKeys.value,
@@ -1,8 +1,9 @@
1
- import { defineComponent, ref, resolveComponent, resolveDirective, createBlock, openBlock, withCtx, createElementVNode, normalizeClass, unref, createVNode, toDisplayString, createCommentVNode, resolveDynamicComponent, withDirectives, createElementBlock } from 'vue';
1
+ import { defineComponent, ref, resolveComponent, createBlock, openBlock, withCtx, createVNode, normalizeClass, unref, createElementVNode, toDisplayString, createCommentVNode, resolveDynamicComponent } from 'vue';
2
2
  import { useRouter } from 'vue-router';
3
3
  import { useGlobalConfig } from '../../config/index.js';
4
4
  import { useUserStore } from '../../store/user.js';
5
5
  import stdin_default$1 from './style/index.js';
6
+ import { ElLoading } from 'element-plus';
6
7
  import { useLocale } from '../../hooks/useLocale.js';
7
8
  import { useComponentConfig } from '../../components/config-provider/config-provider.js';
8
9
  import { Icon as _Icon } from '../../components/icon/index.js';
@@ -39,19 +40,26 @@ var stdin_default = /* @__PURE__ */defineComponent({
39
40
  };
40
41
  const fullscreenLoading = ref(false);
41
42
  const logout = () => {
43
+ if (fullscreenLoading.value) return;
42
44
  fullscreenLoading.value = true;
45
+ const loading = ElLoading.service({
46
+ lock: true,
47
+ text: t("co.auth.loggingOut")
48
+ });
43
49
  userStore.logout().finally(() => {
44
50
  fullscreenLoading.value = false;
51
+ loading.close();
45
52
  });
46
53
  };
47
54
  return (_ctx, _cache) => {
48
55
  const _component_el_avatar = resolveComponent("el-avatar");
56
+ const _component_el_button = resolveComponent("el-button");
49
57
  const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
50
58
  const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
51
59
  const _component_el_dropdown = resolveComponent("el-dropdown");
52
- const _directive_loading = resolveDirective("loading");
53
60
  return openBlock(), createBlock(_component_el_dropdown, {
54
- placement: "bottom"
61
+ placement: "bottom",
62
+ trigger: "click"
55
63
  }, {
56
64
  dropdown: withCtx(() => [createVNode(_component_el_dropdown_menu, {
57
65
  class: normalizeClass([unref(hashId), `${unref(prefixCls)}-dropdown`])
@@ -85,38 +93,39 @@ var stdin_default = /* @__PURE__ */defineComponent({
85
93
  divided: "",
86
94
  onClick: logout
87
95
  }, {
88
- default: withCtx(() => [withDirectives((openBlock(), createElementBlock("div", null, [createVNode(unref(_Icon), {
96
+ default: withCtx(() => [createVNode(unref(_Icon), {
89
97
  name: "co:logout",
90
98
  size: "lg"
91
99
  }), createElementVNode("span", {
92
100
  class: normalizeClass(`${unref(prefixCls)}-item-title`)
93
101
  }, toDisplayString(unref(t)("co.auth.logout")), 3
94
- /* TEXT, CLASS */)])), [[_directive_loading, fullscreenLoading.value, void 0, {
95
- fullscreen: true,
96
- lock: true
97
- }]])]),
102
+ /* TEXT, CLASS */)]),
98
103
  _: 1
99
104
  /* STABLE */
100
105
  })]),
101
106
  _: 1
102
107
  /* STABLE */
103
108
  }, 8, ["class"])]),
104
- default: withCtx(() => [createElementVNode("div", {
109
+ default: withCtx(() => [createVNode(_component_el_button, {
110
+ link: "",
105
111
  class: normalizeClass([unref(hashId), unref(prefixCls)])
106
- }, [createVNode(_component_el_avatar, {
107
- size: 32,
108
- src: unref(userStore).userInfo?.avatar
109
112
  }, {
110
- default: withCtx(() => [createVNode(unref(_Icon), {
111
- name: "co:user"
112
- })]),
113
+ default: withCtx(() => [createVNode(_component_el_avatar, {
114
+ size: 32,
115
+ src: unref(userStore).userInfo?.avatar
116
+ }, {
117
+ default: withCtx(() => [createVNode(unref(_Icon), {
118
+ name: "co:user"
119
+ })]),
120
+ _: 1
121
+ /* STABLE */
122
+ }, 8, ["src"]), createElementVNode("span", {
123
+ class: normalizeClass(`${unref(prefixCls)}-name`)
124
+ }, toDisplayString(unref(userStore).userInfo?.nickname), 3
125
+ /* TEXT, CLASS */)]),
113
126
  _: 1
114
127
  /* STABLE */
115
- }, 8, ["src"]), createElementVNode("span", {
116
- class: normalizeClass(`${unref(prefixCls)}-name`)
117
- }, toDisplayString(unref(userStore).userInfo?.nickname), 3
118
- /* TEXT, CLASS */)], 2
119
- /* CLASS */)]),
128
+ }, 8, ["class"])]),
120
129
  _: 1
121
130
  /* STABLE */
122
131
  });
@@ -9,8 +9,15 @@ var stdin_default = getSimpleStyleHook("LayoutUserMenu", (token) => {
9
9
  alignItems: "center",
10
10
  borderRadius: token.borderRadius,
11
11
  cursor: "pointer",
12
- "&:focus-visible": {
13
- outline: "none"
12
+ "&:hover": {
13
+ img: {
14
+ opacity: 0.6
15
+ }
16
+ },
17
+ "&:active": {
18
+ img: {
19
+ opacity: 1
20
+ }
14
21
  },
15
22
  [`${componentCls}-name`]: {
16
23
  marginInlineStart: token.marginXS,
@@ -102,6 +102,7 @@ declare const _default: {
102
102
  enterPassword: string;
103
103
  password: string;
104
104
  logout: string;
105
+ loggingOut: string;
105
106
  };
106
107
  tabbar: {
107
108
  closeLeftTabs: string;
package/locale/lang/ar.js CHANGED
@@ -104,7 +104,8 @@ var stdin_default = {
104
104
  username: "\u0627\u0633\u0645 \u0627\u0644\u0645\u0633\u062A\u062E\u062F\u0645",
105
105
  enterPassword: "\u0627\u0644\u0631\u062C\u0627\u0621 \u0625\u062F\u062E\u0627\u0644 \u0643\u0644\u0645\u0629 \u0627\u0644\u0645\u0631\u0648\u0631",
106
106
  password: "\u0643\u0644\u0645\u0629 \u0627\u0644\u0645\u0631\u0648\u0631",
107
- logout: "\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062E\u0631\u0648\u062C"
107
+ logout: "\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062E\u0631\u0648\u062C",
108
+ loggingOut: "\u062C\u0627\u0631\u064A \u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062E\u0631\u0648\u062C..."
108
109
  },
109
110
  tabbar: {
110
111
  closeLeftTabs: "\u0625\u063A\u0644\u0627\u0642 \u0639\u0644\u0627\u0645\u0627\u062A \u0627\u0644\u062A\u0628\u0648\u064A\u0628 \u0627\u0644\u064A\u0633\u0631\u0649",
@@ -102,6 +102,7 @@ declare const _default: {
102
102
  enterPassword: string;
103
103
  password: string;
104
104
  logout: string;
105
+ loggingOut: string;
105
106
  };
106
107
  tabbar: {
107
108
  closeLeftTabs: string;
package/locale/lang/en.js CHANGED
@@ -104,7 +104,8 @@ var stdin_default = {
104
104
  username: "Username",
105
105
  enterPassword: "Please enter your password",
106
106
  password: "Password",
107
- logout: "Logout"
107
+ logout: "Logout",
108
+ loggingOut: "Logging out..."
108
109
  },
109
110
  tabbar: {
110
111
  closeLeftTabs: "Close tabs to the left",
@@ -102,6 +102,7 @@ declare const _default: {
102
102
  enterPassword: string;
103
103
  password: string;
104
104
  logout: string;
105
+ loggingOut: string;
105
106
  };
106
107
  tabbar: {
107
108
  closeLeftTabs: string;
@@ -104,7 +104,8 @@ var stdin_default = {
104
104
  username: "\u7528\u6237\u540D",
105
105
  enterPassword: "\u8BF7\u8F93\u5165\u5BC6\u7801",
106
106
  password: "\u5BC6\u7801",
107
- logout: "\u9000\u51FA"
107
+ logout: "\u9000\u51FA",
108
+ loggingOut: "\u6B63\u5728\u9000\u51FA"
108
109
  },
109
110
  tabbar: {
110
111
  closeLeftTabs: "\u5173\u95ED\u5DE6\u4FA7\u6807\u7B7E\u9875",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",