@opengeoweb/knmi-components 15.3.0 → 17.0.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.
- package/index.esm.js +522 -179
- package/package.json +8 -8
- package/src/index.d.ts +0 -5
- package/src/lib/api/api.d.ts +0 -3
- package/src/lib/api/fakeApi.d.ts +0 -1
- package/src/lib/api/hooks.d.ts +0 -9
- package/src/lib/components/ComponentsLookup/ComponentsLookUp.d.ts +0 -10
- package/src/lib/components/ComponentsLookup/ComponentsLookUp.spec.d.ts +0 -1
- package/src/lib/components/ComponentsLookup/index.d.ts +0 -1
- package/src/lib/components/Trajks/TrajksForm.d.ts +0 -14
- package/src/lib/components/Trajks/TrajksForm.spec.d.ts +0 -1
- package/src/lib/components/Trajks/TrajksForm.stories.d.ts +0 -11
- package/src/lib/components/Trajks/TrajksFormWrapper.d.ts +0 -1
- package/src/lib/components/Trajks/TrajksFormWrapper.spec.d.ts +0 -1
- package/src/lib/components/Trajks/TrajksFormWrapper.stories.d.ts +0 -9
- package/src/lib/components/Trajks/index.d.ts +0 -1
- package/src/lib/utils/Providers.d.ts +0 -9
- package/src/lib/utils/i18n.d.ts +0 -6
package/index.esm.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
1
|
import { LinearProgress, Box, Grid, FormControlLabel, Radio, MenuItem, Checkbox, Button } from '@mui/material';
|
|
3
2
|
import { useFormContext } from 'react-hook-form';
|
|
4
3
|
import { FORM_FIELDS_NAMESPACE, ReactHookFormTextField, ReactHookFormNumberField, isLatitude, isLongitude, isValidMin, isValidMax, ReactHookFormDateTime, isXHoursBefore, isXHoursAfter, ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormFormControl, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
5
|
-
import { sessionStorageProvider, SHARED_NAMESPACE,
|
|
4
|
+
import { sessionStorageProvider, SHARED_NAMESPACE, usePreventBrowserClose, AlertBanner, dateUtils, ErrorBoundary } from '@opengeoweb/shared';
|
|
6
5
|
import { useMutation } from '@tanstack/react-query';
|
|
7
6
|
import { useDispatch } from 'react-redux';
|
|
8
7
|
import { useAuthenticationContext } from '@opengeoweb/authentication';
|
|
@@ -10,6 +9,7 @@ import { snackbarActions, snackbarTypes } from '@opengeoweb/snackbar';
|
|
|
10
9
|
import { getHeaders, handleResponse } from '@opengeoweb/api';
|
|
11
10
|
import 'i18next';
|
|
12
11
|
import { useTranslation } from 'react-i18next';
|
|
12
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
13
|
|
|
14
14
|
var en = {
|
|
15
15
|
"error-auth-login": "This feature is protected by authentication. Please log in to proceed",
|
|
@@ -68,30 +68,303 @@ var knmicomponentTranslations = {
|
|
|
68
68
|
nl: nl
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
71
|
+
function _OverloadYield(e, d) {
|
|
72
|
+
this.v = e, this.k = d;
|
|
73
|
+
}
|
|
74
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
75
|
+
try {
|
|
76
|
+
var i = n[a](c),
|
|
77
|
+
u = i.value;
|
|
78
|
+
} catch (n) {
|
|
79
|
+
return void e(n);
|
|
80
|
+
}
|
|
81
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
82
|
+
}
|
|
83
|
+
function _asyncToGenerator(n) {
|
|
84
|
+
return function () {
|
|
85
|
+
var t = this,
|
|
86
|
+
e = arguments;
|
|
87
|
+
return new Promise(function (r, o) {
|
|
88
|
+
var a = n.apply(t, e);
|
|
89
|
+
function _next(n) {
|
|
90
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
91
|
+
}
|
|
92
|
+
function _throw(n) {
|
|
93
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
94
|
+
}
|
|
95
|
+
_next(void 0);
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function _regenerator() {
|
|
100
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
101
|
+
var e,
|
|
102
|
+
t,
|
|
103
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
104
|
+
n = r.iterator || "@@iterator",
|
|
105
|
+
o = r.toStringTag || "@@toStringTag";
|
|
106
|
+
function i(r, n, o, i) {
|
|
107
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
108
|
+
u = Object.create(c.prototype);
|
|
109
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
110
|
+
var i,
|
|
111
|
+
c,
|
|
112
|
+
u,
|
|
113
|
+
f = 0,
|
|
114
|
+
p = o || [],
|
|
115
|
+
y = false,
|
|
116
|
+
G = {
|
|
117
|
+
p: 0,
|
|
118
|
+
n: 0,
|
|
119
|
+
v: e,
|
|
120
|
+
a: d,
|
|
121
|
+
f: d.bind(e, 4),
|
|
122
|
+
d: function (t, r) {
|
|
123
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
function d(r, n) {
|
|
127
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
128
|
+
var o,
|
|
129
|
+
i = p[t],
|
|
130
|
+
d = G.p,
|
|
131
|
+
l = i[2];
|
|
132
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
133
|
+
}
|
|
134
|
+
if (o || r > 1) return a;
|
|
135
|
+
throw y = true, n;
|
|
136
|
+
}
|
|
137
|
+
return function (o, p, l) {
|
|
138
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
139
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
140
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
141
|
+
try {
|
|
142
|
+
if (f = 2, i) {
|
|
143
|
+
if (c || (o = "next"), t = i[o]) {
|
|
144
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
145
|
+
if (!t.done) return t;
|
|
146
|
+
u = t.value, c < 2 && (c = 0);
|
|
147
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
148
|
+
i = e;
|
|
149
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
150
|
+
} catch (t) {
|
|
151
|
+
i = e, c = 1, u = t;
|
|
152
|
+
} finally {
|
|
153
|
+
f = 1;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
value: t,
|
|
158
|
+
done: y
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
}(r, o, i), true), u;
|
|
162
|
+
}
|
|
163
|
+
var a = {};
|
|
164
|
+
function Generator() {}
|
|
165
|
+
function GeneratorFunction() {}
|
|
166
|
+
function GeneratorFunctionPrototype() {}
|
|
167
|
+
t = Object.getPrototypeOf;
|
|
168
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
169
|
+
return this;
|
|
170
|
+
}), t),
|
|
171
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
172
|
+
function f(e) {
|
|
173
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
174
|
+
}
|
|
175
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
176
|
+
return this;
|
|
177
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
178
|
+
return "[object Generator]";
|
|
179
|
+
}), (_regenerator = function () {
|
|
180
|
+
return {
|
|
181
|
+
w: i,
|
|
182
|
+
m: f
|
|
183
|
+
};
|
|
184
|
+
})();
|
|
185
|
+
}
|
|
186
|
+
function _regeneratorAsync(n, e, r, t, o) {
|
|
187
|
+
var a = _regeneratorAsyncGen(n, e, r, t, o);
|
|
188
|
+
return a.next().then(function (n) {
|
|
189
|
+
return n.done ? n.value : a.next();
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function _regeneratorAsyncGen(r, e, t, o, n) {
|
|
193
|
+
return new _regeneratorAsyncIterator(_regenerator().w(r, e, t, o), n || Promise);
|
|
194
|
+
}
|
|
195
|
+
function _regeneratorAsyncIterator(t, e) {
|
|
196
|
+
function n(r, o, i, f) {
|
|
197
|
+
try {
|
|
198
|
+
var c = t[r](o),
|
|
199
|
+
u = c.value;
|
|
200
|
+
return u instanceof _OverloadYield ? e.resolve(u.v).then(function (t) {
|
|
201
|
+
n("next", t, i, f);
|
|
202
|
+
}, function (t) {
|
|
203
|
+
n("throw", t, i, f);
|
|
204
|
+
}) : e.resolve(u).then(function (t) {
|
|
205
|
+
c.value = t, i(c);
|
|
206
|
+
}, function (t) {
|
|
207
|
+
return n("throw", t, i, f);
|
|
208
|
+
});
|
|
209
|
+
} catch (t) {
|
|
210
|
+
f(t);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
var r;
|
|
214
|
+
this.next || (_regeneratorDefine(_regeneratorAsyncIterator.prototype), _regeneratorDefine(_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
|
|
215
|
+
return this;
|
|
216
|
+
})), _regeneratorDefine(this, "_invoke", function (t, o, i) {
|
|
217
|
+
function f() {
|
|
218
|
+
return new e(function (e, r) {
|
|
219
|
+
n(t, i, e, r);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
return r = r ? r.then(f, f) : f();
|
|
223
|
+
}, true);
|
|
224
|
+
}
|
|
225
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
226
|
+
var i = Object.defineProperty;
|
|
227
|
+
try {
|
|
228
|
+
i({}, "", {});
|
|
229
|
+
} catch (e) {
|
|
230
|
+
i = 0;
|
|
231
|
+
}
|
|
232
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
233
|
+
if (r) i ? i(e, r, {
|
|
234
|
+
value: n,
|
|
235
|
+
enumerable: !t,
|
|
236
|
+
configurable: !t,
|
|
237
|
+
writable: !t
|
|
238
|
+
}) : e[r] = n;else {
|
|
239
|
+
function o(r, n) {
|
|
240
|
+
_regeneratorDefine(e, r, function (e) {
|
|
241
|
+
return this._invoke(r, n, e);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
o("next", 0), o("throw", 1), o("return", 2);
|
|
245
|
+
}
|
|
246
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
247
|
+
}
|
|
248
|
+
function _regeneratorKeys(e) {
|
|
249
|
+
var n = Object(e),
|
|
250
|
+
r = [];
|
|
251
|
+
for (var t in n) r.unshift(t);
|
|
252
|
+
return function e() {
|
|
253
|
+
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = false, e;
|
|
254
|
+
return e.done = true, e;
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function _regeneratorValues(e) {
|
|
258
|
+
if (null != e) {
|
|
259
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
260
|
+
r = 0;
|
|
261
|
+
if (t) return t.call(e);
|
|
262
|
+
if ("function" == typeof e.next) return e;
|
|
263
|
+
if (!isNaN(e.length)) return {
|
|
264
|
+
next: function () {
|
|
265
|
+
return e && r >= e.length && (e = void 0), {
|
|
266
|
+
value: e && e[r++],
|
|
267
|
+
done: !e
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
273
|
+
}
|
|
274
|
+
function _regeneratorRuntime() {
|
|
275
|
+
|
|
276
|
+
var r = _regenerator(),
|
|
277
|
+
e = r.m(_regeneratorRuntime),
|
|
278
|
+
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
|
|
279
|
+
function n(r) {
|
|
280
|
+
var e = "function" == typeof r && r.constructor;
|
|
281
|
+
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
|
|
282
|
+
}
|
|
283
|
+
var o = {
|
|
284
|
+
throw: 1,
|
|
285
|
+
return: 2,
|
|
286
|
+
break: 3,
|
|
287
|
+
continue: 3
|
|
288
|
+
};
|
|
289
|
+
function a(r) {
|
|
290
|
+
var e, t;
|
|
291
|
+
return function (n) {
|
|
292
|
+
e || (e = {
|
|
293
|
+
stop: function () {
|
|
294
|
+
return t(n.a, 2);
|
|
295
|
+
},
|
|
296
|
+
catch: function () {
|
|
297
|
+
return n.v;
|
|
298
|
+
},
|
|
299
|
+
abrupt: function (r, e) {
|
|
300
|
+
return t(n.a, o[r], e);
|
|
301
|
+
},
|
|
302
|
+
delegateYield: function (r, o, a) {
|
|
303
|
+
return e.resultName = o, t(n.d, _regeneratorValues(r), a);
|
|
304
|
+
},
|
|
305
|
+
finish: function (r) {
|
|
306
|
+
return t(n.f, r);
|
|
307
|
+
}
|
|
308
|
+
}, t = function (r, t, o) {
|
|
309
|
+
n.p = e.prev, n.n = e.next;
|
|
310
|
+
try {
|
|
311
|
+
return r(t, o);
|
|
312
|
+
} finally {
|
|
313
|
+
e.next = n.n;
|
|
314
|
+
}
|
|
315
|
+
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
|
|
316
|
+
try {
|
|
317
|
+
return r.call(this, e);
|
|
318
|
+
} finally {
|
|
319
|
+
n.p = e.prev, n.n = e.next;
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
return (_regeneratorRuntime = function () {
|
|
324
|
+
return {
|
|
325
|
+
wrap: function (e, t, n, o) {
|
|
326
|
+
return r.w(a(e), t, n, o && o.reverse());
|
|
327
|
+
},
|
|
328
|
+
isGeneratorFunction: n,
|
|
329
|
+
mark: r.m,
|
|
330
|
+
awrap: function (r, e) {
|
|
331
|
+
return new _OverloadYield(r, e);
|
|
332
|
+
},
|
|
333
|
+
AsyncIterator: _regeneratorAsyncIterator,
|
|
334
|
+
async: function (r, e, t, o, u) {
|
|
335
|
+
return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u);
|
|
336
|
+
},
|
|
337
|
+
keys: _regeneratorKeys,
|
|
338
|
+
values: _regeneratorValues
|
|
339
|
+
};
|
|
340
|
+
})();
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
var config = sessionStorageProvider.getConfig();
|
|
344
|
+
var publisherBaseUrl = config.GW_KNMI_PUBLISHER_BASE_URL || '';
|
|
345
|
+
var publishProduct = /*#__PURE__*/function () {
|
|
346
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(auth, data, productType) {
|
|
347
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
348
|
+
while (1) switch (_context.prev = _context.next) {
|
|
349
|
+
case 0:
|
|
350
|
+
if (productType === void 0) {
|
|
351
|
+
productType = 'trajks';
|
|
352
|
+
}
|
|
353
|
+
return _context.abrupt("return", fetch(publisherBaseUrl + "/publish/" + productType, {
|
|
354
|
+
headers: getHeaders(auth),
|
|
355
|
+
method: 'POST',
|
|
356
|
+
body: JSON.stringify(data)
|
|
357
|
+
}).then(handleResponse));
|
|
358
|
+
case 2:
|
|
359
|
+
case "end":
|
|
360
|
+
return _context.stop();
|
|
361
|
+
}
|
|
362
|
+
}, _callee);
|
|
363
|
+
}));
|
|
364
|
+
return function publishProduct(_x, _x2, _x3) {
|
|
365
|
+
return _ref.apply(this, arguments);
|
|
366
|
+
};
|
|
367
|
+
}();
|
|
95
368
|
|
|
96
369
|
/* *
|
|
97
370
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -110,9 +383,70 @@ const publishProduct = async (auth, data, productType = 'trajks') => fetch(`${pu
|
|
|
110
383
|
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
111
384
|
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
112
385
|
* */
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
386
|
+
|
|
387
|
+
var KNMICOMPONENTS_NAMESPACE = 'KNMIComponents';
|
|
388
|
+
var ns = [KNMICOMPONENTS_NAMESPACE, SHARED_NAMESPACE, FORM_FIELDS_NAMESPACE];
|
|
389
|
+
var useKNMIComponentsTranslation = function useKNMIComponentsTranslation() {
|
|
390
|
+
return useTranslation(ns);
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
var usePublishProduct = function usePublishProduct() {
|
|
394
|
+
var _useAuthenticationCon = useAuthenticationContext(),
|
|
395
|
+
auth = _useAuthenticationCon.auth;
|
|
396
|
+
var _useKNMIComponentsTra = useKNMIComponentsTranslation(),
|
|
397
|
+
t = _useKNMIComponentsTra.t;
|
|
398
|
+
var dispatch = useDispatch();
|
|
399
|
+
return useMutation({
|
|
400
|
+
mutationFn: function () {
|
|
401
|
+
var _mutationFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
402
|
+
var data;
|
|
403
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
404
|
+
while (1) switch (_context.prev = _context.next) {
|
|
405
|
+
case 0:
|
|
406
|
+
data = _ref.data;
|
|
407
|
+
if (auth) {
|
|
408
|
+
_context.next = 3;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
throw new Error('Authentication context not found');
|
|
412
|
+
case 3:
|
|
413
|
+
return _context.abrupt("return", publishProduct(auth, data));
|
|
414
|
+
case 4:
|
|
415
|
+
case "end":
|
|
416
|
+
return _context.stop();
|
|
417
|
+
}
|
|
418
|
+
}, _callee);
|
|
419
|
+
}));
|
|
420
|
+
function mutationFn(_x) {
|
|
421
|
+
return _mutationFn.apply(this, arguments);
|
|
422
|
+
}
|
|
423
|
+
return mutationFn;
|
|
424
|
+
}(),
|
|
425
|
+
onSuccess: function () {
|
|
426
|
+
var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_data, _ref2) {
|
|
427
|
+
var clearForm;
|
|
428
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
429
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
430
|
+
case 0:
|
|
431
|
+
clearForm = _ref2.clearForm;
|
|
432
|
+
dispatch(snackbarActions.openSnackbar({
|
|
433
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
434
|
+
key: t('message-publish-success')
|
|
435
|
+
}));
|
|
436
|
+
clearForm();
|
|
437
|
+
case 3:
|
|
438
|
+
case "end":
|
|
439
|
+
return _context2.stop();
|
|
440
|
+
}
|
|
441
|
+
}, _callee2);
|
|
442
|
+
}));
|
|
443
|
+
function onSuccess(_x2, _x3) {
|
|
444
|
+
return _onSuccess.apply(this, arguments);
|
|
445
|
+
}
|
|
446
|
+
return onSuccess;
|
|
447
|
+
}()
|
|
448
|
+
});
|
|
449
|
+
};
|
|
116
450
|
|
|
117
451
|
/* *
|
|
118
452
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -127,40 +461,12 @@ const useKNMIComponentsTranslation = () => useTranslation(ns);
|
|
|
127
461
|
* See the License for the specific language governing permissions and
|
|
128
462
|
* limitations under the License.
|
|
129
463
|
*
|
|
130
|
-
* Copyright
|
|
131
|
-
* Copyright
|
|
132
|
-
* Copyright
|
|
464
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
465
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
466
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
133
467
|
* */
|
|
134
|
-
const usePublishProduct = () => {
|
|
135
|
-
const {
|
|
136
|
-
auth
|
|
137
|
-
} = useAuthenticationContext();
|
|
138
|
-
const {
|
|
139
|
-
t
|
|
140
|
-
} = useKNMIComponentsTranslation();
|
|
141
|
-
const dispatch = useDispatch();
|
|
142
|
-
return useMutation({
|
|
143
|
-
mutationFn: async ({
|
|
144
|
-
data
|
|
145
|
-
}) => {
|
|
146
|
-
if (!auth) {
|
|
147
|
-
throw new Error('Authentication context not found');
|
|
148
|
-
}
|
|
149
|
-
return publishProduct(auth, data);
|
|
150
|
-
},
|
|
151
|
-
onSuccess: async (_data, {
|
|
152
|
-
clearForm
|
|
153
|
-
}) => {
|
|
154
|
-
dispatch(snackbarActions.openSnackbar({
|
|
155
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
156
|
-
key: t('message-publish-success')
|
|
157
|
-
}));
|
|
158
|
-
clearForm();
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
};
|
|
162
468
|
|
|
163
|
-
|
|
469
|
+
var formStyles = {
|
|
164
470
|
padding: '32px 16px',
|
|
165
471
|
'.MuiSelect-select.MuiInputBase-input.MuiFilledInput-input': {
|
|
166
472
|
paddingTop: '17px',
|
|
@@ -175,161 +481,164 @@ const formStyles = {
|
|
|
175
481
|
paddingBottom: '0px'
|
|
176
482
|
}
|
|
177
483
|
};
|
|
178
|
-
|
|
484
|
+
var rowStyles = {
|
|
179
485
|
width: '100%',
|
|
180
486
|
display: 'flex',
|
|
181
487
|
flexWrap: 'wrap',
|
|
182
488
|
gap: '16px',
|
|
183
489
|
marginTop: '-8px'
|
|
184
490
|
};
|
|
185
|
-
|
|
491
|
+
var fieldStyles = {
|
|
186
492
|
flexGrow: 1,
|
|
187
493
|
flexBasis: '240px',
|
|
188
494
|
minWidth: '240px'
|
|
189
495
|
};
|
|
190
|
-
|
|
496
|
+
var fieldStylesRadio = {
|
|
191
497
|
flexGrow: 1,
|
|
192
498
|
flexBasis: '112px',
|
|
193
499
|
minWidth: '112px'
|
|
194
500
|
};
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
501
|
+
var MIN_HEIGHT = 0;
|
|
502
|
+
var MAX_HEIGHT = 10000;
|
|
503
|
+
var MIN_DURATION = 1;
|
|
504
|
+
var MAX_DURATION = 125;
|
|
505
|
+
var MIN_MAX_TIME = 120;
|
|
506
|
+
|
|
507
|
+
// String type for number fields is to allow empty default values
|
|
508
|
+
|
|
509
|
+
var generateDefaultValues = function generateDefaultValues() {
|
|
510
|
+
var _dateUtils$dateToStri;
|
|
201
511
|
return {
|
|
202
512
|
referenceName: '',
|
|
203
513
|
lat: '',
|
|
204
514
|
lon: '',
|
|
205
515
|
releaseHeight: '',
|
|
206
|
-
start: dateUtils.dateToString(dateUtils.sub(dateUtils.utc(), {}))
|
|
516
|
+
start: (_dateUtils$dateToStri = dateUtils.dateToString(dateUtils.sub(dateUtils.utc(), {}))) != null ? _dateUtils$dateToStri : '',
|
|
207
517
|
direction: 'forward',
|
|
208
518
|
duration: 48,
|
|
209
519
|
numVerticalLevels: 1,
|
|
210
520
|
spatialUncertainty: false
|
|
211
521
|
};
|
|
212
522
|
};
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
t
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
dirtyFields,
|
|
226
|
-
isValid
|
|
227
|
-
} = formState;
|
|
228
|
-
const isDirty = Object.keys(dirtyFields).length > 0;
|
|
523
|
+
var Form = function Form() {
|
|
524
|
+
var _useKNMIComponentsTra = useKNMIComponentsTranslation(),
|
|
525
|
+
t = _useKNMIComponentsTra.t;
|
|
526
|
+
var _useFormContext = useFormContext(),
|
|
527
|
+
handleSubmit = _useFormContext.handleSubmit,
|
|
528
|
+
formState = _useFormContext.formState,
|
|
529
|
+
reset = _useFormContext.reset,
|
|
530
|
+
watch = _useFormContext.watch,
|
|
531
|
+
setValue = _useFormContext.setValue;
|
|
532
|
+
var dirtyFields = formState.dirtyFields,
|
|
533
|
+
isValid = formState.isValid;
|
|
534
|
+
var isDirty = Object.keys(dirtyFields).length > 0;
|
|
229
535
|
usePreventBrowserClose(isDirty);
|
|
230
|
-
|
|
231
|
-
mutate
|
|
232
|
-
error
|
|
233
|
-
isPending
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
void handleSubmit(data => {
|
|
536
|
+
var _usePublishProduct = usePublishProduct(),
|
|
537
|
+
publishProduct = _usePublishProduct.mutate,
|
|
538
|
+
publishError = _usePublishProduct.error,
|
|
539
|
+
isPublishing = _usePublishProduct.isPending;
|
|
540
|
+
var handleSendForm = function handleSendForm() {
|
|
541
|
+
void handleSubmit(function (data) {
|
|
237
542
|
publishProduct({
|
|
238
543
|
data: data,
|
|
239
544
|
clearForm: handleClearForm
|
|
240
545
|
});
|
|
241
546
|
})();
|
|
242
547
|
};
|
|
243
|
-
|
|
548
|
+
var handleClearForm = function handleClearForm() {
|
|
244
549
|
reset(generateDefaultValues());
|
|
245
550
|
};
|
|
246
|
-
|
|
247
|
-
return jsxs("form", {
|
|
551
|
+
var spatialUncertainty = watch('spatialUncertainty');
|
|
552
|
+
return /*#__PURE__*/jsxs("form", {
|
|
248
553
|
"data-testid": "trajks-form",
|
|
249
554
|
style: {
|
|
250
555
|
height: '100%',
|
|
251
556
|
overflowY: 'auto'
|
|
252
557
|
},
|
|
253
|
-
children: [isPublishing ? jsx(LinearProgress, {
|
|
558
|
+
children: [isPublishing ? /*#__PURE__*/jsx(LinearProgress, {
|
|
254
559
|
color: "secondary",
|
|
255
560
|
sx: {
|
|
256
561
|
position: 'absolute',
|
|
257
562
|
width: '100%'
|
|
258
563
|
}
|
|
259
|
-
}) : null, publishError ? jsx(Box, {
|
|
564
|
+
}) : null, publishError ? /*#__PURE__*/jsx(Box, {
|
|
260
565
|
sx: {
|
|
261
566
|
width: '100%'
|
|
262
567
|
},
|
|
263
|
-
children: jsx(AlertBanner, {
|
|
568
|
+
children: /*#__PURE__*/jsx(AlertBanner, {
|
|
264
569
|
info: publishError.message,
|
|
265
570
|
shouldClose: true,
|
|
266
571
|
title: t('error-publish')
|
|
267
572
|
})
|
|
268
|
-
}) : null, jsxs(Grid, {
|
|
573
|
+
}) : null, /*#__PURE__*/jsxs(Grid, {
|
|
269
574
|
container: true,
|
|
270
575
|
spacing: 3,
|
|
271
576
|
sx: formStyles,
|
|
272
|
-
children: [jsx(ReactHookFormTextField, {
|
|
577
|
+
children: [/*#__PURE__*/jsx(ReactHookFormTextField, {
|
|
273
578
|
label: t('reference-name'),
|
|
274
579
|
name: "referenceName",
|
|
275
580
|
rules: {
|
|
276
581
|
required: true
|
|
277
582
|
},
|
|
278
583
|
size: "small"
|
|
279
|
-
}), jsxs(Box, {
|
|
584
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
280
585
|
sx: rowStyles,
|
|
281
|
-
children: [jsx(Box, {
|
|
586
|
+
children: [/*#__PURE__*/jsx(Box, {
|
|
282
587
|
sx: fieldStyles,
|
|
283
|
-
children: jsx(ReactHookFormNumberField, {
|
|
588
|
+
children: /*#__PURE__*/jsx(ReactHookFormNumberField, {
|
|
284
589
|
inputMode: "decimal",
|
|
285
590
|
label: t('latitude'),
|
|
286
591
|
name: "lat",
|
|
287
592
|
rules: {
|
|
288
593
|
required: true,
|
|
289
594
|
validate: {
|
|
290
|
-
isLatitude
|
|
595
|
+
isLatitude: isLatitude
|
|
291
596
|
}
|
|
292
597
|
},
|
|
293
598
|
size: "small"
|
|
294
599
|
})
|
|
295
|
-
}), jsx(Box, {
|
|
600
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
296
601
|
sx: fieldStyles,
|
|
297
|
-
children: jsx(ReactHookFormNumberField, {
|
|
602
|
+
children: /*#__PURE__*/jsx(ReactHookFormNumberField, {
|
|
298
603
|
inputMode: "decimal",
|
|
299
604
|
label: t('longitude'),
|
|
300
605
|
name: "lon",
|
|
301
606
|
rules: {
|
|
302
607
|
required: true,
|
|
303
608
|
validate: {
|
|
304
|
-
isLongitude
|
|
609
|
+
isLongitude: isLongitude
|
|
305
610
|
}
|
|
306
611
|
},
|
|
307
612
|
size: "small"
|
|
308
613
|
})
|
|
309
614
|
})]
|
|
310
|
-
}), jsxs(Box, {
|
|
615
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
311
616
|
sx: rowStyles,
|
|
312
|
-
children: [jsx(Box, {
|
|
617
|
+
children: [/*#__PURE__*/jsx(Box, {
|
|
313
618
|
sx: fieldStyles,
|
|
314
|
-
children: jsx(ReactHookFormNumberField, {
|
|
619
|
+
children: /*#__PURE__*/jsx(ReactHookFormNumberField, {
|
|
315
620
|
label: t('release-height'),
|
|
316
621
|
name: "releaseHeight",
|
|
317
622
|
rules: {
|
|
318
623
|
required: true,
|
|
319
624
|
validate: {
|
|
320
|
-
maxHeight:
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
625
|
+
maxHeight: function maxHeight(value) {
|
|
626
|
+
return isValidMax(value, MAX_HEIGHT) || t('release-height-max-error', {
|
|
627
|
+
maxValue: MAX_HEIGHT
|
|
628
|
+
});
|
|
629
|
+
},
|
|
630
|
+
minHeight: function minHeight(value) {
|
|
631
|
+
return isValidMin(value, MIN_HEIGHT) || t('release-height-min-error', {
|
|
632
|
+
minHeightValue: MIN_HEIGHT
|
|
633
|
+
});
|
|
634
|
+
}
|
|
326
635
|
}
|
|
327
636
|
},
|
|
328
637
|
size: "small"
|
|
329
638
|
})
|
|
330
|
-
}), jsx(Box, {
|
|
639
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
331
640
|
sx: fieldStyles,
|
|
332
|
-
children: jsx(ReactHookFormDateTime, {
|
|
641
|
+
children: /*#__PURE__*/jsx(ReactHookFormDateTime, {
|
|
333
642
|
format: "dd/MM/yyyy HH:mm",
|
|
334
643
|
label: t('start'),
|
|
335
644
|
name: "start",
|
|
@@ -338,14 +647,14 @@ const Form = () => {
|
|
|
338
647
|
required: true,
|
|
339
648
|
validate: {
|
|
340
649
|
isValidDate: dateUtils.isValidIsoDateString,
|
|
341
|
-
isCurrentTimeWithinXHoursValue: value
|
|
342
|
-
|
|
650
|
+
isCurrentTimeWithinXHoursValue: function isCurrentTimeWithinXHoursValue(value) {
|
|
651
|
+
var isValidBefore = isXHoursBefore(dateUtils.getCurrentTimeAsString(), value, MIN_MAX_TIME);
|
|
343
652
|
if (!isValidBefore) {
|
|
344
653
|
return t('start-time-after-error-message', {
|
|
345
654
|
hours: MIN_MAX_TIME
|
|
346
655
|
});
|
|
347
656
|
}
|
|
348
|
-
|
|
657
|
+
var isValidAfter = isXHoursAfter(dateUtils.getCurrentTimeAsString(), value, MIN_MAX_TIME);
|
|
349
658
|
return isValidBefore && isValidAfter || t('start-time-before-error-message', {
|
|
350
659
|
hours: MIN_MAX_TIME
|
|
351
660
|
});
|
|
@@ -354,55 +663,60 @@ const Form = () => {
|
|
|
354
663
|
}
|
|
355
664
|
})
|
|
356
665
|
})]
|
|
357
|
-
}), jsx(ReactHookFormRadioGroup, {
|
|
666
|
+
}), /*#__PURE__*/jsx(ReactHookFormRadioGroup, {
|
|
358
667
|
name: "direction",
|
|
359
668
|
row: true,
|
|
360
669
|
rules: {
|
|
361
670
|
required: true
|
|
362
671
|
},
|
|
363
|
-
children: jsxs(Box, {
|
|
672
|
+
children: /*#__PURE__*/jsxs(Box, {
|
|
364
673
|
sx: rowStyles,
|
|
365
|
-
children: [jsx(Box, {
|
|
674
|
+
children: [/*#__PURE__*/jsx(Box, {
|
|
366
675
|
sx: fieldStylesRadio,
|
|
367
|
-
children: jsx(FormControlLabel, {
|
|
368
|
-
control: jsx(Radio, {}),
|
|
676
|
+
children: /*#__PURE__*/jsx(FormControlLabel, {
|
|
677
|
+
control: /*#__PURE__*/jsx(Radio, {}),
|
|
369
678
|
label: t('direction-for'),
|
|
370
679
|
value: "forward"
|
|
371
680
|
}, "forward")
|
|
372
|
-
}), jsx(Box, {
|
|
681
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
373
682
|
sx: fieldStylesRadio,
|
|
374
|
-
children: jsx(FormControlLabel, {
|
|
375
|
-
control: jsx(Radio, {}),
|
|
683
|
+
children: /*#__PURE__*/jsx(FormControlLabel, {
|
|
684
|
+
control: /*#__PURE__*/jsx(Radio, {}),
|
|
376
685
|
label: t('direction-back'),
|
|
377
686
|
value: "backward"
|
|
378
687
|
}, "backward")
|
|
379
688
|
})]
|
|
380
689
|
})
|
|
381
|
-
}), jsxs(Box, {
|
|
690
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
382
691
|
sx: rowStyles,
|
|
383
|
-
children: [jsx(Box, {
|
|
692
|
+
children: [/*#__PURE__*/jsx(Box, {
|
|
384
693
|
sx: fieldStyles,
|
|
385
|
-
children: jsx(ReactHookFormNumberField, {
|
|
694
|
+
children: /*#__PURE__*/jsx(ReactHookFormNumberField, {
|
|
386
695
|
label: t('trajectory-duration'),
|
|
387
696
|
name: "duration",
|
|
388
697
|
rules: {
|
|
389
698
|
required: true,
|
|
390
699
|
validate: {
|
|
391
|
-
maxDuration:
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
700
|
+
maxDuration: function maxDuration(value) {
|
|
701
|
+
return isValidMax(value, MAX_DURATION) || t('trajectory-duration-max-error', {
|
|
702
|
+
maxValue: MAX_DURATION
|
|
703
|
+
});
|
|
704
|
+
},
|
|
705
|
+
minDuration: function minDuration(value) {
|
|
706
|
+
return (
|
|
707
|
+
// The min level depends on the unit
|
|
708
|
+
isValidMin(value, MIN_DURATION) || t('trajectory-duration-min-error', {
|
|
709
|
+
minLevelValue: MIN_DURATION
|
|
710
|
+
})
|
|
711
|
+
);
|
|
712
|
+
}
|
|
399
713
|
}
|
|
400
714
|
},
|
|
401
715
|
size: "small"
|
|
402
716
|
})
|
|
403
|
-
}), jsx(Box, {
|
|
717
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
404
718
|
sx: fieldStyles,
|
|
405
|
-
children: jsx(ReactHookFormSelect, {
|
|
719
|
+
children: /*#__PURE__*/jsx(ReactHookFormSelect, {
|
|
406
720
|
label: t('num-vertical-levels'),
|
|
407
721
|
name: "numVerticalLevels",
|
|
408
722
|
rules: {
|
|
@@ -411,21 +725,23 @@ const Form = () => {
|
|
|
411
725
|
size: "small",
|
|
412
726
|
children: Array.from({
|
|
413
727
|
length: 10
|
|
414
|
-
}, (_, i)
|
|
415
|
-
return
|
|
728
|
+
}, function (_, i) {
|
|
729
|
+
return i + 1;
|
|
730
|
+
}).map(function (level) {
|
|
731
|
+
return /*#__PURE__*/jsx(MenuItem, {
|
|
416
732
|
value: level,
|
|
417
733
|
children: level
|
|
418
734
|
}, level);
|
|
419
735
|
})
|
|
420
736
|
})
|
|
421
737
|
})]
|
|
422
|
-
}), jsx(ReactHookFormFormControl, {
|
|
423
|
-
children: jsx(FormControlLabel, {
|
|
424
|
-
control: jsx(Checkbox, {
|
|
738
|
+
}), /*#__PURE__*/jsx(ReactHookFormFormControl, {
|
|
739
|
+
children: /*#__PURE__*/jsx(FormControlLabel, {
|
|
740
|
+
control: /*#__PURE__*/jsx(Checkbox, {
|
|
425
741
|
checked: spatialUncertainty,
|
|
426
742
|
color: "secondary",
|
|
427
743
|
name: "spatialUncertainty",
|
|
428
|
-
onChange: ()
|
|
744
|
+
onChange: function onChange() {
|
|
429
745
|
setValue('spatialUncertainty', !spatialUncertainty, {
|
|
430
746
|
shouldDirty: true
|
|
431
747
|
});
|
|
@@ -433,14 +749,14 @@ const Form = () => {
|
|
|
433
749
|
}),
|
|
434
750
|
label: t('spatial-uncertainty')
|
|
435
751
|
})
|
|
436
|
-
}), jsxs(Grid, {
|
|
752
|
+
}), /*#__PURE__*/jsxs(Grid, {
|
|
437
753
|
alignItems: "center",
|
|
438
754
|
container: true,
|
|
439
755
|
justifyContent: "flex-end",
|
|
440
756
|
size: 12,
|
|
441
757
|
spacing: 2,
|
|
442
|
-
children: [jsx(Grid, {
|
|
443
|
-
children: jsx(Button, {
|
|
758
|
+
children: [/*#__PURE__*/jsx(Grid, {
|
|
759
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
444
760
|
onClick: handleClearForm,
|
|
445
761
|
size: "small",
|
|
446
762
|
sx: {
|
|
@@ -450,8 +766,8 @@ const Form = () => {
|
|
|
450
766
|
variant: "tertiary",
|
|
451
767
|
children: t('clear-form')
|
|
452
768
|
})
|
|
453
|
-
}), jsx(Grid, {
|
|
454
|
-
children: jsx(Button, {
|
|
769
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
770
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
455
771
|
disabled: !isValid || isPublishing,
|
|
456
772
|
onClick: handleSendForm,
|
|
457
773
|
size: "small",
|
|
@@ -467,43 +783,70 @@ const Form = () => {
|
|
|
467
783
|
})]
|
|
468
784
|
});
|
|
469
785
|
};
|
|
470
|
-
|
|
471
|
-
return jsx(ReactHookFormProvider, {
|
|
472
|
-
options: {
|
|
473
|
-
...defaultFormOptions,
|
|
786
|
+
var TrajksForm = function TrajksForm(props) {
|
|
787
|
+
return /*#__PURE__*/jsx(ReactHookFormProvider, {
|
|
788
|
+
options: Object.assign({}, defaultFormOptions, {
|
|
474
789
|
defaultValues: generateDefaultValues()
|
|
475
|
-
},
|
|
476
|
-
children: jsx(Form, {
|
|
477
|
-
...props
|
|
478
|
-
})
|
|
790
|
+
}),
|
|
791
|
+
children: /*#__PURE__*/jsx(Form, Object.assign({}, props))
|
|
479
792
|
});
|
|
480
793
|
};
|
|
481
794
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
795
|
+
/* *
|
|
796
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
797
|
+
* you may not use this file except in compliance with the License.
|
|
798
|
+
* You may obtain a copy of the License at
|
|
799
|
+
*
|
|
800
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
801
|
+
*
|
|
802
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
803
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
804
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
805
|
+
* See the License for the specific language governing permissions and
|
|
806
|
+
* limitations under the License.
|
|
807
|
+
*
|
|
808
|
+
* Copyright 2026 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
809
|
+
* Copyright 2026 - Finnish Meteorological Institute (FMI)
|
|
810
|
+
* Copyright 2026 - The Norwegian Meteorological Institute (MET Norway)
|
|
811
|
+
* */
|
|
812
|
+
var TrajksFormWrapper = function TrajksFormWrapper() {
|
|
813
|
+
var _useKNMIComponentsTra = useKNMIComponentsTranslation(),
|
|
814
|
+
t = _useKNMIComponentsTra.t;
|
|
815
|
+
var _useAuthenticationCon = useAuthenticationContext(),
|
|
816
|
+
isLoggedIn = _useAuthenticationCon.isLoggedIn;
|
|
489
817
|
if (!isLoggedIn) {
|
|
490
|
-
return jsx(AlertBanner, {
|
|
818
|
+
return /*#__PURE__*/jsx(AlertBanner, {
|
|
491
819
|
title: t('error-auth-login')
|
|
492
820
|
});
|
|
493
821
|
}
|
|
494
|
-
return jsx(ErrorBoundary, {
|
|
495
|
-
children: jsx(TrajksForm, {})
|
|
822
|
+
return /*#__PURE__*/jsx(ErrorBoundary, {
|
|
823
|
+
children: /*#__PURE__*/jsx(TrajksForm, {})
|
|
496
824
|
});
|
|
497
825
|
};
|
|
498
826
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
827
|
+
/* *
|
|
828
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
829
|
+
* you may not use this file except in compliance with the License.
|
|
830
|
+
* You may obtain a copy of the License at
|
|
831
|
+
*
|
|
832
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
833
|
+
*
|
|
834
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
835
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
836
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
837
|
+
* See the License for the specific language governing permissions and
|
|
838
|
+
* limitations under the License.
|
|
839
|
+
*
|
|
840
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
841
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
842
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
843
|
+
* */
|
|
844
|
+
var TRAJKS_COMPONENT_TYPE = 'TrajksModule';
|
|
845
|
+
var componentsLookUp = function componentsLookUp(payload) {
|
|
846
|
+
var componentType = payload.componentType;
|
|
504
847
|
switch (componentType) {
|
|
505
848
|
case TRAJKS_COMPONENT_TYPE:
|
|
506
|
-
return jsx(TrajksFormWrapper, {});
|
|
849
|
+
return /*#__PURE__*/jsx(TrajksFormWrapper, {});
|
|
507
850
|
default:
|
|
508
851
|
return null;
|
|
509
852
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/knmi-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0",
|
|
4
4
|
"description": "GeoWeb knmi-components library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,21 +8,21 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@opengeoweb/form-fields": "
|
|
11
|
+
"@opengeoweb/form-fields": "17.0.0",
|
|
12
12
|
"react-hook-form": "^7.61.1",
|
|
13
13
|
"@mui/material": "^7.2.0",
|
|
14
|
-
"@opengeoweb/shared": "
|
|
15
|
-
"@opengeoweb/theme": "
|
|
14
|
+
"@opengeoweb/shared": "17.0.0",
|
|
15
|
+
"@opengeoweb/theme": "17.0.0",
|
|
16
16
|
"i18next": "^25.3.2",
|
|
17
17
|
"react-i18next": "^15.1.1",
|
|
18
|
-
"@opengeoweb/api": "
|
|
19
|
-
"@opengeoweb/authentication": "
|
|
18
|
+
"@opengeoweb/api": "17.0.0",
|
|
19
|
+
"@opengeoweb/authentication": "17.0.0",
|
|
20
20
|
"@tanstack/react-query": "^5.85.5",
|
|
21
21
|
"react-redux": "^9.2.0",
|
|
22
|
-
"@opengeoweb/snackbar": "
|
|
22
|
+
"@opengeoweb/snackbar": "17.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"eslint-plugin-storybook": "
|
|
25
|
+
"eslint-plugin-storybook": "10.3.3"
|
|
26
26
|
},
|
|
27
27
|
"module": "./index.esm.js",
|
|
28
28
|
"type": "module",
|
package/src/index.d.ts
DELETED
package/src/lib/api/api.d.ts
DELETED
package/src/lib/api/fakeApi.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const requestHandlers: import("msw").HttpHandler[];
|
package/src/lib/api/hooks.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { UseMutationResult } from '@tanstack/react-query';
|
|
2
|
-
import type { TrajksFormValues } from '../components/Trajks';
|
|
3
|
-
type MutationReturnType<T> = UseMutationResult<Headers | null, Error, T>;
|
|
4
|
-
interface PublishProductProps {
|
|
5
|
-
data: TrajksFormValues;
|
|
6
|
-
clearForm: () => void;
|
|
7
|
-
}
|
|
8
|
-
export declare const usePublishProduct: () => MutationReturnType<PublishProductProps>;
|
|
9
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare const TRAJKS_COMPONENT_TYPE: "TrajksModule";
|
|
2
|
-
export type TrajksComponentType = typeof TRAJKS_COMPONENT_TYPE;
|
|
3
|
-
export interface ComponentsLookUpPayload {
|
|
4
|
-
componentType: TrajksComponentType;
|
|
5
|
-
id: string;
|
|
6
|
-
title?: string;
|
|
7
|
-
initialProps: unknown;
|
|
8
|
-
}
|
|
9
|
-
export declare const componentsLookUp: (payload: ComponentsLookUpPayload) => React.ReactElement;
|
|
10
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ComponentsLookUp';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface TrajksFormValues {
|
|
2
|
-
referenceName: string;
|
|
3
|
-
lat: number | string;
|
|
4
|
-
lon: number | string;
|
|
5
|
-
releaseHeight: number | string;
|
|
6
|
-
start: string;
|
|
7
|
-
direction: string;
|
|
8
|
-
duration: number;
|
|
9
|
-
numVerticalLevels: number;
|
|
10
|
-
spatialUncertainty: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare const generateDefaultValues: () => TrajksFormValues;
|
|
13
|
-
export declare const Form: () => React.JSX.Element;
|
|
14
|
-
export declare const TrajksForm: React.FC;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { Form } from './TrajksForm';
|
|
3
|
-
type Story = StoryObj<typeof Form>;
|
|
4
|
-
declare const _default: {
|
|
5
|
-
title: string;
|
|
6
|
-
};
|
|
7
|
-
export default _default;
|
|
8
|
-
export declare const TrajksLight: Story;
|
|
9
|
-
export declare const TrajksDark: Story;
|
|
10
|
-
export declare const TrajksLightLarge: Story;
|
|
11
|
-
export declare const TrajksDarkLarge: Story;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const TrajksFormWrapper: React.FC;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { TrajksFormWrapper } from './TrajksFormWrapper';
|
|
3
|
-
type Story = StoryObj<typeof TrajksFormWrapper>;
|
|
4
|
-
declare const _default: {
|
|
5
|
-
title: string;
|
|
6
|
-
};
|
|
7
|
-
export default _default;
|
|
8
|
-
export declare const Demo: Story;
|
|
9
|
-
export declare const DemoError: Story;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './TrajksForm';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Theme } from '@mui/material';
|
|
2
|
-
import type { UseFormProps } from 'react-hook-form';
|
|
3
|
-
interface KNMIComponentsThemeFormProviderProps {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
options?: UseFormProps;
|
|
6
|
-
theme?: Theme;
|
|
7
|
-
}
|
|
8
|
-
export declare const KNMIComponentsThemeFormProvider: React.FC<KNMIComponentsThemeFormProviderProps>;
|
|
9
|
-
export {};
|
package/src/lib/utils/i18n.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import i18n from 'i18next';
|
|
2
|
-
import type { UseTranslationResponse } from 'react-i18next';
|
|
3
|
-
export declare const KNMICOMPONENTS_NAMESPACE = "KNMIComponents";
|
|
4
|
-
export declare const initKNMIComponentsI18n: () => void;
|
|
5
|
-
export declare const translateInTestsAndStories: (key: string, params?: Record<string, string | number> | undefined) => string;
|
|
6
|
-
export declare const useKNMIComponentsTranslation: () => UseTranslationResponse<typeof KNMICOMPONENTS_NAMESPACE, typeof i18n>;
|