@conduction/nextcloud-vue 2.56.0-beta.69 → 2.56.0-beta.70

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.
Files changed (180) hide show
  1. package/dist/esm/components/CnActionDialog/CnActionDialog.vue.js +1 -1
  2. package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js +114 -11
  3. package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
  4. package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js +67 -17
  5. package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
  6. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js +9 -0
  7. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js.map +1 -0
  8. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js +352 -0
  9. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js.map +1 -0
  10. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js +266 -0
  11. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js.map +1 -0
  12. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
  13. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +257 -7
  14. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
  15. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js +113 -59
  16. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
  17. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue.js +1 -1
  18. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js +210 -5
  19. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js.map +1 -1
  20. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js +134 -46
  21. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js.map +1 -1
  22. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js +9 -0
  23. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js.map +1 -0
  24. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js +385 -0
  25. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js.map +1 -0
  26. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js +277 -0
  27. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js.map +1 -0
  28. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue.js +1 -1
  29. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js +175 -20
  30. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js.map +1 -1
  31. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js +30 -8
  32. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js.map +1 -1
  33. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue.js +1 -1
  34. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js +72 -6
  35. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js.map +1 -1
  36. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js +48 -14
  37. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js.map +1 -1
  38. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue.js +1 -1
  39. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js +162 -9
  40. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js.map +1 -1
  41. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js +63 -23
  42. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js.map +1 -1
  43. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js +9 -0
  44. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js.map +1 -0
  45. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js +175 -0
  46. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js.map +1 -0
  47. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js +114 -0
  48. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js.map +1 -0
  49. package/dist/esm/components/CnDurationField/CnDurationField.vue.js +1 -1
  50. package/dist/esm/components/CnDurationField/CnDurationField.vue2.js +218 -4
  51. package/dist/esm/components/CnDurationField/CnDurationField.vue2.js.map +1 -1
  52. package/dist/esm/components/CnDurationField/CnDurationField.vue3.js +133 -44
  53. package/dist/esm/components/CnDurationField/CnDurationField.vue3.js.map +1 -1
  54. package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
  55. package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
  56. package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js +5 -1
  57. package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js.map +1 -1
  58. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js +9 -0
  59. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js.map +1 -0
  60. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js +113 -0
  61. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js.map +1 -0
  62. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js +43 -0
  63. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js.map +1 -0
  64. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue.js +1 -1
  65. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js +110 -1
  66. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js.map +1 -1
  67. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js +60 -18
  68. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js.map +1 -1
  69. package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js +2 -2
  70. package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js.map +1 -1
  71. package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js +2 -2
  72. package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js.map +1 -1
  73. package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js +2 -2
  74. package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js.map +1 -1
  75. package/dist/esm/components/CnQrCode/CnQrCode.vue.js +9 -0
  76. package/dist/esm/components/CnQrCode/CnQrCode.vue.js.map +1 -0
  77. package/dist/esm/components/CnQrCode/CnQrCode.vue2.js +241 -0
  78. package/dist/esm/components/CnQrCode/CnQrCode.vue2.js.map +1 -0
  79. package/dist/esm/components/CnQrCode/CnQrCode.vue3.js +75 -0
  80. package/dist/esm/components/CnQrCode/CnQrCode.vue3.js.map +1 -0
  81. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue.js +1 -1
  82. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js +34 -3
  83. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js.map +1 -1
  84. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js +81 -19
  85. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js.map +1 -1
  86. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
  87. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +11 -0
  88. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
  89. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +112 -88
  90. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
  91. package/dist/esm/components/CnRevealField/CnRevealField.vue.js +9 -0
  92. package/dist/esm/components/CnRevealField/CnRevealField.vue.js.map +1 -0
  93. package/dist/esm/components/CnRevealField/CnRevealField.vue2.js +157 -0
  94. package/dist/esm/components/CnRevealField/CnRevealField.vue2.js.map +1 -0
  95. package/dist/esm/components/CnRevealField/CnRevealField.vue3.js +116 -0
  96. package/dist/esm/components/CnRevealField/CnRevealField.vue3.js.map +1 -0
  97. package/dist/esm/components/CnTextWidget/CnTextWidget.vue.js +1 -1
  98. package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js +43 -3
  99. package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js.map +1 -1
  100. package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js +19 -12
  101. package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js.map +1 -1
  102. package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js +9 -0
  103. package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js.map +1 -0
  104. package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js +87 -0
  105. package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js.map +1 -0
  106. package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js +126 -0
  107. package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js.map +1 -0
  108. package/dist/esm/components/CnTreeView/CnTreeNode.vue.js +1 -1
  109. package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js +66 -1
  110. package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js.map +1 -1
  111. package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js +129 -29
  112. package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js.map +1 -1
  113. package/dist/esm/components/CnTreeView/CnTreeView.vue.js +1 -1
  114. package/dist/esm/components/CnTreeView/CnTreeView.vue2.js +158 -6
  115. package/dist/esm/components/CnTreeView/CnTreeView.vue2.js.map +1 -1
  116. package/dist/esm/components/CnTreeView/CnTreeView.vue3.js +100 -39
  117. package/dist/esm/components/CnTreeView/CnTreeView.vue3.js.map +1 -1
  118. package/dist/esm/index.js +8 -0
  119. package/dist/esm/index.js.map +1 -1
  120. package/dist/esm/l10n/en.json.js +63 -1
  121. package/dist/esm/l10n/en.json.js.map +1 -1
  122. package/dist/esm/l10n/nl.json.js +63 -1
  123. package/dist/esm/l10n/nl.json.js.map +1 -1
  124. package/dist/esm/library-style.js +1 -1
  125. package/dist/esm/nextcloud-vue.css +1134 -499
  126. package/dist/esm/node_modules/vuedraggable/dist/vuedraggable.umd.js +2 -2
  127. package/dist/esm/utils/captureLocation.js +32 -0
  128. package/dist/esm/utils/captureLocation.js.map +1 -0
  129. package/dist/esm/utils/childRecordTotals.js +157 -0
  130. package/dist/esm/utils/childRecordTotals.js.map +1 -0
  131. package/dist/esm/utils/isoDuration.js +51 -1
  132. package/dist/esm/utils/isoDuration.js.map +1 -1
  133. package/dist/esm/utils/qr.js +649 -0
  134. package/dist/esm/utils/qr.js.map +1 -0
  135. package/dist/esm/utils/schema.js +3 -0
  136. package/dist/esm/utils/schema.js.map +1 -1
  137. package/dist/esm/utils/templateVariables.js +54 -0
  138. package/dist/esm/utils/templateVariables.js.map +1 -0
  139. package/dist/nextcloud-vue.cjs.js +20307 -14544
  140. package/dist/nextcloud-vue.cjs.js.map +2 -2
  141. package/dist/nextcloud-vue.css +1134 -499
  142. package/l10n/en.json +63 -1
  143. package/l10n/nl.json +63 -1
  144. package/package.json +1 -1
  145. package/src/components/CnActionDialog/CnActionDialog.vue +156 -9
  146. package/src/components/CnBlockListEditor/CnBlockListEditor.vue +615 -0
  147. package/src/components/CnBlockListEditor/index.js +9 -0
  148. package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +311 -10
  149. package/src/components/CnChildRecordsField/CnChildRecordsField.vue +306 -15
  150. package/src/components/CnChoiceMatrix/CnChoiceMatrix.vue +710 -0
  151. package/src/components/CnChoiceMatrix/index.js +9 -0
  152. package/src/components/CnCountdownWidget/CnCountdownWidget.vue +223 -28
  153. package/src/components/CnCreateFormWidget/CnCreateFormWidget.vue +97 -6
  154. package/src/components/CnDataMatrix/CnDataMatrix.vue +199 -13
  155. package/src/components/CnDisplayScreen/CnDisplayScreen.vue +308 -0
  156. package/src/components/CnDisplayScreen/index.js +9 -0
  157. package/src/components/CnDurationField/CnDurationField.vue +330 -5
  158. package/src/components/CnFormDialog/CnFormDialog.vue +4 -0
  159. package/src/components/CnGeoCaptureField/CnGeoCaptureField.vue +148 -0
  160. package/src/components/CnGeoCaptureField/index.js +9 -0
  161. package/src/components/CnMarkdownEditor/CnMarkdownEditor.vue +139 -1
  162. package/src/components/CnQrCode/CnQrCode.vue +321 -0
  163. package/src/components/CnQrCode/index.js +9 -0
  164. package/src/components/CnReadinessChecklist/CnReadinessChecklist.vue +80 -3
  165. package/src/components/CnRecordListWidget/CnRecordListWidget.vue +34 -1
  166. package/src/components/CnRevealField/CnRevealField.vue +273 -0
  167. package/src/components/CnRevealField/index.js +9 -0
  168. package/src/components/CnTextWidget/CnTextWidget.vue +62 -3
  169. package/src/components/CnTransferCard/CnTransferCard.vue +205 -0
  170. package/src/components/CnTransferCard/index.js +9 -0
  171. package/src/components/CnTreeView/CnTreeNode.vue +145 -2
  172. package/src/components/CnTreeView/CnTreeView.vue +210 -6
  173. package/src/components/index.js +7 -0
  174. package/src/index.js +8 -0
  175. package/src/utils/captureLocation.js +29 -0
  176. package/src/utils/childRecordTotals.js +153 -0
  177. package/src/utils/isoDuration.js +50 -0
  178. package/src/utils/qr.js +681 -0
  179. package/src/utils/schema.js +3 -0
  180. package/src/utils/templateVariables.js +51 -0
@@ -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);\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AE;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: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{{ 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; 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 * 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--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":";;;;AAsGA,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;;;;;;AAMC;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;;AAIA;;AAEA;;AAEA;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;;;AAGD,EAAA,OAAO,EAAE,EAAE,IAAI,EA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AAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAA,GAAI,CAAC,EAAE,CAAC,CAAA;GACvC;EACD;AACF;;;;"}
@@ -1,4 +1,4 @@
1
- import { openBlock, createElementBlock, toDisplayString, createCommentVNode, createElementVNode, Fragment, renderList, normalizeStyle, normalizeClass, withKeys } from 'vue';
1
+ import { openBlock, createElementBlock, toDisplayString, createCommentVNode, createElementVNode, Fragment, renderList, normalizeStyle, createTextVNode, normalizeClass, withKeys } from 'vue';
2
2
 
3
3
  const _hoisted_1 = {
4
4
  class: "cn-data-matrix",
@@ -23,30 +23,50 @@ const _hoisted_7 = {
23
23
  class: "cn-data-matrix__row-header-corner"
24
24
  };
25
25
  const _hoisted_8 = {
26
+ key: 0,
27
+ class: "cn-data-matrix__weight"
28
+ };
29
+ const _hoisted_9 = {
26
30
  key: 1,
27
31
  class: "cn-data-matrix__total-header"
28
32
  };
29
- const _hoisted_9 = ["title"];
30
- const _hoisted_10 = ["data-row-id", "data-col-key"];
31
- const _hoisted_11 = ["value", "disabled", "onBlur", "onKeydown"];
32
- const _hoisted_12 = ["onClick"];
33
- const _hoisted_13 = {
33
+ const _hoisted_10 = {
34
+ key: 2,
35
+ class: "cn-data-matrix__total-header cn-data-matrix__rank-header"
36
+ };
37
+ const _hoisted_11 = ["title"];
38
+ const _hoisted_12 = {
39
+ key: 0,
40
+ class: "cn-data-matrix__row-sublabel"
41
+ };
42
+ const _hoisted_13 = ["data-row-id", "data-col-key"];
43
+ const _hoisted_14 = ["value", "disabled", "onBlur", "onKeydown"];
44
+ const _hoisted_15 = ["onClick"];
45
+ const _hoisted_16 = {
34
46
  key: 1,
35
47
  class: "cn-data-matrix__total-cell"
36
48
  };
37
- const _hoisted_14 = {
49
+ const _hoisted_17 = {
50
+ key: 2,
51
+ class: "cn-data-matrix__total-cell cn-data-matrix__rank-cell"
52
+ };
53
+ const _hoisted_18 = {
38
54
  key: 0,
39
55
  class: "cn-data-matrix__totals-row"
40
56
  };
41
- const _hoisted_15 = {
57
+ const _hoisted_19 = {
42
58
  key: 0,
43
59
  class: "cn-data-matrix__totals-label"
44
60
  };
45
- const _hoisted_16 = {
61
+ const _hoisted_20 = {
46
62
  key: 1,
47
63
  class: "cn-data-matrix__total-cell cn-data-matrix__grand-total"
48
64
  };
49
- const _hoisted_17 = {
65
+ const _hoisted_21 = {
66
+ key: 2,
67
+ class: "cn-data-matrix__total-cell"
68
+ };
69
+ const _hoisted_22 = {
50
70
  key: 1,
51
71
  class: "cn-data-matrix__empty"
52
72
  };
@@ -75,10 +95,18 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
75
95
  key: col.key,
76
96
  class: "cn-data-matrix__col-header",
77
97
  style: normalizeStyle(col.width ? { width: col.width } : null)
78
- }, toDisplayString(col.label || col.key), 5 /* TEXT, STYLE */))
98
+ }, [
99
+ createTextVNode(toDisplayString(col.label || col.key) + " ", 1 /* TEXT */),
100
+ ($options.weightText(col))
101
+ ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString($options.weightText(col)), 1 /* TEXT */))
102
+ : createCommentVNode("v-if", true)
103
+ ], 4 /* STYLE */))
79
104
  }), 128 /* KEYED_FRAGMENT */)),
80
105
  ($props.showRowTotals)
81
- ? (openBlock(), createElementBlock("th", _hoisted_8, toDisplayString($props.rowTotalsLabel), 1 /* TEXT */))
106
+ ? (openBlock(), createElementBlock("th", _hoisted_9, toDisplayString($props.rowTotalsLabel), 1 /* TEXT */))
107
+ : createCommentVNode("v-if", true),
108
+ ($props.showRank)
109
+ ? (openBlock(), createElementBlock("th", _hoisted_10, toDisplayString($options.resolvedRankLabel), 1 /* TEXT */))
82
110
  : createCommentVNode("v-if", true)
83
111
  ])
84
112
  ]),
@@ -86,14 +114,20 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
86
114
  (openBlock(true), createElementBlock(Fragment, null, renderList($props.rows, (row) => {
87
115
  return (openBlock(), createElementBlock("tr", {
88
116
  key: row[$props.rowIdKey],
89
- class: "cn-data-matrix__row"
117
+ class: normalizeClass(["cn-data-matrix__row", { 'cn-data-matrix__row--top': $props.highlightTopRank && $options.ranks.get(row[$props.rowIdKey]) === 1 }])
90
118
  }, [
91
119
  ($props.rowHeader)
92
120
  ? (openBlock(), createElementBlock("th", {
93
121
  key: 0,
122
+ scope: "row",
94
123
  class: "cn-data-matrix__row-header",
95
124
  title: row[$props.rowLabelKey]
96
- }, toDisplayString(row[$props.rowLabelKey]), 9 /* TEXT, PROPS */, _hoisted_9))
125
+ }, [
126
+ createTextVNode(toDisplayString(row[$props.rowLabelKey]) + " ", 1 /* TEXT */),
127
+ ($props.rowSublabelKey && row[$props.rowSublabelKey])
128
+ ? (openBlock(), createElementBlock("span", _hoisted_12, toDisplayString(row[$props.rowSublabelKey]), 1 /* TEXT */))
129
+ : createCommentVNode("v-if", true)
130
+ ], 8 /* PROPS */, _hoisted_11))
97
131
  : createCommentVNode("v-if", true),
98
132
  (openBlock(true), createElementBlock(Fragment, null, renderList($props.columns, (col) => {
99
133
  return (openBlock(), createElementBlock("td", {
@@ -116,23 +150,26 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
116
150
  withKeys($event => ($options.commitEdit(row, col, $event.target.value)), ["enter"]),
117
151
  _cache[0] || (_cache[0] = withKeys((...args) => ($options.cancelEdit && $options.cancelEdit(...args)), ["esc"]))
118
152
  ]
119
- }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_11))
153
+ }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_14))
120
154
  : (openBlock(), createElementBlock("span", {
121
155
  key: 1,
122
156
  class: "cn-data-matrix__cell-value",
123
157
  onClick: $event => ($options.startEdit(row, col))
124
- }, toDisplayString($options.formatCell($options.cellValue(row, col), col)), 9 /* TEXT, PROPS */, _hoisted_12))
125
- ], 10 /* CLASS, PROPS */, _hoisted_10))
158
+ }, toDisplayString($options.formatCell($options.cellValue(row, col), col)), 9 /* TEXT, PROPS */, _hoisted_15))
159
+ ], 10 /* CLASS, PROPS */, _hoisted_13))
126
160
  }), 128 /* KEYED_FRAGMENT */)),
127
161
  ($props.showRowTotals)
128
- ? (openBlock(), createElementBlock("td", _hoisted_13, toDisplayString($options.formatCell($options.rowTotal(row), { type: 'number' })), 1 /* TEXT */))
162
+ ? (openBlock(), createElementBlock("td", _hoisted_16, toDisplayString($options.formatTotal($options.rowTotal(row))), 1 /* TEXT */))
163
+ : createCommentVNode("v-if", true),
164
+ ($props.showRank)
165
+ ? (openBlock(), createElementBlock("td", _hoisted_17, toDisplayString($options.ranks.has(row[$props.rowIdKey]) ? $options.ranks.get(row[$props.rowIdKey]) : ''), 1 /* TEXT */))
129
166
  : createCommentVNode("v-if", true)
130
- ]))
167
+ ], 2 /* CLASS */))
131
168
  }), 128 /* KEYED_FRAGMENT */)),
132
169
  ($props.showColumnTotals)
133
- ? (openBlock(), createElementBlock("tr", _hoisted_14, [
170
+ ? (openBlock(), createElementBlock("tr", _hoisted_18, [
134
171
  ($props.rowHeader)
135
- ? (openBlock(), createElementBlock("th", _hoisted_15, toDisplayString($props.columnTotalsLabel), 1 /* TEXT */))
172
+ ? (openBlock(), createElementBlock("th", _hoisted_19, toDisplayString($props.columnTotalsLabel), 1 /* TEXT */))
136
173
  : createCommentVNode("v-if", true),
137
174
  (openBlock(true), createElementBlock(Fragment, null, renderList($props.columns, (col) => {
138
175
  return (openBlock(), createElementBlock("td", {
@@ -141,7 +178,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
141
178
  }, toDisplayString($options.formatCell($options.columnTotal(col), { type: 'number' })), 1 /* TEXT */))
142
179
  }), 128 /* KEYED_FRAGMENT */)),
143
180
  ($props.showRowTotals)
144
- ? (openBlock(), createElementBlock("td", _hoisted_16, toDisplayString($options.formatCell($options.grandTotal, { type: 'number' })), 1 /* TEXT */))
181
+ ? (openBlock(), createElementBlock("td", _hoisted_20, toDisplayString($options.formatTotal($options.grandTotal)), 1 /* TEXT */))
182
+ : createCommentVNode("v-if", true),
183
+ ($props.showRank)
184
+ ? (openBlock(), createElementBlock("td", _hoisted_21))
145
185
  : createCommentVNode("v-if", true)
146
186
  ]))
147
187
  : createCommentVNode("v-if", true)
@@ -149,7 +189,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
149
189
  ])
150
190
  ]),
151
191
  ($props.rows.length === 0)
152
- ? (openBlock(), createElementBlock("p", _hoisted_17, toDisplayString($props.emptyLabel), 1 /* TEXT */))
192
+ ? (openBlock(), createElementBlock("p", _hoisted_22, toDisplayString($props.emptyLabel), 1 /* TEXT */))
153
193
  : createCommentVNode("v-if", true)
154
194
  ]))
155
195
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CnDataMatrix.vue3.js","sources":["../../../../src/components/CnDataMatrix/CnDataMatrix.vue?vue&type=template&id=b800caca&lang.js"],"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":["_openBlock","_createElementBlock","_toDisplayString","_createElementVNode","_Fragment","_renderList"],"mappings":";;;AACM,EAAA,KAAK,EAAC,gBAAiB;AAAA,EAAA,aAAW,EAAC,gBAAgB;;;;AACnB,EAAA,KAAK,EAAC,wBAAwB;;;;AAChD,EAAA,KAAK,EAAC,uBAAuB;;;;AAGxB,EAAA,KAAK,EAAC,6BAA6B;;AAKrD,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,0BAA0B,GAAA;AAC7B,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,uBAAuB,GAAA;;;AAGZ,EAAA,KAAK,EAAC,mCAAmC;;;;AASrC,EAAA,KAAK,EAAC,8BAA8B;;;;;;;;AAiCpC,EAAA,KAAK,EAAC,4BAA4B;;;;AAIhC,EAAA,KAAK,EAAC,4BAA4B;;;;AACxC,EAAA,KAAK,EAAC,8BAA8B;;;;AAQhC,EAAA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AI,KAAA;uCAAfJ,kBAII,CAAA,IAAA,EAAA;oBAHF,GAAG,EAAE,GAAG,CAAC,GAAG;AACb,oBAAA,KAAK,EAAC,4BAA4B;qCAC/B,QAAU,CAAA,UAAA,CAAC,QAAW,CAAA,WAAA,CAAC,GAAG,CAAA,EAAA,EAAA,IAAA,EAAA,QAAA,EAAA,CAAA,CAAA,EAAA,CAAA,YAAA,CAAA;;iBAEpB,MAAa,CAAA,aAAA;AAAvB,qBAAAD,SAAA,EAAA,EAAAC,kBAAA,CAEI,IAFJ,EAAA,WAEI,EADAC,eAAA,CAAA,QAAA,CAAA,UAAU,CAAC,QAAU,CAAA,UAAA,EAAA,EAAA,IAAA,EAAA,QAAA,EAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;;;;;AAOpB,IAAA,CAAA,MAAA,CAAA,IAAI,CAAC,MAAK,KAAA,CAAA;sBAAnBD,kBAEG,CAAA,GAAA,EAFH,WAEG,EAAAC,eAAA,CADC,MAAS,CAAA,UAAA,CAAA,EAAA,CAAA,YAAA;;;;;;;"}
1
+ {"version":3,"file":"CnDataMatrix.vue3.js","sources":["../../../../src/components/CnDataMatrix/CnDataMatrix.vue?vue&type=template&id=401dc886&lang.js"],"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: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{{ 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; 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 * 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--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":["_openBlock","_createElementBlock","_toDisplayString","_createElementVNode","_Fragment","_renderList","_createTextVNode","_normalizeClass"],"mappings":";;;AACM,EAAA,KAAK,EAAC,gBAAiB;AAAA,EAAA,aAAW,EAAC,gBAAgB;;;;AACnB,EAAA,KAAK,EAAC,wBAAwB;;;;AAChD,EAAA,KAAK,EAAC,uBAAuB;;;;AAGxB,EAAA,KAAK,EAAC,6BAA6B;;AAKrD,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,0BAA0B,GAAA;AAC7B,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,uBAAuB,GAAA;;;AAGZ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I,CAAA,IAAA,EAFJ,WAEI,EAAAC,eAAA,CADA;;kCAEJD,kBAII,CAAAG,QAAA,EAAA,IAAA,EAAAC,UAAA,CAJc,MAAO,CAAA,OAAA,EAAA,CAAd,GAAI,KAAA;uCAAfJ,kBAII,CAAA,IAAA,EAAA;oBAHF,GAAG,EAAE,GAAG,CAAC,GAAG;AACb,oBAAA,KAAK,EAAC,4BAA4B;qCAC/B,QAAU,CAAA,UAAA,CAAC,QAAW,CAAA,WAAA,CAAC,GAAG,CAAA,EAAA,EAAA,IAAA,EAAA,QAAA,EAAA,CAAA,CAAA,EAAA,CAAA,YAAA,CAAA;;iBAEpB,MAAa,CAAA,aAAA;AAAvB,qBAAAD,SAAA,EAAA,EAAAC,kBAAA,CAEI,IAFJ,EAAA,WAEI,EADAC,eAAA,CAAA,QAAA,CAAA,WAAW,CAAC,QAAU,CAAA,UAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;iBAEhB,MAAQ,CAAA,QAAA;AAAlB,qBAAAF,SAAA,EAAA,EAAAC,kBAAA,CAAwD,MAAxD,WAAwD,CAAA;;;;;;;AAMnD,IAAA,CAAA,MAAA,CAAA,IAAI,CAAC,MAAK,KAAA,CAAA;sBAAnBA,kBAEG,CAAA,GAAA,EAFH,WAEG,EAAAC,eAAA,CADC,MAAS,CAAA,UAAA,CAAA,EAAA,CAAA,YAAA;;;;;;;"}
@@ -0,0 +1,9 @@
1
+ import script from './CnDisplayScreen.vue2.js';
2
+ import { render } from './CnDisplayScreen.vue3.js';
3
+
4
+ script.render = render;
5
+ script.__scopeId = "data-v-02d5bc1a";
6
+ const __sfc_main = script;
7
+
8
+ export { __sfc_main as default };
9
+ //# sourceMappingURL=CnDisplayScreen.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CnDisplayScreen.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -0,0 +1,175 @@
1
+ import { translate } from '@nextcloud/l10n';
2
+ import { NcThemeProvider } from '@nextcloud/vue';
3
+ import { formatTimeOfDay } from '../../utils/boardDate.js';
4
+ import { parseDateValue } from '../../utils/dateVariant.js';
5
+
6
+ const TICK_MS = 1000;
7
+
8
+ /**
9
+ * CnDisplayScreen: a full page without a menu, read from a distance on a hall
10
+ * screen or a classroom board (boards LqInfoscherm "Infoscherm bij de aula", LqLes
11
+ * "Zelf inchecken, op het bord").
12
+ *
13
+ * A title, a clock, when the content was last updated, the host's rows and a
14
+ * bottom line. The host owns the content and its refresh, and sets `stale` when a
15
+ * refresh failed. With `overlay` the screen covers the whole app: the rest of the
16
+ * page goes inert, Escape emits `close`, and focus returns on unmount.
17
+ *
18
+ * ```vue
19
+ * <CnDisplayScreen title="Today" clock dark footer="No names, no reasons." :updated-at="updatedAt" :stale="failed">
20
+ * <CnDataTable :rows="rows" />
21
+ * </CnDisplayScreen>
22
+ * ```
23
+ *
24
+ * @event close The user pressed Escape on an overlay.
25
+ * @spec openspec/changes/display-screen/specs/display-screen/spec.md
26
+ */
27
+ var script = {
28
+ name: 'CnDisplayScreen',
29
+
30
+ components: { NcThemeProvider },
31
+
32
+ props: {
33
+ /** The heading, already translated. */
34
+ title: { type: String, required: true },
35
+ /** A line over the title, already translated. */
36
+ subtitle: { type: String, default: '' },
37
+ /** Show a clock that keeps time. */
38
+ clock: { type: Boolean, default: false },
39
+ /** When the content was last updated: an ISO string, a Date or a timestamp. */
40
+ updatedAt: { type: [String, Number, Date], default: '' },
41
+ /** The update line, already translated, with `{time}`. */
42
+ updatedTemplate: { type: String, default: '' },
43
+ /** The content could not be refreshed and shows what it last had. */
44
+ stale: { type: Boolean, default: false },
45
+ /** Says the content is old, already translated, with `{time}`. */
46
+ staleText: { type: String, default: '' },
47
+ /** The bottom line, already translated. */
48
+ footer: { type: String, default: '' },
49
+ /** Use the dark theme, whatever the user's theme is. */
50
+ dark: { type: Boolean, default: false },
51
+ /** Cover the whole app. */
52
+ overlay: { type: Boolean, default: false },
53
+ },
54
+
55
+ emits: ['close'],
56
+
57
+ data() {
58
+ return {
59
+ now: new Date(),
60
+ timer: null,
61
+ inerted: [],
62
+ returnFocusTo: null,
63
+ }
64
+ },
65
+
66
+ computed: {
67
+ /** @return {object} The classes of the outer element. */
68
+ rootClasses() {
69
+ return { 'cn-display-screen': true, 'cn-display-screen--overlay': this.overlay }
70
+ },
71
+
72
+ /** @return {string} The clock. */
73
+ clockText() {
74
+ return formatTimeOfDay(this.now)
75
+ },
76
+
77
+ /** @return {string} The time of the last update, or '' without one. */
78
+ updatedTime() {
79
+ const date = parseDateValue(this.updatedAt);
80
+ return date ? formatTimeOfDay(date) : ''
81
+ },
82
+
83
+ /** @return {string} The update line. */
84
+ updatedText() {
85
+ if (!this.updatedTime) {
86
+ return ''
87
+ }
88
+ if (this.updatedTemplate) {
89
+ return this.updatedTemplate.replace('{time}', this.updatedTime)
90
+ }
91
+ return translate('nextcloud-vue', 'updated at {time}', { time: this.updatedTime })
92
+ },
93
+
94
+ /** @return {string} What the stale line says. */
95
+ staleMessage() {
96
+ if (this.staleText) {
97
+ return this.staleText.replace('{time}', this.updatedTime)
98
+ }
99
+ return this.updatedTime
100
+ ? translate('nextcloud-vue', 'Cannot reach the server. This shows what it knew at {time}.', { time: this.updatedTime })
101
+ : translate('nextcloud-vue', 'Cannot reach the server. This may be out of date.')
102
+ },
103
+ },
104
+
105
+ watch: {
106
+ clock() {
107
+ this.startClock();
108
+ },
109
+
110
+ overlay(on) {
111
+ if (on) {
112
+ this.$nextTick(this.enterOverlay);
113
+ } else {
114
+ this.leaveOverlay();
115
+ }
116
+ },
117
+ },
118
+
119
+ mounted() {
120
+ this.startClock();
121
+ if (this.overlay) {
122
+ this.enterOverlay();
123
+ }
124
+ },
125
+
126
+ beforeUnmount() {
127
+ clearInterval(this.timer);
128
+ this.leaveOverlay();
129
+ },
130
+
131
+ methods: {
132
+ /** Keep the clock on time while it shows. */
133
+ startClock() {
134
+ clearInterval(this.timer);
135
+ this.timer = null;
136
+ if (this.clock) {
137
+ this.now = new Date();
138
+ this.timer = setInterval(() => {
139
+ this.now = new Date();
140
+ }, TICK_MS);
141
+ }
142
+ },
143
+
144
+ /** Make the rest of the page inert and take focus. */
145
+ enterOverlay() {
146
+ const root = this.$refs.screen?.closest('.cn-display-screen');
147
+ this.returnFocusTo = document.activeElement;
148
+ this.inerted = [...document.body.children].filter((element) => element !== root && !element.inert);
149
+ this.inerted.forEach((element) => {
150
+ element.inert = true;
151
+ });
152
+ this.$refs.screen?.focus();
153
+ },
154
+
155
+ /** Give the rest of the page and the focus back. */
156
+ leaveOverlay() {
157
+ this.inerted.forEach((element) => {
158
+ element.inert = false;
159
+ });
160
+ this.inerted = [];
161
+ this.returnFocusTo?.focus?.();
162
+ this.returnFocusTo = null;
163
+ },
164
+
165
+ /** Ask the host to close an overlay. */
166
+ onEscape() {
167
+ if (this.overlay) {
168
+ this.$emit('close');
169
+ }
170
+ },
171
+ },
172
+ };
173
+
174
+ export { script as default };
175
+ //# sourceMappingURL=CnDisplayScreen.vue2.js.map