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.
Files changed (185) hide show
  1. package/dist/src/@jsminAmotifyExtension/_.d.ts +4 -0
  2. package/dist/src/@jsminAmotifyExtension/fetch.d.ts +9 -0
  3. package/dist/src/@jsminAmotifyExtension/formCollect.d.ts +1 -0
  4. package/dist/src/@jsminAmotifyExtension/spreadSheet.d.ts +4 -0
  5. package/dist/src/@jsminAmotifyExtension/variables.d.ts +0 -0
  6. package/dist/src/@types/_.d.ts +6 -0
  7. package/dist/src/@types/amot.d.ts +260 -0
  8. package/dist/src/@types/fn.d.ts +1040 -0
  9. package/dist/src/@types/index.d.ts +62 -0
  10. package/dist/src/@types/jsminAmotifyExtension.d.ts +134 -0
  11. package/dist/src/@types/module.d.ts +2 -0
  12. package/dist/src/@types/state.d.ts +145 -0
  13. package/dist/src/Atoms/@export.d.ts +4 -0
  14. package/dist/src/Atoms/FAIcon/parts.d.ts +2 -0
  15. package/dist/src/Atoms/Logo/parts.d.ts +1 -0
  16. package/dist/src/Atoms/Various/parts.d.ts +9 -0
  17. package/dist/src/Functions/@export.d.ts +12 -0
  18. package/dist/src/Functions/Button/_.d.ts +1 -0
  19. package/dist/src/Functions/Cropper/parts.d.ts +1 -0
  20. package/dist/src/Functions/Effects/Fade.d.ts +1 -0
  21. package/dist/src/Functions/Effects/Ripple.d.ts +1 -0
  22. package/dist/src/Functions/Effects/_.d.ts +3 -0
  23. package/dist/src/Functions/Input/Chips/Selector.d.ts +1 -0
  24. package/dist/src/Functions/Input/Chips/_.d.ts +2 -0
  25. package/dist/src/Functions/Input/DigitCharacters.d.ts +1 -0
  26. package/dist/src/Functions/Input/File/_.d.ts +2 -0
  27. package/dist/src/Functions/Input/Hidden.d.ts +1 -0
  28. package/dist/src/Functions/Input/List/_.d.ts +1 -0
  29. package/dist/src/Functions/Input/Segmented/_.d.ts +1 -0
  30. package/dist/src/Functions/Input/Select/_.d.ts +1 -0
  31. package/dist/src/Functions/Input/Slider/_.d.ts +1 -0
  32. package/dist/src/Functions/Input/Switch/_.d.ts +1 -0
  33. package/dist/src/Functions/Input/Text.d.ts +5 -0
  34. package/dist/src/Functions/Input/TextArea.d.ts +1 -0
  35. package/dist/src/Functions/Input/Time/Picker.d.ts +1 -0
  36. package/dist/src/Functions/Input/Time/_.d.ts +2 -0
  37. package/dist/src/Functions/Input/_.d.ts +5 -0
  38. package/dist/src/Functions/Input/core.d.ts +34 -0
  39. package/dist/src/Functions/Inputs/_.d.ts +3 -0
  40. package/dist/src/Functions/Inputs/text.d.ts +12 -0
  41. package/dist/src/Functions/Layout/PageNotFound.d.ts +1 -0
  42. package/dist/src/Functions/Layout/PageRouter.d.ts +2 -0
  43. package/dist/src/Functions/Layout/PageViewController/parts.d.ts +1 -0
  44. package/dist/src/Functions/Layout/Plate.d.ts +1 -0
  45. package/dist/src/Functions/Layout/RootViewController/parts.d.ts +1 -0
  46. package/dist/src/Functions/Layout/SwipeView/parts.d.ts +2 -0
  47. package/dist/src/Functions/Layout/TabBar.d.ts +1 -0
  48. package/dist/src/Functions/Layout/_.d.ts +2 -0
  49. package/dist/src/Functions/Loader/corner.d.ts +1 -0
  50. package/dist/src/Functions/Loader/mini.d.ts +33 -0
  51. package/dist/src/Functions/Loader/parts.d.ts +3 -0
  52. package/dist/src/Functions/Loader/top.d.ts +1 -0
  53. package/dist/src/Functions/Sheet/parts.d.ts +2 -0
  54. package/dist/src/Functions/SnackBar/parts.d.ts +2 -0
  55. package/dist/src/Functions/Table/Data/parts.d.ts +3 -0
  56. package/dist/src/Functions/Table/Drag/parts.d.ts +1 -0
  57. package/dist/src/Functions/Table/Normal/parts.d.ts +1 -0
  58. package/dist/src/Functions/Table/_.d.ts +9 -0
  59. package/dist/src/Functions/Tooltips/parts.d.ts +2 -0
  60. package/dist/src/Global/@export.d.ts +12 -0
  61. package/dist/src/Global/LaunchReactApplication.d.ts +1 -0
  62. package/dist/src/Global/styleConverter.d.ts +2 -0
  63. package/dist/src/Molecules/@export.d.ts +21 -0
  64. package/dist/src/Molecules/Accordion/parts.d.ts +2 -0
  65. package/dist/src/Molecules/LinkifyText/parts.d.ts +1 -0
  66. package/dist/src/Molecules/List.d.ts +1 -0
  67. package/dist/src/Organisms/@export.d.ts +2 -0
  68. package/dist/src/Organisms/DisplayStyleInput/_.d.ts +1 -0
  69. package/dist/src/Organisms/DisplayStyleInput/darkmode.d.ts +1 -0
  70. package/dist/src/Organisms/DisplayStyleInput/themeColor.d.ts +27 -0
  71. package/dist/src/Templates/@export.d.ts +2 -0
  72. package/dist/src/Templates/PlayGround/parts.d.ts +1 -0
  73. package/dist/src/config.d.ts +16 -0
  74. package/dist/src/launch.d.ts +9 -0
  75. package/dist/src/preload.d.ts +1 -0
  76. package/package.json +2 -2
  77. package/src/@jsminAmotifyExtension/_.tsx +4 -0
  78. package/src/@jsminAmotifyExtension/fetch.tsx +107 -0
  79. package/src/@jsminAmotifyExtension/formCollect.tsx +89 -0
  80. package/src/@jsminAmotifyExtension/spreadSheet.tsx +159 -0
  81. package/src/@jsminAmotifyExtension/variables.tsx +130 -0
  82. package/src/@styles/@app.scss +4 -0
  83. package/src/@styles/@variables/customProps.scss +109 -0
  84. package/src/@styles/@variables/styleSet.scss +38 -0
  85. package/src/@styles/@variables/themeColor.scss +71 -0
  86. package/src/@styles/@variables/var.scss +171 -0
  87. package/src/@styles/UniStyling.scss +996 -0
  88. package/src/@styles/init.scss +154 -0
  89. package/src/@types/_.tsx +6 -0
  90. package/src/@types/amot.tsx +323 -0
  91. package/src/@types/fn.tsx +1210 -0
  92. package/src/@types/index.tsx +74 -0
  93. package/src/@types/jsminAmotifyExtension.tsx +143 -0
  94. package/src/@types/module.tsx +2 -0
  95. package/src/@types/state.tsx +199 -0
  96. package/src/Atoms/@export.tsx +32 -0
  97. package/src/Atoms/FAIcon/parts.tsx +117 -0
  98. package/src/Atoms/FAIcon/style.module.scss +9 -0
  99. package/src/Atoms/Logo/parts.tsx +335 -0
  100. package/src/Atoms/Logo/style.module.scss +96 -0
  101. package/src/Atoms/Various/parts.tsx +157 -0
  102. package/src/Atoms/Various/style.module.scss +40 -0
  103. package/src/Functions/@export.tsx +29 -0
  104. package/src/Functions/Button/_.tsx +305 -0
  105. package/src/Functions/Button/style.module.scss +183 -0
  106. package/src/Functions/Cropper/parts.tsx +1061 -0
  107. package/src/Functions/Cropper/style.module.scss +62 -0
  108. package/src/Functions/Effects/Fade.tsx +81 -0
  109. package/src/Functions/Effects/Ripple.tsx +141 -0
  110. package/src/Functions/Effects/_.tsx +33 -0
  111. package/src/Functions/Effects/style.module.scss +83 -0
  112. package/src/Functions/Input/Chips/Selector.tsx +451 -0
  113. package/src/Functions/Input/Chips/_.tsx +286 -0
  114. package/src/Functions/Input/Chips/style.module.scss +6 -0
  115. package/src/Functions/Input/DigitCharacters.tsx +241 -0
  116. package/src/Functions/Input/File/_.tsx +596 -0
  117. package/src/Functions/Input/File/style.module.scss +34 -0
  118. package/src/Functions/Input/Hidden.tsx +18 -0
  119. package/src/Functions/Input/List/_.tsx +383 -0
  120. package/src/Functions/Input/List/style.module.scss +84 -0
  121. package/src/Functions/Input/Segmented/_.tsx +238 -0
  122. package/src/Functions/Input/Segmented/style.module.scss +81 -0
  123. package/src/Functions/Input/Select/_.tsx +225 -0
  124. package/src/Functions/Input/Select/style.module.scss +10 -0
  125. package/src/Functions/Input/Slider/_.tsx +519 -0
  126. package/src/Functions/Input/Slider/style.module.scss +67 -0
  127. package/src/Functions/Input/Switch/_.tsx +177 -0
  128. package/src/Functions/Input/Switch/style.module.scss +18 -0
  129. package/src/Functions/Input/Text.tsx +437 -0
  130. package/src/Functions/Input/TextArea.tsx +115 -0
  131. package/src/Functions/Input/Time/Picker.tsx +950 -0
  132. package/src/Functions/Input/Time/_.tsx +736 -0
  133. package/src/Functions/Input/Time/style.module.scss +72 -0
  134. package/src/Functions/Input/_.tsx +793 -0
  135. package/src/Functions/Input/core.tsx +461 -0
  136. package/src/Functions/Input/style.module.scss +43 -0
  137. package/src/Functions/Inputs/_.tsx +5 -0
  138. package/src/Functions/Inputs/style.module.scss +15 -0
  139. package/src/Functions/Inputs/text.tsx +67 -0
  140. package/src/Functions/Inputs/types.d.ts +1 -0
  141. package/src/Functions/Layout/PageNotFound.tsx +81 -0
  142. package/src/Functions/Layout/PageRouter.tsx +107 -0
  143. package/src/Functions/Layout/PageViewController/parts.tsx +32 -0
  144. package/src/Functions/Layout/Plate.tsx +30 -0
  145. package/src/Functions/Layout/RootViewController/parts.tsx +290 -0
  146. package/src/Functions/Layout/RootViewController/style.module.scss +24 -0
  147. package/src/Functions/Layout/SwipeView/parts.tsx +380 -0
  148. package/src/Functions/Layout/SwipeView/style.module.scss +19 -0
  149. package/src/Functions/Layout/TabBar.tsx +64 -0
  150. package/src/Functions/Layout/_.tsx +20 -0
  151. package/src/Functions/Loader/corner.tsx +78 -0
  152. package/src/Functions/Loader/mini.tsx +117 -0
  153. package/src/Functions/Loader/parts.tsx +105 -0
  154. package/src/Functions/Loader/style.module.scss +222 -0
  155. package/src/Functions/Loader/top.tsx +90 -0
  156. package/src/Functions/Sheet/parts.tsx +972 -0
  157. package/src/Functions/Sheet/style.module.scss +235 -0
  158. package/src/Functions/SnackBar/parts.tsx +215 -0
  159. package/src/Functions/SnackBar/style.module.scss +25 -0
  160. package/src/Functions/Table/Data/parts.tsx +955 -0
  161. package/src/Functions/Table/Drag/parts.tsx +448 -0
  162. package/src/Functions/Table/Normal/parts.tsx +123 -0
  163. package/src/Functions/Table/_.tsx +170 -0
  164. package/src/Functions/Table/style.module.scss +92 -0
  165. package/src/Functions/Tooltips/parts.tsx +52 -0
  166. package/src/Global/@export.tsx +138 -0
  167. package/src/Global/LaunchReactApplication.tsx +30 -0
  168. package/src/Global/exe.tsx +0 -0
  169. package/src/Global/styleConverter.tsx +435 -0
  170. package/src/Molecules/@export.tsx +95 -0
  171. package/src/Molecules/Accordion/parts.tsx +146 -0
  172. package/src/Molecules/Accordion/style.module.scss +13 -0
  173. package/src/Molecules/LinkifyText/parts.tsx +54 -0
  174. package/src/Molecules/List.tsx +30 -0
  175. package/src/Organisms/@export.tsx +5 -0
  176. package/src/Organisms/DisplayStyleInput/_.tsx +18 -0
  177. package/src/Organisms/DisplayStyleInput/darkmode.tsx +112 -0
  178. package/src/Organisms/DisplayStyleInput/themeColor.tsx +210 -0
  179. package/src/Templates/@export.tsx +7 -0
  180. package/src/Templates/PlayGround/parts.tsx +115 -0
  181. package/src/Templates/PlayGround/style.module.scss +38 -0
  182. package/src/config.tsx +132 -0
  183. package/src/launch.tsx +100 -0
  184. package/src/preload.tsx +49 -0
  185. 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
+ }