amotify 0.0.4 → 0.0.5

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 (186) hide show
  1. package/package.json +1 -1
  2. package/public/amotify.js +1 -0
  3. package/public/amotify.min.css +24 -0
  4. package/dist/src/@jsminAmotifyExtension/_.d.ts +0 -4
  5. package/dist/src/@jsminAmotifyExtension/fetch.d.ts +0 -9
  6. package/dist/src/@jsminAmotifyExtension/formCollect.d.ts +0 -1
  7. package/dist/src/@jsminAmotifyExtension/spreadSheet.d.ts +0 -4
  8. package/dist/src/@jsminAmotifyExtension/variables.d.ts +0 -0
  9. package/dist/src/@types/_.d.ts +0 -6
  10. package/dist/src/@types/amot.d.ts +0 -260
  11. package/dist/src/@types/fn.d.ts +0 -1040
  12. package/dist/src/@types/index.d.ts +0 -62
  13. package/dist/src/@types/jsminAmotifyExtension.d.ts +0 -134
  14. package/dist/src/@types/module.d.ts +0 -2
  15. package/dist/src/@types/state.d.ts +0 -145
  16. package/dist/src/Atoms/@export.d.ts +0 -4
  17. package/dist/src/Atoms/FAIcon/parts.d.ts +0 -2
  18. package/dist/src/Atoms/Logo/parts.d.ts +0 -1
  19. package/dist/src/Atoms/Various/parts.d.ts +0 -9
  20. package/dist/src/Functions/@export.d.ts +0 -12
  21. package/dist/src/Functions/Button/_.d.ts +0 -1
  22. package/dist/src/Functions/Cropper/parts.d.ts +0 -1
  23. package/dist/src/Functions/Effects/Fade.d.ts +0 -1
  24. package/dist/src/Functions/Effects/Ripple.d.ts +0 -1
  25. package/dist/src/Functions/Effects/_.d.ts +0 -3
  26. package/dist/src/Functions/Input/Chips/Selector.d.ts +0 -1
  27. package/dist/src/Functions/Input/Chips/_.d.ts +0 -2
  28. package/dist/src/Functions/Input/DigitCharacters.d.ts +0 -1
  29. package/dist/src/Functions/Input/File/_.d.ts +0 -2
  30. package/dist/src/Functions/Input/Hidden.d.ts +0 -1
  31. package/dist/src/Functions/Input/List/_.d.ts +0 -1
  32. package/dist/src/Functions/Input/Segmented/_.d.ts +0 -1
  33. package/dist/src/Functions/Input/Select/_.d.ts +0 -1
  34. package/dist/src/Functions/Input/Slider/_.d.ts +0 -1
  35. package/dist/src/Functions/Input/Switch/_.d.ts +0 -1
  36. package/dist/src/Functions/Input/Text.d.ts +0 -5
  37. package/dist/src/Functions/Input/TextArea.d.ts +0 -1
  38. package/dist/src/Functions/Input/Time/Picker.d.ts +0 -1
  39. package/dist/src/Functions/Input/Time/_.d.ts +0 -2
  40. package/dist/src/Functions/Input/_.d.ts +0 -5
  41. package/dist/src/Functions/Input/core.d.ts +0 -34
  42. package/dist/src/Functions/Inputs/_.d.ts +0 -3
  43. package/dist/src/Functions/Inputs/text.d.ts +0 -12
  44. package/dist/src/Functions/Layout/PageNotFound.d.ts +0 -1
  45. package/dist/src/Functions/Layout/PageRouter.d.ts +0 -2
  46. package/dist/src/Functions/Layout/PageViewController/parts.d.ts +0 -1
  47. package/dist/src/Functions/Layout/Plate.d.ts +0 -1
  48. package/dist/src/Functions/Layout/RootViewController/parts.d.ts +0 -1
  49. package/dist/src/Functions/Layout/SwipeView/parts.d.ts +0 -2
  50. package/dist/src/Functions/Layout/TabBar.d.ts +0 -1
  51. package/dist/src/Functions/Layout/_.d.ts +0 -2
  52. package/dist/src/Functions/Loader/corner.d.ts +0 -1
  53. package/dist/src/Functions/Loader/mini.d.ts +0 -33
  54. package/dist/src/Functions/Loader/parts.d.ts +0 -3
  55. package/dist/src/Functions/Loader/top.d.ts +0 -1
  56. package/dist/src/Functions/Sheet/parts.d.ts +0 -2
  57. package/dist/src/Functions/SnackBar/parts.d.ts +0 -2
  58. package/dist/src/Functions/Table/Data/parts.d.ts +0 -3
  59. package/dist/src/Functions/Table/Drag/parts.d.ts +0 -1
  60. package/dist/src/Functions/Table/Normal/parts.d.ts +0 -1
  61. package/dist/src/Functions/Table/_.d.ts +0 -9
  62. package/dist/src/Functions/Tooltips/parts.d.ts +0 -2
  63. package/dist/src/Global/@export.d.ts +0 -12
  64. package/dist/src/Global/LaunchReactApplication.d.ts +0 -1
  65. package/dist/src/Global/styleConverter.d.ts +0 -2
  66. package/dist/src/Molecules/@export.d.ts +0 -21
  67. package/dist/src/Molecules/Accordion/parts.d.ts +0 -2
  68. package/dist/src/Molecules/LinkifyText/parts.d.ts +0 -1
  69. package/dist/src/Molecules/List.d.ts +0 -1
  70. package/dist/src/Organisms/@export.d.ts +0 -2
  71. package/dist/src/Organisms/DisplayStyleInput/_.d.ts +0 -1
  72. package/dist/src/Organisms/DisplayStyleInput/darkmode.d.ts +0 -1
  73. package/dist/src/Organisms/DisplayStyleInput/themeColor.d.ts +0 -27
  74. package/dist/src/Templates/@export.d.ts +0 -2
  75. package/dist/src/Templates/PlayGround/parts.d.ts +0 -1
  76. package/dist/src/config.d.ts +0 -16
  77. package/dist/src/launch.d.ts +0 -9
  78. package/dist/src/preload.d.ts +0 -1
  79. package/src/@jsminAmotifyExtension/_.tsx +0 -4
  80. package/src/@jsminAmotifyExtension/fetch.tsx +0 -107
  81. package/src/@jsminAmotifyExtension/formCollect.tsx +0 -89
  82. package/src/@jsminAmotifyExtension/spreadSheet.tsx +0 -159
  83. package/src/@jsminAmotifyExtension/variables.tsx +0 -130
  84. package/src/@styles/@app.scss +0 -4
  85. package/src/@styles/@variables/customProps.scss +0 -109
  86. package/src/@styles/@variables/styleSet.scss +0 -38
  87. package/src/@styles/@variables/themeColor.scss +0 -71
  88. package/src/@styles/@variables/var.scss +0 -171
  89. package/src/@styles/UniStyling.scss +0 -996
  90. package/src/@styles/init.scss +0 -154
  91. package/src/@types/_.tsx +0 -6
  92. package/src/@types/amot.tsx +0 -323
  93. package/src/@types/fn.tsx +0 -1210
  94. package/src/@types/index.tsx +0 -74
  95. package/src/@types/jsminAmotifyExtension.tsx +0 -143
  96. package/src/@types/module.tsx +0 -2
  97. package/src/@types/state.tsx +0 -199
  98. package/src/Atoms/@export.tsx +0 -32
  99. package/src/Atoms/FAIcon/parts.tsx +0 -117
  100. package/src/Atoms/FAIcon/style.module.scss +0 -9
  101. package/src/Atoms/Logo/parts.tsx +0 -335
  102. package/src/Atoms/Logo/style.module.scss +0 -96
  103. package/src/Atoms/Various/parts.tsx +0 -157
  104. package/src/Atoms/Various/style.module.scss +0 -40
  105. package/src/Functions/@export.tsx +0 -29
  106. package/src/Functions/Button/_.tsx +0 -305
  107. package/src/Functions/Button/style.module.scss +0 -183
  108. package/src/Functions/Cropper/parts.tsx +0 -1061
  109. package/src/Functions/Cropper/style.module.scss +0 -62
  110. package/src/Functions/Effects/Fade.tsx +0 -81
  111. package/src/Functions/Effects/Ripple.tsx +0 -141
  112. package/src/Functions/Effects/_.tsx +0 -33
  113. package/src/Functions/Effects/style.module.scss +0 -83
  114. package/src/Functions/Input/Chips/Selector.tsx +0 -451
  115. package/src/Functions/Input/Chips/_.tsx +0 -286
  116. package/src/Functions/Input/Chips/style.module.scss +0 -6
  117. package/src/Functions/Input/DigitCharacters.tsx +0 -241
  118. package/src/Functions/Input/File/_.tsx +0 -596
  119. package/src/Functions/Input/File/style.module.scss +0 -34
  120. package/src/Functions/Input/Hidden.tsx +0 -18
  121. package/src/Functions/Input/List/_.tsx +0 -383
  122. package/src/Functions/Input/List/style.module.scss +0 -84
  123. package/src/Functions/Input/Segmented/_.tsx +0 -238
  124. package/src/Functions/Input/Segmented/style.module.scss +0 -81
  125. package/src/Functions/Input/Select/_.tsx +0 -225
  126. package/src/Functions/Input/Select/style.module.scss +0 -10
  127. package/src/Functions/Input/Slider/_.tsx +0 -519
  128. package/src/Functions/Input/Slider/style.module.scss +0 -67
  129. package/src/Functions/Input/Switch/_.tsx +0 -177
  130. package/src/Functions/Input/Switch/style.module.scss +0 -18
  131. package/src/Functions/Input/Text.tsx +0 -437
  132. package/src/Functions/Input/TextArea.tsx +0 -115
  133. package/src/Functions/Input/Time/Picker.tsx +0 -950
  134. package/src/Functions/Input/Time/_.tsx +0 -736
  135. package/src/Functions/Input/Time/style.module.scss +0 -72
  136. package/src/Functions/Input/_.tsx +0 -793
  137. package/src/Functions/Input/core.tsx +0 -461
  138. package/src/Functions/Input/style.module.scss +0 -43
  139. package/src/Functions/Inputs/_.tsx +0 -5
  140. package/src/Functions/Inputs/style.module.scss +0 -15
  141. package/src/Functions/Inputs/text.tsx +0 -67
  142. package/src/Functions/Inputs/types.d.ts +0 -1
  143. package/src/Functions/Layout/PageNotFound.tsx +0 -81
  144. package/src/Functions/Layout/PageRouter.tsx +0 -107
  145. package/src/Functions/Layout/PageViewController/parts.tsx +0 -32
  146. package/src/Functions/Layout/Plate.tsx +0 -30
  147. package/src/Functions/Layout/RootViewController/parts.tsx +0 -290
  148. package/src/Functions/Layout/RootViewController/style.module.scss +0 -24
  149. package/src/Functions/Layout/SwipeView/parts.tsx +0 -380
  150. package/src/Functions/Layout/SwipeView/style.module.scss +0 -19
  151. package/src/Functions/Layout/TabBar.tsx +0 -64
  152. package/src/Functions/Layout/_.tsx +0 -20
  153. package/src/Functions/Loader/corner.tsx +0 -78
  154. package/src/Functions/Loader/mini.tsx +0 -117
  155. package/src/Functions/Loader/parts.tsx +0 -105
  156. package/src/Functions/Loader/style.module.scss +0 -222
  157. package/src/Functions/Loader/top.tsx +0 -90
  158. package/src/Functions/Sheet/parts.tsx +0 -972
  159. package/src/Functions/Sheet/style.module.scss +0 -235
  160. package/src/Functions/SnackBar/parts.tsx +0 -215
  161. package/src/Functions/SnackBar/style.module.scss +0 -25
  162. package/src/Functions/Table/Data/parts.tsx +0 -955
  163. package/src/Functions/Table/Drag/parts.tsx +0 -448
  164. package/src/Functions/Table/Normal/parts.tsx +0 -123
  165. package/src/Functions/Table/_.tsx +0 -170
  166. package/src/Functions/Table/style.module.scss +0 -92
  167. package/src/Functions/Tooltips/parts.tsx +0 -52
  168. package/src/Global/@export.tsx +0 -138
  169. package/src/Global/LaunchReactApplication.tsx +0 -30
  170. package/src/Global/exe.tsx +0 -0
  171. package/src/Global/styleConverter.tsx +0 -435
  172. package/src/Molecules/@export.tsx +0 -95
  173. package/src/Molecules/Accordion/parts.tsx +0 -146
  174. package/src/Molecules/Accordion/style.module.scss +0 -13
  175. package/src/Molecules/LinkifyText/parts.tsx +0 -54
  176. package/src/Molecules/List.tsx +0 -30
  177. package/src/Organisms/@export.tsx +0 -5
  178. package/src/Organisms/DisplayStyleInput/_.tsx +0 -18
  179. package/src/Organisms/DisplayStyleInput/darkmode.tsx +0 -112
  180. package/src/Organisms/DisplayStyleInput/themeColor.tsx +0 -210
  181. package/src/Templates/@export.tsx +0 -7
  182. package/src/Templates/PlayGround/parts.tsx +0 -115
  183. package/src/Templates/PlayGround/style.module.scss +0 -38
  184. package/src/config.tsx +0 -132
  185. package/src/launch.tsx +0 -100
  186. package/src/preload.tsx +0 -49
@@ -1,596 +0,0 @@
1
- import {
2
- useStore
3
- } from '@global';
4
- const {
5
- useEffect,
6
- useState
7
- } = React;
8
- import {
9
- Box,
10
- Flex,
11
- FAIcon
12
- } from '@atoms';
13
- import {
14
- Column,
15
- Row,
16
- Text
17
- } from '@mols';
18
- import {
19
- Input,
20
- Buttons,
21
- SnackBar
22
- } from '@functions';
23
-
24
- import {
25
- BoxWrapper,
26
- SubmitForm,
27
- ValidationCheck,
28
- CommonEffects
29
- } from '../core';
30
- import style from './style.module.scss';
31
-
32
- function DefaultValidation( props: {
33
- value: any
34
- params: any
35
- } ): amotify.fn.Input.Validation.Result {
36
- let { value,params } = props;
37
- let { required } = params as amotify.fn.Input.Filer.PlainParams;
38
- let notice: amotify.fn.Input.Validation.NoticeTypes[] = [];
39
-
40
- if ( required && !value.length ) {
41
- notice.push( { type: 'invalid',label: '必須項目です' } );
42
- }
43
-
44
- return {
45
- ok: !notice.filter( ( { type } ) => type == 'invalid' ).length,
46
- notice: notice
47
- }
48
- }
49
-
50
- const FileComponent: FNC<amotify.fn.Input.Filer.PlainParams> = ( params ) => {
51
- let {
52
- tone,
53
- required,
54
- form,
55
-
56
- fileNameEdit = true,
57
- systemOnly = false,
58
- accept = '*',
59
- limit = 1,
60
-
61
- checkValidationAtFirst,
62
- onChange,
63
- onValidate,
64
- onUpdateValue,onUpdateValidValue,
65
- value = [],
66
- className,
67
-
68
- cellStyles,cellClassName,
69
-
70
- ...others
71
- } = params;
72
-
73
- let Default_Status: amotify.fn.Input.Status.Plain = {
74
- componentID: params.componentID || '',
75
- dataValue: value,
76
- eventType: 'init',
77
- eventID: $.uuidGen()
78
- }
79
- let [ val_status,set_status ] = useState( Default_Status );
80
- let [ val_validate,set_validate ] = useState( {
81
- ok: false,
82
- notice: []
83
- } as amotify.fn.Input.Validation.Result );
84
-
85
- CommonEffects( {
86
- type: 'file',
87
- params,
88
- val_status,
89
- set_status,
90
- val_validate,
91
- set_validate,
92
- DefaultValidation,
93
- onUpdateValue,onUpdateValidValue,
94
- ExtraOverrideParams: {
95
- dataValue: value,
96
- formatValue: value,
97
- },
98
- ExtraStoreParams: {
99
- AddFiles: async ( files: any[] ) => {
100
- let currentFiles = useStore.get( val_status.componentID ).Files;
101
- let newFiles = [];
102
- for ( var i = 0; i < files?.length; i++ ) {
103
- let file = files[ i ];
104
- let { type,name } = file;
105
-
106
- if ( i + 1 + currentFiles.length > limit ) {
107
- SnackBar.add( {
108
- componentID: name,
109
- secondsToClose: 12000,
110
- children: `ファイル選択上限を超えたため、${ name }}は追加できません。`,
111
- backgroundColor: 'nega'
112
- } );
113
- continue;
114
- }
115
-
116
- if ( accept ) {
117
- if ( accept == 'image' ) {
118
- if ( !type.match( /image/ ) ) {
119
- SnackBar.add( {
120
- componentID: name,
121
- secondsToClose: 12000,
122
- children: `ファイル形式が異なるため、${ name } は追加できません。`,
123
- backgroundColor: 'nega'
124
- } );
125
- continue;
126
- }
127
- }
128
- }
129
- newFiles.push( file );
130
- }
131
- set_status( {
132
- ...val_status,
133
- dataValue: [ ...currentFiles,...newFiles ],
134
- eventType: 'update',
135
- eventID: $.uuidGen(),
136
- } );
137
- }
138
- }
139
- } );
140
-
141
- let Accept = '';
142
- if ( accept ) {
143
- if ( accept == 'image' ) Accept = 'image/png,image/jpeg';
144
- else Accept = accept;
145
- }
146
-
147
- return (
148
- <BoxWrapper
149
- val_status={ val_status }
150
- set_status={ set_status }
151
- val_validate={ val_validate }
152
- params={ params }
153
- >
154
- <input
155
- type='file'
156
- className={ style.Input }
157
- data-form={ form }
158
- data-input-type={ 'file' }
159
- data-component-id={ val_status.componentID }
160
- data-validation={ val_validate.ok }
161
- accept={ Accept }
162
- multiple={ limit == 1 ? false : true }
163
- onChange={ async ( event ) => {
164
- let Input = event.target;
165
- let files = Input.files as any;
166
- let newFiles = [];
167
- for ( var i = 0; i < files?.length; i++ ) {
168
- let file = files[ i ];
169
- let fileName = file.name;
170
- file.id = $.uuidGen();
171
-
172
- if ( i + 1 + val_status.dataValue.length > limit ) {
173
- SnackBar.add( {
174
- componentID: fileName,
175
- secondsToClose: 12000,
176
- children: `ファイル登録数を超えたため、${ fileName }}は追加できませんでした。`,
177
- backgroundColor: 'nega'
178
- } );
179
- continue;
180
- }
181
- newFiles.push( file );
182
- }
183
- set_status( {
184
- ...val_status,
185
- dataValue: [ ...val_status.dataValue,...newFiles ],
186
- eventType: 'update',
187
- eventID: $.uuidGen(),
188
- } );
189
- Input.value = '';
190
- } }
191
- { ...others }
192
- tabIndex={ -1 }
193
- value={ '' }
194
- />
195
- { !systemOnly ? <FileList
196
- files={ val_status.dataValue }
197
- params={ params }
198
- val_status={ val_status }
199
- set_status={ set_status }
200
- /> : null }
201
- </BoxWrapper>
202
- );
203
- }
204
-
205
- const FileList: FNC<{
206
- files: File[]
207
- params: amotify.fn.Input.Filer.PlainParams
208
- val_status: amotify.fn.Input.Status.Plain
209
- set_status: React.Dispatch<React.SetStateAction<amotify.fn.Input.Status.Plain>>
210
- }> = ( props ) => {
211
- let {
212
- files,
213
- params,
214
- val_status,
215
- set_status
216
- } = props;
217
- let Left = ( params.limit || 1 ) - val_status.dataValue.length;
218
-
219
- let Files = files.map( ( file,index ) => {
220
- return (
221
- <FileCell
222
- key={ file.name }
223
- index={ index }
224
- file={ file }
225
- className={ params.cellClassName }
226
- val_status={ val_status }
227
- set_status={ set_status }
228
- fileNameEdit={ params.fileNameEdit }
229
- />
230
- );
231
- } );
232
-
233
- if ( Left > 0 ) {
234
- Files.push(
235
- <Buttons.Label.Plain
236
- key={ 'AddButton' }
237
- className={ [ params.cellClassName,style.AddButton ].join( ' ' ) }
238
- htmlFor={ params.id }
239
- tabIndex={ params.tabIndex }
240
- onKeyDown={ ( event ) => {
241
- let { key } = event;
242
- if ( params.tabIndex != -1 ) {
243
- if ( [ ' ','Enter' ].includes( key ) ) {
244
- $( '#' + params.id ).click();
245
- }
246
- }
247
- } }
248
- >
249
- <Row.Center
250
- padding={ [ '1/3',0 ] }
251
- >
252
- <Box
253
- isRounded
254
- className={ style.AddIcon }
255
- >
256
- <FAIcon
257
- d={ 'cloud-arrow-up' }
258
- className={ style.Icon }
259
- fontColor={ 'theme' }
260
- backgroundColor={ 'tcOpLow' }
261
- padding={ 0 }
262
- unitWidth={ 4 }
263
- unitHeight={ 4 }
264
- isRounded
265
- />
266
- </Box>
267
- <Box>
268
- <Box
269
- children={ 'ファイルを選択' + `(${ Left })` }
270
- fontColor={ 'theme' }
271
- fontSize={ '2.normal' }
272
- isBoldFont
273
- />
274
- <Box
275
- children={ 'または、ファイルをドロップ' }
276
- fontColor={ '4.thin' }
277
- fontSize={ '0.xs' }
278
- />
279
- </Box>
280
- </Row.Center>
281
- </Buttons.Label.Plain>
282
- )
283
- }
284
-
285
- return ( <Column
286
- flexSizing={ 'auto' }
287
- className={ params.className }
288
- children={ Files }
289
- />
290
- );
291
- }
292
-
293
- const FileCell: FNC<{
294
- index: number
295
- file: File
296
- className?: string
297
- val_status: amotify.fn.Input.Status.Plain
298
- set_status: React.Dispatch<React.SetStateAction<amotify.fn.Input.Status.Plain>>
299
- fileNameEdit?: boolean
300
- }> = ( props ) => {
301
- let {
302
- index,
303
- file,
304
- className,
305
- val_status,
306
- set_status,
307
- fileNameEdit = true
308
- } = props;
309
- let {
310
- name: fileName,
311
- size,
312
- type,
313
- } = file;
314
-
315
- let [ val_edit,set_edit ] = useState( false );
316
- let FileID = $.uuidGen();
317
- let Size = size.rank();
318
- let [ name,extension ] = fileName
319
- .replace( /\s/,'' )
320
- .replace( /(.*)\.(.*)$/,'$1 $2' ).split( ' ' );
321
-
322
- let FileType = {
323
- name: '不明',
324
- icon: 'fal file'
325
- }
326
- if ( type.match( /image/ ) ) {
327
- FileType = {
328
- name: type.replace( /image\//,'' ),
329
- icon: 'image'
330
- }
331
- } else if ( type.match( /pdf/ ) ) {
332
- FileType = {
333
- name: 'PDF',
334
- icon: 'file-pdf'
335
- }
336
- } else if ( type.match( /csv/ ) ) {
337
- FileType = {
338
- name: 'CSV',
339
- icon: 'file-csv'
340
- }
341
- } else if ( type.match( /spreadsheet/ ) ) {
342
- FileType = {
343
- name: 'SpreadSheet',
344
- icon: 'file-excel'
345
- }
346
- } else if ( type.match( /presentation/ ) ) {
347
- FileType = {
348
- name: 'PowerPoint',
349
- icon: 'file-powerpoint'
350
- }
351
- } else if ( type.match( /word/ ) ) {
352
- FileType = {
353
- name: 'Word',
354
- icon: 'file-word'
355
- }
356
- } else if ( type.match( /zip/ ) ) {
357
- FileType = {
358
- name: 'Zip',
359
- icon: 'file-zipper'
360
- }
361
- } else if ( type.match( /powerpoint/ ) ) {
362
- FileType = {
363
- name: 'PowerPoint',
364
- icon: 'file-powerpoint'
365
- }
366
- } else if ( type.match( /html/ ) ) {
367
- FileType = {
368
- name: 'HTML',
369
- icon: 'fab html5'
370
- }
371
- } else if ( type.match( /js/ ) ) {
372
- FileType = {
373
- name: 'JS',
374
- icon: 'fab js-square'
375
- }
376
- } else if ( type.match( /css/ ) ) {
377
- FileType = {
378
- name: 'CSS',
379
- icon: 'fab css3-alt'
380
- }
381
- } else if ( type.match( /text\/plain/ ) ) {
382
- FileType = {
383
- name: 'テキスト',
384
- icon: 'file-lines'
385
- }
386
- }
387
-
388
- useEffect( () => {
389
- if ( val_edit ) {
390
- setTimeout( () => {
391
- $( '#' + FileID )[ 0 ].focus();
392
- },100 );
393
- }
394
- },[ val_edit ] );
395
-
396
- return (
397
- <Flex
398
- verticalAlign='center'
399
- flexWrap={ false }
400
- gap={ 1 }
401
- className={ className }
402
- >
403
- <FAIcon
404
- fontSize={ '4.thirdTitle' }
405
- fontColor={ 'theme' }
406
- d={ FileType.icon }
407
- />
408
- <Box flexSizing={ 0 }>
409
- <Box>
410
- <Flex
411
- verticalAlign='center'
412
- gap={ '2/3' }
413
- flexWrap={ false }
414
- className={ style.FileName }
415
- children={ !val_edit ? <>
416
- { fileName }
417
- { fileNameEdit ?
418
- <Buttons.Button.Clear.R
419
- padding={ '1/3' }
420
- ssEffectsOnActive={ 'expand' }
421
- children={ <FAIcon d='pen' /> }
422
- onClick={ () => {
423
- set_edit( true );
424
- } }
425
- /> : null
426
- }
427
- </> : <>
428
- <Column
429
- gap={ '1/2' }
430
- flexSizing={ 0 }
431
- >
432
- <Flex
433
- gap={ '2/3' }
434
- verticalAlign='center'
435
- >
436
- <Input.Text.Normal
437
- tone='border'
438
- wrapStyles={ {
439
- flexSizing: 'auto'
440
- } }
441
- restrict='fileName'
442
- name='name'
443
- required
444
- id={ FileID }
445
- form={ 'form-' + FileID }
446
- enableFormSubmit
447
- value={ name }
448
- onKeyDown={ ( event ) => {
449
- let { key } = event;
450
- if ( key == 'Escape' ) set_edit( false );
451
- } }
452
- />
453
- <Box>
454
- . { extension }
455
- </Box>
456
- </Flex>
457
- <Flex
458
- gap={ '2/3' }
459
- horizontalAlign='right'
460
- flexWrap={ false }
461
- >
462
- <Buttons.Button.Sub.R
463
- padding={ [ '2/3',1 ] }
464
- children={ '閉じる' }
465
- onClick={ () => {
466
- set_edit( false );
467
- } }
468
- />
469
- <Buttons.Button.Prime.R
470
- padding={ [ '2/3',1 ] }
471
- submitOption={ {
472
- formName: 'form-' + FileID,
473
- submitDelegationKey: 'auxEnter',
474
- callback: async ( form ) => {
475
- let { name } = form;
476
- let nextFiles = [ ...val_status.dataValue ];
477
- let prevFile = nextFiles[ index ];
478
- let id = prevFile.id;
479
- if ( !prevFile ) return;
480
-
481
- let { target } = await prevFile.read();
482
- if ( !target ) return;
483
- let dataUrl = String( target.result );
484
-
485
- let newBlob = await dataUrl.toBlob( file.type )
486
- if ( !newBlob ) return;
487
- let newFile: any = new File( [ newBlob ],name + '.' + extension,{ type: prevFile.type } );
488
- newFile.id = id;
489
-
490
- nextFiles[ index ] = newFile;
491
-
492
- set_status( {
493
- ...val_status,
494
- dataValue: nextFiles,
495
- eventType: 'update',
496
- eventID: $.uuidGen(),
497
- } );
498
- set_edit( false );
499
- }
500
- } }
501
- >
502
- 決定
503
- </Buttons.Button.Prime.R>
504
- </Flex>
505
- </Column>
506
- </>
507
- }
508
- />
509
- </Box>
510
- { !val_edit ? <>
511
- <Box
512
- fontSize={ '1.mini' }
513
- fontColor={ '4.thin' }
514
- flexSizing={ 0 }
515
- children={ FileType.name + 'ファイル / ' + Size + 'B' }
516
- />
517
- </> : null }
518
- </Box>
519
- <Buttons.Button.Sub.R
520
- ssSphere={ 3 }
521
- onClick={ () => {
522
- let nextFiles = [ ...val_status.dataValue ];
523
- let prevFile = nextFiles[ index ];
524
- if ( !prevFile ) return;
525
-
526
- nextFiles.splice( index,1 );
527
- set_status( {
528
- ...val_status,
529
- dataValue: nextFiles,
530
- eventType: 'update',
531
- eventID: $.uuidGen(),
532
- } )
533
- } }
534
- >
535
- <FAIcon.Times />
536
- </Buttons.Button.Sub.R>
537
- </Flex>
538
- );
539
- }
540
-
541
-
542
- ( async () => {
543
- $( document ).addEvent( {
544
- eventType: 'dragover',
545
- callback: ( event ) => {
546
- event.preventDefault();
547
- $( '.' + style.AddButton ).addClass( style.Draggable );
548
- },
549
- option: {
550
- passive: false
551
- }
552
- } ).addEvent( {
553
- eventType: 'drop',
554
- callback: ( event: any ) => {
555
- event.preventDefault();
556
- $( '.' + style.AddButton ).removeClass( style.Draggable );
557
- let Files = event.dataTransfer.files;
558
- if ( Files.length ) {
559
- let Target = event.target as HTMLElement;
560
- if ( $( Target ).hasClass( style.AddButton ) ) {
561
- let { inputComponentId } = Target.dataset;
562
- let component = useStore.get( inputComponentId! );
563
- if ( component && component.AddFiles ) component.AddFiles( Files );
564
- }
565
- }
566
- },
567
- option: {
568
- passive: false
569
- }
570
- } );
571
- } )();
572
-
573
- const FileInput: amotify.fn.Input.Filer.Methods = FileComponent as any
574
- FileInput.fn = {
575
- openDialog: ( params ) => {
576
- let {
577
- multiple,
578
- accept
579
- } = params;
580
-
581
- return new Promise( resolve => {
582
- const input = document.createElement( 'input' );
583
- input.type = 'file';
584
- input.multiple = multiple ?? true;
585
- if ( accept ) {
586
- if ( accept == 'image' ) input.accept = 'image/png,image/jpeg';
587
- else input.accept = accept;
588
- }
589
- input.onchange = ( event: any ) => {
590
- resolve( event.target.files );
591
- };
592
- input.click();
593
- } );
594
- }
595
- }
596
- export { FileInput }
@@ -1,34 +0,0 @@
1
- @use '@uniVar' as *;
2
-
3
- .Input:focus {
4
- + .List .AddButton {
5
- background-color: $color-layer3;
6
- }
7
- }
8
- .FileName {
9
- word-break: break-all;
10
- }
11
- .AddButton {
12
- transition: $animation-time-middle;
13
- > * {
14
- pointer-events: none;
15
- }
16
- &:hover {
17
- background-color: $color-layer3;
18
- }
19
- &.Draggable {
20
- background-color: $color-layer3;
21
- .AddIcon {
22
- animation: 1s infinite IconAnimation;
23
- }
24
- }
25
- }
26
-
27
- @keyframes IconAnimation {
28
- 0% {
29
- box-shadow: 0 0 0 0 $color-theme;
30
- }
31
- 100% {
32
- box-shadow: 0 0 0 1rem cAlfa( 0 );
33
- }
34
- }
@@ -1,18 +0,0 @@
1
- export const HiddenInput: FNC<amotify.fn.Input.Hidden.PlainParams> = ( params ) => {
2
- let {
3
- componentID = '',
4
- form,
5
- value = '',
6
- ...others
7
- } = params;
8
-
9
- return ( <input
10
- value={ JSON.stringify( value ) }
11
- data-input-type={ 'hidden' }
12
- data-form={ form }
13
- data-component-id={ componentID }
14
- data-value={ JSON.stringify( value ) }
15
- { ...others }
16
- type='hidden'
17
- /> );
18
- }