@bytebrand/fe-ui-core 4.2.106 → 4.2.108

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/common.ts CHANGED
@@ -136,7 +136,9 @@ import {
136
136
  StepButton,
137
137
  Accordion as MIAccordion,
138
138
  AccordionSummary,
139
- AccordionDetails
139
+ AccordionDetails,
140
+ ListItemButton,
141
+ RadioGroup as MUIRadioGroup
140
142
  } from '@mui/material';
141
143
  import { createTheme } from '@mui/material/styles';
142
144
 
@@ -156,5 +158,7 @@ export {
156
158
  MIAccordion,
157
159
  AccordionSummary,
158
160
  AccordionDetails,
159
- StyledComponent
161
+ StyledComponent,
162
+ ListItemButton,
163
+ MUIRadioGroup
160
164
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.2.106",
3
+ "version": "4.2.108",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -23,6 +23,9 @@ class Power extends React.Component<IPowerProps, {}> {
23
23
  super(props);
24
24
 
25
25
  this.name = 'POWER';
26
+ this.state = {
27
+ type:'PS'
28
+ };
26
29
  }
27
30
 
28
31
  private readonly name: string;
@@ -30,7 +33,8 @@ class Power extends React.Component<IPowerProps, {}> {
30
33
 
31
34
  onDropDownChange = (name: string, value: any) => {
32
35
  const { controls, onChange, onChangeControls } = this.props;
33
- const { from, to, type }: any = { ...controls, [name]: value };
36
+ const { type } = this.state;
37
+ const { from, to }: any = { ...controls, [name]: value };
34
38
  const controlsObj = { from, to, type };
35
39
  this.tempValues = { from, to };
36
40
 
@@ -41,9 +45,14 @@ class Power extends React.Component<IPowerProps, {}> {
41
45
  onTypeChange = (_event: React.SyntheticEvent, value: any) => {
42
46
  const { controls, onChange, onChangeControls } = this.props;
43
47
  const values = this.tempValues ? this.tempValues : controls;
44
-
45
- onChangeControls(this.name, { ...values, type: value });
46
- onChange(this.name, { ...values, type: value });
48
+ // this.type=value;
49
+ this.setState(() => ({
50
+ type:value
51
+ }));
52
+ if (values.from !== '' && values.to !== '') {
53
+ onChangeControls(this.name, { ...values, type: value });
54
+ onChange(this.name, { ...values, type: value });
55
+ }
47
56
  };
48
57
 
49
58
  getOptions = (options: any) => options.map((option: string) => ({
@@ -62,7 +71,9 @@ class Power extends React.Component<IPowerProps, {}> {
62
71
  };
63
72
 
64
73
  renderSlider = () => {
65
- const { values, options, onChange, onChangeControls, controls: { type } } = this.props;
74
+ const { type } = this.state;
75
+
76
+ const { values, options, onChange, onChangeControls } = this.props;
66
77
  const sliderProps = {
67
78
  options,
68
79
  name: this.name,
@@ -70,7 +81,6 @@ class Power extends React.Component<IPowerProps, {}> {
70
81
  values: this.transformValues(values),
71
82
  onChange: (value: any, name: string) => {
72
83
  this.tempValues = value;
73
-
74
84
  onChange(name, { ...value, type });
75
85
  onChangeControls(this.name, { ...value, type });
76
86
  // onChangeControls(this.name, { ...RANGE_FILTERS_DEFAULT_CONTROLS, type });
@@ -82,7 +92,7 @@ class Power extends React.Component<IPowerProps, {}> {
82
92
 
83
93
  renderRadioGroup = () => {
84
94
  const { typeOptions, controls } = this.props;
85
- const { type } = controls;
95
+ const { type } = this.state;
86
96
  const radioGroupProps = {
87
97
  value: type,
88
98
  name: 'POWER_TYPE',
@@ -106,15 +116,16 @@ class Power extends React.Component<IPowerProps, {}> {
106
116
 
107
117
  render(): JSX.Element {
108
118
  const { t, controls } = this.props;
109
- const { from = 0, to = 0, type } = controls;
119
+ const { type } = this.state;
120
+ const { from = 0, to = 0 } = controls;
110
121
  const commonProps = {
111
122
  size: 'custom'
112
123
  };
113
124
 
114
125
  const fromProps = {
115
126
  ...commonProps,
116
- value: from || null,
117
- label: this.getLabel('filters.from', controls.type),
127
+ value: `${from}` || null,
128
+ label: this.getLabel('filters.from', type),
118
129
  type: 'number',
119
130
  onChange: (value: any) => this.onDropDownChange('from', value),
120
131
  items: this.getOptions(sliceLessThan(POWER_FIX, to))
@@ -122,10 +133,10 @@ class Power extends React.Component<IPowerProps, {}> {
122
133
 
123
134
  const toProps = {
124
135
  ...commonProps,
125
- value: to || null,
136
+ value: `${to}` || null,
126
137
  type: 'number',
127
- label: this.getLabel('filters.to', controls.type),
128
- onChange: (value: any) => this.onDropDownChange('to', value),
138
+ label: this.getLabel('filters.to', type),
139
+ onChange: (value: any) => this.onDropDownChange('to', type),
129
140
  items: this.getOptions(sliceMoreThan(POWER_FIX, from))
130
141
  };
131
142