@pdg/react-table 1.0.103 → 1.0.105
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/@types/index.d.ts +1 -1
- package/dist/@types/types.d.ts +11 -11
- package/dist/InfoTable/InfoTable.d.ts +7 -7
- package/dist/InfoTable/InfoTable.types.d.ts +78 -79
- package/dist/InfoTable/index.d.ts +4 -4
- package/dist/SearchTable/SearchTable.d.ts +8 -8
- package/dist/SearchTable/SearchTable.types.d.ts +42 -34
- package/dist/SearchTable/index.d.ts +4 -4
- package/dist/Table/Table.d.ts +8 -8
- package/dist/Table/Table.types.d.ts +129 -130
- package/dist/Table/index.d.ts +4 -4
- package/dist/TableBodyCell/TableBodyCell.d.ts +4 -4
- package/dist/TableBodyCell/TableBodyCell.types.d.ts +18 -18
- package/dist/TableBodyCell/index.d.ts +4 -4
- package/dist/TableBodyRow/TableBodyRow.d.ts +7 -7
- package/dist/TableBodyRow/TableBodyRow.types.d.ts +18 -19
- package/dist/TableBodyRow/index.d.ts +4 -4
- package/dist/TableButton/TableButton.d.ts +4 -4
- package/dist/TableButton/TableButton.types.d.ts +3 -4
- package/dist/TableButton/index.d.ts +4 -4
- package/dist/TableCommonCell/TableCommonCell.d.ts +4 -4
- package/dist/TableCommonCell/TableCommonCell.types.d.ts +11 -11
- package/dist/TableCommonCell/index.d.ts +4 -4
- package/dist/TableContext/TableContext.d.ts +4 -4
- package/dist/TableContext/TableContext.types.d.ts +14 -14
- package/dist/TableContext/index.d.ts +5 -5
- package/dist/TableContext/useTableState.d.ts +2 -2
- package/dist/TableContextProvider/TableContextProvider.d.ts +4 -4
- package/dist/TableContextProvider/TableContextProvider.types.d.ts +6 -6
- package/dist/TableContextProvider/index.d.ts +4 -4
- package/dist/TableFooterCell/TableFooterCell.d.ts +4 -4
- package/dist/TableFooterCell/TableFooterCell.types.d.ts +5 -5
- package/dist/TableFooterCell/index.d.ts +4 -4
- package/dist/TableHeadCell/TableHeadCell.d.ts +4 -4
- package/dist/TableHeadCell/TableHeadCell.types.d.ts +11 -11
- package/dist/TableHeadCell/index.d.ts +4 -4
- package/dist/TableMenuButton/TableMenuButton.d.ts +4 -4
- package/dist/TableMenuButton/TableMenuButton.types.d.ts +9 -10
- package/dist/TableMenuButton/index.d.ts +4 -4
- package/dist/TablePagination/TablePagination.d.ts +4 -4
- package/dist/TablePagination/TablePagination.types.d.ts +13 -13
- package/dist/TablePagination/index.d.ts +4 -4
- package/dist/TableTopHead/TableTopHead.d.ts +4 -4
- package/dist/TableTopHead/TableTopHead.types.d.ts +17 -18
- package/dist/TableTopHead/index.d.ts +4 -4
- package/dist/index.d.ts +7 -7
- package/dist/index.esm.js +1896 -2007
- package/dist/index.js +1896 -2007
- package/package.json +18 -18
- package/dist/@util/index.d.ts +0 -1
- package/dist/@util/table.d.ts +0 -8
- package/dist/InfoTable/InfoTable.style.d.ts +0 -14
- package/dist/Table/Table.styles.d.ts +0 -5
- package/dist/TableTopHead/TableTopHead.style.d.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
'use strict';var React=require('react'),classNames=require('classnames'),material=require('@mui/material'),reactResizeDetector=require('react-resize-detector'),sortable=require('@dnd-kit/sortable'),dayjs=require('dayjs'),util=require('@pdg/util'),reactHook=require('@pdg/react-hook'),core=require('@dnd-kit/core'),
|
|
1
|
+
'use strict';var React=require('react'),classNames=require('classnames'),material=require('@mui/material'),reactResizeDetector=require('react-resize-detector'),sortable=require('@dnd-kit/sortable'),dayjs=require('dayjs'),util=require('@pdg/util'),reactHook=require('@pdg/react-hook'),core=require('@dnd-kit/core'),SimpleBar=require('simplebar-react');require('simplebar-react/dist/simplebar.min.css');var uuid=require('uuid'),reactForm=require('@pdg/react-form'),reactComponent=require('@pdg/react-component'),reactCopyToClipboard=require('react-copy-to-clipboard');function styleInject(css, ref) {
|
|
2
2
|
if ( ref === void 0 ) ref = {};
|
|
3
3
|
var insertAt = ref.insertAt;
|
|
4
4
|
|
|
5
|
-
if (
|
|
5
|
+
if (typeof document === 'undefined') { return; }
|
|
6
6
|
|
|
7
7
|
var head = document.head || document.getElementsByTagName('head')[0];
|
|
8
8
|
var style = document.createElement('style');
|
|
@@ -71,23 +71,19 @@ function __makeTemplateObject(cooked, raw) {
|
|
|
71
71
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
72
72
|
var e = new Error(message);
|
|
73
73
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
74
|
-
};var
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
var StyledNoDataDiv = material.styled('div')(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n text-align: center;\n padding: 30px 0;\n font-weight: 500;\n font-size: 13px;\n color: #94a0b2;\n opacity: 0.8;\n\n .material-icons {\n font-size: 40px;\n margin-bottom: 5px;\n }\n"], ["\n text-align: center;\n padding: 30px 0;\n font-weight: 500;\n font-size: 13px;\n color: #94a0b2;\n opacity: 0.8;\n\n .material-icons {\n font-size: 40px;\n margin-bottom: 5px;\n }\n"])));
|
|
90
|
-
var templateObject_1$4;var TableBodyRowDefaultProps = {};const CSS = /*#__PURE__*/Object.freeze({
|
|
74
|
+
};var StyledBodyRow$1 = material.styled(material.TableRow)(function (_a) {
|
|
75
|
+
var theme = _a.theme;
|
|
76
|
+
return ({
|
|
77
|
+
'&.odd-color:nth-of-type(odd):not(:hover)': {
|
|
78
|
+
backgroundColor: material.lighten(theme.palette.action.hover, 0.4),
|
|
79
|
+
},
|
|
80
|
+
'&.even-color:nth-of-type(even):not(:hover)': {
|
|
81
|
+
backgroundColor: material.lighten(theme.palette.action.hover, 0.4),
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
var StyledNoDataDiv = material.styled('div')(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n text-align: center;\n padding: 30px 0;\n font-weight: 500;\n font-size: 13px;\n color: #94a0b2;\n opacity: 0.8;\n\n .material-icons {\n font-size: 40px;\n margin-bottom: 5px;\n }\n"], ["\n text-align: center;\n padding: 30px 0;\n font-weight: 500;\n font-size: 13px;\n color: #94a0b2;\n opacity: 0.8;\n\n .material-icons {\n font-size: 40px;\n margin-bottom: 5px;\n }\n"])));
|
|
86
|
+
var templateObject_1$4;const CSS = /*#__PURE__*/Object.freeze({
|
|
91
87
|
Translate: {
|
|
92
88
|
toString(transform) {
|
|
93
89
|
if (!transform) {
|
|
@@ -137,1991 +133,1884 @@ var templateObject_1$4;var TableBodyRowDefaultProps = {};const CSS = /*#__PURE__
|
|
|
137
133
|
}
|
|
138
134
|
|
|
139
135
|
}
|
|
140
|
-
});function getTableColumnAlign(column, defaultAlign) {
|
|
141
|
-
switch (column.type) {
|
|
142
|
-
case 'number':
|
|
143
|
-
return column.align ? column.align : 'right';
|
|
144
|
-
default:
|
|
145
|
-
return column.align || defaultAlign;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function combineSx() {
|
|
149
|
-
var sx = [];
|
|
150
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
151
|
-
sx[_i] = arguments[_i];
|
|
152
|
-
}
|
|
153
|
-
var finalSx = [];
|
|
154
|
-
if (Array.isArray(finalSx)) {
|
|
155
|
-
sx.forEach(function (v) { return v && finalSx.push.apply(finalSx, (Array.isArray(v) ? v : [v])); });
|
|
156
|
-
}
|
|
157
|
-
return finalSx;
|
|
158
|
-
}
|
|
159
|
-
function typographyColorToSxColor(color) {
|
|
160
|
-
if (typeof color === 'string') {
|
|
161
|
-
if (['primary', 'secondary', 'info', 'warning', 'error'].includes(color)) {
|
|
162
|
-
return "".concat(color, ".main");
|
|
163
|
-
}
|
|
164
|
-
else if (color === 'text') {
|
|
165
|
-
return 'text.primary';
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
return color;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
return color;
|
|
173
|
-
}
|
|
174
|
-
}var TableContextDefaultValue = {
|
|
175
|
-
menuOpen: false,
|
|
176
|
-
openMenuId: undefined,
|
|
177
|
-
setMenuOpen: function () { },
|
|
178
|
-
setItemColumnChecked: function () { },
|
|
179
|
-
setItemColumnCheckDisabled: function () { },
|
|
180
|
-
setItemColumnCommands: function () { },
|
|
181
|
-
setHeadColumnChecked: function () { },
|
|
182
|
-
setHeadColumnCommands: function () { },
|
|
183
|
-
};var TableContext = React.createContext(TableContextDefaultValue);function useTableState() {
|
|
184
|
-
var value = React.useContext(TableContext);
|
|
185
|
-
if (value === undefined) {
|
|
186
|
-
throw new Error('useFormState should be used within TableContext.Provider');
|
|
187
|
-
}
|
|
188
|
-
return value;
|
|
189
|
-
}var StyledTableCell = material.styled(material.TableCell)(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n &.ellipsis {\n position: relative;\n max-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"], ["\n &.ellipsis {\n position: relative;\n max-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"])));
|
|
190
|
-
var TableCommonCell = function (_a) {
|
|
191
|
-
/********************************************************************************************************************
|
|
192
|
-
* Use
|
|
193
|
-
* ******************************************************************************************************************/
|
|
194
|
-
var children = _a.children, initClassName = _a.className, initStyle = _a.style, initSx = _a.sx, type = _a.type, column = _a.column, defaultAlign = _a.defaultAlign, initDefaultEllipsis = _a.defaultEllipsis, index = _a.index, item = _a.item, onClick = _a.onClick;
|
|
195
|
-
var menuOpen = useTableState().menuOpen;
|
|
196
|
-
/********************************************************************************************************************
|
|
197
|
-
* Memo
|
|
198
|
-
* ******************************************************************************************************************/
|
|
199
|
-
var
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
(column.ellipsis ||
|
|
203
|
-
(column.type !== 'img' &&
|
|
204
|
-
column.type !== 'button' &&
|
|
205
|
-
column.type !== 'buttons' &&
|
|
206
|
-
(column.ellipsis == null ? !!initDefaultEllipsis : false)));
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
var
|
|
211
|
-
var
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
var
|
|
238
|
-
var
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
var
|
|
262
|
-
var
|
|
263
|
-
var
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
*
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
column.type !== '
|
|
324
|
-
column.type !== '
|
|
325
|
-
column.type !== '
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
*
|
|
343
|
-
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
var
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
*
|
|
350
|
-
|
|
351
|
-
var
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
*
|
|
355
|
-
|
|
356
|
-
var
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
*
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
*
|
|
394
|
-
|
|
395
|
-
var
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
var
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
onCheckChange && onCheckChange(item,
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
var
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
React.createElement("
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
React.createElement("
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
React.createElement("
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
*
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
*
|
|
535
|
-
|
|
536
|
-
};
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
});
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
*
|
|
552
|
-
|
|
553
|
-
var
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
*
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
*
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
*
|
|
611
|
-
|
|
612
|
-
var
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
*
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
*
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
var
|
|
677
|
-
var
|
|
678
|
-
/********************************************************************************************************************
|
|
679
|
-
*
|
|
680
|
-
* ******************************************************************************************************************/
|
|
681
|
-
var
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
var
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
.
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}
|
|
768
|
-
};
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
var
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
var
|
|
780
|
-
var
|
|
781
|
-
var
|
|
782
|
-
var
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
var
|
|
807
|
-
var
|
|
808
|
-
var
|
|
809
|
-
var
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
setContainerHeight(
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
setPagingHeight(
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
return
|
|
865
|
-
}
|
|
866
|
-
}, []);
|
|
867
|
-
var
|
|
868
|
-
if (
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
var data =
|
|
1168
|
-
if (data) {
|
|
1169
|
-
data.
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
var
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
*
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
*
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
if (
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
}
|
|
1435
|
-
else {
|
|
1436
|
-
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
break;
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
React.
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
})
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
if (
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
data = (React.createElement(React.Fragment, null,
|
|
2022
|
-
React.createElement("span", null, dt.format('YYYY-MM-DD')),
|
|
2023
|
-
item.dateTwoLine ? React.createElement("br", null) : ' ',
|
|
2024
|
-
React.createElement("span", { style: { opacity: 0.5 } }, dt.format('HH시'))));
|
|
2025
|
-
}
|
|
2026
|
-
break;
|
|
2027
|
-
case 'date-minute':
|
|
2028
|
-
if (typeof data === 'string' || typeof data === 'number') {
|
|
2029
|
-
var dt = dayjs(data, item.dateFormat);
|
|
2030
|
-
data = (React.createElement(React.Fragment, null,
|
|
2031
|
-
React.createElement("span", null, dt.format('YYYY-MM-DD')),
|
|
2032
|
-
item.dateTwoLine ? React.createElement("br", null) : ' ',
|
|
2033
|
-
React.createElement("span", { style: { opacity: 0.5 } }, dt.format('HH시 MM분'))));
|
|
2034
|
-
}
|
|
2035
|
-
break;
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
2038
|
-
if (util.empty(data))
|
|
2039
|
-
data = item.onRenderEmpty ? item.onRenderEmpty(info) : React.createElement(React.Fragment, null, "\u00A0");
|
|
2040
|
-
/** copyToClipboardText */
|
|
2041
|
-
var copyToClipboardText = item.clipboardText || (typeof data === 'string' ? data : typeof data === 'number' ? data.toString() : '');
|
|
2042
|
-
/** sizeProps */
|
|
2043
|
-
var sizeProps = {};
|
|
2044
|
-
if (typeof cols === 'number') {
|
|
2045
|
-
sizeProps.xs = 12 / cols;
|
|
2046
|
-
}
|
|
2047
|
-
else {
|
|
2048
|
-
if (cols.xs)
|
|
2049
|
-
sizeProps.xs = 12 / cols.xs;
|
|
2050
|
-
if (cols.sm)
|
|
2051
|
-
sizeProps.sm = 12 / cols.sm;
|
|
2052
|
-
if (cols.md)
|
|
2053
|
-
sizeProps.md = 12 / cols.md;
|
|
2054
|
-
if (cols.lg)
|
|
2055
|
-
sizeProps.lg = 12 / cols.lg;
|
|
2056
|
-
if (cols.xl)
|
|
2057
|
-
sizeProps.xl = 12 / cols.xl;
|
|
2058
|
-
}
|
|
2059
|
-
if (item.xs)
|
|
2060
|
-
sizeProps.xs = item.xs;
|
|
2061
|
-
if (item.sm)
|
|
2062
|
-
sizeProps.sm = item.sm;
|
|
2063
|
-
if (item.md)
|
|
2064
|
-
sizeProps.md = item.md;
|
|
2065
|
-
if (item.lg)
|
|
2066
|
-
sizeProps.lg = item.lg;
|
|
2067
|
-
if (item.xl)
|
|
2068
|
-
sizeProps.xl = item.xl;
|
|
2069
|
-
if (item.onXs)
|
|
2070
|
-
sizeProps.xs = item.onXs(info);
|
|
2071
|
-
if (item.onSm)
|
|
2072
|
-
sizeProps.sm = item.onSm(info);
|
|
2073
|
-
if (item.onMd)
|
|
2074
|
-
sizeProps.md = item.onMd(info);
|
|
2075
|
-
if (item.onLg)
|
|
2076
|
-
sizeProps.lg = item.onLg(info);
|
|
2077
|
-
if (item.onXl)
|
|
2078
|
-
sizeProps.xl = item.onXl(info);
|
|
2079
|
-
return { item: item, data: data, copyToClipboardText: copyToClipboardText, sizeProps: sizeProps };
|
|
2080
|
-
});
|
|
2081
|
-
}, [info, items, cols]);
|
|
2082
|
-
var content = React.useMemo(function () {
|
|
2083
|
-
return renderItems.map(function (_a, idx) {
|
|
2084
|
-
var item = _a.item, data = _a.data, copyToClipboardText = _a.copyToClipboardText, sizeProps = _a.sizeProps;
|
|
2085
|
-
var finalLabelColor = typographyColorToSxColor(item.type === 'divider' ? item.dividerColor || dividerColor : item.labelColor || labelColor);
|
|
2086
|
-
var finalLabelSx = combineSx(labelSx, item.labelSx, !!finalLabelColor && { color: finalLabelColor });
|
|
2087
|
-
var finalValueSx = combineSx(valueSx, item.valueSx);
|
|
2088
|
-
var valueUnderlineStyle = valueUnderline
|
|
2089
|
-
? { borderBottom: '1px solid #efefef', paddingBottom: 5 }
|
|
2090
|
-
: undefined;
|
|
2091
|
-
return item.type === 'divider' ? (React.createElement(material.Grid, { key: idx, item: true, xs: 12 },
|
|
2092
|
-
React.createElement(material.Stack, { direction: 'row', spacing: 0.5, alignItems: 'center' },
|
|
2093
|
-
item.icon && (React.createElement(reactComponent.PdgIcon, { sx: { color: item.dividerColor || dividerColor }, size: 'small' }, item.icon)),
|
|
2094
|
-
item.label && (React.createElement(Label, { className: classNames(labelClassName, item.labelClassName), style: __assign(__assign({}, item.labelStyle), labelStyle), sx: finalLabelSx }, item.label)),
|
|
2095
|
-
item.dividerLine && (React.createElement(React.Fragment, null, item.icon || item.label ? (React.createElement("div", { style: { flex: 1, paddingLeft: 5 } },
|
|
2096
|
-
React.createElement(Line, null))) : (React.createElement(Line, null))))))) : (React.createElement(material.Grid, __assign({ key: idx, item: true }, sizeProps, { className: item.className, style: item.style, sx: item.sx }),
|
|
2097
|
-
React.createElement(material.Stack, { direction: 'row', spacing: 0.5, alignItems: 'center' },
|
|
2098
|
-
item.icon && (React.createElement(reactComponent.PdgIcon, { sx: { color: finalLabelColor }, size: 'small' }, "CalendarMonth")),
|
|
2099
|
-
React.createElement(Label, { className: classNames(labelClassName, item.labelClassName), style: __assign(__assign({}, item.labelStyle), labelStyle), sx: finalLabelSx }, item.label)),
|
|
2100
|
-
React.createElement(ValueWrap, { className: classNames(valueClassName, item.valueClassName), style: __assign(__assign(__assign({}, valueStyle), item.valueStyle), valueUnderlineStyle), sx: finalValueSx },
|
|
2101
|
-
item.ellipsis || ellipsis ? React.createElement(ValueEllipsis, null, data) : React.createElement(Value, null, data),
|
|
2102
|
-
item.clipboard && util.notEmpty(copyToClipboardText) && (React.createElement(ValueClipboard, null,
|
|
2103
|
-
React.createElement(reactCopyToClipboard.CopyToClipboard, { text: copyToClipboardText, onCopy: onCopyToClipboard ? function () { return onCopyToClipboard(item, copyToClipboardText); } : undefined },
|
|
2104
|
-
React.createElement(ClipboardIconButton, __assign({ size: 'small', color: 'primary' }, item.clipboardProps),
|
|
2105
|
-
React.createElement(reactComponent.PdgIcon, null, item.clipboardIcon || 'ContentPaste'))))))));
|
|
2106
|
-
});
|
|
2107
|
-
}, [
|
|
2108
|
-
dividerColor,
|
|
2109
|
-
ellipsis,
|
|
2110
|
-
labelClassName,
|
|
2111
|
-
labelColor,
|
|
2112
|
-
labelStyle,
|
|
2113
|
-
labelSx,
|
|
2114
|
-
onCopyToClipboard,
|
|
2115
|
-
renderItems,
|
|
2116
|
-
valueClassName,
|
|
2117
|
-
valueStyle,
|
|
2118
|
-
valueSx,
|
|
2119
|
-
valueUnderline,
|
|
2120
|
-
]);
|
|
2121
|
-
/********************************************************************************************************************
|
|
2122
|
-
* Render
|
|
2123
|
-
* ******************************************************************************************************************/
|
|
2124
|
-
return (React.createElement(material.Grid, { container: true, spacing: spacing, columnSpacing: columnSpacing, rowSpacing: rowSpacing, className: classNames('InfoTable', className), style: style, sx: sx }, content));
|
|
2125
|
-
};
|
|
2126
|
-
InfoTable.displayName = 'InfoTable';
|
|
2127
|
-
InfoTable.defaultProps = InfoTableDefaultProps;exports.InfoTable=InfoTable;exports.InfoTableDefaultProps=InfoTableDefaultProps;exports.SearchTable=SearchTable;exports.SearchTableDefaultProps=SearchTableDefaultProps;exports.Table=Table;exports.TableButton=TableButton;exports.TableButtonDefaultProps=TableButtonDefaultProps;exports.TableDefaultProps=TableDefaultProps;exports.TableMenuButton=TableMenuButton;exports.TableMenuButtonDefaultProps=TableMenuButtonDefaultProps;
|
|
136
|
+
});function getTableColumnAlign(column, defaultAlign) {
|
|
137
|
+
switch (column.type) {
|
|
138
|
+
case 'number':
|
|
139
|
+
return column.align ? column.align : 'right';
|
|
140
|
+
default:
|
|
141
|
+
return column.align || defaultAlign;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function combineSx() {
|
|
145
|
+
var sx = [];
|
|
146
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
147
|
+
sx[_i] = arguments[_i];
|
|
148
|
+
}
|
|
149
|
+
var finalSx = [];
|
|
150
|
+
if (Array.isArray(finalSx)) {
|
|
151
|
+
sx.forEach(function (v) { return v && finalSx.push.apply(finalSx, (Array.isArray(v) ? v : [v])); });
|
|
152
|
+
}
|
|
153
|
+
return finalSx;
|
|
154
|
+
}
|
|
155
|
+
function typographyColorToSxColor(color) {
|
|
156
|
+
if (typeof color === 'string') {
|
|
157
|
+
if (['primary', 'secondary', 'info', 'warning', 'error'].includes(color)) {
|
|
158
|
+
return "".concat(color, ".main");
|
|
159
|
+
}
|
|
160
|
+
else if (color === 'text') {
|
|
161
|
+
return 'text.primary';
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return color;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
return color;
|
|
169
|
+
}
|
|
170
|
+
}var TableContextDefaultValue = {
|
|
171
|
+
menuOpen: false,
|
|
172
|
+
openMenuId: undefined,
|
|
173
|
+
setMenuOpen: function () { },
|
|
174
|
+
setItemColumnChecked: function () { },
|
|
175
|
+
setItemColumnCheckDisabled: function () { },
|
|
176
|
+
setItemColumnCommands: function () { },
|
|
177
|
+
setHeadColumnChecked: function () { },
|
|
178
|
+
setHeadColumnCommands: function () { },
|
|
179
|
+
};var TableContext = React.createContext(TableContextDefaultValue);function useTableState() {
|
|
180
|
+
var value = React.useContext(TableContext);
|
|
181
|
+
if (value === undefined) {
|
|
182
|
+
throw new Error('useFormState should be used within TableContext.Provider');
|
|
183
|
+
}
|
|
184
|
+
return value;
|
|
185
|
+
}var StyledTableCell = material.styled(material.TableCell)(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n &.ellipsis {\n position: relative;\n max-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"], ["\n &.ellipsis {\n position: relative;\n max-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"])));
|
|
186
|
+
var TableCommonCell = function (_a) {
|
|
187
|
+
/********************************************************************************************************************
|
|
188
|
+
* Use
|
|
189
|
+
* ******************************************************************************************************************/
|
|
190
|
+
var children = _a.children, initClassName = _a.className, initStyle = _a.style, initSx = _a.sx, type = _a.type, column = _a.column, defaultAlign = _a.defaultAlign, initDefaultEllipsis = _a.defaultEllipsis, index = _a.index, item = _a.item, onClick = _a.onClick;
|
|
191
|
+
var menuOpen = useTableState().menuOpen;
|
|
192
|
+
/********************************************************************************************************************
|
|
193
|
+
* Memo
|
|
194
|
+
* ******************************************************************************************************************/
|
|
195
|
+
var _b = React.useMemo(function () {
|
|
196
|
+
var align = getTableColumnAlign(column, defaultAlign);
|
|
197
|
+
var ellipsis = type !== 'head' &&
|
|
198
|
+
(column.ellipsis ||
|
|
199
|
+
(column.type !== 'img' &&
|
|
200
|
+
column.type !== 'button' &&
|
|
201
|
+
column.type !== 'buttons' &&
|
|
202
|
+
(column.ellipsis == null ? !!initDefaultEllipsis : false)));
|
|
203
|
+
return { align: align, ellipsis: ellipsis };
|
|
204
|
+
}, [column, defaultAlign, initDefaultEllipsis, type]), align = _b.align, ellipsis = _b.ellipsis;
|
|
205
|
+
var className = React.useMemo(function () {
|
|
206
|
+
var _a, _b, _c, _d, _e, _f;
|
|
207
|
+
var className;
|
|
208
|
+
var getClassName;
|
|
209
|
+
switch (type) {
|
|
210
|
+
case 'head':
|
|
211
|
+
className = (_a = column.head) === null || _a === void 0 ? void 0 : _a.className;
|
|
212
|
+
getClassName = ((_b = column.head) === null || _b === void 0 ? void 0 : _b.onGetClassName) ? (_c = column.head) === null || _c === void 0 ? void 0 : _c.onGetClassName() : undefined;
|
|
213
|
+
break;
|
|
214
|
+
case 'body':
|
|
215
|
+
className = column.className;
|
|
216
|
+
if (item != null && index != null) {
|
|
217
|
+
getClassName = column.onGetClassName ? column.onGetClassName(item, index) : undefined;
|
|
218
|
+
}
|
|
219
|
+
break;
|
|
220
|
+
case 'footer':
|
|
221
|
+
className = (_d = column.footer) === null || _d === void 0 ? void 0 : _d.className;
|
|
222
|
+
getClassName = ((_e = column.footer) === null || _e === void 0 ? void 0 : _e.onGetClassName) ? (_f = column.footer) === null || _f === void 0 ? void 0 : _f.onGetClassName() : undefined;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
if (className || getClassName) {
|
|
226
|
+
return classNames(initClassName, className, getClassName);
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
return initClassName;
|
|
230
|
+
}
|
|
231
|
+
}, [column, index, initClassName, item, type]);
|
|
232
|
+
var style = React.useMemo(function () {
|
|
233
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
234
|
+
var style;
|
|
235
|
+
var getStyle;
|
|
236
|
+
switch (type) {
|
|
237
|
+
case 'head':
|
|
238
|
+
style = ((_a = column.head) === null || _a === void 0 ? void 0 : _a.backgroundColor)
|
|
239
|
+
? __assign(__assign({}, (_b = column.head) === null || _b === void 0 ? void 0 : _b.style), { backgroundColor: column.head.backgroundColor }) : (_c = column.head) === null || _c === void 0 ? void 0 : _c.style;
|
|
240
|
+
getStyle = ((_d = column.head) === null || _d === void 0 ? void 0 : _d.onGetStyle) ? (_e = column.head) === null || _e === void 0 ? void 0 : _e.onGetStyle() : undefined;
|
|
241
|
+
break;
|
|
242
|
+
case 'body':
|
|
243
|
+
style = column.backgroundColor ? __assign(__assign({}, column.style), { backgroundColor: column.backgroundColor }) : column.style;
|
|
244
|
+
if (item != null && index != null) {
|
|
245
|
+
getStyle = column.onGetStyle ? column.onGetStyle(item, index) : undefined;
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
case 'footer':
|
|
249
|
+
style = ((_f = column.footer) === null || _f === void 0 ? void 0 : _f.backgroundColor)
|
|
250
|
+
? __assign(__assign({}, (_g = column.footer) === null || _g === void 0 ? void 0 : _g.style), { backgroundColor: column.footer.backgroundColor }) : (_h = column.footer) === null || _h === void 0 ? void 0 : _h.style;
|
|
251
|
+
getStyle = ((_j = column.footer) === null || _j === void 0 ? void 0 : _j.onGetStyle) ? (_k = column.footer) === null || _k === void 0 ? void 0 : _k.onGetStyle() : undefined;
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
return __assign(__assign(__assign(__assign({}, initStyle), { width: column.width, minWidth: column.minWidth, cursor: type === 'body' && (column.onClick || onClick) ? 'pointer' : undefined, paddingLeft: column.paddingLeft, paddingRight: column.paddingRight }), style), getStyle);
|
|
255
|
+
}, [column, index, initStyle, item, onClick, type]);
|
|
256
|
+
var sx = React.useMemo(function () {
|
|
257
|
+
var _a, _b, _c, _d, _e, _f;
|
|
258
|
+
var sx;
|
|
259
|
+
var getSx;
|
|
260
|
+
var displaySx;
|
|
261
|
+
switch (type) {
|
|
262
|
+
case 'head':
|
|
263
|
+
sx = (_a = column.head) === null || _a === void 0 ? void 0 : _a.sx;
|
|
264
|
+
getSx = ((_b = column.head) === null || _b === void 0 ? void 0 : _b.onGetSx) ? (_c = column.head) === null || _c === void 0 ? void 0 : _c.onGetSx() : undefined;
|
|
265
|
+
break;
|
|
266
|
+
case 'body':
|
|
267
|
+
sx = column.sx;
|
|
268
|
+
if (item != null && index != null) {
|
|
269
|
+
getSx = column.onGetSx ? column.onGetSx(item, index) : undefined;
|
|
270
|
+
}
|
|
271
|
+
break;
|
|
272
|
+
case 'footer':
|
|
273
|
+
sx = (_d = column.footer) === null || _d === void 0 ? void 0 : _d.sx;
|
|
274
|
+
getSx = ((_e = column.footer) === null || _e === void 0 ? void 0 : _e.onGetSx) ? (_f = column.footer) === null || _f === void 0 ? void 0 : _f.onGetSx() : undefined;
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
if (column.display) {
|
|
278
|
+
var display = {};
|
|
279
|
+
if (column.display.xs !== undefined)
|
|
280
|
+
display.xs = column.display.xs ? 'table-cell' : 'none';
|
|
281
|
+
if (column.display.sm !== undefined)
|
|
282
|
+
display.sm = column.display.sm ? 'table-cell' : 'none';
|
|
283
|
+
if (column.display.md !== undefined)
|
|
284
|
+
display.md = column.display.md ? 'table-cell' : 'none';
|
|
285
|
+
if (column.display.lg !== undefined)
|
|
286
|
+
display.lg = column.display.lg ? 'table-cell' : 'none';
|
|
287
|
+
if (column.display.xl !== undefined)
|
|
288
|
+
display.xl = column.display.xl ? 'table-cell' : 'none';
|
|
289
|
+
displaySx = { display: display };
|
|
290
|
+
}
|
|
291
|
+
var sxList = [];
|
|
292
|
+
if (getSx)
|
|
293
|
+
sxList.push(getSx);
|
|
294
|
+
if (sx)
|
|
295
|
+
sxList.push(sx);
|
|
296
|
+
if (initSx)
|
|
297
|
+
sxList.push(initSx);
|
|
298
|
+
if (displaySx)
|
|
299
|
+
sxList.push(displaySx);
|
|
300
|
+
if (sxList.length > 0) {
|
|
301
|
+
if (sxList.length === 1) {
|
|
302
|
+
return sxList[0];
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
if (!sxList.find(function (sx) { return typeof sx !== 'object'; })) {
|
|
306
|
+
return sxList.reduce(function (res, sx) {
|
|
307
|
+
res = __assign(__assign({}, res), sx);
|
|
308
|
+
return res;
|
|
309
|
+
}, {});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}, [column, index, initSx, item, type]);
|
|
314
|
+
/********************************************************************************************************************
|
|
315
|
+
* Event Handler
|
|
316
|
+
* ******************************************************************************************************************/
|
|
317
|
+
var handleClick = React.useCallback(function (e) {
|
|
318
|
+
if (!menuOpen &&
|
|
319
|
+
column.type !== 'check' &&
|
|
320
|
+
column.type !== 'button' &&
|
|
321
|
+
column.type !== 'buttons' &&
|
|
322
|
+
column.type !== 'img') {
|
|
323
|
+
e.stopPropagation();
|
|
324
|
+
if (type === 'body') {
|
|
325
|
+
if (item != null && index != null) {
|
|
326
|
+
if (column.onClick) {
|
|
327
|
+
column.onClick(item, index);
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
if (onClick)
|
|
331
|
+
onClick(item, index);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}, [menuOpen, type, item, index, column, onClick]);
|
|
337
|
+
/********************************************************************************************************************
|
|
338
|
+
* Render
|
|
339
|
+
* ******************************************************************************************************************/
|
|
340
|
+
return (React.createElement(StyledTableCell, { align: align, className: classNames(className, 'TableCommonCell', ellipsis && 'ellipsis', column.type ? "column-type-".concat(column.type) : false), style: style, sx: sx, onClick: type === 'body' ? handleClick : undefined }, children));
|
|
341
|
+
};
|
|
342
|
+
var templateObject_1$3;var StyledButtonsBox = material.styled(material.Box)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n gap: 5px;\n"], ["\n display: flex;\n flex-wrap: wrap;\n gap: 5px;\n"])));
|
|
343
|
+
var TableBodyCell = function (_a) {
|
|
344
|
+
/********************************************************************************************************************
|
|
345
|
+
* Use
|
|
346
|
+
* ******************************************************************************************************************/
|
|
347
|
+
var className = _a.className, style = _a.style, sx = _a.sx, item = _a.item, index = _a.index, column = _a.column, defaultAlign = _a.defaultAlign, defaultEllipsis = _a.defaultEllipsis, onClick = _a.onClick, onCheckChange = _a.onCheckChange;
|
|
348
|
+
var _b = useTableState(), menuOpen = _b.menuOpen, setItemColumnChecked = _b.setItemColumnChecked, setItemColumnCheckDisabled = _b.setItemColumnCheckDisabled, setItemColumnCommands = _b.setItemColumnCommands;
|
|
349
|
+
/********************************************************************************************************************
|
|
350
|
+
* State
|
|
351
|
+
* ******************************************************************************************************************/
|
|
352
|
+
var _c = React.useState(false), checked = _c[0], setChecked = _c[1];
|
|
353
|
+
var _d = React.useState(false), checkDisabled = _d[0], setCheckDisabled = _d[1];
|
|
354
|
+
/********************************************************************************************************************
|
|
355
|
+
* Effect
|
|
356
|
+
* ******************************************************************************************************************/
|
|
357
|
+
React.useEffect(function () {
|
|
358
|
+
if (column.type === 'check') {
|
|
359
|
+
setChecked(column.onInitChecked ? column.onInitChecked(item) : false);
|
|
360
|
+
setCheckDisabled(column.onCheckDisabled ? column.onCheckDisabled(item) : false);
|
|
361
|
+
}
|
|
362
|
+
setItemColumnCommands(item, column, {
|
|
363
|
+
setChecked: function (checked) {
|
|
364
|
+
if (column.type === 'check') {
|
|
365
|
+
setChecked(checked);
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
setCheckDisabled: function (disabled) {
|
|
369
|
+
if (column.type === 'check') {
|
|
370
|
+
setCheckDisabled(disabled);
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
});
|
|
374
|
+
}, [column, item, setItemColumnCommands]);
|
|
375
|
+
React.useEffect(function () {
|
|
376
|
+
if (column.type === 'check') {
|
|
377
|
+
setItemColumnChecked(item, column, checked);
|
|
378
|
+
}
|
|
379
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
380
|
+
}, [checked]);
|
|
381
|
+
React.useEffect(function () {
|
|
382
|
+
if (column.type === 'check') {
|
|
383
|
+
setItemColumnCheckDisabled(item, column, checkDisabled);
|
|
384
|
+
column.onCheckDisabledChange && column.onCheckDisabledChange(item, checkDisabled);
|
|
385
|
+
}
|
|
386
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
387
|
+
}, [checkDisabled]);
|
|
388
|
+
/********************************************************************************************************************
|
|
389
|
+
* Memo
|
|
390
|
+
* ******************************************************************************************************************/
|
|
391
|
+
var isHidden = React.useMemo(function () { return (column.onHide ? column.onHide(item, index) : false); }, [column, index, item]);
|
|
392
|
+
var buttonsBoxJustifyContent = React.useMemo(function () {
|
|
393
|
+
switch (getTableColumnAlign(column, defaultAlign)) {
|
|
394
|
+
case 'center':
|
|
395
|
+
return 'center';
|
|
396
|
+
case 'right':
|
|
397
|
+
return 'end';
|
|
398
|
+
default:
|
|
399
|
+
return 'start';
|
|
400
|
+
}
|
|
401
|
+
}, [column, defaultAlign]);
|
|
402
|
+
var data = React.useMemo(function () {
|
|
403
|
+
var _a, _b;
|
|
404
|
+
var data;
|
|
405
|
+
if (column.type !== 'check') {
|
|
406
|
+
if (column.onRender) {
|
|
407
|
+
data = column.onRender(item, index);
|
|
408
|
+
}
|
|
409
|
+
else if (column.name) {
|
|
410
|
+
data = item[column.name];
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
data = undefined;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
switch (column.type) {
|
|
417
|
+
case 'number':
|
|
418
|
+
if (typeof data === 'string' || typeof data === 'number') {
|
|
419
|
+
data = util.numberFormat(data);
|
|
420
|
+
}
|
|
421
|
+
if (column.numberPrefix) {
|
|
422
|
+
data = (React.createElement(React.Fragment, null,
|
|
423
|
+
React.createElement("span", { style: { opacity: 0.5, marginRight: 2 } }, column.numberPrefix),
|
|
424
|
+
data));
|
|
425
|
+
}
|
|
426
|
+
if (column.numberSuffix) {
|
|
427
|
+
data = (React.createElement(React.Fragment, null,
|
|
428
|
+
data,
|
|
429
|
+
React.createElement("span", { style: { opacity: 0.5, marginLeft: 2 } }, column.numberSuffix)));
|
|
430
|
+
}
|
|
431
|
+
break;
|
|
432
|
+
case 'tel':
|
|
433
|
+
if (typeof data === 'string') {
|
|
434
|
+
data = util.telNoAutoDash(data);
|
|
435
|
+
}
|
|
436
|
+
break;
|
|
437
|
+
case 'company_no':
|
|
438
|
+
if (typeof data === 'string') {
|
|
439
|
+
data = util.companyNoAutoDash(data);
|
|
440
|
+
}
|
|
441
|
+
break;
|
|
442
|
+
case 'personal_no':
|
|
443
|
+
if (typeof data === 'string') {
|
|
444
|
+
data = util.personalNoAutoDash(data);
|
|
445
|
+
}
|
|
446
|
+
break;
|
|
447
|
+
case 'check':
|
|
448
|
+
data = (React.createElement(material.Box, { className: 'TableBoxyCell-check-box', onClick: menuOpen ? undefined : function (e) { return e.stopPropagation(); } },
|
|
449
|
+
React.createElement(material.Checkbox, { checked: checked, disabled: checkDisabled, onChange: function (e, newChecked) {
|
|
450
|
+
setChecked(newChecked);
|
|
451
|
+
column.onCheckChange && column.onCheckChange(item, newChecked);
|
|
452
|
+
onCheckChange && onCheckChange(item, column, newChecked);
|
|
453
|
+
} })));
|
|
454
|
+
break;
|
|
455
|
+
case 'button':
|
|
456
|
+
data = (React.createElement(material.Box, { className: 'TableBoxyCell-button-box', onClick: menuOpen ? undefined : function (e) { return e.stopPropagation(); } }, data));
|
|
457
|
+
break;
|
|
458
|
+
case 'buttons':
|
|
459
|
+
data = (React.createElement(StyledButtonsBox, { className: 'TableBodyCell-buttons-box', justifyContent: buttonsBoxJustifyContent, onClick: menuOpen ? undefined : function (e) { return e.stopPropagation(); } }, data));
|
|
460
|
+
break;
|
|
461
|
+
case 'img':
|
|
462
|
+
{
|
|
463
|
+
var img = React.createElement("img", { src: data, style: { maxWidth: '100%', verticalAlign: 'middle' }, alt: '' });
|
|
464
|
+
var placement = ((_a = column.tooltipProps) === null || _a === void 0 ? void 0 : _a.placement) ? (_b = column.tooltipProps) === null || _b === void 0 ? void 0 : _b.placement : 'left';
|
|
465
|
+
data = (React.createElement("a", { href: data, target: '_blank', onClick: menuOpen
|
|
466
|
+
? undefined
|
|
467
|
+
: function (e) {
|
|
468
|
+
e.stopPropagation();
|
|
469
|
+
} },
|
|
470
|
+
React.createElement(material.Tooltip, __assign({ className: 'TableBodyCell-tooltip', title: React.createElement("div", { style: { paddingTop: 3, paddingBottom: 3 } }, img) }, column.tooltipProps, { placement: placement }), img)));
|
|
471
|
+
}
|
|
472
|
+
break;
|
|
473
|
+
case 'date':
|
|
474
|
+
if (data) {
|
|
475
|
+
data = dayjs(data, column.dateFormat).format('YYYY-MM-DD');
|
|
476
|
+
}
|
|
477
|
+
break;
|
|
478
|
+
case 'datetime':
|
|
479
|
+
if (data) {
|
|
480
|
+
var dt = dayjs(data, column.dateFormat);
|
|
481
|
+
data = (React.createElement(React.Fragment, null,
|
|
482
|
+
React.createElement("span", null, dt.format('YYYY-MM-DD')),
|
|
483
|
+
column.dateTwoLine ? React.createElement("br", null) : ' ',
|
|
484
|
+
React.createElement("span", { style: { opacity: 0.5 } }, dt.format('HH:mm:ss'))));
|
|
485
|
+
}
|
|
486
|
+
break;
|
|
487
|
+
case 'date-hour':
|
|
488
|
+
if (data) {
|
|
489
|
+
var dt = dayjs(data, column.dateFormat);
|
|
490
|
+
data = (React.createElement(React.Fragment, null,
|
|
491
|
+
React.createElement("span", null, dt.format('YYYY-MM-DD')),
|
|
492
|
+
column.dateTwoLine ? React.createElement("br", null) : ' ',
|
|
493
|
+
React.createElement("span", { style: { opacity: 0.5 } }, dt.format('HH시'))));
|
|
494
|
+
}
|
|
495
|
+
break;
|
|
496
|
+
case 'date-minute':
|
|
497
|
+
if (data) {
|
|
498
|
+
var dt = dayjs(data, column.dateFormat);
|
|
499
|
+
data = (React.createElement(React.Fragment, null,
|
|
500
|
+
React.createElement("span", null, dt.format('YYYY-MM-DD')),
|
|
501
|
+
column.dateTwoLine ? React.createElement("br", null) : ' ',
|
|
502
|
+
React.createElement("span", { style: { opacity: 0.5 } }, dt.format('HH시 MM분'))));
|
|
503
|
+
}
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
if (column.type !== 'img') {
|
|
507
|
+
var tooltip = void 0;
|
|
508
|
+
if (column.onGetTooltip) {
|
|
509
|
+
tooltip = column.onGetTooltip(item, index);
|
|
510
|
+
}
|
|
511
|
+
if (tooltip) {
|
|
512
|
+
data = (React.createElement(material.Tooltip, __assign({ className: 'TableBodyCell-tooltip', title: tooltip }, column.tooltipProps), React.isValidElement(data) ? (data.type === React.Fragment ? (React.createElement("span", null, data)) : (data)) : (React.createElement("span", null, data))));
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
return data;
|
|
516
|
+
}, [column, item, index, menuOpen, checked, checkDisabled, buttonsBoxJustifyContent, onCheckChange]);
|
|
517
|
+
/********************************************************************************************************************
|
|
518
|
+
* Event Handler
|
|
519
|
+
* ******************************************************************************************************************/
|
|
520
|
+
var handleClick = React.useCallback(function (item, index) {
|
|
521
|
+
if (column.onClick) {
|
|
522
|
+
column.onClick(item, index);
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
if (onClick)
|
|
526
|
+
onClick(item, index);
|
|
527
|
+
}
|
|
528
|
+
}, [column, onClick]);
|
|
529
|
+
/********************************************************************************************************************
|
|
530
|
+
* Render
|
|
531
|
+
* ******************************************************************************************************************/
|
|
532
|
+
return (React.createElement(TableCommonCell, { type: 'body', className: classNames('TableBodyCell', className), style: style, sx: sx, column: column, defaultAlign: defaultAlign, defaultEllipsis: defaultEllipsis, item: item, index: index, onClick: column.onClick || onClick ? handleClick : undefined }, !isHidden && data));
|
|
533
|
+
};
|
|
534
|
+
var templateObject_1$2;var StyledBodyRow = material.styled(material.TableRow)(function (_a) {
|
|
535
|
+
var theme = _a.theme;
|
|
536
|
+
return ({
|
|
537
|
+
'&.odd-color:nth-of-type(odd):not(:hover)': {
|
|
538
|
+
backgroundColor: material.lighten(theme.palette.action.hover, 0.4),
|
|
539
|
+
},
|
|
540
|
+
'&.even-color:nth-of-type(even):not(:hover)': {
|
|
541
|
+
backgroundColor: material.lighten(theme.palette.action.hover, 0.4),
|
|
542
|
+
},
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
var TableBodyRow = function (_a) {
|
|
546
|
+
/********************************************************************************************************************
|
|
547
|
+
* Use
|
|
548
|
+
* ******************************************************************************************************************/
|
|
549
|
+
var className = _a.className, style = _a.style, id = _a.id, index = _a.index, defaultAlign = _a.defaultAlign, defaultEllipsis = _a.defaultEllipsis, sortable$1 = _a.sortable, columns = _a.columns, item = _a.item, onClick = _a.onClick, onCheckChange = _a.onCheckChange, onGetColumnClassName = _a.onGetColumnClassName, onGetColumnStyle = _a.onGetColumnStyle, onGetColumnSx = _a.onGetColumnSx, props = __rest(_a, ["className", "style", "id", "index", "defaultAlign", "defaultEllipsis", "sortable", "columns", "item", "onClick", "onCheckChange", "onGetColumnClassName", "onGetColumnStyle", "onGetColumnSx"]);
|
|
550
|
+
var _b = sortable.useSortable({ id: id }), attributes = _b.attributes, listeners = _b.listeners, setNodeRef = _b.setNodeRef, transform = _b.transform, transition = _b.transition;
|
|
551
|
+
/********************************************************************************************************************
|
|
552
|
+
* Variable
|
|
553
|
+
* ******************************************************************************************************************/
|
|
554
|
+
var sortableProps = sortable$1
|
|
555
|
+
? __assign(__assign({ ref: setNodeRef }, attributes), listeners) : {};
|
|
556
|
+
/********************************************************************************************************************
|
|
557
|
+
* Render
|
|
558
|
+
* ******************************************************************************************************************/
|
|
559
|
+
return (React.createElement(StyledBodyRow, __assign({ className: classNames('TableBodyRow', className), style: sortable$1
|
|
560
|
+
? __assign(__assign({}, style), { transform: CSS.Transform.toString(transform), transition: transition }) : style }, props, sortableProps), columns.map(function (column, columnIdx) { return (React.createElement(TableBodyCell, { className: onGetColumnClassName ? onGetColumnClassName(column, item, index) : undefined, sx: onGetColumnSx ? onGetColumnSx(column, item, index) : undefined, style: onGetColumnStyle ? onGetColumnStyle(column, item, index) : undefined, key: columnIdx, index: index, item: item, defaultAlign: defaultAlign, defaultEllipsis: defaultEllipsis, column: column, onClick: onClick, onCheckChange: onCheckChange })); })));
|
|
561
|
+
};var TableFooterCell = function (_a) {
|
|
562
|
+
/********************************************************************************************************************
|
|
563
|
+
* Memo
|
|
564
|
+
* ******************************************************************************************************************/
|
|
565
|
+
var column = _a.column, defaultAlign = _a.defaultAlign;
|
|
566
|
+
var data = React.useMemo(function () {
|
|
567
|
+
var _a, _b, _c;
|
|
568
|
+
if ((_a = column.footer) === null || _a === void 0 ? void 0 : _a.onRender) {
|
|
569
|
+
return (_b = column.footer) === null || _b === void 0 ? void 0 : _b.onRender();
|
|
570
|
+
}
|
|
571
|
+
else {
|
|
572
|
+
return (_c = column.footer) === null || _c === void 0 ? void 0 : _c.value;
|
|
573
|
+
}
|
|
574
|
+
}, [column]);
|
|
575
|
+
/********************************************************************************************************************
|
|
576
|
+
* Render
|
|
577
|
+
* ******************************************************************************************************************/
|
|
578
|
+
return (React.createElement(TableCommonCell, { type: 'head', className: 'TableFooterCell', column: column, defaultAlign: defaultAlign }, data));
|
|
579
|
+
};var TablePagination = function (_a) {
|
|
580
|
+
var className = _a.className, style = _a.style, sx = _a.sx, paging = _a.paging, align = _a.align, onChange = _a.onChange;
|
|
581
|
+
return (React.createElement(material.Stack, { alignItems: align },
|
|
582
|
+
React.createElement(material.Pagination, { count: paging.last_page, page: paging.current_page, color: 'primary', className: classNames('TablePagination', className), style: style, sx: sx, onChange: function (e, page) {
|
|
583
|
+
if (onChange)
|
|
584
|
+
onChange(page);
|
|
585
|
+
} })));
|
|
586
|
+
};var TableContextProvider = function (_a) {
|
|
587
|
+
var children = _a.children, value = _a.value;
|
|
588
|
+
return React.createElement(TableContext.Provider, { value: value }, children);
|
|
589
|
+
};var TableTopHeadCaptionRow = material.styled(material.TableRow)(function (_a) {
|
|
590
|
+
var theme = _a.theme;
|
|
591
|
+
return ({
|
|
592
|
+
'> th': {
|
|
593
|
+
backgroundColor: theme.palette.grey.A100,
|
|
594
|
+
textAlign: 'center',
|
|
595
|
+
fontWeight: 700,
|
|
596
|
+
},
|
|
597
|
+
});
|
|
598
|
+
});var TableHeadCell = function (_a) {
|
|
599
|
+
/********************************************************************************************************************
|
|
600
|
+
* Use
|
|
601
|
+
* ******************************************************************************************************************/
|
|
602
|
+
var column = _a.column, defaultAlign = _a.defaultAlign, top = _a.top, onCheckChange = _a.onCheckChange;
|
|
603
|
+
var _b = useTableState(), setHeadColumnChecked = _b.setHeadColumnChecked, setHeadColumnCommands = _b.setHeadColumnCommands;
|
|
604
|
+
/********************************************************************************************************************
|
|
605
|
+
* State
|
|
606
|
+
* ******************************************************************************************************************/
|
|
607
|
+
var _c = React.useState(false), checked = _c[0], setChecked = _c[1];
|
|
608
|
+
var _d = React.useState(false), checkDisabled = _d[0], setCheckDisabled = _d[1];
|
|
609
|
+
/********************************************************************************************************************
|
|
610
|
+
* Effect
|
|
611
|
+
* ******************************************************************************************************************/
|
|
612
|
+
React.useEffect(function () {
|
|
613
|
+
if (column.type === 'check') {
|
|
614
|
+
setHeadColumnChecked(column, checked);
|
|
615
|
+
}
|
|
616
|
+
}, [column, checked, setHeadColumnChecked]);
|
|
617
|
+
React.useEffect(function () {
|
|
618
|
+
setHeadColumnCommands(column, {
|
|
619
|
+
setChecked: function (checked) {
|
|
620
|
+
if (column.type === 'check') {
|
|
621
|
+
setChecked(checked);
|
|
622
|
+
}
|
|
623
|
+
},
|
|
624
|
+
setCheckDisabled: function (checkDisabled) {
|
|
625
|
+
if (column.type === 'check') {
|
|
626
|
+
setCheckDisabled(checkDisabled);
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
});
|
|
630
|
+
}, [setHeadColumnCommands, column]);
|
|
631
|
+
/********************************************************************************************************************
|
|
632
|
+
* Memo
|
|
633
|
+
* ******************************************************************************************************************/
|
|
634
|
+
var data = React.useMemo(function () {
|
|
635
|
+
var _a, _b;
|
|
636
|
+
if (column.type === 'check') {
|
|
637
|
+
return column.hideAllCheck ? null : (React.createElement(material.Checkbox, { checked: checked, disabled: checkDisabled, onChange: function (e, newChecked) {
|
|
638
|
+
setChecked(newChecked);
|
|
639
|
+
onCheckChange && onCheckChange(column, newChecked);
|
|
640
|
+
} }));
|
|
641
|
+
}
|
|
642
|
+
else {
|
|
643
|
+
if ((_a = column.head) === null || _a === void 0 ? void 0 : _a.onRender) {
|
|
644
|
+
return (_b = column.head) === null || _b === void 0 ? void 0 : _b.onRender();
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
if (typeof column.label === 'string') {
|
|
648
|
+
return React.createElement("div", { dangerouslySetInnerHTML: { __html: column.label } });
|
|
649
|
+
}
|
|
650
|
+
else {
|
|
651
|
+
return column.label;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}, [checkDisabled, checked, column, onCheckChange]);
|
|
656
|
+
/********************************************************************************************************************
|
|
657
|
+
* Render
|
|
658
|
+
* ******************************************************************************************************************/
|
|
659
|
+
return (React.createElement(TableCommonCell, { type: 'head', className: 'TableHeadCell', style: top !== undefined ? { top: top } : undefined, column: column, defaultAlign: defaultAlign }, data));
|
|
660
|
+
};var BottomLine = material.styled('div')(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n height: 1px;\n position: absolute;\n left: 3px;\n right: 3px;\n bottom: 0;\n"], ["\n height: 1px;\n position: absolute;\n left: 3px;\n right: 3px;\n bottom: 0;\n"])));
|
|
661
|
+
var TableTopHead = function (_a) {
|
|
662
|
+
/********************************************************************************************************************
|
|
663
|
+
* Use
|
|
664
|
+
* ******************************************************************************************************************/
|
|
665
|
+
var columns = _a.columns, rows = _a.rows, caption = _a.caption, defaultAlign = _a.defaultAlign, onCheckChange = _a.onCheckChange;
|
|
666
|
+
var theme = material.useTheme();
|
|
667
|
+
/********************************************************************************************************************
|
|
668
|
+
* Ref
|
|
669
|
+
* ******************************************************************************************************************/
|
|
670
|
+
var captionRef = React.useRef(null);
|
|
671
|
+
var row1Ref = React.useRef(null);
|
|
672
|
+
var row2Ref = React.useRef(null);
|
|
673
|
+
var row3Ref = React.useRef(null);
|
|
674
|
+
/********************************************************************************************************************
|
|
675
|
+
* ResizeDetector
|
|
676
|
+
* ******************************************************************************************************************/
|
|
677
|
+
var captionHeight = reactResizeDetector.useResizeDetector({
|
|
678
|
+
targetRef: captionRef,
|
|
679
|
+
handleWidth: false,
|
|
680
|
+
handleHeight: true,
|
|
681
|
+
}).height;
|
|
682
|
+
var row1Height = reactResizeDetector.useResizeDetector({ targetRef: row1Ref, handleWidth: false, handleHeight: true }).height;
|
|
683
|
+
var row2Height = reactResizeDetector.useResizeDetector({ targetRef: row2Ref, handleWidth: false, handleHeight: true }).height;
|
|
684
|
+
var row3Height = reactResizeDetector.useResizeDetector({ targetRef: row3Ref, handleWidth: false, handleHeight: true }).height;
|
|
685
|
+
/********************************************************************************************************************
|
|
686
|
+
* Function
|
|
687
|
+
* ******************************************************************************************************************/
|
|
688
|
+
var makeRowCells = React.useCallback(function (row, top) {
|
|
689
|
+
var totalColumns = 0;
|
|
690
|
+
var cells = row
|
|
691
|
+
.map(function (info, idx) {
|
|
692
|
+
if (info) {
|
|
693
|
+
totalColumns += info.colSpan || 1;
|
|
694
|
+
return (React.createElement(material.TableCell, { key: idx, colSpan: info.colSpan, align: info.align, style: {
|
|
695
|
+
top: top,
|
|
696
|
+
borderBottom: 0,
|
|
697
|
+
} },
|
|
698
|
+
info.label,
|
|
699
|
+
info.label != null && React.createElement(BottomLine, { style: { backgroundColor: theme.palette.divider } })));
|
|
700
|
+
}
|
|
701
|
+
})
|
|
702
|
+
.filter(function (cell) { return !!cell; });
|
|
703
|
+
if (totalColumns < columns.length) {
|
|
704
|
+
cells.push(React.createElement(material.TableCell, { key: columns.length, colSpan: columns.length - cells.length, style: { top: top, borderBottom: 0 } }));
|
|
705
|
+
}
|
|
706
|
+
return cells;
|
|
707
|
+
}, [columns, theme.palette.divider]);
|
|
708
|
+
var columnRow = React.useMemo(function () {
|
|
709
|
+
var top = (captionHeight || 0) + (row1Height || 0) + (row2Height || 0) + (row3Height || 0);
|
|
710
|
+
return (React.createElement(material.TableRow, null, columns.map(function (column, idx) { return (React.createElement(TableHeadCell, { key: idx, column: column, defaultAlign: defaultAlign, top: top, onCheckChange: onCheckChange })); })));
|
|
711
|
+
}, [captionHeight, columns, defaultAlign, onCheckChange, row1Height, row2Height, row3Height]);
|
|
712
|
+
/********************************************************************************************************************
|
|
713
|
+
* Variable
|
|
714
|
+
* ******************************************************************************************************************/
|
|
715
|
+
var captionRow = !!caption && (React.createElement(TableTopHeadCaptionRow, { ref: captionRef, className: 'TableTopHeadCaptionRow' },
|
|
716
|
+
React.createElement(material.TableCell, { colSpan: columns.length }, caption)));
|
|
717
|
+
/********************************************************************************************************************
|
|
718
|
+
* Render
|
|
719
|
+
* ******************************************************************************************************************/
|
|
720
|
+
if (rows) {
|
|
721
|
+
if (Array.isArray(rows[0])) {
|
|
722
|
+
return (React.createElement(material.TableHead, { className: 'TableHead' },
|
|
723
|
+
captionRow,
|
|
724
|
+
rows.map(function (row, idx) {
|
|
725
|
+
var ref = undefined;
|
|
726
|
+
var top = undefined;
|
|
727
|
+
switch (idx) {
|
|
728
|
+
case 0:
|
|
729
|
+
ref = row1Ref;
|
|
730
|
+
top = captionHeight;
|
|
731
|
+
break;
|
|
732
|
+
case 1:
|
|
733
|
+
ref = row2Ref;
|
|
734
|
+
top = (captionHeight || 0) + (row1Height || 0);
|
|
735
|
+
break;
|
|
736
|
+
case 2:
|
|
737
|
+
ref = row3Ref;
|
|
738
|
+
top = (captionHeight || 0) + (row1Height || 0) + (row2Height || 0);
|
|
739
|
+
break;
|
|
740
|
+
case 3:
|
|
741
|
+
top = (captionHeight || 0) + (row1Height || 0) + (row2Height || 0) + (row3Height || 0);
|
|
742
|
+
}
|
|
743
|
+
return (React.createElement(material.TableRow, { key: idx, ref: ref, className: 'TableHeadRow' }, makeRowCells(row, top)));
|
|
744
|
+
})));
|
|
745
|
+
}
|
|
746
|
+
else {
|
|
747
|
+
return (React.createElement(material.TableHead, { className: 'TableHead' },
|
|
748
|
+
captionRow,
|
|
749
|
+
React.createElement(material.TableRow, { ref: row1Ref, className: 'TableHeadRow' }, makeRowCells(rows, captionHeight)),
|
|
750
|
+
columnRow));
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
else {
|
|
754
|
+
return (React.createElement(material.TableHead, { className: 'TableHead' },
|
|
755
|
+
captionRow,
|
|
756
|
+
columnRow));
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
var templateObject_1$1;var makeSortableItems = function (items) {
|
|
760
|
+
return items === null || items === void 0 ? void 0 : items.map(function (_a, index) {
|
|
761
|
+
var id = _a.id, item = __rest(_a, ["id"]);
|
|
762
|
+
return __assign({ id: id == null ? "".concat(uuid.v4(), "_").concat(index) : id }, item);
|
|
763
|
+
});
|
|
764
|
+
};function columnFilter(v) {
|
|
765
|
+
return v !== undefined && v !== null && v !== false;
|
|
766
|
+
}
|
|
767
|
+
var _columnId = 0;
|
|
768
|
+
var Table = React.forwardRef(function (_a, ref) {
|
|
769
|
+
/********************************************************************************************************************
|
|
770
|
+
* Ref
|
|
771
|
+
* ******************************************************************************************************************/
|
|
772
|
+
var className = _a.className, initStyle = _a.style, sx = _a.sx, caption = _a.caption, topHeadRows = _a.topHeadRows, initColumns = _a.columns, initItems = _a.items, initPaging = _a.paging, _b = _a.pagingAlign, pagingAlign = _b === void 0 ? 'center' : _b, _c = _a.defaultAlign, defaultAlign = _c === void 0 ? 'left' : _c, defaultEllipsis = _a.defaultEllipsis, initStickyHeader = _a.stickyHeader, height = _a.height, minHeight = _a.minHeight, maxHeight = _a.maxHeight, fullHeight = _a.fullHeight, showOddColor = _a.showOddColor, showEvenColor = _a.showEvenColor, _d = _a.cellPadding, cellPadding = _d === void 0 ? 13 : _d, footer = _a.footer, noData = _a.noData, pagination = _a.pagination, sortable$1 = _a.sortable, onClick = _a.onClick, onGetBodyRowClassName = _a.onGetBodyRowClassName, onGetBodyRowStyle = _a.onGetBodyRowStyle, onGetBodyRowSx = _a.onGetBodyRowSx, onGetBodyColumnClassName = _a.onGetBodyColumnClassName, onGetBodyColumnStyle = _a.onGetBodyColumnStyle, onGetBodyColumnSx = _a.onGetBodyColumnSx, onPageChange = _a.onPageChange, onSortChange = _a.onSortChange, onCheckChange = _a.onCheckChange;
|
|
773
|
+
var localHeaderDataRef = React.useRef({});
|
|
774
|
+
var localBodyDataRef = React.useRef({});
|
|
775
|
+
var updateHeadCheckTimer = React.useRef();
|
|
776
|
+
var fireOnCheckChangeTimer = React.useRef({});
|
|
777
|
+
var simpleBarRef = React.useRef(null);
|
|
778
|
+
var finalColumnsIdRef = React.useRef([]);
|
|
779
|
+
/********************************************************************************************************************
|
|
780
|
+
* sortable
|
|
781
|
+
* ******************************************************************************************************************/
|
|
782
|
+
var sensors = core.useSensors(core.useSensor(core.MouseSensor, {
|
|
783
|
+
// Require the mouse to move by 10 pixels before activating
|
|
784
|
+
activationConstraint: {
|
|
785
|
+
distance: 10,
|
|
786
|
+
},
|
|
787
|
+
}), core.useSensor(core.TouchSensor, {
|
|
788
|
+
// Press delay of 250ms, with tolerance of 5px of movement
|
|
789
|
+
activationConstraint: {
|
|
790
|
+
delay: 250,
|
|
791
|
+
tolerance: 5,
|
|
792
|
+
},
|
|
793
|
+
}), core.useSensor(core.KeyboardSensor, {
|
|
794
|
+
coordinateGetter: sortable.sortableKeyboardCoordinates,
|
|
795
|
+
}));
|
|
796
|
+
/********************************************************************************************************************
|
|
797
|
+
* State
|
|
798
|
+
* ******************************************************************************************************************/
|
|
799
|
+
var _e = React.useState(false), menuOpen = _e[0], setMenuOpen = _e[1];
|
|
800
|
+
var _f = React.useState(undefined), openMenuId = _f[0], setOpenMenuId = _f[1];
|
|
801
|
+
var _g = reactHook.useAutoUpdateLayoutState(initColumns), columns = _g[0], setColumns = _g[1];
|
|
802
|
+
var _h = React.useState(), finalColumns = _h[0], setFinalColumns = _h[1];
|
|
803
|
+
var _j = reactHook.useAutoUpdateLayoutState(initItems), items = _j[0], setItems = _j[1];
|
|
804
|
+
var _k = React.useState(), sortableItems = _k[0], setSortableItems = _k[1];
|
|
805
|
+
var _l = reactHook.useAutoUpdateLayoutState(initPaging), paging = _l[0], setPaging = _l[1];
|
|
806
|
+
/********************************************************************************************************************
|
|
807
|
+
* containerHeight
|
|
808
|
+
* ******************************************************************************************************************/
|
|
809
|
+
var _m = React.useState(), containerHeight = _m[0], setContainerHeight = _m[1];
|
|
810
|
+
var containerHeightDetector = reactResizeDetector.useResizeDetector({
|
|
811
|
+
handleHeight: true,
|
|
812
|
+
handleWidth: false,
|
|
813
|
+
onResize: function () {
|
|
814
|
+
if (containerHeightDetector.current) {
|
|
815
|
+
setContainerHeight(containerHeightDetector.current.getBoundingClientRect().height);
|
|
816
|
+
}
|
|
817
|
+
else {
|
|
818
|
+
setContainerHeight(undefined);
|
|
819
|
+
}
|
|
820
|
+
},
|
|
821
|
+
}).ref;
|
|
822
|
+
/********************************************************************************************************************
|
|
823
|
+
* footerHeight
|
|
824
|
+
* ******************************************************************************************************************/
|
|
825
|
+
var _o = React.useState(), pagingHeight = _o[0], setPagingHeight = _o[1];
|
|
826
|
+
var pagingHeightResizeDetector = reactResizeDetector.useResizeDetector({
|
|
827
|
+
handleHeight: true,
|
|
828
|
+
handleWidth: false,
|
|
829
|
+
onResize: function () {
|
|
830
|
+
if (pagingHeightResizeDetector.current) {
|
|
831
|
+
setPagingHeight(pagingHeightResizeDetector.current.getBoundingClientRect().height);
|
|
832
|
+
}
|
|
833
|
+
else {
|
|
834
|
+
setPagingHeight(undefined);
|
|
835
|
+
}
|
|
836
|
+
},
|
|
837
|
+
}).ref;
|
|
838
|
+
/********************************************************************************************************************
|
|
839
|
+
* Memo
|
|
840
|
+
* ******************************************************************************************************************/
|
|
841
|
+
var tableSx = React.useMemo(function () {
|
|
842
|
+
var sx = {
|
|
843
|
+
padding: typeof cellPadding === 'number' ? "".concat(cellPadding, "px") : cellPadding,
|
|
844
|
+
};
|
|
845
|
+
return {
|
|
846
|
+
'> .MuiTableHead-root > .MuiTableRow-root > .MuiTableCell-root ': sx,
|
|
847
|
+
'> .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root ': sx,
|
|
848
|
+
'> .MuiTableFooter-root > .MuiTableRow-root > .MuiTableCell-root ': sx,
|
|
849
|
+
};
|
|
850
|
+
}, [cellPadding]);
|
|
851
|
+
/********************************************************************************************************************
|
|
852
|
+
* Function
|
|
853
|
+
* ******************************************************************************************************************/
|
|
854
|
+
var getFinalColumnId = React.useCallback(function (column) {
|
|
855
|
+
if (finalColumns && finalColumnsIdRef.current) {
|
|
856
|
+
var idx = finalColumns.indexOf(column);
|
|
857
|
+
return finalColumnsIdRef.current[idx];
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
return '';
|
|
861
|
+
}
|
|
862
|
+
}, [finalColumns]);
|
|
863
|
+
var updateHeadCheck = React.useCallback(function (column) {
|
|
864
|
+
if (updateHeadCheckTimer.current) {
|
|
865
|
+
clearTimeout(updateHeadCheckTimer.current);
|
|
866
|
+
updateHeadCheckTimer.current = undefined;
|
|
867
|
+
}
|
|
868
|
+
var columnId = getFinalColumnId(column);
|
|
869
|
+
var headColumnData = localHeaderDataRef.current[columnId];
|
|
870
|
+
if (headColumnData) {
|
|
871
|
+
updateHeadCheckTimer.current = setTimeout(function () {
|
|
872
|
+
var _a, _b;
|
|
873
|
+
updateHeadCheckTimer.current = undefined;
|
|
874
|
+
var enabledCheckExists = !!Object.keys(localBodyDataRef.current).find(function (key) {
|
|
875
|
+
var columnData = localBodyDataRef.current[key].columns[columnId];
|
|
876
|
+
if (columnData) {
|
|
877
|
+
if (!columnData.checkDisabled) {
|
|
878
|
+
return true;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
var allChecked = enabledCheckExists &&
|
|
883
|
+
!Object.keys(localBodyDataRef.current).find(function (key) {
|
|
884
|
+
var columnData = localBodyDataRef.current[key].columns[columnId];
|
|
885
|
+
if (columnData) {
|
|
886
|
+
if (!columnData.checkDisabled) {
|
|
887
|
+
return !columnData.checked;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
});
|
|
891
|
+
(_a = headColumnData.commands) === null || _a === void 0 ? void 0 : _a.setCheckDisabled(!enabledCheckExists);
|
|
892
|
+
(_b = headColumnData.commands) === null || _b === void 0 ? void 0 : _b.setChecked(allChecked);
|
|
893
|
+
}, 100);
|
|
894
|
+
}
|
|
895
|
+
}, [getFinalColumnId]);
|
|
896
|
+
var getCheckedItems = React.useCallback(function (columnId) {
|
|
897
|
+
var checkedItems = [];
|
|
898
|
+
Object.keys(localBodyDataRef.current).forEach(function (key) {
|
|
899
|
+
var itemData = localBodyDataRef.current[key];
|
|
900
|
+
var columnData = itemData.columns[columnId];
|
|
901
|
+
if (columnData) {
|
|
902
|
+
if (columnData.checked) {
|
|
903
|
+
checkedItems.push(itemData.item);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
return checkedItems;
|
|
908
|
+
}, []);
|
|
909
|
+
var stopHeadCheckTimer = React.useCallback(function () {
|
|
910
|
+
if (updateHeadCheckTimer.current) {
|
|
911
|
+
clearTimeout(updateHeadCheckTimer.current);
|
|
912
|
+
updateHeadCheckTimer.current = undefined;
|
|
913
|
+
}
|
|
914
|
+
}, []);
|
|
915
|
+
var clearFireOnCheckChangeTimer = React.useCallback(function () {
|
|
916
|
+
Object.keys(fireOnCheckChangeTimer.current).forEach(function (key) {
|
|
917
|
+
if (fireOnCheckChangeTimer.current[key]) {
|
|
918
|
+
clearTimeout(fireOnCheckChangeTimer.current[key]);
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
fireOnCheckChangeTimer.current = {};
|
|
922
|
+
}, []);
|
|
923
|
+
var fireOnCheckChange = React.useCallback(function (columnId) {
|
|
924
|
+
if (fireOnCheckChangeTimer.current[columnId]) {
|
|
925
|
+
clearTimeout(fireOnCheckChangeTimer.current[columnId]);
|
|
926
|
+
fireOnCheckChangeTimer.current[columnId] = undefined;
|
|
927
|
+
}
|
|
928
|
+
if (onCheckChange) {
|
|
929
|
+
fireOnCheckChangeTimer.current[columnId] = setTimeout(function () {
|
|
930
|
+
fireOnCheckChangeTimer.current[columnId] = undefined;
|
|
931
|
+
onCheckChange && onCheckChange(columnId, getCheckedItems(columnId));
|
|
932
|
+
}, 100);
|
|
933
|
+
}
|
|
934
|
+
}, [getCheckedItems, onCheckChange]);
|
|
935
|
+
var simpleBarScrollToTop = React.useCallback(function () {
|
|
936
|
+
var _a, _b;
|
|
937
|
+
(_b = (_a = simpleBarRef.current) === null || _a === void 0 ? void 0 : _a.getScrollElement()) === null || _b === void 0 ? void 0 : _b.scrollTo({ top: 0 });
|
|
938
|
+
}, []);
|
|
939
|
+
/********************************************************************************************************************
|
|
940
|
+
* Effect
|
|
941
|
+
* ******************************************************************************************************************/
|
|
942
|
+
React.useEffect(function () {
|
|
943
|
+
return function () {
|
|
944
|
+
stopHeadCheckTimer();
|
|
945
|
+
clearFireOnCheckChangeTimer();
|
|
946
|
+
};
|
|
947
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
948
|
+
}, []);
|
|
949
|
+
React.useEffect(function () {
|
|
950
|
+
stopHeadCheckTimer();
|
|
951
|
+
clearFireOnCheckChangeTimer();
|
|
952
|
+
Object.keys(localHeaderDataRef.current).forEach(function (key) {
|
|
953
|
+
var _a;
|
|
954
|
+
if (localHeaderDataRef.current[key].column.type === 'check') {
|
|
955
|
+
(_a = localHeaderDataRef.current[key].commands) === null || _a === void 0 ? void 0 : _a.setChecked(false);
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
Object.keys(localBodyDataRef.current).forEach(function (key) {
|
|
959
|
+
Object.keys(localBodyDataRef.current[key].columns).forEach(function (cKey) {
|
|
960
|
+
var _a;
|
|
961
|
+
(_a = localBodyDataRef.current[key].columns[cKey].commands) === null || _a === void 0 ? void 0 : _a.setChecked(false);
|
|
962
|
+
});
|
|
963
|
+
});
|
|
964
|
+
setSortableItems(makeSortableItems(items));
|
|
965
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
966
|
+
}, [items]);
|
|
967
|
+
React.useEffect(function () {
|
|
968
|
+
stopHeadCheckTimer();
|
|
969
|
+
clearFireOnCheckChangeTimer();
|
|
970
|
+
var newFinalColumns = columns === null || columns === void 0 ? void 0 : columns.filter(columnFilter);
|
|
971
|
+
setFinalColumns(newFinalColumns);
|
|
972
|
+
finalColumnsIdRef.current = newFinalColumns === null || newFinalColumns === void 0 ? void 0 : newFinalColumns.map(function (col) {
|
|
973
|
+
if (col.id) {
|
|
974
|
+
return col.id;
|
|
975
|
+
}
|
|
976
|
+
else {
|
|
977
|
+
_columnId += 1;
|
|
978
|
+
return "$c$".concat(_columnId, "$");
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
982
|
+
}, [columns]);
|
|
983
|
+
React.useLayoutEffect(function () {
|
|
984
|
+
clearFireOnCheckChangeTimer();
|
|
985
|
+
if (sortableItems) {
|
|
986
|
+
localBodyDataRef.current = sortableItems.reduce(function (res, item) {
|
|
987
|
+
res[item.id] = {
|
|
988
|
+
item: item,
|
|
989
|
+
columns: {},
|
|
990
|
+
};
|
|
991
|
+
if (finalColumns) {
|
|
992
|
+
finalColumns.forEach(function (c) {
|
|
993
|
+
var _a;
|
|
994
|
+
var columnId = getFinalColumnId(c);
|
|
995
|
+
if ((_a = localBodyDataRef.current[item.id]) === null || _a === void 0 ? void 0 : _a.columns[columnId]) {
|
|
996
|
+
res[item.id].columns[columnId] = localBodyDataRef.current[item.id].columns[columnId];
|
|
997
|
+
}
|
|
998
|
+
else {
|
|
999
|
+
res[item.id].columns[columnId] = {
|
|
1000
|
+
column: c,
|
|
1001
|
+
checked: false,
|
|
1002
|
+
checkDisabled: false,
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
return res;
|
|
1008
|
+
}, {});
|
|
1009
|
+
}
|
|
1010
|
+
else {
|
|
1011
|
+
localBodyDataRef.current = {};
|
|
1012
|
+
}
|
|
1013
|
+
}, [sortableItems, finalColumns, clearFireOnCheckChangeTimer, getFinalColumnId]);
|
|
1014
|
+
React.useLayoutEffect(function () {
|
|
1015
|
+
if (finalColumns) {
|
|
1016
|
+
localHeaderDataRef.current = finalColumns.reduce(function (res, c) {
|
|
1017
|
+
res[getFinalColumnId(c)] = { column: c, checked: false };
|
|
1018
|
+
return res;
|
|
1019
|
+
}, {});
|
|
1020
|
+
}
|
|
1021
|
+
else {
|
|
1022
|
+
localHeaderDataRef.current = {};
|
|
1023
|
+
}
|
|
1024
|
+
}, [finalColumns, getFinalColumnId]);
|
|
1025
|
+
/********************************************************************************************************************
|
|
1026
|
+
* Commands
|
|
1027
|
+
* ******************************************************************************************************************/
|
|
1028
|
+
React.useLayoutEffect(function () {
|
|
1029
|
+
if (ref) {
|
|
1030
|
+
var lastColumns_1 = columns;
|
|
1031
|
+
var lastItems_1 = items;
|
|
1032
|
+
var lastPaging_1 = paging;
|
|
1033
|
+
var commands = {
|
|
1034
|
+
getColumns: function () { return lastColumns_1; },
|
|
1035
|
+
setColumns: function (columns) {
|
|
1036
|
+
lastColumns_1 = columns;
|
|
1037
|
+
setColumns(lastColumns_1);
|
|
1038
|
+
},
|
|
1039
|
+
getItems: function () { return lastItems_1; },
|
|
1040
|
+
setItems: function (items) {
|
|
1041
|
+
lastItems_1 = items;
|
|
1042
|
+
setItems(items);
|
|
1043
|
+
},
|
|
1044
|
+
getPaging: function () { return lastPaging_1; },
|
|
1045
|
+
setItemsPaging: function (items, paging) {
|
|
1046
|
+
lastItems_1 = items;
|
|
1047
|
+
lastPaging_1 = paging;
|
|
1048
|
+
setItems(lastItems_1);
|
|
1049
|
+
setPaging(lastPaging_1);
|
|
1050
|
+
},
|
|
1051
|
+
resetSort: function () {
|
|
1052
|
+
setSortableItems(makeSortableItems(lastItems_1));
|
|
1053
|
+
},
|
|
1054
|
+
getCheckedItems: getCheckedItems,
|
|
1055
|
+
scrollToTop: simpleBarScrollToTop,
|
|
1056
|
+
};
|
|
1057
|
+
if (typeof ref === 'function') {
|
|
1058
|
+
ref(commands);
|
|
1059
|
+
}
|
|
1060
|
+
else {
|
|
1061
|
+
ref.current = commands;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}, [ref, columns, items, paging, setColumns, setItems, setPaging, getCheckedItems, simpleBarScrollToTop]);
|
|
1065
|
+
/********************************************************************************************************************
|
|
1066
|
+
* Event Handler
|
|
1067
|
+
* ******************************************************************************************************************/
|
|
1068
|
+
var handleDragEnd = React.useCallback(function (event) {
|
|
1069
|
+
var active = event.active, over = event.over;
|
|
1070
|
+
if (active && over) {
|
|
1071
|
+
setSortableItems(function (items) {
|
|
1072
|
+
if (items) {
|
|
1073
|
+
var oldIndex_1 = null;
|
|
1074
|
+
var newIndex_1 = null;
|
|
1075
|
+
items.find(function (item, idx) {
|
|
1076
|
+
if (item.id === active.id) {
|
|
1077
|
+
oldIndex_1 = idx;
|
|
1078
|
+
}
|
|
1079
|
+
else if (item.id === over.id) {
|
|
1080
|
+
newIndex_1 = idx;
|
|
1081
|
+
}
|
|
1082
|
+
return oldIndex_1 != null && newIndex_1 != null;
|
|
1083
|
+
});
|
|
1084
|
+
if (oldIndex_1 != null && newIndex_1 != null) {
|
|
1085
|
+
var finalItems = sortable.arrayMove(items, oldIndex_1, newIndex_1);
|
|
1086
|
+
onSortChange && onSortChange(finalItems);
|
|
1087
|
+
return finalItems;
|
|
1088
|
+
}
|
|
1089
|
+
else {
|
|
1090
|
+
return items;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
else {
|
|
1094
|
+
return items;
|
|
1095
|
+
}
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
}, [onSortChange]);
|
|
1099
|
+
var handleHeadCheckChange = React.useCallback(function (column, checked) {
|
|
1100
|
+
Object.keys(localBodyDataRef.current).forEach(function (key) {
|
|
1101
|
+
var _a;
|
|
1102
|
+
var data = localBodyDataRef.current[key].columns[getFinalColumnId(column)];
|
|
1103
|
+
if (data) {
|
|
1104
|
+
if (!data.checkDisabled) {
|
|
1105
|
+
(_a = data.commands) === null || _a === void 0 ? void 0 : _a.setChecked(checked);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
});
|
|
1109
|
+
}, [getFinalColumnId]);
|
|
1110
|
+
var handleBodyCheckChange = React.useCallback(function (item, column) {
|
|
1111
|
+
updateHeadCheck(column);
|
|
1112
|
+
}, [updateHeadCheck]);
|
|
1113
|
+
var handlePageChange = React.useCallback(function (page) {
|
|
1114
|
+
simpleBarScrollToTop();
|
|
1115
|
+
onPageChange && onPageChange(page);
|
|
1116
|
+
}, [onPageChange, simpleBarScrollToTop]);
|
|
1117
|
+
/********************************************************************************************************************
|
|
1118
|
+
* TableContext Function
|
|
1119
|
+
* ******************************************************************************************************************/
|
|
1120
|
+
var TableContextSetMenuOpen = React.useCallback(function (newMenuOpen, newOpenMenuId) {
|
|
1121
|
+
if (newMenuOpen) {
|
|
1122
|
+
setMenuOpen(newMenuOpen);
|
|
1123
|
+
setOpenMenuId(newOpenMenuId);
|
|
1124
|
+
}
|
|
1125
|
+
else {
|
|
1126
|
+
if (openMenuId === newOpenMenuId) {
|
|
1127
|
+
setMenuOpen(false);
|
|
1128
|
+
setOpenMenuId(undefined);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
}, [openMenuId]);
|
|
1132
|
+
var TableContextSetItemColumnChecked = React.useCallback(function (item, column, checked) {
|
|
1133
|
+
var _a;
|
|
1134
|
+
var columnId = getFinalColumnId(column);
|
|
1135
|
+
var data = (_a = localBodyDataRef.current[item.id]) === null || _a === void 0 ? void 0 : _a.columns[columnId];
|
|
1136
|
+
if (data) {
|
|
1137
|
+
data.checked = checked;
|
|
1138
|
+
fireOnCheckChange(columnId);
|
|
1139
|
+
}
|
|
1140
|
+
}, [fireOnCheckChange, getFinalColumnId]);
|
|
1141
|
+
var TableContextSetItemColumnCheckDisabled = React.useCallback(function (item, column, disabled) {
|
|
1142
|
+
var _a;
|
|
1143
|
+
var data = (_a = localBodyDataRef.current[item.id]) === null || _a === void 0 ? void 0 : _a.columns[getFinalColumnId(column)];
|
|
1144
|
+
if (data) {
|
|
1145
|
+
data.checkDisabled = disabled;
|
|
1146
|
+
updateHeadCheck(column);
|
|
1147
|
+
}
|
|
1148
|
+
}, [getFinalColumnId, updateHeadCheck]);
|
|
1149
|
+
var TableContextSetItemColumnCommands = React.useCallback(function (item, column, commands) {
|
|
1150
|
+
var _a;
|
|
1151
|
+
var data = (_a = localBodyDataRef.current[item.id]) === null || _a === void 0 ? void 0 : _a.columns[getFinalColumnId(column)];
|
|
1152
|
+
if (data) {
|
|
1153
|
+
data.commands = commands;
|
|
1154
|
+
}
|
|
1155
|
+
}, [getFinalColumnId]);
|
|
1156
|
+
var TableContextSetHeadColumnChecked = React.useCallback(function (column, checked) {
|
|
1157
|
+
var data = localHeaderDataRef.current[getFinalColumnId(column)];
|
|
1158
|
+
if (data) {
|
|
1159
|
+
data.checked = checked;
|
|
1160
|
+
}
|
|
1161
|
+
}, [getFinalColumnId]);
|
|
1162
|
+
var TableContextSetHeadColumnCommands = React.useCallback(function (column, commands) {
|
|
1163
|
+
var data = localHeaderDataRef.current[getFinalColumnId(column)];
|
|
1164
|
+
if (data) {
|
|
1165
|
+
data.commands = commands;
|
|
1166
|
+
}
|
|
1167
|
+
}, [getFinalColumnId]);
|
|
1168
|
+
/********************************************************************************************************************
|
|
1169
|
+
* Memo
|
|
1170
|
+
* ******************************************************************************************************************/
|
|
1171
|
+
var isNoData = !!sortableItems && sortableItems.length <= 0;
|
|
1172
|
+
var finalPagingHeight = paging && paging.total > 0 ? pagingHeight || 0 : 0;
|
|
1173
|
+
var stickyHeader = !isNoData && initStickyHeader;
|
|
1174
|
+
var style = fullHeight
|
|
1175
|
+
? __assign(__assign({ width: '100%' }, initStyle), { flex: 1, justifyContent: 'flex-end', height: '100%', display: 'flex', flexDirection: 'column', position: 'relative' }) : __assign({ width: '100%' }, initStyle);
|
|
1176
|
+
var simpleBarStyle = fullHeight
|
|
1177
|
+
? {
|
|
1178
|
+
height: (containerHeight || 0) - (finalPagingHeight || 0) - 1,
|
|
1179
|
+
flex: 1,
|
|
1180
|
+
position: 'absolute',
|
|
1181
|
+
top: 0,
|
|
1182
|
+
left: 0,
|
|
1183
|
+
right: 0,
|
|
1184
|
+
marginBottom: finalPagingHeight || 0,
|
|
1185
|
+
}
|
|
1186
|
+
: { height: height, minHeight: minHeight, maxHeight: maxHeight, marginBottom: -1 };
|
|
1187
|
+
var tableStyle = fullHeight && isNoData ? { flex: 1, height: (containerHeight || 0) - finalPagingHeight - 2 } : undefined;
|
|
1188
|
+
// pageStyle
|
|
1189
|
+
var pagingStyle = { padding: '13px 0', borderTop: '1px solid rgba(224, 224, 224, 1)' };
|
|
1190
|
+
if (fullHeight) {
|
|
1191
|
+
pagingStyle.position = 'sticky';
|
|
1192
|
+
}
|
|
1193
|
+
var tableTopHead = finalColumns && (React.createElement(TableTopHead, { caption: caption, rows: topHeadRows, columns: finalColumns, defaultAlign: defaultAlign, onCheckChange: handleHeadCheckChange }));
|
|
1194
|
+
var tableBody = React.useMemo(function () {
|
|
1195
|
+
return finalColumns && (React.createElement(material.TableBody, null, sortableItems ? (sortableItems.length > 0 ? (React.createElement(sortable.SortableContext, { items: sortableItems, strategy: sortable.verticalListSortingStrategy }, sortableItems.map(function (item, idx) { return (React.createElement(TableBodyRow, { key: item.id, className: classNames(!!showOddColor && 'odd-color', !!showEvenColor && 'even-color', onGetBodyRowClassName ? onGetBodyRowClassName(item, idx) : undefined), style: onGetBodyRowStyle ? onGetBodyRowStyle(item, idx) : undefined, sx: onGetBodyRowSx ? onGetBodyRowSx(item, idx) : undefined, onGetColumnClassName: onGetBodyColumnClassName, onGetColumnStyle: onGetBodyColumnStyle, onGetColumnSx: onGetBodyColumnSx, hover: true, id: item.id, index: idx, defaultAlign: defaultAlign, defaultEllipsis: defaultEllipsis, sortable: sortable$1, columns: finalColumns, item: item, onClick: onClick, onCheckChange: handleBodyCheckChange })); }))) : (React.createElement(StyledBodyRow$1, null,
|
|
1196
|
+
React.createElement(material.TableCell, { colSpan: finalColumns.length, style: { flex: 1 } }, noData ? (noData) : (React.createElement(StyledNoDataDiv, null,
|
|
1197
|
+
React.createElement("div", null,
|
|
1198
|
+
React.createElement(material.Icon, null, "error")),
|
|
1199
|
+
React.createElement("div", null, "\uAC80\uC0C9\uB41C \uC815\uBCF4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."))))))) : undefined));
|
|
1200
|
+
}, [
|
|
1201
|
+
defaultAlign,
|
|
1202
|
+
defaultEllipsis,
|
|
1203
|
+
finalColumns,
|
|
1204
|
+
handleBodyCheckChange,
|
|
1205
|
+
noData,
|
|
1206
|
+
onClick,
|
|
1207
|
+
onGetBodyColumnClassName,
|
|
1208
|
+
onGetBodyColumnStyle,
|
|
1209
|
+
onGetBodyColumnSx,
|
|
1210
|
+
onGetBodyRowClassName,
|
|
1211
|
+
onGetBodyRowStyle,
|
|
1212
|
+
onGetBodyRowSx,
|
|
1213
|
+
showEvenColor,
|
|
1214
|
+
showOddColor,
|
|
1215
|
+
sortable$1,
|
|
1216
|
+
sortableItems,
|
|
1217
|
+
]);
|
|
1218
|
+
var tableFooter = React.useMemo(function () {
|
|
1219
|
+
return finalColumns &&
|
|
1220
|
+
!isNoData &&
|
|
1221
|
+
footer && (React.createElement(material.TableFooter, null,
|
|
1222
|
+
React.createElement(material.TableRow, null, finalColumns.map(function (column, idx) { return (React.createElement(TableFooterCell, { key: idx, column: column, defaultAlign: defaultAlign })); }))));
|
|
1223
|
+
}, [defaultAlign, finalColumns, footer, isNoData]);
|
|
1224
|
+
/********************************************************************************************************************
|
|
1225
|
+
* Render
|
|
1226
|
+
* ******************************************************************************************************************/
|
|
1227
|
+
return finalColumns ? (React.createElement(TableContextProvider, { value: {
|
|
1228
|
+
menuOpen: menuOpen,
|
|
1229
|
+
openMenuId: openMenuId,
|
|
1230
|
+
setMenuOpen: TableContextSetMenuOpen,
|
|
1231
|
+
setItemColumnChecked: TableContextSetItemColumnChecked,
|
|
1232
|
+
setItemColumnCheckDisabled: TableContextSetItemColumnCheckDisabled,
|
|
1233
|
+
setItemColumnCommands: TableContextSetItemColumnCommands,
|
|
1234
|
+
setHeadColumnChecked: TableContextSetHeadColumnChecked,
|
|
1235
|
+
setHeadColumnCommands: TableContextSetHeadColumnCommands,
|
|
1236
|
+
} },
|
|
1237
|
+
React.createElement(material.Paper, { ref: fullHeight ? containerHeightDetector : undefined, className: classNames('Table', className, !!stickyHeader && 'sticky-header', !!fullHeight && 'full-height', !!showOddColor && 'odd-color', !!showEvenColor && 'even-color', !!sortable$1 && 'sortable'), variant: 'outlined', style: style, sx: sx },
|
|
1238
|
+
React.createElement(SimpleBar, { ref: simpleBarRef, style: simpleBarStyle },
|
|
1239
|
+
React.createElement(core.DndContext, { sensors: sensors, collisionDetection: core.closestCenter, onDragEnd: handleDragEnd },
|
|
1240
|
+
React.createElement(material.Table, { stickyHeader: stickyHeader, sx: tableSx, style: tableStyle },
|
|
1241
|
+
tableTopHead,
|
|
1242
|
+
tableBody,
|
|
1243
|
+
tableFooter))),
|
|
1244
|
+
finalColumns && paging && paging.total > 0 && (React.createElement(material.Stack, { ref: fullHeight ? pagingHeightResizeDetector : undefined, alignItems: pagingAlign, style: pagingStyle },
|
|
1245
|
+
React.createElement(TablePagination, { className: pagination === null || pagination === void 0 ? void 0 : pagination.className, style: pagination === null || pagination === void 0 ? void 0 : pagination.style, sx: pagination === null || pagination === void 0 ? void 0 : pagination.sx, paging: paging, align: pagingAlign, onChange: handlePageChange })))))) : null;
|
|
1246
|
+
});var getSearchInfo = function (search) {
|
|
1247
|
+
var searchInfo = {};
|
|
1248
|
+
if (search) {
|
|
1249
|
+
var ref = search.ref, searchGroups = search.searchGroups, props = __rest(search, ["ref", "searchGroups"]);
|
|
1250
|
+
searchInfo.ref = ref;
|
|
1251
|
+
searchInfo.searchGroups = searchGroups;
|
|
1252
|
+
searchInfo.props = props;
|
|
1253
|
+
}
|
|
1254
|
+
return searchInfo;
|
|
1255
|
+
};
|
|
1256
|
+
var getTableInfo = function (table) {
|
|
1257
|
+
var tableInfo = {};
|
|
1258
|
+
if (table) {
|
|
1259
|
+
var ref = table.ref, props = __rest(table, ["ref"]);
|
|
1260
|
+
tableInfo.ref = ref;
|
|
1261
|
+
tableInfo.props = props;
|
|
1262
|
+
}
|
|
1263
|
+
return tableInfo;
|
|
1264
|
+
};
|
|
1265
|
+
var deHash = function () {
|
|
1266
|
+
var values = {};
|
|
1267
|
+
var hash = window.location.hash.substring(1);
|
|
1268
|
+
hash.replace(/([^=&]+)=([^&]*)/g, function (substring, key, value) {
|
|
1269
|
+
values[decodeURIComponent(key)] = decodeURIComponent(value);
|
|
1270
|
+
return substring;
|
|
1271
|
+
});
|
|
1272
|
+
return values;
|
|
1273
|
+
};var SearchTable = React.forwardRef(function (_a, ref) {
|
|
1274
|
+
/********************************************************************************************************************
|
|
1275
|
+
* Ref
|
|
1276
|
+
* ******************************************************************************************************************/
|
|
1277
|
+
var _b, _c;
|
|
1278
|
+
var className = _a.className, initStyle = _a.style, sx = _a.sx, color = _a.color, hash = _a.hash, stickyHeader = _a.stickyHeader, fullHeight = _a.fullHeight, search = _a.search, table = _a.table, betweenSearchTableComponent = _a.betweenSearchTableComponent, onGetData = _a.onGetData, onRequestHashChange = _a.onRequestHashChange;
|
|
1279
|
+
var searchRef = React.useRef();
|
|
1280
|
+
var tableRef = React.useRef();
|
|
1281
|
+
var lastGetDataDataRef = React.useRef({});
|
|
1282
|
+
/********************************************************************************************************************
|
|
1283
|
+
* State
|
|
1284
|
+
* ******************************************************************************************************************/
|
|
1285
|
+
var _d = React.useState(true), isFirstSearchSubmit = _d[0], setIsFirstSearchSubmit = _d[1];
|
|
1286
|
+
var _e = React.useState(), tableData = _e[0], setTableData = _e[1];
|
|
1287
|
+
/********************************************************************************************************************
|
|
1288
|
+
* searchInfo
|
|
1289
|
+
* ******************************************************************************************************************/
|
|
1290
|
+
var searchInfoFirstUseEffect = React.useRef(true);
|
|
1291
|
+
var _f = React.useState(function () { return getSearchInfo(search); }), searchInfo = _f[0], setSearchInfo = _f[1];
|
|
1292
|
+
React.useEffect(function () {
|
|
1293
|
+
if (searchInfoFirstUseEffect.current) {
|
|
1294
|
+
searchInfoFirstUseEffect.current = false;
|
|
1295
|
+
}
|
|
1296
|
+
else {
|
|
1297
|
+
setSearchInfo(getSearchInfo(search));
|
|
1298
|
+
}
|
|
1299
|
+
}, [search]);
|
|
1300
|
+
/********************************************************************************************************************
|
|
1301
|
+
* tableInfo
|
|
1302
|
+
* ******************************************************************************************************************/
|
|
1303
|
+
var tableInfoFirstUseEffect = React.useRef(true);
|
|
1304
|
+
var _g = React.useState(function () { return getTableInfo(table); }), tableInfo = _g[0], setTableInfo = _g[1];
|
|
1305
|
+
React.useEffect(function () {
|
|
1306
|
+
if (tableInfoFirstUseEffect.current) {
|
|
1307
|
+
tableInfoFirstUseEffect.current = false;
|
|
1308
|
+
}
|
|
1309
|
+
else {
|
|
1310
|
+
setTableInfo(getTableInfo(table));
|
|
1311
|
+
}
|
|
1312
|
+
}, [table]);
|
|
1313
|
+
/********************************************************************************************************************
|
|
1314
|
+
* Function
|
|
1315
|
+
* ******************************************************************************************************************/
|
|
1316
|
+
var getData = React.useCallback(function (data) {
|
|
1317
|
+
lastGetDataDataRef.current = data;
|
|
1318
|
+
if (onGetData) {
|
|
1319
|
+
onGetData(data).then(setTableData);
|
|
1320
|
+
}
|
|
1321
|
+
}, [onGetData]);
|
|
1322
|
+
var hashToSearchValue = React.useCallback(function () {
|
|
1323
|
+
var commands = searchRef.current;
|
|
1324
|
+
if (commands) {
|
|
1325
|
+
commands.resetAll();
|
|
1326
|
+
var hashValues_1 = deHash();
|
|
1327
|
+
Object.keys(hashValues_1).forEach(function (name) {
|
|
1328
|
+
var _a, _b;
|
|
1329
|
+
var value = hashValues_1[name];
|
|
1330
|
+
if (name === 'page') {
|
|
1331
|
+
commands.setValue(name, Number(value) || 1);
|
|
1332
|
+
}
|
|
1333
|
+
else {
|
|
1334
|
+
var itemCommands = commands.getItem(name);
|
|
1335
|
+
if (itemCommands) {
|
|
1336
|
+
switch (itemCommands.getType()) {
|
|
1337
|
+
case 'FormCheckbox':
|
|
1338
|
+
if (util.notEmpty(value)) {
|
|
1339
|
+
var checkCommands = itemCommands;
|
|
1340
|
+
if (value.toString() === ((_a = itemCommands.getValue()) === null || _a === void 0 ? void 0 : _a.toString())) {
|
|
1341
|
+
checkCommands.setChecked(true);
|
|
1342
|
+
}
|
|
1343
|
+
else if (value.toString() === ((_b = checkCommands.getUncheckedValue()) === null || _b === void 0 ? void 0 : _b.toString())) {
|
|
1344
|
+
checkCommands.setChecked(false);
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
break;
|
|
1348
|
+
case 'FormDatePicker':
|
|
1349
|
+
case 'FormDateTimePicker':
|
|
1350
|
+
case 'FormTimePicker':
|
|
1351
|
+
{
|
|
1352
|
+
if (util.notEmpty(value)) {
|
|
1353
|
+
var dateCommands = itemCommands;
|
|
1354
|
+
var format = dateCommands.getFormValueFormat();
|
|
1355
|
+
var itemValue = dayjs(value, format);
|
|
1356
|
+
itemCommands.setValue(itemValue.isValid() ? itemValue : null);
|
|
1357
|
+
}
|
|
1358
|
+
else {
|
|
1359
|
+
itemCommands.setValue(null);
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
break;
|
|
1363
|
+
case 'FormDateRangePicker':
|
|
1364
|
+
{
|
|
1365
|
+
var dateRangePickerCommands = itemCommands;
|
|
1366
|
+
var fromName = dateRangePickerCommands.getFormValueFromName();
|
|
1367
|
+
var toName = dateRangePickerCommands.getFormValueToName();
|
|
1368
|
+
var format = dateRangePickerCommands.getFormValueFormat();
|
|
1369
|
+
if (name === fromName) {
|
|
1370
|
+
if (util.notEmpty(value)) {
|
|
1371
|
+
var startValue = dayjs(value, format);
|
|
1372
|
+
dateRangePickerCommands.setFromValue(startValue.isValid() ? startValue : null);
|
|
1373
|
+
}
|
|
1374
|
+
else {
|
|
1375
|
+
dateRangePickerCommands.setFromValue(null);
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
else if (name === toName) {
|
|
1379
|
+
if (util.notEmpty(value)) {
|
|
1380
|
+
var endValue = dayjs(value, format);
|
|
1381
|
+
dateRangePickerCommands.setToValue(endValue.isValid() ? endValue : null);
|
|
1382
|
+
}
|
|
1383
|
+
else {
|
|
1384
|
+
dateRangePickerCommands.setToValue(null);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
break;
|
|
1389
|
+
case 'FormYearRangePicker':
|
|
1390
|
+
{
|
|
1391
|
+
var dateRangePickerCommands = itemCommands;
|
|
1392
|
+
var fromName = dateRangePickerCommands.getFormValueFromName();
|
|
1393
|
+
var toName = dateRangePickerCommands.getFormValueToName();
|
|
1394
|
+
if (name === fromName) {
|
|
1395
|
+
dateRangePickerCommands.setFromValue(util.notEmpty(value) ? Number(value) : null);
|
|
1396
|
+
}
|
|
1397
|
+
else if (name === toName) {
|
|
1398
|
+
dateRangePickerCommands.setToValue(util.notEmpty(value) ? Number(value) : null);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
break;
|
|
1402
|
+
case 'FormMonthPicker':
|
|
1403
|
+
{
|
|
1404
|
+
var monthCommands = itemCommands;
|
|
1405
|
+
var yearName = monthCommands.getFormValueYearName();
|
|
1406
|
+
var monthName = monthCommands.getFormValueMonthName();
|
|
1407
|
+
if (name === yearName) {
|
|
1408
|
+
monthCommands.setYear(util.notEmpty(value) ? Number(value) : null);
|
|
1409
|
+
}
|
|
1410
|
+
else if (name === monthName) {
|
|
1411
|
+
monthCommands.setMonth(util.notEmpty(value) ? Number(value) : null);
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
break;
|
|
1415
|
+
case 'FormMonthRangePicker':
|
|
1416
|
+
{
|
|
1417
|
+
var monthRangeCommands = itemCommands;
|
|
1418
|
+
var fromYearName = monthRangeCommands.getFormValueFromYearName();
|
|
1419
|
+
var fromMonthName = monthRangeCommands.getFormValueFromMonthName();
|
|
1420
|
+
var toYearName = monthRangeCommands.getFormValueToYearName();
|
|
1421
|
+
var toMonthName = monthRangeCommands.getFormValueToMonthName();
|
|
1422
|
+
if (name === fromYearName) {
|
|
1423
|
+
monthRangeCommands.setFromYear(util.notEmpty(value) ? Number(value) : null);
|
|
1424
|
+
}
|
|
1425
|
+
else if (name === fromMonthName) {
|
|
1426
|
+
monthRangeCommands.setFromMonth(util.notEmpty(value) ? Number(value) : null);
|
|
1427
|
+
}
|
|
1428
|
+
else if (name === toYearName) {
|
|
1429
|
+
monthRangeCommands.setToYear(util.notEmpty(value) ? Number(value) : null);
|
|
1430
|
+
}
|
|
1431
|
+
else if (name === toMonthName) {
|
|
1432
|
+
monthRangeCommands.setToMonth(util.notEmpty(value) ? Number(value) : null);
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
break;
|
|
1436
|
+
default:
|
|
1437
|
+
commands.setValue(name, value);
|
|
1438
|
+
break;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
});
|
|
1443
|
+
return commands.getAllFormValue();
|
|
1444
|
+
}
|
|
1445
|
+
}, [searchRef]);
|
|
1446
|
+
/********************************************************************************************************************
|
|
1447
|
+
* Commands
|
|
1448
|
+
* ******************************************************************************************************************/
|
|
1449
|
+
React.useLayoutEffect(function () {
|
|
1450
|
+
if (ref) {
|
|
1451
|
+
var commands = {
|
|
1452
|
+
reload: function (page) {
|
|
1453
|
+
var _a, _b, _c, _d;
|
|
1454
|
+
if (page != null) {
|
|
1455
|
+
(_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.scrollToTop();
|
|
1456
|
+
}
|
|
1457
|
+
var finalData;
|
|
1458
|
+
if (lastGetDataDataRef.current) {
|
|
1459
|
+
finalData = __assign({}, lastGetDataDataRef.current);
|
|
1460
|
+
if (page != null) {
|
|
1461
|
+
(_b = searchRef.current) === null || _b === void 0 ? void 0 : _b.setValue('page', page);
|
|
1462
|
+
finalData.page = page;
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
else {
|
|
1466
|
+
if (hash) {
|
|
1467
|
+
hashToSearchValue();
|
|
1468
|
+
}
|
|
1469
|
+
if (page != null) {
|
|
1470
|
+
(_c = searchRef.current) === null || _c === void 0 ? void 0 : _c.setValue('page', page);
|
|
1471
|
+
}
|
|
1472
|
+
finalData = ((_d = searchRef.current) === null || _d === void 0 ? void 0 : _d.getAllFormValue()) || {};
|
|
1473
|
+
}
|
|
1474
|
+
getData(finalData);
|
|
1475
|
+
},
|
|
1476
|
+
getLastLoadData: function () { return lastGetDataDataRef.current || {}; },
|
|
1477
|
+
getSearch: function () { return searchRef.current; },
|
|
1478
|
+
getTable: function () { return tableRef.current; },
|
|
1479
|
+
};
|
|
1480
|
+
if (typeof ref === 'function') {
|
|
1481
|
+
ref(commands);
|
|
1482
|
+
}
|
|
1483
|
+
else {
|
|
1484
|
+
ref.current = commands;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
}, [ref, hash, lastGetDataDataRef, searchRef, tableRef, getData, hashToSearchValue]);
|
|
1488
|
+
/********************************************************************************************************************
|
|
1489
|
+
* hash
|
|
1490
|
+
* ******************************************************************************************************************/
|
|
1491
|
+
React.useEffect(function () {
|
|
1492
|
+
if (hash) {
|
|
1493
|
+
var data = hashToSearchValue();
|
|
1494
|
+
if (data)
|
|
1495
|
+
getData(data);
|
|
1496
|
+
}
|
|
1497
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1498
|
+
}, [window.location.hash]);
|
|
1499
|
+
var hashChange = React.useCallback(function (params) {
|
|
1500
|
+
if (onRequestHashChange) {
|
|
1501
|
+
var hashes_1 = [];
|
|
1502
|
+
Object.keys(params).forEach(function (name) {
|
|
1503
|
+
var value = params[name];
|
|
1504
|
+
if (name === 'page') {
|
|
1505
|
+
if (Number(value) > 1) {
|
|
1506
|
+
hashes_1.push("".concat(name, "=").concat(value));
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
else {
|
|
1510
|
+
if (searchRef.current) {
|
|
1511
|
+
var itemCommands = searchRef.current.getItem(name);
|
|
1512
|
+
if (itemCommands) {
|
|
1513
|
+
var resetValue = null;
|
|
1514
|
+
switch (itemCommands.getType()) {
|
|
1515
|
+
case 'FormDateRangePicker':
|
|
1516
|
+
case 'FormYearRangePicker':
|
|
1517
|
+
{
|
|
1518
|
+
var commands = itemCommands;
|
|
1519
|
+
var itemName = itemCommands.getName();
|
|
1520
|
+
var fromName = commands.getFormValueFromName();
|
|
1521
|
+
var fromSuffix = commands.getFormValueFromNameSuffix();
|
|
1522
|
+
var toName = commands.getFormValueToName();
|
|
1523
|
+
var toSuffix = commands.getFormValueToNameSuffix();
|
|
1524
|
+
if (name === fromName) {
|
|
1525
|
+
resetValue = searchRef.current.getFormReset(itemName, fromSuffix);
|
|
1526
|
+
}
|
|
1527
|
+
else if (name === toName) {
|
|
1528
|
+
resetValue = searchRef.current.getFormReset(itemName, toSuffix);
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
break;
|
|
1532
|
+
case 'FormMonthPicker':
|
|
1533
|
+
{
|
|
1534
|
+
var commands = itemCommands;
|
|
1535
|
+
var itemName = commands.getName();
|
|
1536
|
+
var yearName = commands.getFormValueYearName();
|
|
1537
|
+
var yearSuffix = commands.getFormValueYearNameSuffix();
|
|
1538
|
+
var monthName = commands.getFormValueMonthName();
|
|
1539
|
+
var monthSuffix = commands.getFormValueMonthNameSuffix();
|
|
1540
|
+
if (name === yearName) {
|
|
1541
|
+
resetValue = searchRef.current.getFormReset(itemName, yearSuffix);
|
|
1542
|
+
}
|
|
1543
|
+
else if (name === monthName) {
|
|
1544
|
+
resetValue = searchRef.current.getFormReset(itemName, monthSuffix);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
break;
|
|
1548
|
+
case 'FormMonthRangePicker':
|
|
1549
|
+
{
|
|
1550
|
+
var commands = itemCommands;
|
|
1551
|
+
var itemName = commands.getName();
|
|
1552
|
+
var fromYearName = commands.getFormValueFromYearName();
|
|
1553
|
+
var fromYearSuffix = commands.getFormValueFromYearNameSuffix();
|
|
1554
|
+
var fromMonthName = commands.getFormValueFromMonthName();
|
|
1555
|
+
var fromMonthSuffix = commands.getFormValueFromMonthNameSuffix();
|
|
1556
|
+
var toYearName = commands.getFormValueToYearName();
|
|
1557
|
+
var toYearSuffix = commands.getFormValueToYearNameSuffix();
|
|
1558
|
+
var toMonthName = commands.getFormValueToMonthName();
|
|
1559
|
+
var toMonthSuffix = commands.getFormValueToMonthNameSuffix();
|
|
1560
|
+
if (name === fromYearName) {
|
|
1561
|
+
resetValue = searchRef.current.getFormReset(itemName, fromYearSuffix);
|
|
1562
|
+
}
|
|
1563
|
+
else if (name === fromMonthName) {
|
|
1564
|
+
resetValue = searchRef.current.getFormReset(itemName, fromMonthSuffix);
|
|
1565
|
+
}
|
|
1566
|
+
else if (name === toYearName) {
|
|
1567
|
+
resetValue = searchRef.current.getFormReset(itemName, toYearSuffix);
|
|
1568
|
+
}
|
|
1569
|
+
else if (name === toMonthName) {
|
|
1570
|
+
resetValue = searchRef.current.getFormReset(itemName, toMonthSuffix);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
break;
|
|
1574
|
+
default:
|
|
1575
|
+
resetValue = searchRef.current.getFormReset(name);
|
|
1576
|
+
break;
|
|
1577
|
+
}
|
|
1578
|
+
if (resetValue != null && !util.equal(resetValue, value) && typeof value !== 'object') {
|
|
1579
|
+
hashes_1.push("".concat(name, "=").concat(encodeURIComponent(value)));
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
});
|
|
1585
|
+
var finalHash = hashes_1.join('&');
|
|
1586
|
+
if (window.location.hash.substring(1) === finalHash) {
|
|
1587
|
+
getData(params);
|
|
1588
|
+
}
|
|
1589
|
+
else {
|
|
1590
|
+
onRequestHashChange(hashes_1.join('&'));
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
}, [onRequestHashChange, getData]);
|
|
1594
|
+
/********************************************************************************************************************
|
|
1595
|
+
* Event Handler
|
|
1596
|
+
* ******************************************************************************************************************/
|
|
1597
|
+
var handlePageChange = React.useCallback(function (page) {
|
|
1598
|
+
var _a, _b;
|
|
1599
|
+
(_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.setValue('page', page);
|
|
1600
|
+
var finalData;
|
|
1601
|
+
if (lastGetDataDataRef.current) {
|
|
1602
|
+
finalData = __assign({}, lastGetDataDataRef.current);
|
|
1603
|
+
finalData.page = page;
|
|
1604
|
+
}
|
|
1605
|
+
else {
|
|
1606
|
+
finalData = (_b = searchRef.current) === null || _b === void 0 ? void 0 : _b.getAllFormValue();
|
|
1607
|
+
}
|
|
1608
|
+
if (hash) {
|
|
1609
|
+
hashChange(finalData || {});
|
|
1610
|
+
}
|
|
1611
|
+
else {
|
|
1612
|
+
getData(finalData || {});
|
|
1613
|
+
}
|
|
1614
|
+
}, [searchRef, hash, hashChange, getData]);
|
|
1615
|
+
var handleSearchSubmit = React.useCallback(function (data) {
|
|
1616
|
+
var _a, _b;
|
|
1617
|
+
(_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.scrollToTop();
|
|
1618
|
+
if (isFirstSearchSubmit) {
|
|
1619
|
+
setIsFirstSearchSubmit(false);
|
|
1620
|
+
if (!hash) {
|
|
1621
|
+
getData(data);
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
else {
|
|
1625
|
+
(_b = searchRef.current) === null || _b === void 0 ? void 0 : _b.setValue('page', 1);
|
|
1626
|
+
var finalData = __assign(__assign({}, data), { page: 1 });
|
|
1627
|
+
if (hash) {
|
|
1628
|
+
hashChange(finalData);
|
|
1629
|
+
}
|
|
1630
|
+
else {
|
|
1631
|
+
getData(finalData);
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
}, [searchRef, hash, hashChange, getData, isFirstSearchSubmit]);
|
|
1635
|
+
/********************************************************************************************************************
|
|
1636
|
+
* Render
|
|
1637
|
+
* ******************************************************************************************************************/
|
|
1638
|
+
return (React.createElement(material.Grid, { container: true, direction: 'column', spacing: 1, className: classNames('SearchTable', className), style: fullHeight ? __assign(__assign({}, initStyle), { flex: 1, display: 'flex' }) : initStyle, sx: sx },
|
|
1639
|
+
React.createElement(material.Grid, { item: true, sx: { display: searchInfo.searchGroups ? undefined : 'none' } },
|
|
1640
|
+
React.createElement(reactForm.Search, __assign({ color: color }, searchInfo.props, { ref: function (commands) {
|
|
1641
|
+
if (searchInfo.ref) {
|
|
1642
|
+
if (typeof searchInfo.ref === 'function') {
|
|
1643
|
+
searchInfo.ref(commands);
|
|
1644
|
+
}
|
|
1645
|
+
else {
|
|
1646
|
+
searchInfo.ref.current = commands;
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
searchRef.current = commands || undefined;
|
|
1650
|
+
}, autoSubmit: true, onSubmit: handleSearchSubmit }),
|
|
1651
|
+
React.createElement(reactForm.SearchGroup, { hidden: true },
|
|
1652
|
+
React.createElement(reactForm.FormHidden, { name: 'page', value: 1 })),
|
|
1653
|
+
searchInfo.searchGroups)),
|
|
1654
|
+
betweenSearchTableComponent && React.createElement(material.Grid, { item: true }, betweenSearchTableComponent),
|
|
1655
|
+
React.createElement(material.Grid, { item: true, style: fullHeight ? { flex: 1, display: 'flex', flexDirection: 'column' } : undefined },
|
|
1656
|
+
React.createElement(Table, __assign({}, tableInfo.props, { stickyHeader: stickyHeader || ((_b = tableInfo.props) === null || _b === void 0 ? void 0 : _b.stickyHeader), fullHeight: fullHeight || ((_c = tableInfo.props) === null || _c === void 0 ? void 0 : _c.fullHeight), ref: function (commands) {
|
|
1657
|
+
if (tableInfo.ref) {
|
|
1658
|
+
if (typeof tableInfo.ref === 'function') {
|
|
1659
|
+
tableInfo.ref(commands);
|
|
1660
|
+
}
|
|
1661
|
+
else {
|
|
1662
|
+
tableInfo.ref.current = commands;
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
tableRef.current = commands || undefined;
|
|
1666
|
+
}, items: tableData === null || tableData === void 0 ? void 0 : tableData.items, paging: tableData === null || tableData === void 0 ? void 0 : tableData.paging, onPageChange: handlePageChange })))));
|
|
1667
|
+
});var TableButton = React.forwardRef(function (_a, ref) {
|
|
1668
|
+
var children = _a.children, className = _a.className, initSx = _a.sx, _b = _a.variant, variant = _b === void 0 ? 'outlined' : _b, _c = _a.color, color = _c === void 0 ? 'primary' : _c, startIcon = _a.startIcon, endIcon = _a.endIcon, onClick = _a.onClick, props = __rest(_a, ["children", "className", "sx", "variant", "color", "startIcon", "endIcon", "onClick"]);
|
|
1669
|
+
return (React.createElement(reactComponent.PdgButton, __assign({ ref: ref, className: classNames(className, 'TableButton'), variant: variant, type: 'button', size: 'small', sx: __assign({ minWidth: 0, px: util.empty(startIcon) && util.empty(endIcon)
|
|
1670
|
+
? '7px !important'
|
|
1671
|
+
: util.empty(children)
|
|
1672
|
+
? '5px !important'
|
|
1673
|
+
: '7px !important' }, initSx), color: color, startIcon: startIcon, endIcon: endIcon, onClick: onClick }, props), children));
|
|
1674
|
+
});
|
|
1675
|
+
var TableButton$1 = React.memo(TableButton);var TableMenuButton = React.forwardRef(function (_a, ref) {
|
|
1676
|
+
/********************************************************************************************************************
|
|
1677
|
+
* ID
|
|
1678
|
+
* ******************************************************************************************************************/
|
|
1679
|
+
var children = _a.children, className = _a.className, initSx = _a.sx, _b = _a.color, color = _b === void 0 ? 'primary' : _b, _c = _a.variant, variant = _c === void 0 ? 'text' : _c, startIcon = _a.startIcon, _d = _a.placement, placement = _d === void 0 ? 'bottom' : _d, inModal = _a.inModal, zIndex = _a.zIndex, menuList = _a.menuList, props = __rest(_a, ["children", "className", "sx", "color", "variant", "startIcon", "placement", "inModal", "zIndex", "menuList"]);
|
|
1680
|
+
var buttonId = React.useId();
|
|
1681
|
+
var menuId = React.useId();
|
|
1682
|
+
/********************************************************************************************************************
|
|
1683
|
+
* Use
|
|
1684
|
+
* ******************************************************************************************************************/
|
|
1685
|
+
var _e = useTableState(), menuOpen = _e.menuOpen, openMenuId = _e.openMenuId, setMenuOpen = _e.setMenuOpen;
|
|
1686
|
+
/********************************************************************************************************************
|
|
1687
|
+
* Ref
|
|
1688
|
+
* ******************************************************************************************************************/
|
|
1689
|
+
var anchorRef = React.useRef();
|
|
1690
|
+
/********************************************************************************************************************
|
|
1691
|
+
* State
|
|
1692
|
+
* ******************************************************************************************************************/
|
|
1693
|
+
var _f = React.useState(false), open = _f[0], setOpen = _f[1];
|
|
1694
|
+
/********************************************************************************************************************
|
|
1695
|
+
* Effect
|
|
1696
|
+
* ******************************************************************************************************************/
|
|
1697
|
+
React.useEffect(function () {
|
|
1698
|
+
if (open && menuOpen && openMenuId !== menuId) {
|
|
1699
|
+
setOpen(false);
|
|
1700
|
+
}
|
|
1701
|
+
}, [menuId, menuOpen, open, openMenuId]);
|
|
1702
|
+
/********************************************************************************************************************
|
|
1703
|
+
* Event Handler
|
|
1704
|
+
* ******************************************************************************************************************/
|
|
1705
|
+
var handleClick = React.useCallback(function () {
|
|
1706
|
+
setOpen(function (old) { return !old; });
|
|
1707
|
+
if (!open) {
|
|
1708
|
+
setMenuOpen(true, menuId);
|
|
1709
|
+
}
|
|
1710
|
+
else {
|
|
1711
|
+
setMenuOpen(false, menuId);
|
|
1712
|
+
}
|
|
1713
|
+
}, [menuId, open, setMenuOpen]);
|
|
1714
|
+
var handleClose = React.useCallback(function () {
|
|
1715
|
+
if (open) {
|
|
1716
|
+
setOpen(false);
|
|
1717
|
+
setMenuOpen(false, menuId);
|
|
1718
|
+
}
|
|
1719
|
+
}, [menuId, open, setMenuOpen]);
|
|
1720
|
+
var handleListKeyDown = React.useCallback(function (event) {
|
|
1721
|
+
if (event.key === 'Tab') {
|
|
1722
|
+
event.preventDefault();
|
|
1723
|
+
if (open) {
|
|
1724
|
+
setOpen(false);
|
|
1725
|
+
setMenuOpen(false, menuId);
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
else if (event.key === 'Escape') {
|
|
1729
|
+
if (open) {
|
|
1730
|
+
setOpen(false);
|
|
1731
|
+
setMenuOpen(false, menuId);
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
}, [menuId, open, setMenuOpen]);
|
|
1735
|
+
/********************************************************************************************************************
|
|
1736
|
+
* Memo
|
|
1737
|
+
* ******************************************************************************************************************/
|
|
1738
|
+
var finalMenuList = React.useMemo(function () {
|
|
1739
|
+
return React.cloneElement(menuList, {
|
|
1740
|
+
autoFocusItem: open,
|
|
1741
|
+
id: menuId,
|
|
1742
|
+
'aria-labelledby': buttonId,
|
|
1743
|
+
onKeyDown: handleListKeyDown,
|
|
1744
|
+
onClick: handleClose,
|
|
1745
|
+
});
|
|
1746
|
+
}, [buttonId, handleClose, handleListKeyDown, menuId, menuList, open]);
|
|
1747
|
+
/********************************************************************************************************************
|
|
1748
|
+
* Variable
|
|
1749
|
+
* ******************************************************************************************************************/
|
|
1750
|
+
var icon = !startIcon && !children ? 'MoreVert' : undefined;
|
|
1751
|
+
/********************************************************************************************************************
|
|
1752
|
+
* Render
|
|
1753
|
+
* ******************************************************************************************************************/
|
|
1754
|
+
return (React.createElement("span", null,
|
|
1755
|
+
React.createElement(reactComponent.PdgButton, __assign({ ref: function (r) {
|
|
1756
|
+
if (ref) {
|
|
1757
|
+
if (typeof ref === 'function') {
|
|
1758
|
+
ref(r);
|
|
1759
|
+
}
|
|
1760
|
+
else {
|
|
1761
|
+
ref.current = r;
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
anchorRef.current = r;
|
|
1765
|
+
}, id: buttonId, variant: variant, "aria-controls": open ? menuId : undefined, "aria-expanded": open ? 'true' : undefined, "aria-haspopup": 'true', className: classNames(className, 'TableMenuButton'), type: 'button', size: 'small', sx: __assign({ minWidth: 0, pl: !children ? 0.7 : icon || startIcon ? 0.7 : variant === 'text' ? 1.2 : 0.7 }, initSx), color: color, startIcon: icon, onClick: handleClick }, props), children),
|
|
1766
|
+
React.createElement(material.Popper, { className: 'TableMenuButton-Popper', open: open, anchorEl: anchorRef.current, role: undefined, placement: placement, transition: true, style: { zIndex: inModal ? (zIndex === undefined ? 1301 : zIndex) : zIndex } }, function (_a) {
|
|
1767
|
+
var TransitionProps = _a.TransitionProps, placement = _a.placement;
|
|
1768
|
+
var placements = placement.split('-');
|
|
1769
|
+
var transformOrigin;
|
|
1770
|
+
if (placements[0] === 'left') {
|
|
1771
|
+
transformOrigin = 'right';
|
|
1772
|
+
// if (placements.length > 1) {
|
|
1773
|
+
// if (placements[1] === 'start') {
|
|
1774
|
+
// transformOrigin += ' top';
|
|
1775
|
+
// } else if (placements[1] === 'end') {
|
|
1776
|
+
// transformOrigin += ' bottom';
|
|
1777
|
+
// }
|
|
1778
|
+
// }
|
|
1779
|
+
}
|
|
1780
|
+
else if (placements[0] === 'right') {
|
|
1781
|
+
transformOrigin = 'left';
|
|
1782
|
+
// if (placements.length > 1) {
|
|
1783
|
+
// if (placements[1] === 'start') {
|
|
1784
|
+
// transformOrigin += ' top';
|
|
1785
|
+
// } else if (placements[1] === 'end') {
|
|
1786
|
+
// transformOrigin += ' bottom';
|
|
1787
|
+
// }
|
|
1788
|
+
// }
|
|
1789
|
+
}
|
|
1790
|
+
else if (placements[0] === 'top') {
|
|
1791
|
+
transformOrigin = 'bottom';
|
|
1792
|
+
// if (placements.length > 1) {
|
|
1793
|
+
// if (placements[1] === 'start') {
|
|
1794
|
+
// transformOrigin += ' left';
|
|
1795
|
+
// } else if (placements[1] === 'end') {
|
|
1796
|
+
// transformOrigin += ' right';
|
|
1797
|
+
// }
|
|
1798
|
+
// }
|
|
1799
|
+
}
|
|
1800
|
+
else if (placements[0] === 'bottom') {
|
|
1801
|
+
transformOrigin = 'top';
|
|
1802
|
+
// if (placements.length > 1) {
|
|
1803
|
+
// if (placements[1] === 'start') {
|
|
1804
|
+
// transformOrigin += ' left';
|
|
1805
|
+
// } else if (placements[1] === 'end') {
|
|
1806
|
+
// transformOrigin += ' right';
|
|
1807
|
+
// }
|
|
1808
|
+
// }
|
|
1809
|
+
}
|
|
1810
|
+
else {
|
|
1811
|
+
transformOrigin = 'top';
|
|
1812
|
+
}
|
|
1813
|
+
return (React.createElement(material.Grow, __assign({}, TransitionProps, { style: {
|
|
1814
|
+
transformOrigin: transformOrigin,
|
|
1815
|
+
} }),
|
|
1816
|
+
React.createElement(material.Paper, null,
|
|
1817
|
+
React.createElement(material.ClickAwayListener, { onClickAway: handleClose }, finalMenuList))));
|
|
1818
|
+
})));
|
|
1819
|
+
});var Label = material.styled(material.Box)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: 12px;\n font-weight: bold;\n"], ["\n font-size: 12px;\n font-weight: bold;\n"])));
|
|
1820
|
+
var ValueWrap = material.styled(material.Box)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-top: 3px;\n position: relative;\n display: flex;\n flex-direction: row;\n"], ["\n margin-top: 3px;\n position: relative;\n display: flex;\n flex-direction: row;\n"])));
|
|
1821
|
+
var Value = material.styled('div')(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex: 1;\n"], ["\n flex: 1;\n"])));
|
|
1822
|
+
var ValueEllipsis = material.styled('div')(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n flex: 1;\n position: relative;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"], ["\n flex: 1;\n position: relative;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
|
|
1823
|
+
var ValueClipboard = material.styled('div')(templateObject_5 || (templateObject_5 = __makeTemplateObject([""], [""])));
|
|
1824
|
+
var ClipboardIconButton = material.styled(material.IconButton)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-top: -10px;\n margin-bottom: -10px;\n"], ["\n margin-top: -10px;\n margin-bottom: -10px;\n"])));
|
|
1825
|
+
var Line = material.styled('div')(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n border-top: 1px solid #efefef;\n height: 1px;\n flex: 1;\n"], ["\n border-top: 1px solid #efefef;\n height: 1px;\n flex: 1;\n"])));
|
|
1826
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;var InfoTable = function (_a) {
|
|
1827
|
+
/********************************************************************************************************************
|
|
1828
|
+
* Memo
|
|
1829
|
+
* ******************************************************************************************************************/
|
|
1830
|
+
var cols = _a.cols, _b = _a.spacing, spacing = _b === void 0 ? 2 : _b, columnSpacing = _a.columnSpacing, _c = _a.rowSpacing, rowSpacing = _c === void 0 ? 3 : _c, className = _a.className, style = _a.style, sx = _a.sx, labelClassName = _a.labelClassName, _d = _a.labelColor, labelColor = _d === void 0 ? 'primary' : _d, labelStyle = _a.labelStyle, labelSx = _a.labelSx, _e = _a.dividerColor, dividerColor = _e === void 0 ? 'gray' : _e, valueClassName = _a.valueClassName, valueStyle = _a.valueStyle, valueSx = _a.valueSx, ellipsis = _a.ellipsis, valueUnderline = _a.valueUnderline, info = _a.info, items = _a.items, onCopyToClipboard = _a.onCopyToClipboard;
|
|
1831
|
+
var renderItems = React.useMemo(function () {
|
|
1832
|
+
return items.filter(function (item) { return !!item && (!item.onHide || !item.onHide(info)); }).map(function (item) {
|
|
1833
|
+
/** data */
|
|
1834
|
+
var data = undefined;
|
|
1835
|
+
if (item.name !== undefined) {
|
|
1836
|
+
if (info[item.name] !== undefined) {
|
|
1837
|
+
if (info[item.name] instanceof Date) {
|
|
1838
|
+
data = dayjs(info[item.name]).format('YYYY-MM-DD HH:mm:ss');
|
|
1839
|
+
}
|
|
1840
|
+
else if (info[item.name] instanceof dayjs) {
|
|
1841
|
+
data = info[item.name].format('YYYY-MM-DD HH:mm:ss');
|
|
1842
|
+
}
|
|
1843
|
+
else {
|
|
1844
|
+
data = info[item.name];
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
if (item.onRender) {
|
|
1849
|
+
data = item.onRender(info);
|
|
1850
|
+
}
|
|
1851
|
+
else if (util.notEmpty(data)) {
|
|
1852
|
+
switch (item.type) {
|
|
1853
|
+
case 'number':
|
|
1854
|
+
if (typeof data === 'string' || typeof data === 'number') {
|
|
1855
|
+
data = util.numberFormat(data);
|
|
1856
|
+
if (item.numberPrefix) {
|
|
1857
|
+
data = (React.createElement(React.Fragment, null,
|
|
1858
|
+
React.createElement("span", { style: { opacity: 0.5, marginRight: 2 } }, item.numberPrefix),
|
|
1859
|
+
data));
|
|
1860
|
+
}
|
|
1861
|
+
if (item.numberSuffix) {
|
|
1862
|
+
data = (React.createElement(React.Fragment, null,
|
|
1863
|
+
data,
|
|
1864
|
+
React.createElement("span", { style: { opacity: 0.5, marginLeft: 2 } }, item.numberSuffix)));
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
break;
|
|
1868
|
+
case 'tel':
|
|
1869
|
+
if (typeof data === 'string') {
|
|
1870
|
+
data = util.telNoAutoDash(data);
|
|
1871
|
+
}
|
|
1872
|
+
break;
|
|
1873
|
+
case 'email':
|
|
1874
|
+
if (typeof data === 'string') {
|
|
1875
|
+
data = (React.createElement(React.Fragment, null,
|
|
1876
|
+
React.createElement("a", { href: "mailto:".concat(data) }, data)));
|
|
1877
|
+
}
|
|
1878
|
+
break;
|
|
1879
|
+
case 'url':
|
|
1880
|
+
if (typeof data === 'string' && data.toLowerCase().startsWith('http')) {
|
|
1881
|
+
data = (React.createElement(React.Fragment, null,
|
|
1882
|
+
React.createElement("a", { href: data, target: '_blank' }, data)));
|
|
1883
|
+
}
|
|
1884
|
+
break;
|
|
1885
|
+
case 'company_no':
|
|
1886
|
+
if (typeof data === 'string') {
|
|
1887
|
+
data = util.companyNoAutoDash(data);
|
|
1888
|
+
}
|
|
1889
|
+
break;
|
|
1890
|
+
case 'personal_no':
|
|
1891
|
+
if (typeof data === 'string') {
|
|
1892
|
+
data = util.personalNoAutoDash(data);
|
|
1893
|
+
}
|
|
1894
|
+
break;
|
|
1895
|
+
case 'date':
|
|
1896
|
+
if (typeof data === 'string' || typeof data === 'number') {
|
|
1897
|
+
data = dayjs(data, item.dateFormat).format('YYYY-MM-DD');
|
|
1898
|
+
}
|
|
1899
|
+
break;
|
|
1900
|
+
case 'datetime':
|
|
1901
|
+
if (typeof data === 'string' || typeof data === 'number') {
|
|
1902
|
+
var dt = dayjs(data, item.dateFormat);
|
|
1903
|
+
data = (React.createElement(React.Fragment, null,
|
|
1904
|
+
React.createElement("span", null, dt.format('YYYY-MM-DD')),
|
|
1905
|
+
item.dateTwoLine ? React.createElement("br", null) : ' ',
|
|
1906
|
+
React.createElement("span", { style: { opacity: 0.5 } }, dt.format('HH:mm:ss'))));
|
|
1907
|
+
}
|
|
1908
|
+
break;
|
|
1909
|
+
case 'date-hour':
|
|
1910
|
+
if (typeof data === 'string' || typeof data === 'number') {
|
|
1911
|
+
var dt = dayjs(data, item.dateFormat);
|
|
1912
|
+
data = (React.createElement(React.Fragment, null,
|
|
1913
|
+
React.createElement("span", null, dt.format('YYYY-MM-DD')),
|
|
1914
|
+
item.dateTwoLine ? React.createElement("br", null) : ' ',
|
|
1915
|
+
React.createElement("span", { style: { opacity: 0.5 } }, dt.format('HH시'))));
|
|
1916
|
+
}
|
|
1917
|
+
break;
|
|
1918
|
+
case 'date-minute':
|
|
1919
|
+
if (typeof data === 'string' || typeof data === 'number') {
|
|
1920
|
+
var dt = dayjs(data, item.dateFormat);
|
|
1921
|
+
data = (React.createElement(React.Fragment, null,
|
|
1922
|
+
React.createElement("span", null, dt.format('YYYY-MM-DD')),
|
|
1923
|
+
item.dateTwoLine ? React.createElement("br", null) : ' ',
|
|
1924
|
+
React.createElement("span", { style: { opacity: 0.5 } }, dt.format('HH시 MM분'))));
|
|
1925
|
+
}
|
|
1926
|
+
break;
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
if (util.empty(data))
|
|
1930
|
+
data = item.onRenderEmpty ? item.onRenderEmpty(info) : React.createElement(React.Fragment, null, "\u00A0");
|
|
1931
|
+
/** copyToClipboardText */
|
|
1932
|
+
var copyToClipboardText = item.clipboardText || (typeof data === 'string' ? data : typeof data === 'number' ? data.toString() : '');
|
|
1933
|
+
/** sizeProps */
|
|
1934
|
+
var sizeProps = {};
|
|
1935
|
+
if (typeof cols === 'number') {
|
|
1936
|
+
sizeProps.xs = 12 / cols;
|
|
1937
|
+
}
|
|
1938
|
+
else {
|
|
1939
|
+
if (cols.xs)
|
|
1940
|
+
sizeProps.xs = 12 / cols.xs;
|
|
1941
|
+
if (cols.sm)
|
|
1942
|
+
sizeProps.sm = 12 / cols.sm;
|
|
1943
|
+
if (cols.md)
|
|
1944
|
+
sizeProps.md = 12 / cols.md;
|
|
1945
|
+
if (cols.lg)
|
|
1946
|
+
sizeProps.lg = 12 / cols.lg;
|
|
1947
|
+
if (cols.xl)
|
|
1948
|
+
sizeProps.xl = 12 / cols.xl;
|
|
1949
|
+
}
|
|
1950
|
+
if (item.xs)
|
|
1951
|
+
sizeProps.xs = item.xs;
|
|
1952
|
+
if (item.sm)
|
|
1953
|
+
sizeProps.sm = item.sm;
|
|
1954
|
+
if (item.md)
|
|
1955
|
+
sizeProps.md = item.md;
|
|
1956
|
+
if (item.lg)
|
|
1957
|
+
sizeProps.lg = item.lg;
|
|
1958
|
+
if (item.xl)
|
|
1959
|
+
sizeProps.xl = item.xl;
|
|
1960
|
+
if (item.onXs)
|
|
1961
|
+
sizeProps.xs = item.onXs(info);
|
|
1962
|
+
if (item.onSm)
|
|
1963
|
+
sizeProps.sm = item.onSm(info);
|
|
1964
|
+
if (item.onMd)
|
|
1965
|
+
sizeProps.md = item.onMd(info);
|
|
1966
|
+
if (item.onLg)
|
|
1967
|
+
sizeProps.lg = item.onLg(info);
|
|
1968
|
+
if (item.onXl)
|
|
1969
|
+
sizeProps.xl = item.onXl(info);
|
|
1970
|
+
return { item: item, data: data, copyToClipboardText: copyToClipboardText, sizeProps: sizeProps };
|
|
1971
|
+
});
|
|
1972
|
+
}, [info, items, cols]);
|
|
1973
|
+
var content = React.useMemo(function () {
|
|
1974
|
+
return renderItems.map(function (_a, idx) {
|
|
1975
|
+
var item = _a.item, data = _a.data, copyToClipboardText = _a.copyToClipboardText, sizeProps = _a.sizeProps;
|
|
1976
|
+
var finalLabelColor = typographyColorToSxColor(item.type === 'divider' ? item.dividerColor || dividerColor : item.labelColor || labelColor);
|
|
1977
|
+
var finalLabelSx = combineSx(labelSx, item.labelSx, !!finalLabelColor && { color: finalLabelColor });
|
|
1978
|
+
var finalValueSx = combineSx(valueSx, item.valueSx);
|
|
1979
|
+
var valueUnderlineStyle = valueUnderline
|
|
1980
|
+
? { borderBottom: '1px solid #efefef', paddingBottom: 5 }
|
|
1981
|
+
: undefined;
|
|
1982
|
+
return item.type === 'divider' ? (React.createElement(material.Grid, { key: idx, item: true, xs: 12 },
|
|
1983
|
+
React.createElement(material.Stack, { direction: 'row', spacing: 0.5, alignItems: 'center' },
|
|
1984
|
+
item.icon && (React.createElement(reactComponent.PdgIcon, { sx: { color: item.dividerColor || dividerColor }, size: 'small' }, item.icon)),
|
|
1985
|
+
item.label && (React.createElement(Label, { className: classNames(labelClassName, item.labelClassName), style: __assign(__assign({}, item.labelStyle), labelStyle), sx: finalLabelSx }, item.label)),
|
|
1986
|
+
item.dividerLine && (React.createElement(React.Fragment, null, item.icon || item.label ? (React.createElement("div", { style: { flex: 1, paddingLeft: 5 } },
|
|
1987
|
+
React.createElement(Line, null))) : (React.createElement(Line, null))))))) : (React.createElement(material.Grid, __assign({ key: idx, item: true }, sizeProps, { className: item.className, style: item.style, sx: item.sx }),
|
|
1988
|
+
React.createElement(material.Stack, { direction: 'row', spacing: 0.5, alignItems: 'center' },
|
|
1989
|
+
item.icon && (React.createElement(reactComponent.PdgIcon, { sx: { color: finalLabelColor }, size: 'small' }, "CalendarMonth")),
|
|
1990
|
+
React.createElement(Label, { className: classNames(labelClassName, item.labelClassName), style: __assign(__assign({}, item.labelStyle), labelStyle), sx: finalLabelSx }, item.label)),
|
|
1991
|
+
React.createElement(ValueWrap, { className: classNames(valueClassName, item.valueClassName), style: __assign(__assign(__assign({}, valueStyle), item.valueStyle), valueUnderlineStyle), sx: finalValueSx },
|
|
1992
|
+
item.ellipsis || ellipsis ? React.createElement(ValueEllipsis, null, data) : React.createElement(Value, null, data),
|
|
1993
|
+
item.clipboard && util.notEmpty(copyToClipboardText) && (React.createElement(ValueClipboard, null,
|
|
1994
|
+
React.createElement(reactCopyToClipboard.CopyToClipboard, { text: copyToClipboardText, onCopy: onCopyToClipboard ? function () { return onCopyToClipboard(item, copyToClipboardText); } : undefined },
|
|
1995
|
+
React.createElement(ClipboardIconButton, __assign({ size: 'small', color: 'primary' }, item.clipboardProps),
|
|
1996
|
+
React.createElement(reactComponent.PdgIcon, null, item.clipboardIcon || 'ContentPaste'))))))));
|
|
1997
|
+
});
|
|
1998
|
+
}, [
|
|
1999
|
+
dividerColor,
|
|
2000
|
+
ellipsis,
|
|
2001
|
+
labelClassName,
|
|
2002
|
+
labelColor,
|
|
2003
|
+
labelStyle,
|
|
2004
|
+
labelSx,
|
|
2005
|
+
onCopyToClipboard,
|
|
2006
|
+
renderItems,
|
|
2007
|
+
valueClassName,
|
|
2008
|
+
valueStyle,
|
|
2009
|
+
valueSx,
|
|
2010
|
+
valueUnderline,
|
|
2011
|
+
]);
|
|
2012
|
+
/********************************************************************************************************************
|
|
2013
|
+
* Render
|
|
2014
|
+
* ******************************************************************************************************************/
|
|
2015
|
+
return (React.createElement(material.Grid, { container: true, spacing: spacing, columnSpacing: columnSpacing, rowSpacing: rowSpacing, className: classNames('InfoTable', className), style: style, sx: sx }, content));
|
|
2016
|
+
};exports.InfoTable=InfoTable;exports.SearchTable=SearchTable;exports.Table=Table;exports.TableButton=TableButton$1;exports.TableMenuButton=TableMenuButton;
|