amotify 0.0.59 → 0.0.62
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 +14 -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 +28 -44
- package/src/functions/Layout/PageViewController/parts.tsx +7 -7
- package/src/functions/Layout/Plate.tsx +5 -5
- package/src/functions/Layout/RootViewController/parts.tsx +94 -71
- package/src/functions/Layout/RootViewController/style.module.scss +0 -1
- 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,34 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
React
|
|
3
|
-
} from '@global'
|
|
3
|
+
} from '@global'
|
|
4
4
|
import {
|
|
5
5
|
Box,
|
|
6
6
|
FAI
|
|
7
|
-
} from '@atoms'
|
|
7
|
+
} from '@atoms'
|
|
8
8
|
import {
|
|
9
9
|
Row
|
|
10
|
-
} from '@mols'
|
|
10
|
+
} from '@mols'
|
|
11
11
|
import {
|
|
12
12
|
Buttons
|
|
13
|
-
} from '@fn'
|
|
13
|
+
} from '@fn'
|
|
14
14
|
import {
|
|
15
15
|
BoxWrapper,
|
|
16
16
|
SubmitForm,
|
|
17
17
|
ValidationCheck,
|
|
18
18
|
CommonEffects
|
|
19
|
-
} from '../core'
|
|
20
|
-
import style from './style.module.scss'
|
|
19
|
+
} from '../core'
|
|
20
|
+
import style from './style.module.scss'
|
|
21
21
|
|
|
22
22
|
function DefaultValidation( props: {
|
|
23
23
|
value: any
|
|
24
24
|
params: any
|
|
25
25
|
} ): amotify.fn.Input.Validation.Result {
|
|
26
|
-
let { value,params } = props
|
|
27
|
-
let { required } = params as amotify.fn.Input.TextArea.PlainParams
|
|
28
|
-
let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
|
|
26
|
+
let { value,params } = props
|
|
27
|
+
let { required } = params as amotify.fn.Input.TextArea.PlainParams
|
|
28
|
+
let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
|
|
29
29
|
|
|
30
30
|
if ( required && !value ) {
|
|
31
|
-
notice.push( { type: 'invalid',label: 'ONになっていません' } )
|
|
31
|
+
notice.push( { type: 'invalid',label: 'ONになっていません' } )
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
return {
|
|
@@ -56,7 +56,7 @@ export const SwitchInput: React.FC<amotify.fn.Input.Switch.PlainParams> = ( para
|
|
|
56
56
|
appearance = 'material',
|
|
57
57
|
|
|
58
58
|
...others
|
|
59
|
-
} = params
|
|
59
|
+
} = params
|
|
60
60
|
|
|
61
61
|
let Default_Status: amotify.fn.Input.Status.Plain = {
|
|
62
62
|
componentID: params.componentID || '',
|
|
@@ -64,12 +64,12 @@ export const SwitchInput: React.FC<amotify.fn.Input.Switch.PlainParams> = ( para
|
|
|
64
64
|
eventType: 'init',
|
|
65
65
|
eventID: $.uuidGen()
|
|
66
66
|
}
|
|
67
|
-
let [ val_status,set_status ] = React.useState( Default_Status )
|
|
67
|
+
let [ val_status,set_status ] = React.useState( Default_Status )
|
|
68
68
|
let [ val_validate,set_validate ] = React.useState( {
|
|
69
69
|
ok: false,
|
|
70
70
|
notice: []
|
|
71
|
-
} as amotify.fn.Input.Validation.Result )
|
|
72
|
-
let isChecked = !!val_status.dataValue
|
|
71
|
+
} as amotify.fn.Input.Validation.Result )
|
|
72
|
+
let isChecked = !!val_status.dataValue
|
|
73
73
|
|
|
74
74
|
CommonEffects( {
|
|
75
75
|
params,
|
|
@@ -83,7 +83,7 @@ export const SwitchInput: React.FC<amotify.fn.Input.Switch.PlainParams> = ( para
|
|
|
83
83
|
dataValue: value,
|
|
84
84
|
formatValue: value
|
|
85
85
|
},
|
|
86
|
-
} )
|
|
86
|
+
} )
|
|
87
87
|
|
|
88
88
|
return <BoxWrapper
|
|
89
89
|
val_status={ val_status }
|
|
@@ -102,19 +102,19 @@ export const SwitchInput: React.FC<amotify.fn.Input.Switch.PlainParams> = ( para
|
|
|
102
102
|
className={ style.Input }
|
|
103
103
|
id={ id }
|
|
104
104
|
onKeyDown={ ( event ) => {
|
|
105
|
-
if ( onKeyDown ) onKeyDown( event )
|
|
106
|
-
if ( enableFormSubmit ) SubmitForm( event )
|
|
105
|
+
if ( onKeyDown ) onKeyDown( event )
|
|
106
|
+
if ( enableFormSubmit ) SubmitForm( event )
|
|
107
107
|
} }
|
|
108
108
|
onChange={ ( event ) => {
|
|
109
|
-
if ( val_validate.ok ) set_validate( { ok: false,notice: [] } )
|
|
109
|
+
if ( val_validate.ok ) set_validate( { ok: false,notice: [] } )
|
|
110
110
|
set_status( {
|
|
111
111
|
...val_status,
|
|
112
112
|
dataValue: event.target.checked,
|
|
113
113
|
eventType: 'update',
|
|
114
114
|
eventID: $.uuidGen(),
|
|
115
|
-
} )
|
|
115
|
+
} )
|
|
116
116
|
|
|
117
|
-
if ( onChange ) onChange( event )
|
|
117
|
+
if ( onChange ) onChange( event )
|
|
118
118
|
} }
|
|
119
119
|
{ ...others }
|
|
120
120
|
/>
|
|
@@ -172,5 +172,5 @@ export const SwitchInput: React.FC<amotify.fn.Input.Switch.PlainParams> = ( para
|
|
|
172
172
|
</Row.Center>
|
|
173
173
|
</Box>
|
|
174
174
|
</Buttons.Label.Plain>
|
|
175
|
-
</BoxWrapper
|
|
175
|
+
</BoxWrapper>
|
|
176
176
|
}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
React,
|
|
3
|
-
} from '@global'
|
|
3
|
+
} from '@global'
|
|
4
4
|
import {
|
|
5
5
|
Box,
|
|
6
|
-
} from '@atoms'
|
|
6
|
+
} from '@atoms'
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
BoxWrapper,
|
|
10
10
|
SubmitForm,
|
|
11
11
|
CommonEffects
|
|
12
|
-
} from './core'
|
|
13
|
-
|
|
14
|
-
import style from './style.module.scss';
|
|
12
|
+
} from './core'
|
|
15
13
|
|
|
16
14
|
const ValidateTypes: {
|
|
17
15
|
[ key: string ]: {
|
|
@@ -37,7 +35,7 @@ const ValidateTypes: {
|
|
|
37
35
|
reason: '半角数字で入力してください'
|
|
38
36
|
},
|
|
39
37
|
fileName: {
|
|
40
|
-
reg: /[
|
|
38
|
+
reg: /[¥\/:*\?\"\'\|\.\s\n\r\<\>]/g,exist: false,
|
|
41
39
|
reason: '空白または一部の特殊文字は使用できません'
|
|
42
40
|
},
|
|
43
41
|
creditCard: {
|
|
@@ -88,80 +86,80 @@ const DataLeveling = ( params: {
|
|
|
88
86
|
let {
|
|
89
87
|
restrict,
|
|
90
88
|
value = ''
|
|
91
|
-
} = params
|
|
89
|
+
} = params
|
|
92
90
|
|
|
93
|
-
let dataValue = String( value )
|
|
94
|
-
let minus = false
|
|
91
|
+
let dataValue = String( value )
|
|
92
|
+
let minus = false
|
|
95
93
|
if ( [ 'tel','number','digitNumber','test','postal','creditCard' ].includes( restrict ) ) {
|
|
96
|
-
dataValue = dataValue.zen2hanNumber()
|
|
94
|
+
dataValue = dataValue.zen2hanNumber()
|
|
97
95
|
}
|
|
98
96
|
if ( restrict == 'katakana' ) {
|
|
99
|
-
dataValue = dataValue.replace( /[^ァ-ヶー ヲ-゚ ]/ig,'' )
|
|
97
|
+
dataValue = dataValue.replace( /[^ァ-ヶー ヲ-゚ ]/ig,'' )
|
|
100
98
|
}
|
|
101
99
|
if ( restrict == 'hankaku.katakana' ) {
|
|
102
|
-
dataValue = dataValue.replace( /[^ヲ-゚ ]/ig,'' )
|
|
100
|
+
dataValue = dataValue.replace( /[^ヲ-゚ ]/ig,'' )
|
|
103
101
|
}
|
|
104
102
|
if ( [ 'postal','creditCard' ].includes( restrict ) ) {
|
|
105
|
-
dataValue = dataValue.removeLetters()
|
|
103
|
+
dataValue = dataValue.removeLetters()
|
|
106
104
|
}
|
|
107
105
|
if ( [ 'number','digitNumber' ].includes( restrict ) ) {
|
|
108
106
|
if ( dataValue ) {
|
|
109
107
|
if ( dataValue == '-' ) {
|
|
110
108
|
|
|
111
109
|
} else if ( dataValue == '0-' ) {
|
|
112
|
-
dataValue = '-'
|
|
110
|
+
dataValue = '-'
|
|
113
111
|
} else {
|
|
114
|
-
if ( dataValue[ 0 ] == '-' ) minus = true
|
|
115
|
-
dataValue = dataValue.replace( /[^0-9\.]/ig,'' )
|
|
112
|
+
if ( dataValue[ 0 ] == '-' ) minus = true
|
|
113
|
+
dataValue = dataValue.replace( /[^0-9\.]/ig,'' )
|
|
116
114
|
|
|
117
|
-
let Amount = Number( dataValue )
|
|
118
|
-
if ( Amount === 0 ) minus = false
|
|
119
|
-
if ( minus ) Amount = -1 * Amount
|
|
115
|
+
let Amount = Number( dataValue )
|
|
116
|
+
if ( Amount === 0 ) minus = false
|
|
117
|
+
if ( minus ) Amount = -1 * Amount
|
|
120
118
|
|
|
121
119
|
if ( $.is.exist( params.min ) ) {
|
|
122
|
-
Amount = Math.max( Amount,Number( params.min ) )
|
|
120
|
+
Amount = Math.max( Amount,Number( params.min ) )
|
|
123
121
|
}
|
|
124
122
|
if ( $.is.exist( params.max ) ) {
|
|
125
|
-
Amount = Math.min( Amount,Number( params.max ) )
|
|
123
|
+
Amount = Math.min( Amount,Number( params.max ) )
|
|
126
124
|
}
|
|
127
|
-
dataValue = String( Math.abs( Amount ) )
|
|
125
|
+
dataValue = String( Math.abs( Amount ) )
|
|
128
126
|
}
|
|
129
127
|
}
|
|
130
128
|
}
|
|
131
129
|
|
|
132
|
-
let formatValue = dataValue
|
|
130
|
+
let formatValue = dataValue
|
|
133
131
|
if ( restrict == 'digitNumber' ) {
|
|
134
132
|
if ( dataValue && dataValue != '-' ) {
|
|
135
|
-
let arrary = []
|
|
133
|
+
let arrary = []
|
|
136
134
|
for ( let index = dataValue.length - 1; index >= 0; index-- ) {
|
|
137
|
-
arrary.unshift( dataValue[ index ] )
|
|
138
|
-
let Index = ( dataValue.length - 1 ) - index + 1
|
|
135
|
+
arrary.unshift( dataValue[ index ] )
|
|
136
|
+
let Index = ( dataValue.length - 1 ) - index + 1
|
|
139
137
|
if (
|
|
140
138
|
index != 0 && Index % 3 == 0 ) {
|
|
141
|
-
arrary.unshift( ',' )
|
|
139
|
+
arrary.unshift( ',' )
|
|
142
140
|
}
|
|
143
141
|
}
|
|
144
|
-
formatValue = arrary.join( '' )
|
|
142
|
+
formatValue = arrary.join( '' )
|
|
145
143
|
}
|
|
146
144
|
} else if ( restrict == 'postal' ) {
|
|
147
145
|
if ( dataValue.length >= 4 ) {
|
|
148
|
-
formatValue = dataValue.clip( 0,3 ) + '-' + dataValue.clip( 3 )
|
|
146
|
+
formatValue = dataValue.clip( 0,3 ) + '-' + dataValue.clip( 3 )
|
|
149
147
|
}
|
|
150
148
|
} else if ( restrict == 'creditCard' ) {
|
|
151
|
-
formatValue = dataValue.replace( /.{4}(?=.)/g,"$& " )
|
|
149
|
+
formatValue = dataValue.replace( /.{4}(?=.)/g,"$& " )
|
|
152
150
|
}
|
|
153
151
|
|
|
154
152
|
if ( [ 'number','digitNumber' ].includes( restrict ) ) {
|
|
155
153
|
if ( minus ) {
|
|
156
|
-
dataValue = '-' + dataValue
|
|
157
|
-
formatValue = '-' + formatValue
|
|
154
|
+
dataValue = '-' + dataValue
|
|
155
|
+
formatValue = '-' + formatValue
|
|
158
156
|
}
|
|
159
157
|
}
|
|
160
158
|
|
|
161
159
|
return {
|
|
162
160
|
formatValue,
|
|
163
161
|
dataValue
|
|
164
|
-
}
|
|
162
|
+
}
|
|
165
163
|
}
|
|
166
164
|
|
|
167
165
|
const setSelection: {
|
|
@@ -175,39 +173,43 @@ const setSelection: {
|
|
|
175
173
|
id,
|
|
176
174
|
restrict,
|
|
177
175
|
val_status
|
|
178
|
-
} = props
|
|
176
|
+
} = props
|
|
179
177
|
|
|
180
|
-
let input = $( '#' + id )[ 0 ] as HTMLInputElement
|
|
178
|
+
let input = $( '#' + id )[ 0 ] as HTMLInputElement
|
|
181
179
|
if ( input ) {
|
|
182
180
|
if ( val_status.prevValue && val_status.formatValue ) {
|
|
183
181
|
let {
|
|
184
182
|
formatValue: currentValue,
|
|
185
183
|
prevValue,
|
|
186
184
|
caretFrom,caretTo
|
|
187
|
-
} = val_status
|
|
185
|
+
} = val_status
|
|
188
186
|
|
|
189
187
|
if ( restrict == 'creditCard' ) {
|
|
190
188
|
if ( currentValue.length >= prevValue.length ) {
|
|
191
189
|
if ( caretFrom % 5 == 0 ) {
|
|
192
|
-
caretFrom
|
|
190
|
+
caretFrom++
|
|
191
|
+
caretTo++
|
|
193
192
|
}
|
|
194
193
|
}
|
|
195
|
-
input.setSelectionRange( caretFrom,caretTo )
|
|
194
|
+
input.setSelectionRange( caretFrom,caretTo )
|
|
196
195
|
} else if ( restrict == 'postal' ) {
|
|
197
196
|
if ( currentValue.length == 5 && prevValue.length == 3 ) {
|
|
198
|
-
caretFrom
|
|
197
|
+
caretFrom++
|
|
198
|
+
caretTo++
|
|
199
199
|
}
|
|
200
|
-
input.setSelectionRange( caretFrom,caretTo )
|
|
200
|
+
input.setSelectionRange( caretFrom,caretTo )
|
|
201
201
|
} else if ( restrict == 'digitNumber' ) {
|
|
202
|
-
let margin = currentValue.length - prevValue.length
|
|
202
|
+
let margin = currentValue.length - prevValue.length
|
|
203
203
|
|
|
204
204
|
if ( margin == 2 ) {
|
|
205
|
-
caretFrom
|
|
205
|
+
caretFrom++
|
|
206
|
+
caretTo++
|
|
206
207
|
}
|
|
207
208
|
if ( margin == -2 ) {
|
|
208
|
-
caretFrom
|
|
209
|
+
caretFrom--
|
|
210
|
+
caretTo--
|
|
209
211
|
}
|
|
210
|
-
input.setSelectionRange( caretFrom,caretTo )
|
|
212
|
+
input.setSelectionRange( caretFrom,caretTo )
|
|
211
213
|
}
|
|
212
214
|
}
|
|
213
215
|
}
|
|
@@ -218,19 +220,19 @@ export const TextValidate = ( value: any,restrict: amotify.fn.Input.Text.Restric
|
|
|
218
220
|
body: '' as any
|
|
219
221
|
};
|
|
220
222
|
( () => {
|
|
221
|
-
let kit = ValidateTypes[ restrict ]
|
|
222
|
-
if ( !kit ) return
|
|
223
|
+
let kit = ValidateTypes[ restrict ]
|
|
224
|
+
if ( !kit ) return
|
|
223
225
|
|
|
224
|
-
let reason = kit.reason
|
|
226
|
+
let reason = kit.reason
|
|
225
227
|
if ( kit ) {
|
|
226
|
-
let valid = Boolean( Number( !!value.match( kit.reg ) ) ^ Number( !kit.exist ) )
|
|
228
|
+
let valid = Boolean( Number( !!value.match( kit.reg ) ) ^ Number( !kit.exist ) )
|
|
227
229
|
response = {
|
|
228
230
|
ok: valid,
|
|
229
231
|
body: valid ? '' : reason
|
|
230
232
|
}
|
|
231
233
|
}
|
|
232
|
-
} )()
|
|
233
|
-
return response
|
|
234
|
+
} )()
|
|
235
|
+
return response
|
|
234
236
|
}
|
|
235
237
|
|
|
236
238
|
function DefaultValidation( props: {
|
|
@@ -240,24 +242,24 @@ function DefaultValidation( props: {
|
|
|
240
242
|
let {
|
|
241
243
|
value,
|
|
242
244
|
params
|
|
243
|
-
} = props
|
|
245
|
+
} = props
|
|
244
246
|
let {
|
|
245
247
|
restrict = 'text',
|
|
246
248
|
maxLength = 255,
|
|
247
249
|
required
|
|
248
250
|
} = params as amotify.fn.Input.Text.OriginParams
|
|
249
|
-
let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
|
|
251
|
+
let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
|
|
250
252
|
|
|
251
253
|
if ( $.is.exist( maxLength ) ) {
|
|
252
254
|
if ( value.length >= Number( maxLength ) ) {
|
|
253
|
-
notice.push( { type: 'invalid',label: maxLength + '字以内で入力してください' } )
|
|
255
|
+
notice.push( { type: 'invalid',label: maxLength + '字以内で入力してください' } )
|
|
254
256
|
}
|
|
255
257
|
}
|
|
256
258
|
if ( value ) {
|
|
257
|
-
let Valid = TextValidate( value,restrict )
|
|
258
|
-
if ( !Valid.ok ) notice.push( { type: 'invalid',label: Valid.body } )
|
|
259
|
+
let Valid = TextValidate( value,restrict )
|
|
260
|
+
if ( !Valid.ok ) notice.push( { type: 'invalid',label: Valid.body } )
|
|
259
261
|
} else if ( required ) {
|
|
260
|
-
notice.push( { type: 'invalid',label: '必須項目です' } )
|
|
262
|
+
notice.push( { type: 'invalid',label: '必須項目です' } )
|
|
261
263
|
}
|
|
262
264
|
|
|
263
265
|
return {
|
|
@@ -290,10 +292,10 @@ export const TextInput: React.FC<amotify.fn.Input.Text.OriginParams> = ( params
|
|
|
290
292
|
min,
|
|
291
293
|
max,
|
|
292
294
|
...others
|
|
293
|
-
} = params
|
|
295
|
+
} = params
|
|
294
296
|
|
|
295
|
-
let inputType = restrict == 'password' ? 'password' : 'text'
|
|
296
|
-
let inputMode: 'numeric' | 'text' | 'email' = [ 'number','digitNumber','creditCard' ].includes( restrict ) ? 'numeric' : restrict == 'email' ? 'email' : 'text'
|
|
297
|
+
let inputType = restrict == 'password' ? 'password' : 'text'
|
|
298
|
+
let inputMode: 'numeric' | 'text' | 'email' = [ 'number','digitNumber','creditCard' ].includes( restrict ) ? 'numeric' : restrict == 'email' ? 'email' : 'text'
|
|
297
299
|
|
|
298
300
|
let Default_Status: amotify.fn.Input.Status.Text = {
|
|
299
301
|
componentID: componentID!,
|
|
@@ -308,12 +310,12 @@ export const TextInput: React.FC<amotify.fn.Input.Text.OriginParams> = ( params
|
|
|
308
310
|
caretFrom: null as any,
|
|
309
311
|
caretTo: null as any
|
|
310
312
|
}
|
|
311
|
-
let [ val_isComposing,set_isComposing ] = React.useState( false )
|
|
312
|
-
let [ val_status,set_status ] = React.useState( Default_Status )
|
|
313
|
+
let [ val_isComposing,set_isComposing ] = React.useState( false )
|
|
314
|
+
let [ val_status,set_status ] = React.useState( Default_Status )
|
|
313
315
|
let [ val_validate,set_validate ] = React.useState( {
|
|
314
316
|
ok: false,
|
|
315
317
|
notice: []
|
|
316
|
-
} as amotify.fn.Input.Validation.Result )
|
|
318
|
+
} as amotify.fn.Input.Validation.Result )
|
|
317
319
|
|
|
318
320
|
CommonEffects( {
|
|
319
321
|
params,
|
|
@@ -331,11 +333,11 @@ export const TextInput: React.FC<amotify.fn.Input.Text.OriginParams> = ( params
|
|
|
331
333
|
value
|
|
332
334
|
} )
|
|
333
335
|
}
|
|
334
|
-
} )
|
|
336
|
+
} )
|
|
335
337
|
|
|
336
338
|
React.useEffect( () => {
|
|
337
|
-
setSelection( { id: params.id,restrict,val_status } )
|
|
338
|
-
},[ val_status ] )
|
|
339
|
+
setSelection( { id: params.id,restrict,val_status } )
|
|
340
|
+
},[ val_status ] )
|
|
339
341
|
|
|
340
342
|
return <BoxWrapper
|
|
341
343
|
val_status={ val_status }
|
|
@@ -355,31 +357,31 @@ export const TextInput: React.FC<amotify.fn.Input.Text.OriginParams> = ( params
|
|
|
355
357
|
autoComplete={ autoComplete }
|
|
356
358
|
autoCapitalize={ autoCapitalize }
|
|
357
359
|
onKeyDown={ ( event ) => {
|
|
358
|
-
let { key,target } = event
|
|
360
|
+
let { key,target } = event
|
|
359
361
|
|
|
360
362
|
{
|
|
361
|
-
let input = target as HTMLInputElement
|
|
362
|
-
let { selectionStart,selectionEnd } = input
|
|
363
|
-
let caretFrom = Number( selectionStart )
|
|
363
|
+
let input = target as HTMLInputElement
|
|
364
|
+
let { selectionStart,selectionEnd } = input
|
|
365
|
+
let caretFrom = Number( selectionStart )
|
|
364
366
|
let caretTo = Number( selectionEnd )
|
|
365
367
|
|
|
366
|
-
let _v = val_status.formatValue[ Number( caretFrom ) ]
|
|
367
|
-
let v_ = val_status.formatValue[ Number( caretFrom ) - 1 ]
|
|
368
|
+
let _v = val_status.formatValue[ Number( caretFrom ) ]
|
|
369
|
+
let v_ = val_status.formatValue[ Number( caretFrom ) - 1 ]
|
|
368
370
|
if ( key == 'Delete' && (
|
|
369
371
|
( restrict == 'creditCard' && _v == ' ' ) ||
|
|
370
372
|
( restrict == 'postal' && _v == '-' ) ||
|
|
371
373
|
( restrict == 'digitNumber' && _v == ',' )
|
|
372
374
|
) ) {
|
|
373
|
-
input.setSelectionRange( caretFrom + 1,caretTo + 1 )
|
|
374
|
-
event.preventDefault()
|
|
375
|
+
input.setSelectionRange( caretFrom + 1,caretTo + 1 )
|
|
376
|
+
event.preventDefault()
|
|
375
377
|
}
|
|
376
378
|
if ( key == 'Backspace' && (
|
|
377
379
|
( restrict == 'creditCard' && v_ == ' ' ) ||
|
|
378
380
|
( restrict == 'postal' && v_ == '-' ) ||
|
|
379
381
|
( restrict == 'digitNumber' && v_ == ',' )
|
|
380
382
|
) ) {
|
|
381
|
-
input.setSelectionRange( caretFrom - 1,caretTo - 1 )
|
|
382
|
-
event.preventDefault()
|
|
383
|
+
input.setSelectionRange( caretFrom - 1,caretTo - 1 )
|
|
384
|
+
event.preventDefault()
|
|
383
385
|
}
|
|
384
386
|
if ( key == 'Enter' || key == 'Tab' ) {
|
|
385
387
|
|
|
@@ -399,10 +401,10 @@ export const TextInput: React.FC<amotify.fn.Input.Text.OriginParams> = ( params
|
|
|
399
401
|
}
|
|
400
402
|
if ( [ 'number','digitNumber' ].includes( restrict ) ) {
|
|
401
403
|
if ( [ 'ArrowUp','ArrowDown' ].includes( key ) ) {
|
|
402
|
-
let direction = Number( key == 'ArrowUp' ) * 2 - 1
|
|
403
|
-
let Value = String( Number( val_status.dataValue ) + direction )
|
|
404
|
+
let direction = Number( key == 'ArrowUp' ) * 2 - 1
|
|
405
|
+
let Value = String( Number( val_status.dataValue ) + direction )
|
|
404
406
|
if ( val_validate.ok ) {
|
|
405
|
-
set_validate( { ok: false,notice: [] } )
|
|
407
|
+
set_validate( { ok: false,notice: [] } )
|
|
406
408
|
}
|
|
407
409
|
set_status( {
|
|
408
410
|
...val_status,
|
|
@@ -413,32 +415,32 @@ export const TextInput: React.FC<amotify.fn.Input.Text.OriginParams> = ( params
|
|
|
413
415
|
} ),
|
|
414
416
|
eventType: 'update',
|
|
415
417
|
eventID: $.uuidGen(),
|
|
416
|
-
} )
|
|
417
|
-
event.preventDefault()
|
|
418
|
+
} )
|
|
419
|
+
event.preventDefault()
|
|
418
420
|
}
|
|
419
421
|
}
|
|
420
422
|
|
|
421
|
-
if ( onKeyDown ) onKeyDown( event )
|
|
422
|
-
if ( enableFormSubmit ) SubmitForm( event )
|
|
423
|
+
if ( onKeyDown ) onKeyDown( event )
|
|
424
|
+
if ( enableFormSubmit ) SubmitForm( event )
|
|
423
425
|
} }
|
|
424
426
|
onChange={ ( event ) => {
|
|
425
427
|
let {
|
|
426
428
|
value: rawValue,
|
|
427
429
|
selectionStart,
|
|
428
430
|
selectionEnd
|
|
429
|
-
} = event.target
|
|
431
|
+
} = event.target
|
|
430
432
|
|
|
431
433
|
let value = DataLeveling( {
|
|
432
434
|
min,max,
|
|
433
435
|
restrict,
|
|
434
436
|
value: rawValue
|
|
435
|
-
} )
|
|
437
|
+
} )
|
|
436
438
|
|
|
437
|
-
if ( val_isComposing ) value.formatValue = rawValue
|
|
439
|
+
if ( val_isComposing ) value.formatValue = rawValue
|
|
438
440
|
|
|
439
|
-
if ( value.formatValue == val_status.formatValue ) return
|
|
441
|
+
if ( value.formatValue == val_status.formatValue ) return
|
|
440
442
|
|
|
441
|
-
if ( val_validate.ok ) set_validate( { ok: false,notice: [] } )
|
|
443
|
+
if ( val_validate.ok ) set_validate( { ok: false,notice: [] } )
|
|
442
444
|
|
|
443
445
|
set_status( {
|
|
444
446
|
...val_status,
|
|
@@ -448,27 +450,27 @@ export const TextInput: React.FC<amotify.fn.Input.Text.OriginParams> = ( params
|
|
|
448
450
|
eventID: $.uuidGen(),
|
|
449
451
|
caretFrom: Number( selectionStart ),
|
|
450
452
|
caretTo: Number( selectionEnd )
|
|
451
|
-
} )
|
|
453
|
+
} )
|
|
452
454
|
|
|
453
|
-
if ( onChange ) onChange( event )
|
|
455
|
+
if ( onChange ) onChange( event )
|
|
454
456
|
} }
|
|
455
457
|
{ ...others }
|
|
456
458
|
onCompositionStart={ ( event ) => {
|
|
457
|
-
others?.onCompositionStart && others?.onCompositionStart( event )
|
|
458
|
-
set_isComposing( true )
|
|
459
|
+
others?.onCompositionStart && others?.onCompositionStart( event )
|
|
460
|
+
set_isComposing( true )
|
|
459
461
|
} }
|
|
460
462
|
onCompositionEnd={ ( event ) => {
|
|
461
|
-
others?.onCompositionEnd && others?.onCompositionEnd( event )
|
|
463
|
+
others?.onCompositionEnd && others?.onCompositionEnd( event )
|
|
462
464
|
|
|
463
465
|
if ( restrict == 'text' ) {
|
|
464
|
-
return
|
|
466
|
+
return
|
|
465
467
|
}
|
|
466
468
|
|
|
467
469
|
let value = DataLeveling( {
|
|
468
470
|
min,max,
|
|
469
471
|
restrict,
|
|
470
472
|
value: val_status.formatValue
|
|
471
|
-
} )
|
|
473
|
+
} )
|
|
472
474
|
set_status( {
|
|
473
475
|
...val_status,
|
|
474
476
|
...value,
|
|
@@ -477,9 +479,9 @@ export const TextInput: React.FC<amotify.fn.Input.Text.OriginParams> = ( params
|
|
|
477
479
|
eventID: $.uuidGen(),
|
|
478
480
|
caretFrom: Number( val_status.formatValue.length + 1 ),
|
|
479
481
|
caretTo: Number( val_status.formatValue.length + 1 )
|
|
480
|
-
} )
|
|
481
|
-
set_isComposing( false )
|
|
482
|
+
} )
|
|
483
|
+
set_isComposing( false )
|
|
482
484
|
} }
|
|
483
485
|
/>
|
|
484
|
-
</BoxWrapper
|
|
486
|
+
</BoxWrapper>
|
|
485
487
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
React,
|
|
3
|
-
} from '@global'
|
|
3
|
+
} from '@global'
|
|
4
4
|
import {
|
|
5
5
|
BoxWrapper,
|
|
6
6
|
SubmitForm,
|
|
@@ -8,18 +8,18 @@ import {
|
|
|
8
8
|
CommonEffects
|
|
9
9
|
} from './core'
|
|
10
10
|
|
|
11
|
-
import style from './style.module.scss'
|
|
11
|
+
import style from './style.module.scss'
|
|
12
12
|
|
|
13
13
|
function DefaultValidation( props: {
|
|
14
14
|
value: any
|
|
15
15
|
params: any
|
|
16
16
|
} ): amotify.fn.Input.Validation.Result {
|
|
17
|
-
let { value,params } = props
|
|
18
|
-
let { required } = params as amotify.fn.Input.TextArea.PlainParams
|
|
19
|
-
let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
|
|
17
|
+
let { value,params } = props
|
|
18
|
+
let { required } = params as amotify.fn.Input.TextArea.PlainParams
|
|
19
|
+
let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
|
|
20
20
|
|
|
21
21
|
if ( required && !value ) {
|
|
22
|
-
notice.push( { type: 'invalid',label: '必須項目です' } )
|
|
22
|
+
notice.push( { type: 'invalid',label: '必須項目です' } )
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
return {
|
|
@@ -46,7 +46,7 @@ export const TextAreaInput: React.FC<amotify.fn.Input.TextArea.PlainParams> = (
|
|
|
46
46
|
leftIndicator,rightIndicator,leftIcon,rightIcon,
|
|
47
47
|
|
|
48
48
|
...others
|
|
49
|
-
} = params
|
|
49
|
+
} = params
|
|
50
50
|
|
|
51
51
|
let Default_Status: amotify.fn.Input.Status.Plain = {
|
|
52
52
|
componentID: componentID!,
|
|
@@ -54,11 +54,11 @@ export const TextAreaInput: React.FC<amotify.fn.Input.TextArea.PlainParams> = (
|
|
|
54
54
|
eventType: 'init',
|
|
55
55
|
eventID: $.uuidGen()
|
|
56
56
|
}
|
|
57
|
-
let [ val_status,set_status ] = React.useState( Default_Status )
|
|
57
|
+
let [ val_status,set_status ] = React.useState( Default_Status )
|
|
58
58
|
let [ val_validate,set_validate ] = React.useState( {
|
|
59
59
|
ok: false,
|
|
60
60
|
notice: []
|
|
61
|
-
} as amotify.fn.Input.Validation.Result )
|
|
61
|
+
} as amotify.fn.Input.Validation.Result )
|
|
62
62
|
|
|
63
63
|
CommonEffects( {
|
|
64
64
|
params,
|
|
@@ -69,7 +69,7 @@ export const TextAreaInput: React.FC<amotify.fn.Input.TextArea.PlainParams> = (
|
|
|
69
69
|
onUpdateValue,
|
|
70
70
|
onUpdateValidValue,
|
|
71
71
|
DefaultValidation
|
|
72
|
-
} )
|
|
72
|
+
} )
|
|
73
73
|
|
|
74
74
|
return <BoxWrapper
|
|
75
75
|
val_status={ val_status }
|
|
@@ -85,25 +85,25 @@ export const TextAreaInput: React.FC<amotify.fn.Input.TextArea.PlainParams> = (
|
|
|
85
85
|
data-component-id={ val_status.componentID }
|
|
86
86
|
value={ val_status.dataValue }
|
|
87
87
|
onKeyDown={ ( event ) => {
|
|
88
|
-
if ( onKeyDown ) onKeyDown( event )
|
|
89
|
-
if ( enableFormSubmit ) SubmitForm( event )
|
|
88
|
+
if ( onKeyDown ) onKeyDown( event )
|
|
89
|
+
if ( enableFormSubmit ) SubmitForm( event )
|
|
90
90
|
} }
|
|
91
91
|
onChange={ ( event ) => {
|
|
92
92
|
let {
|
|
93
93
|
value
|
|
94
|
-
} = event.target
|
|
94
|
+
} = event.target
|
|
95
95
|
|
|
96
|
-
if ( val_validate.ok ) set_validate( { ok: false,notice: [] } )
|
|
96
|
+
if ( val_validate.ok ) set_validate( { ok: false,notice: [] } )
|
|
97
97
|
set_status( {
|
|
98
98
|
...val_status,
|
|
99
99
|
dataValue: value,
|
|
100
100
|
eventType: 'update',
|
|
101
101
|
eventID: $.uuidGen(),
|
|
102
|
-
} )
|
|
102
|
+
} )
|
|
103
103
|
|
|
104
|
-
if ( onChange ) onChange( event )
|
|
104
|
+
if ( onChange ) onChange( event )
|
|
105
105
|
} }
|
|
106
106
|
{ ...others }
|
|
107
107
|
/>
|
|
108
|
-
</BoxWrapper
|
|
108
|
+
</BoxWrapper>
|
|
109
109
|
}
|