@iobroker/adapter-react-v5 4.10.0 → 4.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,188 +1,71 @@
1
- export default _export;
2
- export type DialogSelectFileProps = {
3
- /**
4
- * PropTypes.string, // where to store settings in localStorage *
5
- */
6
- dialogName?: boolean;
7
- /**
8
- * The dialog title; default: Please select object ID... (translated)
9
- */
1
+ import React from 'react';
2
+ import type { Connection } from '@iobroker/socket-client';
3
+ interface DialogSelectFileProps {
4
+ /** where to store settings in localStorage * @property {string} [title] The dialog title; default: Please select object ID... (translated) */
5
+ dialogName?: string;
6
+ /** The dialog title; default: Please select object ID... (translated) */
10
7
  title?: string;
11
- /**
12
- * Set to true to allow the selection of multiple IDs.
13
- */
8
+ /** Set to true to allow the selection of multiple IDs. */
14
9
  multiSelect?: boolean;
15
- /**
16
- * Prefix (default: '.')
17
- */
10
+ /** Image prefix. Normally, admin has '../..' and the web has '../' */
18
11
  imagePrefix?: string;
19
- /**
20
- * Show the expert button?
21
- */
12
+ /** @deprectaed Image prefix */
13
+ prefix?: string;
14
+ /** Show the expert button? */
22
15
  showExpertButton?: boolean;
23
- /**
24
- * The language.
25
- */
16
+ /** Language */
26
17
  lang?: ioBroker.Languages;
27
- /**
28
- * The socket connection.
29
- */
30
- socket?: import('../Connection').default;
31
- /**
32
- * Theme name.
33
- */
18
+ /** Socket class */
19
+ socket: Connection;
20
+ /** Theme name. */
34
21
  themeName?: string;
35
- /**
36
- * Theme type.
37
- */
38
- themeType?: string;
39
- /**
40
- * The selected IDs.
41
- */
22
+ /** Theme type. */
23
+ themeType?: 'dark' | 'light';
24
+ /** The selected IDs. */
42
25
  selected?: string | string[];
43
- /**
44
- * The ok button text; default: OK (translated)
45
- */
26
+ /** The ok button text; default: OK (translated) */
46
27
  ok?: string;
47
- /**
48
- * The cancel button text; default: Cancel (translated)
49
- */
28
+ /** The cancel button text; default: Cancel (translated) */
50
29
  cancel?: string;
51
- /**
52
- * If download of files enabled
53
- */
30
+ /** If download of files enabled */
54
31
  allowUpload?: boolean;
55
- /**
56
- * If download of files enabled
57
- */
32
+ /** If download of files enabled */
58
33
  allowDownload?: boolean;
59
- /**
60
- * If creation of folders enabled
61
- */
34
+ /** If creation of folders enabled */
62
35
  allowCreateFolder?: boolean;
63
- /**
64
- * If creation of folders enabled
65
- */
36
+ /** If creation of folders enabled */
66
37
  allowDelete?: boolean;
67
- /**
68
- * if tile view enabled (default true)
69
- */
38
+ /** if tile view enabled (default true) */
70
39
  allowView?: boolean;
71
- /**
72
- * Show toolbar (default true)
73
- */
40
+ /** Show toolbar (default true) */
74
41
  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', 'gif']`
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;
91
- /**
92
- * Close handler that is always called when the dialog is closed.
93
- */
42
+ /** Limit file browser to one specific objectID of type meta and the following path (like vis.0/main) */
43
+ limitPath?: string;
44
+ /** like `['png', 'svg', 'bmp', 'jpg', 'jpeg', 'gif']` */
45
+ filterFiles?: string[];
46
+ /** images, code, txt, audio, video */
47
+ filterByType?: 'images' | 'code' | 'txt';
48
+ /** allow only folder's selection */
49
+ selectOnlyFolders?: boolean;
50
+ /** Close handler that is always called when the dialog is closed. */
94
51
  onClose: () => void;
95
- /**
96
- * Handler that is called when the user presses OK or by double click.
97
- */
52
+ /** Handler that is called when the user presses OK or by double click. */
98
53
  onOk: (selected: string | string[] | undefined) => void;
99
- /**
100
- * The styling class names.
101
- */
102
- classes?: {
103
- headerID: string;
104
- dialog: string;
105
- content: string;
106
- };
107
- };
108
- /** @type {typeof DialogSelectFile} */
109
- declare const _export: typeof DialogSelectFile;
110
- /**
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)
113
- * @property {boolean} [multiSelect] Set to true to allow the selection of multiple IDs.
114
- * @property {string} [imagePrefix] Prefix (default: '.')
115
- * @property {boolean} [showExpertButton] Show the expert button?
116
- * @property {ioBroker.Languages} [lang] The language.
117
- * @property {import('../Connection').default} socket The socket connection.
118
- * @property {string} [themeName] Theme name.
119
- * @property {string} [themeType] Theme type.
120
- * @property {string | string[]} [selected] The selected IDs.
121
- * @property {string} [ok] The ok button text; default: OK (translated)
122
- * @property {string} [cancel] The cancel button text; default: Cancel (translated)
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', 'gif']`
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.
135
- * @property {{headerID: string; dialog: string; content: string}} [classes] The styling class names.
136
- *
137
- * @extends {React.Component<DialogSelectIDProps>}
138
- */
139
- declare class DialogSelectFile extends React.Component<DialogSelectIDProps, any, any> {
140
- /**
141
- * @param {DialogSelectFileProps} props
142
- */
143
- constructor(props: DialogSelectFileProps);
144
- dialogName: string;
145
- filters: any;
146
- state: {
147
- selected: any;
148
- };
149
- handleCancel(): void;
150
- handleOk(): void;
151
- render(): React.JSX.Element;
152
- }
153
- declare namespace DialogSelectFile {
154
- namespace propTypes {
155
- let imagePrefix: PropTypes.Requireable<string>;
156
- let dialogName: PropTypes.Requireable<string>;
157
- let selected: PropTypes.Requireable<NonNullable<string | any[]>>;
158
- let classes: PropTypes.Requireable<object>;
159
- let onClose: PropTypes.Validator<(...args: any[]) => any>;
160
- let onOk: PropTypes.Validator<(...args: any[]) => any>;
161
- let ok: PropTypes.Requireable<string>;
162
- let cancel: PropTypes.Requireable<string>;
163
- let socket: PropTypes.Validator<object>;
164
- let allowUpload: PropTypes.Requireable<boolean>;
165
- let allowDownload: PropTypes.Requireable<boolean>;
166
- let allowCreateFolder: PropTypes.Requireable<boolean>;
167
- let allowDelete: PropTypes.Requireable<boolean>;
168
- let allowView: PropTypes.Requireable<boolean>;
169
- let showToolbar: PropTypes.Requireable<boolean>;
170
- let filterFiles: PropTypes.Requireable<string[]>;
171
- let filterByType: PropTypes.Requireable<string>;
172
- let limitPath: PropTypes.Requireable<string>;
173
- let selectOnlyFolders: PropTypes.Requireable<boolean>;
174
- let showViewTypeButton: PropTypes.Requireable<boolean>;
175
- let showTypeSelector: PropTypes.Requireable<boolean>;
176
- let restrictToFolder: PropTypes.Requireable<string>;
177
- let allowNonRestricted: PropTypes.Requireable<boolean>;
178
- let title: PropTypes.Requireable<string>;
179
- let lang: PropTypes.Requireable<string>;
180
- let themeName: PropTypes.Requireable<string>;
181
- let themeType: PropTypes.Requireable<string>;
182
- let showExpertButton: PropTypes.Requireable<boolean>;
183
- let expertMode: PropTypes.Requireable<boolean>;
184
- let multiSelect: PropTypes.Requireable<boolean>;
185
- }
54
+ /** The styling class names. */
55
+ classes: Record<string, string>;
56
+ filters: Record<string, string>;
57
+ /** Allow switch views Table<=>Rows */
58
+ showViewTypeButton?: boolean;
59
+ /** If type selector should be shown */
60
+ showTypeSelector?: boolean;
61
+ /** If defined, allow selecting only files from this folder */
62
+ restrictToFolder?: string;
63
+ /** If restrictToFolder defined, allow selecting files outside of this folder */
64
+ allowNonRestricted?: boolean;
65
+ /** force expert mode */
66
+ expertMode?: boolean;
67
+ /** Translate function - optional */
68
+ t?: (text: string, ...args: any[]) => string;
186
69
  }
187
- import React from 'react';
188
- import PropTypes from 'prop-types';
70
+ declare const _default: React.JSXElementConstructor<Omit<DialogSelectFileProps, "classes"> & import("@mui/styles").StyledComponentProps<string> & object>;
71
+ export default _default;
@@ -1,279 +1,122 @@
1
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 _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
16
- var _react = _interopRequireDefault(require("react"));
17
- var _propTypes = _interopRequireDefault(require("prop-types"));
18
- var _styles = require("@mui/styles");
19
- var _material = require("@mui/material");
20
- var _iconsMaterial = require("@mui/icons-material");
21
- var _Utils = _interopRequireDefault(require("../Components/Utils"));
22
- var _i18n = _interopRequireDefault(require("../i18n"));
23
- var _FileBrowser = _interopRequireDefault(require("../Components/FileBrowser"));
24
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
- function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
27
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*
28
- * Copyright 2022-2023 Denis Haev (bluefox) <dogafox@gmail.com>
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /*
7
+ * Copyright 2022-2024 Denis Haev (bluefox) <dogafox@gmail.com>
29
8
  *
30
9
  * MIT License
31
10
  *
32
- */ // please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined
33
- var styles = function styles() {
34
- return {
11
+ */
12
+ // please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined
13
+ const react_1 = __importDefault(require("react"));
14
+ const styles_1 = require("@mui/styles");
15
+ const material_1 = require("@mui/material");
16
+ const icons_material_1 = require("@mui/icons-material");
17
+ const Utils_1 = __importDefault(require("../Components/Utils"));
18
+ const i18n_1 = __importDefault(require("../i18n"));
19
+ const FileBrowser_1 = __importDefault(require("../Components/FileBrowser"));
20
+ const styles = {
35
21
  headerID: {
36
- fontWeight: 'bold',
37
- fontStyle: 'italic'
22
+ fontWeight: 'bold',
23
+ fontStyle: 'italic',
38
24
  },
39
25
  dialog: {
40
- height: '95%'
26
+ height: '95%',
41
27
  },
42
28
  dialogMobile: {
43
- padding: 4,
44
- width: '100%',
45
- maxWidth: '100%',
46
- maxHeight: 'calc(100% - 16px)',
47
- height: '100%'
29
+ padding: 4,
30
+ width: '100%',
31
+ maxWidth: '100%',
32
+ maxHeight: 'calc(100% - 16px)',
33
+ height: '100%',
48
34
  },
49
35
  content: {
50
- height: '100%',
51
- overflow: 'hidden'
36
+ height: '100%',
37
+ overflow: 'hidden',
52
38
  },
53
39
  contentMobile: {
54
- padding: '8px 4px'
40
+ padding: '8px 4px',
55
41
  },
56
42
  titleRoot: {
57
- whiteSpace: 'nowrap',
58
- width: 'calc(100% - 72px)',
59
- overflow: 'hidden',
60
- display: 'inline-block',
61
- textOverflow: 'ellipsis'
62
- }
63
- };
43
+ whiteSpace: 'nowrap',
44
+ width: 'calc(100% - 72px)',
45
+ overflow: 'hidden',
46
+ display: 'inline-block',
47
+ textOverflow: 'ellipsis',
48
+ },
64
49
  };
65
-
66
- /**
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)
69
- * @property {boolean} [multiSelect] Set to true to allow the selection of multiple IDs.
70
- * @property {string} [imagePrefix] Prefix (default: '.')
71
- * @property {boolean} [showExpertButton] Show the expert button?
72
- * @property {ioBroker.Languages} [lang] The language.
73
- * @property {import('../Connection').default} socket The socket connection.
74
- * @property {string} [themeName] Theme name.
75
- * @property {string} [themeType] Theme type.
76
- * @property {string | string[]} [selected] The selected IDs.
77
- * @property {string} [ok] The ok button text; default: OK (translated)
78
- * @property {string} [cancel] The cancel button text; default: Cancel (translated)
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', 'gif']`
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.
91
- * @property {{headerID: string; dialog: string; content: string}} [classes] The styling class names.
92
- *
93
- * @extends {React.Component<DialogSelectIDProps>}
94
- */
95
- var DialogSelectFile = /*#__PURE__*/function (_React$Component) {
96
- (0, _inherits2["default"])(DialogSelectFile, _React$Component);
97
- /**
98
- * @param {DialogSelectFileProps} props
99
- */
100
- function DialogSelectFile(props) {
101
- var _this;
102
- (0, _classCallCheck2["default"])(this, DialogSelectFile);
103
- _this = _callSuper(this, DialogSelectFile, [props]);
104
- _this.dialogName = _this.props.dialogName || 'default';
105
- _this.dialogName = "SelectFile.".concat(_this.dialogName);
106
- _this.filters = (window._localStorage || window.localStorage).getItem(_this.dialogName) || '{}';
107
- try {
108
- _this.filters = JSON.parse(_this.filters);
109
- } catch (e) {
110
- _this.filters = {};
111
- }
112
- if (props.filters) {
113
- _this.filters = _objectSpread(_objectSpread({}, _this.filters), props.filters);
114
- }
115
- var selected = _this.props.selected || [];
116
- if ((0, _typeof2["default"])(selected) !== 'object') {
117
- selected = [selected];
118
- } else {
119
- selected = (0, _toConsumableArray2["default"])(selected);
50
+ class DialogSelectFile extends react_1.default.Component {
51
+ constructor(props) {
52
+ super(props);
53
+ this.dialogName = this.props.dialogName || 'default';
54
+ this.dialogName = `SelectFile.${this.dialogName}`;
55
+ const filters = (window._localStorage || window.localStorage).getItem(this.dialogName) || '{}';
56
+ try {
57
+ this.filters = JSON.parse(filters);
58
+ }
59
+ catch (e) {
60
+ this.filters = {};
61
+ }
62
+ if (props.filters) {
63
+ this.filters = Object.assign(Object.assign({}, this.filters), props.filters);
64
+ }
65
+ let selected = this.props.selected || [];
66
+ if (typeof selected !== 'object') {
67
+ selected = [selected];
68
+ }
69
+ else {
70
+ selected = [...selected];
71
+ }
72
+ selected = selected.filter(id => id);
73
+ this.state = {
74
+ selected,
75
+ };
120
76
  }
121
- selected = selected.filter(function (id) {
122
- return id;
123
- });
124
- _this.state = {
125
- selected: selected
126
- };
127
- return _this;
128
- }
129
- (0, _createClass2["default"])(DialogSelectFile, [{
130
- key: "handleCancel",
131
- value: function handleCancel() {
132
- this.props.onClose();
77
+ handleCancel() {
78
+ this.props.onClose();
133
79
  }
134
- }, {
135
- key: "handleOk",
136
- value: function handleOk() {
137
- this.props.onOk(this.props.multiSelect || !Array.isArray(this.state.selected) ? this.state.selected : this.state.selected[0] || '');
138
- this.props.onClose();
80
+ handleOk() {
81
+ this.props.onOk(this.props.multiSelect || !Array.isArray(this.state.selected) ? this.state.selected : this.state.selected[0] || '');
82
+ this.props.onClose();
139
83
  }
140
- }, {
141
- key: "render",
142
- value: function render() {
143
- var _this2 = this;
144
- var title;
145
- if (this.state.selected.length) {
146
- if (!Array.isArray(this.state.selected) || this.state.selected.length === 1) {
147
- title = [/*#__PURE__*/_react["default"].createElement("span", {
148
- key: "selected"
149
- }, _i18n["default"].t('ra_Selected'), "\xA0"), /*#__PURE__*/_react["default"].createElement("span", {
150
- key: "id",
151
- className: this.props.classes.headerID
152
- }, this.state.selected)];
153
- } else {
154
- title = [/*#__PURE__*/_react["default"].createElement("span", {
155
- key: "selected"
156
- }, _i18n["default"].t('ra_Selected'), "\xA0"), /*#__PURE__*/_react["default"].createElement("span", {
157
- key: "id",
158
- className: this.props.classes.headerID
159
- }, _i18n["default"].t('%s items', this.state.selected.length))];
84
+ render() {
85
+ let title;
86
+ if (this.state.selected.length) {
87
+ if (!Array.isArray(this.state.selected) || this.state.selected.length === 1) {
88
+ title = [
89
+ react_1.default.createElement("span", { key: "selected" },
90
+ i18n_1.default.t('ra_Selected'),
91
+ "\u00A0"),
92
+ react_1.default.createElement("span", { key: "id", className: this.props.classes.headerID }, this.state.selected),
93
+ ];
94
+ }
95
+ else {
96
+ title = [
97
+ react_1.default.createElement("span", { key: "selected" },
98
+ i18n_1.default.t('ra_Selected'),
99
+ "\u00A0"),
100
+ react_1.default.createElement("span", { key: "id", className: this.props.classes.headerID }, i18n_1.default.t('%s items', this.state.selected.length)),
101
+ ];
102
+ }
160
103
  }
161
- } else {
162
- title = this.props.title || _i18n["default"].t('ra_Please select file...');
163
- }
164
- return /*#__PURE__*/_react["default"].createElement(_material.Dialog, {
165
- onClose: function onClose() {},
166
- maxWidth: false,
167
- classes: {
168
- paper: _Utils["default"].clsx(this.props.classes.dialog, this.props.classes.dialogMobile)
169
- },
170
- fullWidth: true,
171
- open: !0,
172
- "aria-labelledby": "ar_dialog_selectfile_title"
173
- }, /*#__PURE__*/_react["default"].createElement(_material.DialogTitle, {
174
- id: "ar_dialog_selectfile_title",
175
- classes: {
176
- root: this.props.classes.titleRoot
104
+ else {
105
+ title = this.props.title || i18n_1.default.t('ra_Please select file...');
177
106
  }
178
- }, title), /*#__PURE__*/_react["default"].createElement(_material.DialogContent, {
179
- className: _Utils["default"].clsx(this.props.classes.content, this.props.classes.contentMobile)
180
- }, /*#__PURE__*/_react["default"].createElement(_FileBrowser["default"], {
181
- ready: true,
182
- imagePrefix: this.props.imagePrefix || this.props.prefix || '../' // prefix is for back compatibility
183
- ,
184
- allowUpload: !!this.props.allowUpload,
185
- allowDownload: this.props.allowDownload !== false,
186
- allowCreateFolder: !!this.props.allowCreateFolder,
187
- allowDelete: !!this.props.allowDelete,
188
- allowView: this.props.allowView !== false,
189
- showViewTypeButton: this.props.showViewTypeButton !== false,
190
- showToolbar: this.props.showToolbar !== false,
191
- limitPath: this.props.limitPath,
192
- filterFiles: this.props.filterFiles,
193
- filterByType: this.props.filterByType,
194
- selected: this.props.selected,
195
- restrictToFolder: this.props.restrictToFolder,
196
- allowNonRestricted: this.props.allowNonRestricted,
197
- onSelect: function onSelect(selected, isDoubleClick, isFolder) {
198
- _this2.setState({
199
- selected: selected
200
- }, function () {
201
- return isDoubleClick && (!_this2.props.selectOnlyFolders || isFolder) && _this2.handleOk();
202
- });
203
- },
204
- t: this.props.t || _i18n["default"].t,
205
- lang: this.props.lang || _i18n["default"].getLanguage(),
206
- socket: this.props.socket,
207
- themeType: this.props.themeType,
208
- themeName: this.props.themeName,
209
- showExpertButton: this.props.showExpertButton,
210
- expertMode: this.props.expertMode,
211
- showTypeSelector: this.props.showTypeSelector
212
- })), /*#__PURE__*/_react["default"].createElement(_material.DialogActions, null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
213
- variant: "contained",
214
- onClick: function onClick() {
215
- return _this2.handleOk();
216
- },
217
- startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Check, null),
218
- disabled: !this.state.selected.length,
219
- color: "primary"
220
- }, this.props.ok || _i18n["default"].t('ra_Ok')), /*#__PURE__*/_react["default"].createElement(_material.Button, {
221
- color: "grey",
222
- variant: "contained",
223
- onClick: function onClick() {
224
- return _this2.handleCancel();
225
- },
226
- startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Cancel, null)
227
- }, this.props.cancel || _i18n["default"].t('ra_Cancel'))));
107
+ return react_1.default.createElement(material_1.Dialog, { onClose: () => { }, maxWidth: false, classes: { paper: Utils_1.default.clsx(this.props.classes.dialog, this.props.classes.dialogMobile) }, fullWidth: true, open: !0, "aria-labelledby": "ar_dialog_selectfile_title" },
108
+ react_1.default.createElement(material_1.DialogTitle, { id: "ar_dialog_selectfile_title", classes: { root: this.props.classes.titleRoot } }, title),
109
+ react_1.default.createElement(material_1.DialogContent, { className: Utils_1.default.clsx(this.props.classes.content, this.props.classes.contentMobile) },
110
+ react_1.default.createElement(FileBrowser_1.default, { ready: true, imagePrefix: this.props.imagePrefix || this.props.prefix || '../', allowUpload: !!this.props.allowUpload, allowDownload: this.props.allowDownload !== false, allowCreateFolder: !!this.props.allowCreateFolder, allowDelete: !!this.props.allowDelete, allowView: this.props.allowView !== false, showViewTypeButton: this.props.showViewTypeButton !== false, showToolbar: this.props.showToolbar !== false, limitPath: this.props.limitPath, filterFiles: this.props.filterFiles, filterByType: this.props.filterByType, selected: this.props.selected, restrictToFolder: this.props.restrictToFolder, allowNonRestricted: this.props.allowNonRestricted, onSelect: (selected, isDoubleClick, isFolder) => {
111
+ this.setState({ selected: Array.isArray(selected) ? selected : [selected] }, () => isDoubleClick && (!this.props.selectOnlyFolders || isFolder) && this.handleOk());
112
+ }, t: this.props.t || i18n_1.default.t, lang: this.props.lang || i18n_1.default.getLanguage(), socket: this.props.socket, themeType: this.props.themeType, themeName: this.props.themeName, showExpertButton: this.props.showExpertButton, expertMode: this.props.expertMode, showTypeSelector: this.props.showTypeSelector })),
113
+ react_1.default.createElement(material_1.DialogActions, null,
114
+ react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleOk(), startIcon: react_1.default.createElement(icons_material_1.Check, null), disabled: !this.state.selected.length, color: "primary" }, this.props.ok || i18n_1.default.t('ra_Ok')),
115
+ react_1.default.createElement(material_1.Button
116
+ // @ts-expect-error grey is allowed color
117
+ , {
118
+ // @ts-expect-error grey is allowed color
119
+ color: "grey", variant: "contained", onClick: () => this.handleCancel(), startIcon: react_1.default.createElement(icons_material_1.Cancel, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel'))));
228
120
  }
229
- }]);
230
- return DialogSelectFile;
231
- }(_react["default"].Component);
232
- DialogSelectFile.propTypes = {
233
- imagePrefix: _propTypes["default"].string,
234
- dialogName: _propTypes["default"].string,
235
- // where to store settings in localStorage
236
- selected: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].array // not implemented
237
- ]),
238
- classes: _propTypes["default"].object,
239
- onClose: _propTypes["default"].func.isRequired,
240
- onOk: _propTypes["default"].func.isRequired,
241
- ok: _propTypes["default"].string,
242
- cancel: _propTypes["default"].string,
243
- socket: _propTypes["default"].object.isRequired,
244
- allowUpload: _propTypes["default"].bool,
245
- allowDownload: _propTypes["default"].bool,
246
- allowCreateFolder: _propTypes["default"].bool,
247
- allowDelete: _propTypes["default"].bool,
248
- allowView: _propTypes["default"].bool,
249
- // allow view of files
250
- showToolbar: _propTypes["default"].bool,
251
- filterFiles: _propTypes["default"].arrayOf(_propTypes["default"].string),
252
- // array of extensions ['png', 'svg', 'bmp', 'jpg', 'jpeg', 'gif']
253
- filterByType: _propTypes["default"].string,
254
- // e.g. images
255
- limitPath: _propTypes["default"].string,
256
- selectOnlyFolders: _propTypes["default"].bool,
257
- showViewTypeButton: _propTypes["default"].bool,
258
- // Allow switch views Table<=>Rows
259
- showTypeSelector: _propTypes["default"].bool,
260
- // If type selector should be shown
261
- restrictToFolder: _propTypes["default"].string,
262
- // If defined, allow selecting only files from this folder
263
- allowNonRestricted: _propTypes["default"].bool,
264
- // If restrictToFolder defined, allow selecting files outside of this folder
265
-
266
- title: _propTypes["default"].string,
267
- lang: _propTypes["default"].string,
268
- themeName: _propTypes["default"].string,
269
- themeType: _propTypes["default"].string,
270
- showExpertButton: _propTypes["default"].bool,
271
- expertMode: _propTypes["default"].bool,
272
- // force expert mode
273
- multiSelect: _propTypes["default"].bool // not implemented
274
- };
275
-
276
- /** @type {typeof DialogSelectFile} */
277
- var _export = (0, _styles.withStyles)(styles)(DialogSelectFile);
278
- var _default = exports["default"] = _export;
279
- //# sourceMappingURL=SelectFile.js.map
121
+ }
122
+ exports.default = (0, styles_1.withStyles)(styles)(DialogSelectFile);
package/README.md CHANGED
@@ -670,7 +670,10 @@ socket.getObjectViewCustom('custom', 'state', 'startKey', 'endKey')
670
670
  -->
671
671
 
672
672
  ## Changelog
673
- ### 4.10.0 (2024-03-11)
673
+ ### 4.10.2 (2024-03-16)
674
+ * (bluefox) Migrated some components to typescript
675
+
676
+ ### 4.10.1 (2024-03-11)
674
677
  * (bluefox) Migrated some components to typescript
675
678
 
676
679
  ### 4.9.11 (2024-03-08)