@charlesgomes/leafcode-shared-lib-react 1.0.56 → 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 +22 -0
- package/dist/index.d.mts +72 -2
- package/dist/index.d.ts +72 -2
- package/dist/index.js +373 -116
- package/dist/index.mjs +368 -110
- package/dist/styles/input.css +128 -0
- package/dist/styles/table.css +25 -0
- 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,29 +442,38 @@ 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
|
|
445
|
+
var import_react8 = require("@phosphor-icons/react");
|
|
446
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
200
447
|
var TableHeader = ({
|
|
201
448
|
globalFilterValue,
|
|
202
449
|
onGlobalFilterChange,
|
|
203
450
|
isLanguagePtBr
|
|
204
451
|
}) => {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
452
|
+
const limparCampo = () => {
|
|
453
|
+
onGlobalFilterChange({
|
|
454
|
+
target: { value: "" }
|
|
455
|
+
});
|
|
456
|
+
};
|
|
457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { position: "relative" }, children: [
|
|
458
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
459
|
+
import_inputtext.InputText,
|
|
460
|
+
{
|
|
461
|
+
value: globalFilterValue,
|
|
462
|
+
onChange: onGlobalFilterChange,
|
|
463
|
+
placeholder: isLanguagePtBr ? "Pesquisar..." : "Search...",
|
|
464
|
+
className: "custom-input input-search"
|
|
465
|
+
}
|
|
466
|
+
),
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react8.X, { size: 16, className: "close-search", onClick: limparCampo })
|
|
468
|
+
] });
|
|
214
469
|
};
|
|
215
470
|
var TableHeader_default = TableHeader;
|
|
216
471
|
|
|
217
472
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
218
|
-
var
|
|
473
|
+
var import_react13 = require("@phosphor-icons/react");
|
|
219
474
|
|
|
220
475
|
// src/components/DataTableAdvancedFilter/TableActions.tsx
|
|
221
|
-
var
|
|
476
|
+
var import_react9 = require("@phosphor-icons/react");
|
|
222
477
|
|
|
223
478
|
// src/utils/utils.ts
|
|
224
479
|
var import_clsx = require("clsx");
|
|
@@ -237,20 +492,20 @@ function centsToReal(value) {
|
|
|
237
492
|
}
|
|
238
493
|
|
|
239
494
|
// src/components/TooltipCustom.tsx
|
|
240
|
-
var
|
|
495
|
+
var import_react_tooltip2 = require("react-tooltip");
|
|
241
496
|
var import_react_dom = require("react-dom");
|
|
242
|
-
var
|
|
497
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
243
498
|
function TooltipCustom({ label, id }) {
|
|
244
499
|
return (0, import_react_dom.createPortal)(
|
|
245
|
-
/* @__PURE__ */ (0,
|
|
246
|
-
|
|
500
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
501
|
+
import_react_tooltip2.Tooltip,
|
|
247
502
|
{
|
|
248
503
|
anchorSelect: `#${id}`,
|
|
249
504
|
place: "top",
|
|
250
505
|
positionStrategy: "fixed",
|
|
251
506
|
className: "tooltip-icone",
|
|
252
507
|
style: { zIndex: 13 },
|
|
253
|
-
children: /* @__PURE__ */ (0,
|
|
508
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "tooltip-custom", children: label })
|
|
254
509
|
}
|
|
255
510
|
),
|
|
256
511
|
document.body
|
|
@@ -258,7 +513,7 @@ function TooltipCustom({ label, id }) {
|
|
|
258
513
|
}
|
|
259
514
|
|
|
260
515
|
// src/components/DataTableAdvancedFilter/TableActions.tsx
|
|
261
|
-
var
|
|
516
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
262
517
|
function TableActions({
|
|
263
518
|
onNew,
|
|
264
519
|
onEdit,
|
|
@@ -270,9 +525,9 @@ function TableActions({
|
|
|
270
525
|
const disableButtonsNotMultiplesSelecteds = selectedRows?.length !== 1 ? true : false;
|
|
271
526
|
const enableButtonsNotMultiplesSelecteds = selectedRows?.length > 0 ? true : false;
|
|
272
527
|
const resolvedCustomActions = typeof customActions === "function" ? customActions(selectedRows) : customActions;
|
|
273
|
-
return /* @__PURE__ */ (0,
|
|
274
|
-
onNew && /* @__PURE__ */ (0,
|
|
275
|
-
/* @__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)(
|
|
276
531
|
"button",
|
|
277
532
|
{
|
|
278
533
|
id: "add",
|
|
@@ -283,10 +538,10 @@ function TableActions({
|
|
|
283
538
|
enableButtonsNotMultiplesSelecteds && "disable-button-table-actions"
|
|
284
539
|
),
|
|
285
540
|
disabled: enableButtonsNotMultiplesSelecteds,
|
|
286
|
-
children: /* @__PURE__ */ (0,
|
|
541
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react9.Plus, { size: 18 })
|
|
287
542
|
}
|
|
288
543
|
),
|
|
289
|
-
/* @__PURE__ */ (0,
|
|
544
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
290
545
|
TooltipCustom,
|
|
291
546
|
{
|
|
292
547
|
id: "add",
|
|
@@ -294,7 +549,7 @@ function TableActions({
|
|
|
294
549
|
}
|
|
295
550
|
)
|
|
296
551
|
] }),
|
|
297
|
-
onEdit && /* @__PURE__ */ (0,
|
|
552
|
+
onEdit && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
298
553
|
"button",
|
|
299
554
|
{
|
|
300
555
|
id: "edit",
|
|
@@ -306,8 +561,8 @@ function TableActions({
|
|
|
306
561
|
),
|
|
307
562
|
disabled: disableButtonsNotMultiplesSelecteds,
|
|
308
563
|
children: [
|
|
309
|
-
/* @__PURE__ */ (0,
|
|
310
|
-
/* @__PURE__ */ (0,
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react9.PencilSimple, { size: 18 }),
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
311
566
|
TooltipCustom,
|
|
312
567
|
{
|
|
313
568
|
id: "edit",
|
|
@@ -317,7 +572,7 @@ function TableActions({
|
|
|
317
572
|
]
|
|
318
573
|
}
|
|
319
574
|
) }),
|
|
320
|
-
onDelete && /* @__PURE__ */ (0,
|
|
575
|
+
onDelete && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
321
576
|
"button",
|
|
322
577
|
{
|
|
323
578
|
id: "delete",
|
|
@@ -329,8 +584,8 @@ function TableActions({
|
|
|
329
584
|
),
|
|
330
585
|
disabled: !enableButtonsNotMultiplesSelecteds,
|
|
331
586
|
children: [
|
|
332
|
-
/* @__PURE__ */ (0,
|
|
333
|
-
/* @__PURE__ */ (0,
|
|
587
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react9.Trash, { size: 18 }),
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
334
589
|
TooltipCustom,
|
|
335
590
|
{
|
|
336
591
|
id: "delete",
|
|
@@ -342,7 +597,7 @@ function TableActions({
|
|
|
342
597
|
) }),
|
|
343
598
|
resolvedCustomActions?.map((action) => {
|
|
344
599
|
const id = `action-table${phraseToId(action.label)}`;
|
|
345
|
-
return /* @__PURE__ */ (0,
|
|
600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
346
601
|
"button",
|
|
347
602
|
{
|
|
348
603
|
id,
|
|
@@ -351,7 +606,7 @@ function TableActions({
|
|
|
351
606
|
className: cn("enable-button-table-actions", action.className),
|
|
352
607
|
children: [
|
|
353
608
|
action.icon,
|
|
354
|
-
/* @__PURE__ */ (0,
|
|
609
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipCustom, { id, label: action.label })
|
|
355
610
|
]
|
|
356
611
|
},
|
|
357
612
|
id
|
|
@@ -361,8 +616,8 @@ function TableActions({
|
|
|
361
616
|
}
|
|
362
617
|
|
|
363
618
|
// src/components/DataTableAdvancedFilter/ActionsColumn.tsx
|
|
364
|
-
var
|
|
365
|
-
var
|
|
619
|
+
var import_react10 = require("@phosphor-icons/react");
|
|
620
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
366
621
|
function ActionsColumn({
|
|
367
622
|
row,
|
|
368
623
|
onEdit,
|
|
@@ -371,8 +626,8 @@ function ActionsColumn({
|
|
|
371
626
|
isLanguagePtBr
|
|
372
627
|
}) {
|
|
373
628
|
const resolvedCustomActions = typeof customActionsColums === "function" ? customActionsColums(row) : customActionsColums;
|
|
374
|
-
return /* @__PURE__ */ (0,
|
|
375
|
-
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)(
|
|
376
631
|
"button",
|
|
377
632
|
{
|
|
378
633
|
id: "edit-column",
|
|
@@ -382,8 +637,8 @@ function ActionsColumn({
|
|
|
382
637
|
onEdit && onEdit([row]);
|
|
383
638
|
},
|
|
384
639
|
children: [
|
|
385
|
-
/* @__PURE__ */ (0,
|
|
386
|
-
/* @__PURE__ */ (0,
|
|
640
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react10.PencilSimple, { size: 17, weight: "regular" }),
|
|
641
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
387
642
|
TooltipCustom,
|
|
388
643
|
{
|
|
389
644
|
id: "edit-column",
|
|
@@ -393,7 +648,7 @@ function ActionsColumn({
|
|
|
393
648
|
]
|
|
394
649
|
}
|
|
395
650
|
) }),
|
|
396
|
-
onDelete && /* @__PURE__ */ (0,
|
|
651
|
+
onDelete && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
397
652
|
"button",
|
|
398
653
|
{
|
|
399
654
|
id: "delete-column",
|
|
@@ -403,8 +658,8 @@ function ActionsColumn({
|
|
|
403
658
|
onDelete && onDelete([row]);
|
|
404
659
|
},
|
|
405
660
|
children: [
|
|
406
|
-
/* @__PURE__ */ (0,
|
|
407
|
-
/* @__PURE__ */ (0,
|
|
661
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react10.Trash, { size: 17, weight: "regular" }),
|
|
662
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
408
663
|
TooltipCustom,
|
|
409
664
|
{
|
|
410
665
|
id: "delete-column",
|
|
@@ -416,7 +671,7 @@ function ActionsColumn({
|
|
|
416
671
|
) }),
|
|
417
672
|
resolvedCustomActions?.map((action) => {
|
|
418
673
|
const id = `action-colunm-${phraseToId(action.label)}`;
|
|
419
|
-
return /* @__PURE__ */ (0,
|
|
674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
420
675
|
"button",
|
|
421
676
|
{
|
|
422
677
|
id,
|
|
@@ -425,7 +680,7 @@ function ActionsColumn({
|
|
|
425
680
|
className: cn("btn-icone-actions-column", action.className),
|
|
426
681
|
children: [
|
|
427
682
|
action.icon,
|
|
428
|
-
/* @__PURE__ */ (0,
|
|
683
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipCustom, { id, label: action.label })
|
|
429
684
|
]
|
|
430
685
|
},
|
|
431
686
|
id
|
|
@@ -435,7 +690,7 @@ function ActionsColumn({
|
|
|
435
690
|
}
|
|
436
691
|
|
|
437
692
|
// src/components/DataTableAdvancedFilter/DynamicColumns.tsx
|
|
438
|
-
var
|
|
693
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
439
694
|
function DynamicColumns({
|
|
440
695
|
columns,
|
|
441
696
|
isMultiSelectionMode = true,
|
|
@@ -447,7 +702,7 @@ function DynamicColumns({
|
|
|
447
702
|
const array = [];
|
|
448
703
|
if (isMultiSelectionMode) {
|
|
449
704
|
array.push(
|
|
450
|
-
/* @__PURE__ */ (0,
|
|
705
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
451
706
|
import_column.Column,
|
|
452
707
|
{
|
|
453
708
|
selectionMode: "multiple",
|
|
@@ -464,7 +719,7 @@ function DynamicColumns({
|
|
|
464
719
|
const width = isActionsCol && col?.size ? col.size + "rem" : "6rem";
|
|
465
720
|
const placeholder = isLanguagePtBr ? "Procurar" : "Search";
|
|
466
721
|
array.push(
|
|
467
|
-
/* @__PURE__ */ (0,
|
|
722
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
468
723
|
import_column.Column,
|
|
469
724
|
{
|
|
470
725
|
field: isActionsCol ? void 0 : col.field,
|
|
@@ -482,7 +737,7 @@ function DynamicColumns({
|
|
|
482
737
|
resizeable: col.enableResizeable ?? true
|
|
483
738
|
},
|
|
484
739
|
style: isActionsCol ? { width, minWidth: width, position: "relative" } : {},
|
|
485
|
-
body: (rowData) => isActionsCol ? /* @__PURE__ */ (0,
|
|
740
|
+
body: (rowData) => isActionsCol ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
486
741
|
ActionsColumn,
|
|
487
742
|
{
|
|
488
743
|
row: rowData,
|
|
@@ -491,7 +746,7 @@ function DynamicColumns({
|
|
|
491
746
|
customActionsColums,
|
|
492
747
|
isLanguagePtBr
|
|
493
748
|
}
|
|
494
|
-
) : 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]) }),
|
|
495
750
|
sortable: !isActionsCol ? col.enableSorting ?? true : false
|
|
496
751
|
},
|
|
497
752
|
`${String(col.field)}-${idx}`
|
|
@@ -502,10 +757,10 @@ function DynamicColumns({
|
|
|
502
757
|
}
|
|
503
758
|
|
|
504
759
|
// src/hooks/use-debounce.ts
|
|
505
|
-
var
|
|
760
|
+
var import_react11 = require("react");
|
|
506
761
|
var useDebounce = (value, delay) => {
|
|
507
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
508
|
-
(0,
|
|
762
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react11.useState)(value);
|
|
763
|
+
(0, import_react11.useEffect)(() => {
|
|
509
764
|
const timer = setTimeout(() => {
|
|
510
765
|
setDebouncedValue(value);
|
|
511
766
|
}, delay || 500);
|
|
@@ -517,7 +772,7 @@ var useDebounce = (value, delay) => {
|
|
|
517
772
|
};
|
|
518
773
|
|
|
519
774
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
520
|
-
var
|
|
775
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
521
776
|
function DataTableAdvancedFilterWrapper({
|
|
522
777
|
queryKey,
|
|
523
778
|
mutationFn,
|
|
@@ -537,8 +792,8 @@ function DataTableAdvancedFilterWrapper({
|
|
|
537
792
|
state,
|
|
538
793
|
onStateChange
|
|
539
794
|
}) {
|
|
540
|
-
const [isClient, setIsClient] = (0,
|
|
541
|
-
(0,
|
|
795
|
+
const [isClient, setIsClient] = (0, import_react12.useState)(false);
|
|
796
|
+
(0, import_react12.useEffect)(() => {
|
|
542
797
|
setIsClient(true);
|
|
543
798
|
}, []);
|
|
544
799
|
const initialState = state ?? {
|
|
@@ -548,26 +803,26 @@ function DataTableAdvancedFilterWrapper({
|
|
|
548
803
|
sortOrder: sortOrderInitial,
|
|
549
804
|
filter: ""
|
|
550
805
|
};
|
|
551
|
-
const [page, setPage] = (0,
|
|
552
|
-
const [rows, setRows] = (0,
|
|
553
|
-
const [first, setFirst] = (0,
|
|
554
|
-
const [sortField, setSortField] = (0,
|
|
555
|
-
const [sortOrder, setSortOrder] = (0,
|
|
556
|
-
const [searchText, setSearchText] = (0,
|
|
557
|
-
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)({
|
|
558
813
|
...initFilters,
|
|
559
814
|
global: { value: initialState.filter, matchMode: "contains" }
|
|
560
815
|
});
|
|
561
|
-
const [selectedRowsData, setSelectedRowsData] = (0,
|
|
816
|
+
const [selectedRowsData, setSelectedRowsData] = (0, import_react12.useState)([]);
|
|
562
817
|
const debouncedSearch = useDebounce(searchText, 500);
|
|
563
|
-
const debouncedFilters = (0,
|
|
818
|
+
const debouncedFilters = (0, import_react12.useMemo)(() => {
|
|
564
819
|
const f = { ...filters };
|
|
565
820
|
if (!f.global) f.global = { value: "", matchMode: "contains" };
|
|
566
821
|
f.global.value = debouncedSearch;
|
|
567
822
|
return f;
|
|
568
823
|
}, [filters, debouncedSearch]);
|
|
569
824
|
const filtersKey = JSON.stringify(debouncedFilters);
|
|
570
|
-
const globalFilterFields = (0,
|
|
825
|
+
const globalFilterFields = (0, import_react12.useMemo)(() => {
|
|
571
826
|
return columns?.filter(
|
|
572
827
|
(col) => col.filterGlobal === true && (col.field !== "acoes" || col.field !== "actions")
|
|
573
828
|
).map((col) => col.field) ?? [];
|
|
@@ -583,7 +838,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
583
838
|
globalFilterFields
|
|
584
839
|
)
|
|
585
840
|
});
|
|
586
|
-
(0,
|
|
841
|
+
(0, import_react12.useEffect)(() => {
|
|
587
842
|
if (!state) return;
|
|
588
843
|
setPage(state.page);
|
|
589
844
|
setRows(state.rows);
|
|
@@ -639,7 +894,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
639
894
|
filter: searchText
|
|
640
895
|
});
|
|
641
896
|
};
|
|
642
|
-
(0,
|
|
897
|
+
(0, import_react12.useEffect)(() => {
|
|
643
898
|
emitStateChange({
|
|
644
899
|
page: 1,
|
|
645
900
|
rows,
|
|
@@ -648,7 +903,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
648
903
|
filter: debouncedSearch
|
|
649
904
|
});
|
|
650
905
|
}, [debouncedSearch]);
|
|
651
|
-
(0,
|
|
906
|
+
(0, import_react12.useEffect)(() => {
|
|
652
907
|
if (customers?.items && selectedRowsData.length > 0) {
|
|
653
908
|
const currentIds = new Set(customers.items.map((item) => item.id));
|
|
654
909
|
const filteredSelection = selectedRowsData.filter(
|
|
@@ -659,9 +914,9 @@ function DataTableAdvancedFilterWrapper({
|
|
|
659
914
|
}
|
|
660
915
|
}
|
|
661
916
|
}, [customers?.items, selectedRowsData]);
|
|
662
|
-
const TableHeaderAndTableActions = (0,
|
|
663
|
-
() => /* @__PURE__ */ (0,
|
|
664
|
-
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)(
|
|
665
920
|
TableHeader_default,
|
|
666
921
|
{
|
|
667
922
|
isLanguagePtBr,
|
|
@@ -669,7 +924,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
669
924
|
onGlobalFilterChange
|
|
670
925
|
}
|
|
671
926
|
),
|
|
672
|
-
/* @__PURE__ */ (0,
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
673
928
|
TableActions,
|
|
674
929
|
{
|
|
675
930
|
selectedRows: selectedRowsData,
|
|
@@ -692,9 +947,9 @@ function DataTableAdvancedFilterWrapper({
|
|
|
692
947
|
customActions
|
|
693
948
|
]
|
|
694
949
|
);
|
|
695
|
-
return /* @__PURE__ */ (0,
|
|
696
|
-
disablePagination && /* @__PURE__ */ (0,
|
|
697
|
-
/* @__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)(
|
|
698
953
|
import_datatable.DataTable,
|
|
699
954
|
{
|
|
700
955
|
value: customers?.items ?? [],
|
|
@@ -720,7 +975,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
720
975
|
sortOrder,
|
|
721
976
|
paginatorTemplate: {
|
|
722
977
|
layout: "RowsPerPageDropdown PrevPageLink CurrentPageReport NextPageLink",
|
|
723
|
-
RowsPerPageDropdown: (options) => /* @__PURE__ */ (0,
|
|
978
|
+
RowsPerPageDropdown: (options) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
724
979
|
"select",
|
|
725
980
|
{
|
|
726
981
|
value: options.value,
|
|
@@ -729,20 +984,20 @@ function DataTableAdvancedFilterWrapper({
|
|
|
729
984
|
value: Number(e.target.value)
|
|
730
985
|
}),
|
|
731
986
|
className: "custom-input custom-select",
|
|
732
|
-
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))
|
|
733
988
|
}
|
|
734
989
|
),
|
|
735
|
-
PrevPageLink: (options) => /* @__PURE__ */ (0,
|
|
990
|
+
PrevPageLink: (options) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
736
991
|
"button",
|
|
737
992
|
{
|
|
738
993
|
type: "button",
|
|
739
994
|
onClick: options.onClick,
|
|
740
995
|
disabled: options.disabled,
|
|
741
996
|
className: `PrevPage ${options.disabled ? "PrevPageDisabled" : "PrevPageEnabled"}`,
|
|
742
|
-
children: /* @__PURE__ */ (0,
|
|
997
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react13.CaretLeft, { size: 18, color: "#fff" })
|
|
743
998
|
}
|
|
744
999
|
),
|
|
745
|
-
CurrentPageReport: (options) => /* @__PURE__ */ (0,
|
|
1000
|
+
CurrentPageReport: (options) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "pageReport", children: [
|
|
746
1001
|
isLanguagePtBr ? "Mostrando" : "Showing",
|
|
747
1002
|
" ",
|
|
748
1003
|
options.first,
|
|
@@ -755,21 +1010,21 @@ function DataTableAdvancedFilterWrapper({
|
|
|
755
1010
|
" ",
|
|
756
1011
|
options.totalRecords
|
|
757
1012
|
] }),
|
|
758
|
-
NextPageLink: (options) => /* @__PURE__ */ (0,
|
|
1013
|
+
NextPageLink: (options) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
759
1014
|
"button",
|
|
760
1015
|
{
|
|
761
1016
|
type: "button",
|
|
762
1017
|
onClick: options.onClick,
|
|
763
1018
|
disabled: options.disabled,
|
|
764
1019
|
className: `NextPage ${options.disabled ? "NextPageDisabled" : "NextPageEnabled"}`,
|
|
765
|
-
children: /* @__PURE__ */ (0,
|
|
1020
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react13.CaretRight, { size: 18, color: "#fff" })
|
|
766
1021
|
}
|
|
767
1022
|
)
|
|
768
1023
|
},
|
|
769
1024
|
paginatorPosition: "top",
|
|
770
|
-
paginatorLeft: /* @__PURE__ */ (0,
|
|
1025
|
+
paginatorLeft: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "paginatorLeft", children: TableHeaderAndTableActions }),
|
|
771
1026
|
currentPageReportTemplate: "Mostrando {first} a {last} de {totalRecords}",
|
|
772
|
-
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" }) }),
|
|
773
1028
|
onFilter: (e) => {
|
|
774
1029
|
const newFilters = { ...e.filters };
|
|
775
1030
|
Object.keys(filters).forEach((key) => {
|
|
@@ -968,7 +1223,7 @@ var localePtBr = {
|
|
|
968
1223
|
};
|
|
969
1224
|
|
|
970
1225
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
971
|
-
var
|
|
1226
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
972
1227
|
function DataTableAdvancedFilter({
|
|
973
1228
|
queryKey,
|
|
974
1229
|
mutationFn,
|
|
@@ -988,21 +1243,21 @@ function DataTableAdvancedFilter({
|
|
|
988
1243
|
state,
|
|
989
1244
|
onStateChange
|
|
990
1245
|
}) {
|
|
991
|
-
const [isClient, setIsClient] = (0,
|
|
992
|
-
(0,
|
|
1246
|
+
const [isClient, setIsClient] = (0, import_react14.useState)(false);
|
|
1247
|
+
(0, import_react14.useEffect)(() => {
|
|
993
1248
|
(0, import_api2.addLocale)("pt", localePtBr);
|
|
994
1249
|
}, []);
|
|
995
|
-
(0,
|
|
1250
|
+
(0, import_react14.useEffect)(() => {
|
|
996
1251
|
(0, import_api2.locale)(isLanguagePtBr ? "pt" : "en");
|
|
997
1252
|
}, [isLanguagePtBr]);
|
|
998
|
-
(0,
|
|
1253
|
+
(0, import_react14.useEffect)(() => {
|
|
999
1254
|
setIsClient(true);
|
|
1000
1255
|
}, []);
|
|
1001
|
-
return /* @__PURE__ */ (0,
|
|
1256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: isClient && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1002
1257
|
import_api2.PrimeReactProvider,
|
|
1003
1258
|
{
|
|
1004
1259
|
value: isLanguagePtBr ? { locale: "pt" } : { locale: "en" },
|
|
1005
|
-
children: /* @__PURE__ */ (0,
|
|
1260
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1006
1261
|
DataTableAdvancedFilterWrapper,
|
|
1007
1262
|
{
|
|
1008
1263
|
rowsPerPageOptions,
|
|
@@ -1032,10 +1287,10 @@ function DataTableAdvancedFilter({
|
|
|
1032
1287
|
var import_react_select = __toESM(require("react-select"));
|
|
1033
1288
|
var import_dropdown = require("primereact/dropdown");
|
|
1034
1289
|
var import_moment2 = __toESM(require("moment"));
|
|
1035
|
-
var
|
|
1290
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1036
1291
|
var DateFilterTemplate = (options, mask) => {
|
|
1037
1292
|
const parsedValue = options.value && typeof options.value === "string" ? /* @__PURE__ */ new Date(options.value + "T00:00:00") : options.value;
|
|
1038
|
-
return /* @__PURE__ */ (0,
|
|
1293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1039
1294
|
import_calendar.Calendar,
|
|
1040
1295
|
{
|
|
1041
1296
|
value: parsedValue,
|
|
@@ -1060,7 +1315,7 @@ var DateFilterTemplate = (options, mask) => {
|
|
|
1060
1315
|
};
|
|
1061
1316
|
var DateTimeFilterTemplate = (options, mask) => {
|
|
1062
1317
|
const value = typeof options.value === "string" ? (0, import_moment2.default)(options.value).toDate() : options.value ?? null;
|
|
1063
|
-
return /* @__PURE__ */ (0,
|
|
1318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1064
1319
|
import_calendar.Calendar,
|
|
1065
1320
|
{
|
|
1066
1321
|
value,
|
|
@@ -1094,7 +1349,7 @@ var ValueFilterTemplate = (options, mask) => {
|
|
|
1094
1349
|
const valueToFilter = mask ? mask(rawValue) : rawValue;
|
|
1095
1350
|
options.filterCallback(valueToFilter, options.index);
|
|
1096
1351
|
};
|
|
1097
|
-
return /* @__PURE__ */ (0,
|
|
1352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1098
1353
|
import_inputnumber.InputNumber,
|
|
1099
1354
|
{
|
|
1100
1355
|
value: parsedValue,
|
|
@@ -1113,7 +1368,7 @@ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
|
|
|
1113
1368
|
{ label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
|
|
1114
1369
|
];
|
|
1115
1370
|
const currentValue = selectOptions.find((opt) => opt.value === options.value) || null;
|
|
1116
|
-
return /* @__PURE__ */ (0,
|
|
1371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1117
1372
|
import_react_select.default,
|
|
1118
1373
|
{
|
|
1119
1374
|
options: selectOptions,
|
|
@@ -1172,7 +1427,7 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
|
|
|
1172
1427
|
const currentMatchMode = rawFilter.matchMode ?? "contains";
|
|
1173
1428
|
const currentValue = typeof rawFilter.text === "string" ? rawFilter.text : "";
|
|
1174
1429
|
const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
|
|
1175
|
-
return /* @__PURE__ */ (0,
|
|
1430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1176
1431
|
"div",
|
|
1177
1432
|
{
|
|
1178
1433
|
className: "filter-wrapper",
|
|
@@ -1183,7 +1438,7 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
|
|
|
1183
1438
|
minWidth: "200px"
|
|
1184
1439
|
},
|
|
1185
1440
|
children: [
|
|
1186
|
-
/* @__PURE__ */ (0,
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1187
1442
|
import_dropdown.Dropdown,
|
|
1188
1443
|
{
|
|
1189
1444
|
value: currentMatchMode,
|
|
@@ -1209,7 +1464,7 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
|
|
|
1209
1464
|
}
|
|
1210
1465
|
}
|
|
1211
1466
|
),
|
|
1212
|
-
!isSpecial && /* @__PURE__ */ (0,
|
|
1467
|
+
!isSpecial && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1213
1468
|
import_inputtext.InputText,
|
|
1214
1469
|
{
|
|
1215
1470
|
value: currentValue,
|
|
@@ -1629,8 +1884,10 @@ var import_api5 = require("primereact/api");
|
|
|
1629
1884
|
DateTimeFilterTemplate,
|
|
1630
1885
|
FilterMatchMode,
|
|
1631
1886
|
FilterOperator,
|
|
1887
|
+
Input,
|
|
1632
1888
|
ModalBase,
|
|
1633
1889
|
SelectFilterTemplate,
|
|
1890
|
+
TextArea,
|
|
1634
1891
|
ValueFilterTemplate,
|
|
1635
1892
|
buildDynamicCampoFilters,
|
|
1636
1893
|
buildSortingWithFilters,
|