@ogc-maps/storybook-components 0.4.0 → 0.5.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 (43) hide show
  1. package/dist/{ExportButton-D2xn4G74.js → ExportButton-CLsWoW4m.js} +17 -17
  2. package/dist/{LayerPanel-K00X2QUj.js → LayerPanel-BHpb8dbm.js} +17 -16
  3. package/dist/SearchPanel-DCY01Wa-.js +363 -0
  4. package/dist/components/ExportButton/index.js +1 -1
  5. package/dist/components/LayerPanel/LayerPanel.d.ts +2 -1
  6. package/dist/components/LayerPanel/LayerPanel.d.ts.map +1 -1
  7. package/dist/components/LayerPanel/index.js +1 -1
  8. package/dist/components/SearchPanel/AutocompleteInput.d.ts +12 -0
  9. package/dist/components/SearchPanel/AutocompleteInput.d.ts.map +1 -0
  10. package/dist/components/SearchPanel/DateRangeInput.d.ts +11 -0
  11. package/dist/components/SearchPanel/DateRangeInput.d.ts.map +1 -0
  12. package/dist/components/SearchPanel/NumberInput.d.ts +11 -0
  13. package/dist/components/SearchPanel/NumberInput.d.ts.map +1 -0
  14. package/dist/components/SearchPanel/SearchPanel.d.ts +8 -4
  15. package/dist/components/SearchPanel/SearchPanel.d.ts.map +1 -1
  16. package/dist/components/SearchPanel/index.js +1 -1
  17. package/dist/cql2-BaKDic7B.js +288 -0
  18. package/dist/hooks/index.d.ts +3 -2
  19. package/dist/hooks/index.d.ts.map +1 -1
  20. package/dist/hooks/index.js +31 -11
  21. package/dist/hooks/useCsvExport.d.ts +2 -1
  22. package/dist/hooks/useCsvExport.d.ts.map +1 -1
  23. package/dist/index-BLgVA46J.js +2854 -0
  24. package/dist/main.js +72 -48
  25. package/dist/schemas/config.d.ts +836 -64
  26. package/dist/schemas/config.d.ts.map +1 -1
  27. package/dist/schemas/index.js +21 -2822
  28. package/dist/style.css +1 -1
  29. package/dist/types/index.d.ts +17 -3
  30. package/dist/types/index.d.ts.map +1 -1
  31. package/dist/types/index.js +20 -16
  32. package/dist/utils/__tests__/cql2.test.d.ts +2 -0
  33. package/dist/utils/__tests__/cql2.test.d.ts.map +1 -0
  34. package/dist/utils/cql2.d.ts +75 -0
  35. package/dist/utils/cql2.d.ts.map +1 -0
  36. package/dist/utils/index.d.ts +1 -0
  37. package/dist/utils/index.d.ts.map +1 -1
  38. package/dist/utils/ogcApi.d.ts +24 -7
  39. package/dist/utils/ogcApi.d.ts.map +1 -1
  40. package/package.json +4 -2
  41. package/dist/SearchPanel-CFVQV6JJ.js +0 -135
  42. package/dist/ogcApi-BuXSs9i0.js +0 -48
  43. package/dist/useCsvExport-wr7hy0P-.js +0 -101
@@ -1,101 +0,0 @@
1
- import { useState as d, useEffect as C, useCallback as S } from "react";
2
- import { f as w, a as E } from "./ogcApi-BuXSs9i0.js";
3
- function x(e) {
4
- const [n, s] = d([]), [o, t] = d(!1), [a, l] = d(null);
5
- return C(() => {
6
- if (!e) return;
7
- let f = !1;
8
- return t(!0), l(null), w(e).then((r) => {
9
- f || s(r);
10
- }).catch((r) => {
11
- f || l(r instanceof Error ? r : new Error(String(r)));
12
- }).finally(() => {
13
- f || t(!1);
14
- }), () => {
15
- f = !0;
16
- };
17
- }, [e]), { collections: n, loading: o, error: a };
18
- }
19
- function J(e, n, s = {}) {
20
- const [o, t] = d([]), [a, l] = d(!1), [f, r] = d(null), [p, i] = d(!1), m = JSON.stringify(s);
21
- return C(() => {
22
- if (!e || !n) return;
23
- let h = !1;
24
- l(!0), r(null);
25
- const u = JSON.parse(m);
26
- return E(e, n, u).then((c) => {
27
- if (!h) {
28
- t(c.features);
29
- const y = u.limit ?? 10, g = u.offset ?? 0;
30
- c.numberMatched != null ? i(g + c.features.length < c.numberMatched) : i(c.features.length >= y);
31
- }
32
- }).catch((c) => {
33
- h || (r(c instanceof Error ? c : new Error(String(c))), t([]), i(!1));
34
- }).finally(() => {
35
- h || l(!1);
36
- }), () => {
37
- h = !0;
38
- };
39
- }, [e, n, m]), { features: o, loading: a, error: f, hasMore: p };
40
- }
41
- function b(e, n) {
42
- return e.includes('"') || e.includes(n) || e.includes(`
43
- `) ? `"${e.replace(/"/g, '""')}"` : e;
44
- }
45
- function M(e, n) {
46
- const s = (e.properties ?? {})[n];
47
- return s == null ? "" : typeof s == "object" ? JSON.stringify(s) : String(s);
48
- }
49
- function O(e, n = {}) {
50
- const { fields: s, includeGeometry: o = !1, delimiter: t = "," } = n;
51
- if (e.length === 0) return "";
52
- const a = s ?? [...new Set(e.flatMap((r) => Object.keys(r.properties ?? {})))], l = o ? [...a, "geometry"] : a, f = e.map((r) => {
53
- const p = a.map(
54
- (i) => b(M(r, i), t)
55
- );
56
- return o && p.push(b(JSON.stringify(r.geometry), t)), p.join(t);
57
- });
58
- return [l.map((r) => b(r, t)).join(t), ...f].join(`
59
- `);
60
- }
61
- function j(e, n) {
62
- const s = new Blob([e], { type: "text/csv;charset=utf-8;" }), o = URL.createObjectURL(s), t = document.createElement("a");
63
- t.href = o, t.download = n, t.style.display = "none", document.body.appendChild(t), t.click(), document.body.removeChild(t), URL.revokeObjectURL(o);
64
- }
65
- function N({
66
- baseUrl: e,
67
- limit: n = 1e3,
68
- csvOptions: s
69
- }) {
70
- const [o, t] = d(!1), [a, l] = d(null);
71
- return { exportCsv: S(
72
- async (r, p = `${r}.csv`) => {
73
- t(!0), l(null);
74
- const i = [], m = Math.min(n, 1e3);
75
- let h = 0;
76
- try {
77
- for (; i.length < n; ) {
78
- const c = n - i.length, y = Math.min(m, c), g = await E(e, r, {
79
- limit: y,
80
- offset: h
81
- });
82
- if (i.push(...g.features), h += g.features.length, g.features.length < y || g.numberMatched != null && h >= g.numberMatched) break;
83
- }
84
- const u = O(i, s);
85
- j(u, p);
86
- } catch (u) {
87
- l(u instanceof Error ? u : new Error(String(u)));
88
- } finally {
89
- t(!1);
90
- }
91
- },
92
- [e, n, s]
93
- ), loading: o, error: a };
94
- }
95
- export {
96
- x as a,
97
- J as b,
98
- j as d,
99
- O as f,
100
- N as u
101
- };