@iobroker/adapter-react-v5 3.4.4 → 3.4.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"copy-to-clipboard.js","names":["deselectCurrent","selection","document","getSelection","rangeCount","active","activeElement","ranges","i","push","getRangeAt","tagName","toUpperCase","blur","removeAllRanges","type","forEach","range","addRange","focus","clipboardToIE11Formatting","defaultMessage","format","message","copyKey","test","navigator","userAgent","replace","copy","text","options","debug","reselectPrevious","mark","success","createRange","createElement","textContent","ariaHidden","style","all","position","top","clip","whiteSpace","webkitUserSelect","MozUserSelect","msUserSelect","userSelect","addEventListener","e","stopPropagation","preventDefault","clipboardData","console","warn","window","clearData","setData","onCopy","body","appendChild","selectNodeContents","successful","execCommand","Error","err","error","prompt","removeRange","removeChild","module","exports"],"sources":["copy-to-clipboard.js"],"sourcesContent":["/*\nMIT License\n\nCopyright (c) 2017 sudodoki <smd.deluzion@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n */\n// https://github.com/sudodoki/toggle-selection/blob/gh-pages/index.js\nfunction deselectCurrent () {\n const selection = document.getSelection();\n if (!selection.rangeCount) {\n return function () {};\n }\n let active = document.activeElement;\n\n const ranges = [];\n for (let i = 0; i < selection.rangeCount; i++) {\n ranges.push(selection.getRangeAt(i));\n }\n\n switch (active.tagName.toUpperCase()) { // .toUpperCase handles XHTML\n case 'INPUT':\n case 'TEXTAREA':\n active.blur();\n break;\n\n default:\n active = null;\n break;\n }\n\n selection.removeAllRanges();\n return function () {\n selection.type === 'Caret' &&\n selection.removeAllRanges();\n\n if (!selection.rangeCount) {\n ranges.forEach(function(range) {\n selection.addRange(range);\n });\n }\n\n active && active.focus();\n };\n}\n\n// https://github.com/sudodoki/copy-to-clipboard/blob/master/index.js\n\nconst clipboardToIE11Formatting = {\n 'text/plain': 'Text',\n 'text/html': 'Url',\n 'default': 'Text',\n};\n\nconst defaultMessage = 'Copy to clipboard: #{key}, Enter';\n\nfunction format(message) {\n const copyKey = (/mac os x/i.test(navigator.userAgent) ? '⌘' : 'Ctrl') + '+C';\n return message.replace(/#{\\s*key\\s*}/g, copyKey);\n}\n\nfunction copy(text, options) {\n let debug;\n let reselectPrevious;\n let range;\n let selection;\n let mark;\n let success = false;\n if (!options) {\n options = {};\n }\n debug = options.debug || false;\n try {\n reselectPrevious = deselectCurrent();\n\n range = document.createRange();\n selection = document.getSelection();\n\n mark = document.createElement('span');\n mark.textContent = text;\n // avoid screen readers from reading out loud the text\n mark.ariaHidden = 'true';\n // reset user styles for span element\n mark.style.all = 'unset';\n // prevents scrolling to the end of the page\n mark.style.position = 'fixed';\n mark.style.top = 0;\n mark.style.clip = 'rect(0, 0, 0, 0)';\n // used to preserve spaces and line breaks\n mark.style.whiteSpace = 'pre';\n // do not inherit user-select (it may be `none`)\n mark.style.webkitUserSelect = 'text';\n mark.style.MozUserSelect = 'text';\n mark.style.msUserSelect = 'text';\n mark.style.userSelect = 'text';\n mark.addEventListener('copy', function (e) {\n e.stopPropagation();\n if (options.format) {\n e.preventDefault();\n if (typeof e.clipboardData === 'undefined') { // IE 11\n debug && console.warn('unable to use e.clipboardData');\n debug && console.warn('trying IE specific stuff');\n window.clipboardData.clearData();\n var format = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting['default']\n window.clipboardData.setData(format, text);\n } else { // all other browsers\n e.clipboardData.clearData();\n e.clipboardData.setData(options.format, text);\n }\n }\n if (options.onCopy) {\n e.preventDefault();\n options.onCopy(e.clipboardData);\n }\n });\n\n document.body.appendChild(mark);\n\n range.selectNodeContents(mark);\n selection.addRange(range);\n\n const successful = document.execCommand('copy');\n if (!successful) {\n throw new Error('copy command was unsuccessful');\n }\n success = true;\n } catch (err) {\n debug && console.error('unable to copy using execCommand: ', err);\n debug && console.warn('trying IE specific stuff');\n try {\n window.clipboardData.setData(options.format || 'text', text);\n options.onCopy && options.onCopy(window.clipboardData);\n success = true;\n } catch (err) {\n debug && console.error('unable to copy using clipboardData: ', err);\n debug && console.error('falling back to prompt');\n let message = format('message' in options ? options.message : defaultMessage);\n window.prompt(message, text);\n }\n } finally {\n if (selection) {\n if (typeof selection.removeRange === 'function') {\n selection.removeRange(range);\n } else {\n selection.removeAllRanges();\n }\n }\n\n if (mark) {\n document.body.removeChild(mark);\n }\n reselectPrevious();\n }\n\n return success;\n}\n\nmodule.exports = copy;"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAe,GAAI;EACxB,IAAMC,SAAS,GAAGC,QAAQ,CAACC,YAAY,EAAE;EACzC,IAAI,CAACF,SAAS,CAACG,UAAU,EAAE;IACvB,OAAO,YAAY,CAAC,CAAC;EACzB;EACA,IAAIC,MAAM,GAAGH,QAAQ,CAACI,aAAa;EAEnC,IAAMC,MAAM,GAAG,EAAE;EACjB,KAAK,IAAIC,CAAC,GAAG,CA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MACtDnB,OAAO,GAAG,IAAI;IAClB,CAAC,CAAC,OAAOgC,GAAG,EAAE;MACVnC,KAAK,IAAIuB,OAAO,CAACa,KAAK,CAAC,sCAAsC,EAAED,GAAG,CAAC;MACnEnC,KAAK,IAAIuB,OAAO,CAACa,KAAK,CAAC,wBAAwB,CAAC;MAChD,IAAI7C,OAAO,GAAGD,MAAM,CAAC,SAAS,IAAIS,OAAO,GAAGA,OAAO,CAACR,OAAO,GAAGF,cAAc,CAAC;MAC7EoC,MAAM,CAACY,MAAM,CAAC9C,OAAO,EAAEO,IAAI,CAAC;IAChC;EACJ,CAAC,SAAS;IACN,IAAI7B,SAAS,EAAE;MACX,IAAI,OAAOA,SAAS,CAACqE,WAAW,KAAK,UAAU,EAAE;QAC7CrE,SAAS,CAACqE,WAAW,CAACrD,KAAK,CAAC;MAChC,CAAC,MAAM;QACHhB,SAAS,CAACa,eAAe,EAAE;MAC/B;IACJ;IAEA,IAAIoB,IAAI,EAAE;MACNhC,QAAQ,CAAC2D,IAAI,CAACU,WAAW,CAACrC,IAAI,CAAC;IACnC;IACAD,gBAAgB,EAAE;EACtB;EAEA,OAAOE,OAAO;AAClB;AAEAqC,MAAM,CAACC,OAAO,GAAG5C,IAAI"}
1
+ {"version":3,"file":"copy-to-clipboard.js","names":["deselectCurrent","selection","document","getSelection","rangeCount","active","activeElement","ranges","i","push","getRangeAt","tagName","toUpperCase","blur","removeAllRanges","type","forEach","range","addRange","focus","clipboardToIE11Formatting","defaultMessage","format","message","copyKey","test","navigator","userAgent","replace","copy","text","options","debug","reselectPrevious","mark","success","createRange","createElement","textContent","ariaHidden","style","all","position","top","clip","whiteSpace","webkitUserSelect","MozUserSelect","msUserSelect","userSelect","addEventListener","e","stopPropagation","preventDefault","clipboardData","console","warn","window","clearData","setData","onCopy","body","appendChild","selectNodeContents","successful","execCommand","Error","err","error","prompt","removeRange","removeChild","module","exports"],"sources":["copy-to-clipboard.js"],"sourcesContent":["/*\nMIT License\n\nCopyright (c) 2017 sudodoki <smd.deluzion@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n */\n// https://github.com/sudodoki/toggle-selection/blob/gh-pages/index.js\nfunction deselectCurrent () {\n const selection = document.getSelection();\n if (!selection.rangeCount) {\n return function () {};\n }\n let active = document.activeElement;\n\n const ranges = [];\n for (let i = 0; i < selection.rangeCount; i++) {\n ranges.push(selection.getRangeAt(i));\n }\n\n switch (active.tagName.toUpperCase()) { // .toUpperCase handles XHTML\n case 'INPUT':\n case 'TEXTAREA':\n active.blur();\n break;\n\n default:\n active = null;\n break;\n }\n\n selection.removeAllRanges();\n return function () {\n selection.type === 'Caret' &&\n selection.removeAllRanges();\n\n if (!selection.rangeCount) {\n ranges.forEach(function (range) {\n selection.addRange(range);\n });\n }\n\n active && active.focus();\n };\n}\n\n// https://github.com/sudodoki/copy-to-clipboard/blob/master/index.js\n\nconst clipboardToIE11Formatting = {\n 'text/plain': 'Text',\n 'text/html': 'Url',\n 'default': 'Text',\n};\n\nconst defaultMessage = 'Copy to clipboard: #{key}, Enter';\n\nfunction format(message) {\n const copyKey = (/mac os x/i.test(navigator.userAgent) ? '⌘' : 'Ctrl') + '+C';\n return message.replace(/#{\\s*key\\s*}/g, copyKey);\n}\n\nfunction copy(text, options) {\n let debug;\n let reselectPrevious;\n let range;\n let selection;\n let mark;\n let success = false;\n if (!options) {\n options = {};\n }\n debug = options.debug || false;\n try {\n reselectPrevious = deselectCurrent();\n\n range = document.createRange();\n selection = document.getSelection();\n\n mark = document.createElement('span');\n mark.textContent = text;\n // avoid screen readers from reading out loud the text\n mark.ariaHidden = 'true';\n // reset user styles for span element\n mark.style.all = 'unset';\n // prevents scrolling to the end of the page\n mark.style.position = 'fixed';\n mark.style.top = 0;\n mark.style.clip = 'rect(0, 0, 0, 0)';\n // used to preserve spaces and line breaks\n mark.style.whiteSpace = 'pre';\n // do not inherit user-select (it may be `none`)\n mark.style.webkitUserSelect = 'text';\n mark.style.MozUserSelect = 'text';\n mark.style.msUserSelect = 'text';\n mark.style.userSelect = 'text';\n mark.addEventListener('copy', function (e) {\n e.stopPropagation();\n if (options.format) {\n e.preventDefault();\n if (typeof e.clipboardData === 'undefined') { // IE 11\n debug && console.warn('unable to use e.clipboardData');\n debug && console.warn('trying IE specific stuff');\n window.clipboardData.clearData();\n var format = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting['default']\n window.clipboardData.setData(format, text);\n } else { // all other browsers\n e.clipboardData.clearData();\n e.clipboardData.setData(options.format, text);\n }\n }\n if (options.onCopy) {\n e.preventDefault();\n options.onCopy(e.clipboardData);\n }\n });\n\n document.body.appendChild(mark);\n\n range.selectNodeContents(mark);\n selection.addRange(range);\n\n const successful = document.execCommand('copy');\n if (!successful) {\n throw new Error('copy command was unsuccessful');\n }\n success = true;\n } catch (err) {\n debug && console.error('unable to copy using execCommand: ', err);\n debug && console.warn('trying IE specific stuff');\n try {\n window.clipboardData.setData(options.format || 'text', text);\n options.onCopy && options.onCopy(window.clipboardData);\n success = true;\n } catch (err) {\n debug && console.error('unable to copy using clipboardData: ', err);\n debug && console.error('falling back to prompt');\n let message = format('message' in options ? options.message : defaultMessage);\n window.prompt(message, text);\n }\n } finally {\n if (selection) {\n if (typeof selection.removeRange === 'function') {\n selection.removeRange(range);\n } else {\n selection.removeAllRanges();\n }\n }\n\n if (mark) {\n document.body.removeChild(mark);\n }\n reselectPrevious();\n }\n\n return success;\n}\n\nmodule.exports = copy;"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAe,GAAI;EACxB,IAAMC,SAAS,GAAGC,QAAQ,CAACC,YAAY,EAAE;EACzC,IAAI,CAACF,SAAS,CAACG,UAAU,EAAE;IACvB,OAAO,YAAY,CAAC,CAAC;EACzB;EACA,IAAIC,MAAM,GAAGH,QAAQ,CAACI,aAAa;EAEnC,IAAMC,MAAM,GAAG,EAAE;EACjB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGP,SAAS,CAACG,UAAU,EAAEI,CAAC,EAAE,EAAE;IAC3CD,MAAM,CAACE,IAAI,CAACR,SAAS,CAACS,UAAU,CAACF,CAAC,CAAC,CAAC;EACxC;EAEA,QAAQH,MAAM,CAACM,OAAO,CAACC,WAAW,EAAE;IAAI;IACpC,KAAK,OAAO;IACZ,KAAK,UAAU;MACXP,MAAM,CAACQ,IAAI,EAAE;MACb;IAEJ;MACIR,MAAM,GAAG,IAAI;MACb;EAAM;EAGdJ,SAAS,CAACa,eAAe,EAAE;EAC3B,OAAO,YAAY;IACfb,SAAS,CAACc,IAAI,KAAK,OAAO,IAC1Bd,SAAS,CAACa,eAAe,EAAE;IAE3B,IAAI,CAACb,SAAS,CAACG,UAAU,EAAE;MACvBG,MAAM,CAACS,OAAO,CAAC,UAAUC,KAAK,EAAE;QAC5BhB,SAAS,CAACiB,QAAQ,CAACD,KAAK,CAAC;MAC7B,CAAC,CA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AI,EAAE;MACNhC,QAAQ,CAAC2D,IAAI,CAACU,WAAW,CAACrC,IAAI,CAAC;IACnC;IACAD,gBAAgB,EAAE;EACtB;EAEA,OAAOE,OAAO;AAClB;AAEAqC,MAAM,CAACC,OAAO,GAAG5C,IAAI"}
@@ -1,9 +1,9 @@
1
1
  export default _export;
2
- export type DialogSelectIDProps = {
2
+ export type DialogSelectFileProps = {
3
3
  /**
4
- * The internal name of the dialog; default: "default"
4
+ * PropTypes.string, // where to store settings in localStorage *
5
5
  */
6
- dialogName?: string;
6
+ dialogName?: boolean;
7
7
  /**
8
8
  * The dialog title; default: Please select object ID... (translated)
9
9
  */
@@ -27,7 +27,7 @@ export type DialogSelectIDProps = {
27
27
  /**
28
28
  * The socket connection.
29
29
  */
30
- socket: import('../Connection').default;
30
+ socket?: import('../Connection').default;
31
31
  /**
32
32
  * Theme name.
33
33
  */
@@ -48,14 +48,54 @@ export type DialogSelectIDProps = {
48
48
  * The cancel button text; default: Cancel (translated)
49
49
  */
50
50
  cancel?: string;
51
+ /**
52
+ * If download of files enabled
53
+ */
54
+ allowUpload?: boolean;
55
+ /**
56
+ * If download of files enabled
57
+ */
58
+ allowDownload?: boolean;
59
+ /**
60
+ * If creation of folders enabled
61
+ */
62
+ allowCreateFolder?: boolean;
63
+ /**
64
+ * If creation of folders enabled
65
+ */
66
+ allowDelete?: boolean;
67
+ /**
68
+ * if tile view enabled (default true)
69
+ */
70
+ allowView?: boolean;
71
+ /**
72
+ * Show toolbar (default true)
73
+ */
74
+ showToolbar?: boolean;
75
+ /**
76
+ * Limit file browser to one specific objectID of type meta and following path (like vis.0/main)
77
+ */
78
+ limitPath?: any[];
79
+ /**
80
+ * like `['png', 'svg', 'bmp', 'jpg', 'jpeg']`
81
+ */
82
+ filterFiles?: any[];
83
+ /**
84
+ * images, code, txt, audio, video
85
+ */
86
+ filterByType?: string;
87
+ /**
88
+ * allow only folder's selection *
89
+ */
90
+ selectOnlyFolders?: bool;
51
91
  /**
52
92
  * Close handler that is always called when the dialog is closed.
53
93
  */
54
94
  onClose: () => void;
55
95
  /**
56
- * Handler that is called when the user presses OK.
96
+ * Handler that is called when the user presses OK or by double click.
57
97
  */
58
- onOk: (selected: string | string[] | undefined, name: string) => void;
98
+ onOk: (selected: string | string[] | undefined) => void;
59
99
  /**
60
100
  * The styling class names.
61
101
  */
@@ -68,9 +108,8 @@ export type DialogSelectIDProps = {
68
108
  /** @type {typeof DialogSelectFile} */
69
109
  declare const _export: typeof DialogSelectFile;
70
110
  /**
71
- * @typedef {object} DialogSelectIDProps
72
- * @property {string} [dialogName] The internal name of the dialog; default: "default"
73
- * @property {string} [title] The dialog title; default: Please select object ID... (translated)
111
+ * @typedef {object} DialogSelectFileProps
112
+ * @property {boolean} [dialogName] PropTypes.string, // where to store settings in localStorage * @property {string} [title] The dialog title; default: Please select object ID... (translated)
74
113
  * @property {boolean} [multiSelect] Set to true to allow the selection of multiple IDs.
75
114
  * @property {string} [imagePrefix] Prefix (default: '.')
76
115
  * @property {boolean} [showExpertButton] Show the expert button?
@@ -81,21 +120,32 @@ declare const _export: typeof DialogSelectFile;
81
120
  * @property {string | string[]} [selected] The selected IDs.
82
121
  * @property {string} [ok] The ok button text; default: OK (translated)
83
122
  * @property {string} [cancel] The cancel button text; default: Cancel (translated)
84
- * @property {() => void} onClose Close handler that is always called when the dialog is closed.
85
- * @property {(selected: string | string[] | undefined, name: string) => void} onOk Handler that is called when the user presses OK.
123
+ * @property {boolean} [socket] Socket class (required)
124
+ * @property {boolean} [allowUpload] If download of files enabled
125
+ * @property {boolean} [allowDownload] If download of files enabled
126
+ * @property {boolean} [allowCreateFolder] If creation of folders enabled
127
+ * @property {boolean} [allowDelete] If creation of folders enabled
128
+ * @property {boolean} [allowView] if tile view enabled (default true)
129
+ * @property {boolean} [showToolbar] Show toolbar (default true)
130
+ * @property {array} [limitPath] Limit file browser to one specific objectID of type meta and following path (like vis.0/main)
131
+ * @property {array} [filterFiles] like `['png', 'svg', 'bmp', 'jpg', 'jpeg']`
132
+ * @property {string} [filterByType] images, code, txt, audio, video
133
+ * @property {bool} [selectOnlyFolders] allow only folder's selection * @property {() => void} onClose Close handler that is always called when the dialog is closed.
134
+ * @property {(selected: string | string[] | undefined) => void} onOk Handler that is called when the user presses OK or by double click.
86
135
  * @property {{headerID: string; dialog: string; content: string}} [classes] The styling class names.
87
136
  *
88
137
  * @extends {React.Component<DialogSelectIDProps>}
89
138
  */
90
139
  declare class DialogSelectFile extends React.Component<DialogSelectIDProps, any, any> {
91
140
  /**
92
- * @param {DialogSelectIDProps} props
141
+ * @param {DialogSelectFileProps} props
93
142
  */
94
- constructor(props: DialogSelectIDProps);
143
+ constructor(props: DialogSelectFileProps);
95
144
  dialogName: string;
96
145
  filters: any;
97
146
  state: {
98
- selected: string[];
147
+ selected: any;
148
+ isFolder: boolean;
99
149
  };
100
150
  handleCancel(): void;
101
151
  handleOk(): void;
@@ -103,25 +153,29 @@ declare class DialogSelectFile extends React.Component<DialogSelectIDProps, any,
103
153
  }
104
154
  declare namespace DialogSelectFile {
105
155
  namespace propTypes {
156
+ const imagePrefix: PropTypes.Requireable<string>;
106
157
  const dialogName: PropTypes.Requireable<string>;
158
+ const selected: PropTypes.Requireable<NonNullable<string | any[]>>;
107
159
  const classes: PropTypes.Requireable<object>;
160
+ const onClose: PropTypes.Validator<(...args: any[]) => any>;
161
+ const onOk: PropTypes.Validator<(...args: any[]) => any>;
162
+ const ok: PropTypes.Requireable<string>;
163
+ const cancel: PropTypes.Requireable<string>;
164
+ const socket: PropTypes.Validator<object>;
108
165
  const allowUpload: PropTypes.Requireable<boolean>;
109
166
  const allowDownload: PropTypes.Requireable<boolean>;
110
167
  const allowCreateFolder: PropTypes.Requireable<boolean>;
111
168
  const allowDelete: PropTypes.Requireable<boolean>;
112
169
  const allowView: PropTypes.Requireable<boolean>;
113
170
  const showToolbar: PropTypes.Requireable<boolean>;
171
+ const filterFiles: PropTypes.Requireable<string[]>;
114
172
  const filterByType: PropTypes.Requireable<string>;
173
+ const limitPath: PropTypes.Requireable<string>;
174
+ const selectOnlyFolders: PropTypes.Requireable<boolean>;
175
+ const showViewTypeButton: PropTypes.Requireable<boolean>;
115
176
  const showTypeSelector: PropTypes.Requireable<boolean>;
116
- const onClose: PropTypes.Validator<(...args: any[]) => any>;
117
- const onOk: PropTypes.Validator<(...args: any[]) => any>;
118
177
  const title: PropTypes.Requireable<string>;
119
178
  const lang: PropTypes.Requireable<string>;
120
- const selected: PropTypes.Requireable<NonNullable<string | any[]>>;
121
- const socket: PropTypes.Validator<object>;
122
- const cancel: PropTypes.Requireable<string>;
123
- const imagePrefix: PropTypes.Requireable<string>;
124
- const ok: PropTypes.Requireable<string>;
125
179
  const themeName: PropTypes.Requireable<string>;
126
180
  const themeType: PropTypes.Requireable<string>;
127
181
  const showExpertButton: PropTypes.Requireable<boolean>;
@@ -64,9 +64,8 @@ var styles = function styles() {
64
64
  };
65
65
 
66
66
  /**
67
- * @typedef {object} DialogSelectIDProps
68
- * @property {string} [dialogName] The internal name of the dialog; default: "default"
69
- * @property {string} [title] The dialog title; default: Please select object ID... (translated)
67
+ * @typedef {object} DialogSelectFileProps
68
+ * @property {boolean} [dialogName] PropTypes.string, // where to store settings in localStorage * @property {string} [title] The dialog title; default: Please select object ID... (translated)
70
69
  * @property {boolean} [multiSelect] Set to true to allow the selection of multiple IDs.
71
70
  * @property {string} [imagePrefix] Prefix (default: '.')
72
71
  * @property {boolean} [showExpertButton] Show the expert button?
@@ -77,8 +76,18 @@ var styles = function styles() {
77
76
  * @property {string | string[]} [selected] The selected IDs.
78
77
  * @property {string} [ok] The ok button text; default: OK (translated)
79
78
  * @property {string} [cancel] The cancel button text; default: Cancel (translated)
80
- * @property {() => void} onClose Close handler that is always called when the dialog is closed.
81
- * @property {(selected: string | string[] | undefined, name: string) => void} onOk Handler that is called when the user presses OK.
79
+ * @property {boolean} [socket] Socket class (required)
80
+ * @property {boolean} [allowUpload] If download of files enabled
81
+ * @property {boolean} [allowDownload] If download of files enabled
82
+ * @property {boolean} [allowCreateFolder] If creation of folders enabled
83
+ * @property {boolean} [allowDelete] If creation of folders enabled
84
+ * @property {boolean} [allowView] if tile view enabled (default true)
85
+ * @property {boolean} [showToolbar] Show toolbar (default true)
86
+ * @property {array} [limitPath] Limit file browser to one specific objectID of type meta and following path (like vis.0/main)
87
+ * @property {array} [filterFiles] like `['png', 'svg', 'bmp', 'jpg', 'jpeg']`
88
+ * @property {string} [filterByType] images, code, txt, audio, video
89
+ * @property {bool} [selectOnlyFolders] allow only folder's selection * @property {() => void} onClose Close handler that is always called when the dialog is closed.
90
+ * @property {(selected: string | string[] | undefined) => void} onOk Handler that is called when the user presses OK or by double click.
82
91
  * @property {{headerID: string; dialog: string; content: string}} [classes] The styling class names.
83
92
  *
84
93
  * @extends {React.Component<DialogSelectIDProps>}
@@ -87,7 +96,7 @@ var DialogSelectFile = /*#__PURE__*/function (_React$Component) {
87
96
  (0, _inherits2["default"])(DialogSelectFile, _React$Component);
88
97
  var _super = _createSuper(DialogSelectFile);
89
98
  /**
90
- * @param {DialogSelectIDProps} props
99
+ * @param {DialogSelectFileProps} props
91
100
  */
92
101
  function DialogSelectFile(props) {
93
102
  var _this;
@@ -114,7 +123,8 @@ var DialogSelectFile = /*#__PURE__*/function (_React$Component) {
114
123
  return id;
115
124
  });
116
125
  _this.state = {
117
- selected: selected
126
+ selected: selected,
127
+ isFolder: false
118
128
  };
119
129
  return _this;
120
130
  }
@@ -171,16 +181,27 @@ var DialogSelectFile = /*#__PURE__*/function (_React$Component) {
171
181
  className: _Utils["default"].clsx(this.props.classes.content, this.props.classes.contentMobile)
172
182
  }, /*#__PURE__*/_react["default"].createElement(_FileBrowser["default"], {
173
183
  ready: true,
174
- allowUpload: this.props.allowUpload,
175
- allowDownload: this.props.allowDownload,
176
- allowCreateFolder: this.props.allowCreateFolder,
177
- allowDelete: this.props.allowDelete,
178
- allowView: this.props.allowView,
179
- showToolbar: this.props.showToolbar,
180
184
  imagePrefix: this.props.imagePrefix || this.props.prefix || '../' // prefix is for back compatibility
181
185
  ,
182
- selected: this.props.selected,
186
+ allowUpload: !!this.props.allowUpload,
187
+ allowDownload: this.props.allowDownload !== false,
188
+ allowCreateFolder: !!this.props.allowCreateFolder,
189
+ allowDelete: !!this.props.allowDelete,
190
+ allowView: this.props.allowView !== false,
191
+ showViewTypeButton: this.props.showViewTypeButton !== false,
192
+ showToolbar: this.props.showToolbar !== false,
193
+ limitPath: this.props.limitPath,
194
+ filterFiles: this.props.filterFiles,
183
195
  filterByType: this.props.filterByType,
196
+ selected: this.props.selected,
197
+ onSelect: function onSelect(selected, isDoubleClick, isFolder) {
198
+ _this2.setState({
199
+ selected: selected,
200
+ isFolder: isFolder
201
+ }, function () {
202
+ return isDoubleClick && (!_this2.props.selectOnlyFolders || isFolder) && _this2.handleOk();
203
+ });
204
+ },
184
205
  t: this.props.t || _i18n["default"].t,
185
206
  lang: this.props.lang || _i18n["default"].getLanguage(),
186
207
  socket: this.props.socket,
@@ -188,18 +209,7 @@ var DialogSelectFile = /*#__PURE__*/function (_React$Component) {
188
209
  themeName: this.props.themeName,
189
210
  showExpertButton: this.props.showExpertButton,
190
211
  expertMode: this.props.expertMode,
191
- showTypeSelector: this.props.showTypeSelector,
192
- onSelect: function onSelect(selected, isDouble) {
193
- if (JSON.stringify(selected) !== JSON.stringify(_this2.state.selected)) {
194
- _this2.setState({
195
- selected: selected
196
- }, function () {
197
- return isDouble && _this2.handleOk();
198
- });
199
- } else if (isDouble) {
200
- _this2.handleOk();
201
- }
202
- }
212
+ showTypeSelector: this.props.showTypeSelector
203
213
  })), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
204
214
  variant: "contained",
205
215
  onClick: function onClick() {
@@ -221,31 +231,37 @@ var DialogSelectFile = /*#__PURE__*/function (_React$Component) {
221
231
  return DialogSelectFile;
222
232
  }(_react["default"].Component);
223
233
  DialogSelectFile.propTypes = {
234
+ imagePrefix: _propTypes["default"].string,
224
235
  dialogName: _propTypes["default"].string,
225
236
  // where to store settings in localStorage
237
+ selected: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].array // not implemented
238
+ ]),
226
239
  classes: _propTypes["default"].object,
240
+ onClose: _propTypes["default"].func.isRequired,
241
+ onOk: _propTypes["default"].func.isRequired,
242
+ ok: _propTypes["default"].string,
243
+ cancel: _propTypes["default"].string,
244
+ socket: _propTypes["default"].object.isRequired,
227
245
  allowUpload: _propTypes["default"].bool,
228
246
  allowDownload: _propTypes["default"].bool,
229
247
  allowCreateFolder: _propTypes["default"].bool,
230
248
  allowDelete: _propTypes["default"].bool,
231
249
  allowView: _propTypes["default"].bool,
250
+ // allow view of files
232
251
  showToolbar: _propTypes["default"].bool,
252
+ filterFiles: _propTypes["default"].arrayOf(_propTypes["default"].string),
253
+ // array of extensions ['jpg', 'png]
233
254
  filterByType: _propTypes["default"].string,
234
255
  // e.g. images
256
+ limitPath: _propTypes["default"].string,
257
+ selectOnlyFolders: _propTypes["default"].bool,
258
+ showViewTypeButton: _propTypes["default"].bool,
259
+ // Allow switch views Table<=>Rows
235
260
  showTypeSelector: _propTypes["default"].bool,
236
261
  // If type selector should be shown
237
262
 
238
- onClose: _propTypes["default"].func.isRequired,
239
- onOk: _propTypes["default"].func.isRequired,
240
263
  title: _propTypes["default"].string,
241
264
  lang: _propTypes["default"].string,
242
- selected: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].array // not implemented
243
- ]),
244
-
245
- socket: _propTypes["default"].object.isRequired,
246
- cancel: _propTypes["default"].string,
247
- imagePrefix: _propTypes["default"].string,
248
- ok: _propTypes["default"].string,
249
265
  themeName: _propTypes["default"].string,
250
266
  themeType: _propTypes["default"].string,
251
267
  showExpertButton: _propTypes["default"].bool,
@@ -1 +1 @@
1
- {"version":3,"file":"SelectFile.js","names":["styles","headerID","fontWeight","fontStyle","dialog","height","dialogMobile","padding","width","maxWidth","maxHeight","content","overflow","contentMobile","titleRoot","whiteSpace","display","textOverflow","DialogSelectFile","props","dialogName","filters","window","_localStorage","localStorage","getItem","JSON","parse","e","selected","filter","id","state","onClose","onOk","multiSelect","Array","isArray","title","length","I18n","t","classes","paper","Utils","clsx","root","allowUpload","allowDownload","allowCreateFolder","allowDelete","allowView","showToolbar","imagePrefix","prefix","filterByType","lang","getLanguage","socket","themeType","themeName","showExpertButton","expertMode","showTypeSelector","isDouble","stringify","setState","handleOk","ok","handleCancel","cancel","React","Component","propTypes","PropTypes","string","object","bool","func","isRequired","oneOfType","array","_export","withStyles"],"sources":["SelectFile.jsx"],"sourcesContent":["/*\n * Copyright 2022 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 from 'react';\nimport PropTypes from 'prop-types';\nimport withStyles from '@mui/styles/withStyles';\n\nimport Button from '@mui/material/Button';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogActions from '@mui/material/DialogActions';\nimport Dialog from '@mui/material/Dialog';\n\nimport IconCancel from '@mui/icons-material/Cancel';\nimport IconOk from '@mui/icons-material/Check';\n\nimport Utils from '../Components/Utils';\nimport I18n from '../i18n';\nimport FileBrowser from '../Components/FileBrowser';\n\nconst styles = () => ({\n headerID: {\n fontWeight: 'bold',\n fontStyle: 'italic',\n },\n dialog: {\n height: '95%',\n },\n dialogMobile: {\n padding: 4,\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\n/**\n * @typedef {object} DialogSelectIDProps\n * @property {string} [dialogName] The internal name of the dialog; default: \"default\"\n * @property {string} [title] The dialog title; default: Please select object ID... (translated)\n * @property {boolean} [multiSelect] Set to true to allow the selection of multiple IDs.\n * @property {string} [imagePrefix] Prefix (default: '.')\n * @property {boolean} [showExpertButton] Show the expert button?\n * @property {ioBroker.Languages} [lang] The language.\n * @property {import('../Connection').default} socket The socket connection.\n * @property {string} [themeName] Theme name.\n * @property {string} [themeType] Theme type.\n * @property {string | string[]} [selected] The selected IDs.\n * @property {string} [ok] The ok button text; default: OK (translated)\n * @property {string} [cancel] The cancel button text; default: Cancel (translated)\n * @property {() => void} onClose Close handler that is always called when the dialog is closed.\n * @property {(selected: string | string[] | undefined, name: string) => void} onOk Handler that is called when the user presses OK.\n * @property {{headerID: string; dialog: string; content: string}} [classes] The styling class names.\n *\n * @extends {React.Component<DialogSelectIDProps>}\n */\nclass DialogSelectFile extends React.Component {\n /**\n * @param {DialogSelectIDProps} props\n */\n constructor(props) {\n super(props);\n this.dialogName = this.props.dialogName || 'default';\n this.dialogName = `SelectFile.${this.dialogName}`;\n\n this.filters = (window._localStorage || window.localStorage).getItem(this.dialogName) || '{}';\n\n try {\n this.filters = JSON.parse(this.filters);\n } catch (e) {\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() {\n this.props.onClose();\n }\n\n handleOk() {\n this.props.onOk(this.props.multiSelect || !Array.isArray(this.state.selected) ? this.state.selected : this.state.selected[0] || '');\n this.props.onClose();\n }\n\n render() {\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 key=\"id\" className={this.props.classes.headerID}>\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 key=\"id\" className={this.props.classes.headerID}>\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 <Dialog\n onClose={() => {}}\n maxWidth={false}\n classes={{ paper: Utils.clsx(this.props.classes.dialog, this.props.classes.dialogMobile) }}\n fullWidth\n open={!0}\n aria-labelledby=\"selectfile-dialog-title\"\n >\n <DialogTitle id=\"selectfile-dialog-title\" classes={{ root: this.props.classes.titleRoot }}>{title}</DialogTitle>\n <DialogContent className={Utils.clsx(this.props.classes.content, this.props.classes.contentMobile)}>\n <FileBrowser\n ready\n allowUpload={this.props.allowUpload}\n allowDownload={this.props.allowDownload}\n allowCreateFolder={this.props.allowCreateFolder}\n allowDelete={this.props.allowDelete}\n allowView={this.props.allowView}\n showToolbar={this.props.showToolbar}\n imagePrefix={this.props.imagePrefix || this.props.prefix || '../'} // prefix is for back compatibility\n selected={this.props.selected}\n filterByType={this.props.filterByType}\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 showExpertButton={this.props.showExpertButton}\n expertMode={this.props.expertMode}\n showTypeSelector={this.props.showTypeSelector}\n onSelect={(selected, isDouble) => {\n if (JSON.stringify(selected) !== JSON.stringify(this.state.selected)) {\n this.setState({ selected }, () =>\n isDouble && this.handleOk());\n } else if (isDouble) {\n this.handleOk();\n }\n }}\n />\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" onClick={() => this.handleOk()} startIcon={<IconOk />} disabled={!this.state.selected.length} color=\"primary\">{this.props.ok || I18n.t('ra_Ok')}</Button>\n <Button color=\"grey\" variant=\"contained\" onClick={() => this.handleCancel()} startIcon={<IconCancel />}>{this.props.cancel || I18n.t('ra_Cancel')}</Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nDialogSelectFile.propTypes = {\n dialogName: PropTypes.string, // where to store settings in localStorage\n classes: PropTypes.object,\n allowUpload: PropTypes.bool,\n allowDownload: PropTypes.bool,\n allowCreateFolder: PropTypes.bool,\n allowDelete: PropTypes.bool,\n allowView: PropTypes.bool,\n showToolbar: PropTypes.bool,\n filterByType: PropTypes.string, // e.g. images\n showTypeSelector: PropTypes.bool, // If type selector should be shown\n\n onClose: PropTypes.func.isRequired,\n onOk: PropTypes.func.isRequired,\n title: PropTypes.string,\n lang: PropTypes.string,\n selected: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.array, // not implemented\n ]),\n socket: PropTypes.object.isRequired,\n cancel: PropTypes.string,\n imagePrefix: PropTypes.string,\n ok: PropTypes.string,\n themeName: PropTypes.string,\n themeType: PropTypes.string,\n showExpertButton: PropTypes.bool,\n expertMode: PropTypes.bool, // force expert mode\n multiSelect: PropTypes.bool, // not implemented\n};\n\n/** @type {typeof DialogSelectFile} */\nconst _export = withStyles(styles)(DialogSelectFile);\nexport default _export;\n"],"mappings":";;;;;;;;;;;;;;;AAOA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAAoD;AAAA;AAAA;AAAA;AAEpD,IAAMA,MAAM,GAAG,SAATA,MAAM;EAAA,OAAU;IAClBC,QAAQ,EAAE;MACNC,UAAU,EAAE,MAAM;MAClBC,SAAS,EAAE;IACf,CAAC;IACDC,MAAM,EAAE;MACJC,MAAM,EAAE;IACZ,CAAC;IACDC,YAAY,EAAE;MACVC,OAAO,EAAE,CAAC;MACVC,KAAK,EAAE,MAAM;MACbC,QAAQ,EAAE,MAAM;MAChBC,SAAS,EAAE,mBAAmB;MAC9BL,MAAM,EAAE;IACZ,CAAC;IACDM,OAAO,EAAE;MACLN,MAAM,EAAE,MAAM;MACdO,QAAQ,EAAE;IACd,CAAC;IACDC,aAAa,EAAE;MACXN,OAAO,EAAE;IACb,CAAC;IACDO,SAAS,EAAE;MACPC,UAAU,EAAE,QAAQ;MACpBP,KAAK,EAAE,mBAAmB;MAC1BI,QAAQ,EAAE,QAAQ;MAClBI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AEgB,qBAAS,CAACE,MAAM,CAACG,UAAU;EACnCT,MAAM,EAAEI,qBAAS,CAACC,MAAM;EACxBtB,WAAW,EAAEqB,qBAAS,CAACC,MAAM;EAC7BP,EAAE,EAAEM,qBAAS,CAACC,MAAM;EACpBf,SAAS,EAAEc,qBAAS,CAACC,MAAM;EAC3BhB,SAAS,EAAEe,qBAAS,CAACC,MAAM;EAC3Bd,gBAAgB,EAAEa,qBAAS,CAACG,IAAI;EAChCf,UAAU,EAAEY,qBAAS,CAACG,IAAI;EAAE;EAC5B1C,WAAW,EAAEuC,qBAAS,CAACG,IAAI,CAAE;AACjC,CAAC;;AAED;AACA,IAAMK,OAAO,GAAG,IAAAC,sBAAU,EAACnF,MAAM,CAAC,CAACkB,gBAAgB,CAAC;AAAC,eACtCgE,OAAO;AAAA"}
1
+ {"version":3,"file":"SelectFile.js","names":["styles","headerID","fontWeight","fontStyle","dialog","height","dialogMobile","padding","width","maxWidth","maxHeight","content","overflow","contentMobile","titleRoot","whiteSpace","display","textOverflow","DialogSelectFile","props","dialogName","filters","window","_localStorage","localStorage","getItem","JSON","parse","e","selected","filter","id","state","isFolder","onClose","onOk","multiSelect","Array","isArray","title","length","I18n","t","classes","paper","Utils","clsx","root","imagePrefix","prefix","allowUpload","allowDownload","allowCreateFolder","allowDelete","allowView","showViewTypeButton","showToolbar","limitPath","filterFiles","filterByType","isDoubleClick","setState","selectOnlyFolders","handleOk","lang","getLanguage","socket","themeType","themeName","showExpertButton","expertMode","showTypeSelector","ok","handleCancel","cancel","React","Component","propTypes","PropTypes","string","oneOfType","array","object","func","isRequired","bool","arrayOf","_export","withStyles"],"sources":["SelectFile.jsx"],"sourcesContent":["/*\n * Copyright 2022 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 from 'react';\nimport PropTypes from 'prop-types';\nimport withStyles from '@mui/styles/withStyles';\n\nimport Button from '@mui/material/Button';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogActions from '@mui/material/DialogActions';\nimport Dialog from '@mui/material/Dialog';\n\nimport IconCancel from '@mui/icons-material/Cancel';\nimport IconOk from '@mui/icons-material/Check';\n\nimport Utils from '../Components/Utils';\nimport I18n from '../i18n';\nimport FileBrowser from '../Components/FileBrowser';\n\nconst styles = () => ({\n headerID: {\n fontWeight: 'bold',\n fontStyle: 'italic',\n },\n dialog: {\n height: '95%',\n },\n dialogMobile: {\n padding: 4,\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\n/**\n * @typedef {object} DialogSelectFileProps\n * @property {boolean} [dialogName] PropTypes.string, // where to store settings in localStorage * @property {string} [title] The dialog title; default: Please select object ID... (translated)\n * @property {boolean} [multiSelect] Set to true to allow the selection of multiple IDs.\n * @property {string} [imagePrefix] Prefix (default: '.')\n * @property {boolean} [showExpertButton] Show the expert button?\n * @property {ioBroker.Languages} [lang] The language.\n * @property {import('../Connection').default} socket The socket connection.\n * @property {string} [themeName] Theme name.\n * @property {string} [themeType] Theme type.\n * @property {string | string[]} [selected] The selected IDs.\n * @property {string} [ok] The ok button text; default: OK (translated)\n * @property {string} [cancel] The cancel button text; default: Cancel (translated)\n * @property {boolean} [socket] Socket class (required)\n * @property {boolean} [allowUpload] If download of files enabled\n * @property {boolean} [allowDownload] If download of files enabled\n * @property {boolean} [allowCreateFolder] If creation of folders enabled\n * @property {boolean} [allowDelete] If creation of folders enabled\n * @property {boolean} [allowView] if tile view enabled (default true)\n * @property {boolean} [showToolbar] Show toolbar (default true)\n * @property {array} [limitPath] Limit file browser to one specific objectID of type meta and following path (like vis.0/main)\n * @property {array} [filterFiles] like `['png', 'svg', 'bmp', 'jpg', 'jpeg']`\n * @property {string} [filterByType] images, code, txt, audio, video\n * @property {bool} [selectOnlyFolders] allow only folder's selection * @property {() => void} onClose Close handler that is always called when the dialog is closed.\n * @property {(selected: string | string[] | undefined) => void} onOk Handler that is called when the user presses OK or by double click.\n * @property {{headerID: string; dialog: string; content: string}} [classes] The styling class names.\n *\n * @extends {React.Component<DialogSelectIDProps>}\n */\nclass DialogSelectFile extends React.Component {\n /**\n * @param {DialogSelectFileProps} props\n */\n constructor(props) {\n super(props);\n this.dialogName = this.props.dialogName || 'default';\n this.dialogName = `SelectFile.${this.dialogName}`;\n\n this.filters = (window._localStorage || window.localStorage).getItem(this.dialogName) || '{}';\n\n try {\n this.filters = JSON.parse(this.filters);\n } catch (e) {\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 isFolder: false,\n };\n }\n\n handleCancel() {\n this.props.onClose();\n }\n\n handleOk() {\n this.props.onOk(this.props.multiSelect || !Array.isArray(this.state.selected) ? this.state.selected : this.state.selected[0] || '');\n this.props.onClose();\n }\n\n render() {\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 key=\"id\" className={this.props.classes.headerID}>\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 key=\"id\" className={this.props.classes.headerID}>\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 <Dialog\n onClose={() => {}}\n maxWidth={false}\n classes={{ paper: Utils.clsx(this.props.classes.dialog, this.props.classes.dialogMobile) }}\n fullWidth\n open={!0}\n aria-labelledby=\"selectfile-dialog-title\"\n >\n <DialogTitle id=\"selectfile-dialog-title\" classes={{ root: this.props.classes.titleRoot }}>{title}</DialogTitle>\n <DialogContent className={Utils.clsx(this.props.classes.content, this.props.classes.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 onSelect={(selected, isDoubleClick, isFolder) => {\n this.setState({ selected, isFolder }, () =>\n isDoubleClick && (!this.props.selectOnlyFolders || isFolder) && this.handleOk());\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 showExpertButton={this.props.showExpertButton}\n expertMode={this.props.expertMode}\n showTypeSelector={this.props.showTypeSelector}\n />\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" onClick={() => this.handleOk()} startIcon={<IconOk />} disabled={!this.state.selected.length} color=\"primary\">{this.props.ok || I18n.t('ra_Ok')}</Button>\n <Button color=\"grey\" variant=\"contained\" onClick={() => this.handleCancel()} startIcon={<IconCancel />}>{this.props.cancel || I18n.t('ra_Cancel')}</Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nDialogSelectFile.propTypes = {\n imagePrefix: PropTypes.string,\n dialogName: PropTypes.string, // where to store settings in localStorage\n selected: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.array, // not implemented\n ]), classes: PropTypes.object,\n onClose: PropTypes.func.isRequired,\n onOk: PropTypes.func.isRequired,\n ok: PropTypes.string,\n cancel: PropTypes.string,\n socket: PropTypes.object.isRequired,\n allowUpload: PropTypes.bool,\n allowDownload: PropTypes.bool,\n allowCreateFolder: PropTypes.bool,\n allowDelete: PropTypes.bool,\n allowView: PropTypes.bool, // allow view of files\n showToolbar: PropTypes.bool,\n filterFiles: PropTypes.arrayOf(PropTypes.string), // array of extensions ['jpg', 'png]\n filterByType: PropTypes.string, // e.g. images\n limitPath: PropTypes.string,\n selectOnlyFolders: PropTypes.bool,\n showViewTypeButton: PropTypes.bool, // Allow switch views Table<=>Rows\n showTypeSelector: PropTypes.bool, // If type selector should be shown\n\n title: PropTypes.string,\n lang: PropTypes.string,\n\n themeName: PropTypes.string,\n themeType: PropTypes.string,\n showExpertButton: PropTypes.bool,\n expertMode: PropTypes.bool, // force expert mode\n multiSelect: PropTypes.bool, // not implemented\n};\n\n/** @type {typeof DialogSelectFile} */\nconst _export = withStyles(styles)(DialogSelectFile);\nexport default _export;\n"],"mappings":";;;;;;;;;;;;;;;AAOA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAAoD;AAAA;AAAA;AAAA;AAEpD,IAAMA,MAAM,GAAG,SAATA,MAAM;EAAA,OAAU;IAClBC,QAAQ,EAAE;MACNC,UAAU,EAAE,MAAM;MAClBC,SAAS,EAAE;IACf,CAAC;IACDC,MAAM,EAAE;MACJC,MAAM,EAAE;IACZ,CAAC;IACDC,YAAY,EAAE;MACVC,OAAO,EAAE,CAAC;MACVC,KAAK,EAAE,MAAM;MACbC,QAAQ,EAAE,MAAM;MAChBC,SAAS,EAAE,mBAAmB;MAC9BL,MAAM,EAAE;IACZ,CAAC;IACDM,OAAO,EAAE;MACLN,MAAM,EAAE,MAAM;MACdO,QAAQ,EAAE;IACd,CAAC;IACDC,aAAa,EAAE;MACXN,OAAO,EAAE;IACb,CAAC;IACDO,SAAS,EAAE;MACPC,UAAU,EAAE,QAAQ;MACpBP,KAAK,EAAE,mBAAmB;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,CAACO,IAAI;EAC3BlC,aAAa,EAAE2B,qBAAS,CAACO,IAAI;EAC7BjC,iBAAiB,EAAE0B,qBAAS,CAACO,IAAI;EACjChC,WAAW,EAAEyB,qBAAS,CAACO,IAAI;EAC3B/B,SAAS,EAAEwB,qBAAS,CAACO,IAAI;EAAE;EAC3B7B,WAAW,EAAEsB,qBAAS,CAACO,IAAI;EAC3B3B,WAAW,EAAEoB,qBAAS,CAACQ,OAAO,CAACR,qBAAS,CAACC,MAAM,CAAC;EAAE;EAClDpB,YAAY,EAAEmB,qBAAS,CAACC,MAAM;EAAE;EAChCtB,SAAS,EAAEqB,qBAAS,CAACC,MAAM;EAC3BjB,iBAAiB,EAAEgB,qBAAS,CAACO,IAAI;EACjC9B,kBAAkB,EAAEuB,qBAAS,CAACO,IAAI;EAAE;EACpCd,gBAAgB,EAAEO,qBAAS,CAACO,IAAI;EAAE;;EAElC9C,KAAK,EAAEuC,qBAAS,CAACC,MAAM;EACvBf,IAAI,EAAEc,qBAAS,CAACC,MAAM;EAEtBX,SAAS,EAAEU,qBAAS,CAACC,MAAM;EAC3BZ,SAAS,EAAEW,qBAAS,CAACC,MAAM;EAC3BV,gBAAgB,EAAES,qBAAS,CAACO,IAAI;EAChCf,UAAU,EAAEQ,qBAAS,CAACO,IAAI;EAAE;EAC5BjD,WAAW,EAAE0C,qBAAS,CAACO,IAAI,CAAE;AACjC,CAAC;;AAED;AACA,IAAME,OAAO,GAAG,IAAAC,sBAAU,EAACxF,MAAM,CAAC,CAACkB,gBAAgB,CAAC;AAAC,eACtCqE,OAAO;AAAA"}
package/README.md CHANGED
@@ -10,7 +10,7 @@ If you want to create the configuration page with react:
10
10
  - Change `name` from `src` to `ADAPTERNAME-admin` (Of course replace `ADAPTERNAME` with yours)
11
11
  - Add to devDependencies:
12
12
  ```
13
- "@iobroker/adapter-react": "^3.4.4",
13
+ "@iobroker/adapter-react": "^3.4.5",
14
14
  ```
15
15
  Versions can be higher.
16
16
  So your src/package.json should look like:
@@ -643,7 +643,7 @@ If you still have questions, try to find an answer [here](https://mui.com/guides
643
643
  -->
644
644
 
645
645
  ## Changelog
646
- ### 3.4.4 (2022-11-30)
646
+ ### 3.4.5 (2022-11-30)
647
647
  * (bluefox) updated json config component
648
648
 
649
649
  ### 3.4.1 (2022-11-29)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/adapter-react-v5",
3
- "version": "3.4.4",
3
+ "version": "3.4.5",
4
4
  "description": "React classes to develop admin interfaces for ioBroker with react.",
5
5
  "author": {
6
6
  "name": "bluefox",
@@ -1,148 +0,0 @@
1
- export default _export;
2
- export type FileSelectDialogProps = {
3
- /**
4
- * The internal name of the dialog; default: "default"
5
- */
6
- dialogName?: string;
7
- /**
8
- * The dialog title; default: Please select object ID... (translated)
9
- */
10
- title?: string;
11
- /**
12
- * Prefix (default: '.')
13
- */
14
- imagePrefix?: string;
15
- /**
16
- * Pre-selected file
17
- */
18
- selected?: boolean;
19
- /**
20
- * Close handler that is always called when the dialog is closed.
21
- */
22
- onClose: () => void;
23
- /**
24
- * Handler that is called when the user presses OK.
25
- */
26
- onOk: (selected: string | undefined) => void;
27
- /**
28
- * The ok button text; default: OK (translated)
29
- */
30
- ok?: string;
31
- /**
32
- * The cancel button text; default: Cancel (translated)
33
- */
34
- cancel?: string;
35
- /**
36
- * Socket class (required)
37
- */
38
- socket?: boolean;
39
- /**
40
- * If download of files enabled
41
- */
42
- allowUpload?: boolean;
43
- /**
44
- * If download of files enabled
45
- */
46
- allowDownload?: boolean;
47
- /**
48
- * If creation of folders enabled
49
- */
50
- allowCreateFolder?: boolean;
51
- /**
52
- * If creation of folders enabled
53
- */
54
- allowDelete?: boolean;
55
- /**
56
- * if tile view enabled (default true)
57
- */
58
- allowView?: boolean;
59
- /**
60
- * Show toolbar (default true)
61
- */
62
- showToolbar?: boolean;
63
- /**
64
- * Limit file browser to one specific objectID of type meta and following path (like vis.0/main)
65
- */
66
- limitPath?: any[];
67
- /**
68
- * like `['png', 'svg', 'bmp', 'jpg', 'jpeg']`
69
- */
70
- filterFiles?: any[];
71
- /**
72
- * images, code, txt, audio, video
73
- */
74
- filterByType?: string;
75
- /**
76
- * allow only folders selection
77
- */
78
- selectOnlyFolders?: bool;
79
- };
80
- /** @type {typeof DialogFileSelect} */
81
- declare const _export: typeof DialogFileSelect;
82
- /**
83
- * @typedef {object} FileSelectDialogProps
84
- * @property {string} [dialogName] The internal name of the dialog; default: "default"
85
- * @property {string} [title] The dialog title; default: Please select object ID... (translated)
86
- * @property {string} [imagePrefix] Prefix (default: '.')
87
- * @property {boolean} [dialogName] PropTypes.string, // where to store settings in localStorage
88
- * @property {boolean} [selected] Pre-selected file
89
- * @property {() => void} onClose Close handler that is always called when the dialog is closed.
90
- * @property {(selected: string | undefined) => void} onOk Handler that is called when the user presses OK.
91
- * @property {string} [ok] The ok button text; default: OK (translated)
92
- * @property {string} [cancel] The cancel button text; default: Cancel (translated)
93
- * @property {boolean} [socket] Socket class (required)
94
- * @property {boolean} [allowUpload] If download of files enabled
95
- * @property {boolean} [allowDownload] If download of files enabled
96
- * @property {boolean} [allowCreateFolder] If creation of folders enabled
97
- * @property {boolean} [allowDelete] If creation of folders enabled
98
- * @property {boolean} [allowView] if tile view enabled (default true)
99
- * @property {boolean} [showToolbar] Show toolbar (default true)
100
- * @property {array} [limitPath] Limit file browser to one specific objectID of type meta and following path (like vis.0/main)
101
- * @property {array} [filterFiles] like `['png', 'svg', 'bmp', 'jpg', 'jpeg']`
102
- * @property {string} [filterByType] images, code, txt, audio, video
103
- * @property {bool} [selectOnlyFolders] allow only folders selection
104
- *
105
- * @extends {React.Component<FileSelectDialogProps>}
106
- */
107
- declare class DialogFileSelect extends React.Component<FileSelectDialogProps, any, any> {
108
- /**
109
- * @param {FileSelectDialogProps} props
110
- */
111
- constructor(props: FileSelectDialogProps);
112
- dialogName: string;
113
- filters: any;
114
- state: {
115
- selected: string | true;
116
- isFolder: boolean;
117
- name: string;
118
- isMobile: boolean;
119
- };
120
- handleCancel(): void;
121
- handleOk(): void;
122
- render(): JSX.Element;
123
- }
124
- declare namespace DialogFileSelect {
125
- namespace propTypes {
126
- const imagePrefix: PropTypes.Requireable<string>;
127
- const dialogName: PropTypes.Requireable<string>;
128
- const selected: PropTypes.Requireable<string>;
129
- const onClose: PropTypes.Validator<(...args: any[]) => any>;
130
- const onOk: PropTypes.Validator<(...args: any[]) => any>;
131
- const ok: PropTypes.Requireable<string>;
132
- const cancel: PropTypes.Requireable<string>;
133
- const socket: PropTypes.Validator<object>;
134
- const allowUpload: PropTypes.Requireable<boolean>;
135
- const allowDownload: PropTypes.Requireable<boolean>;
136
- const allowCreateFolder: PropTypes.Requireable<boolean>;
137
- const allowDelete: PropTypes.Requireable<boolean>;
138
- const allowView: PropTypes.Requireable<boolean>;
139
- const showToolbar: PropTypes.Requireable<boolean>;
140
- const objectID: PropTypes.Requireable<string>;
141
- const filterFiles: PropTypes.Requireable<string[]>;
142
- const filterByType: PropTypes.Requireable<string>;
143
- const limitPath: PropTypes.Requireable<string>;
144
- const selectOnlyFolders: PropTypes.Requireable<boolean>;
145
- }
146
- }
147
- import React from "react";
148
- import PropTypes from "prop-types";
@@ -1,226 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
11
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
13
- var _react = _interopRequireDefault(require("react"));
14
- var _propTypes = _interopRequireDefault(require("prop-types"));
15
- var _withStyles = _interopRequireDefault(require("@mui/styles/withStyles"));
16
- var _Button = _interopRequireDefault(require("@mui/material/Button"));
17
- var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
18
- var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
19
- var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
20
- var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
21
- var _Cancel = _interopRequireDefault(require("@mui/icons-material/Cancel"));
22
- var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
23
- var _i18n = _interopRequireDefault(require("../i18n"));
24
- var _Utils = _interopRequireDefault(require("../Components/Utils"));
25
- var _FileBrowser = _interopRequireDefault(require("../Components/FileBrowser"));
26
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
27
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
28
- var styles = function styles(theme) {
29
- return {
30
- headerID: {
31
- fontWeight: 'bold',
32
- fontStyle: 'italic'
33
- },
34
- dialog: {
35
- height: '95%',
36
- backgroundColor: theme.palette.mode === 'dark' ? '#303030' : '#fafafa'
37
- },
38
- dialogMobile: {
39
- padding: 4,
40
- width: '100%',
41
- maxWidth: '100%',
42
- maxHeight: 'calc(100% - 16px)',
43
- height: '100%'
44
- },
45
- content: {
46
- height: '100%',
47
- overflow: 'hidden'
48
- },
49
- contentMobile: {
50
- padding: '8px 4px'
51
- },
52
- titleRoot: {
53
- whiteSpace: 'nowrap',
54
- width: 'calc(100% - 72px)',
55
- overflow: 'hidden',
56
- display: 'inline-block',
57
- textOverflow: 'ellipsis'
58
- }
59
- };
60
- };
61
-
62
- /**
63
- * @typedef {object} FileSelectDialogProps
64
- * @property {string} [dialogName] The internal name of the dialog; default: "default"
65
- * @property {string} [title] The dialog title; default: Please select object ID... (translated)
66
- * @property {string} [imagePrefix] Prefix (default: '.')
67
- * @property {boolean} [dialogName] PropTypes.string, // where to store settings in localStorage
68
- * @property {boolean} [selected] Pre-selected file
69
- * @property {() => void} onClose Close handler that is always called when the dialog is closed.
70
- * @property {(selected: string | undefined) => void} onOk Handler that is called when the user presses OK.
71
- * @property {string} [ok] The ok button text; default: OK (translated)
72
- * @property {string} [cancel] The cancel button text; default: Cancel (translated)
73
- * @property {boolean} [socket] Socket class (required)
74
- * @property {boolean} [allowUpload] If download of files enabled
75
- * @property {boolean} [allowDownload] If download of files enabled
76
- * @property {boolean} [allowCreateFolder] If creation of folders enabled
77
- * @property {boolean} [allowDelete] If creation of folders enabled
78
- * @property {boolean} [allowView] if tile view enabled (default true)
79
- * @property {boolean} [showToolbar] Show toolbar (default true)
80
- * @property {array} [limitPath] Limit file browser to one specific objectID of type meta and following path (like vis.0/main)
81
- * @property {array} [filterFiles] like `['png', 'svg', 'bmp', 'jpg', 'jpeg']`
82
- * @property {string} [filterByType] images, code, txt, audio, video
83
- * @property {bool} [selectOnlyFolders] allow only folders selection
84
- *
85
- * @extends {React.Component<FileSelectDialogProps>}
86
- */
87
- var DialogFileSelect = /*#__PURE__*/function (_React$Component) {
88
- (0, _inherits2["default"])(DialogFileSelect, _React$Component);
89
- var _super = _createSuper(DialogFileSelect);
90
- /**
91
- * @param {FileSelectDialogProps} props
92
- */
93
- function DialogFileSelect(props) {
94
- var _this;
95
- (0, _classCallCheck2["default"])(this, DialogFileSelect);
96
- _this = _super.call(this, props);
97
- _this.dialogName = _this.props.dialogName || 'default';
98
- _this.dialogName = 'FileSelect.' + _this.dialogName;
99
- _this.filters = (window._localStorage || window.localStorage).getItem(_this.dialogName) || '{}';
100
- try {
101
- _this.filters = JSON.parse(_this.filters);
102
- } catch (e) {
103
- _this.filters = {};
104
- }
105
- _this.state = {
106
- selected: _this.props.selected || '',
107
- isFolder: false,
108
- name: '',
109
- isMobile: window.innerWidth < 800
110
- };
111
- return _this;
112
- }
113
- (0, _createClass2["default"])(DialogFileSelect, [{
114
- key: "handleCancel",
115
- value: function handleCancel() {
116
- this.props.onClose();
117
- }
118
- }, {
119
- key: "handleOk",
120
- value: function handleOk() {
121
- this.props.onOk(this.state.selected || '');
122
- this.props.onClose();
123
- }
124
- }, {
125
- key: "render",
126
- value: function render() {
127
- var _this2 = this;
128
- var title;
129
- if (this.state.name || this.state.selected.length) {
130
- title = [/*#__PURE__*/_react["default"].createElement("span", {
131
- key: "selected"
132
- }, _i18n["default"].t('ra_Selected'), " "), /*#__PURE__*/_react["default"].createElement("span", {
133
- key: "id",
134
- className: this.props.classes.headerID
135
- }, this.state.selected)];
136
- } else {
137
- title = this.props.title || _i18n["default"].t('ra_Please select file...');
138
- }
139
- return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
140
- onClose: function onClose() {},
141
- maxWidth: false,
142
- classes: {
143
- paper: _Utils["default"].clsx(this.props.classes.dialog, this.props.classes.dialogMobile)
144
- },
145
- fullWidth: true,
146
- open: !0,
147
- "aria-labelledby": "file-dialog-title"
148
- }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
149
- id: "file-dialog-title",
150
- classes: {
151
- root: this.props.classes.titleRoot
152
- }
153
- }, title), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], {
154
- className: _Utils["default"].clsx(this.props.classes.content, this.props.classes.contentMobile)
155
- }, /*#__PURE__*/_react["default"].createElement(_FileBrowser["default"], {
156
- ready: true,
157
- imagePrefix: this.props.imagePrefix,
158
- allowUpload: !!this.props.allowUpload,
159
- allowDownload: this.props.allowDownload !== false,
160
- allowCreateFolder: !!this.props.allowCreateFolder,
161
- allowDelete: !!this.props.allowDelete,
162
- showViewTypeButton: this.props.allowView !== false,
163
- showToolbar: this.props.showToolbar !== false,
164
- limitPath: this.props.limitPath,
165
- filterFiles: this.props.filterFiles,
166
- filterByType: this.props.filterByType,
167
- selected: this.props.selected,
168
- onSelect: function onSelect(selected, isDoubleClick, isFolder) {
169
- _this2.setState({
170
- selected: selected,
171
- isFolder: isFolder
172
- }, function () {
173
- return isDoubleClick && (_this2.props.selectOnlyFolders && isFolder || !_this2.props.selectOnlyFolders && !isFolder) && _this2.handleOk();
174
- });
175
- },
176
- t: _i18n["default"].t,
177
- lang: _i18n["default"].getLanguage(),
178
- socket: this.props.socket
179
- })), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
180
- variant: "contained",
181
- onClick: function onClick() {
182
- return _this2.handleOk();
183
- },
184
- startIcon: /*#__PURE__*/_react["default"].createElement(_Check["default"], null),
185
- disabled: !this.state.selected || this.props.selectOnlyFolders && !this.state.isFolder || !this.props.selectOnlyFolders && this.state.isFolder,
186
- color: "primary"
187
- }, this.props.ok || _i18n["default"].t('ra_Ok')), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
188
- color: "grey",
189
- variant: "contained",
190
- onClick: function onClick() {
191
- return _this2.handleCancel();
192
- },
193
- startIcon: /*#__PURE__*/_react["default"].createElement(_Cancel["default"], null)
194
- }, this.props.cancel || _i18n["default"].t('ra_Cancel'))));
195
- }
196
- }]);
197
- return DialogFileSelect;
198
- }(_react["default"].Component);
199
- DialogFileSelect.propTypes = {
200
- imagePrefix: _propTypes["default"].string,
201
- dialogName: _propTypes["default"].string,
202
- // where to store settings in localStorage
203
- selected: _propTypes["default"].string,
204
- onClose: _propTypes["default"].func.isRequired,
205
- onOk: _propTypes["default"].func.isRequired,
206
- ok: _propTypes["default"].string,
207
- cancel: _propTypes["default"].string,
208
- socket: _propTypes["default"].object.isRequired,
209
- allowUpload: _propTypes["default"].bool,
210
- allowDownload: _propTypes["default"].bool,
211
- allowCreateFolder: _propTypes["default"].bool,
212
- allowDelete: _propTypes["default"].bool,
213
- allowView: _propTypes["default"].bool,
214
- showToolbar: _propTypes["default"].bool,
215
- objectID: _propTypes["default"].string,
216
- filterFiles: _propTypes["default"].arrayOf(_propTypes["default"].string),
217
- filterByType: _propTypes["default"].string,
218
- limitPath: _propTypes["default"].string,
219
- selectOnlyFolders: _propTypes["default"].bool
220
- };
221
-
222
- /** @type {typeof DialogFileSelect} */
223
- var _export = (0, _withStyles["default"])(styles)(DialogFileSelect);
224
- var _default = _export;
225
- exports["default"] = _default;
226
- //# sourceMappingURL=FileSelect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileSelect.js","names":["styles","theme","headerID","fontWeight","fontStyle","dialog","height","backgroundColor","palette","mode","dialogMobile","padding","width","maxWidth","maxHeight","content","overflow","contentMobile","titleRoot","whiteSpace","display","textOverflow","DialogFileSelect","props","dialogName","filters","window","_localStorage","localStorage","getItem","JSON","parse","e","state","selected","isFolder","name","isMobile","innerWidth","onClose","onOk","title","length","I18n","t","classes","paper","Utils","clsx","root","imagePrefix","allowUpload","allowDownload","allowCreateFolder","allowDelete","allowView","showToolbar","limitPath","filterFiles","filterByType","isDoubleClick","setState","selectOnlyFolders","handleOk","getLanguage","socket","ok","handleCancel","cancel","React","Component","propTypes","PropTypes","string","func","isRequired","object","bool","objectID","arrayOf","_export","withStyles"],"sources":["FileSelect.js"],"sourcesContent":["/**\n * Copyright 2022 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 from 'react';\nimport PropTypes from 'prop-types';\nimport withStyles from '@mui/styles/withStyles';\n\nimport Button from '@mui/material/Button';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogActions from '@mui/material/DialogActions';\nimport Dialog from '@mui/material/Dialog';\n\nimport IconCancel from '@mui/icons-material/Cancel';\nimport IconOk from '@mui/icons-material/Check';\n\nimport I18n from '../i18n';\nimport Utils from '../Components/Utils';\nimport FileBrowser from '../Components/FileBrowser';\n\nconst styles = theme => ({\n headerID: {\n fontWeight: 'bold',\n fontStyle: 'italic'\n },\n dialog: {\n height: '95%',\n backgroundColor: theme.palette.mode === 'dark' ? '#303030' : '#fafafa',\n },\n dialogMobile: {\n padding: 4,\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\n/**\n * @typedef {object} FileSelectDialogProps\n * @property {string} [dialogName] The internal name of the dialog; default: \"default\"\n * @property {string} [title] The dialog title; default: Please select object ID... (translated)\n * @property {string} [imagePrefix] Prefix (default: '.')\n * @property {boolean} [dialogName] PropTypes.string, // where to store settings in localStorage\n * @property {boolean} [selected] Pre-selected file\n * @property {() => void} onClose Close handler that is always called when the dialog is closed.\n * @property {(selected: string | undefined) => void} onOk Handler that is called when the user presses OK.\n * @property {string} [ok] The ok button text; default: OK (translated)\n * @property {string} [cancel] The cancel button text; default: Cancel (translated)\n * @property {boolean} [socket] Socket class (required)\n * @property {boolean} [allowUpload] If download of files enabled\n * @property {boolean} [allowDownload] If download of files enabled\n * @property {boolean} [allowCreateFolder] If creation of folders enabled\n * @property {boolean} [allowDelete] If creation of folders enabled\n * @property {boolean} [allowView] if tile view enabled (default true)\n * @property {boolean} [showToolbar] Show toolbar (default true)\n * @property {array} [limitPath] Limit file browser to one specific objectID of type meta and following path (like vis.0/main)\n * @property {array} [filterFiles] like `['png', 'svg', 'bmp', 'jpg', 'jpeg']`\n * @property {string} [filterByType] images, code, txt, audio, video\n * @property {bool} [selectOnlyFolders] allow only folders selection\n *\n * @extends {React.Component<FileSelectDialogProps>}\n */\nclass DialogFileSelect extends React.Component {\n /**\n * @param {FileSelectDialogProps} props\n */\n constructor(props) {\n super(props);\n this.dialogName = this.props.dialogName || 'default';\n this.dialogName = 'FileSelect.' + this.dialogName;\n\n this.filters = (window._localStorage || window.localStorage).getItem(this.dialogName) || '{}';\n\n try {\n this.filters = JSON.parse(this.filters);\n } catch (e) {\n this.filters = {};\n }\n\n this.state = {\n selected: this.props.selected || '',\n isFolder: false,\n name: '',\n isMobile: window.innerWidth < 800\n };\n }\n\n handleCancel() {\n this.props.onClose();\n };\n\n handleOk() {\n this.props.onOk(this.state.selected || '');\n this.props.onClose();\n };\n\n render() {\n let title;\n if (this.state.name || this.state.selected.length) {\n title = [\n <span key=\"selected\">{ I18n.t('ra_Selected') } </span>,\n <span key=\"id\" className={ this.props.classes.headerID }>{this.state.selected}</span>\n ];\n } else {\n title = this.props.title || I18n.t('ra_Please select file...');\n }\n\n return <Dialog\n onClose={() => {}}\n maxWidth={false}\n classes={{ paper: Utils.clsx(this.props.classes.dialog, this.props.classes.dialogMobile) }}\n fullWidth\n open={!0}\n aria-labelledby=\"file-dialog-title\"\n >\n <DialogTitle id=\"file-dialog-title\" classes={{ root: this.props.classes.titleRoot }}>{ title }</DialogTitle>\n <DialogContent className={Utils.clsx(this.props.classes.content, this.props.classes.contentMobile)}>\n <FileBrowser\n ready\n imagePrefix={this.props.imagePrefix}\n allowUpload={!!this.props.allowUpload}\n allowDownload={this.props.allowDownload !== false}\n allowCreateFolder={!!this.props.allowCreateFolder}\n allowDelete={!!this.props.allowDelete}\n showViewTypeButton={this.props.allowView !== 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 onSelect={(selected, isDoubleClick, isFolder) => {\n this.setState({ selected, isFolder }, () =>\n isDoubleClick && ((this.props.selectOnlyFolders && isFolder) || (!this.props.selectOnlyFolders && !isFolder)) && this.handleOk());\n }}\n t={I18n.t}\n lang={I18n.getLanguage()}\n socket={this.props.socket}\n />\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" onClick={ () => this.handleOk() } startIcon={<IconOk />} disabled={ !this.state.selected || ((this.props.selectOnlyFolders && !this.state.isFolder) || (!this.props.selectOnlyFolders && this.state.isFolder)) } color=\"primary\">{ this.props.ok || I18n.t('ra_Ok') }</Button>\n <Button color=\"grey\" variant=\"contained\" onClick={ () => this.handleCancel() } startIcon={<IconCancel />}>{ this.props.cancel || I18n.t('ra_Cancel') }</Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nDialogFileSelect.propTypes = {\n imagePrefix: PropTypes.string,\n dialogName: PropTypes.string, // where to store settings in localStorage\n selected: PropTypes.string,\n onClose: PropTypes.func.isRequired,\n onOk: PropTypes.func.isRequired,\n ok: PropTypes.string,\n cancel: PropTypes.string,\n socket: PropTypes.object.isRequired,\n allowUpload: PropTypes.bool,\n allowDownload: PropTypes.bool,\n allowCreateFolder: PropTypes.bool,\n allowDelete: PropTypes.bool,\n allowView: PropTypes.bool,\n showToolbar: PropTypes.bool,\n objectID: PropTypes.string,\n filterFiles: PropTypes.arrayOf(PropTypes.string),\n filterByType: PropTypes.string,\n limitPath: PropTypes.string,\n selectOnlyFolders: PropTypes.bool,\n};\n\n/** @type {typeof DialogFileSelect} */\nconst _export = withStyles(styles)(DialogFileSelect);\nexport default _export;\n"],"mappings":";;;;;;;;;;;;AAOA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAAoD;AAAA;AAEpD,IAAMA,MAAM,GAAG,SAATA,MAAM,CAAGC,KAAK;EAAA,OAAK;IACrBC,QAAQ,EAAE;MACNC,UAAU,EAAE,MAAM;MAClBC,SAAS,EAAE;IACf,CAAC;IACDC,MAAM,EAAE;MACJC,MAAM,EAAE,KAAK;MACbC,eAAe,EAAEN,KAAK,CAACO,OAAO,CAACC,IAAI,KAAK,MAAM,GAAG,SAAS,GAAG;IACjE,CAAC;IACD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