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