@conduction/nextcloud-vue 2.182.0 → 2.184.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/esm/components/CnChartWidget/CnChartWidget.vue.js +1 -1
  2. package/dist/esm/components/CnChartWidget/CnChartWidget2.vue.js +21 -0
  3. package/dist/esm/components/CnChartWidget/CnChartWidget2.vue.js.map +1 -1
  4. package/dist/esm/components/CnChartWidget/CnChartWidget3.vue.js.map +1 -1
  5. package/dist/esm/components/CnMapWidget/CnMapWidget.vue.js +1 -1
  6. package/dist/esm/components/CnMapWidget/CnMapWidget2.vue.js +36 -7
  7. package/dist/esm/components/CnMapWidget/CnMapWidget2.vue.js.map +1 -1
  8. package/dist/esm/components/CnMapWidget/CnMapWidget3.vue.js.map +1 -1
  9. package/dist/esm/components/CnMapWidget/spatialFilter.js +136 -0
  10. package/dist/esm/components/CnMapWidget/spatialFilter.js.map +1 -0
  11. package/dist/esm/components/CnStatsBlockWidget/CnStatsBlockWidget.vue.js +1 -1
  12. package/dist/esm/components/CnStatsBlockWidget/CnStatsBlockWidget2.vue.js +20 -0
  13. package/dist/esm/components/CnStatsBlockWidget/CnStatsBlockWidget2.vue.js.map +1 -1
  14. package/dist/esm/components/CnStatsBlockWidget/CnStatsBlockWidget3.vue.js.map +1 -1
  15. package/dist/esm/library-style.js +1 -1
  16. package/dist/esm/mixins/widgetData.js +69 -0
  17. package/dist/esm/mixins/widgetData.js.map +1 -0
  18. package/dist/esm/nextcloud-vue.css +112 -112
  19. package/dist/nextcloud-vue.cjs.js +275 -10
  20. package/dist/nextcloud-vue.cjs.js.map +2 -2
  21. package/dist/nextcloud-vue.css +112 -112
  22. package/package.json +1 -1
  23. package/src/components/CnChartWidget/CnChartWidget.vue +21 -0
  24. package/src/components/CnMapWidget/CnMapWidget.vue +41 -7
  25. package/src/components/CnMapWidget/spatialFilter.js +132 -0
  26. package/src/components/CnStatsBlockWidget/CnStatsBlockWidget.vue +20 -0
  27. package/src/mixins/widgetData.js +66 -0
@@ -0,0 +1,69 @@
1
+ /*
2
+ * SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ * SPDX-License-Identifier: EUPL-1.2
4
+ */
5
+
6
+ /**
7
+ * widgetData — a self-fetching widget tells its host what it shows.
8
+ *
9
+ * A widget that fetches its own data (CnChartWidget, CnStatsBlockWidget)
10
+ * keeps that data to itself, so a host that derives values from it (a
11
+ * dashboard's calculated fields, an export) has nothing to read. A widget
12
+ * using this mixin defines a `widgetData` computed returning a plain,
13
+ * serialisable summary of what it shows, or null while there is nothing yet;
14
+ * the mixin emits `data` with that summary whenever it changes, including the
15
+ * first time it is known.
16
+ *
17
+ * @spec openspec/changes/widget-data-event/specs/widget-data-event/spec.md#requirement-a-self-fetching-widget-tells-its-host-what-it-shows
18
+ */
19
+ var widgetData = {
20
+ emits: ['data'],
21
+
22
+ watch: {
23
+ widgetData: {
24
+ immediate: true,
25
+ /**
26
+ * Emit the summary once it is known, and on every change.
27
+ *
28
+ * @param {object|null} summary The widget's data summary.
29
+ * @return {void}
30
+ */
31
+ handler(summary) {
32
+ if (summary !== null && summary !== undefined) {
33
+ /**
34
+ * What the widget shows, as a plain summary.
35
+ *
36
+ * @event data
37
+ * @type {object}
38
+ */
39
+ this.$emit('data', summary);
40
+ }
41
+ },
42
+ },
43
+ },
44
+ };
45
+
46
+ /**
47
+ * The sum of the numbers in a chart series: a list of numbers (a pie or
48
+ * donut) or the `data` of its first named series. Non-numbers count as 0.
49
+ *
50
+ * @param {Array<number|object>|undefined} series The series.
51
+ * @return {number|null} The total, or null for no series.
52
+ * @spec openspec/changes/widget-data-event/specs/widget-data-event/spec.md#requirement-a-self-fetching-widget-tells-its-host-what-it-shows
53
+ */
54
+ function seriesTotal(series) {
55
+ if (!Array.isArray(series) || series.length === 0) {
56
+ return null
57
+ }
58
+ const values = typeof series[0] === 'object' && series[0] !== null ? series[0].data : series;
59
+ if (!Array.isArray(values)) {
60
+ return null
61
+ }
62
+ return values.reduce((sum, value) => {
63
+ const number = typeof value === 'object' && value !== null ? Number(value.y) : Number(value);
64
+ return Number.isFinite(number) ? sum + number : sum
65
+ }, 0)
66
+ }
67
+
68
+ export { widgetData as default, seriesTotal };
69
+ //# sourceMappingURL=widgetData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgetData.js","sources":["../../../src/mixins/widgetData.js"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n * SPDX-License-Identifier: EUPL-1.2\n */\n\n/**\n * widgetData — a self-fetching widget tells its host what it shows.\n *\n * A widget that fetches its own data (CnChartWidget, CnStatsBlockWidget)\n * keeps that data to itself, so a host that derives values from it (a\n * dashboard's calculated fields, an export) has nothing to read. A widget\n * using this mixin defines a `widgetData` computed returning a plain,\n * serialisable summary of what it shows, or null while there is nothing yet;\n * the mixin emits `data` with that summary whenever it changes, including the\n * first time it is known.\n *\n * @spec openspec/changes/widget-data-event/specs/widget-data-event/spec.md#requirement-a-self-fetching-widget-tells-its-host-what-it-shows\n */\nexport default {\n\temits: ['data'],\n\n\twatch: {\n\t\twidgetData: {\n\t\t\timmediate: true,\n\t\t\t/**\n\t\t\t * Emit the summary once it is known, and on every change.\n\t\t\t *\n\t\t\t * @param {object|null} summary The widget's data summary.\n\t\t\t * @return {void}\n\t\t\t */\n\t\t\thandler(summary) {\n\t\t\t\tif (summary !== null && summary !== undefined) {\n\t\t\t\t\t/**\n\t\t\t\t\t * What the widget shows, as a plain summary.\n\t\t\t\t\t *\n\t\t\t\t\t * @event data\n\t\t\t\t\t * @type {object}\n\t\t\t\t\t */\n\t\t\t\t\tthis.$emit('data', summary)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n}\n\n/**\n * The sum of the numbers in a chart series: a list of numbers (a pie or\n * donut) or the `data` of its first named series. Non-numbers count as 0.\n *\n * @param {Array<number|object>|undefined} series The series.\n * @return {number|null} The total, or null for no series.\n * @spec openspec/changes/widget-data-event/specs/widget-data-event/spec.md#requirement-a-self-fetching-widget-tells-its-host-what-it-shows\n */\nexport function seriesTotal(series) {\n\tif (!Array.isArray(series) || series.length === 0) {\n\t\treturn null\n\t}\n\tconst values = typeof series[0] === 'object' && series[0] !== null ? series[0].data : series\n\tif (!Array.isArray(values)) {\n\t\treturn null\n\t}\n\treturn values.reduce((sum, value) => {\n\t\tconst number = typeof value === 'object' && value !== null ? Number(value.y) : Number(value)\n\t\treturn Number.isFinite(number) ? sum + number : sum\n\t}, 0)\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAe;AACf,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC;;AAEhB,CAAC,KAAK,EAAE;AACR,EAAE,UAAU,EAAE;AACd,GAAG,SAAS,EAAE,IAAI;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,OAAO,CAAC,OAAO,EAAE;AACpB,IAAI,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,EAAE;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;AAC/B,IAAI;AACJ,GAAG,CAAC;AACJ,GAAG;AACH,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,WAAW,CAAC,MAAM,EAAE;AACpC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;AACpD,EAAE,OAAO;AACT,CAAC;AACD,CAAC,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG;AACvF,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AAC7B,EAAE,OAAO;AACT,CAAC;AACD,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,KAAK;AACtC,EAAE,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK;AAC7F,EAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,MAAM,GAAG;AAClD,CAAC,CAAC,EAAE,CAAC;AACL;;"}