cosey 0.3.19 → 0.3.20

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.
@@ -183,6 +183,12 @@ declare const _Table: {
183
183
  keys: {
184
184
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
185
185
  };
186
+ statsColumns: {
187
+ type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats").TableStatisticsColumn[]>>;
188
+ };
189
+ statsData: {
190
+ type: import("vue").MaybeRef<any>;
191
+ };
186
192
  height: (NumberConstructor | StringConstructor)[];
187
193
  maxHeight: (NumberConstructor | StringConstructor)[];
188
194
  tableLayout: {
@@ -324,6 +330,7 @@ declare const _Table: {
324
330
  allowDragLastColumn: boolean;
325
331
  preserveExpandedContent: boolean;
326
332
  toolbarConfig: boolean | import("./table").ToolbarConfig;
333
+ statsData: any;
327
334
  }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
328
335
  P: {};
329
336
  B: {};
@@ -511,6 +518,12 @@ declare const _Table: {
511
518
  keys: {
512
519
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
513
520
  };
521
+ statsColumns: {
522
+ type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats").TableStatisticsColumn[]>>;
523
+ };
524
+ statsData: {
525
+ type: import("vue").MaybeRef<any>;
526
+ };
514
527
  height: (NumberConstructor | StringConstructor)[];
515
528
  maxHeight: (NumberConstructor | StringConstructor)[];
516
529
  tableLayout: {
@@ -652,6 +665,7 @@ declare const _Table: {
652
665
  allowDragLastColumn: boolean;
653
666
  preserveExpandedContent: boolean;
654
667
  toolbarConfig: boolean | import("./table").ToolbarConfig;
668
+ statsData: any;
655
669
  }>;
656
670
  __isFragment?: never;
657
671
  __isTeleport?: never;
@@ -697,6 +711,12 @@ declare const _Table: {
697
711
  keys: {
698
712
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
699
713
  };
714
+ statsColumns: {
715
+ type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats").TableStatisticsColumn[]>>;
716
+ };
717
+ statsData: {
718
+ type: import("vue").MaybeRef<any>;
719
+ };
700
720
  height: (NumberConstructor | StringConstructor)[];
701
721
  maxHeight: (NumberConstructor | StringConstructor)[];
702
722
  tableLayout: {
@@ -838,6 +858,7 @@ declare const _Table: {
838
858
  allowDragLastColumn: boolean;
839
859
  preserveExpandedContent: boolean;
840
860
  toolbarConfig: boolean | import("./table").ToolbarConfig;
861
+ statsData: any;
841
862
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
842
863
  $slots: import("./table").TableSlots;
843
864
  }) & import("vue").Plugin;
@@ -0,0 +1,14 @@
1
+ import { VNodeChild } from 'vue';
2
+ export interface TableStatisticsColumn {
3
+ label: VNodeChild;
4
+ prop: string;
5
+ format?: (value: unknown) => unknown;
6
+ }
7
+ export interface TableStatisticsProps {
8
+ columns?: TableStatisticsColumn[];
9
+ data?: Record<string, unknown>;
10
+ }
11
+ export declare const defaultTableStatsProps: {
12
+ columns: () => never[];
13
+ data: () => {};
14
+ };
@@ -0,0 +1,6 @@
1
+ const defaultTableStatsProps = {
2
+ columns: () => [],
3
+ data: () => ({})
4
+ };
5
+
6
+ export { defaultTableStatsProps };
@@ -0,0 +1,4 @@
1
+ declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../../theme/theme-context").ThemeManager) => {
2
+ hashId: import("vue").Ref<string, string>;
3
+ };
4
+ export default _default;
@@ -0,0 +1,33 @@
1
+ import { getSimpleStyleHook } from '../../theme/getSimpleStyleHook.js';
2
+
3
+ var stdin_default = getSimpleStyleHook("TableStats", (token) => {
4
+ const { componentCls } = token;
5
+ return {
6
+ [componentCls]: {
7
+ display: "flex",
8
+ flexWrap: "wrap",
9
+ columnGap: token.sizeXXL,
10
+ alignItems: "center",
11
+ [`${componentCls}-column`]: {
12
+ display: "flex",
13
+ alignItems: "center"
14
+ },
15
+ [`${componentCls}-label`]: {
16
+ fontSize: token.fontSize,
17
+ color: token.colorTextTertiary
18
+ },
19
+ [`${componentCls}-colon`]: {
20
+ fontSize: token.fontSize,
21
+ color: token.colorTextTertiary,
22
+ marginInlineStart: token.marginXXS,
23
+ marginInlineEnd: token.marginXS
24
+ },
25
+ [`${componentCls}-value`]: {
26
+ fontSize: token.fontSize,
27
+ color: token.colorText
28
+ }
29
+ }
30
+ };
31
+ });
32
+
33
+ export { stdin_default as default };
@@ -0,0 +1,6 @@
1
+ import { type TableStatisticsProps } from './table-stats';
2
+ declare const _default: import("vue").DefineComponent<TableStatisticsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TableStatisticsProps> & Readonly<{}>, {
3
+ columns: import("./table-stats").TableStatisticsColumn[];
4
+ data: Record<string, unknown>;
5
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ export default _default;
@@ -0,0 +1,53 @@
1
+ import { defineComponent, mergeDefaults, createBlock, openBlock, resolveDynamicComponent, unref } from 'vue';
2
+ import { defaultTableStatsProps } from './table-stats.js';
3
+ import stdin_default$1 from './table-stats.style.js';
4
+ import { useComponentConfig } from '../../config-provider/config-provider.js';
5
+ import { defineTemplate } from '../../../utils/vue.js';
6
+
7
+ var stdin_default = /* @__PURE__ */defineComponent({
8
+ __name: "table-stats",
9
+ props: /* @__PURE__ */mergeDefaults({
10
+ columns: {
11
+ type: Array,
12
+ required: false
13
+ },
14
+ data: {
15
+ type: Object,
16
+ required: false
17
+ }
18
+ }, defaultTableStatsProps),
19
+ setup(__props) {
20
+ const props = __props;
21
+ const {
22
+ prefixCls
23
+ } = useComponentConfig("table-stats");
24
+ const {
25
+ hashId
26
+ } = stdin_default$1(prefixCls);
27
+ const template = defineTemplate(h => {
28
+ console.log(props.data);
29
+ return h("div", {
30
+ class: [hashId.value, prefixCls.value]
31
+ }, props.columns.map(column => {
32
+ let value = props.data[column.prop];
33
+ if (column.format) {
34
+ value = column.format(value);
35
+ }
36
+ return h("div", {
37
+ class: `${prefixCls.value}-column`
38
+ }, [h("div", {
39
+ class: `${prefixCls.value}-label`
40
+ }, column.label), h("span", {
41
+ class: `${prefixCls.value}-colon`
42
+ }, ":"), h("div", {
43
+ class: `${prefixCls.value}-value`
44
+ }, value)]);
45
+ }));
46
+ });
47
+ return (_ctx, _cache) => {
48
+ return openBlock(), createBlock(resolveDynamicComponent(unref(template)));
49
+ };
50
+ }
51
+ });
52
+
53
+ export { stdin_default as default };
@@ -1,7 +1,8 @@
1
1
  import { TableColumnCtx, type PaginationProps } from 'element-plus';
2
- import { type PropType, type ExtractPropTypes } from 'vue';
2
+ import { type PropType, type ExtractPropTypes, MaybeRef } from 'vue';
3
3
  import { type TableColumnProps } from './table-column/table-column';
4
4
  import { TableQueryExpose, type TableQueryProps } from './table-query/table-query';
5
+ import { TableStatisticsColumn } from './table-stats/table-stats';
5
6
  export interface ToolbarConfig {
6
7
  reload?: boolean;
7
8
  export?: boolean | {
@@ -56,6 +57,12 @@ export declare const tableProps: {
56
57
  keys: {
57
58
  type: PropType<TableConfig["keys"]>;
58
59
  };
60
+ statsColumns: {
61
+ type: PropType<MaybeRef<TableStatisticsColumn[]>>;
62
+ };
63
+ statsData: {
64
+ type: MaybeRef<any>;
65
+ };
59
66
  height: (NumberConstructor | StringConstructor)[];
60
67
  maxHeight: (NumberConstructor | StringConstructor)[];
61
68
  tableLayout: {
@@ -75,6 +75,12 @@ const tableExtraProps = {
75
75
  },
76
76
  keys: {
77
77
  type: Object
78
+ },
79
+ statsColumns: {
80
+ type: Object
81
+ },
82
+ statsData: {
83
+ type: Object
78
84
  }
79
85
  };
80
86
  const tableProps = {
@@ -1,10 +1,10 @@
1
- import { type FullToken } from '../../theme';
1
+ import { type FullToken } from '../theme';
2
2
  export interface ComponentToken {
3
3
  }
4
4
  export interface TableToken extends FullToken<'Table'> {
5
5
  tableHeaderBg: string;
6
6
  }
7
- declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../../theme/theme-context").ThemeManager) => {
7
+ declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../theme/theme-context").ThemeManager) => {
8
8
  hashId: import("vue").Ref<string, string>;
9
9
  };
10
10
  export default _default;
@@ -1,5 +1,5 @@
1
- import { getStyleHook } from '../../theme/getStyleHook.js';
2
- import { contrarotation } from '../../style/animation.js';
1
+ import { getStyleHook } from '../theme/getStyleHook.js';
2
+ import { contrarotation } from '../style/animation.js';
3
3
 
4
4
  const getTableStyle = (token) => {
5
5
  const { componentCls } = token;
@@ -28,7 +28,7 @@ const getTableStyle = (token) => {
28
28
  [`${componentCls}-toolbar`]: {
29
29
  display: "flex",
30
30
  flex: "none",
31
- alignItems: "center",
31
+ alignItems: "flex-end",
32
32
  justifyContent: "center",
33
33
  paddingBlockStart: token.paddingSM,
34
34
  paddingInline: token.paddingSM
@@ -49,6 +49,9 @@ const getTableStyle = (token) => {
49
49
  animationIterationCount: "infinite"
50
50
  }
51
51
  },
52
+ [`${componentCls}-stats-wrapper`]: {
53
+ paddingBlockStart: token.paddingSM
54
+ },
52
55
  [`${componentCls}-before-table`]: {
53
56
  paddingBlockStart: token.paddingSM,
54
57
  paddingInline: token.paddingSM
@@ -43,6 +43,12 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
43
43
  keys: {
44
44
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
45
45
  };
46
+ statsColumns: {
47
+ type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats").TableStatisticsColumn[]>>;
48
+ };
49
+ statsData: {
50
+ type: import("vue").MaybeRef<any>;
51
+ };
46
52
  height: (NumberConstructor | StringConstructor)[];
47
53
  maxHeight: (NumberConstructor | StringConstructor)[];
48
54
  tableLayout: {
@@ -201,6 +207,12 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
201
207
  keys: {
202
208
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
203
209
  };
210
+ statsColumns: {
211
+ type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats").TableStatisticsColumn[]>>;
212
+ };
213
+ statsData: {
214
+ type: import("vue").MaybeRef<any>;
215
+ };
204
216
  height: (NumberConstructor | StringConstructor)[];
205
217
  maxHeight: (NumberConstructor | StringConstructor)[];
206
218
  tableLayout: {
@@ -309,6 +321,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
309
321
  allowDragLastColumn: boolean;
310
322
  preserveExpandedContent: boolean;
311
323
  toolbarConfig: boolean | ToolbarConfig;
324
+ statsData: any;
312
325
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
313
326
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
314
327
  export default _default;
@@ -3,16 +3,17 @@ import { merge, cloneDeep, get } from 'lodash-es';
3
3
  import { reactiveComputed, reactiveOmit } from '@vueuse/core';
4
4
  import { useNamespace, useZIndex, ElButton, Mousewheel } from 'element-plus';
5
5
  import { tableEmitEvents, tableProps, tableEmitOnEvents, defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys } from './table.js';
6
- import stdin_default$6 from './table-column/table-column.vue.js';
7
- import stdin_default$5 from './table-column-editor/table-column-editor.vue.js';
6
+ import stdin_default$7 from './table-column/table-column.vue.js';
7
+ import stdin_default$6 from './table-column-editor/table-column-editor.vue.js';
8
8
  import stdin_default$2 from './table-query/table-query.vue.js';
9
- import stdin_default$4 from './table-export/table-export.vue.js';
10
- import stdin_default$3 from '../icon/icon.vue.js';
9
+ import stdin_default$5 from './table-export/table-export.vue.js';
10
+ import stdin_default$4 from '../icon/icon.vue.js';
11
11
  import { filterEmptyFormValue } from './utils.js';
12
- import stdin_default$1 from './style/index.js';
12
+ import stdin_default$1 from './table.style.js';
13
13
  import { hColgroup } from 'element-plus/es/components/table/src/h-helper.mjs';
14
- import stdin_default$7 from './table-footer/index.js';
14
+ import stdin_default$8 from './table-footer/index.js';
15
15
  import { defaultSummaryMethod } from './table-footer/utils.js';
16
+ import stdin_default$3 from './table-stats/table-stats.vue.js';
16
17
  import { uniqid } from '../../utils/string.js';
17
18
  import { useComponentConfig, useConfig } from '../config-provider/config-provider.js';
18
19
  import { flatColumns } from '../../utils/excel/index.js';
@@ -330,6 +331,9 @@ var stdin_default = /* @__PURE__ */defineComponent({
330
331
  await execute();
331
332
  }
332
333
  };
334
+ const statsColumns = computed(() => unref(props.statsColumns));
335
+ const statsData = computed(() => unref(props.statsData));
336
+ const isStatsVisible = computed(() => statsColumns.value && statsColumns.value.length > 0);
333
337
  const expose = createMergedExpose(tableExposeKeys, () => elTableRef.value, {
334
338
  reload,
335
339
  expandAll,
@@ -369,12 +373,19 @@ var stdin_default = /* @__PURE__ */defineComponent({
369
373
  /* FULL_PROPS */)], 2
370
374
  /* CLASS */)) : createCommentVNode("v-if", true), createElementVNode("div", {
371
375
  class: normalizeClass(`${unref(prefixCls)}-body`)
372
- }, [_ctx.$slots["toolbar-left"] || _ctx.$slots["toolbar-right"] || mergedToolbarConfig.value ? (openBlock(), createElementBlock("div", {
376
+ }, [_ctx.$slots["toolbar-left"] || _ctx.$slots["toolbar-right"] || mergedToolbarConfig.value || isStatsVisible.value ? (openBlock(), createElementBlock("div", {
373
377
  key: 0,
374
378
  class: normalizeClass(`${unref(prefixCls)}-toolbar`)
375
379
  }, [createElementVNode("div", {
376
380
  class: normalizeClass(`${unref(prefixCls)}-toolbar-left`)
377
- }, [renderSlot(_ctx.$slots, "toolbar-left")], 2
381
+ }, [renderSlot(_ctx.$slots, "toolbar-left"), isStatsVisible.value ? (openBlock(), createElementBlock("div", {
382
+ key: 0,
383
+ class: normalizeClass(`${unref(prefixCls)}-stats-wrapper`)
384
+ }, [createVNode(stdin_default$3, {
385
+ columns: statsColumns.value,
386
+ data: statsData.value
387
+ }, null, 8, ["columns", "data"])], 2
388
+ /* CLASS */)) : createCommentVNode("v-if", true)], 2
378
389
  /* CLASS */), createElementVNode("div", {
379
390
  class: normalizeClass(`${unref(prefixCls)}-toolbar-right`)
380
391
  }, [renderSlot(_ctx.$slots, "toolbar-right"), mergedToolbarConfig.value ? (openBlock(), createElementBlock("div", {
@@ -390,7 +401,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
390
401
  circle: "",
391
402
  onClick: reload
392
403
  }, {
393
- default: withCtx(() => [createVNode(stdin_default$3, {
404
+ default: withCtx(() => [createVNode(stdin_default$4, {
394
405
  name: "co:rotate-360",
395
406
  size: "md",
396
407
  class: normalizeClass([`${unref(prefixCls)}-refresh-icon`, {
@@ -412,7 +423,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
412
423
  circle: "",
413
424
  onClick: _cache[0] || (_cache[0] = $event => exportVisible.value = true)
414
425
  }, {
415
- default: withCtx(() => [createVNode(stdin_default$3, {
426
+ default: withCtx(() => [createVNode(stdin_default$4, {
416
427
  name: "co:download",
417
428
  size: "md"
418
429
  })]),
@@ -421,7 +432,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
421
432
  })]),
422
433
  _: 1
423
434
  /* STABLE */
424
- }, 8, ["content"]), createVNode(stdin_default$4, {
435
+ }, 8, ["content"]), createVNode(stdin_default$5, {
425
436
  modelValue: exportVisible.value,
426
437
  "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => exportVisible.value = $event),
427
438
  title: unref(t)("co.table.exportData"),
@@ -439,7 +450,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
439
450
  circle: "",
440
451
  onClick: onFullScreen
441
452
  }, {
442
- default: withCtx(() => [createVNode(stdin_default$3, {
453
+ default: withCtx(() => [createVNode(stdin_default$4, {
443
454
  name: unref(isFullPage) ? "co:fullscreen-exit" : "co:fullscreen",
444
455
  size: "md"
445
456
  }, null, 8, ["name"])]),
@@ -458,7 +469,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
458
469
  ref: "setting-ref",
459
470
  circle: ""
460
471
  }, {
461
- default: withCtx(() => [createVNode(stdin_default$3, {
472
+ default: withCtx(() => [createVNode(stdin_default$4, {
462
473
  name: "co:settings-adjust",
463
474
  size: "md"
464
475
  })]),
@@ -468,7 +479,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
468
479
  /* NEED_PATCH */)]),
469
480
  _: 1
470
481
  /* STABLE */
471
- }, 8, ["content"]), createVNode(stdin_default$5, {
482
+ }, 8, ["content"]), createVNode(stdin_default$6, {
472
483
  modelValue: renderedColumns.value,
473
484
  "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => renderedColumns.value = $event),
474
485
  "virtual-ref": settingRef.value,
@@ -498,7 +509,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
498
509
  "max-height": "none"
499
510
  }), createSlots({
500
511
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(renderedColumns.value, column => {
501
- return openBlock(), createBlock(stdin_default$6, mergeProps({
512
+ return openBlock(), createBlock(stdin_default$7, mergeProps({
502
513
  key: column.prop || column.property,
503
514
  ref_for: true
504
515
  }, column, {
@@ -523,7 +534,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
523
534
  key: 0,
524
535
  columns: store.value.states.columns,
525
536
  "table-layout": _ctx.tableLayout
526
- }, null, 8, ["columns", "table-layout"])) : createCommentVNode("v-if", true), store.value ? (openBlock(), createBlock(unref(stdin_default$7), {
537
+ }, null, 8, ["columns", "table-layout"])) : createCommentVNode("v-if", true), store.value ? (openBlock(), createBlock(unref(stdin_default$8), {
527
538
  key: 1,
528
539
  border: _ctx.border,
529
540
  "default-sort": _ctx.defaultSort,
@@ -20,7 +20,7 @@ import type { ComponentToken as LongTextComponentToken } from '../../long-text/s
20
20
  import type { ComponentToken as MaskComponentToken } from '../../mask/style';
21
21
  import type { ComponentToken as PanelComponentToken } from '../../panel/style';
22
22
  import type { ComponentToken as ScrollViewComponentToken } from '../../scroll-view/style';
23
- import type { ComponentToken as TableComponentToken } from '../../table/style';
23
+ import type { ComponentToken as TableComponentToken } from '../../table/table.style';
24
24
  import type { ComponentToken as TableColumnComponentToken } from '../../table/table-column/style';
25
25
  import type { ComponentToken as TableColumnEditorComponentToken } from '../../table/table-column-editor/style';
26
26
  import type { ComponentToken as TableExportComponentToken } from '../../table/table-export/style';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",