@charlesgomes/leafcode-shared-lib-react 1.0.17 → 1.0.19
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 +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +168 -89
- package/dist/index.mjs +150 -72
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode as ReactNode$1 } from 'react';
|
|
2
3
|
import { FilterMatchMode } from 'primereact/api';
|
|
3
4
|
export { FilterMatchMode, FilterOperator } from 'primereact/api';
|
|
4
5
|
export { DataTableProps } from 'primereact/datatable';
|
|
@@ -15,6 +16,19 @@ interface ButtonProps {
|
|
|
15
16
|
}
|
|
16
17
|
declare function Button({ disabled, loading, color, type, onClick, title, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
17
18
|
|
|
19
|
+
interface Props {
|
|
20
|
+
show: boolean;
|
|
21
|
+
onHide: () => void;
|
|
22
|
+
onAction: () => void;
|
|
23
|
+
title: string;
|
|
24
|
+
children: ReactNode$1;
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
btnCancel?: string;
|
|
27
|
+
btnSuccess?: string;
|
|
28
|
+
disabledBtnSuccess?: boolean;
|
|
29
|
+
}
|
|
30
|
+
declare function ModalBase({ show, onHide, onAction, title, children, loading, btnCancel, btnSuccess, disabledBtnSuccess, }: Props): react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
18
32
|
type IDataTableProps<T extends object> = {
|
|
19
33
|
queryKey: string;
|
|
20
34
|
mutationFn: (
|
|
@@ -39,6 +53,7 @@ type IDataTableProps<T extends object> = {
|
|
|
39
53
|
sortOrderInitial?: 1 | -1;
|
|
40
54
|
isMultiSelectionMode?: boolean;
|
|
41
55
|
isLanguagePtBr?: boolean;
|
|
56
|
+
replaceUrl?: boolean;
|
|
42
57
|
};
|
|
43
58
|
|
|
44
59
|
interface PaginatedResponse<T> {
|
|
@@ -69,7 +84,7 @@ interface ColumnCustom<T> {
|
|
|
69
84
|
alignFrozen?: "left" | "right";
|
|
70
85
|
}
|
|
71
86
|
|
|
72
|
-
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;
|
|
73
88
|
|
|
74
89
|
interface IItemProps {
|
|
75
90
|
value: string;
|
|
@@ -90,4 +105,4 @@ declare const getDefaultFilterMatchOptionsDate: (isLanguagePtBr: boolean) => {
|
|
|
90
105
|
value: FilterMatchMode;
|
|
91
106
|
}[];
|
|
92
107
|
|
|
93
|
-
export { Button, type ColumnCustom, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, SelectFilterTemplate, ValueFilterTemplate, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsString };
|
|
108
|
+
export { Button, type ColumnCustom, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, ModalBase, SelectFilterTemplate, ValueFilterTemplate, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsString };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode as ReactNode$1 } from 'react';
|
|
2
3
|
import { FilterMatchMode } from 'primereact/api';
|
|
3
4
|
export { FilterMatchMode, FilterOperator } from 'primereact/api';
|
|
4
5
|
export { DataTableProps } from 'primereact/datatable';
|
|
@@ -15,6 +16,19 @@ interface ButtonProps {
|
|
|
15
16
|
}
|
|
16
17
|
declare function Button({ disabled, loading, color, type, onClick, title, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
17
18
|
|
|
19
|
+
interface Props {
|
|
20
|
+
show: boolean;
|
|
21
|
+
onHide: () => void;
|
|
22
|
+
onAction: () => void;
|
|
23
|
+
title: string;
|
|
24
|
+
children: ReactNode$1;
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
btnCancel?: string;
|
|
27
|
+
btnSuccess?: string;
|
|
28
|
+
disabledBtnSuccess?: boolean;
|
|
29
|
+
}
|
|
30
|
+
declare function ModalBase({ show, onHide, onAction, title, children, loading, btnCancel, btnSuccess, disabledBtnSuccess, }: Props): react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
18
32
|
type IDataTableProps<T extends object> = {
|
|
19
33
|
queryKey: string;
|
|
20
34
|
mutationFn: (
|
|
@@ -39,6 +53,7 @@ type IDataTableProps<T extends object> = {
|
|
|
39
53
|
sortOrderInitial?: 1 | -1;
|
|
40
54
|
isMultiSelectionMode?: boolean;
|
|
41
55
|
isLanguagePtBr?: boolean;
|
|
56
|
+
replaceUrl?: boolean;
|
|
42
57
|
};
|
|
43
58
|
|
|
44
59
|
interface PaginatedResponse<T> {
|
|
@@ -69,7 +84,7 @@ interface ColumnCustom<T> {
|
|
|
69
84
|
alignFrozen?: "left" | "right";
|
|
70
85
|
}
|
|
71
86
|
|
|
72
|
-
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;
|
|
73
88
|
|
|
74
89
|
interface IItemProps {
|
|
75
90
|
value: string;
|
|
@@ -90,4 +105,4 @@ declare const getDefaultFilterMatchOptionsDate: (isLanguagePtBr: boolean) => {
|
|
|
90
105
|
value: FilterMatchMode;
|
|
91
106
|
}[];
|
|
92
107
|
|
|
93
|
-
export { Button, type ColumnCustom, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, SelectFilterTemplate, ValueFilterTemplate, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsString };
|
|
108
|
+
export { Button, type ColumnCustom, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, ModalBase, SelectFilterTemplate, ValueFilterTemplate, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsString };
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
DateTimeFilterTemplate: () => DateTimeFilterTemplate,
|
|
37
37
|
FilterMatchMode: () => import_api4.FilterMatchMode,
|
|
38
38
|
FilterOperator: () => import_api4.FilterOperator,
|
|
39
|
+
ModalBase: () => ModalBase,
|
|
39
40
|
SelectFilterTemplate: () => SelectFilterTemplate,
|
|
40
41
|
ValueFilterTemplate: () => ValueFilterTemplate,
|
|
41
42
|
getDefaultFilterMatchOptionsDate: () => getDefaultFilterMatchOptionsDate,
|
|
@@ -96,11 +97,85 @@ function Button({
|
|
|
96
97
|
);
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
// src/components/ModalBase/ModalBase.tsx
|
|
101
|
+
var import_react = require("@phosphor-icons/react");
|
|
102
|
+
|
|
103
|
+
// src/components/ModalBase/FooterButtons.tsx
|
|
104
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
105
|
+
function FooterButtons({ children }) {
|
|
106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "sm:flex pt-8 justify-end text-right sm:space-x-6 space-x-0 sm:space-y-0 space-y-4 p-6", children });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// src/components/ModalBase/ModalBase.tsx
|
|
110
|
+
var import_react2 = require("react");
|
|
111
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
112
|
+
function ModalBase({
|
|
113
|
+
show,
|
|
114
|
+
onHide,
|
|
115
|
+
onAction,
|
|
116
|
+
title,
|
|
117
|
+
children,
|
|
118
|
+
loading,
|
|
119
|
+
btnCancel = "Cancel",
|
|
120
|
+
btnSuccess = "Save",
|
|
121
|
+
disabledBtnSuccess
|
|
122
|
+
}) {
|
|
123
|
+
(0, import_react2.useEffect)(() => {
|
|
124
|
+
const handleKeyDown = (event) => {
|
|
125
|
+
if (event.key === "Escape") {
|
|
126
|
+
onHide();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
130
|
+
return () => {
|
|
131
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
132
|
+
};
|
|
133
|
+
}, [onHide]);
|
|
134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: show ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
135
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "justify-center items-start pt-11 overflow-x-hidden overflow-y-auto fixed inset-0 z-[60] outline-none focus:outline-none", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "relative w-auto my-6 mx-auto max-w-xl", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-theme-dark outline-none focus:outline-none", children: [
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-start justify-between p-2", children: [
|
|
137
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: "text-lg text-center absolute top-6 left-1/2 transform -translate-x-1/2 -translate-y-1/2 font-SegoeUIVF font-bold text-light-dark-100", children: title }),
|
|
138
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
139
|
+
"button",
|
|
140
|
+
{
|
|
141
|
+
className: "p-1 ml-auto mr-1 cursor-pointer",
|
|
142
|
+
onClick: onHide,
|
|
143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react.X, { size: 18, color: "#ffffff" })
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
] }),
|
|
147
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "w-full p-6", children }),
|
|
148
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(FooterButtons, { children: [
|
|
149
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
150
|
+
Button,
|
|
151
|
+
{
|
|
152
|
+
color: "danger",
|
|
153
|
+
title: btnCancel,
|
|
154
|
+
type: "button",
|
|
155
|
+
onClick: onHide
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
159
|
+
Button,
|
|
160
|
+
{
|
|
161
|
+
type: "button",
|
|
162
|
+
title: btnSuccess,
|
|
163
|
+
onClick: onAction,
|
|
164
|
+
loading,
|
|
165
|
+
disabled: disabledBtnSuccess
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
] })
|
|
169
|
+
] }) }) }),
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "opacity-40 fixed inset-0 z-50 bg-black" })
|
|
171
|
+
] }) : null });
|
|
172
|
+
}
|
|
173
|
+
|
|
99
174
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
100
|
-
var
|
|
175
|
+
var import_react8 = require("react");
|
|
101
176
|
|
|
102
177
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
103
|
-
var
|
|
178
|
+
var import_react6 = require("react");
|
|
104
179
|
var import_react_query = require("@tanstack/react-query");
|
|
105
180
|
|
|
106
181
|
// src/primereact-compat.ts
|
|
@@ -112,13 +187,13 @@ var import_calendar = require("primereact/calendar");
|
|
|
112
187
|
var import_api = require("primereact/api");
|
|
113
188
|
|
|
114
189
|
// src/components/DataTableAdvancedFilter/TableHeader.tsx
|
|
115
|
-
var
|
|
190
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
116
191
|
var TableHeader = ({
|
|
117
192
|
globalFilterValue,
|
|
118
193
|
onGlobalFilterChange,
|
|
119
194
|
isLanguagePtBr
|
|
120
195
|
}) => {
|
|
121
|
-
return /* @__PURE__ */ (0,
|
|
196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
122
197
|
import_inputtext.InputText,
|
|
123
198
|
{
|
|
124
199
|
value: globalFilterValue,
|
|
@@ -131,10 +206,10 @@ var TableHeader = ({
|
|
|
131
206
|
var TableHeader_default = TableHeader;
|
|
132
207
|
|
|
133
208
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
134
|
-
var
|
|
209
|
+
var import_react7 = require("@phosphor-icons/react");
|
|
135
210
|
|
|
136
211
|
// src/components/DataTableAdvancedFilter/TableActions.tsx
|
|
137
|
-
var
|
|
212
|
+
var import_react3 = require("@phosphor-icons/react");
|
|
138
213
|
|
|
139
214
|
// src/utils/utils.ts
|
|
140
215
|
var import_clsx = require("clsx");
|
|
@@ -153,9 +228,9 @@ function centsToReal(value) {
|
|
|
153
228
|
|
|
154
229
|
// src/components/TooltipCustom.tsx
|
|
155
230
|
var import_react_tooltip = require("react-tooltip");
|
|
156
|
-
var
|
|
231
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
157
232
|
function TooltipCustom({ label, id }) {
|
|
158
|
-
return /* @__PURE__ */ (0,
|
|
233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
159
234
|
import_react_tooltip.Tooltip,
|
|
160
235
|
{
|
|
161
236
|
className: "tooltip-icone",
|
|
@@ -166,13 +241,13 @@ function TooltipCustom({ label, id }) {
|
|
|
166
241
|
zIndex: 9999
|
|
167
242
|
},
|
|
168
243
|
positionStrategy: "fixed",
|
|
169
|
-
children: /* @__PURE__ */ (0,
|
|
244
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "tooltip-custom", children: label })
|
|
170
245
|
}
|
|
171
246
|
);
|
|
172
247
|
}
|
|
173
248
|
|
|
174
249
|
// src/components/DataTableAdvancedFilter/TableActions.tsx
|
|
175
|
-
var
|
|
250
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
176
251
|
function TableActions({
|
|
177
252
|
onNew,
|
|
178
253
|
onEdit,
|
|
@@ -184,9 +259,9 @@ function TableActions({
|
|
|
184
259
|
const disableButtonsNotMultiplesSelecteds = selectedRows?.length !== 1 ? true : false;
|
|
185
260
|
const enableButtonsNotMultiplesSelecteds = selectedRows?.length > 0 ? true : false;
|
|
186
261
|
const resolvedCustomActions = typeof customActions === "function" ? customActions(selectedRows) : customActions;
|
|
187
|
-
return /* @__PURE__ */ (0,
|
|
188
|
-
onNew && /* @__PURE__ */ (0,
|
|
189
|
-
/* @__PURE__ */ (0,
|
|
262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "box-icones-table-actions", children: [
|
|
263
|
+
onNew && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
264
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
190
265
|
"button",
|
|
191
266
|
{
|
|
192
267
|
id: "add",
|
|
@@ -196,10 +271,10 @@ function TableActions({
|
|
|
196
271
|
enableButtonsNotMultiplesSelecteds && "disable-button-table-actions"
|
|
197
272
|
),
|
|
198
273
|
disabled: enableButtonsNotMultiplesSelecteds,
|
|
199
|
-
children: /* @__PURE__ */ (0,
|
|
274
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react3.Plus, { size: 18 })
|
|
200
275
|
}
|
|
201
276
|
),
|
|
202
|
-
/* @__PURE__ */ (0,
|
|
277
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
203
278
|
TooltipCustom,
|
|
204
279
|
{
|
|
205
280
|
id: "add",
|
|
@@ -207,7 +282,7 @@ function TableActions({
|
|
|
207
282
|
}
|
|
208
283
|
)
|
|
209
284
|
] }),
|
|
210
|
-
onEdit && /* @__PURE__ */ (0,
|
|
285
|
+
onEdit && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
211
286
|
"button",
|
|
212
287
|
{
|
|
213
288
|
id: "edit",
|
|
@@ -218,8 +293,8 @@ function TableActions({
|
|
|
218
293
|
),
|
|
219
294
|
disabled: disableButtonsNotMultiplesSelecteds,
|
|
220
295
|
children: [
|
|
221
|
-
/* @__PURE__ */ (0,
|
|
222
|
-
/* @__PURE__ */ (0,
|
|
296
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react3.PencilSimple, { size: 18 }),
|
|
297
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
223
298
|
TooltipCustom,
|
|
224
299
|
{
|
|
225
300
|
id: "edit",
|
|
@@ -229,7 +304,7 @@ function TableActions({
|
|
|
229
304
|
]
|
|
230
305
|
}
|
|
231
306
|
) }),
|
|
232
|
-
onDelete && /* @__PURE__ */ (0,
|
|
307
|
+
onDelete && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
233
308
|
"button",
|
|
234
309
|
{
|
|
235
310
|
id: "delete",
|
|
@@ -240,8 +315,8 @@ function TableActions({
|
|
|
240
315
|
),
|
|
241
316
|
disabled: !enableButtonsNotMultiplesSelecteds,
|
|
242
317
|
children: [
|
|
243
|
-
/* @__PURE__ */ (0,
|
|
244
|
-
/* @__PURE__ */ (0,
|
|
318
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react3.Trash, { size: 18 }),
|
|
319
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
245
320
|
TooltipCustom,
|
|
246
321
|
{
|
|
247
322
|
id: "delete",
|
|
@@ -253,7 +328,7 @@ function TableActions({
|
|
|
253
328
|
) }),
|
|
254
329
|
resolvedCustomActions?.map((action) => {
|
|
255
330
|
const id = `action-table${phraseToId(action.label)}`;
|
|
256
|
-
return /* @__PURE__ */ (0,
|
|
331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
257
332
|
"button",
|
|
258
333
|
{
|
|
259
334
|
id,
|
|
@@ -261,7 +336,7 @@ function TableActions({
|
|
|
261
336
|
className: cn("enable-button-table-actions", action.className),
|
|
262
337
|
children: [
|
|
263
338
|
action.icon,
|
|
264
|
-
/* @__PURE__ */ (0,
|
|
339
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TooltipCustom, { id, label: action.label })
|
|
265
340
|
]
|
|
266
341
|
},
|
|
267
342
|
id
|
|
@@ -271,8 +346,8 @@ function TableActions({
|
|
|
271
346
|
}
|
|
272
347
|
|
|
273
348
|
// src/components/DataTableAdvancedFilter/ActionsColumn.tsx
|
|
274
|
-
var
|
|
275
|
-
var
|
|
349
|
+
var import_react4 = require("@phosphor-icons/react");
|
|
350
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
276
351
|
function ActionsColumn({
|
|
277
352
|
row,
|
|
278
353
|
onEdit,
|
|
@@ -281,8 +356,8 @@ function ActionsColumn({
|
|
|
281
356
|
isLanguagePtBr
|
|
282
357
|
}) {
|
|
283
358
|
const resolvedCustomActions = typeof customActionsColums === "function" ? customActionsColums(row) : customActionsColums;
|
|
284
|
-
return /* @__PURE__ */ (0,
|
|
285
|
-
onEdit && /* @__PURE__ */ (0,
|
|
359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "box-icones-actions-column", children: [
|
|
360
|
+
onEdit && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
286
361
|
"button",
|
|
287
362
|
{
|
|
288
363
|
id: "edit-column",
|
|
@@ -291,8 +366,8 @@ function ActionsColumn({
|
|
|
291
366
|
onEdit && onEdit([row]);
|
|
292
367
|
},
|
|
293
368
|
children: [
|
|
294
|
-
/* @__PURE__ */ (0,
|
|
295
|
-
/* @__PURE__ */ (0,
|
|
369
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react4.PencilSimple, { size: 17, weight: "regular" }),
|
|
370
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
296
371
|
TooltipCustom,
|
|
297
372
|
{
|
|
298
373
|
id: "edit-column",
|
|
@@ -302,7 +377,7 @@ function ActionsColumn({
|
|
|
302
377
|
]
|
|
303
378
|
}
|
|
304
379
|
) }),
|
|
305
|
-
onDelete && /* @__PURE__ */ (0,
|
|
380
|
+
onDelete && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
306
381
|
"button",
|
|
307
382
|
{
|
|
308
383
|
id: "delete-column",
|
|
@@ -311,8 +386,8 @@ function ActionsColumn({
|
|
|
311
386
|
onDelete && onDelete([row]);
|
|
312
387
|
},
|
|
313
388
|
children: [
|
|
314
|
-
/* @__PURE__ */ (0,
|
|
315
|
-
/* @__PURE__ */ (0,
|
|
389
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react4.Trash, { size: 17, weight: "regular" }),
|
|
390
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
316
391
|
TooltipCustom,
|
|
317
392
|
{
|
|
318
393
|
id: "delete-column",
|
|
@@ -324,7 +399,7 @@ function ActionsColumn({
|
|
|
324
399
|
) }),
|
|
325
400
|
resolvedCustomActions?.map((action) => {
|
|
326
401
|
const id = `action-colunm-${phraseToId(action.label)}`;
|
|
327
|
-
return /* @__PURE__ */ (0,
|
|
402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
328
403
|
"button",
|
|
329
404
|
{
|
|
330
405
|
id,
|
|
@@ -332,7 +407,7 @@ function ActionsColumn({
|
|
|
332
407
|
className: cn("btn-icone-actions-column", action.className),
|
|
333
408
|
children: [
|
|
334
409
|
action.icon,
|
|
335
|
-
/* @__PURE__ */ (0,
|
|
410
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipCustom, { id, label: action.label })
|
|
336
411
|
]
|
|
337
412
|
},
|
|
338
413
|
id
|
|
@@ -342,7 +417,7 @@ function ActionsColumn({
|
|
|
342
417
|
}
|
|
343
418
|
|
|
344
419
|
// src/components/DataTableAdvancedFilter/DynamicColumns.tsx
|
|
345
|
-
var
|
|
420
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
346
421
|
function DynamicColumns({
|
|
347
422
|
columns,
|
|
348
423
|
isMultiSelectionMode = true,
|
|
@@ -354,7 +429,7 @@ function DynamicColumns({
|
|
|
354
429
|
const array = [];
|
|
355
430
|
if (isMultiSelectionMode) {
|
|
356
431
|
array.push(
|
|
357
|
-
/* @__PURE__ */ (0,
|
|
432
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
358
433
|
import_column.Column,
|
|
359
434
|
{
|
|
360
435
|
selectionMode: "multiple",
|
|
@@ -371,7 +446,7 @@ function DynamicColumns({
|
|
|
371
446
|
const width = isActionsCol && col?.size ? col.size + "rem" : "6rem";
|
|
372
447
|
const placeholder = isLanguagePtBr ? "Procurar" : "Search";
|
|
373
448
|
array.push(
|
|
374
|
-
/* @__PURE__ */ (0,
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
375
450
|
import_column.Column,
|
|
376
451
|
{
|
|
377
452
|
field: isActionsCol ? void 0 : col.field,
|
|
@@ -387,7 +462,7 @@ function DynamicColumns({
|
|
|
387
462
|
resizeable: col.enableResizeable ?? true
|
|
388
463
|
},
|
|
389
464
|
style: isActionsCol ? { width, minWidth: width, position: "relative" } : {},
|
|
390
|
-
body: (rowData) => isActionsCol ? /* @__PURE__ */ (0,
|
|
465
|
+
body: (rowData) => isActionsCol ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
391
466
|
ActionsColumn,
|
|
392
467
|
{
|
|
393
468
|
row: rowData,
|
|
@@ -396,7 +471,7 @@ function DynamicColumns({
|
|
|
396
471
|
customActionsColums,
|
|
397
472
|
isLanguagePtBr
|
|
398
473
|
}
|
|
399
|
-
) : col.body ? col.body(rowData) : /* @__PURE__ */ (0,
|
|
474
|
+
) : col.body ? col.body(rowData) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: String(rowData[col.field]) }),
|
|
400
475
|
sortable: !isActionsCol ? col.enableSorting ?? true : false
|
|
401
476
|
},
|
|
402
477
|
`${String(col.field)}-${idx}`
|
|
@@ -421,10 +496,10 @@ var getUrlParams = (sortFieldInitial, sortOrderInitial) => {
|
|
|
421
496
|
};
|
|
422
497
|
|
|
423
498
|
// src/hooks/use-debounce.ts
|
|
424
|
-
var
|
|
499
|
+
var import_react5 = require("react");
|
|
425
500
|
var useDebounce = (value, delay) => {
|
|
426
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
427
|
-
(0,
|
|
501
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react5.useState)(value);
|
|
502
|
+
(0, import_react5.useEffect)(() => {
|
|
428
503
|
const timer = setTimeout(() => {
|
|
429
504
|
setDebouncedValue(value);
|
|
430
505
|
}, delay || 500);
|
|
@@ -436,7 +511,7 @@ var useDebounce = (value, delay) => {
|
|
|
436
511
|
};
|
|
437
512
|
|
|
438
513
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
439
|
-
var
|
|
514
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
440
515
|
function DataTableAdvancedFilterWrapper({
|
|
441
516
|
queryKey,
|
|
442
517
|
mutationFn,
|
|
@@ -451,10 +526,11 @@ function DataTableAdvancedFilterWrapper({
|
|
|
451
526
|
sortFieldInitial,
|
|
452
527
|
sortOrderInitial = 1,
|
|
453
528
|
isMultiSelectionMode = true,
|
|
454
|
-
isLanguagePtBr = true
|
|
529
|
+
isLanguagePtBr = true,
|
|
530
|
+
replaceUrl = true
|
|
455
531
|
}) {
|
|
456
|
-
const [isClient, setIsClient] = (0,
|
|
457
|
-
(0,
|
|
532
|
+
const [isClient, setIsClient] = (0, import_react6.useState)(false);
|
|
533
|
+
(0, import_react6.useEffect)(() => {
|
|
458
534
|
setIsClient(true);
|
|
459
535
|
}, []);
|
|
460
536
|
const {
|
|
@@ -464,26 +540,26 @@ function DataTableAdvancedFilterWrapper({
|
|
|
464
540
|
sortOrder: urlSortOrder,
|
|
465
541
|
filter: urlFilter
|
|
466
542
|
} = getUrlParams(sortFieldInitial, sortOrderInitial);
|
|
467
|
-
const [page, setPage] = (0,
|
|
468
|
-
const [rows, setRows] = (0,
|
|
469
|
-
const [first, setFirst] = (0,
|
|
470
|
-
const [sortField, setSortField] = (0,
|
|
471
|
-
const [sortOrder, setSortOrder] = (0,
|
|
472
|
-
const [searchText, setSearchText] = (0,
|
|
473
|
-
const [filters, setFilters] = (0,
|
|
543
|
+
const [page, setPage] = (0, import_react6.useState)(urlPage);
|
|
544
|
+
const [rows, setRows] = (0, import_react6.useState)(urlRows);
|
|
545
|
+
const [first, setFirst] = (0, import_react6.useState)((urlPage - 1) * urlRows);
|
|
546
|
+
const [sortField, setSortField] = (0, import_react6.useState)(urlSortField);
|
|
547
|
+
const [sortOrder, setSortOrder] = (0, import_react6.useState)(urlSortOrder);
|
|
548
|
+
const [searchText, setSearchText] = (0, import_react6.useState)(urlFilter);
|
|
549
|
+
const [filters, setFilters] = (0, import_react6.useState)({
|
|
474
550
|
...initFilters,
|
|
475
551
|
global: { value: urlFilter, matchMode: "contains" }
|
|
476
552
|
});
|
|
477
|
-
const [selectedRowsData, setSelectedRowsData] = (0,
|
|
553
|
+
const [selectedRowsData, setSelectedRowsData] = (0, import_react6.useState)([]);
|
|
478
554
|
const debouncedSearch = useDebounce(searchText, 500);
|
|
479
|
-
const debouncedFilters = (0,
|
|
555
|
+
const debouncedFilters = (0, import_react6.useMemo)(() => {
|
|
480
556
|
const f = { ...filters };
|
|
481
557
|
if (!f.global) f.global = { value: "", matchMode: "contains" };
|
|
482
558
|
f.global.value = debouncedSearch;
|
|
483
559
|
return f;
|
|
484
560
|
}, [filters, debouncedSearch]);
|
|
485
561
|
const filtersKey = JSON.stringify(debouncedFilters);
|
|
486
|
-
const globalFilterFields = (0,
|
|
562
|
+
const globalFilterFields = (0, import_react6.useMemo)(() => {
|
|
487
563
|
return columns?.filter(
|
|
488
564
|
(col) => col.filterGlobal === true && (col.field !== "acoes" || col.field !== "actions")
|
|
489
565
|
).map((col) => col.field) ?? [];
|
|
@@ -500,7 +576,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
500
576
|
)
|
|
501
577
|
});
|
|
502
578
|
const updateUrlParams = (params) => {
|
|
503
|
-
if (typeof window === "undefined") return;
|
|
579
|
+
if (typeof window === "undefined" || !replaceUrl) return;
|
|
504
580
|
const urlParams = new URLSearchParams(window.location.search);
|
|
505
581
|
Object.entries(params).forEach(([key, value]) => {
|
|
506
582
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -540,10 +616,10 @@ function DataTableAdvancedFilterWrapper({
|
|
|
540
616
|
setSortOrder(e.sortOrder);
|
|
541
617
|
updateUrlParams({ sortField: e.sortField, sortOrder: e.sortOrder });
|
|
542
618
|
};
|
|
543
|
-
(0,
|
|
619
|
+
(0, import_react6.useEffect)(() => {
|
|
544
620
|
updateUrlParams({ page: 1, filter: debouncedSearch });
|
|
545
621
|
}, [debouncedSearch]);
|
|
546
|
-
(0,
|
|
622
|
+
(0, import_react6.useEffect)(() => {
|
|
547
623
|
if (customers?.items && selectedRowsData.length > 0) {
|
|
548
624
|
const currentIds = new Set(customers.items.map((item) => item.id));
|
|
549
625
|
const filteredSelection = selectedRowsData.filter(
|
|
@@ -554,9 +630,9 @@ function DataTableAdvancedFilterWrapper({
|
|
|
554
630
|
}
|
|
555
631
|
}
|
|
556
632
|
}, [customers?.items, selectedRowsData]);
|
|
557
|
-
const TableHeaderAndTableActions = (0,
|
|
558
|
-
() => /* @__PURE__ */ (0,
|
|
559
|
-
globalFilterFields.length > 0 && /* @__PURE__ */ (0,
|
|
633
|
+
const TableHeaderAndTableActions = (0, import_react6.useMemo)(
|
|
634
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
635
|
+
globalFilterFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
560
636
|
TableHeader_default,
|
|
561
637
|
{
|
|
562
638
|
isLanguagePtBr,
|
|
@@ -564,7 +640,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
564
640
|
onGlobalFilterChange
|
|
565
641
|
}
|
|
566
642
|
),
|
|
567
|
-
/* @__PURE__ */ (0,
|
|
643
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
568
644
|
TableActions,
|
|
569
645
|
{
|
|
570
646
|
selectedRows: selectedRowsData,
|
|
@@ -587,9 +663,9 @@ function DataTableAdvancedFilterWrapper({
|
|
|
587
663
|
customActions
|
|
588
664
|
]
|
|
589
665
|
);
|
|
590
|
-
return /* @__PURE__ */ (0,
|
|
591
|
-
disablePagination && /* @__PURE__ */ (0,
|
|
592
|
-
/* @__PURE__ */ (0,
|
|
666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: isClient && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
667
|
+
disablePagination && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "disablePagination", children: TableHeaderAndTableActions }),
|
|
668
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
593
669
|
import_datatable.DataTable,
|
|
594
670
|
{
|
|
595
671
|
value: customers?.items ?? [],
|
|
@@ -615,7 +691,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
615
691
|
sortOrder,
|
|
616
692
|
paginatorTemplate: {
|
|
617
693
|
layout: "RowsPerPageDropdown PrevPageLink CurrentPageReport NextPageLink",
|
|
618
|
-
RowsPerPageDropdown: (options) => /* @__PURE__ */ (0,
|
|
694
|
+
RowsPerPageDropdown: (options) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
619
695
|
"select",
|
|
620
696
|
{
|
|
621
697
|
value: options.value,
|
|
@@ -624,19 +700,19 @@ function DataTableAdvancedFilterWrapper({
|
|
|
624
700
|
value: Number(e.target.value)
|
|
625
701
|
}),
|
|
626
702
|
className: "custom-input custom-select",
|
|
627
|
-
children: options.options.map((opt) => /* @__PURE__ */ (0,
|
|
703
|
+
children: options.options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
628
704
|
}
|
|
629
705
|
),
|
|
630
|
-
PrevPageLink: (options) => /* @__PURE__ */ (0,
|
|
706
|
+
PrevPageLink: (options) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
631
707
|
"button",
|
|
632
708
|
{
|
|
633
709
|
onClick: options.onClick,
|
|
634
710
|
disabled: options.disabled,
|
|
635
711
|
className: `PrevPage ${options.disabled ? "PrevPageDisabled" : "PrevPageEnabled"}`,
|
|
636
|
-
children: /* @__PURE__ */ (0,
|
|
712
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react7.CaretLeft, { size: 18, color: "#fff" })
|
|
637
713
|
}
|
|
638
714
|
),
|
|
639
|
-
CurrentPageReport: (options) => /* @__PURE__ */ (0,
|
|
715
|
+
CurrentPageReport: (options) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "pageReport", children: [
|
|
640
716
|
isLanguagePtBr ? "Mostrando" : "Showing",
|
|
641
717
|
" ",
|
|
642
718
|
options.first,
|
|
@@ -649,20 +725,20 @@ function DataTableAdvancedFilterWrapper({
|
|
|
649
725
|
" ",
|
|
650
726
|
options.totalRecords
|
|
651
727
|
] }),
|
|
652
|
-
NextPageLink: (options) => /* @__PURE__ */ (0,
|
|
728
|
+
NextPageLink: (options) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
653
729
|
"button",
|
|
654
730
|
{
|
|
655
731
|
onClick: options.onClick,
|
|
656
732
|
disabled: options.disabled,
|
|
657
733
|
className: `NextPage ${options.disabled ? "NextPageDisabled" : "NextPageEnabled"}`,
|
|
658
|
-
children: /* @__PURE__ */ (0,
|
|
734
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react7.CaretRight, { size: 18, color: "#fff" })
|
|
659
735
|
}
|
|
660
736
|
)
|
|
661
737
|
},
|
|
662
738
|
paginatorPosition: "top",
|
|
663
|
-
paginatorLeft: /* @__PURE__ */ (0,
|
|
739
|
+
paginatorLeft: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "paginatorLeft", children: TableHeaderAndTableActions }),
|
|
664
740
|
currentPageReportTemplate: "Mostrando {first} a {last} de {totalRecords}",
|
|
665
|
-
emptyMessage: /* @__PURE__ */ (0,
|
|
741
|
+
emptyMessage: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mensagem-nenhum-dado", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: isLanguagePtBr ? "Nenhum dado encontrado" : "No data found" }) }),
|
|
666
742
|
onFilter: (e) => setFilters(e.filters),
|
|
667
743
|
rowsPerPageOptions: [10, 25, 50, 100],
|
|
668
744
|
className: "p-datatable-sm",
|
|
@@ -840,7 +916,7 @@ var localePtBr = {
|
|
|
840
916
|
};
|
|
841
917
|
|
|
842
918
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
843
|
-
var
|
|
919
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
844
920
|
function DataTableAdvancedFilter({
|
|
845
921
|
queryKey,
|
|
846
922
|
mutationFn,
|
|
@@ -855,23 +931,24 @@ function DataTableAdvancedFilter({
|
|
|
855
931
|
sortFieldInitial,
|
|
856
932
|
sortOrderInitial = 1,
|
|
857
933
|
isMultiSelectionMode = true,
|
|
858
|
-
isLanguagePtBr = true
|
|
934
|
+
isLanguagePtBr = true,
|
|
935
|
+
replaceUrl = true
|
|
859
936
|
}) {
|
|
860
|
-
const [isClient, setIsClient] = (0,
|
|
861
|
-
(0,
|
|
937
|
+
const [isClient, setIsClient] = (0, import_react8.useState)(false);
|
|
938
|
+
(0, import_react8.useEffect)(() => {
|
|
862
939
|
(0, import_api2.addLocale)("pt", localePtBr);
|
|
863
940
|
}, []);
|
|
864
|
-
(0,
|
|
941
|
+
(0, import_react8.useEffect)(() => {
|
|
865
942
|
(0, import_api2.locale)(isLanguagePtBr ? "pt" : "en");
|
|
866
943
|
}, [isLanguagePtBr]);
|
|
867
|
-
(0,
|
|
944
|
+
(0, import_react8.useEffect)(() => {
|
|
868
945
|
setIsClient(true);
|
|
869
946
|
}, []);
|
|
870
|
-
return /* @__PURE__ */ (0,
|
|
947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: isClient && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
871
948
|
import_api2.PrimeReactProvider,
|
|
872
949
|
{
|
|
873
950
|
value: isLanguagePtBr ? { locale: "pt" } : { locale: "en" },
|
|
874
|
-
children: /* @__PURE__ */ (0,
|
|
951
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
875
952
|
DataTableAdvancedFilterWrapper,
|
|
876
953
|
{
|
|
877
954
|
queryKey,
|
|
@@ -887,7 +964,8 @@ function DataTableAdvancedFilter({
|
|
|
887
964
|
sortFieldInitial,
|
|
888
965
|
sortOrderInitial,
|
|
889
966
|
isMultiSelectionMode,
|
|
890
|
-
isLanguagePtBr
|
|
967
|
+
isLanguagePtBr,
|
|
968
|
+
replaceUrl
|
|
891
969
|
}
|
|
892
970
|
)
|
|
893
971
|
}
|
|
@@ -896,10 +974,10 @@ function DataTableAdvancedFilter({
|
|
|
896
974
|
|
|
897
975
|
// src/components/DataTableAdvancedFilter/FilterTemplates.tsx
|
|
898
976
|
var import_react_select = __toESM(require("react-select"));
|
|
899
|
-
var
|
|
977
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
900
978
|
var DateFilterTemplate = (options, mask) => {
|
|
901
979
|
const parsedValue = options.value && typeof options.value === "string" ? /* @__PURE__ */ new Date(options.value + "T00:00:00") : options.value;
|
|
902
|
-
return /* @__PURE__ */ (0,
|
|
980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
903
981
|
import_calendar.Calendar,
|
|
904
982
|
{
|
|
905
983
|
value: parsedValue,
|
|
@@ -924,7 +1002,7 @@ var DateFilterTemplate = (options, mask) => {
|
|
|
924
1002
|
};
|
|
925
1003
|
var DateTimeFilterTemplate = (options, mask) => {
|
|
926
1004
|
const parsedValue = options.value && typeof options.value === "string" ? new Date(options.value) : options.value;
|
|
927
|
-
return /* @__PURE__ */ (0,
|
|
1005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
928
1006
|
import_calendar.Calendar,
|
|
929
1007
|
{
|
|
930
1008
|
value: parsedValue,
|
|
@@ -954,7 +1032,7 @@ var ValueFilterTemplate = (options, mask) => {
|
|
|
954
1032
|
const valueToFilter = mask ? mask(rawValue) : rawValue;
|
|
955
1033
|
options.filterCallback(valueToFilter, options.index);
|
|
956
1034
|
};
|
|
957
|
-
return /* @__PURE__ */ (0,
|
|
1035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
958
1036
|
import_inputnumber.InputNumber,
|
|
959
1037
|
{
|
|
960
1038
|
value: parsedValue,
|
|
@@ -973,7 +1051,7 @@ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
|
|
|
973
1051
|
{ label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
|
|
974
1052
|
];
|
|
975
1053
|
const currentValue = selectOptions.find((opt) => opt.value === options.value) || selectOptions[0];
|
|
976
|
-
return /* @__PURE__ */ (0,
|
|
1054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
977
1055
|
import_react_select.default,
|
|
978
1056
|
{
|
|
979
1057
|
options: selectOptions,
|
|
@@ -1088,6 +1166,7 @@ var import_api4 = require("primereact/api");
|
|
|
1088
1166
|
DateTimeFilterTemplate,
|
|
1089
1167
|
FilterMatchMode,
|
|
1090
1168
|
FilterOperator,
|
|
1169
|
+
ModalBase,
|
|
1091
1170
|
SelectFilterTemplate,
|
|
1092
1171
|
ValueFilterTemplate,
|
|
1093
1172
|
getDefaultFilterMatchOptionsDate,
|
package/dist/index.mjs
CHANGED
|
@@ -51,11 +51,85 @@ function Button({
|
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
// src/components/ModalBase/ModalBase.tsx
|
|
55
|
+
import { X } from "@phosphor-icons/react";
|
|
56
|
+
|
|
57
|
+
// src/components/ModalBase/FooterButtons.tsx
|
|
58
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
59
|
+
function FooterButtons({ children }) {
|
|
60
|
+
return /* @__PURE__ */ jsx2("div", { className: "sm:flex pt-8 justify-end text-right sm:space-x-6 space-x-0 sm:space-y-0 space-y-4 p-6", children });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/components/ModalBase/ModalBase.tsx
|
|
64
|
+
import { useEffect } from "react";
|
|
65
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
66
|
+
function ModalBase({
|
|
67
|
+
show,
|
|
68
|
+
onHide,
|
|
69
|
+
onAction,
|
|
70
|
+
title,
|
|
71
|
+
children,
|
|
72
|
+
loading,
|
|
73
|
+
btnCancel = "Cancel",
|
|
74
|
+
btnSuccess = "Save",
|
|
75
|
+
disabledBtnSuccess
|
|
76
|
+
}) {
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
const handleKeyDown = (event) => {
|
|
79
|
+
if (event.key === "Escape") {
|
|
80
|
+
onHide();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
84
|
+
return () => {
|
|
85
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
86
|
+
};
|
|
87
|
+
}, [onHide]);
|
|
88
|
+
return /* @__PURE__ */ jsx3(Fragment, { children: show ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
89
|
+
/* @__PURE__ */ jsx3("div", { className: "justify-center items-start pt-11 overflow-x-hidden overflow-y-auto fixed inset-0 z-[60] outline-none focus:outline-none", children: /* @__PURE__ */ jsx3("div", { className: "relative w-auto my-6 mx-auto max-w-xl", children: /* @__PURE__ */ jsxs2("div", { className: "border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-theme-dark outline-none focus:outline-none", children: [
|
|
90
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-start justify-between p-2", children: [
|
|
91
|
+
/* @__PURE__ */ jsx3("h3", { className: "text-lg text-center absolute top-6 left-1/2 transform -translate-x-1/2 -translate-y-1/2 font-SegoeUIVF font-bold text-light-dark-100", children: title }),
|
|
92
|
+
/* @__PURE__ */ jsx3(
|
|
93
|
+
"button",
|
|
94
|
+
{
|
|
95
|
+
className: "p-1 ml-auto mr-1 cursor-pointer",
|
|
96
|
+
onClick: onHide,
|
|
97
|
+
children: /* @__PURE__ */ jsx3(X, { size: 18, color: "#ffffff" })
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] }),
|
|
101
|
+
/* @__PURE__ */ jsx3("div", { className: "w-full p-6", children }),
|
|
102
|
+
/* @__PURE__ */ jsxs2(FooterButtons, { children: [
|
|
103
|
+
/* @__PURE__ */ jsx3(
|
|
104
|
+
Button,
|
|
105
|
+
{
|
|
106
|
+
color: "danger",
|
|
107
|
+
title: btnCancel,
|
|
108
|
+
type: "button",
|
|
109
|
+
onClick: onHide
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsx3(
|
|
113
|
+
Button,
|
|
114
|
+
{
|
|
115
|
+
type: "button",
|
|
116
|
+
title: btnSuccess,
|
|
117
|
+
onClick: onAction,
|
|
118
|
+
loading,
|
|
119
|
+
disabled: disabledBtnSuccess
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] })
|
|
123
|
+
] }) }) }),
|
|
124
|
+
/* @__PURE__ */ jsx3("div", { className: "opacity-40 fixed inset-0 z-50 bg-black" })
|
|
125
|
+
] }) : null });
|
|
126
|
+
}
|
|
127
|
+
|
|
54
128
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
55
|
-
import { useEffect as
|
|
129
|
+
import { useEffect as useEffect4, useState as useState3 } from "react";
|
|
56
130
|
|
|
57
131
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
58
|
-
import { useEffect as
|
|
132
|
+
import { useEffect as useEffect3, useMemo, useState as useState2 } from "react";
|
|
59
133
|
import { useQuery } from "@tanstack/react-query";
|
|
60
134
|
|
|
61
135
|
// src/primereact-compat.ts
|
|
@@ -67,13 +141,13 @@ import { Calendar } from "primereact/calendar";
|
|
|
67
141
|
import { FilterMatchMode } from "primereact/api";
|
|
68
142
|
|
|
69
143
|
// src/components/DataTableAdvancedFilter/TableHeader.tsx
|
|
70
|
-
import { jsx as
|
|
144
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
71
145
|
var TableHeader = ({
|
|
72
146
|
globalFilterValue,
|
|
73
147
|
onGlobalFilterChange,
|
|
74
148
|
isLanguagePtBr
|
|
75
149
|
}) => {
|
|
76
|
-
return /* @__PURE__ */
|
|
150
|
+
return /* @__PURE__ */ jsx4(
|
|
77
151
|
InputText,
|
|
78
152
|
{
|
|
79
153
|
value: globalFilterValue,
|
|
@@ -108,9 +182,9 @@ function centsToReal(value) {
|
|
|
108
182
|
|
|
109
183
|
// src/components/TooltipCustom.tsx
|
|
110
184
|
import { Tooltip } from "react-tooltip";
|
|
111
|
-
import { jsx as
|
|
185
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
112
186
|
function TooltipCustom({ label, id }) {
|
|
113
|
-
return /* @__PURE__ */
|
|
187
|
+
return /* @__PURE__ */ jsx5(
|
|
114
188
|
Tooltip,
|
|
115
189
|
{
|
|
116
190
|
className: "tooltip-icone",
|
|
@@ -121,13 +195,13 @@ function TooltipCustom({ label, id }) {
|
|
|
121
195
|
zIndex: 9999
|
|
122
196
|
},
|
|
123
197
|
positionStrategy: "fixed",
|
|
124
|
-
children: /* @__PURE__ */
|
|
198
|
+
children: /* @__PURE__ */ jsx5("div", { className: "tooltip-custom", children: label })
|
|
125
199
|
}
|
|
126
200
|
);
|
|
127
201
|
}
|
|
128
202
|
|
|
129
203
|
// src/components/DataTableAdvancedFilter/TableActions.tsx
|
|
130
|
-
import { Fragment, jsx as
|
|
204
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
131
205
|
function TableActions({
|
|
132
206
|
onNew,
|
|
133
207
|
onEdit,
|
|
@@ -139,9 +213,9 @@ function TableActions({
|
|
|
139
213
|
const disableButtonsNotMultiplesSelecteds = selectedRows?.length !== 1 ? true : false;
|
|
140
214
|
const enableButtonsNotMultiplesSelecteds = selectedRows?.length > 0 ? true : false;
|
|
141
215
|
const resolvedCustomActions = typeof customActions === "function" ? customActions(selectedRows) : customActions;
|
|
142
|
-
return /* @__PURE__ */
|
|
143
|
-
onNew && /* @__PURE__ */
|
|
144
|
-
/* @__PURE__ */
|
|
216
|
+
return /* @__PURE__ */ jsxs3("div", { className: "box-icones-table-actions", children: [
|
|
217
|
+
onNew && /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
218
|
+
/* @__PURE__ */ jsx6(
|
|
145
219
|
"button",
|
|
146
220
|
{
|
|
147
221
|
id: "add",
|
|
@@ -151,10 +225,10 @@ function TableActions({
|
|
|
151
225
|
enableButtonsNotMultiplesSelecteds && "disable-button-table-actions"
|
|
152
226
|
),
|
|
153
227
|
disabled: enableButtonsNotMultiplesSelecteds,
|
|
154
|
-
children: /* @__PURE__ */
|
|
228
|
+
children: /* @__PURE__ */ jsx6(Plus, { size: 18 })
|
|
155
229
|
}
|
|
156
230
|
),
|
|
157
|
-
/* @__PURE__ */
|
|
231
|
+
/* @__PURE__ */ jsx6(
|
|
158
232
|
TooltipCustom,
|
|
159
233
|
{
|
|
160
234
|
id: "add",
|
|
@@ -162,7 +236,7 @@ function TableActions({
|
|
|
162
236
|
}
|
|
163
237
|
)
|
|
164
238
|
] }),
|
|
165
|
-
onEdit && /* @__PURE__ */
|
|
239
|
+
onEdit && /* @__PURE__ */ jsx6(Fragment2, { children: /* @__PURE__ */ jsxs3(
|
|
166
240
|
"button",
|
|
167
241
|
{
|
|
168
242
|
id: "edit",
|
|
@@ -173,8 +247,8 @@ function TableActions({
|
|
|
173
247
|
),
|
|
174
248
|
disabled: disableButtonsNotMultiplesSelecteds,
|
|
175
249
|
children: [
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ jsx6(PencilSimple, { size: 18 }),
|
|
251
|
+
/* @__PURE__ */ jsx6(
|
|
178
252
|
TooltipCustom,
|
|
179
253
|
{
|
|
180
254
|
id: "edit",
|
|
@@ -184,7 +258,7 @@ function TableActions({
|
|
|
184
258
|
]
|
|
185
259
|
}
|
|
186
260
|
) }),
|
|
187
|
-
onDelete && /* @__PURE__ */
|
|
261
|
+
onDelete && /* @__PURE__ */ jsx6(Fragment2, { children: /* @__PURE__ */ jsxs3(
|
|
188
262
|
"button",
|
|
189
263
|
{
|
|
190
264
|
id: "delete",
|
|
@@ -195,8 +269,8 @@ function TableActions({
|
|
|
195
269
|
),
|
|
196
270
|
disabled: !enableButtonsNotMultiplesSelecteds,
|
|
197
271
|
children: [
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
/* @__PURE__ */
|
|
272
|
+
/* @__PURE__ */ jsx6(Trash, { size: 18 }),
|
|
273
|
+
/* @__PURE__ */ jsx6(
|
|
200
274
|
TooltipCustom,
|
|
201
275
|
{
|
|
202
276
|
id: "delete",
|
|
@@ -208,7 +282,7 @@ function TableActions({
|
|
|
208
282
|
) }),
|
|
209
283
|
resolvedCustomActions?.map((action) => {
|
|
210
284
|
const id = `action-table${phraseToId(action.label)}`;
|
|
211
|
-
return /* @__PURE__ */
|
|
285
|
+
return /* @__PURE__ */ jsxs3(
|
|
212
286
|
"button",
|
|
213
287
|
{
|
|
214
288
|
id,
|
|
@@ -216,7 +290,7 @@ function TableActions({
|
|
|
216
290
|
className: cn("enable-button-table-actions", action.className),
|
|
217
291
|
children: [
|
|
218
292
|
action.icon,
|
|
219
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ jsx6(TooltipCustom, { id, label: action.label })
|
|
220
294
|
]
|
|
221
295
|
},
|
|
222
296
|
id
|
|
@@ -227,7 +301,7 @@ function TableActions({
|
|
|
227
301
|
|
|
228
302
|
// src/components/DataTableAdvancedFilter/ActionsColumn.tsx
|
|
229
303
|
import { PencilSimple as PencilSimple2, Trash as Trash2 } from "@phosphor-icons/react";
|
|
230
|
-
import { Fragment as
|
|
304
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
231
305
|
function ActionsColumn({
|
|
232
306
|
row,
|
|
233
307
|
onEdit,
|
|
@@ -236,8 +310,8 @@ function ActionsColumn({
|
|
|
236
310
|
isLanguagePtBr
|
|
237
311
|
}) {
|
|
238
312
|
const resolvedCustomActions = typeof customActionsColums === "function" ? customActionsColums(row) : customActionsColums;
|
|
239
|
-
return /* @__PURE__ */
|
|
240
|
-
onEdit && /* @__PURE__ */
|
|
313
|
+
return /* @__PURE__ */ jsxs4("div", { className: "box-icones-actions-column", children: [
|
|
314
|
+
onEdit && /* @__PURE__ */ jsx7(Fragment3, { children: /* @__PURE__ */ jsxs4(
|
|
241
315
|
"button",
|
|
242
316
|
{
|
|
243
317
|
id: "edit-column",
|
|
@@ -246,8 +320,8 @@ function ActionsColumn({
|
|
|
246
320
|
onEdit && onEdit([row]);
|
|
247
321
|
},
|
|
248
322
|
children: [
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
/* @__PURE__ */
|
|
323
|
+
/* @__PURE__ */ jsx7(PencilSimple2, { size: 17, weight: "regular" }),
|
|
324
|
+
/* @__PURE__ */ jsx7(
|
|
251
325
|
TooltipCustom,
|
|
252
326
|
{
|
|
253
327
|
id: "edit-column",
|
|
@@ -257,7 +331,7 @@ function ActionsColumn({
|
|
|
257
331
|
]
|
|
258
332
|
}
|
|
259
333
|
) }),
|
|
260
|
-
onDelete && /* @__PURE__ */
|
|
334
|
+
onDelete && /* @__PURE__ */ jsx7(Fragment3, { children: /* @__PURE__ */ jsxs4(
|
|
261
335
|
"button",
|
|
262
336
|
{
|
|
263
337
|
id: "delete-column",
|
|
@@ -266,8 +340,8 @@ function ActionsColumn({
|
|
|
266
340
|
onDelete && onDelete([row]);
|
|
267
341
|
},
|
|
268
342
|
children: [
|
|
269
|
-
/* @__PURE__ */
|
|
270
|
-
/* @__PURE__ */
|
|
343
|
+
/* @__PURE__ */ jsx7(Trash2, { size: 17, weight: "regular" }),
|
|
344
|
+
/* @__PURE__ */ jsx7(
|
|
271
345
|
TooltipCustom,
|
|
272
346
|
{
|
|
273
347
|
id: "delete-column",
|
|
@@ -279,7 +353,7 @@ function ActionsColumn({
|
|
|
279
353
|
) }),
|
|
280
354
|
resolvedCustomActions?.map((action) => {
|
|
281
355
|
const id = `action-colunm-${phraseToId(action.label)}`;
|
|
282
|
-
return /* @__PURE__ */
|
|
356
|
+
return /* @__PURE__ */ jsxs4(
|
|
283
357
|
"button",
|
|
284
358
|
{
|
|
285
359
|
id,
|
|
@@ -287,7 +361,7 @@ function ActionsColumn({
|
|
|
287
361
|
className: cn("btn-icone-actions-column", action.className),
|
|
288
362
|
children: [
|
|
289
363
|
action.icon,
|
|
290
|
-
/* @__PURE__ */
|
|
364
|
+
/* @__PURE__ */ jsx7(TooltipCustom, { id, label: action.label })
|
|
291
365
|
]
|
|
292
366
|
},
|
|
293
367
|
id
|
|
@@ -297,7 +371,7 @@ function ActionsColumn({
|
|
|
297
371
|
}
|
|
298
372
|
|
|
299
373
|
// src/components/DataTableAdvancedFilter/DynamicColumns.tsx
|
|
300
|
-
import { jsx as
|
|
374
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
301
375
|
function DynamicColumns({
|
|
302
376
|
columns,
|
|
303
377
|
isMultiSelectionMode = true,
|
|
@@ -309,7 +383,7 @@ function DynamicColumns({
|
|
|
309
383
|
const array = [];
|
|
310
384
|
if (isMultiSelectionMode) {
|
|
311
385
|
array.push(
|
|
312
|
-
/* @__PURE__ */
|
|
386
|
+
/* @__PURE__ */ jsx8(
|
|
313
387
|
Column,
|
|
314
388
|
{
|
|
315
389
|
selectionMode: "multiple",
|
|
@@ -326,7 +400,7 @@ function DynamicColumns({
|
|
|
326
400
|
const width = isActionsCol && col?.size ? col.size + "rem" : "6rem";
|
|
327
401
|
const placeholder = isLanguagePtBr ? "Procurar" : "Search";
|
|
328
402
|
array.push(
|
|
329
|
-
/* @__PURE__ */
|
|
403
|
+
/* @__PURE__ */ jsx8(
|
|
330
404
|
Column,
|
|
331
405
|
{
|
|
332
406
|
field: isActionsCol ? void 0 : col.field,
|
|
@@ -342,7 +416,7 @@ function DynamicColumns({
|
|
|
342
416
|
resizeable: col.enableResizeable ?? true
|
|
343
417
|
},
|
|
344
418
|
style: isActionsCol ? { width, minWidth: width, position: "relative" } : {},
|
|
345
|
-
body: (rowData) => isActionsCol ? /* @__PURE__ */
|
|
419
|
+
body: (rowData) => isActionsCol ? /* @__PURE__ */ jsx8(
|
|
346
420
|
ActionsColumn,
|
|
347
421
|
{
|
|
348
422
|
row: rowData,
|
|
@@ -351,7 +425,7 @@ function DynamicColumns({
|
|
|
351
425
|
customActionsColums,
|
|
352
426
|
isLanguagePtBr
|
|
353
427
|
}
|
|
354
|
-
) : col.body ? col.body(rowData) : /* @__PURE__ */
|
|
428
|
+
) : col.body ? col.body(rowData) : /* @__PURE__ */ jsx8("span", { children: String(rowData[col.field]) }),
|
|
355
429
|
sortable: !isActionsCol ? col.enableSorting ?? true : false
|
|
356
430
|
},
|
|
357
431
|
`${String(col.field)}-${idx}`
|
|
@@ -376,10 +450,10 @@ var getUrlParams = (sortFieldInitial, sortOrderInitial) => {
|
|
|
376
450
|
};
|
|
377
451
|
|
|
378
452
|
// src/hooks/use-debounce.ts
|
|
379
|
-
import { useEffect, useState } from "react";
|
|
453
|
+
import { useEffect as useEffect2, useState } from "react";
|
|
380
454
|
var useDebounce = (value, delay) => {
|
|
381
455
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
382
|
-
|
|
456
|
+
useEffect2(() => {
|
|
383
457
|
const timer = setTimeout(() => {
|
|
384
458
|
setDebouncedValue(value);
|
|
385
459
|
}, delay || 500);
|
|
@@ -391,7 +465,7 @@ var useDebounce = (value, delay) => {
|
|
|
391
465
|
};
|
|
392
466
|
|
|
393
467
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
394
|
-
import { Fragment as
|
|
468
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
395
469
|
function DataTableAdvancedFilterWrapper({
|
|
396
470
|
queryKey,
|
|
397
471
|
mutationFn,
|
|
@@ -406,10 +480,11 @@ function DataTableAdvancedFilterWrapper({
|
|
|
406
480
|
sortFieldInitial,
|
|
407
481
|
sortOrderInitial = 1,
|
|
408
482
|
isMultiSelectionMode = true,
|
|
409
|
-
isLanguagePtBr = true
|
|
483
|
+
isLanguagePtBr = true,
|
|
484
|
+
replaceUrl = true
|
|
410
485
|
}) {
|
|
411
486
|
const [isClient, setIsClient] = useState2(false);
|
|
412
|
-
|
|
487
|
+
useEffect3(() => {
|
|
413
488
|
setIsClient(true);
|
|
414
489
|
}, []);
|
|
415
490
|
const {
|
|
@@ -455,7 +530,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
455
530
|
)
|
|
456
531
|
});
|
|
457
532
|
const updateUrlParams = (params) => {
|
|
458
|
-
if (typeof window === "undefined") return;
|
|
533
|
+
if (typeof window === "undefined" || !replaceUrl) return;
|
|
459
534
|
const urlParams = new URLSearchParams(window.location.search);
|
|
460
535
|
Object.entries(params).forEach(([key, value]) => {
|
|
461
536
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -495,10 +570,10 @@ function DataTableAdvancedFilterWrapper({
|
|
|
495
570
|
setSortOrder(e.sortOrder);
|
|
496
571
|
updateUrlParams({ sortField: e.sortField, sortOrder: e.sortOrder });
|
|
497
572
|
};
|
|
498
|
-
|
|
573
|
+
useEffect3(() => {
|
|
499
574
|
updateUrlParams({ page: 1, filter: debouncedSearch });
|
|
500
575
|
}, [debouncedSearch]);
|
|
501
|
-
|
|
576
|
+
useEffect3(() => {
|
|
502
577
|
if (customers?.items && selectedRowsData.length > 0) {
|
|
503
578
|
const currentIds = new Set(customers.items.map((item) => item.id));
|
|
504
579
|
const filteredSelection = selectedRowsData.filter(
|
|
@@ -510,8 +585,8 @@ function DataTableAdvancedFilterWrapper({
|
|
|
510
585
|
}
|
|
511
586
|
}, [customers?.items, selectedRowsData]);
|
|
512
587
|
const TableHeaderAndTableActions = useMemo(
|
|
513
|
-
() => /* @__PURE__ */
|
|
514
|
-
globalFilterFields.length > 0 && /* @__PURE__ */
|
|
588
|
+
() => /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
589
|
+
globalFilterFields.length > 0 && /* @__PURE__ */ jsx9(
|
|
515
590
|
TableHeader_default,
|
|
516
591
|
{
|
|
517
592
|
isLanguagePtBr,
|
|
@@ -519,7 +594,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
519
594
|
onGlobalFilterChange
|
|
520
595
|
}
|
|
521
596
|
),
|
|
522
|
-
/* @__PURE__ */
|
|
597
|
+
/* @__PURE__ */ jsx9(
|
|
523
598
|
TableActions,
|
|
524
599
|
{
|
|
525
600
|
selectedRows: selectedRowsData,
|
|
@@ -542,9 +617,9 @@ function DataTableAdvancedFilterWrapper({
|
|
|
542
617
|
customActions
|
|
543
618
|
]
|
|
544
619
|
);
|
|
545
|
-
return /* @__PURE__ */
|
|
546
|
-
disablePagination && /* @__PURE__ */
|
|
547
|
-
/* @__PURE__ */
|
|
620
|
+
return /* @__PURE__ */ jsx9(Fragment4, { children: isClient && /* @__PURE__ */ jsxs5("div", { children: [
|
|
621
|
+
disablePagination && /* @__PURE__ */ jsx9("div", { className: "disablePagination", children: TableHeaderAndTableActions }),
|
|
622
|
+
/* @__PURE__ */ jsxs5(
|
|
548
623
|
DataTable,
|
|
549
624
|
{
|
|
550
625
|
value: customers?.items ?? [],
|
|
@@ -570,7 +645,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
570
645
|
sortOrder,
|
|
571
646
|
paginatorTemplate: {
|
|
572
647
|
layout: "RowsPerPageDropdown PrevPageLink CurrentPageReport NextPageLink",
|
|
573
|
-
RowsPerPageDropdown: (options) => /* @__PURE__ */
|
|
648
|
+
RowsPerPageDropdown: (options) => /* @__PURE__ */ jsx9(
|
|
574
649
|
"select",
|
|
575
650
|
{
|
|
576
651
|
value: options.value,
|
|
@@ -579,19 +654,19 @@ function DataTableAdvancedFilterWrapper({
|
|
|
579
654
|
value: Number(e.target.value)
|
|
580
655
|
}),
|
|
581
656
|
className: "custom-input custom-select",
|
|
582
|
-
children: options.options.map((opt) => /* @__PURE__ */
|
|
657
|
+
children: options.options.map((opt) => /* @__PURE__ */ jsx9("option", { value: opt.value, children: opt.label }, opt.value))
|
|
583
658
|
}
|
|
584
659
|
),
|
|
585
|
-
PrevPageLink: (options) => /* @__PURE__ */
|
|
660
|
+
PrevPageLink: (options) => /* @__PURE__ */ jsx9(
|
|
586
661
|
"button",
|
|
587
662
|
{
|
|
588
663
|
onClick: options.onClick,
|
|
589
664
|
disabled: options.disabled,
|
|
590
665
|
className: `PrevPage ${options.disabled ? "PrevPageDisabled" : "PrevPageEnabled"}`,
|
|
591
|
-
children: /* @__PURE__ */
|
|
666
|
+
children: /* @__PURE__ */ jsx9(CaretLeft, { size: 18, color: "#fff" })
|
|
592
667
|
}
|
|
593
668
|
),
|
|
594
|
-
CurrentPageReport: (options) => /* @__PURE__ */
|
|
669
|
+
CurrentPageReport: (options) => /* @__PURE__ */ jsxs5("span", { className: "pageReport", children: [
|
|
595
670
|
isLanguagePtBr ? "Mostrando" : "Showing",
|
|
596
671
|
" ",
|
|
597
672
|
options.first,
|
|
@@ -604,20 +679,20 @@ function DataTableAdvancedFilterWrapper({
|
|
|
604
679
|
" ",
|
|
605
680
|
options.totalRecords
|
|
606
681
|
] }),
|
|
607
|
-
NextPageLink: (options) => /* @__PURE__ */
|
|
682
|
+
NextPageLink: (options) => /* @__PURE__ */ jsx9(
|
|
608
683
|
"button",
|
|
609
684
|
{
|
|
610
685
|
onClick: options.onClick,
|
|
611
686
|
disabled: options.disabled,
|
|
612
687
|
className: `NextPage ${options.disabled ? "NextPageDisabled" : "NextPageEnabled"}`,
|
|
613
|
-
children: /* @__PURE__ */
|
|
688
|
+
children: /* @__PURE__ */ jsx9(CaretRight, { size: 18, color: "#fff" })
|
|
614
689
|
}
|
|
615
690
|
)
|
|
616
691
|
},
|
|
617
692
|
paginatorPosition: "top",
|
|
618
|
-
paginatorLeft: /* @__PURE__ */
|
|
693
|
+
paginatorLeft: /* @__PURE__ */ jsx9("div", { className: "paginatorLeft", children: TableHeaderAndTableActions }),
|
|
619
694
|
currentPageReportTemplate: "Mostrando {first} a {last} de {totalRecords}",
|
|
620
|
-
emptyMessage: /* @__PURE__ */
|
|
695
|
+
emptyMessage: /* @__PURE__ */ jsx9("div", { className: "mensagem-nenhum-dado", children: /* @__PURE__ */ jsx9("p", { children: isLanguagePtBr ? "Nenhum dado encontrado" : "No data found" }) }),
|
|
621
696
|
onFilter: (e) => setFilters(e.filters),
|
|
622
697
|
rowsPerPageOptions: [10, 25, 50, 100],
|
|
623
698
|
className: "p-datatable-sm",
|
|
@@ -795,7 +870,7 @@ var localePtBr = {
|
|
|
795
870
|
};
|
|
796
871
|
|
|
797
872
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
798
|
-
import { Fragment as
|
|
873
|
+
import { Fragment as Fragment5, jsx as jsx10 } from "react/jsx-runtime";
|
|
799
874
|
function DataTableAdvancedFilter({
|
|
800
875
|
queryKey,
|
|
801
876
|
mutationFn,
|
|
@@ -810,23 +885,24 @@ function DataTableAdvancedFilter({
|
|
|
810
885
|
sortFieldInitial,
|
|
811
886
|
sortOrderInitial = 1,
|
|
812
887
|
isMultiSelectionMode = true,
|
|
813
|
-
isLanguagePtBr = true
|
|
888
|
+
isLanguagePtBr = true,
|
|
889
|
+
replaceUrl = true
|
|
814
890
|
}) {
|
|
815
891
|
const [isClient, setIsClient] = useState3(false);
|
|
816
|
-
|
|
892
|
+
useEffect4(() => {
|
|
817
893
|
addLocale("pt", localePtBr);
|
|
818
894
|
}, []);
|
|
819
|
-
|
|
895
|
+
useEffect4(() => {
|
|
820
896
|
locale(isLanguagePtBr ? "pt" : "en");
|
|
821
897
|
}, [isLanguagePtBr]);
|
|
822
|
-
|
|
898
|
+
useEffect4(() => {
|
|
823
899
|
setIsClient(true);
|
|
824
900
|
}, []);
|
|
825
|
-
return /* @__PURE__ */
|
|
901
|
+
return /* @__PURE__ */ jsx10(Fragment5, { children: isClient && /* @__PURE__ */ jsx10(
|
|
826
902
|
PrimeReactProvider,
|
|
827
903
|
{
|
|
828
904
|
value: isLanguagePtBr ? { locale: "pt" } : { locale: "en" },
|
|
829
|
-
children: /* @__PURE__ */
|
|
905
|
+
children: /* @__PURE__ */ jsx10(
|
|
830
906
|
DataTableAdvancedFilterWrapper,
|
|
831
907
|
{
|
|
832
908
|
queryKey,
|
|
@@ -842,7 +918,8 @@ function DataTableAdvancedFilter({
|
|
|
842
918
|
sortFieldInitial,
|
|
843
919
|
sortOrderInitial,
|
|
844
920
|
isMultiSelectionMode,
|
|
845
|
-
isLanguagePtBr
|
|
921
|
+
isLanguagePtBr,
|
|
922
|
+
replaceUrl
|
|
846
923
|
}
|
|
847
924
|
)
|
|
848
925
|
}
|
|
@@ -851,10 +928,10 @@ function DataTableAdvancedFilter({
|
|
|
851
928
|
|
|
852
929
|
// src/components/DataTableAdvancedFilter/FilterTemplates.tsx
|
|
853
930
|
import Select from "react-select";
|
|
854
|
-
import { jsx as
|
|
931
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
855
932
|
var DateFilterTemplate = (options, mask) => {
|
|
856
933
|
const parsedValue = options.value && typeof options.value === "string" ? /* @__PURE__ */ new Date(options.value + "T00:00:00") : options.value;
|
|
857
|
-
return /* @__PURE__ */
|
|
934
|
+
return /* @__PURE__ */ jsx11(
|
|
858
935
|
Calendar,
|
|
859
936
|
{
|
|
860
937
|
value: parsedValue,
|
|
@@ -879,7 +956,7 @@ var DateFilterTemplate = (options, mask) => {
|
|
|
879
956
|
};
|
|
880
957
|
var DateTimeFilterTemplate = (options, mask) => {
|
|
881
958
|
const parsedValue = options.value && typeof options.value === "string" ? new Date(options.value) : options.value;
|
|
882
|
-
return /* @__PURE__ */
|
|
959
|
+
return /* @__PURE__ */ jsx11(
|
|
883
960
|
Calendar,
|
|
884
961
|
{
|
|
885
962
|
value: parsedValue,
|
|
@@ -909,7 +986,7 @@ var ValueFilterTemplate = (options, mask) => {
|
|
|
909
986
|
const valueToFilter = mask ? mask(rawValue) : rawValue;
|
|
910
987
|
options.filterCallback(valueToFilter, options.index);
|
|
911
988
|
};
|
|
912
|
-
return /* @__PURE__ */
|
|
989
|
+
return /* @__PURE__ */ jsx11(
|
|
913
990
|
InputNumber,
|
|
914
991
|
{
|
|
915
992
|
value: parsedValue,
|
|
@@ -928,7 +1005,7 @@ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
|
|
|
928
1005
|
{ label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
|
|
929
1006
|
];
|
|
930
1007
|
const currentValue = selectOptions.find((opt) => opt.value === options.value) || selectOptions[0];
|
|
931
|
-
return /* @__PURE__ */
|
|
1008
|
+
return /* @__PURE__ */ jsx11(
|
|
932
1009
|
Select,
|
|
933
1010
|
{
|
|
934
1011
|
options: selectOptions,
|
|
@@ -1042,6 +1119,7 @@ export {
|
|
|
1042
1119
|
DateTimeFilterTemplate,
|
|
1043
1120
|
FilterMatchMode4 as FilterMatchMode,
|
|
1044
1121
|
FilterOperator,
|
|
1122
|
+
ModalBase,
|
|
1045
1123
|
SelectFilterTemplate,
|
|
1046
1124
|
ValueFilterTemplate,
|
|
1047
1125
|
getDefaultFilterMatchOptionsDate,
|