@skbkontur/react-ui 4.1.2 → 4.2.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/CHANGELOG.md +44 -0
- package/cjs/components/Autocomplete/Autocomplete.d.ts +3 -0
- package/cjs/components/Autocomplete/Autocomplete.js +12 -3
- package/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
- package/cjs/components/Button/Button.d.ts +3 -0
- package/cjs/components/Button/Button.js +8 -4
- package/cjs/components/Button/Button.js.map +1 -1
- package/cjs/components/Button/Button.styles.d.ts +1 -1
- package/cjs/components/Button/Button.styles.js +6 -6
- package/cjs/components/Button/Button.styles.js.map +1 -1
- package/cjs/components/Center/Center.d.ts +3 -0
- package/cjs/components/Center/Center.js +8 -3
- package/cjs/components/Center/Center.js.map +1 -1
- package/cjs/components/Checkbox/Checkbox.d.ts +3 -0
- package/cjs/components/Checkbox/Checkbox.js +8 -2
- package/cjs/components/Checkbox/Checkbox.js.map +1 -1
- package/cjs/components/Checkbox/Checkbox.md +48 -0
- package/cjs/components/CurrencyInput/CurrencyInput.d.ts +4 -1
- package/cjs/components/CurrencyInput/CurrencyInput.js +23 -5
- package/cjs/components/CurrencyInput/CurrencyInput.js.map +1 -1
- package/cjs/components/CurrencyLabel/CurrencyLabel.d.ts +3 -0
- package/cjs/components/CurrencyLabel/CurrencyLabel.js +6 -2
- package/cjs/components/CurrencyLabel/CurrencyLabel.js.map +1 -1
- package/cjs/components/DatePicker/DatePicker.d.ts +5 -0
- package/cjs/components/DatePicker/DatePicker.js +14 -3
- package/cjs/components/DatePicker/DatePicker.js.map +1 -1
- package/cjs/components/DatePicker/Picker.js +7 -2
- package/cjs/components/DatePicker/Picker.js.map +1 -1
- package/cjs/components/Dropdown/Dropdown.d.ts +3 -0
- package/cjs/components/Dropdown/Dropdown.js +7 -2
- package/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/cjs/components/FileUploader/FileUploader.d.ts +5 -0
- package/cjs/components/FileUploader/FileUploader.js +10 -4
- package/cjs/components/FileUploader/FileUploader.js.map +1 -1
- package/cjs/components/FxInput/FxInput.d.ts +3 -0
- package/cjs/components/FxInput/FxInput.js +7 -3
- package/cjs/components/FxInput/FxInput.js.map +1 -1
- package/cjs/components/Gapped/Gapped.d.ts +4 -0
- package/cjs/components/Gapped/Gapped.js +9 -4
- package/cjs/components/Gapped/Gapped.js.map +1 -1
- package/cjs/components/GlobalLoader/GlobalLoader.d.ts +3 -0
- package/cjs/components/GlobalLoader/GlobalLoader.js +6 -2
- package/cjs/components/GlobalLoader/GlobalLoader.js.map +1 -1
- package/cjs/components/Group/Group.d.ts +3 -0
- package/cjs/components/Group/Group.js +7 -3
- package/cjs/components/Group/Group.js.map +1 -1
- package/cjs/components/Input/Input.d.ts +3 -0
- package/cjs/components/Input/Input.js +7 -3
- package/cjs/components/Input/Input.js.map +1 -1
- package/cjs/components/Link/Link.d.ts +4 -1
- package/cjs/components/Link/Link.js +8 -4
- package/cjs/components/Link/Link.js.map +1 -1
- package/cjs/components/Loader/Loader.d.ts +4 -0
- package/cjs/components/Loader/Loader.js +8 -3
- package/cjs/components/Loader/Loader.js.map +1 -1
- package/cjs/components/MenuHeader/MenuHeader.d.ts +3 -0
- package/cjs/components/MenuHeader/MenuHeader.js +7 -2
- package/cjs/components/MenuHeader/MenuHeader.js.map +1 -1
- package/cjs/components/MenuItem/MenuItem.d.ts +5 -1
- package/cjs/components/MenuItem/MenuItem.js +11 -5
- package/cjs/components/MenuItem/MenuItem.js.map +1 -1
- package/cjs/components/MenuSeparator/MenuSeparator.d.ts +3 -0
- package/cjs/components/MenuSeparator/MenuSeparator.js +7 -3
- package/cjs/components/MenuSeparator/MenuSeparator.js.map +1 -1
- package/cjs/components/Modal/Modal.d.ts +5 -0
- package/cjs/components/Modal/Modal.js +9 -3
- package/cjs/components/Modal/Modal.js.map +1 -1
- package/cjs/components/Modal/ModalClose.js +3 -2
- package/cjs/components/Modal/ModalClose.js.map +1 -1
- package/cjs/components/Modal/ModalFooter.d.ts +3 -0
- package/cjs/components/Modal/ModalFooter.js +8 -3
- package/cjs/components/Modal/ModalFooter.js.map +1 -1
- package/cjs/components/Modal/ModalHeader.d.ts +3 -0
- package/cjs/components/Modal/ModalHeader.js +9 -3
- package/cjs/components/Modal/ModalHeader.js.map +1 -1
- package/cjs/components/Paging/Paging.d.ts +8 -1
- package/cjs/components/Paging/Paging.js +15 -7
- package/cjs/components/Paging/Paging.js.map +1 -1
- package/cjs/components/PasswordInput/PasswordInput.d.ts +5 -0
- package/cjs/components/PasswordInput/PasswordInput.js +13 -5
- package/cjs/components/PasswordInput/PasswordInput.js.map +1 -1
- package/cjs/components/Radio/Radio.d.ts +3 -0
- package/cjs/components/Radio/Radio.js +7 -3
- package/cjs/components/Radio/Radio.js.map +1 -1
- package/cjs/components/RadioGroup/RadioGroup.d.ts +9 -0
- package/cjs/components/RadioGroup/RadioGroup.js +21 -4
- package/cjs/components/RadioGroup/RadioGroup.js.map +1 -1
- package/cjs/components/ResponsiveLayout/useResponsiveLayout.js +1 -1
- package/cjs/components/ResponsiveLayout/useResponsiveLayout.js.map +1 -1
- package/cjs/components/ScrollContainer/ScrollContainer.d.ts +4 -0
- package/cjs/components/ScrollContainer/ScrollContainer.js +14 -4
- package/cjs/components/ScrollContainer/ScrollContainer.js.map +1 -1
- package/cjs/components/Select/Select.d.ts +3 -0
- package/cjs/components/Select/Select.js +11 -3
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/SidePage/SidePage.d.ts +4 -0
- package/cjs/components/SidePage/SidePage.js +7 -2
- package/cjs/components/SidePage/SidePage.js.map +1 -1
- package/cjs/components/SidePage/SidePageBody.d.ts +3 -0
- package/cjs/components/SidePage/SidePageBody.js +10 -3
- package/cjs/components/SidePage/SidePageBody.js.map +1 -1
- package/cjs/components/SidePage/SidePageContainer.d.ts +3 -0
- package/cjs/components/SidePage/SidePageContainer.js +7 -2
- package/cjs/components/SidePage/SidePageContainer.js.map +1 -1
- package/cjs/components/SidePage/SidePageFooter.d.ts +3 -0
- package/cjs/components/SidePage/SidePageFooter.js +11 -3
- package/cjs/components/SidePage/SidePageFooter.js.map +1 -1
- package/cjs/components/SidePage/SidePageHeader.d.ts +4 -0
- package/cjs/components/SidePage/SidePageHeader.js +9 -4
- package/cjs/components/SidePage/SidePageHeader.js.map +1 -1
- package/cjs/components/Spinner/Spinner.d.ts +3 -0
- package/cjs/components/Spinner/Spinner.js +7 -3
- package/cjs/components/Spinner/Spinner.js.map +1 -1
- package/cjs/components/Sticky/Sticky.d.ts +3 -0
- package/cjs/components/Sticky/Sticky.js +7 -3
- package/cjs/components/Sticky/Sticky.js.map +1 -1
- package/cjs/components/Switcher/Switcher.d.ts +3 -0
- package/cjs/components/Switcher/Switcher.js +7 -3
- package/cjs/components/Switcher/Switcher.js.map +1 -1
- package/cjs/components/Tabs/Indicator.js +4 -2
- package/cjs/components/Tabs/Indicator.js.map +1 -1
- package/cjs/components/Tabs/Tab.d.ts +3 -0
- package/cjs/components/Tabs/Tab.js +7 -2
- package/cjs/components/Tabs/Tab.js.map +1 -1
- package/cjs/components/Tabs/Tabs.d.ts +4 -0
- package/cjs/components/Tabs/Tabs.js +12 -3
- package/cjs/components/Tabs/Tabs.js.map +1 -1
- package/cjs/components/Textarea/Textarea.d.ts +4 -0
- package/cjs/components/Textarea/Textarea.js +8 -3
- package/cjs/components/Textarea/Textarea.js.map +1 -1
- package/cjs/components/Textarea/TextareaCounter.js +10 -9
- package/cjs/components/Textarea/TextareaCounter.js.map +1 -1
- package/cjs/components/Toast/Toast.d.ts +6 -0
- package/cjs/components/Toast/Toast.js +9 -2
- package/cjs/components/Toast/Toast.js.map +1 -1
- package/cjs/components/Toast/ToastStatic.js +1 -1
- package/cjs/components/Toast/ToastStatic.js.map +1 -1
- package/cjs/components/Toast/ToastView.js +5 -4
- package/cjs/components/Toast/ToastView.js.map +1 -1
- package/cjs/components/Toggle/Toggle.d.ts +3 -0
- package/cjs/components/Toggle/Toggle.js +7 -3
- package/cjs/components/Toggle/Toggle.js.map +1 -1
- package/cjs/components/Token/Token.d.ts +3 -0
- package/cjs/components/Token/Token.js +8 -3
- package/cjs/components/Token/Token.js.map +1 -1
- package/cjs/components/TokenInput/TokenInput.d.ts +4 -0
- package/cjs/components/TokenInput/TokenInput.js +7 -2
- package/cjs/components/TokenInput/TokenInput.js.map +1 -1
- package/cjs/components/TokenInput/TokenInputMenu.js +4 -3
- package/cjs/components/TokenInput/TokenInputMenu.js.map +1 -1
- package/cjs/components/Tooltip/Tooltip.d.ts +4 -0
- package/cjs/components/Tooltip/Tooltip.js +9 -3
- package/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/cjs/components/TooltipMenu/TooltipMenu.d.ts +3 -0
- package/cjs/components/TooltipMenu/TooltipMenu.js +7 -2
- package/cjs/components/TooltipMenu/TooltipMenu.js.map +1 -1
- package/cjs/internal/Calendar/Calendar.d.ts +6 -0
- package/cjs/internal/Calendar/Calendar.js +9 -2
- package/cjs/internal/Calendar/Calendar.js.map +1 -1
- package/cjs/internal/Calendar/MonthView.js +5 -4
- package/cjs/internal/Calendar/MonthView.js.map +1 -1
- package/cjs/internal/CommonWrapper/CommonWrapper.d.ts +1 -0
- package/cjs/internal/CommonWrapper/CommonWrapper.js +4 -2
- package/cjs/internal/CommonWrapper/CommonWrapper.js.map +1 -1
- package/cjs/internal/CustomComboBox/ComboBoxMenu.d.ts +7 -0
- package/cjs/internal/CustomComboBox/ComboBoxMenu.js +23 -5
- package/cjs/internal/CustomComboBox/ComboBoxMenu.js.map +1 -1
- package/cjs/internal/CustomComboBox/ComboBoxView.js +4 -2
- package/cjs/internal/CustomComboBox/ComboBoxView.js.map +1 -1
- package/cjs/internal/CustomComboBox/CustomComboBox.d.ts +3 -0
- package/cjs/internal/CustomComboBox/CustomComboBox.js +6 -2
- package/cjs/internal/CustomComboBox/CustomComboBox.js.map +1 -1
- package/cjs/internal/DataTids/DATATIDS.md +12 -0
- package/cjs/internal/DataTids/DataTids.d.ts +12 -0
- package/cjs/internal/DataTids/DataTids.js +46 -0
- package/cjs/internal/DataTids/DataTids.js.map +1 -0
- package/cjs/internal/DataTids/DataTids.styles.d.ts +7 -0
- package/cjs/internal/DataTids/DataTids.styles.js +41 -0
- package/cjs/internal/DataTids/DataTids.styles.js.map +1 -0
- package/cjs/internal/DataTids/componentsDataTids.d.ts +5 -0
- package/cjs/internal/DataTids/componentsDataTids.js +16 -0
- package/cjs/internal/DataTids/componentsDataTids.js.map +1 -0
- package/cjs/internal/DateSelect/DateSelect.d.ts +4 -0
- package/cjs/internal/DateSelect/DateSelect.js +8 -3
- package/cjs/internal/DateSelect/DateSelect.js.map +1 -1
- package/cjs/internal/FileUploaderControl/FileUploaderFile/FileUploaderFile.d.ts +7 -0
- package/cjs/internal/FileUploaderControl/FileUploaderFile/FileUploaderFile.js +14 -6
- package/cjs/internal/FileUploaderControl/FileUploaderFile/FileUploaderFile.js.map +1 -1
- package/cjs/internal/FileUploaderControl/FileUploaderFileList/FileUploaderFileList.d.ts +3 -0
- package/cjs/internal/FileUploaderControl/FileUploaderFileList/FileUploaderFileList.js +6 -2
- package/cjs/internal/FileUploaderControl/FileUploaderFileList/FileUploaderFileList.js.map +1 -1
- package/cjs/internal/InputLikeText/InputLikeText.d.ts +4 -0
- package/cjs/internal/InputLikeText/InputLikeText.js +10 -4
- package/cjs/internal/InputLikeText/InputLikeText.js.map +1 -1
- package/cjs/internal/InternalMenu/InternalMenu.d.ts +3 -0
- package/cjs/internal/InternalMenu/InternalMenu.js +8 -3
- package/cjs/internal/InternalMenu/InternalMenu.js.map +1 -1
- package/cjs/internal/InternalMenu/InternalMenu.styles.js +2 -1
- package/cjs/internal/InternalMenu/InternalMenu.styles.js.map +1 -1
- package/cjs/internal/MaskedInput/MaskedInput.d.ts +3 -0
- package/cjs/internal/MaskedInput/MaskedInput.js +7 -3
- package/cjs/internal/MaskedInput/MaskedInput.js.map +1 -1
- package/cjs/internal/Menu/Menu.d.ts +3 -0
- package/cjs/internal/Menu/Menu.js +8 -3
- package/cjs/internal/Menu/Menu.js.map +1 -1
- package/cjs/internal/MobilePopup/MobilePopup.d.ts +4 -0
- package/cjs/internal/MobilePopup/MobilePopup.js +10 -3
- package/cjs/internal/MobilePopup/MobilePopup.js.map +1 -1
- package/cjs/internal/Popup/Popup.d.ts +5 -0
- package/cjs/internal/Popup/Popup.js +10 -4
- package/cjs/internal/Popup/Popup.js.map +1 -1
- package/cjs/internal/Popup/PopupPin.js +2 -1
- package/cjs/internal/Popup/PopupPin.js.map +1 -1
- package/cjs/internal/PopupMenu/PopupMenu.d.ts +4 -0
- package/cjs/internal/PopupMenu/PopupMenu.js +9 -4
- package/cjs/internal/PopupMenu/PopupMenu.js.map +1 -1
- package/cjs/internal/RenderLayer/RenderLayer.d.ts +1 -0
- package/cjs/internal/RenderLayer/RenderLayer.js +8 -3
- package/cjs/internal/RenderLayer/RenderLayer.js.map +1 -1
- package/cjs/internal/icons/16px/index.js +1 -1
- package/cjs/internal/icons/16px/index.js.map +1 -1
- package/cjs/lib/listenFocusOutside.js +1 -1
- package/cjs/lib/listenFocusOutside.js.map +1 -1
- package/components/Autocomplete/Autocomplete/Autocomplete.js +10 -6
- package/components/Autocomplete/Autocomplete/Autocomplete.js.map +1 -1
- package/components/Autocomplete/Autocomplete.d.ts +3 -0
- package/components/Button/Button/Button.js +5 -1
- package/components/Button/Button/Button.js.map +1 -1
- package/components/Button/Button.d.ts +3 -0
- package/components/Button/Button.styles/Button.styles.js +6 -6
- package/components/Button/Button.styles/Button.styles.js.map +1 -1
- package/components/Button/Button.styles.d.ts +1 -1
- package/components/Center/Center/Center.js +10 -5
- package/components/Center/Center/Center.js.map +1 -1
- package/components/Center/Center.d.ts +3 -0
- package/components/Checkbox/Checkbox/Checkbox.js +4 -0
- package/components/Checkbox/Checkbox/Checkbox.js.map +1 -1
- package/components/Checkbox/Checkbox.d.ts +3 -0
- package/components/Checkbox/Checkbox.md +48 -0
- package/components/CurrencyInput/CurrencyInput/CurrencyInput.js +27 -12
- package/components/CurrencyInput/CurrencyInput/CurrencyInput.js.map +1 -1
- package/components/CurrencyInput/CurrencyInput.d.ts +4 -1
- package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js +6 -1
- package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js.map +1 -1
- package/components/CurrencyLabel/CurrencyLabel.d.ts +3 -0
- package/components/DatePicker/DatePicker/DatePicker.js +6 -0
- package/components/DatePicker/DatePicker/DatePicker.js.map +1 -1
- package/components/DatePicker/DatePicker.d.ts +5 -0
- package/components/DatePicker/Picker/Picker.js +3 -1
- package/components/DatePicker/Picker/Picker.js.map +1 -1
- package/components/Dropdown/Dropdown/Dropdown.js +9 -5
- package/components/Dropdown/Dropdown/Dropdown.js.map +1 -1
- package/components/Dropdown/Dropdown.d.ts +3 -0
- package/components/FileUploader/FileUploader/FileUploader.js +9 -2
- package/components/FileUploader/FileUploader/FileUploader.js.map +1 -1
- package/components/FileUploader/FileUploader.d.ts +5 -0
- package/components/FxInput/FxInput/FxInput.js +6 -2
- package/components/FxInput/FxInput/FxInput.js.map +1 -1
- package/components/FxInput/FxInput.d.ts +3 -0
- package/components/Gapped/Gapped/Gapped.js +12 -5
- package/components/Gapped/Gapped/Gapped.js.map +1 -1
- package/components/Gapped/Gapped.d.ts +4 -0
- package/components/GlobalLoader/GlobalLoader/GlobalLoader.js +4 -1
- package/components/GlobalLoader/GlobalLoader/GlobalLoader.js.map +1 -1
- package/components/GlobalLoader/GlobalLoader.d.ts +3 -0
- package/components/Group/Group/Group.js +4 -0
- package/components/Group/Group/Group.js.map +1 -1
- package/components/Group/Group.d.ts +3 -0
- package/components/Input/Input/Input.js +11 -6
- package/components/Input/Input/Input.js.map +1 -1
- package/components/Input/Input.d.ts +3 -0
- package/components/Link/Link/Link.js +11 -6
- package/components/Link/Link/Link.js.map +1 -1
- package/components/Link/Link.d.ts +4 -1
- package/components/Loader/Loader/Loader.js +10 -6
- package/components/Loader/Loader/Loader.js.map +1 -1
- package/components/Loader/Loader.d.ts +4 -0
- package/components/MenuHeader/MenuHeader/MenuHeader.js +4 -0
- package/components/MenuHeader/MenuHeader/MenuHeader.js.map +1 -1
- package/components/MenuHeader/MenuHeader.d.ts +3 -0
- package/components/MenuItem/MenuItem/MenuItem.js +16 -10
- package/components/MenuItem/MenuItem/MenuItem.js.map +1 -1
- package/components/MenuItem/MenuItem.d.ts +5 -1
- package/components/MenuSeparator/MenuSeparator/MenuSeparator.js +4 -0
- package/components/MenuSeparator/MenuSeparator/MenuSeparator.js.map +1 -1
- package/components/MenuSeparator/MenuSeparator.d.ts +3 -0
- package/components/Modal/Modal/Modal.js +7 -2
- package/components/Modal/Modal/Modal.js.map +1 -1
- package/components/Modal/Modal.d.ts +5 -0
- package/components/Modal/ModalClose/ModalClose.js +2 -1
- package/components/Modal/ModalClose/ModalClose.js.map +1 -1
- package/components/Modal/ModalFooter/ModalFooter.js +6 -2
- package/components/Modal/ModalFooter/ModalFooter.js.map +1 -1
- package/components/Modal/ModalFooter.d.ts +3 -0
- package/components/Modal/ModalHeader/ModalHeader.js +6 -2
- package/components/Modal/ModalHeader/ModalHeader.js.map +1 -1
- package/components/Modal/ModalHeader.d.ts +3 -0
- package/components/Paging/Paging/Paging.js +12 -5
- package/components/Paging/Paging/Paging.js.map +1 -1
- package/components/Paging/Paging.d.ts +8 -1
- package/components/PasswordInput/PasswordInput/PasswordInput.js +12 -6
- package/components/PasswordInput/PasswordInput/PasswordInput.js.map +1 -1
- package/components/PasswordInput/PasswordInput.d.ts +5 -0
- package/components/Radio/Radio/Radio.js +10 -5
- package/components/Radio/Radio/Radio.js.map +1 -1
- package/components/Radio/Radio.d.ts +3 -0
- package/components/RadioGroup/RadioGroup/RadioGroup.js +23 -11
- package/components/RadioGroup/RadioGroup/RadioGroup.js.map +1 -1
- package/components/RadioGroup/RadioGroup.d.ts +9 -0
- package/components/ResponsiveLayout/useResponsiveLayout/useResponsiveLayout.js +1 -1
- package/components/ResponsiveLayout/useResponsiveLayout/useResponsiveLayout.js.map +1 -1
- package/components/ScrollContainer/ScrollContainer/ScrollContainer.js +6 -1
- package/components/ScrollContainer/ScrollContainer/ScrollContainer.js.map +1 -1
- package/components/ScrollContainer/ScrollContainer.d.ts +4 -0
- package/components/Select/Select/Select.js +4 -0
- package/components/Select/Select/Select.js.map +1 -1
- package/components/Select/Select.d.ts +3 -0
- package/components/SidePage/SidePage/SidePage.js +6 -2
- package/components/SidePage/SidePage/SidePage.js.map +1 -1
- package/components/SidePage/SidePage.d.ts +4 -0
- package/components/SidePage/SidePageBody/SidePageBody.js +10 -6
- package/components/SidePage/SidePageBody/SidePageBody.js.map +1 -1
- package/components/SidePage/SidePageBody.d.ts +3 -0
- package/components/SidePage/SidePageContainer/SidePageContainer.js +10 -6
- package/components/SidePage/SidePageContainer/SidePageContainer.js.map +1 -1
- package/components/SidePage/SidePageContainer.d.ts +3 -0
- package/components/SidePage/SidePageFooter/SidePageFooter.js +10 -6
- package/components/SidePage/SidePageFooter/SidePageFooter.js.map +1 -1
- package/components/SidePage/SidePageFooter.d.ts +3 -0
- package/components/SidePage/SidePageHeader/SidePageHeader.js +12 -7
- package/components/SidePage/SidePageHeader/SidePageHeader.js.map +1 -1
- package/components/SidePage/SidePageHeader.d.ts +4 -0
- package/components/Spinner/Spinner/Spinner.js +8 -4
- package/components/Spinner/Spinner/Spinner.js.map +1 -1
- package/components/Spinner/Spinner.d.ts +3 -0
- package/components/Sticky/Sticky/Sticky.js +4 -0
- package/components/Sticky/Sticky/Sticky.js.map +1 -1
- package/components/Sticky/Sticky.d.ts +3 -0
- package/components/Switcher/Switcher/Switcher.js +4 -0
- package/components/Switcher/Switcher/Switcher.js.map +1 -1
- package/components/Switcher/Switcher.d.ts +3 -0
- package/components/Tabs/Indicator/Indicator.js +2 -0
- package/components/Tabs/Indicator/Indicator.js.map +1 -1
- package/components/Tabs/Tab/Tab.js +4 -0
- package/components/Tabs/Tab/Tab.js.map +1 -1
- package/components/Tabs/Tab.d.ts +3 -0
- package/components/Tabs/Tabs/Tabs.js +11 -6
- package/components/Tabs/Tabs/Tabs.js.map +1 -1
- package/components/Tabs/Tabs.d.ts +4 -0
- package/components/Textarea/Textarea/Textarea.js +15 -9
- package/components/Textarea/Textarea/Textarea.js.map +1 -1
- package/components/Textarea/Textarea.d.ts +4 -0
- package/components/Textarea/TextareaCounter/TextareaCounter.js +8 -3
- package/components/Textarea/TextareaCounter/TextareaCounter.js.map +1 -1
- package/components/Toast/Toast/Toast.js +16 -10
- package/components/Toast/Toast/Toast.js.map +1 -1
- package/components/Toast/Toast.d.ts +6 -0
- package/components/Toast/ToastStatic/ToastStatic.js +2 -2
- package/components/Toast/ToastStatic/ToastStatic.js.map +1 -1
- package/components/Toast/ToastView/ToastView.js +4 -3
- package/components/Toast/ToastView/ToastView.js.map +1 -1
- package/components/Toggle/Toggle/Toggle.js +8 -4
- package/components/Toggle/Toggle/Toggle.js.map +1 -1
- package/components/Toggle/Toggle.d.ts +3 -0
- package/components/Token/Token/Token.js +4 -0
- package/components/Token/Token/Token.js.map +1 -1
- package/components/Token/Token.d.ts +3 -0
- package/components/TokenInput/TokenInput/TokenInput.js +5 -0
- package/components/TokenInput/TokenInput/TokenInput.js.map +1 -1
- package/components/TokenInput/TokenInput.d.ts +4 -0
- package/components/TokenInput/TokenInputMenu/TokenInputMenu.js +2 -0
- package/components/TokenInput/TokenInputMenu/TokenInputMenu.js.map +1 -1
- package/components/Tooltip/Tooltip/Tooltip.js +7 -1
- package/components/Tooltip/Tooltip/Tooltip.js.map +1 -1
- package/components/Tooltip/Tooltip.d.ts +4 -0
- package/components/TooltipMenu/TooltipMenu/TooltipMenu.js +16 -12
- package/components/TooltipMenu/TooltipMenu/TooltipMenu.js.map +1 -1
- package/components/TooltipMenu/TooltipMenu.d.ts +3 -0
- package/internal/Calendar/Calendar/Calendar.js +7 -1
- package/internal/Calendar/Calendar/Calendar.js.map +1 -1
- package/internal/Calendar/Calendar.d.ts +6 -0
- package/internal/Calendar/MonthView/MonthView.js +4 -3
- package/internal/Calendar/MonthView/MonthView.js.map +1 -1
- package/internal/CommonWrapper/CommonWrapper/CommonWrapper.js +4 -5
- package/internal/CommonWrapper/CommonWrapper/CommonWrapper.js.map +1 -1
- package/internal/CommonWrapper/CommonWrapper.d.ts +1 -0
- package/internal/CustomComboBox/ComboBoxMenu/ComboBoxMenu.js +12 -5
- package/internal/CustomComboBox/ComboBoxMenu/ComboBoxMenu.js.map +1 -1
- package/internal/CustomComboBox/ComboBoxMenu.d.ts +7 -0
- package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js +2 -0
- package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js.map +1 -1
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js +3 -0
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js.map +1 -1
- package/internal/CustomComboBox/CustomComboBox.d.ts +3 -0
- package/internal/DataTids/DATATIDS.md +12 -0
- package/internal/DataTids/DataTids/DataTids.js +69 -0
- package/internal/DataTids/DataTids/DataTids.js.map +1 -0
- package/internal/DataTids/DataTids/package.json +6 -0
- package/internal/DataTids/DataTids.d.ts +12 -0
- package/internal/DataTids/DataTids.styles/DataTids.styles.js +22 -0
- package/internal/DataTids/DataTids.styles/DataTids.styles.js.map +1 -0
- package/internal/DataTids/DataTids.styles/package.json +6 -0
- package/internal/DataTids/DataTids.styles.d.ts +7 -0
- package/internal/DataTids/componentsDataTids/componentsDataTids.js +14 -0
- package/internal/DataTids/componentsDataTids/componentsDataTids.js.map +1 -0
- package/internal/DataTids/componentsDataTids/package.json +6 -0
- package/internal/DataTids/componentsDataTids.d.ts +5 -0
- package/internal/DateSelect/DateSelect/DateSelect.js +6 -2
- package/internal/DateSelect/DateSelect/DateSelect.js.map +1 -1
- package/internal/DateSelect/DateSelect.d.ts +4 -0
- package/internal/FileUploaderControl/FileUploaderFile/FileUploaderFile/FileUploaderFile.js +12 -5
- package/internal/FileUploaderControl/FileUploaderFile/FileUploaderFile/FileUploaderFile.js.map +1 -1
- package/internal/FileUploaderControl/FileUploaderFile/FileUploaderFile.d.ts +7 -0
- package/internal/FileUploaderControl/FileUploaderFileList/FileUploaderFileList/FileUploaderFileList.js +4 -1
- package/internal/FileUploaderControl/FileUploaderFileList/FileUploaderFileList/FileUploaderFileList.js.map +1 -1
- package/internal/FileUploaderControl/FileUploaderFileList/FileUploaderFileList.d.ts +3 -0
- package/internal/InputLikeText/InputLikeText/InputLikeText.js +8 -2
- package/internal/InputLikeText/InputLikeText/InputLikeText.js.map +1 -1
- package/internal/InputLikeText/InputLikeText.d.ts +4 -0
- package/internal/InternalMenu/InternalMenu/InternalMenu.js +4 -0
- package/internal/InternalMenu/InternalMenu/InternalMenu.js.map +1 -1
- package/internal/InternalMenu/InternalMenu.d.ts +3 -0
- package/internal/InternalMenu/InternalMenu.styles/InternalMenu.styles.js +1 -1
- package/internal/InternalMenu/InternalMenu.styles/InternalMenu.styles.js.map +1 -1
- package/internal/MaskedInput/MaskedInput/MaskedInput.js +4 -0
- package/internal/MaskedInput/MaskedInput/MaskedInput.js.map +1 -1
- package/internal/MaskedInput/MaskedInput.d.ts +3 -0
- package/internal/Menu/Menu/Menu.js +4 -0
- package/internal/Menu/Menu/Menu.js.map +1 -1
- package/internal/Menu/Menu.d.ts +3 -0
- package/internal/MobilePopup/MobilePopup/MobilePopup.js +6 -0
- package/internal/MobilePopup/MobilePopup/MobilePopup.js.map +1 -1
- package/internal/MobilePopup/MobilePopup.d.ts +4 -0
- package/internal/Popup/Popup/Popup.js +7 -2
- package/internal/Popup/Popup/Popup.js.map +1 -1
- package/internal/Popup/Popup.d.ts +5 -0
- package/internal/Popup/PopupPin/PopupPin.js +2 -0
- package/internal/Popup/PopupPin/PopupPin.js.map +1 -1
- package/internal/PopupMenu/PopupMenu/PopupMenu.js +7 -2
- package/internal/PopupMenu/PopupMenu/PopupMenu.js.map +1 -1
- package/internal/PopupMenu/PopupMenu.d.ts +4 -0
- package/internal/RenderLayer/RenderLayer/RenderLayer.js +10 -7
- package/internal/RenderLayer/RenderLayer/RenderLayer.js.map +1 -1
- package/internal/RenderLayer/RenderLayer.d.ts +1 -0
- package/internal/icons/16px/index/index.js +1 -1
- package/internal/icons/16px/index/index.js.map +1 -1
- package/lib/listenFocusOutside/listenFocusOutside.js +1 -1
- package/lib/listenFocusOutside/listenFocusOutside.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CommonWrapper.tsx"],"names":["CommonWrapper","rootNode","rootNodeSubscription","ref","instance","setRootNode","props","rootNodeRef","remove","addRootNodeChangeListener","node","originalRef","child","render","extractCommonProps","className","style","
|
|
1
|
+
{"version":3,"sources":["CommonWrapper.tsx"],"names":["CommonWrapper","rootNode","rootNodeSubscription","ref","instance","setRootNode","props","rootNodeRef","remove","addRootNodeChangeListener","node","originalRef","child","render","extractCommonProps","className","style","children","dataProps","rest","isValidElement","React","cloneElement","Component","common","key","isCommonProp","name","indexOf"],"mappings":"ucAAA;;AAEA;AACA;;AAEA;AACA,mE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BaA,a,OADZC,kB;;;;;AAMSC,IAAAA,oB,GAAwD,I;;;;;;;;;;;;;;;;;;AAkBxDC,IAAAA,G,GAAM,UAACC,QAAD,EAA6C;AACzD,YAAKC,WAAL,CAAiBD,QAAjB;AACA,YAAKE,KAAL,CAAWC,WAAX,0BAAKD,KAAL,CAAWC,WAAX,CAAyB,2BAAYH,QAAZ,CAAzB;;AAEA;AACA;AACA,qCAAKF,oBAAL,2CAA2BM,MAA3B;AACA,YAAKN,oBAAL,GAA4B,IAA5B;;AAEA,UAAIE,QAAQ,IAAI,sCAAuBA,QAAvB,CAAhB,EAAkD;AAChD,cAAKF,oBAAL,GAA4BE,QAAQ,CAACK,yBAArC,oBAA4BL,QAAQ,CAACK,yBAAT,CAAqC,UAACC,IAAD,EAAU;AACzE,gBAAKL,WAAL,CAAiBK,IAAjB;AACA,gBA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AD,CAAnB;AACD,KAHD,MAGO;AACL;AACAN,MAAAA,IAAI,CAACM,GAAD,CAAJ,GAAYnB,KAAK,CAACmB,GAAD,CAAjB;AACD;AACF;;AAED,SAAO,CAACD,MAAD,EAASL,IAAT,CAAP;AACD,CAjBD;;AAmBA,IAAMO,YAAY,GAAG,SAAfA,YAAe,CAACC,IAAD,EAAkB;AACrC,UAAQ,IAAR;AACE,SAAKA,IAAI,KAAK,WAAd;AACA,SAAKA,IAAI,KAAK,OAAd;AACA,SAAKA,IAAI,KAAK,aAAd;AACA,SAAKA,IAAI,KAAK,UAAd;AACA,SAAKA,IAAI,CAACC,OAAL,CAAa,OAAb,MAA0B,CAA/B,EAAkC;AAChC,aAAO,IAAP;AACF;AACE,aAAO,KAAP,CARJ;;AAUD,CAXD","sourcesContent":["import React from 'react';\n\nimport { isFunction, isRefableElement } from '../../lib/utils';\nimport { cx } from '../../lib/theming/Emotion';\nimport { Nullable } from '../../typings/utility-types';\nimport { getRootNode, rootNode, TSetRootNode, TRootNodeSubscription, isInstanceWithRootNode } from '../../lib/rootNode';\nimport { callChildRef } from '../../lib/callChildRef/callChildRef';\n\nexport interface CommonProps {\n /**\n * HTML-атрибут `class`.\n */\n className?: React.HTMLAttributes<HTMLElement>['className'];\n /**\n * HTML-атрибут `style`.\n */\n style?: React.HTMLAttributes<HTMLElement>['style'];\n /**\n * На равне с data-tid транслируются любые data-атрибуты. Они попадают на корневой элемент.\n */\n 'data-tid'?: string;\n children?: React.ReactNode;\n}\n\ninterface CommonPropsRootNodeRef {\n rootNodeRef?: (instance: Nullable<HTMLElement>) => void;\n}\n\nexport type NotCommonProps<P> = Omit<P, keyof CommonProps>;\n\nexport type CommonWrapperProps<P> = P & {\n children: React.ReactNode | ((rest: CommonWrapperRestProps<P>) => React.ReactNode);\n};\nexport type CommonWrapperRestProps<P> = Omit<NotCommonProps<P>, 'children'>;\n\n@rootNode\nexport class CommonWrapper<P extends CommonProps & CommonPropsRootNodeRef> extends React.Component<\n CommonWrapperProps<P> & CommonPropsRootNodeRef\n> {\n private child: React.ReactNode;\n private setRootNode!: TSetRootNode;\n private rootNodeSubscription: Nullable<TRootNodeSubscription> = null;\n\n render() {\n const [{ className, style, children, rootNodeRef, ...dataProps }, { ...rest }] = extractCommonProps(this.props);\n this.child = isFunction(children) ? children(rest) : children;\n return React.isValidElement<CommonProps & React.RefAttributes<any>>(this.child)\n ? React.cloneElement(this.child, {\n ref: isRefableElement(this.child) ? this.ref : null,\n className: cx(this.child.props.className, className),\n style: {\n ...this.child.props.style,\n ...style,\n },\n ...dataProps,\n })\n : this.child;\n }\n\n private ref = (instance: Nullable<React.ReactInstance>) => {\n this.setRootNode(instance);\n this.props.rootNodeRef?.(getRootNode(instance));\n\n // refs are called when instances change\n // so we have to renew or remove old subscription\n this.rootNodeSubscription?.remove();\n this.rootNodeSubscription = null;\n\n if (instance && isInstanceWithRootNode(instance)) {\n this.rootNodeSubscription = instance.addRootNodeChangeListener?.((node) => {\n this.setRootNode(node);\n this.props.rootNodeRef?.(node);\n });\n }\n\n const originalRef = (this.child as React.RefAttributes<any>)?.ref;\n originalRef && callChildRef(originalRef, instance);\n };\n}\n\nconst extractCommonProps = <P extends CommonProps & CommonPropsRootNodeRef>(\n props: P,\n): [CommonProps & CommonPropsRootNodeRef, NotCommonProps<P>] => {\n const common = {} as CommonProps & CommonPropsRootNodeRef;\n const rest = {} as NotCommonProps<P>;\n\n for (const key in props) {\n if (isCommonProp(key)) {\n // @ts-ignore\n common[key] = props[key];\n } else {\n // @ts-ignore\n rest[key] = props[key];\n }\n }\n\n return [common, rest];\n};\n\nconst isCommonProp = (name: string) => {\n switch (true) {\n case name === 'className':\n case name === 'style':\n case name === 'rootNodeRef':\n case name === 'children':\n case name.indexOf('data-') === 0: // все data-атрибуты\n return true;\n default:\n return false;\n }\n};\n"]}
|
|
@@ -20,6 +20,13 @@ export interface ComboBoxMenuProps<T> {
|
|
|
20
20
|
requestStatus?: ComboBoxRequestStatus;
|
|
21
21
|
isMobile?: boolean;
|
|
22
22
|
}
|
|
23
|
+
export declare const ComboBoxMenuDataTids: {
|
|
24
|
+
readonly loading: "ComboBoxMenu__loading";
|
|
25
|
+
readonly failed: "ComboBoxMenu__failed";
|
|
26
|
+
readonly notFound: "ComboBoxMenu__notFound";
|
|
27
|
+
readonly items: "ComboBoxMenu__items";
|
|
28
|
+
readonly item: "ComboBoxMenu__item";
|
|
29
|
+
};
|
|
23
30
|
export declare class ComboBoxMenu<T> extends Component<ComboBoxMenuProps<T>> {
|
|
24
31
|
static __KONTUR_REACT_UI__: string;
|
|
25
32
|
static defaultProps: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.ComboBoxMenu = void 0;var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _react = _interopRequireWildcard(require("react"));
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.ComboBoxMenuDataTids = exports.ComboBoxMenu = void 0;var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _react = _interopRequireWildcard(require("react"));
|
|
2
2
|
|
|
3
3
|
var _utils = require("../../lib/utils");
|
|
4
4
|
var _decorators = require("../../lib/locale/decorators");
|
|
@@ -9,7 +9,7 @@ var _Spinner = require("../../components/Spinner");
|
|
|
9
9
|
var _MenuSeparator = require("../../components/MenuSeparator");
|
|
10
10
|
|
|
11
11
|
var _CustomComboBoxTypes = require("./CustomComboBoxTypes");
|
|
12
|
-
var _locale = require("./locale");var _dec, _class, _class2, _temp;function _getRequireWildcardCache(nodeInterop) {if (typeof WeakMap !== "function") return null;var cacheBabelInterop = new WeakMap();var cacheNodeInterop = new WeakMap();return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {return nodeInterop ? cacheNodeInterop : cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj, nodeInterop) {if (!nodeInterop && obj && obj.__esModule) {return obj;}if (obj === null || typeof obj !== "object" && typeof obj !== "function") {return { default: obj };}var cache = _getRequireWildcardCache(nodeInterop);if (cache && cache.has(obj)) {return cache.get(obj);}var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {Object.defineProperty(newObj, key, desc);} else {newObj[key] = obj[key];}}}newObj.default = obj;if (cache) {cache.set(obj, newObj);}return newObj;}
|
|
12
|
+
var _locale = require("./locale");var _dec, _class, _class2, _temp;function _getRequireWildcardCache(nodeInterop) {if (typeof WeakMap !== "function") return null;var cacheBabelInterop = new WeakMap();var cacheNodeInterop = new WeakMap();return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {return nodeInterop ? cacheNodeInterop : cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj, nodeInterop) {if (!nodeInterop && obj && obj.__esModule) {return obj;}if (obj === null || typeof obj !== "object" && typeof obj !== "function") {return { default: obj };}var cache = _getRequireWildcardCache(nodeInterop);if (cache && cache.has(obj)) {return cache.get(obj);}var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {Object.defineProperty(newObj, key, desc);} else {newObj[key] = obj[key];}}}newObj.default = obj;if (cache) {cache.set(obj, newObj);}return newObj;}
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -29,6 +29,14 @@ var _locale = require("./locale");var _dec, _class, _class2, _temp;function _get
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
var ComboBoxMenuDataTids = {
|
|
33
|
+
loading: 'ComboBoxMenu__loading',
|
|
34
|
+
failed: 'ComboBoxMenu__failed',
|
|
35
|
+
notFound: 'ComboBoxMenu__notFound',
|
|
36
|
+
items: 'ComboBoxMenu__items',
|
|
37
|
+
item: 'ComboBoxMenu__item' };exports.ComboBoxMenuDataTids = ComboBoxMenuDataTids;var
|
|
38
|
+
|
|
39
|
+
|
|
32
40
|
|
|
33
41
|
ComboBoxMenu = (_dec = (0, _decorators.locale)('ComboBox', _locale.CustomComboBoxLocaleHelper), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {(0, _inheritsLoose2.default)(ComboBoxMenu, _Component);function ComboBoxMenu() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _Component.call.apply(_Component, [this].concat(args)) || this;_this.
|
|
34
42
|
|
|
@@ -124,6 +132,16 @@ ComboBoxMenu = (_dec = (0, _decorators.locale)('ComboBox', _locale.CustomComboBo
|
|
|
124
132
|
|
|
125
133
|
|
|
126
134
|
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
127
145
|
|
|
128
146
|
|
|
129
147
|
|
|
@@ -154,7 +172,7 @@ ComboBoxMenu = (_dec = (0, _decorators.locale)('ComboBox', _locale.CustomComboBo
|
|
|
154
172
|
|
|
155
173
|
return /*#__PURE__*/(
|
|
156
174
|
_react.default.createElement(_MenuItem.MenuItem, {
|
|
157
|
-
"data-tid":
|
|
175
|
+
"data-tid": ComboBoxMenuDataTids.item,
|
|
158
176
|
onClick: function onClick() {return onValueChange(item);},
|
|
159
177
|
key: index,
|
|
160
178
|
isMobile: _this.props.isMobile },
|
|
@@ -162,5 +180,5 @@ ComboBoxMenu = (_dec = (0, _decorators.locale)('ComboBox', _locale.CustomComboBo
|
|
|
162
180
|
function (state) {return renderItem(item, state);}));
|
|
163
181
|
|
|
164
182
|
|
|
165
|
-
};return _this;}var _proto = ComboBoxMenu.prototype;_proto.render = function render() {var _this$props2 = this.props,opened = _this$props2.opened,items = _this$props2.items,totalCount = _this$props2.totalCount,loading = _this$props2.loading,refMenu = _this$props2.refMenu,_this$props2$renderNo = _this$props2.renderNotFound,renderNotFound = _this$props2$renderNo === void 0 ? function () {return notFound;} : _this$props2$renderNo,renderTotalCount = _this$props2.renderTotalCount,maxMenuHeight = _this$props2.maxMenuHeight,requestStatus = _this$props2.requestStatus,isMobile = _this$props2.isMobile;var _this$locale = this.locale,notFound = _this$locale.notFound,errorNetworkButton = _this$locale.errorNetworkButton,errorNetworkMessage = _this$locale.errorNetworkMessage;if (!opened) {return null;}var renderAddButton = null;if (this.props.renderAddButton) {renderAddButton = this.props.renderAddButton();}var maxHeight = isMobile ? 'auto' : maxMenuHeight;if (loading && (!items || !items.length)) {return /*#__PURE__*/_react.default.createElement(_Menu.Menu, { maxHeight: maxHeight, ref: refMenu, disableScrollContainer: isMobile, "data-tid":
|
|
166
|
-
var countItems = renderedItems == null ? void 0 : renderedItems.filter(function (item) {var _item$type;return (item == null ? void 0 : (_item$type = item.type) == null ? void 0 : _item$type.__KONTUR_REACT_UI__) === 'MenuItem';}).length;if (countItems && renderTotalCount && totalCount && countItems < totalCount) {total = /*#__PURE__*/_react.default.createElement(_MenuItem.MenuItem, { disabled: true, key: "total", isMobile: isMobile }, /*#__PURE__*/_react.default.createElement("div", { style: { fontSize: 12 } }, renderTotalCount(countItems, totalCount)));}return /*#__PURE__*/_react.default.createElement(_Menu.Menu, { "data-tid":
|
|
183
|
+
};return _this;}var _proto = ComboBoxMenu.prototype;_proto.render = function render() {var _this$props2 = this.props,opened = _this$props2.opened,items = _this$props2.items,totalCount = _this$props2.totalCount,loading = _this$props2.loading,refMenu = _this$props2.refMenu,_this$props2$renderNo = _this$props2.renderNotFound,renderNotFound = _this$props2$renderNo === void 0 ? function () {return notFound;} : _this$props2$renderNo,renderTotalCount = _this$props2.renderTotalCount,maxMenuHeight = _this$props2.maxMenuHeight,requestStatus = _this$props2.requestStatus,isMobile = _this$props2.isMobile;var _this$locale = this.locale,notFound = _this$locale.notFound,errorNetworkButton = _this$locale.errorNetworkButton,errorNetworkMessage = _this$locale.errorNetworkMessage;if (!opened) {return null;}var renderAddButton = null;if (this.props.renderAddButton) {renderAddButton = this.props.renderAddButton();}var maxHeight = isMobile ? 'auto' : maxMenuHeight;if (loading && (!items || !items.length)) {return /*#__PURE__*/_react.default.createElement(_Menu.Menu, { maxHeight: maxHeight, ref: refMenu, disableScrollContainer: isMobile, "data-tid": ComboBoxMenuDataTids.loading }, /*#__PURE__*/_react.default.createElement(_MenuItem.MenuItem, { disabled: true, isMobile: isMobile }, /*#__PURE__*/_react.default.createElement(_Spinner.Spinner, { type: "mini", dimmed: true })));}if (items === null && requestStatus === _CustomComboBoxTypes.ComboBoxRequestStatus.Failed) {return /*#__PURE__*/_react.default.createElement(_Menu.Menu, { ref: refMenu, maxHeight: maxHeight, disableScrollContainer: isMobile, "data-tid": ComboBoxMenuDataTids.failed }, /*#__PURE__*/_react.default.createElement(_MenuItem.MenuItem, { disabled: true, key: "message", isMobile: isMobile }, /*#__PURE__*/_react.default.createElement("div", { style: { maxWidth: 300, whiteSpace: 'normal' } }, errorNetworkMessage)), /*#__PURE__*/_react.default.createElement(_MenuItem.MenuItem, { link: true, onClick: this.props.repeatRequest, key: "retry", isMobile: isMobile }, errorNetworkButton));}if (((0, _utils.isNullable)(items) || items.length === 0) && renderNotFound) {var notFoundValue = renderNotFound();if (renderAddButton) {return /*#__PURE__*/_react.default.createElement(_Menu.Menu, { maxHeight: maxHeight, ref: refMenu, disableScrollContainer: isMobile }, renderAddButton);}if (notFoundValue) {return /*#__PURE__*/_react.default.createElement(_Menu.Menu, { maxHeight: maxHeight, ref: refMenu, disableScrollContainer: isMobile }, /*#__PURE__*/_react.default.createElement(_MenuItem.MenuItem, { "data-tid": ComboBoxMenuDataTids.notFound, disabled: true, isMobile: isMobile }, notFoundValue));}return null;}var total = null;var renderedItems = items && items.map(this.renderItem); // @ts-ignore // todo fix checking
|
|
184
|
+
var countItems = renderedItems == null ? void 0 : renderedItems.filter(function (item) {var _item$type;return (item == null ? void 0 : (_item$type = item.type) == null ? void 0 : _item$type.__KONTUR_REACT_UI__) === 'MenuItem';}).length;if (countItems && renderTotalCount && totalCount && countItems < totalCount) {total = /*#__PURE__*/_react.default.createElement(_MenuItem.MenuItem, { disabled: true, key: "total", isMobile: isMobile }, /*#__PURE__*/_react.default.createElement("div", { style: { fontSize: 12 } }, renderTotalCount(countItems, totalCount)));}return /*#__PURE__*/_react.default.createElement(_Menu.Menu, { "data-tid": ComboBoxMenuDataTids.items, ref: refMenu, maxHeight: maxHeight, disableScrollContainer: isMobile }, renderedItems, total, renderAddButton && [/*#__PURE__*/_react.default.createElement(_MenuSeparator.MenuSeparator, { key: "separator" }), renderAddButton]);};return ComboBoxMenu;}(_react.Component), _class2.__KONTUR_REACT_UI__ = 'ComboBoxMenu', _class2.defaultProps = { repeatRequest: function repeatRequest() {return undefined;}, requestStatus: _CustomComboBoxTypes.ComboBoxRequestStatus.Unknown }, _temp)) || _class);exports.ComboBoxMenu = ComboBoxMenu;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ComboBoxMenu.tsx"],"names":["ComboBoxMenu","CustomComboBoxLocaleHelper","renderItem","item","index","props","onValueChange","React","isValidElement","element","Object","assign","key","onClick","cloneElement","isMobile","state","render","opened","items","totalCount","loading","refMenu","renderNotFound","notFound","renderTotalCount","maxMenuHeight","requestStatus","locale","errorNetworkButton","errorNetworkMessage","renderAddButton","maxHeight","length","ComboBoxRequestStatus","Failed","maxWidth","whiteSpace","repeatRequest","notFoundValue","total","renderedItems","map","countItems","filter","type","__KONTUR_REACT_UI__","fontSize","Component","defaultProps","undefined","Unknown"],"mappings":"wPAAA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,kC;;;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Ad,IAAkCL,UAAlC,IAAgDuB,UAAU,GAAGvB,UAAjE,EAA6E,CAC3EoB,KAAK,gBACH,6BAAC,kBAAD,IAAU,QAAQ,MAAlB,EAAmB,GAAG,EAAC,OAAvB,EAA+B,QAAQ,EAAEzB,QAAzC,iBACE,sCAAK,KAAK,EAAE,EAAEgC,QAAQ,EAAE,EAAZ,EAAZ,IAA+BtB,gBAAgB,CAACkB,UAAD,EAAavB,UAAb,CAA/C,CADF,CADF,CAKD,CAED,oBACE,6BAAC,UAAD,IAAM,YAAS,qBAAf,EAAqC,GAAG,EAAEE,OAA1C,EAAmD,SAAS,EAAEU,SAA9D,EAAyE,sBAAsB,EAAEjB,QAAjG,IACG0B,aADH,EAEGD,KAFH,EAGGT,eAAe,IAAI,cAAC,6BAAC,4BAAD,IAAe,GAAG,EAAC,WAAnB,GAAD,EAAoCA,eAApC,CAHtB,CADF,CAOD,C,uBAvGkCiB,gB,WACrBF,mB,GAAsB,c,UAEtBG,Y,GAAe,EAC3BX,aAAa,EAAE,iCAAMY,SAAN,EADY,EAE3BvB,aAAa,EAAEO,2CAAsBiB,OAFV,E","sourcesContent":["import React, { Component } from 'react';\n\nimport { isNullable } from '../../lib/utils';\nimport { locale } from '../../lib/locale/decorators';\nimport { Menu } from '../Menu';\nimport { MenuItem, MenuItemState } from '../../components/MenuItem';\nimport { Spinner } from '../../components/Spinner';\nimport { Nullable } from '../../typings/utility-types';\nimport { MenuSeparator } from '../../components/MenuSeparator';\n\nimport { ComboBoxRequestStatus } from './CustomComboBoxTypes';\nimport { ComboBoxLocale, CustomComboBoxLocaleHelper } from './locale';\n\nexport interface ComboBoxMenuProps<T> {\n opened?: boolean;\n items?: Nullable<T[]>;\n totalCount?: number;\n loading?: boolean;\n maxMenuHeight?: number | string;\n refMenu?: (menu: Nullable<Menu>) => void;\n renderNotFound?: () => React.ReactNode;\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n renderItem: (item: T, state: MenuItemState) => React.ReactNode;\n onValueChange: (value: T) => any;\n renderAddButton?: () => React.ReactNode;\n caption?: React.ReactNode;\n repeatRequest?: () => void;\n requestStatus?: ComboBoxRequestStatus;\n isMobile?: boolean;\n}\n\n@locale('ComboBox', CustomComboBoxLocaleHelper)\nexport class ComboBoxMenu<T> extends Component<ComboBoxMenuProps<T>> {\n public static __KONTUR_REACT_UI__ = 'ComboBoxMenu';\n\n public static defaultProps = {\n repeatRequest: () => undefined,\n requestStatus: ComboBoxRequestStatus.Unknown,\n };\n\n private readonly locale!: ComboBoxLocale;\n\n public render() {\n const {\n opened,\n items,\n totalCount,\n loading,\n refMenu,\n renderNotFound = () => notFound,\n renderTotalCount,\n maxMenuHeight,\n requestStatus,\n isMobile,\n } = this.props;\n\n const { notFound, errorNetworkButton, errorNetworkMessage } = this.locale;\n\n if (!opened) {\n return null;\n }\n\n let renderAddButton = null;\n if (this.props.renderAddButton) {\n renderAddButton = this.props.renderAddButton();\n }\n\n const maxHeight = isMobile ? 'auto' : maxMenuHeight;\n\n if (loading && (!items || !items.length)) {\n return (\n <Menu maxHeight={maxHeight} ref={refMenu} disableScrollContainer={isMobile} data-tid=\"ComboBoxMenu__loading\">\n <MenuItem disabled isMobile={isMobile}>\n <Spinner type=\"mini\" dimmed />\n </MenuItem>\n </Menu>\n );\n }\n\n if (items === null && requestStatus === ComboBoxRequestStatus.Failed) {\n return (\n <Menu ref={refMenu} maxHeight={maxHeight} disableScrollContainer={isMobile} data-tid=\"ComboBoxMenu__failed\">\n <MenuItem disabled key=\"message\" isMobile={isMobile}>\n <div style={{ maxWidth: 300, whiteSpace: 'normal' }}>{errorNetworkMessage}</div>\n </MenuItem>\n <MenuItem link onClick={this.props.repeatRequest} key=\"retry\" isMobile={isMobile}>\n {errorNetworkButton}\n </MenuItem>\n </Menu>\n );\n }\n\n if ((isNullable(items) || items.length === 0) && renderNotFound) {\n const notFoundValue = renderNotFound();\n if (renderAddButton) {\n return (\n <Menu maxHeight={maxHeight} ref={refMenu} disableScrollContainer={isMobile}>\n {renderAddButton}\n </Menu>\n );\n }\n\n if (notFoundValue) {\n return (\n <Menu maxHeight={maxHeight} ref={refMenu} disableScrollContainer={isMobile}>\n <MenuItem data-tid=\"ComboBoxMenu__notFound\" disabled isMobile={isMobile}>\n {notFoundValue}\n </MenuItem>\n </Menu>\n );\n }\n\n return null;\n }\n\n let total = null;\n const renderedItems = items && items.map(this.renderItem);\n // @ts-ignore // todo fix checking\n const countItems = renderedItems?.filter((item) => item?.type?.__KONTUR_REACT_UI__ === 'MenuItem').length;\n\n if (countItems && renderTotalCount && totalCount && countItems < totalCount) {\n total = (\n <MenuItem disabled key=\"total\" isMobile={isMobile}>\n <div style={{ fontSize: 12 }}>{renderTotalCount(countItems, totalCount)}</div>\n </MenuItem>\n );\n }\n\n return (\n <Menu data-tid=\"ComboBoxMenu__items\" ref={refMenu} maxHeight={maxHeight} disableScrollContainer={isMobile}>\n {renderedItems}\n {total}\n {renderAddButton && [<MenuSeparator key=\"separator\" />, renderAddButton]}\n </Menu>\n );\n }\n\n private renderItem = (item: T, index: number): React.ReactNode => {\n // NOTE this is undesireable feature, better\n // to remove it from further versions\n const { renderItem, onValueChange } = this.props;\n if (typeof item === 'function' || React.isValidElement(item)) {\n // @ts-ignore\n const element = typeof item === 'function' ? item() : item;\n const props = Object.assign(\n {\n key: index,\n onClick: () => onValueChange(element.props),\n },\n element.props,\n );\n return React.cloneElement(element, props);\n }\n\n return (\n <MenuItem\n data-tid=\"ComboBoxMenu__item\"\n onClick={() => onValueChange(item)}\n key={index}\n isMobile={this.props.isMobile}\n >\n {(state) => renderItem(item, state)}\n </MenuItem>\n );\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["ComboBoxMenu.tsx"],"names":["ComboBoxMenuDataTids","loading","failed","notFound","items","item","ComboBoxMenu","CustomComboBoxLocaleHelper","renderItem","index","props","onValueChange","React","isValidElement","element","Object","assign","key","onClick","cloneElement","isMobile","state","render","opened","totalCount","refMenu","renderNotFound","renderTotalCount","maxMenuHeight","requestStatus","locale","errorNetworkButton","errorNetworkMessage","renderAddButton","maxHeight","length","ComboBoxRequestStatus","Failed","maxWidth","whiteSpace","repeatRequest","notFoundValue","total","renderedItems","map","countItems","filter","type","__KONTUR_REACT_UI__","fontSize","Component","defaultProps","undefined","Unknown"],"mappings":"uRAAA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,kC;;;;;;;;;;;;;;;;;;;;AAoBO,IAAMA,oBAAoB,GAAG;AAClCC,EAAAA,OAAO,EAAE,uBADyB;AAElCC,EAAAA,MAAM,EAAE,sBAF0B;AAGlCC,EAAAA,QAAQ,EAAE,wBAHwB;AAIlCC,EAAAA,KAAK,EAAE,qBAJ2B;AAKlCC,EAAAA,IAAI,EAAE,oBAL4B,EAA7B,C;;;;AASMC,Y,WADZ,wBAAO,UAAP,EAAmBC,kCAAnB,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoHSC,IAAAA,U,GAAa,UAACH,IAAD,EAAUI,KAAV,EAA6C;AAChE;AACA;AACA,wBAAsC,MAAKC,KAA3C,CAAQF,UAAR,eAAQA,UAAR,CAAoBG,aAApB,eAAoBA,aAApB;AACA,UAAI,OAAON,IAAP,KAAgB,UAAhB,iBAA8BO,eAAMC,cAAN,CAAqBR,IAArB,CAAlC,EAA8D;AAC5D;AACA,YAAMS,OAAO,GAAG,OAAOT,IAAP,KAAgB,UAAhB,GAA6BA,IAAI,EAAjC,GAAsCA,IAAtD;AACA,YAAMK,KAAK,GAAGK,MAAM,CAACC,MAAP;AACZ;AACEC,UAAAA,GAAG,EAAER,KADP;AAEES,UAAAA,OAAO,EAAE,2BAAMP,aAAa,CAACG,OAAO,CAACJ,KAAT,CAAnB,EAFX,EADY;;AAKZI,QAAAA,OAAO,CAACJ,KALI,CAAd;;AAOA,4BAAOE,eAAMO,Y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V,E","sourcesContent":["import React, { Component } from 'react';\n\nimport { isNullable } from '../../lib/utils';\nimport { locale } from '../../lib/locale/decorators';\nimport { Menu } from '../Menu';\nimport { MenuItem, MenuItemState } from '../../components/MenuItem';\nimport { Spinner } from '../../components/Spinner';\nimport { Nullable } from '../../typings/utility-types';\nimport { MenuSeparator } from '../../components/MenuSeparator';\n\nimport { ComboBoxRequestStatus } from './CustomComboBoxTypes';\nimport { ComboBoxLocale, CustomComboBoxLocaleHelper } from './locale';\n\nexport interface ComboBoxMenuProps<T> {\n opened?: boolean;\n items?: Nullable<T[]>;\n totalCount?: number;\n loading?: boolean;\n maxMenuHeight?: number | string;\n refMenu?: (menu: Nullable<Menu>) => void;\n renderNotFound?: () => React.ReactNode;\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n renderItem: (item: T, state: MenuItemState) => React.ReactNode;\n onValueChange: (value: T) => any;\n renderAddButton?: () => React.ReactNode;\n caption?: React.ReactNode;\n repeatRequest?: () => void;\n requestStatus?: ComboBoxRequestStatus;\n isMobile?: boolean;\n}\n\nexport const ComboBoxMenuDataTids = {\n loading: 'ComboBoxMenu__loading',\n failed: 'ComboBoxMenu__failed',\n notFound: 'ComboBoxMenu__notFound',\n items: 'ComboBoxMenu__items',\n item: 'ComboBoxMenu__item',\n} as const;\n\n@locale('ComboBox', CustomComboBoxLocaleHelper)\nexport class ComboBoxMenu<T> extends Component<ComboBoxMenuProps<T>> {\n public static __KONTUR_REACT_UI__ = 'ComboBoxMenu';\n\n public static defaultProps = {\n repeatRequest: () => undefined,\n requestStatus: ComboBoxRequestStatus.Unknown,\n };\n\n private readonly locale!: ComboBoxLocale;\n\n public render() {\n const {\n opened,\n items,\n totalCount,\n loading,\n refMenu,\n renderNotFound = () => notFound,\n renderTotalCount,\n maxMenuHeight,\n requestStatus,\n isMobile,\n } = this.props;\n\n const { notFound, errorNetworkButton, errorNetworkMessage } = this.locale;\n\n if (!opened) {\n return null;\n }\n\n let renderAddButton = null;\n if (this.props.renderAddButton) {\n renderAddButton = this.props.renderAddButton();\n }\n\n const maxHeight = isMobile ? 'auto' : maxMenuHeight;\n\n if (loading && (!items || !items.length)) {\n return (\n <Menu\n maxHeight={maxHeight}\n ref={refMenu}\n disableScrollContainer={isMobile}\n data-tid={ComboBoxMenuDataTids.loading}\n >\n <MenuItem disabled isMobile={isMobile}>\n <Spinner type=\"mini\" dimmed />\n </MenuItem>\n </Menu>\n );\n }\n\n if (items === null && requestStatus === ComboBoxRequestStatus.Failed) {\n return (\n <Menu\n ref={refMenu}\n maxHeight={maxHeight}\n disableScrollContainer={isMobile}\n data-tid={ComboBoxMenuDataTids.failed}\n >\n <MenuItem disabled key=\"message\" isMobile={isMobile}>\n <div style={{ maxWidth: 300, whiteSpace: 'normal' }}>{errorNetworkMessage}</div>\n </MenuItem>\n <MenuItem link onClick={this.props.repeatRequest} key=\"retry\" isMobile={isMobile}>\n {errorNetworkButton}\n </MenuItem>\n </Menu>\n );\n }\n\n if ((isNullable(items) || items.length === 0) && renderNotFound) {\n const notFoundValue = renderNotFound();\n if (renderAddButton) {\n return (\n <Menu maxHeight={maxHeight} ref={refMenu} disableScrollContainer={isMobile}>\n {renderAddButton}\n </Menu>\n );\n }\n\n if (notFoundValue) {\n return (\n <Menu maxHeight={maxHeight} ref={refMenu} disableScrollContainer={isMobile}>\n <MenuItem data-tid={ComboBoxMenuDataTids.notFound} disabled isMobile={isMobile}>\n {notFoundValue}\n </MenuItem>\n </Menu>\n );\n }\n\n return null;\n }\n\n let total = null;\n const renderedItems = items && items.map(this.renderItem);\n // @ts-ignore // todo fix checking\n const countItems = renderedItems?.filter((item) => item?.type?.__KONTUR_REACT_UI__ === 'MenuItem').length;\n\n if (countItems && renderTotalCount && totalCount && countItems < totalCount) {\n total = (\n <MenuItem disabled key=\"total\" isMobile={isMobile}>\n <div style={{ fontSize: 12 }}>{renderTotalCount(countItems, totalCount)}</div>\n </MenuItem>\n );\n }\n\n return (\n <Menu data-tid={ComboBoxMenuDataTids.items} ref={refMenu} maxHeight={maxHeight} disableScrollContainer={isMobile}>\n {renderedItems}\n {total}\n {renderAddButton && [<MenuSeparator key=\"separator\" />, renderAddButton]}\n </Menu>\n );\n }\n\n private renderItem = (item: T, index: number): React.ReactNode => {\n // NOTE this is undesireable feature, better\n // to remove it from further versions\n const { renderItem, onValueChange } = this.props;\n if (typeof item === 'function' || React.isValidElement(item)) {\n // @ts-ignore\n const element = typeof item === 'function' ? item() : item;\n const props = Object.assign(\n {\n key: index,\n onClick: () => onValueChange(element.props),\n },\n element.props,\n );\n return React.cloneElement(element, props);\n }\n\n return (\n <MenuItem\n data-tid={ComboBoxMenuDataTids.item}\n onClick={() => onValueChange(item)}\n key={index}\n isMobile={this.props.isMobile}\n >\n {(state) => renderItem(item, state)}\n </MenuItem>\n );\n };\n}\n"]}
|
|
@@ -17,7 +17,8 @@ var _rootNode = require("../../lib/rootNode");
|
|
|
17
17
|
|
|
18
18
|
var _ComboBoxMenu = require("./ComboBoxMenu");
|
|
19
19
|
var _CustomComboBoxTypes = require("./CustomComboBoxTypes");
|
|
20
|
-
var _CustomComboBox = require("./CustomComboBox.styles");
|
|
20
|
+
var _CustomComboBox = require("./CustomComboBox.styles");
|
|
21
|
+
var _CustomComboBox2 = require("./CustomComboBox");var _class, _class2, _temp;var
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
|
|
@@ -149,6 +150,7 @@ ComboBoxView = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNode)
|
|
|
149
150
|
|
|
150
151
|
|
|
151
152
|
|
|
153
|
+
|
|
152
154
|
|
|
153
155
|
|
|
154
156
|
getComboBoxMenu = function () {
|
|
@@ -375,4 +377,4 @@ ComboBoxView = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNode)
|
|
|
375
377
|
|
|
376
378
|
refMobileInput = function (input) {
|
|
377
379
|
_this.mobileInput = input;
|
|
378
|
-
};return _this;}var _proto = ComboBoxView.prototype;_proto.componentDidMount = function componentDidMount() {var _this$dropdownContain;if (this.props.autoFocus && this.props.onFocus) {this.props.onFocus();}this.props.opened && ((_this$dropdownContain = this.dropdownContainerRef.current) == null ? void 0 : _this$dropdownContain.position());};_proto.componentDidUpdate = function componentDidUpdate(prevProps) {var input = this.input,props = this.props;if (props.editing && !prevProps.editing && input) {input.focus();}};_proto.render = function render() {var _this$props5 = this.props,onClickOutside = _this$props5.onClickOutside,onFocusOutside = _this$props5.onFocusOutside,onMouseEnter = _this$props5.onMouseEnter,onMouseLeave = _this$props5.onMouseLeave,onMouseOver = _this$props5.onMouseOver,opened = _this$props5.opened,width = _this$props5.width;var isMobile = this.isMobileLayout;var input = this.renderInput();return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, this.props, /*#__PURE__*/_react.default.createElement(_RenderLayer.RenderLayer, { onClickOutside: onClickOutside, onFocusOutside: onFocusOutside, active: opened }, /*#__PURE__*/_react.default.createElement("span", { style: { width: width }, className: _CustomComboBox.styles.root(), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseOver: onMouseOver, ref: this.setRootNode }, input, isMobile ? this.renderMobileMenu() : this.renderMenu())));};_proto.renderInput = function renderInput() {var isMobile = this.isMobileLayout;var _this$props6 = this.props,align = _this$props6.align,borderless = _this$props6.borderless,disabled = _this$props6.disabled,editing = _this$props6.editing,error = _this$props6.error,onFocus = _this$props6.onFocus,onInputBlur = _this$props6.onInputBlur,onInputValueChange = _this$props6.onInputValueChange,onInputFocus = _this$props6.onInputFocus,onInputClick = _this$props6.onInputClick,onInputKeyDown = _this$props6.onInputKeyDown,placeholder = _this$props6.placeholder,renderValue = _this$props6.renderValue,size = _this$props6.size,textValue = _this$props6.textValue,value = _this$props6.value,warning = _this$props6.warning,refInputLikeText = _this$props6.refInputLikeText,leftIcon = _this$props6.leftIcon,inputMode = _this$props6.inputMode;var rightIcon = this.getRightIcon();if (editing) {return /*#__PURE__*/_react.default.createElement(_Input.Input, { align: align, borderless: borderless, disabled: disabled, error: error, maxLength: this.props.maxLength, onBlur: isMobile ? undefined : onInputBlur, onValueChange: onInputValueChange, onFocus: isMobile ? this.handleFocusMobile : onInputFocus, onClick: isMobile ? this.handleFocusMobile : onInputClick, leftIcon: leftIcon, rightIcon: rightIcon, value: textValue || '', onKeyDown: onInputKeyDown, placeholder: placeholder, width: "100%", size: size, ref: this.refInput, warning: warning, inputMode: inputMode });}return /*#__PURE__*/_react.default.createElement(_InputLikeText.InputLikeText, { align: align, borderless: borderless, error: error, onFocus: onFocus, leftIcon: leftIcon, rightIcon: rightIcon, disabled: disabled, warning: warning, placeholder: placeholder, size: size, width: "100%", ref: refInputLikeText }, (0, _utils.isNonNullable)(value) && renderValue ? renderValue(value) : null);};return ComboBoxView;}(_react.default.Component), _class2.__KONTUR_REACT_UI__ = 'ComboBoxView', _class2.defaultProps = { renderItem: function renderItem(item) {return item;}, renderValue: function renderValue(item) {return item;}, renderAddButton: function renderAddButton() {return null;}, repeatRequest: function repeatRequest() {return undefined;}, requestStatus: _CustomComboBoxTypes.ComboBoxRequestStatus.Unknown, onClickOutside: function onClickOutside() {/**/}, onFocusOutside: function onFocusOutside() {/**/}, size: 'small', width: 250 }, _temp)) || _class) || _class;exports.ComboBoxView = ComboBoxView;
|
|
380
|
+
};return _this;}var _proto = ComboBoxView.prototype;_proto.componentDidMount = function componentDidMount() {var _this$dropdownContain;if (this.props.autoFocus && this.props.onFocus) {this.props.onFocus();}this.props.opened && ((_this$dropdownContain = this.dropdownContainerRef.current) == null ? void 0 : _this$dropdownContain.position());};_proto.componentDidUpdate = function componentDidUpdate(prevProps) {var input = this.input,props = this.props;if (props.editing && !prevProps.editing && input) {input.focus();}};_proto.render = function render() {var _this$props5 = this.props,onClickOutside = _this$props5.onClickOutside,onFocusOutside = _this$props5.onFocusOutside,onMouseEnter = _this$props5.onMouseEnter,onMouseLeave = _this$props5.onMouseLeave,onMouseOver = _this$props5.onMouseOver,opened = _this$props5.opened,width = _this$props5.width;var isMobile = this.isMobileLayout;var input = this.renderInput();return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, this.props, /*#__PURE__*/_react.default.createElement(_RenderLayer.RenderLayer, { onClickOutside: onClickOutside, onFocusOutside: onFocusOutside, active: opened }, /*#__PURE__*/_react.default.createElement("span", { "data-tid": _CustomComboBox2.CustomComboBoxDataTids.comboBoxView, style: { width: width }, className: _CustomComboBox.styles.root(), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseOver: onMouseOver, ref: this.setRootNode }, input, isMobile ? this.renderMobileMenu() : this.renderMenu())));};_proto.renderInput = function renderInput() {var isMobile = this.isMobileLayout;var _this$props6 = this.props,align = _this$props6.align,borderless = _this$props6.borderless,disabled = _this$props6.disabled,editing = _this$props6.editing,error = _this$props6.error,onFocus = _this$props6.onFocus,onInputBlur = _this$props6.onInputBlur,onInputValueChange = _this$props6.onInputValueChange,onInputFocus = _this$props6.onInputFocus,onInputClick = _this$props6.onInputClick,onInputKeyDown = _this$props6.onInputKeyDown,placeholder = _this$props6.placeholder,renderValue = _this$props6.renderValue,size = _this$props6.size,textValue = _this$props6.textValue,value = _this$props6.value,warning = _this$props6.warning,refInputLikeText = _this$props6.refInputLikeText,leftIcon = _this$props6.leftIcon,inputMode = _this$props6.inputMode;var rightIcon = this.getRightIcon();if (editing) {return /*#__PURE__*/_react.default.createElement(_Input.Input, { align: align, borderless: borderless, disabled: disabled, error: error, maxLength: this.props.maxLength, onBlur: isMobile ? undefined : onInputBlur, onValueChange: onInputValueChange, onFocus: isMobile ? this.handleFocusMobile : onInputFocus, onClick: isMobile ? this.handleFocusMobile : onInputClick, leftIcon: leftIcon, rightIcon: rightIcon, value: textValue || '', onKeyDown: onInputKeyDown, placeholder: placeholder, width: "100%", size: size, ref: this.refInput, warning: warning, inputMode: inputMode });}return /*#__PURE__*/_react.default.createElement(_InputLikeText.InputLikeText, { align: align, borderless: borderless, error: error, onFocus: onFocus, leftIcon: leftIcon, rightIcon: rightIcon, disabled: disabled, warning: warning, placeholder: placeholder, size: size, width: "100%", ref: refInputLikeText }, (0, _utils.isNonNullable)(value) && renderValue ? renderValue(value) : null);};return ComboBoxView;}(_react.default.Component), _class2.__KONTUR_REACT_UI__ = 'ComboBoxView', _class2.defaultProps = { renderItem: function renderItem(item) {return item;}, renderValue: function renderValue(item) {return item;}, renderAddButton: function renderAddButton() {return null;}, repeatRequest: function repeatRequest() {return undefined;}, requestStatus: _CustomComboBoxTypes.ComboBoxRequestStatus.Unknown, onClickOutside: function onClickOutside() {/**/}, onFocusOutside: function onFocusOutside() {/**/}, size: 'small', width: 250 }, _temp)) || _class) || _class;exports.ComboBoxView = ComboBoxView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ComboBoxView.tsx"],"names":["ComboBoxView","responsiveLayout","rootNode","mobileInput","dropdownContainerRef","React","createRef","state","isMobileOpened","getComboBoxMenu","props","items","loading","opened","refMenu","maxMenuHeight","renderTotalCount","renderItem","renderNotFound","repeatRequest","requestStatus","totalCount","handleItemSelect","renderAddButton","isMobileLayout","renderMenu","menuAlign","getParent","disablePortal","renderMobileMenu","rightIcon","length","renderSpinner","inputProps","autoFocus","width","onFocus","onValueChange","onInputValueChange","value","textValue","placeholder","refMobileInput","handleCloseMobile","setState","onInputBlur","handleFocusMobile","focus","item","refInput","input","styles","spinnerWrapper","getRightIcon","drawArrow","rightIconWrapper","componentDidMount","current","position","componentDidUpdate","prevProps","editing","render","onClickOutside","onFocusOutside","onMouseEnter","onMouseLeave","onMouseOver","isMobile","renderInput","root","setRootNode","align","borderless","disabled","error","onInputFocus","onInputClick","onInputKeyDown","renderValue","size","warning","refInputLikeText","leftIcon","inputMode","maxLength","undefined","Component","__KONTUR_REACT_UI__","defaultProps","ComboBoxRequestStatus","Unknown"],"mappings":"wbAAA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAc3C,KAAd,KAAwBwC,WAAxB,GAAsCA,WAAW,CAACxC,KAAD,CAAjD,GAA2D,IAd9D,CADF,CAkBD,C,uBAnPkClC,eAAMkF,S,WAC3BC,mB,GAAsB,c,UAEtBC,Y,GAAe,EAC3BxE,UAAU,EAAE,oBAAC+B,IAAD,UAAeA,IAAf,EADe,EAE3B+B,WAAW,EAAE,qBAAC/B,IAAD,UAAeA,IAAf,EAFc,EAG3BzB,eAAe,EAAE,mCAAM,IAAN,EAHU,EAI3BJ,aAAa,EAAE,iCAAMmE,SAAN,EAJY,EAK3BlE,aAAa,EAAEsE,2CAAsBC,OALV,EAM3B5B,cAAc,EAAE,0BAAM,CACpB,IACD,CAR0B,EAS3BC,cAAc,EAAE,0BAAM,CACpB,IACD,CAX0B,EAY3BgB,IAAI,EAAE,OAZqB,EAa3B7C,KAAK,EAAE,GAboB,E","sourcesContent":["import React from 'react';\n\nimport { isNonNullable } from '../../lib/utils';\nimport { DropdownContainer } from '../DropdownContainer';\nimport { Input, InputIconType, InputProps } from '../../components/Input';\nimport { InputLikeText } from '../InputLikeText';\nimport { Menu } from '../Menu';\nimport { MenuItemState } from '../../components/MenuItem';\nimport { RenderLayer } from '../RenderLayer';\nimport { Spinner } from '../../components/Spinner';\nimport { Nullable } from '../../typings/utility-types';\nimport { ArrowChevronDownIcon } from '../icons/16px';\nimport { CommonProps, CommonWrapper } from '../../internal/CommonWrapper';\nimport { MobilePopup } from '../MobilePopup';\nimport { responsiveLayout } from '../../components/ResponsiveLayout/decorator';\nimport { rootNode, getRootNode, TSetRootNode } from '../../lib/rootNode';\n\nimport { ComboBoxMenu } from './ComboBoxMenu';\nimport { ComboBoxRequestStatus } from './CustomComboBoxTypes';\nimport { styles } from './CustomComboBox.styles';\n\ninterface ComboBoxViewProps<T> extends CommonProps {\n align?: 'left' | 'center' | 'right';\n autoFocus?: boolean;\n borderless?: boolean;\n disablePortal?: boolean;\n disabled?: boolean;\n editing?: boolean;\n /**\n * Cостояние валидации при ошибке.\n */\n error?: boolean;\n items?: Nullable<T[]>;\n loading?: boolean;\n menuAlign?: 'left' | 'right';\n opened?: boolean;\n drawArrow?: boolean;\n placeholder?: string;\n size?: 'small' | 'medium' | 'large';\n textValue?: string;\n totalCount?: number;\n value?: Nullable<T>;\n /**\n * Cостояние валидации при предупреждении.\n */\n warning?: boolean;\n width?: string | number;\n maxLength?: number;\n maxMenuHeight?: number | string;\n leftIcon?: InputIconType;\n rightIcon?: InputIconType;\n inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];\n\n onValueChange?: (value: T) => void;\n onClickOutside?: (e: Event) => void;\n onFocus?: () => void;\n onFocusOutside?: () => void;\n onInputBlur?: () => void;\n onInputValueChange?: (value: string) => void;\n onInputFocus?: () => void;\n onInputClick?: () => void;\n onInputKeyDown?: (e: React.KeyboardEvent) => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseOver?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n renderItem?: (item: T, state: MenuItemState) => React.ReactNode;\n renderNotFound?: () => React.ReactNode;\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n renderValue?: (item: T) => React.ReactNode;\n renderAddButton: (query?: string) => React.ReactNode;\n repeatRequest?: () => void;\n requestStatus?: ComboBoxRequestStatus;\n refInput?: (input: Nullable<Input>) => void;\n refMenu?: (menu: Nullable<Menu>) => void;\n refInputLikeText?: (inputLikeText: Nullable<InputLikeText>) => void;\n}\n\ninterface ComboBoxViewState {\n isMobileOpened: boolean;\n}\n\n@responsiveLayout\n@rootNode\nexport class ComboBoxView<T> extends React.Component<ComboBoxViewProps<T>, ComboBoxViewState> {\n public static __KONTUR_REACT_UI__ = 'ComboBoxView';\n\n public static defaultProps = {\n renderItem: (item: any) => item,\n renderValue: (item: any) => item,\n renderAddButton: () => null,\n repeatRequest: () => undefined,\n requestStatus: ComboBoxRequestStatus.Unknown,\n onClickOutside: () => {\n /**/\n },\n onFocusOutside: () => {\n /**/\n },\n size: 'small',\n width: 250,\n };\n\n private input: Nullable<Input>;\n private setRootNode!: TSetRootNode;\n private mobileInput: Nullable<Input> = null;\n private isMobileLayout!: boolean;\n private dropdownContainerRef = React.createRef<DropdownContainer>();\n\n public componentDidMount() {\n if (this.props.autoFocus && this.props.onFocus) {\n this.props.onFocus();\n }\n this.props.opened && this.dropdownContainerRef.current?.position();\n }\n\n public state: ComboBoxViewState = {\n isMobileOpened: false,\n };\n\n public componentDidUpdate(prevProps: ComboBoxViewProps<T>) {\n const { input, props } = this;\n\n if (props.editing && !prevProps.editing && input) {\n input.focus();\n }\n }\n\n public render() {\n const { onClickOutside, onFocusOutside, onMouseEnter, onMouseLeave, onMouseOver, opened, width } = this.props;\n\n const isMobile = this.isMobileLayout;\n\n const input = this.renderInput();\n\n return (\n <CommonWrapper {...this.props}>\n <RenderLayer onClickOutside={onClickOutside} onFocusOutside={onFocusOutside} active={opened}>\n <span\n style={{ width }}\n className={styles.root()}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onMouseOver={onMouseOver}\n ref={this.setRootNode}\n >\n {input}\n {isMobile ? this.renderMobileMenu() : this.renderMenu()}\n </span>\n </RenderLayer>\n </CommonWrapper>\n );\n }\n\n private getComboBoxMenu = () => {\n const {\n items,\n loading,\n opened,\n refMenu,\n maxMenuHeight,\n renderTotalCount,\n renderItem,\n renderNotFound,\n repeatRequest,\n requestStatus,\n totalCount,\n } = this.props;\n\n return (\n <ComboBoxMenu\n items={items}\n loading={loading}\n maxMenuHeight={maxMenuHeight}\n onValueChange={this.handleItemSelect}\n opened={opened}\n refMenu={refMenu}\n renderTotalCount={renderTotalCount}\n renderItem={renderItem!}\n renderNotFound={renderNotFound}\n renderAddButton={this.renderAddButton}\n repeatRequest={repeatRequest}\n requestStatus={requestStatus}\n totalCount={totalCount}\n isMobile={this.isMobileLayout}\n />\n );\n };\n\n private renderMenu = () => {\n const { menuAlign, opened } = this.props;\n\n return (\n opened && (\n <DropdownContainer\n align={menuAlign}\n getParent={this.getParent}\n offsetY={1}\n disablePortal={this.props.disablePortal}\n ref={this.dropdownContainerRef}\n >\n {this.getComboBoxMenu()}\n </DropdownContainer>\n )\n );\n };\n\n private renderMobileMenu = () => {\n let rightIcon = null;\n\n const { loading, items } = this.props;\n if (loading && items && !!items.length) {\n rightIcon = this.renderSpinner();\n }\n\n const inputProps: InputProps = {\n autoFocus: true,\n width: '100%',\n onFocus: this.props.onFocus,\n onValueChange: this.props.onInputValueChange,\n value: this.props.textValue,\n placeholder: this.props.placeholder,\n rightIcon,\n };\n\n return (\n <MobilePopup\n headerChildComponent={<Input ref={this.refMobileInput} {...inputProps} />}\n useFullHeight\n onCloseRequest={this.handleCloseMobile}\n opened={this.state.isMobileOpened}\n >\n {this.getComboBoxMenu()}\n </MobilePopup>\n );\n };\n\n private handleCloseMobile = () => {\n this.setState({\n isMobileOpened: false,\n });\n\n if (this.props.onInputBlur) {\n this.props.onInputBlur();\n }\n };\n\n private getParent = () => {\n return getRootNode(this);\n };\n\n private renderAddButton = (): React.ReactNode => {\n return this.props.renderAddButton(this.props.textValue);\n };\n\n private renderInput(): React.ReactNode {\n const isMobile = this.isMobileLayout;\n\n const {\n align,\n borderless,\n disabled,\n editing,\n error,\n onFocus,\n onInputBlur,\n onInputValueChange,\n onInputFocus,\n onInputClick,\n onInputKeyDown,\n placeholder,\n renderValue,\n size,\n textValue,\n value,\n warning,\n refInputLikeText,\n leftIcon,\n inputMode,\n } = this.props;\n\n const rightIcon = this.getRightIcon();\n\n if (editing) {\n return (\n <Input\n align={align}\n borderless={borderless}\n disabled={disabled}\n error={error}\n maxLength={this.props.maxLength}\n onBlur={isMobile ? undefined : onInputBlur}\n onValueChange={onInputValueChange}\n onFocus={isMobile ? this.handleFocusMobile : onInputFocus}\n onClick={isMobile ? this.handleFocusMobile : onInputClick}\n leftIcon={leftIcon}\n rightIcon={rightIcon}\n value={textValue || ''}\n onKeyDown={onInputKeyDown}\n placeholder={placeholder}\n width=\"100%\"\n size={size}\n ref={this.refInput}\n warning={warning}\n inputMode={inputMode}\n />\n );\n }\n\n return (\n <InputLikeText\n align={align}\n borderless={borderless}\n error={error}\n onFocus={onFocus}\n leftIcon={leftIcon}\n rightIcon={rightIcon}\n disabled={disabled}\n warning={warning}\n placeholder={placeholder}\n size={size}\n width=\"100%\"\n ref={refInputLikeText}\n >\n {isNonNullable(value) && renderValue ? renderValue(value) : null}\n </InputLikeText>\n );\n }\n\n private handleFocusMobile = () => {\n this.setState({\n isMobileOpened: true,\n });\n\n if (this.mobileInput) {\n this.mobileInput.focus();\n }\n };\n\n private handleItemSelect = (item: T) => {\n if (this.props.onValueChange) {\n this.props.onValueChange(item);\n }\n\n if (this.isMobileLayout) {\n this.handleCloseMobile();\n }\n };\n\n private refInput = (input: Nullable<Input>) => {\n if (this.props.refInput) {\n this.props.refInput(input);\n }\n this.input = input;\n };\n\n private renderSpinner = () => (\n <span className={styles.spinnerWrapper()}>\n <Spinner type=\"mini\" caption=\"\" dimmed />\n </span>\n );\n\n private getRightIcon = () => {\n const { loading, items, drawArrow, rightIcon } = this.props;\n\n if (loading && items && !!items.length) {\n return this.renderSpinner();\n }\n\n if (rightIcon || drawArrow) {\n return <span className={styles.rightIconWrapper()}>{rightIcon ?? <ArrowChevronDownIcon />}</span>;\n }\n\n return null;\n };\n\n private refMobileInput = (input: Nullable<Input>) => {\n this.mobileInput = input;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["ComboBoxView.tsx"],"names":["ComboBoxView","responsiveLayout","rootNode","mobileInput","dropdownContainerRef","React","createRef","state","isMobileOpened","getComboBoxMenu","props","items","loading","opened","refMenu","maxMenuHeight","renderTotalCount","renderItem","renderNotFound","repeatRequest","requestStatus","totalCount","handleItemSelect","renderAddButton","isMobileLayout","renderMenu","menuAlign","getParent","disablePortal","renderMobileMenu","rightIcon","length","renderSpinner","inputProps","autoFocus","width","onFocus","onValueChange","onInputValueChange","value","textValue","placeholder","refMobileInput","handleCloseMobile","setState","onInputBlur","handleFocusMobile","focus","item","refInput","input","styles","spinnerWrapper","getRightIcon","drawArrow","rightIconWrapper","componentDidMount","current","position","componentDidUpdate","prevProps","editing","render","onClickOutside","onFocusOutside","onMouseEnter","onMouseLeave","onMouseOver","isMobile","renderInput","CustomComboBoxDataTids","comboBoxView","root","setRootNode","align","borderless","disabled","error","onInputFocus","onInputClick","onInputKeyDown","renderValue","size","warning","refInputLikeText","leftIcon","inputMode","maxLength","undefined","Component","__KONTUR_REACT_UI__","defaultProps","ComboBoxRequestStatus","Unknown"],"mappings":"wbAAA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEaA,Y,OAFZC,2B,eACAC,kB;;;;;;;;;;;;;;;;;;;;;AAsBSC,IAAAA,W,GAA+B,I;;AAE/BC,IAAAA,oB,gBAAuBC,eAAMC,SAAN,E;;;;;;;;;AASxBC,IAAAA,K,GAA2B;AAChCC,MAAAA,cAAc,EAAE,KADgB,E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuC1BC,IAAAA,e,GAAkB,YAAM;AAC9B;;;;;;;;;;;;AAYI,YAAKC,KAZT,CACEC,KADF,eACEA,KADF,CAEEC,OAFF,eAEEA,OAFF,CAGEC,MAHF,eAGEA,MAHF,CAIEC,OAJF,eAIEA,OAJF,CAKEC,aALF,eAKEA,aALF,CAMEC,gBANF,eAMEA,gBANF,CAOEC,UAPF,eAOEA,UAPF,CAQEC,cARF,eAQEA,cARF,CASEC,aATF,eASEA,aATF,CAUEC,aAVF,eAUEA,aAVF,CAWEC,UAXF,eAWEA,UAXF;;AAcA;AACE,qCAAC,0BAAD;AACE,UAAA,KAAK,EAAEV,KADT;AAEE,UAAA,OAAO,EAAEC,OAFX;AAGE,UAAA,aAAa,EAAEG,aAHjB;AAIE,U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AEwC,cAbb,EAcE,WAAW,EAAEvC,WAdf,EAeE,KAAK,EAAC,MAfR,EAgBE,IAAI,EAAEyC,IAhBR,EAiBE,GAAG,EAAE,KAAKjC,QAjBZ,EAkBE,OAAO,EAAEkC,OAlBX,EAmBE,SAAS,EAAEG,SAnBb,GADF,CAuBD,CAED,oBACE,6BAAC,4BAAD,IACE,KAAK,EAAEZ,KADT,EAEE,UAAU,EAAEC,UAFd,EAGE,KAAK,EAAEE,KAHT,EAIE,OAAO,EAAEzC,OAJX,EAKE,QAAQ,EAAEiD,QALZ,EAME,SAAS,EAAEvD,SANb,EAOE,QAAQ,EAAE8C,QAPZ,EAQE,OAAO,EAAEO,OARX,EASE,WAAW,EAAE1C,WATf,EAUE,IAAI,EAAEyC,IAVR,EAWE,KAAK,EAAC,MAXR,EAYE,GAAG,EAAEE,gBAZP,IAcG,0BAAc7C,KAAd,KAAwB0C,WAAxB,GAAsCA,WAAW,CAAC1C,KAAD,CAAjD,GAA2D,IAd9D,CADF,CAkBD,C,uBApPkClC,eAAMoF,S,WAC3BC,mB,GAAsB,c,UAEtBC,Y,GAAe,EAC3B1E,UAAU,EAAE,oBAAC+B,IAAD,UAAeA,IAAf,EADe,EAE3BiC,WAAW,EAAE,qBAACjC,IAAD,UAAeA,IAAf,EAFc,EAG3BzB,eAAe,EAAE,mCAAM,IAAN,EAHU,EAI3BJ,aAAa,EAAE,iCAAMqE,SAAN,EAJY,EAK3BpE,aAAa,EAAEwE,2CAAsBC,OALV,EAM3B9B,cAAc,EAAE,0BAAM,CACpB,IACD,CAR0B,EAS3BC,cAAc,EAAE,0BAAM,CACpB,IACD,CAX0B,EAY3BkB,IAAI,EAAE,OAZqB,EAa3B/C,KAAK,EAAE,GAboB,E","sourcesContent":["import React from 'react';\n\nimport { isNonNullable } from '../../lib/utils';\nimport { DropdownContainer } from '../DropdownContainer';\nimport { Input, InputIconType, InputProps } from '../../components/Input';\nimport { InputLikeText } from '../InputLikeText';\nimport { Menu } from '../Menu';\nimport { MenuItemState } from '../../components/MenuItem';\nimport { RenderLayer } from '../RenderLayer';\nimport { Spinner } from '../../components/Spinner';\nimport { Nullable } from '../../typings/utility-types';\nimport { ArrowChevronDownIcon } from '../icons/16px';\nimport { CommonProps, CommonWrapper } from '../../internal/CommonWrapper';\nimport { MobilePopup } from '../MobilePopup';\nimport { responsiveLayout } from '../../components/ResponsiveLayout/decorator';\nimport { rootNode, getRootNode, TSetRootNode } from '../../lib/rootNode';\n\nimport { ComboBoxMenu } from './ComboBoxMenu';\nimport { ComboBoxRequestStatus } from './CustomComboBoxTypes';\nimport { styles } from './CustomComboBox.styles';\nimport { CustomComboBoxDataTids } from './CustomComboBox';\n\ninterface ComboBoxViewProps<T> extends CommonProps {\n align?: 'left' | 'center' | 'right';\n autoFocus?: boolean;\n borderless?: boolean;\n disablePortal?: boolean;\n disabled?: boolean;\n editing?: boolean;\n /**\n * Cостояние валидации при ошибке.\n */\n error?: boolean;\n items?: Nullable<T[]>;\n loading?: boolean;\n menuAlign?: 'left' | 'right';\n opened?: boolean;\n drawArrow?: boolean;\n placeholder?: string;\n size?: 'small' | 'medium' | 'large';\n textValue?: string;\n totalCount?: number;\n value?: Nullable<T>;\n /**\n * Cостояние валидации при предупреждении.\n */\n warning?: boolean;\n width?: string | number;\n maxLength?: number;\n maxMenuHeight?: number | string;\n leftIcon?: InputIconType;\n rightIcon?: InputIconType;\n inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];\n\n onValueChange?: (value: T) => void;\n onClickOutside?: (e: Event) => void;\n onFocus?: () => void;\n onFocusOutside?: () => void;\n onInputBlur?: () => void;\n onInputValueChange?: (value: string) => void;\n onInputFocus?: () => void;\n onInputClick?: () => void;\n onInputKeyDown?: (e: React.KeyboardEvent) => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseOver?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n renderItem?: (item: T, state: MenuItemState) => React.ReactNode;\n renderNotFound?: () => React.ReactNode;\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n renderValue?: (item: T) => React.ReactNode;\n renderAddButton: (query?: string) => React.ReactNode;\n repeatRequest?: () => void;\n requestStatus?: ComboBoxRequestStatus;\n refInput?: (input: Nullable<Input>) => void;\n refMenu?: (menu: Nullable<Menu>) => void;\n refInputLikeText?: (inputLikeText: Nullable<InputLikeText>) => void;\n}\n\ninterface ComboBoxViewState {\n isMobileOpened: boolean;\n}\n\n@responsiveLayout\n@rootNode\nexport class ComboBoxView<T> extends React.Component<ComboBoxViewProps<T>, ComboBoxViewState> {\n public static __KONTUR_REACT_UI__ = 'ComboBoxView';\n\n public static defaultProps = {\n renderItem: (item: any) => item,\n renderValue: (item: any) => item,\n renderAddButton: () => null,\n repeatRequest: () => undefined,\n requestStatus: ComboBoxRequestStatus.Unknown,\n onClickOutside: () => {\n /**/\n },\n onFocusOutside: () => {\n /**/\n },\n size: 'small',\n width: 250,\n };\n\n private input: Nullable<Input>;\n private setRootNode!: TSetRootNode;\n private mobileInput: Nullable<Input> = null;\n private isMobileLayout!: boolean;\n private dropdownContainerRef = React.createRef<DropdownContainer>();\n\n public componentDidMount() {\n if (this.props.autoFocus && this.props.onFocus) {\n this.props.onFocus();\n }\n this.props.opened && this.dropdownContainerRef.current?.position();\n }\n\n public state: ComboBoxViewState = {\n isMobileOpened: false,\n };\n\n public componentDidUpdate(prevProps: ComboBoxViewProps<T>) {\n const { input, props } = this;\n\n if (props.editing && !prevProps.editing && input) {\n input.focus();\n }\n }\n\n public render() {\n const { onClickOutside, onFocusOutside, onMouseEnter, onMouseLeave, onMouseOver, opened, width } = this.props;\n\n const isMobile = this.isMobileLayout;\n\n const input = this.renderInput();\n\n return (\n <CommonWrapper {...this.props}>\n <RenderLayer onClickOutside={onClickOutside} onFocusOutside={onFocusOutside} active={opened}>\n <span\n data-tid={CustomComboBoxDataTids.comboBoxView}\n style={{ width }}\n className={styles.root()}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onMouseOver={onMouseOver}\n ref={this.setRootNode}\n >\n {input}\n {isMobile ? this.renderMobileMenu() : this.renderMenu()}\n </span>\n </RenderLayer>\n </CommonWrapper>\n );\n }\n\n private getComboBoxMenu = () => {\n const {\n items,\n loading,\n opened,\n refMenu,\n maxMenuHeight,\n renderTotalCount,\n renderItem,\n renderNotFound,\n repeatRequest,\n requestStatus,\n totalCount,\n } = this.props;\n\n return (\n <ComboBoxMenu\n items={items}\n loading={loading}\n maxMenuHeight={maxMenuHeight}\n onValueChange={this.handleItemSelect}\n opened={opened}\n refMenu={refMenu}\n renderTotalCount={renderTotalCount}\n renderItem={renderItem!}\n renderNotFound={renderNotFound}\n renderAddButton={this.renderAddButton}\n repeatRequest={repeatRequest}\n requestStatus={requestStatus}\n totalCount={totalCount}\n isMobile={this.isMobileLayout}\n />\n );\n };\n\n private renderMenu = () => {\n const { menuAlign, opened } = this.props;\n\n return (\n opened && (\n <DropdownContainer\n align={menuAlign}\n getParent={this.getParent}\n offsetY={1}\n disablePortal={this.props.disablePortal}\n ref={this.dropdownContainerRef}\n >\n {this.getComboBoxMenu()}\n </DropdownContainer>\n )\n );\n };\n\n private renderMobileMenu = () => {\n let rightIcon = null;\n\n const { loading, items } = this.props;\n if (loading && items && !!items.length) {\n rightIcon = this.renderSpinner();\n }\n\n const inputProps: InputProps = {\n autoFocus: true,\n width: '100%',\n onFocus: this.props.onFocus,\n onValueChange: this.props.onInputValueChange,\n value: this.props.textValue,\n placeholder: this.props.placeholder,\n rightIcon,\n };\n\n return (\n <MobilePopup\n headerChildComponent={<Input ref={this.refMobileInput} {...inputProps} />}\n useFullHeight\n onCloseRequest={this.handleCloseMobile}\n opened={this.state.isMobileOpened}\n >\n {this.getComboBoxMenu()}\n </MobilePopup>\n );\n };\n\n private handleCloseMobile = () => {\n this.setState({\n isMobileOpened: false,\n });\n\n if (this.props.onInputBlur) {\n this.props.onInputBlur();\n }\n };\n\n private getParent = () => {\n return getRootNode(this);\n };\n\n private renderAddButton = (): React.ReactNode => {\n return this.props.renderAddButton(this.props.textValue);\n };\n\n private renderInput(): React.ReactNode {\n const isMobile = this.isMobileLayout;\n\n const {\n align,\n borderless,\n disabled,\n editing,\n error,\n onFocus,\n onInputBlur,\n onInputValueChange,\n onInputFocus,\n onInputClick,\n onInputKeyDown,\n placeholder,\n renderValue,\n size,\n textValue,\n value,\n warning,\n refInputLikeText,\n leftIcon,\n inputMode,\n } = this.props;\n\n const rightIcon = this.getRightIcon();\n\n if (editing) {\n return (\n <Input\n align={align}\n borderless={borderless}\n disabled={disabled}\n error={error}\n maxLength={this.props.maxLength}\n onBlur={isMobile ? undefined : onInputBlur}\n onValueChange={onInputValueChange}\n onFocus={isMobile ? this.handleFocusMobile : onInputFocus}\n onClick={isMobile ? this.handleFocusMobile : onInputClick}\n leftIcon={leftIcon}\n rightIcon={rightIcon}\n value={textValue || ''}\n onKeyDown={onInputKeyDown}\n placeholder={placeholder}\n width=\"100%\"\n size={size}\n ref={this.refInput}\n warning={warning}\n inputMode={inputMode}\n />\n );\n }\n\n return (\n <InputLikeText\n align={align}\n borderless={borderless}\n error={error}\n onFocus={onFocus}\n leftIcon={leftIcon}\n rightIcon={rightIcon}\n disabled={disabled}\n warning={warning}\n placeholder={placeholder}\n size={size}\n width=\"100%\"\n ref={refInputLikeText}\n >\n {isNonNullable(value) && renderValue ? renderValue(value) : null}\n </InputLikeText>\n );\n }\n\n private handleFocusMobile = () => {\n this.setState({\n isMobileOpened: true,\n });\n\n if (this.mobileInput) {\n this.mobileInput.focus();\n }\n };\n\n private handleItemSelect = (item: T) => {\n if (this.props.onValueChange) {\n this.props.onValueChange(item);\n }\n\n if (this.isMobileLayout) {\n this.handleCloseMobile();\n }\n };\n\n private refInput = (input: Nullable<Input>) => {\n if (this.props.refInput) {\n this.props.refInput(input);\n }\n this.input = input;\n };\n\n private renderSpinner = () => (\n <span className={styles.spinnerWrapper()}>\n <Spinner type=\"mini\" caption=\"\" dimmed />\n </span>\n );\n\n private getRightIcon = () => {\n const { loading, items, drawArrow, rightIcon } = this.props;\n\n if (loading && items && !!items.length) {\n return this.renderSpinner();\n }\n\n if (rightIcon || drawArrow) {\n return <span className={styles.rightIconWrapper()}>{rightIcon ?? <ArrowChevronDownIcon />}</span>;\n }\n\n return null;\n };\n\n private refMobileInput = (input: Nullable<Input>) => {\n this.mobileInput = input;\n };\n}\n"]}
|
|
@@ -75,6 +75,9 @@ export declare const DefaultState: {
|
|
|
75
75
|
repeatRequest: () => undefined;
|
|
76
76
|
requestStatus: ComboBoxRequestStatus;
|
|
77
77
|
};
|
|
78
|
+
export declare const CustomComboBoxDataTids: {
|
|
79
|
+
readonly comboBoxView: "ComboBoxView__root";
|
|
80
|
+
};
|
|
78
81
|
export declare class CustomComboBox<T> extends React.PureComponent<CustomComboBoxProps<T>, CustomComboBoxState<T>> {
|
|
79
82
|
static __KONTUR_REACT_UI__: string;
|
|
80
83
|
state: CustomComboBoxState<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.LOADER_SHOW_TIME = exports.DefaultState = exports.DELAY_BEFORE_SHOW_LOADER = exports.CustomComboBox = void 0;var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _react = _interopRequireDefault(require("react"));
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.LOADER_SHOW_TIME = exports.DefaultState = exports.DELAY_BEFORE_SHOW_LOADER = exports.CustomComboBoxDataTids = exports.CustomComboBox = void 0;var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _react = _interopRequireDefault(require("react"));
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -85,7 +85,11 @@ var DefaultState = {
|
|
|
85
85
|
focused: false,
|
|
86
86
|
textValue: '',
|
|
87
87
|
repeatRequest: function repeatRequest() {return undefined;},
|
|
88
|
-
requestStatus: _CustomComboBoxTypes.ComboBoxRequestStatus.Unknown };exports.DefaultState = DefaultState;
|
|
88
|
+
requestStatus: _CustomComboBoxTypes.ComboBoxRequestStatus.Unknown };exports.DefaultState = DefaultState;
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
var CustomComboBoxDataTids = {
|
|
92
|
+
comboBoxView: 'ComboBoxView__root' };exports.CustomComboBoxDataTids = CustomComboBoxDataTids;var
|
|
89
93
|
|
|
90
94
|
|
|
91
95
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CustomComboBox.tsx"],"names":["DELAY_BEFORE_SHOW_LOADER","LOADER_SHOW_TIME","DefaultState","inputChanged","editing","items","loading","opened","focused","textValue","repeatRequest","undefined","requestStatus","ComboBoxRequestStatus","Unknown","CustomComboBox","responsiveLayout","rootNode","state","requestId","cancelationToken","reducer","cancelLoaderDelay","focus","props","disabled","input","inputLikeText","selectInputText","selectAll","blur","handleBlur","dispatch","action","effects","nextState","setState","stateAndEffect","Array","forEach","handleEffect","effect","getState","getProps","handleValueChange","value","type","keepFocus","isMobileLayout","handleFocus","handleClickOutside","e","close","setTimeout","handleInputBlur","handleInputClick","search","query","getItems","cancelPromise","Promise","_","reject","expectingId","loaderShowDelay","resolve","cancelLoader","catch","race","code","cancelSearch","CancelationError","open","render","viewProps","align","borderless","disablePortal","error","menuAlign","drawArrow","placeholder","size","totalCount","warning","width","maxLength","maxMenuHeight","leftIcon","rightIcon","inputMode","onValueChange","onClickOutside","onFocus","onFocusOutside","onInputBlur","onInputValueChange","onInputFocus","onInputClick","onInputKeyDown","event","persist","onMouseEnter","onMouseOver","onMouseLeave","renderItem","renderNotFound","renderValue","renderTotalCount","renderAddButton","refInput","refMenu","menu","refInputLikeText","setRootNode","componentDidMount","autoFocus","componentDidUpdate","prevProps","prevState","reset","React","PureComponent","__KONTUR_REACT_UI__"],"mappings":"osBAAA;;;;;;;AAOA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DO,IAAMA,wBAAwB,GAAG,GAAjC,C;AACA,IAAMC,gBAAgB,GAAG,IAAzB,C;;AAEA,IAAMC,YAAY,GAAG;AAC1BC,EAAAA,YAAY,EAAE,KADY;AAE1BC,EAAAA,OAAO,EAAE,KAFiB;AAG1BC,EAAAA,KAAK,EAAE,IAHmB;AAI1BC,EAAAA,OAAO,EAAE,KAJiB;AAK1BC,EAAAA,MAAM,EAAE,KALkB;AAM1BC,EAAAA,OAAO,EAAE,KANiB;AAO1BC,EAAAA,SAAS,EAAE,EAPe;AAQ1BC,EAAAA,aAAa,EAAE,iCAAMC,SAAN,EARW;AAS1BC,EAAAA,aAAa,EAAEC,2CAAsBC,OATX,EAArB,C;;;;;AAcMC,c,OAFZC,2B,eACAC,kB;;;AAIQC,IAAAA,K,GAAgChB,Y;;;;AAIhCiB,IAAAA,S,GAAY,C;;AAEXX,IAAAA,O,GAAU,K;AACVY,IAAAA,gB,GAAuD,I;;;AAGvDC,IAAAA,O,GAAUA,8B;AACXC,IAAAA,iB,GAAgC,oBAAM,IAAN,E;;;;;AAKhCC,IAAAA,K,GAAQ,YAAM;AACnB,UAAI,MAAKC,KAAL,CAAWC,QAAf,EAAyB;A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EAAEc,IAAI,EAAE,OAAR,EAAd,EACA,IAAI,KAAKtB,KAAL,CAAW4F,SAAf,EAA0B,CACxB,KAAK7F,KAAL,GACD,CACF,C,QAEM8F,kB,GAAP,4BAA0BC,SAA1B,EAA6DC,SAA7D,EAAgG,CAC9F,IAAIA,SAAS,CAACnH,OAAV,IAAqB,CAAC,KAAKc,KAAL,CAAWd,OAArC,EAA8C,CAC5C,KAAK2B,UAAL,GACD,CACD,KAAKC,QAAL,CAAc,EAAEc,IAAI,EAAE,WAAR,EAAqBwE,SAAS,EAATA,SAArB,EAAgCC,SAAS,EAATA,SAAhC,EAAd,EACD,C,CAED;AACF;AACA,K,QACSC,K,GAAP,iBAAe,CACb,KAAKxF,QAAL,CAAc,EAAEc,IAAI,EAAE,OAAR,EAAd,EACD,C,yBAlOoC2E,eAAMC,a,WAC7BC,mB,GAAsB,gB","sourcesContent":["import React from 'react';\n\nimport { Nullable } from '../../typings/utility-types';\nimport { Input, InputIconType } from '../../components/Input';\nimport { Menu } from '../Menu';\nimport { InputLikeText } from '../InputLikeText';\nimport { MenuItemState } from '../../components/MenuItem';\nimport { CancelationError, taskWithDelay } from '../../lib/utils';\nimport { fixClickFocusIE } from '../../lib/events/fixClickFocusIE';\nimport { CommonProps, CommonWrapper } from '../../internal/CommonWrapper';\nimport { responsiveLayout } from '../../components/ResponsiveLayout/decorator';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\n\nimport { ComboBoxRequestStatus } from './CustomComboBoxTypes';\nimport { CustomComboBoxAction, CustomComboBoxEffect, reducer } from './CustomComboBoxReducer';\nimport { ComboBoxView } from './ComboBoxView';\n\nexport interface CustomComboBoxProps<T> extends CommonProps {\n align?: 'left' | 'center' | 'right';\n autoFocus?: boolean;\n borderless?: boolean;\n disablePortal?: boolean;\n disabled?: boolean;\n /**\n * Cостояние валидации при ошибке.\n */\n error?: boolean;\n maxLength?: number;\n menuAlign?: 'left' | 'right';\n drawArrow?: boolean;\n leftIcon?: InputIconType;\n rightIcon?: InputIconType;\n searchOnFocus?: boolean;\n onValueChange?: (value: T) => void;\n onInputValueChange?: (value: string) => Nullable<string> | void;\n onUnexpectedInput?: (value: string) => void | null | T;\n onFocus?: () => void;\n onBlur?: () => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseOver?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n onInputKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => void;\n placeholder?: string;\n size?: 'small' | 'medium' | 'large';\n totalCount?: number;\n value?: Nullable<T>;\n /**\n * Cостояние валидации при предупреждении.\n */\n warning?: boolean;\n width?: string | number;\n maxMenuHeight?: number | string;\n renderNotFound?: () => React.ReactNode;\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n renderItem: (item: T, state?: MenuItemState) => React.ReactNode;\n renderValue: (value: T) => React.ReactNode;\n renderAddButton?: (query?: string) => React.ReactNode;\n valueToString: (value: T) => string;\n itemToValue: (item: T) => string | number;\n getItems: (query: string) => Promise<T[]>;\n inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];\n}\n\nexport interface CustomComboBoxState<T> {\n editing: boolean;\n loading: boolean;\n opened: boolean;\n textValue: string;\n items: Nullable<T[]>;\n inputChanged: boolean;\n focused: boolean;\n repeatRequest: () => void;\n requestStatus: ComboBoxRequestStatus;\n}\n\nexport const DELAY_BEFORE_SHOW_LOADER = 300;\nexport const LOADER_SHOW_TIME = 1000;\n\nexport const DefaultState = {\n inputChanged: false,\n editing: false,\n items: null,\n loading: false,\n opened: false,\n focused: false,\n textValue: '',\n repeatRequest: () => undefined,\n requestStatus: ComboBoxRequestStatus.Unknown,\n};\n\n@responsiveLayout\n@rootNode\nexport class CustomComboBox<T> extends React.PureComponent<CustomComboBoxProps<T>, CustomComboBoxState<T>> {\n public static __KONTUR_REACT_UI__ = 'CustomComboBox';\n\n public state: CustomComboBoxState<T> = DefaultState;\n public input: Nullable<Input>;\n public menu: Nullable<Menu>;\n public inputLikeText: Nullable<InputLikeText>;\n public requestId = 0;\n public loaderShowDelay: Nullable<Promise<void>>;\n private focused = false;\n private cancelationToken: Nullable<(reason?: Error) => void> = null;\n private isMobileLayout!: boolean;\n\n private reducer = reducer;\n public cancelLoaderDelay: () => void = () => null;\n\n /**\n * @public\n */\n public focus = () => {\n if (this.props.disabled) {\n return;\n }\n\n if (this.input) {\n this.input.focus();\n } else if (this.inputLikeText) {\n this.inputLikeText.focus();\n }\n };\n\n /**\n * @public\n */\n public selectInputText = () => {\n if (this.props.disabled) {\n return;\n }\n if (this.input) {\n this.input.selectAll();\n }\n };\n\n /**\n * @public\n */\n public blur = () => {\n if (this.props.disabled) {\n return;\n }\n\n this.handleBlur();\n };\n private setRootNode!: TSetRootNode;\n\n /**\n * @public\n */\n public async search(query: string = this.state.textValue) {\n const { getItems } = this.props;\n\n const cancelPromise: Promise<never> = new Promise((_, reject) => (this.cancelationToken = reject));\n this.requestId += 1;\n const expectingId = this.requestId;\n\n if (!this.loaderShowDelay) {\n this.loaderShowDelay = new Promise<void>((resolve) => {\n const cancelLoader = taskWithDelay(() => {\n this.dispatch({ type: 'RequestItems' });\n setTimeout(resolve, LOADER_SHOW_TIME);\n }, DELAY_BEFORE_SHOW_LOADER);\n\n cancelPromise.catch(() => cancelLoader());\n\n this.cancelLoaderDelay = () => {\n cancelLoader();\n resolve();\n };\n });\n }\n\n try {\n const items = await Promise.race([getItems(query), cancelPromise]);\n if (this.state.loading) {\n await Promise.race([this.loaderShowDelay, cancelPromise]);\n }\n if (expectingId === this.requestId) {\n this.dispatch({\n type: 'ReceiveItems',\n items,\n });\n }\n } catch (error) {\n if (error && error.code === 'CancelationError') {\n this.dispatch({ type: 'CancelRequest' });\n } else if (expectingId === this.requestId) {\n this.dispatch({\n type: 'RequestFailure',\n repeatRequest: () => {\n this.search(query);\n if (this.input) {\n this.input.focus();\n }\n },\n });\n }\n } finally {\n if (expectingId === this.requestId) {\n if (!this.state.loading) {\n this.cancelLoaderDelay();\n }\n this.cancelationToken = null;\n this.loaderShowDelay = null;\n }\n }\n }\n\n /**\n * @public\n */\n public cancelSearch() {\n if (this.cancelationToken) {\n this.cancelationToken(new CancelationError());\n }\n }\n\n /**\n * @public\n */\n public open() {\n this.dispatch({ type: 'Open' });\n }\n\n /**\n * @public\n */\n public close() {\n this.dispatch({ type: 'Close' });\n }\n\n public render() {\n const viewProps = {\n align: this.props.align,\n borderless: this.props.borderless,\n disabled: this.props.disabled,\n disablePortal: this.props.disablePortal,\n editing: this.state.editing,\n error: this.props.error,\n items: this.state.items,\n loading: this.state.loading,\n menuAlign: this.props.menuAlign,\n opened: this.state.opened,\n drawArrow: this.props.drawArrow,\n placeholder: this.props.placeholder,\n size: this.props.size,\n textValue: this.state.textValue,\n totalCount: this.props.totalCount,\n value: this.props.value,\n warning: this.props.warning,\n width: this.props.width,\n maxLength: this.props.maxLength,\n maxMenuHeight: this.props.maxMenuHeight,\n leftIcon: this.props.leftIcon,\n rightIcon: this.props.rightIcon,\n inputMode: this.props.inputMode,\n\n onValueChange: this.handleValueChange,\n onClickOutside: this.handleClickOutside,\n onFocus: this.handleFocus,\n onFocusOutside: this.handleBlur,\n onInputBlur: this.handleInputBlur,\n onInputValueChange: (value: string) => this.dispatch({ type: 'TextChange', value }),\n onInputFocus: this.handleFocus,\n onInputClick: this.handleInputClick,\n onInputKeyDown: (event: React.KeyboardEvent) => {\n event.persist();\n this.dispatch({ type: 'KeyPress', event });\n },\n onMouseEnter: this.props.onMouseEnter,\n onMouseOver: this.props.onMouseOver,\n onMouseLeave: this.props.onMouseLeave,\n renderItem: this.props.renderItem,\n renderNotFound: this.props.renderNotFound,\n renderValue: this.props.renderValue,\n renderTotalCount: this.props.renderTotalCount,\n renderAddButton: this.props.renderAddButton,\n repeatRequest: this.state.repeatRequest,\n requestStatus: this.state.requestStatus,\n\n refInput: (input: Nullable<Input>) => {\n this.input = input;\n },\n refMenu: (menu: Nullable<Menu>) => {\n this.menu = menu;\n },\n refInputLikeText: (inputLikeText: Nullable<InputLikeText>) => {\n this.inputLikeText = inputLikeText;\n },\n };\n\n return (\n <CommonWrapper {...this.props}>\n <ComboBoxView {...viewProps} ref={this.setRootNode} />\n </CommonWrapper>\n );\n }\n\n public componentDidMount() {\n this.dispatch({ type: 'Mount' });\n if (this.props.autoFocus) {\n this.focus();\n }\n }\n\n public componentDidUpdate(prevProps: CustomComboBoxProps<T>, prevState: CustomComboBoxState<T>) {\n if (prevState.editing && !this.state.editing) {\n this.handleBlur();\n }\n this.dispatch({ type: 'DidUpdate', prevProps, prevState });\n }\n\n /**\n * @public\n */\n public reset() {\n this.dispatch({ type: 'Reset' });\n }\n\n private dispatch = (action: CustomComboBoxAction<T>) => {\n let effects: Array<CustomComboBoxEffect<T>>;\n let nextState: Pick<CustomComboBoxState<T>, never>;\n\n this.setState(\n (state) => {\n const stateAndEffect = this.reducer(state, this.props, action);\n\n [nextState, effects] = stateAndEffect instanceof Array ? stateAndEffect : [stateAndEffect, []];\n\n return nextState;\n },\n () => {\n effects.forEach(this.handleEffect);\n },\n );\n };\n\n private handleEffect = (effect: CustomComboBoxEffect<T>) => {\n effect(this.dispatch, this.getState, this.getProps, () => this);\n };\n\n private getProps = () => this.props;\n\n private getState = () => this.state;\n\n private handleValueChange = (value: T) => {\n this.dispatch({\n type: 'ValueChange',\n value,\n keepFocus: !this.isMobileLayout,\n });\n };\n\n private handleFocus = () => {\n if (this.focused) {\n return;\n }\n this.focused = true;\n this.dispatch({ type: 'Focus' });\n };\n\n private handleClickOutside = (e: Event) => {\n fixClickFocusIE(e);\n this.handleBlur();\n };\n\n private handleBlur = () => {\n if (!this.focused) {\n if (this.state.opened) {\n this.close();\n }\n return;\n }\n\n this.focused = false;\n // workaround for the similar bug with focusout\n // in Firefox, Chrome and IE\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1363964\n setTimeout(() => {\n this.dispatch({ type: 'Blur' });\n });\n };\n\n private handleInputBlur = () => {\n // If menu opened, RenderLayer is active and\n // it would call handleFocusOutside\n // In that way handleBlur would be called\n\n // TODO: add check for mobile layout, to call `handleBlur`\n\n if (this.state.opened) {\n return;\n }\n this.handleBlur();\n };\n\n private handleInputClick = () => {\n if (!this.cancelationToken) {\n this.dispatch({ type: 'InputClick' });\n }\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["CustomComboBox.tsx"],"names":["DELAY_BEFORE_SHOW_LOADER","LOADER_SHOW_TIME","DefaultState","inputChanged","editing","items","loading","opened","focused","textValue","repeatRequest","undefined","requestStatus","ComboBoxRequestStatus","Unknown","CustomComboBoxDataTids","comboBoxView","CustomComboBox","responsiveLayout","rootNode","state","requestId","cancelationToken","reducer","cancelLoaderDelay","focus","props","disabled","input","inputLikeText","selectInputText","selectAll","blur","handleBlur","dispatch","action","effects","nextState","setState","stateAndEffect","Array","forEach","handleEffect","effect","getState","getProps","handleValueChange","value","type","keepFocus","isMobileLayout","handleFocus","handleClickOutside","e","close","setTimeout","handleInputBlur","handleInputClick","search","query","getItems","cancelPromise","Promise","_","reject","expectingId","loaderShowDelay","resolve","cancelLoader","catch","race","code","cancelSearch","CancelationError","open","render","viewProps","align","borderless","disablePortal","error","menuAlign","drawArrow","placeholder","size","totalCount","warning","width","maxLength","maxMenuHeight","leftIcon","rightIcon","inputMode","onValueChange","onClickOutside","onFocus","onFocusOutside","onInputBlur","onInputValueChange","onInputFocus","onInputClick","onInputKeyDown","event","persist","onMouseEnter","onMouseOver","onMouseLeave","renderItem","renderNotFound","renderValue","renderTotalCount","renderAddButton","refInput","refMenu","menu","refInputLikeText","setRootNode","componentDidMount","autoFocus","componentDidUpdate","prevProps","prevState","reset","React","PureComponent","__KONTUR_REACT_UI__"],"mappings":"quBAAA;;;;;;;AAOA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DO,IAAMA,wBAAwB,GAAG,GAAjC,C;AACA,IAAMC,gBAAgB,GAAG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,OAAR,EAAd,EACD,C,yBAlOoC2E,eAAMC,a,WAC7BC,mB,GAAsB,gB","sourcesContent":["import React from 'react';\n\nimport { Nullable } from '../../typings/utility-types';\nimport { Input, InputIconType } from '../../components/Input';\nimport { Menu } from '../Menu';\nimport { InputLikeText } from '../InputLikeText';\nimport { MenuItemState } from '../../components/MenuItem';\nimport { CancelationError, taskWithDelay } from '../../lib/utils';\nimport { fixClickFocusIE } from '../../lib/events/fixClickFocusIE';\nimport { CommonProps, CommonWrapper } from '../../internal/CommonWrapper';\nimport { responsiveLayout } from '../../components/ResponsiveLayout/decorator';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\n\nimport { ComboBoxRequestStatus } from './CustomComboBoxTypes';\nimport { CustomComboBoxAction, CustomComboBoxEffect, reducer } from './CustomComboBoxReducer';\nimport { ComboBoxView } from './ComboBoxView';\n\nexport interface CustomComboBoxProps<T> extends CommonProps {\n align?: 'left' | 'center' | 'right';\n autoFocus?: boolean;\n borderless?: boolean;\n disablePortal?: boolean;\n disabled?: boolean;\n /**\n * Cостояние валидации при ошибке.\n */\n error?: boolean;\n maxLength?: number;\n menuAlign?: 'left' | 'right';\n drawArrow?: boolean;\n leftIcon?: InputIconType;\n rightIcon?: InputIconType;\n searchOnFocus?: boolean;\n onValueChange?: (value: T) => void;\n onInputValueChange?: (value: string) => Nullable<string> | void;\n onUnexpectedInput?: (value: string) => void | null | T;\n onFocus?: () => void;\n onBlur?: () => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseOver?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n onInputKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => void;\n placeholder?: string;\n size?: 'small' | 'medium' | 'large';\n totalCount?: number;\n value?: Nullable<T>;\n /**\n * Cостояние валидации при предупреждении.\n */\n warning?: boolean;\n width?: string | number;\n maxMenuHeight?: number | string;\n renderNotFound?: () => React.ReactNode;\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n renderItem: (item: T, state?: MenuItemState) => React.ReactNode;\n renderValue: (value: T) => React.ReactNode;\n renderAddButton?: (query?: string) => React.ReactNode;\n valueToString: (value: T) => string;\n itemToValue: (item: T) => string | number;\n getItems: (query: string) => Promise<T[]>;\n inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];\n}\n\nexport interface CustomComboBoxState<T> {\n editing: boolean;\n loading: boolean;\n opened: boolean;\n textValue: string;\n items: Nullable<T[]>;\n inputChanged: boolean;\n focused: boolean;\n repeatRequest: () => void;\n requestStatus: ComboBoxRequestStatus;\n}\n\nexport const DELAY_BEFORE_SHOW_LOADER = 300;\nexport const LOADER_SHOW_TIME = 1000;\n\nexport const DefaultState = {\n inputChanged: false,\n editing: false,\n items: null,\n loading: false,\n opened: false,\n focused: false,\n textValue: '',\n repeatRequest: () => undefined,\n requestStatus: ComboBoxRequestStatus.Unknown,\n};\n\nexport const CustomComboBoxDataTids = {\n comboBoxView: 'ComboBoxView__root',\n} as const;\n\n@responsiveLayout\n@rootNode\nexport class CustomComboBox<T> extends React.PureComponent<CustomComboBoxProps<T>, CustomComboBoxState<T>> {\n public static __KONTUR_REACT_UI__ = 'CustomComboBox';\n\n public state: CustomComboBoxState<T> = DefaultState;\n public input: Nullable<Input>;\n public menu: Nullable<Menu>;\n public inputLikeText: Nullable<InputLikeText>;\n public requestId = 0;\n public loaderShowDelay: Nullable<Promise<void>>;\n private focused = false;\n private cancelationToken: Nullable<(reason?: Error) => void> = null;\n private isMobileLayout!: boolean;\n\n private reducer = reducer;\n public cancelLoaderDelay: () => void = () => null;\n\n /**\n * @public\n */\n public focus = () => {\n if (this.props.disabled) {\n return;\n }\n\n if (this.input) {\n this.input.focus();\n } else if (this.inputLikeText) {\n this.inputLikeText.focus();\n }\n };\n\n /**\n * @public\n */\n public selectInputText = () => {\n if (this.props.disabled) {\n return;\n }\n if (this.input) {\n this.input.selectAll();\n }\n };\n\n /**\n * @public\n */\n public blur = () => {\n if (this.props.disabled) {\n return;\n }\n\n this.handleBlur();\n };\n private setRootNode!: TSetRootNode;\n\n /**\n * @public\n */\n public async search(query: string = this.state.textValue) {\n const { getItems } = this.props;\n\n const cancelPromise: Promise<never> = new Promise((_, reject) => (this.cancelationToken = reject));\n this.requestId += 1;\n const expectingId = this.requestId;\n\n if (!this.loaderShowDelay) {\n this.loaderShowDelay = new Promise<void>((resolve) => {\n const cancelLoader = taskWithDelay(() => {\n this.dispatch({ type: 'RequestItems' });\n setTimeout(resolve, LOADER_SHOW_TIME);\n }, DELAY_BEFORE_SHOW_LOADER);\n\n cancelPromise.catch(() => cancelLoader());\n\n this.cancelLoaderDelay = () => {\n cancelLoader();\n resolve();\n };\n });\n }\n\n try {\n const items = await Promise.race([getItems(query), cancelPromise]);\n if (this.state.loading) {\n await Promise.race([this.loaderShowDelay, cancelPromise]);\n }\n if (expectingId === this.requestId) {\n this.dispatch({\n type: 'ReceiveItems',\n items,\n });\n }\n } catch (error) {\n if (error && error.code === 'CancelationError') {\n this.dispatch({ type: 'CancelRequest' });\n } else if (expectingId === this.requestId) {\n this.dispatch({\n type: 'RequestFailure',\n repeatRequest: () => {\n this.search(query);\n if (this.input) {\n this.input.focus();\n }\n },\n });\n }\n } finally {\n if (expectingId === this.requestId) {\n if (!this.state.loading) {\n this.cancelLoaderDelay();\n }\n this.cancelationToken = null;\n this.loaderShowDelay = null;\n }\n }\n }\n\n /**\n * @public\n */\n public cancelSearch() {\n if (this.cancelationToken) {\n this.cancelationToken(new CancelationError());\n }\n }\n\n /**\n * @public\n */\n public open() {\n this.dispatch({ type: 'Open' });\n }\n\n /**\n * @public\n */\n public close() {\n this.dispatch({ type: 'Close' });\n }\n\n public render() {\n const viewProps = {\n align: this.props.align,\n borderless: this.props.borderless,\n disabled: this.props.disabled,\n disablePortal: this.props.disablePortal,\n editing: this.state.editing,\n error: this.props.error,\n items: this.state.items,\n loading: this.state.loading,\n menuAlign: this.props.menuAlign,\n opened: this.state.opened,\n drawArrow: this.props.drawArrow,\n placeholder: this.props.placeholder,\n size: this.props.size,\n textValue: this.state.textValue,\n totalCount: this.props.totalCount,\n value: this.props.value,\n warning: this.props.warning,\n width: this.props.width,\n maxLength: this.props.maxLength,\n maxMenuHeight: this.props.maxMenuHeight,\n leftIcon: this.props.leftIcon,\n rightIcon: this.props.rightIcon,\n inputMode: this.props.inputMode,\n\n onValueChange: this.handleValueChange,\n onClickOutside: this.handleClickOutside,\n onFocus: this.handleFocus,\n onFocusOutside: this.handleBlur,\n onInputBlur: this.handleInputBlur,\n onInputValueChange: (value: string) => this.dispatch({ type: 'TextChange', value }),\n onInputFocus: this.handleFocus,\n onInputClick: this.handleInputClick,\n onInputKeyDown: (event: React.KeyboardEvent) => {\n event.persist();\n this.dispatch({ type: 'KeyPress', event });\n },\n onMouseEnter: this.props.onMouseEnter,\n onMouseOver: this.props.onMouseOver,\n onMouseLeave: this.props.onMouseLeave,\n renderItem: this.props.renderItem,\n renderNotFound: this.props.renderNotFound,\n renderValue: this.props.renderValue,\n renderTotalCount: this.props.renderTotalCount,\n renderAddButton: this.props.renderAddButton,\n repeatRequest: this.state.repeatRequest,\n requestStatus: this.state.requestStatus,\n\n refInput: (input: Nullable<Input>) => {\n this.input = input;\n },\n refMenu: (menu: Nullable<Menu>) => {\n this.menu = menu;\n },\n refInputLikeText: (inputLikeText: Nullable<InputLikeText>) => {\n this.inputLikeText = inputLikeText;\n },\n };\n\n return (\n <CommonWrapper {...this.props}>\n <ComboBoxView {...viewProps} ref={this.setRootNode} />\n </CommonWrapper>\n );\n }\n\n public componentDidMount() {\n this.dispatch({ type: 'Mount' });\n if (this.props.autoFocus) {\n this.focus();\n }\n }\n\n public componentDidUpdate(prevProps: CustomComboBoxProps<T>, prevState: CustomComboBoxState<T>) {\n if (prevState.editing && !this.state.editing) {\n this.handleBlur();\n }\n this.dispatch({ type: 'DidUpdate', prevProps, prevState });\n }\n\n /**\n * @public\n */\n public reset() {\n this.dispatch({ type: 'Reset' });\n }\n\n private dispatch = (action: CustomComboBoxAction<T>) => {\n let effects: Array<CustomComboBoxEffect<T>>;\n let nextState: Pick<CustomComboBoxState<T>, never>;\n\n this.setState(\n (state) => {\n const stateAndEffect = this.reducer(state, this.props, action);\n\n [nextState, effects] = stateAndEffect instanceof Array ? stateAndEffect : [stateAndEffect, []];\n\n return nextState;\n },\n () => {\n effects.forEach(this.handleEffect);\n },\n );\n };\n\n private handleEffect = (effect: CustomComboBoxEffect<T>) => {\n effect(this.dispatch, this.getState, this.getProps, () => this);\n };\n\n private getProps = () => this.props;\n\n private getState = () => this.state;\n\n private handleValueChange = (value: T) => {\n this.dispatch({\n type: 'ValueChange',\n value,\n keepFocus: !this.isMobileLayout,\n });\n };\n\n private handleFocus = () => {\n if (this.focused) {\n return;\n }\n this.focused = true;\n this.dispatch({ type: 'Focus' });\n };\n\n private handleClickOutside = (e: Event) => {\n fixClickFocusIE(e);\n this.handleBlur();\n };\n\n private handleBlur = () => {\n if (!this.focused) {\n if (this.state.opened) {\n this.close();\n }\n return;\n }\n\n this.focused = false;\n // workaround for the similar bug with focusout\n // in Firefox, Chrome and IE\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1363964\n setTimeout(() => {\n this.dispatch({ type: 'Blur' });\n });\n };\n\n private handleInputBlur = () => {\n // If menu opened, RenderLayer is active and\n // it would call handleFocusOutside\n // In that way handleBlur would be called\n\n // TODO: add check for mobile layout, to call `handleBlur`\n\n if (this.state.opened) {\n return;\n }\n this.handleBlur();\n };\n\n private handleInputClick = () => {\n if (!this.cancelationToken) {\n this.dispatch({ type: 'InputClick' });\n }\n };\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Аттрибуты data-tid экспортируются для компонентов в виде объекта.
|
|
2
|
+
При необходимости добавления аттрибута data-tid необходимо создать пулл-реквест.
|
|
3
|
+
|
|
4
|
+
У всех компонентов также есть проп data-tid, которым можно переопределять корневые дата-тиды.
|
|
5
|
+
|
|
6
|
+
Список экспортируемых data-tid:
|
|
7
|
+
|
|
8
|
+
```jsx harmony
|
|
9
|
+
import {DataTids} from './DataTids';
|
|
10
|
+
|
|
11
|
+
<DataTids/>
|
|
12
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.DataTids = void 0;var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _react = _interopRequireDefault(require("react"));
|
|
2
|
+
|
|
3
|
+
var _Select = require("../../components/Select");
|
|
4
|
+
|
|
5
|
+
var _DataTids = require("./DataTids.styles");
|
|
6
|
+
var _componentsDataTids = require("./componentsDataTids");var
|
|
7
|
+
|
|
8
|
+
DataTids = /*#__PURE__*/function (_React$Component) {(0, _inheritsLoose2.default)(DataTids, _React$Component);function DataTids() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;_this.
|
|
9
|
+
state = {
|
|
10
|
+
selectedValue: 'все' };_this.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
components = Object.keys(_componentsDataTids.componentsDataTids);_this.
|
|
14
|
+
|
|
15
|
+
items = ['все'].concat(_this.components);_this.
|
|
16
|
+
|
|
17
|
+
setValue = function (value) {
|
|
18
|
+
_this.setState({ selectedValue: value });
|
|
19
|
+
};return _this;}var _proto = DataTids.prototype;_proto.
|
|
20
|
+
|
|
21
|
+
render = function render() {var _this2 = this;
|
|
22
|
+
return /*#__PURE__*/(
|
|
23
|
+
_react.default.createElement("div", null, "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442:", /*#__PURE__*/
|
|
24
|
+
|
|
25
|
+
_react.default.createElement(_Select.Select, { items: this.items, value: this.state.selectedValue, onValueChange: this.setValue, search: true }),
|
|
26
|
+
Object.entries(_componentsDataTids.componentsDataTids).map(function (_ref, index) {var componentName = _ref[0],dataTids = _ref[1];
|
|
27
|
+
if (componentName === _this2.state.selectedValue || _this2.state.selectedValue === 'все') {
|
|
28
|
+
return /*#__PURE__*/(
|
|
29
|
+
_react.default.createElement("div", { key: index, className: _DataTids.styles.wrapper() }, /*#__PURE__*/
|
|
30
|
+
_react.default.createElement("div", { className: _DataTids.styles.componentName() }, componentName),
|
|
31
|
+
Object.values(dataTids).map(function (value, i) {
|
|
32
|
+
return /*#__PURE__*/(
|
|
33
|
+
_react.default.createElement("div", { key: i, className: _DataTids.styles.row() }, /*#__PURE__*/
|
|
34
|
+
_react.default.createElement("div", { className: _DataTids.styles.leftCell() }, componentName + "DataTids." + value[0]), /*#__PURE__*/
|
|
35
|
+
_react.default.createElement("div", { className: _DataTids.styles.rightCell() }, "'" + value[1] + "'")));
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
})));
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
})));
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
};return DataTids;}(_react.default.Component);exports.DataTids = DataTids;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DataTids.tsx"],"names":["DataTids","state","selectedValue","components","Object","keys","componentsDataTids","items","setValue","value","setState","render","entries","map","index","componentName","dataTids","styles","wrapper","values","i","row","leftCell","rightCell","React","Component"],"mappings":"oPAAA;;AAEA;;AAEA;AACA,0D;;AAEaA,Q;AACJC,IAAAA,K,GAAQ;AACbC,MAAAA,aAAa,EAAE,KADF,E;;;AAIPC,IAAAA,U,GAAaC,MAAM,CAACC,IAAP,CAAYC,sCAAZ,C;;AAEbC,IAAAA,K,IAAS,K,SAAU,MAAKJ,U;;AAExBK,IAAAA,Q,GAAW,UAACC,KAAD,EAAmB;AACpC,YAAKC,QAAL,CAAc,EAAER,aAAa,EAAEO,KAAjB,EAAd;AACD,K;;AAEME,EAAAA,M,GAAP,kBAAgB;AACd;AACE;;AAEE,mCAAC,cAAD,IAAgB,KAAK,EAAE,KAAKJ,KAA5B,EAAmC,KAAK,EAAE,KAAKN,KAAL,CAAWC,aAArD,EAAoE,aAAa,EAAE,KAAKM,QAAxF,EAAkG,MAAM,MAAxG,GAFF;AAGGJ,MAAAA,MAAM,CAACQ,OAAP,CAAeN,sCAAf,EAAmCO,GAAnC,CAAuC,gBAA4BC,KAA5B,EAAsC,KAApCC,aAAoC,WAArBC,QAAqB;AAC5E,YAAID,aAAa,KAAK,MAAI,CAACd,KAAL,CAAWC,aAA7B,IAA8C,MAAI,CAACD,KAAL,CAAWC,aAAX,KAA6B,KAA/E,EAAsF;AACpF;AACE,kDAAK,GAAG,EAAEY,KAAV,EAAiB,SAAS,EAAEG,iBAAOC,OAAP,EAA5B;AACE,kDAAK,SAAS,EAAED,iBAAOF,aAAP,EAAhB,IAAyCA,aAAzC,CADF;AAEGX,YAAAA,MAAM,CAACe,MAAP,CAAcH,QAAd,EAAwBH,GAAxB,CAA4B,UAACJ,KAAD,EAAQW,CAAR,EAAc;AACzC;AACE,sDAAK,GAAG,EAAEA,CAAV,EAAa,SAAS,EAAEH,iBAAOI,GAAP,EAAxB;AACE,sDAAK,SAAS,EAAEJ,iBAAOK,QAAP,EAAhB,IAAuCP,aAAvC,iBAAgEN,KAAK,CAAC,CAAD,CAArE,CADF;AAEE,sDAAK,SAAS,EAAEQ,iBAAOM,SAAP,EAAhB,UAAyCd,KAAK,CAAC,CAAD,CAA9C,OAFF,CADF;;;AAMD,aAPA,CAFH,CADF;;;AAaD;AACD,eAAO,IAAP;AACD,OAjBA,CAHH,CADF;;;AAwBD,G,mBAtC2Be,eAAMC,S","sourcesContent":["import React from 'react';\n\nimport { Select } from '../../components/Select';\n\nimport { styles } from './DataTids.styles';\nimport { componentsDataTids } from './componentsDataTids';\n\nexport class DataTids extends React.Component<{}, { selectedValue: string }> {\n public state = {\n selectedValue: 'все',\n };\n\n private components = Object.keys(componentsDataTids);\n\n private items = ['все', ...this.components];\n\n private setValue = (value: string) => {\n this.setState({ selectedValue: value });\n };\n\n public render() {\n return (\n <div>\n Выбрать компонент:\n <Select<string> items={this.items} value={this.state.selectedValue} onValueChange={this.setValue} search />\n {Object.entries(componentsDataTids).map(([componentName, dataTids], index) => {\n if (componentName === this.state.selectedValue || this.state.selectedValue === 'все') {\n return (\n <div key={index} className={styles.wrapper()}>\n <div className={styles.componentName()}>{componentName}</div>\n {Object.values(dataTids).map((value, i) => {\n return (\n <div key={i} className={styles.row()}>\n <div className={styles.leftCell()}>{`${componentName}DataTids.${value[0]}`}</div>\n <div className={styles.rightCell()}>{`'${value[1]}'`}</div>\n </div>\n );\n })}\n </div>\n );\n }\n return null;\n })}\n </div>\n );\n }\n}\n"]}
|