@nextcloud/vue 8.0.0-beta.9 → 8.0.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.
Files changed (292) hide show
  1. package/CHANGELOG.md +52 -2
  2. package/dist/Components/NcActionButton.cjs +23 -12
  3. package/dist/Components/NcActionButton.cjs.map +1 -1
  4. package/dist/Components/NcActionButton.mjs +21 -9
  5. package/dist/Components/NcActionButton.mjs.map +1 -1
  6. package/dist/Components/NcActionInput.cjs +1 -1
  7. package/dist/Components/NcActionInput.mjs +1 -1
  8. package/dist/Components/NcActionLink.cjs +1 -1
  9. package/dist/Components/NcActionLink.mjs +1 -1
  10. package/dist/Components/NcActionRouter.cjs +1 -1
  11. package/dist/Components/NcActionRouter.mjs +1 -1
  12. package/dist/Components/NcActionText.cjs +1 -1
  13. package/dist/Components/NcActionText.mjs +1 -1
  14. package/dist/Components/NcActionTextEditable.cjs +10 -10
  15. package/dist/Components/NcActionTextEditable.cjs.map +1 -1
  16. package/dist/Components/NcActionTextEditable.mjs +1 -1
  17. package/dist/Components/NcActions.cjs +55 -52
  18. package/dist/Components/NcActions.cjs.map +1 -1
  19. package/dist/Components/NcActions.mjs +44 -41
  20. package/dist/Components/NcActions.mjs.map +1 -1
  21. package/dist/Components/NcAppContent.cjs +19 -20
  22. package/dist/Components/NcAppContent.cjs.map +1 -1
  23. package/dist/Components/NcAppContent.mjs +8 -8
  24. package/dist/Components/NcAppContent.mjs.map +1 -1
  25. package/dist/Components/NcAppNavigation.cjs +58 -27
  26. package/dist/Components/NcAppNavigation.cjs.map +1 -1
  27. package/dist/Components/NcAppNavigation.mjs +67 -34
  28. package/dist/Components/NcAppNavigation.mjs.map +1 -1
  29. package/dist/Components/NcAppNavigationItem.cjs +166 -62
  30. package/dist/Components/NcAppNavigationItem.cjs.map +1 -1
  31. package/dist/Components/NcAppNavigationItem.mjs +145 -43
  32. package/dist/Components/NcAppNavigationItem.mjs.map +1 -1
  33. package/dist/Components/NcAppNavigationNew.cjs +6 -6
  34. package/dist/Components/NcAppNavigationNew.cjs.map +1 -1
  35. package/dist/Components/NcAppNavigationNew.mjs +17 -17
  36. package/dist/Components/NcAppNavigationNew.mjs.map +1 -1
  37. package/dist/Components/NcAppNavigationNewItem.cjs +7 -7
  38. package/dist/Components/NcAppNavigationNewItem.cjs.map +1 -1
  39. package/dist/Components/NcAppNavigationNewItem.mjs +5 -5
  40. package/dist/Components/NcAppNavigationNewItem.mjs.map +1 -1
  41. package/dist/Components/NcAppNavigationSettings.cjs +46 -14
  42. package/dist/Components/NcAppNavigationSettings.cjs.map +1 -1
  43. package/dist/Components/NcAppNavigationSettings.mjs +48 -16
  44. package/dist/Components/NcAppNavigationSettings.mjs.map +1 -1
  45. package/dist/Components/NcAppNavigationToggle.cjs +1 -1
  46. package/dist/Components/NcAppNavigationToggle.mjs +1 -1
  47. package/dist/Components/NcAppSettingsDialog.cjs +75 -54
  48. package/dist/Components/NcAppSettingsDialog.cjs.map +1 -1
  49. package/dist/Components/NcAppSettingsDialog.mjs +79 -57
  50. package/dist/Components/NcAppSettingsDialog.mjs.map +1 -1
  51. package/dist/Components/NcAppSettingsSection.cjs +29 -10
  52. package/dist/Components/NcAppSettingsSection.cjs.map +1 -1
  53. package/dist/Components/NcAppSettingsSection.mjs +29 -10
  54. package/dist/Components/NcAppSettingsSection.mjs.map +1 -1
  55. package/dist/Components/NcAppSidebar.cjs +99 -33
  56. package/dist/Components/NcAppSidebar.cjs.map +1 -1
  57. package/dist/Components/NcAppSidebar.mjs +156 -92
  58. package/dist/Components/NcAppSidebar.mjs.map +1 -1
  59. package/dist/Components/NcAppSidebarTab.cjs +7 -7
  60. package/dist/Components/NcAppSidebarTab.cjs.map +1 -1
  61. package/dist/Components/NcAppSidebarTab.mjs +6 -6
  62. package/dist/Components/NcAppSidebarTab.mjs.map +1 -1
  63. package/dist/Components/NcAvatar.cjs +1 -1
  64. package/dist/Components/NcAvatar.mjs +1 -1
  65. package/dist/Components/NcBreadcrumb.cjs +10 -10
  66. package/dist/Components/NcBreadcrumb.cjs.map +1 -1
  67. package/dist/Components/NcBreadcrumb.mjs +1 -1
  68. package/dist/Components/NcBreadcrumbs.cjs +85 -53
  69. package/dist/Components/NcBreadcrumbs.cjs.map +1 -1
  70. package/dist/Components/NcBreadcrumbs.mjs +91 -60
  71. package/dist/Components/NcBreadcrumbs.mjs.map +1 -1
  72. package/dist/Components/NcButton.cjs +25 -25
  73. package/dist/Components/NcButton.cjs.map +1 -1
  74. package/dist/Components/NcButton.mjs +25 -25
  75. package/dist/Components/NcButton.mjs.map +1 -1
  76. package/dist/Components/NcCheckboxRadioSwitch.cjs +305 -67
  77. package/dist/Components/NcCheckboxRadioSwitch.cjs.map +1 -1
  78. package/dist/Components/NcCheckboxRadioSwitch.mjs +307 -75
  79. package/dist/Components/NcCheckboxRadioSwitch.mjs.map +1 -1
  80. package/dist/Components/NcColorPicker.cjs +18 -18
  81. package/dist/Components/NcColorPicker.cjs.map +1 -1
  82. package/dist/Components/NcColorPicker.mjs +17 -17
  83. package/dist/Components/NcColorPicker.mjs.map +1 -1
  84. package/dist/Components/NcCounterBubble.cjs +6 -6
  85. package/dist/Components/NcCounterBubble.cjs.map +1 -1
  86. package/dist/Components/NcCounterBubble.mjs +2 -2
  87. package/dist/Components/NcCounterBubble.mjs.map +1 -1
  88. package/dist/Components/NcDashboardWidget.cjs +30 -30
  89. package/dist/Components/NcDashboardWidget.cjs.map +1 -1
  90. package/dist/Components/NcDashboardWidget.mjs +3 -3
  91. package/dist/Components/NcDashboardWidgetItem.cjs +1 -1
  92. package/dist/Components/NcDashboardWidgetItem.mjs +1 -1
  93. package/dist/Components/NcDateTime.cjs +1 -1
  94. package/dist/Components/NcDateTime.mjs +1 -1
  95. package/dist/Components/NcDateTimePicker.cjs +109 -44
  96. package/dist/Components/NcDateTimePicker.cjs.map +1 -1
  97. package/dist/Components/NcDateTimePicker.mjs +115 -52
  98. package/dist/Components/NcDateTimePicker.mjs.map +1 -1
  99. package/dist/Components/NcDateTimePickerNative.cjs +1 -1
  100. package/dist/Components/NcDateTimePickerNative.mjs +1 -1
  101. package/dist/Components/NcDialogButton.cjs +11 -11
  102. package/dist/Components/NcDialogButton.cjs.map +1 -1
  103. package/dist/Components/NcDialogButton.mjs +14 -14
  104. package/dist/Components/NcDialogButton.mjs.map +1 -1
  105. package/dist/Components/NcEmojiPicker.cjs +1 -1
  106. package/dist/Components/NcEmojiPicker.mjs +1 -1
  107. package/dist/Components/NcEmptyContent.cjs +14 -14
  108. package/dist/Components/NcEmptyContent.cjs.map +1 -1
  109. package/dist/Components/NcEmptyContent.mjs +7 -7
  110. package/dist/Components/NcEmptyContent.mjs.map +1 -1
  111. package/dist/Components/NcInputField.cjs +16 -16
  112. package/dist/Components/NcInputField.cjs.map +1 -1
  113. package/dist/Components/NcInputField.mjs +5 -5
  114. package/dist/Components/NcInputField.mjs.map +1 -1
  115. package/dist/Components/NcListItem.cjs +3 -3
  116. package/dist/Components/NcListItem.cjs.map +1 -1
  117. package/dist/Components/NcListItem.mjs +3 -3
  118. package/dist/Components/NcListItem.mjs.map +1 -1
  119. package/dist/Components/NcListItemIcon.cjs +1 -1
  120. package/dist/Components/NcListItemIcon.mjs +1 -1
  121. package/dist/Components/NcModal.cjs +165 -68
  122. package/dist/Components/NcModal.cjs.map +1 -1
  123. package/dist/Components/NcModal.mjs +129 -35
  124. package/dist/Components/NcModal.mjs.map +1 -1
  125. package/dist/Components/NcNoteCard.cjs +146 -18
  126. package/dist/Components/NcNoteCard.cjs.map +1 -1
  127. package/dist/Components/NcNoteCard.mjs +146 -21
  128. package/dist/Components/NcNoteCard.mjs.map +1 -1
  129. package/dist/Components/NcPasswordField.cjs +84 -20
  130. package/dist/Components/NcPasswordField.cjs.map +1 -1
  131. package/dist/Components/NcPasswordField.mjs +104 -42
  132. package/dist/Components/NcPasswordField.mjs.map +1 -1
  133. package/dist/Components/NcRelatedResourcesPanel.cjs +48 -31
  134. package/dist/Components/NcRelatedResourcesPanel.cjs.map +1 -1
  135. package/dist/Components/NcRelatedResourcesPanel.mjs +31 -14
  136. package/dist/Components/NcRelatedResourcesPanel.mjs.map +1 -1
  137. package/dist/Components/NcRichContenteditable.cjs +22 -18
  138. package/dist/Components/NcRichContenteditable.cjs.map +1 -1
  139. package/dist/Components/NcRichContenteditable.mjs +32 -28
  140. package/dist/Components/NcRichContenteditable.mjs.map +1 -1
  141. package/dist/Components/NcRichText.cjs +1 -1
  142. package/dist/Components/NcRichText.mjs +3 -3
  143. package/dist/Components/NcSelect.cjs +80 -57
  144. package/dist/Components/NcSelect.cjs.map +1 -1
  145. package/dist/Components/NcSelect.mjs +75 -50
  146. package/dist/Components/NcSelect.mjs.map +1 -1
  147. package/dist/Components/NcSelectTags.cjs +2 -2
  148. package/dist/Components/NcSelectTags.cjs.map +1 -1
  149. package/dist/Components/NcSelectTags.mjs +4 -4
  150. package/dist/Components/NcSelectTags.mjs.map +1 -1
  151. package/dist/Components/NcSettingsInputText.cjs +1 -1
  152. package/dist/Components/NcSettingsInputText.mjs +1 -1
  153. package/dist/Components/NcSettingsSection.cjs +46 -14
  154. package/dist/Components/NcSettingsSection.cjs.map +1 -1
  155. package/dist/Components/NcSettingsSection.mjs +44 -12
  156. package/dist/Components/NcSettingsSection.mjs.map +1 -1
  157. package/dist/Components/NcSettingsSelectGroup.cjs +1 -1
  158. package/dist/Components/NcSettingsSelectGroup.mjs +1 -1
  159. package/dist/Components/NcTextArea.cjs +14 -14
  160. package/dist/Components/NcTextArea.cjs.map +1 -1
  161. package/dist/Components/NcTextArea.mjs +6 -6
  162. package/dist/Components/NcTextArea.mjs.map +1 -1
  163. package/dist/Components/NcTextField.cjs +51 -19
  164. package/dist/Components/NcTextField.cjs.map +1 -1
  165. package/dist/Components/NcTextField.mjs +59 -28
  166. package/dist/Components/NcTextField.mjs.map +1 -1
  167. package/dist/Components/NcTimezonePicker.cjs +32 -24
  168. package/dist/Components/NcTimezonePicker.cjs.map +1 -1
  169. package/dist/Components/NcTimezonePicker.mjs +36 -27
  170. package/dist/Components/NcTimezonePicker.mjs.map +1 -1
  171. package/dist/Components/NcUserBubble.cjs +24 -20
  172. package/dist/Components/NcUserBubble.cjs.map +1 -1
  173. package/dist/Components/NcUserBubble.mjs +25 -20
  174. package/dist/Components/NcUserBubble.mjs.map +1 -1
  175. package/dist/assets/{NcAppNavigationToggle-2cc5b864.css → NcAppNavigationToggle-9e170630.css} +3 -2
  176. package/dist/assets/{NcInputConfirmCancel-2ba60a52.css → NcInputConfirmCancel-45d1d76b.css} +7 -7
  177. package/dist/assets/{index-af72a30b.css → index-05760fea.css} +5 -1
  178. package/dist/assets/{index-30e099f7.css → index-0ac09203.css} +3 -3
  179. package/dist/assets/{index-eea65531.css → index-0e9b11c7.css} +20 -16
  180. package/dist/assets/{index-7813bab3.css → index-17673ea1.css} +7 -9
  181. package/dist/assets/{index-1151d229.css → index-1f25a3c0.css} +3 -3
  182. package/dist/assets/{index-9dcf6260.css → index-2e5e3b55.css} +30 -30
  183. package/dist/assets/{index-ed4adf1d.css → index-4271da53.css} +18 -17
  184. package/dist/assets/{index-abb90c97.css → index-4e03d941.css} +48 -48
  185. package/dist/assets/{index-4b75fe20.css → index-55600948.css} +11 -11
  186. package/dist/assets/{index-236620b0.css → index-6899d75b.css} +29 -29
  187. package/dist/assets/{index-5ee8a575.css → index-73ded07b.css} +63 -63
  188. package/dist/assets/{index-1beccc92.css → index-750c02cc.css} +28 -10
  189. package/dist/assets/{index-9e9587e1.css → index-77a548be.css} +4 -4
  190. package/dist/assets/{index-c5ae3bc4.css → index-7d211db9.css} +11 -11
  191. package/dist/assets/{index-8304db49.css → index-802d2118.css} +5 -1
  192. package/dist/assets/{index-a2d55f92.css → index-9176105d.css} +41 -41
  193. package/dist/assets/index-93bc89ef.css +197 -0
  194. package/dist/assets/{index-50b0766d.css → index-a0532427.css} +55 -70
  195. package/dist/assets/{index-e828b286.css → index-ab715d82.css} +4 -4
  196. package/dist/assets/{index-9e44e336.css → index-c221fe05.css} +9 -9
  197. package/dist/assets/{index-c6f0da2e.css → index-c239a2fc.css} +14 -8
  198. package/dist/assets/{index-73867d38.css → index-d3702c91.css} +5 -1
  199. package/dist/assets/{index-4a775ba1.css → index-d812ed9e.css} +43 -43
  200. package/dist/assets/{index-793eae6b.css → index-d9ae9479.css} +6 -6
  201. package/dist/assets/{index-f85aa003.css → index-db5a8b1c.css} +22 -10
  202. package/dist/assets/{index-574438d6.css → index-dea0aef3.css} +10 -10
  203. package/dist/assets/{index-0adc989c.css → index-ebbb7829.css} +9 -13
  204. package/dist/assets/{index-c06ad941.css → index-fbc0b606.css} +58 -42
  205. package/dist/chunks/AlertCircleOutline-7085c10f.cjs +35 -0
  206. package/dist/chunks/AlertCircleOutline-7085c10f.cjs.map +1 -0
  207. package/dist/chunks/AlertCircleOutline-b73838e0.mjs +37 -0
  208. package/dist/chunks/AlertCircleOutline-b73838e0.mjs.map +1 -0
  209. package/dist/chunks/ArrowLeft-2f9b9323.cjs +35 -0
  210. package/dist/chunks/ArrowLeft-2f9b9323.cjs.map +1 -0
  211. package/dist/chunks/ArrowLeft-3779ba88.mjs +37 -0
  212. package/dist/chunks/ArrowLeft-3779ba88.mjs.map +1 -0
  213. package/dist/chunks/ArrowRight-7315f6c1.cjs +35 -0
  214. package/dist/chunks/ArrowRight-7315f6c1.cjs.map +1 -0
  215. package/dist/chunks/ArrowRight-74a9fcb2.mjs +37 -0
  216. package/dist/chunks/ArrowRight-74a9fcb2.mjs.map +1 -0
  217. package/dist/chunks/Check-2ea0a88a.mjs +37 -0
  218. package/dist/chunks/Check-2ea0a88a.mjs.map +1 -0
  219. package/dist/chunks/Check-be8cd6af.cjs +35 -0
  220. package/dist/chunks/Check-be8cd6af.cjs.map +1 -0
  221. package/dist/chunks/ChevronDown-a72d365d.mjs +37 -0
  222. package/dist/chunks/ChevronDown-a72d365d.mjs.map +1 -0
  223. package/dist/chunks/ChevronDown-dc32e51d.cjs +35 -0
  224. package/dist/chunks/ChevronDown-dc32e51d.cjs.map +1 -0
  225. package/dist/chunks/ChevronRight-1a6a6cf2.mjs +37 -0
  226. package/dist/chunks/ChevronRight-1a6a6cf2.mjs.map +1 -0
  227. package/dist/chunks/ChevronRight-a4c1e0d3.cjs +35 -0
  228. package/dist/chunks/ChevronRight-a4c1e0d3.cjs.map +1 -0
  229. package/dist/chunks/Close-271f72e2.mjs +37 -0
  230. package/dist/chunks/Close-271f72e2.mjs.map +1 -0
  231. package/dist/chunks/Close-98cb6f12.cjs +35 -0
  232. package/dist/chunks/Close-98cb6f12.cjs.map +1 -0
  233. package/dist/chunks/DotsHorizontal-0ee7d901.mjs +37 -0
  234. package/dist/chunks/DotsHorizontal-0ee7d901.mjs.map +1 -0
  235. package/dist/chunks/DotsHorizontal-ac96129a.cjs +35 -0
  236. package/dist/chunks/DotsHorizontal-ac96129a.cjs.map +1 -0
  237. package/dist/chunks/NcAppNavigationToggle-60664a28.cjs +113 -0
  238. package/dist/chunks/NcAppNavigationToggle-60664a28.cjs.map +1 -0
  239. package/dist/chunks/NcAppNavigationToggle-82764816.mjs +118 -0
  240. package/dist/chunks/NcAppNavigationToggle-82764816.mjs.map +1 -0
  241. package/dist/chunks/NcInputConfirmCancel-262d455f.cjs +90 -0
  242. package/dist/chunks/{NcInputConfirmCancel-44052477.mjs.map → NcInputConfirmCancel-262d455f.cjs.map} +1 -1
  243. package/dist/chunks/{NcInputConfirmCancel-44052477.mjs → NcInputConfirmCancel-906c7816.mjs} +11 -11
  244. package/dist/chunks/{NcInputConfirmCancel-6bea0fdc.cjs.map → NcInputConfirmCancel-906c7816.mjs.map} +1 -1
  245. package/dist/chunks/{NcRichText-8fda53c8.mjs → NcRichText-1e8fd02d.mjs} +1 -1
  246. package/dist/chunks/{NcRichText-8fda53c8.mjs.map → NcRichText-1e8fd02d.mjs.map} +1 -1
  247. package/dist/chunks/{NcRichText-332fe454.cjs → NcRichText-ae95c854.cjs} +1 -1
  248. package/dist/chunks/{NcRichText-332fe454.cjs.map → NcRichText-ae95c854.cjs.map} +1 -1
  249. package/dist/chunks/{NcSettingsSelectGroup-fdd3309c.mjs → NcSettingsSelectGroup-ae323579.mjs} +2 -2
  250. package/dist/chunks/{NcSettingsSelectGroup-fdd3309c.mjs.map → NcSettingsSelectGroup-ae323579.mjs.map} +1 -1
  251. package/dist/chunks/{NcSettingsSelectGroup-a5ff8c36.cjs → NcSettingsSelectGroup-e8f9f9fe.cjs} +1 -1
  252. package/dist/chunks/{NcSettingsSelectGroup-a5ff8c36.cjs.map → NcSettingsSelectGroup-e8f9f9fe.cjs.map} +1 -1
  253. package/dist/chunks/{ScopeComponent-9519afcc.mjs → ScopeComponent-1ab1ebb9.mjs} +1 -1
  254. package/dist/chunks/{ScopeComponent-9519afcc.mjs.map → ScopeComponent-1ab1ebb9.mjs.map} +1 -1
  255. package/dist/chunks/{ScopeComponent-e060526a.cjs → ScopeComponent-50287dad.cjs} +1 -1
  256. package/dist/chunks/{ScopeComponent-e060526a.cjs.map → ScopeComponent-50287dad.cjs.map} +1 -1
  257. package/dist/chunks/{index-032137a6.cjs → index-e06b96d3.cjs} +56 -47
  258. package/dist/chunks/index-e06b96d3.cjs.map +1 -0
  259. package/dist/chunks/{index-fb2ee22c.mjs → index-fbf943b3.mjs} +93 -84
  260. package/dist/chunks/index-fbf943b3.mjs.map +1 -0
  261. package/dist/chunks/{l10n-9aa6482d.mjs → l10n-9fc9974f.mjs} +1 -1
  262. package/dist/chunks/{l10n-9aa6482d.mjs.map → l10n-9fc9974f.mjs.map} +1 -1
  263. package/dist/chunks/{l10n-c7bd0ea6.cjs → l10n-ec2d3010.cjs} +1 -1
  264. package/dist/chunks/{l10n-c7bd0ea6.cjs.map → l10n-ec2d3010.cjs.map} +1 -1
  265. package/dist/chunks/l10n-f491109d.cjs +29 -0
  266. package/dist/chunks/l10n-f491109d.cjs.map +1 -0
  267. package/dist/chunks/l10n-f692947e.mjs +31 -0
  268. package/dist/chunks/l10n-f692947e.mjs.map +1 -0
  269. package/dist/chunks/{referencePickerModal-443a4c57.mjs → referencePickerModal-6bc8f6b9.mjs} +156 -124
  270. package/dist/chunks/referencePickerModal-6bc8f6b9.mjs.map +1 -0
  271. package/dist/chunks/{referencePickerModal-279a483d.cjs → referencePickerModal-e033bf2c.cjs} +144 -111
  272. package/dist/chunks/referencePickerModal-e033bf2c.cjs.map +1 -0
  273. package/dist/index.cjs +4 -8
  274. package/dist/index.cjs.map +1 -1
  275. package/dist/index.mjs +26 -30
  276. package/dist/index.mjs.map +1 -1
  277. package/dist/vendor.LICENSE.txt +5 -1
  278. package/package.json +3 -3
  279. package/dist/assets/index-d646553d.css +0 -41
  280. package/dist/chunks/NcAppNavigationToggle-841d3015.cjs +0 -49
  281. package/dist/chunks/NcAppNavigationToggle-841d3015.cjs.map +0 -1
  282. package/dist/chunks/NcAppNavigationToggle-e358aa47.mjs +0 -55
  283. package/dist/chunks/NcAppNavigationToggle-e358aa47.mjs.map +0 -1
  284. package/dist/chunks/NcInputConfirmCancel-6bea0fdc.cjs +0 -90
  285. package/dist/chunks/index-032137a6.cjs.map +0 -1
  286. package/dist/chunks/index-fb2ee22c.mjs.map +0 -1
  287. package/dist/chunks/l10n-05a09c66.mjs +0 -31
  288. package/dist/chunks/l10n-05a09c66.mjs.map +0 -1
  289. package/dist/chunks/l10n-b1d264c7.cjs +0 -29
  290. package/dist/chunks/l10n-b1d264c7.cjs.map +0 -1
  291. package/dist/chunks/referencePickerModal-279a483d.cjs.map +0 -1
  292. package/dist/chunks/referencePickerModal-443a4c57.mjs.map +0 -1
@@ -1,19 +1,81 @@
1
- import o from "vue-material-design-icons/Eye.vue";
2
- import a from "vue-material-design-icons/EyeOff.vue";
3
- import n from "./NcInputField.mjs";
4
- import l from "debounce";
5
- import d from "@nextcloud/axios";
6
- import { loadState as u } from "@nextcloud/initial-state";
7
- import { generateOcsUrl as p } from "@nextcloud/router";
8
- import { t as i } from "../chunks/l10n-05a09c66.mjs";
9
- import { l as c } from "../chunks/logger-3612e664.mjs";
10
- import { n as h } from "../chunks/_plugin-vue2_normalizer-71e2aa87.mjs";
11
- const s = u("core", "capabilities", {}).password_policy || null, m = new Set(Object.keys(n.props)), f = {
1
+ import { n as l } from "../chunks/_plugin-vue2_normalizer-71e2aa87.mjs";
2
+ import a from "./NcInputField.mjs";
3
+ import o from "debounce";
4
+ import c from "@nextcloud/axios";
5
+ import { loadState as d } from "@nextcloud/initial-state";
6
+ import { generateOcsUrl as u } from "@nextcloud/router";
7
+ import { t as n } from "../chunks/l10n-f692947e.mjs";
8
+ import { l as p } from "../chunks/logger-3612e664.mjs";
9
+ const f = {
10
+ name: "EyeIcon",
11
+ emits: ["click"],
12
+ props: {
13
+ title: {
14
+ type: String
15
+ },
16
+ fillColor: {
17
+ type: String,
18
+ default: "currentColor"
19
+ },
20
+ size: {
21
+ type: Number,
22
+ default: 24
23
+ }
24
+ }
25
+ };
26
+ var m = function() {
27
+ var t = this, s = t._self._c;
28
+ return s("span", t._b({ staticClass: "material-design-icon eye-icon", attrs: { "aria-hidden": !t.title, "aria-label": t.title, role: "img" }, on: { click: function(i) {
29
+ return t.$emit("click", i);
30
+ } } }, "span", t.$attrs, !1), [s("svg", { staticClass: "material-design-icon__svg", attrs: { fill: t.fillColor, width: t.size, height: t.size, viewBox: "0 0 24 24" } }, [s("path", { attrs: { d: "M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z" } }, [t.title ? s("title", [t._v(t._s(t.title))]) : t._e()])])]);
31
+ }, h = [], _ = /* @__PURE__ */ l(
32
+ f,
33
+ m,
34
+ h,
35
+ !1,
36
+ null,
37
+ null,
38
+ null,
39
+ null
40
+ );
41
+ const g = _.exports, v = {
42
+ name: "EyeOffIcon",
43
+ emits: ["click"],
44
+ props: {
45
+ title: {
46
+ type: String
47
+ },
48
+ fillColor: {
49
+ type: String,
50
+ default: "currentColor"
51
+ },
52
+ size: {
53
+ type: Number,
54
+ default: 24
55
+ }
56
+ }
57
+ };
58
+ var w = function() {
59
+ var t = this, s = t._self._c;
60
+ return s("span", t._b({ staticClass: "material-design-icon eye-off-icon", attrs: { "aria-hidden": !t.title, "aria-label": t.title, role: "img" }, on: { click: function(i) {
61
+ return t.$emit("click", i);
62
+ } } }, "span", t.$attrs, !1), [s("svg", { staticClass: "material-design-icon__svg", attrs: { fill: t.fillColor, width: t.size, height: t.size, viewBox: "0 0 24 24" } }, [s("path", { attrs: { d: "M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z" } }, [t.title ? s("title", [t._v(t._s(t.title))]) : t._e()])])]);
63
+ }, C = [], y = /* @__PURE__ */ l(
64
+ v,
65
+ w,
66
+ C,
67
+ !1,
68
+ null,
69
+ null,
70
+ null,
71
+ null
72
+ );
73
+ const b = y.exports, r = d("core", "capabilities", {}).password_policy || null, $ = new Set(Object.keys(a.props)), P = {
12
74
  name: "NcPasswordField",
13
75
  components: {
14
- NcInputField: n,
15
- Eye: o,
16
- EyeOff: a
76
+ NcInputField: a,
77
+ Eye: g,
78
+ EyeOff: b
17
79
  },
18
80
  // Allow forwarding all attributes
19
81
  inheritAttrs: !1,
@@ -25,7 +87,7 @@ const s = u("core", "capabilities", {}).password_policy || null, m = new Set(Obj
25
87
  // eslint-disable-next-line
26
88
  " ": {},
27
89
  // Reuse all the props from NcInputField for better typing and documentation
28
- ...n.props,
90
+ ...a.props,
29
91
  // Redefined props
30
92
  /**
31
93
  * Controls whether to display the trailing button.
@@ -88,13 +150,13 @@ const s = u("core", "capabilities", {}).password_policy || null, m = new Set(Obj
88
150
  return this.helperText.length > 0 ? this.helperText : this.internalHelpMessage;
89
151
  },
90
152
  rules() {
91
- const { minlength: t } = this;
153
+ const { minlength: e } = this;
92
154
  return {
93
- minlength: t != null ? t : s == null ? void 0 : s.minLength
155
+ minlength: e != null ? e : r == null ? void 0 : r.minLength
94
156
  };
95
157
  },
96
158
  trailingButtonLabelPassword() {
97
- return this.isPasswordHidden ? i("Show password") : i("Hide password");
159
+ return this.isPasswordHidden ? n("Show password") : n("Hide password");
98
160
  },
99
161
  propsAndAttrsToForward() {
100
162
  return {
@@ -102,17 +164,17 @@ const s = u("core", "capabilities", {}).password_policy || null, m = new Set(Obj
102
164
  ...this.$attrs,
103
165
  // Proxy original NcInputField's props
104
166
  ...Object.fromEntries(
105
- Object.entries(this.$props).filter(([t]) => m.has(t))
167
+ Object.entries(this.$props).filter(([e]) => $.has(e))
106
168
  )
107
169
  };
108
170
  }
109
171
  },
110
172
  watch: {
111
- value(t) {
173
+ value(e) {
112
174
  if (this.checkPasswordStrength) {
113
- if (s === null)
175
+ if (r === null)
114
176
  return;
115
- this.checkPassword(t);
177
+ this.checkPassword(e);
116
178
  }
117
179
  }
118
180
  },
@@ -133,42 +195,42 @@ const s = u("core", "capabilities", {}).password_policy || null, m = new Set(Obj
133
195
  select() {
134
196
  this.$refs.inputField.select();
135
197
  },
136
- handleInput(t) {
137
- this.$emit("update:value", t.target.value);
198
+ handleInput(e) {
199
+ this.$emit("update:value", e.target.value);
138
200
  },
139
201
  togglePasswordVisibility() {
140
202
  this.isPasswordHidden = !this.isPasswordHidden;
141
203
  },
142
- checkPassword: l(async function(t) {
204
+ checkPassword: o(async function(e) {
143
205
  try {
144
- const { data: e } = await d.post(p("apps/password_policy/api/v1/validate"), { password: t });
145
- if (this.isValid = e.ocs.data.passed, e.ocs.data.passed) {
146
- this.internalHelpMessage = i("Password is secure"), this.$emit("valid");
206
+ const { data: t } = await c.post(u("apps/password_policy/api/v1/validate"), { password: e });
207
+ if (this.isValid = t.ocs.data.passed, t.ocs.data.passed) {
208
+ this.internalHelpMessage = n("Password is secure"), this.$emit("valid");
147
209
  return;
148
210
  }
149
- this.internalHelpMessage = e.ocs.data.reason, this.$emit("invalid");
150
- } catch (e) {
151
- c.error("Password policy returned an error", e);
211
+ this.internalHelpMessage = t.ocs.data.reason, this.$emit("invalid");
212
+ } catch (t) {
213
+ p.error("Password policy returned an error", t);
152
214
  }
153
215
  }, 500)
154
216
  }
155
217
  };
156
- var w = function() {
157
- var e = this, r = e._self._c;
158
- return r("NcInputField", e._g(e._b({ ref: "inputField", attrs: { type: e.isPasswordHidden ? "password" : "text", "trailing-button-label": e.trailingButtonLabelPassword, "helper-text": e.computedHelperText, error: e.computedError, success: e.computedSuccess, minlength: e.rules.minlength }, on: { "trailing-button-click": e.togglePasswordVisibility, input: e.handleInput }, scopedSlots: e._u([{ key: "trailing-button-icon", fn: function() {
159
- return [e.isPasswordHidden ? r("Eye", { attrs: { size: 18 } }) : r("EyeOff", { attrs: { size: 18 } })];
160
- }, proxy: !0 }]) }, "NcInputField", e.propsAndAttrsToForward, !1), e.$listeners), [e._t("default")], 2);
161
- }, g = [], _ = /* @__PURE__ */ h(
162
- f,
163
- w,
164
- g,
218
+ var A = function() {
219
+ var t = this, s = t._self._c;
220
+ return s("NcInputField", t._g(t._b({ ref: "inputField", attrs: { type: t.isPasswordHidden ? "password" : "text", "trailing-button-label": t.trailingButtonLabelPassword, "helper-text": t.computedHelperText, error: t.computedError, success: t.computedSuccess, minlength: t.rules.minlength }, on: { "trailing-button-click": t.togglePasswordVisibility, input: t.handleInput }, scopedSlots: t._u([{ key: "trailing-button-icon", fn: function() {
221
+ return [t.isPasswordHidden ? s("Eye", { attrs: { size: 18 } }) : s("EyeOff", { attrs: { size: 18 } })];
222
+ }, proxy: !0 }]) }, "NcInputField", t.propsAndAttrsToForward, !1), t.$listeners), [t._t("default")], 2);
223
+ }, x = [], L = /* @__PURE__ */ l(
224
+ P,
225
+ A,
226
+ x,
165
227
  !1,
166
228
  null,
167
229
  null,
168
230
  null,
169
231
  null
170
232
  );
171
- const k = _.exports;
233
+ const B = L.exports;
172
234
  export {
173
- k as default
235
+ B as default
174
236
  };
@@ -1 +1 @@
1
- {"version":3,"file":"NcPasswordField.mjs","sources":["../../src/components/NcPasswordField/NcPasswordField.vue"],"sourcesContent":["<!--\n - @copyright Copyright (c) 2022 Marco Ambrosini <marcoambrosini@pm.me>\n -\n - @author Marco Ambrosini <marcoambrosini@pm.me>\n - @author Carl Schwan <carl@carlschwan.eu>\n -\n - @license GNU AGPL version 3 or any later version\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n-->\n\n<docs>\n### Description\nSee [NcInputField](#/Components/NcFields?id=ncinputfield) for a list of all available props.\n\nGeneral purpose password field component.\n\n```\n<template>\n\t<div class=\"wrapper\">\n\t\t<NcPasswordField :value.sync=\"text1\"\n\t\t\tlabel=\"Old password\" />\n\t\t<div class=\"external-label\">\n\t\t\t<label for=\"textField\">New password</label>\n\t\t\t<NcPasswordField id=\"textField\"\n\t\t\t\t:value.sync=\"text2\"\n\t\t\t\t:label-outside=\"true\"\n\t\t\t\tplaceholder=\"Min. 12 characters\" />\n\t\t</div>\n\t\t<div class=\"external-label\">\n\t\t\t<label for=\"textField2\">New password</label>\n\t\t\t<NcPasswordField id=\"textField2\"\n\t\t\t\t:value.sync=\"text3\"\n\t\t\t\t:error=\"true\"\n\t\t\t\t:label-outside=\"true\"\n\t\t\t\tplaceholder=\"Min. 12 characters\"\n\t\t\t\thelper-text=\"Password is insecure\" />\n\t\t</div>\n\n\t\t<NcPasswordField :value.sync=\"text4\"\n\t\t\tlabel=\"Good new password\"\n\t\t\t:success=\"true\"\n\t\t\tplaceholder=\"Min. 12 characters\"\n\t\t\thelper-text=\"Password is secure\" />\n\n\t\t<NcPasswordField :value.sync=\"text5\"\n\t\t\t:disabled=\"true\"\n\t\t\tlabel=\"Disabled\" />\n\t</div>\n</template>\n<script>\nexport default {\n\tdata() {\n\t\treturn {\n\t\t\ttext1: '',\n\t\t\ttext2: '',\n\t\t\ttext3: 'hunter',\n\t\t\ttext4: '',\n\t\t\ttext5: '',\n\t\t}\n\t},\n}\n</script>\n<style lang=\"scss\" scoped>\n.wrapper {\n\tdisplay: flex;\n\tgap: 4px;\n\talign-items: flex-end;\n\tflex-wrap: wrap;\n}\n\n.external-label {\n\tdisplay: flex;\n\twidth: 100%;\n\tmargin-top: 1rem;\n}\n\n.external-label label {\n\tpadding-top: 7px;\n\tpadding-right: 14px;\n\twhite-space: nowrap;\n}\n</style>\n```\n</docs>\n\n<template>\n\t<NcInputField v-bind=\"propsAndAttrsToForward\"\n\t\tref=\"inputField\"\n\t\t:type=\"isPasswordHidden ? 'password' : 'text'\"\n\t\t:trailing-button-label=\"trailingButtonLabelPassword\"\n\t\t:helper-text=\"computedHelperText\"\n\t\t:error=\"computedError\"\n\t\t:success=\"computedSuccess\"\n\t\t:minlength=\"rules.minlength\"\n\t\tv-on=\"$listeners\"\n\t\t@trailing-button-click=\"togglePasswordVisibility\"\n\t\t@input=\"handleInput\">\n\t\t<!-- Default slot for the leading icon -->\n\t\t<slot />\n\t\t<template #trailing-button-icon>\n\t\t\t<Eye v-if=\"isPasswordHidden\" :size=\"18\" />\n\t\t\t<EyeOff v-else :size=\"18\" />\n\t\t</template>\n\t</NcInputField>\n</template>\n\n<script>\n\nimport Eye from 'vue-material-design-icons/Eye.vue'\nimport EyeOff from 'vue-material-design-icons/EyeOff.vue'\nimport NcInputField from '../NcInputField/NcInputField.vue'\nimport debounce from 'debounce'\nimport axios from '@nextcloud/axios'\nimport { loadState } from '@nextcloud/initial-state'\nimport { generateOcsUrl } from '@nextcloud/router'\nimport { t } from '../../l10n.js'\nimport logger from '../../utils/logger.js'\n\n/**\n * @typedef PasswordPolicy\n * @property {object} api - The URLs to the password_policy app methods\n * @property {string} api.generate - The URL to the password generator\n * @property {string} api.validate - The URL to the password validator\n * @property {boolean} enforceNonCommonPassword - Whether to enforce non common passwords\n * @property {boolean} enforceNumericCharacters - Whether to enforce numeric characters\n * @property {boolean} enforceSpecialCharacters - Whether to enforce special characters\n * @property {boolean} enforceUpperLowerCase - Whether to enforce upper and lower case\n * @property {number} minLength - The minimum length of the password\n */\n\n/** @type {PasswordPolicy|null} */\nconst passwordPolicy = loadState('core', 'capabilities', {}).password_policy || null\n\nconst NcInputFieldProps = new Set(Object.keys(NcInputField.props))\n\nexport default {\n\tname: 'NcPasswordField',\n\n\tcomponents: {\n\t\tNcInputField,\n\t\tEye,\n\t\tEyeOff,\n\t},\n\n\t// Allow forwarding all attributes\n\tinheritAttrs: false,\n\n\tprops: {\n\t\t/**\n\t\t * Any [NcInputField](#/Components/NcFields?id=ncinputfield) props\n\t\t */\n\t\t// Not an actual prop but needed to show in vue-styleguidist docs\n\t\t// eslint-disable-next-line\n\t\t' ': {},\n\n\t\t// Reuse all the props from NcInputField for better typing and documentation\n\t\t...NcInputField.props,\n\n\t\t// Redefined props\n\n\t\t/**\n\t\t * Controls whether to display the trailing button.\n\t\t */\n\t\t showTrailingButton: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t// Removed NcInputField props, defined only by this component\n\n\t\ttrailingButtonLabel: undefined,\n\n\t\t// Custom props\n\n\t\t/**\n\t\t * Check if the user entered a valid password using the password_policy\n\t\t * app if available.\n\t\t *\n\t\t * Warning: this doesn't replace server side checking and will do nothing\n\t\t * if the password_policy app is disabled.\n\t\t */\n\t\tcheckPasswordStrength: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/**\n\t\t * The minlength property defines the minimum number of characters\n\t\t * (as UTF-16 code units) the user can enter\n\t\t */\n\t\tminlength: {\n\t\t\ttype: Number,\n\t\t\tdefault: 0,\n\t\t},\n\n\t\t/**\n\t\t * The maxlength property defines the maximum number of characters\n\t\t * (as UTF-16 code units) the user can enter\n\t\t */\n\t\tmaxlength: {\n\t\t\ttype: Number,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: [\n\t\t'valid',\n\t\t'invalid',\n\t\t'update:value',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\tisPasswordHidden: true,\n\t\t\tinternalHelpMessage: '',\n\t\t\tisValid: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tcomputedError() {\n\t\t\treturn this.error || this.isValid === false\n\t\t},\n\t\tcomputedSuccess() {\n\t\t\treturn this.success || this.isValid === true\n\t\t},\n\t\tcomputedHelperText() {\n\t\t\tif (this.helperText.length > 0) {\n\t\t\t\treturn this.helperText\n\t\t\t}\n\t\t\treturn this.internalHelpMessage\n\t\t},\n\n\t\trules() {\n\t\t\tconst { minlength } = this\n\t\t\treturn {\n\t\t\t\tminlength: minlength ?? passwordPolicy?.minLength,\n\t\t\t}\n\t\t},\n\n\t\ttrailingButtonLabelPassword() {\n\t\t\treturn this.isPasswordHidden ? t('Show password') : t('Hide password')\n\t\t},\n\n\t\tpropsAndAttrsToForward() {\n\t\t\treturn {\n\t\t\t\t// Proxy all the HTML attributes\n\t\t\t\t...this.$attrs,\n\t\t\t\t// Proxy original NcInputField's props\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\tObject.entries(this.$props).filter(([key]) => NcInputFieldProps.has(key)),\n\t\t\t\t),\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\tvalue(newValue) {\n\t\t\tif (this.checkPasswordStrength) {\n\t\t\t\tif (passwordPolicy === null) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.checkPassword(newValue)\n\t\t\t}\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Focus the input element\n\t\t *\n\t\t * @public\n\t\t */\n\t\tfocus() {\n\t\t\tthis.$refs.inputField.focus()\n\t\t},\n\n\t\t/**\n\t\t * Select all the text in the input\n\t\t *\n\t\t * @public\n\t\t */\n\t\tselect() {\n\t\t\tthis.$refs.inputField.select()\n\t\t},\n\n\t\thandleInput(event) {\n\t\t\t/**\n\t\t\t * Triggers when the value inside the password field is\n\t\t\t * updated.\n\t\t\t *\n\t\t\t * @property {string} The new value\n\t\t\t */\n\t\t\tthis.$emit('update:value', event.target.value)\n\t\t},\n\t\ttogglePasswordVisibility() {\n\t\t\tthis.isPasswordHidden = !this.isPasswordHidden\n\t\t},\n\t\tcheckPassword: debounce(async function(password) {\n\t\t\ttry {\n\t\t\t\tconst { data } = await axios.post(generateOcsUrl('apps/password_policy/api/v1/validate'), { password })\n\t\t\t\tthis.isValid = data.ocs.data.passed\n\t\t\t\tif (data.ocs.data.passed) {\n\t\t\t\t\tthis.internalHelpMessage = t('Password is secure')\n\t\t\t\t\t/**\n\t\t\t\t\t * Triggers when the internal password_policy detect that the\n\t\t\t\t\t * password entered is valid.\n\t\t\t\t\t */\n\t\t\t\t\tthis.$emit('valid')\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tthis.internalHelpMessage = data.ocs.data.reason\n\t\t\t\t/**\n\t\t\t\t * Triggers when the internal password_policy detect that the\n\t\t\t\t * password entered is invalid.\n\t\t\t\t */\n\t\t\t\tthis.$emit('invalid')\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error('Password policy returned an error', e)\n\t\t\t}\n\t\t}, 500),\n\t},\n}\n</script>\n"],"names":["passwordPolicy","loadState","NcInputFieldProps","NcInputField","_sfc_main","Eye","EyeOff","minlength","t","key","newValue","event","debounce","password","data","axios","generateOcsUrl","logger"],"mappings":";;;;;;;;;;AA+IA,MAAAA,IAAAC,EAAA,QAAA,gBAAA,CAAA,CAAA,EAAA,mBAAA,MAEAC,IAAA,IAAA,IAAA,OAAA,KAAAC,EAAA,KAAA,CAAA,GAEAC,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA,cAAAD;AAAA,IACA,KAAAE;AAAA,IACA,QAAAC;AAAA,EACA;AAAA;AAAA,EAGA,cAAA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,KAAA,CAAA;AAAA;AAAA,IAGA,GAAAH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,oBAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA,IAIA,qBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWA,uBAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AACA,WAAA;AAAA,MACA,kBAAA;AAAA,MACA,qBAAA;AAAA,MACA,SAAA;AAAA,IACA;AAA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cAAA,EAAA,MAAAC,MAAA,MAAAC,EAAA,KAAAC,EAAA,sCAAA,GAAA,EAAA,UAAAH,GAAA;AAEA,YADA,KAAA,UAAAC,EAAA,IAAA,KAAA,QACAA,EAAA,IAAA,KAAA,QAAA;AACA,eAAA,sBAAAN,EAAA,oBAAA,GAKA,KAAA,MAAA,OAAA;AACA;AAAA,QACA;AAEA,aAAA,sBAAAM,EAAA,IAAA,KAAA,QAKA,KAAA,MAAA,SAAA;AAAA,MACA,SAAA,GAAA;AACA,QAAAG,EAAA,MAAA,qCAAA,CAAA;AAAA,MACA;AAAA,IACA,GAAA,GAAA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"NcPasswordField.mjs","sources":["../../node_modules/vue-material-design-icons/Eye.vue","../../node_modules/vue-material-design-icons/EyeOff.vue","../../src/components/NcPasswordField/NcPasswordField.vue"],"sourcesContent":["<template>\n <span v-bind=\"$attrs\"\n :aria-hidden=\"!title\"\n :aria-label=\"title\"\n class=\"material-design-icon eye-icon\"\n role=\"img\"\n @click=\"$emit('click', $event)\">\n <svg :fill=\"fillColor\"\n class=\"material-design-icon__svg\"\n :width=\"size\"\n :height=\"size\"\n viewBox=\"0 0 24 24\">\n <path d=\"M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z\">\n <title v-if=\"title\">{{ title }}</title>\n </path>\n </svg>\n </span>\n</template>\n\n<script>\nexport default {\n name: \"EyeIcon\",\n emits: ['click'],\n props: {\n title: {\n type: String,\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n}\n</script>","<template>\n <span v-bind=\"$attrs\"\n :aria-hidden=\"!title\"\n :aria-label=\"title\"\n class=\"material-design-icon eye-off-icon\"\n role=\"img\"\n @click=\"$emit('click', $event)\">\n <svg :fill=\"fillColor\"\n class=\"material-design-icon__svg\"\n :width=\"size\"\n :height=\"size\"\n viewBox=\"0 0 24 24\">\n <path d=\"M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z\">\n <title v-if=\"title\">{{ title }}</title>\n </path>\n </svg>\n </span>\n</template>\n\n<script>\nexport default {\n name: \"EyeOffIcon\",\n emits: ['click'],\n props: {\n title: {\n type: String,\n },\n fillColor: {\n type: String,\n default: \"currentColor\"\n },\n size: {\n type: Number,\n default: 24\n }\n }\n}\n</script>","<!--\n - @copyright Copyright (c) 2022 Marco Ambrosini <marcoambrosini@pm.me>\n -\n - @author Marco Ambrosini <marcoambrosini@pm.me>\n - @author Carl Schwan <carl@carlschwan.eu>\n -\n - @license GNU AGPL version 3 or any later version\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n-->\n\n<docs>\n### Description\nSee [NcInputField](#/Components/NcFields?id=ncinputfield) for a list of all available props.\n\nGeneral purpose password field component.\n\n```\n<template>\n\t<div class=\"wrapper\">\n\t\t<NcPasswordField :value.sync=\"text1\"\n\t\t\tlabel=\"Old password\" />\n\t\t<div class=\"external-label\">\n\t\t\t<label for=\"textField\">New password</label>\n\t\t\t<NcPasswordField id=\"textField\"\n\t\t\t\t:value.sync=\"text2\"\n\t\t\t\t:label-outside=\"true\"\n\t\t\t\tplaceholder=\"Min. 12 characters\" />\n\t\t</div>\n\t\t<div class=\"external-label\">\n\t\t\t<label for=\"textField2\">New password</label>\n\t\t\t<NcPasswordField id=\"textField2\"\n\t\t\t\t:value.sync=\"text3\"\n\t\t\t\t:error=\"true\"\n\t\t\t\t:label-outside=\"true\"\n\t\t\t\tplaceholder=\"Min. 12 characters\"\n\t\t\t\thelper-text=\"Password is insecure\" />\n\t\t</div>\n\n\t\t<NcPasswordField :value.sync=\"text4\"\n\t\t\tlabel=\"Good new password\"\n\t\t\t:success=\"true\"\n\t\t\tplaceholder=\"Min. 12 characters\"\n\t\t\thelper-text=\"Password is secure\" />\n\n\t\t<NcPasswordField :value.sync=\"text5\"\n\t\t\t:disabled=\"true\"\n\t\t\tlabel=\"Disabled\" />\n\t</div>\n</template>\n<script>\nexport default {\n\tdata() {\n\t\treturn {\n\t\t\ttext1: '',\n\t\t\ttext2: '',\n\t\t\ttext3: 'hunter',\n\t\t\ttext4: '',\n\t\t\ttext5: '',\n\t\t}\n\t},\n}\n</script>\n<style lang=\"scss\" scoped>\n.wrapper {\n\tdisplay: flex;\n\tgap: 4px;\n\talign-items: flex-end;\n\tflex-wrap: wrap;\n}\n\n.external-label {\n\tdisplay: flex;\n\twidth: 100%;\n\tmargin-top: 1rem;\n}\n\n.external-label label {\n\tpadding-top: 7px;\n\tpadding-right: 14px;\n\twhite-space: nowrap;\n}\n</style>\n```\n</docs>\n\n<template>\n\t<NcInputField v-bind=\"propsAndAttrsToForward\"\n\t\tref=\"inputField\"\n\t\t:type=\"isPasswordHidden ? 'password' : 'text'\"\n\t\t:trailing-button-label=\"trailingButtonLabelPassword\"\n\t\t:helper-text=\"computedHelperText\"\n\t\t:error=\"computedError\"\n\t\t:success=\"computedSuccess\"\n\t\t:minlength=\"rules.minlength\"\n\t\tv-on=\"$listeners\"\n\t\t@trailing-button-click=\"togglePasswordVisibility\"\n\t\t@input=\"handleInput\">\n\t\t<!-- Default slot for the leading icon -->\n\t\t<slot />\n\t\t<template #trailing-button-icon>\n\t\t\t<Eye v-if=\"isPasswordHidden\" :size=\"18\" />\n\t\t\t<EyeOff v-else :size=\"18\" />\n\t\t</template>\n\t</NcInputField>\n</template>\n\n<script>\n\nimport Eye from 'vue-material-design-icons/Eye.vue'\nimport EyeOff from 'vue-material-design-icons/EyeOff.vue'\nimport NcInputField from '../NcInputField/NcInputField.vue'\nimport debounce from 'debounce'\nimport axios from '@nextcloud/axios'\nimport { loadState } from '@nextcloud/initial-state'\nimport { generateOcsUrl } from '@nextcloud/router'\nimport { t } from '../../l10n.js'\nimport logger from '../../utils/logger.js'\n\n/**\n * @typedef PasswordPolicy\n * @property {object} api - The URLs to the password_policy app methods\n * @property {string} api.generate - The URL to the password generator\n * @property {string} api.validate - The URL to the password validator\n * @property {boolean} enforceNonCommonPassword - Whether to enforce non common passwords\n * @property {boolean} enforceNumericCharacters - Whether to enforce numeric characters\n * @property {boolean} enforceSpecialCharacters - Whether to enforce special characters\n * @property {boolean} enforceUpperLowerCase - Whether to enforce upper and lower case\n * @property {number} minLength - The minimum length of the password\n */\n\n/** @type {PasswordPolicy|null} */\nconst passwordPolicy = loadState('core', 'capabilities', {}).password_policy || null\n\nconst NcInputFieldProps = new Set(Object.keys(NcInputField.props))\n\nexport default {\n\tname: 'NcPasswordField',\n\n\tcomponents: {\n\t\tNcInputField,\n\t\tEye,\n\t\tEyeOff,\n\t},\n\n\t// Allow forwarding all attributes\n\tinheritAttrs: false,\n\n\tprops: {\n\t\t/**\n\t\t * Any [NcInputField](#/Components/NcFields?id=ncinputfield) props\n\t\t */\n\t\t// Not an actual prop but needed to show in vue-styleguidist docs\n\t\t// eslint-disable-next-line\n\t\t' ': {},\n\n\t\t// Reuse all the props from NcInputField for better typing and documentation\n\t\t...NcInputField.props,\n\n\t\t// Redefined props\n\n\t\t/**\n\t\t * Controls whether to display the trailing button.\n\t\t */\n\t\t showTrailingButton: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t// Removed NcInputField props, defined only by this component\n\n\t\ttrailingButtonLabel: undefined,\n\n\t\t// Custom props\n\n\t\t/**\n\t\t * Check if the user entered a valid password using the password_policy\n\t\t * app if available.\n\t\t *\n\t\t * Warning: this doesn't replace server side checking and will do nothing\n\t\t * if the password_policy app is disabled.\n\t\t */\n\t\tcheckPasswordStrength: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/**\n\t\t * The minlength property defines the minimum number of characters\n\t\t * (as UTF-16 code units) the user can enter\n\t\t */\n\t\tminlength: {\n\t\t\ttype: Number,\n\t\t\tdefault: 0,\n\t\t},\n\n\t\t/**\n\t\t * The maxlength property defines the maximum number of characters\n\t\t * (as UTF-16 code units) the user can enter\n\t\t */\n\t\tmaxlength: {\n\t\t\ttype: Number,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: [\n\t\t'valid',\n\t\t'invalid',\n\t\t'update:value',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\tisPasswordHidden: true,\n\t\t\tinternalHelpMessage: '',\n\t\t\tisValid: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tcomputedError() {\n\t\t\treturn this.error || this.isValid === false\n\t\t},\n\t\tcomputedSuccess() {\n\t\t\treturn this.success || this.isValid === true\n\t\t},\n\t\tcomputedHelperText() {\n\t\t\tif (this.helperText.length > 0) {\n\t\t\t\treturn this.helperText\n\t\t\t}\n\t\t\treturn this.internalHelpMessage\n\t\t},\n\n\t\trules() {\n\t\t\tconst { minlength } = this\n\t\t\treturn {\n\t\t\t\tminlength: minlength ?? passwordPolicy?.minLength,\n\t\t\t}\n\t\t},\n\n\t\ttrailingButtonLabelPassword() {\n\t\t\treturn this.isPasswordHidden ? t('Show password') : t('Hide password')\n\t\t},\n\n\t\tpropsAndAttrsToForward() {\n\t\t\treturn {\n\t\t\t\t// Proxy all the HTML attributes\n\t\t\t\t...this.$attrs,\n\t\t\t\t// Proxy original NcInputField's props\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\tObject.entries(this.$props).filter(([key]) => NcInputFieldProps.has(key)),\n\t\t\t\t),\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\tvalue(newValue) {\n\t\t\tif (this.checkPasswordStrength) {\n\t\t\t\tif (passwordPolicy === null) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.checkPassword(newValue)\n\t\t\t}\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Focus the input element\n\t\t *\n\t\t * @public\n\t\t */\n\t\tfocus() {\n\t\t\tthis.$refs.inputField.focus()\n\t\t},\n\n\t\t/**\n\t\t * Select all the text in the input\n\t\t *\n\t\t * @public\n\t\t */\n\t\tselect() {\n\t\t\tthis.$refs.inputField.select()\n\t\t},\n\n\t\thandleInput(event) {\n\t\t\t/**\n\t\t\t * Triggers when the value inside the password field is\n\t\t\t * updated.\n\t\t\t *\n\t\t\t * @property {string} The new value\n\t\t\t */\n\t\t\tthis.$emit('update:value', event.target.value)\n\t\t},\n\t\ttogglePasswordVisibility() {\n\t\t\tthis.isPasswordHidden = !this.isPasswordHidden\n\t\t},\n\t\tcheckPassword: debounce(async function(password) {\n\t\t\ttry {\n\t\t\t\tconst { data } = await axios.post(generateOcsUrl('apps/password_policy/api/v1/validate'), { password })\n\t\t\t\tthis.isValid = data.ocs.data.passed\n\t\t\t\tif (data.ocs.data.passed) {\n\t\t\t\t\tthis.internalHelpMessage = t('Password is secure')\n\t\t\t\t\t/**\n\t\t\t\t\t * Triggers when the internal password_policy detect that the\n\t\t\t\t\t * password entered is valid.\n\t\t\t\t\t */\n\t\t\t\t\tthis.$emit('valid')\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tthis.internalHelpMessage = data.ocs.data.reason\n\t\t\t\t/**\n\t\t\t\t * Triggers when the internal password_policy detect that the\n\t\t\t\t * password entered is invalid.\n\t\t\t\t */\n\t\t\t\tthis.$emit('invalid')\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error('Password policy returned an error', e)\n\t\t\t}\n\t\t}, 500),\n\t},\n}\n</script>\n"],"names":["_sfc_main","passwordPolicy","loadState","NcInputFieldProps","NcInputField","Eye","EyeOff","minlength","t","key","newValue","event","debounce","password","data","axios","generateOcsUrl","e","logger"],"mappings":";;;;;;;;AAoBA,MAAAA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA,CAAA,OAAA;AAAA,EACA,OAAA;AAAA,IACA,OAAA;AAAA,MACA,MAAA;AAAA,IACA;AAAA,IACA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,IACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;qBChBAA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA,CAAA,OAAA;AAAA,EACA,OAAA;AAAA,IACA,OAAA;AAAA,MACA,MAAA;AAAA,IACA;AAAA,IACA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,IACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;qBC2GAC,IAAAC,EAAA,QAAA,gBAAA,CA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D,CAAA;AAAA,MACA;AAAA,IACA,GAAA,GAAA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1]}
@@ -1,5 +1,5 @@
1
- var I = require("../assets/index-e828b286.css");
2
- const o = require("@nextcloud/axios"), l = require("@nextcloud/router"), a = require("./NcButton.cjs"), s = require("../chunks/l10n-b1d264c7.cjs"), i = require("../chunks/_plugin-vue2_normalizer-7f9efb60.cjs"), u = (r) => r && r.__esModule ? r : { default: r }, c = /* @__PURE__ */ u(o);
1
+ var I = require("../assets/index-ab715d82.css");
2
+ const o = require("@nextcloud/axios"), l = require("@nextcloud/router"), a = require("./NcButton.cjs"), s = require("../chunks/l10n-f491109d.cjs"), n = require("../chunks/_plugin-vue2_normalizer-7f9efb60.cjs"), u = (t) => t && t.__esModule ? t : { default: t }, c = /* @__PURE__ */ u(o);
3
3
  const d = {
4
4
  name: "NcResource",
5
5
  components: {
@@ -29,21 +29,21 @@ const d = {
29
29
  }
30
30
  };
31
31
  var _ = function() {
32
- var e = this, t = e._self._c;
33
- return t("li", { staticClass: "resource" }, [t("NcButton", { staticClass: "resource__button", attrs: { "aria-label": e.labelTranslated, type: "tertiary", href: e.url }, scopedSlots: e._u([{ key: "icon", fn: function() {
34
- return [t("div", { staticClass: "resource__icon" }, [t("img", { attrs: { src: e.icon } })])];
32
+ var e = this, r = e._self._c;
33
+ return r("li", { staticClass: "resource" }, [r("NcButton", { staticClass: "resource__button", attrs: { "aria-label": e.labelTranslated, type: "tertiary", href: e.url }, scopedSlots: e._u([{ key: "icon", fn: function() {
34
+ return [r("div", { staticClass: "resource__icon" }, [r("img", { attrs: { src: e.icon } })])];
35
35
  }, proxy: !0 }]) }, [e._v(" " + e._s(e.name) + " ")])], 1);
36
- }, f = [], p = /* @__PURE__ */ i.normalizeComponent(
36
+ }, p = [], f = /* @__PURE__ */ n.normalizeComponent(
37
37
  d,
38
38
  _,
39
- f,
39
+ p,
40
40
  !1,
41
41
  null,
42
42
  "1a960bef",
43
43
  null,
44
44
  null
45
45
  );
46
- const h = p.exports;
46
+ const h = f.exports;
47
47
  const m = {
48
48
  name: "NcRelatedResourcesPanel",
49
49
  components: {
@@ -86,6 +86,24 @@ const m = {
86
86
  fileInfo: {
87
87
  type: Object,
88
88
  default: null
89
+ },
90
+ /**
91
+ * Make the header name dynamic
92
+ */
93
+ header: {
94
+ type: String,
95
+ default: s.t("Related resources")
96
+ },
97
+ description: {
98
+ type: String,
99
+ default: s.t("Anything shared with the same group of people will show up here")
100
+ },
101
+ /**
102
+ * If this element is used on a primary element set to true for primary styling.
103
+ */
104
+ primary: {
105
+ type: Boolean,
106
+ default: !1
89
107
  }
90
108
  },
91
109
  emits: [
@@ -93,10 +111,9 @@ const m = {
93
111
  "has-resources"
94
112
  ],
95
113
  data() {
96
- var r;
114
+ var t;
97
115
  return {
98
- appEnabled: ((r = OC == null ? void 0 : OC.appswebroots) == null ? void 0 : r.related_resources) !== void 0,
99
- headerTranslated: s.t("Related resources"),
116
+ appEnabled: ((t = OC == null ? void 0 : OC.appswebroots) == null ? void 0 : t.related_resources) !== void 0,
100
117
  loading: !1,
101
118
  error: null,
102
119
  resources: []
@@ -104,23 +121,23 @@ const m = {
104
121
  },
105
122
  computed: {
106
123
  isVisible() {
107
- var r;
108
- return this.loading ? !1 : (r = this.error) != null ? r : this.resources.length > 0;
124
+ var t;
125
+ return this.loading ? !1 : (t = this.error) != null ? t : this.resources.length > 0;
109
126
  },
110
- description() {
111
- return this.error ? s.t("Error getting related resources. Please contact your system administrator if you have any questions.") : s.t("Anything shared with the same group of people will show up here");
127
+ subline() {
128
+ return this.error ? s.t("Error getting related resources. Please contact your system administrator if you have any questions.") : this.description;
112
129
  },
113
130
  hasResourceInfo() {
114
131
  return this.providerId !== null && this.itemId !== null || this.fileInfo !== null;
115
132
  },
116
133
  isFiles() {
117
- var r;
118
- return ((r = this.fileInfo) == null ? void 0 : r.id) !== void 0;
134
+ var t;
135
+ return ((t = this.fileInfo) == null ? void 0 : t.id) !== void 0;
119
136
  },
120
137
  url() {
121
- let r = null, e = null;
122
- return this.isFiles ? (r = "files", e = this.fileInfo.id) : (r = this.providerId, e = this.itemId), l.generateOcsUrl("/apps/related_resources/related/{providerId}?itemId={itemId}&resourceType={resourceType}&limit={limit}&format=json", {
123
- providerId: r,
138
+ let t = null, e = null;
139
+ return this.isFiles ? (t = "files", e = this.fileInfo.id) : (t = this.providerId, e = this.itemId), l.generateOcsUrl("/apps/related_resources/related/{providerId}?itemId={itemId}&resourceType={resourceType}&limit={limit}&format=json", {
140
+ providerId: t,
124
141
  itemId: e,
125
142
  resourceType: this.resourceType,
126
143
  limit: this.limit
@@ -137,11 +154,11 @@ const m = {
137
154
  fileInfo() {
138
155
  this.fetchRelatedResources();
139
156
  },
140
- error(r) {
141
- this.$emit("has-error", !!r);
157
+ error(t) {
158
+ this.$emit("has-error", !!t);
142
159
  },
143
- resources(r) {
144
- this.$emit("has-resources", r.length > 0);
160
+ resources(t) {
161
+ this.$emit("has-resources", t.length > 0);
145
162
  }
146
163
  },
147
164
  created() {
@@ -150,12 +167,12 @@ const m = {
150
167
  methods: {
151
168
  t: s.t,
152
169
  async fetchRelatedResources() {
153
- var r;
170
+ var t;
154
171
  if (!(!this.appEnabled || !this.hasResourceInfo)) {
155
172
  this.loading = !0, this.error = null, this.resources = [];
156
173
  try {
157
174
  const e = await c.default.get(this.url);
158
- this.resources = (r = e.data.ocs) == null ? void 0 : r.data;
175
+ this.resources = (t = e.data.ocs) == null ? void 0 : t.data;
159
176
  } catch (e) {
160
177
  this.error = e, console.error(e);
161
178
  } finally {
@@ -166,17 +183,17 @@ const m = {
166
183
  }
167
184
  };
168
185
  var y = function() {
169
- var e = this, t = e._self._c;
170
- return e.appEnabled && e.isVisible ? t("div", { staticClass: "related-resources" }, [t("div", { staticClass: "related-resources__header" }, [t("h5", [e._v(e._s(e.headerTranslated))]), t("p", [e._v(e._s(e.description))])]), e._l(e.resources, function(n) {
171
- return t("NcResource", { key: n.itemId, staticClass: "related-resources__entry", attrs: { icon: n.icon, name: n.title, url: n.url } });
186
+ var e = this, r = e._self._c;
187
+ return e.appEnabled && e.isVisible ? r("div", { staticClass: "related-resources" }, [r("div", { staticClass: "related-resources__header" }, [r("h5", [e._v(e._s(e.header))]), r("p", [e._v(e._s(e.subline))])]), e._l(e.resources, function(i) {
188
+ return r("NcResource", { key: i.itemId, staticClass: "related-resources__entry", attrs: { icon: i.icon, name: i.title, url: i.url } });
172
189
  })], 2) : e._e();
173
- }, v = [], R = /* @__PURE__ */ i.normalizeComponent(
190
+ }, v = [], R = /* @__PURE__ */ n.normalizeComponent(
174
191
  m,
175
192
  y,
176
193
  v,
177
194
  !1,
178
195
  null,
179
- "01cfeb01",
196
+ "19300848",
180
197
  null,
181
198
  null
182
199
  );
@@ -1 +1 @@
1
- {"version":3,"file":"NcRelatedResourcesPanel.cjs","sources":["../../src/components/NcRelatedResourcesPanel/NcResource.vue","../../src/components/NcRelatedResourcesPanel/NcRelatedResourcesPanel.vue"],"sourcesContent":["<!--\n - @copyright 2022 Christopher Ng <chrng8@gmail.com>\n -\n - @author Christopher Ng <chrng8@gmail.com>\n -\n - @license AGPL-3.0-or-later\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n -\n-->\n\n<template>\n\t<li class=\"resource\">\n\t\t<NcButton class=\"resource__button\"\n\t\t\t:aria-label=\"labelTranslated\"\n\t\t\ttype=\"tertiary\"\n\t\t\t:href=\"url\">\n\t\t\t<template #icon>\n\t\t\t\t<div class=\"resource__icon\">\n\t\t\t\t\t<img :src=\"icon\">\n\t\t\t\t</div>\n\t\t\t</template>\n\t\t\t{{ name }}\n\t\t</NcButton>\n\t</li>\n</template>\n\n<script>\nimport NcButton from '../NcButton/index.js'\n\nimport { t } from '../../l10n.js'\n\nexport default {\n\tname: 'NcResource',\n\n\tcomponents: {\n\t\tNcButton,\n\t},\n\n\tprops: {\n\t\ticon: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tname: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\turl: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tlabelTranslated: t('Open link to \"{resourceName}\"', { resourceName: this.name }),\n\t\t}\n\t},\n\n\tmethods: {\n\t\tt,\n\t},\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.resource {\n\tdisplay: flex;\n\talign-items: center;\n\theight: 44px;\n\n\t// Override default NcButton styles\n\t&__button {\n\t\twidth: 100% !important;\n\t\tjustify-content: flex-start !important;\n\t\tpadding: 0 !important;\n\n\t\t&:deep {\n\t\t\t.button-vue__wrapper {\n\t\t\t\tjustify-content: flex-start !important;\n\n\t\t\t\t.button-vue__text {\n\t\t\t\t\tfont-weight: normal !important;\n\t\t\t\t\tmargin-left: 2px !important;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t&__icon {\n\t\twidth: 32px;\n\t\theight: 32px;\n\t\tbackground-color: var(--color-text-maxcontrast);\n\t\tborder-radius: 50%;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\n\t\timg {\n\t\t\twidth: 16px;\n\t\t\theight: 16px;\n\t\t\tfilter: var(--background-invert-if-dark);\n\t\t}\n\t}\n}\n</style>\n","<!--\n - @copyright 2022 Christopher Ng <chrng8@gmail.com>\n -\n - @author Christopher Ng <chrng8@gmail.com>\n -\n - @license AGPL-3.0-or-later\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n -\n-->\n\n<docs>\n### Usage\n\nUse this component to display the related resources of a given item.\n\n```\n<template>\n\t<NcRelatedResourcesPanel provider-id=\"talk\"\n\t\t:item-id=\"conversationId\" />\n</template>\n\n<script>\nexport default {\n\tdata() {\n\t\treturn {\n\t\t\tconversationId: 1,\n\t\t}\n\t},\n}\n</script>\n```\n</docs>\n\n<template>\n\t<div v-if=\"appEnabled && isVisible\" class=\"related-resources\">\n\t\t<div class=\"related-resources__header\">\n\t\t\t<h5>{{ headerTranslated }}</h5>\n\t\t\t<p>{{ description }}</p>\n\t\t</div>\n\n\t\t<NcResource v-for=\"resource in resources\"\n\t\t\t:key=\"resource.itemId\"\n\t\t\tclass=\"related-resources__entry\"\n\t\t\t:icon=\"resource.icon\"\n\t\t\t:name=\"resource.title\"\n\t\t\t:url=\"resource.url\" />\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { generateOcsUrl } from '@nextcloud/router'\n\nimport NcResource from './NcResource.vue'\n\nimport { t } from '../../l10n.js'\n\nexport default {\n\tname: 'NcRelatedResourcesPanel',\n\n\tcomponents: {\n\t\tNcResource,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The provider id implemented with `\\OCA\\RelatedResources\\IRelatedResourceProvider::getProviderId()`\n\t\t */\n\t\tproviderId: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\t\t/**\n\t\t * The item id which uniquely identities the e.g. Calendar event, Deck board, file, Talk room, etc.\n\t\t */\n\t\titemId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: null,\n\t\t},\n\t\t/**\n\t\t * Limits to specific resource type. i.e. any provider id implemented with `\\OCA\\RelatedResources\\IRelatedResourceProvider::getProviderId()`\n\t\t */\n\t\tresourceType: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\t\t/**\n\t\t * Set the maximum number of resources to load\n\t\t */\n\t\tlimit: {\n\t\t\ttype: Number,\n\t\t\tdefault: null,\n\t\t},\n\t\t/**\n\t\t * Only used by the files sidebar\n\t\t *\n\t\t * File info is passed when registered with `OCA.Sharing.ShareTabSections.registerSection()`\n\t\t */\n\t\tfileInfo: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: [\n\t\t'has-error',\n\t\t'has-resources',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\tappEnabled: OC?.appswebroots?.related_resources !== undefined,\n\t\t\theaderTranslated: t('Related resources'),\n\t\t\tloading: false,\n\t\t\terror: null,\n\t\t\tresources: [],\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tisVisible() {\n\t\t\tif (this.loading) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn this.error ?? this.resources.length > 0\n\t\t},\n\n\t\tdescription() {\n\t\t\tif (this.error) {\n\t\t\t\treturn t('Error getting related resources. Please contact your system administrator if you have any questions.')\n\t\t\t}\n\t\t\treturn t('Anything shared with the same group of people will show up here')\n\t\t},\n\n\t\thasResourceInfo() {\n\t\t\tif (this.providerId !== null && this.itemId !== null) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (this.fileInfo !== null) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\n\t\tisFiles() {\n\t\t\treturn this.fileInfo?.id !== undefined\n\t\t},\n\n\t\turl() {\n\t\t\tlet providerId = null\n\t\t\tlet itemId = null\n\n\t\t\tif (this.isFiles) {\n\t\t\t\tproviderId = 'files'\n\t\t\t\titemId = this.fileInfo.id\n\t\t\t} else {\n\t\t\t\tproviderId = this.providerId\n\t\t\t\titemId = this.itemId\n\t\t\t}\n\n\t\t\treturn generateOcsUrl('/apps/related_resources/related/{providerId}?itemId={itemId}&resourceType={resourceType}&limit={limit}&format=json', {\n\t\t\t\tproviderId,\n\t\t\t\titemId,\n\t\t\t\tresourceType: this.resourceType,\n\t\t\t\tlimit: this.limit,\n\t\t\t})\n\t\t},\n\t},\n\n\twatch: {\n\t\tproviderId() {\n\t\t\tthis.fetchRelatedResources()\n\t\t},\n\t\titemId() {\n\t\t\tthis.fetchRelatedResources()\n\t\t},\n\t\tfileInfo() {\n\t\t\tthis.fetchRelatedResources()\n\t\t},\n\t\terror(error) {\n\t\t\t/**\n\t\t\t * Emitted when the error value changes\n\t\t\t *\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tthis.$emit('has-error', Boolean(error))\n\t\t},\n\t\tresources(resources) {\n\t\t\t/**\n\t\t\t * Emitted when the resources value changes\n\t\t\t *\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tthis.$emit('has-resources', resources.length > 0)\n\t\t},\n\t},\n\n\tcreated() {\n\t\tthis.fetchRelatedResources()\n\t},\n\n\tmethods: {\n\t\tt,\n\t\tasync fetchRelatedResources() {\n\t\t\tif (!this.appEnabled || !this.hasResourceInfo) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.loading = true\n\t\t\tthis.error = null\n\t\t\tthis.resources = []\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(this.url)\n\t\t\t\tthis.resources = response.data.ocs?.data\n\t\t\t} catch (e) {\n\t\t\t\tthis.error = e\n\t\t\t\tconsole.error(e)\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.related-resources {\n\t&__header {\n\t\tmargin: 0 0 10px 46px;\n\n\t\th5 {\n\t\t\tfont-weight: bold;\n\t\t}\n\n\t\tp {\n\t\t\tcolor: var(--color-text-maxcontrast);\n\t\t}\n\t}\n}\n</style>\n"],"names":["_sfc_main$1","Components_NcButton","l10n","_sfc_main","NcResource","_a","providerId","itemId","router","error","resources","response","axios__default"],"mappings":";;AA2CA,MAAAA,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA,UAAAC;AAAA,EACA;AAAA,EAEA,OAAA;AAAA,IACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,IACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,IACA,KAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AACA,WAAA;AAAA,MACA,iBAAAC,EAAA,EAAA,iCAAA,EAAA,cAAA,KAAA,KAAA,CAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,SAAA;AAAA,IACA,GAAAA,EAAA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;ACLA,MAAAC,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA,YAAAC;AAAA,EACA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,YAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAIA,QAAA;AAAA,MACA,MAAA,CAAA,QAAA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAIA,cAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAIA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,UAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AAAA,IACA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;;AACA,WAAA;AAAA,MACA,cAAAC,IAAA,yBAAA,iBAAA,gBAAAA,EAAA,uBA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;AACA,UAAA,GAAA,KAAA,cAAA,CAAA,KAAA,kBAIA;AAAA,aAAA,UAAA,IACA,KAAA,QAAA,MACA,KAAA,YAAA,CAAA;AACA,YAAA;AACA,gBAAAS,IAAA,MAAAC,EAAA,QAAA,IAAA,KAAA,GAAA;AACA,eAAA,aAAAP,IAAAM,EAAA,KAAA,QAAA,gBAAAN,EAAA;AAAA,QACA,SAAA,GAAA;AACA,eAAA,QAAA,GACA,QAAA,MAAA,CAAA;AAAA,QACA,UAAA;AACA,eAAA,UAAA;AAAA,QACA;AAAA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"NcRelatedResourcesPanel.cjs","sources":["../../src/components/NcRelatedResourcesPanel/NcResource.vue","../../src/components/NcRelatedResourcesPanel/NcRelatedResourcesPanel.vue"],"sourcesContent":["<!--\n - @copyright 2022 Christopher Ng <chrng8@gmail.com>\n -\n - @author Christopher Ng <chrng8@gmail.com>\n -\n - @license AGPL-3.0-or-later\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n -\n-->\n\n<template>\n\t<li class=\"resource\">\n\t\t<NcButton class=\"resource__button\"\n\t\t\t:aria-label=\"labelTranslated\"\n\t\t\ttype=\"tertiary\"\n\t\t\t:href=\"url\">\n\t\t\t<template #icon>\n\t\t\t\t<div class=\"resource__icon\">\n\t\t\t\t\t<img :src=\"icon\">\n\t\t\t\t</div>\n\t\t\t</template>\n\t\t\t{{ name }}\n\t\t</NcButton>\n\t</li>\n</template>\n\n<script>\nimport NcButton from '../NcButton/index.js'\n\nimport { t } from '../../l10n.js'\n\nexport default {\n\tname: 'NcResource',\n\n\tcomponents: {\n\t\tNcButton,\n\t},\n\n\tprops: {\n\t\ticon: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tname: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\turl: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tlabelTranslated: t('Open link to \"{resourceName}\"', { resourceName: this.name }),\n\t\t}\n\t},\n\n\tmethods: {\n\t\tt,\n\t},\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.resource {\n\tdisplay: flex;\n\talign-items: center;\n\theight: 44px;\n\n\t// Override default NcButton styles\n\t&__button {\n\t\twidth: 100% !important;\n\t\tjustify-content: flex-start !important;\n\t\tpadding: 0 !important;\n\n\t\t&:deep {\n\t\t\t.button-vue__wrapper {\n\t\t\t\tjustify-content: flex-start !important;\n\n\t\t\t\t.button-vue__text {\n\t\t\t\t\tfont-weight: normal !important;\n\t\t\t\t\tmargin-left: 2px !important;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t&__icon {\n\t\twidth: 32px;\n\t\theight: 32px;\n\t\tbackground-color: var(--color-text-maxcontrast);\n\t\tborder-radius: 50%;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\n\t\timg {\n\t\t\twidth: 16px;\n\t\t\theight: 16px;\n\t\t\tfilter: var(--background-invert-if-dark);\n\t\t}\n\t}\n}\n</style>\n","<!--\n - @copyright 2022 Christopher Ng <chrng8@gmail.com>\n -\n - @author Christopher Ng <chrng8@gmail.com>\n -\n - @license AGPL-3.0-or-later\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n -\n-->\n\n<docs>\n### Usage\n\nUse this component to display the related resources of a given item.\n\n```\n<template>\n\t<NcRelatedResourcesPanel provider-id=\"talk\"\n\t\theader=\"Related resources for talk\"\n\t\t:item-id=\"conversationId\" />\n</template>\n\n<script>\nexport default {\n\tdata() {\n\t\treturn {\n\t\t\tconversationId: 1,\n\t\t}\n\t},\n}\n</script>\n```\n</docs>\n\n<template>\n\t<div v-if=\"appEnabled && isVisible\" class=\"related-resources\">\n\t\t<div class=\"related-resources__header\">\n\t\t\t<h5>{{ header }}</h5>\n\t\t\t<p>{{ subline }}</p>\n\t\t</div>\n\n\t\t<NcResource v-for=\"resource in resources\"\n\t\t\t:key=\"resource.itemId\"\n\t\t\tclass=\"related-resources__entry\"\n\t\t\t:icon=\"resource.icon\"\n\t\t\t:name=\"resource.title\"\n\t\t\t:url=\"resource.url\" />\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { generateOcsUrl } from '@nextcloud/router'\n\nimport NcResource from './NcResource.vue'\n\nimport { t } from '../../l10n.js'\n\nexport default {\n\tname: 'NcRelatedResourcesPanel',\n\n\tcomponents: {\n\t\tNcResource,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The provider id implemented with `\\OCA\\RelatedResources\\IRelatedResourceProvider::getProviderId()`\n\t\t */\n\t\tproviderId: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\t\t/**\n\t\t * The item id which uniquely identities the e.g. Calendar event, Deck board, file, Talk room, etc.\n\t\t */\n\t\titemId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: null,\n\t\t},\n\t\t/**\n\t\t * Limits to specific resource type. i.e. any provider id implemented with `\\OCA\\RelatedResources\\IRelatedResourceProvider::getProviderId()`\n\t\t */\n\t\tresourceType: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\t\t/**\n\t\t * Set the maximum number of resources to load\n\t\t */\n\t\tlimit: {\n\t\t\ttype: Number,\n\t\t\tdefault: null,\n\t\t},\n\t\t/**\n\t\t * Only used by the files sidebar\n\t\t *\n\t\t * File info is passed when registered with `OCA.Sharing.ShareTabSections.registerSection()`\n\t\t */\n\t\tfileInfo: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t\t/**\n\t\t * Make the header name dynamic\n\t\t */\n\t\theader: {\n\t\t\ttype: String,\n\t\t\tdefault: t('Related resources'),\n\t\t},\n\t\tdescription: {\n\t\t\ttype: String,\n\t\t\tdefault: t('Anything shared with the same group of people will show up here'),\n\t\t},\n\t\t/**\n\t\t * If this element is used on a primary element set to true for primary styling.\n\t\t */\n\t\tprimary: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t},\n\n\temits: [\n\t\t'has-error',\n\t\t'has-resources',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\tappEnabled: OC?.appswebroots?.related_resources !== undefined,\n\t\t\tloading: false,\n\t\t\terror: null,\n\t\t\tresources: [],\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tisVisible() {\n\t\t\tif (this.loading) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn this.error ?? this.resources.length > 0\n\t\t},\n\t\tsubline() {\n\t\t\tif (this.error) {\n\t\t\t\treturn t('Error getting related resources. Please contact your system administrator if you have any questions.')\n\t\t\t}\n\t\t\treturn this.description\n\t\t},\n\n\t\thasResourceInfo() {\n\t\t\tif (this.providerId !== null && this.itemId !== null) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (this.fileInfo !== null) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\n\t\tisFiles() {\n\t\t\treturn this.fileInfo?.id !== undefined\n\t\t},\n\n\t\turl() {\n\t\t\tlet providerId = null\n\t\t\tlet itemId = null\n\n\t\t\tif (this.isFiles) {\n\t\t\t\tproviderId = 'files'\n\t\t\t\titemId = this.fileInfo.id\n\t\t\t} else {\n\t\t\t\tproviderId = this.providerId\n\t\t\t\titemId = this.itemId\n\t\t\t}\n\n\t\t\treturn generateOcsUrl('/apps/related_resources/related/{providerId}?itemId={itemId}&resourceType={resourceType}&limit={limit}&format=json', {\n\t\t\t\tproviderId,\n\t\t\t\titemId,\n\t\t\t\tresourceType: this.resourceType,\n\t\t\t\tlimit: this.limit,\n\t\t\t})\n\t\t},\n\t},\n\n\twatch: {\n\t\tproviderId() {\n\t\t\tthis.fetchRelatedResources()\n\t\t},\n\t\titemId() {\n\t\t\tthis.fetchRelatedResources()\n\t\t},\n\t\tfileInfo() {\n\t\t\tthis.fetchRelatedResources()\n\t\t},\n\t\terror(error) {\n\t\t\t/**\n\t\t\t * Emitted when the error value changes\n\t\t\t *\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tthis.$emit('has-error', Boolean(error))\n\t\t},\n\t\tresources(resources) {\n\t\t\t/**\n\t\t\t * Emitted when the resources value changes\n\t\t\t *\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tthis.$emit('has-resources', resources.length > 0)\n\t\t},\n\t},\n\n\tcreated() {\n\t\tthis.fetchRelatedResources()\n\t},\n\n\tmethods: {\n\t\tt,\n\t\tasync fetchRelatedResources() {\n\t\t\tif (!this.appEnabled || !this.hasResourceInfo) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.loading = true\n\t\t\tthis.error = null\n\t\t\tthis.resources = []\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(this.url)\n\t\t\t\tthis.resources = response.data.ocs?.data\n\t\t\t} catch (e) {\n\t\t\t\tthis.error = e\n\t\t\t\tconsole.error(e)\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.related-resources {\n\t&__header {\n\t\tmargin: 0 0 10px 46px;\n\n\t\th5 {\n\t\t\tfont-weight: bold;\n\t\t}\n\n\t\tp {\n\t\t\tcolor: var(--color-text-maxcontrast);\n\t\t}\n\t}\n}\n</style>\n"],"names":["_sfc_main$1","Components_NcButton","l10n","_sfc_main","NcResource","_a","providerId","itemId","router","error","resources","response","axios__default"],"mappings":";;AA2CA,MAAAA,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA,UAAAC;AAAA,EACA;AAAA,EAEA,OAAA;AAAA,IACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,IACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,IACA,KAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AACA,WAAA;AAAA,MACA,iBAAAC,EAAA,EAAA,iCAAA,EAAA,cAAA,KAAA,KAAA,CAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,SAAA;AAAA,IACA,GAAAA,EAAA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;ACJA,MAAAC,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA,YAAAC;AAAA,EACA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,YAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAIA,QAAA;AAAA,MACA,MAAA,CAAA,QAAA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAIA,cAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAIA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,UAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;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;AACA,WAAA,sBAAA;AAAA,IACA;AAAA,IACA,WAAA;AACA,WAAA,sBAAA;AAAA,IACA;AAAA,IACA,MAAAE,GAAA;AAMA,WAAA,MAAA,aAAA,EAAAA,CAAA;AAAA,IACA;AAAA,IACA,UAAAC,GAAA;AAMA,WAAA,MAAA,iBAAAA,EAAA,SAAA,CAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,UAAA;AACA,SAAA,sBAAA;AAAA,EACA;AAAA,EAEA,SAAA;AAAA,IACA,GAAAR,EAAA;AAAA,IACA,MAAA,wBAAA;;AACA,UAAA,GAAA,KAAA,cAAA,CAAA,KAAA,kBAIA;AAAA,aAAA,UAAA,IACA,KAAA,QAAA,MACA,KAAA,YAAA,CAAA;AACA,YAAA;AACA,gBAAAS,IAAA,MAAAC,EAAA,QAAA,IAAA,KAAA,GAAA;AACA,eAAA,aAAAP,IAAAM,EAAA,KAAA,QAAA,gBAAAN,EAAA;AAAA,QACA,SAAA,GAAA;AACA,eAAA,QAAA,GACA,QAAA,MAAA,CAAA;AAAA,QACA,UAAA;AACA,eAAA,UAAA;AAAA,QACA;AAAA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,8 @@
1
- import "../assets/index-e828b286.css";
1
+ import "../assets/index-ab715d82.css";
2
2
  import o from "@nextcloud/axios";
3
3
  import { generateOcsUrl as l } from "@nextcloud/router";
4
4
  import a from "./NcButton.mjs";
5
- import { t as s } from "../chunks/l10n-05a09c66.mjs";
5
+ import { t as s } from "../chunks/l10n-f692947e.mjs";
6
6
  import { n } from "../chunks/_plugin-vue2_normalizer-71e2aa87.mjs";
7
7
  const u = {
8
8
  name: "NcResource",
@@ -37,7 +37,7 @@ var c = function() {
37
37
  return t("li", { staticClass: "resource" }, [t("NcButton", { staticClass: "resource__button", attrs: { "aria-label": e.labelTranslated, type: "tertiary", href: e.url }, scopedSlots: e._u([{ key: "icon", fn: function() {
38
38
  return [t("div", { staticClass: "resource__icon" }, [t("img", { attrs: { src: e.icon } })])];
39
39
  }, proxy: !0 }]) }, [e._v(" " + e._s(e.name) + " ")])], 1);
40
- }, d = [], f = /* @__PURE__ */ n(
40
+ }, d = [], p = /* @__PURE__ */ n(
41
41
  u,
42
42
  c,
43
43
  d,
@@ -47,11 +47,11 @@ var c = function() {
47
47
  null,
48
48
  null
49
49
  );
50
- const _ = f.exports;
51
- const p = {
50
+ const f = p.exports;
51
+ const _ = {
52
52
  name: "NcRelatedResourcesPanel",
53
53
  components: {
54
- NcResource: _
54
+ NcResource: f
55
55
  },
56
56
  props: {
57
57
  /**
@@ -90,6 +90,24 @@ const p = {
90
90
  fileInfo: {
91
91
  type: Object,
92
92
  default: null
93
+ },
94
+ /**
95
+ * Make the header name dynamic
96
+ */
97
+ header: {
98
+ type: String,
99
+ default: s("Related resources")
100
+ },
101
+ description: {
102
+ type: String,
103
+ default: s("Anything shared with the same group of people will show up here")
104
+ },
105
+ /**
106
+ * If this element is used on a primary element set to true for primary styling.
107
+ */
108
+ primary: {
109
+ type: Boolean,
110
+ default: !1
93
111
  }
94
112
  },
95
113
  emits: [
@@ -100,7 +118,6 @@ const p = {
100
118
  var r;
101
119
  return {
102
120
  appEnabled: ((r = OC == null ? void 0 : OC.appswebroots) == null ? void 0 : r.related_resources) !== void 0,
103
- headerTranslated: s("Related resources"),
104
121
  loading: !1,
105
122
  error: null,
106
123
  resources: []
@@ -111,8 +128,8 @@ const p = {
111
128
  var r;
112
129
  return this.loading ? !1 : (r = this.error) != null ? r : this.resources.length > 0;
113
130
  },
114
- description() {
115
- return this.error ? s("Error getting related resources. Please contact your system administrator if you have any questions.") : s("Anything shared with the same group of people will show up here");
131
+ subline() {
132
+ return this.error ? s("Error getting related resources. Please contact your system administrator if you have any questions.") : this.description;
116
133
  },
117
134
  hasResourceInfo() {
118
135
  return this.providerId !== null && this.itemId !== null || this.fileInfo !== null;
@@ -171,20 +188,20 @@ const p = {
171
188
  };
172
189
  var h = function() {
173
190
  var e = this, t = e._self._c;
174
- return e.appEnabled && e.isVisible ? t("div", { staticClass: "related-resources" }, [t("div", { staticClass: "related-resources__header" }, [t("h5", [e._v(e._s(e.headerTranslated))]), t("p", [e._v(e._s(e.description))])]), e._l(e.resources, function(i) {
191
+ return e.appEnabled && e.isVisible ? t("div", { staticClass: "related-resources" }, [t("div", { staticClass: "related-resources__header" }, [t("h5", [e._v(e._s(e.header))]), t("p", [e._v(e._s(e.subline))])]), e._l(e.resources, function(i) {
175
192
  return t("NcResource", { key: i.itemId, staticClass: "related-resources__entry", attrs: { icon: i.icon, name: i.title, url: i.url } });
176
193
  })], 2) : e._e();
177
194
  }, m = [], y = /* @__PURE__ */ n(
178
- p,
195
+ _,
179
196
  h,
180
197
  m,
181
198
  !1,
182
199
  null,
183
- "01cfeb01",
200
+ "19300848",
184
201
  null,
185
202
  null
186
203
  );
187
- const T = y.exports;
204
+ const S = y.exports;
188
205
  export {
189
- T as default
206
+ S as default
190
207
  };