cosey 0.2.11 → 0.2.12

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.
@@ -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;
@@ -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"]>;
@@ -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
@@ -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;
@@ -159,6 +159,24 @@ var stdin_default = /* @__PURE__ */defineComponent({
159
159
  const onPageChange = () => {
160
160
  execute();
161
161
  };
162
+ const defaultToolbarConfig = {
163
+ reload: true,
164
+ export: true,
165
+ fullScreen: true,
166
+ setting: true
167
+ };
168
+ const mergedToolbarConfig = computed(() => {
169
+ if (!props.toolbarConfig) {
170
+ return false;
171
+ }
172
+ if (props.toolbarConfig === true) {
173
+ return defaultToolbarConfig;
174
+ }
175
+ return {
176
+ ...defaultToolbarConfig,
177
+ ...props.toolbarConfig
178
+ };
179
+ });
162
180
  const reloading = ref(false);
163
181
  const reload = () => {
164
182
  if (!isFetching.value) {
@@ -254,7 +272,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
254
272
  /* FULL_PROPS */)], 2
255
273
  /* CLASS */)) : createCommentVNode("v-if", true), createElementVNode("div", {
256
274
  class: normalizeClass(`${unref(prefixCls)}-body`)
257
- }, [_ctx.$slots["toolbar-left"] || _ctx.$slots["toolbar-right"] || _ctx.toolbarConfig ? (openBlock(), createElementBlock("div", {
275
+ }, [_ctx.$slots["toolbar-left"] || _ctx.$slots["toolbar-right"] || mergedToolbarConfig.value ? (openBlock(), createElementBlock("div", {
258
276
  key: 0,
259
277
  class: normalizeClass(`${unref(prefixCls)}-toolbar`)
260
278
  }, [createElementVNode("div", {
@@ -262,10 +280,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
262
280
  }, [renderSlot(_ctx.$slots, "toolbar-left")], 2
263
281
  /* CLASS */), createElementVNode("div", {
264
282
  class: normalizeClass(`${unref(prefixCls)}-toolbar-right`)
265
- }, [renderSlot(_ctx.$slots, "toolbar-right"), _ctx.toolbarConfig ? (openBlock(), createElementBlock("div", {
283
+ }, [renderSlot(_ctx.$slots, "toolbar-right"), mergedToolbarConfig.value ? (openBlock(), createElementBlock("div", {
266
284
  key: 0,
267
285
  class: normalizeClass(`${unref(prefixCls)}-toolbar-preset`)
268
- }, [_ctx.toolbarConfig.reload ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(_component_el_tooltip, {
286
+ }, [mergedToolbarConfig.value.reload ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(_component_el_tooltip, {
269
287
  content: unref(t)("co.common.reload"),
270
288
  placement: "top",
271
289
  "show-after": 200,
@@ -287,7 +305,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
287
305
  })]),
288
306
  _: 1
289
307
  /* STABLE */
290
- }, 8, ["content"])])) : createCommentVNode("v-if", true), _ctx.toolbarConfig.export ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(_component_el_tooltip, {
308
+ }, 8, ["content"])])) : createCommentVNode("v-if", true), mergedToolbarConfig.value.export ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(_component_el_tooltip, {
291
309
  content: unref(t)("co.table.export"),
292
310
  placement: "top",
293
311
  "show-after": 200,
@@ -310,9 +328,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
310
328
  modelValue: exportVisible.value,
311
329
  "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => exportVisible.value = $event),
312
330
  title: unref(t)("co.table.exportData"),
331
+ config: mergedToolbarConfig.value.export,
313
332
  columns: exportColumns.value,
314
333
  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, {
334
+ }, null, 8, ["modelValue", "title", "config", "columns", "data"])])) : createCommentVNode("v-if", true), mergedToolbarConfig.value.fullScreen ? (openBlock(), createElementBlock("div", _hoisted_3, [createVNode(_component_el_tooltip, {
316
335
  content: unref(isFullPage) ? unref(t)("co.table.exitFullScreen") : unref(t)("co.table.fullScreen"),
317
336
  placement: "top",
318
337
  "show-after": 200,
@@ -331,7 +350,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
331
350
  })]),
332
351
  _: 1
333
352
  /* STABLE */
334
- }, 8, ["content"])])) : createCommentVNode("v-if", true), _ctx.toolbarConfig.setting ? (openBlock(), createElementBlock("div", _hoisted_4, [createVNode(_component_el_tooltip, {
353
+ }, 8, ["content"])])) : createCommentVNode("v-if", true), mergedToolbarConfig.value.setting ? (openBlock(), createElementBlock("div", _hoisted_4, [createVNode(_component_el_tooltip, {
335
354
  content: unref(t)("co.table.columnSettings"),
336
355
  placement: "top",
337
356
  "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.12",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",