@nextcloud/vue 8.6.2 → 8.7.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 (137) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/Components/NcActionButton.cjs +6 -6
  3. package/dist/Components/NcActionButton.cjs.map +1 -1
  4. package/dist/Components/NcActionButton.mjs +3 -3
  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/NcBreadcrumb.cjs +1 -1
  9. package/dist/Components/NcBreadcrumb.mjs +1 -1
  10. package/dist/Components/NcBreadcrumbs.cjs +1 -1
  11. package/dist/Components/NcBreadcrumbs.mjs +1 -1
  12. package/dist/Components/NcDashboardWidget.cjs +1 -1
  13. package/dist/Components/NcDashboardWidget.mjs +1 -1
  14. package/dist/Components/NcDashboardWidgetItem.cjs +1 -1
  15. package/dist/Components/NcDashboardWidgetItem.mjs +1 -1
  16. package/dist/Components/NcDateTimePicker.cjs +3 -3
  17. package/dist/Components/NcDateTimePicker.cjs.map +1 -1
  18. package/dist/Components/NcDateTimePicker.mjs +8 -8
  19. package/dist/Components/NcDateTimePicker.mjs.map +1 -1
  20. package/dist/Components/NcDateTimePickerNative.cjs +1 -1
  21. package/dist/Components/NcDateTimePickerNative.mjs +1 -1
  22. package/dist/Components/NcListItem.cjs +1 -1
  23. package/dist/Components/NcListItem.mjs +1 -1
  24. package/dist/Components/NcModal.cjs +7 -7
  25. package/dist/Components/NcModal.cjs.map +1 -1
  26. package/dist/Components/NcModal.mjs +6 -6
  27. package/dist/Components/NcModal.mjs.map +1 -1
  28. package/dist/Components/NcRichContenteditable.cjs +1 -1
  29. package/dist/Components/NcRichContenteditable.mjs +1 -1
  30. package/dist/Components/NcRichText.cjs +11 -11
  31. package/dist/Components/NcRichText.cjs.map +1 -1
  32. package/dist/Components/NcRichText.mjs +22 -21
  33. package/dist/Components/NcRichText.mjs.map +1 -1
  34. package/dist/Components/NcSelect.cjs +1 -1
  35. package/dist/Components/NcSelect.mjs +1 -1
  36. package/dist/Components/NcSelectTags.cjs +1 -1
  37. package/dist/Components/NcSelectTags.mjs +1 -1
  38. package/dist/Components/NcSettingsSelectGroup.cjs +1 -1
  39. package/dist/Components/NcSettingsSelectGroup.mjs +1 -1
  40. package/dist/Components/NcTimezonePicker.cjs +1 -1
  41. package/dist/Components/NcTimezonePicker.mjs +1 -1
  42. package/dist/Functions/reference.cjs +16 -0
  43. package/dist/Functions/reference.cjs.map +1 -0
  44. package/dist/Functions/reference.mjs +17 -0
  45. package/dist/Functions/reference.mjs.map +1 -0
  46. package/dist/Functions/registerReference.cjs +71 -0
  47. package/dist/Functions/registerReference.cjs.map +1 -0
  48. package/dist/Functions/registerReference.mjs +71 -0
  49. package/dist/Functions/registerReference.mjs.map +1 -0
  50. package/dist/assets/{NcActionButton-1Z9lN7ar.css → NcActionButton-rOZFVQA8.css} +17 -17
  51. package/dist/assets/{NcBreadcrumb-M3hqCbqS.css → NcBreadcrumb-HspaFygg.css} +16 -16
  52. package/dist/assets/{NcDashboardWidgetItem-S7fELANA.css → NcDashboardWidgetItem-OL--xR_P.css} +15 -13
  53. package/dist/assets/{NcDateTimePicker-rixdCL1X.css → NcDateTimePicker-TArRbMs-.css} +17 -17
  54. package/dist/assets/{NcListItem-5XAhBDJv.css → NcListItem-L8LeGwpe.css} +43 -43
  55. package/dist/assets/{NcModal-UZh031V1.css → NcModal-sIK5sUoC.css} +63 -63
  56. package/dist/assets/{NcRichContenteditable-WQVknpPy.css → NcRichContenteditable-CuR1YKTU.css} +34 -32
  57. package/dist/assets/NcRichText-Pw6kTpnR.css +215 -0
  58. package/dist/assets/referencePickerModal-A0PlFUEI.css +316 -0
  59. package/dist/chunks/{NcActionInput-BN9rIyI8.mjs → NcActionInput-XHMzOL_h.mjs} +1 -1
  60. package/dist/chunks/{NcActionInput-BN9rIyI8.mjs.map → NcActionInput-XHMzOL_h.mjs.map} +1 -1
  61. package/dist/chunks/{NcActionInput-qeRQBGlt.cjs → NcActionInput-f1Oq2O71.cjs} +1 -1
  62. package/dist/chunks/{NcActionInput-qeRQBGlt.cjs.map → NcActionInput-f1Oq2O71.cjs.map} +1 -1
  63. package/dist/chunks/{NcBreadcrumb-EGgIr-sA.cjs → NcBreadcrumb-DEWk7wO9.cjs} +27 -20
  64. package/dist/chunks/NcBreadcrumb-DEWk7wO9.cjs.map +1 -0
  65. package/dist/chunks/{NcBreadcrumb-on01ofev.mjs → NcBreadcrumb-w1UX2NR-.mjs} +13 -6
  66. package/dist/chunks/NcBreadcrumb-w1UX2NR-.mjs.map +1 -0
  67. package/dist/chunks/{NcBreadcrumbs-hQmUGh48.cjs → NcBreadcrumbs-VuaG3ex5.cjs} +1 -1
  68. package/dist/chunks/{NcBreadcrumbs-hQmUGh48.cjs.map → NcBreadcrumbs-VuaG3ex5.cjs.map} +1 -1
  69. package/dist/chunks/{NcBreadcrumbs-2l-mWYHl.mjs → NcBreadcrumbs-tRR9CjKD.mjs} +1 -1
  70. package/dist/chunks/{NcBreadcrumbs-2l-mWYHl.mjs.map → NcBreadcrumbs-tRR9CjKD.mjs.map} +1 -1
  71. package/dist/chunks/{NcDashboardWidget-ogqyHahY.mjs → NcDashboardWidget-9LDutUO0.mjs} +1 -1
  72. package/dist/chunks/{NcDashboardWidget-ogqyHahY.mjs.map → NcDashboardWidget-9LDutUO0.mjs.map} +1 -1
  73. package/dist/chunks/{NcDashboardWidget-QciRRvL4.cjs → NcDashboardWidget-oPZKAkd-.cjs} +1 -1
  74. package/dist/chunks/{NcDashboardWidget-QciRRvL4.cjs.map → NcDashboardWidget-oPZKAkd-.cjs.map} +1 -1
  75. package/dist/chunks/{NcDashboardWidgetItem-mIPkPR7r.cjs → NcDashboardWidgetItem-1r760Ikh.cjs} +3 -3
  76. package/dist/chunks/NcDashboardWidgetItem-1r760Ikh.cjs.map +1 -0
  77. package/dist/chunks/{NcDashboardWidgetItem-wuUHTeLl.mjs → NcDashboardWidgetItem-Qd8gSF2h.mjs} +5 -5
  78. package/dist/chunks/NcDashboardWidgetItem-Qd8gSF2h.mjs.map +1 -0
  79. package/dist/chunks/{NcListItem-RDF4Yv0n.cjs → NcListItem--_PCqetA.cjs} +2 -2
  80. package/dist/chunks/{NcListItem-_PBHug1k.mjs.map → NcListItem--_PCqetA.cjs.map} +1 -1
  81. package/dist/chunks/{NcListItem-_PBHug1k.mjs → NcListItem-AMcc69jK.mjs} +2 -2
  82. package/dist/chunks/{NcListItem-RDF4Yv0n.cjs.map → NcListItem-AMcc69jK.mjs.map} +1 -1
  83. package/dist/chunks/{NcRichContenteditable-xcoJkj3I.cjs → NcRichContenteditable-cUZMZlgG.cjs} +77 -54
  84. package/dist/chunks/NcRichContenteditable-cUZMZlgG.cjs.map +1 -0
  85. package/dist/chunks/{NcRichContenteditable-glkLWE43.mjs → NcRichContenteditable-d4EOAT2a.mjs} +86 -64
  86. package/dist/chunks/NcRichContenteditable-d4EOAT2a.mjs.map +1 -0
  87. package/dist/chunks/NcRichText-S34HoIhH.cjs +313 -0
  88. package/dist/chunks/NcRichText-S34HoIhH.cjs.map +1 -0
  89. package/dist/chunks/NcRichText-yfYdNWFh.mjs +328 -0
  90. package/dist/chunks/NcRichText-yfYdNWFh.mjs.map +1 -0
  91. package/dist/chunks/{NcSelect-SlL-Y8Qz.cjs → NcSelect-U9LJcdIo.cjs} +54 -44
  92. package/dist/chunks/NcSelect-U9LJcdIo.cjs.map +1 -0
  93. package/dist/chunks/{NcSelect-2ClmJ8jJ.mjs → NcSelect-b2H-YQsK.mjs} +39 -29
  94. package/dist/chunks/NcSelect-b2H-YQsK.mjs.map +1 -0
  95. package/dist/chunks/{NcSelectTags-TC2UmbfI.mjs → NcSelectTags-MlILya2b.mjs} +1 -1
  96. package/dist/chunks/{NcSelectTags-TC2UmbfI.mjs.map → NcSelectTags-MlILya2b.mjs.map} +1 -1
  97. package/dist/chunks/{NcSelectTags-FKigJPco.cjs → NcSelectTags-rO88Pk-1.cjs} +1 -1
  98. package/dist/chunks/{NcSelectTags-FKigJPco.cjs.map → NcSelectTags-rO88Pk-1.cjs.map} +1 -1
  99. package/dist/chunks/{NcSettingsSelectGroup-fOU9O4VD.cjs → NcSettingsSelectGroup-rfeDPLCg.cjs} +1 -1
  100. package/dist/chunks/{NcSettingsSelectGroup-fOU9O4VD.cjs.map → NcSettingsSelectGroup-rfeDPLCg.cjs.map} +1 -1
  101. package/dist/chunks/{NcSettingsSelectGroup-Bcai5uHx.mjs → NcSettingsSelectGroup-xhnDBg8a.mjs} +1 -1
  102. package/dist/chunks/{NcSettingsSelectGroup-Bcai5uHx.mjs.map → NcSettingsSelectGroup-xhnDBg8a.mjs.map} +1 -1
  103. package/dist/chunks/{NcTimezonePicker-Dv6pIP9O.cjs → NcTimezonePicker-KG0dvgUv.cjs} +1 -1
  104. package/dist/chunks/{NcTimezonePicker-Dv6pIP9O.cjs.map → NcTimezonePicker-KG0dvgUv.cjs.map} +1 -1
  105. package/dist/chunks/{NcTimezonePicker-DDce-mch.mjs → NcTimezonePicker-jJeiI-Ff.mjs} +1 -1
  106. package/dist/chunks/{NcTimezonePicker-DDce-mch.mjs.map → NcTimezonePicker-jJeiI-Ff.mjs.map} +1 -1
  107. package/dist/chunks/{ScopeComponent-hYwaRplQ.mjs → ScopeComponent-ZQvTL_tO.mjs} +1 -1
  108. package/dist/chunks/{ScopeComponent-hYwaRplQ.mjs.map → ScopeComponent-ZQvTL_tO.mjs.map} +1 -1
  109. package/dist/chunks/{ScopeComponent-qBzpvxit.cjs → ScopeComponent-v4OJPQb8.cjs} +1 -1
  110. package/dist/chunks/{ScopeComponent-qBzpvxit.cjs.map → ScopeComponent-v4OJPQb8.cjs.map} +1 -1
  111. package/dist/chunks/referencePickerModal-cPBjsn4r.cjs +2393 -0
  112. package/dist/chunks/referencePickerModal-cPBjsn4r.cjs.map +1 -0
  113. package/dist/chunks/referencePickerModal-gDBkGfNV.mjs +2414 -0
  114. package/dist/chunks/referencePickerModal-gDBkGfNV.mjs.map +1 -0
  115. package/dist/index.cjs +189 -170
  116. package/dist/index.cjs.map +1 -1
  117. package/dist/index.mjs +178 -159
  118. package/dist/index.mjs.map +1 -1
  119. package/dist/vendor.LICENSE.txt +4 -0
  120. package/package.json +2 -2
  121. package/dist/assets/referencePickerModal-yucfxaTX.css +0 -509
  122. package/dist/chunks/NcBreadcrumb-EGgIr-sA.cjs.map +0 -1
  123. package/dist/chunks/NcBreadcrumb-on01ofev.mjs.map +0 -1
  124. package/dist/chunks/NcDashboardWidgetItem-mIPkPR7r.cjs.map +0 -1
  125. package/dist/chunks/NcDashboardWidgetItem-wuUHTeLl.mjs.map +0 -1
  126. package/dist/chunks/NcRichContenteditable-glkLWE43.mjs.map +0 -1
  127. package/dist/chunks/NcRichContenteditable-xcoJkj3I.cjs.map +0 -1
  128. package/dist/chunks/NcRichText-TdyEC_z7.cjs +0 -337
  129. package/dist/chunks/NcRichText-TdyEC_z7.cjs.map +0 -1
  130. package/dist/chunks/NcRichText-lyvuLvpr.mjs +0 -353
  131. package/dist/chunks/NcRichText-lyvuLvpr.mjs.map +0 -1
  132. package/dist/chunks/NcSelect-2ClmJ8jJ.mjs.map +0 -1
  133. package/dist/chunks/NcSelect-SlL-Y8Qz.cjs.map +0 -1
  134. package/dist/chunks/referencePickerModal-cy4_Q5bu.cjs +0 -880
  135. package/dist/chunks/referencePickerModal-cy4_Q5bu.cjs.map +0 -1
  136. package/dist/chunks/referencePickerModal-wDsYQHxX.mjs +0 -897
  137. package/dist/chunks/referencePickerModal-wDsYQHxX.mjs.map +0 -1
@@ -1,880 +0,0 @@
1
- require('../assets/referencePickerModal-yucfxaTX.css');
2
- "use strict";
3
- const o = require("./_plugin-vue2_normalizer-DCfUPqga.cjs"), i = require("./_l10n-Od-4xzJA.cjs"), D = require("@nextcloud/axios"), y = require("@nextcloud/initial-state"), h = require("@nextcloud/router"), p = require("../Components/NcEmptyContent.cjs"), w = require("./index-FO4BaGaF.cjs"), b = require("./NcSelect-SlL-Y8Qz.cjs"), j = require("../Components/NcLoadingIcon.cjs"), A = require("./NcTextField-eclRKl_B.cjs"), F = require("./DotsHorizontal-6hepLUSS.cjs"), H = require("../Components/NcButton.cjs"), U = require("../Components/NcModal.cjs"), Q = require("@nextcloud/event-bus"), G = require("./ArrowLeft-fC5aEWWu.cjs"), Z = require("./Close-dotk0707.cjs"), J = require("vue"), S = (t) => t && t.__esModule ? t : { default: t }, f = /* @__PURE__ */ S(D), K = /* @__PURE__ */ S(J);
4
- window._vue_richtext_widgets || (window._vue_richtext_widgets = {});
5
- const R = (t) => !!window._vue_richtext_widgets[t], $ = (t, e, r = (s) => {
6
- }) => {
7
- if (window._vue_richtext_widgets[t]) {
8
- console.error("Widget for id " + t + " already registered");
9
- return;
10
- }
11
- window._vue_richtext_widgets[t] = {
12
- id: t,
13
- callback: e,
14
- onDestroy: r
15
- };
16
- }, L = (t, { richObjectType: e, richObject: r, accessible: s, interactive: n }) => {
17
- if (e !== "open-graph") {
18
- if (!window._vue_richtext_widgets[e]) {
19
- console.error("Widget for rich object type " + e + " not registered");
20
- return;
21
- }
22
- window._vue_richtext_widgets[e].callback(t, { richObjectType: e, richObject: r, accessible: s, interactive: n });
23
- }
24
- }, X = (t, e) => {
25
- t !== "open-graph" && window._vue_richtext_widgets[t] && window._vue_richtext_widgets[t].onDestroy(e);
26
- };
27
- window._registerWidget = $;
28
- const Y = {
29
- name: "NcReferenceWidget",
30
- props: {
31
- reference: {
32
- type: Object,
33
- required: !0
34
- }
35
- },
36
- data() {
37
- return {
38
- compact: 3
39
- };
40
- },
41
- computed: {
42
- hasCustomWidget() {
43
- return R(this.reference.richObjectType);
44
- },
45
- noAccess() {
46
- return this.reference && !this.reference.accessible;
47
- },
48
- descriptionStyle() {
49
- if (this.compact === 0)
50
- return {
51
- display: "none"
52
- };
53
- const t = this.compact < 4 ? this.compact : 3;
54
- return {
55
- lineClamp: t,
56
- webkitLineClamp: t
57
- };
58
- },
59
- compactLink() {
60
- const t = this.reference.openGraphObject.link;
61
- return t ? t.startsWith("https://") ? t.substring(8) : t.startsWith("http://") ? t.substring(7) : t : "";
62
- }
63
- },
64
- mounted() {
65
- this.renderWidget(), this.observer = new ResizeObserver((t) => {
66
- t[0].contentRect.width < 450 ? this.compact = 0 : t[0].contentRect.width < 550 ? this.compact = 1 : t[0].contentRect.width < 650 ? this.compact = 2 : this.compact = 3;
67
- }), this.observer.observe(this.$el);
68
- },
69
- beforeDestroy() {
70
- this.observer.disconnect(), X(this.reference.richObjectType, this.$el);
71
- },
72
- methods: {
73
- renderWidget() {
74
- this.$refs.customWidget && (this.$refs.customWidget.innerHTML = ""), this?.reference?.richObjectType !== "open-graph" && this.$nextTick(() => {
75
- L(this.$refs.customWidget, this.reference);
76
- });
77
- }
78
- }
79
- };
80
- var ee = function() {
81
- var e = this, r = e._self._c;
82
- return r("div", [e.reference && e.hasCustomWidget ? r("div", { staticClass: "widget-custom" }, [r("div", { ref: "customWidget" })]) : !e.noAccess && e.reference && e.reference.openGraphObject && !e.hasCustomWidget ? r("a", { staticClass: "widget-default", attrs: { href: e.reference.openGraphObject.link, rel: "noopener noreferrer", target: "_blank" } }, [e.reference.openGraphObject.thumb ? r("img", { staticClass: "widget-default--image", attrs: { src: e.reference.openGraphObject.thumb } }) : e._e(), r("div", { staticClass: "widget-default--details" }, [r("p", { staticClass: "widget-default--name" }, [e._v(e._s(e.reference.openGraphObject.name))]), r("p", { staticClass: "widget-default--description", style: e.descriptionStyle }, [e._v(e._s(e.reference.openGraphObject.description))]), r("p", { staticClass: "widget-default--link" }, [e._v(e._s(e.compactLink))])])]) : e._e()]);
83
- }, te = [], re = /* @__PURE__ */ o.normalizeComponent(
84
- Y,
85
- ee,
86
- te,
87
- !1,
88
- null,
89
- "b1c5a80f",
90
- null,
91
- null
92
- );
93
- const N = re.exports;
94
- window._vue_richtext_custom_picker_elements || (window._vue_richtext_custom_picker_elements = {});
95
- class se {
96
- /**
97
- * @param {HTMLElement} element The HTML element
98
- * @param {object} object The object
99
- */
100
- constructor(e, r) {
101
- this.element = e, this.object = r;
102
- }
103
- }
104
- const a = (t) => !!window._vue_richtext_custom_picker_elements[t], ie = (t) => {
105
- const e = window._vue_richtext_custom_picker_elements[t]?.size;
106
- return ["small", "normal", "large", "full"].includes(e) ? e : null;
107
- }, x = (t, e, r = (n) => {
108
- }, s = "large") => {
109
- if (window._vue_richtext_custom_picker_elements[t]) {
110
- console.error("Custom reference picker element for id " + t + " already registered");
111
- return;
112
- }
113
- window._vue_richtext_custom_picker_elements[t] = {
114
- id: t,
115
- callback: e,
116
- onDestroy: r,
117
- size: s
118
- };
119
- }, E = (t, { providerId: e, accessible: r }) => {
120
- if (!window._vue_richtext_custom_picker_elements[e]) {
121
- console.error("Custom reference picker element for reference provider ID " + e + " not registered");
122
- return;
123
- }
124
- return window._vue_richtext_custom_picker_elements[e].callback(t, { providerId: e, accessible: r });
125
- }, ne = (t, e, r) => {
126
- window._vue_richtext_custom_picker_elements[t] && window._vue_richtext_custom_picker_elements[t].onDestroy(e, r);
127
- };
128
- window._registerCustomPickerElement = x;
129
- const oe = {
130
- name: "NcCustomPickerElement",
131
- props: {
132
- /**
133
- * The reference provider
134
- */
135
- provider: {
136
- type: Object,
137
- required: !0
138
- }
139
- },
140
- emits: [
141
- "cancel",
142
- "submit"
143
- ],
144
- data() {
145
- return {
146
- isRegistered: a(this.provider.id),
147
- renderResult: null
148
- };
149
- },
150
- mounted() {
151
- this.isRegistered && this.renderElement();
152
- },
153
- beforeDestroy() {
154
- this.isRegistered && ne(this.provider.id, this.$el, this.renderResult);
155
- },
156
- methods: {
157
- renderElement() {
158
- this.$refs.domElement && (this.$refs.domElement.innerHTML = "");
159
- const t = E(this.$refs.domElement, { providerId: this.provider.id, accessible: !1 });
160
- Promise.resolve(t).then((e) => {
161
- this.renderResult = e, this.renderResult.object?._isVue && this.renderResult.object?.$on && (this.renderResult.object.$on("submit", this.onSubmit), this.renderResult.object.$on("cancel", this.onCancel)), this.renderResult.element.addEventListener("submit", (r) => {
162
- this.onSubmit(r.detail);
163
- }), this.renderResult.element.addEventListener("cancel", this.onCancel);
164
- });
165
- },
166
- onSubmit(t) {
167
- this.$emit("submit", t);
168
- },
169
- onCancel() {
170
- this.$emit("cancel");
171
- }
172
- }
173
- };
174
- var ce = function() {
175
- var e = this, r = e._self._c;
176
- return r("div", { ref: "domElement" });
177
- }, le = [], ae = /* @__PURE__ */ o.normalizeComponent(
178
- oe,
179
- ce,
180
- le,
181
- !1,
182
- null,
183
- "cf695ff9",
184
- null,
185
- null
186
- );
187
- const ue = ae.exports;
188
- i.register(i.t7);
189
- const _ = "any-link", I = {
190
- id: _,
191
- title: i.t("Any link"),
192
- icon_url: h.imagePath("core", "filetypes/link.svg")
193
- };
194
- window._vue_richtext_reference_providers || (window._vue_richtext_reference_providers = y.loadState("core", "reference-provider-list", []));
195
- window._vue_richtext_reference_provider_timestamps || (window._vue_richtext_reference_provider_timestamps = y.loadState("core", "reference-provider-timestamps", {}));
196
- function O(t) {
197
- return t === _ ? I : v().find((e) => e.id === t);
198
- }
199
- function v() {
200
- return window._vue_richtext_reference_providers.filter((t) => {
201
- const e = !!t.search_providers_ids && t.search_providers_ids.length > 0 || a(t.id);
202
- return e || console.debug("[smart picker]", t.id, "reference provider is discoverable but does not have any related search provider or custom picker component registered"), e;
203
- });
204
- }
205
- function q(t) {
206
- const e = window._vue_richtext_reference_provider_timestamps;
207
- return t.sort((r, s) => r.order === s.order ? 0 : r.order > s.order ? 1 : -1).sort((r, s) => {
208
- const n = e[r.id], c = e[s.id];
209
- return n === c ? 0 : c === void 0 ? -1 : n === void 0 ? 1 : n > c ? -1 : 1;
210
- });
211
- }
212
- function B(t, e = null) {
213
- const r = v(), s = t.replace(/[/\-\\^$*+?.()|[\]{}]/g, "\\$&"), n = new RegExp(s, "i"), m = q(r).filter((l) => l.title.match(n)), u = e ? m.slice(0, e) : m;
214
- return (t === "" || u.length === 0) && u.push(I), u;
215
- }
216
- function de(t) {
217
- const e = Math.floor(Date.now() / 1e3), r = {
218
- timestamp: e
219
- }, s = h.generateOcsUrl("references/provider/{providerId}", { providerId: t });
220
- f.default.put(s, r).then((n) => {
221
- window._vue_richtext_reference_provider_timestamps[t] = e;
222
- });
223
- }
224
- let k = 0;
225
- function M(t, e) {
226
- return function() {
227
- const r = this, s = arguments;
228
- clearTimeout(k), k = setTimeout(function() {
229
- t.apply(r, s);
230
- }, e || 0);
231
- };
232
- }
233
- function g(t) {
234
- try {
235
- return !!new URL(t);
236
- } catch {
237
- return !1;
238
- }
239
- }
240
- i.register(i.t33, i.t36);
241
- const he = {
242
- name: "LinkVariantIcon",
243
- emits: ["click"],
244
- props: {
245
- title: {
246
- type: String
247
- },
248
- fillColor: {
249
- type: String,
250
- default: "currentColor"
251
- },
252
- size: {
253
- type: Number,
254
- default: 24
255
- }
256
- }
257
- };
258
- var me = function() {
259
- var e = this, r = e._self._c;
260
- return r("span", e._b({ staticClass: "material-design-icon link-variant-icon", attrs: { "aria-hidden": e.title ? null : !0, "aria-label": e.title, role: "img" }, on: { click: function(s) {
261
- return e.$emit("click", s);
262
- } } }, "span", e.$attrs, !1), [r("svg", { staticClass: "material-design-icon__svg", attrs: { fill: e.fillColor, width: e.size, height: e.size, viewBox: "0 0 24 24" } }, [r("path", { attrs: { d: "M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z" } }, [e.title ? r("title", [e._v(e._s(e.title))]) : e._e()])])]);
263
- }, pe = [], fe = /* @__PURE__ */ o.normalizeComponent(
264
- he,
265
- me,
266
- pe,
267
- !1,
268
- null,
269
- null,
270
- null,
271
- null
272
- );
273
- const C = fe.exports, _e = {
274
- name: "NcProviderList",
275
- components: {
276
- NcSelect: b.NcSelect,
277
- NcHighlight: w.NcHighlight,
278
- NcEmptyContent: p,
279
- LinkVariantIcon: C
280
- },
281
- emits: [
282
- "select-provider",
283
- "submit"
284
- ],
285
- data() {
286
- return {
287
- selectedProvider: null,
288
- query: "",
289
- multiselectPlaceholder: i.t("Select provider"),
290
- providerIconAlt: i.t("Provider icon")
291
- };
292
- },
293
- computed: {
294
- options() {
295
- const t = [];
296
- return this.query !== "" && g(this.query) && t.push({
297
- id: this.query,
298
- title: this.query,
299
- isLink: !0
300
- }), t.push(...B(this.query)), t;
301
- }
302
- },
303
- methods: {
304
- focus() {
305
- setTimeout(() => {
306
- this.$refs["provider-select"]?.$el?.querySelector("#provider-select-input")?.focus();
307
- }, 300);
308
- },
309
- onProviderSelected(t) {
310
- t !== null && (t.isLink ? this.$emit("submit", t.title) : this.$emit("select-provider", t), this.selectedProvider = null);
311
- },
312
- onSearch(t, e) {
313
- this.query = t;
314
- }
315
- }
316
- };
317
- var ve = function() {
318
- var e = this, r = e._self._c;
319
- return r("div", { staticClass: "provider-list" }, [r("NcSelect", { ref: "provider-select", staticClass: "provider-list--select", attrs: { "input-id": "provider-select-input", label: "title", placeholder: e.multiselectPlaceholder, options: e.options, "append-to-body": !1, "clear-search-on-select": !0, "clear-search-on-blur": () => !1, filterable: !1 }, on: { search: e.onSearch, input: e.onProviderSelected }, scopedSlots: e._u([{ key: "option", fn: function(s) {
320
- return [s.isLink ? r("div", { staticClass: "provider" }, [r("LinkVariantIcon", { staticClass: "link-icon", attrs: { size: 20 } }), r("span", [e._v(e._s(s.title))])], 1) : r("div", { staticClass: "provider" }, [r("img", { staticClass: "provider-icon", attrs: { src: s.icon_url, alt: e.providerIconAlt } }), r("NcHighlight", { staticClass: "option-text", attrs: { search: e.query, text: s.title } })], 1)];
321
- } }]), model: { value: e.selectedProvider, callback: function(s) {
322
- e.selectedProvider = s;
323
- }, expression: "selectedProvider" } }), r("NcEmptyContent", { staticClass: "provider-list--empty-content", scopedSlots: e._u([{ key: "icon", fn: function() {
324
- return [r("LinkVariantIcon")];
325
- }, proxy: !0 }]) })], 1);
326
- }, ge = [], Ce = /* @__PURE__ */ o.normalizeComponent(
327
- _e,
328
- ve,
329
- ge,
330
- !1,
331
- null,
332
- "9d850ea5",
333
- null,
334
- null
335
- );
336
- const ke = Ce.exports;
337
- i.register(i.t20);
338
- const Pe = {
339
- name: "NcRawLinkInput",
340
- components: {
341
- LinkVariantIcon: C,
342
- NcEmptyContent: p,
343
- NcLoadingIcon: j,
344
- NcReferenceWidget: N,
345
- NcTextField: A.NcTextField
346
- },
347
- props: {
348
- /**
349
- * The reference provider
350
- */
351
- provider: {
352
- type: Object,
353
- required: !0
354
- }
355
- },
356
- emits: [
357
- "submit"
358
- ],
359
- data() {
360
- return {
361
- inputValue: "",
362
- loading: !1,
363
- reference: null,
364
- abortController: null,
365
- inputPlaceholder: i.t("Enter link")
366
- };
367
- },
368
- computed: {
369
- isLinkValid() {
370
- return g(this.inputValue);
371
- }
372
- },
373
- methods: {
374
- focus() {
375
- this.$refs["url-input"].$el.getElementsByTagName("input")[0]?.focus();
376
- },
377
- onSubmit(t) {
378
- const e = t.target.value;
379
- this.isLinkValid && this.$emit("submit", e);
380
- },
381
- onClear() {
382
- this.inputValue = "", this.reference = null;
383
- },
384
- onInput() {
385
- this.reference = null, this.abortController && this.abortController.abort(), this.isLinkValid && M(() => {
386
- this.updateReference();
387
- }, 500)();
388
- },
389
- updateReference() {
390
- this.loading = !0, this.abortController = new AbortController(), f.default.get(h.generateOcsUrl("references/resolve", 2) + "?reference=" + encodeURIComponent(this.inputValue), {
391
- signal: this.abortController.signal
392
- }).then((t) => {
393
- this.reference = t.data.ocs.data.references[this.inputValue];
394
- }).catch((t) => {
395
- console.error(t);
396
- }).then(() => {
397
- this.loading = !1;
398
- });
399
- }
400
- }
401
- };
402
- var ye = function() {
403
- var e = this, r = e._self._c;
404
- return r("div", { staticClass: "raw-link" }, [r("div", { staticClass: "input-wrapper" }, [r("NcTextField", { ref: "url-input", attrs: { value: e.inputValue, "show-trailing-button": e.inputValue !== "", label: e.inputPlaceholder }, on: { "update:value": [function(s) {
405
- e.inputValue = s;
406
- }, e.onInput], "trailing-button-click": e.onClear }, nativeOn: { keyup: function(s) {
407
- return !s.type.indexOf("key") && e._k(s.keyCode, "enter", 13, s.key, "Enter") ? null : e.onSubmit.apply(null, arguments);
408
- } } }, [e.loading ? r("NcLoadingIcon", { attrs: { size: 16 } }) : r("LinkVariantIcon", { attrs: { size: 16 } })], 1)], 1), e.reference !== null ? r("NcReferenceWidget", { staticClass: "reference-widget", attrs: { reference: e.reference } }) : r("NcEmptyContent", { staticClass: "raw-link--empty-content", scopedSlots: e._u([{ key: "icon", fn: function() {
409
- return [e.provider.icon_url ? r("img", { staticClass: "provider-icon", attrs: { src: e.provider.icon_url } }) : r("LinkVariantIcon")];
410
- }, proxy: !0 }]) })], 1);
411
- }, we = [], be = /* @__PURE__ */ o.normalizeComponent(
412
- Pe,
413
- ye,
414
- we,
415
- !1,
416
- null,
417
- "d0ba247a",
418
- null,
419
- null
420
- );
421
- const Se = be.exports, Re = {
422
- name: "NcSearchResult",
423
- components: {
424
- NcHighlight: w.NcHighlight
425
- },
426
- props: {
427
- /**
428
- * Unified search result entry
429
- */
430
- entry: {
431
- type: Object,
432
- required: !0
433
- },
434
- /**
435
- * The query that led to getting this result
436
- * Used to highlight the entry text
437
- */
438
- query: {
439
- type: String,
440
- required: !0
441
- }
442
- }
443
- };
444
- var $e = function() {
445
- var e = this, r = e._self._c;
446
- return r("div", { staticClass: "result" }, [e.entry.icon ? r("div", { staticClass: "result--icon-class", class: { [e.entry.icon]: !0, rounded: e.entry.rounded } }) : r("img", { staticClass: "result--image", class: { rounded: e.entry.rounded }, attrs: { src: e.entry.thumbnailUrl } }), r("div", { staticClass: "result--content" }, [r("span", { staticClass: "result--content--name" }, [r("NcHighlight", { attrs: { search: e.query, text: e.entry.title } })], 1), r("span", { staticClass: "result--content--subline" }, [r("NcHighlight", { attrs: { search: e.query, text: e.entry.subline } })], 1)])]);
447
- }, Le = [], Ne = /* @__PURE__ */ o.normalizeComponent(
448
- Re,
449
- $e,
450
- Le,
451
- !1,
452
- null,
453
- "7a394a58",
454
- null,
455
- null
456
- );
457
- const xe = Ne.exports;
458
- i.register(i.t26, i.t33, i.t34);
459
- const P = 5, Ee = {
460
- name: "NcSearch",
461
- components: {
462
- LinkVariantIcon: C,
463
- DotsHorizontalIcon: F.DotsHorizontal,
464
- NcEmptyContent: p,
465
- NcSelect: b.NcSelect,
466
- NcSearchResult: xe
467
- },
468
- props: {
469
- /**
470
- * The selected reference provider
471
- */
472
- provider: {
473
- type: Object,
474
- required: !0
475
- },
476
- showEmptyContent: {
477
- type: Boolean,
478
- default: !0
479
- },
480
- searchPlaceholder: {
481
- type: String,
482
- default: null
483
- }
484
- },
485
- emits: [
486
- "submit"
487
- ],
488
- data() {
489
- return {
490
- searchQuery: "",
491
- selectedResult: null,
492
- resultsBySearchProvider: {},
493
- searching: !1,
494
- searchingMoreOf: null,
495
- abortController: null,
496
- noOptionsText: i.t("Start typing to search"),
497
- providerIconAlt: i.t("Provider icon")
498
- };
499
- },
500
- computed: {
501
- mySearchPlaceholder() {
502
- return this.searchPlaceholder || i.t("Search");
503
- },
504
- searchProviderIds() {
505
- return this.provider.search_providers_ids;
506
- },
507
- options() {
508
- if (this.searchQuery === "")
509
- return [];
510
- const t = [];
511
- return g(this.searchQuery) && t.push(this.rawLinkEntry), t.push(...this.formattedSearchResults), t;
512
- },
513
- rawLinkEntry() {
514
- return {
515
- id: "rawLinkEntry",
516
- resourceUrl: this.searchQuery,
517
- isRawLink: !0
518
- };
519
- },
520
- formattedSearchResults() {
521
- const t = [];
522
- return this.searchProviderIds.forEach((e) => {
523
- if (this.resultsBySearchProvider[e].entries.length > 0) {
524
- (this.searchProviderIds.length > 1 || this.resultsBySearchProvider[e].entries.length > 1) && t.push({
525
- id: "groupTitle-" + e,
526
- name: this.resultsBySearchProvider[e].name,
527
- isCustomGroupTitle: !0,
528
- providerId: e
529
- });
530
- const r = this.resultsBySearchProvider[e].entries.map((s, n) => ({
531
- id: "provider-" + e + "-entry-" + n,
532
- ...s
533
- }));
534
- t.push(...r), this.resultsBySearchProvider[e].isPaginated && t.push({
535
- id: "moreOf-" + e,
536
- name: this.resultsBySearchProvider[e].name,
537
- isMore: !0,
538
- providerId: e,
539
- isLoading: this.searchingMoreOf === e
540
- });
541
- }
542
- }), t;
543
- }
544
- },
545
- mounted() {
546
- this.resetResults();
547
- },
548
- beforeDestroy() {
549
- this.cancelSearchRequests();
550
- },
551
- methods: {
552
- t: i.t,
553
- resetResults() {
554
- const t = {};
555
- this.searchProviderIds.forEach((e) => {
556
- t[e] = {
557
- entries: []
558
- };
559
- }), this.resultsBySearchProvider = t;
560
- },
561
- focus() {
562
- setTimeout(() => {
563
- this.$refs["search-select"]?.$el?.querySelector("#search-select-input")?.focus();
564
- }, 300);
565
- },
566
- cancelSearchRequests() {
567
- this.abortController && this.abortController.abort();
568
- },
569
- onSearchInput(t, e) {
570
- this.searchQuery = t, M(() => {
571
- this.updateSearch();
572
- }, 500)();
573
- },
574
- onSelectResultSelected(t) {
575
- t !== null && (t.resourceUrl ? (this.cancelSearchRequests(), this.$emit("submit", t.resourceUrl)) : t.isMore && this.searchMoreOf(t.providerId).then(() => {
576
- this.selectedResult = null;
577
- }));
578
- },
579
- searchMoreOf(t) {
580
- return this.searchingMoreOf = t, this.cancelSearchRequests(), this.searchProviders(t);
581
- },
582
- updateSearch() {
583
- if (this.cancelSearchRequests(), this.resetResults(), this.searchQuery === "") {
584
- this.searching = !1;
585
- return;
586
- }
587
- return this.searchProviders();
588
- },
589
- searchProviders(t = null) {
590
- this.abortController = new AbortController(), this.searching = !0;
591
- const e = t === null ? [...this.searchProviderIds].map((r) => this.searchOneProvider(r)) : [this.searchOneProvider(t, this.resultsBySearchProvider[t]?.cursor ?? null)];
592
- return Promise.allSettled(e).then((r) => {
593
- !!r.find((n) => n.status === "rejected" && (n.reason.name === "CanceledError" || n.reason.code === "ERR_CANCELED")) || (this.searching = !1, this.searchingMoreOf = null);
594
- });
595
- },
596
- searchOneProvider(t, e = null) {
597
- const r = e === null ? h.generateOcsUrl("search/providers/{providerId}/search?term={term}&limit={limit}", { providerId: t, term: this.searchQuery, limit: P }) : h.generateOcsUrl("search/providers/{providerId}/search?term={term}&limit={limit}&cursor={cursor}", { providerId: t, term: this.searchQuery, limit: P, cursor: e });
598
- return f.default.get(r, {
599
- signal: this.abortController.signal
600
- }).then((s) => {
601
- const n = s.data.ocs.data;
602
- this.resultsBySearchProvider[t].name = n.name, this.resultsBySearchProvider[t].cursor = n.cursor, this.resultsBySearchProvider[t].isPaginated = n.isPaginated, this.resultsBySearchProvider[t].entries.push(...n.entries);
603
- });
604
- }
605
- }
606
- };
607
- var Ie = function() {
608
- var e = this, r = e._self._c;
609
- return r("div", { staticClass: "smart-picker-search", class: { "with-empty-content": e.showEmptyContent } }, [r("NcSelect", { ref: "search-select", staticClass: "smart-picker-search--select", attrs: { "input-id": "search-select-input", label: "name", placeholder: e.mySearchPlaceholder, options: e.options, "append-to-body": !1, "close-on-select": !1, "clear-search-on-select": !1, "clear-search-on-blur": () => !1, "reset-focus-on-options-change": !1, filterable: !1, autoscroll: !0, "reset-on-options-change": !1, loading: e.searching }, on: { search: e.onSearchInput, input: e.onSelectResultSelected }, scopedSlots: e._u([{ key: "option", fn: function(s) {
610
- return [s.isRawLink ? r("div", { staticClass: "custom-option" }, [r("LinkVariantIcon", { staticClass: "option-simple-icon", attrs: { size: 20 } }), r("span", { staticClass: "option-text" }, [e._v(" " + e._s(e.t("Raw link {options}", { options: s.resourceUrl })) + " ")])], 1) : s.resourceUrl ? r("NcSearchResult", { staticClass: "search-result", attrs: { entry: s, query: e.searchQuery } }) : s.isCustomGroupTitle ? r("span", { staticClass: "custom-option group-name" }, [e.provider.icon_url ? r("img", { staticClass: "provider-icon group-name-icon", attrs: { src: e.provider.icon_url } }) : e._e(), r("span", { staticClass: "option-text" }, [r("strong", [e._v(e._s(s.name))])])]) : s.isMore ? r("span", { class: { "custom-option": !0 } }, [s.isLoading ? r("span", { staticClass: "option-simple-icon icon-loading-small" }) : r("DotsHorizontalIcon", { staticClass: "option-simple-icon", attrs: { size: 20 } }), r("span", { staticClass: "option-text" }, [e._v(" " + e._s(e.t('Load more "{options}"', { options: s.name })) + " ")])], 1) : e._e()];
611
- } }, { key: "no-options", fn: function() {
612
- return [e._v(" " + e._s(e.noOptionsText) + " ")];
613
- }, proxy: !0 }]), model: { value: e.selectedResult, callback: function(s) {
614
- e.selectedResult = s;
615
- }, expression: "selectedResult" } }), e.showEmptyContent ? r("NcEmptyContent", { staticClass: "smart-picker-search--empty-content", scopedSlots: e._u([{ key: "icon", fn: function() {
616
- return [e.provider.icon_url ? r("img", { staticClass: "provider-icon", attrs: { alt: e.providerIconAlt, src: e.provider.icon_url } }) : r("LinkVariantIcon")];
617
- }, proxy: !0 }], null, !1, 2922132592) }) : e._e()], 1);
618
- }, Oe = [], qe = /* @__PURE__ */ o.normalizeComponent(
619
- Ee,
620
- Ie,
621
- Oe,
622
- !1,
623
- null,
624
- "97d196f0",
625
- null,
626
- null
627
- );
628
- const W = qe.exports, d = {
629
- providerList: 1,
630
- standardLinkInput: 2,
631
- searchInput: 3,
632
- customElement: 4
633
- }, Be = {
634
- name: "NcReferencePicker",
635
- components: {
636
- NcCustomPickerElement: ue,
637
- NcProviderList: ke,
638
- NcRawLinkInput: Se,
639
- NcSearch: W
640
- },
641
- props: {
642
- /**
643
- * Provider to select on creation
644
- * Default: null. Show the provider list
645
- */
646
- initialProvider: {
647
- type: Object,
648
- default: () => null
649
- },
650
- /**
651
- * Optional width in pixels
652
- * Default: 100%
653
- */
654
- width: {
655
- type: Number,
656
- default: null
657
- },
658
- /**
659
- * Focus on the provider list select input on creation
660
- * Default: true
661
- */
662
- focusOnCreate: {
663
- type: Boolean,
664
- default: !0
665
- }
666
- },
667
- emits: [
668
- "cancel",
669
- "cancel-raw-link",
670
- "cancel-search",
671
- "provider-selected",
672
- "submit"
673
- ],
674
- data() {
675
- return {
676
- MODES: d,
677
- selectedProvider: this.initialProvider
678
- };
679
- },
680
- computed: {
681
- mode() {
682
- return this.selectedProvider === null ? d.providerList : a(this.selectedProvider.id) ? d.customElement : this.selectedProvider.search_providers_ids ? d.searchInput : d.standardLinkInput;
683
- },
684
- pickerWrapperStyle() {
685
- return {
686
- width: this.width ? this.width + "px" : void 0
687
- };
688
- }
689
- },
690
- mounted() {
691
- this.focusOnCreate && (this.initialProvider ? setTimeout(() => {
692
- this.$refs["url-input"]?.focus();
693
- }, 300) : this.$nextTick(() => {
694
- this.$refs["provider-list"]?.focus();
695
- }));
696
- },
697
- methods: {
698
- onEscapePressed() {
699
- this.selectedProvider !== null ? this.deselectProvider() : this.cancelProviderSelection();
700
- },
701
- onProviderSelected(t) {
702
- this.selectedProvider = t, this.$emit("provider-selected", t), this.$nextTick(() => {
703
- this.$refs["url-input"]?.focus();
704
- });
705
- },
706
- cancelCustomElement() {
707
- this.deselectProvider();
708
- },
709
- cancelSearch() {
710
- this.$emit("cancel-search", this.selectedProvider?.title), this.deselectProvider();
711
- },
712
- cancelRawLinkInput() {
713
- this.$emit("cancel-raw-link", this.selectedProvider?.title), this.deselectProvider();
714
- },
715
- cancelProviderSelection() {
716
- this.$emit("cancel");
717
- },
718
- submitLink(t) {
719
- this.selectedProvider !== null && de(this.selectedProvider.id), this.$emit("submit", t), this.deselectProvider();
720
- },
721
- deselectProvider() {
722
- this.selectedProvider = null, this.$emit("provider-selected", null), setTimeout(() => {
723
- this.$refs["provider-list"]?.focus();
724
- }, 300);
725
- }
726
- }
727
- };
728
- var Me = function() {
729
- var e = this, r = e._self._c;
730
- return r("div", { staticClass: "reference-picker", style: e.pickerWrapperStyle, attrs: { tabindex: "-1" }, on: { keydown: function(s) {
731
- return !s.type.indexOf("key") && e._k(s.keyCode, "esc", 27, s.key, ["Esc", "Escape"]) ? null : (s.stopPropagation(), s.preventDefault(), e.onEscapePressed.apply(null, arguments));
732
- } } }, [e.mode === e.MODES.providerList ? r("NcProviderList", { ref: "provider-list", on: { "select-provider": e.onProviderSelected, submit: e.submitLink, cancel: e.cancelProviderSelection } }) : e.mode === e.MODES.standardLinkInput ? r("NcRawLinkInput", { ref: "url-input", attrs: { provider: e.selectedProvider }, on: { submit: e.submitLink, cancel: e.cancelRawLinkInput } }) : e.mode === e.MODES.searchInput ? r("NcSearch", { ref: "url-input", attrs: { provider: e.selectedProvider }, on: { cancel: e.cancelSearch, submit: e.submitLink } }) : e.mode === e.MODES.customElement ? r("div", { staticClass: "custom-element-wrapper" }, [r("NcCustomPickerElement", { attrs: { provider: e.selectedProvider }, on: { submit: e.submitLink, cancel: e.cancelCustomElement } })], 1) : e._e()], 1);
733
- }, We = [], ze = /* @__PURE__ */ o.normalizeComponent(
734
- Be,
735
- Me,
736
- We,
737
- !1,
738
- null,
739
- "aa77d0d3",
740
- null,
741
- null
742
- );
743
- const z = ze.exports;
744
- i.register(i.t11, i.t16);
745
- const Ve = {
746
- name: "NcReferencePickerModal",
747
- components: {
748
- NcReferencePicker: z,
749
- NcModal: U,
750
- NcButton: H,
751
- ArrowLeftIcon: G.ArrowLeft,
752
- CloseIcon: Z.Close
753
- },
754
- props: {
755
- /**
756
- * Provider to select on creation
757
- * Show the provider list if no initial one is provided
758
- */
759
- initialProvider: {
760
- type: Object,
761
- default: () => null
762
- },
763
- /**
764
- * Focus on the input item on create
765
- */
766
- focusOnCreate: {
767
- type: Boolean,
768
- default: !0
769
- },
770
- /**
771
- * If true, add the modal content to the Viewer trap elements via the event-bus
772
- */
773
- isInsideViewer: {
774
- type: Boolean,
775
- default: !1
776
- }
777
- },
778
- emits: [
779
- "cancel",
780
- "submit"
781
- ],
782
- data() {
783
- return {
784
- show: !0,
785
- selectedProvider: this.initialProvider,
786
- backButtonTitle: i.t("Back to provider selection"),
787
- closeButtonTitle: i.t("Close"),
788
- closeButtonLabel: i.t("Close Smart Picker")
789
- };
790
- },
791
- computed: {
792
- isProviderSelected() {
793
- return this.selectedProvider !== null;
794
- },
795
- showBackButton() {
796
- return this.initialProvider === null && this.isProviderSelected;
797
- },
798
- modalSize() {
799
- return this.isProviderSelected && a(this.selectedProvider.id) ? ie(this.selectedProvider.id) ?? "large" : "normal";
800
- },
801
- showModalName() {
802
- return !this.isProviderSelected || !a(this.selectedProvider.id);
803
- },
804
- modalName() {
805
- return this.isProviderSelected ? this.selectedProvider.title : i.t("Smart Picker");
806
- }
807
- },
808
- mounted() {
809
- if (this.isInsideViewer) {
810
- const t = this.$refs.modal_content;
811
- Q.emit("viewer:trapElements:changed", t);
812
- }
813
- },
814
- methods: {
815
- onCancel() {
816
- this.show = !1, this.$emit("cancel");
817
- },
818
- onSubmit(t) {
819
- this.show = !1, this.$emit("submit", t);
820
- },
821
- onProviderSelect(t) {
822
- this.selectedProvider = t, t === null && this.initialProvider !== null && this.onCancel();
823
- },
824
- onBackClicked() {
825
- this.$refs.referencePicker.deselectProvider();
826
- }
827
- }
828
- };
829
- var Te = function() {
830
- var e = this, r = e._self._c;
831
- return e.show ? r("NcModal", { staticClass: "reference-picker-modal", attrs: { size: e.modalSize, "can-close": !1 }, on: { close: e.onCancel } }, [r("div", { ref: "modal_content", staticClass: "reference-picker-modal--content" }, [e.showBackButton ? r("NcButton", { staticClass: "back-button", attrs: { "aria-label": e.backButtonTitle, title: e.backButtonTitle }, on: { click: e.onBackClicked }, scopedSlots: e._u([{ key: "icon", fn: function() {
832
- return [r("ArrowLeftIcon")];
833
- }, proxy: !0 }], null, !1, 3001860362) }) : e._e(), r("NcButton", { staticClass: "close-button", attrs: { "aria-label": e.closeButtonLabel, title: e.closeButtonTitle, type: "tertiary" }, on: { click: e.onCancel }, scopedSlots: e._u([{ key: "icon", fn: function() {
834
- return [r("CloseIcon")];
835
- }, proxy: !0 }], null, !1, 2491825086) }), e.showModalName ? r("h2", [e._v(" " + e._s(e.modalName) + " ")]) : e._e(), r("NcReferencePicker", { ref: "referencePicker", attrs: { "initial-provider": e.initialProvider, "focus-on-create": e.focusOnCreate }, on: { "provider-selected": e.onProviderSelect, submit: e.onSubmit, cancel: e.onCancel } })], 1)]) : e._e();
836
- }, De = [], je = /* @__PURE__ */ o.normalizeComponent(
837
- Ve,
838
- Te,
839
- De,
840
- !1,
841
- null,
842
- "3f1a4ac7",
843
- null,
844
- null
845
- );
846
- const V = je.exports;
847
- async function Ae(t = null, e = void 0) {
848
- return await new Promise((r, s) => {
849
- const n = "referencePickerModal", c = document.createElement("div");
850
- c.id = n, document.body.append(c);
851
- const m = t === null ? null : O(t) ?? null, u = K.default.extend(V), l = new u({
852
- propsData: {
853
- initialProvider: m,
854
- isInsideViewer: e
855
- }
856
- }).$mount(c);
857
- l.$on("cancel", () => {
858
- l.$destroy(), s(new Error("User cancellation"));
859
- }), l.$on("submit", (T) => {
860
- l.$destroy(), r(T);
861
- });
862
- });
863
- }
864
- exports.NcCustomPickerRenderResult = se;
865
- exports.NcReferencePicker = z;
866
- exports.NcReferencePickerModal = V;
867
- exports.NcReferenceWidget = N;
868
- exports.NcSearch = W;
869
- exports.anyLinkProviderId = _;
870
- exports.getLinkWithPicker = Ae;
871
- exports.getProvider = O;
872
- exports.getProviders = v;
873
- exports.isCustomPickerElementRegistered = a;
874
- exports.isWidgetRegistered = R;
875
- exports.registerCustomPickerElement = x;
876
- exports.registerWidget = $;
877
- exports.renderCustomPickerElement = E;
878
- exports.renderWidget = L;
879
- exports.searchProvider = B;
880
- exports.sortProviders = q;