@redneckz/wildless-cms-uni-blocks 0.14.261 → 0.14.263

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/bundle/bundle.umd.js +6 -4
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/StickyBottomMenu/StickyBottomMenuDialog.d.ts +9 -0
  4. package/bundle/components/StickyBottomMenu/useBottomMenuItemDialog.d.ts +19 -0
  5. package/bundle/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -1
  6. package/bundle/data/StickyMobileData.d.ts +2 -2
  7. package/dist/components/OfficesAtmsMap/renderWorkSchedule.js +5 -3
  8. package/dist/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
  9. package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js +22 -42
  10. package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
  11. package/dist/components/StickyBottomMenu/StickyBottomMenuDialog.d.ts +9 -0
  12. package/dist/components/StickyBottomMenu/StickyBottomMenuDialog.js +17 -0
  13. package/dist/components/StickyBottomMenu/StickyBottomMenuDialog.js.map +1 -0
  14. package/dist/components/StickyBottomMenu/useBottomMenuItemDialog.d.ts +19 -0
  15. package/dist/components/StickyBottomMenu/useBottomMenuItemDialog.js +15 -0
  16. package/dist/components/StickyBottomMenu/useBottomMenuItemDialog.js.map +1 -0
  17. package/dist/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -1
  18. package/dist/components/StickyBottomMenu/useBurgerMenuDialog.js +1 -1
  19. package/dist/components/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -1
  20. package/dist/data/StickyMobileData.d.ts +2 -2
  21. package/lib/common.css +1 -1
  22. package/lib/components/OfficesAtmsMap/renderWorkSchedule.js +5 -3
  23. package/lib/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
  24. package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js +23 -43
  25. package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
  26. package/lib/components/StickyBottomMenu/StickyBottomMenuDialog.d.ts +9 -0
  27. package/lib/components/StickyBottomMenu/StickyBottomMenuDialog.js +15 -0
  28. package/lib/components/StickyBottomMenu/StickyBottomMenuDialog.js.map +1 -0
  29. package/lib/components/StickyBottomMenu/useBottomMenuItemDialog.d.ts +19 -0
  30. package/lib/components/StickyBottomMenu/useBottomMenuItemDialog.js +12 -0
  31. package/lib/components/StickyBottomMenu/useBottomMenuItemDialog.js.map +1 -0
  32. package/lib/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -1
  33. package/lib/components/StickyBottomMenu/useBurgerMenuDialog.js +1 -1
  34. package/lib/components/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -1
  35. package/lib/data/StickyMobileData.d.ts +2 -2
  36. package/mobile/bundle/bundle.umd.js +54 -52
  37. package/mobile/bundle/bundle.umd.min.js +1 -1
  38. package/mobile/bundle/components/StickyBottomMenu/StickyBottomMenuDialog.d.ts +9 -0
  39. package/mobile/bundle/components/StickyBottomMenu/useBottomMenuItemDialog.d.ts +19 -0
  40. package/mobile/bundle/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -1
  41. package/mobile/bundle/data/StickyMobileData.d.ts +2 -2
  42. package/mobile/dist/components/OfficesAtmsMap/renderWorkSchedule.js +5 -3
  43. package/mobile/dist/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
  44. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js +22 -42
  45. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
  46. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuDialog.d.ts +9 -0
  47. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuDialog.js +17 -0
  48. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuDialog.js.map +1 -0
  49. package/mobile/dist/components/StickyBottomMenu/useBottomMenuItemDialog.d.ts +19 -0
  50. package/mobile/dist/components/StickyBottomMenu/useBottomMenuItemDialog.js +15 -0
  51. package/mobile/dist/components/StickyBottomMenu/useBottomMenuItemDialog.js.map +1 -0
  52. package/mobile/dist/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -1
  53. package/mobile/dist/components/StickyBottomMenu/useBurgerMenuDialog.js +1 -1
  54. package/mobile/dist/components/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -1
  55. package/mobile/dist/data/StickyMobileData.d.ts +2 -2
  56. package/mobile/lib/common.css +1 -1
  57. package/mobile/lib/components/OfficesAtmsMap/renderWorkSchedule.js +5 -3
  58. package/mobile/lib/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
  59. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js +23 -43
  60. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
  61. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuDialog.d.ts +9 -0
  62. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuDialog.js +15 -0
  63. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuDialog.js.map +1 -0
  64. package/mobile/lib/components/StickyBottomMenu/useBottomMenuItemDialog.d.ts +19 -0
  65. package/mobile/lib/components/StickyBottomMenu/useBottomMenuItemDialog.js +12 -0
  66. package/mobile/lib/components/StickyBottomMenu/useBottomMenuItemDialog.js.map +1 -0
  67. package/mobile/lib/components/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -1
  68. package/mobile/lib/components/StickyBottomMenu/useBurgerMenuDialog.js +1 -1
  69. package/mobile/lib/components/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -1
  70. package/mobile/lib/data/StickyMobileData.d.ts +2 -2
  71. package/mobile/src/components/OfficesAtmsMap/renderWorkSchedule.tsx +12 -5
  72. package/mobile/src/components/StickyBottomMenu/StickyBottomMenu.tsx +27 -67
  73. package/mobile/src/components/StickyBottomMenu/StickyBottomMenuDialog.tsx +39 -0
  74. package/mobile/src/components/StickyBottomMenu/useBottomMenuItemDialog.tsx +54 -0
  75. package/mobile/src/components/StickyBottomMenu/useBurgerMenuDialog.tsx +1 -2
  76. package/mobile/src/data/StickyMobileData.ts +2 -2
  77. package/package.json +1 -1
  78. package/src/components/OfficesAtmsMap/renderWorkSchedule.tsx +12 -5
  79. package/src/components/StickyBottomMenu/StickyBottomMenu.mobile.tsx +27 -67
  80. package/src/components/StickyBottomMenu/StickyBottomMenuDialog.tsx +39 -0
  81. package/src/components/StickyBottomMenu/useBottomMenuItemDialog.tsx +54 -0
  82. package/src/components/StickyBottomMenu/useBurgerMenuDialog.tsx +1 -2
  83. package/src/data/StickyMobileData.ts +2 -2
@@ -1,16 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
- import { useCallback, useEffect, useRef, useState } from '@redneckz/uni-jsx/lib/hooks';
3
- import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
2
+ import { useCallback, useRef, useState } from '@redneckz/uni-jsx/lib/hooks';
4
3
  import { useOutsideClick } from '@redneckz/uni-jsx/lib/hooks/useOutsideClick';
5
4
  import { BlockWrapper } from '../../ui-kit/BlockWrapper.js';
6
- import { Dialog } from '../../ui-kit/DialogManager/Dialog.js';
7
- import { Heading } from '../../ui-kit/Heading/Heading.js';
8
5
  import { UniBlock } from '../../UniBlock/UniBlock.js';
9
6
  import { StickyBottomMenuBurger } from './StickyBottomMenuBurger.js';
10
7
  import { StickyBottomMenuItem } from './StickyBottomMenuItem.js';
8
+ import { useBottomMenuItemDialog } from './useBottomMenuItemDialog.js';
11
9
  import { useBurgerMenuDialog } from './useBurgerMenuDialog.js';
12
10
  const EMPTY_MENU = [];
13
- // eslint-disable-next-line max-lines-per-function
14
11
  export const StickyBottomMenu = UniBlock(({ sticky, ...rest }) => {
15
12
  const { menuItems = EMPTY_MENU } = sticky ?? {};
16
13
  const [isBurgerMenuDialogOpen, { toggle, close, openDialog }] = useBurgerMenuDialog(rest.options?.page?.sitemap ?? {});
@@ -19,56 +16,39 @@ export const StickyBottomMenu = UniBlock(({ sticky, ...rest }) => {
19
16
  const rightItems = menuItems.slice(middleIdx);
20
17
  const [activeIndex, setActiveIndex] = useState(-1);
21
18
  const [currentItemPosition, setCurrentItemPosition] = useState('');
22
- const [popupDialogState, { setFalse: setPopupDialogClosed, setTrue: setPopupDialogOpened }] = useBool();
23
- const closePopupDialog = useCallback(() => {
24
- setPopupDialogClosed();
19
+ const closeDialog = useCallback(() => {
25
20
  setActiveIndex(-1);
26
21
  setCurrentItemPosition('');
27
22
  close();
28
23
  }, [close]);
29
24
  const menuRef = useRef(null);
30
- const popupDialogRef = useOutsideClick(closePopupDialog);
31
- const openPopupDialog = useCallback((index, itemsPosition) => {
32
- setPopupDialogOpened();
33
- close();
34
- openDialog(_jsx(Dialog, { onClick: (e) => e.stopPropagation(), className: "mt-[20%]", onClose: closePopupDialog, head: _jsx("div", { className: "flex items-center", children: _jsx(Heading, { as: "h4", title: itemsPosition === 'left' ? leftItems[index].title : rightItems[index].title }) }), children: _jsx("div", { className: "bg-white pb-24 pt-1 text-l", ref: popupDialogRef }) }), {
35
- id: itemsPosition === 'left' ? leftItems[index].title : rightItems[index].title,
36
- });
37
- }, [close, closePopupDialog]);
25
+ const dialogRef = useOutsideClick(closeDialog);
26
+ const [{ openBottomMenuItemDialog }] = useBottomMenuItemDialog({
27
+ menuRef,
28
+ dialogRef,
29
+ closeDialog,
30
+ openDialog,
31
+ leftItems,
32
+ rightItems,
33
+ });
34
+ const handleMenuBurgerClick = useCallback((e) => {
35
+ closeDialog();
36
+ e.stopPropagation();
37
+ toggle();
38
+ }, [closeDialog, toggle]);
38
39
  const handleMenuItemClick = useCallback((index, itemsPosition) => {
39
40
  setCurrentItemPosition(itemsPosition);
40
41
  setActiveIndex(index);
41
- openPopupDialog(index, itemsPosition);
42
- }, [openPopupDialog]);
43
- useEffect(() => {
44
- if (!popupDialogRef.current) {
45
- return;
46
- }
47
- if (!popupDialogRef.current.shadowRoot) {
48
- popupDialogRef.current?.attachShadow({ mode: 'open' });
49
- }
50
- const shadowRoot = popupDialogRef.current.shadowRoot;
51
- if (!shadowRoot) {
52
- return;
53
- }
54
- if (currentItemPosition === 'left') {
55
- shadowRoot.innerHTML = leftItems[activeIndex]?.__html || '';
56
- }
57
- else {
58
- shadowRoot.innerHTML = rightItems[activeIndex]?.__html || '';
59
- }
60
- }, [activeIndex, currentItemPosition, popupDialogState]);
61
- return (_jsx(BlockWrapper, { className: "h-[74px] z-[100] relative", defaultPadding: "p-0", ...rest, children: _jsxs("div", { ref: menuRef, className: "ml-auto container bg-white flex justify-center shadow-blue-gray", children: [leftItems.map(renderMenuItem(handleMenuItemClick, 'left', { activeIndex, currentItemPosition })), _jsx(StickyBottomMenuBurger, { isActive: isBurgerMenuDialogOpen, onClick: (e) => {
62
- closePopupDialog();
63
- e.stopPropagation();
64
- toggle();
65
- } }), rightItems.map(renderMenuItem(handleMenuItemClick, 'right', { activeIndex, currentItemPosition }))] }) }));
42
+ close();
43
+ openBottomMenuItemDialog(index, itemsPosition);
44
+ }, [close, openBottomMenuItemDialog]);
45
+ return (_jsx(BlockWrapper, { className: "h-[74px] z-[100] relative", defaultPadding: "p-0", ...rest, children: _jsxs("div", { ref: menuRef, className: "ml-auto container bg-white flex justify-center shadow-blue-gray", children: [leftItems.map(renderMenuItem(handleMenuItemClick, 'left', { activeIndex, currentItemPosition })), _jsx(StickyBottomMenuBurger, { isActive: isBurgerMenuDialogOpen, onClick: (e) => handleMenuBurgerClick(e) }), rightItems.map(renderMenuItem(handleMenuItemClick, 'right', { activeIndex, currentItemPosition }))] }) }));
66
46
  });
67
- const renderMenuItem = (handleMenuItemClick, itemsPosition, currentActiveItem) => (_, i, arr) => {
47
+ const renderMenuItem = (onClick, itemsPosition, currentActiveItem) => (_, i, arr) => {
68
48
  return (_jsx(StickyBottomMenuItem, { item: _, isActive: arr[currentActiveItem.activeIndex]?.title === _?.title &&
69
49
  currentActiveItem.currentItemPosition === itemsPosition, onClick: (e) => {
70
50
  e.stopPropagation();
71
- handleMenuItemClick(i, itemsPosition);
51
+ onClick(i, itemsPosition);
72
52
  } }, _.title || String(i)));
73
53
  };
74
54
  //# sourceMappingURL=StickyBottomMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StickyBottomMenu.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,GAAG,EAAE,CAAC;AAOtB,kDAAkD;AAClD,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAwB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACtF,MAAM,EAAE,SAAS,GAAG,UAAU,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;IAChD,MAAM,CAAC,sBAAsB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,GAAG,mBAAmB,CACjF,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,EAAE,CAClC,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AAS,EAAC,iEAAiE,aAE1E,SAAS,CAAC,GAAG,CACZ,cAAc,CAAC,mBAAmB,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC,CAClF,EACD,KAAC,sBAAsB,IACrB,QAAQ,EAAE,sBAAsB,EAChC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC,GACxC,EACD,UAAU,CAAC,GAAG,CACb,cAAc,CAAC,mBAAmB,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC,CACnF,IACG,GACO,CAChB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,cAAc,GAClB,CACE,OAAuD,EACvD,aAAqB,EACrB,iBAAoC,EACpC,EAAE,CACJ,CAAC,CAAiB,EAAE,CAAS,EAAE,GAAqB,EAAE,EAAE;IACtD,OAAO,CACL,KAAC,oBAAoB,IAEnB,IAAI,EAAE,CAAC,EACP,QAAQ,EACN,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,KAAK;YACtD,iBAAiB,CAAC,mBAAmB,KAAK,aAAa,EAEzD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,OAAO,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;QAC5B,CAAC,IATI,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC,CAUzB,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type VNode } from '../../model/VNode';
2
+ import { type PreventableEvent } from '../../ui-kit/PreventableEvent';
3
+ export interface StickyBottomMenuDialogProps {
4
+ className?: string;
5
+ head?: VNode;
6
+ onClose?: () => void;
7
+ onClick?: (e: PreventableEvent) => void;
8
+ }
9
+ export declare const StickyBottomMenuDialog: import("@redneckz/uni-jsx").UNIComponent<StickyBottomMenuDialogProps, any, any>;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
+ import { JSX } from '@redneckz/uni-jsx';
3
+ import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
4
+ import { CloseButton } from '../../ui-kit/DialogManager/CloseButton.js';
5
+ import { useDialogManager } from '../../ui-kit/DialogManager/useDialogManager.js';
6
+ import { style } from '../../utils/style.js';
7
+ export const StickyBottomMenuDialog = JSX(({ className, head, children, onClose, onClick }) => {
8
+ const { close } = useDialogManager();
9
+ const handleClose = useCallback(() => {
10
+ close();
11
+ onClose && onClose();
12
+ }, [onClose]);
13
+ return (_jsxs("div", { onClick: onClick, className: style('relative min-h-full bg-white p-0 rounded-xl mt-[20%]', className), role: "dialog", children: [_jsxs("div", { className: "sticky py-xl top-0 rounded-xl bg-white z-10", children: [_jsx(CloseButton, { className: "absolute top-1.5 right-0", onClose: handleClose }), _jsx("div", { className: "container", children: head })] }), _jsx("div", { className: "container pb-6xl", children: children })] }));
14
+ });
15
+ //# sourceMappingURL=StickyBottomMenuDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StickyBottomMenuDialog.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/StickyBottomMenuDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAE/E,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAS1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CACvC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;IAClD,MAAM,EAAE,KAAK,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAErC,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,KAAK,EAAE,CAAC;QACR,OAAO,IAAI,OAAO,EAAE,CAAC;IACvB,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,CACL,eACE,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,KAAK,CAAC,sDAAsD,EAAE,SAAS,CAAC,EACnF,IAAI,EAAC,QAAQ,aAEb,eAAK,SAAS,EAAC,6CAA6C,aAC1D,KAAC,WAAW,IAAC,SAAS,EAAC,0BAA0B,EAAC,OAAO,EAAE,WAAW,GAAI,EAC1E,cAAK,SAAS,EAAC,WAAW,YAAE,IAAI,GAAO,IACnC,EACN,cAAK,SAAS,EAAC,kBAAkB,YAAE,QAAQ,GAAO,IAC9C,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { type StickyMenuItem } from '../../data/StickyMobileData';
2
+ import { type VNode } from '../../model/VNode';
3
+ import { type DialogOptions } from '../../ui-kit/DialogManager/useDialogManager';
4
+ interface BottomMenuItemDialog {
5
+ menuRef?: {
6
+ current: HTMLDivElement | null;
7
+ };
8
+ dialogRef?: {
9
+ current: HTMLDivElement | null;
10
+ };
11
+ closeDialog: () => void;
12
+ openDialog: (dialog: VNode, options: DialogOptions) => void;
13
+ leftItems: StickyMenuItem[];
14
+ rightItems: StickyMenuItem[];
15
+ }
16
+ export declare const useBottomMenuItemDialog: ({ menuRef, dialogRef, closeDialog, openDialog, leftItems, rightItems, }: BottomMenuItemDialog) => {
17
+ openBottomMenuItemDialog: (index: number, itemsPosition: string) => void;
18
+ }[];
19
+ export {};
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
+ import { Heading } from '../../ui-kit/Heading/Heading.js';
3
+ import { StickyBottomMenuDialog } from './StickyBottomMenuDialog.js';
4
+ export const useBottomMenuItemDialog = ({ menuRef, dialogRef, closeDialog, openDialog, leftItems, rightItems, }) => {
5
+ const openBottomMenuItemDialog = (index, itemsPosition) => {
6
+ const requiredArray = itemsPosition === 'left' ? leftItems : rightItems;
7
+ const menuDimensions = menuRef?.current?.getBoundingClientRect();
8
+ openDialog(_jsx(StickyBottomMenuDialog, { onClick: (e) => e.stopPropagation(), onClose: closeDialog, head: _jsx("div", { className: "flex items-center px-xl", children: _jsx(Heading, { as: "h4", title: requiredArray[index].title }) }), children: _jsx("div", { className: "bg-white pb-20 pt-1 text-l", ref: dialogRef, children: _jsx("iframe", { src: requiredArray[index]?.src, className: "min-h-[90vh]", width: menuDimensions?.width || 0 }) }) }), { id: itemsPosition === 'left' ? leftItems[index].title : rightItems[index].title });
9
+ };
10
+ return [{ openBottomMenuItemDialog }];
11
+ };
12
+ //# sourceMappingURL=useBottomMenuItemDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBottomMenuItemDialog.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/useBottomMenuItemDialog.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAelE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,OAAO,EACP,SAAS,EACT,WAAW,EACX,UAAU,EACV,SAAS,EACT,UAAU,GACW,EAAE,EAAE;IACzB,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAAE,aAAqB,EAAE,EAAE;QACxE,MAAM,aAAa,GAAG,aAAa,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;QACxE,MAAM,cAAc,GAAG,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;QACjE,UAAU,CACR,KAAC,sBAAsB,IACrB,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,EACnC,OAAO,EAAE,WAAW,EACpB,IAAI,EACF,cAAK,SAAS,EAAC,yBAAyB,YACtC,KAAC,OAAO,IAAC,EAAE,EAAC,IAAI,EAAC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,KAAK,GAAI,GAClD,YAGR,cAAK,SAAS,EAAC,4BAA4B,EAAC,GAAG,EAAE,SAAS,YACxD,iBACE,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,GAAG,EAC9B,SAAS,EAAC,cAAc,EACxB,KAAK,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC,GACjC,GACE,GACiB,EACzB,EAAE,EAAE,EAAE,aAAa,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CACpF,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,wBAAwB,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC"}
@@ -3,7 +3,6 @@ import { type DialogOptions } from '../../ui-kit/DialogManager/useDialogManager'
3
3
  import { type BurgerMenuDialogProps } from './BurgerMenuDialog';
4
4
  export declare const BURGER_MENU_DIALOG_ID = "burgerMenuDialog";
5
5
  export declare const useBurgerMenuDialog: (props: BurgerMenuDialogProps) => [boolean, {
6
- open: () => void;
7
6
  close: () => void;
8
7
  toggle: () => void;
9
8
  openDialog: (dialog: VNode, options: DialogOptions) => void;
@@ -17,6 +17,6 @@ export const useBurgerMenuDialog = (props) => {
17
17
  open();
18
18
  }
19
19
  };
20
- return [isBurgerMenuOpen, { open, close, toggle, openDialog }];
20
+ return [isBurgerMenuOpen, { close, toggle, openDialog }];
21
21
  };
22
22
  //# sourceMappingURL=useBurgerMenuDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBurgerMenuDialog.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/useBurgerMenuDialog.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAsB,MAAM,6CAA6C,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAA8B,MAAM,oBAAoB,CAAC;AAElF,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAA4B,EAS5B,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAEjE,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,MAAM,gBAAgB,GAAG,YAAY,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;IAEtE,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,KAAC,gBAAgB,OAAK,KAAK,GAAI,EAAE,EAAE,EAAE,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAC9F,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,gBAAgB,EAAE;YACpB,QAAQ,EAAE,CAAC;SACZ;aAAM;YACL,IAAI,EAAE,CAAC;SACR;IACH,CAAC,CAAC;IAEF,OAAO,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;AACjE,CAAC,CAAC"}
1
+ {"version":3,"file":"useBurgerMenuDialog.js","sourceRoot":"","sources":["../../../src/components/StickyBottomMenu/useBurgerMenuDialog.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAsB,MAAM,6CAA6C,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAA8B,MAAM,oBAAoB,CAAC;AAElF,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAA4B,EAQ5B,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAEjE,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,MAAM,gBAAgB,GAAG,YAAY,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;IAEtE,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,KAAC,gBAAgB,OAAK,KAAK,GAAI,EAAE,EAAE,EAAE,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAC9F,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,gBAAgB,EAAE;YACpB,QAAQ,EAAE,CAAC;SACZ;aAAM;YACL,IAAI,EAAE,CAAC;SACR;IACH,CAAC,CAAC;IAEF,OAAO,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;AAC3D,CAAC,CAAC"}
@@ -5,8 +5,8 @@ import { type Picture } from '../model/Picture';
5
5
  export interface StickyMenuItem {
6
6
  /** @title Название */
7
7
  title?: string;
8
- /** @title Html */
9
- __html?: string;
8
+ /** @title Адрес страницы меню */
9
+ src?: string;
10
10
  /** @title Иконка */
11
11
  icon?: Picture;
12
12
  }
@@ -5,6 +5,7 @@ import { type WorkSchedule } from './OfficesAtmsMapProps';
5
5
  export const renderWorkSchedule = (workSchedule?: WorkSchedule) => {
6
6
  const workScheduleWeek = getWorkScheduleWeek(workSchedule);
7
7
  const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
8
+ const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
8
9
 
9
10
  if (!workSchedule) {
10
11
  return null;
@@ -14,18 +15,24 @@ export const renderWorkSchedule = (workSchedule?: WorkSchedule) => {
14
15
  return renderMatchingTimeOfWork(timeOfWork);
15
16
  }
16
17
 
17
- if (workSchedule.businessScheduleVisibleTag && !workSchedule.businessScheduleDescription) {
18
+ if (
19
+ workSchedule.businessScheduleVisibleTag &&
20
+ workSchedule.businessScheduleDescription === null
21
+ ) {
18
22
  return renderIndividualTimeOfWork(timeOfWork);
19
23
  }
20
24
 
21
- return renderDefaultTimeOfWork(timeOfWork);
25
+ return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
22
26
  };
23
27
 
24
28
  const renderIndividualTimeOfWork = (timeOfWork: string[] | '') =>
25
29
  `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
26
30
 
27
- const renderDefaultTimeOfWork = (timeOfWork: string[] | '') =>
28
- `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${timeOfWork}</p>`;
29
-
30
31
  const renderMatchingTimeOfWork = (timeOfWork: string[] | '') =>
31
32
  `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
33
+
34
+ const renderDefaultTimeOfWork = (
35
+ timeOfWork: string[] | '',
36
+ businessTimeOfWork: string | undefined,
37
+ ) =>
38
+ `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
@@ -1,14 +1,13 @@
1
- import { useCallback, useEffect, useRef, useState } from '@redneckz/uni-jsx/lib/hooks';
2
- import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
1
+ import { useCallback, useRef, useState } from '@redneckz/uni-jsx/lib/hooks';
3
2
  import { useOutsideClick } from '@redneckz/uni-jsx/lib/hooks/useOutsideClick';
4
3
  import { type StickyMenuItem } from '../../data/StickyMobileData';
5
4
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
6
- import { Dialog } from '../../ui-kit/DialogManager/Dialog';
7
- import { Heading } from '../../ui-kit/Heading/Heading';
5
+ import { type PreventableEvent } from '../../ui-kit/PreventableEvent';
8
6
  import { UniBlock } from '../../UniBlock/UniBlock';
9
7
  import { StickyBottomMenuBurger } from './StickyBottomMenuBurger';
10
8
  import { StickyBottomMenuItem } from './StickyBottomMenuItem';
11
9
  import { type StickyBottomMenuProps } from './StickyBottomMenuProps';
10
+ import { useBottomMenuItemDialog } from './useBottomMenuItemDialog';
12
11
  import { useBurgerMenuDialog } from './useBurgerMenuDialog';
13
12
 
14
13
  const EMPTY_MENU = [];
@@ -18,7 +17,6 @@ interface CurrentActiveItem {
18
17
  currentItemPosition: string;
19
18
  }
20
19
 
21
- // eslint-disable-next-line max-lines-per-function
22
20
  export const StickyBottomMenu = UniBlock<StickyBottomMenuProps>(({ sticky, ...rest }) => {
23
21
  const { menuItems = EMPTY_MENU } = sticky ?? {};
24
22
  const [isBurgerMenuDialogOpen, { toggle, close, openDialog }] = useBurgerMenuDialog(
@@ -31,78 +29,44 @@ export const StickyBottomMenu = UniBlock<StickyBottomMenuProps>(({ sticky, ...re
31
29
 
32
30
  const [activeIndex, setActiveIndex] = useState(-1);
33
31
  const [currentItemPosition, setCurrentItemPosition] = useState<string>('');
34
- const [popupDialogState, { setFalse: setPopupDialogClosed, setTrue: setPopupDialogOpened }] =
35
- useBool();
36
32
 
37
- const closePopupDialog = useCallback(() => {
38
- setPopupDialogClosed();
33
+ const closeDialog = useCallback(() => {
39
34
  setActiveIndex(-1);
40
35
  setCurrentItemPosition('');
41
36
  close();
42
37
  }, [close]);
43
38
 
44
39
  const menuRef = useRef<HTMLDivElement | null>(null);
45
- const popupDialogRef = useOutsideClick<HTMLDivElement>(closePopupDialog);
46
-
47
- const openPopupDialog = useCallback(
48
- (index: number, itemsPosition: string) => {
49
- setPopupDialogOpened();
50
- close();
51
-
52
- openDialog(
53
- <Dialog
54
- onClick={(e) => e.stopPropagation()}
55
- className="mt-[20%]"
56
- onClose={closePopupDialog}
57
- head={
58
- <div className="flex items-center">
59
- <Heading
60
- as="h4"
61
- title={itemsPosition === 'left' ? leftItems[index].title : rightItems[index].title}
62
- />
63
- </div>
64
- }
65
- >
66
- <div className="bg-white pb-24 pt-1 text-l" ref={popupDialogRef}></div>
67
- </Dialog>,
68
- {
69
- id: itemsPosition === 'left' ? leftItems[index].title : rightItems[index].title,
70
- },
71
- );
40
+ const dialogRef = useOutsideClick<HTMLDivElement>(closeDialog);
41
+
42
+ const [{ openBottomMenuItemDialog }] = useBottomMenuItemDialog({
43
+ menuRef,
44
+ dialogRef,
45
+ closeDialog,
46
+ openDialog,
47
+ leftItems,
48
+ rightItems,
49
+ });
50
+
51
+ const handleMenuBurgerClick = useCallback(
52
+ (e: PreventableEvent) => {
53
+ closeDialog();
54
+ e.stopPropagation();
55
+ toggle();
72
56
  },
73
- [close, closePopupDialog],
57
+ [closeDialog, toggle],
74
58
  );
75
59
 
76
60
  const handleMenuItemClick = useCallback(
77
61
  (index: number, itemsPosition: string) => {
78
62
  setCurrentItemPosition(itemsPosition);
79
63
  setActiveIndex(index);
80
- openPopupDialog(index, itemsPosition);
64
+ close();
65
+ openBottomMenuItemDialog(index, itemsPosition);
81
66
  },
82
- [openPopupDialog],
67
+ [close, openBottomMenuItemDialog],
83
68
  );
84
69
 
85
- useEffect(() => {
86
- if (!popupDialogRef.current) {
87
- return;
88
- }
89
-
90
- if (!popupDialogRef.current.shadowRoot) {
91
- popupDialogRef.current?.attachShadow({ mode: 'open' });
92
- }
93
-
94
- const shadowRoot = popupDialogRef.current.shadowRoot;
95
- if (!shadowRoot) {
96
- return;
97
- }
98
-
99
- if (currentItemPosition === 'left') {
100
- shadowRoot.innerHTML = leftItems[activeIndex]?.__html || '';
101
- } else {
102
- shadowRoot.innerHTML = rightItems[activeIndex]?.__html || '';
103
- }
104
- }, [activeIndex, currentItemPosition, popupDialogState]);
105
-
106
70
  return (
107
71
  <BlockWrapper className="h-[74px] z-[100] relative" defaultPadding="p-0" {...rest}>
108
72
  <div
@@ -114,11 +78,7 @@ export const StickyBottomMenu = UniBlock<StickyBottomMenuProps>(({ sticky, ...re
114
78
  )}
115
79
  <StickyBottomMenuBurger
116
80
  isActive={isBurgerMenuDialogOpen}
117
- onClick={(e) => {
118
- closePopupDialog();
119
- e.stopPropagation();
120
- toggle();
121
- }}
81
+ onClick={(e) => handleMenuBurgerClick(e)}
122
82
  />
123
83
  {rightItems.map(
124
84
  renderMenuItem(handleMenuItemClick, 'right', { activeIndex, currentItemPosition }),
@@ -130,7 +90,7 @@ export const StickyBottomMenu = UniBlock<StickyBottomMenuProps>(({ sticky, ...re
130
90
 
131
91
  const renderMenuItem =
132
92
  (
133
- handleMenuItemClick: (index: number, itemsPosition: string) => void,
93
+ onClick: (index: number, itemsPosition: string) => void,
134
94
  itemsPosition: string,
135
95
  currentActiveItem: CurrentActiveItem,
136
96
  ) =>
@@ -145,7 +105,7 @@ const renderMenuItem =
145
105
  }
146
106
  onClick={(e) => {
147
107
  e.stopPropagation();
148
- handleMenuItemClick(i, itemsPosition);
108
+ onClick(i, itemsPosition);
149
109
  }}
150
110
  />
151
111
  );
@@ -0,0 +1,39 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
+ import { type VNode } from '../../model/VNode';
4
+ import { CloseButton } from '../../ui-kit/DialogManager/CloseButton';
5
+ import { useDialogManager } from '../../ui-kit/DialogManager/useDialogManager';
6
+ import { type PreventableEvent } from '../../ui-kit/PreventableEvent';
7
+ import { style } from '../../utils/style';
8
+
9
+ export interface StickyBottomMenuDialogProps {
10
+ className?: string;
11
+ head?: VNode;
12
+ onClose?: () => void;
13
+ onClick?: (e: PreventableEvent) => void;
14
+ }
15
+
16
+ export const StickyBottomMenuDialog = JSX<StickyBottomMenuDialogProps>(
17
+ ({ className, head, children, onClose, onClick }) => {
18
+ const { close } = useDialogManager();
19
+
20
+ const handleClose = useCallback(() => {
21
+ close();
22
+ onClose && onClose();
23
+ }, [onClose]);
24
+
25
+ return (
26
+ <div
27
+ onClick={onClick}
28
+ className={style('relative min-h-full bg-white p-0 rounded-xl mt-[20%]', className)}
29
+ role="dialog"
30
+ >
31
+ <div className="sticky py-xl top-0 rounded-xl bg-white z-10">
32
+ <CloseButton className="absolute top-1.5 right-0" onClose={handleClose} />
33
+ <div className="container">{head}</div>
34
+ </div>
35
+ <div className="container pb-6xl">{children}</div>
36
+ </div>
37
+ );
38
+ },
39
+ );
@@ -0,0 +1,54 @@
1
+ import { type StickyMenuItem } from '../../data/StickyMobileData';
2
+ import { type VNode } from '../../model/VNode';
3
+ import { type DialogOptions } from '../../ui-kit/DialogManager/useDialogManager';
4
+ import { Heading } from '../../ui-kit/Heading/Heading';
5
+ import { StickyBottomMenuDialog } from './StickyBottomMenuDialog';
6
+
7
+ interface BottomMenuItemDialog {
8
+ menuRef?: {
9
+ current: HTMLDivElement | null;
10
+ };
11
+ dialogRef?: {
12
+ current: HTMLDivElement | null;
13
+ };
14
+ closeDialog: () => void;
15
+ openDialog: (dialog: VNode, options: DialogOptions) => void;
16
+ leftItems: StickyMenuItem[];
17
+ rightItems: StickyMenuItem[];
18
+ }
19
+
20
+ export const useBottomMenuItemDialog = ({
21
+ menuRef,
22
+ dialogRef,
23
+ closeDialog,
24
+ openDialog,
25
+ leftItems,
26
+ rightItems,
27
+ }: BottomMenuItemDialog) => {
28
+ const openBottomMenuItemDialog = (index: number, itemsPosition: string) => {
29
+ const requiredArray = itemsPosition === 'left' ? leftItems : rightItems;
30
+ const menuDimensions = menuRef?.current?.getBoundingClientRect();
31
+ openDialog(
32
+ <StickyBottomMenuDialog
33
+ onClick={(e) => e.stopPropagation()}
34
+ onClose={closeDialog}
35
+ head={
36
+ <div className="flex items-center px-xl">
37
+ <Heading as="h4" title={requiredArray[index].title} />
38
+ </div>
39
+ }
40
+ >
41
+ <div className="bg-white pb-20 pt-1 text-l" ref={dialogRef}>
42
+ <iframe
43
+ src={requiredArray[index]?.src}
44
+ className="min-h-[90vh]"
45
+ width={menuDimensions?.width || 0}
46
+ />
47
+ </div>
48
+ </StickyBottomMenuDialog>,
49
+ { id: itemsPosition === 'left' ? leftItems[index].title : rightItems[index].title },
50
+ );
51
+ };
52
+
53
+ return [{ openBottomMenuItemDialog }];
54
+ };
@@ -11,7 +11,6 @@ export const useBurgerMenuDialog = (
11
11
  ): [
12
12
  boolean,
13
13
  {
14
- open: () => void;
15
14
  close: () => void;
16
15
  toggle: () => void;
17
16
  openDialog: (dialog: VNode, options: DialogOptions) => void;
@@ -31,5 +30,5 @@ export const useBurgerMenuDialog = (
31
30
  }
32
31
  };
33
32
 
34
- return [isBurgerMenuOpen, { open, close, toggle, openDialog }];
33
+ return [isBurgerMenuOpen, { close, toggle, openDialog }];
35
34
  };
@@ -6,8 +6,8 @@ import { type Picture } from '../model/Picture';
6
6
  export interface StickyMenuItem {
7
7
  /** @title Название */
8
8
  title?: string;
9
- /** @title Html */
10
- __html?: string;
9
+ /** @title Адрес страницы меню */
10
+ src?: string;
11
11
  /** @title Иконка */
12
12
  icon?: Picture;
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.261",
3
+ "version": "0.14.263",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -5,6 +5,7 @@ import { type WorkSchedule } from './OfficesAtmsMapProps';
5
5
  export const renderWorkSchedule = (workSchedule?: WorkSchedule) => {
6
6
  const workScheduleWeek = getWorkScheduleWeek(workSchedule);
7
7
  const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
8
+ const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
8
9
 
9
10
  if (!workSchedule) {
10
11
  return null;
@@ -14,18 +15,24 @@ export const renderWorkSchedule = (workSchedule?: WorkSchedule) => {
14
15
  return renderMatchingTimeOfWork(timeOfWork);
15
16
  }
16
17
 
17
- if (workSchedule.businessScheduleVisibleTag && !workSchedule.businessScheduleDescription) {
18
+ if (
19
+ workSchedule.businessScheduleVisibleTag &&
20
+ workSchedule.businessScheduleDescription === null
21
+ ) {
18
22
  return renderIndividualTimeOfWork(timeOfWork);
19
23
  }
20
24
 
21
- return renderDefaultTimeOfWork(timeOfWork);
25
+ return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
22
26
  };
23
27
 
24
28
  const renderIndividualTimeOfWork = (timeOfWork: string[] | '') =>
25
29
  `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
26
30
 
27
- const renderDefaultTimeOfWork = (timeOfWork: string[] | '') =>
28
- `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${timeOfWork}</p>`;
29
-
30
31
  const renderMatchingTimeOfWork = (timeOfWork: string[] | '') =>
31
32
  `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
33
+
34
+ const renderDefaultTimeOfWork = (
35
+ timeOfWork: string[] | '',
36
+ businessTimeOfWork: string | undefined,
37
+ ) =>
38
+ `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;