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

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 (46) hide show
  1. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
  2. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +67 -1
  3. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
  4. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
  5. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue.js +1 -1
  6. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js +93 -1
  7. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js.map +1 -1
  8. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js +11 -9
  9. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js.map +1 -1
  10. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +55 -6
  11. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
  12. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
  13. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +40 -1
  14. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  15. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  16. package/dist/esm/components/CnStorePage/CnStorePage.vue.js +1 -1
  17. package/dist/esm/components/CnStorePage/CnStorePage.vue2.js +3 -3
  18. package/dist/esm/components/CnStorePage/CnStorePage.vue2.js.map +1 -1
  19. package/dist/esm/components/CnStorePage/CnStorePage.vue3.js +5 -5
  20. package/dist/esm/components/CnStorePage/CnStorePage.vue3.js.map +1 -1
  21. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue.js +1 -1
  22. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js +6 -6
  23. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js.map +1 -1
  24. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js +1 -1
  25. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js.map +1 -1
  26. package/dist/esm/l10n/en.json.js +62 -59
  27. package/dist/esm/l10n/en.json.js.map +1 -1
  28. package/dist/esm/l10n/nl.json.js +62 -59
  29. package/dist/esm/l10n/nl.json.js.map +1 -1
  30. package/dist/esm/library-style.js +1 -1
  31. package/dist/esm/nextcloud-vue.css +82 -78
  32. package/dist/esm/utils/parentCrumb.js +86 -0
  33. package/dist/esm/utils/parentCrumb.js.map +1 -0
  34. package/dist/nextcloud-vue.cjs.js +923 -586
  35. package/dist/nextcloud-vue.cjs.js.map +2 -2
  36. package/dist/nextcloud-vue.css +82 -78
  37. package/l10n/en.json +62 -59
  38. package/l10n/nl.json +62 -59
  39. package/package.json +1 -1
  40. package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +67 -1
  41. package/src/components/CnDataMatrix/CnDataMatrix.vue +105 -4
  42. package/src/components/CnDetailPage/CnDetailPage.vue +55 -6
  43. package/src/components/CnIndexPage/CnIndexPage.vue +40 -1
  44. package/src/components/CnStorePage/CnStorePage.vue +8 -8
  45. package/src/components/CnStorePage/CnStorePublishDialog.vue +7 -7
  46. package/src/utils/parentCrumb.js +83 -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\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,I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MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,IAAK,IAAG,CAAA,KAAM,SAAQ,IAAK,CAAA,KAAM,EAAE,CAAA;AACxD,KAAC,GAAG,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAA;AACrB,KAAC,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAA;AAClC,GAAA,IAAI,MAAM,CAAC,MAAK,KAAM,CAAC,EAAE;AACxB,IAAA,OAAO,CAAA;AACR,IAAA;AACA,GAAA,IAAI,SAAS,OAAO,EAAE;AACrB,IAAA,OAAO,MAAM,CAAC,MAAK;AACpB,IAAA;AACA,GAAA,IAAI,IAAK,KAAI,KAAK,EAAE;IACnB,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAE,GAAE,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,MAAK;AACxD,IAAA;;AAEA,GAAA,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAA,GAAI,CAAC,EAAE,CAAC,CAAA;GACvC;EACD;AACF;;;;"}
1
+ {"version":3,"file":"CnDataMatrix.vue2.js","sources":["../../../../src/components/CnDataMatrix/CnDataMatrix.vue"],"sourcesContent":["<template>\n\t<div class=\"cn-data-matrix\" data-testid=\"cn-data-matrix\">\n\t\t<header v-if=\"title || description\" class=\"cn-data-matrix__header\">\n\t\t\t<h3 v-if=\"title\" class=\"cn-data-matrix__title\">\n\t\t\t\t{{ title }}\n\t\t\t</h3>\n\t\t\t<p v-if=\"description\" class=\"cn-data-matrix__description\">\n\t\t\t\t{{ description }}\n\t\t\t</p>\n\t\t</header>\n\n\t\t<div class=\"cn-data-matrix__scroller\">\n\t\t\t<table class=\"cn-data-matrix__table\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th v-if=\"rowHeader\" class=\"cn-data-matrix__row-header-corner\">\n\t\t\t\t\t\t\t{{ rowHeader }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th v-for=\"col in columns\"\n\t\t\t\t\t\t\t:key=\"col.key\"\n\t\t\t\t\t\t\tclass=\"cn-data-matrix__col-header\"\n\t\t\t\t\t\t\t:style=\"col.width ? { width: col.width } : null\">\n\t\t\t\t\t\t\t{{ col.label || col.key }}\n\t\t\t\t\t\t\t<span v-if=\"weightText(col)\" class=\"cn-data-matrix__weight\">{{ weightText(col) }}</span>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th v-if=\"showRowTotals\" class=\"cn-data-matrix__total-header\">\n\t\t\t\t\t\t\t{{ rowTotalsLabel }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th v-if=\"showRank\" class=\"cn-data-matrix__total-header cn-data-matrix__rank-header\">\n\t\t\t\t\t\t\t{{ resolvedRankLabel }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr v-for=\"row in rows\"\n\t\t\t\t\t\t:key=\"row[rowIdKey]\"\n\t\t\t\t\t\tclass=\"cn-data-matrix__row\"\n\t\t\t\t\t\t:class=\"{ 'cn-data-matrix__row--top': highlightTopRank && ranks.get(row[rowIdKey]) === 1 }\">\n\t\t\t\t\t\t<th v-if=\"rowHeader\"\n\t\t\t\t\t\t\tscope=\"row\"\n\t\t\t\t\t\t\tclass=\"cn-data-matrix__row-header\"\n\t\t\t\t\t\t\t:title=\"row[rowLabelKey]\">\n\t\t\t\t\t\t\t{{ row[rowLabelKey] }}\n\t\t\t\t\t\t\t<span v-if=\"rowSublabelKey && row[rowSublabelKey]\" class=\"cn-data-matrix__row-sublabel\">{{ row[rowSublabelKey] }}</span>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<td v-for=\"col in columns\"\n\t\t\t\t\t\t\t:key=\"col.key\"\n\t\t\t\t\t\t\tclass=\"cn-data-matrix__cell\"\n\t\t\t\t\t\t\t:class=\"cellClass(row, col)\"\n\t\t\t\t\t\t\t:data-row-id=\"row[rowIdKey]\"\n\t\t\t\t\t\t\t:data-col-key=\"col.key\">\n\t\t\t\t\t\t\t<input v-if=\"isEditing(row, col)\"\n\t\t\t\t\t\t\t\tref=\"activeInput\"\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tclass=\"cn-data-matrix__cell-input\"\n\t\t\t\t\t\t\t\t:value=\"cellValue(row, col)\"\n\t\t\t\t\t\t\t\t:aria-label=\"inputLabel(row, col)\"\n\t\t\t\t\t\t\t\t:disabled=\"readOnly || isCellReadOnly(row, col)\"\n\t\t\t\t\t\t\t\t@blur=\"commitEdit(row, col, $event.target.value)\"\n\t\t\t\t\t\t\t\t@keydown=\"onInputKeydown($event, row, col)\">\n\t\t\t\t\t\t\t<span v-else\n\t\t\t\t\t\t\t\tclass=\"cn-data-matrix__cell-value\"\n\t\t\t\t\t\t\t\t:tabindex=\"isCellEditable(row, col) ? 0 : null\"\n\t\t\t\t\t\t\t\t:role=\"isCellEditable(row, col) ? 'button' : null\"\n\t\t\t\t\t\t\t\t:aria-label=\"isCellEditable(row, col) ? cellLabel(row, col) : null\"\n\t\t\t\t\t\t\t\t@click=\"startEdit(row, col)\"\n\t\t\t\t\t\t\t\t@keydown=\"onCellKeydown($event, row, col)\">\n\t\t\t\t\t\t\t\t{{ formatCell(cellValue(row, col), col) }}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRowTotals\" class=\"cn-data-matrix__total-cell\">\n\t\t\t\t\t\t\t{{ formatTotal(rowTotal(row)) }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRank\" class=\"cn-data-matrix__total-cell cn-data-matrix__rank-cell\">\n\t\t\t\t\t\t\t{{ ranks.has(row[rowIdKey]) ? ranks.get(row[rowIdKey]) : '' }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr v-if=\"showColumnTotals\" class=\"cn-data-matrix__totals-row\">\n\t\t\t\t\t\t<th v-if=\"rowHeader\" class=\"cn-data-matrix__totals-label\">\n\t\t\t\t\t\t\t{{ columnTotalsLabel }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<td v-for=\"col in columns\"\n\t\t\t\t\t\t\t:key=\"col.key\"\n\t\t\t\t\t\t\tclass=\"cn-data-matrix__total-cell\">\n\t\t\t\t\t\t\t{{ formatCell(columnTotal(col), { type: 'number' }) }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRowTotals\" class=\"cn-data-matrix__total-cell cn-data-matrix__grand-total\">\n\t\t\t\t\t\t\t{{ formatTotal(grandTotal) }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRank\" class=\"cn-data-matrix__total-cell\" />\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>\n\n\t\t<p v-if=\"rows.length === 0\" class=\"cn-data-matrix__empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { evalFormula } from '../../utils/evalFormula.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\nconst ROUNDERS = Object.freeze({ round: Math.round, ceil: Math.ceil, floor: Math.floor })\n\n/**\n * The number a cell holds; an empty cell is no number, rather than zero.\n *\n * @param {unknown} raw The cell.\n * @return {number|null} The number, or null.\n */\nfunction numberIn(raw) {\n\treturn raw === null || raw === undefined || raw === '' || !Number.isFinite(Number(raw)) ? null : Number(raw)\n}\n\n/**\n * CnDataMatrix — Inline-edit data grid for matrix-shaped data\n * (rows × columns). Each cell is click-to-edit, and keyboard editable:\n * Tab reaches it, Enter or F2 opens it, Enter commits, Escape cancels. Commits emit\n * `@cell-edit({ rowId, colKey, value })` so the parent can persist.\n * Optional row / column / grand totals computed from the live data\n * with the column's `aggregate` setting (`sum` by default).\n *\n * Use for gradebooks, weight matrices, allocation tables, scoring\n * rubrics — the \"spreadsheet\" shape where cells are independently\n * editable values rather than a row/object form.\n *\n * A column with `formula` computes its cells from the other columns and is\n * read only: `now*(rate/100)`, with `prev_now` for the row above and `round`\n * set to `round`, `ceil` or `floor`. A row where the formula has no answer shows\n * its own stored value. Formulas are arithmetic only, through `evalFormula`.\n *\n * A scoring matrix weighs its columns: give each column a `weight` (and an\n * optional `weightLabel` such as \"40%\"), set `rowTotalsMode=\"weighted\"` and\n * the row total is the weighted mean of the row's scores. `showRank` ranks\n * the rows by that total, highest first, and `highlightTopRank` tints the\n * leading row.\n *\n * Not a full spreadsheet engine — there are no cell-range references, no\n * charts. Consumers wanting that should\n * embed a dedicated library (e.g. handsontable) and use this for\n * the simpler cases.\n *\n * ```vue\n * <CnDataMatrix\n * title=\"Cohort gradebook\"\n * row-header=\"Student\"\n * :rows=\"students\"\n * :columns=\"[\n * { key: 'midterm', label: 'Midterm', type: 'number', aggregate: 'sum' },\n * { key: 'final', label: 'Final', type: 'number', aggregate: 'sum' },\n * { key: 'notes', label: 'Notes', type: 'string', readOnly: true },\n * ]\"\n * :show-row-totals=\"true\"\n * :show-column-totals=\"true\"\n * @cell-edit=\"onCellEdit\" />\n * ```\n */\nexport default {\n\tname: 'CnDataMatrix',\n\tprops: {\n\t\t/**\n\t\t * Row records. Each record holds an `id`, an optional row\n\t\t * label, and one field per column key.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\trows: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Column declarations.\n\t\t *\n\t\t * @type {Array<{key:string,label?:string,type?:'number'|'string',readOnly?:boolean,formula?:string,round?:'round'|'ceil'|'floor',formatter?:(value: unknown) => string,aggregate?:'sum'|'avg'|'count'|'none',width?:string,weight?:number,weightLabel?:string}>}\n\t\t */\n\t\tcolumns: { type: Array, default: () => [] },\n\t\t/** Field on each row carrying its id. */\n\t\trowIdKey: { type: String, default: 'id' },\n\t\t/** Field on each row carrying its label (shown in the row header). */\n\t\trowLabelKey: { type: String, default: 'label' },\n\t\t/** Header for the row-label column (empty hides it). */\n\t\trowHeader: { type: String, default: '' },\n\t\t/** Optional title. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Optional description. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** Empty-state text when rows[] is empty. */\n\t\temptyLabel: { type: String, default: 'No data.' },\n\t\t/** Disable all cell editing globally. */\n\t\treadOnly: { type: Boolean, default: false },\n\t\t/** Render the per-row totals column. */\n\t\tshowRowTotals: { type: Boolean, default: false },\n\t\t/** Render the per-column totals row at the bottom. */\n\t\tshowColumnTotals: { type: Boolean, default: false },\n\t\t/** Label for the row-totals column header. */\n\t\trowTotalsLabel: { type: String, default: 'Total' },\n\t\t/** Label preceding the column-totals row. */\n\t\tcolumnTotalsLabel: { type: String, default: 'Total' },\n\t\t/**\n\t\t * How a row total is computed: `sum` adds the number columns,\n\t\t * `weighted` takes the mean of the number columns weighted by each\n\t\t * column's `weight`, leaving out a cell without a value.\n\t\t */\n\t\trowTotalsMode: { type: String, default: 'sum', validator: (v) => ['sum', 'weighted'].includes(v) },\n\t\t/** Fraction digits of the totals; null keeps the locale default. */\n\t\ttotalsFractionDigits: { type: Number, default: null },\n\t\t/** Render a rank column: the rows ranked by their row total, highest first, ties sharing a rank. */\n\t\tshowRank: { type: Boolean, default: false },\n\t\t/** Header of the rank column, already translated; the library default is \"Rank\". */\n\t\trankLabel: { type: String, default: '' },\n\t\t/** Tint the row ranked first. */\n\t\thighlightTopRank: { type: Boolean, default: false },\n\t\t/** Field on each row with a second line under its label, such as a price. */\n\t\trowSublabelKey: { type: String, default: '' },\n\t},\n\n\temits: ['cell-edit'],\n\tdata() {\n\t\treturn {\n\t\t\tediting: null, // { rowId, colKey }\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {string} The rank column header. */\n\t\tresolvedRankLabel() {\n\t\t\treturn this.rankLabel || t('nextcloud-vue', 'Rank')\n\t\t},\n\n\t\t/**\n\t\t * The rank of every row with a row total: highest total first, rows\n\t\t * with an equal total sharing a rank (1, 2, 2, 4).\n\t\t *\n\t\t * @return {Map<unknown, number>} Rank per row id.\n\t\t */\n\t\tranks() {\n\t\t\tconst totals = this.rows\n\t\t\t\t.map((row) => ({ id: row[this.rowIdKey], total: this.rowTotal(row) }))\n\t\t\t\t.filter((entry) => Number.isFinite(entry.total))\n\t\t\t\t.sort((a, b) => b.total - a.total)\n\t\t\tconst ranks = new Map()\n\t\t\ttotals.forEach((entry, index) => {\n\t\t\t\tconst previous = totals[index - 1]\n\t\t\t\tranks.set(entry.id, previous && previous.total === entry.total ? ranks.get(previous.id) : index + 1)\n\t\t\t})\n\t\t\treturn ranks\n\t\t},\n\n\t\t/**\n\t\t * The computed cells of every row, in order. A formula reads the row's\n\t\t * numbers by column key and the previous row's as `prev_<key>`, and sees\n\t\t * formula columns to its left. A formula without an answer has no entry\n\t\t * here, so the cell shows what the row itself holds.\n\t\t *\n\t\t * @return {Map<object, Record<string, number>>} Computed values per row.\n\t\t */\n\t\tformulaValues() {\n\t\t\tconst values = new Map()\n\t\t\tif (!this.columns.some((col) => col.formula)) {\n\t\t\t\treturn values\n\t\t\t}\n\t\t\tlet previous = {}\n\t\t\tfor (const row of this.rows) {\n\t\t\t\tconst vars = { ...previous }\n\t\t\t\tfor (const col of this.columns) {\n\t\t\t\t\tif (!col.formula && numberIn(row[col.key]) !== null) {\n\t\t\t\t\t\tvars[col.key] = numberIn(row[col.key])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst computed = {}\n\t\t\t\tfor (const col of this.columns) {\n\t\t\t\t\tif (col.formula) {\n\t\t\t\t\t\tconst answer = evalFormula(col.formula, vars)\n\t\t\t\t\t\tif (answer !== null) {\n\t\t\t\t\t\t\tcomputed[col.key] = (ROUNDERS[col.round] ?? Number)(answer)\n\t\t\t\t\t\t\tvars[col.key] = computed[col.key]\n\t\t\t\t\t\t} else if (numberIn(row[col.key]) !== null) {\n\t\t\t\t\t\t\tvars[col.key] = numberIn(row[col.key])\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvalues.set(row, computed)\n\t\t\t\tprevious = Object.fromEntries(Object.entries(vars).filter(([key]) => !key.startsWith('prev_')).map(([key, value]) => [`prev_${key}`, value]))\n\t\t\t}\n\t\t\treturn values\n\t\t},\n\n\t\t/**\n\t\t * Grand total (sum of every numeric cell). Shown in the\n\t\t * bottom-right corner when both totals are enabled.\n\t\t *\n\t\t * @return {number}\n\t\t */\n\t\tgrandTotal() {\n\t\t\tlet total = 0\n\t\t\tfor (const row of this.rows) {\n\t\t\t\tfor (const col of this.columns) {\n\t\t\t\t\tif (col.type === 'number') {\n\t\t\t\t\t\tconst v = Number(this.cellValue(row, col))\n\t\t\t\t\t\tif (Number.isFinite(v)) {\n\t\t\t\t\t\t\ttotal += v\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn total\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Whether the given (row, col) is the active edit cell.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {boolean}\n\t\t */\n\t\tisEditing(row, col) {\n\t\t\treturn this.editing && this.editing.rowId === row[this.rowIdKey] && this.editing.colKey === col.key\n\t\t},\n\n\t\t/**\n\t\t * Effective read-only flag for a single cell.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {boolean}\n\t\t */\n\t\tisCellReadOnly(row, col) {\n\t\t\treturn Boolean(col.readOnly || col.formula)\n\t\t},\n\n\t\t/**\n\t\t * Whether a cell can be edited, and so takes keyboard focus.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {boolean}\n\t\t */\n\t\tisCellEditable(row, col) {\n\t\t\treturn !this.readOnly && !this.isCellReadOnly(row, col)\n\t\t},\n\n\t\t/**\n\t\t * Accessible name of a cell's input: its column and row.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {string} The label.\n\t\t */\n\t\tinputLabel(row, col) {\n\t\t\treturn t('nextcloud-vue', '{column}, {row}', {\n\t\t\t\tcolumn: col.label || col.key,\n\t\t\t\trow: row[this.rowLabelKey] ?? row[this.rowIdKey],\n\t\t\t}, undefined, { escape: false })\n\t\t},\n\n\t\t/**\n\t\t * Accessible name of an editable cell: its column, row and value.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {string} The label.\n\t\t */\n\t\tcellLabel(row, col) {\n\t\t\tconst value = this.formatCell(this.cellValue(row, col), col)\n\t\t\tconst vars = { cell: this.inputLabel(row, col), value: String(value) }\n\t\t\treturn value === ''\n\t\t\t\t? t('nextcloud-vue', '{cell}: empty', vars, undefined, { escape: false })\n\t\t\t\t: t('nextcloud-vue', '{cell}: {value}', vars, undefined, { escape: false })\n\t\t},\n\n\t\t/**\n\t\t * Enter or F2 on a focused cell starts editing it.\n\t\t *\n\t\t * @param {KeyboardEvent} event The key event.\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {void}\n\t\t */\n\t\tonCellKeydown(event, row, col) {\n\t\t\tif ((event.key === 'Enter' || event.key === 'F2') && this.isCellEditable(row, col)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.startEdit(row, col)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Enter commits and Escape cancels the edit; both return focus to the cell.\n\t\t *\n\t\t * @param {KeyboardEvent} event The key event.\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {void}\n\t\t */\n\t\tonInputKeydown(event, row, col) {\n\t\t\tif (event.key === 'Enter') {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.commitEdit(row, col, event.target.value)\n\t\t\t\tthis.focusCell(row, col)\n\t\t\t} else if (event.key === 'Escape' || event.key === 'Esc') {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.cancelEdit()\n\t\t\t\tthis.focusCell(row, col)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Move focus to a cell's value after the edit input is gone.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {void}\n\t\t */\n\t\tfocusCell(row, col) {\n\t\t\tconst rowId = String(row[this.rowIdKey])\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tconst cell = Array.from(this.$el.querySelectorAll('.cn-data-matrix__cell'))\n\t\t\t\t\t.find((td) => td.dataset.rowId === rowId && td.dataset.colKey === col.key)\n\t\t\t\tcell?.querySelector('.cn-data-matrix__cell-value')?.focus()\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Read the cell value from the row.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {unknown} The raw value.\n\t\t */\n\t\tcellValue(row, col) {\n\t\t\tif (col.formula && this.formulaValues.get(row)?.[col.key] !== undefined) {\n\t\t\t\treturn this.formulaValues.get(row)[col.key]\n\t\t\t}\n\t\t\treturn row[col.key]\n\t\t},\n\n\t\t/**\n\t\t * Format a cell value for display. Number columns get a\n\t\t * locale-formatted number; others go through the column's\n\t\t * `formatter` (if any) or are returned verbatim.\n\t\t *\n\t\t * @param {unknown} value The raw value.\n\t\t * @param {object} col Column definition.\n\t\t * @return {string} The display string.\n\t\t */\n\t\tformatCell(value, col) {\n\t\t\tif (value === undefined || value === null || value === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tif (typeof col.formatter === 'function') {\n\t\t\t\treturn col.formatter(value)\n\t\t\t}\n\t\t\tif (col.type === 'number') {\n\t\t\t\tconst n = Number(value)\n\t\t\t\tif (!Number.isFinite(n)) {\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t\treturn n.toLocaleString(userLocale())\n\t\t\t}\n\t\t\treturn value\n\t\t},\n\n\t\t/**\n\t\t * BEM modifier(s) for a cell — currently only the read-only\n\t\t * flag. Consumers extend via the `formatter` if they want\n\t\t * to swap to a styled component.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {object} Class binding.\n\t\t */\n\t\tcellClass(row, col) {\n\t\t\treturn {\n\t\t\t\t'cn-data-matrix__cell--read-only': this.readOnly || this.isCellReadOnly(row, col),\n\t\t\t\t'cn-data-matrix__cell--number': col.type === 'number',\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Start editing a cell.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {void}\n\t\t */\n\t\tstartEdit(row, col) {\n\t\t\tif (this.readOnly || this.isCellReadOnly(row, col)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.editing = { rowId: row[this.rowIdKey], colKey: col.key }\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tif (this.$refs.activeInput && this.$refs.activeInput[0]) {\n\t\t\t\t\tthis.$refs.activeInput[0].focus()\n\t\t\t\t\tthis.$refs.activeInput[0].select()\n\t\t\t\t} else if (this.$refs.activeInput && this.$refs.activeInput.focus) {\n\t\t\t\t\tthis.$refs.activeInput.focus()\n\t\t\t\t\tthis.$refs.activeInput.select()\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Commit an edit — coerces the value to the column type and\n\t\t * emits `@cell-edit`.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @param {string} raw The raw input string.\n\t\t * @return {void}\n\t\t */\n\t\tcommitEdit(row, col, raw) {\n\t\t\tif (!this.editing) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet value = raw\n\t\t\tif (col.type === 'number') {\n\t\t\t\tconst n = Number(raw)\n\t\t\t\tvalue = Number.isFinite(n) ? n : null\n\t\t\t}\n\t\t\tthis.editing = null\n\t\t\t/**\n\t\t\t * @event cell-edit Emitted on commit (blur or Enter).\n\t\t\t * Payload: `{rowId, colKey, value, row}`.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('cell-edit', { rowId: row[this.rowIdKey], colKey: col.key, value, row })\n\t\t},\n\n\t\t/**\n\t\t * Cancel the active edit (Esc).\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcancelEdit() {\n\t\t\tthis.editing = null\n\t\t},\n\n\t\t/**\n\t\t * The weight shown beside a column label: `weightLabel`, else the\n\t\t * `weight` itself, or '' for an unweighted column.\n\t\t *\n\t\t * @param {object} col Column definition.\n\t\t * @return {string} The weight text.\n\t\t */\n\t\tweightText(col) {\n\t\t\tif (typeof col.weightLabel === 'string' && col.weightLabel !== '') {\n\t\t\t\treturn col.weightLabel\n\t\t\t}\n\t\t\treturn Number.isFinite(col.weight) ? String(col.weight) : ''\n\t\t},\n\n\t\t/**\n\t\t * Format a total with `totalsFractionDigits` when set.\n\t\t *\n\t\t * @param {number|null} value The total.\n\t\t * @return {string} The display string.\n\t\t */\n\t\tformatTotal(value) {\n\t\t\tif (!Number.isFinite(value)) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tif (this.totalsFractionDigits === null) {\n\t\t\t\treturn this.formatCell(value, { type: 'number' })\n\t\t\t}\n\t\t\tconst digits = this.totalsFractionDigits\n\t\t\treturn value.toLocaleString(userLocale(), { minimumFractionDigits: digits, maximumFractionDigits: digits })\n\t\t},\n\n\t\t/**\n\t\t * Per-row total: the sum of every numeric column, or in `weighted`\n\t\t * mode the weighted mean over the weighted columns that hold a value\n\t\t * (null when none does).\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @return {number|null}\n\t\t */\n\t\trowTotal(row) {\n\t\t\tif (this.rowTotalsMode === 'weighted') {\n\t\t\t\tlet weighted = 0\n\t\t\t\tlet weights = 0\n\t\t\t\tfor (const col of this.columns) {\n\t\t\t\t\tconst raw = this.cellValue(row, col)\n\t\t\t\t\tconst v = Number(raw)\n\t\t\t\t\tif (col.type === 'number' && Number.isFinite(col.weight) && col.weight > 0 && raw !== null && raw !== undefined && raw !== '' && Number.isFinite(v)) {\n\t\t\t\t\t\tweighted += v * col.weight\n\t\t\t\t\t\tweights += col.weight\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn weights > 0 ? weighted / weights : null\n\t\t\t}\n\t\t\tlet total = 0\n\t\t\tfor (const col of this.columns) {\n\t\t\t\tif (col.type === 'number') {\n\t\t\t\t\tconst v = Number(this.cellValue(row, col))\n\t\t\t\t\tif (Number.isFinite(v)) {\n\t\t\t\t\t\ttotal += v\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn total\n\t\t},\n\n\t\t/**\n\t\t * Per-column total — aggregate over all rows using the\n\t\t * column's `aggregate` setting (`sum` by default).\n\t\t *\n\t\t * @param {object} col Column definition.\n\t\t * @return {number}\n\t\t */\n\t\tcolumnTotal(col) {\n\t\t\tif (col.type !== 'number') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst mode = col.aggregate || 'sum'\n\t\t\tif (mode === 'none') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\t// Drop empty cells (null / undefined / '') BEFORE coercing —\n\t\t\t// `Number(null)` is `0`, which would otherwise be counted and\n\t\t\t// summed as a real zero value.\n\t\t\tconst values = this.rows\n\t\t\t\t.map((r) => this.cellValue(r, col))\n\t\t\t\t.filter((v) => v !== null && v !== undefined && v !== '')\n\t\t\t\t.map((v) => Number(v))\n\t\t\t\t.filter((v) => Number.isFinite(v))\n\t\t\tif (values.length === 0) {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tif (mode === 'count') {\n\t\t\t\treturn values.length\n\t\t\t}\n\t\t\tif (mode === 'avg') {\n\t\t\t\treturn values.reduce((a, b) => a + b, 0) / values.length\n\t\t\t}\n\t\t\t// default: sum\n\t\t\treturn values.reduce((a, b) => a + b, 0)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-data-matrix {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-data-matrix__title {\n\tmargin: 0;\n\tfont-size: 1.1em;\n}\n\n.cn-data-matrix__description {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-data-matrix__scroller {\n\toverflow-x: auto;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n}\n\n.cn-data-matrix__table {\n\twidth: 100%;\n\tborder-collapse: collapse;\n\tfont-size: 0.95em;\n}\n\n.cn-data-matrix__col-header,\n.cn-data-matrix__row-header-corner,\n.cn-data-matrix__total-header {\n\tbackground: var(--color-background-hover);\n\ttext-align: left;\n\tpadding: 8px 10px;\n\tfont-weight: 600;\n\tborder-bottom: 1px solid var(--color-border);\n\tborder-right: 1px solid var(--color-border);\n}\n\n.cn-data-matrix__row-header {\n\tbackground: var(--color-background-hover);\n\ttext-align: left;\n\tpadding: 6px 10px;\n\tfont-weight: 500;\n\tborder-right: 1px solid var(--color-border);\n\tborder-bottom: 1px solid var(--color-border);\n\tmax-width: 200px;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-data-matrix__cell {\n\tpadding: 0;\n\tborder-right: 1px solid var(--color-border);\n\tborder-bottom: 1px solid var(--color-border);\n\tmin-width: 80px;\n}\n\n.cn-data-matrix__cell--number {\n\ttext-align: right;\n}\n\n.cn-data-matrix__cell-value {\n\tdisplay: block;\n\tpadding: 6px 10px;\n\tcursor: cell;\n\tmin-height: 28px;\n}\n\n.cn-data-matrix__cell-value:focus-visible {\n\toutline: 2px solid var(--color-primary-element);\n\toutline-offset: -2px;\n}\n\n.cn-data-matrix__cell--read-only .cn-data-matrix__cell-value {\n\tcursor: default;\n\tbackground: var(--color-background-hover);\n}\n\n.cn-data-matrix__cell-input {\n\twidth: 100%;\n\tpadding: 5px 10px;\n\tborder: 1px solid var(--color-primary-element);\n\tbackground: var(--color-main-background);\n\toutline: none;\n\tfont: inherit;\n}\n\n.cn-data-matrix__totals-row .cn-data-matrix__total-cell,\n.cn-data-matrix__total-header {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n\tfont-weight: 600;\n\ttext-align: right;\n\tpadding: 6px 10px;\n}\n\n.cn-data-matrix__totals-label {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n\tfont-weight: 600;\n\tpadding: 6px 10px;\n\ttext-align: left;\n}\n\n.cn-data-matrix__grand-total {\n\tbackground: var(--color-primary-element-light);\n}\n\n.cn-data-matrix__weight {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-weight: 400;\n\twhite-space: nowrap;\n}\n\n.cn-data-matrix__row-sublabel {\n\tdisplay: block;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\tfont-weight: 400;\n}\n\n.cn-data-matrix__row--top > th,\n.cn-data-matrix__row--top > td {\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text);\n}\n\n.cn-data-matrix__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n\tmargin: 16px 0;\n\ttext-align: center;\n}\n</style>\n"],"names":["t"],"mappings":";;;;AA0GA,MAAM,QAAS,GAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAA;;AAExF;;AAEC;;AAEA;;AAED,SAAS,QAAQ,CAAC,GAAG,EAAE;AACtB,CAAA,OAAO,GAAI,KAAI,IAAG,IAAK,GAAI,KAAI,SAAQ,IAAK,GAAI,KAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAG,GAAI,MAAM,CAAC,GAAG,CAAA;AAC5G,CAAA;;AAEA;;;AAGC;;;;AAIA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;;AAIA;;AAEA;;AAE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K,KAAM,CAAC,EAAE;AACxB,IAAA,OAAO,CAAA;AACR,IAAA;AACA,GAAA,IAAI,SAAS,OAAO,EAAE;AACrB,IAAA,OAAO,MAAM,CAAC,MAAK;AACpB,IAAA;AACA,GAAA,IAAI,IAAK,KAAI,KAAK,EAAE;IACnB,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAE,GAAE,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,MAAK;AACxD,IAAA;;AAEA,GAAA,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAA,GAAI,CAAC,EAAE,CAAC,CAAA;GACvC;EACD;AACF;;;;"}
@@ -1,4 +1,4 @@
1
- import { openBlock, createElementBlock, toDisplayString, createCommentVNode, createElementVNode, Fragment, renderList, normalizeStyle, createTextVNode, normalizeClass, withKeys } from 'vue';
1
+ import { openBlock, createElementBlock, toDisplayString, createCommentVNode, createElementVNode, Fragment, renderList, normalizeStyle, createTextVNode, normalizeClass } from 'vue';
2
2
 
3
3
  const _hoisted_1 = {
4
4
  class: "cn-data-matrix",
@@ -40,8 +40,8 @@ const _hoisted_12 = {
40
40
  class: "cn-data-matrix__row-sublabel"
41
41
  };
42
42
  const _hoisted_13 = ["data-row-id", "data-col-key"];
43
- const _hoisted_14 = ["value", "disabled", "onBlur", "onKeydown"];
44
- const _hoisted_15 = ["onClick"];
43
+ const _hoisted_14 = ["value", "aria-label", "disabled", "onBlur", "onKeydown"];
44
+ const _hoisted_15 = ["tabindex", "role", "aria-label", "onClick", "onKeydown"];
45
45
  const _hoisted_16 = {
46
46
  key: 1,
47
47
  class: "cn-data-matrix__total-cell"
@@ -144,18 +144,20 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
144
144
  type: "text",
145
145
  class: "cn-data-matrix__cell-input",
146
146
  value: $options.cellValue(row, col),
147
+ "aria-label": $options.inputLabel(row, col),
147
148
  disabled: $props.readOnly || $options.isCellReadOnly(row, col),
148
149
  onBlur: $event => ($options.commitEdit(row, col, $event.target.value)),
149
- onKeydown: [
150
- withKeys($event => ($options.commitEdit(row, col, $event.target.value)), ["enter"]),
151
- _cache[0] || (_cache[0] = withKeys((...args) => ($options.cancelEdit && $options.cancelEdit(...args)), ["esc"]))
152
- ]
150
+ onKeydown: $event => ($options.onInputKeydown($event, row, col))
153
151
  }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_14))
154
152
  : (openBlock(), createElementBlock("span", {
155
153
  key: 1,
156
154
  class: "cn-data-matrix__cell-value",
157
- onClick: $event => ($options.startEdit(row, col))
158
- }, toDisplayString($options.formatCell($options.cellValue(row, col), col)), 9 /* TEXT, PROPS */, _hoisted_15))
155
+ tabindex: $options.isCellEditable(row, col) ? 0 : null,
156
+ role: $options.isCellEditable(row, col) ? 'button' : null,
157
+ "aria-label": $options.isCellEditable(row, col) ? $options.cellLabel(row, col) : null,
158
+ onClick: $event => ($options.startEdit(row, col)),
159
+ onKeydown: $event => ($options.onCellKeydown($event, row, col))
160
+ }, toDisplayString($options.formatCell($options.cellValue(row, col), col)), 41 /* TEXT, PROPS, NEED_HYDRATION */, _hoisted_15))
159
161
  ], 10 /* CLASS, PROPS */, _hoisted_13))
160
162
  }), 128 /* KEYED_FRAGMENT */)),
161
163
  ($props.showRowTotals)
@@ -1 +1 @@
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,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AA,GAAA,EAAA,CAAA,EAAA,CAAA,YAAA;;;;WAG5C,MAAgB,CAAA,gBAAA;AAA1B,eAAAF,SAAA,EAAA,EAAAC,kBAAA,CAaI,MAbJ,WAaI,EAAA;iBAZO,MAAS,CAAA,SAAA;kCAAnBA,kBAEI,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;;;;;;;"}
1
+ {"version":3,"file":"CnDataMatrix.vue3.js","sources":["../../../../src/components/CnDataMatrix/CnDataMatrix.vue?vue&type=template&id=7c401d14&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:aria-label=\"inputLabel(row, col)\"\n\t\t\t\t\t\t\t\t:disabled=\"readOnly || isCellReadOnly(row, col)\"\n\t\t\t\t\t\t\t\t@blur=\"commitEdit(row, col, $event.target.value)\"\n\t\t\t\t\t\t\t\t@keydown=\"onInputKeydown($event, row, col)\">\n\t\t\t\t\t\t\t<span v-else\n\t\t\t\t\t\t\t\tclass=\"cn-data-matrix__cell-value\"\n\t\t\t\t\t\t\t\t:tabindex=\"isCellEditable(row, col) ? 0 : null\"\n\t\t\t\t\t\t\t\t:role=\"isCellEditable(row, col) ? 'button' : null\"\n\t\t\t\t\t\t\t\t:aria-label=\"isCellEditable(row, col) ? cellLabel(row, col) : null\"\n\t\t\t\t\t\t\t\t@click=\"startEdit(row, col)\"\n\t\t\t\t\t\t\t\t@keydown=\"onCellKeydown($event, row, col)\">\n\t\t\t\t\t\t\t\t{{ formatCell(cellValue(row, col), col) }}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRowTotals\" class=\"cn-data-matrix__total-cell\">\n\t\t\t\t\t\t\t{{ formatTotal(rowTotal(row)) }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRank\" class=\"cn-data-matrix__total-cell cn-data-matrix__rank-cell\">\n\t\t\t\t\t\t\t{{ ranks.has(row[rowIdKey]) ? ranks.get(row[rowIdKey]) : '' }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr v-if=\"showColumnTotals\" class=\"cn-data-matrix__totals-row\">\n\t\t\t\t\t\t<th v-if=\"rowHeader\" class=\"cn-data-matrix__totals-label\">\n\t\t\t\t\t\t\t{{ columnTotalsLabel }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<td v-for=\"col in columns\"\n\t\t\t\t\t\t\t:key=\"col.key\"\n\t\t\t\t\t\t\tclass=\"cn-data-matrix__total-cell\">\n\t\t\t\t\t\t\t{{ formatCell(columnTotal(col), { type: 'number' }) }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRowTotals\" class=\"cn-data-matrix__total-cell cn-data-matrix__grand-total\">\n\t\t\t\t\t\t\t{{ formatTotal(grandTotal) }}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"showRank\" class=\"cn-data-matrix__total-cell\" />\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>\n\n\t\t<p v-if=\"rows.length === 0\" class=\"cn-data-matrix__empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { evalFormula } from '../../utils/evalFormula.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\nconst ROUNDERS = Object.freeze({ round: Math.round, ceil: Math.ceil, floor: Math.floor })\n\n/**\n * The number a cell holds; an empty cell is no number, rather than zero.\n *\n * @param {unknown} raw The cell.\n * @return {number|null} The number, or null.\n */\nfunction numberIn(raw) {\n\treturn raw === null || raw === undefined || raw === '' || !Number.isFinite(Number(raw)) ? null : Number(raw)\n}\n\n/**\n * CnDataMatrix — Inline-edit data grid for matrix-shaped data\n * (rows × columns). Each cell is click-to-edit, and keyboard editable:\n * Tab reaches it, Enter or F2 opens it, Enter commits, Escape cancels. Commits emit\n * `@cell-edit({ rowId, colKey, value })` so the parent can persist.\n * Optional row / column / grand totals computed from the live data\n * with the column's `aggregate` setting (`sum` by default).\n *\n * Use for gradebooks, weight matrices, allocation tables, scoring\n * rubrics — the \"spreadsheet\" shape where cells are independently\n * editable values rather than a row/object form.\n *\n * A column with `formula` computes its cells from the other columns and is\n * read only: `now*(rate/100)`, with `prev_now` for the row above and `round`\n * set to `round`, `ceil` or `floor`. A row where the formula has no answer shows\n * its own stored value. Formulas are arithmetic only, through `evalFormula`.\n *\n * A scoring matrix weighs its columns: give each column a `weight` (and an\n * optional `weightLabel` such as \"40%\"), set `rowTotalsMode=\"weighted\"` and\n * the row total is the weighted mean of the row's scores. `showRank` ranks\n * the rows by that total, highest first, and `highlightTopRank` tints the\n * leading row.\n *\n * Not a full spreadsheet engine — there are no cell-range references, no\n * charts. Consumers wanting that should\n * embed a dedicated library (e.g. handsontable) and use this for\n * the simpler cases.\n *\n * ```vue\n * <CnDataMatrix\n * title=\"Cohort gradebook\"\n * row-header=\"Student\"\n * :rows=\"students\"\n * :columns=\"[\n * { key: 'midterm', label: 'Midterm', type: 'number', aggregate: 'sum' },\n * { key: 'final', label: 'Final', type: 'number', aggregate: 'sum' },\n * { key: 'notes', label: 'Notes', type: 'string', readOnly: true },\n * ]\"\n * :show-row-totals=\"true\"\n * :show-column-totals=\"true\"\n * @cell-edit=\"onCellEdit\" />\n * ```\n */\nexport default {\n\tname: 'CnDataMatrix',\n\tprops: {\n\t\t/**\n\t\t * Row records. Each record holds an `id`, an optional row\n\t\t * label, and one field per column key.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\trows: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Column declarations.\n\t\t *\n\t\t * @type {Array<{key:string,label?:string,type?:'number'|'string',readOnly?:boolean,formula?:string,round?:'round'|'ceil'|'floor',formatter?:(value: unknown) => string,aggregate?:'sum'|'avg'|'count'|'none',width?:string,weight?:number,weightLabel?:string}>}\n\t\t */\n\t\tcolumns: { type: Array, default: () => [] },\n\t\t/** Field on each row carrying its id. */\n\t\trowIdKey: { type: String, default: 'id' },\n\t\t/** Field on each row carrying its label (shown in the row header). */\n\t\trowLabelKey: { type: String, default: 'label' },\n\t\t/** Header for the row-label column (empty hides it). */\n\t\trowHeader: { type: String, default: '' },\n\t\t/** Optional title. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Optional description. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** Empty-state text when rows[] is empty. */\n\t\temptyLabel: { type: String, default: 'No data.' },\n\t\t/** Disable all cell editing globally. */\n\t\treadOnly: { type: Boolean, default: false },\n\t\t/** Render the per-row totals column. */\n\t\tshowRowTotals: { type: Boolean, default: false },\n\t\t/** Render the per-column totals row at the bottom. */\n\t\tshowColumnTotals: { type: Boolean, default: false },\n\t\t/** Label for the row-totals column header. */\n\t\trowTotalsLabel: { type: String, default: 'Total' },\n\t\t/** Label preceding the column-totals row. */\n\t\tcolumnTotalsLabel: { type: String, default: 'Total' },\n\t\t/**\n\t\t * How a row total is computed: `sum` adds the number columns,\n\t\t * `weighted` takes the mean of the number columns weighted by each\n\t\t * column's `weight`, leaving out a cell without a value.\n\t\t */\n\t\trowTotalsMode: { type: String, default: 'sum', validator: (v) => ['sum', 'weighted'].includes(v) },\n\t\t/** Fraction digits of the totals; null keeps the locale default. */\n\t\ttotalsFractionDigits: { type: Number, default: null },\n\t\t/** Render a rank column: the rows ranked by their row total, highest first, ties sharing a rank. */\n\t\tshowRank: { type: Boolean, default: false },\n\t\t/** Header of the rank column, already translated; the library default is \"Rank\". */\n\t\trankLabel: { type: String, default: '' },\n\t\t/** Tint the row ranked first. */\n\t\thighlightTopRank: { type: Boolean, default: false },\n\t\t/** Field on each row with a second line under its label, such as a price. */\n\t\trowSublabelKey: { type: String, default: '' },\n\t},\n\n\temits: ['cell-edit'],\n\tdata() {\n\t\treturn {\n\t\t\tediting: null, // { rowId, colKey }\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {string} The rank column header. */\n\t\tresolvedRankLabel() {\n\t\t\treturn this.rankLabel || t('nextcloud-vue', 'Rank')\n\t\t},\n\n\t\t/**\n\t\t * The rank of every row with a row total: highest total first, rows\n\t\t * with an equal total sharing a rank (1, 2, 2, 4).\n\t\t *\n\t\t * @return {Map<unknown, number>} Rank per row id.\n\t\t */\n\t\tranks() {\n\t\t\tconst totals = this.rows\n\t\t\t\t.map((row) => ({ id: row[this.rowIdKey], total: this.rowTotal(row) }))\n\t\t\t\t.filter((entry) => Number.isFinite(entry.total))\n\t\t\t\t.sort((a, b) => b.total - a.total)\n\t\t\tconst ranks = new Map()\n\t\t\ttotals.forEach((entry, index) => {\n\t\t\t\tconst previous = totals[index - 1]\n\t\t\t\tranks.set(entry.id, previous && previous.total === entry.total ? ranks.get(previous.id) : index + 1)\n\t\t\t})\n\t\t\treturn ranks\n\t\t},\n\n\t\t/**\n\t\t * The computed cells of every row, in order. A formula reads the row's\n\t\t * numbers by column key and the previous row's as `prev_<key>`, and sees\n\t\t * formula columns to its left. A formula without an answer has no entry\n\t\t * here, so the cell shows what the row itself holds.\n\t\t *\n\t\t * @return {Map<object, Record<string, number>>} Computed values per row.\n\t\t */\n\t\tformulaValues() {\n\t\t\tconst values = new Map()\n\t\t\tif (!this.columns.some((col) => col.formula)) {\n\t\t\t\treturn values\n\t\t\t}\n\t\t\tlet previous = {}\n\t\t\tfor (const row of this.rows) {\n\t\t\t\tconst vars = { ...previous }\n\t\t\t\tfor (const col of this.columns) {\n\t\t\t\t\tif (!col.formula && numberIn(row[col.key]) !== null) {\n\t\t\t\t\t\tvars[col.key] = numberIn(row[col.key])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst computed = {}\n\t\t\t\tfor (const col of this.columns) {\n\t\t\t\t\tif (col.formula) {\n\t\t\t\t\t\tconst answer = evalFormula(col.formula, vars)\n\t\t\t\t\t\tif (answer !== null) {\n\t\t\t\t\t\t\tcomputed[col.key] = (ROUNDERS[col.round] ?? Number)(answer)\n\t\t\t\t\t\t\tvars[col.key] = computed[col.key]\n\t\t\t\t\t\t} else if (numberIn(row[col.key]) !== null) {\n\t\t\t\t\t\t\tvars[col.key] = numberIn(row[col.key])\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvalues.set(row, computed)\n\t\t\t\tprevious = Object.fromEntries(Object.entries(vars).filter(([key]) => !key.startsWith('prev_')).map(([key, value]) => [`prev_${key}`, value]))\n\t\t\t}\n\t\t\treturn values\n\t\t},\n\n\t\t/**\n\t\t * Grand total (sum of every numeric cell). Shown in the\n\t\t * bottom-right corner when both totals are enabled.\n\t\t *\n\t\t * @return {number}\n\t\t */\n\t\tgrandTotal() {\n\t\t\tlet total = 0\n\t\t\tfor (const row of this.rows) {\n\t\t\t\tfor (const col of this.columns) {\n\t\t\t\t\tif (col.type === 'number') {\n\t\t\t\t\t\tconst v = Number(this.cellValue(row, col))\n\t\t\t\t\t\tif (Number.isFinite(v)) {\n\t\t\t\t\t\t\ttotal += v\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn total\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Whether the given (row, col) is the active edit cell.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {boolean}\n\t\t */\n\t\tisEditing(row, col) {\n\t\t\treturn this.editing && this.editing.rowId === row[this.rowIdKey] && this.editing.colKey === col.key\n\t\t},\n\n\t\t/**\n\t\t * Effective read-only flag for a single cell.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {boolean}\n\t\t */\n\t\tisCellReadOnly(row, col) {\n\t\t\treturn Boolean(col.readOnly || col.formula)\n\t\t},\n\n\t\t/**\n\t\t * Whether a cell can be edited, and so takes keyboard focus.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {boolean}\n\t\t */\n\t\tisCellEditable(row, col) {\n\t\t\treturn !this.readOnly && !this.isCellReadOnly(row, col)\n\t\t},\n\n\t\t/**\n\t\t * Accessible name of a cell's input: its column and row.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {string} The label.\n\t\t */\n\t\tinputLabel(row, col) {\n\t\t\treturn t('nextcloud-vue', '{column}, {row}', {\n\t\t\t\tcolumn: col.label || col.key,\n\t\t\t\trow: row[this.rowLabelKey] ?? row[this.rowIdKey],\n\t\t\t}, undefined, { escape: false })\n\t\t},\n\n\t\t/**\n\t\t * Accessible name of an editable cell: its column, row and value.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {string} The label.\n\t\t */\n\t\tcellLabel(row, col) {\n\t\t\tconst value = this.formatCell(this.cellValue(row, col), col)\n\t\t\tconst vars = { cell: this.inputLabel(row, col), value: String(value) }\n\t\t\treturn value === ''\n\t\t\t\t? t('nextcloud-vue', '{cell}: empty', vars, undefined, { escape: false })\n\t\t\t\t: t('nextcloud-vue', '{cell}: {value}', vars, undefined, { escape: false })\n\t\t},\n\n\t\t/**\n\t\t * Enter or F2 on a focused cell starts editing it.\n\t\t *\n\t\t * @param {KeyboardEvent} event The key event.\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {void}\n\t\t */\n\t\tonCellKeydown(event, row, col) {\n\t\t\tif ((event.key === 'Enter' || event.key === 'F2') && this.isCellEditable(row, col)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.startEdit(row, col)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Enter commits and Escape cancels the edit; both return focus to the cell.\n\t\t *\n\t\t * @param {KeyboardEvent} event The key event.\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {void}\n\t\t */\n\t\tonInputKeydown(event, row, col) {\n\t\t\tif (event.key === 'Enter') {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.commitEdit(row, col, event.target.value)\n\t\t\t\tthis.focusCell(row, col)\n\t\t\t} else if (event.key === 'Escape' || event.key === 'Esc') {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.cancelEdit()\n\t\t\t\tthis.focusCell(row, col)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Move focus to a cell's value after the edit input is gone.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {void}\n\t\t */\n\t\tfocusCell(row, col) {\n\t\t\tconst rowId = String(row[this.rowIdKey])\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tconst cell = Array.from(this.$el.querySelectorAll('.cn-data-matrix__cell'))\n\t\t\t\t\t.find((td) => td.dataset.rowId === rowId && td.dataset.colKey === col.key)\n\t\t\t\tcell?.querySelector('.cn-data-matrix__cell-value')?.focus()\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Read the cell value from the row.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {unknown} The raw value.\n\t\t */\n\t\tcellValue(row, col) {\n\t\t\tif (col.formula && this.formulaValues.get(row)?.[col.key] !== undefined) {\n\t\t\t\treturn this.formulaValues.get(row)[col.key]\n\t\t\t}\n\t\t\treturn row[col.key]\n\t\t},\n\n\t\t/**\n\t\t * Format a cell value for display. Number columns get a\n\t\t * locale-formatted number; others go through the column's\n\t\t * `formatter` (if any) or are returned verbatim.\n\t\t *\n\t\t * @param {unknown} value The raw value.\n\t\t * @param {object} col Column definition.\n\t\t * @return {string} The display string.\n\t\t */\n\t\tformatCell(value, col) {\n\t\t\tif (value === undefined || value === null || value === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tif (typeof col.formatter === 'function') {\n\t\t\t\treturn col.formatter(value)\n\t\t\t}\n\t\t\tif (col.type === 'number') {\n\t\t\t\tconst n = Number(value)\n\t\t\t\tif (!Number.isFinite(n)) {\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t\treturn n.toLocaleString(userLocale())\n\t\t\t}\n\t\t\treturn value\n\t\t},\n\n\t\t/**\n\t\t * BEM modifier(s) for a cell — currently only the read-only\n\t\t * flag. Consumers extend via the `formatter` if they want\n\t\t * to swap to a styled component.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {object} Class binding.\n\t\t */\n\t\tcellClass(row, col) {\n\t\t\treturn {\n\t\t\t\t'cn-data-matrix__cell--read-only': this.readOnly || this.isCellReadOnly(row, col),\n\t\t\t\t'cn-data-matrix__cell--number': col.type === 'number',\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Start editing a cell.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @return {void}\n\t\t */\n\t\tstartEdit(row, col) {\n\t\t\tif (this.readOnly || this.isCellReadOnly(row, col)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.editing = { rowId: row[this.rowIdKey], colKey: col.key }\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tif (this.$refs.activeInput && this.$refs.activeInput[0]) {\n\t\t\t\t\tthis.$refs.activeInput[0].focus()\n\t\t\t\t\tthis.$refs.activeInput[0].select()\n\t\t\t\t} else if (this.$refs.activeInput && this.$refs.activeInput.focus) {\n\t\t\t\t\tthis.$refs.activeInput.focus()\n\t\t\t\t\tthis.$refs.activeInput.select()\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Commit an edit — coerces the value to the column type and\n\t\t * emits `@cell-edit`.\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @param {object} col Column definition.\n\t\t * @param {string} raw The raw input string.\n\t\t * @return {void}\n\t\t */\n\t\tcommitEdit(row, col, raw) {\n\t\t\tif (!this.editing) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet value = raw\n\t\t\tif (col.type === 'number') {\n\t\t\t\tconst n = Number(raw)\n\t\t\t\tvalue = Number.isFinite(n) ? n : null\n\t\t\t}\n\t\t\tthis.editing = null\n\t\t\t/**\n\t\t\t * @event cell-edit Emitted on commit (blur or Enter).\n\t\t\t * Payload: `{rowId, colKey, value, row}`.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('cell-edit', { rowId: row[this.rowIdKey], colKey: col.key, value, row })\n\t\t},\n\n\t\t/**\n\t\t * Cancel the active edit (Esc).\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcancelEdit() {\n\t\t\tthis.editing = null\n\t\t},\n\n\t\t/**\n\t\t * The weight shown beside a column label: `weightLabel`, else the\n\t\t * `weight` itself, or '' for an unweighted column.\n\t\t *\n\t\t * @param {object} col Column definition.\n\t\t * @return {string} The weight text.\n\t\t */\n\t\tweightText(col) {\n\t\t\tif (typeof col.weightLabel === 'string' && col.weightLabel !== '') {\n\t\t\t\treturn col.weightLabel\n\t\t\t}\n\t\t\treturn Number.isFinite(col.weight) ? String(col.weight) : ''\n\t\t},\n\n\t\t/**\n\t\t * Format a total with `totalsFractionDigits` when set.\n\t\t *\n\t\t * @param {number|null} value The total.\n\t\t * @return {string} The display string.\n\t\t */\n\t\tformatTotal(value) {\n\t\t\tif (!Number.isFinite(value)) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tif (this.totalsFractionDigits === null) {\n\t\t\t\treturn this.formatCell(value, { type: 'number' })\n\t\t\t}\n\t\t\tconst digits = this.totalsFractionDigits\n\t\t\treturn value.toLocaleString(userLocale(), { minimumFractionDigits: digits, maximumFractionDigits: digits })\n\t\t},\n\n\t\t/**\n\t\t * Per-row total: the sum of every numeric column, or in `weighted`\n\t\t * mode the weighted mean over the weighted columns that hold a value\n\t\t * (null when none does).\n\t\t *\n\t\t * @param {object} row Row record.\n\t\t * @return {number|null}\n\t\t */\n\t\trowTotal(row) {\n\t\t\tif (this.rowTotalsMode === 'weighted') {\n\t\t\t\tlet weighted = 0\n\t\t\t\tlet weights = 0\n\t\t\t\tfor (const col of this.columns) {\n\t\t\t\t\tconst raw = this.cellValue(row, col)\n\t\t\t\t\tconst v = Number(raw)\n\t\t\t\t\tif (col.type === 'number' && Number.isFinite(col.weight) && col.weight > 0 && raw !== null && raw !== undefined && raw !== '' && Number.isFinite(v)) {\n\t\t\t\t\t\tweighted += v * col.weight\n\t\t\t\t\t\tweights += col.weight\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn weights > 0 ? weighted / weights : null\n\t\t\t}\n\t\t\tlet total = 0\n\t\t\tfor (const col of this.columns) {\n\t\t\t\tif (col.type === 'number') {\n\t\t\t\t\tconst v = Number(this.cellValue(row, col))\n\t\t\t\t\tif (Number.isFinite(v)) {\n\t\t\t\t\t\ttotal += v\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn total\n\t\t},\n\n\t\t/**\n\t\t * Per-column total — aggregate over all rows using the\n\t\t * column's `aggregate` setting (`sum` by default).\n\t\t *\n\t\t * @param {object} col Column definition.\n\t\t * @return {number}\n\t\t */\n\t\tcolumnTotal(col) {\n\t\t\tif (col.type !== 'number') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst mode = col.aggregate || 'sum'\n\t\t\tif (mode === 'none') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\t// Drop empty cells (null / undefined / '') BEFORE coercing —\n\t\t\t// `Number(null)` is `0`, which would otherwise be counted and\n\t\t\t// summed as a real zero value.\n\t\t\tconst values = this.rows\n\t\t\t\t.map((r) => this.cellValue(r, col))\n\t\t\t\t.filter((v) => v !== null && v !== undefined && v !== '')\n\t\t\t\t.map((v) => Number(v))\n\t\t\t\t.filter((v) => Number.isFinite(v))\n\t\t\tif (values.length === 0) {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tif (mode === 'count') {\n\t\t\t\treturn values.length\n\t\t\t}\n\t\t\tif (mode === 'avg') {\n\t\t\t\treturn values.reduce((a, b) => a + b, 0) / values.length\n\t\t\t}\n\t\t\t// default: sum\n\t\t\treturn values.reduce((a, b) => a + b, 0)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-data-matrix {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-data-matrix__title {\n\tmargin: 0;\n\tfont-size: 1.1em;\n}\n\n.cn-data-matrix__description {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-data-matrix__scroller {\n\toverflow-x: auto;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n}\n\n.cn-data-matrix__table {\n\twidth: 100%;\n\tborder-collapse: collapse;\n\tfont-size: 0.95em;\n}\n\n.cn-data-matrix__col-header,\n.cn-data-matrix__row-header-corner,\n.cn-data-matrix__total-header {\n\tbackground: var(--color-background-hover);\n\ttext-align: left;\n\tpadding: 8px 10px;\n\tfont-weight: 600;\n\tborder-bottom: 1px solid var(--color-border);\n\tborder-right: 1px solid var(--color-border);\n}\n\n.cn-data-matrix__row-header {\n\tbackground: var(--color-background-hover);\n\ttext-align: left;\n\tpadding: 6px 10px;\n\tfont-weight: 500;\n\tborder-right: 1px solid var(--color-border);\n\tborder-bottom: 1px solid var(--color-border);\n\tmax-width: 200px;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-data-matrix__cell {\n\tpadding: 0;\n\tborder-right: 1px solid var(--color-border);\n\tborder-bottom: 1px solid var(--color-border);\n\tmin-width: 80px;\n}\n\n.cn-data-matrix__cell--number {\n\ttext-align: right;\n}\n\n.cn-data-matrix__cell-value {\n\tdisplay: block;\n\tpadding: 6px 10px;\n\tcursor: cell;\n\tmin-height: 28px;\n}\n\n.cn-data-matrix__cell-value:focus-visible {\n\toutline: 2px solid var(--color-primary-element);\n\toutline-offset: -2px;\n}\n\n.cn-data-matrix__cell--read-only .cn-data-matrix__cell-value {\n\tcursor: default;\n\tbackground: var(--color-background-hover);\n}\n\n.cn-data-matrix__cell-input {\n\twidth: 100%;\n\tpadding: 5px 10px;\n\tborder: 1px solid var(--color-primary-element);\n\tbackground: var(--color-main-background);\n\toutline: none;\n\tfont: inherit;\n}\n\n.cn-data-matrix__totals-row .cn-data-matrix__total-cell,\n.cn-data-matrix__total-header {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n\tfont-weight: 600;\n\ttext-align: right;\n\tpadding: 6px 10px;\n}\n\n.cn-data-matrix__totals-label {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n\tfont-weight: 600;\n\tpadding: 6px 10px;\n\ttext-align: left;\n}\n\n.cn-data-matrix__grand-total {\n\tbackground: var(--color-primary-element-light);\n}\n\n.cn-data-matrix__weight {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-weight: 400;\n\twhite-space: nowrap;\n}\n\n.cn-data-matrix__row-sublabel {\n\tdisplay: block;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n\tfont-weight: 400;\n}\n\n.cn-data-matrix__row--top > th,\n.cn-data-matrix__row--top > td {\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text);\n}\n\n.cn-data-matrix__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n\tmargin: 16px 0;\n\ttext-align: center;\n}\n</style>\n"],"names":["_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,KA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AC,MAAK,KAAA,CAAA;sBAAnBA,kBAEG,CAAA,GAAA,EAFH,WAEG,EAAAC,eAAA,CADC,MAAS,CAAA,UAAA,CAAA,EAAA,CAAA,YAAA;;;;;;;"}
@@ -63,6 +63,7 @@ import { prefixUrl } from '../../utils/headers.js';
63
63
  import { HEADING_LEVEL } from '../../utils/headingLevel.js';
64
64
  import { interpolateUrlTokens } from '../../utils/interpolateUrlTokens.js';
65
65
  import { followLinkClick } from '../../utils/linkNavigation.js';
66
+ import { parentCrumb } from '../../utils/parentCrumb.js';
66
67
  import { patchStoredSelf } from '../../utils/patchStoredSelf.js';
67
68
  import { setReadState } from '../../utils/recordInteractions.js';
68
69
  import { saveEdited } from '../../utils/saveEdited.js';
@@ -1036,6 +1037,24 @@ var script = {
1036
1037
  default: false,
1037
1038
  },
1038
1039
 
1040
+ /**
1041
+ * A condition on the record, in the `visibleWhen` grammar (manifest
1042
+ * `config.readOnlyWhen`): while it holds, the page treats the record
1043
+ * as one it may not update, as with `can.update` false. The Edit
1044
+ * button, the header actions with role `edit` or `update` and the
1045
+ * inline editors are off. `{ field: "mergedInto", op: "notEmpty" }`
1046
+ * keeps a record merged into another from being edited. It is decided
1047
+ * on the page (no `endpoint` or `source`) and may read the
1048
+ * `visibilityContext` records as `@context.<name>.<path>`. Null
1049
+ * (the default) changes nothing.
1050
+ *
1051
+ * @spec openspec/changes/detail-read-only-when/specs/detail-page/spec.md#requirement-a-detail-page-can-make-a-record-read-only-by-a-condition
1052
+ */
1053
+ readOnlyWhen: {
1054
+ type: Object,
1055
+ default: null,
1056
+ },
1057
+
1039
1058
  /**
1040
1059
  * Hide valueless fields on the auto-rendered data widget, instead of
1041
1060
  * showing them with an em dash. See `CnObjectDataWidget`'s `hide-empty`.
@@ -1621,8 +1640,12 @@ var script = {
1621
1640
  * @spec openspec/changes/zuiddrecht-pixel-gaps-3/specs/zuiddrecht-pixel-gaps-3/spec.md#requirement-a-breadcrumb-can-name-the-record-by-a-field-and-use-a-text-separator
1622
1641
  * A list of such crumbs draws a deeper trail ("Settings / Case types /"
1623
1642
  * and then the record); `currentField` and `separator` may sit on any
1624
- * of them.
1643
+ * of them. A crumb with `parent` (a `visibilityContext` name) instead
1644
+ * of `label` is the record's parent: its `labelField` value (else its
1645
+ * name), linked by `route` + `param` (default `id`) or `href` with
1646
+ * `{id}`; it drops out when the record has no parent.
1625
1647
  *
1648
+ * @spec openspec/changes/detail-parent-crumb/specs/detail-page/spec.md#requirement-a-sub-record-trail-can-show-its-parent-record
1626
1649
  * @spec openspec/changes/detail-breadcrumb-trail/specs/detail-page/spec.md#requirement-a-record-page-breadcrumb-can-name-more-than-one-level
1627
1650
  * @type {{label: string, route?: string, params?: object, href?: string, icon?: string, currentField?: string, separator?: string}|Array<object>|null}
1628
1651
  */
@@ -4174,13 +4197,30 @@ var script = {
4174
4197
  },
4175
4198
 
4176
4199
  /**
4177
- * Whether the record refuses this reader's updates (`can.update === false`).
4200
+ * Whether the record refuses this reader's updates (`can.update === false`),
4201
+ * or the page's `readOnlyWhen` holds for it.
4178
4202
  *
4179
4203
  * @return {boolean}
4180
4204
  * @spec openspec/changes/detail-page-record-rights/specs/detail-page-record-rights/spec.md#requirement-edit-controls-follow-the-records-update-right
4181
4205
  */
4182
4206
  recordUpdateDenied() {
4183
- return Boolean(this.recordCan && this.recordCan.update === false)
4207
+ return Boolean(this.recordCan && this.recordCan.update === false) || this.readOnlyByCondition
4208
+ },
4209
+
4210
+ /**
4211
+ * Whether the page's `readOnlyWhen` holds for the record (and its
4212
+ * `visibilityContext` records). False without the option, and while
4213
+ * the record or those records are still on their way.
4214
+ *
4215
+ * @return {boolean}
4216
+ * @spec openspec/changes/detail-read-only-when/specs/detail-page/spec.md#requirement-a-detail-page-can-make-a-record-read-only-by-a-condition
4217
+ */
4218
+ readOnlyByCondition() {
4219
+ const when = this.readOnlyWhen;
4220
+ if (!when || typeof when !== 'object' || !this.widgetVisibilityData || this.visibilityRowsPending) {
4221
+ return false
4222
+ }
4223
+ return detailWidgetVisible({ visibleWhen: when }, this.widgetVisibilityData)
4184
4224
  },
4185
4225
 
4186
4226
  /**
@@ -4245,7 +4285,7 @@ var script = {
4245
4285
  */
4246
4286
  declaredCrumbs() {
4247
4287
  const list = Array.isArray(this.breadcrumb) ? this.breadcrumb : (this.breadcrumb ? [this.breadcrumb] : []);
4248
- return list.filter((crumb) => crumb && typeof crumb.label === 'string' && crumb.label !== ''
4288
+ return list.filter((crumb) => crumb && ((typeof crumb.label === 'string' && crumb.label !== '') || (typeof crumb.parent === 'string' && crumb.parent !== ''))
4249
4289
  && (!crumb.visibleWhen || detailWidgetVisible({ visibleWhen: crumb.visibleWhen }, this.widgetVisibilityData)))
4250
4290
  },
4251
4291
 
@@ -4253,11 +4293,14 @@ var script = {
4253
4293
  * The breadcrumb trail: the declared crumbs (each a router target from
4254
4294
  * `route` + `params`, or an `href`), then the record's display name
4255
4295
  * as the current crumb. Empty without a declared crumb. A crumb
4256
- * carries `icon` only when the manifest declares one.
4296
+ * carries `icon` only when the manifest declares one. A crumb with
4297
+ * `parent` is the record's parent (see `parentCrumb`) and drops out
4298
+ * when the record has none.
4257
4299
  *
4258
4300
  * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-a-detail-page-drops-its-eyebrow-and-shows-a-breadcrumb
4259
4301
  * @spec openspec/changes/zuiddrecht-pixel-gaps-2/specs/zuiddrecht-pixel-gaps-2/spec.md#requirement-a-declared-breadcrumb-label-shows-as-text
4260
4302
  * @spec openspec/changes/detail-breadcrumb-trail/specs/detail-page/spec.md#requirement-a-record-page-breadcrumb-can-name-more-than-one-level
4303
+ * @spec openspec/changes/detail-parent-crumb/specs/detail-page/spec.md#requirement-a-sub-record-trail-can-show-its-parent-record
4261
4304
  * @return {Array<{label: string, to?: object, href?: string, icon?: string}>}
4262
4305
  */
4263
4306
  breadcrumbCrumbs() {
@@ -4265,6 +4308,9 @@ var script = {
4265
4308
  return []
4266
4309
  }
4267
4310
  const crumbs = this.declaredCrumbs.map((crumb) => {
4311
+ if (typeof crumb.parent === 'string' && crumb.parent !== '') {
4312
+ return parentCrumb(crumb, this.visibilityRefs, this.visibilityRows, this.effectiveTranslate)
4313
+ }
4268
4314
  const entry = { label: this.effectiveTranslate(crumb.label) };
4269
4315
  if (typeof crumb.icon === 'string' && crumb.icon !== '') {
4270
4316
  entry.icon = crumb.icon;
@@ -4275,7 +4321,10 @@ var script = {
4275
4321
  entry.href = crumb.href;
4276
4322
  }
4277
4323
  return entry
4278
- });
4324
+ }).filter((crumb) => crumb !== null);
4325
+ if (crumbs.length === 0) {
4326
+ return []
4327
+ }
4279
4328
  return [...crumbs, { label: this.breadcrumbCurrentLabel }]
4280
4329
  },
4281
4330