@conduction/nextcloud-vue 2.170.0 → 2.172.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/dist/esm/components/CnActionDialog/CnActionDialog.vue.js +1 -1
  2. package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
  3. package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
  4. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
  5. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +22 -3
  6. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
  7. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
  8. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue.js +9 -0
  9. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue.js.map +1 -0
  10. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue2.js +242 -0
  11. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue2.js.map +1 -0
  12. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue3.js +200 -0
  13. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue3.js.map +1 -0
  14. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue.js +9 -0
  15. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue.js.map +1 -0
  16. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue2.js +186 -0
  17. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue2.js.map +1 -0
  18. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue3.js +24 -0
  19. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue3.js.map +1 -0
  20. package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue.js +1 -1
  21. package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue2.js +3 -15
  22. package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue2.js.map +1 -1
  23. package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue3.js +16 -61
  24. package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue3.js.map +1 -1
  25. package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue.js +9 -0
  26. package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue.js.map +1 -0
  27. package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue2.js +120 -0
  28. package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue2.js.map +1 -0
  29. package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue3.js +86 -0
  30. package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue3.js.map +1 -0
  31. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +1 -1
  32. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
  33. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js +9 -9
  34. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
  35. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue.js +1 -1
  36. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue2.js.map +1 -1
  37. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue3.js.map +1 -1
  38. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue.js +1 -1
  39. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js.map +1 -1
  40. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue3.js.map +1 -1
  41. package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue.js +1 -1
  42. package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js +75 -4
  43. package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js.map +1 -1
  44. package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue3.js.map +1 -1
  45. package/dist/esm/components/CnDialogActions/CnDialogActions.vue.js +8 -0
  46. package/dist/esm/components/CnDialogActions/CnDialogActions.vue.js.map +1 -0
  47. package/dist/esm/components/CnDialogActions/CnDialogActions.vue2.js +101 -0
  48. package/dist/esm/components/CnDialogActions/CnDialogActions.vue2.js.map +1 -0
  49. package/dist/esm/components/CnDialogActions/CnDialogActions.vue3.js +54 -0
  50. package/dist/esm/components/CnDialogActions/CnDialogActions.vue3.js.map +1 -0
  51. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
  52. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +7 -3
  53. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
  54. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
  55. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue.js +1 -1
  56. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +14 -2
  57. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
  58. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js +1 -1
  59. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
  60. package/dist/esm/components/CnFilesBrowser/filesBrowser.js +21 -2
  61. package/dist/esm/components/CnFilesBrowser/filesBrowser.js.map +1 -1
  62. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue.js +1 -1
  63. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js +7 -0
  64. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js.map +1 -1
  65. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js +2 -2
  66. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js.map +1 -1
  67. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js +11 -0
  68. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js.map +1 -1
  69. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js +2 -1
  70. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js.map +1 -1
  71. package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue.js +1 -1
  72. package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue2.js.map +1 -1
  73. package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue3.js.map +1 -1
  74. package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue.js +9 -0
  75. package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue.js.map +1 -0
  76. package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue2.js +248 -0
  77. package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue2.js.map +1 -0
  78. package/dist/esm/components/{CnMassDeleteDialog/CnMassDeleteDialog.vue3.js → CnMassActionDialog/CnMassActionDialog.vue3.js} +66 -52
  79. package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue3.js.map +1 -0
  80. package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue.js +0 -3
  81. package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue.js.map +1 -1
  82. package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue2.js +25 -121
  83. package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue2.js.map +1 -1
  84. package/dist/esm/components/CnNotesCard/CnNotesCard.vue.js +1 -1
  85. package/dist/esm/components/CnNotesCard/CnNotesCard.vue2.js +11 -3
  86. package/dist/esm/components/CnNotesCard/CnNotesCard.vue2.js.map +1 -1
  87. package/dist/esm/components/CnNotesCard/CnNotesCard.vue3.js +1 -1
  88. package/dist/esm/components/CnNotesCard/CnNotesCard.vue3.js.map +1 -1
  89. package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue.js +1 -1
  90. package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js +21 -1
  91. package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js.map +1 -1
  92. package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js +2 -2
  93. package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js.map +1 -1
  94. package/dist/esm/components/CnTreeView/CnTreeNode.vue.js +1 -1
  95. package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js.map +1 -1
  96. package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js +23 -5
  97. package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js.map +1 -1
  98. package/dist/esm/components/CnTreeView/CnTreeView.vue.js +1 -1
  99. package/dist/esm/components/CnTreeView/CnTreeView.vue2.js +3 -0
  100. package/dist/esm/components/CnTreeView/CnTreeView.vue2.js.map +1 -1
  101. package/dist/esm/components/CnTreeView/CnTreeView.vue3.js +14 -4
  102. package/dist/esm/components/CnTreeView/CnTreeView.vue3.js.map +1 -1
  103. package/dist/esm/dialogs/CnConfirmDialog.vue.js +1 -1
  104. package/dist/esm/dialogs/CnConfirmDialog.vue2.js.map +1 -1
  105. package/dist/esm/dialogs/CnConfirmDialog.vue3.js +5 -3
  106. package/dist/esm/dialogs/CnConfirmDialog.vue3.js.map +1 -1
  107. package/dist/esm/index.js +3 -0
  108. package/dist/esm/index.js.map +1 -1
  109. package/dist/esm/l10n/en.json.js +16 -1
  110. package/dist/esm/l10n/en.json.js.map +1 -1
  111. package/dist/esm/l10n/nl.json.js +16 -1
  112. package/dist/esm/l10n/nl.json.js.map +1 -1
  113. package/dist/esm/library-style.js +1 -1
  114. package/dist/esm/nextcloud-vue.css +908 -464
  115. package/dist/esm/utils/builtInFormatters.js +19 -1
  116. package/dist/esm/utils/builtInFormatters.js.map +1 -1
  117. package/dist/esm/utils/noteThreads.js +14 -2
  118. package/dist/esm/utils/noteThreads.js.map +1 -1
  119. package/dist/nextcloud-vue.cjs.js +11435 -10084
  120. package/dist/nextcloud-vue.cjs.js.map +2 -2
  121. package/dist/nextcloud-vue.css +908 -464
  122. package/l10n/en.json +16 -1
  123. package/l10n/nl.json +16 -1
  124. package/package.json +1 -1
  125. package/scripts/.jsdoc-baselines.json +1 -1
  126. package/src/components/CnActionDialog/CnActionDialog.vue +4 -1
  127. package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +24 -3
  128. package/src/components/CnConditionGroupEditor/CnConditionGroup.vue +528 -0
  129. package/src/components/CnConditionGroupEditor/CnConditionGroupEditor.vue +211 -0
  130. package/src/components/CnConditionGroupEditor/index.js +9 -0
  131. package/src/components/CnConditionListEditor/CnConditionListEditor.vue +15 -78
  132. package/src/components/CnConditionListEditor/CnConditionRow.vue +226 -0
  133. package/src/components/CnDetailPage/CnDetailPage.vue +8 -8
  134. package/src/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue +6 -0
  135. package/src/components/CnDetailWidgetHost/CnDetailWidgetHost.vue +0 -6
  136. package/src/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue +75 -4
  137. package/src/components/CnDialogActions/CnDialogActions.vue +124 -0
  138. package/src/components/CnDialogActions/index.js +7 -0
  139. package/src/components/CnFactsWidget/CnFactsWidget.vue +7 -3
  140. package/src/components/CnFilesBrowser/CnFilesBrowser.vue +15 -3
  141. package/src/components/CnFilesBrowser/filesBrowser.js +21 -2
  142. package/src/components/CnFlowsPage/CnFlowBoard.vue +10 -3
  143. package/src/components/CnFlowsPage/CnFlowEditorPage.vue +12 -0
  144. package/src/components/CnLinkedWidget/CnLinkedWidget.vue +7 -0
  145. package/src/components/CnMassActionDialog/CnMassActionDialog.vue +382 -0
  146. package/src/components/CnMassActionDialog/index.js +7 -0
  147. package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.md +4 -0
  148. package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +25 -254
  149. package/src/components/CnNotesCard/CnNotesCard.vue +12 -4
  150. package/src/components/CnObjectSidebar/CnNotesTab.vue +23 -3
  151. package/src/components/CnTreeView/CnTreeNode.vue +10 -1
  152. package/src/components/CnTreeView/CnTreeView.vue +9 -0
  153. package/src/components/index.js +3 -0
  154. package/src/css/context-menu.css +7 -0
  155. package/src/css/look-board-detail.css +220 -2
  156. package/src/css/look-board-index.css +7 -6
  157. package/src/css/look-board.css +43 -2
  158. package/src/css/patches.css +4 -1
  159. package/src/dialogs/CnConfirmDialog.vue +3 -1
  160. package/src/index.js +3 -0
  161. package/src/utils/builtInFormatters.js +18 -0
  162. package/src/utils/noteThreads.js +13 -1
  163. package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue3.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CnConditionListEditor.vue2.js","sources":["../../../../src/components/CnConditionListEditor/CnConditionListEditor.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<fieldset class=\"cn-condition-list\">\n\t\t<legend v-if=\"label\" class=\"cn-condition-list__label\">\n\t\t\t{{ label }}\n\t\t</legend>\n\t\t<p v-if=\"rows.length === 0\" class=\"cn-condition-list__empty\">\n\t\t\t{{ emptyText || t('nextcloud-vue', 'No conditions: the rule always applies.') }}\n\t\t</p>\n\t\t<div\n\t\t\tv-for=\"(row, i) in rows\"\n\t\t\t:key=\"i\"\n\t\t\tclass=\"cn-condition-list__row\">\n\t\t\t<NcSelect\n\t\t\t\tclass=\"cn-condition-list__field\"\n\t\t\t\t:modelValue=\"fieldOption(row.field)\"\n\t\t\t\t:options=\"fieldOptions\"\n\t\t\t\tlabel=\"label\"\n\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'Field')\"\n\t\t\t\t:clearable=\"false\"\n\t\t\t\t@update:modelValue=\"setField(i, $event)\" />\n\t\t\t<NcSelect\n\t\t\t\tclass=\"cn-condition-list__operator\"\n\t\t\t\t:modelValue=\"operatorOption(row.operator)\"\n\t\t\t\t:options=\"operatorOptions(row.field)\"\n\t\t\t\tlabel=\"label\"\n\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'Operator')\"\n\t\t\t\t:clearable=\"false\"\n\t\t\t\t:disabled=\"!row.field\"\n\t\t\t\t@update:modelValue=\"setOperator(i, $event)\" />\n\t\t\t<template v-if=\"takesValue(row.operator)\">\n\t\t\t\t<NcSelect\n\t\t\t\t\tv-if=\"valueOptions(row.field)\"\n\t\t\t\t\tclass=\"cn-condition-list__value\"\n\t\t\t\t\t:modelValue=\"valueOption(row)\"\n\t\t\t\t\t:options=\"valueOptions(row.field)\"\n\t\t\t\t\tlabel=\"label\"\n\t\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'Value')\"\n\t\t\t\t\t:clearable=\"false\"\n\t\t\t\t\t@update:modelValue=\"setValue(i, $event ? $event.id : '')\" />\n\t\t\t\t<NcTextField\n\t\t\t\t\tv-else\n\t\t\t\t\tclass=\"cn-condition-list__value\"\n\t\t\t\t\t:type=\"inputType(row.field)\"\n\t\t\t\t\t:modelValue=\"row.value === undefined || row.value === null ? '' : String(row.value)\"\n\t\t\t\t\t:label=\"t('nextcloud-vue', 'Value')\"\n\t\t\t\t\t@update:modelValue=\"setValue(i, typedValue(row.field, $event))\" />\n\t\t\t</template>\n\t\t\t<NcButton\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Remove condition')\"\n\t\t\t\t@click=\"remove(i)\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<Close :size=\"18\" />\n\t\t\t\t</template>\n\t\t\t</NcButton>\n\t\t</div>\n\t\t<NcButton variant=\"tertiary\" :disabled=\"fields.length === 0\" @click=\"add\">\n\t\t\t<template #icon>\n\t\t\t\t<Plus :size=\"18\" />\n\t\t\t</template>\n\t\t\t{{ t('nextcloud-vue', 'Add condition') }}\n\t\t</NcButton>\n\t</fieldset>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcSelect, NcTextField } from '@nextcloud/vue'\nimport Close from 'vue-material-design-icons/Close.vue'\nimport Plus from 'vue-material-design-icons/Plus.vue'\nimport { operatorLabel, operatorsForType, operatorTakesValue } from './conditionOperators.js'\n\n/**\n * CnConditionListEditor - the conditions of a rule as rows over an object's\n * own fields: field, operator, value. All rows hold together. The operators\n * follow the field's type (see `operatorsForType`), \"is filled in\" needs no\n * value, and the value is a choice for a choice or yes/no field.\n *\n * v-model on `{ field, operator, value }[]`, in both dialects (`value`/`input`\n * and `modelValue`/`update:modelValue`). Read a condition back as words with\n * `conditionSentence` from `./conditionOperators.js`.\n */\nexport default {\n\tname: 'CnConditionListEditor',\n\n\tcomponents: { NcButton, NcSelect, NcTextField, Close, Plus },\n\n\tprops: {\n\t\t/**\n\t\t * The conditions.\n\t\t *\n\t\t * @type {Array<{field: string, operator: string, value?: unknown}>}\n\t\t */\n\t\tvalue: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The same value under Vue 3's v-model name; wins over `value` when passed.\n\t\t *\n\t\t * @type {Array}\n\t\t */\n\t\tmodelValue: { type: Array, default: undefined },\n\t\t/**\n\t\t * The fields a condition may name: `{ id, label, type, options?, format? }`.\n\t\t * `type` is number, integer, date, boolean, presence or anything else (text);\n\t\t * `options` (`[{ id, label }]`) make the value a choice.\n\t\t *\n\t\t * @type {Array<{id: string, label: string, type?: string, options?: Array}>}\n\t\t */\n\t\tfields: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The legend above the rows, already translated.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tlabel: { type: String, default: '' },\n\t\t/**\n\t\t * What an empty list says, already translated.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\temptyText: { type: String, default: '' },\n\t},\n\n\temits: ['input', 'update:modelValue'],\n\n\tdata() {\n\t\treturn {\n\t\t\trows: this.copy(this.modelValue !== undefined ? this.modelValue : this.value),\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The field choices.\n\t\t *\n\t\t * @return {Array<{id: string, label: string}>}\n\t\t */\n\t\tfieldOptions() {\n\t\t\treturn this.fields.map((f) => ({ id: f.id, label: f.label || f.id }))\n\t\t},\n\t},\n\n\twatch: {\n\t\tvalue(next) {\n\t\t\tif (this.modelValue === undefined) {\n\t\t\t\tthis.rows = this.copy(next)\n\t\t\t}\n\t\t},\n\n\t\tmodelValue(next) {\n\t\t\tif (next !== undefined) {\n\t\t\t\tthis.rows = this.copy(next)\n\t\t\t}\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A detached copy of the bound conditions.\n\t\t *\n\t\t * @param {Array} list The conditions.\n\t\t * @return {Array} The copy.\n\t\t */\n\t\tcopy(list) {\n\t\t\treturn (Array.isArray(list) ? list : []).map((row) => ({ ...row }))\n\t\t},\n\n\t\t/**\n\t\t * The field with this id.\n\t\t *\n\t\t * @param {string} id The field id.\n\t\t * @return {object|undefined}\n\t\t */\n\t\tfieldOf(id) {\n\t\t\treturn this.fields.find((f) => f.id === id)\n\t\t},\n\n\t\tfieldOption(id) {\n\t\t\treturn this.fieldOptions.find((o) => o.id === id) || null\n\t\t},\n\n\t\toperatorOptions(fieldId) {\n\t\t\treturn operatorsForType(this.fieldOf(fieldId)?.type).map((id) => ({ id, label: operatorLabel(id) }))\n\t\t},\n\n\t\toperatorOption(operator) {\n\t\t\treturn operator ? { id: operator, label: operatorLabel(operator) } : null\n\t\t},\n\n\t\ttakesValue(operator) {\n\t\t\treturn operatorTakesValue(operator)\n\t\t},\n\n\t\t/**\n\t\t * The value choices of a field, or null when its value is typed.\n\t\t *\n\t\t * @param {string} fieldId The field id.\n\t\t * @return {Array<{id: string, label: string}>|null}\n\t\t */\n\t\tvalueOptions(fieldId) {\n\t\t\tconst field = this.fieldOf(fieldId)\n\t\t\tif (field?.type === 'boolean') {\n\t\t\t\treturn [\n\t\t\t\t\t{ id: true, label: t('nextcloud-vue', 'Yes') },\n\t\t\t\t\t{ id: false, label: t('nextcloud-vue', 'No') },\n\t\t\t\t]\n\t\t\t}\n\t\t\tif (Array.isArray(field?.options) && field.options.length > 0) {\n\t\t\t\treturn field.options.map((o) => (typeof o === 'object'\n\t\t\t\t\t? { id: o.id ?? o.value, label: o.label ?? String(o.id ?? o.value) }\n\t\t\t\t\t: { id: o, label: String(o) }))\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\n\t\tvalueOption(row) {\n\t\t\treturn (this.valueOptions(row.field) || []).find((o) => String(o.id) === String(row.value)) || null\n\t\t},\n\n\t\tinputType(fieldId) {\n\t\t\tconst type = this.fieldOf(fieldId)?.type\n\t\t\tif (type === 'number' || type === 'integer') {\n\t\t\t\treturn 'number'\n\t\t\t}\n\t\t\treturn type === 'date' ? 'date' : 'text'\n\t\t},\n\n\t\t/**\n\t\t * A typed value as stored: a number for a number field.\n\t\t *\n\t\t * @param {string} fieldId The field id.\n\t\t * @param {string} raw What was typed.\n\t\t * @return {string|number}\n\t\t */\n\t\ttypedValue(fieldId, raw) {\n\t\t\tconst type = this.fieldOf(fieldId)?.type\n\t\t\tif ((type === 'number' || type === 'integer') && raw !== '' && !Number.isNaN(Number(raw))) {\n\t\t\t\treturn Number(raw)\n\t\t\t}\n\t\t\treturn raw\n\t\t},\n\n\t\tsetField(i, option) {\n\t\t\tconst field = this.fieldOf(option?.id)\n\t\t\tconst operators = operatorsForType(field?.type)\n\t\t\tthis.rows[i] = { field: option?.id || '', operator: operators[0], value: field?.type === 'boolean' ? true : '' }\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tsetOperator(i, option) {\n\t\t\tconst row = { ...this.rows[i], operator: option?.id || 'eq' }\n\t\t\tif (!operatorTakesValue(row.operator)) {\n\t\t\t\tdelete row.value\n\t\t\t} else if (row.value === undefined) {\n\t\t\t\trow.value = ''\n\t\t\t}\n\t\t\tthis.rows[i] = row\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tsetValue(i, value) {\n\t\t\tthis.rows[i] = { ...this.rows[i], value }\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tadd() {\n\t\t\tthis.rows.push({ field: '', operator: 'eq', value: '' })\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tremove(i) {\n\t\t\tthis.rows.splice(i, 1)\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\t/**\n\t\t * Tell the consumer, in both v-model dialects.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\temitRows() {\n\t\t\tconst next = this.copy(this.rows)\n\t\t\t/**\n\t\t\t * The conditions changed.\n\t\t\t *\n\t\t\t * @event input\n\t\t\t * @type {Array}\n\t\t\t */\n\t\t\tthis.$emit('input', next)\n\t\t\t/**\n\t\t\t * The conditions changed (Vue 3 v-model).\n\t\t\t *\n\t\t\t * @event update:modelValue\n\t\t\t * @type {Array}\n\t\t\t */\n\t\t\tthis.$emit('update:modelValue', next)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-condition-list {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tborder: 0;\n\tmargin: 0;\n\tpadding: 0;\n\tmin-width: 0;\n}\n\n.cn-condition-list__label {\n\tfont-weight: 600;\n\tpadding: 0;\n\tmargin-bottom: 4px;\n}\n\n.cn-condition-list__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tmargin: 0;\n}\n\n.cn-condition-list__row {\n\tdisplay: grid;\n\tgrid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1.6fr) auto;\n\tgap: 8px;\n\talign-items: end;\n}\n\n.cn-condition-list__row > :nth-child(3):last-child {\n\tgrid-column: 4;\n}\n\n@media (max-width: 640px) {\n\t.cn-condition-list__row {\n\t\tgrid-template-columns: minmax(0, 1fr) auto;\n\t}\n}\n</style>\n"],"names":["t"],"mappings":";;;;;;AA6EA;AACC;AACA;AACA;;AAEA;AACA;AACA;;;AAGD,aAAe;CACd,IAAI,EAAE,uBAAuB;;CAE7B,UAAU,EAAE,EAAE,QAAQ,EAAE,QA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CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;AACtC,IAAA,OAAO,GAAG,CAAC,MAAI;AAChB,IAAA,MAAO,IAAI,GAAG,CAAC,KAAI,KAAM,SAAS,EAAE;IACnC,GAAG,CAAC,KAAM,GAAE,GAAC;AACd,IAAA;AACA,GAAA,IAAI,CAAC,IAAI,CAAC,CAAC,CAAE,GAAE,IAAE;AACjB,GAAA,IAAI,CAAC,QAAQ,GAAC;GACd;;AAED,EAAA,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE;AAClB,GAAA,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA,GAAI,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAM,GAAA;AACxC,GAAA,IAAI,CAAC,QAAQ,GAAC;GACd;;EAED,GAAG,GAAG;GACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAAC,EAAG,EAAA;AACvD,GAAA,IAAI,CAAC,QAAQ,GAAC;GACd;;AAED,EAAA,MAAM,CAAC,CAAC,EAAE;AACT,GAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAA;AACrB,GAAA,IAAI,CAAC,QAAQ,GAAC;GACd;;AAED;AACC;AACA;;;EAGD,QAAQ,GAAG;GACV,MAAM,IAAK,GAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAA;AAChC;AACC;AACA;;;;GAID,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAA;AACxB;AACC;AACA;;;;AAID,GAAA,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,IAAI,EAAA;GACpC;EACD;AACF;;;;"}
1
+ {"version":3,"file":"CnConditionListEditor.vue2.js","sources":["../../../../src/components/CnConditionListEditor/CnConditionListEditor.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<fieldset class=\"cn-condition-list\">\n\t\t<legend v-if=\"label\" class=\"cn-condition-list__label\">\n\t\t\t{{ label }}\n\t\t</legend>\n\t\t<p v-if=\"rows.length === 0\" class=\"cn-condition-list__empty\">\n\t\t\t{{ emptyText || t('nextcloud-vue', 'No conditions: the rule always applies.') }}\n\t\t</p>\n\t\t<CnConditionRow\n\t\t\tv-for=\"(row, i) in rows\"\n\t\t\t:key=\"i\"\n\t\t\tclass=\"cn-condition-list__row\"\n\t\t\t:condition=\"row\"\n\t\t\t:fieldOptions=\"fieldOptions\"\n\t\t\t:operatorOptions=\"operatorOptions(row.field)\"\n\t\t\t:valueOptions=\"valueOptions(row.field)\"\n\t\t\t:inputType=\"inputType(row.field)\"\n\t\t\t:showValue=\"takesValue(row.operator)\"\n\t\t\t@field=\"setField(i, $event)\"\n\t\t\t@operator=\"setOperator(i, $event)\"\n\t\t\t@value=\"setValue(i, valueOptions(row.field) ? $event : typedValue(row.field, $event))\"\n\t\t\t@remove=\"remove(i)\" />\n\t\t<NcButton variant=\"tertiary\" :disabled=\"fields.length === 0\" @click=\"add\">\n\t\t\t<template #icon>\n\t\t\t\t<Plus :size=\"18\" />\n\t\t\t</template>\n\t\t\t{{ t('nextcloud-vue', 'Add condition') }}\n\t\t</NcButton>\n\t</fieldset>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton } from '@nextcloud/vue'\nimport Plus from 'vue-material-design-icons/Plus.vue'\nimport CnConditionRow from './CnConditionRow.vue'\nimport { operatorLabel, operatorsForType, operatorTakesValue } from './conditionOperators.js'\n\n/**\n * CnConditionListEditor - the conditions of a rule as rows over an object's\n * own fields: field, operator, value. All rows hold together. The operators\n * follow the field's type (see `operatorsForType`), \"is filled in\" needs no\n * value, and the value is a choice for a choice or yes/no field.\n *\n * v-model on `{ field, operator, value }[]`, in both dialects (`value`/`input`\n * and `modelValue`/`update:modelValue`). Read a condition back as words with\n * `conditionSentence` from `./conditionOperators.js`.\n */\nexport default {\n\tname: 'CnConditionListEditor',\n\n\tcomponents: { CnConditionRow, NcButton, Plus },\n\n\tprops: {\n\t\t/**\n\t\t * The conditions.\n\t\t *\n\t\t * @type {Array<{field: string, operator: string, value?: unknown}>}\n\t\t */\n\t\tvalue: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The same value under Vue 3's v-model name; wins over `value` when passed.\n\t\t *\n\t\t * @type {Array}\n\t\t */\n\t\tmodelValue: { type: Array, default: undefined },\n\t\t/**\n\t\t * The fields a condition may name: `{ id, label, type, options?, format? }`.\n\t\t * `type` is number, integer, date, boolean, presence or anything else (text);\n\t\t * `options` (`[{ id, label }]`) make the value a choice.\n\t\t *\n\t\t * @type {Array<{id: string, label: string, type?: string, options?: Array}>}\n\t\t */\n\t\tfields: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The legend above the rows, already translated.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tlabel: { type: String, default: '' },\n\t\t/**\n\t\t * What an empty list says, already translated.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\temptyText: { type: String, default: '' },\n\t},\n\n\temits: ['input', 'update:modelValue'],\n\n\tdata() {\n\t\treturn {\n\t\t\trows: this.copy(this.modelValue !== undefined ? this.modelValue : this.value),\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The field choices.\n\t\t *\n\t\t * @return {Array<{id: string, label: string}>}\n\t\t */\n\t\tfieldOptions() {\n\t\t\treturn this.fields.map((f) => ({ id: f.id, label: f.label || f.id }))\n\t\t},\n\t},\n\n\twatch: {\n\t\tvalue(next) {\n\t\t\tif (this.modelValue === undefined) {\n\t\t\t\tthis.rows = this.copy(next)\n\t\t\t}\n\t\t},\n\n\t\tmodelValue(next) {\n\t\t\tif (next !== undefined) {\n\t\t\t\tthis.rows = this.copy(next)\n\t\t\t}\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A detached copy of the bound conditions.\n\t\t *\n\t\t * @param {Array} list The conditions.\n\t\t * @return {Array} The copy.\n\t\t */\n\t\tcopy(list) {\n\t\t\treturn (Array.isArray(list) ? list : []).map((row) => ({ ...row }))\n\t\t},\n\n\t\t/**\n\t\t * The field with this id.\n\t\t *\n\t\t * @param {string} id The field id.\n\t\t * @return {object|undefined}\n\t\t */\n\t\tfieldOf(id) {\n\t\t\treturn this.fields.find((f) => f.id === id)\n\t\t},\n\n\t\toperatorOptions(fieldId) {\n\t\t\treturn operatorsForType(this.fieldOf(fieldId)?.type).map((id) => ({ id, label: operatorLabel(id) }))\n\t\t},\n\n\t\ttakesValue(operator) {\n\t\t\treturn operatorTakesValue(operator)\n\t\t},\n\n\t\t/**\n\t\t * The value choices of a field, or null when its value is typed.\n\t\t *\n\t\t * @param {string} fieldId The field id.\n\t\t * @return {Array<{id: string, label: string}>|null}\n\t\t */\n\t\tvalueOptions(fieldId) {\n\t\t\tconst field = this.fieldOf(fieldId)\n\t\t\tif (field?.type === 'boolean') {\n\t\t\t\treturn [\n\t\t\t\t\t{ id: true, label: t('nextcloud-vue', 'Yes') },\n\t\t\t\t\t{ id: false, label: t('nextcloud-vue', 'No') },\n\t\t\t\t]\n\t\t\t}\n\t\t\tif (Array.isArray(field?.options) && field.options.length > 0) {\n\t\t\t\treturn field.options.map((o) => (typeof o === 'object'\n\t\t\t\t\t? { id: o.id ?? o.value, label: o.label ?? String(o.id ?? o.value) }\n\t\t\t\t\t: { id: o, label: String(o) }))\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\n\t\tinputType(fieldId) {\n\t\t\tconst type = this.fieldOf(fieldId)?.type\n\t\t\tif (type === 'number' || type === 'integer') {\n\t\t\t\treturn 'number'\n\t\t\t}\n\t\t\treturn type === 'date' ? 'date' : 'text'\n\t\t},\n\n\t\t/**\n\t\t * A typed value as stored: a number for a number field.\n\t\t *\n\t\t * @param {string} fieldId The field id.\n\t\t * @param {string} raw What was typed.\n\t\t * @return {string|number}\n\t\t */\n\t\ttypedValue(fieldId, raw) {\n\t\t\tconst type = this.fieldOf(fieldId)?.type\n\t\t\tif ((type === 'number' || type === 'integer') && raw !== '' && !Number.isNaN(Number(raw))) {\n\t\t\t\treturn Number(raw)\n\t\t\t}\n\t\t\treturn raw\n\t\t},\n\n\t\tsetField(i, option) {\n\t\t\tconst field = this.fieldOf(option?.id)\n\t\t\tconst operators = operatorsForType(field?.type)\n\t\t\tthis.rows[i] = { field: option?.id || '', operator: operators[0], value: field?.type === 'boolean' ? true : '' }\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tsetOperator(i, option) {\n\t\t\tconst row = { ...this.rows[i], operator: option?.id || 'eq' }\n\t\t\tif (!operatorTakesValue(row.operator)) {\n\t\t\t\tdelete row.value\n\t\t\t} else if (row.value === undefined) {\n\t\t\t\trow.value = ''\n\t\t\t}\n\t\t\tthis.rows[i] = row\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tsetValue(i, value) {\n\t\t\tthis.rows[i] = { ...this.rows[i], value }\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tadd() {\n\t\t\tthis.rows.push({ field: '', operator: 'eq', value: '' })\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tremove(i) {\n\t\t\tthis.rows.splice(i, 1)\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\t/**\n\t\t * Tell the consumer, in both v-model dialects.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\temitRows() {\n\t\t\tconst next = this.copy(this.rows)\n\t\t\t/**\n\t\t\t * The conditions changed.\n\t\t\t *\n\t\t\t * @event input\n\t\t\t * @type {Array}\n\t\t\t */\n\t\t\tthis.$emit('input', next)\n\t\t\t/**\n\t\t\t * The conditions changed (Vue 3 v-model).\n\t\t\t *\n\t\t\t * @event update:modelValue\n\t\t\t * @type {Array}\n\t\t\t */\n\t\t\tthis.$emit('update:modelValue', next)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-condition-list {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tborder: 0;\n\tmargin: 0;\n\tpadding: 0;\n\tmin-width: 0;\n}\n\n.cn-condition-list__label {\n\tfont-weight: 600;\n\tpadding: 0;\n\tmargin-bottom: 4px;\n}\n\n.cn-condition-list__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tmargin: 0;\n}\n</style>\n"],"names":["CnConditionRow","t"],"mappings":";;;;;;AA2CA;AACC;AACA;AACA;;AAEA;AACA;AACA;;;AAGD,aAAe;CACd,IAAI,EAAE,uBAAuB;;AAE7B,CAAA,UAAU,EAAE,kBAAEA,UAAc,EAAE,QAAQ,EAAE,MAAM;;AAE9C,CAAA,KAAK,EAAE;AACN;AACC;AACA;;;AAGD,EAAA,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI;AACzC;;AAEC;;;AAGD,EAAA,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW;AAC/C;AACC;AACA;AACA;AACA;AACA;;AAED,EAAA,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI;AAC1C;AACC;AACA;;;AAGD,EAAA,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAC,EAAG;AACpC;AACC;AACA;;;AAGD,EAAA,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;EACxC;;AAED,CAAA,KAAK,EAAE,CAAC,OAAO,EAAE,mBAAmB,CAAC;;AAErC,CAAA,IAAI,GAAG;AACN,EAAA,OAAO;AACN,GAAA,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAS,KAAM,YAAY,IAAI,CAAC,UAAW,GAAE,IAAI,CAAC,KAAK,CAAC;AAC9E,GAAA;EACA;;AAED,CAAA,QAAQ,EAAE;AACT;AACC;AACA;AACA;;AAED,EAAA,YAAY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AAA,IAAI,CAAC,IAAI,CAAC,CAAC,CAAE,GAAE,IAAE;AACjB,GAAA,IAAI,CAAC,QAAQ,GAAC;GACd;;AAED,EAAA,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE;AAClB,GAAA,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA,GAAI,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAM,GAAA;AACxC,GAAA,IAAI,CAAC,QAAQ,GAAC;GACd;;EAED,GAAG,GAAG;GACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAAC,EAAG,EAAA;AACvD,GAAA,IAAI,CAAC,QAAQ,GAAC;GACd;;AAED,EAAA,MAAM,CAAC,CAAC,EAAE;AACT,GAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAA;AACrB,GAAA,IAAI,CAAC,QAAQ,GAAC;GACd;;AAED;AACC;AACA;;;EAGD,QAAQ,GAAG;GACV,MAAM,IAAK,GAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAA;AAChC;AACC;AACA;;;;GAID,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAA;AACxB;AACC;AACA;;;;AAID,GAAA,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,IAAI,EAAA;GACpC;EACD;AACF;;;;"}
@@ -1,4 +1,4 @@
1
- import { resolveComponent, openBlock, createElementBlock, toDisplayString, createCommentVNode, Fragment, renderList, createVNode, createBlock, withCtx, createTextVNode } from 'vue';
1
+ import { resolveComponent, openBlock, createElementBlock, toDisplayString, createCommentVNode, Fragment, renderList, createBlock, createVNode, withCtx, createTextVNode } from 'vue';
2
2
 
3
3
  const _hoisted_1 = { class: "cn-condition-list" };
4
4
  const _hoisted_2 = {
@@ -11,11 +11,9 @@ const _hoisted_3 = {
11
11
  };
12
12
 
13
13
  function render(_ctx, _cache, $props, $setup, $data, $options) {
14
- const _component_NcSelect = resolveComponent("NcSelect");
15
- const _component_NcTextField = resolveComponent("NcTextField");
16
- const _component_Close = resolveComponent("Close");
17
- const _component_NcButton = resolveComponent("NcButton");
14
+ const _component_CnConditionRow = resolveComponent("CnConditionRow");
18
15
  const _component_Plus = resolveComponent("Plus");
16
+ const _component_NcButton = resolveComponent("NcButton");
19
17
 
20
18
  return (openBlock(), createElementBlock("fieldset", _hoisted_1, [
21
19
  ($props.label)
@@ -25,63 +23,20 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
25
23
  ? (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString($props.emptyText || $options.t('nextcloud-vue', 'No conditions: the rule always applies.')), 1 /* TEXT */))
26
24
  : createCommentVNode("v-if", true),
27
25
  (openBlock(true), createElementBlock(Fragment, null, renderList($data.rows, (row, i) => {
28
- return (openBlock(), createElementBlock("div", {
26
+ return (openBlock(), createBlock(_component_CnConditionRow, {
29
27
  key: i,
30
- class: "cn-condition-list__row"
31
- }, [
32
- createVNode(_component_NcSelect, {
33
- class: "cn-condition-list__field",
34
- modelValue: $options.fieldOption(row.field),
35
- options: $options.fieldOptions,
36
- label: "label",
37
- inputLabel: $options.t('nextcloud-vue', 'Field'),
38
- clearable: false,
39
- "onUpdate:modelValue": $event => ($options.setField(i, $event))
40
- }, null, 8 /* PROPS */, ["modelValue", "options", "inputLabel", "onUpdate:modelValue"]),
41
- createVNode(_component_NcSelect, {
42
- class: "cn-condition-list__operator",
43
- modelValue: $options.operatorOption(row.operator),
44
- options: $options.operatorOptions(row.field),
45
- label: "label",
46
- inputLabel: $options.t('nextcloud-vue', 'Operator'),
47
- clearable: false,
48
- disabled: !row.field,
49
- "onUpdate:modelValue": $event => ($options.setOperator(i, $event))
50
- }, null, 8 /* PROPS */, ["modelValue", "options", "inputLabel", "disabled", "onUpdate:modelValue"]),
51
- ($options.takesValue(row.operator))
52
- ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
53
- ($options.valueOptions(row.field))
54
- ? (openBlock(), createBlock(_component_NcSelect, {
55
- key: 0,
56
- class: "cn-condition-list__value",
57
- modelValue: $options.valueOption(row),
58
- options: $options.valueOptions(row.field),
59
- label: "label",
60
- inputLabel: $options.t('nextcloud-vue', 'Value'),
61
- clearable: false,
62
- "onUpdate:modelValue": $event => ($options.setValue(i, $event ? $event.id : ''))
63
- }, null, 8 /* PROPS */, ["modelValue", "options", "inputLabel", "onUpdate:modelValue"]))
64
- : (openBlock(), createBlock(_component_NcTextField, {
65
- key: 1,
66
- class: "cn-condition-list__value",
67
- type: $options.inputType(row.field),
68
- modelValue: row.value === undefined || row.value === null ? '' : String(row.value),
69
- label: $options.t('nextcloud-vue', 'Value'),
70
- "onUpdate:modelValue": $event => ($options.setValue(i, $options.typedValue(row.field, $event)))
71
- }, null, 8 /* PROPS */, ["type", "modelValue", "label", "onUpdate:modelValue"]))
72
- ], 64 /* STABLE_FRAGMENT */))
73
- : createCommentVNode("v-if", true),
74
- createVNode(_component_NcButton, {
75
- variant: "tertiary",
76
- "aria-label": $options.t('nextcloud-vue', 'Remove condition'),
77
- onClick: $event => ($options.remove(i))
78
- }, {
79
- icon: withCtx(() => [
80
- createVNode(_component_Close, { size: 18 })
81
- ]),
82
- _: 1 /* STABLE */
83
- }, 8 /* PROPS */, ["aria-label", "onClick"])
84
- ]))
28
+ class: "cn-condition-list__row",
29
+ condition: row,
30
+ fieldOptions: $options.fieldOptions,
31
+ operatorOptions: $options.operatorOptions(row.field),
32
+ valueOptions: $options.valueOptions(row.field),
33
+ inputType: $options.inputType(row.field),
34
+ showValue: $options.takesValue(row.operator),
35
+ onField: $event => ($options.setField(i, $event)),
36
+ onOperator: $event => ($options.setOperator(i, $event)),
37
+ onValue: $event => ($options.setValue(i, $options.valueOptions(row.field) ? $event : $options.typedValue(row.field, $event))),
38
+ onRemove: $event => ($options.remove(i))
39
+ }, null, 8 /* PROPS */, ["condition", "fieldOptions", "operatorOptions", "valueOptions", "inputType", "showValue", "onField", "onOperator", "onValue", "onRemove"]))
85
40
  }), 128 /* KEYED_FRAGMENT */)),
86
41
  createVNode(_component_NcButton, {
87
42
  variant: "tertiary",
@@ -1 +1 @@
1
- {"version":3,"file":"CnConditionListEditor.vue3.js","sources":["../../../../src/components/CnConditionListEditor/CnConditionListEditor.vue?vue&type=template&id=f00a4cf2&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<fieldset class=\"cn-condition-list\">\n\t\t<legend v-if=\"label\" class=\"cn-condition-list__label\">\n\t\t\t{{ label }}\n\t\t</legend>\n\t\t<p v-if=\"rows.length === 0\" class=\"cn-condition-list__empty\">\n\t\t\t{{ emptyText || t('nextcloud-vue', 'No conditions: the rule always applies.') }}\n\t\t</p>\n\t\t<div\n\t\t\tv-for=\"(row, i) in rows\"\n\t\t\t:key=\"i\"\n\t\t\tclass=\"cn-condition-list__row\">\n\t\t\t<NcSelect\n\t\t\t\tclass=\"cn-condition-list__field\"\n\t\t\t\t:modelValue=\"fieldOption(row.field)\"\n\t\t\t\t:options=\"fieldOptions\"\n\t\t\t\tlabel=\"label\"\n\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'Field')\"\n\t\t\t\t:clearable=\"false\"\n\t\t\t\t@update:modelValue=\"setField(i, $event)\" />\n\t\t\t<NcSelect\n\t\t\t\tclass=\"cn-condition-list__operator\"\n\t\t\t\t:modelValue=\"operatorOption(row.operator)\"\n\t\t\t\t:options=\"operatorOptions(row.field)\"\n\t\t\t\tlabel=\"label\"\n\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'Operator')\"\n\t\t\t\t:clearable=\"false\"\n\t\t\t\t:disabled=\"!row.field\"\n\t\t\t\t@update:modelValue=\"setOperator(i, $event)\" />\n\t\t\t<template v-if=\"takesValue(row.operator)\">\n\t\t\t\t<NcSelect\n\t\t\t\t\tv-if=\"valueOptions(row.field)\"\n\t\t\t\t\tclass=\"cn-condition-list__value\"\n\t\t\t\t\t:modelValue=\"valueOption(row)\"\n\t\t\t\t\t:options=\"valueOptions(row.field)\"\n\t\t\t\t\tlabel=\"label\"\n\t\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'Value')\"\n\t\t\t\t\t:clearable=\"false\"\n\t\t\t\t\t@update:modelValue=\"setValue(i, $event ? $event.id : '')\" />\n\t\t\t\t<NcTextField\n\t\t\t\t\tv-else\n\t\t\t\t\tclass=\"cn-condition-list__value\"\n\t\t\t\t\t:type=\"inputType(row.field)\"\n\t\t\t\t\t:modelValue=\"row.value === undefined || row.value === null ? '' : String(row.value)\"\n\t\t\t\t\t:label=\"t('nextcloud-vue', 'Value')\"\n\t\t\t\t\t@update:modelValue=\"setValue(i, typedValue(row.field, $event))\" />\n\t\t\t</template>\n\t\t\t<NcButton\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Remove condition')\"\n\t\t\t\t@click=\"remove(i)\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<Close :size=\"18\" />\n\t\t\t\t</template>\n\t\t\t</NcButton>\n\t\t</div>\n\t\t<NcButton variant=\"tertiary\" :disabled=\"fields.length === 0\" @click=\"add\">\n\t\t\t<template #icon>\n\t\t\t\t<Plus :size=\"18\" />\n\t\t\t</template>\n\t\t\t{{ t('nextcloud-vue', 'Add condition') }}\n\t\t</NcButton>\n\t</fieldset>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcSelect, NcTextField } from '@nextcloud/vue'\nimport Close from 'vue-material-design-icons/Close.vue'\nimport Plus from 'vue-material-design-icons/Plus.vue'\nimport { operatorLabel, operatorsForType, operatorTakesValue } from './conditionOperators.js'\n\n/**\n * CnConditionListEditor - the conditions of a rule as rows over an object's\n * own fields: field, operator, value. All rows hold together. The operators\n * follow the field's type (see `operatorsForType`), \"is filled in\" needs no\n * value, and the value is a choice for a choice or yes/no field.\n *\n * v-model on `{ field, operator, value }[]`, in both dialects (`value`/`input`\n * and `modelValue`/`update:modelValue`). Read a condition back as words with\n * `conditionSentence` from `./conditionOperators.js`.\n */\nexport default {\n\tname: 'CnConditionListEditor',\n\n\tcomponents: { NcButton, NcSelect, NcTextField, Close, Plus },\n\n\tprops: {\n\t\t/**\n\t\t * The conditions.\n\t\t *\n\t\t * @type {Array<{field: string, operator: string, value?: unknown}>}\n\t\t */\n\t\tvalue: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The same value under Vue 3's v-model name; wins over `value` when passed.\n\t\t *\n\t\t * @type {Array}\n\t\t */\n\t\tmodelValue: { type: Array, default: undefined },\n\t\t/**\n\t\t * The fields a condition may name: `{ id, label, type, options?, format? }`.\n\t\t * `type` is number, integer, date, boolean, presence or anything else (text);\n\t\t * `options` (`[{ id, label }]`) make the value a choice.\n\t\t *\n\t\t * @type {Array<{id: string, label: string, type?: string, options?: Array}>}\n\t\t */\n\t\tfields: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The legend above the rows, already translated.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tlabel: { type: String, default: '' },\n\t\t/**\n\t\t * What an empty list says, already translated.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\temptyText: { type: String, default: '' },\n\t},\n\n\temits: ['input', 'update:modelValue'],\n\n\tdata() {\n\t\treturn {\n\t\t\trows: this.copy(this.modelValue !== undefined ? this.modelValue : this.value),\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The field choices.\n\t\t *\n\t\t * @return {Array<{id: string, label: string}>}\n\t\t */\n\t\tfieldOptions() {\n\t\t\treturn this.fields.map((f) => ({ id: f.id, label: f.label || f.id }))\n\t\t},\n\t},\n\n\twatch: {\n\t\tvalue(next) {\n\t\t\tif (this.modelValue === undefined) {\n\t\t\t\tthis.rows = this.copy(next)\n\t\t\t}\n\t\t},\n\n\t\tmodelValue(next) {\n\t\t\tif (next !== undefined) {\n\t\t\t\tthis.rows = this.copy(next)\n\t\t\t}\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A detached copy of the bound conditions.\n\t\t *\n\t\t * @param {Array} list The conditions.\n\t\t * @return {Array} The copy.\n\t\t */\n\t\tcopy(list) {\n\t\t\treturn (Array.isArray(list) ? list : []).map((row) => ({ ...row }))\n\t\t},\n\n\t\t/**\n\t\t * The field with this id.\n\t\t *\n\t\t * @param {string} id The field id.\n\t\t * @return {object|undefined}\n\t\t */\n\t\tfieldOf(id) {\n\t\t\treturn this.fields.find((f) => f.id === id)\n\t\t},\n\n\t\tfieldOption(id) {\n\t\t\treturn this.fieldOptions.find((o) => o.id === id) || null\n\t\t},\n\n\t\toperatorOptions(fieldId) {\n\t\t\treturn operatorsForType(this.fieldOf(fieldId)?.type).map((id) => ({ id, label: operatorLabel(id) }))\n\t\t},\n\n\t\toperatorOption(operator) {\n\t\t\treturn operator ? { id: operator, label: operatorLabel(operator) } : null\n\t\t},\n\n\t\ttakesValue(operator) {\n\t\t\treturn operatorTakesValue(operator)\n\t\t},\n\n\t\t/**\n\t\t * The value choices of a field, or null when its value is typed.\n\t\t *\n\t\t * @param {string} fieldId The field id.\n\t\t * @return {Array<{id: string, label: string}>|null}\n\t\t */\n\t\tvalueOptions(fieldId) {\n\t\t\tconst field = this.fieldOf(fieldId)\n\t\t\tif (field?.type === 'boolean') {\n\t\t\t\treturn [\n\t\t\t\t\t{ id: true, label: t('nextcloud-vue', 'Yes') },\n\t\t\t\t\t{ id: false, label: t('nextcloud-vue', 'No') },\n\t\t\t\t]\n\t\t\t}\n\t\t\tif (Array.isArray(field?.options) && field.options.length > 0) {\n\t\t\t\treturn field.options.map((o) => (typeof o === 'object'\n\t\t\t\t\t? { id: o.id ?? o.value, label: o.label ?? String(o.id ?? o.value) }\n\t\t\t\t\t: { id: o, label: String(o) }))\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\n\t\tvalueOption(row) {\n\t\t\treturn (this.valueOptions(row.field) || []).find((o) => String(o.id) === String(row.value)) || null\n\t\t},\n\n\t\tinputType(fieldId) {\n\t\t\tconst type = this.fieldOf(fieldId)?.type\n\t\t\tif (type === 'number' || type === 'integer') {\n\t\t\t\treturn 'number'\n\t\t\t}\n\t\t\treturn type === 'date' ? 'date' : 'text'\n\t\t},\n\n\t\t/**\n\t\t * A typed value as stored: a number for a number field.\n\t\t *\n\t\t * @param {string} fieldId The field id.\n\t\t * @param {string} raw What was typed.\n\t\t * @return {string|number}\n\t\t */\n\t\ttypedValue(fieldId, raw) {\n\t\t\tconst type = this.fieldOf(fieldId)?.type\n\t\t\tif ((type === 'number' || type === 'integer') && raw !== '' && !Number.isNaN(Number(raw))) {\n\t\t\t\treturn Number(raw)\n\t\t\t}\n\t\t\treturn raw\n\t\t},\n\n\t\tsetField(i, option) {\n\t\t\tconst field = this.fieldOf(option?.id)\n\t\t\tconst operators = operatorsForType(field?.type)\n\t\t\tthis.rows[i] = { field: option?.id || '', operator: operators[0], value: field?.type === 'boolean' ? true : '' }\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tsetOperator(i, option) {\n\t\t\tconst row = { ...this.rows[i], operator: option?.id || 'eq' }\n\t\t\tif (!operatorTakesValue(row.operator)) {\n\t\t\t\tdelete row.value\n\t\t\t} else if (row.value === undefined) {\n\t\t\t\trow.value = ''\n\t\t\t}\n\t\t\tthis.rows[i] = row\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tsetValue(i, value) {\n\t\t\tthis.rows[i] = { ...this.rows[i], value }\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tadd() {\n\t\t\tthis.rows.push({ field: '', operator: 'eq', value: '' })\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tremove(i) {\n\t\t\tthis.rows.splice(i, 1)\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\t/**\n\t\t * Tell the consumer, in both v-model dialects.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\temitRows() {\n\t\t\tconst next = this.copy(this.rows)\n\t\t\t/**\n\t\t\t * The conditions changed.\n\t\t\t *\n\t\t\t * @event input\n\t\t\t * @type {Array}\n\t\t\t */\n\t\t\tthis.$emit('input', next)\n\t\t\t/**\n\t\t\t * The conditions changed (Vue 3 v-model).\n\t\t\t *\n\t\t\t * @event update:modelValue\n\t\t\t * @type {Array}\n\t\t\t */\n\t\t\tthis.$emit('update:modelValue', next)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-condition-list {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tborder: 0;\n\tmargin: 0;\n\tpadding: 0;\n\tmin-width: 0;\n}\n\n.cn-condition-list__label {\n\tfont-weight: 600;\n\tpadding: 0;\n\tmargin-bottom: 4px;\n}\n\n.cn-condition-list__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tmargin: 0;\n}\n\n.cn-condition-list__row {\n\tdisplay: grid;\n\tgrid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1.6fr) auto;\n\tgap: 8px;\n\talign-items: end;\n}\n\n.cn-condition-list__row > :nth-child(3):last-child {\n\tgrid-column: 4;\n}\n\n@media (max-width: 640px) {\n\t.cn-condition-list__row {\n\t\tgrid-template-columns: minmax(0, 1fr) auto;\n\t}\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_toDisplayString","_Fragment","_renderList","_createVNode","_createBlock"],"mappings":";;AAWW,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,mBAAmB,GAAA;;;AAC/B,EAAA,KAAA,EAAA,0BAAA;;;;AAGK,EAAA,KAAA,EAAA,0BAAA;;;;;;;;;;AAJP,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,aAAA;KACE,MAAA,CAAA,KAAA;sBAAHA,kBAES,CAAA,QAAA,EAFT,UAES,EAAAC,eAAA,CADN,MAAA,CAAA,KAAA,CAAA,EAAA,CAAA,YAAA;;AAEK,IAAA,CAAA,KAAA,CAAA,IAAA,CAA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A,OAAO,EAAC,UAAE;AACT,UAAA,YAAQ,EAAA,QAAA,CAAA,CAAA,CAAA,eAAA,EAAA,kBAAA,CAAA;UACR,OAAE,EAAA,MAAA,KAAA,QAAA,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA;;AACQ,UAAA,IAAI,UACd,MAAa;YAAbA,WAAa,CAAA,gBAAA,EAAA,EAAL,IAAI,EAAC,EAAA,EAAA,CAAA;;;;;;IAIhBA;AAAU,MAAA,OAAA,EAAA,UAAA;MAAA,QAAA,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,KAAA,CAAA;AAAA,MAAA,OAAA,EAAA,QAAA,CAAA,GAAA;;AACD,MAAA,IAAA;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"CnConditionListEditor.vue3.js","sources":["../../../../src/components/CnConditionListEditor/CnConditionListEditor.vue?vue&type=template&id=77809f32&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<fieldset class=\"cn-condition-list\">\n\t\t<legend v-if=\"label\" class=\"cn-condition-list__label\">\n\t\t\t{{ label }}\n\t\t</legend>\n\t\t<p v-if=\"rows.length === 0\" class=\"cn-condition-list__empty\">\n\t\t\t{{ emptyText || t('nextcloud-vue', 'No conditions: the rule always applies.') }}\n\t\t</p>\n\t\t<CnConditionRow\n\t\t\tv-for=\"(row, i) in rows\"\n\t\t\t:key=\"i\"\n\t\t\tclass=\"cn-condition-list__row\"\n\t\t\t:condition=\"row\"\n\t\t\t:fieldOptions=\"fieldOptions\"\n\t\t\t:operatorOptions=\"operatorOptions(row.field)\"\n\t\t\t:valueOptions=\"valueOptions(row.field)\"\n\t\t\t:inputType=\"inputType(row.field)\"\n\t\t\t:showValue=\"takesValue(row.operator)\"\n\t\t\t@field=\"setField(i, $event)\"\n\t\t\t@operator=\"setOperator(i, $event)\"\n\t\t\t@value=\"setValue(i, valueOptions(row.field) ? $event : typedValue(row.field, $event))\"\n\t\t\t@remove=\"remove(i)\" />\n\t\t<NcButton variant=\"tertiary\" :disabled=\"fields.length === 0\" @click=\"add\">\n\t\t\t<template #icon>\n\t\t\t\t<Plus :size=\"18\" />\n\t\t\t</template>\n\t\t\t{{ t('nextcloud-vue', 'Add condition') }}\n\t\t</NcButton>\n\t</fieldset>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton } from '@nextcloud/vue'\nimport Plus from 'vue-material-design-icons/Plus.vue'\nimport CnConditionRow from './CnConditionRow.vue'\nimport { operatorLabel, operatorsForType, operatorTakesValue } from './conditionOperators.js'\n\n/**\n * CnConditionListEditor - the conditions of a rule as rows over an object's\n * own fields: field, operator, value. All rows hold together. The operators\n * follow the field's type (see `operatorsForType`), \"is filled in\" needs no\n * value, and the value is a choice for a choice or yes/no field.\n *\n * v-model on `{ field, operator, value }[]`, in both dialects (`value`/`input`\n * and `modelValue`/`update:modelValue`). Read a condition back as words with\n * `conditionSentence` from `./conditionOperators.js`.\n */\nexport default {\n\tname: 'CnConditionListEditor',\n\n\tcomponents: { CnConditionRow, NcButton, Plus },\n\n\tprops: {\n\t\t/**\n\t\t * The conditions.\n\t\t *\n\t\t * @type {Array<{field: string, operator: string, value?: unknown}>}\n\t\t */\n\t\tvalue: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The same value under Vue 3's v-model name; wins over `value` when passed.\n\t\t *\n\t\t * @type {Array}\n\t\t */\n\t\tmodelValue: { type: Array, default: undefined },\n\t\t/**\n\t\t * The fields a condition may name: `{ id, label, type, options?, format? }`.\n\t\t * `type` is number, integer, date, boolean, presence or anything else (text);\n\t\t * `options` (`[{ id, label }]`) make the value a choice.\n\t\t *\n\t\t * @type {Array<{id: string, label: string, type?: string, options?: Array}>}\n\t\t */\n\t\tfields: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The legend above the rows, already translated.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tlabel: { type: String, default: '' },\n\t\t/**\n\t\t * What an empty list says, already translated.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\temptyText: { type: String, default: '' },\n\t},\n\n\temits: ['input', 'update:modelValue'],\n\n\tdata() {\n\t\treturn {\n\t\t\trows: this.copy(this.modelValue !== undefined ? this.modelValue : this.value),\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The field choices.\n\t\t *\n\t\t * @return {Array<{id: string, label: string}>}\n\t\t */\n\t\tfieldOptions() {\n\t\t\treturn this.fields.map((f) => ({ id: f.id, label: f.label || f.id }))\n\t\t},\n\t},\n\n\twatch: {\n\t\tvalue(next) {\n\t\t\tif (this.modelValue === undefined) {\n\t\t\t\tthis.rows = this.copy(next)\n\t\t\t}\n\t\t},\n\n\t\tmodelValue(next) {\n\t\t\tif (next !== undefined) {\n\t\t\t\tthis.rows = this.copy(next)\n\t\t\t}\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A detached copy of the bound conditions.\n\t\t *\n\t\t * @param {Array} list The conditions.\n\t\t * @return {Array} The copy.\n\t\t */\n\t\tcopy(list) {\n\t\t\treturn (Array.isArray(list) ? list : []).map((row) => ({ ...row }))\n\t\t},\n\n\t\t/**\n\t\t * The field with this id.\n\t\t *\n\t\t * @param {string} id The field id.\n\t\t * @return {object|undefined}\n\t\t */\n\t\tfieldOf(id) {\n\t\t\treturn this.fields.find((f) => f.id === id)\n\t\t},\n\n\t\toperatorOptions(fieldId) {\n\t\t\treturn operatorsForType(this.fieldOf(fieldId)?.type).map((id) => ({ id, label: operatorLabel(id) }))\n\t\t},\n\n\t\ttakesValue(operator) {\n\t\t\treturn operatorTakesValue(operator)\n\t\t},\n\n\t\t/**\n\t\t * The value choices of a field, or null when its value is typed.\n\t\t *\n\t\t * @param {string} fieldId The field id.\n\t\t * @return {Array<{id: string, label: string}>|null}\n\t\t */\n\t\tvalueOptions(fieldId) {\n\t\t\tconst field = this.fieldOf(fieldId)\n\t\t\tif (field?.type === 'boolean') {\n\t\t\t\treturn [\n\t\t\t\t\t{ id: true, label: t('nextcloud-vue', 'Yes') },\n\t\t\t\t\t{ id: false, label: t('nextcloud-vue', 'No') },\n\t\t\t\t]\n\t\t\t}\n\t\t\tif (Array.isArray(field?.options) && field.options.length > 0) {\n\t\t\t\treturn field.options.map((o) => (typeof o === 'object'\n\t\t\t\t\t? { id: o.id ?? o.value, label: o.label ?? String(o.id ?? o.value) }\n\t\t\t\t\t: { id: o, label: String(o) }))\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\n\t\tinputType(fieldId) {\n\t\t\tconst type = this.fieldOf(fieldId)?.type\n\t\t\tif (type === 'number' || type === 'integer') {\n\t\t\t\treturn 'number'\n\t\t\t}\n\t\t\treturn type === 'date' ? 'date' : 'text'\n\t\t},\n\n\t\t/**\n\t\t * A typed value as stored: a number for a number field.\n\t\t *\n\t\t * @param {string} fieldId The field id.\n\t\t * @param {string} raw What was typed.\n\t\t * @return {string|number}\n\t\t */\n\t\ttypedValue(fieldId, raw) {\n\t\t\tconst type = this.fieldOf(fieldId)?.type\n\t\t\tif ((type === 'number' || type === 'integer') && raw !== '' && !Number.isNaN(Number(raw))) {\n\t\t\t\treturn Number(raw)\n\t\t\t}\n\t\t\treturn raw\n\t\t},\n\n\t\tsetField(i, option) {\n\t\t\tconst field = this.fieldOf(option?.id)\n\t\t\tconst operators = operatorsForType(field?.type)\n\t\t\tthis.rows[i] = { field: option?.id || '', operator: operators[0], value: field?.type === 'boolean' ? true : '' }\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tsetOperator(i, option) {\n\t\t\tconst row = { ...this.rows[i], operator: option?.id || 'eq' }\n\t\t\tif (!operatorTakesValue(row.operator)) {\n\t\t\t\tdelete row.value\n\t\t\t} else if (row.value === undefined) {\n\t\t\t\trow.value = ''\n\t\t\t}\n\t\t\tthis.rows[i] = row\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tsetValue(i, value) {\n\t\t\tthis.rows[i] = { ...this.rows[i], value }\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tadd() {\n\t\t\tthis.rows.push({ field: '', operator: 'eq', value: '' })\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\tremove(i) {\n\t\t\tthis.rows.splice(i, 1)\n\t\t\tthis.emitRows()\n\t\t},\n\n\t\t/**\n\t\t * Tell the consumer, in both v-model dialects.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\temitRows() {\n\t\t\tconst next = this.copy(this.rows)\n\t\t\t/**\n\t\t\t * The conditions changed.\n\t\t\t *\n\t\t\t * @event input\n\t\t\t * @type {Array}\n\t\t\t */\n\t\t\tthis.$emit('input', next)\n\t\t\t/**\n\t\t\t * The conditions changed (Vue 3 v-model).\n\t\t\t *\n\t\t\t * @event update:modelValue\n\t\t\t * @type {Array}\n\t\t\t */\n\t\t\tthis.$emit('update:modelValue', next)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-condition-list {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tborder: 0;\n\tmargin: 0;\n\tpadding: 0;\n\tmin-width: 0;\n}\n\n.cn-condition-list__label {\n\tfont-weight: 600;\n\tpadding: 0;\n\tmargin-bottom: 4px;\n}\n\n.cn-condition-list__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tmargin: 0;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_toDisplayString","_Fragment","_renderList","_createVNode"],"mappings":";;AAWW,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,mBAAmB,GAAA;;;AAC/B,EAAA,KAAA,EAAA,0BAAA;;;;AAGK,EAAA,KAAA,EAAA,0BAAA;;;;;;;;AAJP,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,aAAA;KACE,MAAA,CAAA,KAAA;sBAAHA,kBAES,CAAA,QAAA,EAFT,UAES,EAAAC,eAAA,CADL,MAAK,CAAA,KAAA,CAAA,EAAA,CAAA,YAAA;;AAED,IAAA,CAAA,KAAA,CAAA,IAAA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AAA,EAAA,UAAA;MAAA,QAAA,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,KAAA,CAAA;AAAA,MAAA,OAAA,EAAA,QAAA,CAAA,GAAA;;AACD,MAAA,IAAA;;;;;;;;;;;;;"}
@@ -0,0 +1,9 @@
1
+ import script from './CnConditionRow.vue2.js';
2
+ import { render } from './CnConditionRow.vue3.js';
3
+
4
+ script.render = render;
5
+ script.__scopeId = "data-v-e1c8a9e2";
6
+ const __sfc_main = script;
7
+
8
+ export { __sfc_main as default };
9
+ //# sourceMappingURL=CnConditionRow.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CnConditionRow.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -0,0 +1,120 @@
1
+ import { translate } from '@nextcloud/l10n';
2
+ import { NcButton, NcSelect, NcTextField } from '@nextcloud/vue';
3
+ import Close from 'vue-material-design-icons/Close.vue';
4
+
5
+ /**
6
+ * CnConditionRow - one condition as a row of field, operator and value, with
7
+ * a remove button. Shared by CnConditionListEditor and CnConditionGroupEditor;
8
+ * the editor owns the condition and decides the options, the row only draws
9
+ * them and reports what the user picked.
10
+ */
11
+ var script = {
12
+ name: 'CnConditionRow',
13
+
14
+ components: { NcButton, NcSelect, NcTextField, Close },
15
+
16
+ props: {
17
+ /**
18
+ * The condition drawn.
19
+ *
20
+ * @type {{field: string, operator: string, value?: unknown}}
21
+ */
22
+ condition: { type: Object, required: true },
23
+ /**
24
+ * The field choices, `[{ id, label }]`.
25
+ *
26
+ * @type {Array<{id: string, label: string}>}
27
+ */
28
+ fieldOptions: { type: Array, default: () => [] },
29
+ /**
30
+ * The operator choices for the condition's field, `[{ id, label }]`.
31
+ *
32
+ * @type {Array<{id: string, label: string}>}
33
+ */
34
+ operatorOptions: { type: Array, default: () => [] },
35
+ /**
36
+ * The value choices, or null when the value is typed.
37
+ *
38
+ * @type {Array<{id: unknown, label: string}>|null}
39
+ */
40
+ valueOptions: { type: Array, default: null },
41
+ /**
42
+ * The input type of a typed value: text, number or date.
43
+ *
44
+ * @type {string}
45
+ */
46
+ inputType: { type: String, default: 'text' },
47
+ /**
48
+ * Whether the operator takes a value.
49
+ *
50
+ * @type {boolean}
51
+ */
52
+ showValue: { type: Boolean, default: true },
53
+ /**
54
+ * Keep the field, operator and value labels for screen readers only.
55
+ *
56
+ * @type {boolean}
57
+ */
58
+ hideLabels: { type: Boolean, default: false },
59
+ /**
60
+ * The labels of the three controls, already translated. Missing keys
61
+ * read Field, Operator and Value.
62
+ *
63
+ * @type {{field?: string, operator?: string, value?: string}}
64
+ */
65
+ controlLabels: { type: Object, default: () => ({}) },
66
+ /**
67
+ * A message shown under the row, already translated.
68
+ *
69
+ * @type {string}
70
+ */
71
+ error: { type: String, default: '' },
72
+ },
73
+
74
+ emits: ['field', 'operator', 'value', 'remove'],
75
+
76
+ computed: {
77
+ labels() {
78
+ return {
79
+ field: this.controlLabels.field || translate('nextcloud-vue', 'Field'),
80
+ operator: this.controlLabels.operator || translate('nextcloud-vue', 'Operator'),
81
+ value: this.controlLabels.value || translate('nextcloud-vue', 'Value'),
82
+ }
83
+ },
84
+
85
+ fieldOption() {
86
+ return this.fieldOptions.find((o) => o.id === this.condition.field) || null
87
+ },
88
+
89
+ operatorOption() {
90
+ return this.operatorOptions.find((o) => o.id === this.condition.operator) || null
91
+ },
92
+
93
+ valueOption() {
94
+ return (this.valueOptions || []).find((o) => String(o.id) === String(this.condition.value)) || null
95
+ },
96
+
97
+ textValue() {
98
+ const value = this.condition.value;
99
+ return value === undefined || value === null ? '' : String(value)
100
+ },
101
+ },
102
+
103
+ methods: {
104
+ t: translate,
105
+
106
+ /**
107
+ * The label binding of a select: shown above it, or for screen
108
+ * readers only.
109
+ *
110
+ * @param {string} text The label.
111
+ * @return {object} The props.
112
+ */
113
+ selectLabel(text) {
114
+ return this.hideLabels ? { ariaLabelCombobox: text } : { inputLabel: text }
115
+ },
116
+ },
117
+ };
118
+
119
+ export { script as default };
120
+ //# sourceMappingURL=CnConditionRow.vue2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CnConditionRow.vue2.js","sources":["../../../../src/components/CnConditionListEditor/CnConditionRow.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-condition-row\" :class=\"{ 'cn-condition-row--error': !!error }\">\n\t\t<div class=\"cn-condition-row__controls\">\n\t\t\t<NcSelect\n\t\t\t\tclass=\"cn-condition-row__field\"\n\t\t\t\t:modelValue=\"fieldOption\"\n\t\t\t\t:options=\"fieldOptions\"\n\t\t\t\tlabel=\"label\"\n\t\t\t\tv-bind=\"selectLabel(labels.field)\"\n\t\t\t\t:clearable=\"false\"\n\t\t\t\t@update:modelValue=\"$emit('field', $event)\" />\n\t\t\t<NcSelect\n\t\t\t\tclass=\"cn-condition-row__operator\"\n\t\t\t\t:modelValue=\"operatorOption\"\n\t\t\t\t:options=\"operatorOptions\"\n\t\t\t\tlabel=\"label\"\n\t\t\t\tv-bind=\"selectLabel(labels.operator)\"\n\t\t\t\t:clearable=\"false\"\n\t\t\t\t:disabled=\"!condition.field\"\n\t\t\t\t@update:modelValue=\"$emit('operator', $event)\" />\n\t\t\t<template v-if=\"showValue\">\n\t\t\t\t<NcSelect\n\t\t\t\t\tv-if=\"valueOptions\"\n\t\t\t\t\tclass=\"cn-condition-row__value\"\n\t\t\t\t\t:modelValue=\"valueOption\"\n\t\t\t\t\t:options=\"valueOptions\"\n\t\t\t\t\tlabel=\"label\"\n\t\t\t\t\tv-bind=\"selectLabel(labels.value)\"\n\t\t\t\t\t:clearable=\"false\"\n\t\t\t\t\t:disabled=\"!condition.field\"\n\t\t\t\t\t@update:modelValue=\"$emit('value', $event ? $event.id : '')\" />\n\t\t\t\t<NcTextField\n\t\t\t\t\tv-else\n\t\t\t\t\tclass=\"cn-condition-row__value\"\n\t\t\t\t\t:type=\"inputType\"\n\t\t\t\t\t:modelValue=\"textValue\"\n\t\t\t\t\t:label=\"labels.value\"\n\t\t\t\t\t:disabled=\"!condition.field\"\n\t\t\t\t\t@update:modelValue=\"$emit('value', $event)\" />\n\t\t\t</template>\n\t\t\t<NcButton\n\t\t\t\tclass=\"cn-condition-row__remove\"\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Remove condition')\"\n\t\t\t\t:title=\"t('nextcloud-vue', 'Remove condition')\"\n\t\t\t\t@click=\"$emit('remove')\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<!-- @slot The remove button's icon; a close cross by default. -->\n\t\t\t\t\t<slot name=\"remove-icon\">\n\t\t\t\t\t\t<Close :size=\"18\" />\n\t\t\t\t\t</slot>\n\t\t\t\t</template>\n\t\t\t</NcButton>\n\t\t</div>\n\t\t<p v-if=\"error\" class=\"cn-condition-row__error\" role=\"alert\">\n\t\t\t{{ error }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcSelect, NcTextField } from '@nextcloud/vue'\nimport Close from 'vue-material-design-icons/Close.vue'\n\n/**\n * CnConditionRow - one condition as a row of field, operator and value, with\n * a remove button. Shared by CnConditionListEditor and CnConditionGroupEditor;\n * the editor owns the condition and decides the options, the row only draws\n * them and reports what the user picked.\n */\nexport default {\n\tname: 'CnConditionRow',\n\n\tcomponents: { NcButton, NcSelect, NcTextField, Close },\n\n\tprops: {\n\t\t/**\n\t\t * The condition drawn.\n\t\t *\n\t\t * @type {{field: string, operator: string, value?: unknown}}\n\t\t */\n\t\tcondition: { type: Object, required: true },\n\t\t/**\n\t\t * The field choices, `[{ id, label }]`.\n\t\t *\n\t\t * @type {Array<{id: string, label: string}>}\n\t\t */\n\t\tfieldOptions: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The operator choices for the condition's field, `[{ id, label }]`.\n\t\t *\n\t\t * @type {Array<{id: string, label: string}>}\n\t\t */\n\t\toperatorOptions: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The value choices, or null when the value is typed.\n\t\t *\n\t\t * @type {Array<{id: unknown, label: string}>|null}\n\t\t */\n\t\tvalueOptions: { type: Array, default: null },\n\t\t/**\n\t\t * The input type of a typed value: text, number or date.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tinputType: { type: String, default: 'text' },\n\t\t/**\n\t\t * Whether the operator takes a value.\n\t\t *\n\t\t * @type {boolean}\n\t\t */\n\t\tshowValue: { type: Boolean, default: true },\n\t\t/**\n\t\t * Keep the field, operator and value labels for screen readers only.\n\t\t *\n\t\t * @type {boolean}\n\t\t */\n\t\thideLabels: { type: Boolean, default: false },\n\t\t/**\n\t\t * The labels of the three controls, already translated. Missing keys\n\t\t * read Field, Operator and Value.\n\t\t *\n\t\t * @type {{field?: string, operator?: string, value?: string}}\n\t\t */\n\t\tcontrolLabels: { type: Object, default: () => ({}) },\n\t\t/**\n\t\t * A message shown under the row, already translated.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\terror: { type: String, default: '' },\n\t},\n\n\temits: ['field', 'operator', 'value', 'remove'],\n\n\tcomputed: {\n\t\tlabels() {\n\t\t\treturn {\n\t\t\t\tfield: this.controlLabels.field || t('nextcloud-vue', 'Field'),\n\t\t\t\toperator: this.controlLabels.operator || t('nextcloud-vue', 'Operator'),\n\t\t\t\tvalue: this.controlLabels.value || t('nextcloud-vue', 'Value'),\n\t\t\t}\n\t\t},\n\n\t\tfieldOption() {\n\t\t\treturn this.fieldOptions.find((o) => o.id === this.condition.field) || null\n\t\t},\n\n\t\toperatorOption() {\n\t\t\treturn this.operatorOptions.find((o) => o.id === this.condition.operator) || null\n\t\t},\n\n\t\tvalueOption() {\n\t\t\treturn (this.valueOptions || []).find((o) => String(o.id) === String(this.condition.value)) || null\n\t\t},\n\n\t\ttextValue() {\n\t\t\tconst value = this.condition.value\n\t\t\treturn value === undefined || value === null ? '' : String(value)\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * The label binding of a select: shown above it, or for screen\n\t\t * readers only.\n\t\t *\n\t\t * @param {string} text The label.\n\t\t * @return {object} The props.\n\t\t */\n\t\tselectLabel(text) {\n\t\t\treturn this.hideLabels ? { ariaLabelCombobox: text } : { inputLabel: text }\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-condition-row {\n\tmin-width: 0;\n}\n\n.cn-condition-row__controls {\n\tdisplay: grid;\n\tgrid-template-columns: var(--cn-condition-row-columns, minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1.6fr) auto);\n\tgap: 8px;\n\talign-items: var(--cn-condition-row-align, end);\n}\n\n.cn-condition-row__controls > :nth-child(3):last-child {\n\tgrid-column: 4;\n}\n\n.cn-condition-row__field,\n.cn-condition-row__operator,\n.cn-condition-row__value {\n\twidth: 100%;\n\tmin-width: 0;\n\tmargin: 0;\n}\n\n.cn-condition-row--error .cn-condition-row__controls :deep(input),\n.cn-condition-row--error .cn-condition-row__controls :deep(.vs__dropdown-toggle) {\n\tborder-color: var(--color-border-error, var(--color-error));\n}\n\n.cn-condition-row__error {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-error, var(--color-error));\n\tfont-size: 0.9em;\n}\n\n@media (max-width: 640px) {\n\t.cn-condition-row__controls {\n\t\tgrid-template-columns: minmax(0, 1fr) auto;\n\t}\n}\n</style>\n"],"names":["t"],"mappings":";;;;AAsEA;AACC;AACA;;AAEA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,gBAAgB;;CAEtB,UAAU,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAI,EAAG;;AAEtD,CAAA,KAAK,EAAE;AACN;AACC;AACA;;;AAGD,EAAA,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;AAC3C;AACC;AACA;AACA;;AAED,EAAA,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI;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S,CAAC,KAAK,CAAE,IAAG,IAAG;GAC1E;;AAED,EAAA,cAAc,GAAG;AAChB,GAAA,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAG,KAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAE,IAAG,IAAG;GAChF;;EAED,WAAW,GAAG;AACb,GAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA,KAAM,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA,IAAK,IAAG;GAClG;;EAED,SAAS,GAAG;AACX,GAAA,MAAM,KAAM,GAAE,IAAI,CAAC,SAAS,CAAC,MAAI;GACjC,OAAO,KAAM,KAAI,SAAU,IAAG,KAAM,KAAI,IAAK,GAAE,EAAC,GAAI,MAAM,CAAC,KAAK,CAAA;GAChE;EACD;;AAED,CAAA,OAAO,EAAE;KACRA,SAAC;;AAED;;;AAGC;;;;AAID,EAAA,WAAW,CAAC,IAAI,EAAE;AACjB,GAAA,OAAO,IAAI,CAAC,UAAS,GAAI,EAAE,iBAAiB,EAAE,IAAG,EAAI,GAAE,EAAE,UAAU,EAAE,IAAK,EAAA;GAC1E;EACD;AACF;;;;"}
@@ -0,0 +1,86 @@
1
+ import { resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createVNode, mergeProps, Fragment, createBlock, createCommentVNode, withCtx, renderSlot, toDisplayString } from 'vue';
2
+
3
+ const _hoisted_1 = { class: "cn-condition-row__controls" };
4
+ const _hoisted_2 = {
5
+ key: 0,
6
+ class: "cn-condition-row__error",
7
+ role: "alert"
8
+ };
9
+
10
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
11
+ const _component_NcSelect = resolveComponent("NcSelect");
12
+ const _component_NcTextField = resolveComponent("NcTextField");
13
+ const _component_Close = resolveComponent("Close");
14
+ const _component_NcButton = resolveComponent("NcButton");
15
+
16
+ return (openBlock(), createElementBlock("div", {
17
+ class: normalizeClass(["cn-condition-row", { 'cn-condition-row--error': !!$props.error }])
18
+ }, [
19
+ createElementVNode("div", _hoisted_1, [
20
+ createVNode(_component_NcSelect, mergeProps({
21
+ class: "cn-condition-row__field",
22
+ modelValue: $options.fieldOption,
23
+ options: $props.fieldOptions,
24
+ label: "label"
25
+ }, $options.selectLabel($options.labels.field), {
26
+ clearable: false,
27
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (_ctx.$emit('field', $event)))
28
+ }), null, 16 /* FULL_PROPS */, ["modelValue", "options"]),
29
+ createVNode(_component_NcSelect, mergeProps({
30
+ class: "cn-condition-row__operator",
31
+ modelValue: $options.operatorOption,
32
+ options: $props.operatorOptions,
33
+ label: "label"
34
+ }, $options.selectLabel($options.labels.operator), {
35
+ clearable: false,
36
+ disabled: !$props.condition.field,
37
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (_ctx.$emit('operator', $event)))
38
+ }), null, 16 /* FULL_PROPS */, ["modelValue", "options", "disabled"]),
39
+ ($props.showValue)
40
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
41
+ ($props.valueOptions)
42
+ ? (openBlock(), createBlock(_component_NcSelect, mergeProps({
43
+ key: 0,
44
+ class: "cn-condition-row__value",
45
+ modelValue: $options.valueOption,
46
+ options: $props.valueOptions,
47
+ label: "label"
48
+ }, $options.selectLabel($options.labels.value), {
49
+ clearable: false,
50
+ disabled: !$props.condition.field,
51
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => (_ctx.$emit('value', $event ? $event.id : '')))
52
+ }), null, 16 /* FULL_PROPS */, ["modelValue", "options", "disabled"]))
53
+ : (openBlock(), createBlock(_component_NcTextField, {
54
+ key: 1,
55
+ class: "cn-condition-row__value",
56
+ type: $props.inputType,
57
+ modelValue: $options.textValue,
58
+ label: $options.labels.value,
59
+ disabled: !$props.condition.field,
60
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = $event => (_ctx.$emit('value', $event)))
61
+ }, null, 8 /* PROPS */, ["type", "modelValue", "label", "disabled"]))
62
+ ], 64 /* STABLE_FRAGMENT */))
63
+ : createCommentVNode("v-if", true),
64
+ createVNode(_component_NcButton, {
65
+ class: "cn-condition-row__remove",
66
+ variant: "tertiary",
67
+ "aria-label": $options.t('nextcloud-vue', 'Remove condition'),
68
+ title: $options.t('nextcloud-vue', 'Remove condition'),
69
+ onClick: _cache[4] || (_cache[4] = $event => (_ctx.$emit('remove')))
70
+ }, {
71
+ icon: withCtx(() => [
72
+ renderSlot(_ctx.$slots, "remove-icon", {}, () => [
73
+ createVNode(_component_Close, { size: 18 })
74
+ ])
75
+ ]),
76
+ _: 3 /* FORWARDED */
77
+ }, 8 /* PROPS */, ["aria-label", "title"])
78
+ ]),
79
+ ($props.error)
80
+ ? (openBlock(), createElementBlock("p", _hoisted_2, toDisplayString($props.error), 1 /* TEXT */))
81
+ : createCommentVNode("v-if", true)
82
+ ], 2 /* CLASS */))
83
+ }
84
+
85
+ export { render };
86
+ //# sourceMappingURL=CnConditionRow.vue3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CnConditionRow.vue3.js","sources":["../../../../src/components/CnConditionListEditor/CnConditionRow.vue?vue&type=template&id=e1c8a9e2&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-condition-row\" :class=\"{ 'cn-condition-row--error': !!error }\">\n\t\t<div class=\"cn-condition-row__controls\">\n\t\t\t<NcSelect\n\t\t\t\tclass=\"cn-condition-row__field\"\n\t\t\t\t:modelValue=\"fieldOption\"\n\t\t\t\t:options=\"fieldOptions\"\n\t\t\t\tlabel=\"label\"\n\t\t\t\tv-bind=\"selectLabel(labels.field)\"\n\t\t\t\t:clearable=\"false\"\n\t\t\t\t@update:modelValue=\"$emit('field', $event)\" />\n\t\t\t<NcSelect\n\t\t\t\tclass=\"cn-condition-row__operator\"\n\t\t\t\t:modelValue=\"operatorOption\"\n\t\t\t\t:options=\"operatorOptions\"\n\t\t\t\tlabel=\"label\"\n\t\t\t\tv-bind=\"selectLabel(labels.operator)\"\n\t\t\t\t:clearable=\"false\"\n\t\t\t\t:disabled=\"!condition.field\"\n\t\t\t\t@update:modelValue=\"$emit('operator', $event)\" />\n\t\t\t<template v-if=\"showValue\">\n\t\t\t\t<NcSelect\n\t\t\t\t\tv-if=\"valueOptions\"\n\t\t\t\t\tclass=\"cn-condition-row__value\"\n\t\t\t\t\t:modelValue=\"valueOption\"\n\t\t\t\t\t:options=\"valueOptions\"\n\t\t\t\t\tlabel=\"label\"\n\t\t\t\t\tv-bind=\"selectLabel(labels.value)\"\n\t\t\t\t\t:clearable=\"false\"\n\t\t\t\t\t:disabled=\"!condition.field\"\n\t\t\t\t\t@update:modelValue=\"$emit('value', $event ? $event.id : '')\" />\n\t\t\t\t<NcTextField\n\t\t\t\t\tv-else\n\t\t\t\t\tclass=\"cn-condition-row__value\"\n\t\t\t\t\t:type=\"inputType\"\n\t\t\t\t\t:modelValue=\"textValue\"\n\t\t\t\t\t:label=\"labels.value\"\n\t\t\t\t\t:disabled=\"!condition.field\"\n\t\t\t\t\t@update:modelValue=\"$emit('value', $event)\" />\n\t\t\t</template>\n\t\t\t<NcButton\n\t\t\t\tclass=\"cn-condition-row__remove\"\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Remove condition')\"\n\t\t\t\t:title=\"t('nextcloud-vue', 'Remove condition')\"\n\t\t\t\t@click=\"$emit('remove')\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<!-- @slot The remove button's icon; a close cross by default. -->\n\t\t\t\t\t<slot name=\"remove-icon\">\n\t\t\t\t\t\t<Close :size=\"18\" />\n\t\t\t\t\t</slot>\n\t\t\t\t</template>\n\t\t\t</NcButton>\n\t\t</div>\n\t\t<p v-if=\"error\" class=\"cn-condition-row__error\" role=\"alert\">\n\t\t\t{{ error }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcSelect, NcTextField } from '@nextcloud/vue'\nimport Close from 'vue-material-design-icons/Close.vue'\n\n/**\n * CnConditionRow - one condition as a row of field, operator and value, with\n * a remove button. Shared by CnConditionListEditor and CnConditionGroupEditor;\n * the editor owns the condition and decides the options, the row only draws\n * them and reports what the user picked.\n */\nexport default {\n\tname: 'CnConditionRow',\n\n\tcomponents: { NcButton, NcSelect, NcTextField, Close },\n\n\tprops: {\n\t\t/**\n\t\t * The condition drawn.\n\t\t *\n\t\t * @type {{field: string, operator: string, value?: unknown}}\n\t\t */\n\t\tcondition: { type: Object, required: true },\n\t\t/**\n\t\t * The field choices, `[{ id, label }]`.\n\t\t *\n\t\t * @type {Array<{id: string, label: string}>}\n\t\t */\n\t\tfieldOptions: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The operator choices for the condition's field, `[{ id, label }]`.\n\t\t *\n\t\t * @type {Array<{id: string, label: string}>}\n\t\t */\n\t\toperatorOptions: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The value choices, or null when the value is typed.\n\t\t *\n\t\t * @type {Array<{id: unknown, label: string}>|null}\n\t\t */\n\t\tvalueOptions: { type: Array, default: null },\n\t\t/**\n\t\t * The input type of a typed value: text, number or date.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tinputType: { type: String, default: 'text' },\n\t\t/**\n\t\t * Whether the operator takes a value.\n\t\t *\n\t\t * @type {boolean}\n\t\t */\n\t\tshowValue: { type: Boolean, default: true },\n\t\t/**\n\t\t * Keep the field, operator and value labels for screen readers only.\n\t\t *\n\t\t * @type {boolean}\n\t\t */\n\t\thideLabels: { type: Boolean, default: false },\n\t\t/**\n\t\t * The labels of the three controls, already translated. Missing keys\n\t\t * read Field, Operator and Value.\n\t\t *\n\t\t * @type {{field?: string, operator?: string, value?: string}}\n\t\t */\n\t\tcontrolLabels: { type: Object, default: () => ({}) },\n\t\t/**\n\t\t * A message shown under the row, already translated.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\terror: { type: String, default: '' },\n\t},\n\n\temits: ['field', 'operator', 'value', 'remove'],\n\n\tcomputed: {\n\t\tlabels() {\n\t\t\treturn {\n\t\t\t\tfield: this.controlLabels.field || t('nextcloud-vue', 'Field'),\n\t\t\t\toperator: this.controlLabels.operator || t('nextcloud-vue', 'Operator'),\n\t\t\t\tvalue: this.controlLabels.value || t('nextcloud-vue', 'Value'),\n\t\t\t}\n\t\t},\n\n\t\tfieldOption() {\n\t\t\treturn this.fieldOptions.find((o) => o.id === this.condition.field) || null\n\t\t},\n\n\t\toperatorOption() {\n\t\t\treturn this.operatorOptions.find((o) => o.id === this.condition.operator) || null\n\t\t},\n\n\t\tvalueOption() {\n\t\t\treturn (this.valueOptions || []).find((o) => String(o.id) === String(this.condition.value)) || null\n\t\t},\n\n\t\ttextValue() {\n\t\t\tconst value = this.condition.value\n\t\t\treturn value === undefined || value === null ? '' : String(value)\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * The label binding of a select: shown above it, or for screen\n\t\t * readers only.\n\t\t *\n\t\t * @param {string} text The label.\n\t\t * @return {object} The props.\n\t\t */\n\t\tselectLabel(text) {\n\t\t\treturn this.hideLabels ? { ariaLabelCombobox: text } : { inputLabel: text }\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-condition-row {\n\tmin-width: 0;\n}\n\n.cn-condition-row__controls {\n\tdisplay: grid;\n\tgrid-template-columns: var(--cn-condition-row-columns, minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1.6fr) auto);\n\tgap: 8px;\n\talign-items: var(--cn-condition-row-align, end);\n}\n\n.cn-condition-row__controls > :nth-child(3):last-child {\n\tgrid-column: 4;\n}\n\n.cn-condition-row__field,\n.cn-condition-row__operator,\n.cn-condition-row__value {\n\twidth: 100%;\n\tmin-width: 0;\n\tmargin: 0;\n}\n\n.cn-condition-row--error .cn-condition-row__controls :deep(input),\n.cn-condition-row--error .cn-condition-row__controls :deep(.vs__dropdown-toggle) {\n\tborder-color: var(--color-border-error, var(--color-error));\n}\n\n.cn-condition-row__error {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-error, var(--color-error));\n\tfont-size: 0.9em;\n}\n\n@media (max-width: 640px) {\n\t.cn-condition-row__controls {\n\t\tgrid-template-columns: minmax(0, 1fr) auto;\n\t}\n}\n</style>\n"],"names":["_normalizeClass","_createVNode","_mergeProps","_Fragment","_createBlock","_renderSlot"],"mappings":";;AAYO,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,4BAAG,GAAA;;;;;;;;;;;;;;IADV,KAAK,EAAAA,cAAA,CAAA,CAAC,kBAAc,EAAA,EAAA,yBAAA,EAAA,CAAA,CAAA,MAAA,CAAA,KAAA,EAAA,CAAA,CAAA;;;AAEtB,MAAAC,WAAA,CAOY,qBAPZC,UAOY,CAAA;AANZ,QAAA,KAAK,EAAC,yBAAW;AAChB,QAAA,UAAU,EAAE,QAAW,CAAA,WAAA;AACvB,QAAA,OAAM,EAAA,MAAA,CAAA,YAAA;AACP,QAAA,KAAK,EAAC,OAAO;SACL,QAAW,CAAA,WAAA,CAAC,QAAM,CAAA,MAAA,CAAC,KAAA,CAAA,EAAA;AAC1B,QAAA,SAAS,EAAE,KAAK;QAChB,qBAAW,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,MAAA,KAAA,IAAA,CAAA,KAAA,CAAA,OAAA,EAAA,MAAA,CAAA,CAAA,CAAA;;AACZ,MAAAD,WAAA,CAQyB,qBARzBC,UAQyB,CAAA;AAPzB,QAAA,KAAK,EAAC,4BAAW;AAChB,QAAA,UAAU,EAAE,QAAc,CAAA,cAAA;AAC1B,QAAA,OAAO,EAAE,MAAe,CAAA,eAAA;AACzB,QAAA,KAAK,EAAC,OAAO;SACL,QAAA,CAAA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,KAAA,CAAA,OAAA,EAAU,MAAM,CAAA,CAAA,CAAA;;;;iBAcxC,CAAA,mBAAA,EAAA;AAXF,QAAA,KAAK,EAAC,0BAAS;eACR,EAAC,UAAU;AACjB,QAAA,YAAU,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,kBAAA,CAAA;AACZ,QAAA,KAAI,UAAG,CAAA,CAAA,CAAA,eAAA,EAAA,kBAAA,CAAA;AACR,QAAA,OAAK,uCAAC,IAAA,CAAA,KAAA,CAAA,QAAA,CAAA,CAAA,CAAA;;AACG,QAAA,IAAA,UAET,MAEO;AAFP,UAAAC,UAAA,CAEO,gCAFP,MAEO;YADNJ,WAAoB,CAAA,gBAAA,EAAA,EAAZ,IAAI,EAAE,EAAE,EAAA,CAAA;;;;;;;;;;;;;;"}
@@ -2404,7 +2404,7 @@ var script = {
2404
2404
  },
2405
2405
 
2406
2406
  /**
2407
- * Whether row 2 has a meta line or header chips to draw after the
2407
+ * Whether row 2 has a meta line or header chips to draw beside the
2408
2408
  * breadcrumb.
2409
2409
  *
2410
2410
  * @return {boolean} True with meta or chips.