cloudmr-ux 0.0.3 → 1.0.0

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 (67) hide show
  1. package/README.md +24 -16
  2. package/dist/index.975ef6c8.js +75418 -0
  3. package/dist/index.975ef6c8.js.map +1 -0
  4. package/dist/index.css +140 -14
  5. package/dist/index.d.ts +58 -0
  6. package/dist/index.db9ed22c.css +171 -0
  7. package/dist/index.db9ed22c.css.map +1 -0
  8. package/dist/index.html +13 -0
  9. package/dist/index.js +170 -141
  10. package/dist/index.mjs +157 -0
  11. package/package.json +39 -99
  12. package/dist/index.js.map +0 -1
  13. package/dist/index.modern.js +0 -147
  14. package/dist/index.modern.js.map +0 -1
  15. package/src/.eslintrc +0 -5
  16. package/src/common/components/Cmr-components/avatar/Avatar.scss +0 -0
  17. package/src/common/components/Cmr-components/avatar/Avatar.tsx +0 -25
  18. package/src/common/components/Cmr-components/button/Button.scss +0 -0
  19. package/src/common/components/Cmr-components/button/Button.tsx +0 -14
  20. package/src/common/components/Cmr-components/checkbox/Checkbox.scss +0 -11
  21. package/src/common/components/Cmr-components/checkbox/Checkbox.tsx +0 -29
  22. package/src/common/components/Cmr-components/collapse/Collapse.scss +0 -3
  23. package/src/common/components/Cmr-components/collapse/Collapse.tsx +0 -75
  24. package/src/common/components/Cmr-components/dialogue/Confirmation.tsx +0 -48
  25. package/src/common/components/Cmr-components/dialogue/DeletionDialog.tsx +0 -61
  26. package/src/common/components/Cmr-components/dialogue/EditConfirmation.tsx +0 -72
  27. package/src/common/components/Cmr-components/double-slider/DualSlider.tsx +0 -198
  28. package/src/common/components/Cmr-components/double-slider/InvertibleDualSlider.tsx +0 -224
  29. package/src/common/components/Cmr-components/dropdown/Dropdown.scss +0 -36
  30. package/src/common/components/Cmr-components/dropdown/Dropdown.tsx +0 -83
  31. package/src/common/components/Cmr-components/gui-slider/ControlledSlider.tsx +0 -139
  32. package/src/common/components/Cmr-components/gui-slider/Slider.tsx +0 -170
  33. package/src/common/components/Cmr-components/header/Header.scss +0 -20
  34. package/src/common/components/Cmr-components/header/Header.tsx +0 -101
  35. package/src/common/components/Cmr-components/input/Input.scss +0 -0
  36. package/src/common/components/Cmr-components/input/Input.tsx +0 -39
  37. package/src/common/components/Cmr-components/input-number/InputNumber.scss +0 -0
  38. package/src/common/components/Cmr-components/input-number/InputNumber.tsx +0 -29
  39. package/src/common/components/Cmr-components/label/Label.scss +0 -13
  40. package/src/common/components/Cmr-components/label/Label.tsx +0 -20
  41. package/src/common/components/Cmr-components/option/Option.scss +0 -0
  42. package/src/common/components/Cmr-components/option/Option.tsx +0 -24
  43. package/src/common/components/Cmr-components/panel/Panel.scss +0 -0
  44. package/src/common/components/Cmr-components/panel/Panel.tsx +0 -54
  45. package/src/common/components/Cmr-components/progress/Progress.scss +0 -0
  46. package/src/common/components/Cmr-components/progress/Progress.tsx +0 -38
  47. package/src/common/components/Cmr-components/radio/Radio.scss +0 -0
  48. package/src/common/components/Cmr-components/radio/Radio.tsx +0 -23
  49. package/src/common/components/Cmr-components/radio-group/RadioGroup.scss +0 -0
  50. package/src/common/components/Cmr-components/radio-group/RadioGroup.tsx +0 -32
  51. package/src/common/components/Cmr-components/rename/edit.tsx +0 -94
  52. package/src/common/components/Cmr-components/select/Select.scss +0 -3
  53. package/src/common/components/Cmr-components/select/Select.tsx +0 -33
  54. package/src/common/components/Cmr-components/select-upload/SelectUpload.scss +0 -0
  55. package/src/common/components/Cmr-components/select-upload/SelectUpload.tsx +0 -133
  56. package/src/common/components/Cmr-components/slider/Slider.scss +0 -0
  57. package/src/common/components/Cmr-components/slider/Slider.tsx +0 -66
  58. package/src/common/components/Cmr-components/spin/Spin.scss +0 -0
  59. package/src/common/components/Cmr-components/spin/Spin.tsx +0 -31
  60. package/src/common/components/Cmr-components/tooltip/Tooltip.scss +0 -0
  61. package/src/common/components/Cmr-components/tooltip/Tooltip.tsx +0 -50
  62. package/src/common/components/Cmr-components/upload/Upload.scss +0 -5
  63. package/src/common/components/Cmr-components/upload/Upload.tsx +0 -188
  64. package/src/common/components/Cmr-components/upload/UploadWindow.tsx +0 -355
  65. package/src/index.js +0 -8
  66. package/src/index.test.js +0 -7
  67. package/src/styles.module.css +0 -9
@@ -1,198 +0,0 @@
1
- import {Box} from "@mui/material";
2
- import {useRef, useState} from "react";
3
-
4
- /**
5
- * This dual slider (lil-gui styled) allows users to control the max and min of an interval simultaneously.
6
- * The rendered interval (and number control) can be masked by a transformation - inverse pair.
7
- * @param name
8
- * @param min
9
- * @param max
10
- * @param setMin
11
- * @param setMax
12
- * @param transform transform and inverse are a pair that masks the rendered values and rendered inputs by a transformation
13
- * @param inverse transform and inverse are a pair that masks the rendered values and rendered inputs by a transformation
14
- * @constructor
15
- */
16
- export const DualSlider = ({name,min,max,setMin,setMax,
17
- transform=x=>x,inverse=x=>x}:
18
- {name:string,min:number,max:number, setMin?:(min:number)=>void,
19
- setMax?:(max:number)=>void,transform?:(x:number)=>number,
20
- inverse?:(x:number)=>number})=>{
21
- const [leftSliderPosition, setLeftSliderPosition] = useState(0); // Initial percentage for the left slider
22
- const [rightSliderPosition, setRightSliderPosition] = useState(100); // Initial percentage for the right slider
23
- const [isHovering, setIsHovering] = useState(false);
24
- const [leftEditing, setLeftEditing] = useState(false);
25
-
26
- const [minOverride, setMinOverride] = useState<any>(undefined);
27
- const [maxOverride, setMaxOverride] = useState<any>(undefined);
28
-
29
- if(minOverride)
30
- min = minOverride;
31
- if(maxOverride)
32
- max = maxOverride;
33
-
34
- const a = transform((max-min)*leftSliderPosition/100+min);
35
- const b = transform((max-min)*rightSliderPosition/100+min);
36
- const left = Math.min(a,b);
37
- const right = Math.max(a,b);
38
-
39
- const sliderRef = useRef(null); // Ref for the parent box
40
-
41
- const handleDragStart = (e:any, slider:string) => {
42
- // Prevent default behavior
43
- e.preventDefault();
44
- setLeftEditing(false);
45
- setLeftIsNaN(false)
46
- leftRef.current.blur();
47
-
48
- setRightEditing(false);
49
- setRightIsNaN(false);
50
- rightRef.current.blur();
51
-
52
- // Calculate initial positions
53
- const startX = e.clientX;
54
- // @ts-ignore
55
- const sliderWidth = sliderRef.current.offsetWidth;
56
-
57
- const handleMouseMove = (e:any) => {
58
- const moveX = e.clientX - startX;
59
- const newPosition = ((moveX / sliderWidth) * 100) + (slider === 'left' ? leftSliderPosition : rightSliderPosition);
60
-
61
-
62
- // Prevent the slider from going outside the parent box
63
- const clampedPosition = Math.min(100, Math.max(0, newPosition));
64
-
65
- // Update the position of the slider
66
- if (slider === 'left') {
67
- setLeftSliderPosition(clampedPosition);
68
- const a = (max-min)*clampedPosition/100+min;
69
- const b = (max-min)*rightSliderPosition/100+min;
70
- setMin&&setMin(Math.min(a,b));
71
- setMax&&setMax(Math.max(a,b));
72
-
73
- } else if (slider === 'right') {
74
- setRightSliderPosition(clampedPosition);
75
- const a = (max-min)*leftSliderPosition/100+min;
76
- const b = (max-min)*clampedPosition/100+min;
77
- setMin&&setMin(Math.min(a,b));
78
- setMax&&setMax(Math.max(a,b));
79
- }
80
-
81
- };
82
-
83
- const handleMouseUp = () => {
84
- // Remove event listeners once dragging is complete
85
- document.removeEventListener('mousemove', handleMouseMove);
86
- document.removeEventListener('mouseup', handleMouseUp);
87
- };
88
-
89
- // Add mouse move and mouse up listeners to document to handle drag
90
- document.addEventListener('mousemove', handleMouseMove);
91
- document.addEventListener('mouseup', handleMouseUp);
92
- };
93
-
94
- const leftText = Math.abs(left)<0.01&&left!=0?Number(left).toExponential(3).toUpperCase():Number(left).toFixed(3);
95
- const [leftEditedText,setLeftEditedText] = useState('');
96
- const [leftIsNaN, setLeftIsNaN] = useState(false);
97
- const leftRef = useRef<any>(null);
98
-
99
- const [rightEditing, setRightEditing] = useState(false);
100
- const [rightEditedText, setRightEditedText] = useState('');
101
- const [rightIsNaN, setRightIsNaN] = useState(false);
102
- const rightRef = useRef<any>(null);
103
-
104
- // Logic to handle right value box editing...
105
- const rightText = Math.abs(right) < 0.01 && right != 0 ? Number(right).toExponential(3).toUpperCase() : Number(right).toFixed(3);
106
-
107
- return <Box sx={{display:'flex',flexDirection:'row', paddingLeft:'4px',paddingRight:'4px'}} height={20}>
108
- <Box flex={0.322} fontSize={16} color={'#3D3D3D'} alignItems={'center'} display={'flex'} marginBottom={'1pt'}
109
- fontFamily={'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif'}>
110
- {name}
111
- </Box>
112
- <Box sx={{display:'flex',flexDirection:'row'}} flex={1}>
113
- <input ref={leftRef} style={{backgroundColor:'#f0f0f0',width:'45px', borderRadius:'2px', outline:"none",borderStyle:'none',paddingLeft:'3px',paddingRight:'3px', lineHeight:'20px',
114
- whiteSpace:'nowrap',fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif',fontSize:'11px',color:leftIsNaN?'red':'black'}} value={
115
- (leftEditing)?leftEditedText:leftText
116
- } onKeyDown={(e) => {
117
- if (e.key === 'Enter'&&!leftIsNaN) {
118
- //@ts-ignore
119
- e.target.blur(); // This will cause the input to lose focus
120
- }
121
- }} onFocus={(e)=>{
122
- setLeftEditedText(e.target.value);
123
- setLeftEditing(true);
124
- }} onChange={(event)=>{
125
- setLeftIsNaN(isNaN(Number(event.target.value)));
126
- setLeftEditedText(event.target.value);
127
- }} onBlur={(e)=>{
128
- let val = inverse(Number(leftEditedText));
129
- if(isNaN(val)) {
130
- return e.preventDefault();
131
- }
132
- setLeftEditing(false);
133
- setMin&&setMin(val);
134
- let newMin = min;
135
- if(val<min) {
136
- setMinOverride(val);
137
- newMin = val;
138
- }
139
- let leftPosition = (val-newMin)/(max-newMin)*100;
140
- setLeftSliderPosition(leftPosition);
141
- }}/>
142
-
143
- <Box sx={{ backgroundColor: '#f0f0f0', flex: 1, marginLeft: '4px', marginRight: '4px', borderRadius: '2px', position: 'relative',
144
- overflow:'hidden', opacity:isHovering?0.75:1
145
- }} ref={sliderRef}
146
- onMouseEnter={() => setIsHovering(true)} onMouseLeave={() => setIsHovering(false)}>
147
- {/* Central gray block with two vertical black components */}
148
- <Box sx={{ position: 'absolute', left: `calc(${leftSliderPosition*0.97}% - 10px)`, width: '20px', height: '100%', cursor: 'ew-resize', zIndex: 1 }}
149
- onMouseDown={(e) => handleDragStart(e, 'left')}>
150
- {/* Visual representation of the slider */}
151
- <Box sx={{ position: 'absolute', left: '10px', width: '2px', height: '100%', backgroundColor: 'black' }} />
152
- </Box>
153
-
154
- {/* Transparent hitbox for the right slider */}
155
- <Box sx={{ position: 'absolute', right: `calc(${(100 - rightSliderPosition)*0.97}% - 10px)`, width: '20px', height: '100%', cursor: 'ew-resize', zIndex: 1 }}
156
- onMouseDown={(e) => handleDragStart(e, 'right')}>
157
- {/* Visual representation of the slider */}
158
- <Box sx={{ position: 'absolute', right: '10px', width: '2px', height: '100%', backgroundColor: 'black' }} />
159
- </Box>
160
- </Box>
161
-
162
- <input style={{backgroundColor: '#f0f0f0', width: '45px', borderRadius: '2px', outline: "none", borderStyle: 'none', paddingLeft: '3px', paddingRight: '3px', lineHeight: '20px',
163
- whiteSpace: 'nowrap', fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif', fontSize: '11px', color: rightIsNaN ? 'red' : 'black'}}
164
- value={(rightEditing) ? rightEditedText : rightText}
165
- ref={rightRef}
166
- onKeyDown={(e) => {
167
- if (e.key === 'Enter' && !rightIsNaN) {
168
- //@ts-ignore
169
- e.target.blur(); // This will cause the input to lose focus
170
- }
171
- }}
172
- onFocus={(e) => {
173
- setRightEditedText(e.target.value);
174
- setRightEditing(true);
175
- }}
176
- onChange={(event) => {
177
- setRightIsNaN(isNaN(Number(event.target.value)));
178
- setRightEditedText(event.target.value);
179
- }}
180
- onBlur={(e) => {
181
- let val = inverse(Number(rightEditedText));
182
- if (isNaN(val)) {
183
- return e.preventDefault();
184
- }
185
- setRightEditing(false);
186
- setMax && setMax(val);
187
- let newMax = max;
188
- if (val > max) {
189
- setMaxOverride(val);
190
- newMax = val;
191
- }
192
- let rightPosition = (val - min) / (newMax - min) * 100;
193
- setRightSliderPosition(rightPosition);
194
- }}
195
- />
196
- </Box>
197
- </Box>
198
- }
@@ -1,224 +0,0 @@
1
- import {Box} from "@mui/material";
2
- import {useEffect, useRef, useState} from "react";
3
-
4
- /**
5
- * This dual slider (lil-gui styled) allows users to control the max and min of an interval simultaneously.
6
- * The rendered interval (and number control) can be masked by a transformation - inverse pair.
7
- * @param name
8
- * @param min
9
- * @param max
10
- * @param setMin
11
- * @param setMax
12
- * @param reverse
13
- * @param transform transform and inverse are a pair that masks the rendered values and rendered inputs by a transformation
14
- * @param inverse transform and inverse are a pair that masks the rendered values and rendered inputs by a transformation
15
- * @constructor
16
- */
17
- export const InvertibleDualSlider = ({name,min,max,setMin,setMax, reverse=false,
18
- transform=x=>x,inverse=x=>x,onFinalize}:
19
- {name:string,min:number,max:number, setMin?:(min:number)=>void,
20
- setMax?:(max:number)=>void,reverse?:boolean,transform?:(x:number)=>number,
21
- inverse?:(x:number)=>number,onFinalize?: ()=>void} )=>{
22
- const [leftSliderPosition, setLeftSliderPosition] = useState(0); // Initial percentage for the left slider
23
- const [rightSliderPosition, setRightSliderPosition] = useState(100); // Initial percentage for the right slider
24
- useEffect(() => {//Initialize parent min/max values upon initialization
25
- setMin&&setMin(min);
26
- setMax&&setMax(max);
27
- setLeftSliderPosition(0);
28
- setRightSliderPosition(100);
29
- }, [min,max]);
30
- const [isHovering, setIsHovering] = useState(false);
31
- const [leftEditing, setLeftEditing] = useState(false);
32
-
33
- const [minOverride, setMinOverride] = useState<any>(undefined);
34
- const [maxOverride, setMaxOverride] = useState<any>(undefined);
35
-
36
- if(minOverride)
37
- min = minOverride;
38
- if(maxOverride)
39
- max = maxOverride;
40
-
41
- const a = transform((max-min)*leftSliderPosition/100+min);
42
- const b = transform((max-min)*rightSliderPosition/100+min);
43
- const left = Math.min(a,b);
44
- const right = Math.max(a,b);
45
-
46
- const sliderRef = useRef(null); // Ref for the parent box
47
-
48
- const handleDragStart = (e:any, slider:string) => {
49
- // Prevent default behavior
50
- e.preventDefault();
51
- setLeftEditing(false);
52
- setLeftIsNaN(false)
53
- leftRef.current.blur();
54
-
55
- setRightEditing(false);
56
- setRightIsNaN(false);
57
- rightRef.current.blur();
58
-
59
- // Calculate initial positions
60
- const startX = e.clientX;
61
- // @ts-ignore
62
- const sliderWidth = sliderRef.current.offsetWidth;
63
-
64
- const handleMouseMove = (e:any) => {
65
- const moveX = e.clientX - startX;
66
- const newPosition = ((moveX / sliderWidth) * 100) + (slider === 'left' ? leftSliderPosition : rightSliderPosition);
67
-
68
-
69
- // Prevent the slider from going outside the parent box
70
- const clampedPosition = Math.min(100, Math.max(0, newPosition));
71
- // Update the position of the slider
72
- if (slider === 'left') {
73
- setLeftSliderPosition(clampedPosition);
74
- const a = (max-min)*clampedPosition/100+min;
75
- const b = (max-min)*rightSliderPosition/100+min;
76
- setMin&&setMin(Math.min(a,b));
77
- setMax&&setMax(Math.max(a,b));
78
-
79
- } else if (slider === 'right') {
80
- setRightSliderPosition(clampedPosition);
81
- const a = (max-min)*leftSliderPosition/100+min;
82
- const b = (max-min)*clampedPosition/100+min;
83
- setMin&&setMin(Math.min(a,b));
84
- setMax&&setMax(Math.max(a,b));
85
- }
86
-
87
- };
88
-
89
- const handleMouseUp = () => {
90
- // Remove event listeners once dragging is complete
91
- document.removeEventListener('mousemove', handleMouseMove);
92
- document.removeEventListener('mouseup', handleMouseUp);
93
- onFinalize&&onFinalize();
94
- };
95
-
96
- // Add mouse move and mouse up listeners to document to handle drag
97
- document.addEventListener('mousemove', handleMouseMove);
98
- document.addEventListener('mouseup', handleMouseUp);
99
- };
100
-
101
- const leftText = Math.abs(left)<0.01&&left!=0?Number(left).toExponential(3).toUpperCase():Number(left).toFixed(3);
102
- const [leftEditedText,setLeftEditedText] = useState('');
103
- const [leftIsNaN, setLeftIsNaN] = useState(false);
104
- const leftRef = useRef<any>(null);
105
-
106
- const [rightEditing, setRightEditing] = useState(false);
107
- const [rightEditedText, setRightEditedText] = useState('');
108
- const [rightIsNaN, setRightIsNaN] = useState(false);
109
- const rightRef = useRef<any>(null);
110
-
111
- // Logic to handle right value box editing...
112
- const rightText = Math.abs(right) < 0.01 && right != 0 ? Number(right).toExponential(3).toUpperCase() : Number(right).toFixed(3);
113
-
114
- return <Box sx={{display:'flex',flexDirection:'row', paddingLeft:'4px',paddingRight:'4px'}} height={27}>
115
- {name!=''&&<Box fontSize={16} marginRight={'5pt'} color={'white'} alignItems={'center'} display={'flex'} marginBottom={'1pt'}
116
- fontFamily={'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif'}>
117
- {name}
118
- </Box>}
119
- <Box sx={{display:'flex',flexDirection:'row'}} flex={1}>
120
- <input ref={leftRef} style={{backgroundColor:'#ffffff',width:'45px', borderRadius:'2px', outline:"none",borderStyle:'none',paddingLeft:'3px',paddingRight:'3px', lineHeight:'20px',
121
- whiteSpace:'nowrap',fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif',fontSize:'11px',color:leftIsNaN?'red':'black'}} value={
122
- (leftEditing)?leftEditedText:leftText
123
- } onKeyDown={(e) => {
124
- if (e.key === 'Enter'&&!leftIsNaN) {
125
- //@ts-ignore
126
- e.target.blur(); // This will cause the input to lose focus
127
- }
128
- }} onFocus={(e)=>{
129
- setLeftEditedText(e.target.value);
130
- setLeftEditing(true);
131
- }} onChange={(event)=>{
132
- setLeftIsNaN(isNaN(Number(event.target.value)));
133
- setLeftEditedText(event.target.value);
134
- }} onBlur={(e)=>{
135
- let val = inverse(Number(leftEditedText));
136
- if(isNaN(val)) {
137
- return e.preventDefault();
138
- }
139
- setLeftEditing(false);
140
- setMin&&setMin(val);
141
- let newMin = min;
142
- if(val<min) {
143
- setMinOverride(val);
144
- newMin = val;
145
- }
146
- let leftPosition = (val-newMin)/(max-newMin)*100;
147
- setLeftSliderPosition(leftPosition);
148
- onFinalize&&onFinalize();
149
- }}/>
150
-
151
- <Box sx={{ backgroundColor: '#ffffff', flex: 1, marginLeft: '4px', marginRight: '4px', borderRadius: '2px', position: 'relative',
152
- overflow:'hidden'
153
- }} ref={sliderRef}
154
- onMouseEnter={() => setIsHovering(true)} onMouseLeave={() => setIsHovering(false)}>
155
- {/* Central gray block with two vertical black components */}
156
-
157
-
158
- {!reverse&&<Box sx={{backgroundColor:isHovering?'#b9deff':'#8ec7ff',
159
- height:'100%',position:'absolute',
160
- left:`calc(${Math.min(leftSliderPosition,rightSliderPosition+3)*0.97}%)`,
161
- right:`calc(${(100 - Math.max(leftSliderPosition-3,rightSliderPosition))*0.97}%)`,
162
- zIndex:1}}/>}
163
- {reverse&&<Box sx={{backgroundColor:isHovering?'#b9deff':'#8ec7ff',
164
- height:'100%',position:'absolute',
165
- left:`calc(${Math.max(leftSliderPosition,rightSliderPosition+3)*0.97}%)`,
166
- right:`0`,
167
- zIndex:1}}/>}
168
- {reverse&&<Box sx={{backgroundColor:isHovering?'#b9deff':'#8ec7ff',
169
- height:'100%',position:'absolute',
170
- left:`0`,
171
- right:`calc(${(100 - Math.min(leftSliderPosition-3,rightSliderPosition))*0.97}%)`,
172
- zIndex:1}}/>}
173
- <Box sx={{ position: 'absolute', left: `calc(${leftSliderPosition*0.97}% - 10px)`, width: '20px', height: '100%', cursor: 'ew-resize', zIndex: 1 }}
174
- onMouseDown={(e) => handleDragStart(e, 'left')}>
175
- {/* Visual representation of the slider */}
176
- <Box sx={{ position: 'absolute', left: '10px', width: '2px', height: '100%', backgroundColor: '#2e9eff' }} />
177
- </Box>
178
-
179
- {/* Transparent hitbox for the right slider */}
180
- <Box sx={{ position: 'absolute', right: `calc(${(100 - rightSliderPosition)*0.97}% - 10px)`, width: '20px', height: '100%', cursor: 'ew-resize', zIndex: 1 }}
181
- onMouseDown={(e) => handleDragStart(e, 'right')}>
182
- {/* Visual representation of the slider */}
183
- <Box sx={{ position: 'absolute', right: '10px', width: '2px', height: '100%', backgroundColor: '#2e9eff' }} />
184
- </Box>
185
- </Box>
186
-
187
- <input style={{backgroundColor: '#ffffff', width: '45px', borderRadius: '2px', outline: "none", borderStyle: 'none', paddingLeft: '3px', paddingRight: '3px', lineHeight: '20px',
188
- whiteSpace: 'nowrap', fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif', fontSize: '11px', color: rightIsNaN ? 'red' : 'black'}}
189
- value={(rightEditing) ? rightEditedText : rightText}
190
- ref={rightRef}
191
- onKeyDown={(e) => {
192
- if (e.key === 'Enter' && !rightIsNaN) {
193
- //@ts-ignore
194
- e.target.blur(); // This will cause the input to lose focus
195
- }
196
- }}
197
- onFocus={(e) => {
198
- setRightEditedText(e.target.value);
199
- setRightEditing(true);
200
- }}
201
- onChange={(event) => {
202
- setRightIsNaN(isNaN(Number(event.target.value)));
203
- setRightEditedText(event.target.value);
204
- }}
205
- onBlur={(e) => {
206
- let val = inverse(Number(rightEditedText));
207
- if (isNaN(val)) {
208
- return e.preventDefault();
209
- }
210
- setRightEditing(false);
211
- setMax && setMax(val);
212
- let newMax = max;
213
- if (val > max) {
214
- setMaxOverride(val);
215
- newMax = val;
216
- }
217
- let rightPosition = (val - min) / (newMax - min) * 100;
218
- setRightSliderPosition(rightPosition);
219
- onFinalize&&onFinalize();
220
- }}
221
- />
222
- </Box>
223
- </Box>
224
- }
@@ -1,36 +0,0 @@
1
- .select-box {
2
- position: relative;
3
- outline: none;
4
- }
5
-
6
- .select-box .ant-select {
7
- color: #888080;
8
- width: 205px;
9
- background: #ffffff;
10
- box-sizing: border-box;
11
- border-radius: 4px;
12
- -webkit-appearance: none;
13
- appearance: none;
14
- -webkit-outline: none;
15
- outline: none;
16
- }
17
-
18
- .select-box > .ant-select > .ant-select-selector {
19
- border: 1px solid #e5e5e5;
20
- }
21
-
22
- .select-box
23
- > .ant-select
24
- > .ant-select-selector
25
- > .ant-select-selection-placeholder,
26
- .ant-select-selection-item {
27
- font-size: 12px;
28
- line-height: 30px;
29
- color: #999999;
30
- font-weight: normal;
31
- letter-spacing: 0.1px;
32
- }
33
-
34
- .select-box > .ant-select > .ant-select-arrow {
35
- top: 65%;
36
- }
@@ -1,83 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { Select } from 'antd';
3
- import './DropDown.scss';
4
-
5
- const { Option } = Select;
6
-
7
- const CmrDropDown = (props: any) => {
8
- const [DropdownCaret, setDropdownCaret] = useState(false);
9
- const onCaretChange = () => {
10
- setDropdownCaret(!DropdownCaret);
11
- };
12
-
13
- return (
14
- <div className="select-box">
15
- <Select
16
- onFocus={onCaretChange}
17
- onBlur={onCaretChange}
18
- suffixIcon={
19
- <>
20
- <svg
21
- style={{ display: DropdownCaret ? 'none' : 'block' }}
22
- width="6"
23
- height="3"
24
- viewBox="0 0 6 3"
25
- fill="none"
26
- xmlns="http://www.w3.org/2000/svg"
27
- >
28
- <path
29
- d="M5.79875 0H0.20125C0.0333594 0 -0.0603867 0.147179 0.0435863 0.247656L2.84234 2.94215C2.92245 3.01928 3.0767 3.01928 3.15766 2.94215L5.95641 0.247656C6.06039 0.147179 5.96664 0 5.79875 0Z"
30
- fill="#999999"
31
- />
32
- </svg>
33
- <svg
34
- style={{ display: DropdownCaret ? 'block' : 'none' }}
35
- width="6"
36
- height="3"
37
- viewBox="0 0 6 3"
38
- fill="none"
39
- xmlns="http://www.w3.org/2000/svg"
40
- >
41
- <path
42
- d="M5.79875 3H0.20125C0.0333594 3 -0.0603867 2.85282 0.0435863 2.75234L2.84234 0.0578451C2.92245 -0.0192819 3.0767 -0.0192819 3.15766 0.0578451L5.95641 2.75234C6.06039 2.85282 5.96664 3 5.79875 3Z"
43
- fill="#999999"
44
- />
45
- </svg>
46
- </>
47
- }
48
- id=""
49
- disabled={props.disabled}
50
- className={props.className}
51
- placeholder={props.placeholder}
52
- value={props.value}
53
- onChange={props.onChange}
54
- dropdownClassName={props.dropdownClassName}
55
- dropdownStyle={props.dropdownStyle}
56
- defaultValue={props.defaultValue}
57
- onSelect={props.onSelect}
58
- showSearch={props.showSearch}
59
- onSearch={props.onSearch}
60
- dropdownAlign={{
61
- offset: [0, 0],
62
- overflow: {
63
- adjustY: 0,
64
- },
65
- }}
66
- >
67
- {props.isOptionsObj
68
- ? props.options.map((obj: any, i: any) => (
69
- <Option key={i} value={obj.value}>
70
- {obj.label}
71
- </Option>
72
- ))
73
- : props.options.map((opt: any, ind: any) => (
74
- <Option key={ind} value={props.options[ind]}>
75
- {props.options[ind]}
76
- </Option>
77
- ))}
78
- </Select>
79
- </div>
80
- );
81
- };
82
-
83
- export default CmrDropDown;