@iobroker/json-config 7.3.0 → 7.3.1

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.
@@ -79,7 +79,7 @@ class ConfigPassword extends ConfigGeneric {
79
79
  ? I18n.t('ra_Passwords are not equal!')
80
80
  : this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation) }));
81
81
  if (this.props.schema.repeat && !this.props.schema.readOnly) {
82
- const passwordRepeat = this.state._visible ? (React.createElement(TextField, { variant: "standard", fullWidth: true, type: "password", value: this.state._repeat, error: !!error || this.state._notEqual, disabled: !!disabled, onChange: e => this.onChangePassword(undefined, e.target.value), label: `${this.getText(this.props.schema.label)} (${I18n.t('ra_repeat')})`, slotProps: {
82
+ const passwordRepeat = !this.state._visible ? (React.createElement(TextField, { variant: "standard", fullWidth: true, type: "password", value: this.state._repeat, error: !!error || this.state._notEqual, disabled: !!disabled, onChange: e => this.onChangePassword(undefined, e.target.value), label: `${this.getText(this.props.schema.label)} (${I18n.t('ra_repeat')})`, slotProps: {
83
83
  input: {
84
84
  autoComplete: 'new-password',
85
85
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigPassword.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigPassword.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,cAAc;KAC1B;IACD,UAAU,EAAE;QACR,KAAK,EAAE,iBAAiB;QACxB,OAAO,EAAE,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C;oBACvC,CAAC,CAAC,IAAI,CAAC,UAAU,CACX,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,GAEb,CACL,CAAC,CAAC,CAAC,IAAI,CAAC;YAET,OAAO,CACH,6BAAK,KAAK,EAAE,MAAM,CAAC,SAAS;gBACxB,6BAAK,KAAK,EAAE,MAAM,CAAC,UAAU,IAAG,QAAQ,CAAO;gBAC/C,6BAAK,KAAK,EAAE,MAAM,CAAC,UAAU,IAAG,cAAc,CAAO,CACnD,CACT,CAAC;SACL;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAED,eAAe,cAAc,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, IconButton, InputAdornment } from '@mui/material';\n\nimport { Visibility, VisibilityOff } from '@mui/icons-material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemPassword } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n fullWidth: {\n width: '100%',\n display: 'inline-block',\n },\n halfWidth1: {\n width: 'calc(50% - 5px)',\n display: 'inline-block',\n marginRight: 8,\n },\n halfWidth2: {\n width: 'calc(50% - 5px)',\n display: 'inline-block',\n },\n};\n\nconst PASSWORD_PLACEHOLDER = '____ppp____';\n\ninterface ConfigPasswordProps extends ConfigGenericProps {\n schema: ConfigItemPassword;\n}\n\ninterface ConfigPasswordState extends ConfigGenericState {\n _notEqual?: boolean;\n _repeat?: string;\n _visible?: boolean;\n}\n\nclass ConfigPassword extends ConfigGeneric<ConfigPasswordProps, ConfigPasswordState> {\n componentDidMount(): void {\n super.componentDidMount();\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n this.setState({\n _repeat: value ? PASSWORD_PLACEHOLDER : '',\n _visible: false,\n value: value ? PASSWORD_PLACEHOLDER : '',\n _notEqual: false,\n });\n }\n\n onChangePassword(password?: string, repeatPassword?: string): void {\n if (password === undefined) {\n password = this.state.value;\n }\n if (repeatPassword === undefined) {\n repeatPassword = this.state._repeat;\n }\n const _notEqual = !!this.props.schema.repeat && repeatPassword !== password;\n this.setState({ value: password, _repeat: repeatPassword, _notEqual }, () => {\n if (_notEqual) {\n this.onError(this.props.attr, I18n.t('ra_Passwords are not equal!'));\n } else {\n this.onError(this.props.attr); // clear error\n const mayBePromise = this.onChange(this.props.attr, password);\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => this.onError(this.props.attr, e));\n }\n }\n });\n }\n\n renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n if (this.state._notEqual === undefined) {\n return null;\n }\n\n const password = (\n <TextField\n variant=\"standard\"\n fullWidth\n type={this.state._visible && this.state.value !== PASSWORD_PLACEHOLDER ? 'text' : 'password'}\n value={this.state.value}\n error={!!error || this.state._notEqual}\n disabled={!!disabled}\n onChange={e => this.onChangePassword(e.target.value)}\n label={this.getText(this.props.schema.label)}\n slotProps={{\n input: {\n autoComplete: 'new-password',\n endAdornment:\n this.state.value &&\n this.state.value !== PASSWORD_PLACEHOLDER &&\n this.props.schema.visible &&\n !disabled &&\n !this.props.schema.readOnly ? (\n <InputAdornment position=\"end\">\n <IconButton\n size=\"large\"\n tabIndex={-1}\n onClick={e => {\n e.preventDefault();\n e.stopPropagation();\n this.setState({ _visible: !this.state._visible });\n }}\n edge=\"end\"\n >\n {this.state._visible ? <VisibilityOff /> : <Visibility />}\n </IconButton>\n </InputAdornment>\n ) : undefined,\n },\n htmlInput: {\n autoComplete: 'new-password',\n form: { autoComplete: 'off' },\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n readOnly: this.props.schema.readOnly || false,\n },\n }}\n helperText={\n this.state._notEqual\n ? I18n.t('ra_Passwords are not equal!')\n : this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )\n }\n />\n );\n\n if (this.props.schema.repeat && !this.props.schema.readOnly) {\n const passwordRepeat = this.state._visible ? (\n <TextField\n variant=\"standard\"\n fullWidth\n type=\"password\"\n value={this.state._repeat}\n error={!!error || this.state._notEqual}\n disabled={!!disabled}\n onChange={e => this.onChangePassword(undefined, e.target.value)}\n label={`${this.getText(this.props.schema.label)} (${I18n.t('ra_repeat')})`}\n slotProps={{\n input: {\n autoComplete: 'new-password',\n },\n htmlInput: {\n autoComplete: 'new-password',\n form: { autoComplete: 'off' },\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n },\n }}\n helperText={\n this.state._notEqual\n ? I18n.t('ra_Passwords are not equal!')\n : this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )\n }\n />\n ) : null;\n\n return (\n <div style={styles.fullWidth}>\n <div style={styles.halfWidth1}>{password}</div>\n <div style={styles.halfWidth2}>{passwordRepeat}</div>\n </div>\n );\n }\n return password;\n }\n}\n\nexport default ConfigPassword;\n"]}
1
+ {"version":3,"file":"ConfigPassword.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigPassword.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,cAAc;KAC1B;IACD,UAAU,EAAE;QACR,KAAK,EAAE,iBAAiB;QACxB,OAAO,EAAE,cAAc;QACvB,WAAW,EAAE,CAAC;KACjB;IACD,UAAU,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CACX,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,GAEb,CACL,CAAC,CAAC,CAAC,IAAI,CAAC;YAET,OAAO,CACH,6BAAK,KAAK,EAAE,MAAM,CAAC,SAAS;gBACxB,6BAAK,KAAK,EAAE,MAAM,CAAC,UAAU,IAAG,QAAQ,CAAO;gBAC/C,6BAAK,KAAK,EAAE,MAAM,CAAC,UAAU,IAAG,cAAc,CAAO,CACnD,CACT,CAAC;SACL;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAED,eAAe,cAAc,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, IconButton, InputAdornment } from '@mui/material';\n\nimport { Visibility, VisibilityOff } from '@mui/icons-material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemPassword } from '#JC/types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n fullWidth: {\n width: '100%',\n display: 'inline-block',\n },\n halfWidth1: {\n width: 'calc(50% - 5px)',\n display: 'inline-block',\n marginRight: 8,\n },\n halfWidth2: {\n width: 'calc(50% - 5px)',\n display: 'inline-block',\n },\n};\n\nconst PASSWORD_PLACEHOLDER = '____ppp____';\n\ninterface ConfigPasswordProps extends ConfigGenericProps {\n schema: ConfigItemPassword;\n}\n\ninterface ConfigPasswordState extends ConfigGenericState {\n _notEqual?: boolean;\n _repeat?: string;\n _visible?: boolean;\n}\n\nclass ConfigPassword extends ConfigGeneric<ConfigPasswordProps, ConfigPasswordState> {\n componentDidMount(): void {\n super.componentDidMount();\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n this.setState({\n _repeat: value ? PASSWORD_PLACEHOLDER : '',\n _visible: false,\n value: value ? PASSWORD_PLACEHOLDER : '',\n _notEqual: false,\n });\n }\n\n onChangePassword(password?: string, repeatPassword?: string): void {\n if (password === undefined) {\n password = this.state.value;\n }\n if (repeatPassword === undefined) {\n repeatPassword = this.state._repeat;\n }\n const _notEqual = !!this.props.schema.repeat && repeatPassword !== password;\n this.setState({ value: password, _repeat: repeatPassword, _notEqual }, () => {\n if (_notEqual) {\n this.onError(this.props.attr, I18n.t('ra_Passwords are not equal!'));\n } else {\n this.onError(this.props.attr); // clear error\n const mayBePromise = this.onChange(this.props.attr, password);\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => this.onError(this.props.attr, e));\n }\n }\n });\n }\n\n renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n if (this.state._notEqual === undefined) {\n return null;\n }\n\n const password = (\n <TextField\n variant=\"standard\"\n fullWidth\n type={this.state._visible && this.state.value !== PASSWORD_PLACEHOLDER ? 'text' : 'password'}\n value={this.state.value}\n error={!!error || this.state._notEqual}\n disabled={!!disabled}\n onChange={e => this.onChangePassword(e.target.value)}\n label={this.getText(this.props.schema.label)}\n slotProps={{\n input: {\n autoComplete: 'new-password',\n endAdornment:\n this.state.value &&\n this.state.value !== PASSWORD_PLACEHOLDER &&\n this.props.schema.visible &&\n !disabled &&\n !this.props.schema.readOnly ? (\n <InputAdornment position=\"end\">\n <IconButton\n size=\"large\"\n tabIndex={-1}\n onClick={e => {\n e.preventDefault();\n e.stopPropagation();\n this.setState({ _visible: !this.state._visible });\n }}\n edge=\"end\"\n >\n {this.state._visible ? <VisibilityOff /> : <Visibility />}\n </IconButton>\n </InputAdornment>\n ) : undefined,\n },\n htmlInput: {\n autoComplete: 'new-password',\n form: { autoComplete: 'off' },\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n readOnly: this.props.schema.readOnly || false,\n },\n }}\n helperText={\n this.state._notEqual\n ? I18n.t('ra_Passwords are not equal!')\n : this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )\n }\n />\n );\n\n if (this.props.schema.repeat && !this.props.schema.readOnly) {\n const passwordRepeat = !this.state._visible ? (\n <TextField\n variant=\"standard\"\n fullWidth\n type=\"password\"\n value={this.state._repeat}\n error={!!error || this.state._notEqual}\n disabled={!!disabled}\n onChange={e => this.onChangePassword(undefined, e.target.value)}\n label={`${this.getText(this.props.schema.label)} (${I18n.t('ra_repeat')})`}\n slotProps={{\n input: {\n autoComplete: 'new-password',\n },\n htmlInput: {\n autoComplete: 'new-password',\n form: { autoComplete: 'off' },\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n },\n }}\n helperText={\n this.state._notEqual\n ? I18n.t('ra_Passwords are not equal!')\n : this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )\n }\n />\n ) : null;\n\n return (\n <div style={styles.fullWidth}>\n <div style={styles.halfWidth1}>{password}</div>\n <div style={styles.halfWidth2}>{passwordRepeat}</div>\n </div>\n );\n }\n return password;\n }\n}\n\nexport default ConfigPassword;\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iobroker/json-config",
3
3
  "description": "This package contains the ioBroker JSON config UI components",
4
- "version": "7.3.0",
4
+ "version": "7.3.1",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
7
7
  "scripts": {
@@ -16,7 +16,7 @@
16
16
  "access": "public"
17
17
  },
18
18
  "dependencies": {
19
- "@iobroker/adapter-react-v5": "7.3.0",
19
+ "@iobroker/adapter-react-v5": "7.3.1",
20
20
  "@mui/x-date-pickers": "^7.22.0",
21
21
  "crypto-js": "^4.2.0",
22
22
  "react-ace": "^12.0.0",
@@ -31,5 +31,5 @@
31
31
  "build/",
32
32
  "LICENSE"
33
33
  ],
34
- "gitHead": "03429207817dd73c3271dabeabcafe71a0a595a7"
34
+ "gitHead": "f0de8ec7e949b78a2ac4c398a04df22b2b106463"
35
35
  }