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,33 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
2
|
React
|
|
3
|
-
} from '@global'
|
|
3
|
+
} from '@global'
|
|
4
4
|
import {
|
|
5
5
|
FAI
|
|
6
|
-
} from '@atoms'
|
|
6
|
+
} from '@atoms'
|
|
7
7
|
import {
|
|
8
8
|
Column,
|
|
9
9
|
Row,
|
|
10
10
|
Text
|
|
11
|
-
} from '@mols'
|
|
11
|
+
} from '@mols'
|
|
12
12
|
import {
|
|
13
13
|
Input,
|
|
14
14
|
Buttons,
|
|
15
15
|
Loader,
|
|
16
16
|
Sheet
|
|
17
|
-
} from '@fn'
|
|
17
|
+
} from '@fn'
|
|
18
18
|
|
|
19
19
|
import {
|
|
20
20
|
BoxWrapper,
|
|
21
21
|
SubmitForm,
|
|
22
22
|
ValidationCheck,
|
|
23
23
|
CommonEffects
|
|
24
|
-
} from '../core'
|
|
24
|
+
} from '../core'
|
|
25
25
|
|
|
26
26
|
import {
|
|
27
27
|
ChipsInputFNs
|
|
28
|
-
} from './Selector'
|
|
28
|
+
} from './Selector'
|
|
29
29
|
|
|
30
|
-
import coreStyle from '../style.module.scss'
|
|
30
|
+
import coreStyle from '../style.module.scss'
|
|
31
31
|
|
|
32
32
|
function DefaultValidation( props: {
|
|
33
33
|
value: any
|
|
@@ -36,14 +36,14 @@ function DefaultValidation( props: {
|
|
|
36
36
|
let {
|
|
37
37
|
value,
|
|
38
38
|
params
|
|
39
|
-
} = props
|
|
39
|
+
} = props
|
|
40
40
|
let {
|
|
41
41
|
required
|
|
42
|
-
} = params as amotify.fn.Input.Chips.PlainParams
|
|
43
|
-
let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
|
|
42
|
+
} = params as amotify.fn.Input.Chips.PlainParams
|
|
43
|
+
let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
|
|
44
44
|
|
|
45
45
|
if ( required && !value.length ) {
|
|
46
|
-
notice.push( { type: 'invalid',label: '一つ以上選択してください' } )
|
|
46
|
+
notice.push( { type: 'invalid',label: '一つ以上選択してください' } )
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
return {
|
|
@@ -53,8 +53,8 @@ function DefaultValidation( props: {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const DataWrapping: React.FC<amotify.fn.Input.Chips.PlainParams> = ( params ) => {
|
|
56
|
-
let DefaultValues = [ ...( params.value || [] ) ]
|
|
57
|
-
let Values = DefaultValues.splice( 0,params.limit || 65535 )
|
|
56
|
+
let DefaultValues = [ ...( params.value || [] ) ]
|
|
57
|
+
let Values = DefaultValues.splice( 0,params.limit || 65535 )
|
|
58
58
|
|
|
59
59
|
return <Core
|
|
60
60
|
SelectedCellComponent={ ( params ) => {
|
|
@@ -62,7 +62,7 @@ const DataWrapping: React.FC<amotify.fn.Input.Chips.PlainParams> = ( params ) =>
|
|
|
62
62
|
value,
|
|
63
63
|
label,
|
|
64
64
|
removeCallback
|
|
65
|
-
} = params
|
|
65
|
+
} = params
|
|
66
66
|
|
|
67
67
|
return <Row.Left
|
|
68
68
|
ssCardBox
|
|
@@ -73,25 +73,25 @@ const DataWrapping: React.FC<amotify.fn.Input.Chips.PlainParams> = ( params ) =>
|
|
|
73
73
|
>
|
|
74
74
|
{ label }
|
|
75
75
|
{ params.defaultRemoveButton }
|
|
76
|
-
</Row.Left
|
|
76
|
+
</Row.Left>
|
|
77
77
|
} }
|
|
78
78
|
AddButtonComponent={ ( props ) => {
|
|
79
|
-
if ( params.limit && params.limit <= props.selected.length ) return null
|
|
79
|
+
if ( params.limit && params.limit <= props.selected.length ) return null
|
|
80
80
|
|
|
81
81
|
return <Buttons.Button.Sub.R
|
|
82
82
|
color='cloud'
|
|
83
83
|
padding={ '1/2' }
|
|
84
84
|
onClick={ () => {
|
|
85
|
-
props.openCallback()
|
|
85
|
+
props.openCallback()
|
|
86
86
|
} }
|
|
87
87
|
>
|
|
88
88
|
<FAI.Plus />
|
|
89
89
|
追加する
|
|
90
|
-
</Buttons.Button.Sub.R
|
|
90
|
+
</Buttons.Button.Sub.R>
|
|
91
91
|
} }
|
|
92
92
|
{ ...params }
|
|
93
93
|
value={ Values }
|
|
94
|
-
|
|
94
|
+
/>
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
const Core: React.FC<amotify.fn.Input.Chips.PlainParams> = ( params ) => {
|
|
@@ -116,22 +116,22 @@ const Core: React.FC<amotify.fn.Input.Chips.PlainParams> = ( params ) => {
|
|
|
116
116
|
enableFormSubmit,
|
|
117
117
|
|
|
118
118
|
...others
|
|
119
|
-
} = params
|
|
120
|
-
AddButtonComponent = AddButtonComponent
|
|
119
|
+
} = params
|
|
120
|
+
AddButtonComponent = AddButtonComponent!
|
|
121
121
|
|
|
122
|
-
let [ val_selectorID ] = React.useState( $.uuidGen() )
|
|
122
|
+
let [ val_selectorID ] = React.useState( $.uuidGen() )
|
|
123
123
|
let [ val_status,set_status ] = React.useState( {
|
|
124
124
|
componentID: params.componentID || '',
|
|
125
125
|
dataValue: value.map( ( val: any ) => val ),
|
|
126
126
|
eventID: $.uuidGen(),
|
|
127
127
|
eventType: 'init'
|
|
128
|
-
} as amotify.fn.Input.Status.Plain )
|
|
128
|
+
} as amotify.fn.Input.Status.Plain )
|
|
129
129
|
let [ val_validate,set_validate ] = React.useState( {
|
|
130
130
|
ok: false,
|
|
131
131
|
notice: []
|
|
132
|
-
} as amotify.fn.Input.Validation.Result )
|
|
132
|
+
} as amotify.fn.Input.Validation.Result )
|
|
133
133
|
|
|
134
|
-
let [ val_selected,set_selected ] = React.useState( [ ...value ] )
|
|
134
|
+
let [ val_selected,set_selected ] = React.useState( [ ...value ] )
|
|
135
135
|
|
|
136
136
|
CommonEffects( {
|
|
137
137
|
params,
|
|
@@ -146,16 +146,16 @@ const Core: React.FC<amotify.fn.Input.Chips.PlainParams> = ( params ) => {
|
|
|
146
146
|
ExtraStoreParams: {
|
|
147
147
|
searchTimer: null
|
|
148
148
|
}
|
|
149
|
-
} )
|
|
149
|
+
} )
|
|
150
150
|
|
|
151
151
|
const UpdateValue = ( values: amotify.fn.Input.Chips.OptionParams[] ) => {
|
|
152
|
-
set_selected( values )
|
|
152
|
+
set_selected( values )
|
|
153
153
|
set_status( {
|
|
154
154
|
...val_status,
|
|
155
155
|
dataValue: values.map( ( val: any ) => val ),
|
|
156
156
|
eventID: $.uuidGen(),
|
|
157
157
|
eventType: 'update'
|
|
158
|
-
} as amotify.fn.Input.Status.Plain )
|
|
158
|
+
} as amotify.fn.Input.Status.Plain )
|
|
159
159
|
}
|
|
160
160
|
const OpenSelector = () => {
|
|
161
161
|
ChipsInputFNs.openSelector( {
|
|
@@ -168,43 +168,43 @@ const Core: React.FC<amotify.fn.Input.Chips.PlainParams> = ( params ) => {
|
|
|
168
168
|
limit: params.limit,
|
|
169
169
|
onDynamicSearch: params.onDynamicSearch,
|
|
170
170
|
onUpdated: ( args ) => {
|
|
171
|
-
UpdateValue( args.values )
|
|
171
|
+
UpdateValue( args.values )
|
|
172
172
|
},
|
|
173
173
|
onClosed: () => {
|
|
174
|
-
$( DefaultParentQuerySelector ).focus()
|
|
174
|
+
$( DefaultParentQuerySelector ).focus()
|
|
175
175
|
}
|
|
176
|
-
} )
|
|
176
|
+
} )
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
let DefaultParentQuerySelector = `[data-chips-input-wrapper="${ val_selectorID }"]
|
|
180
|
-
let isFully = limit && limit <= val_selected.length
|
|
179
|
+
let DefaultParentQuerySelector = `[data-chips-input-wrapper="${ val_selectorID }"]`
|
|
180
|
+
let isFully = limit && limit <= val_selected.length
|
|
181
181
|
|
|
182
|
-
const mounted = React.useRef( false )
|
|
182
|
+
const mounted = React.useRef( false )
|
|
183
183
|
React.useEffect( () => {
|
|
184
184
|
if ( mounted.current ) {
|
|
185
185
|
if ( isFully ) {
|
|
186
|
-
Sheet.close( val_selectorID )
|
|
187
|
-
$( DefaultParentQuerySelector ).focus()
|
|
186
|
+
Sheet.close( val_selectorID )
|
|
187
|
+
$( DefaultParentQuerySelector ).focus()
|
|
188
188
|
}
|
|
189
189
|
} else {
|
|
190
|
-
mounted.current = true
|
|
190
|
+
mounted.current = true
|
|
191
191
|
}
|
|
192
|
-
},[ val_selected ] )
|
|
192
|
+
},[ val_selected ] )
|
|
193
193
|
|
|
194
194
|
let Selected = val_selected.map( ( s ) => {
|
|
195
|
-
let { value,label } = s
|
|
196
|
-
SelectedCellComponent = SelectedCellComponent
|
|
195
|
+
let { value,label } = s
|
|
196
|
+
SelectedCellComponent = SelectedCellComponent!
|
|
197
197
|
|
|
198
198
|
const removeCallback = () => {
|
|
199
|
-
let findIndex = val_selected.findIndex( ( v ) => v.value == value )
|
|
200
|
-
if ( findIndex == -1 ) return
|
|
201
|
-
let newSelected = [ ...val_selected ]
|
|
202
|
-
newSelected.splice( findIndex,1 )
|
|
203
|
-
UpdateValue( newSelected )
|
|
199
|
+
let findIndex = val_selected.findIndex( ( v ) => v.value == value )
|
|
200
|
+
if ( findIndex == -1 ) return
|
|
201
|
+
let newSelected = [ ...val_selected ]
|
|
202
|
+
newSelected.splice( findIndex,1 )
|
|
203
|
+
UpdateValue( newSelected )
|
|
204
204
|
if ( !newSelected.length ) {
|
|
205
205
|
setTimeout( () => {
|
|
206
|
-
$( DefaultParentQuerySelector ).focus()
|
|
207
|
-
},200 )
|
|
206
|
+
$( DefaultParentQuerySelector ).focus()
|
|
207
|
+
},200 )
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
return <SelectedCellComponent
|
|
@@ -219,16 +219,16 @@ const Core: React.FC<amotify.fn.Input.Chips.PlainParams> = ( params ) => {
|
|
|
219
219
|
backgroundColor='cloud'
|
|
220
220
|
isRounded
|
|
221
221
|
onClick={ () => {
|
|
222
|
-
removeCallback()
|
|
222
|
+
removeCallback()
|
|
223
223
|
} }
|
|
224
224
|
>
|
|
225
225
|
<FAI.Times />
|
|
226
226
|
</Buttons.Button.Sub.S> }
|
|
227
227
|
openCallback={ () => {
|
|
228
|
-
OpenSelector()
|
|
228
|
+
OpenSelector()
|
|
229
229
|
} }
|
|
230
230
|
/>
|
|
231
|
-
} )
|
|
231
|
+
} )
|
|
232
232
|
|
|
233
233
|
return <BoxWrapper
|
|
234
234
|
val_status={ val_status }
|
|
@@ -248,30 +248,30 @@ const Core: React.FC<amotify.fn.Input.Chips.PlainParams> = ( params ) => {
|
|
|
248
248
|
<button
|
|
249
249
|
data-chips-input-wrapper={ val_selectorID }
|
|
250
250
|
onKeyDown={ ( e ) => {
|
|
251
|
-
let { key,ctrlKey,metaKey,keyCode } = e
|
|
252
|
-
let auxKey = ctrlKey || metaKey
|
|
253
|
-
let isString = ( keyCode >= 48 && keyCode <= 57 ) || ( keyCode >= 65 && keyCode <= 90 ) || ( keyCode >= 96 && keyCode <= 105 )
|
|
251
|
+
let { key,ctrlKey,metaKey,keyCode } = e
|
|
252
|
+
let auxKey = ctrlKey || metaKey
|
|
253
|
+
let isString = ( keyCode >= 48 && keyCode <= 57 ) || ( keyCode >= 65 && keyCode <= 90 ) || ( keyCode >= 96 && keyCode <= 105 )
|
|
254
254
|
|
|
255
255
|
if ( isString ) {
|
|
256
|
-
if ( isFully ) return
|
|
257
|
-
OpenSelector()
|
|
256
|
+
if ( isFully ) return
|
|
257
|
+
OpenSelector()
|
|
258
258
|
} else if ( key == 'Tab' ) {
|
|
259
259
|
|
|
260
260
|
} else if ( key == 'Backspace' ) {
|
|
261
|
-
if ( !val_selected.length ) return
|
|
261
|
+
if ( !val_selected.length ) return
|
|
262
262
|
if ( auxKey ) {
|
|
263
|
-
UpdateValue( [] )
|
|
263
|
+
UpdateValue( [] )
|
|
264
264
|
} else {
|
|
265
|
-
let newSelected = [ ...val_selected ]
|
|
266
|
-
newSelected.pop()
|
|
267
|
-
UpdateValue( newSelected )
|
|
265
|
+
let newSelected = [ ...val_selected ]
|
|
266
|
+
newSelected.pop()
|
|
267
|
+
UpdateValue( newSelected )
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
} }
|
|
271
271
|
onClick={ () => {
|
|
272
|
-
if ( isFully ) return
|
|
273
|
-
// if ( val_selected.length ) return
|
|
274
|
-
OpenSelector()
|
|
272
|
+
if ( isFully ) return
|
|
273
|
+
// if ( val_selected.length ) return
|
|
274
|
+
OpenSelector()
|
|
275
275
|
} }
|
|
276
276
|
{ ...others }
|
|
277
277
|
>
|
|
@@ -281,9 +281,9 @@ const Core: React.FC<amotify.fn.Input.Chips.PlainParams> = ( params ) => {
|
|
|
281
281
|
/> : null }
|
|
282
282
|
{ Selected }
|
|
283
283
|
</button>
|
|
284
|
-
</BoxWrapper
|
|
284
|
+
</BoxWrapper>
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
const ChipsInput: amotify.fn.Input.Chips.Methods = DataWrapping as any
|
|
288
|
-
ChipsInput.fn = ChipsInputFNs
|
|
287
|
+
const ChipsInput: amotify.fn.Input.Chips.Methods = DataWrapping as any
|
|
288
|
+
ChipsInput.fn = ChipsInputFNs
|
|
289
289
|
export { ChipsInput }
|
|
@@ -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.Contenteditable.PlainParams
|
|
19
|
-
let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
|
|
17
|
+
let { value,params } = props
|
|
18
|
+
let { required } = params as amotify.fn.Input.Contenteditable.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 ContenteditableInput: React.FC<amotify.fn.Input.Contenteditable.Pla
|
|
|
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 ContenteditableInput: React.FC<amotify.fn.Input.Contenteditable.Pla
|
|
|
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 ContenteditableInput: React.FC<amotify.fn.Input.Contenteditable.Pla
|
|
|
69
69
|
onUpdateValue,
|
|
70
70
|
onUpdateValidValue,
|
|
71
71
|
DefaultValidation
|
|
72
|
-
} )
|
|
72
|
+
} )
|
|
73
73
|
|
|
74
74
|
return <BoxWrapper
|
|
75
75
|
val_status={ val_status }
|
|
@@ -86,29 +86,29 @@ export const ContenteditableInput: React.FC<amotify.fn.Input.Contenteditable.Pla
|
|
|
86
86
|
data-value={ val_status.dataValue }
|
|
87
87
|
data-component-id={ val_status.componentID }
|
|
88
88
|
onKeyDown={ ( event ) => {
|
|
89
|
-
!!onKeyDown && onKeyDown( event )
|
|
90
|
-
!!enableFormSubmit && SubmitForm( event )
|
|
89
|
+
!!onKeyDown && onKeyDown( event )
|
|
90
|
+
!!enableFormSubmit && SubmitForm( event )
|
|
91
91
|
} }
|
|
92
92
|
onInput={ ( event ) => {
|
|
93
|
-
let contentEditor = event.currentTarget as HTMLDivElement
|
|
93
|
+
let contentEditor = event.currentTarget as HTMLDivElement
|
|
94
94
|
let {
|
|
95
95
|
innerHTML,
|
|
96
96
|
innerText
|
|
97
|
-
} = contentEditor
|
|
97
|
+
} = contentEditor
|
|
98
98
|
|
|
99
|
-
if ( val_validate.ok ) set_validate( { ok: false,notice: [] } )
|
|
99
|
+
if ( val_validate.ok ) set_validate( { ok: false,notice: [] } )
|
|
100
100
|
set_status( {
|
|
101
101
|
...val_status,
|
|
102
102
|
dataValue: innerText,
|
|
103
103
|
eventType: 'update',
|
|
104
104
|
eventID: $.uuidGen(),
|
|
105
|
-
} )
|
|
105
|
+
} )
|
|
106
106
|
|
|
107
|
-
onInput && onInput( event )
|
|
107
|
+
onInput && onInput( event )
|
|
108
108
|
} }
|
|
109
109
|
{ ...others }
|
|
110
110
|
>
|
|
111
111
|
{ children }
|
|
112
112
|
</div>
|
|
113
|
-
</BoxWrapper
|
|
113
|
+
</BoxWrapper>
|
|
114
114
|
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import {
|
|
2
2
|
React
|
|
3
|
-
} from '@global'
|
|
3
|
+
} from '@global'
|
|
4
4
|
import {
|
|
5
5
|
Flex
|
|
6
|
-
} from '@atoms'
|
|
6
|
+
} from '@atoms'
|
|
7
7
|
import {
|
|
8
8
|
Input
|
|
9
|
-
} from '@fn'
|
|
9
|
+
} from '@fn'
|
|
10
10
|
import {
|
|
11
11
|
BoxWrapper,
|
|
12
12
|
SubmitForm,
|
|
13
13
|
CommonEffects
|
|
14
14
|
} from './core'
|
|
15
15
|
|
|
16
|
-
import style from './style.module.scss'
|
|
16
|
+
import style from './style.module.scss'
|
|
17
17
|
|
|
18
18
|
function DefaultValidation( props: {
|
|
19
19
|
value: any
|
|
20
20
|
params: any
|
|
21
21
|
} ): amotify.fn.Input.Validation.Result {
|
|
22
|
-
let { value,params } = props
|
|
22
|
+
let { value,params } = props
|
|
23
23
|
let {
|
|
24
24
|
required,
|
|
25
25
|
numericOnly = false,
|
|
26
26
|
digits
|
|
27
|
-
} = params as amotify.fn.Input.DigitCharacters.PlainParams
|
|
28
|
-
let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
|
|
27
|
+
} = params as amotify.fn.Input.DigitCharacters.PlainParams
|
|
28
|
+
let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
|
|
29
29
|
|
|
30
30
|
if ( required && !value ) {
|
|
31
|
-
notice.push( { type: 'invalid',label: '必須項目です' } )
|
|
31
|
+
notice.push( { type: 'invalid',label: '必須項目です' } )
|
|
32
32
|
}
|
|
33
33
|
if ( value ) {
|
|
34
34
|
if ( numericOnly && value.match( /\D/ ) ) {
|
|
35
|
-
notice.push( { type: 'invalid',label: '数字のみで入力してください' } )
|
|
35
|
+
notice.push( { type: 'invalid',label: '数字のみで入力してください' } )
|
|
36
36
|
}
|
|
37
37
|
if ( value.length != digits ) {
|
|
38
|
-
notice.push( { type: 'warn',label: '最後まで入力してください' } )
|
|
38
|
+
notice.push( { type: 'warn',label: '最後まで入力してください' } )
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -47,19 +47,19 @@ function DefaultValidation( props: {
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
const dataToFormat = ( digits: number,value: any = '' ) => {
|
|
50
|
-
let dataValue = String( value )
|
|
51
|
-
let formatValue: any = []
|
|
50
|
+
let dataValue = String( value )
|
|
51
|
+
let formatValue: any = []
|
|
52
52
|
for ( let index = 0; index < digits; index++ ) {
|
|
53
|
-
formatValue[ index ] = dataValue[ index ] || ''
|
|
53
|
+
formatValue[ index ] = dataValue[ index ] || ''
|
|
54
54
|
}
|
|
55
55
|
return {
|
|
56
56
|
formatValue,
|
|
57
57
|
dataValue
|
|
58
|
-
}
|
|
58
|
+
}
|
|
59
59
|
}
|
|
60
60
|
const formatToData = ( value: any = '' ) => {
|
|
61
|
-
let formatValue = value
|
|
62
|
-
let dataValue = formatValue.join( '' )
|
|
61
|
+
let formatValue = value
|
|
62
|
+
let dataValue = formatValue.join( '' )
|
|
63
63
|
return {
|
|
64
64
|
formatValue,
|
|
65
65
|
dataValue
|
|
@@ -91,10 +91,10 @@ export const DigitCharactersInput: React.FC<amotify.fn.Input.DigitCharacters.Pla
|
|
|
91
91
|
componentID,
|
|
92
92
|
listStyles,
|
|
93
93
|
...others
|
|
94
|
-
} = params
|
|
94
|
+
} = params
|
|
95
95
|
|
|
96
96
|
if ( numericOnly ) {
|
|
97
|
-
params.inputMode = params.inputMode || 'numeric'
|
|
97
|
+
params.inputMode = params.inputMode || 'numeric'
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
let Default_Status: amotify.fn.Input.Status.DigitCharacters = {
|
|
@@ -104,11 +104,11 @@ export const DigitCharactersInput: React.FC<amotify.fn.Input.DigitCharacters.Pla
|
|
|
104
104
|
eventID: $.uuidGen()
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
let [ val_status,set_status ] = React.useState( Default_Status )
|
|
107
|
+
let [ val_status,set_status ] = React.useState( Default_Status )
|
|
108
108
|
let [ val_validate,set_validate ] = React.useState( {
|
|
109
109
|
ok: false,
|
|
110
110
|
notice: []
|
|
111
|
-
} as amotify.fn.Input.Validation.Result )
|
|
111
|
+
} as amotify.fn.Input.Validation.Result )
|
|
112
112
|
|
|
113
113
|
CommonEffects( {
|
|
114
114
|
params,
|
|
@@ -119,22 +119,22 @@ export const DigitCharactersInput: React.FC<amotify.fn.Input.DigitCharacters.Pla
|
|
|
119
119
|
onUpdateValue,
|
|
120
120
|
onUpdateValidValue,
|
|
121
121
|
DefaultValidation
|
|
122
|
-
} )
|
|
122
|
+
} )
|
|
123
123
|
|
|
124
|
-
let Digits = []
|
|
124
|
+
let Digits = []
|
|
125
125
|
for ( let index = 0; index < digits; index++ ) {
|
|
126
|
-
let Character = val_status.formatValue[ index ]
|
|
126
|
+
let Character = val_status.formatValue[ index ]
|
|
127
127
|
|
|
128
128
|
let Styles: React.CSSProperties = {}
|
|
129
129
|
|
|
130
|
-
let ClassName = className
|
|
130
|
+
let ClassName = className
|
|
131
131
|
|
|
132
132
|
if ( params.combineInput ) {
|
|
133
133
|
ClassName = [
|
|
134
134
|
className,
|
|
135
135
|
style.DigitCharacterCell,
|
|
136
136
|
style.Combined
|
|
137
|
-
].join( ' ' )
|
|
137
|
+
].join( ' ' )
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
Digits.push( <input
|
|
@@ -153,58 +153,58 @@ export const DigitCharactersInput: React.FC<amotify.fn.Input.DigitCharacters.Pla
|
|
|
153
153
|
let {
|
|
154
154
|
key,
|
|
155
155
|
code
|
|
156
|
-
} = event
|
|
156
|
+
} = event
|
|
157
157
|
|
|
158
|
-
if ( key == 'Tab' ) return
|
|
159
|
-
event.preventDefault()
|
|
160
|
-
let nextFocusIndex = null
|
|
158
|
+
if ( key == 'Tab' ) return
|
|
159
|
+
event.preventDefault()
|
|
160
|
+
let nextFocusIndex = null
|
|
161
161
|
|
|
162
162
|
if ( key == 'Backspace' ) {
|
|
163
|
-
let newFormatValue = val_status.formatValue
|
|
164
|
-
newFormatValue[ index ] = ''
|
|
163
|
+
let newFormatValue = val_status.formatValue
|
|
164
|
+
newFormatValue[ index ] = ''
|
|
165
165
|
|
|
166
166
|
set_status( {
|
|
167
167
|
...val_status,
|
|
168
168
|
...formatToData( newFormatValue ),
|
|
169
169
|
eventType: 'update',
|
|
170
170
|
eventID: $.uuidGen()
|
|
171
|
-
} )
|
|
172
|
-
nextFocusIndex = index - 1
|
|
171
|
+
} )
|
|
172
|
+
nextFocusIndex = index - 1
|
|
173
173
|
} else if ( [ 'ArrowLeft','ArrowRight' ].includes( key ) ) {
|
|
174
|
-
let dir = Number( key == 'ArrowRight' ) * 2 - 1
|
|
175
|
-
nextFocusIndex = index + dir
|
|
174
|
+
let dir = Number( key == 'ArrowRight' ) * 2 - 1
|
|
175
|
+
nextFocusIndex = index + dir
|
|
176
176
|
} else {
|
|
177
177
|
if ( enableFormSubmit ) SubmitForm( event );
|
|
178
178
|
|
|
179
179
|
( () => {
|
|
180
|
-
let regExp = code.match( /^(Key(.)|Digit(\d)|Numpad(\d))/ )
|
|
181
|
-
if ( !regExp ) return
|
|
180
|
+
let regExp = code.match( /^(Key(.)|Digit(\d)|Numpad(\d))/ )
|
|
181
|
+
if ( !regExp ) return
|
|
182
182
|
|
|
183
|
-
let newCharacter: string = regExp[ 2 ] || regExp[ 3 ] || regExp[ 4 ]
|
|
183
|
+
let newCharacter: string = regExp[ 2 ] || regExp[ 3 ] || regExp[ 4 ]
|
|
184
184
|
if ( numericOnly ) {
|
|
185
|
-
if ( !newCharacter.match( /\d/ ) ) return
|
|
185
|
+
if ( !newCharacter.match( /\d/ ) ) return
|
|
186
186
|
}
|
|
187
|
-
if ( !newCharacter ) return
|
|
187
|
+
if ( !newCharacter ) return
|
|
188
188
|
|
|
189
|
-
let newFormatValue = val_status.formatValue
|
|
190
|
-
newFormatValue[ index ] = newCharacter
|
|
189
|
+
let newFormatValue = val_status.formatValue
|
|
190
|
+
newFormatValue[ index ] = newCharacter
|
|
191
191
|
|
|
192
192
|
set_status( {
|
|
193
193
|
...val_status,
|
|
194
194
|
...formatToData( newFormatValue ),
|
|
195
195
|
eventType: 'update',
|
|
196
196
|
eventID: $.uuidGen()
|
|
197
|
-
} )
|
|
198
|
-
nextFocusIndex = index + 1
|
|
199
|
-
} )()
|
|
197
|
+
} )
|
|
198
|
+
nextFocusIndex = index + 1
|
|
199
|
+
} )()
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
if ( $.is.exist( nextFocusIndex ) ) {
|
|
203
|
-
$( '#Digit-' + nextFocusIndex + '-' + val_status.componentID ).focus()
|
|
203
|
+
$( '#Digit-' + nextFocusIndex + '-' + val_status.componentID ).focus()
|
|
204
204
|
}
|
|
205
205
|
} }
|
|
206
206
|
onChange={ () => { } }
|
|
207
|
-
/> )
|
|
207
|
+
/> )
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
return <BoxWrapper
|
|
@@ -231,5 +231,5 @@ export const DigitCharactersInput: React.FC<amotify.fn.Input.DigitCharacters.Pla
|
|
|
231
231
|
>
|
|
232
232
|
{ Digits }
|
|
233
233
|
</Flex>
|
|
234
|
-
</BoxWrapper
|
|
234
|
+
</BoxWrapper>
|
|
235
235
|
}
|