@vue-pivottable/multi-value-renderer 0.1.0 → 0.2.0
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/README.md +19 -1
- package/dist/styles.css +0 -19
- package/dist/vue2.js +15 -15
- package/dist/vue2.mjs +15 -15
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Multi-value aggregator renderer for vue-pivottable. Display multiple aggregated values per cell, each with its own aggregation function.
|
|
4
4
|
|
|
5
|
+
## Screenshots
|
|
6
|
+
|
|
7
|
+
### Vue 3 - PivotTable
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
### Vue 3 - PivotTable UI
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
### Vue 2 - PivotTable
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
### Vue 2 - PivotTable UI
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
5
23
|
## Features
|
|
6
24
|
|
|
7
25
|
- **Multiple Values per Cell**: Display sales (Sum), quantity (Average), and more in a single pivot table cell
|
|
@@ -138,7 +156,7 @@ Custom display labels for value columns:
|
|
|
138
156
|
Import the included CSS for default styling:
|
|
139
157
|
|
|
140
158
|
```js
|
|
141
|
-
import '@vue-pivottable/multi-value-renderer/
|
|
159
|
+
import '@vue-pivottable/multi-value-renderer/styles.css'
|
|
142
160
|
```
|
|
143
161
|
|
|
144
162
|
Or customize with your own CSS targeting these classes:
|
package/dist/styles.css
CHANGED
|
@@ -87,25 +87,6 @@
|
|
|
87
87
|
font-weight: 600;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
/* Dark mode support */
|
|
91
|
-
@media (prefers-color-scheme: dark) {
|
|
92
|
-
.multi-value-label {
|
|
93
|
-
color: #aaa;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.layout-horizontal .multi-value-item {
|
|
97
|
-
border-right-color: #444;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.pvtMultiVal:hover {
|
|
101
|
-
background-color: rgba(255, 255, 255, 0.05);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.pvtTotal.pvtMultiVal,
|
|
105
|
-
.pvtGrandTotal.pvtMultiVal {
|
|
106
|
-
background-color: #2a2a2a;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
90
|
|
|
110
91
|
/* Print styles */
|
|
111
92
|
@media print {
|
package/dist/vue2.js
CHANGED
|
@@ -203,7 +203,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
203
203
|
staticClass: "multi-value-label"
|
|
204
204
|
}, `${label}: `) : null,
|
|
205
205
|
h("span", {
|
|
206
|
-
staticClass:
|
|
206
|
+
staticClass: "multi-value-value"
|
|
207
207
|
}, formatted)
|
|
208
208
|
]);
|
|
209
209
|
});
|
|
@@ -211,7 +211,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
211
211
|
return items.join(" / ");
|
|
212
212
|
}
|
|
213
213
|
return h("div", {
|
|
214
|
-
staticClass:
|
|
214
|
+
staticClass: `multi-value-cell layout-${this.cellLayout}`
|
|
215
215
|
}, items);
|
|
216
216
|
},
|
|
217
217
|
/**
|
|
@@ -249,7 +249,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
249
249
|
} catch (error) {
|
|
250
250
|
console.error("Multi-Value Renderer Error:", error);
|
|
251
251
|
return h("div", {
|
|
252
|
-
staticClass:
|
|
252
|
+
staticClass: "pvtError"
|
|
253
253
|
}, `Error: ${error.message}`);
|
|
254
254
|
}
|
|
255
255
|
const colAttrs = pivotData.props.cols;
|
|
@@ -275,7 +275,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
275
275
|
return null;
|
|
276
276
|
};
|
|
277
277
|
return h("table", {
|
|
278
|
-
staticClass:
|
|
278
|
+
staticClass: "pvtTable pvtMultiValueTable"
|
|
279
279
|
}, [
|
|
280
280
|
// THEAD
|
|
281
281
|
h("thead", [
|
|
@@ -290,13 +290,13 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
290
290
|
}
|
|
291
291
|
}) : void 0,
|
|
292
292
|
// Column attribute label
|
|
293
|
-
h("th", { staticClass:
|
|
293
|
+
h("th", { staticClass: "pvtAxisLabel" }, c),
|
|
294
294
|
// Column keys
|
|
295
295
|
colKeys.map((colKey, i) => {
|
|
296
296
|
const x = this.spanSize(colKeys, i, j);
|
|
297
297
|
if (x === -1) return null;
|
|
298
298
|
return h("th", {
|
|
299
|
-
staticClass:
|
|
299
|
+
staticClass: "pvtColLabel",
|
|
300
300
|
attrs: {
|
|
301
301
|
key: `colKey${i}`,
|
|
302
302
|
colSpan: x,
|
|
@@ -306,7 +306,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
306
306
|
}),
|
|
307
307
|
// Totals header
|
|
308
308
|
j === 0 && this.rowTotal ? h("th", {
|
|
309
|
-
staticClass:
|
|
309
|
+
staticClass: "pvtTotalLabel",
|
|
310
310
|
attrs: {
|
|
311
311
|
rowSpan: colAttrs.length + (rowAttrs.length === 0 ? 0 : 1)
|
|
312
312
|
}
|
|
@@ -317,13 +317,13 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
317
317
|
rowAttrs.length !== 0 ? h("tr", [
|
|
318
318
|
rowAttrs.map((r, i) => {
|
|
319
319
|
return h("th", {
|
|
320
|
-
staticClass:
|
|
320
|
+
staticClass: "pvtAxisLabel",
|
|
321
321
|
key: `rowAttr${i}`
|
|
322
322
|
}, r);
|
|
323
323
|
}),
|
|
324
324
|
this.rowTotal ? h(
|
|
325
325
|
"th",
|
|
326
|
-
{ staticClass:
|
|
326
|
+
{ staticClass: "pvtTotalLabel" },
|
|
327
327
|
colAttrs.length === 0 ? this.localeStrings.totals : null
|
|
328
328
|
) : colAttrs.length === 0 ? void 0 : h("th")
|
|
329
329
|
]) : void 0
|
|
@@ -339,7 +339,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
339
339
|
const x = this.spanSize(rowKeys, i, j);
|
|
340
340
|
if (x === -1) return null;
|
|
341
341
|
return h("th", {
|
|
342
|
-
staticClass:
|
|
342
|
+
staticClass: "pvtRowLabel",
|
|
343
343
|
attrs: {
|
|
344
344
|
key: `rowKeyLabel${i}-${j}`,
|
|
345
345
|
rowSpan: x,
|
|
@@ -353,14 +353,14 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
353
353
|
const value = aggregator.value();
|
|
354
354
|
const clickHandler = getClickHandler(value, rowKey, colKey);
|
|
355
355
|
return h("td", {
|
|
356
|
-
staticClass:
|
|
356
|
+
staticClass: "pvVal pvtMultiVal",
|
|
357
357
|
attrs: { key: `pvtVal${i}-${j}` },
|
|
358
358
|
on: clickHandler ? { click: clickHandler } : {}
|
|
359
359
|
}, [this.renderMultiValueCell(h, value, rowKey, colKey)]);
|
|
360
360
|
}),
|
|
361
361
|
// Row total
|
|
362
362
|
this.rowTotal ? h("td", {
|
|
363
|
-
staticClass:
|
|
363
|
+
staticClass: "pvtTotal pvtMultiVal",
|
|
364
364
|
on: getClickHandler(totalAggregator.value(), rowKey, []) ? { click: getClickHandler(totalAggregator.value(), rowKey, []) } : {}
|
|
365
365
|
}, [this.renderMultiValueCell(h, totalAggregator.value(), rowKey, [])]) : void 0
|
|
366
366
|
]);
|
|
@@ -368,7 +368,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
368
368
|
// Column totals row
|
|
369
369
|
h("tr", [
|
|
370
370
|
this.colTotal ? h("th", {
|
|
371
|
-
staticClass:
|
|
371
|
+
staticClass: "pvtTotalLabel",
|
|
372
372
|
attrs: {
|
|
373
373
|
colSpan: rowAttrs.length + (colAttrs.length === 0 ? 0 : 1)
|
|
374
374
|
}
|
|
@@ -377,13 +377,13 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
377
377
|
const totalAggregator = pivotData.getAggregator([], colKey);
|
|
378
378
|
const clickHandler = getClickHandler(totalAggregator.value(), [], colKey);
|
|
379
379
|
return h("td", {
|
|
380
|
-
staticClass:
|
|
380
|
+
staticClass: "pvtTotal pvtMultiVal",
|
|
381
381
|
attrs: { key: `total${i}` },
|
|
382
382
|
on: clickHandler ? { click: clickHandler } : {}
|
|
383
383
|
}, [this.renderMultiValueCell(h, totalAggregator.value(), [], colKey)]);
|
|
384
384
|
}) : void 0,
|
|
385
385
|
this.colTotal && this.rowTotal ? h("td", {
|
|
386
|
-
staticClass:
|
|
386
|
+
staticClass: "pvtGrandTotal pvtMultiVal",
|
|
387
387
|
on: getClickHandler(grandTotalAggregator.value(), [], []) ? { click: getClickHandler(grandTotalAggregator.value(), [], []) } : {}
|
|
388
388
|
}, [this.renderMultiValueCell(h, grandTotalAggregator.value(), [], [])]) : void 0
|
|
389
389
|
])
|
package/dist/vue2.mjs
CHANGED
|
@@ -201,7 +201,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
201
201
|
staticClass: "multi-value-label"
|
|
202
202
|
}, `${label}: `) : null,
|
|
203
203
|
h("span", {
|
|
204
|
-
staticClass:
|
|
204
|
+
staticClass: "multi-value-value"
|
|
205
205
|
}, formatted)
|
|
206
206
|
]);
|
|
207
207
|
});
|
|
@@ -209,7 +209,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
209
209
|
return items.join(" / ");
|
|
210
210
|
}
|
|
211
211
|
return h("div", {
|
|
212
|
-
staticClass:
|
|
212
|
+
staticClass: `multi-value-cell layout-${this.cellLayout}`
|
|
213
213
|
}, items);
|
|
214
214
|
},
|
|
215
215
|
/**
|
|
@@ -247,7 +247,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
247
247
|
} catch (error) {
|
|
248
248
|
console.error("Multi-Value Renderer Error:", error);
|
|
249
249
|
return h("div", {
|
|
250
|
-
staticClass:
|
|
250
|
+
staticClass: "pvtError"
|
|
251
251
|
}, `Error: ${error.message}`);
|
|
252
252
|
}
|
|
253
253
|
const colAttrs = pivotData.props.cols;
|
|
@@ -273,7 +273,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
273
273
|
return null;
|
|
274
274
|
};
|
|
275
275
|
return h("table", {
|
|
276
|
-
staticClass:
|
|
276
|
+
staticClass: "pvtTable pvtMultiValueTable"
|
|
277
277
|
}, [
|
|
278
278
|
// THEAD
|
|
279
279
|
h("thead", [
|
|
@@ -288,13 +288,13 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
288
288
|
}
|
|
289
289
|
}) : void 0,
|
|
290
290
|
// Column attribute label
|
|
291
|
-
h("th", { staticClass:
|
|
291
|
+
h("th", { staticClass: "pvtAxisLabel" }, c),
|
|
292
292
|
// Column keys
|
|
293
293
|
colKeys.map((colKey, i) => {
|
|
294
294
|
const x = this.spanSize(colKeys, i, j);
|
|
295
295
|
if (x === -1) return null;
|
|
296
296
|
return h("th", {
|
|
297
|
-
staticClass:
|
|
297
|
+
staticClass: "pvtColLabel",
|
|
298
298
|
attrs: {
|
|
299
299
|
key: `colKey${i}`,
|
|
300
300
|
colSpan: x,
|
|
@@ -304,7 +304,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
304
304
|
}),
|
|
305
305
|
// Totals header
|
|
306
306
|
j === 0 && this.rowTotal ? h("th", {
|
|
307
|
-
staticClass:
|
|
307
|
+
staticClass: "pvtTotalLabel",
|
|
308
308
|
attrs: {
|
|
309
309
|
rowSpan: colAttrs.length + (rowAttrs.length === 0 ? 0 : 1)
|
|
310
310
|
}
|
|
@@ -315,13 +315,13 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
315
315
|
rowAttrs.length !== 0 ? h("tr", [
|
|
316
316
|
rowAttrs.map((r, i) => {
|
|
317
317
|
return h("th", {
|
|
318
|
-
staticClass:
|
|
318
|
+
staticClass: "pvtAxisLabel",
|
|
319
319
|
key: `rowAttr${i}`
|
|
320
320
|
}, r);
|
|
321
321
|
}),
|
|
322
322
|
this.rowTotal ? h(
|
|
323
323
|
"th",
|
|
324
|
-
{ staticClass:
|
|
324
|
+
{ staticClass: "pvtTotalLabel" },
|
|
325
325
|
colAttrs.length === 0 ? this.localeStrings.totals : null
|
|
326
326
|
) : colAttrs.length === 0 ? void 0 : h("th")
|
|
327
327
|
]) : void 0
|
|
@@ -337,7 +337,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
337
337
|
const x = this.spanSize(rowKeys, i, j);
|
|
338
338
|
if (x === -1) return null;
|
|
339
339
|
return h("th", {
|
|
340
|
-
staticClass:
|
|
340
|
+
staticClass: "pvtRowLabel",
|
|
341
341
|
attrs: {
|
|
342
342
|
key: `rowKeyLabel${i}-${j}`,
|
|
343
343
|
rowSpan: x,
|
|
@@ -351,14 +351,14 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
351
351
|
const value = aggregator.value();
|
|
352
352
|
const clickHandler = getClickHandler(value, rowKey, colKey);
|
|
353
353
|
return h("td", {
|
|
354
|
-
staticClass:
|
|
354
|
+
staticClass: "pvVal pvtMultiVal",
|
|
355
355
|
attrs: { key: `pvtVal${i}-${j}` },
|
|
356
356
|
on: clickHandler ? { click: clickHandler } : {}
|
|
357
357
|
}, [this.renderMultiValueCell(h, value, rowKey, colKey)]);
|
|
358
358
|
}),
|
|
359
359
|
// Row total
|
|
360
360
|
this.rowTotal ? h("td", {
|
|
361
|
-
staticClass:
|
|
361
|
+
staticClass: "pvtTotal pvtMultiVal",
|
|
362
362
|
on: getClickHandler(totalAggregator.value(), rowKey, []) ? { click: getClickHandler(totalAggregator.value(), rowKey, []) } : {}
|
|
363
363
|
}, [this.renderMultiValueCell(h, totalAggregator.value(), rowKey, [])]) : void 0
|
|
364
364
|
]);
|
|
@@ -366,7 +366,7 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
366
366
|
// Column totals row
|
|
367
367
|
h("tr", [
|
|
368
368
|
this.colTotal ? h("th", {
|
|
369
|
-
staticClass:
|
|
369
|
+
staticClass: "pvtTotalLabel",
|
|
370
370
|
attrs: {
|
|
371
371
|
colSpan: rowAttrs.length + (colAttrs.length === 0 ? 0 : 1)
|
|
372
372
|
}
|
|
@@ -375,13 +375,13 @@ function makeMultiValueRenderer(opts = {}) {
|
|
|
375
375
|
const totalAggregator = pivotData.getAggregator([], colKey);
|
|
376
376
|
const clickHandler = getClickHandler(totalAggregator.value(), [], colKey);
|
|
377
377
|
return h("td", {
|
|
378
|
-
staticClass:
|
|
378
|
+
staticClass: "pvtTotal pvtMultiVal",
|
|
379
379
|
attrs: { key: `total${i}` },
|
|
380
380
|
on: clickHandler ? { click: clickHandler } : {}
|
|
381
381
|
}, [this.renderMultiValueCell(h, totalAggregator.value(), [], colKey)]);
|
|
382
382
|
}) : void 0,
|
|
383
383
|
this.colTotal && this.rowTotal ? h("td", {
|
|
384
|
-
staticClass:
|
|
384
|
+
staticClass: "pvtGrandTotal pvtMultiVal",
|
|
385
385
|
on: getClickHandler(grandTotalAggregator.value(), [], []) ? { click: getClickHandler(grandTotalAggregator.value(), [], []) } : {}
|
|
386
386
|
}, [this.renderMultiValueCell(h, grandTotalAggregator.value(), [], [])]) : void 0
|
|
387
387
|
])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-pivottable/multi-value-renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Multi-value aggregator renderer for vue-pivottable (Vue 2/3 compatible)",
|
|
5
5
|
"author": "Seungwoo321",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"import": "./dist/vue3.mjs",
|
|
25
25
|
"require": "./dist/vue3.js"
|
|
26
26
|
},
|
|
27
|
+
"./styles.css": "./dist/styles.css",
|
|
27
28
|
"./dist/styles.css": "./dist/styles.css",
|
|
28
29
|
"./package.json": "./package.json"
|
|
29
30
|
},
|
|
@@ -49,8 +50,9 @@
|
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
53
|
+
"@release-it/conventional-changelog": "^10.0.4",
|
|
52
54
|
"@vitejs/plugin-vue": "^5.0.0",
|
|
53
|
-
"release-it": "^
|
|
55
|
+
"release-it": "^19.2.3",
|
|
54
56
|
"rimraf": "^5.0.0",
|
|
55
57
|
"typescript": "^5.0.0",
|
|
56
58
|
"vite": "^5.0.0",
|