@configuratorware/configurator-frontendgui 1.28.4 → 1.29.0
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/App/Constant.js +73 -0
- package/App/Error/DevelopmentErrorPage/index.js +74 -0
- package/App/Error/ErrorBoundary.js +98 -0
- package/App/Error/ProductionErrorPage/Style.scss +47 -0
- package/App/Error/ProductionErrorPage/index.js +43 -0
- package/App/Error/ProductionErrorPage/index.story.js +13 -0
- package/App/Error/ProductionErrorPage/res/error_gears.png +0 -0
- package/App/Frame.js +95 -0
- package/App/Modules/Creator/Components/ConfigurationvariantItem/Styles.scss +33 -0
- package/App/Modules/Creator/Components/ConfigurationvariantItem/index.js +118 -0
- package/App/Modules/Creator/Components/ConfigurationvariantSelection/Styles.scss +47 -0
- package/App/Modules/Creator/Components/ConfigurationvariantSelection/index.js +130 -0
- package/App/Modules/Creator/Components/CustomTitleEditor/Styles.scss +43 -0
- package/App/Modules/Creator/Components/CustomTitleEditor/index.js +144 -0
- package/App/Modules/Creator/Components/ExternalVisualization/index.js +140 -0
- package/App/Modules/Creator/Components/FastConfiguration/SelectableRow.js +128 -0
- package/App/Modules/Creator/Components/FastConfiguration/Styles.scss +53 -0
- package/App/Modules/Creator/Components/FastConfiguration/index.js +280 -0
- package/App/Modules/Creator/Components/FastConfigurationRow/Styles.scss +45 -0
- package/App/Modules/Creator/Components/FastConfigurationRow/index.js +78 -0
- package/App/Modules/Creator/Components/FastConfigurationSelect/Styles.scss +35 -0
- package/App/Modules/Creator/Components/FastConfigurationSelect/index.js +251 -0
- package/App/Modules/Creator/Components/FormattedNumber/index.js +45 -0
- package/App/Modules/Creator/Components/FormattedPrice/index.js +57 -0
- package/App/Modules/Creator/Components/FullScreenView/FullScreenView.js +104 -0
- package/App/Modules/Creator/Components/Incompatibility/OptionRule/index.js +182 -0
- package/App/Modules/Creator/Components/Incompatibility/RuleComponent.js +88 -0
- package/App/Modules/Creator/Components/Incompatibility/index.js +251 -0
- package/App/Modules/Creator/Components/InvalidConfigurationNotice/index.js +164 -0
- package/App/Modules/Creator/Components/LoginForm/Styles.scss +9 -0
- package/App/Modules/Creator/Components/LoginForm/index.js +129 -0
- package/App/Modules/Creator/Components/Option/index.js +545 -0
- package/App/Modules/Creator/Components/Option/index.story.js +154 -0
- package/App/Modules/Creator/Components/OptionAmount/index.js +236 -0
- package/App/Modules/Creator/Components/OptionGroup/index.js +55 -0
- package/App/Modules/Creator/Components/Optiondetail/ZoomImage/index.js +173 -0
- package/App/Modules/Creator/Components/Optiondetail/index.js +499 -0
- package/App/Modules/Creator/Components/Optiondetail/index.story.js +117 -0
- package/App/Modules/Creator/Components/OptionsList/index.js +193 -0
- package/App/Modules/Creator/Components/Price/Styles.scss +3 -0
- package/App/Modules/Creator/Components/Price/index.js +79 -0
- package/App/Modules/Creator/Components/ProductPart/index.js +185 -0
- package/App/Modules/Creator/Components/ProductPart/index.story.js +88 -0
- package/App/Modules/Creator/Components/ProductPartsList/index.js +150 -0
- package/App/Modules/Creator/Components/ProductPartsList/index.story.js +101 -0
- package/App/Modules/Creator/Components/SavedConfiguration/Styles.scss +19 -0
- package/App/Modules/Creator/Components/SavedConfiguration/index.js +82 -0
- package/App/Modules/Creator/Components/ShareConfiguration/Styles.scss +23 -0
- package/App/Modules/Creator/Components/ShareConfiguration/index.js +224 -0
- package/App/Modules/Creator/Components/StockInformation/index.js +93 -0
- package/App/Modules/Creator/Components/StoreConfigurationForm/Styles.scss +5 -0
- package/App/Modules/Creator/Components/StoreConfigurationForm/index.js +123 -0
- package/App/Modules/Creator/Components/Tools/Styles.scss +44 -0
- package/App/Modules/Creator/Components/Tools/index.js +102 -0
- package/App/Modules/Creator/Components/ValidationResult/Styles.scss +45 -0
- package/App/Modules/Creator/Components/ValidationResult/index.js +165 -0
- package/App/Modules/Creator/Components/index.js +84 -0
- package/App/Modules/Creator/Containers/AmountPrice/index.js +26 -0
- package/App/Modules/Creator/Containers/ConfigurationvariantSelection/index.js +60 -0
- package/App/Modules/Creator/Containers/CustomTitleEditor/index.js +52 -0
- package/App/Modules/Creator/Containers/FastConfiguration/index.js +62 -0
- package/App/Modules/Creator/Containers/FormattedPrice/index.js +31 -0
- package/App/Modules/Creator/Containers/Incompatibility/index.js +40 -0
- package/App/Modules/Creator/Containers/InvalidConfigurationNotice/index.js +89 -0
- package/App/Modules/Creator/Containers/LoadingOverlay/index.js +26 -0
- package/App/Modules/Creator/Containers/Optiondetail/index.js +48 -0
- package/App/Modules/Creator/Containers/OptionsList/index.js +49 -0
- package/App/Modules/Creator/Containers/ProductPart/index.js +26 -0
- package/App/Modules/Creator/Containers/ProductPartsList/index.js +49 -0
- package/App/Modules/Creator/Containers/SavedConfigurationContainer/index.js +25 -0
- package/App/Modules/Creator/Containers/ShareConfiguration/index.js +42 -0
- package/App/Modules/Creator/Containers/StockInformation/index.js +33 -0
- package/App/Modules/Creator/Containers/Tools/index.js +44 -0
- package/App/Modules/Creator/Containers/ValidationResult/index.js +34 -0
- package/App/Modules/Creator/Containers/index.js +175 -0
- package/App/Modules/Creator/CreatorScreen.js +307 -0
- package/App/Modules/Creator/Layouts/DefaultLayout.js +260 -0
- package/App/Modules/Creator/Styles.scss +216 -0
- package/App/Modules/Designer/Components/AddGalleryImage/index.js +234 -0
- package/App/Modules/Designer/Components/AddGalleryImage/index.story.js +94 -0
- package/App/Modules/Designer/Components/AddGalleryImage/index.test.js +151 -0
- package/App/Modules/Designer/Components/AddVisualElement/Styles.scss +0 -0
- package/App/Modules/Designer/Components/AddVisualElement/index.js +278 -0
- package/App/Modules/Designer/Components/AddVisualElement/index.story.js +24 -0
- package/App/Modules/Designer/Components/AddVisualElement/index.test.js +47 -0
- package/App/Modules/Designer/Components/CloseDesignEditor/index.js +130 -0
- package/App/Modules/Designer/Components/CloseGraphicsEditorButton/index.js +54 -0
- package/App/Modules/Designer/Components/ColorPalettes/ColorPalettesSearch.js +175 -0
- package/App/Modules/Designer/Components/ColorPalettes/index.js +814 -0
- package/App/Modules/Designer/Components/ColorPalettes/index.story.js +158 -0
- package/App/Modules/Designer/Components/ColorPalettes/index.test.js +150 -0
- package/App/Modules/Designer/Components/DesignAreaControlbox/Styles.scss +0 -0
- package/App/Modules/Designer/Components/DesignAreaControlbox/index.js +467 -0
- package/App/Modules/Designer/Components/DesignAreaControlbox/index.story.js +272 -0
- package/App/Modules/Designer/Components/DesignAreaControlbox/index.test.js +164 -0
- package/App/Modules/Designer/Components/DesignerSelectionToolbox/CustomFontOverlay.js +162 -0
- package/App/Modules/Designer/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.js +425 -0
- package/App/Modules/Designer/Components/DesignerSelectionToolbox/fontItemUtils.js +48 -0
- package/App/Modules/Designer/Components/Dialog/index.js +125 -0
- package/App/Modules/Designer/Components/EditDesignButton/index.js +128 -0
- package/App/Modules/Designer/Components/FeedbackNotice/index.js +110 -0
- package/App/Modules/Designer/Components/FeedbackNotice/index.test.js +16 -0
- package/App/Modules/Designer/Components/FullScreenView/FullScreenView.js +63 -0
- package/App/Modules/Designer/Components/ImageColorPicker/ImageColorPicker.dev.js +32 -0
- package/App/Modules/Designer/Components/ImageColorPicker/ImageColorPicker.js +430 -0
- package/App/Modules/Designer/Components/ImageColorize/index.js +636 -0
- package/App/Modules/Designer/Components/ImageColorize/index.story.js +73 -0
- package/App/Modules/Designer/Components/ImageControlbox/index.js +302 -0
- package/App/Modules/Designer/Components/ImageEditDialog/ImageThumbnail.js +171 -0
- package/App/Modules/Designer/Components/ImageEditDialog/ImageUpload.js +478 -0
- package/App/Modules/Designer/Components/ImageEditDialog/index.js +716 -0
- package/App/Modules/Designer/Components/ImageEditDialog/res/baseline_colorize_black_24dp.png +0 -0
- package/App/Modules/Designer/Components/ImageEditDialog/res/checkers_tile.png +0 -0
- package/App/Modules/Designer/Components/ImageLibraryFilter/index.js +179 -0
- package/App/Modules/Designer/Components/ImageLibraryThumbnail/Styles.scss +14 -0
- package/App/Modules/Designer/Components/ImageLibraryThumbnail/index.js +165 -0
- package/App/Modules/Designer/Components/ObjectTools/index.js +146 -0
- package/App/Modules/Designer/Components/Select/index.js +171 -0
- package/App/Modules/Designer/Components/TextControlbox/TextFormatIcon.js +48 -0
- package/App/Modules/Designer/Components/TextControlbox/index.js +656 -0
- package/App/Modules/Designer/Components/TextControlbox/index.story.js +109 -0
- package/App/Modules/Designer/Components/TextControlbox/index.test.js +172 -0
- package/App/Modules/Designer/Containers/AddGalleryImage.js +90 -0
- package/App/Modules/Designer/Containers/AddVisualElement.js +166 -0
- package/App/Modules/Designer/Containers/CloseDesignEditor.js +32 -0
- package/App/Modules/Designer/Containers/CloseGraphicsEditorButton.js +32 -0
- package/App/Modules/Designer/Containers/ColorPalettes.js +145 -0
- package/App/Modules/Designer/Containers/DesignAreaControlbox.js +54 -0
- package/App/Modules/Designer/Containers/Designer.js +37 -0
- package/App/Modules/Designer/Containers/DesignerSelectionToolbox.js +116 -0
- package/App/Modules/Designer/Containers/EditDesignButton.js +35 -0
- package/App/Modules/Designer/Containers/ImageEditDialog.js +1130 -0
- package/App/Modules/Designer/Designer.js +231 -0
- package/App/Modules/Designer/DesignerScreen.js +255 -0
- package/App/Modules/Designer/DesignerUI.js +241 -0
- package/App/Modules/Designer/Layouts/DefaultLayout.js +221 -0
- package/App/Modules/Designer/Layouts/Mobile/TwoSideBottomBar.js +50 -0
- package/App/Modules/Designer/Layouts/PopupAreaProvider.js +186 -0
- package/App/Modules/Designer/MultilayerComponents/DesignerClickAwayListener.js +53 -0
- package/App/Modules/Designer/MultilayerComponents/InlineToolboxPortal.js +106 -0
- package/App/Modules/Designer/MultilayerComponents/StandardToolboxPortal.js +64 -0
- package/App/Modules/Designer/Utils/FontFaceRepository.js +82 -0
- package/App/Modules/Designer/Utils/ImageEditUtils.js +104 -0
- package/App/Modules/Designer/Utils/Transformers.js +164 -0
- package/App/Modules/Designer/setupDesigner.js +182 -0
- package/App/Modules/Designer/withActiveCanvas.js +136 -0
- package/App/Modules/Visualization/AlignTargetContainer.js +55 -0
- package/App/Modules/Visualization/CreatorAlignTarget.js +41 -0
- package/App/Modules/Visualization/DefaultVisualizationProvider.js +105 -0
- package/App/Modules/Visualization/DesignerAlignTarget.js +45 -0
- package/App/Modules/Visualization/Utils/getFirstDataURLFromScreenshotsObj.js +20 -0
- package/App/Reducers/Actions.js +297 -0
- package/App/Reducers/ConfigurationMode/Actions.js +21 -0
- package/App/Reducers/ConfigurationMode/Reducer.js +80 -0
- package/App/Reducers/ConfigurationMode/Selectors.js +84 -0
- package/App/Reducers/Configurator/Actions.js +1417 -0
- package/App/Reducers/Configurator/AttributeSelectors.js +32 -0
- package/App/Reducers/Configurator/Modifiers.js +35 -0
- package/App/Reducers/Configurator/Reducer.js +639 -0
- package/App/Reducers/Configurator/Selectors.js +242 -0
- package/App/Reducers/Confirm/Actions.js +84 -0
- package/App/Reducers/Confirm/Reducer.js +30 -0
- package/App/Reducers/DesignArea/Actions.js +76 -0
- package/App/Reducers/DesignArea/DesignElementSelectors.js +114 -0
- package/App/Reducers/DesignArea/MaskSelectors.js +101 -0
- package/App/Reducers/DesignArea/Reducer.js +150 -0
- package/App/Reducers/DesignArea/Selectors.js +1304 -0
- package/App/Reducers/DesignArea/Transformers.js +333 -0
- package/App/Reducers/DesignData/Actions.js +232 -0
- package/App/Reducers/DesignData/Modifiers.js +328 -0
- package/App/Reducers/DesignData/Reducer.js +189 -0
- package/App/Reducers/DesignData/Selectors.js +94 -0
- package/App/Reducers/DesignData/Transformers.js +27 -0
- package/App/Reducers/DesignView/Actions.js +19 -0
- package/App/Reducers/DesignView/Reducer.js +165 -0
- package/App/Reducers/DesignView/Selectors.js +130 -0
- package/App/Reducers/DesignView/Transformers.js +32 -0
- package/App/Reducers/Device/Actions.js +16 -0
- package/App/Reducers/Device/Reducer.js +51 -0
- package/App/Reducers/Fonts/Actions.js +137 -0
- package/App/Reducers/Fonts/Reducer.js +39 -0
- package/App/Reducers/Fonts/Selectors.js +98 -0
- package/App/Reducers/GeneralActions.js +16 -0
- package/App/Reducers/ImageGallery/Actions.js +336 -0
- package/App/Reducers/ImageGallery/Modifiers.js +67 -0
- package/App/Reducers/ImageGallery/Reducer.js +320 -0
- package/App/Reducers/ImageGallery/Selectors.js +206 -0
- package/App/Reducers/Reducer.js +107 -0
- package/App/Reducers/UI/Actions.js +191 -0
- package/App/Reducers/UI/Reducer.js +98 -0
- package/App/Reducers/UI/Selectors.js +32 -0
- package/App/Reducers.js +48 -0
- package/App/Routing.js +168 -0
- package/App/Screens/Configurator/CalculationWidgetScreen.js +84 -0
- package/App/Screens/Configurator/Components/AmountSelection/Styles.scss +17 -0
- package/App/Screens/Configurator/Components/AmountSelection/index.js +170 -0
- package/App/Screens/Configurator/Components/AmountSelection/index.story.js +36 -0
- package/App/Screens/Configurator/Components/CalculationWidget/index.js +652 -0
- package/App/Screens/Configurator/Components/CalculationWidget/index.story.js +154 -0
- package/App/Screens/Configurator/Components/CalculationWidget/index.test.js +142 -0
- package/App/Screens/Configurator/Components/ConfigurationModeSwitch/ConfigurationModeSwitch.js +82 -0
- package/App/Screens/Configurator/Components/ConfigurationModeSwitch/index.js +15 -0
- package/App/Screens/Configurator/Components/Confirm/Styles.scss +0 -0
- package/App/Screens/Configurator/Components/Confirm/index.js +105 -0
- package/App/Screens/Configurator/Components/DesignApproval/index.js +76 -0
- package/App/Screens/Configurator/Components/DesignApproval/index.story.js +27 -0
- package/App/Screens/Configurator/Components/DesignApproval/index.test.js +31 -0
- package/App/Screens/Configurator/Components/Error/index.js +106 -0
- package/App/Screens/Configurator/Components/FallbackVisualization/FallbackVisualization.js +96 -0
- package/App/Screens/Configurator/Components/FileUpload/FileUploadBase.js +1 -0
- package/App/Screens/Configurator/Components/FullScreenView/index.js +304 -0
- package/App/Screens/Configurator/Components/FullScreenView/index.test.js +28 -0
- package/App/Screens/Configurator/Components/ImageLoader/ImageLoader.js +96 -0
- package/App/Screens/Configurator/Components/LandscapeInformation/index.js +75 -0
- package/App/Screens/Configurator/Components/NoVisualization/NoVisualization.js +35 -0
- package/App/Screens/Configurator/Components/PreviewPortal/index.js +249 -0
- package/App/Screens/Configurator/Components/Styles.scss +1 -0
- package/App/Screens/Configurator/Components/Thumbnail/index.js +394 -0
- package/App/Screens/Configurator/Components/Thumbnail/index.test.js +50 -0
- package/App/Screens/Configurator/Components/TotalPrice/TotalPrice.js +57 -0
- package/App/Screens/Configurator/Containers/AmountPrice.js +84 -0
- package/App/Screens/Configurator/Containers/CalculationWidget.js +278 -0
- package/App/Screens/Configurator/Containers/ConfigurationModeSwitch.js +81 -0
- package/App/Screens/Configurator/Containers/Confirm.js +37 -0
- package/App/Screens/Configurator/Containers/DesignApproval.js +129 -0
- package/App/Screens/Configurator/Containers/FallbackVisualization.js +32 -0
- package/App/Screens/Configurator/Containers/FullScreenView.js +47 -0
- package/App/Screens/Configurator/Containers/Thumbnail.js +41 -0
- package/App/Screens/Configurator/Containers/Visualization.js +13 -0
- package/App/Screens/Configurator/DynamicComponents.js +40 -0
- package/App/Screens/Configurator/Screen.js +238 -0
- package/App/Screens/Configurator/ScreenPropTypes.js +45 -0
- package/App/Screens/Configurator/ThemeProvider.js +298 -0
- package/App/Screens/DesignerProductPreview/Constants.js +12 -0
- package/App/Screens/DesignerProductPreview/DesignerProductPreviewManager.js +554 -0
- package/App/Screens/DesignerProductPreview/Screen.js +407 -0
- package/App/Screens.js +42 -0
- package/App/ServiceLocator.js +309 -0
- package/App/Services/AdminareaCommunicationService.js +149 -0
- package/App/Services/AnalyticsService.js +403 -0
- package/App/Services/ConfiguratorService.js +1166 -0
- package/App/Services/DesignDataService.js +3249 -0
- package/App/Services/DesignerService.js +496 -0
- package/App/Services/InteractionService.js +784 -0
- package/App/Services/UIService.js +129 -0
- package/App/Services/VisualizationService.js +844 -0
- package/App/Shared/Components/AcceptDesign/index.js +166 -0
- package/App/Shared/Components/AddToBasket/index.js +194 -0
- package/App/Shared/Components/AddToBasket/index.story.js +47 -0
- package/App/Shared/Components/AlertDialog/index.js +138 -0
- package/App/Shared/Components/AmountInput/Styles.scss +6 -0
- package/App/Shared/Components/AmountInput/index.js +296 -0
- package/App/Shared/Components/AmountInput/index.story.js +29 -0
- package/App/Shared/Components/AmountPrice/index.js +925 -0
- package/App/Shared/Components/AmountPrice/index.story.js +112 -0
- package/App/Shared/Components/AmountPrice/index.test.js +125 -0
- package/App/Shared/Components/Analytics/AnalyticsWrapper.js +49 -0
- package/App/Shared/Components/BulkNames/index.js +319 -0
- package/App/Shared/Components/CallToAction/index.js +220 -0
- package/App/Shared/Components/Header/Header.js +150 -0
- package/App/Shared/Components/Header/index.js +15 -0
- package/App/Shared/Components/Header/index.story.js +143 -0
- package/App/Shared/Components/InformationTag/InformationTag.js +155 -0
- package/App/Shared/Components/LicenseNotice/LicenseNotice.js +148 -0
- package/App/Shared/Components/LicenseNotice/index.js +15 -0
- package/App/Shared/Components/LoadConfiguration/index.js +218 -0
- package/App/Shared/Components/MessageBox/index.js +84 -0
- package/App/Shared/Components/MessageBox/index.story.js +49 -0
- package/App/Shared/Components/Notification/index.js +105 -0
- package/App/Shared/Components/Notification/index.story.js +55 -0
- package/App/Shared/Components/PdfDownload/index.js +150 -0
- package/App/Shared/Components/PlusMinusInput/index.js +118 -0
- package/App/Shared/Components/PriceList/index.js +237 -0
- package/App/Shared/Components/PriceList/index.story.js +114 -0
- package/App/Shared/Components/PriceOverview/index.js +177 -0
- package/App/Shared/Components/PriceOverview/index.story.js +215 -0
- package/App/Shared/Components/ProductVariant/Image.js +75 -0
- package/App/Shared/Components/ProductVariant/Styles.scss +11 -0
- package/App/Shared/Components/ProductVariant/index.js +477 -0
- package/App/Shared/Components/ProductVariant/index.story.js +283 -0
- package/App/Shared/Components/Progress/Progress.js +59 -0
- package/App/Shared/Components/ReceiveOfferForm/index.js +432 -0
- package/App/Shared/Components/ReceiveOfferForm/index.story.js +32 -0
- package/App/Shared/Components/ReceiveOfferForm/index.test.js +36 -0
- package/App/Shared/Components/SaveConfiguration/index.js +286 -0
- package/App/Shared/Components/SendEmail/index.js +103 -0
- package/App/Shared/Components/Stepper/index.js +136 -0
- package/App/Shared/Components/Stepper/index.story.js +38 -0
- package/App/Shared/Components/ToolbarList/index.js +231 -0
- package/App/Shared/Components/ToolbarList/index.story.js +33 -0
- package/App/Shared/Components/VariantChooser/index.js +270 -0
- package/App/Shared/Components/VariantChooser/index.story.js +100 -0
- package/App/Shared/Containers/AlertMessages.js +37 -0
- package/App/Shared/Containers/AmountPrice/AmountPriceAdminareaWrapper.js +40 -0
- package/App/Shared/Containers/AmountPrice/index.js +284 -0
- package/App/Shared/Containers/BulkNames.js +310 -0
- package/App/Shared/Containers/Error.js +37 -0
- package/App/Shared/Containers/GlobalLoader.js +25 -0
- package/App/Shared/Containers/Header/index.js +178 -0
- package/App/Shared/Containers/LicenseNotice/LicenseNotice.js +26 -0
- package/App/Shared/Containers/LicenseNotice/index.js +15 -0
- package/App/Shared/Containers/LoadConfiguration/LoadConfiguration.js +146 -0
- package/App/Shared/Containers/LoadConfiguration/index.js +15 -0
- package/App/Shared/Containers/PdfDownload/index.js +39 -0
- package/App/Shared/Containers/ProductVariant/ProductVariant.js +339 -0
- package/App/Shared/Containers/ProductVariant/index.js +15 -0
- package/App/Shared/Containers/SaveConfiguration.js +49 -0
- package/App/Shared/Containers/SendEmail/SendEmail.js +45 -0
- package/App/Shared/Containers/SendEmail/index.js +15 -0
- package/App/Shared/Providers/DefaultCanvasProvider.js +86 -0
- package/App/Storage.js +17 -0
- package/App/Store.js +87 -0
- package/App/Styles.scss +0 -0
- package/App/Translations.js +88 -0
- package/App/Utils/createMessageInterface.js +65 -0
- package/App/Utils/customClassName.js +12 -0
- package/App/Utils/getContrastText.js +27 -0
- package/App/Utils/getImageUrl.js +32 -0
- package/App/Variables.scss +84 -0
- package/App/configuration.js +421 -0
- package/App/index.js +52 -0
- package/App/initServices.js +67 -0
- package/App/setup.js +22 -0
- package/App/versionInfo.js +8 -0
- package/Framework/Api.js +178 -0
- package/Framework/ComponentContainer.js +165 -0
- package/Framework/Components/Carousel/Styles.scss +85 -0
- package/Framework/Components/Carousel/index.js +322 -0
- package/Framework/Components/Dialog/Style.scss +79 -0
- package/Framework/Components/Dialog/index.js +721 -0
- package/Framework/Components/DialogSelect/Styles.scss +53 -0
- package/Framework/Components/DialogSelect/index.js +331 -0
- package/Framework/Components/Input/index.js +147 -0
- package/Framework/Components/LoadingOverlay/Styles.scss +37 -0
- package/Framework/Components/LoadingOverlay/index.js +33 -0
- package/Framework/Components/Markdown/index.js +62 -0
- package/Framework/Components/Mobile/index.js +33 -0
- package/Framework/CustomError.js +51 -0
- package/Framework/Helpers/TransitionDetect.js +116 -0
- package/Framework/Helpers/isLandscapeMobile.js +14 -0
- package/Framework/Helpers/isMobileDevice.js +17 -0
- package/Framework/Helpers/isMobileSize.js +13 -0
- package/Framework/Mixins.scss +235 -0
- package/Framework/Services/AbstractAdminareaCommunicationService.js +48 -0
- package/Framework/Services/AbstractAsyncService.js +44 -0
- package/Framework/Services/AbstractConfiguratorService.js +47 -0
- package/Framework/Services/AbstractInteractionService.js +50 -0
- package/Framework/Services/AbstractStoreService.js +42 -0
- package/Framework/Services/AbstractUIService.js +53 -0
- package/Framework/Services/AbstractVisualizationService.js +47 -0
- package/Framework/Services/AsyncService.js +93 -0
- package/Framework/Services/StoreService.js +237 -0
- package/Framework/Variables.scss +22 -0
- package/Framework/bindDecorator.js +173 -0
- package/Framework/i18n.js +382 -0
- package/README.md +5 -26
- package/Resources/Icons/MaterialUI/Icons/AddCircle.js +13 -0
- package/Resources/Icons/MaterialUI/Icons/RemoveCircle.js +13 -0
- package/Resources/Icons/MaterialUI/fontFace.scss +37 -0
- package/Resources/Icons/MaterialUI/fonts/MaterialIcons-Regular.eot +0 -0
- package/Resources/Icons/MaterialUI/fonts/MaterialIcons-Regular.svg +2373 -0
- package/Resources/Icons/MaterialUI/fonts/MaterialIcons-Regular.ttf +0 -0
- package/Resources/Icons/MaterialUI/fonts/MaterialIcons-Regular.woff +0 -0
- package/Resources/Icons/MaterialUI/fonts/MaterialIcons-Regular.woff2 +0 -0
- package/Resources/Icons/fonts/ionicons.eot +0 -0
- package/Resources/Icons/fonts/ionicons.svg +2230 -0
- package/Resources/Icons/fonts/ionicons.ttf +0 -0
- package/Resources/Icons/fonts/ionicons.woff +0 -0
- package/Resources/Icons/ionicons.scss +1489 -0
- package/Resources/Icons/ioniconsExtend.scss +1469 -0
- package/Resources/Icons/v4/fontFace.scss +11 -0
- package/Resources/Icons/v4/fonts/ionicons.eot +0 -0
- package/Resources/Icons/v4/fonts/ionicons.svg +2090 -0
- package/Resources/Icons/v4/fonts/ionicons.ttf +0 -0
- package/Resources/Icons/v4/fonts/ionicons.woff +0 -0
- package/Resources/Icons/v4/fonts/ionicons.woff2 +0 -0
- package/Resources/Icons/v4/icons.scss +15 -0
- package/Resources/Icons/v4/iconsExtend.scss +7 -0
- package/Resources/Images/designer_placeholder_logo.svg +1 -0
- package/Resources/Masks/circle.svg +4 -0
- package/Shared/Components/CustomDialog.js +133 -0
- package/Shared/Components/CustomDialogSelect.js +161 -0
- package/Shared/Components/MainButton.js +81 -0
- package/Shared/ErrorTypes/DeferredError.js +51 -0
- package/Shared/HOCs/ResizeDetect/ResizeDetect.dev.js +60 -0
- package/Shared/HOCs/ResizeDetect/ResizeDetect.js +217 -0
- package/Shared/HOCs/getDisplayName.js +10 -0
- package/Shared/HOCs/withFixedChangeHandler.js +46 -0
- package/Shared/PropTypes/ReactComponent.js +13 -0
- package/Shared/Styles/absoluteCenter.js +17 -0
- package/Utils/Array/isIdentical.js +38 -0
- package/Utils/Async/AsyncManager.js +128 -0
- package/Utils/Async/Deferred.js +145 -0
- package/Utils/Async/ObjectLock.js +38 -0
- package/Utils/Decorators/Observable.js +130 -0
- package/Utils/Dev/HOCs/withFilePicker.js +101 -0
- package/Utils/Dev/isDev.js +21 -0
- package/Utils/Events/pointerEvent.js +199 -0
- package/Utils/Events/preventEventDoubling.js +23 -0
- package/Utils/Function/cached.js +64 -0
- package/Utils/Function/createDebounceManager.js +77 -0
- package/Utils/Function/createSelector.js +62 -0
- package/Utils/Function/memoize.js +46 -0
- package/Utils/Function/sendMessage.js +22 -0
- package/Utils/Helper/createSelectionRangeMemo.js +45 -0
- package/Utils/Immutable/set.js +81 -0
- package/Utils/Math/conversions.js +13 -0
- package/Utils/Math/isPositiveNumber.js +12 -0
- package/Utils/Redux/createActionWithGlobalState.js +23 -0
- package/Utils/Styles/combineMediaQueries.js +24 -0
- package/Utils/Styles/createCheckerBoardBackground.js +22 -0
- package/Utils/Test/CallOrderChecker.js +29 -0
- package/Utils/Test/createStoreProvider.js +33 -0
- package/Utils/Test/formDataToJSON.js +20 -0
- package/Utils/Test/mountWithState.js +40 -0
- package/index.js +8 -0
- package/package.json +22 -103
- package/scripts/cpPublic.js +3 -3
- package/scripts/getDefaultWebpackConfig.js +11 -10
- package/src/App/Error/ProductionErrorPage/Style.scss +1 -1
- package/src/App/Modules/Creator/Components/Option/index.test.js +1 -1
- package/src/App/Modules/Creator/Components/OptionAmount/index.test.js +1 -1
- package/src/App/Modules/Creator/Components/ProductPart/index.test.js +1 -1
- package/src/App/Modules/Designer/Components/AddGalleryImage/index.story.js +1 -1
- package/src/App/Modules/Designer/Components/ColorPalettes/index.test.jsx +1 -1
- package/src/App/Modules/Designer/Components/DesignAreaControlbox/index.js +21 -4
- package/src/App/Modules/Designer/Components/DesignAreaControlbox/index.test.jsx +1 -1
- package/src/App/Modules/Designer/Components/TextControlbox/index.test.jsx +1 -1
- package/src/App/Modules/Designer/Containers/Designer.js +1 -1
- package/src/App/Modules/Designer/DesignerScreen.js +32 -8
- package/src/App/{Screens/Configurator → Modules/Designer}/DesignerUI.js +42 -26
- package/src/App/Modules/Designer/Layouts/DefaultLayout.js +35 -1
- package/src/App/Modules/Designer/MultilayerComponents/DesignerClickAwayListener.js +18 -0
- package/src/App/Modules/Designer/MultilayerComponents/InlineToolboxPortal.js +54 -0
- package/src/App/Modules/Designer/MultilayerComponents/StandardToolboxPortal.js +38 -0
- package/src/App/Reducers/DesignView/Actions.js +1 -2
- package/src/App/Reducers/DesignView/Reducer.js +2 -10
- package/src/App/Reducers/DesignView/__mocks__/designerViewData.js +0 -1
- package/src/App/Reducers/DesignView/__tests__/Reducer.test.js +0 -22
- package/src/App/Reducers/ImageGallery/Actions.js +1 -1
- package/src/App/Screens/Configurator/Components/CalculationWidget/index.test.jsx +1 -1
- package/src/App/Screens/Configurator/Components/DesignApproval/index.test.jsx +1 -1
- package/src/App/Screens/Configurator/Components/FullScreenView/index.js +3 -2
- package/src/App/Screens/Configurator/Components/FullScreenView/index.test.jsx +1 -1
- package/src/App/Screens/Configurator/Components/PreviewPortal/index.js +7 -3
- package/src/App/Screens/Configurator/Containers/AmountPrice.js +1 -1
- package/src/App/Screens/Configurator/Containers/Confirm.js +1 -1
- package/src/App/Screens/Configurator/Containers/FullScreenView.js +1 -0
- package/src/App/Screens/Configurator/Containers/__tests__/Designer.test.js +1 -1
- package/src/App/Screens/Configurator/Screen.js +4 -2
- package/src/App/Screens/Configurator/__tests__/Screen.test.js +3 -0
- package/src/App/Services/ConfiguratorService.js +25 -4
- package/src/App/Services/InteractionService.js +2 -1
- package/src/App/Services/VisualizationService.js +3 -0
- package/src/App/Services/__tests__/DesignDataService.selectViewForComponent.test.js +0 -53
- package/src/App/Shared/Containers/AlertMessages.js +1 -1
- package/src/App/Shared/Containers/AmountPrice/index.test.js +1 -1
- package/src/App/Shared/Containers/Error.js +1 -1
- package/src/App/Shared/Containers/SaveConfiguration.js +1 -1
- package/src/App/Translations.js +1 -1
- package/src/App/Utils/createMessageInterface.js +10 -0
- package/src/App/configuration.js +3 -0
- package/src/Framework/i18n.js +2 -3
- package/babel.config.js +0 -46
- package/public/ConfigurationMessagingDemo.html +0 -55
- package/scripts/cpPath.js +0 -135
- package/scripts/moveLibToPackageRoot.js +0 -40
- package/scripts/rmDir.js +0 -29
- package/scripts/updateLocalPackages.js +0 -68
- package/scripts/utils/process.js +0 -19
- package/tsconfig.json +0 -22
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.ImageColorPicker = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _pointerEvent = require("../../../../../Utils/Events/pointerEvent");
|
|
15
|
+
|
|
16
|
+
var _ResizeDetect = require("../../../../../Shared/HOCs/ResizeDetect/ResizeDetect");
|
|
17
|
+
|
|
18
|
+
var _Selectors = require("../../../../Reducers/DesignArea/Selectors");
|
|
19
|
+
|
|
20
|
+
var _Progress = _interopRequireDefault(require("../../../../Shared/Components/Progress/Progress"));
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
+
|
|
24
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
|
+
|
|
26
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
27
|
+
|
|
28
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
29
|
+
|
|
30
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
31
|
+
|
|
32
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
33
|
+
|
|
34
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
35
|
+
|
|
36
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
37
|
+
|
|
38
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
39
|
+
|
|
40
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
41
|
+
|
|
42
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
43
|
+
|
|
44
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
45
|
+
|
|
46
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
47
|
+
|
|
48
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
49
|
+
|
|
50
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
51
|
+
|
|
52
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
53
|
+
|
|
54
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
55
|
+
|
|
56
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
57
|
+
|
|
58
|
+
function getColorAt(ctx, x, y) {
|
|
59
|
+
var p = ctx.getImageData(x, y, 1, 1).data;
|
|
60
|
+
return {
|
|
61
|
+
rgba: {
|
|
62
|
+
r: p[0],
|
|
63
|
+
g: p[1],
|
|
64
|
+
b: p[2],
|
|
65
|
+
a: p[3]
|
|
66
|
+
},
|
|
67
|
+
hex: (0, _Selectors.rgbToHex)(p[0], p[1], p[2])
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Saves the imageData of the source context, and returns a function which can clear the
|
|
72
|
+
* given area and restore the original data.
|
|
73
|
+
* @param sourceCtx
|
|
74
|
+
* @returns {function(*, *=, *=, *=, *=)}
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
var createAreaClearer = function createAreaClearer(sourceCtx) {
|
|
79
|
+
var imageData;
|
|
80
|
+
|
|
81
|
+
if (sourceCtx) {
|
|
82
|
+
var _sourceCtx$canvas = sourceCtx.canvas,
|
|
83
|
+
width = _sourceCtx$canvas.width,
|
|
84
|
+
height = _sourceCtx$canvas.height;
|
|
85
|
+
imageData = sourceCtx.getImageData(0, 0, width, height);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return function (ctx, x, y, w, h) {
|
|
89
|
+
ctx.clearRect(x, y, w, h);
|
|
90
|
+
imageData && ctx.putImageData(imageData, 0, 0, x, y, w + 1, h + 1);
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* By default the indicator is shown on the left side, but if the user moves the pointer close to it,
|
|
95
|
+
* it jumps to the right side.
|
|
96
|
+
* @param ctx
|
|
97
|
+
* @param x
|
|
98
|
+
* @param y
|
|
99
|
+
* @returns {{size: number, offsetX: number, offsetY: number}}
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
var getIndicatorPosition = function getIndicatorPosition(ctx, x, y) {
|
|
104
|
+
var offsetX = 10;
|
|
105
|
+
var offsetY = 10;
|
|
106
|
+
var size = 50;
|
|
107
|
+
var tolerance = 50;
|
|
108
|
+
|
|
109
|
+
if (x < offsetX + size + tolerance && y < offsetY + size + tolerance) {
|
|
110
|
+
offsetX = ctx.canvas.width - offsetX - size;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
size: size,
|
|
115
|
+
offsetX: offsetX,
|
|
116
|
+
offsetY: offsetY
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Draws the indicator on the given context depending on the mouse position (x, y).
|
|
121
|
+
* It returns the dirty area as an array to clear: [x, y, size].
|
|
122
|
+
* @param ctx
|
|
123
|
+
* @param x
|
|
124
|
+
* @param y
|
|
125
|
+
* @returns {[number,number,number]}
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
var drawIndicator = function drawIndicator(ctx, x, y) {
|
|
130
|
+
var _getIndicatorPosition = getIndicatorPosition(ctx, x, y),
|
|
131
|
+
offsetX = _getIndicatorPosition.offsetX,
|
|
132
|
+
offsetY = _getIndicatorPosition.offsetY,
|
|
133
|
+
size = _getIndicatorPosition.size;
|
|
134
|
+
|
|
135
|
+
var lineWidth = 2;
|
|
136
|
+
var shadowBlur = 1;
|
|
137
|
+
ctx.fillStyle = "rgba(".concat(Object.values(getColorAt(ctx, x, y).rgba), ")");
|
|
138
|
+
ctx.fillRect(offsetX, offsetY, size, size);
|
|
139
|
+
ctx.lineWidth = lineWidth;
|
|
140
|
+
ctx.strokeStyle = 'white';
|
|
141
|
+
ctx.shadowColor = 'black';
|
|
142
|
+
ctx.shadowBlur = shadowBlur;
|
|
143
|
+
ctx.strokeRect(offsetX, offsetY, size, size);
|
|
144
|
+
var padding = lineWidth + shadowBlur;
|
|
145
|
+
return [offsetX - padding, offsetY - padding, size + 2 * padding];
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Draws the marker circle on the given context (from the center x and y).
|
|
149
|
+
* It returns the dirty area as an array to clear: [x, y, size].
|
|
150
|
+
* @param ctx
|
|
151
|
+
* @param x
|
|
152
|
+
* @param y
|
|
153
|
+
* @returns {[number,number,number]}
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
var drawMarker = function drawMarker(ctx, x, y) {
|
|
158
|
+
var lineWidth = 2;
|
|
159
|
+
var shadowBlur = 1;
|
|
160
|
+
var size = 5;
|
|
161
|
+
var posOffset = shadowBlur / 2;
|
|
162
|
+
ctx.strokeStyle = 'white';
|
|
163
|
+
ctx.lineWidth = lineWidth;
|
|
164
|
+
ctx.shadowBlur = shadowBlur;
|
|
165
|
+
ctx.shadowColor = 'black';
|
|
166
|
+
ctx.beginPath();
|
|
167
|
+
ctx.arc(x + posOffset, y + posOffset, size, 0, 2 * Math.PI);
|
|
168
|
+
ctx.stroke();
|
|
169
|
+
var padding = Math.ceil(lineWidth + shadowBlur + size);
|
|
170
|
+
return [x - padding, y - padding, (padding + shadowBlur) * 2];
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
var ImageColorPicker = /*#__PURE__*/function (_React$Component) {
|
|
174
|
+
_inherits(ImageColorPicker, _React$Component);
|
|
175
|
+
|
|
176
|
+
var _super = _createSuper(ImageColorPicker);
|
|
177
|
+
|
|
178
|
+
function ImageColorPicker() {
|
|
179
|
+
var _this;
|
|
180
|
+
|
|
181
|
+
_classCallCheck(this, ImageColorPicker);
|
|
182
|
+
|
|
183
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
184
|
+
args[_key] = arguments[_key];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
188
|
+
|
|
189
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
190
|
+
loadingImage: false
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
_defineProperty(_assertThisInitialized(_this), "canvasRef", /*#__PURE__*/_react["default"].createRef());
|
|
194
|
+
|
|
195
|
+
_defineProperty(_assertThisInitialized(_this), "reportError", function (e) {
|
|
196
|
+
// eslint-disable-next-line no-console
|
|
197
|
+
console.error(e);
|
|
198
|
+
var onError = _this.props.onError;
|
|
199
|
+
onError && onError(e);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
_defineProperty(_assertThisInitialized(_this), "redrawMarker", function (evt) {
|
|
203
|
+
return setTimeout(function () {
|
|
204
|
+
var _this$getRelativePosi = _this.getRelativePosition(evt),
|
|
205
|
+
x = _this$getRelativePosi.x,
|
|
206
|
+
y = _this$getRelativePosi.y;
|
|
207
|
+
|
|
208
|
+
if (_this.indicatorPosition) {
|
|
209
|
+
var _this$indicatorPositi = _slicedToArray(_this.indicatorPosition, 3),
|
|
210
|
+
_x = _this$indicatorPositi[0],
|
|
211
|
+
_y = _this$indicatorPositi[1],
|
|
212
|
+
size = _this$indicatorPositi[2];
|
|
213
|
+
|
|
214
|
+
_this.clearArea(_this.ctx, _x, _y, size, size);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (_this.markerPosition) {
|
|
218
|
+
var _this$markerPosition = _slicedToArray(_this.markerPosition, 3),
|
|
219
|
+
_x2 = _this$markerPosition[0],
|
|
220
|
+
_y2 = _this$markerPosition[1],
|
|
221
|
+
_size = _this$markerPosition[2];
|
|
222
|
+
|
|
223
|
+
_this.clearArea(_this.ctx, _x2, _y2, _size, _size);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
_this.markerPosition = drawMarker(_this.ctx, x, y);
|
|
227
|
+
_this.indicatorPosition = drawIndicator(_this.ctx, x, y);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
return _this;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
_createClass(ImageColorPicker, [{
|
|
235
|
+
key: "componentDidMount",
|
|
236
|
+
value: function componentDidMount() {
|
|
237
|
+
var _this2 = this;
|
|
238
|
+
|
|
239
|
+
var src = this.props.src;
|
|
240
|
+
|
|
241
|
+
if (src) {
|
|
242
|
+
this.loadImage(src);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
var canvas = this.canvasRef.current;
|
|
246
|
+
this.ctx = canvas.getContext('2d');
|
|
247
|
+
this.removeStartListener = (0, _pointerEvent.createPointerEventListener)(canvas, 'start', function (evt) {
|
|
248
|
+
if (!_this2.props.enabled || !_this2.img) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
evt.preventDefault();
|
|
253
|
+
|
|
254
|
+
_this2.redrawMarker(evt);
|
|
255
|
+
|
|
256
|
+
var removeMoveListener = (0, _pointerEvent.createPointerEventListener)(canvas, 'move', _this2.redrawMarker);
|
|
257
|
+
var removeEndListener = (0, _pointerEvent.createPointerEventListener)(canvas, 'end', function (evt) {
|
|
258
|
+
removeMoveListener();
|
|
259
|
+
removeEndListener();
|
|
260
|
+
var onChange = _this2.props.onChange;
|
|
261
|
+
|
|
262
|
+
var _this2$getRelativePos = _this2.getRelativePosition(evt),
|
|
263
|
+
x = _this2$getRelativePos.x,
|
|
264
|
+
y = _this2$getRelativePos.y;
|
|
265
|
+
|
|
266
|
+
onChange && onChange(getColorAt(_this2.ctx, x, y));
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}, {
|
|
271
|
+
key: "componentWillUnmount",
|
|
272
|
+
value: function componentWillUnmount() {
|
|
273
|
+
this.removeStartListener();
|
|
274
|
+
}
|
|
275
|
+
}, {
|
|
276
|
+
key: "componentDidUpdate",
|
|
277
|
+
value: function componentDidUpdate(prevProps) {
|
|
278
|
+
var _this$props = this.props,
|
|
279
|
+
src = _this$props.src,
|
|
280
|
+
size = _this$props.size;
|
|
281
|
+
|
|
282
|
+
if (prevProps.src !== src) {
|
|
283
|
+
src && this.loadImage(src);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (prevProps.size !== size) {
|
|
287
|
+
this.updateCanvas();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}, {
|
|
291
|
+
key: "loadImage",
|
|
292
|
+
value: function loadImage(src) {
|
|
293
|
+
var _this3 = this;
|
|
294
|
+
|
|
295
|
+
this.currentSrc = src;
|
|
296
|
+
this.setState({
|
|
297
|
+
loadingImage: true
|
|
298
|
+
});
|
|
299
|
+
var img = document.createElement('img');
|
|
300
|
+
img.crossOrigin = 'anonymous';
|
|
301
|
+
|
|
302
|
+
img.onload = function () {
|
|
303
|
+
// skip if the src is outdated
|
|
304
|
+
if (_this3.currentSrc !== src) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
_this3.img = img;
|
|
309
|
+
|
|
310
|
+
_this3.setState({
|
|
311
|
+
loadingImage: false
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
_this3.updateCanvas();
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
img.onerror = function (e) {
|
|
318
|
+
_this3.setState({
|
|
319
|
+
loadingImage: false
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
_this3.reportError(e);
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
img.src = src;
|
|
326
|
+
}
|
|
327
|
+
}, {
|
|
328
|
+
key: "updateCanvas",
|
|
329
|
+
value: function updateCanvas() {
|
|
330
|
+
var img = this.img;
|
|
331
|
+
var canvas = this.canvasRef.current;
|
|
332
|
+
|
|
333
|
+
if (!canvas || !img) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
var container = canvas.parentElement;
|
|
338
|
+
|
|
339
|
+
var _container$getBoundin = container.getBoundingClientRect(),
|
|
340
|
+
pw = _container$getBoundin.width,
|
|
341
|
+
ph = _container$getBoundin.height;
|
|
342
|
+
|
|
343
|
+
var ow = img.width,
|
|
344
|
+
oh = img.height;
|
|
345
|
+
var pa = pw / ph;
|
|
346
|
+
var oa = ow / oh;
|
|
347
|
+
|
|
348
|
+
if (pa >= oa) {
|
|
349
|
+
var height = Math.min(ph, oh);
|
|
350
|
+
var width = height * ow / oh;
|
|
351
|
+
this.updateCanvasDimensionsAndContent(canvas, img, width, height);
|
|
352
|
+
} else {
|
|
353
|
+
var _width = Math.min(pw, ow);
|
|
354
|
+
|
|
355
|
+
var _height = _width * oh / ow;
|
|
356
|
+
|
|
357
|
+
this.updateCanvasDimensionsAndContent(canvas, img, _width, _height);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
try {
|
|
361
|
+
this.clearArea = createAreaClearer(this.ctx);
|
|
362
|
+
} catch (e) {
|
|
363
|
+
this.reportError(e);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}, {
|
|
367
|
+
key: "updateCanvasDimensionsAndContent",
|
|
368
|
+
value: function updateCanvasDimensionsAndContent(canvas, img, width, height) {
|
|
369
|
+
Object.assign(canvas, {
|
|
370
|
+
width: width,
|
|
371
|
+
height: height
|
|
372
|
+
});
|
|
373
|
+
this.ctx.clearRect(0, 0, width, height);
|
|
374
|
+
this.ctx.drawImage(img, 0, 0, width, height);
|
|
375
|
+
}
|
|
376
|
+
}, {
|
|
377
|
+
key: "getRelativePosition",
|
|
378
|
+
value: function getRelativePosition(evt) {
|
|
379
|
+
var canvas = this.canvasRef.current;
|
|
380
|
+
|
|
381
|
+
var _canvas$getBoundingCl = canvas.getBoundingClientRect(),
|
|
382
|
+
offsetX = _canvas$getBoundingCl.left,
|
|
383
|
+
offsetY = _canvas$getBoundingCl.top;
|
|
384
|
+
|
|
385
|
+
var _getPointFromPointerE = (0, _pointerEvent.getPointFromPointerEvent)(evt),
|
|
386
|
+
eX = _getPointFromPointerE.x,
|
|
387
|
+
eY = _getPointFromPointerE.y;
|
|
388
|
+
|
|
389
|
+
var x = eX - offsetX;
|
|
390
|
+
var y = eY - offsetY;
|
|
391
|
+
return {
|
|
392
|
+
x: x,
|
|
393
|
+
y: y
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
}, {
|
|
397
|
+
key: "render",
|
|
398
|
+
value: function render() {
|
|
399
|
+
var className = this.props.className;
|
|
400
|
+
var loadingImage = this.state.loadingImage;
|
|
401
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Progress["default"], {
|
|
402
|
+
loading: loadingImage
|
|
403
|
+
}), /*#__PURE__*/_react["default"].createElement("canvas", {
|
|
404
|
+
ref: this.canvasRef,
|
|
405
|
+
className: className
|
|
406
|
+
}));
|
|
407
|
+
}
|
|
408
|
+
}]);
|
|
409
|
+
|
|
410
|
+
return ImageColorPicker;
|
|
411
|
+
}(_react["default"].Component);
|
|
412
|
+
|
|
413
|
+
exports.ImageColorPicker = ImageColorPicker;
|
|
414
|
+
|
|
415
|
+
_defineProperty(ImageColorPicker, "propTypes", {
|
|
416
|
+
className: _propTypes["default"].string,
|
|
417
|
+
enabled: _propTypes["default"].bool,
|
|
418
|
+
onChange: _propTypes["default"].func,
|
|
419
|
+
onError: _propTypes["default"].func,
|
|
420
|
+
src: _propTypes["default"].string,
|
|
421
|
+
size: _propTypes["default"].object
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
_defineProperty(ImageColorPicker, "defaultProps", {
|
|
425
|
+
enabled: true
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
var _default = (0, _ResizeDetect.withResizeDetectWrapper)(ImageColorPicker);
|
|
429
|
+
|
|
430
|
+
exports["default"] = _default;
|