@iobroker/adapter-react-v5 3.4.4 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Components/JsonConfigComponent/ConfigAlive.js +3 -3
- package/Components/JsonConfigComponent/ConfigAlive.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocomplete.js +1 -1
- package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +1 -1
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCRON.js +2 -2
- package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js +1 -1
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCheckLicense.js +2 -2
- package/Components/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCheckbox.js +1 -1
- package/Components/JsonConfigComponent/ConfigCheckbox.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigColor.js +2 -2
- package/Components/JsonConfigComponent/ConfigColor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCoordinates.js +1 -1
- package/Components/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCustom.js +1 -1
- package/Components/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFile.js +2 -2
- package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFileSelector.js +4 -4
- package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFunc.js +2 -2
- package/Components/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigGeneric.js +3 -3
- package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigIP.js +1 -1
- package/Components/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigImageUpload.js +2 -2
- package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js +1 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.js +1 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigLanguage.js +1 -1
- package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigNumber.js +2 -2
- package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigObjectId.js +1 -1
- package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPassword.js +1 -1
- package/Components/JsonConfigComponent/ConfigPassword.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPattern.js +3 -3
- package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigRoom.js +3 -3
- package/Components/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelect.js +3 -2
- package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js +1 -1
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSendto.js +5 -5
- package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSetState.js +3 -3
- package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticDivider.js +1 -1
- package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticText.js +1 -1
- package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTable.js +1 -1
- package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigText.js +4 -2
- package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTextSendTo.js +3 -3
- package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigUUID.js +2 -2
- package/Components/JsonConfigComponent/ConfigUUID.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigUser.js +3 -3
- package/Components/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/Components/JsonConfigComponent/index.js +1 -1
- package/Components/JsonConfigComponent/index.js.map +1 -1
- package/Components/JsonConfigComponent/wrapper/Components/ColorPicker.d.ts +2 -0
- package/Components/JsonConfigComponent/wrapper/Components/ColorPicker.js +11 -0
- package/Components/JsonConfigComponent/wrapper/Components/ColorPicker.js.map +1 -0
- package/Components/JsonConfigComponent/wrapper/Components/Icon.d.ts +2 -0
- package/Components/JsonConfigComponent/wrapper/Components/Icon.js +11 -0
- package/Components/JsonConfigComponent/wrapper/Components/Icon.js.map +1 -0
- package/Components/JsonConfigComponent/wrapper/Components/TextWithIcon.d.ts +2 -0
- package/Components/JsonConfigComponent/wrapper/Components/TextWithIcon.js +11 -0
- package/Components/JsonConfigComponent/wrapper/Components/TextWithIcon.js.map +1 -0
- package/Components/JsonConfigComponent/wrapper/Components/UploadImage.d.ts +2 -0
- package/Components/JsonConfigComponent/wrapper/Components/UploadImage.js +11 -0
- package/Components/JsonConfigComponent/wrapper/Components/UploadImage.js.map +1 -0
- package/Components/JsonConfigComponent/wrapper/Components/Utils.d.ts +2 -0
- package/Components/JsonConfigComponent/wrapper/Components/Utils.js +11 -0
- package/Components/JsonConfigComponent/wrapper/Components/Utils.js.map +1 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/Confirm.d.ts +2 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/Confirm.js +11 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/Confirm.js.map +1 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/Cron.d.ts +2 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/Cron.js +11 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/Cron.js.map +1 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/Error.d.ts +2 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/Error.js +11 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/Error.js.map +1 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/Message.d.ts +1 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/Message.js +11 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/Message.js.map +1 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectFile.d.ts +2 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectFile.js +11 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectFile.js.map +1 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectID.d.ts +2 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectID.js +11 -0
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectID.js.map +1 -0
- package/Components/JsonConfigComponent/wrapper/i18n.d.ts +2 -0
- package/Components/JsonConfigComponent/wrapper/i18n.js +11 -0
- package/Components/JsonConfigComponent/wrapper/i18n.js.map +1 -0
- package/Components/JsonConfigComponent/wrapper/icons/IconCopy.d.ts +2 -0
- package/Components/JsonConfigComponent/wrapper/icons/IconCopy.js +11 -0
- package/Components/JsonConfigComponent/wrapper/icons/IconCopy.js.map +1 -0
- package/Components/copy-to-clipboard.js.map +1 -1
- package/Dialogs/SelectFile.d.ts +75 -21
- package/Dialogs/SelectFile.js +51 -35
- package/Dialogs/SelectFile.js.map +1 -1
- package/README.md +2 -2
- package/package.json +1 -1
- package/Dialogs/FileSelect.d.ts +0 -148
- package/Dialogs/FileSelect.js +0 -226
- package/Dialogs/FileSelect.js.map +0 -1
package/Dialogs/SelectFile.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export default _export;
|
|
2
|
-
export type
|
|
2
|
+
export type DialogSelectFileProps = {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* PropTypes.string, // where to store settings in localStorage *
|
|
5
5
|
*/
|
|
6
|
-
dialogName?:
|
|
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
|
|
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
|
|
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}
|
|
72
|
-
* @property {
|
|
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 {
|
|
85
|
-
* @property {
|
|
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 {
|
|
141
|
+
* @param {DialogSelectFileProps} props
|
|
93
142
|
*/
|
|
94
|
-
constructor(props:
|
|
143
|
+
constructor(props: DialogSelectFileProps);
|
|
95
144
|
dialogName: string;
|
|
96
145
|
filters: any;
|
|
97
146
|
state: {
|
|
98
|
-
selected:
|
|
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>;
|
package/Dialogs/SelectFile.js
CHANGED
|
@@ -64,9 +64,8 @@ var styles = function styles() {
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
* @typedef {object}
|
|
68
|
-
* @property {
|
|
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 {
|
|
81
|
-
* @property {
|
|
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 {
|
|
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
|
-
|
|
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 \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 \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":";;;;;;;;;;;;;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aAAa,EAAE0B,qBAAS,CAACG,IAAI;EAC7B5B,iBAAiB,EAAEyB,qBAAS,CAACG,IAAI;EACjC3B,WAAW,EAAEwB,qBAAS,CAACG,IAAI;EAC3B1B,SAAS,EAAEuB,qBAAS,CAACG,IAAI;EACzBzB,WAAW,EAAEsB,qBAAS,CAACG,IAAI;EAC3BtB,YAAY,EAAEmB,qBAAS,CAACC,MAAM;EAAE;EAChCZ,gBAAgB,EAAEW,qBAAS,CAACG,IAAI;EAAE;;EAElC5C,OAAO,EAAEyC,qBAAS,CAACI,IAAI,CAACC,UAAU;EAClC7C,IAAI,EAAEwC,qBAAS,CAACI,IAAI,CAACC,UAAU;EAC/BzC,KAAK,EAAEoC,qBAAS,CAACC,MAAM;EACvBnB,IAAI,EAAEkB,qBAAS,CAACC,MAAM;EACtB9C,QAAQ,EAAE6C,qBAAS,CAACM,SAAS,CAAC,CAC1BN,qBAAS,CAACC,MAAM,EAChBD,qBAAS,CAACO,KAAK,CAAE;EAAA,CACpB,CAAC;;EACFvB,MAAM,EAAEgB,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 \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 \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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;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.
|
|
13
|
+
"@iobroker/adapter-react": "^3.5.0",
|
|
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.
|
|
646
|
+
### 3.5.0 (2022-11-30)
|
|
647
647
|
* (bluefox) updated json config component
|
|
648
648
|
|
|
649
649
|
### 3.4.1 (2022-11-29)
|
package/package.json
CHANGED
package/Dialogs/FileSelect.d.ts
DELETED
|
@@ -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";
|