react-table-edit 1.2.47 → 1.2.49
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/index.d.mts +5 -6
- package/dist/index.d.ts +5 -6
- package/dist/index.js +1795 -1795
- package/dist/index.mjs +1801 -1801
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/component/table/index.tsx
|
|
2
|
-
import { Fragment as Fragment21, forwardRef as
|
|
2
|
+
import { Fragment as Fragment21, forwardRef as forwardRef5, useEffect as useEffect9, useImperativeHandle, useRef as useRef4, useState as useState9 } from "react";
|
|
3
3
|
import { Button as Button6, DropdownMenu as DropdownMenu4, DropdownToggle as DropdownToggle4, Input as Input8, UncontrolledDropdown, UncontrolledTooltip as UncontrolledTooltip5 } from "reactstrap";
|
|
4
4
|
import classnames9 from "classnames";
|
|
5
5
|
import { useTranslation as useTranslation12 } from "react-i18next";
|
|
@@ -316,254 +316,28 @@ var formatDateTime = (data, format = "dd/MM/yyyy") => {
|
|
|
316
316
|
return format.replace(/dd|MM|yyyy|HH|mm/g, (match) => map[match]);
|
|
317
317
|
};
|
|
318
318
|
|
|
319
|
-
// src/component/
|
|
320
|
-
import {
|
|
321
|
-
import {
|
|
322
|
-
DropdownItem as DropdownItem2,
|
|
323
|
-
DropdownMenu as DropdownMenu2,
|
|
324
|
-
DropdownToggle as DropdownToggle2,
|
|
325
|
-
Dropdown as Dropdown2,
|
|
326
|
-
Input as Input4,
|
|
327
|
-
Row,
|
|
328
|
-
Button as Button2,
|
|
329
|
-
Col
|
|
330
|
-
} from "reactstrap";
|
|
331
|
-
import { useForm } from "react-hook-form";
|
|
332
|
-
import { yupResolver } from "@hookform/resolvers/yup";
|
|
333
|
-
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
319
|
+
// src/component/table/paging/index.tsx
|
|
320
|
+
import { ChevronRight, ChevronLeft, ChevronsLeft, ChevronsRight } from "becoxy-icons";
|
|
334
321
|
import classNames2 from "classnames";
|
|
335
|
-
|
|
336
|
-
// src/component/input-text/index.tsx
|
|
337
|
-
import { Controller } from "react-hook-form";
|
|
338
|
-
import { Input as Input2, Label, FormFeedback } from "reactstrap";
|
|
339
|
-
import classnames from "classnames";
|
|
340
|
-
import { Fragment as Fragment3 } from "react";
|
|
341
|
-
import { useTranslation } from "react-i18next";
|
|
342
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
343
|
-
var TextInput = (props) => {
|
|
344
|
-
const { t } = useTranslation();
|
|
345
|
-
const { control, id, name, min, max, type, label, labelSize, required, errors, height, disabled, row, isLabel, placeholder, autoFocus, inLine, callback, readOnly, classes, ...rest } = props;
|
|
346
|
-
const renderLabel = () => {
|
|
347
|
-
return /* @__PURE__ */ jsx3(Fragment3, { children: isLabel === false ? "" : /* @__PURE__ */ jsxs3(Label, { for: name, children: [
|
|
348
|
-
t(label ? label : ""),
|
|
349
|
-
" ",
|
|
350
|
-
required ? /* @__PURE__ */ jsx3("span", { className: "text-danger", children: "*" }) : "",
|
|
351
|
-
" "
|
|
352
|
-
] }) });
|
|
353
|
-
};
|
|
354
|
-
const renderInput = () => {
|
|
355
|
-
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
356
|
-
/* @__PURE__ */ jsx3(
|
|
357
|
-
Controller,
|
|
358
|
-
{
|
|
359
|
-
name,
|
|
360
|
-
control,
|
|
361
|
-
render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsx3(
|
|
362
|
-
Input2,
|
|
363
|
-
{
|
|
364
|
-
id,
|
|
365
|
-
value: !isNullOrUndefined(value) ? value : "",
|
|
366
|
-
onChange: (val) => {
|
|
367
|
-
if (min || max) {
|
|
368
|
-
if (min && Number(val.target.value) >= min) {
|
|
369
|
-
onChange(val.target.value);
|
|
370
|
-
if (callback) {
|
|
371
|
-
callback(val);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
if (max && Number(val.target.value) <= max) {
|
|
375
|
-
onChange(val.target.value);
|
|
376
|
-
if (callback) {
|
|
377
|
-
callback(val);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
} else {
|
|
381
|
-
onChange(val.target.value);
|
|
382
|
-
if (callback) {
|
|
383
|
-
callback(val);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
},
|
|
387
|
-
style: { height: `${height}px` },
|
|
388
|
-
autoFocus,
|
|
389
|
-
disabled,
|
|
390
|
-
placeholder,
|
|
391
|
-
type: type ? type : "text",
|
|
392
|
-
invalid: errors && true,
|
|
393
|
-
className: "h-100",
|
|
394
|
-
rows: row,
|
|
395
|
-
min,
|
|
396
|
-
max,
|
|
397
|
-
readOnly,
|
|
398
|
-
...rest
|
|
399
|
-
}
|
|
400
|
-
)
|
|
401
|
-
}
|
|
402
|
-
),
|
|
403
|
-
errors && /* @__PURE__ */ jsx3(FormFeedback, { children: errors?.message })
|
|
404
|
-
] });
|
|
405
|
-
};
|
|
406
|
-
return /* @__PURE__ */ jsx3(Fragment3, { children: /* @__PURE__ */ jsxs3(
|
|
407
|
-
"div",
|
|
408
|
-
{
|
|
409
|
-
className: classnames(
|
|
410
|
-
" align",
|
|
411
|
-
{
|
|
412
|
-
[labelSize ? labelSize : ""]: labelSize,
|
|
413
|
-
[classes ? classes : ""]: classes,
|
|
414
|
-
"form-row-inline-error": errors
|
|
415
|
-
},
|
|
416
|
-
inLine === false ? "form-group " : "form-row-inline d-flex"
|
|
417
|
-
),
|
|
418
|
-
children: [
|
|
419
|
-
renderLabel(),
|
|
420
|
-
/* @__PURE__ */ jsx3("div", { className: classnames("form-input-content", { "hidden-label": isLabel === false }), children: renderInput() })
|
|
421
|
-
]
|
|
422
|
-
}
|
|
423
|
-
) });
|
|
424
|
-
};
|
|
425
|
-
var input_text_default = TextInput;
|
|
426
|
-
|
|
427
|
-
// src/component/input-number/index.tsx
|
|
428
|
-
import { Controller as Controller2 } from "react-hook-form";
|
|
429
|
-
import { Label as Label2, FormFeedback as FormFeedback2 } from "reactstrap";
|
|
430
|
-
import classnames2 from "classnames";
|
|
431
|
-
import { Fragment as Fragment4 } from "react";
|
|
432
|
-
import { NumericFormat } from "react-number-format";
|
|
322
|
+
import { Fragment as Fragment5, useEffect as useEffect4, useState as useState3 } from "react";
|
|
433
323
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
434
|
-
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
435
|
-
var NumberInput = (props) => {
|
|
436
|
-
const {
|
|
437
|
-
id,
|
|
438
|
-
control,
|
|
439
|
-
fractionCurrency,
|
|
440
|
-
name,
|
|
441
|
-
min,
|
|
442
|
-
max,
|
|
443
|
-
label,
|
|
444
|
-
labelSize,
|
|
445
|
-
required,
|
|
446
|
-
errors,
|
|
447
|
-
disabled,
|
|
448
|
-
isLabel,
|
|
449
|
-
fixedDecimalScale,
|
|
450
|
-
placeholder,
|
|
451
|
-
inLine,
|
|
452
|
-
callback,
|
|
453
|
-
decimalSeparator = ",",
|
|
454
|
-
thousandSeparator = ".",
|
|
455
|
-
classes,
|
|
456
|
-
width,
|
|
457
|
-
allowNegative
|
|
458
|
-
} = props;
|
|
459
|
-
const { t } = useTranslation2();
|
|
460
|
-
const renderLabel = () => {
|
|
461
|
-
return /* @__PURE__ */ jsx4(Fragment4, { children: isLabel === false ? "" : /* @__PURE__ */ jsxs4(Label2, { className: "form-label", for: name, children: [
|
|
462
|
-
t(label ? label : ""),
|
|
463
|
-
" ",
|
|
464
|
-
required ? /* @__PURE__ */ jsx4("span", { className: "text-danger", children: "*" }) : "",
|
|
465
|
-
" "
|
|
466
|
-
] }) });
|
|
467
|
-
};
|
|
468
|
-
const renderInput = () => {
|
|
469
|
-
return /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
470
|
-
/* @__PURE__ */ jsx4(
|
|
471
|
-
Controller2,
|
|
472
|
-
{
|
|
473
|
-
name,
|
|
474
|
-
control,
|
|
475
|
-
render: ({ field: { value, onChange } }) => {
|
|
476
|
-
let floatValue = parseFloat(value);
|
|
477
|
-
const numericFormatProps = {
|
|
478
|
-
value: !isNullOrUndefined(value) ? value : "",
|
|
479
|
-
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
480
|
-
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
481
|
-
allowNegative: allowNegative ?? false,
|
|
482
|
-
decimalScale: fractionCurrency ?? 0,
|
|
483
|
-
fixedDecimalScale
|
|
484
|
-
};
|
|
485
|
-
return /* @__PURE__ */ jsx4(
|
|
486
|
-
NumericFormat,
|
|
487
|
-
{
|
|
488
|
-
...numericFormatProps,
|
|
489
|
-
className: classnames2("form-control text-right", {
|
|
490
|
-
"is-invalid": errors
|
|
491
|
-
}),
|
|
492
|
-
onValueChange: (values) => {
|
|
493
|
-
floatValue = values?.floatValue;
|
|
494
|
-
const textBeforeDot = values?.value.split(".")[1];
|
|
495
|
-
onChange(textBeforeDot ? parseFloat(values?.value).toFixed(textBeforeDot.length) : values?.floatValue);
|
|
496
|
-
},
|
|
497
|
-
onFocus: (e) => {
|
|
498
|
-
e.target.setSelectionRange(0, e.target.innerText.length - 1);
|
|
499
|
-
},
|
|
500
|
-
onChange: () => {
|
|
501
|
-
if (callback) {
|
|
502
|
-
callback(floatValue);
|
|
503
|
-
}
|
|
504
|
-
},
|
|
505
|
-
onBlur: () => {
|
|
506
|
-
if (max && floatValue > max) {
|
|
507
|
-
onChange(max);
|
|
508
|
-
} else if (min && floatValue < min) {
|
|
509
|
-
onChange(min);
|
|
510
|
-
} else {
|
|
511
|
-
onChange(floatValue);
|
|
512
|
-
}
|
|
513
|
-
},
|
|
514
|
-
placeholder,
|
|
515
|
-
disabled
|
|
516
|
-
}
|
|
517
|
-
);
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
),
|
|
521
|
-
errors && /* @__PURE__ */ jsx4(FormFeedback2, { children: errors?.message })
|
|
522
|
-
] });
|
|
523
|
-
};
|
|
524
|
-
return /* @__PURE__ */ jsx4(Fragment4, { children: /* @__PURE__ */ jsxs4(
|
|
525
|
-
"div",
|
|
526
|
-
{
|
|
527
|
-
className: classnames2(
|
|
528
|
-
" align",
|
|
529
|
-
{
|
|
530
|
-
[labelSize ? labelSize : ""]: labelSize,
|
|
531
|
-
[classes ? classes : ""]: classes,
|
|
532
|
-
"form-row-inline-error": errors
|
|
533
|
-
},
|
|
534
|
-
inLine === false ? "form-group " : "form-row-inline d-flex"
|
|
535
|
-
),
|
|
536
|
-
children: [
|
|
537
|
-
renderLabel(),
|
|
538
|
-
/* @__PURE__ */ jsx4("div", { style: { width: width ? width : void 0 }, className: classnames2("form-input-content", { "hidden-label": isLabel === false }), children: renderInput() })
|
|
539
|
-
]
|
|
540
|
-
}
|
|
541
|
-
) });
|
|
542
|
-
};
|
|
543
|
-
var input_number_default = NumberInput;
|
|
544
|
-
|
|
545
|
-
// src/component/edit-form/select-table/index.tsx
|
|
546
|
-
import { Controller as Controller3 } from "react-hook-form";
|
|
547
|
-
import { FormFeedback as FormFeedback3, Label as Label3, UncontrolledTooltip as UncontrolledTooltip2 } from "reactstrap";
|
|
548
|
-
import classnames4 from "classnames";
|
|
549
|
-
import { Fragment as Fragment7 } from "react";
|
|
550
324
|
|
|
551
325
|
// src/component/select-table/index.tsx
|
|
552
|
-
import React, { forwardRef, Fragment as
|
|
326
|
+
import React, { forwardRef, Fragment as Fragment3, useEffect as useEffect3, useMemo, useRef, useState as useState2 } from "react";
|
|
553
327
|
import {
|
|
554
328
|
DropdownItem,
|
|
555
329
|
DropdownMenu,
|
|
556
330
|
DropdownToggle,
|
|
557
331
|
Dropdown,
|
|
558
332
|
Button,
|
|
559
|
-
Input as
|
|
333
|
+
Input as Input2,
|
|
560
334
|
Spinner,
|
|
561
335
|
UncontrolledTooltip
|
|
562
336
|
} from "reactstrap";
|
|
563
|
-
import { useTranslation
|
|
564
|
-
import
|
|
337
|
+
import { useTranslation } from "react-i18next";
|
|
338
|
+
import classnames from "classnames";
|
|
565
339
|
import { Plus } from "becoxy-icons";
|
|
566
|
-
import { Fragment as
|
|
340
|
+
import { Fragment as Fragment4, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
567
341
|
var defaultMaxHeight = 250;
|
|
568
342
|
var SelectTable = forwardRef((props, ref) => {
|
|
569
343
|
const {
|
|
@@ -607,7 +381,7 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
607
381
|
const [searchTerm, setSearchTerm] = useState2("");
|
|
608
382
|
const [optionsLoad, setOptionsLoad] = useState2();
|
|
609
383
|
const [haveCreateNew, setHaveCreateNew] = useState2(false);
|
|
610
|
-
const { t } =
|
|
384
|
+
const { t } = useTranslation();
|
|
611
385
|
const isSelectedAll = useMemo(() => {
|
|
612
386
|
return isMulti === true && (optionsLoad ? optionsLoad : options).length > 0 && value?.length >= (optionsLoad ? optionsLoad : options).length;
|
|
613
387
|
}, [optionsLoad, options, value]);
|
|
@@ -798,13 +572,13 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
798
572
|
}, 100);
|
|
799
573
|
};
|
|
800
574
|
const renderHeaderCol = (col, indexCol) => {
|
|
801
|
-
return /* @__PURE__ */
|
|
802
|
-
|
|
575
|
+
return /* @__PURE__ */ jsx3(
|
|
576
|
+
Fragment3,
|
|
803
577
|
{
|
|
804
|
-
children: col.visible !== false && /* @__PURE__ */
|
|
578
|
+
children: col.visible !== false && /* @__PURE__ */ jsx3(
|
|
805
579
|
"th",
|
|
806
580
|
{
|
|
807
|
-
className:
|
|
581
|
+
className: classnames(
|
|
808
582
|
`r-select-headercell fix-${col.fixedType}`,
|
|
809
583
|
{ "cell-fixed": col.fixedType }
|
|
810
584
|
),
|
|
@@ -814,7 +588,7 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
814
588
|
top: `${0 * 35}px`,
|
|
815
589
|
maxWidth: col.maxWidth
|
|
816
590
|
},
|
|
817
|
-
children: /* @__PURE__ */
|
|
591
|
+
children: /* @__PURE__ */ jsx3(
|
|
818
592
|
"div",
|
|
819
593
|
{
|
|
820
594
|
role: "textbox",
|
|
@@ -864,17 +638,17 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
864
638
|
};
|
|
865
639
|
const RenderElement = React.memo((props2) => {
|
|
866
640
|
const { indexRow, row, isSelected, level = 0 } = props2;
|
|
867
|
-
return /* @__PURE__ */
|
|
641
|
+
return /* @__PURE__ */ jsxs3(
|
|
868
642
|
"tr",
|
|
869
643
|
{
|
|
870
644
|
id: `row-select-table-${indexRow}`,
|
|
871
645
|
style: { paddingLeft: 10 * level },
|
|
872
|
-
className:
|
|
646
|
+
className: classnames("r-select-row", { "last-row": indexRow === (optionsLoad ? optionsLoad : options).length - 1 }, { "fisrt-row": indexRow === 0 }),
|
|
873
647
|
children: [
|
|
874
|
-
isMulti && /* @__PURE__ */
|
|
648
|
+
isMulti && /* @__PURE__ */ jsx3(
|
|
875
649
|
"td",
|
|
876
650
|
{
|
|
877
|
-
className:
|
|
651
|
+
className: classnames(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
|
|
878
652
|
style: { width: 40, textAlign: "center", padding: 0, paddingBottom: 6 },
|
|
879
653
|
onClick: (e) => {
|
|
880
654
|
if (isMulti) {
|
|
@@ -893,8 +667,8 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
893
667
|
e.stopPropagation();
|
|
894
668
|
}
|
|
895
669
|
},
|
|
896
|
-
children: /* @__PURE__ */
|
|
897
|
-
|
|
670
|
+
children: /* @__PURE__ */ jsx3(
|
|
671
|
+
Input2,
|
|
898
672
|
{
|
|
899
673
|
checked: isSelected,
|
|
900
674
|
type: "checkbox",
|
|
@@ -915,12 +689,12 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
915
689
|
} else if (col.type === "datetime") {
|
|
916
690
|
valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat ?? "DD/MM/yyyy HH:mm") : "";
|
|
917
691
|
}
|
|
918
|
-
return /* @__PURE__ */
|
|
919
|
-
col.visible !== false && /* @__PURE__ */
|
|
692
|
+
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
693
|
+
col.visible !== false && /* @__PURE__ */ jsx3(
|
|
920
694
|
"td",
|
|
921
695
|
{
|
|
922
696
|
id: `select-${id}-${indexRow}-${indexCol}`,
|
|
923
|
-
className:
|
|
697
|
+
className: classnames(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
|
|
924
698
|
style: {
|
|
925
699
|
minWidth: col.minWidth,
|
|
926
700
|
width: col.width,
|
|
@@ -955,14 +729,14 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
955
729
|
}
|
|
956
730
|
e.stopPropagation();
|
|
957
731
|
},
|
|
958
|
-
children: col.template ? col.template(row, indexRow) : col.type === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */
|
|
732
|
+
children: col.template ? col.template(row, indexRow) : col.type === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ jsxs3("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
959
733
|
" ",
|
|
960
734
|
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
961
735
|
] }) : valueDisplay
|
|
962
736
|
},
|
|
963
737
|
`col-${indexRow}-${indexCol}`
|
|
964
738
|
),
|
|
965
|
-
checkOverflow(indexRow, indexCol) && /* @__PURE__ */
|
|
739
|
+
checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx3(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : valueDisplay })
|
|
966
740
|
] }, indexCol);
|
|
967
741
|
})
|
|
968
742
|
]
|
|
@@ -972,16 +746,16 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
972
746
|
});
|
|
973
747
|
const RenderTable = (props2) => {
|
|
974
748
|
const {} = props2;
|
|
975
|
-
return /* @__PURE__ */
|
|
976
|
-
/* @__PURE__ */
|
|
977
|
-
!(noHeader || (columns?.length ?? 0) === 0) && /* @__PURE__ */
|
|
978
|
-
isMulti && /* @__PURE__ */
|
|
749
|
+
return /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
750
|
+
/* @__PURE__ */ jsxs3("table", { style: { width: "100%" }, children: [
|
|
751
|
+
!(noHeader || (columns?.length ?? 0) === 0) && /* @__PURE__ */ jsx3("thead", { className: "r-select-gridheader", children: /* @__PURE__ */ jsxs3("tr", { className: "r-select-row", role: "row", children: [
|
|
752
|
+
isMulti && /* @__PURE__ */ jsx3("th", { className: classnames(`r-select-headercell`), style: { width: 40, top: `0px` }, children: /* @__PURE__ */ jsx3(
|
|
979
753
|
"div",
|
|
980
754
|
{
|
|
981
755
|
style: { justifyContent: "center" },
|
|
982
|
-
className:
|
|
983
|
-
children: /* @__PURE__ */
|
|
984
|
-
|
|
756
|
+
className: classnames("r-select-headercell-div"),
|
|
757
|
+
children: /* @__PURE__ */ jsx3(
|
|
758
|
+
Input2,
|
|
985
759
|
{
|
|
986
760
|
checked: isSelectedAll,
|
|
987
761
|
type: "checkbox",
|
|
@@ -996,7 +770,7 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
996
770
|
}
|
|
997
771
|
},
|
|
998
772
|
readOnly: true,
|
|
999
|
-
className:
|
|
773
|
+
className: classnames("cursor-pointer", { "d-none": !isMulti }),
|
|
1000
774
|
style: { textAlign: "center", marginTop: 6 }
|
|
1001
775
|
}
|
|
1002
776
|
)
|
|
@@ -1006,37 +780,37 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
1006
780
|
return renderHeaderCol(col, index);
|
|
1007
781
|
})
|
|
1008
782
|
] }) }),
|
|
1009
|
-
(optionsLoad ? optionsLoad : options) && !isLoading && /* @__PURE__ */
|
|
1010
|
-
haveCreateNew && /* @__PURE__ */
|
|
783
|
+
(optionsLoad ? optionsLoad : options) && !isLoading && /* @__PURE__ */ jsx3(Fragment4, { children: /* @__PURE__ */ jsxs3("tbody", { className: "r-select-gridcontent", children: [
|
|
784
|
+
haveCreateNew && /* @__PURE__ */ jsx3(RenderElement, { isSelected: false, indexRow: 0, row: { valueCreate: searchTerm, [fieldValue ?? "value"]: searchTerm, [fieldLabel ?? "label"]: `${t("Create")} '${searchTerm}'`, isCreated: true } }),
|
|
1011
785
|
(optionsLoad ? optionsLoad : options)?.map((row, indexRow) => {
|
|
1012
786
|
const isSelected = isMulti && value?.some((x) => x[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
|
|
1013
|
-
return /* @__PURE__ */
|
|
787
|
+
return /* @__PURE__ */ jsx3(RenderElement, { isSelected: isSelected ?? false, indexRow: indexRow + (haveCreateNew ? 1 : 0), row }, `select-table-${indexRow}`);
|
|
1014
788
|
})
|
|
1015
789
|
] }) })
|
|
1016
790
|
] }),
|
|
1017
|
-
((optionsLoad ? optionsLoad : options)?.length ?? 0) === 0 && !haveCreateNew && !isLoading && /* @__PURE__ */
|
|
1018
|
-
/* @__PURE__ */
|
|
1019
|
-
/* @__PURE__ */
|
|
1020
|
-
/* @__PURE__ */
|
|
1021
|
-
/* @__PURE__ */
|
|
1022
|
-
/* @__PURE__ */
|
|
791
|
+
((optionsLoad ? optionsLoad : options)?.length ?? 0) === 0 && !haveCreateNew && !isLoading && /* @__PURE__ */ jsxs3("div", { className: "r-no-data", children: [
|
|
792
|
+
/* @__PURE__ */ jsx3("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxs3("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [
|
|
793
|
+
/* @__PURE__ */ jsx3("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }),
|
|
794
|
+
/* @__PURE__ */ jsxs3("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [
|
|
795
|
+
/* @__PURE__ */ jsx3("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }),
|
|
796
|
+
/* @__PURE__ */ jsx3("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", fill: "#fafafa" })
|
|
1023
797
|
] })
|
|
1024
798
|
] }) }),
|
|
1025
799
|
t("No data available.")
|
|
1026
800
|
] }),
|
|
1027
|
-
isLoading && /* @__PURE__ */
|
|
1028
|
-
/* @__PURE__ */
|
|
801
|
+
isLoading && /* @__PURE__ */ jsxs3("div", { className: "r-no-data", children: [
|
|
802
|
+
/* @__PURE__ */ jsx3(Spinner, { className: "me-1", children: " " }),
|
|
1029
803
|
t("Loading...")
|
|
1030
804
|
] })
|
|
1031
805
|
] });
|
|
1032
806
|
};
|
|
1033
|
-
return /* @__PURE__ */
|
|
807
|
+
return /* @__PURE__ */ jsx3(
|
|
1034
808
|
"div",
|
|
1035
809
|
{
|
|
1036
|
-
className:
|
|
810
|
+
className: classnames("react-select-table", { "is-invalid": invalid }),
|
|
1037
811
|
ref,
|
|
1038
812
|
id,
|
|
1039
|
-
children: /* @__PURE__ */
|
|
813
|
+
children: /* @__PURE__ */ jsx3("div", { ref: selectTableRef, children: /* @__PURE__ */ jsxs3(
|
|
1040
814
|
Dropdown,
|
|
1041
815
|
{
|
|
1042
816
|
isOpen: dropdownOpen,
|
|
@@ -1044,7 +818,7 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
1044
818
|
},
|
|
1045
819
|
onMouseDown: (e) => e.preventDefault(),
|
|
1046
820
|
children: [
|
|
1047
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ jsxs3(
|
|
1048
822
|
DropdownToggle,
|
|
1049
823
|
{
|
|
1050
824
|
onClick: (e) => {
|
|
@@ -1056,25 +830,25 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
1056
830
|
},
|
|
1057
831
|
tag: "div",
|
|
1058
832
|
style: { width: width ? width : "auto" },
|
|
1059
|
-
className:
|
|
833
|
+
className: classnames("select-table-control", { "r-select-is-disabled": isDisabled }, { "r-select-is-open": dropdownOpen }, { "r-select-is-focus": isFocus }, { "r-select-is-invalid": invalid }),
|
|
1060
834
|
children: [
|
|
1061
|
-
/* @__PURE__ */
|
|
1062
|
-
isMulti ? /* @__PURE__ */
|
|
1063
|
-
return /* @__PURE__ */
|
|
835
|
+
/* @__PURE__ */ jsxs3("div", { className: "select-table-container", children: [
|
|
836
|
+
isMulti ? /* @__PURE__ */ jsx3(Fragment4, { children: /* @__PURE__ */ jsx3("div", { className: classnames("select-value is-mutil", { "d-none": searchTerm }), children: value?.map((ele, index) => {
|
|
837
|
+
return /* @__PURE__ */ jsxs3("span", { children: [
|
|
1064
838
|
index === 0 ? "" : ", ",
|
|
1065
839
|
formatOptionLabel ? formatOptionLabel(ele) : ele[fieldLabel ?? "label"]
|
|
1066
840
|
] }, index);
|
|
1067
|
-
}) }) }) : /* @__PURE__ */
|
|
841
|
+
}) }) }) : /* @__PURE__ */ jsx3(Fragment4, { children: /* @__PURE__ */ jsxs3("div", { className: classnames("select-value", { "d-none": searchTerm }), children: [
|
|
1068
842
|
value ? formatOptionLabel ? formatOptionLabel(value) : value[fieldLabel ?? "label"] : "",
|
|
1069
843
|
" "
|
|
1070
844
|
] }) }),
|
|
1071
|
-
!((isMulti ? value?.length > 0 : value) || isDisabled || searchTerm) && /* @__PURE__ */
|
|
1072
|
-
/* @__PURE__ */
|
|
845
|
+
!((isMulti ? value?.length > 0 : value) || isDisabled || searchTerm) && /* @__PURE__ */ jsx3("div", { className: classnames("select-placeholder"), children: placeholder }),
|
|
846
|
+
/* @__PURE__ */ jsx3("div", { className: "input-container", children: /* @__PURE__ */ jsx3(
|
|
1073
847
|
"input",
|
|
1074
848
|
{
|
|
1075
849
|
style: { textAlign: textAlign ?? "left" },
|
|
1076
850
|
ref: inputRef,
|
|
1077
|
-
className:
|
|
851
|
+
className: classnames("select-input"),
|
|
1078
852
|
readOnly: isDisabled,
|
|
1079
853
|
value: searchTerm,
|
|
1080
854
|
onPaste: (e) => onPaste && !dropdownOpen && onPaste(e),
|
|
@@ -1096,27 +870,27 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
1096
870
|
}
|
|
1097
871
|
) })
|
|
1098
872
|
] }),
|
|
1099
|
-
isLoading && /* @__PURE__ */
|
|
1100
|
-
/* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */
|
|
1102
|
-
/* @__PURE__ */
|
|
873
|
+
isLoading && /* @__PURE__ */ jsxs3("div", { className: classnames("select-table-indicator d-flex align-items-center"), children: [
|
|
874
|
+
/* @__PURE__ */ jsx3(Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" }),
|
|
875
|
+
/* @__PURE__ */ jsx3(Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" }),
|
|
876
|
+
/* @__PURE__ */ jsx3(Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" })
|
|
1103
877
|
] }),
|
|
1104
|
-
isClearable && value && !isDisabled && /* @__PURE__ */
|
|
878
|
+
isClearable && value && !isDisabled && /* @__PURE__ */ jsx3(
|
|
1105
879
|
"div",
|
|
1106
880
|
{
|
|
1107
|
-
className:
|
|
881
|
+
className: classnames("cursor-pointer"),
|
|
1108
882
|
onClick: (e) => {
|
|
1109
883
|
handChange(isMulti ? [] : void 0);
|
|
1110
884
|
e.stopPropagation();
|
|
1111
885
|
},
|
|
1112
|
-
children: /* @__PURE__ */
|
|
886
|
+
children: /* @__PURE__ */ jsx3("svg", { height: "20", width: "20", color: "#c4c4c4", viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", className: "css-tj5bde-Svg", children: /* @__PURE__ */ jsx3("path", { d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z" }) })
|
|
1113
887
|
}
|
|
1114
888
|
),
|
|
1115
|
-
!isDisabled && /* @__PURE__ */
|
|
889
|
+
!isDisabled && /* @__PURE__ */ jsx3("div", { className: "select-table-indicator", onMouseDown: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx3("svg", { height: "20", width: "20", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx3("path", { d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z" }) }) })
|
|
1116
890
|
]
|
|
1117
891
|
}
|
|
1118
892
|
),
|
|
1119
|
-
/* @__PURE__ */
|
|
893
|
+
/* @__PURE__ */ jsx3(
|
|
1120
894
|
DropdownMenu,
|
|
1121
895
|
{
|
|
1122
896
|
container: component,
|
|
@@ -1128,7 +902,7 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
1128
902
|
borderRadius: 4,
|
|
1129
903
|
zIndex: 9999
|
|
1130
904
|
},
|
|
1131
|
-
children: /* @__PURE__ */
|
|
905
|
+
children: /* @__PURE__ */ jsx3(DropdownItem, { className: classnames("p-0 menu-select-table"), tag: "div", header: true, children: dropdownOpen && /* @__PURE__ */ jsx3(
|
|
1132
906
|
"div",
|
|
1133
907
|
{
|
|
1134
908
|
style: { backgroundColor: "none" },
|
|
@@ -1138,11 +912,11 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
1138
912
|
e.preventDefault();
|
|
1139
913
|
}
|
|
1140
914
|
},
|
|
1141
|
-
children: /* @__PURE__ */
|
|
1142
|
-
/* @__PURE__ */
|
|
1143
|
-
/* @__PURE__ */
|
|
1144
|
-
/* @__PURE__ */
|
|
1145
|
-
/* @__PURE__ */
|
|
915
|
+
children: /* @__PURE__ */ jsxs3("div", { className: "r-select-grid", children: [
|
|
916
|
+
/* @__PURE__ */ jsx3("div", { className: classnames("r-select-gridtable", { "no-header": noHeader || (columns?.length ?? 0) === 0 }), ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ jsx3(RenderTable, {}) }),
|
|
917
|
+
/* @__PURE__ */ jsxs3("div", { className: classnames("r-select-footer", { "d-none": !(showFooter === true || handleAdd) }), children: [
|
|
918
|
+
/* @__PURE__ */ jsxs3(Button, { outline: true, color: "primary", onClick: handleAdd, className: classnames("r-btn d-flex align-items-center", { "d-none": !handleAdd }), children: [
|
|
919
|
+
/* @__PURE__ */ jsx3(Plus, { className: "me-50", fontSize: 16 }),
|
|
1146
920
|
t("AddNew"),
|
|
1147
921
|
" (F9)"
|
|
1148
922
|
] }),
|
|
@@ -1160,1700 +934,1926 @@ var SelectTable = forwardRef((props, ref) => {
|
|
|
1160
934
|
);
|
|
1161
935
|
});
|
|
1162
936
|
|
|
1163
|
-
// src/component/
|
|
1164
|
-
import {
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
};
|
|
1201
|
-
const renderLabel = (props2) => {
|
|
1202
|
-
const { t } = useTranslation4();
|
|
1203
|
-
const { isLabel: isLabel2, desciptionLabel: desciptionLabel2, id: id2, classLabel: classLabel2, name: name2, label: label2, required: required2 } = props2;
|
|
1204
|
-
return /* @__PURE__ */ jsxs6(Fragment7, { children: [
|
|
1205
|
-
isLabel2 === false ? "" : /* @__PURE__ */ jsxs6(Label3, { id: `label-${id2}`, className: classLabel2, for: name2, children: [
|
|
1206
|
-
t(label2 ? label2 : ""),
|
|
1207
|
-
" ",
|
|
1208
|
-
required2 ? /* @__PURE__ */ jsx6("span", { className: "text-danger", children: "*" }) : ""
|
|
1209
|
-
] }),
|
|
1210
|
-
(!isNullOrUndefined(desciptionLabel2) && desciptionLabel2 !== "") ?? /* @__PURE__ */ jsx6(Fragment8, { children: /* @__PURE__ */ jsx6(UncontrolledTooltip2, { target: `label-${id2}`, children: t(desciptionLabel2 ?? "") }) })
|
|
1211
|
-
] });
|
|
1212
|
-
};
|
|
1213
|
-
return /* @__PURE__ */ jsx6(Fragment7, { children: /* @__PURE__ */ jsxs6(
|
|
1214
|
-
"div",
|
|
1215
|
-
{
|
|
1216
|
-
className: classnames4(
|
|
1217
|
-
inLine === false ? "form-group " : "form-row-inline d-flex",
|
|
1218
|
-
"align",
|
|
937
|
+
// src/component/table/paging/index.tsx
|
|
938
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
939
|
+
var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOptions, onChangePageSize }) => {
|
|
940
|
+
const { t } = useTranslation2();
|
|
941
|
+
const [countPage, setCountPage] = useState3(0);
|
|
942
|
+
const [currentPageNumber, setCurrentPageNumber] = useState3(1);
|
|
943
|
+
useEffect4(() => {
|
|
944
|
+
setCountPage(Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1));
|
|
945
|
+
}, [totalItem, pageSize]);
|
|
946
|
+
useEffect4(() => {
|
|
947
|
+
setCurrentPageNumber(Math.floor(currentPage / 5) + (Math.floor(currentPage / 5) === currentPage / 5 ? 0 : 1));
|
|
948
|
+
}, [currentPage]);
|
|
949
|
+
const renderPageNumber = (number) => {
|
|
950
|
+
const arr = [];
|
|
951
|
+
for (let index = (number - 1) * 5 + 1; index <= number * 5 && index <= Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1); index++) {
|
|
952
|
+
arr.push(
|
|
953
|
+
/* @__PURE__ */ jsx4(
|
|
954
|
+
"div",
|
|
955
|
+
{
|
|
956
|
+
className: classNames2("r-number", { "r-active": index === currentPage }),
|
|
957
|
+
onClick: () => {
|
|
958
|
+
onChangePage({ totalItem, pageSize, currentPage: index, old: currentPage });
|
|
959
|
+
},
|
|
960
|
+
children: index
|
|
961
|
+
},
|
|
962
|
+
`page-${index}`
|
|
963
|
+
)
|
|
964
|
+
);
|
|
965
|
+
}
|
|
966
|
+
return arr;
|
|
967
|
+
};
|
|
968
|
+
return /* @__PURE__ */ jsx4(Fragment5, { children: /* @__PURE__ */ jsxs4("div", { className: "r-pager", children: [
|
|
969
|
+
/* @__PURE__ */ jsxs4("div", { className: "r-pagercontainer", children: [
|
|
970
|
+
/* @__PURE__ */ jsx4("button", { className: "r-button", type: "button", disabled: countPage <= 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: 1, old: currentPage }), children: /* @__PURE__ */ jsx4(ChevronsLeft, { fontSize: 16 }) }),
|
|
971
|
+
/* @__PURE__ */ jsx4("button", { className: "r-button", type: "button", disabled: countPage <= 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage - 1, old: currentPage }), children: /* @__PURE__ */ jsx4(ChevronLeft, { fontSize: 16 }) }),
|
|
972
|
+
/* @__PURE__ */ jsx4(
|
|
973
|
+
"button",
|
|
1219
974
|
{
|
|
1220
|
-
|
|
1221
|
-
"
|
|
975
|
+
className: classNames2("r-button", { "d-none": currentPageNumber === 1 }),
|
|
976
|
+
type: "button",
|
|
977
|
+
onClick: () => {
|
|
978
|
+
setCurrentPageNumber(currentPageNumber - 1);
|
|
979
|
+
onChangePage({ totalItem, pageSize, currentPage: (currentPageNumber - 2) * 5 + 1, old: currentPage });
|
|
980
|
+
},
|
|
981
|
+
children: "..."
|
|
1222
982
|
}
|
|
1223
983
|
),
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
984
|
+
renderPageNumber(currentPageNumber),
|
|
985
|
+
/* @__PURE__ */ jsx4(
|
|
986
|
+
"button",
|
|
987
|
+
{
|
|
988
|
+
className: classNames2("r-button", { "d-none": currentPageNumber * 5 >= countPage }),
|
|
989
|
+
type: "button",
|
|
990
|
+
onClick: () => {
|
|
991
|
+
setCurrentPageNumber(currentPageNumber + 1);
|
|
992
|
+
onChangePage({ totalItem, pageSize, currentPage: currentPageNumber * 5 + 1, old: currentPage });
|
|
993
|
+
},
|
|
994
|
+
children: "..."
|
|
995
|
+
}
|
|
996
|
+
),
|
|
997
|
+
/* @__PURE__ */ jsx4("button", { className: "r-button", type: "button", disabled: countPage <= 1 || countPage === currentPage, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage + 1, old: currentPage }), children: /* @__PURE__ */ jsx4(ChevronRight, { fontSize: 16 }) }),
|
|
998
|
+
/* @__PURE__ */ jsx4("button", { className: "r-button", type: "button", disabled: countPage <= 1 || countPage === currentPage, onClick: () => onChangePage({ totalItem, pageSize, currentPage: Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1), old: currentPage }), children: /* @__PURE__ */ jsx4(ChevronsRight, { fontSize: 16 }) }),
|
|
999
|
+
/* @__PURE__ */ jsx4("div", { className: "r-pagesize", children: /* @__PURE__ */ jsx4(
|
|
1000
|
+
SelectTable,
|
|
1001
|
+
{
|
|
1002
|
+
value: { value: pageSize, label: pageSize },
|
|
1003
|
+
noHeader: true,
|
|
1004
|
+
options: pageOptions.map((item) => ({ value: item, label: item })),
|
|
1005
|
+
onChange: (val) => {
|
|
1006
|
+
onChangePageSize({ totalItem, pageSize: val?.value });
|
|
1007
|
+
},
|
|
1008
|
+
menuWidth: 90,
|
|
1009
|
+
width: 90,
|
|
1010
|
+
placeholder: t("Select")
|
|
1011
|
+
}
|
|
1012
|
+
) }),
|
|
1013
|
+
/* @__PURE__ */ jsx4("span", { style: { display: "inline", marginLeft: 10, fontSize: 13 }, children: t("pagerDropDown") })
|
|
1014
|
+
] }),
|
|
1015
|
+
/* @__PURE__ */ jsx4("div", { className: "r-parentmsgbar", children: t("totalItemsInfo", { page: currentPage, countPage, totalItem }) })
|
|
1016
|
+
] }) });
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
// src/component/table/header.tsx
|
|
1020
|
+
import { Fragment as Fragment6 } from "react";
|
|
1021
|
+
import classnames2 from "classnames";
|
|
1022
|
+
import { Input as Input3 } from "reactstrap";
|
|
1023
|
+
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
1024
|
+
import { Resizable } from "react-resizable";
|
|
1025
|
+
import "react-resizable/css/styles.css";
|
|
1026
|
+
import { Fragment as Fragment7, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1027
|
+
var HeaderTableCol = (props) => {
|
|
1028
|
+
const {
|
|
1029
|
+
selectEnable,
|
|
1030
|
+
dataSource,
|
|
1031
|
+
setSelectedRows,
|
|
1032
|
+
col,
|
|
1033
|
+
indexCol,
|
|
1034
|
+
indexParent,
|
|
1035
|
+
objWidthFix,
|
|
1036
|
+
totalCount,
|
|
1037
|
+
selectedRows,
|
|
1038
|
+
column,
|
|
1039
|
+
setColumn,
|
|
1040
|
+
isMulti
|
|
1041
|
+
} = props;
|
|
1042
|
+
const { t } = useTranslation3();
|
|
1043
|
+
const handleResize = (e, { size }) => {
|
|
1044
|
+
if (size.width > 50) {
|
|
1045
|
+
const newColumns = [...column];
|
|
1046
|
+
newColumns[indexCol].width = size.width;
|
|
1047
|
+
setColumn(newColumns);
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1050
|
+
return /* @__PURE__ */ jsx5(Fragment6, { children: col.visible !== false && /* @__PURE__ */ jsx5(
|
|
1051
|
+
Resizable,
|
|
1052
|
+
{
|
|
1053
|
+
className: "r-resize",
|
|
1054
|
+
width: typeof col.width === "number" ? col.width : Number((col.width ?? "").replaceAll(new RegExp(`[^0-9]`, "g"), "")),
|
|
1055
|
+
height: 0,
|
|
1056
|
+
onResize: handleResize,
|
|
1057
|
+
draggableOpts: { enableUserSelectHack: false },
|
|
1058
|
+
children: /* @__PURE__ */ jsx5(
|
|
1059
|
+
"th",
|
|
1060
|
+
{
|
|
1061
|
+
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
1062
|
+
colSpan: col.columns?.length ?? 1,
|
|
1063
|
+
className: classnames2(`r-headercell fix-${col.fixedType}`, { "cell-fixed": col.fixedType }),
|
|
1064
|
+
style: {
|
|
1065
|
+
top: `${indexParent * 42}px`,
|
|
1066
|
+
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
1067
|
+
right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
|
|
1068
|
+
width: col.width ? typeof col.width === "number" ? col.width : col.width?.includes("px") || col.width?.includes("%") ? col.width : `${col.width}px` : "auto",
|
|
1069
|
+
minWidth: col.width ? typeof col.width === "number" ? col.width : col.width?.includes("px") || col.width?.includes("%") ? col.width : `${col.width}px` : "auto",
|
|
1070
|
+
maxWidth: col.width ? typeof col.width === "number" ? col.width : col.width?.includes("px") || col.width?.includes("%") ? col.width : `${col.width}px` : "auto"
|
|
1071
|
+
},
|
|
1072
|
+
children: /* @__PURE__ */ jsxs5(
|
|
1073
|
+
"div",
|
|
1229
1074
|
{
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1075
|
+
style: { justifyContent: col.textAlign ?? "left" },
|
|
1076
|
+
className: classnames2("r-headercell-div"),
|
|
1077
|
+
children: [
|
|
1078
|
+
col.field === "checkbox" && /* @__PURE__ */ jsx5(
|
|
1079
|
+
Input3,
|
|
1235
1080
|
{
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1081
|
+
checked: totalCount > 0 && selectedRows?.length >= totalCount,
|
|
1082
|
+
type: "checkbox",
|
|
1083
|
+
className: classnames2("cursor-pointer", { "d-none": !isMulti }),
|
|
1084
|
+
style: { textAlign: col.textAlign ?? "left", marginTop: 6 },
|
|
1085
|
+
onChange: (e) => {
|
|
1086
|
+
if (selectEnable) {
|
|
1087
|
+
if (e.target.checked) {
|
|
1088
|
+
setSelectedRows(dataSource.map((item) => {
|
|
1089
|
+
return item;
|
|
1090
|
+
}));
|
|
1243
1091
|
} else {
|
|
1244
|
-
|
|
1245
|
-
onChange(!isNullOrUndefined(val) ? val.map((item) => item[fieldValue ?? "value"]) : []);
|
|
1246
|
-
} else {
|
|
1247
|
-
onChange(!isNullOrUndefined(val) ? val[fieldValue ?? "value"] : void 0);
|
|
1248
|
-
}
|
|
1249
|
-
if (callback) {
|
|
1250
|
-
callback(val);
|
|
1251
|
-
}
|
|
1092
|
+
setSelectedRows([]);
|
|
1252
1093
|
}
|
|
1253
1094
|
}
|
|
1254
|
-
}
|
|
1255
|
-
handleAdd: handleAddNew,
|
|
1256
|
-
isClearable,
|
|
1257
|
-
isMulti,
|
|
1258
|
-
placeholder,
|
|
1259
|
-
invalid: errors,
|
|
1260
|
-
loadOptions,
|
|
1261
|
-
options: defaultOptions,
|
|
1262
|
-
isDisabled: disabled,
|
|
1263
|
-
columns,
|
|
1264
|
-
fieldValue,
|
|
1265
|
-
fieldLabel,
|
|
1266
|
-
formatOptionLabel: labelComponent ? labelComponent : void 0
|
|
1095
|
+
}
|
|
1267
1096
|
}
|
|
1268
|
-
)
|
|
1269
|
-
|
|
1097
|
+
),
|
|
1098
|
+
col.field !== "checkbox" && /* @__PURE__ */ jsx5(Fragment7, { children: /* @__PURE__ */ jsx5("span", { className: "header-content", children: t(col.headerText ?? "") }) })
|
|
1099
|
+
]
|
|
1270
1100
|
}
|
|
1271
|
-
)
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
]
|
|
1101
|
+
)
|
|
1102
|
+
}
|
|
1103
|
+
)
|
|
1275
1104
|
}
|
|
1276
|
-
) });
|
|
1105
|
+
) }, `header-${indexCol}`);
|
|
1277
1106
|
};
|
|
1278
|
-
var
|
|
1107
|
+
var header_default = HeaderTableCol;
|
|
1279
1108
|
|
|
1280
|
-
// src/component/
|
|
1281
|
-
import { Fragment as Fragment9
|
|
1282
|
-
|
|
1283
|
-
|
|
1109
|
+
// src/component/table/command.tsx
|
|
1110
|
+
import { Fragment as Fragment9 } from "react";
|
|
1111
|
+
import classnames3 from "classnames";
|
|
1112
|
+
import { Button as Button2, UncontrolledTooltip as UncontrolledTooltip2 } from "reactstrap";
|
|
1113
|
+
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
1114
|
+
|
|
1115
|
+
// src/component/icon/index.tsx
|
|
1116
|
+
import * as Icon from "becoxy-icons";
|
|
1117
|
+
import { Fragment as Fragment8 } from "react";
|
|
1118
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1119
|
+
var IconCustom = (props) => {
|
|
1120
|
+
const { iconName, size } = props;
|
|
1121
|
+
if (iconName === "") {
|
|
1122
|
+
return null;
|
|
1123
|
+
} else {
|
|
1124
|
+
const TagIcon = iconName === "" ? "" : Icon[iconName];
|
|
1125
|
+
return /* @__PURE__ */ jsx6(Fragment8, { children: iconName === "" ? "" : /* @__PURE__ */ jsx6(TagIcon, { fontSize: size }) });
|
|
1126
|
+
}
|
|
1127
|
+
};
|
|
1128
|
+
var icon_default = IconCustom;
|
|
1129
|
+
|
|
1130
|
+
// src/component/table/command.tsx
|
|
1131
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1132
|
+
var CommandElement = (props) => {
|
|
1133
|
+
const { commandItems, rowData, indexRow, handleCommandClick, indexFocus, setIndexFocus } = props;
|
|
1134
|
+
const { t } = useTranslation4();
|
|
1135
|
+
return /* @__PURE__ */ jsx7(Fragment9, { children: /* @__PURE__ */ jsx7("div", { className: "d-flex align-items-center", style: { columnGap: 10 }, children: commandItems.map((item, index) => {
|
|
1136
|
+
return /* @__PURE__ */ jsxs6(
|
|
1137
|
+
Button2,
|
|
1138
|
+
{
|
|
1139
|
+
id: `command-item-${indexRow}-${index}`,
|
|
1140
|
+
tabIndex: -1,
|
|
1141
|
+
style: { padding: "5px", minWidth: 45, height: "100%" },
|
|
1142
|
+
className: classnames3("command-item", {
|
|
1143
|
+
"btn-icon": item.tooltip === ""
|
|
1144
|
+
}),
|
|
1145
|
+
color: item.color ? item.color : "#000",
|
|
1146
|
+
onClick: (e) => {
|
|
1147
|
+
handleCommandClick(item.id, rowData, indexRow);
|
|
1148
|
+
if (indexRow === indexFocus) {
|
|
1149
|
+
setIndexFocus(void 0);
|
|
1150
|
+
}
|
|
1151
|
+
e.preventDefault();
|
|
1152
|
+
},
|
|
1153
|
+
children: [
|
|
1154
|
+
item.icon && /* @__PURE__ */ jsx7(icon_default, { iconName: item.icon, size: 16 }),
|
|
1155
|
+
/* @__PURE__ */ jsx7(UncontrolledTooltip2, { className: "r-tooltip", target: `command-item-${indexRow}-${index}`, place: "top", children: t(item.tooltip ?? "") })
|
|
1156
|
+
]
|
|
1157
|
+
},
|
|
1158
|
+
`command-${index}`
|
|
1159
|
+
);
|
|
1160
|
+
}) }) });
|
|
1161
|
+
};
|
|
1162
|
+
var command_default = CommandElement;
|
|
1163
|
+
|
|
1164
|
+
// src/component/select-table-tree/index.tsx
|
|
1165
|
+
import React2, { forwardRef as forwardRef2, Fragment as Fragment10, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef2, useState as useState4 } from "react";
|
|
1166
|
+
import {
|
|
1167
|
+
DropdownItem as DropdownItem2,
|
|
1168
|
+
DropdownMenu as DropdownMenu2,
|
|
1169
|
+
DropdownToggle as DropdownToggle2,
|
|
1170
|
+
Dropdown as Dropdown2,
|
|
1171
|
+
Button as Button3,
|
|
1172
|
+
Input as Input4,
|
|
1173
|
+
UncontrolledTooltip as UncontrolledTooltip3
|
|
1174
|
+
} from "reactstrap";
|
|
1175
|
+
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
1176
|
+
import classnames4 from "classnames";
|
|
1177
|
+
import { ChevronRight as ChevronRight2, Plus as Plus2 } from "becoxy-icons";
|
|
1178
|
+
import { Fragment as Fragment11, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1179
|
+
var defaultMaxHeight2 = 250;
|
|
1180
|
+
var SelectTableTree = forwardRef2((props, ref) => {
|
|
1284
1181
|
const {
|
|
1285
1182
|
id,
|
|
1286
|
-
field,
|
|
1287
|
-
displayValue,
|
|
1288
|
-
menuHeight,
|
|
1289
1183
|
menuWidth,
|
|
1290
|
-
|
|
1184
|
+
width,
|
|
1291
1185
|
invalid,
|
|
1292
|
-
onChange,
|
|
1293
|
-
onChangeField,
|
|
1294
1186
|
onKeyDown,
|
|
1295
|
-
defaultValues,
|
|
1296
1187
|
placeholder,
|
|
1297
1188
|
textAlign,
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1189
|
+
options,
|
|
1190
|
+
columns,
|
|
1191
|
+
onChange,
|
|
1192
|
+
value,
|
|
1193
|
+
fieldValue,
|
|
1194
|
+
fieldLabel,
|
|
1195
|
+
fieldChildren,
|
|
1196
|
+
maxHeight,
|
|
1197
|
+
handleAdd,
|
|
1305
1198
|
isClearable,
|
|
1306
|
-
|
|
1199
|
+
component,
|
|
1200
|
+
formatOptionLabel,
|
|
1201
|
+
isMulti,
|
|
1202
|
+
noHeader,
|
|
1203
|
+
isDisabled,
|
|
1204
|
+
showFooter,
|
|
1205
|
+
selectChilds,
|
|
1206
|
+
footerComponent,
|
|
1207
|
+
formatSetting,
|
|
1208
|
+
onOpenMenu,
|
|
1209
|
+
onPaste
|
|
1307
1210
|
} = props;
|
|
1308
|
-
const
|
|
1211
|
+
const selectTableRef = useRef2();
|
|
1212
|
+
const selectMenuTableRef = useRef2();
|
|
1309
1213
|
const inputRef = useRef2();
|
|
1310
|
-
const
|
|
1311
|
-
const
|
|
1312
|
-
const [
|
|
1313
|
-
const [itemsField, setItemsField] = useState3([]);
|
|
1214
|
+
const [dropdownOpen, setDropdownOpen] = useState4(false);
|
|
1215
|
+
const [isFocus, setIsFocus] = useState4(false);
|
|
1216
|
+
const [searchTerm, setSearchTerm] = useState4("");
|
|
1314
1217
|
const { t } = useTranslation5();
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1218
|
+
const areAllItemsSelected = (value2, options2, fieldValue2) => {
|
|
1219
|
+
const checkAllSelected = (nodes) => {
|
|
1220
|
+
return nodes.every((node) => {
|
|
1221
|
+
const isSelected = value2.includes(node[fieldValue2]);
|
|
1222
|
+
const childrenSelected = node.children ? checkAllSelected(node.children) : true;
|
|
1223
|
+
return isSelected && childrenSelected;
|
|
1224
|
+
});
|
|
1225
|
+
};
|
|
1226
|
+
return checkAllSelected(options2);
|
|
1227
|
+
};
|
|
1228
|
+
const isSelectedAll = useMemo2(() => {
|
|
1229
|
+
return isMulti === true && options.length > 0 && areAllItemsSelected(value, options, fieldValue ?? "value");
|
|
1230
|
+
}, [options, value]);
|
|
1231
|
+
useEffect5(() => {
|
|
1232
|
+
if (dropdownOpen && onOpenMenu) {
|
|
1233
|
+
onOpenMenu();
|
|
1234
|
+
}
|
|
1235
|
+
}, [dropdownOpen]);
|
|
1236
|
+
const defaultColumns = [
|
|
1237
|
+
{
|
|
1238
|
+
headerText: "Name",
|
|
1239
|
+
field: fieldLabel ?? "label",
|
|
1240
|
+
width: menuWidth
|
|
1241
|
+
}
|
|
1242
|
+
];
|
|
1318
1243
|
const closeMenu = () => {
|
|
1319
|
-
|
|
1320
|
-
setDropdownOpen(false);
|
|
1321
|
-
}, onChangeField ? 10 : 0);
|
|
1244
|
+
setDropdownOpen(false);
|
|
1322
1245
|
};
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
setValue,
|
|
1329
|
-
formState: { errors }
|
|
1330
|
-
} = useForm({
|
|
1331
|
-
mode: "onChange",
|
|
1332
|
-
defaultValues,
|
|
1333
|
-
resolver: yupResolver(schema)
|
|
1334
|
-
});
|
|
1335
|
-
useEffect4(() => {
|
|
1336
|
-
if (dropdownOpen) {
|
|
1337
|
-
if (onFormOpen && itemsField.length === 0) {
|
|
1338
|
-
onFormOpen(rowData, itemsField, setItemsField);
|
|
1339
|
-
}
|
|
1340
|
-
if (openOnFocus) {
|
|
1341
|
-
setTimeout(() => {
|
|
1342
|
-
focusElement(`form-element-${field}-0`, true);
|
|
1343
|
-
}, 100);
|
|
1246
|
+
useEffect5(() => {
|
|
1247
|
+
if (dropdownOpen && value && !isMulti && selectMenuTableRef) {
|
|
1248
|
+
const index = options?.findIndex((e) => e[fieldValue ?? "value"] === value[fieldValue ?? "value"]);
|
|
1249
|
+
if (index >= 0) {
|
|
1250
|
+
selectMenuTableRef.current.scrollTo({ top: (index - 1) * 30 });
|
|
1344
1251
|
}
|
|
1345
1252
|
}
|
|
1346
1253
|
}, [dropdownOpen]);
|
|
1347
|
-
|
|
1348
|
-
if (
|
|
1349
|
-
|
|
1350
|
-
|
|
1254
|
+
useEffect5(() => {
|
|
1255
|
+
if (inputRef && !isDisabled) {
|
|
1256
|
+
inputRef.current.addEventListener("blur", function() {
|
|
1257
|
+
setDropdownOpen(false);
|
|
1258
|
+
setSearchTerm("");
|
|
1259
|
+
setIsFocus(false);
|
|
1260
|
+
});
|
|
1261
|
+
inputRef.current.addEventListener("focus", function() {
|
|
1262
|
+
if (!isFocus) {
|
|
1263
|
+
setIsFocus(true);
|
|
1264
|
+
}
|
|
1351
1265
|
});
|
|
1352
1266
|
}
|
|
1353
|
-
}, [
|
|
1354
|
-
|
|
1267
|
+
}, [inputRef]);
|
|
1268
|
+
useEffect5(() => {
|
|
1269
|
+
if (searchTerm && !dropdownOpen) {
|
|
1270
|
+
setDropdownOpen(true);
|
|
1271
|
+
}
|
|
1272
|
+
}, [searchTerm]);
|
|
1273
|
+
const handleOpenClose = () => {
|
|
1274
|
+
setSearchTerm("");
|
|
1355
1275
|
if (dropdownOpen) {
|
|
1356
1276
|
closeMenu();
|
|
1357
1277
|
} else {
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
};
|
|
1361
|
-
const handleOnSubmit = (val) => {
|
|
1362
|
-
closeMenu();
|
|
1363
|
-
onChange(val);
|
|
1364
|
-
if (onFormSubmit) {
|
|
1365
|
-
onFormSubmit(rowData, setValue, getValues, reset);
|
|
1366
|
-
}
|
|
1367
|
-
inputRef.current.focus();
|
|
1368
|
-
};
|
|
1369
|
-
const focusElement = (id2, focus) => {
|
|
1370
|
-
const element = document.getElementById(id2);
|
|
1371
|
-
if (element) {
|
|
1372
|
-
if (element.className.includes("react-select")) {
|
|
1373
|
-
element.getElementsByTagName("input")[0]?.focus();
|
|
1374
|
-
} else {
|
|
1375
|
-
element.focus();
|
|
1376
|
-
if (focus) {
|
|
1377
|
-
element.setSelectionRange(0, element.innerText.length - 1);
|
|
1378
|
-
}
|
|
1278
|
+
if (!isDisabled) {
|
|
1279
|
+
setDropdownOpen(true);
|
|
1379
1280
|
}
|
|
1380
1281
|
}
|
|
1381
1282
|
};
|
|
1283
|
+
const listKeyUse = ["Escape", "Space", "F9"];
|
|
1382
1284
|
const handleOnKeyDown = (e) => {
|
|
1285
|
+
let key = "";
|
|
1286
|
+
if (onKeyDown && (!dropdownOpen || !listKeyUse.includes(e.code) || e.code === "Escape" && !(isClearable && value && !isDisabled))) {
|
|
1287
|
+
key = onKeyDown(e);
|
|
1288
|
+
}
|
|
1383
1289
|
let flag = false;
|
|
1384
|
-
if (
|
|
1385
|
-
if (e.code === "
|
|
1386
|
-
|
|
1387
|
-
flag = true;
|
|
1388
|
-
} else if (e.code === "Enter") {
|
|
1389
|
-
closeMenu();
|
|
1390
|
-
flag = true;
|
|
1391
|
-
} else if (e.code === "ArrowDown") {
|
|
1392
|
-
focusElement(`form-element-${field}-0`);
|
|
1393
|
-
flag = true;
|
|
1394
|
-
}
|
|
1395
|
-
} else {
|
|
1396
|
-
if (e.code === "ArrowDown") {
|
|
1397
|
-
setDropdownOpen(true);
|
|
1398
|
-
focusElement(`form-element-${field}-0`);
|
|
1290
|
+
if (!key) {
|
|
1291
|
+
if (e.code === "F9") {
|
|
1292
|
+
handleAdd();
|
|
1399
1293
|
flag = true;
|
|
1400
1294
|
} else if (e.code === "Space") {
|
|
1401
|
-
|
|
1402
|
-
|
|
1295
|
+
if (!searchTerm) {
|
|
1296
|
+
handleOpenClose();
|
|
1297
|
+
flag = true;
|
|
1298
|
+
}
|
|
1299
|
+
} else if (e.code === "Escape") {
|
|
1300
|
+
if (dropdownOpen && isClearable && value && !isDisabled) {
|
|
1301
|
+
onChange(void 0);
|
|
1302
|
+
handleOpenClose();
|
|
1303
|
+
flag = true;
|
|
1304
|
+
}
|
|
1403
1305
|
}
|
|
1404
1306
|
}
|
|
1405
|
-
if (
|
|
1406
|
-
const key = onKeyDown(e);
|
|
1407
|
-
if (key === "ArrowRight" || key === "ArrowLeft") {
|
|
1408
|
-
closeMenu();
|
|
1409
|
-
}
|
|
1410
|
-
} else {
|
|
1307
|
+
if (flag) {
|
|
1411
1308
|
e.stopPropagation();
|
|
1412
1309
|
e.preventDefault();
|
|
1413
1310
|
}
|
|
1414
1311
|
};
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
}
|
|
1312
|
+
const renderHeaderCol = (col, indexCol) => {
|
|
1313
|
+
return /* @__PURE__ */ jsx8(Fragment10, { children: col.visible !== false && /* @__PURE__ */ jsx8(
|
|
1314
|
+
"th",
|
|
1315
|
+
{
|
|
1316
|
+
className: classnames4(`r-select-headercell fix-${col.fixedType}`, { "cell-fixed": col.fixedType }),
|
|
1317
|
+
style: {
|
|
1318
|
+
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
1319
|
+
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
1320
|
+
maxWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
1321
|
+
top: `${0 * 35}px`
|
|
1322
|
+
},
|
|
1323
|
+
children: /* @__PURE__ */ jsx8(
|
|
1324
|
+
"div",
|
|
1325
|
+
{
|
|
1326
|
+
role: "textbox",
|
|
1327
|
+
title: t(col.headerText ?? ""),
|
|
1328
|
+
style: {
|
|
1329
|
+
height: `${1 * 35}px`,
|
|
1330
|
+
justifyContent: col.textAlign ?? "left"
|
|
1331
|
+
},
|
|
1332
|
+
className: "r-select-headercell-div",
|
|
1333
|
+
children: t(col.headerText ?? "")
|
|
1334
|
+
}
|
|
1335
|
+
)
|
|
1426
1336
|
}
|
|
1427
|
-
}
|
|
1337
|
+
) }, `header-select-${indexCol}`);
|
|
1428
1338
|
};
|
|
1429
|
-
const
|
|
1430
|
-
if (
|
|
1431
|
-
|
|
1432
|
-
e.preventDefault();
|
|
1433
|
-
e.stopPropagation();
|
|
1434
|
-
} else if (e.code === "ArrowUp" && index > 0) {
|
|
1435
|
-
focusElement(`form-element-${field}-${index - 1}`);
|
|
1436
|
-
e.preventDefault();
|
|
1437
|
-
e.stopPropagation();
|
|
1438
|
-
} else if (e.code === "Tab" && onChangeField && index === itemsField.length - 1) {
|
|
1439
|
-
closeMenu();
|
|
1339
|
+
const checkSearch = (keyword, data, columnsSearch) => {
|
|
1340
|
+
if (!keyword || columnsSearch.length === 0) {
|
|
1341
|
+
return true;
|
|
1440
1342
|
}
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
const rs = getValues();
|
|
1446
|
-
if (rs) {
|
|
1447
|
-
onChange(rs);
|
|
1343
|
+
for (let index = 0; index < columnsSearch.length; index++) {
|
|
1344
|
+
const key = columnsSearch[index].field.trim();
|
|
1345
|
+
if (data[key] && data[key].toString().trim().toLowerCase().includes(keyword.trim().toLowerCase())) {
|
|
1346
|
+
return true;
|
|
1448
1347
|
}
|
|
1449
1348
|
}
|
|
1349
|
+
if (data[fieldChildren ?? "children"]) {
|
|
1350
|
+
return data[fieldChildren ?? "children"].some((child) => checkSearch(keyword, child, columnsSearch));
|
|
1351
|
+
}
|
|
1352
|
+
return false;
|
|
1450
1353
|
};
|
|
1451
|
-
const
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
return /* @__PURE__ */ jsx7(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx7(
|
|
1455
|
-
input_number_default,
|
|
1456
|
-
{
|
|
1457
|
-
id: `form-element-${field}-${index}`,
|
|
1458
|
-
control,
|
|
1459
|
-
name: item.name,
|
|
1460
|
-
label: item.label ? item.label : "",
|
|
1461
|
-
labelSize: `text-left ${labelSize}`,
|
|
1462
|
-
errors: errors[item.name],
|
|
1463
|
-
disabled: item.disabled,
|
|
1464
|
-
min: item.min,
|
|
1465
|
-
max: item.max,
|
|
1466
|
-
fractionCurrency: item.fraction,
|
|
1467
|
-
callback: () => {
|
|
1468
|
-
elementChange(item.name);
|
|
1469
|
-
}
|
|
1470
|
-
},
|
|
1471
|
-
index
|
|
1472
|
-
) }, index);
|
|
1473
|
-
} else if (item.type === "text") {
|
|
1474
|
-
return /* @__PURE__ */ jsx7(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx7(
|
|
1475
|
-
input_text_default,
|
|
1476
|
-
{
|
|
1477
|
-
id: `form-element-${field}-${index}`,
|
|
1478
|
-
control,
|
|
1479
|
-
name: item.name,
|
|
1480
|
-
label: item.label ? item.label : "",
|
|
1481
|
-
labelSize: `text-left ${labelSize}`,
|
|
1482
|
-
errors: errors[item.name],
|
|
1483
|
-
disabled: item.disabled,
|
|
1484
|
-
callback: () => {
|
|
1485
|
-
elementChange(item.name);
|
|
1486
|
-
}
|
|
1487
|
-
},
|
|
1488
|
-
index
|
|
1489
|
-
) }, index);
|
|
1490
|
-
} else if (item.type === "select") {
|
|
1491
|
-
return /* @__PURE__ */ jsx7(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx7(
|
|
1492
|
-
select_table_default,
|
|
1493
|
-
{
|
|
1494
|
-
id: `form-element-${field}-${index}`,
|
|
1495
|
-
defaultOptions: item.options ?? [],
|
|
1496
|
-
control,
|
|
1497
|
-
name: item.name,
|
|
1498
|
-
label: item.label ? item.label : "",
|
|
1499
|
-
labelSize: `text-left ${labelSize}`,
|
|
1500
|
-
errors: errors[item.name],
|
|
1501
|
-
disabled: item.disabled,
|
|
1502
|
-
callback: () => {
|
|
1503
|
-
elementChange(item.name);
|
|
1504
|
-
}
|
|
1505
|
-
},
|
|
1506
|
-
index
|
|
1507
|
-
) }, index);
|
|
1508
|
-
}
|
|
1509
|
-
}) });
|
|
1354
|
+
const checkOverflow = (indexRow, indexCol) => {
|
|
1355
|
+
const element = document.getElementById(`select-${id}-${indexRow}-${indexCol}`);
|
|
1356
|
+
return element && element.scrollWidth > element.clientWidth;
|
|
1510
1357
|
};
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
{
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1358
|
+
const getSelectAll = (tree, checkValue = false) => {
|
|
1359
|
+
const selects = [];
|
|
1360
|
+
const traverse = (items) => {
|
|
1361
|
+
items.forEach((item) => {
|
|
1362
|
+
if (item[fieldValue ?? "value"] && !(checkValue && value?.includes(item[fieldValue ?? "value"]))) {
|
|
1363
|
+
selects.push(item[fieldValue ?? "value"]);
|
|
1364
|
+
}
|
|
1365
|
+
if (item[fieldChildren ?? "children"] && item[fieldChildren ?? "children"].length > 0) {
|
|
1366
|
+
traverse(item[fieldChildren ?? "children"]);
|
|
1367
|
+
}
|
|
1368
|
+
});
|
|
1369
|
+
};
|
|
1370
|
+
traverse(tree);
|
|
1371
|
+
return selects;
|
|
1372
|
+
};
|
|
1373
|
+
const RenderElement = React2.memo((props2) => {
|
|
1374
|
+
const { indexRow, row, isSelected, level = 0 } = props2;
|
|
1375
|
+
const [expanded, setExpanded] = useState4(row.expanded);
|
|
1376
|
+
return /* @__PURE__ */ jsxs7(Fragment11, { children: [
|
|
1377
|
+
/* @__PURE__ */ jsxs7(
|
|
1378
|
+
"tr",
|
|
1519
1379
|
{
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
},
|
|
1380
|
+
id: `row-select-table-${indexRow}`,
|
|
1381
|
+
className: classnames4("r-select-row", { "fisrt-row": indexRow === 0 && level === 0 }),
|
|
1523
1382
|
children: [
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
{
|
|
1527
|
-
style: { backgroundColor: "#FFF", textAlign: textAlign ?? "left" },
|
|
1528
|
-
placeholder,
|
|
1529
|
-
innerRef: inputRef,
|
|
1530
|
-
className: classNames2("input-display input-numeric", { "is-invalid": invalid }),
|
|
1531
|
-
value: displayValue,
|
|
1532
|
-
onClick: handleOnClick,
|
|
1533
|
-
onKeyDown: (e) => handleOnKeyDown(e),
|
|
1534
|
-
onPaste: (e) => onPaste && onPaste(e),
|
|
1535
|
-
readOnly: true
|
|
1536
|
-
}
|
|
1537
|
-
) }),
|
|
1538
|
-
/* @__PURE__ */ jsx7(
|
|
1539
|
-
DropdownMenu2,
|
|
1383
|
+
isMulti && /* @__PURE__ */ jsxs7(
|
|
1384
|
+
"td",
|
|
1540
1385
|
{
|
|
1541
|
-
className:
|
|
1386
|
+
className: classnames4(`r-select-rowcell`, { "r-select-active": !isMulti && value && isSelected }),
|
|
1542
1387
|
style: {
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
maxWidth: innerWidth > 1280 ? 1280 : innerWidth,
|
|
1546
|
-
borderRadius: 8,
|
|
1547
|
-
zIndex: 1056
|
|
1388
|
+
textAlign: "center",
|
|
1389
|
+
paddingLeft: level * 15 + (row[fieldChildren ?? "children"]?.length > 0 ? 0 : 10)
|
|
1548
1390
|
},
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
"
|
|
1391
|
+
onClick: (e) => {
|
|
1392
|
+
if (isMulti) {
|
|
1393
|
+
const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
|
|
1394
|
+
if (index > -1) {
|
|
1395
|
+
if (!selectChilds) {
|
|
1396
|
+
value?.splice(index, 1);
|
|
1397
|
+
} else {
|
|
1398
|
+
value?.splice(index, 1);
|
|
1399
|
+
getSelectAll(row[fieldChildren ?? "children"]).forEach((x) => {
|
|
1400
|
+
const index2 = value?.findIndex((y) => y === x);
|
|
1401
|
+
if (index2 > -1) {
|
|
1402
|
+
value?.splice(index2, 1);
|
|
1403
|
+
}
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
onChange([...value]);
|
|
1407
|
+
} else {
|
|
1408
|
+
if (value) {
|
|
1409
|
+
if (!selectChilds) {
|
|
1410
|
+
onChange([...value, row[fieldValue ?? "value"]]);
|
|
1411
|
+
} else {
|
|
1412
|
+
onChange([...value, row[fieldValue ?? "value"], ...getSelectAll(row[fieldChildren ?? "children"], true)]);
|
|
1413
|
+
}
|
|
1414
|
+
} else {
|
|
1415
|
+
onChange([row[fieldValue ?? "value"]]);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
e.stopPropagation();
|
|
1419
|
+
}
|
|
1420
|
+
},
|
|
1421
|
+
children: [
|
|
1422
|
+
row[fieldChildren ?? "children"]?.length > 0 && /* @__PURE__ */ jsx8(
|
|
1423
|
+
ChevronRight2,
|
|
1552
1424
|
{
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1425
|
+
onClick: (e) => {
|
|
1426
|
+
if (expanded) {
|
|
1427
|
+
row.expanded = false;
|
|
1428
|
+
setExpanded(false);
|
|
1429
|
+
} else {
|
|
1430
|
+
row.expanded = true;
|
|
1431
|
+
setExpanded(true);
|
|
1432
|
+
}
|
|
1433
|
+
e.stopPropagation();
|
|
1558
1434
|
},
|
|
1559
|
-
|
|
1435
|
+
fontSize: 18,
|
|
1436
|
+
className: classnames4("me-50 pb-0 r-icon-expand", { "is-open": expanded })
|
|
1560
1437
|
}
|
|
1561
1438
|
),
|
|
1562
|
-
/* @__PURE__ */
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1439
|
+
/* @__PURE__ */ jsx8(
|
|
1440
|
+
Input4,
|
|
1441
|
+
{
|
|
1442
|
+
checked: isSelected,
|
|
1443
|
+
type: "checkbox",
|
|
1444
|
+
className: "cursor-pointer",
|
|
1445
|
+
onChange: () => {
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
)
|
|
1449
|
+
]
|
|
1450
|
+
}
|
|
1451
|
+
),
|
|
1452
|
+
(columns ? columns : defaultColumns).map((col, indexCol) => {
|
|
1453
|
+
let valueDisplay = row[col.field];
|
|
1454
|
+
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
1455
|
+
valueDisplay = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ".", formatSetting?.thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
1456
|
+
} else if (col.type === "date") {
|
|
1457
|
+
valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat) : "";
|
|
1458
|
+
} else if (col.type === "datetime") {
|
|
1459
|
+
valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat ?? "DD/MM/yyyy HH:mm") : "";
|
|
1460
|
+
}
|
|
1461
|
+
return /* @__PURE__ */ jsxs7(Fragment10, { children: [
|
|
1462
|
+
col.visible !== false && /* @__PURE__ */ jsxs7(
|
|
1463
|
+
"td",
|
|
1464
|
+
{
|
|
1465
|
+
id: `select-${id}-${indexRow}-${indexCol}`,
|
|
1466
|
+
className: classnames4(`r-select-rowcell`, { "r-select-active": !isMulti && value && isSelected }),
|
|
1467
|
+
style: {
|
|
1468
|
+
paddingLeft: 9 + (indexCol === 0 && !isMulti ? level * 10 + (row[fieldChildren ?? "children"]?.length > 0 || level === 0 ? 0 : 15) : 0),
|
|
1469
|
+
textAlign: col.textAlign ? col.textAlign : "left"
|
|
1470
|
+
},
|
|
1471
|
+
onClick: (e) => {
|
|
1472
|
+
if (isMulti) {
|
|
1473
|
+
const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
|
|
1474
|
+
if (index > -1) {
|
|
1475
|
+
if (!selectChilds) {
|
|
1476
|
+
value?.splice(index, 1);
|
|
1477
|
+
} else {
|
|
1478
|
+
value?.splice(index, 1);
|
|
1479
|
+
getSelectAll(row[fieldChildren ?? "children"]).forEach((x) => {
|
|
1480
|
+
const index2 = value?.findIndex((y) => y === x);
|
|
1481
|
+
if (index2 > -1) {
|
|
1482
|
+
value?.splice(index2, 1);
|
|
1577
1483
|
}
|
|
1578
1484
|
});
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1485
|
+
}
|
|
1486
|
+
onChange([...value]);
|
|
1487
|
+
} else {
|
|
1488
|
+
if (value) {
|
|
1489
|
+
if (!selectChilds) {
|
|
1490
|
+
onChange([...value, row[fieldValue ?? "value"]]);
|
|
1491
|
+
} else {
|
|
1492
|
+
onChange([...value, row[fieldValue ?? "value"], ...getSelectAll(row[fieldChildren ?? "children"], true)]);
|
|
1583
1493
|
}
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1494
|
+
} else {
|
|
1495
|
+
onChange([row[fieldValue ?? "value"]]);
|
|
1496
|
+
}
|
|
1586
1497
|
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1498
|
+
e.stopPropagation();
|
|
1499
|
+
} else {
|
|
1500
|
+
onChange(row);
|
|
1501
|
+
setSearchTerm("");
|
|
1502
|
+
closeMenu();
|
|
1503
|
+
}
|
|
1504
|
+
e.preventDefault();
|
|
1505
|
+
e.stopPropagation();
|
|
1506
|
+
},
|
|
1507
|
+
children: [
|
|
1508
|
+
!isMulti && indexCol === 0 && row[fieldChildren ?? "children"]?.length > 0 && /* @__PURE__ */ jsx8(
|
|
1509
|
+
ChevronRight2,
|
|
1590
1510
|
{
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1511
|
+
onClick: (e) => {
|
|
1512
|
+
if (expanded) {
|
|
1513
|
+
row.expanded = false;
|
|
1514
|
+
setExpanded(false);
|
|
1515
|
+
} else {
|
|
1516
|
+
row.expanded = true;
|
|
1517
|
+
setExpanded(true);
|
|
1598
1518
|
}
|
|
1519
|
+
e.stopPropagation();
|
|
1599
1520
|
},
|
|
1600
|
-
|
|
1521
|
+
fontSize: 18,
|
|
1522
|
+
className: classnames4("me-50 r-icon-expand", { "is-open": expanded })
|
|
1601
1523
|
}
|
|
1602
|
-
)
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1524
|
+
),
|
|
1525
|
+
col.template ? col.template(row, indexRow) : col.type === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ jsxs7("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
1526
|
+
" ",
|
|
1527
|
+
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
1528
|
+
] }) : valueDisplay
|
|
1529
|
+
]
|
|
1530
|
+
},
|
|
1531
|
+
`col-${indexRow}-${indexCol}`
|
|
1532
|
+
),
|
|
1533
|
+
checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx8(UncontrolledTooltip3, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : col.type === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ jsxs7("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
1534
|
+
" ",
|
|
1535
|
+
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
1536
|
+
] }) : valueDisplay })
|
|
1537
|
+
] }, indexCol);
|
|
1538
|
+
})
|
|
1608
1539
|
]
|
|
1540
|
+
},
|
|
1541
|
+
`row-${indexRow}`
|
|
1542
|
+
),
|
|
1543
|
+
row[fieldChildren ?? "children"] && row.expanded && row[fieldChildren ?? "children"].map((child, indexChild) => {
|
|
1544
|
+
if (checkSearch(searchTerm, child, columns ? columns : defaultColumns)) {
|
|
1545
|
+
const isSelectedChild = value && (isMulti ? value?.some((x) => x === child[fieldValue ?? "value"]) : value[fieldValue ?? "value"] === child[fieldValue ?? "value"]);
|
|
1546
|
+
return /* @__PURE__ */ jsx8(RenderElement, { isSelected: isSelectedChild, indexRow: indexChild, row: child, level: level + 1 }, `select-table-${indexRow}-${indexChild}`);
|
|
1609
1547
|
}
|
|
1610
|
-
|
|
1611
|
-
}
|
|
1612
|
-
);
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
import { Fragment as Fragment10, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1626
|
-
var ModalHeader = (props) => {
|
|
1627
|
-
const { title, handleModal, typeModal = "Edit", component } = props;
|
|
1628
|
-
const { t } = useTranslation6();
|
|
1629
|
-
const handleModalIcon = () => {
|
|
1630
|
-
if (typeModal === "Edit" || typeModal === "Approval") {
|
|
1631
|
-
return /* @__PURE__ */ jsx8(Edit, { fontSize: 17, className: "me-1" });
|
|
1632
|
-
} else if (typeModal === "View") {
|
|
1633
|
-
return /* @__PURE__ */ jsx8(Info, { fontSize: 17, className: "me-1" });
|
|
1634
|
-
} else if (typeModal === "Detail") {
|
|
1635
|
-
return /* @__PURE__ */ jsx8(Info, { fontSize: 17, className: "me-1" });
|
|
1636
|
-
} else if (typeModal === "Order") {
|
|
1637
|
-
return /* @__PURE__ */ jsx8("span", { className: "e-icons e-sorting-1 me-1", style: { fontSize: "14px" } });
|
|
1638
|
-
} else if (typeModal === "Process") {
|
|
1639
|
-
return /* @__PURE__ */ jsx8("span", { className: "e-flat e-icons e-paste-match-destination me-1", style: { fontSize: "14px" } });
|
|
1640
|
-
} else {
|
|
1641
|
-
return /* @__PURE__ */ jsx8(Plus2, { fontSize: 17, className: "me-1" });
|
|
1642
|
-
}
|
|
1643
|
-
};
|
|
1644
|
-
return /* @__PURE__ */ jsxs8("div", { className: "modal-header d-flex align-items-center justify-content-between mb-1", children: [
|
|
1645
|
-
/* @__PURE__ */ jsxs8("div", { className: "d-flex align-items-center justify-content-start", children: [
|
|
1646
|
-
/* @__PURE__ */ jsxs8("h5", { className: "modal-title", children: [
|
|
1647
|
-
handleModalIcon(),
|
|
1648
|
-
" ",
|
|
1649
|
-
t(title)
|
|
1650
|
-
] }),
|
|
1651
|
-
component ? component() : /* @__PURE__ */ jsx8(Fragment10, {})
|
|
1652
|
-
] }),
|
|
1653
|
-
/* @__PURE__ */ jsx8("div", { className: "todo-item-action d-flex align-items-center", children: /* @__PURE__ */ jsx8(
|
|
1654
|
-
X2,
|
|
1655
|
-
{
|
|
1656
|
-
className: classNames3("fw-normal mt-25 cursor-pointer", { "d-none": !handleModal }),
|
|
1657
|
-
fontSize: 20,
|
|
1658
|
-
onClick: handleModal
|
|
1659
|
-
}
|
|
1660
|
-
) })
|
|
1661
|
-
] });
|
|
1662
|
-
};
|
|
1663
|
-
var modal_header_default = ModalHeader;
|
|
1664
|
-
|
|
1665
|
-
// src/component/sidebar/index.tsx
|
|
1666
|
-
import { ChevronLeft, ChevronRight } from "becoxy-icons";
|
|
1667
|
-
import classNames4 from "classnames";
|
|
1668
|
-
import { useEffect as useEffect5, useState as useState4 } from "react";
|
|
1669
|
-
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1670
|
-
var Sidebar = (props) => {
|
|
1671
|
-
const {
|
|
1672
|
-
open,
|
|
1673
|
-
children,
|
|
1674
|
-
toggleSidebar,
|
|
1675
|
-
width,
|
|
1676
|
-
keyboard,
|
|
1677
|
-
hiddenBackground,
|
|
1678
|
-
hiddenFullScreenButton
|
|
1679
|
-
} = props;
|
|
1680
|
-
const [isFullScreen, setIsFullScreen] = useState4(false);
|
|
1681
|
-
const [flag, setFlag] = useState4(open);
|
|
1682
|
-
useEffect5(() => {
|
|
1683
|
-
if (open !== flag) {
|
|
1684
|
-
if (open) {
|
|
1685
|
-
setFlag(open);
|
|
1686
|
-
} else {
|
|
1687
|
-
setTimeout(() => {
|
|
1688
|
-
setFlag(open);
|
|
1689
|
-
}, 50);
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
}, [open]);
|
|
1693
|
-
const handClose = () => {
|
|
1694
|
-
setFlag(false);
|
|
1695
|
-
setTimeout(() => {
|
|
1696
|
-
toggleSidebar();
|
|
1697
|
-
}, 400);
|
|
1698
|
-
};
|
|
1699
|
-
return /* @__PURE__ */ jsxs9(
|
|
1700
|
-
"div",
|
|
1701
|
-
{
|
|
1702
|
-
tabIndex: 0,
|
|
1703
|
-
className: classNames4({ "d-none": !open }),
|
|
1704
|
-
onKeyDown: (e) => {
|
|
1705
|
-
if (!keyboard && e.code === "Escape" && flag) {
|
|
1706
|
-
handClose();
|
|
1707
|
-
e.stopPropagation();
|
|
1708
|
-
e.preventDefault();
|
|
1709
|
-
}
|
|
1710
|
-
},
|
|
1711
|
-
children: [
|
|
1712
|
-
/* @__PURE__ */ jsx9(
|
|
1713
|
-
"div",
|
|
1714
|
-
{
|
|
1715
|
-
className: classNames4("offcanvas-backdrop fade", {
|
|
1716
|
-
"d-none": !flag || hiddenBackground,
|
|
1717
|
-
show: flag
|
|
1718
|
-
}),
|
|
1719
|
-
style: { zIndex: 1056 },
|
|
1720
|
-
onClick: handClose
|
|
1721
|
-
}
|
|
1722
|
-
),
|
|
1723
|
-
/* @__PURE__ */ jsxs9(
|
|
1724
|
-
"div",
|
|
1725
|
-
{
|
|
1726
|
-
className: classNames4("r-sidebar", `customizer-${width ?? 600}`, {
|
|
1727
|
-
open: flag,
|
|
1728
|
-
fullscreen: isFullScreen
|
|
1729
|
-
}),
|
|
1730
|
-
style: { zIndex: 1057 },
|
|
1731
|
-
children: [
|
|
1732
|
-
/* @__PURE__ */ jsxs9(
|
|
1548
|
+
})
|
|
1549
|
+
] });
|
|
1550
|
+
});
|
|
1551
|
+
const RenderTable = (props2) => {
|
|
1552
|
+
const {} = props2;
|
|
1553
|
+
let countDisplay = 0;
|
|
1554
|
+
return /* @__PURE__ */ jsxs7(Fragment11, { children: [
|
|
1555
|
+
/* @__PURE__ */ jsxs7("table", { style: { width: "100%" }, children: [
|
|
1556
|
+
!(noHeader && (columns?.length ?? 0) > 0) && /* @__PURE__ */ jsx8("thead", { className: "r-select-gridheader", children: /* @__PURE__ */ jsxs7("tr", { className: "r-select-row", role: "row", children: [
|
|
1557
|
+
isMulti && /* @__PURE__ */ jsx8(
|
|
1558
|
+
"th",
|
|
1559
|
+
{
|
|
1560
|
+
className: classnames4(`r-select-headercell checkbox-column`),
|
|
1561
|
+
style: { width: 40, minWidth: 40, maxWidth: 100, top: `0px` },
|
|
1562
|
+
children: /* @__PURE__ */ jsx8(
|
|
1733
1563
|
"div",
|
|
1734
1564
|
{
|
|
1735
|
-
style: {
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1565
|
+
style: { justifyContent: "center" },
|
|
1566
|
+
className: classnames4("r-select-headercell-div"),
|
|
1567
|
+
children: /* @__PURE__ */ jsx8(
|
|
1568
|
+
Input4,
|
|
1569
|
+
{
|
|
1570
|
+
checked: isSelectedAll,
|
|
1571
|
+
type: "checkbox",
|
|
1572
|
+
onClick: (e) => {
|
|
1573
|
+
if (isMulti) {
|
|
1574
|
+
if (isSelectedAll) {
|
|
1575
|
+
onChange([]);
|
|
1576
|
+
} else {
|
|
1577
|
+
onChange(getSelectAll(options));
|
|
1578
|
+
}
|
|
1579
|
+
e.stopPropagation();
|
|
1580
|
+
}
|
|
1581
|
+
},
|
|
1582
|
+
readOnly: true,
|
|
1583
|
+
className: classnames4("cursor-pointer", { "d-none": !isMulti }),
|
|
1584
|
+
style: { textAlign: "center", marginTop: 6 }
|
|
1585
|
+
}
|
|
1586
|
+
)
|
|
1757
1587
|
}
|
|
1758
|
-
)
|
|
1759
|
-
|
|
1760
|
-
|
|
1588
|
+
)
|
|
1589
|
+
}
|
|
1590
|
+
),
|
|
1591
|
+
(columns ? columns : defaultColumns).map((col, index) => {
|
|
1592
|
+
return renderHeaderCol(col, index);
|
|
1593
|
+
})
|
|
1594
|
+
] }) }),
|
|
1595
|
+
options.length > 0 && /* @__PURE__ */ jsx8(Fragment11, { children: /* @__PURE__ */ jsx8("tbody", { className: "r-select-gridcontent", children: options?.map((row, indexRow) => {
|
|
1596
|
+
if (checkSearch(searchTerm, row, columns ? columns : defaultColumns)) {
|
|
1597
|
+
const isSelected = value && (isMulti ? value?.some((x) => x === row[fieldValue ?? "value"]) : value[fieldValue ?? "value"] === row[fieldValue ?? "value"]);
|
|
1598
|
+
countDisplay++;
|
|
1599
|
+
return /* @__PURE__ */ jsx8(RenderElement, { isSelected, indexRow, row }, `select-table-${indexRow}`);
|
|
1761
1600
|
}
|
|
1762
|
-
)
|
|
1763
|
-
]
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
const { t } = useTranslation7();
|
|
1775
|
-
const [dataSource, setDataSource] = useState5([]);
|
|
1776
|
-
const [indexFocus, setIndexFocus] = useState5();
|
|
1777
|
-
useEffect6(() => {
|
|
1778
|
-
if (openSidebar) {
|
|
1779
|
-
setDataSource(column.map((e) => ({ ...e })));
|
|
1780
|
-
}
|
|
1781
|
-
}, [openSidebar]);
|
|
1782
|
-
const handleCancel = () => {
|
|
1783
|
-
handleSidebar();
|
|
1784
|
-
setDataSource([]);
|
|
1785
|
-
};
|
|
1786
|
-
const handleSubmit = () => {
|
|
1787
|
-
setColumn([...dataSource]);
|
|
1788
|
-
handleCancel();
|
|
1789
|
-
};
|
|
1790
|
-
const getWindowSize = () => {
|
|
1791
|
-
const { innerWidth, innerHeight } = window;
|
|
1792
|
-
return { innerWidth, innerHeight };
|
|
1793
|
-
};
|
|
1794
|
-
const [windowSize, setWindowSize] = useState5(getWindowSize());
|
|
1795
|
-
useEffect6(() => {
|
|
1796
|
-
const handleWindowResize = () => {
|
|
1797
|
-
setWindowSize(getWindowSize());
|
|
1798
|
-
};
|
|
1799
|
-
window.addEventListener("resize", handleWindowResize);
|
|
1800
|
-
return () => {
|
|
1801
|
-
window.removeEventListener("resize", handleWindowResize);
|
|
1802
|
-
};
|
|
1803
|
-
}, []);
|
|
1804
|
-
const renderFooterButtons = () => {
|
|
1805
|
-
return /* @__PURE__ */ jsxs10(Fragment11, { children: [
|
|
1806
|
-
/* @__PURE__ */ jsx10(Button3, { color: "primary", onClick: handleSubmit, className: "me-1", children: t("Confirm") }),
|
|
1807
|
-
/* @__PURE__ */ jsx10(Button3, { color: "secondary", onClick: handleCancel, outline: true, children: t("Close") })
|
|
1601
|
+
}) }) })
|
|
1602
|
+
] }),
|
|
1603
|
+
countDisplay === 0 && /* @__PURE__ */ jsxs7("div", { className: "r-no-data", children: [
|
|
1604
|
+
/* @__PURE__ */ jsx8("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxs7("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [
|
|
1605
|
+
/* @__PURE__ */ jsx8("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }),
|
|
1606
|
+
/* @__PURE__ */ jsxs7("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [
|
|
1607
|
+
/* @__PURE__ */ jsx8("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }),
|
|
1608
|
+
/* @__PURE__ */ jsx8("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", fill: "#fafafa" })
|
|
1609
|
+
] })
|
|
1610
|
+
] }) }),
|
|
1611
|
+
t("No data available.")
|
|
1612
|
+
] })
|
|
1808
1613
|
] });
|
|
1809
1614
|
};
|
|
1810
|
-
const
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
{
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
type: "checkbox",
|
|
1817
|
-
style: { height: 18 },
|
|
1818
|
-
className: " cursor-pointer",
|
|
1819
|
-
onChange: (e) => {
|
|
1820
|
-
if (dataSource) {
|
|
1821
|
-
dataSource[index].visible = e.target.checked;
|
|
1822
|
-
setDataSource(dataSource);
|
|
1823
|
-
}
|
|
1615
|
+
const getSelectedRecords = (tree, value2) => {
|
|
1616
|
+
const records = [];
|
|
1617
|
+
const traverse = (nodes) => {
|
|
1618
|
+
nodes.forEach((node) => {
|
|
1619
|
+
if (value2.includes(node[fieldValue ?? "value"])) {
|
|
1620
|
+
records.push(node);
|
|
1824
1621
|
}
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
};
|
|
1828
|
-
const fixColumnTemplate = (item, index) => {
|
|
1829
|
-
return /* @__PURE__ */ jsx10(
|
|
1830
|
-
Input5,
|
|
1831
|
-
{
|
|
1832
|
-
defaultChecked: item.fixedType === "left" || item.fixedType === "right",
|
|
1833
|
-
type: "checkbox",
|
|
1834
|
-
style: { height: 18 },
|
|
1835
|
-
className: " cursor-pointer",
|
|
1836
|
-
onChange: (e) => {
|
|
1837
|
-
if (dataSource) {
|
|
1838
|
-
if (e.target.checked) {
|
|
1839
|
-
if (index * 2 <= dataSource.length) {
|
|
1840
|
-
dataSource[index].fixedType = "left";
|
|
1841
|
-
} else {
|
|
1842
|
-
dataSource[index].fixedType = "right";
|
|
1843
|
-
}
|
|
1844
|
-
} else {
|
|
1845
|
-
dataSource[index].fixedType = void 0;
|
|
1846
|
-
}
|
|
1847
|
-
setDataSource(dataSource);
|
|
1848
|
-
}
|
|
1622
|
+
if (node.children && node.children.length > 0) {
|
|
1623
|
+
traverse(node.children);
|
|
1849
1624
|
}
|
|
1850
|
-
}
|
|
1851
|
-
|
|
1625
|
+
});
|
|
1626
|
+
};
|
|
1627
|
+
traverse(tree);
|
|
1628
|
+
return records;
|
|
1852
1629
|
};
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
field: "headerText",
|
|
1856
|
-
headerText: "Column name",
|
|
1857
|
-
template: (e) => {
|
|
1858
|
-
return /* @__PURE__ */ jsx10(Fragment12, { children: t(e.headerText) });
|
|
1859
|
-
},
|
|
1860
|
-
visible: true,
|
|
1861
|
-
width: 175,
|
|
1862
|
-
maxWidth: 200,
|
|
1863
|
-
minWidth: 150
|
|
1864
|
-
},
|
|
1865
|
-
{
|
|
1866
|
-
field: "",
|
|
1867
|
-
template: visibleTemplate,
|
|
1868
|
-
headerText: "Display",
|
|
1869
|
-
textAlign: "center",
|
|
1870
|
-
visible: true,
|
|
1871
|
-
width: 100,
|
|
1872
|
-
maxWidth: 120,
|
|
1873
|
-
minWidth: 80
|
|
1874
|
-
},
|
|
1630
|
+
return /* @__PURE__ */ jsx8(
|
|
1631
|
+
"div",
|
|
1875
1632
|
{
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
visible: true,
|
|
1890
|
-
width: 100,
|
|
1891
|
-
maxWidth: 120,
|
|
1892
|
-
minWidth: 80
|
|
1893
|
-
}
|
|
1894
|
-
];
|
|
1895
|
-
const renderHeaderCol = (col, indexCol) => {
|
|
1896
|
-
return /* @__PURE__ */ jsx10(
|
|
1897
|
-
Fragment11,
|
|
1898
|
-
{
|
|
1899
|
-
children: col.visible !== false && /* @__PURE__ */ jsx10(
|
|
1900
|
-
"th",
|
|
1901
|
-
{
|
|
1902
|
-
className: classnames5(
|
|
1903
|
-
`r-headercell fix-${col.fixedType}`,
|
|
1904
|
-
{ "cell-fixed": col.fixedType }
|
|
1905
|
-
),
|
|
1906
|
-
style: {
|
|
1907
|
-
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
1908
|
-
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
1909
|
-
top: `${0 * 42}px`,
|
|
1910
|
-
maxWidth: col.maxWidth
|
|
1911
|
-
},
|
|
1912
|
-
children: /* @__PURE__ */ jsx10(
|
|
1913
|
-
"div",
|
|
1914
|
-
{
|
|
1915
|
-
role: "textbox",
|
|
1916
|
-
title: t(col.headerText ?? ""),
|
|
1917
|
-
style: {
|
|
1918
|
-
height: `${1 * 42}px`,
|
|
1919
|
-
justifyContent: col.textAlign ?? "left"
|
|
1920
|
-
},
|
|
1921
|
-
className: "r-headercell-div",
|
|
1922
|
-
children: t(col.headerText ?? "")
|
|
1923
|
-
}
|
|
1924
|
-
)
|
|
1925
|
-
}
|
|
1926
|
-
)
|
|
1927
|
-
},
|
|
1928
|
-
`header-${indexCol}`
|
|
1929
|
-
);
|
|
1930
|
-
};
|
|
1931
|
-
return /* @__PURE__ */ jsxs10(
|
|
1932
|
-
sidebar_default,
|
|
1933
|
-
{
|
|
1934
|
-
open: openSidebar,
|
|
1935
|
-
toggleSidebar: handleCancel,
|
|
1936
|
-
width: 700,
|
|
1937
|
-
children: [
|
|
1938
|
-
/* @__PURE__ */ jsx10(modal_header_default, { typeModal: "Edit", handleModal: handleCancel, title: "Column setup" }),
|
|
1939
|
-
/* @__PURE__ */ jsx10("div", { className: "ms-2 react-table-edit", children: /* @__PURE__ */ jsx10("div", { className: "r-grid", children: /* @__PURE__ */ jsx10("div", { className: "r-gridtable", style: { height: windowSize.innerHeight - 120 }, children: /* @__PURE__ */ jsxs10("table", { style: { width: "100%" }, children: [
|
|
1940
|
-
/* @__PURE__ */ jsx10("thead", { className: "r-gridheader", children: /* @__PURE__ */ jsx10("tr", { className: "r-row", role: "row", children: columns.map((col, index) => {
|
|
1941
|
-
return renderHeaderCol(col, index);
|
|
1942
|
-
}) }) }),
|
|
1943
|
-
/* @__PURE__ */ jsx10("tbody", { className: "r-gridcontent", children: dataSource?.map((row, indexRow) => {
|
|
1944
|
-
return /* @__PURE__ */ jsx10(
|
|
1945
|
-
"tr",
|
|
1633
|
+
className: classnames4("react-select-table", { "is-invalid": invalid }),
|
|
1634
|
+
ref,
|
|
1635
|
+
id,
|
|
1636
|
+
children: /* @__PURE__ */ jsx8("div", { ref: selectTableRef, children: /* @__PURE__ */ jsxs7(
|
|
1637
|
+
Dropdown2,
|
|
1638
|
+
{
|
|
1639
|
+
isOpen: dropdownOpen,
|
|
1640
|
+
toggle: () => {
|
|
1641
|
+
},
|
|
1642
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1643
|
+
children: [
|
|
1644
|
+
/* @__PURE__ */ jsxs7(
|
|
1645
|
+
DropdownToggle2,
|
|
1946
1646
|
{
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
value = formartNumberic(row[col.field], ",", ".", col.numericSettings?.fraction, true) ?? 0;
|
|
1647
|
+
onClick: (e) => {
|
|
1648
|
+
if (!isDisabled) {
|
|
1649
|
+
inputRef?.current.focus();
|
|
1650
|
+
handleOpenClose();
|
|
1952
1651
|
}
|
|
1953
|
-
|
|
1954
|
-
|
|
1652
|
+
e.preventDefault();
|
|
1653
|
+
},
|
|
1654
|
+
tag: "div",
|
|
1655
|
+
style: { width: "100%" },
|
|
1656
|
+
className: classnames4("select-table-control", { "r-select-is-disabled": isDisabled }, { "r-select-is-open": dropdownOpen }, { "r-select-is-focus": isFocus }, { "r-select-is-invalid": invalid }),
|
|
1657
|
+
children: [
|
|
1658
|
+
/* @__PURE__ */ jsxs7("div", { className: "select-table-container", children: [
|
|
1659
|
+
isMulti ? /* @__PURE__ */ jsx8(Fragment11, { children: /* @__PURE__ */ jsx8("div", { className: classnames4("select-value is-mutil", { "d-none": searchTerm }), children: getSelectedRecords(options, value).map((ele, index) => {
|
|
1660
|
+
return /* @__PURE__ */ jsxs7("span", { children: [
|
|
1661
|
+
index === 0 ? "" : ", ",
|
|
1662
|
+
ele[fieldLabel ?? "label"]
|
|
1663
|
+
] }, index);
|
|
1664
|
+
}) }) }) : /* @__PURE__ */ jsx8(Fragment11, { children: /* @__PURE__ */ jsxs7("div", { className: classnames4("select-value", { "d-none": searchTerm }), children: [
|
|
1665
|
+
value ? formatOptionLabel ? formatOptionLabel(value) : value[fieldLabel ?? "label"] : "",
|
|
1666
|
+
" "
|
|
1667
|
+
] }) }),
|
|
1668
|
+
!((isMulti ? value?.length > 0 : value) || isDisabled || searchTerm) && /* @__PURE__ */ jsx8("div", { className: classnames4("select-placeholder"), children: placeholder }),
|
|
1669
|
+
/* @__PURE__ */ jsx8("div", { className: "input-container", children: /* @__PURE__ */ jsx8(
|
|
1670
|
+
"input",
|
|
1671
|
+
{
|
|
1672
|
+
style: { textAlign: textAlign ?? "left" },
|
|
1673
|
+
ref: inputRef,
|
|
1674
|
+
className: classnames4("select-input"),
|
|
1675
|
+
readOnly: isDisabled,
|
|
1676
|
+
value: searchTerm,
|
|
1677
|
+
onPaste: (e) => onPaste && !dropdownOpen && onPaste(e),
|
|
1678
|
+
onChange: (val) => {
|
|
1679
|
+
setSearchTerm(val.target.value);
|
|
1680
|
+
},
|
|
1681
|
+
onKeyDown: (e) => handleOnKeyDown(e)
|
|
1682
|
+
}
|
|
1683
|
+
) })
|
|
1684
|
+
] }),
|
|
1685
|
+
isClearable && value && !isDisabled && /* @__PURE__ */ jsx8(
|
|
1686
|
+
"div",
|
|
1955
1687
|
{
|
|
1956
|
-
className:
|
|
1957
|
-
`r-rowcell fix-${col.fixedType}`,
|
|
1958
|
-
{ "cell-fixed": col.fixedType },
|
|
1959
|
-
{ "r-active": indexFocus === indexRow }
|
|
1960
|
-
),
|
|
1961
|
-
style: {
|
|
1962
|
-
padding: 0,
|
|
1963
|
-
textAlign: col.textAlign ? col.textAlign : "left"
|
|
1964
|
-
},
|
|
1965
|
-
onFocus: (e) => {
|
|
1966
|
-
if (indexRow !== indexFocus) {
|
|
1967
|
-
setIndexFocus(indexRow);
|
|
1968
|
-
}
|
|
1969
|
-
e.stopPropagation();
|
|
1970
|
-
},
|
|
1688
|
+
className: classnames4("cursor-pointer"),
|
|
1971
1689
|
onClick: (e) => {
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
setIndexFocus(indexRow);
|
|
1975
|
-
}
|
|
1976
|
-
e.stopPropagation();
|
|
1977
|
-
}
|
|
1690
|
+
onChange(isMulti ? [] : void 0);
|
|
1691
|
+
e.stopPropagation();
|
|
1978
1692
|
},
|
|
1979
|
-
children: /* @__PURE__ */
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1693
|
+
children: /* @__PURE__ */ jsx8("svg", { height: "20", width: "20", color: "#c4c4c4", viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", className: "css-tj5bde-Svg", children: /* @__PURE__ */ jsx8("path", { d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z" }) })
|
|
1694
|
+
}
|
|
1695
|
+
),
|
|
1696
|
+
!isDisabled && /* @__PURE__ */ jsx8("div", { className: "select-table-indicator", onMouseDown: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx8("svg", { height: "20", width: "20", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx8("path", { d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z" }) }) })
|
|
1697
|
+
]
|
|
1698
|
+
}
|
|
1699
|
+
),
|
|
1700
|
+
/* @__PURE__ */ jsx8(
|
|
1701
|
+
DropdownMenu2,
|
|
1702
|
+
{
|
|
1703
|
+
container: component,
|
|
1704
|
+
className: "formula-dropdown icon-dropdown p-0",
|
|
1705
|
+
style: {
|
|
1706
|
+
width: width ? width + 2 : "min-content",
|
|
1707
|
+
position: "fixed",
|
|
1708
|
+
borderRadius: 4,
|
|
1709
|
+
zIndex: 9999
|
|
1710
|
+
},
|
|
1711
|
+
children: /* @__PURE__ */ jsx8(DropdownItem2, { className: classnames4("p-0 menu-select-table"), style: { borderRadius: "6px" }, tag: "div", header: true, children: dropdownOpen && /* @__PURE__ */ jsx8(
|
|
1712
|
+
"div",
|
|
1713
|
+
{
|
|
1714
|
+
onMouseDown: (e) => {
|
|
1715
|
+
if (!isDisabled) {
|
|
1716
|
+
inputRef?.current.focus();
|
|
1717
|
+
e.preventDefault();
|
|
1718
|
+
}
|
|
1998
1719
|
},
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
1720
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "r-select-grid r-select-tree-grid", children: [
|
|
1721
|
+
/* @__PURE__ */ jsx8("div", { className: "r-select-gridtable ", ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight2 }, children: /* @__PURE__ */ jsx8(RenderTable, {}) }),
|
|
1722
|
+
/* @__PURE__ */ jsxs7("div", { className: classnames4("r-select-footer", { "d-none": !(showFooter === true || handleAdd || isMulti) }), children: [
|
|
1723
|
+
/* @__PURE__ */ jsxs7(Button3, { outline: true, color: "primary", onClick: handleAdd, className: classnames4("r-btn d-flex align-items-center", { "d-none": !handleAdd }), children: [
|
|
1724
|
+
/* @__PURE__ */ jsx8(Plus2, { className: "me-50", fontSize: 16 }),
|
|
1725
|
+
t("AddNew"),
|
|
1726
|
+
" (F9)"
|
|
1727
|
+
] }),
|
|
1728
|
+
isMulti && /* @__PURE__ */ jsx8("div", { className: "ms-50 text-primary h-100 d-flex align-items-center", onClick: handleAdd, children: t("countSelected", { item: value?.length ?? 0 }) }),
|
|
1729
|
+
footerComponent ? footerComponent() : null
|
|
1730
|
+
] })
|
|
1731
|
+
] })
|
|
1732
|
+
}
|
|
1733
|
+
) })
|
|
1734
|
+
}
|
|
1735
|
+
)
|
|
1736
|
+
]
|
|
1737
|
+
}
|
|
1738
|
+
) })
|
|
2016
1739
|
}
|
|
2017
1740
|
);
|
|
1741
|
+
});
|
|
1742
|
+
|
|
1743
|
+
// src/component/table/index.tsx
|
|
1744
|
+
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
1745
|
+
|
|
1746
|
+
// src/component/table/toolbar-top.tsx
|
|
1747
|
+
import { Fragment as Fragment12, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1748
|
+
var renderToolbarTop = (toolbarTopOption) => {
|
|
1749
|
+
return /* @__PURE__ */ jsx9("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: /* @__PURE__ */ jsxs8("div", { className: "r-toolbar-items", children: [
|
|
1750
|
+
/* @__PURE__ */ jsx9("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
|
|
1751
|
+
return item.align === "left" ? /* @__PURE__ */ jsx9(Fragment12, { children: /* @__PURE__ */ jsx9("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) }) : "";
|
|
1752
|
+
}) }),
|
|
1753
|
+
/* @__PURE__ */ jsx9("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
|
|
1754
|
+
return item.align === "center" ? /* @__PURE__ */ jsx9(Fragment12, { children: /* @__PURE__ */ jsx9("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) }) : "";
|
|
1755
|
+
}) }),
|
|
1756
|
+
/* @__PURE__ */ jsx9("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
|
|
1757
|
+
return item.align === "right" ? /* @__PURE__ */ jsx9(Fragment12, { children: /* @__PURE__ */ jsx9("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) }) : "";
|
|
1758
|
+
}) })
|
|
1759
|
+
] }) });
|
|
2018
1760
|
};
|
|
2019
|
-
var
|
|
1761
|
+
var toolbar_top_default = renderToolbarTop;
|
|
2020
1762
|
|
|
2021
|
-
// src/component/
|
|
2022
|
-
import {
|
|
2023
|
-
import
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
)
|
|
2053
|
-
|
|
2054
|
-
|
|
1763
|
+
// src/component/edit-form/index.tsx
|
|
1764
|
+
import { forwardRef as forwardRef3, useEffect as useEffect6, useRef as useRef3, useState as useState5 } from "react";
|
|
1765
|
+
import {
|
|
1766
|
+
DropdownItem as DropdownItem3,
|
|
1767
|
+
DropdownMenu as DropdownMenu3,
|
|
1768
|
+
DropdownToggle as DropdownToggle3,
|
|
1769
|
+
Dropdown as Dropdown3,
|
|
1770
|
+
Input as Input6,
|
|
1771
|
+
Row,
|
|
1772
|
+
Button as Button4,
|
|
1773
|
+
Col
|
|
1774
|
+
} from "reactstrap";
|
|
1775
|
+
import { useForm } from "react-hook-form";
|
|
1776
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
1777
|
+
import { useTranslation as useTranslation9 } from "react-i18next";
|
|
1778
|
+
import classNames3 from "classnames";
|
|
1779
|
+
|
|
1780
|
+
// src/component/input-text/index.tsx
|
|
1781
|
+
import { Controller } from "react-hook-form";
|
|
1782
|
+
import { Input as Input5, Label, FormFeedback } from "reactstrap";
|
|
1783
|
+
import classnames5 from "classnames";
|
|
1784
|
+
import { Fragment as Fragment13 } from "react";
|
|
1785
|
+
import { useTranslation as useTranslation6 } from "react-i18next";
|
|
1786
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1787
|
+
var TextInput = (props) => {
|
|
1788
|
+
const { t } = useTranslation6();
|
|
1789
|
+
const { control, id, name, min, max, type, label, labelSize, required, errors, height, disabled, row, isLabel, placeholder, autoFocus, inLine, callback, readOnly, classes, ...rest } = props;
|
|
1790
|
+
const renderLabel = () => {
|
|
1791
|
+
return /* @__PURE__ */ jsx10(Fragment13, { children: isLabel === false ? "" : /* @__PURE__ */ jsxs9(Label, { for: name, children: [
|
|
1792
|
+
t(label ? label : ""),
|
|
1793
|
+
" ",
|
|
1794
|
+
required ? /* @__PURE__ */ jsx10("span", { className: "text-danger", children: "*" }) : "",
|
|
1795
|
+
" "
|
|
1796
|
+
] }) });
|
|
2055
1797
|
};
|
|
2056
|
-
|
|
2057
|
-
/* @__PURE__ */
|
|
2058
|
-
/* @__PURE__ */
|
|
2059
|
-
|
|
2060
|
-
/* @__PURE__ */ jsx11(
|
|
2061
|
-
"button",
|
|
2062
|
-
{
|
|
2063
|
-
className: classNames5("r-button", { "d-none": currentPageNumber === 1 }),
|
|
2064
|
-
type: "button",
|
|
2065
|
-
onClick: () => {
|
|
2066
|
-
setCurrentPageNumber(currentPageNumber - 1);
|
|
2067
|
-
onChangePage({ totalItem, pageSize, currentPage: (currentPageNumber - 2) * 5 + 1, old: currentPage });
|
|
2068
|
-
},
|
|
2069
|
-
children: "..."
|
|
2070
|
-
}
|
|
2071
|
-
),
|
|
2072
|
-
renderPageNumber(currentPageNumber),
|
|
2073
|
-
/* @__PURE__ */ jsx11(
|
|
2074
|
-
"button",
|
|
1798
|
+
const renderInput = () => {
|
|
1799
|
+
return /* @__PURE__ */ jsxs9(Fragment13, { children: [
|
|
1800
|
+
/* @__PURE__ */ jsx10(
|
|
1801
|
+
Controller,
|
|
2075
1802
|
{
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
1803
|
+
name,
|
|
1804
|
+
control,
|
|
1805
|
+
render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsx10(
|
|
1806
|
+
Input5,
|
|
1807
|
+
{
|
|
1808
|
+
id,
|
|
1809
|
+
value: !isNullOrUndefined(value) ? value : "",
|
|
1810
|
+
onChange: (val) => {
|
|
1811
|
+
if (min || max) {
|
|
1812
|
+
if (min && Number(val.target.value) >= min) {
|
|
1813
|
+
onChange(val.target.value);
|
|
1814
|
+
if (callback) {
|
|
1815
|
+
callback(val);
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
if (max && Number(val.target.value) <= max) {
|
|
1819
|
+
onChange(val.target.value);
|
|
1820
|
+
if (callback) {
|
|
1821
|
+
callback(val);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
} else {
|
|
1825
|
+
onChange(val.target.value);
|
|
1826
|
+
if (callback) {
|
|
1827
|
+
callback(val);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
},
|
|
1831
|
+
style: { height: `${height}px` },
|
|
1832
|
+
autoFocus,
|
|
1833
|
+
disabled,
|
|
1834
|
+
placeholder,
|
|
1835
|
+
type: type ? type : "text",
|
|
1836
|
+
invalid: errors && true,
|
|
1837
|
+
className: "h-100",
|
|
1838
|
+
rows: row,
|
|
1839
|
+
min,
|
|
1840
|
+
max,
|
|
1841
|
+
readOnly,
|
|
1842
|
+
...rest
|
|
1843
|
+
}
|
|
1844
|
+
)
|
|
2083
1845
|
}
|
|
2084
1846
|
),
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
1847
|
+
errors && /* @__PURE__ */ jsx10(FormFeedback, { children: errors?.message })
|
|
1848
|
+
] });
|
|
1849
|
+
};
|
|
1850
|
+
return /* @__PURE__ */ jsx10(Fragment13, { children: /* @__PURE__ */ jsxs9(
|
|
1851
|
+
"div",
|
|
1852
|
+
{
|
|
1853
|
+
className: classnames5(
|
|
1854
|
+
" align",
|
|
2089
1855
|
{
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
] }),
|
|
2103
|
-
/* @__PURE__ */ jsx11("div", { className: "r-parentmsgbar", children: t("totalItemsInfo", { page: currentPage, countPage, totalItem }) })
|
|
2104
|
-
] }) });
|
|
1856
|
+
[labelSize ? labelSize : ""]: labelSize,
|
|
1857
|
+
[classes ? classes : ""]: classes,
|
|
1858
|
+
"form-row-inline-error": errors
|
|
1859
|
+
},
|
|
1860
|
+
inLine === false ? "form-group " : "form-row-inline d-flex"
|
|
1861
|
+
),
|
|
1862
|
+
children: [
|
|
1863
|
+
renderLabel(),
|
|
1864
|
+
/* @__PURE__ */ jsx10("div", { className: classnames5("form-input-content", { "hidden-label": isLabel === false }), children: renderInput() })
|
|
1865
|
+
]
|
|
1866
|
+
}
|
|
1867
|
+
) });
|
|
2105
1868
|
};
|
|
1869
|
+
var input_text_default = TextInput;
|
|
2106
1870
|
|
|
2107
|
-
// src/component/
|
|
2108
|
-
import {
|
|
1871
|
+
// src/component/input-number/index.tsx
|
|
1872
|
+
import { Controller as Controller2 } from "react-hook-form";
|
|
1873
|
+
import { Label as Label2, FormFeedback as FormFeedback2 } from "reactstrap";
|
|
2109
1874
|
import classnames6 from "classnames";
|
|
2110
|
-
import {
|
|
2111
|
-
import {
|
|
2112
|
-
import {
|
|
2113
|
-
import "react-
|
|
2114
|
-
|
|
2115
|
-
var HeaderTableCol = (props) => {
|
|
1875
|
+
import { Fragment as Fragment14 } from "react";
|
|
1876
|
+
import { NumericFormat } from "react-number-format";
|
|
1877
|
+
import { useTranslation as useTranslation7 } from "react-i18next";
|
|
1878
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1879
|
+
var NumberInput = (props) => {
|
|
2116
1880
|
const {
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
1881
|
+
id,
|
|
1882
|
+
control,
|
|
1883
|
+
fractionCurrency,
|
|
1884
|
+
name,
|
|
1885
|
+
min,
|
|
1886
|
+
max,
|
|
1887
|
+
label,
|
|
1888
|
+
labelSize,
|
|
1889
|
+
required,
|
|
1890
|
+
errors,
|
|
1891
|
+
disabled,
|
|
1892
|
+
isLabel,
|
|
1893
|
+
fixedDecimalScale,
|
|
1894
|
+
placeholder,
|
|
1895
|
+
inLine,
|
|
1896
|
+
callback,
|
|
1897
|
+
decimalSeparator = ",",
|
|
1898
|
+
thousandSeparator = ".",
|
|
1899
|
+
classes,
|
|
1900
|
+
width,
|
|
1901
|
+
allowNegative
|
|
2129
1902
|
} = props;
|
|
2130
|
-
const { t } =
|
|
2131
|
-
const
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
1903
|
+
const { t } = useTranslation7();
|
|
1904
|
+
const renderLabel = () => {
|
|
1905
|
+
return /* @__PURE__ */ jsx11(Fragment14, { children: isLabel === false ? "" : /* @__PURE__ */ jsxs10(Label2, { className: "form-label", for: name, children: [
|
|
1906
|
+
t(label ? label : ""),
|
|
1907
|
+
" ",
|
|
1908
|
+
required ? /* @__PURE__ */ jsx11("span", { className: "text-danger", children: "*" }) : "",
|
|
1909
|
+
" "
|
|
1910
|
+
] }) });
|
|
2137
1911
|
};
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
width: typeof col.width === "number" ? col.width : Number((col.width ?? "").replaceAll(new RegExp(`[^0-9]`, "g"), "")),
|
|
2143
|
-
height: 0,
|
|
2144
|
-
onResize: handleResize,
|
|
2145
|
-
draggableOpts: { enableUserSelectHack: false },
|
|
2146
|
-
children: /* @__PURE__ */ jsx12(
|
|
2147
|
-
"th",
|
|
1912
|
+
const renderInput = () => {
|
|
1913
|
+
return /* @__PURE__ */ jsxs10(Fragment14, { children: [
|
|
1914
|
+
/* @__PURE__ */ jsx11(
|
|
1915
|
+
Controller2,
|
|
2148
1916
|
{
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
} else {
|
|
2180
|
-
setSelectedRows([]);
|
|
2181
|
-
}
|
|
2182
|
-
}
|
|
2183
|
-
}
|
|
1917
|
+
name,
|
|
1918
|
+
control,
|
|
1919
|
+
render: ({ field: { value, onChange } }) => {
|
|
1920
|
+
let floatValue = parseFloat(value);
|
|
1921
|
+
const numericFormatProps = {
|
|
1922
|
+
value: !isNullOrUndefined(value) ? value : "",
|
|
1923
|
+
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
1924
|
+
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
1925
|
+
allowNegative: allowNegative ?? false,
|
|
1926
|
+
decimalScale: fractionCurrency ?? 0,
|
|
1927
|
+
fixedDecimalScale
|
|
1928
|
+
};
|
|
1929
|
+
return /* @__PURE__ */ jsx11(
|
|
1930
|
+
NumericFormat,
|
|
1931
|
+
{
|
|
1932
|
+
...numericFormatProps,
|
|
1933
|
+
className: classnames6("form-control text-right", {
|
|
1934
|
+
"is-invalid": errors
|
|
1935
|
+
}),
|
|
1936
|
+
onValueChange: (values) => {
|
|
1937
|
+
floatValue = values?.floatValue;
|
|
1938
|
+
const textBeforeDot = values?.value.split(".")[1];
|
|
1939
|
+
onChange(textBeforeDot ? parseFloat(values?.value).toFixed(textBeforeDot.length) : values?.floatValue);
|
|
1940
|
+
},
|
|
1941
|
+
onFocus: (e) => {
|
|
1942
|
+
e.target.setSelectionRange(0, e.target.innerText.length - 1);
|
|
1943
|
+
},
|
|
1944
|
+
onChange: () => {
|
|
1945
|
+
if (callback) {
|
|
1946
|
+
callback(floatValue);
|
|
2184
1947
|
}
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
1948
|
+
},
|
|
1949
|
+
onBlur: () => {
|
|
1950
|
+
if (max && floatValue > max) {
|
|
1951
|
+
onChange(max);
|
|
1952
|
+
} else if (min && floatValue < min) {
|
|
1953
|
+
onChange(min);
|
|
1954
|
+
} else {
|
|
1955
|
+
onChange(floatValue);
|
|
1956
|
+
}
|
|
1957
|
+
},
|
|
1958
|
+
placeholder,
|
|
1959
|
+
disabled
|
|
1960
|
+
}
|
|
1961
|
+
);
|
|
1962
|
+
}
|
|
2190
1963
|
}
|
|
2191
|
-
)
|
|
1964
|
+
),
|
|
1965
|
+
errors && /* @__PURE__ */ jsx11(FormFeedback2, { children: errors?.message })
|
|
1966
|
+
] });
|
|
1967
|
+
};
|
|
1968
|
+
return /* @__PURE__ */ jsx11(Fragment14, { children: /* @__PURE__ */ jsxs10(
|
|
1969
|
+
"div",
|
|
1970
|
+
{
|
|
1971
|
+
className: classnames6(
|
|
1972
|
+
" align",
|
|
1973
|
+
{
|
|
1974
|
+
[labelSize ? labelSize : ""]: labelSize,
|
|
1975
|
+
[classes ? classes : ""]: classes,
|
|
1976
|
+
"form-row-inline-error": errors
|
|
1977
|
+
},
|
|
1978
|
+
inLine === false ? "form-group " : "form-row-inline d-flex"
|
|
1979
|
+
),
|
|
1980
|
+
children: [
|
|
1981
|
+
renderLabel(),
|
|
1982
|
+
/* @__PURE__ */ jsx11("div", { style: { width: width ? width : void 0 }, className: classnames6("form-input-content", { "hidden-label": isLabel === false }), children: renderInput() })
|
|
1983
|
+
]
|
|
2192
1984
|
}
|
|
2193
|
-
) }
|
|
1985
|
+
) });
|
|
2194
1986
|
};
|
|
2195
|
-
var
|
|
1987
|
+
var input_number_default = NumberInput;
|
|
2196
1988
|
|
|
2197
|
-
// src/component/table/
|
|
2198
|
-
import {
|
|
1989
|
+
// src/component/edit-form/select-table/index.tsx
|
|
1990
|
+
import { Controller as Controller3 } from "react-hook-form";
|
|
1991
|
+
import { FormFeedback as FormFeedback3, Label as Label3, UncontrolledTooltip as UncontrolledTooltip4 } from "reactstrap";
|
|
2199
1992
|
import classnames7 from "classnames";
|
|
2200
|
-
import {
|
|
2201
|
-
import { useTranslation as
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
1993
|
+
import { Fragment as Fragment15 } from "react";
|
|
1994
|
+
import { useTranslation as useTranslation8 } from "react-i18next";
|
|
1995
|
+
import { Fragment as Fragment16, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1996
|
+
var SelectTableBox = (props) => {
|
|
1997
|
+
const {
|
|
1998
|
+
isMulti,
|
|
1999
|
+
isLabel,
|
|
2000
|
+
confirmHandle,
|
|
2001
|
+
id,
|
|
2002
|
+
fieldValue,
|
|
2003
|
+
fieldLabel,
|
|
2004
|
+
labelComponent,
|
|
2005
|
+
defaultOptions,
|
|
2006
|
+
loadOptions,
|
|
2007
|
+
control,
|
|
2008
|
+
placeholder,
|
|
2009
|
+
disabled,
|
|
2010
|
+
name,
|
|
2011
|
+
label,
|
|
2012
|
+
labelSize,
|
|
2013
|
+
required,
|
|
2014
|
+
errors,
|
|
2015
|
+
inLine,
|
|
2016
|
+
callback,
|
|
2017
|
+
desciptionLabel,
|
|
2018
|
+
classLabel,
|
|
2019
|
+
isClearable,
|
|
2020
|
+
defaultValue,
|
|
2021
|
+
handleAddNew,
|
|
2022
|
+
columns,
|
|
2023
|
+
...rest
|
|
2024
|
+
} = props;
|
|
2025
|
+
const handChange = ({ onChange, val }) => {
|
|
2026
|
+
onChange(!isNullOrUndefined(val) && isMulti ? val.map((item) => item.value) : !isNullOrUndefined(val) && !isMulti ? fieldValue ? val[fieldValue] : val?.value : void 0);
|
|
2027
|
+
if (callback) {
|
|
2028
|
+
callback(val);
|
|
2029
|
+
}
|
|
2030
|
+
};
|
|
2031
|
+
const renderLabel = (props2) => {
|
|
2032
|
+
const { t } = useTranslation8();
|
|
2033
|
+
const { isLabel: isLabel2, desciptionLabel: desciptionLabel2, id: id2, classLabel: classLabel2, name: name2, label: label2, required: required2 } = props2;
|
|
2034
|
+
return /* @__PURE__ */ jsxs11(Fragment15, { children: [
|
|
2035
|
+
isLabel2 === false ? "" : /* @__PURE__ */ jsxs11(Label3, { id: `label-${id2}`, className: classLabel2, for: name2, children: [
|
|
2036
|
+
t(label2 ? label2 : ""),
|
|
2037
|
+
" ",
|
|
2038
|
+
required2 ? /* @__PURE__ */ jsx12("span", { className: "text-danger", children: "*" }) : ""
|
|
2039
|
+
] }),
|
|
2040
|
+
(!isNullOrUndefined(desciptionLabel2) && desciptionLabel2 !== "") ?? /* @__PURE__ */ jsx12(Fragment16, { children: /* @__PURE__ */ jsx12(UncontrolledTooltip4, { target: `label-${id2}`, children: t(desciptionLabel2 ?? "") }) })
|
|
2041
|
+
] });
|
|
2042
|
+
};
|
|
2043
|
+
return /* @__PURE__ */ jsx12(Fragment15, { children: /* @__PURE__ */ jsxs11(
|
|
2044
|
+
"div",
|
|
2045
|
+
{
|
|
2046
|
+
className: classnames7(
|
|
2047
|
+
inLine === false ? "form-group " : "form-row-inline d-flex",
|
|
2048
|
+
"align",
|
|
2049
|
+
{
|
|
2050
|
+
[labelSize ? labelSize : ""]: labelSize,
|
|
2051
|
+
"form-row-inline-error": errors
|
|
2052
|
+
}
|
|
2053
|
+
),
|
|
2054
|
+
children: [
|
|
2055
|
+
renderLabel({ isLabel, desciptionLabel, classLabel, name, label, required, id: id ?? "" }),
|
|
2056
|
+
/* @__PURE__ */ jsxs11("div", { className: classnames7("form-input-content", { "hidden-label": isLabel === false }), children: [
|
|
2057
|
+
/* @__PURE__ */ jsx12(
|
|
2058
|
+
Controller3,
|
|
2059
|
+
{
|
|
2060
|
+
name,
|
|
2061
|
+
control,
|
|
2062
|
+
render: ({ field: { value, onChange } }) => {
|
|
2063
|
+
return /* @__PURE__ */ jsx12(
|
|
2064
|
+
SelectTable,
|
|
2065
|
+
{
|
|
2066
|
+
...rest,
|
|
2067
|
+
id,
|
|
2068
|
+
value: (isMulti ? value?.length > 0 : value) ? !isMulti ? defaultOptions.find((val) => val[fieldValue ?? "value"] === value) ?? (defaultValue ?? "") : value : isMulti ? [] : void 0,
|
|
2069
|
+
onChange: (val) => {
|
|
2070
|
+
if (isMulti || (fieldValue && val ? val[fieldValue] : val?.value) !== value) {
|
|
2071
|
+
if (confirmHandle) {
|
|
2072
|
+
confirmHandle(handChange, onChange, val);
|
|
2073
|
+
} else {
|
|
2074
|
+
if (isMulti) {
|
|
2075
|
+
onChange(!isNullOrUndefined(val) ? val.map((item) => item[fieldValue ?? "value"]) : []);
|
|
2076
|
+
} else {
|
|
2077
|
+
onChange(!isNullOrUndefined(val) ? val[fieldValue ?? "value"] : void 0);
|
|
2078
|
+
}
|
|
2079
|
+
if (callback) {
|
|
2080
|
+
callback(val);
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
},
|
|
2085
|
+
handleAdd: handleAddNew,
|
|
2086
|
+
isClearable,
|
|
2087
|
+
isMulti,
|
|
2088
|
+
placeholder,
|
|
2089
|
+
invalid: errors,
|
|
2090
|
+
loadOptions,
|
|
2091
|
+
options: defaultOptions,
|
|
2092
|
+
isDisabled: disabled,
|
|
2093
|
+
columns,
|
|
2094
|
+
fieldValue,
|
|
2095
|
+
fieldLabel,
|
|
2096
|
+
formatOptionLabel: labelComponent ? labelComponent : void 0
|
|
2097
|
+
}
|
|
2098
|
+
);
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
),
|
|
2102
|
+
errors && /* @__PURE__ */ jsx12(FormFeedback3, { children: errors?.message })
|
|
2103
|
+
] })
|
|
2104
|
+
]
|
|
2105
|
+
}
|
|
2106
|
+
) });
|
|
2249
2107
|
};
|
|
2250
|
-
var
|
|
2108
|
+
var select_table_default = SelectTableBox;
|
|
2251
2109
|
|
|
2252
|
-
// src/component/
|
|
2253
|
-
import
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
DropdownMenu as DropdownMenu3,
|
|
2257
|
-
DropdownToggle as DropdownToggle3,
|
|
2258
|
-
Dropdown as Dropdown3,
|
|
2259
|
-
Button as Button5,
|
|
2260
|
-
Input as Input7,
|
|
2261
|
-
UncontrolledTooltip as UncontrolledTooltip4
|
|
2262
|
-
} from "reactstrap";
|
|
2263
|
-
import { useTranslation as useTranslation11 } from "react-i18next";
|
|
2264
|
-
import classnames8 from "classnames";
|
|
2265
|
-
import { ChevronRight as ChevronRight3, Plus as Plus3 } from "becoxy-icons";
|
|
2266
|
-
import { Fragment as Fragment19, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2267
|
-
var defaultMaxHeight2 = 250;
|
|
2268
|
-
var SelectTableTree = forwardRef3((props, ref) => {
|
|
2110
|
+
// src/component/edit-form/index.tsx
|
|
2111
|
+
import { Fragment as Fragment17, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2112
|
+
var defaultWidth = 200;
|
|
2113
|
+
var EditForm = forwardRef3((props, ref) => {
|
|
2269
2114
|
const {
|
|
2270
2115
|
id,
|
|
2116
|
+
field,
|
|
2117
|
+
displayValue,
|
|
2118
|
+
menuHeight,
|
|
2271
2119
|
menuWidth,
|
|
2272
|
-
|
|
2120
|
+
rowData,
|
|
2273
2121
|
invalid,
|
|
2122
|
+
onChange,
|
|
2123
|
+
onChangeField,
|
|
2274
2124
|
onKeyDown,
|
|
2125
|
+
defaultValues,
|
|
2275
2126
|
placeholder,
|
|
2276
2127
|
textAlign,
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
maxHeight,
|
|
2285
|
-
handleAdd,
|
|
2128
|
+
schema,
|
|
2129
|
+
onFormOpen,
|
|
2130
|
+
onFormSubmit,
|
|
2131
|
+
footerTemplate,
|
|
2132
|
+
minWidth,
|
|
2133
|
+
onPaste,
|
|
2134
|
+
openOnFocus,
|
|
2286
2135
|
isClearable,
|
|
2287
|
-
|
|
2288
|
-
formatOptionLabel,
|
|
2289
|
-
isMulti,
|
|
2290
|
-
noHeader,
|
|
2291
|
-
isDisabled,
|
|
2292
|
-
showFooter,
|
|
2293
|
-
selectChilds,
|
|
2294
|
-
footerComponent,
|
|
2295
|
-
formatSetting,
|
|
2296
|
-
onOpenMenu,
|
|
2297
|
-
onPaste
|
|
2136
|
+
labelSize = "label-small"
|
|
2298
2137
|
} = props;
|
|
2299
|
-
const
|
|
2300
|
-
const selectMenuTableRef = useRef3();
|
|
2138
|
+
const { innerWidth } = window;
|
|
2301
2139
|
const inputRef = useRef3();
|
|
2302
|
-
const
|
|
2303
|
-
const
|
|
2304
|
-
const [
|
|
2305
|
-
const
|
|
2306
|
-
const
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
const childrenSelected = node.children ? checkAllSelected(node.children) : true;
|
|
2311
|
-
return isSelected && childrenSelected;
|
|
2312
|
-
});
|
|
2313
|
-
};
|
|
2314
|
-
return checkAllSelected(options2);
|
|
2315
|
-
};
|
|
2316
|
-
const isSelectedAll = useMemo2(() => {
|
|
2317
|
-
return isMulti === true && options.length > 0 && areAllItemsSelected(value, options, fieldValue ?? "value");
|
|
2318
|
-
}, [options, value]);
|
|
2319
|
-
useEffect8(() => {
|
|
2320
|
-
if (dropdownOpen && onOpenMenu) {
|
|
2321
|
-
onOpenMenu();
|
|
2322
|
-
}
|
|
2323
|
-
}, [dropdownOpen]);
|
|
2324
|
-
const defaultColumns = [
|
|
2325
|
-
{
|
|
2326
|
-
headerText: "Name",
|
|
2327
|
-
field: fieldLabel ?? "label",
|
|
2328
|
-
width: menuWidth
|
|
2329
|
-
}
|
|
2330
|
-
];
|
|
2140
|
+
const editFormRef = useRef3();
|
|
2141
|
+
const buttonRef = useRef3();
|
|
2142
|
+
const [dropdownOpen, setDropdownOpen] = useState5(false);
|
|
2143
|
+
const [itemsField, setItemsField] = useState5([]);
|
|
2144
|
+
const { t } = useTranslation9();
|
|
2145
|
+
useOnClickOutside(editFormRef, () => {
|
|
2146
|
+
closeMenu();
|
|
2147
|
+
});
|
|
2331
2148
|
const closeMenu = () => {
|
|
2332
|
-
|
|
2149
|
+
setTimeout(() => {
|
|
2150
|
+
setDropdownOpen(false);
|
|
2151
|
+
}, onChangeField ? 10 : 0);
|
|
2333
2152
|
};
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2153
|
+
const {
|
|
2154
|
+
control,
|
|
2155
|
+
handleSubmit,
|
|
2156
|
+
getValues,
|
|
2157
|
+
reset,
|
|
2158
|
+
setValue,
|
|
2159
|
+
formState: { errors }
|
|
2160
|
+
} = useForm({
|
|
2161
|
+
mode: "onChange",
|
|
2162
|
+
defaultValues,
|
|
2163
|
+
resolver: yupResolver(schema)
|
|
2164
|
+
});
|
|
2165
|
+
useEffect6(() => {
|
|
2166
|
+
if (dropdownOpen) {
|
|
2167
|
+
if (onFormOpen && itemsField.length === 0) {
|
|
2168
|
+
onFormOpen(rowData, itemsField, setItemsField);
|
|
2169
|
+
}
|
|
2170
|
+
if (openOnFocus) {
|
|
2171
|
+
setTimeout(() => {
|
|
2172
|
+
focusElement(`form-element-${field}-0`, true);
|
|
2173
|
+
}, 100);
|
|
2339
2174
|
}
|
|
2340
2175
|
}
|
|
2341
2176
|
}, [dropdownOpen]);
|
|
2342
|
-
|
|
2343
|
-
if (
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
setSearchTerm("");
|
|
2347
|
-
setIsFocus(false);
|
|
2348
|
-
});
|
|
2349
|
-
inputRef.current.addEventListener("focus", function() {
|
|
2350
|
-
if (!isFocus) {
|
|
2351
|
-
setIsFocus(true);
|
|
2352
|
-
}
|
|
2177
|
+
useEffect6(() => {
|
|
2178
|
+
if (dropdownOpen && itemsField.length > 0) {
|
|
2179
|
+
itemsField.forEach((ele) => {
|
|
2180
|
+
setValue(ele.name, rowData[ele.name] ?? "");
|
|
2353
2181
|
});
|
|
2354
2182
|
}
|
|
2355
|
-
}, [
|
|
2356
|
-
|
|
2357
|
-
if (searchTerm && !dropdownOpen) {
|
|
2358
|
-
setDropdownOpen(true);
|
|
2359
|
-
}
|
|
2360
|
-
}, [searchTerm]);
|
|
2361
|
-
const handleOpenClose = () => {
|
|
2362
|
-
setSearchTerm("");
|
|
2183
|
+
}, [dropdownOpen, itemsField]);
|
|
2184
|
+
const handleOnClick = () => {
|
|
2363
2185
|
if (dropdownOpen) {
|
|
2364
2186
|
closeMenu();
|
|
2365
2187
|
} else {
|
|
2366
|
-
|
|
2367
|
-
|
|
2188
|
+
setDropdownOpen(true);
|
|
2189
|
+
}
|
|
2190
|
+
};
|
|
2191
|
+
const handleOnSubmit = (val) => {
|
|
2192
|
+
closeMenu();
|
|
2193
|
+
onChange(val);
|
|
2194
|
+
if (onFormSubmit) {
|
|
2195
|
+
onFormSubmit(rowData, setValue, getValues, reset);
|
|
2196
|
+
}
|
|
2197
|
+
inputRef.current.focus();
|
|
2198
|
+
};
|
|
2199
|
+
const focusElement = (id2, focus) => {
|
|
2200
|
+
const element = document.getElementById(id2);
|
|
2201
|
+
if (element) {
|
|
2202
|
+
if (element.className.includes("react-select")) {
|
|
2203
|
+
element.getElementsByTagName("input")[0]?.focus();
|
|
2204
|
+
} else {
|
|
2205
|
+
element.focus();
|
|
2206
|
+
if (focus) {
|
|
2207
|
+
element.setSelectionRange(0, element.innerText.length - 1);
|
|
2208
|
+
}
|
|
2368
2209
|
}
|
|
2369
2210
|
}
|
|
2370
2211
|
};
|
|
2371
|
-
const listKeyUse = ["Escape", "Space", "F9"];
|
|
2372
2212
|
const handleOnKeyDown = (e) => {
|
|
2373
|
-
let key = "";
|
|
2374
|
-
if (onKeyDown && (!dropdownOpen || !listKeyUse.includes(e.code) || e.code === "Escape" && !(isClearable && value && !isDisabled))) {
|
|
2375
|
-
key = onKeyDown(e);
|
|
2376
|
-
}
|
|
2377
2213
|
let flag = false;
|
|
2378
|
-
if (
|
|
2379
|
-
if (e.code === "
|
|
2380
|
-
|
|
2214
|
+
if (dropdownOpen) {
|
|
2215
|
+
if (e.code === "Escape") {
|
|
2216
|
+
closeMenu();
|
|
2217
|
+
flag = true;
|
|
2218
|
+
} else if (e.code === "Enter") {
|
|
2219
|
+
closeMenu();
|
|
2220
|
+
flag = true;
|
|
2221
|
+
} else if (e.code === "ArrowDown") {
|
|
2222
|
+
focusElement(`form-element-${field}-0`);
|
|
2223
|
+
flag = true;
|
|
2224
|
+
}
|
|
2225
|
+
} else {
|
|
2226
|
+
if (e.code === "ArrowDown") {
|
|
2227
|
+
setDropdownOpen(true);
|
|
2228
|
+
focusElement(`form-element-${field}-0`);
|
|
2381
2229
|
flag = true;
|
|
2382
2230
|
} else if (e.code === "Space") {
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
flag = true;
|
|
2386
|
-
}
|
|
2387
|
-
} else if (e.code === "Escape") {
|
|
2388
|
-
if (dropdownOpen && isClearable && value && !isDisabled) {
|
|
2389
|
-
onChange(void 0);
|
|
2390
|
-
handleOpenClose();
|
|
2391
|
-
flag = true;
|
|
2392
|
-
}
|
|
2231
|
+
setDropdownOpen(true);
|
|
2232
|
+
flag = true;
|
|
2393
2233
|
}
|
|
2394
2234
|
}
|
|
2395
|
-
if (flag) {
|
|
2235
|
+
if (onKeyDown && !flag) {
|
|
2236
|
+
const key = onKeyDown(e);
|
|
2237
|
+
if (key === "ArrowRight" || key === "ArrowLeft") {
|
|
2238
|
+
closeMenu();
|
|
2239
|
+
}
|
|
2240
|
+
} else {
|
|
2396
2241
|
e.stopPropagation();
|
|
2397
2242
|
e.preventDefault();
|
|
2398
2243
|
}
|
|
2399
2244
|
};
|
|
2400
|
-
const
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
}
|
|
2411
|
-
children: /* @__PURE__ */ jsx15(
|
|
2412
|
-
"div",
|
|
2413
|
-
{
|
|
2414
|
-
role: "textbox",
|
|
2415
|
-
title: t(col.headerText ?? ""),
|
|
2416
|
-
style: {
|
|
2417
|
-
height: `${1 * 35}px`,
|
|
2418
|
-
justifyContent: col.textAlign ?? "left"
|
|
2419
|
-
},
|
|
2420
|
-
className: "r-select-headercell-div",
|
|
2421
|
-
children: t(col.headerText ?? "")
|
|
2422
|
-
}
|
|
2423
|
-
)
|
|
2245
|
+
const formKeyDown = (e, handSubmit) => {
|
|
2246
|
+
if (e.code === "Enter") {
|
|
2247
|
+
handSubmit();
|
|
2248
|
+
e.preventDefault();
|
|
2249
|
+
e.stopPropagation();
|
|
2250
|
+
} else {
|
|
2251
|
+
if (onKeyDown) {
|
|
2252
|
+
const key = onKeyDown(e);
|
|
2253
|
+
if (key === "ArrowRight" || key === "ArrowLeft") {
|
|
2254
|
+
closeMenu();
|
|
2255
|
+
}
|
|
2424
2256
|
}
|
|
2425
|
-
|
|
2257
|
+
}
|
|
2426
2258
|
};
|
|
2427
|
-
const
|
|
2428
|
-
if (
|
|
2429
|
-
|
|
2259
|
+
const formItemKeyDown = (e, index) => {
|
|
2260
|
+
if (e.code === "ArrowDown" && index < itemsField.length - 1) {
|
|
2261
|
+
focusElement(`form-element-${field}-${index + 1}`);
|
|
2262
|
+
e.preventDefault();
|
|
2263
|
+
e.stopPropagation();
|
|
2264
|
+
} else if (e.code === "ArrowUp" && index > 0) {
|
|
2265
|
+
focusElement(`form-element-${field}-${index - 1}`);
|
|
2266
|
+
e.preventDefault();
|
|
2267
|
+
e.stopPropagation();
|
|
2268
|
+
} else if (e.code === "Tab" && onChangeField && index === itemsField.length - 1) {
|
|
2269
|
+
closeMenu();
|
|
2430
2270
|
}
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2271
|
+
};
|
|
2272
|
+
const elementChange = (field2) => {
|
|
2273
|
+
if (onChangeField) {
|
|
2274
|
+
onChangeField(rowData, field2, setValue, getValues);
|
|
2275
|
+
const rs = getValues();
|
|
2276
|
+
if (rs) {
|
|
2277
|
+
onChange(rs);
|
|
2435
2278
|
}
|
|
2436
2279
|
}
|
|
2437
|
-
if (data[fieldChildren ?? "children"]) {
|
|
2438
|
-
return data[fieldChildren ?? "children"].some((child) => checkSearch(keyword, child, columnsSearch));
|
|
2439
|
-
}
|
|
2440
|
-
return false;
|
|
2441
|
-
};
|
|
2442
|
-
const checkOverflow = (indexRow, indexCol) => {
|
|
2443
|
-
const element = document.getElementById(`select-${id}-${indexRow}-${indexCol}`);
|
|
2444
|
-
return element && element.scrollWidth > element.clientWidth;
|
|
2445
2280
|
};
|
|
2446
|
-
const
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2281
|
+
const renderForm = (rows) => {
|
|
2282
|
+
return /* @__PURE__ */ jsx13(Row, { className: "gy-25", children: rows.map((item, index) => {
|
|
2283
|
+
if (item.type === "numeric") {
|
|
2284
|
+
return /* @__PURE__ */ jsx13(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx13(
|
|
2285
|
+
input_number_default,
|
|
2286
|
+
{
|
|
2287
|
+
id: `form-element-${field}-${index}`,
|
|
2288
|
+
control,
|
|
2289
|
+
name: item.name,
|
|
2290
|
+
label: item.label ? item.label : "",
|
|
2291
|
+
labelSize: `text-left ${labelSize}`,
|
|
2292
|
+
errors: errors[item.name],
|
|
2293
|
+
disabled: item.disabled,
|
|
2294
|
+
min: item.min,
|
|
2295
|
+
max: item.max,
|
|
2296
|
+
fractionCurrency: item.fraction,
|
|
2297
|
+
callback: () => {
|
|
2298
|
+
elementChange(item.name);
|
|
2299
|
+
}
|
|
2300
|
+
},
|
|
2301
|
+
index
|
|
2302
|
+
) }, index);
|
|
2303
|
+
} else if (item.type === "text") {
|
|
2304
|
+
return /* @__PURE__ */ jsx13(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx13(
|
|
2305
|
+
input_text_default,
|
|
2306
|
+
{
|
|
2307
|
+
id: `form-element-${field}-${index}`,
|
|
2308
|
+
control,
|
|
2309
|
+
name: item.name,
|
|
2310
|
+
label: item.label ? item.label : "",
|
|
2311
|
+
labelSize: `text-left ${labelSize}`,
|
|
2312
|
+
errors: errors[item.name],
|
|
2313
|
+
disabled: item.disabled,
|
|
2314
|
+
callback: () => {
|
|
2315
|
+
elementChange(item.name);
|
|
2316
|
+
}
|
|
2317
|
+
},
|
|
2318
|
+
index
|
|
2319
|
+
) }, index);
|
|
2320
|
+
} else if (item.type === "select") {
|
|
2321
|
+
return /* @__PURE__ */ jsx13(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx13(
|
|
2322
|
+
select_table_default,
|
|
2323
|
+
{
|
|
2324
|
+
id: `form-element-${field}-${index}`,
|
|
2325
|
+
defaultOptions: item.options ?? [],
|
|
2326
|
+
control,
|
|
2327
|
+
name: item.name,
|
|
2328
|
+
label: item.label ? item.label : "",
|
|
2329
|
+
labelSize: `text-left ${labelSize}`,
|
|
2330
|
+
errors: errors[item.name],
|
|
2331
|
+
disabled: item.disabled,
|
|
2332
|
+
callback: () => {
|
|
2333
|
+
elementChange(item.name);
|
|
2334
|
+
}
|
|
2335
|
+
},
|
|
2336
|
+
index
|
|
2337
|
+
) }, index);
|
|
2338
|
+
}
|
|
2339
|
+
}) });
|
|
2460
2340
|
};
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2341
|
+
return /* @__PURE__ */ jsx13(
|
|
2342
|
+
"div",
|
|
2343
|
+
{
|
|
2344
|
+
className: "form-edit",
|
|
2345
|
+
ref,
|
|
2346
|
+
id,
|
|
2347
|
+
children: /* @__PURE__ */ jsx13("div", { ref: editFormRef, children: /* @__PURE__ */ jsxs12(
|
|
2348
|
+
Dropdown3,
|
|
2467
2349
|
{
|
|
2468
|
-
|
|
2469
|
-
|
|
2350
|
+
isOpen: dropdownOpen,
|
|
2351
|
+
toggle: () => {
|
|
2352
|
+
},
|
|
2470
2353
|
children: [
|
|
2471
|
-
|
|
2472
|
-
|
|
2354
|
+
/* @__PURE__ */ jsx13(DropdownToggle3, { tag: "div", children: /* @__PURE__ */ jsx13(
|
|
2355
|
+
Input6,
|
|
2356
|
+
{
|
|
2357
|
+
style: { backgroundColor: "#FFF", textAlign: textAlign ?? "left" },
|
|
2358
|
+
placeholder,
|
|
2359
|
+
innerRef: inputRef,
|
|
2360
|
+
className: classNames3("input-display input-numeric", { "is-invalid": invalid }),
|
|
2361
|
+
value: displayValue,
|
|
2362
|
+
onClick: handleOnClick,
|
|
2363
|
+
onKeyDown: (e) => handleOnKeyDown(e),
|
|
2364
|
+
onPaste: (e) => onPaste && onPaste(e),
|
|
2365
|
+
readOnly: true
|
|
2366
|
+
}
|
|
2367
|
+
) }),
|
|
2368
|
+
/* @__PURE__ */ jsx13(
|
|
2369
|
+
DropdownMenu3,
|
|
2473
2370
|
{
|
|
2474
|
-
className:
|
|
2371
|
+
className: "formula-dropdown icon-dropdown p-0",
|
|
2475
2372
|
style: {
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
|
|
2482
|
-
if (index > -1) {
|
|
2483
|
-
if (!selectChilds) {
|
|
2484
|
-
value?.splice(index, 1);
|
|
2485
|
-
} else {
|
|
2486
|
-
value?.splice(index, 1);
|
|
2487
|
-
getSelectAll(row[fieldChildren ?? "children"]).forEach((x) => {
|
|
2488
|
-
const index2 = value?.findIndex((y) => y === x);
|
|
2489
|
-
if (index2 > -1) {
|
|
2490
|
-
value?.splice(index2, 1);
|
|
2491
|
-
}
|
|
2492
|
-
});
|
|
2493
|
-
}
|
|
2494
|
-
onChange([...value]);
|
|
2495
|
-
} else {
|
|
2496
|
-
if (value) {
|
|
2497
|
-
if (!selectChilds) {
|
|
2498
|
-
onChange([...value, row[fieldValue ?? "value"]]);
|
|
2499
|
-
} else {
|
|
2500
|
-
onChange([...value, row[fieldValue ?? "value"], ...getSelectAll(row[fieldChildren ?? "children"], true)]);
|
|
2501
|
-
}
|
|
2502
|
-
} else {
|
|
2503
|
-
onChange([row[fieldValue ?? "value"]]);
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
e.stopPropagation();
|
|
2507
|
-
}
|
|
2373
|
+
minWidth: minWidth ? minWidth : defaultWidth,
|
|
2374
|
+
width: menuWidth ? menuWidth : "min-content",
|
|
2375
|
+
maxWidth: innerWidth > 1280 ? 1280 : innerWidth,
|
|
2376
|
+
borderRadius: 8,
|
|
2377
|
+
zIndex: 1056
|
|
2508
2378
|
},
|
|
2509
|
-
children: [
|
|
2510
|
-
|
|
2511
|
-
|
|
2379
|
+
children: /* @__PURE__ */ jsxs12(DropdownItem3, { className: "p-0", style: { borderRadius: "6px" }, tag: "div", header: true, children: [
|
|
2380
|
+
/* @__PURE__ */ jsx13(
|
|
2381
|
+
"div",
|
|
2512
2382
|
{
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
row.expanded = true;
|
|
2519
|
-
setExpanded(true);
|
|
2520
|
-
}
|
|
2521
|
-
e.stopPropagation();
|
|
2383
|
+
onKeyDown: (e) => formKeyDown(e, handleSubmit(handleOnSubmit)),
|
|
2384
|
+
className: "p-1",
|
|
2385
|
+
style: {
|
|
2386
|
+
maxHeight: menuHeight ? menuHeight : 300,
|
|
2387
|
+
overflow: "auto"
|
|
2522
2388
|
},
|
|
2523
|
-
|
|
2524
|
-
className: classnames8("me-50 pb-0 r-icon-expand", { "is-open": expanded })
|
|
2389
|
+
children: itemsField ? renderForm(itemsField) : ""
|
|
2525
2390
|
}
|
|
2526
2391
|
),
|
|
2527
|
-
/* @__PURE__ */
|
|
2528
|
-
|
|
2529
|
-
{
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
2543
|
-
valueDisplay = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ".", formatSetting?.thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
2544
|
-
} else if (col.type === "date") {
|
|
2545
|
-
valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat) : "";
|
|
2546
|
-
} else if (col.type === "datetime") {
|
|
2547
|
-
valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat ?? "DD/MM/yyyy HH:mm") : "";
|
|
2548
|
-
}
|
|
2549
|
-
return /* @__PURE__ */ jsxs14(Fragment18, { children: [
|
|
2550
|
-
col.visible !== false && /* @__PURE__ */ jsxs14(
|
|
2551
|
-
"td",
|
|
2552
|
-
{
|
|
2553
|
-
id: `select-${id}-${indexRow}-${indexCol}`,
|
|
2554
|
-
className: classnames8(`r-select-rowcell`, { "r-select-active": !isMulti && value && isSelected }),
|
|
2555
|
-
style: {
|
|
2556
|
-
paddingLeft: 9 + (indexCol === 0 && !isMulti ? level * 10 + (row[fieldChildren ?? "children"]?.length > 0 || level === 0 ? 0 : 15) : 0),
|
|
2557
|
-
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2558
|
-
},
|
|
2559
|
-
onClick: (e) => {
|
|
2560
|
-
if (isMulti) {
|
|
2561
|
-
const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
|
|
2562
|
-
if (index > -1) {
|
|
2563
|
-
if (!selectChilds) {
|
|
2564
|
-
value?.splice(index, 1);
|
|
2565
|
-
} else {
|
|
2566
|
-
value?.splice(index, 1);
|
|
2567
|
-
getSelectAll(row[fieldChildren ?? "children"]).forEach((x) => {
|
|
2568
|
-
const index2 = value?.findIndex((y) => y === x);
|
|
2569
|
-
if (index2 > -1) {
|
|
2570
|
-
value?.splice(index2, 1);
|
|
2392
|
+
/* @__PURE__ */ jsxs12("div", { className: "d-flex justify-content-between p-50", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: [
|
|
2393
|
+
/* @__PURE__ */ jsx13("div", { className: "text-primary py-25", style: { fontSize: 12 }, children: footerTemplate ? footerTemplate(rowData) : "" }),
|
|
2394
|
+
!onChangeField ? /* @__PURE__ */ jsxs12("div", { className: "d-flex justify-content-end", children: [
|
|
2395
|
+
isClearable && /* @__PURE__ */ jsx13(
|
|
2396
|
+
Button4,
|
|
2397
|
+
{
|
|
2398
|
+
ref: buttonRef,
|
|
2399
|
+
className: "btn me-50 py-25 px-50",
|
|
2400
|
+
outline: true,
|
|
2401
|
+
onClick: () => {
|
|
2402
|
+
itemsField.forEach((e) => {
|
|
2403
|
+
if (e.type === "numeric") {
|
|
2404
|
+
setValue(e.name, 0);
|
|
2405
|
+
} else {
|
|
2406
|
+
setValue(e.name, "");
|
|
2571
2407
|
}
|
|
2572
2408
|
});
|
|
2573
|
-
}
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
if (!selectChilds) {
|
|
2578
|
-
onChange([...value, row[fieldValue ?? "value"]]);
|
|
2579
|
-
} else {
|
|
2580
|
-
onChange([...value, row[fieldValue ?? "value"], ...getSelectAll(row[fieldChildren ?? "children"], true)]);
|
|
2409
|
+
},
|
|
2410
|
+
onKeyDown: (e) => {
|
|
2411
|
+
if (e.code === "Tab") {
|
|
2412
|
+
closeMenu();
|
|
2581
2413
|
}
|
|
2582
|
-
}
|
|
2583
|
-
|
|
2584
|
-
}
|
|
2414
|
+
},
|
|
2415
|
+
children: t("Clear")
|
|
2585
2416
|
}
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
setSearchTerm("");
|
|
2590
|
-
closeMenu();
|
|
2591
|
-
}
|
|
2592
|
-
e.preventDefault();
|
|
2593
|
-
e.stopPropagation();
|
|
2594
|
-
},
|
|
2595
|
-
children: [
|
|
2596
|
-
!isMulti && indexCol === 0 && row[fieldChildren ?? "children"]?.length > 0 && /* @__PURE__ */ jsx15(
|
|
2597
|
-
ChevronRight3,
|
|
2417
|
+
),
|
|
2418
|
+
/* @__PURE__ */ jsx13(
|
|
2419
|
+
Button4,
|
|
2598
2420
|
{
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2421
|
+
ref: buttonRef,
|
|
2422
|
+
color: "primary",
|
|
2423
|
+
className: "btn btn-primary py-25 px-50",
|
|
2424
|
+
onClick: handleSubmit(handleOnSubmit),
|
|
2425
|
+
onKeyDown: (e) => {
|
|
2426
|
+
if (e.code === "Tab") {
|
|
2427
|
+
closeMenu();
|
|
2606
2428
|
}
|
|
2607
|
-
e.stopPropagation();
|
|
2608
2429
|
},
|
|
2609
|
-
|
|
2610
|
-
className: classnames8("me-50 r-icon-expand", { "is-open": expanded })
|
|
2430
|
+
children: t("Save")
|
|
2611
2431
|
}
|
|
2612
|
-
)
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
},
|
|
2619
|
-
`col-${indexRow}-${indexCol}`
|
|
2620
|
-
),
|
|
2621
|
-
checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx15(UncontrolledTooltip4, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : col.type === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ jsxs14("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
|
|
2622
|
-
" ",
|
|
2623
|
-
`${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
|
|
2624
|
-
] }) : valueDisplay })
|
|
2625
|
-
] }, indexCol);
|
|
2626
|
-
})
|
|
2432
|
+
)
|
|
2433
|
+
] }) : /* @__PURE__ */ jsx13(Fragment17, {})
|
|
2434
|
+
] })
|
|
2435
|
+
] })
|
|
2436
|
+
}
|
|
2437
|
+
)
|
|
2627
2438
|
]
|
|
2628
|
-
},
|
|
2629
|
-
`row-${indexRow}`
|
|
2630
|
-
),
|
|
2631
|
-
row[fieldChildren ?? "children"] && row.expanded && row[fieldChildren ?? "children"].map((child, indexChild) => {
|
|
2632
|
-
if (checkSearch(searchTerm, child, columns ? columns : defaultColumns)) {
|
|
2633
|
-
const isSelectedChild = value && (isMulti ? value?.some((x) => x === child[fieldValue ?? "value"]) : value[fieldValue ?? "value"] === child[fieldValue ?? "value"]);
|
|
2634
|
-
return /* @__PURE__ */ jsx15(RenderElement, { isSelected: isSelectedChild, indexRow: indexChild, row: child, level: level + 1 }, `select-table-${indexRow}-${indexChild}`);
|
|
2635
2439
|
}
|
|
2636
|
-
})
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2440
|
+
) })
|
|
2441
|
+
}
|
|
2442
|
+
);
|
|
2443
|
+
});
|
|
2444
|
+
var edit_form_default = EditForm;
|
|
2445
|
+
|
|
2446
|
+
// src/component/sidebar-setting-column/index.tsx
|
|
2447
|
+
import { Fragment as Fragment19, useEffect as useEffect8, useState as useState7 } from "react";
|
|
2448
|
+
import { Button as Button5, Input as Input7 } from "reactstrap";
|
|
2449
|
+
import { useTranslation as useTranslation11 } from "react-i18next";
|
|
2450
|
+
|
|
2451
|
+
// src/component/modal-header/index.tsx
|
|
2452
|
+
import { Edit, Info, Plus as Plus3, X as X2 } from "becoxy-icons";
|
|
2453
|
+
import classNames4 from "classnames";
|
|
2454
|
+
import { useTranslation as useTranslation10 } from "react-i18next";
|
|
2455
|
+
import { Fragment as Fragment18, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2456
|
+
var ModalHeader = (props) => {
|
|
2457
|
+
const { title, handleModal, typeModal = "Edit", component } = props;
|
|
2458
|
+
const { t } = useTranslation10();
|
|
2459
|
+
const handleModalIcon = () => {
|
|
2460
|
+
if (typeModal === "Edit" || typeModal === "Approval") {
|
|
2461
|
+
return /* @__PURE__ */ jsx14(Edit, { fontSize: 17, className: "me-1" });
|
|
2462
|
+
} else if (typeModal === "View") {
|
|
2463
|
+
return /* @__PURE__ */ jsx14(Info, { fontSize: 17, className: "me-1" });
|
|
2464
|
+
} else if (typeModal === "Detail") {
|
|
2465
|
+
return /* @__PURE__ */ jsx14(Info, { fontSize: 17, className: "me-1" });
|
|
2466
|
+
} else if (typeModal === "Order") {
|
|
2467
|
+
return /* @__PURE__ */ jsx14("span", { className: "e-icons e-sorting-1 me-1", style: { fontSize: "14px" } });
|
|
2468
|
+
} else if (typeModal === "Process") {
|
|
2469
|
+
return /* @__PURE__ */ jsx14("span", { className: "e-flat e-icons e-paste-match-destination me-1", style: { fontSize: "14px" } });
|
|
2470
|
+
} else {
|
|
2471
|
+
return /* @__PURE__ */ jsx14(Plus3, { fontSize: 17, className: "me-1" });
|
|
2472
|
+
}
|
|
2473
|
+
};
|
|
2474
|
+
return /* @__PURE__ */ jsxs13("div", { className: "modal-header d-flex align-items-center justify-content-between mb-1", children: [
|
|
2475
|
+
/* @__PURE__ */ jsxs13("div", { className: "d-flex align-items-center justify-content-start", children: [
|
|
2476
|
+
/* @__PURE__ */ jsxs13("h5", { className: "modal-title", children: [
|
|
2477
|
+
handleModalIcon(),
|
|
2478
|
+
" ",
|
|
2479
|
+
t(title)
|
|
2480
|
+
] }),
|
|
2481
|
+
component ? component() : /* @__PURE__ */ jsx14(Fragment18, {})
|
|
2482
|
+
] }),
|
|
2483
|
+
/* @__PURE__ */ jsx14("div", { className: "todo-item-action d-flex align-items-center", children: /* @__PURE__ */ jsx14(
|
|
2484
|
+
X2,
|
|
2485
|
+
{
|
|
2486
|
+
className: classNames4("fw-normal mt-25 cursor-pointer", { "d-none": !handleModal }),
|
|
2487
|
+
fontSize: 20,
|
|
2488
|
+
onClick: handleModal
|
|
2489
|
+
}
|
|
2490
|
+
) })
|
|
2491
|
+
] });
|
|
2492
|
+
};
|
|
2493
|
+
var modal_header_default = ModalHeader;
|
|
2494
|
+
|
|
2495
|
+
// src/component/sidebar/index.tsx
|
|
2496
|
+
import { ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight3 } from "becoxy-icons";
|
|
2497
|
+
import classNames5 from "classnames";
|
|
2498
|
+
import { useEffect as useEffect7, useState as useState6 } from "react";
|
|
2499
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2500
|
+
var Sidebar = (props) => {
|
|
2501
|
+
const {
|
|
2502
|
+
open,
|
|
2503
|
+
children,
|
|
2504
|
+
toggleSidebar,
|
|
2505
|
+
width,
|
|
2506
|
+
keyboard,
|
|
2507
|
+
hiddenBackground,
|
|
2508
|
+
hiddenFullScreenButton
|
|
2509
|
+
} = props;
|
|
2510
|
+
const [isFullScreen, setIsFullScreen] = useState6(false);
|
|
2511
|
+
const [flag, setFlag] = useState6(open);
|
|
2512
|
+
useEffect7(() => {
|
|
2513
|
+
if (open !== flag) {
|
|
2514
|
+
if (open) {
|
|
2515
|
+
setFlag(open);
|
|
2516
|
+
} else {
|
|
2517
|
+
setTimeout(() => {
|
|
2518
|
+
setFlag(open);
|
|
2519
|
+
}, 50);
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
}, [open]);
|
|
2523
|
+
const handClose = () => {
|
|
2524
|
+
setFlag(false);
|
|
2525
|
+
setTimeout(() => {
|
|
2526
|
+
toggleSidebar();
|
|
2527
|
+
}, 400);
|
|
2528
|
+
};
|
|
2529
|
+
return /* @__PURE__ */ jsxs14(
|
|
2530
|
+
"div",
|
|
2531
|
+
{
|
|
2532
|
+
tabIndex: 0,
|
|
2533
|
+
className: classNames5({ "d-none": !open }),
|
|
2534
|
+
onKeyDown: (e) => {
|
|
2535
|
+
if (!keyboard && e.code === "Escape" && flag) {
|
|
2536
|
+
handClose();
|
|
2537
|
+
e.stopPropagation();
|
|
2538
|
+
e.preventDefault();
|
|
2539
|
+
}
|
|
2540
|
+
},
|
|
2541
|
+
children: [
|
|
2542
|
+
/* @__PURE__ */ jsx15(
|
|
2543
|
+
"div",
|
|
2544
|
+
{
|
|
2545
|
+
className: classNames5("offcanvas-backdrop fade", {
|
|
2546
|
+
"d-none": !flag || hiddenBackground,
|
|
2547
|
+
show: flag
|
|
2548
|
+
}),
|
|
2549
|
+
style: { zIndex: 1056 },
|
|
2550
|
+
onClick: handClose
|
|
2551
|
+
}
|
|
2552
|
+
),
|
|
2553
|
+
/* @__PURE__ */ jsxs14(
|
|
2554
|
+
"div",
|
|
2555
|
+
{
|
|
2556
|
+
className: classNames5("r-sidebar", `customizer-${width ?? 600}`, {
|
|
2557
|
+
open: flag,
|
|
2558
|
+
fullscreen: isFullScreen
|
|
2559
|
+
}),
|
|
2560
|
+
style: { zIndex: 1057 },
|
|
2561
|
+
children: [
|
|
2562
|
+
/* @__PURE__ */ jsxs14(
|
|
2651
2563
|
"div",
|
|
2652
2564
|
{
|
|
2653
|
-
style: {
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
}
|
|
2674
|
-
|
|
2565
|
+
style: {
|
|
2566
|
+
position: "fixed",
|
|
2567
|
+
top: "50%",
|
|
2568
|
+
transform: "translate(-50%, -50%)",
|
|
2569
|
+
background: "#FFF",
|
|
2570
|
+
filter: "drop-shadow(0.9px 0.9px 1.5px)",
|
|
2571
|
+
height: 50,
|
|
2572
|
+
display: "flex",
|
|
2573
|
+
alignItems: "center",
|
|
2574
|
+
borderRadius: "0px 5px 5px 0px",
|
|
2575
|
+
cursor: "pointer",
|
|
2576
|
+
zIndex: 9,
|
|
2577
|
+
marginLeft: 7
|
|
2578
|
+
},
|
|
2579
|
+
className: classNames5({ "d-none": hiddenFullScreenButton }),
|
|
2580
|
+
onClick: () => {
|
|
2581
|
+
setIsFullScreen(!isFullScreen);
|
|
2582
|
+
},
|
|
2583
|
+
children: [
|
|
2584
|
+
/* @__PURE__ */ jsx15(ChevronLeft2, { className: `${isFullScreen ? "d-none" : ""}`, fontSize: 16 }),
|
|
2585
|
+
/* @__PURE__ */ jsx15(ChevronRight3, { className: `${!isFullScreen ? "d-none" : ""}`, fontSize: 15 })
|
|
2586
|
+
]
|
|
2675
2587
|
}
|
|
2676
|
-
)
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2588
|
+
),
|
|
2589
|
+
children
|
|
2590
|
+
]
|
|
2591
|
+
}
|
|
2592
|
+
)
|
|
2593
|
+
]
|
|
2594
|
+
}
|
|
2595
|
+
);
|
|
2596
|
+
};
|
|
2597
|
+
var sidebar_default = Sidebar;
|
|
2598
|
+
|
|
2599
|
+
// src/component/sidebar-setting-column/index.tsx
|
|
2600
|
+
import classnames8 from "classnames";
|
|
2601
|
+
import { Fragment as Fragment20, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2602
|
+
var SidebarSetColumn = (props) => {
|
|
2603
|
+
const { column, setColumn, openSidebar, handleSidebar } = props;
|
|
2604
|
+
const { t } = useTranslation11();
|
|
2605
|
+
const [dataSource, setDataSource] = useState7([]);
|
|
2606
|
+
const [indexFocus, setIndexFocus] = useState7();
|
|
2607
|
+
useEffect8(() => {
|
|
2608
|
+
if (openSidebar) {
|
|
2609
|
+
setDataSource(column.map((e) => ({ ...e })));
|
|
2610
|
+
}
|
|
2611
|
+
}, [openSidebar]);
|
|
2612
|
+
const handleCancel = () => {
|
|
2613
|
+
handleSidebar();
|
|
2614
|
+
setDataSource([]);
|
|
2615
|
+
};
|
|
2616
|
+
const handleSubmit = () => {
|
|
2617
|
+
setColumn([...dataSource]);
|
|
2618
|
+
handleCancel();
|
|
2619
|
+
};
|
|
2620
|
+
const getWindowSize = () => {
|
|
2621
|
+
const { innerWidth, innerHeight } = window;
|
|
2622
|
+
return { innerWidth, innerHeight };
|
|
2623
|
+
};
|
|
2624
|
+
const [windowSize, setWindowSize] = useState7(getWindowSize());
|
|
2625
|
+
useEffect8(() => {
|
|
2626
|
+
const handleWindowResize = () => {
|
|
2627
|
+
setWindowSize(getWindowSize());
|
|
2628
|
+
};
|
|
2629
|
+
window.addEventListener("resize", handleWindowResize);
|
|
2630
|
+
return () => {
|
|
2631
|
+
window.removeEventListener("resize", handleWindowResize);
|
|
2632
|
+
};
|
|
2633
|
+
}, []);
|
|
2634
|
+
const renderFooterButtons = () => {
|
|
2635
|
+
return /* @__PURE__ */ jsxs15(Fragment19, { children: [
|
|
2636
|
+
/* @__PURE__ */ jsx16(Button5, { color: "primary", onClick: handleSubmit, className: "me-1", children: t("Confirm") }),
|
|
2637
|
+
/* @__PURE__ */ jsx16(Button5, { color: "secondary", onClick: handleCancel, outline: true, children: t("Close") })
|
|
2638
|
+
] });
|
|
2639
|
+
};
|
|
2640
|
+
const visibleTemplate = (item, index) => {
|
|
2641
|
+
return /* @__PURE__ */ jsx16(
|
|
2642
|
+
Input7,
|
|
2643
|
+
{
|
|
2644
|
+
defaultChecked: item.visible ?? true,
|
|
2645
|
+
disabled: item.invisibleDisable,
|
|
2646
|
+
type: "checkbox",
|
|
2647
|
+
style: { height: 18 },
|
|
2648
|
+
className: " cursor-pointer",
|
|
2649
|
+
onChange: (e) => {
|
|
2650
|
+
if (dataSource) {
|
|
2651
|
+
dataSource[index].visible = e.target.checked;
|
|
2652
|
+
setDataSource(dataSource);
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
);
|
|
2657
|
+
};
|
|
2658
|
+
const fixColumnTemplate = (item, index) => {
|
|
2659
|
+
return /* @__PURE__ */ jsx16(
|
|
2660
|
+
Input7,
|
|
2661
|
+
{
|
|
2662
|
+
defaultChecked: item.fixedType === "left" || item.fixedType === "right",
|
|
2663
|
+
type: "checkbox",
|
|
2664
|
+
style: { height: 18 },
|
|
2665
|
+
className: " cursor-pointer",
|
|
2666
|
+
onChange: (e) => {
|
|
2667
|
+
if (dataSource) {
|
|
2668
|
+
if (e.target.checked) {
|
|
2669
|
+
if (index * 2 <= dataSource.length) {
|
|
2670
|
+
dataSource[index].fixedType = "left";
|
|
2671
|
+
} else {
|
|
2672
|
+
dataSource[index].fixedType = "right";
|
|
2673
|
+
}
|
|
2674
|
+
} else {
|
|
2675
|
+
dataSource[index].fixedType = void 0;
|
|
2676
|
+
}
|
|
2677
|
+
setDataSource(dataSource);
|
|
2688
2678
|
}
|
|
2689
|
-
}) }) })
|
|
2690
|
-
] }),
|
|
2691
|
-
countDisplay === 0 && /* @__PURE__ */ jsxs14("div", { className: "r-no-data", children: [
|
|
2692
|
-
/* @__PURE__ */ jsx15("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxs14("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [
|
|
2693
|
-
/* @__PURE__ */ jsx15("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }),
|
|
2694
|
-
/* @__PURE__ */ jsxs14("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [
|
|
2695
|
-
/* @__PURE__ */ jsx15("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }),
|
|
2696
|
-
/* @__PURE__ */ jsx15("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", fill: "#fafafa" })
|
|
2697
|
-
] })
|
|
2698
|
-
] }) }),
|
|
2699
|
-
t("No data available.")
|
|
2700
|
-
] })
|
|
2701
|
-
] });
|
|
2702
|
-
};
|
|
2703
|
-
const getSelectedRecords = (tree, value2) => {
|
|
2704
|
-
const records = [];
|
|
2705
|
-
const traverse = (nodes) => {
|
|
2706
|
-
nodes.forEach((node) => {
|
|
2707
|
-
if (value2.includes(node[fieldValue ?? "value"])) {
|
|
2708
|
-
records.push(node);
|
|
2709
|
-
}
|
|
2710
|
-
if (node.children && node.children.length > 0) {
|
|
2711
|
-
traverse(node.children);
|
|
2712
2679
|
}
|
|
2713
|
-
}
|
|
2714
|
-
|
|
2715
|
-
traverse(tree);
|
|
2716
|
-
return records;
|
|
2680
|
+
}
|
|
2681
|
+
);
|
|
2717
2682
|
};
|
|
2718
|
-
|
|
2719
|
-
"div",
|
|
2683
|
+
const columns = [
|
|
2720
2684
|
{
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
) })
|
|
2772
|
-
] }),
|
|
2773
|
-
isClearable && value && !isDisabled && /* @__PURE__ */ jsx15(
|
|
2774
|
-
"div",
|
|
2775
|
-
{
|
|
2776
|
-
className: classnames8("cursor-pointer"),
|
|
2777
|
-
onClick: (e) => {
|
|
2778
|
-
onChange(isMulti ? [] : void 0);
|
|
2779
|
-
e.stopPropagation();
|
|
2780
|
-
},
|
|
2781
|
-
children: /* @__PURE__ */ jsx15("svg", { height: "20", width: "20", color: "#c4c4c4", viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", className: "css-tj5bde-Svg", children: /* @__PURE__ */ jsx15("path", { d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z" }) })
|
|
2782
|
-
}
|
|
2783
|
-
),
|
|
2784
|
-
!isDisabled && /* @__PURE__ */ jsx15("div", { className: "select-table-indicator", onMouseDown: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx15("svg", { height: "20", width: "20", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx15("path", { d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z" }) }) })
|
|
2785
|
-
]
|
|
2786
|
-
}
|
|
2685
|
+
field: "headerText",
|
|
2686
|
+
headerText: "Column name",
|
|
2687
|
+
template: (e) => {
|
|
2688
|
+
return /* @__PURE__ */ jsx16(Fragment20, { children: t(e.headerText) });
|
|
2689
|
+
},
|
|
2690
|
+
visible: true,
|
|
2691
|
+
width: 175,
|
|
2692
|
+
maxWidth: 200,
|
|
2693
|
+
minWidth: 150
|
|
2694
|
+
},
|
|
2695
|
+
{
|
|
2696
|
+
field: "",
|
|
2697
|
+
template: visibleTemplate,
|
|
2698
|
+
headerText: "Display",
|
|
2699
|
+
textAlign: "center",
|
|
2700
|
+
visible: true,
|
|
2701
|
+
width: 100,
|
|
2702
|
+
maxWidth: 120,
|
|
2703
|
+
minWidth: 80
|
|
2704
|
+
},
|
|
2705
|
+
{
|
|
2706
|
+
field: "",
|
|
2707
|
+
template: fixColumnTemplate,
|
|
2708
|
+
headerText: "Fix the column",
|
|
2709
|
+
textAlign: "center",
|
|
2710
|
+
visible: true,
|
|
2711
|
+
width: 100,
|
|
2712
|
+
maxWidth: 120,
|
|
2713
|
+
minWidth: 80
|
|
2714
|
+
},
|
|
2715
|
+
{
|
|
2716
|
+
field: "width",
|
|
2717
|
+
headerText: "Column width",
|
|
2718
|
+
textAlign: "right",
|
|
2719
|
+
visible: true,
|
|
2720
|
+
width: 100,
|
|
2721
|
+
maxWidth: 120,
|
|
2722
|
+
minWidth: 80
|
|
2723
|
+
}
|
|
2724
|
+
];
|
|
2725
|
+
const renderHeaderCol = (col, indexCol) => {
|
|
2726
|
+
return /* @__PURE__ */ jsx16(
|
|
2727
|
+
Fragment19,
|
|
2728
|
+
{
|
|
2729
|
+
children: col.visible !== false && /* @__PURE__ */ jsx16(
|
|
2730
|
+
"th",
|
|
2731
|
+
{
|
|
2732
|
+
className: classnames8(
|
|
2733
|
+
`r-headercell fix-${col.fixedType}`,
|
|
2734
|
+
{ "cell-fixed": col.fixedType }
|
|
2787
2735
|
),
|
|
2788
|
-
|
|
2789
|
-
|
|
2736
|
+
style: {
|
|
2737
|
+
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
2738
|
+
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
2739
|
+
top: `${0 * 42}px`,
|
|
2740
|
+
maxWidth: col.maxWidth
|
|
2741
|
+
},
|
|
2742
|
+
children: /* @__PURE__ */ jsx16(
|
|
2743
|
+
"div",
|
|
2790
2744
|
{
|
|
2791
|
-
|
|
2792
|
-
|
|
2745
|
+
role: "textbox",
|
|
2746
|
+
title: t(col.headerText ?? ""),
|
|
2793
2747
|
style: {
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
borderRadius: 4,
|
|
2797
|
-
zIndex: 9999
|
|
2748
|
+
height: `${1 * 42}px`,
|
|
2749
|
+
justifyContent: col.textAlign ?? "left"
|
|
2798
2750
|
},
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
{
|
|
2802
|
-
onMouseDown: (e) => {
|
|
2803
|
-
if (!isDisabled) {
|
|
2804
|
-
inputRef?.current.focus();
|
|
2805
|
-
e.preventDefault();
|
|
2806
|
-
}
|
|
2807
|
-
},
|
|
2808
|
-
children: /* @__PURE__ */ jsxs14("div", { className: "r-select-grid r-select-tree-grid", children: [
|
|
2809
|
-
/* @__PURE__ */ jsx15("div", { className: "r-select-gridtable ", ref: selectMenuTableRef, style: { width: menuWidth, minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight2 }, children: /* @__PURE__ */ jsx15(RenderTable, {}) }),
|
|
2810
|
-
/* @__PURE__ */ jsxs14("div", { className: classnames8("r-select-footer", { "d-none": !(showFooter === true || handleAdd || isMulti) }), children: [
|
|
2811
|
-
/* @__PURE__ */ jsxs14(Button5, { outline: true, color: "primary", onClick: handleAdd, className: classnames8("r-btn d-flex align-items-center", { "d-none": !handleAdd }), children: [
|
|
2812
|
-
/* @__PURE__ */ jsx15(Plus3, { className: "me-50", fontSize: 16 }),
|
|
2813
|
-
t("AddNew"),
|
|
2814
|
-
" (F9)"
|
|
2815
|
-
] }),
|
|
2816
|
-
isMulti && /* @__PURE__ */ jsx15("div", { className: "ms-50 text-primary h-100 d-flex align-items-center", onClick: handleAdd, children: t("countSelected", { item: value?.length ?? 0 }) }),
|
|
2817
|
-
footerComponent ? footerComponent() : null
|
|
2818
|
-
] })
|
|
2819
|
-
] })
|
|
2820
|
-
}
|
|
2821
|
-
) })
|
|
2751
|
+
className: "r-headercell-div",
|
|
2752
|
+
children: t(col.headerText ?? "")
|
|
2822
2753
|
}
|
|
2823
2754
|
)
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2755
|
+
}
|
|
2756
|
+
)
|
|
2757
|
+
},
|
|
2758
|
+
`header-${indexCol}`
|
|
2759
|
+
);
|
|
2760
|
+
};
|
|
2761
|
+
return /* @__PURE__ */ jsxs15(
|
|
2762
|
+
sidebar_default,
|
|
2763
|
+
{
|
|
2764
|
+
open: openSidebar,
|
|
2765
|
+
toggleSidebar: handleCancel,
|
|
2766
|
+
width: 700,
|
|
2767
|
+
children: [
|
|
2768
|
+
/* @__PURE__ */ jsx16(modal_header_default, { typeModal: "Edit", handleModal: handleCancel, title: "Column setup" }),
|
|
2769
|
+
/* @__PURE__ */ jsx16("div", { className: "ms-2 react-table-edit", children: /* @__PURE__ */ jsx16("div", { className: "r-grid", children: /* @__PURE__ */ jsx16("div", { className: "r-gridtable", style: { height: windowSize.innerHeight - 120 }, children: /* @__PURE__ */ jsxs15("table", { style: { width: "100%" }, children: [
|
|
2770
|
+
/* @__PURE__ */ jsx16("thead", { className: "r-gridheader", children: /* @__PURE__ */ jsx16("tr", { className: "r-row", role: "row", children: columns.map((col, index) => {
|
|
2771
|
+
return renderHeaderCol(col, index);
|
|
2772
|
+
}) }) }),
|
|
2773
|
+
/* @__PURE__ */ jsx16("tbody", { className: "r-gridcontent", children: dataSource?.map((row, indexRow) => {
|
|
2774
|
+
return /* @__PURE__ */ jsx16(
|
|
2775
|
+
"tr",
|
|
2776
|
+
{
|
|
2777
|
+
className: classnames8("r-row", { "last-row": indexRow === dataSource.length - 1 }, { "fisrt-row": indexRow === 0 }),
|
|
2778
|
+
children: columns.map((col, indexCol) => {
|
|
2779
|
+
let value = row[col.field];
|
|
2780
|
+
if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
|
|
2781
|
+
value = formartNumberic(row[col.field], ",", ".", col.numericSettings?.fraction, true) ?? 0;
|
|
2782
|
+
}
|
|
2783
|
+
return /* @__PURE__ */ jsx16(Fragment19, { children: col.visible !== false && /* @__PURE__ */ jsx16(
|
|
2784
|
+
"td",
|
|
2785
|
+
{
|
|
2786
|
+
className: classnames8(
|
|
2787
|
+
`r-rowcell fix-${col.fixedType}`,
|
|
2788
|
+
{ "cell-fixed": col.fixedType },
|
|
2789
|
+
{ "r-active": indexFocus === indexRow }
|
|
2790
|
+
),
|
|
2791
|
+
style: {
|
|
2792
|
+
padding: 0,
|
|
2793
|
+
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2794
|
+
},
|
|
2795
|
+
onFocus: (e) => {
|
|
2796
|
+
if (indexRow !== indexFocus) {
|
|
2797
|
+
setIndexFocus(indexRow);
|
|
2798
|
+
}
|
|
2799
|
+
e.stopPropagation();
|
|
2800
|
+
},
|
|
2801
|
+
onClick: (e) => {
|
|
2802
|
+
if (e.target.nodeName === "DIV" || e.target.nodeName === "TD") {
|
|
2803
|
+
if (indexRow !== indexFocus) {
|
|
2804
|
+
setIndexFocus(indexRow);
|
|
2805
|
+
}
|
|
2806
|
+
e.stopPropagation();
|
|
2807
|
+
}
|
|
2808
|
+
},
|
|
2809
|
+
children: /* @__PURE__ */ jsx16(
|
|
2810
|
+
"div",
|
|
2811
|
+
{
|
|
2812
|
+
className: classnames8("r-rowcell-div"),
|
|
2813
|
+
style: {
|
|
2814
|
+
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto"
|
|
2815
|
+
},
|
|
2816
|
+
children: /* @__PURE__ */ jsx16(
|
|
2817
|
+
"div",
|
|
2818
|
+
{
|
|
2819
|
+
className: classnames8("r-rowcell-content"),
|
|
2820
|
+
style: {
|
|
2821
|
+
margin: "7px 9px"
|
|
2822
|
+
},
|
|
2823
|
+
children: /* @__PURE__ */ jsx16("div", { className: "r-cell-text", children: col.template ? col.template(row, indexRow) : value })
|
|
2824
|
+
}
|
|
2825
|
+
)
|
|
2826
|
+
}
|
|
2827
|
+
)
|
|
2828
|
+
},
|
|
2829
|
+
`col-${indexRow}-${indexCol}`
|
|
2830
|
+
) }, indexCol);
|
|
2831
|
+
})
|
|
2832
|
+
},
|
|
2833
|
+
`row-${indexRow}`
|
|
2834
|
+
);
|
|
2835
|
+
}) })
|
|
2836
|
+
] }) }) }) }),
|
|
2837
|
+
/* @__PURE__ */ jsx16(
|
|
2838
|
+
"div",
|
|
2839
|
+
{
|
|
2840
|
+
className: "d-flex justify-content-end p-1 ",
|
|
2841
|
+
style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" },
|
|
2842
|
+
children: renderFooterButtons()
|
|
2843
|
+
}
|
|
2844
|
+
)
|
|
2845
|
+
]
|
|
2827
2846
|
}
|
|
2828
2847
|
);
|
|
2829
|
-
});
|
|
2830
|
-
|
|
2831
|
-
// src/component/table/index.tsx
|
|
2832
|
-
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
2833
|
-
|
|
2834
|
-
// src/component/table/toolbar-top.tsx
|
|
2835
|
-
import { Fragment as Fragment20, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2836
|
-
var renderToolbarTop = (toolbarTopOption) => {
|
|
2837
|
-
return /* @__PURE__ */ jsx16("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: /* @__PURE__ */ jsxs15("div", { className: "r-toolbar-items", children: [
|
|
2838
|
-
/* @__PURE__ */ jsx16("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
|
|
2839
|
-
return item.align === "left" ? /* @__PURE__ */ jsx16(Fragment20, { children: /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) }) : "";
|
|
2840
|
-
}) }),
|
|
2841
|
-
/* @__PURE__ */ jsx16("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
|
|
2842
|
-
return item.align === "center" ? /* @__PURE__ */ jsx16(Fragment20, { children: /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) }) : "";
|
|
2843
|
-
}) }),
|
|
2844
|
-
/* @__PURE__ */ jsx16("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
|
|
2845
|
-
return item.align === "right" ? /* @__PURE__ */ jsx16(Fragment20, { children: /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) }) : "";
|
|
2846
|
-
}) })
|
|
2847
|
-
] }) });
|
|
2848
2848
|
};
|
|
2849
|
-
var
|
|
2849
|
+
var sidebar_setting_column_default = SidebarSetColumn;
|
|
2850
2850
|
|
|
2851
2851
|
// src/component/input-date/index.tsx
|
|
2852
|
-
import { useState as useState8 } from "react";
|
|
2852
|
+
import { forwardRef as forwardRef4, useState as useState8 } from "react";
|
|
2853
2853
|
import DatePicker from "react-datepicker";
|
|
2854
2854
|
import InputMask from "react-input-mask";
|
|
2855
2855
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2856
|
-
var DateInput = (props) => {
|
|
2856
|
+
var DateInput = forwardRef4((props, ref) => {
|
|
2857
2857
|
const { id, onKeyDown, dateFormat, className, onChange, value } = props;
|
|
2858
2858
|
const [open, setOpen] = useState8(false);
|
|
2859
2859
|
return /* @__PURE__ */ jsx17(
|
|
@@ -2896,12 +2896,12 @@ var DateInput = (props) => {
|
|
|
2896
2896
|
}
|
|
2897
2897
|
}
|
|
2898
2898
|
);
|
|
2899
|
-
};
|
|
2899
|
+
});
|
|
2900
2900
|
var input_date_default = DateInput;
|
|
2901
2901
|
|
|
2902
2902
|
// src/component/table/index.tsx
|
|
2903
2903
|
import { Fragment as Fragment22, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2904
|
-
var TableEdit =
|
|
2904
|
+
var TableEdit = forwardRef5((props, ref) => {
|
|
2905
2905
|
const { t } = useTranslation12();
|
|
2906
2906
|
const {
|
|
2907
2907
|
idTable,
|