@iobroker/adapter-react-v5 7.5.2 → 7.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/LICENSE +22 -22
  2. package/build/AdminConnection.js.map +1 -1
  3. package/build/Components/404.js +13 -13
  4. package/build/Components/404.js.map +1 -1
  5. package/build/Components/ColorPicker.js.map +1 -1
  6. package/build/Components/CopyToClipboard.js.map +1 -1
  7. package/build/Components/CustomModal.js.map +1 -1
  8. package/build/Components/FileViewer.js.map +1 -1
  9. package/build/Components/Icon.js.map +1 -1
  10. package/build/Components/IconPicker.js.map +1 -1
  11. package/build/Components/IconSelector.js.map +1 -1
  12. package/build/Components/IobUri.js.map +1 -1
  13. package/build/Components/Loader.js +223 -223
  14. package/build/Components/Loader.js.map +1 -1
  15. package/build/Components/Loaders/MV.js.map +1 -1
  16. package/build/Components/Loaders/PT.js +103 -103
  17. package/build/Components/Loaders/PT.js.map +1 -1
  18. package/build/Components/Loaders/Vendor.js +7 -7
  19. package/build/Components/Loaders/Vendor.js.map +1 -1
  20. package/build/Components/MDUtils.js.map +1 -1
  21. package/build/Components/ObjectBrowser.js +1 -1
  22. package/build/Components/ObjectBrowser.js.map +1 -1
  23. package/build/Components/Router.js.map +1 -1
  24. package/build/Components/SaveCloseButtons.js.map +1 -1
  25. package/build/Components/SimpleCron/cronText.js.map +1 -1
  26. package/build/Components/SimpleCron/index.js.map +1 -1
  27. package/build/Components/TabContainer.js.map +1 -1
  28. package/build/Components/TabContent.js.map +1 -1
  29. package/build/Components/TabHeader.js.map +1 -1
  30. package/build/Components/TableResize.js.map +1 -1
  31. package/build/Components/TextWithIcon.js.map +1 -1
  32. package/build/Components/ToggleThemeMenu.js.map +1 -1
  33. package/build/Components/TreeTable.js.map +1 -1
  34. package/build/Components/UploadImage.js +305 -305
  35. package/build/Components/UploadImage.js.map +1 -1
  36. package/build/Components/withWidth.js.map +1 -1
  37. package/build/Connection.js.map +1 -1
  38. package/build/Dialogs/ComplexCron.js.map +1 -1
  39. package/build/Dialogs/Confirm.js.map +1 -1
  40. package/build/Dialogs/Cron.js.map +1 -1
  41. package/build/Dialogs/Error.js.map +1 -1
  42. package/build/Dialogs/Message.js.map +1 -1
  43. package/build/Dialogs/SelectFile.js.map +1 -1
  44. package/build/Dialogs/SimpleCron.js.map +1 -1
  45. package/build/Dialogs/TextInput.d.ts +1 -1
  46. package/build/Dialogs/TextInput.js.map +1 -1
  47. package/build/Prompt.js +7 -7
  48. package/build/Prompt.js.map +1 -1
  49. package/build/assets/devices/parseNames.js.map +1 -1
  50. package/build/assets/devices.json +1 -1
  51. package/build/assets/lamp_ceiling.svg +8 -8
  52. package/build/assets/lamp_table.svg +7 -7
  53. package/build/assets/no_icon.svg +9 -9
  54. package/build/assets/rooms/parseNames.js.map +1 -1
  55. package/build/assets/rooms.json +1 -1
  56. package/build/dictionary.js.map +1 -1
  57. package/build/i18n.js.map +1 -1
  58. package/build/icons/IconAdapter.js.map +1 -1
  59. package/build/icons/IconAlias.js.map +1 -1
  60. package/build/icons/IconButtonImage.js.map +1 -1
  61. package/build/icons/IconChannel.js.map +1 -1
  62. package/build/icons/IconClearFilter.js.map +1 -1
  63. package/build/icons/IconClosed.js.map +1 -1
  64. package/build/icons/IconCopy.js.map +1 -1
  65. package/build/icons/IconDevice.js.map +1 -1
  66. package/build/icons/IconDocument.js.map +1 -1
  67. package/build/icons/IconDocumentReadOnly.js.map +1 -1
  68. package/build/icons/IconExpert.js.map +1 -1
  69. package/build/icons/IconFx.js +1 -1
  70. package/build/icons/IconFx.js.map +1 -1
  71. package/build/icons/IconInstance.js.map +1 -1
  72. package/build/icons/IconLogout.js +1 -1
  73. package/build/icons/IconLogout.js.map +1 -1
  74. package/build/icons/IconNoIcon.js.map +1 -1
  75. package/build/icons/IconOpen.js.map +1 -1
  76. package/build/icons/IconProps.js.map +1 -1
  77. package/build/icons/IconState.js.map +1 -1
  78. package/build/icons/IconVacuum.js.map +1 -1
  79. package/build/index.css +56 -56
  80. package/build/index.d.ts +1 -0
  81. package/build/index.js +1 -0
  82. package/build/index.js.map +1 -1
  83. package/build/modulefederation.admin.config.d.ts +13 -0
  84. package/build/modulefederation.admin.config.js +45 -0
  85. package/build/modulefederation.admin.config.js.map +1 -0
  86. package/craco-module-federation.js +62 -62
  87. package/index.css +56 -56
  88. package/modulefederation.admin.config.d.ts +20 -0
  89. package/modulefederation.admin.config.js +54 -33
  90. package/package.json +12 -10
  91. package/tasksExample.js +91 -91
@@ -1 +1 @@
1
- {"version":3,"file":"UploadImage.js","sourceRoot":"./src/","sources":["Components/UploadImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAC9D,OAAO,QAAgC,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAA4B,MAAM,eAAe,CAAC;AAElE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,IAAI,IAAI,QAAQ,EAAE,kBAAkB,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE7G,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,uCAAuC;AACvC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,IACzE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CACZ,CACR,CACL,CACT;gBACA,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CACpB,oBAAC,IAAI,IACD,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,GAAG,EAAC,MAAM,GACZ,CACL,CAAC,CAAC,CAAC,IAAI;gBAEP,IAAI,IAAI,IAAI,IAAI,WAAW,CAAC,CAAC,CAAC,CAC3B,oBAAC,OAAO,IACJ,GAAG,EAAE,IAAI,CAAC,UAAU,EACpB,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,GAAG,EAAE,IAAI,EACT,kBAAkB,EAAE,CAAC,EACrB,QAAQ,EAAE,CAAC,EACX,MAAM,EAAE,KAAK,EACb,gBAAgB,EAAE,EAAE,EACpB,eAAe,EAAE,EAAE,EACnB,UAAU,EAAE,KAAK,EACjB,gBAAgB,EAAE,KAAK,GACzB,CACL,CAAC,CAAC,CAAC,IAAI,CACN,CACJ,CACT,CACM,CACd,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { Component, createRef, type JSX } from 'react';\r\nimport Dropzone, { type FileRejection } from 'react-dropzone';\r\nimport { Cropper, type ReactCropperElement } from 'react-cropper';\r\n\r\nimport { Menu, MenuItem, Tooltip, IconButton } from '@mui/material';\r\n\r\nimport { Close as IconClose, Crop as CropIcon, UploadFileOutlined as UploadIcon } from '@mui/icons-material';\r\n\r\nimport { I18n } from '../i18n';\r\nimport { Icon } from './Icon';\r\n\r\n// import 'cropperjs/dist/cropper.css';\r\nconst cropperStyles = `\r\n/*!\r\n * Cropper.js v1.5.12\r\n * https://fengyuanchen.github.io/cropperjs\r\n *\r\n * Copyright 2015-present Chen Fengyuan\r\n * Released under the MIT license\r\n *\r\n * Date: 2021-06-12T08:00:11.623Z\r\n */\r\n\r\n.cropper-container {\r\n direction: ltr;\r\n font-size: 0;\r\n line-height: 0;\r\n position: relative;\r\n -ms-touch-action: none;\r\n touch-action: none;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n\r\n.cropper-container img {\r\n display: block;\r\n height: 100%;\r\n image-orientation: 0deg;\r\n max-height: none !important;\r\n max-width: none !important;\r\n min-height: 0 !important;\r\n min-width: 0 !important;\r\n width: 100%;\r\n}\r\n\r\n.cropper-wrap-box,\r\n.cropper-canvas,\r\n.cropper-drag-box,\r\n.cropper-crop-box,\r\n.cropper-modal {\r\n bottom: 0;\r\n left: 0;\r\n position: absolute;\r\n right: 0;\r\n top: 0;\r\n}\r\n\r\n.cropper-wrap-box,\r\n.cropper-canvas {\r\n overflow: hidden;\r\n}\r\n\r\n.cropper-drag-box {\r\n background-color: #fff;\r\n opacity: 0;\r\n}\r\n\r\n.cropper-modal {\r\n background-color: #000;\r\n opacity: 0.5;\r\n}\r\n\r\n.cropper-view-box {\r\n display: block;\r\n height: 100%;\r\n outline: 1px solid #39f;\r\n outline-color: rgba(51, 153, 255, 0.75);\r\n overflow: hidden;\r\n width: 100%;\r\n}\r\n\r\n.cropper-dashed {\r\n border: 0 dashed #eee;\r\n display: block;\r\n opacity: 0.5;\r\n position: absolute;\r\n}\r\n\r\n.cropper-dashed.dashed-h {\r\n border-bottom-width: 1px;\r\n border-top-width: 1px;\r\n height: calc(100% / 3);\r\n left: 0;\r\n top: calc(100% / 3);\r\n width: 100%;\r\n}\r\n\r\n.cropper-dashed.dashed-v {\r\n border-left-width: 1px;\r\n border-right-width: 1px;\r\n height: 100%;\r\n left: calc(100% / 3);\r\n top: 0;\r\n width: calc(100% / 3);\r\n}\r\n\r\n.cropper-center {\r\n display: block;\r\n height: 0;\r\n left: 50%;\r\n opacity: 0.75;\r\n position: absolute;\r\n top: 50%;\r\n width: 0;\r\n}\r\n\r\n.cropper-center::before,\r\n.cropper-center::after {\r\n background-color: #eee;\r\n content: ' ';\r\n display: block;\r\n position: absolute;\r\n}\r\n\r\n.cropper-center::before {\r\n height: 1px;\r\n left: -3px;\r\n top: 0;\r\n width: 7px;\r\n}\r\n\r\n.cropper-center::after {\r\n height: 7px;\r\n left: 0;\r\n top: -3px;\r\n width: 1px;\r\n}\r\n\r\n.cropper-face,\r\n.cropper-line,\r\n.cropper-point {\r\n display: block;\r\n height: 100%;\r\n opacity: 0.1;\r\n position: absolute;\r\n width: 100%;\r\n}\r\n\r\n.cropper-face {\r\n background-color: #fff;\r\n left: 0;\r\n top: 0;\r\n}\r\n\r\n.cropper-line {\r\n background-color: #39f;\r\n}\r\n\r\n.cropper-line.line-e {\r\n cursor: ew-resize;\r\n right: -3px;\r\n top: 0;\r\n width: 5px;\r\n}\r\n\r\n.cropper-line.line-n {\r\n cursor: ns-resize;\r\n height: 5px;\r\n left: 0;\r\n top: -3px;\r\n}\r\n\r\n.cropper-line.line-w {\r\n cursor: ew-resize;\r\n left: -3px;\r\n top: 0;\r\n width: 5px;\r\n}\r\n\r\n.cropper-line.line-s {\r\n bottom: -3px;\r\n cursor: ns-resize;\r\n height: 5px;\r\n left: 0;\r\n}\r\n\r\n.cropper-point {\r\n background-color: #39f;\r\n height: 5px;\r\n opacity: 0.75;\r\n width: 5px;\r\n}\r\n\r\n.cropper-point.point-e {\r\n cursor: ew-resize;\r\n margin-top: -3px;\r\n right: -3px;\r\n top: 50%;\r\n}\r\n\r\n.cropper-point.point-n {\r\n cursor: ns-resize;\r\n left: 50%;\r\n margin-left: -3px;\r\n top: -3px;\r\n}\r\n\r\n.cropper-point.point-w {\r\n cursor: ew-resize;\r\n left: -3px;\r\n margin-top: -3px;\r\n top: 50%;\r\n}\r\n\r\n.cropper-point.point-s {\r\n bottom: -3px;\r\n cursor: s-resize;\r\n left: 50%;\r\n margin-left: -3px;\r\n}\r\n\r\n.cropper-point.point-ne {\r\n cursor: nesw-resize;\r\n right: -3px;\r\n top: -3px;\r\n}\r\n\r\n.cropper-point.point-nw {\r\n cursor: nwse-resize;\r\n left: -3px;\r\n top: -3px;\r\n}\r\n\r\n.cropper-point.point-sw {\r\n bottom: -3px;\r\n cursor: nesw-resize;\r\n left: -3px;\r\n}\r\n\r\n.cropper-point.point-se {\r\n bottom: -3px;\r\n cursor: nwse-resize;\r\n height: 20px;\r\n opacity: 1;\r\n right: -3px;\r\n width: 20px;\r\n}\r\n\r\n@media (min-width: 768px) {\r\n .cropper-point.point-se {\r\n height: 15px;\r\n width: 15px;\r\n }\r\n}\r\n\r\n@media (min-width: 992px) {\r\n .cropper-point.point-se {\r\n height: 10px;\r\n width: 10px;\r\n }\r\n}\r\n\r\n@media (min-width: 1200px) {\r\n .cropper-point.point-se {\r\n height: 5px;\r\n opacity: 0.75;\r\n width: 5px;\r\n }\r\n}\r\n\r\n.cropper-point.point-se::before {\r\n background-color: #39f;\r\n bottom: -50%;\r\n content: ' ';\r\n display: block;\r\n height: 200%;\r\n opacity: 0;\r\n position: absolute;\r\n right: -50%;\r\n width: 200%;\r\n}\r\n\r\n.cropper-invisible {\r\n opacity: 0;\r\n}\r\n\r\n.cropper-bg {\r\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC');\r\n}\r\n\r\n.cropper-hide {\r\n display: block;\r\n height: 0;\r\n position: absolute;\r\n width: 0;\r\n}\r\n\r\n.cropper-hidden {\r\n display: none !important;\r\n}\r\n\r\n.cropper-move {\r\n cursor: move;\r\n}\r\n\r\n.cropper-crop {\r\n cursor: crosshair;\r\n}\r\n\r\n.cropper-disabled .cropper-drag-box,\r\n.cropper-disabled .cropper-face,\r\n.cropper-disabled .cropper-line,\r\n.cropper-disabled .cropper-point {\r\n cursor: not-allowed;\r\n}\r\n`;\r\n\r\nconst styles: Record<string, React.CSSProperties> = {\r\n dropZone: {\r\n width: '100%',\r\n height: 100,\r\n position: 'relative',\r\n },\r\n dropZoneEmpty: {},\r\n image: {\r\n objectFit: 'contain',\r\n margin: 'auto',\r\n display: 'flex',\r\n width: '100%',\r\n height: '100%',\r\n },\r\n\r\n uploadDiv: {\r\n position: 'relative',\r\n width: '100%',\r\n height: 300,\r\n opacity: 0.9,\r\n marginTop: 30,\r\n cursor: 'pointer',\r\n outline: 'none',\r\n },\r\n uploadDivDragging: {\r\n opacity: 1,\r\n background: 'rgba(128,255,128,0.1)',\r\n },\r\n\r\n uploadCenterDiv: {\r\n margin: 5,\r\n border: '3px dashed grey',\r\n borderRadius: 5,\r\n width: 'calc(100% - 10px)',\r\n height: 'calc(100% - 10px)',\r\n position: 'relative',\r\n display: 'flex',\r\n },\r\n uploadCenterIcon: {\r\n paddingTop: 10,\r\n width: 48,\r\n height: 48,\r\n },\r\n uploadCenterText: {\r\n fontSize: 16,\r\n },\r\n uploadCenterTextAndIcon: {\r\n textAlign: 'center',\r\n position: 'absolute',\r\n top: 0,\r\n bottom: 0,\r\n left: 0,\r\n right: 0,\r\n display: 'flex',\r\n flexDirection: 'column',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n },\r\n disabledOpacity: {\r\n opacity: 0.3,\r\n cursor: 'default',\r\n },\r\n buttonRemoveWrapper: {\r\n position: 'absolute',\r\n zIndex: 222,\r\n right: 0,\r\n },\r\n buttonCropWrapper: {\r\n position: 'absolute',\r\n zIndex: 222,\r\n right: 0,\r\n top: 50,\r\n },\r\n error: {\r\n border: '2px solid red',\r\n boxSizing: 'border-box',\r\n },\r\n};\r\n\r\ninterface UploadImageProps {\r\n maxSize?: number;\r\n disabled?: boolean;\r\n crop?: boolean;\r\n error?: boolean;\r\n onChange: (base64: string) => void | undefined;\r\n icon: string | null;\r\n removeIconFunc: () => void | null;\r\n accept?: Record<string, string[]>;\r\n}\r\n\r\ninterface UploadImageState {\r\n uploadFile: boolean | 'dragging';\r\n anchorEl: HTMLElement | null;\r\n cropHandler: boolean;\r\n}\r\n\r\nexport class UploadImage extends Component<UploadImageProps, UploadImageState> {\r\n private readonly cropperRef: React.RefObject<ReactCropperElement>;\r\n\r\n constructor(props: UploadImageProps) {\r\n super(props);\r\n\r\n this.state = {\r\n uploadFile: false,\r\n anchorEl: null,\r\n cropHandler: false,\r\n };\r\n this.cropperRef = createRef();\r\n\r\n if (!window.document.getElementById('cropper-style-json-component')) {\r\n const style = window.document.createElement('style');\r\n style.setAttribute('id', 'cropper-style-json-component');\r\n style.innerHTML = cropperStyles;\r\n window.document.head.appendChild(style);\r\n }\r\n }\r\n\r\n onDrop(acceptedFiles: File[]): void {\r\n const onChange = this.props.onChange;\r\n const maxSize = this.props.maxSize || 10 * 1024;\r\n\r\n const file = acceptedFiles[0];\r\n const reader = new FileReader();\r\n\r\n reader.onabort = () => console.log('file reading was aborted');\r\n reader.onerror = () => console.log('file reading has failed');\r\n reader.onload = () => {\r\n if (!file || !file.name) {\r\n return;\r\n }\r\n const parts = file.name?.split('.');\r\n let ext = parts?.length ? `image/${parts.pop()?.toLowerCase()}` : 'image/jpeg';\r\n if (ext === 'image/jpg') {\r\n ext = 'image/jpeg';\r\n } else if (ext.includes('svg')) {\r\n ext = 'image/svg+xml';\r\n }\r\n if (file.size > maxSize) {\r\n window.alert(I18n.t('ra_File is too big. Max %sk allowed. Try use SVG.', Math.round(maxSize / 1024)));\r\n } else {\r\n const base64 = `data:${ext};base64,${btoa(\r\n new Uint8Array(reader.result as ArrayBufferLike).reduce(\r\n (data, byte) => data + String.fromCharCode(byte),\r\n '',\r\n ),\r\n )}`;\r\n\r\n if (onChange) {\r\n onChange(base64);\r\n } else {\r\n console.log(base64);\r\n }\r\n }\r\n };\r\n reader.readAsArrayBuffer(file);\r\n }\r\n\r\n render(): JSX.Element {\r\n const { disabled, icon, removeIconFunc, error, crop, onChange } = this.props;\r\n const maxSize = this.props.maxSize || 10 * 1024;\r\n let accept = this.props.accept || { 'image/*': [] };\r\n const { uploadFile, anchorEl, cropHandler } = this.state;\r\n\r\n // covert '\"image/png\"' to { 'image/*': [] }\r\n if (typeof accept === 'string') {\r\n accept = { [accept]: [] };\r\n } else if (Array.isArray(accept)) {\r\n const result: Record<string, string[]> = {};\r\n accept.forEach(item => {\r\n result[item] = [];\r\n });\r\n accept = result;\r\n }\r\n\r\n return (\r\n <Dropzone\r\n disabled={!!disabled || cropHandler}\r\n key=\"dropzone\"\r\n multiple={false}\r\n accept={accept}\r\n maxSize={maxSize}\r\n onDragEnter={() => this.setState({ uploadFile: 'dragging' })}\r\n onDragLeave={() => this.setState({ uploadFile: true })}\r\n onDrop={(acceptedFiles: File[], errors: FileRejection[]) => {\r\n this.setState({ uploadFile: false });\r\n if (!acceptedFiles.length) {\r\n window.alert(errors?.[0]?.errors?.[0]?.message || I18n.t('ra_Cannot upload'));\r\n } else {\r\n this.onDrop(acceptedFiles);\r\n }\r\n }}\r\n >\r\n {({ getRootProps, getInputProps }) => (\r\n <div\r\n style={{\r\n ...styles.uploadDiv,\r\n ...(uploadFile === 'dragging' ? styles.uploadDivDragging : undefined),\r\n ...styles.dropZone,\r\n ...(disabled ? styles.disabledOpacity : undefined),\r\n ...(!icon ? styles.dropZoneEmpty : undefined),\r\n }}\r\n {...getRootProps()}\r\n >\r\n <input {...getInputProps()} />\r\n <div style={{ ...styles.uploadCenterDiv, ...(error ? styles.error : undefined) }}>\r\n {!icon ? (\r\n <div style={styles.uploadCenterTextAndIcon}>\r\n <UploadIcon style={styles.uploadCenterIcon} />\r\n <div style={styles.uploadCenterText}>\r\n {uploadFile === 'dragging'\r\n ? I18n.t('ra_Drop file here')\r\n : I18n.t(\r\n 'ra_Place your files here or click here to open the browse dialog',\r\n )}\r\n </div>\r\n </div>\r\n ) : (\r\n removeIconFunc &&\r\n !cropHandler && (\r\n <div style={styles.buttonRemoveWrapper}>\r\n <Tooltip\r\n title={I18n.t('ra_Clear')}\r\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\r\n >\r\n <IconButton\r\n size=\"large\"\r\n onClick={e => {\r\n removeIconFunc && removeIconFunc();\r\n e.stopPropagation();\r\n }}\r\n >\r\n <IconClose />\r\n </IconButton>\r\n </Tooltip>\r\n </div>\r\n )\r\n )}\r\n {icon && crop && (\r\n <div style={styles.buttonCropWrapper}>\r\n <Tooltip\r\n title={I18n.t('ra_Crop')}\r\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\r\n >\r\n <IconButton\r\n size=\"large\"\r\n onClick={e => {\r\n if (!cropHandler) {\r\n this.setState({ cropHandler: true });\r\n } else {\r\n this.setState({ anchorEl: e.currentTarget });\r\n }\r\n e.stopPropagation();\r\n }}\r\n >\r\n <CropIcon color={cropHandler ? 'primary' : 'inherit'} />\r\n </IconButton>\r\n </Tooltip>\r\n <Menu\r\n anchorEl={anchorEl}\r\n keepMounted\r\n open={Boolean(anchorEl)}\r\n onClose={() => this.setState({ anchorEl: null })}\r\n >\r\n <MenuItem\r\n onClick={() =>\r\n this.setState({ anchorEl: null, cropHandler: false }, () => {\r\n const imageElement = this.cropperRef?.current?.cropper;\r\n if (imageElement) {\r\n if (onChange) {\r\n onChange(imageElement.getCroppedCanvas().toDataURL());\r\n } else {\r\n console.log(imageElement.getCroppedCanvas().toDataURL());\r\n }\r\n }\r\n })\r\n }\r\n >\r\n {I18n.t('ra_Save')}\r\n </MenuItem>\r\n <MenuItem onClick={() => this.setState({ anchorEl: null, cropHandler: false })}>\r\n {I18n.t('ra_Close')}\r\n </MenuItem>\r\n </Menu>\r\n </div>\r\n )}\r\n {icon && !cropHandler ? (\r\n <Icon\r\n src={icon}\r\n style={styles.image}\r\n alt=\"icon\"\r\n />\r\n ) : null}\r\n\r\n {icon && crop && cropHandler ? (\r\n <Cropper\r\n ref={this.cropperRef}\r\n style={styles.image}\r\n src={icon}\r\n initialAspectRatio={1}\r\n viewMode={1}\r\n guides={false}\r\n minCropBoxHeight={10}\r\n minCropBoxWidth={10}\r\n background={false}\r\n checkOrientation={false}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n )}\r\n </Dropzone>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"UploadImage.js","sourceRoot":"./src/","sources":["Components/UploadImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAC9D,OAAO,QAAgC,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAA4B,MAAM,eAAe,CAAC;AAElE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,IAAI,IAAI,QAAQ,EAAE,kBAAkB,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE7G,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,uCAAuC;AACvC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiTrB,CAAC;AAEF,MAAM,MAAM,GAAwC;IAChD,QAAQ,EAAE;QACN,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,GAAG;QACX,QAAQ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C,CAAC,CAAC,CACpB,oBAAC,IAAI,IACD,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,GAAG,EAAC,MAAM,GACZ,CACL,CAAC,CAAC,CAAC,IAAI;gBAEP,IAAI,IAAI,IAAI,IAAI,WAAW,CAAC,CAAC,CAAC,CAC3B,oBAAC,OAAO,IACJ,GAAG,EAAE,IAAI,CAAC,UAAU,EACpB,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,GAAG,EAAE,IAAI,EACT,kBAAkB,EAAE,CAAC,EACrB,QAAQ,EAAE,CAAC,EACX,MAAM,EAAE,KAAK,EACb,gBAAgB,EAAE,EAAE,EACpB,eAAe,EAAE,EAAE,EACnB,UAAU,EAAE,KAAK,EACjB,gBAAgB,EAAE,KAAK,GACzB,CACL,CAAC,CAAC,CAAC,IAAI,CACN,CACJ,CACT,CACM,CACd,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { Component, createRef, type JSX } from 'react';\nimport Dropzone, { type FileRejection } from 'react-dropzone';\nimport { Cropper, type ReactCropperElement } from 'react-cropper';\n\nimport { Menu, MenuItem, Tooltip, IconButton } from '@mui/material';\n\nimport { Close as IconClose, Crop as CropIcon, UploadFileOutlined as UploadIcon } from '@mui/icons-material';\n\nimport { I18n } from '../i18n';\nimport { Icon } from './Icon';\n\n// import 'cropperjs/dist/cropper.css';\nconst cropperStyles = `\n/*!\n * Cropper.js v1.5.12\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2021-06-12T08:00:11.623Z\n */\n\n.cropper-container {\n direction: ltr;\n font-size: 0;\n line-height: 0;\n position: relative;\n -ms-touch-action: none;\n touch-action: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.cropper-container img {\n display: block;\n height: 100%;\n image-orientation: 0deg;\n max-height: none !important;\n max-width: none !important;\n min-height: 0 !important;\n min-width: 0 !important;\n width: 100%;\n}\n\n.cropper-wrap-box,\n.cropper-canvas,\n.cropper-drag-box,\n.cropper-crop-box,\n.cropper-modal {\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.cropper-wrap-box,\n.cropper-canvas {\n overflow: hidden;\n}\n\n.cropper-drag-box {\n background-color: #fff;\n opacity: 0;\n}\n\n.cropper-modal {\n background-color: #000;\n opacity: 0.5;\n}\n\n.cropper-view-box {\n display: block;\n height: 100%;\n outline: 1px solid #39f;\n outline-color: rgba(51, 153, 255, 0.75);\n overflow: hidden;\n width: 100%;\n}\n\n.cropper-dashed {\n border: 0 dashed #eee;\n display: block;\n opacity: 0.5;\n position: absolute;\n}\n\n.cropper-dashed.dashed-h {\n border-bottom-width: 1px;\n border-top-width: 1px;\n height: calc(100% / 3);\n left: 0;\n top: calc(100% / 3);\n width: 100%;\n}\n\n.cropper-dashed.dashed-v {\n border-left-width: 1px;\n border-right-width: 1px;\n height: 100%;\n left: calc(100% / 3);\n top: 0;\n width: calc(100% / 3);\n}\n\n.cropper-center {\n display: block;\n height: 0;\n left: 50%;\n opacity: 0.75;\n position: absolute;\n top: 50%;\n width: 0;\n}\n\n.cropper-center::before,\n.cropper-center::after {\n background-color: #eee;\n content: ' ';\n display: block;\n position: absolute;\n}\n\n.cropper-center::before {\n height: 1px;\n left: -3px;\n top: 0;\n width: 7px;\n}\n\n.cropper-center::after {\n height: 7px;\n left: 0;\n top: -3px;\n width: 1px;\n}\n\n.cropper-face,\n.cropper-line,\n.cropper-point {\n display: block;\n height: 100%;\n opacity: 0.1;\n position: absolute;\n width: 100%;\n}\n\n.cropper-face {\n background-color: #fff;\n left: 0;\n top: 0;\n}\n\n.cropper-line {\n background-color: #39f;\n}\n\n.cropper-line.line-e {\n cursor: ew-resize;\n right: -3px;\n top: 0;\n width: 5px;\n}\n\n.cropper-line.line-n {\n cursor: ns-resize;\n height: 5px;\n left: 0;\n top: -3px;\n}\n\n.cropper-line.line-w {\n cursor: ew-resize;\n left: -3px;\n top: 0;\n width: 5px;\n}\n\n.cropper-line.line-s {\n bottom: -3px;\n cursor: ns-resize;\n height: 5px;\n left: 0;\n}\n\n.cropper-point {\n background-color: #39f;\n height: 5px;\n opacity: 0.75;\n width: 5px;\n}\n\n.cropper-point.point-e {\n cursor: ew-resize;\n margin-top: -3px;\n right: -3px;\n top: 50%;\n}\n\n.cropper-point.point-n {\n cursor: ns-resize;\n left: 50%;\n margin-left: -3px;\n top: -3px;\n}\n\n.cropper-point.point-w {\n cursor: ew-resize;\n left: -3px;\n margin-top: -3px;\n top: 50%;\n}\n\n.cropper-point.point-s {\n bottom: -3px;\n cursor: s-resize;\n left: 50%;\n margin-left: -3px;\n}\n\n.cropper-point.point-ne {\n cursor: nesw-resize;\n right: -3px;\n top: -3px;\n}\n\n.cropper-point.point-nw {\n cursor: nwse-resize;\n left: -3px;\n top: -3px;\n}\n\n.cropper-point.point-sw {\n bottom: -3px;\n cursor: nesw-resize;\n left: -3px;\n}\n\n.cropper-point.point-se {\n bottom: -3px;\n cursor: nwse-resize;\n height: 20px;\n opacity: 1;\n right: -3px;\n width: 20px;\n}\n\n@media (min-width: 768px) {\n .cropper-point.point-se {\n height: 15px;\n width: 15px;\n }\n}\n\n@media (min-width: 992px) {\n .cropper-point.point-se {\n height: 10px;\n width: 10px;\n }\n}\n\n@media (min-width: 1200px) {\n .cropper-point.point-se {\n height: 5px;\n opacity: 0.75;\n width: 5px;\n }\n}\n\n.cropper-point.point-se::before {\n background-color: #39f;\n bottom: -50%;\n content: ' ';\n display: block;\n height: 200%;\n opacity: 0;\n position: absolute;\n right: -50%;\n width: 200%;\n}\n\n.cropper-invisible {\n opacity: 0;\n}\n\n.cropper-bg {\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC');\n}\n\n.cropper-hide {\n display: block;\n height: 0;\n position: absolute;\n width: 0;\n}\n\n.cropper-hidden {\n display: none !important;\n}\n\n.cropper-move {\n cursor: move;\n}\n\n.cropper-crop {\n cursor: crosshair;\n}\n\n.cropper-disabled .cropper-drag-box,\n.cropper-disabled .cropper-face,\n.cropper-disabled .cropper-line,\n.cropper-disabled .cropper-point {\n cursor: not-allowed;\n}\n`;\n\nconst styles: Record<string, React.CSSProperties> = {\n dropZone: {\n width: '100%',\n height: 100,\n position: 'relative',\n },\n dropZoneEmpty: {},\n image: {\n objectFit: 'contain',\n margin: 'auto',\n display: 'flex',\n width: '100%',\n height: '100%',\n },\n\n uploadDiv: {\n position: 'relative',\n width: '100%',\n height: 300,\n opacity: 0.9,\n marginTop: 30,\n cursor: 'pointer',\n outline: 'none',\n },\n uploadDivDragging: {\n opacity: 1,\n background: 'rgba(128,255,128,0.1)',\n },\n\n uploadCenterDiv: {\n margin: 5,\n border: '3px dashed grey',\n borderRadius: 5,\n width: 'calc(100% - 10px)',\n height: 'calc(100% - 10px)',\n position: 'relative',\n display: 'flex',\n },\n uploadCenterIcon: {\n paddingTop: 10,\n width: 48,\n height: 48,\n },\n uploadCenterText: {\n fontSize: 16,\n },\n uploadCenterTextAndIcon: {\n textAlign: 'center',\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n },\n disabledOpacity: {\n opacity: 0.3,\n cursor: 'default',\n },\n buttonRemoveWrapper: {\n position: 'absolute',\n zIndex: 222,\n right: 0,\n },\n buttonCropWrapper: {\n position: 'absolute',\n zIndex: 222,\n right: 0,\n top: 50,\n },\n error: {\n border: '2px solid red',\n boxSizing: 'border-box',\n },\n};\n\ninterface UploadImageProps {\n maxSize?: number;\n disabled?: boolean;\n crop?: boolean;\n error?: boolean;\n onChange: (base64: string) => void | undefined;\n icon: string | null;\n removeIconFunc: () => void | null;\n accept?: Record<string, string[]>;\n}\n\ninterface UploadImageState {\n uploadFile: boolean | 'dragging';\n anchorEl: HTMLElement | null;\n cropHandler: boolean;\n}\n\nexport class UploadImage extends Component<UploadImageProps, UploadImageState> {\n private readonly cropperRef: React.RefObject<ReactCropperElement>;\n\n constructor(props: UploadImageProps) {\n super(props);\n\n this.state = {\n uploadFile: false,\n anchorEl: null,\n cropHandler: false,\n };\n this.cropperRef = createRef();\n\n if (!window.document.getElementById('cropper-style-json-component')) {\n const style = window.document.createElement('style');\n style.setAttribute('id', 'cropper-style-json-component');\n style.innerHTML = cropperStyles;\n window.document.head.appendChild(style);\n }\n }\n\n onDrop(acceptedFiles: File[]): void {\n const onChange = this.props.onChange;\n const maxSize = this.props.maxSize || 10 * 1024;\n\n const file = acceptedFiles[0];\n const reader = new FileReader();\n\n reader.onabort = () => console.log('file reading was aborted');\n reader.onerror = () => console.log('file reading has failed');\n reader.onload = () => {\n if (!file || !file.name) {\n return;\n }\n const parts = file.name?.split('.');\n let ext = parts?.length ? `image/${parts.pop()?.toLowerCase()}` : 'image/jpeg';\n if (ext === 'image/jpg') {\n ext = 'image/jpeg';\n } else if (ext.includes('svg')) {\n ext = 'image/svg+xml';\n }\n if (file.size > maxSize) {\n window.alert(I18n.t('ra_File is too big. Max %sk allowed. Try use SVG.', Math.round(maxSize / 1024)));\n } else {\n const base64 = `data:${ext};base64,${btoa(\n new Uint8Array(reader.result as ArrayBufferLike).reduce(\n (data, byte) => data + String.fromCharCode(byte),\n '',\n ),\n )}`;\n\n if (onChange) {\n onChange(base64);\n } else {\n console.log(base64);\n }\n }\n };\n reader.readAsArrayBuffer(file);\n }\n\n render(): JSX.Element {\n const { disabled, icon, removeIconFunc, error, crop, onChange } = this.props;\n const maxSize = this.props.maxSize || 10 * 1024;\n let accept = this.props.accept || { 'image/*': [] };\n const { uploadFile, anchorEl, cropHandler } = this.state;\n\n // covert '\"image/png\"' to { 'image/*': [] }\n if (typeof accept === 'string') {\n accept = { [accept]: [] };\n } else if (Array.isArray(accept)) {\n const result: Record<string, string[]> = {};\n accept.forEach(item => {\n result[item] = [];\n });\n accept = result;\n }\n\n return (\n <Dropzone\n disabled={!!disabled || cropHandler}\n key=\"dropzone\"\n multiple={false}\n accept={accept}\n maxSize={maxSize}\n onDragEnter={() => this.setState({ uploadFile: 'dragging' })}\n onDragLeave={() => this.setState({ uploadFile: true })}\n onDrop={(acceptedFiles: File[], errors: FileRejection[]) => {\n this.setState({ uploadFile: false });\n if (!acceptedFiles.length) {\n window.alert(errors?.[0]?.errors?.[0]?.message || I18n.t('ra_Cannot upload'));\n } else {\n this.onDrop(acceptedFiles);\n }\n }}\n >\n {({ getRootProps, getInputProps }) => (\n <div\n style={{\n ...styles.uploadDiv,\n ...(uploadFile === 'dragging' ? styles.uploadDivDragging : undefined),\n ...styles.dropZone,\n ...(disabled ? styles.disabledOpacity : undefined),\n ...(!icon ? styles.dropZoneEmpty : undefined),\n }}\n {...getRootProps()}\n >\n <input {...getInputProps()} />\n <div style={{ ...styles.uploadCenterDiv, ...(error ? styles.error : undefined) }}>\n {!icon ? (\n <div style={styles.uploadCenterTextAndIcon}>\n <UploadIcon style={styles.uploadCenterIcon} />\n <div style={styles.uploadCenterText}>\n {uploadFile === 'dragging'\n ? I18n.t('ra_Drop file here')\n : I18n.t(\n 'ra_Place your files here or click here to open the browse dialog',\n )}\n </div>\n </div>\n ) : (\n removeIconFunc &&\n !cropHandler && (\n <div style={styles.buttonRemoveWrapper}>\n <Tooltip\n title={I18n.t('ra_Clear')}\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\n >\n <IconButton\n size=\"large\"\n onClick={e => {\n removeIconFunc && removeIconFunc();\n e.stopPropagation();\n }}\n >\n <IconClose />\n </IconButton>\n </Tooltip>\n </div>\n )\n )}\n {icon && crop && (\n <div style={styles.buttonCropWrapper}>\n <Tooltip\n title={I18n.t('ra_Crop')}\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\n >\n <IconButton\n size=\"large\"\n onClick={e => {\n if (!cropHandler) {\n this.setState({ cropHandler: true });\n } else {\n this.setState({ anchorEl: e.currentTarget });\n }\n e.stopPropagation();\n }}\n >\n <CropIcon color={cropHandler ? 'primary' : 'inherit'} />\n </IconButton>\n </Tooltip>\n <Menu\n anchorEl={anchorEl}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={() => this.setState({ anchorEl: null })}\n >\n <MenuItem\n onClick={() =>\n this.setState({ anchorEl: null, cropHandler: false }, () => {\n const imageElement = this.cropperRef?.current?.cropper;\n if (imageElement) {\n if (onChange) {\n onChange(imageElement.getCroppedCanvas().toDataURL());\n } else {\n console.log(imageElement.getCroppedCanvas().toDataURL());\n }\n }\n })\n }\n >\n {I18n.t('ra_Save')}\n </MenuItem>\n <MenuItem onClick={() => this.setState({ anchorEl: null, cropHandler: false })}>\n {I18n.t('ra_Close')}\n </MenuItem>\n </Menu>\n </div>\n )}\n {icon && !cropHandler ? (\n <Icon\n src={icon}\n style={styles.image}\n alt=\"icon\"\n />\n ) : null}\n\n {icon && crop && cropHandler ? (\n <Cropper\n ref={this.cropperRef}\n style={styles.image}\n src={icon}\n initialAspectRatio={1}\n viewMode={1}\n guides={false}\n minCropBoxHeight={10}\n minCropBoxWidth={10}\n background={false}\n checkOrientation={false}\n />\n ) : null}\n </div>\n </div>\n )}\n </Dropzone>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"withWidth.js","sourceRoot":"./src/","sources":["Components/withWidth.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAmB,aAAa,EAAE,MAAM,eAAe,CAAC;AAE/D,SAAS,QAAQ;IACb,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IACnD,OAAO,CACH,IAAI,CAAC,MAAM,CAAC,CAAC,MAAyB,EAAE,GAAe,EAAE,EAAE;QACvD,sDAAsD;QACtD,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACzD,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;IAC7C,CAAC,EAAE,IAAI,CAAC,IAAI,IAAI,CACnB,CAAC;AACN,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,SAAS;IACrB,OAAO,CAAC,gBAA4C,EAAE,EAAE;QACpD,OAAO,SAAS,YAAY,CAAC,KAA0B;YACnD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;YACzB,OAAO,CACH,oBAAC,gBAAgB,OACT,KAAK,EACT,KAAK,EAAE,KAAK,GACd,CACL,CAAC;QACN,CAAC,CAAC;IACN,CAAC,CAAC;AACN,CAAC","sourcesContent":["import React, { type JSXElementConstructor, type JSX } from 'react';\r\nimport { useTheme } from '@mui/material/styles';\r\nimport { type Breakpoint, useMediaQuery } from '@mui/material';\r\n\r\nfunction useWidth(): Breakpoint {\r\n const theme = useTheme();\r\n const keys = [...theme.breakpoints.keys].reverse();\r\n return (\r\n keys.reduce((output: Breakpoint | null, key: Breakpoint) => {\r\n // eslint-disable-next-line react-hooks/rules-of-hooks\r\n const matches = useMediaQuery(theme.breakpoints.up(key));\r\n return !output && matches ? key : output;\r\n }, null) || 'xs'\r\n );\r\n}\r\n\r\n// FIXME checkout https://mui.com/components/use-media-query/#migrating-from-withwidth\r\nexport function withWidth() {\r\n return (WrappedComponent: JSXElementConstructor<any>) => {\r\n return function AnyComponent(props: Record<string, any>): JSX.Element {\r\n const width = useWidth();\r\n return (\r\n <WrappedComponent\r\n {...props}\r\n width={width}\r\n />\r\n );\r\n };\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"withWidth.js","sourceRoot":"./src/","sources":["Components/withWidth.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAmB,aAAa,EAAE,MAAM,eAAe,CAAC;AAE/D,SAAS,QAAQ;IACb,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;IACnD,OAAO,CACH,IAAI,CAAC,MAAM,CAAC,CAAC,MAAyB,EAAE,GAAe,EAAE,EAAE;QACvD,sDAAsD;QACtD,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACzD,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;IAC7C,CAAC,EAAE,IAAI,CAAC,IAAI,IAAI,CACnB,CAAC;AACN,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,SAAS;IACrB,OAAO,CAAC,gBAA4C,EAAE,EAAE;QACpD,OAAO,SAAS,YAAY,CAAC,KAA0B;YACnD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;YACzB,OAAO,CACH,oBAAC,gBAAgB,OACT,KAAK,EACT,KAAK,EAAE,KAAK,GACd,CACL,CAAC;QACN,CAAC,CAAC;IACN,CAAC,CAAC;AACN,CAAC","sourcesContent":["import React, { type JSXElementConstructor, type JSX } from 'react';\nimport { useTheme } from '@mui/material/styles';\nimport { type Breakpoint, useMediaQuery } from '@mui/material';\n\nfunction useWidth(): Breakpoint {\n const theme = useTheme();\n const keys = [...theme.breakpoints.keys].reverse();\n return (\n keys.reduce((output: Breakpoint | null, key: Breakpoint) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const matches = useMediaQuery(theme.breakpoints.up(key));\n return !output && matches ? key : output;\n }, null) || 'xs'\n );\n}\n\n// FIXME checkout https://mui.com/components/use-media-query/#migrating-from-withwidth\nexport function withWidth() {\n return (WrappedComponent: JSXElementConstructor<any>) => {\n return function AnyComponent(props: Record<string, any>): JSX.Element {\n const width = useWidth();\n return (\n <WrappedComponent\n {...props}\n width={width}\n />\n );\n };\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Connection.js","sourceRoot":"./src/","sources":["Connection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { Connection, PROGRESS, ERRORS, PERMISSION_ERROR } from '@iobroker/socket-client';\r\n"]}
1
+ {"version":3,"file":"Connection.js","sourceRoot":"./src/","sources":["Connection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { Connection, PROGRESS, ERRORS, PERMISSION_ERROR } from '@iobroker/socket-client';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ComplexCron.js","sourceRoot":"./src/","sources":["Dialogs/ComplexCron.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEjG,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,aAAa,EA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nB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAC9B,KAAK,EAAC,SAAS,EACf,SAAS,EAAE,oBAAC,MAAM,OAAG,IAEpB,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAC5B;gBACT,oBAAC,MAAM,IACH,KAAK,EAAC,MAAM,EACZ,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,SAAS,EAAE,oBAAC,UAAU,OAAG,IAExB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\r\n\r\nimport { Button, DialogTitle, DialogContent, DialogActions, Dialog } from '@mui/material';\r\n\r\nimport { Check as IconOk, Cancel as IconCancel, Delete as IconClear } from '@mui/icons-material';\r\n\r\nimport { ComplexCron } from '../Components/ComplexCron';\r\nimport { DialogConfirm } from '../Dialogs/Confirm';\r\n\r\nimport { I18n } from '../i18n';\r\n\r\n// Generate cron expression\r\nconst styles: Record<string, React.CSSProperties> = {\r\n headerID: {\r\n fontWeight: 'bold',\r\n fontStyle: 'italic',\r\n },\r\n radio: {\r\n display: 'inline-block',\r\n },\r\n dialogPaper: {\r\n height: 'calc(100% - 96px)',\r\n },\r\n};\r\n\r\ninterface DialogCronProps {\r\n onClose: () => void;\r\n onOk: (cron: string | false) => void;\r\n title?: string;\r\n cron?: string;\r\n cancel?: string;\r\n ok?: string;\r\n clear?: string;\r\n clearButton?: boolean;\r\n}\r\n\r\ninterface DialogCronState {\r\n cron: string;\r\n showWarning: '' | 'everySecond' | 'everyMinute';\r\n}\r\n\r\nexport class DialogComplexCron extends React.Component<DialogCronProps, DialogCronState> {\r\n constructor(props: DialogCronProps) {\r\n super(props);\r\n let cron;\r\n if (this.props.cron && typeof this.props.cron === 'string' && this.props.cron.replace(/^[\"']/, '')[0] !== '{') {\r\n cron = this.props.cron.replace(/['\"]/g, '').trim();\r\n } else {\r\n cron = this.props.cron || '{}';\r\n if (typeof cron === 'string') {\r\n cron = cron.replace(/^[\"']/, '').replace(/[\"']\\n?$/, '');\r\n }\r\n }\r\n\r\n this.state = {\r\n showWarning: '',\r\n cron,\r\n };\r\n }\r\n\r\n handleCancel(): void {\r\n this.props.onClose();\r\n }\r\n\r\n handleOk(ignoreCheck?: boolean): void {\r\n if (!ignoreCheck) {\r\n // Check if the CRON will be executed every second or every minute and warn about it\r\n const cron = ComplexCron.cron2state(this.state.cron);\r\n if (cron.seconds === '*' || cron.seconds === '*/1') {\r\n this.setState({ showWarning: 'everySecond' });\r\n return;\r\n }\r\n if (cron.minutes === '*' || cron.minutes === '*/1') {\r\n this.setState({ showWarning: 'everyMinute' });\r\n return;\r\n }\r\n }\r\n\r\n this.props.onOk(this.state.cron);\r\n this.props.onClose();\r\n }\r\n\r\n renderWarningDialog(): JSX.Element | null {\r\n if (!this.state.showWarning) {\r\n return null;\r\n }\r\n return (\r\n <DialogConfirm\r\n title={I18n.t('ra_Please confirm')}\r\n text={I18n.t(\r\n this.state.showWarning === 'everySecond'\r\n ? 'ra_The schedule will be executed every second. Are you sure?'\r\n : 'ra_The schedule will be executed every minute. Are you sure?',\r\n )}\r\n onClose={(ok: boolean) =>\r\n this.setState({ showWarning: '' }, () => {\r\n if (ok) {\r\n this.handleOk(true);\r\n }\r\n })\r\n }\r\n />\r\n );\r\n }\r\n\r\n handleClear(): void {\r\n this.props.onOk(false);\r\n this.props.onClose();\r\n }\r\n\r\n render(): JSX.Element {\r\n return (\r\n <Dialog\r\n onClose={() => {}}\r\n maxWidth=\"md\"\r\n fullWidth\r\n sx={{ '& .MuiDialog-paper': styles.dialogPaper }}\r\n open={!0}\r\n aria-labelledby=\"cron-dialog-title\"\r\n >\r\n {this.renderWarningDialog()}\r\n <DialogTitle id=\"cron-dialog-title\">{this.props.title || I18n.t('ra_Define schedule...')}</DialogTitle>\r\n <DialogContent style={{ height: '100%', overflow: 'hidden' }}>\r\n <ComplexCron\r\n cronExpression={this.state.cron}\r\n onChange={cron => this.setState({ cron })}\r\n language={I18n.getLanguage()}\r\n />\r\n </DialogContent>\r\n <DialogActions>\r\n {!!this.props.clearButton && (\r\n <Button\r\n color=\"grey\"\r\n variant=\"contained\"\r\n onClick={() => this.handleClear()}\r\n startIcon={<IconClear />}\r\n >\r\n {this.props.clear || I18n.t('ra_Clear')}\r\n </Button>\r\n )}\r\n <Button\r\n variant=\"contained\"\r\n onClick={() => this.handleOk()}\r\n color=\"primary\"\r\n startIcon={<IconOk />}\r\n >\r\n {this.props.ok || I18n.t('ra_Ok')}\r\n </Button>\r\n <Button\r\n color=\"grey\"\r\n variant=\"contained\"\r\n onClick={() => this.handleCancel()}\r\n startIcon={<IconCancel />}\r\n >\r\n {this.props.cancel || I18n.t('ra_Cancel')}\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ComplexCron.js","sourceRoot":"./src/","sources":["Dialogs/ComplexCron.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEjG,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,2BAA2B;AAC3B,MAAM,MAAM,GAAwC;IAChD,QAAQ,EAAE;QACN,UAAU,EAAE,MAAM;Q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AAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAC5B;gBACT,oBAAC,MAAM,IACH,KAAK,EAAC,MAAM,EACZ,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,SAAS,EAAE,oBAAC,UAAU,OAAG,IAExB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Button, DialogTitle, DialogContent, DialogActions, Dialog } from '@mui/material';\n\nimport { Check as IconOk, Cancel as IconCancel, Delete as IconClear } from '@mui/icons-material';\n\nimport { ComplexCron } from '../Components/ComplexCron';\nimport { DialogConfirm } from '../Dialogs/Confirm';\n\nimport { I18n } from '../i18n';\n\n// Generate cron expression\nconst styles: Record<string, React.CSSProperties> = {\n headerID: {\n fontWeight: 'bold',\n fontStyle: 'italic',\n },\n radio: {\n display: 'inline-block',\n },\n dialogPaper: {\n height: 'calc(100% - 96px)',\n },\n};\n\ninterface DialogCronProps {\n onClose: () => void;\n onOk: (cron: string | false) => void;\n title?: string;\n cron?: string;\n cancel?: string;\n ok?: string;\n clear?: string;\n clearButton?: boolean;\n}\n\ninterface DialogCronState {\n cron: string;\n showWarning: '' | 'everySecond' | 'everyMinute';\n}\n\nexport class DialogComplexCron extends React.Component<DialogCronProps, DialogCronState> {\n constructor(props: DialogCronProps) {\n super(props);\n let cron;\n if (this.props.cron && typeof this.props.cron === 'string' && this.props.cron.replace(/^[\"']/, '')[0] !== '{') {\n cron = this.props.cron.replace(/['\"]/g, '').trim();\n } else {\n cron = this.props.cron || '{}';\n if (typeof cron === 'string') {\n cron = cron.replace(/^[\"']/, '').replace(/[\"']\\n?$/, '');\n }\n }\n\n this.state = {\n showWarning: '',\n cron,\n };\n }\n\n handleCancel(): void {\n this.props.onClose();\n }\n\n handleOk(ignoreCheck?: boolean): void {\n if (!ignoreCheck) {\n // Check if the CRON will be executed every second or every minute and warn about it\n const cron = ComplexCron.cron2state(this.state.cron);\n if (cron.seconds === '*' || cron.seconds === '*/1') {\n this.setState({ showWarning: 'everySecond' });\n return;\n }\n if (cron.minutes === '*' || cron.minutes === '*/1') {\n this.setState({ showWarning: 'everyMinute' });\n return;\n }\n }\n\n this.props.onOk(this.state.cron);\n this.props.onClose();\n }\n\n renderWarningDialog(): JSX.Element | null {\n if (!this.state.showWarning) {\n return null;\n }\n return (\n <DialogConfirm\n title={I18n.t('ra_Please confirm')}\n text={I18n.t(\n this.state.showWarning === 'everySecond'\n ? 'ra_The schedule will be executed every second. Are you sure?'\n : 'ra_The schedule will be executed every minute. Are you sure?',\n )}\n onClose={(ok: boolean) =>\n this.setState({ showWarning: '' }, () => {\n if (ok) {\n this.handleOk(true);\n }\n })\n }\n />\n );\n }\n\n handleClear(): void {\n this.props.onOk(false);\n this.props.onClose();\n }\n\n render(): JSX.Element {\n return (\n <Dialog\n onClose={() => {}}\n maxWidth=\"md\"\n fullWidth\n sx={{ '& .MuiDialog-paper': styles.dialogPaper }}\n open={!0}\n aria-labelledby=\"cron-dialog-title\"\n >\n {this.renderWarningDialog()}\n <DialogTitle id=\"cron-dialog-title\">{this.props.title || I18n.t('ra_Define schedule...')}</DialogTitle>\n <DialogContent style={{ height: '100%', overflow: 'hidden' }}>\n <ComplexCron\n cronExpression={this.state.cron}\n onChange={cron => this.setState({ cron })}\n language={I18n.getLanguage()}\n />\n </DialogContent>\n <DialogActions>\n {!!this.props.clearButton && (\n <Button\n color=\"grey\"\n variant=\"contained\"\n onClick={() => this.handleClear()}\n startIcon={<IconClear />}\n >\n {this.props.clear || I18n.t('ra_Clear')}\n </Button>\n )}\n <Button\n variant=\"contained\"\n onClick={() => this.handleOk()}\n color=\"primary\"\n startIcon={<IconOk />}\n >\n {this.props.ok || I18n.t('ra_Ok')}\n </Button>\n <Button\n color=\"grey\"\n variant=\"contained\"\n onClick={() => this.handleCancel()}\n startIcon={<IconCancel />}\n >\n {this.props.cancel || I18n.t('ra_Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Confirm.js","sourceRoot":"./src/","sources":["Dialogs/Confirm.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uHAAuH;AACvH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EACH,MAAM,EACN,MAAM,EACN,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,QAAQ,GACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,MAAM,GAAwC;IAChD,QAAQ,EAAE;QACN,QAAQ,EAAE,EAAE;KACf;IACD,YAAY,EAAE;QACV,WAAW;QACX,SAAS,EAAE,MAAM;KACpB;CACJ,CAAC;AA6BF,MAAM,OAAO,aAAc,SAAQ,SAAiD;IAChF,YAAY,KAAyB;QACjC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC;YAC/D,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QAC3E,CAAC;QACD,IAAI,QAAQ,GAAqB,KAAK,CAAC;QAEvC,IAAI,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC;YACrC,QAAQ;gBACJ,QAAQ,CAAC,CAAE,MAAc,CAAC,aAAa,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;oBAC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,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,GACnE,EAEN,KAAK,EACD,IAAI,CAAC,KAAK,CAAC,YAAY;4BACvB,IAAI,CAAC,CAAC,CACF,0CAA0C,EAC1C,CAAC,IAAI,CAAC,KAAK,CAAC,uBAAuB,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CACvD,GAEP,CACL,CAAC,CAAC,CAAC,IAAI,CACQ,CACR;YAChB,oBAAC,aAAa;gBACV,oBAAC,MAAM,IACH,EAAE,EAAE,wBAAwB,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,EAAE,EACzD,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAC9B,KAAK,EAAC,SAAS,EACf,SAAS,QACT,SAAS,EAAE,oBAAC,SAAS,OAAG,IAEvB,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAC5B;gBACT,oBAAC,MAAM,IACH,EAAE,EAAE,4BAA4B,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,EAAE,EAC7D,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,KAAK,EAAC,MAAM,EACZ,SAAS,EAAE,oBAAC,SAAS,OAAG,IAEvB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\r\n * Copyright 2019-2024 Denis Haev (bluefox) <dogafox@gmail.com>\r\n *\r\n * MIT License\r\n *\r\n */\r\n\r\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\r\nimport React, { Component, type JSX } from 'react';\r\n\r\nimport {\r\n Button,\r\n Dialog,\r\n DialogActions,\r\n DialogContent,\r\n DialogContentText,\r\n DialogTitle,\r\n FormControlLabel,\r\n Checkbox,\r\n} from '@mui/material';\r\n\r\nimport { Check as IconCheck, Close as IconClose } from '@mui/icons-material';\r\n\r\nimport { I18n } from '../i18n';\r\n\r\nconst styles: Record<string, React.CSSProperties> = {\r\n suppress: {\r\n fontSize: 12,\r\n },\r\n suppressRoot: {\r\n // it is sx\r\n marginTop: '16px',\r\n },\r\n};\r\n\r\ninterface DialogConfirmProps {\r\n /** The dialog title; default: Are you sure? (translated) */\r\n title?: string;\r\n /** The dialog text */\r\n text?: string | React.JSX.Element | React.JSX.Element[];\r\n /** Close handler. */\r\n onClose?: (ok: boolean) => void;\r\n /** if the dialog must be fill sized */\r\n fullWidth?: boolean;\r\n /** optional icon */\r\n icon?: React.JSX.Element;\r\n /** optional ok button text */\r\n ok?: string;\r\n /** optional cancel button text */\r\n cancel?: string;\r\n /** optional interval in minutes for which the confirmation dialog will be suppressed if activated. */\r\n suppressQuestionMinutes?: number;\r\n /** optional text for the suppression checkbox */\r\n suppressText?: string;\r\n /** optional name of the dialog. Used only with suppressQuestionMinutes to store the user choice */\r\n dialogName?: string;\r\n}\r\n\r\ninterface DialogConfirmState {\r\n suppress: number | boolean;\r\n}\r\n\r\nexport class DialogConfirm extends Component<DialogConfirmProps, DialogConfirmState> {\r\n constructor(props: DialogConfirmProps) {\r\n super(props);\r\n\r\n if (!this.props.dialogName && this.props.suppressQuestionMinutes) {\r\n throw new Error('dialogName required if suppressQuestionMinutes used');\r\n }\r\n let suppress: number | boolean = false;\r\n\r\n if (this.props.suppressQuestionMinutes) {\r\n suppress =\r\n parseInt(((window as any)._localStorage || window.localStorage).getItem(this.props.dialogName), 10) ||\r\n 0;\r\n\r\n if (!suppress) {\r\n suppress = false;\r\n } else if (Date.now() > suppress) {\r\n ((window as any)._localStorage || window.localStorage).removeItem(this.props.dialogName);\r\n suppress = false;\r\n }\r\n }\r\n\r\n this.state = {\r\n suppress,\r\n };\r\n }\r\n\r\n handleOk(): void {\r\n if (this.state.suppress) {\r\n ((window as any)._localStorage || window.localStorage).setItem(\r\n this.props.dialogName,\r\n Date.now() + (this.props.suppressQuestionMinutes || 2) * 60000,\r\n );\r\n }\r\n if (this.props.onClose) {\r\n this.props.onClose(true);\r\n }\r\n }\r\n\r\n handleCancel(): void {\r\n if (this.props.onClose) {\r\n this.props.onClose(false);\r\n }\r\n }\r\n\r\n render(): JSX.Element | null {\r\n if (typeof this.state.suppress === 'number') {\r\n setTimeout(() => this.props.onClose && this.props.onClose(true), 100);\r\n return null;\r\n }\r\n\r\n return (\r\n <Dialog\r\n open={!0}\r\n maxWidth=\"md\"\r\n fullWidth={this.props.fullWidth !== undefined ? this.props.fullWidth : true}\r\n onClose={(event, reason) => {\r\n if (reason !== 'backdropClick' && reason !== 'escapeKeyDown') {\r\n this.handleCancel();\r\n }\r\n }}\r\n aria-labelledby=\"ar_confirmation_dialog_title\"\r\n aria-describedby=\"ar_confirmation_dialog_description\"\r\n >\r\n <DialogTitle id=\"ar_confirmation_dialog_title\">\r\n {this.props.title || I18n.t('ra_Are you sure?')}\r\n </DialogTitle>\r\n <DialogContent>\r\n <DialogContentText id=\"ar_confirmation_dialog_description\">\r\n {this.props.icon || null}\r\n {this.props.text}\r\n {this.props.suppressQuestionMinutes ? <br /> : null}\r\n {this.props.suppressQuestionMinutes ? (\r\n <FormControlLabel\r\n sx={{\r\n '& .FormControlLabel-label': styles.suppress,\r\n '&.FormControlLabel-root': styles.suppressRoot,\r\n }}\r\n control={\r\n <Checkbox\r\n id={`ar_dialog_confirm_suppress_${this.props.dialogName || ''}`}\r\n checked={!!this.state.suppress}\r\n onChange={() => this.setState({ suppress: !this.state.suppress })}\r\n />\r\n }\r\n label={\r\n this.props.suppressText ||\r\n I18n.t(\r\n 'ra_Suppress question for next %s minutes',\r\n (this.props.suppressQuestionMinutes || 2).toString(),\r\n )\r\n }\r\n />\r\n ) : null}\r\n </DialogContentText>\r\n </DialogContent>\r\n <DialogActions>\r\n <Button\r\n id={`ar_dialog_confirm_ok_${this.props.dialogName || ''}`}\r\n variant=\"contained\"\r\n onClick={() => this.handleOk()}\r\n color=\"primary\"\r\n autoFocus\r\n startIcon={<IconCheck />}\r\n >\r\n {this.props.ok || I18n.t('ra_Ok')}\r\n </Button>\r\n <Button\r\n id={`ar_dialog_confirm_cancel_${this.props.dialogName || ''}`}\r\n variant=\"contained\"\r\n onClick={() => this.handleCancel()}\r\n color=\"grey\"\r\n startIcon={<IconClose />}\r\n >\r\n {this.props.cancel || I18n.t('ra_Cancel')}\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Confirm.js","sourceRoot":"./src/","sources":["Dialogs/Confirm.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uHAAuH;AACvH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EACH,MAAM,EACN,MAAM,EACN,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,QAAQ,GACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,MAAM,GAAwC;IAChD,QAAQ,EAAE;QACN,QAAQ,EAAE,EAAE;KACf;IACD,YAAY,EAAE;QACV,WAAW;QACX,SAAS,EAAE,MAAM;KACpB;CACJ,CAAC;AA6BF,MAAM,OAAO,aAAc,SAAQ,SAAiD;IAChF,YAAY,KAAyB;QACjC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC;YAC/D,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CA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AC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\n * Copyright 2019-2024 Denis Haev (bluefox) <dogafox@gmail.com>\n *\n * MIT License\n *\n */\n\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\nimport React, { Component, type JSX } from 'react';\n\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n FormControlLabel,\n Checkbox,\n} from '@mui/material';\n\nimport { Check as IconCheck, Close as IconClose } from '@mui/icons-material';\n\nimport { I18n } from '../i18n';\n\nconst styles: Record<string, React.CSSProperties> = {\n suppress: {\n fontSize: 12,\n },\n suppressRoot: {\n // it is sx\n marginTop: '16px',\n },\n};\n\ninterface DialogConfirmProps {\n /** The dialog title; default: Are you sure? (translated) */\n title?: string;\n /** The dialog text */\n text?: string | React.JSX.Element | React.JSX.Element[];\n /** Close handler. */\n onClose?: (ok: boolean) => void;\n /** if the dialog must be fill sized */\n fullWidth?: boolean;\n /** optional icon */\n icon?: React.JSX.Element;\n /** optional ok button text */\n ok?: string;\n /** optional cancel button text */\n cancel?: string;\n /** optional interval in minutes for which the confirmation dialog will be suppressed if activated. */\n suppressQuestionMinutes?: number;\n /** optional text for the suppression checkbox */\n suppressText?: string;\n /** optional name of the dialog. Used only with suppressQuestionMinutes to store the user choice */\n dialogName?: string;\n}\n\ninterface DialogConfirmState {\n suppress: number | boolean;\n}\n\nexport class DialogConfirm extends Component<DialogConfirmProps, DialogConfirmState> {\n constructor(props: DialogConfirmProps) {\n super(props);\n\n if (!this.props.dialogName && this.props.suppressQuestionMinutes) {\n throw new Error('dialogName required if suppressQuestionMinutes used');\n }\n let suppress: number | boolean = false;\n\n if (this.props.suppressQuestionMinutes) {\n suppress =\n parseInt(((window as any)._localStorage || window.localStorage).getItem(this.props.dialogName), 10) ||\n 0;\n\n if (!suppress) {\n suppress = false;\n } else if (Date.now() > suppress) {\n ((window as any)._localStorage || window.localStorage).removeItem(this.props.dialogName);\n suppress = false;\n }\n }\n\n this.state = {\n suppress,\n };\n }\n\n handleOk(): void {\n if (this.state.suppress) {\n ((window as any)._localStorage || window.localStorage).setItem(\n this.props.dialogName,\n Date.now() + (this.props.suppressQuestionMinutes || 2) * 60000,\n );\n }\n if (this.props.onClose) {\n this.props.onClose(true);\n }\n }\n\n handleCancel(): void {\n if (this.props.onClose) {\n this.props.onClose(false);\n }\n }\n\n render(): JSX.Element | null {\n if (typeof this.state.suppress === 'number') {\n setTimeout(() => this.props.onClose && this.props.onClose(true), 100);\n return null;\n }\n\n return (\n <Dialog\n open={!0}\n maxWidth=\"md\"\n fullWidth={this.props.fullWidth !== undefined ? this.props.fullWidth : true}\n onClose={(event, reason) => {\n if (reason !== 'backdropClick' && reason !== 'escapeKeyDown') {\n this.handleCancel();\n }\n }}\n aria-labelledby=\"ar_confirmation_dialog_title\"\n aria-describedby=\"ar_confirmation_dialog_description\"\n >\n <DialogTitle id=\"ar_confirmation_dialog_title\">\n {this.props.title || I18n.t('ra_Are you sure?')}\n </DialogTitle>\n <DialogContent>\n <DialogContentText id=\"ar_confirmation_dialog_description\">\n {this.props.icon || null}\n {this.props.text}\n {this.props.suppressQuestionMinutes ? <br /> : null}\n {this.props.suppressQuestionMinutes ? (\n <FormControlLabel\n sx={{\n '& .FormControlLabel-label': styles.suppress,\n '&.FormControlLabel-root': styles.suppressRoot,\n }}\n control={\n <Checkbox\n id={`ar_dialog_confirm_suppress_${this.props.dialogName || ''}`}\n checked={!!this.state.suppress}\n onChange={() => this.setState({ suppress: !this.state.suppress })}\n />\n }\n label={\n this.props.suppressText ||\n I18n.t(\n 'ra_Suppress question for next %s minutes',\n (this.props.suppressQuestionMinutes || 2).toString(),\n )\n }\n />\n ) : null}\n </DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button\n id={`ar_dialog_confirm_ok_${this.props.dialogName || ''}`}\n variant=\"contained\"\n onClick={() => this.handleOk()}\n color=\"primary\"\n autoFocus\n startIcon={<IconCheck />}\n >\n {this.props.ok || I18n.t('ra_Ok')}\n </Button>\n <Button\n id={`ar_dialog_confirm_cancel_${this.props.dialogName || ''}`}\n variant=\"contained\"\n onClick={() => this.handleCancel()}\n color=\"grey\"\n startIcon={<IconClose />}\n >\n {this.props.cancel || I18n.t('ra_Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Cron.js","sourceRoot":"./src/","sources":["Dialogs/Cron.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjG,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,2BAA2B;AAE3B,MAAM,MAAM,GAAwC;IAChD,WAAW,EAAE;QACT,MAAM,EAAE,mBAAmB;KAC9B;CACJ,CAAC;AAuBF,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,SAA2C;IAC7E,YAAY,KAAsB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,IAAI,CAAC;QACT,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAA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AAC,YAAY,EAAE,EAClC,KAAK,EAAC,MAAM,EACZ,SAAS,EAAE,oBAAC,UAAU,OAAG,IAExB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\r\n\r\nimport { Button, DialogTitle, DialogContent, DialogActions, Dialog, Radio } from '@mui/material';\r\n\r\nimport { Check as IconOk, Cancel as IconCancel } from '@mui/icons-material';\r\n\r\nimport { ComplexCron } from '../Components/ComplexCron';\r\nimport { SimpleCron, cron2state } from '../Components/SimpleCron';\r\nimport { Schedule } from '../Components/Schedule';\r\n\r\nimport { I18n } from '../i18n';\r\nimport type { IobTheme } from '../types';\r\n\r\n// Generate cron expression\r\n\r\nconst styles: Record<string, React.CSSProperties> = {\r\n dialogPaper: {\r\n height: 'calc(100% - 96px)',\r\n },\r\n};\r\n\r\ninterface DialogCronProps {\r\n onClose: () => void;\r\n onOk: (cron: string) => void;\r\n title?: string;\r\n cron?: string;\r\n cancel?: string;\r\n ok?: string;\r\n /** show only simple configuration */\r\n simple?: boolean;\r\n /** show only complex configuration */\r\n complex?: boolean;\r\n /** do not show wizard */\r\n noWizard?: boolean;\r\n theme: IobTheme;\r\n}\r\n\r\ninterface DialogCronState {\r\n cron: string;\r\n mode: 'simple' | 'complex' | 'wizard';\r\n}\r\n\r\nexport class DialogCron extends React.Component<DialogCronProps, DialogCronState> {\r\n constructor(props: DialogCronProps) {\r\n super(props);\r\n let cron;\r\n if (this.props.cron && typeof this.props.cron === 'string' && this.props.cron.replace(/^[\"']/, '')[0] !== '{') {\r\n cron = this.props.cron.replace(/['\"]/g, '').trim();\r\n } else {\r\n cron = this.props.cron || '{}';\r\n if (typeof cron === 'string') {\r\n cron = cron.replace(/^[\"']/, '').replace(/[\"']\\n?$/, '');\r\n }\r\n }\r\n\r\n this.state = {\r\n cron,\r\n mode: this.props.simple\r\n ? 'simple'\r\n : this.props.complex\r\n ? 'complex'\r\n : (typeof cron === 'object' || cron[0] === '{') && !this.props.noWizard\r\n ? 'wizard'\r\n : cron2state(this.props.cron || '* * * * *')\r\n ? 'simple'\r\n : 'complex',\r\n };\r\n }\r\n\r\n handleCancel(): void {\r\n this.props.onClose();\r\n }\r\n\r\n handleOk(): void {\r\n this.props.onOk(this.state.cron);\r\n this.props.onClose();\r\n }\r\n\r\n setMode(mode: 'simple' | 'complex' | 'wizard'): void {\r\n this.setState({ mode });\r\n }\r\n\r\n render(): JSX.Element {\r\n return (\r\n <Dialog\r\n onClose={() => {}}\r\n maxWidth=\"md\"\r\n fullWidth\r\n sx={{ '& .MuiDialog-paper': styles.dialogPaper }}\r\n open={!0}\r\n aria-labelledby=\"cron-dialog-title\"\r\n >\r\n <DialogTitle id=\"cron-dialog-title\">{this.props.title || I18n.t('ra_Define schedule...')}</DialogTitle>\r\n <DialogContent style={{ height: '100%', overflow: 'hidden' }}>\r\n {(this.props.simple && this.props.complex) || (!this.props.simple && !this.props.complex) ? (\r\n <div>\r\n {!this.props.simple && !this.props.complex && !this.props.noWizard && (\r\n <>\r\n <Radio\r\n key=\"wizard\"\r\n checked={this.state.mode === 'wizard'}\r\n onChange={() => this.setMode('wizard')}\r\n />\r\n <label\r\n onClick={() => this.setMode('wizard')}\r\n style={this.state.mode !== 'wizard' ? { color: 'lightgrey' } : {}}\r\n >\r\n {I18n.t('sc_wizard')}\r\n </label>\r\n </>\r\n )}\r\n\r\n {((!this.props.simple && !this.props.complex) || this.props.simple) && (\r\n <>\r\n <Radio\r\n key=\"simple\"\r\n checked={this.state.mode === 'simple'}\r\n onChange={() => this.setMode('simple')}\r\n />\r\n <label\r\n onClick={() => this.setMode('simple')}\r\n style={this.state.mode !== 'simple' ? { color: 'lightgrey' } : {}}\r\n >\r\n {I18n.t('sc_simple')}\r\n </label>\r\n </>\r\n )}\r\n\r\n {((!this.props.simple && !this.props.complex) || this.props.complex) && (\r\n <>\r\n <Radio\r\n key=\"complex\"\r\n checked={this.state.mode === 'complex'}\r\n onChange={() => this.setMode('complex')}\r\n />\r\n <label\r\n onClick={() => this.setMode('complex')}\r\n style={this.state.mode !== 'complex' ? { color: 'lightgrey' } : {}}\r\n >\r\n {I18n.t('sc_cron')}\r\n </label>\r\n </>\r\n )}\r\n </div>\r\n ) : null}\r\n\r\n {this.state.mode === 'simple' && (\r\n <SimpleCron\r\n cronExpression={this.state.cron}\r\n onChange={cron => this.setState({ cron })}\r\n language={I18n.getLanguage()}\r\n />\r\n )}\r\n {this.state.mode === 'wizard' && (\r\n <Schedule\r\n theme={this.props.theme}\r\n schedule={this.state.cron}\r\n onChange={(cron: string) => this.setState({ cron })}\r\n />\r\n )}\r\n {this.state.mode === 'complex' && (\r\n <ComplexCron\r\n cronExpression={this.state.cron}\r\n onChange={cron => this.setState({ cron })}\r\n language={I18n.getLanguage()}\r\n />\r\n )}\r\n </DialogContent>\r\n <DialogActions>\r\n <Button\r\n variant=\"contained\"\r\n onClick={() => this.handleOk()}\r\n color=\"primary\"\r\n startIcon={<IconOk />}\r\n >\r\n {this.props.ok || I18n.t('ra_Ok')}\r\n </Button>\r\n <Button\r\n variant=\"contained\"\r\n onClick={() => this.handleCancel()}\r\n color=\"grey\"\r\n startIcon={<IconCancel />}\r\n >\r\n {this.props.cancel || I18n.t('ra_Cancel')}\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Cron.js","sourceRoot":"./src/","sources":["Dialogs/Cron.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjG,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,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AC,GACrD,CACL;gBACA,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,CAC9B,oBAAC,WAAW,IACR,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAC/B,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,EACzC,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,GAC9B,CACL,CACW;YAChB,oBAAC,aAAa;gBACV,oBAAC,MAAM,IACH,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAC9B,KAAK,EAAC,SAAS,EACf,SAAS,EAAE,oBAAC,MAAM,OAAG,IAEpB,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAC5B;gBACT,oBAAC,MAAM,IACH,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,KAAK,EAAC,MAAM,EACZ,SAAS,EAAE,oBAAC,UAAU,OAAG,IAExB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Button, DialogTitle, DialogContent, DialogActions, Dialog, Radio } from '@mui/material';\n\nimport { Check as IconOk, Cancel as IconCancel } from '@mui/icons-material';\n\nimport { ComplexCron } from '../Components/ComplexCron';\nimport { SimpleCron, cron2state } from '../Components/SimpleCron';\nimport { Schedule } from '../Components/Schedule';\n\nimport { I18n } from '../i18n';\nimport type { IobTheme } from '../types';\n\n// Generate cron expression\n\nconst styles: Record<string, React.CSSProperties> = {\n dialogPaper: {\n height: 'calc(100% - 96px)',\n },\n};\n\ninterface DialogCronProps {\n onClose: () => void;\n onOk: (cron: string) => void;\n title?: string;\n cron?: string;\n cancel?: string;\n ok?: string;\n /** show only simple configuration */\n simple?: boolean;\n /** show only complex configuration */\n complex?: boolean;\n /** do not show wizard */\n noWizard?: boolean;\n theme: IobTheme;\n}\n\ninterface DialogCronState {\n cron: string;\n mode: 'simple' | 'complex' | 'wizard';\n}\n\nexport class DialogCron extends React.Component<DialogCronProps, DialogCronState> {\n constructor(props: DialogCronProps) {\n super(props);\n let cron;\n if (this.props.cron && typeof this.props.cron === 'string' && this.props.cron.replace(/^[\"']/, '')[0] !== '{') {\n cron = this.props.cron.replace(/['\"]/g, '').trim();\n } else {\n cron = this.props.cron || '{}';\n if (typeof cron === 'string') {\n cron = cron.replace(/^[\"']/, '').replace(/[\"']\\n?$/, '');\n }\n }\n\n this.state = {\n cron,\n mode: this.props.simple\n ? 'simple'\n : this.props.complex\n ? 'complex'\n : (typeof cron === 'object' || cron[0] === '{') && !this.props.noWizard\n ? 'wizard'\n : cron2state(this.props.cron || '* * * * *')\n ? 'simple'\n : 'complex',\n };\n }\n\n handleCancel(): void {\n this.props.onClose();\n }\n\n handleOk(): void {\n this.props.onOk(this.state.cron);\n this.props.onClose();\n }\n\n setMode(mode: 'simple' | 'complex' | 'wizard'): void {\n this.setState({ mode });\n }\n\n render(): JSX.Element {\n return (\n <Dialog\n onClose={() => {}}\n maxWidth=\"md\"\n fullWidth\n sx={{ '& .MuiDialog-paper': styles.dialogPaper }}\n open={!0}\n aria-labelledby=\"cron-dialog-title\"\n >\n <DialogTitle id=\"cron-dialog-title\">{this.props.title || I18n.t('ra_Define schedule...')}</DialogTitle>\n <DialogContent style={{ height: '100%', overflow: 'hidden' }}>\n {(this.props.simple && this.props.complex) || (!this.props.simple && !this.props.complex) ? (\n <div>\n {!this.props.simple && !this.props.complex && !this.props.noWizard && (\n <>\n <Radio\n key=\"wizard\"\n checked={this.state.mode === 'wizard'}\n onChange={() => this.setMode('wizard')}\n />\n <label\n onClick={() => this.setMode('wizard')}\n style={this.state.mode !== 'wizard' ? { color: 'lightgrey' } : {}}\n >\n {I18n.t('sc_wizard')}\n </label>\n </>\n )}\n\n {((!this.props.simple && !this.props.complex) || this.props.simple) && (\n <>\n <Radio\n key=\"simple\"\n checked={this.state.mode === 'simple'}\n onChange={() => this.setMode('simple')}\n />\n <label\n onClick={() => this.setMode('simple')}\n style={this.state.mode !== 'simple' ? { color: 'lightgrey' } : {}}\n >\n {I18n.t('sc_simple')}\n </label>\n </>\n )}\n\n {((!this.props.simple && !this.props.complex) || this.props.complex) && (\n <>\n <Radio\n key=\"complex\"\n checked={this.state.mode === 'complex'}\n onChange={() => this.setMode('complex')}\n />\n <label\n onClick={() => this.setMode('complex')}\n style={this.state.mode !== 'complex' ? { color: 'lightgrey' } : {}}\n >\n {I18n.t('sc_cron')}\n </label>\n </>\n )}\n </div>\n ) : null}\n\n {this.state.mode === 'simple' && (\n <SimpleCron\n cronExpression={this.state.cron}\n onChange={cron => this.setState({ cron })}\n language={I18n.getLanguage()}\n />\n )}\n {this.state.mode === 'wizard' && (\n <Schedule\n theme={this.props.theme}\n schedule={this.state.cron}\n onChange={(cron: string) => this.setState({ cron })}\n />\n )}\n {this.state.mode === 'complex' && (\n <ComplexCron\n cronExpression={this.state.cron}\n onChange={cron => this.setState({ cron })}\n language={I18n.getLanguage()}\n />\n )}\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n onClick={() => this.handleOk()}\n color=\"primary\"\n startIcon={<IconOk />}\n >\n {this.props.ok || I18n.t('ra_Ok')}\n </Button>\n <Button\n variant=\"contained\"\n onClick={() => this.handleCancel()}\n color=\"grey\"\n startIcon={<IconCancel />}\n >\n {this.props.cancel || I18n.t('ra_Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Error.js","sourceRoot":"./src/","sources":["Dialogs/Error.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,uHAAuH;AACvH,OAAO,KAAK,EAAE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AS,QACT,SAAS,EAAE,oBAAC,SAAS,OAAG,IAEvB,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CACX,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\r\n * Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>\r\n *\r\n * MIT License\r\n *\r\n */\r\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\r\nimport React, { Component, type JSX } from 'react';\r\n\r\nimport { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material';\r\n\r\nimport { Check as IconCheck } from '@mui/icons-material';\r\n\r\nimport { I18n } from '../i18n';\r\n\r\ninterface DialogErrorProps {\r\n /* The dialog title; default: Error (translated) */\r\n title?: string;\r\n /* The dialog text */\r\n text: string | React.JSX.Element | React.JSX.Element[];\r\n /* Close handler. */\r\n onClose?: () => void;\r\n /* if the dialog must be fill sized */\r\n fullWidth?: boolean;\r\n}\r\n\r\nexport class DialogError extends Component<DialogErrorProps> {\r\n handleOk(): void {\r\n if (this.props.onClose) {\r\n this.props.onClose();\r\n }\r\n }\r\n\r\n render(): JSX.Element {\r\n return (\r\n <Dialog\r\n open={!0}\r\n maxWidth=\"sm\"\r\n fullWidth={this.props.fullWidth !== undefined ? this.props.fullWidth : true}\r\n onClose={() => this.handleOk()}\r\n aria-labelledby=\"alert-dialog-title\"\r\n aria-describedby=\"alert-dialog-description\"\r\n >\r\n <DialogTitle id=\"ar_alert_dialog_title\">{this.props.title || I18n.t('ra_Error')}</DialogTitle>\r\n <DialogContent>\r\n <DialogContentText id=\"ar_alert_dialog_description\">\r\n {this.props.text || I18n.t('ra_Unknown error!')}\r\n </DialogContentText>\r\n </DialogContent>\r\n <DialogActions>\r\n <Button\r\n id=\"ar_dialog_error_ok\"\r\n variant=\"contained\"\r\n onClick={() => this.handleOk()}\r\n color=\"primary\"\r\n autoFocus\r\n startIcon={<IconCheck />}\r\n >\r\n {I18n.t('ra_Ok')}\r\n </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YAChB,oBAAC,aAAa;gBACV,oBAAC,MAAM,IACH,EAAE,EAAC,oBAAoB,EACvB,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAC9B,KAAK,EAAC,SAAS,EACf,SAAS,QACT,SAAS,EAAE,oBAAC,SAAS,OAAG,IAEvB,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CACX,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\n * Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>\n *\n * MIT License\n *\n */\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\nimport React, { Component, type JSX } from 'react';\n\nimport { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material';\n\nimport { Check as IconCheck } from '@mui/icons-material';\n\nimport { I18n } from '../i18n';\n\ninterface DialogErrorProps {\n /* The dialog title; default: Error (translated) */\n title?: string;\n /* The dialog text */\n text: string | React.JSX.Element | React.JSX.Element[];\n /* Close handler. */\n onClose?: () => void;\n /* if the dialog must be fill sized */\n fullWidth?: boolean;\n}\n\nexport class DialogError extends Component<DialogErrorProps> {\n handleOk(): void {\n if (this.props.onClose) {\n this.props.onClose();\n }\n }\n\n render(): JSX.Element {\n return (\n <Dialog\n open={!0}\n maxWidth=\"sm\"\n fullWidth={this.props.fullWidth !== undefined ? this.props.fullWidth : true}\n onClose={() => this.handleOk()}\n aria-labelledby=\"alert-dialog-title\"\n aria-describedby=\"alert-dialog-description\"\n >\n <DialogTitle id=\"ar_alert_dialog_title\">{this.props.title || I18n.t('ra_Error')}</DialogTitle>\n <DialogContent>\n <DialogContentText id=\"ar_alert_dialog_description\">\n {this.props.text || I18n.t('ra_Unknown error!')}\n </DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button\n id=\"ar_dialog_error_ok\"\n variant=\"contained\"\n onClick={() => this.handleOk()}\n color=\"primary\"\n autoFocus\n startIcon={<IconCheck />}\n >\n {I18n.t('ra_Ok')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Message.js","sourceRoot":"./src/","sources":["Dialogs/Message.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uHAAuH;AACvH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE7G,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAiB/B,MAAM,OAAO,aAAc,SAAQ,SAA6B;IAC5D,QAAQ;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;IACL,CAAC;IAED,MAAM;QACF,OAAO,CACH,oBAAC,MAAM,IACH,IAAI,EAAE,CAAC,CAAC,EACR,QAAQ,EAAC,IAAI,EACb,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EAC3E,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,qBACd,yBAAyB,sBACxB,+BAA+B;YAEhD,oBAAC,WAAW,IAAC,EAAE,EAAC,yBAAyB,IAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAe;YAClG,oBAAC,aAAa;gBACV,oBAAC,iBAAiB,IAAC,EAAE,EAAC,+BAA+B;oBACjD,8BAAM,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAQ;oBACtF,IAAI,CAAC,KAAK,CAAC,IAAI,CACA,CACR;YAChB,oBAAC,aAAa;gBACV,oBAAC,MAAM,IACH,EAAE,EAAC,sBAAsB,EACzB,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAC9B,KAAK,EAAC,SAAS,EACf,SAAS,QACT,SAAS,EAAE,oBAAC,SAAS,OAAG,IAEvB,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAC/B,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\r\n * Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>\r\n *\r\n * MIT License\r\n *\r\n */\r\n\r\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\r\nimport React, { Component, type JSX } from 'react';\r\n\r\nimport { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material';\r\n\r\nimport { Close as IconClose } from '@mui/icons-material';\r\n\r\nimport { I18n } from '../i18n';\r\n\r\ninterface DialogMessageProps {\r\n /* The dialog title; default: Message (translated) */\r\n title?: string;\r\n /* The dialog text */\r\n text: string | React.JSX.Element | React.JSX.Element[];\r\n /* Close handler. */\r\n onClose?: () => void;\r\n /* if the dialog must be fill sized */\r\n fullWidth?: boolean;\r\n /* optional icon */\r\n icon?: React.JSX.Element;\r\n /* optional ok button text */\r\n ok?: string;\r\n}\r\n\r\nexport class DialogMessage extends Component<DialogMessageProps> {\r\n handleOk(): void {\r\n if (this.props.onClose) {\r\n this.props.onClose();\r\n }\r\n }\r\n\r\n render(): JSX.Element {\r\n return (\r\n <Dialog\r\n open={!0}\r\n maxWidth=\"sm\"\r\n fullWidth={this.props.fullWidth !== undefined ? this.props.fullWidth : true}\r\n onClose={() => this.handleOk()}\r\n aria-labelledby=\"ar_dialog_message_title\"\r\n aria-describedby=\"ar_dialog_message_description\"\r\n >\r\n <DialogTitle id=\"ar_dialog_message_title\">{this.props.title || I18n.t('ra_Message')}</DialogTitle>\r\n <DialogContent>\r\n <DialogContentText id=\"ar_dialog_message_description\">\r\n <span style={{ marginRight: this.props.icon ? 8 : 0 }}>{this.props.icon || null}</span>\r\n {this.props.text}\r\n </DialogContentText>\r\n </DialogContent>\r\n <DialogActions>\r\n <Button\r\n id=\"ar_dialog_message_ok\"\r\n variant=\"contained\"\r\n onClick={() => this.handleOk()}\r\n color=\"primary\"\r\n autoFocus\r\n startIcon={<IconClose />}\r\n >\r\n {this.props.ok || I18n.t('ra_Close')}\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Message.js","sourceRoot":"./src/","sources":["Dialogs/Message.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uHAAuH;AACvH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE7G,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAiB/B,MAAM,OAAO,aAAc,SAAQ,SAA6B;IAC5D,QAAQ;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;IACL,CAAC;IAED,MAAM;QACF,OAAO,CACH,oBAAC,MAAM,IACH,IAAI,EAAE,CAAC,CAAC,EACR,QAAQ,EAAC,IAAI,EACb,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EAC3E,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,qBACd,yBAAyB,sBACxB,+BAA+B;YAEhD,oBAAC,WAAW,IAAC,EAAE,EAAC,yBAAyB,IAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAe;YAClG,oBAAC,aAAa;gBACV,oBAAC,iBAAiB,IAAC,EAAE,EAAC,+BAA+B;oBACjD,8BAAM,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAQ;oBACtF,IAAI,CAAC,KAAK,CAAC,IAAI,CACA,CACR;YAChB,oBAAC,aAAa;gBACV,oBAAC,MAAM,IACH,EAAE,EAAC,sBAAsB,EACzB,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAC9B,KAAK,EAAC,SAAS,EACf,SAAS,QACT,SAAS,EAAE,oBAAC,SAAS,OAAG,IAEvB,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAC/B,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\n * Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>\n *\n * MIT License\n *\n */\n\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\nimport React, { Component, type JSX } from 'react';\n\nimport { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material';\n\nimport { Close as IconClose } from '@mui/icons-material';\n\nimport { I18n } from '../i18n';\n\ninterface DialogMessageProps {\n /* The dialog title; default: Message (translated) */\n title?: string;\n /* The dialog text */\n text: string | React.JSX.Element | React.JSX.Element[];\n /* Close handler. */\n onClose?: () => void;\n /* if the dialog must be fill sized */\n fullWidth?: boolean;\n /* optional icon */\n icon?: React.JSX.Element;\n /* optional ok button text */\n ok?: string;\n}\n\nexport class DialogMessage extends Component<DialogMessageProps> {\n handleOk(): void {\n if (this.props.onClose) {\n this.props.onClose();\n }\n }\n\n render(): JSX.Element {\n return (\n <Dialog\n open={!0}\n maxWidth=\"sm\"\n fullWidth={this.props.fullWidth !== undefined ? this.props.fullWidth : true}\n onClose={() => this.handleOk()}\n aria-labelledby=\"ar_dialog_message_title\"\n aria-describedby=\"ar_dialog_message_description\"\n >\n <DialogTitle id=\"ar_dialog_message_title\">{this.props.title || I18n.t('ra_Message')}</DialogTitle>\n <DialogContent>\n <DialogContentText id=\"ar_dialog_message_description\">\n <span style={{ marginRight: this.props.icon ? 8 : 0 }}>{this.props.icon || null}</span>\n {this.props.text}\n </DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button\n id=\"ar_dialog_message_ok\"\n variant=\"contained\"\n onClick={() => this.handleOk()}\n color=\"primary\"\n autoFocus\n startIcon={<IconClose />}\n >\n {this.props.ok || I18n.t('ra_Close')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectFile.js","sourceRoot":"./src/","sources":["Dialogs/SelectFile.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,uHAAuH;AACvH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI5E,OAAO,EAAE,IAA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, as without it other projects could not be compiled: ReferenceError: React is not defined\r\nimport React, { type JSX } from 'react';\r\n\r\nimport { Button, DialogTitle, DialogContent, DialogActions, Dialog } from '@mui/material';\r\n\r\nimport { Cancel as IconCancel, Check as IconOk } from '@mui/icons-material';\r\n\r\nimport type { Connection } from '@iobroker/socket-client';\r\n\r\nimport { I18n } from '../i18n';\r\nimport { FileBrowser } from '../Components/FileBrowser';\r\nimport type { IobTheme } from '../types';\r\n\r\nconst styles: Record<string, React.CSSProperties> = {\r\n headerID: {\r\n fontWeight: 'bold',\r\n fontStyle: 'italic',\r\n },\r\n dialog: {\r\n height: '95%',\r\n },\r\n dialogMobile: {\r\n // it is sx\r\n padding: '4px',\r\n width: '100%',\r\n maxWidth: '100%',\r\n maxHeight: 'calc(100% - 16px)',\r\n height: '100%',\r\n },\r\n content: {\r\n height: '100%',\r\n overflow: 'hidden',\r\n },\r\n contentMobile: {\r\n padding: '8px 4px',\r\n },\r\n titleRoot: {\r\n whiteSpace: 'nowrap',\r\n width: 'calc(100% - 72px)',\r\n overflow: 'hidden',\r\n display: 'inline-block',\r\n textOverflow: 'ellipsis',\r\n },\r\n};\r\n\r\ninterface DialogSelectFileProps {\r\n /** where to store settings in localStorage * @property {string} [title] The dialog title; default: Please select object ID... (translated) */\r\n dialogName?: string;\r\n /** The dialog title; default: Please select object ID... (translated) */\r\n title?: string;\r\n /** Set to true to allow the selection of multiple IDs. */\r\n multiSelect?: boolean;\r\n /** Image prefix. Normally, admin has '../..' and the web has '../' */\r\n imagePrefix?: string; // Prefix (default: '.')\r\n /** @deprecated Image prefix */\r\n prefix?: string;\r\n /** Show the expert button? */\r\n showExpertButton?: boolean;\r\n /** Language */\r\n lang?: ioBroker.Languages;\r\n /** Socket class */\r\n socket: Connection;\r\n /** Theme name. */\r\n themeName?: string;\r\n /** Theme type. */\r\n themeType?: 'dark' | 'light';\r\n /** Theme object. */\r\n theme: IobTheme;\r\n /** The selected IDs. */\r\n selected?: string | string[];\r\n /** The ok button text; default: OK (translated) */\r\n ok?: string;\r\n /** The cancel button text; default: Cancel (translated) */\r\n cancel?: string;\r\n /** If download of files enabled */\r\n allowUpload?: boolean;\r\n /** If download of files enabled */\r\n allowDownload?: boolean;\r\n /** If creation of folders enabled */\r\n allowCreateFolder?: boolean;\r\n /** If creation of folders enabled */\r\n allowDelete?: boolean;\r\n /** if tile view enabled (default true) */\r\n allowView?: boolean;\r\n /** Show toolbar (default true) */\r\n showToolbar?: boolean;\r\n /** Limit file browser to one specific objectID of type meta and the following path (like vis.0/main) */\r\n limitPath?: string;\r\n /** like `['png', 'svg', 'bmp', 'jpg', 'jpeg', 'gif']` */\r\n filterFiles?: string[];\r\n /** images, code, txt, audio, video */\r\n filterByType?: 'images' | 'code' | 'txt';\r\n /** allow only folder's selection */\r\n selectOnlyFolders?: boolean;\r\n /** Close handler that is always called when the dialog is closed. */\r\n onClose: () => void;\r\n /** Handler that is called when the user presses OK or by double click. */\r\n onOk: (selected: string | string[] | undefined) => void;\r\n /** The styling class names. */\r\n filters?: Record<string, string>;\r\n /** Allow switch views Table<=>Rows */\r\n showViewTypeButton?: boolean;\r\n /** If type selector should be shown */\r\n showTypeSelector?: boolean;\r\n /** If defined, allow selecting only files from this folder */\r\n restrictToFolder?: string;\r\n /** If restrictToFolder defined, allow selecting files outside of this folder */\r\n allowNonRestricted?: boolean;\r\n /** force expert mode */\r\n expertMode?: boolean;\r\n /** Translate function - optional */\r\n t?: (text: string, ...args: any[]) => string;\r\n}\r\n\r\ninterface DialogSelectFileState {\r\n selected: string[];\r\n}\r\n\r\nexport class DialogSelectFile extends React.Component<DialogSelectFileProps, DialogSelectFileState> {\r\n private readonly dialogName: string;\r\n\r\n private readonly filters: Record<string, string>;\r\n\r\n constructor(props: DialogSelectFileProps) {\r\n super(props);\r\n this.dialogName = this.props.dialogName || 'default';\r\n this.dialogName = `SelectFile.${this.dialogName}`;\r\n\r\n const filters: string = ((window as any)._localStorage || window.localStorage).getItem(this.dialogName) || '{}';\r\n\r\n try {\r\n this.filters = JSON.parse(filters);\r\n } catch {\r\n this.filters = {};\r\n }\r\n\r\n if (props.filters) {\r\n this.filters = { ...this.filters, ...props.filters };\r\n }\r\n\r\n let selected = this.props.selected || [];\r\n if (typeof selected !== 'object') {\r\n selected = [selected];\r\n } else {\r\n selected = [...selected];\r\n }\r\n selected = selected.filter(id => id);\r\n\r\n this.state = {\r\n selected,\r\n };\r\n }\r\n\r\n handleCancel(): void {\r\n this.props.onClose();\r\n }\r\n\r\n handleOk(): void {\r\n this.props.onOk(\r\n this.props.multiSelect || !Array.isArray(this.state.selected)\r\n ? this.state.selected\r\n : this.state.selected[0] || '',\r\n );\r\n this.props.onClose();\r\n }\r\n\r\n render(): JSX.Element {\r\n let title;\r\n if (this.state.selected.length) {\r\n if (!Array.isArray(this.state.selected) || this.state.selected.length === 1) {\r\n title = [\r\n <span key=\"selected\">\r\n {I18n.t('ra_Selected')}\r\n &nbsp;\r\n </span>,\r\n <span\r\n key=\"id\"\r\n style={styles.headerID}\r\n >\r\n {this.state.selected}\r\n </span>,\r\n ];\r\n } else {\r\n title = [\r\n <span key=\"selected\">\r\n {I18n.t('ra_Selected')}\r\n &nbsp;\r\n </span>,\r\n <span\r\n key=\"id\"\r\n style={styles.headerID}\r\n >\r\n {I18n.t('%s items', this.state.selected.length)}\r\n </span>,\r\n ];\r\n }\r\n } else {\r\n title = this.props.title || I18n.t('ra_Please select file...');\r\n }\r\n\r\n return (\r\n <Dialog\r\n onClose={() => {}}\r\n maxWidth={false}\r\n sx={{ '& .MuiDialog-paper': { ...styles.dialog, ...styles.dialogMobile } }}\r\n fullWidth\r\n open={!0}\r\n aria-labelledby=\"ar_dialog_selectfile_title\"\r\n >\r\n <DialogTitle\r\n id=\"ar_dialog_selectfile_title\"\r\n sx={{ '&.MuiDialogTitle-root': styles.titleRoot }}\r\n >\r\n {title}\r\n </DialogTitle>\r\n <DialogContent style={{ ...styles.content, ...styles.contentMobile }}>\r\n <FileBrowser\r\n ready\r\n imagePrefix={this.props.imagePrefix || this.props.prefix || '../'} // prefix is for back compatibility\r\n allowUpload={!!this.props.allowUpload}\r\n allowDownload={this.props.allowDownload !== false}\r\n allowCreateFolder={!!this.props.allowCreateFolder}\r\n allowDelete={!!this.props.allowDelete}\r\n allowView={this.props.allowView !== false}\r\n showViewTypeButton={this.props.showViewTypeButton !== false}\r\n showToolbar={this.props.showToolbar !== false}\r\n limitPath={this.props.limitPath}\r\n filterFiles={this.props.filterFiles}\r\n filterByType={this.props.filterByType}\r\n selected={this.props.selected}\r\n restrictToFolder={this.props.restrictToFolder}\r\n allowNonRestricted={this.props.allowNonRestricted}\r\n onSelect={(selected: string | string[], isDoubleClick?: boolean, isFolder?: boolean) => {\r\n this.setState(\r\n { selected: Array.isArray(selected) ? selected : [selected] },\r\n () => isDoubleClick && (!this.props.selectOnlyFolders || isFolder) && this.handleOk(),\r\n );\r\n }}\r\n t={this.props.t || I18n.t}\r\n lang={this.props.lang || I18n.getLanguage()}\r\n socket={this.props.socket}\r\n themeType={this.props.themeType}\r\n themeName={this.props.themeName}\r\n theme={this.props.theme}\r\n showExpertButton={this.props.showExpertButton}\r\n expertMode={this.props.expertMode}\r\n showTypeSelector={this.props.showTypeSelector}\r\n />\r\n </DialogContent>\r\n <DialogActions>\r\n <Button\r\n variant=\"contained\"\r\n onClick={() => this.handleOk()}\r\n startIcon={<IconOk />}\r\n disabled={!this.state.selected.length}\r\n color=\"primary\"\r\n >\r\n {this.props.ok || I18n.t('ra_Ok')}\r\n </Button>\r\n <Button\r\n color=\"grey\"\r\n variant=\"contained\"\r\n onClick={() => this.handleCancel()}\r\n startIcon={<IconCancel />}\r\n >\r\n {this.props.cancel || I18n.t('ra_Cancel')}\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SelectFile.js","sourceRoot":"./src/","sources":["Dialogs/SelectFile.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,uHAAuH;AACv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AC,UAAU,OAAG,IAExB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["/*\n * Copyright 2022-2024 Denis Haev (bluefox) <dogafox@gmail.com>\n *\n * MIT License\n *\n */\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\nimport React, { type JSX } from 'react';\n\nimport { Button, DialogTitle, DialogContent, DialogActions, Dialog } from '@mui/material';\n\nimport { Cancel as IconCancel, Check as IconOk } from '@mui/icons-material';\n\nimport type { Connection } from '@iobroker/socket-client';\n\nimport { I18n } from '../i18n';\nimport { FileBrowser } from '../Components/FileBrowser';\nimport type { IobTheme } from '../types';\n\nconst styles: Record<string, React.CSSProperties> = {\n headerID: {\n fontWeight: 'bold',\n fontStyle: 'italic',\n },\n dialog: {\n height: '95%',\n },\n dialogMobile: {\n // it is sx\n padding: '4px',\n width: '100%',\n maxWidth: '100%',\n maxHeight: 'calc(100% - 16px)',\n height: '100%',\n },\n content: {\n height: '100%',\n overflow: 'hidden',\n },\n contentMobile: {\n padding: '8px 4px',\n },\n titleRoot: {\n whiteSpace: 'nowrap',\n width: 'calc(100% - 72px)',\n overflow: 'hidden',\n display: 'inline-block',\n textOverflow: 'ellipsis',\n },\n};\n\ninterface DialogSelectFileProps {\n /** where to store settings in localStorage * @property {string} [title] The dialog title; default: Please select object ID... (translated) */\n dialogName?: string;\n /** The dialog title; default: Please select object ID... (translated) */\n title?: string;\n /** Set to true to allow the selection of multiple IDs. */\n multiSelect?: boolean;\n /** Image prefix. Normally, admin has '../..' and the web has '../' */\n imagePrefix?: string; // Prefix (default: '.')\n /** @deprecated Image prefix */\n prefix?: string;\n /** Show the expert button? */\n showExpertButton?: boolean;\n /** Language */\n lang?: ioBroker.Languages;\n /** Socket class */\n socket: Connection;\n /** Theme name. */\n themeName?: string;\n /** Theme type. */\n themeType?: 'dark' | 'light';\n /** Theme object. */\n theme: IobTheme;\n /** The selected IDs. */\n selected?: string | string[];\n /** The ok button text; default: OK (translated) */\n ok?: string;\n /** The cancel button text; default: Cancel (translated) */\n cancel?: string;\n /** If download of files enabled */\n allowUpload?: boolean;\n /** If download of files enabled */\n allowDownload?: boolean;\n /** If creation of folders enabled */\n allowCreateFolder?: boolean;\n /** If creation of folders enabled */\n allowDelete?: boolean;\n /** if tile view enabled (default true) */\n allowView?: boolean;\n /** Show toolbar (default true) */\n showToolbar?: boolean;\n /** Limit file browser to one specific objectID of type meta and the following path (like vis.0/main) */\n limitPath?: string;\n /** like `['png', 'svg', 'bmp', 'jpg', 'jpeg', 'gif']` */\n filterFiles?: string[];\n /** images, code, txt, audio, video */\n filterByType?: 'images' | 'code' | 'txt';\n /** allow only folder's selection */\n selectOnlyFolders?: boolean;\n /** Close handler that is always called when the dialog is closed. */\n onClose: () => void;\n /** Handler that is called when the user presses OK or by double click. */\n onOk: (selected: string | string[] | undefined) => void;\n /** The styling class names. */\n filters?: Record<string, string>;\n /** Allow switch views Table<=>Rows */\n showViewTypeButton?: boolean;\n /** If type selector should be shown */\n showTypeSelector?: boolean;\n /** If defined, allow selecting only files from this folder */\n restrictToFolder?: string;\n /** If restrictToFolder defined, allow selecting files outside of this folder */\n allowNonRestricted?: boolean;\n /** force expert mode */\n expertMode?: boolean;\n /** Translate function - optional */\n t?: (text: string, ...args: any[]) => string;\n}\n\ninterface DialogSelectFileState {\n selected: string[];\n}\n\nexport class DialogSelectFile extends React.Component<DialogSelectFileProps, DialogSelectFileState> {\n private readonly dialogName: string;\n\n private readonly filters: Record<string, string>;\n\n constructor(props: DialogSelectFileProps) {\n super(props);\n this.dialogName = this.props.dialogName || 'default';\n this.dialogName = `SelectFile.${this.dialogName}`;\n\n const filters: string = ((window as any)._localStorage || window.localStorage).getItem(this.dialogName) || '{}';\n\n try {\n this.filters = JSON.parse(filters);\n } catch {\n this.filters = {};\n }\n\n if (props.filters) {\n this.filters = { ...this.filters, ...props.filters };\n }\n\n let selected = this.props.selected || [];\n if (typeof selected !== 'object') {\n selected = [selected];\n } else {\n selected = [...selected];\n }\n selected = selected.filter(id => id);\n\n this.state = {\n selected,\n };\n }\n\n handleCancel(): void {\n this.props.onClose();\n }\n\n handleOk(): void {\n this.props.onOk(\n this.props.multiSelect || !Array.isArray(this.state.selected)\n ? this.state.selected\n : this.state.selected[0] || '',\n );\n this.props.onClose();\n }\n\n render(): JSX.Element {\n let title;\n if (this.state.selected.length) {\n if (!Array.isArray(this.state.selected) || this.state.selected.length === 1) {\n title = [\n <span key=\"selected\">\n {I18n.t('ra_Selected')}\n &nbsp;\n </span>,\n <span\n key=\"id\"\n style={styles.headerID}\n >\n {this.state.selected}\n </span>,\n ];\n } else {\n title = [\n <span key=\"selected\">\n {I18n.t('ra_Selected')}\n &nbsp;\n </span>,\n <span\n key=\"id\"\n style={styles.headerID}\n >\n {I18n.t('%s items', this.state.selected.length)}\n </span>,\n ];\n }\n } else {\n title = this.props.title || I18n.t('ra_Please select file...');\n }\n\n return (\n <Dialog\n onClose={() => {}}\n maxWidth={false}\n sx={{ '& .MuiDialog-paper': { ...styles.dialog, ...styles.dialogMobile } }}\n fullWidth\n open={!0}\n aria-labelledby=\"ar_dialog_selectfile_title\"\n >\n <DialogTitle\n id=\"ar_dialog_selectfile_title\"\n sx={{ '&.MuiDialogTitle-root': styles.titleRoot }}\n >\n {title}\n </DialogTitle>\n <DialogContent style={{ ...styles.content, ...styles.contentMobile }}>\n <FileBrowser\n ready\n imagePrefix={this.props.imagePrefix || this.props.prefix || '../'} // prefix is for back compatibility\n allowUpload={!!this.props.allowUpload}\n allowDownload={this.props.allowDownload !== false}\n allowCreateFolder={!!this.props.allowCreateFolder}\n allowDelete={!!this.props.allowDelete}\n allowView={this.props.allowView !== false}\n showViewTypeButton={this.props.showViewTypeButton !== false}\n showToolbar={this.props.showToolbar !== false}\n limitPath={this.props.limitPath}\n filterFiles={this.props.filterFiles}\n filterByType={this.props.filterByType}\n selected={this.props.selected}\n restrictToFolder={this.props.restrictToFolder}\n allowNonRestricted={this.props.allowNonRestricted}\n onSelect={(selected: string | string[], isDoubleClick?: boolean, isFolder?: boolean) => {\n this.setState(\n { selected: Array.isArray(selected) ? selected : [selected] },\n () => isDoubleClick && (!this.props.selectOnlyFolders || isFolder) && this.handleOk(),\n );\n }}\n t={this.props.t || I18n.t}\n lang={this.props.lang || I18n.getLanguage()}\n socket={this.props.socket}\n themeType={this.props.themeType}\n themeName={this.props.themeName}\n theme={this.props.theme}\n showExpertButton={this.props.showExpertButton}\n expertMode={this.props.expertMode}\n showTypeSelector={this.props.showTypeSelector}\n />\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n onClick={() => this.handleOk()}\n startIcon={<IconOk />}\n disabled={!this.state.selected.length}\n color=\"primary\"\n >\n {this.props.ok || I18n.t('ra_Ok')}\n </Button>\n <Button\n color=\"grey\"\n variant=\"contained\"\n onClick={() => this.handleCancel()}\n startIcon={<IconCancel />}\n >\n {this.props.cancel || I18n.t('ra_Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SimpleCron.js","sourceRoot":"./src/","sources":["Dialogs/SimpleCron.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,4BAA4B;AAE5B,MAAM,MAAM,GAAwC;IAChD,WAAW,EAAE;QACT,MAAM,EAAE,mBAAmB;KAC9B;CACJ,CAAC;AAeF,MAAM,OAAO,g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BAAmB;YAEnC,oBAAC,WAAW,IAAC,EAAE,EAAC,mBAAmB,IAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAe;YACnG,oBAAC,aAAa,IAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE;gBACxD,oBAAC,UAAU,IACP,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAC/B,QAAQ,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,EACnD,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,GAC9B,CACU;YAChB,oBAAC,aAAa;gBACV,oBAAC,MAAM,IACH,OAAO,EAAC,WAAW,EACnB,QAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAC3D,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAC9B,KAAK,EAAC,SAAS,EACf,SAAS,EAAE,oBAAC,MAAM,OAAG,IAEpB,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAC5B;gBACT,oBAAC,MAAM,IACH,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,KAAK,EAAC,MAAM,EACZ,SAAS,EAAE,oBAAC,UAAU,OAAG,IAExB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\r\nimport { Button, DialogTitle, DialogContent, DialogActions, Dialog } from '@mui/material';\r\n\r\nimport { Check as IconOk, Cancel as IconCancel } from '@mui/icons-material';\r\n\r\nimport { SimpleCron } from '../Components/SimpleCron';\r\n\r\nimport { I18n } from '../i18n';\r\n\r\n// Generates cron expression\r\n\r\nconst styles: Record<string, React.CSSProperties> = {\r\n dialogPaper: {\r\n height: 'calc(100% - 96px)',\r\n },\r\n};\r\n\r\ninterface DialogCronProps {\r\n onClose: () => void;\r\n onOk: (cron: string) => void;\r\n title?: string;\r\n cron?: string;\r\n cancel?: string;\r\n ok?: string;\r\n}\r\n\r\ninterface DialogCronState {\r\n cron: string;\r\n}\r\n\r\nexport class DialogSimpleCron extends React.Component<DialogCronProps, DialogCronState> {\r\n constructor(props: DialogCronProps) {\r\n super(props);\r\n\r\n let cron;\r\n if (this.props.cron && typeof this.props.cron === 'string' && this.props.cron.replace(/^[\"']/, '')[0] !== '{') {\r\n cron = this.props.cron.replace(/['\"]/g, '').trim();\r\n } else {\r\n cron = this.props.cron || '{}';\r\n if (typeof cron === 'string') {\r\n cron = cron.replace(/^[\"']/, '').replace(/[\"']\\n?$/, '');\r\n }\r\n }\r\n\r\n this.state = {\r\n cron,\r\n };\r\n }\r\n\r\n handleCancel(): void {\r\n this.props.onClose();\r\n }\r\n\r\n handleOk(): void {\r\n this.props.onOk(this.state.cron);\r\n this.props.onClose();\r\n }\r\n\r\n render(): JSX.Element {\r\n return (\r\n <Dialog\r\n onClose={() => {}}\r\n maxWidth=\"md\"\r\n fullWidth\r\n sx={{ '& .MuiDialog-paper': styles.dialogPaper }}\r\n open={!0}\r\n aria-labelledby=\"cron-dialog-title\"\r\n >\r\n <DialogTitle id=\"cron-dialog-title\">{this.props.title || I18n.t('ra_Define CRON...')}</DialogTitle>\r\n <DialogContent style={{ height: '100%', overflow: 'hidden' }}>\r\n <SimpleCron\r\n cronExpression={this.state.cron}\r\n onChange={(cron: string) => this.setState({ cron })}\r\n language={I18n.getLanguage()}\r\n />\r\n </DialogContent>\r\n <DialogActions>\r\n <Button\r\n variant=\"contained\"\r\n disabled={!this.state.cron || this.state.cron.includes('_')}\r\n onClick={() => this.handleOk()}\r\n color=\"primary\"\r\n startIcon={<IconOk />}\r\n >\r\n {this.props.ok || I18n.t('ra_Ok')}\r\n </Button>\r\n <Button\r\n variant=\"contained\"\r\n onClick={() => this.handleCancel()}\r\n color=\"grey\"\r\n startIcon={<IconCancel />}\r\n >\r\n {this.props.cancel || I18n.t('ra_Cancel')}\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SimpleCron.js","sourceRoot":"./src/","sources":["Dialogs/SimpleCron.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,4BAA4B;AAE5B,MAAM,MAAM,GAAwC;IAChD,WAAW,EAAE;QACT,MAAM,EAAE,mBAAmB;KAC9B;CACJ,CAAC;AAeF,MAAM,OAAO,gBAAiB,SAAQ,KAAK,CAAC,SAA2C;IACnF,YAAY,KAAsB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,IAAI,CAAC;QACT,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAC5G,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,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AE,CAAC,EACnD,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,GAC9B,CACU;YAChB,oBAAC,aAAa;gBACV,oBAAC,MAAM,IACH,OAAO,EAAC,WAAW,EACnB,QAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAC3D,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAC9B,KAAK,EAAC,SAAS,EACf,SAAS,EAAE,oBAAC,MAAM,OAAG,IAEpB,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAC5B;gBACT,oBAAC,MAAM,IACH,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,KAAK,EAAC,MAAM,EACZ,SAAS,EAAE,oBAAC,UAAU,OAAG,IAExB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\nimport { Button, DialogTitle, DialogContent, DialogActions, Dialog } from '@mui/material';\n\nimport { Check as IconOk, Cancel as IconCancel } from '@mui/icons-material';\n\nimport { SimpleCron } from '../Components/SimpleCron';\n\nimport { I18n } from '../i18n';\n\n// Generates cron expression\n\nconst styles: Record<string, React.CSSProperties> = {\n dialogPaper: {\n height: 'calc(100% - 96px)',\n },\n};\n\ninterface DialogCronProps {\n onClose: () => void;\n onOk: (cron: string) => void;\n title?: string;\n cron?: string;\n cancel?: string;\n ok?: string;\n}\n\ninterface DialogCronState {\n cron: string;\n}\n\nexport class DialogSimpleCron extends React.Component<DialogCronProps, DialogCronState> {\n constructor(props: DialogCronProps) {\n super(props);\n\n let cron;\n if (this.props.cron && typeof this.props.cron === 'string' && this.props.cron.replace(/^[\"']/, '')[0] !== '{') {\n cron = this.props.cron.replace(/['\"]/g, '').trim();\n } else {\n cron = this.props.cron || '{}';\n if (typeof cron === 'string') {\n cron = cron.replace(/^[\"']/, '').replace(/[\"']\\n?$/, '');\n }\n }\n\n this.state = {\n cron,\n };\n }\n\n handleCancel(): void {\n this.props.onClose();\n }\n\n handleOk(): void {\n this.props.onOk(this.state.cron);\n this.props.onClose();\n }\n\n render(): JSX.Element {\n return (\n <Dialog\n onClose={() => {}}\n maxWidth=\"md\"\n fullWidth\n sx={{ '& .MuiDialog-paper': styles.dialogPaper }}\n open={!0}\n aria-labelledby=\"cron-dialog-title\"\n >\n <DialogTitle id=\"cron-dialog-title\">{this.props.title || I18n.t('ra_Define CRON...')}</DialogTitle>\n <DialogContent style={{ height: '100%', overflow: 'hidden' }}>\n <SimpleCron\n cronExpression={this.state.cron}\n onChange={(cron: string) => this.setState({ cron })}\n language={I18n.getLanguage()}\n />\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n disabled={!this.state.cron || this.state.cron.includes('_')}\n onClick={() => this.handleOk()}\n color=\"primary\"\n startIcon={<IconOk />}\n >\n {this.props.ok || I18n.t('ra_Ok')}\n </Button>\n <Button\n variant=\"contained\"\n onClick={() => this.handleCancel()}\n color=\"grey\"\n startIcon={<IconCancel />}\n >\n {this.props.cancel || I18n.t('ra_Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
1
  import { type JSX } from 'react';
2
- export declare const DialogTextInput: (props: Record<string, any>) => JSX.Element;
2
+ export declare const DialogTextInput: (props: Record<string, any>) => JSX.Element /** The text replacement callback */;
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.js","sourceRoot":"./src/","sources":["Dialogs/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE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CAAC,WAAW,CAAC,CACnC,CACG,CACX,CACZ,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,EAAE,CAAC,aAAa,CAAC,CAAC","sourcesContent":["import React, { type JSX } from 'react';\r\n\r\nimport { Button, TextField, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material';\r\n\r\nimport { Close as IconClose, Check as IconCheck } from '@mui/icons-material';\r\n\r\nimport { I18n } from '../i18n';\r\nimport { withWidth } from '../Components/withWidth';\r\n\r\ninterface TextInputProps {\r\n /** The dialog close callback */\r\n onClose: (text: string | null) => void;\r\n /** The title text */\r\n titleText: string;\r\n /** Prompt text (default: empty) */\r\n promptText?: string;\r\n /** Label text (default: empty) */\r\n labelText?: string;\r\n /** The text of the cancel button */\r\n cancelText: string;\r\n /** The text of the \"apply\" button */\r\n applyText: string;\r\n /** The verification callback. Return a non-empty string if there was an error */\r\n verify?: (text: string) => string;\r\n /** The text replacement callback */\r\n rule?: (text: string) => string;\r\n /** The type of the textbox (default: text) */\r\n type?: 'text' | 'number' | 'password' | 'email';\r\n /** The initial input value when opening the dialog */\r\n value?: string;\r\n /** @deprecated Use value. The input when opening the dialog */\r\n input?: string;\r\n /** If true, the dialog will be full width */\r\n fullWidth?: boolean;\r\n}\r\n\r\nfunction TextInputFunc(props: TextInputProps): JSX.Element {\r\n const [text, setText] = React.useState<string>(props.input || props.value || '');\r\n const [error, setError] = React.useState<string | boolean>('');\r\n return (\r\n <Dialog\r\n open={!0}\r\n onClose={() => props.onClose(null)}\r\n aria-labelledby=\"form-dialog-title\"\r\n fullWidth={props.fullWidth !== undefined ? props.fullWidth : false}\r\n >\r\n <DialogTitle id=\"form-dialog-title\">{props.titleText}</DialogTitle>\r\n <DialogContent>\r\n <DialogContentText>{props.promptText}</DialogContentText>\r\n <TextField\r\n variant=\"standard\"\r\n autoFocus\r\n margin=\"dense\"\r\n error={!!error}\r\n helperText={error === true || !error ? '' : error}\r\n value={text}\r\n label={props.labelText || ''}\r\n type={props.type || 'text'}\r\n onKeyUp={e => e.code === 'Enter' && text && props.onClose(text)}\r\n onChange={e => {\r\n let _error: string | boolean = '';\r\n if (props.verify) {\r\n _error = !props.verify(e.target.value);\r\n }\r\n\r\n if (props.rule) {\r\n setText(props.rule(e.target.value));\r\n } else {\r\n setText(e.target.value);\r\n }\r\n setError(_error);\r\n }}\r\n fullWidth\r\n />\r\n </DialogContent>\r\n <DialogActions>\r\n <Button\r\n variant=\"contained\"\r\n disabled={!text || !!error}\r\n onClick={() => props.onClose(text)}\r\n color=\"primary\"\r\n startIcon={<IconCheck />}\r\n >\r\n {props.applyText || I18n.t('ra_Ok')}\r\n </Button>\r\n <Button\r\n color=\"grey\"\r\n variant=\"contained\"\r\n onClick={() => props.onClose(null)}\r\n startIcon={<IconClose />}\r\n >\r\n {props.cancelText || I18n.t('ra_Cancel')}\r\n </Button>\r\n </DialogActions>\r\n </Dialog>\r\n );\r\n}\r\n\r\nexport const DialogTextInput = withWidth()(TextInputFunc);\r\n"]}
1
+ {"version":3,"file":"TextInput.js","sourceRoot":"./src/","sources":["Dialogs/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAExH,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AA6BpD,SAAS,aAAa,CAAC,KAAqB;IACxC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAS,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,EAAE,CA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wBACb,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;oBACxC,CAAC;yBAAM,CAAC;wBACJ,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBAC5B,CAAC;oBACD,QAAQ,CAAC,MAAM,CAAC,CAAC;gBACrB,CAAC,EACD,SAAS,SACX,CACU;QAChB,oBAAC,aAAa;YACV,oBAAC,MAAM,IACH,OAAO,EAAC,WAAW,EACnB,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,EAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAClC,KAAK,EAAC,SAAS,EACf,SAAS,EAAE,oBAAC,SAAS,OAAG,IAEvB,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAC9B;YACT,oBAAC,MAAM,IACH,KAAK,EAAC,MAAM,EACZ,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAClC,SAAS,EAAE,oBAAC,SAAS,OAAG,IAEvB,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACnC,CACG,CACX,CACZ,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,EAAE,CAAC,aAAa,CAAC,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Button, TextField, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material';\n\nimport { Close as IconClose, Check as IconCheck } from '@mui/icons-material';\n\nimport { I18n } from '../i18n';\nimport { withWidth } from '../Components/withWidth';\n\ninterface TextInputProps {\n /** The dialog close callback */\n onClose: (text: string | null) => void;\n /** The title text */\n titleText: string;\n /** Prompt text (default: empty) */\n promptText?: string;\n /** Label text (default: empty) */\n labelText?: string;\n /** The text of the cancel button */\n cancelText: string;\n /** The text of the \"apply\" button */\n applyText: string;\n /** The verification callback. Return a non-empty string if there was an error */\n verify?: (text: string) => string;\n /** The text replacement callback */\n rule?: (text: string) => string;\n /** The type of the textbox (default: text) */\n type?: 'text' | 'number' | 'password' | 'email';\n /** The initial input value when opening the dialog */\n value?: string;\n /** @deprecated Use value. The input when opening the dialog */\n input?: string;\n /** If true, the dialog will be full width */\n fullWidth?: boolean;\n}\n\nfunction TextInputFunc(props: TextInputProps): JSX.Element {\n const [text, setText] = React.useState<string>(props.input || props.value || '');\n const [error, setError] = React.useState<string | boolean>('');\n return (\n <Dialog\n open={!0}\n onClose={() => props.onClose(null)}\n aria-labelledby=\"form-dialog-title\"\n fullWidth={props.fullWidth !== undefined ? props.fullWidth : false}\n >\n <DialogTitle id=\"form-dialog-title\">{props.titleText}</DialogTitle>\n <DialogContent>\n <DialogContentText>{props.promptText}</DialogContentText>\n <TextField\n variant=\"standard\"\n autoFocus\n margin=\"dense\"\n error={!!error}\n helperText={error === true || !error ? '' : error}\n value={text}\n label={props.labelText || ''}\n type={props.type || 'text'}\n onKeyUp={e => e.code === 'Enter' && text && props.onClose(text)}\n onChange={e => {\n let _error: string | boolean = '';\n if (props.verify) {\n _error = !props.verify(e.target.value);\n }\n\n if (props.rule) {\n setText(props.rule(e.target.value));\n } else {\n setText(e.target.value);\n }\n setError(_error);\n }}\n fullWidth\n />\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n disabled={!text || !!error}\n onClick={() => props.onClose(text)}\n color=\"primary\"\n startIcon={<IconCheck />}\n >\n {props.applyText || I18n.t('ra_Ok')}\n </Button>\n <Button\n color=\"grey\"\n variant=\"contained\"\n onClick={() => props.onClose(null)}\n startIcon={<IconClose />}\n >\n {props.cancelText || I18n.t('ra_Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n\nexport const DialogTextInput = withWidth()(TextInputFunc);\n"]}
package/build/Prompt.js CHANGED
@@ -2,13 +2,13 @@
2
2
  * Print the ioBroker welcome screen to the developer console.
3
3
  */
4
4
  export function printPrompt() {
5
- const prompt = `
6
- ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
7
- ██║██╔═══██╗██╔══██╗██╔══██╗██╔═══██╗██║ ██╔╝██╔════╝██╔══██╗
8
- ██║██║ ██║██████╔╝██████╔╝██║ ██║█████╔╝ █████╗ ██████╔╝
9
- ██║██║ ██║██╔══██╗██╔══██╗██║ ██║██╔═██╗ ██╔══╝ ██╔══██╗
10
- ██║╚██████╔╝██████╔╝██║ ██║╚██████╔╝██║ ██╗███████╗██║ ██║
11
- ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
5
+ const prompt = `
6
+ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
7
+ ██║██╔═══██╗██╔══██╗██╔══██╗██╔═══██╗██║ ██╔╝██╔════╝██╔══██╗
8
+ ██║██║ ██║██████╔╝██████╔╝██║ ██║█████╔╝ █████╗ ██████╔╝
9
+ ██║██║ ██║██╔══██╗██╔══██╗██║ ██║██╔═██╗ ██╔══╝ ██╔══██╗
10
+ ██║╚██████╔╝██████╔╝██║ ██║╚██████╔╝██║ ██╗███████╗██║ ██║
11
+ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
12
12
  `;
13
13
  console.log(prompt);
14
14
  console.log('Nice to see you here! :) Join our dev community here https://github.com/ioBroker/ioBroker or here https://github.com/iobroker-community-adapters');