@conduction/nextcloud-vue 2.174.0 → 2.176.1
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/dist/esm/components/CnActionDialog/CnActionDialog.vue.js +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js +114 -11
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js +67 -17
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js +9 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js.map +1 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js +352 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js.map +1 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js +266 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js.map +1 -0
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +323 -7
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js +113 -59
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue.js +1 -1
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js +210 -5
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js.map +1 -1
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js +134 -46
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js.map +1 -1
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js +9 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js.map +1 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js +385 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js.map +1 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js +277 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js.map +1 -0
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue.js +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js +175 -20
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js +30 -8
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue.js +1 -1
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js +72 -6
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js +48 -14
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue.js +1 -1
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js +255 -10
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js.map +1 -1
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js +70 -28
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +55 -6
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js +9 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js.map +1 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js +175 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js.map +1 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js +114 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js.map +1 -0
- package/dist/esm/components/CnDurationField/CnDurationField.vue.js +1 -1
- package/dist/esm/components/CnDurationField/CnDurationField.vue2.js +218 -4
- package/dist/esm/components/CnDurationField/CnDurationField.vue2.js.map +1 -1
- package/dist/esm/components/CnDurationField/CnDurationField.vue3.js +133 -44
- package/dist/esm/components/CnDurationField/CnDurationField.vue3.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js +5 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js +9 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js.map +1 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js +113 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js.map +1 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js +43 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js.map +1 -0
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +40 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue.js +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js +110 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js.map +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js +60 -18
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js.map +1 -1
- package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js +2 -2
- package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js +2 -2
- package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js +2 -2
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnQrCode/CnQrCode.vue.js +9 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue.js.map +1 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue2.js +241 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue2.js.map +1 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue3.js +75 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue3.js.map +1 -0
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue.js +1 -1
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js +34 -3
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js.map +1 -1
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js +81 -19
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +11 -0
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +112 -88
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnRevealField/CnRevealField.vue.js +9 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue.js.map +1 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue2.js +157 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue2.js.map +1 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue3.js +116 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue3.js.map +1 -0
- package/dist/esm/components/CnStorePage/CnStorePage.vue.js +1 -1
- package/dist/esm/components/CnStorePage/CnStorePage.vue2.js +3 -3
- package/dist/esm/components/CnStorePage/CnStorePage.vue2.js.map +1 -1
- package/dist/esm/components/CnStorePage/CnStorePage.vue3.js +5 -5
- package/dist/esm/components/CnStorePage/CnStorePage.vue3.js.map +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue.js +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js +6 -6
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue.js +1 -1
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js +43 -3
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js +19 -12
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js +9 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js.map +1 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js +87 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js.map +1 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js +126 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js.map +1 -0
- package/dist/esm/components/CnTreeView/CnTreeNode.vue.js +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js +66 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js +129 -29
- package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue.js +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue2.js +158 -6
- package/dist/esm/components/CnTreeView/CnTreeView.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js +100 -39
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js.map +1 -1
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/l10n/en.json.js +79 -14
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +79 -14
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +1162 -523
- package/dist/esm/node_modules/vuedraggable/dist/vuedraggable.umd.js +2 -2
- package/dist/esm/utils/captureLocation.js +32 -0
- package/dist/esm/utils/captureLocation.js.map +1 -0
- package/dist/esm/utils/childRecordTotals.js +157 -0
- package/dist/esm/utils/childRecordTotals.js.map +1 -0
- package/dist/esm/utils/isoDuration.js +51 -1
- package/dist/esm/utils/isoDuration.js.map +1 -1
- package/dist/esm/utils/parentCrumb.js +86 -0
- package/dist/esm/utils/parentCrumb.js.map +1 -0
- package/dist/esm/utils/qr.js +649 -0
- package/dist/esm/utils/qr.js.map +1 -0
- package/dist/esm/utils/schema.js +3 -0
- package/dist/esm/utils/schema.js.map +1 -1
- package/dist/esm/utils/templateVariables.js +54 -0
- package/dist/esm/utils/templateVariables.js.map +1 -0
- package/dist/nextcloud-vue.cjs.js +21125 -15025
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +1162 -523
- package/l10n/en.json +79 -14
- package/l10n/nl.json +79 -14
- package/package.json +1 -1
- package/src/components/CnActionDialog/CnActionDialog.vue +156 -9
- package/src/components/CnBlockListEditor/CnBlockListEditor.vue +615 -0
- package/src/components/CnBlockListEditor/index.js +9 -0
- package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +377 -10
- package/src/components/CnChildRecordsField/CnChildRecordsField.vue +306 -15
- package/src/components/CnChoiceMatrix/CnChoiceMatrix.vue +710 -0
- package/src/components/CnChoiceMatrix/index.js +9 -0
- package/src/components/CnCountdownWidget/CnCountdownWidget.vue +223 -28
- package/src/components/CnCreateFormWidget/CnCreateFormWidget.vue +97 -6
- package/src/components/CnDataMatrix/CnDataMatrix.vue +304 -17
- package/src/components/CnDetailPage/CnDetailPage.vue +55 -6
- package/src/components/CnDisplayScreen/CnDisplayScreen.vue +308 -0
- package/src/components/CnDisplayScreen/index.js +9 -0
- package/src/components/CnDurationField/CnDurationField.vue +330 -5
- package/src/components/CnFormDialog/CnFormDialog.vue +4 -0
- package/src/components/CnGeoCaptureField/CnGeoCaptureField.vue +148 -0
- package/src/components/CnGeoCaptureField/index.js +9 -0
- package/src/components/CnIndexPage/CnIndexPage.vue +40 -1
- package/src/components/CnMarkdownEditor/CnMarkdownEditor.vue +139 -1
- package/src/components/CnQrCode/CnQrCode.vue +321 -0
- package/src/components/CnQrCode/index.js +9 -0
- package/src/components/CnReadinessChecklist/CnReadinessChecklist.vue +80 -3
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +34 -1
- package/src/components/CnRevealField/CnRevealField.vue +273 -0
- package/src/components/CnRevealField/index.js +9 -0
- package/src/components/CnStorePage/CnStorePage.vue +8 -8
- package/src/components/CnStorePage/CnStorePublishDialog.vue +7 -7
- package/src/components/CnTextWidget/CnTextWidget.vue +62 -3
- package/src/components/CnTransferCard/CnTransferCard.vue +205 -0
- package/src/components/CnTransferCard/index.js +9 -0
- package/src/components/CnTreeView/CnTreeNode.vue +145 -2
- package/src/components/CnTreeView/CnTreeView.vue +210 -6
- package/src/components/index.js +7 -0
- package/src/index.js +8 -0
- package/src/utils/captureLocation.js +29 -0
- package/src/utils/childRecordTotals.js +153 -0
- package/src/utils/isoDuration.js +50 -0
- package/src/utils/parentCrumb.js +83 -0
- package/src/utils/qr.js +681 -0
- package/src/utils/schema.js +3 -0
- package/src/utils/templateVariables.js +51 -0
|
@@ -1,8 +1,23 @@
|
|
|
1
|
+
import { translate } from '@nextcloud/l10n';
|
|
2
|
+
import { evalFormula } from '../../utils/evalFormula.js';
|
|
1
3
|
import { userLocale } from '../../utils/userLocale.js';
|
|
2
4
|
|
|
5
|
+
const ROUNDERS = Object.freeze({ round: Math.round, ceil: Math.ceil, floor: Math.floor });
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The number a cell holds; an empty cell is no number, rather than zero.
|
|
9
|
+
*
|
|
10
|
+
* @param {unknown} raw The cell.
|
|
11
|
+
* @return {number|null} The number, or null.
|
|
12
|
+
*/
|
|
13
|
+
function numberIn(raw) {
|
|
14
|
+
return raw === null || raw === undefined || raw === '' || !Number.isFinite(Number(raw)) ? null : Number(raw)
|
|
15
|
+
}
|
|
16
|
+
|
|
3
17
|
/**
|
|
4
18
|
* CnDataMatrix — Inline-edit data grid for matrix-shaped data
|
|
5
|
-
* (rows × columns). Each cell is click-to-edit
|
|
19
|
+
* (rows × columns). Each cell is click-to-edit, and keyboard editable:
|
|
20
|
+
* Tab reaches it, Enter or F2 opens it, Enter commits, Escape cancels. Commits emit
|
|
6
21
|
* `@cell-edit({ rowId, colKey, value })` so the parent can persist.
|
|
7
22
|
* Optional row / column / grand totals computed from the live data
|
|
8
23
|
* with the column's `aggregate` setting (`sum` by default).
|
|
@@ -11,8 +26,19 @@ import { userLocale } from '../../utils/userLocale.js';
|
|
|
11
26
|
* rubrics — the "spreadsheet" shape where cells are independently
|
|
12
27
|
* editable values rather than a row/object form.
|
|
13
28
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
29
|
+
* A column with `formula` computes its cells from the other columns and is
|
|
30
|
+
* read only: `now*(rate/100)`, with `prev_now` for the row above and `round`
|
|
31
|
+
* set to `round`, `ceil` or `floor`. A row where the formula has no answer shows
|
|
32
|
+
* its own stored value. Formulas are arithmetic only, through `evalFormula`.
|
|
33
|
+
*
|
|
34
|
+
* A scoring matrix weighs its columns: give each column a `weight` (and an
|
|
35
|
+
* optional `weightLabel` such as "40%"), set `rowTotalsMode="weighted"` and
|
|
36
|
+
* the row total is the weighted mean of the row's scores. `showRank` ranks
|
|
37
|
+
* the rows by that total, highest first, and `highlightTopRank` tints the
|
|
38
|
+
* leading row.
|
|
39
|
+
*
|
|
40
|
+
* Not a full spreadsheet engine — there are no cell-range references, no
|
|
41
|
+
* charts. Consumers wanting that should
|
|
16
42
|
* embed a dedicated library (e.g. handsontable) and use this for
|
|
17
43
|
* the simpler cases.
|
|
18
44
|
*
|
|
@@ -44,7 +70,7 @@ var script = {
|
|
|
44
70
|
/**
|
|
45
71
|
* Column declarations.
|
|
46
72
|
*
|
|
47
|
-
* @type {Array<{key:string,label?:string,type?:'number'|'string',readOnly?:boolean,formatter?:(value: unknown) => string,aggregate?:'sum'|'avg'|'count'|'none',width?:string}>}
|
|
73
|
+
* @type {Array<{key:string,label?:string,type?:'number'|'string',readOnly?:boolean,formula?:string,round?:'round'|'ceil'|'floor',formatter?:(value: unknown) => string,aggregate?:'sum'|'avg'|'count'|'none',width?:string,weight?:number,weightLabel?:string}>}
|
|
48
74
|
*/
|
|
49
75
|
columns: { type: Array, default: () => [] },
|
|
50
76
|
/** Field on each row carrying its id. */
|
|
@@ -69,6 +95,22 @@ var script = {
|
|
|
69
95
|
rowTotalsLabel: { type: String, default: 'Total' },
|
|
70
96
|
/** Label preceding the column-totals row. */
|
|
71
97
|
columnTotalsLabel: { type: String, default: 'Total' },
|
|
98
|
+
/**
|
|
99
|
+
* How a row total is computed: `sum` adds the number columns,
|
|
100
|
+
* `weighted` takes the mean of the number columns weighted by each
|
|
101
|
+
* column's `weight`, leaving out a cell without a value.
|
|
102
|
+
*/
|
|
103
|
+
rowTotalsMode: { type: String, default: 'sum', validator: (v) => ['sum', 'weighted'].includes(v) },
|
|
104
|
+
/** Fraction digits of the totals; null keeps the locale default. */
|
|
105
|
+
totalsFractionDigits: { type: Number, default: null },
|
|
106
|
+
/** Render a rank column: the rows ranked by their row total, highest first, ties sharing a rank. */
|
|
107
|
+
showRank: { type: Boolean, default: false },
|
|
108
|
+
/** Header of the rank column, already translated; the library default is "Rank". */
|
|
109
|
+
rankLabel: { type: String, default: '' },
|
|
110
|
+
/** Tint the row ranked first. */
|
|
111
|
+
highlightTopRank: { type: Boolean, default: false },
|
|
112
|
+
/** Field on each row with a second line under its label, such as a price. */
|
|
113
|
+
rowSublabelKey: { type: String, default: '' },
|
|
72
114
|
},
|
|
73
115
|
|
|
74
116
|
emits: ['cell-edit'],
|
|
@@ -79,6 +121,69 @@ var script = {
|
|
|
79
121
|
},
|
|
80
122
|
|
|
81
123
|
computed: {
|
|
124
|
+
/** @return {string} The rank column header. */
|
|
125
|
+
resolvedRankLabel() {
|
|
126
|
+
return this.rankLabel || translate('nextcloud-vue', 'Rank')
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The rank of every row with a row total: highest total first, rows
|
|
131
|
+
* with an equal total sharing a rank (1, 2, 2, 4).
|
|
132
|
+
*
|
|
133
|
+
* @return {Map<unknown, number>} Rank per row id.
|
|
134
|
+
*/
|
|
135
|
+
ranks() {
|
|
136
|
+
const totals = this.rows
|
|
137
|
+
.map((row) => ({ id: row[this.rowIdKey], total: this.rowTotal(row) }))
|
|
138
|
+
.filter((entry) => Number.isFinite(entry.total))
|
|
139
|
+
.sort((a, b) => b.total - a.total);
|
|
140
|
+
const ranks = new Map();
|
|
141
|
+
totals.forEach((entry, index) => {
|
|
142
|
+
const previous = totals[index - 1];
|
|
143
|
+
ranks.set(entry.id, previous && previous.total === entry.total ? ranks.get(previous.id) : index + 1);
|
|
144
|
+
});
|
|
145
|
+
return ranks
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The computed cells of every row, in order. A formula reads the row's
|
|
150
|
+
* numbers by column key and the previous row's as `prev_<key>`, and sees
|
|
151
|
+
* formula columns to its left. A formula without an answer has no entry
|
|
152
|
+
* here, so the cell shows what the row itself holds.
|
|
153
|
+
*
|
|
154
|
+
* @return {Map<object, Record<string, number>>} Computed values per row.
|
|
155
|
+
*/
|
|
156
|
+
formulaValues() {
|
|
157
|
+
const values = new Map();
|
|
158
|
+
if (!this.columns.some((col) => col.formula)) {
|
|
159
|
+
return values
|
|
160
|
+
}
|
|
161
|
+
let previous = {};
|
|
162
|
+
for (const row of this.rows) {
|
|
163
|
+
const vars = { ...previous };
|
|
164
|
+
for (const col of this.columns) {
|
|
165
|
+
if (!col.formula && numberIn(row[col.key]) !== null) {
|
|
166
|
+
vars[col.key] = numberIn(row[col.key]);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const computed = {};
|
|
170
|
+
for (const col of this.columns) {
|
|
171
|
+
if (col.formula) {
|
|
172
|
+
const answer = evalFormula(col.formula, vars);
|
|
173
|
+
if (answer !== null) {
|
|
174
|
+
computed[col.key] = (ROUNDERS[col.round] ?? Number)(answer);
|
|
175
|
+
vars[col.key] = computed[col.key];
|
|
176
|
+
} else if (numberIn(row[col.key]) !== null) {
|
|
177
|
+
vars[col.key] = numberIn(row[col.key]);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
values.set(row, computed);
|
|
182
|
+
previous = Object.fromEntries(Object.entries(vars).filter(([key]) => !key.startsWith('prev_')).map(([key, value]) => [`prev_${key}`, value]));
|
|
183
|
+
}
|
|
184
|
+
return values
|
|
185
|
+
},
|
|
186
|
+
|
|
82
187
|
/**
|
|
83
188
|
* Grand total (sum of every numeric cell). Shown in the
|
|
84
189
|
* bottom-right corner when both totals are enabled.
|
|
@@ -90,7 +195,7 @@ var script = {
|
|
|
90
195
|
for (const row of this.rows) {
|
|
91
196
|
for (const col of this.columns) {
|
|
92
197
|
if (col.type === 'number') {
|
|
93
|
-
const v = Number(row
|
|
198
|
+
const v = Number(this.cellValue(row, col));
|
|
94
199
|
if (Number.isFinite(v)) {
|
|
95
200
|
total += v;
|
|
96
201
|
}
|
|
@@ -121,7 +226,98 @@ var script = {
|
|
|
121
226
|
* @return {boolean}
|
|
122
227
|
*/
|
|
123
228
|
isCellReadOnly(row, col) {
|
|
124
|
-
return Boolean(col.readOnly)
|
|
229
|
+
return Boolean(col.readOnly || col.formula)
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Whether a cell can be edited, and so takes keyboard focus.
|
|
234
|
+
*
|
|
235
|
+
* @param {object} row Row record.
|
|
236
|
+
* @param {object} col Column definition.
|
|
237
|
+
* @return {boolean}
|
|
238
|
+
*/
|
|
239
|
+
isCellEditable(row, col) {
|
|
240
|
+
return !this.readOnly && !this.isCellReadOnly(row, col)
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Accessible name of a cell's input: its column and row.
|
|
245
|
+
*
|
|
246
|
+
* @param {object} row Row record.
|
|
247
|
+
* @param {object} col Column definition.
|
|
248
|
+
* @return {string} The label.
|
|
249
|
+
*/
|
|
250
|
+
inputLabel(row, col) {
|
|
251
|
+
return translate('nextcloud-vue', '{column}, {row}', {
|
|
252
|
+
column: col.label || col.key,
|
|
253
|
+
row: row[this.rowLabelKey] ?? row[this.rowIdKey],
|
|
254
|
+
}, undefined, { escape: false })
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Accessible name of an editable cell: its column, row and value.
|
|
259
|
+
*
|
|
260
|
+
* @param {object} row Row record.
|
|
261
|
+
* @param {object} col Column definition.
|
|
262
|
+
* @return {string} The label.
|
|
263
|
+
*/
|
|
264
|
+
cellLabel(row, col) {
|
|
265
|
+
const value = this.formatCell(this.cellValue(row, col), col);
|
|
266
|
+
const vars = { cell: this.inputLabel(row, col), value: String(value) };
|
|
267
|
+
return value === ''
|
|
268
|
+
? translate('nextcloud-vue', '{cell}: empty', vars, undefined, { escape: false })
|
|
269
|
+
: translate('nextcloud-vue', '{cell}: {value}', vars, undefined, { escape: false })
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Enter or F2 on a focused cell starts editing it.
|
|
274
|
+
*
|
|
275
|
+
* @param {KeyboardEvent} event The key event.
|
|
276
|
+
* @param {object} row Row record.
|
|
277
|
+
* @param {object} col Column definition.
|
|
278
|
+
* @return {void}
|
|
279
|
+
*/
|
|
280
|
+
onCellKeydown(event, row, col) {
|
|
281
|
+
if ((event.key === 'Enter' || event.key === 'F2') && this.isCellEditable(row, col)) {
|
|
282
|
+
event.preventDefault();
|
|
283
|
+
this.startEdit(row, col);
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Enter commits and Escape cancels the edit; both return focus to the cell.
|
|
289
|
+
*
|
|
290
|
+
* @param {KeyboardEvent} event The key event.
|
|
291
|
+
* @param {object} row Row record.
|
|
292
|
+
* @param {object} col Column definition.
|
|
293
|
+
* @return {void}
|
|
294
|
+
*/
|
|
295
|
+
onInputKeydown(event, row, col) {
|
|
296
|
+
if (event.key === 'Enter') {
|
|
297
|
+
event.preventDefault();
|
|
298
|
+
this.commitEdit(row, col, event.target.value);
|
|
299
|
+
this.focusCell(row, col);
|
|
300
|
+
} else if (event.key === 'Escape' || event.key === 'Esc') {
|
|
301
|
+
event.preventDefault();
|
|
302
|
+
this.cancelEdit();
|
|
303
|
+
this.focusCell(row, col);
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Move focus to a cell's value after the edit input is gone.
|
|
309
|
+
*
|
|
310
|
+
* @param {object} row Row record.
|
|
311
|
+
* @param {object} col Column definition.
|
|
312
|
+
* @return {void}
|
|
313
|
+
*/
|
|
314
|
+
focusCell(row, col) {
|
|
315
|
+
const rowId = String(row[this.rowIdKey]);
|
|
316
|
+
this.$nextTick(() => {
|
|
317
|
+
const cell = Array.from(this.$el.querySelectorAll('.cn-data-matrix__cell'))
|
|
318
|
+
.find((td) => td.dataset.rowId === rowId && td.dataset.colKey === col.key);
|
|
319
|
+
cell?.querySelector('.cn-data-matrix__cell-value')?.focus();
|
|
320
|
+
});
|
|
125
321
|
},
|
|
126
322
|
|
|
127
323
|
/**
|
|
@@ -132,6 +328,9 @@ var script = {
|
|
|
132
328
|
* @return {unknown} The raw value.
|
|
133
329
|
*/
|
|
134
330
|
cellValue(row, col) {
|
|
331
|
+
if (col.formula && this.formulaValues.get(row)?.[col.key] !== undefined) {
|
|
332
|
+
return this.formulaValues.get(row)[col.key]
|
|
333
|
+
}
|
|
135
334
|
return row[col.key]
|
|
136
335
|
},
|
|
137
336
|
|
|
@@ -237,16 +436,62 @@ var script = {
|
|
|
237
436
|
},
|
|
238
437
|
|
|
239
438
|
/**
|
|
240
|
-
*
|
|
439
|
+
* The weight shown beside a column label: `weightLabel`, else the
|
|
440
|
+
* `weight` itself, or '' for an unweighted column.
|
|
441
|
+
*
|
|
442
|
+
* @param {object} col Column definition.
|
|
443
|
+
* @return {string} The weight text.
|
|
444
|
+
*/
|
|
445
|
+
weightText(col) {
|
|
446
|
+
if (typeof col.weightLabel === 'string' && col.weightLabel !== '') {
|
|
447
|
+
return col.weightLabel
|
|
448
|
+
}
|
|
449
|
+
return Number.isFinite(col.weight) ? String(col.weight) : ''
|
|
450
|
+
},
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Format a total with `totalsFractionDigits` when set.
|
|
454
|
+
*
|
|
455
|
+
* @param {number|null} value The total.
|
|
456
|
+
* @return {string} The display string.
|
|
457
|
+
*/
|
|
458
|
+
formatTotal(value) {
|
|
459
|
+
if (!Number.isFinite(value)) {
|
|
460
|
+
return ''
|
|
461
|
+
}
|
|
462
|
+
if (this.totalsFractionDigits === null) {
|
|
463
|
+
return this.formatCell(value, { type: 'number' })
|
|
464
|
+
}
|
|
465
|
+
const digits = this.totalsFractionDigits;
|
|
466
|
+
return value.toLocaleString(userLocale(), { minimumFractionDigits: digits, maximumFractionDigits: digits })
|
|
467
|
+
},
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Per-row total: the sum of every numeric column, or in `weighted`
|
|
471
|
+
* mode the weighted mean over the weighted columns that hold a value
|
|
472
|
+
* (null when none does).
|
|
241
473
|
*
|
|
242
474
|
* @param {object} row Row record.
|
|
243
|
-
* @return {number}
|
|
475
|
+
* @return {number|null}
|
|
244
476
|
*/
|
|
245
477
|
rowTotal(row) {
|
|
478
|
+
if (this.rowTotalsMode === 'weighted') {
|
|
479
|
+
let weighted = 0;
|
|
480
|
+
let weights = 0;
|
|
481
|
+
for (const col of this.columns) {
|
|
482
|
+
const raw = this.cellValue(row, col);
|
|
483
|
+
const v = Number(raw);
|
|
484
|
+
if (col.type === 'number' && Number.isFinite(col.weight) && col.weight > 0 && raw !== null && raw !== undefined && raw !== '' && Number.isFinite(v)) {
|
|
485
|
+
weighted += v * col.weight;
|
|
486
|
+
weights += col.weight;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return weights > 0 ? weighted / weights : null
|
|
490
|
+
}
|
|
246
491
|
let total = 0;
|
|
247
492
|
for (const col of this.columns) {
|
|
248
493
|
if (col.type === 'number') {
|
|
249
|
-
const v = Number(row
|
|
494
|
+
const v = Number(this.cellValue(row, col));
|
|
250
495
|
if (Number.isFinite(v)) {
|
|
251
496
|
total += v;
|
|
252
497
|
}
|
|
@@ -274,7 +519,7 @@ var script = {
|
|
|
274
519
|
// `Number(null)` is `0`, which would otherwise be counted and
|
|
275
520
|
// summed as a real zero value.
|
|
276
521
|
const values = this.rows
|
|
277
|
-
.map((r) => r
|
|
522
|
+
.map((r) => this.cellValue(r, col))
|
|
278
523
|
.filter((v) => v !== null && v !== undefined && v !== '')
|
|
279
524
|
.map((v) => Number(v))
|
|
280
525
|
.filter((v) => Number.isFinite(v));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnDataMatrix.vue2.js","sources":["../../../../src/components/CnDataMatrix/CnDataMatrix.vue"],"sourcesContent":["<template>\n\t<div class=\"cn-data-matrix\" data-testid=\"cn-data-matrix\">\n\t\t<header v-if=\"title || description\" class=\"cn-data-matrix__header\">\n\t\t\t<h3 v-if=\"title\" class=\"cn-data-matrix__title\">\n\t\t\t\t{{ title }}\n\t\t\t</h3>\n\t\t\t<p v-if=\"description\" class=\"cn-data-matrix__description\">\n\t\t\t\t{{ description }}\n\t\t\t</p>\n\t\t</header>\n\n\t\t<div class=\"cn-data-matrix__scroller\">\n\t\t\t<table class=\"cn-data-matrix__table\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th v-if=\"rowHeader\" class=\"cn-data-matrix__row-header-corner\">\n\t\t\t\t\t\t\t{{ rowHeader }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th v-for=\"col in columns\"\n\t\t\t\t\t\t\t:key=\"col.key\"\n\t\t\t\t\t\t\tclass=\"cn-data-matrix__col-header\"\n\t\t\t\t\t\t\t:style=\"col.width ? { width: col.width } : null\">\n\t\t\t\t\t\t\t{{ col.label || col.key }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th v-if=\"showRowTotals\" class=\"cn-data-matrix__total-header\">\n\t\t\t\t\t\t\t{{ rowTotalsLabel }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr v-for=\"row in rows\"\n\t\t\t\t\t\t:key=\"row[rowIdKey]\"\n\t\t\t\t\t\tclass=\"cn-data-matrix__row\">\n\t\t\t\t\t\t<th v-if=\"rowHeader\" class=\"cn-data-matrix__row-header\" :title=\"row[rowLabelKey]\">\n\t\t\t\t\t\t\t{{ row[rowLabelKey] }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<td v-for=\"col in columns\"\n\t\t\t\t\t\t\t:key=\"col.key\"\n\t\t\t\t\t\t\tclass=\"cn-data-matrix__cell\"\n\t\t\t\t\t\t\t:class=\"cellClass(row, col)\"\n\t\t\t\t\t\t\t:data-row-id=\"row[rowIdKey]\"\n\t\t\t\t\t\t\t:data-col-key=\"col.key\">\n\t\t\t\t\t\t\t<input v-if=\"isEditing(row, col)\"\n\t\t\t\t\t\t\t\tref=\"activeInput\"\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tclass=\"cn-data-matrix__cell-input\"\n\t\t\t\t\t\t\t\t:value=\"cellValue(row, col)\"\n\t\t\t\t\t\t\t\t:disabled=\"readOnly || isCellReadOnly(row, col)\"\n\t\t\t\t\t\t\t\t@blur=\"commitEdit(row, col, $event.target.value)\"\n\t\t\t\t\t\t\t\t@keydown.enter=\"commitEdit(row, col, $event.target.value)\"\n\t\t\t\t\t\t\t\t@keydown.esc=\"cancelEdit\">\n\t\t\t\t\t\t\t<span v-else\n\t\t\t\t\t\t\t\tclass=\"cn-data-matrix__cell-value\"\n\t\t\t\t\t\t\t\t@click=\"startEdit(row, col)\">\n\t\t\t\t\t\t\t\t{{ formatCell(cellValue(row, col), col) }}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRowTotals\" class=\"cn-data-matrix__total-cell\">\n\t\t\t\t\t\t\t{{ formatCell(rowTotal(row), { type: 'number' }) }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr v-if=\"showColumnTotals\" class=\"cn-data-matrix__totals-row\">\n\t\t\t\t\t\t<th v-if=\"rowHeader\" class=\"cn-data-matrix__totals-label\">\n\t\t\t\t\t\t\t{{ columnTotalsLabel }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<td v-for=\"col in columns\"\n\t\t\t\t\t\t\t:key=\"col.key\"\n\t\t\t\t\t\t\tclass=\"cn-data-matrix__total-cell\">\n\t\t\t\t\t\t\t{{ formatCell(columnTotal(col), { type: 'number' }) }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRowTotals\" class=\"cn-data-matrix__total-cell cn-data-matrix__grand-total\">\n\t\t\t\t\t\t\t{{ formatCell(grandTotal, { type: 'number' }) }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>\n\n\t\t<p v-if=\"rows.length === 0\" class=\"cn-data-matrix__empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { userLocale } from '../../utils/userLocale.js'\n/**\n * CnDataMatrix — Inline-edit data grid for matrix-shaped data\n * (rows × columns). Each cell is click-to-edit; commits emit\n * `@cell-edit({ rowId, colKey, value })` so the parent can persist.\n * Optional row / column / grand totals computed from the live data\n * with the column's `aggregate` setting (`sum` by default).\n *\n * Use for gradebooks, weight matrices, allocation tables, scoring\n * rubrics — the \"spreadsheet\" shape where cells are independently\n * editable values rather than a row/object form.\n *\n * Not a full spreadsheet engine — there's no formula language, no\n * cell-range references, no charts. Consumers wanting that should\n * embed a dedicated library (e.g. handsontable) and use this for\n * the simpler cases.\n *\n * ```vue\n * <CnDataMatrix\n * title=\"Cohort gradebook\"\n * row-header=\"Student\"\n * :rows=\"students\"\n * :columns=\"[\n * { key: 'midterm', label: 'Midterm', type: 'number', aggregate: 'sum' },\n * { key: 'final', label: 'Final', type: 'number', aggregate: 'sum' },\n * { key: 'notes', label: 'Notes', type: 'string', readOnly: true },\n * ]\"\n * :show-row-totals=\"true\"\n * :show-column-totals=\"true\"\n * @cell-edit=\"onCellEdit\" />\n * ```\n */\nexport default {\n\tname: 'CnDataMatrix',\n\tprops: {\n\t\t/**\n\t\t * Row records. Each record holds an `id`, an optional row\n\t\t * label, and one field per column key.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\trows: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Column declarations.\n\t\t *\n\t\t * @type {Array<{key:string,label?:string,type?:'number'|'string',readOnly?:boolean,formatter?:(value: unknown) => string,aggregate?:'sum'|'avg'|'count'|'none',width?:string}>}\n\t\t */\n\t\tcolumns: { type: Array, default: () => [] },\n\t\t/** Field on each row carrying its id. */\n\t\trowIdKey: { type: String, default: 'id' },\n\t\t/** Field on each row carrying its label (shown in the row header). */\n\t\trowLabelKey: { type: String, default: 'label' },\n\t\t/** Header for the row-label column (empty hides it). */\n\t\trowHeader: { type: String, default: '' },\n\t\t/** Optional title. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Optional description. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** Empty-state text when rows[] is empty. */\n\t\temptyLabel: { type: String, default: 'No data.' },\n\t\t/** Disable all cell editing globally. */\n\t\treadOnly: { type: Boolean, default: false },\n\t\t/** Render the per-row totals column. */\n\t\tshowRowTotals: { type: Boolean, default: false },\n\t\t/** Render the per-column totals row at the bottom. */\n\t\tshowColumnTotals: { type: Boolean, default: false },\n\t\t/** Label for the row-totals column header. */\n\t\trowTotalsLabel: { type: String, default: 'Total' },\n\t\t/** Label preceding the column-totals row. */\n\t\tcolumnTotalsLabel: { type: String, default: 'Total' },\n\t},\n\n\temits: ['cell-edit'],\n\tdata() {\n\t\treturn {\n\t\t\tediting: null, // { rowId, colKey }\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * Grand total (sum of every numeric cell). Shown in the\n\t\t * bottom-right corner when both totals are enabled.\n\t\t *\n\t\t * @return {number}\n\t\t */\n\t\tgrandTotal() {\n\t\t\tlet total = 0\n\t\t\tfor (const row of this.rows) {\n\t\t\t\tfor (const col of this.columns) {\n\t\t\t\t\tif (col.type === 'number') {\n\t\t\t\t\t\tconst v = Number(row[col.key])\n\t\t\t\t\t\tif (Number.isFinite(v)) {\n\t\t\t\t\t\t\ttotal += v\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn total\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Whether the given (row, col) is the active edit cell.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {boolean}\n\t\t */\n\t\tisEditing(row, col) {\n\t\t\treturn this.editing && this.editing.rowId === row[this.rowIdKey] && this.editing.colKey === col.key\n\t\t},\n\n\t\t/**\n\t\t * Effective read-only flag for a single cell.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {boolean}\n\t\t */\n\t\tisCellReadOnly(row, col) {\n\t\t\treturn Boolean(col.readOnly)\n\t\t},\n\n\t\t/**\n\t\t * Read the cell value from the row.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {unknown} The raw value.\n\t\t */\n\t\tcellValue(row, col) {\n\t\t\treturn row[col.key]\n\t\t},\n\n\t\t/**\n\t\t * Format a cell value for display. Number columns get a\n\t\t * locale-formatted number; others go through the column's\n\t\t * `formatter` (if any) or are returned verbatim.\n\t\t *\n\t\t * @param {unknown} value The raw value.\n\t\t * @param {object} col Column definition.\n\t\t * @return {string} The display string.\n\t\t */\n\t\tformatCell(value, col) {\n\t\t\tif (value === undefined || value === null || value === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tif (typeof col.formatter === 'function') {\n\t\t\t\treturn col.formatter(value)\n\t\t\t}\n\t\t\tif (col.type === 'number') {\n\t\t\t\tconst n = Number(value)\n\t\t\t\tif (!Number.isFinite(n)) {\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t\treturn n.toLocaleString(userLocale())\n\t\t\t}\n\t\t\treturn value\n\t\t},\n\n\t\t/**\n\t\t * BEM modifier(s) for a cell — currently only the read-only\n\t\t * flag. Consumers extend via the `formatter` if they want\n\t\t * to swap to a styled component.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {object} Class binding.\n\t\t */\n\t\tcellClass(row, col) {\n\t\t\treturn {\n\t\t\t\t'cn-data-matrix__cell--read-only': this.readOnly || this.isCellReadOnly(row, col),\n\t\t\t\t'cn-data-matrix__cell--number': col.type === 'number',\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Start editing a cell.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {void}\n\t\t */\n\t\tstartEdit(row, col) {\n\t\t\tif (this.readOnly || this.isCellReadOnly(row, col)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.editing = { rowId: row[this.rowIdKey], colKey: col.key }\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tif (this.$refs.activeInput && this.$refs.activeInput[0]) {\n\t\t\t\t\tthis.$refs.activeInput[0].focus()\n\t\t\t\t\tthis.$refs.activeInput[0].select()\n\t\t\t\t} else if (this.$refs.activeInput && this.$refs.activeInput.focus) {\n\t\t\t\t\tthis.$refs.activeInput.focus()\n\t\t\t\t\tthis.$refs.activeInput.select()\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Commit an edit — coerces the value to the column type and\n\t\t * emits `@cell-edit`.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @param {string} raw The raw input string.\n\t\t * @return {void}\n\t\t */\n\t\tcommitEdit(row, col, raw) {\n\t\t\tif (!this.editing) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet value = raw\n\t\t\tif (col.type === 'number') {\n\t\t\t\tconst n = Number(raw)\n\t\t\t\tvalue = Number.isFinite(n) ? n : null\n\t\t\t}\n\t\t\tthis.editing = null\n\t\t\t/**\n\t\t\t * @event cell-edit Emitted on commit (blur or Enter).\n\t\t\t * Payload: `{rowId, colKey, value, row}`.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('cell-edit', { rowId: row[this.rowIdKey], colKey: col.key, value, row })\n\t\t},\n\n\t\t/**\n\t\t * Cancel the active edit (Esc).\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcancelEdit() {\n\t\t\tthis.editing = null\n\t\t},\n\n\t\t/**\n\t\t * Per-row total — sum of every numeric column.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @return {number}\n\t\t */\n\t\trowTotal(row) {\n\t\t\tlet total = 0\n\t\t\tfor (const col of this.columns) {\n\t\t\t\tif (col.type === 'number') {\n\t\t\t\t\tconst v = Number(row[col.key])\n\t\t\t\t\tif (Number.isFinite(v)) {\n\t\t\t\t\t\ttotal += v\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn total\n\t\t},\n\n\t\t/**\n\t\t * Per-column total — aggregate over all rows using the\n\t\t * column's `aggregate` setting (`sum` by default).\n\t\t *\n\t\t * @param {object} col Column definition.\n\t\t * @return {number}\n\t\t */\n\t\tcolumnTotal(col) {\n\t\t\tif (col.type !== 'number') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst mode = col.aggregate || 'sum'\n\t\t\tif (mode === 'none') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\t// Drop empty cells (null / undefined / '') BEFORE coercing —\n\t\t\t// `Number(null)` is `0`, which would otherwise be counted and\n\t\t\t// summed as a real zero value.\n\t\t\tconst values = this.rows\n\t\t\t\t.map((r) => r[col.key])\n\t\t\t\t.filter((v) => v !== null && v !== undefined && v !== '')\n\t\t\t\t.map((v) => Number(v))\n\t\t\t\t.filter((v) => Number.isFinite(v))\n\t\t\tif (values.length === 0) {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tif (mode === 'count') {\n\t\t\t\treturn values.length\n\t\t\t}\n\t\t\tif (mode === 'avg') {\n\t\t\t\treturn values.reduce((a, b) => a + b, 0) / values.length\n\t\t\t}\n\t\t\t// default: sum\n\t\t\treturn values.reduce((a, b) => a + b, 0)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-data-matrix {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-data-matrix__title {\n\tmargin: 0;\n\tfont-size: 1.1em;\n}\n\n.cn-data-matrix__description {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-data-matrix__scroller {\n\toverflow-x: auto;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n}\n\n.cn-data-matrix__table {\n\twidth: 100%;\n\tborder-collapse: collapse;\n\tfont-size: 0.95em;\n}\n\n.cn-data-matrix__col-header,\n.cn-data-matrix__row-header-corner,\n.cn-data-matrix__total-header {\n\tbackground: var(--color-background-hover);\n\ttext-align: left;\n\tpadding: 8px 10px;\n\tfont-weight: 600;\n\tborder-bottom: 1px solid var(--color-border);\n\tborder-right: 1px solid var(--color-border);\n}\n\n.cn-data-matrix__row-header {\n\tbackground: var(--color-background-hover);\n\ttext-align: left;\n\tpadding: 6px 10px;\n\tfont-weight: 500;\n\tborder-right: 1px solid var(--color-border);\n\tborder-bottom: 1px solid var(--color-border);\n\tmax-width: 200px;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-data-matrix__cell {\n\tpadding: 0;\n\tborder-right: 1px solid var(--color-border);\n\tborder-bottom: 1px solid var(--color-border);\n\tmin-width: 80px;\n}\n\n.cn-data-matrix__cell--number {\n\ttext-align: right;\n}\n\n.cn-data-matrix__cell-value {\n\tdisplay: block;\n\tpadding: 6px 10px;\n\tcursor: cell;\n\tmin-height: 28px;\n}\n\n.cn-data-matrix__cell--read-only .cn-data-matrix__cell-value {\n\tcursor: default;\n\tbackground: var(--color-background-hover);\n}\n\n.cn-data-matrix__cell-input {\n\twidth: 100%;\n\tpadding: 5px 10px;\n\tborder: 1px solid var(--color-primary-element);\n\tbackground: var(--color-main-background);\n\toutline: none;\n\tfont: inherit;\n}\n\n.cn-data-matrix__totals-row .cn-data-matrix__total-cell,\n.cn-data-matrix__total-header {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n\tfont-weight: 600;\n\ttext-align: right;\n\tpadding: 6px 10px;\n}\n\n.cn-data-matrix__totals-label {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n\tfont-weight: 600;\n\tpadding: 6px 10px;\n\ttext-align: left;\n}\n\n.cn-data-matrix__grand-total {\n\tbackground: var(--color-primary-element-light);\n}\n\n.cn-data-matrix__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n\tmargin: 16px 0;\n\ttext-align: center;\n}\n</style>\n"],"names":[],"mappings":";;AAsFA;;;;;;AAMC;;;AAGA;AACA;;;;AAIA;AACA;AACA;;;AAGA;AACA;;AAEA;;;AAGA;;;;AAIA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,cAAc;AACpB,CAAA,KAAK,EAAE;AACN;;AAEC;AACA;AACA;;AAED,EAAA,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI;AACxC;AACC;AACA;AACA;;AAED,EAAA,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI;AAC3C;AACA,EAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;AAEzC,EAAA,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS;;AAE/C,EAAA,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;AACxC;AACA,EAAA,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAC,EAAG;;AAEpC,EAAA,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;AAC1C;AACA,EAAA,UAAU,EAAE,EAAE,IAAI,EAAE,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AAA;AACxD,KAAC,GAAG,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAA;AACrB,KAAC,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAA;AAClC,GAAA,IAAI,MAAM,CAAC,MAAK,KAAM,CAAC,EAAE;AACxB,IAAA,OAAO,CAAA;AACR,IAAA;AACA,GAAA,IAAI,SAAS,OAAO,EAAE;AACrB,IAAA,OAAO,MAAM,CAAC,MAAK;AACpB,IAAA;AACA,GAAA,IAAI,IAAK,KAAI,KAAK,EAAE;IACnB,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAE,GAAE,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,MAAK;AACxD,IAAA;;AAEA,GAAA,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAA,GAAI,CAAC,EAAE,CAAC,CAAA;GACvC;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnDataMatrix.vue2.js","sources":["../../../../src/components/CnDataMatrix/CnDataMatrix.vue"],"sourcesContent":["<template>\n\t<div class=\"cn-data-matrix\" data-testid=\"cn-data-matrix\">\n\t\t<header v-if=\"title || description\" class=\"cn-data-matrix__header\">\n\t\t\t<h3 v-if=\"title\" class=\"cn-data-matrix__title\">\n\t\t\t\t{{ title }}\n\t\t\t</h3>\n\t\t\t<p v-if=\"description\" class=\"cn-data-matrix__description\">\n\t\t\t\t{{ description }}\n\t\t\t</p>\n\t\t</header>\n\n\t\t<div class=\"cn-data-matrix__scroller\">\n\t\t\t<table class=\"cn-data-matrix__table\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th v-if=\"rowHeader\" class=\"cn-data-matrix__row-header-corner\">\n\t\t\t\t\t\t\t{{ rowHeader }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th v-for=\"col in columns\"\n\t\t\t\t\t\t\t:key=\"col.key\"\n\t\t\t\t\t\t\tclass=\"cn-data-matrix__col-header\"\n\t\t\t\t\t\t\t:style=\"col.width ? { width: col.width } : null\">\n\t\t\t\t\t\t\t{{ col.label || col.key }}\n\t\t\t\t\t\t\t<span v-if=\"weightText(col)\" class=\"cn-data-matrix__weight\">{{ weightText(col) }}</span>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th v-if=\"showRowTotals\" class=\"cn-data-matrix__total-header\">\n\t\t\t\t\t\t\t{{ rowTotalsLabel }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th v-if=\"showRank\" class=\"cn-data-matrix__total-header cn-data-matrix__rank-header\">\n\t\t\t\t\t\t\t{{ resolvedRankLabel }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr v-for=\"row in rows\"\n\t\t\t\t\t\t:key=\"row[rowIdKey]\"\n\t\t\t\t\t\tclass=\"cn-data-matrix__row\"\n\t\t\t\t\t\t:class=\"{ 'cn-data-matrix__row--top': highlightTopRank && ranks.get(row[rowIdKey]) === 1 }\">\n\t\t\t\t\t\t<th v-if=\"rowHeader\"\n\t\t\t\t\t\t\tscope=\"row\"\n\t\t\t\t\t\t\tclass=\"cn-data-matrix__row-header\"\n\t\t\t\t\t\t\t:title=\"row[rowLabelKey]\">\n\t\t\t\t\t\t\t{{ row[rowLabelKey] }}\n\t\t\t\t\t\t\t<span v-if=\"rowSublabelKey && row[rowSublabelKey]\" class=\"cn-data-matrix__row-sublabel\">{{ row[rowSublabelKey] }}</span>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<td v-for=\"col in columns\"\n\t\t\t\t\t\t\t:key=\"col.key\"\n\t\t\t\t\t\t\tclass=\"cn-data-matrix__cell\"\n\t\t\t\t\t\t\t:class=\"cellClass(row, col)\"\n\t\t\t\t\t\t\t:data-row-id=\"row[rowIdKey]\"\n\t\t\t\t\t\t\t:data-col-key=\"col.key\">\n\t\t\t\t\t\t\t<input v-if=\"isEditing(row, col)\"\n\t\t\t\t\t\t\t\tref=\"activeInput\"\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tclass=\"cn-data-matrix__cell-input\"\n\t\t\t\t\t\t\t\t:value=\"cellValue(row, col)\"\n\t\t\t\t\t\t\t\t:aria-label=\"inputLabel(row, col)\"\n\t\t\t\t\t\t\t\t:disabled=\"readOnly || isCellReadOnly(row, col)\"\n\t\t\t\t\t\t\t\t@blur=\"commitEdit(row, col, $event.target.value)\"\n\t\t\t\t\t\t\t\t@keydown=\"onInputKeydown($event, row, col)\">\n\t\t\t\t\t\t\t<span v-else\n\t\t\t\t\t\t\t\tclass=\"cn-data-matrix__cell-value\"\n\t\t\t\t\t\t\t\t:tabindex=\"isCellEditable(row, col) ? 0 : null\"\n\t\t\t\t\t\t\t\t:role=\"isCellEditable(row, col) ? 'button' : null\"\n\t\t\t\t\t\t\t\t:aria-label=\"isCellEditable(row, col) ? cellLabel(row, col) : null\"\n\t\t\t\t\t\t\t\t@click=\"startEdit(row, col)\"\n\t\t\t\t\t\t\t\t@keydown=\"onCellKeydown($event, row, col)\">\n\t\t\t\t\t\t\t\t{{ formatCell(cellValue(row, col), col) }}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRowTotals\" class=\"cn-data-matrix__total-cell\">\n\t\t\t\t\t\t\t{{ formatTotal(rowTotal(row)) }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRank\" class=\"cn-data-matrix__total-cell cn-data-matrix__rank-cell\">\n\t\t\t\t\t\t\t{{ ranks.has(row[rowIdKey]) ? ranks.get(row[rowIdKey]) : '' }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr v-if=\"showColumnTotals\" class=\"cn-data-matrix__totals-row\">\n\t\t\t\t\t\t<th v-if=\"rowHeader\" class=\"cn-data-matrix__totals-label\">\n\t\t\t\t\t\t\t{{ columnTotalsLabel }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<td v-for=\"col in columns\"\n\t\t\t\t\t\t\t:key=\"col.key\"\n\t\t\t\t\t\t\tclass=\"cn-data-matrix__total-cell\">\n\t\t\t\t\t\t\t{{ formatCell(columnTotal(col), { type: 'number' }) }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRowTotals\" class=\"cn-data-matrix__total-cell cn-data-matrix__grand-total\">\n\t\t\t\t\t\t\t{{ formatTotal(grandTotal) }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRank\" class=\"cn-data-matrix__total-cell\" />\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>\n\n\t\t<p v-if=\"rows.length === 0\" class=\"cn-data-matrix__empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { evalFormula } from '../../utils/evalFormula.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\nconst ROUNDERS = Object.freeze({ round: Math.round, ceil: Math.ceil, floor: Math.floor })\n\n/**\n * The number a cell holds; an empty cell is no number, rather than zero.\n *\n * @param {unknown} raw The cell.\n * @return {number|null} The number, or null.\n */\nfunction numberIn(raw) {\n\treturn raw === null || raw === undefined || raw === '' || !Number.isFinite(Number(raw)) ? null : Number(raw)\n}\n\n/**\n * CnDataMatrix — Inline-edit data grid for matrix-shaped data\n * (rows × columns). Each cell is click-to-edit, and keyboard editable:\n * Tab reaches it, Enter or F2 opens it, Enter commits, Escape cancels. Commits emit\n * `@cell-edit({ rowId, colKey, value })` so the parent can persist.\n * Optional row / column / grand totals computed from the live data\n * with the column's `aggregate` setting (`sum` by default).\n *\n * Use for gradebooks, weight matrices, allocation tables, scoring\n * rubrics — the \"spreadsheet\" shape where cells are independently\n * editable values rather than a row/object form.\n *\n * A column with `formula` computes its cells from the other columns and is\n * read only: `now*(rate/100)`, with `prev_now` for the row above and `round`\n * set to `round`, `ceil` or `floor`. A row where the formula has no answer shows\n * its own stored value. Formulas are arithmetic only, through `evalFormula`.\n *\n * A scoring matrix weighs its columns: give each column a `weight` (and an\n * optional `weightLabel` such as \"40%\"), set `rowTotalsMode=\"weighted\"` and\n * the row total is the weighted mean of the row's scores. `showRank` ranks\n * the rows by that total, highest first, and `highlightTopRank` tints the\n * leading row.\n *\n * Not a full spreadsheet engine — there are no cell-range references, no\n * charts. Consumers wanting that should\n * embed a dedicated library (e.g. handsontable) and use this for\n * the simpler cases.\n *\n * ```vue\n * <CnDataMatrix\n * title=\"Cohort gradebook\"\n * row-header=\"Student\"\n * :rows=\"students\"\n * :columns=\"[\n * { key: 'midterm', label: 'Midterm', type: 'number', aggregate: 'sum' },\n * { key: 'final', label: 'Final', type: 'number', aggregate: 'sum' },\n * { key: 'notes', label: 'Notes', type: 'string', readOnly: true },\n * ]\"\n * :show-row-totals=\"true\"\n * :show-column-totals=\"true\"\n * @cell-edit=\"onCellEdit\" />\n * ```\n */\nexport default {\n\tname: 'CnDataMatrix',\n\tprops: {\n\t\t/**\n\t\t * Row records. Each record holds an `id`, an optional row\n\t\t * label, and one field per column key.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\trows: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Column declarations.\n\t\t *\n\t\t * @type {Array<{key:string,label?:string,type?:'number'|'string',readOnly?:boolean,formula?:string,round?:'round'|'ceil'|'floor',formatter?:(value: unknown) => string,aggregate?:'sum'|'avg'|'count'|'none',width?:string,weight?:number,weightLabel?:string}>}\n\t\t */\n\t\tcolumns: { type: Array, default: () => [] },\n\t\t/** Field on each row carrying its id. */\n\t\trowIdKey: { type: String, default: 'id' },\n\t\t/** Field on each row carrying its label (shown in the row header). */\n\t\trowLabelKey: { type: String, default: 'label' },\n\t\t/** Header for the row-label column (empty hides it). */\n\t\trowHeader: { type: String, default: '' },\n\t\t/** Optional title. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Optional description. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** Empty-state text when rows[] is empty. */\n\t\temptyLabel: { type: String, default: 'No data.' },\n\t\t/** Disable all cell editing globally. */\n\t\treadOnly: { type: Boolean, default: false },\n\t\t/** Render the per-row totals column. */\n\t\tshowRowTotals: { type: Boolean, default: false },\n\t\t/** Render the per-column totals row at the bottom. */\n\t\tshowColumnTotals: { type: Boolean, default: false },\n\t\t/** Label for the row-totals column header. */\n\t\trowTotalsLabel: { type: String, default: 'Total' },\n\t\t/** Label preceding the column-totals row. */\n\t\tcolumnTotalsLabel: { type: String, default: 'Total' },\n\t\t/**\n\t\t * How a row total is computed: `sum` adds the number columns,\n\t\t * `weighted` takes the mean of the number columns weighted by each\n\t\t * column's `weight`, leaving out a cell without a value.\n\t\t */\n\t\trowTotalsMode: { type: String, default: 'sum', validator: (v) => ['sum', 'weighted'].includes(v) },\n\t\t/** Fraction digits of the totals; null keeps the locale default. */\n\t\ttotalsFractionDigits: { type: Number, default: null },\n\t\t/** Render a rank column: the rows ranked by their row total, highest first, ties sharing a rank. */\n\t\tshowRank: { type: Boolean, default: false },\n\t\t/** Header of the rank column, already translated; the library default is \"Rank\". */\n\t\trankLabel: { type: String, default: '' },\n\t\t/** Tint the row ranked first. */\n\t\thighlightTopRank: { type: Boolean, default: false },\n\t\t/** Field on each row with a second line under its label, such as a price. */\n\t\trowSublabelKey: { type: String, default: '' },\n\t},\n\n\temits: ['cell-edit'],\n\tdata() {\n\t\treturn {\n\t\t\tediting: null, // { rowId, colKey }\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {string} The rank column header. */\n\t\tresolvedRankLabel() {\n\t\t\treturn this.rankLabel || t('nextcloud-vue', 'Rank')\n\t\t},\n\n\t\t/**\n\t\t * The rank of every row with a row total: highest total first, rows\n\t\t * with an equal total sharing a rank (1, 2, 2, 4).\n\t\t *\n\t\t * @return {Map<unknown, number>} Rank per row id.\n\t\t */\n\t\tranks() {\n\t\t\tconst totals = this.rows\n\t\t\t\t.map((row) => ({ id: row[this.rowIdKey], total: this.rowTotal(row) }))\n\t\t\t\t.filter((entry) => Number.isFinite(entry.total))\n\t\t\t\t.sort((a, b) => b.total - a.total)\n\t\t\tconst ranks = new Map()\n\t\t\ttotals.forEach((entry, index) => {\n\t\t\t\tconst previous = totals[index - 1]\n\t\t\t\tranks.set(entry.id, previous && previous.total === entry.total ? ranks.get(previous.id) : index + 1)\n\t\t\t})\n\t\t\treturn ranks\n\t\t},\n\n\t\t/**\n\t\t * The computed cells of every row, in order. A formula reads the row's\n\t\t * numbers by column key and the previous row's as `prev_<key>`, and sees\n\t\t * formula columns to its left. A formula without an answer has no entry\n\t\t * here, so the cell shows what the row itself holds.\n\t\t *\n\t\t * @return {Map<object, Record<string, number>>} Computed values per row.\n\t\t */\n\t\tformulaValues() {\n\t\t\tconst values = new Map()\n\t\t\tif (!this.columns.some((col) => col.formula)) {\n\t\t\t\treturn values\n\t\t\t}\n\t\t\tlet previous = {}\n\t\t\tfor (const row of this.rows) {\n\t\t\t\tconst vars = { ...previous }\n\t\t\t\tfor (const col of this.columns) {\n\t\t\t\t\tif (!col.formula && numberIn(row[col.key]) !== null) {\n\t\t\t\t\t\tvars[col.key] = numberIn(row[col.key])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst computed = {}\n\t\t\t\tfor (const col of this.columns) {\n\t\t\t\t\tif (col.formula) {\n\t\t\t\t\t\tconst answer = evalFormula(col.formula, vars)\n\t\t\t\t\t\tif (answer !== null) {\n\t\t\t\t\t\t\tcomputed[col.key] = (ROUNDERS[col.round] ?? Number)(answer)\n\t\t\t\t\t\t\tvars[col.key] = computed[col.key]\n\t\t\t\t\t\t} else if (numberIn(row[col.key]) !== null) {\n\t\t\t\t\t\t\tvars[col.key] = numberIn(row[col.key])\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvalues.set(row, computed)\n\t\t\t\tprevious = Object.fromEntries(Object.entries(vars).filter(([key]) => !key.startsWith('prev_')).map(([key, value]) => [`prev_${key}`, value]))\n\t\t\t}\n\t\t\treturn values\n\t\t},\n\n\t\t/**\n\t\t * Grand total (sum of every numeric cell). Shown in the\n\t\t * bottom-right corner when both totals are enabled.\n\t\t *\n\t\t * @return {number}\n\t\t */\n\t\tgrandTotal() {\n\t\t\tlet total = 0\n\t\t\tfor (const row of this.rows) {\n\t\t\t\tfor (const col of this.columns) {\n\t\t\t\t\tif (col.type === 'number') {\n\t\t\t\t\t\tconst v = Number(this.cellValue(row, col))\n\t\t\t\t\t\tif (Number.isFinite(v)) {\n\t\t\t\t\t\t\ttotal += v\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn total\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Whether the given (row, col) is the active edit cell.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {boolean}\n\t\t */\n\t\tisEditing(row, col) {\n\t\t\treturn this.editing && this.editing.rowId === row[this.rowIdKey] && this.editing.colKey === col.key\n\t\t},\n\n\t\t/**\n\t\t * Effective read-only flag for a single cell.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {boolean}\n\t\t */\n\t\tisCellReadOnly(row, col) {\n\t\t\treturn Boolean(col.readOnly || col.formula)\n\t\t},\n\n\t\t/**\n\t\t * Whether a cell can be edited, and so takes keyboard focus.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {boolean}\n\t\t */\n\t\tisCellEditable(row, col) {\n\t\t\treturn !this.readOnly && !this.isCellReadOnly(row, col)\n\t\t},\n\n\t\t/**\n\t\t * Accessible name of a cell's input: its column and row.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {string} The label.\n\t\t */\n\t\tinputLabel(row, col) {\n\t\t\treturn t('nextcloud-vue', '{column}, {row}', {\n\t\t\t\tcolumn: col.label || col.key,\n\t\t\t\trow: row[this.rowLabelKey] ?? row[this.rowIdKey],\n\t\t\t}, undefined, { escape: false })\n\t\t},\n\n\t\t/**\n\t\t * Accessible name of an editable cell: its column, row and value.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {string} The label.\n\t\t */\n\t\tcellLabel(row, col) {\n\t\t\tconst value = this.formatCell(this.cellValue(row, col), col)\n\t\t\tconst vars = { cell: this.inputLabel(row, col), value: String(value) }\n\t\t\treturn value === ''\n\t\t\t\t? t('nextcloud-vue', '{cell}: empty', vars, undefined, { escape: false })\n\t\t\t\t: t('nextcloud-vue', '{cell}: {value}', vars, undefined, { escape: false })\n\t\t},\n\n\t\t/**\n\t\t * Enter or F2 on a focused cell starts editing it.\n\t\t *\n\t\t * @param {KeyboardEvent} event The key event.\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {void}\n\t\t */\n\t\tonCellKeydown(event, row, col) {\n\t\t\tif ((event.key === 'Enter' || event.key === 'F2') && this.isCellEditable(row, col)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.startEdit(row, col)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Enter commits and Escape cancels the edit; both return focus to the cell.\n\t\t *\n\t\t * @param {KeyboardEvent} event The key event.\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {void}\n\t\t */\n\t\tonInputKeydown(event, row, col) {\n\t\t\tif (event.key === 'Enter') {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.commitEdit(row, col, event.target.value)\n\t\t\t\tthis.focusCell(row, col)\n\t\t\t} else if (event.key === 'Escape' || event.key === 'Esc') {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.cancelEdit()\n\t\t\t\tthis.focusCell(row, col)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Move focus to a cell's value after the edit input is gone.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {void}\n\t\t */\n\t\tfocusCell(row, col) {\n\t\t\tconst rowId = String(row[this.rowIdKey])\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tconst cell = Array.from(this.$el.querySelectorAll('.cn-data-matrix__cell'))\n\t\t\t\t\t.find((td) => td.dataset.rowId === rowId && td.dataset.colKey === col.key)\n\t\t\t\tcell?.querySelector('.cn-data-matrix__cell-value')?.focus()\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Read the cell value from the row.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {unknown} The raw value.\n\t\t */\n\t\tcellValue(row, col) {\n\t\t\tif (col.formula && this.formulaValues.get(row)?.[col.key] !== undefined) {\n\t\t\t\treturn this.formulaValues.get(row)[col.key]\n\t\t\t}\n\t\t\treturn row[col.key]\n\t\t},\n\n\t\t/**\n\t\t * Format a cell value for display. Number columns get a\n\t\t * locale-formatted number; others go through the column's\n\t\t * `formatter` (if any) or are returned verbatim.\n\t\t *\n\t\t * @param {unknown} value The raw value.\n\t\t * @param {object} col Column definition.\n\t\t * @return {string} The display string.\n\t\t */\n\t\tformatCell(value, col) {\n\t\t\tif (value === undefined || value === null || value === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tif (typeof col.formatter === 'function') {\n\t\t\t\treturn col.formatter(value)\n\t\t\t}\n\t\t\tif (col.type === 'number') {\n\t\t\t\tconst n = Number(value)\n\t\t\t\tif (!Number.isFinite(n)) {\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t\treturn n.toLocaleString(userLocale())\n\t\t\t}\n\t\t\treturn value\n\t\t},\n\n\t\t/**\n\t\t * BEM modifier(s) for a cell — currently only the read-only\n\t\t * flag. Consumers extend via the `formatter` if they want\n\t\t * to swap to a styled component.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {object} Class binding.\n\t\t */\n\t\tcellClass(row, col) {\n\t\t\treturn {\n\t\t\t\t'cn-data-matrix__cell--read-only': this.readOnly || this.isCellReadOnly(row, col),\n\t\t\t\t'cn-data-matrix__cell--number': col.type === 'number',\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Start editing a cell.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {void}\n\t\t */\n\t\tstartEdit(row, col) {\n\t\t\tif (this.readOnly || this.isCellReadOnly(row, col)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.editing = { rowId: row[this.rowIdKey], colKey: col.key }\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tif (this.$refs.activeInput && this.$refs.activeInput[0]) {\n\t\t\t\t\tthis.$refs.activeInput[0].focus()\n\t\t\t\t\tthis.$refs.activeInput[0].select()\n\t\t\t\t} else if (this.$refs.activeInput && this.$refs.activeInput.focus) {\n\t\t\t\t\tthis.$refs.activeInput.focus()\n\t\t\t\t\tthis.$refs.activeInput.select()\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Commit an edit — coerces the value to the column type and\n\t\t * emits `@cell-edit`.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @param {string} raw The raw input string.\n\t\t * @return {void}\n\t\t */\n\t\tcommitEdit(row, col, raw) {\n\t\t\tif (!this.editing) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet value = raw\n\t\t\tif (col.type === 'number') {\n\t\t\t\tconst n = Number(raw)\n\t\t\t\tvalue = Number.isFinite(n) ? n : null\n\t\t\t}\n\t\t\tthis.editing = null\n\t\t\t/**\n\t\t\t * @event cell-edit Emitted on commit (blur or Enter).\n\t\t\t * Payload: `{rowId, colKey, value, row}`.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('cell-edit', { rowId: row[this.rowIdKey], colKey: col.key, value, row })\n\t\t},\n\n\t\t/**\n\t\t * Cancel the active edit (Esc).\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcancelEdit() {\n\t\t\tthis.editing = null\n\t\t},\n\n\t\t/**\n\t\t * The weight shown beside a column label: `weightLabel`, else the\n\t\t * `weight` itself, or '' for an unweighted column.\n\t\t *\n\t\t * @param {object} col Column definition.\n\t\t * @return {string} The weight text.\n\t\t */\n\t\tweightText(col) {\n\t\t\tif (typeof col.weightLabel === 'string' && col.weightLabel !== '') {\n\t\t\t\treturn col.weightLabel\n\t\t\t}\n\t\t\treturn Number.isFinite(col.weight) ? String(col.weight) : ''\n\t\t},\n\n\t\t/**\n\t\t * Format a total with `totalsFractionDigits` when set.\n\t\t *\n\t\t * @param {number|null} value The total.\n\t\t * @return {string} The display string.\n\t\t */\n\t\tformatTotal(value) {\n\t\t\tif (!Number.isFinite(value)) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tif (this.totalsFractionDigits === null) {\n\t\t\t\treturn this.formatCell(value, { type: 'number' })\n\t\t\t}\n\t\t\tconst digits = this.totalsFractionDigits\n\t\t\treturn value.toLocaleString(userLocale(), { minimumFractionDigits: digits, maximumFractionDigits: digits })\n\t\t},\n\n\t\t/**\n\t\t * Per-row total: the sum of every numeric column, or in `weighted`\n\t\t * mode the weighted mean over the weighted columns that hold a value\n\t\t * (null when none does).\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @return {number|null}\n\t\t */\n\t\trowTotal(row) {\n\t\t\tif (this.rowTotalsMode === 'weighted') {\n\t\t\t\tlet weighted = 0\n\t\t\t\tlet weights = 0\n\t\t\t\tfor (const col of this.columns) {\n\t\t\t\t\tconst raw = this.cellValue(row, col)\n\t\t\t\t\tconst v = Number(raw)\n\t\t\t\t\tif (col.type === 'number' && Number.isFinite(col.weight) && col.weight > 0 && raw !== null && raw !== undefined && raw !== '' && Number.isFinite(v)) {\n\t\t\t\t\t\tweighted += v * col.weight\n\t\t\t\t\t\tweights += col.weight\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn weights > 0 ? weighted / weights : null\n\t\t\t}\n\t\t\tlet total = 0\n\t\t\tfor (const col of this.columns) {\n\t\t\t\tif (col.type === 'number') {\n\t\t\t\t\tconst v = Number(this.cellValue(row, col))\n\t\t\t\t\tif (Number.isFinite(v)) {\n\t\t\t\t\t\ttotal += v\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn total\n\t\t},\n\n\t\t/**\n\t\t * Per-column total — aggregate over all rows using the\n\t\t * column's `aggregate` setting (`sum` by default).\n\t\t *\n\t\t * @param {object} col Column definition.\n\t\t * @return {number}\n\t\t */\n\t\tcolumnTotal(col) {\n\t\t\tif (col.type !== 'number') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst mode = col.aggregate || 'sum'\n\t\t\tif (mode === 'none') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\t// Drop empty cells (null / undefined / '') BEFORE coercing —\n\t\t\t// `Number(null)` is `0`, which would otherwise be counted and\n\t\t\t// summed as a real zero value.\n\t\t\tconst values = this.rows\n\t\t\t\t.map((r) => this.cellValue(r, col))\n\t\t\t\t.filter((v) => v !== null && v !== undefined && v !== '')\n\t\t\t\t.map((v) => Number(v))\n\t\t\t\t.filter((v) => Number.isFinite(v))\n\t\t\tif (values.length === 0) {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tif (mode === 'count') {\n\t\t\t\treturn values.length\n\t\t\t}\n\t\t\tif (mode === 'avg') {\n\t\t\t\treturn values.reduce((a, b) => a + b, 0) / values.length\n\t\t\t}\n\t\t\t// default: sum\n\t\t\treturn values.reduce((a, b) => a + b, 0)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-data-matrix {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-data-matrix__title {\n\tmargin: 0;\n\tfont-size: 1.1em;\n}\n\n.cn-data-matrix__description {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-data-matrix__scroller {\n\toverflow-x: auto;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n}\n\n.cn-data-matrix__table {\n\twidth: 100%;\n\tborder-collapse: collapse;\n\tfont-size: 0.95em;\n}\n\n.cn-data-matrix__col-header,\n.cn-data-matrix__row-header-corner,\n.cn-data-matrix__total-header {\n\tbackground: var(--color-background-hover);\n\ttext-align: left;\n\tpadding: 8px 10px;\n\tfont-weight: 600;\n\tborder-bottom: 1px solid var(--color-border);\n\tborder-right: 1px solid var(--color-border);\n}\n\n.cn-data-matrix__row-header {\n\tbackground: var(--color-background-hover);\n\ttext-align: left;\n\tpadding: 6px 10px;\n\tfont-weight: 500;\n\tborder-right: 1px solid var(--color-border);\n\tborder-bottom: 1px solid var(--color-border);\n\tmax-width: 200px;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-data-matrix__cell {\n\tpadding: 0;\n\tborder-right: 1px solid var(--color-border);\n\tborder-bottom: 1px solid var(--color-border);\n\tmin-width: 80px;\n}\n\n.cn-data-matrix__cell--number {\n\ttext-align: right;\n}\n\n.cn-data-matrix__cell-value {\n\tdisplay: block;\n\tpadding: 6px 10px;\n\tcursor: cell;\n\tmin-height: 28px;\n}\n\n.cn-data-matrix__cell-value:focus-visible {\n\toutline: 2px solid var(--color-primary-element);\n\toutline-offset: -2px;\n}\n\n.cn-data-matrix__cell--read-only .cn-data-matrix__cell-value {\n\tcursor: default;\n\tbackground: var(--color-background-hover);\n}\n\n.cn-data-matrix__cell-input {\n\twidth: 100%;\n\tpadding: 5px 10px;\n\tborder: 1px solid var(--color-primary-element);\n\tbackground: var(--color-main-background);\n\toutline: none;\n\tfont: inherit;\n}\n\n.cn-data-matrix__totals-row .cn-data-matrix__total-cell,\n.cn-data-matrix__total-header {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n\tfont-weight: 600;\n\ttext-align: right;\n\tpadding: 6px 10px;\n}\n\n.cn-data-matrix__totals-label {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n\tfont-weight: 600;\n\tpadding: 6px 10px;\n\ttext-align: left;\n}\n\n.cn-data-matrix__grand-total {\n\tbackground: var(--color-primary-element-light);\n}\n\n.cn-data-matrix__weight {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-weight: 400;\n\twhite-space: nowrap;\n}\n\n.cn-data-matrix__row-sublabel {\n\tdisplay: block;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\tfont-weight: 400;\n}\n\n.cn-data-matrix__row--top > th,\n.cn-data-matrix__row--top > td {\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text);\n}\n\n.cn-data-matrix__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n\tmargin: 16px 0;\n\ttext-align: center;\n}\n</style>\n"],"names":["t"],"mappings":";;;;AA0GA,MAAM,QAAS,GAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAA;;AAExF;;AAEC;;AAEA;;AAED,SAAS,QAAQ,CAAC,GAAG,EAAE;AACtB,CAAA,OAAO,GAAI,KAAI,IAAG,IAAK,GAAI,KAAI,SAAQ,IAAK,GAAI,KAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAG,GAAI,MAAM,CAAC,GAAG,CAAA;AAC5G,CAAA;;AAEA;;;AAGC;;;;AAIA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;;AAIA;;AAEA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;;;AAGA;;;;AAIA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,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