amotify 0.0.4 → 0.0.6
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/@jsminAmotifyExtension/formCollect.js +1 -1
- package/dist/Atoms/Logo/parts.js +1 -1
- package/dist/Atoms/Various/parts.js +1 -1
- package/dist/Functions/Button/_.js +1 -1
- package/dist/Functions/Cropper/parts.js +4 -4
- package/dist/Functions/Effects/Fade.js +2 -2
- package/dist/Functions/Input/Chips/Selector.js +4 -4
- package/dist/Functions/Input/Chips/_.js +3 -3
- package/dist/Functions/Input/DigitCharacters.js +3 -3
- package/dist/Functions/Input/File/_.js +4 -4
- package/dist/Functions/Input/List/_.js +3 -3
- package/dist/Functions/Input/Segmented/_.js +1 -1
- package/dist/Functions/Input/Select/_.js +2 -2
- package/dist/Functions/Input/Slider/_.js +3 -3
- package/dist/Functions/Input/Switch/_.js +4 -4
- package/dist/Functions/Input/Text.js +2 -2
- package/dist/Functions/Input/TextArea.js +1 -1
- package/dist/Functions/Input/Time/Picker.js +4 -4
- package/dist/Functions/Input/Time/_.js +3 -3
- package/dist/Functions/Input/_.js +4 -4
- package/dist/Functions/Input/core.js +4 -4
- package/dist/Functions/Inputs/text.js +1 -1
- package/dist/Functions/Layout/PageNotFound.js +3 -3
- package/dist/Functions/Layout/PageRouter.js +2 -2
- package/dist/Functions/Layout/PageViewController/parts.js +2 -2
- package/dist/Functions/Layout/Plate.js +1 -1
- package/dist/Functions/Layout/RootViewController/parts.js +4 -4
- package/dist/Functions/Layout/SwipeView/parts.js +2 -2
- package/dist/Functions/Layout/TabBar.js +3 -3
- package/dist/Functions/Loader/corner.js +2 -2
- package/dist/Functions/Loader/mini.js +2 -2
- package/dist/Functions/Loader/parts.js +1 -1
- package/dist/Functions/Loader/top.js +2 -2
- package/dist/Functions/Sheet/parts.js +4 -4
- package/dist/Functions/SnackBar/parts.js +4 -4
- package/dist/Functions/Table/Data/parts.js +4 -4
- package/dist/Functions/Table/Drag/parts.js +3 -3
- package/dist/Functions/Table/_.js +2 -2
- package/dist/Functions/Tooltips/parts.js +2 -2
- package/dist/Molecules/@export.js +1 -1
- package/dist/Molecules/Accordion/parts.js +2 -2
- package/dist/Molecules/LinkifyText/parts.js +2 -2
- package/dist/Molecules/List.js +1 -1
- package/dist/Organisms/DisplayStyleInput/darkmode.js +4 -4
- package/dist/Organisms/DisplayStyleInput/themeColor.js +4 -4
- package/dist/Templates/PlayGround/parts.js +5 -5
- package/dist/launch.js +6 -6
- package/package.json +6 -5
- package/public/amotify.js +310 -0
- package/public/amotify.min.css +12724 -0
- package/dist/src/@jsminAmotifyExtension/_.d.ts +0 -4
- package/dist/src/@jsminAmotifyExtension/fetch.d.ts +0 -9
- package/dist/src/@jsminAmotifyExtension/formCollect.d.ts +0 -1
- package/dist/src/@jsminAmotifyExtension/spreadSheet.d.ts +0 -4
- package/dist/src/@jsminAmotifyExtension/variables.d.ts +0 -0
- package/dist/src/@types/_.d.ts +0 -6
- package/dist/src/@types/amot.d.ts +0 -260
- package/dist/src/@types/fn.d.ts +0 -1040
- package/dist/src/@types/index.d.ts +0 -62
- package/dist/src/@types/jsminAmotifyExtension.d.ts +0 -134
- package/dist/src/@types/module.d.ts +0 -2
- package/dist/src/@types/state.d.ts +0 -145
- package/dist/src/Atoms/@export.d.ts +0 -4
- package/dist/src/Atoms/FAIcon/parts.d.ts +0 -2
- package/dist/src/Atoms/Logo/parts.d.ts +0 -1
- package/dist/src/Atoms/Various/parts.d.ts +0 -9
- package/dist/src/Functions/@export.d.ts +0 -12
- package/dist/src/Functions/Button/_.d.ts +0 -1
- package/dist/src/Functions/Cropper/parts.d.ts +0 -1
- package/dist/src/Functions/Effects/Fade.d.ts +0 -1
- package/dist/src/Functions/Effects/Ripple.d.ts +0 -1
- package/dist/src/Functions/Effects/_.d.ts +0 -3
- package/dist/src/Functions/Input/Chips/Selector.d.ts +0 -1
- package/dist/src/Functions/Input/Chips/_.d.ts +0 -2
- package/dist/src/Functions/Input/DigitCharacters.d.ts +0 -1
- package/dist/src/Functions/Input/File/_.d.ts +0 -2
- package/dist/src/Functions/Input/Hidden.d.ts +0 -1
- package/dist/src/Functions/Input/List/_.d.ts +0 -1
- package/dist/src/Functions/Input/Segmented/_.d.ts +0 -1
- package/dist/src/Functions/Input/Select/_.d.ts +0 -1
- package/dist/src/Functions/Input/Slider/_.d.ts +0 -1
- package/dist/src/Functions/Input/Switch/_.d.ts +0 -1
- package/dist/src/Functions/Input/Text.d.ts +0 -5
- package/dist/src/Functions/Input/TextArea.d.ts +0 -1
- package/dist/src/Functions/Input/Time/Picker.d.ts +0 -1
- package/dist/src/Functions/Input/Time/_.d.ts +0 -2
- package/dist/src/Functions/Input/_.d.ts +0 -5
- package/dist/src/Functions/Input/core.d.ts +0 -34
- package/dist/src/Functions/Inputs/_.d.ts +0 -3
- package/dist/src/Functions/Inputs/text.d.ts +0 -12
- package/dist/src/Functions/Layout/PageNotFound.d.ts +0 -1
- package/dist/src/Functions/Layout/PageRouter.d.ts +0 -2
- package/dist/src/Functions/Layout/PageViewController/parts.d.ts +0 -1
- package/dist/src/Functions/Layout/Plate.d.ts +0 -1
- package/dist/src/Functions/Layout/RootViewController/parts.d.ts +0 -1
- package/dist/src/Functions/Layout/SwipeView/parts.d.ts +0 -2
- package/dist/src/Functions/Layout/TabBar.d.ts +0 -1
- package/dist/src/Functions/Layout/_.d.ts +0 -2
- package/dist/src/Functions/Loader/corner.d.ts +0 -1
- package/dist/src/Functions/Loader/mini.d.ts +0 -33
- package/dist/src/Functions/Loader/parts.d.ts +0 -3
- package/dist/src/Functions/Loader/top.d.ts +0 -1
- package/dist/src/Functions/Sheet/parts.d.ts +0 -2
- package/dist/src/Functions/SnackBar/parts.d.ts +0 -2
- package/dist/src/Functions/Table/Data/parts.d.ts +0 -3
- package/dist/src/Functions/Table/Drag/parts.d.ts +0 -1
- package/dist/src/Functions/Table/Normal/parts.d.ts +0 -1
- package/dist/src/Functions/Table/_.d.ts +0 -9
- package/dist/src/Functions/Tooltips/parts.d.ts +0 -2
- package/dist/src/Global/@export.d.ts +0 -12
- package/dist/src/Global/LaunchReactApplication.d.ts +0 -1
- package/dist/src/Global/styleConverter.d.ts +0 -2
- package/dist/src/Molecules/@export.d.ts +0 -21
- package/dist/src/Molecules/Accordion/parts.d.ts +0 -2
- package/dist/src/Molecules/LinkifyText/parts.d.ts +0 -1
- package/dist/src/Molecules/List.d.ts +0 -1
- package/dist/src/Organisms/@export.d.ts +0 -2
- package/dist/src/Organisms/DisplayStyleInput/_.d.ts +0 -1
- package/dist/src/Organisms/DisplayStyleInput/darkmode.d.ts +0 -1
- package/dist/src/Organisms/DisplayStyleInput/themeColor.d.ts +0 -27
- package/dist/src/Templates/@export.d.ts +0 -2
- package/dist/src/Templates/PlayGround/parts.d.ts +0 -1
- package/dist/src/config.d.ts +0 -16
- package/dist/src/launch.d.ts +0 -9
- package/dist/src/preload.d.ts +0 -1
- package/src/@jsminAmotifyExtension/_.tsx +0 -4
- package/src/@jsminAmotifyExtension/fetch.tsx +0 -107
- package/src/@jsminAmotifyExtension/formCollect.tsx +0 -89
- package/src/@jsminAmotifyExtension/spreadSheet.tsx +0 -159
- package/src/@jsminAmotifyExtension/variables.tsx +0 -130
- package/src/@styles/@app.scss +0 -4
- package/src/@styles/@variables/customProps.scss +0 -109
- package/src/@styles/@variables/styleSet.scss +0 -38
- package/src/@styles/@variables/themeColor.scss +0 -71
- package/src/@styles/@variables/var.scss +0 -171
- package/src/@styles/UniStyling.scss +0 -996
- package/src/@styles/init.scss +0 -154
- package/src/@types/_.tsx +0 -6
- package/src/@types/amot.tsx +0 -323
- package/src/@types/fn.tsx +0 -1210
- package/src/@types/index.tsx +0 -74
- package/src/@types/jsminAmotifyExtension.tsx +0 -143
- package/src/@types/module.tsx +0 -2
- package/src/@types/state.tsx +0 -199
- package/src/Atoms/@export.tsx +0 -32
- package/src/Atoms/FAIcon/parts.tsx +0 -117
- package/src/Atoms/FAIcon/style.module.scss +0 -9
- package/src/Atoms/Logo/parts.tsx +0 -335
- package/src/Atoms/Logo/style.module.scss +0 -96
- package/src/Atoms/Various/parts.tsx +0 -157
- package/src/Atoms/Various/style.module.scss +0 -40
- package/src/Functions/@export.tsx +0 -29
- package/src/Functions/Button/_.tsx +0 -305
- package/src/Functions/Button/style.module.scss +0 -183
- package/src/Functions/Cropper/parts.tsx +0 -1061
- package/src/Functions/Cropper/style.module.scss +0 -62
- package/src/Functions/Effects/Fade.tsx +0 -81
- package/src/Functions/Effects/Ripple.tsx +0 -141
- package/src/Functions/Effects/_.tsx +0 -33
- package/src/Functions/Effects/style.module.scss +0 -83
- package/src/Functions/Input/Chips/Selector.tsx +0 -451
- package/src/Functions/Input/Chips/_.tsx +0 -286
- package/src/Functions/Input/Chips/style.module.scss +0 -6
- package/src/Functions/Input/DigitCharacters.tsx +0 -241
- package/src/Functions/Input/File/_.tsx +0 -596
- package/src/Functions/Input/File/style.module.scss +0 -34
- package/src/Functions/Input/Hidden.tsx +0 -18
- package/src/Functions/Input/List/_.tsx +0 -383
- package/src/Functions/Input/List/style.module.scss +0 -84
- package/src/Functions/Input/Segmented/_.tsx +0 -238
- package/src/Functions/Input/Segmented/style.module.scss +0 -81
- package/src/Functions/Input/Select/_.tsx +0 -225
- package/src/Functions/Input/Select/style.module.scss +0 -10
- package/src/Functions/Input/Slider/_.tsx +0 -519
- package/src/Functions/Input/Slider/style.module.scss +0 -67
- package/src/Functions/Input/Switch/_.tsx +0 -177
- package/src/Functions/Input/Switch/style.module.scss +0 -18
- package/src/Functions/Input/Text.tsx +0 -437
- package/src/Functions/Input/TextArea.tsx +0 -115
- package/src/Functions/Input/Time/Picker.tsx +0 -950
- package/src/Functions/Input/Time/_.tsx +0 -736
- package/src/Functions/Input/Time/style.module.scss +0 -72
- package/src/Functions/Input/_.tsx +0 -793
- package/src/Functions/Input/core.tsx +0 -461
- package/src/Functions/Input/style.module.scss +0 -43
- package/src/Functions/Inputs/_.tsx +0 -5
- package/src/Functions/Inputs/style.module.scss +0 -15
- package/src/Functions/Inputs/text.tsx +0 -67
- package/src/Functions/Inputs/types.d.ts +0 -1
- package/src/Functions/Layout/PageNotFound.tsx +0 -81
- package/src/Functions/Layout/PageRouter.tsx +0 -107
- package/src/Functions/Layout/PageViewController/parts.tsx +0 -32
- package/src/Functions/Layout/Plate.tsx +0 -30
- package/src/Functions/Layout/RootViewController/parts.tsx +0 -290
- package/src/Functions/Layout/RootViewController/style.module.scss +0 -24
- package/src/Functions/Layout/SwipeView/parts.tsx +0 -380
- package/src/Functions/Layout/SwipeView/style.module.scss +0 -19
- package/src/Functions/Layout/TabBar.tsx +0 -64
- package/src/Functions/Layout/_.tsx +0 -20
- package/src/Functions/Loader/corner.tsx +0 -78
- package/src/Functions/Loader/mini.tsx +0 -117
- package/src/Functions/Loader/parts.tsx +0 -105
- package/src/Functions/Loader/style.module.scss +0 -222
- package/src/Functions/Loader/top.tsx +0 -90
- package/src/Functions/Sheet/parts.tsx +0 -972
- package/src/Functions/Sheet/style.module.scss +0 -235
- package/src/Functions/SnackBar/parts.tsx +0 -215
- package/src/Functions/SnackBar/style.module.scss +0 -25
- package/src/Functions/Table/Data/parts.tsx +0 -955
- package/src/Functions/Table/Drag/parts.tsx +0 -448
- package/src/Functions/Table/Normal/parts.tsx +0 -123
- package/src/Functions/Table/_.tsx +0 -170
- package/src/Functions/Table/style.module.scss +0 -92
- package/src/Functions/Tooltips/parts.tsx +0 -52
- package/src/Global/@export.tsx +0 -138
- package/src/Global/LaunchReactApplication.tsx +0 -30
- package/src/Global/exe.tsx +0 -0
- package/src/Global/styleConverter.tsx +0 -435
- package/src/Molecules/@export.tsx +0 -95
- package/src/Molecules/Accordion/parts.tsx +0 -146
- package/src/Molecules/Accordion/style.module.scss +0 -13
- package/src/Molecules/LinkifyText/parts.tsx +0 -54
- package/src/Molecules/List.tsx +0 -30
- package/src/Organisms/@export.tsx +0 -5
- package/src/Organisms/DisplayStyleInput/_.tsx +0 -18
- package/src/Organisms/DisplayStyleInput/darkmode.tsx +0 -112
- package/src/Organisms/DisplayStyleInput/themeColor.tsx +0 -210
- package/src/Templates/@export.tsx +0 -7
- package/src/Templates/PlayGround/parts.tsx +0 -115
- package/src/Templates/PlayGround/style.module.scss +0 -38
- package/src/config.tsx +0 -132
- package/src/launch.tsx +0 -100
- package/src/preload.tsx +0 -49
|
@@ -1,736 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useStore
|
|
3
|
-
} from '@global';
|
|
4
|
-
import {
|
|
5
|
-
Box
|
|
6
|
-
} from '@atoms'
|
|
7
|
-
import {
|
|
8
|
-
Input,
|
|
9
|
-
Buttons,
|
|
10
|
-
Tooltips
|
|
11
|
-
} from '@functions';
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
BoxWrapper,
|
|
15
|
-
SubmitForm,
|
|
16
|
-
ValidationCheck,
|
|
17
|
-
CommonEffects
|
|
18
|
-
} from '../core';
|
|
19
|
-
import { Picker } from './Picker';
|
|
20
|
-
const {
|
|
21
|
-
useEffect,
|
|
22
|
-
useState,
|
|
23
|
-
useRef
|
|
24
|
-
} = React;
|
|
25
|
-
|
|
26
|
-
const PeriodMargin = ' ~ ';
|
|
27
|
-
|
|
28
|
-
const TimeFormatDatas: {
|
|
29
|
-
[ key: string ]: {
|
|
30
|
-
defaultValue: string
|
|
31
|
-
format: RegExp
|
|
32
|
-
ranges: amotify.fn.Input.Time.RangeProps[]
|
|
33
|
-
sets: number
|
|
34
|
-
}
|
|
35
|
-
} = {
|
|
36
|
-
clock: {
|
|
37
|
-
defaultValue: '--:--',format: /^\d{2}\D\d{2}$/,ranges: [
|
|
38
|
-
{ type: 'hour',from: 0,length: 2 },
|
|
39
|
-
{ type: 'minute',from: 3,length: 2 }
|
|
40
|
-
],sets: 1
|
|
41
|
-
},
|
|
42
|
-
date: {
|
|
43
|
-
defaultValue: '----/--/--',format: /^\d{4}\D\d{2}\D\d{2}$/,ranges: [
|
|
44
|
-
{ type: 'year',from: 0,length: 4 },
|
|
45
|
-
{ type: 'month',from: 5,length: 2 },
|
|
46
|
-
{ type: 'date',from: 8,length: 2 }
|
|
47
|
-
],sets: 1
|
|
48
|
-
},
|
|
49
|
-
week: {
|
|
50
|
-
defaultValue: '----年第--週',format: /^\d{4}\D\d{2}$/,ranges: [
|
|
51
|
-
{ type: 'year',from: 0,length: 4,region: 6 },
|
|
52
|
-
{ type: 'week',from: 6,length: 2,region: 3 }
|
|
53
|
-
],sets: 1
|
|
54
|
-
},
|
|
55
|
-
month: {
|
|
56
|
-
defaultValue: '----年--月',format: /^\d{4}\D\d{2}$/,ranges: [
|
|
57
|
-
{ type: 'year',from: 0,length: 4 },
|
|
58
|
-
{ type: 'month',from: 5,length: 2,region: 3 }
|
|
59
|
-
],sets: 1
|
|
60
|
-
},
|
|
61
|
-
year: {
|
|
62
|
-
defaultValue: '----年',format: /^\d{4}$/,ranges: [
|
|
63
|
-
{ type: 'year',from: 0,length: 4,region: 5 }
|
|
64
|
-
],sets: 1
|
|
65
|
-
},
|
|
66
|
-
dates: {
|
|
67
|
-
defaultValue: '----/--/--',format: /^\d{4}\D\d{2}\D\d{2}$/,ranges: [
|
|
68
|
-
{ type: 'year',from: 0,length: 4 },
|
|
69
|
-
{ type: 'month',from: 5,length: 2 },
|
|
70
|
-
{ type: 'date',from: 8,length: 2,region: 5 },
|
|
71
|
-
{ type: 'year',from: 10 + PeriodMargin.length,length: 4 },
|
|
72
|
-
{ type: 'month',from: 15 + PeriodMargin.length,length: 2 },
|
|
73
|
-
{ type: 'date',from: 18 + PeriodMargin.length,length: 2 }
|
|
74
|
-
],sets: 2
|
|
75
|
-
},
|
|
76
|
-
months: {
|
|
77
|
-
defaultValue: '----年--月',format: /^\d{4}\D\d{2}$/,ranges: [
|
|
78
|
-
{ type: 'year',from: 0,length: 4 },
|
|
79
|
-
{ type: 'month',from: 5,length: 2,region: 6 },
|
|
80
|
-
{ type: 'year',from: 8 + PeriodMargin.length,length: 4 },
|
|
81
|
-
{ type: 'month',from: 13 + PeriodMargin.length,length: 2,region: 3 }
|
|
82
|
-
],sets: 2
|
|
83
|
-
},
|
|
84
|
-
dateWareki: {
|
|
85
|
-
defaultValue: '----年--月--日',format: /^\d{4}\D\d{2}\D\d{2}$/,ranges: [
|
|
86
|
-
{ type: 'dateWareki',from: 0,length: 4,region: 5 },
|
|
87
|
-
{ type: 'month',from: 5,length: 2,region: 3 },
|
|
88
|
-
{ type: 'date',from: 8,length: 2,region: 3 }
|
|
89
|
-
],sets: 1
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const DataLeveling = ( params: {
|
|
94
|
-
restrict: amotify.fn.Input.Time.RestrictTypes
|
|
95
|
-
value: any
|
|
96
|
-
era: amotify.fn.Input.Time.EraTypes
|
|
97
|
-
} ) => {
|
|
98
|
-
let {
|
|
99
|
-
restrict,
|
|
100
|
-
value,
|
|
101
|
-
era
|
|
102
|
-
} = params;
|
|
103
|
-
|
|
104
|
-
let dataValue = $.flatArray( value || '' );
|
|
105
|
-
|
|
106
|
-
let {
|
|
107
|
-
defaultValue,
|
|
108
|
-
format,
|
|
109
|
-
ranges,
|
|
110
|
-
sets
|
|
111
|
-
} = TimeFormatDatas[ restrict ];
|
|
112
|
-
let formatValues: string[] = [];
|
|
113
|
-
|
|
114
|
-
let separateStr = restrict == 'clock' ? ':' : '/';
|
|
115
|
-
for ( let index = 0; index < dataValue.length; index++ ) {
|
|
116
|
-
dataValue[ index ] = String( dataValue[ index ] ).replace( /\D/ig,separateStr );
|
|
117
|
-
}
|
|
118
|
-
for ( let index = 0; index < sets; index++ ) {
|
|
119
|
-
let val = dataValue[ index ] || '';
|
|
120
|
-
if ( !val.match( format ) ) {
|
|
121
|
-
dataValue[ index ] = '';
|
|
122
|
-
formatValues.push( defaultValue );
|
|
123
|
-
} else {
|
|
124
|
-
let _value = defaultValue;
|
|
125
|
-
val.split( /\D/ ).forEach( ( v: string,i: number ) => {
|
|
126
|
-
if ( i == 0 && restrict == 'dateWareki' ) {
|
|
127
|
-
let Year = Number( v );
|
|
128
|
-
if ( era != 'year' ) {
|
|
129
|
-
if ( Year >= 2019 ) Year -= 2019;
|
|
130
|
-
else if ( Year >= 1989 ) Year -= 1989;
|
|
131
|
-
else if ( Year >= 1926 ) Year -= 1926;
|
|
132
|
-
else if ( Year >= 1912 ) Year -= 1912;
|
|
133
|
-
else if ( Year >= 1868 ) Year -= 1868;
|
|
134
|
-
Year += 1;
|
|
135
|
-
}
|
|
136
|
-
v = Year.zeroEmbed( 4 );
|
|
137
|
-
}
|
|
138
|
-
_value = _value.replace( new RegExp( '------------------'.slice( 0,v.length ) ),v );
|
|
139
|
-
} );
|
|
140
|
-
formatValues.push( _value );
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return {
|
|
145
|
-
formatValue: formatValues.join( PeriodMargin ),
|
|
146
|
-
dataValue: [ 'dates','months' ].includes( restrict ) ? dataValue : dataValue[ 0 ],
|
|
147
|
-
ranges
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function DefaultValidation( props: {
|
|
152
|
-
value: any
|
|
153
|
-
params: any
|
|
154
|
-
} ): amotify.fn.Input.Validation.Result {
|
|
155
|
-
let {
|
|
156
|
-
params
|
|
157
|
-
} = props;
|
|
158
|
-
let {
|
|
159
|
-
restrict,
|
|
160
|
-
min,max,
|
|
161
|
-
required
|
|
162
|
-
} = params as amotify.fn.Input.Time.OriginParams
|
|
163
|
-
let notice: amotify.fn.Input.Validation.NoticeTypes[] = [];
|
|
164
|
-
let values: string[] = $.flatArray( props.value );
|
|
165
|
-
|
|
166
|
-
let validate = {
|
|
167
|
-
empty: false,
|
|
168
|
-
escalated: 1,
|
|
169
|
-
filled: true,
|
|
170
|
-
correct: true,
|
|
171
|
-
prohibited: false
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
( () => {
|
|
175
|
-
let separateStr = restrict == 'clock' ? ':' : '/';
|
|
176
|
-
for ( let index = 0; index < values.length; index++ ) {
|
|
177
|
-
values[ index ] = String( values[ index ] ).replace( /\D/ig,separateStr );
|
|
178
|
-
}
|
|
179
|
-
for ( let index = 0; index < values.length; index++ ) {
|
|
180
|
-
let value = values[ index ];
|
|
181
|
-
let prevValue = values[ index - 1 ];
|
|
182
|
-
if ( !value.removeLetters() ) validate.empty = true;
|
|
183
|
-
if ( index > 0 ) validate.escalated &= Number( value >= prevValue );
|
|
184
|
-
}
|
|
185
|
-
if ( !validate.escalated ) return;
|
|
186
|
-
if ( validate.empty ) return;
|
|
187
|
-
|
|
188
|
-
if ( restrict.match( /clock/ ) ) {
|
|
189
|
-
values.forEach( value => {
|
|
190
|
-
let [ hour,minute ] = value.split( /\D+/ );
|
|
191
|
-
|
|
192
|
-
if ( !hour || !minute ) {
|
|
193
|
-
validate.filled = false;
|
|
194
|
-
} else if ( Number( hour ) > 23 || Number( minute ) > 59 ) {
|
|
195
|
-
validate.correct = false;
|
|
196
|
-
}
|
|
197
|
-
} );
|
|
198
|
-
} else if ( restrict.match( /date/ ) ) {
|
|
199
|
-
values.forEach( value => {
|
|
200
|
-
let [ year,month,day ] = value.split( /\D+/ );
|
|
201
|
-
if ( !year || !month || !day ) {
|
|
202
|
-
validate.filled = false;
|
|
203
|
-
} else {
|
|
204
|
-
let Time = $.Time( value );
|
|
205
|
-
if ( !Time.validate || value != Time.toFormatYMD() ) {
|
|
206
|
-
validate.correct = false;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
} );
|
|
210
|
-
} else if ( restrict.match( /week/ ) ) {
|
|
211
|
-
values.forEach( value => {
|
|
212
|
-
let [ year,week ] = value.split( /\D+/ );
|
|
213
|
-
if ( !year || !week ) {
|
|
214
|
-
validate.filled = false;
|
|
215
|
-
} else {
|
|
216
|
-
let yearFirstDay = $.Time( year + '/01/01' ).weekday;
|
|
217
|
-
let yearFirstWeek0Day = $.Time( year + '/01/0' + ( 7 - yearFirstDay + 1 ) );
|
|
218
|
-
let yearValueWeek0Day = yearFirstWeek0Day.addWeek( Number( week ) - 1 );
|
|
219
|
-
if ( year != String( yearValueWeek0Day.year ) ) {
|
|
220
|
-
validate.correct = false;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
} );
|
|
224
|
-
} else if ( restrict.match( /month/ ) ) {
|
|
225
|
-
values.forEach( value => {
|
|
226
|
-
let [ year,month ] = value.split( /\D+/ );
|
|
227
|
-
if ( !year || !month ) {
|
|
228
|
-
validate.filled = false;
|
|
229
|
-
} else {
|
|
230
|
-
let date = $.Time( [ year,month,'01' ].join( '/' ) );
|
|
231
|
-
if ( !date.validate ) validate.correct = false;
|
|
232
|
-
}
|
|
233
|
-
} )
|
|
234
|
-
} else if ( restrict.match( /year/ ) ) {
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
if ( validate.filled && validate.correct ) {
|
|
239
|
-
values.forEach( value => {
|
|
240
|
-
{
|
|
241
|
-
let VAL = Number( String( value ).replace( /\D/ig,'' ) );
|
|
242
|
-
if ( min ) {
|
|
243
|
-
let MIN = Number( String( min ).replace( /\D/ig,'' ) );
|
|
244
|
-
if ( MIN > VAL ) validate.prohibited = true;
|
|
245
|
-
}
|
|
246
|
-
if ( max ) {
|
|
247
|
-
let MAX = Number( String( max ).replace( /\D/ig,'' ) );
|
|
248
|
-
if ( VAL > MAX ) validate.prohibited = true;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
} )
|
|
252
|
-
}
|
|
253
|
-
} )();
|
|
254
|
-
|
|
255
|
-
{
|
|
256
|
-
let {
|
|
257
|
-
empty,
|
|
258
|
-
escalated,
|
|
259
|
-
filled,
|
|
260
|
-
correct,
|
|
261
|
-
prohibited
|
|
262
|
-
} = validate;
|
|
263
|
-
if ( empty && required ) {
|
|
264
|
-
notice = [
|
|
265
|
-
{ type: 'invalid',label: '必須項目です' }
|
|
266
|
-
];
|
|
267
|
-
}
|
|
268
|
-
if ( !escalated ) {
|
|
269
|
-
notice.push( { type: 'invalid',label: '時系列を正しく入力してください' } );
|
|
270
|
-
}
|
|
271
|
-
if ( !correct ) {
|
|
272
|
-
notice.push( { type: 'invalid',label: '無効な値が入力されています' } );
|
|
273
|
-
}
|
|
274
|
-
if ( !filled ) {
|
|
275
|
-
notice.push( { type: 'invalid',label: '最後まで値を埋めてください' } );
|
|
276
|
-
}
|
|
277
|
-
if ( prohibited ) {
|
|
278
|
-
notice.push( {
|
|
279
|
-
type: 'invalid',label: <>
|
|
280
|
-
<Box>
|
|
281
|
-
入力範囲が制限されています
|
|
282
|
-
</Box>
|
|
283
|
-
[{ min || '下限無し' }] ~ [{ max || '上限無し' }]
|
|
284
|
-
</>
|
|
285
|
-
} );
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
return {
|
|
290
|
-
ok: !notice.filter( ( { type } ) => type == 'invalid' ).length,
|
|
291
|
-
notice: notice
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
type FocusProps = {
|
|
296
|
-
active: boolean
|
|
297
|
-
index: number
|
|
298
|
-
prevIndex: number
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
export const TimeInput: FNC<amotify.fn.Input.Time.OriginParams> = ( params ) => {
|
|
302
|
-
let {
|
|
303
|
-
tone,
|
|
304
|
-
required,
|
|
305
|
-
restrict = 'clock',
|
|
306
|
-
componentID,
|
|
307
|
-
era,
|
|
308
|
-
form,
|
|
309
|
-
name,
|
|
310
|
-
min,max,
|
|
311
|
-
className,
|
|
312
|
-
|
|
313
|
-
enableFormSubmit,
|
|
314
|
-
|
|
315
|
-
checkValidationAtFirst,
|
|
316
|
-
onKeyDown,
|
|
317
|
-
onValidate,
|
|
318
|
-
onUpdateValue,
|
|
319
|
-
onUpdateValidValue,
|
|
320
|
-
value = '',
|
|
321
|
-
leftIndicator,rightIndicator,
|
|
322
|
-
|
|
323
|
-
...others
|
|
324
|
-
} = params;
|
|
325
|
-
|
|
326
|
-
let [ val_era,set_era ] = useState( era! );
|
|
327
|
-
|
|
328
|
-
let [ val_status,set_status ] = useState( {
|
|
329
|
-
componentID: params.componentID || '',
|
|
330
|
-
...DataLeveling( {
|
|
331
|
-
restrict,
|
|
332
|
-
value,
|
|
333
|
-
era: val_era
|
|
334
|
-
} ),
|
|
335
|
-
eventType: 'init',
|
|
336
|
-
eventID: $.uuidGen(),
|
|
337
|
-
} as amotify.fn.Input.Status.Time );
|
|
338
|
-
|
|
339
|
-
let [ val_validate,set_validate ] = useState( {
|
|
340
|
-
ok: false,
|
|
341
|
-
notice: []
|
|
342
|
-
} as amotify.fn.Input.Validation.Result );
|
|
343
|
-
let [ val_focus,set_focus ] = useState( {
|
|
344
|
-
active: false,
|
|
345
|
-
index: 0,
|
|
346
|
-
prevIndex: -1
|
|
347
|
-
} as FocusProps );
|
|
348
|
-
|
|
349
|
-
CommonEffects( {
|
|
350
|
-
type: 'time',
|
|
351
|
-
params,
|
|
352
|
-
val_status,
|
|
353
|
-
set_status,
|
|
354
|
-
val_validate,
|
|
355
|
-
set_validate,
|
|
356
|
-
DefaultValidation,
|
|
357
|
-
onUpdateValue,
|
|
358
|
-
onUpdateValidValue,
|
|
359
|
-
ExtraOverrideParams: {
|
|
360
|
-
...DataLeveling( {
|
|
361
|
-
restrict,
|
|
362
|
-
value,
|
|
363
|
-
era: val_era!
|
|
364
|
-
} )
|
|
365
|
-
}
|
|
366
|
-
} );
|
|
367
|
-
|
|
368
|
-
const mounted = useRef( false );
|
|
369
|
-
useEffect( () => {
|
|
370
|
-
if ( mounted.current ) {
|
|
371
|
-
set_status( {
|
|
372
|
-
...val_status,
|
|
373
|
-
...DataLeveling( {
|
|
374
|
-
restrict,
|
|
375
|
-
value: val_status.dataValue,
|
|
376
|
-
era: val_era
|
|
377
|
-
} )
|
|
378
|
-
} );
|
|
379
|
-
} else {
|
|
380
|
-
mounted.current = true;
|
|
381
|
-
}
|
|
382
|
-
},[ val_era ] );
|
|
383
|
-
|
|
384
|
-
useStore.update( {
|
|
385
|
-
key: val_status.componentID,
|
|
386
|
-
value: {
|
|
387
|
-
openPicker: () => {
|
|
388
|
-
if ( params.disabled ) return;
|
|
389
|
-
|
|
390
|
-
TimeFNs.picker.launch( {
|
|
391
|
-
parent: '#Picker-' + val_status.componentID,
|
|
392
|
-
tipsID: 'PickerTips-' + val_status.componentID,
|
|
393
|
-
restrict,
|
|
394
|
-
min,max,
|
|
395
|
-
defaultValue: val_status.dataValue,
|
|
396
|
-
onValueUpdate: ( value ) => {
|
|
397
|
-
set_status( {
|
|
398
|
-
...val_status,
|
|
399
|
-
...DataLeveling( {
|
|
400
|
-
restrict,
|
|
401
|
-
value: value,
|
|
402
|
-
era: val_era!
|
|
403
|
-
} ),
|
|
404
|
-
eventType: 'update',
|
|
405
|
-
eventID: $.uuidGen()
|
|
406
|
-
} );
|
|
407
|
-
}
|
|
408
|
-
} );
|
|
409
|
-
},
|
|
410
|
-
resetEra: ( era: amotify.fn.Input.Time.EraTypes ) => {
|
|
411
|
-
set_era( era );
|
|
412
|
-
set_status( {
|
|
413
|
-
...val_status,
|
|
414
|
-
...DataLeveling( {
|
|
415
|
-
restrict,
|
|
416
|
-
value: '',
|
|
417
|
-
era: val_era!
|
|
418
|
-
} ),
|
|
419
|
-
eventType: 'update',
|
|
420
|
-
eventID: $.uuidGen()
|
|
421
|
-
} );
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
} );
|
|
425
|
-
|
|
426
|
-
useEffect( () => {
|
|
427
|
-
let { index,active } = val_focus;
|
|
428
|
-
if ( active ) {
|
|
429
|
-
index = Math.max( index,0 );
|
|
430
|
-
index = Math.min( index,val_status.ranges.length - 1 );
|
|
431
|
-
|
|
432
|
-
let { from,length } = val_status.ranges[ index ];
|
|
433
|
-
let input = $( '#' + params.id )[ 0 ] as HTMLInputElement;
|
|
434
|
-
if ( input ) input.setSelectionRange( from,( from + length ) );
|
|
435
|
-
}
|
|
436
|
-
},[ val_focus ] );
|
|
437
|
-
|
|
438
|
-
return (
|
|
439
|
-
<BoxWrapper
|
|
440
|
-
val_status={ val_status }
|
|
441
|
-
set_status={ set_status }
|
|
442
|
-
val_validate={ val_validate }
|
|
443
|
-
params={ params }
|
|
444
|
-
>
|
|
445
|
-
<Input.Hidden
|
|
446
|
-
name={ name }
|
|
447
|
-
data-input-type={ 'time' }
|
|
448
|
-
data-form={ form }
|
|
449
|
-
data-validation={ val_validate.ok }
|
|
450
|
-
componentID={ val_status.componentID }
|
|
451
|
-
data-value={ JSON.stringify(
|
|
452
|
-
[ 'dates','months' ].includes( restrict ) ?
|
|
453
|
-
!val_status.dataValue[ 0 ] || !val_status.dataValue[ 1 ] ? null
|
|
454
|
-
: val_status.dataValue
|
|
455
|
-
: ( val_status.dataValue || null )
|
|
456
|
-
) }
|
|
457
|
-
/>
|
|
458
|
-
{ amotify.config.device.isTouchDevice ?
|
|
459
|
-
<Buttons.Button.Plain
|
|
460
|
-
className={ className }
|
|
461
|
-
freeCSS={ {
|
|
462
|
-
textAlign: 'left'
|
|
463
|
-
} }
|
|
464
|
-
children={ val_status.formatValue }
|
|
465
|
-
onClick={ ( event ) => {
|
|
466
|
-
let component = useStore.get( val_status.componentID );
|
|
467
|
-
if ( component ) component.openPicker();
|
|
468
|
-
event.stopPropagation();
|
|
469
|
-
} }
|
|
470
|
-
/> : <input
|
|
471
|
-
type={ 'text' }
|
|
472
|
-
inputMode={ 'numeric' }
|
|
473
|
-
data-input-type={ 'time' }
|
|
474
|
-
data-form-name={ form }
|
|
475
|
-
value={ val_status.formatValue }
|
|
476
|
-
className={ className }
|
|
477
|
-
tabIndex={ amotify.config.device.isTouchDevice ? -1 : 0 }
|
|
478
|
-
onKeyDown={ ( event ) => {
|
|
479
|
-
KeyDownEvent( {
|
|
480
|
-
restrict,
|
|
481
|
-
event,
|
|
482
|
-
val_era,
|
|
483
|
-
val_status,set_status,
|
|
484
|
-
val_focus,set_focus
|
|
485
|
-
} );
|
|
486
|
-
|
|
487
|
-
if ( onKeyDown ) onKeyDown( event );
|
|
488
|
-
if ( enableFormSubmit ) SubmitForm( event );
|
|
489
|
-
} }
|
|
490
|
-
onKeyUp={ ( event ) => {
|
|
491
|
-
if ( event.key == 'Tab' ) set_focus( {
|
|
492
|
-
...val_focus,
|
|
493
|
-
active: true
|
|
494
|
-
} );
|
|
495
|
-
} }
|
|
496
|
-
onClick={ ( event ) => {
|
|
497
|
-
let caretTo = ( event.target as HTMLInputElement ).selectionEnd as number;
|
|
498
|
-
let Index = 0;
|
|
499
|
-
|
|
500
|
-
val_status.ranges.forEach( ( range,index ) => {
|
|
501
|
-
let { from,length,region } = range;
|
|
502
|
-
if ( from <= caretTo && caretTo <= ( from + ( region || length ) ) ) {
|
|
503
|
-
Index = index;
|
|
504
|
-
}
|
|
505
|
-
} );
|
|
506
|
-
set_focus( {
|
|
507
|
-
...val_focus,
|
|
508
|
-
active: true,
|
|
509
|
-
index: Index
|
|
510
|
-
} );
|
|
511
|
-
event.preventDefault();
|
|
512
|
-
} }
|
|
513
|
-
{ ...others }
|
|
514
|
-
/> }
|
|
515
|
-
</BoxWrapper>
|
|
516
|
-
);
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
const KeyDownEvent = ( props: {
|
|
520
|
-
restrict: amotify.fn.Input.Time.RestrictTypes
|
|
521
|
-
event: React.KeyboardEvent<HTMLInputElement>
|
|
522
|
-
val_era: amotify.fn.Input.Time.EraTypes
|
|
523
|
-
val_status: amotify.fn.Input.Status.Time
|
|
524
|
-
set_status: React.Dispatch<React.SetStateAction<amotify.fn.Input.Status.Time>>
|
|
525
|
-
val_focus: FocusProps
|
|
526
|
-
set_focus: React.Dispatch<React.SetStateAction<FocusProps>>
|
|
527
|
-
} ) => {
|
|
528
|
-
let {
|
|
529
|
-
val_era,
|
|
530
|
-
restrict,
|
|
531
|
-
event,
|
|
532
|
-
val_status,set_status,
|
|
533
|
-
val_focus,set_focus
|
|
534
|
-
} = props;
|
|
535
|
-
|
|
536
|
-
let { key,shiftKey,ctrlKey,metaKey } = event;
|
|
537
|
-
let auxKey = ctrlKey || metaKey;
|
|
538
|
-
let {
|
|
539
|
-
selectionStart: caretFrom,
|
|
540
|
-
selectionEnd: caretTo
|
|
541
|
-
} = event.target as HTMLInputElement;
|
|
542
|
-
|
|
543
|
-
let {
|
|
544
|
-
index: currentFocusIndex,
|
|
545
|
-
prevIndex: prevFocusIndex
|
|
546
|
-
} = val_focus;
|
|
547
|
-
let {
|
|
548
|
-
ranges,
|
|
549
|
-
formatValue
|
|
550
|
-
} = val_status;
|
|
551
|
-
let maxFocusIndex = ranges.length - 1;
|
|
552
|
-
|
|
553
|
-
if ( [ 'Tab','ArrowLeft','ArrowRight' ].includes( key ) ) {
|
|
554
|
-
let nextFocusIndex = 0;
|
|
555
|
-
if ( key == 'Tab' ) {
|
|
556
|
-
let direction = Number( !shiftKey ) * 2 - 1;
|
|
557
|
-
nextFocusIndex = val_focus.index + direction;
|
|
558
|
-
if ( nextFocusIndex < 0 || nextFocusIndex > maxFocusIndex ) return;
|
|
559
|
-
} else {
|
|
560
|
-
let direction = key == 'ArrowLeft' ? -1 : key == 'ArrowRight' ? 1 : 0;
|
|
561
|
-
|
|
562
|
-
if ( auxKey ) {
|
|
563
|
-
nextFocusIndex = direction == 1 ? maxFocusIndex : 0;
|
|
564
|
-
} else {
|
|
565
|
-
if ( caretFrom == 0 && caretTo == String( val_status.formatValue ).length ) {
|
|
566
|
-
nextFocusIndex = direction == 1 ? maxFocusIndex : 0;
|
|
567
|
-
} else {
|
|
568
|
-
nextFocusIndex = Math.max( 0,Math.min( currentFocusIndex + direction,maxFocusIndex ) );
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
set_focus( {
|
|
573
|
-
...val_focus,
|
|
574
|
-
index: nextFocusIndex,
|
|
575
|
-
prevIndex: currentFocusIndex
|
|
576
|
-
} );
|
|
577
|
-
event.preventDefault();
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
if ( [ 'Backspace','ArrowUp','ArrowDown','0','1','2','3','4','5','6','7','8','9' ].includes( key ) ) {
|
|
581
|
-
event.preventDefault();
|
|
582
|
-
|
|
583
|
-
let nextFocusIndex = currentFocusIndex;
|
|
584
|
-
nextFocusIndex = Math.max( nextFocusIndex,0 );
|
|
585
|
-
nextFocusIndex = Math.min( nextFocusIndex,maxFocusIndex );
|
|
586
|
-
let {
|
|
587
|
-
type,
|
|
588
|
-
from,
|
|
589
|
-
length
|
|
590
|
-
} = ranges[ nextFocusIndex ];
|
|
591
|
-
|
|
592
|
-
let prevValue: any = formatValue.slice( from,( from + length ) );
|
|
593
|
-
let partsValue: any;
|
|
594
|
-
|
|
595
|
-
if ( key == 'Backspace' ) {
|
|
596
|
-
partsValue = '------'.slice( 0,length );
|
|
597
|
-
} else if ( [ 'ArrowUp','ArrowDown' ].includes( key ) ) {
|
|
598
|
-
let direction = key == 'ArrowUp' ? 1 : -1;
|
|
599
|
-
|
|
600
|
-
prevValue = prevValue | 0;
|
|
601
|
-
partsValue = prevValue + direction;
|
|
602
|
-
|
|
603
|
-
let [ min,max,range ] =
|
|
604
|
-
type == 'dateWareki' ?
|
|
605
|
-
val_era == 'year' ? [ 0,2999,4 ]
|
|
606
|
-
: val_era == 'reiwa' ? [ 1,2999,4 ]
|
|
607
|
-
: val_era == 'heisei' ? [ 1,31,4 ]
|
|
608
|
-
: val_era == 'shouwa' ? [ 1,64,4 ]
|
|
609
|
-
: val_era == 'taisho' ? [ 1,15,4 ]
|
|
610
|
-
: val_era == 'meiji' ? [ 1,45,4 ] : [ 0,0,0 ]
|
|
611
|
-
: type == 'minute' ? [ 0,59,2 ]
|
|
612
|
-
: type == 'hour' ? [ 0,23,2 ]
|
|
613
|
-
: type == 'date' ? [ 1,31,2 ]
|
|
614
|
-
: type == 'week' ? [ 1,53,2 ]
|
|
615
|
-
: type == 'month' ? [ 1,12,2 ]
|
|
616
|
-
: type == 'year' ? [ 0,2999,4 ] : [ 0,0,0 ];
|
|
617
|
-
|
|
618
|
-
if ( partsValue > max ) partsValue = min;
|
|
619
|
-
else if ( partsValue < min ) partsValue = max;
|
|
620
|
-
partsValue = ( Number( partsValue ) ).zeroEmbed( range );
|
|
621
|
-
} else if ( [ '0','1','2','3','4','5','6','7','8','9' ].includes( key ) ) {
|
|
622
|
-
let prev = prevValue | 0;
|
|
623
|
-
let add = key;
|
|
624
|
-
let compound: any = `${ prev }${ add }`;
|
|
625
|
-
|
|
626
|
-
if ( prevFocusIndex != currentFocusIndex && prevFocusIndex >= 0 ) {
|
|
627
|
-
prev = 0,compound = '0' + add;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
if ( type == 'year' || ( type == 'dateWareki' && val_era == 'year' ) ) {
|
|
631
|
-
if ( Number( compound ) > 10000 ) partsValue = add;
|
|
632
|
-
else partsValue = compound;
|
|
633
|
-
|
|
634
|
-
if ( ( partsValue | 0 ) > 1000 ) nextFocusIndex++;
|
|
635
|
-
} else if (
|
|
636
|
-
[ 'hour','minute','date','week','month' ].includes( type ) ||
|
|
637
|
-
( type == 'dateWareki' && val_era != 'year' )
|
|
638
|
-
) {
|
|
639
|
-
let base =
|
|
640
|
-
type == 'dateWareki' ?
|
|
641
|
-
val_era == 'reiwa' ? 100
|
|
642
|
-
: val_era == 'heisei' ? 31
|
|
643
|
-
: val_era == 'shouwa' ? 64
|
|
644
|
-
: val_era == 'taisho' ? 15
|
|
645
|
-
: val_era == 'meiji' ? 45 : 0
|
|
646
|
-
: type == 'minute' ? 59
|
|
647
|
-
: type == 'hour' ? 23
|
|
648
|
-
: type == 'date' ? 31
|
|
649
|
-
: type == 'week' ? 53
|
|
650
|
-
: type == 'month' ? 12 : 0;
|
|
651
|
-
|
|
652
|
-
partsValue = ( compound | 0 ) > base ? add : compound;
|
|
653
|
-
|
|
654
|
-
if ( Number( add ) > Number( String( base )[ 0 ] ) ||
|
|
655
|
-
(
|
|
656
|
-
prevValue == '0000'.slice( 0,String( base ).length ) && (
|
|
657
|
-
compound != '0000'.slice( 0,String( base ).length ) ||
|
|
658
|
-
( [ 'minute','hour' ].includes( type ) && prevFocusIndex == currentFocusIndex )
|
|
659
|
-
)
|
|
660
|
-
) || ( compound | 0 ) >= ( 10 ** ( String( base ).length - 1 ) )
|
|
661
|
-
) nextFocusIndex++;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
if ( type == 'year' || type == 'dateWareki' ) partsValue = ( partsValue | 0 ).zeroEmbed( 4 );
|
|
665
|
-
else partsValue = ( partsValue | 0 ).zeroEmbed( 2 );
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
{
|
|
669
|
-
let nextFormatValue = String( formatValue ).partReplace( from,String( partsValue ) );
|
|
670
|
-
let nextDataValue = nextFormatValue.split( PeriodMargin ).map( ( value ) => {
|
|
671
|
-
return value.replace( /(^\D|\D$)/,'' ).split( /\D+/ ).join( restrict == 'clock' ? ':' : '/' );
|
|
672
|
-
} );
|
|
673
|
-
if ( restrict == 'dateWareki' ) {
|
|
674
|
-
let v = nextDataValue[ 0 ].split( /\D/ );
|
|
675
|
-
let [ year,month,day ] = v;
|
|
676
|
-
if ( v.length == 3 && year ) {
|
|
677
|
-
let yearYear: any = Number( year ) - 1 + Number(
|
|
678
|
-
{
|
|
679
|
-
year: 1,reiwa: 2019,heisei: 1989,shouwa: 1926,taisho: 1912,meiji: 1868
|
|
680
|
-
}[ val_era as string ]
|
|
681
|
-
);
|
|
682
|
-
nextDataValue = [ [ yearYear,month,day ].join( '/' ) ];
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
nextFocusIndex = Math.max( nextFocusIndex,0 );
|
|
687
|
-
nextFocusIndex = Math.min( nextFocusIndex,maxFocusIndex );
|
|
688
|
-
|
|
689
|
-
set_status( {
|
|
690
|
-
...val_status,
|
|
691
|
-
dataValue: [ 'dates','months' ].includes( restrict ) ? nextDataValue : nextDataValue[ 0 ],
|
|
692
|
-
formatValue: nextFormatValue,
|
|
693
|
-
eventType: 'update',
|
|
694
|
-
eventID: $.uuidGen(),
|
|
695
|
-
} );
|
|
696
|
-
set_focus( {
|
|
697
|
-
...val_focus,
|
|
698
|
-
index: nextFocusIndex,
|
|
699
|
-
prevIndex: val_focus.index
|
|
700
|
-
} );
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
export const TimeFNs: amotify.fn.Input.Time.FNTypes = {
|
|
707
|
-
picker: {
|
|
708
|
-
launch: ( params ) => {
|
|
709
|
-
let tipsID = params.tipsID || $.uuidGen();
|
|
710
|
-
Tooltips.open( {
|
|
711
|
-
gravityPoint: params.gravityPoint || 24,
|
|
712
|
-
padding: [ 1,0 ],
|
|
713
|
-
tipsID,
|
|
714
|
-
...params,
|
|
715
|
-
closeOption: {
|
|
716
|
-
aroundClick: true,
|
|
717
|
-
elementBlur: false,
|
|
718
|
-
...params.closeOption
|
|
719
|
-
},
|
|
720
|
-
content: <Picker
|
|
721
|
-
restrict={ params.restrict }
|
|
722
|
-
min={ params.min }
|
|
723
|
-
max={ params.max }
|
|
724
|
-
defaultValue={ params.defaultValue }
|
|
725
|
-
tipsID={ tipsID }
|
|
726
|
-
onValueUpdate={ ( value ) => {
|
|
727
|
-
params.onValueUpdate( value );
|
|
728
|
-
} }
|
|
729
|
-
/>
|
|
730
|
-
} )
|
|
731
|
-
},
|
|
732
|
-
remove: ( tipsID ) => {
|
|
733
|
-
Tooltips.close( tipsID );
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
}
|