@iobroker/adapter-react-v5 6.1.10 → 7.0.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.
@@ -1203,7 +1203,7 @@ function getIdFieldTooltip(data, lang) {
1203
1203
  return react_1.default.createElement("span", { style: styles.cellIdTooltip }, tooltip || data.id || '');
1204
1204
  }
1205
1205
  function buildTree(objects, options) {
1206
- var _b, _c, _d, _e, _f, _g, _h, _j;
1206
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
1207
1207
  const imagePrefix = options.imagePrefix || '.';
1208
1208
  let ids = Object.keys(objects);
1209
1209
  ids.sort((a, b) => {
@@ -1241,6 +1241,7 @@ function buildTree(objects, options) {
1241
1241
  customs: ['_'],
1242
1242
  enums: [],
1243
1243
  hasSomeCustoms: false,
1244
+ aliasesMap: {},
1244
1245
  };
1245
1246
  let cRoot = root;
1246
1247
  for (let i = 0; i < ids.length; i++) {
@@ -1274,6 +1275,38 @@ function buildTree(objects, options) {
1274
1275
  info.hasSomeCustoms = true;
1275
1276
  info.customs.push(id.substring('system.adapter.'.length));
1276
1277
  }
1278
+ // Build a map of aliases
1279
+ if (id.startsWith('alias.') && ((_c = obj.common.alias) === null || _c === void 0 ? void 0 : _c.id)) {
1280
+ if (typeof obj.common.alias.id === 'string') {
1281
+ const usedId = obj.common.alias.id;
1282
+ if (!info.aliasesMap[usedId]) {
1283
+ info.aliasesMap[usedId] = [id];
1284
+ }
1285
+ else if (!info.aliasesMap[usedId].includes(id)) {
1286
+ info.aliasesMap[usedId].push(id);
1287
+ }
1288
+ }
1289
+ else {
1290
+ const readId = obj.common.alias.id.read;
1291
+ if (readId) {
1292
+ if (!info.aliasesMap[readId]) {
1293
+ info.aliasesMap[readId] = [id];
1294
+ }
1295
+ else if (!info.aliasesMap[readId].includes(id)) {
1296
+ info.aliasesMap[readId].push(id);
1297
+ }
1298
+ }
1299
+ const writeId = obj.common.alias.id.write;
1300
+ if (writeId) {
1301
+ if (!info.aliasesMap[writeId]) {
1302
+ info.aliasesMap[writeId] = [id];
1303
+ }
1304
+ else if (!info.aliasesMap[writeId].includes(id)) {
1305
+ info.aliasesMap[writeId].push(id);
1306
+ }
1307
+ }
1308
+ }
1309
+ }
1277
1310
  }
1278
1311
  info.ids.push(id);
1279
1312
  let repeat;
@@ -1314,22 +1347,22 @@ function buildTree(objects, options) {
1314
1347
  const _cRoot = {
1315
1348
  data: {
1316
1349
  name: parts[parts.length - 1],
1317
- title: getName((_c = obj === null || obj === void 0 ? void 0 : obj.common) === null || _c === void 0 ? void 0 : _c.name, options.lang),
1350
+ title: getName((_d = obj === null || obj === void 0 ? void 0 : obj.common) === null || _d === void 0 ? void 0 : _d.name, options.lang),
1318
1351
  obj,
1319
1352
  parent: cRoot,
1320
1353
  icon: getSelectIdIconFromObjects(objects, id, imagePrefix) ||
1321
1354
  getSystemIcon(objects, id, 0, options.themeType, imagePrefix),
1322
1355
  id,
1323
- hasCustoms: !!(((_d = obj.common) === null || _d === void 0 ? void 0 : _d.custom) && Object.keys(obj.common.custom).length),
1356
+ hasCustoms: !!(((_e = obj.common) === null || _e === void 0 ? void 0 : _e.custom) && Object.keys(obj.common.custom).length),
1324
1357
  level: parts.length - 1,
1325
1358
  generated: false,
1326
1359
  button: obj.type === 'state' &&
1327
- !!((_e = obj.common) === null || _e === void 0 ? void 0 : _e.role) &&
1360
+ !!((_f = obj.common) === null || _f === void 0 ? void 0 : _f.role) &&
1328
1361
  typeof obj.common.role === 'string' &&
1329
1362
  obj.common.role.startsWith('button') &&
1330
- ((_f = obj.common) === null || _f === void 0 ? void 0 : _f.write) !== false,
1331
- switch: obj.type === 'state' && ((_g = obj.common) === null || _g === void 0 ? void 0 : _g.type) === 'boolean' &&
1332
- ((_h = obj.common) === null || _h === void 0 ? void 0 : _h.write) !== false && ((_j = obj.common) === null || _j === void 0 ? void 0 : _j.read) !== false,
1363
+ ((_g = obj.common) === null || _g === void 0 ? void 0 : _g.write) !== false,
1364
+ switch: obj.type === 'state' && ((_h = obj.common) === null || _h === void 0 ? void 0 : _h.type) === 'boolean' &&
1365
+ ((_j = obj.common) === null || _j === void 0 ? void 0 : _j.write) !== false && ((_k = obj.common) === null || _k === void 0 ? void 0 : _k.read) !== false,
1333
1366
  },
1334
1367
  };
1335
1368
  cRoot.children = cRoot.children || [];
@@ -1636,11 +1669,12 @@ function formatValue(options) {
1636
1669
  * Get CSS style for given state value
1637
1670
  */
1638
1671
  function getValueStyle(options) {
1639
- const { state, isExpertMode, isButton } = options;
1640
- let color = (state === null || state === void 0 ? void 0 : state.ack) ? (state.q ? '#ffa500' : '') : '#ff2222c9';
1641
- if (!isExpertMode && isButton) {
1642
- color = '';
1643
- }
1672
+ const { state /* , isExpertMode, isButton */ } = options;
1673
+ const color = (state === null || state === void 0 ? void 0 : state.ack) ? (state.q ? '#ffa500' : '') : '#ff2222c9';
1674
+ // do not show the color of the button in non-expert mode
1675
+ // if (!isExpertMode && isButton) {
1676
+ // color = '';
1677
+ // }
1644
1678
  return { color };
1645
1679
  }
1646
1680
  function prepareSparkData(values, from) {
@@ -1831,7 +1865,12 @@ class ObjectBrowserClass extends react_1.Component {
1831
1865
  // console.log(`CONTEXT MENU: ${this.contextMenu ? Date.now() - this.contextMenu.ts : 'false'}`);
1832
1866
  if (this.contextMenu && Date.now() - this.contextMenu.ts < 2000) {
1833
1867
  e.preventDefault();
1834
- this.setState({ showContextMenu: { item: this.contextMenu.item } });
1868
+ this.setState({
1869
+ showContextMenu: {
1870
+ item: this.contextMenu.item,
1871
+ position: { left: e.clientX + 2, top: e.clientY - 6 },
1872
+ },
1873
+ });
1835
1874
  }
1836
1875
  else if (this.state.showContextMenu) {
1837
1876
  e.preventDefault();
@@ -2348,6 +2387,7 @@ class ObjectBrowserClass extends react_1.Component {
2348
2387
  excludeSystemRepositoriesFromExport: true,
2349
2388
  excludeTranslations: false,
2350
2389
  tooltipInfo: null,
2390
+ aliasMenu: '',
2351
2391
  };
2352
2392
  this.texts = {
2353
2393
  name: props.t('ra_Name'),
@@ -2989,7 +3029,7 @@ class ObjectBrowserClass extends react_1.Component {
2989
3029
  else {
2990
3030
  cColumns = null;
2991
3031
  }
2992
- if (cColumns === null || cColumns === void 0 ? void 0 : cColumns.length) {
3032
+ if (cColumns && cColumns.length) {
2993
3033
  columnsForAdmin = columnsForAdmin || {};
2994
3034
  columnsForAdmin[obj.common.name] = cColumns.sort((a, b) => (a.path > b.path ? -1 : a.path < b.path ? 1 : 0));
2995
3035
  }
@@ -3019,6 +3059,52 @@ class ObjectBrowserClass extends react_1.Component {
3019
3059
  }, 500);
3020
3060
  }
3021
3061
  }
3062
+ // This function is called when the user changes the alias of an object.
3063
+ // It updates the aliasMap and returns true if the aliasMap has changed.
3064
+ updateAliases(aliasId) {
3065
+ var _b, _c, _d;
3066
+ if (!this.objects || !((_b = this.info) === null || _b === void 0 ? void 0 : _b.aliasesMap) || !(aliasId === null || aliasId === void 0 ? void 0 : aliasId.startsWith('alias.'))) {
3067
+ return;
3068
+ }
3069
+ // Rebuild aliases map
3070
+ const aliasesIds = Object.keys(this.objects)
3071
+ .filter(id => id.startsWith('alias.0'));
3072
+ this.info.aliasesMap = {};
3073
+ for (const id of aliasesIds) {
3074
+ const obj = this.objects[id];
3075
+ if ((_d = (_c = obj === null || obj === void 0 ? void 0 : obj.common) === null || _c === void 0 ? void 0 : _c.alias) === null || _d === void 0 ? void 0 : _d.id) {
3076
+ if (typeof obj.common.alias.id === 'string') {
3077
+ const usedId = obj.common.alias.id;
3078
+ if (!this.info.aliasesMap[usedId]) {
3079
+ this.info.aliasesMap[usedId] = [id];
3080
+ }
3081
+ else if (!this.info.aliasesMap[usedId].includes(id)) {
3082
+ this.info.aliasesMap[usedId].push(id);
3083
+ }
3084
+ }
3085
+ else {
3086
+ const readId = obj.common.alias.id.read;
3087
+ if (readId) {
3088
+ if (!this.info.aliasesMap[readId]) {
3089
+ this.info.aliasesMap[readId] = [id];
3090
+ }
3091
+ else if (!this.info.aliasesMap[readId].includes(id)) {
3092
+ this.info.aliasesMap[readId].push(id);
3093
+ }
3094
+ }
3095
+ const writeId = obj.common.alias.id.write;
3096
+ if (writeId) {
3097
+ if (!this.info.aliasesMap[writeId]) {
3098
+ this.info.aliasesMap[writeId] = [id];
3099
+ }
3100
+ else if (!this.info.aliasesMap[writeId].includes(id)) {
3101
+ this.info.aliasesMap[writeId].push(id);
3102
+ }
3103
+ }
3104
+ }
3105
+ }
3106
+ }
3107
+ }
3022
3108
  /**
3023
3109
  * Processes a single element in regard to certain filters, columns for admin and updates object dict
3024
3110
  * @returns Returns an object containing the new state (if any) and whether the object was filtered.
@@ -3030,6 +3116,7 @@ class ObjectBrowserClass extends react_1.Component {
3030
3116
  obj) {
3031
3117
  console.log(`> objectChange ${id}`);
3032
3118
  const type = obj === null || obj === void 0 ? void 0 : obj.type;
3119
+ // If the object is filtered out, we don't need to update the React state
3033
3120
  if (obj &&
3034
3121
  typeof this.props.filterFunc === 'function' &&
3035
3122
  !this.props.filterFunc(obj) &&
@@ -3041,7 +3128,7 @@ class ObjectBrowserClass extends react_1.Component {
3041
3128
  return { newInnerState: null, filtered: true };
3042
3129
  }
3043
3130
  let newInnerState = null;
3044
- if (id.startsWith('system.adapter.') && obj && obj.type === 'adapter') {
3131
+ if (id.startsWith('system.adapter.') && (obj === null || obj === void 0 ? void 0 : obj.type) === 'adapter') {
3045
3132
  const columnsForAdmin = JSON.parse(JSON.stringify(this.state.columnsForAdmin));
3046
3133
  this.parseObjectForAdmins(columnsForAdmin, obj);
3047
3134
  if (JSON.stringify(this.state.columnsForAdmin) !== JSON.stringify(columnsForAdmin)) {
@@ -3055,6 +3142,7 @@ class ObjectBrowserClass extends react_1.Component {
3055
3142
  else if (this.objects[id]) {
3056
3143
  delete this.objects[id];
3057
3144
  }
3145
+ this.updateAliases(id);
3058
3146
  return { newInnerState, filtered: false };
3059
3147
  }
3060
3148
  subscribe(id) {
@@ -3585,23 +3673,23 @@ class ObjectBrowserClass extends react_1.Component {
3585
3673
  width: '100%',
3586
3674
  alignItems: 'center',
3587
3675
  } },
3588
- react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Refresh tree'), componentsProps: { popper: { sx: styles.tooltip } } },
3676
+ react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Refresh tree'), slotProps: { popper: { sx: styles.tooltip } } },
3589
3677
  react_1.default.createElement("div", null,
3590
3678
  react_1.default.createElement(material_1.IconButton, { onClick: () => this.refreshComponent(), disabled: this.state.updating, size: "large" },
3591
3679
  react_1.default.createElement(icons_material_1.Refresh, null)))),
3592
- this.props.showExpertButton && !this.props.expertMode && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_expertMode'), componentsProps: { popper: { sx: styles.tooltip } } },
3680
+ this.props.showExpertButton && !this.props.expertMode && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_expertMode'), slotProps: { popper: { sx: styles.tooltip } } },
3593
3681
  react_1.default.createElement(material_1.IconButton, { key: "expertMode", color: this.state.filter.expertMode ? 'secondary' : 'default', onClick: () => this.onFilter('expertMode', !this.state.filter.expertMode), size: "large" },
3594
3682
  react_1.default.createElement(IconExpert_1.default, null))),
3595
- !this.props.disableColumnSelector && this.props.width !== 'xs' && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Configure'), componentsProps: { popper: { sx: styles.tooltip } } },
3683
+ !this.props.disableColumnSelector && this.props.width !== 'xs' && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Configure'), slotProps: { popper: { sx: styles.tooltip } } },
3596
3684
  react_1.default.createElement(material_1.IconButton, { key: "columnSelector", color: this.state.columnsAuto ? 'primary' : 'default', onClick: () => this.setState({ columnsSelectorShow: true }), size: "large" },
3597
3685
  react_1.default.createElement(icons_material_1.ViewColumn, null))),
3598
- this.props.width !== 'xs' && this.state.expandAllVisible && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Expand all nodes'), componentsProps: { popper: { sx: styles.tooltip } } },
3686
+ this.props.width !== 'xs' && this.state.expandAllVisible && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Expand all nodes'), slotProps: { popper: { sx: styles.tooltip } } },
3599
3687
  react_1.default.createElement(material_1.IconButton, { key: "expandAll", onClick: () => this.onExpandAll(), size: "large" },
3600
3688
  react_1.default.createElement(IconOpen_1.default, null))),
3601
- react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Collapse all nodes'), componentsProps: { popper: { sx: styles.tooltip } } },
3689
+ react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Collapse all nodes'), slotProps: { popper: { sx: styles.tooltip } } },
3602
3690
  react_1.default.createElement(material_1.IconButton, { key: "collapseAll", onClick: () => this.onCollapseAll(), size: "large" },
3603
3691
  react_1.default.createElement(IconClosed_1.default, null))),
3604
- this.props.width !== 'xs' && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Expand one step node'), componentsProps: { popper: { sx: styles.tooltip } } },
3692
+ this.props.width !== 'xs' && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Expand one step node'), slotProps: { popper: { sx: styles.tooltip } } },
3605
3693
  react_1.default.createElement(material_1.IconButton, { key: "expandVisible", color: "primary", onClick: () => this.onExpandVisible(), size: "large" },
3606
3694
  react_1.default.createElement(material_1.Badge, { badgeContent: this.state.depth, color: "secondary", sx: (theme) => ({
3607
3695
  badge: {
@@ -3612,7 +3700,7 @@ class ObjectBrowserClass extends react_1.Component {
3612
3700
  },
3613
3701
  }) },
3614
3702
  react_1.default.createElement(IconOpen_1.default, null)))),
3615
- this.props.width !== 'xs' && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Collapse one step node'), componentsProps: { popper: { sx: styles.tooltip } } },
3703
+ this.props.width !== 'xs' && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Collapse one step node'), slotProps: { popper: { sx: styles.tooltip } } },
3616
3704
  react_1.default.createElement(material_1.IconButton, { key: "collapseVisible", color: "primary", onClick: () => this.onCollapseVisible(), size: "large" },
3617
3705
  react_1.default.createElement(material_1.Badge, { sx: (theme) => ({
3618
3706
  badge: {
@@ -3623,16 +3711,16 @@ class ObjectBrowserClass extends react_1.Component {
3623
3711
  },
3624
3712
  }), badgeContent: this.state.depth, color: "secondary" },
3625
3713
  react_1.default.createElement(IconClosed_1.default, null)))),
3626
- this.props.objectStatesView && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Toggle the states view'), componentsProps: { popper: { sx: styles.tooltip } } },
3714
+ this.props.objectStatesView && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Toggle the states view'), slotProps: { popper: { sx: styles.tooltip } } },
3627
3715
  react_1.default.createElement(material_1.IconButton, { onClick: () => this.onStatesViewVisible(), size: "large" },
3628
3716
  react_1.default.createElement(icons_material_1.LooksOne, { color: this.state.statesView ? 'primary' : 'inherit' }))),
3629
- react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Show/Hide object descriptions'), componentsProps: { popper: { sx: styles.tooltip } } },
3717
+ react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Show/Hide object descriptions'), slotProps: { popper: { sx: styles.tooltip } } },
3630
3718
  react_1.default.createElement(material_1.IconButton, { onClick: () => {
3631
3719
  this.localStorage.setItem(`${this.props.dialogName || 'App'}.desc`, this.state.showDescription ? 'false' : 'true');
3632
3720
  this.setState({ showDescription: !this.state.showDescription });
3633
3721
  }, size: "large" },
3634
3722
  react_1.default.createElement(icons_material_1.TextFields, { color: this.state.showDescription ? 'primary' : 'inherit' }))),
3635
- this.props.objectAddBoolean ? react_1.default.createElement(material_1.Tooltip, { title: this.toolTipObjectCreating(), componentsProps: { popper: { sx: styles.tooltip } } },
3723
+ this.props.objectAddBoolean ? react_1.default.createElement(material_1.Tooltip, { title: this.toolTipObjectCreating(), slotProps: { popper: { sx: styles.tooltip } } },
3636
3724
  react_1.default.createElement("div", null,
3637
3725
  react_1.default.createElement(material_1.IconButton, { disabled: !allowObjectCreation, onClick: () => this.setState({
3638
3726
  modalNewObj: {
@@ -3640,7 +3728,7 @@ class ObjectBrowserClass extends react_1.Component {
3640
3728
  },
3641
3729
  }), size: "large" },
3642
3730
  react_1.default.createElement(icons_material_1.Add, null)))) : null,
3643
- this.props.objectImportExport && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Add objects tree from JSON file'), componentsProps: { popper: { sx: styles.tooltip } } },
3731
+ this.props.objectImportExport && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Add objects tree from JSON file'), slotProps: { popper: { sx: styles.tooltip } } },
3644
3732
  react_1.default.createElement(material_1.IconButton, { onClick: () => {
3645
3733
  const input = document.createElement('input');
3646
3734
  input.setAttribute('type', 'file');
@@ -3652,11 +3740,11 @@ class ObjectBrowserClass extends react_1.Component {
3652
3740
  react_1.default.createElement(icons_material_1.Publish, null))),
3653
3741
  this.props.objectImportExport &&
3654
3742
  (!!this.state.selected.length || this.state.selectedNonObject) &&
3655
- react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Save objects tree as JSON file'), componentsProps: { popper: { sx: styles.tooltip } } },
3743
+ react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Save objects tree as JSON file'), slotProps: { popper: { sx: styles.tooltip } } },
3656
3744
  react_1.default.createElement(material_1.IconButton, { onClick: () => this.setState({ showExportDialog: this._getSelectedIdsForExport().length }), size: "large" },
3657
3745
  react_1.default.createElement(icons_material_1.Publish, { style: { transform: 'rotate(180deg)' } })))),
3658
3746
  !!this.props.objectBrowserEditObject && this.props.width !== 'xs' && react_1.default.createElement("div", { style: { display: 'flex', whiteSpace: 'nowrap' } }, `${this.props.t('ra_Objects')}: ${Object.keys(this.info.objects).length}, ${this.props.t('ra_States')}: ${Object.keys(this.info.objects).filter(el => this.info.objects[el].type === 'state').length}`),
3659
- this.props.objectEditBoolean && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Edit custom config'), componentsProps: { popper: { sx: styles.tooltip } } },
3747
+ this.props.objectEditBoolean && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Edit custom config'), slotProps: { popper: { sx: styles.tooltip } } },
3660
3748
  react_1.default.createElement(material_1.IconButton, { onClick: () => {
3661
3749
  var _b;
3662
3750
  // get all visible states
@@ -3738,7 +3826,7 @@ class ObjectBrowserClass extends react_1.Component {
3738
3826
  : this.systemConfig.common.defaultNewAcl.object);
3739
3827
  const showEdit = this.state.filter.expertMode || _a.isNonExpertId(item.data.id);
3740
3828
  return [
3741
- this.state.filter.expertMode && this.props.objectEditOfAccessControl ? react_1.default.createElement(material_1.Tooltip, { key: "acl", title: item.data.aclTooltip, componentsProps: { popper: { sx: styles.tooltip } } },
3829
+ this.state.filter.expertMode && this.props.objectEditOfAccessControl ? react_1.default.createElement(material_1.Tooltip, { key: "acl", title: item.data.aclTooltip, slotProps: { popper: { sx: styles.tooltip } } },
3742
3830
  react_1.default.createElement(material_1.IconButton, { sx: Object.assign(Object.assign(Object.assign({}, styles.cellButtonsButton), styles.cellButtonMinWidth), { opacity: 1 }), onClick: () => this.setState({ modalEditOfAccess: true, modalEditOfAccessObjData: item.data }), size: "large" },
3743
3831
  react_1.default.createElement("div", { style: styles.aclText }, Number.isNaN(Number(acl))
3744
3832
  ? Number(aclSystemConfig).toString(16)
@@ -3952,7 +4040,7 @@ class ObjectBrowserClass extends react_1.Component {
3952
4040
  }, checked: !!this.states[id].val })];
3953
4041
  }
3954
4042
  }
3955
- return react_1.default.createElement(material_1.Tooltip, { key: "value", title: (_c = this.state.tooltipInfo) === null || _c === void 0 ? void 0 : _c.el, componentsProps: {
4043
+ return react_1.default.createElement(material_1.Tooltip, { key: "value", title: (_c = this.state.tooltipInfo) === null || _c === void 0 ? void 0 : _c.el, slotProps: {
3956
4044
  popper: { sx: styles.cellValueTooltipBox },
3957
4045
  tooltip: { sx: styles.cellValueTooltip },
3958
4046
  }, onOpen: () => this.getTooltipInfo(id, () => this.readHistory(id)), onClose: () => { var _b; return ((_b = this.state.tooltipInfo) === null || _b === void 0 ? void 0 : _b.id) === id && this.setState({ tooltipInfo: null }); } },
@@ -4065,11 +4153,10 @@ class ObjectBrowserClass extends react_1.Component {
4065
4153
  enumDialogEnums.splice(pos, 1);
4066
4154
  }
4067
4155
  this.setState({ enumDialogEnums });
4068
- } },
4156
+ }, secondaryAction: icon },
4069
4157
  react_1.default.createElement(material_1.ListItemIcon, { sx: { '&.MuiListItemIcon-root': styles.enumCheckbox } },
4070
4158
  react_1.default.createElement(material_1.Checkbox, { edge: "start", checked: itemEnums.includes(id), tabIndex: -1, disableRipple: true, inputProps: { 'aria-labelledby': labelId } })),
4071
- react_1.default.createElement(material_1.ListItemText, { id: labelId }, name),
4072
- icon ? react_1.default.createElement(material_1.ListItemSecondaryAction, null, icon) : null);
4159
+ react_1.default.createElement(material_1.ListItemText, { id: labelId }, name));
4073
4160
  })));
4074
4161
  }
4075
4162
  renderEditRoleDialog() {
@@ -4268,11 +4355,33 @@ class ObjectBrowserClass extends react_1.Component {
4268
4355
  }
4269
4356
  return null;
4270
4357
  }
4358
+ renderAliasLink(id, index, customStyle) {
4359
+ // read the type of operation
4360
+ const aliasObj = this.objects[this.info.aliasesMap[id][index]].common.alias.id;
4361
+ if (aliasObj) {
4362
+ index = index || 0;
4363
+ return react_1.default.createElement(material_1.Box, { component: "div", onClick: e => {
4364
+ e.stopPropagation();
4365
+ e.preventDefault();
4366
+ const aliasId = this.info.aliasesMap[id][index];
4367
+ // if more than one alias, close the menu
4368
+ if (this.info.aliasesMap[id].length > 1) {
4369
+ this.setState({ aliasMenu: '' });
4370
+ }
4371
+ this.onSelect(aliasId);
4372
+ setTimeout(() => this.expandAllSelected(() => this.scrollToItem(aliasId)), 100);
4373
+ }, sx: customStyle || this.styles.aliasAlone },
4374
+ react_1.default.createElement("span", { className: "admin-browser-arrow" }, (typeof aliasObj === 'string' ||
4375
+ (aliasObj.read === id && aliasObj.write === id)) ? '↔' : (aliasObj.read === id ? '→' : '←')),
4376
+ this.info.aliasesMap[id][index]);
4377
+ }
4378
+ return null;
4379
+ }
4271
4380
  /**
4272
4381
  * Renders a leaf.
4273
4382
  */
4274
4383
  renderLeaf(item, isExpanded, counter) {
4275
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
4384
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
4276
4385
  const id = item.data.id;
4277
4386
  counter.count++;
4278
4387
  isExpanded = isExpanded === undefined ? this.state.expanded.includes(id) : isExpanded;
@@ -4364,34 +4473,55 @@ class ObjectBrowserClass extends react_1.Component {
4364
4473
  newValueTitle.push(`${this.texts.objectChangedByUser} ${Utils_1.default.formatDate(new Date(obj.ts), this.props.dateFormat || this.systemConfig.common.dateFormat)}`);
4365
4474
  }
4366
4475
  }
4367
- const readWriteAlias = typeof ((_c = common === null || common === void 0 ? void 0 : common.alias) === null || _c === void 0 ? void 0 : _c.id) === 'object';
4368
- const alias = id.startsWith('alias.') && ((_d = common === null || common === void 0 ? void 0 : common.alias) === null || _d === void 0 ? void 0 : _d.id) ? (readWriteAlias ?
4369
- react_1.default.createElement("div", { style: styles.cellIdAliasReadWriteDiv },
4370
- common.alias.id.read ? react_1.default.createElement(material_1.Box, { component: "div", onClick: e => {
4371
- e.stopPropagation();
4372
- e.preventDefault();
4373
- this.onSelect(common.alias.id.read);
4374
- setTimeout(() => this.expandAllSelected(() => this.scrollToItem(common.alias.id.read)), 100);
4375
- }, sx: this.styles.aliasReadWrite },
4376
- "\u2190",
4377
- common.alias.id.read) : null,
4378
- common.alias.id.write ? react_1.default.createElement(material_1.Box, { component: "div", onClick: e => {
4379
- e.stopPropagation();
4380
- e.preventDefault();
4381
- this.onSelect(common.alias.id.write);
4382
- setTimeout(() => this.expandAllSelected(() => this.scrollToItem(common.alias.id.write)), 100);
4383
- }, sx: this.styles.aliasReadWrite },
4384
- "\u2192",
4385
- common.alias.id.write) : null)
4386
- :
4387
- react_1.default.createElement(material_1.Box, { component: "div", onClick: e => {
4476
+ let readWriteAlias = false;
4477
+ let alias = null;
4478
+ if (id.startsWith('alias.') && ((_c = common === null || common === void 0 ? void 0 : common.alias) === null || _c === void 0 ? void 0 : _c.id)) {
4479
+ readWriteAlias = typeof common.alias.id === 'object';
4480
+ if (readWriteAlias) {
4481
+ alias = react_1.default.createElement("div", { style: styles.cellIdAliasReadWriteDiv },
4482
+ common.alias.id.read ? react_1.default.createElement(material_1.Box, { component: "div", onClick: e => {
4483
+ e.stopPropagation();
4484
+ e.preventDefault();
4485
+ this.onSelect(common.alias.id.read);
4486
+ setTimeout(() => this.expandAllSelected(() => this.scrollToItem(common.alias.id.read)), 100);
4487
+ }, sx: this.styles.aliasReadWrite },
4488
+ "\u2190",
4489
+ common.alias.id.read) : null,
4490
+ common.alias.id.write ? react_1.default.createElement(material_1.Box, { component: "div", onClick: e => {
4491
+ e.stopPropagation();
4492
+ e.preventDefault();
4493
+ this.onSelect(common.alias.id.write);
4494
+ setTimeout(() => this.expandAllSelected(() => this.scrollToItem(common.alias.id.write)), 100);
4495
+ }, sx: this.styles.aliasReadWrite },
4496
+ "\u2192",
4497
+ common.alias.id.write) : null);
4498
+ }
4499
+ else {
4500
+ alias = react_1.default.createElement(material_1.Box, { component: "div", onClick: e => {
4388
4501
  e.stopPropagation();
4389
4502
  e.preventDefault();
4390
4503
  this.onSelect(common.alias.id);
4391
4504
  setTimeout(() => this.expandAllSelected(() => this.scrollToItem(common.alias.id)), 100);
4392
4505
  }, sx: this.styles.aliasAlone },
4393
4506
  "\u2192",
4394
- common.alias.id)) : null;
4507
+ common.alias.id);
4508
+ }
4509
+ }
4510
+ else if (this.info.aliasesMap[id]) {
4511
+ // Some alias points to this object. It can be more than one
4512
+ if (this.info.aliasesMap[id].length > 1) {
4513
+ // Show number of aliases and open a menu by click
4514
+ alias = react_1.default.createElement(material_1.Box, { component: "div", id: `alias_${id}`, onClick: e => {
4515
+ e.stopPropagation();
4516
+ e.preventDefault();
4517
+ this.setState({ aliasMenu: id });
4518
+ }, sx: this.styles.aliasAlone }, this.props.t('ra_%s links from aliases', this.info.aliasesMap[id].length));
4519
+ }
4520
+ else {
4521
+ // Show name of alias and open it by click
4522
+ alias = this.renderAliasLink(id, 0);
4523
+ }
4524
+ }
4395
4525
  let checkColor = common === null || common === void 0 ? void 0 : common.color;
4396
4526
  let invertBackground;
4397
4527
  if (checkColor && !this.state.selected.includes(id)) {
@@ -4519,8 +4649,8 @@ class ObjectBrowserClass extends react_1.Component {
4519
4649
  }
4520
4650
  }
4521
4651
  }
4522
- const q = checkVisibleObjectType ? Utils_1.default.quality2text(((_e = this.states[id]) === null || _e === void 0 ? void 0 : _e.q) || 0).join(', ') : null;
4523
- let name = ((_f = item.data) === null || _f === void 0 ? void 0 : _f.title) || '';
4652
+ const q = checkVisibleObjectType ? Utils_1.default.quality2text(((_d = this.states[id]) === null || _d === void 0 ? void 0 : _d.q) || 0).join(', ') : null;
4653
+ let name = ((_e = item.data) === null || _e === void 0 ? void 0 : _e.title) || '';
4524
4654
  let useDesc = false;
4525
4655
  if (this.state.showDescription) {
4526
4656
  const oTooltip = getObjectTooltip(item.data, this.props.lang);
@@ -4533,22 +4663,22 @@ class ObjectBrowserClass extends react_1.Component {
4533
4663
  }
4534
4664
  }
4535
4665
  const narrowStyleWithDetails = this.props.width === 'xs' && this.state.focused === id;
4536
- const colID = react_1.default.createElement(material_1.Grid, { container: true, wrap: "nowrap", direction: "row", sx: styles.cellId, style: { width: this.columnsVisibility.id, paddingLeft } },
4537
- react_1.default.createElement(material_1.Grid, { item: true, container: true, alignItems: "center" },
4666
+ const colID = react_1.default.createElement(material_1.Grid2, { container: true, wrap: "nowrap", direction: "row", sx: styles.cellId, style: { width: this.columnsVisibility.id, paddingLeft } },
4667
+ react_1.default.createElement(material_1.Grid2, { container: true, alignItems: "center" },
4538
4668
  checkbox,
4539
4669
  iconFolder),
4540
- react_1.default.createElement(material_1.Grid, { item: true, style: Object.assign(Object.assign(Object.assign({}, styles.cellIdSpan), (invertBackground ? this.styles.invertedBackground : undefined)), { color: checkColor, fontWeight: bold ? 'bold' : undefined }) },
4541
- react_1.default.createElement(material_1.Tooltip, { title: getIdFieldTooltip(item.data, this.props.lang), componentsProps: { popper: { sx: styles.tooltip } } },
4670
+ react_1.default.createElement(material_1.Grid2, { style: Object.assign(Object.assign(Object.assign({}, styles.cellIdSpan), (invertBackground ? this.styles.invertedBackground : undefined)), { color: checkColor, fontWeight: bold ? 'bold' : undefined }) },
4671
+ react_1.default.createElement(material_1.Tooltip, { title: getIdFieldTooltip(item.data, this.props.lang), slotProps: { popper: { sx: styles.tooltip } } },
4542
4672
  react_1.default.createElement("div", null, item.data.name)),
4543
4673
  alias,
4544
4674
  icons),
4545
4675
  react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.grow), (invertBackground ? this.styles.invertedBackgroundFlex : {})) }),
4546
- react_1.default.createElement(material_1.Grid, { item: true, container: true, alignItems: "center" }, iconItem),
4676
+ react_1.default.createElement(material_1.Grid2, { container: true, alignItems: "center" }, iconItem),
4547
4677
  this.props.width !== 'xs' ? react_1.default.createElement("div", null,
4548
4678
  react_1.default.createElement(IconCopy_1.default, { className: narrowStyleWithDetails ? '' : 'copyButton', style: styles.cellCopyButton, onClick: e => this.onCopy(e, id) })) : null);
4549
4679
  let colName = (narrowStyleWithDetails && name) || this.columnsVisibility.name ? react_1.default.createElement(material_1.Box, { component: "div", sx: Object.assign(Object.assign(Object.assign({}, styles.cellName), (useDesc ? styles.cellNameWithDesc : undefined)), { width: this.props.width !== 'xs' ? this.columnsVisibility.name : undefined, ml: narrowStyleWithDetails ? 0 : '5px' }) },
4550
4680
  name,
4551
- !narrowStyleWithDetails && ((_g = item.data) === null || _g === void 0 ? void 0 : _g.title) ? react_1.default.createElement(material_1.Box, { style: { color: checkColor } },
4681
+ !narrowStyleWithDetails && ((_f = item.data) === null || _f === void 0 ? void 0 : _f.title) ? react_1.default.createElement(material_1.Box, { style: { color: checkColor } },
4552
4682
  react_1.default.createElement(IconCopy_1.default, { className: "copyButton", style: styles.cellCopyButton, onClick: e => { var _b; return this.onCopy(e, (_b = item.data) === null || _b === void 0 ? void 0 : _b.title); } })) : null) : null;
4553
4683
  let colMiddle;
4554
4684
  if (!this.state.statesView) {
@@ -4626,29 +4756,29 @@ class ObjectBrowserClass extends react_1.Component {
4626
4756
  }
4627
4757
  else {
4628
4758
  colMiddle = [
4629
- (narrowStyleWithDetails && checkVisibleObjectType && ((_h = this.states[id]) === null || _h === void 0 ? void 0 : _h.from)) || this.columnsVisibility.changedFrom ? {
4630
- el: react_1.default.createElement("div", { key: "from", style: Object.assign(Object.assign({}, styles.cellRole), { width: this.props.width !== 'xs' ? this.columnsVisibility.changedFrom : undefined }), title: newValueTitle.join('\n') }, checkVisibleObjectType && ((_j = this.states[id]) === null || _j === void 0 ? void 0 : _j.from) ? newValue : null),
4759
+ (narrowStyleWithDetails && checkVisibleObjectType && ((_g = this.states[id]) === null || _g === void 0 ? void 0 : _g.from)) || this.columnsVisibility.changedFrom ? {
4760
+ el: react_1.default.createElement("div", { key: "from", style: Object.assign(Object.assign({}, styles.cellRole), { width: this.props.width !== 'xs' ? this.columnsVisibility.changedFrom : undefined }), title: newValueTitle.join('\n') }, checkVisibleObjectType && ((_h = this.states[id]) === null || _h === void 0 ? void 0 : _h.from) ? newValue : null),
4631
4761
  type: 'from',
4632
4762
  } : null,
4633
4763
  (narrowStyleWithDetails && q) || this.columnsVisibility.qualityCode ? {
4634
4764
  el: react_1.default.createElement("div", { key: "q", style: Object.assign(Object.assign({}, styles.cellRole), { width: this.props.width !== 'xs' ? this.columnsVisibility.qualityCode : undefined }), title: q || '' }, q),
4635
4765
  type: 'quality',
4636
4766
  } : null,
4637
- (narrowStyleWithDetails && checkVisibleObjectType && ((_k = this.states[id]) === null || _k === void 0 ? void 0 : _k.ts)) || this.columnsVisibility.timestamp ? {
4638
- el: react_1.default.createElement("div", { key: "ts", style: Object.assign(Object.assign({}, styles.cellRole), { width: this.props.width !== 'xs' ? this.columnsVisibility.timestamp : undefined }) }, checkVisibleObjectType && ((_l = this.states[id]) === null || _l === void 0 ? void 0 : _l.ts)
4767
+ (narrowStyleWithDetails && checkVisibleObjectType && ((_j = this.states[id]) === null || _j === void 0 ? void 0 : _j.ts)) || this.columnsVisibility.timestamp ? {
4768
+ el: react_1.default.createElement("div", { key: "ts", style: Object.assign(Object.assign({}, styles.cellRole), { width: this.props.width !== 'xs' ? this.columnsVisibility.timestamp : undefined }) }, checkVisibleObjectType && ((_k = this.states[id]) === null || _k === void 0 ? void 0 : _k.ts)
4639
4769
  ? Utils_1.default.formatDate(new Date(this.states[id].ts), this.props.dateFormat || this.systemConfig.common.dateFormat)
4640
4770
  : null),
4641
4771
  type: 'ts',
4642
4772
  } : null,
4643
- (narrowStyleWithDetails && checkVisibleObjectType && ((_m = this.states[id]) === null || _m === void 0 ? void 0 : _m.lc)) || this.columnsVisibility.lastChange ? {
4644
- el: react_1.default.createElement("div", { key: "lc", style: Object.assign(Object.assign({}, styles.cellRole), { width: this.props.width !== 'xs' ? this.columnsVisibility.lastChange : undefined }) }, checkVisibleObjectType && ((_o = this.states[id]) === null || _o === void 0 ? void 0 : _o.lc)
4773
+ (narrowStyleWithDetails && checkVisibleObjectType && ((_l = this.states[id]) === null || _l === void 0 ? void 0 : _l.lc)) || this.columnsVisibility.lastChange ? {
4774
+ el: react_1.default.createElement("div", { key: "lc", style: Object.assign(Object.assign({}, styles.cellRole), { width: this.props.width !== 'xs' ? this.columnsVisibility.lastChange : undefined }) }, checkVisibleObjectType && ((_m = this.states[id]) === null || _m === void 0 ? void 0 : _m.lc)
4645
4775
  ? Utils_1.default.formatDate(new Date(this.states[id].lc), this.props.dateFormat || this.systemConfig.common.dateFormat)
4646
4776
  : null),
4647
4777
  type: 'lc',
4648
4778
  } : null,
4649
4779
  ];
4650
4780
  }
4651
- let colCustom = ((_p = this.adapterColumns) === null || _p === void 0 ? void 0 : _p.map(it => react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellAdapter), { width: this.props.width !== 'xs' ? this.columnsVisibility[it.id] : undefined }), key: it.id, title: `${it.adapter} => ${it.pathText}` }, obj ? this.renderCustomValue(obj, it, item) : null))) || null;
4781
+ let colCustom = ((_o = this.adapterColumns) === null || _o === void 0 ? void 0 : _o.map(it => react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellAdapter), { width: this.props.width !== 'xs' ? this.columnsVisibility[it.id] : undefined }), key: it.id, title: `${it.adapter} => ${it.pathText}` }, obj ? this.renderCustomValue(obj, it, item) : null))) || null;
4652
4782
  const columnValue = narrowStyleWithDetails || this.columnsVisibility.val ? this.renderColumnValue(id, item, narrowStyleWithDetails) : null;
4653
4783
  let colValue = (narrowStyleWithDetails && columnValue) || this.columnsVisibility.val ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellValue), { width: this.props.width !== 'xs' ? this.columnsVisibility.val : 'calc(100% - 100px)', cursor: valueEditable ? ((common === null || common === void 0 ? void 0 : common.type) === 'file' ? 'zoom-in' : (item.data.button ? 'grab' : 'text')) : 'default' }), onClick: valueEditable ? () => {
4654
4784
  if (!obj || !this.states) {
@@ -4716,10 +4846,10 @@ class ObjectBrowserClass extends react_1.Component {
4716
4846
  ":"),
4717
4847
  colName,
4718
4848
  react_1.default.createElement("div", { style: { flexGrow: 1 } }),
4719
- ((_q = item.data) === null || _q === void 0 ? void 0 : _q.title) ? react_1.default.createElement(IconCopy_1.default, { className: "copyButton", style: styles.cellCopyButtonInDetails, onClick: e => { var _b; return this.onCopy(e, (_b = item.data) === null || _b === void 0 ? void 0 : _b.title); } }) : null),
4849
+ ((_p = item.data) === null || _p === void 0 ? void 0 : _p.title) ? react_1.default.createElement(IconCopy_1.default, { className: "copyButton", style: styles.cellCopyButtonInDetails, onClick: e => { var _b; return this.onCopy(e, (_b = item.data) === null || _b === void 0 ? void 0 : _b.title); } }) : null),
4720
4850
  renderedMiddle,
4721
4851
  colCustom && react_1.default.createElement("div", { style: styles.cellDetailsLine }, colCustom),
4722
- ((_r = this.objects[id]) === null || _r === void 0 ? void 0 : _r.type) === 'state' && react_1.default.createElement("div", { style: styles.cellDetailsLine },
4852
+ ((_q = this.objects[id]) === null || _q === void 0 ? void 0 : _q.type) === 'state' && react_1.default.createElement("div", { style: styles.cellDetailsLine },
4723
4853
  react_1.default.createElement("span", { style: styles.cellDetailsName },
4724
4854
  this.texts.value,
4725
4855
  ":"),
@@ -4742,7 +4872,7 @@ class ObjectBrowserClass extends react_1.Component {
4742
4872
  colValue = null;
4743
4873
  colButtons = null;
4744
4874
  }
4745
- const row = react_1.default.createElement(material_1.Grid, { container: true, direction: "row", wrap: "nowrap", sx: Utils_1.default.getStyle(this.props.theme, styles.tableRow, this.state.linesEnabled && styles.tableRowLines, !this.props.dragEnabled && styles.tableRowNoDragging, alias && styles.tableRowAlias, readWriteAlias && styles.tableRowAliasReadWrite, this.state.focused === id && this.props.multiSelect && styles.tableRowFocused, !item.data.visible && styles.filteredOut, item.data.hasVisibleParent &&
4875
+ const row = react_1.default.createElement(material_1.Grid2, { container: true, direction: "row", wrap: "nowrap", sx: Utils_1.default.getStyle(this.props.theme, styles.tableRow, this.state.linesEnabled && styles.tableRowLines, !this.props.dragEnabled && styles.tableRowNoDragging, alias && styles.tableRowAlias, readWriteAlias && styles.tableRowAliasReadWrite, this.state.focused === id && this.props.multiSelect && styles.tableRowFocused, !item.data.visible && styles.filteredOut, item.data.hasVisibleParent &&
4746
4876
  !item.data.visible &&
4747
4877
  !item.data.hasVisibleChildren &&
4748
4878
  styles.filteredParentOut, this.state.selected.includes(id) && styles.itemSelected, this.state.selectedNonObject === id && styles.itemSelected), key: id, id: id, onMouseDown: e => {
@@ -5242,6 +5372,18 @@ class ObjectBrowserClass extends react_1.Component {
5242
5372
  },
5243
5373
  });
5244
5374
  }
5375
+ /** Renders the aliases list for one state (if more than 2) */
5376
+ renderAliasMenu() {
5377
+ if (!this.state.aliasMenu) {
5378
+ return null;
5379
+ }
5380
+ return react_1.default.createElement(material_1.Menu, { key: "aliasmenu", open: !0, anchorEl: window.document.getElementById(`alias_${this.state.aliasMenu}`), onClose: () => this.setState({ aliasMenu: '' }) }, this.info.aliasesMap[this.state.aliasMenu].map((aliasId, i) => react_1.default.createElement(material_1.MenuItem, { key: aliasId, onClick: () => this.onSelect(aliasId) },
5381
+ react_1.default.createElement(material_1.ListItemText, null, this.renderAliasLink(this.state.aliasMenu, i, {
5382
+ '& .admin-browser-arrow': {
5383
+ mr: '8px',
5384
+ },
5385
+ })))));
5386
+ }
5245
5387
  /**
5246
5388
  * Renders the right mouse button context menu
5247
5389
  */
@@ -5419,11 +5561,11 @@ class ObjectBrowserClass extends react_1.Component {
5419
5561
  icon: react_1.default.createElement(icons_material_1.Link, { style: ((_f = obj === null || obj === void 0 ? void 0 : obj.common) === null || _f === void 0 ? void 0 : _f.alias)
5420
5562
  ? this.styles.cellButtonsButtonWithCustoms
5421
5563
  : styles.cellButtonsButtonWithoutCustoms }),
5422
- label: this.props.t('ra_Edit alias'),
5564
+ label: this.info.aliasesMap[item.data.id] ? this.props.t('ra_Edit alias') : this.props.t('ra_Create alias'),
5423
5565
  onClick: () => {
5424
5566
  var _b;
5425
5567
  if ((_b = obj === null || obj === void 0 ? void 0 : obj.common) === null || _b === void 0 ? void 0 : _b.alias) {
5426
- this.setState({ editObjectDialog: item.data.id, showContextMenu: null, editObjectAlias: true });
5568
+ this.setState({ showContextMenu: null, editObjectDialog: item.data.id, editObjectAlias: true });
5427
5569
  }
5428
5570
  else {
5429
5571
  this.setState({ showContextMenu: null, showAliasEditor: item.data.id });
@@ -5499,9 +5641,10 @@ class ObjectBrowserClass extends react_1.Component {
5499
5641
  var _b, _c;
5500
5642
  if (ITEMS[key].visibility) {
5501
5643
  if (ITEMS[key].subMenu) {
5502
- items.push(react_1.default.createElement(material_1.MenuItem, { key: key, onClick: (e) => this.state.showContextMenu && this.setState({
5644
+ items.push(react_1.default.createElement(material_1.MenuItem, { key: key, href: "", onClick: (e) => this.state.showContextMenu && this.setState({
5503
5645
  showContextMenu: {
5504
5646
  item: this.state.showContextMenu.item,
5647
+ position: this.state.showContextMenu.position,
5505
5648
  subItem: key,
5506
5649
  subAnchor: e.target,
5507
5650
  },
@@ -5515,7 +5658,12 @@ class ObjectBrowserClass extends react_1.Component {
5515
5658
  if (((_b = this.state.showContextMenu) === null || _b === void 0 ? void 0 : _b.subItem) === key) {
5516
5659
  items.push(react_1.default.createElement(material_1.Menu, { key: "subContextMenu", open: !0, anchorEl: this.state.showContextMenu.subAnchor, onClose: () => {
5517
5660
  if (this.state.showContextMenu) {
5518
- this.setState({ showContextMenu: { item: this.state.showContextMenu.item } });
5661
+ this.setState({
5662
+ showContextMenu: {
5663
+ item: this.state.showContextMenu.item,
5664
+ position: this.state.showContextMenu.position,
5665
+ },
5666
+ });
5519
5667
  }
5520
5668
  this.contextMenu = null;
5521
5669
  } }, (_c = ITEMS[key].subMenu) === null || _c === void 0 ? void 0 : _c.map(subItem => (subItem.visibility ? react_1.default.createElement(material_1.MenuItem, { key: subItem.label, onClick: subItem.onClick, style: subItem.style },
@@ -5535,7 +5683,6 @@ class ObjectBrowserClass extends react_1.Component {
5535
5683
  setTimeout(() => this.setState({ showContextMenu: null }), 100);
5536
5684
  return null;
5537
5685
  }
5538
- const el = document.getElementById(id);
5539
5686
  return react_1.default.createElement(material_1.Menu, { key: "contextMenu", open: !0, onKeyUp: e => {
5540
5687
  e.preventDefault();
5541
5688
  if (e.altKey) {
@@ -5545,7 +5692,7 @@ class ObjectBrowserClass extends react_1.Component {
5545
5692
  }
5546
5693
  });
5547
5694
  }
5548
- }, anchorEl: el, onClose: () => {
5695
+ }, anchorReference: "anchorPosition", anchorPosition: this.state.showContextMenu.position, onClose: () => {
5549
5696
  this.setState({ showContextMenu: null });
5550
5697
  this.contextMenu = null;
5551
5698
  } }, items);
@@ -5665,6 +5812,7 @@ class ObjectBrowserClass extends react_1.Component {
5665
5812
  this.renderHeader(),
5666
5813
  react_1.default.createElement("div", { style: styles.tableDiv, ref: this.tableRef, onKeyDown: event => this.navigateKeyPress(event) }, items)),
5667
5814
  this.renderContextMenu(),
5815
+ this.renderAliasMenu(),
5668
5816
  this.renderToast(),
5669
5817
  this.renderColumnsEditCustomDialog(),
5670
5818
  this.renderColumnsSelectorDialog(),