cosey 0.7.6 → 0.7.8
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.
- package/components/table/index.d.ts +18 -0
- package/components/table/table-footer/index.d.ts +30 -6
- package/components/table/table-footer/index.js +25 -5
- package/components/table/table-footer/utils.d.ts +1 -1
- package/components/table/table-footer/utils.js +6 -2
- package/components/table/table-query/table-query.js +5 -3
- package/components/table/table.d.ts +6 -0
- package/components/table/table.js +6 -0
- package/components/table/table.vue.d.ts +12 -0
- package/components/table/table.vue.js +5 -3
- package/package.json +1 -1
|
@@ -192,6 +192,12 @@ declare const _Table: {
|
|
|
192
192
|
statsData: {
|
|
193
193
|
type: import("vue").MaybeRef<any>;
|
|
194
194
|
};
|
|
195
|
+
summaryProperties: {
|
|
196
|
+
type: import("vue").PropType<string[]>;
|
|
197
|
+
};
|
|
198
|
+
transformSummary: {
|
|
199
|
+
type: import("vue").PropType<(sums: any[]) => any[]>;
|
|
200
|
+
};
|
|
195
201
|
height: (NumberConstructor | StringConstructor)[];
|
|
196
202
|
maxHeight: (NumberConstructor | StringConstructor)[];
|
|
197
203
|
tableLayout: {
|
|
@@ -538,6 +544,12 @@ declare const _Table: {
|
|
|
538
544
|
statsData: {
|
|
539
545
|
type: import("vue").MaybeRef<any>;
|
|
540
546
|
};
|
|
547
|
+
summaryProperties: {
|
|
548
|
+
type: import("vue").PropType<string[]>;
|
|
549
|
+
};
|
|
550
|
+
transformSummary: {
|
|
551
|
+
type: import("vue").PropType<(sums: any[]) => any[]>;
|
|
552
|
+
};
|
|
541
553
|
height: (NumberConstructor | StringConstructor)[];
|
|
542
554
|
maxHeight: (NumberConstructor | StringConstructor)[];
|
|
543
555
|
tableLayout: {
|
|
@@ -739,6 +751,12 @@ declare const _Table: {
|
|
|
739
751
|
statsData: {
|
|
740
752
|
type: import("vue").MaybeRef<any>;
|
|
741
753
|
};
|
|
754
|
+
summaryProperties: {
|
|
755
|
+
type: import("vue").PropType<string[]>;
|
|
756
|
+
};
|
|
757
|
+
transformSummary: {
|
|
758
|
+
type: import("vue").PropType<(sums: any[]) => any[]>;
|
|
759
|
+
};
|
|
742
760
|
height: (NumberConstructor | StringConstructor)[];
|
|
743
761
|
maxHeight: (NumberConstructor | StringConstructor)[];
|
|
744
762
|
tableLayout: {
|
|
@@ -19,9 +19,21 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
19
19
|
required: true;
|
|
20
20
|
type: PropType<TableFooter<DefaultRow>["store"]>;
|
|
21
21
|
};
|
|
22
|
-
summaryMethod:
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
summaryMethod: {
|
|
23
|
+
type: PropType<TableFooter<DefaultRow>["summaryMethod"]>;
|
|
24
|
+
};
|
|
25
|
+
summaryProperties: {
|
|
26
|
+
type: PropType<string[]>;
|
|
27
|
+
};
|
|
28
|
+
transformSummary: {
|
|
29
|
+
type: PropType<(sums: any[]) => any[]>;
|
|
30
|
+
};
|
|
31
|
+
sumText: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
};
|
|
34
|
+
border: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
};
|
|
25
37
|
defaultSort: {
|
|
26
38
|
type: PropType<TableFooter<DefaultRow>["defaultSort"]>;
|
|
27
39
|
default: () => {
|
|
@@ -62,9 +74,21 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
62
74
|
required: true;
|
|
63
75
|
type: PropType<TableFooter<DefaultRow>["store"]>;
|
|
64
76
|
};
|
|
65
|
-
summaryMethod:
|
|
66
|
-
|
|
67
|
-
|
|
77
|
+
summaryMethod: {
|
|
78
|
+
type: PropType<TableFooter<DefaultRow>["summaryMethod"]>;
|
|
79
|
+
};
|
|
80
|
+
summaryProperties: {
|
|
81
|
+
type: PropType<string[]>;
|
|
82
|
+
};
|
|
83
|
+
transformSummary: {
|
|
84
|
+
type: PropType<(sums: any[]) => any[]>;
|
|
85
|
+
};
|
|
86
|
+
sumText: {
|
|
87
|
+
type: StringConstructor;
|
|
88
|
+
};
|
|
89
|
+
border: {
|
|
90
|
+
type: BooleanConstructor;
|
|
91
|
+
};
|
|
68
92
|
defaultSort: {
|
|
69
93
|
type: PropType<TableFooter<DefaultRow>["defaultSort"]>;
|
|
70
94
|
default: () => {
|
|
@@ -16,9 +16,21 @@ var stdin_default = defineComponent({
|
|
|
16
16
|
required: true,
|
|
17
17
|
type: Object
|
|
18
18
|
},
|
|
19
|
-
summaryMethod:
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
summaryMethod: {
|
|
20
|
+
type: Function
|
|
21
|
+
},
|
|
22
|
+
summaryProperties: {
|
|
23
|
+
type: Array
|
|
24
|
+
},
|
|
25
|
+
transformSummary: {
|
|
26
|
+
type: Function
|
|
27
|
+
},
|
|
28
|
+
sumText: {
|
|
29
|
+
type: String
|
|
30
|
+
},
|
|
31
|
+
border: {
|
|
32
|
+
type: Boolean
|
|
33
|
+
},
|
|
22
34
|
defaultSort: {
|
|
23
35
|
type: Object,
|
|
24
36
|
default: () => {
|
|
@@ -44,7 +56,15 @@ var stdin_default = defineComponent({
|
|
|
44
56
|
};
|
|
45
57
|
},
|
|
46
58
|
render() {
|
|
47
|
-
const {
|
|
59
|
+
const {
|
|
60
|
+
columns,
|
|
61
|
+
getCellStyles,
|
|
62
|
+
getCellClasses,
|
|
63
|
+
summaryMethod,
|
|
64
|
+
sumText,
|
|
65
|
+
summaryProperties,
|
|
66
|
+
transformSummary
|
|
67
|
+
} = this;
|
|
48
68
|
const data = unref(this.store.states.data) || [];
|
|
49
69
|
let sums = [];
|
|
50
70
|
if (summaryMethod) {
|
|
@@ -53,7 +73,7 @@ var stdin_default = defineComponent({
|
|
|
53
73
|
data
|
|
54
74
|
});
|
|
55
75
|
} else {
|
|
56
|
-
sums = defaultSummaryMethod(columns, data, sumText);
|
|
76
|
+
sums = defaultSummaryMethod(columns, data, sumText, summaryProperties, transformSummary);
|
|
57
77
|
}
|
|
58
78
|
if (!Array.isArray(sums[0])) {
|
|
59
79
|
sums = [sums];
|
|
@@ -12,4 +12,4 @@ export declare const isFixedColumn: <T extends DefaultRow>(index: number, fixed:
|
|
|
12
12
|
export declare const getFixedColumnsClass: <T extends DefaultRow>(namespace: string, index: number, fixed: string | boolean, store: any, realColumns?: TableColumnCtx<T>[], offset?: number) => string[];
|
|
13
13
|
export declare const getFixedColumnOffset: <T extends DefaultRow>(index: number, fixed: string | boolean, store: any, realColumns?: TableColumnCtx<T>[]) => any;
|
|
14
14
|
export declare const ensurePosition: (style: any, key: string) => void;
|
|
15
|
-
export declare function defaultSummaryMethod(columns: TableColumnCtx<DefaultRow>[], data: any[], sumText?: string): any[];
|
|
15
|
+
export declare function defaultSummaryMethod(columns: TableColumnCtx<DefaultRow>[], data: any[], sumText?: string, summaryProperties?: string[], transformSummary?: (sums: any[]) => any[]): any[];
|
|
@@ -86,13 +86,17 @@ const ensurePosition = (style, key) => {
|
|
|
86
86
|
style[key] = `${style[key]}px`;
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
-
function defaultSummaryMethod(columns, data, sumText) {
|
|
89
|
+
function defaultSummaryMethod(columns, data, sumText, summaryProperties, transformSummary) {
|
|
90
90
|
const sums = [];
|
|
91
91
|
columns.forEach((column, index) => {
|
|
92
92
|
if (index === 0) {
|
|
93
93
|
sums[index] = sumText;
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
+
if (summaryProperties && !summaryProperties.includes(column.property)) {
|
|
97
|
+
sums[index] = "";
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
96
100
|
const values = data.map((item) => Number(item[column.property]));
|
|
97
101
|
const precisions = [];
|
|
98
102
|
let notNumber = true;
|
|
@@ -117,7 +121,7 @@ function defaultSummaryMethod(columns, data, sumText) {
|
|
|
117
121
|
sums[index] = "";
|
|
118
122
|
}
|
|
119
123
|
});
|
|
120
|
-
return sums;
|
|
124
|
+
return transformSummary ? transformSummary(sums) : sums;
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
export { defaultSummaryMethod, ensurePosition, getFixedColumnOffset, getFixedColumnsClass, isFixedColumn };
|
|
@@ -21,9 +21,11 @@ var stdin_default = defineComponent({
|
|
|
21
21
|
return props.model || defaultModel;
|
|
22
22
|
});
|
|
23
23
|
onBeforeMount(() => {
|
|
24
|
-
props.
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
if (!props.model) {
|
|
25
|
+
props.schemes.forEach(item => {
|
|
26
|
+
unref(formModel)[item.prop] = item.modelValue;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
27
29
|
});
|
|
28
30
|
const onEnter = () => {
|
|
29
31
|
formQueryRef.value?.submit();
|
|
@@ -63,6 +63,12 @@ export declare const tableProps: {
|
|
|
63
63
|
statsData: {
|
|
64
64
|
type: MaybeRef<any>;
|
|
65
65
|
};
|
|
66
|
+
summaryProperties: {
|
|
67
|
+
type: PropType<string[]>;
|
|
68
|
+
};
|
|
69
|
+
transformSummary: {
|
|
70
|
+
type: PropType<(sums: any[]) => any[]>;
|
|
71
|
+
};
|
|
66
72
|
height: (NumberConstructor | StringConstructor)[];
|
|
67
73
|
maxHeight: (NumberConstructor | StringConstructor)[];
|
|
68
74
|
tableLayout: {
|
|
@@ -48,6 +48,12 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
48
48
|
statsData: {
|
|
49
49
|
type: import("vue").MaybeRef<any>;
|
|
50
50
|
};
|
|
51
|
+
summaryProperties: {
|
|
52
|
+
type: import("vue").PropType<string[]>;
|
|
53
|
+
};
|
|
54
|
+
transformSummary: {
|
|
55
|
+
type: import("vue").PropType<(sums: any[]) => any[]>;
|
|
56
|
+
};
|
|
51
57
|
height: (NumberConstructor | StringConstructor)[];
|
|
52
58
|
maxHeight: (NumberConstructor | StringConstructor)[];
|
|
53
59
|
tableLayout: {
|
|
@@ -219,6 +225,12 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
219
225
|
statsData: {
|
|
220
226
|
type: import("vue").MaybeRef<any>;
|
|
221
227
|
};
|
|
228
|
+
summaryProperties: {
|
|
229
|
+
type: import("vue").PropType<string[]>;
|
|
230
|
+
};
|
|
231
|
+
transformSummary: {
|
|
232
|
+
type: import("vue").PropType<(sums: any[]) => any[]>;
|
|
233
|
+
};
|
|
222
234
|
height: (NumberConstructor | StringConstructor)[];
|
|
223
235
|
maxHeight: (NumberConstructor | StringConstructor)[];
|
|
224
236
|
tableLayout: {
|
|
@@ -145,7 +145,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
145
145
|
let sums = props.summaryMethod ? props.summaryMethod({
|
|
146
146
|
columns,
|
|
147
147
|
data: tableData.value
|
|
148
|
-
}) : defaultSummaryMethod(columns, data, props.sumText || t("co.table.total"));
|
|
148
|
+
}) : defaultSummaryMethod(columns, data, props.sumText || t("co.table.total"), props.summaryProperties, props.transformSummary);
|
|
149
149
|
if (!Array.isArray(sums[0])) {
|
|
150
150
|
sums = [sums];
|
|
151
151
|
}
|
|
@@ -579,8 +579,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
579
579
|
"default-sort": _ctx.defaultSort,
|
|
580
580
|
store: store.value,
|
|
581
581
|
"sum-text": computedSumText.value,
|
|
582
|
-
"summary-method": _ctx.summaryMethod
|
|
583
|
-
|
|
582
|
+
"summary-method": _ctx.summaryMethod,
|
|
583
|
+
"summary-properties": _ctx.summaryProperties,
|
|
584
|
+
"transform-summary": _ctx.transformSummary
|
|
585
|
+
}, null, 8, ["border", "default-sort", "store", "sum-text", "summary-method", "summary-properties", "transform-summary"])) : createCommentVNode("v-if", true)], 6
|
|
584
586
|
/* CLASS, STYLE */)], 2
|
|
585
587
|
/* CLASS */)), [[vShow, !isEmpty.value], [unref(Mousewheel), handleHeaderFooterMousewheel]]) : createCommentVNode("v-if", true)], 8, ["to"]))]),
|
|
586
588
|
_: 2
|