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,965 +0,0 @@
1
- import {
2
- useStore,
3
- React
4
- } from '@global'
5
- import {
6
- Flex,
7
- Box,
8
- Span,
9
- FAI
10
- } from '@atoms'
11
- import {
12
- Column,
13
- Row,Text
14
- } from '@mols'
15
- import {
16
- Buttons,
17
- Input,
18
- Sheet,
19
- } from '@fn'
20
-
21
- import { faArrowUp } from '@fortawesome/free-solid-svg-icons/faArrowUp'
22
- import { faArrowDown } from '@fortawesome/free-solid-svg-icons/faArrowDown'
23
- import { faArrowRight } from '@fortawesome/free-solid-svg-icons/faArrowRight'
24
- import { faFilter } from '@fortawesome/free-solid-svg-icons/faFilter'
25
-
26
- import style from '../style.module.scss'
27
-
28
- import {
29
- Comps,
30
- DefaultCellSystemStyles,
31
- } from '../_'
32
-
33
- type DataTableOptionParams = {
34
- tableID: string
35
- componentID: string
36
-
37
- colLength: number
38
- checker: boolean
39
-
40
- searchKeyword: string
41
- filter: {
42
- enabled: boolean
43
- column: boolean[]
44
- current: ( string[] )[]
45
- }
46
- order: {
47
- enabled: boolean
48
- column: boolean[]
49
- current: amotify.fn.Tables.Data.OrderParams
50
- }
51
- paging: {
52
- rowLength: number
53
- pageLength: number
54
- currentPageIndex: number
55
- }
56
- head: amotify.fn.Tables.Data.HeadRowParams
57
- rows: amotify.fn.Tables.Data.BodyRowParams[]
58
-
59
- noRecords: ReactElement
60
- cellStyles?: amotifyUniStyleParams
61
- cellClassName?: string
62
- cellStylesCallback?: {
63
- ( params: amotify.fn.Tables.StylesCallbackInput ): amotifyUniStyleParams
64
- }
65
- onRowClick?: amotify.fn.Tables.OnRowClick
66
- onOrderChanged?: {
67
- ( args: amotify.fn.Tables.Data.OrderParams ): void
68
- }
69
- }
70
-
71
- const Components = {
72
- __memoryID: $.uuidGen(),
73
- Header: ( params: {
74
- val_status: DataTableOptionParams
75
- set_status: React.Dispatch<React.SetStateAction<DataTableOptionParams>>
76
-
77
- KeywordFilterRows: amotify.fn.Tables.Data.BodyRowParams[]
78
- } ) => {
79
- let {
80
- val_status,
81
- set_status,
82
- KeywordFilterRows
83
- } = { ...params }
84
-
85
- let {
86
- order,
87
- filter
88
- } = val_status
89
- let [ orderIndex,orderDirection ] = order.current
90
-
91
- let Cols = []
92
-
93
- let HEAD = [ ...val_status.head ]
94
- if ( val_status.checker ) {
95
- Cols.push( <Comps.TH
96
- { ...val_status.cellStyles }
97
- fontWeight='2.normal'
98
- position='sticky'
99
- top={ 0 }
100
- unitWidth={ 4 }
101
- padding={ 0 }
102
- { ...DefaultCellSystemStyles( {
103
- top: true,
104
- bottom: !val_status.rows.length,
105
- left: true,
106
- right: !val_status.colLength
107
- } ) }
108
- { ...val_status.cellStylesCallback ? val_status.cellStylesCallback( {
109
- top: true,
110
- bottom: !val_status.rows.length,
111
- left: true,
112
- right: !val_status.colLength,
113
- rowIndex: 0,
114
- colIndex: 0,
115
- isBody: false,
116
- isHeader: true
117
- } ) : {} }
118
- className={ [
119
- style.Cell,
120
- val_status.cellClassName
121
- ].join( ' ' ) }
122
- freeCSS={ {
123
- zIndex: 2
124
- } }
125
- >
126
- <Box flexCenter>
127
- <Input.Checker
128
- label={ null }
129
- value={ false }
130
- onUpdateValidValue={ ( { value } ) => {
131
- let newRows = val_status.rows
132
- newRows.forEach( ( rows ) => {
133
- rows.checked = value
134
- } )
135
- set_status( {
136
- ...val_status,
137
- rows: newRows
138
- } )
139
- } }
140
- />
141
- </Box>
142
- </Comps.TH> )
143
- }
144
-
145
- for ( let colIndex = 0; colIndex < val_status.colLength; colIndex++ ) {
146
- let col = HEAD[ colIndex ]
147
- if ( !col ) continue
148
-
149
- let DisplayLabel = col.children || col.data
150
-
151
- let orderable = order.enabled && order.column[ colIndex ]
152
- let filterable = filter.enabled && filter.column[ colIndex ]
153
-
154
- let OrderButton = orderable ? <FAI
155
- fontSize={ '1.mini' }
156
- fontColor={ colIndex == orderIndex ? '1.clear' : '5.translucent' }
157
- icon={ colIndex == orderIndex
158
- ? orderDirection == 'DESC'
159
- ? faArrowDown
160
- : faArrowUp
161
- : faArrowRight }
162
- /> : null
163
-
164
- let FilterButton = <></>
165
- if ( filterable ) {
166
- let ColumnDatas = KeywordFilterRows.map( ( row ) => {
167
- return row[ colIndex ]?.data
168
- } )
169
- ColumnDatas = [ ... new Set( ColumnDatas ) ].order( {
170
- direction: 'ASC',
171
- } )
172
- let filterList: any = filter.current[ colIndex ]
173
-
174
- if ( filterList ) {
175
- let ValueList = ColumnDatas.filter( ( data ) => !filterList.includes( data ) )
176
- let SelectList: amotify.fn.Input.List.OptionParams[] = []
177
- ColumnDatas.forEach( ( data ) => {
178
- if ( !data ) return
179
- SelectList.push( {
180
- value: data,
181
- label: <Box
182
- flexSizing={ 'auto' }
183
- >
184
- { data }
185
- </Box>
186
- } )
187
- } )
188
-
189
- let FilterModaButtonID = 'BUTTON-' + val_status.componentID + '-' + colIndex
190
- let FilterSheetID = val_status.componentID + '-' + colIndex
191
-
192
- let SheetParams: amotify.fn.Sheet.Params = {
193
- sheetID: FilterSheetID,
194
- parent: '#' + FilterModaButtonID,
195
- gravityPoint: 23,
196
- type: 'custom',
197
- content: <Flex
198
- flexType='col'
199
- border
200
- boxShadow={ '3.remark' }
201
- backgroundColor={ '1.layer.base' }
202
- borderRadius={ 1 }
203
- freeCSS={ {
204
- minWidth: 12 * 20,
205
- maxWidth: 12 * 30
206
- } }
207
- >
208
- <Column
209
- gap={ '1/3' }
210
- overflow={ 'auto' }
211
- padding={ '2/3' }
212
- freeCSS={ {
213
- maxHeight: 12 * 30
214
- } }
215
- >
216
- <Input.Checkbox
217
- tone='cloud'
218
- icon
219
- value={ ValueList }
220
- display='flex'
221
- gap={ '1/2' }
222
- override='force'
223
- options={ SelectList }
224
- hideInput
225
- name={ 'DTFilter-col-' + colIndex + '-table-' + val_status.componentID }
226
- cellStyles={ {
227
- flexSizing: 'auto',
228
- padding: '2/3'
229
- } }
230
- onUpdateValidValue={ ( { value } ) => {
231
- let DropValues = ColumnDatas.filter( ( data ) => !value.includes( data ) )
232
- let newOptions = { ...val_status }
233
- newOptions.filter.current[ colIndex ] = DropValues as string[]
234
-
235
- set_status( newOptions )
236
- } }
237
- />
238
- </Column>
239
- <Row.Separate
240
- gap={ '2/3' }
241
- padding={ '2/3' }
242
- horizontalAlign='right'
243
- >
244
- <Buttons.Button.Border.S
245
- isRounded
246
- onClick={ () => {
247
- Sheet.close( FilterSheetID )
248
- } }
249
- >
250
- 閉じる
251
- </Buttons.Button.Border.S>
252
- <Buttons.Button.Prime.S
253
- color='theme'
254
- isRounded
255
- ssEffectsOnActive='shrink'
256
- onClick={ () => {
257
- let newFilterList = [] as string[]
258
- if ( !filterList.length ) newFilterList = ColumnDatas as string[]
259
-
260
- let newOptions = { ...val_status }
261
- newOptions.filter.current[ colIndex ] = newFilterList
262
-
263
- set_status( newOptions )
264
- } }
265
- >
266
- 全選択
267
- </Buttons.Button.Prime.S>
268
- </Row.Separate>
269
- </Flex>
270
- }
271
-
272
- Sheet.refresh( SheetParams,true )
273
-
274
- FilterButton = <Box className={ style.FilterRegion }>
275
- <Buttons.Button.Sub.S
276
- ssSphere={ 2.5 }
277
- fontSize={ '1.mini' }
278
- className={ style[ 'Filtering_' + !!filterList.length ] }
279
- id={ FilterModaButtonID }
280
- onClick={ ( event ) => {
281
- event.stopPropagation()
282
- Sheet.open( SheetParams )
283
- } }
284
- >
285
- <FAI icon={ faFilter } />
286
- </Buttons.Button.Sub.S>
287
- </Box>
288
- }
289
- }
290
-
291
- col = {
292
- ...val_status.cellStyles,
293
- ...col,
294
- ...DefaultCellSystemStyles( {
295
- top: true,
296
- bottom: !val_status.rows.length,
297
- left: colIndex == Number( val_status.checker ),
298
- right: colIndex == val_status.colLength - 1
299
- } ),
300
- ...val_status.cellStylesCallback ? val_status.cellStylesCallback( {
301
- top: true,
302
- bottom: !val_status.rows.length,
303
- left: colIndex == Number( val_status.checker ),
304
- right: colIndex == val_status.colLength - 1,
305
- rowIndex: 0,
306
- colIndex,
307
- isBody: false,
308
- isHeader: true
309
- } ) : {},
310
- ssPushable: orderable,
311
- className: [
312
- style.Cell,
313
- val_status.cellClassName,
314
- col.className
315
- ].join( ' ' )
316
- }
317
-
318
- Cols.push( <Comps.TH
319
- fontWeight='2.normal'
320
- position='sticky'
321
- top={ 0 }
322
- { ...col }
323
- freeCSS={ {
324
- zIndex: 2,
325
- ...col.freeCSS
326
- } }
327
- onClick={ ( event ) => {
328
- if ( orderable ) {
329
- let newOptions = { ...val_status }
330
- let orderObject: amotify.fn.Tables.Data.OrderParams = [ colIndex,orderIndex === colIndex && orderDirection == 'ASC' ? 'DESC' : 'ASC' ]
331
- newOptions.order.current = orderObject
332
- set_status( newOptions )
333
- val_status.onOrderChanged && val_status.onOrderChanged( orderObject )
334
- }
335
- } }
336
- >
337
- <Flex
338
- flexType='row-r'
339
- flexWrap={ false }
340
- height={ 1 }
341
- borderRadius='inherit'
342
- flexCenter
343
- >
344
- { FilterButton }
345
- <Flex
346
- flexSizing={ 0 }
347
- position='relative'
348
- borderRadius='inherit'
349
- gap={ '1/3' }
350
- flexWrap={ false }
351
- horizontalAlign='center'
352
- >
353
- { OrderButton }
354
- { DisplayLabel }
355
- </Flex>
356
- </Flex>
357
- </Comps.TH> )
358
- }
359
-
360
- return <Comps.Row
361
- className={ [ style.Row,style.HeadRow ].join( ' ' ) }
362
- children={ Cols }
363
- />
364
- },
365
- Body: ( params: {
366
- val_status: DataTableOptionParams
367
- set_status: React.Dispatch<React.SetStateAction<DataTableOptionParams>>
368
- PageRows: amotify.fn.Tables.Data.BodyRowParams[]
369
- } ) => {
370
- let {
371
- val_status,
372
- PageRows
373
- } = params
374
-
375
- let BodyRows: ReactElement[] = []
376
- PageRows.forEach( ( row,rowIndex ) => {
377
- let ROW = [ ...row ]
378
- let Cols: ReactElement[] = []
379
-
380
- if ( val_status.checker ) {
381
- Cols.push( <Comps.TH
382
- unitWidth={ 4 }
383
- padding={ 0 }
384
- borderRight
385
- { ...val_status.cellStyles }
386
- { ...DefaultCellSystemStyles( {
387
- top: rowIndex == 0 && !val_status.head,
388
- bottom: rowIndex == PageRows.length - 1,
389
- left: true,
390
- right: !val_status.colLength
391
- } ) }
392
- { ...val_status.cellStylesCallback ? val_status.cellStylesCallback( {
393
- top: rowIndex == 0 && !val_status.head,
394
- bottom: rowIndex == PageRows.length - 1,
395
- left: true,
396
- right: !val_status.colLength,
397
- rowIndex,
398
- colIndex: 0,
399
- isBody: true,
400
- isHeader: false
401
- } ) : {} }
402
- className={ [
403
- style.Cell,
404
- val_status.cellClassName
405
- ].join( ' ' ) }
406
- >
407
- <Box flexCenter>
408
- <Input.Checker
409
- label={ null }
410
- value={ row.checked }
411
- override='force'
412
- onUpdateValidValue={ ( { value } ) => {
413
- let newRows = val_status.rows
414
- newRows[ rowIndex ].checked = value
415
- params.set_status( {
416
- ...val_status,
417
- rows: newRows
418
- } )
419
- } }
420
- />
421
- </Box>
422
- </Comps.TH> )
423
- }
424
-
425
- ROW.forEach( ( col,colIndex ) => {
426
- if ( !col ) return
427
- let {
428
- type = 'td',
429
- ...Params
430
- } = col
431
-
432
- Params = {
433
- ...val_status.cellStyles,
434
- ...Params,
435
- ...DefaultCellSystemStyles( {
436
- top: rowIndex == 0 && !val_status.head,
437
- bottom: rowIndex == PageRows.length - 1,
438
- left: val_status.checker ? false : colIndex == 0,
439
- right: colIndex == val_status.colLength - 1
440
- } ),
441
- ...val_status.cellStylesCallback ? val_status.cellStylesCallback( {
442
- top: rowIndex == 0 && !val_status.head,
443
- bottom: rowIndex == PageRows.length - 1,
444
- left: val_status.checker ? false : colIndex == 0,
445
- right: colIndex == val_status.colLength - 1,
446
- rowIndex,
447
- colIndex,
448
- isBody: true,
449
- isHeader: false
450
- } ) : {},
451
- className: [
452
- style.Cell,
453
- val_status.cellClassName,
454
- Params.className
455
- ].join( ' ' )
456
- }
457
-
458
- let Cell = Comps[ type == 'td' ? 'TD' : 'TH' ]
459
- Cols.push( <Cell
460
- key={ colIndex }
461
- { ...Params } /> )
462
- } )
463
-
464
- BodyRows.push( <Comps.Row
465
- key={ rowIndex }
466
- className={ [ style.Row,style.BodyRow ].join( ' ' ) }
467
- children={ Cols }
468
- onClick={ ( event ) => {
469
- if ( !val_status.onRowClick ) return
470
- val_status.onRowClick( JSON.parse( row.rowID ) as any,event )
471
- } }
472
- /> )
473
- } )
474
-
475
- if ( !PageRows.length ) {
476
- let Content = <Box
477
- padding={ 2 }
478
- fontColor={ '4.thin' }
479
- freeCSS={ {
480
- textAlign: 'center'
481
- } }
482
- borderTop='1.thin'
483
- children={ 'テーブルがありません' }
484
- />
485
- if ( val_status.noRecords ) {
486
- Content = <>
487
- { val_status.noRecords }
488
- </>
489
- }
490
-
491
- BodyRows.push( <Comps.Row
492
- key={ 'dataNotFound' }
493
- className={ [
494
- style.Row,
495
- style.BodyRow,
496
- style.DataNotFound
497
- ].join( ' ' ) }
498
- >
499
- <Comps.TD
500
- colSpan={ val_status.colLength }
501
- className={ style.Cell }
502
- >
503
- { Content }
504
- </Comps.TD>
505
- </Comps.Row> )
506
- }
507
- return <>{ BodyRows }</>
508
- },
509
- Core: ( params: {
510
- val_status: DataTableOptionParams
511
- set_status: React.Dispatch<React.SetStateAction<DataTableOptionParams>>
512
- } ) => {
513
- let {
514
- val_status,
515
- set_status
516
- } = params
517
-
518
- let {
519
- searchKeyword,
520
- filter,
521
- order,
522
- paging
523
- } = val_status
524
-
525
- let MotherRows = [ ...val_status.rows ]
526
- let KeywordFilterRows = [ ...val_status.rows ]
527
- let FilterRows = [ ...val_status.rows ]
528
- let PageRows = [ ...val_status.rows ]
529
-
530
- if ( searchKeyword ) {
531
- KeywordFilterRows = MotherRows.filter( ( row ) => {
532
- if ( ( row.__sys4SearchKey || '' ).match( new RegExp( searchKeyword,'i' ) ) ) return 1
533
- return 0
534
- } )
535
- FilterRows = [ ...KeywordFilterRows ]
536
- PageRows = [ ...KeywordFilterRows ]
537
- }
538
- if ( filter.enabled ) {
539
- for ( let i = 0; i < val_status.colLength; i++ ) {
540
- let enabled = filter.column[ i ]
541
- let current = filter.current[ i ]
542
-
543
- if ( enabled && current && current.length ) {
544
- FilterRows = FilterRows.filter( ( row ) => !current.includes( row[ i ].data as string ) )
545
- PageRows = [ ...FilterRows ]
546
- }
547
- }
548
- }
549
- if ( order.enabled ) {
550
- FilterRows = FilterRows.order( {
551
- direction: order.current[ 1 ],
552
- keys: [
553
- order.current[ 0 ],
554
- 'orderIndex'
555
- ]
556
- } )
557
- PageRows = [ ...FilterRows ]
558
- }
559
-
560
- {
561
- let {
562
- currentPageIndex,
563
- rowLength
564
- } = paging
565
- PageRows = [ ...PageRows ].splice( ( currentPageIndex - 1 ) * rowLength,rowLength )
566
- }
567
-
568
- let tableObjectID = Components.__memoryID + '_' + val_status.tableID
569
-
570
- let useStatusOutput: amotify.fn.Tables.Data.useStatusOutput = {
571
- tableComponentDidMount: true,
572
- totalRows: MotherRows.length,
573
- pageRows: PageRows.length,
574
- filteredRows: FilterRows.length,
575
-
576
- filter: val_status.filter,
577
- order: val_status.order,
578
- paging: val_status.paging,
579
- searchKeyword: val_status.searchKeyword,
580
- }
581
- useStore.update( {
582
- key: tableObjectID,
583
- value: {
584
- status: useStatusOutput,
585
- updatePageIndex: ( index: number ) => {
586
- let Index = Math.min( Math.max( 1,index ),val_status.paging.pageLength )
587
- let newOptions = { ...val_status }
588
- newOptions.paging.currentPageIndex = Index
589
- set_status( newOptions )
590
- },
591
- updateRowLength: ( index: number ) => {
592
- let newOptions = { ...val_status }
593
- newOptions.paging = {
594
- rowLength: index,
595
- currentPageIndex: 1,
596
- pageLength: Math.ceil( FilterRows.length / index )
597
- }
598
- set_status( newOptions )
599
- },
600
- updateKeyword: ( keyword: string ) => {
601
- $.interval.clear( 'InputSearchTime' )
602
- $.interval.standBy( 'InputSearchTime',200,() => {
603
- let newOptions = { ...val_status }
604
-
605
- newOptions.searchKeyword = keyword
606
- newOptions.paging.currentPageIndex = 1
607
- newOptions.filter.current = newOptions.filter.current.map( () => [] )
608
-
609
- set_status( newOptions )
610
- } )
611
- },
612
- getRowData: () => {
613
- let ReturnRows = [ ...MotherRows ]
614
-
615
- if ( order.enabled ) {
616
- ReturnRows = ReturnRows.order( {
617
- direction: order.current[ 1 ],
618
- keys: [
619
- order.current[ 0 ],
620
- 'orderIndex'
621
- ]
622
- } )
623
- }
624
-
625
- ReturnRows.forEach( ( row ) => {
626
- row.currentPage = false
627
- row.filtered = false
628
- // row.checked = val_checked[ row.rowID! ]
629
- } )
630
- PageRows.forEach( ( row ) => {
631
- let { rowID } = row
632
- ReturnRows.find( ( row ) => row.rowID == rowID )!.currentPage = true
633
- } )
634
- FilterRows.forEach( ( row ) => {
635
- let { rowID } = row
636
- ReturnRows.find( ( row ) => row.rowID == rowID )!.filtered = true
637
- } )
638
- return ReturnRows
639
- }
640
- }
641
- } )
642
-
643
- React.useEffect( () => {
644
- let Propagations = Components.Propagations[ val_status.tableID ] || []
645
- Object.keys( Propagations ).forEach( ( key ) => {
646
- let propagationObject = useStore.get( key )
647
- if ( !propagationObject?.refresh ) return
648
- propagationObject.refresh()
649
- } )
650
- } )
651
-
652
- return <Box
653
- className={ style.TableBase }
654
- >
655
- <Comps.Table className={ style.Table }>
656
- <Components.Header
657
- val_status={ val_status }
658
- set_status={ set_status }
659
- KeywordFilterRows={ KeywordFilterRows }
660
- />
661
- <Components.Body
662
- val_status={ val_status }
663
- set_status={ set_status }
664
- PageRows={ PageRows }
665
- />
666
- </Comps.Table>
667
- </Box>
668
- },
669
- Propagations: {} as any,
670
-
671
- DataLeveler: ( params: amotify.fn.Tables.Data.Params ) => {
672
- params = { ...params }
673
- params.filter = params.filter ?? false
674
- params.filter = Array.from( { length: params.colLength } ).map( ( a,index ) => {
675
- if ( $.is.boolean( params.filter ) ) {
676
- return params.filter
677
- }
678
- return ( params.filter as boolean[] )![ index ] ?? false
679
- } )
680
-
681
- params.order = params.order ?? true
682
- params.order = Array.from( { length: params.colLength } ).map( ( a,index ) => {
683
- if ( $.is.boolean( params.order ) ) {
684
- return params.order
685
- }
686
- return ( params.order as boolean[] )![ index ] ?? true
687
- } )
688
-
689
- params = {
690
- checker: false,
691
- searchKeyword: '',
692
- filter: false,
693
- order: true,
694
- defaultOrder: [ 0,'ASC' ],
695
- ...params
696
- }
697
- params.rows.forEach( ( row,rowIndex ) => {
698
- row.rowID = JSON.stringify( row.rowID || rowIndex )
699
- let __sys4SearchKey: string[] = []
700
- row.forEach( ( col,colIndex ) => {
701
- let {
702
- data,
703
- children,
704
- orderIndex
705
- } = col
706
- col.orderIndex = $.is.exist( orderIndex ) ? String( orderIndex ) : String( data )
707
- col.children = children || String( data )
708
- __sys4SearchKey.push( String( col.data ) )
709
- } )
710
- row.__sys4SearchKey = __sys4SearchKey.join( '/' )
711
- } )
712
- return <Components.StateManager
713
- eventID={ $.uuidGen() }
714
- { ...params }
715
- />
716
- },
717
- StateManager: ( params: amotify.fn.Tables.Data.Params ) => {
718
- let {
719
- colLength,
720
- eventID,
721
- checker = false,
722
- searchKeyword = '',
723
- filter,
724
- order,
725
- defaultOrder = [ 0,'ASC' ] as amotify.fn.Tables.Data.OrderParams,
726
- pageRowLength = 30
727
- } = params
728
- let [ val_componentID ] = React.useState( $.uuidGen() )
729
-
730
- let DefStatus: DataTableOptionParams = {
731
- tableID: params.tableID || val_componentID,
732
- componentID: val_componentID,
733
- colLength,
734
- checker,
735
- searchKeyword: searchKeyword,
736
- filter: {
737
- enabled: filter !== false,
738
- column: filter as boolean[],
739
- current: Array.from( { length: colLength },() => [] )
740
- },
741
- order: {
742
- enabled: order !== false,
743
- column: order as boolean[],
744
- current: defaultOrder
745
- },
746
- paging: {
747
- rowLength: pageRowLength,
748
- pageLength: Math.ceil( params.rows.length / pageRowLength ),
749
- currentPageIndex: 1
750
- },
751
- head: params.head,
752
- rows: params.rows,
753
- noRecords: params.noRecords,
754
- cellStyles: params.cellStyles || {},
755
- cellClassName: params.cellClassName || '',
756
- cellStylesCallback: params.cellStylesCallback,
757
- onRowClick: params.onRowClick,
758
- onOrderChanged: params.onOrderChanged
759
- }
760
- let [ val_status,set_status ] = React.useState( DefStatus )
761
-
762
- let [ val_eventID,set_eventID ] = React.useState( params.eventID )
763
- if ( val_eventID != params.eventID ) {
764
- set_eventID( params.eventID )
765
- set_status( DefStatus )
766
- }
767
-
768
- return <Components.Core
769
- val_status={ val_status }
770
- set_status={ set_status }
771
- />
772
- }
773
- }
774
-
775
- export const DataFNs: amotify.fn.Tables.Data.FNs = {
776
- __memoryID: Components.__memoryID,
777
- useStatus: ( tableID ) => {
778
- let [ val_statusID ] = React.useState( $.uuidGen() )
779
- let [ val_refresh,set_refresh ] = React.useState( $.uuidGen() )
780
-
781
- let tableObjectID = Components.__memoryID + '_' + tableID
782
- React.useEffect( () => {
783
- Components.Propagations[ tableID ] = {
784
- ...Components.Propagations[ tableID ],
785
- [ val_statusID ]: 1
786
- }
787
- useStore.set( {
788
- key: val_statusID,
789
- value: {
790
- refresh: () => {
791
- set_refresh( $.uuidGen() )
792
- }
793
- }
794
- } )
795
-
796
- return () => {
797
- delete Components.Propagations[ tableID ][ val_statusID ]
798
- }
799
- },[] )
800
-
801
- return useStore.get( tableObjectID )?.status || {
802
- tableComponentDidMount: false
803
- }
804
- },
805
- getRowData: ( tableID ) => {
806
- let tableObject = useStore.get( Components.__memoryID + '_' + tableID )
807
- if ( !tableObject?.getRowData ) return
808
- return tableObject.getRowData()
809
- },
810
- setPageIndex: ( tableID,pageIndex ) => {
811
- let tableObject = useStore.get( Components.__memoryID + '_' + tableID )
812
- if ( !tableObject?.updatePageIndex ) return
813
- tableObject.updatePageIndex( pageIndex )
814
- },
815
- setRowLength: ( tableID,rowLength ) => {
816
- let tableObject = useStore.get( Components.__memoryID + '_' + tableID )
817
- if ( !tableObject?.updateRowLength ) return
818
- tableObject.updateRowLength( rowLength )
819
- },
820
- setSearchKeyword: ( tableID,keyword ) => {
821
- let tableObject = useStore.get( Components.__memoryID + '_' + tableID )
822
- if ( !tableObject?.updateKeyword ) return
823
- tableObject.updateKeyword( keyword )
824
- },
825
- }
826
- export const DataComps: amotify.fn.Tables.Data.Comps = {
827
- SearchInput: ( params ) => {
828
- let status = DataFNs.useStatus( params.tableID )
829
- if ( !status.tableComponentDidMount ) return null
830
-
831
- return <Input.Text.Normal
832
- placeholder='検索...'
833
- clearButton
834
- padding={ '2/3' }
835
- paddingRight={ 3 }
836
- rightIcon={ <Input.Comps.RightIcon
837
- fontColor={ '5.translucent' }
838
- right={ '2/3' }
839
- >
840
- <FAI.Search />
841
- </Input.Comps.RightIcon> }
842
- override='force'
843
- value={ status.searchKeyword }
844
- onUpdateValidValue={ ( { value } ) => {
845
- DataFNs.setSearchKeyword( params.tableID,value )
846
- } }
847
- />
848
- },
849
- Info: ( params ) => {
850
- let status = DataFNs.useStatus( params.tableID )
851
- if ( !status.tableComponentDidMount ) return null
852
- let Ratio = status.filteredRows.ratio( status.totalRows ) || 0
853
-
854
- return <Flex
855
- verticalAlign='baseline'
856
- gap={ '1/2' }
857
- fontSize='1.mini'
858
- fontColor='3.blur'
859
- >
860
- <Span
861
- fontSize='4.thirdTitle'
862
- fontColor='theme'
863
- >
864
- { status.filteredRows.toLocaleString() }
865
- </Span>
866
- / { status.totalRows.toLocaleString() }件 ({ Ratio }%)
867
- </Flex>
868
- },
869
- Paging: ( params ) => {
870
- let status = DataFNs.useStatus( params.tableID )
871
- if ( !status.tableComponentDidMount ) return null
872
-
873
- let PageSelect: amotify.fn.Input.Select.OptionProps[] = []
874
- for ( let index = 0; index < status.paging.pageLength; index++ ) {
875
- PageSelect.push( { value: index + 1,label: ( index + 1 ).toString() } )
876
- }
877
-
878
- return <Row.Center>
879
- <Row.Center
880
- gap={ '1/2' }
881
- >
882
- ページ :
883
- <Input.Select
884
- enableUnSelected={ false }
885
- padding={ [ '1/3','2/3' ] }
886
- rightIcon={ false }
887
- placeholder=''
888
- override='force'
889
- value={ status.paging.currentPageIndex }
890
- options={ PageSelect }
891
- onUpdateValidValue={ ( { value } ) => {
892
- DataFNs.setPageIndex( params.tableID,value )
893
- } }
894
- />
895
- / { status.paging.pageLength }
896
- </Row.Center>
897
- <Row.Right gap={ '1/2' }>
898
- <Buttons.Button.Sub.R
899
- ssSphere={ 3 }
900
- onClick={ () => {
901
- if ( status.paging.currentPageIndex == 1 ) {
902
- DataFNs.setPageIndex( params.tableID,status.paging.pageLength )
903
- return
904
- }
905
- DataFNs.setPageIndex( params.tableID,status.paging.currentPageIndex - 1 )
906
- } }
907
- >
908
- <FAI.ChevronLeft />
909
- </Buttons.Button.Sub.R>
910
- <Buttons.Button.Sub.R
911
- ssSphere={ 3 }
912
- onClick={ () => {
913
- if ( status.paging.currentPageIndex == status.paging.pageLength ) {
914
- DataFNs.setPageIndex( params.tableID,1 )
915
- return
916
- }
917
- DataFNs.setPageIndex( params.tableID,status.paging.currentPageIndex + 1 )
918
- } }
919
- >
920
- <FAI.ChevronRight />
921
- </Buttons.Button.Sub.R>
922
- </Row.Right>
923
- </Row.Center>
924
- },
925
- RowLength: ( params ) => {
926
- let status = DataFNs.useStatus( params.tableID )
927
- if ( !status.tableComponentDidMount ) return null
928
-
929
- let currentLength = status.paging.rowLength
930
- let ExistCurrentLength = 0
931
- let LengthList: amotify.fn.Input.Select.OptionProps[] = params.lengthSelect.map( ( l ) => {
932
- ExistCurrentLength |= Number( l == currentLength )
933
-
934
- return { value: l,label: l.toString() }
935
- } )
936
- if ( !ExistCurrentLength ) {
937
- LengthList.push( { value: currentLength,label: currentLength.toString() } )
938
- }
939
-
940
- LengthList = LengthList.order( {
941
- direction: 'ASC',
942
- keys: [ 'value' ],
943
- } )
944
-
945
- return <Row.Center
946
- gap={ '1/2' }
947
- >
948
- 件数 :
949
- <Input.Select
950
- enableUnSelected={ false }
951
- rightIcon={ false }
952
- placeholder='選択'
953
- override='force'
954
- padding={ [ '1/3','2/3' ] }
955
- value={ status.paging.rowLength }
956
- options={ LengthList }
957
- onUpdateValidValue={ ( { value } ) => {
958
- DataFNs.setRowLength( params.tableID,value )
959
- } }
960
- />
961
- </Row.Center>
962
- },
963
- }
964
-
965
- export const DataTable = ( params: amotify.fn.Tables.Data.Params ) => ( <Components.DataLeveler{ ...params } /> )