@apia/components 4.0.8 → 4.0.11
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/dist/index.d.ts +413 -9
- package/dist/index.js +2275 -420
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
import uniqueId$2 from 'lodash-es/uniqueId';
|
|
2
|
-
import { findScrollContainer, useUpdateEffect, focus, focusSelector, getFocusSelector, addBoundary, useCombinedRefs, usePrevious, EventEmitter, useMount, getLabel, getSpecificParent, isChild, useUnmount, StatefulEmitter, debugDispatcher, customEvents, getDateFormat, persistentStorage, disableChildrenFocus, enableChildrenFocus, decodeHTMLEntities, useDebouncedCallback, getIndex, noNaN, useLatest, useSubscription } from '@apia/util';
|
|
3
1
|
import { jsx, Fragment, jsxs } from '@apia/theme/jsx-runtime';
|
|
4
2
|
import * as React from 'react';
|
|
5
|
-
import React__default, { createContext, useContext,
|
|
3
|
+
import React__default, { createContext, useContext, useEffect, useMemo, useState, useCallback, useRef, forwardRef, Fragment as Fragment$1, useDeferredValue, lazy, Suspense, useTransition, Children, memo, isValidElement, cloneElement } from 'react';
|
|
4
|
+
import parse, { domToReact, Element } from 'html-react-parser';
|
|
5
|
+
import { Spinner as Spinner$1, Box as Box$1 } from 'theme-ui';
|
|
6
|
+
import { uniqueId as uniqueId$3, debounce, cloneDeep, isFunction as isFunction$1 } from 'lodash-es';
|
|
7
|
+
import { Box, getVariant, useBreakpointIndex, Close, responsive, spacing, Heading, Button, Spinner, createElement, Select, Input, Flex, IconButton as IconButton$1, Image, injectStyles, focusOutline, makeStyledComponent, useThemeUI, Label, Progress, Grid, Textarea, Paragraph, Container } from '@apia/theme';
|
|
8
|
+
import { BarLoader } from 'react-spinners';
|
|
9
|
+
import uniqueId$2 from 'lodash-es/uniqueId';
|
|
10
|
+
import { findScrollContainer, useUpdateEffect, focus, focusSelector, getFocusSelector, addBoundary, useCombinedRefs, usePrevious, EventEmitter, useMount, getLabel, getSpecificParent, isChild, useUnmount, StatefulEmitter, shallowEqual as shallowEqual$1, debugDispatcher, customEvents, getDateFormat, persistentStorage, disableChildrenFocus, enableChildrenFocus, decodeHTMLEntities, useDebouncedCallback, getIndex, noNaN, useLatest, useSubscription, arrayOrArray } from '@apia/util';
|
|
6
11
|
import usePortal from 'react-cool-portal';
|
|
7
12
|
import { CSSTransition } from 'react-transition-group';
|
|
8
|
-
import { Box, getVariant, useBreakpointIndex, Close, responsive, spacing, Heading, Spinner, Button, createElement, Select, Input, Flex, IconButton as IconButton$1, Image, injectStyles, focusOutline, makeStyledComponent, useThemeUI, Label, Progress, Grid } from '@apia/theme';
|
|
9
13
|
import { uniqueId as uniqueId$1, defaultNotifier, NotificationsList } from '@apia/notifications';
|
|
10
14
|
import ReactFocusLock, { FreeFocusInside } from 'react-focus-lock';
|
|
11
15
|
import { useBreakpointIndex as useBreakpointIndex$1 } from '@theme-ui/match-media';
|
|
16
|
+
import { isIconName, Icon as Icon$1, icons } from '@apia/icons';
|
|
12
17
|
import { useMenuState, ControlledMenu, MenuItem, MenuDivider, SubMenu } from '@szhsin/react-menu';
|
|
13
|
-
import { makeAutoObservable, observable, reaction } from 'mobx';
|
|
18
|
+
import { makeAutoObservable, observable, reaction, makeObservable, toJS, action } from 'mobx';
|
|
14
19
|
import { shallowEqual } from '@apia/store';
|
|
15
|
-
import { isIconName, Icon as Icon$1, icons } from '@apia/icons';
|
|
16
20
|
import AnimateHeight from 'react-animate-height';
|
|
17
21
|
import { useUpdateEffect as useUpdateEffect$1 } from 'ahooks';
|
|
18
22
|
import dayjs from 'dayjs';
|
|
19
23
|
import isFunction from 'lodash-es/isFunction';
|
|
20
24
|
import ReactInputMask from 'react-input-mask';
|
|
21
|
-
import { uniqueId as uniqueId$3, debounce } from 'lodash-es';
|
|
22
25
|
import { observer } from 'mobx-react-lite';
|
|
23
26
|
import { createFAsomeStore } from '@apia/dom-store';
|
|
24
|
-
import {
|
|
27
|
+
import { keyframes } from '@emotion/react';
|
|
25
28
|
|
|
26
29
|
const AccordionContext = createContext(null);
|
|
27
30
|
const AccordionItemContext = createContext(null);
|
|
@@ -32,10 +35,10 @@ const useAccordionContext = () => {
|
|
|
32
35
|
return context;
|
|
33
36
|
};
|
|
34
37
|
|
|
35
|
-
var __defProp$
|
|
36
|
-
var __defNormalProp$
|
|
37
|
-
var __publicField$
|
|
38
|
-
__defNormalProp$
|
|
38
|
+
var __defProp$o = Object.defineProperty;
|
|
39
|
+
var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
40
|
+
var __publicField$o = (obj, key, value) => {
|
|
41
|
+
__defNormalProp$o(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
39
42
|
return value;
|
|
40
43
|
};
|
|
41
44
|
function makeItemStateSelectorHook(handler) {
|
|
@@ -67,10 +70,10 @@ class AccordionHandler {
|
|
|
67
70
|
constructor(id, props) {
|
|
68
71
|
this.id = id;
|
|
69
72
|
this.props = props;
|
|
70
|
-
__publicField$
|
|
71
|
-
__publicField$
|
|
72
|
-
__publicField$
|
|
73
|
-
__publicField$
|
|
73
|
+
__publicField$o(this, "itemsState", {});
|
|
74
|
+
__publicField$o(this, "itemsStateListeners", {});
|
|
75
|
+
__publicField$o(this, "propsListeners", []);
|
|
76
|
+
__publicField$o(this, "hooks", {
|
|
74
77
|
useAccordionContextProvider: () => {
|
|
75
78
|
const Provider = useMemo(
|
|
76
79
|
() => ({ children }) => /* @__PURE__ */ jsx(AccordionContext.Provider, { value: this, children }),
|
|
@@ -573,7 +576,6 @@ const DialogHeader = ({
|
|
|
573
576
|
}
|
|
574
577
|
);
|
|
575
578
|
};
|
|
576
|
-
var DialogHeader$1 = DialogHeader;
|
|
577
579
|
|
|
578
580
|
const ModalContext = createContext(null);
|
|
579
581
|
function useModalContext() {
|
|
@@ -977,7 +979,7 @@ const WindowModal = forwardRef(
|
|
|
977
979
|
),
|
|
978
980
|
children: [
|
|
979
981
|
!noHeader && /* @__PURE__ */ jsx(
|
|
980
|
-
DialogHeader
|
|
982
|
+
DialogHeader,
|
|
981
983
|
{
|
|
982
984
|
NavBar,
|
|
983
985
|
title: innerTitle,
|
|
@@ -1006,56 +1008,56 @@ const WindowModal = forwardRef(
|
|
|
1006
1008
|
}
|
|
1007
1009
|
);
|
|
1008
1010
|
|
|
1009
|
-
var __defProp$
|
|
1010
|
-
var __defNormalProp$
|
|
1011
|
-
var __publicField$
|
|
1012
|
-
__defNormalProp$
|
|
1011
|
+
var __defProp$n = Object.defineProperty;
|
|
1012
|
+
var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1013
|
+
var __publicField$n = (obj, key, value) => {
|
|
1014
|
+
__defNormalProp$n(obj, key + "" , value);
|
|
1013
1015
|
return value;
|
|
1014
1016
|
};
|
|
1015
|
-
var __accessCheck$
|
|
1017
|
+
var __accessCheck$d = (obj, member, msg) => {
|
|
1016
1018
|
if (!member.has(obj))
|
|
1017
1019
|
throw TypeError("Cannot " + msg);
|
|
1018
1020
|
};
|
|
1019
|
-
var __privateGet$
|
|
1020
|
-
__accessCheck$
|
|
1021
|
+
var __privateGet$a = (obj, member, getter) => {
|
|
1022
|
+
__accessCheck$d(obj, member, "read from private field");
|
|
1021
1023
|
return getter ? getter.call(obj) : member.get(obj);
|
|
1022
1024
|
};
|
|
1023
|
-
var __privateAdd$
|
|
1025
|
+
var __privateAdd$d = (obj, member, value) => {
|
|
1024
1026
|
if (member.has(obj))
|
|
1025
1027
|
throw TypeError("Cannot add the same private member more than once");
|
|
1026
1028
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
1027
1029
|
};
|
|
1028
1030
|
var __privateSet$8 = (obj, member, value, setter) => {
|
|
1029
|
-
__accessCheck$
|
|
1030
|
-
|
|
1031
|
+
__accessCheck$d(obj, member, "write to private field");
|
|
1032
|
+
member.set(obj, value);
|
|
1031
1033
|
return value;
|
|
1032
1034
|
};
|
|
1033
1035
|
var __privateMethod$3 = (obj, member, method) => {
|
|
1034
|
-
__accessCheck$
|
|
1036
|
+
__accessCheck$d(obj, member, "access private method");
|
|
1035
1037
|
return method;
|
|
1036
1038
|
};
|
|
1037
1039
|
var _isLocked, _onChangeCb, _onDestroyCb, _evaluate, evaluate_fn, _a$1;
|
|
1038
1040
|
class BodyScrollLocker {
|
|
1039
1041
|
constructor() {
|
|
1040
|
-
__privateAdd$
|
|
1041
|
-
__privateAdd$
|
|
1042
|
+
__privateAdd$d(this, _isLocked, false);
|
|
1043
|
+
__privateAdd$d(this, _onChangeCb, () => {
|
|
1042
1044
|
});
|
|
1043
|
-
__privateAdd$
|
|
1045
|
+
__privateAdd$d(this, _onDestroyCb, () => {
|
|
1044
1046
|
});
|
|
1045
1047
|
}
|
|
1046
1048
|
get isLocked() {
|
|
1047
|
-
return __privateGet$
|
|
1049
|
+
return __privateGet$a(this, _isLocked);
|
|
1048
1050
|
}
|
|
1049
1051
|
destroy() {
|
|
1050
|
-
__privateGet$
|
|
1052
|
+
__privateGet$a(this, _onDestroyCb).call(this);
|
|
1051
1053
|
}
|
|
1052
1054
|
lock() {
|
|
1053
1055
|
__privateSet$8(this, _isLocked, true);
|
|
1054
|
-
__privateGet$
|
|
1056
|
+
__privateGet$a(this, _onChangeCb).call(this);
|
|
1055
1057
|
}
|
|
1056
1058
|
unlock() {
|
|
1057
1059
|
__privateSet$8(this, _isLocked, false);
|
|
1058
|
-
__privateGet$
|
|
1060
|
+
__privateGet$a(this, _onChangeCb).call(this);
|
|
1059
1061
|
}
|
|
1060
1062
|
onChange(cb) {
|
|
1061
1063
|
__privateSet$8(this, _onChangeCb, cb);
|
|
@@ -1073,8 +1075,8 @@ _onChangeCb = new WeakMap();
|
|
|
1073
1075
|
_onDestroyCb = new WeakMap();
|
|
1074
1076
|
const BodyScrollLock = new (_a$1 = class {
|
|
1075
1077
|
constructor() {
|
|
1076
|
-
__privateAdd$
|
|
1077
|
-
__publicField$
|
|
1078
|
+
__privateAdd$d(this, _evaluate);
|
|
1079
|
+
__publicField$n(this, "lockers", []);
|
|
1078
1080
|
}
|
|
1079
1081
|
getLocker() {
|
|
1080
1082
|
const locker = new BodyScrollLocker();
|
|
@@ -1301,7 +1303,7 @@ const StaticModal = forwardRef(
|
|
|
1301
1303
|
"data-variant": `layout.common.modals.${size}`,
|
|
1302
1304
|
children: [
|
|
1303
1305
|
!noHeader && /* @__PURE__ */ jsx(
|
|
1304
|
-
DialogHeader
|
|
1306
|
+
DialogHeader,
|
|
1305
1307
|
{
|
|
1306
1308
|
className: "modal__header",
|
|
1307
1309
|
NavBar,
|
|
@@ -1348,7 +1350,8 @@ Modal.displayName = "Modal";
|
|
|
1348
1350
|
const OpenModal = (props) => {
|
|
1349
1351
|
const modalProps = useModal({
|
|
1350
1352
|
isDefaultOpen: true,
|
|
1351
|
-
onExited: props.onExited
|
|
1353
|
+
onExited: props.onExited,
|
|
1354
|
+
onClose: props.onClose
|
|
1352
1355
|
});
|
|
1353
1356
|
const previousOpenProp = usePrevious(props.isOpen);
|
|
1354
1357
|
if (previousOpenProp.current !== props.isOpen && !props.isOpen) {
|
|
@@ -1372,10 +1375,12 @@ const OpenModal = (props) => {
|
|
|
1372
1375
|
Confirm,
|
|
1373
1376
|
{
|
|
1374
1377
|
...confirmProps,
|
|
1375
|
-
onConfirm: () => {
|
|
1378
|
+
onConfirm: async () => {
|
|
1376
1379
|
hasConfirmed.current = true;
|
|
1377
|
-
props.onConfirm?.();
|
|
1378
|
-
|
|
1380
|
+
const res = await props.onConfirm?.();
|
|
1381
|
+
if (res !== false) {
|
|
1382
|
+
modalProps.hide();
|
|
1383
|
+
}
|
|
1379
1384
|
},
|
|
1380
1385
|
onCancel: () => {
|
|
1381
1386
|
modalProps.hide();
|
|
@@ -1396,36 +1401,36 @@ const OpenModal = (props) => {
|
|
|
1396
1401
|
);
|
|
1397
1402
|
};
|
|
1398
1403
|
|
|
1399
|
-
var __defProp$
|
|
1400
|
-
var __defNormalProp$
|
|
1401
|
-
var __publicField$
|
|
1402
|
-
__defNormalProp$
|
|
1404
|
+
var __defProp$m = Object.defineProperty;
|
|
1405
|
+
var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1406
|
+
var __publicField$m = (obj, key, value) => {
|
|
1407
|
+
__defNormalProp$m(obj, key + "" , value);
|
|
1403
1408
|
return value;
|
|
1404
1409
|
};
|
|
1405
|
-
var __accessCheck$
|
|
1410
|
+
var __accessCheck$c = (obj, member, msg) => {
|
|
1406
1411
|
if (!member.has(obj))
|
|
1407
1412
|
throw TypeError("Cannot " + msg);
|
|
1408
1413
|
};
|
|
1409
|
-
var __privateGet$
|
|
1410
|
-
__accessCheck$
|
|
1414
|
+
var __privateGet$9 = (obj, member, getter) => {
|
|
1415
|
+
__accessCheck$c(obj, member, "read from private field");
|
|
1411
1416
|
return getter ? getter.call(obj) : member.get(obj);
|
|
1412
1417
|
};
|
|
1413
|
-
var __privateAdd$
|
|
1418
|
+
var __privateAdd$c = (obj, member, value) => {
|
|
1414
1419
|
if (member.has(obj))
|
|
1415
1420
|
throw TypeError("Cannot add the same private member more than once");
|
|
1416
1421
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
1417
1422
|
};
|
|
1418
1423
|
var __privateSet$7 = (obj, member, value, setter) => {
|
|
1419
|
-
__accessCheck$
|
|
1420
|
-
|
|
1424
|
+
__accessCheck$c(obj, member, "write to private field");
|
|
1425
|
+
member.set(obj, value);
|
|
1421
1426
|
return value;
|
|
1422
1427
|
};
|
|
1423
1428
|
var __privateWrapper$2 = (obj, member, setter, getter) => ({
|
|
1424
1429
|
set _(value) {
|
|
1425
|
-
__privateSet$7(obj, member, value
|
|
1430
|
+
__privateSet$7(obj, member, value);
|
|
1426
1431
|
},
|
|
1427
1432
|
get _() {
|
|
1428
|
-
return __privateGet$
|
|
1433
|
+
return __privateGet$9(obj, member, getter);
|
|
1429
1434
|
}
|
|
1430
1435
|
});
|
|
1431
1436
|
var _emitter$4, _maxId$1, _useModalsList;
|
|
@@ -1437,14 +1442,14 @@ class ApiaUtilModalHandler {
|
|
|
1437
1442
|
}
|
|
1438
1443
|
class ApiaUtilModals {
|
|
1439
1444
|
constructor() {
|
|
1440
|
-
__privateAdd$
|
|
1441
|
-
__privateAdd$
|
|
1442
|
-
__privateAdd$
|
|
1445
|
+
__privateAdd$c(this, _emitter$4, new EventEmitter());
|
|
1446
|
+
__privateAdd$c(this, _maxId$1, 0);
|
|
1447
|
+
__privateAdd$c(this, _useModalsList, () => {
|
|
1443
1448
|
const [modals, setModals] = useState(
|
|
1444
1449
|
[]
|
|
1445
1450
|
);
|
|
1446
1451
|
useMount(() => {
|
|
1447
|
-
const u1 = __privateGet$
|
|
1452
|
+
const u1 = __privateGet$9(this, _emitter$4).on("open", (ev) => {
|
|
1448
1453
|
setModals((current) => [
|
|
1449
1454
|
...current,
|
|
1450
1455
|
{
|
|
@@ -1459,12 +1464,12 @@ class ApiaUtilModals {
|
|
|
1459
1464
|
}
|
|
1460
1465
|
]);
|
|
1461
1466
|
});
|
|
1462
|
-
const u2 = __privateGet$
|
|
1467
|
+
const u2 = __privateGet$9(this, _emitter$4).on("closeAll", () => {
|
|
1463
1468
|
setModals(
|
|
1464
1469
|
(current) => current.map((modal) => ({ ...modal, isOpen: false }))
|
|
1465
1470
|
);
|
|
1466
1471
|
});
|
|
1467
|
-
const u3 = __privateGet$
|
|
1472
|
+
const u3 = __privateGet$9(this, _emitter$4).on("close", (modalId) => {
|
|
1468
1473
|
setModals(
|
|
1469
1474
|
(current) => current.map(
|
|
1470
1475
|
(modal) => modal.id === modalId ? { ...modal, isOpen: false } : modal
|
|
@@ -1479,8 +1484,8 @@ class ApiaUtilModals {
|
|
|
1479
1484
|
});
|
|
1480
1485
|
return modals;
|
|
1481
1486
|
});
|
|
1482
|
-
__publicField$
|
|
1483
|
-
const modals = __privateGet$
|
|
1487
|
+
__publicField$m(this, "Component", () => {
|
|
1488
|
+
const modals = __privateGet$9(this, _useModalsList).call(this);
|
|
1484
1489
|
return /* @__PURE__ */ jsx(Fragment, { children: modals.map((current) => /* @__PURE__ */ jsx(OpenModal, { ...current }, current.id)) });
|
|
1485
1490
|
});
|
|
1486
1491
|
document.addEventListener("openModal", (event) => {
|
|
@@ -1488,11 +1493,14 @@ class ApiaUtilModals {
|
|
|
1488
1493
|
this.open(cevent.detail);
|
|
1489
1494
|
});
|
|
1490
1495
|
}
|
|
1496
|
+
close(id) {
|
|
1497
|
+
__privateGet$9(this, _emitter$4).emit("close", id);
|
|
1498
|
+
}
|
|
1491
1499
|
open(props) {
|
|
1492
1500
|
const id = props.id ?? `modal_${__privateWrapper$2(this, _maxId$1)._++}`;
|
|
1493
|
-
__privateGet$
|
|
1501
|
+
__privateGet$9(this, _emitter$4).emit("open", { ...props, id });
|
|
1494
1502
|
return new ApiaUtilModalHandler(id, () => {
|
|
1495
|
-
__privateGet$
|
|
1503
|
+
__privateGet$9(this, _emitter$4).emit("close", id);
|
|
1496
1504
|
});
|
|
1497
1505
|
}
|
|
1498
1506
|
}
|
|
@@ -1500,29 +1508,29 @@ _emitter$4 = new WeakMap();
|
|
|
1500
1508
|
_maxId$1 = new WeakMap();
|
|
1501
1509
|
_useModalsList = new WeakMap();
|
|
1502
1510
|
|
|
1503
|
-
var __defProp$
|
|
1504
|
-
var __defNormalProp$
|
|
1505
|
-
var __publicField$
|
|
1506
|
-
__defNormalProp$
|
|
1511
|
+
var __defProp$l = Object.defineProperty;
|
|
1512
|
+
var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1513
|
+
var __publicField$l = (obj, key, value) => {
|
|
1514
|
+
__defNormalProp$l(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1507
1515
|
return value;
|
|
1508
1516
|
};
|
|
1509
1517
|
class ApiaUtilNotifications {
|
|
1510
1518
|
constructor() {
|
|
1511
|
-
__publicField$
|
|
1519
|
+
__publicField$l(this, "close", (id) => {
|
|
1512
1520
|
defaultNotifier.close(id);
|
|
1513
1521
|
});
|
|
1514
|
-
__publicField$
|
|
1522
|
+
__publicField$l(this, "closeAll", () => {
|
|
1515
1523
|
defaultNotifier.closeAll();
|
|
1516
1524
|
});
|
|
1517
|
-
__publicField$
|
|
1525
|
+
__publicField$l(this, "notify", (notification) => {
|
|
1518
1526
|
defaultNotifier.notify({
|
|
1519
1527
|
...notification,
|
|
1520
1528
|
type: notification.type ?? "warning"
|
|
1521
1529
|
});
|
|
1522
1530
|
});
|
|
1523
1531
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1524
|
-
__publicField$
|
|
1525
|
-
__publicField$
|
|
1532
|
+
__publicField$l(this, "useSelector", (selector) => defaultNotifier.useSelector(selector));
|
|
1533
|
+
__publicField$l(this, "Component", () => {
|
|
1526
1534
|
return /* @__PURE__ */ jsx(NotificationsList, {});
|
|
1527
1535
|
});
|
|
1528
1536
|
}
|
|
@@ -1615,7 +1623,6 @@ const ContextMenu = observer(
|
|
|
1615
1623
|
);
|
|
1616
1624
|
}
|
|
1617
1625
|
);
|
|
1618
|
-
var ContextMenu$1 = ContextMenu;
|
|
1619
1626
|
|
|
1620
1627
|
function makeIcon(name) {
|
|
1621
1628
|
return function IconComponent() {
|
|
@@ -1644,20 +1651,50 @@ const DefaultTabsLabelRenderer = observer(
|
|
|
1644
1651
|
},
|
|
1645
1652
|
[controller, tab.id]
|
|
1646
1653
|
);
|
|
1654
|
+
const handleMouseDown = React__default.useCallback(
|
|
1655
|
+
(ev) => {
|
|
1656
|
+
if (ev.button === 1) {
|
|
1657
|
+
tab.close();
|
|
1658
|
+
} else if (ev.button === 0)
|
|
1659
|
+
tab.open();
|
|
1660
|
+
},
|
|
1661
|
+
[tab]
|
|
1662
|
+
);
|
|
1647
1663
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1664
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1665
|
+
tab.controller.state.isMultiple && /* @__PURE__ */ jsx(
|
|
1666
|
+
Checkbox$1,
|
|
1667
|
+
{
|
|
1668
|
+
onChange: (ev) => {
|
|
1669
|
+
tab.toggle(ev.target.checked);
|
|
1670
|
+
},
|
|
1671
|
+
checked: tab.state.isOpen
|
|
1672
|
+
}
|
|
1673
|
+
),
|
|
1674
|
+
tab.state.isIconTab ? /* @__PURE__ */ jsx(
|
|
1675
|
+
IconButton,
|
|
1676
|
+
{
|
|
1677
|
+
onMouseDown: handleMouseDown,
|
|
1678
|
+
className: "tabs__item__button",
|
|
1679
|
+
as: "div",
|
|
1680
|
+
icon: tab.state.icon,
|
|
1681
|
+
variant: "null",
|
|
1682
|
+
iconSize: "Sm",
|
|
1683
|
+
size: "Lg"
|
|
1684
|
+
}
|
|
1685
|
+
) : /* @__PURE__ */ jsxs(
|
|
1686
|
+
SimpleButton,
|
|
1687
|
+
{
|
|
1688
|
+
onMouseDown: handleMouseDown,
|
|
1689
|
+
className: "tabs__item__button",
|
|
1690
|
+
as: "div",
|
|
1691
|
+
variant: "null",
|
|
1692
|
+
children: [
|
|
1693
|
+
/* @__PURE__ */ jsx(ActualIcon, {}),
|
|
1694
|
+
tab.state.label
|
|
1695
|
+
]
|
|
1696
|
+
}
|
|
1697
|
+
)
|
|
1661
1698
|
] }),
|
|
1662
1699
|
tab.state.isClosable && /* @__PURE__ */ jsx(
|
|
1663
1700
|
IconButton,
|
|
@@ -1706,54 +1743,50 @@ const Item = observer(({ tab }) => {
|
|
|
1706
1743
|
});
|
|
1707
1744
|
}
|
|
1708
1745
|
}, [tab.state.isOpen]);
|
|
1709
|
-
const
|
|
1746
|
+
const boxProps = {
|
|
1710
1747
|
className: `tabs__item__wrapper ${tab.state.isOpen ? "open" : ""} ${tab.state.isDisabled ? "disabled" : ""}`,
|
|
1711
1748
|
title: tab.state.title ?? tab.state.label,
|
|
1712
|
-
onMouseDown: React__default.useCallback(
|
|
1713
|
-
(ev) => {
|
|
1714
|
-
if (ev.button === 1) {
|
|
1715
|
-
tab.close();
|
|
1716
|
-
} else if (ev.button === 0)
|
|
1717
|
-
tab.open();
|
|
1718
|
-
},
|
|
1719
|
-
[tab]
|
|
1720
|
-
),
|
|
1721
1749
|
"aria-controls": `tabpanel-${tab.controller.id}-${tab.state.id}`,
|
|
1722
1750
|
"aria-selected": tab.state.isOpen ?? false,
|
|
1723
1751
|
id: `tab-${tab.controller.id}-${tab.id}`,
|
|
1724
|
-
tabIndex: tab.state.
|
|
1752
|
+
tabIndex: tab.state.isOpen ? 0 : -1,
|
|
1725
1753
|
role: "tab",
|
|
1726
1754
|
variant: "inherit"
|
|
1727
1755
|
};
|
|
1728
|
-
return /* @__PURE__ */ jsx(
|
|
1756
|
+
return /* @__PURE__ */ jsx(Box, { "data-id": tab.id, ref, ...boxProps, children: /* @__PURE__ */ jsx(Renderer, { tab }) });
|
|
1729
1757
|
});
|
|
1730
|
-
|
|
1758
|
+
|
|
1759
|
+
function useShowScrollButtons() {
|
|
1760
|
+
const [showScrollButtons, setShowScrollButtons] = useState(false);
|
|
1761
|
+
const [ref, setRef] = useState(null);
|
|
1762
|
+
const controller = useTabsContext();
|
|
1763
|
+
useEffect(() => {
|
|
1764
|
+
if (ref && controller) {
|
|
1765
|
+
const observer = new MutationObserver(([{ addedNodes }]) => {
|
|
1766
|
+
const fixedTabsElement = ref.querySelector(".tabsList__fixedTabs");
|
|
1767
|
+
const hasFixedTabsScroll = (fixedTabsElement?.clientWidth ?? 0) < (fixedTabsElement?.scrollWidth ?? 0);
|
|
1768
|
+
const nonFixedTabsElement = ref.querySelector(".tabs__list");
|
|
1769
|
+
const hasFixedNonTabsScroll = (nonFixedTabsElement?.clientWidth ?? 0) < (nonFixedTabsElement?.scrollWidth ?? 0);
|
|
1770
|
+
setShowScrollButtons(hasFixedTabsScroll || hasFixedNonTabsScroll);
|
|
1771
|
+
if (addedNodes) {
|
|
1772
|
+
ref.querySelector(".tabs__list").scrollLeft = 9999999;
|
|
1773
|
+
}
|
|
1774
|
+
});
|
|
1775
|
+
observer.observe(ref, { childList: true, subtree: true });
|
|
1776
|
+
return () => {
|
|
1777
|
+
observer.disconnect();
|
|
1778
|
+
};
|
|
1779
|
+
}
|
|
1780
|
+
return () => {
|
|
1781
|
+
};
|
|
1782
|
+
}, [controller, ref]);
|
|
1783
|
+
return [showScrollButtons, setRef];
|
|
1784
|
+
}
|
|
1731
1785
|
|
|
1732
1786
|
const TabsList = observer(
|
|
1733
1787
|
({ arrowsBehavior = "focus" }) => {
|
|
1734
1788
|
const controller = useTabsContext();
|
|
1735
|
-
const [showScrollButtons,
|
|
1736
|
-
const [ref, setRef] = React__default.useState(null);
|
|
1737
|
-
React__default.useEffect(() => {
|
|
1738
|
-
if (ref && controller) {
|
|
1739
|
-
const observer2 = new MutationObserver(([{ addedNodes }]) => {
|
|
1740
|
-
const fixedTabsElement = ref.querySelector(".tabsList__fixedTabs");
|
|
1741
|
-
const hasFixedTabsScroll = (fixedTabsElement?.clientWidth ?? 0) < (fixedTabsElement?.scrollWidth ?? 0);
|
|
1742
|
-
const nonFixedTabsElement = ref.querySelector(".tabs__list");
|
|
1743
|
-
const hasFixedNonTabsScroll = (nonFixedTabsElement?.clientWidth ?? 0) < (nonFixedTabsElement?.scrollWidth ?? 0);
|
|
1744
|
-
setShowScrollButtons(hasFixedTabsScroll || hasFixedNonTabsScroll);
|
|
1745
|
-
if (addedNodes) {
|
|
1746
|
-
ref.querySelector(".tabs__list").scrollLeft = 9999999;
|
|
1747
|
-
}
|
|
1748
|
-
});
|
|
1749
|
-
observer2.observe(ref, { childList: true, subtree: true });
|
|
1750
|
-
return () => {
|
|
1751
|
-
observer2.disconnect();
|
|
1752
|
-
};
|
|
1753
|
-
}
|
|
1754
|
-
return () => {
|
|
1755
|
-
};
|
|
1756
|
-
}, [controller, ref]);
|
|
1789
|
+
const [showScrollButtons, setRef] = useShowScrollButtons();
|
|
1757
1790
|
const onClickPrev = React__default.useCallback(() => {
|
|
1758
1791
|
if (arrowsBehavior === "focus")
|
|
1759
1792
|
controller?.focusPreviousTab();
|
|
@@ -1785,9 +1818,9 @@ const TabsList = observer(
|
|
|
1785
1818
|
...getVariant("layout.common.tabs.primary"),
|
|
1786
1819
|
ref: setRef,
|
|
1787
1820
|
children: [
|
|
1788
|
-
/* @__PURE__ */ jsx(Box, { className: "tabsList__fixedTabs", children: fixedTabs.map((current) => /* @__PURE__ */ jsx(Item
|
|
1821
|
+
/* @__PURE__ */ jsx(Box, { className: "tabsList__fixedTabs", children: fixedTabs.map((current) => /* @__PURE__ */ jsx(Item, { tab: current }, current.id)) }),
|
|
1789
1822
|
/* @__PURE__ */ jsx(
|
|
1790
|
-
ContextMenu
|
|
1823
|
+
ContextMenu,
|
|
1791
1824
|
{
|
|
1792
1825
|
anchorPoint,
|
|
1793
1826
|
isOpen,
|
|
@@ -1812,7 +1845,7 @@ const TabsList = observer(
|
|
|
1812
1845
|
setIsOpen(true);
|
|
1813
1846
|
}
|
|
1814
1847
|
}, []),
|
|
1815
|
-
children: nonFixedTabs.map((current) => /* @__PURE__ */ jsx(Item
|
|
1848
|
+
children: nonFixedTabs.map((current) => /* @__PURE__ */ jsx(Item, { tab: current }, current.id))
|
|
1816
1849
|
}
|
|
1817
1850
|
),
|
|
1818
1851
|
showScrollButtons && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1847,23 +1880,23 @@ const TabsList = observer(
|
|
|
1847
1880
|
}
|
|
1848
1881
|
);
|
|
1849
1882
|
|
|
1850
|
-
var __defProp$
|
|
1851
|
-
var __defNormalProp$
|
|
1852
|
-
var __publicField$
|
|
1853
|
-
__defNormalProp$
|
|
1883
|
+
var __defProp$k = Object.defineProperty;
|
|
1884
|
+
var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1885
|
+
var __publicField$k = (obj, key, value) => {
|
|
1886
|
+
__defNormalProp$k(obj, key + "" , value);
|
|
1854
1887
|
return value;
|
|
1855
1888
|
};
|
|
1856
|
-
var __accessCheck$
|
|
1889
|
+
var __accessCheck$b = (obj, member, msg) => {
|
|
1857
1890
|
if (!member.has(obj))
|
|
1858
1891
|
throw TypeError("Cannot " + msg);
|
|
1859
1892
|
};
|
|
1860
|
-
var __privateAdd$
|
|
1893
|
+
var __privateAdd$b = (obj, member, value) => {
|
|
1861
1894
|
if (member.has(obj))
|
|
1862
1895
|
throw TypeError("Cannot add the same private member more than once");
|
|
1863
1896
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
1864
1897
|
};
|
|
1865
1898
|
var __privateMethod$2 = (obj, member, method) => {
|
|
1866
|
-
__accessCheck$
|
|
1899
|
+
__accessCheck$b(obj, member, "access private method");
|
|
1867
1900
|
return method;
|
|
1868
1901
|
};
|
|
1869
1902
|
var _innerAppend, innerAppend_fn;
|
|
@@ -1885,18 +1918,24 @@ class Tab {
|
|
|
1885
1918
|
open() {
|
|
1886
1919
|
this.controller.openTab(this.id);
|
|
1887
1920
|
}
|
|
1921
|
+
toggle(isShown) {
|
|
1922
|
+
this.controller.toggleTab(this.state.id, isShown);
|
|
1923
|
+
}
|
|
1888
1924
|
}
|
|
1889
1925
|
class TabsController {
|
|
1890
1926
|
constructor(id, props) {
|
|
1891
1927
|
this.id = id;
|
|
1892
1928
|
this.props = props;
|
|
1893
|
-
__privateAdd$
|
|
1894
|
-
__publicField$
|
|
1895
|
-
|
|
1929
|
+
__privateAdd$b(this, _innerAppend);
|
|
1930
|
+
__publicField$k(this, "state", {
|
|
1931
|
+
isMultiple: false,
|
|
1932
|
+
openTabsHistory: /* @__PURE__ */ new Set(),
|
|
1896
1933
|
tabs: /* @__PURE__ */ new Map(),
|
|
1897
|
-
timestamp: 0
|
|
1934
|
+
timestamp: 0,
|
|
1935
|
+
showAtLeastOneTab: false
|
|
1898
1936
|
});
|
|
1899
|
-
|
|
1937
|
+
Object.assign(this.state, props.initialState ?? {});
|
|
1938
|
+
props.initialTabs?.forEach((tab) => this.append(tab));
|
|
1900
1939
|
if (props.initialTabs && props.initialTabs.length > 0)
|
|
1901
1940
|
this.focusTab(props.initialTabs[0].id);
|
|
1902
1941
|
makeAutoObservable(this);
|
|
@@ -1908,7 +1947,7 @@ class TabsController {
|
|
|
1908
1947
|
* Es el tab que está abierto
|
|
1909
1948
|
*/
|
|
1910
1949
|
get activeTab() {
|
|
1911
|
-
const tabs = [...this.state.
|
|
1950
|
+
const tabs = [...this.state.openTabsHistory];
|
|
1912
1951
|
return tabs[tabs.length - 1];
|
|
1913
1952
|
}
|
|
1914
1953
|
getTab(id) {
|
|
@@ -1920,7 +1959,7 @@ class TabsController {
|
|
|
1920
1959
|
/**
|
|
1921
1960
|
* Obviamente agrega un tab al listado de tabs
|
|
1922
1961
|
*/
|
|
1923
|
-
append(tab) {
|
|
1962
|
+
append(tab, closeOthers) {
|
|
1924
1963
|
if (this.getTab(tab.id)) {
|
|
1925
1964
|
void ApiaUtil.instance.dialogs.confirm({
|
|
1926
1965
|
children: getLabel("msgTabIsOpen").text,
|
|
@@ -1931,10 +1970,10 @@ class TabsController {
|
|
|
1931
1970
|
...tab,
|
|
1932
1971
|
id: `${tab.id}_${uniqueId$2()}`,
|
|
1933
1972
|
additionalProps: tab.additionalProps ?? {}
|
|
1934
|
-
});
|
|
1973
|
+
}, closeOthers);
|
|
1935
1974
|
});
|
|
1936
1975
|
} else
|
|
1937
|
-
__privateMethod$2(this, _innerAppend, innerAppend_fn).call(this, tab);
|
|
1976
|
+
__privateMethod$2(this, _innerAppend, innerAppend_fn).call(this, tab, closeOthers);
|
|
1938
1977
|
}
|
|
1939
1978
|
async closeAll(closeFixedTabsAsWell = false, force = false) {
|
|
1940
1979
|
for (const tab of this.tabsList) {
|
|
@@ -1991,13 +2030,27 @@ class TabsController {
|
|
|
1991
2030
|
return false;
|
|
1992
2031
|
}
|
|
1993
2032
|
}
|
|
1994
|
-
this.state.
|
|
1995
|
-
this.getActiveTab()
|
|
2033
|
+
this.state.openTabsHistory.delete(tab);
|
|
2034
|
+
this.getActiveTab()?.open();
|
|
1996
2035
|
this.state.tabs.delete(tab.id);
|
|
1997
2036
|
this.props?.onCloseTab?.(tab);
|
|
1998
2037
|
}
|
|
1999
2038
|
return true;
|
|
2000
2039
|
}
|
|
2040
|
+
checkAtLeastOneOpen() {
|
|
2041
|
+
if (this.state.showAtLeastOneTab && !this.tabsList.find((c) => c.state.isOpen)) {
|
|
2042
|
+
this.openTab(this.tabsList[0].id);
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
async toggleTab(tabId, isShown) {
|
|
2046
|
+
const willBeOpen = isShown || !this.getTab(tabId)?.state.isOpen;
|
|
2047
|
+
if (willBeOpen) {
|
|
2048
|
+
this.openTab(tabId, false);
|
|
2049
|
+
} else {
|
|
2050
|
+
if (!this.state.showAtLeastOneTab || this.tabsList.find((c) => c.state.isOpen && c.id !== tabId))
|
|
2051
|
+
this.getTab(tabId).state.isOpen = false;
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2001
2054
|
focusNextTab() {
|
|
2002
2055
|
const tabsList = this.tabsList;
|
|
2003
2056
|
const focusedIndex = tabsList.findIndex(
|
|
@@ -2020,8 +2073,8 @@ class TabsController {
|
|
|
2020
2073
|
this.focusTab(tabsList[newFocusIndex].id);
|
|
2021
2074
|
return tabsList[newFocusIndex];
|
|
2022
2075
|
}
|
|
2023
|
-
focusTab(tabId) {
|
|
2024
|
-
this.openTab(tabId);
|
|
2076
|
+
focusTab(tabId, closeOthers) {
|
|
2077
|
+
this.openTab(tabId, closeOthers);
|
|
2025
2078
|
}
|
|
2026
2079
|
getTabElement(tabId) {
|
|
2027
2080
|
return document.querySelector(`#tabpanel-${this.id}-${tabId}`);
|
|
@@ -2105,39 +2158,64 @@ class TabsController {
|
|
|
2105
2158
|
/**
|
|
2106
2159
|
* Se utiliza para hacer que el tab aparezca visible en el listado
|
|
2107
2160
|
*/
|
|
2108
|
-
openTab(tabId) {
|
|
2161
|
+
openTab(tabId, closeOthers) {
|
|
2109
2162
|
const tab = this.getTab(tabId);
|
|
2110
2163
|
if (!tab) {
|
|
2111
2164
|
console.warn(`There is no tab with such id: ${tabId}`);
|
|
2112
2165
|
} else {
|
|
2113
2166
|
try {
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2167
|
+
if (closeOthers !== false) {
|
|
2168
|
+
this.state.tabs.forEach((c) => {
|
|
2169
|
+
c.state.isOpen = false;
|
|
2170
|
+
});
|
|
2171
|
+
}
|
|
2117
2172
|
} catch (e) {
|
|
2118
2173
|
}
|
|
2119
2174
|
tab.state.isOpen = true;
|
|
2175
|
+
tab.state.isFocused = true;
|
|
2176
|
+
document.querySelector(`.tabs__item__wrapper[data-id="${tab.id}"]`)?.focus();
|
|
2120
2177
|
tab.state.onFocus?.(tab);
|
|
2121
|
-
if (this.state.
|
|
2122
|
-
this.state.
|
|
2178
|
+
if (this.state.openTabsHistory.has(tab)) {
|
|
2179
|
+
this.state.openTabsHistory.delete(tab);
|
|
2123
2180
|
}
|
|
2124
|
-
this.state.
|
|
2181
|
+
this.state.openTabsHistory.add(tab);
|
|
2182
|
+
this.checkAtLeastOneOpen();
|
|
2125
2183
|
}
|
|
2126
2184
|
}
|
|
2127
2185
|
}
|
|
2128
2186
|
_innerAppend = new WeakSet();
|
|
2129
|
-
innerAppend_fn = function(tab) {
|
|
2187
|
+
innerAppend_fn = function(tab, closeOthers = false) {
|
|
2130
2188
|
this.state.tabs.set(tab.id, new Tab(tab, this));
|
|
2131
2189
|
if (tab.isOpen) {
|
|
2132
|
-
this.openTab(tab.id);
|
|
2133
|
-
this.focusTab(tab.id);
|
|
2190
|
+
this.openTab(tab.id, closeOthers);
|
|
2191
|
+
this.focusTab(tab.id, closeOthers);
|
|
2134
2192
|
}
|
|
2193
|
+
this.checkAtLeastOneOpen();
|
|
2135
2194
|
};
|
|
2136
2195
|
|
|
2137
2196
|
const InnerRenderer = observer(({ tab }) => {
|
|
2138
2197
|
const state = tab.state;
|
|
2139
2198
|
const Render = useDeferredValue(state.content);
|
|
2140
|
-
|
|
2199
|
+
let accordion = null;
|
|
2200
|
+
const tabContent = /* @__PURE__ */ jsxs(Box, { className: "tabs__Item", sx: { height: "100%" }, children: [
|
|
2201
|
+
/* @__PURE__ */ jsx(Render, { tab }),
|
|
2202
|
+
state.isLoading && /* @__PURE__ */ jsx(Box, { className: "tabs__content__spinner__wrapper", children: /* @__PURE__ */ jsx(LoaderSpinner, {}) })
|
|
2203
|
+
] });
|
|
2204
|
+
if (tab.state.asAccordion)
|
|
2205
|
+
accordion = /* @__PURE__ */ jsx(
|
|
2206
|
+
AccordionItem,
|
|
2207
|
+
{
|
|
2208
|
+
id: tab.id,
|
|
2209
|
+
defaultExpanded: true,
|
|
2210
|
+
buttonProps: {
|
|
2211
|
+
ariaLabel: tab.state.label,
|
|
2212
|
+
label: tab.state.label
|
|
2213
|
+
},
|
|
2214
|
+
children: tabContent
|
|
2215
|
+
},
|
|
2216
|
+
tab.id
|
|
2217
|
+
);
|
|
2218
|
+
return /* @__PURE__ */ jsx(
|
|
2141
2219
|
Box,
|
|
2142
2220
|
{
|
|
2143
2221
|
"aria-hidden": !state.isOpen,
|
|
@@ -2146,10 +2224,10 @@ const InnerRenderer = observer(({ tab }) => {
|
|
|
2146
2224
|
"data-id": state.id,
|
|
2147
2225
|
id: `tabpanel-${tab.controller.id}-${state.id}`,
|
|
2148
2226
|
role: "tabpanel",
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2227
|
+
sx: {
|
|
2228
|
+
display: state.isOpen ? void 0 : "none"
|
|
2229
|
+
},
|
|
2230
|
+
children: accordion ?? tabContent
|
|
2153
2231
|
},
|
|
2154
2232
|
state.id
|
|
2155
2233
|
);
|
|
@@ -2159,7 +2237,7 @@ const TabsContent = observer((props) => {
|
|
|
2159
2237
|
if (!controller)
|
|
2160
2238
|
return null;
|
|
2161
2239
|
return /* @__PURE__ */ jsx(
|
|
2162
|
-
|
|
2240
|
+
Accordion,
|
|
2163
2241
|
{
|
|
2164
2242
|
className: "tabs__content__wrapper",
|
|
2165
2243
|
...getVariant("layout.common.tabs.primary.content"),
|
|
@@ -2176,13 +2254,15 @@ const NonForwardedTabs = ({
|
|
|
2176
2254
|
getController,
|
|
2177
2255
|
initialTabs,
|
|
2178
2256
|
orientation,
|
|
2257
|
+
initialState,
|
|
2179
2258
|
...props
|
|
2180
2259
|
}, ref) => {
|
|
2181
2260
|
const [handler, setHandler] = React__default.useState(null);
|
|
2182
2261
|
useMount(() => {
|
|
2183
2262
|
const newHandler = new TabsController(String(id), {
|
|
2184
2263
|
initialTabs,
|
|
2185
|
-
orientation: orientation || "horizontal"
|
|
2264
|
+
orientation: orientation || "horizontal",
|
|
2265
|
+
initialState
|
|
2186
2266
|
});
|
|
2187
2267
|
setHandler(newHandler);
|
|
2188
2268
|
getController?.(newHandler);
|
|
@@ -2536,54 +2616,54 @@ const AlertModal = ({ children, onClose, title }) => {
|
|
|
2536
2616
|
);
|
|
2537
2617
|
};
|
|
2538
2618
|
|
|
2539
|
-
var __defProp$
|
|
2540
|
-
var __defNormalProp$
|
|
2541
|
-
var __publicField$
|
|
2542
|
-
__defNormalProp$
|
|
2619
|
+
var __defProp$j = Object.defineProperty;
|
|
2620
|
+
var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2621
|
+
var __publicField$j = (obj, key, value) => {
|
|
2622
|
+
__defNormalProp$j(obj, key + "" , value);
|
|
2543
2623
|
return value;
|
|
2544
2624
|
};
|
|
2545
|
-
var __accessCheck$
|
|
2625
|
+
var __accessCheck$a = (obj, member, msg) => {
|
|
2546
2626
|
if (!member.has(obj))
|
|
2547
2627
|
throw TypeError("Cannot " + msg);
|
|
2548
2628
|
};
|
|
2549
|
-
var __privateGet$
|
|
2550
|
-
__accessCheck$
|
|
2629
|
+
var __privateGet$8 = (obj, member, getter) => {
|
|
2630
|
+
__accessCheck$a(obj, member, "read from private field");
|
|
2551
2631
|
return getter ? getter.call(obj) : member.get(obj);
|
|
2552
2632
|
};
|
|
2553
|
-
var __privateAdd$
|
|
2633
|
+
var __privateAdd$a = (obj, member, value) => {
|
|
2554
2634
|
if (member.has(obj))
|
|
2555
2635
|
throw TypeError("Cannot add the same private member more than once");
|
|
2556
2636
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
2557
2637
|
};
|
|
2558
2638
|
var __privateSet$6 = (obj, member, value, setter) => {
|
|
2559
|
-
__accessCheck$
|
|
2560
|
-
|
|
2639
|
+
__accessCheck$a(obj, member, "write to private field");
|
|
2640
|
+
member.set(obj, value);
|
|
2561
2641
|
return value;
|
|
2562
2642
|
};
|
|
2563
2643
|
var __privateWrapper$1 = (obj, member, setter, getter) => ({
|
|
2564
2644
|
set _(value) {
|
|
2565
|
-
__privateSet$6(obj, member, value
|
|
2645
|
+
__privateSet$6(obj, member, value);
|
|
2566
2646
|
},
|
|
2567
2647
|
get _() {
|
|
2568
|
-
return __privateGet$
|
|
2648
|
+
return __privateGet$8(obj, member, getter);
|
|
2569
2649
|
}
|
|
2570
2650
|
});
|
|
2571
2651
|
var _emitter$3, _maxIdAlert, _maxIdConfirm;
|
|
2572
2652
|
class ApiaUtilDialogs {
|
|
2573
2653
|
constructor() {
|
|
2574
|
-
__privateAdd$
|
|
2575
|
-
__privateAdd$
|
|
2576
|
-
__privateAdd$
|
|
2577
|
-
__publicField$
|
|
2654
|
+
__privateAdd$a(this, _emitter$3, new EventEmitter());
|
|
2655
|
+
__privateAdd$a(this, _maxIdAlert, 0);
|
|
2656
|
+
__privateAdd$a(this, _maxIdConfirm, 0);
|
|
2657
|
+
__publicField$j(this, "Component", () => {
|
|
2578
2658
|
const [confirmDialogs, setConfirmDialogs] = useState([]);
|
|
2579
2659
|
const [alertsDialogs, setAlertsDialogs] = useState(
|
|
2580
2660
|
[]
|
|
2581
2661
|
);
|
|
2582
2662
|
useMount(() => {
|
|
2583
|
-
const unsuscribe1 = __privateGet$
|
|
2663
|
+
const unsuscribe1 = __privateGet$8(this, _emitter$3).on("alert", (ev) => {
|
|
2584
2664
|
setAlertsDialogs((current) => [...current, ev]);
|
|
2585
2665
|
});
|
|
2586
|
-
const unsuscribe2 = __privateGet$
|
|
2666
|
+
const unsuscribe2 = __privateGet$8(this, _emitter$3).on("confirm", (ev) => {
|
|
2587
2667
|
setConfirmDialogs((current) => [...current, ev]);
|
|
2588
2668
|
});
|
|
2589
2669
|
return () => {
|
|
@@ -2621,7 +2701,7 @@ class ApiaUtilDialogs {
|
|
|
2621
2701
|
}
|
|
2622
2702
|
alert(props) {
|
|
2623
2703
|
return new Promise((resolve) => {
|
|
2624
|
-
__privateGet$
|
|
2704
|
+
__privateGet$8(this, _emitter$3).emit("alert", {
|
|
2625
2705
|
...props,
|
|
2626
2706
|
onClose: () => resolve(),
|
|
2627
2707
|
id: `confirm${__privateWrapper$1(this, _maxIdAlert)._++}`
|
|
@@ -2630,7 +2710,7 @@ class ApiaUtilDialogs {
|
|
|
2630
2710
|
}
|
|
2631
2711
|
confirm(props) {
|
|
2632
2712
|
return new Promise((resolve) => {
|
|
2633
|
-
__privateGet$
|
|
2713
|
+
__privateGet$8(this, _emitter$3).emit("confirm", {
|
|
2634
2714
|
...props,
|
|
2635
2715
|
id: `confirm${__privateWrapper$1(this, _maxIdConfirm)._++}`,
|
|
2636
2716
|
onCancel: () => resolve(false),
|
|
@@ -2694,31 +2774,31 @@ function parseStringToApiaNumber(value) {
|
|
|
2694
2774
|
)}${decimalsString.length > 0 ? `${decimalSeparator$1}${decimalsString}` : ""}`;
|
|
2695
2775
|
}
|
|
2696
2776
|
|
|
2697
|
-
var __accessCheck$
|
|
2777
|
+
var __accessCheck$9 = (obj, member, msg) => {
|
|
2698
2778
|
if (!member.has(obj))
|
|
2699
2779
|
throw TypeError("Cannot " + msg);
|
|
2700
2780
|
};
|
|
2701
|
-
var __privateAdd$
|
|
2781
|
+
var __privateAdd$9 = (obj, member, value) => {
|
|
2702
2782
|
if (member.has(obj))
|
|
2703
2783
|
throw TypeError("Cannot add the same private member more than once");
|
|
2704
2784
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
2705
2785
|
};
|
|
2706
2786
|
var __privateMethod$1 = (obj, member, method) => {
|
|
2707
|
-
__accessCheck$
|
|
2787
|
+
__accessCheck$9(obj, member, "access private method");
|
|
2708
2788
|
return method;
|
|
2709
2789
|
};
|
|
2710
2790
|
var _parseString, parseString_fn, _findDelimiter, findDelimiter_fn, _parseCellValue, parseCellValue_fn;
|
|
2711
2791
|
const delimiters = [",", ";", " ", "|"];
|
|
2712
2792
|
class ApiaUtilParsers {
|
|
2713
2793
|
constructor() {
|
|
2714
|
-
__privateAdd$
|
|
2794
|
+
__privateAdd$9(this, _parseString);
|
|
2715
2795
|
/**
|
|
2716
2796
|
* Inspecciona las primeras filas de un array de strings, en búsqueda del mejor delimitador
|
|
2717
2797
|
* para convertir esos strings a array de datos, que serán el resultado de haber interpretado
|
|
2718
2798
|
* un documento CSV.
|
|
2719
2799
|
*/
|
|
2720
|
-
__privateAdd$
|
|
2721
|
-
__privateAdd$
|
|
2800
|
+
__privateAdd$9(this, _findDelimiter);
|
|
2801
|
+
__privateAdd$9(this, _parseCellValue);
|
|
2722
2802
|
}
|
|
2723
2803
|
/**
|
|
2724
2804
|
* Toma un número sin separadores de miles y lo devuelve en el formato
|
|
@@ -2856,10 +2936,10 @@ parseCellValue_fn = function(cellValue) {
|
|
|
2856
2936
|
return cellValue.match(/^\s*"?([^"]+)"?[\s\r\n]*$/)?.[1] ?? cellValue;
|
|
2857
2937
|
};
|
|
2858
2938
|
|
|
2859
|
-
var __defProp$
|
|
2860
|
-
var __defNormalProp$
|
|
2861
|
-
var __publicField$
|
|
2862
|
-
__defNormalProp$
|
|
2939
|
+
var __defProp$i = Object.defineProperty;
|
|
2940
|
+
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2941
|
+
var __publicField$i = (obj, key, value) => {
|
|
2942
|
+
__defNormalProp$i(obj, key + "" , value);
|
|
2863
2943
|
return value;
|
|
2864
2944
|
};
|
|
2865
2945
|
let maxId = 0;
|
|
@@ -2867,32 +2947,32 @@ class ApiaUtilTooltip {
|
|
|
2867
2947
|
constructor(props, close) {
|
|
2868
2948
|
this.props = props;
|
|
2869
2949
|
this.close = close;
|
|
2870
|
-
__publicField$
|
|
2950
|
+
__publicField$i(this, "id", `tooltip__${maxId++}`);
|
|
2871
2951
|
}
|
|
2872
2952
|
}
|
|
2873
2953
|
|
|
2874
|
-
var __defProp$
|
|
2875
|
-
var __defNormalProp$
|
|
2876
|
-
var __publicField$
|
|
2877
|
-
__defNormalProp$
|
|
2954
|
+
var __defProp$h = Object.defineProperty;
|
|
2955
|
+
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2956
|
+
var __publicField$h = (obj, key, value) => {
|
|
2957
|
+
__defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2878
2958
|
return value;
|
|
2879
2959
|
};
|
|
2880
|
-
var __accessCheck$
|
|
2960
|
+
var __accessCheck$8 = (obj, member, msg) => {
|
|
2881
2961
|
if (!member.has(obj))
|
|
2882
2962
|
throw TypeError("Cannot " + msg);
|
|
2883
2963
|
};
|
|
2884
|
-
var __privateGet$
|
|
2885
|
-
__accessCheck$
|
|
2964
|
+
var __privateGet$7 = (obj, member, getter) => {
|
|
2965
|
+
__accessCheck$8(obj, member, "read from private field");
|
|
2886
2966
|
return getter ? getter.call(obj) : member.get(obj);
|
|
2887
2967
|
};
|
|
2888
|
-
var __privateAdd$
|
|
2968
|
+
var __privateAdd$8 = (obj, member, value) => {
|
|
2889
2969
|
if (member.has(obj))
|
|
2890
2970
|
throw TypeError("Cannot add the same private member more than once");
|
|
2891
2971
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
2892
2972
|
};
|
|
2893
2973
|
var __privateSet$5 = (obj, member, value, setter) => {
|
|
2894
|
-
__accessCheck$
|
|
2895
|
-
|
|
2974
|
+
__accessCheck$8(obj, member, "write to private field");
|
|
2975
|
+
member.set(obj, value);
|
|
2896
2976
|
return value;
|
|
2897
2977
|
};
|
|
2898
2978
|
var _timeout, _tooltipTimeout, _unsuscribe, _tooltipController, _tooltip;
|
|
@@ -2904,30 +2984,30 @@ document?.addEventListener("mousemove", (ev) => {
|
|
|
2904
2984
|
class AutomaticTooltip {
|
|
2905
2985
|
constructor(tooltip = null, handler) {
|
|
2906
2986
|
this.handler = handler;
|
|
2907
|
-
__privateAdd$
|
|
2908
|
-
__privateAdd$
|
|
2909
|
-
__privateAdd$
|
|
2910
|
-
__privateAdd$
|
|
2911
|
-
__publicField$
|
|
2987
|
+
__privateAdd$8(this, _timeout, 500);
|
|
2988
|
+
__privateAdd$8(this, _tooltipTimeout, 0);
|
|
2989
|
+
__privateAdd$8(this, _unsuscribe, null);
|
|
2990
|
+
__privateAdd$8(this, _tooltipController, null);
|
|
2991
|
+
__publicField$h(this, "ref", (el) => {
|
|
2912
2992
|
var _a, _b;
|
|
2913
|
-
(_a = __privateGet$
|
|
2993
|
+
(_a = __privateGet$7(this, _unsuscribe)) == null ? void 0 : _a.call(this);
|
|
2914
2994
|
const listener = () => {
|
|
2915
|
-
clearTimeout(__privateGet$
|
|
2995
|
+
clearTimeout(__privateGet$7(this, _tooltipTimeout));
|
|
2916
2996
|
__privateSet$5(this, _tooltipTimeout, setTimeout(() => {
|
|
2917
|
-
if (__privateGet$
|
|
2997
|
+
if (__privateGet$7(this, _tooltip)?.children)
|
|
2918
2998
|
__privateSet$5(this, _tooltipController, this.handler.open({
|
|
2919
2999
|
closeOnMouseLeaveTooltip: true,
|
|
2920
3000
|
closeOnEscape: true,
|
|
2921
3001
|
closeOnScrollOut: true,
|
|
2922
|
-
...__privateGet$
|
|
3002
|
+
...__privateGet$7(this, _tooltip),
|
|
2923
3003
|
anchorPoint: { left: x$1 + 3, top: y$1 + 3 }
|
|
2924
3004
|
}));
|
|
2925
|
-
}, __privateGet$
|
|
3005
|
+
}, __privateGet$7(this, _timeout)));
|
|
2926
3006
|
};
|
|
2927
3007
|
const reset = () => {
|
|
2928
|
-
clearTimeout(__privateGet$
|
|
2929
|
-
if (__privateGet$
|
|
2930
|
-
__privateGet$
|
|
3008
|
+
clearTimeout(__privateGet$7(this, _tooltipTimeout));
|
|
3009
|
+
if (__privateGet$7(this, _tooltip)?.closeOnMouseLeaveAttachedElement) {
|
|
3010
|
+
__privateGet$7(this, _tooltipController)?.close();
|
|
2931
3011
|
}
|
|
2932
3012
|
};
|
|
2933
3013
|
if (el) {
|
|
@@ -2938,12 +3018,12 @@ class AutomaticTooltip {
|
|
|
2938
3018
|
el.removeEventListener("mouseleave", reset);
|
|
2939
3019
|
});
|
|
2940
3020
|
} else {
|
|
2941
|
-
(_b = __privateGet$
|
|
3021
|
+
(_b = __privateGet$7(this, _unsuscribe)) == null ? void 0 : _b.call(this);
|
|
2942
3022
|
reset();
|
|
2943
3023
|
}
|
|
2944
3024
|
});
|
|
2945
|
-
__privateAdd$
|
|
2946
|
-
__publicField$
|
|
3025
|
+
__privateAdd$8(this, _tooltip, null);
|
|
3026
|
+
__publicField$h(this, "update", (tooltip) => {
|
|
2947
3027
|
__privateSet$5(this, _tooltip, tooltip);
|
|
2948
3028
|
});
|
|
2949
3029
|
__privateSet$5(this, _tooltip, tooltip);
|
|
@@ -3053,19 +3133,23 @@ function calculateTooltipPosition({
|
|
|
3053
3133
|
const availableTopSpace = actualAnchorPoint.top;
|
|
3054
3134
|
const availableLeftSpace = actualAnchorPoint.left;
|
|
3055
3135
|
const availableRightSpace = window.innerWidth - actualAnchorPoint.left;
|
|
3056
|
-
const isEnoughToRight = (minSize?.width ?? 0) <= availableRightSpace;
|
|
3057
|
-
const isEnoughToLeft = (minSize?.width ?? 0) <= availableLeftSpace;
|
|
3058
|
-
const isEnoughToBottom = (minSize?.height ?? 0) <= availableBottomSpace;
|
|
3059
|
-
const isEnoughToTop = (minSize?.height ?? 0) <= availableTopSpace;
|
|
3136
|
+
const isEnoughToRight = ((preferredSize?.width !== "auto" ? preferredSize?.width : void 0) ?? minSize?.width ?? 0) <= availableRightSpace;
|
|
3137
|
+
const isEnoughToLeft = ((preferredSize?.width !== "auto" ? preferredSize?.width : void 0) ?? minSize?.width ?? 0) <= availableLeftSpace;
|
|
3138
|
+
const isEnoughToBottom = ((preferredSize?.height !== "auto" ? preferredSize?.height : void 0) ?? minSize?.height ?? 0) <= availableBottomSpace;
|
|
3139
|
+
const isEnoughToTop = ((preferredSize?.height !== "auto" ? preferredSize?.height : void 0) ?? minSize?.height ?? 0) <= availableTopSpace;
|
|
3060
3140
|
const preferredWidth = preferredSize.width === "auto" ? Infinity : preferredSize.width;
|
|
3061
3141
|
const preferredHeight = preferredSize.height === "auto" ? Infinity : preferredSize.height;
|
|
3062
3142
|
const position = {
|
|
3063
3143
|
"& > *": {
|
|
3064
3144
|
width: "100%",
|
|
3065
|
-
height: "100%"
|
|
3145
|
+
height: "100%",
|
|
3146
|
+
overflow: "auto"
|
|
3066
3147
|
},
|
|
3067
|
-
|
|
3068
|
-
|
|
3148
|
+
display: "flex",
|
|
3149
|
+
flexDirection: "column",
|
|
3150
|
+
overflow: "hidden",
|
|
3151
|
+
width: preferredSize.width === "auto" ? "auto" : void 0,
|
|
3152
|
+
height: preferredSize.height === "auto" ? "auto" : void 0
|
|
3069
3153
|
};
|
|
3070
3154
|
if (preferredOrientationX === "left") {
|
|
3071
3155
|
if (isEnoughToLeft) {
|
|
@@ -3291,21 +3375,21 @@ const Tooltip = ({
|
|
|
3291
3375
|
);
|
|
3292
3376
|
};
|
|
3293
3377
|
|
|
3294
|
-
var __defProp$
|
|
3295
|
-
var __defNormalProp$
|
|
3296
|
-
var __publicField$
|
|
3297
|
-
__defNormalProp$
|
|
3378
|
+
var __defProp$g = Object.defineProperty;
|
|
3379
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3380
|
+
var __publicField$g = (obj, key, value) => {
|
|
3381
|
+
__defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3298
3382
|
return value;
|
|
3299
3383
|
};
|
|
3300
|
-
var __accessCheck$
|
|
3384
|
+
var __accessCheck$7 = (obj, member, msg) => {
|
|
3301
3385
|
if (!member.has(obj))
|
|
3302
3386
|
throw TypeError("Cannot " + msg);
|
|
3303
3387
|
};
|
|
3304
|
-
var __privateGet$
|
|
3305
|
-
__accessCheck$
|
|
3388
|
+
var __privateGet$6 = (obj, member, getter) => {
|
|
3389
|
+
__accessCheck$7(obj, member, "read from private field");
|
|
3306
3390
|
return getter ? getter.call(obj) : member.get(obj);
|
|
3307
3391
|
};
|
|
3308
|
-
var __privateAdd$
|
|
3392
|
+
var __privateAdd$7 = (obj, member, value) => {
|
|
3309
3393
|
if (member.has(obj))
|
|
3310
3394
|
throw TypeError("Cannot add the same private member more than once");
|
|
3311
3395
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
@@ -3313,16 +3397,16 @@ var __privateAdd$6 = (obj, member, value) => {
|
|
|
3313
3397
|
var _emitter$2, _shoutChangedList;
|
|
3314
3398
|
class ApiaUtilTooltips {
|
|
3315
3399
|
constructor() {
|
|
3316
|
-
__privateAdd$
|
|
3317
|
-
__publicField$
|
|
3318
|
-
__privateAdd$
|
|
3319
|
-
__privateGet$
|
|
3400
|
+
__privateAdd$7(this, _emitter$2, new EventEmitter());
|
|
3401
|
+
__publicField$g(this, "tooltips", []);
|
|
3402
|
+
__privateAdd$7(this, _shoutChangedList, () => {
|
|
3403
|
+
__privateGet$6(this, _emitter$2).emit("changedList", [...this.tooltips]);
|
|
3320
3404
|
});
|
|
3321
3405
|
/**
|
|
3322
3406
|
* Permite crear un tooltip que se abrirá automáticamente al estar parado
|
|
3323
3407
|
* sobre un elemento durante 300ms
|
|
3324
3408
|
*/
|
|
3325
|
-
__publicField$
|
|
3409
|
+
__publicField$g(this, "useHover", (tooltip) => {
|
|
3326
3410
|
let tt = void 0;
|
|
3327
3411
|
tt = useMemo(() => {
|
|
3328
3412
|
tt?.ref(null);
|
|
@@ -3333,15 +3417,15 @@ class ApiaUtilTooltips {
|
|
|
3333
3417
|
});
|
|
3334
3418
|
return tt;
|
|
3335
3419
|
});
|
|
3336
|
-
__publicField$
|
|
3420
|
+
__publicField$g(this, "close", (id) => {
|
|
3337
3421
|
this.tooltips = this.tooltips.filter((current) => current.id !== id);
|
|
3338
|
-
__privateGet$
|
|
3422
|
+
__privateGet$6(this, _shoutChangedList).call(this);
|
|
3339
3423
|
});
|
|
3340
|
-
__publicField$
|
|
3424
|
+
__publicField$g(this, "closeAll", () => {
|
|
3341
3425
|
this.tooltips = [];
|
|
3342
|
-
__privateGet$
|
|
3426
|
+
__privateGet$6(this, _shoutChangedList).call(this);
|
|
3343
3427
|
});
|
|
3344
|
-
__publicField$
|
|
3428
|
+
__publicField$g(this, "open", (tooltip) => {
|
|
3345
3429
|
const controller = new ApiaUtilTooltip(tooltip, () => {
|
|
3346
3430
|
this.close(controller.id);
|
|
3347
3431
|
controller.props.onClose?.();
|
|
@@ -3351,13 +3435,13 @@ class ApiaUtilTooltips {
|
|
|
3351
3435
|
} else {
|
|
3352
3436
|
this.tooltips = [...this.tooltips, controller];
|
|
3353
3437
|
}
|
|
3354
|
-
__privateGet$
|
|
3438
|
+
__privateGet$6(this, _shoutChangedList).call(this);
|
|
3355
3439
|
return controller;
|
|
3356
3440
|
});
|
|
3357
|
-
__publicField$
|
|
3441
|
+
__publicField$g(this, "Component", () => {
|
|
3358
3442
|
const [tooltips, setTooltips] = useState(this.tooltips);
|
|
3359
3443
|
useMount(() => {
|
|
3360
|
-
const unsuscribeToList = __privateGet$
|
|
3444
|
+
const unsuscribeToList = __privateGet$6(this, _emitter$2).on("changedList", (ev) => {
|
|
3361
3445
|
setTooltips(ev);
|
|
3362
3446
|
});
|
|
3363
3447
|
return () => {
|
|
@@ -3382,7 +3466,7 @@ class ApiaUtilTooltips {
|
|
|
3382
3466
|
this.tooltips = this.tooltips.filter(
|
|
3383
3467
|
(current) => current.props.closeOnEscape === false
|
|
3384
3468
|
);
|
|
3385
|
-
__privateGet$
|
|
3469
|
+
__privateGet$6(this, _shoutChangedList).call(this);
|
|
3386
3470
|
}
|
|
3387
3471
|
});
|
|
3388
3472
|
}
|
|
@@ -3390,36 +3474,36 @@ class ApiaUtilTooltips {
|
|
|
3390
3474
|
_emitter$2 = new WeakMap();
|
|
3391
3475
|
_shoutChangedList = new WeakMap();
|
|
3392
3476
|
|
|
3393
|
-
var __defProp$
|
|
3394
|
-
var __defNormalProp$
|
|
3395
|
-
var __publicField$
|
|
3396
|
-
__defNormalProp$
|
|
3477
|
+
var __defProp$f = Object.defineProperty;
|
|
3478
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3479
|
+
var __publicField$f = (obj, key, value) => {
|
|
3480
|
+
__defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3397
3481
|
return value;
|
|
3398
3482
|
};
|
|
3399
|
-
var __accessCheck$
|
|
3483
|
+
var __accessCheck$6 = (obj, member, msg) => {
|
|
3400
3484
|
if (!member.has(obj))
|
|
3401
3485
|
throw TypeError("Cannot " + msg);
|
|
3402
3486
|
};
|
|
3403
|
-
var __privateGet$
|
|
3404
|
-
__accessCheck$
|
|
3487
|
+
var __privateGet$5 = (obj, member, getter) => {
|
|
3488
|
+
__accessCheck$6(obj, member, "read from private field");
|
|
3405
3489
|
return getter ? getter.call(obj) : member.get(obj);
|
|
3406
3490
|
};
|
|
3407
|
-
var __privateAdd$
|
|
3491
|
+
var __privateAdd$6 = (obj, member, value) => {
|
|
3408
3492
|
if (member.has(obj))
|
|
3409
3493
|
throw TypeError("Cannot add the same private member more than once");
|
|
3410
3494
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
3411
3495
|
};
|
|
3412
3496
|
var __privateSet$4 = (obj, member, value, setter) => {
|
|
3413
|
-
__accessCheck$
|
|
3414
|
-
|
|
3497
|
+
__accessCheck$6(obj, member, "write to private field");
|
|
3498
|
+
member.set(obj, value);
|
|
3415
3499
|
return value;
|
|
3416
3500
|
};
|
|
3417
3501
|
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
3418
3502
|
set _(value) {
|
|
3419
|
-
__privateSet$4(obj, member, value
|
|
3503
|
+
__privateSet$4(obj, member, value);
|
|
3420
3504
|
},
|
|
3421
3505
|
get _() {
|
|
3422
|
-
return __privateGet$
|
|
3506
|
+
return __privateGet$5(obj, member, getter);
|
|
3423
3507
|
}
|
|
3424
3508
|
});
|
|
3425
3509
|
var _emitter$1, _items$1, _hooks, _maxId, _RenderMenu;
|
|
@@ -3428,14 +3512,14 @@ function isSubmenu(item) {
|
|
|
3428
3512
|
}
|
|
3429
3513
|
class ApiaUtilMenu {
|
|
3430
3514
|
constructor() {
|
|
3431
|
-
__privateAdd$
|
|
3432
|
-
__privateAdd$
|
|
3433
|
-
__publicField$
|
|
3434
|
-
__privateAdd$
|
|
3515
|
+
__privateAdd$6(this, _emitter$1, new EventEmitter());
|
|
3516
|
+
__privateAdd$6(this, _items$1, []);
|
|
3517
|
+
__publicField$f(this, "menuProps", null);
|
|
3518
|
+
__privateAdd$6(this, _hooks, {
|
|
3435
3519
|
useIsOpen: () => {
|
|
3436
3520
|
const [isOpen, setIsOpen] = useState(false);
|
|
3437
3521
|
useMount(() => {
|
|
3438
|
-
return __privateGet$
|
|
3522
|
+
return __privateGet$5(this, _emitter$1).on("toggle", setIsOpen);
|
|
3439
3523
|
});
|
|
3440
3524
|
return [
|
|
3441
3525
|
isOpen,
|
|
@@ -3445,30 +3529,35 @@ class ApiaUtilMenu {
|
|
|
3445
3529
|
];
|
|
3446
3530
|
}
|
|
3447
3531
|
});
|
|
3448
|
-
__publicField$
|
|
3449
|
-
__privateGet$
|
|
3532
|
+
__publicField$f(this, "close", () => {
|
|
3533
|
+
__privateGet$5(this, _emitter$1).emit("toggle", false);
|
|
3450
3534
|
});
|
|
3451
|
-
__publicField$
|
|
3535
|
+
__publicField$f(this, "open", ({
|
|
3452
3536
|
menuProps,
|
|
3453
3537
|
items
|
|
3454
3538
|
}) => {
|
|
3455
3539
|
__privateSet$4(this, _items$1, items);
|
|
3456
3540
|
this.menuProps = menuProps;
|
|
3457
|
-
__privateGet$
|
|
3541
|
+
__privateGet$5(this, _emitter$1).emit("toggle", true);
|
|
3458
3542
|
});
|
|
3459
|
-
__privateAdd$
|
|
3460
|
-
__privateAdd$
|
|
3543
|
+
__privateAdd$6(this, _maxId, 0);
|
|
3544
|
+
__privateAdd$6(this, _RenderMenu, (submenu) => {
|
|
3461
3545
|
return /* @__PURE__ */ jsx(Fragment, { children: submenu.items.map((current, i) => {
|
|
3462
3546
|
if (current === "separator")
|
|
3463
3547
|
return /* @__PURE__ */ jsx(MenuDivider, {}, `separator${i}`);
|
|
3464
3548
|
if (isSubmenu(current)) {
|
|
3465
|
-
return /* @__PURE__ */ jsx(SubMenu, { label: current.label, children: __privateGet$
|
|
3549
|
+
return /* @__PURE__ */ jsx(SubMenu, { label: current.label, children: __privateGet$5(this, _RenderMenu).call(this, current) }, `submenu${__privateWrapper(this, _maxId)._++}`);
|
|
3466
3550
|
}
|
|
3467
|
-
|
|
3551
|
+
const children = current.icon ? /* @__PURE__ */ jsxs(Box, { className: "withIcon", children: [
|
|
3552
|
+
/* @__PURE__ */ jsx(Icon$1, { name: current.icon, title: current.title }),
|
|
3553
|
+
" ",
|
|
3554
|
+
current.children
|
|
3555
|
+
] }) : current.children;
|
|
3556
|
+
return /* @__PURE__ */ createElement(MenuItem, { ...current, key: current.key }, children);
|
|
3468
3557
|
}) });
|
|
3469
3558
|
});
|
|
3470
|
-
__publicField$
|
|
3471
|
-
const [isOpen, close] = __privateGet$
|
|
3559
|
+
__publicField$f(this, "Component", () => {
|
|
3560
|
+
const [isOpen, close] = __privateGet$5(this, _hooks).useIsOpen();
|
|
3472
3561
|
if (!isOpen)
|
|
3473
3562
|
return null;
|
|
3474
3563
|
return /* @__PURE__ */ jsx(FreeFocusInside, { children: /* @__PURE__ */ jsx(
|
|
@@ -3480,7 +3569,7 @@ class ApiaUtilMenu {
|
|
|
3480
3569
|
close();
|
|
3481
3570
|
this.menuProps?.onClose?.(ev);
|
|
3482
3571
|
},
|
|
3483
|
-
children: __privateGet$
|
|
3572
|
+
children: __privateGet$5(this, _RenderMenu).call(this, { label: "", items: __privateGet$5(this, _items$1) })
|
|
3484
3573
|
}
|
|
3485
3574
|
) });
|
|
3486
3575
|
});
|
|
@@ -3492,17 +3581,17 @@ _hooks = new WeakMap();
|
|
|
3492
3581
|
_maxId = new WeakMap();
|
|
3493
3582
|
_RenderMenu = new WeakMap();
|
|
3494
3583
|
|
|
3495
|
-
var __defProp$
|
|
3496
|
-
var __defNormalProp$
|
|
3497
|
-
var __publicField$
|
|
3498
|
-
__defNormalProp$
|
|
3584
|
+
var __defProp$e = Object.defineProperty;
|
|
3585
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3586
|
+
var __publicField$e = (obj, key, value) => {
|
|
3587
|
+
__defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3499
3588
|
return value;
|
|
3500
3589
|
};
|
|
3501
3590
|
class ApiaUtilMouse extends EventEmitter {
|
|
3502
3591
|
constructor() {
|
|
3503
3592
|
super();
|
|
3504
|
-
__publicField$
|
|
3505
|
-
__publicField$
|
|
3593
|
+
__publicField$e(this, "x", 0);
|
|
3594
|
+
__publicField$e(this, "y", 0);
|
|
3506
3595
|
document.addEventListener("mousemove", (ev) => {
|
|
3507
3596
|
this.x = ev.clientX;
|
|
3508
3597
|
this.y = ev.clientY;
|
|
@@ -3514,42 +3603,42 @@ class ApiaUtilMouse extends EventEmitter {
|
|
|
3514
3603
|
}
|
|
3515
3604
|
}
|
|
3516
3605
|
|
|
3517
|
-
var __defProp$
|
|
3518
|
-
var __defNormalProp$
|
|
3519
|
-
var __publicField$
|
|
3520
|
-
__defNormalProp$
|
|
3606
|
+
var __defProp$d = Object.defineProperty;
|
|
3607
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3608
|
+
var __publicField$d = (obj, key, value) => {
|
|
3609
|
+
__defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3521
3610
|
return value;
|
|
3522
3611
|
};
|
|
3523
|
-
var __accessCheck$
|
|
3612
|
+
var __accessCheck$5 = (obj, member, msg) => {
|
|
3524
3613
|
if (!member.has(obj))
|
|
3525
3614
|
throw TypeError("Cannot " + msg);
|
|
3526
3615
|
};
|
|
3527
|
-
var __privateGet$
|
|
3528
|
-
__accessCheck$
|
|
3616
|
+
var __privateGet$4 = (obj, member, getter) => {
|
|
3617
|
+
__accessCheck$5(obj, member, "read from private field");
|
|
3529
3618
|
return getter ? getter.call(obj) : member.get(obj);
|
|
3530
3619
|
};
|
|
3531
|
-
var __privateAdd$
|
|
3620
|
+
var __privateAdd$5 = (obj, member, value) => {
|
|
3532
3621
|
if (member.has(obj))
|
|
3533
3622
|
throw TypeError("Cannot add the same private member more than once");
|
|
3534
3623
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
3535
3624
|
};
|
|
3536
3625
|
var __privateSet$3 = (obj, member, value, setter) => {
|
|
3537
|
-
__accessCheck$
|
|
3538
|
-
|
|
3626
|
+
__accessCheck$5(obj, member, "write to private field");
|
|
3627
|
+
member.set(obj, value);
|
|
3539
3628
|
return value;
|
|
3540
3629
|
};
|
|
3541
3630
|
var _instance;
|
|
3542
3631
|
const _ApiaUtil = class _ApiaUtil {
|
|
3543
3632
|
constructor() {
|
|
3544
|
-
__publicField$
|
|
3545
|
-
__publicField$
|
|
3546
|
-
__publicField$
|
|
3547
|
-
__publicField$
|
|
3548
|
-
__publicField$
|
|
3549
|
-
__publicField$
|
|
3550
|
-
__publicField$
|
|
3551
|
-
__publicField$
|
|
3552
|
-
__publicField$
|
|
3633
|
+
__publicField$d(this, "dialogs");
|
|
3634
|
+
__publicField$d(this, "menu");
|
|
3635
|
+
__publicField$d(this, "modals");
|
|
3636
|
+
__publicField$d(this, "mouse");
|
|
3637
|
+
__publicField$d(this, "notifications");
|
|
3638
|
+
__publicField$d(this, "parsers");
|
|
3639
|
+
__publicField$d(this, "tabs");
|
|
3640
|
+
__publicField$d(this, "tooltips");
|
|
3641
|
+
__publicField$d(this, "Component", () => {
|
|
3553
3642
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3554
3643
|
/* @__PURE__ */ jsx(this.dialogs.Component, {}),
|
|
3555
3644
|
/* @__PURE__ */ jsx(this.modals.Component, {}),
|
|
@@ -3568,32 +3657,32 @@ const _ApiaUtil = class _ApiaUtil {
|
|
|
3568
3657
|
this.tooltips = new ApiaUtilTooltips();
|
|
3569
3658
|
}
|
|
3570
3659
|
static get instance() {
|
|
3571
|
-
if (!__privateGet$
|
|
3660
|
+
if (!__privateGet$4(this, _instance)) {
|
|
3572
3661
|
__privateSet$3(this, _instance, new _ApiaUtil());
|
|
3573
3662
|
}
|
|
3574
|
-
return __privateGet$
|
|
3663
|
+
return __privateGet$4(this, _instance);
|
|
3575
3664
|
}
|
|
3576
3665
|
};
|
|
3577
3666
|
_instance = new WeakMap();
|
|
3578
|
-
__privateAdd$
|
|
3667
|
+
__privateAdd$5(_ApiaUtil, _instance, void 0);
|
|
3579
3668
|
let ApiaUtil = _ApiaUtil;
|
|
3580
3669
|
|
|
3581
|
-
var __defProp$
|
|
3582
|
-
var __defNormalProp$
|
|
3583
|
-
var __publicField$
|
|
3584
|
-
__defNormalProp$
|
|
3670
|
+
var __defProp$c = Object.defineProperty;
|
|
3671
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3672
|
+
var __publicField$c = (obj, key, value) => {
|
|
3673
|
+
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3585
3674
|
return value;
|
|
3586
3675
|
};
|
|
3587
3676
|
class ScreenLocker {
|
|
3588
3677
|
constructor() {
|
|
3589
|
-
__publicField$
|
|
3678
|
+
__publicField$c(this, "emitter", new StatefulEmitter({
|
|
3590
3679
|
locks: {
|
|
3591
3680
|
common: { count: 0 },
|
|
3592
3681
|
linear: { count: 0 },
|
|
3593
3682
|
white: { count: 1 }
|
|
3594
3683
|
}
|
|
3595
3684
|
}));
|
|
3596
|
-
__publicField$
|
|
3685
|
+
__publicField$c(this, "lock", (options) => {
|
|
3597
3686
|
this.emitter.setState("locks", (s) => {
|
|
3598
3687
|
const key = options?.type ?? "common";
|
|
3599
3688
|
return {
|
|
@@ -3609,11 +3698,11 @@ class ScreenLocker {
|
|
|
3609
3698
|
};
|
|
3610
3699
|
});
|
|
3611
3700
|
});
|
|
3612
|
-
__publicField$
|
|
3701
|
+
__publicField$c(this, "hasReleased", false);
|
|
3613
3702
|
/**
|
|
3614
3703
|
* This method will work once, then, the action will be ignored. The ScreenLocker starts always locked on white, when this method is called, all listeners of onRelease will be called and the lock will be released.
|
|
3615
3704
|
*/
|
|
3616
|
-
__publicField$
|
|
3705
|
+
__publicField$c(this, "release", () => {
|
|
3617
3706
|
if (this.hasReleased)
|
|
3618
3707
|
return;
|
|
3619
3708
|
this.hasReleased = true;
|
|
@@ -3629,11 +3718,11 @@ class ScreenLocker {
|
|
|
3629
3718
|
/**
|
|
3630
3719
|
* This method notifies when the screenLock is released by the first time.
|
|
3631
3720
|
*/
|
|
3632
|
-
__publicField$
|
|
3721
|
+
__publicField$c(this, "onRelease", this.emitter.on.bind(this.emitter, "release"));
|
|
3633
3722
|
/**
|
|
3634
3723
|
* This component is the responsible for putting the lock courtain in the browser when it's required. It must be used once per application.
|
|
3635
3724
|
*/
|
|
3636
|
-
__publicField$
|
|
3725
|
+
__publicField$c(this, "Component", () => {
|
|
3637
3726
|
const locks = this.emitter.useState("locks");
|
|
3638
3727
|
const style = {
|
|
3639
3728
|
alignItems: "center",
|
|
@@ -3681,7 +3770,7 @@ const OptionsBox = observer(() => {
|
|
|
3681
3770
|
if (c.filtered) {
|
|
3682
3771
|
return /* @__PURE__ */ jsx(Fragment, {}, c.value);
|
|
3683
3772
|
} else {
|
|
3684
|
-
return /* @__PURE__ */
|
|
3773
|
+
return /* @__PURE__ */ jsxs(
|
|
3685
3774
|
Box,
|
|
3686
3775
|
{
|
|
3687
3776
|
className: `autocomplete__option ${handler.focusedIndex === i ? "focused" : ""}`,
|
|
@@ -3695,7 +3784,10 @@ const OptionsBox = observer(() => {
|
|
|
3695
3784
|
});
|
|
3696
3785
|
},
|
|
3697
3786
|
"data-value": c.value,
|
|
3698
|
-
children:
|
|
3787
|
+
children: [
|
|
3788
|
+
c.label,
|
|
3789
|
+
" \xA0"
|
|
3790
|
+
]
|
|
3699
3791
|
},
|
|
3700
3792
|
c.value
|
|
3701
3793
|
);
|
|
@@ -3703,43 +3795,44 @@ const OptionsBox = observer(() => {
|
|
|
3703
3795
|
}) });
|
|
3704
3796
|
});
|
|
3705
3797
|
|
|
3706
|
-
var __defProp$
|
|
3707
|
-
var __defNormalProp$
|
|
3708
|
-
var __publicField$
|
|
3709
|
-
__defNormalProp$
|
|
3798
|
+
var __defProp$b = Object.defineProperty;
|
|
3799
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3800
|
+
var __publicField$b = (obj, key, value) => {
|
|
3801
|
+
__defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3710
3802
|
return value;
|
|
3711
3803
|
};
|
|
3712
|
-
var __accessCheck$
|
|
3804
|
+
var __accessCheck$4 = (obj, member, msg) => {
|
|
3713
3805
|
if (!member.has(obj))
|
|
3714
3806
|
throw TypeError("Cannot " + msg);
|
|
3715
3807
|
};
|
|
3716
|
-
var __privateGet$
|
|
3717
|
-
__accessCheck$
|
|
3808
|
+
var __privateGet$3 = (obj, member, getter) => {
|
|
3809
|
+
__accessCheck$4(obj, member, "read from private field");
|
|
3718
3810
|
return getter ? getter.call(obj) : member.get(obj);
|
|
3719
3811
|
};
|
|
3720
|
-
var __privateAdd$
|
|
3812
|
+
var __privateAdd$4 = (obj, member, value) => {
|
|
3721
3813
|
if (member.has(obj))
|
|
3722
3814
|
throw TypeError("Cannot add the same private member more than once");
|
|
3723
3815
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
3724
3816
|
};
|
|
3725
3817
|
var __privateSet$2 = (obj, member, value, setter) => {
|
|
3726
|
-
__accessCheck$
|
|
3727
|
-
|
|
3818
|
+
__accessCheck$4(obj, member, "write to private field");
|
|
3819
|
+
member.set(obj, value);
|
|
3728
3820
|
return value;
|
|
3729
3821
|
};
|
|
3730
3822
|
var _actualSearch, _makeSearch, _search;
|
|
3731
3823
|
class AutocompleteController {
|
|
3732
3824
|
constructor(properties) {
|
|
3733
|
-
__publicField$
|
|
3825
|
+
__publicField$b(this, "state", {
|
|
3734
3826
|
disabled: false,
|
|
3735
3827
|
id: uniqueId$3("autocomplete"),
|
|
3736
3828
|
loading: false,
|
|
3737
3829
|
options: [],
|
|
3738
3830
|
searchDebounce: 100,
|
|
3739
3831
|
showValue: "",
|
|
3740
|
-
value: ""
|
|
3832
|
+
value: "",
|
|
3833
|
+
width: 55
|
|
3741
3834
|
});
|
|
3742
|
-
__privateAdd$
|
|
3835
|
+
__privateAdd$4(this, _actualSearch, (str) => {
|
|
3743
3836
|
this.state.options.forEach((c) => {
|
|
3744
3837
|
if (this.state.caseInsensitive) {
|
|
3745
3838
|
c.filtered = (c.searchLabel ?? c.label?.toString?.() ?? c.value).toLowerCase().indexOf(str.toLowerCase()) === -1;
|
|
@@ -3751,14 +3844,16 @@ class AutocompleteController {
|
|
|
3751
3844
|
}
|
|
3752
3845
|
});
|
|
3753
3846
|
});
|
|
3754
|
-
__privateAdd$
|
|
3755
|
-
return debounce(__privateGet$
|
|
3847
|
+
__privateAdd$4(this, _makeSearch, () => {
|
|
3848
|
+
return debounce(__privateGet$3(this, _actualSearch), this.state.searchDebounce);
|
|
3756
3849
|
});
|
|
3757
|
-
__privateAdd$
|
|
3758
|
-
__publicField$
|
|
3850
|
+
__privateAdd$4(this, _search, __privateGet$3(this, _makeSearch).call(this));
|
|
3851
|
+
__publicField$b(this, "tooltipRef", null);
|
|
3759
3852
|
Object.assign(this.state, properties);
|
|
3760
3853
|
if (properties.value) {
|
|
3761
|
-
this.state.showValue =
|
|
3854
|
+
this.state.showValue = String(
|
|
3855
|
+
properties.options?.find((c) => c.value === properties.value)?.label
|
|
3856
|
+
) || properties.value;
|
|
3762
3857
|
this.state.focusedValue = properties.value;
|
|
3763
3858
|
}
|
|
3764
3859
|
makeAutoObservable(this, {
|
|
@@ -3768,7 +3863,7 @@ class AutocompleteController {
|
|
|
3768
3863
|
reaction(
|
|
3769
3864
|
() => this.state.searchDebounce,
|
|
3770
3865
|
() => {
|
|
3771
|
-
__privateSet$2(this, _search, __privateGet$
|
|
3866
|
+
__privateSet$2(this, _search, __privateGet$3(this, _makeSearch).call(this));
|
|
3772
3867
|
}
|
|
3773
3868
|
);
|
|
3774
3869
|
reaction(
|
|
@@ -3798,7 +3893,7 @@ class AutocompleteController {
|
|
|
3798
3893
|
close(selectValue = true) {
|
|
3799
3894
|
this.tooltipRef?.close();
|
|
3800
3895
|
this.tooltipRef = null;
|
|
3801
|
-
__privateGet$
|
|
3896
|
+
__privateGet$3(this, _actualSearch).call(this, "");
|
|
3802
3897
|
if (selectValue) {
|
|
3803
3898
|
let currentValue = this.state.options.find(
|
|
3804
3899
|
(c) => c.value === this.state.focusedValue
|
|
@@ -3901,6 +3996,10 @@ class AutocompleteController {
|
|
|
3901
3996
|
this.tooltipRef = null;
|
|
3902
3997
|
this.close();
|
|
3903
3998
|
},
|
|
3999
|
+
minSize: {
|
|
4000
|
+
height: Math.min(4, this.state.options.length) * 28,
|
|
4001
|
+
width: this.state.width
|
|
4002
|
+
},
|
|
3904
4003
|
preferredOrientationY: "bottom",
|
|
3905
4004
|
preferredOrientationX: "right",
|
|
3906
4005
|
attachToElementAnchorPoint: "bottomLeft",
|
|
@@ -3917,7 +4016,11 @@ class AutocompleteController {
|
|
|
3917
4016
|
}
|
|
3918
4017
|
}
|
|
3919
4018
|
search(str) {
|
|
3920
|
-
|
|
4019
|
+
if (this.state.disabled) {
|
|
4020
|
+
return;
|
|
4021
|
+
}
|
|
4022
|
+
this.state.showValue = str;
|
|
4023
|
+
__privateGet$3(this, _search).call(this, str);
|
|
3921
4024
|
}
|
|
3922
4025
|
selectFocused() {
|
|
3923
4026
|
this.close();
|
|
@@ -3926,12 +4029,21 @@ class AutocompleteController {
|
|
|
3926
4029
|
this.setValue(newValue);
|
|
3927
4030
|
}
|
|
3928
4031
|
}
|
|
3929
|
-
setValue(value) {
|
|
4032
|
+
async setValue(value) {
|
|
4033
|
+
if (this.state.disabled) {
|
|
4034
|
+
return;
|
|
4035
|
+
}
|
|
3930
4036
|
const selectedOption = this.state.options.find((c) => c.value === value);
|
|
3931
|
-
|
|
4037
|
+
const newValue = selectedOption?.value || "";
|
|
4038
|
+
const onChangeResult = this.state.onChange?.(newValue, this);
|
|
4039
|
+
if (onChangeResult instanceof Promise) {
|
|
4040
|
+
if (!await onChangeResult) {
|
|
4041
|
+
return;
|
|
4042
|
+
}
|
|
4043
|
+
}
|
|
4044
|
+
this.state.value = newValue;
|
|
3932
4045
|
this.state.focusedValue = this.state.value;
|
|
3933
4046
|
this.state.showValue = selectedOption?.label?.toString?.() || selectedOption?.value || "";
|
|
3934
|
-
this.state.onChange?.(this.state.value, this);
|
|
3935
4047
|
}
|
|
3936
4048
|
}
|
|
3937
4049
|
_actualSearch = new WeakMap();
|
|
@@ -3941,6 +4053,7 @@ _search = new WeakMap();
|
|
|
3941
4053
|
const SearchBox = observer(() => {
|
|
3942
4054
|
const handler = useAutocompleteContext();
|
|
3943
4055
|
const breakpoint = useBreakpointIndex();
|
|
4056
|
+
const inputRef = useRef(null);
|
|
3944
4057
|
return /* @__PURE__ */ jsxs(Box, { className: "autocomplete__inputWrapper", children: [
|
|
3945
4058
|
/* @__PURE__ */ jsx(
|
|
3946
4059
|
"input",
|
|
@@ -3963,12 +4076,13 @@ const SearchBox = observer(() => {
|
|
|
3963
4076
|
/* @__PURE__ */ jsx(
|
|
3964
4077
|
Input,
|
|
3965
4078
|
{
|
|
4079
|
+
ref: inputRef,
|
|
3966
4080
|
className: `autocomplete__search ${handler.state.disabled ? "disabled" : ""}`,
|
|
3967
4081
|
onChange: (ev) => {
|
|
3968
4082
|
handler.search(ev.target.value);
|
|
3969
|
-
handler.state.showValue = ev.target.value;
|
|
3970
4083
|
},
|
|
3971
4084
|
onMouseDown: () => {
|
|
4085
|
+
handler.state.width = inputRef.current?.getBoundingClientRect().width ?? handler.state.width;
|
|
3972
4086
|
handler.toggleOpen();
|
|
3973
4087
|
},
|
|
3974
4088
|
onFocus: (ev) => {
|
|
@@ -4072,6 +4186,10 @@ const Autocomplete = (props) => {
|
|
|
4072
4186
|
props.getHandler?.(newHandler);
|
|
4073
4187
|
setHandler(newHandler);
|
|
4074
4188
|
});
|
|
4189
|
+
const prevProps = usePrevious(props.properties);
|
|
4190
|
+
if (!shallowEqual$1(prevProps.current, props.properties) && handler?.state) {
|
|
4191
|
+
Object.assign(handler.state, props.properties);
|
|
4192
|
+
}
|
|
4075
4193
|
if (!handler) {
|
|
4076
4194
|
return null;
|
|
4077
4195
|
}
|
|
@@ -4415,36 +4533,36 @@ const Checkbox$1 = forwardRef(
|
|
|
4415
4533
|
);
|
|
4416
4534
|
Checkbox$1.displayName = "Checkbox";
|
|
4417
4535
|
|
|
4418
|
-
var __defProp$
|
|
4419
|
-
var __defNormalProp$
|
|
4420
|
-
var __publicField$
|
|
4421
|
-
__defNormalProp$
|
|
4536
|
+
var __defProp$a = Object.defineProperty;
|
|
4537
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4538
|
+
var __publicField$a = (obj, key, value) => {
|
|
4539
|
+
__defNormalProp$a(obj, key + "" , value);
|
|
4422
4540
|
return value;
|
|
4423
4541
|
};
|
|
4424
|
-
var __accessCheck$
|
|
4542
|
+
var __accessCheck$3 = (obj, member, msg) => {
|
|
4425
4543
|
if (!member.has(obj))
|
|
4426
4544
|
throw TypeError("Cannot " + msg);
|
|
4427
4545
|
};
|
|
4428
|
-
var __privateGet$
|
|
4429
|
-
__accessCheck$
|
|
4546
|
+
var __privateGet$2 = (obj, member, getter) => {
|
|
4547
|
+
__accessCheck$3(obj, member, "read from private field");
|
|
4430
4548
|
return getter ? getter.call(obj) : member.get(obj);
|
|
4431
4549
|
};
|
|
4432
|
-
var __privateAdd$
|
|
4550
|
+
var __privateAdd$3 = (obj, member, value) => {
|
|
4433
4551
|
if (member.has(obj))
|
|
4434
4552
|
throw TypeError("Cannot add the same private member more than once");
|
|
4435
4553
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
4436
4554
|
};
|
|
4437
4555
|
var __privateSet$1 = (obj, member, value, setter) => {
|
|
4438
|
-
__accessCheck$
|
|
4439
|
-
|
|
4556
|
+
__accessCheck$3(obj, member, "write to private field");
|
|
4557
|
+
member.set(obj, value);
|
|
4440
4558
|
return value;
|
|
4441
4559
|
};
|
|
4442
4560
|
var _onFocusCallbacks, _a;
|
|
4443
4561
|
const historySize = 50;
|
|
4444
4562
|
const globalFocus = new (_a = class {
|
|
4445
4563
|
constructor() {
|
|
4446
|
-
__publicField$
|
|
4447
|
-
__privateAdd$
|
|
4564
|
+
__publicField$a(this, "focused", []);
|
|
4565
|
+
__privateAdd$3(this, _onFocusCallbacks, []);
|
|
4448
4566
|
debugDispatcher.on(
|
|
4449
4567
|
"focusHistory",
|
|
4450
4568
|
() => {
|
|
@@ -4454,12 +4572,12 @@ const globalFocus = new (_a = class {
|
|
|
4454
4572
|
);
|
|
4455
4573
|
}
|
|
4456
4574
|
offFocus(cb) {
|
|
4457
|
-
__privateSet$1(this, _onFocusCallbacks, __privateGet$
|
|
4575
|
+
__privateSet$1(this, _onFocusCallbacks, __privateGet$2(this, _onFocusCallbacks).filter((current) => {
|
|
4458
4576
|
return current !== cb;
|
|
4459
4577
|
}));
|
|
4460
4578
|
}
|
|
4461
4579
|
onFocus(cb) {
|
|
4462
|
-
__privateGet$
|
|
4580
|
+
__privateGet$2(this, _onFocusCallbacks).push(cb);
|
|
4463
4581
|
return () => {
|
|
4464
4582
|
this.offFocus(cb);
|
|
4465
4583
|
};
|
|
@@ -4476,7 +4594,7 @@ const globalFocus = new (_a = class {
|
|
|
4476
4594
|
if (this.focused.length > historySize) {
|
|
4477
4595
|
this.focused = this.focused.splice(0, historySize);
|
|
4478
4596
|
}
|
|
4479
|
-
__privateGet$
|
|
4597
|
+
__privateGet$2(this, _onFocusCallbacks).forEach((cb) => {
|
|
4480
4598
|
return cb();
|
|
4481
4599
|
});
|
|
4482
4600
|
}
|
|
@@ -4753,7 +4871,7 @@ const DateInput = React__default.forwardRef(
|
|
|
4753
4871
|
...props,
|
|
4754
4872
|
className: "dateInput",
|
|
4755
4873
|
value: renderLabel ? renderLabel(inputValue) : inputValue,
|
|
4756
|
-
ref,
|
|
4874
|
+
inputRef: ref,
|
|
4757
4875
|
onChange: (ev) => {
|
|
4758
4876
|
setInputValue(ev.target.value);
|
|
4759
4877
|
if (getMaskForDateFormat().replaceAll("9", DEFAULT_MASK_PLACEHOLDER) !== ev.target.value && ev.target.value !== "")
|
|
@@ -4799,7 +4917,9 @@ const DateInput = React__default.forwardRef(
|
|
|
4799
4917
|
`#DateInput${id} input`
|
|
4800
4918
|
)?.focus();
|
|
4801
4919
|
},
|
|
4802
|
-
type: "button"
|
|
4920
|
+
type: "button",
|
|
4921
|
+
title: getLabel("btnAiDelete").text,
|
|
4922
|
+
"aria-label": getLabel("btnAiDelete").text
|
|
4803
4923
|
}
|
|
4804
4924
|
),
|
|
4805
4925
|
[id, onDelete, setCalendarValue]
|
|
@@ -5009,7 +5129,7 @@ const RequiredMark = ({
|
|
|
5009
5129
|
isRequired = false,
|
|
5010
5130
|
isReadonly = false
|
|
5011
5131
|
}) => {
|
|
5012
|
-
return isRequired && !isReadonly && !isFormReadonly ? /* @__PURE__ */ jsx("
|
|
5132
|
+
return isRequired && !isReadonly && !isFormReadonly ? /* @__PURE__ */ jsx("span", { className: "requiredMark", title: getLabel("msgReqField").text, children: "*" }) : null;
|
|
5013
5133
|
};
|
|
5014
5134
|
|
|
5015
5135
|
injectStyles("layout.common.components.fieldLabel", {
|
|
@@ -5122,6 +5242,7 @@ const AutoEllipsis = ({
|
|
|
5122
5242
|
return;
|
|
5123
5243
|
unsuscribe.current();
|
|
5124
5244
|
function showBox() {
|
|
5245
|
+
document.querySelectorAll(".autoellipsis_clone").forEach((c) => c.remove());
|
|
5125
5246
|
clone.current = el.cloneNode(true);
|
|
5126
5247
|
const target = findParent?.(el) ?? el;
|
|
5127
5248
|
const styles = window.getComputedStyle(target);
|
|
@@ -5683,9 +5804,28 @@ const ContainerWithHeader = ({
|
|
|
5683
5804
|
);
|
|
5684
5805
|
};
|
|
5685
5806
|
|
|
5686
|
-
const
|
|
5807
|
+
const collapsiblePanel = {
|
|
5808
|
+
display: "flex",
|
|
5809
|
+
flexDirection: "column",
|
|
5810
|
+
gap: spacing(2),
|
|
5811
|
+
".collapsiblePanel__label": {
|
|
5812
|
+
display: "flex",
|
|
5813
|
+
gap: spacing(2),
|
|
5814
|
+
p: "1px",
|
|
5815
|
+
alignItems: "center",
|
|
5816
|
+
justifyContent: "space-between",
|
|
5817
|
+
".collapsiblePanel__label__button": {
|
|
5818
|
+
display: "flex",
|
|
5819
|
+
gap: spacing(2),
|
|
5820
|
+
p: "1px",
|
|
5821
|
+
alignItems: "center",
|
|
5822
|
+
"&:focus": focusOutline,
|
|
5823
|
+
color: "palette.text.primary"
|
|
5824
|
+
}
|
|
5825
|
+
}
|
|
5826
|
+
};
|
|
5687
5827
|
|
|
5688
|
-
injectStyles("layout.common.components.collapsiblePanel",
|
|
5828
|
+
injectStyles("layout.common.components.collapsiblePanel", collapsiblePanel);
|
|
5689
5829
|
const CollapsiblePanel = React__default.forwardRef(
|
|
5690
5830
|
({
|
|
5691
5831
|
children,
|
|
@@ -5703,7 +5843,8 @@ const CollapsiblePanel = React__default.forwardRef(
|
|
|
5703
5843
|
rememberCollapsedState,
|
|
5704
5844
|
titleButtons,
|
|
5705
5845
|
minHeight = 0,
|
|
5706
|
-
"aria-hidden": ariaHidden
|
|
5846
|
+
"aria-hidden": ariaHidden,
|
|
5847
|
+
collapseIconToRight
|
|
5707
5848
|
}, outerRef) => {
|
|
5708
5849
|
const prefix = React__default.useMemo(() => id ? "" : uniqueId$2(), []);
|
|
5709
5850
|
const actualId = `${prefix}_${id ?? "collapsiblePanel"}`;
|
|
@@ -5777,8 +5918,9 @@ const CollapsiblePanel = React__default.forwardRef(
|
|
|
5777
5918
|
type: "button",
|
|
5778
5919
|
className: "collapsiblePanel__label__button",
|
|
5779
5920
|
children: [
|
|
5780
|
-
isCollapsed ? /* @__PURE__ */ jsx(Icon$1, { title: "", icon: openIcon, size: iconSize }) : /* @__PURE__ */ jsx(Icon$1, { title: "", icon: closedIcon, size: iconSize }),
|
|
5781
|
-
/* @__PURE__ */ jsx("span", { className: "title", children: label })
|
|
5921
|
+
!collapseIconToRight && /* @__PURE__ */ jsx(Fragment, { children: isCollapsed ? /* @__PURE__ */ jsx(Icon$1, { title: "", icon: openIcon, size: iconSize }) : /* @__PURE__ */ jsx(Icon$1, { title: "", icon: closedIcon, size: iconSize }) }),
|
|
5922
|
+
/* @__PURE__ */ jsx("span", { className: "title", children: label }),
|
|
5923
|
+
collapseIconToRight && /* @__PURE__ */ jsx(Fragment, { children: isCollapsed ? /* @__PURE__ */ jsx(Icon$1, { title: "", icon: openIcon, size: iconSize }) : /* @__PURE__ */ jsx(Icon$1, { title: "", icon: closedIcon, size: iconSize }) })
|
|
5782
5924
|
]
|
|
5783
5925
|
}
|
|
5784
5926
|
),
|
|
@@ -5865,35 +6007,35 @@ const ListboxItem = memo(
|
|
|
5865
6007
|
);
|
|
5866
6008
|
ListboxItem.displayName = "ListboxItem";
|
|
5867
6009
|
|
|
5868
|
-
var __defProp$
|
|
5869
|
-
var __defNormalProp$
|
|
5870
|
-
var __publicField$
|
|
5871
|
-
__defNormalProp$
|
|
6010
|
+
var __defProp$9 = Object.defineProperty;
|
|
6011
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6012
|
+
var __publicField$9 = (obj, key, value) => {
|
|
6013
|
+
__defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5872
6014
|
return value;
|
|
5873
6015
|
};
|
|
5874
|
-
var __accessCheck$
|
|
6016
|
+
var __accessCheck$2 = (obj, member, msg) => {
|
|
5875
6017
|
if (!member.has(obj))
|
|
5876
6018
|
throw TypeError("Cannot " + msg);
|
|
5877
6019
|
};
|
|
5878
|
-
var __privateAdd$
|
|
6020
|
+
var __privateAdd$2 = (obj, member, value) => {
|
|
5879
6021
|
if (member.has(obj))
|
|
5880
6022
|
throw TypeError("Cannot add the same private member more than once");
|
|
5881
6023
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
5882
6024
|
};
|
|
5883
6025
|
var __privateMethod = (obj, member, method) => {
|
|
5884
|
-
__accessCheck$
|
|
6026
|
+
__accessCheck$2(obj, member, "access private method");
|
|
5885
6027
|
return method;
|
|
5886
6028
|
};
|
|
5887
6029
|
var _restoreTimeout, restoreTimeout_fn, _shout, shout_fn;
|
|
5888
6030
|
class WaiTypeAhead extends EventEmitter {
|
|
5889
6031
|
constructor(props) {
|
|
5890
6032
|
super();
|
|
5891
|
-
__privateAdd$
|
|
5892
|
-
__privateAdd$
|
|
5893
|
-
__publicField$
|
|
6033
|
+
__privateAdd$2(this, _restoreTimeout);
|
|
6034
|
+
__privateAdd$2(this, _shout);
|
|
6035
|
+
__publicField$9(this, "frequency", 2.5);
|
|
5894
6036
|
// Keys per second
|
|
5895
|
-
__publicField$
|
|
5896
|
-
__publicField$
|
|
6037
|
+
__publicField$9(this, "timeout", 0);
|
|
6038
|
+
__publicField$9(this, "typing", "");
|
|
5897
6039
|
const { onMultipleKeys, onSingleKey, onTypeUpdate } = props ?? {};
|
|
5898
6040
|
if (onMultipleKeys)
|
|
5899
6041
|
this.on("multipleKeys", onMultipleKeys);
|
|
@@ -6704,7 +6846,6 @@ const LinearLoader = () => {
|
|
|
6704
6846
|
}
|
|
6705
6847
|
);
|
|
6706
6848
|
};
|
|
6707
|
-
var LinearLoader$1 = LinearLoader;
|
|
6708
6849
|
|
|
6709
6850
|
const ProgressBar = ({
|
|
6710
6851
|
id,
|
|
@@ -6738,12 +6879,11 @@ const ProgressBar = ({
|
|
|
6738
6879
|
)
|
|
6739
6880
|
] });
|
|
6740
6881
|
};
|
|
6741
|
-
var ProgressBar$1 = ProgressBar;
|
|
6742
6882
|
|
|
6743
6883
|
const styles$1 = {
|
|
6744
6884
|
height: "iconmd",
|
|
6745
6885
|
width: "iconmd",
|
|
6746
|
-
background: "
|
|
6886
|
+
background: "transparent"
|
|
6747
6887
|
};
|
|
6748
6888
|
const LoaderSpinner = makeStyledComponent(
|
|
6749
6889
|
"LoaderSpinner",
|
|
@@ -6759,7 +6899,32 @@ const LoaderSpinner = makeStyledComponent(
|
|
|
6759
6899
|
);
|
|
6760
6900
|
}
|
|
6761
6901
|
);
|
|
6762
|
-
|
|
6902
|
+
|
|
6903
|
+
const shimmer = keyframes`
|
|
6904
|
+
0% {
|
|
6905
|
+
opacity: 0.8;
|
|
6906
|
+
}
|
|
6907
|
+
50% {
|
|
6908
|
+
opacity: 0.4;
|
|
6909
|
+
}
|
|
6910
|
+
100% {
|
|
6911
|
+
opacity: 0.8;
|
|
6912
|
+
}
|
|
6913
|
+
`;
|
|
6914
|
+
const SkeletonItem = () => /* @__PURE__ */ jsx(
|
|
6915
|
+
Box,
|
|
6916
|
+
{
|
|
6917
|
+
sx: {
|
|
6918
|
+
height: 20,
|
|
6919
|
+
bg: "muted",
|
|
6920
|
+
mb: 2,
|
|
6921
|
+
borderRadius: 4,
|
|
6922
|
+
animation: `${shimmer} 1.5s infinite`,
|
|
6923
|
+
background: "palette.gray.800"
|
|
6924
|
+
}
|
|
6925
|
+
}
|
|
6926
|
+
);
|
|
6927
|
+
const ListSkeletonLoader = ({ items = 5 }) => /* @__PURE__ */ jsx(Box, { sx: { display: "flex", flexDirection: "column", gap: 3 }, children: Array.from({ length: items }).map((_, index) => /* @__PURE__ */ jsx(SkeletonItem, {}, index)) });
|
|
6763
6928
|
|
|
6764
6929
|
const distinctors = {
|
|
6765
6930
|
grid: [
|
|
@@ -7407,9 +7572,7 @@ const IconsListNonForwarded = (props, ref) => {
|
|
|
7407
7572
|
"layout.common.components.iconsList",
|
|
7408
7573
|
styles,
|
|
7409
7574
|
styledComponent
|
|
7410
|
-
)
|
|
7411
|
-
debounce: 50
|
|
7412
|
-
});
|
|
7575
|
+
)});
|
|
7413
7576
|
return Component;
|
|
7414
7577
|
}, []);
|
|
7415
7578
|
if (previousProps.current?.iconWidth !== props.iconWidth) {
|
|
@@ -7435,7 +7598,14 @@ function importComponent(path) {
|
|
|
7435
7598
|
/* webpackInclude: /\.tsx?$/ */
|
|
7436
7599
|
`/customComponents/${path}`
|
|
7437
7600
|
).then((result) => {
|
|
7438
|
-
|
|
7601
|
+
if (result?.default?.default)
|
|
7602
|
+
resolve(result.default);
|
|
7603
|
+
else if (result?.default)
|
|
7604
|
+
resolve(result);
|
|
7605
|
+
else
|
|
7606
|
+
resolve({
|
|
7607
|
+
default: () => /* @__PURE__ */ jsx(Fragment, { children: "Something went wrong when importing component" })
|
|
7608
|
+
});
|
|
7439
7609
|
}).catch((error) => {
|
|
7440
7610
|
resolve({
|
|
7441
7611
|
default: () => {
|
|
@@ -7448,18 +7618,18 @@ function importComponent(path) {
|
|
|
7448
7618
|
});
|
|
7449
7619
|
}
|
|
7450
7620
|
|
|
7451
|
-
var __defProp$
|
|
7452
|
-
var __defNormalProp$
|
|
7453
|
-
var __publicField$
|
|
7454
|
-
__defNormalProp$
|
|
7621
|
+
var __defProp$8 = Object.defineProperty;
|
|
7622
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7623
|
+
var __publicField$8 = (obj, key, value) => {
|
|
7624
|
+
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7455
7625
|
return value;
|
|
7456
7626
|
};
|
|
7457
7627
|
class ToolbarController extends EventEmitter {
|
|
7458
7628
|
constructor() {
|
|
7459
7629
|
super(...arguments);
|
|
7460
|
-
__publicField$
|
|
7461
|
-
__publicField$
|
|
7462
|
-
__publicField$
|
|
7630
|
+
__publicField$8(this, "eventListeners", {});
|
|
7631
|
+
__publicField$8(this, "itemsState", {});
|
|
7632
|
+
__publicField$8(this, "hooks", {
|
|
7463
7633
|
useItemState: (id, initialState) => {
|
|
7464
7634
|
const [state, setState] = useState(initialState);
|
|
7465
7635
|
useEffect(() => {
|
|
@@ -7473,11 +7643,11 @@ class ToolbarController extends EventEmitter {
|
|
|
7473
7643
|
return state;
|
|
7474
7644
|
}
|
|
7475
7645
|
});
|
|
7476
|
-
__publicField$
|
|
7646
|
+
__publicField$8(this, "setItemState", (id, newState) => {
|
|
7477
7647
|
this.itemsState[id] = { ...this.itemsState[id], ...newState };
|
|
7478
7648
|
this.emit("updateItemState", id);
|
|
7479
7649
|
});
|
|
7480
|
-
__publicField$
|
|
7650
|
+
__publicField$8(this, "Context", ({ children }) => {
|
|
7481
7651
|
return /* @__PURE__ */ jsx(ToolbarControllerContext.Provider, { value: this, children });
|
|
7482
7652
|
});
|
|
7483
7653
|
}
|
|
@@ -7648,28 +7818,28 @@ const Toolbar = ({
|
|
|
7648
7818
|
) });
|
|
7649
7819
|
};
|
|
7650
7820
|
|
|
7651
|
-
var __defProp = Object.defineProperty;
|
|
7652
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7653
|
-
var __publicField = (obj, key, value) => {
|
|
7654
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7821
|
+
var __defProp$7 = Object.defineProperty;
|
|
7822
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7823
|
+
var __publicField$7 = (obj, key, value) => {
|
|
7824
|
+
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7655
7825
|
return value;
|
|
7656
7826
|
};
|
|
7657
|
-
var __accessCheck = (obj, member, msg) => {
|
|
7827
|
+
var __accessCheck$1 = (obj, member, msg) => {
|
|
7658
7828
|
if (!member.has(obj))
|
|
7659
7829
|
throw TypeError("Cannot " + msg);
|
|
7660
7830
|
};
|
|
7661
|
-
var __privateGet = (obj, member, getter) => {
|
|
7662
|
-
__accessCheck(obj, member, "read from private field");
|
|
7831
|
+
var __privateGet$1 = (obj, member, getter) => {
|
|
7832
|
+
__accessCheck$1(obj, member, "read from private field");
|
|
7663
7833
|
return getter ? getter.call(obj) : member.get(obj);
|
|
7664
7834
|
};
|
|
7665
|
-
var __privateAdd = (obj, member, value) => {
|
|
7835
|
+
var __privateAdd$1 = (obj, member, value) => {
|
|
7666
7836
|
if (member.has(obj))
|
|
7667
7837
|
throw TypeError("Cannot add the same private member more than once");
|
|
7668
7838
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
7669
7839
|
};
|
|
7670
7840
|
var __privateSet = (obj, member, value, setter) => {
|
|
7671
|
-
__accessCheck(obj, member, "write to private field");
|
|
7672
|
-
|
|
7841
|
+
__accessCheck$1(obj, member, "write to private field");
|
|
7842
|
+
member.set(obj, value);
|
|
7673
7843
|
return value;
|
|
7674
7844
|
};
|
|
7675
7845
|
var _emitter, _items, _moveItem;
|
|
@@ -7680,27 +7850,27 @@ function getTargetItem(ev) {
|
|
|
7680
7850
|
}
|
|
7681
7851
|
class SortableListHandler {
|
|
7682
7852
|
constructor() {
|
|
7683
|
-
__privateAdd(this, _emitter, new EventEmitter());
|
|
7684
|
-
__privateAdd(this, _items, []);
|
|
7685
|
-
__publicField(this, "updateChildren", (items) => {
|
|
7853
|
+
__privateAdd$1(this, _emitter, new EventEmitter());
|
|
7854
|
+
__privateAdd$1(this, _items, []);
|
|
7855
|
+
__publicField$7(this, "updateChildren", (items) => {
|
|
7686
7856
|
__privateSet(this, _items, Children.toArray(items).filter(
|
|
7687
7857
|
(el) => isValidElement(el)
|
|
7688
7858
|
));
|
|
7689
7859
|
});
|
|
7690
|
-
__privateAdd(this, _moveItem, (movingId, idBefore, after) => {
|
|
7860
|
+
__privateAdd$1(this, _moveItem, (movingId, idBefore, after) => {
|
|
7691
7861
|
if (movingId === idBefore)
|
|
7692
7862
|
return;
|
|
7693
|
-
const itemIndex = __privateGet(this, _items).findIndex(
|
|
7863
|
+
const itemIndex = __privateGet$1(this, _items).findIndex(
|
|
7694
7864
|
(search) => search.props.id === movingId
|
|
7695
7865
|
);
|
|
7696
|
-
const item = __privateGet(this, _items).splice(itemIndex, 1)[0];
|
|
7697
|
-
const insertIndex = __privateGet(this, _items).findIndex(
|
|
7866
|
+
const item = __privateGet$1(this, _items).splice(itemIndex, 1)[0];
|
|
7867
|
+
const insertIndex = __privateGet$1(this, _items).findIndex(
|
|
7698
7868
|
(search) => search.props.id === idBefore
|
|
7699
7869
|
);
|
|
7700
|
-
__privateGet(this, _items).splice(insertIndex + (after ? 1 : 0), 0, item);
|
|
7701
|
-
__privateGet(this, _emitter).emit("sort", null);
|
|
7870
|
+
__privateGet$1(this, _items).splice(insertIndex + (after ? 1 : 0), 0, item);
|
|
7871
|
+
__privateGet$1(this, _emitter).emit("sort", null);
|
|
7702
7872
|
});
|
|
7703
|
-
__publicField(this, "useItemEvents", () => {
|
|
7873
|
+
__publicField$7(this, "useItemEvents", () => {
|
|
7704
7874
|
const unsuscribe = useRef(() => {
|
|
7705
7875
|
});
|
|
7706
7876
|
const ref = useCallback((el) => {
|
|
@@ -7711,7 +7881,7 @@ class SortableListHandler {
|
|
|
7711
7881
|
};
|
|
7712
7882
|
const handleDrop = (ev) => {
|
|
7713
7883
|
const target = getTargetItem(ev);
|
|
7714
|
-
__privateGet(this, _moveItem).call(this, ev.dataTransfer.getData("text"), target.id, target.classList.contains("after"));
|
|
7884
|
+
__privateGet$1(this, _moveItem).call(this, ev.dataTransfer.getData("text"), target.id, target.classList.contains("after"));
|
|
7715
7885
|
target.classList.remove("dragover");
|
|
7716
7886
|
target.classList.remove("after");
|
|
7717
7887
|
};
|
|
@@ -7742,16 +7912,16 @@ class SortableListHandler {
|
|
|
7742
7912
|
}, []);
|
|
7743
7913
|
return ref;
|
|
7744
7914
|
});
|
|
7745
|
-
__publicField(this, "useSortChange", (onSortChange) => {
|
|
7915
|
+
__publicField$7(this, "useSortChange", (onSortChange) => {
|
|
7746
7916
|
useSubscription({
|
|
7747
7917
|
makeSubscription: () => {
|
|
7748
|
-
return __privateGet(this, _emitter).on("sort", () => {
|
|
7749
|
-
onSortChange?.([...__privateGet(this, _items)]);
|
|
7918
|
+
return __privateGet$1(this, _emitter).on("sort", () => {
|
|
7919
|
+
onSortChange?.([...__privateGet$1(this, _items)]);
|
|
7750
7920
|
});
|
|
7751
7921
|
}
|
|
7752
7922
|
});
|
|
7753
7923
|
});
|
|
7754
|
-
__publicField(this, "useWrapperEvents", () => {
|
|
7924
|
+
__publicField$7(this, "useWrapperEvents", () => {
|
|
7755
7925
|
const unsuscribe = useRef(() => {
|
|
7756
7926
|
});
|
|
7757
7927
|
const ref = useCallback((el) => {
|
|
@@ -7864,5 +8034,1690 @@ const SortableList = makeStyledComponent(
|
|
|
7864
8034
|
UnstyledSortableList
|
|
7865
8035
|
);
|
|
7866
8036
|
|
|
7867
|
-
|
|
8037
|
+
var __defProp$6 = Object.defineProperty;
|
|
8038
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8039
|
+
var __publicField$6 = (obj, key, value) => {
|
|
8040
|
+
__defNormalProp$6(obj, key + "" , value);
|
|
8041
|
+
return value;
|
|
8042
|
+
};
|
|
8043
|
+
class Parameter {
|
|
8044
|
+
constructor(params) {
|
|
8045
|
+
__publicField$6(this, "state");
|
|
8046
|
+
this.state = params;
|
|
8047
|
+
this.state.type = this.state.type.toLowerCase();
|
|
8048
|
+
this.state.values = this.state.values || [];
|
|
8049
|
+
this.removeEmptyValues();
|
|
8050
|
+
makeObservable(this, {
|
|
8051
|
+
state: observable
|
|
8052
|
+
});
|
|
8053
|
+
reaction(
|
|
8054
|
+
() => this.state.values,
|
|
8055
|
+
() => delete this.state.validationError
|
|
8056
|
+
);
|
|
8057
|
+
}
|
|
8058
|
+
clear() {
|
|
8059
|
+
this.state.values.splice(0, this.state.values.length);
|
|
8060
|
+
}
|
|
8061
|
+
getValues() {
|
|
8062
|
+
return this.state.values;
|
|
8063
|
+
}
|
|
8064
|
+
removeEmptyValues() {
|
|
8065
|
+
this.state.values = this.state.values.filter((x) => !!x);
|
|
8066
|
+
}
|
|
8067
|
+
setValue(value, index) {
|
|
8068
|
+
this.removeEmptyValues();
|
|
8069
|
+
index !== null && index !== void 0 ? this.state.values[index] = value : this.state.values = [value];
|
|
8070
|
+
}
|
|
8071
|
+
addValue(value) {
|
|
8072
|
+
this.removeEmptyValues();
|
|
8073
|
+
this.state.values[this.state.values.length] = value;
|
|
8074
|
+
}
|
|
8075
|
+
setValues(values, index = 0) {
|
|
8076
|
+
this.removeEmptyValues();
|
|
8077
|
+
values.forEach((x, i) => this.state.values[index + i] = x);
|
|
8078
|
+
for (let i = values.length; i < this.state.values.length; i++) {
|
|
8079
|
+
delete this.state.values[i];
|
|
8080
|
+
}
|
|
8081
|
+
}
|
|
8082
|
+
removeValue(value) {
|
|
8083
|
+
this.state.values = this.getValues().filter((x) => !!x && x !== value);
|
|
8084
|
+
}
|
|
8085
|
+
asPayloadElement() {
|
|
8086
|
+
return this.state.type === "label" ? null : toJS(this.state.values);
|
|
8087
|
+
}
|
|
8088
|
+
includes(value) {
|
|
8089
|
+
return this.state.values.includes(value);
|
|
8090
|
+
}
|
|
8091
|
+
validate() {
|
|
8092
|
+
const isValid = !this.state.required || !!this.state.values[0];
|
|
8093
|
+
this.state.validationError = isValid ? void 0 : getLabel("msgReqField").text;
|
|
8094
|
+
return isValid;
|
|
8095
|
+
}
|
|
8096
|
+
}
|
|
8097
|
+
|
|
8098
|
+
const ParameterRender = observer(
|
|
8099
|
+
({
|
|
8100
|
+
index = 0,
|
|
8101
|
+
omitLabel = false,
|
|
8102
|
+
parameter
|
|
8103
|
+
}) => {
|
|
8104
|
+
const Label = useMemo(
|
|
8105
|
+
() => omitLabel && parameter.state.type !== "check" ? ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }) : FieldLabel,
|
|
8106
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8107
|
+
[]
|
|
8108
|
+
);
|
|
8109
|
+
const error = parameter.state.validationError && /* @__PURE__ */ jsx(FieldErrorMessage, { name: parameter.state.name, children: parameter.state.validationError });
|
|
8110
|
+
const componentRef = useRef(null);
|
|
8111
|
+
if (parameter.state.component) {
|
|
8112
|
+
componentRef.current = componentRef.current || importComponent(parameter.state.component);
|
|
8113
|
+
return /* @__PURE__ */ jsxs(Suspense, { fallback: null, children: [
|
|
8114
|
+
/* @__PURE__ */ jsx(componentRef.current, { parameter, index }),
|
|
8115
|
+
error
|
|
8116
|
+
] });
|
|
8117
|
+
} else if (parameter.state.type === "input") {
|
|
8118
|
+
return /* @__PURE__ */ jsxs(
|
|
8119
|
+
Label,
|
|
8120
|
+
{
|
|
8121
|
+
label: parameter.state.title,
|
|
8122
|
+
required: parameter.state.required,
|
|
8123
|
+
children: [
|
|
8124
|
+
/* @__PURE__ */ jsx(
|
|
8125
|
+
Input,
|
|
8126
|
+
{
|
|
8127
|
+
name: parameter.state.name,
|
|
8128
|
+
title: parameter.state.description,
|
|
8129
|
+
onChange: (ev) => {
|
|
8130
|
+
parameter.setValue(ev.target.value, index);
|
|
8131
|
+
},
|
|
8132
|
+
value: parameter.state.values[index]
|
|
8133
|
+
}
|
|
8134
|
+
),
|
|
8135
|
+
error
|
|
8136
|
+
]
|
|
8137
|
+
}
|
|
8138
|
+
);
|
|
8139
|
+
} else if (parameter.state.type === "text_area") {
|
|
8140
|
+
return /* @__PURE__ */ jsxs(
|
|
8141
|
+
Label,
|
|
8142
|
+
{
|
|
8143
|
+
label: parameter.state.title,
|
|
8144
|
+
required: parameter.state.required,
|
|
8145
|
+
children: [
|
|
8146
|
+
/* @__PURE__ */ jsx(
|
|
8147
|
+
Textarea,
|
|
8148
|
+
{
|
|
8149
|
+
name: parameter.state.name,
|
|
8150
|
+
title: parameter.state.description,
|
|
8151
|
+
onChange: (ev) => {
|
|
8152
|
+
parameter.setValue(ev.target.value, index);
|
|
8153
|
+
},
|
|
8154
|
+
value: parameter.state.values[index]
|
|
8155
|
+
}
|
|
8156
|
+
),
|
|
8157
|
+
error
|
|
8158
|
+
]
|
|
8159
|
+
}
|
|
8160
|
+
);
|
|
8161
|
+
} else if (parameter.state.type === "check") {
|
|
8162
|
+
return /* @__PURE__ */ jsxs(
|
|
8163
|
+
Label,
|
|
8164
|
+
{
|
|
8165
|
+
label: parameter.state.title,
|
|
8166
|
+
required: parameter.state.required,
|
|
8167
|
+
children: [
|
|
8168
|
+
/* @__PURE__ */ jsx(
|
|
8169
|
+
Checkbox$1,
|
|
8170
|
+
{
|
|
8171
|
+
name: parameter.state.name,
|
|
8172
|
+
title: parameter.state.description,
|
|
8173
|
+
onChange: (ev) => {
|
|
8174
|
+
parameter.setValue(String(ev.target.checked), index);
|
|
8175
|
+
},
|
|
8176
|
+
checked: parameter.state.values[index] === "true"
|
|
8177
|
+
}
|
|
8178
|
+
),
|
|
8179
|
+
error
|
|
8180
|
+
]
|
|
8181
|
+
}
|
|
8182
|
+
);
|
|
8183
|
+
} else if (parameter.state.type === "combo") {
|
|
8184
|
+
return /* @__PURE__ */ jsxs(
|
|
8185
|
+
Label,
|
|
8186
|
+
{
|
|
8187
|
+
label: parameter.state.title,
|
|
8188
|
+
required: parameter.state.required,
|
|
8189
|
+
children: [
|
|
8190
|
+
/* @__PURE__ */ jsx(
|
|
8191
|
+
Select,
|
|
8192
|
+
{
|
|
8193
|
+
name: parameter.state.name,
|
|
8194
|
+
title: parameter.state.description,
|
|
8195
|
+
onChange: (ev) => {
|
|
8196
|
+
parameter.setValue(ev.target.value, index);
|
|
8197
|
+
},
|
|
8198
|
+
value: parameter.state.values[index],
|
|
8199
|
+
children: arrayOrArray(parameter.state.possibleValues).map((c) => /* @__PURE__ */ jsx("option", { value: c.value, children: c.text }))
|
|
8200
|
+
}
|
|
8201
|
+
),
|
|
8202
|
+
error
|
|
8203
|
+
]
|
|
8204
|
+
}
|
|
8205
|
+
);
|
|
8206
|
+
} else if (parameter.state.type === "mdl_attribute") {
|
|
8207
|
+
console.warn("There is no renderer for type mdl_attribute");
|
|
8208
|
+
return null;
|
|
8209
|
+
} else if (parameter.state.type === "mdl_doc_type") {
|
|
8210
|
+
console.warn("There is no renderer for type mdl_doc_type");
|
|
8211
|
+
return null;
|
|
8212
|
+
} else if (parameter.state.type === "mdl_metadata") {
|
|
8213
|
+
console.warn("There is no renderer for type mdl_metadata");
|
|
8214
|
+
return null;
|
|
8215
|
+
} else if (parameter.state.type === "mdl_entity") {
|
|
8216
|
+
console.warn("There is no renderer for type mdl_entity");
|
|
8217
|
+
return null;
|
|
8218
|
+
} else if (parameter.state.type === "mdl_ai_connector") {
|
|
8219
|
+
return null;
|
|
8220
|
+
} else if (parameter.state.type === "mdl_ai_completion_model") {
|
|
8221
|
+
return null;
|
|
8222
|
+
} else if (parameter.state.type === "mdl_ai_embeddings_model") {
|
|
8223
|
+
return null;
|
|
8224
|
+
} else if (parameter.state.type === "hidden") {
|
|
8225
|
+
return null;
|
|
8226
|
+
} else if (parameter.state.type === "label") {
|
|
8227
|
+
return parameter.state.values[index];
|
|
8228
|
+
}
|
|
8229
|
+
console.warn("Cannot render parameter of type", parameter.state.type);
|
|
8230
|
+
return null;
|
|
8231
|
+
}
|
|
8232
|
+
);
|
|
8233
|
+
|
|
8234
|
+
const ParametersTable = observer(
|
|
8235
|
+
({ group }) => {
|
|
8236
|
+
const maxIndex = Math.max(
|
|
8237
|
+
...Object.values(group.parameters).map((p) => p.state.values.length)
|
|
8238
|
+
);
|
|
8239
|
+
const indices = Array.from({ length: maxIndex }, (_, i) => i);
|
|
8240
|
+
return /* @__PURE__ */ jsxs(
|
|
8241
|
+
Box,
|
|
8242
|
+
{
|
|
8243
|
+
as: "table",
|
|
8244
|
+
variant: "layout.common.tables.secondary",
|
|
8245
|
+
sx: {
|
|
8246
|
+
gridColumn: "span 4"
|
|
8247
|
+
},
|
|
8248
|
+
children: [
|
|
8249
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: Object.values(group.parameters).map(
|
|
8250
|
+
(p) => p.state.type !== "hidden" ? /* @__PURE__ */ jsx("th", { sx: toJS(p.state.cssProps?.TH), children: p.state.title }, p.state.name) : null
|
|
8251
|
+
) }) }),
|
|
8252
|
+
/* @__PURE__ */ jsx("tbody", { children: indices.map((index) => /* @__PURE__ */ jsx(
|
|
8253
|
+
"tr",
|
|
8254
|
+
{
|
|
8255
|
+
onClick: () => {
|
|
8256
|
+
group.selection.clear();
|
|
8257
|
+
group.selection.add(index);
|
|
8258
|
+
},
|
|
8259
|
+
className: group.selection.has(index) ? "selected" : "",
|
|
8260
|
+
children: Object.entries(group.parameters).map(
|
|
8261
|
+
([name, parameter]) => parameter.state.type !== "hidden" ? /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx(
|
|
8262
|
+
ParameterRender,
|
|
8263
|
+
{
|
|
8264
|
+
omitLabel: true,
|
|
8265
|
+
index,
|
|
8266
|
+
parameter
|
|
8267
|
+
}
|
|
8268
|
+
) }, name) : null
|
|
8269
|
+
)
|
|
8270
|
+
},
|
|
8271
|
+
index
|
|
8272
|
+
)) }),
|
|
8273
|
+
/* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { colSpan: Object.keys(group.parameters).length, children: [
|
|
8274
|
+
/* @__PURE__ */ jsx(
|
|
8275
|
+
Button,
|
|
8276
|
+
{
|
|
8277
|
+
onClick: () => {
|
|
8278
|
+
Object.values(group.parameters)[0]?.state.values.push("");
|
|
8279
|
+
},
|
|
8280
|
+
children: getLabel("btnAgr").text
|
|
8281
|
+
}
|
|
8282
|
+
),
|
|
8283
|
+
/* @__PURE__ */ jsx(
|
|
8284
|
+
Button,
|
|
8285
|
+
{
|
|
8286
|
+
onClick: () => {
|
|
8287
|
+
for (let i = maxIndex; i >= 0; i--) {
|
|
8288
|
+
if (group.selection.has(i)) {
|
|
8289
|
+
Object.values(group.parameters).forEach(
|
|
8290
|
+
(c) => c.state.values.splice(i, 1)
|
|
8291
|
+
);
|
|
8292
|
+
}
|
|
8293
|
+
}
|
|
8294
|
+
group.selection.clear();
|
|
8295
|
+
},
|
|
8296
|
+
children: getLabel("btnDel").text
|
|
8297
|
+
}
|
|
8298
|
+
)
|
|
8299
|
+
] }) }) })
|
|
8300
|
+
]
|
|
8301
|
+
}
|
|
8302
|
+
);
|
|
8303
|
+
}
|
|
8304
|
+
);
|
|
8305
|
+
|
|
8306
|
+
class TableParameter extends Parameter {
|
|
8307
|
+
constructor(params) {
|
|
8308
|
+
super(params);
|
|
8309
|
+
this.state.cssProps = params.cssProps ?? { TH: {} };
|
|
8310
|
+
}
|
|
8311
|
+
}
|
|
8312
|
+
|
|
8313
|
+
var __defProp$5 = Object.defineProperty;
|
|
8314
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8315
|
+
var __publicField$5 = (obj, key, value) => {
|
|
8316
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8317
|
+
return value;
|
|
8318
|
+
};
|
|
8319
|
+
class ParametersGroup {
|
|
8320
|
+
constructor(params) {
|
|
8321
|
+
__publicField$5(this, "component");
|
|
8322
|
+
__publicField$5(this, "name");
|
|
8323
|
+
__publicField$5(this, "parameters");
|
|
8324
|
+
__publicField$5(this, "selection", /* @__PURE__ */ new Set());
|
|
8325
|
+
this.component = params.component;
|
|
8326
|
+
this.name = params.name;
|
|
8327
|
+
this.parameters = Object.fromEntries(
|
|
8328
|
+
Object.entries(params.parameters).map(([name, param]) => [
|
|
8329
|
+
name,
|
|
8330
|
+
new TableParameter(param)
|
|
8331
|
+
])
|
|
8332
|
+
);
|
|
8333
|
+
makeObservable(this, {
|
|
8334
|
+
parameters: observable,
|
|
8335
|
+
selection: observable
|
|
8336
|
+
});
|
|
8337
|
+
}
|
|
8338
|
+
removeAll() {
|
|
8339
|
+
Object.values(this.parameters).forEach((p) => p.clear());
|
|
8340
|
+
}
|
|
8341
|
+
asPayloadElement() {
|
|
8342
|
+
return Object.keys(this.parameters).reduce(
|
|
8343
|
+
(prev, current) => {
|
|
8344
|
+
const elem = this.parameters[current].asPayloadElement();
|
|
8345
|
+
elem && (prev[current] = elem);
|
|
8346
|
+
return prev;
|
|
8347
|
+
},
|
|
8348
|
+
{}
|
|
8349
|
+
);
|
|
8350
|
+
}
|
|
8351
|
+
}
|
|
8352
|
+
|
|
8353
|
+
var __defProp$4 = Object.defineProperty;
|
|
8354
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8355
|
+
var __publicField$4 = (obj, key, value) => {
|
|
8356
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8357
|
+
return value;
|
|
8358
|
+
};
|
|
8359
|
+
function isParametersGroup(param) {
|
|
8360
|
+
return param.parameters !== void 0;
|
|
8361
|
+
}
|
|
8362
|
+
const _ParametersStore = class _ParametersStore {
|
|
8363
|
+
constructor() {
|
|
8364
|
+
__publicField$4(this, "parameters", {});
|
|
8365
|
+
makeObservable(this, {
|
|
8366
|
+
parameters: observable
|
|
8367
|
+
});
|
|
8368
|
+
}
|
|
8369
|
+
static getInstance() {
|
|
8370
|
+
if (!_ParametersStore.instance) {
|
|
8371
|
+
_ParametersStore.instance = new _ParametersStore();
|
|
8372
|
+
}
|
|
8373
|
+
return _ParametersStore.instance;
|
|
8374
|
+
}
|
|
8375
|
+
/**
|
|
8376
|
+
* Takes the string generated by the ParametersStore in the server
|
|
8377
|
+
* and assigns it to the current parameters
|
|
8378
|
+
*/
|
|
8379
|
+
fromResponse(owner, response) {
|
|
8380
|
+
const params = JSON.parse(response);
|
|
8381
|
+
Object.entries(params).forEach(([name, param]) => {
|
|
8382
|
+
if (!this.parameters[owner]) {
|
|
8383
|
+
this.parameters[owner] = {};
|
|
8384
|
+
}
|
|
8385
|
+
if (isParametersGroup(param)) {
|
|
8386
|
+
this.parameters[owner][name] = new ParametersGroup(param);
|
|
8387
|
+
} else {
|
|
8388
|
+
this.parameters[owner][name] = new Parameter(param);
|
|
8389
|
+
}
|
|
8390
|
+
});
|
|
8391
|
+
}
|
|
8392
|
+
static getParametersFromResponse(response) {
|
|
8393
|
+
const parsed = JSON.parse(response);
|
|
8394
|
+
const newParameters = {};
|
|
8395
|
+
Object.entries(parsed).forEach(([name, param]) => {
|
|
8396
|
+
if (isParametersGroup(param)) {
|
|
8397
|
+
newParameters[name] = new ParametersGroup(param);
|
|
8398
|
+
} else {
|
|
8399
|
+
newParameters[name] = new Parameter(param);
|
|
8400
|
+
}
|
|
8401
|
+
});
|
|
8402
|
+
return newParameters;
|
|
8403
|
+
}
|
|
8404
|
+
static getParametersFromObject(response) {
|
|
8405
|
+
const newParameters = {};
|
|
8406
|
+
Object.entries(response).forEach(([name, param]) => {
|
|
8407
|
+
if (param instanceof Parameter || param instanceof ParametersGroup) {
|
|
8408
|
+
newParameters[name] = param;
|
|
8409
|
+
} else {
|
|
8410
|
+
if (isParametersGroup(param)) {
|
|
8411
|
+
newParameters[name] = new ParametersGroup(param);
|
|
8412
|
+
} else {
|
|
8413
|
+
newParameters[name] = new Parameter(param);
|
|
8414
|
+
}
|
|
8415
|
+
}
|
|
8416
|
+
});
|
|
8417
|
+
return newParameters;
|
|
8418
|
+
}
|
|
8419
|
+
/**
|
|
8420
|
+
* Returns the parameters for a given owner name.
|
|
8421
|
+
*/
|
|
8422
|
+
getParameters(ownerName) {
|
|
8423
|
+
return this.parameters[ownerName];
|
|
8424
|
+
}
|
|
8425
|
+
/**
|
|
8426
|
+
* Returns an object that can be used to submit the parameters to the server
|
|
8427
|
+
* in a format that the ParametersStore in the server expects.
|
|
8428
|
+
*/
|
|
8429
|
+
getSubmitValue(owner) {
|
|
8430
|
+
const submitObject = {};
|
|
8431
|
+
Object.values(this.parameters[owner]).forEach((p) => {
|
|
8432
|
+
if (p instanceof Parameter) {
|
|
8433
|
+
submitObject[p.state.name] = p.getValues();
|
|
8434
|
+
} else if (p instanceof ParametersGroup) {
|
|
8435
|
+
for (const [name, param] of Object.entries(p.parameters)) {
|
|
8436
|
+
submitObject[name] = param.getValues();
|
|
8437
|
+
}
|
|
8438
|
+
}
|
|
8439
|
+
});
|
|
8440
|
+
return JSON.stringify(submitObject);
|
|
8441
|
+
}
|
|
8442
|
+
/**
|
|
8443
|
+
* Resets the parameters store.
|
|
8444
|
+
*/
|
|
8445
|
+
reset() {
|
|
8446
|
+
this.parameters = {};
|
|
8447
|
+
}
|
|
8448
|
+
static validate(parameters) {
|
|
8449
|
+
let isValid = true;
|
|
8450
|
+
let firstInvalid = null;
|
|
8451
|
+
for (const p of Object.values(parameters)) {
|
|
8452
|
+
if (p instanceof Parameter) {
|
|
8453
|
+
isValid = p.validate() && isValid;
|
|
8454
|
+
if (!firstInvalid && !isValid) {
|
|
8455
|
+
firstInvalid = p;
|
|
8456
|
+
}
|
|
8457
|
+
} else if (p instanceof ParametersGroup) {
|
|
8458
|
+
for (const pg of Object.values(p.parameters)) {
|
|
8459
|
+
isValid = pg.validate() && isValid;
|
|
8460
|
+
if (!firstInvalid && !isValid) {
|
|
8461
|
+
firstInvalid = pg;
|
|
8462
|
+
}
|
|
8463
|
+
}
|
|
8464
|
+
}
|
|
8465
|
+
}
|
|
8466
|
+
if (firstInvalid) {
|
|
8467
|
+
document.querySelector(`[name="${firstInvalid.state.name}"]`)?.focus();
|
|
8468
|
+
}
|
|
8469
|
+
return isValid;
|
|
8470
|
+
}
|
|
8471
|
+
};
|
|
8472
|
+
__publicField$4(_ParametersStore, "instance");
|
|
8473
|
+
let ParametersStore = _ParametersStore;
|
|
8474
|
+
|
|
8475
|
+
const Parameters = observer(
|
|
8476
|
+
({
|
|
8477
|
+
label,
|
|
8478
|
+
ownerName,
|
|
8479
|
+
parameters
|
|
8480
|
+
}) => {
|
|
8481
|
+
const params = parameters ?? ParametersStore.getInstance().getParameters(ownerName ?? "");
|
|
8482
|
+
if (!params)
|
|
8483
|
+
return;
|
|
8484
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8485
|
+
label,
|
|
8486
|
+
Object.entries(params).map(([, c]) => {
|
|
8487
|
+
if (c instanceof Parameter) {
|
|
8488
|
+
return /* @__PURE__ */ jsx(ParameterRender, { index: 0, parameter: c }, c.state.name);
|
|
8489
|
+
} else if (c instanceof ParametersGroup) {
|
|
8490
|
+
if (c.component) {
|
|
8491
|
+
const Component = importComponent(
|
|
8492
|
+
c.component
|
|
8493
|
+
);
|
|
8494
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Component, { group: c }, c.name) });
|
|
8495
|
+
} else {
|
|
8496
|
+
return /* @__PURE__ */ jsx(ParametersTable, { group: c }, c.name);
|
|
8497
|
+
}
|
|
8498
|
+
}
|
|
8499
|
+
})
|
|
8500
|
+
] });
|
|
8501
|
+
}
|
|
8502
|
+
);
|
|
8503
|
+
|
|
8504
|
+
var __defProp$3 = Object.defineProperty;
|
|
8505
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8506
|
+
var __publicField$3 = (obj, key, value) => {
|
|
8507
|
+
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8508
|
+
return value;
|
|
8509
|
+
};
|
|
8510
|
+
const _FilterConditionDTO = class _FilterConditionDTO {
|
|
8511
|
+
constructor(props, type, parent) {
|
|
8512
|
+
__publicField$3(this, "state", { label: "", op: "" });
|
|
8513
|
+
__publicField$3(this, "parent");
|
|
8514
|
+
__publicField$3(this, "allowedOps", /* @__PURE__ */ new Set());
|
|
8515
|
+
__publicField$3(this, "Component", observer(() => {
|
|
8516
|
+
return /* @__PURE__ */ jsx(
|
|
8517
|
+
Select,
|
|
8518
|
+
{
|
|
8519
|
+
name: "filterCondition",
|
|
8520
|
+
onChange: (ev) => this.setOp(ev.target.value),
|
|
8521
|
+
children: Object.entries(this.getOpMap()).map(([key, value], idx) => {
|
|
8522
|
+
return /* @__PURE__ */ jsx(
|
|
8523
|
+
"option",
|
|
8524
|
+
{
|
|
8525
|
+
selected: this.state.op === key,
|
|
8526
|
+
value: key,
|
|
8527
|
+
children: value.text
|
|
8528
|
+
},
|
|
8529
|
+
`${key}_${idx}`
|
|
8530
|
+
);
|
|
8531
|
+
})
|
|
8532
|
+
}
|
|
8533
|
+
);
|
|
8534
|
+
}));
|
|
8535
|
+
switch (type) {
|
|
8536
|
+
case "S":
|
|
8537
|
+
[
|
|
8538
|
+
"CONTAINS",
|
|
8539
|
+
"DISTINCT",
|
|
8540
|
+
"ENDS_WITH",
|
|
8541
|
+
"EQUAL",
|
|
8542
|
+
"NOT_CONTAINS",
|
|
8543
|
+
"NOT_ENDS_WITH",
|
|
8544
|
+
"NOT_STARTS_WITH",
|
|
8545
|
+
"STARTS_WITH",
|
|
8546
|
+
"NOT_NULL",
|
|
8547
|
+
"NULL",
|
|
8548
|
+
"IN",
|
|
8549
|
+
"NOT_IN"
|
|
8550
|
+
].forEach((op) => this.allowedOps.add(op));
|
|
8551
|
+
break;
|
|
8552
|
+
case "D":
|
|
8553
|
+
[
|
|
8554
|
+
"EQUAL",
|
|
8555
|
+
"DISTINCT",
|
|
8556
|
+
"LOWER_THAN",
|
|
8557
|
+
"LOWER_OR_EQUAL_THAN",
|
|
8558
|
+
"GREATER_THAN",
|
|
8559
|
+
"GREATER_OR_EQUAL_THAN",
|
|
8560
|
+
"NOT_NULL",
|
|
8561
|
+
"NULL",
|
|
8562
|
+
"IN",
|
|
8563
|
+
"NOT_IN",
|
|
8564
|
+
"RANGE"
|
|
8565
|
+
].forEach((op) => this.allowedOps.add(op));
|
|
8566
|
+
break;
|
|
8567
|
+
case "N":
|
|
8568
|
+
[
|
|
8569
|
+
"EQUAL",
|
|
8570
|
+
"DISTINCT",
|
|
8571
|
+
"LOWER_THAN",
|
|
8572
|
+
"LOWER_OR_EQUAL_THAN",
|
|
8573
|
+
"GREATER_THAN",
|
|
8574
|
+
"GREATER_OR_EQUAL_THAN",
|
|
8575
|
+
"NOT_NULL",
|
|
8576
|
+
"NULL",
|
|
8577
|
+
"IN",
|
|
8578
|
+
"NOT_IN",
|
|
8579
|
+
"RANGE"
|
|
8580
|
+
].forEach((op) => this.allowedOps.add(op));
|
|
8581
|
+
break;
|
|
8582
|
+
}
|
|
8583
|
+
this.state = props;
|
|
8584
|
+
this.parent = parent;
|
|
8585
|
+
this.state.label = this.getLabelByFilterOp().text;
|
|
8586
|
+
makeObservable(this, { state: observable, parent: observable });
|
|
8587
|
+
}
|
|
8588
|
+
getLabelByFilterOp() {
|
|
8589
|
+
return _FilterConditionDTO.opLabels[this.state.op];
|
|
8590
|
+
}
|
|
8591
|
+
getOpMap() {
|
|
8592
|
+
return Object.keys(_FilterConditionDTO.opLabels).reduce(
|
|
8593
|
+
(acc, key) => {
|
|
8594
|
+
if (this.allowedOps.has(key)) {
|
|
8595
|
+
acc[key] = _FilterConditionDTO.opLabels[key];
|
|
8596
|
+
}
|
|
8597
|
+
return acc;
|
|
8598
|
+
},
|
|
8599
|
+
{}
|
|
8600
|
+
);
|
|
8601
|
+
}
|
|
8602
|
+
setOp(op) {
|
|
8603
|
+
if ((this.state.op === "NULL" || this.state.op === "NOT_NULL") && op !== "NOT_NULL" && op !== "NULL") {
|
|
8604
|
+
this.parent.setValue("");
|
|
8605
|
+
}
|
|
8606
|
+
this.state.op = op;
|
|
8607
|
+
}
|
|
8608
|
+
};
|
|
8609
|
+
__publicField$3(_FilterConditionDTO, "opLabels", {
|
|
8610
|
+
CONTAINS: getLabel("lblFilLik"),
|
|
8611
|
+
DISTINCT: getLabel("lblFilNotEqu"),
|
|
8612
|
+
ENDS_WITH: getLabel("lblFilLikLef"),
|
|
8613
|
+
EQUAL: getLabel("lblFilEqu"),
|
|
8614
|
+
NOT_CONTAINS: getLabel("lblFilNotLik"),
|
|
8615
|
+
NOT_ENDS_WITH: getLabel("lblFilNotLikLef"),
|
|
8616
|
+
NOT_STARTS_WITH: getLabel("lblFilNotLikRig"),
|
|
8617
|
+
STARTS_WITH: getLabel("lblFilLikRig"),
|
|
8618
|
+
NOT_NULL: getLabel("lblFilNotNull"),
|
|
8619
|
+
NULL: getLabel("lblFilNull"),
|
|
8620
|
+
LOWER_THAN: getLabel("lblFilLowerThan"),
|
|
8621
|
+
LOWER_OR_EQUAL_THAN: getLabel("lblFilLowerOrEqualThan"),
|
|
8622
|
+
GREATER_THAN: getLabel("lblFilGreaterThan"),
|
|
8623
|
+
GREATER_OR_EQUAL_THAN: getLabel("lblFilGreaterOrEqualThan"),
|
|
8624
|
+
IN: getLabel("lblFilIn"),
|
|
8625
|
+
NOT_IN: getLabel("lblFilNotIn"),
|
|
8626
|
+
RANGE: getLabel("lblFilRange")
|
|
8627
|
+
});
|
|
8628
|
+
let FilterConditionDTO = _FilterConditionDTO;
|
|
8629
|
+
|
|
8630
|
+
var __defProp$2 = Object.defineProperty;
|
|
8631
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8632
|
+
var __publicField$2 = (obj, key, value) => {
|
|
8633
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8634
|
+
return value;
|
|
8635
|
+
};
|
|
8636
|
+
class FilterDTO {
|
|
8637
|
+
constructor(params, filterType, isTd = true) {
|
|
8638
|
+
__publicField$2(this, "type", "filter");
|
|
8639
|
+
__publicField$2(this, "state");
|
|
8640
|
+
__publicField$2(this, "isTd");
|
|
8641
|
+
__publicField$2(this, "ref", null);
|
|
8642
|
+
__publicField$2(this, "Component", observer(
|
|
8643
|
+
({
|
|
8644
|
+
renderers,
|
|
8645
|
+
multipleInputBoxProps
|
|
8646
|
+
}) => {
|
|
8647
|
+
const value = this.getValue();
|
|
8648
|
+
const type = this.getInputType();
|
|
8649
|
+
let visualizationComponent = null;
|
|
8650
|
+
const error = this.state.validationError ? /* @__PURE__ */ jsx(FieldErrorMessage, { children: this.state.validationError }) : null;
|
|
8651
|
+
const InputRenderer = renderers?.input || Input;
|
|
8652
|
+
switch (this.state.filterCondition.state.op) {
|
|
8653
|
+
case "CONTAINS":
|
|
8654
|
+
case "DISTINCT":
|
|
8655
|
+
case "ENDS_WITH":
|
|
8656
|
+
case "EQUAL":
|
|
8657
|
+
case "NOT_CONTAINS":
|
|
8658
|
+
case "NOT_ENDS_WITH":
|
|
8659
|
+
case "NOT_STARTS_WITH":
|
|
8660
|
+
case "STARTS_WITH":
|
|
8661
|
+
case "GREATER_OR_EQUAL_THAN":
|
|
8662
|
+
case "GREATER_THAN":
|
|
8663
|
+
case "LOWER_OR_EQUAL_THAN":
|
|
8664
|
+
case "LOWER_THAN": {
|
|
8665
|
+
visualizationComponent = /* @__PURE__ */ jsx(
|
|
8666
|
+
InputRenderer,
|
|
8667
|
+
{
|
|
8668
|
+
onChange: (ev) => {
|
|
8669
|
+
this.setValue(ev.target.value);
|
|
8670
|
+
},
|
|
8671
|
+
type,
|
|
8672
|
+
value,
|
|
8673
|
+
ref: (el) => this.ref = el
|
|
8674
|
+
}
|
|
8675
|
+
);
|
|
8676
|
+
break;
|
|
8677
|
+
}
|
|
8678
|
+
case "IN":
|
|
8679
|
+
case "NOT_IN":
|
|
8680
|
+
visualizationComponent = /* @__PURE__ */ jsxs(Box, { ...multipleInputBoxProps, children: [
|
|
8681
|
+
/* @__PURE__ */ jsx(
|
|
8682
|
+
InputRenderer,
|
|
8683
|
+
{
|
|
8684
|
+
onKeyDown: (ev) => {
|
|
8685
|
+
if (ev.key === "Enter") {
|
|
8686
|
+
this.setMultipleValue(this.getValue());
|
|
8687
|
+
this.setValue("");
|
|
8688
|
+
}
|
|
8689
|
+
},
|
|
8690
|
+
onChange: (ev) => {
|
|
8691
|
+
this.setValue(ev.target.value);
|
|
8692
|
+
ev.preventDefault();
|
|
8693
|
+
},
|
|
8694
|
+
type,
|
|
8695
|
+
value,
|
|
8696
|
+
ref: (el) => this.ref = el
|
|
8697
|
+
}
|
|
8698
|
+
),
|
|
8699
|
+
[...this.state.multipleValue ?? /* @__PURE__ */ new Set()].map((x, idx) => /* @__PURE__ */ jsxs(Box, { ...multipleInputBoxProps, className: "multiplesValuesBox", children: [
|
|
8700
|
+
/* @__PURE__ */ jsx(
|
|
8701
|
+
InputRenderer,
|
|
8702
|
+
{
|
|
8703
|
+
onChange: (ev) => {
|
|
8704
|
+
this.setMultipleValue(ev.target.value, idx);
|
|
8705
|
+
},
|
|
8706
|
+
value: x,
|
|
8707
|
+
type
|
|
8708
|
+
}
|
|
8709
|
+
),
|
|
8710
|
+
/* @__PURE__ */ jsx(
|
|
8711
|
+
IconButton,
|
|
8712
|
+
{
|
|
8713
|
+
icon: "Trash",
|
|
8714
|
+
onClick: () => {
|
|
8715
|
+
this.removeMultipleValue(x);
|
|
8716
|
+
}
|
|
8717
|
+
}
|
|
8718
|
+
)
|
|
8719
|
+
] }))
|
|
8720
|
+
] });
|
|
8721
|
+
break;
|
|
8722
|
+
case "NOT_NULL":
|
|
8723
|
+
case "NULL":
|
|
8724
|
+
const isFixed = this.state.filterType === "F";
|
|
8725
|
+
isFixed && this.setValue("true");
|
|
8726
|
+
visualizationComponent = /* @__PURE__ */ jsx(
|
|
8727
|
+
Checkbox$1,
|
|
8728
|
+
{
|
|
8729
|
+
disabled: isFixed,
|
|
8730
|
+
type: "checkbox",
|
|
8731
|
+
onChange: (ev) => this.setValue(ev.target.checked ? "true" : "false"),
|
|
8732
|
+
checked: value === "true",
|
|
8733
|
+
ref: (el) => this.ref = el
|
|
8734
|
+
}
|
|
8735
|
+
);
|
|
8736
|
+
break;
|
|
8737
|
+
case "RANGE":
|
|
8738
|
+
if (this.state.multipleValue && this.state.multipleValue?.length >= 0 && this.isUndefined(this.state.multipleValue[0])) {
|
|
8739
|
+
this.state.multipleValue[0] = "";
|
|
8740
|
+
}
|
|
8741
|
+
visualizationComponent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8742
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
8743
|
+
InputRenderer,
|
|
8744
|
+
{
|
|
8745
|
+
value: this.state.multipleValue && this.state.multipleValue?.length >= 0 && !this.isUndefined(this.state.multipleValue[0]) ? this.state.multipleValue[0] : "",
|
|
8746
|
+
label: getLabel("lblProEleTo").text,
|
|
8747
|
+
title: getLabel("lblProEleFrom").text,
|
|
8748
|
+
type,
|
|
8749
|
+
onChange: (ev) => {
|
|
8750
|
+
this.setMultipleValue(ev.target.value, 0);
|
|
8751
|
+
},
|
|
8752
|
+
ref: (el) => this.ref = el
|
|
8753
|
+
}
|
|
8754
|
+
) }),
|
|
8755
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
8756
|
+
InputRenderer,
|
|
8757
|
+
{
|
|
8758
|
+
value: this.state.multipleValue && this.state.multipleValue?.length >= 0 && this.state.multipleValue[1] ? this.state.multipleValue[1] : "",
|
|
8759
|
+
label: getLabel("lblProEleTo").text,
|
|
8760
|
+
title: getLabel("lblProEleTo").text,
|
|
8761
|
+
type,
|
|
8762
|
+
onChange: (ev) => {
|
|
8763
|
+
if ((this.state.multipleValue ?? []).length < 1) {
|
|
8764
|
+
this.setMultipleValue("", 0);
|
|
8765
|
+
}
|
|
8766
|
+
this.setMultipleValue(ev.target.value, 1);
|
|
8767
|
+
}
|
|
8768
|
+
}
|
|
8769
|
+
) })
|
|
8770
|
+
] });
|
|
8771
|
+
break;
|
|
8772
|
+
default:
|
|
8773
|
+
throw new Error(
|
|
8774
|
+
"Unknown condition: " + this.state.filterCondition.state.op
|
|
8775
|
+
);
|
|
8776
|
+
}
|
|
8777
|
+
return /* @__PURE__ */ jsxs(Box, { variant: "layout.design.semanticSearch.filterBox", children: [
|
|
8778
|
+
!this.isTd && /* @__PURE__ */ jsx("span", { children: this.getLabel() }),
|
|
8779
|
+
visualizationComponent,
|
|
8780
|
+
error
|
|
8781
|
+
] });
|
|
8782
|
+
}
|
|
8783
|
+
));
|
|
8784
|
+
this.state = params;
|
|
8785
|
+
filterType && (this.state.filterType = filterType);
|
|
8786
|
+
if (params.filterCondition && typeof params.filterCondition === "string") {
|
|
8787
|
+
this.state.filterCondition = new FilterConditionDTO(
|
|
8788
|
+
{
|
|
8789
|
+
op: params.filterCondition
|
|
8790
|
+
},
|
|
8791
|
+
params.valueType,
|
|
8792
|
+
this
|
|
8793
|
+
);
|
|
8794
|
+
}
|
|
8795
|
+
if (this.state.value && (this.state.filterCondition.state.op === "IN" || this.state.filterCondition.state.op === "NOT_IN" || this.state.filterCondition.state.op === "RANGE")) {
|
|
8796
|
+
this.state.multipleValue = (String(this.state.value) ?? "").split(",");
|
|
8797
|
+
this.state.value = void 0;
|
|
8798
|
+
}
|
|
8799
|
+
this.state.visualizationType = params.visualizationType.toUpperCase();
|
|
8800
|
+
this.state.hasFixedType = !!this.state.valueType;
|
|
8801
|
+
makeObservable(this, {
|
|
8802
|
+
state: observable,
|
|
8803
|
+
setValue: action
|
|
8804
|
+
});
|
|
8805
|
+
this.isTd = isTd;
|
|
8806
|
+
}
|
|
8807
|
+
isCheckBox() {
|
|
8808
|
+
return this.state.filterCondition.state.op === "NULL" || this.state.filterCondition.state.op === "NOT_NULL";
|
|
8809
|
+
}
|
|
8810
|
+
getStoreValue() {
|
|
8811
|
+
return ["IN", "NOT_IN", "RANGE"].includes(
|
|
8812
|
+
this.state.filterCondition.state.op
|
|
8813
|
+
) ? this.state.multipleValue?.filter((c) => !!c).join(",") : this.state.value;
|
|
8814
|
+
}
|
|
8815
|
+
getValue() {
|
|
8816
|
+
if (!this.state.value && this.isCheckBox()) {
|
|
8817
|
+
if (!FiltersStore.getFilter(this.state.name, "F")) {
|
|
8818
|
+
this.state.value = String(this.state.value === "true");
|
|
8819
|
+
} else {
|
|
8820
|
+
this.state.value = "true";
|
|
8821
|
+
}
|
|
8822
|
+
}
|
|
8823
|
+
return this.state.value;
|
|
8824
|
+
}
|
|
8825
|
+
getValueTypeLabel() {
|
|
8826
|
+
switch (this.state.valueType) {
|
|
8827
|
+
case "D":
|
|
8828
|
+
return getLabel("lblDate").text;
|
|
8829
|
+
case "N":
|
|
8830
|
+
return getLabel("lblNum").text;
|
|
8831
|
+
case "S":
|
|
8832
|
+
return getLabel("lblStr").text;
|
|
8833
|
+
default:
|
|
8834
|
+
return this.state.valueType;
|
|
8835
|
+
}
|
|
8836
|
+
}
|
|
8837
|
+
setMultipleValue(value, idx) {
|
|
8838
|
+
if (!this.state.multipleValue) {
|
|
8839
|
+
this.state.multipleValue = [];
|
|
8840
|
+
}
|
|
8841
|
+
if (this.state.multipleValue) {
|
|
8842
|
+
if (idx !== void 0) {
|
|
8843
|
+
this.state.multipleValue[idx] = value;
|
|
8844
|
+
} else {
|
|
8845
|
+
this.state.multipleValue.push(this.state.value);
|
|
8846
|
+
}
|
|
8847
|
+
}
|
|
8848
|
+
}
|
|
8849
|
+
setValue(value) {
|
|
8850
|
+
this.state.value = value;
|
|
8851
|
+
}
|
|
8852
|
+
resolveMultipleValueInPayload() {
|
|
8853
|
+
if (this.state.filterCondition.state.op === "IN" || this.state.filterCondition.state.op === "NOT_IN") {
|
|
8854
|
+
return this.state.multipleValue?.join(",");
|
|
8855
|
+
} else if (this.state.filterCondition.state.op === "RANGE") {
|
|
8856
|
+
return this.state.multipleValue?.slice(0, 2).join(",");
|
|
8857
|
+
}
|
|
8858
|
+
}
|
|
8859
|
+
asPayloadElement() {
|
|
8860
|
+
const aux = toJS(this.state);
|
|
8861
|
+
aux.filterCondition = this.state.filterCondition.state.op;
|
|
8862
|
+
aux.multipleValue && (aux.value = this.resolveMultipleValueInPayload());
|
|
8863
|
+
return aux;
|
|
8864
|
+
}
|
|
8865
|
+
asFilterValue() {
|
|
8866
|
+
const value = this.state.multipleValue ? this.resolveMultipleValueInPayload() : this.state.value;
|
|
8867
|
+
return value ? {
|
|
8868
|
+
condition: this.state.filterCondition.state.op,
|
|
8869
|
+
value,
|
|
8870
|
+
type: this.state.valueType
|
|
8871
|
+
} : null;
|
|
8872
|
+
}
|
|
8873
|
+
getInputType() {
|
|
8874
|
+
return this.state.valueType === "N" ? "number" : this.state.valueType === "D" ? "date" : "text";
|
|
8875
|
+
}
|
|
8876
|
+
removeMultipleValue(value) {
|
|
8877
|
+
this.state.multipleValue = (this.state.multipleValue ?? []).filter(
|
|
8878
|
+
(x) => x !== value
|
|
8879
|
+
);
|
|
8880
|
+
}
|
|
8881
|
+
isUndefined(value) {
|
|
8882
|
+
return !value || !(value !== "undefined");
|
|
8883
|
+
}
|
|
8884
|
+
getLabel() {
|
|
8885
|
+
return `${this.state.title} (${this.state.filterCondition.state.label})`;
|
|
8886
|
+
}
|
|
8887
|
+
validate() {
|
|
8888
|
+
const storeValue = this.getStoreValue();
|
|
8889
|
+
const isValid = this.state.filterType === "U" || storeValue !== void 0 && storeValue !== "";
|
|
8890
|
+
this.state.validationError = isValid ? void 0 : getLabel("msgReqField").text;
|
|
8891
|
+
return isValid;
|
|
8892
|
+
}
|
|
8893
|
+
clear() {
|
|
8894
|
+
this.state.value = "";
|
|
8895
|
+
this.state.multipleValue = [];
|
|
8896
|
+
}
|
|
8897
|
+
hasFilledValue() {
|
|
8898
|
+
return this.state.value || this.state.multipleValue?.some((x) => x);
|
|
8899
|
+
}
|
|
8900
|
+
}
|
|
8901
|
+
|
|
8902
|
+
var __defProp$1 = Object.defineProperty;
|
|
8903
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8904
|
+
var __publicField$1 = (obj, key, value) => {
|
|
8905
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8906
|
+
return value;
|
|
8907
|
+
};
|
|
8908
|
+
const _FiltersStore = class _FiltersStore {
|
|
8909
|
+
constructor() {
|
|
8910
|
+
__publicField$1(this, "available", {});
|
|
8911
|
+
__publicField$1(this, "fixed", {});
|
|
8912
|
+
__publicField$1(this, "dynamic", {});
|
|
8913
|
+
makeObservable(this, {
|
|
8914
|
+
available: observable,
|
|
8915
|
+
fixed: observable,
|
|
8916
|
+
dynamic: observable
|
|
8917
|
+
});
|
|
8918
|
+
}
|
|
8919
|
+
/**
|
|
8920
|
+
* Takes the string generated by the ParametersStore in the server
|
|
8921
|
+
* and assigns it to the current filters
|
|
8922
|
+
*/
|
|
8923
|
+
static getFiltersFromResponse(response, from = "available") {
|
|
8924
|
+
const parsed = JSON.parse(response);
|
|
8925
|
+
const newFilters = {};
|
|
8926
|
+
Object.entries(parsed[from]).forEach(([name, param]) => {
|
|
8927
|
+
newFilters[name] = new FilterDTO(param);
|
|
8928
|
+
});
|
|
8929
|
+
return newFilters;
|
|
8930
|
+
}
|
|
8931
|
+
static setFiltersFromObject(response) {
|
|
8932
|
+
this.instance.available = this.getFiltersFromObject(response.available);
|
|
8933
|
+
this.instance.dynamic = this.getFiltersFromObject(response.dynamic);
|
|
8934
|
+
this.instance.fixed = this.getFiltersFromObject(response.fixed);
|
|
8935
|
+
}
|
|
8936
|
+
static getFiltersFromObject(response) {
|
|
8937
|
+
const newFilters = {};
|
|
8938
|
+
Object.entries(response).forEach(([name, param]) => {
|
|
8939
|
+
if (!(param instanceof FilterDTO)) {
|
|
8940
|
+
param = new FilterDTO(param);
|
|
8941
|
+
}
|
|
8942
|
+
newFilters[name] = param;
|
|
8943
|
+
});
|
|
8944
|
+
return newFilters;
|
|
8945
|
+
}
|
|
8946
|
+
/**
|
|
8947
|
+
* Returns the filters for a given name.
|
|
8948
|
+
*/
|
|
8949
|
+
static getFilter(name, type) {
|
|
8950
|
+
return !type ? this.instance.available[name] : type === "F" ? this.instance.fixed[name] : this.instance.dynamic[name];
|
|
8951
|
+
}
|
|
8952
|
+
/**
|
|
8953
|
+
* Set filter into store given owner name
|
|
8954
|
+
*/
|
|
8955
|
+
static setFilter(value, type, replace = true) {
|
|
8956
|
+
const newFilter = new FilterDTO(value.state, type);
|
|
8957
|
+
if (!type) {
|
|
8958
|
+
this.instance.available[value.state.name] = newFilter;
|
|
8959
|
+
} else if (type === "F" && (!replace && !this.instance.fixed[value.state.name] || replace)) {
|
|
8960
|
+
this.instance.fixed[value.state.name] = newFilter;
|
|
8961
|
+
} else if (type === "U" && (!replace && !this.instance.dynamic[value.state.name] || replace)) {
|
|
8962
|
+
this.instance.dynamic[value.state.name] = newFilter;
|
|
8963
|
+
}
|
|
8964
|
+
}
|
|
8965
|
+
/**
|
|
8966
|
+
* Remove into store given owner name
|
|
8967
|
+
*/
|
|
8968
|
+
static removeFilter(x, type) {
|
|
8969
|
+
if (!type) {
|
|
8970
|
+
delete this.instance.available[x.state.name];
|
|
8971
|
+
delete this.instance.fixed[x.state.name];
|
|
8972
|
+
delete this.instance.dynamic[x.state.name];
|
|
8973
|
+
} else if (type === "U") {
|
|
8974
|
+
delete this.instance.dynamic[x.state.name];
|
|
8975
|
+
x.state.filterType = void 0;
|
|
8976
|
+
} else if (type === "F") {
|
|
8977
|
+
delete this.instance.fixed[x.state.name];
|
|
8978
|
+
x.state.filterType = void 0;
|
|
8979
|
+
}
|
|
8980
|
+
}
|
|
8981
|
+
/**
|
|
8982
|
+
* Resets the parameters store.
|
|
8983
|
+
*/
|
|
8984
|
+
static reset() {
|
|
8985
|
+
_FiltersStore.instance.available = {};
|
|
8986
|
+
_FiltersStore.instance.fixed = {};
|
|
8987
|
+
_FiltersStore.instance.dynamic = {};
|
|
8988
|
+
}
|
|
8989
|
+
static size() {
|
|
8990
|
+
return Object.keys(_FiltersStore.instance.available).length;
|
|
8991
|
+
}
|
|
8992
|
+
static setFilters(filters, type) {
|
|
8993
|
+
!type ? this.instance.available = filters : type === "F" ? this.instance.fixed = filters : this.instance.dynamic = filters;
|
|
8994
|
+
}
|
|
8995
|
+
static filters(type) {
|
|
8996
|
+
return !type ? _FiltersStore.instance.available : type === "F" ? _FiltersStore.instance.fixed : _FiltersStore.instance.dynamic;
|
|
8997
|
+
}
|
|
8998
|
+
static parseFiltersAsFilterValue(values) {
|
|
8999
|
+
return values.reduce((x, y) => {
|
|
9000
|
+
const value = y.asFilterValue();
|
|
9001
|
+
if (value) {
|
|
9002
|
+
x[y.state.name] = value;
|
|
9003
|
+
}
|
|
9004
|
+
return x;
|
|
9005
|
+
}, {});
|
|
9006
|
+
}
|
|
9007
|
+
static getFiltersAsFilterValue(type) {
|
|
9008
|
+
return _FiltersStore.parseFiltersAsFilterValue(_FiltersStore.values(type));
|
|
9009
|
+
}
|
|
9010
|
+
static getAllFilters(includeAvailable) {
|
|
9011
|
+
const retList = [];
|
|
9012
|
+
includeAvailable && retList.push(...Object.values(_FiltersStore.instance.available));
|
|
9013
|
+
retList.push(...Object.values(_FiltersStore.instance.fixed));
|
|
9014
|
+
retList.push(...Object.values(_FiltersStore.instance.dynamic));
|
|
9015
|
+
return retList;
|
|
9016
|
+
}
|
|
9017
|
+
static values(type) {
|
|
9018
|
+
return !type ? Object.values(_FiltersStore.instance.available) : type === "F" ? Object.values(_FiltersStore.instance.fixed) : Object.values(_FiltersStore.instance.dynamic);
|
|
9019
|
+
}
|
|
9020
|
+
static entries(type) {
|
|
9021
|
+
return !type ? Object.entries(_FiltersStore.instance.available) : type === "F" ? Object.entries(_FiltersStore.instance.fixed) : Object.entries(_FiltersStore.instance.dynamic);
|
|
9022
|
+
}
|
|
9023
|
+
static keys(type) {
|
|
9024
|
+
return !type ? Object.keys(_FiltersStore.instance.available) : type === "F" ? Object.keys(_FiltersStore.instance.fixed) : Object.keys(_FiltersStore.instance.dynamic);
|
|
9025
|
+
}
|
|
9026
|
+
static async getFiltersById(id) {
|
|
9027
|
+
const response = (
|
|
9028
|
+
/* await ApiaApi.post<{
|
|
9029
|
+
parameters: string;
|
|
9030
|
+
}>(
|
|
9031
|
+
makeApiaUrl({
|
|
9032
|
+
ajaxUrl: 'apia.design.SemanticSearchAction.run',
|
|
9033
|
+
action: 'getFiltersBySemSerId',
|
|
9034
|
+
id,
|
|
9035
|
+
}),
|
|
9036
|
+
);*/
|
|
9037
|
+
{}
|
|
9038
|
+
);
|
|
9039
|
+
const filters = this.getFiltersFromResponse(
|
|
9040
|
+
response?.data?.parameters ?? "",
|
|
9041
|
+
"dynamic"
|
|
9042
|
+
);
|
|
9043
|
+
Object.values(filters).forEach((x) => x.isTd = false);
|
|
9044
|
+
return filters;
|
|
9045
|
+
}
|
|
9046
|
+
static asPayloadElement() {
|
|
9047
|
+
return _FiltersStore.getAllFilters().map((x) => x.asPayloadElement());
|
|
9048
|
+
}
|
|
9049
|
+
static validate() {
|
|
9050
|
+
let isValid = true;
|
|
9051
|
+
let firstInvalid = null;
|
|
9052
|
+
for (const f of _FiltersStore.getAllFilters()) {
|
|
9053
|
+
isValid && (isValid = f.validate());
|
|
9054
|
+
if (!isValid && !firstInvalid) {
|
|
9055
|
+
firstInvalid = f;
|
|
9056
|
+
}
|
|
9057
|
+
}
|
|
9058
|
+
firstInvalid?.ref?.focus();
|
|
9059
|
+
return isValid;
|
|
9060
|
+
}
|
|
9061
|
+
};
|
|
9062
|
+
__publicField$1(_FiltersStore, "instance", new _FiltersStore());
|
|
9063
|
+
let FiltersStore = _FiltersStore;
|
|
9064
|
+
|
|
9065
|
+
const AttributeParsers = [
|
|
9066
|
+
/**
|
|
9067
|
+
* Allows to pass javascript event handlers through the format
|
|
9068
|
+
* onEventDispatched, the main difficulty is that the html parser returns the
|
|
9069
|
+
* attributes with lowercase, that's why any attribute of the type
|
|
9070
|
+
* onEventDispatched will be passed to the component as onEventdispatched
|
|
9071
|
+
* (note the lowercase 'd').
|
|
9072
|
+
*/
|
|
9073
|
+
{
|
|
9074
|
+
match: /^(?:data-)?on(.*)$/i,
|
|
9075
|
+
parse([, originalAction], value) {
|
|
9076
|
+
if (value.match(/^__contextMethod/))
|
|
9077
|
+
return [
|
|
9078
|
+
{
|
|
9079
|
+
newName: `on${originalAction[0].toUpperCase()}${originalAction.slice(
|
|
9080
|
+
1
|
|
9081
|
+
)}`,
|
|
9082
|
+
newValue: value
|
|
9083
|
+
}
|
|
9084
|
+
];
|
|
9085
|
+
let newName = `on${originalAction.charAt(0).toUpperCase()}${originalAction.slice(1)}`;
|
|
9086
|
+
const composedEvent = originalAction.match(/^(mouse|key|double)(.*)$/i);
|
|
9087
|
+
if (composedEvent) {
|
|
9088
|
+
newName = `on${composedEvent[1].charAt(0).toUpperCase()}${composedEvent[1].slice(1)}${composedEvent[2].charAt(0).toUpperCase()}${composedEvent[2].slice(1)}`;
|
|
9089
|
+
}
|
|
9090
|
+
return [
|
|
9091
|
+
{
|
|
9092
|
+
newName,
|
|
9093
|
+
newValue: (ev) => {
|
|
9094
|
+
const evalString = value.replace(/return [^;\n\r]+/, "");
|
|
9095
|
+
const f = eval(evalString);
|
|
9096
|
+
f(ev);
|
|
9097
|
+
}
|
|
9098
|
+
}
|
|
9099
|
+
];
|
|
9100
|
+
}
|
|
9101
|
+
},
|
|
9102
|
+
{
|
|
9103
|
+
/**
|
|
9104
|
+
* Allows to pass style objects as JSON strings
|
|
9105
|
+
*/
|
|
9106
|
+
match: /^data-style$/,
|
|
9107
|
+
parse(_match, value2) {
|
|
9108
|
+
try {
|
|
9109
|
+
return [{ newName: "style", newValue: JSON.parse(value2) }];
|
|
9110
|
+
} catch (e) {
|
|
9111
|
+
console.error({ value: value2, e });
|
|
9112
|
+
}
|
|
9113
|
+
return null;
|
|
9114
|
+
}
|
|
9115
|
+
},
|
|
9116
|
+
{
|
|
9117
|
+
/**
|
|
9118
|
+
* Allows conditional rendering of a component
|
|
9119
|
+
*/
|
|
9120
|
+
match: /^data-render$/,
|
|
9121
|
+
parse(_match, originalValue) {
|
|
9122
|
+
if (originalValue !== "" && !JSON.parse(originalValue)) {
|
|
9123
|
+
throw new Command("COMMAND: PREVENT_RENDERING");
|
|
9124
|
+
}
|
|
9125
|
+
return [
|
|
9126
|
+
{
|
|
9127
|
+
newName: "data-render",
|
|
9128
|
+
newValue: void 0
|
|
9129
|
+
}
|
|
9130
|
+
];
|
|
9131
|
+
}
|
|
9132
|
+
},
|
|
9133
|
+
{
|
|
9134
|
+
/**
|
|
9135
|
+
* Allow to pass json data as property to the components
|
|
9136
|
+
*/
|
|
9137
|
+
match: /^data-json-([a-zA-Z][\w_]*)$/,
|
|
9138
|
+
parse: ([, name], originalValue) => {
|
|
9139
|
+
try {
|
|
9140
|
+
return [
|
|
9141
|
+
{
|
|
9142
|
+
newName: name,
|
|
9143
|
+
newValue: JSON.parse(originalValue)
|
|
9144
|
+
}
|
|
9145
|
+
];
|
|
9146
|
+
} catch (e) {
|
|
9147
|
+
console.info(`Prop: ${name}, originalValue: ${originalValue}`);
|
|
9148
|
+
console.error(e);
|
|
9149
|
+
return null;
|
|
9150
|
+
}
|
|
9151
|
+
}
|
|
9152
|
+
},
|
|
9153
|
+
{
|
|
9154
|
+
match: /^data(?:-dom)?-variant$/,
|
|
9155
|
+
parse(_, newValue) {
|
|
9156
|
+
return [
|
|
9157
|
+
{ newName: "data-variant", newValue },
|
|
9158
|
+
{ newName: "variant", newValue }
|
|
9159
|
+
];
|
|
9160
|
+
}
|
|
9161
|
+
},
|
|
9162
|
+
{
|
|
9163
|
+
match: /^data-dom-([a-zA-Z][\w_]*)/i,
|
|
9164
|
+
parse([, name], newValue) {
|
|
9165
|
+
return [{ newName: `data-${name}`, newValue }];
|
|
9166
|
+
}
|
|
9167
|
+
},
|
|
9168
|
+
{
|
|
9169
|
+
/**
|
|
9170
|
+
* Change all the attributes whose name matches with data-(name) to just
|
|
9171
|
+
* name
|
|
9172
|
+
*/
|
|
9173
|
+
match: /^data-([a-zA-Z][\w_]*)$/,
|
|
9174
|
+
parse: ([, newName2], newValue) => [{ newName: newName2, newValue }]
|
|
9175
|
+
},
|
|
9176
|
+
/**
|
|
9177
|
+
* Allows to pass conditional data to a component. It accepts as value a JSON
|
|
9178
|
+
* string with the following structure:
|
|
9179
|
+
*
|
|
9180
|
+
* data-condition-NAME_OF_ATTRIBUTE=`
|
|
9181
|
+
* {
|
|
9182
|
+
* "condition": CONDITION,
|
|
9183
|
+
* "NAME_OF_ATTRIBUTE": VALUE_TO_PASS_TO_THE_COMPONENT
|
|
9184
|
+
* }
|
|
9185
|
+
*
|
|
9186
|
+
* Where:
|
|
9187
|
+
* - NAME_OF_ATTRIBUTE can be anything you want, the only limitations are
|
|
9188
|
+
* the attribute names limitations. - CONDITION will be evaluated with a
|
|
9189
|
+
* ternary conditional, if it parses to true the value will be passed or
|
|
9190
|
+
* hidden elsewhere - VALUE_TO_PASS_TO_THE_COMPONENT Since all the attribute
|
|
9191
|
+
* will be parsed with JSON, the value to pass can be anything that
|
|
9192
|
+
* can be parsed this way.
|
|
9193
|
+
*/
|
|
9194
|
+
{
|
|
9195
|
+
match: /^data-condition-([a-zA-Z][\w_]*)$/,
|
|
9196
|
+
parse: ([, newName2], value2) => {
|
|
9197
|
+
try {
|
|
9198
|
+
const parsedValue = JSON.parse(value2);
|
|
9199
|
+
return [
|
|
9200
|
+
{
|
|
9201
|
+
newName: newName2,
|
|
9202
|
+
newValue: parsedValue.condition ? parsedValue[newName2] : void 0
|
|
9203
|
+
}
|
|
9204
|
+
];
|
|
9205
|
+
} catch (e) {
|
|
9206
|
+
console.error(e);
|
|
9207
|
+
}
|
|
9208
|
+
return null;
|
|
9209
|
+
}
|
|
9210
|
+
},
|
|
9211
|
+
{
|
|
9212
|
+
match: /^tabindex/i,
|
|
9213
|
+
parse(_, newValue) {
|
|
9214
|
+
return [{ newName: "tabIndex", newValue }];
|
|
9215
|
+
}
|
|
9216
|
+
}
|
|
9217
|
+
];
|
|
9218
|
+
|
|
9219
|
+
const PathShortcuts = {};
|
|
9220
|
+
|
|
9221
|
+
const AttributeFilters = ["data-template", "data-component", "style"];
|
|
9222
|
+
|
|
9223
|
+
const AttributeReplacers = {
|
|
9224
|
+
// Common html props
|
|
9225
|
+
class: "className",
|
|
9226
|
+
colspan: "colSpan",
|
|
9227
|
+
for: "htmlFor",
|
|
9228
|
+
readonly: "readOnly",
|
|
9229
|
+
autocomplete: "autoComplete",
|
|
9230
|
+
// Chart button
|
|
9231
|
+
chartid: "chartId",
|
|
9232
|
+
// Dynamic button
|
|
9233
|
+
apiaprops: "apiaProps",
|
|
9234
|
+
// Profiles props
|
|
9235
|
+
// Users administration
|
|
9236
|
+
isglobal: "isGlobal",
|
|
9237
|
+
iscreate: "isCreate",
|
|
9238
|
+
ldapfull: "ldapFull",
|
|
9239
|
+
passwordprops: "passwordProps",
|
|
9240
|
+
// Validation fields
|
|
9241
|
+
initialvalue: "initialValue",
|
|
9242
|
+
submitvalueparser: "submitValueParser",
|
|
9243
|
+
validationclass: "validationClass",
|
|
9244
|
+
validationfunction: "validationFunction",
|
|
9245
|
+
validationrules: "validationRules",
|
|
9246
|
+
allowpickbeforetoday: "allowPickBeforeToday",
|
|
9247
|
+
evtmetafilters: "evtMetaFilters",
|
|
9248
|
+
trafreemetafilters: "traFreeMetaFilters",
|
|
9249
|
+
// Documents info modal
|
|
9250
|
+
allowdownload: "allowDownload",
|
|
9251
|
+
// Documents upload modal
|
|
9252
|
+
allowpickfromdirectories: "allowPickFromDirectories",
|
|
9253
|
+
allowpickfrommonitor: "allowPickFromMonitor",
|
|
9254
|
+
// Document Info modal
|
|
9255
|
+
frommonitor: "fromMonitor",
|
|
9256
|
+
showhistory: "showHistory",
|
|
9257
|
+
showdownloadinfo: "showDownloadInfo",
|
|
9258
|
+
showpermissions: "showPermissions",
|
|
9259
|
+
// LangPicker
|
|
9260
|
+
currentlang: "currentLang",
|
|
9261
|
+
// Change Dates Modal
|
|
9262
|
+
dateinputname: "dateInputName",
|
|
9263
|
+
initiallyexpanded: "initiallyExpanded",
|
|
9264
|
+
buttonsactions: "buttonsActions",
|
|
9265
|
+
// Reports
|
|
9266
|
+
reportname: "reportName"
|
|
9267
|
+
};
|
|
9268
|
+
|
|
9269
|
+
const ComplexReplacements = [
|
|
9270
|
+
(domNode, _, customOptions, commentsData) => {
|
|
9271
|
+
if (domNode.attribs["data-prevent-parse"] && domNode.attribs["data-prevent-parse"].trim() === "true") {
|
|
9272
|
+
return null;
|
|
9273
|
+
}
|
|
9274
|
+
if (domNode.attributes.find((current) => current.name === "data-fragment")) {
|
|
9275
|
+
const children = domToReact(
|
|
9276
|
+
cloneDeep(domNode.children),
|
|
9277
|
+
parseOptions(customOptions, commentsData)
|
|
9278
|
+
);
|
|
9279
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
9280
|
+
}
|
|
9281
|
+
return false;
|
|
9282
|
+
}
|
|
9283
|
+
];
|
|
9284
|
+
|
|
9285
|
+
const TagReplacers = {
|
|
9286
|
+
div: Box,
|
|
9287
|
+
button: Button,
|
|
9288
|
+
container: Container,
|
|
9289
|
+
h1: (props) => /* @__PURE__ */ jsx(Heading, { as: "h1", ...props }),
|
|
9290
|
+
h2: (props) => /* @__PURE__ */ jsx(Heading, { as: "h2", ...props }),
|
|
9291
|
+
h3: (props) => /* @__PURE__ */ jsx(Heading, { as: "h3", ...props }),
|
|
9292
|
+
h4: (props) => /* @__PURE__ */ jsx(Heading, { as: "h4", ...props }),
|
|
9293
|
+
h5: (props) => /* @__PURE__ */ jsx(Heading, { as: "h5", ...props }),
|
|
9294
|
+
h6: (props) => /* @__PURE__ */ jsx(Heading, { as: "h6", ...props }),
|
|
9295
|
+
img: Image,
|
|
9296
|
+
label: Label,
|
|
9297
|
+
input: Input,
|
|
9298
|
+
p: Paragraph,
|
|
9299
|
+
select: Select
|
|
9300
|
+
};
|
|
9301
|
+
|
|
9302
|
+
const contextMethods = {};
|
|
9303
|
+
|
|
9304
|
+
const AttributeValueParsers = (currentValue) => {
|
|
9305
|
+
if (currentValue === "true")
|
|
9306
|
+
return true;
|
|
9307
|
+
if (currentValue === "false")
|
|
9308
|
+
return false;
|
|
9309
|
+
if (typeof currentValue === "string") {
|
|
9310
|
+
const result = currentValue.match(/^__contextMethod\.(\w+)\.(\w+)$/);
|
|
9311
|
+
if (result) {
|
|
9312
|
+
return contextMethods[result[1]][result[2]];
|
|
9313
|
+
}
|
|
9314
|
+
}
|
|
9315
|
+
return currentValue;
|
|
9316
|
+
};
|
|
9317
|
+
|
|
9318
|
+
function isMessage(error) {
|
|
9319
|
+
return !!(typeof error === "object" && error && "message" in error);
|
|
9320
|
+
}
|
|
9321
|
+
function processCommand(command) {
|
|
9322
|
+
return Commands[command]();
|
|
9323
|
+
}
|
|
9324
|
+
const Commands = {
|
|
9325
|
+
PREVENT_RENDERING: () => null
|
|
9326
|
+
};
|
|
9327
|
+
|
|
9328
|
+
const CommentsParsers = [
|
|
9329
|
+
{
|
|
9330
|
+
/**
|
|
9331
|
+
* This parser allows to put a comment with the structure:
|
|
9332
|
+
* <!-- addRoute<newName,path/to/the/components> -->
|
|
9333
|
+
* And then use it in replacement of the path:
|
|
9334
|
+
*
|
|
9335
|
+
* @example
|
|
9336
|
+
*
|
|
9337
|
+
* <!-- addRoute<modals,path/to/the/modals> -->
|
|
9338
|
+
* <div data-component="modals/Info">...
|
|
9339
|
+
*/
|
|
9340
|
+
match: /addRoute *<(.{2,}),(.+)>/,
|
|
9341
|
+
parse(result, commentsData) {
|
|
9342
|
+
const routeShourtcut = result[1];
|
|
9343
|
+
const routePath = result[2];
|
|
9344
|
+
const newData = cloneDeep(commentsData);
|
|
9345
|
+
newData.customShortcuts.push([
|
|
9346
|
+
parseShortcut(routeShourtcut),
|
|
9347
|
+
routePath
|
|
9348
|
+
]);
|
|
9349
|
+
return newData;
|
|
9350
|
+
}
|
|
9351
|
+
},
|
|
9352
|
+
{
|
|
9353
|
+
/**
|
|
9354
|
+
* This parser allows anybody to put a comment with the structure:
|
|
9355
|
+
* <!-- SuspenseComponent<path/to/Component> --> or
|
|
9356
|
+
* <!-- SuspenseComponent<null> -->
|
|
9357
|
+
* which will result in a custom for the lazy components.
|
|
9358
|
+
*/
|
|
9359
|
+
match: /SuspenseComponent *<(\w+)>/,
|
|
9360
|
+
parse(result, commentsData) {
|
|
9361
|
+
const responseData = commentsData;
|
|
9362
|
+
if (result[1].toLowerCase() === "spinner")
|
|
9363
|
+
responseData.SuspenseComponent = Spinner$1;
|
|
9364
|
+
else
|
|
9365
|
+
responseData.SuspenseComponent = importTemplaterComponent(result[1]);
|
|
9366
|
+
return responseData;
|
|
9367
|
+
}
|
|
9368
|
+
}
|
|
9369
|
+
];
|
|
9370
|
+
|
|
9371
|
+
var __defProp = Object.defineProperty;
|
|
9372
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9373
|
+
var __publicField = (obj, key, value) => {
|
|
9374
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
9375
|
+
return value;
|
|
9376
|
+
};
|
|
9377
|
+
var __accessCheck = (obj, member, msg) => {
|
|
9378
|
+
if (!member.has(obj))
|
|
9379
|
+
throw TypeError("Cannot " + msg);
|
|
9380
|
+
};
|
|
9381
|
+
var __privateGet = (obj, member, getter) => {
|
|
9382
|
+
__accessCheck(obj, member, "read from private field");
|
|
9383
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
9384
|
+
};
|
|
9385
|
+
var __privateAdd = (obj, member, value) => {
|
|
9386
|
+
if (member.has(obj))
|
|
9387
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
9388
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
9389
|
+
};
|
|
9390
|
+
var _actuallyParse;
|
|
9391
|
+
console.time("Templater parse");
|
|
9392
|
+
console.time("Templater pre screen unlock");
|
|
9393
|
+
function importTemplaterComponent(path) {
|
|
9394
|
+
return lazy(() => {
|
|
9395
|
+
return new Promise((resolve) => {
|
|
9396
|
+
import(
|
|
9397
|
+
/* webpackChunkName: "[request]" */
|
|
9398
|
+
/* webpackInclude: /\.tsx?$/ */
|
|
9399
|
+
/* webpackPreload: true */
|
|
9400
|
+
/* webpackExclude: /projectAnalysisTree/ */
|
|
9401
|
+
`/src/dynamic/${path}`
|
|
9402
|
+
).then((result2) => {
|
|
9403
|
+
resolve(result2);
|
|
9404
|
+
}).catch((error) => {
|
|
9405
|
+
resolve({
|
|
9406
|
+
default: () => {
|
|
9407
|
+
console.error(error);
|
|
9408
|
+
throw new Error(
|
|
9409
|
+
`The above error ocurred at component ${path}, does it exist?`
|
|
9410
|
+
);
|
|
9411
|
+
}
|
|
9412
|
+
});
|
|
9413
|
+
});
|
|
9414
|
+
});
|
|
9415
|
+
});
|
|
9416
|
+
}
|
|
9417
|
+
function parseShortcut(shortcut) {
|
|
9418
|
+
if ("^($)[.".indexOf(shortcut) !== -1)
|
|
9419
|
+
return `\\${shortcut}`;
|
|
9420
|
+
return shortcut;
|
|
9421
|
+
}
|
|
9422
|
+
const parsedShortcuts = Object.entries(PathShortcuts).map(
|
|
9423
|
+
([shortcut, path]) => {
|
|
9424
|
+
return [parseShortcut(shortcut), path];
|
|
9425
|
+
}
|
|
9426
|
+
);
|
|
9427
|
+
const Wrapper = ({
|
|
9428
|
+
children,
|
|
9429
|
+
onMount
|
|
9430
|
+
}) => {
|
|
9431
|
+
React.useEffect(() => {
|
|
9432
|
+
if (onMount) {
|
|
9433
|
+
onMount();
|
|
9434
|
+
}
|
|
9435
|
+
return () => {
|
|
9436
|
+
};
|
|
9437
|
+
}, []);
|
|
9438
|
+
return children;
|
|
9439
|
+
};
|
|
9440
|
+
const Command = Error;
|
|
9441
|
+
function makeEmptyCommentsData() {
|
|
9442
|
+
return { customShortcuts: [], SuspenseComponent: () => null };
|
|
9443
|
+
}
|
|
9444
|
+
const parseOptions = (customOptions, commentsData) => {
|
|
9445
|
+
let actualCommentsData = commentsData ?? makeEmptyCommentsData();
|
|
9446
|
+
return {
|
|
9447
|
+
trim: true,
|
|
9448
|
+
replace: (domNode) => {
|
|
9449
|
+
if (customOptions?.debug)
|
|
9450
|
+
console.log(domNode);
|
|
9451
|
+
if (domNode.type.toLowerCase() === "comment") {
|
|
9452
|
+
CommentsParsers.forEach((parser) => {
|
|
9453
|
+
const matchResult = domNode.data.match(
|
|
9454
|
+
parser.match
|
|
9455
|
+
);
|
|
9456
|
+
if (matchResult) {
|
|
9457
|
+
actualCommentsData = parser.parse(matchResult, actualCommentsData);
|
|
9458
|
+
}
|
|
9459
|
+
});
|
|
9460
|
+
}
|
|
9461
|
+
if (domNode instanceof Element && domNode.attribs) {
|
|
9462
|
+
let componentName = domNode.attribs["data-component"];
|
|
9463
|
+
if (componentName) {
|
|
9464
|
+
actualCommentsData.customShortcuts.forEach(
|
|
9465
|
+
([shortcut, replacement]) => {
|
|
9466
|
+
if (componentName.match(new RegExp(`^${shortcut}.+`))) {
|
|
9467
|
+
componentName = replacement + componentName.slice(shortcut.length);
|
|
9468
|
+
}
|
|
9469
|
+
}
|
|
9470
|
+
);
|
|
9471
|
+
parsedShortcuts.forEach(([shortcut, replacement]) => {
|
|
9472
|
+
if (componentName.match(new RegExp(`^${shortcut}.+`))) {
|
|
9473
|
+
componentName = replacement + componentName.slice(shortcut.length);
|
|
9474
|
+
}
|
|
9475
|
+
});
|
|
9476
|
+
if (componentName.startsWith("@"))
|
|
9477
|
+
componentName = componentName.slice(1);
|
|
9478
|
+
}
|
|
9479
|
+
try {
|
|
9480
|
+
const Component = componentName ? importTemplaterComponent(componentName) : TagReplacers[domNode.name] ?? ((props3) => /* @__PURE__ */ jsx(Box$1, { as: domNode.name, ...props3 }));
|
|
9481
|
+
for (let i = 0; i < ComplexReplacements.length; i++) {
|
|
9482
|
+
const complexReplacement = ComplexReplacements[i];
|
|
9483
|
+
const result2 = complexReplacement(
|
|
9484
|
+
domNode,
|
|
9485
|
+
Component,
|
|
9486
|
+
customOptions,
|
|
9487
|
+
commentsData
|
|
9488
|
+
);
|
|
9489
|
+
if (result2 !== false)
|
|
9490
|
+
return /* @__PURE__ */ jsx(Suspense, { children: result2 });
|
|
9491
|
+
}
|
|
9492
|
+
[
|
|
9493
|
+
...AttributeFilters,
|
|
9494
|
+
...customOptions?.filterAttributes ?? []
|
|
9495
|
+
].forEach((att) => {
|
|
9496
|
+
delete domNode.attribs[att];
|
|
9497
|
+
});
|
|
9498
|
+
const props2 = Object.entries(domNode.attribs).reduce(
|
|
9499
|
+
(dictionary, [initialName, initialValue]) => {
|
|
9500
|
+
const name = initialName;
|
|
9501
|
+
const value = initialValue;
|
|
9502
|
+
let hasParsed = false;
|
|
9503
|
+
const returnDictionary = { ...dictionary };
|
|
9504
|
+
for (let i = 0; i < AttributeParsers.length; i++) {
|
|
9505
|
+
const parser = AttributeParsers[i];
|
|
9506
|
+
const match = name.match(parser.match);
|
|
9507
|
+
if (customOptions?.debug)
|
|
9508
|
+
console.log(parser.match, match);
|
|
9509
|
+
if (match) {
|
|
9510
|
+
const parsed = parser.parse(match, value);
|
|
9511
|
+
if (customOptions?.debug)
|
|
9512
|
+
console.log(parser.match, parsed);
|
|
9513
|
+
if (parsed) {
|
|
9514
|
+
parsed.forEach(({ newName, newValue }) => {
|
|
9515
|
+
const finalName = {
|
|
9516
|
+
...AttributeReplacers,
|
|
9517
|
+
...customOptions?.attributesReplacement ?? {}
|
|
9518
|
+
}[newName] ?? newName;
|
|
9519
|
+
returnDictionary[finalName] = AttributeValueParsers(newValue);
|
|
9520
|
+
});
|
|
9521
|
+
hasParsed = true;
|
|
9522
|
+
}
|
|
9523
|
+
break;
|
|
9524
|
+
}
|
|
9525
|
+
}
|
|
9526
|
+
if (!hasParsed) {
|
|
9527
|
+
const newName = {
|
|
9528
|
+
...AttributeReplacers,
|
|
9529
|
+
...customOptions?.attributesReplacement ?? {}
|
|
9530
|
+
}[name] ?? name;
|
|
9531
|
+
returnDictionary[newName] = AttributeValueParsers(value);
|
|
9532
|
+
}
|
|
9533
|
+
return returnDictionary;
|
|
9534
|
+
},
|
|
9535
|
+
{}
|
|
9536
|
+
);
|
|
9537
|
+
const children = domToReact(
|
|
9538
|
+
cloneDeep(domNode.children),
|
|
9539
|
+
parseOptions(customOptions, actualCommentsData)
|
|
9540
|
+
);
|
|
9541
|
+
delete props2.children;
|
|
9542
|
+
const { onComponentload } = props2;
|
|
9543
|
+
if (onComponentload) {
|
|
9544
|
+
delete props2.onComponentload;
|
|
9545
|
+
}
|
|
9546
|
+
if (actualCommentsData.SuspenseComponent) {
|
|
9547
|
+
if (onComponentload) {
|
|
9548
|
+
return /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(Wrapper, { onMount: onComponentload, children: /* @__PURE__ */ jsx(Component, { ...props2, children: domNode.children.length > 0 ? children : null }) }) });
|
|
9549
|
+
}
|
|
9550
|
+
return /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(Component, { ...props2, children: domNode.children.length > 0 ? children : null }) });
|
|
9551
|
+
}
|
|
9552
|
+
if (onComponentload)
|
|
9553
|
+
return /* @__PURE__ */ jsx(Wrapper, { onMount: onComponentload, children: /* @__PURE__ */ jsx(Component, { ...props2, children: domNode.children.length > 0 ? children : null }) });
|
|
9554
|
+
return /* @__PURE__ */ jsx(Component, { ...props2, children: domNode.children.length > 0 ? children : null });
|
|
9555
|
+
} catch (e) {
|
|
9556
|
+
if (isMessage(e)) {
|
|
9557
|
+
const match = e.message.match(/COMMAND: *(\w[\w\d_-]*)/);
|
|
9558
|
+
if (match) {
|
|
9559
|
+
return processCommand(match[1]);
|
|
9560
|
+
}
|
|
9561
|
+
}
|
|
9562
|
+
console.error(e);
|
|
9563
|
+
}
|
|
9564
|
+
}
|
|
9565
|
+
return domNode;
|
|
9566
|
+
},
|
|
9567
|
+
htmlparser2: { lowerCaseAttributeNames: false }
|
|
9568
|
+
};
|
|
9569
|
+
};
|
|
9570
|
+
const _Templater = class _Templater {
|
|
9571
|
+
constructor() {
|
|
9572
|
+
__publicField(this, "isDownloadingTemplate", false);
|
|
9573
|
+
__publicField(this, "templates", {});
|
|
9574
|
+
__privateAdd(this, _actuallyParse, (html, options) => {
|
|
9575
|
+
let actualHTML = html;
|
|
9576
|
+
if (window.onPreParseTemplate) {
|
|
9577
|
+
const parser = new DOMParser();
|
|
9578
|
+
const document2 = parser.parseFromString(html, "text/html");
|
|
9579
|
+
window.onPreParseTemplate?.(document2);
|
|
9580
|
+
actualHTML = document2.body.innerHTML;
|
|
9581
|
+
}
|
|
9582
|
+
return parse(actualHTML, options);
|
|
9583
|
+
});
|
|
9584
|
+
this.initTemplates();
|
|
9585
|
+
}
|
|
9586
|
+
static get instance() {
|
|
9587
|
+
if (!this._instance) {
|
|
9588
|
+
this._instance = new _Templater();
|
|
9589
|
+
}
|
|
9590
|
+
return this._instance;
|
|
9591
|
+
}
|
|
9592
|
+
initTemplates() {
|
|
9593
|
+
const templates = [
|
|
9594
|
+
...document.querySelectorAll("[data-template]")
|
|
9595
|
+
];
|
|
9596
|
+
const templatesObject = templates.reduce((dictionary, template) => {
|
|
9597
|
+
const name = template.getAttribute("data-template");
|
|
9598
|
+
if (!name)
|
|
9599
|
+
return dictionary;
|
|
9600
|
+
return {
|
|
9601
|
+
...dictionary,
|
|
9602
|
+
[name]: this.parseContent(name, template.outerHTML, {})
|
|
9603
|
+
};
|
|
9604
|
+
}, {});
|
|
9605
|
+
templates.forEach((template) => template.remove());
|
|
9606
|
+
this.templates = templatesObject;
|
|
9607
|
+
}
|
|
9608
|
+
/**
|
|
9609
|
+
* This method parses the string looking for <script class="context"> tags
|
|
9610
|
+
* and placeholders, run that code and make the replacements in the template
|
|
9611
|
+
* string.
|
|
9612
|
+
*
|
|
9613
|
+
* @param content The HTML string
|
|
9614
|
+
*/
|
|
9615
|
+
parseContent(templateName, content, props) {
|
|
9616
|
+
function shoutError(error) {
|
|
9617
|
+
console.error("%cParse template error", "font-size: 16px; margin: 10px");
|
|
9618
|
+
throw new Error(`${error} at template ${templateName}`);
|
|
9619
|
+
}
|
|
9620
|
+
let context = {};
|
|
9621
|
+
let newContent = content.replaceAll(
|
|
9622
|
+
/data-json-([\w_-]+)="([^"]+)"/g,
|
|
9623
|
+
(_2, propName, propValue) => {
|
|
9624
|
+
return `data-json-${propName}='${propValue.replaceAll(
|
|
9625
|
+
"'",
|
|
9626
|
+
"'"
|
|
9627
|
+
)}'`;
|
|
9628
|
+
}
|
|
9629
|
+
).replaceAll(
|
|
9630
|
+
/<script [^>]*class="context"[^>]*>([\s\S]*?)<\/script>/g,
|
|
9631
|
+
(_, scriptContent) => {
|
|
9632
|
+
if (scriptContent.match(/window[^=;]*=/))
|
|
9633
|
+
throw new Error("Assignment to window is forbidden");
|
|
9634
|
+
try {
|
|
9635
|
+
context = {
|
|
9636
|
+
...context,
|
|
9637
|
+
...eval(`{
|
|
9638
|
+
let context = JSON.parse(\`${JSON.stringify(context).replaceAll(
|
|
9639
|
+
'"',
|
|
9640
|
+
'\\"'
|
|
9641
|
+
)}\`);
|
|
9642
|
+
${scriptContent};
|
|
9643
|
+
context
|
|
9644
|
+
}`)
|
|
9645
|
+
};
|
|
9646
|
+
} catch (e) {
|
|
9647
|
+
console.info(`Script contents: ${scriptContent}`);
|
|
9648
|
+
console.info(`Props`, props);
|
|
9649
|
+
shoutError(e);
|
|
9650
|
+
}
|
|
9651
|
+
return "";
|
|
9652
|
+
}
|
|
9653
|
+
);
|
|
9654
|
+
const contextId = uniqueId$3();
|
|
9655
|
+
const replacementVars = { context, props };
|
|
9656
|
+
Object.entries(replacementVars).forEach(([varName, varContent]) => {
|
|
9657
|
+
if (varContent)
|
|
9658
|
+
Object.entries(varContent).forEach(([key, value]) => {
|
|
9659
|
+
if (isFunction$1(value)) {
|
|
9660
|
+
if (!contextMethods[contextId])
|
|
9661
|
+
contextMethods[contextId] = {};
|
|
9662
|
+
const methodId = uniqueId$3();
|
|
9663
|
+
contextMethods[contextId][methodId] = value;
|
|
9664
|
+
newContent = newContent.replaceAll(
|
|
9665
|
+
new RegExp(`{{\\s*(${varName})\\??.${key}\\s*}}`, "g"),
|
|
9666
|
+
`__contextMethod.${contextId}.${methodId}`
|
|
9667
|
+
);
|
|
9668
|
+
} else
|
|
9669
|
+
newContent = newContent.replaceAll(
|
|
9670
|
+
new RegExp(`{{\\s*(${varName})\\??.${key}\\s*}}`, "g"),
|
|
9671
|
+
value !== void 0 ? value : ""
|
|
9672
|
+
);
|
|
9673
|
+
});
|
|
9674
|
+
});
|
|
9675
|
+
newContent = newContent.replaceAll(
|
|
9676
|
+
/{{\s*(context|props)\?.([_$a-zA-Z]\w+)\s*}}/g,
|
|
9677
|
+
""
|
|
9678
|
+
);
|
|
9679
|
+
const result = newContent.match(
|
|
9680
|
+
/\{\{(context|props)\.([_$a-zA-Z]\w+)\\s*}}/
|
|
9681
|
+
);
|
|
9682
|
+
if (result)
|
|
9683
|
+
shoutError(`${result[1]}.${result[2]} is undefined`);
|
|
9684
|
+
return newContent;
|
|
9685
|
+
}
|
|
9686
|
+
/**
|
|
9687
|
+
* This method takes a template from the HTML Document and parses it to React
|
|
9688
|
+
* Components.
|
|
9689
|
+
*
|
|
9690
|
+
* @param name The name of the template you are looking for, it must be specified as
|
|
9691
|
+
* data-template="name" in the HTML element you want to use as template.
|
|
9692
|
+
* @param options This argument allows you to alter the behavior of the parser, for example
|
|
9693
|
+
* to replace some attribute names, parse some attributes with a custom parser function or
|
|
9694
|
+
* discard some attributes. See the type IAlterDefaultOptions to get more information
|
|
9695
|
+
*
|
|
9696
|
+
* @returns A ReactComponent as the result of the parsed HTML template.
|
|
9697
|
+
*/
|
|
9698
|
+
getTemplateByName(name, options) {
|
|
9699
|
+
if (!this.templates[name])
|
|
9700
|
+
throw new Error("There is no template with such name, ", name);
|
|
9701
|
+
const component = __privateGet(this, _actuallyParse).call(this, this.parseContent(name, this.templates[name], options?.props), parseOptions(options));
|
|
9702
|
+
return component;
|
|
9703
|
+
}
|
|
9704
|
+
/**
|
|
9705
|
+
* This method parses a string in HTML to React Components.
|
|
9706
|
+
*
|
|
9707
|
+
* @param content The HTML string to parse to React Components
|
|
9708
|
+
* @param options This argument allows you to alter the behavior of the parser, for example
|
|
9709
|
+
* to replace some attribute names, parse some attributes with a custom parser function or
|
|
9710
|
+
* discard some attributes. See the type IAlterDefaultOptions to get more information
|
|
9711
|
+
*
|
|
9712
|
+
* @returns A ReactComponent as the result of the parsed HTML template.
|
|
9713
|
+
*/
|
|
9714
|
+
parseString(content2, options) {
|
|
9715
|
+
return __privateGet(this, _actuallyParse).call(this, this.parseContent("parseStringTemplate", content2, options?.props), parseOptions(options));
|
|
9716
|
+
}
|
|
9717
|
+
};
|
|
9718
|
+
_actuallyParse = new WeakMap();
|
|
9719
|
+
__publicField(_Templater, "_instance", null);
|
|
9720
|
+
let Templater = _Templater;
|
|
9721
|
+
|
|
9722
|
+
export { Accordion, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, AutoEllipsis, Autocomplete, AutocompleteController, BaseButton, CalendarModal, Captcha, Checkbox$1 as Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, FieldErrorMessage, FieldLabel, FilterConditionDTO, FilterDTO, FiltersStore, IconButton, IconInput, IconsList, LabelBox, LinearLoader, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner, Modal, NumberInput, Overlay, Parameter, ParameterRender, Parameters, ParametersGroup, ParametersStore, ParametersTable, ProgressBar, RequiredMark, ScreenLocker, SimpleButton, SortableList, SortableListItem, Tab, Tabs, TabsContent, TabsController, TabsList, Templater, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, WaiTypeAhead, getFieldErrorStyles, getFieldTouchedStyles, importComponent, isParametersGroup, makeResponsiveComponent, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useModal, useModalContext, useOtherTagButton, useTabsContext };
|
|
7868
9723
|
//# sourceMappingURL=index.js.map
|