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.
- package/dist/amotify.js +3 -2
- package/dist/amotify.min.css +2 -2
- package/dist/coreVender.js +14 -2
- package/package.json +10 -10
- package/tsconfig.json +13 -5
- package/@types/_.tsx +0 -7
- package/@types/amot.tsx +0 -357
- package/@types/fn.tsx +0 -1280
- package/@types/jsminAmotifyExtension.tsx +0 -137
- package/@types/module.tsx +0 -1
- package/@types/state.tsx +0 -231
- package/src/@atoms.tsx +0 -34
- package/src/@functions.tsx +0 -29
- package/src/@global.tsx +0 -149
- package/src/@jsminAmotifyExtension/_.tsx +0 -4
- package/src/@jsminAmotifyExtension/fetch.tsx +0 -110
- package/src/@jsminAmotifyExtension/formCollect.tsx +0 -94
- package/src/@jsminAmotifyExtension/spreadSheet.tsx +0 -165
- package/src/@jsminAmotifyExtension/variables.tsx +0 -137
- package/src/@molecules.tsx +0 -96
- package/src/@organisms.tsx +0 -1
- package/src/@reactPacks/reactProduction@18.2.0.js +0 -79
- package/src/@reactPacks/reactRouterDomProduction@18.2.0.js +0 -31
- package/src/@styles/@app.scss +0 -4
- package/src/@styles/UniStyling.scss +0 -1028
- package/src/@styles/init.scss +0 -94
- package/src/@styles/props.scss +0 -109
- package/src/@styles/styleSet.scss +0 -38
- package/src/@styles/themeColor.scss +0 -71
- package/src/@styles/var.scss +0 -182
- package/src/@templates.tsx +0 -7
- package/src/@variables.tsx +0 -74
- package/src/atoms/FAI/parts.tsx +0 -139
- package/src/atoms/Logo/parts.tsx +0 -335
- package/src/atoms/Logo/style.module.scss +0 -96
- package/src/atoms/Various/parts.tsx +0 -159
- package/src/atoms/Various/style.module.scss +0 -46
- package/src/config.tsx +0 -191
- package/src/functions/Button/_.tsx +0 -331
- package/src/functions/Button/style.module.scss +0 -157
- package/src/functions/Cropper/parts.tsx +0 -1084
- package/src/functions/Cropper/style.module.scss +0 -64
- package/src/functions/Effects/Fade.tsx +0 -76
- package/src/functions/Effects/Ripple.tsx +0 -141
- package/src/functions/Effects/_.tsx +0 -33
- package/src/functions/Effects/style.module.scss +0 -91
- package/src/functions/Input/Chips/Selector.tsx +0 -445
- package/src/functions/Input/Chips/_.tsx +0 -289
- package/src/functions/Input/Chips/style.module.scss +0 -6
- package/src/functions/Input/Contenteditable.tsx +0 -114
- package/src/functions/Input/DigitCharacters.tsx +0 -235
- package/src/functions/Input/File/_.tsx +0 -553
- package/src/functions/Input/File/style.module.scss +0 -34
- package/src/functions/Input/Hidden.tsx +0 -21
- package/src/functions/Input/List/_.tsx +0 -383
- package/src/functions/Input/List/style.module.scss +0 -84
- package/src/functions/Input/RichSelect/_.tsx +0 -230
- package/src/functions/Input/RichSelect/style.module.scss +0 -11
- package/src/functions/Input/Segmented/_.tsx +0 -246
- package/src/functions/Input/Segmented/style.module.scss +0 -81
- package/src/functions/Input/Select/_.tsx +0 -218
- package/src/functions/Input/Select/style.module.scss +0 -11
- package/src/functions/Input/Slider/_.tsx +0 -524
- package/src/functions/Input/Slider/style.module.scss +0 -67
- package/src/functions/Input/Switch/_.tsx +0 -176
- package/src/functions/Input/Switch/style.module.scss +0 -18
- package/src/functions/Input/Text.tsx +0 -487
- package/src/functions/Input/TextArea.tsx +0 -109
- package/src/functions/Input/Time/Picker.tsx +0 -1361
- package/src/functions/Input/Time/_.tsx +0 -749
- package/src/functions/Input/Time/style.module.scss +0 -79
- package/src/functions/Input/_.tsx +0 -881
- package/src/functions/Input/core.tsx +0 -473
- package/src/functions/Input/style.module.scss +0 -102
- package/src/functions/Inputs/_.tsx +0 -5
- package/src/functions/Inputs/style.module.scss +0 -15
- package/src/functions/Inputs/text.tsx +0 -53
- package/src/functions/Inputs/types.d.ts +0 -13
- package/src/functions/Layout/PageNotFound.tsx +0 -78
- package/src/functions/Layout/PageRouter.tsx +0 -89
- package/src/functions/Layout/PageViewController/parts.tsx +0 -27
- package/src/functions/Layout/Plate.tsx +0 -30
- package/src/functions/Layout/RootViewController/parts.tsx +0 -300
- package/src/functions/Layout/RootViewController/style.module.scss +0 -23
- package/src/functions/Layout/SwipeView/parts.tsx +0 -375
- package/src/functions/Layout/SwipeView/style.module.scss +0 -20
- package/src/functions/Layout/TabBar.tsx +0 -60
- package/src/functions/Layout/_.tsx +0 -20
- package/src/functions/Loader/corner.tsx +0 -74
- package/src/functions/Loader/mini.tsx +0 -114
- package/src/functions/Loader/parts.tsx +0 -103
- package/src/functions/Loader/style.module.scss +0 -223
- package/src/functions/Loader/top.tsx +0 -84
- package/src/functions/Sheet/parts.tsx +0 -994
- package/src/functions/Sheet/style.module.scss +0 -208
- package/src/functions/SnackBar/parts.tsx +0 -215
- package/src/functions/SnackBar/style.module.scss +0 -25
- package/src/functions/Table/Data/parts.tsx +0 -965
- package/src/functions/Table/Drag/parts.tsx +0 -442
- package/src/functions/Table/Normal/parts.tsx +0 -124
- package/src/functions/Table/_.tsx +0 -177
- package/src/functions/Table/style.module.scss +0 -93
- package/src/functions/Tooltips/parts.tsx +0 -53
- package/src/global/LaunchReactApplication.tsx +0 -74
- package/src/global/styleConverter.tsx +0 -465
- package/src/launch.tsx +0 -119
- package/src/molecules/Accordion/parts.tsx +0 -146
- package/src/molecules/Accordion/style.module.scss +0 -13
- package/src/molecules/LinkifyText/parts.tsx +0 -52
- package/src/molecules/List.tsx +0 -31
- package/src/preload.tsx +0 -31
- package/src/templates/PlayGround/parts.tsx +0 -96
- package/src/templates/PlayGround/style.module.scss +0 -38
- package/webpack.config.js +0 -146
|
@@ -1,442 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useStore,
|
|
3
|
-
React
|
|
4
|
-
} from '@global'
|
|
5
|
-
import {
|
|
6
|
-
FAI
|
|
7
|
-
} from '@atoms'
|
|
8
|
-
import {
|
|
9
|
-
Buttons,
|
|
10
|
-
Tooltips,
|
|
11
|
-
} from '@fn'
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
Comps,
|
|
15
|
-
DefaultCellSystemStyles
|
|
16
|
-
} from '../_'
|
|
17
|
-
|
|
18
|
-
import { faGripVertical } from '@fortawesome/free-solid-svg-icons/faGripVertical'
|
|
19
|
-
|
|
20
|
-
import style from '../style.module.scss'
|
|
21
|
-
|
|
22
|
-
const HeadRow: React.FC<amotify.fn.Tables.Drag.Params> = ( props ) => {
|
|
23
|
-
let {
|
|
24
|
-
cellStyles = {},
|
|
25
|
-
cellClassName = '',
|
|
26
|
-
cellStylesCallback,
|
|
27
|
-
colLength,
|
|
28
|
-
head,
|
|
29
|
-
rows
|
|
30
|
-
} = props
|
|
31
|
-
|
|
32
|
-
if ( !head ) return null
|
|
33
|
-
|
|
34
|
-
let Cols = []
|
|
35
|
-
|
|
36
|
-
for ( let colIndex = 0; colIndex < colLength; colIndex++ ) {
|
|
37
|
-
let col = head[ colIndex ]
|
|
38
|
-
|
|
39
|
-
let Cell = Comps[ col.type == 'th' ? 'TH' : 'TD' ]
|
|
40
|
-
Cols.push( <Cell
|
|
41
|
-
{ ...cellStyles }
|
|
42
|
-
{ ...DefaultCellSystemStyles( {
|
|
43
|
-
top: true,
|
|
44
|
-
bottom: !rows.length,
|
|
45
|
-
left: colIndex == 0,
|
|
46
|
-
right: colIndex == colLength - 1
|
|
47
|
-
} ) }
|
|
48
|
-
{ ...cellStylesCallback ? cellStylesCallback( {
|
|
49
|
-
top: true,
|
|
50
|
-
bottom: !rows.length,
|
|
51
|
-
left: colIndex == 0,
|
|
52
|
-
right: colIndex == colLength - 1,
|
|
53
|
-
rowIndex: 0,
|
|
54
|
-
colIndex,
|
|
55
|
-
isBody: false,
|
|
56
|
-
isHeader: true,
|
|
57
|
-
} ) : {} }
|
|
58
|
-
className={ [
|
|
59
|
-
style.Cell,
|
|
60
|
-
cellClassName,
|
|
61
|
-
col.className,
|
|
62
|
-
].join( ' ' ) }
|
|
63
|
-
{ ...col }
|
|
64
|
-
/> )
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return <Comps.Row
|
|
68
|
-
className={ [ style.Row,style.HeadRow ].join( ' ' ) }
|
|
69
|
-
children={ Cols }
|
|
70
|
-
/>
|
|
71
|
-
}
|
|
72
|
-
const BodyRows: React.FC<amotify.fn.Tables.Drag.Params> = ( props ) => {
|
|
73
|
-
let {
|
|
74
|
-
cellStyles = {},
|
|
75
|
-
cellClassName = '',
|
|
76
|
-
cellStylesCallback,
|
|
77
|
-
head,
|
|
78
|
-
rows,
|
|
79
|
-
colLength,
|
|
80
|
-
onOrderChanged
|
|
81
|
-
} = props
|
|
82
|
-
|
|
83
|
-
let [ val_componentID ] = React.useState( $.uuidGen() )
|
|
84
|
-
let [ val_info,set_info ] = React.useState( {
|
|
85
|
-
rows: rows,
|
|
86
|
-
origin: 0,
|
|
87
|
-
to: NaN
|
|
88
|
-
} )
|
|
89
|
-
|
|
90
|
-
let BodyRows: ReactElement[] = []
|
|
91
|
-
|
|
92
|
-
val_info.rows.forEach( ( cols,rowIndex ) => {
|
|
93
|
-
let Cols: ReactElement[] = []
|
|
94
|
-
{
|
|
95
|
-
Cols.push( <Comps.TH
|
|
96
|
-
key={ 'DragOrigin' }
|
|
97
|
-
padding={ 0 }
|
|
98
|
-
borderRight
|
|
99
|
-
{ ...cellStyles }
|
|
100
|
-
{ ...DefaultCellSystemStyles( {
|
|
101
|
-
top: rowIndex == 0 && !head,
|
|
102
|
-
bottom: rowIndex == rows.length - 1,
|
|
103
|
-
left: true,
|
|
104
|
-
right: false
|
|
105
|
-
} ) }
|
|
106
|
-
{ ...cellStylesCallback ? cellStylesCallback( {
|
|
107
|
-
top: rowIndex == 0 && !head,
|
|
108
|
-
bottom: rowIndex == rows.length - 1,
|
|
109
|
-
left: true,
|
|
110
|
-
right: false,
|
|
111
|
-
rowIndex,
|
|
112
|
-
colIndex: 0,
|
|
113
|
-
isBody: true,
|
|
114
|
-
isHeader: false,
|
|
115
|
-
} ) : {} }
|
|
116
|
-
className={ [
|
|
117
|
-
style.Cell,
|
|
118
|
-
style.Draggable,
|
|
119
|
-
cellClassName
|
|
120
|
-
].join( ' ' ) }
|
|
121
|
-
>
|
|
122
|
-
<Buttons.Button.Clear.R
|
|
123
|
-
className={ style.DragableButton }
|
|
124
|
-
fontColor={ '4.thin' }
|
|
125
|
-
fontSize={ '3.paragraph' }
|
|
126
|
-
margin={ 'auto' }
|
|
127
|
-
tabIndex={ -1 }
|
|
128
|
-
ssSphere={ 3 }
|
|
129
|
-
onMouseDown={ ( event ) => {
|
|
130
|
-
EffectStart( event,{
|
|
131
|
-
id: val_componentID,
|
|
132
|
-
index: rowIndex,
|
|
133
|
-
rows: val_info.rows,
|
|
134
|
-
maxLength: rows.length
|
|
135
|
-
} )
|
|
136
|
-
} }
|
|
137
|
-
onTouchStart={ ( event ) => {
|
|
138
|
-
EffectStart( event,{
|
|
139
|
-
id: val_componentID,
|
|
140
|
-
index: rowIndex,
|
|
141
|
-
rows: val_info.rows,
|
|
142
|
-
maxLength: rows.length
|
|
143
|
-
} )
|
|
144
|
-
} }
|
|
145
|
-
>
|
|
146
|
-
<FAI icon={ faGripVertical } />
|
|
147
|
-
</Buttons.Button.Clear.R>
|
|
148
|
-
</Comps.TH> )
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
cols.forEach( ( col,colIndex ) => {
|
|
152
|
-
col = { ...col as any }
|
|
153
|
-
|
|
154
|
-
let Cell = Comps[ col.type == 'th' ? 'TH' : 'TD' ]
|
|
155
|
-
Cols.push( <Cell
|
|
156
|
-
{ ...cellStyles }
|
|
157
|
-
{ ...DefaultCellSystemStyles( {
|
|
158
|
-
top: !!head && !head.length,
|
|
159
|
-
bottom: rowIndex == rows.length - 1,
|
|
160
|
-
left: false,
|
|
161
|
-
right: colIndex == colLength - 2
|
|
162
|
-
} ) }
|
|
163
|
-
{ ...cellStylesCallback ? cellStylesCallback( {
|
|
164
|
-
top: !!head && !head.length,
|
|
165
|
-
bottom: rowIndex == rows.length - 1,
|
|
166
|
-
left: false,
|
|
167
|
-
right: colIndex == colLength - 2,
|
|
168
|
-
rowIndex,
|
|
169
|
-
colIndex,
|
|
170
|
-
isBody: true,
|
|
171
|
-
isHeader: false,
|
|
172
|
-
} ) : {} }
|
|
173
|
-
className={ [
|
|
174
|
-
style.Cell,
|
|
175
|
-
cellClassName,
|
|
176
|
-
col.className,
|
|
177
|
-
].join( ' ' ) }
|
|
178
|
-
{ ...col }
|
|
179
|
-
/> )
|
|
180
|
-
} )
|
|
181
|
-
|
|
182
|
-
BodyRows.push( <Comps.Row
|
|
183
|
-
key={ rowIndex }
|
|
184
|
-
id={ 'TableRow-' + val_componentID + '-' + rowIndex }
|
|
185
|
-
data-rowId={ rowIndex }
|
|
186
|
-
className={ [ style.Row,style.BodyRow ].join( ' ' ) }
|
|
187
|
-
children={ Cols }
|
|
188
|
-
/> )
|
|
189
|
-
} )
|
|
190
|
-
|
|
191
|
-
if ( !isNaN( val_info.to ) ) {
|
|
192
|
-
let {
|
|
193
|
-
origin,
|
|
194
|
-
to
|
|
195
|
-
} = val_info
|
|
196
|
-
let Cols = []
|
|
197
|
-
Cols.push( <Comps.TH
|
|
198
|
-
key={ 'dragButton' }
|
|
199
|
-
backgroundColor='tcOpLow'
|
|
200
|
-
padding={ 0 }
|
|
201
|
-
borderRight={ '2.normal' }
|
|
202
|
-
className={ [
|
|
203
|
-
style.Cell,
|
|
204
|
-
style.Draggable,
|
|
205
|
-
cellClassName
|
|
206
|
-
].join( ' ' ) }
|
|
207
|
-
>
|
|
208
|
-
<FAI.ArrowRight
|
|
209
|
-
fontColor='theme'
|
|
210
|
-
/>
|
|
211
|
-
</Comps.TH> )
|
|
212
|
-
|
|
213
|
-
let cols = val_info.rows[ origin ]
|
|
214
|
-
cols.forEach( ( col,colIndex ) => {
|
|
215
|
-
col = { ...col as any }
|
|
216
|
-
|
|
217
|
-
let Cell = Comps[ col.type == 'th' ? 'TH' : 'TD' ]
|
|
218
|
-
Cols.push( <Cell
|
|
219
|
-
{ ...cellStyles }
|
|
220
|
-
{ ...DefaultCellSystemStyles( {
|
|
221
|
-
top: false,
|
|
222
|
-
bottom: false,
|
|
223
|
-
left: false,
|
|
224
|
-
right: false
|
|
225
|
-
} ) }
|
|
226
|
-
{ ...cellStylesCallback ? cellStylesCallback( {
|
|
227
|
-
top: false,
|
|
228
|
-
bottom: false,
|
|
229
|
-
left: false,
|
|
230
|
-
right: false,
|
|
231
|
-
rowIndex: -1,
|
|
232
|
-
colIndex: -1,
|
|
233
|
-
isBody: true,
|
|
234
|
-
isHeader: false,
|
|
235
|
-
} ) : {} }
|
|
236
|
-
className={ [
|
|
237
|
-
style.Cell,
|
|
238
|
-
cellClassName,
|
|
239
|
-
col.className,
|
|
240
|
-
].join( ' ' ) }
|
|
241
|
-
backgroundColor='tcOpLow'
|
|
242
|
-
{ ...col }
|
|
243
|
-
/> )
|
|
244
|
-
} )
|
|
245
|
-
|
|
246
|
-
BodyRows.splice( to,0,<Comps.Row
|
|
247
|
-
key={ 'preSet' }
|
|
248
|
-
className={ [ style.Row,style.Pre ].join( ' ' ) }
|
|
249
|
-
children={ Cols }
|
|
250
|
-
/> )
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
React.useEffect( () => {
|
|
254
|
-
useStore.set( {
|
|
255
|
-
key: val_componentID,
|
|
256
|
-
value: {
|
|
257
|
-
swap: ( rowIndex: number,insertIndex: number ) => {
|
|
258
|
-
if ( insertIndex || insertIndex == 0 ) {
|
|
259
|
-
let targetRow = val_info.rows[ rowIndex ]
|
|
260
|
-
|
|
261
|
-
let newRows = [ ...val_info.rows ]
|
|
262
|
-
newRows.splice( rowIndex,1 )
|
|
263
|
-
newRows.splice( insertIndex - ( rowIndex < insertIndex ? 1 : 0 ),0,targetRow )
|
|
264
|
-
|
|
265
|
-
set_info( {
|
|
266
|
-
rows: newRows,
|
|
267
|
-
origin: 0,
|
|
268
|
-
to: NaN
|
|
269
|
-
} )
|
|
270
|
-
|
|
271
|
-
onOrderChanged( newRows.map( ( row ) => JSON.parse( row.rowID ) ) )
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
preSet: ( props: {
|
|
275
|
-
origin: number,
|
|
276
|
-
index: number
|
|
277
|
-
} ) => {
|
|
278
|
-
let {
|
|
279
|
-
origin,index
|
|
280
|
-
} = props
|
|
281
|
-
|
|
282
|
-
set_info( {
|
|
283
|
-
rows: val_info.rows,
|
|
284
|
-
origin: origin,
|
|
285
|
-
to: index
|
|
286
|
-
} )
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
} )
|
|
290
|
-
} )
|
|
291
|
-
React.useEffect( () => {
|
|
292
|
-
return () => {
|
|
293
|
-
useStore.delete( val_componentID )
|
|
294
|
-
}
|
|
295
|
-
},[] )
|
|
296
|
-
|
|
297
|
-
return <>
|
|
298
|
-
{ BodyRows }
|
|
299
|
-
</>
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
export const DragTable: React.FC<amotify.fn.Tables.Drag.Params> = ( params ) => {
|
|
303
|
-
params = { ...params }
|
|
304
|
-
params.colLength = params.colLength + 1
|
|
305
|
-
|
|
306
|
-
if ( params.head ) {
|
|
307
|
-
params.head = [
|
|
308
|
-
{
|
|
309
|
-
children: <Buttons.Button.Clear.R
|
|
310
|
-
ssSphere={ 3 }
|
|
311
|
-
fontSize={ '3.paragraph' }
|
|
312
|
-
fontColor={ 'theme' }
|
|
313
|
-
onMouseOver={ ( event ) => {
|
|
314
|
-
Tooltips.open( {
|
|
315
|
-
parent: event.currentTarget,
|
|
316
|
-
content: <Tooltips.Comps.Body>
|
|
317
|
-
<FAI icon={ faGripVertical } />
|
|
318
|
-
ボタンをドラッグして順序を変更
|
|
319
|
-
</Tooltips.Comps.Body>
|
|
320
|
-
} )
|
|
321
|
-
} }
|
|
322
|
-
>
|
|
323
|
-
<FAI.QuestionCircle />
|
|
324
|
-
</Buttons.Button.Clear.R>,
|
|
325
|
-
padding: [ 0,1 ],
|
|
326
|
-
unitWidth: 4
|
|
327
|
-
},
|
|
328
|
-
...params.head
|
|
329
|
-
]
|
|
330
|
-
}
|
|
331
|
-
params.rows = params.rows.map( ( row,rowIndex ) => {
|
|
332
|
-
row.rowID = JSON.stringify( row.rowID || rowIndex )
|
|
333
|
-
return row
|
|
334
|
-
} )
|
|
335
|
-
|
|
336
|
-
return <Comps.Table className={ style.Table }>
|
|
337
|
-
<HeadRow { ...params } />
|
|
338
|
-
<BodyRows { ...params } />
|
|
339
|
-
</Comps.Table>
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
type InfoParams = {
|
|
343
|
-
id: string
|
|
344
|
-
index: number
|
|
345
|
-
maxLength: number
|
|
346
|
-
rows: amotify.fn.Tables.Drag.BodyRowParams[]
|
|
347
|
-
insertIndex?: number
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
const EffectStart = async function ( event: any,info: InfoParams ) {
|
|
351
|
-
event.stopPropagation()
|
|
352
|
-
event.preventDefault()
|
|
353
|
-
|
|
354
|
-
let {
|
|
355
|
-
id,
|
|
356
|
-
index,
|
|
357
|
-
rows,
|
|
358
|
-
maxLength
|
|
359
|
-
} = info
|
|
360
|
-
|
|
361
|
-
$( '#TableRow-' + id + '-' + index ).addClass( style.DraggerOrigin )
|
|
362
|
-
|
|
363
|
-
$( document )
|
|
364
|
-
.addEvent( {
|
|
365
|
-
eventID: 'DragMouseMove',
|
|
366
|
-
eventType: 'mousemove',
|
|
367
|
-
callback: ( event ) => { EffectMove( event,info ) },
|
|
368
|
-
option: { passive: false }
|
|
369
|
-
} )
|
|
370
|
-
.addEvent( {
|
|
371
|
-
eventID: 'DragTouchMove',
|
|
372
|
-
eventType: 'touchmove',
|
|
373
|
-
callback: ( event ) => { EffectMove( event,info ) },
|
|
374
|
-
option: { passive: false }
|
|
375
|
-
} )
|
|
376
|
-
.addEvent( {
|
|
377
|
-
eventID: 'DragMouseUp',
|
|
378
|
-
eventType: 'mouseup',
|
|
379
|
-
callback: ( event ) => { EffectEnd( event,info ) }
|
|
380
|
-
} )
|
|
381
|
-
.addEvent( {
|
|
382
|
-
eventID: 'DragTouchEnd',
|
|
383
|
-
eventType: 'touchend',
|
|
384
|
-
callback: ( event ) => { EffectEnd( event,info ) }
|
|
385
|
-
} )
|
|
386
|
-
}
|
|
387
|
-
const EffectMove = function ( event: any,info: InfoParams ) {
|
|
388
|
-
let {
|
|
389
|
-
id,
|
|
390
|
-
maxLength
|
|
391
|
-
} = info
|
|
392
|
-
|
|
393
|
-
let Y = $.getCursor( event ).y - $.getScreenSize().scrollY
|
|
394
|
-
|
|
395
|
-
for ( let rowIndex = 0; rowIndex < maxLength; rowIndex++ ) {
|
|
396
|
-
let Row = $( '#TableRow-' + id + '-' + rowIndex )
|
|
397
|
-
let {
|
|
398
|
-
top: rT,
|
|
399
|
-
bottom: rB,
|
|
400
|
-
height: rH
|
|
401
|
-
} = Row.position()
|
|
402
|
-
|
|
403
|
-
if ( rowIndex == 0 && Y < rT ) {
|
|
404
|
-
info.insertIndex = 0
|
|
405
|
-
} else if ( rowIndex === maxLength - 1 && rB <= Y ) {
|
|
406
|
-
info.insertIndex = maxLength
|
|
407
|
-
} else if ( Y >= rT && Y < rB ) {
|
|
408
|
-
info.insertIndex = rowIndex + 1
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
{
|
|
413
|
-
let {
|
|
414
|
-
index,
|
|
415
|
-
insertIndex
|
|
416
|
-
} = info
|
|
417
|
-
|
|
418
|
-
let component = useStore.get( id )
|
|
419
|
-
if ( component && component.preSet ) component.preSet( {
|
|
420
|
-
origin: index,
|
|
421
|
-
index: insertIndex
|
|
422
|
-
} )
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
event.stopPropagation()
|
|
426
|
-
event.preventDefault()
|
|
427
|
-
return false
|
|
428
|
-
}
|
|
429
|
-
const EffectEnd = function ( event: any,info: InfoParams ) {
|
|
430
|
-
let {
|
|
431
|
-
id,
|
|
432
|
-
index,
|
|
433
|
-
insertIndex
|
|
434
|
-
} = info
|
|
435
|
-
|
|
436
|
-
let component = useStore.get( id )
|
|
437
|
-
if ( component && component.swap ) component.swap( index,insertIndex )
|
|
438
|
-
|
|
439
|
-
$( '#TableRow-' + id + '-' + index ).removeClass( style.DraggerOrigin )
|
|
440
|
-
|
|
441
|
-
$( document ).removeEvent( [ 'DragMouseMove','DragTouchMove','DragMouseUp','DragTouchEnd' ] )
|
|
442
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
Comps,
|
|
4
|
-
DefaultCellSystemStyles
|
|
5
|
-
} from '../_'
|
|
6
|
-
import style from '../style.module.scss'
|
|
7
|
-
|
|
8
|
-
const HeadRow: React.FC<amotify.fn.Tables.Normal.Params> = ( params ) => {
|
|
9
|
-
let {
|
|
10
|
-
cellStyles = {},
|
|
11
|
-
cellClassName = '',
|
|
12
|
-
cellStylesCallback,
|
|
13
|
-
colLength,
|
|
14
|
-
head,
|
|
15
|
-
rows
|
|
16
|
-
} = params
|
|
17
|
-
|
|
18
|
-
if ( !head ) return null
|
|
19
|
-
|
|
20
|
-
let Cols: ReactElement[] = []
|
|
21
|
-
head.forEach( ( col,colIndex ) => {
|
|
22
|
-
let Cell = Comps[ col.type == 'th' ? 'TH' : 'TD' ]
|
|
23
|
-
Cols.push( <Cell
|
|
24
|
-
{ ...cellStyles }
|
|
25
|
-
{ ...DefaultCellSystemStyles( {
|
|
26
|
-
top: true,
|
|
27
|
-
bottom: !rows.length,
|
|
28
|
-
left: colIndex == 0,
|
|
29
|
-
right: colIndex == colLength - 1
|
|
30
|
-
} ) }
|
|
31
|
-
{ ...cellStylesCallback ? cellStylesCallback( {
|
|
32
|
-
top: true,
|
|
33
|
-
bottom: !rows.length,
|
|
34
|
-
left: colIndex == 0,
|
|
35
|
-
right: colIndex == colLength - 1,
|
|
36
|
-
rowIndex: 0,
|
|
37
|
-
colIndex,
|
|
38
|
-
isBody: false,
|
|
39
|
-
isHeader: true,
|
|
40
|
-
} ) : {} }
|
|
41
|
-
className={ [
|
|
42
|
-
style.Cell,
|
|
43
|
-
cellClassName,
|
|
44
|
-
col.className,
|
|
45
|
-
].join( ' ' ) }
|
|
46
|
-
{ ...col }
|
|
47
|
-
/> )
|
|
48
|
-
} )
|
|
49
|
-
|
|
50
|
-
return <Comps.Row
|
|
51
|
-
className={ [ style.Row,style.HeadRow ].join( ' ' ) }
|
|
52
|
-
children={ Cols }
|
|
53
|
-
/>
|
|
54
|
-
}
|
|
55
|
-
const BodyRows: React.FC<amotify.fn.Tables.Normal.Params> = ( params ) => {
|
|
56
|
-
let {
|
|
57
|
-
cellStyles = {},
|
|
58
|
-
cellClassName = '',
|
|
59
|
-
cellStylesCallback,
|
|
60
|
-
head,
|
|
61
|
-
rows,
|
|
62
|
-
colLength,
|
|
63
|
-
onRowClick,
|
|
64
|
-
} = params
|
|
65
|
-
|
|
66
|
-
let BodyRows: ReactElement[] = []
|
|
67
|
-
rows.forEach( ( cols,rowIndex ) => {
|
|
68
|
-
let Cols: ReactElement[] = []
|
|
69
|
-
cols.forEach( ( col,colIndex ) => {
|
|
70
|
-
let Cell = Comps[ col.type == 'th' ? 'TH' : 'TD' ]
|
|
71
|
-
Cols.push( <Cell
|
|
72
|
-
{ ...cellStyles }
|
|
73
|
-
{ ...DefaultCellSystemStyles( {
|
|
74
|
-
top: rowIndex == 0 && !head,
|
|
75
|
-
bottom: rowIndex == rows.length - 1,
|
|
76
|
-
left: colIndex == 0,
|
|
77
|
-
right: colIndex == colLength - 1
|
|
78
|
-
} ) }
|
|
79
|
-
{ ...cellStylesCallback ? cellStylesCallback( {
|
|
80
|
-
top: rowIndex == 0 && !head,
|
|
81
|
-
bottom: rowIndex == rows.length - 1,
|
|
82
|
-
left: colIndex == 0,
|
|
83
|
-
right: colIndex == colLength - 1,
|
|
84
|
-
rowIndex,
|
|
85
|
-
colIndex,
|
|
86
|
-
isBody: true,
|
|
87
|
-
isHeader: false,
|
|
88
|
-
} ) : {} }
|
|
89
|
-
className={ [
|
|
90
|
-
style.Cell,
|
|
91
|
-
cellClassName,
|
|
92
|
-
col.className,
|
|
93
|
-
].join( ' ' ) }
|
|
94
|
-
{ ...col }
|
|
95
|
-
/> )
|
|
96
|
-
} )
|
|
97
|
-
|
|
98
|
-
BodyRows.push( <Comps.Row
|
|
99
|
-
key={ rowIndex }
|
|
100
|
-
className={ [ style.Row,style.BodyRow ].join( ' ' ) }
|
|
101
|
-
children={ Cols }
|
|
102
|
-
onClick={ ( event ) => {
|
|
103
|
-
if ( onRowClick ) onRowClick( cols.rowID as any,event )
|
|
104
|
-
} }
|
|
105
|
-
/> )
|
|
106
|
-
} )
|
|
107
|
-
|
|
108
|
-
return <>
|
|
109
|
-
{ BodyRows }
|
|
110
|
-
</>
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export const NormalTable: React.FC<amotify.fn.Tables.Normal.Params> = ( params ) => {
|
|
114
|
-
params = { ...params }
|
|
115
|
-
params.rows = params.rows.map( ( row,rowIndex ) => {
|
|
116
|
-
row.rowID = row.rowID || rowIndex
|
|
117
|
-
return row
|
|
118
|
-
} )
|
|
119
|
-
|
|
120
|
-
return <Comps.Table className={ style.Table }>
|
|
121
|
-
<HeadRow { ...params } />
|
|
122
|
-
<BodyRows { ...params } />
|
|
123
|
-
</Comps.Table>
|
|
124
|
-
}
|