@iobroker/adapter-react-v5 3.1.20 → 3.1.23

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.
@@ -911,10 +911,63 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
911
911
  var common = data.obj && data.obj.common;
912
912
 
913
913
  if (customFilter) {
914
- if (customFilter.type && customFilter.type !== data.obj.type) {
915
- filteredOut = true;
916
- } else if (customFilter.common && customFilter.common.custom) {
917
- if (!common || !common.custom || customFilter.common.custom !== true && !common.custom[customFilter.common.custom]) {
914
+ var _customFilter$common, _customFilter$common2, _customFilter$common3;
915
+
916
+ if (customFilter.type) {
917
+ if (typeof customFilter.type === 'string') {
918
+ if (customFilter.type !== data.obj.type) {
919
+ filteredOut = true;
920
+ }
921
+ } else if (Array.isArray(customFilter.type)) {
922
+ if (!customFilter.type.includes(data.obj.type)) {
923
+ filteredOut = true;
924
+ }
925
+ }
926
+ }
927
+
928
+ if (!filteredOut && (_customFilter$common = customFilter.common) !== null && _customFilter$common !== void 0 && _customFilter$common.type) {
929
+ if (!common || !common.type) {
930
+ filteredOut = true;
931
+ } else if (typeof customFilter.common.type === 'string') {
932
+ if (customFilter.common.type !== common.type) {
933
+ filteredOut = true;
934
+ }
935
+ } else if (Array.isArray(customFilter.common.type)) {
936
+ if (!customFilter.type.includes(common.type)) {
937
+ filteredOut = true;
938
+ }
939
+ }
940
+ }
941
+
942
+ if (!filteredOut && (_customFilter$common2 = customFilter.common) !== null && _customFilter$common2 !== void 0 && _customFilter$common2.role) {
943
+ if (!common || !common.role) {
944
+ filteredOut = true;
945
+ } else if (typeof customFilter.common.role === 'string') {
946
+ if (common.role.startsWith(customFilter.common.role)) {
947
+ filteredOut = true;
948
+ }
949
+ } else if (Array.isArray(customFilter.common.role)) {
950
+ if (!customFilter.common.role.find(function (role) {
951
+ return customFilter.role.includes(role);
952
+ })) {
953
+ filteredOut = true;
954
+ }
955
+ }
956
+ }
957
+
958
+ if (!filteredOut && (_customFilter$common3 = customFilter.common) !== null && _customFilter$common3 !== void 0 && _customFilter$common3.custom) {
959
+ if (!common || !common.custom) {
960
+ filteredOut = true;
961
+ } else if (customFilter.common.custom === '_dataSources') {
962
+ // TODO: make it configurable
963
+ if (!Object.keys(common.custom).find(function (id) {
964
+ return id.startsWith('history.') || id.startsWith('sql.') || id.startsWith('influxdb.');
965
+ })) {
966
+ filteredOut = true;
967
+ }
968
+ } else if (customFilter.common.custom !== true && !Object.keys(common.custom).find(function (id) {
969
+ return id.startsWith(customFilter.common.custom);
970
+ })) {
918
971
  filteredOut = true;
919
972
  }
920
973
  }
@@ -4258,7 +4311,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
4258
4311
  },
4259
4312
  disabled: this.state.updating,
4260
4313
  size: "large"
4261
- }, /*#__PURE__*/_react["default"].createElement(_Refresh["default"], null)))), this.props.showExpertButton && /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
4314
+ }, /*#__PURE__*/_react["default"].createElement(_Refresh["default"], null)))), this.props.showExpertButton && !this.props.expertMode && /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
4262
4315
  title: this.props.t('ra_expertMode')
4263
4316
  }, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
4264
4317
  key: "expertMode",
@@ -6494,7 +6547,17 @@ ObjectBrowser.propTypes = {
6494
6547
  onObjectDelete: _propTypes["default"].func,
6495
6548
  // optional function (id, hasChildren, objectExists) { }
6496
6549
  customFilter: _propTypes["default"].object,
6497
- // optional {common: {custom: true}} or {common: {custom: 'sql.0'}}
6550
+ // optional
6551
+ // `{common: {custom: true}}` - show only objects with some custom settings
6552
+ // `{common: {custom: 'sql.0'}}` - show only objects with sql.0 custom settings (only of the specific instance)
6553
+ // `{common: {custom: '_dataSources'}}` - show only objects of adapters `influxdb' or 'sql' or 'history'
6554
+ // `{common: {custom: 'adapterName.'}}` - show only objects of custom settings of specific adapter (all instances)
6555
+ // `{type: 'channel'}` - show only channels
6556
+ // `{type: ['channel', 'device']}` - show only channels and devices
6557
+ // `{common: {type: 'number'}` - show only states of type 'number
6558
+ // `{common: {type: ['number', 'string']}` - show only states of type 'number and string
6559
+ // `{common: {role: 'switch']}` - show only states with roles starting from switch
6560
+ // `{common: {role: ['switch', 'button]}` - show only states with roles starting from `switch` and `button`
6498
6561
  objectBrowserValue: _propTypes["default"].object,
6499
6562
  objectBrowserEditObject: _propTypes["default"].object,
6500
6563
  objectBrowserEditRole: _propTypes["default"].object,