@antscorp/antsomi-ui 1.3.4 → 1.3.5-beta.2
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/es/assets/css/main.scss +6 -0
- package/es/assets/images/iphone-top-bar.png +0 -0
- package/es/assets/images/iphone.png +0 -0
- package/es/assets/images/stars_slider.png +0 -0
- package/es/components/atoms/Empty/Empty.d.ts +6 -5
- package/es/components/atoms/Empty/Empty.js +7 -1
- package/es/components/atoms/Flex/Flex.d.ts +2 -0
- package/es/components/atoms/Flex/Flex.js +1 -0
- package/es/components/atoms/Flex/index.d.ts +1 -0
- package/es/components/atoms/Flex/index.js +1 -0
- package/es/components/atoms/Input/Input.d.ts +14 -3
- package/es/components/atoms/Input/Input.js +7 -3
- package/es/components/atoms/InputDynamic/EditCaretPositioning.d.ts +2 -0
- package/es/components/atoms/InputDynamic/EditCaretPositioning.js +89 -0
- package/es/components/atoms/InputDynamic/InputDynamic.d.ts +10 -0
- package/es/components/atoms/InputDynamic/InputDynamic.js +516 -0
- package/es/components/atoms/InputDynamic/PopupShortLink.d.ts +16 -0
- package/es/components/atoms/InputDynamic/PopupShortLink.js +85 -0
- package/es/components/atoms/InputDynamic/constants.d.ts +71 -0
- package/es/components/atoms/InputDynamic/constants.js +71 -0
- package/es/components/atoms/InputDynamic/index.d.ts +2 -0
- package/es/components/atoms/InputDynamic/index.js +1 -0
- package/es/components/atoms/InputDynamic/styled.d.ts +13 -0
- package/es/components/atoms/InputDynamic/styled.js +293 -0
- package/es/components/atoms/InputDynamic/types.d.ts +116 -0
- package/es/components/atoms/InputDynamic/types.js +1 -0
- package/es/components/atoms/InputDynamic/utils.d.ts +30 -0
- package/es/components/atoms/InputDynamic/utils.js +874 -0
- package/es/components/atoms/MobileFrame/MobileFrame.d.ts +4 -0
- package/es/components/atoms/MobileFrame/MobileFrame.js +22 -0
- package/es/components/atoms/MobileFrame/constants.d.ts +4 -0
- package/es/components/atoms/MobileFrame/constants.js +4 -0
- package/es/components/atoms/MobileFrame/index.d.ts +2 -0
- package/es/components/atoms/MobileFrame/index.js +1 -0
- package/es/components/atoms/MobileFrame/styled.d.ts +3 -0
- package/es/components/atoms/MobileFrame/styled.js +33 -0
- package/es/components/atoms/Pagination/index.d.ts +1 -0
- package/es/components/atoms/Popover/styled.d.ts +4 -0
- package/es/components/atoms/Popover/styled.js +5 -0
- package/es/components/atoms/PreviewTabs/PreviewTabs.d.ts +7 -0
- package/es/components/atoms/PreviewTabs/PreviewTabs.js +67 -0
- package/es/components/atoms/PreviewTabs/index.d.ts +2 -0
- package/es/components/atoms/PreviewTabs/index.js +1 -0
- package/es/components/atoms/PreviewTabs/styled.d.ts +6 -0
- package/es/components/atoms/PreviewTabs/styled.js +79 -0
- package/es/components/atoms/RateV2/RateV2.d.ts +18 -0
- package/es/components/atoms/RateV2/RateV2.js +73 -0
- package/es/components/atoms/RateV2/index.d.ts +1 -0
- package/es/components/atoms/RateV2/index.js +1 -0
- package/es/components/atoms/RequiredLabel/index.d.ts +1 -0
- package/es/components/atoms/RequiredLabel/index.js +4 -3
- package/es/components/atoms/SlideBar/SlideBar.d.ts +34 -0
- package/es/components/atoms/SlideBar/SlideBar.js +283 -0
- package/es/components/atoms/SlideBar/constants.d.ts +10 -0
- package/es/components/atoms/SlideBar/constants.js +10 -0
- package/es/components/atoms/SlideBar/index.d.ts +1 -0
- package/es/components/atoms/SlideBar/index.js +1 -0
- package/es/components/atoms/SlideBar/styled.d.ts +20 -0
- package/es/components/atoms/SlideBar/styled.js +136 -0
- package/es/components/atoms/Slider/index.d.ts +2 -1
- package/es/components/atoms/Slider/index.js +14 -16
- package/es/components/atoms/SliderV2/index.d.ts +6 -0
- package/es/components/atoms/SliderV2/index.js +21 -0
- package/es/components/atoms/Spin/Spin.d.ts +2 -1
- package/es/components/atoms/index.d.ts +10 -0
- package/es/components/atoms/index.js +8 -0
- package/es/components/common/ConfigProvider/ConfigProvider.d.ts +2 -0
- package/es/components/common/ConfigProvider/ConfigProvider.js +14 -0
- package/es/components/common/ConfigProvider/GlobalStyle.js +310 -27
- package/es/components/icons/ArrowGrowIcon.d.ts +2 -1
- package/es/components/icons/AudioRecordIcon.d.ts +2 -1
- package/es/components/icons/BugIcon.d.ts +2 -1
- package/es/components/icons/CameraIcon.d.ts +2 -1
- package/es/components/icons/CaptureIcon.d.ts +2 -1
- package/es/components/icons/CheckSlimIcon.d.ts +2 -1
- package/es/components/icons/CloseIcon.d.ts +2 -1
- package/es/components/icons/CommentIcon.d.ts +2 -1
- package/es/components/icons/EventIcon.d.ts +2 -1
- package/es/components/icons/FreeDrawIcon.d.ts +2 -1
- package/es/components/icons/GPTIcon.d.ts +2 -1
- package/es/components/icons/GPTIconV2.d.ts +2 -1
- package/es/components/icons/GPTIconV3.d.ts +2 -1
- package/es/components/icons/HighlightIcon.d.ts +2 -1
- package/es/components/icons/IdeaIcon.d.ts +2 -1
- package/es/components/icons/InvisibleIcon.d.ts +2 -1
- package/es/components/icons/MuteIcon.d.ts +2 -1
- package/es/components/icons/OpenUrlIcon.d.ts +2 -1
- package/es/components/icons/PauseIcon.d.ts +2 -1
- package/es/components/icons/PlaneIcon.d.ts +2 -1
- package/es/components/icons/RequestIcon.d.ts +2 -1
- package/es/components/icons/StopRecordIcon.d.ts +2 -1
- package/es/components/icons/UserIcon.d.ts +2 -1
- package/es/components/icons/VerticalDotsIcon.d.ts +2 -1
- package/es/components/icons/WarningIcon.d.ts +2 -1
- package/es/components/index.d.ts +1 -0
- package/es/components/index.js +1 -0
- package/es/components/molecules/AddDynamicContent/AddDynamicContent.d.ts +35 -0
- package/es/components/molecules/AddDynamicContent/AddDynamicContent.js +1248 -0
- package/es/components/molecules/AddDynamicContent/components/DisplayFormat/DisplayFormat.d.ts +12 -0
- package/es/components/molecules/AddDynamicContent/components/DisplayFormat/DisplayFormat.js +25 -0
- package/es/components/molecules/AddDynamicContent/components/DisplayFormat/index.d.ts +3 -0
- package/es/components/molecules/AddDynamicContent/components/DisplayFormat/index.js +3 -0
- package/es/components/molecules/AddDynamicContent/components/FormatDatetime/FormatDatetime.d.ts +19 -0
- package/es/components/molecules/AddDynamicContent/components/FormatDatetime/FormatDatetime.js +100 -0
- package/es/components/molecules/AddDynamicContent/components/FormatDatetime/index.d.ts +1 -0
- package/es/components/molecules/AddDynamicContent/components/FormatDatetime/index.js +1 -0
- package/es/components/molecules/AddDynamicContent/components/FormatNumber/FormatNumber.d.ts +52 -0
- package/es/components/molecules/AddDynamicContent/components/FormatNumber/FormatNumber.js +132 -0
- package/es/components/molecules/AddDynamicContent/components/FormatNumber/index.d.ts +1 -0
- package/es/components/molecules/AddDynamicContent/components/FormatNumber/index.js +1 -0
- package/es/components/molecules/AddDynamicContent/components/index.d.ts +3 -0
- package/es/components/molecules/AddDynamicContent/components/index.js +3 -0
- package/es/components/molecules/AddDynamicContent/constants.d.ts +101 -0
- package/es/components/molecules/AddDynamicContent/constants.js +152 -0
- package/es/components/molecules/AddDynamicContent/currencies.json +1523 -0
- package/es/components/molecules/AddDynamicContent/index.d.ts +2 -0
- package/es/components/molecules/AddDynamicContent/index.js +2 -0
- package/es/components/molecules/AddDynamicContent/styled.d.ts +12 -0
- package/es/components/molecules/AddDynamicContent/styled.js +30 -0
- package/es/components/molecules/AddDynamicContent/types.d.ts +13 -0
- package/es/components/molecules/AddDynamicContent/types.js +1 -0
- package/es/components/molecules/AddDynamicContent/utils.d.ts +41 -0
- package/es/components/molecules/AddDynamicContent/utils.js +396 -0
- package/es/components/molecules/CaptureScreen/CaptureScreen.d.ts +2 -1
- package/es/components/molecules/CaptureScreen/components/CommentBox/CommentBox.d.ts +2 -1
- package/es/components/molecules/CaptureScreen/components/Cursor/Cursor.d.ts +2 -1
- package/es/components/molecules/Collapse/Collapse.d.ts +3 -3
- package/es/components/molecules/Collapse/Collapse.js +9 -0
- package/es/components/molecules/ColorPicker/CustomPicker/index.js +9 -18
- package/es/components/molecules/ColorPicker/CustomPicker/styled.d.ts +5 -1
- package/es/components/molecules/ColorPicker/CustomPicker/styled.js +14 -3
- package/es/components/molecules/ColorPicker/index.js +3 -3
- package/es/components/molecules/ColorSetting/index.js +3 -3
- package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.d.ts +7 -3
- package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +212 -205
- package/es/components/molecules/DatePicker/components/AdvancedPicker/constants.d.ts +78 -25
- package/es/components/molecules/DatePicker/components/AdvancedPicker/constants.js +145 -22
- package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.js +49 -5
- package/es/components/molecules/DatePicker/components/AdvancedPicker/types.d.ts +22 -0
- package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.d.ts +25 -1
- package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.js +167 -40
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.d.ts +3 -1
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js +21 -9
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/constants.d.ts +1 -0
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/constants.js +1 -0
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/types.d.ts +1 -0
- package/es/components/molecules/DatePicker/components/DropdownLabel/DropdownLabel.d.ts +13 -0
- package/es/components/molecules/DatePicker/components/DropdownLabel/DropdownLabel.js +87 -0
- package/es/components/molecules/DatePicker/components/ErrorMessage/ErrorMessage.d.ts +6 -0
- package/es/components/molecules/DatePicker/components/ErrorMessage/ErrorMessage.js +12 -0
- package/es/components/molecules/Drawer/Drawer.d.ts +5 -1
- package/es/components/molecules/Drawer/Drawer.js +3 -1
- package/es/components/molecules/Drawer/index.d.ts +1 -0
- package/es/components/molecules/EditorScript/EditorScript.d.ts +14 -0
- package/es/components/molecules/EditorScript/EditorScript.js +89 -0
- package/es/components/molecules/EditorScript/index.d.ts +1 -0
- package/es/components/molecules/EditorScript/index.js +1 -0
- package/es/components/molecules/EditorScript/styled.d.ts +1 -0
- package/es/components/molecules/EditorScript/styled.js +3 -0
- package/es/components/molecules/FontFamilySelect/constants.d.ts +307 -0
- package/es/components/molecules/FontFamilySelect/constants.js +257 -0
- package/es/components/molecules/FontFamilySelect/index.d.ts +17 -0
- package/es/components/molecules/FontFamilySelect/index.js +53 -0
- package/es/components/molecules/FontSetting/constants.d.ts +3 -0
- package/es/components/molecules/FontSetting/constants.js +22 -0
- package/es/components/molecules/FontSetting/index.d.ts +24 -0
- package/es/components/molecules/FontSetting/index.js +54 -0
- package/es/components/molecules/FontSetting/types.d.ts +22 -0
- package/es/components/molecules/FontSetting/types.js +1 -0
- package/es/components/molecules/FontWeightSelect/constants.d.ts +28 -0
- package/es/components/molecules/FontWeightSelect/constants.js +11 -0
- package/es/components/molecules/FontWeightSelect/index.d.ts +9 -0
- package/es/components/molecules/FontWeightSelect/index.js +39 -0
- package/es/components/molecules/Form/Form.d.ts +1 -0
- package/es/components/molecules/Form/Form.js +1 -0
- package/es/components/molecules/Form/index.d.ts +1 -0
- package/es/components/molecules/Form/index.js +1 -0
- package/es/components/molecules/GradientSetting/index.d.ts +19 -2
- package/es/components/molecules/GradientSetting/index.js +52 -30
- package/es/components/molecules/GradientSetting/styled.d.ts +1 -0
- package/es/components/molecules/GradientSetting/styled.js +59 -0
- package/es/components/molecules/InputNumber/index.js +2 -2
- package/es/components/molecules/Modal/index.d.ts +1 -0
- package/es/components/molecules/Modal/styled.d.ts +1 -1
- package/es/components/molecules/Modal/styled.js +2 -0
- package/es/components/molecules/ModalV2/ModalV2.d.ts +5 -0
- package/es/components/molecules/ModalV2/ModalV2.js +26 -0
- package/es/components/molecules/ModalV2/index.d.ts +2 -0
- package/es/components/molecules/ModalV2/index.js +1 -0
- package/es/components/molecules/ModalV2/styled.d.ts +7 -0
- package/es/components/molecules/ModalV2/styled.js +22 -0
- package/es/components/molecules/PreviewModal/PreviewModal.d.ts +7 -0
- package/es/components/molecules/PreviewModal/PreviewModal.js +30 -0
- package/es/components/molecules/PreviewModal/index.d.ts +2 -0
- package/es/components/molecules/PreviewModal/index.js +1 -0
- package/es/components/molecules/PreviewModal/styled.d.ts +4 -0
- package/es/components/molecules/PreviewModal/styled.js +39 -0
- package/es/components/molecules/ResizeGrid/ResizeGrid.d.ts +3 -0
- package/es/components/molecules/ResizeGrid/ResizeGrid.js +728 -0
- package/es/components/molecules/ResizeGrid/components/Cell/Cell.d.ts +3 -0
- package/es/components/molecules/ResizeGrid/components/Cell/Cell.js +87 -0
- package/es/components/molecules/ResizeGrid/components/Cell/index.d.ts +1 -0
- package/es/components/molecules/ResizeGrid/components/Cell/index.js +1 -0
- package/es/components/molecules/ResizeGrid/components/Cell/styled.d.ts +3 -0
- package/es/components/molecules/ResizeGrid/components/Cell/styled.js +80 -0
- package/es/components/molecules/ResizeGrid/constant.d.ts +35 -0
- package/es/components/molecules/ResizeGrid/constant.js +111 -0
- package/es/components/molecules/ResizeGrid/index.d.ts +2 -0
- package/es/components/molecules/ResizeGrid/index.js +1 -0
- package/es/components/molecules/ResizeGrid/styled.d.ts +10 -0
- package/es/components/molecules/ResizeGrid/styled.js +56 -0
- package/es/components/molecules/ResizeGrid/types.d.ts +147 -0
- package/es/components/molecules/ResizeGrid/types.js +1 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.d.ts +13 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.js +53 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/index.d.ts +18 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/index.js +110 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/styled.d.ts +20 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/styled.js +135 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/constants.d.ts +2 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/constants.js +765 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/index.d.ts +3 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/index.js +2 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/styled.d.ts +9 -0
- package/es/components/molecules/RichMenu/RichMenuBlock/styled.js +17 -0
- package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.d.ts +10 -0
- package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.js +32 -0
- package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/index.d.ts +6 -0
- package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/index.js +15 -0
- package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/styled.d.ts +4 -0
- package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/styled.js +47 -0
- package/es/components/molecules/RichMenu/RichMenuChatBar/index.d.ts +2 -0
- package/es/components/molecules/RichMenu/RichMenuChatBar/index.js +1 -0
- package/es/components/molecules/RichMenu/RichMenuChatBar/styled.d.ts +9 -0
- package/es/components/molecules/RichMenu/RichMenuChatBar/styled.js +37 -0
- package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.d.ts +10 -0
- package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.js +37 -0
- package/es/components/molecules/RichMenu/RichMenuMobileView/index.d.ts +1 -0
- package/es/components/molecules/RichMenu/RichMenuMobileView/index.js +1 -0
- package/es/components/molecules/RichMenu/RichMenuMobileView/styled.d.ts +6 -0
- package/es/components/molecules/RichMenu/RichMenuMobileView/styled.js +20 -0
- package/es/components/molecules/RichMenu/index.d.ts +3 -0
- package/es/components/molecules/RichMenu/index.js +3 -0
- package/es/components/molecules/Select/Select.d.ts +3 -0
- package/es/components/molecules/Select/Select.js +23 -2
- package/es/components/molecules/Select/Test.d.ts +2 -1
- package/es/components/molecules/SettingWrapper/index.d.ts +1 -2
- package/es/components/molecules/SettingWrapperPopover/index.d.ts +16 -0
- package/es/components/molecules/SettingWrapperPopover/index.js +17 -0
- package/es/components/molecules/ShareAccess/ShareAccess.d.ts +3 -0
- package/es/components/molecules/ShareAccess/ShareAccess.js +23 -0
- package/es/components/molecules/ShareAccess/actions.d.ts +16 -0
- package/es/components/molecules/ShareAccess/actions.js +12 -0
- package/es/components/molecules/ShareAccess/components/GeneralAccess/GeneralAccess.d.ts +2 -0
- package/es/components/molecules/ShareAccess/components/GeneralAccess/GeneralAccess.js +78 -0
- package/es/components/molecules/ShareAccess/components/GeneralAccess/index.d.ts +1 -0
- package/es/components/molecules/ShareAccess/components/GeneralAccess/index.js +1 -0
- package/es/components/molecules/ShareAccess/components/GeneralAccess/styled.d.ts +1 -0
- package/es/components/molecules/ShareAccess/components/GeneralAccess/styled.js +57 -0
- package/es/components/molecules/ShareAccess/components/LayoutContent/LayoutContent.d.ts +3 -0
- package/es/components/molecules/ShareAccess/components/LayoutContent/LayoutContent.js +19 -0
- package/es/components/molecules/ShareAccess/components/LayoutContent/index.d.ts +1 -0
- package/es/components/molecules/ShareAccess/components/LayoutContent/index.js +1 -0
- package/es/components/molecules/ShareAccess/components/LayoutContent/styled.d.ts +1 -0
- package/es/components/molecules/ShareAccess/components/LayoutContent/styled.js +7 -0
- package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/ModalTransferOwnerShip.d.ts +2 -0
- package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/ModalTransferOwnerShip.js +43 -0
- package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/index.d.ts +0 -0
- package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/index.js +1 -0
- package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/styled.d.ts +7 -0
- package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/styled.js +18 -0
- package/es/components/molecules/ShareAccess/components/PeopleAccess/PeopleAccess.d.ts +5 -0
- package/es/components/molecules/ShareAccess/components/PeopleAccess/PeopleAccess.js +97 -0
- package/es/components/molecules/ShareAccess/components/PeopleAccess/index.d.ts +1 -0
- package/es/components/molecules/ShareAccess/components/PeopleAccess/index.js +1 -0
- package/es/components/molecules/ShareAccess/components/PeopleAccess/styled.d.ts +1 -0
- package/es/components/molecules/ShareAccess/components/PeopleAccess/styled.js +46 -0
- package/es/components/molecules/ShareAccess/components/SearchUser/SearchUser.d.ts +5 -0
- package/es/components/molecules/ShareAccess/components/SearchUser/SearchUser.js +73 -0
- package/es/components/molecules/ShareAccess/components/SearchUser/index.d.ts +1 -0
- package/es/components/molecules/ShareAccess/components/SearchUser/index.js +1 -0
- package/es/components/molecules/ShareAccess/components/SearchUser/styled.d.ts +2 -0
- package/es/components/molecules/ShareAccess/components/SearchUser/styled.js +29 -0
- package/es/components/molecules/ShareAccess/components/index.d.ts +1 -0
- package/es/components/molecules/ShareAccess/components/index.js +1 -0
- package/es/components/molecules/ShareAccess/constants.d.ts +67 -0
- package/es/components/molecules/ShareAccess/constants.js +85 -0
- package/es/components/molecules/ShareAccess/context.d.ts +4 -0
- package/es/components/molecules/ShareAccess/context.js +3 -0
- package/es/components/molecules/ShareAccess/hooks/index.d.ts +1 -0
- package/es/components/molecules/ShareAccess/hooks/index.js +1 -0
- package/es/components/molecules/ShareAccess/hooks/useShareAccess.d.ts +18 -0
- package/es/components/molecules/ShareAccess/hooks/useShareAccess.js +29 -0
- package/es/components/molecules/ShareAccess/index.d.ts +4 -0
- package/es/components/molecules/ShareAccess/index.js +4 -0
- package/es/components/molecules/ShareAccess/reducer.d.ts +2 -0
- package/es/components/molecules/ShareAccess/reducer.js +19 -0
- package/es/components/molecules/ShareAccess/types.d.ts +54 -0
- package/es/components/molecules/ShareAccess/types.js +1 -0
- package/es/components/molecules/ShareAccess/utils.d.ts +38 -0
- package/es/components/molecules/ShareAccess/utils.js +57 -0
- package/es/components/molecules/TextDecorationSelect/constants.d.ts +19 -0
- package/es/components/molecules/TextDecorationSelect/constants.js +26 -0
- package/es/components/molecules/TextDecorationSelect/index.d.ts +15 -0
- package/es/components/molecules/TextDecorationSelect/index.js +45 -0
- package/es/components/molecules/TextTransformSelect/constants.d.ts +13 -0
- package/es/components/molecules/TextTransformSelect/constants.js +19 -0
- package/es/components/molecules/TextTransformSelect/index.d.ts +9 -0
- package/es/components/molecules/TextTransformSelect/index.js +39 -0
- package/es/components/molecules/TreeSelect/TreeSelect.d.ts +2 -2
- package/es/components/molecules/UploadImage/MediaIcon.d.ts +2 -1
- package/es/components/molecules/UploadImage/MediaThumb.d.ts +8 -0
- package/es/components/molecules/UploadImage/MediaThumb.js +15 -0
- package/es/components/molecules/UploadImage/VideoThumbnail.d.ts +4 -0
- package/es/components/molecules/UploadImage/VideoThumbnail.js +43 -0
- package/es/components/molecules/UploadImage/index.d.ts +6 -2
- package/es/components/molecules/UploadImage/index.js +105 -85
- package/es/components/molecules/UploadImage/styled.js +0 -4
- package/es/components/molecules/UploadImage/utils.d.ts +3 -0
- package/es/components/molecules/UploadImage/utils.js +24 -0
- package/es/components/molecules/index.d.ts +18 -3
- package/es/components/molecules/index.js +15 -3
- package/es/components/organism/GenerativeInsights/constants.d.ts +1 -0
- package/es/components/organism/GenerativeInsights/constants.js +1 -0
- package/es/components/organism/GenerativeInsights/index.d.ts +11 -0
- package/es/components/organism/GenerativeInsights/index.js +57 -0
- package/es/components/organism/GenerativeInsights/styled.d.ts +12 -0
- package/es/components/organism/GenerativeInsights/styled.js +66 -0
- package/es/components/organism/GenerativeInsights/utils.d.ts +13 -0
- package/es/components/organism/GenerativeInsights/utils.js +50 -0
- package/es/components/organism/index.d.ts +1 -0
- package/es/components/organism/index.js +1 -0
- package/es/components/template/TemplateListing/components/BlankTemplate/index.d.ts +3 -0
- package/es/components/template/TemplateListing/components/BlankTemplate/index.js +17 -0
- package/es/components/template/TemplateListing/components/BlankTemplate/styled.d.ts +2 -0
- package/es/components/template/TemplateListing/components/BlankTemplate/styled.js +24 -0
- package/es/components/template/TemplateListing/components/CategoryListing/index.d.ts +3 -0
- package/es/components/template/TemplateListing/components/CategoryListing/index.js +103 -0
- package/es/components/template/TemplateListing/components/CategoryListing/styled.d.ts +5 -0
- package/es/components/template/TemplateListing/components/CategoryListing/styled.js +55 -0
- package/es/components/template/TemplateListing/components/CategoryListing/types.d.ts +10 -0
- package/es/components/template/TemplateListing/components/CategoryListing/types.js +1 -0
- package/es/components/template/TemplateListing/components/TemplateItem/index.d.ts +3 -0
- package/es/components/template/TemplateListing/components/TemplateItem/index.js +53 -0
- package/es/components/template/TemplateListing/components/TemplateItem/styled.d.ts +1 -0
- package/es/components/template/TemplateListing/components/TemplateItem/styled.js +82 -0
- package/es/components/template/TemplateListing/components/index.d.ts +3 -0
- package/es/components/template/TemplateListing/components/index.js +3 -0
- package/es/components/template/TemplateListing/constants/defaultProps.d.ts +8 -0
- package/es/components/template/TemplateListing/constants/defaultProps.js +20 -0
- package/es/components/template/TemplateListing/constants/index.d.ts +2 -0
- package/es/components/template/TemplateListing/constants/index.js +2 -0
- package/es/components/template/TemplateListing/constants/mockData.d.ts +2 -0
- package/es/components/template/TemplateListing/constants/mockData.js +101 -0
- package/es/components/template/TemplateListing/index.d.ts +3 -0
- package/es/components/template/TemplateListing/index.js +22 -0
- package/es/components/template/TemplateListing/styled/index.d.ts +2 -0
- package/es/components/template/TemplateListing/styled/index.js +16 -0
- package/es/components/template/TemplateListing/types/BlankTemplate.d.ts +8 -0
- package/es/components/template/TemplateListing/types/BlankTemplate.js +1 -0
- package/es/components/template/TemplateListing/types/CategoryListing.d.ts +16 -0
- package/es/components/template/TemplateListing/types/CategoryListing.js +1 -0
- package/es/components/template/TemplateListing/types/TemplateItem.d.ts +14 -0
- package/es/components/template/TemplateListing/types/TemplateItem.js +1 -0
- package/es/components/template/TemplateListing/types/TemplateListing.d.ts +15 -0
- package/es/components/template/TemplateListing/types/TemplateListing.js +1 -0
- package/es/components/template/TemplateListing/types/index.d.ts +4 -0
- package/es/components/template/TemplateListing/types/index.js +4 -0
- package/es/components/template/index.d.ts +2 -0
- package/es/components/template/index.js +2 -0
- package/es/constants/index.d.ts +1 -0
- package/es/constants/index.js +1 -0
- package/es/constants/queries.d.ts +14 -0
- package/es/constants/queries.js +21 -0
- package/es/constants/richMenu.d.ts +19 -0
- package/es/constants/richMenu.js +19 -0
- package/es/constants/storybook.d.ts +7 -1
- package/es/constants/storybook.js +12 -0
- package/es/constants/theme.js +30 -3
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.js +1 -0
- package/es/hooks/useDebounceCallback.d.ts +1 -0
- package/es/hooks/useDebounceCallback.js +5 -0
- package/es/hooks/useDebounceV2.d.ts +1 -0
- package/es/hooks/useDebounceV2.js +11 -0
- package/es/hooks/useDeepCompareEffect.d.ts +1 -0
- package/es/hooks/useDeepCompareEffect.js +21 -0
- package/es/hooks/useDeepCompareMemo.d.ts +2 -0
- package/es/hooks/useDeepCompareMemo.js +21 -0
- package/es/hooks/useOutsideClick.d.ts +4 -0
- package/es/hooks/useOutsideClick.js +18 -0
- package/es/hooks/usePrevious.d.ts +2 -0
- package/es/hooks/usePrevious.js +9 -0
- package/es/locales/en/translation.json +167 -1
- package/es/locales/i18n.d.ts +167 -0
- package/es/locales/translations.d.ts +166 -0
- package/es/locales/vi/translation.json +2 -1
- package/es/models/BusinessObject.d.ts +116 -0
- package/es/models/BusinessObject.js +113 -0
- package/es/models/Currency.d.ts +9 -0
- package/es/models/Currency.js +10 -0
- package/es/models/CustomFunction.d.ts +19 -0
- package/es/models/CustomFunction.js +25 -0
- package/es/models/DynamicContentAttribute.d.ts +34 -0
- package/es/models/DynamicContentAttribute.js +9 -0
- package/es/models/EventTrackingAttribute.d.ts +11 -0
- package/es/models/EventTrackingAttribute.js +13 -0
- package/es/models/PromotionPool.d.ts +11 -0
- package/es/models/PromotionPool.js +12 -0
- package/es/models/{SavedImage.d.ts → SavedMedia.d.ts} +7 -5
- package/es/models/{SavedImage.js → SavedMedia.js} +7 -3
- package/es/models/Upload.d.ts +2 -0
- package/es/models/Upload.js +3 -0
- package/es/queries/BusinessObject/index.d.ts +6 -0
- package/es/queries/BusinessObject/index.js +6 -0
- package/es/queries/BusinessObject/useGetListAllEvents.d.ts +11 -0
- package/es/queries/BusinessObject/useGetListAllEvents.js +14 -0
- package/es/queries/BusinessObject/useGetListAttributeBO.d.ts +17 -0
- package/es/queries/BusinessObject/useGetListAttributeBO.js +41 -0
- package/es/queries/BusinessObject/useGetListBO.d.ts +6 -0
- package/es/queries/BusinessObject/useGetListBO.js +19 -0
- package/es/queries/BusinessObject/useGetListEventAttr.d.ts +4 -0
- package/es/queries/BusinessObject/useGetListEventAttr.js +15 -0
- package/es/queries/BusinessObject/useGetListPromotionCodeAttr.d.ts +6 -0
- package/es/queries/BusinessObject/useGetListPromotionCodeAttr.js +26 -0
- package/es/queries/BusinessObject/useGetListSourceByEvent.d.ts +13 -0
- package/es/queries/BusinessObject/useGetListSourceByEvent.js +11 -0
- package/es/queries/CustomFunction/index.d.ts +2 -0
- package/es/queries/CustomFunction/index.js +2 -0
- package/es/queries/CustomFunction/useCustomFunction.d.ts +19 -0
- package/es/queries/CustomFunction/useCustomFunction.js +53 -0
- package/es/queries/DynamicContentAttribute/index.d.ts +1 -0
- package/es/queries/DynamicContentAttribute/index.js +1 -0
- package/es/queries/DynamicContentAttribute/useGetDynamicContentAttr.d.ts +10 -0
- package/es/queries/DynamicContentAttribute/useGetDynamicContentAttr.js +21 -0
- package/es/queries/PromotionPool/index.d.ts +1 -0
- package/es/queries/PromotionPool/index.js +1 -0
- package/es/queries/PromotionPool/useGetListPromotionPool.d.ts +9 -0
- package/es/queries/PromotionPool/useGetListPromotionPool.js +62 -0
- package/es/queries/ThirdParty/index.d.ts +1 -0
- package/es/queries/ThirdParty/index.js +1 -0
- package/es/queries/ThirdParty/useGetEventTrackingAttributes.d.ts +14 -0
- package/es/queries/ThirdParty/useGetEventTrackingAttributes.js +15 -0
- package/es/queries/configs.d.ts +4 -0
- package/es/queries/configs.js +13 -0
- package/es/queries/index.d.ts +6 -0
- package/es/queries/index.js +6 -0
- package/es/services/MediaTemplateDesign/BusinessObject/index.d.ts +8 -0
- package/es/services/MediaTemplateDesign/BusinessObject/index.js +100 -0
- package/es/services/MediaTemplateDesign/CustomFunction/index.d.ts +15 -0
- package/es/services/MediaTemplateDesign/CustomFunction/index.js +135 -0
- package/es/services/MediaTemplateDesign/DynamicContentAttribute/index.d.ts +4 -0
- package/es/services/MediaTemplateDesign/DynamicContentAttribute/index.js +39 -0
- package/es/services/MediaTemplateDesign/ListCurrency/index.d.ts +6 -0
- package/es/services/MediaTemplateDesign/ListCurrency/index.js +34 -0
- package/es/services/MediaTemplateDesign/PromotionPool/index.d.ts +3 -0
- package/es/services/MediaTemplateDesign/PromotionPool/index.js +31 -0
- package/es/services/MediaTemplateDesign/UploadFile/index.d.ts +5 -5
- package/es/services/MediaTemplateDesign/UploadFile/index.js +37 -19
- package/es/services/ThirParty/index.d.ts +8 -0
- package/es/services/ThirParty/index.js +26 -0
- package/es/services/index.d.ts +14 -5
- package/es/services/index.js +45 -1
- package/es/test.d.ts +2 -1
- package/es/test.js +258 -80
- package/es/types/index.d.ts +17 -0
- package/es/types/index.js +2 -1
- package/es/types/richMenu.d.ts +214 -0
- package/es/types/richMenu.js +1 -0
- package/es/types/variables.d.ts +2 -0
- package/es/types/variables.js +1 -0
- package/es/utils/common.d.ts +4 -0
- package/es/utils/common.js +21 -0
- package/es/utils/handleError.d.ts +32 -2
- package/es/utils/handleError.js +42 -4
- package/package.json +27 -9
- package/dist/0173b5993573afa04880.woff +0 -0
- package/dist/0dfb9214dfd945cd7290.png +0 -1
- package/dist/2883cad25a2b4e87ce5f.eot +0 -0
- package/dist/4f54a37971347e3d7122.png +0 -1
- package/dist/574b7bee0563a9fe9a29.png +0 -1
- package/dist/6b586356e837581204dc.svg +0 -1
- package/dist/72eec5c1c786b45a667f.ttf +0 -0
- package/dist/bc6bf11c6f5e6743aa4c.png +0 -1
- package/dist/dbc405edd6e0806efbc9.svg +0 -1
- package/dist/e32f09119052a55cce3c.png +0 -1
- package/dist/e3851b9384a984c6fdb5.png +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.LICENSE.txt +0 -69
- package/dist/main.css +0 -68
- package/dist/public/icons/2d496b55d85a9545d7311c073af442bb.png +0 -0
- package/dist/public/icons/2fbb4e0927d18e3f8e5c6511ab88d5b3.png +0 -0
- package/dist/public/icons/725a52bd91a3ce534b10833df510e5fa.png +0 -0
- package/dist/public/icons/7d037e0b378e87a82804443636cd0e13.svg +0 -346
- package/dist/public/icons/90553767e0a05b9585a54797cfd9ce51.png +0 -0
- package/dist/public/icons/bb64e23a1ff390a416d765ee556096ab.svg +0 -87
- package/dist/public/icons/d327b24e9c5d8f486f08d253aab58ce6.png +0 -0
- package/dist/public/icons/f1cf266d0a0a53ce07f2dbb859869b7a.png +0 -0
- package/dist/public/icons/placeholder-image.png +0 -0
- package/dist/public/icons/transparent.svg +0 -1
|
@@ -0,0 +1,728 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
22
|
+
import { Cell } from './components/Cell';
|
|
23
|
+
import { GRID_TEMPLATE, MIN_SIZE, THREADHOLD, buildGrid } from './constant';
|
|
24
|
+
import { StyledGrid, StyledMiddleLayer, StyledBGLayer, StyledLine } from './styled';
|
|
25
|
+
import { useDeepCompareEffect } from '../../../hooks/useDeepCompareEffect';
|
|
26
|
+
const defaultProps = {
|
|
27
|
+
containerStyle: {},
|
|
28
|
+
cellBorder: '1px dotted',
|
|
29
|
+
cellStyle: {},
|
|
30
|
+
cellActiveStyle: { background: '#2f79bf80' },
|
|
31
|
+
isPreview: false,
|
|
32
|
+
isCompact: false,
|
|
33
|
+
delayUpdate: 200,
|
|
34
|
+
selectColor: '#2f79bf80',
|
|
35
|
+
};
|
|
36
|
+
export const ResizeGrid = props => {
|
|
37
|
+
const { containerStyle, cellBorder, cellStyle, cellActiveStyle, isPreview, renderCell, grid: initGrid, image, imageSize, imagePosition, isCompact, onChange, delayUpdate, selectColor, } = props;
|
|
38
|
+
const [grid, setGrid] = useState(buildGrid(initGrid || GRID_TEMPLATE.GRID_2_3));
|
|
39
|
+
const startRef = useRef(null);
|
|
40
|
+
const startCellRef = useRef(null);
|
|
41
|
+
const selectRef = useRef(null);
|
|
42
|
+
const selectEndRef = useRef(null);
|
|
43
|
+
const gridRef = useRef();
|
|
44
|
+
const containerRef = useRef(null);
|
|
45
|
+
const verticalLineRef = useRef(null);
|
|
46
|
+
const horizontalLineRef = useRef(null);
|
|
47
|
+
const layersRef = useRef(null);
|
|
48
|
+
const cellsRef = useRef({});
|
|
49
|
+
const cordinatesRef = useRef({});
|
|
50
|
+
const onChangeTimoutRef = useRef();
|
|
51
|
+
const onChangeDelayRef = useRef();
|
|
52
|
+
const acceptUpdateRef = useRef(false);
|
|
53
|
+
const firstChangeRef = useRef(true);
|
|
54
|
+
const ctrlKeyRef = useRef(false);
|
|
55
|
+
const initRef = useRef(0);
|
|
56
|
+
const initDoneRef = useRef(false);
|
|
57
|
+
// console.log('grid', grid)
|
|
58
|
+
function lineVertical(isShow = true, left = 0) {
|
|
59
|
+
if (verticalLineRef.current && layersRef.current) {
|
|
60
|
+
verticalLineRef.current.style.display = isShow ? 'block' : 'none';
|
|
61
|
+
layersRef.current.style.opacity = isShow ? '.5' : '1';
|
|
62
|
+
verticalLineRef.current.style.left = `${left}px`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function lineHorizontal(isShow = true, top = 0) {
|
|
66
|
+
if (horizontalLineRef.current && layersRef.current) {
|
|
67
|
+
horizontalLineRef.current.style.display = isShow ? 'block' : 'none';
|
|
68
|
+
layersRef.current.style.opacity = isShow ? '.5' : '1';
|
|
69
|
+
horizontalLineRef.current.style.top = `${top}px`;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const handleChangeGrid = () => {
|
|
73
|
+
clearTimeout(onChangeTimoutRef.current);
|
|
74
|
+
onChangeTimoutRef.current = setTimeout(() => {
|
|
75
|
+
if (containerRef.current && cellsRef.current && cellsRef.current[0]) {
|
|
76
|
+
const container = containerRef.current.getBoundingClientRect();
|
|
77
|
+
// Object.values(cordinatesRef.current);
|
|
78
|
+
const childs = Object.values(cellsRef.current).map(cell => {
|
|
79
|
+
if (!cell || !cell.current)
|
|
80
|
+
return;
|
|
81
|
+
const childBox = cell.current.getBoundingClientRect();
|
|
82
|
+
return {
|
|
83
|
+
width: childBox.width,
|
|
84
|
+
height: childBox.height,
|
|
85
|
+
x: childBox.x - container.x,
|
|
86
|
+
y: childBox.y - container.y,
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
if (typeof onChange === 'function') {
|
|
90
|
+
onChange(grid, childs, firstChangeRef.current ? 'system' : 'user');
|
|
91
|
+
acceptUpdateRef.current = false;
|
|
92
|
+
firstChangeRef.current = false;
|
|
93
|
+
clearTimeout(onChangeDelayRef.current);
|
|
94
|
+
onChangeDelayRef.current = setTimeout(() => {
|
|
95
|
+
acceptUpdateRef.current = true;
|
|
96
|
+
}, delayUpdate);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, 300);
|
|
100
|
+
};
|
|
101
|
+
const isFollow = (cell, line, isCol = true) => isCol
|
|
102
|
+
? (cell.colEnd !== line || !cell.sizeX) && (cell.colStart !== line || !cell.sizeX)
|
|
103
|
+
: (cell.rowEnd !== line || !cell.sizeY) && (cell.rowStart !== line || !cell.sizeY);
|
|
104
|
+
const notFollow = (cell, line, isCol = true) => !isFollow(cell, line, isCol);
|
|
105
|
+
const floorSize = size => Math.floor(size);
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
handleChangeGrid();
|
|
108
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
109
|
+
}, [grid]);
|
|
110
|
+
useDeepCompareEffect(() => {
|
|
111
|
+
// console.log('changed grid', initGrid, acceptUpdateRef.current, initGrid?.rows, initGrid?.cols)
|
|
112
|
+
// console.log(initRef.current < 2,!initDoneRef.current, acceptUpdateRef.current)
|
|
113
|
+
if ((initRef.current < 2 || !initDoneRef.current || acceptUpdateRef.current) &&
|
|
114
|
+
(initGrid === null || initGrid === void 0 ? void 0 : initGrid.rows) &&
|
|
115
|
+
(initGrid === null || initGrid === void 0 ? void 0 : initGrid.cols)) {
|
|
116
|
+
// console.log('apply change...', buildGrid(initGrid))
|
|
117
|
+
initRef.current += 1;
|
|
118
|
+
firstChangeRef.current = true;
|
|
119
|
+
setGrid(buildGrid(initGrid));
|
|
120
|
+
resetBackgroundCellRef();
|
|
121
|
+
}
|
|
122
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
123
|
+
}, [initGrid]);
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
initDoneRef.current = true;
|
|
127
|
+
}, 3000);
|
|
128
|
+
const handleMove = e => {
|
|
129
|
+
// Resize Grid
|
|
130
|
+
if (startRef.current && gridRef.current && containerRef.current) {
|
|
131
|
+
const { type, line } = startRef.current;
|
|
132
|
+
const idx = line - 1;
|
|
133
|
+
const { gridTemplateRows, gridTemplateColumns, rows, cols, childs } = gridRef.current;
|
|
134
|
+
if (idx <= 0 || (type === 'row' && idx >= rows) || (type === 'column' && idx >= cols))
|
|
135
|
+
return;
|
|
136
|
+
const { clientX, clientY } = e;
|
|
137
|
+
if (type === 'row') {
|
|
138
|
+
const gridHeight = containerRef.current.offsetHeight;
|
|
139
|
+
const yDistant = clientY - startRef.current.clientY;
|
|
140
|
+
const yPercentDistant = (100 * yDistant) / gridHeight;
|
|
141
|
+
const minPercent = (100 * MIN_SIZE) / gridHeight;
|
|
142
|
+
// console.log('move Y', clientY, yDistant, yPercentDistant);
|
|
143
|
+
const newArr = [...gridTemplateRows];
|
|
144
|
+
newArr[idx - 1] += yPercentDistant;
|
|
145
|
+
newArr[idx] -= yPercentDistant;
|
|
146
|
+
if (newArr[idx - 1] >= minPercent && newArr[idx] >= minPercent) {
|
|
147
|
+
const newChilds = JSON.parse(JSON.stringify(childs));
|
|
148
|
+
let isValidChildSize = true;
|
|
149
|
+
newChilds.forEach((child, idx) => {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
if (isValidChildSize && notFollow(child, (_a = startRef.current) === null || _a === void 0 ? void 0 : _a.line, false)) {
|
|
152
|
+
if (child.rowStart === ((_b = startRef.current) === null || _b === void 0 ? void 0 : _b.line)) {
|
|
153
|
+
if (child.transformY) {
|
|
154
|
+
child.transformY = +child.transformY - yDistant;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
child.sizeY = +child.sizeY - yDistant;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
child.transformY &&
|
|
162
|
+
!child.movedBottom &&
|
|
163
|
+
(child.sizeY = +child.sizeY + yDistant);
|
|
164
|
+
}
|
|
165
|
+
// console.log('check...', startRef.current.line, child.transformY, yDistant, +child.transformY - yDistant)
|
|
166
|
+
if (child.sizeY < MIN_SIZE) {
|
|
167
|
+
isValidChildSize = false;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
isValidChildSize &&
|
|
172
|
+
setGrid(Object.assign(Object.assign({}, gridRef.current), { gridTemplateRows: newArr, childs: newChilds }));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
const xDistant = clientX - startRef.current.clientX;
|
|
177
|
+
const gridWidth = containerRef.current.offsetWidth;
|
|
178
|
+
const xPercentDistant = (100 * xDistant) / gridWidth;
|
|
179
|
+
const minPercent = (100 * MIN_SIZE) / gridWidth;
|
|
180
|
+
// console.log('move X', clientX, xDistant, xPercentDistant);
|
|
181
|
+
const newArr = [...gridTemplateColumns];
|
|
182
|
+
newArr[idx - 1] += xPercentDistant;
|
|
183
|
+
newArr[idx] -= xPercentDistant;
|
|
184
|
+
if (newArr[idx - 1] >= minPercent && newArr[idx] >= minPercent) {
|
|
185
|
+
const newChilds = JSON.parse(JSON.stringify(childs));
|
|
186
|
+
let isValidChildSize = true;
|
|
187
|
+
newChilds.forEach(child => {
|
|
188
|
+
if (isValidChildSize && notFollow(child, line)) {
|
|
189
|
+
if (child.colStart === line) {
|
|
190
|
+
if (child.transformX) {
|
|
191
|
+
child.transformX = +child.transformX - xDistant;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
child.sizeX = +child.sizeX - xDistant;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
child.transformX && !child.movedRight && (child.sizeX = +child.sizeX + xDistant);
|
|
199
|
+
}
|
|
200
|
+
// console.log('check...', startRef.current.line, child.transformX, xDistant, +child.transformX - xDistant)
|
|
201
|
+
if (child.sizeX < MIN_SIZE) {
|
|
202
|
+
isValidChildSize = false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
isValidChildSize &&
|
|
207
|
+
setGrid(Object.assign(Object.assign({}, gridRef.current), { gridTemplateColumns: newArr, childs: newChilds }));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
//-------------------------------------------
|
|
212
|
+
// Resize Cell
|
|
213
|
+
if (startCellRef.current && gridRef.current) {
|
|
214
|
+
const { clientX: startClientX, clientY: startClientY, direction, isRevert, leftCells, rightCells, } = startCellRef.current;
|
|
215
|
+
// const { rowStart, rowEnd, colStart, colEnd, transformX, transformY } = cell;
|
|
216
|
+
// const { gridTemplateRows, gridTemplateColumns, rows, cols, childs } = gridRef.current;
|
|
217
|
+
// if (
|
|
218
|
+
// idx < 0 ||
|
|
219
|
+
// (direction === 'top' && rowStart === 1) ||
|
|
220
|
+
// (direction === 'right' && colEnd === cols + 1) ||
|
|
221
|
+
// (direction === 'bottom' && rowEnd === rows + 1) ||
|
|
222
|
+
// (direction === 'left' && colStart === 1)
|
|
223
|
+
// )
|
|
224
|
+
// return;
|
|
225
|
+
const { clientX, clientY } = e;
|
|
226
|
+
if (['top', 'bottom'].includes(direction)) {
|
|
227
|
+
// const cellHeight = cellRef.current.offsetHeight;
|
|
228
|
+
let yDistant = clientY - startClientY;
|
|
229
|
+
// console.log('move Y', clientY, yDistant);
|
|
230
|
+
if (Math.abs(yDistant) > THREADHOLD) {
|
|
231
|
+
startCellRef.current.fallback = true;
|
|
232
|
+
}
|
|
233
|
+
let isValid = true;
|
|
234
|
+
const mapNewSizeTop = {};
|
|
235
|
+
const mapNewSizeBottom = {};
|
|
236
|
+
const leftKeys = Object.keys(leftCells);
|
|
237
|
+
leftKeys.forEach(cellIdx => {
|
|
238
|
+
const cell = leftCells[cellIdx];
|
|
239
|
+
let newHeight = (cell.sizeY || 0) + yDistant;
|
|
240
|
+
if (newHeight < MIN_SIZE) {
|
|
241
|
+
isValid = false;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
const cellCordinate = cordinatesRef.current[cellIdx];
|
|
245
|
+
// const cell = gridRef.current.childs[cellIdx];
|
|
246
|
+
const newYEnd = cellCordinate.y + newHeight;
|
|
247
|
+
const nearestCells = Object.entries(cordinatesRef.current).filter(cor => gridRef.current &&
|
|
248
|
+
gridRef.current.childs[cor[0]] &&
|
|
249
|
+
!leftKeys.includes(cor[0]) &&
|
|
250
|
+
gridRef.current.childs[cor[0]].colStart !== cell.colStart &&
|
|
251
|
+
Math.abs(cor[1].yEnd - newYEnd) <= THREADHOLD);
|
|
252
|
+
// console.log('nearestCells', nearestCells, newXEnd, leftKeys, cordinatesRef.current);
|
|
253
|
+
if (nearestCells.length && startCellRef.current) {
|
|
254
|
+
const nearestY = Math.abs(nearestCells[0][1].y - newYEnd) <= THREADHOLD
|
|
255
|
+
? nearestCells[0][1].y
|
|
256
|
+
: nearestCells[0][1].yEnd;
|
|
257
|
+
const delta = nearestY - newYEnd;
|
|
258
|
+
if (startCellRef.current.fallback ||
|
|
259
|
+
floorSize(cellCordinate.height) !== floorSize(newHeight + delta)) {
|
|
260
|
+
newHeight += delta;
|
|
261
|
+
yDistant += delta;
|
|
262
|
+
lineHorizontal(true, nearestY - 1);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
lineHorizontal(false);
|
|
267
|
+
}
|
|
268
|
+
mapNewSizeTop[cellIdx] = newHeight;
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
Object.keys(rightCells).forEach(cellIdx => {
|
|
272
|
+
const nextCell = rightCells[cellIdx];
|
|
273
|
+
const newHeightNextCell = (nextCell.sizeY || 0) - yDistant;
|
|
274
|
+
if (newHeightNextCell < MIN_SIZE) {
|
|
275
|
+
isValid = false;
|
|
276
|
+
}
|
|
277
|
+
mapNewSizeBottom[cellIdx] = [newHeightNextCell, nextCell];
|
|
278
|
+
});
|
|
279
|
+
if (isValid) {
|
|
280
|
+
const newChilds = [...gridRef.current.childs];
|
|
281
|
+
Object.keys(mapNewSizeTop).forEach(cellIdx => {
|
|
282
|
+
newChilds[cellIdx] = Object.assign(Object.assign({}, newChilds[cellIdx]), { sizeY: mapNewSizeTop[cellIdx], movedBottom: true });
|
|
283
|
+
});
|
|
284
|
+
Object.keys(mapNewSizeBottom).forEach(cellIdx => {
|
|
285
|
+
newChilds[cellIdx] = Object.assign(Object.assign({}, newChilds[cellIdx]), { sizeY: mapNewSizeBottom[cellIdx][0], transformY: (mapNewSizeBottom[cellIdx][1].transformY || 0) + yDistant, movedTop: true });
|
|
286
|
+
});
|
|
287
|
+
setGrid(Object.assign(Object.assign({}, gridRef.current), { childs: newChilds }));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
// const cellWidth = cellRef.current.offsetWidth;
|
|
292
|
+
let xDistant = clientX - startClientX;
|
|
293
|
+
// console.log('move X', clientX, xDistant);
|
|
294
|
+
if (Math.abs(xDistant) > THREADHOLD) {
|
|
295
|
+
startCellRef.current.fallback = true;
|
|
296
|
+
}
|
|
297
|
+
let isValid = true;
|
|
298
|
+
const mapNewSizeLeft = {};
|
|
299
|
+
const mapNewSizeRight = {};
|
|
300
|
+
const mapReset = {};
|
|
301
|
+
const leftKeys = Object.keys(leftCells);
|
|
302
|
+
leftKeys.forEach(cellIdx => {
|
|
303
|
+
const cell = leftCells[cellIdx];
|
|
304
|
+
let newWidth = (cell.sizeX || 0) + xDistant;
|
|
305
|
+
if (newWidth < MIN_SIZE) {
|
|
306
|
+
isValid = false;
|
|
307
|
+
}
|
|
308
|
+
else if (gridRef.current) {
|
|
309
|
+
const cellCordinate = cordinatesRef.current[cellIdx];
|
|
310
|
+
// const cell = gridRef.current.childs[cellIdx];
|
|
311
|
+
const newXEnd = cellCordinate.x + newWidth;
|
|
312
|
+
const nearestCells = Object.entries(cordinatesRef.current).filter(cor => gridRef.current &&
|
|
313
|
+
gridRef.current.childs[cor[0]] &&
|
|
314
|
+
!leftKeys.includes(cor[0]) &&
|
|
315
|
+
gridRef.current.childs[cor[0]].rowStart !== cell.rowStart &&
|
|
316
|
+
Math.abs(cor[1].xEnd - newXEnd) <= THREADHOLD);
|
|
317
|
+
// console.log('nearestCells', nearestCells, newXEnd, leftKeys, cordinatesRef.current);
|
|
318
|
+
if (nearestCells.length && startCellRef.current) {
|
|
319
|
+
const nearestX = Math.abs(nearestCells[0][1].x - newXEnd) <= THREADHOLD
|
|
320
|
+
? nearestCells[0][1].x
|
|
321
|
+
: nearestCells[0][1].xEnd;
|
|
322
|
+
const delta = nearestX - newXEnd;
|
|
323
|
+
if (startCellRef.current.fallback ||
|
|
324
|
+
floorSize(cellCordinate.width) !== floorSize(newWidth + delta)) {
|
|
325
|
+
newWidth += delta;
|
|
326
|
+
xDistant += delta;
|
|
327
|
+
lineVertical(true, nearestX - 1);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
lineVertical(false);
|
|
332
|
+
}
|
|
333
|
+
mapNewSizeLeft[cellIdx] = newWidth;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
Object.keys(rightCells).forEach(cellIdx => {
|
|
337
|
+
const nextCell = rightCells[cellIdx];
|
|
338
|
+
const newWidthNextCell = (nextCell.sizeX || 0) - xDistant;
|
|
339
|
+
if (newWidthNextCell < MIN_SIZE) {
|
|
340
|
+
isValid = false;
|
|
341
|
+
}
|
|
342
|
+
mapNewSizeRight[cellIdx] = [newWidthNextCell, nextCell];
|
|
343
|
+
});
|
|
344
|
+
if (isValid) {
|
|
345
|
+
const newChilds = [...gridRef.current.childs];
|
|
346
|
+
Object.keys(mapNewSizeLeft).forEach(cellIdx => {
|
|
347
|
+
newChilds[cellIdx] = Object.assign(Object.assign({}, newChilds[cellIdx]), { sizeX: mapNewSizeLeft[cellIdx], movedRight: true });
|
|
348
|
+
});
|
|
349
|
+
Object.keys(mapNewSizeRight).forEach(cellIdx => {
|
|
350
|
+
newChilds[cellIdx] = Object.assign(Object.assign({}, newChilds[cellIdx]), { sizeX: mapNewSizeRight[cellIdx][0], transformX: (mapNewSizeRight[cellIdx][1].transformX || 0) + xDistant, movedLeft: true });
|
|
351
|
+
});
|
|
352
|
+
setGrid(Object.assign(Object.assign({}, gridRef.current), { childs: newChilds }));
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
//------------------------------------------
|
|
357
|
+
// if (selectRef.current) {}
|
|
358
|
+
};
|
|
359
|
+
const handleUp = () => {
|
|
360
|
+
startRef.current = null;
|
|
361
|
+
startCellRef.current = null;
|
|
362
|
+
lineVertical(false);
|
|
363
|
+
lineHorizontal(false);
|
|
364
|
+
};
|
|
365
|
+
const isMac = () => navigator.platform.indexOf('Mac') >= 0;
|
|
366
|
+
window.addEventListener('mousemove', handleMove);
|
|
367
|
+
window.addEventListener('mouseup', handleUp);
|
|
368
|
+
const handleKeyDown = e => {
|
|
369
|
+
if (!ctrlKeyRef.current && ((isMac() && e.metaKey) || (!isMac() && e.key === 'Control'))) {
|
|
370
|
+
ctrlKeyRef.current = true;
|
|
371
|
+
// console.log('ctrlKeyRef', ctrlKeyRef.current);
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
const handleKeyUp = () => {
|
|
375
|
+
ctrlKeyRef.current = false;
|
|
376
|
+
// console.log('ctrlKeyRef', ctrlKeyRef.current);
|
|
377
|
+
};
|
|
378
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
379
|
+
window.addEventListener('keyup', handleKeyUp);
|
|
380
|
+
return () => {
|
|
381
|
+
window.removeEventListener('mousemove', handleMove);
|
|
382
|
+
window.removeEventListener('mouseup', handleUp);
|
|
383
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
384
|
+
window.removeEventListener('keyup', handleKeyUp);
|
|
385
|
+
};
|
|
386
|
+
}, []);
|
|
387
|
+
// const rebaseCordinate = (x, y, ...rest) => {
|
|
388
|
+
// if (containerRef.current) {
|
|
389
|
+
// const container = containerRef.current.getBoundingClientRect();
|
|
390
|
+
// console.log('rebased', x - container.x, y - container.y, ...rest);
|
|
391
|
+
// }
|
|
392
|
+
// };
|
|
393
|
+
const activeCell = ({ idx }) => {
|
|
394
|
+
setGrid(prev => (Object.assign(Object.assign({}, prev), { childs: prev.childs.map((c, i) => (Object.assign(Object.assign({}, c), { active: i === idx }))) })));
|
|
395
|
+
};
|
|
396
|
+
const findResizeCells = ({ type, line, direction, idx,
|
|
397
|
+
// cell,
|
|
398
|
+
isRevert, leftCols = [], rightCols = [], dones = [], level = 0, }) => {
|
|
399
|
+
// left is current cell and right is the opposite
|
|
400
|
+
if (dones.includes(idx)) {
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
const { childs } = grid;
|
|
404
|
+
const cellBox = cordinatesRef.current[idx];
|
|
405
|
+
dones.push(idx);
|
|
406
|
+
if (level === 0 && !leftCols.length) {
|
|
407
|
+
leftCols.push(idx);
|
|
408
|
+
}
|
|
409
|
+
let isEnd = true;
|
|
410
|
+
if (type === 'column') {
|
|
411
|
+
childs.forEach((cell, i) => {
|
|
412
|
+
if (((direction === 'left' &&
|
|
413
|
+
cell.colEnd === line &&
|
|
414
|
+
Math.abs(cellBox.x - cordinatesRef.current[i].xEnd) < 1) ||
|
|
415
|
+
(direction === 'right' &&
|
|
416
|
+
cell.colStart === line &&
|
|
417
|
+
Math.abs(cellBox.xEnd - cordinatesRef.current[i].x) < 1)) &&
|
|
418
|
+
!(floorSize(cordinatesRef.current[i].y) >= floorSize(cellBox.yEnd) ||
|
|
419
|
+
floorSize(cordinatesRef.current[i].yEnd) <= floorSize(cellBox.y))) {
|
|
420
|
+
if (!rightCols.includes(i)) {
|
|
421
|
+
rightCols.push(i);
|
|
422
|
+
// const cellIRef = cellsRef.current[i];
|
|
423
|
+
// if (cellIRef.current) {
|
|
424
|
+
// cellIRef.current.style.background = 'green';
|
|
425
|
+
// }
|
|
426
|
+
isEnd = false;
|
|
427
|
+
}
|
|
428
|
+
// else if (direction === 'right' && !leftCols.includes(i)) {
|
|
429
|
+
// leftCols.push(i);
|
|
430
|
+
// const cellIRef = cellsRef.current[i];
|
|
431
|
+
// if (cellIRef.current) {
|
|
432
|
+
// cellIRef.current.style.background = 'blue';
|
|
433
|
+
// }
|
|
434
|
+
// isEnd = false;
|
|
435
|
+
// }
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
childs.forEach((cell, i) => {
|
|
441
|
+
if (((direction === 'top' &&
|
|
442
|
+
cell.rowEnd === line &&
|
|
443
|
+
Math.abs(cellBox.y - cordinatesRef.current[i].yEnd) < 1) ||
|
|
444
|
+
(direction === 'bottom' &&
|
|
445
|
+
cell.rowStart === line &&
|
|
446
|
+
Math.abs(cellBox.yEnd - cordinatesRef.current[i].y) < 1)) &&
|
|
447
|
+
!(floorSize(cordinatesRef.current[i].x) >= floorSize(cellBox.xEnd) ||
|
|
448
|
+
floorSize(cordinatesRef.current[i].xEnd) <= floorSize(cellBox.x))) {
|
|
449
|
+
if (!rightCols.includes(i)) {
|
|
450
|
+
rightCols.push(i);
|
|
451
|
+
// const cellIRef = cellsRef.current[i];
|
|
452
|
+
// if (cellIRef.current) {
|
|
453
|
+
// cellIRef.current.style.background = 'green';
|
|
454
|
+
// }
|
|
455
|
+
isEnd = false;
|
|
456
|
+
}
|
|
457
|
+
// else if (direction === 'bottom' && !leftCols.includes(i)) {
|
|
458
|
+
// leftCols.push(i);
|
|
459
|
+
// const cellIRef = cellsRef.current[i];
|
|
460
|
+
// if (cellIRef.current) {
|
|
461
|
+
// cellIRef.current.style.background = 'blue';
|
|
462
|
+
// }
|
|
463
|
+
// isEnd = false;
|
|
464
|
+
// }
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
// console.log(' find', direction, idx, leftCols, rightCols, dones, cordinatesRef.current);
|
|
469
|
+
if (!isEnd) {
|
|
470
|
+
// console.log('continue find', leftCols, rightCols);
|
|
471
|
+
rightCols
|
|
472
|
+
.filter(i => !dones.includes(i))
|
|
473
|
+
.forEach(i => {
|
|
474
|
+
findResizeCells({
|
|
475
|
+
type,
|
|
476
|
+
line,
|
|
477
|
+
direction: { left: 'right', right: 'left', top: 'bottom', bottom: 'top' }[direction] || '',
|
|
478
|
+
idx: i,
|
|
479
|
+
isRevert,
|
|
480
|
+
leftCols: rightCols,
|
|
481
|
+
rightCols: leftCols,
|
|
482
|
+
dones,
|
|
483
|
+
level: level + 1,
|
|
484
|
+
});
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
return { leftCols, rightCols };
|
|
488
|
+
};
|
|
489
|
+
const handleDownCell = (e, type, line, idx, direction, cell, cellRef) => {
|
|
490
|
+
const { clientX, clientY } = e;
|
|
491
|
+
// rebaseCordinate(clientX, clientY, type, line);
|
|
492
|
+
const isRevert = ['top', 'left'].includes(direction);
|
|
493
|
+
// let newIdx = isRevert ? idx - 1 : idx;
|
|
494
|
+
// let nextCellIdx = isRevert ? idx - 1 : idx + 1;
|
|
495
|
+
const leftCols = [idx];
|
|
496
|
+
const rightCols = [];
|
|
497
|
+
findResizeCells({ type, line, direction, idx, isRevert, leftCols, rightCols });
|
|
498
|
+
// console.log('change cell', leftCols, rightCols);
|
|
499
|
+
// if (['top', 'bottom'].includes(direction)) {
|
|
500
|
+
// nextCellIdx = grid.childs.findIndex(
|
|
501
|
+
// b =>
|
|
502
|
+
// b.colStart === cell.colStart &&
|
|
503
|
+
// ((isRevert && b.rowEnd === cell.rowStart) || (!isRevert && b.rowStart === cell.rowEnd)),
|
|
504
|
+
// );
|
|
505
|
+
// newIdx = isRevert ? nextCellIdx : idx;
|
|
506
|
+
// }
|
|
507
|
+
// if (nextCellIdx < 0) return;
|
|
508
|
+
if (!leftCols.length || !rightCols.length)
|
|
509
|
+
return;
|
|
510
|
+
const leftCells = {};
|
|
511
|
+
const rightCells = {};
|
|
512
|
+
leftCols.forEach(i => {
|
|
513
|
+
var _a, _b;
|
|
514
|
+
const cell = grid.childs[i];
|
|
515
|
+
const cellRef = cellsRef.current[i];
|
|
516
|
+
leftCells[i] = Object.assign({ sizeX: cell.sizeX || ((_a = cellRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0, sizeY: cell.sizeY || ((_b = cellRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0, transformX: cell.transformX || 0, transformY: cell.transformY || 0, idx: i, cellRef }, cell);
|
|
517
|
+
});
|
|
518
|
+
rightCols.forEach(i => {
|
|
519
|
+
var _a, _b;
|
|
520
|
+
const cell = grid.childs[i];
|
|
521
|
+
const cellRef = cellsRef.current[i];
|
|
522
|
+
rightCells[i] = Object.assign({ sizeX: cell.sizeX || ((_a = cellRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0, sizeY: cell.sizeY || ((_b = cellRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0, transformX: cell.transformX || 0, transformY: cell.transformY || 0, idx: i, cellRef }, cell);
|
|
523
|
+
});
|
|
524
|
+
const newDirection = isRevert
|
|
525
|
+
? {
|
|
526
|
+
left: 'right',
|
|
527
|
+
right: 'left',
|
|
528
|
+
top: 'bottom',
|
|
529
|
+
bottom: 'top',
|
|
530
|
+
}[direction]
|
|
531
|
+
: direction;
|
|
532
|
+
startCellRef.current = {
|
|
533
|
+
clientX,
|
|
534
|
+
clientY,
|
|
535
|
+
// idx: newIdx,
|
|
536
|
+
direction: newDirection,
|
|
537
|
+
isRevert,
|
|
538
|
+
leftCells: isRevert ? rightCells : leftCells,
|
|
539
|
+
rightCells: !isRevert ? rightCells : leftCells,
|
|
540
|
+
};
|
|
541
|
+
// console.log('down cell', clientX, clientY, idx, direction, cell, cellRef);
|
|
542
|
+
gridRef.current = grid;
|
|
543
|
+
};
|
|
544
|
+
const handleDown = (e, type, line, idx, direction, cell, cellRef) => {
|
|
545
|
+
const { clientX, clientY } = e;
|
|
546
|
+
// rebaseCordinate(clientX, clientY, type, line);
|
|
547
|
+
startRef.current = { clientX, clientY, type, line };
|
|
548
|
+
// const isRevert = ['top', 'left'].includes(direction);
|
|
549
|
+
// const { leftCols, rightCols } = findResizeCells({ type, line, direction, idx, isRevert });
|
|
550
|
+
// console.log('change cell', leftCols, rightCols);
|
|
551
|
+
// console.log('down', type, line, clientX, clientY);
|
|
552
|
+
gridRef.current = JSON.parse(JSON.stringify(grid));
|
|
553
|
+
};
|
|
554
|
+
const handleUp = (e, direction, idx) => {
|
|
555
|
+
// console.log('up', direction, idx, e);
|
|
556
|
+
startRef.current = null;
|
|
557
|
+
startCellRef.current = null;
|
|
558
|
+
lineVertical(false);
|
|
559
|
+
lineHorizontal(false);
|
|
560
|
+
};
|
|
561
|
+
const downSelect = (idx, cell) => {
|
|
562
|
+
// console.log('dow select', idx, cell);
|
|
563
|
+
!cell.active && activeCell({ idx });
|
|
564
|
+
selectRef.current = { idx, cell };
|
|
565
|
+
gridRef.current = grid;
|
|
566
|
+
};
|
|
567
|
+
const unMerge = (cell, idx) => {
|
|
568
|
+
const { colStart, colEnd, rowStart, rowEnd } = cell;
|
|
569
|
+
if (colStart + 1 === colEnd && rowStart + 1 === rowEnd) {
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
const newChilds = [...grid.childs];
|
|
573
|
+
for (let i = rowStart; i < rowEnd; i++) {
|
|
574
|
+
for (let j = colStart; j < colEnd; j++) {
|
|
575
|
+
const rStart = i;
|
|
576
|
+
const cStart = j;
|
|
577
|
+
const rEnd = rStart + 1;
|
|
578
|
+
const cEnd = cStart + 1;
|
|
579
|
+
// console.log('merge', i, j, rStart, cStart, rEnd, cEnd)
|
|
580
|
+
const newChild = {
|
|
581
|
+
colStart: cStart,
|
|
582
|
+
colEnd: cEnd,
|
|
583
|
+
rowStart: rStart,
|
|
584
|
+
rowEnd: rEnd,
|
|
585
|
+
};
|
|
586
|
+
if (i === rowStart && j === colStart) {
|
|
587
|
+
newChilds[idx] = newChild;
|
|
588
|
+
}
|
|
589
|
+
else if (rStart !== rowStart ||
|
|
590
|
+
rEnd !== rowEnd ||
|
|
591
|
+
cStart !== colStart ||
|
|
592
|
+
cEnd !== colEnd) {
|
|
593
|
+
newChilds.splice(idx, 0, newChild);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
setGrid(prev => (Object.assign(Object.assign({}, prev), { childs: newChilds })));
|
|
598
|
+
};
|
|
599
|
+
function resetBackgroundCellRef() {
|
|
600
|
+
Object.values(cellsRef.current).forEach(r => {
|
|
601
|
+
if (r.current) {
|
|
602
|
+
r.current.style.background = 'unset';
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
const upSelect = (idx, cell) => {
|
|
607
|
+
// console.log('up select', idx, cell);
|
|
608
|
+
if (selectRef.current &&
|
|
609
|
+
selectEndRef.current &&
|
|
610
|
+
gridRef.current &&
|
|
611
|
+
selectRef.current.idx !== selectEndRef.current.idx &&
|
|
612
|
+
(selectEndRef.current.cell.rowEnd > selectRef.current.cell.rowEnd ||
|
|
613
|
+
selectEndRef.current.cell.colEnd > selectRef.current.cell.colEnd)) {
|
|
614
|
+
resetBackgroundCellRef();
|
|
615
|
+
// console.log('merge', selectRef.current, selectEndRef.current)
|
|
616
|
+
const { cell: cellStart, idx: idxStart } = selectRef.current;
|
|
617
|
+
const { cell: cellEnd, idx: idxEnd, hCells } = selectEndRef.current;
|
|
618
|
+
const newChilds = JSON.parse(JSON.stringify(gridRef.current.childs));
|
|
619
|
+
newChilds[idxStart].rowEnd = cellEnd.rowEnd;
|
|
620
|
+
newChilds[idxStart].colEnd = cellEnd.colEnd;
|
|
621
|
+
delete newChilds[idxStart].sizeX;
|
|
622
|
+
delete newChilds[idxStart].sizeY;
|
|
623
|
+
hCells.reverse().forEach(i => {
|
|
624
|
+
if (i !== idxStart) {
|
|
625
|
+
newChilds.splice(i, 1);
|
|
626
|
+
delete cellsRef.current[i];
|
|
627
|
+
delete cordinatesRef.current[i];
|
|
628
|
+
// console.log('del corr', i, cordinatesRef.current)
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
setGrid(Object.assign(Object.assign({}, gridRef.current), { childs: newChilds }));
|
|
632
|
+
}
|
|
633
|
+
selectRef.current = null;
|
|
634
|
+
selectEndRef.current = null;
|
|
635
|
+
};
|
|
636
|
+
const hoverSelect = (idx, cell) => {
|
|
637
|
+
if (selectRef.current && gridRef.current) {
|
|
638
|
+
// console.log('hover select', idx, cell);
|
|
639
|
+
const { cell: cellStart, idx: idxStart } = selectRef.current;
|
|
640
|
+
const hCells = [];
|
|
641
|
+
gridRef.current.childs.forEach((child, i) => {
|
|
642
|
+
if (child.rowStart >= cellStart.rowStart &&
|
|
643
|
+
child.rowEnd <= cell.rowEnd &&
|
|
644
|
+
child.colStart >= cellStart.colStart &&
|
|
645
|
+
child.colEnd <= cell.colEnd) {
|
|
646
|
+
hCells.push(i);
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
// console.log('hCells', hCells)
|
|
650
|
+
resetBackgroundCellRef();
|
|
651
|
+
hCells.forEach(i => {
|
|
652
|
+
const cellRef = cellsRef.current[i];
|
|
653
|
+
if (cellRef && cellRef.current) {
|
|
654
|
+
cellRef.current.style.background = selectColor || 'unset';
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
selectEndRef.current = { cell, idx, hCells };
|
|
658
|
+
gridRef.current = grid;
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
const setRef = (idx, ref) => {
|
|
662
|
+
cellsRef.current[idx] = ref;
|
|
663
|
+
// console.log('cellsRef.current', cellsRef.current)
|
|
664
|
+
};
|
|
665
|
+
const setCordinate = (idx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
666
|
+
// while(!cellsRef[idx]) {
|
|
667
|
+
// await new Promise(r => {setTimeout(r, 100)});
|
|
668
|
+
// console.log('wait', idx, cellsRef[idx])
|
|
669
|
+
// }
|
|
670
|
+
var _b;
|
|
671
|
+
if (containerRef.current) {
|
|
672
|
+
const container = containerRef.current.getBoundingClientRect();
|
|
673
|
+
const childRef = cellsRef.current[idx];
|
|
674
|
+
const childBox = (_b = childRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
675
|
+
if (childBox) {
|
|
676
|
+
const cordinate = {
|
|
677
|
+
width: childBox.width,
|
|
678
|
+
height: childBox.height,
|
|
679
|
+
x: childBox.x - container.x,
|
|
680
|
+
y: childBox.y - container.y,
|
|
681
|
+
xEnd: childBox.x - container.x + childBox.width,
|
|
682
|
+
yEnd: childBox.y - container.y + childBox.height,
|
|
683
|
+
};
|
|
684
|
+
cordinatesRef.current[idx] = cordinate;
|
|
685
|
+
// console.log('set cor', idx, cordinate);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
// console.log('set corr', idx, cordinatesRef.current)
|
|
689
|
+
});
|
|
690
|
+
const renderGrid = (style) => {
|
|
691
|
+
const { gridTemplateColumns, gridTemplateRows, childs } = grid;
|
|
692
|
+
// console.log('grid', { gridTemplateColumns, gridTemplateRows, childs });
|
|
693
|
+
return (React.createElement("div", { className: "grid-container", ref: containerRef, style: Object.assign({ gridTemplateColumns: gridTemplateColumns.map(fr => `${fr}%`).join(' '), gridTemplateRows: gridTemplateRows.map(fr => `${fr}%`).join(' ') }, style) }, childs.map((cell, idx) => (React.createElement(Cell, { key: `${cell.rowStart}-${cell.colStart}-${cell.rowEnd}-${cell.colEnd}`, idx: idx, cell: cell, down: handleDown, downCell: handleDownCell, up: handleUp, setRef: setRef, setCordinate: setCordinate, downSelect: downSelect, upSelect: upSelect, hoverSelect: hoverSelect, unMerge: unMerge, renderCell: renderCell, borderStyle: cellBorder, style: cellStyle, activeStyle: cellActiveStyle, isPreview: isPreview, rowPercentage: grid.gridTemplateRows[cell.rowStart - 1], colPercentage: grid.gridTemplateColumns[cell.colStart - 1], ctrlKeyRef: ctrlKeyRef })))));
|
|
694
|
+
};
|
|
695
|
+
const handleUpLine = () => {
|
|
696
|
+
lineVertical(false);
|
|
697
|
+
lineHorizontal(false);
|
|
698
|
+
};
|
|
699
|
+
const _a = containerStyle || {}, { borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius, borderTopWidth, borderRightWidth, borderBottomWidth, borderLeftWidth, borderStyle, borderColor } = _a, rest = __rest(_a, ["borderTopLeftRadius", "borderTopRightRadius", "borderBottomRightRadius", "borderBottomLeftRadius", "borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth", "borderStyle", "borderColor"]);
|
|
700
|
+
const renderLines = () => (React.createElement(React.Fragment, null,
|
|
701
|
+
React.createElement(StyledLine, { ref: verticalLineRef, className: "vertical", onMouseUp: handleUpLine }),
|
|
702
|
+
React.createElement(StyledLine, { ref: horizontalLineRef, className: "horizontal", onMouseUp: handleUpLine })));
|
|
703
|
+
return (React.createElement(StyledGrid, { className: "grid-wrapper", isCompact: !!isCompact },
|
|
704
|
+
React.createElement("div", { className: "layers", ref: layersRef },
|
|
705
|
+
React.createElement(StyledBGLayer, { style: {
|
|
706
|
+
backgroundImage: image ? `url(${image})` : 'unset',
|
|
707
|
+
backgroundSize: imageSize === 'fill' ? '100% 100%' : imageSize,
|
|
708
|
+
backgroundPosition: imagePosition,
|
|
709
|
+
} }),
|
|
710
|
+
React.createElement(StyledMiddleLayer, { style: {
|
|
711
|
+
borderTopLeftRadius,
|
|
712
|
+
borderTopRightRadius,
|
|
713
|
+
borderBottomRightRadius,
|
|
714
|
+
borderBottomLeftRadius,
|
|
715
|
+
borderTopWidth,
|
|
716
|
+
borderRightWidth,
|
|
717
|
+
borderBottomWidth,
|
|
718
|
+
borderLeftWidth,
|
|
719
|
+
borderStyle,
|
|
720
|
+
borderColor,
|
|
721
|
+
} }),
|
|
722
|
+
renderGrid(Object.assign(Object.assign({}, rest), { borderTopLeftRadius,
|
|
723
|
+
borderTopRightRadius,
|
|
724
|
+
borderBottomRightRadius,
|
|
725
|
+
borderBottomLeftRadius }))),
|
|
726
|
+
renderLines()));
|
|
727
|
+
};
|
|
728
|
+
ResizeGrid.defaultProps = defaultProps;
|