react-table-edit 0.8.8 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +1585 -1644
  2. package/dist/index.mjs +1559 -1619
  3. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  // test-app/src/component/table/index.tsx
2
2
  import { Fragment as Fragment17, forwardRef as forwardRef3, useEffect as useEffect8, useImperativeHandle, useRef as useRef3, useState as useState7 } from "react";
3
- import { Button as Button5, DropdownMenu as DropdownMenu3, DropdownToggle as DropdownToggle3, Input as Input8, UncontrolledDropdown, UncontrolledTooltip as UncontrolledTooltip3 } from "reactstrap";
4
- import classnames9 from "classnames";
5
- import { useTranslation as useTranslation12 } from "react-i18next";
3
+ import { Button as Button5, DropdownMenu as DropdownMenu3, DropdownToggle as DropdownToggle3, Input as Input8, UncontrolledDropdown, UncontrolledTooltip as UncontrolledTooltip4 } from "reactstrap";
4
+ import classnames8 from "classnames";
5
+ import { useTranslation as useTranslation11 } from "react-i18next";
6
6
  import { AlertCircle, Info as Info2, Settings } from "becoxy-icons";
7
7
 
8
8
  // test-app/src/component/react-input/index.tsx
@@ -279,16 +279,15 @@ var roundNumber = (num, fraction) => {
279
279
  import moment2 from "moment";
280
280
 
281
281
  // test-app/src/component/edit-form/index.tsx
282
- import { forwardRef, useEffect as useEffect3, useRef, useState as useState2 } from "react";
282
+ import { forwardRef as forwardRef2, useEffect as useEffect4, useRef as useRef2, useState as useState3 } from "react";
283
283
  import {
284
- DropdownItem,
285
- DropdownMenu,
286
- DropdownToggle,
287
- Dropdown,
288
- Input as Input4,
289
- Form,
284
+ DropdownItem as DropdownItem2,
285
+ DropdownMenu as DropdownMenu2,
286
+ DropdownToggle as DropdownToggle2,
287
+ Dropdown as Dropdown2,
288
+ Input as Input5,
290
289
  Row,
291
- Button,
290
+ Button as Button2,
292
291
  Col
293
292
  } from "reactstrap";
294
293
  import { useForm } from "react-hook-form";
@@ -387,175 +386,15 @@ var TextInput = (props) => {
387
386
  };
388
387
  var input_text_default = TextInput;
389
388
 
390
- // test-app/src/component/select/index.tsx
389
+ // test-app/src/component/input-number/index.tsx
391
390
  import { Controller as Controller2 } from "react-hook-form";
392
- import { Label as Label2, FormFeedback as FormFeedback2 } from "reactstrap";
393
- import Select from "react-select";
391
+ import { Input as Input3, Label as Label2, FormFeedback as FormFeedback2 } from "reactstrap";
394
392
  import classnames2 from "classnames";
395
393
  import { Fragment as Fragment4 } from "react";
396
394
  import { useTranslation as useTranslation2 } from "react-i18next";
397
395
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
398
- var SelectBox = (props) => {
399
- const { t } = useTranslation2();
400
- const { control, id, placeholder, fieldValue, confirmHandle, disabled, name, options, label, isLabel, labelSize, classes, required, errors, isMulti, isClearable, labelComponent, callback, inLine, onInputChange, ref, menuPosition, ...rest } = props;
401
- const handChange = ({ onChange, val }) => {
402
- onChange(!isNullOrUndefined(val) && isMulti ? val.map((item) => item.value) : !isNullOrUndefined(val) && !isMulti ? fieldValue ? val[fieldValue] : val?.value : void 0);
403
- if (callback) {
404
- callback(val);
405
- }
406
- };
407
- const renderSelect = () => {
408
- return /* @__PURE__ */ jsxs4(Fragment4, { children: [
409
- /* @__PURE__ */ jsx4(
410
- Controller2,
411
- {
412
- name,
413
- control,
414
- render: ({ field: { value, onChange } }) => {
415
- return /* @__PURE__ */ jsx4(
416
- Select,
417
- {
418
- ...rest,
419
- id,
420
- value: isMulti && value?.length > 0 ? value.map((x) => options.find((val) => (fieldValue ? val[fieldValue] : val.value) === x)) : !isNullOrUndefined(value) && value !== "" ? options.find((val) => (fieldValue ? val[fieldValue] : val.value) === value) : "",
421
- onChange: (val) => {
422
- if ((fieldValue && val ? val[fieldValue] : val?.value) !== value) {
423
- if (confirmHandle) {
424
- confirmHandle(handChange, onChange, val);
425
- } else {
426
- onChange(!isNullOrUndefined(val) && isMulti ? val.map((item) => item.value) : !isNullOrUndefined(val) && !isMulti ? fieldValue ? val[fieldValue] : val?.value : void 0);
427
- if (callback) {
428
- callback(val);
429
- }
430
- }
431
- }
432
- },
433
- onInputChange,
434
- form: name,
435
- placeholder: placeholder ? placeholder : "",
436
- classNamePrefix: "select",
437
- className: `react-select ${errors && "is-invalid"}`,
438
- options,
439
- isMulti,
440
- isDisabled: disabled,
441
- isClearable,
442
- menuPosition: menuPosition ?? "fixed",
443
- formatOptionLabel: labelComponent ? labelComponent : void 0,
444
- ref
445
- }
446
- );
447
- }
448
- }
449
- ),
450
- errors && /* @__PURE__ */ jsx4(FormFeedback2, { children: errors?.message })
451
- ] });
452
- };
453
- return /* @__PURE__ */ jsx4(Fragment4, { children: /* @__PURE__ */ jsxs4(
454
- "div",
455
- {
456
- className: classnames2(
457
- inLine === false ? "form-group " : "form-row-inline d-flex",
458
- "align",
459
- {
460
- [labelSize ? labelSize : ""]: labelSize,
461
- [classes ? classes : ""]: classes,
462
- "form-row-inline-error": errors
463
- }
464
- ),
465
- children: [
466
- isLabel === false ? "" : /* @__PURE__ */ jsxs4(Label2, { className: "form-label", for: name, children: [
467
- t(label ? label : ""),
468
- " ",
469
- required ? /* @__PURE__ */ jsx4("span", { className: "text-danger", children: "*" }) : "",
470
- " "
471
- ] }),
472
- /* @__PURE__ */ jsx4("div", { className: classnames2("form-input-content", { "hidden-label": isLabel === false }), children: renderSelect() })
473
- ]
474
- }
475
- ) });
476
- };
477
- var select_default = SelectBox;
478
-
479
- // test-app/src/component/creactable-select/index.tsx
480
- import { Controller as Controller3 } from "react-hook-form";
481
- import { Label as Label3, FormFeedback as FormFeedback3 } from "reactstrap";
482
- import classnames3 from "classnames";
483
- import { Fragment as Fragment5 } from "react";
484
- import { useTranslation as useTranslation3 } from "react-i18next";
485
- import CreatableSelect from "react-select/creatable";
486
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
487
- var CreatableSelectBox = (props) => {
488
- const { t } = useTranslation3();
489
- const { isMulti, id, isLabel, control, placeholder, fieldValue, name, options, label, labelSize, required, errors, inLine, isClearable, labelComponent, onInputChange, callback, ...rest } = props;
490
- return /* @__PURE__ */ jsx5(Fragment5, { children: /* @__PURE__ */ jsxs5(
491
- "div",
492
- {
493
- className: classnames3(
494
- inLine === false ? "form-group " : "form-row-inline d-flex",
495
- "align",
496
- {
497
- [labelSize ? labelSize : ""]: labelSize,
498
- "form-row-inline-error": errors
499
- }
500
- ),
501
- children: [
502
- isLabel === false ? "" : /* @__PURE__ */ jsxs5(Label3, { className: "form-label", for: name, children: [
503
- t(label),
504
- " ",
505
- required ? /* @__PURE__ */ jsx5("span", { className: "text-danger", children: "*" }) : "",
506
- " "
507
- ] }),
508
- /* @__PURE__ */ jsxs5("div", { className: classnames3("form-input-content", { "hidden-label": isLabel === false }), children: [
509
- /* @__PURE__ */ jsx5(
510
- Controller3,
511
- {
512
- name,
513
- control,
514
- render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsx5(
515
- CreatableSelect,
516
- {
517
- ...rest,
518
- id,
519
- value: isMulti && value?.length > 0 ? value.map((x) => options.find((val) => (fieldValue ? val[fieldValue] : val.value) === x)) : !isNullOrUndefined(value) && value !== "" ? options.find((val) => (fieldValue ? val[fieldValue] : val.value) === value) : "",
520
- onChange: (val) => {
521
- if (fieldValue && val.__isNew__) {
522
- val[fieldValue] = val.value;
523
- }
524
- onChange(!isNullOrUndefined(val) && isMulti ? val.map((item) => item.value) : !isNullOrUndefined(val) && !isMulti ? fieldValue ? val[fieldValue] : val?.value : void 0);
525
- if (callback) {
526
- callback(val);
527
- }
528
- },
529
- onInputChange,
530
- classNamePrefix: "select",
531
- className: `react-select ${errors && "is-invalid"}`,
532
- options,
533
- placeholder,
534
- isMulti,
535
- isClearable,
536
- menuPosition: "fixed",
537
- formatOptionLabel: labelComponent ? labelComponent : void 0
538
- }
539
- )
540
- }
541
- ),
542
- errors && /* @__PURE__ */ jsx5(FormFeedback3, { children: errors?.message })
543
- ] })
544
- ]
545
- }
546
- ) });
547
- };
548
- var creactable_select_default = CreatableSelectBox;
549
-
550
- // test-app/src/component/input-number/index.tsx
551
- import { Controller as Controller4 } from "react-hook-form";
552
- import { Input as Input3, Label as Label4, FormFeedback as FormFeedback4 } from "reactstrap";
553
- import classnames4 from "classnames";
554
- import { Fragment as Fragment6 } from "react";
555
- import { useTranslation as useTranslation4 } from "react-i18next";
556
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
557
396
  var NumberInput = (props) => {
558
- const { t } = useTranslation4();
397
+ const { t } = useTranslation2();
559
398
  const {
560
399
  control,
561
400
  id,
@@ -583,21 +422,21 @@ var NumberInput = (props) => {
583
422
  ...rest
584
423
  } = props;
585
424
  const renderLabel = () => {
586
- return /* @__PURE__ */ jsx6(Fragment6, { children: isLabel === false ? "" : /* @__PURE__ */ jsxs6(Label4, { className: "form-label", for: name, children: [
425
+ return /* @__PURE__ */ jsx4(Fragment4, { children: isLabel === false ? "" : /* @__PURE__ */ jsxs4(Label2, { className: "form-label", for: name, children: [
587
426
  t(label ? label : ""),
588
427
  " ",
589
- required ? /* @__PURE__ */ jsx6("span", { className: "text-danger", children: "*" }) : "",
428
+ required ? /* @__PURE__ */ jsx4("span", { className: "text-danger", children: "*" }) : "",
590
429
  " "
591
430
  ] }) });
592
431
  };
593
432
  const renderInput = () => {
594
- return /* @__PURE__ */ jsxs6(Fragment6, { children: [
595
- /* @__PURE__ */ jsx6(
596
- Controller4,
433
+ return /* @__PURE__ */ jsxs4(Fragment4, { children: [
434
+ /* @__PURE__ */ jsx4(
435
+ Controller2,
597
436
  {
598
437
  name,
599
438
  control,
600
- render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsx6(
439
+ render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsx4(
601
440
  Input3,
602
441
  {
603
442
  id,
@@ -657,13 +496,13 @@ var NumberInput = (props) => {
657
496
  )
658
497
  }
659
498
  ),
660
- errors && /* @__PURE__ */ jsx6(FormFeedback4, { children: errors?.message })
499
+ errors && /* @__PURE__ */ jsx4(FormFeedback2, { children: errors?.message })
661
500
  ] });
662
501
  };
663
- return /* @__PURE__ */ jsx6(Fragment6, { children: /* @__PURE__ */ jsxs6(
502
+ return /* @__PURE__ */ jsx4(Fragment4, { children: /* @__PURE__ */ jsxs4(
664
503
  "div",
665
504
  {
666
- className: classnames4(
505
+ className: classnames2(
667
506
  " align",
668
507
  {
669
508
  [labelSize ? labelSize : ""]: labelSize,
@@ -674,358 +513,590 @@ var NumberInput = (props) => {
674
513
  ),
675
514
  children: [
676
515
  renderLabel(),
677
- /* @__PURE__ */ jsx6("div", { className: classnames4("form-input-content", { "hidden-label": isLabel === false }), children: renderInput() })
516
+ /* @__PURE__ */ jsx4("div", { className: classnames2("form-input-content", { "hidden-label": isLabel === false }), children: renderInput() })
678
517
  ]
679
518
  }
680
519
  ) });
681
520
  };
682
521
  var input_number_default = NumberInput;
683
522
 
684
- // test-app/src/component/edit-form/index.tsx
685
- import { Fragment as Fragment7, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
686
- var defaultWidth = 200;
687
- var EditForm = forwardRef((props, ref) => {
523
+ // test-app/src/component/edit-form/select-table/index.tsx
524
+ import { Controller as Controller3 } from "react-hook-form";
525
+ import { FormFeedback as FormFeedback3, Label as Label3, UncontrolledTooltip as UncontrolledTooltip2 } from "reactstrap";
526
+ import classnames4 from "classnames";
527
+ import { Fragment as Fragment7 } from "react";
528
+
529
+ // test-app/src/component/select-table/index.tsx
530
+ import { forwardRef, Fragment as Fragment5, useEffect as useEffect3, useMemo, useRef, useState as useState2 } from "react";
531
+ import {
532
+ DropdownItem,
533
+ DropdownMenu,
534
+ DropdownToggle,
535
+ Dropdown,
536
+ Button,
537
+ Input as Input4,
538
+ Spinner,
539
+ UncontrolledTooltip
540
+ } from "reactstrap";
541
+ import { useTranslation as useTranslation3 } from "react-i18next";
542
+ import classnames3 from "classnames";
543
+ import moment from "moment";
544
+ import { Plus } from "becoxy-icons";
545
+ import { Fragment as Fragment6, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
546
+ var defaultMaxHeight = 250;
547
+ var SelectTable = forwardRef((props, ref) => {
688
548
  const {
689
549
  id,
690
- field,
691
- displayValue,
692
- menuHeight,
693
550
  menuWidth,
694
- rowData,
695
551
  invalid,
696
- onChange,
697
- onChangeField,
698
552
  onKeyDown,
699
- defaultValues,
700
553
  placeholder,
701
554
  textAlign,
702
- schema,
703
- onFormOpen,
704
- onFormSubmit,
705
- footerTemplate,
706
- minWidth,
707
- onPaste,
708
- openOnFocus,
555
+ options,
556
+ columns,
557
+ decimalSeparator,
558
+ thousandSeparator,
559
+ onChange,
560
+ value,
561
+ fieldValue,
562
+ fieldLabel,
563
+ loadOptions,
564
+ maxHeight,
565
+ handleAdd,
709
566
  isClearable,
710
- labelSize = "label-small"
567
+ component,
568
+ formatOptionLabel,
569
+ isMulti,
570
+ noHeader,
571
+ isDisabled,
572
+ showFooter,
573
+ onPaste
711
574
  } = props;
712
- const { innerWidth } = window;
575
+ const selectTableRef = useRef();
576
+ const selectMenuTableRef = useRef();
713
577
  const inputRef = useRef();
714
- const editFormRef = useRef();
715
- const buttonRef = useRef();
716
578
  const [dropdownOpen, setDropdownOpen] = useState2(false);
717
- const [itemsField, setItemsField] = useState2([]);
718
- const { t } = useTranslation5();
719
- useOnClickOutside(editFormRef, () => {
720
- closeMenu();
721
- });
579
+ const [indexFocus, setIndexFocus] = useState2(-1);
580
+ const [isFocus, setIsFocus] = useState2(false);
581
+ const [isLoading, setIsLoading] = useState2(false);
582
+ const [searchTerm, setSearchTerm] = useState2("");
583
+ const [optionsLoad, setOptionsLoad] = useState2();
584
+ const { t } = useTranslation3();
585
+ const isSelectedAll = useMemo(() => {
586
+ return isMulti === true && (optionsLoad ? optionsLoad : options).length > 0 && value?.length >= (optionsLoad ? optionsLoad : options).length;
587
+ }, [optionsLoad, options, value]);
588
+ const defaultColumns = noHeader ? [
589
+ {
590
+ headerText: "Name",
591
+ field: fieldLabel ?? "label",
592
+ width: menuWidth
593
+ }
594
+ ] : [
595
+ {
596
+ field: "key",
597
+ headerText: "Code",
598
+ width: 100,
599
+ maxWidth: 120,
600
+ minWidth: 80
601
+ },
602
+ {
603
+ headerText: "Name",
604
+ field: "label",
605
+ width: 150,
606
+ maxWidth: 200,
607
+ minWidth: 250
608
+ }
609
+ ];
722
610
  const closeMenu = () => {
723
- setTimeout(() => {
724
- setDropdownOpen(false);
725
- }, onChangeField ? 10 : 0);
611
+ setDropdownOpen(false);
726
612
  };
727
- const {
728
- control,
729
- handleSubmit,
730
- getValues,
731
- reset,
732
- setValue,
733
- formState: { errors }
734
- } = useForm({
735
- mode: "onChange",
736
- defaultValues,
737
- resolver: yupResolver(schema)
738
- });
739
613
  useEffect3(() => {
740
- if (dropdownOpen) {
741
- if (onFormOpen && itemsField.length === 0) {
742
- onFormOpen(rowData, itemsField, setItemsField);
743
- }
744
- if (openOnFocus) {
745
- setTimeout(() => {
746
- focusElement(`form-element-${field}-0`, true);
747
- }, 100);
748
- }
614
+ if (dropdownOpen && value && !isMulti && selectMenuTableRef) {
615
+ setTimeout(() => {
616
+ const elementFocus = document.getElementById(`row-select-table-${(optionsLoad ? optionsLoad : options)?.findIndex((e) => e[fieldValue ?? "value"] === value[fieldValue ?? "value"])}`);
617
+ if (elementFocus) {
618
+ const parentRect = selectMenuTableRef.current.getBoundingClientRect();
619
+ const childRect = elementFocus.getBoundingClientRect();
620
+ const offset = childRect.top - parentRect.top + selectMenuTableRef.current.scrollTop - parentRect.height / 2 + childRect.height / 2;
621
+ selectMenuTableRef.current.scrollTo({ top: offset });
622
+ }
623
+ }, 100);
749
624
  }
750
625
  }, [dropdownOpen]);
751
626
  useEffect3(() => {
752
- if (dropdownOpen && itemsField.length > 0) {
753
- itemsField.forEach((ele) => {
754
- setValue(ele.name, rowData[ele.name] ?? "");
627
+ if (inputRef && !isDisabled) {
628
+ inputRef.current.addEventListener("blur", function() {
629
+ setDropdownOpen(false);
630
+ setSearchTerm("");
631
+ setIsFocus(false);
632
+ });
633
+ inputRef.current.addEventListener("focus", function() {
634
+ if (!isFocus) {
635
+ setIsFocus(true);
636
+ }
755
637
  });
756
638
  }
757
- }, [dropdownOpen, itemsField]);
758
- const handleOnClick = () => {
639
+ }, [inputRef]);
640
+ useEffect3(() => {
641
+ if (searchTerm && !dropdownOpen) {
642
+ setDropdownOpen(true);
643
+ setIndexFocus(0);
644
+ }
645
+ }, [searchTerm]);
646
+ const handleOpenClose = () => {
647
+ setSearchTerm("");
759
648
  if (dropdownOpen) {
760
649
  closeMenu();
761
650
  } else {
762
- setDropdownOpen(true);
651
+ if (!isDisabled) {
652
+ setDropdownOpen(true);
653
+ }
763
654
  }
764
655
  };
765
- const handleOnSubmit = (val) => {
766
- closeMenu();
767
- onChange(val);
768
- if (onFormSubmit) {
769
- onFormSubmit(rowData, setValue, getValues, reset);
770
- }
771
- inputRef.current.focus();
772
- };
773
- const focusElement = (id2, focus) => {
774
- const element = document.getElementById(id2);
775
- if (element) {
776
- if (element.className.includes("react-select")) {
777
- element.getElementsByTagName("input")[0]?.focus();
778
- } else {
779
- element.focus();
780
- if (focus) {
781
- element.setSelectionRange(0, element.innerText.length - 1);
782
- }
656
+ const listKeyUse = ["Escape", "Space", "Enter", "Tab", "NumpadEnter", "ArrowDown", "ArrowUp", "F9"];
657
+ const handleOnKeyDown = (e) => {
658
+ let key = "";
659
+ if (onKeyDown && (!dropdownOpen || !listKeyUse.includes(e.code))) {
660
+ key = onKeyDown(e);
661
+ if (key === "ArrowRight" || key === "ArrowLeft") {
662
+ closeMenu();
783
663
  }
784
664
  }
785
- };
786
- const handleOnKeyDown = (e) => {
787
665
  let flag = false;
788
- if (dropdownOpen) {
789
- if (e.code === "Escape") {
790
- closeMenu();
791
- flag = true;
792
- } else if (e.code === "Enter") {
793
- closeMenu();
666
+ if (!key) {
667
+ if (e.code === "F9") {
668
+ handleAdd();
794
669
  flag = true;
670
+ } else if (e.code === "Escape" || e.code === "Space") {
671
+ if (dropdownOpen) {
672
+ if ((optionsLoad ? optionsLoad : options)[indexFocus]) {
673
+ onChange((optionsLoad ? optionsLoad : options)[indexFocus]);
674
+ }
675
+ }
676
+ if (!searchTerm) {
677
+ handleOpenClose();
678
+ flag = true;
679
+ }
680
+ } else if (e.code === "Enter" || e.code === "Tab" || e.code === "NumpadEnter") {
681
+ if (dropdownOpen) {
682
+ onChange((optionsLoad ? optionsLoad : options)[indexFocus]);
683
+ handleOpenClose();
684
+ flag = true;
685
+ }
795
686
  } else if (e.code === "ArrowDown") {
796
- focusElement(`form-element-${field}-0`);
797
- flag = true;
798
- }
799
- } else {
800
- if (e.code === "ArrowDown") {
801
- setDropdownOpen(true);
802
- focusElement(`form-element-${field}-0`);
803
- flag = true;
804
- } else if (e.code === "Space") {
805
- setDropdownOpen(true);
806
- flag = true;
687
+ if (dropdownOpen) {
688
+ let newIndex = 0;
689
+ if (indexFocus >= 0) {
690
+ newIndex = indexFocus + 1;
691
+ } else if (value) {
692
+ newIndex = (optionsLoad ? optionsLoad : options)?.findIndex((e2) => e2[fieldValue ?? "value"] === value[fieldValue ?? "value"]) + 1;
693
+ }
694
+ if (newIndex < (optionsLoad ? optionsLoad : options).length) {
695
+ setIndexFocus(newIndex);
696
+ checkIfElementIsOutOfScroll(0, newIndex);
697
+ } else {
698
+ setIndexFocus(0);
699
+ checkIfElementIsOutOfScroll(1, 0);
700
+ }
701
+ flag = true;
702
+ } else {
703
+ handleOpenClose();
704
+ flag = true;
705
+ }
706
+ } else if (e.code === "ArrowUp") {
707
+ if (dropdownOpen) {
708
+ let newIndex = 0;
709
+ if (indexFocus >= 0) {
710
+ newIndex = indexFocus - 1;
711
+ } else if (value) {
712
+ newIndex = (optionsLoad ? optionsLoad : options)?.findIndex((e2) => e2[fieldValue ?? "value"] === value[fieldValue ?? "value"]) - 1;
713
+ }
714
+ if (newIndex >= 0) {
715
+ setIndexFocus(newIndex);
716
+ checkIfElementIsOutOfScroll(2, newIndex);
717
+ } else {
718
+ setIndexFocus((optionsLoad ? optionsLoad : options).length - 1);
719
+ checkIfElementIsOutOfScroll(3, (optionsLoad ? optionsLoad : options).length - 1);
720
+ }
721
+ flag = true;
722
+ }
807
723
  }
808
724
  }
809
- if (onKeyDown && !flag) {
810
- const key = onKeyDown(e);
811
- if (key === "ArrowRight" || key === "ArrowLeft") {
812
- closeMenu();
813
- }
814
- } else {
725
+ if (flag) {
815
726
  e.stopPropagation();
816
727
  e.preventDefault();
817
728
  }
818
729
  };
819
- const formKeyDown = (e, handSubmit) => {
820
- if (e.code === "Enter") {
821
- handSubmit();
822
- e.preventDefault();
823
- e.stopPropagation();
824
- } else {
825
- if (onKeyDown) {
826
- const key = onKeyDown(e);
827
- if (key === "ArrowRight" || key === "ArrowLeft") {
828
- closeMenu();
730
+ const checkIfElementIsOutOfScroll = (flag, index) => {
731
+ if (selectMenuTableRef) {
732
+ const elementFocus = document.getElementById(`row-select-table-${index}`);
733
+ if (elementFocus) {
734
+ const rect = elementFocus.getBoundingClientRect();
735
+ const parentRect = selectMenuTableRef.current?.getBoundingClientRect();
736
+ if (flag === 1) {
737
+ scrollToElement(selectMenuTableRef.current, 0);
738
+ } else if (flag === 3) {
739
+ scrollToElement(selectMenuTableRef.current, selectMenuTableRef.current.scrollHeight);
740
+ } else if (flag === 0 && rect.bottom + 30 > parentRect.bottom) {
741
+ scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop - selectMenuTableRef.current.offsetTop - parentRect.height + rect.height + 50);
742
+ } else if (flag === 2 && rect.top < parentRect.top + 50) {
743
+ scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop - 65);
829
744
  }
830
745
  }
831
746
  }
832
747
  };
833
- const formItemKeyDown = (e, index) => {
834
- if (e.code === "ArrowDown" && index < itemsField.length - 1) {
835
- focusElement(`form-element-${field}-${index + 1}`);
836
- e.preventDefault();
837
- e.stopPropagation();
838
- } else if (e.code === "ArrowUp" && index > 0) {
839
- focusElement(`form-element-${field}-${index - 1}`);
840
- e.preventDefault();
841
- e.stopPropagation();
842
- } else if (e.code === "Tab" && onChangeField && index === itemsField.length - 1) {
843
- closeMenu();
844
- }
748
+ let timeOutElement;
749
+ const scrollToElement = (elemment, top) => {
750
+ clearTimeout(timeOutElement);
751
+ timeOutElement = setTimeout(() => {
752
+ elemment.scrollTo({
753
+ top,
754
+ behavior: "smooth"
755
+ });
756
+ }, 100);
845
757
  };
846
- const elementChange = (field2) => {
847
- if (onChangeField) {
848
- onChangeField(rowData, field2, setValue, getValues);
849
- const rs = getValues();
850
- if (rs) {
851
- onChange(rs);
758
+ const renderHeaderCol = (col, indexCol) => {
759
+ return /* @__PURE__ */ jsx5(
760
+ Fragment5,
761
+ {
762
+ children: col.visible !== false && /* @__PURE__ */ jsx5(
763
+ "th",
764
+ {
765
+ className: classnames3(
766
+ `r-select-headercell fix-${col.fixedType}`,
767
+ { "cell-fixed": col.fixedType }
768
+ ),
769
+ style: {
770
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
771
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
772
+ top: `${0 * 35}px`,
773
+ maxWidth: col.maxWidth
774
+ },
775
+ children: /* @__PURE__ */ jsx5(
776
+ "div",
777
+ {
778
+ role: "textbox",
779
+ title: t(col.headerText ?? ""),
780
+ style: {
781
+ height: `${1 * 35}px`,
782
+ justifyContent: col.textAlign ?? "left"
783
+ },
784
+ className: "r-select-headercell-div",
785
+ children: t(col.headerText ?? "")
786
+ }
787
+ )
788
+ }
789
+ )
790
+ },
791
+ `header-select-${indexCol}`
792
+ );
793
+ };
794
+ const checkSearch = (keyword, data, columnsSearch) => {
795
+ if (!keyword || columnsSearch.length === 0) {
796
+ return true;
797
+ }
798
+ for (let index = 0; index < columnsSearch.length; index++) {
799
+ const key = columnsSearch[index].field.trim();
800
+ if (data[key] && data[key].toString().trim().toLowerCase().includes(keyword.trim().toLowerCase())) {
801
+ return true;
852
802
  }
853
803
  }
804
+ return false;
854
805
  };
855
- const renderForm = (rows) => {
856
- return /* @__PURE__ */ jsx7(Row, { className: "gy-25", children: rows.map((item, index) => {
857
- if (item.type === "numeric") {
858
- return /* @__PURE__ */ jsx7(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx7(
859
- input_number_default,
860
- {
861
- id: `form-element-${field}-${index}`,
862
- control,
863
- name: item.name,
864
- label: item.label ? item.label : "",
865
- labelSize: `text-left ${labelSize}`,
866
- errors: errors[item.name],
867
- disabled: item.disabled,
868
- min: item.min,
869
- max: item.max,
870
- fractionCurrency: item.fraction,
871
- callback: () => {
872
- elementChange(item.name);
873
- }
874
- },
875
- index
876
- ) }, index);
877
- } else if (item.type === "text") {
878
- return /* @__PURE__ */ jsx7(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx7(
879
- input_text_default,
880
- {
881
- id: `form-element-${field}-${index}`,
882
- control,
883
- name: item.name,
884
- label: item.label ? item.label : "",
885
- labelSize: `text-left ${labelSize}`,
886
- errors: errors[item.name],
887
- disabled: item.disabled,
888
- callback: () => {
889
- elementChange(item.name);
890
- }
891
- },
892
- index
893
- ) }, index);
894
- } else if (item.type === "select") {
895
- return /* @__PURE__ */ jsx7(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx7(
896
- select_default,
897
- {
898
- id: `form-element-${field}-${index}`,
899
- options: item.options ?? [],
900
- control,
901
- name: item.name,
902
- label: item.label ? item.label : "",
903
- labelSize: `text-left ${labelSize}`,
904
- menuPortalTarget: document.body,
905
- errors: errors[item.name],
906
- disabled: item.disabled,
907
- callback: () => {
908
- elementChange(item.name);
909
- }
910
- },
911
- index
912
- ) }, index);
913
- } else if (item.type === "selectCreatable") {
914
- return /* @__PURE__ */ jsx7(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx7(
915
- creactable_select_default,
916
- {
917
- id: `form-element-${field}-${index}`,
918
- options: item.options ?? [],
919
- control,
920
- name: item.name,
921
- placeholder: t("Select"),
922
- menuPortalTarget: document.body,
923
- label: item.label ? item.label : "",
924
- labelSize: ` ${labelSize}`,
925
- errors: errors[item.name],
926
- callback: () => {
927
- elementChange(item.name);
806
+ const callbackLoadOption = (rs) => {
807
+ setIsLoading(false);
808
+ setOptionsLoad(rs);
809
+ };
810
+ useEffect3(() => {
811
+ if (!searchTerm) {
812
+ setOptionsLoad(void 0);
813
+ }
814
+ }, [searchTerm]);
815
+ const checkOverflow = (indexRow, indexCol) => {
816
+ const element = document.getElementById(`select-${id}-${indexRow}-${indexCol}`);
817
+ return element && element.scrollWidth > element.clientWidth;
818
+ };
819
+ const RenderElement = (props2) => {
820
+ const { indexRow, row, isSelected, level = 0 } = props2;
821
+ return /* @__PURE__ */ jsxs5(
822
+ "tr",
823
+ {
824
+ id: `row-select-table-${indexRow}`,
825
+ style: { paddingLeft: 10 * level },
826
+ className: classnames3("r-select-row", { "last-row": indexRow === (optionsLoad ? optionsLoad : options).length - 1 }, { "fisrt-row": indexRow === 0 }),
827
+ children: [
828
+ isMulti && /* @__PURE__ */ jsx5(
829
+ "td",
830
+ {
831
+ className: classnames3(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
832
+ style: { width: 40, textAlign: "center", padding: 0, paddingBottom: 6 },
833
+ onClick: (e) => {
834
+ if (isMulti) {
835
+ const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
836
+ if (index > -1) {
837
+ value?.splice(index, 1);
838
+ const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
839
+ onChange(valueArr);
840
+ } else {
841
+ if (value) {
842
+ value?.push(row[fieldValue ?? "value"]);
843
+ const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
844
+ onChange(valueArr);
845
+ } else {
846
+ onChange([row[fieldValue ?? "value"]]);
847
+ }
848
+ }
849
+ e.stopPropagation();
850
+ }
851
+ },
852
+ children: /* @__PURE__ */ jsx5(
853
+ Input4,
854
+ {
855
+ checked: isSelected,
856
+ type: "checkbox",
857
+ className: "cursor-pointer",
858
+ onChange: () => {
859
+ },
860
+ style: { textAlign: "center", marginTop: 6 }
861
+ }
862
+ )
928
863
  }
929
- },
930
- index
931
- ) }, index);
932
- }
933
- }) });
864
+ ),
865
+ (columns ? columns : defaultColumns).map((col, indexCol) => {
866
+ let valueDisplay = row[col.field];
867
+ if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
868
+ valueDisplay = formartNumberic(row[col.field], decimalSeparator ?? ".", thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
869
+ } else if (col.type === "date") {
870
+ valueDisplay = valueDisplay ? moment(valueDisplay).format("DD/MM/yyyy") : "";
871
+ } else if (col.type === "datetime") {
872
+ valueDisplay = valueDisplay ? moment(valueDisplay).format("DD/MM/yyyy HH:mm") : "";
873
+ }
874
+ return /* @__PURE__ */ jsxs5(Fragment5, { children: [
875
+ col.visible !== false && /* @__PURE__ */ jsx5(
876
+ "td",
877
+ {
878
+ id: `select-${id}-${indexRow}-${indexCol}`,
879
+ className: classnames3(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
880
+ style: {
881
+ minWidth: col.minWidth,
882
+ width: col.width,
883
+ maxWidth: col.maxWidth,
884
+ textAlign: col.textAlign ? col.textAlign : "left"
885
+ },
886
+ onClick: (e) => {
887
+ if (isMulti) {
888
+ const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
889
+ if (index > -1) {
890
+ value?.splice(index, 1);
891
+ const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
892
+ onChange(valueArr);
893
+ } else {
894
+ if (value) {
895
+ value?.push(row[fieldValue ?? "value"]);
896
+ const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
897
+ onChange(valueArr);
898
+ } else {
899
+ onChange([row[fieldValue ?? "value"]]);
900
+ }
901
+ }
902
+ } else {
903
+ onChange(row);
904
+ setSearchTerm("");
905
+ closeMenu();
906
+ }
907
+ e.preventDefault();
908
+ e.stopPropagation();
909
+ },
910
+ onMouseMove: (e) => {
911
+ if (indexRow !== indexFocus) {
912
+ setIndexFocus(indexRow);
913
+ }
914
+ e.stopPropagation();
915
+ },
916
+ children: col.template ? col.template(row, indexRow) : valueDisplay
917
+ },
918
+ `col-${indexRow}-${indexCol}`
919
+ ),
920
+ checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx5(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : valueDisplay })
921
+ ] }, indexCol);
922
+ })
923
+ ]
924
+ },
925
+ `row-${indexRow}`
926
+ );
934
927
  };
935
- return /* @__PURE__ */ jsx7(
928
+ const RenderTable = (props2) => {
929
+ const {} = props2;
930
+ let countDisplay = 0;
931
+ return /* @__PURE__ */ jsxs5(Fragment6, { children: [
932
+ /* @__PURE__ */ jsxs5("table", { style: { width: "100%" }, children: [
933
+ !noHeader && /* @__PURE__ */ jsx5("thead", { className: "r-select-gridheader", children: /* @__PURE__ */ jsxs5("tr", { className: "r-select-row", role: "row", children: [
934
+ isMulti && /* @__PURE__ */ jsx5("th", { className: classnames3(`r-select-headercell`), style: { width: 40, top: `0px` }, children: /* @__PURE__ */ jsx5(
935
+ "div",
936
+ {
937
+ style: { justifyContent: "center" },
938
+ className: classnames3("r-select-headercell-div"),
939
+ children: /* @__PURE__ */ jsx5(
940
+ Input4,
941
+ {
942
+ checked: isSelectedAll,
943
+ type: "checkbox",
944
+ onClick: (e) => {
945
+ if (isMulti) {
946
+ if (isSelectedAll) {
947
+ onChange([]);
948
+ } else {
949
+ onChange([...optionsLoad ? optionsLoad : options]);
950
+ }
951
+ e.stopPropagation();
952
+ }
953
+ },
954
+ readOnly: true,
955
+ className: classnames3("cursor-pointer", { "d-none": !isMulti }),
956
+ style: { textAlign: "center", marginTop: 6 }
957
+ }
958
+ )
959
+ }
960
+ ) }),
961
+ !noHeader && (columns ? columns : defaultColumns).map((col, index) => {
962
+ return renderHeaderCol(col, index);
963
+ })
964
+ ] }) }),
965
+ (optionsLoad ? optionsLoad : options).length > 0 && !isLoading && /* @__PURE__ */ jsx5(Fragment6, { children: /* @__PURE__ */ jsx5("tbody", { className: "r-select-gridcontent", children: (optionsLoad ? optionsLoad : options)?.map((row, indexRow) => {
966
+ if (!isMulti && loadOptions || checkSearch(searchTerm, row, columns ? columns : defaultColumns)) {
967
+ const isSelected = isMulti && value?.some((x) => x === row[fieldValue ?? "value"]);
968
+ countDisplay++;
969
+ return /* @__PURE__ */ jsx5(RenderElement, { isSelected, indexRow, row }, `select-table-${indexRow}`);
970
+ }
971
+ }) }) })
972
+ ] }),
973
+ countDisplay === 0 && !isLoading && /* @__PURE__ */ jsxs5("div", { className: "r-no-data", children: [
974
+ /* @__PURE__ */ jsx5("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxs5("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [
975
+ /* @__PURE__ */ jsx5("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }),
976
+ /* @__PURE__ */ jsxs5("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [
977
+ /* @__PURE__ */ jsx5("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" }),
978
+ /* @__PURE__ */ jsx5("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" })
979
+ ] })
980
+ ] }) }),
981
+ t("No data available.")
982
+ ] }),
983
+ isLoading && /* @__PURE__ */ jsxs5("div", { className: "r-no-data", children: [
984
+ /* @__PURE__ */ jsx5(Spinner, { className: "me-1", children: " " }),
985
+ t("Loading...")
986
+ ] })
987
+ ] });
988
+ };
989
+ return /* @__PURE__ */ jsx5(
936
990
  "div",
937
991
  {
938
- className: "form-edit",
992
+ className: classnames3("react-select-table", { "is-invalid": invalid }),
939
993
  ref,
940
994
  id,
941
- children: /* @__PURE__ */ jsx7("div", { ref: editFormRef, children: /* @__PURE__ */ jsxs7(
995
+ children: /* @__PURE__ */ jsx5("div", { ref: selectTableRef, children: /* @__PURE__ */ jsxs5(
942
996
  Dropdown,
943
997
  {
944
998
  isOpen: dropdownOpen,
945
999
  toggle: () => {
946
1000
  },
1001
+ onMouseDown: (e) => e.preventDefault(),
947
1002
  children: [
948
- /* @__PURE__ */ jsx7(DropdownToggle, { tag: "div", children: /* @__PURE__ */ jsx7(
949
- Input4,
1003
+ /* @__PURE__ */ jsxs5(
1004
+ DropdownToggle,
950
1005
  {
951
- style: { backgroundColor: "#FFF", textAlign: textAlign ?? "left" },
952
- placeholder,
953
- innerRef: inputRef,
954
- className: classNames2("input-display input-numeric", { "is-invalid": invalid }),
955
- value: displayValue,
956
- onClick: handleOnClick,
957
- onKeyDown: (e) => handleOnKeyDown(e),
958
- onPaste: (e) => onPaste && onPaste(e),
959
- readOnly: true
1006
+ onClick: (e) => {
1007
+ if (!isDisabled) {
1008
+ inputRef?.current.focus();
1009
+ handleOpenClose();
1010
+ }
1011
+ e.preventDefault();
1012
+ },
1013
+ tag: "div",
1014
+ className: classnames3("select-table-control", { "r-select-is-disabled": isDisabled }, { "r-select-is-open": dropdownOpen }, { "r-select-is-focus": isFocus }, { "r-select-is-invalid": invalid }),
1015
+ children: [
1016
+ /* @__PURE__ */ jsxs5("div", { className: "select-table-container", children: [
1017
+ isMulti ? /* @__PURE__ */ jsx5(Fragment6, { children: /* @__PURE__ */ jsx5("div", { className: classnames3("select-value is-mutil", { "d-none": searchTerm }), children: value?.map((ele, index) => {
1018
+ const element = (optionsLoad ? optionsLoad : options).find((e) => e[fieldValue ?? "value"] === ele);
1019
+ if (element) {
1020
+ return /* @__PURE__ */ jsxs5("span", { children: [
1021
+ index === 0 ? "" : ", ",
1022
+ element[fieldLabel ?? "label"]
1023
+ ] }, index);
1024
+ }
1025
+ }) }) }) : /* @__PURE__ */ jsx5(Fragment6, { children: /* @__PURE__ */ jsxs5("div", { className: classnames3("select-value", { "d-none": searchTerm }), children: [
1026
+ value ? formatOptionLabel ? formatOptionLabel(value) : value[fieldLabel ?? "label"] : "",
1027
+ " "
1028
+ ] }) }),
1029
+ !((isMulti ? value?.length > 0 : value) || isDisabled || searchTerm) && /* @__PURE__ */ jsx5("div", { className: classnames3("select-placeholder"), children: placeholder }),
1030
+ /* @__PURE__ */ jsx5("div", { className: "input-container", children: /* @__PURE__ */ jsx5(
1031
+ "input",
1032
+ {
1033
+ style: { textAlign: textAlign ?? "left" },
1034
+ ref: inputRef,
1035
+ className: classnames3("select-input"),
1036
+ readOnly: isDisabled,
1037
+ value: searchTerm,
1038
+ onPaste: (e) => onPaste && !dropdownOpen && onPaste(e),
1039
+ onChange: (val) => {
1040
+ if (!isMulti && loadOptions && val.target.value) {
1041
+ setIsLoading(true);
1042
+ loadOptions(val.target.value, callbackLoadOption);
1043
+ }
1044
+ setSearchTerm(val.target.value);
1045
+ },
1046
+ onKeyDown: (e) => handleOnKeyDown(e)
1047
+ }
1048
+ ) })
1049
+ ] }),
1050
+ isLoading && /* @__PURE__ */ jsxs5("div", { className: classnames3("select-table-indicator d-flex align-items-center"), children: [
1051
+ /* @__PURE__ */ jsx5(Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" }),
1052
+ /* @__PURE__ */ jsx5(Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" }),
1053
+ /* @__PURE__ */ jsx5(Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" })
1054
+ ] }),
1055
+ isClearable && value && !isDisabled && /* @__PURE__ */ jsx5(
1056
+ "div",
1057
+ {
1058
+ className: classnames3("cursor-pointer"),
1059
+ onClick: (e) => {
1060
+ onChange(isMulti ? [] : void 0);
1061
+ e.stopPropagation();
1062
+ },
1063
+ children: /* @__PURE__ */ jsx5("svg", { height: "20", width: "20", color: "#c4c4c4", viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", className: "css-tj5bde-Svg", children: /* @__PURE__ */ jsx5("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" }) })
1064
+ }
1065
+ ),
1066
+ !isDisabled && /* @__PURE__ */ jsx5("div", { className: "select-table-indicator", onMouseDown: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx5("svg", { height: "20", width: "20", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx5("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" }) }) })
1067
+ ]
960
1068
  }
961
- ) }),
962
- /* @__PURE__ */ jsx7(
1069
+ ),
1070
+ /* @__PURE__ */ jsx5(
963
1071
  DropdownMenu,
964
1072
  {
1073
+ container: component,
965
1074
  className: "formula-dropdown icon-dropdown p-0",
966
1075
  style: {
967
- minWidth: minWidth ? minWidth : defaultWidth,
968
1076
  width: menuWidth ? menuWidth : "min-content",
969
- maxWidth: innerWidth > 1280 ? 1280 : innerWidth,
970
- borderRadius: 8,
971
- zIndex: 1056
1077
+ position: "fixed",
1078
+ borderRadius: 3,
1079
+ zIndex: 9999
972
1080
  },
973
- children: /* @__PURE__ */ jsx7(DropdownItem, { className: "p-0", style: { borderRadius: "6px" }, tag: "div", header: true, children: /* @__PURE__ */ jsxs7(Form, { className: "todo-modal", onKeyDown: (e) => formKeyDown(e, handleSubmit(handleOnSubmit)), children: [
974
- /* @__PURE__ */ jsx7(
975
- "div",
976
- {
977
- className: "p-1",
978
- style: {
979
- maxHeight: menuHeight ? menuHeight : 300,
980
- overflow: "auto"
981
- },
982
- children: itemsField ? renderForm(itemsField) : ""
983
- }
984
- ),
985
- /* @__PURE__ */ jsxs7("div", { className: "d-flex justify-content-between p-50", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: [
986
- /* @__PURE__ */ jsx7("div", { className: "text-primary py-25", style: { fontSize: 12 }, children: footerTemplate ? footerTemplate(rowData) : "" }),
987
- !onChangeField ? /* @__PURE__ */ jsxs7("div", { className: "d-flex justify-content-end", children: [
988
- isClearable && /* @__PURE__ */ jsx7(
989
- Button,
990
- {
991
- ref: buttonRef,
992
- className: "btn me-50 py-25 px-50",
993
- outline: true,
994
- onClick: () => {
995
- itemsField.forEach((e) => {
996
- if (e.type === "numeric") {
997
- setValue(e.name, 0);
998
- } else {
999
- setValue(e.name, "");
1000
- }
1001
- });
1002
- },
1003
- onKeyDown: (e) => {
1004
- if (e.code === "Tab") {
1005
- closeMenu();
1006
- }
1007
- },
1008
- children: t("Clear")
1009
- }
1010
- ),
1011
- /* @__PURE__ */ jsx7(
1012
- Button,
1013
- {
1014
- ref: buttonRef,
1015
- color: "primary",
1016
- className: "btn btn-primary py-25 px-50",
1017
- onClick: handleSubmit(handleOnSubmit),
1018
- onKeyDown: (e) => {
1019
- if (e.code === "Tab") {
1020
- closeMenu();
1021
- }
1022
- },
1023
- children: t("Save")
1024
- }
1025
- )
1026
- ] }) : /* @__PURE__ */ jsx7(Fragment7, {})
1027
- ] })
1028
- ] }) })
1081
+ children: /* @__PURE__ */ jsx5(DropdownItem, { className: classnames3("p-0 menu-select-table"), style: { borderRadius: "6px" }, tag: "div", header: true, children: dropdownOpen && /* @__PURE__ */ jsx5(
1082
+ "div",
1083
+ {
1084
+ onMouseDown: (e) => {
1085
+ if (!isDisabled) {
1086
+ inputRef?.current.focus();
1087
+ e.preventDefault();
1088
+ }
1089
+ },
1090
+ children: /* @__PURE__ */ jsxs5("div", { className: "r-select-grid", children: [
1091
+ /* @__PURE__ */ jsx5("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ jsx5(RenderTable, {}) }),
1092
+ /* @__PURE__ */ jsx5("div", { className: classnames3("r-select-footer", { "d-none": !(showFooter === true || handleAdd) }), children: /* @__PURE__ */ jsxs5(Button, { outline: true, color: "primary", onClick: handleAdd, className: classnames3("r-btn-add d-flex align-items-center", { "d-none": !handleAdd }), children: [
1093
+ /* @__PURE__ */ jsx5(Plus, { className: "me-50", fontSize: 16 }),
1094
+ t("AddNew"),
1095
+ " (F9)"
1096
+ ] }) })
1097
+ ] })
1098
+ }
1099
+ ) })
1029
1100
  }
1030
1101
  )
1031
1102
  ]
@@ -1034,1091 +1105,960 @@ var EditForm = forwardRef((props, ref) => {
1034
1105
  }
1035
1106
  );
1036
1107
  });
1037
- var edit_form_default = EditForm;
1038
-
1039
- // test-app/src/component/sidebar-setting-column/index.tsx
1040
- import { Fragment as Fragment9, useEffect as useEffect5, useState as useState4 } from "react";
1041
- import { Button as Button2, Input as Input5 } from "reactstrap";
1042
- import { useTranslation as useTranslation7 } from "react-i18next";
1043
1108
 
1044
- // test-app/src/component/modal-header/index.tsx
1045
- import { Edit, Info, Plus, X as X2 } from "becoxy-icons";
1046
- import classNames3 from "classnames";
1047
- import { useTranslation as useTranslation6 } from "react-i18next";
1048
- import { Fragment as Fragment8, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1049
- var ModalHeader = (props) => {
1050
- const { title, handleModal, typeModal = "Edit", component } = props;
1051
- const { t } = useTranslation6();
1052
- const handleModalIcon = () => {
1053
- if (typeModal === "Edit" || typeModal === "Approval") {
1054
- return /* @__PURE__ */ jsx8(Edit, { fontSize: 17, className: "me-1" });
1055
- } else if (typeModal === "View") {
1056
- return /* @__PURE__ */ jsx8(Info, { fontSize: 17, className: "me-1" });
1057
- } else if (typeModal === "Detail") {
1058
- return /* @__PURE__ */ jsx8(Info, { fontSize: 17, className: "me-1" });
1059
- } else if (typeModal === "Order") {
1060
- return /* @__PURE__ */ jsx8("span", { className: "e-icons e-sorting-1 me-1", style: { fontSize: "14px" } });
1061
- } else if (typeModal === "Process") {
1062
- return /* @__PURE__ */ jsx8("span", { className: "e-flat e-icons e-paste-match-destination me-1", style: { fontSize: "14px" } });
1063
- } else {
1064
- return /* @__PURE__ */ jsx8(Plus, { fontSize: 17, className: "me-1" });
1109
+ // test-app/src/component/edit-form/select-table/index.tsx
1110
+ import { useTranslation as useTranslation4 } from "react-i18next";
1111
+ import { Fragment as Fragment8, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1112
+ var SelectTableBox = (props) => {
1113
+ const {
1114
+ isMulti,
1115
+ isLabel,
1116
+ confirmHandle,
1117
+ id,
1118
+ fieldValue,
1119
+ fieldLabel,
1120
+ labelComponent,
1121
+ defaultOptions,
1122
+ loadOptions,
1123
+ control,
1124
+ placeholder,
1125
+ disabled,
1126
+ name,
1127
+ label,
1128
+ labelSize,
1129
+ required,
1130
+ errors,
1131
+ inLine,
1132
+ callback,
1133
+ desciptionLabel,
1134
+ classLabel,
1135
+ isClearable,
1136
+ defaultValue,
1137
+ handleAddNew,
1138
+ columns,
1139
+ ...rest
1140
+ } = props;
1141
+ const handChange = ({ onChange, val }) => {
1142
+ onChange(!isNullOrUndefined(val) && isMulti ? val.map((item) => item.value) : !isNullOrUndefined(val) && !isMulti ? fieldValue ? val[fieldValue] : val?.value : void 0);
1143
+ if (callback) {
1144
+ callback(val);
1065
1145
  }
1066
1146
  };
1067
- return /* @__PURE__ */ jsxs8("div", { className: "modal-header d-flex align-items-center justify-content-between mb-1", children: [
1068
- /* @__PURE__ */ jsxs8("div", { className: "d-flex align-items-center justify-content-start", children: [
1069
- /* @__PURE__ */ jsxs8("h5", { className: "modal-title", children: [
1070
- handleModalIcon(),
1147
+ const renderLabel = (props2) => {
1148
+ const { t } = useTranslation4();
1149
+ const { isLabel: isLabel2, desciptionLabel: desciptionLabel2, id: id2, classLabel: classLabel2, name: name2, label: label2, required: required2 } = props2;
1150
+ return /* @__PURE__ */ jsxs6(Fragment7, { children: [
1151
+ isLabel2 === false ? "" : /* @__PURE__ */ jsxs6(Label3, { id: `label-${id2}`, className: classLabel2, for: name2, children: [
1152
+ t(label2 ? label2 : ""),
1071
1153
  " ",
1072
- t(title)
1154
+ required2 ? /* @__PURE__ */ jsx6("span", { className: "text-danger", children: "*" }) : ""
1073
1155
  ] }),
1074
- component ? component() : /* @__PURE__ */ jsx8(Fragment8, {})
1075
- ] }),
1076
- /* @__PURE__ */ jsx8("div", { className: "todo-item-action d-flex align-items-center", children: /* @__PURE__ */ jsx8(
1077
- X2,
1078
- {
1079
- className: classNames3("fw-normal mt-25 cursor-pointer", { "d-none": !handleModal }),
1080
- fontSize: 20,
1081
- onClick: handleModal
1082
- }
1083
- ) })
1084
- ] });
1156
+ (!isNullOrUndefined(desciptionLabel2) && desciptionLabel2 !== "") ?? /* @__PURE__ */ jsx6(Fragment8, { children: /* @__PURE__ */ jsx6(UncontrolledTooltip2, { target: `label-${id2}`, children: t(desciptionLabel2 ?? "") }) })
1157
+ ] });
1158
+ };
1159
+ return /* @__PURE__ */ jsx6(Fragment7, { children: /* @__PURE__ */ jsxs6(
1160
+ "div",
1161
+ {
1162
+ className: classnames4(
1163
+ inLine === false ? "form-group " : "form-row-inline d-flex",
1164
+ "align",
1165
+ {
1166
+ [labelSize ? labelSize : ""]: labelSize,
1167
+ "form-row-inline-error": errors
1168
+ }
1169
+ ),
1170
+ children: [
1171
+ renderLabel({ isLabel, desciptionLabel, classLabel, name, label, required, id: id ?? "" }),
1172
+ /* @__PURE__ */ jsxs6("div", { className: classnames4("form-input-content", { "hidden-label": isLabel === false }), children: [
1173
+ /* @__PURE__ */ jsx6(
1174
+ Controller3,
1175
+ {
1176
+ name,
1177
+ control,
1178
+ render: ({ field: { value, onChange } }) => {
1179
+ return /* @__PURE__ */ jsx6(
1180
+ SelectTable,
1181
+ {
1182
+ ...rest,
1183
+ id,
1184
+ value: (isMulti ? value?.length > 0 : value) ? !isMulti ? defaultOptions.find((val) => val[fieldValue ?? "value"] === value) ?? (defaultValue ?? "") : value : isMulti ? [] : void 0,
1185
+ onChange: (val) => {
1186
+ if (isMulti || (fieldValue && val ? val[fieldValue] : val?.value) !== value) {
1187
+ if (confirmHandle) {
1188
+ confirmHandle(handChange, onChange, val);
1189
+ } else {
1190
+ if (isMulti) {
1191
+ onChange(!isNullOrUndefined(val) ? val.map((item) => item[fieldValue ?? "value"]) : []);
1192
+ } else {
1193
+ onChange(!isNullOrUndefined(val) ? val[fieldValue ?? "value"] : void 0);
1194
+ }
1195
+ if (callback) {
1196
+ callback(val);
1197
+ }
1198
+ }
1199
+ }
1200
+ },
1201
+ handleAdd: handleAddNew,
1202
+ isClearable,
1203
+ isMulti,
1204
+ placeholder,
1205
+ invalid: errors,
1206
+ loadOptions,
1207
+ options: defaultOptions,
1208
+ isDisabled: disabled,
1209
+ columns,
1210
+ fieldValue,
1211
+ fieldLabel,
1212
+ formatOptionLabel: labelComponent ? labelComponent : void 0
1213
+ }
1214
+ );
1215
+ }
1216
+ }
1217
+ ),
1218
+ errors && /* @__PURE__ */ jsx6(FormFeedback3, { children: errors?.message })
1219
+ ] })
1220
+ ]
1221
+ }
1222
+ ) });
1085
1223
  };
1086
- var modal_header_default = ModalHeader;
1224
+ var select_table_default = SelectTableBox;
1087
1225
 
1088
- // test-app/src/component/sidebar/index.tsx
1089
- import { ChevronLeft, ChevronRight } from "becoxy-icons";
1090
- import classNames4 from "classnames";
1091
- import { useEffect as useEffect4, useState as useState3 } from "react";
1092
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1093
- var Sidebar = (props) => {
1226
+ // test-app/src/component/edit-form/index.tsx
1227
+ import { Fragment as Fragment9, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1228
+ var defaultWidth = 200;
1229
+ var EditForm = forwardRef2((props, ref) => {
1094
1230
  const {
1095
- open,
1096
- children,
1097
- toggleSidebar,
1098
- width,
1099
- keyboard,
1100
- hiddenBackground,
1101
- hiddenFullScreenButton
1231
+ id,
1232
+ field,
1233
+ displayValue,
1234
+ menuHeight,
1235
+ menuWidth,
1236
+ rowData,
1237
+ invalid,
1238
+ onChange,
1239
+ onChangeField,
1240
+ onKeyDown,
1241
+ defaultValues,
1242
+ placeholder,
1243
+ textAlign,
1244
+ schema,
1245
+ onFormOpen,
1246
+ onFormSubmit,
1247
+ footerTemplate,
1248
+ minWidth,
1249
+ onPaste,
1250
+ openOnFocus,
1251
+ isClearable,
1252
+ labelSize = "label-small"
1102
1253
  } = props;
1103
- const [isFullScreen, setIsFullScreen] = useState3(false);
1104
- const [flag, setFlag] = useState3(open);
1254
+ const { innerWidth } = window;
1255
+ const inputRef = useRef2();
1256
+ const editFormRef = useRef2();
1257
+ const buttonRef = useRef2();
1258
+ const [dropdownOpen, setDropdownOpen] = useState3(false);
1259
+ const [itemsField, setItemsField] = useState3([]);
1260
+ const { t } = useTranslation5();
1261
+ useOnClickOutside(editFormRef, () => {
1262
+ closeMenu();
1263
+ });
1264
+ const closeMenu = () => {
1265
+ setTimeout(() => {
1266
+ setDropdownOpen(false);
1267
+ }, onChangeField ? 10 : 0);
1268
+ };
1269
+ const {
1270
+ control,
1271
+ handleSubmit,
1272
+ getValues,
1273
+ reset,
1274
+ setValue,
1275
+ formState: { errors }
1276
+ } = useForm({
1277
+ mode: "onChange",
1278
+ defaultValues,
1279
+ resolver: yupResolver(schema)
1280
+ });
1105
1281
  useEffect4(() => {
1106
- if (open !== flag) {
1107
- if (open) {
1108
- setFlag(open);
1109
- } else {
1282
+ if (dropdownOpen) {
1283
+ if (onFormOpen && itemsField.length === 0) {
1284
+ onFormOpen(rowData, itemsField, setItemsField);
1285
+ }
1286
+ if (openOnFocus) {
1110
1287
  setTimeout(() => {
1111
- setFlag(open);
1112
- }, 50);
1288
+ focusElement(`form-element-${field}-0`, true);
1289
+ }, 100);
1113
1290
  }
1114
1291
  }
1115
- }, [open]);
1116
- const handClose = () => {
1117
- setFlag(false);
1118
- setTimeout(() => {
1119
- toggleSidebar();
1120
- }, 400);
1292
+ }, [dropdownOpen]);
1293
+ useEffect4(() => {
1294
+ if (dropdownOpen && itemsField.length > 0) {
1295
+ itemsField.forEach((ele) => {
1296
+ setValue(ele.name, rowData[ele.name] ?? "");
1297
+ });
1298
+ }
1299
+ }, [dropdownOpen, itemsField]);
1300
+ const handleOnClick = () => {
1301
+ if (dropdownOpen) {
1302
+ closeMenu();
1303
+ } else {
1304
+ setDropdownOpen(true);
1305
+ }
1121
1306
  };
1122
- return /* @__PURE__ */ jsxs9(
1123
- "div",
1124
- {
1125
- tabIndex: 0,
1126
- className: classNames4({ "d-none": !open }),
1127
- onKeyDown: (e) => {
1128
- if (!keyboard && e.code === "Escape" && flag) {
1129
- handClose();
1130
- e.stopPropagation();
1131
- e.preventDefault();
1307
+ const handleOnSubmit = (val) => {
1308
+ closeMenu();
1309
+ onChange(val);
1310
+ if (onFormSubmit) {
1311
+ onFormSubmit(rowData, setValue, getValues, reset);
1312
+ }
1313
+ inputRef.current.focus();
1314
+ };
1315
+ const focusElement = (id2, focus) => {
1316
+ const element = document.getElementById(id2);
1317
+ if (element) {
1318
+ if (element.className.includes("react-select")) {
1319
+ element.getElementsByTagName("input")[0]?.focus();
1320
+ } else {
1321
+ element.focus();
1322
+ if (focus) {
1323
+ element.setSelectionRange(0, element.innerText.length - 1);
1132
1324
  }
1133
- },
1134
- children: [
1135
- /* @__PURE__ */ jsx9(
1136
- "div",
1137
- {
1138
- className: classNames4("offcanvas-backdrop fade", {
1139
- "d-none": !flag || hiddenBackground,
1140
- show: flag
1141
- }),
1142
- style: { zIndex: 1056 },
1143
- onClick: handClose
1144
- }
1145
- ),
1146
- /* @__PURE__ */ jsxs9(
1147
- "div",
1148
- {
1149
- className: classNames4("customizer d-none d-md-block ", `customizer-${width ?? 600}`, {
1150
- open: flag,
1151
- fullscreen: isFullScreen
1152
- }),
1153
- style: { zIndex: 1057 },
1154
- children: [
1155
- /* @__PURE__ */ jsxs9(
1156
- "div",
1157
- {
1158
- style: {
1159
- position: "fixed",
1160
- top: "50%",
1161
- transform: "translate(-50%, -50%)",
1162
- background: "#FFF",
1163
- filter: "drop-shadow(0.9px 0.9px 1.5px)",
1164
- height: 50,
1165
- display: "flex",
1166
- alignItems: "center",
1167
- borderRadius: "0px 5px 5px 0px",
1168
- cursor: "pointer",
1169
- zIndex: 9,
1170
- marginLeft: 7
1171
- },
1172
- className: classNames4({ "d-none": hiddenFullScreenButton }),
1173
- onClick: () => {
1174
- setIsFullScreen(!isFullScreen);
1175
- },
1176
- children: [
1177
- /* @__PURE__ */ jsx9(ChevronLeft, { className: `${isFullScreen ? "d-none" : ""}`, fontSize: 16 }),
1178
- /* @__PURE__ */ jsx9(ChevronRight, { className: `${!isFullScreen ? "d-none" : ""}`, fontSize: 15 })
1179
- ]
1180
- }
1181
- ),
1182
- children
1183
- ]
1184
- }
1185
- )
1186
- ]
1187
- }
1188
- );
1189
- };
1190
- var sidebar_default = Sidebar;
1191
-
1192
- // test-app/src/component/sidebar-setting-column/index.tsx
1193
- import classnames5 from "classnames";
1194
- import { Fragment as Fragment10, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1195
- var SidebarSetColumn = (props) => {
1196
- const { column, setColumn, openSidebar, handleSidebar } = props;
1197
- const { t } = useTranslation7();
1198
- const [dataSource, setDataSource] = useState4([]);
1199
- const [indexFocus, setIndexFocus] = useState4();
1200
- useEffect5(() => {
1201
- if (openSidebar) {
1202
- setDataSource(column.map((e) => ({ ...e })));
1325
+ }
1203
1326
  }
1204
- }, [openSidebar]);
1205
- const handleCancel = () => {
1206
- handleSidebar();
1207
- setDataSource([]);
1208
1327
  };
1209
- const handleSubmit = () => {
1210
- setColumn([...dataSource]);
1211
- handleCancel();
1328
+ const handleOnKeyDown = (e) => {
1329
+ let flag = false;
1330
+ if (dropdownOpen) {
1331
+ if (e.code === "Escape") {
1332
+ closeMenu();
1333
+ flag = true;
1334
+ } else if (e.code === "Enter") {
1335
+ closeMenu();
1336
+ flag = true;
1337
+ } else if (e.code === "ArrowDown") {
1338
+ focusElement(`form-element-${field}-0`);
1339
+ flag = true;
1340
+ }
1341
+ } else {
1342
+ if (e.code === "ArrowDown") {
1343
+ setDropdownOpen(true);
1344
+ focusElement(`form-element-${field}-0`);
1345
+ flag = true;
1346
+ } else if (e.code === "Space") {
1347
+ setDropdownOpen(true);
1348
+ flag = true;
1349
+ }
1350
+ }
1351
+ if (onKeyDown && !flag) {
1352
+ const key = onKeyDown(e);
1353
+ if (key === "ArrowRight" || key === "ArrowLeft") {
1354
+ closeMenu();
1355
+ }
1356
+ } else {
1357
+ e.stopPropagation();
1358
+ e.preventDefault();
1359
+ }
1212
1360
  };
1213
- const getWindowSize = () => {
1214
- const { innerWidth, innerHeight } = window;
1215
- return { innerWidth, innerHeight };
1361
+ const formKeyDown = (e, handSubmit) => {
1362
+ if (e.code === "Enter") {
1363
+ handSubmit();
1364
+ e.preventDefault();
1365
+ e.stopPropagation();
1366
+ } else {
1367
+ if (onKeyDown) {
1368
+ const key = onKeyDown(e);
1369
+ if (key === "ArrowRight" || key === "ArrowLeft") {
1370
+ closeMenu();
1371
+ }
1372
+ }
1373
+ }
1216
1374
  };
1217
- const [windowSize, setWindowSize] = useState4(getWindowSize());
1218
- useEffect5(() => {
1219
- const handleWindowResize = () => {
1220
- setWindowSize(getWindowSize());
1221
- };
1222
- window.addEventListener("resize", handleWindowResize);
1223
- return () => {
1224
- window.removeEventListener("resize", handleWindowResize);
1225
- };
1226
- }, []);
1227
- const renderFooterButtons = () => {
1228
- return /* @__PURE__ */ jsxs10(Fragment9, { children: [
1229
- /* @__PURE__ */ jsx10(Button2, { color: "primary", onClick: handleSubmit, className: "me-1", children: t("Confirm") }),
1230
- /* @__PURE__ */ jsx10(Button2, { color: "secondary", onClick: handleCancel, outline: true, children: t("Close") })
1231
- ] });
1375
+ const formItemKeyDown = (e, index) => {
1376
+ if (e.code === "ArrowDown" && index < itemsField.length - 1) {
1377
+ focusElement(`form-element-${field}-${index + 1}`);
1378
+ e.preventDefault();
1379
+ e.stopPropagation();
1380
+ } else if (e.code === "ArrowUp" && index > 0) {
1381
+ focusElement(`form-element-${field}-${index - 1}`);
1382
+ e.preventDefault();
1383
+ e.stopPropagation();
1384
+ } else if (e.code === "Tab" && onChangeField && index === itemsField.length - 1) {
1385
+ closeMenu();
1386
+ }
1232
1387
  };
1233
- const visibleTemplate = (item, index) => {
1234
- return /* @__PURE__ */ jsx10(
1235
- Input5,
1236
- {
1237
- defaultChecked: item.visible ?? true,
1238
- disabled: item.invisibleDisable,
1239
- type: "checkbox",
1240
- style: { height: 18 },
1241
- className: " cursor-pointer",
1242
- onChange: (e) => {
1243
- if (dataSource) {
1244
- dataSource[index].visible = e.target.checked;
1245
- setDataSource(dataSource);
1246
- }
1247
- }
1388
+ const elementChange = (field2) => {
1389
+ if (onChangeField) {
1390
+ onChangeField(rowData, field2, setValue, getValues);
1391
+ const rs = getValues();
1392
+ if (rs) {
1393
+ onChange(rs);
1248
1394
  }
1249
- );
1395
+ }
1250
1396
  };
1251
- const fixColumnTemplate = (item, index) => {
1252
- return /* @__PURE__ */ jsx10(
1253
- Input5,
1254
- {
1255
- defaultChecked: item.fixedType === "left" || item.fixedType === "right",
1256
- type: "checkbox",
1257
- style: { height: 18 },
1258
- className: " cursor-pointer",
1259
- onChange: (e) => {
1260
- if (dataSource) {
1261
- if (e.target.checked) {
1262
- if (index * 2 <= dataSource.length) {
1263
- dataSource[index].fixedType = "left";
1264
- } else {
1265
- dataSource[index].fixedType = "right";
1266
- }
1267
- } else {
1268
- dataSource[index].fixedType = void 0;
1397
+ const renderForm = (rows) => {
1398
+ return /* @__PURE__ */ jsx7(Row, { className: "gy-25", children: rows.map((item, index) => {
1399
+ if (item.type === "numeric") {
1400
+ return /* @__PURE__ */ jsx7(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx7(
1401
+ input_number_default,
1402
+ {
1403
+ id: `form-element-${field}-${index}`,
1404
+ control,
1405
+ name: item.name,
1406
+ label: item.label ? item.label : "",
1407
+ labelSize: `text-left ${labelSize}`,
1408
+ errors: errors[item.name],
1409
+ disabled: item.disabled,
1410
+ min: item.min,
1411
+ max: item.max,
1412
+ fractionCurrency: item.fraction,
1413
+ callback: () => {
1414
+ elementChange(item.name);
1269
1415
  }
1270
- setDataSource(dataSource);
1271
- }
1272
- }
1416
+ },
1417
+ index
1418
+ ) }, index);
1419
+ } else if (item.type === "text") {
1420
+ return /* @__PURE__ */ jsx7(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx7(
1421
+ input_text_default,
1422
+ {
1423
+ id: `form-element-${field}-${index}`,
1424
+ control,
1425
+ name: item.name,
1426
+ label: item.label ? item.label : "",
1427
+ labelSize: `text-left ${labelSize}`,
1428
+ errors: errors[item.name],
1429
+ disabled: item.disabled,
1430
+ callback: () => {
1431
+ elementChange(item.name);
1432
+ }
1433
+ },
1434
+ index
1435
+ ) }, index);
1436
+ } else if (item.type === "select") {
1437
+ return /* @__PURE__ */ jsx7(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx7(
1438
+ select_table_default,
1439
+ {
1440
+ id: `form-element-${field}-${index}`,
1441
+ defaultOptions: item.options ?? [],
1442
+ control,
1443
+ name: item.name,
1444
+ label: item.label ? item.label : "",
1445
+ labelSize: `text-left ${labelSize}`,
1446
+ errors: errors[item.name],
1447
+ disabled: item.disabled,
1448
+ callback: () => {
1449
+ elementChange(item.name);
1450
+ }
1451
+ },
1452
+ index
1453
+ ) }, index);
1273
1454
  }
1274
- );
1455
+ }) });
1275
1456
  };
1276
- const columns = [
1277
- {
1278
- field: "headerText",
1279
- headerText: "Column name",
1280
- template: (e) => {
1281
- return /* @__PURE__ */ jsx10(Fragment10, { children: t(e.headerText) });
1282
- },
1283
- visible: true,
1284
- width: 175,
1285
- maxWidth: 200,
1286
- minWidth: 150
1287
- },
1457
+ return /* @__PURE__ */ jsx7(
1458
+ "div",
1288
1459
  {
1289
- field: "",
1290
- template: visibleTemplate,
1291
- headerText: "Display",
1292
- textAlign: "center",
1293
- visible: true,
1294
- width: 100,
1295
- maxWidth: 120,
1296
- minWidth: 80
1297
- },
1298
- {
1299
- field: "",
1300
- template: fixColumnTemplate,
1301
- headerText: "Fix the column",
1302
- textAlign: "center",
1303
- visible: true,
1304
- width: 100,
1305
- maxWidth: 120,
1306
- minWidth: 80
1307
- },
1308
- {
1309
- field: "width",
1310
- headerText: "Column width",
1311
- textAlign: "right",
1312
- visible: true,
1313
- width: 100,
1314
- maxWidth: 120,
1315
- minWidth: 80
1316
- }
1317
- ];
1318
- const renderHeaderCol = (col, indexCol) => {
1319
- return /* @__PURE__ */ jsx10(
1320
- Fragment9,
1321
- {
1322
- children: col.visible !== false && /* @__PURE__ */ jsx10(
1323
- "th",
1324
- {
1325
- className: classnames5(
1326
- `r-headercell fix-${col.fixedType}`,
1327
- { "cell-fixed": col.fixedType }
1328
- ),
1329
- style: {
1330
- width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
1331
- minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
1332
- top: `${0 * 42}px`,
1333
- maxWidth: col.maxWidth
1334
- },
1335
- children: /* @__PURE__ */ jsx10(
1336
- "div",
1460
+ className: "form-edit",
1461
+ ref,
1462
+ id,
1463
+ children: /* @__PURE__ */ jsx7("div", { ref: editFormRef, children: /* @__PURE__ */ jsxs7(
1464
+ Dropdown2,
1465
+ {
1466
+ isOpen: dropdownOpen,
1467
+ toggle: () => {
1468
+ },
1469
+ children: [
1470
+ /* @__PURE__ */ jsx7(DropdownToggle2, { tag: "div", children: /* @__PURE__ */ jsx7(
1471
+ Input5,
1337
1472
  {
1338
- role: "textbox",
1339
- title: t(col.headerText ?? ""),
1340
- style: {
1341
- height: `${1 * 42}px`,
1342
- justifyContent: col.textAlign ?? "left"
1343
- },
1344
- className: "r-headercell-div",
1345
- children: t(col.headerText ?? "")
1473
+ style: { backgroundColor: "#FFF", textAlign: textAlign ?? "left" },
1474
+ placeholder,
1475
+ innerRef: inputRef,
1476
+ className: classNames2("input-display input-numeric", { "is-invalid": invalid }),
1477
+ value: displayValue,
1478
+ onClick: handleOnClick,
1479
+ onKeyDown: (e) => handleOnKeyDown(e),
1480
+ onPaste: (e) => onPaste && onPaste(e),
1481
+ readOnly: true
1346
1482
  }
1347
- )
1348
- }
1349
- )
1350
- },
1351
- `header-${indexCol}`
1352
- );
1353
- };
1354
- return /* @__PURE__ */ jsxs10(
1355
- sidebar_default,
1356
- {
1357
- open: openSidebar,
1358
- toggleSidebar: handleCancel,
1359
- width: 700,
1360
- children: [
1361
- /* @__PURE__ */ jsx10(modal_header_default, { typeModal: "Edit", handleModal: handleCancel, title: "Column setup" }),
1362
- /* @__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: [
1363
- /* @__PURE__ */ jsx10("thead", { className: "r-gridheader", children: /* @__PURE__ */ jsx10("tr", { className: "r-row", role: "row", children: columns.map((col, index) => {
1364
- return renderHeaderCol(col, index);
1365
- }) }) }),
1366
- /* @__PURE__ */ jsx10("tbody", { className: "r-gridcontent", children: dataSource?.map((row, indexRow) => {
1367
- return /* @__PURE__ */ jsx10(
1368
- "tr",
1483
+ ) }),
1484
+ /* @__PURE__ */ jsx7(
1485
+ DropdownMenu2,
1369
1486
  {
1370
- className: classnames5("r-row", { "last-row": indexRow === dataSource.length - 1 }, { "fisrt-row": indexRow === 0 }),
1371
- children: columns.map((col, indexCol) => {
1372
- let value = row[col.field];
1373
- if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
1374
- value = formartNumberic(row[col.field], ",", ".", col.numericSettings?.fraction, true) ?? 0;
1375
- }
1376
- return /* @__PURE__ */ jsx10(Fragment9, { children: col.visible !== false && /* @__PURE__ */ jsx10(
1377
- "td",
1487
+ className: "formula-dropdown icon-dropdown p-0",
1488
+ style: {
1489
+ minWidth: minWidth ? minWidth : defaultWidth,
1490
+ width: menuWidth ? menuWidth : "min-content",
1491
+ maxWidth: innerWidth > 1280 ? 1280 : innerWidth,
1492
+ borderRadius: 8,
1493
+ zIndex: 1056
1494
+ },
1495
+ children: /* @__PURE__ */ jsxs7(DropdownItem2, { className: "p-0", style: { borderRadius: "6px" }, tag: "div", header: true, children: [
1496
+ /* @__PURE__ */ jsx7(
1497
+ "div",
1378
1498
  {
1379
- className: classnames5(
1380
- `r-rowcell fix-${col.fixedType}`,
1381
- { "cell-fixed": col.fixedType },
1382
- { "r-active": indexFocus === indexRow }
1383
- ),
1499
+ onKeyDown: (e) => formKeyDown(e, handleSubmit(handleOnSubmit)),
1500
+ className: "p-1",
1384
1501
  style: {
1385
- padding: 0,
1386
- textAlign: col.textAlign ? col.textAlign : "left"
1387
- },
1388
- onFocus: (e) => {
1389
- if (indexRow !== indexFocus) {
1390
- setIndexFocus(indexRow);
1391
- }
1392
- e.stopPropagation();
1393
- },
1394
- onClick: (e) => {
1395
- if (e.target.nodeName === "DIV" || e.target.nodeName === "TD") {
1396
- if (indexRow !== indexFocus) {
1397
- setIndexFocus(indexRow);
1398
- }
1399
- e.stopPropagation();
1400
- }
1502
+ maxHeight: menuHeight ? menuHeight : 300,
1503
+ overflow: "auto"
1401
1504
  },
1402
- children: /* @__PURE__ */ jsx10(
1403
- "div",
1505
+ children: itemsField ? renderForm(itemsField) : ""
1506
+ }
1507
+ ),
1508
+ /* @__PURE__ */ jsxs7("div", { className: "d-flex justify-content-between p-50", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: [
1509
+ /* @__PURE__ */ jsx7("div", { className: "text-primary py-25", style: { fontSize: 12 }, children: footerTemplate ? footerTemplate(rowData) : "" }),
1510
+ !onChangeField ? /* @__PURE__ */ jsxs7("div", { className: "d-flex justify-content-end", children: [
1511
+ isClearable && /* @__PURE__ */ jsx7(
1512
+ Button2,
1404
1513
  {
1405
- className: classnames5("r-rowcell-div"),
1406
- style: {
1407
- width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto"
1514
+ ref: buttonRef,
1515
+ className: "btn me-50 py-25 px-50",
1516
+ outline: true,
1517
+ onClick: () => {
1518
+ itemsField.forEach((e) => {
1519
+ if (e.type === "numeric") {
1520
+ setValue(e.name, 0);
1521
+ } else {
1522
+ setValue(e.name, "");
1523
+ }
1524
+ });
1408
1525
  },
1409
- children: /* @__PURE__ */ jsx10(
1410
- "div",
1411
- {
1412
- className: classnames5("r-rowcell-content"),
1413
- style: {
1414
- margin: "7px 9px"
1415
- },
1416
- children: /* @__PURE__ */ jsx10("div", { className: "r-cell-text", children: col.template ? col.template(row, indexRow) : value })
1526
+ onKeyDown: (e) => {
1527
+ if (e.code === "Tab") {
1528
+ closeMenu();
1417
1529
  }
1418
- )
1530
+ },
1531
+ children: t("Clear")
1532
+ }
1533
+ ),
1534
+ /* @__PURE__ */ jsx7(
1535
+ Button2,
1536
+ {
1537
+ ref: buttonRef,
1538
+ color: "primary",
1539
+ className: "btn btn-primary py-25 px-50",
1540
+ onClick: handleSubmit(handleOnSubmit),
1541
+ onKeyDown: (e) => {
1542
+ if (e.code === "Tab") {
1543
+ closeMenu();
1544
+ }
1545
+ },
1546
+ children: t("Save")
1419
1547
  }
1420
1548
  )
1421
- },
1422
- `col-${indexRow}-${indexCol}`
1423
- ) }, indexCol);
1424
- })
1425
- },
1426
- `row-${indexRow}`
1427
- );
1428
- }) })
1429
- ] }) }) }) }),
1430
- /* @__PURE__ */ jsx10(
1431
- "div",
1432
- {
1433
- className: "d-flex justify-content-end p-1 ",
1434
- style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" },
1435
- children: renderFooterButtons()
1436
- }
1437
- )
1438
- ]
1549
+ ] }) : /* @__PURE__ */ jsx7(Fragment9, {})
1550
+ ] })
1551
+ ] })
1552
+ }
1553
+ )
1554
+ ]
1555
+ }
1556
+ ) })
1439
1557
  }
1440
1558
  );
1441
- };
1442
- var sidebar_setting_column_default = SidebarSetColumn;
1443
-
1444
- // test-app/src/component/table/index.tsx
1445
- import { DropDownTreeComponent } from "@syncfusion/ej2-react-dropdowns";
1559
+ });
1560
+ var edit_form_default = EditForm;
1446
1561
 
1447
- // test-app/src/component/paging/index.tsx
1448
- import { ChevronRight as ChevronRight2, ChevronLeft as ChevronLeft2, ChevronsLeft, ChevronsRight } from "becoxy-icons";
1449
- import classNames5 from "classnames";
1562
+ // test-app/src/component/sidebar-setting-column/index.tsx
1450
1563
  import { Fragment as Fragment11, useEffect as useEffect6, useState as useState5 } from "react";
1451
- import { useTranslation as useTranslation8 } from "react-i18next";
1452
- import Select2 from "react-select";
1453
- import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
1454
- var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOptions, onChangePageSize }) => {
1455
- const { t } = useTranslation8();
1456
- const [countPage, setCountPage] = useState5(0);
1457
- const [currentPageNumber, setCurrentPageNumber] = useState5(1);
1458
- useEffect6(() => {
1459
- setCountPage(Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1));
1460
- }, [totalItem, pageSize]);
1461
- useEffect6(() => {
1462
- setCurrentPageNumber(Math.floor(currentPage / 5) + (Math.floor(currentPage / 5) === currentPage / 5 ? 0 : 1));
1463
- }, [currentPage]);
1464
- const renderPageNumber = (number) => {
1465
- const arr = [];
1466
- for (let index = (number - 1) * 5 + 1; index <= number * 5 && index <= Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1); index++) {
1467
- arr.push(
1468
- /* @__PURE__ */ jsx11(
1469
- "div",
1470
- {
1471
- className: classNames5("r-number", { "r-active": index === currentPage }),
1472
- onClick: () => {
1473
- onChangePage({ totalItem, pageSize, currentPage: index, old: currentPage });
1474
- },
1475
- children: index
1476
- },
1477
- `page-${index}`
1478
- )
1479
- );
1480
- }
1481
- return arr;
1482
- };
1483
- return /* @__PURE__ */ jsx11(Fragment11, { children: /* @__PURE__ */ jsxs11("div", { className: "r-pager", children: [
1484
- /* @__PURE__ */ jsxs11("div", { className: "r-pagercontainer", children: [
1485
- /* @__PURE__ */ jsx11("button", { className: "r-button", type: "button", disabled: countPage <= 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: 1, old: currentPage }), children: /* @__PURE__ */ jsx11(ChevronsLeft, { fontSize: 16 }) }),
1486
- /* @__PURE__ */ jsx11("button", { className: "r-button", type: "button", disabled: countPage <= 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage - 1, old: currentPage }), children: /* @__PURE__ */ jsx11(ChevronLeft2, { fontSize: 16 }) }),
1487
- /* @__PURE__ */ jsx11(
1488
- "button",
1489
- {
1490
- className: classNames5("r-button", { "d-none": currentPageNumber === 1 }),
1491
- type: "button",
1492
- onClick: () => {
1493
- setCurrentPageNumber(currentPageNumber - 1);
1494
- onChangePage({ totalItem, pageSize, currentPage: (currentPageNumber - 2) * 5 + 1, old: currentPage });
1495
- },
1496
- children: "..."
1497
- }
1498
- ),
1499
- renderPageNumber(currentPageNumber),
1500
- /* @__PURE__ */ jsx11(
1501
- "button",
1502
- {
1503
- className: classNames5("r-button", { "d-none": currentPageNumber * 5 >= countPage }),
1504
- type: "button",
1505
- onClick: () => {
1506
- setCurrentPageNumber(currentPageNumber + 1);
1507
- onChangePage({ totalItem, pageSize, currentPage: currentPageNumber * 5 + 1, old: currentPage });
1508
- },
1509
- children: "..."
1510
- }
1511
- ),
1512
- /* @__PURE__ */ jsx11("button", { className: "r-button", type: "button", disabled: countPage <= 1 || countPage === currentPage, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage + 1, old: currentPage }), children: /* @__PURE__ */ jsx11(ChevronRight2, { fontSize: 16 }) }),
1513
- /* @__PURE__ */ jsx11("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__ */ jsx11(ChevronsRight, { fontSize: 16 }) }),
1514
- /* @__PURE__ */ jsx11("div", { className: "r-pagesize", children: /* @__PURE__ */ jsx11(
1515
- Select2,
1516
- {
1517
- value: { value: pageSize, label: pageSize },
1518
- options: pageOptions.map((item) => ({ value: item, label: item })),
1519
- onChange: (val) => {
1520
- onChangePageSize({ totalItem, pageSize: val?.value });
1521
- },
1522
- menuPosition: "fixed",
1523
- placeholder: t("Select"),
1524
- classNamePrefix: "select-pagesize"
1525
- }
1526
- ) }),
1527
- /* @__PURE__ */ jsx11("span", { style: { display: "inline", marginLeft: 10, fontSize: 13 }, children: t("pagerDropDown") })
1528
- ] }),
1529
- /* @__PURE__ */ jsx11("div", { className: "r-parentmsgbar", children: t("totalItemsInfo", { page: currentPage, countPage, totalItem }) })
1530
- ] }) });
1531
- };
1564
+ import { Button as Button3, Input as Input6 } from "reactstrap";
1565
+ import { useTranslation as useTranslation7 } from "react-i18next";
1532
1566
 
1533
- // test-app/src/component/select-table/index.tsx
1534
- import { forwardRef as forwardRef2, Fragment as Fragment12, useEffect as useEffect7, useMemo, useRef as useRef2, useState as useState6 } from "react";
1535
- import {
1536
- DropdownItem as DropdownItem2,
1537
- DropdownMenu as DropdownMenu2,
1538
- DropdownToggle as DropdownToggle2,
1539
- Dropdown as Dropdown2,
1540
- Button as Button3,
1541
- Input as Input6,
1542
- Spinner,
1543
- UncontrolledTooltip
1544
- } from "reactstrap";
1545
- import { useTranslation as useTranslation9 } from "react-i18next";
1546
- import classnames6 from "classnames";
1547
- import moment from "moment";
1548
- import { Plus as Plus2 } from "becoxy-icons";
1549
- import { Fragment as Fragment13, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
1550
- var defaultMaxHeight = 250;
1551
- var SelectTable = forwardRef2((props, ref) => {
1552
- const {
1553
- id,
1554
- menuWidth,
1555
- invalid,
1556
- onKeyDown,
1557
- placeholder,
1558
- textAlign,
1559
- options,
1560
- columns,
1561
- decimalSeparator,
1562
- thousandSeparator,
1563
- onChange,
1564
- value,
1565
- fieldValue,
1566
- fieldLabel,
1567
- loadOptions,
1568
- maxHeight,
1569
- handleAdd,
1570
- isClearable,
1571
- component,
1572
- formatOptionLabel,
1573
- isMulti,
1574
- noHeader,
1575
- isDisabled,
1576
- showFooter,
1577
- onPaste
1578
- } = props;
1579
- const selectTableRef = useRef2();
1580
- const selectMenuTableRef = useRef2();
1581
- const inputRef = useRef2();
1582
- const [dropdownOpen, setDropdownOpen] = useState6(false);
1583
- const [indexFocus, setIndexFocus] = useState6(-1);
1584
- const [isFocus, setIsFocus] = useState6(false);
1585
- const [isLoading, setIsLoading] = useState6(false);
1586
- const [searchTerm, setSearchTerm] = useState6("");
1587
- const [optionsLoad, setOptionsLoad] = useState6();
1588
- const { t } = useTranslation9();
1589
- const isSelectedAll = useMemo(() => {
1590
- return isMulti === true && (optionsLoad ? optionsLoad : options).length > 0 && value?.length >= (optionsLoad ? optionsLoad : options).length;
1591
- }, [optionsLoad, options, value]);
1592
- const defaultColumns = noHeader ? [
1593
- {
1594
- headerText: "Name",
1595
- field: fieldLabel ?? "label",
1596
- width: menuWidth
1597
- }
1598
- ] : [
1599
- {
1600
- field: "key",
1601
- headerText: "Code",
1602
- width: 100,
1603
- maxWidth: 120,
1604
- minWidth: 80
1605
- },
1606
- {
1607
- headerText: "Name",
1608
- field: "label",
1609
- width: 150,
1610
- maxWidth: 200,
1611
- minWidth: 250
1612
- }
1613
- ];
1614
- const closeMenu = () => {
1615
- setDropdownOpen(false);
1616
- };
1617
- useEffect7(() => {
1618
- if (dropdownOpen && value && !isMulti && selectMenuTableRef) {
1619
- setTimeout(() => {
1620
- const elementFocus = document.getElementById(`row-select-table-${(optionsLoad ? optionsLoad : options)?.findIndex((e) => e[fieldValue ?? "value"] === value[fieldValue ?? "value"])}`);
1621
- if (elementFocus) {
1622
- const parentRect = selectMenuTableRef.current.getBoundingClientRect();
1623
- const childRect = elementFocus.getBoundingClientRect();
1624
- const offset = childRect.top - parentRect.top + selectMenuTableRef.current.scrollTop - parentRect.height / 2 + childRect.height / 2;
1625
- selectMenuTableRef.current.scrollTo({ top: offset, behavior: "smooth" });
1626
- }
1627
- }, 100);
1628
- }
1629
- }, [dropdownOpen]);
1630
- useEffect7(() => {
1631
- if (inputRef && !isDisabled) {
1632
- inputRef.current.addEventListener("blur", function() {
1633
- setDropdownOpen(false);
1634
- setSearchTerm("");
1635
- setIsFocus(false);
1636
- });
1637
- inputRef.current.addEventListener("focus", function() {
1638
- if (!isFocus) {
1639
- setIsFocus(true);
1640
- }
1641
- });
1642
- }
1643
- }, [inputRef]);
1644
- useEffect7(() => {
1645
- if (searchTerm && !dropdownOpen) {
1646
- setDropdownOpen(true);
1647
- setIndexFocus(0);
1648
- }
1649
- }, [searchTerm]);
1650
- const handleOpenClose = () => {
1651
- setSearchTerm("");
1652
- if (dropdownOpen) {
1653
- closeMenu();
1567
+ // test-app/src/component/modal-header/index.tsx
1568
+ import { Edit, Info, Plus as Plus2, X as X2 } from "becoxy-icons";
1569
+ import classNames3 from "classnames";
1570
+ import { useTranslation as useTranslation6 } from "react-i18next";
1571
+ import { Fragment as Fragment10, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1572
+ var ModalHeader = (props) => {
1573
+ const { title, handleModal, typeModal = "Edit", component } = props;
1574
+ const { t } = useTranslation6();
1575
+ const handleModalIcon = () => {
1576
+ if (typeModal === "Edit" || typeModal === "Approval") {
1577
+ return /* @__PURE__ */ jsx8(Edit, { fontSize: 17, className: "me-1" });
1578
+ } else if (typeModal === "View") {
1579
+ return /* @__PURE__ */ jsx8(Info, { fontSize: 17, className: "me-1" });
1580
+ } else if (typeModal === "Detail") {
1581
+ return /* @__PURE__ */ jsx8(Info, { fontSize: 17, className: "me-1" });
1582
+ } else if (typeModal === "Order") {
1583
+ return /* @__PURE__ */ jsx8("span", { className: "e-icons e-sorting-1 me-1", style: { fontSize: "14px" } });
1584
+ } else if (typeModal === "Process") {
1585
+ return /* @__PURE__ */ jsx8("span", { className: "e-flat e-icons e-paste-match-destination me-1", style: { fontSize: "14px" } });
1654
1586
  } else {
1655
- if (!isDisabled) {
1656
- setDropdownOpen(true);
1657
- }
1587
+ return /* @__PURE__ */ jsx8(Plus2, { fontSize: 17, className: "me-1" });
1658
1588
  }
1659
1589
  };
1660
- const listKeyUse = ["Escape", "Space", "Enter", "Tab", "NumpadEnter", "ArrowDown", "ArrowUp", "F9"];
1661
- const handleOnKeyDown = (e) => {
1662
- let key = "";
1663
- if (onKeyDown && (!dropdownOpen || !listKeyUse.includes(e.code))) {
1664
- key = onKeyDown(e);
1665
- if (key === "ArrowRight" || key === "ArrowLeft") {
1666
- closeMenu();
1590
+ return /* @__PURE__ */ jsxs8("div", { className: "modal-header d-flex align-items-center justify-content-between mb-1", children: [
1591
+ /* @__PURE__ */ jsxs8("div", { className: "d-flex align-items-center justify-content-start", children: [
1592
+ /* @__PURE__ */ jsxs8("h5", { className: "modal-title", children: [
1593
+ handleModalIcon(),
1594
+ " ",
1595
+ t(title)
1596
+ ] }),
1597
+ component ? component() : /* @__PURE__ */ jsx8(Fragment10, {})
1598
+ ] }),
1599
+ /* @__PURE__ */ jsx8("div", { className: "todo-item-action d-flex align-items-center", children: /* @__PURE__ */ jsx8(
1600
+ X2,
1601
+ {
1602
+ className: classNames3("fw-normal mt-25 cursor-pointer", { "d-none": !handleModal }),
1603
+ fontSize: 20,
1604
+ onClick: handleModal
1667
1605
  }
1668
- }
1669
- let flag = false;
1670
- if (!key) {
1671
- if (e.code === "F9") {
1672
- handleAdd();
1673
- flag = true;
1674
- } else if (e.code === "Escape" || e.code === "Space") {
1675
- if (dropdownOpen) {
1676
- if ((optionsLoad ? optionsLoad : options)[indexFocus]) {
1677
- onChange((optionsLoad ? optionsLoad : options)[indexFocus]);
1678
- }
1679
- }
1680
- if (!searchTerm) {
1681
- handleOpenClose();
1682
- flag = true;
1683
- }
1684
- } else if (e.code === "Enter" || e.code === "Tab" || e.code === "NumpadEnter") {
1685
- if (dropdownOpen) {
1686
- onChange((optionsLoad ? optionsLoad : options)[indexFocus]);
1687
- handleOpenClose();
1688
- flag = true;
1689
- }
1690
- } else if (e.code === "ArrowDown") {
1691
- if (dropdownOpen) {
1692
- let newIndex = 0;
1693
- if (indexFocus >= 0) {
1694
- newIndex = indexFocus + 1;
1695
- } else if (value) {
1696
- newIndex = (optionsLoad ? optionsLoad : options)?.findIndex((e2) => e2[fieldValue ?? "value"] === value[fieldValue ?? "value"]) + 1;
1697
- }
1698
- if (newIndex < (optionsLoad ? optionsLoad : options).length) {
1699
- setIndexFocus(newIndex);
1700
- checkIfElementIsOutOfScroll(0, newIndex);
1701
- } else {
1702
- setIndexFocus(0);
1703
- checkIfElementIsOutOfScroll(1, 0);
1704
- }
1705
- flag = true;
1706
- } else {
1707
- handleOpenClose();
1708
- flag = true;
1709
- }
1710
- } else if (e.code === "ArrowUp") {
1711
- if (dropdownOpen) {
1712
- let newIndex = 0;
1713
- if (indexFocus >= 0) {
1714
- newIndex = indexFocus - 1;
1715
- } else if (value) {
1716
- newIndex = (optionsLoad ? optionsLoad : options)?.findIndex((e2) => e2[fieldValue ?? "value"] === value[fieldValue ?? "value"]) - 1;
1717
- }
1718
- if (newIndex >= 0) {
1719
- setIndexFocus(newIndex);
1720
- checkIfElementIsOutOfScroll(2, newIndex);
1721
- } else {
1722
- setIndexFocus((optionsLoad ? optionsLoad : options).length - 1);
1723
- checkIfElementIsOutOfScroll(3, (optionsLoad ? optionsLoad : options).length - 1);
1724
- }
1725
- flag = true;
1726
- }
1606
+ ) })
1607
+ ] });
1608
+ };
1609
+ var modal_header_default = ModalHeader;
1610
+
1611
+ // test-app/src/component/sidebar/index.tsx
1612
+ import { ChevronLeft, ChevronRight } from "becoxy-icons";
1613
+ import classNames4 from "classnames";
1614
+ import { useEffect as useEffect5, useState as useState4 } from "react";
1615
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1616
+ var Sidebar = (props) => {
1617
+ const {
1618
+ open,
1619
+ children,
1620
+ toggleSidebar,
1621
+ width,
1622
+ keyboard,
1623
+ hiddenBackground,
1624
+ hiddenFullScreenButton
1625
+ } = props;
1626
+ const [isFullScreen, setIsFullScreen] = useState4(false);
1627
+ const [flag, setFlag] = useState4(open);
1628
+ useEffect5(() => {
1629
+ if (open !== flag) {
1630
+ if (open) {
1631
+ setFlag(open);
1632
+ } else {
1633
+ setTimeout(() => {
1634
+ setFlag(open);
1635
+ }, 50);
1727
1636
  }
1728
1637
  }
1729
- if (flag) {
1730
- e.stopPropagation();
1731
- e.preventDefault();
1732
- }
1638
+ }, [open]);
1639
+ const handClose = () => {
1640
+ setFlag(false);
1641
+ setTimeout(() => {
1642
+ toggleSidebar();
1643
+ }, 400);
1733
1644
  };
1734
- const checkIfElementIsOutOfScroll = (flag, index) => {
1735
- if (selectMenuTableRef) {
1736
- const elementFocus = document.getElementById(`row-select-table-${index}`);
1737
- console.log(elementFocus);
1738
- if (elementFocus) {
1739
- const rect = elementFocus.getBoundingClientRect();
1740
- const parentRect = selectMenuTableRef.current?.getBoundingClientRect();
1741
- if (flag === 1) {
1742
- scrollToElement(selectMenuTableRef.current, 0);
1743
- } else if (flag === 3) {
1744
- scrollToElement(selectMenuTableRef.current, selectMenuTableRef.current.scrollHeight);
1745
- } else if (flag === 0 && rect.bottom + 30 > parentRect.bottom) {
1746
- scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop - selectMenuTableRef.current.offsetTop - parentRect.height + rect.height + 50);
1747
- } else if (flag === 2 && rect.top < parentRect.top + 50) {
1748
- scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop - 65);
1645
+ return /* @__PURE__ */ jsxs9(
1646
+ "div",
1647
+ {
1648
+ tabIndex: 0,
1649
+ className: classNames4({ "d-none": !open }),
1650
+ onKeyDown: (e) => {
1651
+ if (!keyboard && e.code === "Escape" && flag) {
1652
+ handClose();
1653
+ e.stopPropagation();
1654
+ e.preventDefault();
1749
1655
  }
1750
- }
1751
- }
1752
- };
1753
- let timeOutElement;
1754
- const scrollToElement = (elemment, top) => {
1755
- clearTimeout(timeOutElement);
1756
- timeOutElement = setTimeout(() => {
1757
- elemment.scrollTo({
1758
- top,
1759
- behavior: "smooth"
1760
- });
1761
- }, 100);
1762
- };
1763
- const renderHeaderCol = (col, indexCol) => {
1764
- return /* @__PURE__ */ jsx12(
1765
- Fragment12,
1766
- {
1767
- children: col.visible !== false && /* @__PURE__ */ jsx12(
1768
- "th",
1769
- {
1770
- className: classnames6(
1771
- `r-select-headercell fix-${col.fixedType}`,
1772
- { "cell-fixed": col.fixedType }
1773
- ),
1774
- style: {
1775
- width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
1776
- minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
1777
- top: `${0 * 35}px`,
1778
- maxWidth: col.maxWidth
1779
- },
1780
- children: /* @__PURE__ */ jsx12(
1781
- "div",
1782
- {
1783
- role: "textbox",
1784
- title: t(col.headerText ?? ""),
1785
- style: {
1786
- height: `${1 * 35}px`,
1787
- justifyContent: col.textAlign ?? "left"
1788
- },
1789
- className: "r-select-headercell-div",
1790
- children: t(col.headerText ?? "")
1791
- }
1792
- )
1793
- }
1794
- )
1795
1656
  },
1796
- `header-select-${indexCol}`
1797
- );
1798
- };
1799
- const checkSearch = (keyword, data, columnsSearch) => {
1800
- if (!keyword || columnsSearch.length === 0) {
1801
- return true;
1802
- }
1803
- for (let index = 0; index < columnsSearch.length; index++) {
1804
- const key = columnsSearch[index].field.trim();
1805
- if (data[key] && data[key].toString().trim().toLowerCase().includes(keyword.trim().toLowerCase())) {
1806
- return true;
1807
- }
1808
- }
1809
- return false;
1810
- };
1811
- const callbackLoadOption = (rs) => {
1812
- setIsLoading(false);
1813
- setOptionsLoad(rs);
1814
- };
1815
- useEffect7(() => {
1816
- if (!searchTerm) {
1817
- setOptionsLoad(void 0);
1818
- }
1819
- }, [searchTerm]);
1820
- const checkOverflow = (indexRow, indexCol) => {
1821
- const element = document.getElementById(`select-${id}-${indexRow}-${indexCol}`);
1822
- return element && element.scrollWidth > element.clientWidth;
1823
- };
1824
- const RenderElement = (props2) => {
1825
- const { indexRow, row, isSelected, level = 0 } = props2;
1826
- return /* @__PURE__ */ jsxs12(
1827
- "tr",
1828
- {
1829
- id: `row-select-table-${indexRow}`,
1830
- style: { paddingLeft: 10 * level },
1831
- className: classnames6("r-select-row", { "last-row": indexRow === (optionsLoad ? optionsLoad : options).length - 1 }, { "fisrt-row": indexRow === 0 }),
1832
- children: [
1833
- isMulti && /* @__PURE__ */ jsx12(
1834
- "td",
1835
- {
1836
- className: classnames6(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
1837
- style: { width: 40, textAlign: "center", padding: 0, paddingBottom: 6 },
1838
- onClick: (e) => {
1839
- if (isMulti) {
1840
- const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
1841
- if (index > -1) {
1842
- value?.splice(index, 1);
1843
- const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
1844
- onChange(valueArr);
1845
- } else {
1846
- if (value) {
1847
- value?.push(row[fieldValue ?? "value"]);
1848
- const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
1849
- onChange(valueArr);
1850
- } else {
1851
- onChange([row[fieldValue ?? "value"]]);
1852
- }
1853
- }
1854
- e.stopPropagation();
1855
- }
1856
- },
1857
- children: /* @__PURE__ */ jsx12(
1858
- Input6,
1859
- {
1860
- checked: isSelected,
1861
- type: "checkbox",
1862
- className: "cursor-pointer",
1863
- onChange: () => {
1864
- },
1865
- style: { textAlign: "center", marginTop: 6 }
1866
- }
1867
- )
1868
- }
1869
- ),
1870
- (columns ? columns : defaultColumns).map((col, indexCol) => {
1871
- let valueDisplay = row[col.field];
1872
- if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
1873
- valueDisplay = formartNumberic(row[col.field], decimalSeparator ?? ".", thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
1874
- } else if (col.type === "date") {
1875
- valueDisplay = valueDisplay ? moment(valueDisplay).format("DD/MM/yyyy") : "";
1876
- } else if (col.type === "datetime") {
1877
- valueDisplay = valueDisplay ? moment(valueDisplay).format("DD/MM/yyyy HH:mm") : "";
1878
- }
1879
- return /* @__PURE__ */ jsxs12(Fragment12, { children: [
1880
- col.visible !== false && /* @__PURE__ */ jsx12(
1881
- "td",
1882
- {
1883
- id: `select-${id}-${indexRow}-${indexCol}`,
1884
- className: classnames6(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
1885
- style: {
1886
- minWidth: col.minWidth,
1887
- width: col.width,
1888
- maxWidth: col.maxWidth,
1889
- textAlign: col.textAlign ? col.textAlign : "left"
1890
- },
1891
- onClick: (e) => {
1892
- if (isMulti) {
1893
- const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
1894
- if (index > -1) {
1895
- value?.splice(index, 1);
1896
- const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
1897
- onChange(valueArr);
1898
- } else {
1899
- if (value) {
1900
- value?.push(row[fieldValue ?? "value"]);
1901
- const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
1902
- onChange(valueArr);
1903
- } else {
1904
- onChange([row[fieldValue ?? "value"]]);
1905
- }
1906
- }
1907
- } else {
1908
- onChange(row);
1909
- setSearchTerm("");
1910
- closeMenu();
1911
- }
1912
- e.preventDefault();
1913
- e.stopPropagation();
1657
+ children: [
1658
+ /* @__PURE__ */ jsx9(
1659
+ "div",
1660
+ {
1661
+ className: classNames4("offcanvas-backdrop fade", {
1662
+ "d-none": !flag || hiddenBackground,
1663
+ show: flag
1664
+ }),
1665
+ style: { zIndex: 1056 },
1666
+ onClick: handClose
1667
+ }
1668
+ ),
1669
+ /* @__PURE__ */ jsxs9(
1670
+ "div",
1671
+ {
1672
+ className: classNames4("customizer d-none d-md-block ", `customizer-${width ?? 600}`, {
1673
+ open: flag,
1674
+ fullscreen: isFullScreen
1675
+ }),
1676
+ style: { zIndex: 1057 },
1677
+ children: [
1678
+ /* @__PURE__ */ jsxs9(
1679
+ "div",
1680
+ {
1681
+ style: {
1682
+ position: "fixed",
1683
+ top: "50%",
1684
+ transform: "translate(-50%, -50%)",
1685
+ background: "#FFF",
1686
+ filter: "drop-shadow(0.9px 0.9px 1.5px)",
1687
+ height: 50,
1688
+ display: "flex",
1689
+ alignItems: "center",
1690
+ borderRadius: "0px 5px 5px 0px",
1691
+ cursor: "pointer",
1692
+ zIndex: 9,
1693
+ marginLeft: 7
1914
1694
  },
1915
- onMouseMove: (e) => {
1916
- if (indexRow !== indexFocus) {
1917
- setIndexFocus(indexRow);
1918
- }
1919
- e.stopPropagation();
1695
+ className: classNames4({ "d-none": hiddenFullScreenButton }),
1696
+ onClick: () => {
1697
+ setIsFullScreen(!isFullScreen);
1920
1698
  },
1921
- children: col.template ? col.template(row, indexRow) : valueDisplay
1922
- },
1923
- `col-${indexRow}-${indexCol}`
1699
+ children: [
1700
+ /* @__PURE__ */ jsx9(ChevronLeft, { className: `${isFullScreen ? "d-none" : ""}`, fontSize: 16 }),
1701
+ /* @__PURE__ */ jsx9(ChevronRight, { className: `${!isFullScreen ? "d-none" : ""}`, fontSize: 15 })
1702
+ ]
1703
+ }
1924
1704
  ),
1925
- checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx12(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : valueDisplay })
1926
- ] }, indexCol);
1927
- })
1928
- ]
1929
- },
1930
- `row-${indexRow}`
1705
+ children
1706
+ ]
1707
+ }
1708
+ )
1709
+ ]
1710
+ }
1711
+ );
1712
+ };
1713
+ var sidebar_default = Sidebar;
1714
+
1715
+ // test-app/src/component/sidebar-setting-column/index.tsx
1716
+ import classnames5 from "classnames";
1717
+ import { Fragment as Fragment12, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1718
+ var SidebarSetColumn = (props) => {
1719
+ const { column, setColumn, openSidebar, handleSidebar } = props;
1720
+ const { t } = useTranslation7();
1721
+ const [dataSource, setDataSource] = useState5([]);
1722
+ const [indexFocus, setIndexFocus] = useState5();
1723
+ useEffect6(() => {
1724
+ if (openSidebar) {
1725
+ setDataSource(column.map((e) => ({ ...e })));
1726
+ }
1727
+ }, [openSidebar]);
1728
+ const handleCancel = () => {
1729
+ handleSidebar();
1730
+ setDataSource([]);
1731
+ };
1732
+ const handleSubmit = () => {
1733
+ setColumn([...dataSource]);
1734
+ handleCancel();
1735
+ };
1736
+ const getWindowSize = () => {
1737
+ const { innerWidth, innerHeight } = window;
1738
+ return { innerWidth, innerHeight };
1739
+ };
1740
+ const [windowSize, setWindowSize] = useState5(getWindowSize());
1741
+ useEffect6(() => {
1742
+ const handleWindowResize = () => {
1743
+ setWindowSize(getWindowSize());
1744
+ };
1745
+ window.addEventListener("resize", handleWindowResize);
1746
+ return () => {
1747
+ window.removeEventListener("resize", handleWindowResize);
1748
+ };
1749
+ }, []);
1750
+ const renderFooterButtons = () => {
1751
+ return /* @__PURE__ */ jsxs10(Fragment11, { children: [
1752
+ /* @__PURE__ */ jsx10(Button3, { color: "primary", onClick: handleSubmit, className: "me-1", children: t("Confirm") }),
1753
+ /* @__PURE__ */ jsx10(Button3, { color: "secondary", onClick: handleCancel, outline: true, children: t("Close") })
1754
+ ] });
1755
+ };
1756
+ const visibleTemplate = (item, index) => {
1757
+ return /* @__PURE__ */ jsx10(
1758
+ Input6,
1759
+ {
1760
+ defaultChecked: item.visible ?? true,
1761
+ disabled: item.invisibleDisable,
1762
+ type: "checkbox",
1763
+ style: { height: 18 },
1764
+ className: " cursor-pointer",
1765
+ onChange: (e) => {
1766
+ if (dataSource) {
1767
+ dataSource[index].visible = e.target.checked;
1768
+ setDataSource(dataSource);
1769
+ }
1770
+ }
1771
+ }
1931
1772
  );
1932
1773
  };
1933
- const RenderTable = (props2) => {
1934
- const {} = props2;
1935
- let countDisplay = 0;
1936
- return /* @__PURE__ */ jsxs12(Fragment13, { children: [
1937
- /* @__PURE__ */ jsxs12("table", { style: { width: "100%" }, children: [
1938
- !noHeader && /* @__PURE__ */ jsx12("thead", { className: "r-select-gridheader", children: /* @__PURE__ */ jsxs12("tr", { className: "r-select-row", role: "row", children: [
1939
- isMulti && /* @__PURE__ */ jsx12("th", { className: classnames6(`r-select-headercell`), style: { width: 40, top: `0px` }, children: /* @__PURE__ */ jsx12(
1940
- "div",
1941
- {
1942
- style: { justifyContent: "center" },
1943
- className: classnames6("r-select-headercell-div"),
1944
- children: /* @__PURE__ */ jsx12(
1945
- Input6,
1946
- {
1947
- checked: isSelectedAll,
1948
- type: "checkbox",
1949
- onClick: (e) => {
1950
- if (isMulti) {
1951
- if (isSelectedAll) {
1952
- onChange([]);
1953
- } else {
1954
- onChange([...optionsLoad ? optionsLoad : options]);
1955
- }
1956
- e.stopPropagation();
1957
- }
1958
- },
1959
- readOnly: true,
1960
- className: classnames6("cursor-pointer", { "d-none": !isMulti }),
1961
- style: { textAlign: "center", marginTop: 6 }
1962
- }
1963
- )
1774
+ const fixColumnTemplate = (item, index) => {
1775
+ return /* @__PURE__ */ jsx10(
1776
+ Input6,
1777
+ {
1778
+ defaultChecked: item.fixedType === "left" || item.fixedType === "right",
1779
+ type: "checkbox",
1780
+ style: { height: 18 },
1781
+ className: " cursor-pointer",
1782
+ onChange: (e) => {
1783
+ if (dataSource) {
1784
+ if (e.target.checked) {
1785
+ if (index * 2 <= dataSource.length) {
1786
+ dataSource[index].fixedType = "left";
1787
+ } else {
1788
+ dataSource[index].fixedType = "right";
1789
+ }
1790
+ } else {
1791
+ dataSource[index].fixedType = void 0;
1964
1792
  }
1965
- ) }),
1966
- !noHeader && (columns ? columns : defaultColumns).map((col, index) => {
1967
- return renderHeaderCol(col, index);
1968
- })
1969
- ] }) }),
1970
- (optionsLoad ? optionsLoad : options).length > 0 && !isLoading && /* @__PURE__ */ jsx12(Fragment13, { children: /* @__PURE__ */ jsx12("tbody", { className: "r-select-gridcontent", children: (optionsLoad ? optionsLoad : options)?.map((row, indexRow) => {
1971
- if (!isMulti && loadOptions || checkSearch(searchTerm, row, columns ? columns : defaultColumns)) {
1972
- const isSelected = isMulti && value?.some((x) => x === row[fieldValue ?? "value"]);
1973
- countDisplay++;
1974
- return /* @__PURE__ */ jsx12(RenderElement, { isSelected, indexRow, row }, `select-table-${indexRow}`);
1793
+ setDataSource(dataSource);
1975
1794
  }
1976
- }) }) })
1977
- ] }),
1978
- countDisplay === 0 && !isLoading && /* @__PURE__ */ jsxs12("div", { className: "r-no-data", children: [
1979
- /* @__PURE__ */ jsx12("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxs12("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [
1980
- /* @__PURE__ */ jsx12("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }),
1981
- /* @__PURE__ */ jsxs12("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [
1982
- /* @__PURE__ */ jsx12("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" }),
1983
- /* @__PURE__ */ jsx12("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" })
1984
- ] })
1985
- ] }) }),
1986
- t("No data available.")
1987
- ] }),
1988
- isLoading && /* @__PURE__ */ jsxs12("div", { className: "r-no-data", children: [
1989
- /* @__PURE__ */ jsx12(Spinner, { className: "me-1", children: " " }),
1990
- t("Loading...")
1991
- ] })
1992
- ] });
1795
+ }
1796
+ }
1797
+ );
1993
1798
  };
1994
- return /* @__PURE__ */ jsx12(
1995
- "div",
1799
+ const columns = [
1996
1800
  {
1997
- className: classnames6("react-select-table", { "is-invalid": invalid }),
1998
- ref,
1999
- id,
2000
- children: /* @__PURE__ */ jsx12("div", { ref: selectTableRef, children: /* @__PURE__ */ jsxs12(
2001
- Dropdown2,
2002
- {
2003
- isOpen: dropdownOpen,
2004
- toggle: () => {
2005
- },
2006
- onMouseDown: (e) => e.preventDefault(),
2007
- children: [
2008
- /* @__PURE__ */ jsxs12(
2009
- DropdownToggle2,
2010
- {
2011
- onClick: (e) => {
2012
- if (!isDisabled) {
2013
- inputRef?.current.focus();
2014
- handleOpenClose();
2015
- }
2016
- e.preventDefault();
2017
- },
2018
- tag: "div",
2019
- className: classnames6("select-table-control", { "r-select-is-disabled": isDisabled }, { "r-select-is-open": dropdownOpen }, { "r-select-is-focus": isFocus }, { "r-select-is-invalid": invalid }),
2020
- children: [
2021
- /* @__PURE__ */ jsxs12("div", { className: "select-table-container", children: [
2022
- isMulti ? /* @__PURE__ */ jsx12(Fragment13, { children: /* @__PURE__ */ jsx12("div", { className: classnames6("select-value is-mutil", { "d-none": searchTerm }), children: value?.map((ele, index) => {
2023
- const element = (optionsLoad ? optionsLoad : options).find((e) => e[fieldValue ?? "value"] === ele);
2024
- if (element) {
2025
- return /* @__PURE__ */ jsxs12("span", { children: [
2026
- index === 0 ? "" : ", ",
2027
- element[fieldLabel ?? "label"]
2028
- ] }, index);
2029
- }
2030
- }) }) }) : /* @__PURE__ */ jsx12(Fragment13, { children: /* @__PURE__ */ jsxs12("div", { className: classnames6("select-value", { "d-none": searchTerm }), children: [
2031
- value ? formatOptionLabel ? formatOptionLabel(value) : value[fieldLabel ?? "label"] : "",
2032
- " "
2033
- ] }) }),
2034
- !((isMulti ? value?.length > 0 : value) || isDisabled || searchTerm) && /* @__PURE__ */ jsx12("div", { className: classnames6("select-placeholder"), children: placeholder }),
2035
- /* @__PURE__ */ jsx12("div", { className: "input-container", children: /* @__PURE__ */ jsx12(
2036
- "input",
2037
- {
2038
- style: { textAlign: textAlign ?? "left" },
2039
- ref: inputRef,
2040
- className: classnames6("select-input"),
2041
- readOnly: isDisabled,
2042
- value: searchTerm,
2043
- onPaste: (e) => onPaste && !dropdownOpen && onPaste(e),
2044
- onChange: (val) => {
2045
- if (!isMulti && loadOptions && val.target.value) {
2046
- setIsLoading(true);
2047
- loadOptions(val.target.value, callbackLoadOption);
2048
- }
2049
- setSearchTerm(val.target.value);
2050
- },
2051
- onKeyDown: (e) => handleOnKeyDown(e)
2052
- }
2053
- ) })
2054
- ] }),
2055
- isLoading && /* @__PURE__ */ jsxs12("div", { className: classnames6("select-table-indicator d-flex align-items-center"), children: [
2056
- /* @__PURE__ */ jsx12(Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" }),
2057
- /* @__PURE__ */ jsx12(Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" }),
2058
- /* @__PURE__ */ jsx12(Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" })
2059
- ] }),
2060
- isClearable && value && !isDisabled && /* @__PURE__ */ jsx12(
2061
- "div",
2062
- {
2063
- className: classnames6("cursor-pointer"),
2064
- onClick: (e) => {
2065
- onChange(isMulti ? [] : void 0);
2066
- e.stopPropagation();
2067
- },
2068
- children: /* @__PURE__ */ jsx12("svg", { height: "20", width: "20", color: "#c4c4c4", viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", className: "css-tj5bde-Svg", children: /* @__PURE__ */ jsx12("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" }) })
2069
- }
2070
- ),
2071
- !isDisabled && /* @__PURE__ */ jsx12("div", { className: "select-table-indicator", onMouseDown: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx12("svg", { height: "20", width: "20", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx12("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" }) }) })
2072
- ]
2073
- }
1801
+ field: "headerText",
1802
+ headerText: "Column name",
1803
+ template: (e) => {
1804
+ return /* @__PURE__ */ jsx10(Fragment12, { children: t(e.headerText) });
1805
+ },
1806
+ visible: true,
1807
+ width: 175,
1808
+ maxWidth: 200,
1809
+ minWidth: 150
1810
+ },
1811
+ {
1812
+ field: "",
1813
+ template: visibleTemplate,
1814
+ headerText: "Display",
1815
+ textAlign: "center",
1816
+ visible: true,
1817
+ width: 100,
1818
+ maxWidth: 120,
1819
+ minWidth: 80
1820
+ },
1821
+ {
1822
+ field: "",
1823
+ template: fixColumnTemplate,
1824
+ headerText: "Fix the column",
1825
+ textAlign: "center",
1826
+ visible: true,
1827
+ width: 100,
1828
+ maxWidth: 120,
1829
+ minWidth: 80
1830
+ },
1831
+ {
1832
+ field: "width",
1833
+ headerText: "Column width",
1834
+ textAlign: "right",
1835
+ visible: true,
1836
+ width: 100,
1837
+ maxWidth: 120,
1838
+ minWidth: 80
1839
+ }
1840
+ ];
1841
+ const renderHeaderCol = (col, indexCol) => {
1842
+ return /* @__PURE__ */ jsx10(
1843
+ Fragment11,
1844
+ {
1845
+ children: col.visible !== false && /* @__PURE__ */ jsx10(
1846
+ "th",
1847
+ {
1848
+ className: classnames5(
1849
+ `r-headercell fix-${col.fixedType}`,
1850
+ { "cell-fixed": col.fixedType }
2074
1851
  ),
2075
- /* @__PURE__ */ jsx12(
2076
- DropdownMenu2,
1852
+ style: {
1853
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
1854
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
1855
+ top: `${0 * 42}px`,
1856
+ maxWidth: col.maxWidth
1857
+ },
1858
+ children: /* @__PURE__ */ jsx10(
1859
+ "div",
2077
1860
  {
2078
- container: component,
2079
- className: "formula-dropdown icon-dropdown p-0",
1861
+ role: "textbox",
1862
+ title: t(col.headerText ?? ""),
2080
1863
  style: {
2081
- width: menuWidth ? menuWidth : "min-content",
2082
- position: "fixed",
2083
- borderRadius: 3,
2084
- zIndex: 9999
1864
+ height: `${1 * 42}px`,
1865
+ justifyContent: col.textAlign ?? "left"
2085
1866
  },
2086
- children: /* @__PURE__ */ jsx12(DropdownItem2, { className: classnames6("p-0 menu-select-table"), style: { borderRadius: "6px" }, tag: "div", header: true, children: dropdownOpen && /* @__PURE__ */ jsx12(
2087
- "div",
2088
- {
2089
- onMouseDown: (e) => {
2090
- if (!isDisabled) {
2091
- inputRef?.current.focus();
2092
- e.preventDefault();
2093
- }
2094
- },
2095
- children: /* @__PURE__ */ jsxs12("div", { className: "r-select-grid", children: [
2096
- /* @__PURE__ */ jsx12("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ jsx12(RenderTable, {}) }),
2097
- /* @__PURE__ */ jsx12("div", { className: classnames6("r-select-footer", { "d-none": !(showFooter === true || handleAdd) }), children: /* @__PURE__ */ jsxs12(Button3, { outline: true, color: "primary", onClick: handleAdd, className: classnames6("r-btn-add d-flex align-items-center", { "d-none": !handleAdd }), children: [
2098
- /* @__PURE__ */ jsx12(Plus2, { className: "me-50", fontSize: 16 }),
2099
- t("AddNew"),
2100
- " (F9)"
2101
- ] }) })
2102
- ] })
2103
- }
2104
- ) })
1867
+ className: "r-headercell-div",
1868
+ children: t(col.headerText ?? "")
2105
1869
  }
2106
1870
  )
2107
- ]
2108
- }
2109
- ) })
1871
+ }
1872
+ )
1873
+ },
1874
+ `header-${indexCol}`
1875
+ );
1876
+ };
1877
+ return /* @__PURE__ */ jsxs10(
1878
+ sidebar_default,
1879
+ {
1880
+ open: openSidebar,
1881
+ toggleSidebar: handleCancel,
1882
+ width: 700,
1883
+ children: [
1884
+ /* @__PURE__ */ jsx10(modal_header_default, { typeModal: "Edit", handleModal: handleCancel, title: "Column setup" }),
1885
+ /* @__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: [
1886
+ /* @__PURE__ */ jsx10("thead", { className: "r-gridheader", children: /* @__PURE__ */ jsx10("tr", { className: "r-row", role: "row", children: columns.map((col, index) => {
1887
+ return renderHeaderCol(col, index);
1888
+ }) }) }),
1889
+ /* @__PURE__ */ jsx10("tbody", { className: "r-gridcontent", children: dataSource?.map((row, indexRow) => {
1890
+ return /* @__PURE__ */ jsx10(
1891
+ "tr",
1892
+ {
1893
+ className: classnames5("r-row", { "last-row": indexRow === dataSource.length - 1 }, { "fisrt-row": indexRow === 0 }),
1894
+ children: columns.map((col, indexCol) => {
1895
+ let value = row[col.field];
1896
+ if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
1897
+ value = formartNumberic(row[col.field], ",", ".", col.numericSettings?.fraction, true) ?? 0;
1898
+ }
1899
+ return /* @__PURE__ */ jsx10(Fragment11, { children: col.visible !== false && /* @__PURE__ */ jsx10(
1900
+ "td",
1901
+ {
1902
+ className: classnames5(
1903
+ `r-rowcell fix-${col.fixedType}`,
1904
+ { "cell-fixed": col.fixedType },
1905
+ { "r-active": indexFocus === indexRow }
1906
+ ),
1907
+ style: {
1908
+ padding: 0,
1909
+ textAlign: col.textAlign ? col.textAlign : "left"
1910
+ },
1911
+ onFocus: (e) => {
1912
+ if (indexRow !== indexFocus) {
1913
+ setIndexFocus(indexRow);
1914
+ }
1915
+ e.stopPropagation();
1916
+ },
1917
+ onClick: (e) => {
1918
+ if (e.target.nodeName === "DIV" || e.target.nodeName === "TD") {
1919
+ if (indexRow !== indexFocus) {
1920
+ setIndexFocus(indexRow);
1921
+ }
1922
+ e.stopPropagation();
1923
+ }
1924
+ },
1925
+ children: /* @__PURE__ */ jsx10(
1926
+ "div",
1927
+ {
1928
+ className: classnames5("r-rowcell-div"),
1929
+ style: {
1930
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto"
1931
+ },
1932
+ children: /* @__PURE__ */ jsx10(
1933
+ "div",
1934
+ {
1935
+ className: classnames5("r-rowcell-content"),
1936
+ style: {
1937
+ margin: "7px 9px"
1938
+ },
1939
+ children: /* @__PURE__ */ jsx10("div", { className: "r-cell-text", children: col.template ? col.template(row, indexRow) : value })
1940
+ }
1941
+ )
1942
+ }
1943
+ )
1944
+ },
1945
+ `col-${indexRow}-${indexCol}`
1946
+ ) }, indexCol);
1947
+ })
1948
+ },
1949
+ `row-${indexRow}`
1950
+ );
1951
+ }) })
1952
+ ] }) }) }) }),
1953
+ /* @__PURE__ */ jsx10(
1954
+ "div",
1955
+ {
1956
+ className: "d-flex justify-content-end p-1 ",
1957
+ style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" },
1958
+ children: renderFooterButtons()
1959
+ }
1960
+ )
1961
+ ]
2110
1962
  }
2111
1963
  );
2112
- });
1964
+ };
1965
+ var sidebar_setting_column_default = SidebarSetColumn;
1966
+
1967
+ // test-app/src/component/table/index.tsx
1968
+ import { DropDownTreeComponent } from "@syncfusion/ej2-react-dropdowns";
1969
+
1970
+ // test-app/src/component/table/paging/index.tsx
1971
+ import { ChevronRight as ChevronRight2, ChevronLeft as ChevronLeft2, ChevronsLeft, ChevronsRight } from "becoxy-icons";
1972
+ import classNames5 from "classnames";
1973
+ import { Fragment as Fragment13, useEffect as useEffect7, useState as useState6 } from "react";
1974
+ import { useTranslation as useTranslation8 } from "react-i18next";
1975
+ import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
1976
+ var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOptions, onChangePageSize }) => {
1977
+ const { t } = useTranslation8();
1978
+ const [countPage, setCountPage] = useState6(0);
1979
+ const [currentPageNumber, setCurrentPageNumber] = useState6(1);
1980
+ useEffect7(() => {
1981
+ setCountPage(Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1));
1982
+ }, [totalItem, pageSize]);
1983
+ useEffect7(() => {
1984
+ setCurrentPageNumber(Math.floor(currentPage / 5) + (Math.floor(currentPage / 5) === currentPage / 5 ? 0 : 1));
1985
+ }, [currentPage]);
1986
+ const renderPageNumber = (number) => {
1987
+ const arr = [];
1988
+ for (let index = (number - 1) * 5 + 1; index <= number * 5 && index <= Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1); index++) {
1989
+ arr.push(
1990
+ /* @__PURE__ */ jsx11(
1991
+ "div",
1992
+ {
1993
+ className: classNames5("r-number", { "r-active": index === currentPage }),
1994
+ onClick: () => {
1995
+ onChangePage({ totalItem, pageSize, currentPage: index, old: currentPage });
1996
+ },
1997
+ children: index
1998
+ },
1999
+ `page-${index}`
2000
+ )
2001
+ );
2002
+ }
2003
+ return arr;
2004
+ };
2005
+ return /* @__PURE__ */ jsx11(Fragment13, { children: /* @__PURE__ */ jsxs11("div", { className: "r-pager", children: [
2006
+ /* @__PURE__ */ jsxs11("div", { className: "r-pagercontainer", children: [
2007
+ /* @__PURE__ */ jsx11("button", { className: "r-button", type: "button", disabled: countPage <= 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: 1, old: currentPage }), children: /* @__PURE__ */ jsx11(ChevronsLeft, { fontSize: 16 }) }),
2008
+ /* @__PURE__ */ jsx11("button", { className: "r-button", type: "button", disabled: countPage <= 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage - 1, old: currentPage }), children: /* @__PURE__ */ jsx11(ChevronLeft2, { fontSize: 16 }) }),
2009
+ /* @__PURE__ */ jsx11(
2010
+ "button",
2011
+ {
2012
+ className: classNames5("r-button", { "d-none": currentPageNumber === 1 }),
2013
+ type: "button",
2014
+ onClick: () => {
2015
+ setCurrentPageNumber(currentPageNumber - 1);
2016
+ onChangePage({ totalItem, pageSize, currentPage: (currentPageNumber - 2) * 5 + 1, old: currentPage });
2017
+ },
2018
+ children: "..."
2019
+ }
2020
+ ),
2021
+ renderPageNumber(currentPageNumber),
2022
+ /* @__PURE__ */ jsx11(
2023
+ "button",
2024
+ {
2025
+ className: classNames5("r-button", { "d-none": currentPageNumber * 5 >= countPage }),
2026
+ type: "button",
2027
+ onClick: () => {
2028
+ setCurrentPageNumber(currentPageNumber + 1);
2029
+ onChangePage({ totalItem, pageSize, currentPage: currentPageNumber * 5 + 1, old: currentPage });
2030
+ },
2031
+ children: "..."
2032
+ }
2033
+ ),
2034
+ /* @__PURE__ */ jsx11("button", { className: "r-button", type: "button", disabled: countPage <= 1 || countPage === currentPage, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage + 1, old: currentPage }), children: /* @__PURE__ */ jsx11(ChevronRight2, { fontSize: 16 }) }),
2035
+ /* @__PURE__ */ jsx11("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__ */ jsx11(ChevronsRight, { fontSize: 16 }) }),
2036
+ /* @__PURE__ */ jsx11("div", { className: "r-pagesize", children: /* @__PURE__ */ jsx11(
2037
+ SelectTable,
2038
+ {
2039
+ value: { value: pageSize, label: pageSize },
2040
+ noHeader: true,
2041
+ options: pageOptions.map((item) => ({ value: item, label: item })),
2042
+ onChange: (val) => {
2043
+ onChangePageSize({ totalItem, pageSize: val?.value });
2044
+ },
2045
+ placeholder: t("Select")
2046
+ }
2047
+ ) }),
2048
+ /* @__PURE__ */ jsx11("span", { style: { display: "inline", marginLeft: 10, fontSize: 13 }, children: t("pagerDropDown") })
2049
+ ] }),
2050
+ /* @__PURE__ */ jsx11("div", { className: "r-parentmsgbar", children: t("totalItemsInfo", { page: currentPage, countPage, totalItem }) })
2051
+ ] }) });
2052
+ };
2113
2053
 
2114
2054
  // test-app/src/component/table/header.tsx
2115
2055
  import { Fragment as Fragment14 } from "react";
2116
- import classnames7 from "classnames";
2056
+ import classnames6 from "classnames";
2117
2057
  import { Input as Input7 } from "reactstrap";
2118
- import { useTranslation as useTranslation10 } from "react-i18next";
2058
+ import { useTranslation as useTranslation9 } from "react-i18next";
2119
2059
  import { Resizable } from "react-resizable";
2120
2060
  import "react-resizable/css/styles.css";
2121
- import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
2061
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
2122
2062
  var HeaderTableCol = (props) => {
2123
2063
  const {
2124
2064
  selectEnable,
@@ -2134,7 +2074,7 @@ var HeaderTableCol = (props) => {
2134
2074
  setColumn,
2135
2075
  isMulti
2136
2076
  } = props;
2137
- const { t } = useTranslation10();
2077
+ const { t } = useTranslation9();
2138
2078
  const handleResize = (e, { size }) => {
2139
2079
  if (size.width > 50) {
2140
2080
  const newColumns = [...column];
@@ -2142,7 +2082,7 @@ var HeaderTableCol = (props) => {
2142
2082
  setColumn(newColumns);
2143
2083
  }
2144
2084
  };
2145
- return /* @__PURE__ */ jsx13(Fragment14, { children: col.visible !== false && /* @__PURE__ */ jsx13(
2085
+ return /* @__PURE__ */ jsx12(Fragment14, { children: col.visible !== false && /* @__PURE__ */ jsx12(
2146
2086
  Resizable,
2147
2087
  {
2148
2088
  className: "r-resize",
@@ -2150,12 +2090,12 @@ var HeaderTableCol = (props) => {
2150
2090
  height: 0,
2151
2091
  onResize: handleResize,
2152
2092
  draggableOpts: { enableUserSelectHack: false },
2153
- children: /* @__PURE__ */ jsx13(
2093
+ children: /* @__PURE__ */ jsx12(
2154
2094
  "th",
2155
2095
  {
2156
2096
  rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
2157
2097
  colSpan: col.columns?.length ?? 1,
2158
- className: classnames7(`r-headercell fix-${col.fixedType}`, { "cell-fixed": col.fixedType }),
2098
+ className: classnames6(`r-headercell fix-${col.fixedType}`, { "cell-fixed": col.fixedType }),
2159
2099
  style: {
2160
2100
  top: `${indexParent * 42}px`,
2161
2101
  left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
@@ -2164,18 +2104,18 @@ var HeaderTableCol = (props) => {
2164
2104
  minWidth: col.width ? typeof col.width === "number" ? col.width : col.width?.includes("px") || col.width?.includes("%") ? col.width : `${col.width}px` : "auto",
2165
2105
  maxWidth: col.width ? typeof col.width === "number" ? col.width : col.width?.includes("px") || col.width?.includes("%") ? col.width : `${col.width}px` : "auto"
2166
2106
  },
2167
- children: /* @__PURE__ */ jsxs13(
2107
+ children: /* @__PURE__ */ jsxs12(
2168
2108
  "div",
2169
2109
  {
2170
2110
  style: { justifyContent: col.textAlign ?? "left" },
2171
- className: classnames7("r-headercell-div"),
2111
+ className: classnames6("r-headercell-div"),
2172
2112
  children: [
2173
- col.field === "checkbox" && /* @__PURE__ */ jsx13(
2113
+ col.field === "checkbox" && /* @__PURE__ */ jsx12(
2174
2114
  Input7,
2175
2115
  {
2176
2116
  checked: totalCount > 0 && selectedRows?.length >= totalCount,
2177
2117
  type: "checkbox",
2178
- className: classnames7("cursor-pointer", { "d-none": !isMulti }),
2118
+ className: classnames6("cursor-pointer", { "d-none": !isMulti }),
2179
2119
  style: { textAlign: col.textAlign ?? "left", marginTop: 6 },
2180
2120
  onChange: (e) => {
2181
2121
  if (selectEnable) {
@@ -2203,38 +2143,38 @@ var header_default = HeaderTableCol;
2203
2143
 
2204
2144
  // test-app/src/component/table/command.tsx
2205
2145
  import { Fragment as Fragment16 } from "react";
2206
- import classnames8 from "classnames";
2207
- import { Button as Button4, UncontrolledTooltip as UncontrolledTooltip2 } from "reactstrap";
2208
- import { useTranslation as useTranslation11 } from "react-i18next";
2146
+ import classnames7 from "classnames";
2147
+ import { Button as Button4, UncontrolledTooltip as UncontrolledTooltip3 } from "reactstrap";
2148
+ import { useTranslation as useTranslation10 } from "react-i18next";
2209
2149
 
2210
2150
  // test-app/src/component/icon/index.tsx
2211
2151
  import * as Icon from "becoxy-icons";
2212
2152
  import { Fragment as Fragment15 } from "react";
2213
- import { jsx as jsx14 } from "react/jsx-runtime";
2153
+ import { jsx as jsx13 } from "react/jsx-runtime";
2214
2154
  var IconCustom = (props) => {
2215
2155
  const { iconName, size } = props;
2216
2156
  if (iconName === "") {
2217
2157
  return null;
2218
2158
  } else {
2219
2159
  const TagIcon = iconName === "" ? "" : Icon[iconName];
2220
- return /* @__PURE__ */ jsx14(Fragment15, { children: iconName === "" ? "" : /* @__PURE__ */ jsx14(TagIcon, { fontSize: size }) });
2160
+ return /* @__PURE__ */ jsx13(Fragment15, { children: iconName === "" ? "" : /* @__PURE__ */ jsx13(TagIcon, { fontSize: size }) });
2221
2161
  }
2222
2162
  };
2223
2163
  var icon_default = IconCustom;
2224
2164
 
2225
2165
  // test-app/src/component/table/command.tsx
2226
- import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
2166
+ import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
2227
2167
  var CommandElement = (props) => {
2228
2168
  const { commandItems, rowData, indexRow, handleCommandClick, indexFocus, setIndexFocus } = props;
2229
- const { t } = useTranslation11();
2230
- return /* @__PURE__ */ jsx15(Fragment16, { children: /* @__PURE__ */ jsx15("div", { className: "d-flex align-items-center", style: { columnGap: 10 }, children: commandItems.map((item, index) => {
2231
- return /* @__PURE__ */ jsxs14(
2169
+ const { t } = useTranslation10();
2170
+ return /* @__PURE__ */ jsx14(Fragment16, { children: /* @__PURE__ */ jsx14("div", { className: "d-flex align-items-center", style: { columnGap: 10 }, children: commandItems.map((item, index) => {
2171
+ return /* @__PURE__ */ jsxs13(
2232
2172
  Button4,
2233
2173
  {
2234
2174
  id: `command-item-${indexRow}-${index}`,
2235
2175
  tabIndex: -1,
2236
2176
  style: { padding: "5px", minWidth: 45, height: "100%" },
2237
- className: classnames8("command-item", {
2177
+ className: classnames7("command-item", {
2238
2178
  "btn-icon": item.tooltip === ""
2239
2179
  }),
2240
2180
  color: item.color ? item.color : "#000",
@@ -2246,8 +2186,8 @@ var CommandElement = (props) => {
2246
2186
  e.preventDefault();
2247
2187
  },
2248
2188
  children: [
2249
- item.icon && /* @__PURE__ */ jsx15(icon_default, { iconName: item.icon, size: 16 }),
2250
- /* @__PURE__ */ jsx15(UncontrolledTooltip2, { className: "r-tooltip", target: `command-item-${indexRow}-${index}`, place: "top", children: t(item.tooltip ?? "") })
2189
+ item.icon && /* @__PURE__ */ jsx14(icon_default, { iconName: item.icon, size: 16 }),
2190
+ /* @__PURE__ */ jsx14(UncontrolledTooltip3, { className: "r-tooltip", target: `command-item-${indexRow}-${index}`, place: "top", children: t(item.tooltip ?? "") })
2251
2191
  ]
2252
2192
  },
2253
2193
  `command-${index}`
@@ -2257,9 +2197,9 @@ var CommandElement = (props) => {
2257
2197
  var command_default = CommandElement;
2258
2198
 
2259
2199
  // test-app/src/component/table/index.tsx
2260
- import { Fragment as Fragment18, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
2200
+ import { Fragment as Fragment18, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
2261
2201
  var TableEdit = forwardRef3((props, ref) => {
2262
- const { t } = useTranslation12();
2202
+ const { t } = useTranslation11();
2263
2203
  const {
2264
2204
  idTable,
2265
2205
  dataSource,
@@ -2481,7 +2421,7 @@ var TableEdit = forwardRef3((props, ref) => {
2481
2421
  }
2482
2422
  };
2483
2423
  const searchTemplate = () => {
2484
- return /* @__PURE__ */ jsx16(Fragment17, { children: /* @__PURE__ */ jsx16("div", { className: "me-50 r-search", children: /* @__PURE__ */ jsx16(
2424
+ return /* @__PURE__ */ jsx15(Fragment17, { children: /* @__PURE__ */ jsx15("div", { className: "me-50 r-search", children: /* @__PURE__ */ jsx15(
2485
2425
  react_input_default,
2486
2426
  {
2487
2427
  style: { width: "230px" },
@@ -2502,7 +2442,7 @@ var TableEdit = forwardRef3((props, ref) => {
2502
2442
  const renderEdit = (row, col, indexRow, indexCol) => {
2503
2443
  switch (col?.editTypeCondition ? col?.editTypeCondition(row) : col.editType) {
2504
2444
  case "date":
2505
- return /* @__PURE__ */ jsx16(
2445
+ return /* @__PURE__ */ jsx15(
2506
2446
  Input8,
2507
2447
  {
2508
2448
  id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
@@ -2515,7 +2455,7 @@ var TableEdit = forwardRef3((props, ref) => {
2515
2455
  }
2516
2456
  handleDataChange(row, col, indexRow);
2517
2457
  },
2518
- className: classnames9("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
2458
+ className: classnames8("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
2519
2459
  type: "date",
2520
2460
  max: "9999-12-31",
2521
2461
  onKeyDown: (e) => {
@@ -2531,7 +2471,7 @@ var TableEdit = forwardRef3((props, ref) => {
2531
2471
  }
2532
2472
  );
2533
2473
  case "datetime":
2534
- return /* @__PURE__ */ jsx16(
2474
+ return /* @__PURE__ */ jsx15(
2535
2475
  Input8,
2536
2476
  {
2537
2477
  id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
@@ -2544,7 +2484,7 @@ var TableEdit = forwardRef3((props, ref) => {
2544
2484
  }
2545
2485
  handleDataChange(row, col, indexRow);
2546
2486
  },
2547
- className: classnames9("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
2487
+ className: classnames8("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
2548
2488
  type: "datetime-local",
2549
2489
  max: "9999-12-31T23:59",
2550
2490
  onKeyDown: (e) => {
@@ -2572,7 +2512,7 @@ var TableEdit = forwardRef3((props, ref) => {
2572
2512
  } else {
2573
2513
  valueSelect = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? optionsSelect?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
2574
2514
  }
2575
- return /* @__PURE__ */ jsx16(
2515
+ return /* @__PURE__ */ jsx15(
2576
2516
  SelectTable,
2577
2517
  {
2578
2518
  id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
@@ -2629,14 +2569,14 @@ var TableEdit = forwardRef3((props, ref) => {
2629
2569
  }
2630
2570
  }
2631
2571
  };
2632
- return /* @__PURE__ */ jsx16(
2572
+ return /* @__PURE__ */ jsx15(
2633
2573
  "div",
2634
2574
  {
2635
2575
  onKeyDown: (e) => {
2636
2576
  if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
2637
2577
  }
2638
2578
  },
2639
- children: /* @__PURE__ */ jsx16(
2579
+ children: /* @__PURE__ */ jsx15(
2640
2580
  DropDownTreeComponent,
2641
2581
  {
2642
2582
  id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
@@ -2647,7 +2587,7 @@ var TableEdit = forwardRef3((props, ref) => {
2647
2587
  parentValue: "parentId",
2648
2588
  child: "children"
2649
2589
  },
2650
- className: classnames9("select-tree", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
2590
+ className: classnames8("select-tree", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
2651
2591
  allowFiltering: false,
2652
2592
  value: valueSelectTree,
2653
2593
  popupHeight: 250,
@@ -2675,7 +2615,7 @@ var TableEdit = forwardRef3((props, ref) => {
2675
2615
  }
2676
2616
  );
2677
2617
  case "checkbox":
2678
- return /* @__PURE__ */ jsx16(
2618
+ return /* @__PURE__ */ jsx15(
2679
2619
  Input8,
2680
2620
  {
2681
2621
  checked: row[col.field],
@@ -2698,13 +2638,13 @@ var TableEdit = forwardRef3((props, ref) => {
2698
2638
  );
2699
2639
  case "numeric":
2700
2640
  let valueCurrency = row[col.field];
2701
- return /* @__PURE__ */ jsx16(
2641
+ return /* @__PURE__ */ jsx15(
2702
2642
  Input8,
2703
2643
  {
2704
2644
  id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
2705
2645
  style: { textAlign: col.textAlign, height: 29 },
2706
2646
  defaultValue: formartNumberic(valueCurrency, decimalSeparator, thousandSeparator, col.numericSettings?.fraction),
2707
- className: classnames9("border-0 rounded-0 input-numeric", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
2647
+ className: classnames8("border-0 rounded-0 input-numeric", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
2708
2648
  onChange: (val) => {
2709
2649
  let newVal = "";
2710
2650
  const flag = val.target?.value.startsWith("-");
@@ -2788,7 +2728,7 @@ var TableEdit = forwardRef3((props, ref) => {
2788
2728
  }
2789
2729
  );
2790
2730
  case "color":
2791
- return /* @__PURE__ */ jsx16("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ jsx16(
2731
+ return /* @__PURE__ */ jsx15("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ jsx15(
2792
2732
  Input8,
2793
2733
  {
2794
2734
  type: "color",
@@ -2811,7 +2751,7 @@ var TableEdit = forwardRef3((props, ref) => {
2811
2751
  `col-${indexRow}-${indexCol}`
2812
2752
  ) });
2813
2753
  case "form":
2814
- return /* @__PURE__ */ jsx16(
2754
+ return /* @__PURE__ */ jsx15(
2815
2755
  edit_form_default,
2816
2756
  {
2817
2757
  id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
@@ -2839,13 +2779,13 @@ var TableEdit = forwardRef3((props, ref) => {
2839
2779
  }
2840
2780
  );
2841
2781
  default:
2842
- return /* @__PURE__ */ jsx16(
2782
+ return /* @__PURE__ */ jsx15(
2843
2783
  Input8,
2844
2784
  {
2845
2785
  id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
2846
2786
  style: { textAlign: col.textAlign, height: 29 },
2847
2787
  defaultValue: isNullOrUndefined(row[col.field]) ? "" : row[col.field],
2848
- className: classnames9("border-0 rounded-0 input-element", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
2788
+ className: classnames8("border-0 rounded-0 input-element", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
2849
2789
  onBlur: (val) => {
2850
2790
  if (row[col.field] != val.target?.value) {
2851
2791
  row[col.field] = val.target?.value;
@@ -3272,10 +3212,10 @@ var TableEdit = forwardRef3((props, ref) => {
3272
3212
  }, [selectedItem]);
3273
3213
  const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
3274
3214
  if (col.field === "command") {
3275
- return col.visible !== false && /* @__PURE__ */ jsx16(
3215
+ return col.visible !== false && /* @__PURE__ */ jsx15(
3276
3216
  "td",
3277
3217
  {
3278
- className: classnames9(
3218
+ className: classnames8(
3279
3219
  `r-rowcell p-0 fix-${col.fixedType}`,
3280
3220
  { "cell-fixed": col.fixedType },
3281
3221
  { "r-active": isSelected && editDisable || indexFocus === indexRow }
@@ -3285,15 +3225,15 @@ var TableEdit = forwardRef3((props, ref) => {
3285
3225
  right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
3286
3226
  textAlign: col.textAlign ? col.textAlign : "left"
3287
3227
  },
3288
- children: /* @__PURE__ */ jsx16("div", { className: "r-rowcell-div ", children: /* @__PURE__ */ jsx16(command_default, { commandItems: col.commandItems ?? [], handleCommandClick, indexRow, rowData: row, setIndexFocus, indexFocus }) })
3228
+ children: /* @__PURE__ */ jsx15("div", { className: "r-rowcell-div ", children: /* @__PURE__ */ jsx15(command_default, { commandItems: col.commandItems ?? [], handleCommandClick, indexRow, rowData: row, setIndexFocus, indexFocus }) })
3289
3229
  },
3290
3230
  `col-${indexRow}-${indexCol}`
3291
3231
  );
3292
3232
  } else if (col.field === "#") {
3293
- return col.visible !== false && /* @__PURE__ */ jsx16(
3233
+ return col.visible !== false && /* @__PURE__ */ jsx15(
3294
3234
  "td",
3295
3235
  {
3296
- className: classnames9(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "r-active": isSelected && editDisable || indexFocus === indexRow }),
3236
+ className: classnames8(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "r-active": isSelected && editDisable || indexFocus === indexRow }),
3297
3237
  tabIndex: Number(`${indexRow}${indexCol}`),
3298
3238
  style: {
3299
3239
  left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
@@ -3337,15 +3277,15 @@ var TableEdit = forwardRef3((props, ref) => {
3337
3277
  e.stopPropagation();
3338
3278
  }
3339
3279
  },
3340
- children: /* @__PURE__ */ jsx16("div", { className: "r-rowcell-div pt-50", children: indexRow + 1 })
3280
+ children: /* @__PURE__ */ jsx15("div", { className: "r-rowcell-div pt-50", children: indexRow + 1 })
3341
3281
  },
3342
3282
  `col-${indexRow}-${indexCol}`
3343
3283
  );
3344
3284
  } else if (col.field === "checkbox") {
3345
- return /* @__PURE__ */ jsx16(
3285
+ return /* @__PURE__ */ jsx15(
3346
3286
  "td",
3347
3287
  {
3348
- className: classnames9(
3288
+ className: classnames8(
3349
3289
  `r-rowcell p-0 fix-${col.fixedType}`,
3350
3290
  { "cell-fixed": col.fixedType },
3351
3291
  { "r-active": isSelected && editDisable || indexFocus === indexRow }
@@ -3355,7 +3295,7 @@ var TableEdit = forwardRef3((props, ref) => {
3355
3295
  right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
3356
3296
  textAlign: col.textAlign ? col.textAlign : "center"
3357
3297
  },
3358
- children: /* @__PURE__ */ jsx16(
3298
+ children: /* @__PURE__ */ jsx15(
3359
3299
  "div",
3360
3300
  {
3361
3301
  className: "r-rowcell-div cursor-pointer",
@@ -3379,7 +3319,7 @@ var TableEdit = forwardRef3((props, ref) => {
3379
3319
  e.stopPropagation();
3380
3320
  }
3381
3321
  },
3382
- children: /* @__PURE__ */ jsx16(
3322
+ children: /* @__PURE__ */ jsx15(
3383
3323
  Input8,
3384
3324
  {
3385
3325
  checked: isSelected,
@@ -3406,10 +3346,10 @@ var TableEdit = forwardRef3((props, ref) => {
3406
3346
  }
3407
3347
  const typeDis = !editDisable && (indexFocus === indexRow || col.editType === "checkbox") && (!col.disabledCondition || !col.disabledCondition(row)) ? col.editEnable ? 1 : col.template ? 2 : 3 : col.template ? 2 : 3;
3408
3348
  const errorMessage = typeDis === 1 || col.field === "" || !col.validate ? "" : col.validate(row[col.field], row);
3409
- return /* @__PURE__ */ jsx16(Fragment17, { children: col.visible !== false && /* @__PURE__ */ jsx16(
3349
+ return /* @__PURE__ */ jsx15(Fragment17, { children: col.visible !== false && /* @__PURE__ */ jsx15(
3410
3350
  "td",
3411
3351
  {
3412
- className: classnames9(
3352
+ className: classnames8(
3413
3353
  `r-rowcell fix-${col.fixedType}`,
3414
3354
  { "cell-fixed": col.fixedType },
3415
3355
  { "r-active": isSelected && editDisable || indexFocus === indexRow }
@@ -3451,25 +3391,25 @@ var TableEdit = forwardRef3((props, ref) => {
3451
3391
  e.stopPropagation();
3452
3392
  }
3453
3393
  },
3454
- children: /* @__PURE__ */ jsx16(
3394
+ children: /* @__PURE__ */ jsx15(
3455
3395
  "div",
3456
3396
  {
3457
- className: classnames9("r-rowcell-div"),
3458
- children: /* @__PURE__ */ jsxs15(
3397
+ className: classnames8("r-rowcell-div"),
3398
+ children: /* @__PURE__ */ jsxs14(
3459
3399
  "div",
3460
3400
  {
3461
3401
  id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
3462
- className: classnames9("r-rowcell-content", { "r-is-invalid": errorMessage }),
3402
+ className: classnames8("r-rowcell-content", { "r-is-invalid": errorMessage }),
3463
3403
  style: {
3464
3404
  margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2,
3465
3405
  color: col.editType === "numeric" && Number(row[col.field]) < 0 ? "red" : ""
3466
3406
  },
3467
3407
  children: [
3468
- typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */ jsx16("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }),
3469
- /* @__PURE__ */ jsx16("span", { id: `error-${indexRow}-${indexCol}`, className: classnames9("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ jsx16(AlertCircle, { fontSize: 15.5 }) }),
3470
- !(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx16(UncontrolledTooltip3, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : value }),
3471
- /* @__PURE__ */ jsx16(
3472
- UncontrolledTooltip3,
3408
+ typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */ jsx15("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }),
3409
+ /* @__PURE__ */ jsx15("span", { id: `error-${indexRow}-${indexCol}`, className: classnames8("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ jsx15(AlertCircle, { fontSize: 15.5 }) }),
3410
+ !(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx15(UncontrolledTooltip4, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : value }),
3411
+ /* @__PURE__ */ jsx15(
3412
+ UncontrolledTooltip4,
3473
3413
  {
3474
3414
  target: `error-${indexRow}-${indexCol}`,
3475
3415
  className: "r-tooltip tooltip-error",
@@ -3491,10 +3431,10 @@ var TableEdit = forwardRef3((props, ref) => {
3491
3431
  return element && element.scrollWidth > element.clientWidth;
3492
3432
  };
3493
3433
  const renderFooterCol = (col, indexCol) => {
3494
- return /* @__PURE__ */ jsx16(Fragment17, { children: col.visible !== false && /* @__PURE__ */ jsx16(
3434
+ return /* @__PURE__ */ jsx15(Fragment17, { children: col.visible !== false && /* @__PURE__ */ jsx15(
3495
3435
  "td",
3496
3436
  {
3497
- className: classnames9(
3437
+ className: classnames8(
3498
3438
  `p-0 px-50 r-footer fix-${col.fixedType}`,
3499
3439
  { "cell-fixed": col.fixedType }
3500
3440
  ),
@@ -3503,56 +3443,56 @@ var TableEdit = forwardRef3((props, ref) => {
3503
3443
  right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
3504
3444
  textAlign: col.textAlign ? col.textAlign : "left"
3505
3445
  },
3506
- children: /* @__PURE__ */ jsx16("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource.reduce(function(accumulator, currentValue) {
3446
+ children: /* @__PURE__ */ jsx15("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource.reduce(function(accumulator, currentValue) {
3507
3447
  return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
3508
3448
  }, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
3509
3449
  }
3510
3450
  ) }, `summarycell-${indexCol}`);
3511
3451
  };
3512
3452
  const renderToolbarTop = () => {
3513
- 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: [
3514
- /* @__PURE__ */ jsx16("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
3515
- return item.align === "left" ? /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) : "";
3453
+ return /* @__PURE__ */ jsx15("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: /* @__PURE__ */ jsxs14("div", { className: "r-toolbar-items", children: [
3454
+ /* @__PURE__ */ jsx15("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
3455
+ return item.align === "left" ? /* @__PURE__ */ jsx15("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) : "";
3516
3456
  }) }),
3517
- /* @__PURE__ */ jsx16("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
3518
- return item.align === "center" ? /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) : "";
3457
+ /* @__PURE__ */ jsx15("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
3458
+ return item.align === "center" ? /* @__PURE__ */ jsx15("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) : "";
3519
3459
  }) }),
3520
- /* @__PURE__ */ jsx16("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
3521
- return item.align === "right" ? /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) : "";
3460
+ /* @__PURE__ */ jsx15("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
3461
+ return item.align === "right" ? /* @__PURE__ */ jsx15("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) : "";
3522
3462
  }) })
3523
3463
  ] }) });
3524
3464
  };
3525
3465
  const renderToolbarBottom = () => {
3526
- return /* @__PURE__ */ jsx16("div", { id: "table_custom_bottom_toolbar", className: "r-toolbar r-toolbar-bottom", role: "toolbar", "aria-disabled": "false", "aria-haspopup": "false", "aria-orientation": "horizontal", children: /* @__PURE__ */ jsxs15("div", { className: "r-toolbar-items", children: [
3527
- /* @__PURE__ */ jsxs15("div", { className: "r-toolbar-left", children: [
3528
- /* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx16(Button5, { color: "success", outline: true, onClick: handleAdd, className: "d-flex", children: t("Add item") }) }),
3529
- (indexFocus ?? -1) > -1 ? /* @__PURE__ */ jsxs15(Fragment18, { children: [
3530
- /* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx16(Button5, { color: "success", outline: true, onClick: () => {
3466
+ return /* @__PURE__ */ jsx15("div", { id: "table_custom_bottom_toolbar", className: "r-toolbar r-toolbar-bottom", role: "toolbar", "aria-disabled": "false", "aria-haspopup": "false", "aria-orientation": "horizontal", children: /* @__PURE__ */ jsxs14("div", { className: "r-toolbar-items", children: [
3467
+ /* @__PURE__ */ jsxs14("div", { className: "r-toolbar-left", children: [
3468
+ /* @__PURE__ */ jsx15("div", { className: classnames8("r-toolbar-item", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx15(Button5, { color: "success", outline: true, onClick: handleAdd, className: "d-flex", children: t("Add item") }) }),
3469
+ (indexFocus ?? -1) > -1 ? /* @__PURE__ */ jsxs14(Fragment18, { children: [
3470
+ /* @__PURE__ */ jsx15("div", { className: classnames8("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx15(Button5, { color: "success", outline: true, onClick: () => {
3531
3471
  handleDuplicate(dataSource[indexFocus ?? -1], indexFocus ?? -1);
3532
3472
  }, className: "d-flex", children: t("Duplicate") }) }),
3533
- /* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx16(Button5, { color: "success", outline: true, onClick: handleInsertBefore, className: "d-flex", children: t("Insert item before") }) }),
3534
- /* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx16(Button5, { color: "success", outline: true, onClick: handleInsertAfter, className: "d-flex", children: t("Insert item after") }) })
3535
- ] }) : /* @__PURE__ */ jsx16(Fragment18, { children: " " }),
3536
- /* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item", { "d-none": editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx16(Button5, { color: "primary", outline: true, onClick: handleDeleteAll, className: "d-flex", children: t("Delete all item") }) }),
3473
+ /* @__PURE__ */ jsx15("div", { className: classnames8("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx15(Button5, { color: "success", outline: true, onClick: handleInsertBefore, className: "d-flex", children: t("Insert item before") }) }),
3474
+ /* @__PURE__ */ jsx15("div", { className: classnames8("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx15(Button5, { color: "success", outline: true, onClick: handleInsertAfter, className: "d-flex", children: t("Insert item after") }) })
3475
+ ] }) : /* @__PURE__ */ jsx15(Fragment18, { children: " " }),
3476
+ /* @__PURE__ */ jsx15("div", { className: classnames8("r-toolbar-item", { "d-none": editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx15(Button5, { color: "primary", outline: true, onClick: handleDeleteAll, className: "d-flex", children: t("Delete all item") }) }),
3537
3477
  toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
3538
- return item.align === "left" ? /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : "";
3478
+ return item.align === "left" ? /* @__PURE__ */ jsx15("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : "";
3539
3479
  })
3540
3480
  ] }),
3541
- /* @__PURE__ */ jsx16("div", { className: "r-toolbar-center", children: toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
3542
- return item.align === "center" ? /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : "";
3481
+ /* @__PURE__ */ jsx15("div", { className: "r-toolbar-center", children: toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
3482
+ return item.align === "center" ? /* @__PURE__ */ jsx15("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : "";
3543
3483
  }) }),
3544
- /* @__PURE__ */ jsxs15("div", { className: "r-toolbar-right", children: [
3484
+ /* @__PURE__ */ jsxs14("div", { className: "r-toolbar-right", children: [
3545
3485
  toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
3546
- return item.align === "right" ? /* @__PURE__ */ jsx16("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : "";
3486
+ return item.align === "right" ? /* @__PURE__ */ jsx15("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : "";
3547
3487
  }),
3548
- /* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item me-25", { "d-none": headerColumns.length > 1 }), "aria-disabled": "false", children: /* @__PURE__ */ jsx16(Settings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }),
3549
- /* @__PURE__ */ jsx16("div", { className: classnames9("r-toolbar-item me-25", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsxs15(UncontrolledDropdown, { className: "dropdown-user nav-item", children: [
3550
- /* @__PURE__ */ jsx16(DropdownToggle3, { href: "/", tag: "a", color: "info", onClick: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx16(Info2, { className: "cursor-pointer" }) }),
3551
- /* @__PURE__ */ jsx16(DropdownMenu3, { children: /* @__PURE__ */ jsxs15("div", { className: "d-flex flex-column p-50 py-25", children: [
3552
- /* @__PURE__ */ jsx16("div", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\xE0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\xE0ng v\xE0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\xE2n b\u1EA3n" }),
3553
- /* @__PURE__ */ jsx16("div", { style: { fontSize: 13 }, children: "Ch\u1ECDn \xF4 v\xE0 Ctrl + V \u0111\u1EC3 d\xE1n th\xF4ng tin t\u1EEB excel" }),
3554
- /* @__PURE__ */ jsx16("div", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\xE0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\xE0ng v\xE0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\xE9p h\xE0ng" }),
3555
- /* @__PURE__ */ jsx16("div", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\xE0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\xE0ng v\xE0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\xE1n h\xE0ng" })
3488
+ /* @__PURE__ */ jsx15("div", { className: classnames8("r-toolbar-item me-25", { "d-none": headerColumns.length > 1 }), "aria-disabled": "false", children: /* @__PURE__ */ jsx15(Settings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }),
3489
+ /* @__PURE__ */ jsx15("div", { className: classnames8("r-toolbar-item me-25", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsxs14(UncontrolledDropdown, { className: "dropdown-user nav-item", children: [
3490
+ /* @__PURE__ */ jsx15(DropdownToggle3, { href: "/", tag: "a", color: "info", onClick: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx15(Info2, { className: "cursor-pointer" }) }),
3491
+ /* @__PURE__ */ jsx15(DropdownMenu3, { children: /* @__PURE__ */ jsxs14("div", { className: "d-flex flex-column p-50 py-25", children: [
3492
+ /* @__PURE__ */ jsx15("div", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\xE0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\xE0ng v\xE0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\xE2n b\u1EA3n" }),
3493
+ /* @__PURE__ */ jsx15("div", { style: { fontSize: 13 }, children: "Ch\u1ECDn \xF4 v\xE0 Ctrl + V \u0111\u1EC3 d\xE1n th\xF4ng tin t\u1EEB excel" }),
3494
+ /* @__PURE__ */ jsx15("div", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\xE0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\xE0ng v\xE0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\xE9p h\xE0ng" }),
3495
+ /* @__PURE__ */ jsx15("div", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\xE0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\xE0ng v\xE0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\xE1n h\xE0ng" })
3556
3496
  ] }) })
3557
3497
  ] }) })
3558
3498
  ] })
@@ -3581,10 +3521,10 @@ var TableEdit = forwardRef3((props, ref) => {
3581
3521
  const flagDisplay = !pagingClient || totalCount > (pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0) - 1) && totalCount <= (pagingSetting.pageSize ?? 0) * (pagingSetting.currentPage ?? 0);
3582
3522
  if (flagDisplay) {
3583
3523
  countDisplay++;
3584
- return /* @__PURE__ */ jsx16(
3524
+ return /* @__PURE__ */ jsx15(
3585
3525
  "tr",
3586
3526
  {
3587
- className: classnames9("r-row", { "fisrt-row": countDisplay === 0 }),
3527
+ className: classnames8("r-row", { "fisrt-row": countDisplay === 0 }),
3588
3528
  children: contentColumns.map((col, indexCol) => {
3589
3529
  return renderContentCol(col, row, indexRow, indexCol, isSelected);
3590
3530
  })
@@ -3600,14 +3540,14 @@ var TableEdit = forwardRef3((props, ref) => {
3600
3540
  pagingSetting?.setCurrentPage(1);
3601
3541
  }
3602
3542
  }, [searchTerm, searchSetting?.searchTerm]);
3603
- return /* @__PURE__ */ jsxs15(Fragment17, { children: [
3604
- /* @__PURE__ */ jsxs15("div", { className: "react-table-edit", children: [
3605
- /* @__PURE__ */ jsxs15("div", { className: "r-grid", ref: gridRef, children: [
3606
- toolbarSetting?.showTopToolbar ? /* @__PURE__ */ jsx16(Fragment18, { children: renderToolbarTop() }) : /* @__PURE__ */ jsx16(Fragment18, {}),
3607
- /* @__PURE__ */ jsx16("div", { ref: tableElement, className: "r-gridtable", style: { height: `${height ? `${height}px` : "auto"}`, minHeight: `${minHeight ? `${minHeight}px` : ""}`, maxHeight: `${maxHeight ? `${maxHeight}px` : "400px"}` }, children: /* @__PURE__ */ jsxs15("table", { style: { width: "100%" }, children: [
3608
- /* @__PURE__ */ jsx16("thead", { className: "r-gridheader", children: headerColumns.map((element, indexParent) => {
3609
- return /* @__PURE__ */ jsx16("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
3610
- return /* @__PURE__ */ jsx16(
3543
+ return /* @__PURE__ */ jsxs14(Fragment17, { children: [
3544
+ /* @__PURE__ */ jsxs14("div", { className: "react-table-edit", children: [
3545
+ /* @__PURE__ */ jsxs14("div", { className: "r-grid", ref: gridRef, children: [
3546
+ toolbarSetting?.showTopToolbar ? /* @__PURE__ */ jsx15(Fragment18, { children: renderToolbarTop() }) : /* @__PURE__ */ jsx15(Fragment18, {}),
3547
+ /* @__PURE__ */ jsx15("div", { ref: tableElement, className: "r-gridtable", style: { height: `${height ? `${height}px` : "auto"}`, minHeight: `${minHeight ? `${minHeight}px` : ""}`, maxHeight: `${maxHeight ? `${maxHeight}px` : "400px"}` }, children: /* @__PURE__ */ jsxs14("table", { style: { width: "100%" }, children: [
3548
+ /* @__PURE__ */ jsx15("thead", { className: "r-gridheader", children: headerColumns.map((element, indexParent) => {
3549
+ return /* @__PURE__ */ jsx15("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
3550
+ return /* @__PURE__ */ jsx15(
3611
3551
  header_default,
3612
3552
  {
3613
3553
  col,
@@ -3627,14 +3567,14 @@ var TableEdit = forwardRef3((props, ref) => {
3627
3567
  );
3628
3568
  }) }, `header-${-indexParent}`);
3629
3569
  }) }),
3630
- /* @__PURE__ */ jsx16("tbody", { className: "r-gridcontent", children: renderData() }),
3631
- /* @__PURE__ */ jsx16("tfoot", { className: "r-gridfoot", children: haveSum == true ? /* @__PURE__ */ jsx16("tr", { className: "r-row", children: contentColumns.map((col, index) => {
3570
+ /* @__PURE__ */ jsx15("tbody", { className: "r-gridcontent", children: renderData() }),
3571
+ /* @__PURE__ */ jsx15("tfoot", { className: "r-gridfoot", children: haveSum == true ? /* @__PURE__ */ jsx15("tr", { className: "r-row", children: contentColumns.map((col, index) => {
3632
3572
  return renderFooterCol(col, index);
3633
- }) }) : /* @__PURE__ */ jsx16(Fragment18, {}) })
3573
+ }) }) : /* @__PURE__ */ jsx15(Fragment18, {}) })
3634
3574
  ] }) }),
3635
- toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ jsx16(Fragment18, { children: renderToolbarBottom() }) : /* @__PURE__ */ jsx16(Fragment18, {})
3575
+ toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ jsx15(Fragment18, { children: renderToolbarBottom() }) : /* @__PURE__ */ jsx15(Fragment18, {})
3636
3576
  ] }),
3637
- pagingSetting?.allowPaging ? /* @__PURE__ */ jsx16(
3577
+ pagingSetting?.allowPaging ? /* @__PURE__ */ jsx15(
3638
3578
  PagingComponent,
3639
3579
  {
3640
3580
  onChangePage,
@@ -3644,9 +3584,9 @@ var TableEdit = forwardRef3((props, ref) => {
3644
3584
  totalItem: pagingClient ? totalCount : pagingSetting?.totalItem ?? 0,
3645
3585
  onChangePageSize
3646
3586
  }
3647
- ) : /* @__PURE__ */ jsx16(Fragment18, {})
3587
+ ) : /* @__PURE__ */ jsx15(Fragment18, {})
3648
3588
  ] }),
3649
- /* @__PURE__ */ jsx16(
3589
+ /* @__PURE__ */ jsx15(
3650
3590
  sidebar_setting_column_default,
3651
3591
  {
3652
3592
  handleSidebar: () => {
@@ -3667,7 +3607,7 @@ import classNames6 from "classnames";
3667
3607
  import { Fragment as Fragment19, useEffect as useEffect9, useState as useState8 } from "react";
3668
3608
  import { Link, useNavigate } from "react-router-dom";
3669
3609
  import { DropdownItem as DropdownItem3, DropdownMenu as DropdownMenu4, DropdownToggle as DropdownToggle4, UncontrolledDropdown as UncontrolledDropdown2 } from "reactstrap";
3670
- import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
3610
+ import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
3671
3611
  var TabsMenuComponent = ({
3672
3612
  buttonWidth,
3673
3613
  tabParent,
@@ -3742,22 +3682,22 @@ var TabsMenuComponent = ({
3742
3682
  const handleModal = (name) => {
3743
3683
  setOpenModal((old) => ({ ...old, [name]: !(openModal[name] ?? false) }));
3744
3684
  };
3745
- return /* @__PURE__ */ jsxs16(Fragment19, { children: [
3685
+ return /* @__PURE__ */ jsxs15(Fragment19, { children: [
3746
3686
  renderModal ? renderModal({ handleModal, windowSize, openModal, setDataItem, dataItem }) : "",
3747
- /* @__PURE__ */ jsxs16("div", { className: classNames6("tab-custom", { "tab-parent": tabParent }, { "tab-child": tabChild }), style: { width: `calc(100% - ${buttonWidth ?? 100}px` }, children: [
3748
- /* @__PURE__ */ jsx17(
3687
+ /* @__PURE__ */ jsxs15("div", { className: classNames6("tab-custom", { "tab-parent": tabParent }, { "tab-child": tabChild }), style: { width: `calc(100% - ${buttonWidth ?? 100}px` }, children: [
3688
+ /* @__PURE__ */ jsx16(
3749
3689
  "div",
3750
3690
  {
3751
3691
  onClick: () => handleScroll(-200),
3752
3692
  className: classNames6("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
3753
- children: /* @__PURE__ */ jsx17(ChevronLeft3, {})
3693
+ children: /* @__PURE__ */ jsx16(ChevronLeft3, {})
3754
3694
  }
3755
3695
  ),
3756
- /* @__PURE__ */ jsx17("div", { id: `tab-component-${resourceCode}`, className: "tab-component", children: /* @__PURE__ */ jsx17("div", { id: `content-component-${resourceCode}`, children: dataMenu.map((item) => {
3696
+ /* @__PURE__ */ jsx16("div", { id: `tab-component-${resourceCode}`, className: "tab-component", children: /* @__PURE__ */ jsx16("div", { id: `content-component-${resourceCode}`, children: dataMenu.map((item) => {
3757
3697
  if (item?.resAttributes?.IS_MENU === "1") {
3758
- return /* @__PURE__ */ jsxs16(UncontrolledDropdown2, { className: "tab-custom-item", isOpen: openMenu, toggle: toggleMenu, direction: "down", style: { backgroundColor: openMenu ? "#e0e0e0" : "" }, children: [
3759
- /* @__PURE__ */ jsx17(DropdownToggle4, { color: "#00000", style: { border: "none", boxShadow: "none", margin: 0, padding: 0 }, className: "background-none", children: /* @__PURE__ */ jsx17("div", { children: item.name }) }),
3760
- /* @__PURE__ */ jsx17(DropdownMenu4, { container: document.body, end: true, style: { width: 300 }, children: item?.children?.map((x) => /* @__PURE__ */ jsx17(
3698
+ return /* @__PURE__ */ jsxs15(UncontrolledDropdown2, { className: "tab-custom-item", isOpen: openMenu, toggle: toggleMenu, direction: "down", style: { backgroundColor: openMenu ? "#e0e0e0" : "" }, children: [
3699
+ /* @__PURE__ */ jsx16(DropdownToggle4, { color: "#00000", style: { border: "none", boxShadow: "none", margin: 0, padding: 0 }, className: "background-none", children: /* @__PURE__ */ jsx16("div", { children: item.name }) }),
3700
+ /* @__PURE__ */ jsx16(DropdownMenu4, { container: document.body, end: true, style: { width: 300 }, children: item?.children?.map((x) => /* @__PURE__ */ jsx16(
3761
3701
  DropdownItem3,
3762
3702
  {
3763
3703
  style: { borderRadius: "5px", margin: "0 0.5rem", width: "95%" },
@@ -3774,7 +3714,7 @@ var TabsMenuComponent = ({
3774
3714
  )) })
3775
3715
  ] }, item.code);
3776
3716
  } else {
3777
- return /* @__PURE__ */ jsx17(
3717
+ return /* @__PURE__ */ jsx16(
3778
3718
  Link,
3779
3719
  {
3780
3720
  to: item.url,
@@ -3785,12 +3725,12 @@ var TabsMenuComponent = ({
3785
3725
  );
3786
3726
  }
3787
3727
  }) }) }),
3788
- /* @__PURE__ */ jsx17(
3728
+ /* @__PURE__ */ jsx16(
3789
3729
  "div",
3790
3730
  {
3791
3731
  onClick: () => handleScroll(200),
3792
3732
  className: classNames6("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
3793
- children: /* @__PURE__ */ jsx17(ChevronRight3, {})
3733
+ children: /* @__PURE__ */ jsx16(ChevronRight3, {})
3794
3734
  }
3795
3735
  )
3796
3736
  ] })
@@ -3800,7 +3740,7 @@ var TabsMenuComponent = ({
3800
3740
  // test-app/src/component/input-style/index.tsx
3801
3741
  import { Bold, Droplet, Italic, Type, Underline } from "becoxy-icons";
3802
3742
  import { Button as Button6, Input as Input9 } from "reactstrap";
3803
- import classnames10 from "classnames";
3743
+ import classnames9 from "classnames";
3804
3744
  import { Fragment as Fragment20 } from "react";
3805
3745
 
3806
3746
  // test-app/src/component/input-style/fonts.ts
@@ -4660,7 +4600,7 @@ var OptionFont = [
4660
4600
  ];
4661
4601
 
4662
4602
  // test-app/src/component/input-style/index.tsx
4663
- import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
4603
+ import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
4664
4604
  var InputStyleComponent = (props) => {
4665
4605
  const {
4666
4606
  value,
@@ -4674,8 +4614,8 @@ var InputStyleComponent = (props) => {
4674
4614
  disabledItalic,
4675
4615
  disabledUnderline
4676
4616
  } = props;
4677
- return /* @__PURE__ */ jsx18(Fragment20, { children: /* @__PURE__ */ jsxs17("div", { className: "d-flex align-items-center", children: [
4678
- /* @__PURE__ */ jsx18(
4617
+ return /* @__PURE__ */ jsx17(Fragment20, { children: /* @__PURE__ */ jsxs16("div", { className: "d-flex align-items-center", children: [
4618
+ /* @__PURE__ */ jsx17(
4679
4619
  SelectTable,
4680
4620
  {
4681
4621
  options: OptionFont,
@@ -4691,12 +4631,12 @@ var InputStyleComponent = (props) => {
4691
4631
  field: "label",
4692
4632
  headerText: "",
4693
4633
  template: (row) => {
4694
- return /* @__PURE__ */ jsx18("div", { style: { fontFamily: row.label }, children: row.label });
4634
+ return /* @__PURE__ */ jsx17("div", { style: { fontFamily: row.label }, children: row.label });
4695
4635
  }
4696
4636
  }
4697
4637
  ],
4698
4638
  formatOptionLabel: (props2) => {
4699
- return /* @__PURE__ */ jsx18("p", { style: {
4639
+ return /* @__PURE__ */ jsx17("p", { style: {
4700
4640
  paddingLeft: 3,
4701
4641
  borderRadius: 2,
4702
4642
  fontFamily: value.fontFamily,
@@ -4709,7 +4649,7 @@ var InputStyleComponent = (props) => {
4709
4649
  }
4710
4650
  }
4711
4651
  ),
4712
- /* @__PURE__ */ jsx18("div", { className: classnames10("ms-25", { "d-none": disabledFontSize }), style: { width: 60 }, children: /* @__PURE__ */ jsx18(
4652
+ /* @__PURE__ */ jsx17("div", { className: classnames9("ms-25", { "d-none": disabledFontSize }), style: { width: 60 }, children: /* @__PURE__ */ jsx17(
4713
4653
  SelectTable,
4714
4654
  {
4715
4655
  options: Array.from({ length: 100 }, (_, i) => ({ value: i + 1, label: i + 1 })),
@@ -4721,45 +4661,45 @@ var InputStyleComponent = (props) => {
4721
4661
  }
4722
4662
  }
4723
4663
  ) }),
4724
- /* @__PURE__ */ jsx18(
4664
+ /* @__PURE__ */ jsx17(
4725
4665
  "div",
4726
4666
  {
4727
- className: classnames10("btn-input-style", { "active-custom": value.bold }, { "d-none": disabledBold }),
4667
+ className: classnames9("btn-input-style", { "active-custom": value.bold }, { "d-none": disabledBold }),
4728
4668
  onClick: () => {
4729
4669
  if (!disabled) {
4730
4670
  onChange({ ...value, bold: !value.bold });
4731
4671
  }
4732
4672
  },
4733
- children: /* @__PURE__ */ jsx18(Bold, { fontSize: 18 })
4673
+ children: /* @__PURE__ */ jsx17(Bold, { fontSize: 18 })
4734
4674
  }
4735
4675
  ),
4736
- /* @__PURE__ */ jsx18(
4676
+ /* @__PURE__ */ jsx17(
4737
4677
  "div",
4738
4678
  {
4739
- className: classnames10("btn-input-style", { "active-custom": value.italic }, { "d-none": disabledItalic }),
4679
+ className: classnames9("btn-input-style", { "active-custom": value.italic }, { "d-none": disabledItalic }),
4740
4680
  onClick: () => {
4741
4681
  if (!disabled) {
4742
4682
  onChange({ ...value, italic: !value.italic });
4743
4683
  }
4744
4684
  },
4745
- children: /* @__PURE__ */ jsx18(Italic, { fontSize: 18 })
4685
+ children: /* @__PURE__ */ jsx17(Italic, { fontSize: 18 })
4746
4686
  }
4747
4687
  ),
4748
- /* @__PURE__ */ jsx18(
4688
+ /* @__PURE__ */ jsx17(
4749
4689
  "div",
4750
4690
  {
4751
- className: classnames10("btn-input-style", { "active-custom": value.underline }, { "d-none": disabledUnderline }),
4691
+ className: classnames9("btn-input-style", { "active-custom": value.underline }, { "d-none": disabledUnderline }),
4752
4692
  onClick: () => {
4753
4693
  if (!disabled) {
4754
4694
  onChange({ ...value, underline: !value.underline });
4755
4695
  }
4756
4696
  },
4757
- children: /* @__PURE__ */ jsx18(Underline, { fontSize: 18 })
4697
+ children: /* @__PURE__ */ jsx17(Underline, { fontSize: 18 })
4758
4698
  }
4759
4699
  ),
4760
- /* @__PURE__ */ jsxs17(Button6, { tag: "label", color: "none", className: classnames10("btn-input-style", { "d-none": disabledColor }), children: [
4761
- /* @__PURE__ */ jsx18(Type, { stroke: value.color ?? "#000000", fontSize: 18 }),
4762
- /* @__PURE__ */ jsx18(
4700
+ /* @__PURE__ */ jsxs16(Button6, { tag: "label", color: "none", className: classnames9("btn-input-style", { "d-none": disabledColor }), children: [
4701
+ /* @__PURE__ */ jsx17(Type, { stroke: value.color ?? "#000000", fontSize: 18 }),
4702
+ /* @__PURE__ */ jsx17(
4763
4703
  "input",
4764
4704
  {
4765
4705
  type: "color",
@@ -4773,9 +4713,9 @@ var InputStyleComponent = (props) => {
4773
4713
  }
4774
4714
  )
4775
4715
  ] }),
4776
- /* @__PURE__ */ jsxs17(Button6, { tag: "label", color: "none", className: classnames10("btn-input-style", { "d-none": disabledBackgroundColor }), children: [
4777
- /* @__PURE__ */ jsx18(Droplet, { fill: value.backgroundColor ?? "#ffffff", fontSize: 18 }),
4778
- /* @__PURE__ */ jsx18(
4716
+ /* @__PURE__ */ jsxs16(Button6, { tag: "label", color: "none", className: classnames9("btn-input-style", { "d-none": disabledBackgroundColor }), children: [
4717
+ /* @__PURE__ */ jsx17(Droplet, { fill: value.backgroundColor ?? "#ffffff", fontSize: 18 }),
4718
+ /* @__PURE__ */ jsx17(
4779
4719
  Input9,
4780
4720
  {
4781
4721
  id: "backgroundColor",