@charlesgomes/leafcode-shared-lib-react 1.0.57 → 1.0.58
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.css +5 -5
- package/dist/index.d.mts +72 -2
- package/dist/index.d.ts +72 -2
- package/dist/index.js +359 -111
- package/dist/index.mjs +354 -105
- package/dist/styles/input.css +128 -0
- package/dist/styles/table.css +5 -5
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -37,8 +37,10 @@ __export(index_exports, {
|
|
|
37
37
|
DateTimeFilterTemplate: () => DateTimeFilterTemplate,
|
|
38
38
|
FilterMatchMode: () => import_api5.FilterMatchMode,
|
|
39
39
|
FilterOperator: () => import_api5.FilterOperator,
|
|
40
|
+
Input: () => Input,
|
|
40
41
|
ModalBase: () => ModalBase,
|
|
41
42
|
SelectFilterTemplate: () => SelectFilterTemplate,
|
|
43
|
+
TextArea: () => TextArea,
|
|
42
44
|
ValueFilterTemplate: () => ValueFilterTemplate,
|
|
43
45
|
buildDynamicCampoFilters: () => buildDynamicCampoFilters,
|
|
44
46
|
buildSortingWithFilters: () => buildSortingWithFilters,
|
|
@@ -106,18 +108,262 @@ function Button({
|
|
|
106
108
|
);
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
// src/components/
|
|
111
|
+
// src/components/Input/Input.tsx
|
|
112
|
+
var import_react3 = require("react");
|
|
113
|
+
|
|
114
|
+
// src/components/Tooltips/TooltipErrorInput.tsx
|
|
110
115
|
var import_react = require("@phosphor-icons/react");
|
|
116
|
+
var import_react2 = require("react");
|
|
117
|
+
var import_react_tooltip = require("react-tooltip");
|
|
118
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
119
|
+
function TooltipErrorInput({
|
|
120
|
+
error,
|
|
121
|
+
name,
|
|
122
|
+
isSelect = false,
|
|
123
|
+
isInvalid = false
|
|
124
|
+
}) {
|
|
125
|
+
const [isTooltipOpen, setIsTooltipOpen] = (0, import_react2.useState)(true);
|
|
126
|
+
const handleClose = () => setIsTooltipOpen(false);
|
|
127
|
+
(0, import_react2.useEffect)(() => {
|
|
128
|
+
setIsTooltipOpen(true);
|
|
129
|
+
}, [error]);
|
|
130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
className: `absolute ${isSelect ? isInvalid ? "right-[4.5rem]" : "right-11" : "right-2"} top-1/2 transform -translate-y-1/2 cursor-pointer z-20`,
|
|
134
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: error?.message && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
135
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
136
|
+
"a",
|
|
137
|
+
{
|
|
138
|
+
"data-tooltip-id": name,
|
|
139
|
+
"data-tooltip-content": "",
|
|
140
|
+
"data-tooltip-place": "top-end",
|
|
141
|
+
onClick: () => setIsTooltipOpen(true),
|
|
142
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react.WarningCircle, { size: 22, className: "text-red-400" })
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
146
|
+
import_react_tooltip.Tooltip,
|
|
147
|
+
{
|
|
148
|
+
className: "max-w-[15rem] relative z-50 tooltip-content cursor-default",
|
|
149
|
+
id: name,
|
|
150
|
+
style: {
|
|
151
|
+
backgroundColor: "#f87171",
|
|
152
|
+
color: "#fff",
|
|
153
|
+
padding: "8px 14px"
|
|
154
|
+
},
|
|
155
|
+
opacity: 1,
|
|
156
|
+
delayShow: 300,
|
|
157
|
+
delayHide: 150,
|
|
158
|
+
clickable: true,
|
|
159
|
+
openOnClick: true,
|
|
160
|
+
isOpen: isTooltipOpen,
|
|
161
|
+
children: isTooltipOpen && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex justify-between gap-1 items-center font-Roboto text-[13px] leading-[125%] transition-all", children: [
|
|
162
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: error?.message }),
|
|
163
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
164
|
+
"button",
|
|
165
|
+
{
|
|
166
|
+
onClick: handleClose,
|
|
167
|
+
className: "text-white hover:text-black",
|
|
168
|
+
style: {
|
|
169
|
+
border: "none",
|
|
170
|
+
background: "transparent",
|
|
171
|
+
cursor: "pointer"
|
|
172
|
+
},
|
|
173
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react.X, { size: 16, weight: "bold" })
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
] })
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
] }) })
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// src/components/Input/Input.tsx
|
|
185
|
+
var import_react4 = require("@phosphor-icons/react");
|
|
186
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
187
|
+
var InputBase = ({
|
|
188
|
+
name,
|
|
189
|
+
label,
|
|
190
|
+
placeholder,
|
|
191
|
+
onFocus,
|
|
192
|
+
error = null,
|
|
193
|
+
disabled,
|
|
194
|
+
isUppercaseLabel = true,
|
|
195
|
+
isUppercaseText = false,
|
|
196
|
+
validationMode = "default",
|
|
197
|
+
showPasswordToggle = false,
|
|
198
|
+
onChange,
|
|
199
|
+
value,
|
|
200
|
+
colors,
|
|
201
|
+
fonts,
|
|
202
|
+
...rest
|
|
203
|
+
}, ref) => {
|
|
204
|
+
const styleVars = {
|
|
205
|
+
"--label-font-family": fonts?.labelFamily,
|
|
206
|
+
"--label-font-weight": fonts?.labelWeight,
|
|
207
|
+
"--input-font-family": fonts?.inputFamily,
|
|
208
|
+
"--input-font-weight": fonts?.inputWeight,
|
|
209
|
+
"--label-color": colors?.label,
|
|
210
|
+
"--label-bg": colors?.labelBg,
|
|
211
|
+
"--input-border": colors?.inputBorder,
|
|
212
|
+
"--input-bg": colors?.inputBg,
|
|
213
|
+
"--input-text": colors?.inputText,
|
|
214
|
+
"--input-focus-border": colors?.inputFocusBorder,
|
|
215
|
+
"--input-placeholder": colors?.inputPlaceholder,
|
|
216
|
+
"--input-error-border": colors?.inputErrorBorder,
|
|
217
|
+
"--autofill-box-shadow": colors?.autofillBoxShadow,
|
|
218
|
+
"--autofill-text-color": colors?.autofillTextColor,
|
|
219
|
+
"--autofill-color-border": colors?.autofillColorBorder,
|
|
220
|
+
"--color-password-toggle": colors?.colorPasswordToggle
|
|
221
|
+
};
|
|
222
|
+
const handleChange = (e) => {
|
|
223
|
+
let val = e.target.value;
|
|
224
|
+
if (validationMode === "restricted") {
|
|
225
|
+
val = val.replace(/[^a-zA-Z0-9_.-]/g, "");
|
|
226
|
+
val = val.replace(/^\.+/, "");
|
|
227
|
+
val = val.replace(/\.+$/, "");
|
|
228
|
+
val = val.replace(/\s+/g, "");
|
|
229
|
+
}
|
|
230
|
+
e.target.value = val;
|
|
231
|
+
onChange?.(e);
|
|
232
|
+
};
|
|
233
|
+
const [show, setShow] = (0, import_react3.useState)(false);
|
|
234
|
+
const handleClick = () => setShow(!show);
|
|
235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
236
|
+
"div",
|
|
237
|
+
{
|
|
238
|
+
className: `input-wrapper ${disabled ? "is-disabled" : ""}`,
|
|
239
|
+
style: styleVars,
|
|
240
|
+
children: [
|
|
241
|
+
!!label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
242
|
+
"label",
|
|
243
|
+
{
|
|
244
|
+
className: `label-input ${isUppercaseLabel && "is-uppercase"}`,
|
|
245
|
+
htmlFor: name,
|
|
246
|
+
children: label
|
|
247
|
+
}
|
|
248
|
+
),
|
|
249
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { position: "relative", width: "100%" }, children: [
|
|
250
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
251
|
+
"input",
|
|
252
|
+
{
|
|
253
|
+
id: name,
|
|
254
|
+
name,
|
|
255
|
+
disabled,
|
|
256
|
+
type: show ? "text" : "password",
|
|
257
|
+
className: `input ${error && "input-error"} ${isUppercaseText && "is-uppercase"}`,
|
|
258
|
+
placeholder,
|
|
259
|
+
onFocus,
|
|
260
|
+
onChange: handleChange,
|
|
261
|
+
value,
|
|
262
|
+
ref,
|
|
263
|
+
...rest
|
|
264
|
+
}
|
|
265
|
+
),
|
|
266
|
+
showPasswordToggle && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
267
|
+
"div",
|
|
268
|
+
{
|
|
269
|
+
onClick: handleClick,
|
|
270
|
+
className: `password-toggle ${error ? "error" : "no-error"}`,
|
|
271
|
+
children: show ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react4.Eye, { size: 21 }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react4.EyeSlash, { size: 21 })
|
|
272
|
+
}
|
|
273
|
+
)
|
|
274
|
+
] }),
|
|
275
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipErrorInput, { error, name })
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
};
|
|
280
|
+
var Input = (0, import_react3.forwardRef)(InputBase);
|
|
281
|
+
|
|
282
|
+
// src/components/Input/TextArea.tsx
|
|
283
|
+
var import_react5 = require("react");
|
|
284
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
285
|
+
var TextAreaBase = ({
|
|
286
|
+
name,
|
|
287
|
+
label,
|
|
288
|
+
placeholder,
|
|
289
|
+
isUppercaseText = false,
|
|
290
|
+
isUppercaseLabel = true,
|
|
291
|
+
disabled,
|
|
292
|
+
onFocus,
|
|
293
|
+
error,
|
|
294
|
+
colors,
|
|
295
|
+
fonts,
|
|
296
|
+
height,
|
|
297
|
+
...rest
|
|
298
|
+
}, ref) => {
|
|
299
|
+
const styleVars = {
|
|
300
|
+
"--label-font-family": fonts?.labelFamily,
|
|
301
|
+
"--label-font-weight": fonts?.labelWeight,
|
|
302
|
+
"--input-font-family": fonts?.inputFamily,
|
|
303
|
+
"--input-font-weight": fonts?.inputWeight,
|
|
304
|
+
"--height-text-area": height?.heightTextArea,
|
|
305
|
+
"--label-color": colors?.label,
|
|
306
|
+
"--label-bg": colors?.labelBg,
|
|
307
|
+
"--input-border": colors?.inputBorder,
|
|
308
|
+
"--input-bg": colors?.inputBg,
|
|
309
|
+
"--input-text": colors?.inputText,
|
|
310
|
+
"--input-focus-border": colors?.inputFocusBorder,
|
|
311
|
+
"--input-placeholder": colors?.inputPlaceholder,
|
|
312
|
+
"--input-error-border": colors?.inputErrorBorder,
|
|
313
|
+
"--autofill-box-shadow": colors?.autofillBoxShadow,
|
|
314
|
+
"--autofill-text-color": colors?.autofillTextColor,
|
|
315
|
+
"--autofill-color-border": colors?.autofillColorBorder
|
|
316
|
+
};
|
|
317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
318
|
+
"div",
|
|
319
|
+
{
|
|
320
|
+
className: `input-wrapper ${disabled ? "is-disabled" : ""}`,
|
|
321
|
+
style: styleVars,
|
|
322
|
+
children: [
|
|
323
|
+
!!label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
324
|
+
"label",
|
|
325
|
+
{
|
|
326
|
+
className: `label-input ${isUppercaseLabel ? "is-uppercase" : ""}`,
|
|
327
|
+
htmlFor: name,
|
|
328
|
+
children: label
|
|
329
|
+
}
|
|
330
|
+
),
|
|
331
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { position: "relative", width: "100%" }, children: [
|
|
332
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
333
|
+
"textarea",
|
|
334
|
+
{
|
|
335
|
+
ref,
|
|
336
|
+
id: name,
|
|
337
|
+
name,
|
|
338
|
+
disabled,
|
|
339
|
+
className: `input textArea ${error ? "input-error" : ""} ${isUppercaseText ? "is-uppercase" : ""}`,
|
|
340
|
+
placeholder,
|
|
341
|
+
onFocus,
|
|
342
|
+
...rest
|
|
343
|
+
}
|
|
344
|
+
),
|
|
345
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "absolute top-6 right-1", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TooltipErrorInput, { error, name }) })
|
|
346
|
+
] })
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
};
|
|
351
|
+
var TextArea = (0, import_react5.forwardRef)(
|
|
352
|
+
TextAreaBase
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
// src/components/ModalBase/ModalBase.tsx
|
|
356
|
+
var import_react6 = require("@phosphor-icons/react");
|
|
111
357
|
|
|
112
358
|
// src/components/ModalBase/FooterButtons.tsx
|
|
113
|
-
var
|
|
359
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
114
360
|
function FooterButtons({ children }) {
|
|
115
|
-
return /* @__PURE__ */ (0,
|
|
361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.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 });
|
|
116
362
|
}
|
|
117
363
|
|
|
118
364
|
// src/components/ModalBase/ModalBase.tsx
|
|
119
|
-
var
|
|
120
|
-
var
|
|
365
|
+
var import_react7 = require("react");
|
|
366
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
121
367
|
function ModalBase({
|
|
122
368
|
show,
|
|
123
369
|
onHide,
|
|
@@ -129,7 +375,7 @@ function ModalBase({
|
|
|
129
375
|
btnSuccess = "Save",
|
|
130
376
|
disabledBtnSuccess
|
|
131
377
|
}) {
|
|
132
|
-
(0,
|
|
378
|
+
(0, import_react7.useEffect)(() => {
|
|
133
379
|
const handleKeyDown = (event) => {
|
|
134
380
|
if (event.key === "Escape") {
|
|
135
381
|
onHide();
|
|
@@ -140,22 +386,22 @@ function ModalBase({
|
|
|
140
386
|
document.removeEventListener("keydown", handleKeyDown);
|
|
141
387
|
};
|
|
142
388
|
}, [onHide]);
|
|
143
|
-
return /* @__PURE__ */ (0,
|
|
144
|
-
/* @__PURE__ */ (0,
|
|
145
|
-
/* @__PURE__ */ (0,
|
|
146
|
-
/* @__PURE__ */ (0,
|
|
147
|
-
/* @__PURE__ */ (0,
|
|
389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: show ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
390
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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_runtime6.jsx)("div", { className: "relative w-auto my-6 mx-auto max-w-xl", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-theme-dark outline-none focus:outline-none", children: [
|
|
391
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-start justify-between p-2", children: [
|
|
392
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.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 }),
|
|
393
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
148
394
|
"button",
|
|
149
395
|
{
|
|
150
396
|
className: "p-1 ml-auto mr-1 cursor-pointer",
|
|
151
397
|
onClick: onHide,
|
|
152
|
-
children: /* @__PURE__ */ (0,
|
|
398
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react6.X, { size: 18, color: "#ffffff" })
|
|
153
399
|
}
|
|
154
400
|
)
|
|
155
401
|
] }),
|
|
156
|
-
/* @__PURE__ */ (0,
|
|
157
|
-
/* @__PURE__ */ (0,
|
|
158
|
-
/* @__PURE__ */ (0,
|
|
402
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-full p-6", children }),
|
|
403
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(FooterButtons, { children: [
|
|
404
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
159
405
|
Button,
|
|
160
406
|
{
|
|
161
407
|
color: "danger",
|
|
@@ -164,7 +410,7 @@ function ModalBase({
|
|
|
164
410
|
onClick: onHide
|
|
165
411
|
}
|
|
166
412
|
),
|
|
167
|
-
/* @__PURE__ */ (0,
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
168
414
|
Button,
|
|
169
415
|
{
|
|
170
416
|
type: "button",
|
|
@@ -176,15 +422,15 @@ function ModalBase({
|
|
|
176
422
|
)
|
|
177
423
|
] })
|
|
178
424
|
] }) }) }),
|
|
179
|
-
/* @__PURE__ */ (0,
|
|
425
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "opacity-40 fixed inset-0 z-50 bg-black" })
|
|
180
426
|
] }) : null });
|
|
181
427
|
}
|
|
182
428
|
|
|
183
429
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
184
|
-
var
|
|
430
|
+
var import_react14 = require("react");
|
|
185
431
|
|
|
186
432
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
187
|
-
var
|
|
433
|
+
var import_react12 = require("react");
|
|
188
434
|
var import_react_query = require("@tanstack/react-query");
|
|
189
435
|
|
|
190
436
|
// src/primereact-compat.ts
|
|
@@ -196,8 +442,8 @@ var import_calendar = require("primereact/calendar");
|
|
|
196
442
|
var import_api = require("primereact/api");
|
|
197
443
|
|
|
198
444
|
// src/components/DataTableAdvancedFilter/TableHeader.tsx
|
|
199
|
-
var
|
|
200
|
-
var
|
|
445
|
+
var import_react8 = require("@phosphor-icons/react");
|
|
446
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
201
447
|
var TableHeader = ({
|
|
202
448
|
globalFilterValue,
|
|
203
449
|
onGlobalFilterChange,
|
|
@@ -208,8 +454,8 @@ var TableHeader = ({
|
|
|
208
454
|
target: { value: "" }
|
|
209
455
|
});
|
|
210
456
|
};
|
|
211
|
-
return /* @__PURE__ */ (0,
|
|
212
|
-
/* @__PURE__ */ (0,
|
|
457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { position: "relative" }, children: [
|
|
458
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
213
459
|
import_inputtext.InputText,
|
|
214
460
|
{
|
|
215
461
|
value: globalFilterValue,
|
|
@@ -218,16 +464,16 @@ var TableHeader = ({
|
|
|
218
464
|
className: "custom-input input-search"
|
|
219
465
|
}
|
|
220
466
|
),
|
|
221
|
-
/* @__PURE__ */ (0,
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react8.X, { size: 16, className: "close-search", onClick: limparCampo })
|
|
222
468
|
] });
|
|
223
469
|
};
|
|
224
470
|
var TableHeader_default = TableHeader;
|
|
225
471
|
|
|
226
472
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
227
|
-
var
|
|
473
|
+
var import_react13 = require("@phosphor-icons/react");
|
|
228
474
|
|
|
229
475
|
// src/components/DataTableAdvancedFilter/TableActions.tsx
|
|
230
|
-
var
|
|
476
|
+
var import_react9 = require("@phosphor-icons/react");
|
|
231
477
|
|
|
232
478
|
// src/utils/utils.ts
|
|
233
479
|
var import_clsx = require("clsx");
|
|
@@ -246,20 +492,20 @@ function centsToReal(value) {
|
|
|
246
492
|
}
|
|
247
493
|
|
|
248
494
|
// src/components/TooltipCustom.tsx
|
|
249
|
-
var
|
|
495
|
+
var import_react_tooltip2 = require("react-tooltip");
|
|
250
496
|
var import_react_dom = require("react-dom");
|
|
251
|
-
var
|
|
497
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
252
498
|
function TooltipCustom({ label, id }) {
|
|
253
499
|
return (0, import_react_dom.createPortal)(
|
|
254
|
-
/* @__PURE__ */ (0,
|
|
255
|
-
|
|
500
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
501
|
+
import_react_tooltip2.Tooltip,
|
|
256
502
|
{
|
|
257
503
|
anchorSelect: `#${id}`,
|
|
258
504
|
place: "top",
|
|
259
505
|
positionStrategy: "fixed",
|
|
260
506
|
className: "tooltip-icone",
|
|
261
507
|
style: { zIndex: 13 },
|
|
262
|
-
children: /* @__PURE__ */ (0,
|
|
508
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "tooltip-custom", children: label })
|
|
263
509
|
}
|
|
264
510
|
),
|
|
265
511
|
document.body
|
|
@@ -267,7 +513,7 @@ function TooltipCustom({ label, id }) {
|
|
|
267
513
|
}
|
|
268
514
|
|
|
269
515
|
// src/components/DataTableAdvancedFilter/TableActions.tsx
|
|
270
|
-
var
|
|
516
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
271
517
|
function TableActions({
|
|
272
518
|
onNew,
|
|
273
519
|
onEdit,
|
|
@@ -279,9 +525,9 @@ function TableActions({
|
|
|
279
525
|
const disableButtonsNotMultiplesSelecteds = selectedRows?.length !== 1 ? true : false;
|
|
280
526
|
const enableButtonsNotMultiplesSelecteds = selectedRows?.length > 0 ? true : false;
|
|
281
527
|
const resolvedCustomActions = typeof customActions === "function" ? customActions(selectedRows) : customActions;
|
|
282
|
-
return /* @__PURE__ */ (0,
|
|
283
|
-
onNew && /* @__PURE__ */ (0,
|
|
284
|
-
/* @__PURE__ */ (0,
|
|
528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "box-icones-table-actions", children: [
|
|
529
|
+
onNew && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
530
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
285
531
|
"button",
|
|
286
532
|
{
|
|
287
533
|
id: "add",
|
|
@@ -292,10 +538,10 @@ function TableActions({
|
|
|
292
538
|
enableButtonsNotMultiplesSelecteds && "disable-button-table-actions"
|
|
293
539
|
),
|
|
294
540
|
disabled: enableButtonsNotMultiplesSelecteds,
|
|
295
|
-
children: /* @__PURE__ */ (0,
|
|
541
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react9.Plus, { size: 18 })
|
|
296
542
|
}
|
|
297
543
|
),
|
|
298
|
-
/* @__PURE__ */ (0,
|
|
544
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
299
545
|
TooltipCustom,
|
|
300
546
|
{
|
|
301
547
|
id: "add",
|
|
@@ -303,7 +549,7 @@ function TableActions({
|
|
|
303
549
|
}
|
|
304
550
|
)
|
|
305
551
|
] }),
|
|
306
|
-
onEdit && /* @__PURE__ */ (0,
|
|
552
|
+
onEdit && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
307
553
|
"button",
|
|
308
554
|
{
|
|
309
555
|
id: "edit",
|
|
@@ -315,8 +561,8 @@ function TableActions({
|
|
|
315
561
|
),
|
|
316
562
|
disabled: disableButtonsNotMultiplesSelecteds,
|
|
317
563
|
children: [
|
|
318
|
-
/* @__PURE__ */ (0,
|
|
319
|
-
/* @__PURE__ */ (0,
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react9.PencilSimple, { size: 18 }),
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
320
566
|
TooltipCustom,
|
|
321
567
|
{
|
|
322
568
|
id: "edit",
|
|
@@ -326,7 +572,7 @@ function TableActions({
|
|
|
326
572
|
]
|
|
327
573
|
}
|
|
328
574
|
) }),
|
|
329
|
-
onDelete && /* @__PURE__ */ (0,
|
|
575
|
+
onDelete && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
330
576
|
"button",
|
|
331
577
|
{
|
|
332
578
|
id: "delete",
|
|
@@ -338,8 +584,8 @@ function TableActions({
|
|
|
338
584
|
),
|
|
339
585
|
disabled: !enableButtonsNotMultiplesSelecteds,
|
|
340
586
|
children: [
|
|
341
|
-
/* @__PURE__ */ (0,
|
|
342
|
-
/* @__PURE__ */ (0,
|
|
587
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react9.Trash, { size: 18 }),
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
343
589
|
TooltipCustom,
|
|
344
590
|
{
|
|
345
591
|
id: "delete",
|
|
@@ -351,7 +597,7 @@ function TableActions({
|
|
|
351
597
|
) }),
|
|
352
598
|
resolvedCustomActions?.map((action) => {
|
|
353
599
|
const id = `action-table${phraseToId(action.label)}`;
|
|
354
|
-
return /* @__PURE__ */ (0,
|
|
600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
355
601
|
"button",
|
|
356
602
|
{
|
|
357
603
|
id,
|
|
@@ -360,7 +606,7 @@ function TableActions({
|
|
|
360
606
|
className: cn("enable-button-table-actions", action.className),
|
|
361
607
|
children: [
|
|
362
608
|
action.icon,
|
|
363
|
-
/* @__PURE__ */ (0,
|
|
609
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipCustom, { id, label: action.label })
|
|
364
610
|
]
|
|
365
611
|
},
|
|
366
612
|
id
|
|
@@ -370,8 +616,8 @@ function TableActions({
|
|
|
370
616
|
}
|
|
371
617
|
|
|
372
618
|
// src/components/DataTableAdvancedFilter/ActionsColumn.tsx
|
|
373
|
-
var
|
|
374
|
-
var
|
|
619
|
+
var import_react10 = require("@phosphor-icons/react");
|
|
620
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
375
621
|
function ActionsColumn({
|
|
376
622
|
row,
|
|
377
623
|
onEdit,
|
|
@@ -380,8 +626,8 @@ function ActionsColumn({
|
|
|
380
626
|
isLanguagePtBr
|
|
381
627
|
}) {
|
|
382
628
|
const resolvedCustomActions = typeof customActionsColums === "function" ? customActionsColums(row) : customActionsColums;
|
|
383
|
-
return /* @__PURE__ */ (0,
|
|
384
|
-
onEdit && /* @__PURE__ */ (0,
|
|
629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "box-icones-actions-column", children: [
|
|
630
|
+
onEdit && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
385
631
|
"button",
|
|
386
632
|
{
|
|
387
633
|
id: "edit-column",
|
|
@@ -391,8 +637,8 @@ function ActionsColumn({
|
|
|
391
637
|
onEdit && onEdit([row]);
|
|
392
638
|
},
|
|
393
639
|
children: [
|
|
394
|
-
/* @__PURE__ */ (0,
|
|
395
|
-
/* @__PURE__ */ (0,
|
|
640
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react10.PencilSimple, { size: 17, weight: "regular" }),
|
|
641
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
396
642
|
TooltipCustom,
|
|
397
643
|
{
|
|
398
644
|
id: "edit-column",
|
|
@@ -402,7 +648,7 @@ function ActionsColumn({
|
|
|
402
648
|
]
|
|
403
649
|
}
|
|
404
650
|
) }),
|
|
405
|
-
onDelete && /* @__PURE__ */ (0,
|
|
651
|
+
onDelete && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
406
652
|
"button",
|
|
407
653
|
{
|
|
408
654
|
id: "delete-column",
|
|
@@ -412,8 +658,8 @@ function ActionsColumn({
|
|
|
412
658
|
onDelete && onDelete([row]);
|
|
413
659
|
},
|
|
414
660
|
children: [
|
|
415
|
-
/* @__PURE__ */ (0,
|
|
416
|
-
/* @__PURE__ */ (0,
|
|
661
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react10.Trash, { size: 17, weight: "regular" }),
|
|
662
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
417
663
|
TooltipCustom,
|
|
418
664
|
{
|
|
419
665
|
id: "delete-column",
|
|
@@ -425,7 +671,7 @@ function ActionsColumn({
|
|
|
425
671
|
) }),
|
|
426
672
|
resolvedCustomActions?.map((action) => {
|
|
427
673
|
const id = `action-colunm-${phraseToId(action.label)}`;
|
|
428
|
-
return /* @__PURE__ */ (0,
|
|
674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
429
675
|
"button",
|
|
430
676
|
{
|
|
431
677
|
id,
|
|
@@ -434,7 +680,7 @@ function ActionsColumn({
|
|
|
434
680
|
className: cn("btn-icone-actions-column", action.className),
|
|
435
681
|
children: [
|
|
436
682
|
action.icon,
|
|
437
|
-
/* @__PURE__ */ (0,
|
|
683
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipCustom, { id, label: action.label })
|
|
438
684
|
]
|
|
439
685
|
},
|
|
440
686
|
id
|
|
@@ -444,7 +690,7 @@ function ActionsColumn({
|
|
|
444
690
|
}
|
|
445
691
|
|
|
446
692
|
// src/components/DataTableAdvancedFilter/DynamicColumns.tsx
|
|
447
|
-
var
|
|
693
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
448
694
|
function DynamicColumns({
|
|
449
695
|
columns,
|
|
450
696
|
isMultiSelectionMode = true,
|
|
@@ -456,7 +702,7 @@ function DynamicColumns({
|
|
|
456
702
|
const array = [];
|
|
457
703
|
if (isMultiSelectionMode) {
|
|
458
704
|
array.push(
|
|
459
|
-
/* @__PURE__ */ (0,
|
|
705
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
460
706
|
import_column.Column,
|
|
461
707
|
{
|
|
462
708
|
selectionMode: "multiple",
|
|
@@ -473,7 +719,7 @@ function DynamicColumns({
|
|
|
473
719
|
const width = isActionsCol && col?.size ? col.size + "rem" : "6rem";
|
|
474
720
|
const placeholder = isLanguagePtBr ? "Procurar" : "Search";
|
|
475
721
|
array.push(
|
|
476
|
-
/* @__PURE__ */ (0,
|
|
722
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
477
723
|
import_column.Column,
|
|
478
724
|
{
|
|
479
725
|
field: isActionsCol ? void 0 : col.field,
|
|
@@ -491,7 +737,7 @@ function DynamicColumns({
|
|
|
491
737
|
resizeable: col.enableResizeable ?? true
|
|
492
738
|
},
|
|
493
739
|
style: isActionsCol ? { width, minWidth: width, position: "relative" } : {},
|
|
494
|
-
body: (rowData) => isActionsCol ? /* @__PURE__ */ (0,
|
|
740
|
+
body: (rowData) => isActionsCol ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
495
741
|
ActionsColumn,
|
|
496
742
|
{
|
|
497
743
|
row: rowData,
|
|
@@ -500,7 +746,7 @@ function DynamicColumns({
|
|
|
500
746
|
customActionsColums,
|
|
501
747
|
isLanguagePtBr
|
|
502
748
|
}
|
|
503
|
-
) : col.body ? col.body(rowData) : /* @__PURE__ */ (0,
|
|
749
|
+
) : col.body ? col.body(rowData) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: String(rowData[col.field]) }),
|
|
504
750
|
sortable: !isActionsCol ? col.enableSorting ?? true : false
|
|
505
751
|
},
|
|
506
752
|
`${String(col.field)}-${idx}`
|
|
@@ -511,10 +757,10 @@ function DynamicColumns({
|
|
|
511
757
|
}
|
|
512
758
|
|
|
513
759
|
// src/hooks/use-debounce.ts
|
|
514
|
-
var
|
|
760
|
+
var import_react11 = require("react");
|
|
515
761
|
var useDebounce = (value, delay) => {
|
|
516
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
517
|
-
(0,
|
|
762
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react11.useState)(value);
|
|
763
|
+
(0, import_react11.useEffect)(() => {
|
|
518
764
|
const timer = setTimeout(() => {
|
|
519
765
|
setDebouncedValue(value);
|
|
520
766
|
}, delay || 500);
|
|
@@ -526,7 +772,7 @@ var useDebounce = (value, delay) => {
|
|
|
526
772
|
};
|
|
527
773
|
|
|
528
774
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
529
|
-
var
|
|
775
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
530
776
|
function DataTableAdvancedFilterWrapper({
|
|
531
777
|
queryKey,
|
|
532
778
|
mutationFn,
|
|
@@ -546,8 +792,8 @@ function DataTableAdvancedFilterWrapper({
|
|
|
546
792
|
state,
|
|
547
793
|
onStateChange
|
|
548
794
|
}) {
|
|
549
|
-
const [isClient, setIsClient] = (0,
|
|
550
|
-
(0,
|
|
795
|
+
const [isClient, setIsClient] = (0, import_react12.useState)(false);
|
|
796
|
+
(0, import_react12.useEffect)(() => {
|
|
551
797
|
setIsClient(true);
|
|
552
798
|
}, []);
|
|
553
799
|
const initialState = state ?? {
|
|
@@ -557,26 +803,26 @@ function DataTableAdvancedFilterWrapper({
|
|
|
557
803
|
sortOrder: sortOrderInitial,
|
|
558
804
|
filter: ""
|
|
559
805
|
};
|
|
560
|
-
const [page, setPage] = (0,
|
|
561
|
-
const [rows, setRows] = (0,
|
|
562
|
-
const [first, setFirst] = (0,
|
|
563
|
-
const [sortField, setSortField] = (0,
|
|
564
|
-
const [sortOrder, setSortOrder] = (0,
|
|
565
|
-
const [searchText, setSearchText] = (0,
|
|
566
|
-
const [filters, setFilters] = (0,
|
|
806
|
+
const [page, setPage] = (0, import_react12.useState)(initialState.page);
|
|
807
|
+
const [rows, setRows] = (0, import_react12.useState)(initialState.rows);
|
|
808
|
+
const [first, setFirst] = (0, import_react12.useState)((initialState.page - 1) * initialState.rows);
|
|
809
|
+
const [sortField, setSortField] = (0, import_react12.useState)(initialState.sortField);
|
|
810
|
+
const [sortOrder, setSortOrder] = (0, import_react12.useState)(initialState.sortOrder ?? 1);
|
|
811
|
+
const [searchText, setSearchText] = (0, import_react12.useState)(initialState.filter ?? "");
|
|
812
|
+
const [filters, setFilters] = (0, import_react12.useState)({
|
|
567
813
|
...initFilters,
|
|
568
814
|
global: { value: initialState.filter, matchMode: "contains" }
|
|
569
815
|
});
|
|
570
|
-
const [selectedRowsData, setSelectedRowsData] = (0,
|
|
816
|
+
const [selectedRowsData, setSelectedRowsData] = (0, import_react12.useState)([]);
|
|
571
817
|
const debouncedSearch = useDebounce(searchText, 500);
|
|
572
|
-
const debouncedFilters = (0,
|
|
818
|
+
const debouncedFilters = (0, import_react12.useMemo)(() => {
|
|
573
819
|
const f = { ...filters };
|
|
574
820
|
if (!f.global) f.global = { value: "", matchMode: "contains" };
|
|
575
821
|
f.global.value = debouncedSearch;
|
|
576
822
|
return f;
|
|
577
823
|
}, [filters, debouncedSearch]);
|
|
578
824
|
const filtersKey = JSON.stringify(debouncedFilters);
|
|
579
|
-
const globalFilterFields = (0,
|
|
825
|
+
const globalFilterFields = (0, import_react12.useMemo)(() => {
|
|
580
826
|
return columns?.filter(
|
|
581
827
|
(col) => col.filterGlobal === true && (col.field !== "acoes" || col.field !== "actions")
|
|
582
828
|
).map((col) => col.field) ?? [];
|
|
@@ -592,7 +838,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
592
838
|
globalFilterFields
|
|
593
839
|
)
|
|
594
840
|
});
|
|
595
|
-
(0,
|
|
841
|
+
(0, import_react12.useEffect)(() => {
|
|
596
842
|
if (!state) return;
|
|
597
843
|
setPage(state.page);
|
|
598
844
|
setRows(state.rows);
|
|
@@ -648,7 +894,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
648
894
|
filter: searchText
|
|
649
895
|
});
|
|
650
896
|
};
|
|
651
|
-
(0,
|
|
897
|
+
(0, import_react12.useEffect)(() => {
|
|
652
898
|
emitStateChange({
|
|
653
899
|
page: 1,
|
|
654
900
|
rows,
|
|
@@ -657,7 +903,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
657
903
|
filter: debouncedSearch
|
|
658
904
|
});
|
|
659
905
|
}, [debouncedSearch]);
|
|
660
|
-
(0,
|
|
906
|
+
(0, import_react12.useEffect)(() => {
|
|
661
907
|
if (customers?.items && selectedRowsData.length > 0) {
|
|
662
908
|
const currentIds = new Set(customers.items.map((item) => item.id));
|
|
663
909
|
const filteredSelection = selectedRowsData.filter(
|
|
@@ -668,9 +914,9 @@ function DataTableAdvancedFilterWrapper({
|
|
|
668
914
|
}
|
|
669
915
|
}
|
|
670
916
|
}, [customers?.items, selectedRowsData]);
|
|
671
|
-
const TableHeaderAndTableActions = (0,
|
|
672
|
-
() => /* @__PURE__ */ (0,
|
|
673
|
-
globalFilterFields.length > 0 && /* @__PURE__ */ (0,
|
|
917
|
+
const TableHeaderAndTableActions = (0, import_react12.useMemo)(
|
|
918
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
919
|
+
globalFilterFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
674
920
|
TableHeader_default,
|
|
675
921
|
{
|
|
676
922
|
isLanguagePtBr,
|
|
@@ -678,7 +924,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
678
924
|
onGlobalFilterChange
|
|
679
925
|
}
|
|
680
926
|
),
|
|
681
|
-
/* @__PURE__ */ (0,
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
682
928
|
TableActions,
|
|
683
929
|
{
|
|
684
930
|
selectedRows: selectedRowsData,
|
|
@@ -701,9 +947,9 @@ function DataTableAdvancedFilterWrapper({
|
|
|
701
947
|
customActions
|
|
702
948
|
]
|
|
703
949
|
);
|
|
704
|
-
return /* @__PURE__ */ (0,
|
|
705
|
-
disablePagination && /* @__PURE__ */ (0,
|
|
706
|
-
/* @__PURE__ */ (0,
|
|
950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: isClient && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
951
|
+
disablePagination && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "disablePagination", children: TableHeaderAndTableActions }),
|
|
952
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
707
953
|
import_datatable.DataTable,
|
|
708
954
|
{
|
|
709
955
|
value: customers?.items ?? [],
|
|
@@ -729,7 +975,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
729
975
|
sortOrder,
|
|
730
976
|
paginatorTemplate: {
|
|
731
977
|
layout: "RowsPerPageDropdown PrevPageLink CurrentPageReport NextPageLink",
|
|
732
|
-
RowsPerPageDropdown: (options) => /* @__PURE__ */ (0,
|
|
978
|
+
RowsPerPageDropdown: (options) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
733
979
|
"select",
|
|
734
980
|
{
|
|
735
981
|
value: options.value,
|
|
@@ -738,20 +984,20 @@ function DataTableAdvancedFilterWrapper({
|
|
|
738
984
|
value: Number(e.target.value)
|
|
739
985
|
}),
|
|
740
986
|
className: "custom-input custom-select",
|
|
741
|
-
children: options.options.map((opt) => /* @__PURE__ */ (0,
|
|
987
|
+
children: options.options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
742
988
|
}
|
|
743
989
|
),
|
|
744
|
-
PrevPageLink: (options) => /* @__PURE__ */ (0,
|
|
990
|
+
PrevPageLink: (options) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
745
991
|
"button",
|
|
746
992
|
{
|
|
747
993
|
type: "button",
|
|
748
994
|
onClick: options.onClick,
|
|
749
995
|
disabled: options.disabled,
|
|
750
996
|
className: `PrevPage ${options.disabled ? "PrevPageDisabled" : "PrevPageEnabled"}`,
|
|
751
|
-
children: /* @__PURE__ */ (0,
|
|
997
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react13.CaretLeft, { size: 18, color: "#fff" })
|
|
752
998
|
}
|
|
753
999
|
),
|
|
754
|
-
CurrentPageReport: (options) => /* @__PURE__ */ (0,
|
|
1000
|
+
CurrentPageReport: (options) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "pageReport", children: [
|
|
755
1001
|
isLanguagePtBr ? "Mostrando" : "Showing",
|
|
756
1002
|
" ",
|
|
757
1003
|
options.first,
|
|
@@ -764,21 +1010,21 @@ function DataTableAdvancedFilterWrapper({
|
|
|
764
1010
|
" ",
|
|
765
1011
|
options.totalRecords
|
|
766
1012
|
] }),
|
|
767
|
-
NextPageLink: (options) => /* @__PURE__ */ (0,
|
|
1013
|
+
NextPageLink: (options) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
768
1014
|
"button",
|
|
769
1015
|
{
|
|
770
1016
|
type: "button",
|
|
771
1017
|
onClick: options.onClick,
|
|
772
1018
|
disabled: options.disabled,
|
|
773
1019
|
className: `NextPage ${options.disabled ? "NextPageDisabled" : "NextPageEnabled"}`,
|
|
774
|
-
children: /* @__PURE__ */ (0,
|
|
1020
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react13.CaretRight, { size: 18, color: "#fff" })
|
|
775
1021
|
}
|
|
776
1022
|
)
|
|
777
1023
|
},
|
|
778
1024
|
paginatorPosition: "top",
|
|
779
|
-
paginatorLeft: /* @__PURE__ */ (0,
|
|
1025
|
+
paginatorLeft: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "paginatorLeft", children: TableHeaderAndTableActions }),
|
|
780
1026
|
currentPageReportTemplate: "Mostrando {first} a {last} de {totalRecords}",
|
|
781
|
-
emptyMessage: /* @__PURE__ */ (0,
|
|
1027
|
+
emptyMessage: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mensagem-nenhum-dado", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: isLanguagePtBr ? "Nenhum dado encontrado" : "No data found" }) }),
|
|
782
1028
|
onFilter: (e) => {
|
|
783
1029
|
const newFilters = { ...e.filters };
|
|
784
1030
|
Object.keys(filters).forEach((key) => {
|
|
@@ -977,7 +1223,7 @@ var localePtBr = {
|
|
|
977
1223
|
};
|
|
978
1224
|
|
|
979
1225
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
980
|
-
var
|
|
1226
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
981
1227
|
function DataTableAdvancedFilter({
|
|
982
1228
|
queryKey,
|
|
983
1229
|
mutationFn,
|
|
@@ -997,21 +1243,21 @@ function DataTableAdvancedFilter({
|
|
|
997
1243
|
state,
|
|
998
1244
|
onStateChange
|
|
999
1245
|
}) {
|
|
1000
|
-
const [isClient, setIsClient] = (0,
|
|
1001
|
-
(0,
|
|
1246
|
+
const [isClient, setIsClient] = (0, import_react14.useState)(false);
|
|
1247
|
+
(0, import_react14.useEffect)(() => {
|
|
1002
1248
|
(0, import_api2.addLocale)("pt", localePtBr);
|
|
1003
1249
|
}, []);
|
|
1004
|
-
(0,
|
|
1250
|
+
(0, import_react14.useEffect)(() => {
|
|
1005
1251
|
(0, import_api2.locale)(isLanguagePtBr ? "pt" : "en");
|
|
1006
1252
|
}, [isLanguagePtBr]);
|
|
1007
|
-
(0,
|
|
1253
|
+
(0, import_react14.useEffect)(() => {
|
|
1008
1254
|
setIsClient(true);
|
|
1009
1255
|
}, []);
|
|
1010
|
-
return /* @__PURE__ */ (0,
|
|
1256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: isClient && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1011
1257
|
import_api2.PrimeReactProvider,
|
|
1012
1258
|
{
|
|
1013
1259
|
value: isLanguagePtBr ? { locale: "pt" } : { locale: "en" },
|
|
1014
|
-
children: /* @__PURE__ */ (0,
|
|
1260
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1015
1261
|
DataTableAdvancedFilterWrapper,
|
|
1016
1262
|
{
|
|
1017
1263
|
rowsPerPageOptions,
|
|
@@ -1041,10 +1287,10 @@ function DataTableAdvancedFilter({
|
|
|
1041
1287
|
var import_react_select = __toESM(require("react-select"));
|
|
1042
1288
|
var import_dropdown = require("primereact/dropdown");
|
|
1043
1289
|
var import_moment2 = __toESM(require("moment"));
|
|
1044
|
-
var
|
|
1290
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1045
1291
|
var DateFilterTemplate = (options, mask) => {
|
|
1046
1292
|
const parsedValue = options.value && typeof options.value === "string" ? /* @__PURE__ */ new Date(options.value + "T00:00:00") : options.value;
|
|
1047
|
-
return /* @__PURE__ */ (0,
|
|
1293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1048
1294
|
import_calendar.Calendar,
|
|
1049
1295
|
{
|
|
1050
1296
|
value: parsedValue,
|
|
@@ -1069,7 +1315,7 @@ var DateFilterTemplate = (options, mask) => {
|
|
|
1069
1315
|
};
|
|
1070
1316
|
var DateTimeFilterTemplate = (options, mask) => {
|
|
1071
1317
|
const value = typeof options.value === "string" ? (0, import_moment2.default)(options.value).toDate() : options.value ?? null;
|
|
1072
|
-
return /* @__PURE__ */ (0,
|
|
1318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1073
1319
|
import_calendar.Calendar,
|
|
1074
1320
|
{
|
|
1075
1321
|
value,
|
|
@@ -1103,7 +1349,7 @@ var ValueFilterTemplate = (options, mask) => {
|
|
|
1103
1349
|
const valueToFilter = mask ? mask(rawValue) : rawValue;
|
|
1104
1350
|
options.filterCallback(valueToFilter, options.index);
|
|
1105
1351
|
};
|
|
1106
|
-
return /* @__PURE__ */ (0,
|
|
1352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1107
1353
|
import_inputnumber.InputNumber,
|
|
1108
1354
|
{
|
|
1109
1355
|
value: parsedValue,
|
|
@@ -1122,7 +1368,7 @@ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
|
|
|
1122
1368
|
{ label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
|
|
1123
1369
|
];
|
|
1124
1370
|
const currentValue = selectOptions.find((opt) => opt.value === options.value) || null;
|
|
1125
|
-
return /* @__PURE__ */ (0,
|
|
1371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1126
1372
|
import_react_select.default,
|
|
1127
1373
|
{
|
|
1128
1374
|
options: selectOptions,
|
|
@@ -1181,7 +1427,7 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
|
|
|
1181
1427
|
const currentMatchMode = rawFilter.matchMode ?? "contains";
|
|
1182
1428
|
const currentValue = typeof rawFilter.text === "string" ? rawFilter.text : "";
|
|
1183
1429
|
const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
|
|
1184
|
-
return /* @__PURE__ */ (0,
|
|
1430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1185
1431
|
"div",
|
|
1186
1432
|
{
|
|
1187
1433
|
className: "filter-wrapper",
|
|
@@ -1192,7 +1438,7 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
|
|
|
1192
1438
|
minWidth: "200px"
|
|
1193
1439
|
},
|
|
1194
1440
|
children: [
|
|
1195
|
-
/* @__PURE__ */ (0,
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1196
1442
|
import_dropdown.Dropdown,
|
|
1197
1443
|
{
|
|
1198
1444
|
value: currentMatchMode,
|
|
@@ -1218,7 +1464,7 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
|
|
|
1218
1464
|
}
|
|
1219
1465
|
}
|
|
1220
1466
|
),
|
|
1221
|
-
!isSpecial && /* @__PURE__ */ (0,
|
|
1467
|
+
!isSpecial && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1222
1468
|
import_inputtext.InputText,
|
|
1223
1469
|
{
|
|
1224
1470
|
value: currentValue,
|
|
@@ -1638,8 +1884,10 @@ var import_api5 = require("primereact/api");
|
|
|
1638
1884
|
DateTimeFilterTemplate,
|
|
1639
1885
|
FilterMatchMode,
|
|
1640
1886
|
FilterOperator,
|
|
1887
|
+
Input,
|
|
1641
1888
|
ModalBase,
|
|
1642
1889
|
SelectFilterTemplate,
|
|
1890
|
+
TextArea,
|
|
1643
1891
|
ValueFilterTemplate,
|
|
1644
1892
|
buildDynamicCampoFilters,
|
|
1645
1893
|
buildSortingWithFilters,
|