amotify 0.0.59 → 0.0.60
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/@types/_.tsx +5 -5
- package/@types/amot.tsx +11 -11
- package/@types/fn.tsx +1 -1
- package/@types/module.tsx +1 -1
- package/dist/amotify.js +1 -1
- package/dist/amotify.min.css +3 -3
- package/package.json +1 -1
- package/src/@atoms.tsx +3 -3
- package/src/@functions.tsx +11 -11
- package/src/@global.tsx +40 -40
- package/src/@jsminAmotifyExtension/_.tsx +4 -4
- package/src/@jsminAmotifyExtension/fetch.tsx +30 -30
- package/src/@jsminAmotifyExtension/formCollect.tsx +32 -32
- package/src/@jsminAmotifyExtension/spreadSheet.tsx +71 -71
- package/src/@jsminAmotifyExtension/variables.tsx +38 -38
- package/src/@molecules.tsx +6 -6
- package/src/@styles/props.scss +1 -1
- package/src/@styles/var.scss +0 -1
- package/src/@templates.tsx +1 -1
- package/src/@variables.tsx +2 -2
- package/src/atoms/FAI/parts.tsx +105 -105
- package/src/atoms/Logo/parts.tsx +19 -19
- package/src/atoms/Various/parts.tsx +26 -26
- package/src/config.tsx +62 -59
- package/src/functions/Button/_.tsx +49 -49
- package/src/functions/Cropper/parts.tsx +249 -249
- package/src/functions/Effects/Fade.tsx +18 -18
- package/src/functions/Effects/Ripple.tsx +24 -24
- package/src/functions/Effects/_.tsx +5 -5
- package/src/functions/Input/Chips/Selector.tsx +107 -107
- package/src/functions/Input/Chips/_.tsx +66 -66
- package/src/functions/Input/Contenteditable.tsx +18 -18
- package/src/functions/Input/DigitCharacters.tsx +48 -48
- package/src/functions/Input/File/_.tsx +114 -114
- package/src/functions/Input/Hidden.tsx +3 -3
- package/src/functions/Input/List/_.tsx +61 -61
- package/src/functions/Input/RichSelect/_.tsx +38 -38
- package/src/functions/Input/Segmented/_.tsx +30 -30
- package/src/functions/Input/Select/_.tsx +42 -42
- package/src/functions/Input/Slider/_.tsx +93 -93
- package/src/functions/Input/Switch/_.tsx +21 -21
- package/src/functions/Input/Text.tsx +99 -97
- package/src/functions/Input/TextArea.tsx +17 -17
- package/src/functions/Input/Time/Picker.tsx +199 -199
- package/src/functions/Input/Time/_.tsx +173 -173
- package/src/functions/Input/_.tsx +135 -135
- package/src/functions/Input/core.tsx +96 -96
- package/src/functions/Inputs/_.tsx +1 -1
- package/src/functions/Inputs/text.tsx +5 -5
- package/src/functions/Layout/PageNotFound.tsx +6 -6
- package/src/functions/Layout/PageRouter.tsx +34 -34
- package/src/functions/Layout/PageViewController/parts.tsx +7 -7
- package/src/functions/Layout/Plate.tsx +5 -5
- package/src/functions/Layout/RootViewController/parts.tsx +53 -53
- package/src/functions/Layout/SwipeView/parts.tsx +90 -90
- package/src/functions/Layout/TabBar.tsx +10 -10
- package/src/functions/Layout/_.tsx +7 -7
- package/src/functions/Loader/corner.tsx +10 -10
- package/src/functions/Loader/mini.tsx +25 -25
- package/src/functions/Loader/parts.tsx +31 -31
- package/src/functions/Loader/top.tsx +10 -10
- package/src/functions/Sheet/parts.tsx +219 -219
- package/src/functions/Sheet/style.module.scss +0 -20
- package/src/functions/SnackBar/parts.tsx +50 -50
- package/src/functions/Table/Data/parts.tsx +202 -202
- package/src/functions/Table/Drag/parts.tsx +76 -76
- package/src/functions/Table/Normal/parts.tsx +23 -23
- package/src/functions/Table/_.tsx +33 -33
- package/src/functions/Tooltips/parts.tsx +7 -7
- package/src/global/LaunchReactApplication.tsx +28 -28
- package/src/global/styleConverter.tsx +133 -133
- package/src/launch.tsx +27 -27
- package/src/molecules/Accordion/parts.tsx +41 -41
- package/src/molecules/LinkifyText/parts.tsx +18 -18
- package/src/molecules/List.tsx +6 -6
- package/src/preload.tsx +5 -45
- package/src/templates/PlayGround/parts.tsx +8 -8
- package/webpack.config.js +9 -9
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useStore,
|
|
3
3
|
React
|
|
4
|
-
} from '@global'
|
|
4
|
+
} from '@global'
|
|
5
5
|
import {
|
|
6
6
|
Box
|
|
7
|
-
} from '@atoms'
|
|
7
|
+
} from '@atoms'
|
|
8
8
|
import {
|
|
9
9
|
Input,
|
|
10
10
|
Buttons,
|
|
11
11
|
Tooltips
|
|
12
|
-
} from '@fn'
|
|
12
|
+
} from '@fn'
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
15
|
BoxWrapper,
|
|
16
16
|
SubmitForm,
|
|
17
17
|
ValidationCheck,
|
|
18
18
|
CommonEffects
|
|
19
|
-
} from '../core'
|
|
20
|
-
import { Picker } from './Picker'
|
|
19
|
+
} from '../core'
|
|
20
|
+
import { Picker } from './Picker'
|
|
21
21
|
|
|
22
|
-
const PeriodMargin = ' ~ '
|
|
22
|
+
const PeriodMargin = ' ~ '
|
|
23
23
|
|
|
24
24
|
const TimeFormatDatas: {
|
|
25
25
|
[ key: string ]: {
|
|
@@ -95,52 +95,52 @@ const DataLeveling = ( params: {
|
|
|
95
95
|
restrict,
|
|
96
96
|
value,
|
|
97
97
|
era
|
|
98
|
-
} = params
|
|
98
|
+
} = params
|
|
99
99
|
|
|
100
|
-
let dataValue = $.flatArray( value || '' )
|
|
100
|
+
let dataValue = $.flatArray( value || '' )
|
|
101
101
|
|
|
102
102
|
let {
|
|
103
103
|
defaultValue,
|
|
104
104
|
format,
|
|
105
105
|
ranges,
|
|
106
106
|
sets
|
|
107
|
-
} = TimeFormatDatas[ restrict ]
|
|
108
|
-
let formatValues: string[] = []
|
|
107
|
+
} = TimeFormatDatas[ restrict ]
|
|
108
|
+
let formatValues: string[] = []
|
|
109
109
|
|
|
110
|
-
let separateStr = restrict == 'clock' ? ':' : '/'
|
|
110
|
+
let separateStr = restrict == 'clock' ? ':' : '/'
|
|
111
111
|
for ( let index = 0; index < dataValue.length; index++ ) {
|
|
112
|
-
dataValue[ index ] = String( dataValue[ index ] ).replace( /\D/ig,separateStr )
|
|
112
|
+
dataValue[ index ] = String( dataValue[ index ] ).replace( /\D/ig,separateStr )
|
|
113
113
|
}
|
|
114
114
|
for ( let index = 0; index < sets; index++ ) {
|
|
115
|
-
let val = dataValue[ index ] || ''
|
|
115
|
+
let val = dataValue[ index ] || ''
|
|
116
116
|
if ( !val.match( format ) ) {
|
|
117
|
-
dataValue[ index ] = ''
|
|
118
|
-
formatValues.push( defaultValue )
|
|
117
|
+
dataValue[ index ] = ''
|
|
118
|
+
formatValues.push( defaultValue )
|
|
119
119
|
} else {
|
|
120
|
-
let _value = defaultValue
|
|
120
|
+
let _value = defaultValue
|
|
121
121
|
val.split( /\D/ ).forEach( ( v: string,i: number ) => {
|
|
122
122
|
if ( i == 0 && restrict == 'dateWareki' ) {
|
|
123
|
-
let Year = Number( v )
|
|
123
|
+
let Year = Number( v )
|
|
124
124
|
if ( era != 'year' ) {
|
|
125
125
|
if ( Year >= 2019 ) {
|
|
126
|
-
if ( era == 'reiwa' ) Year -= ( 2019 - 1 )
|
|
127
|
-
else if ( era == 'heisei' ) Year = 31
|
|
126
|
+
if ( era == 'reiwa' ) Year -= ( 2019 - 1 )
|
|
127
|
+
else if ( era == 'heisei' ) Year = 31
|
|
128
128
|
} else if ( Year >= 1989 ) {
|
|
129
|
-
if ( era == 'heisei' ) Year -= ( 1989 - 1 )
|
|
130
|
-
else if ( era == 'shouwa' ) Year = 64
|
|
129
|
+
if ( era == 'heisei' ) Year -= ( 1989 - 1 )
|
|
130
|
+
else if ( era == 'shouwa' ) Year = 64
|
|
131
131
|
} else if ( Year >= 1926 ) {
|
|
132
|
-
if ( era == 'shouwa' ) Year -= ( 1926 - 1 )
|
|
133
|
-
else if ( era == 'taisho' ) Year = 15
|
|
132
|
+
if ( era == 'shouwa' ) Year -= ( 1926 - 1 )
|
|
133
|
+
else if ( era == 'taisho' ) Year = 15
|
|
134
134
|
} else if ( Year >= 1912 ) {
|
|
135
|
-
if ( era == 'taisho' ) Year -= ( 1912 - 1 )
|
|
136
|
-
else if ( era == 'meiji' ) Year = 45
|
|
137
|
-
} else if ( Year >= 1868 ) Year -= ( 1868 - 1 )
|
|
135
|
+
if ( era == 'taisho' ) Year -= ( 1912 - 1 )
|
|
136
|
+
else if ( era == 'meiji' ) Year = 45
|
|
137
|
+
} else if ( Year >= 1868 ) Year -= ( 1868 - 1 )
|
|
138
138
|
}
|
|
139
|
-
v = Year.zeroEmbed( 4 )
|
|
139
|
+
v = Year.zeroEmbed( 4 )
|
|
140
140
|
}
|
|
141
|
-
_value = _value.replace( new RegExp( '------------------'.slice( 0,v.length ) ),v )
|
|
142
|
-
} )
|
|
143
|
-
formatValues.push( _value )
|
|
141
|
+
_value = _value.replace( new RegExp( '------------------'.slice( 0,v.length ) ),v )
|
|
142
|
+
} )
|
|
143
|
+
formatValues.push( _value )
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -148,7 +148,7 @@ const DataLeveling = ( params: {
|
|
|
148
148
|
formatValue: formatValues.join( PeriodMargin ),
|
|
149
149
|
dataValue: [ 'dates','months' ].includes( restrict ) ? dataValue : dataValue[ 0 ],
|
|
150
150
|
ranges
|
|
151
|
-
}
|
|
151
|
+
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
function DefaultValidation( props: {
|
|
@@ -157,14 +157,14 @@ function DefaultValidation( props: {
|
|
|
157
157
|
} ): amotify.fn.Input.Validation.Result {
|
|
158
158
|
let {
|
|
159
159
|
params
|
|
160
|
-
} = props
|
|
160
|
+
} = props
|
|
161
161
|
let {
|
|
162
162
|
restrict,
|
|
163
163
|
min,max,
|
|
164
164
|
required
|
|
165
165
|
} = params as amotify.fn.Input.Time.OriginParams
|
|
166
|
-
let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
|
|
167
|
-
let values: string[] = $.flatArray( props.value )
|
|
166
|
+
let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
|
|
167
|
+
let values: string[] = $.flatArray( props.value )
|
|
168
168
|
|
|
169
169
|
let validate = {
|
|
170
170
|
empty: false,
|
|
@@ -175,63 +175,63 @@ function DefaultValidation( props: {
|
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
( () => {
|
|
178
|
-
let separateStr = restrict == 'clock' ? ':' : '/'
|
|
178
|
+
let separateStr = restrict == 'clock' ? ':' : '/'
|
|
179
179
|
for ( let index = 0; index < values.length; index++ ) {
|
|
180
|
-
values[ index ] = String( values[ index ] ).replace( /\D/ig,separateStr )
|
|
180
|
+
values[ index ] = String( values[ index ] ).replace( /\D/ig,separateStr )
|
|
181
181
|
}
|
|
182
182
|
for ( let index = 0; index < values.length; index++ ) {
|
|
183
|
-
let value = values[ index ]
|
|
184
|
-
let prevValue = values[ index - 1 ]
|
|
185
|
-
if ( !value.removeLetters() ) validate.empty = true
|
|
186
|
-
if ( index > 0 ) validate.escalated &= Number( value >= prevValue )
|
|
183
|
+
let value = values[ index ]
|
|
184
|
+
let prevValue = values[ index - 1 ]
|
|
185
|
+
if ( !value.removeLetters() ) validate.empty = true
|
|
186
|
+
if ( index > 0 ) validate.escalated &= Number( value >= prevValue )
|
|
187
187
|
}
|
|
188
|
-
if ( !validate.escalated ) return
|
|
189
|
-
if ( validate.empty ) return
|
|
188
|
+
if ( !validate.escalated ) return
|
|
189
|
+
if ( validate.empty ) return
|
|
190
190
|
|
|
191
191
|
if ( restrict.match( /clock/ ) ) {
|
|
192
192
|
values.forEach( value => {
|
|
193
|
-
let [ hour,minute ] = value.split( /\D+/ )
|
|
193
|
+
let [ hour,minute ] = value.split( /\D+/ )
|
|
194
194
|
|
|
195
195
|
if ( !hour || !minute ) {
|
|
196
|
-
validate.filled = false
|
|
196
|
+
validate.filled = false
|
|
197
197
|
} else if ( Number( hour ) > 23 || Number( minute ) > 59 ) {
|
|
198
|
-
validate.correct = false
|
|
198
|
+
validate.correct = false
|
|
199
199
|
}
|
|
200
|
-
} )
|
|
200
|
+
} )
|
|
201
201
|
} else if ( restrict.match( /date/ ) ) {
|
|
202
202
|
values.forEach( value => {
|
|
203
|
-
let [ year,month,day ] = value.split( /\D+/ )
|
|
203
|
+
let [ year,month,day ] = value.split( /\D+/ )
|
|
204
204
|
if ( !year || !month || !day ) {
|
|
205
|
-
validate.filled = false
|
|
205
|
+
validate.filled = false
|
|
206
206
|
} else {
|
|
207
|
-
let Time = $.Time( value )
|
|
207
|
+
let Time = $.Time( value )
|
|
208
208
|
if ( !Time.validate || value != Time.toFormatYMD() ) {
|
|
209
|
-
validate.correct = false
|
|
209
|
+
validate.correct = false
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
} )
|
|
212
|
+
} )
|
|
213
213
|
} else if ( restrict.match( /week/ ) ) {
|
|
214
214
|
values.forEach( value => {
|
|
215
|
-
let [ year,week ] = value.split( /\D+/ )
|
|
215
|
+
let [ year,week ] = value.split( /\D+/ )
|
|
216
216
|
if ( !year || !week ) {
|
|
217
|
-
validate.filled = false
|
|
217
|
+
validate.filled = false
|
|
218
218
|
} else {
|
|
219
|
-
let yearFirstDay = $.Time( year + '/01/01' ).weekday
|
|
220
|
-
let yearFirstWeek0Day = $.Time( year + '/01/0' + ( 7 - yearFirstDay + 1 ) )
|
|
221
|
-
let yearValueWeek0Day = yearFirstWeek0Day.addWeek( Number( week ) - 1 )
|
|
219
|
+
let yearFirstDay = $.Time( year + '/01/01' ).weekday
|
|
220
|
+
let yearFirstWeek0Day = $.Time( year + '/01/0' + ( 7 - yearFirstDay + 1 ) )
|
|
221
|
+
let yearValueWeek0Day = yearFirstWeek0Day.addWeek( Number( week ) - 1 )
|
|
222
222
|
if ( year != String( yearValueWeek0Day.year ) ) {
|
|
223
|
-
validate.correct = false
|
|
223
|
+
validate.correct = false
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
} )
|
|
226
|
+
} )
|
|
227
227
|
} else if ( restrict.match( /month/ ) ) {
|
|
228
228
|
values.forEach( value => {
|
|
229
|
-
let [ year,month ] = value.split( /\D+/ )
|
|
229
|
+
let [ year,month ] = value.split( /\D+/ )
|
|
230
230
|
if ( !year || !month ) {
|
|
231
|
-
validate.filled = false
|
|
231
|
+
validate.filled = false
|
|
232
232
|
} else {
|
|
233
|
-
let date = $.Time( [ year,month,'01' ].join( '/' ) )
|
|
234
|
-
if ( !date.validate ) validate.correct = false
|
|
233
|
+
let date = $.Time( [ year,month,'01' ].join( '/' ) )
|
|
234
|
+
if ( !date.validate ) validate.correct = false
|
|
235
235
|
}
|
|
236
236
|
} )
|
|
237
237
|
} else if ( restrict.match( /year/ ) ) {
|
|
@@ -241,19 +241,19 @@ function DefaultValidation( props: {
|
|
|
241
241
|
if ( validate.filled && validate.correct ) {
|
|
242
242
|
values.forEach( value => {
|
|
243
243
|
{
|
|
244
|
-
let VAL = Number( String( value ).replace( /\D/ig,'' ) )
|
|
244
|
+
let VAL = Number( String( value ).replace( /\D/ig,'' ) )
|
|
245
245
|
if ( min ) {
|
|
246
|
-
let MIN = Number( String( min ).replace( /\D/ig,'' ) )
|
|
247
|
-
if ( MIN > VAL ) validate.prohibited = true
|
|
246
|
+
let MIN = Number( String( min ).replace( /\D/ig,'' ) )
|
|
247
|
+
if ( MIN > VAL ) validate.prohibited = true
|
|
248
248
|
}
|
|
249
249
|
if ( max ) {
|
|
250
|
-
let MAX = Number( String( max ).replace( /\D/ig,'' ) )
|
|
251
|
-
if ( VAL > MAX ) validate.prohibited = true
|
|
250
|
+
let MAX = Number( String( max ).replace( /\D/ig,'' ) )
|
|
251
|
+
if ( VAL > MAX ) validate.prohibited = true
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
} )
|
|
255
255
|
}
|
|
256
|
-
} )()
|
|
256
|
+
} )()
|
|
257
257
|
|
|
258
258
|
{
|
|
259
259
|
let {
|
|
@@ -262,20 +262,20 @@ function DefaultValidation( props: {
|
|
|
262
262
|
filled,
|
|
263
263
|
correct,
|
|
264
264
|
prohibited
|
|
265
|
-
} = validate
|
|
265
|
+
} = validate
|
|
266
266
|
if ( empty && required ) {
|
|
267
267
|
notice = [
|
|
268
268
|
{ type: 'invalid',label: '必須項目です' }
|
|
269
|
-
]
|
|
269
|
+
]
|
|
270
270
|
}
|
|
271
271
|
if ( !escalated ) {
|
|
272
|
-
notice.push( { type: 'invalid',label: '時系列を正しく入力してください' } )
|
|
272
|
+
notice.push( { type: 'invalid',label: '時系列を正しく入力してください' } )
|
|
273
273
|
}
|
|
274
274
|
if ( !correct ) {
|
|
275
|
-
notice.push( { type: 'invalid',label: '無効な値が入力されています' } )
|
|
275
|
+
notice.push( { type: 'invalid',label: '無効な値が入力されています' } )
|
|
276
276
|
}
|
|
277
277
|
if ( !filled ) {
|
|
278
|
-
notice.push( { type: 'invalid',label: '最後まで値を埋めてください' } )
|
|
278
|
+
notice.push( { type: 'invalid',label: '最後まで値を埋めてください' } )
|
|
279
279
|
}
|
|
280
280
|
if ( prohibited ) {
|
|
281
281
|
notice.push( {
|
|
@@ -285,7 +285,7 @@ function DefaultValidation( props: {
|
|
|
285
285
|
</Box>
|
|
286
286
|
[{ min || '下限無し' }] ~ [{ max || '上限無し' }]
|
|
287
287
|
</>
|
|
288
|
-
} )
|
|
288
|
+
} )
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
|
|
@@ -324,9 +324,9 @@ export const TimeInput: React.FC<amotify.fn.Input.Time.OriginParams> = ( params
|
|
|
324
324
|
leftIndicator,rightIndicator,
|
|
325
325
|
|
|
326
326
|
...others
|
|
327
|
-
} = params
|
|
327
|
+
} = params
|
|
328
328
|
|
|
329
|
-
let [ val_era,set_era ] = React.useState( era! )
|
|
329
|
+
let [ val_era,set_era ] = React.useState( era! )
|
|
330
330
|
|
|
331
331
|
let [ val_status,set_status ] = React.useState( {
|
|
332
332
|
componentID: params.componentID || '',
|
|
@@ -337,17 +337,17 @@ export const TimeInput: React.FC<amotify.fn.Input.Time.OriginParams> = ( params
|
|
|
337
337
|
} ),
|
|
338
338
|
eventType: 'init',
|
|
339
339
|
eventID: $.uuidGen(),
|
|
340
|
-
} as amotify.fn.Input.Status.Time )
|
|
340
|
+
} as amotify.fn.Input.Status.Time )
|
|
341
341
|
|
|
342
342
|
let [ val_validate,set_validate ] = React.useState( {
|
|
343
343
|
ok: false,
|
|
344
344
|
notice: []
|
|
345
|
-
} as amotify.fn.Input.Validation.Result )
|
|
345
|
+
} as amotify.fn.Input.Validation.Result )
|
|
346
346
|
let [ val_focus,set_focus ] = React.useState( {
|
|
347
347
|
active: false,
|
|
348
348
|
index: 0,
|
|
349
349
|
prevIndex: -1
|
|
350
|
-
} as FocusProps )
|
|
350
|
+
} as FocusProps )
|
|
351
351
|
|
|
352
352
|
CommonEffects( {
|
|
353
353
|
type: 'time',
|
|
@@ -366,9 +366,9 @@ export const TimeInput: React.FC<amotify.fn.Input.Time.OriginParams> = ( params
|
|
|
366
366
|
era: val_era!
|
|
367
367
|
} )
|
|
368
368
|
}
|
|
369
|
-
} )
|
|
369
|
+
} )
|
|
370
370
|
|
|
371
|
-
const mounted = React.useRef( false )
|
|
371
|
+
const mounted = React.useRef( false )
|
|
372
372
|
React.useEffect( () => {
|
|
373
373
|
if ( mounted.current ) {
|
|
374
374
|
set_status( {
|
|
@@ -378,20 +378,20 @@ export const TimeInput: React.FC<amotify.fn.Input.Time.OriginParams> = ( params
|
|
|
378
378
|
value: val_status.dataValue,
|
|
379
379
|
era: val_era
|
|
380
380
|
} )
|
|
381
|
-
} )
|
|
381
|
+
} )
|
|
382
382
|
|
|
383
|
-
let ParentComponent = useStore.get( 'refreshEra_' + val_status.componentID )
|
|
384
|
-
ParentComponent && ParentComponent.refreshEra( val_era )
|
|
383
|
+
let ParentComponent = useStore.get( 'refreshEra_' + val_status.componentID )
|
|
384
|
+
ParentComponent && ParentComponent.refreshEra( val_era )
|
|
385
385
|
} else {
|
|
386
|
-
mounted.current = true
|
|
386
|
+
mounted.current = true
|
|
387
387
|
}
|
|
388
|
-
},[ val_era ] )
|
|
388
|
+
},[ val_era ] )
|
|
389
389
|
|
|
390
390
|
useStore.update( {
|
|
391
391
|
key: val_status.componentID,
|
|
392
392
|
value: {
|
|
393
393
|
openPicker: () => {
|
|
394
|
-
if ( params.disabled ) return
|
|
394
|
+
if ( params.disabled ) return
|
|
395
395
|
|
|
396
396
|
TimeFNs.picker.launch( {
|
|
397
397
|
parent: '#Picker-' + val_status.componentID,
|
|
@@ -410,13 +410,13 @@ export const TimeInput: React.FC<amotify.fn.Input.Time.OriginParams> = ( params
|
|
|
410
410
|
} ),
|
|
411
411
|
eventType: 'update',
|
|
412
412
|
eventID: $.uuidGen()
|
|
413
|
-
} )
|
|
414
|
-
set_era( era )
|
|
413
|
+
} )
|
|
414
|
+
set_era( era )
|
|
415
415
|
}
|
|
416
|
-
} )
|
|
416
|
+
} )
|
|
417
417
|
},
|
|
418
418
|
resetEra: ( era: amotify.fn.Input.Time.EraTypes ) => {
|
|
419
|
-
set_era( era )
|
|
419
|
+
set_era( era )
|
|
420
420
|
set_status( {
|
|
421
421
|
...val_status,
|
|
422
422
|
...DataLeveling( {
|
|
@@ -426,22 +426,22 @@ export const TimeInput: React.FC<amotify.fn.Input.Time.OriginParams> = ( params
|
|
|
426
426
|
} ),
|
|
427
427
|
eventType: 'update',
|
|
428
428
|
eventID: $.uuidGen()
|
|
429
|
-
} )
|
|
429
|
+
} )
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
|
-
} )
|
|
432
|
+
} )
|
|
433
433
|
|
|
434
434
|
React.useEffect( () => {
|
|
435
|
-
let { index,active } = val_focus
|
|
435
|
+
let { index,active } = val_focus
|
|
436
436
|
if ( active ) {
|
|
437
|
-
index = Math.max( index,0 )
|
|
438
|
-
index = Math.min( index,val_status.ranges.length - 1 )
|
|
437
|
+
index = Math.max( index,0 )
|
|
438
|
+
index = Math.min( index,val_status.ranges.length - 1 )
|
|
439
439
|
|
|
440
|
-
let { from,length } = val_status.ranges[ index ]
|
|
441
|
-
let input = $( '#' + params.id )[ 0 ] as HTMLInputElement
|
|
442
|
-
if ( input ) input.setSelectionRange( from,( from + length ) )
|
|
440
|
+
let { from,length } = val_status.ranges[ index ]
|
|
441
|
+
let input = $( '#' + params.id )[ 0 ] as HTMLInputElement
|
|
442
|
+
if ( input ) input.setSelectionRange( from,( from + length ) )
|
|
443
443
|
}
|
|
444
|
-
},[ val_focus ] )
|
|
444
|
+
},[ val_focus ] )
|
|
445
445
|
|
|
446
446
|
return <BoxWrapper
|
|
447
447
|
val_status={ val_status }
|
|
@@ -470,9 +470,9 @@ export const TimeInput: React.FC<amotify.fn.Input.Time.OriginParams> = ( params
|
|
|
470
470
|
} }
|
|
471
471
|
children={ val_status.formatValue }
|
|
472
472
|
onClick={ ( event ) => {
|
|
473
|
-
let component = useStore.get( val_status.componentID )
|
|
474
|
-
if ( component ) component.openPicker()
|
|
475
|
-
event.stopPropagation()
|
|
473
|
+
let component = useStore.get( val_status.componentID )
|
|
474
|
+
if ( component ) component.openPicker()
|
|
475
|
+
event.stopPropagation()
|
|
476
476
|
} }
|
|
477
477
|
/> : <input
|
|
478
478
|
type={ 'text' }
|
|
@@ -489,38 +489,38 @@ export const TimeInput: React.FC<amotify.fn.Input.Time.OriginParams> = ( params
|
|
|
489
489
|
val_era,
|
|
490
490
|
val_status,set_status,
|
|
491
491
|
val_focus,set_focus
|
|
492
|
-
} )
|
|
492
|
+
} )
|
|
493
493
|
|
|
494
|
-
if ( onKeyDown ) onKeyDown( event )
|
|
495
|
-
if ( enableFormSubmit ) SubmitForm( event )
|
|
494
|
+
if ( onKeyDown ) onKeyDown( event )
|
|
495
|
+
if ( enableFormSubmit ) SubmitForm( event )
|
|
496
496
|
} }
|
|
497
497
|
onKeyUp={ ( event ) => {
|
|
498
498
|
if ( event.key == 'Tab' ) set_focus( {
|
|
499
499
|
...val_focus,
|
|
500
500
|
active: true
|
|
501
|
-
} )
|
|
501
|
+
} )
|
|
502
502
|
} }
|
|
503
503
|
onClick={ ( event ) => {
|
|
504
|
-
let caretTo = ( event.target as HTMLInputElement ).selectionEnd as number
|
|
505
|
-
let Index = 0
|
|
504
|
+
let caretTo = ( event.target as HTMLInputElement ).selectionEnd as number
|
|
505
|
+
let Index = 0
|
|
506
506
|
|
|
507
507
|
val_status.ranges.forEach( ( range,index ) => {
|
|
508
|
-
let { from,length,region } = range
|
|
508
|
+
let { from,length,region } = range
|
|
509
509
|
if ( from <= caretTo && caretTo <= ( from + ( region || length ) ) ) {
|
|
510
|
-
Index = index
|
|
510
|
+
Index = index
|
|
511
511
|
}
|
|
512
|
-
} )
|
|
512
|
+
} )
|
|
513
513
|
set_focus( {
|
|
514
514
|
...val_focus,
|
|
515
515
|
active: true,
|
|
516
516
|
index: Index
|
|
517
|
-
} )
|
|
518
|
-
event.preventDefault()
|
|
517
|
+
} )
|
|
518
|
+
event.preventDefault()
|
|
519
519
|
} }
|
|
520
520
|
onChange={ () => { } }
|
|
521
521
|
{ ...others }
|
|
522
522
|
/> }
|
|
523
|
-
</BoxWrapper
|
|
523
|
+
</BoxWrapper>
|
|
524
524
|
}
|
|
525
525
|
|
|
526
526
|
const KeyDownEvent = ( props: {
|
|
@@ -538,41 +538,41 @@ const KeyDownEvent = ( props: {
|
|
|
538
538
|
event,
|
|
539
539
|
val_status,set_status,
|
|
540
540
|
val_focus,set_focus
|
|
541
|
-
} = props
|
|
541
|
+
} = props
|
|
542
542
|
|
|
543
|
-
let { key,shiftKey,ctrlKey,metaKey } = event
|
|
544
|
-
let auxKey = ctrlKey || metaKey
|
|
543
|
+
let { key,shiftKey,ctrlKey,metaKey } = event
|
|
544
|
+
let auxKey = ctrlKey || metaKey
|
|
545
545
|
let {
|
|
546
546
|
selectionStart: caretFrom,
|
|
547
547
|
selectionEnd: caretTo
|
|
548
|
-
} = event.target as HTMLInputElement
|
|
548
|
+
} = event.target as HTMLInputElement
|
|
549
549
|
|
|
550
550
|
let {
|
|
551
551
|
index: currentFocusIndex,
|
|
552
552
|
prevIndex: prevFocusIndex
|
|
553
|
-
} = val_focus
|
|
553
|
+
} = val_focus
|
|
554
554
|
let {
|
|
555
555
|
ranges,
|
|
556
556
|
formatValue
|
|
557
|
-
} = val_status
|
|
558
|
-
let maxFocusIndex = ranges.length - 1
|
|
557
|
+
} = val_status
|
|
558
|
+
let maxFocusIndex = ranges.length - 1
|
|
559
559
|
|
|
560
560
|
if ( [ 'Tab','ArrowLeft','ArrowRight' ].includes( key ) ) {
|
|
561
|
-
let nextFocusIndex = 0
|
|
561
|
+
let nextFocusIndex = 0
|
|
562
562
|
if ( key == 'Tab' ) {
|
|
563
|
-
let direction = Number( !shiftKey ) * 2 - 1
|
|
564
|
-
nextFocusIndex = val_focus.index + direction
|
|
565
|
-
if ( nextFocusIndex < 0 || nextFocusIndex > maxFocusIndex ) return
|
|
563
|
+
let direction = Number( !shiftKey ) * 2 - 1
|
|
564
|
+
nextFocusIndex = val_focus.index + direction
|
|
565
|
+
if ( nextFocusIndex < 0 || nextFocusIndex > maxFocusIndex ) return
|
|
566
566
|
} else {
|
|
567
|
-
let direction = key == 'ArrowLeft' ? -1 : key == 'ArrowRight' ? 1 : 0
|
|
567
|
+
let direction = key == 'ArrowLeft' ? -1 : key == 'ArrowRight' ? 1 : 0
|
|
568
568
|
|
|
569
569
|
if ( auxKey ) {
|
|
570
|
-
nextFocusIndex = direction == 1 ? maxFocusIndex : 0
|
|
570
|
+
nextFocusIndex = direction == 1 ? maxFocusIndex : 0
|
|
571
571
|
} else {
|
|
572
572
|
if ( caretFrom == 0 && caretTo == String( val_status.formatValue ).length ) {
|
|
573
|
-
nextFocusIndex = direction == 1 ? maxFocusIndex : 0
|
|
573
|
+
nextFocusIndex = direction == 1 ? maxFocusIndex : 0
|
|
574
574
|
} else {
|
|
575
|
-
nextFocusIndex = Math.max( 0,Math.min( currentFocusIndex + direction,maxFocusIndex ) )
|
|
575
|
+
nextFocusIndex = Math.max( 0,Math.min( currentFocusIndex + direction,maxFocusIndex ) )
|
|
576
576
|
}
|
|
577
577
|
}
|
|
578
578
|
}
|
|
@@ -580,32 +580,32 @@ const KeyDownEvent = ( props: {
|
|
|
580
580
|
...val_focus,
|
|
581
581
|
index: nextFocusIndex,
|
|
582
582
|
prevIndex: currentFocusIndex
|
|
583
|
-
} )
|
|
584
|
-
event.preventDefault()
|
|
583
|
+
} )
|
|
584
|
+
event.preventDefault()
|
|
585
585
|
}
|
|
586
586
|
|
|
587
587
|
if ( [ 'Backspace','ArrowUp','ArrowDown','0','1','2','3','4','5','6','7','8','9' ].includes( key ) ) {
|
|
588
|
-
event.preventDefault()
|
|
588
|
+
event.preventDefault()
|
|
589
589
|
|
|
590
|
-
let nextFocusIndex = currentFocusIndex
|
|
591
|
-
nextFocusIndex = Math.max( nextFocusIndex,0 )
|
|
592
|
-
nextFocusIndex = Math.min( nextFocusIndex,maxFocusIndex )
|
|
590
|
+
let nextFocusIndex = currentFocusIndex
|
|
591
|
+
nextFocusIndex = Math.max( nextFocusIndex,0 )
|
|
592
|
+
nextFocusIndex = Math.min( nextFocusIndex,maxFocusIndex )
|
|
593
593
|
let {
|
|
594
594
|
type,
|
|
595
595
|
from,
|
|
596
596
|
length
|
|
597
|
-
} = ranges[ nextFocusIndex ]
|
|
597
|
+
} = ranges[ nextFocusIndex ]
|
|
598
598
|
|
|
599
|
-
let prevValue: any = formatValue.slice( from,( from + length ) )
|
|
600
|
-
let partsValue: any
|
|
599
|
+
let prevValue: any = formatValue.slice( from,( from + length ) )
|
|
600
|
+
let partsValue: any
|
|
601
601
|
|
|
602
602
|
if ( key == 'Backspace' ) {
|
|
603
|
-
partsValue = '------'.slice( 0,length )
|
|
603
|
+
partsValue = '------'.slice( 0,length )
|
|
604
604
|
} else if ( [ 'ArrowUp','ArrowDown' ].includes( key ) ) {
|
|
605
|
-
let direction = key == 'ArrowUp' ? 1 : -1
|
|
605
|
+
let direction = key == 'ArrowUp' ? 1 : -1
|
|
606
606
|
|
|
607
|
-
prevValue = prevValue | 0
|
|
608
|
-
partsValue = prevValue + direction
|
|
607
|
+
prevValue = prevValue | 0
|
|
608
|
+
partsValue = prevValue + direction
|
|
609
609
|
|
|
610
610
|
let [ min,max,range ] =
|
|
611
611
|
type == 'dateWareki' ?
|
|
@@ -620,25 +620,25 @@ const KeyDownEvent = ( props: {
|
|
|
620
620
|
: type == 'date' ? [ 1,31,2 ]
|
|
621
621
|
: type == 'week' ? [ 1,53,2 ]
|
|
622
622
|
: type == 'month' ? [ 1,12,2 ]
|
|
623
|
-
: type == 'year' ? [ 0,2999,4 ] : [ 0,0,0 ]
|
|
623
|
+
: type == 'year' ? [ 0,2999,4 ] : [ 0,0,0 ]
|
|
624
624
|
|
|
625
|
-
if ( partsValue > max ) partsValue = min
|
|
626
|
-
else if ( partsValue < min ) partsValue = max
|
|
627
|
-
partsValue = ( Number( partsValue ) ).zeroEmbed( range )
|
|
625
|
+
if ( partsValue > max ) partsValue = min
|
|
626
|
+
else if ( partsValue < min ) partsValue = max
|
|
627
|
+
partsValue = ( Number( partsValue ) ).zeroEmbed( range )
|
|
628
628
|
} else if ( [ '0','1','2','3','4','5','6','7','8','9' ].includes( key ) ) {
|
|
629
|
-
let prev = prevValue | 0
|
|
630
|
-
let add = key
|
|
631
|
-
let compound: any = `${ prev }${ add }
|
|
629
|
+
let prev = prevValue | 0
|
|
630
|
+
let add = key
|
|
631
|
+
let compound: any = `${ prev }${ add }`
|
|
632
632
|
|
|
633
633
|
if ( prevFocusIndex != currentFocusIndex && prevFocusIndex >= 0 ) {
|
|
634
|
-
prev = 0,compound = '0' + add
|
|
634
|
+
prev = 0,compound = '0' + add
|
|
635
635
|
}
|
|
636
636
|
|
|
637
637
|
if ( type == 'year' || ( type == 'dateWareki' && val_era == 'year' ) ) {
|
|
638
|
-
if ( Number( compound ) > 10000 ) partsValue = add
|
|
639
|
-
else partsValue = compound
|
|
638
|
+
if ( Number( compound ) > 10000 ) partsValue = add
|
|
639
|
+
else partsValue = compound
|
|
640
640
|
|
|
641
|
-
if ( ( partsValue | 0 ) > 1000 ) nextFocusIndex
|
|
641
|
+
if ( ( partsValue | 0 ) > 1000 ) nextFocusIndex++
|
|
642
642
|
} else if (
|
|
643
643
|
[ 'hour','minute','date','week','month' ].includes( type ) ||
|
|
644
644
|
( type == 'dateWareki' && val_era != 'year' )
|
|
@@ -654,9 +654,9 @@ const KeyDownEvent = ( props: {
|
|
|
654
654
|
: type == 'hour' ? 23
|
|
655
655
|
: type == 'date' ? 31
|
|
656
656
|
: type == 'week' ? 53
|
|
657
|
-
: type == 'month' ? 12 : 0
|
|
657
|
+
: type == 'month' ? 12 : 0
|
|
658
658
|
|
|
659
|
-
partsValue = ( compound | 0 ) > base ? add : compound
|
|
659
|
+
partsValue = ( compound | 0 ) > base ? add : compound
|
|
660
660
|
|
|
661
661
|
if ( Number( add ) > Number( String( base )[ 0 ] ) ||
|
|
662
662
|
(
|
|
@@ -665,37 +665,37 @@ const KeyDownEvent = ( props: {
|
|
|
665
665
|
( [ 'minute','hour' ].includes( type ) && prevFocusIndex == currentFocusIndex )
|
|
666
666
|
)
|
|
667
667
|
) || ( compound | 0 ) >= ( 10 ** ( String( base ).length - 1 ) )
|
|
668
|
-
) nextFocusIndex
|
|
668
|
+
) nextFocusIndex++
|
|
669
669
|
}
|
|
670
670
|
|
|
671
|
-
if ( type == 'year' || type == 'dateWareki' ) partsValue = ( partsValue | 0 ).zeroEmbed( 4 )
|
|
672
|
-
else partsValue = ( partsValue | 0 ).zeroEmbed( 2 )
|
|
671
|
+
if ( type == 'year' || type == 'dateWareki' ) partsValue = ( partsValue | 0 ).zeroEmbed( 4 )
|
|
672
|
+
else partsValue = ( partsValue | 0 ).zeroEmbed( 2 )
|
|
673
673
|
}
|
|
674
674
|
|
|
675
675
|
{
|
|
676
|
-
let nextFormatValue = String( formatValue ).partReplace( from,String( partsValue ) )
|
|
676
|
+
let nextFormatValue = String( formatValue ).partReplace( from,String( partsValue ) )
|
|
677
677
|
let nextDataValue = nextFormatValue.split( PeriodMargin ).map( ( value ) => {
|
|
678
678
|
return value
|
|
679
679
|
.replace( /(^\D|\D$)/,'' )
|
|
680
680
|
.split( /\D+/ )
|
|
681
681
|
.join( restrict == 'clock' ? ':' : '/' )
|
|
682
|
-
.replace( /(^\D|\D$)/,'' )
|
|
683
|
-
} )
|
|
682
|
+
.replace( /(^\D|\D$)/,'' )
|
|
683
|
+
} )
|
|
684
684
|
if ( restrict == 'dateWareki' ) {
|
|
685
|
-
let v = nextDataValue[ 0 ].split( /\D/ )
|
|
686
|
-
let [ year,month,day ] = v
|
|
685
|
+
let v = nextDataValue[ 0 ].split( /\D/ )
|
|
686
|
+
let [ year,month,day ] = v
|
|
687
687
|
if ( v.length == 3 && year ) {
|
|
688
688
|
let yearYear: any = Number( year ) - 1 + Number(
|
|
689
689
|
{
|
|
690
690
|
year: 1,reiwa: 2019,heisei: 1989,shouwa: 1926,taisho: 1912,meiji: 1868
|
|
691
691
|
}[ val_era as string ]
|
|
692
|
-
)
|
|
693
|
-
nextDataValue = [ [ yearYear,month,day ].join( '/' ) ]
|
|
692
|
+
)
|
|
693
|
+
nextDataValue = [ [ yearYear,month,day ].join( '/' ) ]
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
696
|
|
|
697
|
-
nextFocusIndex = Math.max( nextFocusIndex,0 )
|
|
698
|
-
nextFocusIndex = Math.min( nextFocusIndex,maxFocusIndex )
|
|
697
|
+
nextFocusIndex = Math.max( nextFocusIndex,0 )
|
|
698
|
+
nextFocusIndex = Math.min( nextFocusIndex,maxFocusIndex )
|
|
699
699
|
|
|
700
700
|
set_status( {
|
|
701
701
|
...val_status,
|
|
@@ -703,12 +703,12 @@ const KeyDownEvent = ( props: {
|
|
|
703
703
|
formatValue: nextFormatValue,
|
|
704
704
|
eventType: 'update',
|
|
705
705
|
eventID: $.uuidGen(),
|
|
706
|
-
} )
|
|
706
|
+
} )
|
|
707
707
|
set_focus( {
|
|
708
708
|
...val_focus,
|
|
709
709
|
index: nextFocusIndex,
|
|
710
710
|
prevIndex: val_focus.index
|
|
711
|
-
} )
|
|
711
|
+
} )
|
|
712
712
|
}
|
|
713
713
|
}
|
|
714
714
|
}
|
|
@@ -717,7 +717,7 @@ const KeyDownEvent = ( props: {
|
|
|
717
717
|
export const TimeFNs: amotify.fn.Input.Time.FNTypes = {
|
|
718
718
|
picker: {
|
|
719
719
|
launch: ( params ) => {
|
|
720
|
-
let tipsID = params.tipsID || $.uuidGen()
|
|
720
|
+
let tipsID = params.tipsID || $.uuidGen()
|
|
721
721
|
|
|
722
722
|
Tooltips.open( {
|
|
723
723
|
gravityPoint: params.gravityPoint || 24,
|
|
@@ -737,13 +737,13 @@ export const TimeFNs: amotify.fn.Input.Time.FNTypes = {
|
|
|
737
737
|
defaultValue={ params.defaultValue }
|
|
738
738
|
tipsID={ tipsID }
|
|
739
739
|
onValueUpdate={ ( value,era ) => {
|
|
740
|
-
params.onValueUpdate( value,era )
|
|
740
|
+
params.onValueUpdate( value,era )
|
|
741
741
|
} }
|
|
742
742
|
/>
|
|
743
743
|
} )
|
|
744
744
|
},
|
|
745
745
|
remove: ( tipsID ) => {
|
|
746
|
-
Tooltips.close( tipsID )
|
|
746
|
+
Tooltips.close( tipsID )
|
|
747
747
|
}
|
|
748
748
|
}
|
|
749
749
|
}
|