@iobroker/adapter-react-v5 5.0.4 → 5.0.6

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.
Files changed (55) hide show
  1. package/Components/ColorPicker.d.ts +0 -1
  2. package/Components/ColorPicker.js +1 -1
  3. package/Components/ComplexCron.js +20 -28
  4. package/Components/CopyToClipboard.js +0 -4
  5. package/Components/CustomModal.js +1 -5
  6. package/Components/FileBrowser.js +13 -18
  7. package/Components/FileViewer.js +4 -11
  8. package/Components/Icon.d.ts +2 -2
  9. package/Components/Icon.js +2 -2
  10. package/Components/IconSelector.js +2 -10
  11. package/Components/Image.js +3 -1
  12. package/Components/Loader.d.ts +2 -2
  13. package/Components/Loader.js +1 -1
  14. package/Components/Loaders/PT.d.ts +1 -1
  15. package/Components/Loaders/PT.js +1 -1
  16. package/Components/Loaders/Vendor.d.ts +1 -1
  17. package/Components/Loaders/Vendor.js +2 -2
  18. package/Components/Logo.js +1 -1
  19. package/Components/MDUtils.js +2 -0
  20. package/Components/ObjectBrowser.d.ts +526 -2
  21. package/Components/ObjectBrowser.js +100 -84
  22. package/Components/SaveCloseButtons.js +9 -18
  23. package/Components/Schedule.js +2 -2
  24. package/Components/SimpleCron/cron2text.js +5 -3
  25. package/Components/SimpleCron/cronText.js +1 -1
  26. package/Components/SimpleCron/index.js +29 -35
  27. package/Components/TableResize.d.ts +1 -1
  28. package/Components/TableResize.js +1 -1
  29. package/Components/TextWithIcon.js +1 -1
  30. package/Components/TreeTable.js +5 -4
  31. package/Components/Utils.d.ts +58 -60
  32. package/Components/Utils.js +239 -197
  33. package/Dialogs/ComplexCron.js +2 -10
  34. package/Dialogs/Confirm.d.ts +1 -1
  35. package/Dialogs/Confirm.js +2 -4
  36. package/Dialogs/Cron.js +1 -3
  37. package/Dialogs/Error.d.ts +1 -11
  38. package/Dialogs/Error.js +1 -7
  39. package/Dialogs/Message.d.ts +1 -12
  40. package/Dialogs/Message.js +1 -8
  41. package/Dialogs/SelectFile.js +1 -5
  42. package/Dialogs/SelectID.d.ts +1 -1
  43. package/Dialogs/SelectID.js +13 -7
  44. package/Dialogs/SimpleCron.js +1 -3
  45. package/Dialogs/TextInput.js +1 -5
  46. package/GenericApp.d.ts +2 -3
  47. package/GenericApp.js +11 -9
  48. package/LegacyConnection.d.ts +11 -12
  49. package/LegacyConnection.js +350 -222
  50. package/README.md +25 -0
  51. package/craco-module-federation.js +2 -2
  52. package/i18n.d.ts +1 -1
  53. package/i18n.js +6 -8
  54. package/package.json +7 -7
  55. package/types.d.ts +27 -27
@@ -30,9 +30,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
30
30
  var __importDefault = (this && this.__importDefault) || function (mod) {
31
31
  return (mod && mod.__esModule) ? mod : { "default": mod };
32
32
  };
33
- var _a, _ObjectBrowser_NON_EXPERT_NAMESPACES;
33
+ var _a, _ObjectBrowserClass_NON_EXPERT_NAMESPACES;
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.ITEM_IMAGES = exports.getSelectIdIconFromObjects = void 0;
35
+ exports.ObjectBrowserClass = exports.ITEM_IMAGES = exports.getSelectIdIconFromObjects = void 0;
36
36
  /**
37
37
  * Copyright 2020-2024, Denis Haev <dogafox@gmail.com>
38
38
  *
@@ -422,6 +422,10 @@ const styles = (theme) => ({
422
422
  whiteSpace: 'nowrap',
423
423
  textOverflow: 'ellipsis',
424
424
  },
425
+ cellValueTooltipImage: {
426
+ width: 100,
427
+ height: 'auto',
428
+ },
425
429
  cellValueTooltipBoth: {
426
430
  width: 220,
427
431
  display: 'inline-block',
@@ -1507,6 +1511,7 @@ function formatValue(options) {
1507
1511
  const { dateFormat, state, isFloatComma, texts, obj, } = options;
1508
1512
  const states = Utils_1.default.getStates(obj);
1509
1513
  const isCommon = obj.common;
1514
+ let fileViewer;
1510
1515
  let v =
1511
1516
  // @ts-expect-error deprecated from js-controller 6
1512
1517
  (isCommon === null || isCommon === void 0 ? void 0 : isCommon.type) === 'file'
@@ -1541,7 +1546,7 @@ function formatValue(options) {
1541
1546
  // '2000-01-01T00:00:00' => 946681200000
1542
1547
  v *= 1000; // maybe the time is in seconds (UNIX time)
1543
1548
  }
1544
- // null and undefined could not be here. See `let v = (isCommon && isCommon.type === 'file') ....` above
1549
+ // "null" and undefined could not be here. See `let v = (isCommon && isCommon.type === 'file') ....` above
1545
1550
  v = v ? new Date(v).toString() : v;
1546
1551
  }
1547
1552
  }
@@ -1560,6 +1565,9 @@ function formatValue(options) {
1560
1565
  else if (type !== 'string') {
1561
1566
  v = v.toString();
1562
1567
  }
1568
+ else if (v.startsWith('data:image/')) {
1569
+ fileViewer = 'image';
1570
+ }
1563
1571
  if (typeof v !== 'string') {
1564
1572
  v = v.toString();
1565
1573
  }
@@ -1576,39 +1584,43 @@ function formatValue(options) {
1576
1584
  if (isCommon === null || isCommon === void 0 ? void 0 : isCommon.unit) {
1577
1585
  valText.u = isCommon.unit;
1578
1586
  }
1579
- const valFull = [{ t: texts.value, v }];
1580
- if (state) {
1581
- if (state.ack !== undefined && state.ack !== null) {
1582
- valFull.push({ t: texts.ack, v: state.ack.toString() });
1583
- }
1584
- if (state.ts) {
1585
- valFull.push({ t: texts.ts, v: state.ts ? Utils_1.default.formatDate(new Date(state.ts), dateFormat) : '' });
1586
- }
1587
- if (state.lc) {
1588
- valFull.push({ t: texts.lc, v: state.lc ? Utils_1.default.formatDate(new Date(state.lc), dateFormat) : '' });
1589
- }
1590
- if (state.from) {
1591
- let from = state.from.toString();
1592
- if (from.startsWith('system.adapter.')) {
1593
- from = from.substring(15);
1587
+ let valFull;
1588
+ if (options.full) {
1589
+ valFull = [{ t: texts.value, v }];
1590
+ if (state) {
1591
+ if (state.ack !== undefined && state.ack !== null) {
1592
+ valFull.push({ t: texts.ack, v: state.ack.toString() });
1594
1593
  }
1595
- valFull.push({ t: texts.from, v: from });
1596
- }
1597
- if (state.user) {
1598
- let user = state.user.toString();
1599
- if (user.startsWith('system.user.')) {
1600
- user = user.substring(12);
1594
+ if (state.ts) {
1595
+ valFull.push({ t: texts.ts, v: state.ts ? Utils_1.default.formatDate(new Date(state.ts), dateFormat) : '' });
1601
1596
  }
1602
- valFull.push({ t: texts.user, v: user });
1603
- }
1604
- if (state.c) {
1605
- valFull.push({ t: texts.c, v: state.c });
1597
+ if (state.lc) {
1598
+ valFull.push({ t: texts.lc, v: state.lc ? Utils_1.default.formatDate(new Date(state.lc), dateFormat) : '' });
1599
+ }
1600
+ if (state.from) {
1601
+ let from = state.from.toString();
1602
+ if (from.startsWith('system.adapter.')) {
1603
+ from = from.substring(15);
1604
+ }
1605
+ valFull.push({ t: texts.from, v: from });
1606
+ }
1607
+ if (state.user) {
1608
+ let user = state.user.toString();
1609
+ if (user.startsWith('system.user.')) {
1610
+ user = user.substring(12);
1611
+ }
1612
+ valFull.push({ t: texts.user, v: user });
1613
+ }
1614
+ if (state.c) {
1615
+ valFull.push({ t: texts.c, v: state.c });
1616
+ }
1617
+ valFull.push({ t: texts.quality, v: Utils_1.default.quality2text(state.q || 0).join(', '), nbr: true });
1606
1618
  }
1607
- valFull.push({ t: texts.quality, v: Utils_1.default.quality2text(state.q || 0).join(', '), nbr: true });
1608
1619
  }
1609
1620
  return {
1610
1621
  valText,
1611
1622
  valFull,
1623
+ fileViewer,
1612
1624
  };
1613
1625
  }
1614
1626
  /**
@@ -1770,7 +1782,7 @@ const DEFAULT_FILTER = {
1770
1782
  custom: '',
1771
1783
  expertMode: false,
1772
1784
  };
1773
- class ObjectBrowser extends react_1.Component {
1785
+ class ObjectBrowserClass extends react_1.Component {
1774
1786
  constructor(props) {
1775
1787
  super(props);
1776
1788
  this.localStorage = window._localStorage || window.localStorage;
@@ -2323,6 +2335,7 @@ class ObjectBrowser extends react_1.Component {
2323
2335
  beautifyJsonExport: true,
2324
2336
  excludeSystemRepositoriesFromExport: true,
2325
2337
  excludeTranslations: false,
2338
+ tooltipInfo: null,
2326
2339
  };
2327
2340
  this.texts = {
2328
2341
  value: props.t('ra_tooltip_value'),
@@ -2547,7 +2560,7 @@ class ObjectBrowser extends react_1.Component {
2547
2560
  static isNonExpertId(
2548
2561
  /** id to test */
2549
2562
  id) {
2550
- return !!__classPrivateFieldGet(_a, _a, "f", _ObjectBrowser_NON_EXPERT_NAMESPACES).find(saveNamespace => id.startsWith(saveNamespace));
2563
+ return !!__classPrivateFieldGet(_a, _a, "f", _ObjectBrowserClass_NON_EXPERT_NAMESPACES).find(saveNamespace => id.startsWith(saveNamespace));
2551
2564
  }
2552
2565
  expandAllSelected(cb) {
2553
2566
  const expanded = [...this.state.expanded];
@@ -3395,11 +3408,7 @@ class ObjectBrowser extends react_1.Component {
3395
3408
  react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { checked: this.state.excludeSystemRepositoriesFromExport, onChange: e => this.setState({ excludeSystemRepositoriesFromExport: e.target.checked }) }), label: this.props.t('Exclude system repositories from export JSON') }),
3396
3409
  react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { checked: this.state.excludeTranslations, onChange: e => this.setState({ excludeTranslations: e.target.checked }) }), label: this.props.t('Exclude translations (except english) from export JSON') })) : null)),
3397
3410
  react_1.default.createElement(material_1.DialogActions, null,
3398
- this.state.filter.expertMode || this.state.showAllExportOptions ? react_1.default.createElement(material_1.Button
3399
- // @ts-expect-error grey is valid color
3400
- , {
3401
- // @ts-expect-error grey is valid color
3402
- color: "grey", variant: "outlined", onClick: () => this.setState({ showExportDialog: false, showAllExportOptions: false }, () => this._exportObjects({
3411
+ this.state.filter.expertMode || this.state.showAllExportOptions ? react_1.default.createElement(material_1.Button, { color: "grey", variant: "outlined", onClick: () => this.setState({ showExportDialog: false, showAllExportOptions: false }, () => this._exportObjects({
3403
3412
  isAll: true,
3404
3413
  noStatesByExportImport: this.state.noStatesByExportImport,
3405
3414
  beautify: this.state.beautifyJsonExport,
@@ -3409,11 +3418,7 @@ class ObjectBrowser extends react_1.Component {
3409
3418
  react_1.default.createElement("span", { style: { marginRight: 8 } }, this.props.t('ra_All objects')),
3410
3419
  "(",
3411
3420
  Object.keys(this.objects).length,
3412
- ")") : react_1.default.createElement(material_1.Button
3413
- // @ts-expect-error grey is valid color
3414
- , {
3415
- // @ts-expect-error grey is valid color
3416
- color: "grey", variant: "outlined", startIcon: react_1.default.createElement(IconExpert_1.default, null), onClick: () => this.setState({ showAllExportOptions: true }) }, this.props.t('ra_Advanced options')),
3421
+ ")") : react_1.default.createElement(material_1.Button, { color: "grey", variant: "outlined", startIcon: react_1.default.createElement(IconExpert_1.default, null), onClick: () => this.setState({ showAllExportOptions: true }) }, this.props.t('ra_Advanced options')),
3417
3422
  react_1.default.createElement(material_1.Button, { color: "primary", variant: "contained", autoFocus: true, onClick: () => this.setState({ showExportDialog: false, showAllExportOptions: false }, () => this._exportObjects({
3418
3423
  isAll: false,
3419
3424
  noStatesByExportImport: this.state.noStatesByExportImport,
@@ -3425,11 +3430,7 @@ class ObjectBrowser extends react_1.Component {
3425
3430
  "(",
3426
3431
  this.state.showExportDialog,
3427
3432
  ")"),
3428
- react_1.default.createElement(material_1.Button
3429
- // @ts-expect-error grey is valid color
3430
- , {
3431
- // @ts-expect-error grey is valid color
3432
- color: "grey", variant: "contained", onClick: () => this.setState({ showExportDialog: false, showAllExportOptions: false }), startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.props.t('ra_Cancel'))));
3433
+ react_1.default.createElement(material_1.Button, { color: "grey", variant: "contained", onClick: () => this.setState({ showExportDialog: false, showAllExportOptions: false }), startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.props.t('ra_Cancel'))));
3433
3434
  }
3434
3435
  handleJsonUpload(evt) {
3435
3436
  var _b;
@@ -3771,8 +3772,49 @@ class ObjectBrowser extends react_1.Component {
3771
3772
  .catch(e => console.warn(`Cannot read history: ${e}`));
3772
3773
  }
3773
3774
  }
3775
+ getTooltipInfo(id, cb) {
3776
+ var _b, _c;
3777
+ const obj = this.objects[id];
3778
+ const state = this.states[id];
3779
+ const classes = this.props.classes;
3780
+ const { valFull, fileViewer } = formatValue({
3781
+ state,
3782
+ obj: obj,
3783
+ texts: this.texts,
3784
+ dateFormat: this.props.dateFormat || this.systemConfig.common.dateFormat,
3785
+ isFloatComma: this.props.isFloatComma === undefined ? this.systemConfig.common.isFloatComma : this.props.isFloatComma,
3786
+ full: true,
3787
+ });
3788
+ const valFullRx = [];
3789
+ valFull.forEach(_item => {
3790
+ if (_item.t === this.texts.quality && state.q) {
3791
+ valFullRx.push(react_1.default.createElement("div", { className: classes.cellValueTooltipBoth, key: _item.t },
3792
+ _item.t,
3793
+ ":\u00A0",
3794
+ _item.v));
3795
+ // <div className={classes.cellValueTooltipValue} key={item.t + '_v'}>{item.v}</div>,
3796
+ !_item.nbr && valFullRx.push(react_1.default.createElement("br", { key: `${_item.t}_br` }));
3797
+ }
3798
+ else {
3799
+ valFullRx.push(react_1.default.createElement("div", { className: classes.cellValueTooltipTitle, key: _item.t },
3800
+ _item.t,
3801
+ ":\u00A0"));
3802
+ valFullRx.push(react_1.default.createElement("div", { className: classes.cellValueTooltipValue, key: `${_item.t}_v` }, _item.v));
3803
+ !_item.nbr && valFullRx.push(react_1.default.createElement("br", { key: `${_item.t}_br` }));
3804
+ }
3805
+ });
3806
+ if (fileViewer === 'image') {
3807
+ valFullRx.push(react_1.default.createElement("img", { className: classes.cellValueTooltipImage, src: state.val, alt: id }));
3808
+ }
3809
+ else if (this.defaultHistory &&
3810
+ ((_c = (_b = this.objects[id]) === null || _b === void 0 ? void 0 : _b.common) === null || _c === void 0 ? void 0 : _c.custom) &&
3811
+ this.objects[id].common.custom[this.defaultHistory]) {
3812
+ valFullRx.push(react_1.default.createElement("svg", { key: "sparkline", className: "sparkline", "data-id": id, style: { fill: '#3d85de' }, width: "200", height: "30", strokeWidth: "3" }));
3813
+ }
3814
+ this.setState({ tooltipInfo: { el: valFullRx, id } }, () => cb && cb());
3815
+ }
3774
3816
  renderColumnValue(id, item, classes) {
3775
- var _b, _c, _d;
3817
+ var _b, _c;
3776
3818
  const obj = item.data.obj;
3777
3819
  if (!obj || !this.states) {
3778
3820
  return null;
@@ -3793,38 +3835,15 @@ class ObjectBrowser extends react_1.Component {
3793
3835
  const state = this.states[id];
3794
3836
  let info = item.data.state;
3795
3837
  if (!info) {
3796
- const { valFull, valText } = formatValue({
3838
+ const { valText } = formatValue({
3797
3839
  state,
3798
3840
  obj: obj,
3799
3841
  texts: this.texts,
3800
3842
  dateFormat: this.props.dateFormat || this.systemConfig.common.dateFormat,
3801
3843
  isFloatComma: this.props.isFloatComma === undefined ? this.systemConfig.common.isFloatComma : this.props.isFloatComma,
3802
3844
  });
3803
- const valFullRx = [];
3804
3845
  const valTextRx = [];
3805
- item.data.state = { valFullRx, valTextRx };
3806
- valFull.forEach(_item => {
3807
- if (_item.t === this.texts.quality && state.q) {
3808
- valFullRx.push(react_1.default.createElement("div", { className: classes.cellValueTooltipBoth, key: _item.t },
3809
- _item.t,
3810
- ":\u00A0",
3811
- _item.v));
3812
- // <div className={classes.cellValueTooltipValue} key={item.t + '_v'}>{item.v}</div>,
3813
- !_item.nbr && valFullRx.push(react_1.default.createElement("br", { key: `${_item.t}_br` }));
3814
- }
3815
- else {
3816
- valFullRx.push(react_1.default.createElement("div", { className: classes.cellValueTooltipTitle, key: _item.t },
3817
- _item.t,
3818
- ":\u00A0"));
3819
- valFullRx.push(react_1.default.createElement("div", { className: classes.cellValueTooltipValue, key: `${_item.t}_v` }, _item.v));
3820
- !_item.nbr && valFullRx.push(react_1.default.createElement("br", { key: `${_item.t}_br` }));
3821
- }
3822
- });
3823
- if (this.defaultHistory &&
3824
- ((_d = (_c = this.objects[id]) === null || _c === void 0 ? void 0 : _c.common) === null || _d === void 0 ? void 0 : _d.custom) &&
3825
- this.objects[id].common.custom[this.defaultHistory]) {
3826
- valFullRx.push(react_1.default.createElement("svg", { key: "sparkline", className: "sparkline", "data-id": id, style: { fill: '#3d85de' }, width: "200", height: "30", strokeWidth: "3" }));
3827
- }
3846
+ item.data.state = { valTextRx };
3828
3847
  const copyText = valText.v || '';
3829
3848
  valTextRx.push(react_1.default.createElement("span", { className: classes.newValue, key: `${valText.v.toString()}valText` }, valText.v.toString()));
3830
3849
  valText.u && valTextRx.push(react_1.default.createElement("span", { className: Utils_1.default.clsx(classes.cellValueTextUnit, classes.newValue), key: `${valText.v.toString()}unit` }, valText.u));
@@ -3841,10 +3860,10 @@ class ObjectBrowser extends react_1.Component {
3841
3860
  if (!this.state.filter.expertMode && item.data.button) {
3842
3861
  val = [react_1.default.createElement(icons_material_1.RoomService, { className: this.props.classes.cellValueButton })];
3843
3862
  }
3844
- return react_1.default.createElement(material_1.Tooltip, { key: "value", title: info.valFullRx, classes: {
3863
+ return react_1.default.createElement(material_1.Tooltip, { key: "value", title: ((_c = this.state.tooltipInfo) === null || _c === void 0 ? void 0 : _c.el) || 'Calculating...', classes: {
3845
3864
  tooltip: this.props.classes.cellValueTooltip,
3846
3865
  popper: this.props.classes.cellValueTooltipBox,
3847
- }, onOpen: () => this.readHistory(id) },
3866
+ }, 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 }); } },
3848
3867
  react_1.default.createElement("div", { style: info.style, className: classes.cellValueText }, val));
3849
3868
  }
3850
3869
  _syncEnum(id, enumIds, newArray, cb) {
@@ -4038,11 +4057,7 @@ class ObjectBrowser extends react_1.Component {
4038
4057
  }, autoFocus: true }))),
4039
4058
  react_1.default.createElement(material_1.DialogActions, null,
4040
4059
  react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.onColumnsEditCustomDialogClose(true), disabled: !this.state.customColumnDialogValueChanged, color: "primary", startIcon: react_1.default.createElement(icons_material_1.Check, null) }, this.props.t('ra_Update')),
4041
- react_1.default.createElement(material_1.Button
4042
- // @ts-expect-error grey is valid color
4043
- , {
4044
- // @ts-expect-error grey is valid color
4045
- color: "grey", variant: "contained", onClick: () => this.onColumnsEditCustomDialogClose(), startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.props.t('ra_Cancel'))));
4060
+ react_1.default.createElement(material_1.Button, { color: "grey", variant: "contained", onClick: () => this.onColumnsEditCustomDialogClose(), startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.props.t('ra_Cancel'))));
4046
4061
  }
4047
4062
  static getCustomValue(obj, it) {
4048
4063
  var _b;
@@ -4790,7 +4805,7 @@ class ObjectBrowser extends react_1.Component {
4790
4805
  this.toggleExpanded(selectedId);
4791
4806
  }
4792
4807
  if (event.code === 'Delete' && this.root && selectedId) {
4793
- const item = this.getItemFromRoot(this.root, selectedId);
4808
+ const item = _a.getItemFromRoot(this.root, selectedId);
4794
4809
  if (item) {
4795
4810
  const { obj } = item.data;
4796
4811
  if (obj && !((_c = obj.common) === null || _c === void 0 ? void 0 : _c.dontDelete)) {
@@ -4802,7 +4817,7 @@ class ObjectBrowser extends react_1.Component {
4802
4817
  /**
4803
4818
  * Find the id from the root
4804
4819
  */
4805
- getItemFromRoot(
4820
+ static getItemFromRoot(
4806
4821
  /** The current root */
4807
4822
  root,
4808
4823
  /** the object id to find */
@@ -5388,7 +5403,8 @@ class ObjectBrowser extends react_1.Component {
5388
5403
  this.props.modalEditOfAccessControl(this, this.state.modalEditOfAccessObjData));
5389
5404
  }
5390
5405
  }
5391
- _a = ObjectBrowser;
5406
+ exports.ObjectBrowserClass = ObjectBrowserClass;
5407
+ _a = ObjectBrowserClass;
5392
5408
  /** Namespaces which are allowed to be edited by non-expert users */
5393
- _ObjectBrowser_NON_EXPERT_NAMESPACES = { value: ['0_userdata.0.', 'alias.0.'] };
5394
- exports.default = (0, withWidth_1.default)()((0, styles_1.withStyles)(styles)(ObjectBrowser));
5409
+ _ObjectBrowserClass_NON_EXPERT_NAMESPACES = { value: ['0_userdata.0.', 'alias.0.'] };
5410
+ exports.default = (0, withWidth_1.default)()((0, styles_1.withStyles)(styles)(ObjectBrowserClass));
@@ -14,29 +14,20 @@ const styles = {
14
14
  marginRight: 8,
15
15
  },
16
16
  };
17
- /**
18
- * @typedef {object} SaveCloseButtonsProps
19
- * @property {boolean} noTextOnButtons Are the buttons without text
20
- * @property {any} theme Theme object (from this.state.theme)
21
- * @property {boolean} isIFrame bottom position 0 or 38 for iFrame
22
- * @property {boolean} newReact is used in new react
23
- * @property {function} onSave on Save handler
24
- * @property {function} onClose on Close handler
25
- *
26
- * @extends {React.Component<SaveCloseButtonsProps>}
27
- */
28
17
  class SaveCloseButtons extends react_1.default.Component {
29
- /**
30
- * @param {SaveCloseButtonsProps} props
31
- */
32
18
  constructor(props) {
33
19
  super(props);
34
20
  const newReact = props.newReact === undefined ? true : props.newReact;
35
- try {
36
- this.isIFrame = !newReact && window.self !== window.top;
21
+ if (props.isIFrame !== undefined) {
22
+ this.isIFrame = props.isIFrame;
37
23
  }
38
- catch (e) {
39
- this.isIFrame = !newReact;
24
+ else {
25
+ try {
26
+ this.isIFrame = !newReact && window.self !== window.top;
27
+ }
28
+ catch (e) {
29
+ this.isIFrame = !newReact;
30
+ }
40
31
  }
41
32
  }
42
33
  render() {
@@ -234,7 +234,7 @@ class Schedule extends react_1.Component {
234
234
  this.timerOnce = null;
235
235
  this.timerFrom = null;
236
236
  this.timerTo = null;
237
- let schedule = undefined;
237
+ let schedule;
238
238
  if (this.props.schedule && typeof this.props.schedule === 'string' && this.props.schedule[0] === '{') {
239
239
  try {
240
240
  schedule = JSON.parse(this.props.schedule);
@@ -504,7 +504,7 @@ class Schedule extends react_1.Component {
504
504
  }
505
505
  // time
506
506
  if (schedule.time.exactTime) {
507
- if (ASTRO.indexOf(schedule.time.start) !== -1) {
507
+ if (ASTRO.includes(schedule.time.start)) {
508
508
  // at sunset
509
509
  desc.push(i18n_1.default.t('sch_desc_atTime', i18n_1.default.t(`sch_astro_${schedule.time.start}`)));
510
510
  }
@@ -207,7 +207,8 @@ function cronToText(cronSpec, withSeconds, locale) {
207
207
  item = (min - 1).toString(10);
208
208
  }
209
209
  // parse x
210
- if ((value = getValue(item, offset, max)) !== null) {
210
+ value = getValue(item, offset, max);
211
+ if (value !== null) {
211
212
  add(curSched, name, value, value);
212
213
  }
213
214
  else if ((value = getValue(item.replace('W', ''), offset, max)) !== null) {
@@ -300,7 +301,7 @@ function cronToText(cronSpec, withSeconds, locale) {
300
301
  }
301
302
  function ordinal(number) {
302
303
  const b = number % 10;
303
- const output = (toInt(number % 100 / 10) === 1) ? locale.ORDINALS.th :
304
+ const output = (toInt((number % 100) / 10) === 1) ? locale.ORDINALS.th :
304
305
  b === 1 ? locale.ORDINALS.st :
305
306
  b === 2 ? locale.ORDINALS.nd :
306
307
  b === 3 ? locale.ORDINALS.rd : locale.ORDINALS.th;
@@ -347,7 +348,8 @@ function cronToText(cronSpec, withSeconds, locale) {
347
348
  }
348
349
  const lastVal = numbers.pop() || 0;
349
350
  let outputText = '';
350
- for (let i = 0, value; (value = numbers[i]); i++) {
351
+ for (let i = 0, value; numbers[i]; i++) {
352
+ value = numbers[i];
351
353
  if (outputText.length > 0) {
352
354
  outputText += ', ';
353
355
  }
@@ -47,6 +47,6 @@ function convertCronToText(cron, lang) {
47
47
  const withSeconds = cron.split(' ').length === 6;
48
48
  const locale = (lang && jquery_cron_locale_1.default[lang]) || jquery_cron_locale_1.default.en;
49
49
  const text = (0, cron2text_1.default)(cron, withSeconds, locale);
50
- return correctCasus(text /*, withSeconds*/);
50
+ return correctCasus(text /* , withSeconds */);
51
51
  }
52
52
  exports.default = convertCronToText;
@@ -6,13 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.cron2state = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const styles_1 = require("@mui/styles");
9
- const InputLabel_1 = __importDefault(require("@mui/material/InputLabel"));
10
- const MenuItem_1 = __importDefault(require("@mui/material/MenuItem"));
11
- const FormControl_1 = __importDefault(require("@mui/material/FormControl"));
12
- const Select_1 = __importDefault(require("@mui/material/Select"));
13
- const TextField_1 = __importDefault(require("@mui/material/TextField"));
14
- const FormControlLabel_1 = __importDefault(require("@mui/material/FormControlLabel"));
15
- const Checkbox_1 = __importDefault(require("@mui/material/Checkbox"));
9
+ const material_1 = require("@mui/material");
16
10
  const cronText_1 = __importDefault(require("./cronText"));
17
11
  const i18n_1 = __importDefault(require("../../i18n"));
18
12
  const styles = {
@@ -456,7 +450,7 @@ class SimpleCron extends react_1.default.Component {
456
450
  const settings = type === 'intervalBetween' ? this.state.intervalBetween : this.state.specific;
457
451
  return react_1.default.createElement("div", { key: "weekdays", style: { paddingLeft: 8, width: '100%', maxWidth: 600 } },
458
452
  react_1.default.createElement("h5", null, i18n_1.default.t('ra_On weekdays')),
459
- [1, 2, 3, 4, 5, 6, 0].map(day => (react_1.default.createElement(FormControlLabel_1.default, { key: WEEKDAYS[day], control: react_1.default.createElement(Checkbox_1.default, { checked: settings.weekdays.includes(day), onChange: e => {
453
+ [1, 2, 3, 4, 5, 6, 0].map(day => react_1.default.createElement(material_1.FormControlLabel, { key: WEEKDAYS[day], control: react_1.default.createElement(material_1.Checkbox, { checked: settings.weekdays.includes(day), onChange: e => {
460
454
  const _settings = JSON.parse(JSON.stringify(this.state[type]));
461
455
  const pos = _settings.weekdays.indexOf(day);
462
456
  e.target.checked && pos === -1 && _settings.weekdays.push(day);
@@ -468,14 +462,14 @@ class SimpleCron extends react_1.default.Component {
468
462
  else {
469
463
  this.setState({ specific: _settings }, () => this.recalcCron());
470
464
  }
471
- }, value: day.toString() }), label: i18n_1.default.t(WEEKDAYS[day]) }))));
465
+ }, value: day.toString() }), label: i18n_1.default.t(WEEKDAYS[day]) })));
472
466
  }
473
467
  getControlsPeriodElements(type) {
474
468
  const settings = type === 'interval' ? this.state.interval : this.state.intervalBetween;
475
469
  if (this.state.extended) {
476
470
  return react_1.default.createElement("div", { key: "period", style: { paddingLeft: 8, display: 'inline-block' } },
477
471
  react_1.default.createElement("h5", { style: { marginBottom: 5 } }, i18n_1.default.t('sc_period')),
478
- react_1.default.createElement(TextField_1.default, { variant: "standard", style: { marginTop: 0, marginBottom: 0, verticalAlign: 'bottom' }, key: "value", label: i18n_1.default.t('sc_minutes'), value: settings.minutes, onChange: e => {
472
+ react_1.default.createElement(material_1.TextField, { variant: "standard", style: { marginTop: 0, marginBottom: 0, verticalAlign: 'bottom' }, key: "value", label: i18n_1.default.t('sc_minutes'), value: settings.minutes, onChange: e => {
479
473
  const _settings = JSON.parse(JSON.stringify(this.state[type]));
480
474
  _settings.minutes = parseInt(e.target.value, 10);
481
475
  if (_settings.minutes < 1) {
@@ -488,7 +482,7 @@ class SimpleCron extends react_1.default.Component {
488
482
  this.setState({ intervalBetween: _settings }, () => this.recalcCron());
489
483
  }
490
484
  }, InputProps: { inputProps: { min: 1, max: 60 } }, type: "number", InputLabelProps: { shrink: true }, margin: "normal" }),
491
- react_1.default.createElement(TextField_1.default, { variant: "standard", style: { marginTop: 0, marginBottom: 0, verticalAlign: 'bottom' }, key: "value", label: i18n_1.default.t('sc_hours'), value: settings.hours, onChange: e => {
485
+ react_1.default.createElement(material_1.TextField, { variant: "standard", style: { marginTop: 0, marginBottom: 0, verticalAlign: 'bottom' }, key: "value", label: i18n_1.default.t('sc_hours'), value: settings.hours, onChange: e => {
492
486
  const _settings = JSON.parse(JSON.stringify(this.state[type]));
493
487
  _settings.hours = parseInt(e.target.value, 10);
494
488
  if (_settings.hours < 1) {
@@ -504,7 +498,7 @@ class SimpleCron extends react_1.default.Component {
504
498
  }
505
499
  return react_1.default.createElement("div", { key: "period", style: { paddingLeft: 8, display: 'inline-block' } },
506
500
  react_1.default.createElement("h5", { style: { marginBottom: 5 } }, i18n_1.default.t('sc_period')),
507
- react_1.default.createElement(TextField_1.default, { variant: "standard", style: { marginTop: 0, marginBottom: 0, verticalAlign: 'bottom' }, key: "value", label: i18n_1.default.t('sc_every'), value: settings.period, onChange: e => {
501
+ react_1.default.createElement(material_1.TextField, { variant: "standard", style: { marginTop: 0, marginBottom: 0, verticalAlign: 'bottom' }, key: "value", label: i18n_1.default.t('sc_every'), value: settings.period, onChange: e => {
508
502
  const _settings = JSON.parse(JSON.stringify(this.state[type]));
509
503
  _settings.period = parseInt(e.target.value, 10);
510
504
  if (_settings.period < 1) {
@@ -517,7 +511,7 @@ class SimpleCron extends react_1.default.Component {
517
511
  this.setState({ intervalBetween: _settings }, () => this.recalcCron());
518
512
  }
519
513
  }, InputProps: { inputProps: { min: 1, max: 60 } }, type: "number", InputLabelProps: { shrink: true }, margin: "normal" }),
520
- react_1.default.createElement(Select_1.default, { variant: "standard", style: { verticalAlign: 'bottom' }, value: settings.unit, onChange: e => {
514
+ react_1.default.createElement(material_1.Select, { variant: "standard", style: { verticalAlign: 'bottom' }, value: settings.unit, onChange: e => {
521
515
  const _settings = JSON.parse(JSON.stringify(this.state[type]));
522
516
  _settings.unit = e.target.value;
523
517
  if (type === 'interval') {
@@ -527,15 +521,15 @@ class SimpleCron extends react_1.default.Component {
527
521
  this.setState({ intervalBetween: _settings }, () => this.recalcCron());
528
522
  }
529
523
  } },
530
- react_1.default.createElement(MenuItem_1.default, { value: "seconds" }, i18n_1.default.t('sc_seconds')),
524
+ react_1.default.createElement(material_1.MenuItem, { value: "seconds" }, i18n_1.default.t('sc_seconds')),
531
525
  ")",
532
- react_1.default.createElement(MenuItem_1.default, { value: "minutes" }, i18n_1.default.t('sc_minutes')),
526
+ react_1.default.createElement(material_1.MenuItem, { value: "minutes" }, i18n_1.default.t('sc_minutes')),
533
527
  ")"));
534
528
  }
535
529
  getControlsTime(type) {
536
530
  const settings = type === 'once' ? this.state.once : this.state.specific;
537
- return react_1.default.createElement(FormControl_1.default, { variant: "standard", className: this.props.classes.formControl, classes: { root: this.props.classes.formControlMarginRight } },
538
- react_1.default.createElement(TextField_1.default, { variant: "standard", key: "at", label: i18n_1.default.t('sc_time'), value: settings.time, type: "time", onChange: e => {
531
+ return react_1.default.createElement(material_1.FormControl, { variant: "standard", className: this.props.classes.formControl, classes: { root: this.props.classes.formControlMarginRight } },
532
+ react_1.default.createElement(material_1.TextField, { variant: "standard", key: "at", label: i18n_1.default.t('sc_time'), value: settings.time, type: "time", onChange: e => {
539
533
  const _settings = JSON.parse(JSON.stringify(this.state[type]));
540
534
  _settings.time = e.target.value;
541
535
  if (type === 'once') {
@@ -553,8 +547,8 @@ class SimpleCron extends react_1.default.Component {
553
547
  settings.date = `${d.getDate()}.${padding(d.getMonth() + 1)}`;
554
548
  }
555
549
  // <InputLabel htmlFor="formatted-text-mask-input">{I18n.t('sc_at')}</InputLabel>
556
- return react_1.default.createElement(FormControl_1.default, { variant: "standard", className: this.props.classes.formControl },
557
- react_1.default.createElement(TextField_1.default, { variant: "standard", key: "date", label: i18n_1.default.t('sc_date'), value: settings.date, type: "text", inputProps: { className: this.props.classes.formControlPaddingTop }, onChange: e => {
550
+ return react_1.default.createElement(material_1.FormControl, { variant: "standard", className: this.props.classes.formControl },
551
+ react_1.default.createElement(material_1.TextField, { variant: "standard", key: "date", label: i18n_1.default.t('sc_date'), value: settings.date, type: "text", inputProps: { className: this.props.classes.formControlPaddingTop }, onChange: e => {
558
552
  const _settings = JSON.parse(JSON.stringify(this.state.once));
559
553
  _settings.date = e.target.value;
560
554
  this.setState({ once: _settings }, () => this.recalcCron());
@@ -574,20 +568,20 @@ class SimpleCron extends react_1.default.Component {
574
568
  this.getControlsPeriodElements('intervalBetween'),
575
569
  react_1.default.createElement("div", { key: "between", style: { paddingLeft: 8, display: 'inline-block', verticalAlign: 'top' } },
576
570
  react_1.default.createElement("h5", { style: { marginBottom: 5 } }, i18n_1.default.t('sc_hours')),
577
- react_1.default.createElement(FormControl_1.default, { variant: "standard", className: this.props.classes.formControl },
578
- react_1.default.createElement(InputLabel_1.default, { shrink: true, htmlFor: "age-label-placeholder" }, i18n_1.default.t('sc_from')),
579
- react_1.default.createElement(Select_1.default, { variant: "standard", style: { width: 100 }, value: settings.timeFrom, onChange: e => {
571
+ react_1.default.createElement(material_1.FormControl, { variant: "standard", className: this.props.classes.formControl },
572
+ react_1.default.createElement(material_1.InputLabel, { shrink: true, htmlFor: "age-label-placeholder" }, i18n_1.default.t('sc_from')),
573
+ react_1.default.createElement(material_1.Select, { variant: "standard", style: { width: 100 }, value: settings.timeFrom, onChange: e => {
580
574
  const _settings = JSON.parse(JSON.stringify(this.state.intervalBetween));
581
575
  _settings.timeFrom = parseInt(e.target.value, 10);
582
576
  this.setState({ intervalBetween: _settings }, () => this.recalcCron());
583
- } }, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23].map(hour => react_1.default.createElement(MenuItem_1.default, { key: `B_${hour}`, value: hour }, `${padding(hour)}:00`)))),
584
- react_1.default.createElement(FormControl_1.default, { variant: "standard", className: this.props.classes.formControl },
585
- react_1.default.createElement(InputLabel_1.default, { shrink: true, htmlFor: "age-label-placeholder" }, i18n_1.default.t('sc_to')),
586
- react_1.default.createElement(Select_1.default, { variant: "standard", style: { width: 100 }, value: settings.timeTo, onChange: e => {
577
+ } }, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23].map(hour => react_1.default.createElement(material_1.MenuItem, { key: `B_${hour}`, value: hour }, `${padding(hour)}:00`)))),
578
+ react_1.default.createElement(material_1.FormControl, { variant: "standard", className: this.props.classes.formControl },
579
+ react_1.default.createElement(material_1.InputLabel, { shrink: true, htmlFor: "age-label-placeholder" }, i18n_1.default.t('sc_to')),
580
+ react_1.default.createElement(material_1.Select, { variant: "standard", style: { width: 100 }, value: settings.timeTo, onChange: e => {
587
581
  const _settings = JSON.parse(JSON.stringify(this.state.intervalBetween));
588
582
  _settings.timeTo = parseInt(e.target.value, 10);
589
583
  this.setState({ intervalBetween: _settings }, () => this.recalcCron());
590
- } }, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24].map(hour => (react_1.default.createElement(MenuItem_1.default, { key: `A_${hour}`, value: hour }, `${padding(hour)}:00`)))))),
584
+ } }, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24].map(hour => react_1.default.createElement(material_1.MenuItem, { key: `A_${hour}`, value: hour }, `${padding(hour)}:00`))))),
591
585
  this.getControlsWeekdaysElements('intervalBetween'),
592
586
  ];
593
587
  }
@@ -611,16 +605,16 @@ class SimpleCron extends react_1.default.Component {
611
605
  render() {
612
606
  return react_1.default.createElement("div", { className: this.props.classes.mainDiv },
613
607
  react_1.default.createElement("div", { style: { paddingLeft: 8, width: '100%' } },
614
- react_1.default.createElement(TextField_1.default, { style: { width: '100%' }, value: this.state.cron, disabled: true })),
608
+ react_1.default.createElement(material_1.TextField, { style: { width: '100%' }, value: this.state.cron, disabled: true })),
615
609
  react_1.default.createElement("div", { style: { paddingLeft: 8, width: '100%', height: 60 } }, (0, cronText_1.default)(this.state.cron, this.props.language || 'en')),
616
610
  react_1.default.createElement("div", null,
617
- react_1.default.createElement(FormControl_1.default, { variant: "standard", style: { marginLeft: 8, marginTop: 8 }, className: this.props.classes.formControl },
618
- react_1.default.createElement(InputLabel_1.default, null, i18n_1.default.t('ra_Repeat')),
619
- react_1.default.createElement(Select_1.default, { variant: "standard", value: this.state.mode, onChange: e => this.onModeChange(e.target.value), inputProps: { name: 'mode', id: 'mode' } },
620
- react_1.default.createElement(MenuItem_1.default, { value: "once" }, i18n_1.default.t('sc_once')),
621
- react_1.default.createElement(MenuItem_1.default, { value: "interval" }, i18n_1.default.t('sc_interval')),
622
- react_1.default.createElement(MenuItem_1.default, { value: "intervalBetween" }, i18n_1.default.t('sc_intervalBetween')),
623
- react_1.default.createElement(MenuItem_1.default, { value: "specific" }, i18n_1.default.t('sc_specific'))))),
611
+ react_1.default.createElement(material_1.FormControl, { variant: "standard", style: { marginLeft: 8, marginTop: 8 }, className: this.props.classes.formControl },
612
+ react_1.default.createElement(material_1.InputLabel, null, i18n_1.default.t('ra_Repeat')),
613
+ react_1.default.createElement(material_1.Select, { variant: "standard", value: this.state.mode, onChange: e => this.onModeChange(e.target.value), inputProps: { name: 'mode', id: 'mode' } },
614
+ react_1.default.createElement(material_1.MenuItem, { value: "once" }, i18n_1.default.t('sc_once')),
615
+ react_1.default.createElement(material_1.MenuItem, { value: "interval" }, i18n_1.default.t('sc_interval')),
616
+ react_1.default.createElement(material_1.MenuItem, { value: "intervalBetween" }, i18n_1.default.t('sc_intervalBetween')),
617
+ react_1.default.createElement(material_1.MenuItem, { value: "specific" }, i18n_1.default.t('sc_specific'))))),
624
618
  this.state.mode === PERIODIC.once && this.getOnceElements(),
625
619
  this.state.mode === 'interval' && this.getIntervalElements(),
626
620
  this.state.mode === 'intervalBetween' && this.getIntervalBetweenElements(),
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * MIT License
5
5
  *
6
- **/
6
+ * */
7
7
  import React from 'react';
8
8
  interface TableResizeProps {
9
9
  name?: string;
@@ -28,7 +28,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
28
28
  *
29
29
  * MIT License
30
30
  *
31
- **/
31
+ * */
32
32
  const react_1 = __importStar(require("react"));
33
33
  const styles_1 = require("@mui/styles");
34
34
  const material_1 = require("@mui/material");
@@ -31,7 +31,7 @@ const styles = {
31
31
  };
32
32
  const TextWithIcon = (props) => {
33
33
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
34
- let value = props.value;
34
+ const value = props.value;
35
35
  let item;
36
36
  const prefix = props.removePrefix || '';
37
37
  if (typeof value === 'string') {