amotify 0.0.2 → 0.0.4
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/dist/src/@jsminAmotifyExtension/_.d.ts +4 -0
- package/dist/src/@jsminAmotifyExtension/fetch.d.ts +9 -0
- package/dist/src/@jsminAmotifyExtension/formCollect.d.ts +1 -0
- package/dist/src/@jsminAmotifyExtension/spreadSheet.d.ts +4 -0
- package/dist/src/@jsminAmotifyExtension/variables.d.ts +0 -0
- package/dist/src/@types/_.d.ts +6 -0
- package/dist/src/@types/amot.d.ts +260 -0
- package/dist/src/@types/fn.d.ts +1040 -0
- package/dist/src/@types/index.d.ts +62 -0
- package/dist/src/@types/jsminAmotifyExtension.d.ts +134 -0
- package/dist/src/@types/module.d.ts +2 -0
- package/dist/src/@types/state.d.ts +145 -0
- package/dist/src/Atoms/@export.d.ts +4 -0
- package/dist/src/Atoms/FAIcon/parts.d.ts +2 -0
- package/dist/src/Atoms/Logo/parts.d.ts +1 -0
- package/dist/src/Atoms/Various/parts.d.ts +9 -0
- package/dist/src/Functions/@export.d.ts +12 -0
- package/dist/src/Functions/Button/_.d.ts +1 -0
- package/dist/src/Functions/Cropper/parts.d.ts +1 -0
- package/dist/src/Functions/Effects/Fade.d.ts +1 -0
- package/dist/src/Functions/Effects/Ripple.d.ts +1 -0
- package/dist/src/Functions/Effects/_.d.ts +3 -0
- package/dist/src/Functions/Input/Chips/Selector.d.ts +1 -0
- package/dist/src/Functions/Input/Chips/_.d.ts +2 -0
- package/dist/src/Functions/Input/DigitCharacters.d.ts +1 -0
- package/dist/src/Functions/Input/File/_.d.ts +2 -0
- package/dist/src/Functions/Input/Hidden.d.ts +1 -0
- package/dist/src/Functions/Input/List/_.d.ts +1 -0
- package/dist/src/Functions/Input/Segmented/_.d.ts +1 -0
- package/dist/src/Functions/Input/Select/_.d.ts +1 -0
- package/dist/src/Functions/Input/Slider/_.d.ts +1 -0
- package/dist/src/Functions/Input/Switch/_.d.ts +1 -0
- package/dist/src/Functions/Input/Text.d.ts +5 -0
- package/dist/src/Functions/Input/TextArea.d.ts +1 -0
- package/dist/src/Functions/Input/Time/Picker.d.ts +1 -0
- package/dist/src/Functions/Input/Time/_.d.ts +2 -0
- package/dist/src/Functions/Input/_.d.ts +5 -0
- package/dist/src/Functions/Input/core.d.ts +34 -0
- package/dist/src/Functions/Inputs/_.d.ts +3 -0
- package/dist/src/Functions/Inputs/text.d.ts +12 -0
- package/dist/src/Functions/Layout/PageNotFound.d.ts +1 -0
- package/dist/src/Functions/Layout/PageRouter.d.ts +2 -0
- package/dist/src/Functions/Layout/PageViewController/parts.d.ts +1 -0
- package/dist/src/Functions/Layout/Plate.d.ts +1 -0
- package/dist/src/Functions/Layout/RootViewController/parts.d.ts +1 -0
- package/dist/src/Functions/Layout/SwipeView/parts.d.ts +2 -0
- package/dist/src/Functions/Layout/TabBar.d.ts +1 -0
- package/dist/src/Functions/Layout/_.d.ts +2 -0
- package/dist/src/Functions/Loader/corner.d.ts +1 -0
- package/dist/src/Functions/Loader/mini.d.ts +33 -0
- package/dist/src/Functions/Loader/parts.d.ts +3 -0
- package/dist/src/Functions/Loader/top.d.ts +1 -0
- package/dist/src/Functions/Sheet/parts.d.ts +2 -0
- package/dist/src/Functions/SnackBar/parts.d.ts +2 -0
- package/dist/src/Functions/Table/Data/parts.d.ts +3 -0
- package/dist/src/Functions/Table/Drag/parts.d.ts +1 -0
- package/dist/src/Functions/Table/Normal/parts.d.ts +1 -0
- package/dist/src/Functions/Table/_.d.ts +9 -0
- package/dist/src/Functions/Tooltips/parts.d.ts +2 -0
- package/dist/src/Global/@export.d.ts +12 -0
- package/dist/src/Global/LaunchReactApplication.d.ts +1 -0
- package/dist/src/Global/styleConverter.d.ts +2 -0
- package/dist/src/Molecules/@export.d.ts +21 -0
- package/dist/src/Molecules/Accordion/parts.d.ts +2 -0
- package/dist/src/Molecules/LinkifyText/parts.d.ts +1 -0
- package/dist/src/Molecules/List.d.ts +1 -0
- package/dist/src/Organisms/@export.d.ts +2 -0
- package/dist/src/Organisms/DisplayStyleInput/_.d.ts +1 -0
- package/dist/src/Organisms/DisplayStyleInput/darkmode.d.ts +1 -0
- package/dist/src/Organisms/DisplayStyleInput/themeColor.d.ts +27 -0
- package/dist/src/Templates/@export.d.ts +2 -0
- package/dist/src/Templates/PlayGround/parts.d.ts +1 -0
- package/dist/src/config.d.ts +16 -0
- package/dist/src/launch.d.ts +9 -0
- package/dist/src/preload.d.ts +1 -0
- package/package.json +2 -2
- package/src/@jsminAmotifyExtension/_.tsx +4 -0
- package/src/@jsminAmotifyExtension/fetch.tsx +107 -0
- package/src/@jsminAmotifyExtension/formCollect.tsx +89 -0
- package/src/@jsminAmotifyExtension/spreadSheet.tsx +159 -0
- package/src/@jsminAmotifyExtension/variables.tsx +130 -0
- package/src/@styles/@app.scss +4 -0
- package/src/@styles/@variables/customProps.scss +109 -0
- package/src/@styles/@variables/styleSet.scss +38 -0
- package/src/@styles/@variables/themeColor.scss +71 -0
- package/src/@styles/@variables/var.scss +171 -0
- package/src/@styles/UniStyling.scss +996 -0
- package/src/@styles/init.scss +154 -0
- package/src/@types/_.tsx +6 -0
- package/src/@types/amot.tsx +323 -0
- package/src/@types/fn.tsx +1210 -0
- package/src/@types/index.tsx +74 -0
- package/src/@types/jsminAmotifyExtension.tsx +143 -0
- package/src/@types/module.tsx +2 -0
- package/src/@types/state.tsx +199 -0
- package/src/Atoms/@export.tsx +32 -0
- package/src/Atoms/FAIcon/parts.tsx +117 -0
- package/src/Atoms/FAIcon/style.module.scss +9 -0
- package/src/Atoms/Logo/parts.tsx +335 -0
- package/src/Atoms/Logo/style.module.scss +96 -0
- package/src/Atoms/Various/parts.tsx +157 -0
- package/src/Atoms/Various/style.module.scss +40 -0
- package/src/Functions/@export.tsx +29 -0
- package/src/Functions/Button/_.tsx +305 -0
- package/src/Functions/Button/style.module.scss +183 -0
- package/src/Functions/Cropper/parts.tsx +1061 -0
- package/src/Functions/Cropper/style.module.scss +62 -0
- package/src/Functions/Effects/Fade.tsx +81 -0
- package/src/Functions/Effects/Ripple.tsx +141 -0
- package/src/Functions/Effects/_.tsx +33 -0
- package/src/Functions/Effects/style.module.scss +83 -0
- package/src/Functions/Input/Chips/Selector.tsx +451 -0
- package/src/Functions/Input/Chips/_.tsx +286 -0
- package/src/Functions/Input/Chips/style.module.scss +6 -0
- package/src/Functions/Input/DigitCharacters.tsx +241 -0
- package/src/Functions/Input/File/_.tsx +596 -0
- package/src/Functions/Input/File/style.module.scss +34 -0
- package/src/Functions/Input/Hidden.tsx +18 -0
- package/src/Functions/Input/List/_.tsx +383 -0
- package/src/Functions/Input/List/style.module.scss +84 -0
- package/src/Functions/Input/Segmented/_.tsx +238 -0
- package/src/Functions/Input/Segmented/style.module.scss +81 -0
- package/src/Functions/Input/Select/_.tsx +225 -0
- package/src/Functions/Input/Select/style.module.scss +10 -0
- package/src/Functions/Input/Slider/_.tsx +519 -0
- package/src/Functions/Input/Slider/style.module.scss +67 -0
- package/src/Functions/Input/Switch/_.tsx +177 -0
- package/src/Functions/Input/Switch/style.module.scss +18 -0
- package/src/Functions/Input/Text.tsx +437 -0
- package/src/Functions/Input/TextArea.tsx +115 -0
- package/src/Functions/Input/Time/Picker.tsx +950 -0
- package/src/Functions/Input/Time/_.tsx +736 -0
- package/src/Functions/Input/Time/style.module.scss +72 -0
- package/src/Functions/Input/_.tsx +793 -0
- package/src/Functions/Input/core.tsx +461 -0
- package/src/Functions/Input/style.module.scss +43 -0
- package/src/Functions/Inputs/_.tsx +5 -0
- package/src/Functions/Inputs/style.module.scss +15 -0
- package/src/Functions/Inputs/text.tsx +67 -0
- package/src/Functions/Inputs/types.d.ts +1 -0
- package/src/Functions/Layout/PageNotFound.tsx +81 -0
- package/src/Functions/Layout/PageRouter.tsx +107 -0
- package/src/Functions/Layout/PageViewController/parts.tsx +32 -0
- package/src/Functions/Layout/Plate.tsx +30 -0
- package/src/Functions/Layout/RootViewController/parts.tsx +290 -0
- package/src/Functions/Layout/RootViewController/style.module.scss +24 -0
- package/src/Functions/Layout/SwipeView/parts.tsx +380 -0
- package/src/Functions/Layout/SwipeView/style.module.scss +19 -0
- package/src/Functions/Layout/TabBar.tsx +64 -0
- package/src/Functions/Layout/_.tsx +20 -0
- package/src/Functions/Loader/corner.tsx +78 -0
- package/src/Functions/Loader/mini.tsx +117 -0
- package/src/Functions/Loader/parts.tsx +105 -0
- package/src/Functions/Loader/style.module.scss +222 -0
- package/src/Functions/Loader/top.tsx +90 -0
- package/src/Functions/Sheet/parts.tsx +972 -0
- package/src/Functions/Sheet/style.module.scss +235 -0
- package/src/Functions/SnackBar/parts.tsx +215 -0
- package/src/Functions/SnackBar/style.module.scss +25 -0
- package/src/Functions/Table/Data/parts.tsx +955 -0
- package/src/Functions/Table/Drag/parts.tsx +448 -0
- package/src/Functions/Table/Normal/parts.tsx +123 -0
- package/src/Functions/Table/_.tsx +170 -0
- package/src/Functions/Table/style.module.scss +92 -0
- package/src/Functions/Tooltips/parts.tsx +52 -0
- package/src/Global/@export.tsx +138 -0
- package/src/Global/LaunchReactApplication.tsx +30 -0
- package/src/Global/exe.tsx +0 -0
- package/src/Global/styleConverter.tsx +435 -0
- package/src/Molecules/@export.tsx +95 -0
- package/src/Molecules/Accordion/parts.tsx +146 -0
- package/src/Molecules/Accordion/style.module.scss +13 -0
- package/src/Molecules/LinkifyText/parts.tsx +54 -0
- package/src/Molecules/List.tsx +30 -0
- package/src/Organisms/@export.tsx +5 -0
- package/src/Organisms/DisplayStyleInput/_.tsx +18 -0
- package/src/Organisms/DisplayStyleInput/darkmode.tsx +112 -0
- package/src/Organisms/DisplayStyleInput/themeColor.tsx +210 -0
- package/src/Templates/@export.tsx +7 -0
- package/src/Templates/PlayGround/parts.tsx +115 -0
- package/src/Templates/PlayGround/style.module.scss +38 -0
- package/src/config.tsx +132 -0
- package/src/launch.tsx +100 -0
- package/src/preload.tsx +49 -0
- package/tsconfig.json +27 -14
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useStore
|
|
3
|
+
} from '@global';
|
|
4
|
+
import {
|
|
5
|
+
Box,
|
|
6
|
+
Flex,
|
|
7
|
+
} from '@atoms';
|
|
8
|
+
import {
|
|
9
|
+
Input,
|
|
10
|
+
Buttons
|
|
11
|
+
} from '@functions';
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
BoxWrapper,
|
|
15
|
+
SubmitForm,
|
|
16
|
+
CommonEffects
|
|
17
|
+
} from '../core';
|
|
18
|
+
import style from './style.module.scss';
|
|
19
|
+
const {
|
|
20
|
+
useState,
|
|
21
|
+
useEffect
|
|
22
|
+
} = React;
|
|
23
|
+
|
|
24
|
+
function DefaultValidation( props: {
|
|
25
|
+
value: any
|
|
26
|
+
params: any
|
|
27
|
+
} ): amotify.fn.Input.Validation.Result {
|
|
28
|
+
let { value,params } = props;
|
|
29
|
+
let { required } = params as amotify.fn.Input.TextArea.PlainParams;
|
|
30
|
+
let notice: amotify.fn.Input.Validation.NoticeTypes[] = [];
|
|
31
|
+
|
|
32
|
+
if ( required && !value ) {
|
|
33
|
+
notice.push( { type: 'invalid',label: '必須項目です' } );
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
ok: !notice.filter( ( { type } ) => type == 'invalid' ).length,
|
|
38
|
+
notice: notice
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type DataLevelingResult = {
|
|
43
|
+
stepValue: number
|
|
44
|
+
stepIndex: number
|
|
45
|
+
positionLeft: string
|
|
46
|
+
}
|
|
47
|
+
const DataLeveling: {
|
|
48
|
+
( props: {
|
|
49
|
+
value: number
|
|
50
|
+
val_status: amotify.fn.Input.Status.Slider
|
|
51
|
+
} ): DataLevelingResult
|
|
52
|
+
} = ( props ) => {
|
|
53
|
+
let { value,val_status } = props;
|
|
54
|
+
let { min,max,step } = val_status;
|
|
55
|
+
|
|
56
|
+
value = Math.max( value,min );
|
|
57
|
+
value = Math.min( value,max );
|
|
58
|
+
|
|
59
|
+
let rawValue = value / max;
|
|
60
|
+
let stepValue = rawValue * max;
|
|
61
|
+
|
|
62
|
+
stepValue = Math.round( stepValue / step );
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
stepValue: stepValue * step,
|
|
66
|
+
stepIndex: stepValue,
|
|
67
|
+
positionLeft: stepValue * step / max * 100 + '%'
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const SliderInput: FNC<amotify.fn.Input.Slider.PlainParams> = ( params ) => {
|
|
72
|
+
let {
|
|
73
|
+
color = 'theme',
|
|
74
|
+
required,
|
|
75
|
+
form = '',
|
|
76
|
+
|
|
77
|
+
legends: {
|
|
78
|
+
enable: showLegends = true,
|
|
79
|
+
custom: customLegends,
|
|
80
|
+
showAlways: showLegendsAlways = false
|
|
81
|
+
} = {},
|
|
82
|
+
min,max,step,
|
|
83
|
+
|
|
84
|
+
enableFormSubmit,
|
|
85
|
+
|
|
86
|
+
checkValidationAtFirst,
|
|
87
|
+
onChange,onKeyDown,
|
|
88
|
+
onValidate,
|
|
89
|
+
onUpdateValue,onUpdateValidValue,
|
|
90
|
+
value = '',
|
|
91
|
+
className,
|
|
92
|
+
|
|
93
|
+
...others
|
|
94
|
+
} = params;
|
|
95
|
+
|
|
96
|
+
let Default_Status: amotify.fn.Input.Status.Slider = {
|
|
97
|
+
componentID: params.componentID || '',
|
|
98
|
+
dataValue: value,
|
|
99
|
+
min,max,step,
|
|
100
|
+
eventType: 'init',
|
|
101
|
+
eventID: $.uuidGen(),
|
|
102
|
+
}
|
|
103
|
+
let [ val_status,set_status ] = useState( Default_Status );
|
|
104
|
+
let [ val_validate,set_validate ] = useState( {
|
|
105
|
+
ok: false,
|
|
106
|
+
notice: []
|
|
107
|
+
} as amotify.fn.Input.Validation.Result );
|
|
108
|
+
|
|
109
|
+
CommonEffects( {
|
|
110
|
+
params,
|
|
111
|
+
val_status,
|
|
112
|
+
set_status,
|
|
113
|
+
val_validate,
|
|
114
|
+
set_validate,
|
|
115
|
+
onUpdateValue,onUpdateValidValue,
|
|
116
|
+
DefaultValidation,
|
|
117
|
+
ExtraOverrideParams: {
|
|
118
|
+
dataValue: value
|
|
119
|
+
},
|
|
120
|
+
ExtraStoreParams: {
|
|
121
|
+
prevValue: val_status.dataValue,
|
|
122
|
+
setValueByForeign: ( value: number ) => {
|
|
123
|
+
set_status( {
|
|
124
|
+
...val_status,
|
|
125
|
+
dataValue: value,
|
|
126
|
+
eventType: 'update',
|
|
127
|
+
eventID: $.uuidGen(),
|
|
128
|
+
} );
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
} );
|
|
132
|
+
|
|
133
|
+
let DotData = DataLeveling( {
|
|
134
|
+
value: val_status.dataValue,
|
|
135
|
+
val_status
|
|
136
|
+
} );
|
|
137
|
+
|
|
138
|
+
return <BoxWrapper
|
|
139
|
+
val_status={ val_status }
|
|
140
|
+
set_status={ set_status }
|
|
141
|
+
val_validate={ val_validate }
|
|
142
|
+
params={ params }
|
|
143
|
+
>
|
|
144
|
+
<Input.Hidden
|
|
145
|
+
value={ DotData.stepValue }
|
|
146
|
+
form={ form }
|
|
147
|
+
data-value={ DotData.stepValue }
|
|
148
|
+
data-validation={ val_validate.ok }
|
|
149
|
+
data-input-type={ 'slider' }
|
|
150
|
+
{ ...others }
|
|
151
|
+
/>
|
|
152
|
+
<Box
|
|
153
|
+
flexSizing={ 'auto' }
|
|
154
|
+
className={ [
|
|
155
|
+
style.Wrap,
|
|
156
|
+
className,
|
|
157
|
+
style[ 'ShowLegendsAlways_' + showLegendsAlways ]
|
|
158
|
+
].join( ' ' ) }
|
|
159
|
+
>
|
|
160
|
+
<Comps.Rail
|
|
161
|
+
color={ color }
|
|
162
|
+
val_status={ val_status }
|
|
163
|
+
set_status={ set_status }
|
|
164
|
+
DotData={ DotData }
|
|
165
|
+
form={ form }
|
|
166
|
+
enableFormSubmit={ enableFormSubmit! }
|
|
167
|
+
/>
|
|
168
|
+
{ showLegends ? <Comps.IndicatorLabels
|
|
169
|
+
componentID={ val_status.componentID }
|
|
170
|
+
min={ min }
|
|
171
|
+
max={ max }
|
|
172
|
+
step={ step }
|
|
173
|
+
customLegends={ customLegends }
|
|
174
|
+
/> : null }
|
|
175
|
+
</Box>
|
|
176
|
+
</BoxWrapper>;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const Comps = {
|
|
180
|
+
IndicatorLabels: ( props: {
|
|
181
|
+
componentID: string
|
|
182
|
+
min: number
|
|
183
|
+
max: number
|
|
184
|
+
step: number
|
|
185
|
+
customLegends?: amotify.fn.Input.Slider.LegendsCallback
|
|
186
|
+
} ) => {
|
|
187
|
+
let {
|
|
188
|
+
componentID,
|
|
189
|
+
min,
|
|
190
|
+
max,
|
|
191
|
+
step,
|
|
192
|
+
customLegends
|
|
193
|
+
} = props;
|
|
194
|
+
let Labels = [];
|
|
195
|
+
|
|
196
|
+
let minStep = Math.round( min / step );
|
|
197
|
+
let maxStep = Math.round( max / step );
|
|
198
|
+
let steps = maxStep - minStep + 1;
|
|
199
|
+
|
|
200
|
+
for ( var index = minStep; index <= maxStep; index++ ) {
|
|
201
|
+
let value = index * step;
|
|
202
|
+
value = Math.max( value,min );
|
|
203
|
+
value = Math.min( value,max );
|
|
204
|
+
let left = ( value / max * 100 ) + '%';
|
|
205
|
+
Labels.push( <Box
|
|
206
|
+
key={ value }
|
|
207
|
+
className={ style.Label }
|
|
208
|
+
id={ 'Legend-' + componentID + '-' + index }
|
|
209
|
+
display={ index == minStep || index == maxStep ? 'flex' : 'none' }
|
|
210
|
+
position='absolute'
|
|
211
|
+
top={ 0 }
|
|
212
|
+
height={ 1 }
|
|
213
|
+
unitWidth={ 2 }
|
|
214
|
+
transition='middle'
|
|
215
|
+
fontColor={ '1.clear' }
|
|
216
|
+
freeCSS={ {
|
|
217
|
+
left: left,
|
|
218
|
+
whiteSpace: 'nowrap',
|
|
219
|
+
textAlign: 'center'
|
|
220
|
+
} }
|
|
221
|
+
verticalAlign='center'
|
|
222
|
+
horizontalAlign='center'
|
|
223
|
+
children={ customLegends ? customLegends( value ) : value.rank() }
|
|
224
|
+
/> );
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
useEffect( () => {
|
|
228
|
+
const LabelLeveling = () => {
|
|
229
|
+
let Labels = $( '#Labels-' + componentID );
|
|
230
|
+
let {
|
|
231
|
+
width
|
|
232
|
+
} = Labels.position();
|
|
233
|
+
|
|
234
|
+
let maxLabelCount = Math.round( width / 50 ) - 1;
|
|
235
|
+
let labelStep = Math.round( steps / maxLabelCount );
|
|
236
|
+
|
|
237
|
+
for ( let index = minStep + 1; index < maxStep; index++ ) {
|
|
238
|
+
$( '#Legend-' + componentID + '-' + index ).css( {
|
|
239
|
+
display: index % labelStep == 0 ? 'flex' : 'none'
|
|
240
|
+
} );
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
$( window ).addEvent( {
|
|
245
|
+
eventID: 'SliderResizeCallback-' + componentID,
|
|
246
|
+
eventType: 'resize',
|
|
247
|
+
callback: () => {
|
|
248
|
+
LabelLeveling();
|
|
249
|
+
}
|
|
250
|
+
} );
|
|
251
|
+
LabelLeveling();
|
|
252
|
+
|
|
253
|
+
return () => {
|
|
254
|
+
$( window ).removeEvent( 'SliderResizeCallback-' + componentID );
|
|
255
|
+
}
|
|
256
|
+
},[] );
|
|
257
|
+
|
|
258
|
+
return ( <Flex
|
|
259
|
+
className={ style.Labels }
|
|
260
|
+
verticalAlign='center'
|
|
261
|
+
horizontalAlign='between'
|
|
262
|
+
unitHeight={ 2 }
|
|
263
|
+
fontSize={ '0.xs' }
|
|
264
|
+
position='relative'
|
|
265
|
+
id={ 'Labels-' + componentID }
|
|
266
|
+
>
|
|
267
|
+
<Box
|
|
268
|
+
position='absolute'
|
|
269
|
+
top={ 0 }
|
|
270
|
+
left={ 0 }
|
|
271
|
+
right={ 2 }
|
|
272
|
+
bottom={ 0 }
|
|
273
|
+
children={ Labels }
|
|
274
|
+
/>
|
|
275
|
+
</Flex> );
|
|
276
|
+
},
|
|
277
|
+
Rail: ( props: {
|
|
278
|
+
color: amotify.fn.Input.Slider.ColorTypes
|
|
279
|
+
val_status: amotify.fn.Input.Status.Slider
|
|
280
|
+
set_status: React.Dispatch<React.SetStateAction<amotify.fn.Input.Status.Slider>>
|
|
281
|
+
DotData: DataLevelingResult
|
|
282
|
+
form: string
|
|
283
|
+
enableFormSubmit: boolean
|
|
284
|
+
} ) => {
|
|
285
|
+
let {
|
|
286
|
+
val_status,
|
|
287
|
+
set_status,
|
|
288
|
+
DotData,
|
|
289
|
+
form,
|
|
290
|
+
enableFormSubmit
|
|
291
|
+
} = props;
|
|
292
|
+
let {
|
|
293
|
+
componentID
|
|
294
|
+
} = val_status;
|
|
295
|
+
|
|
296
|
+
return ( <Flex
|
|
297
|
+
className={ style.Rail }
|
|
298
|
+
position='relative'
|
|
299
|
+
paddingLeft={ '1/2' }
|
|
300
|
+
unitHeight={ 2 }
|
|
301
|
+
verticalAlign='center'
|
|
302
|
+
freeCSS={ {
|
|
303
|
+
minWidth: '10rem',
|
|
304
|
+
zIndex: 1,
|
|
305
|
+
cursor: 'pointer'
|
|
306
|
+
} }
|
|
307
|
+
onMouseDown={ ( event ) => {
|
|
308
|
+
event.stopPropagation();
|
|
309
|
+
EffectStart( event,{
|
|
310
|
+
val_status,
|
|
311
|
+
set_status,
|
|
312
|
+
DotData
|
|
313
|
+
} );
|
|
314
|
+
} }
|
|
315
|
+
onTouchStart={ ( event ) => {
|
|
316
|
+
event.stopPropagation();
|
|
317
|
+
EffectStart( event,{
|
|
318
|
+
val_status,
|
|
319
|
+
set_status,
|
|
320
|
+
DotData
|
|
321
|
+
} );
|
|
322
|
+
} }
|
|
323
|
+
>
|
|
324
|
+
<Box
|
|
325
|
+
className={ style.Bar }
|
|
326
|
+
backgroundColor={ '4.layer.darken' }
|
|
327
|
+
position='relative'
|
|
328
|
+
borderRadius={ 'sphere' }
|
|
329
|
+
transition='middle'
|
|
330
|
+
flexSizing={ 'none' }
|
|
331
|
+
unitHeight={ '2/3' }
|
|
332
|
+
width={ 1 }
|
|
333
|
+
id={ componentID + '_Bar' }
|
|
334
|
+
>
|
|
335
|
+
<Box
|
|
336
|
+
className={ style.BarColor }
|
|
337
|
+
position='relative'
|
|
338
|
+
height={ 1 }
|
|
339
|
+
width={ 0 }
|
|
340
|
+
left={ 0 }
|
|
341
|
+
transition='long'
|
|
342
|
+
borderRadius={ 'inherit' }
|
|
343
|
+
backgroundColor={ props.color }
|
|
344
|
+
opacity='middle'
|
|
345
|
+
overflow='hidden'
|
|
346
|
+
freeCSS={ {
|
|
347
|
+
width: DotData.positionLeft
|
|
348
|
+
} }
|
|
349
|
+
id={ componentID + '_BarColor' }
|
|
350
|
+
/>
|
|
351
|
+
</Box>
|
|
352
|
+
<Box
|
|
353
|
+
className={ style.BallWrap }
|
|
354
|
+
position='absolute'
|
|
355
|
+
top={ 0 }
|
|
356
|
+
left={ 0 }
|
|
357
|
+
right={ 2 }
|
|
358
|
+
bottom={ 0 }
|
|
359
|
+
>
|
|
360
|
+
<Buttons.Button.Plain
|
|
361
|
+
className={ style.Ball }
|
|
362
|
+
position='absolute'
|
|
363
|
+
backgroundColor={ props.color }
|
|
364
|
+
top={ 0 }
|
|
365
|
+
left={ 0 }
|
|
366
|
+
ssSphere={ 2 }
|
|
367
|
+
freeCSS={ {
|
|
368
|
+
zIndex: 2,
|
|
369
|
+
left: DotData.positionLeft
|
|
370
|
+
} }
|
|
371
|
+
data-form-name={ form }
|
|
372
|
+
id={ componentID + '_Ball' }
|
|
373
|
+
onKeyDown={ ( event ) => {
|
|
374
|
+
KeyDownEvent( {
|
|
375
|
+
event,
|
|
376
|
+
val_status,
|
|
377
|
+
set_status,
|
|
378
|
+
DotData
|
|
379
|
+
} );
|
|
380
|
+
|
|
381
|
+
if ( enableFormSubmit ) SubmitForm( event );
|
|
382
|
+
} }
|
|
383
|
+
/>
|
|
384
|
+
</Box>
|
|
385
|
+
</Flex> );
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const EffectStart = ( event: any,info: {
|
|
390
|
+
val_status: amotify.fn.Input.Status.Slider
|
|
391
|
+
set_status: React.Dispatch<React.SetStateAction<amotify.fn.Input.Status.Slider>>
|
|
392
|
+
DotData: DataLevelingResult
|
|
393
|
+
} ) => {
|
|
394
|
+
$( document )
|
|
395
|
+
.addEvent( {
|
|
396
|
+
eventID: 'SliderMouseMove',
|
|
397
|
+
eventType: 'mousemove',
|
|
398
|
+
callback: ( event ) => { EffectMove( event,info ); },
|
|
399
|
+
option: { passive: false }
|
|
400
|
+
} )
|
|
401
|
+
.addEvent( {
|
|
402
|
+
eventID: 'SliderTouchMove',
|
|
403
|
+
eventType: 'touchmove',
|
|
404
|
+
callback: ( event ) => { EffectMove( event,info ); },
|
|
405
|
+
option: { passive: false }
|
|
406
|
+
} )
|
|
407
|
+
.addEvent( {
|
|
408
|
+
eventID: 'SliderMouseUp',
|
|
409
|
+
eventType: 'mouseup',
|
|
410
|
+
callback: () => { EffectEnd(); }
|
|
411
|
+
} )
|
|
412
|
+
.addEvent( {
|
|
413
|
+
eventID: 'SliderTouchEnd',
|
|
414
|
+
eventType: 'touchend',
|
|
415
|
+
callback: () => { EffectEnd(); }
|
|
416
|
+
} )
|
|
417
|
+
}
|
|
418
|
+
const EffectMove = ( event: any,info: {
|
|
419
|
+
val_status: amotify.fn.Input.Status.Slider
|
|
420
|
+
set_status: React.Dispatch<React.SetStateAction<amotify.fn.Input.Status.Slider>>
|
|
421
|
+
} ) => {
|
|
422
|
+
let mouseX = $.getCursor( event ).x;
|
|
423
|
+
let {
|
|
424
|
+
val_status,
|
|
425
|
+
set_status,
|
|
426
|
+
} = info;
|
|
427
|
+
let {
|
|
428
|
+
componentID,
|
|
429
|
+
min,max
|
|
430
|
+
} = val_status;
|
|
431
|
+
|
|
432
|
+
let Ball = $( '#' + componentID + '_Ball' );
|
|
433
|
+
let Bar = $( '#' + componentID + '_Bar' );
|
|
434
|
+
let BarColor = $( '#' + componentID + '_BarColor' );
|
|
435
|
+
|
|
436
|
+
let { width: barWidth,left: barLeft } = Bar.position();
|
|
437
|
+
|
|
438
|
+
let Left = ( mouseX - barLeft ) / barWidth;
|
|
439
|
+
Left = Math.max( Left,0 );
|
|
440
|
+
Left = Math.min( Left,1 );
|
|
441
|
+
|
|
442
|
+
let LeftRawValue = Left * max;
|
|
443
|
+
let resultValues = DataLeveling( {
|
|
444
|
+
value: LeftRawValue,
|
|
445
|
+
val_status
|
|
446
|
+
} );
|
|
447
|
+
let left = resultValues.positionLeft;
|
|
448
|
+
let stepValue = resultValues.stepValue;
|
|
449
|
+
|
|
450
|
+
Ball.css( { left: left } );
|
|
451
|
+
BarColor.css( { width: left } );
|
|
452
|
+
|
|
453
|
+
let { prevValue } = useStore.get( componentID );
|
|
454
|
+
if ( stepValue != prevValue ) {
|
|
455
|
+
useStore.update( {
|
|
456
|
+
key: componentID,
|
|
457
|
+
value: {
|
|
458
|
+
prevValue: stepValue
|
|
459
|
+
}
|
|
460
|
+
} );
|
|
461
|
+
set_status( {
|
|
462
|
+
...val_status,
|
|
463
|
+
dataValue: stepValue,
|
|
464
|
+
eventType: 'update',
|
|
465
|
+
eventID: $.uuidGen(),
|
|
466
|
+
} )
|
|
467
|
+
}
|
|
468
|
+
event.preventDefault();
|
|
469
|
+
event.stopPropagation();
|
|
470
|
+
return false;
|
|
471
|
+
}
|
|
472
|
+
const EffectEnd = () => {
|
|
473
|
+
$( document ).removeEvent( [ 'SliderMouseMove','SliderTouchMove','SliderMouseUp','SliderTouchEnd' ] )
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
const KeyDownEvent = (
|
|
477
|
+
props: {
|
|
478
|
+
event: React.KeyboardEvent<HTMLButtonElement>
|
|
479
|
+
val_status: amotify.fn.Input.Status.Slider
|
|
480
|
+
set_status: React.Dispatch<React.SetStateAction<amotify.fn.Input.Status.Slider>>
|
|
481
|
+
DotData: DataLevelingResult
|
|
482
|
+
}
|
|
483
|
+
) => {
|
|
484
|
+
let {
|
|
485
|
+
event,
|
|
486
|
+
val_status,
|
|
487
|
+
set_status
|
|
488
|
+
} = props;
|
|
489
|
+
let { min,max,step } = val_status;
|
|
490
|
+
let { key,metaKey,ctrlKey } = event;
|
|
491
|
+
let auxKey = ctrlKey || metaKey;
|
|
492
|
+
|
|
493
|
+
let nextValue = val_status.dataValue;
|
|
494
|
+
if ( !key.match( /Arrow/ ) ) return;
|
|
495
|
+
|
|
496
|
+
event.preventDefault();
|
|
497
|
+
if ( key.match( /Left|Up/ ) ) {
|
|
498
|
+
if ( auxKey ) nextValue = min;
|
|
499
|
+
else nextValue -= step;
|
|
500
|
+
} else if ( key.match( /Right|Down/ ) ) {
|
|
501
|
+
if ( auxKey ) nextValue = max;
|
|
502
|
+
else nextValue += step;
|
|
503
|
+
}
|
|
504
|
+
nextValue = Math.max( Math.min( nextValue,max ),min );
|
|
505
|
+
|
|
506
|
+
useStore.update( {
|
|
507
|
+
key: val_status.componentID,
|
|
508
|
+
value: {
|
|
509
|
+
prevValue: nextValue
|
|
510
|
+
}
|
|
511
|
+
} );
|
|
512
|
+
|
|
513
|
+
set_status( {
|
|
514
|
+
...val_status,
|
|
515
|
+
dataValue: nextValue,
|
|
516
|
+
eventType: 'update',
|
|
517
|
+
eventID: $.uuidGen(),
|
|
518
|
+
} );
|
|
519
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
@use '@uniVar' as *;
|
|
2
|
+
@use'@styleSet' as *;
|
|
3
|
+
.Label {
|
|
4
|
+
&:before {
|
|
5
|
+
content: "";
|
|
6
|
+
position: absolute;
|
|
7
|
+
top: calc(-1 * $unit1 / 6);
|
|
8
|
+
height: calc($unit1 / 2);
|
|
9
|
+
left: 50%;
|
|
10
|
+
width: 1px;
|
|
11
|
+
transform: translateX(-50%);
|
|
12
|
+
background-color: $font-color4;
|
|
13
|
+
}
|
|
14
|
+
&:not( :first-child):not( :last-child) {
|
|
15
|
+
opacity: 0;
|
|
16
|
+
}
|
|
17
|
+
&:first-child, &:last-child {
|
|
18
|
+
opacity: .6;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
.Wrap {
|
|
22
|
+
&:hover {
|
|
23
|
+
.Rail {
|
|
24
|
+
.Bar {
|
|
25
|
+
background-color: $color-layer5;
|
|
26
|
+
.BarColor {
|
|
27
|
+
opacity: 1 !important;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
+ .Labels .Label {
|
|
31
|
+
opacity: .75;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
&.ShowLegendsAlways_true {
|
|
36
|
+
.Label {
|
|
37
|
+
opacity: 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
.Rail {
|
|
41
|
+
user-select: none;
|
|
42
|
+
-webkit-user-select: none;
|
|
43
|
+
* {
|
|
44
|
+
user-select: none;
|
|
45
|
+
-webkit-user-select: none;
|
|
46
|
+
}
|
|
47
|
+
.Ball {
|
|
48
|
+
transition: box-shadow $animation-time-middle, left .1s;
|
|
49
|
+
&:focus {
|
|
50
|
+
box-shadow: 0 0 0 $unit2_3 hsla(var(--color-layer5-hsl), .4);
|
|
51
|
+
}
|
|
52
|
+
&:before {
|
|
53
|
+
@include absoluteCovered();
|
|
54
|
+
border-radius: 100rem;
|
|
55
|
+
box-shadow: $shadow1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
&:active {
|
|
59
|
+
.Ball {
|
|
60
|
+
box-shadow: 0 0 0 $unit2_3 hsla(var(--color-layer5-hsl), .4);
|
|
61
|
+
}
|
|
62
|
+
+ .Labels .Label {
|
|
63
|
+
opacity: 1;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|