@iobroker/json-config 8.4.15 → 8.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/build/JsonConfig.d.ts +3 -3
- package/build/JsonConfig.js +11 -7
- package/build/JsonConfig.js.map +1 -1
- package/build/JsonConfigComponent/ChipInput.js +3 -3
- package/build/JsonConfigComponent/ChipInput.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAccordion.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigAccordion.js +28 -18
- package/build/JsonConfigComponent/ConfigAccordion.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAlive.js +8 -4
- package/build/JsonConfigComponent/ConfigAlive.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocomplete.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigAutocomplete.js +6 -6
- package/build/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js +5 -5
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCRON.d.ts +1 -0
- package/build/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertCollection.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigCertCollection.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertificateSelect.d.ts +1 -0
- package/build/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertificates.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigCertificates.js +1 -1
- package/build/JsonConfigComponent/ConfigCertificates.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCheckDocker.js +4 -2
- package/build/JsonConfigComponent/ConfigCheckDocker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCheckLicense.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigCheckLicense.js +14 -11
- package/build/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCheckbox.js +12 -10
- package/build/JsonConfigComponent/ConfigCheckbox.js.map +1 -1
- package/build/JsonConfigComponent/ConfigChip.js +22 -18
- package/build/JsonConfigComponent/ConfigChip.js.map +1 -1
- package/build/JsonConfigComponent/ConfigColor.js +5 -8
- package/build/JsonConfigComponent/ConfigColor.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCoordinates.js +1 -1
- package/build/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCredentialSelect.d.ts +2 -0
- package/build/JsonConfigComponent/ConfigCredentialSelect.js +3 -0
- package/build/JsonConfigComponent/ConfigCredentialSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCustom.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigCustom.js +1 -1
- package/build/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/build/JsonConfigComponent/ConfigDatePicker.js +4 -2
- package/build/JsonConfigComponent/ConfigDatePicker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFile.js +4 -2
- package/build/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFileSelector.d.ts +3 -2
- package/build/JsonConfigComponent/ConfigFileSelector.js +10 -8
- package/build/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFunc.js +1 -1
- package/build/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/build/JsonConfigComponent/ConfigGeneric.d.ts +16 -13
- package/build/JsonConfigComponent/ConfigGeneric.js +68 -46
- package/build/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIFrameSendTo.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigIFrameSendTo.js +1 -3
- package/build/JsonConfigComponent/ConfigIFrameSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIP.js +4 -1
- package/build/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageSendTo.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigImageSendTo.js +1 -3
- package/build/JsonConfigComponent/ConfigImageSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageUpload.js +26 -22
- package/build/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/build/JsonConfigComponent/ConfigInstanceSelect.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigInstanceSelect.js +5 -5
- package/build/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigInterface.js +16 -12
- package/build/JsonConfigComponent/ConfigInterface.js.map +1 -1
- package/build/JsonConfigComponent/ConfigJsonEditor.js +1 -1
- package/build/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/build/JsonConfigComponent/ConfigLanguage.js +7 -9
- package/build/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/build/JsonConfigComponent/ConfigLicense.js +5 -3
- package/build/JsonConfigComponent/ConfigLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigNumber.js +7 -5
- package/build/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/build/JsonConfigComponent/ConfigOAuth2.js +2 -2
- package/build/JsonConfigComponent/ConfigOAuth2.js.map +1 -1
- package/build/JsonConfigComponent/ConfigObjectId.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigObjectId.js +12 -10
- package/build/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPanel.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigPanel.js +5 -4
- package/build/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPassword.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigPassword.js.map +1 -1
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.js +1 -3
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigRoom.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelect.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigSelect.js +4 -4
- package/build/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.js +14 -16
- package/build/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSendto.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigSendto.js +6 -5
- package/build/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSetState.js +4 -1
- package/build/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigState.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigState.js +33 -22
- package/build/JsonConfigComponent/ConfigState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticImage.js +1 -1
- package/build/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticInfo.js +2 -2
- package/build/JsonConfigComponent/ConfigStaticInfo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticText.js +2 -2
- package/build/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTable.d.ts +4 -4
- package/build/JsonConfigComponent/ConfigTable.js +80 -75
- package/build/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTabs.d.ts +7 -7
- package/build/JsonConfigComponent/ConfigTabs.js +61 -57
- package/build/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/build/JsonConfigComponent/ConfigText.js +6 -6
- package/build/JsonConfigComponent/ConfigText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.js +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTimePicker.js +2 -5
- package/build/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigUUID.js +1 -1
- package/build/JsonConfigComponent/ConfigUUID.js.map +1 -1
- package/build/JsonConfigComponent/ConfigUser.js +2 -2
- package/build/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/build/JsonConfigComponent/ConfigYamlEditor.js +2 -2
- package/build/JsonConfigComponent/ConfigYamlEditor.js.map +1 -1
- package/build/JsonConfigComponent/Icons.d.ts +1 -1
- package/build/JsonConfigComponent/Icons.js.map +1 -1
- package/build/JsonConfigComponent/index.d.ts +4 -4
- package/build/JsonConfigComponent/index.js +21 -16
- package/build/JsonConfigComponent/index.js.map +1 -1
- package/build/JsonConfigComponent/wrapper/Components/CustomModal.d.ts +2 -3
- package/build/JsonConfigComponent/wrapper/Components/CustomModal.js +2 -7
- package/build/JsonConfigComponent/wrapper/Components/CustomModal.js.map +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigStaticInfo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigStaticInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAiB,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAG9E,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,SAAS,cAAc,CAAC,KAAe,EAAE,KAAc,EAAE,KAAwB;IAC7E,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO;YACH,uCAAuC,EAAE;gBACrC,IAAI,EAAE;oBACF,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK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AAC,UAAU,GAAG,KAAK,CAAC;QAChC,CAAC;QAED,OAAO,CACH,oBAAC,GAAG,IACA,SAAS,EAAC,KAAK,EACf,KAAK,EAAE,QAAQ,EACf,EAAE,EAAE,QAAQ;YAEZ,6BAAK,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,IAAI,SAAS,CAAC,EAAE;gBAC1E,SAAS;gBACT,KAAK,CACJ;YACL,KAAK;YACL,UAAU,CACT,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Box, Checkbox } from '@mui/material';\nimport { ContentCopy } from '@mui/icons-material';\nimport { I18n, Icon, type IobTheme, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemStaticInfo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nfunction valueBlinkOnce(theme: IobTheme, force: boolean, color?: string | boolean): any {\n if (typeof color === 'string') {\n return {\n '@keyframes newValueAnimationOnceColor': {\n '0%': {\n color: force ? `${color} !important` : color,\n },\n '100%': {\n color:\n theme.palette.mode === 'dark'\n ? force\n ? '#fff !important'\n : '#fff'\n : force\n ? '#000 !important'\n : '#000',\n },\n },\n animation: 'newValueAnimationOnceColor 2s ease-in-out',\n };\n }\n return {\n '@keyframes newValueAnimationOnce': {\n '0%': {\n color: force ? `#00f900 !important` : '#00f900',\n },\n '80%': {\n color:\n theme.palette.mode === 'dark'\n ? force\n ? `#518851 !important`\n : '#518851'\n : force\n ? `#008000 !important`\n : '#008000',\n },\n '100%': {\n color:\n theme.palette.mode === 'dark'\n ? force\n ? '#fff !important'\n : '#fff'\n : force\n ? '#000 !important'\n : '#000',\n },\n },\n animation: 'newValueAnimationOnce 2s ease-in-out',\n };\n}\n\nfunction valueBlink(theme: IobTheme, color?: string | boolean): any {\n if (typeof color === 'string') {\n return {\n '@keyframes blinkAnimationColor': {\n '0%': {\n color,\n },\n '100%': {\n color: theme.palette.mode === 'dark' ? '#fff' : '#000',\n },\n },\n animation: 'blinkAnimationColor 2s ease-in-out infinite',\n };\n }\n return {\n '@keyframes blinkAnimation': {\n '0%': {\n color: '#00f900',\n },\n '80%': {\n color: theme.palette.mode === 'dark' ? '#518851' : '#008000',\n },\n '100%': {\n color: theme.palette.mode === 'dark' ? '#fff' : '#000',\n },\n },\n animation: 'blinkAnimation 2s ease-in-out infinite',\n };\n}\n\nconst styles: Record<string, any> = {\n label: {\n fontWeight: 'bold',\n whiteSpace: 'nowrap',\n },\n valueImage: {\n maxHeight: '100%',\n },\n valueAndUnit: {\n display: 'flex',\n gap: 4,\n alignItems: 'baseline',\n },\n value: {},\n unit: {\n fontSize: 'smaller',\n opacity: 0.7,\n },\n};\n\ninterface ConfigStaticInfoProps extends ConfigGenericProps {\n schema: ConfigItemStaticInfo;\n}\n\nclass ConfigStaticInfo extends ConfigGeneric<ConfigStaticInfoProps, ConfigGenericState> {\n renderItem(_error: string): JSX.Element {\n let label: string | JSX.Element | JSX.Element[] = this.getText(\n this.props.schema.text || this.props.schema.label,\n this.props.schema.noTranslation,\n );\n if (this.props.schema.addColon && typeof label === 'string' && !label.trim().endsWith(':')) {\n label = `${label.trim()}:`;\n }\n\n if (\n label &&\n (label.includes('<a ') || label.includes('<br') || label.includes('<b>') || label.includes('<i>'))\n ) {\n label = Utils.renderTextWithA(label);\n }\n let fontSize: number | undefined;\n if (this.props.schema.size === 'normal') {\n fontSize = 16;\n } else if (this.props.schema.size === 'large') {\n fontSize = 20;\n } else if (typeof this.props.schema.size === 'number') {\n fontSize = this.props.schema.size;\n }\n\n const divStyle: React.CSSProperties = {\n width: '100%',\n height: '100%',\n display: 'flex',\n alignItems: 'center',\n position: 'relative',\n fontSize,\n };\n\n if (this.props.schema.narrow) {\n divStyle.gap = 8;\n } else {\n divStyle.justifyContent = 'space-between';\n }\n\n let value: React.JSX.Element;\n let valueTxt: string;\n if (this.props.schema.data && typeof this.props.schema.data === 'object' && this.props.schema.data.en) {\n valueTxt = this.getText(this.props.schema.data);\n } else if (\n typeof this.props.schema.data === 'object' ||\n this.props.schema.data === undefined ||\n this.props.schema.data === null\n ) {\n valueTxt = JSON.stringify(this.props.schema.data);\n } else if (typeof this.props.schema.data === 'number') {\n valueTxt = this.props.schema.data.toString();\n if (this.props.oContext.isFloatComma) {\n valueTxt = valueTxt.replace('.', ',');\n }\n } else if (!this.props.schema.booleanAsCheckbox || typeof this.props.schema.data !== 'boolean') {\n valueTxt = this.props.schema.data.toString();\n }\n let multiLine = false;\n\n if (this.props.schema.booleanAsCheckbox && typeof this.props.schema.data === 'boolean') {\n value = (\n <Checkbox\n checked={!!value}\n disabled\n size={\n this.props.schema.size === 'small'\n ? 'small'\n : this.props.schema.size === 'large'\n ? 'large'\n : undefined\n }\n />\n );\n } else if (valueTxt.startsWith('data:image/')) {\n value = (\n <div style={{ ...styles.value, ...styles.valueImage, ...(this.props.schema.styleValue || undefined) }}>\n <Icon src={valueTxt} />\n </div>\n );\n } else {\n const valStyle: React.CSSProperties = { ...styles.value, ...(this.props.schema.styleValue || undefined) };\n if (this.props.schema.html) {\n value = (\n <div\n style={valStyle}\n dangerouslySetInnerHTML={{ __html: valueTxt }}\n />\n );\n } else {\n if (Array.isArray(this.props.schema.data)) {\n multiLine = true;\n value = (\n <div style={valStyle}>\n {this.props.schema.data.map((it, i) => (\n <div key={i}>\n {typeof it === 'object' || it === null || it === undefined\n ? JSON.stringify(it)\n : it}\n </div>\n ))}\n </div>\n );\n } else {\n if (valueTxt.includes('\\n')) {\n multiLine = true;\n value = <div style={valStyle}>{Utils.renderTextWithA(valueTxt)}</div>;\n } else {\n value = <div style={valStyle}>{valueTxt}</div>;\n }\n }\n }\n }\n\n if (this.props.schema.blinkOnUpdate && this.props.schema.blink) {\n const style1 = valueBlinkOnce(this.props.oContext.theme, true, this.props.schema.blinkOnUpdate);\n const style2 = valueBlink(this.props.oContext.theme, this.props.schema.blink);\n value = (\n <Box\n key={valueTxt}\n sx={{ ...style1, ...style2 }}\n >\n {value}\n </Box>\n );\n } else if (this.props.schema.blinkOnUpdate) {\n const style = valueBlinkOnce(this.props.oContext.theme, false, this.props.schema.blinkOnUpdate);\n value = (\n <Box\n key={valueTxt}\n sx={style}\n >\n {value}\n </Box>\n );\n } else if (this.props.schema.blink) {\n const style = valueBlink(this.props.oContext.theme, this.props.schema.blink);\n value = <Box sx={style}>{value}</Box>;\n }\n\n if (this.props.schema.unit) {\n value = (\n <div style={styles.valueAndUnit}>\n {value}\n <div style={{ ...styles.unit, ...(this.props.schema.styleUnit || undefined) }}>\n {this.getText(this.props.schema.unit, this.props.schema.noTranslation)}\n </div>\n </div>\n );\n }\n\n let labelIcon: React.JSX.Element | undefined;\n if (this.props.schema.labelIcon) {\n labelIcon = (\n <Icon\n src={this.props.schema.labelIcon}\n style={{ marginRight: 4 }}\n />\n );\n }\n let copyButton: React.JSX.Element | undefined;\n if (this.props.schema.copyToClipboard) {\n copyButton = (\n <ContentCopy\n className=\"staticCopyButton\"\n style={{\n position: 'absolute',\n top: 'calc(50% - 12px)',\n right: 0,\n cursor: 'pointer',\n }}\n onClick={() => {\n Utils.copyToClipboard(valueTxt);\n window.alert(I18n.t('jc_Copied'));\n }}\n />\n );\n }\n\n const boxStyle: Record<string, any> = {\n '& .staticCopyButton': {\n display: 'none',\n },\n '& .staticCopyButton:action': {\n transform: 'scale(0.9)',\n },\n '&:hover .staticCopyButton': {\n display: 'block',\n },\n };\n if (this.props.schema.highlight) {\n boxStyle['&:hover'] = {\n backgroundColor: this.props.oContext.themeType === 'dark' ? '#51515180' : '#b8b8b880',\n };\n }\n if (multiLine) {\n divStyle.alignItems = 'top';\n }\n\n return (\n <Box\n component=\"div\"\n style={divStyle}\n sx={boxStyle}\n >\n <div style={{ ...styles.label, ...(this.props.schema.styleLabel || undefined) }}>\n {labelIcon}\n {label}\n </div>\n {value}\n {copyButton}\n </Box>\n );\n }\n}\n\nexport default ConfigStaticInfo;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigStaticInfo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigStaticInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAiB,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAG9E,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,SAAS,cAAc,CAAC,KAAe,EAAE,KAAc,EAAE,KAAwB;IAC7E,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO;YACH,uCAAuC,EAAE;gBACrC,IAAI,EAAE;oBACF,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK;iBAC/C;gBACD,MAAM,EAAE;oBACJ,KAAK,EACD,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM;wBACzB,CAAC,CAAC,KAAK;4BACH,CAAC,CAAC,iBAAiB;4BACnB,CAAC,CAAC,MAAM;wBACZ,CAAC,CAAC,KAAK;4BACL,CAAC,CAAC,iBAAiB;4BACnB,CAAC,CAAC,MAAM;iBACrB;aACJ;YACD,SAAS,EAAE,2CAA2C;SACzD,CAAC;IACN,CAAC;IACD,OAAO;QACH,kCAAkC,EAAE;YAChC,IAAI,EAAE;gBACF,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS;aAClD;YACD,KAAK,EAAE;gBACH,KAAK,EACD,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM;oBACzB,CAAC,CAAC,KAAK;wBACH,CAAC,CAAC,oBAAoB;wBACtB,CAAC,C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BACtC,CAAC,GACH,CACL,CAAC;QACN,CAAC;QAED,MAAM,QAAQ,GAAwB;YAClC,qBAAqB,EAAE;gBACnB,OAAO,EAAE,MAAM;aAClB;YACD,4BAA4B,EAAE;gBAC1B,SAAS,EAAE,YAAY;aAC1B;YACD,2BAA2B,EAAE;gBACzB,OAAO,EAAE,OAAO;aACnB;SACJ,CAAC;QACF,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAC9B,QAAQ,CAAC,SAAS,CAAC,GAAG;gBAClB,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW;aACxF,CAAC;QACN,CAAC;QACD,IAAI,SAAS,EAAE,CAAC;YACZ,QAAQ,CAAC,UAAU,GAAG,KAAK,CAAC;QAChC,CAAC;QAED,OAAO,CACH,oBAAC,GAAG,IACA,SAAS,EAAC,KAAK,EACf,KAAK,EAAE,QAAQ,EACf,EAAE,EAAE,QAAQ;YAEZ,6BAAK,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,IAAI,SAAS,CAAC,EAAE;gBAC1E,SAAS;gBACT,KAAK,CACJ;YACL,KAAK;YACL,UAAU,CACT,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Box, Checkbox } from '@mui/material';\nimport { ContentCopy } from '@mui/icons-material';\nimport { I18n, Icon, type IobTheme, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemStaticInfo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nfunction valueBlinkOnce(theme: IobTheme, force: boolean, color?: string | boolean): any {\n if (typeof color === 'string') {\n return {\n '@keyframes newValueAnimationOnceColor': {\n '0%': {\n color: force ? `${color} !important` : color,\n },\n '100%': {\n color:\n theme.palette.mode === 'dark'\n ? force\n ? '#fff !important'\n : '#fff'\n : force\n ? '#000 !important'\n : '#000',\n },\n },\n animation: 'newValueAnimationOnceColor 2s ease-in-out',\n };\n }\n return {\n '@keyframes newValueAnimationOnce': {\n '0%': {\n color: force ? `#00f900 !important` : '#00f900',\n },\n '80%': {\n color:\n theme.palette.mode === 'dark'\n ? force\n ? `#518851 !important`\n : '#518851'\n : force\n ? `#008000 !important`\n : '#008000',\n },\n '100%': {\n color:\n theme.palette.mode === 'dark'\n ? force\n ? '#fff !important'\n : '#fff'\n : force\n ? '#000 !important'\n : '#000',\n },\n },\n animation: 'newValueAnimationOnce 2s ease-in-out',\n };\n}\n\nfunction valueBlink(theme: IobTheme, color?: string | boolean): any {\n if (typeof color === 'string') {\n return {\n '@keyframes blinkAnimationColor': {\n '0%': {\n color,\n },\n '100%': {\n color: theme.palette.mode === 'dark' ? '#fff' : '#000',\n },\n },\n animation: 'blinkAnimationColor 2s ease-in-out infinite',\n };\n }\n return {\n '@keyframes blinkAnimation': {\n '0%': {\n color: '#00f900',\n },\n '80%': {\n color: theme.palette.mode === 'dark' ? '#518851' : '#008000',\n },\n '100%': {\n color: theme.palette.mode === 'dark' ? '#fff' : '#000',\n },\n },\n animation: 'blinkAnimation 2s ease-in-out infinite',\n };\n}\n\nconst styles: Record<string, any> = {\n label: {\n fontWeight: 'bold',\n whiteSpace: 'nowrap',\n },\n valueImage: {\n maxHeight: '100%',\n },\n valueAndUnit: {\n display: 'flex',\n gap: 4,\n alignItems: 'baseline',\n },\n value: {},\n unit: {\n fontSize: 'smaller',\n opacity: 0.7,\n },\n};\n\ninterface ConfigStaticInfoProps extends ConfigGenericProps {\n schema: ConfigItemStaticInfo;\n}\n\nclass ConfigStaticInfo extends ConfigGeneric<ConfigStaticInfoProps, ConfigGenericState> {\n renderItem(_error: string): JSX.Element {\n let label: string | JSX.Element | JSX.Element[] = this.getText(\n this.props.schema.text || this.props.schema.label,\n this.props.schema.noTranslation,\n );\n if (this.props.schema.addColon && typeof label === 'string' && !label.trim().endsWith(':')) {\n label = `${label.trim()}:`;\n }\n\n if (\n label &&\n (label.includes('<a ') || label.includes('<br') || label.includes('<b>') || label.includes('<i>'))\n ) {\n label = Utils.renderTextWithA(label);\n }\n let fontSize: number | undefined;\n if (this.props.schema.size === 'normal') {\n fontSize = 16;\n } else if (this.props.schema.size === 'large') {\n fontSize = 20;\n } else if (typeof this.props.schema.size === 'number') {\n fontSize = this.props.schema.size;\n }\n\n const divStyle: React.CSSProperties = {\n width: '100%',\n height: '100%',\n display: 'flex',\n alignItems: 'center',\n position: 'relative',\n fontSize,\n };\n\n if (this.props.schema.narrow) {\n divStyle.gap = 8;\n } else {\n divStyle.justifyContent = 'space-between';\n }\n\n let value: React.JSX.Element;\n let valueTxt: string;\n if (this.props.schema.data && typeof this.props.schema.data === 'object' && this.props.schema.data.en) {\n valueTxt = this.getText(this.props.schema.data);\n } else if (\n typeof this.props.schema.data === 'object' ||\n this.props.schema.data === undefined ||\n this.props.schema.data === null\n ) {\n valueTxt = JSON.stringify(this.props.schema.data);\n } else if (typeof this.props.schema.data === 'number') {\n valueTxt = this.props.schema.data.toString();\n if (this.props.oContext.isFloatComma) {\n valueTxt = valueTxt.replace('.', ',');\n }\n } else {\n valueTxt = this.props.schema.data.toString();\n }\n let multiLine = false;\n\n if (this.props.schema.booleanAsCheckbox && typeof this.props.schema.data === 'boolean') {\n value = (\n <Checkbox\n checked={this.props.schema.data}\n disabled\n size={\n this.props.schema.size === 'small'\n ? 'small'\n : this.props.schema.size === 'large'\n ? 'large'\n : undefined\n }\n />\n );\n } else if (valueTxt.startsWith('data:image/')) {\n value = (\n <div style={{ ...styles.value, ...styles.valueImage, ...(this.props.schema.styleValue || undefined) }}>\n <Icon src={valueTxt} />\n </div>\n );\n } else {\n const valStyle: React.CSSProperties = { ...styles.value, ...(this.props.schema.styleValue || undefined) };\n if (this.props.schema.html) {\n value = (\n <div\n style={valStyle}\n dangerouslySetInnerHTML={{ __html: valueTxt }}\n />\n );\n } else {\n if (Array.isArray(this.props.schema.data)) {\n multiLine = true;\n value = (\n <div style={valStyle}>\n {this.props.schema.data.map((it, i) => (\n <div key={i}>\n {typeof it === 'object' || it === null || it === undefined\n ? JSON.stringify(it)\n : it}\n </div>\n ))}\n </div>\n );\n } else {\n if (valueTxt.includes('\\n')) {\n multiLine = true;\n value = <div style={valStyle}>{Utils.renderTextWithA(valueTxt)}</div>;\n } else {\n value = <div style={valStyle}>{valueTxt}</div>;\n }\n }\n }\n }\n\n if (this.props.schema.blinkOnUpdate && this.props.schema.blink) {\n const style1 = valueBlinkOnce(this.props.oContext.theme, true, this.props.schema.blinkOnUpdate);\n const style2 = valueBlink(this.props.oContext.theme, this.props.schema.blink);\n value = (\n <Box\n key={valueTxt}\n sx={{ ...style1, ...style2 }}\n >\n {value}\n </Box>\n );\n } else if (this.props.schema.blinkOnUpdate) {\n const style = valueBlinkOnce(this.props.oContext.theme, false, this.props.schema.blinkOnUpdate);\n value = (\n <Box\n key={valueTxt}\n sx={style}\n >\n {value}\n </Box>\n );\n } else if (this.props.schema.blink) {\n const style = valueBlink(this.props.oContext.theme, this.props.schema.blink);\n value = <Box sx={style}>{value}</Box>;\n }\n\n if (this.props.schema.unit) {\n value = (\n <div style={styles.valueAndUnit}>\n {value}\n <div style={{ ...styles.unit, ...(this.props.schema.styleUnit || undefined) }}>\n {this.getText(this.props.schema.unit, this.props.schema.noTranslation)}\n </div>\n </div>\n );\n }\n\n let labelIcon: React.JSX.Element | undefined;\n if (this.props.schema.labelIcon) {\n labelIcon = (\n <Icon\n src={this.props.schema.labelIcon}\n style={{ marginRight: 4 }}\n />\n );\n }\n let copyButton: React.JSX.Element | undefined;\n if (this.props.schema.copyToClipboard) {\n copyButton = (\n <ContentCopy\n className=\"staticCopyButton\"\n style={{\n position: 'absolute',\n top: 'calc(50% - 12px)',\n right: 0,\n cursor: 'pointer',\n }}\n onClick={() => {\n Utils.copyToClipboard(valueTxt);\n window.alert(I18n.t('jc_Copied'));\n }}\n />\n );\n }\n\n const boxStyle: Record<string, any> = {\n '& .staticCopyButton': {\n display: 'none',\n },\n '& .staticCopyButton:action': {\n transform: 'scale(0.9)',\n },\n '&:hover .staticCopyButton': {\n display: 'block',\n },\n };\n if (this.props.schema.highlight) {\n boxStyle['&:hover'] = {\n backgroundColor: this.props.oContext.themeType === 'dark' ? '#51515180' : '#b8b8b880',\n };\n }\n if (multiLine) {\n divStyle.alignItems = 'top';\n }\n\n return (\n <Box\n component=\"div\"\n style={divStyle}\n sx={boxStyle}\n >\n <div style={{ ...styles.label, ...(this.props.schema.styleLabel || undefined) }}>\n {labelIcon}\n {label}\n </div>\n {value}\n {copyButton}\n </Box>\n );\n }\n}\n\nexport default ConfigStaticInfo;\n"]}
|
|
@@ -85,7 +85,7 @@ export default class ConfigStaticText extends ConfigGeneric {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
:
|
|
88
|
+
: undefined }, this.getText(this.props.schema.text || this.props.schema.label, this.props.schema.noTranslation)));
|
|
89
89
|
}
|
|
90
90
|
let text = this.getText(this.props.schema.text || this.props.schema.label, this.props.schema.noTranslation);
|
|
91
91
|
if (this.props.schema.format === 'html') {
|
|
@@ -123,7 +123,7 @@ export default class ConfigStaticText extends ConfigGeneric {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
:
|
|
126
|
+
: undefined }, text));
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
//# sourceMappingURL=ConfigStaticText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigStaticText.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigStaticText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,eAAe,CAA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CACf,GAAG,EAAE,IAAI;gCACT,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,QAAQ;gCAC5C,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;6BACjC,CAAC,CAAC;wBACP,CAAC;6BAAM,CAAC;4BACJ,MAAM,CACF,IAAI,EACJ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,QAAQ,EACpC,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CACvE,CAAC;wBACN,CAAC;oBACL,CAAC;gBACL,CAAC;gBACH,CAAC,CAAC,IAAI,IAGb,IAAI,CACH,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Box, Button } from '@mui/material';\n\nimport { type IobTheme, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemStaticText } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, any> = {\n fullWidth: {\n height: '100%',\n width: '100%',\n },\n link: (theme: IobTheme): React.CSSProperties => ({\n textDecoration: 'underline',\n color: theme.palette.mode === 'dark' ? '#4dabf5' : '#254e72',\n cursor: 'pointer',\n }),\n};\n\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\nfunction onLink(href: string, target: '_blank' | '_self' | string, instanceId: string): void {\n let _target;\n let url = '';\n if (!href) {\n url = `#tab-instances/config/${instanceId}`;\n _target = target || '_self';\n } else if (href.toString().startsWith('#')) {\n _target = target || '_self';\n url = href;\n } else if (href.toString().startsWith('/')) {\n _target = target || '_self';\n url = href;\n } else if (href.startsWith('http://') || href.startsWith('https://')) {\n _target = target || '_blank';\n url = href;\n } else {\n url = `#tab-instances/config/${instanceId}/${href}`;\n _target = target || '_self';\n }\n if (_target === '_self') {\n // close dialog\n setTimeout(\n (_url: string) => {\n if (_url.startsWith('#')) {\n window.location.hash = _url;\n } else if (_url.startsWith('/')) {\n url = `${window.location.protocol}//${window.location.host}${url}`;\n } else if (_url.startsWith('http://') || _url.startsWith('https://')) {\n window.location.href = _url;\n }\n },\n 100,\n url,\n );\n } else {\n if (url.startsWith('#')) {\n url = `${window.location.protocol}//${window.location.host}${window.location.pathname}${url}`;\n } else if (url.startsWith('/')) {\n url = `${window.location.protocol}//${window.location.host}${url}`;\n }\n\n window.open(url, _target);\n }\n}\n\ninterface ConfigStaticTextProps extends ConfigGenericProps {\n schema: ConfigItemStaticText;\n}\n\nexport default class ConfigStaticText extends ConfigGeneric<ConfigStaticTextProps, ConfigGenericState> {\n renderItem(_error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n if (this.props.schema.button) {\n const icon = this.getIcon();\n return (\n <Button\n variant={this.props.schema.variant || undefined}\n color={this.props.schema.color || 'grey'}\n style={{ ...styles.fullWidth, ...(this.props.schema.controlStyle || undefined) }}\n disabled={disabled}\n startIcon={icon}\n onClick={\n this.props.schema.href\n ? () => {\n // calculate one more time just before call\n const href = this.props.schema.href\n ? this.getText(this.props.schema.href, true)\n : null;\n if (href) {\n if (this.props.oContext.onBackEndCommand) {\n this.props.oContext.onBackEndCommand({\n command: 'link',\n url: href,\n target: this.props.schema.target,\n close: this.props.schema.close,\n });\n } else {\n onLink(\n href,\n this.props.schema.target,\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n );\n }\n }\n }\n : null\n }\n >\n {this.getText(this.props.schema.text || this.props.schema.label, this.props.schema.noTranslation)}\n </Button>\n );\n }\n let text: string | JSX.Element | JSX.Element[] = this.getText(\n this.props.schema.text || this.props.schema.label,\n this.props.schema.noTranslation,\n );\n if (this.props.schema.format === 'html') {\n text = <div dangerouslySetInnerHTML={{ __html: text }} />;\n } else if (this.props.schema.format === 'json') {\n try {\n const obj = typeof text === 'string' ? JSON.parse(text) : text;\n text = (\n <pre style={{ whiteSpace: 'pre-wrap', wordBreak: 'break-word', margin: 0 }}>\n {JSON.stringify(obj, null, 2)}\n </pre>\n );\n } catch {\n // invalid JSON — just render as text\n // fallthrough to the next block\n }\n } else if (\n text &&\n (text.includes('<a ') || text.includes('<br') || text.includes('<b>') || text.includes('<i>'))\n ) {\n text = Utils.renderTextWithA(text);\n }\n\n return (\n <Box\n component=\"span\"\n style={{ ...(this.props.schema.controlStyle || undefined) }}\n sx={this.props.schema.href ? styles.link : undefined}\n onClick={\n this.props.schema.href\n ? () => {\n // calculate one more time just before call\n const href = this.props.schema.href ? this.getText(this.props.schema.href, true) : null;\n if (href) {\n if (this.props.oContext.onBackEndCommand) {\n this.props.oContext.onBackEndCommand({\n command: 'link',\n url: href,\n target: this.props.schema.target || '_blank',\n close: this.props.schema.close,\n });\n } else {\n onLink(\n href,\n this.props.schema.target || '_blank',\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n );\n }\n }\n }\n : null\n }\n >\n {text}\n </Box>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigStaticText.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigStaticText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAiB,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwB;IAChC,SAAS,EAAE;QACP,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;KAChB;IACD,IAAI,EAAE,CAAC,KAAe,EAAuB,EAAE,CAAC,CAAC;QAC7C,cAAc,EAAE,WAAW;QAC3B,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;QAC5D,MAAM,EAAE,SAAS;KAC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,CAAC;wBACN,CAAC;oBACL,CAAC;gBACL,CAAC;gBACH,CAAC,CAAC,SAAS,IAGlB,IAAI,CACH,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Box, Button } from '@mui/material';\n\nimport { type IobTheme, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemStaticText } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, any> = {\n fullWidth: {\n height: '100%',\n width: '100%',\n },\n link: (theme: IobTheme): React.CSSProperties => ({\n textDecoration: 'underline',\n color: theme.palette.mode === 'dark' ? '#4dabf5' : '#254e72',\n cursor: 'pointer',\n }),\n};\n\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\nfunction onLink(href: string, target: '_blank' | '_self' | string | undefined, instanceId: string): void {\n let _target;\n let url = '';\n if (!href) {\n url = `#tab-instances/config/${instanceId}`;\n _target = target || '_self';\n } else if (href.toString().startsWith('#')) {\n _target = target || '_self';\n url = href;\n } else if (href.toString().startsWith('/')) {\n _target = target || '_self';\n url = href;\n } else if (href.startsWith('http://') || href.startsWith('https://')) {\n _target = target || '_blank';\n url = href;\n } else {\n url = `#tab-instances/config/${instanceId}/${href}`;\n _target = target || '_self';\n }\n if (_target === '_self') {\n // close dialog\n setTimeout(\n (_url: string) => {\n if (_url.startsWith('#')) {\n window.location.hash = _url;\n } else if (_url.startsWith('/')) {\n url = `${window.location.protocol}//${window.location.host}${url}`;\n } else if (_url.startsWith('http://') || _url.startsWith('https://')) {\n window.location.href = _url;\n }\n },\n 100,\n url,\n );\n } else {\n if (url.startsWith('#')) {\n url = `${window.location.protocol}//${window.location.host}${window.location.pathname}${url}`;\n } else if (url.startsWith('/')) {\n url = `${window.location.protocol}//${window.location.host}${url}`;\n }\n\n window.open(url, _target);\n }\n}\n\ninterface ConfigStaticTextProps extends ConfigGenericProps {\n schema: ConfigItemStaticText;\n}\n\nexport default class ConfigStaticText extends ConfigGeneric<ConfigStaticTextProps, ConfigGenericState> {\n renderItem(_error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n if (this.props.schema.button) {\n const icon = this.getIcon();\n return (\n <Button\n variant={this.props.schema.variant || undefined}\n color={this.props.schema.color || 'grey'}\n style={{ ...styles.fullWidth, ...(this.props.schema.controlStyle || undefined) }}\n disabled={disabled}\n startIcon={icon}\n onClick={\n this.props.schema.href\n ? () => {\n // calculate one more time just before call\n const href = this.props.schema.href\n ? this.getText(this.props.schema.href, true)\n : null;\n if (href) {\n if (this.props.oContext.onBackEndCommand) {\n this.props.oContext.onBackEndCommand({\n command: 'link',\n url: href,\n target: this.props.schema.target,\n close: this.props.schema.close,\n });\n } else {\n onLink(\n href,\n this.props.schema.target,\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n );\n }\n }\n }\n : undefined\n }\n >\n {this.getText(this.props.schema.text || this.props.schema.label, this.props.schema.noTranslation)}\n </Button>\n );\n }\n let text: string | JSX.Element | JSX.Element[] = this.getText(\n this.props.schema.text || this.props.schema.label,\n this.props.schema.noTranslation,\n );\n if (this.props.schema.format === 'html') {\n text = <div dangerouslySetInnerHTML={{ __html: text }} />;\n } else if (this.props.schema.format === 'json') {\n try {\n const obj = typeof text === 'string' ? JSON.parse(text) : text;\n text = (\n <pre style={{ whiteSpace: 'pre-wrap', wordBreak: 'break-word', margin: 0 }}>\n {JSON.stringify(obj, null, 2)}\n </pre>\n );\n } catch {\n // invalid JSON — just render as text\n // fallthrough to the next block\n }\n } else if (\n text &&\n (text.includes('<a ') || text.includes('<br') || text.includes('<b>') || text.includes('<i>'))\n ) {\n text = Utils.renderTextWithA(text);\n }\n\n return (\n <Box\n component=\"span\"\n style={{ ...(this.props.schema.controlStyle || undefined) }}\n sx={this.props.schema.href ? styles.link : undefined}\n onClick={\n this.props.schema.href\n ? () => {\n // calculate one more time just before call\n const href = this.props.schema.href ? this.getText(this.props.schema.href, true) : null;\n if (href) {\n if (this.props.oContext.onBackEndCommand) {\n this.props.oContext.onBackEndCommand({\n command: 'link',\n url: href,\n target: this.props.schema.target || '_blank',\n close: this.props.schema.close,\n });\n } else {\n onLink(\n href,\n this.props.schema.target || '_blank',\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n );\n }\n }\n }\n : undefined\n }\n >\n {text}\n </Box>\n );\n }\n}\n"]}
|
|
@@ -45,11 +45,11 @@ export default class ConfigTable extends ConfigGeneric<ConfigTableProps, ConfigT
|
|
|
45
45
|
/**
|
|
46
46
|
* Handle errors from table row components
|
|
47
47
|
*/
|
|
48
|
-
onTableRowError: (rowIndex: number) => (attr: string, error?: string) => void;
|
|
48
|
+
onTableRowError: (rowIndex: number) => (attr: string | undefined, error?: string) => void;
|
|
49
49
|
static descendingComparator(a: Record<string, any>, b: Record<string, any>, orderBy: string): number;
|
|
50
50
|
static getComparator(order: 'desc' | 'asc', orderBy: string): (a: Record<string, any>, b: Record<string, any>) => number;
|
|
51
51
|
static getFilterValue(el: React.RefObject<HTMLInputElement>): string;
|
|
52
|
-
static setFilterValue(el: React.RefObject<HTMLInputElement>, filterValue: string):
|
|
52
|
+
static setFilterValue(el: React.RefObject<HTMLInputElement>, filterValue: string): void;
|
|
53
53
|
handleRequestSort: (property: string, orderCheck?: boolean) => void;
|
|
54
54
|
stableSort: (order: "desc" | "asc", orderBy: string) => Record<string, any>[];
|
|
55
55
|
renderShowHideFilter(headCell: ConfigItemTableIndexed): React.JSX.Element | null;
|
|
@@ -77,9 +77,9 @@ export default class ConfigTable extends ConfigGeneric<ConfigTableProps, ConfigT
|
|
|
77
77
|
orderBy: string;
|
|
78
78
|
order: 'asc' | 'desc';
|
|
79
79
|
showAddButton: boolean;
|
|
80
|
-
style
|
|
80
|
+
style?: React.CSSProperties;
|
|
81
81
|
}): React.JSX.Element;
|
|
82
|
-
enhancedFilterCard(): JSX.Element;
|
|
82
|
+
enhancedFilterCard(): JSX.Element | null;
|
|
83
83
|
enhancedBottomCard(): JSX.Element;
|
|
84
84
|
renderCards(): JSX.Element | null;
|
|
85
85
|
renderTable(): JSX.Element | null;
|
|
@@ -212,7 +212,7 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
212
212
|
this.filterRefs = {};
|
|
213
213
|
this.props.schema.items ||= [];
|
|
214
214
|
this.props.schema.items.forEach((el) => {
|
|
215
|
-
if (el.filter) {
|
|
215
|
+
if (el.filter && el.attr) {
|
|
216
216
|
this.filterRefs[el.attr] = createRef();
|
|
217
217
|
}
|
|
218
218
|
});
|
|
@@ -250,10 +250,8 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
250
250
|
}
|
|
251
251
|
this.secret = systemConfig?.native?.secret || this.secret;
|
|
252
252
|
_value.forEach((el) => {
|
|
253
|
-
this.props.schema.encryptedAttributes
|
|
254
|
-
|
|
255
|
-
el[attr] = decrypt(this.secret, el[attr]);
|
|
256
|
-
}
|
|
253
|
+
this.props.schema.encryptedAttributes?.forEach((attr) => {
|
|
254
|
+
el[attr] ||= decrypt(this.secret, el[attr]);
|
|
257
255
|
});
|
|
258
256
|
});
|
|
259
257
|
}
|
|
@@ -379,7 +377,7 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
379
377
|
});
|
|
380
378
|
// Clear error for this column if no duplicates found
|
|
381
379
|
if (!found) {
|
|
382
|
-
this.onError(uniqueCol
|
|
380
|
+
this.onError(uniqueCol);
|
|
383
381
|
}
|
|
384
382
|
}
|
|
385
383
|
// Set error message based on the first error found (or clear if no errors)
|
|
@@ -397,18 +395,18 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
397
395
|
*/
|
|
398
396
|
onTableRowError = (rowIndex) => (attr, error) => {
|
|
399
397
|
const newTableErrors = { ...this.state.tableErrors };
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
398
|
+
newTableErrors[rowIndex] ||= {};
|
|
399
|
+
if (attr) {
|
|
400
|
+
if (!error) {
|
|
401
|
+
delete newTableErrors[rowIndex][attr];
|
|
402
|
+
// Clean up empty row error objects
|
|
403
|
+
if (Object.keys(newTableErrors[rowIndex]).length === 0) {
|
|
404
|
+
delete newTableErrors[rowIndex];
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
newTableErrors[rowIndex][attr] = error;
|
|
408
409
|
}
|
|
409
|
-
}
|
|
410
|
-
else {
|
|
411
|
-
newTableErrors[rowIndex][attr] = error;
|
|
412
410
|
}
|
|
413
411
|
this.setState({ tableErrors: newTableErrors });
|
|
414
412
|
// Forward error to parent component
|
|
@@ -432,7 +430,9 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
432
430
|
return el?.current?.children[0]?.children[0]?.value;
|
|
433
431
|
}
|
|
434
432
|
static setFilterValue(el, filterValue) {
|
|
435
|
-
|
|
433
|
+
if (el.current) {
|
|
434
|
+
el.current.children[0].children[0].value = filterValue;
|
|
435
|
+
}
|
|
436
436
|
}
|
|
437
437
|
handleRequestSort = (property, orderCheck = false) => {
|
|
438
438
|
const { order, orderBy } = this.state;
|
|
@@ -460,24 +460,26 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
460
460
|
return stabilizedThis.map(el => el.el);
|
|
461
461
|
};
|
|
462
462
|
renderShowHideFilter(headCell) {
|
|
463
|
-
if (!headCell.filter) {
|
|
463
|
+
if (!headCell.filter || !headCell.attr) {
|
|
464
464
|
return null;
|
|
465
465
|
}
|
|
466
466
|
return (React.createElement(IconButton, { title: I18n.t('jc_Show/hide filter input'), size: "small", onClick: () => {
|
|
467
467
|
const filterOn = [...this.state.filterOn];
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
else {
|
|
473
|
-
filterOn.splice(pos, 1);
|
|
474
|
-
}
|
|
475
|
-
this.setState({ filterOn }, () => {
|
|
476
|
-
if (pos && ConfigTable.getFilterValue(this.filterRefs[headCell.attr])) {
|
|
477
|
-
ConfigTable.setFilterValue(this.filterRefs[headCell.attr], '');
|
|
478
|
-
this.applyFilter();
|
|
468
|
+
if (headCell.attr) {
|
|
469
|
+
const pos = this.state.filterOn.indexOf(headCell.attr);
|
|
470
|
+
if (pos === -1) {
|
|
471
|
+
filterOn.push(headCell.attr);
|
|
479
472
|
}
|
|
480
|
-
|
|
473
|
+
else {
|
|
474
|
+
filterOn.splice(pos, 1);
|
|
475
|
+
}
|
|
476
|
+
this.setState({ filterOn }, () => {
|
|
477
|
+
if (pos && ConfigTable.getFilterValue(this.filterRefs[headCell.attr])) {
|
|
478
|
+
ConfigTable.setFilterValue(this.filterRefs[headCell.attr], '');
|
|
479
|
+
this.applyFilter();
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
}
|
|
481
483
|
} }, this.state.filterOn.includes(headCell.attr) ? React.createElement(IconFilterOff, null) : React.createElement(IconFilterOn, null)));
|
|
482
484
|
}
|
|
483
485
|
renderImportExportButtons(schema) {
|
|
@@ -549,21 +551,23 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
549
551
|
value: newValue,
|
|
550
552
|
iteration: this.state.iteration + 10_000,
|
|
551
553
|
tableErrors: shiftedErrors,
|
|
552
|
-
}, () => this.applyFilter(false,
|
|
554
|
+
}, () => this.applyFilter(false, undefined, () => this.onChangeWrapper(newValue)));
|
|
553
555
|
};
|
|
554
556
|
onExport() {
|
|
555
557
|
const { schema } = this.props;
|
|
556
558
|
const { value } = this.state;
|
|
557
|
-
const cols = schema.items
|
|
558
|
-
const lines = [cols.join(';')];
|
|
559
|
+
const cols = schema.items?.map((it) => it.attr);
|
|
560
|
+
const lines = cols ? [cols.join(';')] : [];
|
|
559
561
|
value.forEach(row => {
|
|
560
562
|
const line = [];
|
|
561
|
-
schema.items
|
|
562
|
-
if (
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
563
|
+
schema.items?.forEach((it) => {
|
|
564
|
+
if (it.attr) {
|
|
565
|
+
if (row[it.attr] && typeof row[it.attr] === 'string' && row[it.attr].includes(';')) {
|
|
566
|
+
line.push(`"${row[it.attr]}"`);
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
line.push(row[it.attr] ?? '');
|
|
570
|
+
}
|
|
567
571
|
}
|
|
568
572
|
});
|
|
569
573
|
lines.push(line.join(';'));
|
|
@@ -581,10 +585,9 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
581
585
|
const lines = text.split('\n').map((line) => line.replace('\r', '').trim());
|
|
582
586
|
// the first line is header
|
|
583
587
|
const { schema } = this.props;
|
|
584
|
-
const header = lines
|
|
585
|
-
.shift()
|
|
588
|
+
const header = (lines?.shift() || '')
|
|
586
589
|
.split(';')
|
|
587
|
-
.filter(it => it && schema.items
|
|
590
|
+
.filter(it => it && schema.items?.find((it2) => it2.attr === it));
|
|
588
591
|
const values = [];
|
|
589
592
|
lines.forEach((line) => {
|
|
590
593
|
const parts = line.split(';');
|
|
@@ -606,7 +609,7 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
606
609
|
val = false;
|
|
607
610
|
}
|
|
608
611
|
else if (window.isFinite(value)) {
|
|
609
|
-
const attr = this.props.schema.items
|
|
612
|
+
const attr = this.props.schema.items?.find((it) => it.attr === header[p]);
|
|
610
613
|
if (attr && attr.type === 'number') {
|
|
611
614
|
// if a type of attribute is a "number"
|
|
612
615
|
val = parseFloat(value);
|
|
@@ -654,7 +657,7 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
654
657
|
cloned[this.props.schema.clone] = `${cloned[this.props.schema.clone]}_${i}`;
|
|
655
658
|
}
|
|
656
659
|
newValue.splice(index, 0, cloned);
|
|
657
|
-
this.setState({ value: newValue, iteration: this.state.iteration + 10000 }, () => this.applyFilter(false,
|
|
660
|
+
this.setState({ value: newValue, iteration: this.state.iteration + 10000 }, () => this.applyFilter(false, undefined, () => this.onChangeWrapper(newValue)));
|
|
658
661
|
};
|
|
659
662
|
onChangeWrapper = (newValue, updateVisible) => {
|
|
660
663
|
if (this.typingTimer) {
|
|
@@ -718,24 +721,26 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
718
721
|
else {
|
|
719
722
|
defaultValue = currentValue.default ?? null;
|
|
720
723
|
}
|
|
721
|
-
|
|
724
|
+
if (currentValue.attr) {
|
|
725
|
+
newItem[currentValue.attr] = defaultValue;
|
|
726
|
+
}
|
|
722
727
|
}
|
|
723
728
|
}
|
|
724
729
|
newValue.push(newItem);
|
|
725
|
-
this.setState({ value: newValue }, () => this.applyFilter(false,
|
|
730
|
+
this.setState({ value: newValue }, () => this.applyFilter(false, undefined, () => this.onChangeWrapper(newValue)));
|
|
726
731
|
};
|
|
727
732
|
isAnyFilterSet() {
|
|
728
733
|
return !!Object.keys(this.filterRefs).find(attr => ConfigTable.getFilterValue(this.filterRefs[attr]));
|
|
729
734
|
}
|
|
730
735
|
applyFilter = (clear, value, cb) => {
|
|
731
|
-
value
|
|
736
|
+
value ||= this.state.value;
|
|
732
737
|
let visibleValue = value.map((_, i) => i);
|
|
733
738
|
Object.keys(this.filterRefs).forEach(attr => {
|
|
734
739
|
let valueInputRef = ConfigTable.getFilterValue(this.filterRefs[attr]);
|
|
735
740
|
if (!clear && valueInputRef) {
|
|
736
741
|
valueInputRef = valueInputRef.toLowerCase();
|
|
737
742
|
const labelMap = this.state.filterLabelMap?.[attr];
|
|
738
|
-
visibleValue = visibleValue
|
|
743
|
+
visibleValue = visibleValue?.filter(idx => {
|
|
739
744
|
if (!value[idx] || value[idx][attr] == null) {
|
|
740
745
|
return false;
|
|
741
746
|
}
|
|
@@ -746,7 +751,7 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
746
751
|
// Also check against the display label
|
|
747
752
|
if (labelMap) {
|
|
748
753
|
const label = labelMap[value[idx][attr]];
|
|
749
|
-
if (label
|
|
754
|
+
if (label?.toLowerCase().includes(valueInputRef)) {
|
|
750
755
|
return true;
|
|
751
756
|
}
|
|
752
757
|
}
|
|
@@ -757,13 +762,11 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
757
762
|
ConfigTable.setFilterValue(this.filterRefs[attr], '');
|
|
758
763
|
}
|
|
759
764
|
});
|
|
760
|
-
if (visibleValue.length === value.length) {
|
|
765
|
+
if (visibleValue && visibleValue.length === value.length) {
|
|
761
766
|
visibleValue = null;
|
|
762
767
|
}
|
|
763
|
-
if (visibleValue
|
|
764
|
-
|
|
765
|
-
cb();
|
|
766
|
-
}
|
|
768
|
+
if (visibleValue == null && this.state.visibleValue === null) {
|
|
769
|
+
cb?.();
|
|
767
770
|
return;
|
|
768
771
|
}
|
|
769
772
|
if (JSON.stringify(visibleValue) !== JSON.stringify(this.state.visibleValue)) {
|
|
@@ -778,14 +781,14 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
778
781
|
const item = newValue[idx];
|
|
779
782
|
newValue.splice(idx, 1);
|
|
780
783
|
newValue.splice(idx - 1, 0, item);
|
|
781
|
-
this.setState({ value: newValue, iteration: this.state.iteration + 10000 }, () => this.applyFilter(false,
|
|
784
|
+
this.setState({ value: newValue, iteration: this.state.iteration + 10000 }, () => this.applyFilter(false, undefined, () => this.onChangeWrapper(newValue)));
|
|
782
785
|
}
|
|
783
786
|
onMoveDown(idx) {
|
|
784
787
|
const newValue = JSON.parse(JSON.stringify(this.state.value));
|
|
785
788
|
const item = newValue[idx];
|
|
786
789
|
newValue.splice(idx, 1);
|
|
787
790
|
newValue.splice(idx + 1, 0, item);
|
|
788
|
-
this.setState({ value: newValue, iteration: this.state.iteration + 10000 }, () => this.applyFilter(false,
|
|
791
|
+
this.setState({ value: newValue, iteration: this.state.iteration + 10000 }, () => this.applyFilter(false, undefined, () => this.onChangeWrapper(newValue)));
|
|
789
792
|
}
|
|
790
793
|
onDrop(acceptedFiles) {
|
|
791
794
|
const file = acceptedFiles[0];
|
|
@@ -817,7 +820,7 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
817
820
|
value,
|
|
818
821
|
iteration: this.state.iteration + 10000,
|
|
819
822
|
showTypeOfImportDialog: false,
|
|
820
|
-
}, () => this.applyFilter(false,
|
|
823
|
+
}, () => this.applyFilter(false, undefined, () => this.onChangeWrapper(value)));
|
|
821
824
|
} }, I18n.t('jc_Append')),
|
|
822
825
|
React.createElement(Button, { variant: "contained", color: "secondary", autoFocus: true, onClick: () => {
|
|
823
826
|
const value = this.state.showTypeOfImportDialog;
|
|
@@ -825,7 +828,7 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
825
828
|
value,
|
|
826
829
|
iteration: this.state.iteration + 10000,
|
|
827
830
|
showTypeOfImportDialog: false,
|
|
828
|
-
}, () => this.applyFilter(false,
|
|
831
|
+
}, () => this.applyFilter(false, undefined, () => this.onChangeWrapper(value)));
|
|
829
832
|
} }, I18n.t('jc_Replace')))));
|
|
830
833
|
}
|
|
831
834
|
showImportDialog() {
|
|
@@ -842,12 +845,7 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
842
845
|
React.createElement(Dropzone, { multiple: false, accept: { 'text/csv': ['.csv'] }, maxSize: MAX_SIZE, onDragEnter: () => this.setState({ uploadFile: 'dragging' }), onDragLeave: () => this.setState({ uploadFile: true }), onDrop: (acceptedFiles, errors) => {
|
|
843
846
|
this.setState({ uploadFile: false });
|
|
844
847
|
if (!acceptedFiles.length) {
|
|
845
|
-
window.alert(
|
|
846
|
-
errors[0] &&
|
|
847
|
-
errors[0].errors &&
|
|
848
|
-
errors[0].errors[0] &&
|
|
849
|
-
errors[0].errors[0].message) ||
|
|
850
|
-
I18n.t('jc_Cannot upload'));
|
|
848
|
+
window.alert(errors?.[0]?.errors?.[0]?.message || I18n.t('jc_Cannot upload'));
|
|
851
849
|
}
|
|
852
850
|
else {
|
|
853
851
|
this.onDrop(acceptedFiles);
|
|
@@ -875,8 +873,10 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
875
873
|
...(props.schema.showFirstAddOnTop ? { flexDirection: 'column' } : undefined),
|
|
876
874
|
} },
|
|
877
875
|
props.showAddButton ? this.renderAddButton(props.doAnyFilterSet) : null,
|
|
878
|
-
props.headCell.sort && (React.createElement(TableSortLabel, { active: true, style: props.orderBy !== props.headCell.attr ? styles.silver : undefined, direction: props.orderBy === props.headCell.attr ? props.order : 'asc', onClick: () => this.handleRequestSort(props.headCell.attr) })),
|
|
879
|
-
props.headCell.filter &&
|
|
876
|
+
props.headCell.sort && (React.createElement(TableSortLabel, { active: true, style: props.orderBy !== props.headCell.attr ? styles.silver : undefined, direction: props.orderBy === props.headCell.attr ? props.order : 'asc', onClick: () => props.headCell.attr && this.handleRequestSort(props.headCell.attr) })),
|
|
877
|
+
props.headCell.filter &&
|
|
878
|
+
props.headCell.attr &&
|
|
879
|
+
this.state.filterOn.includes(props.headCell.attr) ? (React.createElement(TextField, { variant: "standard", ref: this.filterRefs[props.headCell.attr], onChange: () => this.applyFilter(), title: I18n.t('jc_You can filter entries by entering here some text'), slotProps: {
|
|
880
880
|
input: {
|
|
881
881
|
endAdornment: ConfigTable.getFilterValue(this.filterRefs[props.headCell.attr]) && (React.createElement(InputAdornment, { position: "end" },
|
|
882
882
|
React.createElement(IconButton, { size: "small", tabIndex: -1, onClick: () => {
|
|
@@ -896,7 +896,7 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
896
896
|
tdStyle = { paddingTop: 1, paddingBottom: 1 };
|
|
897
897
|
}
|
|
898
898
|
const importExportVisible = (!schema.noDelete && schema.import) || schema.export;
|
|
899
|
-
if (importExportVisible || schema.items
|
|
899
|
+
if (importExportVisible || schema.items?.find(item => item.sort || item.filter)) {
|
|
900
900
|
return (React.createElement(Grid2, { size: {
|
|
901
901
|
xs: schema.xs || 12, // if xs is not defined, take the full width
|
|
902
902
|
sm: schema.sm || undefined,
|
|
@@ -949,7 +949,7 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
949
949
|
React.createElement(Table, null,
|
|
950
950
|
React.createElement(TableBody, null,
|
|
951
951
|
React.createElement(TableRow, null,
|
|
952
|
-
React.createElement(TableCell, { colSpan: schema.items
|
|
952
|
+
React.createElement(TableCell, { colSpan: (schema.items?.length || 0) + 1, style: tdStyle }, this.renderAddButton(doAnyFilterSet)))))))));
|
|
953
953
|
}
|
|
954
954
|
renderCards() {
|
|
955
955
|
const { schema } = this.props;
|
|
@@ -1015,10 +1015,12 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
1015
1015
|
React.createElement(Table, null,
|
|
1016
1016
|
React.createElement(TableBody, null,
|
|
1017
1017
|
schema.items?.map((headCell) => {
|
|
1018
|
-
const hidden =
|
|
1018
|
+
const hidden = headCell.attr &&
|
|
1019
|
+
this.listOfHiddenElements?.[idx]?.includes(headCell.attr);
|
|
1019
1020
|
return (React.createElement(TableRow, { key: `${headCell.attr}_${idx}` },
|
|
1020
1021
|
React.createElement(TableCell, { align: "left", style: hidden ? tdStyleHidden : tdStyle }, hidden ? null : (React.createElement("span", { style: styles.headerText }, this.getText(headCell.title)))),
|
|
1021
|
-
React.createElement(TableCell, { align: "left", style: hidden ? tdStyleHidden : tdStyle },
|
|
1022
|
+
React.createElement(TableCell, { align: "left", style: hidden ? tdStyleHidden : tdStyle }, headCell.attr &&
|
|
1023
|
+
this.itemTable(headCell.attr, this.state.value[idx], idx, true))));
|
|
1022
1024
|
}),
|
|
1023
1025
|
!this.props.schema.titleAttribute && !schema.noDelete && (React.createElement(TableRow, null,
|
|
1024
1026
|
React.createElement(TableCell, { align: "left", style: tdStyle },
|
|
@@ -1060,7 +1062,8 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
1060
1062
|
this.enhancedTableHead(!doAnyFilterSet && !this.state.orderBy ? 120 : 64, doAnyFilterSet),
|
|
1061
1063
|
React.createElement(TableBody, null,
|
|
1062
1064
|
visibleValue.map((idx, i) => (React.createElement(TableRow, { hover: true, key: `${idx}_${i}`, sx: this.state.tableErrors[idx] ? { outline: '1px solid red' } : undefined },
|
|
1063
|
-
schema.items?.map((headCell) => (React.createElement(TableCell, { key: `${headCell.attr}_${idx}`, align: "left", style: tdStyle },
|
|
1065
|
+
schema.items?.map((headCell) => (React.createElement(TableCell, { key: `${headCell.attr}_${idx}`, align: "left", style: tdStyle }, headCell.attr &&
|
|
1066
|
+
this.itemTable(headCell.attr, this.state.value[idx], idx, false)))),
|
|
1064
1067
|
!schema.noDelete && (React.createElement(TableCell, { align: "left", style: { ...tdStyle, ...styles.buttonCell } },
|
|
1065
1068
|
!doAnyFilterSet && !this.state.orderBy ? (i ? (React.createElement(Tooltip, { title: I18n.t('jc_Move up'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
1066
1069
|
React.createElement(IconButton, { size: "small", onClick: () => this.onMoveUp(idx) },
|
|
@@ -1075,7 +1078,7 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
1075
1078
|
React.createElement(IconButton, { size: "small", onClick: this.onClone(idx) },
|
|
1076
1079
|
React.createElement(CopyContentIcon, null)))) : null))))),
|
|
1077
1080
|
!schema.noDelete && visibleValue.length >= (schema.showSecondAddAt || 5) ? (React.createElement(TableRow, null,
|
|
1078
|
-
React.createElement(TableCell, { colSpan: schema.items
|
|
1081
|
+
React.createElement(TableCell, { colSpan: (schema.items?.length || 0) + 1, style: { ...tdStyle } }, this.renderAddButton(doAnyFilterSet)))) : null)),
|
|
1079
1082
|
!visibleValue.length && this.state.value.length ? (React.createElement("div", { style: styles.filteredOut },
|
|
1080
1083
|
React.createElement(Typography, { style: styles.title, variant: "h6", id: "tableTitle", component: "div" },
|
|
1081
1084
|
I18n.t('jc_All items are filtered out'),
|
|
@@ -1093,7 +1096,9 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
1093
1096
|
}
|
|
1094
1097
|
this.resizeTimeout = setTimeout(() => {
|
|
1095
1098
|
this.resizeTimeout = null;
|
|
1096
|
-
|
|
1099
|
+
if (this.refDiv.current?.clientWidth) {
|
|
1100
|
+
this.setState({ width: this.refDiv.current.clientWidth });
|
|
1101
|
+
}
|
|
1097
1102
|
}, 50);
|
|
1098
1103
|
}
|
|
1099
1104
|
}
|
|
@@ -1121,7 +1126,7 @@ export default class ConfigTable extends ConfigGeneric {
|
|
|
1121
1126
|
return null;
|
|
1122
1127
|
}
|
|
1123
1128
|
const currentBreakpoint = this.getCurrentBreakpoint();
|
|
1124
|
-
let content;
|
|
1129
|
+
let content = null;
|
|
1125
1130
|
if (currentBreakpoint && (schema.useCardFor || ['xs']).includes(currentBreakpoint)) {
|
|
1126
1131
|
content = this.renderCards();
|
|
1127
1132
|
}
|