amotify 0.0.64 → 0.0.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/amotify.js +3 -2
  2. package/dist/amotify.min.css +2 -2
  3. package/dist/coreVender.js +14 -2
  4. package/package.json +10 -10
  5. package/tsconfig.json +13 -5
  6. package/@types/_.tsx +0 -7
  7. package/@types/amot.tsx +0 -357
  8. package/@types/fn.tsx +0 -1280
  9. package/@types/jsminAmotifyExtension.tsx +0 -137
  10. package/@types/module.tsx +0 -1
  11. package/@types/state.tsx +0 -231
  12. package/src/@atoms.tsx +0 -34
  13. package/src/@functions.tsx +0 -29
  14. package/src/@global.tsx +0 -149
  15. package/src/@jsminAmotifyExtension/_.tsx +0 -4
  16. package/src/@jsminAmotifyExtension/fetch.tsx +0 -110
  17. package/src/@jsminAmotifyExtension/formCollect.tsx +0 -94
  18. package/src/@jsminAmotifyExtension/spreadSheet.tsx +0 -165
  19. package/src/@jsminAmotifyExtension/variables.tsx +0 -137
  20. package/src/@molecules.tsx +0 -96
  21. package/src/@organisms.tsx +0 -1
  22. package/src/@reactPacks/reactProduction@18.2.0.js +0 -79
  23. package/src/@reactPacks/reactRouterDomProduction@18.2.0.js +0 -31
  24. package/src/@styles/@app.scss +0 -4
  25. package/src/@styles/UniStyling.scss +0 -1028
  26. package/src/@styles/init.scss +0 -94
  27. package/src/@styles/props.scss +0 -109
  28. package/src/@styles/styleSet.scss +0 -38
  29. package/src/@styles/themeColor.scss +0 -71
  30. package/src/@styles/var.scss +0 -182
  31. package/src/@templates.tsx +0 -7
  32. package/src/@variables.tsx +0 -74
  33. package/src/atoms/FAI/parts.tsx +0 -139
  34. package/src/atoms/Logo/parts.tsx +0 -335
  35. package/src/atoms/Logo/style.module.scss +0 -96
  36. package/src/atoms/Various/parts.tsx +0 -159
  37. package/src/atoms/Various/style.module.scss +0 -46
  38. package/src/config.tsx +0 -191
  39. package/src/functions/Button/_.tsx +0 -331
  40. package/src/functions/Button/style.module.scss +0 -157
  41. package/src/functions/Cropper/parts.tsx +0 -1084
  42. package/src/functions/Cropper/style.module.scss +0 -64
  43. package/src/functions/Effects/Fade.tsx +0 -76
  44. package/src/functions/Effects/Ripple.tsx +0 -141
  45. package/src/functions/Effects/_.tsx +0 -33
  46. package/src/functions/Effects/style.module.scss +0 -91
  47. package/src/functions/Input/Chips/Selector.tsx +0 -445
  48. package/src/functions/Input/Chips/_.tsx +0 -289
  49. package/src/functions/Input/Chips/style.module.scss +0 -6
  50. package/src/functions/Input/Contenteditable.tsx +0 -114
  51. package/src/functions/Input/DigitCharacters.tsx +0 -235
  52. package/src/functions/Input/File/_.tsx +0 -553
  53. package/src/functions/Input/File/style.module.scss +0 -34
  54. package/src/functions/Input/Hidden.tsx +0 -21
  55. package/src/functions/Input/List/_.tsx +0 -383
  56. package/src/functions/Input/List/style.module.scss +0 -84
  57. package/src/functions/Input/RichSelect/_.tsx +0 -230
  58. package/src/functions/Input/RichSelect/style.module.scss +0 -11
  59. package/src/functions/Input/Segmented/_.tsx +0 -246
  60. package/src/functions/Input/Segmented/style.module.scss +0 -81
  61. package/src/functions/Input/Select/_.tsx +0 -218
  62. package/src/functions/Input/Select/style.module.scss +0 -11
  63. package/src/functions/Input/Slider/_.tsx +0 -524
  64. package/src/functions/Input/Slider/style.module.scss +0 -67
  65. package/src/functions/Input/Switch/_.tsx +0 -176
  66. package/src/functions/Input/Switch/style.module.scss +0 -18
  67. package/src/functions/Input/Text.tsx +0 -487
  68. package/src/functions/Input/TextArea.tsx +0 -109
  69. package/src/functions/Input/Time/Picker.tsx +0 -1361
  70. package/src/functions/Input/Time/_.tsx +0 -749
  71. package/src/functions/Input/Time/style.module.scss +0 -79
  72. package/src/functions/Input/_.tsx +0 -881
  73. package/src/functions/Input/core.tsx +0 -473
  74. package/src/functions/Input/style.module.scss +0 -102
  75. package/src/functions/Inputs/_.tsx +0 -5
  76. package/src/functions/Inputs/style.module.scss +0 -15
  77. package/src/functions/Inputs/text.tsx +0 -53
  78. package/src/functions/Inputs/types.d.ts +0 -13
  79. package/src/functions/Layout/PageNotFound.tsx +0 -78
  80. package/src/functions/Layout/PageRouter.tsx +0 -89
  81. package/src/functions/Layout/PageViewController/parts.tsx +0 -27
  82. package/src/functions/Layout/Plate.tsx +0 -30
  83. package/src/functions/Layout/RootViewController/parts.tsx +0 -300
  84. package/src/functions/Layout/RootViewController/style.module.scss +0 -23
  85. package/src/functions/Layout/SwipeView/parts.tsx +0 -375
  86. package/src/functions/Layout/SwipeView/style.module.scss +0 -20
  87. package/src/functions/Layout/TabBar.tsx +0 -60
  88. package/src/functions/Layout/_.tsx +0 -20
  89. package/src/functions/Loader/corner.tsx +0 -74
  90. package/src/functions/Loader/mini.tsx +0 -114
  91. package/src/functions/Loader/parts.tsx +0 -103
  92. package/src/functions/Loader/style.module.scss +0 -223
  93. package/src/functions/Loader/top.tsx +0 -84
  94. package/src/functions/Sheet/parts.tsx +0 -994
  95. package/src/functions/Sheet/style.module.scss +0 -208
  96. package/src/functions/SnackBar/parts.tsx +0 -215
  97. package/src/functions/SnackBar/style.module.scss +0 -25
  98. package/src/functions/Table/Data/parts.tsx +0 -965
  99. package/src/functions/Table/Drag/parts.tsx +0 -442
  100. package/src/functions/Table/Normal/parts.tsx +0 -124
  101. package/src/functions/Table/_.tsx +0 -177
  102. package/src/functions/Table/style.module.scss +0 -93
  103. package/src/functions/Tooltips/parts.tsx +0 -53
  104. package/src/global/LaunchReactApplication.tsx +0 -74
  105. package/src/global/styleConverter.tsx +0 -465
  106. package/src/launch.tsx +0 -119
  107. package/src/molecules/Accordion/parts.tsx +0 -146
  108. package/src/molecules/Accordion/style.module.scss +0 -13
  109. package/src/molecules/LinkifyText/parts.tsx +0 -52
  110. package/src/molecules/List.tsx +0 -31
  111. package/src/preload.tsx +0 -31
  112. package/src/templates/PlayGround/parts.tsx +0 -96
  113. package/src/templates/PlayGround/style.module.scss +0 -38
  114. package/webpack.config.js +0 -146
@@ -1,176 +0,0 @@
1
- import {
2
- React
3
- } from '@global'
4
- import {
5
- Box,
6
- FAI
7
- } from '@atoms'
8
- import {
9
- Row
10
- } from '@mols'
11
- import {
12
- Buttons
13
- } from '@fn'
14
- import {
15
- BoxWrapper,
16
- SubmitForm,
17
- ValidationCheck,
18
- CommonEffects
19
- } from '../core'
20
- import style from './style.module.scss'
21
-
22
- function DefaultValidation( props: {
23
- value: any
24
- params: any
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[] = []
29
-
30
- if ( required && !value ) {
31
- notice.push( { type: 'invalid',label: 'ONになっていません' } )
32
- }
33
-
34
- return {
35
- ok: !notice.filter( ( { type } ) => type == 'invalid' ).length,
36
- notice: notice
37
- }
38
- }
39
-
40
- export const SwitchInput: React.FC<amotify.fn.Input.Switch.PlainParams> = ( params ) => {
41
- let {
42
- componentID,
43
- color = 'posi',
44
- required,
45
- form,
46
- id,
47
-
48
- enableFormSubmit,
49
-
50
- checkValidationAtFirst,
51
- onChange,onKeyDown,
52
- onValidate,
53
- onUpdateValue,onUpdateValidValue,
54
- value = '',
55
- icon = '',
56
- appearance = 'material',
57
-
58
- ...others
59
- } = params
60
-
61
- let Default_Status: amotify.fn.Input.Status.Plain = {
62
- componentID: params.componentID || '',
63
- dataValue: value,
64
- eventType: 'init',
65
- eventID: $.uuidGen()
66
- }
67
- let [ val_status,set_status ] = React.useState( Default_Status )
68
- let [ val_validate,set_validate ] = React.useState( {
69
- ok: false,
70
- notice: []
71
- } as amotify.fn.Input.Validation.Result )
72
- let isChecked = !!val_status.dataValue
73
-
74
- CommonEffects( {
75
- params,
76
- val_status,
77
- set_status,
78
- val_validate,
79
- set_validate,
80
- DefaultValidation,
81
- onUpdateValue,onUpdateValidValue,
82
- ExtraOverrideParams: {
83
- dataValue: value,
84
- formatValue: value
85
- },
86
- } )
87
-
88
- return <BoxWrapper
89
- val_status={ val_status }
90
- set_status={ set_status }
91
- val_validate={ val_validate }
92
- params={ params }
93
- >
94
- <input
95
- type='checkbox'
96
- data-form={ form }
97
- data-input-type={ 'switch' }
98
- data-validation={ val_validate.ok }
99
- data-component-id={ val_status.componentID }
100
- data-value={ val_status.dataValue }
101
- checked={ val_status.dataValue }
102
- className={ style.Input }
103
- id={ id }
104
- onKeyDown={ ( event ) => {
105
- if ( onKeyDown ) onKeyDown( event )
106
- if ( enableFormSubmit ) SubmitForm( event )
107
- } }
108
- onChange={ ( event ) => {
109
- if ( val_validate.ok ) set_validate( { ok: false,notice: [] } )
110
- set_status( {
111
- ...val_status,
112
- dataValue: event.target.checked,
113
- eventType: 'update',
114
- eventID: $.uuidGen(),
115
- } )
116
-
117
- if ( onChange ) onChange( event )
118
- } }
119
- { ...others }
120
- />
121
- <Buttons.Label.Plain
122
- tabIndex={ -1 }
123
- htmlFor={ id }
124
- padding={ '1/3' }
125
- transition='middle'
126
- borderRadius={ '1.tone.primary' }
127
- className={ style.Label }
128
- >
129
- <Box
130
- { ...appearance == 'applely' ? {
131
- padding: '1/4',
132
- isRounded: true,
133
- backgroundColor: isChecked ? color : '5.layer.darker'
134
- } : {} }
135
- >
136
- <Row.Center
137
- unitHeight={ 2.5 }
138
- position='relative'
139
- freeCSS={ {
140
- width: 12 * 4.5
141
- } }
142
- >
143
- { appearance == 'material' ? <Box
144
- position='absolute'
145
- backgroundColor={ isChecked ? color : '5.layer.darker' }
146
- borderRadius={ 'sphere' }
147
- unitHeight={ 1 }
148
- transition='middle'
149
- width={ 1 }
150
- className={ style.Bar }
151
- opacity='middle'
152
- /> : null }
153
- <Box
154
- position='absolute'
155
- top={ 0 }
156
- left={ 0 }
157
- backgroundColor={ appearance == 'material' && isChecked ? color : 'white' }
158
- transition='middle'
159
- ssSphere={ 2.5 }
160
- boxShadow={ '1.remark' }
161
- className={ style.Dot }
162
- >
163
- { icon ? <Box
164
- transition='middle'
165
- ssSquare={ 2 }
166
- flexCenter
167
- fontColor={ appearance == 'applely' && isChecked ? color : 'white' }
168
- >
169
- { icon }
170
- </Box> : null }
171
- </Box>
172
- </Row.Center>
173
- </Box>
174
- </Buttons.Label.Plain>
175
- </BoxWrapper>
176
- }
@@ -1,18 +0,0 @@
1
- @use '@props' as *;
2
- .Input {
3
- position: absolute;
4
- height: 0;
5
- width: 0;
6
- overflow: hidden;
7
- &:checked + .Label {
8
- .Dot {
9
- left: calc(100% - $unit2-5 ) !important;
10
- }
11
- }
12
- &:focus + .Label {
13
- box-shadow: 0 0 0 $unit1_3 $color-layer3;
14
- }
15
- &[disabled] + .Label {
16
- opacity: .4;
17
- }
18
- }
@@ -1,487 +0,0 @@
1
- import {
2
- React,
3
- } from '@global'
4
- import {
5
- Box,
6
- } from '@atoms'
7
-
8
- import {
9
- BoxWrapper,
10
- SubmitForm,
11
- CommonEffects
12
- } from './core'
13
-
14
- const ValidateTypes: {
15
- [ key: string ]: {
16
- reg: RegExp
17
- exist: boolean
18
- reason: ReactElement
19
- }
20
- } = {
21
- number: {
22
- reg: /^-?[0-9\.]+$/g,exist: true,
23
- reason: '半角数字で入力してください'
24
- },
25
- katakana: {
26
- reg: /^[ァ-ヶー  ヲ-゚  ]*$/g,exist: true,
27
- reason: 'カタカナで入力してください'
28
- },
29
- [ 'hankaku.katakana' ]: {
30
- reg: /^[ヲ-゚  ]*$/g,exist: true,
31
- reason: '半角カタカナで入力してください'
32
- },
33
- digitNumber: {
34
- reg: /^-?[0-9\.]+$/g,exist: true,
35
- reason: '半角数字で入力してください'
36
- },
37
- fileName: {
38
- reg: /[¥\/:*\?\"\'\|\.\s\n\r\<\>]/g,exist: false,
39
- reason: '空白または一部の特殊文字は使用できません'
40
- },
41
- creditCard: {
42
- reg: /^\d{14,16}$/g,exist: true,
43
- reason: '14~16桁の数字で入力してください'
44
- },
45
- email: {
46
- reg: /^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]+\.[A-Za-z0-9]+$/,exist: true,
47
- reason: <>
48
- <Box>○○○○@○○○○.○○○の形式で入力してください</Box>
49
- <Box>最後の文字に.(ドット)を入れることはできません</Box>
50
- </>,
51
- },
52
- password: {
53
- reg: /^(?=[^A-Z]*[A-Z])(?=[^a-z]*[a-z])(?=[^0-9]*[0-9]).{8,}$/,exist: true,
54
- reason: '8文字以上、半角英数大小文字で入力してください'
55
- },
56
- tel: {
57
- reg: /.*$/g,exist: true,
58
- reason: <>
59
- <Box>0から始まる番号のみ入力可能です</Box>
60
- <Box>9~12桁の数字で入力してください</Box>
61
- <Box>数字のみ入力可能です</Box>
62
- </>
63
- // reg: /^(0|\(?\+\d{1,3}\)?\s)[-0-9]{9,12}$/g,exist: true,
64
- // reason: <>
65
- // <Box>0から始まる番号のみ入力可能です</Box>
66
- // <Box>9~12桁の数字で入力してください</Box>
67
- // <Box>数字のみ入力可能です</Box>
68
- // </>
69
- },
70
- url: {
71
- reg: /^https?:\/\/[^\n\s]+(\.|\:)[^\n\s\.\:]+$/,exist: true,
72
- reason: 'URL形式 : http(s)://◯◯◯◯'
73
- },
74
- postal: {
75
- reg: /^\d{7}$/g,exist: true,
76
- reason: '7桁の数字で入力してください'
77
- }
78
- }
79
-
80
- const DataLeveling = ( params: {
81
- min?: number | null
82
- max?: number | null
83
- restrict: amotify.fn.Input.Text.RestrictTypes,
84
- value: any
85
- } ) => {
86
- let {
87
- restrict,
88
- value = ''
89
- } = params
90
-
91
- let dataValue = String( value )
92
- let minus = false
93
- if ( [ 'tel','number','digitNumber','test','postal','creditCard' ].includes( restrict ) ) {
94
- dataValue = dataValue.zen2hanNumber()
95
- }
96
- if ( restrict == 'katakana' ) {
97
- dataValue = dataValue.replace( /[^ァ-ヶー  ヲ-゚  ]/ig,'' )
98
- }
99
- if ( restrict == 'hankaku.katakana' ) {
100
- dataValue = dataValue.replace( /[^ヲ-゚  ]/ig,'' )
101
- }
102
- if ( [ 'postal','creditCard' ].includes( restrict ) ) {
103
- dataValue = dataValue.removeLetters()
104
- }
105
- if ( [ 'number','digitNumber' ].includes( restrict ) ) {
106
- if ( dataValue ) {
107
- if ( dataValue == '-' ) {
108
-
109
- } else if ( dataValue == '0-' ) {
110
- dataValue = '-'
111
- } else {
112
- if ( dataValue[ 0 ] == '-' ) minus = true
113
- dataValue = dataValue.replace( /[^0-9\.]/ig,'' )
114
-
115
- let Amount = Number( dataValue )
116
- if ( Amount === 0 ) minus = false
117
- if ( minus ) Amount = -1 * Amount
118
-
119
- if ( $.is.exist( params.min ) ) {
120
- Amount = Math.max( Amount,Number( params.min ) )
121
- }
122
- if ( $.is.exist( params.max ) ) {
123
- Amount = Math.min( Amount,Number( params.max ) )
124
- }
125
- dataValue = String( Math.abs( Amount ) )
126
- }
127
- }
128
- }
129
-
130
- let formatValue = dataValue
131
- if ( restrict == 'digitNumber' ) {
132
- if ( dataValue && dataValue != '-' ) {
133
- let arrary = []
134
- for ( let index = dataValue.length - 1; index >= 0; index-- ) {
135
- arrary.unshift( dataValue[ index ] )
136
- let Index = ( dataValue.length - 1 ) - index + 1
137
- if (
138
- index != 0 && Index % 3 == 0 ) {
139
- arrary.unshift( ',' )
140
- }
141
- }
142
- formatValue = arrary.join( '' )
143
- }
144
- } else if ( restrict == 'postal' ) {
145
- if ( dataValue.length >= 4 ) {
146
- formatValue = dataValue.clip( 0,3 ) + '-' + dataValue.clip( 3 )
147
- }
148
- } else if ( restrict == 'creditCard' ) {
149
- formatValue = dataValue.replace( /.{4}(?=.)/g,"$& " )
150
- }
151
-
152
- if ( [ 'number','digitNumber' ].includes( restrict ) ) {
153
- if ( minus ) {
154
- dataValue = '-' + dataValue
155
- formatValue = '-' + formatValue
156
- }
157
- }
158
-
159
- return {
160
- formatValue,
161
- dataValue
162
- }
163
- }
164
-
165
- const setSelection: {
166
- ( props: {
167
- id?: string,
168
- restrict: amotify.fn.Input.Text.RestrictTypes
169
- val_status: any
170
- } ): void
171
- } = ( props ) => {
172
- let {
173
- id,
174
- restrict,
175
- val_status
176
- } = props
177
-
178
- let input = $( '#' + id )[ 0 ] as HTMLInputElement
179
- if ( input ) {
180
- if ( val_status.prevValue && val_status.formatValue ) {
181
- let {
182
- formatValue: currentValue,
183
- prevValue,
184
- caretFrom,caretTo
185
- } = val_status
186
-
187
- if ( restrict == 'creditCard' ) {
188
- if ( currentValue.length >= prevValue.length ) {
189
- if ( caretFrom % 5 == 0 ) {
190
- caretFrom++
191
- caretTo++
192
- }
193
- }
194
- input.setSelectionRange( caretFrom,caretTo )
195
- } else if ( restrict == 'postal' ) {
196
- if ( currentValue.length == 5 && prevValue.length == 3 ) {
197
- caretFrom++
198
- caretTo++
199
- }
200
- input.setSelectionRange( caretFrom,caretTo )
201
- } else if ( restrict == 'digitNumber' ) {
202
- let margin = currentValue.length - prevValue.length
203
-
204
- if ( margin == 2 ) {
205
- caretFrom++
206
- caretTo++
207
- }
208
- if ( margin == -2 ) {
209
- caretFrom--
210
- caretTo--
211
- }
212
- input.setSelectionRange( caretFrom,caretTo )
213
- }
214
- }
215
- }
216
- }
217
- export const TextValidate = ( value: any,restrict: amotify.fn.Input.Text.RestrictTypes ) => {
218
- let response = {
219
- ok: true,
220
- body: '' as any
221
- };
222
- ( () => {
223
- let kit = ValidateTypes[ restrict ]
224
- if ( !kit ) return
225
-
226
- let reason = kit.reason
227
- if ( kit ) {
228
- let valid = Boolean( Number( !!value.match( kit.reg ) ) ^ Number( !kit.exist ) )
229
- response = {
230
- ok: valid,
231
- body: valid ? '' : reason
232
- }
233
- }
234
- } )()
235
- return response
236
- }
237
-
238
- function DefaultValidation( props: {
239
- value: any
240
- params: any
241
- } ): amotify.fn.Input.Validation.Result {
242
- let {
243
- value,
244
- params
245
- } = props
246
- let {
247
- restrict = 'text',
248
- maxLength = 255,
249
- required
250
- } = params as amotify.fn.Input.Text.OriginParams
251
- let notice: amotify.fn.Input.Validation.NoticeTypes[] = []
252
-
253
- if ( $.is.exist( maxLength ) ) {
254
- if ( value.length >= Number( maxLength ) ) {
255
- notice.push( { type: 'invalid',label: maxLength + '字以内で入力してください' } )
256
- }
257
- }
258
- if ( value ) {
259
- let Valid = TextValidate( value,restrict )
260
- if ( !Valid.ok ) notice.push( { type: 'invalid',label: Valid.body } )
261
- } else if ( required ) {
262
- notice.push( { type: 'invalid',label: '必須項目です' } )
263
- }
264
-
265
- return {
266
- ok: !notice.filter( ( { type } ) => type == 'invalid' ).length,
267
- notice: notice
268
- }
269
- }
270
-
271
- export const TextInput: React.FC<amotify.fn.Input.Text.OriginParams> = ( params ) => {
272
- let {
273
- componentID,
274
- tone,
275
- required,
276
- restrict = 'text',
277
- form,
278
- autoComplete = 'off',
279
- autoCapitalize = 'off',
280
-
281
- enableFormSubmit,
282
- clearButton = false,
283
-
284
- checkValidationAtFirst,
285
- onChange,onKeyDown,
286
- onValidate,
287
- onUpdateValue,
288
- onUpdateValidValue,
289
- value = '',
290
- leftIndicator,rightIndicator,leftIcon,rightIcon,
291
- maxLength,
292
- min,
293
- max,
294
- ...others
295
- } = params
296
-
297
- let inputType = restrict == 'password' ? 'password' : 'text'
298
- let inputMode: 'numeric' | 'text' | 'email' = [ 'number','digitNumber','creditCard' ].includes( restrict ) ? 'numeric' : restrict == 'email' ? 'email' : 'text'
299
-
300
- let Default_Status: amotify.fn.Input.Status.Text = {
301
- componentID: componentID!,
302
- ...DataLeveling( {
303
- min,max,
304
- restrict,
305
- value
306
- } ),
307
- prevValue: '',
308
- eventType: 'init',
309
- eventID: $.uuidGen(),
310
- caretFrom: null as any,
311
- caretTo: null as any
312
- }
313
- let [ val_isComposing,set_isComposing ] = React.useState( false )
314
- let [ val_status,set_status ] = React.useState( Default_Status )
315
- let [ val_validate,set_validate ] = React.useState( {
316
- ok: false,
317
- notice: []
318
- } as amotify.fn.Input.Validation.Result )
319
-
320
- CommonEffects( {
321
- params,
322
- val_status,
323
- set_status,
324
- val_validate,
325
- set_validate,
326
- DefaultValidation,
327
- onUpdateValue,
328
- onUpdateValidValue,
329
- ExtraOverrideParams: {
330
- ...DataLeveling( {
331
- min,max,
332
- restrict,
333
- value
334
- } )
335
- }
336
- } )
337
-
338
- React.useEffect( () => {
339
- setSelection( { id: params.id,restrict,val_status } )
340
- },[ val_status ] )
341
-
342
- return <BoxWrapper
343
- val_status={ val_status }
344
- set_status={ set_status }
345
- val_validate={ val_validate }
346
- params={ params }
347
- >
348
- <input
349
- type={ inputType }
350
- inputMode={ inputMode }
351
- data-form={ form }
352
- data-input-type={ 'text' }
353
- data-validation={ val_validate.ok }
354
- data-value={ val_status.dataValue }
355
- data-component-id={ val_status.componentID }
356
- value={ val_status.formatValue }
357
- autoComplete={ autoComplete }
358
- autoCapitalize={ autoCapitalize }
359
- onKeyDown={ ( event ) => {
360
- let { key,target } = event
361
-
362
- {
363
- let input = target as HTMLInputElement
364
- let { selectionStart,selectionEnd } = input
365
- let caretFrom = Number( selectionStart )
366
- let caretTo = Number( selectionEnd )
367
-
368
- let _v = val_status.formatValue[ Number( caretFrom ) ]
369
- let v_ = val_status.formatValue[ Number( caretFrom ) - 1 ]
370
- if ( key == 'Delete' && (
371
- ( restrict == 'creditCard' && _v == ' ' ) ||
372
- ( restrict == 'postal' && _v == '-' ) ||
373
- ( restrict == 'digitNumber' && _v == ',' )
374
- ) ) {
375
- input.setSelectionRange( caretFrom + 1,caretTo + 1 )
376
- event.preventDefault()
377
- }
378
- if ( key == 'Backspace' && (
379
- ( restrict == 'creditCard' && v_ == ' ' ) ||
380
- ( restrict == 'postal' && v_ == '-' ) ||
381
- ( restrict == 'digitNumber' && v_ == ',' )
382
- ) ) {
383
- input.setSelectionRange( caretFrom - 1,caretTo - 1 )
384
- event.preventDefault()
385
- }
386
- if ( key == 'Enter' || key == 'Tab' ) {
387
-
388
- }
389
- }
390
-
391
- if ( [ 'number','digitNumber','creditCard' ].includes( restrict ) ) {
392
- if ( key == 'Clear' ) {
393
- set_status( {
394
- ...val_status,
395
- dataValue: '',
396
- formatValue: '',
397
- eventType: 'update',
398
- eventID: $.uuidGen(),
399
- } )
400
- }
401
- }
402
- if ( [ 'number','digitNumber' ].includes( restrict ) ) {
403
- if ( [ 'ArrowUp','ArrowDown' ].includes( key ) ) {
404
- let direction = Number( key == 'ArrowUp' ) * 2 - 1
405
- let Value = String( Number( val_status.dataValue ) + direction )
406
- if ( val_validate.ok ) {
407
- set_validate( { ok: false,notice: [] } )
408
- }
409
- set_status( {
410
- ...val_status,
411
- ...DataLeveling( {
412
- min,max,
413
- restrict,
414
- value: Value
415
- } ),
416
- eventType: 'update',
417
- eventID: $.uuidGen(),
418
- } )
419
- event.preventDefault()
420
- }
421
- }
422
-
423
- if ( onKeyDown ) onKeyDown( event )
424
- if ( enableFormSubmit ) SubmitForm( event )
425
- } }
426
- onChange={ ( event ) => {
427
- let {
428
- value: rawValue,
429
- selectionStart,
430
- selectionEnd
431
- } = event.target
432
-
433
- let value = DataLeveling( {
434
- min,max,
435
- restrict,
436
- value: rawValue
437
- } )
438
-
439
- if ( val_isComposing ) value.formatValue = rawValue
440
-
441
- if ( value.formatValue == val_status.formatValue ) return
442
-
443
- if ( val_validate.ok ) set_validate( { ok: false,notice: [] } )
444
-
445
- set_status( {
446
- ...val_status,
447
- ...value,
448
- prevValue: val_status.formatValue,
449
- eventType: 'update',
450
- eventID: $.uuidGen(),
451
- caretFrom: Number( selectionStart ),
452
- caretTo: Number( selectionEnd )
453
- } )
454
-
455
- if ( onChange ) onChange( event )
456
- } }
457
- { ...others }
458
- onCompositionStart={ ( event ) => {
459
- others?.onCompositionStart && others?.onCompositionStart( event )
460
- set_isComposing( true )
461
- } }
462
- onCompositionEnd={ ( event ) => {
463
- others?.onCompositionEnd && others?.onCompositionEnd( event )
464
-
465
- if ( restrict == 'text' ) {
466
- return
467
- }
468
-
469
- let value = DataLeveling( {
470
- min,max,
471
- restrict,
472
- value: val_status.formatValue
473
- } )
474
- set_status( {
475
- ...val_status,
476
- ...value,
477
- prevValue: val_status.formatValue,
478
- eventType: 'update',
479
- eventID: $.uuidGen(),
480
- caretFrom: Number( val_status.formatValue.length + 1 ),
481
- caretTo: Number( val_status.formatValue.length + 1 )
482
- } )
483
- set_isComposing( false )
484
- } }
485
- />
486
- </BoxWrapper>
487
- }