funda-ui 4.2.375 → 4.2.445

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.
@@ -4199,7 +4199,7 @@ var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_re
4199
4199
  var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
4200
4200
  // EXTERNAL MODULE: ../Utils/dist/cjs/index.js
4201
4201
  var cjs = __webpack_require__(456);
4202
- ;// CONCATENATED MODULE: ./src/MenuList.tsx
4202
+ ;// CONCATENATED MODULE: ./src/ItemList.tsx
4203
4203
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4204
4204
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4205
4205
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -4212,8 +4212,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4212
4212
  /* Recursively nested components to traverse nodes
4213
4213
  -------------------------------------------------*/
4214
4214
 
4215
- function MenuList(props) {
4216
- var alternateCollapse = props.alternateCollapse,
4215
+ function ItemList(props) {
4216
+ var root = props.root,
4217
+ alternateCollapse = props.alternateCollapse,
4217
4218
  first = props.first,
4218
4219
  arrow = props.arrow,
4219
4220
  childClassName = props.childClassName,
@@ -4268,6 +4269,7 @@ function MenuList(props) {
4268
4269
  };
4269
4270
  function handleClick(e) {
4270
4271
  e.preventDefault();
4272
+ e.stopPropagation();
4271
4273
  var hyperlink = e.currentTarget;
4272
4274
  var url = hyperlink.getAttribute('href');
4273
4275
  var subElement = (0,cjs.getNextSiblings)(hyperlink, 'ul');
@@ -4321,48 +4323,50 @@ function MenuList(props) {
4321
4323
  }));
4322
4324
  }
4323
4325
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
4324
- // Activate current item
4325
- //=====================
4326
- var allItems = rootRef.current ? [].slice.call(document.querySelectorAll(".".concat(childClassName, " a"))).map(function (item) {
4327
- var _item$parentNode$clas;
4328
- return {
4329
- href: item.getAttribute('href'),
4330
- el: item,
4331
- actived: (_item$parentNode$clas = item.parentNode.classList) !== null && _item$parentNode$clas !== void 0 && _item$parentNode$clas.contains('active') ? true : false,
4332
- expandedLink: document.body.contains(item.parentNode.parentNode.previousSibling) ? item.parentNode.parentNode.previousSibling : false
4333
- };
4334
- }) : [];
4335
- allItems.forEach(function (hyperlink) {
4336
- // Expand the currently active item by default
4337
- if (hyperlink.actived) {
4338
- hyperlink.el.setAttribute('aria-expanded', 'true');
4339
- if (hyperlink.expandedLink) {
4340
- var expandedLink = hyperlink.expandedLink; // <a>
4341
- activeClass(expandedLink.parentNode, 'add');
4342
- expandedLink.setAttribute('aria-expanded', true);
4343
- }
4344
-
4345
- // init <ul> height
4346
- var ul = (0,cjs.getNextSiblings)(hyperlink.el, 'ul');
4347
- [].slice.call(ul).forEach(function (_curUl) {
4348
- var allHeight = [].slice.call(_curUl.querySelectorAll('li')).map(function (_curLi) {
4349
- return _curLi.scrollHeight;
4350
- });
4326
+ if (root !== null && data.length > 0) {
4327
+ // Activate current item
4328
+ //=====================
4329
+ var allItems = rootRef.current ? [].slice.call(root.querySelectorAll(".".concat(childClassName, " a"))).map(function (item) {
4330
+ var _item$parentNode$clas;
4331
+ return {
4332
+ href: item.getAttribute('href'),
4333
+ el: item,
4334
+ actived: (_item$parentNode$clas = item.parentNode.classList) !== null && _item$parentNode$clas !== void 0 && _item$parentNode$clas.contains('active') ? true : false,
4335
+ expandedLink: document.body.contains(item.parentNode.parentNode.previousSibling) ? item.parentNode.parentNode.previousSibling : false
4336
+ };
4337
+ }) : [];
4338
+ allItems.forEach(function (hyperlink) {
4339
+ // Expand the currently active item by default
4340
+ if (hyperlink.actived) {
4341
+ hyperlink.el.setAttribute('aria-expanded', 'true');
4342
+ if (hyperlink.expandedLink) {
4343
+ var expandedLink = hyperlink.expandedLink; // <a>
4344
+ activeClass(expandedLink.parentNode, 'add');
4345
+ expandedLink.setAttribute('aria-expanded', true);
4346
+ }
4351
4347
 
4352
- // Prevent missing height, causing the last element to be clipped
4353
- var maxHeight = Math.max.apply(Math, _toConsumableArray(allHeight));
4354
- allHeight.push(maxHeight * 3);
4348
+ // init <ul> height
4349
+ var ul = (0,cjs.getNextSiblings)(hyperlink.el, 'ul');
4350
+ [].slice.call(ul).forEach(function (_curUl) {
4351
+ var allHeight = [].slice.call(_curUl.querySelectorAll('li')).map(function (_curLi) {
4352
+ return _curLi.scrollHeight;
4353
+ });
4355
4354
 
4356
- //
4357
- var totalHeight = allHeight.reduce(function (accumulator, currentValue) {
4358
- return accumulator + currentValue;
4359
- }, 0);
4355
+ // Prevent missing height, causing the last element to be clipped
4356
+ var maxHeight = Math.max.apply(Math, _toConsumableArray(allHeight));
4357
+ allHeight.push(maxHeight * 3);
4360
4358
 
4361
- // Prevent the use of iframe or other situations where the height is 0
4362
- _curUl.style.maxHeight = "".concat(totalHeight == 0 ? 999 : totalHeight, "px");
4363
- });
4364
- }
4365
- });
4359
+ //
4360
+ var totalHeight = allHeight.reduce(function (accumulator, currentValue) {
4361
+ return accumulator + currentValue;
4362
+ }, 0);
4363
+
4364
+ // Prevent the use of iframe or other situations where the height is 0
4365
+ _curUl.style.maxHeight = "".concat(totalHeight == 0 ? 999 : totalHeight, "px");
4366
+ });
4367
+ }
4368
+ });
4369
+ }
4366
4370
  }, [data]);
4367
4371
  if (data) {
4368
4372
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("ul", {
@@ -4417,9 +4421,10 @@ function MenuList(props) {
4417
4421
  dangerouslySetInnerHTML: {
4418
4422
  __html: "".concat(item.title)
4419
4423
  }
4420
- }), item.children ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
4424
+ }), item.children && item.children.length > 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
4421
4425
  className: "arrow"
4422
- }, arrowGenerator()) : ''), item.children && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(MenuList, {
4426
+ }, arrowGenerator()) : ''), item.children && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(ItemList, {
4427
+ root: root,
4423
4428
  data: item.children,
4424
4429
  first: false,
4425
4430
  arrow: arrow,
@@ -4450,6 +4455,7 @@ var MultilevelDropdownMenu = function MultilevelDropdownMenu(props) {
4450
4455
  data = props.data,
4451
4456
  id = props.id,
4452
4457
  onSelect = props.onSelect;
4458
+ var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
4453
4459
  var uniqueID = (0,cjs.useComId)();
4454
4460
  var idRes = id || uniqueID;
4455
4461
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
@@ -4461,8 +4467,10 @@ var MultilevelDropdownMenu = function MultilevelDropdownMenu(props) {
4461
4467
  }, [data]);
4462
4468
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("nav", {
4463
4469
  id: idRes,
4464
- className: navbarClassName ? navbarClassName : "navbar"
4465
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(MenuList, {
4470
+ className: navbarClassName ? navbarClassName : "navbar",
4471
+ ref: rootRef
4472
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(ItemList, {
4473
+ root: rootRef.current,
4466
4474
  alternateCollapse: alternateCollapse,
4467
4475
  first: true,
4468
4476
  arrow: arrow,
@@ -4,6 +4,7 @@ export interface OptionConfig {
4
4
  }
5
5
  declare type MultipleSelectProps = {
6
6
  wrapperClassName?: string;
7
+ childClassName?: string;
7
8
  wrapperMinHeight?: string;
8
9
  wrapperMinWidth?: string;
9
10
  availableHeaderTitle?: string;
@@ -16,6 +17,8 @@ declare type MultipleSelectProps = {
16
17
  hierarchical?: boolean;
17
18
  indentation?: string;
18
19
  doubleIndent?: boolean;
20
+ alternateCollapse?: boolean;
21
+ arrow?: React.ReactNode;
19
22
  value?: string;
20
23
  label?: React.ReactNode | string;
21
24
  name?: string;