cosey 0.2.11 → 0.2.13

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.
@@ -76,7 +76,7 @@ export { defaultBreakpoints, defaultRowProps, generateAlgorithms, rowColumns, ro
76
76
  export { snugMenuContextSymbol } from './snug-menu/snug-menu.js';
77
77
  export { getFocusVisibleStyle, getLineClampStyle, getTruncateStyle } from './style/mixins.js';
78
78
  export { contrarotation, rotation, rotation45, spinner } from './style/animation.js';
79
- export { defaultPaginationProps, defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys, tableProps } from './table/table.js';
79
+ export { defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys, tableProps } from './table/table.js';
80
80
  export { useTable } from './table/useTable.js';
81
81
  export { defaultTableActionProps } from './table-action/table-action.js';
82
82
  export { StyleCache, StyleProvider } from './theme/StyleContext.js';
@@ -172,13 +172,8 @@ declare const _Table: {
172
172
  type: import("vue").PropType<(res: any) => any>;
173
173
  };
174
174
  toolbarConfig: {
175
- type: import("vue").PropType<import("./table").ToolbarConfig | false>;
176
- default: () => {
177
- reload: boolean;
178
- export: boolean;
179
- fullScreen: boolean;
180
- setting: boolean;
181
- };
175
+ type: import("vue").PropType<import("./table").ToolbarConfig | boolean>;
176
+ default: boolean;
182
177
  };
183
178
  keys: {
184
179
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
@@ -359,7 +354,7 @@ declare const _Table: {
359
354
  scrollbarTabindex: string | number;
360
355
  allowDragLastColumn: boolean;
361
356
  preserveExpandedContent: boolean;
362
- toolbarConfig: false | import("./table").ToolbarConfig;
357
+ toolbarConfig: boolean | import("./table").ToolbarConfig;
363
358
  }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
364
359
  P: {};
365
360
  B: {};
@@ -538,13 +533,8 @@ declare const _Table: {
538
533
  type: import("vue").PropType<(res: any) => any>;
539
534
  };
540
535
  toolbarConfig: {
541
- type: import("vue").PropType<import("./table").ToolbarConfig | false>;
542
- default: () => {
543
- reload: boolean;
544
- export: boolean;
545
- fullScreen: boolean;
546
- setting: boolean;
547
- };
536
+ type: import("vue").PropType<import("./table").ToolbarConfig | boolean>;
537
+ default: boolean;
548
538
  };
549
539
  keys: {
550
540
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
@@ -706,7 +696,7 @@ declare const _Table: {
706
696
  scrollbarTabindex: string | number;
707
697
  allowDragLastColumn: boolean;
708
698
  preserveExpandedContent: boolean;
709
- toolbarConfig: false | import("./table").ToolbarConfig;
699
+ toolbarConfig: boolean | import("./table").ToolbarConfig;
710
700
  }>;
711
701
  __isFragment?: never;
712
702
  __isTeleport?: never;
@@ -743,13 +733,8 @@ declare const _Table: {
743
733
  type: import("vue").PropType<(res: any) => any>;
744
734
  };
745
735
  toolbarConfig: {
746
- type: import("vue").PropType<import("./table").ToolbarConfig | false>;
747
- default: () => {
748
- reload: boolean;
749
- export: boolean;
750
- fullScreen: boolean;
751
- setting: boolean;
752
- };
736
+ type: import("vue").PropType<import("./table").ToolbarConfig | boolean>;
737
+ default: boolean;
753
738
  };
754
739
  keys: {
755
740
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
@@ -930,7 +915,7 @@ declare const _Table: {
930
915
  scrollbarTabindex: string | number;
931
916
  allowDragLastColumn: boolean;
932
917
  preserveExpandedContent: boolean;
933
- toolbarConfig: false | import("./table").ToolbarConfig;
918
+ toolbarConfig: boolean | import("./table").ToolbarConfig;
934
919
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
935
920
  $slots: import("./table").TableSlots;
936
921
  }) & import("vue").Plugin;
@@ -1,6 +1,6 @@
1
1
  import { withInstall } from '../utils.js';
2
2
  import stdin_default$1 from './table.vue.js';
3
- export { defaultPaginationProps, defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys, tableProps } from './table.js';
3
+ export { defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys, tableProps } from './table.js';
4
4
  export { useTable } from './useTable.js';
5
5
 
6
6
  const _Table = withInstall(stdin_default$1);
@@ -10,6 +10,11 @@ export declare const tableExportProps: {
10
10
  type: PropType<any[]>;
11
11
  default: () => never[];
12
12
  };
13
+ config: {
14
+ type: PropType<boolean | {
15
+ filename: string;
16
+ }>;
17
+ };
13
18
  width: {
14
19
  type: PropType<import("../..").FormDialogWidth>;
15
20
  default: string;
@@ -8,6 +8,9 @@ const tableExportExtraProps = {
8
8
  data: {
9
9
  type: Array,
10
10
  default: () => []
11
+ },
12
+ config: {
13
+ type: [Boolean, Object]
11
14
  }
12
15
  };
13
16
  const tableExportProps = {
@@ -8,6 +8,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
8
8
  type: import("vue").PropType<any[]>;
9
9
  default: () => never[];
10
10
  };
11
+ config: {
12
+ type: import("vue").PropType<boolean | {
13
+ filename: string;
14
+ }>;
15
+ };
11
16
  width: {
12
17
  type: import("vue").PropType<import("../..").FormDialogWidth>;
13
18
  default: string;
@@ -174,6 +179,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
174
179
  type: import("vue").PropType<any[]>;
175
180
  default: () => never[];
176
181
  };
182
+ config: {
183
+ type: import("vue").PropType<boolean | {
184
+ filename: string;
185
+ }>;
186
+ };
177
187
  width: {
178
188
  type: import("vue").PropType<import("../..").FormDialogWidth>;
179
189
  default: string;
@@ -13,6 +13,7 @@ import { exportExcel } from '../../../utils/excel/index.js';
13
13
  import { formatAsBasicDateTime } from '../../../utils/date.js';
14
14
  import { useComponentConfig } from '../../config-provider/config-provider.js';
15
15
  import { useLocale } from '../../../hooks/useLocale.js';
16
+ import { isObject } from '../../../utils/is.js';
16
17
  import { useTreeCheck } from '../../../hooks/useTreeCheck.js';
17
18
  import { walkTree } from '../../../utils/tree.js';
18
19
 
@@ -37,8 +38,11 @@ var stdin_default = /* @__PURE__ */defineComponent({
37
38
  const mergedProps = computed(() => {
38
39
  return mergeProps(reactiveOmit(props, omittedTableExportProps), attrs);
39
40
  });
41
+ const filename = computed(() => {
42
+ return isObject(props.config) ? props.config.filename : "";
43
+ });
40
44
  const getDefaultFilename = () => {
41
- return `${t("co.table.export")}-` + formatAsBasicDateTime(/* @__PURE__ */new Date());
45
+ return filename.value || `${t("co.table.export")}-` + formatAsBasicDateTime(/* @__PURE__ */new Date());
42
46
  };
43
47
  const bookTypeOptions = computed(() => bookFormats.map(bookType => {
44
48
  return {
@@ -4,7 +4,9 @@ import { type TableColumnProps } from './table-column/table-column';
4
4
  import { TableQueryExpose, type TableQueryProps } from './table-query/table-query';
5
5
  export interface ToolbarConfig {
6
6
  reload?: boolean;
7
- export?: boolean;
7
+ export?: boolean | {
8
+ filename: string;
9
+ };
8
10
  fullScreen?: boolean;
9
11
  setting?: boolean;
10
12
  }
@@ -40,13 +42,8 @@ export declare const tableProps: {
40
42
  type: PropType<(res: any) => any>;
41
43
  };
42
44
  toolbarConfig: {
43
- type: PropType<ToolbarConfig | false>;
44
- default: () => {
45
- reload: boolean;
46
- export: boolean;
47
- fullScreen: boolean;
48
- setting: boolean;
49
- };
45
+ type: PropType<ToolbarConfig | boolean>;
46
+ default: boolean;
50
47
  };
51
48
  keys: {
52
49
  type: PropType<TableConfig["keys"]>;
@@ -148,9 +145,6 @@ export interface TableSlots {
148
145
  export declare const elSlotsName: readonly ["default", "append", "empty"];
149
146
  type TableEmitEvents = 'select-all' | 'expand-change' | 'current-change' | 'select' | 'selection-change' | 'cell-mouse-enter' | 'cell-mouse-leave' | 'cell-contextmenu' | 'cell-click' | 'cell-dblclick' | 'row-click' | 'row-contextmenu' | 'row-dblclick' | 'header-click' | 'header-contextmenu' | 'sort-change' | 'filter-change' | 'header-dragend';
150
147
  export type TableEmits = (event: TableEmitEvents, ...args: any[]) => void;
151
- export declare const defaultPaginationProps: {
152
- layout: string;
153
- };
154
148
  export interface TableCustomExpose {
155
149
  reload: () => void;
156
150
  expandAll: () => void;
@@ -211,6 +205,11 @@ export declare const defaultTableConfig: {
211
205
  */
212
206
  desc: string;
213
207
  };
208
+ pagination: {
209
+ layout: string;
210
+ currentPage: number;
211
+ pageSize: number;
212
+ };
214
213
  };
215
214
  export interface TableConfig {
216
215
  keys?: {
@@ -223,5 +222,6 @@ export interface TableConfig {
223
222
  asc?: string;
224
223
  desc?: string;
225
224
  };
225
+ pagination?: Partial<PaginationProps>;
226
226
  }
227
227
  export {};
@@ -35,12 +35,7 @@ const tableExtraProps = {
35
35
  },
36
36
  toolbarConfig: {
37
37
  type: [Object, Boolean],
38
- default: () => ({
39
- reload: true,
40
- export: true,
41
- fullScreen: true,
42
- setting: true
43
- })
38
+ default: true
44
39
  },
45
40
  keys: {
46
41
  type: Object
@@ -52,9 +47,6 @@ const tableProps = {
52
47
  };
53
48
  const omittedTableProps = Object.keys(tableExtraProps);
54
49
  const elSlotsName = ["default", "append", "empty"];
55
- const defaultPaginationProps = {
56
- layout: "prev, pager, next, sizes, jumper, total"
57
- };
58
50
  const elTableExposeKeys = [
59
51
  "clearSelection",
60
52
  "getSelectionRows",
@@ -115,7 +107,12 @@ const defaultTableConfig = {
115
107
  * 排序方向中“降序”的值
116
108
  */
117
109
  desc: "desc"
110
+ },
111
+ pagination: {
112
+ layout: "prev, pager, next, sizes, jumper, total",
113
+ currentPage: 1,
114
+ pageSize: 10
118
115
  }
119
116
  };
120
117
 
121
- export { defaultPaginationProps, defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys, tableProps };
118
+ export { defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys, tableProps };
@@ -1,5 +1,5 @@
1
1
  import { type PaginationProps } from 'element-plus';
2
- import { type TableSlots, type TableExpose } from './table';
2
+ import { type TableSlots, type TableExpose, type ToolbarConfig } 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<{
@@ -34,13 +34,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
34
34
  type: import("vue").PropType<(res: any) => any>;
35
35
  };
36
36
  toolbarConfig: {
37
- type: import("vue").PropType<import("./table").ToolbarConfig | false>;
38
- default: () => {
39
- reload: boolean;
40
- export: boolean;
41
- fullScreen: boolean;
42
- setting: boolean;
43
- };
37
+ type: import("vue").PropType<ToolbarConfig | boolean>;
38
+ default: boolean;
44
39
  };
45
40
  keys: {
46
41
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
@@ -211,13 +206,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
211
206
  type: import("vue").PropType<(res: any) => any>;
212
207
  };
213
208
  toolbarConfig: {
214
- type: import("vue").PropType<import("./table").ToolbarConfig | false>;
215
- default: () => {
216
- reload: boolean;
217
- export: boolean;
218
- fullScreen: boolean;
219
- setting: boolean;
220
- };
209
+ type: import("vue").PropType<ToolbarConfig | boolean>;
210
+ default: boolean;
221
211
  };
222
212
  keys: {
223
213
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
@@ -348,7 +338,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
348
338
  scrollbarTabindex: string | number;
349
339
  allowDragLastColumn: boolean;
350
340
  preserveExpandedContent: boolean;
351
- toolbarConfig: false | import("./table").ToolbarConfig;
341
+ toolbarConfig: boolean | ToolbarConfig;
352
342
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
353
343
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
354
344
  export default _default;
@@ -2,7 +2,7 @@ import { defineComponent, useSlots, unref, computed, ref, useTemplateRef, mergeP
2
2
  import { merge, cloneDeep, get } from 'lodash-es';
3
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
+ import { tableProps, defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys } from './table.js';
6
6
  import stdin_default$6 from './table-column/table-column.vue.js';
7
7
  import stdin_default$5 from './table-column-editor/table-column-editor.vue.js';
8
8
  import stdin_default$2 from './table-query/table-query.vue.js';
@@ -11,7 +11,7 @@ import stdin_default$3 from '../icon/icon.vue.js';
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';
14
- import { isNullish, isFunction } from '../../utils/is.js';
14
+ import { isNullish, isObject, isFunction } from '../../utils/is.js';
15
15
  import { useFetch } from '../../hooks/useFetch.js';
16
16
  import { useFullPage } from '../../hooks/useFullPage.js';
17
17
  import { useLocale } from '../../hooks/useLocale.js';
@@ -52,10 +52,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
52
52
  hashId
53
53
  } = stdin_default$1(prefixCls);
54
54
  const {
55
- table
55
+ table: tableConfig
56
56
  } = useConfig();
57
57
  const tableKeys = reactiveComputed(() => {
58
- return merge({}, defaultTableConfig.keys, unref(table)?.keys, props.keys);
58
+ return merge({}, defaultTableConfig.keys, unref(tableConfig)?.keys, props.keys);
59
59
  });
60
60
  const passedElSlotsName = computed(() => {
61
61
  return elSlotsName.filter(name => !!slots[name]);
@@ -140,16 +140,18 @@ var stdin_default = /* @__PURE__ */defineComponent({
140
140
  execute();
141
141
  }
142
142
  });
143
+ const pagination = reactiveComputed(() => {
144
+ return merge({}, defaultTableConfig.pagination, unref(tableConfig)?.pagination, isObject(props.pagination) ? props.pagination : null);
145
+ });
143
146
  const total = ref(0);
144
- const page = ref(1);
145
- const pageSize = ref(10);
147
+ const page = ref(pagination.currentPage);
148
+ const pageSize = ref(pagination.pageSize);
146
149
  const paginationProps = computed(() => {
147
150
  if (props.pagination === false) {
148
151
  return false;
149
152
  }
150
153
  return {
151
- ...defaultPaginationProps,
152
- ...(typeof props.pagination === "object" ? props.pagination : null),
154
+ ...pagination,
153
155
  total: total.value
154
156
  };
155
157
  });
@@ -159,6 +161,24 @@ var stdin_default = /* @__PURE__ */defineComponent({
159
161
  const onPageChange = () => {
160
162
  execute();
161
163
  };
164
+ const defaultToolbarConfig = {
165
+ reload: true,
166
+ export: true,
167
+ fullScreen: true,
168
+ setting: true
169
+ };
170
+ const mergedToolbarConfig = computed(() => {
171
+ if (!props.toolbarConfig) {
172
+ return false;
173
+ }
174
+ if (props.toolbarConfig === true) {
175
+ return defaultToolbarConfig;
176
+ }
177
+ return {
178
+ ...defaultToolbarConfig,
179
+ ...props.toolbarConfig
180
+ };
181
+ });
162
182
  const reloading = ref(false);
163
183
  const reload = () => {
164
184
  if (!isFetching.value) {
@@ -254,7 +274,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
254
274
  /* FULL_PROPS */)], 2
255
275
  /* CLASS */)) : createCommentVNode("v-if", true), createElementVNode("div", {
256
276
  class: normalizeClass(`${unref(prefixCls)}-body`)
257
- }, [_ctx.$slots["toolbar-left"] || _ctx.$slots["toolbar-right"] || _ctx.toolbarConfig ? (openBlock(), createElementBlock("div", {
277
+ }, [_ctx.$slots["toolbar-left"] || _ctx.$slots["toolbar-right"] || mergedToolbarConfig.value ? (openBlock(), createElementBlock("div", {
258
278
  key: 0,
259
279
  class: normalizeClass(`${unref(prefixCls)}-toolbar`)
260
280
  }, [createElementVNode("div", {
@@ -262,10 +282,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
262
282
  }, [renderSlot(_ctx.$slots, "toolbar-left")], 2
263
283
  /* CLASS */), createElementVNode("div", {
264
284
  class: normalizeClass(`${unref(prefixCls)}-toolbar-right`)
265
- }, [renderSlot(_ctx.$slots, "toolbar-right"), _ctx.toolbarConfig ? (openBlock(), createElementBlock("div", {
285
+ }, [renderSlot(_ctx.$slots, "toolbar-right"), mergedToolbarConfig.value ? (openBlock(), createElementBlock("div", {
266
286
  key: 0,
267
287
  class: normalizeClass(`${unref(prefixCls)}-toolbar-preset`)
268
- }, [_ctx.toolbarConfig.reload ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(_component_el_tooltip, {
288
+ }, [mergedToolbarConfig.value.reload ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(_component_el_tooltip, {
269
289
  content: unref(t)("co.common.reload"),
270
290
  placement: "top",
271
291
  "show-after": 200,
@@ -287,7 +307,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
287
307
  })]),
288
308
  _: 1
289
309
  /* STABLE */
290
- }, 8, ["content"])])) : createCommentVNode("v-if", true), _ctx.toolbarConfig.export ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(_component_el_tooltip, {
310
+ }, 8, ["content"])])) : createCommentVNode("v-if", true), mergedToolbarConfig.value.export ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(_component_el_tooltip, {
291
311
  content: unref(t)("co.table.export"),
292
312
  placement: "top",
293
313
  "show-after": 200,
@@ -310,9 +330,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
310
330
  modelValue: exportVisible.value,
311
331
  "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => exportVisible.value = $event),
312
332
  title: unref(t)("co.table.exportData"),
333
+ config: mergedToolbarConfig.value.export,
313
334
  columns: exportColumns.value,
314
335
  data: tableData.value
315
- }, null, 8, ["modelValue", "title", "columns", "data"])])) : createCommentVNode("v-if", true), _ctx.toolbarConfig.fullScreen ? (openBlock(), createElementBlock("div", _hoisted_3, [createVNode(_component_el_tooltip, {
336
+ }, null, 8, ["modelValue", "title", "config", "columns", "data"])])) : createCommentVNode("v-if", true), mergedToolbarConfig.value.fullScreen ? (openBlock(), createElementBlock("div", _hoisted_3, [createVNode(_component_el_tooltip, {
316
337
  content: unref(isFullPage) ? unref(t)("co.table.exitFullScreen") : unref(t)("co.table.fullScreen"),
317
338
  placement: "top",
318
339
  "show-after": 200,
@@ -331,7 +352,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
331
352
  })]),
332
353
  _: 1
333
354
  /* STABLE */
334
- }, 8, ["content"])])) : createCommentVNode("v-if", true), _ctx.toolbarConfig.setting ? (openBlock(), createElementBlock("div", _hoisted_4, [createVNode(_component_el_tooltip, {
355
+ }, 8, ["content"])])) : createCommentVNode("v-if", true), mergedToolbarConfig.value.setting ? (openBlock(), createElementBlock("div", _hoisted_4, [createVNode(_component_el_tooltip, {
335
356
  content: unref(t)("co.table.columnSettings"),
336
357
  placement: "top",
337
358
  "show-after": 200,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",