@iobroker/json-config 6.17.12 → 6.17.14

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 (61) hide show
  1. package/package.json +27 -27
  2. package/src/JsonConfig.tsx +0 -710
  3. package/src/JsonConfigComponent/ChipInput.tsx +0 -752
  4. package/src/JsonConfigComponent/ConfigAccordion.tsx +0 -278
  5. package/src/JsonConfigComponent/ConfigAlive.tsx +0 -74
  6. package/src/JsonConfigComponent/ConfigAutocomplete.tsx +0 -108
  7. package/src/JsonConfigComponent/ConfigAutocompleteSendTo.tsx +0 -183
  8. package/src/JsonConfigComponent/ConfigCRON.jsx +0 -101
  9. package/src/JsonConfigComponent/ConfigCertCollection.tsx +0 -102
  10. package/src/JsonConfigComponent/ConfigCertificateSelect.tsx +0 -92
  11. package/src/JsonConfigComponent/ConfigCertificates.tsx +0 -202
  12. package/src/JsonConfigComponent/ConfigCheckLicense.jsx +0 -662
  13. package/src/JsonConfigComponent/ConfigCheckbox.tsx +0 -67
  14. package/src/JsonConfigComponent/ConfigChip.jsx +0 -81
  15. package/src/JsonConfigComponent/ConfigColor.tsx +0 -86
  16. package/src/JsonConfigComponent/ConfigCoordinates.tsx +0 -234
  17. package/src/JsonConfigComponent/ConfigCustom.tsx +0 -246
  18. package/src/JsonConfigComponent/ConfigDatePicker.tsx +0 -48
  19. package/src/JsonConfigComponent/ConfigDeviceManager.tsx +0 -33
  20. package/src/JsonConfigComponent/ConfigFile.jsx +0 -181
  21. package/src/JsonConfigComponent/ConfigFileSelector.jsx +0 -520
  22. package/src/JsonConfigComponent/ConfigFunc.jsx +0 -90
  23. package/src/JsonConfigComponent/ConfigGeneric.tsx +0 -1027
  24. package/src/JsonConfigComponent/ConfigIP.jsx +0 -96
  25. package/src/JsonConfigComponent/ConfigImageSendTo.jsx +0 -79
  26. package/src/JsonConfigComponent/ConfigImageUpload.jsx +0 -114
  27. package/src/JsonConfigComponent/ConfigInstanceSelect.jsx +0 -172
  28. package/src/JsonConfigComponent/ConfigInterface.jsx +0 -112
  29. package/src/JsonConfigComponent/ConfigJsonEditor.jsx +0 -103
  30. package/src/JsonConfigComponent/ConfigLanguage.tsx +0 -153
  31. package/src/JsonConfigComponent/ConfigLicense.jsx +0 -148
  32. package/src/JsonConfigComponent/ConfigNumber.tsx +0 -207
  33. package/src/JsonConfigComponent/ConfigObjectId.jsx +0 -113
  34. package/src/JsonConfigComponent/ConfigPanel.tsx +0 -360
  35. package/src/JsonConfigComponent/ConfigPassword.jsx +0 -160
  36. package/src/JsonConfigComponent/ConfigPattern.jsx +0 -50
  37. package/src/JsonConfigComponent/ConfigPort.tsx +0 -232
  38. package/src/JsonConfigComponent/ConfigRoom.jsx +0 -90
  39. package/src/JsonConfigComponent/ConfigSelect.jsx +0 -124
  40. package/src/JsonConfigComponent/ConfigSelectSendTo.tsx +0 -251
  41. package/src/JsonConfigComponent/ConfigSendto.tsx +0 -340
  42. package/src/JsonConfigComponent/ConfigSetState.jsx +0 -116
  43. package/src/JsonConfigComponent/ConfigSlider.jsx +0 -97
  44. package/src/JsonConfigComponent/ConfigStaticDivider.jsx +0 -51
  45. package/src/JsonConfigComponent/ConfigStaticHeader.jsx +0 -63
  46. package/src/JsonConfigComponent/ConfigStaticImage.jsx +0 -48
  47. package/src/JsonConfigComponent/ConfigStaticText.jsx +0 -72
  48. package/src/JsonConfigComponent/ConfigTable.tsx +0 -1040
  49. package/src/JsonConfigComponent/ConfigTabs.tsx +0 -150
  50. package/src/JsonConfigComponent/ConfigText.tsx +0 -188
  51. package/src/JsonConfigComponent/ConfigTextSendTo.tsx +0 -102
  52. package/src/JsonConfigComponent/ConfigTimePicker.tsx +0 -63
  53. package/src/JsonConfigComponent/ConfigTopic.jsx +0 -78
  54. package/src/JsonConfigComponent/ConfigUUID.tsx +0 -55
  55. package/src/JsonConfigComponent/ConfigUser.jsx +0 -104
  56. package/src/JsonConfigComponent/index.tsx +0 -435
  57. package/src/JsonConfigComponent/wrapper/Components/CustomModal.jsx +0 -145
  58. package/src/JsonConfigComponent/wrapper/Components/Editor.jsx +0 -65
  59. package/src/Utils.jsx +0 -1683
  60. package/src/index.tsx +0 -14
  61. package/src/types.d.ts +0 -372
@@ -1,153 +0,0 @@
1
- import React from 'react';
2
- import { withStyles } from '@mui/styles';
3
-
4
- import {
5
- InputLabel,
6
- MenuItem,
7
- FormHelperText,
8
- FormControl,
9
- Select,
10
- } from '@mui/material';
11
-
12
- import { I18n } from '@iobroker/adapter-react-v5';
13
-
14
- import type { ConfigItemLanguage } from '#JC/types';
15
- import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';
16
-
17
- const styles: Record<string, any> = {
18
- fullWidth: {
19
- width: '100%',
20
- },
21
- };
22
-
23
- const LANGUAGES = [
24
- {
25
- value: 'en',
26
- label: 'English',
27
- },
28
- {
29
- value: 'de',
30
- label: 'Deutsch',
31
- },
32
- {
33
- value: 'ru',
34
- label: 'русский',
35
- },
36
- {
37
- value: 'pt',
38
- label: 'Portugues',
39
- },
40
- {
41
- value: 'nl',
42
- label: 'Nederlands',
43
- },
44
- {
45
- value: 'fr',
46
- label: 'français',
47
- },
48
- {
49
- value: 'it',
50
- label: 'Italiano',
51
- },
52
- {
53
- value: 'es',
54
- label: 'Espanol',
55
- },
56
- {
57
- value: 'pl',
58
- label: 'Polski',
59
- },
60
- {
61
- value: 'uk',
62
- label: 'Український',
63
- },
64
- {
65
- value: 'zh-ch',
66
- label: '简体中文',
67
- },
68
- ] as const;
69
-
70
- interface LanguageSelectOption {
71
- /** Value to save */
72
- value: string;
73
- /** Label to show */
74
- label: string;
75
- }
76
-
77
- interface ConfigLanguageProps extends ConfigGenericProps {
78
- schema: ConfigItemLanguage;
79
- }
80
-
81
- interface ConfigLanguageState extends ConfigGenericState {
82
- selectOptions: LanguageSelectOption[];
83
- }
84
-
85
- class ConfigLanguage extends ConfigGeneric<ConfigLanguageProps, ConfigLanguageState> {
86
- componentDidMount() {
87
- super.componentDidMount();
88
- const value = ConfigGeneric.getValue(this.props.data, this.props.attr);
89
- const languages: LanguageSelectOption[] = [...LANGUAGES];
90
- if (this.props.schema.system) {
91
- languages.unshift({ value: '', label: I18n.t('ra_System language') });
92
- } else {
93
- languages.unshift({ value: '', label: I18n.t('ra_none') });
94
- }
95
-
96
- this.setState({ value: this.props.schema.system ? (value || '') : (value || I18n.getLanguage()), selectOptions: languages });
97
- }
98
-
99
- renderItem(error: unknown, disabled: boolean): React.JSX.Element | null {
100
- if (!this.state.selectOptions) {
101
- return null;
102
- }
103
-
104
- const item = this.state.selectOptions?.find(it => it.value === this.state.value || (!it.value && !this.state.value));
105
-
106
- return <FormControl className={this.props.classes.fullWidth} variant="standard">
107
- {this.props.schema.label ? <InputLabel>{this.getText(this.props.schema.label)}</InputLabel> : null}
108
- <Select
109
- variant="standard"
110
- error={!!error}
111
- disabled={disabled}
112
- value={this.state.value || '_'}
113
- renderValue={() => this.getText(item?.label, this.props.schema.noTranslation)}
114
- onChange={e => {
115
- let { value } = e.target;
116
- if (value === '_') {
117
- value = '';
118
- }
119
-
120
- this.setState({ value }, () => {
121
- this.onChange(this.props.attr, value);
122
- if (this.props.schema.changeGuiLanguage) {
123
- if (value) {
124
- if (value === I18n.getLanguage()) {
125
- return;
126
- }
127
- I18n.setLanguage(value);
128
- this.props.changeLanguage && this.props.changeLanguage();
129
- } else {
130
- this.props.socket.getSystemConfig()
131
- .then((systemConfig: ioBroker.SystemConfigObject) => {
132
- if (systemConfig.common.language === I18n.getLanguage()) {
133
- return;
134
- }
135
- if (systemConfig.common.language) {
136
- I18n.setLanguage(systemConfig.common.language);
137
- this.props.changeLanguage && this.props.changeLanguage();
138
- }
139
- });
140
- }
141
- }
142
- });
143
- }}
144
- >
145
- {this.state.selectOptions?.map(it =>
146
- <MenuItem key={it.value} value={it.value}>{it.label}</MenuItem>)}
147
- </Select>
148
- {this.props.schema.help ? <FormHelperText>{this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}</FormHelperText> : null}
149
- </FormControl>;
150
- }
151
- }
152
-
153
- export default withStyles(styles)(ConfigLanguage);
@@ -1,148 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- import {
5
- Button,
6
- Dialog,
7
- DialogActions,
8
- DialogContent,
9
- DialogTitle,
10
- LinearProgress,
11
- FormControlLabel,
12
- Checkbox,
13
- } from '@mui/material';
14
-
15
- import { Check, Close } from '@mui/icons-material';
16
-
17
- import { I18n } from '@iobroker/adapter-react-v5';
18
-
19
- import ConfigGeneric from './ConfigGeneric';
20
-
21
- class ConfigLicense extends ConfigGeneric {
22
- constructor(props) {
23
- super(props);
24
- this.scrollRef = React.createRef();
25
- this.noPlaceRequired = true;
26
- }
27
-
28
- scrolledDown() {
29
- if (!this.scrollRef.current) {
30
- return false;
31
- }
32
- return this.scrollRef.current.offsetHeight + this.scrollRef.current.scrollTop >= this.scrollRef.current.scrollHeight;
33
- }
34
-
35
- componentDidMount() {
36
- super.componentDidMount();
37
- if (!ConfigGeneric.getValue(this.props.data, this.props.attr)) {
38
- if (this.props.schema.licenseUrl) {
39
- this.setState({ showLicenseDialog: true, loading: true, scrolledDown: false });
40
- fetch(this.props.schema.licenseUrl)
41
- .then(res => res.text())
42
- .then(text => this.setState({ license: text, loading: false }))
43
- .catch(e => this.setState({
44
- license: e.toString(), loading: false, error: true, scrolledDown: false,
45
- }));
46
- } else {
47
- this.setState({ showLicenseDialog: true, scrolledDown: false });
48
- }
49
- setTimeout(() => {
50
- // install scroll handler
51
- if (this.scrollRef.current) {
52
- const scrolledDown = this.scrolledDown();
53
- if (!scrolledDown) {
54
- this.scrollRef.current.addEventListener('scroll', () => {
55
- if (!this.state.scrolledDown && this.scrolledDown()) {
56
- this.setState({ scrolledDown: true });
57
- }
58
- });
59
- } else {
60
- this.setState({ scrolledDown: true });
61
- }
62
- }
63
- }, 1000);
64
- }
65
- }
66
-
67
- renderItem(/* error, disabled, defaultValue */) {
68
- if (!this.state.showLicenseDialog) {
69
- return null;
70
- }
71
-
72
- return <Dialog
73
- maxWidth="lg"
74
- open={!0}
75
- onClose={(e, reason) => {
76
- if (reason !== 'escapeKeyDown' && reason !== 'backdropClick') {
77
- this.setState({ showLicenseDialog: false });
78
- }
79
- }}
80
- >
81
- <DialogTitle>{this.props.schema.title ? I18n.t(this.props.schema.title) : I18n.t('ra_License agreement')}</DialogTitle>
82
- <DialogContent>
83
- {this.props.schema.licenseUrl ? <>
84
- {this.state.loading ? <LinearProgress /> : null}
85
- <pre
86
- ref={this.scrollRef}
87
- style={{
88
- width: '100%', height: '100%', overflowY: 'auto', fontSize: 14,
89
- }}
90
- >
91
- {this.state.license}
92
- </pre>
93
- </> : null}
94
- {!this.props.schema.licenseUrl && this.props.schema.texts ? <div
95
- ref={this.scrollRef}
96
- style={{
97
- width: '100%', height: '100%', overflowY: 'auto', fontSize: 14,
98
- }}
99
- >
100
- {this.props.schema.texts.map(text => (this.props.schema.noTranslation ? <p>{text}</p> : <p>{I18n.t(text)}</p>))}
101
- </div> : null}
102
- </DialogContent>
103
- <DialogActions>
104
- {this.props.schema.checkBox ? <FormControlLabel
105
- control={<Checkbox checked={!!this.state.licenseChecked} onClick={() => this.setState({ licenseChecked: !this.state.licenseChecked })} />}
106
- label={I18n.t(this.props.schema.checkBox)}
107
- /> : null}
108
- <Button
109
- disabled={this.state.loading || this.state.error || (this.props.schema.checkBox && !this.state.licenseChecked) || !this.state.scrolledDown}
110
- onClick={() => {
111
- this.setState({ showLicenseDialog: null });
112
- this.onChange(this.props.attr, true);
113
- }}
114
- color="primary"
115
- variant="contained"
116
- startIcon={<Check />}
117
- >
118
- {this.props.schema.agreeText ? I18n.t(this.props.schema.agreeText) : I18n.t('ra_Accept license')}
119
- </Button>
120
- <Button
121
- onClick={() => {
122
- this.setState({ showLicenseDialog: false });
123
- setTimeout(() => this.setState({ showLicenseDialog: true }), 2000);
124
- }}
125
- color="grey"
126
- variant="contained"
127
- startIcon={<Close />}
128
- >
129
- {I18n.t('ra_Close')}
130
- </Button>
131
- </DialogActions>
132
- </Dialog>;
133
- }
134
- }
135
-
136
- ConfigLicense.propTypes = {
137
- socket: PropTypes.object.isRequired,
138
- themeType: PropTypes.string,
139
- themeName: PropTypes.string,
140
- style: PropTypes.object,
141
- className: PropTypes.string,
142
- data: PropTypes.object.isRequired,
143
- schema: PropTypes.object,
144
- onError: PropTypes.func,
145
- onChange: PropTypes.func,
146
- };
147
-
148
- export default ConfigLicense;
@@ -1,207 +0,0 @@
1
- import React from 'react';
2
- import { withStyles } from '@mui/styles';
3
-
4
- import { Autocomplete, TextField, FormControl } from '@mui/material';
5
-
6
- import { I18n } from '@iobroker/adapter-react-v5';
7
-
8
- import type { ConfigItemNumber } from '#JC/types';
9
- import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';
10
-
11
- const styles: Record<string, any> = {
12
- indeterminate: {
13
- opacity: 0.5,
14
- },
15
- control: {
16
- flexDirection: 'row',
17
- width: '100%',
18
- },
19
- };
20
-
21
- interface ConfigNumberProps extends ConfigGenericProps {
22
- schema: ConfigItemNumber;
23
- }
24
-
25
- interface ConfigNumberState extends ConfigGenericState {
26
- _value: string;
27
- oldValue: string | null;
28
- }
29
-
30
- class ConfigNumber extends ConfigGeneric<ConfigNumberProps, ConfigNumberState> {
31
- private updateTimeout?: ReturnType<typeof setTimeout>;
32
-
33
- componentDidMount() {
34
- super.componentDidMount();
35
- let _value = ConfigGeneric.getValue(this.props.data, this.props.attr);
36
-
37
- if (_value === null || _value === undefined) {
38
- _value = '';
39
- }
40
-
41
- if (Array.isArray(_value) && this.props.multiEdit) {
42
- _value = ConfigGeneric.DIFFERENT_VALUE;
43
- this.setState({ _value, oldValue: _value });
44
- return;
45
- }
46
-
47
- this.setState({ _value: _value.toString(), oldValue: _value.toString() });
48
- }
49
-
50
- static getDerivedStateFromProps(props: ConfigNumberProps, state: ConfigNumberState) {
51
- if (
52
- (props.schema.min !== undefined && props.schema.min < 0) ||
53
- (props.schema.max !== undefined && props.schema.max < 0)
54
- ) {
55
- return null;
56
- }
57
- const _value = ConfigGeneric.getValue(props.data, props.attr);
58
-
59
- if (props.multiEdit && state._value === ConfigGeneric.DIFFERENT_VALUE) {
60
- return ConfigGeneric.DIFFERENT_VALUE;
61
- }
62
-
63
- if (
64
- _value === null ||
65
- _value === undefined ||
66
- state.oldValue === null ||
67
- state.oldValue === undefined ||
68
- (_value.toString() !== parseFloat(state._value).toString() &&
69
- _value.toString() !== state.oldValue.toString())
70
- ) {
71
- return { _value };
72
- }
73
-
74
- return null;
75
- }
76
-
77
- checkValue(value: string): string | null {
78
- if (value === null || value === undefined) {
79
- return null;
80
- }
81
- value = value.toString().trim();
82
- const f = value === '' ? 0 : parseFloat(value);
83
-
84
- if (value !== '' && Number.isNaN(f)) {
85
- return 'ra_Not a number';
86
- }
87
-
88
- // eslint-disable-next-line no-restricted-properties
89
- if (value !== '' && window.isFinite(f)) {
90
- if (this.props.schema.min !== undefined && f < this.props.schema.min) {
91
- return 'ra_Too small';
92
- }
93
- if (this.props.schema.max !== undefined && f > this.props.schema.max) {
94
- return 'ra_Too big';
95
- }
96
- if (value === '' || value === '-' || Number.isNaN(f)) {
97
- return 'ra_Not a number';
98
- }
99
-
100
- return null;
101
- }
102
-
103
- return 'ra_Not a number';
104
- }
105
-
106
- renderItem(error: unknown, disabled: boolean) {
107
- const isIndeterminate = Array.isArray(this.state._value) || this.state._value === ConfigGeneric.DIFFERENT_VALUE;
108
-
109
- if (this.state.oldValue !== null && this.state.oldValue !== undefined) {
110
- this.updateTimeout && clearTimeout(this.updateTimeout);
111
- this.updateTimeout = setTimeout(() => {
112
- this.updateTimeout = undefined;
113
- this.setState({ oldValue: null });
114
- }, 30);
115
- } else if (this.updateTimeout) {
116
- clearTimeout(this.updateTimeout);
117
- this.updateTimeout = undefined;
118
- }
119
-
120
- if (isIndeterminate) {
121
- const autoCompleteOptions = ConfigGeneric.getValue(this.props.data, this.props.attr);
122
- const arr = [...autoCompleteOptions].map(item => ({ label: item.toString(), value: item }));
123
-
124
- arr.unshift({ label: I18n.t(ConfigGeneric.DIFFERENT_LABEL), value: ConfigGeneric.DIFFERENT_VALUE });
125
-
126
- return <Autocomplete
127
- className={this.props.classes.indeterminate}
128
- fullWidth
129
- freeSolo
130
- value={arr[0]}
131
- // @ts-expect-error needs investigation if this really has no effect
132
- getOptionSelected={(option, value) => option.label === value.label}
133
- onChange={(_, value: typeof arr[number]) => {
134
- this.onChange(this.props.attr, value?.value, () => {
135
- this.setState({ _value: value?.value, oldValue: this.state._value });
136
- });
137
- }}
138
- options={arr}
139
- getOptionLabel={(option: typeof arr[number]) => option.label}
140
- renderInput={params => (
141
- <TextField
142
- {...params}
143
- label={this.getText(this.props.schema.label)}
144
- variant="standard"
145
- inputProps={{ ...params.inputProps, readOnly: this.props.schema.readOnly || false }}
146
- error={!!error}
147
- placeholder={this.getText(this.props.schema.placeholder)}
148
- helperText={this.renderHelp(
149
- this.props.schema.help,
150
- this.props.schema.helpLink,
151
- this.props.schema.noTranslation,
152
- )}
153
- disabled={!!disabled}
154
- />
155
- )}
156
- />;
157
- }
158
- if (!error && this.state._value !== null && this.state._value !== undefined && this.state._value) {
159
- error = this.checkValue(this.state._value);
160
- if (error) {
161
- error = I18n.t(error as string);
162
- }
163
- }
164
-
165
- return <FormControl variant="standard" className={this.props.classes.control}>
166
- <TextField
167
- variant="standard"
168
- type="number"
169
- fullWidth
170
- inputProps={{
171
- min: this.props.schema.min,
172
- max: this.props.schema.max,
173
- step: this.props.schema.step,
174
- readOnly: this.props.schema.readOnly || false,
175
- }}
176
- value={this.state._value === null || this.state._value === undefined ? '' : this.state._value}
177
- error={!!error}
178
- disabled={!!disabled}
179
- onChange={e => {
180
- const _value = e.target.value; // value is always a string and it is validly formatted
181
- const _error = this.checkValue(_value);
182
- if (_error) {
183
- this.onError(this.props.attr, I18n.t(_error));
184
- } else {
185
- this.onError(this.props.attr); // clear error
186
- }
187
-
188
- this.setState({ _value, oldValue: this.state._value }, () =>
189
- this.onChange(this.props.attr, parseFloat(_value)));
190
- }}
191
- placeholder={this.getText(this.props.schema.placeholder)}
192
- label={this.getText(this.props.schema.label)}
193
- helperText={
194
- error && typeof error === 'string'
195
- ? error
196
- : this.renderHelp(
197
- this.props.schema.help,
198
- this.props.schema.helpLink,
199
- this.props.schema.noTranslation,
200
- )
201
- }
202
- />
203
- </FormControl>;
204
- }
205
- }
206
-
207
- export default withStyles(styles)(ConfigNumber);
@@ -1,113 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { withStyles } from '@mui/styles';
4
-
5
- import {
6
- InputLabel,
7
- FormControl,
8
- Button,
9
- TextField,
10
- } from '@mui/material';
11
-
12
- import { SelectID as DialogSelectID } from '@iobroker/adapter-react-v5';
13
-
14
- import ConfigGeneric from './ConfigGeneric';
15
-
16
- const styles = () => ({
17
- fullWidth: {
18
- width: '100%',
19
- },
20
- flex: {
21
- display: 'flex',
22
- },
23
- button: {
24
- height: 48,
25
- marginLeft: 4,
26
- minWidth: 48,
27
- },
28
- });
29
-
30
- class ConfigObjectId extends ConfigGeneric {
31
- async componentDidMount() {
32
- super.componentDidMount();
33
- const { data, attr } = this.props;
34
- const value = ConfigGeneric.getValue(data, attr) || '';
35
- this.setState({ value, initialized: true });
36
- }
37
-
38
- renderItem(error, disabled /* , defaultValue */) {
39
- if (!this.state.initialized) {
40
- return null;
41
- }
42
- const {
43
- classes, schema, socket, attr,
44
- } = this.props;
45
- const { value, showSelectId } = this.state;
46
-
47
- return <FormControl className={classes.fullWidth} variant="standard">
48
- {schema.label ? <InputLabel shrink>{this.getText(schema.label)}</InputLabel> : null}
49
- <div className={classes.flex}>
50
- <TextField
51
- variant="standard"
52
- fullWidth
53
- value={value}
54
- error={!!error}
55
- disabled={disabled}
56
- placeholder={this.getText(schema.placeholder)}
57
- label={this.getText(schema.label)}
58
- helperText={this.renderHelp(schema.help, schema.helpLink, schema.noTranslation)}
59
- onChange={e => {
60
- const value_ = e.target.value;
61
- this.setState({ value: value_ }, () =>
62
- this.onChange(attr, value_));
63
- }}
64
- />
65
- <Button
66
- color="grey"
67
- className={this.props.classes.button}
68
- size="small"
69
- variant="outlined"
70
- onClick={() => this.setState({ showSelectId: true })}
71
- >
72
- ...
73
- </Button>
74
- </div>
75
- {showSelectId ? <DialogSelectID
76
- imagePrefix={this.props.imagePrefix === undefined ? '../..' : this.props.imagePrefix}
77
- dateFormat={this.props.dateFormat}
78
- isFloatComma={this.props.isFloatComma}
79
- dialogName={`admin.${this.props.adapterName}`}
80
- filterFunc={schema.filterFunc}
81
- themeType={this.props.themeType}
82
- types={schema.types ? (Array.isArray(schema.types) ? schema.types : [schema.types]) : undefined}
83
- customFilter={schema.customFilter}
84
- filters={schema.filters}
85
- socket={socket}
86
- statesOnly={schema.all === undefined ? true : schema.all}
87
- selected={value}
88
- root={schema.root}
89
- onClose={() => this.setState({ showSelectId: false })}
90
- onOk={value_ =>
91
- this.setState({ showSelectId: false, value: value_ }, () =>
92
- this.onChange(attr, value_))}
93
- /> : null}
94
- </FormControl>;
95
- }
96
- }
97
-
98
- ConfigObjectId.propTypes = {
99
- socket: PropTypes.object.isRequired,
100
- themeType: PropTypes.string,
101
- themeName: PropTypes.string,
102
- style: PropTypes.object,
103
- className: PropTypes.string,
104
- data: PropTypes.object.isRequired,
105
- schema: PropTypes.object,
106
- onError: PropTypes.func,
107
- onChange: PropTypes.func,
108
- dateFormat: PropTypes.string,
109
- isFloatComma: PropTypes.bool,
110
- imagePrefix: PropTypes.string,
111
- };
112
-
113
- export default withStyles(styles)(ConfigObjectId);