@conduction/nextcloud-vue 2.174.0 → 2.176.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue.js +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js +114 -11
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js +67 -17
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js +9 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js.map +1 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js +352 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js.map +1 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js +266 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js.map +1 -0
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +323 -7
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js +113 -59
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue.js +1 -1
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js +210 -5
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js.map +1 -1
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js +134 -46
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js.map +1 -1
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js +9 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js.map +1 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js +385 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js.map +1 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js +277 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js.map +1 -0
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue.js +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js +175 -20
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js +30 -8
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue.js +1 -1
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js +72 -6
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js +48 -14
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue.js +1 -1
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js +255 -10
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js.map +1 -1
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js +70 -28
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +55 -6
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js +9 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js.map +1 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js +175 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js.map +1 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js +114 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js.map +1 -0
- package/dist/esm/components/CnDurationField/CnDurationField.vue.js +1 -1
- package/dist/esm/components/CnDurationField/CnDurationField.vue2.js +218 -4
- package/dist/esm/components/CnDurationField/CnDurationField.vue2.js.map +1 -1
- package/dist/esm/components/CnDurationField/CnDurationField.vue3.js +133 -44
- package/dist/esm/components/CnDurationField/CnDurationField.vue3.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js +5 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js +9 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js.map +1 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js +113 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js.map +1 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js +43 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js.map +1 -0
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +40 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue.js +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js +110 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js.map +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js +60 -18
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js.map +1 -1
- package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js +2 -2
- package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js +2 -2
- package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js +2 -2
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnQrCode/CnQrCode.vue.js +9 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue.js.map +1 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue2.js +241 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue2.js.map +1 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue3.js +75 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue3.js.map +1 -0
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue.js +1 -1
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js +34 -3
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js.map +1 -1
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js +81 -19
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +11 -0
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +112 -88
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnRevealField/CnRevealField.vue.js +9 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue.js.map +1 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue2.js +157 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue2.js.map +1 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue3.js +116 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue3.js.map +1 -0
- package/dist/esm/components/CnStorePage/CnStorePage.vue.js +1 -1
- package/dist/esm/components/CnStorePage/CnStorePage.vue2.js +3 -3
- package/dist/esm/components/CnStorePage/CnStorePage.vue2.js.map +1 -1
- package/dist/esm/components/CnStorePage/CnStorePage.vue3.js +5 -5
- package/dist/esm/components/CnStorePage/CnStorePage.vue3.js.map +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue.js +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js +6 -6
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue.js +1 -1
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js +43 -3
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js +19 -12
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js +9 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js.map +1 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js +87 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js.map +1 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js +126 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js.map +1 -0
- package/dist/esm/components/CnTreeView/CnTreeNode.vue.js +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js +66 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js +129 -29
- package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue.js +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue2.js +158 -6
- package/dist/esm/components/CnTreeView/CnTreeView.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js +100 -39
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js.map +1 -1
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/l10n/en.json.js +79 -14
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +79 -14
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +1162 -523
- package/dist/esm/node_modules/vuedraggable/dist/vuedraggable.umd.js +2 -2
- package/dist/esm/utils/captureLocation.js +32 -0
- package/dist/esm/utils/captureLocation.js.map +1 -0
- package/dist/esm/utils/childRecordTotals.js +157 -0
- package/dist/esm/utils/childRecordTotals.js.map +1 -0
- package/dist/esm/utils/isoDuration.js +51 -1
- package/dist/esm/utils/isoDuration.js.map +1 -1
- package/dist/esm/utils/parentCrumb.js +86 -0
- package/dist/esm/utils/parentCrumb.js.map +1 -0
- package/dist/esm/utils/qr.js +649 -0
- package/dist/esm/utils/qr.js.map +1 -0
- package/dist/esm/utils/schema.js +3 -0
- package/dist/esm/utils/schema.js.map +1 -1
- package/dist/esm/utils/templateVariables.js +54 -0
- package/dist/esm/utils/templateVariables.js.map +1 -0
- package/dist/nextcloud-vue.cjs.js +21125 -15025
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +1162 -523
- package/l10n/en.json +79 -14
- package/l10n/nl.json +79 -14
- package/package.json +1 -1
- package/src/components/CnActionDialog/CnActionDialog.vue +156 -9
- package/src/components/CnBlockListEditor/CnBlockListEditor.vue +615 -0
- package/src/components/CnBlockListEditor/index.js +9 -0
- package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +377 -10
- package/src/components/CnChildRecordsField/CnChildRecordsField.vue +306 -15
- package/src/components/CnChoiceMatrix/CnChoiceMatrix.vue +710 -0
- package/src/components/CnChoiceMatrix/index.js +9 -0
- package/src/components/CnCountdownWidget/CnCountdownWidget.vue +223 -28
- package/src/components/CnCreateFormWidget/CnCreateFormWidget.vue +97 -6
- package/src/components/CnDataMatrix/CnDataMatrix.vue +304 -17
- package/src/components/CnDetailPage/CnDetailPage.vue +55 -6
- package/src/components/CnDisplayScreen/CnDisplayScreen.vue +308 -0
- package/src/components/CnDisplayScreen/index.js +9 -0
- package/src/components/CnDurationField/CnDurationField.vue +330 -5
- package/src/components/CnFormDialog/CnFormDialog.vue +4 -0
- package/src/components/CnGeoCaptureField/CnGeoCaptureField.vue +148 -0
- package/src/components/CnGeoCaptureField/index.js +9 -0
- package/src/components/CnIndexPage/CnIndexPage.vue +40 -1
- package/src/components/CnMarkdownEditor/CnMarkdownEditor.vue +139 -1
- package/src/components/CnQrCode/CnQrCode.vue +321 -0
- package/src/components/CnQrCode/index.js +9 -0
- package/src/components/CnReadinessChecklist/CnReadinessChecklist.vue +80 -3
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +34 -1
- package/src/components/CnRevealField/CnRevealField.vue +273 -0
- package/src/components/CnRevealField/index.js +9 -0
- package/src/components/CnStorePage/CnStorePage.vue +8 -8
- package/src/components/CnStorePage/CnStorePublishDialog.vue +7 -7
- package/src/components/CnTextWidget/CnTextWidget.vue +62 -3
- package/src/components/CnTransferCard/CnTransferCard.vue +205 -0
- package/src/components/CnTransferCard/index.js +9 -0
- package/src/components/CnTreeView/CnTreeNode.vue +145 -2
- package/src/components/CnTreeView/CnTreeView.vue +210 -6
- package/src/components/index.js +7 -0
- package/src/index.js +8 -0
- package/src/utils/captureLocation.js +29 -0
- package/src/utils/childRecordTotals.js +153 -0
- package/src/utils/isoDuration.js +50 -0
- package/src/utils/parentCrumb.js +83 -0
- package/src/utils/qr.js +681 -0
- package/src/utils/schema.js +3 -0
- package/src/utils/templateVariables.js +51 -0
|
@@ -3,7 +3,10 @@ import { translate } from '@nextcloud/l10n';
|
|
|
3
3
|
import { generateUrl } from '@nextcloud/router';
|
|
4
4
|
import { NcButton, NcLoadingIcon, NcTextField } from '@nextcloud/vue';
|
|
5
5
|
import { defineAsyncComponent } from 'vue';
|
|
6
|
+
import __sfc_main from '../CnSearchSelect/CnSearchSelect.vue.js';
|
|
6
7
|
import { validateChildRows, describeRowProblem, useChildRecords } from '../../composables/useChildRecords.js';
|
|
8
|
+
import { computeTotals, storeComputed, computeRow, rowFromSource } from '../../utils/childRecordTotals.js';
|
|
9
|
+
import { normalizeMetricFormat, formatMetricValue } from '../../utils/formatMetric.js';
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* CnChildRecordsField — edits the records of another schema that point at this
|
|
@@ -17,6 +20,12 @@ import { validateChildRows, describeRowProblem, useChildRecords } from '../../co
|
|
|
17
20
|
* the parent's payload. Each row is checked against the child schema's
|
|
18
21
|
* required properties and the field reports the problems through `validity`.
|
|
19
22
|
*
|
|
23
|
+
* `config.computed` adds read-only columns worked out per row from a formula,
|
|
24
|
+
* `config.totals` adds total rows under the table (a sum over the rows, or a
|
|
25
|
+
* formula over the totals before it), and `config.addFrom` adds rows from
|
|
26
|
+
* another schema's records: picked from a search, or found by a typed or
|
|
27
|
+
* scanned code.
|
|
28
|
+
*
|
|
20
29
|
* ```vue
|
|
21
30
|
* <CnChildRecordsField v-model="lines" register="shop" :config="{ schema: 'order-line', parentField: 'order' }" parentId="o-1" />
|
|
22
31
|
* ```
|
|
@@ -27,6 +36,7 @@ var script = {
|
|
|
27
36
|
components: {
|
|
28
37
|
// Lazy: CnFormDialog renders this field, so a static import is a cycle.
|
|
29
38
|
CnFormDialog: defineAsyncComponent(() => import('../CnFormDialog/CnFormDialog.vue.js')),
|
|
39
|
+
CnSearchSelect: __sfc_main,
|
|
30
40
|
NcButton,
|
|
31
41
|
NcLoadingIcon,
|
|
32
42
|
NcTextField,
|
|
@@ -43,7 +53,16 @@ var script = {
|
|
|
43
53
|
* The relation: `schema` (child schema slug), `parentField` (the child
|
|
44
54
|
* property pointing at the parent) and optional `columns` (keys shown).
|
|
45
55
|
*
|
|
46
|
-
*
|
|
56
|
+
* Optional `computed`: read-only columns, each `{ key, label, formula,
|
|
57
|
+
* format?, currency?, decimals?, store? }`; `store` writes the value into
|
|
58
|
+
* the row when the row changes. Optional `totals`: rows under the table,
|
|
59
|
+
* each `{ key, label, sum? | formula?, format?, currency?, decimals?,
|
|
60
|
+
* emphasis? }`. Optional `addFrom`: `{ schema, register?, map,
|
|
61
|
+
* titleField?, secondaryField?, label?, codeField?, codeLabel?,
|
|
62
|
+
* freeRows? }`, where `map` names per row key the source key to copy
|
|
63
|
+
* (`@id` for the source's id).
|
|
64
|
+
*
|
|
65
|
+
* @type {{schema: string, parentField: string, columns?: string[], computed?: object[], totals?: object[], addFrom?: object}}
|
|
47
66
|
*/
|
|
48
67
|
config: {
|
|
49
68
|
type: Object,
|
|
@@ -115,6 +134,13 @@ var script = {
|
|
|
115
134
|
* @type {Array<{row: number, field: string, label: string}>}
|
|
116
135
|
*/
|
|
117
136
|
'validity',
|
|
137
|
+
/**
|
|
138
|
+
* The totals changed: the value per total key.
|
|
139
|
+
*
|
|
140
|
+
* @event totals
|
|
141
|
+
* @type {{[key: string]: number|null}}
|
|
142
|
+
*/
|
|
143
|
+
'totals',
|
|
118
144
|
],
|
|
119
145
|
|
|
120
146
|
data() {
|
|
@@ -123,6 +149,11 @@ var script = {
|
|
|
123
149
|
childSchema: null,
|
|
124
150
|
total: 0,
|
|
125
151
|
editing: null,
|
|
152
|
+
sourceOptions: [],
|
|
153
|
+
sourceLoading: false,
|
|
154
|
+
code: '',
|
|
155
|
+
addError: '',
|
|
156
|
+
status: '',
|
|
126
157
|
}
|
|
127
158
|
},
|
|
128
159
|
|
|
@@ -143,11 +174,59 @@ var script = {
|
|
|
143
174
|
}
|
|
144
175
|
keys = keys.slice(0, this.maxColumns);
|
|
145
176
|
}
|
|
146
|
-
|
|
177
|
+
const computedKeys = this.computedColumns.map((c) => c.key);
|
|
178
|
+
const plain = keys.filter((k) => k !== this.config.parentField && !computedKeys.includes(k)).map((key) => {
|
|
147
179
|
const type = props[key]?.type || 'string';
|
|
148
180
|
const inline = ['string', 'number', 'integer'].includes(type) && !props[key]?.enum && !props[key]?.$ref;
|
|
149
181
|
return { key, label: props[key]?.title || key, inline, numeric: type === 'number' || type === 'integer' }
|
|
150
|
-
})
|
|
182
|
+
});
|
|
183
|
+
const computed = this.computedColumns.map((c) => ({
|
|
184
|
+
key: c.key,
|
|
185
|
+
label: c.label || props[c.key]?.title || c.key,
|
|
186
|
+
computed: true,
|
|
187
|
+
format: normalizeMetricFormat(c) || { style: 'decimal', decimals: 2 },
|
|
188
|
+
}));
|
|
189
|
+
return [...plain, ...computed]
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
/** The computed columns as configured. */
|
|
193
|
+
computedColumns() {
|
|
194
|
+
return Array.isArray(this.config.computed) ? this.config.computed.filter((c) => c && c.key) : []
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
/** The totals per key. */
|
|
198
|
+
totals() {
|
|
199
|
+
return computeTotals(this.list, this.config.totals, this.computedColumns)
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
/** The total rows, each with its formatted text. */
|
|
203
|
+
totalRows() {
|
|
204
|
+
const totals = Array.isArray(this.config.totals) ? this.config.totals.filter((x) => x && x.key) : [];
|
|
205
|
+
return totals.map((x) => ({
|
|
206
|
+
key: x.key,
|
|
207
|
+
label: x.label || x.key,
|
|
208
|
+
emphasis: !!x.emphasis,
|
|
209
|
+
text: formatMetricValue(this.totals[x.key], normalizeMetricFormat(x) || { style: 'decimal', decimals: 2 }),
|
|
210
|
+
}))
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
/** The add-from source, or null. */
|
|
214
|
+
addFrom() {
|
|
215
|
+
const source = this.config.addFrom;
|
|
216
|
+
return source && typeof source === 'object' && source.schema ? source : null
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
/** Whether a free, empty row can be added. */
|
|
220
|
+
freeRows() {
|
|
221
|
+
return !this.addFrom || this.addFrom.freeRows !== false
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
addFromLabel() {
|
|
225
|
+
return this.addFrom?.label || translate('nextcloud-vue', 'Add from a list')
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
codeLabel() {
|
|
229
|
+
return this.addFrom?.codeLabel || translate('nextcloud-vue', 'Scan or type a code')
|
|
151
230
|
},
|
|
152
231
|
|
|
153
232
|
problems() {
|
|
@@ -178,6 +257,15 @@ var script = {
|
|
|
178
257
|
parentId() {
|
|
179
258
|
this.load();
|
|
180
259
|
},
|
|
260
|
+
|
|
261
|
+
totals: {
|
|
262
|
+
immediate: true,
|
|
263
|
+
handler(totals) {
|
|
264
|
+
if (Object.keys(totals).length > 0) {
|
|
265
|
+
this.$emit('totals', totals);
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
},
|
|
181
269
|
},
|
|
182
270
|
|
|
183
271
|
created() {
|
|
@@ -237,10 +325,127 @@ var script = {
|
|
|
237
325
|
* @param {string} value The typed value.
|
|
238
326
|
*/
|
|
239
327
|
setCell(index, col, value) {
|
|
240
|
-
const next = this.list.map((r, i) => (i === index ? { ...r, [col.key]: col.numeric && value !== '' ? Number(value) : value } : r));
|
|
328
|
+
const next = this.list.map((r, i) => (i === index ? this.withComputed({ ...r, [col.key]: col.numeric && value !== '' ? Number(value) : value }) : r));
|
|
241
329
|
this.$emit('update:modelValue', next);
|
|
242
330
|
},
|
|
243
331
|
|
|
332
|
+
/**
|
|
333
|
+
* The row with its stored computed columns written in.
|
|
334
|
+
*
|
|
335
|
+
* @param {object} row The row.
|
|
336
|
+
* @return {object} The row.
|
|
337
|
+
* @spec openspec/changes/child-records-totals/tasks.md#task-1
|
|
338
|
+
*/
|
|
339
|
+
withComputed(row) {
|
|
340
|
+
return storeComputed(row, this.computedColumns)
|
|
341
|
+
},
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* The text of a computed cell.
|
|
345
|
+
*
|
|
346
|
+
* @param {object} row The row.
|
|
347
|
+
* @param {{key: string, format: object}} col The computed column.
|
|
348
|
+
* @return {string} The text.
|
|
349
|
+
* @spec openspec/changes/child-records-totals/tasks.md#task-1
|
|
350
|
+
*/
|
|
351
|
+
computedText(row, col) {
|
|
352
|
+
return formatMetricValue(computeRow(row, this.computedColumns)[col.key], col.format)
|
|
353
|
+
},
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* The URL of the add-from source's objects.
|
|
357
|
+
*
|
|
358
|
+
* @param {URLSearchParams} params The query.
|
|
359
|
+
* @return {string} The URL.
|
|
360
|
+
* @spec openspec/changes/child-records-totals/tasks.md#task-3
|
|
361
|
+
*/
|
|
362
|
+
sourceUrl(params) {
|
|
363
|
+
const register = this.addFrom.register || this.register;
|
|
364
|
+
return generateUrl(`${this.apiBase}/objects/${register}/${this.addFrom.schema}?${params.toString()}`)
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Search the add-from source.
|
|
369
|
+
*
|
|
370
|
+
* @param {string} query The typed text.
|
|
371
|
+
* @spec openspec/changes/child-records-totals/tasks.md#task-3
|
|
372
|
+
*/
|
|
373
|
+
async searchSource(query) {
|
|
374
|
+
if (!query) {
|
|
375
|
+
this.sourceOptions = [];
|
|
376
|
+
return
|
|
377
|
+
}
|
|
378
|
+
this.sourceLoading = true;
|
|
379
|
+
try {
|
|
380
|
+
const response = await axios__default.get(this.sourceUrl(new URLSearchParams({ _search: query, _limit: '20' })));
|
|
381
|
+
const results = Array.isArray(response?.data?.results) ? response.data.results : [];
|
|
382
|
+
const titleField = this.addFrom.titleField || 'name';
|
|
383
|
+
this.sourceOptions = results.map((source) => ({
|
|
384
|
+
id: String(source.id ?? source.uuid),
|
|
385
|
+
label: String(source[titleField] ?? source.id ?? ''),
|
|
386
|
+
secondary: this.addFrom.secondaryField ? String(source[this.addFrom.secondaryField] ?? '') : '',
|
|
387
|
+
source,
|
|
388
|
+
}));
|
|
389
|
+
} catch {
|
|
390
|
+
this.sourceOptions = [];
|
|
391
|
+
}
|
|
392
|
+
this.sourceLoading = false;
|
|
393
|
+
},
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* A source record was picked: add a row from it.
|
|
397
|
+
*
|
|
398
|
+
* @param {string|null} id The picked option's id.
|
|
399
|
+
* @spec openspec/changes/child-records-totals/tasks.md#task-3
|
|
400
|
+
*/
|
|
401
|
+
addFromPicked(id) {
|
|
402
|
+
const option = this.sourceOptions.find((o) => o.id === id);
|
|
403
|
+
if (option) {
|
|
404
|
+
this.addSourceRow(option.source);
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Find the source record with the typed or scanned code and add a row from it.
|
|
410
|
+
*
|
|
411
|
+
* @spec openspec/changes/child-records-totals/tasks.md#task-3
|
|
412
|
+
*/
|
|
413
|
+
async addByCode() {
|
|
414
|
+
const code = String(this.code || '').trim();
|
|
415
|
+
if (code === '') {
|
|
416
|
+
return
|
|
417
|
+
}
|
|
418
|
+
this.addError = '';
|
|
419
|
+
try {
|
|
420
|
+
const response = await axios__default.get(this.sourceUrl(new URLSearchParams({ [this.addFrom.codeField]: code, _limit: '2' })));
|
|
421
|
+
const results = Array.isArray(response?.data?.results) ? response.data.results : [];
|
|
422
|
+
if (results.length === 1) {
|
|
423
|
+
this.addSourceRow(results[0]);
|
|
424
|
+
this.code = '';
|
|
425
|
+
} else if (results.length === 0) {
|
|
426
|
+
this.addError = translate('nextcloud-vue', 'No record has the code {code}.', { code });
|
|
427
|
+
} else {
|
|
428
|
+
this.addError = translate('nextcloud-vue', 'More than one record has the code {code}.', { code });
|
|
429
|
+
}
|
|
430
|
+
} catch {
|
|
431
|
+
this.addError = translate('nextcloud-vue', 'The code {code} could not be looked up.', { code });
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Append a row made from a source record.
|
|
437
|
+
*
|
|
438
|
+
* @param {object} source The source record.
|
|
439
|
+
* @spec openspec/changes/child-records-totals/tasks.md#task-3
|
|
440
|
+
*/
|
|
441
|
+
addSourceRow(source) {
|
|
442
|
+
this.addError = '';
|
|
443
|
+
const row = this.withComputed(rowFromSource(source, this.addFrom.map));
|
|
444
|
+
this.$emit('update:modelValue', [...this.list, row]);
|
|
445
|
+
const name = source?.[this.addFrom.titleField || 'name'] ?? '';
|
|
446
|
+
this.status = translate('nextcloud-vue', 'Added {name}.', { name: String(name) });
|
|
447
|
+
},
|
|
448
|
+
|
|
244
449
|
/** Append an empty row. */
|
|
245
450
|
addRow() {
|
|
246
451
|
this.$emit('update:modelValue', [...this.list, {}]);
|
|
@@ -262,7 +467,7 @@ var script = {
|
|
|
262
467
|
*/
|
|
263
468
|
onRowConfirm(values) {
|
|
264
469
|
const index = this.editing;
|
|
265
|
-
this.$emit('update:modelValue', this.list.map((r, i) => (i === index ? { ...r, ...values } : r)));
|
|
470
|
+
this.$emit('update:modelValue', this.list.map((r, i) => (i === index ? this.withComputed({ ...r, ...values }) : r)));
|
|
266
471
|
this.editing = null;
|
|
267
472
|
},
|
|
268
473
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnChildRecordsField.vue2.js","sources":["../../../../src/components/CnChildRecordsField/CnChildRecordsField.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-child-records-field\">\n\t\t<div class=\"cn-child-records-field__head\">\n\t\t\t<span class=\"cn-child-records-field__label\">{{ inputLabel }}</span>\n\t\t\t<NcButton\n\t\t\t\tv-if=\"!disabled\"\n\t\t\t\tdata-testid=\"cn-child-records-add\"\n\t\t\t\t@click=\"addRow\">\n\t\t\t\t{{ t('nextcloud-vue', 'Add row') }}\n\t\t\t</NcButton>\n\t\t</div>\n\t\t<NcLoadingIcon v-if=\"loading\" :name=\"t('nextcloud-vue', 'Loading …')\" />\n\t\t<table v-else class=\"cn-child-records-field__table\">\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th v-for=\"col in columns\" :key=\"col.key\" scope=\"col\">\n\t\t\t\t\t\t{{ col.label }}\n\t\t\t\t\t</th>\n\t\t\t\t\t<th v-if=\"!disabled\" scope=\"col\">\n\t\t\t\t\t\t<span class=\"cn-child-records-field__sr\">{{ t('nextcloud-vue', 'Row actions') }}</span>\n\t\t\t\t\t</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t\t<tr v-if=\"list.length === 0\">\n\t\t\t\t\t<td :colspan=\"columns.length + 1\" class=\"cn-child-records-field__empty\">\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'No rows yet.') }}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr v-for=\"(row, index) in list\" :key=\"index\" data-testid=\"cn-child-records-row\">\n\t\t\t\t\t<td v-for=\"col in columns\" :key=\"col.key\">\n\t\t\t\t\t\t<NcTextField\n\t\t\t\t\t\t\tv-if=\"col.inline && !disabled\"\n\t\t\t\t\t\t\t:modelValue=\"cellText(row, col)\"\n\t\t\t\t\t\t\t:label=\"`${col.label} ${index + 1}`\"\n\t\t\t\t\t\t\t:labelOutside=\"true\"\n\t\t\t\t\t\t\t:type=\"col.numeric ? 'number' : 'text'\"\n\t\t\t\t\t\t\t@update:modelValue=\"value => setCell(index, col, value)\" />\n\t\t\t\t\t\t<span v-else>{{ cellText(row, col) }}</span>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td v-if=\"!disabled\" class=\"cn-child-records-field__actions\">\n\t\t\t\t\t\t<NcButton variant=\"tertiary\" :aria-label=\"t('nextcloud-vue', 'Edit row {n}', { n: index + 1 })\" @click=\"editing = index\">\n\t\t\t\t\t\t\t{{ t('nextcloud-vue', 'Edit') }}\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t\t<NcButton variant=\"tertiary\"\n\t\t\t\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Remove row {n}', { n: index + 1 })\"\n\t\t\t\t\t\t\tdata-testid=\"cn-child-records-remove\"\n\t\t\t\t\t\t\t@click=\"removeRow(index)\">\n\t\t\t\t\t\t\t{{ t('nextcloud-vue', 'Remove') }}\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</tbody>\n\t\t</table>\n\t\t<p v-if=\"total > list.length\" class=\"cn-child-records-field__more\" data-testid=\"cn-child-records-more\">\n\t\t\t<template v-if=\"listUrl\">\n\t\t\t\t<a :href=\"listUrl\">{{ moreLabel }}</a>\n\t\t\t</template>\n\t\t\t<template v-else>\n\t\t\t\t{{ moreLabel }}\n\t\t\t</template>\n\t\t</p>\n\t\t<p v-if=\"error || problemText\" class=\"cn-child-records-field__error\" role=\"alert\">\n\t\t\t{{ error || problemText }}\n\t\t</p>\n\t\t<CnFormDialog\n\t\t\tv-if=\"editing !== null && childSchema\"\n\t\t\t:schema=\"childSchema\"\n\t\t\t:item=\"list[editing]\"\n\t\t\t:excludeFields=\"[config.parentField]\"\n\t\t\t:dialogTitle=\"t('nextcloud-vue', 'Edit row {n}', { n: editing + 1 })\"\n\t\t\t:recoverDraft=\"false\"\n\t\t\t@confirm=\"onRowConfirm\"\n\t\t\t@close=\"editing = null\" />\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcLoadingIcon, NcTextField } from '@nextcloud/vue'\nimport { defineAsyncComponent } from 'vue'\nimport { describeRowProblem, useChildRecords, validateChildRows } from '../../composables/useChildRecords.js'\n\n/**\n * CnChildRecordsField — edits the records of another schema that point at this\n * one, as a table inside the parent form (`child-records` form widget).\n *\n * Add row, inline editing of the columns shown, an Edit dialog for the other\n * fields, and Remove. On an existing parent it loads the first 50 children\n * (those whose `parentField` names the parent) and links to the list for the\n * rest. The rows are the v-model; the parent form saves them as their own\n * objects after the parent is saved (see `useChildRecords`), never nested in\n * the parent's payload. Each row is checked against the child schema's\n * required properties and the field reports the problems through `validity`.\n *\n * ```vue\n * <CnChildRecordsField v-model=\"lines\" register=\"shop\" :config=\"{ schema: 'order-line', parentField: 'order' }\" parentId=\"o-1\" />\n * ```\n */\nexport default {\n\tname: 'CnChildRecordsField',\n\n\tcomponents: {\n\t\t// Lazy: CnFormDialog renders this field, so a static import is a cycle.\n\t\tCnFormDialog: defineAsyncComponent(() => import('../CnFormDialog/CnFormDialog.vue')),\n\t\tNcButton,\n\t\tNcLoadingIcon,\n\t\tNcTextField,\n\t},\n\n\tprops: {\n\t\t/** The rows (v-model). Each saved row carries its `id`. */\n\t\tmodelValue: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/**\n\t\t * The relation: `schema` (child schema slug), `parentField` (the child\n\t\t * property pointing at the parent) and optional `columns` (keys shown).\n\t\t *\n\t\t * @type {{schema: string, parentField: string, columns?: string[]}}\n\t\t */\n\t\tconfig: {\n\t\t\ttype: Object,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** Register slug the child schema lives in. */\n\t\tregister: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Id of the parent being edited; empty when creating (no children to load). */\n\t\tparentId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Visible label of the table. */\n\t\tinputLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Hide the editing controls. */\n\t\tdisabled: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Validation message shown under the table. */\n\t\terror: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Base URL of the OpenRegister API. */\n\t\tapiBase: {\n\t\t\ttype: String,\n\t\t\tdefault: '/apps/openregister/api',\n\t\t},\n\n\t\t/** Most columns shown in the table. */\n\t\tmaxColumns: {\n\t\t\ttype: Number,\n\t\t\tdefault: 4,\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * The rows changed (v-model).\n\t\t *\n\t\t * @event update:modelValue\n\t\t * @type {object[]}\n\t\t */\n\t\t'update:modelValue',\n\t\t/**\n\t\t * The children as loaded from the server, so the form can tell what changed on save.\n\t\t *\n\t\t * @event loaded\n\t\t * @type {object[]}\n\t\t */\n\t\t'loaded',\n\t\t/**\n\t\t * The current row problems (empty when every row is valid).\n\t\t *\n\t\t * @event validity\n\t\t * @type {Array<{row: number, field: string, label: string}>}\n\t\t */\n\t\t'validity',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\tloading: false,\n\t\t\tchildSchema: null,\n\t\t\ttotal: 0,\n\t\t\tediting: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tlist() {\n\t\t\treturn Array.isArray(this.modelValue) ? this.modelValue : []\n\t\t},\n\n\t\t/** The columns: the configured keys, else the child schema's first required properties. */\n\t\tcolumns() {\n\t\t\tconst props = this.childSchema?.properties || {}\n\t\t\tlet keys = Array.isArray(this.config.columns) ? [...this.config.columns] : []\n\t\t\tif (keys.length === 0) {\n\t\t\t\tconst required = Array.isArray(this.childSchema?.required) ? this.childSchema.required : []\n\t\t\t\tkeys = required.filter((k) => k !== this.config.parentField)\n\t\t\t\tif (keys.length === 0) {\n\t\t\t\t\tkeys = Object.keys(props).filter((k) => k !== this.config.parentField)\n\t\t\t\t}\n\t\t\t\tkeys = keys.slice(0, this.maxColumns)\n\t\t\t}\n\t\t\treturn keys.filter((k) => k !== this.config.parentField).map((key) => {\n\t\t\t\tconst type = props[key]?.type || 'string'\n\t\t\t\tconst inline = ['string', 'number', 'integer'].includes(type) && !props[key]?.enum && !props[key]?.$ref\n\t\t\t\treturn { key, label: props[key]?.title || key, inline, numeric: type === 'number' || type === 'integer' }\n\t\t\t})\n\t\t},\n\n\t\tproblems() {\n\t\t\treturn validateChildRows(this.list, this.childSchema, this.config.parentField)\n\t\t},\n\n\t\tproblemText() {\n\t\t\treturn describeRowProblem(this.problems)\n\t\t},\n\n\t\tmoreLabel() {\n\t\t\treturn t('nextcloud-vue', 'Showing {shown} of {total} rows. Edit the rest on the list page.', { shown: this.list.length, total: this.total })\n\t\t},\n\n\t\tlistUrl() {\n\t\t\treturn this.config.listUrl || ''\n\t\t},\n\t},\n\n\twatch: {\n\t\tproblems: {\n\t\t\timmediate: true,\n\t\t\thandler(problems) {\n\t\t\t\tthis.$emit('validity', problems)\n\t\t\t},\n\t\t},\n\n\t\tparentId() {\n\t\t\tthis.load()\n\t\t},\n\t},\n\n\tcreated() {\n\t\tthis.load()\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/** Load the child schema and, for an existing parent, its children. */\n\t\tasync load() {\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(generateUrl(`${this.apiBase}/schemas/${encodeURIComponent(this.config.schema)}`))\n\t\t\t\tthis.childSchema = response?.data || null\n\t\t\t} catch {\n\t\t\t\tthis.childSchema = null\n\t\t\t}\n\t\t\tif (this.parentId !== '' && this.parentId !== null && this.parentId !== undefined) {\n\t\t\t\ttry {\n\t\t\t\t\tconst { rows, total } = await useChildRecords({ apiBase: this.apiBase }).load({\n\t\t\t\t\t\tregister: this.register,\n\t\t\t\t\t\tschema: this.config.schema,\n\t\t\t\t\t\tparentField: this.config.parentField,\n\t\t\t\t\t\tparentId: this.parentId,\n\t\t\t\t\t})\n\t\t\t\t\tthis.total = total\n\t\t\t\t\tthis.$emit('loaded', rows.map((r) => ({ ...r })))\n\t\t\t\t\tthis.$emit('update:modelValue', rows)\n\t\t\t\t} catch {\n\t\t\t\t\tthis.total = 0\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.loading = false\n\t\t},\n\n\t\t/**\n\t\t * The text of a cell.\n\t\t *\n\t\t * @param {object} row The row.\n\t\t * @param {{key: string}} col The column.\n\t\t * @return {string} The text.\n\t\t */\n\t\tcellText(row, col) {\n\t\t\tconst value = row?.[col.key]\n\t\t\tif (value === undefined || value === null) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn typeof value === 'object' ? JSON.stringify(value) : String(value)\n\t\t},\n\n\t\t/**\n\t\t * Write one cell.\n\t\t *\n\t\t * @param {number} index The row index.\n\t\t * @param {{key: string, numeric: boolean}} col The column.\n\t\t * @param {string} value The typed value.\n\t\t */\n\t\tsetCell(index, col, value) {\n\t\t\tconst next = this.list.map((r, i) => (i === index ? { ...r, [col.key]: col.numeric && value !== '' ? Number(value) : value } : r))\n\t\t\tthis.$emit('update:modelValue', next)\n\t\t},\n\n\t\t/** Append an empty row. */\n\t\taddRow() {\n\t\t\tthis.$emit('update:modelValue', [...this.list, {}])\n\t\t},\n\n\t\t/**\n\t\t * Remove a row.\n\t\t *\n\t\t * @param {number} index The row index.\n\t\t */\n\t\tremoveRow(index) {\n\t\t\tthis.$emit('update:modelValue', this.list.filter((_, i) => i !== index))\n\t\t},\n\n\t\t/**\n\t\t * The row dialog was confirmed: take its values.\n\t\t *\n\t\t * @param {object} values The row values.\n\t\t */\n\t\tonRowConfirm(values) {\n\t\t\tconst index = this.editing\n\t\t\tthis.$emit('update:modelValue', this.list.map((r, i) => (i === index ? { ...r, ...values } : r)))\n\t\t\tthis.editing = null\n\t\t},\n\t},\n}\n\n</script>\n\n<style scoped>\n.cn-child-records-field__head {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tmargin-bottom: 8px;\n}\n\n.cn-child-records-field__label {\n\tfont-weight: 600;\n}\n\n.cn-child-records-field__table {\n\twidth: 100%;\n\tborder-collapse: collapse;\n}\n\n.cn-child-records-field__table th,\n.cn-child-records-field__table td {\n\tpadding: 4px 8px;\n\ttext-align: start;\n\tborder-bottom: 1px solid var(--color-border);\n}\n\n.cn-child-records-field__empty,\n.cn-child-records-field__more {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-child-records-field__actions {\n\twhite-space: nowrap;\n}\n\n.cn-child-records-field__error {\n\tcolor: var(--color-error);\n\tmargin: 8px 0 0;\n}\n\n.cn-child-records-field__sr {\n\tposition: absolute;\n\twidth: 1px;\n\theight: 1px;\n\toverflow: hidden;\n\tclip-path: inset(50%);\n}\n</style>\n"],"names":["t","axios"],"mappings":";;;;;;;AAyFA;AACC;;AAEA;;;AAGA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAED,aAAe;CACd,IAAI,EAAE,qBAAqB;;CAE3B,UAAU,EAAE;;AAEX,EAAA,YAAY,EAAE,oBAAoB,CAAC,MAAM,OAAO,qCAAkC,CAAC,CAAC;AACpF,EAAA,QAAQ;EACR,aAAa;EACb,WAAW;EACX;;AAED,CAAA,KAAK,EAAE;;EAEN,UAAU,EAAE;GACX,IAAI,EAAE,KAAK;AACX,GAAA,OAAO,EAAE,MAAM,EAAE;GACjB;;AAED;;;AAGC;;;AAGD,EAAA,MAAM,EAAE;GACP,IAAI,EAAE,MAAM;GACZ,QAAQ,EAAE,IAAI;GACd;;AAED;AACA,EAAA,QAAQ,EAAE;GACT,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,EAAE;GACX;;AAED;AACA,EAAA,QAAQ,EAAE;AACT,GAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;GACtB,OAAO,EAAE,EAAE;GACX;;;EAGD,UAAU,EAAE;GACX,IAAI,EAA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AE,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,OAAQ,IAAG,KAAM,KAAI,EAAG,GAAE,MAAM,CAAC,KAAK,CAAA,GAAI,KAAM,EAAA,GAAI,CAAC,CAAC,EAAA;AACjI,GAAA,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,IAAI,EAAA;GACpC;;AAED;AACA,EAAA,MAAM,GAAG;GACR,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,EAAA;GAClD;;AAED;;AAEC;AACA;;AAED,EAAA,SAAS,CAAC,KAAK,EAAE;AAChB,GAAA,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAE,KAAI,KAAK,CAAC,EAAA;GACvE;;AAED;AACC;AACA;AACA;;AAED,EAAA,YAAY,CAAC,MAAM,EAAE;GACpB,MAAM,KAAM,GAAE,IAAI,CAAC,QAAM;AACzB,GAAA,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,MAAM,KAAI,GAAI,EAAE,GAAG,CAAC,EAAE,GAAG,MAAK,KAAM,CAAC,CAAC,CAAC,EAAA;AAChG,GAAA,IAAI,CAAC,OAAM,GAAI,KAAG;GAClB;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnChildRecordsField.vue2.js","sources":["../../../../src/components/CnChildRecordsField/CnChildRecordsField.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-child-records-field\">\n\t\t<div class=\"cn-child-records-field__head\">\n\t\t\t<span class=\"cn-child-records-field__label\">{{ inputLabel }}</span>\n\t\t\t<div v-if=\"!disabled\" class=\"cn-child-records-field__adds\">\n\t\t\t\t<CnSearchSelect\n\t\t\t\t\tv-if=\"addFrom\"\n\t\t\t\t\tclass=\"cn-child-records-field__pick\"\n\t\t\t\t\tdata-testid=\"cn-child-records-add-from\"\n\t\t\t\t\t:modelValue=\"null\"\n\t\t\t\t\t:options=\"sourceOptions\"\n\t\t\t\t\t:loading=\"sourceLoading\"\n\t\t\t\t\t:inputLabel=\"addFromLabel\"\n\t\t\t\t\t:filterable=\"false\"\n\t\t\t\t\t@search=\"searchSource\"\n\t\t\t\t\t@update:modelValue=\"addFromPicked\" />\n\t\t\t\t<form\n\t\t\t\t\tv-if=\"addFrom && addFrom.codeField\"\n\t\t\t\t\tclass=\"cn-child-records-field__code\"\n\t\t\t\t\tdata-testid=\"cn-child-records-code\"\n\t\t\t\t\t@submit.prevent=\"addByCode\">\n\t\t\t\t\t<NcTextField\n\t\t\t\t\t\t:modelValue=\"code\"\n\t\t\t\t\t\t:label=\"codeLabel\"\n\t\t\t\t\t\t@update:modelValue=\"value => { code = value }\" />\n\t\t\t\t\t<NcButton type=\"submit\" data-testid=\"cn-child-records-code-add\">\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'Add') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</form>\n\t\t\t\t<NcButton\n\t\t\t\t\tv-if=\"freeRows\"\n\t\t\t\t\tdata-testid=\"cn-child-records-add\"\n\t\t\t\t\t@click=\"addRow\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Add row') }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t</div>\n\t\t<NcLoadingIcon v-if=\"loading\" :name=\"t('nextcloud-vue', 'Loading …')\" />\n\t\t<table v-else class=\"cn-child-records-field__table\">\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th v-for=\"col in columns\"\n\t\t\t\t\t\t:key=\"col.key\"\n\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t:class=\"{ 'cn-child-records-field__num': col.numeric || col.computed }\">\n\t\t\t\t\t\t{{ col.label }}\n\t\t\t\t\t</th>\n\t\t\t\t\t<th v-if=\"!disabled\" scope=\"col\">\n\t\t\t\t\t\t<span class=\"cn-child-records-field__sr\">{{ t('nextcloud-vue', 'Row actions') }}</span>\n\t\t\t\t\t</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t\t<tr v-if=\"list.length === 0\">\n\t\t\t\t\t<td :colspan=\"columns.length + 1\" class=\"cn-child-records-field__empty\">\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'No rows yet.') }}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr v-for=\"(row, index) in list\" :key=\"index\" data-testid=\"cn-child-records-row\">\n\t\t\t\t\t<td v-for=\"col in columns\" :key=\"col.key\" :class=\"{ 'cn-child-records-field__num': col.numeric || col.computed }\">\n\t\t\t\t\t\t<span v-if=\"col.computed\" data-testid=\"cn-child-records-computed\">{{ computedText(row, col) }}</span>\n\t\t\t\t\t\t<NcTextField\n\t\t\t\t\t\t\tv-else-if=\"col.inline && !disabled\"\n\t\t\t\t\t\t\t:modelValue=\"cellText(row, col)\"\n\t\t\t\t\t\t\t:label=\"`${col.label} ${index + 1}`\"\n\t\t\t\t\t\t\t:labelOutside=\"true\"\n\t\t\t\t\t\t\t:type=\"col.numeric ? 'number' : 'text'\"\n\t\t\t\t\t\t\t@update:modelValue=\"value => setCell(index, col, value)\" />\n\t\t\t\t\t\t<span v-else>{{ cellText(row, col) }}</span>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td v-if=\"!disabled\" class=\"cn-child-records-field__actions\">\n\t\t\t\t\t\t<NcButton variant=\"tertiary\" :aria-label=\"t('nextcloud-vue', 'Edit row {n}', { n: index + 1 })\" @click=\"editing = index\">\n\t\t\t\t\t\t\t{{ t('nextcloud-vue', 'Edit') }}\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t\t<NcButton variant=\"tertiary\"\n\t\t\t\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Remove row {n}', { n: index + 1 })\"\n\t\t\t\t\t\t\tdata-testid=\"cn-child-records-remove\"\n\t\t\t\t\t\t\t@click=\"removeRow(index)\">\n\t\t\t\t\t\t\t{{ t('nextcloud-vue', 'Remove') }}\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</tbody>\n\t\t\t<tfoot v-if=\"totalRows.length > 0\">\n\t\t\t\t<tr v-for=\"totalRow in totalRows\"\n\t\t\t\t\t:key=\"totalRow.key\"\n\t\t\t\t\t:class=\"{ 'cn-child-records-field__total--emphasis': totalRow.emphasis }\"\n\t\t\t\t\tdata-testid=\"cn-child-records-total\">\n\t\t\t\t\t<th scope=\"row\" :colspan=\"Math.max(1, columns.length - 1)\" class=\"cn-child-records-field__total-label\">\n\t\t\t\t\t\t{{ totalRow.label }}\n\t\t\t\t\t</th>\n\t\t\t\t\t<td class=\"cn-child-records-field__num\" data-testid=\"cn-child-records-total-value\">\n\t\t\t\t\t\t{{ totalRow.text }}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td v-if=\"!disabled\" />\n\t\t\t\t</tr>\n\t\t\t</tfoot>\n\t\t</table>\n\t\t<p class=\"cn-child-records-field__sr\" aria-live=\"polite\" data-testid=\"cn-child-records-status\">\n\t\t\t{{ status }}\n\t\t</p>\n\t\t<p v-if=\"total > list.length\" class=\"cn-child-records-field__more\" data-testid=\"cn-child-records-more\">\n\t\t\t<template v-if=\"listUrl\">\n\t\t\t\t<a :href=\"listUrl\">{{ moreLabel }}</a>\n\t\t\t</template>\n\t\t\t<template v-else>\n\t\t\t\t{{ moreLabel }}\n\t\t\t</template>\n\t\t</p>\n\t\t<p v-if=\"error || problemText || addError\" class=\"cn-child-records-field__error\" role=\"alert\">\n\t\t\t{{ error || problemText || addError }}\n\t\t</p>\n\t\t<CnFormDialog\n\t\t\tv-if=\"editing !== null && childSchema\"\n\t\t\t:schema=\"childSchema\"\n\t\t\t:item=\"list[editing]\"\n\t\t\t:excludeFields=\"[config.parentField]\"\n\t\t\t:dialogTitle=\"t('nextcloud-vue', 'Edit row {n}', { n: editing + 1 })\"\n\t\t\t:recoverDraft=\"false\"\n\t\t\t@confirm=\"onRowConfirm\"\n\t\t\t@close=\"editing = null\" />\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcLoadingIcon, NcTextField } from '@nextcloud/vue'\nimport { defineAsyncComponent } from 'vue'\nimport CnSearchSelect from '../CnSearchSelect/CnSearchSelect.vue'\nimport { describeRowProblem, useChildRecords, validateChildRows } from '../../composables/useChildRecords.js'\nimport { computeRow, computeTotals, rowFromSource, storeComputed } from '../../utils/childRecordTotals.js'\nimport { formatMetricValue, normalizeMetricFormat } from '../../utils/formatMetric.js'\n\n/**\n * CnChildRecordsField — edits the records of another schema that point at this\n * one, as a table inside the parent form (`child-records` form widget).\n *\n * Add row, inline editing of the columns shown, an Edit dialog for the other\n * fields, and Remove. On an existing parent it loads the first 50 children\n * (those whose `parentField` names the parent) and links to the list for the\n * rest. The rows are the v-model; the parent form saves them as their own\n * objects after the parent is saved (see `useChildRecords`), never nested in\n * the parent's payload. Each row is checked against the child schema's\n * required properties and the field reports the problems through `validity`.\n *\n * `config.computed` adds read-only columns worked out per row from a formula,\n * `config.totals` adds total rows under the table (a sum over the rows, or a\n * formula over the totals before it), and `config.addFrom` adds rows from\n * another schema's records: picked from a search, or found by a typed or\n * scanned code.\n *\n * ```vue\n * <CnChildRecordsField v-model=\"lines\" register=\"shop\" :config=\"{ schema: 'order-line', parentField: 'order' }\" parentId=\"o-1\" />\n * ```\n */\nexport default {\n\tname: 'CnChildRecordsField',\n\n\tcomponents: {\n\t\t// Lazy: CnFormDialog renders this field, so a static import is a cycle.\n\t\tCnFormDialog: defineAsyncComponent(() => import('../CnFormDialog/CnFormDialog.vue')),\n\t\tCnSearchSelect,\n\t\tNcButton,\n\t\tNcLoadingIcon,\n\t\tNcTextField,\n\t},\n\n\tprops: {\n\t\t/** The rows (v-model). Each saved row carries its `id`. */\n\t\tmodelValue: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/**\n\t\t * The relation: `schema` (child schema slug), `parentField` (the child\n\t\t * property pointing at the parent) and optional `columns` (keys shown).\n\t\t *\n\t\t * Optional `computed`: read-only columns, each `{ key, label, formula,\n\t\t * format?, currency?, decimals?, store? }`; `store` writes the value into\n\t\t * the row when the row changes. Optional `totals`: rows under the table,\n\t\t * each `{ key, label, sum? | formula?, format?, currency?, decimals?,\n\t\t * emphasis? }`. Optional `addFrom`: `{ schema, register?, map,\n\t\t * titleField?, secondaryField?, label?, codeField?, codeLabel?,\n\t\t * freeRows? }`, where `map` names per row key the source key to copy\n\t\t * (`@id` for the source's id).\n\t\t *\n\t\t * @type {{schema: string, parentField: string, columns?: string[], computed?: object[], totals?: object[], addFrom?: object}}\n\t\t */\n\t\tconfig: {\n\t\t\ttype: Object,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** Register slug the child schema lives in. */\n\t\tregister: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Id of the parent being edited; empty when creating (no children to load). */\n\t\tparentId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Visible label of the table. */\n\t\tinputLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Hide the editing controls. */\n\t\tdisabled: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Validation message shown under the table. */\n\t\terror: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Base URL of the OpenRegister API. */\n\t\tapiBase: {\n\t\t\ttype: String,\n\t\t\tdefault: '/apps/openregister/api',\n\t\t},\n\n\t\t/** Most columns shown in the table. */\n\t\tmaxColumns: {\n\t\t\ttype: Number,\n\t\t\tdefault: 4,\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * The rows changed (v-model).\n\t\t *\n\t\t * @event update:modelValue\n\t\t * @type {object[]}\n\t\t */\n\t\t'update:modelValue',\n\t\t/**\n\t\t * The children as loaded from the server, so the form can tell what changed on save.\n\t\t *\n\t\t * @event loaded\n\t\t * @type {object[]}\n\t\t */\n\t\t'loaded',\n\t\t/**\n\t\t * The current row problems (empty when every row is valid).\n\t\t *\n\t\t * @event validity\n\t\t * @type {Array<{row: number, field: string, label: string}>}\n\t\t */\n\t\t'validity',\n\t\t/**\n\t\t * The totals changed: the value per total key.\n\t\t *\n\t\t * @event totals\n\t\t * @type {{[key: string]: number|null}}\n\t\t */\n\t\t'totals',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\tloading: false,\n\t\t\tchildSchema: null,\n\t\t\ttotal: 0,\n\t\t\tediting: null,\n\t\t\tsourceOptions: [],\n\t\t\tsourceLoading: false,\n\t\t\tcode: '',\n\t\t\taddError: '',\n\t\t\tstatus: '',\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tlist() {\n\t\t\treturn Array.isArray(this.modelValue) ? this.modelValue : []\n\t\t},\n\n\t\t/** The columns: the configured keys, else the child schema's first required properties. */\n\t\tcolumns() {\n\t\t\tconst props = this.childSchema?.properties || {}\n\t\t\tlet keys = Array.isArray(this.config.columns) ? [...this.config.columns] : []\n\t\t\tif (keys.length === 0) {\n\t\t\t\tconst required = Array.isArray(this.childSchema?.required) ? this.childSchema.required : []\n\t\t\t\tkeys = required.filter((k) => k !== this.config.parentField)\n\t\t\t\tif (keys.length === 0) {\n\t\t\t\t\tkeys = Object.keys(props).filter((k) => k !== this.config.parentField)\n\t\t\t\t}\n\t\t\t\tkeys = keys.slice(0, this.maxColumns)\n\t\t\t}\n\t\t\tconst computedKeys = this.computedColumns.map((c) => c.key)\n\t\t\tconst plain = keys.filter((k) => k !== this.config.parentField && !computedKeys.includes(k)).map((key) => {\n\t\t\t\tconst type = props[key]?.type || 'string'\n\t\t\t\tconst inline = ['string', 'number', 'integer'].includes(type) && !props[key]?.enum && !props[key]?.$ref\n\t\t\t\treturn { key, label: props[key]?.title || key, inline, numeric: type === 'number' || type === 'integer' }\n\t\t\t})\n\t\t\tconst computed = this.computedColumns.map((c) => ({\n\t\t\t\tkey: c.key,\n\t\t\t\tlabel: c.label || props[c.key]?.title || c.key,\n\t\t\t\tcomputed: true,\n\t\t\t\tformat: normalizeMetricFormat(c) || { style: 'decimal', decimals: 2 },\n\t\t\t}))\n\t\t\treturn [...plain, ...computed]\n\t\t},\n\n\t\t/** The computed columns as configured. */\n\t\tcomputedColumns() {\n\t\t\treturn Array.isArray(this.config.computed) ? this.config.computed.filter((c) => c && c.key) : []\n\t\t},\n\n\t\t/** The totals per key. */\n\t\ttotals() {\n\t\t\treturn computeTotals(this.list, this.config.totals, this.computedColumns)\n\t\t},\n\n\t\t/** The total rows, each with its formatted text. */\n\t\ttotalRows() {\n\t\t\tconst totals = Array.isArray(this.config.totals) ? this.config.totals.filter((x) => x && x.key) : []\n\t\t\treturn totals.map((x) => ({\n\t\t\t\tkey: x.key,\n\t\t\t\tlabel: x.label || x.key,\n\t\t\t\temphasis: !!x.emphasis,\n\t\t\t\ttext: formatMetricValue(this.totals[x.key], normalizeMetricFormat(x) || { style: 'decimal', decimals: 2 }),\n\t\t\t}))\n\t\t},\n\n\t\t/** The add-from source, or null. */\n\t\taddFrom() {\n\t\t\tconst source = this.config.addFrom\n\t\t\treturn source && typeof source === 'object' && source.schema ? source : null\n\t\t},\n\n\t\t/** Whether a free, empty row can be added. */\n\t\tfreeRows() {\n\t\t\treturn !this.addFrom || this.addFrom.freeRows !== false\n\t\t},\n\n\t\taddFromLabel() {\n\t\t\treturn this.addFrom?.label || t('nextcloud-vue', 'Add from a list')\n\t\t},\n\n\t\tcodeLabel() {\n\t\t\treturn this.addFrom?.codeLabel || t('nextcloud-vue', 'Scan or type a code')\n\t\t},\n\n\t\tproblems() {\n\t\t\treturn validateChildRows(this.list, this.childSchema, this.config.parentField)\n\t\t},\n\n\t\tproblemText() {\n\t\t\treturn describeRowProblem(this.problems)\n\t\t},\n\n\t\tmoreLabel() {\n\t\t\treturn t('nextcloud-vue', 'Showing {shown} of {total} rows. Edit the rest on the list page.', { shown: this.list.length, total: this.total })\n\t\t},\n\n\t\tlistUrl() {\n\t\t\treturn this.config.listUrl || ''\n\t\t},\n\t},\n\n\twatch: {\n\t\tproblems: {\n\t\t\timmediate: true,\n\t\t\thandler(problems) {\n\t\t\t\tthis.$emit('validity', problems)\n\t\t\t},\n\t\t},\n\n\t\tparentId() {\n\t\t\tthis.load()\n\t\t},\n\n\t\ttotals: {\n\t\t\timmediate: true,\n\t\t\thandler(totals) {\n\t\t\t\tif (Object.keys(totals).length > 0) {\n\t\t\t\t\tthis.$emit('totals', totals)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tcreated() {\n\t\tthis.load()\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/** Load the child schema and, for an existing parent, its children. */\n\t\tasync load() {\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(generateUrl(`${this.apiBase}/schemas/${encodeURIComponent(this.config.schema)}`))\n\t\t\t\tthis.childSchema = response?.data || null\n\t\t\t} catch {\n\t\t\t\tthis.childSchema = null\n\t\t\t}\n\t\t\tif (this.parentId !== '' && this.parentId !== null && this.parentId !== undefined) {\n\t\t\t\ttry {\n\t\t\t\t\tconst { rows, total } = await useChildRecords({ apiBase: this.apiBase }).load({\n\t\t\t\t\t\tregister: this.register,\n\t\t\t\t\t\tschema: this.config.schema,\n\t\t\t\t\t\tparentField: this.config.parentField,\n\t\t\t\t\t\tparentId: this.parentId,\n\t\t\t\t\t})\n\t\t\t\t\tthis.total = total\n\t\t\t\t\tthis.$emit('loaded', rows.map((r) => ({ ...r })))\n\t\t\t\t\tthis.$emit('update:modelValue', rows)\n\t\t\t\t} catch {\n\t\t\t\t\tthis.total = 0\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.loading = false\n\t\t},\n\n\t\t/**\n\t\t * The text of a cell.\n\t\t *\n\t\t * @param {object} row The row.\n\t\t * @param {{key: string}} col The column.\n\t\t * @return {string} The text.\n\t\t */\n\t\tcellText(row, col) {\n\t\t\tconst value = row?.[col.key]\n\t\t\tif (value === undefined || value === null) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn typeof value === 'object' ? JSON.stringify(value) : String(value)\n\t\t},\n\n\t\t/**\n\t\t * Write one cell.\n\t\t *\n\t\t * @param {number} index The row index.\n\t\t * @param {{key: string, numeric: boolean}} col The column.\n\t\t * @param {string} value The typed value.\n\t\t */\n\t\tsetCell(index, col, value) {\n\t\t\tconst next = this.list.map((r, i) => (i === index ? this.withComputed({ ...r, [col.key]: col.numeric && value !== '' ? Number(value) : value }) : r))\n\t\t\tthis.$emit('update:modelValue', next)\n\t\t},\n\n\t\t/**\n\t\t * The row with its stored computed columns written in.\n\t\t *\n\t\t * @param {object} row The row.\n\t\t * @return {object} The row.\n\t\t * @spec openspec/changes/child-records-totals/tasks.md#task-1\n\t\t */\n\t\twithComputed(row) {\n\t\t\treturn storeComputed(row, this.computedColumns)\n\t\t},\n\n\t\t/**\n\t\t * The text of a computed cell.\n\t\t *\n\t\t * @param {object} row The row.\n\t\t * @param {{key: string, format: object}} col The computed column.\n\t\t * @return {string} The text.\n\t\t * @spec openspec/changes/child-records-totals/tasks.md#task-1\n\t\t */\n\t\tcomputedText(row, col) {\n\t\t\treturn formatMetricValue(computeRow(row, this.computedColumns)[col.key], col.format)\n\t\t},\n\n\t\t/**\n\t\t * The URL of the add-from source's objects.\n\t\t *\n\t\t * @param {URLSearchParams} params The query.\n\t\t * @return {string} The URL.\n\t\t * @spec openspec/changes/child-records-totals/tasks.md#task-3\n\t\t */\n\t\tsourceUrl(params) {\n\t\t\tconst register = this.addFrom.register || this.register\n\t\t\treturn generateUrl(`${this.apiBase}/objects/${register}/${this.addFrom.schema}?${params.toString()}`)\n\t\t},\n\n\t\t/**\n\t\t * Search the add-from source.\n\t\t *\n\t\t * @param {string} query The typed text.\n\t\t * @spec openspec/changes/child-records-totals/tasks.md#task-3\n\t\t */\n\t\tasync searchSource(query) {\n\t\t\tif (!query) {\n\t\t\t\tthis.sourceOptions = []\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.sourceLoading = true\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(this.sourceUrl(new URLSearchParams({ _search: query, _limit: '20' })))\n\t\t\t\tconst results = Array.isArray(response?.data?.results) ? response.data.results : []\n\t\t\t\tconst titleField = this.addFrom.titleField || 'name'\n\t\t\t\tthis.sourceOptions = results.map((source) => ({\n\t\t\t\t\tid: String(source.id ?? source.uuid),\n\t\t\t\t\tlabel: String(source[titleField] ?? source.id ?? ''),\n\t\t\t\t\tsecondary: this.addFrom.secondaryField ? String(source[this.addFrom.secondaryField] ?? '') : '',\n\t\t\t\t\tsource,\n\t\t\t\t}))\n\t\t\t} catch {\n\t\t\t\tthis.sourceOptions = []\n\t\t\t}\n\t\t\tthis.sourceLoading = false\n\t\t},\n\n\t\t/**\n\t\t * A source record was picked: add a row from it.\n\t\t *\n\t\t * @param {string|null} id The picked option's id.\n\t\t * @spec openspec/changes/child-records-totals/tasks.md#task-3\n\t\t */\n\t\taddFromPicked(id) {\n\t\t\tconst option = this.sourceOptions.find((o) => o.id === id)\n\t\t\tif (option) {\n\t\t\t\tthis.addSourceRow(option.source)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Find the source record with the typed or scanned code and add a row from it.\n\t\t *\n\t\t * @spec openspec/changes/child-records-totals/tasks.md#task-3\n\t\t */\n\t\tasync addByCode() {\n\t\t\tconst code = String(this.code || '').trim()\n\t\t\tif (code === '') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.addError = ''\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(this.sourceUrl(new URLSearchParams({ [this.addFrom.codeField]: code, _limit: '2' })))\n\t\t\t\tconst results = Array.isArray(response?.data?.results) ? response.data.results : []\n\t\t\t\tif (results.length === 1) {\n\t\t\t\t\tthis.addSourceRow(results[0])\n\t\t\t\t\tthis.code = ''\n\t\t\t\t} else if (results.length === 0) {\n\t\t\t\t\tthis.addError = t('nextcloud-vue', 'No record has the code {code}.', { code })\n\t\t\t\t} else {\n\t\t\t\t\tthis.addError = t('nextcloud-vue', 'More than one record has the code {code}.', { code })\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\tthis.addError = t('nextcloud-vue', 'The code {code} could not be looked up.', { code })\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Append a row made from a source record.\n\t\t *\n\t\t * @param {object} source The source record.\n\t\t * @spec openspec/changes/child-records-totals/tasks.md#task-3\n\t\t */\n\t\taddSourceRow(source) {\n\t\t\tthis.addError = ''\n\t\t\tconst row = this.withComputed(rowFromSource(source, this.addFrom.map))\n\t\t\tthis.$emit('update:modelValue', [...this.list, row])\n\t\t\tconst name = source?.[this.addFrom.titleField || 'name'] ?? ''\n\t\t\tthis.status = t('nextcloud-vue', 'Added {name}.', { name: String(name) })\n\t\t},\n\n\t\t/** Append an empty row. */\n\t\taddRow() {\n\t\t\tthis.$emit('update:modelValue', [...this.list, {}])\n\t\t},\n\n\t\t/**\n\t\t * Remove a row.\n\t\t *\n\t\t * @param {number} index The row index.\n\t\t */\n\t\tremoveRow(index) {\n\t\t\tthis.$emit('update:modelValue', this.list.filter((_, i) => i !== index))\n\t\t},\n\n\t\t/**\n\t\t * The row dialog was confirmed: take its values.\n\t\t *\n\t\t * @param {object} values The row values.\n\t\t */\n\t\tonRowConfirm(values) {\n\t\t\tconst index = this.editing\n\t\t\tthis.$emit('update:modelValue', this.list.map((r, i) => (i === index ? this.withComputed({ ...r, ...values }) : r)))\n\t\t\tthis.editing = null\n\t\t},\n\t},\n}\n\n</script>\n\n<style scoped>\n.cn-child-records-field__head {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tmargin-bottom: 8px;\n}\n\n.cn-child-records-field__label {\n\tfont-weight: 600;\n}\n\n.cn-child-records-field__head {\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n\n.cn-child-records-field__adds,\n.cn-child-records-field__code {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: flex-end;\n\tgap: 8px;\n}\n\n.cn-child-records-field__pick {\n\tmin-width: 240px;\n}\n\n.cn-child-records-field__table th.cn-child-records-field__num,\n.cn-child-records-field__table td.cn-child-records-field__num {\n\ttext-align: end;\n\tfont-variant-numeric: tabular-nums;\n}\n\n.cn-child-records-field__table tfoot th,\n.cn-child-records-field__table tfoot td {\n\tborder-bottom: none;\n}\n\n.cn-child-records-field__table .cn-child-records-field__total-label {\n\ttext-align: end;\n\tfont-weight: normal;\n}\n\n.cn-child-records-field__total--emphasis th,\n.cn-child-records-field__total--emphasis td {\n\tfont-weight: 600;\n\tborder-top: 1px solid var(--color-border);\n}\n\n.cn-child-records-field__table {\n\twidth: 100%;\n\tborder-collapse: collapse;\n}\n\n.cn-child-records-field__table th,\n.cn-child-records-field__table td {\n\tpadding: 4px 8px;\n\ttext-align: start;\n\tborder-bottom: 1px solid var(--color-border);\n}\n\n.cn-child-records-field__empty,\n.cn-child-records-field__more {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-child-records-field__actions {\n\twhite-space: nowrap;\n}\n\n.cn-child-records-field__error {\n\tcolor: var(--color-error);\n\tmargin: 8px 0 0;\n}\n\n.cn-child-records-field__sr {\n\tposition: absolute;\n\twidth: 1px;\n\theight: 1px;\n\toverflow: hidden;\n\tclip-path: inset(50%);\n}\n</style>\n"],"names":["CnSearchSelect","t","axios"],"mappings":";;;;;;;;;;AA2IA;AACC;;AAEA;;;AAGA;;AAEA;;AAEA;AACA;AACA;;;;;AAKA;AACA;;AAEA;;AAED,aAAe;CACd,IAAI,EAAE,qBAAqB;;CAE3B,UAAU,EAAE;;AAEX,EAAA,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