react-table-edit 0.8.9 → 0.9.1

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