react-table-edit 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,2651 @@
1
+ // test-app/component/table/index.tsx
2
+ import { Fragment as Fragment12, forwardRef as forwardRef2, useEffect as useEffect5, useImperativeHandle, useRef as useRef3, useState as useState5 } from "react";
3
+ import { Button as Button3, DropdownMenu as DropdownMenu2, DropdownToggle as DropdownToggle2, Input as Input6, UncontrolledDropdown } from "reactstrap";
4
+ import classnames5 from "classnames";
5
+ import { useTranslation as useTranslation8 } from "react-i18next";
6
+ import Select2 from "react-select";
7
+ import { PagerComponent } from "@syncfusion/ej2-react-grids";
8
+ import AsyncSelect from "react-select/async";
9
+ import { AlertCircle, Info as Info2, Settings } from "becoxy-icons";
10
+
11
+ // test-app/component/react-input/index.tsx
12
+ import { X } from "becoxy-icons";
13
+ import classNames from "classnames";
14
+ import { Fragment, useState } from "react";
15
+ import { Input } from "reactstrap";
16
+ import { jsx, jsxs } from "react/jsx-runtime";
17
+ var ReactInput = (props) => {
18
+ const { setSearchTerm, onKeyPress, placeholder, style } = props;
19
+ const [value, setValue] = useState(props.value);
20
+ const handelClear = () => {
21
+ setValue("");
22
+ setSearchTerm("");
23
+ };
24
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { children: [
25
+ /* @__PURE__ */ jsx(
26
+ Input,
27
+ {
28
+ style,
29
+ placeholder,
30
+ onKeyPress,
31
+ className: classNames("input__value", {
32
+ "is-clearable": value
33
+ }),
34
+ value,
35
+ onChange: (val) => setValue(val.target.value)
36
+ }
37
+ ),
38
+ value ? /* @__PURE__ */ jsx(X, { className: "input__clear-icon", onClick: handelClear, strokeWidth: 3, fontSize: 16 }) : ""
39
+ ] }) });
40
+ };
41
+ var react_input_default = ReactInput;
42
+
43
+ // test-app/component/notifications.tsx
44
+ import { Fragment as Fragment2 } from "react";
45
+ import Swal from "sweetalert2";
46
+ import withReactContent from "sweetalert2-react-content";
47
+ import toast from "react-hot-toast";
48
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
49
+ var MySwal = withReactContent(Swal);
50
+ var notificationSuccess = (param) => {
51
+ return toast.success(
52
+ /* @__PURE__ */ jsxs2(Fragment2, { children: [
53
+ /* @__PURE__ */ jsx2("div", { className: "toastify-header", children: /* @__PURE__ */ jsx2("div", { className: "title-wrapper", children: /* @__PURE__ */ jsx2("h6", { className: "toast-title", children: param }) }) }),
54
+ /* @__PURE__ */ jsx2("div", { className: "toastify-body", children: /* @__PURE__ */ jsx2("ul", { className: "list-unstyled mb-0", children: /* @__PURE__ */ jsx2("li", {}) }) })
55
+ ] })
56
+ );
57
+ };
58
+ var messageBoxError = (t, message) => {
59
+ MySwal.fire({
60
+ title: t("Important"),
61
+ text: t(message),
62
+ allowOutsideClick: false,
63
+ showCancelButton: true,
64
+ showConfirmButton: false,
65
+ cancelButtonText: t("Ok"),
66
+ customClass: {
67
+ cancelButton: "btn btn-danger ms-1"
68
+ },
69
+ buttonsStyling: false
70
+ });
71
+ };
72
+ var messageHtmlBoxError = (t, message, title) => {
73
+ MySwal.fire({
74
+ title: title ? t(title) : t("Important"),
75
+ html: message.map((item, index) => {
76
+ return `<div style="min-width: 448px padding: 7px width:100% border: 1px solid #e0e0e0${index !== 0 ? " border-top-width: 0px" : ""}">${item}</div>`;
77
+ }).join(""),
78
+ allowOutsideClick: false,
79
+ showCancelButton: true,
80
+ showConfirmButton: false,
81
+ cancelButtonText: t("Ok"),
82
+ width: "auto",
83
+ customClass: {
84
+ cancelButton: "btn btn-danger ms-1"
85
+ },
86
+ buttonsStyling: false
87
+ });
88
+ };
89
+ var messageBoxConfirmDelete = (t, handle, data) => {
90
+ MySwal.fire({
91
+ title: t("Confirm"),
92
+ text: t("Do you want to delete item?"),
93
+ allowOutsideClick: false,
94
+ showCancelButton: true,
95
+ confirmButtonText: t("Delete"),
96
+ cancelButtonText: t("Cancel"),
97
+ customClass: {
98
+ confirmButton: "btn btn-primary",
99
+ cancelButton: "btn btn-danger ms-1"
100
+ },
101
+ buttonsStyling: false
102
+ }).then(async (result) => {
103
+ if (result.value) {
104
+ handle(data);
105
+ }
106
+ });
107
+ };
108
+ var messageBoxConfirmApprove = (t, handle, data) => {
109
+ MySwal.fire({
110
+ title: t("Confirm"),
111
+ text: t("Do you want to approve item?"),
112
+ allowOutsideClick: false,
113
+ showCancelButton: true,
114
+ confirmButtonText: t("Approve"),
115
+ cancelButtonText: t("Cancel"),
116
+ customClass: {
117
+ confirmButton: "btn btn-primary",
118
+ cancelButton: "btn btn-danger ms-1"
119
+ },
120
+ buttonsStyling: false
121
+ }).then(async (result) => {
122
+ if (result.value) {
123
+ handle(data);
124
+ }
125
+ });
126
+ };
127
+ var messageBoxConfirm = (t, handle, data, message) => {
128
+ MySwal.fire({
129
+ title: t("Confirm"),
130
+ text: t(message),
131
+ allowOutsideClick: false,
132
+ showCancelButton: true,
133
+ confirmButtonText: t("Ok"),
134
+ cancelButtonText: t("Cancel"),
135
+ customClass: {
136
+ confirmButton: "btn btn-primary",
137
+ cancelButton: "btn btn-danger ms-1"
138
+ },
139
+ buttonsStyling: false
140
+ }).then(async (result) => {
141
+ if (result.value) {
142
+ handle(data);
143
+ }
144
+ });
145
+ };
146
+ var notificationError = (param) => {
147
+ return toast.error(
148
+ /* @__PURE__ */ jsxs2(Fragment2, { children: [
149
+ /* @__PURE__ */ jsx2("div", { className: "toastify-header", children: /* @__PURE__ */ jsx2("div", { className: "title-wrapper", children: /* @__PURE__ */ jsx2("h6", { className: "toast-title", children: param }) }) }),
150
+ /* @__PURE__ */ jsx2("div", { className: "toastify-body", children: /* @__PURE__ */ jsx2("ul", { className: "list-unstyled mb-0", children: /* @__PURE__ */ jsx2("li", {}) }) })
151
+ ] })
152
+ );
153
+ };
154
+ var messageBoxConfirm2 = async (t, data, data2, message) => {
155
+ return new Promise((resolve) => {
156
+ MySwal.fire({
157
+ title: t("Confirm"),
158
+ text: t(message),
159
+ allowOutsideClick: false,
160
+ showCancelButton: true,
161
+ confirmButtonText: t("Ok"),
162
+ cancelButtonText: t("Cancel"),
163
+ customClass: {
164
+ confirmButton: "btn btn-primary",
165
+ cancelButton: "btn btn-danger ms-1"
166
+ },
167
+ buttonsStyling: false
168
+ }).then((result) => {
169
+ if (result.isConfirmed) {
170
+ resolve(true);
171
+ } else {
172
+ resolve(false);
173
+ }
174
+ });
175
+ });
176
+ };
177
+
178
+ // test-app/component/utils.ts
179
+ import { useEffect } from "react";
180
+ var useOnClickOutside = (ref, handler) => {
181
+ useEffect(
182
+ () => {
183
+ const listener = (event) => {
184
+ if (!ref.current || ref.current.contains(event.target)) {
185
+ return;
186
+ }
187
+ handler(event);
188
+ };
189
+ document.addEventListener("mousedown", listener);
190
+ document.addEventListener("touchstart", listener);
191
+ return () => {
192
+ document.removeEventListener("mousedown", listener);
193
+ document.removeEventListener("touchstart", listener);
194
+ };
195
+ },
196
+ // ** Add ref and handler to effect dependencies
197
+ // ** It's worth noting that because passed in handler is a new ...
198
+ // ** ... function on every render that will cause this effect ...
199
+ // ** ... callback/cleanup to run every render. It's not a big deal ...
200
+ // ** ... but to optimize you can wrap handler in useCallback before ...
201
+ // ** ... passing it into this hook.
202
+ [ref, handler]
203
+ );
204
+ };
205
+ var isNullOrUndefined = (d) => {
206
+ if (d === null || d === void 0) {
207
+ return true;
208
+ }
209
+ return false;
210
+ };
211
+ var generateUUID = () => {
212
+ let d = (/* @__PURE__ */ new Date()).getTime();
213
+ let d2 = typeof performance !== "undefined" && performance.now && performance.now() * 1e3 || 0;
214
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
215
+ let r = Math.random() * 16;
216
+ if (d > 0) {
217
+ r = (d + r) % 16 | 0;
218
+ d = Math.floor(d / 16);
219
+ } else {
220
+ r = (d2 + r) % 16 | 0;
221
+ d2 = Math.floor(d2 / 16);
222
+ }
223
+ return (c === "x" ? r : 3).toString(16);
224
+ });
225
+ };
226
+ var formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10, isDone) => {
227
+ if (str || str == "0") {
228
+ str = str.toString();
229
+ const value = decimalSeparator !== "." ? str.toString().replaceAll(".", decimalSeparator ?? "") : str;
230
+ const arr = value.toString().split(decimalSeparator ?? "", 2);
231
+ let flag = value.toString().includes(decimalSeparator ?? "");
232
+ if ((arr[0]?.length ?? 0) < 3) {
233
+ return flag ? `${arr[0]}${decimalSeparator}${arr[1]?.substring(0, fraction) ?? ""}` : arr[0];
234
+ } else {
235
+ let count = 0;
236
+ for (let i = (arr[0]?.length ?? 0) - 2; i >= 0; i--) {
237
+ if (((arr[0]?.length ?? 0) - i - count) % 3 === 0 && i > 0) {
238
+ arr[0] = `${arr[0]?.substring(0, i)}${thousandSeparator}${arr[0]?.substring(i, arr[0]?.length ?? 0)}`;
239
+ count++;
240
+ }
241
+ }
242
+ if (arr[0]?.lastIndexOf(thousandSeparator ?? "") === (arr[0]?.length ?? 0) - 1) {
243
+ arr[0] = arr[0]?.slice(0, (arr[0]?.length ?? 0) - 1);
244
+ }
245
+ if (isDone) {
246
+ flag = (arr[1]?.substring(0, fraction) ?? "") !== "";
247
+ }
248
+ return flag ? `${arr[0]}${decimalSeparator}${arr[1]?.substring(0, fraction) ?? ""}` : arr[0];
249
+ }
250
+ } else {
251
+ return "";
252
+ }
253
+ };
254
+
255
+ // test-app/component/icon/index.tsx
256
+ import * as Icon from "becoxy-icons";
257
+ import { Fragment as Fragment3 } from "react";
258
+ import { jsx as jsx3 } from "react/jsx-runtime";
259
+ var IconCustom = (props) => {
260
+ const { iconName, size } = props;
261
+ if (iconName === "") {
262
+ return null;
263
+ } else {
264
+ const TagIcon = iconName === "" ? "" : Icon[iconName];
265
+ return /* @__PURE__ */ jsx3(Fragment3, { children: iconName === "" ? "" : /* @__PURE__ */ jsx3(TagIcon, { fontSize: size }) });
266
+ }
267
+ };
268
+ var icon_default = IconCustom;
269
+
270
+ // test-app/component/table/index.tsx
271
+ import moment from "moment";
272
+ import { DropDownTreeComponent } from "@syncfusion/ej2-react-dropdowns";
273
+
274
+ // test-app/component/edit-form/index.tsx
275
+ import { forwardRef, useEffect as useEffect2, useRef, useState as useState2 } from "react";
276
+ import {
277
+ DropdownItem,
278
+ DropdownMenu,
279
+ DropdownToggle,
280
+ Dropdown,
281
+ Input as Input4,
282
+ Form,
283
+ Row,
284
+ Button,
285
+ Col
286
+ } from "reactstrap";
287
+ import { useForm } from "react-hook-form";
288
+ import { yupResolver } from "@hookform/resolvers/yup";
289
+ import { useTranslation as useTranslation5 } from "react-i18next";
290
+ import classNames2 from "classnames";
291
+
292
+ // test-app/component/input-text/index.tsx
293
+ import { Controller } from "react-hook-form";
294
+ import { Input as Input2, Label, FormFeedback } from "reactstrap";
295
+ import classnames from "classnames";
296
+ import { Fragment as Fragment4 } from "react";
297
+ import { useTranslation } from "react-i18next";
298
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
299
+ var TextInput = (props) => {
300
+ const { t } = useTranslation();
301
+ const { control, id, name, min, max, type, label, labelSize, required, errors, height, disabled, row, isLabel, placeholder, autoFocus, inLine, callback, readOnly, classes, ...rest } = props;
302
+ const renderLabel = () => {
303
+ return /* @__PURE__ */ jsx4(Fragment4, { children: isLabel === false ? "" : /* @__PURE__ */ jsxs3(Label, { for: name, children: [
304
+ t(label ? label : ""),
305
+ " ",
306
+ required ? /* @__PURE__ */ jsx4("span", { className: "text-danger", children: "*" }) : "",
307
+ " "
308
+ ] }) });
309
+ };
310
+ const renderInput = () => {
311
+ return /* @__PURE__ */ jsxs3(Fragment4, { children: [
312
+ /* @__PURE__ */ jsx4(
313
+ Controller,
314
+ {
315
+ name,
316
+ control,
317
+ render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsx4(
318
+ Input2,
319
+ {
320
+ id,
321
+ value: !isNullOrUndefined(value) ? value : "",
322
+ onChange: (val) => {
323
+ if (min || max) {
324
+ if (min && Number(val.target.value) >= min) {
325
+ onChange(val.target.value);
326
+ if (callback) {
327
+ callback(val);
328
+ }
329
+ }
330
+ if (max && Number(val.target.value) <= max) {
331
+ onChange(val.target.value);
332
+ if (callback) {
333
+ callback(val);
334
+ }
335
+ }
336
+ } else {
337
+ onChange(val.target.value);
338
+ if (callback) {
339
+ callback(val);
340
+ }
341
+ }
342
+ },
343
+ style: { height: `${height}px` },
344
+ autoFocus,
345
+ disabled,
346
+ placeholder,
347
+ type: type ? type : "text",
348
+ invalid: errors && true,
349
+ className: "h-100",
350
+ rows: row,
351
+ min,
352
+ max,
353
+ readOnly,
354
+ ...rest
355
+ }
356
+ )
357
+ }
358
+ ),
359
+ errors && /* @__PURE__ */ jsx4(FormFeedback, { children: errors?.message })
360
+ ] });
361
+ };
362
+ return /* @__PURE__ */ jsx4(Fragment4, { children: /* @__PURE__ */ jsxs3(
363
+ "div",
364
+ {
365
+ className: classnames(
366
+ " align",
367
+ {
368
+ [labelSize ? labelSize : ""]: labelSize,
369
+ [classes ? classes : ""]: classes,
370
+ "form-row-inline-error": errors
371
+ },
372
+ inLine === false ? "form-group " : "form-row-inline d-flex"
373
+ ),
374
+ children: [
375
+ renderLabel(),
376
+ /* @__PURE__ */ jsx4("div", { className: classnames("form-input-content", { "hidden-label": isLabel === false }), children: renderInput() })
377
+ ]
378
+ }
379
+ ) });
380
+ };
381
+ var input_text_default = TextInput;
382
+
383
+ // test-app/component/select/index.tsx
384
+ import { Controller as Controller2 } from "react-hook-form";
385
+ import { Label as Label2, FormFeedback as FormFeedback2 } from "reactstrap";
386
+ import Select from "react-select";
387
+ import classnames2 from "classnames";
388
+ import { Fragment as Fragment5 } from "react";
389
+ import { useTranslation as useTranslation2 } from "react-i18next";
390
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
391
+ var SelectBox = (props) => {
392
+ const { t } = useTranslation2();
393
+ 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;
394
+ const handChange = ({ onChange, val }) => {
395
+ onChange(!isNullOrUndefined(val) && isMulti ? val.map((item) => item.value) : !isNullOrUndefined(val) && !isMulti ? fieldValue ? val[fieldValue] : val?.value : void 0);
396
+ if (callback) {
397
+ callback(val);
398
+ }
399
+ };
400
+ const renderSelect = () => {
401
+ return /* @__PURE__ */ jsxs4(Fragment5, { children: [
402
+ /* @__PURE__ */ jsx5(
403
+ Controller2,
404
+ {
405
+ name,
406
+ control,
407
+ render: ({ field: { value, onChange } }) => {
408
+ return /* @__PURE__ */ jsx5(
409
+ Select,
410
+ {
411
+ ...rest,
412
+ id,
413
+ 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) : "",
414
+ onChange: (val) => {
415
+ if ((fieldValue && val ? val[fieldValue] : val?.value) !== value) {
416
+ if (confirmHandle) {
417
+ confirmHandle(handChange, onChange, val);
418
+ } else {
419
+ onChange(!isNullOrUndefined(val) && isMulti ? val.map((item) => item.value) : !isNullOrUndefined(val) && !isMulti ? fieldValue ? val[fieldValue] : val?.value : void 0);
420
+ if (callback) {
421
+ callback(val);
422
+ }
423
+ }
424
+ }
425
+ },
426
+ onInputChange,
427
+ form: name,
428
+ placeholder: placeholder ? placeholder : "",
429
+ classNamePrefix: "select",
430
+ className: `react-select ${errors && "is-invalid"}`,
431
+ options,
432
+ isMulti,
433
+ isDisabled: disabled,
434
+ isClearable,
435
+ menuPosition: menuPosition ?? "fixed",
436
+ formatOptionLabel: labelComponent ? labelComponent : void 0,
437
+ ref
438
+ }
439
+ );
440
+ }
441
+ }
442
+ ),
443
+ errors && /* @__PURE__ */ jsx5(FormFeedback2, { children: errors?.message })
444
+ ] });
445
+ };
446
+ return /* @__PURE__ */ jsx5(Fragment5, { children: /* @__PURE__ */ jsxs4(
447
+ "div",
448
+ {
449
+ className: classnames2(
450
+ inLine === false ? "form-group " : "form-row-inline d-flex",
451
+ "align",
452
+ {
453
+ [labelSize ? labelSize : ""]: labelSize,
454
+ [classes ? classes : ""]: classes,
455
+ "form-row-inline-error": errors
456
+ }
457
+ ),
458
+ children: [
459
+ isLabel === false ? "" : /* @__PURE__ */ jsxs4(Label2, { className: "form-label", for: name, children: [
460
+ t(label ? label : ""),
461
+ " ",
462
+ required ? /* @__PURE__ */ jsx5("span", { className: "text-danger", children: "*" }) : "",
463
+ " "
464
+ ] }),
465
+ /* @__PURE__ */ jsx5("div", { className: classnames2("form-input-content", { "hidden-label": isLabel === false }), children: renderSelect() })
466
+ ]
467
+ }
468
+ ) });
469
+ };
470
+ var select_default = SelectBox;
471
+
472
+ // test-app/component/creactable-select/index.tsx
473
+ import { Controller as Controller3 } from "react-hook-form";
474
+ import { Label as Label3, FormFeedback as FormFeedback3 } from "reactstrap";
475
+ import classnames3 from "classnames";
476
+ import { Fragment as Fragment6 } from "react";
477
+ import { useTranslation as useTranslation3 } from "react-i18next";
478
+ import CreatableSelect from "react-select/creatable";
479
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
480
+ var CreatableSelectBox = (props) => {
481
+ const { t } = useTranslation3();
482
+ const { isMulti, id, isLabel, control, placeholder, fieldValue, name, options, label, labelSize, required, errors, inLine, isClearable, labelComponent, onInputChange, callback, ...rest } = props;
483
+ return /* @__PURE__ */ jsx6(Fragment6, { children: /* @__PURE__ */ jsxs5(
484
+ "div",
485
+ {
486
+ className: classnames3(
487
+ inLine === false ? "form-group " : "form-row-inline d-flex",
488
+ "align",
489
+ {
490
+ [labelSize ? labelSize : ""]: labelSize,
491
+ "form-row-inline-error": errors
492
+ }
493
+ ),
494
+ children: [
495
+ isLabel === false ? "" : /* @__PURE__ */ jsxs5(Label3, { className: "form-label", for: name, children: [
496
+ t(label),
497
+ " ",
498
+ required ? /* @__PURE__ */ jsx6("span", { className: "text-danger", children: "*" }) : "",
499
+ " "
500
+ ] }),
501
+ /* @__PURE__ */ jsxs5("div", { className: classnames3("form-input-content", { "hidden-label": isLabel === false }), children: [
502
+ /* @__PURE__ */ jsx6(
503
+ Controller3,
504
+ {
505
+ name,
506
+ control,
507
+ render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsx6(
508
+ CreatableSelect,
509
+ {
510
+ ...rest,
511
+ id,
512
+ 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) : "",
513
+ onChange: (val) => {
514
+ if (fieldValue && val.__isNew__) {
515
+ val[fieldValue] = val.value;
516
+ }
517
+ onChange(!isNullOrUndefined(val) && isMulti ? val.map((item) => item.value) : !isNullOrUndefined(val) && !isMulti ? fieldValue ? val[fieldValue] : val?.value : void 0);
518
+ if (callback) {
519
+ callback(val);
520
+ }
521
+ },
522
+ onInputChange,
523
+ classNamePrefix: "select",
524
+ className: `react-select ${errors && "is-invalid"}`,
525
+ options,
526
+ placeholder,
527
+ isMulti,
528
+ isClearable,
529
+ menuPosition: "fixed",
530
+ formatOptionLabel: labelComponent ? labelComponent : void 0
531
+ }
532
+ )
533
+ }
534
+ ),
535
+ errors && /* @__PURE__ */ jsx6(FormFeedback3, { children: errors?.message })
536
+ ] })
537
+ ]
538
+ }
539
+ ) });
540
+ };
541
+ var creactable_select_default = CreatableSelectBox;
542
+
543
+ // test-app/component/input-number/index.tsx
544
+ import { Controller as Controller4 } from "react-hook-form";
545
+ import { Input as Input3, Label as Label4, FormFeedback as FormFeedback4 } from "reactstrap";
546
+ import classnames4 from "classnames";
547
+ import { Fragment as Fragment7 } from "react";
548
+ import { useTranslation as useTranslation4 } from "react-i18next";
549
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
550
+ var NumberInput = (props) => {
551
+ const { t } = useTranslation4();
552
+ const {
553
+ control,
554
+ id,
555
+ fractionCurrency = 10,
556
+ name,
557
+ min,
558
+ max,
559
+ type,
560
+ label,
561
+ labelSize,
562
+ required,
563
+ errors,
564
+ height,
565
+ disabled,
566
+ row,
567
+ isLabel,
568
+ placeholder,
569
+ autoFocus,
570
+ inLine,
571
+ callback,
572
+ readOnly,
573
+ decimalSeparator = ",",
574
+ thousandSeparator = ".",
575
+ classes,
576
+ ...rest
577
+ } = props;
578
+ const renderLabel = () => {
579
+ return /* @__PURE__ */ jsx7(Fragment7, { children: isLabel === false ? "" : /* @__PURE__ */ jsxs6(Label4, { className: "form-label", for: name, children: [
580
+ t(label ? label : ""),
581
+ " ",
582
+ required ? /* @__PURE__ */ jsx7("span", { className: "text-danger", children: "*" }) : "",
583
+ " "
584
+ ] }) });
585
+ };
586
+ const renderInput = () => {
587
+ return /* @__PURE__ */ jsxs6(Fragment7, { children: [
588
+ /* @__PURE__ */ jsx7(
589
+ Controller4,
590
+ {
591
+ name,
592
+ control,
593
+ render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsx7(
594
+ Input3,
595
+ {
596
+ id,
597
+ value: formartNumberic(value, decimalSeparator, thousandSeparator, fractionCurrency),
598
+ onChange: (val) => {
599
+ let newVal = "";
600
+ const flag = val.target?.value.startsWith("-");
601
+ if (val.target?.value.endsWith(decimalSeparator)) {
602
+ if ((val.target?.value.match(new RegExp(decimalSeparator === "," ? "," : "\\.", "g")) || []).length > 1 || fractionCurrency === 0) {
603
+ newVal = val.target?.value.slice(0, -1).replaceAll(thousandSeparator, "");
604
+ } else {
605
+ newVal = val.target?.value.replaceAll(thousandSeparator, "");
606
+ }
607
+ } else {
608
+ newVal = val.target.value.replaceAll(new RegExp(`[^0-9${decimalSeparator}]`, "g"), "");
609
+ }
610
+ if (decimalSeparator !== ".") {
611
+ newVal = newVal.replaceAll(decimalSeparator, ".");
612
+ }
613
+ onChange(flag ? `-${newVal}` : newVal);
614
+ },
615
+ onBlur: (val) => {
616
+ let newVal = "";
617
+ const flag = val.target?.value.startsWith("-");
618
+ if (val.target?.value.endsWith(decimalSeparator)) {
619
+ newVal = val.target?.value.slice(0, -1).replaceAll(new RegExp(`[^0-9${decimalSeparator}]`, "g"), "");
620
+ } else {
621
+ newVal = val.target.value.replaceAll(new RegExp(`[^0-9${decimalSeparator}]`, "g"), "");
622
+ }
623
+ if (decimalSeparator !== ".") {
624
+ newVal = newVal.replaceAll(decimalSeparator, ".");
625
+ }
626
+ let value2 = flag ? 0 - Number(newVal) : Number(newVal);
627
+ if (max !== void 0 && value2 > max) {
628
+ value2 = max;
629
+ } else if (min !== void 0 && value2 < min) {
630
+ value2 = min;
631
+ }
632
+ onChange(value2);
633
+ if (callback) {
634
+ callback(value2);
635
+ }
636
+ },
637
+ style: { height: `${height}px` },
638
+ autoFocus,
639
+ disabled,
640
+ placeholder,
641
+ type: type ? type : "text",
642
+ invalid: errors && true,
643
+ className: "h-100",
644
+ rows: row,
645
+ min,
646
+ max,
647
+ readOnly,
648
+ ...rest
649
+ }
650
+ )
651
+ }
652
+ ),
653
+ errors && /* @__PURE__ */ jsx7(FormFeedback4, { children: errors?.message })
654
+ ] });
655
+ };
656
+ return /* @__PURE__ */ jsx7(Fragment7, { children: /* @__PURE__ */ jsxs6(
657
+ "div",
658
+ {
659
+ className: classnames4(
660
+ " align",
661
+ {
662
+ [labelSize ? labelSize : ""]: labelSize,
663
+ [classes ? classes : ""]: classes,
664
+ "form-row-inline-error": errors
665
+ },
666
+ inLine === false ? "form-group " : "form-row-inline d-flex"
667
+ ),
668
+ children: [
669
+ renderLabel(),
670
+ /* @__PURE__ */ jsx7("div", { className: classnames4("form-input-content", { "hidden-label": isLabel === false }), children: renderInput() })
671
+ ]
672
+ }
673
+ ) });
674
+ };
675
+ var input_number_default = NumberInput;
676
+
677
+ // test-app/component/edit-form/index.tsx
678
+ import { Fragment as Fragment8, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
679
+ var defaultWidth = 200;
680
+ var EditForm = forwardRef((props, ref) => {
681
+ const {
682
+ id,
683
+ field,
684
+ displayValue,
685
+ menuHeight,
686
+ menuWidth,
687
+ rowData,
688
+ invalid,
689
+ onChange,
690
+ onChangeField,
691
+ onKeyDown,
692
+ defaultValues,
693
+ placeholder,
694
+ textAlign,
695
+ schema,
696
+ onFormOpen,
697
+ onFormSubmit,
698
+ footerTemplate,
699
+ minWidth,
700
+ openOnFocus,
701
+ labelSize = "label-small"
702
+ } = props;
703
+ const { innerWidth } = window;
704
+ const inputRef = useRef();
705
+ const editFormRef = useRef();
706
+ const buttonRef = useRef();
707
+ const [dropdownOpen, setDropdownOpen] = useState2(false);
708
+ const [itemsField, setItemsField] = useState2([]);
709
+ const { t } = useTranslation5();
710
+ useOnClickOutside(editFormRef, () => {
711
+ closeMenu();
712
+ });
713
+ const closeMenu = () => {
714
+ setTimeout(() => {
715
+ setDropdownOpen(false);
716
+ }, onChangeField ? 10 : 0);
717
+ };
718
+ const {
719
+ control,
720
+ handleSubmit,
721
+ getValues,
722
+ reset,
723
+ setValue,
724
+ formState: { errors }
725
+ } = useForm({
726
+ mode: "onChange",
727
+ defaultValues,
728
+ resolver: yupResolver(schema)
729
+ });
730
+ useEffect2(() => {
731
+ if (dropdownOpen) {
732
+ if (onFormOpen && itemsField.length === 0) {
733
+ onFormOpen(rowData, itemsField, setItemsField);
734
+ }
735
+ }
736
+ }, [dropdownOpen]);
737
+ useEffect2(() => {
738
+ if (dropdownOpen && itemsField.length > 0) {
739
+ itemsField.forEach((ele) => {
740
+ setValue(ele.name, rowData[ele.name] ?? "");
741
+ });
742
+ }
743
+ }, [dropdownOpen, itemsField]);
744
+ const handleOnClick = () => {
745
+ if (dropdownOpen) {
746
+ if (!openOnFocus) {
747
+ closeMenu();
748
+ }
749
+ } else {
750
+ setDropdownOpen(true);
751
+ }
752
+ };
753
+ const handleOnSubmit = (val) => {
754
+ closeMenu();
755
+ onChange(val);
756
+ if (onFormSubmit) {
757
+ onFormSubmit(rowData, setValue, getValues, reset);
758
+ }
759
+ inputRef.current.focus();
760
+ };
761
+ const focusElement = (id2, focus) => {
762
+ const element = document.getElementById(id2);
763
+ if (element) {
764
+ if (element.className.includes("react-select")) {
765
+ element.getElementsByTagName("input")[0]?.focus();
766
+ } else {
767
+ element.focus();
768
+ if (focus) {
769
+ element.setSelectionRange(0, element.innerText.length - 1);
770
+ }
771
+ }
772
+ }
773
+ };
774
+ const handleOnKeyDown = (e) => {
775
+ let flag = false;
776
+ if (dropdownOpen) {
777
+ if (e.code === "Escape") {
778
+ closeMenu();
779
+ flag = true;
780
+ } else if (e.code === "Enter") {
781
+ closeMenu();
782
+ flag = true;
783
+ } else if (e.code === "ArrowDown") {
784
+ focusElement(`form-element-${field}-0`);
785
+ flag = true;
786
+ }
787
+ } else {
788
+ if (e.code === "ArrowDown") {
789
+ setDropdownOpen(true);
790
+ focusElement(`form-element-${field}-0`);
791
+ flag = true;
792
+ } else if (e.code === "Space") {
793
+ setDropdownOpen(true);
794
+ flag = true;
795
+ }
796
+ }
797
+ if (onKeyDown && !flag) {
798
+ const key = onKeyDown(e);
799
+ if (key === "ArrowRight" || key === "ArrowLeft") {
800
+ closeMenu();
801
+ }
802
+ } else {
803
+ e.stopPropagation();
804
+ e.preventDefault();
805
+ }
806
+ };
807
+ const handleOnFocus = () => {
808
+ if (openOnFocus) {
809
+ setDropdownOpen(true);
810
+ if (field) {
811
+ setTimeout(() => {
812
+ focusElement(`form-element-${field}-0`, true);
813
+ }, 100);
814
+ }
815
+ }
816
+ };
817
+ const formKeyDown = (e, handSubmit) => {
818
+ if (e.code === "Enter") {
819
+ handSubmit();
820
+ e.preventDefault();
821
+ e.stopPropagation();
822
+ } else {
823
+ if (onKeyDown) {
824
+ const key = onKeyDown(e);
825
+ if (key === "ArrowRight" || key === "ArrowLeft") {
826
+ closeMenu();
827
+ }
828
+ }
829
+ }
830
+ };
831
+ const formItemKeyDown = (e, index) => {
832
+ if (e.code === "ArrowDown" && index < itemsField.length - 1) {
833
+ focusElement(`form-element-${field}-${index + 1}`);
834
+ e.preventDefault();
835
+ e.stopPropagation();
836
+ } else if (e.code === "ArrowUp" && index > 0) {
837
+ focusElement(`form-element-${field}-${index - 1}`);
838
+ e.preventDefault();
839
+ e.stopPropagation();
840
+ } else if (e.code === "Tab" && onChangeField && index === itemsField.length - 1) {
841
+ closeMenu();
842
+ }
843
+ };
844
+ const elementChange = (field2) => {
845
+ if (onChangeField) {
846
+ onChangeField(rowData, field2, setValue, getValues);
847
+ const rs = getValues();
848
+ if (rs) {
849
+ onChange(rs);
850
+ }
851
+ }
852
+ };
853
+ const renderForm = (rows) => {
854
+ return /* @__PURE__ */ jsx8(Row, { className: "gy-25", children: rows.map((item, index) => {
855
+ if (item.type === "numeric") {
856
+ return /* @__PURE__ */ jsx8(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx8(
857
+ input_number_default,
858
+ {
859
+ id: `form-element-${field}-${index}`,
860
+ control,
861
+ name: item.name,
862
+ label: item.label ? item.label : "",
863
+ labelSize: `text-left ${labelSize}`,
864
+ errors: errors[item.name],
865
+ disabled: item.disabled,
866
+ min: item.min,
867
+ max: item.max,
868
+ fractionCurrency: item.fraction,
869
+ callback: () => {
870
+ elementChange(item.name);
871
+ }
872
+ },
873
+ index
874
+ ) }, index);
875
+ } else if (item.type === "text") {
876
+ return /* @__PURE__ */ jsx8(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx8(
877
+ input_text_default,
878
+ {
879
+ id: `form-element-${field}-${index}`,
880
+ control,
881
+ name: item.name,
882
+ label: item.label ? item.label : "",
883
+ labelSize: `text-left ${labelSize}`,
884
+ errors: errors[item.name],
885
+ disabled: item.disabled,
886
+ callback: () => {
887
+ elementChange(item.name);
888
+ }
889
+ },
890
+ index
891
+ ) }, index);
892
+ } else if (item.type === "select") {
893
+ return /* @__PURE__ */ jsx8(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx8(
894
+ select_default,
895
+ {
896
+ id: `form-element-${field}-${index}`,
897
+ options: item.options ?? [],
898
+ control,
899
+ name: item.name,
900
+ label: item.label ? item.label : "",
901
+ labelSize: `text-left ${labelSize}`,
902
+ menuPortalTarget: document.body,
903
+ errors: errors[item.name],
904
+ disabled: item.disabled,
905
+ callback: () => {
906
+ elementChange(item.name);
907
+ }
908
+ },
909
+ index
910
+ ) }, index);
911
+ } else if (item.type === "selectCreatable") {
912
+ return /* @__PURE__ */ jsx8(Col, { xl: 12, onKeyDown: (e) => formItemKeyDown(e, index), children: /* @__PURE__ */ jsx8(
913
+ creactable_select_default,
914
+ {
915
+ id: `form-element-${field}-${index}`,
916
+ options: item.options ?? [],
917
+ control,
918
+ name: item.name,
919
+ placeholder: t("Select"),
920
+ menuPortalTarget: document.body,
921
+ label: item.label ? item.label : "",
922
+ labelSize: ` ${labelSize}`,
923
+ errors: errors[item.name],
924
+ callback: () => {
925
+ elementChange(item.name);
926
+ }
927
+ },
928
+ index
929
+ ) }, index);
930
+ }
931
+ }) });
932
+ };
933
+ return /* @__PURE__ */ jsx8(
934
+ "div",
935
+ {
936
+ className: "from-edit",
937
+ ref,
938
+ id,
939
+ children: /* @__PURE__ */ jsx8("div", { ref: editFormRef, children: /* @__PURE__ */ jsxs7(
940
+ Dropdown,
941
+ {
942
+ isOpen: dropdownOpen,
943
+ toggle: () => {
944
+ },
945
+ children: [
946
+ /* @__PURE__ */ jsx8(DropdownToggle, { tag: "div", children: /* @__PURE__ */ jsx8(
947
+ Input4,
948
+ {
949
+ style: { backgroundColor: "#FFF", textAlign: textAlign ?? "left" },
950
+ placeholder,
951
+ innerRef: inputRef,
952
+ className: classNames2("input-display", { "is-invalid": invalid }),
953
+ value: displayValue,
954
+ onFocus: handleOnFocus,
955
+ onClick: handleOnClick,
956
+ onKeyDown: (e) => handleOnKeyDown(e),
957
+ readOnly: true
958
+ }
959
+ ) }),
960
+ /* @__PURE__ */ jsx8(
961
+ DropdownMenu,
962
+ {
963
+ className: "formula-dropdown icon-dropdown p-0",
964
+ style: {
965
+ minWidth: minWidth ? minWidth : defaultWidth,
966
+ width: menuWidth ? menuWidth : "min-content",
967
+ maxWidth: innerWidth > 1280 ? 1280 : innerWidth,
968
+ borderRadius: 8,
969
+ zIndex: 1060
970
+ },
971
+ children: /* @__PURE__ */ jsx8(DropdownItem, { className: "p-0", style: { borderRadius: "6px" }, tag: "div", header: true, children: /* @__PURE__ */ jsxs7(Form, { className: "todo-modal", onKeyDown: (e) => formKeyDown(e, handleSubmit(handleOnSubmit)), children: [
972
+ /* @__PURE__ */ jsx8(
973
+ "div",
974
+ {
975
+ className: "p-1",
976
+ style: {
977
+ maxHeight: menuHeight ? menuHeight : 300,
978
+ overflow: "auto"
979
+ },
980
+ children: itemsField ? renderForm(itemsField) : ""
981
+ }
982
+ ),
983
+ /* @__PURE__ */ jsxs7("div", { className: "d-flex justify-content-between p-50", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: [
984
+ /* @__PURE__ */ jsx8("div", { className: "text-primary py-25", style: { fontSize: 12 }, children: footerTemplate ? footerTemplate(rowData) : "" }),
985
+ !onChangeField ? /* @__PURE__ */ jsx8(Fragment8, { children: /* @__PURE__ */ jsx8(
986
+ Button,
987
+ {
988
+ ref: buttonRef,
989
+ color: "primary",
990
+ className: "btn btn-primary py-25 px-50",
991
+ onClick: handleSubmit(handleOnSubmit),
992
+ onKeyDown: (e) => {
993
+ if (e.code === "Tab") {
994
+ closeMenu();
995
+ }
996
+ },
997
+ children: t("Save")
998
+ }
999
+ ) }) : /* @__PURE__ */ jsx8(Fragment8, {})
1000
+ ] })
1001
+ ] }) })
1002
+ }
1003
+ )
1004
+ ]
1005
+ }
1006
+ ) })
1007
+ }
1008
+ );
1009
+ });
1010
+ var edit_form_default = EditForm;
1011
+
1012
+ // test-app/component/sidebar-setting-column/index.tsx
1013
+ import { Fragment as Fragment10, useEffect as useEffect4, useRef as useRef2, useState as useState4 } from "react";
1014
+ import { Button as Button2, Input as Input5 } from "reactstrap";
1015
+ import { useTranslation as useTranslation7 } from "react-i18next";
1016
+ import {
1017
+ GridComponent,
1018
+ ColumnsDirective,
1019
+ ColumnDirective,
1020
+ Selection,
1021
+ RowDD,
1022
+ Inject,
1023
+ CommandColumn
1024
+ } from "@syncfusion/ej2-react-grids";
1025
+
1026
+ // test-app/component/modal-header/index.tsx
1027
+ import { Edit, Info, Plus, X as X2 } from "becoxy-icons";
1028
+ import classNames3 from "classnames";
1029
+ import { useTranslation as useTranslation6 } from "react-i18next";
1030
+ import { Fragment as Fragment9, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1031
+ var ModalHeader = (props) => {
1032
+ const { title, handleModal, typeModal = "Edit", component } = props;
1033
+ const { t } = useTranslation6();
1034
+ const handleModalIcon = () => {
1035
+ if (typeModal === "Edit" || typeModal === "Approval") {
1036
+ return /* @__PURE__ */ jsx9(Edit, { fontSize: 17, className: "me-1" });
1037
+ } else if (typeModal === "View") {
1038
+ return /* @__PURE__ */ jsx9(Info, { fontSize: 17, className: "me-1" });
1039
+ } else if (typeModal === "Detail") {
1040
+ return /* @__PURE__ */ jsx9(Info, { fontSize: 17, className: "me-1" });
1041
+ } else if (typeModal === "Order") {
1042
+ return /* @__PURE__ */ jsx9("span", { className: "e-icons e-sorting-1 me-1", style: { fontSize: "14px" } });
1043
+ } else if (typeModal === "Process") {
1044
+ return /* @__PURE__ */ jsx9("span", { className: "e-flat e-icons e-paste-match-destination me-1", style: { fontSize: "14px" } });
1045
+ } else {
1046
+ return /* @__PURE__ */ jsx9(Plus, { fontSize: 17, className: "me-1" });
1047
+ }
1048
+ };
1049
+ return /* @__PURE__ */ jsxs8("div", { className: "modal-header d-flex align-items-center justify-content-between mb-1", children: [
1050
+ /* @__PURE__ */ jsxs8("div", { className: "d-flex align-items-center justify-content-start", children: [
1051
+ /* @__PURE__ */ jsxs8("h5", { className: "modal-title", children: [
1052
+ handleModalIcon(),
1053
+ " ",
1054
+ t(title)
1055
+ ] }),
1056
+ component ? component() : /* @__PURE__ */ jsx9(Fragment9, {})
1057
+ ] }),
1058
+ /* @__PURE__ */ jsx9("div", { className: "todo-item-action d-flex align-items-center", children: /* @__PURE__ */ jsx9(
1059
+ X2,
1060
+ {
1061
+ className: classNames3("fw-normal mt-25 cursor-pointer", { "d-none": !handleModal }),
1062
+ fontSize: 20,
1063
+ onClick: handleModal
1064
+ }
1065
+ ) })
1066
+ ] });
1067
+ };
1068
+ var modal_header_default = ModalHeader;
1069
+
1070
+ // test-app/component/sidebar/index.tsx
1071
+ import { ChevronLeft, ChevronRight } from "becoxy-icons";
1072
+ import classNames4 from "classnames";
1073
+ import { useEffect as useEffect3, useState as useState3 } from "react";
1074
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1075
+ var Sidebar = (props) => {
1076
+ const {
1077
+ open,
1078
+ children,
1079
+ toggleSidebar,
1080
+ width,
1081
+ keyboard,
1082
+ hiddenBackground,
1083
+ hiddenFullScreenButton
1084
+ } = props;
1085
+ const [isFullScreen, setIsFullScreen] = useState3(false);
1086
+ const [flag, setFlag] = useState3(open);
1087
+ useEffect3(() => {
1088
+ if (open !== flag) {
1089
+ if (open) {
1090
+ setFlag(open);
1091
+ } else {
1092
+ setTimeout(() => {
1093
+ setFlag(open);
1094
+ }, 50);
1095
+ }
1096
+ }
1097
+ }, [open]);
1098
+ const handClose = () => {
1099
+ setFlag(false);
1100
+ setTimeout(() => {
1101
+ toggleSidebar();
1102
+ }, 400);
1103
+ };
1104
+ return /* @__PURE__ */ jsxs9(
1105
+ "div",
1106
+ {
1107
+ tabIndex: 0,
1108
+ className: classNames4({ "d-none": !open }),
1109
+ onKeyDown: (e) => {
1110
+ if (!keyboard && e.code === "Escape" && flag) {
1111
+ handClose();
1112
+ e.stopPropagation();
1113
+ e.preventDefault();
1114
+ }
1115
+ },
1116
+ children: [
1117
+ /* @__PURE__ */ jsx10(
1118
+ "div",
1119
+ {
1120
+ className: classNames4("offcanvas-backdrop fade", {
1121
+ "d-none": !flag || hiddenBackground,
1122
+ show: flag
1123
+ }),
1124
+ style: { zIndex: 1056 },
1125
+ onClick: handClose
1126
+ }
1127
+ ),
1128
+ /* @__PURE__ */ jsxs9(
1129
+ "div",
1130
+ {
1131
+ className: classNames4("customizer d-none d-md-block ", `customizer-${width ?? 600}`, {
1132
+ open: flag,
1133
+ fullscreen: isFullScreen
1134
+ }),
1135
+ style: { zIndex: 1057 },
1136
+ children: [
1137
+ /* @__PURE__ */ jsxs9(
1138
+ "div",
1139
+ {
1140
+ style: {
1141
+ position: "fixed",
1142
+ top: "50%",
1143
+ transform: "translate(-50%, -50%)",
1144
+ background: "#FFF",
1145
+ filter: "drop-shadow(0.9px 0.9px 1.5px)",
1146
+ height: 50,
1147
+ display: "flex",
1148
+ alignItems: "center",
1149
+ borderRadius: "0px 5px 5px 0px",
1150
+ cursor: "pointer",
1151
+ zIndex: 9,
1152
+ marginLeft: 7
1153
+ },
1154
+ className: classNames4({ "d-none": hiddenFullScreenButton }),
1155
+ onClick: () => {
1156
+ setIsFullScreen(!isFullScreen);
1157
+ },
1158
+ children: [
1159
+ /* @__PURE__ */ jsx10(ChevronLeft, { className: `${isFullScreen ? "d-none" : ""}`, fontSize: 16 }),
1160
+ /* @__PURE__ */ jsx10(ChevronRight, { className: `${!isFullScreen ? "d-none" : ""}`, fontSize: 15 })
1161
+ ]
1162
+ }
1163
+ ),
1164
+ children
1165
+ ]
1166
+ }
1167
+ )
1168
+ ]
1169
+ }
1170
+ );
1171
+ };
1172
+ var sidebar_default = Sidebar;
1173
+
1174
+ // test-app/component/sidebar-setting-column/index.tsx
1175
+ import { Fragment as Fragment11, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1176
+ var SidebarSetColumn = (props) => {
1177
+ const { column, setColumn, openSidebar, handleSidebar } = props;
1178
+ const { t } = useTranslation7();
1179
+ const [dataSource, setDataSource] = useState4([]);
1180
+ useEffect4(() => {
1181
+ if (openSidebar) {
1182
+ setDataSource([...column]);
1183
+ }
1184
+ }, [openSidebar]);
1185
+ const handleCancel = () => {
1186
+ handleSidebar();
1187
+ setDataSource([]);
1188
+ };
1189
+ const handleSubmit = () => {
1190
+ setColumn([...dataSource]);
1191
+ handleCancel();
1192
+ };
1193
+ const getWindowSize = () => {
1194
+ const { innerWidth, innerHeight } = window;
1195
+ return { innerWidth, innerHeight };
1196
+ };
1197
+ const gird = useRef2(null);
1198
+ const [windowSize, setWindowSize] = useState4(getWindowSize());
1199
+ useEffect4(() => {
1200
+ const handleWindowResize = () => {
1201
+ setWindowSize(getWindowSize());
1202
+ };
1203
+ window.addEventListener("resize", handleWindowResize);
1204
+ return () => {
1205
+ window.removeEventListener("resize", handleWindowResize);
1206
+ };
1207
+ }, []);
1208
+ const renderFooterButtons = () => {
1209
+ return /* @__PURE__ */ jsxs10(Fragment10, { children: [
1210
+ /* @__PURE__ */ jsx11(Button2, { color: "primary", onClick: handleSubmit, className: "me-1", children: t("Confirm") }),
1211
+ /* @__PURE__ */ jsx11(Button2, { color: "secondary", onClick: handleCancel, outline: true, children: t("Close") })
1212
+ ] });
1213
+ };
1214
+ const visibleTemplate = (item) => {
1215
+ return /* @__PURE__ */ jsx11(
1216
+ Input5,
1217
+ {
1218
+ defaultChecked: item.visible ?? true,
1219
+ disabled: item.invisibleDisable,
1220
+ type: "checkbox",
1221
+ style: { height: 18 },
1222
+ className: " cursor-pointer",
1223
+ onChange: (e) => {
1224
+ if (dataSource) {
1225
+ item.column.dataSource[item.index].visible = e.target.checked;
1226
+ setDataSource(item.column.dataSource);
1227
+ }
1228
+ }
1229
+ }
1230
+ );
1231
+ };
1232
+ const fixColumnTemplate = (item) => {
1233
+ return /* @__PURE__ */ jsx11(
1234
+ Input5,
1235
+ {
1236
+ defaultChecked: item.fixedType === "left" || item.fixedType === "right",
1237
+ type: "checkbox",
1238
+ style: { height: 18 },
1239
+ className: " cursor-pointer",
1240
+ onChange: (e) => {
1241
+ if (dataSource) {
1242
+ if (e.target.checked) {
1243
+ if (item.index * 2 <= item.column.dataSource.length) {
1244
+ item.column.dataSource[item.index].fixedType = "left";
1245
+ } else {
1246
+ item.column.dataSource[item.index].fixedType = "right";
1247
+ }
1248
+ } else {
1249
+ item.column.dataSource[item.index].fixedType = "";
1250
+ }
1251
+ setDataSource(item.column.dataSource);
1252
+ }
1253
+ }
1254
+ }
1255
+ );
1256
+ };
1257
+ const columns = [
1258
+ {
1259
+ isPrimaryKey: true,
1260
+ field: "headerText",
1261
+ headerText: "Column name",
1262
+ template: (e) => {
1263
+ return /* @__PURE__ */ jsx11(Fragment11, { children: t(e.headerText) });
1264
+ },
1265
+ visible: true,
1266
+ width: 100,
1267
+ maxWidth: 120,
1268
+ minWidth: 80
1269
+ },
1270
+ {
1271
+ isPrimaryKey: true,
1272
+ template: visibleTemplate,
1273
+ headerText: "Display",
1274
+ dataSource,
1275
+ visible: true,
1276
+ width: 100,
1277
+ maxWidth: 120,
1278
+ minWidth: 80
1279
+ },
1280
+ {
1281
+ isPrimaryKey: true,
1282
+ template: fixColumnTemplate,
1283
+ headerText: "Fix the column",
1284
+ dataSource,
1285
+ visible: true,
1286
+ width: 100,
1287
+ maxWidth: 120,
1288
+ minWidth: 80
1289
+ },
1290
+ {
1291
+ isPrimaryKey: true,
1292
+ field: "width",
1293
+ headerText: "Column width",
1294
+ template: (item) => {
1295
+ return item.width ? /* @__PURE__ */ jsxs10(Fragment11, { children: [
1296
+ t(item.width),
1297
+ "px"
1298
+ ] }) : /* @__PURE__ */ jsx11(Fragment11, {});
1299
+ },
1300
+ visible: true,
1301
+ width: 100,
1302
+ maxWidth: 120,
1303
+ minWidth: 80
1304
+ }
1305
+ ];
1306
+ return /* @__PURE__ */ jsxs10(
1307
+ sidebar_default,
1308
+ {
1309
+ open: openSidebar,
1310
+ toggleSidebar: handleCancel,
1311
+ width: 700,
1312
+ children: [
1313
+ /* @__PURE__ */ jsx11(modal_header_default, { typeModal: "Edit", handleModal: handleCancel, title: "Column setup" }),
1314
+ /* @__PURE__ */ jsxs10(
1315
+ GridComponent,
1316
+ {
1317
+ className: "ms-2",
1318
+ dataSource,
1319
+ ref: gird,
1320
+ height: windowSize.innerHeight - 160,
1321
+ allowRowDragAndDrop: true,
1322
+ children: [
1323
+ /* @__PURE__ */ jsx11(ColumnsDirective, { children: columns.map((col, index) => /* @__PURE__ */ jsx11(ColumnDirective, { ...col, headerText: t(col.headerText) }, index)) }),
1324
+ /* @__PURE__ */ jsx11(Inject, { services: [RowDD, Selection, CommandColumn] })
1325
+ ]
1326
+ }
1327
+ ),
1328
+ /* @__PURE__ */ jsx11(
1329
+ "div",
1330
+ {
1331
+ className: "d-flex justify-content-end p-1 ",
1332
+ style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" },
1333
+ children: renderFooterButtons()
1334
+ }
1335
+ )
1336
+ ]
1337
+ }
1338
+ );
1339
+ };
1340
+ var sidebar_setting_column_default = SidebarSetColumn;
1341
+
1342
+ // test-app/component/table/index.tsx
1343
+ import { TooltipComponent } from "@syncfusion/ej2-react-popups";
1344
+ import { Fragment as Fragment13, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1345
+ var TableEdit = forwardRef2((props, ref) => {
1346
+ const { t } = useTranslation8();
1347
+ const {
1348
+ idTable,
1349
+ dataSource,
1350
+ columns,
1351
+ commandClick,
1352
+ dataSourceChange,
1353
+ rowChange,
1354
+ allowPaging,
1355
+ pageSize,
1356
+ totalItem,
1357
+ currentPage,
1358
+ setCurrentPage,
1359
+ setPageSize,
1360
+ setDataSource,
1361
+ height,
1362
+ maxHeight,
1363
+ minHeight,
1364
+ defaultValue,
1365
+ haveSum,
1366
+ toolbarOptions,
1367
+ toolbarBottomOptions,
1368
+ showTopToolbar,
1369
+ showBottomToolbar,
1370
+ searchTerm,
1371
+ setSearchTerm,
1372
+ searchEnable,
1373
+ setSelectedItem,
1374
+ selectedItem,
1375
+ selectEnable,
1376
+ editDisable,
1377
+ addDisable,
1378
+ deleteAllDisable,
1379
+ insertAfterDisable,
1380
+ insertBeforeDisable,
1381
+ duplicateDisable,
1382
+ decimalSeparator = ",",
1383
+ thousandSeparator = ".",
1384
+ isMulti
1385
+ } = props;
1386
+ useImperativeHandle(ref, () => {
1387
+ return {
1388
+ refeshFocusRow: handleRefeshRow
1389
+ };
1390
+ });
1391
+ const [refreshRow, setRefreshRow] = useState5(false);
1392
+ const [indexFocus, setIndexFocus] = useState5();
1393
+ const [selectedRows, setSelectedRows] = useState5([]);
1394
+ const [tableColumns, setTableColumns] = useState5([...columns]);
1395
+ const [columnFistEdit, setColumnFistEdit] = useState5(0);
1396
+ const [columnLastEdit, setColumnlastEdit] = useState5(0);
1397
+ const [objWidthFix, setObjWidthFix] = useState5({});
1398
+ const [openPopupTree, setOpenPopupTree] = useState5(false);
1399
+ const [openPopupSetupColumn, setOpenPopupSetupColumn] = useState5(false);
1400
+ const tableElement = useRef3(null);
1401
+ const gridRef = useRef3();
1402
+ const lag = window.localStorage.getItem("i18nextLng");
1403
+ const lang = lag ? lag : "vi";
1404
+ const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? "id";
1405
+ const fieldUniKey = columns.filter((item) => item.isUnikey === true)?.map((item) => item.field);
1406
+ useEffect5(() => {
1407
+ let indexFirst = -1;
1408
+ let indexlast = -1;
1409
+ let letfWidthFix = 0;
1410
+ let rightWidthFix = 0;
1411
+ tableColumns.forEach((item, index) => {
1412
+ if (item.fixedType === "left" && item.visible !== false) {
1413
+ objWidthFix[index] = letfWidthFix;
1414
+ letfWidthFix += Number(item.minWidth ? item.minWidth : item.field === "#" ? 40 : item.width ? item.width : 0);
1415
+ }
1416
+ if (tableColumns[tableColumns.length - 1 - index].fixedType === "right" && tableColumns[tableColumns.length - 1 - index].visible !== false) {
1417
+ objWidthFix[tableColumns.length - 1 - index] = rightWidthFix;
1418
+ rightWidthFix += Number(tableColumns[tableColumns.length - 1 - index].minWidth ? tableColumns[tableColumns.length - 1 - index].minWidth : tableColumns[tableColumns.length - 1 - index].field === "#" ? 40 : tableColumns[tableColumns.length - 1 - index].width ? tableColumns[tableColumns.length - 1 - index].width : 0);
1419
+ }
1420
+ if (item.editEnable && item.visible !== false && !item.disabledCondition) {
1421
+ if (indexFirst === -1) {
1422
+ indexFirst = index;
1423
+ }
1424
+ indexlast = index;
1425
+ }
1426
+ });
1427
+ setObjWidthFix(objWidthFix);
1428
+ setColumnFistEdit(indexFirst + 1);
1429
+ setColumnlastEdit(indexlast + 1);
1430
+ }, [tableColumns]);
1431
+ useEffect5(() => {
1432
+ setTableColumns(columns.map((item, index) => {
1433
+ return { ...item, visible: item.invisibleDisable ? item.visible : tableColumns[index]?.visible ?? item.visible };
1434
+ }));
1435
+ }, [columns]);
1436
+ const handleRefeshRow = () => {
1437
+ setRefreshRow(true);
1438
+ setTimeout(() => {
1439
+ setRefreshRow(false);
1440
+ }, 5);
1441
+ };
1442
+ const handleDataChange = async (row, col, indexRow) => {
1443
+ if (dataSourceChange) {
1444
+ dataSourceChange(dataSource);
1445
+ }
1446
+ if (rowChange) {
1447
+ await rowChange(row, indexRow, col.field);
1448
+ for (let index = 0; index <= tableColumns.length; index++) {
1449
+ if (!editDisable && indexFocus === indexRow && (!col.disabledCondition || !col.disabledCondition(row)) && tableColumns[index] && tableColumns[index].editEnable) {
1450
+ const element = document.getElementById(`${idTable}-col${index + 1}-row${indexRow + 1}`);
1451
+ if (element) {
1452
+ if (element.className.includes("input-element")) {
1453
+ element.value = row[tableColumns[index].field] ?? "";
1454
+ } else if (element.className.includes("input-numeric")) {
1455
+ element.value = row[tableColumns[index].field] ? formartNumberic(row[tableColumns[index].field], decimalSeparator, thousandSeparator, col.numericSettings?.fraction) : 0;
1456
+ } else if (element.className.includes("input-checkbox")) {
1457
+ element.checked = row[tableColumns[index].field] ?? false;
1458
+ }
1459
+ }
1460
+ }
1461
+ }
1462
+ }
1463
+ };
1464
+ const handleKeyPress = (e) => {
1465
+ if (e.code === "Enter" || e.code === "NumpadEnter") {
1466
+ setSearchTerm(e.target.value);
1467
+ }
1468
+ };
1469
+ const searchTemplate = () => {
1470
+ return /* @__PURE__ */ jsx12(Fragment12, { children: /* @__PURE__ */ jsx12("div", { className: "me-50", children: /* @__PURE__ */ jsx12(
1471
+ react_input_default,
1472
+ {
1473
+ style: { width: "230px" },
1474
+ value: searchTerm,
1475
+ setSearchTerm,
1476
+ placeholder: t("Search"),
1477
+ onKeyPress: handleKeyPress
1478
+ }
1479
+ ) }) });
1480
+ };
1481
+ const defaultToolbarOption = searchEnable === true ? [{ template: searchTemplate, align: "left" }] : [];
1482
+ let toolbarTopOption = [];
1483
+ if (toolbarOptions) {
1484
+ toolbarTopOption = [...defaultToolbarOption, ...toolbarOptions];
1485
+ } else {
1486
+ toolbarTopOption = [...defaultToolbarOption];
1487
+ }
1488
+ const renderEdit = (row, col, indexRow, indexCol) => {
1489
+ switch (col?.editTypeCondition ? col?.editTypeCondition(row) : col.editType) {
1490
+ case "date":
1491
+ return /* @__PURE__ */ jsx12(
1492
+ Input6,
1493
+ {
1494
+ id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
1495
+ style: { textAlign: col.textAlign, height: 29 },
1496
+ value: row[col.field] ? moment(row[col.field]).format("yyyy-MM-DD") : row[col.field],
1497
+ onChange: (val) => {
1498
+ row[col.field] = val.target.value;
1499
+ if (col.callback) {
1500
+ col.callback(val.target.value, indexRow);
1501
+ }
1502
+ handleDataChange(row, col, indexRow);
1503
+ },
1504
+ className: classnames5("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
1505
+ type: "date",
1506
+ max: "9999-12-31",
1507
+ onKeyDown: (e) => {
1508
+ if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
1509
+ }
1510
+ }
1511
+ }
1512
+ );
1513
+ case "datetime":
1514
+ return /* @__PURE__ */ jsx12(
1515
+ Input6,
1516
+ {
1517
+ id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
1518
+ style: { textAlign: col.textAlign, height: 29 },
1519
+ value: row[col.field] ? moment(row[col.field]).format("yyyy-MM-DD HH:MM") : row[col.field],
1520
+ onChange: (val) => {
1521
+ row[col.field] = val.target.value;
1522
+ if (col.callback) {
1523
+ col.callback(val.target.value, indexRow);
1524
+ }
1525
+ handleDataChange(row, col, indexRow);
1526
+ },
1527
+ className: classnames5("border-0 rounded-0", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
1528
+ type: "datetime-local",
1529
+ max: "9999-12-31T23:59",
1530
+ onKeyDown: (e) => {
1531
+ if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
1532
+ }
1533
+ }
1534
+ }
1535
+ );
1536
+ case "asyncSelect":
1537
+ let optionAsyncSelects = [];
1538
+ if (col.selectSettings?.optionsField) {
1539
+ optionAsyncSelects = row[col.selectSettings?.optionsField] ? row[col.selectSettings?.optionsField] : [];
1540
+ } else {
1541
+ optionAsyncSelects = col.selectSettings?.options ? col.selectSettings?.validateOption ? col.selectSettings?.options.filter((item) => col.selectSettings?.validateOption(item, row)) : col.selectSettings?.options : [];
1542
+ }
1543
+ let valueAsyncSelect = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? optionAsyncSelects?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : void 0;
1544
+ if (!valueAsyncSelect && col.selectSettings?.defaultValue) {
1545
+ valueAsyncSelect = col.selectSettings?.defaultValue(row);
1546
+ }
1547
+ return /* @__PURE__ */ jsxs11("div", { className: classnames5("d-flex select-group", { "is-invalid": col.validate && col.validate(row[col.field], row) }), children: [
1548
+ /* @__PURE__ */ jsx12(
1549
+ AsyncSelect,
1550
+ {
1551
+ menuPosition: "fixed",
1552
+ value: valueAsyncSelect,
1553
+ defaultOptions: optionAsyncSelects,
1554
+ onChange: (val) => {
1555
+ row[col.field] = val ? val[col.selectSettings?.fieldValue ?? "value"] : void 0;
1556
+ if (col.callback) {
1557
+ col.callback(val, indexRow);
1558
+ }
1559
+ handleDataChange(row, col, indexRow);
1560
+ },
1561
+ menuPortalTarget: document.body,
1562
+ isClearable: col.selectSettings?.isClearable ?? false,
1563
+ classNamePrefix: col.selectSettings?.widthPopup ? `width-popup-${col.selectSettings?.widthPopup}` : "select",
1564
+ placeholder: t("Select"),
1565
+ id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
1566
+ loadOptions: col.selectSettings?.loadOptions,
1567
+ className: classnames5("react-select"),
1568
+ onKeyDown: (e) => {
1569
+ if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
1570
+ }
1571
+ }
1572
+ }
1573
+ ),
1574
+ /* @__PURE__ */ jsx12(
1575
+ "span",
1576
+ {
1577
+ onClick: () => {
1578
+ if (col.selectSettings?.handIconGroupClick) {
1579
+ col.selectSettings?.handIconGroupClick("right");
1580
+ }
1581
+ },
1582
+ className: classnames5("input-group-text", { "d-none": !col.selectSettings?.iconGroup }),
1583
+ children: /* @__PURE__ */ jsx12(icon_default, { iconName: col.selectSettings?.iconGroup ?? "", size: 16 })
1584
+ }
1585
+ )
1586
+ ] });
1587
+ case "select":
1588
+ let valueSelect;
1589
+ let options = [];
1590
+ if (col.selectSettings?.optionsField) {
1591
+ options = row[col.selectSettings?.optionsField] ? row[col.selectSettings?.optionsField] : [];
1592
+ } else {
1593
+ options = col.selectSettings?.options ? col.selectSettings?.validateOption ? col.selectSettings?.options.filter((item) => col.selectSettings?.validateOption(item, row)) : col.selectSettings?.options : [];
1594
+ }
1595
+ if (col.selectSettings?.isMulti) {
1596
+ valueSelect = !isNullOrUndefined(row[col.field]) && row[col.field]?.length > 0 ? options?.filter((val) => row[col.field]?.includes(val[col.selectSettings?.fieldValue ?? "value"])) : [];
1597
+ } else {
1598
+ valueSelect = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? options?.find((val) => val[col.selectSettings?.fieldValue ?? "value"] === row[col.field]) : "";
1599
+ }
1600
+ return /* @__PURE__ */ jsx12(
1601
+ Select2,
1602
+ {
1603
+ menuPosition: "fixed",
1604
+ id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
1605
+ value: valueSelect,
1606
+ options,
1607
+ onChange: (val) => {
1608
+ row[col.field] = col.selectSettings?.isMulti ? val?.map((item) => item[col.selectSettings?.fieldValue ?? "value"]) ?? [] : val ? val[col.selectSettings?.fieldValue ?? "value"] : void 0;
1609
+ if (col.callback) {
1610
+ col.callback(val, indexRow);
1611
+ }
1612
+ handleDataChange(row, col, indexRow);
1613
+ },
1614
+ menuPortalTarget: document.body,
1615
+ isMulti: col.selectSettings?.isMulti ?? false,
1616
+ isClearable: col.selectSettings?.isClearable ?? false,
1617
+ classNamePrefix: col.selectSettings?.widthPopup ? `width-popup-${col.selectSettings?.widthPopup}` : "select",
1618
+ placeholder: t("Select"),
1619
+ className: classnames5("react-select", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
1620
+ onKeyDown: (e) => {
1621
+ if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
1622
+ }
1623
+ }
1624
+ }
1625
+ );
1626
+ case "selectTree":
1627
+ let valueSelectTree = !isNullOrUndefined(row[col.field]) && row[col.field] !== "" ? [row[col.field]] : [];
1628
+ const findItemInTree = (items, value) => {
1629
+ for (let index = 0; index < items.length; index++) {
1630
+ const item = items[index];
1631
+ if (item[col.selectSettings?.fieldValue ? col.selectSettings?.fieldValue : "value"] === value) {
1632
+ return { ...item };
1633
+ } else if (item["children"]?.length > 0) {
1634
+ const itemFilter = findItemInTree(item["children"], value);
1635
+ if (itemFilter) {
1636
+ return itemFilter;
1637
+ }
1638
+ }
1639
+ }
1640
+ };
1641
+ return /* @__PURE__ */ jsx12(
1642
+ "div",
1643
+ {
1644
+ onKeyDown: (e) => {
1645
+ if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
1646
+ }
1647
+ },
1648
+ children: /* @__PURE__ */ jsx12(
1649
+ DropDownTreeComponent,
1650
+ {
1651
+ id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
1652
+ fields: {
1653
+ dataSource: col.selectSettings?.options,
1654
+ value: col.selectSettings?.fieldValue ? col.selectSettings?.fieldValue : "value",
1655
+ text: "label",
1656
+ parentValue: "parentId",
1657
+ child: "children"
1658
+ },
1659
+ className: classnames5("select-tree", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
1660
+ allowFiltering: false,
1661
+ value: valueSelectTree,
1662
+ popupHeight: 250,
1663
+ popupWidth: "auto",
1664
+ changeOnBlur: false,
1665
+ showClearButton: col.selectSettings?.isClearable,
1666
+ change: (val) => {
1667
+ const item = val?.value?.length > 0 ? val?.value[0] : void 0;
1668
+ if (row[col.field] !== item) {
1669
+ row[col.field] = item;
1670
+ if (col.callback) {
1671
+ col.callback(item ? findItemInTree(col.selectSettings?.options, item) : void 0, indexRow);
1672
+ }
1673
+ handleDataChange(row, col, indexRow);
1674
+ }
1675
+ },
1676
+ open: () => {
1677
+ setOpenPopupTree(true);
1678
+ },
1679
+ close: () => {
1680
+ setOpenPopupTree(false);
1681
+ }
1682
+ }
1683
+ )
1684
+ }
1685
+ );
1686
+ case "checkbox":
1687
+ return /* @__PURE__ */ jsx12(
1688
+ Input6,
1689
+ {
1690
+ checked: row[col.field],
1691
+ id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
1692
+ type: "checkbox",
1693
+ className: "input-checkbox cursor-pointer",
1694
+ style: { textAlign: col.textAlign ?? "left", marginTop: 6 },
1695
+ onChange: (val) => {
1696
+ row[col.field] = val.currentTarget.checked;
1697
+ if (col.callback) {
1698
+ col.callback(val.target.value, indexRow);
1699
+ }
1700
+ handleDataChange(row, col, indexRow);
1701
+ },
1702
+ onKeyDown: (e) => {
1703
+ if (checkKeyDown(e, row, col, indexRow + 1, indexCol + 1)) {
1704
+ }
1705
+ }
1706
+ }
1707
+ );
1708
+ case "numeric":
1709
+ let valueCurrency = row[col.field];
1710
+ return /* @__PURE__ */ jsx12(
1711
+ Input6,
1712
+ {
1713
+ id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
1714
+ style: { textAlign: col.textAlign, height: 29 },
1715
+ defaultValue: formartNumberic(valueCurrency, decimalSeparator, thousandSeparator, col.numericSettings?.fraction),
1716
+ className: classnames5("border-0 rounded-0 input-numeric", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
1717
+ onChange: (val) => {
1718
+ let newVal = "";
1719
+ const flag = val.target?.value.startsWith("-");
1720
+ if (val.target?.value.endsWith(decimalSeparator)) {
1721
+ if ((val.target?.value.match(new RegExp(decimalSeparator === "," ? "," : "\\.", "g")) || []).length > 1 || col.numericSettings?.fraction === 0) {
1722
+ newVal = val.target?.value.slice(0, -1).replaceAll(thousandSeparator, "");
1723
+ } else {
1724
+ newVal = val.target?.value.replaceAll(thousandSeparator, "");
1725
+ }
1726
+ } else {
1727
+ newVal = val.target.value.replaceAll(new RegExp(`[^0-9${decimalSeparator === "," ? "," : "\\."}]`, "g"), "");
1728
+ }
1729
+ val.target.value = flag && col.numericSettings?.min !== 0 ? `-${formartNumberic(newVal, decimalSeparator, thousandSeparator, col.numericSettings?.fraction)}` : formartNumberic(newVal, decimalSeparator, thousandSeparator, col.numericSettings?.fraction);
1730
+ },
1731
+ onFocus: (e) => {
1732
+ e.target.setSelectionRange(0, e.target.innerText.length - 1);
1733
+ },
1734
+ onBlur: (val) => {
1735
+ let newVal = "";
1736
+ const flag = val.target?.value.startsWith("-");
1737
+ if (val.target?.value.endsWith(decimalSeparator)) {
1738
+ newVal = val.target?.value.slice(0, -1).replaceAll(new RegExp(`[^0-9${decimalSeparator === "," ? "," : "\\."}]`, "g"), "");
1739
+ } else {
1740
+ newVal = val.target.value.replaceAll(new RegExp(`[^0-9${decimalSeparator === "," ? "," : "\\."}]`, "g"), "");
1741
+ }
1742
+ if (decimalSeparator === ",") {
1743
+ newVal = newVal.replaceAll(",", ".");
1744
+ }
1745
+ let value = flag ? 0 - Number(newVal) : Number(newVal);
1746
+ if (col.numericSettings?.max !== void 0 && value > col.numericSettings?.max) {
1747
+ val.currentTarget.value = col.numericSettings?.max.toString();
1748
+ value = col.numericSettings?.max;
1749
+ } else if (col.numericSettings?.min !== void 0 && value < col.numericSettings?.min) {
1750
+ value = col.numericSettings?.min;
1751
+ val.currentTarget.value = col.numericSettings?.min.toString();
1752
+ }
1753
+ if (newVal !== row[col.field]) {
1754
+ row[col.field] = value;
1755
+ if (col.callback) {
1756
+ col.callback(val.target.value, indexRow);
1757
+ }
1758
+ handleDataChange(row, col, indexRow);
1759
+ }
1760
+ },
1761
+ onKeyDown: (e) => {
1762
+ if (e.key === "ArrowDown" || e.key === "NumpadEnter" || e.key === "ArrowUp" || e.key === "Enter" || e.key === "Tab") {
1763
+ let newVal = "";
1764
+ const flag = e.target?.value.startsWith("-");
1765
+ if (e.target?.value.endsWith(decimalSeparator)) {
1766
+ newVal = e.target?.value.slice(0, -1).replaceAll(new RegExp(`[^0-9${decimalSeparator === "," ? "," : "\\."}]`, "g"), "");
1767
+ } else {
1768
+ newVal = e.target.value.replaceAll(new RegExp(`[^0-9${decimalSeparator === "," ? "," : "\\."}]`, "g"), "");
1769
+ }
1770
+ if (decimalSeparator === ",") {
1771
+ newVal = newVal.replaceAll(",", ".");
1772
+ }
1773
+ let value = flag ? 0 - Number(newVal) : Number(newVal);
1774
+ if (col.numericSettings?.max !== void 0 && value > col.numericSettings?.max) {
1775
+ e.target.value = col.numericSettings?.max.toString();
1776
+ value = col.numericSettings?.max;
1777
+ } else if (col.numericSettings?.min !== void 0 && value < col.numericSettings?.min) {
1778
+ value = col.numericSettings?.min;
1779
+ e.target.value = col.numericSettings?.min.toString();
1780
+ }
1781
+ if (newVal !== row[col.field]) {
1782
+ row[col.field] = value;
1783
+ if (col.callback) {
1784
+ col.callback(e.target.value, indexRow);
1785
+ }
1786
+ handleDataChange(row, col, indexRow);
1787
+ }
1788
+ }
1789
+ checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
1790
+ },
1791
+ onPaste: (e) => {
1792
+ if (showBottomToolbar && !editDisable && !addDisable) {
1793
+ pasteDataFromExcel(indexRow, indexCol);
1794
+ e.preventDefault();
1795
+ }
1796
+ }
1797
+ }
1798
+ );
1799
+ case "color":
1800
+ return /* @__PURE__ */ jsx12("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ jsx12(
1801
+ Input6,
1802
+ {
1803
+ type: "color",
1804
+ value: row[col.field],
1805
+ style: { textAlign: col.textAlign ?? "center", padding: 0, height: 23, border: "none" },
1806
+ disabled: editDisable,
1807
+ onChange: (val) => {
1808
+ if (row[col.field] != val.target?.value) {
1809
+ row[col.field] = val.target?.value;
1810
+ if (col.callback) {
1811
+ col.callback(val.target.value, indexRow);
1812
+ }
1813
+ handleDataChange(row, col, indexRow);
1814
+ }
1815
+ },
1816
+ onKeyDown: (val) => {
1817
+ checkKeyDown(val, row, col, indexRow + 1, indexCol + 1);
1818
+ }
1819
+ },
1820
+ `col-${indexRow}-${indexCol}`
1821
+ ) });
1822
+ case "form":
1823
+ return /* @__PURE__ */ jsx12(
1824
+ edit_form_default,
1825
+ {
1826
+ id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
1827
+ ...col.formSettings,
1828
+ field: col.field,
1829
+ displayValue: col.formSettings?.displayValue ? col.formSettings?.displayValue(row) : "",
1830
+ placeholder: col.placeholder ? t(col.placeholder) : "",
1831
+ rowData: row,
1832
+ indexRow,
1833
+ onChange: (val, field) => {
1834
+ row = { ...row, ...val };
1835
+ handleDataChange(row, col, indexRow);
1836
+ },
1837
+ invalid: col.validate && col.validate(row[col.field], row),
1838
+ textAlign: col.textAlign,
1839
+ onKeyDown: (e) => {
1840
+ return checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
1841
+ }
1842
+ }
1843
+ );
1844
+ default:
1845
+ return /* @__PURE__ */ jsx12(
1846
+ Input6,
1847
+ {
1848
+ id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`,
1849
+ style: { textAlign: col.textAlign, height: 29 },
1850
+ defaultValue: isNullOrUndefined(row[col.field]) ? "" : row[col.field],
1851
+ className: classnames5("border-0 rounded-0 input-element", { "is-invalid": col.validate && col.validate(row[col.field], row) }),
1852
+ onBlur: (val) => {
1853
+ if (row[col.field] != val.target?.value) {
1854
+ row[col.field] = val.target?.value;
1855
+ if (col.callback) {
1856
+ col.callback(val.target.value, indexRow);
1857
+ }
1858
+ handleDataChange(row, col, indexRow);
1859
+ }
1860
+ },
1861
+ onKeyDown: (e) => {
1862
+ if (e.key === "ArrowDown" || e.key === "NumpadEnter" || e.key === "ArrowUp" || e.key === "Enter" || e.key === "Tab") {
1863
+ if (row[col.field] != e.target?.value) {
1864
+ row[col.field] = e.target?.value;
1865
+ handleDataChange(row, col, indexRow);
1866
+ if (col.callback) {
1867
+ col.callback(e.target.value, indexRow);
1868
+ }
1869
+ }
1870
+ }
1871
+ checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
1872
+ },
1873
+ onPaste: (e) => {
1874
+ if (showBottomToolbar && !editDisable && !addDisable) {
1875
+ pasteDataFromExcel(indexRow, indexCol);
1876
+ e.preventDefault();
1877
+ }
1878
+ }
1879
+ }
1880
+ );
1881
+ }
1882
+ };
1883
+ const handleCommandClick = (id, rowData, index) => {
1884
+ if (commandClick) {
1885
+ commandClick({ id, rowData, index });
1886
+ }
1887
+ };
1888
+ const renderCommand = (commandItems, rowData, i) => {
1889
+ return /* @__PURE__ */ jsx12(Fragment12, { children: /* @__PURE__ */ jsx12("div", { className: "d-flex align-items-center", style: { columnGap: 10 }, children: commandItems.map((item, index) => {
1890
+ return /* @__PURE__ */ jsx12(
1891
+ Button3,
1892
+ {
1893
+ tabIndex: -1,
1894
+ style: { padding: "5px", minWidth: 45, height: "100%" },
1895
+ className: classnames5("command-item", {
1896
+ "btn-icon": item.tooltip === ""
1897
+ }),
1898
+ color: item.color ? item.color : "#000",
1899
+ onClick: (e) => {
1900
+ handleCommandClick(item.id, rowData, i);
1901
+ if (i === indexFocus) {
1902
+ setIndexFocus(void 0);
1903
+ }
1904
+ e.preventDefault();
1905
+ },
1906
+ children: /* @__PURE__ */ jsx12(TooltipComponent, { content: t(item.tooltip ?? ""), children: item.icon && /* @__PURE__ */ jsx12(icon_default, { iconName: item.icon, size: 16 }) })
1907
+ },
1908
+ `command-${index}`
1909
+ );
1910
+ }) }) });
1911
+ };
1912
+ const checkKeyDown = (e, row, col, indexRow, indexCol) => {
1913
+ if (e.code === "ArrowRight") {
1914
+ let newIndexCol = -1;
1915
+ for (let i = indexCol; i < tableColumns.length; i++) {
1916
+ if (tableColumns[i].editEnable && tableColumns[i].visible !== false && (!tableColumns[i].disabledCondition || !tableColumns[i].disabledCondition(row))) {
1917
+ newIndexCol = i + 1;
1918
+ break;
1919
+ }
1920
+ }
1921
+ if (newIndexCol > -1) {
1922
+ const element = document.getElementById(`${idTable}-col${newIndexCol}-row${indexRow}`);
1923
+ if (element) {
1924
+ if (element.className.includes("react-select") || element.className.includes("from-edit")) {
1925
+ element.getElementsByTagName("input")[0]?.focus();
1926
+ } else {
1927
+ element.focus();
1928
+ }
1929
+ element.scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" });
1930
+ }
1931
+ e.preventDefault();
1932
+ return e.code;
1933
+ }
1934
+ }
1935
+ if (e.code === "ArrowLeft") {
1936
+ let newIndexCol = -1;
1937
+ for (let i = indexCol - 2; i >= 0; i--) {
1938
+ if (tableColumns[i].editEnable && tableColumns[i].visible !== false && (!tableColumns[i].disabledCondition || !tableColumns[i].disabledCondition(row))) {
1939
+ newIndexCol = i + 1;
1940
+ break;
1941
+ }
1942
+ }
1943
+ if (newIndexCol > -1) {
1944
+ const element = document.getElementById(`${idTable}-col${newIndexCol}-row${indexRow}`);
1945
+ if (element) {
1946
+ if (element.className.includes("react-select") || element.className.includes("from-edit")) {
1947
+ element.getElementsByTagName("input")[0]?.focus();
1948
+ } else {
1949
+ element.focus();
1950
+ }
1951
+ element.scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" });
1952
+ }
1953
+ e.preventDefault();
1954
+ return e.code;
1955
+ }
1956
+ }
1957
+ if (e.code === "ArrowUp") {
1958
+ const element = document.getElementById(`${idTable}-col${indexCol}-row${indexRow}`);
1959
+ if (element && !(element.getElementsByClassName("select__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--100__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--200__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--300__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--400__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--500__control--menu-is-open").length > 0)) {
1960
+ if (indexRow > 1) {
1961
+ setIndexFocus(indexRow - 2);
1962
+ setTimeout(() => {
1963
+ const element2 = document.getElementById(`${idTable}-col${indexCol}-row${indexRow - 1}`);
1964
+ if (element2) {
1965
+ if (element2.className.includes("react-select") || element2.className.includes("from-edit")) {
1966
+ element2.getElementsByTagName("input")[0]?.focus();
1967
+ } else {
1968
+ element2.focus();
1969
+ }
1970
+ }
1971
+ }, 100);
1972
+ e.preventDefault();
1973
+ return e.code;
1974
+ }
1975
+ }
1976
+ }
1977
+ if (e.code === "ArrowDown") {
1978
+ const element = document.getElementById(`${idTable}-col${indexCol}-row${indexRow}`);
1979
+ if (element && !(element.getElementsByClassName("select__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--100__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--200__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--300__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--400__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--500__control--menu-is-open").length > 0)) {
1980
+ if (indexRow < dataSource?.length) {
1981
+ setIndexFocus(indexRow);
1982
+ setTimeout(() => {
1983
+ const element2 = document.getElementById(`${idTable}-col${indexCol}-row${indexRow + 1}`);
1984
+ if (element2) {
1985
+ if (element2.className.includes("react-select") || element2.className.includes("from-edit")) {
1986
+ element2.getElementsByTagName("input")[0]?.focus();
1987
+ } else {
1988
+ element2.focus();
1989
+ }
1990
+ }
1991
+ }, 100);
1992
+ e.preventDefault();
1993
+ return e.code;
1994
+ }
1995
+ }
1996
+ }
1997
+ if (e.code === "Tab" && indexCol === columnLastEdit) {
1998
+ if (indexRow === dataSource?.length) {
1999
+ if (setDataSource) {
2000
+ setDataSource([...dataSource, defaultValue ? { ...defaultValue } : {}]);
2001
+ }
2002
+ if (tableElement) {
2003
+ setTimeout(() => {
2004
+ tableElement.current?.scrollTo(0, tableElement.current.scrollHeight);
2005
+ }, 100);
2006
+ }
2007
+ if (!(!editDisable && !addDisable)) {
2008
+ return false;
2009
+ }
2010
+ }
2011
+ setIndexFocus(indexRow);
2012
+ setTimeout(() => {
2013
+ const element = document.getElementById(`${idTable}-col${columnFistEdit}-row${indexRow + 1}`);
2014
+ if (element) {
2015
+ if (element.className.includes("react-select") || element.className.includes("from-edit")) {
2016
+ element.getElementsByTagName("input")[0]?.focus();
2017
+ } else {
2018
+ element.focus();
2019
+ element.scrollIntoView();
2020
+ }
2021
+ }
2022
+ }, 100);
2023
+ e.preventDefault();
2024
+ }
2025
+ if ((e.code === "Enter" || e.code === "NumpadEnter") && (!editDisable && !addDisable)) {
2026
+ const element = document.getElementById(`${idTable}-col${indexCol}-row${indexRow}`);
2027
+ if (element && !(element.getElementsByClassName("select__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--100__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--200__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--300__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--400__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--500__control--menu-is-open").length > 0)) {
2028
+ if (indexRow < dataSource?.length) {
2029
+ setIndexFocus(indexRow);
2030
+ setTimeout(() => {
2031
+ const element2 = document.getElementById(`${idTable}-col${indexCol}-row${indexRow + 1}`);
2032
+ if (element2) {
2033
+ if (element2.className.includes("react-select") || element2.className.includes("from-edit")) {
2034
+ element2.getElementsByTagName("input")[0]?.focus();
2035
+ } else {
2036
+ element2.focus();
2037
+ }
2038
+ }
2039
+ }, 100);
2040
+ } else {
2041
+ handleAdd();
2042
+ }
2043
+ e.preventDefault();
2044
+ return e.code;
2045
+ }
2046
+ }
2047
+ if (e.code === "KeyD" && e.ctrlKey == true && (!editDisable && !addDisable)) {
2048
+ handleDuplicate(dataSource[indexFocus ?? -1], indexRow);
2049
+ e.preventDefault();
2050
+ return e.code;
2051
+ }
2052
+ return "";
2053
+ };
2054
+ const onChangePage = (args) => {
2055
+ if (args.newProp.currentPage === args.oldProp.currentPage) {
2056
+ return;
2057
+ }
2058
+ setCurrentPage(args.currentPage);
2059
+ };
2060
+ const onChangePageSize = (args) => {
2061
+ if (allowPaging) {
2062
+ if (pageSize !== args.pageSize) {
2063
+ setPageSize(args.pageSize);
2064
+ setCurrentPage(1);
2065
+ }
2066
+ }
2067
+ };
2068
+ useOnClickOutside(gridRef, () => {
2069
+ if (!openPopupTree) {
2070
+ setTimeout(() => {
2071
+ setIndexFocus(-1);
2072
+ }, 50);
2073
+ }
2074
+ });
2075
+ const handleAdd = () => {
2076
+ if (setDataSource) {
2077
+ setDataSource([...dataSource, defaultValue ? { ...defaultValue, id: generateUUID() } : {}]);
2078
+ }
2079
+ if (tableElement) {
2080
+ setIndexFocus(dataSource?.length);
2081
+ setTimeout(() => {
2082
+ tableElement.current?.scrollTo(0, tableElement.current.scrollHeight);
2083
+ const element = document.getElementById(`${idTable}-col${columnFistEdit}-row${dataSource?.length + 1}`);
2084
+ if (element && !(element.getElementsByClassName("select__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--100__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--200__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--300__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--400__control--menu-is-open").length > 0 || element.getElementsByClassName("width-popup--500__control--menu-is-open").length > 0)) {
2085
+ if (element.className.includes("react-select") || element.className.includes("from-edit")) {
2086
+ element.getElementsByTagName("input")[0]?.focus();
2087
+ } else {
2088
+ element.focus();
2089
+ }
2090
+ }
2091
+ }, 100);
2092
+ }
2093
+ };
2094
+ const deleteAll = () => {
2095
+ if (!editDisable && !addDisable) {
2096
+ setIndexFocus(-1);
2097
+ if (setDataSource) {
2098
+ setDataSource([]);
2099
+ }
2100
+ }
2101
+ };
2102
+ const handleDuplicate = (data, index) => {
2103
+ if (showBottomToolbar && !editDisable && !addDisable) {
2104
+ if (fieldKey) {
2105
+ const newdata = { ...data };
2106
+ fieldUniKey.forEach((item) => {
2107
+ newdata[item] = defaultValue[item];
2108
+ });
2109
+ newdata[fieldKey] = defaultValue[fieldKey];
2110
+ dataSource?.splice(index, 0, newdata);
2111
+ } else {
2112
+ dataSource?.splice(index, 0, { ...data });
2113
+ }
2114
+ if (setDataSource) {
2115
+ setDataSource([...dataSource]);
2116
+ }
2117
+ if (tableElement && index === dataSource?.length) {
2118
+ setTimeout(() => {
2119
+ tableElement.current?.scrollTo(0, tableElement.current.scrollHeight);
2120
+ }, 100);
2121
+ }
2122
+ }
2123
+ };
2124
+ const handleInsertAfter = () => {
2125
+ if (showBottomToolbar && !editDisable && !addDisable) {
2126
+ dataSource?.splice((indexFocus ?? -1) + 1, 0, { ...defaultValue });
2127
+ if (setDataSource) {
2128
+ setDataSource([...dataSource]);
2129
+ }
2130
+ if (tableElement && indexFocus === dataSource?.length) {
2131
+ setTimeout(() => {
2132
+ tableElement.current?.scrollTo(0, tableElement.current.scrollHeight);
2133
+ }, 100);
2134
+ }
2135
+ }
2136
+ };
2137
+ const handleInsertBefore = () => {
2138
+ if (showBottomToolbar && !editDisable && !addDisable) {
2139
+ dataSource?.splice(indexFocus ?? -1, 0, { ...defaultValue });
2140
+ if (setDataSource) {
2141
+ setDataSource([...dataSource]);
2142
+ }
2143
+ }
2144
+ };
2145
+ const handleDeleteAll = () => {
2146
+ if (showBottomToolbar && !editDisable && !addDisable) {
2147
+ messageBoxConfirmDelete(t, deleteAll, "");
2148
+ }
2149
+ };
2150
+ const pasteDataFromExcel = async (row, col) => {
2151
+ const clipboard = await navigator.clipboard.readText();
2152
+ const arrayRow = clipboard.trimEnd().split("\n");
2153
+ arrayRow.forEach((item, indexRow) => {
2154
+ const arrayCol = item.trimEnd().split(" ");
2155
+ let dataRow = dataSource[row + indexRow];
2156
+ if (!dataRow) {
2157
+ dataRow = { ...defaultValue };
2158
+ dataSource?.push(dataRow);
2159
+ }
2160
+ arrayCol.forEach((element, index) => {
2161
+ const column = tableColumns[col + index];
2162
+ if ((!column.disabledCondition || !column.disabledCondition(row)) && column.editEnable) {
2163
+ dataRow[column.field] = element;
2164
+ }
2165
+ });
2166
+ rowChange(dataRow, row + indexRow, "");
2167
+ });
2168
+ handleRefeshRow();
2169
+ if (setDataSource) {
2170
+ setDataSource([...dataSource]);
2171
+ }
2172
+ };
2173
+ useEffect5(() => {
2174
+ if (setSelectedItem) {
2175
+ if (isMulti) {
2176
+ if (dataSource && selectedRows && selectedRows?.length !== selectedItem?.length) {
2177
+ setSelectedItem([...selectedRows]);
2178
+ }
2179
+ } else {
2180
+ if (dataSource && selectedRows?.length > 0) {
2181
+ if (!selectedItem || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
2182
+ setSelectedItem({ ...selectedRows[0] });
2183
+ }
2184
+ } else {
2185
+ setSelectedItem(void 0);
2186
+ }
2187
+ }
2188
+ }
2189
+ }, [selectedRows]);
2190
+ useEffect5(() => {
2191
+ if (!isMulti) {
2192
+ if (dataSource && selectedItem && selectedItem[fieldKey]) {
2193
+ if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
2194
+ setSelectedRows([selectedItem]);
2195
+ }
2196
+ } else {
2197
+ setSelectedRows([]);
2198
+ }
2199
+ } else {
2200
+ if (dataSource && selectedItem && selectedRows?.length !== selectedItem.length) {
2201
+ setSelectedRows(selectedItem ? [...selectedItem] : []);
2202
+ }
2203
+ }
2204
+ }, [selectedItem]);
2205
+ const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
2206
+ if (col.field === "command") {
2207
+ return /* @__PURE__ */ jsx12(
2208
+ "td",
2209
+ {
2210
+ className: classnames5(`e-rowcell p-0 fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "e-active": isSelected && editDisable || indexFocus === indexRow }),
2211
+ style: {
2212
+ width: col.width,
2213
+ minWidth: col.minWidth,
2214
+ maxWidth: col.maxWidth,
2215
+ left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
2216
+ right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
2217
+ textAlign: col.textAlign ? col.textAlign : "left"
2218
+ },
2219
+ children: /* @__PURE__ */ jsx12("div", { className: "e-rowcell-div ", children: renderCommand(col.commandItems, row, indexRow) })
2220
+ },
2221
+ `col-${indexRow}-${indexCol}`
2222
+ );
2223
+ } else if (col.field === "#") {
2224
+ return /* @__PURE__ */ jsx12(
2225
+ "td",
2226
+ {
2227
+ className: classnames5(`e-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "e-active": isSelected && editDisable || indexFocus === indexRow }),
2228
+ tabIndex: Number(`${indexRow}${indexCol}`),
2229
+ style: {
2230
+ width: 40,
2231
+ minWidth: 40,
2232
+ maxWidth: 40,
2233
+ left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
2234
+ right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
2235
+ textAlign: "center"
2236
+ },
2237
+ onCopy: (e) => {
2238
+ if (!editDisable && (e.target.nodeName === "DIV" || e.target.nodeName === "TD")) {
2239
+ navigator.clipboard.writeText(JSON.stringify(row));
2240
+ notificationSuccess(t("CopySuccessful"));
2241
+ e.stopPropagation();
2242
+ }
2243
+ },
2244
+ onPaste: (e) => {
2245
+ if (!editDisable && (e.target.nodeName === "DIV" || e.target.nodeName === "TD")) {
2246
+ navigator.clipboard.readText().then((rs) => {
2247
+ dataSource[indexRow] = JSON.parse(rs);
2248
+ if (fieldKey) {
2249
+ dataSource[indexRow][fieldKey] = defaultValue[fieldKey];
2250
+ }
2251
+ if (setDataSource) {
2252
+ setDataSource([...dataSource]);
2253
+ }
2254
+ notificationSuccess(t("PasteSuccessful"));
2255
+ }).catch((ex) => {
2256
+ alert(ex);
2257
+ });
2258
+ e.stopPropagation();
2259
+ }
2260
+ },
2261
+ onClick: (e) => {
2262
+ if (e.target.nodeName === "DIV" || e.target.nodeName === "TD") {
2263
+ if (!editDisable && indexRow != indexFocus) {
2264
+ setIndexFocus(indexRow);
2265
+ }
2266
+ e.stopPropagation();
2267
+ }
2268
+ },
2269
+ onKeyDown: (e) => {
2270
+ if (e.code === "KeyD" && e.ctrlKey == true && (!editDisable && !addDisable) && (e.target.nodeName === "DIV" || e.target.nodeName === "TD")) {
2271
+ handleDuplicate(row, indexRow);
2272
+ e.preventDefault();
2273
+ e.stopPropagation();
2274
+ }
2275
+ },
2276
+ children: /* @__PURE__ */ jsx12("div", { className: "e-rowcell-div pt-50", children: indexRow + 1 })
2277
+ },
2278
+ `col-${indexRow}-${indexCol}`
2279
+ );
2280
+ } else if (col.field === "checkbox") {
2281
+ return /* @__PURE__ */ jsx12(
2282
+ "td",
2283
+ {
2284
+ className: classnames5(`e-rowcell p-0 fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "e-active": isSelected && editDisable || indexFocus === indexRow }),
2285
+ style: {
2286
+ width: col.width,
2287
+ minWidth: col.minWidth,
2288
+ maxWidth: col.maxWidth,
2289
+ left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
2290
+ right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
2291
+ textAlign: col.textAlign ? col.textAlign : "center"
2292
+ },
2293
+ children: /* @__PURE__ */ jsx12(
2294
+ "div",
2295
+ {
2296
+ className: "e-rowcell-div cursor-pointer",
2297
+ onClick: (e) => {
2298
+ if (selectEnable) {
2299
+ const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
2300
+ if (index > -1) {
2301
+ if (isMulti) {
2302
+ selectedRows?.splice(index, 1);
2303
+ setSelectedRows([...selectedRows]);
2304
+ } else {
2305
+ setSelectedRows([]);
2306
+ }
2307
+ } else {
2308
+ if (isMulti) {
2309
+ setSelectedRows([...selectedRows, row]);
2310
+ } else {
2311
+ setSelectedRows([row]);
2312
+ }
2313
+ }
2314
+ e.stopPropagation();
2315
+ }
2316
+ },
2317
+ children: /* @__PURE__ */ jsx12(
2318
+ Input6,
2319
+ {
2320
+ checked: isSelected,
2321
+ type: "checkbox",
2322
+ className: "cursor-pointer",
2323
+ onChange: () => {
2324
+ },
2325
+ style: { textAlign: col.textAlign ?? "center", marginTop: 6 }
2326
+ }
2327
+ )
2328
+ }
2329
+ )
2330
+ },
2331
+ `col-${indexRow}-${indexCol}`
2332
+ );
2333
+ } else {
2334
+ let value = row[col.field];
2335
+ if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
2336
+ value = formartNumberic(row[col.field], decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) ?? 0;
2337
+ } else if (col.editType === "date") {
2338
+ value = value ? moment(value).format("DD/MM/yyyy") : "";
2339
+ } else if (col.editType === "datetime") {
2340
+ value = value ? moment(value).format("DD/MM/yyyy HH:mm") : "";
2341
+ }
2342
+ const typeDis = !editDisable && (indexFocus === indexRow || col.editType === "checkbox") && (!col.disabledCondition || !col.disabledCondition(row)) ? col.editEnable ? 1 : col.template ? 2 : 3 : col.template ? 2 : 3;
2343
+ const errorMessage = typeDis === 1 || col.field === "" || !col.validate ? "" : col.validate(row[col.field], row);
2344
+ return /* @__PURE__ */ jsx12(Fragment12, { children: col.visible !== false && /* @__PURE__ */ jsx12(
2345
+ "td",
2346
+ {
2347
+ className: classnames5(`e-rowcell fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "e-active": isSelected && editDisable || indexFocus === indexRow }),
2348
+ style: {
2349
+ left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
2350
+ right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
2351
+ padding: 0,
2352
+ textAlign: col.textAlign ? col.textAlign : "left"
2353
+ },
2354
+ onFocus: (e) => {
2355
+ if (!editDisable && indexRow != indexFocus) {
2356
+ setIndexFocus(indexRow);
2357
+ }
2358
+ e.stopPropagation();
2359
+ },
2360
+ onClick: (e) => {
2361
+ if (e.target.nodeName === "DIV" || e.target.nodeName === "TD") {
2362
+ if (!editDisable && indexRow != indexFocus) {
2363
+ setIndexFocus(indexRow);
2364
+ }
2365
+ if (selectEnable && editDisable) {
2366
+ const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
2367
+ if (index > -1) {
2368
+ if (isMulti) {
2369
+ selectedRows?.splice(index, 1);
2370
+ setSelectedRows([...selectedRows]);
2371
+ } else {
2372
+ setSelectedRows([]);
2373
+ }
2374
+ } else {
2375
+ if (isMulti) {
2376
+ setSelectedRows([...selectedRows, row]);
2377
+ } else {
2378
+ setSelectedRows([row]);
2379
+ }
2380
+ }
2381
+ }
2382
+ e.stopPropagation();
2383
+ }
2384
+ },
2385
+ title: `${value ?? ""}`,
2386
+ children: /* @__PURE__ */ jsxs11(
2387
+ "div",
2388
+ {
2389
+ id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
2390
+ className: classnames5("e-rowcell-div", { "is-invalid": errorMessage }),
2391
+ style: { padding: typeDis !== 1 ? errorMessage ? "2px 10px" : "6px 10px" : 2 },
2392
+ children: [
2393
+ typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : typeDis === 2 ? col.template(row, indexRow) : value,
2394
+ /* @__PURE__ */ jsx12("span", { className: "icon-table", children: /* @__PURE__ */ jsx12(TooltipComponent, { className: classnames5("cursor-pointer text-primary", { "d-none": !errorMessage }), content: errorMessage, children: /* @__PURE__ */ jsx12(AlertCircle, { fontSize: 16.5 }) }) })
2395
+ ]
2396
+ }
2397
+ )
2398
+ },
2399
+ `col-${indexRow}-${indexCol}`
2400
+ ) }, indexCol);
2401
+ }
2402
+ };
2403
+ const renderHeaderCol = (col, indexCol) => {
2404
+ if (col.field === "checkbox") {
2405
+ return /* @__PURE__ */ jsx12(Fragment12, { children: col.visible !== false && /* @__PURE__ */ jsx12(
2406
+ "th",
2407
+ {
2408
+ className: classnames5(`e-headercell fix-${col.fixedType}`, { "cell-fixed": col.fixedType }),
2409
+ style: {
2410
+ width: col.width,
2411
+ padding: 0,
2412
+ minWidth: col.minWidth,
2413
+ left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
2414
+ right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
2415
+ maxWidth: col.maxWidth
2416
+ },
2417
+ children: /* @__PURE__ */ jsx12(
2418
+ "div",
2419
+ {
2420
+ style: { textAlign: "center", justifyContent: col.textAlign ?? "center" },
2421
+ className: classnames5("e-headercell-div"),
2422
+ children: /* @__PURE__ */ jsx12(
2423
+ Input6,
2424
+ {
2425
+ checked: selectedRows?.length >= dataSource?.length && dataSource?.length > 0,
2426
+ type: "checkbox",
2427
+ className: classnames5("cursor-pointer", { "d-none": !isMulti }),
2428
+ style: { textAlign: col.textAlign ?? "center", marginTop: 6 },
2429
+ onChange: (e) => {
2430
+ if (selectEnable) {
2431
+ if (e.target.checked) {
2432
+ const arr = dataSource?.map((item) => {
2433
+ return item;
2434
+ });
2435
+ setSelectedRows(arr);
2436
+ } else {
2437
+ setSelectedRows([]);
2438
+ }
2439
+ }
2440
+ }
2441
+ }
2442
+ )
2443
+ }
2444
+ )
2445
+ }
2446
+ ) }, `header-${indexCol}`);
2447
+ } else if (col.field === "#") {
2448
+ return /* @__PURE__ */ jsx12(
2449
+ Fragment12,
2450
+ {
2451
+ children: col.visible !== false && /* @__PURE__ */ jsx12(
2452
+ "th",
2453
+ {
2454
+ className: classnames5(`e-headercell fix-${col.fixedType}`, { "cell-fixed": col.fixedType }),
2455
+ style: {
2456
+ padding: 0,
2457
+ width: 40,
2458
+ minWidth: 40,
2459
+ maxWidth: 40,
2460
+ left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
2461
+ right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0
2462
+ },
2463
+ children: /* @__PURE__ */ jsx12(
2464
+ "div",
2465
+ {
2466
+ title: t(col.headerText ?? ""),
2467
+ style: { textAlign: "center", justifyContent: col.textAlign ?? "center" },
2468
+ className: "e-headercell-div",
2469
+ children: t(col.headerText ?? "")
2470
+ }
2471
+ )
2472
+ }
2473
+ )
2474
+ },
2475
+ `header-${indexCol}`
2476
+ );
2477
+ } else {
2478
+ return /* @__PURE__ */ jsx12(
2479
+ Fragment12,
2480
+ {
2481
+ children: col.visible !== false && /* @__PURE__ */ jsx12(
2482
+ "th",
2483
+ {
2484
+ className: classnames5(`e-headercell fix-${col.fixedType}`, { "cell-fixed": col.fixedType }),
2485
+ style: {
2486
+ width: col.width,
2487
+ padding: 0,
2488
+ minWidth: col.minWidth,
2489
+ left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
2490
+ right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
2491
+ maxWidth: col.maxWidth
2492
+ },
2493
+ children: /* @__PURE__ */ jsx12(
2494
+ "div",
2495
+ {
2496
+ title: t(col.headerText ?? ""),
2497
+ style: { textAlign: "center", justifyContent: col.textAlign ?? "left" },
2498
+ className: "e-headercell-div",
2499
+ children: t(col.headerText ?? "")
2500
+ }
2501
+ )
2502
+ }
2503
+ )
2504
+ },
2505
+ `header-${indexCol}`
2506
+ );
2507
+ }
2508
+ };
2509
+ const renderFooterCol = (col, indexCol) => {
2510
+ return /* @__PURE__ */ jsx12(Fragment12, { children: col.visible !== false && /* @__PURE__ */ jsx12(
2511
+ "td",
2512
+ {
2513
+ className: classnames5(`e-summarycell p-0 px-50 fix-${col.fixedType}`, { "cell-fixed": col.fixedType }),
2514
+ style: {
2515
+ height: 30,
2516
+ fontSize: 14,
2517
+ fontWeight: 600,
2518
+ left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
2519
+ right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
2520
+ width: col.width,
2521
+ minWidth: col.minWidth,
2522
+ maxWidth: col.maxWidth,
2523
+ whiteSpace: "nowrap",
2524
+ textAlign: col.textAlign ? col.textAlign : "left"
2525
+ },
2526
+ children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource?.reduce(function(accumulator, currentValue) {
2527
+ return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
2528
+ }, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : ""
2529
+ }
2530
+ ) }, `summarycell-${indexCol}`);
2531
+ };
2532
+ const renderToolbarTop = () => {
2533
+ return /* @__PURE__ */ jsx12("div", { id: "table_custom_top_toolbar", className: "e-control e-toolbar", "aria-orientation": "horizontal", children: /* @__PURE__ */ jsxs11("div", { className: "e-toolbar-items e-tbar-pos", children: [
2534
+ /* @__PURE__ */ jsx12("div", { className: "e-toolbar-left", children: toolbarTopOption?.map((item, index) => {
2535
+ return item.align === "left" ? /* @__PURE__ */ jsx12("div", { className: "e-toolbar-item e-template", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) : "";
2536
+ }) }),
2537
+ /* @__PURE__ */ jsx12("div", { className: "e-toolbar-center", children: toolbarTopOption?.map((item, index) => {
2538
+ return item.align === "center" ? /* @__PURE__ */ jsx12("div", { className: "e-toolbar-item e-template", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) : "";
2539
+ }) }),
2540
+ /* @__PURE__ */ jsx12("div", { className: "e-toolbar-right", children: toolbarTopOption?.map((item, index) => {
2541
+ return item.align === "right" ? /* @__PURE__ */ jsx12("div", { className: "e-toolbar-item e-template", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) : "";
2542
+ }) })
2543
+ ] }) });
2544
+ };
2545
+ const renderToolbarBottom = () => {
2546
+ return /* @__PURE__ */ jsx12("div", { id: "table_custom_bottom_toolbar", className: "e-control e-toolbar e-lib e-keyboard ", role: "toolbar", "aria-disabled": "false", "aria-haspopup": "false", "aria-orientation": "horizontal", children: /* @__PURE__ */ jsxs11("div", { className: "e-toolbar-items e-tbar-pos", children: [
2547
+ /* @__PURE__ */ jsxs11("div", { className: "e-toolbar-left", children: [
2548
+ /* @__PURE__ */ jsx12("div", { className: classnames5("e-toolbar-item e-template", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx12(Button3, { color: "success", outline: true, onClick: handleAdd, className: "d-flex", children: t("Add item") }) }),
2549
+ (indexFocus ?? -1) > -1 ? /* @__PURE__ */ jsxs11(Fragment13, { children: [
2550
+ /* @__PURE__ */ jsx12("div", { className: classnames5("e-toolbar-item e-template", { "d-none": editDisable || addDisable || duplicateDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx12(Button3, { color: "success", outline: true, onClick: () => {
2551
+ handleDuplicate(dataSource[indexFocus ?? -1], indexFocus ?? -1);
2552
+ }, className: "d-flex", children: t("Duplicate") }) }),
2553
+ /* @__PURE__ */ jsx12("div", { className: classnames5("e-toolbar-item e-template", { "d-none": editDisable || addDisable || insertBeforeDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx12(Button3, { color: "success", outline: true, onClick: handleInsertBefore, className: "d-flex", children: t("Insert item before") }) }),
2554
+ /* @__PURE__ */ jsx12("div", { className: classnames5("e-toolbar-item e-template", { "d-none": editDisable || addDisable || insertAfterDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx12(Button3, { color: "success", outline: true, onClick: handleInsertAfter, className: "d-flex", children: t("Insert item after") }) })
2555
+ ] }) : /* @__PURE__ */ jsx12(Fragment13, { children: " " }),
2556
+ /* @__PURE__ */ jsx12("div", { className: classnames5("e-toolbar-item e-template", { "d-none": editDisable || addDisable || deleteAllDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsx12(Button3, { color: "primary", outline: true, onClick: handleDeleteAll, className: "d-flex", children: t("Delete all item") }) }),
2557
+ toolbarBottomOptions?.map((item, index) => {
2558
+ return item.align === "left" ? /* @__PURE__ */ jsx12("div", { className: "e-toolbar-item e-template", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : "";
2559
+ })
2560
+ ] }),
2561
+ /* @__PURE__ */ jsx12("div", { className: "e-toolbar-center", children: toolbarBottomOptions?.map((item, index) => {
2562
+ return item.align === "center" ? /* @__PURE__ */ jsx12("div", { className: "e-toolbar-item e-template", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : "";
2563
+ }) }),
2564
+ /* @__PURE__ */ jsxs11("div", { className: "e-toolbar-right", children: [
2565
+ toolbarBottomOptions?.map((item, index) => {
2566
+ return item.align === "right" ? /* @__PURE__ */ jsx12("div", { className: "e-toolbar-item e-template", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : "";
2567
+ }),
2568
+ /* @__PURE__ */ jsx12("div", { className: classnames5("e-toolbar-item e-template me-25"), "aria-disabled": "false", children: /* @__PURE__ */ jsx12(Settings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }),
2569
+ /* @__PURE__ */ jsx12("div", { className: classnames5("e-toolbar-item e-template me-25", { "d-none": editDisable || addDisable }), "aria-disabled": "false", children: /* @__PURE__ */ jsxs11(UncontrolledDropdown, { className: "dropdown-user nav-item", children: [
2570
+ /* @__PURE__ */ jsx12(DropdownToggle2, { href: "/", tag: "a", color: "info", onClick: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx12(Info2, { className: "cursor-pointer" }) }),
2571
+ /* @__PURE__ */ jsx12(DropdownMenu2, { children: /* @__PURE__ */ jsxs11("div", { className: "d-flex flex-column p-50 py-25", children: [
2572
+ /* @__PURE__ */ jsx12("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" }),
2573
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 13 }, children: "Ch\u1ECDn \xF4 v\xE0 Ctrl + V \u0111\u1EC3 d\xE1n th\xF4ng tin t\u1EEB excel" }),
2574
+ /* @__PURE__ */ jsx12("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" }),
2575
+ /* @__PURE__ */ jsx12("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" })
2576
+ ] }) })
2577
+ ] }) })
2578
+ ] })
2579
+ ] }) });
2580
+ };
2581
+ return /* @__PURE__ */ jsxs11(Fragment12, { children: [
2582
+ /* @__PURE__ */ jsxs11("div", { className: "table-edit-custom", children: [
2583
+ /* @__PURE__ */ jsxs11("div", { className: "e-grid e-default e-bothlines", children: [
2584
+ showTopToolbar ? /* @__PURE__ */ jsx12(Fragment13, { children: renderToolbarTop() }) : /* @__PURE__ */ jsx12(Fragment13, {}),
2585
+ /* @__PURE__ */ jsxs11("div", { ref: gridRef, children: [
2586
+ /* @__PURE__ */ jsx12("div", { className: "e-gridcontent", children: /* @__PURE__ */ jsx12("div", { ref: tableElement, className: "e-content", style: { height: `${height ? `${height}px` : "auto"}`, minHeight: `${minHeight ? `${minHeight}px` : ""}`, maxHeight: `${maxHeight ? `${maxHeight}px` : "400px"}` }, children: /* @__PURE__ */ jsxs11("table", { style: { width: "100%" }, children: [
2587
+ /* @__PURE__ */ jsx12("thead", { className: "e-gridheader", children: /* @__PURE__ */ jsx12("tr", { className: "e-row", role: "row", children: tableColumns.map((col, index) => {
2588
+ return renderHeaderCol(col, index);
2589
+ }) }) }),
2590
+ /* @__PURE__ */ jsx12("tbody", { className: "rowgroup", style: { overflowY: "scroll" }, children: dataSource?.map((row, indexRow) => {
2591
+ const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
2592
+ return /* @__PURE__ */ jsx12(
2593
+ "tr",
2594
+ {
2595
+ className: "e-row",
2596
+ children: tableColumns.map((col, indexCol) => {
2597
+ return renderContentCol(col, row, indexRow, indexCol, isSelected);
2598
+ })
2599
+ },
2600
+ `row-${indexRow}`
2601
+ );
2602
+ }) }),
2603
+ /* @__PURE__ */ jsx12("tfoot", { className: "e-gridfoot", children: haveSum == true ? /* @__PURE__ */ jsx12("tr", { className: "e-row", children: tableColumns.map((col, index) => {
2604
+ return renderFooterCol(col, index);
2605
+ }) }) : /* @__PURE__ */ jsx12(Fragment13, {}) })
2606
+ ] }) }) }),
2607
+ showBottomToolbar ? /* @__PURE__ */ jsx12(Fragment13, { children: renderToolbarBottom() }) : /* @__PURE__ */ jsx12(Fragment13, {})
2608
+ ] })
2609
+ ] }),
2610
+ allowPaging ? /* @__PURE__ */ jsx12(
2611
+ PagerComponent,
2612
+ {
2613
+ locale: lang,
2614
+ click: onChangePage,
2615
+ pageSize,
2616
+ currentPage,
2617
+ pageSizes: [20, 30, 50, 100],
2618
+ totalRecordsCount: totalItem ? totalItem : void 0,
2619
+ pageCount: 5,
2620
+ dropDownChanged: onChangePageSize
2621
+ }
2622
+ ) : /* @__PURE__ */ jsx12(Fragment13, {})
2623
+ ] }),
2624
+ /* @__PURE__ */ jsx12(
2625
+ sidebar_setting_column_default,
2626
+ {
2627
+ handleSidebar: () => {
2628
+ setOpenPopupSetupColumn(!openPopupSetupColumn);
2629
+ },
2630
+ openSidebar: openPopupSetupColumn,
2631
+ column: tableColumns,
2632
+ setColumn: setTableColumns
2633
+ }
2634
+ )
2635
+ ] });
2636
+ });
2637
+ var table_default = TableEdit;
2638
+
2639
+ // index.ts
2640
+ var Table_edit_default = table_default;
2641
+ export {
2642
+ Table_edit_default as default,
2643
+ messageBoxConfirm,
2644
+ messageBoxConfirm2,
2645
+ messageBoxConfirmApprove,
2646
+ messageBoxConfirmDelete,
2647
+ messageBoxError,
2648
+ messageHtmlBoxError,
2649
+ notificationError,
2650
+ notificationSuccess
2651
+ };