react-table-edit 0.8.8 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1585 -1644
- package/dist/index.mjs +1559 -1619
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -53,10 +53,10 @@ __export(Table_edit_exports, {
|
|
|
53
53
|
module.exports = __toCommonJS(Table_edit_exports);
|
|
54
54
|
|
|
55
55
|
// test-app/src/component/table/index.tsx
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
var
|
|
56
|
+
var import_react15 = require("react");
|
|
57
|
+
var import_reactstrap10 = require("reactstrap");
|
|
58
|
+
var import_classnames13 = __toESM(require("classnames"));
|
|
59
|
+
var import_react_i18next11 = require("react-i18next");
|
|
60
60
|
var import_becoxy_icons6 = require("becoxy-icons");
|
|
61
61
|
|
|
62
62
|
// test-app/src/component/react-input/index.tsx
|
|
@@ -335,7 +335,7 @@ var import_moment2 = __toESM(require("moment"));
|
|
|
335
335
|
// test-app/src/component/edit-form/index.tsx
|
|
336
336
|
var import_react8 = require("react");
|
|
337
337
|
var import_reactstrap6 = require("reactstrap");
|
|
338
|
-
var
|
|
338
|
+
var import_react_hook_form4 = require("react-hook-form");
|
|
339
339
|
var import_yup = require("@hookform/resolvers/yup");
|
|
340
340
|
var import_react_i18next5 = require("react-i18next");
|
|
341
341
|
var import_classnames6 = __toESM(require("classnames"));
|
|
@@ -431,175 +431,15 @@ var TextInput = (props) => {
|
|
|
431
431
|
};
|
|
432
432
|
var input_text_default = TextInput;
|
|
433
433
|
|
|
434
|
-
// test-app/src/component/
|
|
434
|
+
// test-app/src/component/input-number/index.tsx
|
|
435
435
|
var import_react_hook_form2 = require("react-hook-form");
|
|
436
436
|
var import_reactstrap3 = require("reactstrap");
|
|
437
|
-
var import_react_select = __toESM(require("react-select"));
|
|
438
437
|
var import_classnames3 = __toESM(require("classnames"));
|
|
439
438
|
var import_react5 = require("react");
|
|
440
439
|
var import_react_i18next2 = require("react-i18next");
|
|
441
440
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
442
|
-
var SelectBox = (props) => {
|
|
443
|
-
const { t } = (0, import_react_i18next2.useTranslation)();
|
|
444
|
-
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;
|
|
445
|
-
const handChange = ({ onChange, val }) => {
|
|
446
|
-
onChange(!isNullOrUndefined(val) && isMulti ? val.map((item) => item.value) : !isNullOrUndefined(val) && !isMulti ? fieldValue ? val[fieldValue] : val?.value : void 0);
|
|
447
|
-
if (callback) {
|
|
448
|
-
callback(val);
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
const renderSelect = () => {
|
|
452
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react5.Fragment, { children: [
|
|
453
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
454
|
-
import_react_hook_form2.Controller,
|
|
455
|
-
{
|
|
456
|
-
name,
|
|
457
|
-
control,
|
|
458
|
-
render: ({ field: { value, onChange } }) => {
|
|
459
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
460
|
-
import_react_select.default,
|
|
461
|
-
{
|
|
462
|
-
...rest,
|
|
463
|
-
id,
|
|
464
|
-
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) : "",
|
|
465
|
-
onChange: (val) => {
|
|
466
|
-
if ((fieldValue && val ? val[fieldValue] : val?.value) !== value) {
|
|
467
|
-
if (confirmHandle) {
|
|
468
|
-
confirmHandle(handChange, onChange, val);
|
|
469
|
-
} else {
|
|
470
|
-
onChange(!isNullOrUndefined(val) && isMulti ? val.map((item) => item.value) : !isNullOrUndefined(val) && !isMulti ? fieldValue ? val[fieldValue] : val?.value : void 0);
|
|
471
|
-
if (callback) {
|
|
472
|
-
callback(val);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
},
|
|
477
|
-
onInputChange,
|
|
478
|
-
form: name,
|
|
479
|
-
placeholder: placeholder ? placeholder : "",
|
|
480
|
-
classNamePrefix: "select",
|
|
481
|
-
className: `react-select ${errors && "is-invalid"}`,
|
|
482
|
-
options,
|
|
483
|
-
isMulti,
|
|
484
|
-
isDisabled: disabled,
|
|
485
|
-
isClearable,
|
|
486
|
-
menuPosition: menuPosition ?? "fixed",
|
|
487
|
-
formatOptionLabel: labelComponent ? labelComponent : void 0,
|
|
488
|
-
ref
|
|
489
|
-
}
|
|
490
|
-
);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
),
|
|
494
|
-
errors && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_reactstrap3.FormFeedback, { children: errors?.message })
|
|
495
|
-
] });
|
|
496
|
-
};
|
|
497
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
498
|
-
"div",
|
|
499
|
-
{
|
|
500
|
-
className: (0, import_classnames3.default)(
|
|
501
|
-
inLine === false ? "form-group " : "form-row-inline d-flex",
|
|
502
|
-
"align",
|
|
503
|
-
{
|
|
504
|
-
[labelSize ? labelSize : ""]: labelSize,
|
|
505
|
-
[classes ? classes : ""]: classes,
|
|
506
|
-
"form-row-inline-error": errors
|
|
507
|
-
}
|
|
508
|
-
),
|
|
509
|
-
children: [
|
|
510
|
-
isLabel === false ? "" : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_reactstrap3.Label, { className: "form-label", for: name, children: [
|
|
511
|
-
t(label ? label : ""),
|
|
512
|
-
" ",
|
|
513
|
-
required ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-danger", children: "*" }) : "",
|
|
514
|
-
" "
|
|
515
|
-
] }),
|
|
516
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: (0, import_classnames3.default)("form-input-content", { "hidden-label": isLabel === false }), children: renderSelect() })
|
|
517
|
-
]
|
|
518
|
-
}
|
|
519
|
-
) });
|
|
520
|
-
};
|
|
521
|
-
var select_default = SelectBox;
|
|
522
|
-
|
|
523
|
-
// test-app/src/component/creactable-select/index.tsx
|
|
524
|
-
var import_react_hook_form3 = require("react-hook-form");
|
|
525
|
-
var import_reactstrap4 = require("reactstrap");
|
|
526
|
-
var import_classnames4 = __toESM(require("classnames"));
|
|
527
|
-
var import_react6 = require("react");
|
|
528
|
-
var import_react_i18next3 = require("react-i18next");
|
|
529
|
-
var import_creatable = __toESM(require("react-select/creatable"));
|
|
530
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
531
|
-
var CreatableSelectBox = (props) => {
|
|
532
|
-
const { t } = (0, import_react_i18next3.useTranslation)();
|
|
533
|
-
const { isMulti, id, isLabel, control, placeholder, fieldValue, name, options, label, labelSize, required, errors, inLine, isClearable, labelComponent, onInputChange, callback, ...rest } = props;
|
|
534
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
535
|
-
"div",
|
|
536
|
-
{
|
|
537
|
-
className: (0, import_classnames4.default)(
|
|
538
|
-
inLine === false ? "form-group " : "form-row-inline d-flex",
|
|
539
|
-
"align",
|
|
540
|
-
{
|
|
541
|
-
[labelSize ? labelSize : ""]: labelSize,
|
|
542
|
-
"form-row-inline-error": errors
|
|
543
|
-
}
|
|
544
|
-
),
|
|
545
|
-
children: [
|
|
546
|
-
isLabel === false ? "" : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_reactstrap4.Label, { className: "form-label", for: name, children: [
|
|
547
|
-
t(label),
|
|
548
|
-
" ",
|
|
549
|
-
required ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-danger", children: "*" }) : "",
|
|
550
|
-
" "
|
|
551
|
-
] }),
|
|
552
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_classnames4.default)("form-input-content", { "hidden-label": isLabel === false }), children: [
|
|
553
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
554
|
-
import_react_hook_form3.Controller,
|
|
555
|
-
{
|
|
556
|
-
name,
|
|
557
|
-
control,
|
|
558
|
-
render: ({ field: { value, onChange } }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
559
|
-
import_creatable.default,
|
|
560
|
-
{
|
|
561
|
-
...rest,
|
|
562
|
-
id,
|
|
563
|
-
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) : "",
|
|
564
|
-
onChange: (val) => {
|
|
565
|
-
if (fieldValue && val.__isNew__) {
|
|
566
|
-
val[fieldValue] = val.value;
|
|
567
|
-
}
|
|
568
|
-
onChange(!isNullOrUndefined(val) && isMulti ? val.map((item) => item.value) : !isNullOrUndefined(val) && !isMulti ? fieldValue ? val[fieldValue] : val?.value : void 0);
|
|
569
|
-
if (callback) {
|
|
570
|
-
callback(val);
|
|
571
|
-
}
|
|
572
|
-
},
|
|
573
|
-
onInputChange,
|
|
574
|
-
classNamePrefix: "select",
|
|
575
|
-
className: `react-select ${errors && "is-invalid"}`,
|
|
576
|
-
options,
|
|
577
|
-
placeholder,
|
|
578
|
-
isMulti,
|
|
579
|
-
isClearable,
|
|
580
|
-
menuPosition: "fixed",
|
|
581
|
-
formatOptionLabel: labelComponent ? labelComponent : void 0
|
|
582
|
-
}
|
|
583
|
-
)
|
|
584
|
-
}
|
|
585
|
-
),
|
|
586
|
-
errors && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_reactstrap4.FormFeedback, { children: errors?.message })
|
|
587
|
-
] })
|
|
588
|
-
]
|
|
589
|
-
}
|
|
590
|
-
) });
|
|
591
|
-
};
|
|
592
|
-
var creactable_select_default = CreatableSelectBox;
|
|
593
|
-
|
|
594
|
-
// test-app/src/component/input-number/index.tsx
|
|
595
|
-
var import_react_hook_form4 = require("react-hook-form");
|
|
596
|
-
var import_reactstrap5 = require("reactstrap");
|
|
597
|
-
var import_classnames5 = __toESM(require("classnames"));
|
|
598
|
-
var import_react7 = require("react");
|
|
599
|
-
var import_react_i18next4 = require("react-i18next");
|
|
600
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
601
441
|
var NumberInput = (props) => {
|
|
602
|
-
const { t } = (0,
|
|
442
|
+
const { t } = (0, import_react_i18next2.useTranslation)();
|
|
603
443
|
const {
|
|
604
444
|
control,
|
|
605
445
|
id,
|
|
@@ -627,22 +467,22 @@ var NumberInput = (props) => {
|
|
|
627
467
|
...rest
|
|
628
468
|
} = props;
|
|
629
469
|
const renderLabel = () => {
|
|
630
|
-
return /* @__PURE__ */ (0,
|
|
470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Fragment, { children: isLabel === false ? "" : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_reactstrap3.Label, { className: "form-label", for: name, children: [
|
|
631
471
|
t(label ? label : ""),
|
|
632
472
|
" ",
|
|
633
|
-
required ? /* @__PURE__ */ (0,
|
|
473
|
+
required ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-danger", children: "*" }) : "",
|
|
634
474
|
" "
|
|
635
475
|
] }) });
|
|
636
476
|
};
|
|
637
477
|
const renderInput = () => {
|
|
638
|
-
return /* @__PURE__ */ (0,
|
|
639
|
-
/* @__PURE__ */ (0,
|
|
640
|
-
|
|
478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react5.Fragment, { children: [
|
|
479
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
480
|
+
import_react_hook_form2.Controller,
|
|
641
481
|
{
|
|
642
482
|
name,
|
|
643
483
|
control,
|
|
644
|
-
render: ({ field: { value, onChange } }) => /* @__PURE__ */ (0,
|
|
645
|
-
|
|
484
|
+
render: ({ field: { value, onChange } }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
485
|
+
import_reactstrap3.Input,
|
|
646
486
|
{
|
|
647
487
|
id,
|
|
648
488
|
value: formartNumberic(value, decimalSeparator, thousandSeparator, fractionCurrency),
|
|
@@ -701,13 +541,13 @@ var NumberInput = (props) => {
|
|
|
701
541
|
)
|
|
702
542
|
}
|
|
703
543
|
),
|
|
704
|
-
errors && /* @__PURE__ */ (0,
|
|
544
|
+
errors && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_reactstrap3.FormFeedback, { children: errors?.message })
|
|
705
545
|
] });
|
|
706
546
|
};
|
|
707
|
-
return /* @__PURE__ */ (0,
|
|
547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
708
548
|
"div",
|
|
709
549
|
{
|
|
710
|
-
className: (0,
|
|
550
|
+
className: (0, import_classnames3.default)(
|
|
711
551
|
" align",
|
|
712
552
|
{
|
|
713
553
|
[labelSize ? labelSize : ""]: labelSize,
|
|
@@ -718,358 +558,581 @@ var NumberInput = (props) => {
|
|
|
718
558
|
),
|
|
719
559
|
children: [
|
|
720
560
|
renderLabel(),
|
|
721
|
-
/* @__PURE__ */ (0,
|
|
561
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: (0, import_classnames3.default)("form-input-content", { "hidden-label": isLabel === false }), children: renderInput() })
|
|
722
562
|
]
|
|
723
563
|
}
|
|
724
564
|
) });
|
|
725
565
|
};
|
|
726
566
|
var input_number_default = NumberInput;
|
|
727
567
|
|
|
728
|
-
// test-app/src/component/edit-form/index.tsx
|
|
729
|
-
var
|
|
730
|
-
var
|
|
731
|
-
var
|
|
568
|
+
// test-app/src/component/edit-form/select-table/index.tsx
|
|
569
|
+
var import_react_hook_form3 = require("react-hook-form");
|
|
570
|
+
var import_reactstrap5 = require("reactstrap");
|
|
571
|
+
var import_classnames5 = __toESM(require("classnames"));
|
|
572
|
+
var import_react7 = require("react");
|
|
573
|
+
|
|
574
|
+
// test-app/src/component/select-table/index.tsx
|
|
575
|
+
var import_react6 = require("react");
|
|
576
|
+
var import_reactstrap4 = require("reactstrap");
|
|
577
|
+
var import_react_i18next3 = require("react-i18next");
|
|
578
|
+
var import_classnames4 = __toESM(require("classnames"));
|
|
579
|
+
var import_moment = __toESM(require("moment"));
|
|
580
|
+
var import_becoxy_icons2 = require("becoxy-icons");
|
|
581
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
582
|
+
var defaultMaxHeight = 250;
|
|
583
|
+
var SelectTable = (0, import_react6.forwardRef)((props, ref) => {
|
|
732
584
|
const {
|
|
733
585
|
id,
|
|
734
|
-
field,
|
|
735
|
-
displayValue,
|
|
736
|
-
menuHeight,
|
|
737
586
|
menuWidth,
|
|
738
|
-
rowData,
|
|
739
587
|
invalid,
|
|
740
|
-
onChange,
|
|
741
|
-
onChangeField,
|
|
742
588
|
onKeyDown,
|
|
743
|
-
defaultValues,
|
|
744
589
|
placeholder,
|
|
745
590
|
textAlign,
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
591
|
+
options,
|
|
592
|
+
columns,
|
|
593
|
+
decimalSeparator,
|
|
594
|
+
thousandSeparator,
|
|
595
|
+
onChange,
|
|
596
|
+
value,
|
|
597
|
+
fieldValue,
|
|
598
|
+
fieldLabel,
|
|
599
|
+
loadOptions,
|
|
600
|
+
maxHeight,
|
|
601
|
+
handleAdd,
|
|
753
602
|
isClearable,
|
|
754
|
-
|
|
603
|
+
component,
|
|
604
|
+
formatOptionLabel,
|
|
605
|
+
isMulti,
|
|
606
|
+
noHeader,
|
|
607
|
+
isDisabled,
|
|
608
|
+
showFooter,
|
|
609
|
+
onPaste
|
|
755
610
|
} = props;
|
|
756
|
-
const
|
|
757
|
-
const
|
|
758
|
-
const
|
|
759
|
-
const
|
|
760
|
-
const [
|
|
761
|
-
const [
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
});
|
|
611
|
+
const selectTableRef = (0, import_react6.useRef)();
|
|
612
|
+
const selectMenuTableRef = (0, import_react6.useRef)();
|
|
613
|
+
const inputRef = (0, import_react6.useRef)();
|
|
614
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react6.useState)(false);
|
|
615
|
+
const [indexFocus, setIndexFocus] = (0, import_react6.useState)(-1);
|
|
616
|
+
const [isFocus, setIsFocus] = (0, import_react6.useState)(false);
|
|
617
|
+
const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
|
|
618
|
+
const [searchTerm, setSearchTerm] = (0, import_react6.useState)("");
|
|
619
|
+
const [optionsLoad, setOptionsLoad] = (0, import_react6.useState)();
|
|
620
|
+
const { t } = (0, import_react_i18next3.useTranslation)();
|
|
621
|
+
const isSelectedAll = (0, import_react6.useMemo)(() => {
|
|
622
|
+
return isMulti === true && (optionsLoad ? optionsLoad : options).length > 0 && value?.length >= (optionsLoad ? optionsLoad : options).length;
|
|
623
|
+
}, [optionsLoad, options, value]);
|
|
624
|
+
const defaultColumns = noHeader ? [
|
|
625
|
+
{
|
|
626
|
+
headerText: "Name",
|
|
627
|
+
field: fieldLabel ?? "label",
|
|
628
|
+
width: menuWidth
|
|
629
|
+
}
|
|
630
|
+
] : [
|
|
631
|
+
{
|
|
632
|
+
field: "key",
|
|
633
|
+
headerText: "Code",
|
|
634
|
+
width: 100,
|
|
635
|
+
maxWidth: 120,
|
|
636
|
+
minWidth: 80
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
headerText: "Name",
|
|
640
|
+
field: "label",
|
|
641
|
+
width: 150,
|
|
642
|
+
maxWidth: 200,
|
|
643
|
+
minWidth: 250
|
|
644
|
+
}
|
|
645
|
+
];
|
|
766
646
|
const closeMenu = () => {
|
|
767
|
-
|
|
768
|
-
setDropdownOpen(false);
|
|
769
|
-
}, onChangeField ? 10 : 0);
|
|
647
|
+
setDropdownOpen(false);
|
|
770
648
|
};
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
});
|
|
783
|
-
(0, import_react8.useEffect)(() => {
|
|
784
|
-
if (dropdownOpen) {
|
|
785
|
-
if (onFormOpen && itemsField.length === 0) {
|
|
786
|
-
onFormOpen(rowData, itemsField, setItemsField);
|
|
787
|
-
}
|
|
788
|
-
if (openOnFocus) {
|
|
789
|
-
setTimeout(() => {
|
|
790
|
-
focusElement(`form-element-${field}-0`, true);
|
|
791
|
-
}, 100);
|
|
792
|
-
}
|
|
649
|
+
(0, import_react6.useEffect)(() => {
|
|
650
|
+
if (dropdownOpen && value && !isMulti && selectMenuTableRef) {
|
|
651
|
+
setTimeout(() => {
|
|
652
|
+
const elementFocus = document.getElementById(`row-select-table-${(optionsLoad ? optionsLoad : options)?.findIndex((e) => e[fieldValue ?? "value"] === value[fieldValue ?? "value"])}`);
|
|
653
|
+
if (elementFocus) {
|
|
654
|
+
const parentRect = selectMenuTableRef.current.getBoundingClientRect();
|
|
655
|
+
const childRect = elementFocus.getBoundingClientRect();
|
|
656
|
+
const offset = childRect.top - parentRect.top + selectMenuTableRef.current.scrollTop - parentRect.height / 2 + childRect.height / 2;
|
|
657
|
+
selectMenuTableRef.current.scrollTo({ top: offset });
|
|
658
|
+
}
|
|
659
|
+
}, 100);
|
|
793
660
|
}
|
|
794
661
|
}, [dropdownOpen]);
|
|
795
|
-
(0,
|
|
796
|
-
if (
|
|
797
|
-
|
|
798
|
-
|
|
662
|
+
(0, import_react6.useEffect)(() => {
|
|
663
|
+
if (inputRef && !isDisabled) {
|
|
664
|
+
inputRef.current.addEventListener("blur", function() {
|
|
665
|
+
setDropdownOpen(false);
|
|
666
|
+
setSearchTerm("");
|
|
667
|
+
setIsFocus(false);
|
|
668
|
+
});
|
|
669
|
+
inputRef.current.addEventListener("focus", function() {
|
|
670
|
+
if (!isFocus) {
|
|
671
|
+
setIsFocus(true);
|
|
672
|
+
}
|
|
799
673
|
});
|
|
800
674
|
}
|
|
801
|
-
}, [
|
|
802
|
-
|
|
675
|
+
}, [inputRef]);
|
|
676
|
+
(0, import_react6.useEffect)(() => {
|
|
677
|
+
if (searchTerm && !dropdownOpen) {
|
|
678
|
+
setDropdownOpen(true);
|
|
679
|
+
setIndexFocus(0);
|
|
680
|
+
}
|
|
681
|
+
}, [searchTerm]);
|
|
682
|
+
const handleOpenClose = () => {
|
|
683
|
+
setSearchTerm("");
|
|
803
684
|
if (dropdownOpen) {
|
|
804
685
|
closeMenu();
|
|
805
686
|
} else {
|
|
806
|
-
|
|
687
|
+
if (!isDisabled) {
|
|
688
|
+
setDropdownOpen(true);
|
|
689
|
+
}
|
|
807
690
|
}
|
|
808
691
|
};
|
|
809
|
-
const
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
if (
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
};
|
|
817
|
-
const focusElement = (id2, focus) => {
|
|
818
|
-
const element = document.getElementById(id2);
|
|
819
|
-
if (element) {
|
|
820
|
-
if (element.className.includes("react-select")) {
|
|
821
|
-
element.getElementsByTagName("input")[0]?.focus();
|
|
822
|
-
} else {
|
|
823
|
-
element.focus();
|
|
824
|
-
if (focus) {
|
|
825
|
-
element.setSelectionRange(0, element.innerText.length - 1);
|
|
826
|
-
}
|
|
692
|
+
const listKeyUse = ["Escape", "Space", "Enter", "Tab", "NumpadEnter", "ArrowDown", "ArrowUp", "F9"];
|
|
693
|
+
const handleOnKeyDown = (e) => {
|
|
694
|
+
let key = "";
|
|
695
|
+
if (onKeyDown && (!dropdownOpen || !listKeyUse.includes(e.code))) {
|
|
696
|
+
key = onKeyDown(e);
|
|
697
|
+
if (key === "ArrowRight" || key === "ArrowLeft") {
|
|
698
|
+
closeMenu();
|
|
827
699
|
}
|
|
828
700
|
}
|
|
829
|
-
};
|
|
830
|
-
const handleOnKeyDown = (e) => {
|
|
831
701
|
let flag = false;
|
|
832
|
-
if (
|
|
833
|
-
if (e.code === "
|
|
834
|
-
|
|
835
|
-
flag = true;
|
|
836
|
-
} else if (e.code === "Enter") {
|
|
837
|
-
closeMenu();
|
|
702
|
+
if (!key) {
|
|
703
|
+
if (e.code === "F9") {
|
|
704
|
+
handleAdd();
|
|
838
705
|
flag = true;
|
|
706
|
+
} else if (e.code === "Escape" || e.code === "Space") {
|
|
707
|
+
if (dropdownOpen) {
|
|
708
|
+
if ((optionsLoad ? optionsLoad : options)[indexFocus]) {
|
|
709
|
+
onChange((optionsLoad ? optionsLoad : options)[indexFocus]);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (!searchTerm) {
|
|
713
|
+
handleOpenClose();
|
|
714
|
+
flag = true;
|
|
715
|
+
}
|
|
716
|
+
} else if (e.code === "Enter" || e.code === "Tab" || e.code === "NumpadEnter") {
|
|
717
|
+
if (dropdownOpen) {
|
|
718
|
+
onChange((optionsLoad ? optionsLoad : options)[indexFocus]);
|
|
719
|
+
handleOpenClose();
|
|
720
|
+
flag = true;
|
|
721
|
+
}
|
|
839
722
|
} else if (e.code === "ArrowDown") {
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
723
|
+
if (dropdownOpen) {
|
|
724
|
+
let newIndex = 0;
|
|
725
|
+
if (indexFocus >= 0) {
|
|
726
|
+
newIndex = indexFocus + 1;
|
|
727
|
+
} else if (value) {
|
|
728
|
+
newIndex = (optionsLoad ? optionsLoad : options)?.findIndex((e2) => e2[fieldValue ?? "value"] === value[fieldValue ?? "value"]) + 1;
|
|
729
|
+
}
|
|
730
|
+
if (newIndex < (optionsLoad ? optionsLoad : options).length) {
|
|
731
|
+
setIndexFocus(newIndex);
|
|
732
|
+
checkIfElementIsOutOfScroll(0, newIndex);
|
|
733
|
+
} else {
|
|
734
|
+
setIndexFocus(0);
|
|
735
|
+
checkIfElementIsOutOfScroll(1, 0);
|
|
736
|
+
}
|
|
737
|
+
flag = true;
|
|
738
|
+
} else {
|
|
739
|
+
handleOpenClose();
|
|
740
|
+
flag = true;
|
|
741
|
+
}
|
|
742
|
+
} else if (e.code === "ArrowUp") {
|
|
743
|
+
if (dropdownOpen) {
|
|
744
|
+
let newIndex = 0;
|
|
745
|
+
if (indexFocus >= 0) {
|
|
746
|
+
newIndex = indexFocus - 1;
|
|
747
|
+
} else if (value) {
|
|
748
|
+
newIndex = (optionsLoad ? optionsLoad : options)?.findIndex((e2) => e2[fieldValue ?? "value"] === value[fieldValue ?? "value"]) - 1;
|
|
749
|
+
}
|
|
750
|
+
if (newIndex >= 0) {
|
|
751
|
+
setIndexFocus(newIndex);
|
|
752
|
+
checkIfElementIsOutOfScroll(2, newIndex);
|
|
753
|
+
} else {
|
|
754
|
+
setIndexFocus((optionsLoad ? optionsLoad : options).length - 1);
|
|
755
|
+
checkIfElementIsOutOfScroll(3, (optionsLoad ? optionsLoad : options).length - 1);
|
|
756
|
+
}
|
|
757
|
+
flag = true;
|
|
758
|
+
}
|
|
851
759
|
}
|
|
852
760
|
}
|
|
853
|
-
if (
|
|
854
|
-
const key = onKeyDown(e);
|
|
855
|
-
if (key === "ArrowRight" || key === "ArrowLeft") {
|
|
856
|
-
closeMenu();
|
|
857
|
-
}
|
|
858
|
-
} else {
|
|
761
|
+
if (flag) {
|
|
859
762
|
e.stopPropagation();
|
|
860
763
|
e.preventDefault();
|
|
861
764
|
}
|
|
862
765
|
};
|
|
863
|
-
const
|
|
864
|
-
if (
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
if (
|
|
872
|
-
|
|
766
|
+
const checkIfElementIsOutOfScroll = (flag, index) => {
|
|
767
|
+
if (selectMenuTableRef) {
|
|
768
|
+
const elementFocus = document.getElementById(`row-select-table-${index}`);
|
|
769
|
+
if (elementFocus) {
|
|
770
|
+
const rect = elementFocus.getBoundingClientRect();
|
|
771
|
+
const parentRect = selectMenuTableRef.current?.getBoundingClientRect();
|
|
772
|
+
if (flag === 1) {
|
|
773
|
+
scrollToElement(selectMenuTableRef.current, 0);
|
|
774
|
+
} else if (flag === 3) {
|
|
775
|
+
scrollToElement(selectMenuTableRef.current, selectMenuTableRef.current.scrollHeight);
|
|
776
|
+
} else if (flag === 0 && rect.bottom + 30 > parentRect.bottom) {
|
|
777
|
+
scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop - selectMenuTableRef.current.offsetTop - parentRect.height + rect.height + 50);
|
|
778
|
+
} else if (flag === 2 && rect.top < parentRect.top + 50) {
|
|
779
|
+
scrollToElement(selectMenuTableRef.current, elementFocus.offsetTop - 65);
|
|
873
780
|
}
|
|
874
781
|
}
|
|
875
782
|
}
|
|
876
783
|
};
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
} else if (e.code === "Tab" && onChangeField && index === itemsField.length - 1) {
|
|
887
|
-
closeMenu();
|
|
888
|
-
}
|
|
784
|
+
let timeOutElement;
|
|
785
|
+
const scrollToElement = (elemment, top) => {
|
|
786
|
+
clearTimeout(timeOutElement);
|
|
787
|
+
timeOutElement = setTimeout(() => {
|
|
788
|
+
elemment.scrollTo({
|
|
789
|
+
top,
|
|
790
|
+
behavior: "smooth"
|
|
791
|
+
});
|
|
792
|
+
}, 100);
|
|
889
793
|
};
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
794
|
+
const renderHeaderCol = (col, indexCol) => {
|
|
795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
796
|
+
import_react6.Fragment,
|
|
797
|
+
{
|
|
798
|
+
children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
799
|
+
"th",
|
|
800
|
+
{
|
|
801
|
+
className: (0, import_classnames4.default)(
|
|
802
|
+
`r-select-headercell fix-${col.fixedType}`,
|
|
803
|
+
{ "cell-fixed": col.fixedType }
|
|
804
|
+
),
|
|
805
|
+
style: {
|
|
806
|
+
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
807
|
+
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
808
|
+
top: `${0 * 35}px`,
|
|
809
|
+
maxWidth: col.maxWidth
|
|
810
|
+
},
|
|
811
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
812
|
+
"div",
|
|
813
|
+
{
|
|
814
|
+
role: "textbox",
|
|
815
|
+
title: t(col.headerText ?? ""),
|
|
816
|
+
style: {
|
|
817
|
+
height: `${1 * 35}px`,
|
|
818
|
+
justifyContent: col.textAlign ?? "left"
|
|
819
|
+
},
|
|
820
|
+
className: "r-select-headercell-div",
|
|
821
|
+
children: t(col.headerText ?? "")
|
|
822
|
+
}
|
|
823
|
+
)
|
|
824
|
+
}
|
|
825
|
+
)
|
|
826
|
+
},
|
|
827
|
+
`header-select-${indexCol}`
|
|
828
|
+
);
|
|
829
|
+
};
|
|
830
|
+
const checkSearch = (keyword, data, columnsSearch) => {
|
|
831
|
+
if (!keyword || columnsSearch.length === 0) {
|
|
832
|
+
return true;
|
|
833
|
+
}
|
|
834
|
+
for (let index = 0; index < columnsSearch.length; index++) {
|
|
835
|
+
const key = columnsSearch[index].field.trim();
|
|
836
|
+
if (data[key] && data[key].toString().trim().toLowerCase().includes(keyword.trim().toLowerCase())) {
|
|
837
|
+
return true;
|
|
896
838
|
}
|
|
897
839
|
}
|
|
840
|
+
return false;
|
|
898
841
|
};
|
|
899
|
-
const
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
) }, index);
|
|
957
|
-
} else if (item.type === "selectCreatable") {
|
|
958
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_reactstrap6.Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
959
|
-
creactable_select_default,
|
|
960
|
-
{
|
|
961
|
-
id: `form-element-${field}-${index}`,
|
|
962
|
-
options: item.options ?? [],
|
|
963
|
-
control,
|
|
964
|
-
name: item.name,
|
|
965
|
-
placeholder: t("Select"),
|
|
966
|
-
menuPortalTarget: document.body,
|
|
967
|
-
label: item.label ? item.label : "",
|
|
968
|
-
labelSize: ` ${labelSize}`,
|
|
969
|
-
errors: errors[item.name],
|
|
970
|
-
callback: () => {
|
|
971
|
-
elementChange(item.name);
|
|
842
|
+
const callbackLoadOption = (rs) => {
|
|
843
|
+
setIsLoading(false);
|
|
844
|
+
setOptionsLoad(rs);
|
|
845
|
+
};
|
|
846
|
+
(0, import_react6.useEffect)(() => {
|
|
847
|
+
if (!searchTerm) {
|
|
848
|
+
setOptionsLoad(void 0);
|
|
849
|
+
}
|
|
850
|
+
}, [searchTerm]);
|
|
851
|
+
const checkOverflow = (indexRow, indexCol) => {
|
|
852
|
+
const element = document.getElementById(`select-${id}-${indexRow}-${indexCol}`);
|
|
853
|
+
return element && element.scrollWidth > element.clientWidth;
|
|
854
|
+
};
|
|
855
|
+
const RenderElement = (props2) => {
|
|
856
|
+
const { indexRow, row, isSelected, level = 0 } = props2;
|
|
857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
858
|
+
"tr",
|
|
859
|
+
{
|
|
860
|
+
id: `row-select-table-${indexRow}`,
|
|
861
|
+
style: { paddingLeft: 10 * level },
|
|
862
|
+
className: (0, import_classnames4.default)("r-select-row", { "last-row": indexRow === (optionsLoad ? optionsLoad : options).length - 1 }, { "fisrt-row": indexRow === 0 }),
|
|
863
|
+
children: [
|
|
864
|
+
isMulti && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
865
|
+
"td",
|
|
866
|
+
{
|
|
867
|
+
className: (0, import_classnames4.default)(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
|
|
868
|
+
style: { width: 40, textAlign: "center", padding: 0, paddingBottom: 6 },
|
|
869
|
+
onClick: (e) => {
|
|
870
|
+
if (isMulti) {
|
|
871
|
+
const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
|
|
872
|
+
if (index > -1) {
|
|
873
|
+
value?.splice(index, 1);
|
|
874
|
+
const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
|
|
875
|
+
onChange(valueArr);
|
|
876
|
+
} else {
|
|
877
|
+
if (value) {
|
|
878
|
+
value?.push(row[fieldValue ?? "value"]);
|
|
879
|
+
const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
|
|
880
|
+
onChange(valueArr);
|
|
881
|
+
} else {
|
|
882
|
+
onChange([row[fieldValue ?? "value"]]);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
e.stopPropagation();
|
|
886
|
+
}
|
|
887
|
+
},
|
|
888
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
889
|
+
import_reactstrap4.Input,
|
|
890
|
+
{
|
|
891
|
+
checked: isSelected,
|
|
892
|
+
type: "checkbox",
|
|
893
|
+
className: "cursor-pointer",
|
|
894
|
+
onChange: () => {
|
|
895
|
+
},
|
|
896
|
+
style: { textAlign: "center", marginTop: 6 }
|
|
897
|
+
}
|
|
898
|
+
)
|
|
972
899
|
}
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
900
|
+
),
|
|
901
|
+
(columns ? columns : defaultColumns).map((col, indexCol) => {
|
|
902
|
+
let valueDisplay = row[col.field];
|
|
903
|
+
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
904
|
+
valueDisplay = formartNumberic(row[col.field], decimalSeparator ?? ".", thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
905
|
+
} else if (col.type === "date") {
|
|
906
|
+
valueDisplay = valueDisplay ? (0, import_moment.default)(valueDisplay).format("DD/MM/yyyy") : "";
|
|
907
|
+
} else if (col.type === "datetime") {
|
|
908
|
+
valueDisplay = valueDisplay ? (0, import_moment.default)(valueDisplay).format("DD/MM/yyyy HH:mm") : "";
|
|
909
|
+
}
|
|
910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react6.Fragment, { children: [
|
|
911
|
+
col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
912
|
+
"td",
|
|
913
|
+
{
|
|
914
|
+
id: `select-${id}-${indexRow}-${indexCol}`,
|
|
915
|
+
className: (0, import_classnames4.default)(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
|
|
916
|
+
style: {
|
|
917
|
+
minWidth: col.minWidth,
|
|
918
|
+
width: col.width,
|
|
919
|
+
maxWidth: col.maxWidth,
|
|
920
|
+
textAlign: col.textAlign ? col.textAlign : "left"
|
|
921
|
+
},
|
|
922
|
+
onClick: (e) => {
|
|
923
|
+
if (isMulti) {
|
|
924
|
+
const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
|
|
925
|
+
if (index > -1) {
|
|
926
|
+
value?.splice(index, 1);
|
|
927
|
+
const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
|
|
928
|
+
onChange(valueArr);
|
|
929
|
+
} else {
|
|
930
|
+
if (value) {
|
|
931
|
+
value?.push(row[fieldValue ?? "value"]);
|
|
932
|
+
const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
|
|
933
|
+
onChange(valueArr);
|
|
934
|
+
} else {
|
|
935
|
+
onChange([row[fieldValue ?? "value"]]);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
} else {
|
|
939
|
+
onChange(row);
|
|
940
|
+
setSearchTerm("");
|
|
941
|
+
closeMenu();
|
|
942
|
+
}
|
|
943
|
+
e.preventDefault();
|
|
944
|
+
e.stopPropagation();
|
|
945
|
+
},
|
|
946
|
+
onMouseMove: (e) => {
|
|
947
|
+
if (indexRow !== indexFocus) {
|
|
948
|
+
setIndexFocus(indexRow);
|
|
949
|
+
}
|
|
950
|
+
e.stopPropagation();
|
|
951
|
+
},
|
|
952
|
+
children: col.template ? col.template(row, indexRow) : valueDisplay
|
|
953
|
+
},
|
|
954
|
+
`col-${indexRow}-${indexCol}`
|
|
955
|
+
),
|
|
956
|
+
checkOverflow(indexRow, indexCol) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_reactstrap4.UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : valueDisplay })
|
|
957
|
+
] }, indexCol);
|
|
958
|
+
})
|
|
959
|
+
]
|
|
960
|
+
},
|
|
961
|
+
`row-${indexRow}`
|
|
962
|
+
);
|
|
978
963
|
};
|
|
979
|
-
|
|
964
|
+
const RenderTable = (props2) => {
|
|
965
|
+
const {} = props2;
|
|
966
|
+
let countDisplay = 0;
|
|
967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
968
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("table", { style: { width: "100%" }, children: [
|
|
969
|
+
!noHeader && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("thead", { className: "r-select-gridheader", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("tr", { className: "r-select-row", role: "row", children: [
|
|
970
|
+
isMulti && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { className: (0, import_classnames4.default)(`r-select-headercell`), style: { width: 40, top: `0px` }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
971
|
+
"div",
|
|
972
|
+
{
|
|
973
|
+
style: { justifyContent: "center" },
|
|
974
|
+
className: (0, import_classnames4.default)("r-select-headercell-div"),
|
|
975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
976
|
+
import_reactstrap4.Input,
|
|
977
|
+
{
|
|
978
|
+
checked: isSelectedAll,
|
|
979
|
+
type: "checkbox",
|
|
980
|
+
onClick: (e) => {
|
|
981
|
+
if (isMulti) {
|
|
982
|
+
if (isSelectedAll) {
|
|
983
|
+
onChange([]);
|
|
984
|
+
} else {
|
|
985
|
+
onChange([...optionsLoad ? optionsLoad : options]);
|
|
986
|
+
}
|
|
987
|
+
e.stopPropagation();
|
|
988
|
+
}
|
|
989
|
+
},
|
|
990
|
+
readOnly: true,
|
|
991
|
+
className: (0, import_classnames4.default)("cursor-pointer", { "d-none": !isMulti }),
|
|
992
|
+
style: { textAlign: "center", marginTop: 6 }
|
|
993
|
+
}
|
|
994
|
+
)
|
|
995
|
+
}
|
|
996
|
+
) }),
|
|
997
|
+
!noHeader && (columns ? columns : defaultColumns).map((col, index) => {
|
|
998
|
+
return renderHeaderCol(col, index);
|
|
999
|
+
})
|
|
1000
|
+
] }) }),
|
|
1001
|
+
(optionsLoad ? optionsLoad : options).length > 0 && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tbody", { className: "r-select-gridcontent", children: (optionsLoad ? optionsLoad : options)?.map((row, indexRow) => {
|
|
1002
|
+
if (!isMulti && loadOptions || checkSearch(searchTerm, row, columns ? columns : defaultColumns)) {
|
|
1003
|
+
const isSelected = isMulti && value?.some((x) => x === row[fieldValue ?? "value"]);
|
|
1004
|
+
countDisplay++;
|
|
1005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RenderElement, { isSelected, indexRow, row }, `select-table-${indexRow}`);
|
|
1006
|
+
}
|
|
1007
|
+
}) }) })
|
|
1008
|
+
] }),
|
|
1009
|
+
countDisplay === 0 && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "r-no-data", children: [
|
|
1010
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [
|
|
1011
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }),
|
|
1012
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [
|
|
1013
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" }),
|
|
1014
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" })
|
|
1015
|
+
] })
|
|
1016
|
+
] }) }),
|
|
1017
|
+
t("No data available.")
|
|
1018
|
+
] }),
|
|
1019
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "r-no-data", children: [
|
|
1020
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_reactstrap4.Spinner, { className: "me-1", children: " " }),
|
|
1021
|
+
t("Loading...")
|
|
1022
|
+
] })
|
|
1023
|
+
] });
|
|
1024
|
+
};
|
|
1025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
980
1026
|
"div",
|
|
981
1027
|
{
|
|
982
|
-
className: "
|
|
1028
|
+
className: (0, import_classnames4.default)("react-select-table", { "is-invalid": invalid }),
|
|
983
1029
|
ref,
|
|
984
1030
|
id,
|
|
985
|
-
children: /* @__PURE__ */ (0,
|
|
986
|
-
|
|
1031
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: selectTableRef, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1032
|
+
import_reactstrap4.Dropdown,
|
|
987
1033
|
{
|
|
988
1034
|
isOpen: dropdownOpen,
|
|
989
1035
|
toggle: () => {
|
|
990
1036
|
},
|
|
1037
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
991
1038
|
children: [
|
|
992
|
-
/* @__PURE__ */ (0,
|
|
993
|
-
|
|
994
|
-
{
|
|
995
|
-
style: { backgroundColor: "#FFF", textAlign: textAlign ?? "left" },
|
|
996
|
-
placeholder,
|
|
997
|
-
innerRef: inputRef,
|
|
998
|
-
className: (0, import_classnames6.default)("input-display input-numeric", { "is-invalid": invalid }),
|
|
999
|
-
value: displayValue,
|
|
1000
|
-
onClick: handleOnClick,
|
|
1001
|
-
onKeyDown: (e) => handleOnKeyDown(e),
|
|
1002
|
-
onPaste: (e) => onPaste && onPaste(e),
|
|
1003
|
-
readOnly: true
|
|
1004
|
-
}
|
|
1005
|
-
) }),
|
|
1006
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1007
|
-
import_reactstrap6.DropdownMenu,
|
|
1039
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1040
|
+
import_reactstrap4.DropdownToggle,
|
|
1008
1041
|
{
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
zIndex: 1056
|
|
1042
|
+
onClick: (e) => {
|
|
1043
|
+
if (!isDisabled) {
|
|
1044
|
+
inputRef?.current.focus();
|
|
1045
|
+
handleOpenClose();
|
|
1046
|
+
}
|
|
1047
|
+
e.preventDefault();
|
|
1016
1048
|
},
|
|
1017
|
-
|
|
1018
|
-
|
|
1049
|
+
tag: "div",
|
|
1050
|
+
className: (0, import_classnames4.default)("select-table-control", { "r-select-is-disabled": isDisabled }, { "r-select-is-open": dropdownOpen }, { "r-select-is-focus": isFocus }, { "r-select-is-invalid": invalid }),
|
|
1051
|
+
children: [
|
|
1052
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "select-table-container", children: [
|
|
1053
|
+
isMulti ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: (0, import_classnames4.default)("select-value is-mutil", { "d-none": searchTerm }), children: value?.map((ele, index) => {
|
|
1054
|
+
const element = (optionsLoad ? optionsLoad : options).find((e) => e[fieldValue ?? "value"] === ele);
|
|
1055
|
+
if (element) {
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
1057
|
+
index === 0 ? "" : ", ",
|
|
1058
|
+
element[fieldLabel ?? "label"]
|
|
1059
|
+
] }, index);
|
|
1060
|
+
}
|
|
1061
|
+
}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_classnames4.default)("select-value", { "d-none": searchTerm }), children: [
|
|
1062
|
+
value ? formatOptionLabel ? formatOptionLabel(value) : value[fieldLabel ?? "label"] : "",
|
|
1063
|
+
" "
|
|
1064
|
+
] }) }),
|
|
1065
|
+
!((isMulti ? value?.length > 0 : value) || isDisabled || searchTerm) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: (0, import_classnames4.default)("select-placeholder"), children: placeholder }),
|
|
1066
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "input-container", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1067
|
+
"input",
|
|
1068
|
+
{
|
|
1069
|
+
style: { textAlign: textAlign ?? "left" },
|
|
1070
|
+
ref: inputRef,
|
|
1071
|
+
className: (0, import_classnames4.default)("select-input"),
|
|
1072
|
+
readOnly: isDisabled,
|
|
1073
|
+
value: searchTerm,
|
|
1074
|
+
onPaste: (e) => onPaste && !dropdownOpen && onPaste(e),
|
|
1075
|
+
onChange: (val) => {
|
|
1076
|
+
if (!isMulti && loadOptions && val.target.value) {
|
|
1077
|
+
setIsLoading(true);
|
|
1078
|
+
loadOptions(val.target.value, callbackLoadOption);
|
|
1079
|
+
}
|
|
1080
|
+
setSearchTerm(val.target.value);
|
|
1081
|
+
},
|
|
1082
|
+
onKeyDown: (e) => handleOnKeyDown(e)
|
|
1083
|
+
}
|
|
1084
|
+
) })
|
|
1085
|
+
] }),
|
|
1086
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_classnames4.default)("select-table-indicator d-flex align-items-center"), children: [
|
|
1087
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_reactstrap4.Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" }),
|
|
1088
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_reactstrap4.Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" }),
|
|
1089
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_reactstrap4.Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" })
|
|
1090
|
+
] }),
|
|
1091
|
+
isClearable && value && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1019
1092
|
"div",
|
|
1020
1093
|
{
|
|
1021
|
-
className: "
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1094
|
+
className: (0, import_classnames4.default)("cursor-pointer"),
|
|
1095
|
+
onClick: (e) => {
|
|
1096
|
+
onChange(isMulti ? [] : void 0);
|
|
1097
|
+
e.stopPropagation();
|
|
1025
1098
|
},
|
|
1026
|
-
children:
|
|
1099
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { height: "20", width: "20", color: "#c4c4c4", viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", className: "css-tj5bde-Svg", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" }) })
|
|
1027
1100
|
}
|
|
1028
1101
|
),
|
|
1029
|
-
/* @__PURE__ */ (0,
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
),
|
|
1055
|
-
/* @__PURE__ */ (0,
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
if (e.code === "Tab") {
|
|
1064
|
-
closeMenu();
|
|
1065
|
-
}
|
|
1066
|
-
},
|
|
1067
|
-
children: t("Save")
|
|
1068
|
-
}
|
|
1069
|
-
)
|
|
1070
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, {})
|
|
1071
|
-
] })
|
|
1072
|
-
] }) })
|
|
1102
|
+
!isDisabled && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "select-table-indicator", onMouseDown: (e) => e.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { height: "20", width: "20", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" }) }) })
|
|
1103
|
+
]
|
|
1104
|
+
}
|
|
1105
|
+
),
|
|
1106
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1107
|
+
import_reactstrap4.DropdownMenu,
|
|
1108
|
+
{
|
|
1109
|
+
container: component,
|
|
1110
|
+
className: "formula-dropdown icon-dropdown p-0",
|
|
1111
|
+
style: {
|
|
1112
|
+
width: menuWidth ? menuWidth : "min-content",
|
|
1113
|
+
position: "fixed",
|
|
1114
|
+
borderRadius: 3,
|
|
1115
|
+
zIndex: 9999
|
|
1116
|
+
},
|
|
1117
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_reactstrap4.DropdownItem, { className: (0, import_classnames4.default)("p-0 menu-select-table"), style: { borderRadius: "6px" }, tag: "div", header: true, children: dropdownOpen && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1118
|
+
"div",
|
|
1119
|
+
{
|
|
1120
|
+
onMouseDown: (e) => {
|
|
1121
|
+
if (!isDisabled) {
|
|
1122
|
+
inputRef?.current.focus();
|
|
1123
|
+
e.preventDefault();
|
|
1124
|
+
}
|
|
1125
|
+
},
|
|
1126
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "r-select-grid", children: [
|
|
1127
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "r-select-gridtable", ref: selectMenuTableRef, style: { minWidth: selectTableRef?.current?.clientWidth, maxHeight: maxHeight ?? defaultMaxHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RenderTable, {}) }),
|
|
1128
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: (0, import_classnames4.default)("r-select-footer", { "d-none": !(showFooter === true || handleAdd) }), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_reactstrap4.Button, { outline: true, color: "primary", onClick: handleAdd, className: (0, import_classnames4.default)("r-btn-add d-flex align-items-center", { "d-none": !handleAdd }), children: [
|
|
1129
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_becoxy_icons2.Plus, { className: "me-50", fontSize: 16 }),
|
|
1130
|
+
t("AddNew"),
|
|
1131
|
+
" (F9)"
|
|
1132
|
+
] }) })
|
|
1133
|
+
] })
|
|
1134
|
+
}
|
|
1135
|
+
) })
|
|
1073
1136
|
}
|
|
1074
1137
|
)
|
|
1075
1138
|
]
|
|
@@ -1078,1082 +1141,960 @@ var EditForm = (0, import_react8.forwardRef)((props, ref) => {
|
|
|
1078
1141
|
}
|
|
1079
1142
|
);
|
|
1080
1143
|
});
|
|
1081
|
-
var edit_form_default = EditForm;
|
|
1082
|
-
|
|
1083
|
-
// test-app/src/component/sidebar-setting-column/index.tsx
|
|
1084
|
-
var import_react10 = require("react");
|
|
1085
|
-
var import_reactstrap7 = require("reactstrap");
|
|
1086
|
-
var import_react_i18next7 = require("react-i18next");
|
|
1087
1144
|
|
|
1088
|
-
// test-app/src/component/
|
|
1089
|
-
var
|
|
1090
|
-
var
|
|
1091
|
-
var
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1145
|
+
// test-app/src/component/edit-form/select-table/index.tsx
|
|
1146
|
+
var import_react_i18next4 = require("react-i18next");
|
|
1147
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1148
|
+
var SelectTableBox = (props) => {
|
|
1149
|
+
const {
|
|
1150
|
+
isMulti,
|
|
1151
|
+
isLabel,
|
|
1152
|
+
confirmHandle,
|
|
1153
|
+
id,
|
|
1154
|
+
fieldValue,
|
|
1155
|
+
fieldLabel,
|
|
1156
|
+
labelComponent,
|
|
1157
|
+
defaultOptions,
|
|
1158
|
+
loadOptions,
|
|
1159
|
+
control,
|
|
1160
|
+
placeholder,
|
|
1161
|
+
disabled,
|
|
1162
|
+
name,
|
|
1163
|
+
label,
|
|
1164
|
+
labelSize,
|
|
1165
|
+
required,
|
|
1166
|
+
errors,
|
|
1167
|
+
inLine,
|
|
1168
|
+
callback,
|
|
1169
|
+
desciptionLabel,
|
|
1170
|
+
classLabel,
|
|
1171
|
+
isClearable,
|
|
1172
|
+
defaultValue,
|
|
1173
|
+
handleAddNew,
|
|
1174
|
+
columns,
|
|
1175
|
+
...rest
|
|
1176
|
+
} = props;
|
|
1177
|
+
const handChange = ({ onChange, val }) => {
|
|
1178
|
+
onChange(!isNullOrUndefined(val) && isMulti ? val.map((item) => item.value) : !isNullOrUndefined(val) && !isMulti ? fieldValue ? val[fieldValue] : val?.value : void 0);
|
|
1179
|
+
if (callback) {
|
|
1180
|
+
callback(val);
|
|
1109
1181
|
}
|
|
1110
1182
|
};
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1183
|
+
const renderLabel = (props2) => {
|
|
1184
|
+
const { t } = (0, import_react_i18next4.useTranslation)();
|
|
1185
|
+
const { isLabel: isLabel2, desciptionLabel: desciptionLabel2, id: id2, classLabel: classLabel2, name: name2, label: label2, required: required2 } = props2;
|
|
1186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react7.Fragment, { children: [
|
|
1187
|
+
isLabel2 === false ? "" : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_reactstrap5.Label, { id: `label-${id2}`, className: classLabel2, for: name2, children: [
|
|
1188
|
+
t(label2 ? label2 : ""),
|
|
1115
1189
|
" ",
|
|
1116
|
-
|
|
1190
|
+
required2 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-danger", children: "*" }) : ""
|
|
1117
1191
|
] }),
|
|
1118
|
-
|
|
1119
|
-
] })
|
|
1120
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "todo-item-action d-flex align-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1121
|
-
import_becoxy_icons2.X,
|
|
1122
|
-
{
|
|
1123
|
-
className: (0, import_classnames7.default)("fw-normal mt-25 cursor-pointer", { "d-none": !handleModal }),
|
|
1124
|
-
fontSize: 20,
|
|
1125
|
-
onClick: handleModal
|
|
1126
|
-
}
|
|
1127
|
-
) })
|
|
1128
|
-
] });
|
|
1129
|
-
};
|
|
1130
|
-
var modal_header_default = ModalHeader;
|
|
1131
|
-
|
|
1132
|
-
// test-app/src/component/sidebar/index.tsx
|
|
1133
|
-
var import_becoxy_icons3 = require("becoxy-icons");
|
|
1134
|
-
var import_classnames8 = __toESM(require("classnames"));
|
|
1135
|
-
var import_react9 = require("react");
|
|
1136
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1137
|
-
var Sidebar = (props) => {
|
|
1138
|
-
const {
|
|
1139
|
-
open,
|
|
1140
|
-
children,
|
|
1141
|
-
toggleSidebar,
|
|
1142
|
-
width,
|
|
1143
|
-
keyboard,
|
|
1144
|
-
hiddenBackground,
|
|
1145
|
-
hiddenFullScreenButton
|
|
1146
|
-
} = props;
|
|
1147
|
-
const [isFullScreen, setIsFullScreen] = (0, import_react9.useState)(false);
|
|
1148
|
-
const [flag, setFlag] = (0, import_react9.useState)(open);
|
|
1149
|
-
(0, import_react9.useEffect)(() => {
|
|
1150
|
-
if (open !== flag) {
|
|
1151
|
-
if (open) {
|
|
1152
|
-
setFlag(open);
|
|
1153
|
-
} else {
|
|
1154
|
-
setTimeout(() => {
|
|
1155
|
-
setFlag(open);
|
|
1156
|
-
}, 50);
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
}, [open]);
|
|
1160
|
-
const handClose = () => {
|
|
1161
|
-
setFlag(false);
|
|
1162
|
-
setTimeout(() => {
|
|
1163
|
-
toggleSidebar();
|
|
1164
|
-
}, 400);
|
|
1192
|
+
(!isNullOrUndefined(desciptionLabel2) && desciptionLabel2 !== "") ?? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_reactstrap5.UncontrolledTooltip, { target: `label-${id2}`, children: t(desciptionLabel2 ?? "") }) })
|
|
1193
|
+
] });
|
|
1165
1194
|
};
|
|
1166
|
-
return /* @__PURE__ */ (0,
|
|
1195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1167
1196
|
"div",
|
|
1168
1197
|
{
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
e.preventDefault();
|
|
1198
|
+
className: (0, import_classnames5.default)(
|
|
1199
|
+
inLine === false ? "form-group " : "form-row-inline d-flex",
|
|
1200
|
+
"align",
|
|
1201
|
+
{
|
|
1202
|
+
[labelSize ? labelSize : ""]: labelSize,
|
|
1203
|
+
"form-row-inline-error": errors
|
|
1176
1204
|
}
|
|
1177
|
-
|
|
1205
|
+
),
|
|
1178
1206
|
children: [
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
}
|
|
1229
|
-
)
|
|
1207
|
+
renderLabel({ isLabel, desciptionLabel, classLabel, name, label, required, id: id ?? "" }),
|
|
1208
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_classnames5.default)("form-input-content", { "hidden-label": isLabel === false }), children: [
|
|
1209
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1210
|
+
import_react_hook_form3.Controller,
|
|
1211
|
+
{
|
|
1212
|
+
name,
|
|
1213
|
+
control,
|
|
1214
|
+
render: ({ field: { value, onChange } }) => {
|
|
1215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1216
|
+
SelectTable,
|
|
1217
|
+
{
|
|
1218
|
+
...rest,
|
|
1219
|
+
id,
|
|
1220
|
+
value: (isMulti ? value?.length > 0 : value) ? !isMulti ? defaultOptions.find((val) => val[fieldValue ?? "value"] === value) ?? (defaultValue ?? "") : value : isMulti ? [] : void 0,
|
|
1221
|
+
onChange: (val) => {
|
|
1222
|
+
if (isMulti || (fieldValue && val ? val[fieldValue] : val?.value) !== value) {
|
|
1223
|
+
if (confirmHandle) {
|
|
1224
|
+
confirmHandle(handChange, onChange, val);
|
|
1225
|
+
} else {
|
|
1226
|
+
if (isMulti) {
|
|
1227
|
+
onChange(!isNullOrUndefined(val) ? val.map((item) => item[fieldValue ?? "value"]) : []);
|
|
1228
|
+
} else {
|
|
1229
|
+
onChange(!isNullOrUndefined(val) ? val[fieldValue ?? "value"] : void 0);
|
|
1230
|
+
}
|
|
1231
|
+
if (callback) {
|
|
1232
|
+
callback(val);
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
},
|
|
1237
|
+
handleAdd: handleAddNew,
|
|
1238
|
+
isClearable,
|
|
1239
|
+
isMulti,
|
|
1240
|
+
placeholder,
|
|
1241
|
+
invalid: errors,
|
|
1242
|
+
loadOptions,
|
|
1243
|
+
options: defaultOptions,
|
|
1244
|
+
isDisabled: disabled,
|
|
1245
|
+
columns,
|
|
1246
|
+
fieldValue,
|
|
1247
|
+
fieldLabel,
|
|
1248
|
+
formatOptionLabel: labelComponent ? labelComponent : void 0
|
|
1249
|
+
}
|
|
1250
|
+
);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
),
|
|
1254
|
+
errors && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_reactstrap5.FormFeedback, { children: errors?.message })
|
|
1255
|
+
] })
|
|
1230
1256
|
]
|
|
1231
1257
|
}
|
|
1232
|
-
);
|
|
1258
|
+
) });
|
|
1233
1259
|
};
|
|
1234
|
-
var
|
|
1260
|
+
var select_table_default = SelectTableBox;
|
|
1235
1261
|
|
|
1236
|
-
// test-app/src/component/
|
|
1237
|
-
var
|
|
1238
|
-
var
|
|
1239
|
-
var
|
|
1240
|
-
const {
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1262
|
+
// test-app/src/component/edit-form/index.tsx
|
|
1263
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1264
|
+
var defaultWidth = 200;
|
|
1265
|
+
var EditForm = (0, import_react8.forwardRef)((props, ref) => {
|
|
1266
|
+
const {
|
|
1267
|
+
id,
|
|
1268
|
+
field,
|
|
1269
|
+
displayValue,
|
|
1270
|
+
menuHeight,
|
|
1271
|
+
menuWidth,
|
|
1272
|
+
rowData,
|
|
1273
|
+
invalid,
|
|
1274
|
+
onChange,
|
|
1275
|
+
onChangeField,
|
|
1276
|
+
onKeyDown,
|
|
1277
|
+
defaultValues,
|
|
1278
|
+
placeholder,
|
|
1279
|
+
textAlign,
|
|
1280
|
+
schema,
|
|
1281
|
+
onFormOpen,
|
|
1282
|
+
onFormSubmit,
|
|
1283
|
+
footerTemplate,
|
|
1284
|
+
minWidth,
|
|
1285
|
+
onPaste,
|
|
1286
|
+
openOnFocus,
|
|
1287
|
+
isClearable,
|
|
1288
|
+
labelSize = "label-small"
|
|
1289
|
+
} = props;
|
|
1290
|
+
const { innerWidth } = window;
|
|
1291
|
+
const inputRef = (0, import_react8.useRef)();
|
|
1292
|
+
const editFormRef = (0, import_react8.useRef)();
|
|
1293
|
+
const buttonRef = (0, import_react8.useRef)();
|
|
1294
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react8.useState)(false);
|
|
1295
|
+
const [itemsField, setItemsField] = (0, import_react8.useState)([]);
|
|
1296
|
+
const { t } = (0, import_react_i18next5.useTranslation)();
|
|
1297
|
+
useOnClickOutside(editFormRef, () => {
|
|
1298
|
+
closeMenu();
|
|
1299
|
+
});
|
|
1300
|
+
const closeMenu = () => {
|
|
1301
|
+
setTimeout(() => {
|
|
1302
|
+
setDropdownOpen(false);
|
|
1303
|
+
}, onChangeField ? 10 : 0);
|
|
1256
1304
|
};
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1259
|
-
|
|
1305
|
+
const {
|
|
1306
|
+
control,
|
|
1307
|
+
handleSubmit,
|
|
1308
|
+
getValues,
|
|
1309
|
+
reset,
|
|
1310
|
+
setValue,
|
|
1311
|
+
formState: { errors }
|
|
1312
|
+
} = (0, import_react_hook_form4.useForm)({
|
|
1313
|
+
mode: "onChange",
|
|
1314
|
+
defaultValues,
|
|
1315
|
+
resolver: (0, import_yup.yupResolver)(schema)
|
|
1316
|
+
});
|
|
1317
|
+
(0, import_react8.useEffect)(() => {
|
|
1318
|
+
if (dropdownOpen) {
|
|
1319
|
+
if (onFormOpen && itemsField.length === 0) {
|
|
1320
|
+
onFormOpen(rowData, itemsField, setItemsField);
|
|
1321
|
+
}
|
|
1322
|
+
if (openOnFocus) {
|
|
1323
|
+
setTimeout(() => {
|
|
1324
|
+
focusElement(`form-element-${field}-0`, true);
|
|
1325
|
+
}, 100);
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
}, [dropdownOpen]);
|
|
1329
|
+
(0, import_react8.useEffect)(() => {
|
|
1330
|
+
if (dropdownOpen && itemsField.length > 0) {
|
|
1331
|
+
itemsField.forEach((ele) => {
|
|
1332
|
+
setValue(ele.name, rowData[ele.name] ?? "");
|
|
1333
|
+
});
|
|
1334
|
+
}
|
|
1335
|
+
}, [dropdownOpen, itemsField]);
|
|
1336
|
+
const handleOnClick = () => {
|
|
1337
|
+
if (dropdownOpen) {
|
|
1338
|
+
closeMenu();
|
|
1339
|
+
} else {
|
|
1340
|
+
setDropdownOpen(true);
|
|
1341
|
+
}
|
|
1260
1342
|
};
|
|
1261
|
-
const
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
window.removeEventListener("resize", handleWindowResize);
|
|
1269
|
-
};
|
|
1270
|
-
}, []);
|
|
1271
|
-
const renderFooterButtons = () => {
|
|
1272
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react10.Fragment, { children: [
|
|
1273
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_reactstrap7.Button, { color: "primary", onClick: handleSubmit, className: "me-1", children: t("Confirm") }),
|
|
1274
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_reactstrap7.Button, { color: "secondary", onClick: handleCancel, outline: true, children: t("Close") })
|
|
1275
|
-
] });
|
|
1343
|
+
const handleOnSubmit = (val) => {
|
|
1344
|
+
closeMenu();
|
|
1345
|
+
onChange(val);
|
|
1346
|
+
if (onFormSubmit) {
|
|
1347
|
+
onFormSubmit(rowData, setValue, getValues, reset);
|
|
1348
|
+
}
|
|
1349
|
+
inputRef.current.focus();
|
|
1276
1350
|
};
|
|
1277
|
-
const
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
{
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
onChange: (e) => {
|
|
1287
|
-
if (dataSource) {
|
|
1288
|
-
dataSource[index].visible = e.target.checked;
|
|
1289
|
-
setDataSource(dataSource);
|
|
1290
|
-
}
|
|
1351
|
+
const focusElement = (id2, focus) => {
|
|
1352
|
+
const element = document.getElementById(id2);
|
|
1353
|
+
if (element) {
|
|
1354
|
+
if (element.className.includes("react-select")) {
|
|
1355
|
+
element.getElementsByTagName("input")[0]?.focus();
|
|
1356
|
+
} else {
|
|
1357
|
+
element.focus();
|
|
1358
|
+
if (focus) {
|
|
1359
|
+
element.setSelectionRange(0, element.innerText.length - 1);
|
|
1291
1360
|
}
|
|
1292
1361
|
}
|
|
1293
|
-
|
|
1362
|
+
}
|
|
1294
1363
|
};
|
|
1295
|
-
const
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
{
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1364
|
+
const handleOnKeyDown = (e) => {
|
|
1365
|
+
let flag = false;
|
|
1366
|
+
if (dropdownOpen) {
|
|
1367
|
+
if (e.code === "Escape") {
|
|
1368
|
+
closeMenu();
|
|
1369
|
+
flag = true;
|
|
1370
|
+
} else if (e.code === "Enter") {
|
|
1371
|
+
closeMenu();
|
|
1372
|
+
flag = true;
|
|
1373
|
+
} else if (e.code === "ArrowDown") {
|
|
1374
|
+
focusElement(`form-element-${field}-0`);
|
|
1375
|
+
flag = true;
|
|
1376
|
+
}
|
|
1377
|
+
} else {
|
|
1378
|
+
if (e.code === "ArrowDown") {
|
|
1379
|
+
setDropdownOpen(true);
|
|
1380
|
+
focusElement(`form-element-${field}-0`);
|
|
1381
|
+
flag = true;
|
|
1382
|
+
} else if (e.code === "Space") {
|
|
1383
|
+
setDropdownOpen(true);
|
|
1384
|
+
flag = true;
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
if (onKeyDown && !flag) {
|
|
1388
|
+
const key = onKeyDown(e);
|
|
1389
|
+
if (key === "ArrowRight" || key === "ArrowLeft") {
|
|
1390
|
+
closeMenu();
|
|
1391
|
+
}
|
|
1392
|
+
} else {
|
|
1393
|
+
e.stopPropagation();
|
|
1394
|
+
e.preventDefault();
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
const formKeyDown = (e, handSubmit) => {
|
|
1398
|
+
if (e.code === "Enter") {
|
|
1399
|
+
handSubmit();
|
|
1400
|
+
e.preventDefault();
|
|
1401
|
+
e.stopPropagation();
|
|
1402
|
+
} else {
|
|
1403
|
+
if (onKeyDown) {
|
|
1404
|
+
const key = onKeyDown(e);
|
|
1405
|
+
if (key === "ArrowRight" || key === "ArrowLeft") {
|
|
1406
|
+
closeMenu();
|
|
1316
1407
|
}
|
|
1317
1408
|
}
|
|
1318
|
-
|
|
1409
|
+
}
|
|
1319
1410
|
};
|
|
1320
|
-
const
|
|
1321
|
-
{
|
|
1322
|
-
field
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
},
|
|
1332
|
-
{
|
|
1333
|
-
field: "",
|
|
1334
|
-
template: visibleTemplate,
|
|
1335
|
-
headerText: "Display",
|
|
1336
|
-
textAlign: "center",
|
|
1337
|
-
visible: true,
|
|
1338
|
-
width: 100,
|
|
1339
|
-
maxWidth: 120,
|
|
1340
|
-
minWidth: 80
|
|
1341
|
-
},
|
|
1342
|
-
{
|
|
1343
|
-
field: "",
|
|
1344
|
-
template: fixColumnTemplate,
|
|
1345
|
-
headerText: "Fix the column",
|
|
1346
|
-
textAlign: "center",
|
|
1347
|
-
visible: true,
|
|
1348
|
-
width: 100,
|
|
1349
|
-
maxWidth: 120,
|
|
1350
|
-
minWidth: 80
|
|
1351
|
-
},
|
|
1352
|
-
{
|
|
1353
|
-
field: "width",
|
|
1354
|
-
headerText: "Column width",
|
|
1355
|
-
textAlign: "right",
|
|
1356
|
-
visible: true,
|
|
1357
|
-
width: 100,
|
|
1358
|
-
maxWidth: 120,
|
|
1359
|
-
minWidth: 80
|
|
1411
|
+
const formItemKeyDown = (e, index) => {
|
|
1412
|
+
if (e.code === "ArrowDown" && index < itemsField.length - 1) {
|
|
1413
|
+
focusElement(`form-element-${field}-${index + 1}`);
|
|
1414
|
+
e.preventDefault();
|
|
1415
|
+
e.stopPropagation();
|
|
1416
|
+
} else if (e.code === "ArrowUp" && index > 0) {
|
|
1417
|
+
focusElement(`form-element-${field}-${index - 1}`);
|
|
1418
|
+
e.preventDefault();
|
|
1419
|
+
e.stopPropagation();
|
|
1420
|
+
} else if (e.code === "Tab" && onChangeField && index === itemsField.length - 1) {
|
|
1421
|
+
closeMenu();
|
|
1360
1422
|
}
|
|
1361
|
-
|
|
1362
|
-
const
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1423
|
+
};
|
|
1424
|
+
const elementChange = (field2) => {
|
|
1425
|
+
if (onChangeField) {
|
|
1426
|
+
onChangeField(rowData, field2, setValue, getValues);
|
|
1427
|
+
const rs = getValues();
|
|
1428
|
+
if (rs) {
|
|
1429
|
+
onChange(rs);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
};
|
|
1433
|
+
const renderForm = (rows) => {
|
|
1434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_reactstrap6.Row, { className: "gy-25", children: rows.map((item, index) => {
|
|
1435
|
+
if (item.type === "numeric") {
|
|
1436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_reactstrap6.Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1437
|
+
input_number_default,
|
|
1368
1438
|
{
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1439
|
+
id: `form-element-${field}-${index}`,
|
|
1440
|
+
control,
|
|
1441
|
+
name: item.name,
|
|
1442
|
+
label: item.label ? item.label : "",
|
|
1443
|
+
labelSize: `text-left ${labelSize}`,
|
|
1444
|
+
errors: errors[item.name],
|
|
1445
|
+
disabled: item.disabled,
|
|
1446
|
+
min: item.min,
|
|
1447
|
+
max: item.max,
|
|
1448
|
+
fractionCurrency: item.fraction,
|
|
1449
|
+
callback: () => {
|
|
1450
|
+
elementChange(item.name);
|
|
1451
|
+
}
|
|
1452
|
+
},
|
|
1453
|
+
index
|
|
1454
|
+
) }, index);
|
|
1455
|
+
} else if (item.type === "text") {
|
|
1456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_reactstrap6.Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1457
|
+
input_text_default,
|
|
1458
|
+
{
|
|
1459
|
+
id: `form-element-${field}-${index}`,
|
|
1460
|
+
control,
|
|
1461
|
+
name: item.name,
|
|
1462
|
+
label: item.label ? item.label : "",
|
|
1463
|
+
labelSize: `text-left ${labelSize}`,
|
|
1464
|
+
errors: errors[item.name],
|
|
1465
|
+
disabled: item.disabled,
|
|
1466
|
+
callback: () => {
|
|
1467
|
+
elementChange(item.name);
|
|
1468
|
+
}
|
|
1469
|
+
},
|
|
1470
|
+
index
|
|
1471
|
+
) }, index);
|
|
1472
|
+
} else if (item.type === "select") {
|
|
1473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_reactstrap6.Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1474
|
+
select_table_default,
|
|
1475
|
+
{
|
|
1476
|
+
id: `form-element-${field}-${index}`,
|
|
1477
|
+
defaultOptions: item.options ?? [],
|
|
1478
|
+
control,
|
|
1479
|
+
name: item.name,
|
|
1480
|
+
label: item.label ? item.label : "",
|
|
1481
|
+
labelSize: `text-left ${labelSize}`,
|
|
1482
|
+
errors: errors[item.name],
|
|
1483
|
+
disabled: item.disabled,
|
|
1484
|
+
callback: () => {
|
|
1485
|
+
elementChange(item.name);
|
|
1486
|
+
}
|
|
1487
|
+
},
|
|
1488
|
+
index
|
|
1489
|
+
) }, index);
|
|
1490
|
+
}
|
|
1491
|
+
}) });
|
|
1397
1492
|
};
|
|
1398
|
-
return /* @__PURE__ */ (0,
|
|
1399
|
-
|
|
1493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1494
|
+
"div",
|
|
1400
1495
|
{
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
children:
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1496
|
+
className: "form-edit",
|
|
1497
|
+
ref,
|
|
1498
|
+
id,
|
|
1499
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: editFormRef, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1500
|
+
import_reactstrap6.Dropdown,
|
|
1501
|
+
{
|
|
1502
|
+
isOpen: dropdownOpen,
|
|
1503
|
+
toggle: () => {
|
|
1504
|
+
},
|
|
1505
|
+
children: [
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_reactstrap6.DropdownToggle, { tag: "div", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1507
|
+
import_reactstrap6.Input,
|
|
1413
1508
|
{
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1509
|
+
style: { backgroundColor: "#FFF", textAlign: textAlign ?? "left" },
|
|
1510
|
+
placeholder,
|
|
1511
|
+
innerRef: inputRef,
|
|
1512
|
+
className: (0, import_classnames6.default)("input-display input-numeric", { "is-invalid": invalid }),
|
|
1513
|
+
value: displayValue,
|
|
1514
|
+
onClick: handleOnClick,
|
|
1515
|
+
onKeyDown: (e) => handleOnKeyDown(e),
|
|
1516
|
+
onPaste: (e) => onPaste && onPaste(e),
|
|
1517
|
+
readOnly: true
|
|
1518
|
+
}
|
|
1519
|
+
) }),
|
|
1520
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1521
|
+
import_reactstrap6.DropdownMenu,
|
|
1522
|
+
{
|
|
1523
|
+
className: "formula-dropdown icon-dropdown p-0",
|
|
1524
|
+
style: {
|
|
1525
|
+
minWidth: minWidth ? minWidth : defaultWidth,
|
|
1526
|
+
width: menuWidth ? menuWidth : "min-content",
|
|
1527
|
+
maxWidth: innerWidth > 1280 ? 1280 : innerWidth,
|
|
1528
|
+
borderRadius: 8,
|
|
1529
|
+
zIndex: 1056
|
|
1530
|
+
},
|
|
1531
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_reactstrap6.DropdownItem, { className: "p-0", style: { borderRadius: "6px" }, tag: "div", header: true, children: [
|
|
1532
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1533
|
+
"div",
|
|
1422
1534
|
{
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
{ "cell-fixed": col.fixedType },
|
|
1426
|
-
{ "r-active": indexFocus === indexRow }
|
|
1427
|
-
),
|
|
1535
|
+
onKeyDown: (e) => formKeyDown(e, handleSubmit(handleOnSubmit)),
|
|
1536
|
+
className: "p-1",
|
|
1428
1537
|
style: {
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
},
|
|
1432
|
-
onFocus: (e) => {
|
|
1433
|
-
if (indexRow !== indexFocus) {
|
|
1434
|
-
setIndexFocus(indexRow);
|
|
1435
|
-
}
|
|
1436
|
-
e.stopPropagation();
|
|
1437
|
-
},
|
|
1438
|
-
onClick: (e) => {
|
|
1439
|
-
if (e.target.nodeName === "DIV" || e.target.nodeName === "TD") {
|
|
1440
|
-
if (indexRow !== indexFocus) {
|
|
1441
|
-
setIndexFocus(indexRow);
|
|
1442
|
-
}
|
|
1443
|
-
e.stopPropagation();
|
|
1444
|
-
}
|
|
1538
|
+
maxHeight: menuHeight ? menuHeight : 300,
|
|
1539
|
+
overflow: "auto"
|
|
1445
1540
|
},
|
|
1446
|
-
children:
|
|
1447
|
-
|
|
1541
|
+
children: itemsField ? renderForm(itemsField) : ""
|
|
1542
|
+
}
|
|
1543
|
+
),
|
|
1544
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "d-flex justify-content-between p-50", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: [
|
|
1545
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-primary py-25", style: { fontSize: 12 }, children: footerTemplate ? footerTemplate(rowData) : "" }),
|
|
1546
|
+
!onChangeField ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "d-flex justify-content-end", children: [
|
|
1547
|
+
isClearable && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1548
|
+
import_reactstrap6.Button,
|
|
1448
1549
|
{
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1550
|
+
ref: buttonRef,
|
|
1551
|
+
className: "btn me-50 py-25 px-50",
|
|
1552
|
+
outline: true,
|
|
1553
|
+
onClick: () => {
|
|
1554
|
+
itemsField.forEach((e) => {
|
|
1555
|
+
if (e.type === "numeric") {
|
|
1556
|
+
setValue(e.name, 0);
|
|
1557
|
+
} else {
|
|
1558
|
+
setValue(e.name, "");
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1452
1561
|
},
|
|
1453
|
-
|
|
1454
|
-
"
|
|
1455
|
-
|
|
1456
|
-
className: (0, import_classnames9.default)("r-rowcell-content"),
|
|
1457
|
-
style: {
|
|
1458
|
-
margin: "7px 9px"
|
|
1459
|
-
},
|
|
1460
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "r-cell-text", children: col.template ? col.template(row, indexRow) : value })
|
|
1562
|
+
onKeyDown: (e) => {
|
|
1563
|
+
if (e.code === "Tab") {
|
|
1564
|
+
closeMenu();
|
|
1461
1565
|
}
|
|
1462
|
-
|
|
1566
|
+
},
|
|
1567
|
+
children: t("Clear")
|
|
1463
1568
|
}
|
|
1464
|
-
)
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1569
|
+
),
|
|
1570
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1571
|
+
import_reactstrap6.Button,
|
|
1572
|
+
{
|
|
1573
|
+
ref: buttonRef,
|
|
1574
|
+
color: "primary",
|
|
1575
|
+
className: "btn btn-primary py-25 px-50",
|
|
1576
|
+
onClick: handleSubmit(handleOnSubmit),
|
|
1577
|
+
onKeyDown: (e) => {
|
|
1578
|
+
if (e.code === "Tab") {
|
|
1579
|
+
closeMenu();
|
|
1580
|
+
}
|
|
1581
|
+
},
|
|
1582
|
+
children: t("Save")
|
|
1583
|
+
}
|
|
1584
|
+
)
|
|
1585
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, {})
|
|
1586
|
+
] })
|
|
1587
|
+
] })
|
|
1588
|
+
}
|
|
1589
|
+
)
|
|
1590
|
+
]
|
|
1591
|
+
}
|
|
1592
|
+
) })
|
|
1483
1593
|
}
|
|
1484
1594
|
);
|
|
1485
|
-
};
|
|
1486
|
-
var
|
|
1595
|
+
});
|
|
1596
|
+
var edit_form_default = EditForm;
|
|
1487
1597
|
|
|
1488
|
-
// test-app/src/component/
|
|
1489
|
-
var
|
|
1598
|
+
// test-app/src/component/sidebar-setting-column/index.tsx
|
|
1599
|
+
var import_react10 = require("react");
|
|
1600
|
+
var import_reactstrap7 = require("reactstrap");
|
|
1601
|
+
var import_react_i18next7 = require("react-i18next");
|
|
1490
1602
|
|
|
1491
|
-
// test-app/src/component/
|
|
1492
|
-
var
|
|
1493
|
-
var
|
|
1494
|
-
var
|
|
1495
|
-
var
|
|
1496
|
-
var
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
const
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1513
|
-
"div",
|
|
1514
|
-
{
|
|
1515
|
-
className: (0, import_classnames10.default)("r-number", { "r-active": index === currentPage }),
|
|
1516
|
-
onClick: () => {
|
|
1517
|
-
onChangePage({ totalItem, pageSize, currentPage: index, old: currentPage });
|
|
1518
|
-
},
|
|
1519
|
-
children: index
|
|
1520
|
-
},
|
|
1521
|
-
`page-${index}`
|
|
1522
|
-
)
|
|
1523
|
-
);
|
|
1603
|
+
// test-app/src/component/modal-header/index.tsx
|
|
1604
|
+
var import_becoxy_icons3 = require("becoxy-icons");
|
|
1605
|
+
var import_classnames7 = __toESM(require("classnames"));
|
|
1606
|
+
var import_react_i18next6 = require("react-i18next");
|
|
1607
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1608
|
+
var ModalHeader = (props) => {
|
|
1609
|
+
const { title, handleModal, typeModal = "Edit", component } = props;
|
|
1610
|
+
const { t } = (0, import_react_i18next6.useTranslation)();
|
|
1611
|
+
const handleModalIcon = () => {
|
|
1612
|
+
if (typeModal === "Edit" || typeModal === "Approval") {
|
|
1613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_becoxy_icons3.Edit, { fontSize: 17, className: "me-1" });
|
|
1614
|
+
} else if (typeModal === "View") {
|
|
1615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_becoxy_icons3.Info, { fontSize: 17, className: "me-1" });
|
|
1616
|
+
} else if (typeModal === "Detail") {
|
|
1617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_becoxy_icons3.Info, { fontSize: 17, className: "me-1" });
|
|
1618
|
+
} else if (typeModal === "Order") {
|
|
1619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "e-icons e-sorting-1 me-1", style: { fontSize: "14px" } });
|
|
1620
|
+
} else if (typeModal === "Process") {
|
|
1621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "e-flat e-icons e-paste-match-destination me-1", style: { fontSize: "14px" } });
|
|
1622
|
+
} else {
|
|
1623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_becoxy_icons3.Plus, { fontSize: 17, className: "me-1" });
|
|
1524
1624
|
}
|
|
1525
|
-
return arr;
|
|
1526
1625
|
};
|
|
1527
|
-
return /* @__PURE__ */ (0,
|
|
1528
|
-
/* @__PURE__ */ (0,
|
|
1529
|
-
/* @__PURE__ */ (0,
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
type: "button",
|
|
1536
|
-
onClick: () => {
|
|
1537
|
-
setCurrentPageNumber(currentPageNumber - 1);
|
|
1538
|
-
onChangePage({ totalItem, pageSize, currentPage: (currentPageNumber - 2) * 5 + 1, old: currentPage });
|
|
1539
|
-
},
|
|
1540
|
-
children: "..."
|
|
1541
|
-
}
|
|
1542
|
-
),
|
|
1543
|
-
renderPageNumber(currentPageNumber),
|
|
1544
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1545
|
-
"button",
|
|
1546
|
-
{
|
|
1547
|
-
className: (0, import_classnames10.default)("r-button", { "d-none": currentPageNumber * 5 >= countPage }),
|
|
1548
|
-
type: "button",
|
|
1549
|
-
onClick: () => {
|
|
1550
|
-
setCurrentPageNumber(currentPageNumber + 1);
|
|
1551
|
-
onChangePage({ totalItem, pageSize, currentPage: currentPageNumber * 5 + 1, old: currentPage });
|
|
1552
|
-
},
|
|
1553
|
-
children: "..."
|
|
1554
|
-
}
|
|
1555
|
-
),
|
|
1556
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "r-button", type: "button", disabled: countPage <= 1 || countPage === currentPage, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage + 1, old: currentPage }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_becoxy_icons4.ChevronRight, { fontSize: 16 }) }),
|
|
1557
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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__ */ (0, import_jsx_runtime11.jsx)(import_becoxy_icons4.ChevronsRight, { fontSize: 16 }) }),
|
|
1558
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "r-pagesize", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1559
|
-
import_react_select2.default,
|
|
1560
|
-
{
|
|
1561
|
-
value: { value: pageSize, label: pageSize },
|
|
1562
|
-
options: pageOptions.map((item) => ({ value: item, label: item })),
|
|
1563
|
-
onChange: (val) => {
|
|
1564
|
-
onChangePageSize({ totalItem, pageSize: val?.value });
|
|
1565
|
-
},
|
|
1566
|
-
menuPosition: "fixed",
|
|
1567
|
-
placeholder: t("Select"),
|
|
1568
|
-
classNamePrefix: "select-pagesize"
|
|
1569
|
-
}
|
|
1570
|
-
) }),
|
|
1571
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { display: "inline", marginLeft: 10, fontSize: 13 }, children: t("pagerDropDown") })
|
|
1626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "modal-header d-flex align-items-center justify-content-between mb-1", children: [
|
|
1627
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "d-flex align-items-center justify-content-start", children: [
|
|
1628
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("h5", { className: "modal-title", children: [
|
|
1629
|
+
handleModalIcon(),
|
|
1630
|
+
" ",
|
|
1631
|
+
t(title)
|
|
1632
|
+
] }),
|
|
1633
|
+
component ? component() : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, {})
|
|
1572
1634
|
] }),
|
|
1573
|
-
/* @__PURE__ */ (0,
|
|
1574
|
-
|
|
1635
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "todo-item-action d-flex align-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1636
|
+
import_becoxy_icons3.X,
|
|
1637
|
+
{
|
|
1638
|
+
className: (0, import_classnames7.default)("fw-normal mt-25 cursor-pointer", { "d-none": !handleModal }),
|
|
1639
|
+
fontSize: 20,
|
|
1640
|
+
onClick: handleModal
|
|
1641
|
+
}
|
|
1642
|
+
) })
|
|
1643
|
+
] });
|
|
1575
1644
|
};
|
|
1645
|
+
var modal_header_default = ModalHeader;
|
|
1576
1646
|
|
|
1577
|
-
// test-app/src/component/
|
|
1578
|
-
var
|
|
1579
|
-
var
|
|
1580
|
-
var
|
|
1581
|
-
var
|
|
1582
|
-
var
|
|
1583
|
-
var import_becoxy_icons5 = require("becoxy-icons");
|
|
1584
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1585
|
-
var defaultMaxHeight = 250;
|
|
1586
|
-
var SelectTable = (0, import_react12.forwardRef)((props, ref) => {
|
|
1647
|
+
// test-app/src/component/sidebar/index.tsx
|
|
1648
|
+
var import_becoxy_icons4 = require("becoxy-icons");
|
|
1649
|
+
var import_classnames8 = __toESM(require("classnames"));
|
|
1650
|
+
var import_react9 = require("react");
|
|
1651
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1652
|
+
var Sidebar = (props) => {
|
|
1587
1653
|
const {
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
columns,
|
|
1596
|
-
decimalSeparator,
|
|
1597
|
-
thousandSeparator,
|
|
1598
|
-
onChange,
|
|
1599
|
-
value,
|
|
1600
|
-
fieldValue,
|
|
1601
|
-
fieldLabel,
|
|
1602
|
-
loadOptions,
|
|
1603
|
-
maxHeight,
|
|
1604
|
-
handleAdd,
|
|
1605
|
-
isClearable,
|
|
1606
|
-
component,
|
|
1607
|
-
formatOptionLabel,
|
|
1608
|
-
isMulti,
|
|
1609
|
-
noHeader,
|
|
1610
|
-
isDisabled,
|
|
1611
|
-
showFooter,
|
|
1612
|
-
onPaste
|
|
1654
|
+
open,
|
|
1655
|
+
children,
|
|
1656
|
+
toggleSidebar,
|
|
1657
|
+
width,
|
|
1658
|
+
keyboard,
|
|
1659
|
+
hiddenBackground,
|
|
1660
|
+
hiddenFullScreenButton
|
|
1613
1661
|
} = props;
|
|
1614
|
-
const
|
|
1615
|
-
const
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
const isSelectedAll = (0, import_react12.useMemo)(() => {
|
|
1625
|
-
return isMulti === true && (optionsLoad ? optionsLoad : options).length > 0 && value?.length >= (optionsLoad ? optionsLoad : options).length;
|
|
1626
|
-
}, [optionsLoad, options, value]);
|
|
1627
|
-
const defaultColumns = noHeader ? [
|
|
1628
|
-
{
|
|
1629
|
-
headerText: "Name",
|
|
1630
|
-
field: fieldLabel ?? "label",
|
|
1631
|
-
width: menuWidth
|
|
1632
|
-
}
|
|
1633
|
-
] : [
|
|
1634
|
-
{
|
|
1635
|
-
field: "key",
|
|
1636
|
-
headerText: "Code",
|
|
1637
|
-
width: 100,
|
|
1638
|
-
maxWidth: 120,
|
|
1639
|
-
minWidth: 80
|
|
1640
|
-
},
|
|
1641
|
-
{
|
|
1642
|
-
headerText: "Name",
|
|
1643
|
-
field: "label",
|
|
1644
|
-
width: 150,
|
|
1645
|
-
maxWidth: 200,
|
|
1646
|
-
minWidth: 250
|
|
1647
|
-
}
|
|
1648
|
-
];
|
|
1649
|
-
const closeMenu = () => {
|
|
1650
|
-
setDropdownOpen(false);
|
|
1651
|
-
};
|
|
1652
|
-
(0, import_react12.useEffect)(() => {
|
|
1653
|
-
if (dropdownOpen && value && !isMulti && selectMenuTableRef) {
|
|
1654
|
-
setTimeout(() => {
|
|
1655
|
-
const elementFocus = document.getElementById(`row-select-table-${(optionsLoad ? optionsLoad : options)?.findIndex((e) => e[fieldValue ?? "value"] === value[fieldValue ?? "value"])}`);
|
|
1656
|
-
if (elementFocus) {
|
|
1657
|
-
const parentRect = selectMenuTableRef.current.getBoundingClientRect();
|
|
1658
|
-
const childRect = elementFocus.getBoundingClientRect();
|
|
1659
|
-
const offset = childRect.top - parentRect.top + selectMenuTableRef.current.scrollTop - parentRect.height / 2 + childRect.height / 2;
|
|
1660
|
-
selectMenuTableRef.current.scrollTo({ top: offset, behavior: "smooth" });
|
|
1661
|
-
}
|
|
1662
|
-
}, 100);
|
|
1663
|
-
}
|
|
1664
|
-
}, [dropdownOpen]);
|
|
1665
|
-
(0, import_react12.useEffect)(() => {
|
|
1666
|
-
if (inputRef && !isDisabled) {
|
|
1667
|
-
inputRef.current.addEventListener("blur", function() {
|
|
1668
|
-
setDropdownOpen(false);
|
|
1669
|
-
setSearchTerm("");
|
|
1670
|
-
setIsFocus(false);
|
|
1671
|
-
});
|
|
1672
|
-
inputRef.current.addEventListener("focus", function() {
|
|
1673
|
-
if (!isFocus) {
|
|
1674
|
-
setIsFocus(true);
|
|
1675
|
-
}
|
|
1676
|
-
});
|
|
1677
|
-
}
|
|
1678
|
-
}, [inputRef]);
|
|
1679
|
-
(0, import_react12.useEffect)(() => {
|
|
1680
|
-
if (searchTerm && !dropdownOpen) {
|
|
1681
|
-
setDropdownOpen(true);
|
|
1682
|
-
setIndexFocus(0);
|
|
1683
|
-
}
|
|
1684
|
-
}, [searchTerm]);
|
|
1685
|
-
const handleOpenClose = () => {
|
|
1686
|
-
setSearchTerm("");
|
|
1687
|
-
if (dropdownOpen) {
|
|
1688
|
-
closeMenu();
|
|
1689
|
-
} else {
|
|
1690
|
-
if (!isDisabled) {
|
|
1691
|
-
setDropdownOpen(true);
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
};
|
|
1695
|
-
const listKeyUse = ["Escape", "Space", "Enter", "Tab", "NumpadEnter", "ArrowDown", "ArrowUp", "F9"];
|
|
1696
|
-
const handleOnKeyDown = (e) => {
|
|
1697
|
-
let key = "";
|
|
1698
|
-
if (onKeyDown && (!dropdownOpen || !listKeyUse.includes(e.code))) {
|
|
1699
|
-
key = onKeyDown(e);
|
|
1700
|
-
if (key === "ArrowRight" || key === "ArrowLeft") {
|
|
1701
|
-
closeMenu();
|
|
1662
|
+
const [isFullScreen, setIsFullScreen] = (0, import_react9.useState)(false);
|
|
1663
|
+
const [flag, setFlag] = (0, import_react9.useState)(open);
|
|
1664
|
+
(0, import_react9.useEffect)(() => {
|
|
1665
|
+
if (open !== flag) {
|
|
1666
|
+
if (open) {
|
|
1667
|
+
setFlag(open);
|
|
1668
|
+
} else {
|
|
1669
|
+
setTimeout(() => {
|
|
1670
|
+
setFlag(open);
|
|
1671
|
+
}, 50);
|
|
1702
1672
|
}
|
|
1703
1673
|
}
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
onChange((optionsLoad ? optionsLoad : options)[indexFocus]);
|
|
1722
|
-
handleOpenClose();
|
|
1723
|
-
flag = true;
|
|
1674
|
+
}, [open]);
|
|
1675
|
+
const handClose = () => {
|
|
1676
|
+
setFlag(false);
|
|
1677
|
+
setTimeout(() => {
|
|
1678
|
+
toggleSidebar();
|
|
1679
|
+
}, 400);
|
|
1680
|
+
};
|
|
1681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1682
|
+
"div",
|
|
1683
|
+
{
|
|
1684
|
+
tabIndex: 0,
|
|
1685
|
+
className: (0, import_classnames8.default)({ "d-none": !open }),
|
|
1686
|
+
onKeyDown: (e) => {
|
|
1687
|
+
if (!keyboard && e.code === "Escape" && flag) {
|
|
1688
|
+
handClose();
|
|
1689
|
+
e.stopPropagation();
|
|
1690
|
+
e.preventDefault();
|
|
1724
1691
|
}
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
} else {
|
|
1737
|
-
setIndexFocus(0);
|
|
1738
|
-
checkIfElementIsOutOfScroll(1, 0);
|
|
1692
|
+
},
|
|
1693
|
+
children: [
|
|
1694
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1695
|
+
"div",
|
|
1696
|
+
{
|
|
1697
|
+
className: (0, import_classnames8.default)("offcanvas-backdrop fade", {
|
|
1698
|
+
"d-none": !flag || hiddenBackground,
|
|
1699
|
+
show: flag
|
|
1700
|
+
}),
|
|
1701
|
+
style: { zIndex: 1056 },
|
|
1702
|
+
onClick: handClose
|
|
1739
1703
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1704
|
+
),
|
|
1705
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1706
|
+
"div",
|
|
1707
|
+
{
|
|
1708
|
+
className: (0, import_classnames8.default)("customizer d-none d-md-block ", `customizer-${width ?? 600}`, {
|
|
1709
|
+
open: flag,
|
|
1710
|
+
fullscreen: isFullScreen
|
|
1711
|
+
}),
|
|
1712
|
+
style: { zIndex: 1057 },
|
|
1713
|
+
children: [
|
|
1714
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1715
|
+
"div",
|
|
1716
|
+
{
|
|
1717
|
+
style: {
|
|
1718
|
+
position: "fixed",
|
|
1719
|
+
top: "50%",
|
|
1720
|
+
transform: "translate(-50%, -50%)",
|
|
1721
|
+
background: "#FFF",
|
|
1722
|
+
filter: "drop-shadow(0.9px 0.9px 1.5px)",
|
|
1723
|
+
height: 50,
|
|
1724
|
+
display: "flex",
|
|
1725
|
+
alignItems: "center",
|
|
1726
|
+
borderRadius: "0px 5px 5px 0px",
|
|
1727
|
+
cursor: "pointer",
|
|
1728
|
+
zIndex: 9,
|
|
1729
|
+
marginLeft: 7
|
|
1730
|
+
},
|
|
1731
|
+
className: (0, import_classnames8.default)({ "d-none": hiddenFullScreenButton }),
|
|
1732
|
+
onClick: () => {
|
|
1733
|
+
setIsFullScreen(!isFullScreen);
|
|
1734
|
+
},
|
|
1735
|
+
children: [
|
|
1736
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_becoxy_icons4.ChevronLeft, { className: `${isFullScreen ? "d-none" : ""}`, fontSize: 16 }),
|
|
1737
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_becoxy_icons4.ChevronRight, { className: `${!isFullScreen ? "d-none" : ""}`, fontSize: 15 })
|
|
1738
|
+
]
|
|
1739
|
+
}
|
|
1740
|
+
),
|
|
1741
|
+
children
|
|
1742
|
+
]
|
|
1752
1743
|
}
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1744
|
+
)
|
|
1745
|
+
]
|
|
1746
|
+
}
|
|
1747
|
+
);
|
|
1748
|
+
};
|
|
1749
|
+
var sidebar_default = Sidebar;
|
|
1750
|
+
|
|
1751
|
+
// test-app/src/component/sidebar-setting-column/index.tsx
|
|
1752
|
+
var import_classnames9 = __toESM(require("classnames"));
|
|
1753
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1754
|
+
var SidebarSetColumn = (props) => {
|
|
1755
|
+
const { column, setColumn, openSidebar, handleSidebar } = props;
|
|
1756
|
+
const { t } = (0, import_react_i18next7.useTranslation)();
|
|
1757
|
+
const [dataSource, setDataSource] = (0, import_react10.useState)([]);
|
|
1758
|
+
const [indexFocus, setIndexFocus] = (0, import_react10.useState)();
|
|
1759
|
+
(0, import_react10.useEffect)(() => {
|
|
1760
|
+
if (openSidebar) {
|
|
1761
|
+
setDataSource(column.map((e) => ({ ...e })));
|
|
1762
|
+
}
|
|
1763
|
+
}, [openSidebar]);
|
|
1764
|
+
const handleCancel = () => {
|
|
1765
|
+
handleSidebar();
|
|
1766
|
+
setDataSource([]);
|
|
1767
|
+
};
|
|
1768
|
+
const handleSubmit = () => {
|
|
1769
|
+
setColumn([...dataSource]);
|
|
1770
|
+
handleCancel();
|
|
1771
|
+
};
|
|
1772
|
+
const getWindowSize = () => {
|
|
1773
|
+
const { innerWidth, innerHeight } = window;
|
|
1774
|
+
return { innerWidth, innerHeight };
|
|
1775
|
+
};
|
|
1776
|
+
const [windowSize, setWindowSize] = (0, import_react10.useState)(getWindowSize());
|
|
1777
|
+
(0, import_react10.useEffect)(() => {
|
|
1778
|
+
const handleWindowResize = () => {
|
|
1779
|
+
setWindowSize(getWindowSize());
|
|
1780
|
+
};
|
|
1781
|
+
window.addEventListener("resize", handleWindowResize);
|
|
1782
|
+
return () => {
|
|
1783
|
+
window.removeEventListener("resize", handleWindowResize);
|
|
1784
|
+
};
|
|
1785
|
+
}, []);
|
|
1786
|
+
const renderFooterButtons = () => {
|
|
1787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react10.Fragment, { children: [
|
|
1788
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_reactstrap7.Button, { color: "primary", onClick: handleSubmit, className: "me-1", children: t("Confirm") }),
|
|
1789
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_reactstrap7.Button, { color: "secondary", onClick: handleCancel, outline: true, children: t("Close") })
|
|
1790
|
+
] });
|
|
1791
|
+
};
|
|
1792
|
+
const visibleTemplate = (item, index) => {
|
|
1793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1794
|
+
import_reactstrap7.Input,
|
|
1795
|
+
{
|
|
1796
|
+
defaultChecked: item.visible ?? true,
|
|
1797
|
+
disabled: item.invisibleDisable,
|
|
1798
|
+
type: "checkbox",
|
|
1799
|
+
style: { height: 18 },
|
|
1800
|
+
className: " cursor-pointer",
|
|
1801
|
+
onChange: (e) => {
|
|
1802
|
+
if (dataSource) {
|
|
1803
|
+
dataSource[index].visible = e.target.checked;
|
|
1804
|
+
setDataSource(dataSource);
|
|
1759
1805
|
}
|
|
1760
|
-
flag = true;
|
|
1761
1806
|
}
|
|
1762
1807
|
}
|
|
1763
|
-
|
|
1764
|
-
if (flag) {
|
|
1765
|
-
e.stopPropagation();
|
|
1766
|
-
e.preventDefault();
|
|
1767
|
-
}
|
|
1808
|
+
);
|
|
1768
1809
|
};
|
|
1769
|
-
const
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1810
|
+
const fixColumnTemplate = (item, index) => {
|
|
1811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1812
|
+
import_reactstrap7.Input,
|
|
1813
|
+
{
|
|
1814
|
+
defaultChecked: item.fixedType === "left" || item.fixedType === "right",
|
|
1815
|
+
type: "checkbox",
|
|
1816
|
+
style: { height: 18 },
|
|
1817
|
+
className: " cursor-pointer",
|
|
1818
|
+
onChange: (e) => {
|
|
1819
|
+
if (dataSource) {
|
|
1820
|
+
if (e.target.checked) {
|
|
1821
|
+
if (index * 2 <= dataSource.length) {
|
|
1822
|
+
dataSource[index].fixedType = "left";
|
|
1823
|
+
} else {
|
|
1824
|
+
dataSource[index].fixedType = "right";
|
|
1825
|
+
}
|
|
1826
|
+
} else {
|
|
1827
|
+
dataSource[index].fixedType = void 0;
|
|
1828
|
+
}
|
|
1829
|
+
setDataSource(dataSource);
|
|
1830
|
+
}
|
|
1784
1831
|
}
|
|
1785
1832
|
}
|
|
1833
|
+
);
|
|
1834
|
+
};
|
|
1835
|
+
const columns = [
|
|
1836
|
+
{
|
|
1837
|
+
field: "headerText",
|
|
1838
|
+
headerText: "Column name",
|
|
1839
|
+
template: (e) => {
|
|
1840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: t(e.headerText) });
|
|
1841
|
+
},
|
|
1842
|
+
visible: true,
|
|
1843
|
+
width: 175,
|
|
1844
|
+
maxWidth: 200,
|
|
1845
|
+
minWidth: 150
|
|
1846
|
+
},
|
|
1847
|
+
{
|
|
1848
|
+
field: "",
|
|
1849
|
+
template: visibleTemplate,
|
|
1850
|
+
headerText: "Display",
|
|
1851
|
+
textAlign: "center",
|
|
1852
|
+
visible: true,
|
|
1853
|
+
width: 100,
|
|
1854
|
+
maxWidth: 120,
|
|
1855
|
+
minWidth: 80
|
|
1856
|
+
},
|
|
1857
|
+
{
|
|
1858
|
+
field: "",
|
|
1859
|
+
template: fixColumnTemplate,
|
|
1860
|
+
headerText: "Fix the column",
|
|
1861
|
+
textAlign: "center",
|
|
1862
|
+
visible: true,
|
|
1863
|
+
width: 100,
|
|
1864
|
+
maxWidth: 120,
|
|
1865
|
+
minWidth: 80
|
|
1866
|
+
},
|
|
1867
|
+
{
|
|
1868
|
+
field: "width",
|
|
1869
|
+
headerText: "Column width",
|
|
1870
|
+
textAlign: "right",
|
|
1871
|
+
visible: true,
|
|
1872
|
+
width: 100,
|
|
1873
|
+
maxWidth: 120,
|
|
1874
|
+
minWidth: 80
|
|
1786
1875
|
}
|
|
1787
|
-
|
|
1788
|
-
let timeOutElement;
|
|
1789
|
-
const scrollToElement = (elemment, top) => {
|
|
1790
|
-
clearTimeout(timeOutElement);
|
|
1791
|
-
timeOutElement = setTimeout(() => {
|
|
1792
|
-
elemment.scrollTo({
|
|
1793
|
-
top,
|
|
1794
|
-
behavior: "smooth"
|
|
1795
|
-
});
|
|
1796
|
-
}, 100);
|
|
1797
|
-
};
|
|
1876
|
+
];
|
|
1798
1877
|
const renderHeaderCol = (col, indexCol) => {
|
|
1799
|
-
return /* @__PURE__ */ (0,
|
|
1800
|
-
|
|
1878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1879
|
+
import_react10.Fragment,
|
|
1801
1880
|
{
|
|
1802
|
-
children: col.visible !== false && /* @__PURE__ */ (0,
|
|
1881
|
+
children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1803
1882
|
"th",
|
|
1804
1883
|
{
|
|
1805
|
-
className: (0,
|
|
1806
|
-
`r-
|
|
1884
|
+
className: (0, import_classnames9.default)(
|
|
1885
|
+
`r-headercell fix-${col.fixedType}`,
|
|
1807
1886
|
{ "cell-fixed": col.fixedType }
|
|
1808
1887
|
),
|
|
1809
1888
|
style: {
|
|
1810
1889
|
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
|
|
1811
1890
|
minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
|
|
1812
|
-
top: `${0 *
|
|
1891
|
+
top: `${0 * 42}px`,
|
|
1813
1892
|
maxWidth: col.maxWidth
|
|
1814
1893
|
},
|
|
1815
|
-
children: /* @__PURE__ */ (0,
|
|
1894
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1816
1895
|
"div",
|
|
1817
1896
|
{
|
|
1818
1897
|
role: "textbox",
|
|
1819
1898
|
title: t(col.headerText ?? ""),
|
|
1820
1899
|
style: {
|
|
1821
|
-
height: `${1 *
|
|
1900
|
+
height: `${1 * 42}px`,
|
|
1822
1901
|
justifyContent: col.textAlign ?? "left"
|
|
1823
1902
|
},
|
|
1824
|
-
className: "r-
|
|
1903
|
+
className: "r-headercell-div",
|
|
1825
1904
|
children: t(col.headerText ?? "")
|
|
1826
1905
|
}
|
|
1827
1906
|
)
|
|
1828
1907
|
}
|
|
1829
1908
|
)
|
|
1830
1909
|
},
|
|
1831
|
-
`header
|
|
1832
|
-
);
|
|
1833
|
-
};
|
|
1834
|
-
const checkSearch = (keyword, data, columnsSearch) => {
|
|
1835
|
-
if (!keyword || columnsSearch.length === 0) {
|
|
1836
|
-
return true;
|
|
1837
|
-
}
|
|
1838
|
-
for (let index = 0; index < columnsSearch.length; index++) {
|
|
1839
|
-
const key = columnsSearch[index].field.trim();
|
|
1840
|
-
if (data[key] && data[key].toString().trim().toLowerCase().includes(keyword.trim().toLowerCase())) {
|
|
1841
|
-
return true;
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
return false;
|
|
1845
|
-
};
|
|
1846
|
-
const callbackLoadOption = (rs) => {
|
|
1847
|
-
setIsLoading(false);
|
|
1848
|
-
setOptionsLoad(rs);
|
|
1849
|
-
};
|
|
1850
|
-
(0, import_react12.useEffect)(() => {
|
|
1851
|
-
if (!searchTerm) {
|
|
1852
|
-
setOptionsLoad(void 0);
|
|
1853
|
-
}
|
|
1854
|
-
}, [searchTerm]);
|
|
1855
|
-
const checkOverflow = (indexRow, indexCol) => {
|
|
1856
|
-
const element = document.getElementById(`select-${id}-${indexRow}-${indexCol}`);
|
|
1857
|
-
return element && element.scrollWidth > element.clientWidth;
|
|
1858
|
-
};
|
|
1859
|
-
const RenderElement = (props2) => {
|
|
1860
|
-
const { indexRow, row, isSelected, level = 0 } = props2;
|
|
1861
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1862
|
-
"tr",
|
|
1863
|
-
{
|
|
1864
|
-
id: `row-select-table-${indexRow}`,
|
|
1865
|
-
style: { paddingLeft: 10 * level },
|
|
1866
|
-
className: (0, import_classnames11.default)("r-select-row", { "last-row": indexRow === (optionsLoad ? optionsLoad : options).length - 1 }, { "fisrt-row": indexRow === 0 }),
|
|
1867
|
-
children: [
|
|
1868
|
-
isMulti && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1869
|
-
"td",
|
|
1870
|
-
{
|
|
1871
|
-
className: (0, import_classnames11.default)(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
|
|
1872
|
-
style: { width: 40, textAlign: "center", padding: 0, paddingBottom: 6 },
|
|
1873
|
-
onClick: (e) => {
|
|
1874
|
-
if (isMulti) {
|
|
1875
|
-
const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
|
|
1876
|
-
if (index > -1) {
|
|
1877
|
-
value?.splice(index, 1);
|
|
1878
|
-
const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
|
|
1879
|
-
onChange(valueArr);
|
|
1880
|
-
} else {
|
|
1881
|
-
if (value) {
|
|
1882
|
-
value?.push(row[fieldValue ?? "value"]);
|
|
1883
|
-
const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
|
|
1884
|
-
onChange(valueArr);
|
|
1885
|
-
} else {
|
|
1886
|
-
onChange([row[fieldValue ?? "value"]]);
|
|
1887
|
-
}
|
|
1888
|
-
}
|
|
1889
|
-
e.stopPropagation();
|
|
1890
|
-
}
|
|
1891
|
-
},
|
|
1892
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1893
|
-
import_reactstrap8.Input,
|
|
1894
|
-
{
|
|
1895
|
-
checked: isSelected,
|
|
1896
|
-
type: "checkbox",
|
|
1897
|
-
className: "cursor-pointer",
|
|
1898
|
-
onChange: () => {
|
|
1899
|
-
},
|
|
1900
|
-
style: { textAlign: "center", marginTop: 6 }
|
|
1901
|
-
}
|
|
1902
|
-
)
|
|
1903
|
-
}
|
|
1904
|
-
),
|
|
1905
|
-
(columns ? columns : defaultColumns).map((col, indexCol) => {
|
|
1906
|
-
let valueDisplay = row[col.field];
|
|
1907
|
-
if (col.type === "numeric" || col.typeCondition && col.typeCondition(row) === "numeric") {
|
|
1908
|
-
valueDisplay = formartNumberic(row[col.field], decimalSeparator ?? ".", thousandSeparator ?? ",", col.fraction ?? 0, true) ?? 0;
|
|
1909
|
-
} else if (col.type === "date") {
|
|
1910
|
-
valueDisplay = valueDisplay ? (0, import_moment.default)(valueDisplay).format("DD/MM/yyyy") : "";
|
|
1911
|
-
} else if (col.type === "datetime") {
|
|
1912
|
-
valueDisplay = valueDisplay ? (0, import_moment.default)(valueDisplay).format("DD/MM/yyyy HH:mm") : "";
|
|
1913
|
-
}
|
|
1914
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react12.Fragment, { children: [
|
|
1915
|
-
col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1916
|
-
"td",
|
|
1917
|
-
{
|
|
1918
|
-
id: `select-${id}-${indexRow}-${indexCol}`,
|
|
1919
|
-
className: (0, import_classnames11.default)(`r-select-rowcell`, { "r-select-move": indexFocus === indexRow, "r-select-active": !isMulti && value && value[fieldValue ?? "value"] === row[fieldValue ?? "value"] }),
|
|
1920
|
-
style: {
|
|
1921
|
-
minWidth: col.minWidth,
|
|
1922
|
-
width: col.width,
|
|
1923
|
-
maxWidth: col.maxWidth,
|
|
1924
|
-
textAlign: col.textAlign ? col.textAlign : "left"
|
|
1925
|
-
},
|
|
1926
|
-
onClick: (e) => {
|
|
1927
|
-
if (isMulti) {
|
|
1928
|
-
const index = value?.findIndex((x) => x === row[fieldValue ?? "value"]);
|
|
1929
|
-
if (index > -1) {
|
|
1930
|
-
value?.splice(index, 1);
|
|
1931
|
-
const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
|
|
1932
|
-
onChange(valueArr);
|
|
1933
|
-
} else {
|
|
1934
|
-
if (value) {
|
|
1935
|
-
value?.push(row[fieldValue ?? "value"]);
|
|
1936
|
-
const valueArr = (optionsLoad ? optionsLoad : options).filter((ele) => value?.some((x) => x === ele[fieldValue ?? "value"]));
|
|
1937
|
-
onChange(valueArr);
|
|
1938
|
-
} else {
|
|
1939
|
-
onChange([row[fieldValue ?? "value"]]);
|
|
1940
|
-
}
|
|
1941
|
-
}
|
|
1942
|
-
} else {
|
|
1943
|
-
onChange(row);
|
|
1944
|
-
setSearchTerm("");
|
|
1945
|
-
closeMenu();
|
|
1946
|
-
}
|
|
1947
|
-
e.preventDefault();
|
|
1948
|
-
e.stopPropagation();
|
|
1949
|
-
},
|
|
1950
|
-
onMouseMove: (e) => {
|
|
1951
|
-
if (indexRow !== indexFocus) {
|
|
1952
|
-
setIndexFocus(indexRow);
|
|
1953
|
-
}
|
|
1954
|
-
e.stopPropagation();
|
|
1955
|
-
},
|
|
1956
|
-
children: col.template ? col.template(row, indexRow) : valueDisplay
|
|
1957
|
-
},
|
|
1958
|
-
`col-${indexRow}-${indexCol}`
|
|
1959
|
-
),
|
|
1960
|
-
checkOverflow(indexRow, indexCol) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_reactstrap8.UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `select-${id}-${indexRow}-${indexCol}`, children: col.template ? col.template(row, indexRow) : valueDisplay })
|
|
1961
|
-
] }, indexCol);
|
|
1962
|
-
})
|
|
1963
|
-
]
|
|
1964
|
-
},
|
|
1965
|
-
`row-${indexRow}`
|
|
1910
|
+
`header-${indexCol}`
|
|
1966
1911
|
);
|
|
1967
1912
|
};
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
}
|
|
1993
|
-
},
|
|
1994
|
-
readOnly: true,
|
|
1995
|
-
className: (0, import_classnames11.default)("cursor-pointer", { "d-none": !isMulti }),
|
|
1996
|
-
style: { textAlign: "center", marginTop: 6 }
|
|
1997
|
-
}
|
|
1998
|
-
)
|
|
1999
|
-
}
|
|
2000
|
-
) }),
|
|
2001
|
-
!noHeader && (columns ? columns : defaultColumns).map((col, index) => {
|
|
2002
|
-
return renderHeaderCol(col, index);
|
|
2003
|
-
})
|
|
2004
|
-
] }) }),
|
|
2005
|
-
(optionsLoad ? optionsLoad : options).length > 0 && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: "r-select-gridcontent", children: (optionsLoad ? optionsLoad : options)?.map((row, indexRow) => {
|
|
2006
|
-
if (!isMulti && loadOptions || checkSearch(searchTerm, row, columns ? columns : defaultColumns)) {
|
|
2007
|
-
const isSelected = isMulti && value?.some((x) => x === row[fieldValue ?? "value"]);
|
|
2008
|
-
countDisplay++;
|
|
2009
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RenderElement, { isSelected, indexRow, row }, `select-table-${indexRow}`);
|
|
2010
|
-
}
|
|
2011
|
-
}) }) })
|
|
2012
|
-
] }),
|
|
2013
|
-
countDisplay === 0 && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "r-no-data", children: [
|
|
2014
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [
|
|
2015
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }),
|
|
2016
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [
|
|
2017
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" }),
|
|
2018
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" })
|
|
2019
|
-
] })
|
|
2020
|
-
] }) }),
|
|
2021
|
-
t("No data available.")
|
|
2022
|
-
] }),
|
|
2023
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "r-no-data", children: [
|
|
2024
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_reactstrap8.Spinner, { className: "me-1", children: " " }),
|
|
2025
|
-
t("Loading...")
|
|
2026
|
-
] })
|
|
2027
|
-
] });
|
|
2028
|
-
};
|
|
2029
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2030
|
-
"div",
|
|
2031
|
-
{
|
|
2032
|
-
className: (0, import_classnames11.default)("react-select-table", { "is-invalid": invalid }),
|
|
2033
|
-
ref,
|
|
2034
|
-
id,
|
|
2035
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ref: selectTableRef, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2036
|
-
import_reactstrap8.Dropdown,
|
|
2037
|
-
{
|
|
2038
|
-
isOpen: dropdownOpen,
|
|
2039
|
-
toggle: () => {
|
|
2040
|
-
},
|
|
2041
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
2042
|
-
children: [
|
|
2043
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2044
|
-
import_reactstrap8.DropdownToggle,
|
|
2045
|
-
{
|
|
2046
|
-
onClick: (e) => {
|
|
2047
|
-
if (!isDisabled) {
|
|
2048
|
-
inputRef?.current.focus();
|
|
2049
|
-
handleOpenClose();
|
|
2050
|
-
}
|
|
2051
|
-
e.preventDefault();
|
|
2052
|
-
},
|
|
2053
|
-
tag: "div",
|
|
2054
|
-
className: (0, import_classnames11.default)("select-table-control", { "r-select-is-disabled": isDisabled }, { "r-select-is-open": dropdownOpen }, { "r-select-is-focus": isFocus }, { "r-select-is-invalid": invalid }),
|
|
2055
|
-
children: [
|
|
2056
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "select-table-container", children: [
|
|
2057
|
-
isMulti ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: (0, import_classnames11.default)("select-value is-mutil", { "d-none": searchTerm }), children: value?.map((ele, index) => {
|
|
2058
|
-
const element = (optionsLoad ? optionsLoad : options).find((e) => e[fieldValue ?? "value"] === ele);
|
|
2059
|
-
if (element) {
|
|
2060
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
|
|
2061
|
-
index === 0 ? "" : ", ",
|
|
2062
|
-
element[fieldLabel ?? "label"]
|
|
2063
|
-
] }, index);
|
|
2064
|
-
}
|
|
2065
|
-
}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_classnames11.default)("select-value", { "d-none": searchTerm }), children: [
|
|
2066
|
-
value ? formatOptionLabel ? formatOptionLabel(value) : value[fieldLabel ?? "label"] : "",
|
|
2067
|
-
" "
|
|
2068
|
-
] }) }),
|
|
2069
|
-
!((isMulti ? value?.length > 0 : value) || isDisabled || searchTerm) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: (0, import_classnames11.default)("select-placeholder"), children: placeholder }),
|
|
2070
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "input-container", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2071
|
-
"input",
|
|
2072
|
-
{
|
|
2073
|
-
style: { textAlign: textAlign ?? "left" },
|
|
2074
|
-
ref: inputRef,
|
|
2075
|
-
className: (0, import_classnames11.default)("select-input"),
|
|
2076
|
-
readOnly: isDisabled,
|
|
2077
|
-
value: searchTerm,
|
|
2078
|
-
onPaste: (e) => onPaste && !dropdownOpen && onPaste(e),
|
|
2079
|
-
onChange: (val) => {
|
|
2080
|
-
if (!isMulti && loadOptions && val.target.value) {
|
|
2081
|
-
setIsLoading(true);
|
|
2082
|
-
loadOptions(val.target.value, callbackLoadOption);
|
|
2083
|
-
}
|
|
2084
|
-
setSearchTerm(val.target.value);
|
|
2085
|
-
},
|
|
2086
|
-
onKeyDown: (e) => handleOnKeyDown(e)
|
|
2087
|
-
}
|
|
2088
|
-
) })
|
|
2089
|
-
] }),
|
|
2090
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_classnames11.default)("select-table-indicator d-flex align-items-center"), children: [
|
|
2091
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_reactstrap8.Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" }),
|
|
2092
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_reactstrap8.Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" }),
|
|
2093
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_reactstrap8.Spinner, { style: { width: 4, height: 4, marginRight: 3 }, type: "grow" })
|
|
2094
|
-
] }),
|
|
2095
|
-
isClearable && value && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2096
|
-
"div",
|
|
1913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1914
|
+
sidebar_default,
|
|
1915
|
+
{
|
|
1916
|
+
open: openSidebar,
|
|
1917
|
+
toggleSidebar: handleCancel,
|
|
1918
|
+
width: 700,
|
|
1919
|
+
children: [
|
|
1920
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(modal_header_default, { typeModal: "Edit", handleModal: handleCancel, title: "Column setup" }),
|
|
1921
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ms-2 react-table-edit", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "r-grid", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "r-gridtable", style: { height: windowSize.innerHeight - 120 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("table", { style: { width: "100%" }, children: [
|
|
1922
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("thead", { className: "r-gridheader", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tr", { className: "r-row", role: "row", children: columns.map((col, index) => {
|
|
1923
|
+
return renderHeaderCol(col, index);
|
|
1924
|
+
}) }) }),
|
|
1925
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tbody", { className: "r-gridcontent", children: dataSource?.map((row, indexRow) => {
|
|
1926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1927
|
+
"tr",
|
|
1928
|
+
{
|
|
1929
|
+
className: (0, import_classnames9.default)("r-row", { "last-row": indexRow === dataSource.length - 1 }, { "fisrt-row": indexRow === 0 }),
|
|
1930
|
+
children: columns.map((col, indexCol) => {
|
|
1931
|
+
let value = row[col.field];
|
|
1932
|
+
if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
|
|
1933
|
+
value = formartNumberic(row[col.field], ",", ".", col.numericSettings?.fraction, true) ?? 0;
|
|
1934
|
+
}
|
|
1935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react10.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1936
|
+
"td",
|
|
2097
1937
|
{
|
|
2098
|
-
className: (0,
|
|
2099
|
-
|
|
2100
|
-
|
|
1938
|
+
className: (0, import_classnames9.default)(
|
|
1939
|
+
`r-rowcell fix-${col.fixedType}`,
|
|
1940
|
+
{ "cell-fixed": col.fixedType },
|
|
1941
|
+
{ "r-active": indexFocus === indexRow }
|
|
1942
|
+
),
|
|
1943
|
+
style: {
|
|
1944
|
+
padding: 0,
|
|
1945
|
+
textAlign: col.textAlign ? col.textAlign : "left"
|
|
1946
|
+
},
|
|
1947
|
+
onFocus: (e) => {
|
|
1948
|
+
if (indexRow !== indexFocus) {
|
|
1949
|
+
setIndexFocus(indexRow);
|
|
1950
|
+
}
|
|
2101
1951
|
e.stopPropagation();
|
|
2102
1952
|
},
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
1953
|
+
onClick: (e) => {
|
|
1954
|
+
if (e.target.nodeName === "DIV" || e.target.nodeName === "TD") {
|
|
1955
|
+
if (indexRow !== indexFocus) {
|
|
1956
|
+
setIndexFocus(indexRow);
|
|
1957
|
+
}
|
|
1958
|
+
e.stopPropagation();
|
|
1959
|
+
}
|
|
1960
|
+
},
|
|
1961
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1962
|
+
"div",
|
|
1963
|
+
{
|
|
1964
|
+
className: (0, import_classnames9.default)("r-rowcell-div"),
|
|
1965
|
+
style: {
|
|
1966
|
+
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto"
|
|
1967
|
+
},
|
|
1968
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1969
|
+
"div",
|
|
1970
|
+
{
|
|
1971
|
+
className: (0, import_classnames9.default)("r-rowcell-content"),
|
|
1972
|
+
style: {
|
|
1973
|
+
margin: "7px 9px"
|
|
1974
|
+
},
|
|
1975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "r-cell-text", children: col.template ? col.template(row, indexRow) : value })
|
|
1976
|
+
}
|
|
1977
|
+
)
|
|
1978
|
+
}
|
|
1979
|
+
)
|
|
2129
1980
|
},
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
1981
|
+
`col-${indexRow}-${indexCol}`
|
|
1982
|
+
) }, indexCol);
|
|
1983
|
+
})
|
|
1984
|
+
},
|
|
1985
|
+
`row-${indexRow}`
|
|
1986
|
+
);
|
|
1987
|
+
}) })
|
|
1988
|
+
] }) }) }) }),
|
|
1989
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1990
|
+
"div",
|
|
1991
|
+
{
|
|
1992
|
+
className: "d-flex justify-content-end p-1 ",
|
|
1993
|
+
style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" },
|
|
1994
|
+
children: renderFooterButtons()
|
|
1995
|
+
}
|
|
1996
|
+
)
|
|
1997
|
+
]
|
|
2145
1998
|
}
|
|
2146
1999
|
);
|
|
2147
|
-
}
|
|
2000
|
+
};
|
|
2001
|
+
var sidebar_setting_column_default = SidebarSetColumn;
|
|
2002
|
+
|
|
2003
|
+
// test-app/src/component/table/index.tsx
|
|
2004
|
+
var import_ej2_react_dropdowns = require("@syncfusion/ej2-react-dropdowns");
|
|
2005
|
+
|
|
2006
|
+
// test-app/src/component/table/paging/index.tsx
|
|
2007
|
+
var import_becoxy_icons5 = require("becoxy-icons");
|
|
2008
|
+
var import_classnames10 = __toESM(require("classnames"));
|
|
2009
|
+
var import_react11 = require("react");
|
|
2010
|
+
var import_react_i18next8 = require("react-i18next");
|
|
2011
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2012
|
+
var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOptions, onChangePageSize }) => {
|
|
2013
|
+
const { t } = (0, import_react_i18next8.useTranslation)();
|
|
2014
|
+
const [countPage, setCountPage] = (0, import_react11.useState)(0);
|
|
2015
|
+
const [currentPageNumber, setCurrentPageNumber] = (0, import_react11.useState)(1);
|
|
2016
|
+
(0, import_react11.useEffect)(() => {
|
|
2017
|
+
setCountPage(Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1));
|
|
2018
|
+
}, [totalItem, pageSize]);
|
|
2019
|
+
(0, import_react11.useEffect)(() => {
|
|
2020
|
+
setCurrentPageNumber(Math.floor(currentPage / 5) + (Math.floor(currentPage / 5) === currentPage / 5 ? 0 : 1));
|
|
2021
|
+
}, [currentPage]);
|
|
2022
|
+
const renderPageNumber = (number) => {
|
|
2023
|
+
const arr = [];
|
|
2024
|
+
for (let index = (number - 1) * 5 + 1; index <= number * 5 && index <= Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1); index++) {
|
|
2025
|
+
arr.push(
|
|
2026
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2027
|
+
"div",
|
|
2028
|
+
{
|
|
2029
|
+
className: (0, import_classnames10.default)("r-number", { "r-active": index === currentPage }),
|
|
2030
|
+
onClick: () => {
|
|
2031
|
+
onChangePage({ totalItem, pageSize, currentPage: index, old: currentPage });
|
|
2032
|
+
},
|
|
2033
|
+
children: index
|
|
2034
|
+
},
|
|
2035
|
+
`page-${index}`
|
|
2036
|
+
)
|
|
2037
|
+
);
|
|
2038
|
+
}
|
|
2039
|
+
return arr;
|
|
2040
|
+
};
|
|
2041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react11.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "r-pager", children: [
|
|
2042
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "r-pagercontainer", children: [
|
|
2043
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "r-button", type: "button", disabled: countPage <= 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: 1, old: currentPage }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_becoxy_icons5.ChevronsLeft, { fontSize: 16 }) }),
|
|
2044
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "r-button", type: "button", disabled: countPage <= 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage - 1, old: currentPage }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_becoxy_icons5.ChevronLeft, { fontSize: 16 }) }),
|
|
2045
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2046
|
+
"button",
|
|
2047
|
+
{
|
|
2048
|
+
className: (0, import_classnames10.default)("r-button", { "d-none": currentPageNumber === 1 }),
|
|
2049
|
+
type: "button",
|
|
2050
|
+
onClick: () => {
|
|
2051
|
+
setCurrentPageNumber(currentPageNumber - 1);
|
|
2052
|
+
onChangePage({ totalItem, pageSize, currentPage: (currentPageNumber - 2) * 5 + 1, old: currentPage });
|
|
2053
|
+
},
|
|
2054
|
+
children: "..."
|
|
2055
|
+
}
|
|
2056
|
+
),
|
|
2057
|
+
renderPageNumber(currentPageNumber),
|
|
2058
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2059
|
+
"button",
|
|
2060
|
+
{
|
|
2061
|
+
className: (0, import_classnames10.default)("r-button", { "d-none": currentPageNumber * 5 >= countPage }),
|
|
2062
|
+
type: "button",
|
|
2063
|
+
onClick: () => {
|
|
2064
|
+
setCurrentPageNumber(currentPageNumber + 1);
|
|
2065
|
+
onChangePage({ totalItem, pageSize, currentPage: currentPageNumber * 5 + 1, old: currentPage });
|
|
2066
|
+
},
|
|
2067
|
+
children: "..."
|
|
2068
|
+
}
|
|
2069
|
+
),
|
|
2070
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "r-button", type: "button", disabled: countPage <= 1 || countPage === currentPage, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage + 1, old: currentPage }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_becoxy_icons5.ChevronRight, { fontSize: 16 }) }),
|
|
2071
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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__ */ (0, import_jsx_runtime11.jsx)(import_becoxy_icons5.ChevronsRight, { fontSize: 16 }) }),
|
|
2072
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "r-pagesize", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2073
|
+
SelectTable,
|
|
2074
|
+
{
|
|
2075
|
+
value: { value: pageSize, label: pageSize },
|
|
2076
|
+
noHeader: true,
|
|
2077
|
+
options: pageOptions.map((item) => ({ value: item, label: item })),
|
|
2078
|
+
onChange: (val) => {
|
|
2079
|
+
onChangePageSize({ totalItem, pageSize: val?.value });
|
|
2080
|
+
},
|
|
2081
|
+
placeholder: t("Select")
|
|
2082
|
+
}
|
|
2083
|
+
) }),
|
|
2084
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { display: "inline", marginLeft: 10, fontSize: 13 }, children: t("pagerDropDown") })
|
|
2085
|
+
] }),
|
|
2086
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "r-parentmsgbar", children: t("totalItemsInfo", { page: currentPage, countPage, totalItem }) })
|
|
2087
|
+
] }) });
|
|
2088
|
+
};
|
|
2148
2089
|
|
|
2149
2090
|
// test-app/src/component/table/header.tsx
|
|
2150
|
-
var
|
|
2151
|
-
var
|
|
2152
|
-
var
|
|
2153
|
-
var
|
|
2091
|
+
var import_react12 = require("react");
|
|
2092
|
+
var import_classnames11 = __toESM(require("classnames"));
|
|
2093
|
+
var import_reactstrap8 = require("reactstrap");
|
|
2094
|
+
var import_react_i18next9 = require("react-i18next");
|
|
2154
2095
|
var import_react_resizable = require("react-resizable");
|
|
2155
2096
|
var import_styles = require("react-resizable/css/styles.css");
|
|
2156
|
-
var
|
|
2097
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2157
2098
|
var HeaderTableCol = (props) => {
|
|
2158
2099
|
const {
|
|
2159
2100
|
selectEnable,
|
|
@@ -2169,7 +2110,7 @@ var HeaderTableCol = (props) => {
|
|
|
2169
2110
|
setColumn,
|
|
2170
2111
|
isMulti
|
|
2171
2112
|
} = props;
|
|
2172
|
-
const { t } = (0,
|
|
2113
|
+
const { t } = (0, import_react_i18next9.useTranslation)();
|
|
2173
2114
|
const handleResize = (e, { size }) => {
|
|
2174
2115
|
if (size.width > 50) {
|
|
2175
2116
|
const newColumns = [...column];
|
|
@@ -2177,7 +2118,7 @@ var HeaderTableCol = (props) => {
|
|
|
2177
2118
|
setColumn(newColumns);
|
|
2178
2119
|
}
|
|
2179
2120
|
};
|
|
2180
|
-
return /* @__PURE__ */ (0,
|
|
2121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react12.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2181
2122
|
import_react_resizable.Resizable,
|
|
2182
2123
|
{
|
|
2183
2124
|
className: "r-resize",
|
|
@@ -2185,12 +2126,12 @@ var HeaderTableCol = (props) => {
|
|
|
2185
2126
|
height: 0,
|
|
2186
2127
|
onResize: handleResize,
|
|
2187
2128
|
draggableOpts: { enableUserSelectHack: false },
|
|
2188
|
-
children: /* @__PURE__ */ (0,
|
|
2129
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2189
2130
|
"th",
|
|
2190
2131
|
{
|
|
2191
2132
|
rowSpan: col.rowspan !== 1 ? col.rowspan : void 0,
|
|
2192
2133
|
colSpan: col.columns?.length ?? 1,
|
|
2193
|
-
className: (0,
|
|
2134
|
+
className: (0, import_classnames11.default)(`r-headercell fix-${col.fixedType}`, { "cell-fixed": col.fixedType }),
|
|
2194
2135
|
style: {
|
|
2195
2136
|
top: `${indexParent * 42}px`,
|
|
2196
2137
|
left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
|
|
@@ -2199,18 +2140,18 @@ var HeaderTableCol = (props) => {
|
|
|
2199
2140
|
minWidth: col.width ? typeof col.width === "number" ? col.width : col.width?.includes("px") || col.width?.includes("%") ? col.width : `${col.width}px` : "auto",
|
|
2200
2141
|
maxWidth: col.width ? typeof col.width === "number" ? col.width : col.width?.includes("px") || col.width?.includes("%") ? col.width : `${col.width}px` : "auto"
|
|
2201
2142
|
},
|
|
2202
|
-
children: /* @__PURE__ */ (0,
|
|
2143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2203
2144
|
"div",
|
|
2204
2145
|
{
|
|
2205
2146
|
style: { justifyContent: col.textAlign ?? "left" },
|
|
2206
|
-
className: (0,
|
|
2147
|
+
className: (0, import_classnames11.default)("r-headercell-div"),
|
|
2207
2148
|
children: [
|
|
2208
|
-
col.field === "checkbox" && /* @__PURE__ */ (0,
|
|
2209
|
-
|
|
2149
|
+
col.field === "checkbox" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2150
|
+
import_reactstrap8.Input,
|
|
2210
2151
|
{
|
|
2211
2152
|
checked: totalCount > 0 && selectedRows?.length >= totalCount,
|
|
2212
2153
|
type: "checkbox",
|
|
2213
|
-
className: (0,
|
|
2154
|
+
className: (0, import_classnames11.default)("cursor-pointer", { "d-none": !isMulti }),
|
|
2214
2155
|
style: { textAlign: col.textAlign ?? "left", marginTop: 6 },
|
|
2215
2156
|
onChange: (e) => {
|
|
2216
2157
|
if (selectEnable) {
|
|
@@ -2237,39 +2178,39 @@ var HeaderTableCol = (props) => {
|
|
|
2237
2178
|
var header_default = HeaderTableCol;
|
|
2238
2179
|
|
|
2239
2180
|
// test-app/src/component/table/command.tsx
|
|
2240
|
-
var
|
|
2241
|
-
var
|
|
2242
|
-
var
|
|
2243
|
-
var
|
|
2181
|
+
var import_react14 = require("react");
|
|
2182
|
+
var import_classnames12 = __toESM(require("classnames"));
|
|
2183
|
+
var import_reactstrap9 = require("reactstrap");
|
|
2184
|
+
var import_react_i18next10 = require("react-i18next");
|
|
2244
2185
|
|
|
2245
2186
|
// test-app/src/component/icon/index.tsx
|
|
2246
2187
|
var Icon = __toESM(require("becoxy-icons"));
|
|
2247
|
-
var
|
|
2248
|
-
var
|
|
2188
|
+
var import_react13 = require("react");
|
|
2189
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2249
2190
|
var IconCustom = (props) => {
|
|
2250
2191
|
const { iconName, size } = props;
|
|
2251
2192
|
if (iconName === "") {
|
|
2252
2193
|
return null;
|
|
2253
2194
|
} else {
|
|
2254
2195
|
const TagIcon = iconName === "" ? "" : Icon[iconName];
|
|
2255
|
-
return /* @__PURE__ */ (0,
|
|
2196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react13.Fragment, { children: iconName === "" ? "" : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TagIcon, { fontSize: size }) });
|
|
2256
2197
|
}
|
|
2257
2198
|
};
|
|
2258
2199
|
var icon_default = IconCustom;
|
|
2259
2200
|
|
|
2260
2201
|
// test-app/src/component/table/command.tsx
|
|
2261
|
-
var
|
|
2202
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2262
2203
|
var CommandElement = (props) => {
|
|
2263
2204
|
const { commandItems, rowData, indexRow, handleCommandClick, indexFocus, setIndexFocus } = props;
|
|
2264
|
-
const { t } = (0,
|
|
2265
|
-
return /* @__PURE__ */ (0,
|
|
2266
|
-
return /* @__PURE__ */ (0,
|
|
2267
|
-
|
|
2205
|
+
const { t } = (0, import_react_i18next10.useTranslation)();
|
|
2206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react14.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "d-flex align-items-center", style: { columnGap: 10 }, children: commandItems.map((item, index) => {
|
|
2207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2208
|
+
import_reactstrap9.Button,
|
|
2268
2209
|
{
|
|
2269
2210
|
id: `command-item-${indexRow}-${index}`,
|
|
2270
2211
|
tabIndex: -1,
|
|
2271
2212
|
style: { padding: "5px", minWidth: 45, height: "100%" },
|
|
2272
|
-
className: (0,
|
|
2213
|
+
className: (0, import_classnames12.default)("command-item", {
|
|
2273
2214
|
"btn-icon": item.tooltip === ""
|
|
2274
2215
|
}),
|
|
2275
2216
|
color: item.color ? item.color : "#000",
|
|
@@ -2281,8 +2222,8 @@ var CommandElement = (props) => {
|
|
|
2281
2222
|
e.preventDefault();
|
|
2282
2223
|
},
|
|
2283
2224
|
children: [
|
|
2284
|
-
item.icon && /* @__PURE__ */ (0,
|
|
2285
|
-
/* @__PURE__ */ (0,
|
|
2225
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(icon_default, { iconName: item.icon, size: 16 }),
|
|
2226
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_reactstrap9.UncontrolledTooltip, { className: "r-tooltip", target: `command-item-${indexRow}-${index}`, place: "top", children: t(item.tooltip ?? "") })
|
|
2286
2227
|
]
|
|
2287
2228
|
},
|
|
2288
2229
|
`command-${index}`
|
|
@@ -2292,9 +2233,9 @@ var CommandElement = (props) => {
|
|
|
2292
2233
|
var command_default = CommandElement;
|
|
2293
2234
|
|
|
2294
2235
|
// test-app/src/component/table/index.tsx
|
|
2295
|
-
var
|
|
2296
|
-
var TableEdit = (0,
|
|
2297
|
-
const { t } = (0,
|
|
2236
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2237
|
+
var TableEdit = (0, import_react15.forwardRef)((props, ref) => {
|
|
2238
|
+
const { t } = (0, import_react_i18next11.useTranslation)();
|
|
2298
2239
|
const {
|
|
2299
2240
|
idTable,
|
|
2300
2241
|
dataSource,
|
|
@@ -2322,36 +2263,36 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2322
2263
|
handleSelect,
|
|
2323
2264
|
isMulti
|
|
2324
2265
|
} = props;
|
|
2325
|
-
(0,
|
|
2266
|
+
(0, import_react15.useImperativeHandle)(ref, () => {
|
|
2326
2267
|
return {
|
|
2327
2268
|
refeshFocusRow: handleRefeshRow
|
|
2328
2269
|
};
|
|
2329
2270
|
});
|
|
2330
|
-
const [refreshRow, setRefreshRow] = (0,
|
|
2331
|
-
const [indexFocus, setIndexFocus] = (0,
|
|
2332
|
-
const [selectedRows, setSelectedRows] = (0,
|
|
2333
|
-
const [headerColumns, setHeaderColumns] = (0,
|
|
2334
|
-
const [contentColumns, setContentColumns] = (0,
|
|
2335
|
-
const [levelCol, setLevelCol] = (0,
|
|
2336
|
-
const [columnFistEdit, setColumnFistEdit] = (0,
|
|
2337
|
-
const [columnLastEdit, setColumnlastEdit] = (0,
|
|
2338
|
-
const [objWidthFix, setObjWidthFix] = (0,
|
|
2339
|
-
const [openPopupTree, setOpenPopupTree] = (0,
|
|
2340
|
-
const [openPopupSetupColumn, setOpenPopupSetupColumn] = (0,
|
|
2341
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
2342
|
-
const tableElement = (0,
|
|
2343
|
-
const gridRef = (0,
|
|
2271
|
+
const [refreshRow, setRefreshRow] = (0, import_react15.useState)(false);
|
|
2272
|
+
const [indexFocus, setIndexFocus] = (0, import_react15.useState)();
|
|
2273
|
+
const [selectedRows, setSelectedRows] = (0, import_react15.useState)([]);
|
|
2274
|
+
const [headerColumns, setHeaderColumns] = (0, import_react15.useState)([[]]);
|
|
2275
|
+
const [contentColumns, setContentColumns] = (0, import_react15.useState)([]);
|
|
2276
|
+
const [levelCol, setLevelCol] = (0, import_react15.useState)(0);
|
|
2277
|
+
const [columnFistEdit, setColumnFistEdit] = (0, import_react15.useState)(0);
|
|
2278
|
+
const [columnLastEdit, setColumnlastEdit] = (0, import_react15.useState)(0);
|
|
2279
|
+
const [objWidthFix, setObjWidthFix] = (0, import_react15.useState)({});
|
|
2280
|
+
const [openPopupTree, setOpenPopupTree] = (0, import_react15.useState)(false);
|
|
2281
|
+
const [openPopupSetupColumn, setOpenPopupSetupColumn] = (0, import_react15.useState)(false);
|
|
2282
|
+
const [searchTerm, setSearchTerm] = (0, import_react15.useState)("");
|
|
2283
|
+
const tableElement = (0, import_react15.useRef)(null);
|
|
2284
|
+
const gridRef = (0, import_react15.useRef)();
|
|
2344
2285
|
let totalCount = dataSource.length;
|
|
2345
2286
|
const pagingClient = pagingSetting?.allowPaging && (pagingSetting?.pagingClient || !(editDisable || addDisable));
|
|
2346
2287
|
const searchClient = searchSetting?.searchEnable && (searchSetting?.searchClient || !(editDisable || addDisable));
|
|
2347
2288
|
const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? "id";
|
|
2348
2289
|
const fieldUniKey = columns.filter((item) => item.isUnikey === true)?.map((item) => item.field);
|
|
2349
|
-
(0,
|
|
2290
|
+
(0, import_react15.useEffect)(() => {
|
|
2350
2291
|
if (pagingClient && pagingSetting.setCurrentPage && Math.ceil(totalCount / (pagingSetting?.pageSize ?? 1)) < (pagingSetting.currentPage ?? 1)) {
|
|
2351
2292
|
pagingSetting.setCurrentPage(1);
|
|
2352
2293
|
}
|
|
2353
2294
|
}, [dataSource]);
|
|
2354
|
-
(0,
|
|
2295
|
+
(0, import_react15.useEffect)(() => {
|
|
2355
2296
|
let indexFirst = -1;
|
|
2356
2297
|
let indexlast = -1;
|
|
2357
2298
|
let letfWidthFix = 0;
|
|
@@ -2385,7 +2326,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2385
2326
|
setColumnFistEdit(indexFirst + 1);
|
|
2386
2327
|
setColumnlastEdit(indexlast + 1);
|
|
2387
2328
|
}, [contentColumns]);
|
|
2388
|
-
(0,
|
|
2329
|
+
(0, import_react15.useEffect)(() => {
|
|
2389
2330
|
const arrHeaderColumns = [];
|
|
2390
2331
|
const arrContentColumns = [];
|
|
2391
2332
|
let headerLevelRow = 0;
|
|
@@ -2402,7 +2343,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2402
2343
|
setHeaderColumns(arrHeaderColumns);
|
|
2403
2344
|
setContentColumns(arrContentColumns);
|
|
2404
2345
|
}, [columns]);
|
|
2405
|
-
(0,
|
|
2346
|
+
(0, import_react15.useEffect)(() => {
|
|
2406
2347
|
const arrHeaderColumns = [];
|
|
2407
2348
|
const arrContentColumns = [];
|
|
2408
2349
|
let headerLevelRow = 0;
|
|
@@ -2516,7 +2457,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2516
2457
|
}
|
|
2517
2458
|
};
|
|
2518
2459
|
const searchTemplate = () => {
|
|
2519
|
-
return /* @__PURE__ */ (0,
|
|
2460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react15.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "me-50 r-search", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2520
2461
|
react_input_default,
|
|
2521
2462
|
{
|
|
2522
2463
|
style: { width: "230px" },
|
|
@@ -2537,8 +2478,8 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2537
2478
|
const renderEdit = (row, col, indexRow, indexCol) => {
|
|
2538
2479
|
switch (col?.editTypeCondition ? col?.editTypeCondition(row) : col.editType) {
|
|
2539
2480
|
case "date":
|
|
2540
|
-
return /* @__PURE__ */ (0,
|
|
2541
|
-
|
|
2481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2482
|
+
import_reactstrap10.Input,
|
|
2542
2483
|
{
|
|
2543
2484
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2544
2485
|
style: { textAlign: col.textAlign, height: 29 },
|
|
@@ -2550,7 +2491,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2550
2491
|
}
|
|
2551
2492
|
handleDataChange(row, col, indexRow);
|
|
2552
2493
|
},
|
|
2553
|
-
className: (0,
|
|
2494
|
+
className: (0, import_classnames13.default)("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2554
2495
|
type: "date",
|
|
2555
2496
|
max: "9999-12-31",
|
|
2556
2497
|
onKeyDown: (e) => {
|
|
@@ -2566,8 +2507,8 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2566
2507
|
}
|
|
2567
2508
|
);
|
|
2568
2509
|
case "datetime":
|
|
2569
|
-
return /* @__PURE__ */ (0,
|
|
2570
|
-
|
|
2510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2511
|
+
import_reactstrap10.Input,
|
|
2571
2512
|
{
|
|
2572
2513
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2573
2514
|
style: { textAlign: col.textAlign, height: 29 },
|
|
@@ -2579,7 +2520,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2579
2520
|
}
|
|
2580
2521
|
handleDataChange(row, col, indexRow);
|
|
2581
2522
|
},
|
|
2582
|
-
className: (0,
|
|
2523
|
+
className: (0, import_classnames13.default)("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2583
2524
|
type: "datetime-local",
|
|
2584
2525
|
max: "9999-12-31T23:59",
|
|
2585
2526
|
onKeyDown: (e) => {
|
|
@@ -2607,7 +2548,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2607
2548
|
} else {
|
|
2608
2549
|
valueSelect = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? optionsSelect?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
|
|
2609
2550
|
}
|
|
2610
|
-
return /* @__PURE__ */ (0,
|
|
2551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2611
2552
|
SelectTable,
|
|
2612
2553
|
{
|
|
2613
2554
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2664,14 +2605,14 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2664
2605
|
}
|
|
2665
2606
|
}
|
|
2666
2607
|
};
|
|
2667
|
-
return /* @__PURE__ */ (0,
|
|
2608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2668
2609
|
"div",
|
|
2669
2610
|
{
|
|
2670
2611
|
onKeyDown: (e) => {
|
|
2671
2612
|
if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
|
|
2672
2613
|
}
|
|
2673
2614
|
},
|
|
2674
|
-
children: /* @__PURE__ */ (0,
|
|
2615
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2675
2616
|
import_ej2_react_dropdowns.DropDownTreeComponent,
|
|
2676
2617
|
{
|
|
2677
2618
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2682,7 +2623,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2682
2623
|
parentValue: "parentId",
|
|
2683
2624
|
child: "children"
|
|
2684
2625
|
},
|
|
2685
|
-
className: (0,
|
|
2626
|
+
className: (0, import_classnames13.default)("select-tree", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2686
2627
|
allowFiltering: false,
|
|
2687
2628
|
value: valueSelectTree,
|
|
2688
2629
|
popupHeight: 250,
|
|
@@ -2710,8 +2651,8 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2710
2651
|
}
|
|
2711
2652
|
);
|
|
2712
2653
|
case "checkbox":
|
|
2713
|
-
return /* @__PURE__ */ (0,
|
|
2714
|
-
|
|
2654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2655
|
+
import_reactstrap10.Input,
|
|
2715
2656
|
{
|
|
2716
2657
|
checked: row[col.field],
|
|
2717
2658
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2733,13 +2674,13 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2733
2674
|
);
|
|
2734
2675
|
case "numeric":
|
|
2735
2676
|
let valueCurrency = row[col.field];
|
|
2736
|
-
return /* @__PURE__ */ (0,
|
|
2737
|
-
|
|
2677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2678
|
+
import_reactstrap10.Input,
|
|
2738
2679
|
{
|
|
2739
2680
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2740
2681
|
style: { textAlign: col.textAlign, height: 29 },
|
|
2741
2682
|
defaultValue: formartNumberic(valueCurrency, decimalSeparator, thousandSeparator, col.numericSettings?.fraction),
|
|
2742
|
-
className: (0,
|
|
2683
|
+
className: (0, import_classnames13.default)("border-0 rounded-0 input-numeric", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2743
2684
|
onChange: (val) => {
|
|
2744
2685
|
let newVal = "";
|
|
2745
2686
|
const flag = val.target?.value.startsWith("-");
|
|
@@ -2823,8 +2764,8 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2823
2764
|
}
|
|
2824
2765
|
);
|
|
2825
2766
|
case "color":
|
|
2826
|
-
return /* @__PURE__ */ (0,
|
|
2827
|
-
|
|
2767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2768
|
+
import_reactstrap10.Input,
|
|
2828
2769
|
{
|
|
2829
2770
|
type: "color",
|
|
2830
2771
|
value: row[col.field],
|
|
@@ -2846,7 +2787,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2846
2787
|
`col-${indexRow}-${indexCol}`
|
|
2847
2788
|
) });
|
|
2848
2789
|
case "form":
|
|
2849
|
-
return /* @__PURE__ */ (0,
|
|
2790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2850
2791
|
edit_form_default,
|
|
2851
2792
|
{
|
|
2852
2793
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
@@ -2874,13 +2815,13 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2874
2815
|
}
|
|
2875
2816
|
);
|
|
2876
2817
|
default:
|
|
2877
|
-
return /* @__PURE__ */ (0,
|
|
2878
|
-
|
|
2818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2819
|
+
import_reactstrap10.Input,
|
|
2879
2820
|
{
|
|
2880
2821
|
id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
|
|
2881
2822
|
style: { textAlign: col.textAlign, height: 29 },
|
|
2882
2823
|
defaultValue: isNullOrUndefined(row[col.field]) ? "" : row[col.field],
|
|
2883
|
-
className: (0,
|
|
2824
|
+
className: (0, import_classnames13.default)("border-0 rounded-0 input-element", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
|
|
2884
2825
|
onBlur: (val) => {
|
|
2885
2826
|
if (row[col.field] != val.target?.value) {
|
|
2886
2827
|
row[col.field] = val.target?.value;
|
|
@@ -3263,7 +3204,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3263
3204
|
}
|
|
3264
3205
|
}
|
|
3265
3206
|
};
|
|
3266
|
-
(0,
|
|
3207
|
+
(0, import_react15.useEffect)(() => {
|
|
3267
3208
|
setIndexFocus(-1);
|
|
3268
3209
|
if (setSelectedItem) {
|
|
3269
3210
|
if (isMulti) {
|
|
@@ -3290,7 +3231,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3290
3231
|
}
|
|
3291
3232
|
}
|
|
3292
3233
|
}, [selectedRows]);
|
|
3293
|
-
(0,
|
|
3234
|
+
(0, import_react15.useEffect)(() => {
|
|
3294
3235
|
if (!isMulti) {
|
|
3295
3236
|
if (dataSource && selectedItem && selectedItem[fieldKey]) {
|
|
3296
3237
|
if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
|
|
@@ -3307,10 +3248,10 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3307
3248
|
}, [selectedItem]);
|
|
3308
3249
|
const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
|
|
3309
3250
|
if (col.field === "command") {
|
|
3310
|
-
return col.visible !== false && /* @__PURE__ */ (0,
|
|
3251
|
+
return col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3311
3252
|
"td",
|
|
3312
3253
|
{
|
|
3313
|
-
className: (0,
|
|
3254
|
+
className: (0, import_classnames13.default)(
|
|
3314
3255
|
`r-rowcell p-0 fix-${col.fixedType}`,
|
|
3315
3256
|
{ "cell-fixed": col.fixedType },
|
|
3316
3257
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -3320,15 +3261,15 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3320
3261
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3321
3262
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
3322
3263
|
},
|
|
3323
|
-
children: /* @__PURE__ */ (0,
|
|
3264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-rowcell-div ", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(command_default, { commandItems: col.commandItems ?? [], handleCommandClick, indexRow, rowData: row, setIndexFocus, indexFocus }) })
|
|
3324
3265
|
},
|
|
3325
3266
|
`col-${indexRow}-${indexCol}`
|
|
3326
3267
|
);
|
|
3327
3268
|
} else if (col.field === "#") {
|
|
3328
|
-
return col.visible !== false && /* @__PURE__ */ (0,
|
|
3269
|
+
return col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3329
3270
|
"td",
|
|
3330
3271
|
{
|
|
3331
|
-
className: (0,
|
|
3272
|
+
className: (0, import_classnames13.default)(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "r-active": isSelected && editDisable || indexFocus === indexRow }),
|
|
3332
3273
|
tabIndex: Number(`${indexRow}${indexCol}`),
|
|
3333
3274
|
style: {
|
|
3334
3275
|
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
@@ -3372,15 +3313,15 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3372
3313
|
e.stopPropagation();
|
|
3373
3314
|
}
|
|
3374
3315
|
},
|
|
3375
|
-
children: /* @__PURE__ */ (0,
|
|
3316
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-rowcell-div pt-50", children: indexRow + 1 })
|
|
3376
3317
|
},
|
|
3377
3318
|
`col-${indexRow}-${indexCol}`
|
|
3378
3319
|
);
|
|
3379
3320
|
} else if (col.field === "checkbox") {
|
|
3380
|
-
return /* @__PURE__ */ (0,
|
|
3321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3381
3322
|
"td",
|
|
3382
3323
|
{
|
|
3383
|
-
className: (0,
|
|
3324
|
+
className: (0, import_classnames13.default)(
|
|
3384
3325
|
`r-rowcell p-0 fix-${col.fixedType}`,
|
|
3385
3326
|
{ "cell-fixed": col.fixedType },
|
|
3386
3327
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -3390,7 +3331,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3390
3331
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3391
3332
|
textAlign: col.textAlign ? col.textAlign : "center"
|
|
3392
3333
|
},
|
|
3393
|
-
children: /* @__PURE__ */ (0,
|
|
3334
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3394
3335
|
"div",
|
|
3395
3336
|
{
|
|
3396
3337
|
className: "r-rowcell-div cursor-pointer",
|
|
@@ -3414,8 +3355,8 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3414
3355
|
e.stopPropagation();
|
|
3415
3356
|
}
|
|
3416
3357
|
},
|
|
3417
|
-
children: /* @__PURE__ */ (0,
|
|
3418
|
-
|
|
3358
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3359
|
+
import_reactstrap10.Input,
|
|
3419
3360
|
{
|
|
3420
3361
|
checked: isSelected,
|
|
3421
3362
|
type: "checkbox",
|
|
@@ -3441,10 +3382,10 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3441
3382
|
}
|
|
3442
3383
|
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === "checkbox") && (!col.disabledCondition || !col.disabledCondition(row)) ? col.editEnable ? 1 : col.template ? 2 : 3 : col.template ? 2 : 3;
|
|
3443
3384
|
const errorMessage = typeDis === 1 || col.field === "" || !col.validate ? "" : col.validate(row[col.field], row);
|
|
3444
|
-
return /* @__PURE__ */ (0,
|
|
3385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react15.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3445
3386
|
"td",
|
|
3446
3387
|
{
|
|
3447
|
-
className: (0,
|
|
3388
|
+
className: (0, import_classnames13.default)(
|
|
3448
3389
|
`r-rowcell fix-${col.fixedType}`,
|
|
3449
3390
|
{ "cell-fixed": col.fixedType },
|
|
3450
3391
|
{ "r-active": isSelected && editDisable || indexFocus === indexRow }
|
|
@@ -3486,25 +3427,25 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3486
3427
|
e.stopPropagation();
|
|
3487
3428
|
}
|
|
3488
3429
|
},
|
|
3489
|
-
children: /* @__PURE__ */ (0,
|
|
3430
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3490
3431
|
"div",
|
|
3491
3432
|
{
|
|
3492
|
-
className: (0,
|
|
3493
|
-
children: /* @__PURE__ */ (0,
|
|
3433
|
+
className: (0, import_classnames13.default)("r-rowcell-div"),
|
|
3434
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3494
3435
|
"div",
|
|
3495
3436
|
{
|
|
3496
3437
|
id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
|
|
3497
|
-
className: (0,
|
|
3438
|
+
className: (0, import_classnames13.default)("r-rowcell-content", { "r-is-invalid": errorMessage }),
|
|
3498
3439
|
style: {
|
|
3499
3440
|
margin: typeDis === 1 ? 2 : !errorMessage ? "7px 9px" : 2,
|
|
3500
3441
|
color: col.editType === "numeric" && Number(row[col.field]) < 0 ? "red" : ""
|
|
3501
3442
|
},
|
|
3502
3443
|
children: [
|
|
3503
|
-
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */ (0,
|
|
3504
|
-
/* @__PURE__ */ (0,
|
|
3505
|
-
!(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ (0,
|
|
3506
|
-
/* @__PURE__ */ (0,
|
|
3507
|
-
|
|
3444
|
+
typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
3445
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { id: `error-${indexRow}-${indexCol}`, className: (0, import_classnames13.default)("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_becoxy_icons6.AlertCircle, { fontSize: 15.5 }) }),
|
|
3446
|
+
!(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_reactstrap10.UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : value }),
|
|
3447
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3448
|
+
import_reactstrap10.UncontrolledTooltip,
|
|
3508
3449
|
{
|
|
3509
3450
|
target: `error-${indexRow}-${indexCol}`,
|
|
3510
3451
|
className: "r-tooltip tooltip-error",
|
|
@@ -3526,10 +3467,10 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3526
3467
|
return element && element.scrollWidth > element.clientWidth;
|
|
3527
3468
|
};
|
|
3528
3469
|
const renderFooterCol = (col, indexCol) => {
|
|
3529
|
-
return /* @__PURE__ */ (0,
|
|
3470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react15.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3530
3471
|
"td",
|
|
3531
3472
|
{
|
|
3532
|
-
className: (0,
|
|
3473
|
+
className: (0, import_classnames13.default)(
|
|
3533
3474
|
`p-0 px-50 r-footer fix-${col.fixedType}`,
|
|
3534
3475
|
{ "cell-fixed": col.fixedType }
|
|
3535
3476
|
),
|
|
@@ -3538,56 +3479,56 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3538
3479
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
3539
3480
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
3540
3481
|
},
|
|
3541
|
-
children: /* @__PURE__ */ (0,
|
|
3482
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource.reduce(function(accumulator, currentValue) {
|
|
3542
3483
|
return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
|
|
3543
3484
|
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
|
|
3544
3485
|
}
|
|
3545
3486
|
) }, `summarycell-${indexCol}`);
|
|
3546
3487
|
};
|
|
3547
3488
|
const renderToolbarTop = () => {
|
|
3548
|
-
return /* @__PURE__ */ (0,
|
|
3549
|
-
/* @__PURE__ */ (0,
|
|
3550
|
-
return item.align === "left" ? /* @__PURE__ */ (0,
|
|
3489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "r-toolbar-items", children: [
|
|
3490
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
|
|
3491
|
+
return item.align === "left" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) : "";
|
|
3551
3492
|
}) }),
|
|
3552
|
-
/* @__PURE__ */ (0,
|
|
3553
|
-
return item.align === "center" ? /* @__PURE__ */ (0,
|
|
3493
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
|
|
3494
|
+
return item.align === "center" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) : "";
|
|
3554
3495
|
}) }),
|
|
3555
|
-
/* @__PURE__ */ (0,
|
|
3556
|
-
return item.align === "right" ? /* @__PURE__ */ (0,
|
|
3496
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
|
|
3497
|
+
return item.align === "right" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) : "";
|
|
3557
3498
|
}) })
|
|
3558
3499
|
] }) });
|
|
3559
3500
|
};
|
|
3560
3501
|
const renderToolbarBottom = () => {
|
|
3561
|
-
return /* @__PURE__ */ (0,
|
|
3562
|
-
/* @__PURE__ */ (0,
|
|
3563
|
-
/* @__PURE__ */ (0,
|
|
3564
|
-
(indexFocus ?? -1) > -1 ? /* @__PURE__ */ (0,
|
|
3565
|
-
/* @__PURE__ */ (0,
|
|
3502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "r-toolbar-items", children: [
|
|
3503
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "r-toolbar-left", children: [
|
|
3504
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: (0, import_classnames13.default)("r-toolbar-item", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_reactstrap10.Button, { color: "success", outline: true, onClick: handleAdd, className: "d-flex", children: t("Add item") }) }),
|
|
3505
|
+
(indexFocus ?? -1) > -1 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
3506
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: (0, import_classnames13.default)("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_reactstrap10.Button, { color: "success", outline: true, onClick: () => {
|
|
3566
3507
|
handleDuplicate(dataSource[indexFocus ?? -1], indexFocus ?? -1);
|
|
3567
3508
|
}, className: "d-flex", children: t("Duplicate") }) }),
|
|
3568
|
-
/* @__PURE__ */ (0,
|
|
3569
|
-
/* @__PURE__ */ (0,
|
|
3570
|
-
] }) : /* @__PURE__ */ (0,
|
|
3571
|
-
/* @__PURE__ */ (0,
|
|
3509
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: (0, import_classnames13.default)("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_reactstrap10.Button, { color: "success", outline: true, onClick: handleInsertBefore, className: "d-flex", children: t("Insert item before") }) }),
|
|
3510
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: (0, import_classnames13.default)("r-toolbar-item", { "d-none": editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_reactstrap10.Button, { color: "success", outline: true, onClick: handleInsertAfter, className: "d-flex", children: t("Insert item after") }) })
|
|
3511
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: " " }),
|
|
3512
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: (0, import_classnames13.default)("r-toolbar-item", { "d-none": editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_reactstrap10.Button, { color: "primary", outline: true, onClick: handleDeleteAll, className: "d-flex", children: t("Delete all item") }) }),
|
|
3572
3513
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
3573
|
-
return item.align === "left" ? /* @__PURE__ */ (0,
|
|
3514
|
+
return item.align === "left" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : "";
|
|
3574
3515
|
})
|
|
3575
3516
|
] }),
|
|
3576
|
-
/* @__PURE__ */ (0,
|
|
3577
|
-
return item.align === "center" ? /* @__PURE__ */ (0,
|
|
3517
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-toolbar-center", children: toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
3518
|
+
return item.align === "center" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : "";
|
|
3578
3519
|
}) }),
|
|
3579
|
-
/* @__PURE__ */ (0,
|
|
3520
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "r-toolbar-right", children: [
|
|
3580
3521
|
toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
3581
|
-
return item.align === "right" ? /* @__PURE__ */ (0,
|
|
3522
|
+
return item.align === "right" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : "";
|
|
3582
3523
|
}),
|
|
3583
|
-
/* @__PURE__ */ (0,
|
|
3584
|
-
/* @__PURE__ */ (0,
|
|
3585
|
-
/* @__PURE__ */ (0,
|
|
3586
|
-
/* @__PURE__ */ (0,
|
|
3587
|
-
/* @__PURE__ */ (0,
|
|
3588
|
-
/* @__PURE__ */ (0,
|
|
3589
|
-
/* @__PURE__ */ (0,
|
|
3590
|
-
/* @__PURE__ */ (0,
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: (0, import_classnames13.default)("r-toolbar-item me-25", { "d-none": headerColumns.length > 1 }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_becoxy_icons6.Settings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }),
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: (0, import_classnames13.default)("r-toolbar-item me-25", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_reactstrap10.UncontrolledDropdown, { className: "dropdown-user nav-item", children: [
|
|
3526
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_reactstrap10.DropdownToggle, { href: "/", tag: "a", color: "info", onClick: (e) => e.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_becoxy_icons6.Info, { className: "cursor-pointer" }) }),
|
|
3527
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_reactstrap10.DropdownMenu, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "d-flex flex-column p-50 py-25", children: [
|
|
3528
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" }),
|
|
3529
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 13 }, children: "Ch\u1ECDn \xF4 v\xE0 Ctrl + V \u0111\u1EC3 d\xE1n th\xF4ng tin t\u1EEB excel" }),
|
|
3530
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" }),
|
|
3531
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" })
|
|
3591
3532
|
] }) })
|
|
3592
3533
|
] }) })
|
|
3593
3534
|
] })
|
|
@@ -3616,10 +3557,10 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3616
3557
|
const flagDisplay = !pagingClient || totalCount > (pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0) - 1) && totalCount <= (pagingSetting.pageSize ?? 0) * (pagingSetting.currentPage ?? 0);
|
|
3617
3558
|
if (flagDisplay) {
|
|
3618
3559
|
countDisplay++;
|
|
3619
|
-
return /* @__PURE__ */ (0,
|
|
3560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3620
3561
|
"tr",
|
|
3621
3562
|
{
|
|
3622
|
-
className: (0,
|
|
3563
|
+
className: (0, import_classnames13.default)("r-row", { "fisrt-row": countDisplay === 0 }),
|
|
3623
3564
|
children: contentColumns.map((col, indexCol) => {
|
|
3624
3565
|
return renderContentCol(col, row, indexRow, indexCol, isSelected);
|
|
3625
3566
|
})
|
|
@@ -3630,19 +3571,19 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3630
3571
|
}
|
|
3631
3572
|
});
|
|
3632
3573
|
};
|
|
3633
|
-
(0,
|
|
3574
|
+
(0, import_react15.useEffect)(() => {
|
|
3634
3575
|
if (pagingClient && pagingSetting?.setCurrentPage && (searchSetting?.searchTerm !== void 0 ? searchSetting?.searchTerm : searchTerm)) {
|
|
3635
3576
|
pagingSetting?.setCurrentPage(1);
|
|
3636
3577
|
}
|
|
3637
3578
|
}, [searchTerm, searchSetting?.searchTerm]);
|
|
3638
|
-
return /* @__PURE__ */ (0,
|
|
3639
|
-
/* @__PURE__ */ (0,
|
|
3640
|
-
/* @__PURE__ */ (0,
|
|
3641
|
-
toolbarSetting?.showTopToolbar ? /* @__PURE__ */ (0,
|
|
3642
|
-
/* @__PURE__ */ (0,
|
|
3643
|
-
/* @__PURE__ */ (0,
|
|
3644
|
-
return /* @__PURE__ */ (0,
|
|
3645
|
-
return /* @__PURE__ */ (0,
|
|
3579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react15.Fragment, { children: [
|
|
3580
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "react-table-edit", children: [
|
|
3581
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "r-grid", ref: gridRef, children: [
|
|
3582
|
+
toolbarSetting?.showTopToolbar ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: renderToolbarTop() }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, {}),
|
|
3583
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ref: tableElement, className: "r-gridtable", style: { height: `${height ? `${height}px` : "auto"}`, minHeight: `${minHeight ? `${minHeight}px` : ""}`, maxHeight: `${maxHeight ? `${maxHeight}px` : "400px"}` }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { style: { width: "100%" }, children: [
|
|
3584
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { className: "r-gridheader", children: headerColumns.map((element, indexParent) => {
|
|
3585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
3586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3646
3587
|
header_default,
|
|
3647
3588
|
{
|
|
3648
3589
|
col,
|
|
@@ -3662,14 +3603,14 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3662
3603
|
);
|
|
3663
3604
|
}) }, `header-${-indexParent}`);
|
|
3664
3605
|
}) }),
|
|
3665
|
-
/* @__PURE__ */ (0,
|
|
3666
|
-
/* @__PURE__ */ (0,
|
|
3606
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { className: "r-gridcontent", children: renderData() }),
|
|
3607
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tfoot", { className: "r-gridfoot", children: haveSum == true ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { className: "r-row", children: contentColumns.map((col, index) => {
|
|
3667
3608
|
return renderFooterCol(col, index);
|
|
3668
|
-
}) }) : /* @__PURE__ */ (0,
|
|
3609
|
+
}) }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, {}) })
|
|
3669
3610
|
] }) }),
|
|
3670
|
-
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ (0,
|
|
3611
|
+
toolbarSetting?.showBottomToolbar ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: renderToolbarBottom() }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, {})
|
|
3671
3612
|
] }),
|
|
3672
|
-
pagingSetting?.allowPaging ? /* @__PURE__ */ (0,
|
|
3613
|
+
pagingSetting?.allowPaging ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3673
3614
|
PagingComponent,
|
|
3674
3615
|
{
|
|
3675
3616
|
onChangePage,
|
|
@@ -3679,9 +3620,9 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
3679
3620
|
totalItem: pagingClient ? totalCount : pagingSetting?.totalItem ?? 0,
|
|
3680
3621
|
onChangePageSize
|
|
3681
3622
|
}
|
|
3682
|
-
) : /* @__PURE__ */ (0,
|
|
3623
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, {})
|
|
3683
3624
|
] }),
|
|
3684
|
-
/* @__PURE__ */ (0,
|
|
3625
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3685
3626
|
sidebar_setting_column_default,
|
|
3686
3627
|
{
|
|
3687
3628
|
handleSidebar: () => {
|
|
@@ -3698,11 +3639,11 @@ var table_default = TableEdit;
|
|
|
3698
3639
|
|
|
3699
3640
|
// test-app/src/component/tab-menu/index.tsx
|
|
3700
3641
|
var import_becoxy_icons7 = require("becoxy-icons");
|
|
3701
|
-
var
|
|
3702
|
-
var
|
|
3642
|
+
var import_classnames14 = __toESM(require("classnames"));
|
|
3643
|
+
var import_react16 = require("react");
|
|
3703
3644
|
var import_react_router_dom = require("react-router-dom");
|
|
3704
|
-
var
|
|
3705
|
-
var
|
|
3645
|
+
var import_reactstrap11 = require("reactstrap");
|
|
3646
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3706
3647
|
var TabsMenuComponent = ({
|
|
3707
3648
|
buttonWidth,
|
|
3708
3649
|
tabParent,
|
|
@@ -3714,14 +3655,14 @@ var TabsMenuComponent = ({
|
|
|
3714
3655
|
renderModal
|
|
3715
3656
|
}) => {
|
|
3716
3657
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
3717
|
-
const [dataMenu, setDataMenu] = (0,
|
|
3718
|
-
const [openMenu, setOpenMenu] = (0,
|
|
3719
|
-
const [url, setUrl] = (0,
|
|
3720
|
-
const [contentWidth, setContentWidth] = (0,
|
|
3721
|
-
const [componentWidth, setComponentWidth] = (0,
|
|
3722
|
-
const [scrollPosition, setScrollPosition] = (0,
|
|
3723
|
-
const [dataItem, setDataItem] = (0,
|
|
3724
|
-
const [openModal, setOpenModal] = (0,
|
|
3658
|
+
const [dataMenu, setDataMenu] = (0, import_react16.useState)([]);
|
|
3659
|
+
const [openMenu, setOpenMenu] = (0, import_react16.useState)(false);
|
|
3660
|
+
const [url, setUrl] = (0, import_react16.useState)("");
|
|
3661
|
+
const [contentWidth, setContentWidth] = (0, import_react16.useState)(0);
|
|
3662
|
+
const [componentWidth, setComponentWidth] = (0, import_react16.useState)(0);
|
|
3663
|
+
const [scrollPosition, setScrollPosition] = (0, import_react16.useState)(0);
|
|
3664
|
+
const [dataItem, setDataItem] = (0, import_react16.useState)([]);
|
|
3665
|
+
const [openModal, setOpenModal] = (0, import_react16.useState)({});
|
|
3725
3666
|
const handleWindowResize = () => {
|
|
3726
3667
|
const tabEle = document.getElementById(`tab-component-${resourceCode}`);
|
|
3727
3668
|
const tabContent = document.getElementById(`content-component-${resourceCode}`);
|
|
@@ -3730,7 +3671,7 @@ var TabsMenuComponent = ({
|
|
|
3730
3671
|
setContentWidth(tabContent?.offsetWidth ?? 0);
|
|
3731
3672
|
}
|
|
3732
3673
|
};
|
|
3733
|
-
(0,
|
|
3674
|
+
(0, import_react16.useEffect)(() => {
|
|
3734
3675
|
setUrl(window.location.pathname);
|
|
3735
3676
|
window.addEventListener("resize", handleWindowResize);
|
|
3736
3677
|
setTimeout(() => {
|
|
@@ -3746,7 +3687,7 @@ var TabsMenuComponent = ({
|
|
|
3746
3687
|
window.removeEventListener("resize", handleWindowResize);
|
|
3747
3688
|
};
|
|
3748
3689
|
}, []);
|
|
3749
|
-
(0,
|
|
3690
|
+
(0, import_react16.useEffect)(() => {
|
|
3750
3691
|
const item = resources?.find((x) => x.code === (resourceCodeParent ? resourceCodeParent : resourceCode));
|
|
3751
3692
|
if (item) {
|
|
3752
3693
|
if (resourceCodeParent) {
|
|
@@ -3777,23 +3718,23 @@ var TabsMenuComponent = ({
|
|
|
3777
3718
|
const handleModal = (name) => {
|
|
3778
3719
|
setOpenModal((old) => ({ ...old, [name]: !(openModal[name] ?? false) }));
|
|
3779
3720
|
};
|
|
3780
|
-
return /* @__PURE__ */ (0,
|
|
3721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react16.Fragment, { children: [
|
|
3781
3722
|
renderModal ? renderModal({ handleModal, windowSize, openModal, setDataItem, dataItem }) : "",
|
|
3782
|
-
/* @__PURE__ */ (0,
|
|
3783
|
-
/* @__PURE__ */ (0,
|
|
3723
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: (0, import_classnames14.default)("tab-custom", { "tab-parent": tabParent }, { "tab-child": tabChild }), style: { width: `calc(100% - ${buttonWidth ?? 100}px` }, children: [
|
|
3724
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3784
3725
|
"div",
|
|
3785
3726
|
{
|
|
3786
3727
|
onClick: () => handleScroll(-200),
|
|
3787
|
-
className: (0,
|
|
3788
|
-
children: /* @__PURE__ */ (0,
|
|
3728
|
+
className: (0, import_classnames14.default)("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3729
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_becoxy_icons7.ChevronLeft, {})
|
|
3789
3730
|
}
|
|
3790
3731
|
),
|
|
3791
|
-
/* @__PURE__ */ (0,
|
|
3732
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id: `tab-component-${resourceCode}`, className: "tab-component", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id: `content-component-${resourceCode}`, children: dataMenu.map((item) => {
|
|
3792
3733
|
if (item?.resAttributes?.IS_MENU === "1") {
|
|
3793
|
-
return /* @__PURE__ */ (0,
|
|
3794
|
-
/* @__PURE__ */ (0,
|
|
3795
|
-
/* @__PURE__ */ (0,
|
|
3796
|
-
|
|
3734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_reactstrap11.UncontrolledDropdown, { className: "tab-custom-item", isOpen: openMenu, toggle: toggleMenu, direction: "down", style: { backgroundColor: openMenu ? "#e0e0e0" : "" }, children: [
|
|
3735
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.DropdownToggle, { color: "#00000", style: { border: "none", boxShadow: "none", margin: 0, padding: 0 }, className: "background-none", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { children: item.name }) }),
|
|
3736
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.DropdownMenu, { container: document.body, end: true, style: { width: 300 }, children: item?.children?.map((x) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3737
|
+
import_reactstrap11.DropdownItem,
|
|
3797
3738
|
{
|
|
3798
3739
|
style: { borderRadius: "5px", margin: "0 0.5rem", width: "95%" },
|
|
3799
3740
|
onClick: () => {
|
|
@@ -3809,23 +3750,23 @@ var TabsMenuComponent = ({
|
|
|
3809
3750
|
)) })
|
|
3810
3751
|
] }, item.code);
|
|
3811
3752
|
} else {
|
|
3812
|
-
return /* @__PURE__ */ (0,
|
|
3753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3813
3754
|
import_react_router_dom.Link,
|
|
3814
3755
|
{
|
|
3815
3756
|
to: item.url,
|
|
3816
|
-
className: (0,
|
|
3757
|
+
className: (0, import_classnames14.default)("tab-custom-item", { active: item.url === url || tabParent && url?.split("/").length > 3 && item.url.startsWith(url.substring(0, url.lastIndexOf("/"))) }),
|
|
3817
3758
|
children: item.name
|
|
3818
3759
|
},
|
|
3819
3760
|
item.code
|
|
3820
3761
|
);
|
|
3821
3762
|
}
|
|
3822
3763
|
}) }) }),
|
|
3823
|
-
/* @__PURE__ */ (0,
|
|
3764
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3824
3765
|
"div",
|
|
3825
3766
|
{
|
|
3826
3767
|
onClick: () => handleScroll(200),
|
|
3827
|
-
className: (0,
|
|
3828
|
-
children: /* @__PURE__ */ (0,
|
|
3768
|
+
className: (0, import_classnames14.default)("btn-scroll", { "d-none": componentWidth >= contentWidth - 20 }),
|
|
3769
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_becoxy_icons7.ChevronRight, {})
|
|
3829
3770
|
}
|
|
3830
3771
|
)
|
|
3831
3772
|
] })
|
|
@@ -3834,9 +3775,9 @@ var TabsMenuComponent = ({
|
|
|
3834
3775
|
|
|
3835
3776
|
// test-app/src/component/input-style/index.tsx
|
|
3836
3777
|
var import_becoxy_icons8 = require("becoxy-icons");
|
|
3837
|
-
var
|
|
3838
|
-
var
|
|
3839
|
-
var
|
|
3778
|
+
var import_reactstrap12 = require("reactstrap");
|
|
3779
|
+
var import_classnames15 = __toESM(require("classnames"));
|
|
3780
|
+
var import_react17 = require("react");
|
|
3840
3781
|
|
|
3841
3782
|
// test-app/src/component/input-style/fonts.ts
|
|
3842
3783
|
var OptionFont = [
|
|
@@ -4695,7 +4636,7 @@ var OptionFont = [
|
|
|
4695
4636
|
];
|
|
4696
4637
|
|
|
4697
4638
|
// test-app/src/component/input-style/index.tsx
|
|
4698
|
-
var
|
|
4639
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
4699
4640
|
var InputStyleComponent = (props) => {
|
|
4700
4641
|
const {
|
|
4701
4642
|
value,
|
|
@@ -4709,8 +4650,8 @@ var InputStyleComponent = (props) => {
|
|
|
4709
4650
|
disabledItalic,
|
|
4710
4651
|
disabledUnderline
|
|
4711
4652
|
} = props;
|
|
4712
|
-
return /* @__PURE__ */ (0,
|
|
4713
|
-
/* @__PURE__ */ (0,
|
|
4653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react17.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "d-flex align-items-center", children: [
|
|
4654
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4714
4655
|
SelectTable,
|
|
4715
4656
|
{
|
|
4716
4657
|
options: OptionFont,
|
|
@@ -4726,12 +4667,12 @@ var InputStyleComponent = (props) => {
|
|
|
4726
4667
|
field: "label",
|
|
4727
4668
|
headerText: "",
|
|
4728
4669
|
template: (row) => {
|
|
4729
|
-
return /* @__PURE__ */ (0,
|
|
4670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { fontFamily: row.label }, children: row.label });
|
|
4730
4671
|
}
|
|
4731
4672
|
}
|
|
4732
4673
|
],
|
|
4733
4674
|
formatOptionLabel: (props2) => {
|
|
4734
|
-
return /* @__PURE__ */ (0,
|
|
4675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { style: {
|
|
4735
4676
|
paddingLeft: 3,
|
|
4736
4677
|
borderRadius: 2,
|
|
4737
4678
|
fontFamily: value.fontFamily,
|
|
@@ -4744,7 +4685,7 @@ var InputStyleComponent = (props) => {
|
|
|
4744
4685
|
}
|
|
4745
4686
|
}
|
|
4746
4687
|
),
|
|
4747
|
-
/* @__PURE__ */ (0,
|
|
4688
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: (0, import_classnames15.default)("ms-25", { "d-none": disabledFontSize }), style: { width: 60 }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4748
4689
|
SelectTable,
|
|
4749
4690
|
{
|
|
4750
4691
|
options: Array.from({ length: 100 }, (_, i) => ({ value: i + 1, label: i + 1 })),
|
|
@@ -4756,45 +4697,45 @@ var InputStyleComponent = (props) => {
|
|
|
4756
4697
|
}
|
|
4757
4698
|
}
|
|
4758
4699
|
) }),
|
|
4759
|
-
/* @__PURE__ */ (0,
|
|
4700
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4760
4701
|
"div",
|
|
4761
4702
|
{
|
|
4762
|
-
className: (0,
|
|
4703
|
+
className: (0, import_classnames15.default)("btn-input-style", { "active-custom": value.bold }, { "d-none": disabledBold }),
|
|
4763
4704
|
onClick: () => {
|
|
4764
4705
|
if (!disabled) {
|
|
4765
4706
|
onChange({ ...value, bold: !value.bold });
|
|
4766
4707
|
}
|
|
4767
4708
|
},
|
|
4768
|
-
children: /* @__PURE__ */ (0,
|
|
4709
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_becoxy_icons8.Bold, { fontSize: 18 })
|
|
4769
4710
|
}
|
|
4770
4711
|
),
|
|
4771
|
-
/* @__PURE__ */ (0,
|
|
4712
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4772
4713
|
"div",
|
|
4773
4714
|
{
|
|
4774
|
-
className: (0,
|
|
4715
|
+
className: (0, import_classnames15.default)("btn-input-style", { "active-custom": value.italic }, { "d-none": disabledItalic }),
|
|
4775
4716
|
onClick: () => {
|
|
4776
4717
|
if (!disabled) {
|
|
4777
4718
|
onChange({ ...value, italic: !value.italic });
|
|
4778
4719
|
}
|
|
4779
4720
|
},
|
|
4780
|
-
children: /* @__PURE__ */ (0,
|
|
4721
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_becoxy_icons8.Italic, { fontSize: 18 })
|
|
4781
4722
|
}
|
|
4782
4723
|
),
|
|
4783
|
-
/* @__PURE__ */ (0,
|
|
4724
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4784
4725
|
"div",
|
|
4785
4726
|
{
|
|
4786
|
-
className: (0,
|
|
4727
|
+
className: (0, import_classnames15.default)("btn-input-style", { "active-custom": value.underline }, { "d-none": disabledUnderline }),
|
|
4787
4728
|
onClick: () => {
|
|
4788
4729
|
if (!disabled) {
|
|
4789
4730
|
onChange({ ...value, underline: !value.underline });
|
|
4790
4731
|
}
|
|
4791
4732
|
},
|
|
4792
|
-
children: /* @__PURE__ */ (0,
|
|
4733
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_becoxy_icons8.Underline, { fontSize: 18 })
|
|
4793
4734
|
}
|
|
4794
4735
|
),
|
|
4795
|
-
/* @__PURE__ */ (0,
|
|
4796
|
-
/* @__PURE__ */ (0,
|
|
4797
|
-
/* @__PURE__ */ (0,
|
|
4736
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_reactstrap12.Button, { tag: "label", color: "none", className: (0, import_classnames15.default)("btn-input-style", { "d-none": disabledColor }), children: [
|
|
4737
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_becoxy_icons8.Type, { stroke: value.color ?? "#000000", fontSize: 18 }),
|
|
4738
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4798
4739
|
"input",
|
|
4799
4740
|
{
|
|
4800
4741
|
type: "color",
|
|
@@ -4808,10 +4749,10 @@ var InputStyleComponent = (props) => {
|
|
|
4808
4749
|
}
|
|
4809
4750
|
)
|
|
4810
4751
|
] }),
|
|
4811
|
-
/* @__PURE__ */ (0,
|
|
4812
|
-
/* @__PURE__ */ (0,
|
|
4813
|
-
/* @__PURE__ */ (0,
|
|
4814
|
-
|
|
4752
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_reactstrap12.Button, { tag: "label", color: "none", className: (0, import_classnames15.default)("btn-input-style", { "d-none": disabledBackgroundColor }), children: [
|
|
4753
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_becoxy_icons8.Droplet, { fill: value.backgroundColor ?? "#ffffff", fontSize: 18 }),
|
|
4754
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4755
|
+
import_reactstrap12.Input,
|
|
4815
4756
|
{
|
|
4816
4757
|
id: "backgroundColor",
|
|
4817
4758
|
type: "color",
|