@apia/components 4.0.9 → 4.0.13

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.js CHANGED
@@ -1,27 +1,29 @@
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, useMemo, useEffect, useState, useCallback, useRef, forwardRef, Fragment as Fragment$1, useDeferredValue, lazy, Suspense, useTransition, Children, memo, isValidElement, cloneElement } from 'react';
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 { BarLoader } from 'react-spinners';
25
27
  import { keyframes } from '@emotion/react';
26
28
 
27
29
  const AccordionContext = createContext(null);
@@ -33,10 +35,10 @@ const useAccordionContext = () => {
33
35
  return context;
34
36
  };
35
37
 
36
- var __defProp$h = Object.defineProperty;
37
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
38
- var __publicField$h = (obj, key, value) => {
39
- __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
40
42
  return value;
41
43
  };
42
44
  function makeItemStateSelectorHook(handler) {
@@ -68,10 +70,10 @@ class AccordionHandler {
68
70
  constructor(id, props) {
69
71
  this.id = id;
70
72
  this.props = props;
71
- __publicField$h(this, "itemsState", {});
72
- __publicField$h(this, "itemsStateListeners", {});
73
- __publicField$h(this, "propsListeners", []);
74
- __publicField$h(this, "hooks", {
73
+ __publicField$o(this, "itemsState", {});
74
+ __publicField$o(this, "itemsStateListeners", {});
75
+ __publicField$o(this, "propsListeners", []);
76
+ __publicField$o(this, "hooks", {
75
77
  useAccordionContextProvider: () => {
76
78
  const Provider = useMemo(
77
79
  () => ({ children }) => /* @__PURE__ */ jsx(AccordionContext.Provider, { value: this, children }),
@@ -574,7 +576,6 @@ const DialogHeader = ({
574
576
  }
575
577
  );
576
578
  };
577
- var DialogHeader$1 = DialogHeader;
578
579
 
579
580
  const ModalContext = createContext(null);
580
581
  function useModalContext() {
@@ -978,7 +979,7 @@ const WindowModal = forwardRef(
978
979
  ),
979
980
  children: [
980
981
  !noHeader && /* @__PURE__ */ jsx(
981
- DialogHeader$1,
982
+ DialogHeader,
982
983
  {
983
984
  NavBar,
984
985
  title: innerTitle,
@@ -1007,56 +1008,56 @@ const WindowModal = forwardRef(
1007
1008
  }
1008
1009
  );
1009
1010
 
1010
- var __defProp$g = Object.defineProperty;
1011
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1012
- var __publicField$g = (obj, key, value) => {
1013
- __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
1014
1015
  return value;
1015
1016
  };
1016
- var __accessCheck$c = (obj, member, msg) => {
1017
+ var __accessCheck$d = (obj, member, msg) => {
1017
1018
  if (!member.has(obj))
1018
1019
  throw TypeError("Cannot " + msg);
1019
1020
  };
1020
- var __privateGet$9 = (obj, member, getter) => {
1021
- __accessCheck$c(obj, member, "read from private field");
1021
+ var __privateGet$a = (obj, member, getter) => {
1022
+ __accessCheck$d(obj, member, "read from private field");
1022
1023
  return getter ? getter.call(obj) : member.get(obj);
1023
1024
  };
1024
- var __privateAdd$c = (obj, member, value) => {
1025
+ var __privateAdd$d = (obj, member, value) => {
1025
1026
  if (member.has(obj))
1026
1027
  throw TypeError("Cannot add the same private member more than once");
1027
1028
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1028
1029
  };
1029
1030
  var __privateSet$8 = (obj, member, value, setter) => {
1030
- __accessCheck$c(obj, member, "write to private field");
1031
- setter ? setter.call(obj, value) : member.set(obj, value);
1031
+ __accessCheck$d(obj, member, "write to private field");
1032
+ member.set(obj, value);
1032
1033
  return value;
1033
1034
  };
1034
1035
  var __privateMethod$3 = (obj, member, method) => {
1035
- __accessCheck$c(obj, member, "access private method");
1036
+ __accessCheck$d(obj, member, "access private method");
1036
1037
  return method;
1037
1038
  };
1038
1039
  var _isLocked, _onChangeCb, _onDestroyCb, _evaluate, evaluate_fn, _a$1;
1039
1040
  class BodyScrollLocker {
1040
1041
  constructor() {
1041
- __privateAdd$c(this, _isLocked, false);
1042
- __privateAdd$c(this, _onChangeCb, () => {
1042
+ __privateAdd$d(this, _isLocked, false);
1043
+ __privateAdd$d(this, _onChangeCb, () => {
1043
1044
  });
1044
- __privateAdd$c(this, _onDestroyCb, () => {
1045
+ __privateAdd$d(this, _onDestroyCb, () => {
1045
1046
  });
1046
1047
  }
1047
1048
  get isLocked() {
1048
- return __privateGet$9(this, _isLocked);
1049
+ return __privateGet$a(this, _isLocked);
1049
1050
  }
1050
1051
  destroy() {
1051
- __privateGet$9(this, _onDestroyCb).call(this);
1052
+ __privateGet$a(this, _onDestroyCb).call(this);
1052
1053
  }
1053
1054
  lock() {
1054
1055
  __privateSet$8(this, _isLocked, true);
1055
- __privateGet$9(this, _onChangeCb).call(this);
1056
+ __privateGet$a(this, _onChangeCb).call(this);
1056
1057
  }
1057
1058
  unlock() {
1058
1059
  __privateSet$8(this, _isLocked, false);
1059
- __privateGet$9(this, _onChangeCb).call(this);
1060
+ __privateGet$a(this, _onChangeCb).call(this);
1060
1061
  }
1061
1062
  onChange(cb) {
1062
1063
  __privateSet$8(this, _onChangeCb, cb);
@@ -1074,8 +1075,8 @@ _onChangeCb = new WeakMap();
1074
1075
  _onDestroyCb = new WeakMap();
1075
1076
  const BodyScrollLock = new (_a$1 = class {
1076
1077
  constructor() {
1077
- __privateAdd$c(this, _evaluate);
1078
- __publicField$g(this, "lockers", []);
1078
+ __privateAdd$d(this, _evaluate);
1079
+ __publicField$n(this, "lockers", []);
1079
1080
  }
1080
1081
  getLocker() {
1081
1082
  const locker = new BodyScrollLocker();
@@ -1302,7 +1303,7 @@ const StaticModal = forwardRef(
1302
1303
  "data-variant": `layout.common.modals.${size}`,
1303
1304
  children: [
1304
1305
  !noHeader && /* @__PURE__ */ jsx(
1305
- DialogHeader$1,
1306
+ DialogHeader,
1306
1307
  {
1307
1308
  className: "modal__header",
1308
1309
  NavBar,
@@ -1349,7 +1350,8 @@ Modal.displayName = "Modal";
1349
1350
  const OpenModal = (props) => {
1350
1351
  const modalProps = useModal({
1351
1352
  isDefaultOpen: true,
1352
- onExited: props.onExited
1353
+ onExited: props.onExited,
1354
+ onClose: props.onClose
1353
1355
  });
1354
1356
  const previousOpenProp = usePrevious(props.isOpen);
1355
1357
  if (previousOpenProp.current !== props.isOpen && !props.isOpen) {
@@ -1373,10 +1375,12 @@ const OpenModal = (props) => {
1373
1375
  Confirm,
1374
1376
  {
1375
1377
  ...confirmProps,
1376
- onConfirm: () => {
1378
+ onConfirm: async () => {
1377
1379
  hasConfirmed.current = true;
1378
- props.onConfirm?.();
1379
- modalProps.hide();
1380
+ const res = await props.onConfirm?.();
1381
+ if (res !== false) {
1382
+ modalProps.hide();
1383
+ }
1380
1384
  },
1381
1385
  onCancel: () => {
1382
1386
  modalProps.hide();
@@ -1397,36 +1401,36 @@ const OpenModal = (props) => {
1397
1401
  );
1398
1402
  };
1399
1403
 
1400
- var __defProp$f = Object.defineProperty;
1401
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1402
- var __publicField$f = (obj, key, value) => {
1403
- __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
1404
1408
  return value;
1405
1409
  };
1406
- var __accessCheck$b = (obj, member, msg) => {
1410
+ var __accessCheck$c = (obj, member, msg) => {
1407
1411
  if (!member.has(obj))
1408
1412
  throw TypeError("Cannot " + msg);
1409
1413
  };
1410
- var __privateGet$8 = (obj, member, getter) => {
1411
- __accessCheck$b(obj, member, "read from private field");
1414
+ var __privateGet$9 = (obj, member, getter) => {
1415
+ __accessCheck$c(obj, member, "read from private field");
1412
1416
  return getter ? getter.call(obj) : member.get(obj);
1413
1417
  };
1414
- var __privateAdd$b = (obj, member, value) => {
1418
+ var __privateAdd$c = (obj, member, value) => {
1415
1419
  if (member.has(obj))
1416
1420
  throw TypeError("Cannot add the same private member more than once");
1417
1421
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1418
1422
  };
1419
1423
  var __privateSet$7 = (obj, member, value, setter) => {
1420
- __accessCheck$b(obj, member, "write to private field");
1421
- setter ? setter.call(obj, value) : member.set(obj, value);
1424
+ __accessCheck$c(obj, member, "write to private field");
1425
+ member.set(obj, value);
1422
1426
  return value;
1423
1427
  };
1424
1428
  var __privateWrapper$2 = (obj, member, setter, getter) => ({
1425
1429
  set _(value) {
1426
- __privateSet$7(obj, member, value, setter);
1430
+ __privateSet$7(obj, member, value);
1427
1431
  },
1428
1432
  get _() {
1429
- return __privateGet$8(obj, member, getter);
1433
+ return __privateGet$9(obj, member, getter);
1430
1434
  }
1431
1435
  });
1432
1436
  var _emitter$4, _maxId$1, _useModalsList;
@@ -1438,14 +1442,14 @@ class ApiaUtilModalHandler {
1438
1442
  }
1439
1443
  class ApiaUtilModals {
1440
1444
  constructor() {
1441
- __privateAdd$b(this, _emitter$4, new EventEmitter());
1442
- __privateAdd$b(this, _maxId$1, 0);
1443
- __privateAdd$b(this, _useModalsList, () => {
1445
+ __privateAdd$c(this, _emitter$4, new EventEmitter());
1446
+ __privateAdd$c(this, _maxId$1, 0);
1447
+ __privateAdd$c(this, _useModalsList, () => {
1444
1448
  const [modals, setModals] = useState(
1445
1449
  []
1446
1450
  );
1447
1451
  useMount(() => {
1448
- const u1 = __privateGet$8(this, _emitter$4).on("open", (ev) => {
1452
+ const u1 = __privateGet$9(this, _emitter$4).on("open", (ev) => {
1449
1453
  setModals((current) => [
1450
1454
  ...current,
1451
1455
  {
@@ -1460,12 +1464,12 @@ class ApiaUtilModals {
1460
1464
  }
1461
1465
  ]);
1462
1466
  });
1463
- const u2 = __privateGet$8(this, _emitter$4).on("closeAll", () => {
1467
+ const u2 = __privateGet$9(this, _emitter$4).on("closeAll", () => {
1464
1468
  setModals(
1465
1469
  (current) => current.map((modal) => ({ ...modal, isOpen: false }))
1466
1470
  );
1467
1471
  });
1468
- const u3 = __privateGet$8(this, _emitter$4).on("close", (modalId) => {
1472
+ const u3 = __privateGet$9(this, _emitter$4).on("close", (modalId) => {
1469
1473
  setModals(
1470
1474
  (current) => current.map(
1471
1475
  (modal) => modal.id === modalId ? { ...modal, isOpen: false } : modal
@@ -1480,8 +1484,8 @@ class ApiaUtilModals {
1480
1484
  });
1481
1485
  return modals;
1482
1486
  });
1483
- __publicField$f(this, "Component", () => {
1484
- const modals = __privateGet$8(this, _useModalsList).call(this);
1487
+ __publicField$m(this, "Component", () => {
1488
+ const modals = __privateGet$9(this, _useModalsList).call(this);
1485
1489
  return /* @__PURE__ */ jsx(Fragment, { children: modals.map((current) => /* @__PURE__ */ jsx(OpenModal, { ...current }, current.id)) });
1486
1490
  });
1487
1491
  document.addEventListener("openModal", (event) => {
@@ -1489,11 +1493,14 @@ class ApiaUtilModals {
1489
1493
  this.open(cevent.detail);
1490
1494
  });
1491
1495
  }
1496
+ close(id) {
1497
+ __privateGet$9(this, _emitter$4).emit("close", id);
1498
+ }
1492
1499
  open(props) {
1493
1500
  const id = props.id ?? `modal_${__privateWrapper$2(this, _maxId$1)._++}`;
1494
- __privateGet$8(this, _emitter$4).emit("open", { ...props, id });
1501
+ __privateGet$9(this, _emitter$4).emit("open", { ...props, id });
1495
1502
  return new ApiaUtilModalHandler(id, () => {
1496
- __privateGet$8(this, _emitter$4).emit("close", id);
1503
+ __privateGet$9(this, _emitter$4).emit("close", id);
1497
1504
  });
1498
1505
  }
1499
1506
  }
@@ -1501,29 +1508,29 @@ _emitter$4 = new WeakMap();
1501
1508
  _maxId$1 = new WeakMap();
1502
1509
  _useModalsList = new WeakMap();
1503
1510
 
1504
- var __defProp$e = Object.defineProperty;
1505
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1506
- var __publicField$e = (obj, key, value) => {
1507
- __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
1508
1515
  return value;
1509
1516
  };
1510
1517
  class ApiaUtilNotifications {
1511
1518
  constructor() {
1512
- __publicField$e(this, "close", (id) => {
1519
+ __publicField$l(this, "close", (id) => {
1513
1520
  defaultNotifier.close(id);
1514
1521
  });
1515
- __publicField$e(this, "closeAll", () => {
1522
+ __publicField$l(this, "closeAll", () => {
1516
1523
  defaultNotifier.closeAll();
1517
1524
  });
1518
- __publicField$e(this, "notify", (notification) => {
1525
+ __publicField$l(this, "notify", (notification) => {
1519
1526
  defaultNotifier.notify({
1520
1527
  ...notification,
1521
1528
  type: notification.type ?? "warning"
1522
1529
  });
1523
1530
  });
1524
1531
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1525
- __publicField$e(this, "useSelector", (selector) => defaultNotifier.useSelector(selector));
1526
- __publicField$e(this, "Component", () => {
1532
+ __publicField$l(this, "useSelector", (selector) => defaultNotifier.useSelector(selector));
1533
+ __publicField$l(this, "Component", () => {
1527
1534
  return /* @__PURE__ */ jsx(NotificationsList, {});
1528
1535
  });
1529
1536
  }
@@ -1616,7 +1623,6 @@ const ContextMenu = observer(
1616
1623
  );
1617
1624
  }
1618
1625
  );
1619
- var ContextMenu$1 = ContextMenu;
1620
1626
 
1621
1627
  function makeIcon(name) {
1622
1628
  return function IconComponent() {
@@ -1645,20 +1651,50 @@ const DefaultTabsLabelRenderer = observer(
1645
1651
  },
1646
1652
  [controller, tab.id]
1647
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
+ );
1648
1663
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1649
- tab.state.isIconTab ? /* @__PURE__ */ jsx(
1650
- IconButton,
1651
- {
1652
- className: "tabs__item__button",
1653
- as: "div",
1654
- icon: tab.state.icon,
1655
- variant: "null",
1656
- iconSize: "Sm",
1657
- size: "Lg"
1658
- }
1659
- ) : /* @__PURE__ */ jsxs(SimpleButton, { className: "tabs__item__button", as: "div", variant: "null", children: [
1660
- /* @__PURE__ */ jsx(ActualIcon, {}),
1661
- tab.state.label
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
+ )
1662
1698
  ] }),
1663
1699
  tab.state.isClosable && /* @__PURE__ */ jsx(
1664
1700
  IconButton,
@@ -1707,54 +1743,50 @@ const Item = observer(({ tab }) => {
1707
1743
  });
1708
1744
  }
1709
1745
  }, [tab.state.isOpen]);
1710
- const buttonProps = {
1746
+ const boxProps = {
1711
1747
  className: `tabs__item__wrapper ${tab.state.isOpen ? "open" : ""} ${tab.state.isDisabled ? "disabled" : ""}`,
1712
1748
  title: tab.state.title ?? tab.state.label,
1713
- onMouseDown: React__default.useCallback(
1714
- (ev) => {
1715
- if (ev.button === 1) {
1716
- tab.close();
1717
- } else if (ev.button === 0)
1718
- tab.open();
1719
- },
1720
- [tab]
1721
- ),
1722
1749
  "aria-controls": `tabpanel-${tab.controller.id}-${tab.state.id}`,
1723
1750
  "aria-selected": tab.state.isOpen ?? false,
1724
1751
  id: `tab-${tab.controller.id}-${tab.id}`,
1725
- tabIndex: tab.state.isFocused ? 0 : -1,
1752
+ tabIndex: tab.state.isOpen ? 0 : -1,
1726
1753
  role: "tab",
1727
1754
  variant: "inherit"
1728
1755
  };
1729
- return /* @__PURE__ */ jsx(SimpleButton, { "data-id": tab.id, ref, ...buttonProps, children: /* @__PURE__ */ jsx(Renderer, { tab }) });
1756
+ return /* @__PURE__ */ jsx(Box, { "data-id": tab.id, ref, ...boxProps, children: /* @__PURE__ */ jsx(Renderer, { tab }) });
1730
1757
  });
1731
- var Item$1 = Item;
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
+ }
1732
1785
 
1733
1786
  const TabsList = observer(
1734
1787
  ({ arrowsBehavior = "focus" }) => {
1735
1788
  const controller = useTabsContext();
1736
- const [showScrollButtons, setShowScrollButtons] = React__default.useState(false);
1737
- const [ref, setRef] = React__default.useState(null);
1738
- React__default.useEffect(() => {
1739
- if (ref && controller) {
1740
- const observer2 = new MutationObserver(([{ addedNodes }]) => {
1741
- const fixedTabsElement = ref.querySelector(".tabsList__fixedTabs");
1742
- const hasFixedTabsScroll = (fixedTabsElement?.clientWidth ?? 0) < (fixedTabsElement?.scrollWidth ?? 0);
1743
- const nonFixedTabsElement = ref.querySelector(".tabs__list");
1744
- const hasFixedNonTabsScroll = (nonFixedTabsElement?.clientWidth ?? 0) < (nonFixedTabsElement?.scrollWidth ?? 0);
1745
- setShowScrollButtons(hasFixedTabsScroll || hasFixedNonTabsScroll);
1746
- if (addedNodes) {
1747
- ref.querySelector(".tabs__list").scrollLeft = 9999999;
1748
- }
1749
- });
1750
- observer2.observe(ref, { childList: true, subtree: true });
1751
- return () => {
1752
- observer2.disconnect();
1753
- };
1754
- }
1755
- return () => {
1756
- };
1757
- }, [controller, ref]);
1789
+ const [showScrollButtons, setRef] = useShowScrollButtons();
1758
1790
  const onClickPrev = React__default.useCallback(() => {
1759
1791
  if (arrowsBehavior === "focus")
1760
1792
  controller?.focusPreviousTab();
@@ -1786,9 +1818,9 @@ const TabsList = observer(
1786
1818
  ...getVariant("layout.common.tabs.primary"),
1787
1819
  ref: setRef,
1788
1820
  children: [
1789
- /* @__PURE__ */ jsx(Box, { className: "tabsList__fixedTabs", children: fixedTabs.map((current) => /* @__PURE__ */ jsx(Item$1, { tab: current }, current.id)) }),
1821
+ /* @__PURE__ */ jsx(Box, { className: "tabsList__fixedTabs", children: fixedTabs.map((current) => /* @__PURE__ */ jsx(Item, { tab: current }, current.id)) }),
1790
1822
  /* @__PURE__ */ jsx(
1791
- ContextMenu$1,
1823
+ ContextMenu,
1792
1824
  {
1793
1825
  anchorPoint,
1794
1826
  isOpen,
@@ -1813,7 +1845,7 @@ const TabsList = observer(
1813
1845
  setIsOpen(true);
1814
1846
  }
1815
1847
  }, []),
1816
- children: nonFixedTabs.map((current) => /* @__PURE__ */ jsx(Item$1, { tab: current }, current.id))
1848
+ children: nonFixedTabs.map((current) => /* @__PURE__ */ jsx(Item, { tab: current }, current.id))
1817
1849
  }
1818
1850
  ),
1819
1851
  showScrollButtons && /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -1848,23 +1880,23 @@ const TabsList = observer(
1848
1880
  }
1849
1881
  );
1850
1882
 
1851
- var __defProp$d = Object.defineProperty;
1852
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1853
- var __publicField$d = (obj, key, value) => {
1854
- __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
1855
1887
  return value;
1856
1888
  };
1857
- var __accessCheck$a = (obj, member, msg) => {
1889
+ var __accessCheck$b = (obj, member, msg) => {
1858
1890
  if (!member.has(obj))
1859
1891
  throw TypeError("Cannot " + msg);
1860
1892
  };
1861
- var __privateAdd$a = (obj, member, value) => {
1893
+ var __privateAdd$b = (obj, member, value) => {
1862
1894
  if (member.has(obj))
1863
1895
  throw TypeError("Cannot add the same private member more than once");
1864
1896
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1865
1897
  };
1866
1898
  var __privateMethod$2 = (obj, member, method) => {
1867
- __accessCheck$a(obj, member, "access private method");
1899
+ __accessCheck$b(obj, member, "access private method");
1868
1900
  return method;
1869
1901
  };
1870
1902
  var _innerAppend, innerAppend_fn;
@@ -1886,18 +1918,24 @@ class Tab {
1886
1918
  open() {
1887
1919
  this.controller.openTab(this.id);
1888
1920
  }
1921
+ toggle(isShown) {
1922
+ this.controller.toggleTab(this.state.id, isShown);
1923
+ }
1889
1924
  }
1890
1925
  class TabsController {
1891
1926
  constructor(id, props) {
1892
1927
  this.id = id;
1893
1928
  this.props = props;
1894
- __privateAdd$a(this, _innerAppend);
1895
- __publicField$d(this, "state", {
1896
- openTabs: /* @__PURE__ */ new Set(),
1929
+ __privateAdd$b(this, _innerAppend);
1930
+ __publicField$k(this, "state", {
1931
+ isMultiple: false,
1932
+ openTabsHistory: /* @__PURE__ */ new Set(),
1897
1933
  tabs: /* @__PURE__ */ new Map(),
1898
- timestamp: 0
1934
+ timestamp: 0,
1935
+ showAtLeastOneTab: false
1899
1936
  });
1900
- props.initialTabs?.forEach(this.append.bind(this));
1937
+ Object.assign(this.state, props.initialState ?? {});
1938
+ props.initialTabs?.forEach((tab) => this.append(tab));
1901
1939
  if (props.initialTabs && props.initialTabs.length > 0)
1902
1940
  this.focusTab(props.initialTabs[0].id);
1903
1941
  makeAutoObservable(this);
@@ -1909,7 +1947,7 @@ class TabsController {
1909
1947
  * Es el tab que está abierto
1910
1948
  */
1911
1949
  get activeTab() {
1912
- const tabs = [...this.state.openTabs];
1950
+ const tabs = [...this.state.openTabsHistory];
1913
1951
  return tabs[tabs.length - 1];
1914
1952
  }
1915
1953
  getTab(id) {
@@ -1921,7 +1959,7 @@ class TabsController {
1921
1959
  /**
1922
1960
  * Obviamente agrega un tab al listado de tabs
1923
1961
  */
1924
- append(tab) {
1962
+ append(tab, closeOthers) {
1925
1963
  if (this.getTab(tab.id)) {
1926
1964
  void ApiaUtil.instance.dialogs.confirm({
1927
1965
  children: getLabel("msgTabIsOpen").text,
@@ -1932,10 +1970,10 @@ class TabsController {
1932
1970
  ...tab,
1933
1971
  id: `${tab.id}_${uniqueId$2()}`,
1934
1972
  additionalProps: tab.additionalProps ?? {}
1935
- });
1973
+ }, closeOthers);
1936
1974
  });
1937
1975
  } else
1938
- __privateMethod$2(this, _innerAppend, innerAppend_fn).call(this, tab);
1976
+ __privateMethod$2(this, _innerAppend, innerAppend_fn).call(this, tab, closeOthers);
1939
1977
  }
1940
1978
  async closeAll(closeFixedTabsAsWell = false, force = false) {
1941
1979
  for (const tab of this.tabsList) {
@@ -1992,13 +2030,27 @@ class TabsController {
1992
2030
  return false;
1993
2031
  }
1994
2032
  }
1995
- this.state.openTabs.delete(tab);
1996
- this.getActiveTab().open();
2033
+ this.state.openTabsHistory.delete(tab);
2034
+ this.getActiveTab()?.open();
1997
2035
  this.state.tabs.delete(tab.id);
1998
2036
  this.props?.onCloseTab?.(tab);
1999
2037
  }
2000
2038
  return true;
2001
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
+ }
2002
2054
  focusNextTab() {
2003
2055
  const tabsList = this.tabsList;
2004
2056
  const focusedIndex = tabsList.findIndex(
@@ -2021,8 +2073,8 @@ class TabsController {
2021
2073
  this.focusTab(tabsList[newFocusIndex].id);
2022
2074
  return tabsList[newFocusIndex];
2023
2075
  }
2024
- focusTab(tabId) {
2025
- this.openTab(tabId);
2076
+ focusTab(tabId, closeOthers) {
2077
+ this.openTab(tabId, closeOthers);
2026
2078
  }
2027
2079
  getTabElement(tabId) {
2028
2080
  return document.querySelector(`#tabpanel-${this.id}-${tabId}`);
@@ -2106,39 +2158,64 @@ class TabsController {
2106
2158
  /**
2107
2159
  * Se utiliza para hacer que el tab aparezca visible en el listado
2108
2160
  */
2109
- openTab(tabId) {
2161
+ openTab(tabId, closeOthers) {
2110
2162
  const tab = this.getTab(tabId);
2111
2163
  if (!tab) {
2112
2164
  console.warn(`There is no tab with such id: ${tabId}`);
2113
2165
  } else {
2114
2166
  try {
2115
- this.state.tabs.forEach((c) => {
2116
- c.state.isOpen = false;
2117
- });
2167
+ if (closeOthers !== false) {
2168
+ this.state.tabs.forEach((c) => {
2169
+ c.state.isOpen = false;
2170
+ });
2171
+ }
2118
2172
  } catch (e) {
2119
2173
  }
2120
2174
  tab.state.isOpen = true;
2175
+ tab.state.isFocused = true;
2176
+ document.querySelector(`.tabs__item__wrapper[data-id="${tab.id}"]`)?.focus();
2121
2177
  tab.state.onFocus?.(tab);
2122
- if (this.state.openTabs.has(tab)) {
2123
- this.state.openTabs.delete(tab);
2178
+ if (this.state.openTabsHistory.has(tab)) {
2179
+ this.state.openTabsHistory.delete(tab);
2124
2180
  }
2125
- this.state.openTabs.add(tab);
2181
+ this.state.openTabsHistory.add(tab);
2182
+ this.checkAtLeastOneOpen();
2126
2183
  }
2127
2184
  }
2128
2185
  }
2129
2186
  _innerAppend = new WeakSet();
2130
- innerAppend_fn = function(tab) {
2187
+ innerAppend_fn = function(tab, closeOthers = false) {
2131
2188
  this.state.tabs.set(tab.id, new Tab(tab, this));
2132
2189
  if (tab.isOpen) {
2133
- this.openTab(tab.id);
2134
- this.focusTab(tab.id);
2190
+ this.openTab(tab.id, closeOthers);
2191
+ this.focusTab(tab.id, closeOthers);
2135
2192
  }
2193
+ this.checkAtLeastOneOpen();
2136
2194
  };
2137
2195
 
2138
2196
  const InnerRenderer = observer(({ tab }) => {
2139
2197
  const state = tab.state;
2140
2198
  const Render = useDeferredValue(state.content);
2141
- return /* @__PURE__ */ jsxs(
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(
2142
2219
  Box,
2143
2220
  {
2144
2221
  "aria-hidden": !state.isOpen,
@@ -2147,10 +2224,10 @@ const InnerRenderer = observer(({ tab }) => {
2147
2224
  "data-id": state.id,
2148
2225
  id: `tabpanel-${tab.controller.id}-${state.id}`,
2149
2226
  role: "tabpanel",
2150
- children: [
2151
- /* @__PURE__ */ jsx(Render, { tab }),
2152
- state.isLoading && /* @__PURE__ */ jsx(Box, { className: "tabs__content__spinner__wrapper", children: /* @__PURE__ */ jsx(Spinner, {}) })
2153
- ]
2227
+ sx: {
2228
+ display: state.isOpen ? void 0 : "none"
2229
+ },
2230
+ children: accordion ?? tabContent
2154
2231
  },
2155
2232
  state.id
2156
2233
  );
@@ -2160,7 +2237,7 @@ const TabsContent = observer((props) => {
2160
2237
  if (!controller)
2161
2238
  return null;
2162
2239
  return /* @__PURE__ */ jsx(
2163
- Box,
2240
+ Accordion,
2164
2241
  {
2165
2242
  className: "tabs__content__wrapper",
2166
2243
  ...getVariant("layout.common.tabs.primary.content"),
@@ -2177,13 +2254,15 @@ const NonForwardedTabs = ({
2177
2254
  getController,
2178
2255
  initialTabs,
2179
2256
  orientation,
2257
+ initialState,
2180
2258
  ...props
2181
2259
  }, ref) => {
2182
2260
  const [handler, setHandler] = React__default.useState(null);
2183
2261
  useMount(() => {
2184
2262
  const newHandler = new TabsController(String(id), {
2185
2263
  initialTabs,
2186
- orientation: orientation || "horizontal"
2264
+ orientation: orientation || "horizontal",
2265
+ initialState
2187
2266
  });
2188
2267
  setHandler(newHandler);
2189
2268
  getController?.(newHandler);
@@ -2537,54 +2616,54 @@ const AlertModal = ({ children, onClose, title }) => {
2537
2616
  );
2538
2617
  };
2539
2618
 
2540
- var __defProp$c = Object.defineProperty;
2541
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2542
- var __publicField$c = (obj, key, value) => {
2543
- __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
2544
2623
  return value;
2545
2624
  };
2546
- var __accessCheck$9 = (obj, member, msg) => {
2625
+ var __accessCheck$a = (obj, member, msg) => {
2547
2626
  if (!member.has(obj))
2548
2627
  throw TypeError("Cannot " + msg);
2549
2628
  };
2550
- var __privateGet$7 = (obj, member, getter) => {
2551
- __accessCheck$9(obj, member, "read from private field");
2629
+ var __privateGet$8 = (obj, member, getter) => {
2630
+ __accessCheck$a(obj, member, "read from private field");
2552
2631
  return getter ? getter.call(obj) : member.get(obj);
2553
2632
  };
2554
- var __privateAdd$9 = (obj, member, value) => {
2633
+ var __privateAdd$a = (obj, member, value) => {
2555
2634
  if (member.has(obj))
2556
2635
  throw TypeError("Cannot add the same private member more than once");
2557
2636
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2558
2637
  };
2559
2638
  var __privateSet$6 = (obj, member, value, setter) => {
2560
- __accessCheck$9(obj, member, "write to private field");
2561
- setter ? setter.call(obj, value) : member.set(obj, value);
2639
+ __accessCheck$a(obj, member, "write to private field");
2640
+ member.set(obj, value);
2562
2641
  return value;
2563
2642
  };
2564
2643
  var __privateWrapper$1 = (obj, member, setter, getter) => ({
2565
2644
  set _(value) {
2566
- __privateSet$6(obj, member, value, setter);
2645
+ __privateSet$6(obj, member, value);
2567
2646
  },
2568
2647
  get _() {
2569
- return __privateGet$7(obj, member, getter);
2648
+ return __privateGet$8(obj, member, getter);
2570
2649
  }
2571
2650
  });
2572
2651
  var _emitter$3, _maxIdAlert, _maxIdConfirm;
2573
2652
  class ApiaUtilDialogs {
2574
2653
  constructor() {
2575
- __privateAdd$9(this, _emitter$3, new EventEmitter());
2576
- __privateAdd$9(this, _maxIdAlert, 0);
2577
- __privateAdd$9(this, _maxIdConfirm, 0);
2578
- __publicField$c(this, "Component", () => {
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", () => {
2579
2658
  const [confirmDialogs, setConfirmDialogs] = useState([]);
2580
2659
  const [alertsDialogs, setAlertsDialogs] = useState(
2581
2660
  []
2582
2661
  );
2583
2662
  useMount(() => {
2584
- const unsuscribe1 = __privateGet$7(this, _emitter$3).on("alert", (ev) => {
2663
+ const unsuscribe1 = __privateGet$8(this, _emitter$3).on("alert", (ev) => {
2585
2664
  setAlertsDialogs((current) => [...current, ev]);
2586
2665
  });
2587
- const unsuscribe2 = __privateGet$7(this, _emitter$3).on("confirm", (ev) => {
2666
+ const unsuscribe2 = __privateGet$8(this, _emitter$3).on("confirm", (ev) => {
2588
2667
  setConfirmDialogs((current) => [...current, ev]);
2589
2668
  });
2590
2669
  return () => {
@@ -2622,7 +2701,7 @@ class ApiaUtilDialogs {
2622
2701
  }
2623
2702
  alert(props) {
2624
2703
  return new Promise((resolve) => {
2625
- __privateGet$7(this, _emitter$3).emit("alert", {
2704
+ __privateGet$8(this, _emitter$3).emit("alert", {
2626
2705
  ...props,
2627
2706
  onClose: () => resolve(),
2628
2707
  id: `confirm${__privateWrapper$1(this, _maxIdAlert)._++}`
@@ -2631,7 +2710,7 @@ class ApiaUtilDialogs {
2631
2710
  }
2632
2711
  confirm(props) {
2633
2712
  return new Promise((resolve) => {
2634
- __privateGet$7(this, _emitter$3).emit("confirm", {
2713
+ __privateGet$8(this, _emitter$3).emit("confirm", {
2635
2714
  ...props,
2636
2715
  id: `confirm${__privateWrapper$1(this, _maxIdConfirm)._++}`,
2637
2716
  onCancel: () => resolve(false),
@@ -2695,31 +2774,31 @@ function parseStringToApiaNumber(value) {
2695
2774
  )}${decimalsString.length > 0 ? `${decimalSeparator$1}${decimalsString}` : ""}`;
2696
2775
  }
2697
2776
 
2698
- var __accessCheck$8 = (obj, member, msg) => {
2777
+ var __accessCheck$9 = (obj, member, msg) => {
2699
2778
  if (!member.has(obj))
2700
2779
  throw TypeError("Cannot " + msg);
2701
2780
  };
2702
- var __privateAdd$8 = (obj, member, value) => {
2781
+ var __privateAdd$9 = (obj, member, value) => {
2703
2782
  if (member.has(obj))
2704
2783
  throw TypeError("Cannot add the same private member more than once");
2705
2784
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2706
2785
  };
2707
2786
  var __privateMethod$1 = (obj, member, method) => {
2708
- __accessCheck$8(obj, member, "access private method");
2787
+ __accessCheck$9(obj, member, "access private method");
2709
2788
  return method;
2710
2789
  };
2711
2790
  var _parseString, parseString_fn, _findDelimiter, findDelimiter_fn, _parseCellValue, parseCellValue_fn;
2712
2791
  const delimiters = [",", ";", " ", "|"];
2713
2792
  class ApiaUtilParsers {
2714
2793
  constructor() {
2715
- __privateAdd$8(this, _parseString);
2794
+ __privateAdd$9(this, _parseString);
2716
2795
  /**
2717
2796
  * Inspecciona las primeras filas de un array de strings, en búsqueda del mejor delimitador
2718
2797
  * para convertir esos strings a array de datos, que serán el resultado de haber interpretado
2719
2798
  * un documento CSV.
2720
2799
  */
2721
- __privateAdd$8(this, _findDelimiter);
2722
- __privateAdd$8(this, _parseCellValue);
2800
+ __privateAdd$9(this, _findDelimiter);
2801
+ __privateAdd$9(this, _parseCellValue);
2723
2802
  }
2724
2803
  /**
2725
2804
  * Toma un número sin separadores de miles y lo devuelve en el formato
@@ -2857,10 +2936,10 @@ parseCellValue_fn = function(cellValue) {
2857
2936
  return cellValue.match(/^\s*"?([^"]+)"?[\s\r\n]*$/)?.[1] ?? cellValue;
2858
2937
  };
2859
2938
 
2860
- var __defProp$b = Object.defineProperty;
2861
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2862
- var __publicField$b = (obj, key, value) => {
2863
- __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
2864
2943
  return value;
2865
2944
  };
2866
2945
  let maxId = 0;
@@ -2868,32 +2947,32 @@ class ApiaUtilTooltip {
2868
2947
  constructor(props, close) {
2869
2948
  this.props = props;
2870
2949
  this.close = close;
2871
- __publicField$b(this, "id", `tooltip__${maxId++}`);
2950
+ __publicField$i(this, "id", `tooltip__${maxId++}`);
2872
2951
  }
2873
2952
  }
2874
2953
 
2875
- var __defProp$a = Object.defineProperty;
2876
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2877
- var __publicField$a = (obj, key, value) => {
2878
- __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
2879
2958
  return value;
2880
2959
  };
2881
- var __accessCheck$7 = (obj, member, msg) => {
2960
+ var __accessCheck$8 = (obj, member, msg) => {
2882
2961
  if (!member.has(obj))
2883
2962
  throw TypeError("Cannot " + msg);
2884
2963
  };
2885
- var __privateGet$6 = (obj, member, getter) => {
2886
- __accessCheck$7(obj, member, "read from private field");
2964
+ var __privateGet$7 = (obj, member, getter) => {
2965
+ __accessCheck$8(obj, member, "read from private field");
2887
2966
  return getter ? getter.call(obj) : member.get(obj);
2888
2967
  };
2889
- var __privateAdd$7 = (obj, member, value) => {
2968
+ var __privateAdd$8 = (obj, member, value) => {
2890
2969
  if (member.has(obj))
2891
2970
  throw TypeError("Cannot add the same private member more than once");
2892
2971
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2893
2972
  };
2894
2973
  var __privateSet$5 = (obj, member, value, setter) => {
2895
- __accessCheck$7(obj, member, "write to private field");
2896
- setter ? setter.call(obj, value) : member.set(obj, value);
2974
+ __accessCheck$8(obj, member, "write to private field");
2975
+ member.set(obj, value);
2897
2976
  return value;
2898
2977
  };
2899
2978
  var _timeout, _tooltipTimeout, _unsuscribe, _tooltipController, _tooltip;
@@ -2905,30 +2984,30 @@ document?.addEventListener("mousemove", (ev) => {
2905
2984
  class AutomaticTooltip {
2906
2985
  constructor(tooltip = null, handler) {
2907
2986
  this.handler = handler;
2908
- __privateAdd$7(this, _timeout, 500);
2909
- __privateAdd$7(this, _tooltipTimeout, 0);
2910
- __privateAdd$7(this, _unsuscribe, null);
2911
- __privateAdd$7(this, _tooltipController, null);
2912
- __publicField$a(this, "ref", (el) => {
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) => {
2913
2992
  var _a, _b;
2914
- (_a = __privateGet$6(this, _unsuscribe)) == null ? void 0 : _a.call(this);
2993
+ (_a = __privateGet$7(this, _unsuscribe)) == null ? void 0 : _a.call(this);
2915
2994
  const listener = () => {
2916
- clearTimeout(__privateGet$6(this, _tooltipTimeout));
2995
+ clearTimeout(__privateGet$7(this, _tooltipTimeout));
2917
2996
  __privateSet$5(this, _tooltipTimeout, setTimeout(() => {
2918
- if (__privateGet$6(this, _tooltip)?.children)
2997
+ if (__privateGet$7(this, _tooltip)?.children)
2919
2998
  __privateSet$5(this, _tooltipController, this.handler.open({
2920
2999
  closeOnMouseLeaveTooltip: true,
2921
3000
  closeOnEscape: true,
2922
3001
  closeOnScrollOut: true,
2923
- ...__privateGet$6(this, _tooltip),
3002
+ ...__privateGet$7(this, _tooltip),
2924
3003
  anchorPoint: { left: x$1 + 3, top: y$1 + 3 }
2925
3004
  }));
2926
- }, __privateGet$6(this, _timeout)));
3005
+ }, __privateGet$7(this, _timeout)));
2927
3006
  };
2928
3007
  const reset = () => {
2929
- clearTimeout(__privateGet$6(this, _tooltipTimeout));
2930
- if (__privateGet$6(this, _tooltip)?.closeOnMouseLeaveAttachedElement) {
2931
- __privateGet$6(this, _tooltipController)?.close();
3008
+ clearTimeout(__privateGet$7(this, _tooltipTimeout));
3009
+ if (__privateGet$7(this, _tooltip)?.closeOnMouseLeaveAttachedElement) {
3010
+ __privateGet$7(this, _tooltipController)?.close();
2932
3011
  }
2933
3012
  };
2934
3013
  if (el) {
@@ -2939,12 +3018,12 @@ class AutomaticTooltip {
2939
3018
  el.removeEventListener("mouseleave", reset);
2940
3019
  });
2941
3020
  } else {
2942
- (_b = __privateGet$6(this, _unsuscribe)) == null ? void 0 : _b.call(this);
3021
+ (_b = __privateGet$7(this, _unsuscribe)) == null ? void 0 : _b.call(this);
2943
3022
  reset();
2944
3023
  }
2945
3024
  });
2946
- __privateAdd$7(this, _tooltip, null);
2947
- __publicField$a(this, "update", (tooltip) => {
3025
+ __privateAdd$8(this, _tooltip, null);
3026
+ __publicField$h(this, "update", (tooltip) => {
2948
3027
  __privateSet$5(this, _tooltip, tooltip);
2949
3028
  });
2950
3029
  __privateSet$5(this, _tooltip, tooltip);
@@ -3054,19 +3133,23 @@ function calculateTooltipPosition({
3054
3133
  const availableTopSpace = actualAnchorPoint.top;
3055
3134
  const availableLeftSpace = actualAnchorPoint.left;
3056
3135
  const availableRightSpace = window.innerWidth - actualAnchorPoint.left;
3057
- const isEnoughToRight = (minSize?.width ?? 0) <= availableRightSpace;
3058
- const isEnoughToLeft = (minSize?.width ?? 0) <= availableLeftSpace;
3059
- const isEnoughToBottom = (minSize?.height ?? 0) <= availableBottomSpace;
3060
- 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;
3061
3140
  const preferredWidth = preferredSize.width === "auto" ? Infinity : preferredSize.width;
3062
3141
  const preferredHeight = preferredSize.height === "auto" ? Infinity : preferredSize.height;
3063
3142
  const position = {
3064
3143
  "& > *": {
3065
3144
  width: "100%",
3066
- height: "100%"
3145
+ height: "100%",
3146
+ overflow: "auto"
3067
3147
  },
3068
- width: preferredSize.width === "auto" ? "auto" : "100%",
3069
- height: preferredSize.height === "auto" ? "auto" : "100%"
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
3070
3153
  };
3071
3154
  if (preferredOrientationX === "left") {
3072
3155
  if (isEnoughToLeft) {
@@ -3292,21 +3375,21 @@ const Tooltip = ({
3292
3375
  );
3293
3376
  };
3294
3377
 
3295
- var __defProp$9 = Object.defineProperty;
3296
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3297
- var __publicField$9 = (obj, key, value) => {
3298
- __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
3299
3382
  return value;
3300
3383
  };
3301
- var __accessCheck$6 = (obj, member, msg) => {
3384
+ var __accessCheck$7 = (obj, member, msg) => {
3302
3385
  if (!member.has(obj))
3303
3386
  throw TypeError("Cannot " + msg);
3304
3387
  };
3305
- var __privateGet$5 = (obj, member, getter) => {
3306
- __accessCheck$6(obj, member, "read from private field");
3388
+ var __privateGet$6 = (obj, member, getter) => {
3389
+ __accessCheck$7(obj, member, "read from private field");
3307
3390
  return getter ? getter.call(obj) : member.get(obj);
3308
3391
  };
3309
- var __privateAdd$6 = (obj, member, value) => {
3392
+ var __privateAdd$7 = (obj, member, value) => {
3310
3393
  if (member.has(obj))
3311
3394
  throw TypeError("Cannot add the same private member more than once");
3312
3395
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
@@ -3314,16 +3397,16 @@ var __privateAdd$6 = (obj, member, value) => {
3314
3397
  var _emitter$2, _shoutChangedList;
3315
3398
  class ApiaUtilTooltips {
3316
3399
  constructor() {
3317
- __privateAdd$6(this, _emitter$2, new EventEmitter());
3318
- __publicField$9(this, "tooltips", []);
3319
- __privateAdd$6(this, _shoutChangedList, () => {
3320
- __privateGet$5(this, _emitter$2).emit("changedList", [...this.tooltips]);
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]);
3321
3404
  });
3322
3405
  /**
3323
3406
  * Permite crear un tooltip que se abrirá automáticamente al estar parado
3324
3407
  * sobre un elemento durante 300ms
3325
3408
  */
3326
- __publicField$9(this, "useHover", (tooltip) => {
3409
+ __publicField$g(this, "useHover", (tooltip) => {
3327
3410
  let tt = void 0;
3328
3411
  tt = useMemo(() => {
3329
3412
  tt?.ref(null);
@@ -3334,15 +3417,15 @@ class ApiaUtilTooltips {
3334
3417
  });
3335
3418
  return tt;
3336
3419
  });
3337
- __publicField$9(this, "close", (id) => {
3420
+ __publicField$g(this, "close", (id) => {
3338
3421
  this.tooltips = this.tooltips.filter((current) => current.id !== id);
3339
- __privateGet$5(this, _shoutChangedList).call(this);
3422
+ __privateGet$6(this, _shoutChangedList).call(this);
3340
3423
  });
3341
- __publicField$9(this, "closeAll", () => {
3424
+ __publicField$g(this, "closeAll", () => {
3342
3425
  this.tooltips = [];
3343
- __privateGet$5(this, _shoutChangedList).call(this);
3426
+ __privateGet$6(this, _shoutChangedList).call(this);
3344
3427
  });
3345
- __publicField$9(this, "open", (tooltip) => {
3428
+ __publicField$g(this, "open", (tooltip) => {
3346
3429
  const controller = new ApiaUtilTooltip(tooltip, () => {
3347
3430
  this.close(controller.id);
3348
3431
  controller.props.onClose?.();
@@ -3352,13 +3435,13 @@ class ApiaUtilTooltips {
3352
3435
  } else {
3353
3436
  this.tooltips = [...this.tooltips, controller];
3354
3437
  }
3355
- __privateGet$5(this, _shoutChangedList).call(this);
3438
+ __privateGet$6(this, _shoutChangedList).call(this);
3356
3439
  return controller;
3357
3440
  });
3358
- __publicField$9(this, "Component", () => {
3441
+ __publicField$g(this, "Component", () => {
3359
3442
  const [tooltips, setTooltips] = useState(this.tooltips);
3360
3443
  useMount(() => {
3361
- const unsuscribeToList = __privateGet$5(this, _emitter$2).on("changedList", (ev) => {
3444
+ const unsuscribeToList = __privateGet$6(this, _emitter$2).on("changedList", (ev) => {
3362
3445
  setTooltips(ev);
3363
3446
  });
3364
3447
  return () => {
@@ -3383,7 +3466,7 @@ class ApiaUtilTooltips {
3383
3466
  this.tooltips = this.tooltips.filter(
3384
3467
  (current) => current.props.closeOnEscape === false
3385
3468
  );
3386
- __privateGet$5(this, _shoutChangedList).call(this);
3469
+ __privateGet$6(this, _shoutChangedList).call(this);
3387
3470
  }
3388
3471
  });
3389
3472
  }
@@ -3391,36 +3474,36 @@ class ApiaUtilTooltips {
3391
3474
  _emitter$2 = new WeakMap();
3392
3475
  _shoutChangedList = new WeakMap();
3393
3476
 
3394
- var __defProp$8 = Object.defineProperty;
3395
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3396
- var __publicField$8 = (obj, key, value) => {
3397
- __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
3398
3481
  return value;
3399
3482
  };
3400
- var __accessCheck$5 = (obj, member, msg) => {
3483
+ var __accessCheck$6 = (obj, member, msg) => {
3401
3484
  if (!member.has(obj))
3402
3485
  throw TypeError("Cannot " + msg);
3403
3486
  };
3404
- var __privateGet$4 = (obj, member, getter) => {
3405
- __accessCheck$5(obj, member, "read from private field");
3487
+ var __privateGet$5 = (obj, member, getter) => {
3488
+ __accessCheck$6(obj, member, "read from private field");
3406
3489
  return getter ? getter.call(obj) : member.get(obj);
3407
3490
  };
3408
- var __privateAdd$5 = (obj, member, value) => {
3491
+ var __privateAdd$6 = (obj, member, value) => {
3409
3492
  if (member.has(obj))
3410
3493
  throw TypeError("Cannot add the same private member more than once");
3411
3494
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3412
3495
  };
3413
3496
  var __privateSet$4 = (obj, member, value, setter) => {
3414
- __accessCheck$5(obj, member, "write to private field");
3415
- setter ? setter.call(obj, value) : member.set(obj, value);
3497
+ __accessCheck$6(obj, member, "write to private field");
3498
+ member.set(obj, value);
3416
3499
  return value;
3417
3500
  };
3418
3501
  var __privateWrapper = (obj, member, setter, getter) => ({
3419
3502
  set _(value) {
3420
- __privateSet$4(obj, member, value, setter);
3503
+ __privateSet$4(obj, member, value);
3421
3504
  },
3422
3505
  get _() {
3423
- return __privateGet$4(obj, member, getter);
3506
+ return __privateGet$5(obj, member, getter);
3424
3507
  }
3425
3508
  });
3426
3509
  var _emitter$1, _items$1, _hooks, _maxId, _RenderMenu;
@@ -3429,14 +3512,14 @@ function isSubmenu(item) {
3429
3512
  }
3430
3513
  class ApiaUtilMenu {
3431
3514
  constructor() {
3432
- __privateAdd$5(this, _emitter$1, new EventEmitter());
3433
- __privateAdd$5(this, _items$1, []);
3434
- __publicField$8(this, "menuProps", null);
3435
- __privateAdd$5(this, _hooks, {
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, {
3436
3519
  useIsOpen: () => {
3437
3520
  const [isOpen, setIsOpen] = useState(false);
3438
3521
  useMount(() => {
3439
- return __privateGet$4(this, _emitter$1).on("toggle", setIsOpen);
3522
+ return __privateGet$5(this, _emitter$1).on("toggle", setIsOpen);
3440
3523
  });
3441
3524
  return [
3442
3525
  isOpen,
@@ -3446,30 +3529,35 @@ class ApiaUtilMenu {
3446
3529
  ];
3447
3530
  }
3448
3531
  });
3449
- __publicField$8(this, "close", () => {
3450
- __privateGet$4(this, _emitter$1).emit("toggle", false);
3532
+ __publicField$f(this, "close", () => {
3533
+ __privateGet$5(this, _emitter$1).emit("toggle", false);
3451
3534
  });
3452
- __publicField$8(this, "open", ({
3535
+ __publicField$f(this, "open", ({
3453
3536
  menuProps,
3454
3537
  items
3455
3538
  }) => {
3456
3539
  __privateSet$4(this, _items$1, items);
3457
3540
  this.menuProps = menuProps;
3458
- __privateGet$4(this, _emitter$1).emit("toggle", true);
3541
+ __privateGet$5(this, _emitter$1).emit("toggle", true);
3459
3542
  });
3460
- __privateAdd$5(this, _maxId, 0);
3461
- __privateAdd$5(this, _RenderMenu, (submenu) => {
3543
+ __privateAdd$6(this, _maxId, 0);
3544
+ __privateAdd$6(this, _RenderMenu, (submenu) => {
3462
3545
  return /* @__PURE__ */ jsx(Fragment, { children: submenu.items.map((current, i) => {
3463
3546
  if (current === "separator")
3464
3547
  return /* @__PURE__ */ jsx(MenuDivider, {}, `separator${i}`);
3465
3548
  if (isSubmenu(current)) {
3466
- return /* @__PURE__ */ jsx(SubMenu, { label: current.label, children: __privateGet$4(this, _RenderMenu).call(this, current) }, `submenu${__privateWrapper(this, _maxId)._++}`);
3549
+ return /* @__PURE__ */ jsx(SubMenu, { label: current.label, children: __privateGet$5(this, _RenderMenu).call(this, current) }, `submenu${__privateWrapper(this, _maxId)._++}`);
3467
3550
  }
3468
- return /* @__PURE__ */ createElement(MenuItem, { ...current, key: current.key });
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);
3469
3557
  }) });
3470
3558
  });
3471
- __publicField$8(this, "Component", () => {
3472
- const [isOpen, close] = __privateGet$4(this, _hooks).useIsOpen();
3559
+ __publicField$f(this, "Component", () => {
3560
+ const [isOpen, close] = __privateGet$5(this, _hooks).useIsOpen();
3473
3561
  if (!isOpen)
3474
3562
  return null;
3475
3563
  return /* @__PURE__ */ jsx(FreeFocusInside, { children: /* @__PURE__ */ jsx(
@@ -3481,7 +3569,7 @@ class ApiaUtilMenu {
3481
3569
  close();
3482
3570
  this.menuProps?.onClose?.(ev);
3483
3571
  },
3484
- children: __privateGet$4(this, _RenderMenu).call(this, { label: "", items: __privateGet$4(this, _items$1) })
3572
+ children: __privateGet$5(this, _RenderMenu).call(this, { label: "", items: __privateGet$5(this, _items$1) })
3485
3573
  }
3486
3574
  ) });
3487
3575
  });
@@ -3493,17 +3581,17 @@ _hooks = new WeakMap();
3493
3581
  _maxId = new WeakMap();
3494
3582
  _RenderMenu = new WeakMap();
3495
3583
 
3496
- var __defProp$7 = Object.defineProperty;
3497
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3498
- var __publicField$7 = (obj, key, value) => {
3499
- __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
3500
3588
  return value;
3501
3589
  };
3502
3590
  class ApiaUtilMouse extends EventEmitter {
3503
3591
  constructor() {
3504
3592
  super();
3505
- __publicField$7(this, "x", 0);
3506
- __publicField$7(this, "y", 0);
3593
+ __publicField$e(this, "x", 0);
3594
+ __publicField$e(this, "y", 0);
3507
3595
  document.addEventListener("mousemove", (ev) => {
3508
3596
  this.x = ev.clientX;
3509
3597
  this.y = ev.clientY;
@@ -3515,42 +3603,42 @@ class ApiaUtilMouse extends EventEmitter {
3515
3603
  }
3516
3604
  }
3517
3605
 
3518
- var __defProp$6 = Object.defineProperty;
3519
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3520
- var __publicField$6 = (obj, key, value) => {
3521
- __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
3522
3610
  return value;
3523
3611
  };
3524
- var __accessCheck$4 = (obj, member, msg) => {
3612
+ var __accessCheck$5 = (obj, member, msg) => {
3525
3613
  if (!member.has(obj))
3526
3614
  throw TypeError("Cannot " + msg);
3527
3615
  };
3528
- var __privateGet$3 = (obj, member, getter) => {
3529
- __accessCheck$4(obj, member, "read from private field");
3616
+ var __privateGet$4 = (obj, member, getter) => {
3617
+ __accessCheck$5(obj, member, "read from private field");
3530
3618
  return getter ? getter.call(obj) : member.get(obj);
3531
3619
  };
3532
- var __privateAdd$4 = (obj, member, value) => {
3620
+ var __privateAdd$5 = (obj, member, value) => {
3533
3621
  if (member.has(obj))
3534
3622
  throw TypeError("Cannot add the same private member more than once");
3535
3623
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3536
3624
  };
3537
3625
  var __privateSet$3 = (obj, member, value, setter) => {
3538
- __accessCheck$4(obj, member, "write to private field");
3539
- setter ? setter.call(obj, value) : member.set(obj, value);
3626
+ __accessCheck$5(obj, member, "write to private field");
3627
+ member.set(obj, value);
3540
3628
  return value;
3541
3629
  };
3542
3630
  var _instance;
3543
3631
  const _ApiaUtil = class _ApiaUtil {
3544
3632
  constructor() {
3545
- __publicField$6(this, "dialogs");
3546
- __publicField$6(this, "menu");
3547
- __publicField$6(this, "modals");
3548
- __publicField$6(this, "mouse");
3549
- __publicField$6(this, "notifications");
3550
- __publicField$6(this, "parsers");
3551
- __publicField$6(this, "tabs");
3552
- __publicField$6(this, "tooltips");
3553
- __publicField$6(this, "Component", () => {
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", () => {
3554
3642
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3555
3643
  /* @__PURE__ */ jsx(this.dialogs.Component, {}),
3556
3644
  /* @__PURE__ */ jsx(this.modals.Component, {}),
@@ -3569,32 +3657,32 @@ const _ApiaUtil = class _ApiaUtil {
3569
3657
  this.tooltips = new ApiaUtilTooltips();
3570
3658
  }
3571
3659
  static get instance() {
3572
- if (!__privateGet$3(this, _instance)) {
3660
+ if (!__privateGet$4(this, _instance)) {
3573
3661
  __privateSet$3(this, _instance, new _ApiaUtil());
3574
3662
  }
3575
- return __privateGet$3(this, _instance);
3663
+ return __privateGet$4(this, _instance);
3576
3664
  }
3577
3665
  };
3578
3666
  _instance = new WeakMap();
3579
- __privateAdd$4(_ApiaUtil, _instance, void 0);
3667
+ __privateAdd$5(_ApiaUtil, _instance, void 0);
3580
3668
  let ApiaUtil = _ApiaUtil;
3581
3669
 
3582
- var __defProp$5 = Object.defineProperty;
3583
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3584
- var __publicField$5 = (obj, key, value) => {
3585
- __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
3586
3674
  return value;
3587
3675
  };
3588
3676
  class ScreenLocker {
3589
3677
  constructor() {
3590
- __publicField$5(this, "emitter", new StatefulEmitter({
3678
+ __publicField$c(this, "emitter", new StatefulEmitter({
3591
3679
  locks: {
3592
3680
  common: { count: 0 },
3593
3681
  linear: { count: 0 },
3594
3682
  white: { count: 1 }
3595
3683
  }
3596
3684
  }));
3597
- __publicField$5(this, "lock", (options) => {
3685
+ __publicField$c(this, "lock", (options) => {
3598
3686
  this.emitter.setState("locks", (s) => {
3599
3687
  const key = options?.type ?? "common";
3600
3688
  return {
@@ -3610,11 +3698,11 @@ class ScreenLocker {
3610
3698
  };
3611
3699
  });
3612
3700
  });
3613
- __publicField$5(this, "hasReleased", false);
3701
+ __publicField$c(this, "hasReleased", false);
3614
3702
  /**
3615
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.
3616
3704
  */
3617
- __publicField$5(this, "release", () => {
3705
+ __publicField$c(this, "release", () => {
3618
3706
  if (this.hasReleased)
3619
3707
  return;
3620
3708
  this.hasReleased = true;
@@ -3630,11 +3718,11 @@ class ScreenLocker {
3630
3718
  /**
3631
3719
  * This method notifies when the screenLock is released by the first time.
3632
3720
  */
3633
- __publicField$5(this, "onRelease", this.emitter.on.bind(this.emitter, "release"));
3721
+ __publicField$c(this, "onRelease", this.emitter.on.bind(this.emitter, "release"));
3634
3722
  /**
3635
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.
3636
3724
  */
3637
- __publicField$5(this, "Component", () => {
3725
+ __publicField$c(this, "Component", () => {
3638
3726
  const locks = this.emitter.useState("locks");
3639
3727
  const style = {
3640
3728
  alignItems: "center",
@@ -3682,7 +3770,7 @@ const OptionsBox = observer(() => {
3682
3770
  if (c.filtered) {
3683
3771
  return /* @__PURE__ */ jsx(Fragment, {}, c.value);
3684
3772
  } else {
3685
- return /* @__PURE__ */ jsx(
3773
+ return /* @__PURE__ */ jsxs(
3686
3774
  Box,
3687
3775
  {
3688
3776
  className: `autocomplete__option ${handler.focusedIndex === i ? "focused" : ""}`,
@@ -3696,7 +3784,10 @@ const OptionsBox = observer(() => {
3696
3784
  });
3697
3785
  },
3698
3786
  "data-value": c.value,
3699
- children: c.label
3787
+ children: [
3788
+ c.label,
3789
+ " \xA0"
3790
+ ]
3700
3791
  },
3701
3792
  c.value
3702
3793
  );
@@ -3704,43 +3795,44 @@ const OptionsBox = observer(() => {
3704
3795
  }) });
3705
3796
  });
3706
3797
 
3707
- var __defProp$4 = Object.defineProperty;
3708
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3709
- var __publicField$4 = (obj, key, value) => {
3710
- __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
3711
3802
  return value;
3712
3803
  };
3713
- var __accessCheck$3 = (obj, member, msg) => {
3804
+ var __accessCheck$4 = (obj, member, msg) => {
3714
3805
  if (!member.has(obj))
3715
3806
  throw TypeError("Cannot " + msg);
3716
3807
  };
3717
- var __privateGet$2 = (obj, member, getter) => {
3718
- __accessCheck$3(obj, member, "read from private field");
3808
+ var __privateGet$3 = (obj, member, getter) => {
3809
+ __accessCheck$4(obj, member, "read from private field");
3719
3810
  return getter ? getter.call(obj) : member.get(obj);
3720
3811
  };
3721
- var __privateAdd$3 = (obj, member, value) => {
3812
+ var __privateAdd$4 = (obj, member, value) => {
3722
3813
  if (member.has(obj))
3723
3814
  throw TypeError("Cannot add the same private member more than once");
3724
3815
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3725
3816
  };
3726
3817
  var __privateSet$2 = (obj, member, value, setter) => {
3727
- __accessCheck$3(obj, member, "write to private field");
3728
- setter ? setter.call(obj, value) : member.set(obj, value);
3818
+ __accessCheck$4(obj, member, "write to private field");
3819
+ member.set(obj, value);
3729
3820
  return value;
3730
3821
  };
3731
3822
  var _actualSearch, _makeSearch, _search;
3732
3823
  class AutocompleteController {
3733
3824
  constructor(properties) {
3734
- __publicField$4(this, "state", {
3825
+ __publicField$b(this, "state", {
3735
3826
  disabled: false,
3736
3827
  id: uniqueId$3("autocomplete"),
3737
3828
  loading: false,
3738
3829
  options: [],
3739
3830
  searchDebounce: 100,
3740
3831
  showValue: "",
3741
- value: ""
3832
+ value: "",
3833
+ width: 55
3742
3834
  });
3743
- __privateAdd$3(this, _actualSearch, (str) => {
3835
+ __privateAdd$4(this, _actualSearch, (str) => {
3744
3836
  this.state.options.forEach((c) => {
3745
3837
  if (this.state.caseInsensitive) {
3746
3838
  c.filtered = (c.searchLabel ?? c.label?.toString?.() ?? c.value).toLowerCase().indexOf(str.toLowerCase()) === -1;
@@ -3752,14 +3844,16 @@ class AutocompleteController {
3752
3844
  }
3753
3845
  });
3754
3846
  });
3755
- __privateAdd$3(this, _makeSearch, () => {
3756
- return debounce(__privateGet$2(this, _actualSearch), this.state.searchDebounce);
3847
+ __privateAdd$4(this, _makeSearch, () => {
3848
+ return debounce(__privateGet$3(this, _actualSearch), this.state.searchDebounce);
3757
3849
  });
3758
- __privateAdd$3(this, _search, __privateGet$2(this, _makeSearch).call(this));
3759
- __publicField$4(this, "tooltipRef", null);
3850
+ __privateAdd$4(this, _search, __privateGet$3(this, _makeSearch).call(this));
3851
+ __publicField$b(this, "tooltipRef", null);
3760
3852
  Object.assign(this.state, properties);
3761
3853
  if (properties.value) {
3762
- this.state.showValue = properties.value;
3854
+ this.state.showValue = String(
3855
+ properties.options?.find((c) => c.value === properties.value)?.label
3856
+ ) || properties.value;
3763
3857
  this.state.focusedValue = properties.value;
3764
3858
  }
3765
3859
  makeAutoObservable(this, {
@@ -3769,7 +3863,7 @@ class AutocompleteController {
3769
3863
  reaction(
3770
3864
  () => this.state.searchDebounce,
3771
3865
  () => {
3772
- __privateSet$2(this, _search, __privateGet$2(this, _makeSearch).call(this));
3866
+ __privateSet$2(this, _search, __privateGet$3(this, _makeSearch).call(this));
3773
3867
  }
3774
3868
  );
3775
3869
  reaction(
@@ -3799,7 +3893,7 @@ class AutocompleteController {
3799
3893
  close(selectValue = true) {
3800
3894
  this.tooltipRef?.close();
3801
3895
  this.tooltipRef = null;
3802
- __privateGet$2(this, _actualSearch).call(this, "");
3896
+ __privateGet$3(this, _actualSearch).call(this, "");
3803
3897
  if (selectValue) {
3804
3898
  let currentValue = this.state.options.find(
3805
3899
  (c) => c.value === this.state.focusedValue
@@ -3902,6 +3996,10 @@ class AutocompleteController {
3902
3996
  this.tooltipRef = null;
3903
3997
  this.close();
3904
3998
  },
3999
+ minSize: {
4000
+ height: Math.min(4, this.state.options.length) * 28,
4001
+ width: this.state.width
4002
+ },
3905
4003
  preferredOrientationY: "bottom",
3906
4004
  preferredOrientationX: "right",
3907
4005
  attachToElementAnchorPoint: "bottomLeft",
@@ -3918,7 +4016,11 @@ class AutocompleteController {
3918
4016
  }
3919
4017
  }
3920
4018
  search(str) {
3921
- __privateGet$2(this, _search).call(this, str);
4019
+ if (this.state.disabled) {
4020
+ return;
4021
+ }
4022
+ this.state.showValue = str;
4023
+ __privateGet$3(this, _search).call(this, str);
3922
4024
  }
3923
4025
  selectFocused() {
3924
4026
  this.close();
@@ -3927,12 +4029,21 @@ class AutocompleteController {
3927
4029
  this.setValue(newValue);
3928
4030
  }
3929
4031
  }
3930
- setValue(value) {
4032
+ async setValue(value) {
4033
+ if (this.state.disabled) {
4034
+ return;
4035
+ }
3931
4036
  const selectedOption = this.state.options.find((c) => c.value === value);
3932
- this.state.value = selectedOption?.value || "";
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;
3933
4045
  this.state.focusedValue = this.state.value;
3934
4046
  this.state.showValue = selectedOption?.label?.toString?.() || selectedOption?.value || "";
3935
- this.state.onChange?.(this.state.value, this);
3936
4047
  }
3937
4048
  }
3938
4049
  _actualSearch = new WeakMap();
@@ -3942,6 +4053,7 @@ _search = new WeakMap();
3942
4053
  const SearchBox = observer(() => {
3943
4054
  const handler = useAutocompleteContext();
3944
4055
  const breakpoint = useBreakpointIndex();
4056
+ const inputRef = useRef(null);
3945
4057
  return /* @__PURE__ */ jsxs(Box, { className: "autocomplete__inputWrapper", children: [
3946
4058
  /* @__PURE__ */ jsx(
3947
4059
  "input",
@@ -3964,12 +4076,13 @@ const SearchBox = observer(() => {
3964
4076
  /* @__PURE__ */ jsx(
3965
4077
  Input,
3966
4078
  {
4079
+ ref: inputRef,
3967
4080
  className: `autocomplete__search ${handler.state.disabled ? "disabled" : ""}`,
3968
4081
  onChange: (ev) => {
3969
4082
  handler.search(ev.target.value);
3970
- handler.state.showValue = ev.target.value;
3971
4083
  },
3972
4084
  onMouseDown: () => {
4085
+ handler.state.width = inputRef.current?.getBoundingClientRect().width ?? handler.state.width;
3973
4086
  handler.toggleOpen();
3974
4087
  },
3975
4088
  onFocus: (ev) => {
@@ -4073,6 +4186,10 @@ const Autocomplete = (props) => {
4073
4186
  props.getHandler?.(newHandler);
4074
4187
  setHandler(newHandler);
4075
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
+ }
4076
4193
  if (!handler) {
4077
4194
  return null;
4078
4195
  }
@@ -4416,36 +4533,36 @@ const Checkbox$1 = forwardRef(
4416
4533
  );
4417
4534
  Checkbox$1.displayName = "Checkbox";
4418
4535
 
4419
- var __defProp$3 = Object.defineProperty;
4420
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4421
- var __publicField$3 = (obj, key, value) => {
4422
- __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
4423
4540
  return value;
4424
4541
  };
4425
- var __accessCheck$2 = (obj, member, msg) => {
4542
+ var __accessCheck$3 = (obj, member, msg) => {
4426
4543
  if (!member.has(obj))
4427
4544
  throw TypeError("Cannot " + msg);
4428
4545
  };
4429
- var __privateGet$1 = (obj, member, getter) => {
4430
- __accessCheck$2(obj, member, "read from private field");
4546
+ var __privateGet$2 = (obj, member, getter) => {
4547
+ __accessCheck$3(obj, member, "read from private field");
4431
4548
  return getter ? getter.call(obj) : member.get(obj);
4432
4549
  };
4433
- var __privateAdd$2 = (obj, member, value) => {
4550
+ var __privateAdd$3 = (obj, member, value) => {
4434
4551
  if (member.has(obj))
4435
4552
  throw TypeError("Cannot add the same private member more than once");
4436
4553
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4437
4554
  };
4438
4555
  var __privateSet$1 = (obj, member, value, setter) => {
4439
- __accessCheck$2(obj, member, "write to private field");
4440
- setter ? setter.call(obj, value) : member.set(obj, value);
4556
+ __accessCheck$3(obj, member, "write to private field");
4557
+ member.set(obj, value);
4441
4558
  return value;
4442
4559
  };
4443
4560
  var _onFocusCallbacks, _a;
4444
4561
  const historySize = 50;
4445
4562
  const globalFocus = new (_a = class {
4446
4563
  constructor() {
4447
- __publicField$3(this, "focused", []);
4448
- __privateAdd$2(this, _onFocusCallbacks, []);
4564
+ __publicField$a(this, "focused", []);
4565
+ __privateAdd$3(this, _onFocusCallbacks, []);
4449
4566
  debugDispatcher.on(
4450
4567
  "focusHistory",
4451
4568
  () => {
@@ -4455,12 +4572,12 @@ const globalFocus = new (_a = class {
4455
4572
  );
4456
4573
  }
4457
4574
  offFocus(cb) {
4458
- __privateSet$1(this, _onFocusCallbacks, __privateGet$1(this, _onFocusCallbacks).filter((current) => {
4575
+ __privateSet$1(this, _onFocusCallbacks, __privateGet$2(this, _onFocusCallbacks).filter((current) => {
4459
4576
  return current !== cb;
4460
4577
  }));
4461
4578
  }
4462
4579
  onFocus(cb) {
4463
- __privateGet$1(this, _onFocusCallbacks).push(cb);
4580
+ __privateGet$2(this, _onFocusCallbacks).push(cb);
4464
4581
  return () => {
4465
4582
  this.offFocus(cb);
4466
4583
  };
@@ -4477,7 +4594,7 @@ const globalFocus = new (_a = class {
4477
4594
  if (this.focused.length > historySize) {
4478
4595
  this.focused = this.focused.splice(0, historySize);
4479
4596
  }
4480
- __privateGet$1(this, _onFocusCallbacks).forEach((cb) => {
4597
+ __privateGet$2(this, _onFocusCallbacks).forEach((cb) => {
4481
4598
  return cb();
4482
4599
  });
4483
4600
  }
@@ -4754,7 +4871,7 @@ const DateInput = React__default.forwardRef(
4754
4871
  ...props,
4755
4872
  className: "dateInput",
4756
4873
  value: renderLabel ? renderLabel(inputValue) : inputValue,
4757
- ref,
4874
+ inputRef: ref,
4758
4875
  onChange: (ev) => {
4759
4876
  setInputValue(ev.target.value);
4760
4877
  if (getMaskForDateFormat().replaceAll("9", DEFAULT_MASK_PLACEHOLDER) !== ev.target.value && ev.target.value !== "")
@@ -4800,7 +4917,9 @@ const DateInput = React__default.forwardRef(
4800
4917
  `#DateInput${id} input`
4801
4918
  )?.focus();
4802
4919
  },
4803
- type: "button"
4920
+ type: "button",
4921
+ title: getLabel("btnAiDelete").text,
4922
+ "aria-label": getLabel("btnAiDelete").text
4804
4923
  }
4805
4924
  ),
4806
4925
  [id, onDelete, setCalendarValue]
@@ -5010,7 +5129,7 @@ const RequiredMark = ({
5010
5129
  isRequired = false,
5011
5130
  isReadonly = false
5012
5131
  }) => {
5013
- return isRequired && !isReadonly && !isFormReadonly ? /* @__PURE__ */ jsx("abbr", { className: "requiredMark", title: getLabel("msgReqField").text, children: "*" }) : null;
5132
+ return isRequired && !isReadonly && !isFormReadonly ? /* @__PURE__ */ jsx("span", { className: "requiredMark", title: getLabel("msgReqField").text, children: "*" }) : null;
5014
5133
  };
5015
5134
 
5016
5135
  injectStyles("layout.common.components.fieldLabel", {
@@ -5123,6 +5242,7 @@ const AutoEllipsis = ({
5123
5242
  return;
5124
5243
  unsuscribe.current();
5125
5244
  function showBox() {
5245
+ document.querySelectorAll(".autoellipsis_clone").forEach((c) => c.remove());
5126
5246
  clone.current = el.cloneNode(true);
5127
5247
  const target = findParent?.(el) ?? el;
5128
5248
  const styles = window.getComputedStyle(target);
@@ -5684,9 +5804,28 @@ const ContainerWithHeader = ({
5684
5804
  );
5685
5805
  };
5686
5806
 
5687
- const styles$3 = {};
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
+ };
5688
5827
 
5689
- injectStyles("layout.common.components.collapsiblePanel", styles$3);
5828
+ injectStyles("layout.common.components.collapsiblePanel", collapsiblePanel);
5690
5829
  const CollapsiblePanel = React__default.forwardRef(
5691
5830
  ({
5692
5831
  children,
@@ -5704,7 +5843,8 @@ const CollapsiblePanel = React__default.forwardRef(
5704
5843
  rememberCollapsedState,
5705
5844
  titleButtons,
5706
5845
  minHeight = 0,
5707
- "aria-hidden": ariaHidden
5846
+ "aria-hidden": ariaHidden,
5847
+ collapseIconToRight
5708
5848
  }, outerRef) => {
5709
5849
  const prefix = React__default.useMemo(() => id ? "" : uniqueId$2(), []);
5710
5850
  const actualId = `${prefix}_${id ?? "collapsiblePanel"}`;
@@ -5778,8 +5918,9 @@ const CollapsiblePanel = React__default.forwardRef(
5778
5918
  type: "button",
5779
5919
  className: "collapsiblePanel__label__button",
5780
5920
  children: [
5781
- isCollapsed ? /* @__PURE__ */ jsx(Icon$1, { title: "", icon: openIcon, size: iconSize }) : /* @__PURE__ */ jsx(Icon$1, { title: "", icon: closedIcon, size: iconSize }),
5782
- /* @__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 }) })
5783
5924
  ]
5784
5925
  }
5785
5926
  ),
@@ -5866,35 +6007,35 @@ const ListboxItem = memo(
5866
6007
  );
5867
6008
  ListboxItem.displayName = "ListboxItem";
5868
6009
 
5869
- var __defProp$2 = Object.defineProperty;
5870
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5871
- var __publicField$2 = (obj, key, value) => {
5872
- __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
5873
6014
  return value;
5874
6015
  };
5875
- var __accessCheck$1 = (obj, member, msg) => {
6016
+ var __accessCheck$2 = (obj, member, msg) => {
5876
6017
  if (!member.has(obj))
5877
6018
  throw TypeError("Cannot " + msg);
5878
6019
  };
5879
- var __privateAdd$1 = (obj, member, value) => {
6020
+ var __privateAdd$2 = (obj, member, value) => {
5880
6021
  if (member.has(obj))
5881
6022
  throw TypeError("Cannot add the same private member more than once");
5882
6023
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
5883
6024
  };
5884
6025
  var __privateMethod = (obj, member, method) => {
5885
- __accessCheck$1(obj, member, "access private method");
6026
+ __accessCheck$2(obj, member, "access private method");
5886
6027
  return method;
5887
6028
  };
5888
6029
  var _restoreTimeout, restoreTimeout_fn, _shout, shout_fn;
5889
6030
  class WaiTypeAhead extends EventEmitter {
5890
6031
  constructor(props) {
5891
6032
  super();
5892
- __privateAdd$1(this, _restoreTimeout);
5893
- __privateAdd$1(this, _shout);
5894
- __publicField$2(this, "frequency", 2.5);
6033
+ __privateAdd$2(this, _restoreTimeout);
6034
+ __privateAdd$2(this, _shout);
6035
+ __publicField$9(this, "frequency", 2.5);
5895
6036
  // Keys per second
5896
- __publicField$2(this, "timeout", 0);
5897
- __publicField$2(this, "typing", "");
6037
+ __publicField$9(this, "timeout", 0);
6038
+ __publicField$9(this, "typing", "");
5898
6039
  const { onMultipleKeys, onSingleKey, onTypeUpdate } = props ?? {};
5899
6040
  if (onMultipleKeys)
5900
6041
  this.on("multipleKeys", onMultipleKeys);
@@ -6705,7 +6846,6 @@ const LinearLoader = () => {
6705
6846
  }
6706
6847
  );
6707
6848
  };
6708
- var LinearLoader$1 = LinearLoader;
6709
6849
 
6710
6850
  const ProgressBar = ({
6711
6851
  id,
@@ -6739,12 +6879,11 @@ const ProgressBar = ({
6739
6879
  )
6740
6880
  ] });
6741
6881
  };
6742
- var ProgressBar$1 = ProgressBar;
6743
6882
 
6744
6883
  const styles$1 = {
6745
6884
  height: "iconmd",
6746
6885
  width: "iconmd",
6747
- background: "palette.background.paper"
6886
+ background: "transparent"
6748
6887
  };
6749
6888
  const LoaderSpinner = makeStyledComponent(
6750
6889
  "LoaderSpinner",
@@ -6760,7 +6899,6 @@ const LoaderSpinner = makeStyledComponent(
6760
6899
  );
6761
6900
  }
6762
6901
  );
6763
- var LoaderSpinner$1 = LoaderSpinner;
6764
6902
 
6765
6903
  const shimmer = keyframes`
6766
6904
  0% {
@@ -7434,9 +7572,7 @@ const IconsListNonForwarded = (props, ref) => {
7434
7572
  "layout.common.components.iconsList",
7435
7573
  styles,
7436
7574
  styledComponent
7437
- ),
7438
- debounce: 50
7439
- });
7575
+ )});
7440
7576
  return Component;
7441
7577
  }, []);
7442
7578
  if (previousProps.current?.iconWidth !== props.iconWidth) {
@@ -7462,7 +7598,14 @@ function importComponent(path) {
7462
7598
  /* webpackInclude: /\.tsx?$/ */
7463
7599
  `/customComponents/${path}`
7464
7600
  ).then((result) => {
7465
- resolve(result.default);
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
+ });
7466
7609
  }).catch((error) => {
7467
7610
  resolve({
7468
7611
  default: () => {
@@ -7475,18 +7618,18 @@ function importComponent(path) {
7475
7618
  });
7476
7619
  }
7477
7620
 
7478
- var __defProp$1 = Object.defineProperty;
7479
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7480
- var __publicField$1 = (obj, key, value) => {
7481
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
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);
7482
7625
  return value;
7483
7626
  };
7484
7627
  class ToolbarController extends EventEmitter {
7485
7628
  constructor() {
7486
7629
  super(...arguments);
7487
- __publicField$1(this, "eventListeners", {});
7488
- __publicField$1(this, "itemsState", {});
7489
- __publicField$1(this, "hooks", {
7630
+ __publicField$8(this, "eventListeners", {});
7631
+ __publicField$8(this, "itemsState", {});
7632
+ __publicField$8(this, "hooks", {
7490
7633
  useItemState: (id, initialState) => {
7491
7634
  const [state, setState] = useState(initialState);
7492
7635
  useEffect(() => {
@@ -7500,11 +7643,11 @@ class ToolbarController extends EventEmitter {
7500
7643
  return state;
7501
7644
  }
7502
7645
  });
7503
- __publicField$1(this, "setItemState", (id, newState) => {
7646
+ __publicField$8(this, "setItemState", (id, newState) => {
7504
7647
  this.itemsState[id] = { ...this.itemsState[id], ...newState };
7505
7648
  this.emit("updateItemState", id);
7506
7649
  });
7507
- __publicField$1(this, "Context", ({ children }) => {
7650
+ __publicField$8(this, "Context", ({ children }) => {
7508
7651
  return /* @__PURE__ */ jsx(ToolbarControllerContext.Provider, { value: this, children });
7509
7652
  });
7510
7653
  }
@@ -7675,28 +7818,28 @@ const Toolbar = ({
7675
7818
  ) });
7676
7819
  };
7677
7820
 
7678
- var __defProp = Object.defineProperty;
7679
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7680
- var __publicField = (obj, key, value) => {
7681
- __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);
7682
7825
  return value;
7683
7826
  };
7684
- var __accessCheck = (obj, member, msg) => {
7827
+ var __accessCheck$1 = (obj, member, msg) => {
7685
7828
  if (!member.has(obj))
7686
7829
  throw TypeError("Cannot " + msg);
7687
7830
  };
7688
- var __privateGet = (obj, member, getter) => {
7689
- __accessCheck(obj, member, "read from private field");
7831
+ var __privateGet$1 = (obj, member, getter) => {
7832
+ __accessCheck$1(obj, member, "read from private field");
7690
7833
  return getter ? getter.call(obj) : member.get(obj);
7691
7834
  };
7692
- var __privateAdd = (obj, member, value) => {
7835
+ var __privateAdd$1 = (obj, member, value) => {
7693
7836
  if (member.has(obj))
7694
7837
  throw TypeError("Cannot add the same private member more than once");
7695
7838
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7696
7839
  };
7697
7840
  var __privateSet = (obj, member, value, setter) => {
7698
- __accessCheck(obj, member, "write to private field");
7699
- setter ? setter.call(obj, value) : member.set(obj, value);
7841
+ __accessCheck$1(obj, member, "write to private field");
7842
+ member.set(obj, value);
7700
7843
  return value;
7701
7844
  };
7702
7845
  var _emitter, _items, _moveItem;
@@ -7707,27 +7850,27 @@ function getTargetItem(ev) {
7707
7850
  }
7708
7851
  class SortableListHandler {
7709
7852
  constructor() {
7710
- __privateAdd(this, _emitter, new EventEmitter());
7711
- __privateAdd(this, _items, []);
7712
- __publicField(this, "updateChildren", (items) => {
7853
+ __privateAdd$1(this, _emitter, new EventEmitter());
7854
+ __privateAdd$1(this, _items, []);
7855
+ __publicField$7(this, "updateChildren", (items) => {
7713
7856
  __privateSet(this, _items, Children.toArray(items).filter(
7714
7857
  (el) => isValidElement(el)
7715
7858
  ));
7716
7859
  });
7717
- __privateAdd(this, _moveItem, (movingId, idBefore, after) => {
7860
+ __privateAdd$1(this, _moveItem, (movingId, idBefore, after) => {
7718
7861
  if (movingId === idBefore)
7719
7862
  return;
7720
- const itemIndex = __privateGet(this, _items).findIndex(
7863
+ const itemIndex = __privateGet$1(this, _items).findIndex(
7721
7864
  (search) => search.props.id === movingId
7722
7865
  );
7723
- const item = __privateGet(this, _items).splice(itemIndex, 1)[0];
7724
- 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(
7725
7868
  (search) => search.props.id === idBefore
7726
7869
  );
7727
- __privateGet(this, _items).splice(insertIndex + (after ? 1 : 0), 0, item);
7728
- __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);
7729
7872
  });
7730
- __publicField(this, "useItemEvents", () => {
7873
+ __publicField$7(this, "useItemEvents", () => {
7731
7874
  const unsuscribe = useRef(() => {
7732
7875
  });
7733
7876
  const ref = useCallback((el) => {
@@ -7738,7 +7881,7 @@ class SortableListHandler {
7738
7881
  };
7739
7882
  const handleDrop = (ev) => {
7740
7883
  const target = getTargetItem(ev);
7741
- __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"));
7742
7885
  target.classList.remove("dragover");
7743
7886
  target.classList.remove("after");
7744
7887
  };
@@ -7769,16 +7912,16 @@ class SortableListHandler {
7769
7912
  }, []);
7770
7913
  return ref;
7771
7914
  });
7772
- __publicField(this, "useSortChange", (onSortChange) => {
7915
+ __publicField$7(this, "useSortChange", (onSortChange) => {
7773
7916
  useSubscription({
7774
7917
  makeSubscription: () => {
7775
- return __privateGet(this, _emitter).on("sort", () => {
7776
- onSortChange?.([...__privateGet(this, _items)]);
7918
+ return __privateGet$1(this, _emitter).on("sort", () => {
7919
+ onSortChange?.([...__privateGet$1(this, _items)]);
7777
7920
  });
7778
7921
  }
7779
7922
  });
7780
7923
  });
7781
- __publicField(this, "useWrapperEvents", () => {
7924
+ __publicField$7(this, "useWrapperEvents", () => {
7782
7925
  const unsuscribe = useRef(() => {
7783
7926
  });
7784
7927
  const ref = useCallback((el) => {
@@ -7891,5 +8034,1690 @@ const SortableList = makeStyledComponent(
7891
8034
  UnstyledSortableList
7892
8035
  );
7893
8036
 
7894
- 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, IconButton, IconInput, IconsList, LabelBox, LinearLoader$1 as LinearLoader, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner$1 as LoaderSpinner, Modal, NumberInput, Overlay, ProgressBar$1 as ProgressBar, RequiredMark, ScreenLocker, SimpleButton, SortableList, SortableListItem, Tab, Tabs, TabsContent, TabsController, TabsList, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, WaiTypeAhead, getFieldErrorStyles, getFieldTouchedStyles, importComponent, makeResponsiveComponent, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useModal, useModalContext, useOtherTagButton };
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
+ "&apos;"
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 };
7895
9723
  //# sourceMappingURL=index.js.map