@iobroker/adapter-react-v5 6.0.15 → 6.0.17
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/ObjectBrowser.d.ts +1 -2
- package/Components/ObjectBrowser.js +25 -25
- package/README.md +1 -1
- package/package.json +1 -1
|
@@ -355,12 +355,11 @@ export declare class ObjectBrowserClass extends Component<ObjectBrowserProps, Ob
|
|
|
355
355
|
#private;
|
|
356
356
|
private info;
|
|
357
357
|
private localStorage;
|
|
358
|
-
private lastSelectedItems;
|
|
359
358
|
private lastAppliedFilter;
|
|
360
359
|
private readonly tableRef;
|
|
361
360
|
private readonly filterRefs;
|
|
362
361
|
private pausedSubscribes;
|
|
363
|
-
private
|
|
362
|
+
private selectFirst;
|
|
364
363
|
private root;
|
|
365
364
|
private readonly states;
|
|
366
365
|
private subscribes;
|
|
@@ -2187,18 +2187,18 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2187
2187
|
this.localStorage.removeItem(`${this.props.dialogName || 'App'}.table`);
|
|
2188
2188
|
this.forceUpdate();
|
|
2189
2189
|
};
|
|
2190
|
-
const
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
this.
|
|
2190
|
+
const lastSelectedItemStr = this.localStorage.getItem(`${props.dialogName || 'App'}.objectSelected`) || '';
|
|
2191
|
+
if (lastSelectedItemStr.startsWith('[')) {
|
|
2192
|
+
try {
|
|
2193
|
+
const lastSelectedItems = JSON.parse(lastSelectedItemStr);
|
|
2194
|
+
this.selectFirst = lastSelectedItems[0] || '';
|
|
2195
|
+
}
|
|
2196
|
+
catch (e) {
|
|
2197
|
+
// ignore
|
|
2195
2198
|
}
|
|
2196
|
-
// remove empty items
|
|
2197
|
-
this.lastSelectedItems = this.lastSelectedItems.filter((id) => id);
|
|
2198
2199
|
}
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
this.lastSelectedItems = [];
|
|
2200
|
+
else {
|
|
2201
|
+
this.selectFirst = lastSelectedItemStr;
|
|
2202
2202
|
}
|
|
2203
2203
|
let expanded;
|
|
2204
2204
|
const expandedStr = this.localStorage.getItem(`${props.dialogName || 'App'}.objectExpanded`) || '[]';
|
|
@@ -2256,7 +2256,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2256
2256
|
selected = props.selected;
|
|
2257
2257
|
}
|
|
2258
2258
|
selected = selected.map(id => id.replace(/["']/g, '')).filter(id => id);
|
|
2259
|
-
this.
|
|
2259
|
+
this.selectFirst = selected.length && selected[0] ? selected[0] : this.selectFirst;
|
|
2260
2260
|
const columnsStr = this.localStorage.getItem(`${props.dialogName || 'App'}.columns`);
|
|
2261
2261
|
let columns;
|
|
2262
2262
|
try {
|
|
@@ -2587,18 +2587,20 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2587
2587
|
* @param isDouble is double click
|
|
2588
2588
|
*/
|
|
2589
2589
|
onAfterSelect(isDouble) {
|
|
2590
|
-
|
|
2591
|
-
if (this.state.selected && this.state.selected
|
|
2592
|
-
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectSelected`,
|
|
2593
|
-
if
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2590
|
+
var _b;
|
|
2591
|
+
if (((_b = this.state.selected) === null || _b === void 0 ? void 0 : _b.length) && this.state.selected[0]) {
|
|
2592
|
+
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectSelected`, this.state.selected[0]);
|
|
2593
|
+
// remove a task to select the pre-selected item if now we want to see another object
|
|
2594
|
+
if (this.selectFirst && this.selectFirst !== this.state.selected[0]) {
|
|
2595
|
+
this.selectFirst = '';
|
|
2596
|
+
}
|
|
2597
|
+
if (this.state.selected.length === 1 && this.objects[this.state.selected[0]]) {
|
|
2598
|
+
const name = Utils_1.default.getObjectName(this.objects, this.state.selected[0], null, { language: this.props.lang });
|
|
2599
|
+
this.props.onSelect && this.props.onSelect(this.state.selected, name, isDouble);
|
|
2598
2600
|
}
|
|
2599
2601
|
}
|
|
2600
2602
|
else {
|
|
2601
|
-
this.localStorage.
|
|
2603
|
+
this.localStorage.removeItem(`${this.props.dialogName || 'App'}.objectSelected`);
|
|
2602
2604
|
if (this.state.selected.length) {
|
|
2603
2605
|
this.setState({ selected: [] }, () => this.props.onSelect && this.props.onSelect([], ''));
|
|
2604
2606
|
}
|
|
@@ -5038,19 +5040,18 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5038
5040
|
* Called when component is updated.
|
|
5039
5041
|
*/
|
|
5040
5042
|
componentDidUpdate() {
|
|
5041
|
-
var _b, _c, _d, _e;
|
|
5042
5043
|
if (this.tableRef.current) {
|
|
5043
5044
|
const scrollBarWidth = this.tableRef.current.offsetWidth - this.tableRef.current.clientWidth;
|
|
5044
5045
|
if (this.state.scrollBarWidth !== scrollBarWidth) {
|
|
5045
5046
|
setTimeout(() => this.setState({ scrollBarWidth }), 100);
|
|
5046
5047
|
}
|
|
5047
|
-
else if (
|
|
5048
|
-
|
|
5049
|
-
this.scrollToItem(((_d = this.state.selected) === null || _d === void 0 ? void 0 : _d[0]) || ((_e = this.lastSelectedItems) === null || _e === void 0 ? void 0 : _e[0]));
|
|
5048
|
+
else if (this.selectFirst) {
|
|
5049
|
+
this.scrollToItem(this.selectFirst);
|
|
5050
5050
|
}
|
|
5051
5051
|
}
|
|
5052
5052
|
}
|
|
5053
5053
|
scrollToItem(id) {
|
|
5054
|
+
this.selectFirst = '';
|
|
5054
5055
|
const node = window.document.getElementById(id);
|
|
5055
5056
|
node &&
|
|
5056
5057
|
node.scrollIntoView({
|
|
@@ -5058,7 +5059,6 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5058
5059
|
block: 'center',
|
|
5059
5060
|
inline: 'center',
|
|
5060
5061
|
});
|
|
5061
|
-
this.selectedFound = true;
|
|
5062
5062
|
}
|
|
5063
5063
|
renderCustomDialog() {
|
|
5064
5064
|
if (this.state.customDialog && this.props.objectCustomDialog) {
|
package/README.md
CHANGED
|
@@ -781,7 +781,7 @@ The best practice is to replace `padding` with `p` and `margin` with `m`, so you
|
|
|
781
781
|
-->
|
|
782
782
|
|
|
783
783
|
## Changelog
|
|
784
|
-
### 6.0.
|
|
784
|
+
### 6.0.17 (2024-07-14)
|
|
785
785
|
* (bluefox) Allowed playing mp3 files in the file browser
|
|
786
786
|
* (bluefox) Corrected jump by object selection
|
|
787
787
|
|