@charlesgomes/leafcode-shared-lib-react 1.0.18 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +16 -4
- package/dist/index.mjs +16 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -53,6 +53,7 @@ type IDataTableProps<T extends object> = {
|
|
|
53
53
|
sortOrderInitial?: 1 | -1;
|
|
54
54
|
isMultiSelectionMode?: boolean;
|
|
55
55
|
isLanguagePtBr?: boolean;
|
|
56
|
+
replaceUrl?: boolean;
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
interface PaginatedResponse<T> {
|
|
@@ -83,7 +84,7 @@ interface ColumnCustom<T> {
|
|
|
83
84
|
alignFrozen?: "left" | "right";
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
declare function DataTableAdvancedFilter<T extends object>({ queryKey, mutationFn, columns, initFilters, onNew, onEdit, onDelete, customActions, customActionsColums, disablePagination, sortFieldInitial, sortOrderInitial, isMultiSelectionMode, isLanguagePtBr, }: IDataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
87
|
+
declare function DataTableAdvancedFilter<T extends object>({ queryKey, mutationFn, columns, initFilters, onNew, onEdit, onDelete, customActions, customActionsColums, disablePagination, sortFieldInitial, sortOrderInitial, isMultiSelectionMode, isLanguagePtBr, replaceUrl }: IDataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
87
88
|
|
|
88
89
|
interface IItemProps {
|
|
89
90
|
value: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ type IDataTableProps<T extends object> = {
|
|
|
53
53
|
sortOrderInitial?: 1 | -1;
|
|
54
54
|
isMultiSelectionMode?: boolean;
|
|
55
55
|
isLanguagePtBr?: boolean;
|
|
56
|
+
replaceUrl?: boolean;
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
interface PaginatedResponse<T> {
|
|
@@ -83,7 +84,7 @@ interface ColumnCustom<T> {
|
|
|
83
84
|
alignFrozen?: "left" | "right";
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
declare function DataTableAdvancedFilter<T extends object>({ queryKey, mutationFn, columns, initFilters, onNew, onEdit, onDelete, customActions, customActionsColums, disablePagination, sortFieldInitial, sortOrderInitial, isMultiSelectionMode, isLanguagePtBr, }: IDataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
87
|
+
declare function DataTableAdvancedFilter<T extends object>({ queryKey, mutationFn, columns, initFilters, onNew, onEdit, onDelete, customActions, customActionsColums, disablePagination, sortFieldInitial, sortOrderInitial, isMultiSelectionMode, isLanguagePtBr, replaceUrl }: IDataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
87
88
|
|
|
88
89
|
interface IItemProps {
|
|
89
90
|
value: string;
|
package/dist/index.js
CHANGED
|
@@ -265,6 +265,7 @@ function TableActions({
|
|
|
265
265
|
"button",
|
|
266
266
|
{
|
|
267
267
|
id: "add",
|
|
268
|
+
type: "button",
|
|
268
269
|
onClick: onNew,
|
|
269
270
|
className: cn(
|
|
270
271
|
"enable-button-table-actions",
|
|
@@ -286,6 +287,7 @@ function TableActions({
|
|
|
286
287
|
"button",
|
|
287
288
|
{
|
|
288
289
|
id: "edit",
|
|
290
|
+
type: "button",
|
|
289
291
|
onClick: () => onEdit(selectedRows),
|
|
290
292
|
className: cn(
|
|
291
293
|
"enable-button-table-actions",
|
|
@@ -308,6 +310,7 @@ function TableActions({
|
|
|
308
310
|
"button",
|
|
309
311
|
{
|
|
310
312
|
id: "delete",
|
|
313
|
+
type: "button",
|
|
311
314
|
onClick: () => onDelete(selectedRows),
|
|
312
315
|
className: cn(
|
|
313
316
|
"enable-button-table-actions",
|
|
@@ -332,6 +335,7 @@ function TableActions({
|
|
|
332
335
|
"button",
|
|
333
336
|
{
|
|
334
337
|
id,
|
|
338
|
+
type: "button",
|
|
335
339
|
onClick: () => action.onClick(selectedRows),
|
|
336
340
|
className: cn("enable-button-table-actions", action.className),
|
|
337
341
|
children: [
|
|
@@ -361,6 +365,7 @@ function ActionsColumn({
|
|
|
361
365
|
"button",
|
|
362
366
|
{
|
|
363
367
|
id: "edit-column",
|
|
368
|
+
type: "button",
|
|
364
369
|
className: "btn-icone-actions-column",
|
|
365
370
|
onClick: (e) => {
|
|
366
371
|
onEdit && onEdit([row]);
|
|
@@ -381,6 +386,7 @@ function ActionsColumn({
|
|
|
381
386
|
"button",
|
|
382
387
|
{
|
|
383
388
|
id: "delete-column",
|
|
389
|
+
type: "button",
|
|
384
390
|
className: "btn-icone-actions-column",
|
|
385
391
|
onClick: (e) => {
|
|
386
392
|
onDelete && onDelete([row]);
|
|
@@ -403,6 +409,7 @@ function ActionsColumn({
|
|
|
403
409
|
"button",
|
|
404
410
|
{
|
|
405
411
|
id,
|
|
412
|
+
type: "button",
|
|
406
413
|
onClick: () => action.onClick([row]),
|
|
407
414
|
className: cn("btn-icone-actions-column", action.className),
|
|
408
415
|
children: [
|
|
@@ -526,7 +533,8 @@ function DataTableAdvancedFilterWrapper({
|
|
|
526
533
|
sortFieldInitial,
|
|
527
534
|
sortOrderInitial = 1,
|
|
528
535
|
isMultiSelectionMode = true,
|
|
529
|
-
isLanguagePtBr = true
|
|
536
|
+
isLanguagePtBr = true,
|
|
537
|
+
replaceUrl = true
|
|
530
538
|
}) {
|
|
531
539
|
const [isClient, setIsClient] = (0, import_react6.useState)(false);
|
|
532
540
|
(0, import_react6.useEffect)(() => {
|
|
@@ -575,7 +583,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
575
583
|
)
|
|
576
584
|
});
|
|
577
585
|
const updateUrlParams = (params) => {
|
|
578
|
-
if (typeof window === "undefined") return;
|
|
586
|
+
if (typeof window === "undefined" || !replaceUrl) return;
|
|
579
587
|
const urlParams = new URLSearchParams(window.location.search);
|
|
580
588
|
Object.entries(params).forEach(([key, value]) => {
|
|
581
589
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -705,6 +713,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
705
713
|
PrevPageLink: (options) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
706
714
|
"button",
|
|
707
715
|
{
|
|
716
|
+
type: "button",
|
|
708
717
|
onClick: options.onClick,
|
|
709
718
|
disabled: options.disabled,
|
|
710
719
|
className: `PrevPage ${options.disabled ? "PrevPageDisabled" : "PrevPageEnabled"}`,
|
|
@@ -727,6 +736,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
727
736
|
NextPageLink: (options) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
728
737
|
"button",
|
|
729
738
|
{
|
|
739
|
+
type: "button",
|
|
730
740
|
onClick: options.onClick,
|
|
731
741
|
disabled: options.disabled,
|
|
732
742
|
className: `NextPage ${options.disabled ? "NextPageDisabled" : "NextPageEnabled"}`,
|
|
@@ -930,7 +940,8 @@ function DataTableAdvancedFilter({
|
|
|
930
940
|
sortFieldInitial,
|
|
931
941
|
sortOrderInitial = 1,
|
|
932
942
|
isMultiSelectionMode = true,
|
|
933
|
-
isLanguagePtBr = true
|
|
943
|
+
isLanguagePtBr = true,
|
|
944
|
+
replaceUrl = true
|
|
934
945
|
}) {
|
|
935
946
|
const [isClient, setIsClient] = (0, import_react8.useState)(false);
|
|
936
947
|
(0, import_react8.useEffect)(() => {
|
|
@@ -962,7 +973,8 @@ function DataTableAdvancedFilter({
|
|
|
962
973
|
sortFieldInitial,
|
|
963
974
|
sortOrderInitial,
|
|
964
975
|
isMultiSelectionMode,
|
|
965
|
-
isLanguagePtBr
|
|
976
|
+
isLanguagePtBr,
|
|
977
|
+
replaceUrl
|
|
966
978
|
}
|
|
967
979
|
)
|
|
968
980
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -219,6 +219,7 @@ function TableActions({
|
|
|
219
219
|
"button",
|
|
220
220
|
{
|
|
221
221
|
id: "add",
|
|
222
|
+
type: "button",
|
|
222
223
|
onClick: onNew,
|
|
223
224
|
className: cn(
|
|
224
225
|
"enable-button-table-actions",
|
|
@@ -240,6 +241,7 @@ function TableActions({
|
|
|
240
241
|
"button",
|
|
241
242
|
{
|
|
242
243
|
id: "edit",
|
|
244
|
+
type: "button",
|
|
243
245
|
onClick: () => onEdit(selectedRows),
|
|
244
246
|
className: cn(
|
|
245
247
|
"enable-button-table-actions",
|
|
@@ -262,6 +264,7 @@ function TableActions({
|
|
|
262
264
|
"button",
|
|
263
265
|
{
|
|
264
266
|
id: "delete",
|
|
267
|
+
type: "button",
|
|
265
268
|
onClick: () => onDelete(selectedRows),
|
|
266
269
|
className: cn(
|
|
267
270
|
"enable-button-table-actions",
|
|
@@ -286,6 +289,7 @@ function TableActions({
|
|
|
286
289
|
"button",
|
|
287
290
|
{
|
|
288
291
|
id,
|
|
292
|
+
type: "button",
|
|
289
293
|
onClick: () => action.onClick(selectedRows),
|
|
290
294
|
className: cn("enable-button-table-actions", action.className),
|
|
291
295
|
children: [
|
|
@@ -315,6 +319,7 @@ function ActionsColumn({
|
|
|
315
319
|
"button",
|
|
316
320
|
{
|
|
317
321
|
id: "edit-column",
|
|
322
|
+
type: "button",
|
|
318
323
|
className: "btn-icone-actions-column",
|
|
319
324
|
onClick: (e) => {
|
|
320
325
|
onEdit && onEdit([row]);
|
|
@@ -335,6 +340,7 @@ function ActionsColumn({
|
|
|
335
340
|
"button",
|
|
336
341
|
{
|
|
337
342
|
id: "delete-column",
|
|
343
|
+
type: "button",
|
|
338
344
|
className: "btn-icone-actions-column",
|
|
339
345
|
onClick: (e) => {
|
|
340
346
|
onDelete && onDelete([row]);
|
|
@@ -357,6 +363,7 @@ function ActionsColumn({
|
|
|
357
363
|
"button",
|
|
358
364
|
{
|
|
359
365
|
id,
|
|
366
|
+
type: "button",
|
|
360
367
|
onClick: () => action.onClick([row]),
|
|
361
368
|
className: cn("btn-icone-actions-column", action.className),
|
|
362
369
|
children: [
|
|
@@ -480,7 +487,8 @@ function DataTableAdvancedFilterWrapper({
|
|
|
480
487
|
sortFieldInitial,
|
|
481
488
|
sortOrderInitial = 1,
|
|
482
489
|
isMultiSelectionMode = true,
|
|
483
|
-
isLanguagePtBr = true
|
|
490
|
+
isLanguagePtBr = true,
|
|
491
|
+
replaceUrl = true
|
|
484
492
|
}) {
|
|
485
493
|
const [isClient, setIsClient] = useState2(false);
|
|
486
494
|
useEffect3(() => {
|
|
@@ -529,7 +537,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
529
537
|
)
|
|
530
538
|
});
|
|
531
539
|
const updateUrlParams = (params) => {
|
|
532
|
-
if (typeof window === "undefined") return;
|
|
540
|
+
if (typeof window === "undefined" || !replaceUrl) return;
|
|
533
541
|
const urlParams = new URLSearchParams(window.location.search);
|
|
534
542
|
Object.entries(params).forEach(([key, value]) => {
|
|
535
543
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -659,6 +667,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
659
667
|
PrevPageLink: (options) => /* @__PURE__ */ jsx9(
|
|
660
668
|
"button",
|
|
661
669
|
{
|
|
670
|
+
type: "button",
|
|
662
671
|
onClick: options.onClick,
|
|
663
672
|
disabled: options.disabled,
|
|
664
673
|
className: `PrevPage ${options.disabled ? "PrevPageDisabled" : "PrevPageEnabled"}`,
|
|
@@ -681,6 +690,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
681
690
|
NextPageLink: (options) => /* @__PURE__ */ jsx9(
|
|
682
691
|
"button",
|
|
683
692
|
{
|
|
693
|
+
type: "button",
|
|
684
694
|
onClick: options.onClick,
|
|
685
695
|
disabled: options.disabled,
|
|
686
696
|
className: `NextPage ${options.disabled ? "NextPageDisabled" : "NextPageEnabled"}`,
|
|
@@ -884,7 +894,8 @@ function DataTableAdvancedFilter({
|
|
|
884
894
|
sortFieldInitial,
|
|
885
895
|
sortOrderInitial = 1,
|
|
886
896
|
isMultiSelectionMode = true,
|
|
887
|
-
isLanguagePtBr = true
|
|
897
|
+
isLanguagePtBr = true,
|
|
898
|
+
replaceUrl = true
|
|
888
899
|
}) {
|
|
889
900
|
const [isClient, setIsClient] = useState3(false);
|
|
890
901
|
useEffect4(() => {
|
|
@@ -916,7 +927,8 @@ function DataTableAdvancedFilter({
|
|
|
916
927
|
sortFieldInitial,
|
|
917
928
|
sortOrderInitial,
|
|
918
929
|
isMultiSelectionMode,
|
|
919
|
-
isLanguagePtBr
|
|
930
|
+
isLanguagePtBr,
|
|
931
|
+
replaceUrl
|
|
920
932
|
}
|
|
921
933
|
)
|
|
922
934
|
}
|