@charlesgomes/leafcode-shared-lib-react 1.0.58 → 1.0.60
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 +150 -48
- package/dist/index.d.ts +150 -48
- package/dist/index.js +624 -199
- package/dist/index.mjs +607 -177
- package/dist/styles/base.css +20 -0
- package/dist/styles/button.css +41 -47
- package/dist/styles/input.css +129 -11
- package/dist/styles/modalBase.css +99 -0
- package/package.json +8 -3
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,89 @@
|
|
|
1
|
+
// src/provider/ThemeProvider.tsx
|
|
2
|
+
import merge from "lodash.merge";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
|
|
5
|
+
// src/provider/defaultTheme.ts
|
|
6
|
+
var defaultTheme = {
|
|
7
|
+
colors: {
|
|
8
|
+
primary: "#00875F",
|
|
9
|
+
danger: "#ED202E",
|
|
10
|
+
border: "#D4D4D8",
|
|
11
|
+
text: "#18181B",
|
|
12
|
+
light: "#FFFFFF",
|
|
13
|
+
background: "#FFFFFF"
|
|
14
|
+
},
|
|
15
|
+
fonts: {
|
|
16
|
+
body: "Roboto, sans-serif",
|
|
17
|
+
heading: "Roboto, sans-serif"
|
|
18
|
+
},
|
|
19
|
+
radius: {
|
|
20
|
+
sm: "4px",
|
|
21
|
+
md: "6px",
|
|
22
|
+
lg: "10px"
|
|
23
|
+
},
|
|
24
|
+
components: {
|
|
25
|
+
input: {
|
|
26
|
+
colors: {
|
|
27
|
+
border: "#D4D4D8",
|
|
28
|
+
focusBorder: "#00875F",
|
|
29
|
+
errorBorder: "#ED202E",
|
|
30
|
+
background: "#FFFFFF",
|
|
31
|
+
text: "#18181B",
|
|
32
|
+
placeholder: "#71717A",
|
|
33
|
+
passwordToggle: "#71717A"
|
|
34
|
+
},
|
|
35
|
+
fonts: {
|
|
36
|
+
label: "Roboto, sans-serif",
|
|
37
|
+
input: "Roboto, sans-serif",
|
|
38
|
+
labelSize: "12px",
|
|
39
|
+
inputSize: "14px",
|
|
40
|
+
labelWeight: 600,
|
|
41
|
+
inputWeight: 400
|
|
42
|
+
},
|
|
43
|
+
sizes: {
|
|
44
|
+
height: "44px",
|
|
45
|
+
heightTextArea: "6rem",
|
|
46
|
+
radius: "6px"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
button: {
|
|
50
|
+
colors: {
|
|
51
|
+
text: "#FFFFFF",
|
|
52
|
+
primaryBg: "#6366f1",
|
|
53
|
+
primaryHoverBg: "#4f46e5",
|
|
54
|
+
secondaryBg: "#bf1717",
|
|
55
|
+
secondaryHoverBg: "#f35353",
|
|
56
|
+
disabledBorder: "#a1a1aa",
|
|
57
|
+
disabledBg: "#d4d4d8"
|
|
58
|
+
},
|
|
59
|
+
fonts: {
|
|
60
|
+
family: '"Roboto", sans-serif',
|
|
61
|
+
weight: 600,
|
|
62
|
+
size: "13px"
|
|
63
|
+
},
|
|
64
|
+
sizes: {
|
|
65
|
+
height: "2.5rem",
|
|
66
|
+
minWidth: "8rem",
|
|
67
|
+
radius: "6px"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// src/provider/ThemeProvider.tsx
|
|
74
|
+
import { jsx } from "react/jsx-runtime";
|
|
75
|
+
var ThemeContext = createContext(defaultTheme);
|
|
76
|
+
var LeafcodeThemeProvider = ({
|
|
77
|
+
children,
|
|
78
|
+
theme
|
|
79
|
+
}) => {
|
|
80
|
+
const mergedTheme = merge({}, defaultTheme, theme);
|
|
81
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: mergedTheme, children });
|
|
82
|
+
};
|
|
83
|
+
var useLeafcodeTheme = () => useContext(ThemeContext);
|
|
84
|
+
|
|
1
85
|
// src/components/Button/Button.tsx
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
86
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
3
87
|
function Button({
|
|
4
88
|
disabled,
|
|
5
89
|
loading,
|
|
@@ -9,15 +93,32 @@ function Button({
|
|
|
9
93
|
title,
|
|
10
94
|
...rest
|
|
11
95
|
}) {
|
|
12
|
-
|
|
96
|
+
const theme = useLeafcodeTheme();
|
|
97
|
+
const styleVars = {
|
|
98
|
+
"--button-font-family": theme.components.button.fonts.family,
|
|
99
|
+
"--button-font-weight": theme.components.button.fonts.weight,
|
|
100
|
+
"--button-font-size": theme.components.button.fonts.size,
|
|
101
|
+
"--button-text-color": theme.components.button.colors.text,
|
|
102
|
+
"--button-primary-bg": theme.components.button.colors.primaryBg,
|
|
103
|
+
"--button-primary-hover-bg": theme.components.button.colors.primaryHoverBg,
|
|
104
|
+
"--button-secondary-bg": theme.components.button.colors.secondaryBg,
|
|
105
|
+
"--button-secondary-hover-bg": theme.components.button.colors.secondaryHoverBg,
|
|
106
|
+
"--button-disabled-bg": theme.components.button.colors.disabledBg,
|
|
107
|
+
"--button-disabled-border": theme.components.button.colors.disabledBorder,
|
|
108
|
+
"--button-height": theme.components.button.sizes.height,
|
|
109
|
+
"--button-min-width": theme.components.button.sizes.minWidth,
|
|
110
|
+
"--button-border-radius": theme.components.button.sizes.radius
|
|
111
|
+
};
|
|
112
|
+
return /* @__PURE__ */ jsx2(
|
|
13
113
|
"button",
|
|
14
114
|
{
|
|
15
115
|
type,
|
|
16
|
-
|
|
116
|
+
style: styleVars,
|
|
117
|
+
className: `box-button ${disabled || loading ? "button-disabled" : color === "danger" ? "button-secundary" : "button-primary"}`,
|
|
17
118
|
onClick: !loading ? onClick : void 0,
|
|
18
119
|
disabled: disabled || loading,
|
|
19
120
|
...rest,
|
|
20
|
-
children: loading ? /* @__PURE__ */
|
|
121
|
+
children: loading ? /* @__PURE__ */ jsx2("span", { className: "box-loading", children: /* @__PURE__ */ jsxs(
|
|
21
122
|
"svg",
|
|
22
123
|
{
|
|
23
124
|
className: "animate-spin",
|
|
@@ -25,7 +126,7 @@ function Button({
|
|
|
25
126
|
fill: "none",
|
|
26
127
|
viewBox: "0 0 24 24",
|
|
27
128
|
children: [
|
|
28
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ jsx2(
|
|
29
130
|
"circle",
|
|
30
131
|
{
|
|
31
132
|
className: "opacity-01",
|
|
@@ -36,7 +137,7 @@ function Button({
|
|
|
36
137
|
strokeWidth: "4"
|
|
37
138
|
}
|
|
38
139
|
),
|
|
39
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ jsx2(
|
|
40
141
|
"path",
|
|
41
142
|
{
|
|
42
143
|
className: "opacity-02",
|
|
@@ -46,7 +147,7 @@ function Button({
|
|
|
46
147
|
)
|
|
47
148
|
]
|
|
48
149
|
}
|
|
49
|
-
) }) : /* @__PURE__ */
|
|
150
|
+
) }) : /* @__PURE__ */ jsx2("span", { children: title })
|
|
50
151
|
}
|
|
51
152
|
);
|
|
52
153
|
}
|
|
@@ -61,7 +162,7 @@ import {
|
|
|
61
162
|
import { WarningCircle, X } from "@phosphor-icons/react";
|
|
62
163
|
import { useEffect, useState } from "react";
|
|
63
164
|
import { Tooltip } from "react-tooltip";
|
|
64
|
-
import { Fragment, jsx as
|
|
165
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
65
166
|
function TooltipErrorInput({
|
|
66
167
|
error,
|
|
67
168
|
name,
|
|
@@ -73,22 +174,22 @@ function TooltipErrorInput({
|
|
|
73
174
|
useEffect(() => {
|
|
74
175
|
setIsTooltipOpen(true);
|
|
75
176
|
}, [error]);
|
|
76
|
-
return /* @__PURE__ */
|
|
177
|
+
return /* @__PURE__ */ jsx3(
|
|
77
178
|
"div",
|
|
78
179
|
{
|
|
79
180
|
className: `absolute ${isSelect ? isInvalid ? "right-[4.5rem]" : "right-11" : "right-2"} top-1/2 transform -translate-y-1/2 cursor-pointer z-20`,
|
|
80
|
-
children: /* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
181
|
+
children: /* @__PURE__ */ jsx3(Fragment, { children: error?.message && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
182
|
+
/* @__PURE__ */ jsx3(
|
|
82
183
|
"a",
|
|
83
184
|
{
|
|
84
185
|
"data-tooltip-id": name,
|
|
85
186
|
"data-tooltip-content": "",
|
|
86
187
|
"data-tooltip-place": "top-end",
|
|
87
188
|
onClick: () => setIsTooltipOpen(true),
|
|
88
|
-
children: /* @__PURE__ */
|
|
189
|
+
children: /* @__PURE__ */ jsx3(WarningCircle, { size: 22, className: "text-red-400" })
|
|
89
190
|
}
|
|
90
191
|
),
|
|
91
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ jsx3(
|
|
92
193
|
Tooltip,
|
|
93
194
|
{
|
|
94
195
|
className: "max-w-[15rem] relative z-50 tooltip-content cursor-default",
|
|
@@ -105,8 +206,8 @@ function TooltipErrorInput({
|
|
|
105
206
|
openOnClick: true,
|
|
106
207
|
isOpen: isTooltipOpen,
|
|
107
208
|
children: isTooltipOpen && /* @__PURE__ */ jsxs2("div", { className: "flex justify-between gap-1 items-center font-Roboto text-[13px] leading-[125%] transition-all", children: [
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ jsx3("span", { children: error?.message }),
|
|
210
|
+
/* @__PURE__ */ jsx3(
|
|
110
211
|
"button",
|
|
111
212
|
{
|
|
112
213
|
onClick: handleClose,
|
|
@@ -116,7 +217,7 @@ function TooltipErrorInput({
|
|
|
116
217
|
background: "transparent",
|
|
117
218
|
cursor: "pointer"
|
|
118
219
|
},
|
|
119
|
-
children: /* @__PURE__ */
|
|
220
|
+
children: /* @__PURE__ */ jsx3(X, { size: 16, weight: "bold" })
|
|
120
221
|
}
|
|
121
222
|
)
|
|
122
223
|
] })
|
|
@@ -129,7 +230,7 @@ function TooltipErrorInput({
|
|
|
129
230
|
|
|
130
231
|
// src/components/Input/Input.tsx
|
|
131
232
|
import { Eye, EyeSlash } from "@phosphor-icons/react";
|
|
132
|
-
import { jsx as
|
|
233
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
133
234
|
var InputBase = ({
|
|
134
235
|
name,
|
|
135
236
|
label,
|
|
@@ -143,27 +244,29 @@ var InputBase = ({
|
|
|
143
244
|
showPasswordToggle = false,
|
|
144
245
|
onChange,
|
|
145
246
|
value,
|
|
146
|
-
colors,
|
|
147
|
-
fonts,
|
|
148
247
|
...rest
|
|
149
248
|
}, ref) => {
|
|
249
|
+
const theme = useLeafcodeTheme();
|
|
150
250
|
const styleVars = {
|
|
151
|
-
|
|
152
|
-
"--label-font-
|
|
153
|
-
"--
|
|
154
|
-
"--
|
|
155
|
-
"--
|
|
156
|
-
"--
|
|
157
|
-
"--input-
|
|
158
|
-
|
|
159
|
-
"--
|
|
160
|
-
"--input-
|
|
161
|
-
"--input-
|
|
162
|
-
"--input-
|
|
163
|
-
"--
|
|
164
|
-
"--
|
|
165
|
-
"--
|
|
166
|
-
"--color-password-toggle": colors
|
|
251
|
+
// Fonts
|
|
252
|
+
"--label-font-family": theme.components.input.fonts.label,
|
|
253
|
+
"--label-font-weight": theme.components.input.fonts.labelWeight,
|
|
254
|
+
"--label-font-size": theme.components.input.fonts.labelSize,
|
|
255
|
+
"--input-font-family": theme.components.input.fonts.input,
|
|
256
|
+
"--input-font-weight": theme.components.input.fonts.inputWeight,
|
|
257
|
+
"--input-font-size": theme.components.input.fonts.inputSize,
|
|
258
|
+
// Colors
|
|
259
|
+
"--label-color": theme.components.input.colors.text,
|
|
260
|
+
"--input-border": theme.components.input.colors.border,
|
|
261
|
+
"--input-bg": theme.components.input.colors.background,
|
|
262
|
+
"--input-text-color": theme.components.input.colors.text,
|
|
263
|
+
"--input-placeholder": theme.components.input.colors.placeholder,
|
|
264
|
+
"--input-focus-border": theme.components.input.colors.focusBorder,
|
|
265
|
+
"--input-error-border": theme.components.input.colors.errorBorder,
|
|
266
|
+
"--color-password-toggle": theme.components.input.colors.passwordToggle,
|
|
267
|
+
// Sizes
|
|
268
|
+
"--input-height": theme.components.input.sizes.height,
|
|
269
|
+
"--input-border-radius": theme.components.input.sizes.radius
|
|
167
270
|
};
|
|
168
271
|
const handleChange = (e) => {
|
|
169
272
|
let val = e.target.value;
|
|
@@ -184,7 +287,7 @@ var InputBase = ({
|
|
|
184
287
|
className: `input-wrapper ${disabled ? "is-disabled" : ""}`,
|
|
185
288
|
style: styleVars,
|
|
186
289
|
children: [
|
|
187
|
-
!!label && /* @__PURE__ */
|
|
290
|
+
!!label && /* @__PURE__ */ jsx4(
|
|
188
291
|
"label",
|
|
189
292
|
{
|
|
190
293
|
className: `label-input ${isUppercaseLabel && "is-uppercase"}`,
|
|
@@ -193,7 +296,7 @@ var InputBase = ({
|
|
|
193
296
|
}
|
|
194
297
|
),
|
|
195
298
|
/* @__PURE__ */ jsxs3("div", { style: { position: "relative", width: "100%" }, children: [
|
|
196
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ jsx4(
|
|
197
300
|
"input",
|
|
198
301
|
{
|
|
199
302
|
id: name,
|
|
@@ -209,16 +312,16 @@ var InputBase = ({
|
|
|
209
312
|
...rest
|
|
210
313
|
}
|
|
211
314
|
),
|
|
212
|
-
showPasswordToggle && /* @__PURE__ */
|
|
315
|
+
showPasswordToggle && /* @__PURE__ */ jsx4(
|
|
213
316
|
"div",
|
|
214
317
|
{
|
|
215
318
|
onClick: handleClick,
|
|
216
319
|
className: `password-toggle ${error ? "error" : "no-error"}`,
|
|
217
|
-
children: show ? /* @__PURE__ */
|
|
320
|
+
children: show ? /* @__PURE__ */ jsx4(Eye, { size: 21 }) : /* @__PURE__ */ jsx4(EyeSlash, { size: 21 })
|
|
218
321
|
}
|
|
219
322
|
)
|
|
220
323
|
] }),
|
|
221
|
-
/* @__PURE__ */
|
|
324
|
+
/* @__PURE__ */ jsx4(TooltipErrorInput, { error, name })
|
|
222
325
|
]
|
|
223
326
|
}
|
|
224
327
|
);
|
|
@@ -227,7 +330,7 @@ var Input = forwardRef(InputBase);
|
|
|
227
330
|
|
|
228
331
|
// src/components/Input/TextArea.tsx
|
|
229
332
|
import { forwardRef as forwardRef2 } from "react";
|
|
230
|
-
import { jsx as
|
|
333
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
231
334
|
var TextAreaBase = ({
|
|
232
335
|
name,
|
|
233
336
|
label,
|
|
@@ -237,28 +340,29 @@ var TextAreaBase = ({
|
|
|
237
340
|
disabled,
|
|
238
341
|
onFocus,
|
|
239
342
|
error,
|
|
240
|
-
colors,
|
|
241
|
-
fonts,
|
|
242
|
-
height,
|
|
243
343
|
...rest
|
|
244
344
|
}, ref) => {
|
|
345
|
+
const theme = useLeafcodeTheme();
|
|
245
346
|
const styleVars = {
|
|
246
|
-
|
|
247
|
-
"--label-font-
|
|
248
|
-
"--
|
|
249
|
-
"--
|
|
250
|
-
"--
|
|
251
|
-
"--
|
|
252
|
-
"--
|
|
253
|
-
|
|
254
|
-
"--
|
|
255
|
-
"--input-
|
|
256
|
-
"--input-
|
|
257
|
-
"--input-
|
|
258
|
-
"--input-
|
|
259
|
-
"--
|
|
260
|
-
"--
|
|
261
|
-
"--
|
|
347
|
+
// Fonts
|
|
348
|
+
"--label-font-family": theme.components.input.fonts.label,
|
|
349
|
+
"--label-font-weight": theme.components.input.fonts.labelWeight,
|
|
350
|
+
"--label-font-size": theme.components.input.fonts.labelSize,
|
|
351
|
+
"--input-font-family": theme.components.input.fonts.input,
|
|
352
|
+
"--input-font-weight": theme.components.input.fonts.inputWeight,
|
|
353
|
+
"--input-font-size": theme.components.input.fonts.inputSize,
|
|
354
|
+
// Colors
|
|
355
|
+
"--label-color": theme.components.input.colors.text,
|
|
356
|
+
"--input-border": theme.components.input.colors.border,
|
|
357
|
+
"--input-bg": theme.components.input.colors.background,
|
|
358
|
+
"--input-text-color": theme.components.input.colors.text,
|
|
359
|
+
"--input-placeholder": theme.components.input.colors.placeholder,
|
|
360
|
+
"--input-focus-border": theme.components.input.colors.focusBorder,
|
|
361
|
+
"--input-error-border": theme.components.input.colors.errorBorder,
|
|
362
|
+
"--color-password-toggle": theme.components.input.colors.passwordToggle,
|
|
363
|
+
// Sizes
|
|
364
|
+
"--input-height-text-area": theme.components.input.sizes.heightTextArea,
|
|
365
|
+
"--input-border-radius": theme.components.input.sizes.radius
|
|
262
366
|
};
|
|
263
367
|
return /* @__PURE__ */ jsxs4(
|
|
264
368
|
"div",
|
|
@@ -266,7 +370,7 @@ var TextAreaBase = ({
|
|
|
266
370
|
className: `input-wrapper ${disabled ? "is-disabled" : ""}`,
|
|
267
371
|
style: styleVars,
|
|
268
372
|
children: [
|
|
269
|
-
!!label && /* @__PURE__ */
|
|
373
|
+
!!label && /* @__PURE__ */ jsx5(
|
|
270
374
|
"label",
|
|
271
375
|
{
|
|
272
376
|
className: `label-input ${isUppercaseLabel ? "is-uppercase" : ""}`,
|
|
@@ -275,7 +379,7 @@ var TextAreaBase = ({
|
|
|
275
379
|
}
|
|
276
380
|
),
|
|
277
381
|
/* @__PURE__ */ jsxs4("div", { style: { position: "relative", width: "100%" }, children: [
|
|
278
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ jsx5(
|
|
279
383
|
"textarea",
|
|
280
384
|
{
|
|
281
385
|
ref,
|
|
@@ -288,7 +392,7 @@ var TextAreaBase = ({
|
|
|
288
392
|
...rest
|
|
289
393
|
}
|
|
290
394
|
),
|
|
291
|
-
/* @__PURE__ */
|
|
395
|
+
/* @__PURE__ */ jsx5("div", { className: "absolute top-6 right-1", children: /* @__PURE__ */ jsx5(TooltipErrorInput, { error, name }) })
|
|
292
396
|
] })
|
|
293
397
|
]
|
|
294
398
|
}
|
|
@@ -298,18 +402,145 @@ var TextArea = forwardRef2(
|
|
|
298
402
|
TextAreaBase
|
|
299
403
|
);
|
|
300
404
|
|
|
405
|
+
// src/components/Input/InputSelect.tsx
|
|
406
|
+
import {
|
|
407
|
+
forwardRef as forwardRef3,
|
|
408
|
+
useEffect as useEffect2,
|
|
409
|
+
useState as useState3
|
|
410
|
+
} from "react";
|
|
411
|
+
import { Controller } from "react-hook-form";
|
|
412
|
+
import Select, { components } from "react-select";
|
|
413
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
414
|
+
var NoOptionsMessage = (props) => {
|
|
415
|
+
return /* @__PURE__ */ jsx6(components.NoOptionsMessage, { ...props, children: /* @__PURE__ */ jsx6("span", { className: "", children: "Nenhuma op\xE7\xE3o" }) });
|
|
416
|
+
};
|
|
417
|
+
var InputBase2 = ({
|
|
418
|
+
name,
|
|
419
|
+
control,
|
|
420
|
+
options,
|
|
421
|
+
isMulti,
|
|
422
|
+
closeMenuOnSelect,
|
|
423
|
+
isClearable = true,
|
|
424
|
+
label,
|
|
425
|
+
placeholder,
|
|
426
|
+
error = null,
|
|
427
|
+
disabled,
|
|
428
|
+
onSelect,
|
|
429
|
+
isUppercaseLabel = true
|
|
430
|
+
}, ref) => {
|
|
431
|
+
const theme = useLeafcodeTheme();
|
|
432
|
+
const styleVars = {
|
|
433
|
+
// Fonts
|
|
434
|
+
"--label-font-family": theme.components.input.fonts.label,
|
|
435
|
+
"--label-font-weight": theme.components.input.fonts.labelWeight,
|
|
436
|
+
"--label-font-size": theme.components.input.fonts.labelSize,
|
|
437
|
+
"--input-font-family": theme.components.input.fonts.input,
|
|
438
|
+
"--input-font-weight": theme.components.input.fonts.inputWeight,
|
|
439
|
+
"--input-font-size": theme.components.input.fonts.inputSize,
|
|
440
|
+
// Colors
|
|
441
|
+
"--label-color": theme.components.input.colors.text,
|
|
442
|
+
"--input-border": theme.components.input.colors.border,
|
|
443
|
+
"--input-bg": theme.components.input.colors.background,
|
|
444
|
+
"--input-text-color": theme.colors.light,
|
|
445
|
+
"--input-placeholder": theme.components.input.colors.placeholder,
|
|
446
|
+
"--input-focus-border": theme.components.input.colors.focusBorder,
|
|
447
|
+
"--input-error-border": theme.components.input.colors.errorBorder,
|
|
448
|
+
"--color-password-toggle": theme.components.input.colors.passwordToggle,
|
|
449
|
+
// Sizes
|
|
450
|
+
"--input-height": theme.components.input.sizes.height,
|
|
451
|
+
"--input-border-radius": theme.components.input.sizes.radius
|
|
452
|
+
};
|
|
453
|
+
const [menuPortalTarget, setMenuPortalTarget] = useState3(
|
|
454
|
+
null
|
|
455
|
+
);
|
|
456
|
+
useEffect2(() => {
|
|
457
|
+
setMenuPortalTarget(document.body);
|
|
458
|
+
}, []);
|
|
459
|
+
return /* @__PURE__ */ jsxs5("div", { className: "input-wrapper", style: styleVars, children: [
|
|
460
|
+
!!label && /* @__PURE__ */ jsx6(
|
|
461
|
+
"label",
|
|
462
|
+
{
|
|
463
|
+
className: `label-input ${isUppercaseLabel && "is-uppercase"}`,
|
|
464
|
+
htmlFor: name,
|
|
465
|
+
children: label
|
|
466
|
+
}
|
|
467
|
+
),
|
|
468
|
+
/* @__PURE__ */ jsx6(
|
|
469
|
+
Controller,
|
|
470
|
+
{
|
|
471
|
+
name,
|
|
472
|
+
control,
|
|
473
|
+
render: ({ field: { onChange, ref: ref2, value } }) => {
|
|
474
|
+
const selectedOption = options.find(
|
|
475
|
+
(option) => option.value === value
|
|
476
|
+
);
|
|
477
|
+
const displayValue = value?.label ? value : selectedOption || { label: value, value };
|
|
478
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
479
|
+
/* @__PURE__ */ jsx6(
|
|
480
|
+
Select,
|
|
481
|
+
{
|
|
482
|
+
ref: ref2,
|
|
483
|
+
id: "long-value-select",
|
|
484
|
+
instanceId: "long-value-select",
|
|
485
|
+
placeholder,
|
|
486
|
+
isClearable,
|
|
487
|
+
closeMenuOnSelect,
|
|
488
|
+
menuPortalTarget,
|
|
489
|
+
isMulti,
|
|
490
|
+
isSearchable: false,
|
|
491
|
+
menuPlacement: "auto",
|
|
492
|
+
className: "react-select-container",
|
|
493
|
+
components: { NoOptionsMessage },
|
|
494
|
+
classNamePrefix: "react-select",
|
|
495
|
+
isDisabled: disabled,
|
|
496
|
+
options,
|
|
497
|
+
value: displayValue.label !== null && displayValue.label !== void 0 ? displayValue : null,
|
|
498
|
+
onChange: (e) => {
|
|
499
|
+
onChange(e);
|
|
500
|
+
onSelect && onSelect();
|
|
501
|
+
},
|
|
502
|
+
styles: {
|
|
503
|
+
control: (baseStyles) => ({
|
|
504
|
+
...baseStyles,
|
|
505
|
+
boxShadow: "none"
|
|
506
|
+
}),
|
|
507
|
+
menuPortal: (base) => ({
|
|
508
|
+
...base,
|
|
509
|
+
zIndex: 99,
|
|
510
|
+
...styleVars
|
|
511
|
+
})
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
),
|
|
515
|
+
/* @__PURE__ */ jsx6(
|
|
516
|
+
TooltipErrorInput,
|
|
517
|
+
{
|
|
518
|
+
error,
|
|
519
|
+
name,
|
|
520
|
+
isSelect: true,
|
|
521
|
+
isInvalid: value && error?.message
|
|
522
|
+
}
|
|
523
|
+
)
|
|
524
|
+
] });
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
)
|
|
528
|
+
] });
|
|
529
|
+
};
|
|
530
|
+
var InputSelect = forwardRef3(InputBase2);
|
|
531
|
+
|
|
301
532
|
// src/components/ModalBase/ModalBase.tsx
|
|
302
533
|
import { X as X2 } from "@phosphor-icons/react";
|
|
303
534
|
|
|
304
535
|
// src/components/ModalBase/FooterButtons.tsx
|
|
305
|
-
import { jsx as
|
|
536
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
306
537
|
function FooterButtons({ children }) {
|
|
307
|
-
return /* @__PURE__ */
|
|
538
|
+
return /* @__PURE__ */ jsx7("div", { className: "modal-footer", children });
|
|
308
539
|
}
|
|
309
540
|
|
|
310
541
|
// src/components/ModalBase/ModalBase.tsx
|
|
311
|
-
import { useEffect as
|
|
312
|
-
import { Fragment as
|
|
542
|
+
import { useEffect as useEffect3 } from "react";
|
|
543
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
313
544
|
function ModalBase({
|
|
314
545
|
show,
|
|
315
546
|
onHide,
|
|
@@ -319,9 +550,25 @@ function ModalBase({
|
|
|
319
550
|
loading,
|
|
320
551
|
btnCancel = "Cancel",
|
|
321
552
|
btnSuccess = "Save",
|
|
322
|
-
|
|
553
|
+
type = "button",
|
|
554
|
+
disabledBtnSuccess,
|
|
555
|
+
colors,
|
|
556
|
+
fonts,
|
|
557
|
+
modalMaxWidth
|
|
323
558
|
}) {
|
|
324
|
-
|
|
559
|
+
const styleVars = {
|
|
560
|
+
"--modal-title-font-weight": fonts?.modalTitleFontWeight,
|
|
561
|
+
"--modal-title-font-size": fonts?.modalTitleFontSize,
|
|
562
|
+
"--modal-title-font-family": fonts?.modalTitleFontFamily,
|
|
563
|
+
"--modal-body-font-family": fonts?.modalBodyFontFamily,
|
|
564
|
+
"--modal-body-font-size": fonts?.modalBodyFontSize,
|
|
565
|
+
"--modal-bg-color": colors?.modalBgColor,
|
|
566
|
+
"--modal-title-color": colors?.modalTitleColor,
|
|
567
|
+
"--modal-body-color": colors?.modalBodyColor,
|
|
568
|
+
"--modal-close-color": colors?.modalCloseColor,
|
|
569
|
+
"--modal-max-width": modalMaxWidth?.modalMaxWidth
|
|
570
|
+
};
|
|
571
|
+
useEffect3(() => {
|
|
325
572
|
const handleKeyDown = (event) => {
|
|
326
573
|
if (event.key === "Escape") {
|
|
327
574
|
onHide();
|
|
@@ -332,22 +579,15 @@ function ModalBase({
|
|
|
332
579
|
document.removeEventListener("keydown", handleKeyDown);
|
|
333
580
|
};
|
|
334
581
|
}, [onHide]);
|
|
335
|
-
return /* @__PURE__ */
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
/* @__PURE__ */
|
|
338
|
-
/* @__PURE__ */
|
|
339
|
-
/* @__PURE__ */
|
|
340
|
-
"button",
|
|
341
|
-
{
|
|
342
|
-
className: "p-1 ml-auto mr-1 cursor-pointer",
|
|
343
|
-
onClick: onHide,
|
|
344
|
-
children: /* @__PURE__ */ jsx6(X2, { size: 18, color: "#ffffff" })
|
|
345
|
-
}
|
|
346
|
-
)
|
|
582
|
+
return /* @__PURE__ */ jsx8(Fragment3, { children: show ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
583
|
+
/* @__PURE__ */ jsx8("div", { className: "modal-overlay", style: styleVars, children: /* @__PURE__ */ jsx8("div", { className: "modal-wrapper", children: /* @__PURE__ */ jsxs6("div", { className: "modal-content", children: [
|
|
584
|
+
/* @__PURE__ */ jsxs6("div", { className: "modal-header", children: [
|
|
585
|
+
/* @__PURE__ */ jsx8("h3", { className: "modal-title", children: title }),
|
|
586
|
+
/* @__PURE__ */ jsx8("button", { className: "modal-close", type: "button", onClick: onHide, children: /* @__PURE__ */ jsx8(X2, { size: 18, className: "button-close" }) })
|
|
347
587
|
] }),
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
588
|
+
/* @__PURE__ */ jsx8("div", { className: "modal-body", children }),
|
|
589
|
+
/* @__PURE__ */ jsxs6(FooterButtons, { children: [
|
|
590
|
+
/* @__PURE__ */ jsx8(
|
|
351
591
|
Button,
|
|
352
592
|
{
|
|
353
593
|
color: "danger",
|
|
@@ -356,10 +596,10 @@ function ModalBase({
|
|
|
356
596
|
onClick: onHide
|
|
357
597
|
}
|
|
358
598
|
),
|
|
359
|
-
/* @__PURE__ */
|
|
599
|
+
/* @__PURE__ */ jsx8(
|
|
360
600
|
Button,
|
|
361
601
|
{
|
|
362
|
-
type
|
|
602
|
+
type,
|
|
363
603
|
title: btnSuccess,
|
|
364
604
|
onClick: onAction,
|
|
365
605
|
loading,
|
|
@@ -368,16 +608,202 @@ function ModalBase({
|
|
|
368
608
|
)
|
|
369
609
|
] })
|
|
370
610
|
] }) }) }),
|
|
371
|
-
/* @__PURE__ */
|
|
611
|
+
/* @__PURE__ */ jsx8("div", { className: "modal-backdrop" })
|
|
372
612
|
] }) : null });
|
|
373
613
|
}
|
|
374
614
|
|
|
615
|
+
// src/components/Input/InputAutocomplete.tsx
|
|
616
|
+
import { X as X3 } from "@phosphor-icons/react";
|
|
617
|
+
import _ from "lodash";
|
|
618
|
+
import {
|
|
619
|
+
forwardRef as forwardRef4,
|
|
620
|
+
useEffect as useEffect4,
|
|
621
|
+
useRef,
|
|
622
|
+
useState as useState4
|
|
623
|
+
} from "react";
|
|
624
|
+
import { useQuery } from "@tanstack/react-query";
|
|
625
|
+
|
|
626
|
+
// src/components/Loading/Loading.tsx
|
|
627
|
+
import { memo } from "react";
|
|
628
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
629
|
+
var LoadingSpinner = memo(
|
|
630
|
+
({ size = 24, color = "#00875F" }) => {
|
|
631
|
+
return /* @__PURE__ */ jsx9(
|
|
632
|
+
"span",
|
|
633
|
+
{
|
|
634
|
+
style: {
|
|
635
|
+
width: size,
|
|
636
|
+
height: size,
|
|
637
|
+
border: `3px solid ${color}33`,
|
|
638
|
+
borderTopColor: color,
|
|
639
|
+
borderRadius: "50%",
|
|
640
|
+
display: "inline-block",
|
|
641
|
+
animation: "leafcode-spin 0.8s linear infinite"
|
|
642
|
+
},
|
|
643
|
+
"aria-label": "Carregando"
|
|
644
|
+
}
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
);
|
|
648
|
+
LoadingSpinner.displayName = "LoadingSpinner";
|
|
649
|
+
|
|
650
|
+
// src/components/Input/InputAutocomplete.tsx
|
|
651
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
652
|
+
var PAGE_SIZE = 10;
|
|
653
|
+
var InputBase3 = ({
|
|
654
|
+
name,
|
|
655
|
+
label,
|
|
656
|
+
error,
|
|
657
|
+
onSelect,
|
|
658
|
+
defaultValue,
|
|
659
|
+
inputAutocompleteActive,
|
|
660
|
+
queryKey,
|
|
661
|
+
mutationFn,
|
|
662
|
+
renderOption,
|
|
663
|
+
disabled,
|
|
664
|
+
placeholder,
|
|
665
|
+
isUppercaseLabel = true,
|
|
666
|
+
...rest
|
|
667
|
+
}, ref) => {
|
|
668
|
+
const theme = useLeafcodeTheme();
|
|
669
|
+
const styleVars = {
|
|
670
|
+
"--label-font-family": theme.components.input.fonts.label,
|
|
671
|
+
"--label-font-weight": theme.components.input.fonts.labelWeight,
|
|
672
|
+
"--label-font-size": theme.components.input.fonts.labelSize,
|
|
673
|
+
"--dropdown-empty-color": theme.components.input.colors.text,
|
|
674
|
+
"--dropdown-item-hover-bg-color": theme.colors.primary,
|
|
675
|
+
"--label-color": theme.components.input.colors.text,
|
|
676
|
+
"--input-border": theme.components.input.colors.border,
|
|
677
|
+
"--input-bg": theme.components.input.colors.background,
|
|
678
|
+
"--input-text-color": theme.components.input.colors.text,
|
|
679
|
+
"--input-focus-border": theme.components.input.colors.focusBorder,
|
|
680
|
+
"--dropdown-item-hover-color": theme.colors.light,
|
|
681
|
+
"--input-height": theme.components.input.sizes.height,
|
|
682
|
+
"--input-border-radius": theme.components.input.sizes.radius
|
|
683
|
+
};
|
|
684
|
+
const [value, setValue] = useState4("");
|
|
685
|
+
const [items, setItems] = useState4([]);
|
|
686
|
+
const [pageNumber, setPageNumber] = useState4(1);
|
|
687
|
+
const [search, setSearch] = useState4("");
|
|
688
|
+
const [isOpen, setIsOpen] = useState4(false);
|
|
689
|
+
const listRef = useRef(null);
|
|
690
|
+
const { data, isLoading } = useQuery({
|
|
691
|
+
queryKey: [queryKey, pageNumber, search],
|
|
692
|
+
queryFn: () => mutationFn(pageNumber, PAGE_SIZE, search),
|
|
693
|
+
enabled: isOpen
|
|
694
|
+
});
|
|
695
|
+
useEffect4(() => {
|
|
696
|
+
if (!data?.items) return;
|
|
697
|
+
setItems(
|
|
698
|
+
(prev) => pageNumber === 1 ? data.items : [...prev, ...data.items]
|
|
699
|
+
);
|
|
700
|
+
}, [data, pageNumber]);
|
|
701
|
+
useEffect4(() => {
|
|
702
|
+
const debounced = _.debounce(() => {
|
|
703
|
+
setPageNumber(1);
|
|
704
|
+
setItems([]);
|
|
705
|
+
setSearch(value);
|
|
706
|
+
}, 600);
|
|
707
|
+
debounced();
|
|
708
|
+
return () => debounced.cancel();
|
|
709
|
+
}, [value]);
|
|
710
|
+
useEffect4(() => {
|
|
711
|
+
if (!defaultValue) return;
|
|
712
|
+
setValue(defaultValue.label ?? defaultValue);
|
|
713
|
+
}, [defaultValue]);
|
|
714
|
+
const handleScroll = () => {
|
|
715
|
+
if (!listRef.current || !data) return;
|
|
716
|
+
const { scrollTop, clientHeight, scrollHeight } = listRef.current;
|
|
717
|
+
if (scrollTop + clientHeight >= scrollHeight - 10 && pageNumber < data.totalPages && !isLoading) {
|
|
718
|
+
setPageNumber((prev) => prev + 1);
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
const handleSelect = (item) => {
|
|
722
|
+
setValue(item.nome);
|
|
723
|
+
setIsOpen(false);
|
|
724
|
+
onSelect(item);
|
|
725
|
+
};
|
|
726
|
+
const renderDropdown = () => {
|
|
727
|
+
if (!isOpen) return null;
|
|
728
|
+
return /* @__PURE__ */ jsx10("div", { className: "dropdown-container", style: styleVars, children: /* @__PURE__ */ jsxs7("ul", { ref: listRef, onScroll: handleScroll, className: "dropdown-list", children: [
|
|
729
|
+
items.map((item) => /* @__PURE__ */ jsx10(
|
|
730
|
+
"li",
|
|
731
|
+
{
|
|
732
|
+
onClick: () => handleSelect(item),
|
|
733
|
+
className: "dropdown-item",
|
|
734
|
+
children: renderOption(item)
|
|
735
|
+
},
|
|
736
|
+
item.id
|
|
737
|
+
)),
|
|
738
|
+
isLoading && /* @__PURE__ */ jsx10("li", { className: "dropdown-loading", children: /* @__PURE__ */ jsx10(LoadingSpinner, { size: 24 }) }),
|
|
739
|
+
!isLoading && items.length === 0 && /* @__PURE__ */ jsx10("li", { className: "dropdown-empty", children: "N\xE3o encontrado" })
|
|
740
|
+
] }) });
|
|
741
|
+
};
|
|
742
|
+
return /* @__PURE__ */ jsxs7(
|
|
743
|
+
"div",
|
|
744
|
+
{
|
|
745
|
+
className: "input-wrapper",
|
|
746
|
+
style: styleVars,
|
|
747
|
+
tabIndex: -1,
|
|
748
|
+
onBlur: (e) => e.relatedTarget === null && setIsOpen(false),
|
|
749
|
+
children: [
|
|
750
|
+
label && /* @__PURE__ */ jsx10(
|
|
751
|
+
"label",
|
|
752
|
+
{
|
|
753
|
+
htmlFor: name,
|
|
754
|
+
className: `label-input ${isUppercaseLabel && "is-uppercase"}`,
|
|
755
|
+
children: label
|
|
756
|
+
}
|
|
757
|
+
),
|
|
758
|
+
/* @__PURE__ */ jsxs7("div", { style: { position: "relative", width: "100%" }, children: [
|
|
759
|
+
/* @__PURE__ */ jsx10(
|
|
760
|
+
"input",
|
|
761
|
+
{
|
|
762
|
+
ref,
|
|
763
|
+
id: name,
|
|
764
|
+
name,
|
|
765
|
+
disabled,
|
|
766
|
+
placeholder,
|
|
767
|
+
autoComplete: "off",
|
|
768
|
+
className: "input",
|
|
769
|
+
value,
|
|
770
|
+
onChange: (e) => {
|
|
771
|
+
setValue(e.target.value);
|
|
772
|
+
setIsOpen(true);
|
|
773
|
+
},
|
|
774
|
+
onFocus: () => setIsOpen(true),
|
|
775
|
+
...rest
|
|
776
|
+
}
|
|
777
|
+
),
|
|
778
|
+
value && /* @__PURE__ */ jsx10(
|
|
779
|
+
"button",
|
|
780
|
+
{
|
|
781
|
+
type: "button",
|
|
782
|
+
onClick: () => {
|
|
783
|
+
setValue("");
|
|
784
|
+
setItems([]);
|
|
785
|
+
setPageNumber(1);
|
|
786
|
+
onSelect(null);
|
|
787
|
+
},
|
|
788
|
+
className: "dropdown-clear",
|
|
789
|
+
children: /* @__PURE__ */ jsx10(X3, { size: 16, className: "icone-clear" })
|
|
790
|
+
}
|
|
791
|
+
),
|
|
792
|
+
renderDropdown()
|
|
793
|
+
] }),
|
|
794
|
+
!value && !isOpen && /* @__PURE__ */ jsx10(TooltipErrorInput, { error, name })
|
|
795
|
+
]
|
|
796
|
+
}
|
|
797
|
+
);
|
|
798
|
+
};
|
|
799
|
+
var InputAutoComplete = forwardRef4(InputBase3);
|
|
800
|
+
|
|
375
801
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
376
|
-
import { useEffect as
|
|
802
|
+
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
377
803
|
|
|
378
804
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
379
|
-
import { useEffect as
|
|
380
|
-
import { useQuery } from "@tanstack/react-query";
|
|
805
|
+
import { useEffect as useEffect6, useMemo, useState as useState6 } from "react";
|
|
806
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
381
807
|
|
|
382
808
|
// src/primereact-compat.ts
|
|
383
809
|
import { DataTable } from "primereact/datatable";
|
|
@@ -388,8 +814,8 @@ import { Calendar } from "primereact/calendar";
|
|
|
388
814
|
import { FilterMatchMode } from "primereact/api";
|
|
389
815
|
|
|
390
816
|
// src/components/DataTableAdvancedFilter/TableHeader.tsx
|
|
391
|
-
import { X as
|
|
392
|
-
import { jsx as
|
|
817
|
+
import { X as X4 } from "@phosphor-icons/react";
|
|
818
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
393
819
|
var TableHeader = ({
|
|
394
820
|
globalFilterValue,
|
|
395
821
|
onGlobalFilterChange,
|
|
@@ -400,8 +826,8 @@ var TableHeader = ({
|
|
|
400
826
|
target: { value: "" }
|
|
401
827
|
});
|
|
402
828
|
};
|
|
403
|
-
return /* @__PURE__ */
|
|
404
|
-
/* @__PURE__ */
|
|
829
|
+
return /* @__PURE__ */ jsxs8("div", { style: { position: "relative" }, children: [
|
|
830
|
+
/* @__PURE__ */ jsx11(
|
|
405
831
|
InputText,
|
|
406
832
|
{
|
|
407
833
|
value: globalFilterValue,
|
|
@@ -410,7 +836,7 @@ var TableHeader = ({
|
|
|
410
836
|
className: "custom-input input-search"
|
|
411
837
|
}
|
|
412
838
|
),
|
|
413
|
-
/* @__PURE__ */
|
|
839
|
+
/* @__PURE__ */ jsx11(X4, { size: 16, className: "close-search", onClick: limparCampo })
|
|
414
840
|
] });
|
|
415
841
|
};
|
|
416
842
|
var TableHeader_default = TableHeader;
|
|
@@ -440,10 +866,10 @@ function centsToReal(value) {
|
|
|
440
866
|
// src/components/TooltipCustom.tsx
|
|
441
867
|
import { Tooltip as Tooltip2 } from "react-tooltip";
|
|
442
868
|
import { createPortal } from "react-dom";
|
|
443
|
-
import { jsx as
|
|
869
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
444
870
|
function TooltipCustom({ label, id }) {
|
|
445
871
|
return createPortal(
|
|
446
|
-
/* @__PURE__ */
|
|
872
|
+
/* @__PURE__ */ jsx12(
|
|
447
873
|
Tooltip2,
|
|
448
874
|
{
|
|
449
875
|
anchorSelect: `#${id}`,
|
|
@@ -451,7 +877,7 @@ function TooltipCustom({ label, id }) {
|
|
|
451
877
|
positionStrategy: "fixed",
|
|
452
878
|
className: "tooltip-icone",
|
|
453
879
|
style: { zIndex: 13 },
|
|
454
|
-
children: /* @__PURE__ */
|
|
880
|
+
children: /* @__PURE__ */ jsx12("div", { className: "tooltip-custom", children: label })
|
|
455
881
|
}
|
|
456
882
|
),
|
|
457
883
|
document.body
|
|
@@ -459,7 +885,7 @@ function TooltipCustom({ label, id }) {
|
|
|
459
885
|
}
|
|
460
886
|
|
|
461
887
|
// src/components/DataTableAdvancedFilter/TableActions.tsx
|
|
462
|
-
import { Fragment as
|
|
888
|
+
import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
463
889
|
function TableActions({
|
|
464
890
|
onNew,
|
|
465
891
|
onEdit,
|
|
@@ -471,9 +897,9 @@ function TableActions({
|
|
|
471
897
|
const disableButtonsNotMultiplesSelecteds = selectedRows?.length !== 1 ? true : false;
|
|
472
898
|
const enableButtonsNotMultiplesSelecteds = selectedRows?.length > 0 ? true : false;
|
|
473
899
|
const resolvedCustomActions = typeof customActions === "function" ? customActions(selectedRows) : customActions;
|
|
474
|
-
return /* @__PURE__ */
|
|
475
|
-
onNew && /* @__PURE__ */
|
|
476
|
-
/* @__PURE__ */
|
|
900
|
+
return /* @__PURE__ */ jsxs9("div", { className: "box-icones-table-actions", children: [
|
|
901
|
+
onNew && /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
902
|
+
/* @__PURE__ */ jsx13(
|
|
477
903
|
"button",
|
|
478
904
|
{
|
|
479
905
|
id: "add",
|
|
@@ -484,10 +910,10 @@ function TableActions({
|
|
|
484
910
|
enableButtonsNotMultiplesSelecteds && "disable-button-table-actions"
|
|
485
911
|
),
|
|
486
912
|
disabled: enableButtonsNotMultiplesSelecteds,
|
|
487
|
-
children: /* @__PURE__ */
|
|
913
|
+
children: /* @__PURE__ */ jsx13(Plus, { size: 18 })
|
|
488
914
|
}
|
|
489
915
|
),
|
|
490
|
-
/* @__PURE__ */
|
|
916
|
+
/* @__PURE__ */ jsx13(
|
|
491
917
|
TooltipCustom,
|
|
492
918
|
{
|
|
493
919
|
id: "add",
|
|
@@ -495,7 +921,7 @@ function TableActions({
|
|
|
495
921
|
}
|
|
496
922
|
)
|
|
497
923
|
] }),
|
|
498
|
-
onEdit && /* @__PURE__ */
|
|
924
|
+
onEdit && /* @__PURE__ */ jsx13(Fragment4, { children: /* @__PURE__ */ jsxs9(
|
|
499
925
|
"button",
|
|
500
926
|
{
|
|
501
927
|
id: "edit",
|
|
@@ -507,8 +933,8 @@ function TableActions({
|
|
|
507
933
|
),
|
|
508
934
|
disabled: disableButtonsNotMultiplesSelecteds,
|
|
509
935
|
children: [
|
|
510
|
-
/* @__PURE__ */
|
|
511
|
-
/* @__PURE__ */
|
|
936
|
+
/* @__PURE__ */ jsx13(PencilSimple, { size: 18 }),
|
|
937
|
+
/* @__PURE__ */ jsx13(
|
|
512
938
|
TooltipCustom,
|
|
513
939
|
{
|
|
514
940
|
id: "edit",
|
|
@@ -518,7 +944,7 @@ function TableActions({
|
|
|
518
944
|
]
|
|
519
945
|
}
|
|
520
946
|
) }),
|
|
521
|
-
onDelete && /* @__PURE__ */
|
|
947
|
+
onDelete && /* @__PURE__ */ jsx13(Fragment4, { children: /* @__PURE__ */ jsxs9(
|
|
522
948
|
"button",
|
|
523
949
|
{
|
|
524
950
|
id: "delete",
|
|
@@ -530,8 +956,8 @@ function TableActions({
|
|
|
530
956
|
),
|
|
531
957
|
disabled: !enableButtonsNotMultiplesSelecteds,
|
|
532
958
|
children: [
|
|
533
|
-
/* @__PURE__ */
|
|
534
|
-
/* @__PURE__ */
|
|
959
|
+
/* @__PURE__ */ jsx13(Trash, { size: 18 }),
|
|
960
|
+
/* @__PURE__ */ jsx13(
|
|
535
961
|
TooltipCustom,
|
|
536
962
|
{
|
|
537
963
|
id: "delete",
|
|
@@ -543,7 +969,7 @@ function TableActions({
|
|
|
543
969
|
) }),
|
|
544
970
|
resolvedCustomActions?.map((action) => {
|
|
545
971
|
const id = `action-table${phraseToId(action.label)}`;
|
|
546
|
-
return /* @__PURE__ */
|
|
972
|
+
return /* @__PURE__ */ jsxs9(
|
|
547
973
|
"button",
|
|
548
974
|
{
|
|
549
975
|
id,
|
|
@@ -552,7 +978,7 @@ function TableActions({
|
|
|
552
978
|
className: cn("enable-button-table-actions", action.className),
|
|
553
979
|
children: [
|
|
554
980
|
action.icon,
|
|
555
|
-
/* @__PURE__ */
|
|
981
|
+
/* @__PURE__ */ jsx13(TooltipCustom, { id, label: action.label })
|
|
556
982
|
]
|
|
557
983
|
},
|
|
558
984
|
id
|
|
@@ -563,7 +989,7 @@ function TableActions({
|
|
|
563
989
|
|
|
564
990
|
// src/components/DataTableAdvancedFilter/ActionsColumn.tsx
|
|
565
991
|
import { PencilSimple as PencilSimple2, Trash as Trash2 } from "@phosphor-icons/react";
|
|
566
|
-
import { Fragment as
|
|
992
|
+
import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
567
993
|
function ActionsColumn({
|
|
568
994
|
row,
|
|
569
995
|
onEdit,
|
|
@@ -572,8 +998,8 @@ function ActionsColumn({
|
|
|
572
998
|
isLanguagePtBr
|
|
573
999
|
}) {
|
|
574
1000
|
const resolvedCustomActions = typeof customActionsColums === "function" ? customActionsColums(row) : customActionsColums;
|
|
575
|
-
return /* @__PURE__ */
|
|
576
|
-
onEdit && /* @__PURE__ */
|
|
1001
|
+
return /* @__PURE__ */ jsxs10("div", { className: "box-icones-actions-column", children: [
|
|
1002
|
+
onEdit && /* @__PURE__ */ jsx14(Fragment5, { children: /* @__PURE__ */ jsxs10(
|
|
577
1003
|
"button",
|
|
578
1004
|
{
|
|
579
1005
|
id: "edit-column",
|
|
@@ -583,8 +1009,8 @@ function ActionsColumn({
|
|
|
583
1009
|
onEdit && onEdit([row]);
|
|
584
1010
|
},
|
|
585
1011
|
children: [
|
|
586
|
-
/* @__PURE__ */
|
|
587
|
-
/* @__PURE__ */
|
|
1012
|
+
/* @__PURE__ */ jsx14(PencilSimple2, { size: 17, weight: "regular" }),
|
|
1013
|
+
/* @__PURE__ */ jsx14(
|
|
588
1014
|
TooltipCustom,
|
|
589
1015
|
{
|
|
590
1016
|
id: "edit-column",
|
|
@@ -594,7 +1020,7 @@ function ActionsColumn({
|
|
|
594
1020
|
]
|
|
595
1021
|
}
|
|
596
1022
|
) }),
|
|
597
|
-
onDelete && /* @__PURE__ */
|
|
1023
|
+
onDelete && /* @__PURE__ */ jsx14(Fragment5, { children: /* @__PURE__ */ jsxs10(
|
|
598
1024
|
"button",
|
|
599
1025
|
{
|
|
600
1026
|
id: "delete-column",
|
|
@@ -604,8 +1030,8 @@ function ActionsColumn({
|
|
|
604
1030
|
onDelete && onDelete([row]);
|
|
605
1031
|
},
|
|
606
1032
|
children: [
|
|
607
|
-
/* @__PURE__ */
|
|
608
|
-
/* @__PURE__ */
|
|
1033
|
+
/* @__PURE__ */ jsx14(Trash2, { size: 17, weight: "regular" }),
|
|
1034
|
+
/* @__PURE__ */ jsx14(
|
|
609
1035
|
TooltipCustom,
|
|
610
1036
|
{
|
|
611
1037
|
id: "delete-column",
|
|
@@ -617,7 +1043,7 @@ function ActionsColumn({
|
|
|
617
1043
|
) }),
|
|
618
1044
|
resolvedCustomActions?.map((action) => {
|
|
619
1045
|
const id = `action-colunm-${phraseToId(action.label)}`;
|
|
620
|
-
return /* @__PURE__ */
|
|
1046
|
+
return /* @__PURE__ */ jsxs10(
|
|
621
1047
|
"button",
|
|
622
1048
|
{
|
|
623
1049
|
id,
|
|
@@ -626,7 +1052,7 @@ function ActionsColumn({
|
|
|
626
1052
|
className: cn("btn-icone-actions-column", action.className),
|
|
627
1053
|
children: [
|
|
628
1054
|
action.icon,
|
|
629
|
-
/* @__PURE__ */
|
|
1055
|
+
/* @__PURE__ */ jsx14(TooltipCustom, { id, label: action.label })
|
|
630
1056
|
]
|
|
631
1057
|
},
|
|
632
1058
|
id
|
|
@@ -636,7 +1062,7 @@ function ActionsColumn({
|
|
|
636
1062
|
}
|
|
637
1063
|
|
|
638
1064
|
// src/components/DataTableAdvancedFilter/DynamicColumns.tsx
|
|
639
|
-
import { jsx as
|
|
1065
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
640
1066
|
function DynamicColumns({
|
|
641
1067
|
columns,
|
|
642
1068
|
isMultiSelectionMode = true,
|
|
@@ -648,7 +1074,7 @@ function DynamicColumns({
|
|
|
648
1074
|
const array = [];
|
|
649
1075
|
if (isMultiSelectionMode) {
|
|
650
1076
|
array.push(
|
|
651
|
-
/* @__PURE__ */
|
|
1077
|
+
/* @__PURE__ */ jsx15(
|
|
652
1078
|
Column,
|
|
653
1079
|
{
|
|
654
1080
|
selectionMode: "multiple",
|
|
@@ -665,7 +1091,7 @@ function DynamicColumns({
|
|
|
665
1091
|
const width = isActionsCol && col?.size ? col.size + "rem" : "6rem";
|
|
666
1092
|
const placeholder = isLanguagePtBr ? "Procurar" : "Search";
|
|
667
1093
|
array.push(
|
|
668
|
-
/* @__PURE__ */
|
|
1094
|
+
/* @__PURE__ */ jsx15(
|
|
669
1095
|
Column,
|
|
670
1096
|
{
|
|
671
1097
|
field: isActionsCol ? void 0 : col.field,
|
|
@@ -683,7 +1109,7 @@ function DynamicColumns({
|
|
|
683
1109
|
resizeable: col.enableResizeable ?? true
|
|
684
1110
|
},
|
|
685
1111
|
style: isActionsCol ? { width, minWidth: width, position: "relative" } : {},
|
|
686
|
-
body: (rowData) => isActionsCol ? /* @__PURE__ */
|
|
1112
|
+
body: (rowData) => isActionsCol ? /* @__PURE__ */ jsx15(
|
|
687
1113
|
ActionsColumn,
|
|
688
1114
|
{
|
|
689
1115
|
row: rowData,
|
|
@@ -692,7 +1118,7 @@ function DynamicColumns({
|
|
|
692
1118
|
customActionsColums,
|
|
693
1119
|
isLanguagePtBr
|
|
694
1120
|
}
|
|
695
|
-
) : col.body ? col.body(rowData) : /* @__PURE__ */
|
|
1121
|
+
) : col.body ? col.body(rowData) : /* @__PURE__ */ jsx15("span", { children: String(rowData[col.field]) }),
|
|
696
1122
|
sortable: !isActionsCol ? col.enableSorting ?? true : false
|
|
697
1123
|
},
|
|
698
1124
|
`${String(col.field)}-${idx}`
|
|
@@ -703,10 +1129,10 @@ function DynamicColumns({
|
|
|
703
1129
|
}
|
|
704
1130
|
|
|
705
1131
|
// src/hooks/use-debounce.ts
|
|
706
|
-
import { useEffect as
|
|
1132
|
+
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
707
1133
|
var useDebounce = (value, delay) => {
|
|
708
|
-
const [debouncedValue, setDebouncedValue] =
|
|
709
|
-
|
|
1134
|
+
const [debouncedValue, setDebouncedValue] = useState5(value);
|
|
1135
|
+
useEffect5(() => {
|
|
710
1136
|
const timer = setTimeout(() => {
|
|
711
1137
|
setDebouncedValue(value);
|
|
712
1138
|
}, delay || 500);
|
|
@@ -718,7 +1144,7 @@ var useDebounce = (value, delay) => {
|
|
|
718
1144
|
};
|
|
719
1145
|
|
|
720
1146
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
|
|
721
|
-
import { Fragment as
|
|
1147
|
+
import { Fragment as Fragment6, jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
722
1148
|
function DataTableAdvancedFilterWrapper({
|
|
723
1149
|
queryKey,
|
|
724
1150
|
mutationFn,
|
|
@@ -738,8 +1164,8 @@ function DataTableAdvancedFilterWrapper({
|
|
|
738
1164
|
state,
|
|
739
1165
|
onStateChange
|
|
740
1166
|
}) {
|
|
741
|
-
const [isClient, setIsClient] =
|
|
742
|
-
|
|
1167
|
+
const [isClient, setIsClient] = useState6(false);
|
|
1168
|
+
useEffect6(() => {
|
|
743
1169
|
setIsClient(true);
|
|
744
1170
|
}, []);
|
|
745
1171
|
const initialState = state ?? {
|
|
@@ -749,17 +1175,17 @@ function DataTableAdvancedFilterWrapper({
|
|
|
749
1175
|
sortOrder: sortOrderInitial,
|
|
750
1176
|
filter: ""
|
|
751
1177
|
};
|
|
752
|
-
const [page, setPage] =
|
|
753
|
-
const [rows, setRows] =
|
|
754
|
-
const [first, setFirst] =
|
|
755
|
-
const [sortField, setSortField] =
|
|
756
|
-
const [sortOrder, setSortOrder] =
|
|
757
|
-
const [searchText, setSearchText] =
|
|
758
|
-
const [filters, setFilters] =
|
|
1178
|
+
const [page, setPage] = useState6(initialState.page);
|
|
1179
|
+
const [rows, setRows] = useState6(initialState.rows);
|
|
1180
|
+
const [first, setFirst] = useState6((initialState.page - 1) * initialState.rows);
|
|
1181
|
+
const [sortField, setSortField] = useState6(initialState.sortField);
|
|
1182
|
+
const [sortOrder, setSortOrder] = useState6(initialState.sortOrder ?? 1);
|
|
1183
|
+
const [searchText, setSearchText] = useState6(initialState.filter ?? "");
|
|
1184
|
+
const [filters, setFilters] = useState6({
|
|
759
1185
|
...initFilters,
|
|
760
1186
|
global: { value: initialState.filter, matchMode: "contains" }
|
|
761
1187
|
});
|
|
762
|
-
const [selectedRowsData, setSelectedRowsData] =
|
|
1188
|
+
const [selectedRowsData, setSelectedRowsData] = useState6([]);
|
|
763
1189
|
const debouncedSearch = useDebounce(searchText, 500);
|
|
764
1190
|
const debouncedFilters = useMemo(() => {
|
|
765
1191
|
const f = { ...filters };
|
|
@@ -773,7 +1199,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
773
1199
|
(col) => col.filterGlobal === true && (col.field !== "acoes" || col.field !== "actions")
|
|
774
1200
|
).map((col) => col.field) ?? [];
|
|
775
1201
|
}, [columns]);
|
|
776
|
-
const { data: customers, isLoading } =
|
|
1202
|
+
const { data: customers, isLoading } = useQuery2({
|
|
777
1203
|
queryKey: [queryKey, { page, rows, sortField, sortOrder, filtersKey }],
|
|
778
1204
|
queryFn: () => mutationFn(
|
|
779
1205
|
page,
|
|
@@ -784,7 +1210,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
784
1210
|
globalFilterFields
|
|
785
1211
|
)
|
|
786
1212
|
});
|
|
787
|
-
|
|
1213
|
+
useEffect6(() => {
|
|
788
1214
|
if (!state) return;
|
|
789
1215
|
setPage(state.page);
|
|
790
1216
|
setRows(state.rows);
|
|
@@ -840,7 +1266,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
840
1266
|
filter: searchText
|
|
841
1267
|
});
|
|
842
1268
|
};
|
|
843
|
-
|
|
1269
|
+
useEffect6(() => {
|
|
844
1270
|
emitStateChange({
|
|
845
1271
|
page: 1,
|
|
846
1272
|
rows,
|
|
@@ -849,7 +1275,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
849
1275
|
filter: debouncedSearch
|
|
850
1276
|
});
|
|
851
1277
|
}, [debouncedSearch]);
|
|
852
|
-
|
|
1278
|
+
useEffect6(() => {
|
|
853
1279
|
if (customers?.items && selectedRowsData.length > 0) {
|
|
854
1280
|
const currentIds = new Set(customers.items.map((item) => item.id));
|
|
855
1281
|
const filteredSelection = selectedRowsData.filter(
|
|
@@ -861,8 +1287,8 @@ function DataTableAdvancedFilterWrapper({
|
|
|
861
1287
|
}
|
|
862
1288
|
}, [customers?.items, selectedRowsData]);
|
|
863
1289
|
const TableHeaderAndTableActions = useMemo(
|
|
864
|
-
() => /* @__PURE__ */
|
|
865
|
-
globalFilterFields.length > 0 && /* @__PURE__ */
|
|
1290
|
+
() => /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
1291
|
+
globalFilterFields.length > 0 && /* @__PURE__ */ jsx16(
|
|
866
1292
|
TableHeader_default,
|
|
867
1293
|
{
|
|
868
1294
|
isLanguagePtBr,
|
|
@@ -870,7 +1296,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
870
1296
|
onGlobalFilterChange
|
|
871
1297
|
}
|
|
872
1298
|
),
|
|
873
|
-
/* @__PURE__ */
|
|
1299
|
+
/* @__PURE__ */ jsx16(
|
|
874
1300
|
TableActions,
|
|
875
1301
|
{
|
|
876
1302
|
selectedRows: selectedRowsData,
|
|
@@ -893,9 +1319,9 @@ function DataTableAdvancedFilterWrapper({
|
|
|
893
1319
|
customActions
|
|
894
1320
|
]
|
|
895
1321
|
);
|
|
896
|
-
return /* @__PURE__ */
|
|
897
|
-
disablePagination && /* @__PURE__ */
|
|
898
|
-
/* @__PURE__ */
|
|
1322
|
+
return /* @__PURE__ */ jsx16(Fragment6, { children: isClient && /* @__PURE__ */ jsxs11("div", { children: [
|
|
1323
|
+
disablePagination && /* @__PURE__ */ jsx16("div", { className: "disablePagination", children: TableHeaderAndTableActions }),
|
|
1324
|
+
/* @__PURE__ */ jsxs11(
|
|
899
1325
|
DataTable,
|
|
900
1326
|
{
|
|
901
1327
|
value: customers?.items ?? [],
|
|
@@ -921,7 +1347,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
921
1347
|
sortOrder,
|
|
922
1348
|
paginatorTemplate: {
|
|
923
1349
|
layout: "RowsPerPageDropdown PrevPageLink CurrentPageReport NextPageLink",
|
|
924
|
-
RowsPerPageDropdown: (options) => /* @__PURE__ */
|
|
1350
|
+
RowsPerPageDropdown: (options) => /* @__PURE__ */ jsx16(
|
|
925
1351
|
"select",
|
|
926
1352
|
{
|
|
927
1353
|
value: options.value,
|
|
@@ -930,20 +1356,20 @@ function DataTableAdvancedFilterWrapper({
|
|
|
930
1356
|
value: Number(e.target.value)
|
|
931
1357
|
}),
|
|
932
1358
|
className: "custom-input custom-select",
|
|
933
|
-
children: options.options.map((opt) => /* @__PURE__ */
|
|
1359
|
+
children: options.options.map((opt) => /* @__PURE__ */ jsx16("option", { value: opt.value, children: opt.label }, opt.value))
|
|
934
1360
|
}
|
|
935
1361
|
),
|
|
936
|
-
PrevPageLink: (options) => /* @__PURE__ */
|
|
1362
|
+
PrevPageLink: (options) => /* @__PURE__ */ jsx16(
|
|
937
1363
|
"button",
|
|
938
1364
|
{
|
|
939
1365
|
type: "button",
|
|
940
1366
|
onClick: options.onClick,
|
|
941
1367
|
disabled: options.disabled,
|
|
942
1368
|
className: `PrevPage ${options.disabled ? "PrevPageDisabled" : "PrevPageEnabled"}`,
|
|
943
|
-
children: /* @__PURE__ */
|
|
1369
|
+
children: /* @__PURE__ */ jsx16(CaretLeft, { size: 18, color: "#fff" })
|
|
944
1370
|
}
|
|
945
1371
|
),
|
|
946
|
-
CurrentPageReport: (options) => /* @__PURE__ */
|
|
1372
|
+
CurrentPageReport: (options) => /* @__PURE__ */ jsxs11("span", { className: "pageReport", children: [
|
|
947
1373
|
isLanguagePtBr ? "Mostrando" : "Showing",
|
|
948
1374
|
" ",
|
|
949
1375
|
options.first,
|
|
@@ -956,21 +1382,21 @@ function DataTableAdvancedFilterWrapper({
|
|
|
956
1382
|
" ",
|
|
957
1383
|
options.totalRecords
|
|
958
1384
|
] }),
|
|
959
|
-
NextPageLink: (options) => /* @__PURE__ */
|
|
1385
|
+
NextPageLink: (options) => /* @__PURE__ */ jsx16(
|
|
960
1386
|
"button",
|
|
961
1387
|
{
|
|
962
1388
|
type: "button",
|
|
963
1389
|
onClick: options.onClick,
|
|
964
1390
|
disabled: options.disabled,
|
|
965
1391
|
className: `NextPage ${options.disabled ? "NextPageDisabled" : "NextPageEnabled"}`,
|
|
966
|
-
children: /* @__PURE__ */
|
|
1392
|
+
children: /* @__PURE__ */ jsx16(CaretRight, { size: 18, color: "#fff" })
|
|
967
1393
|
}
|
|
968
1394
|
)
|
|
969
1395
|
},
|
|
970
1396
|
paginatorPosition: "top",
|
|
971
|
-
paginatorLeft: /* @__PURE__ */
|
|
1397
|
+
paginatorLeft: /* @__PURE__ */ jsx16("div", { className: "paginatorLeft", children: TableHeaderAndTableActions }),
|
|
972
1398
|
currentPageReportTemplate: "Mostrando {first} a {last} de {totalRecords}",
|
|
973
|
-
emptyMessage: /* @__PURE__ */
|
|
1399
|
+
emptyMessage: /* @__PURE__ */ jsx16("div", { className: "mensagem-nenhum-dado", children: /* @__PURE__ */ jsx16("p", { children: isLanguagePtBr ? "Nenhum dado encontrado" : "No data found" }) }),
|
|
974
1400
|
onFilter: (e) => {
|
|
975
1401
|
const newFilters = { ...e.filters };
|
|
976
1402
|
Object.keys(filters).forEach((key) => {
|
|
@@ -1169,7 +1595,7 @@ var localePtBr = {
|
|
|
1169
1595
|
};
|
|
1170
1596
|
|
|
1171
1597
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
1172
|
-
import { Fragment as
|
|
1598
|
+
import { Fragment as Fragment7, jsx as jsx17 } from "react/jsx-runtime";
|
|
1173
1599
|
function DataTableAdvancedFilter({
|
|
1174
1600
|
queryKey,
|
|
1175
1601
|
mutationFn,
|
|
@@ -1189,21 +1615,21 @@ function DataTableAdvancedFilter({
|
|
|
1189
1615
|
state,
|
|
1190
1616
|
onStateChange
|
|
1191
1617
|
}) {
|
|
1192
|
-
const [isClient, setIsClient] =
|
|
1193
|
-
|
|
1618
|
+
const [isClient, setIsClient] = useState7(false);
|
|
1619
|
+
useEffect7(() => {
|
|
1194
1620
|
addLocale("pt", localePtBr);
|
|
1195
1621
|
}, []);
|
|
1196
|
-
|
|
1622
|
+
useEffect7(() => {
|
|
1197
1623
|
locale(isLanguagePtBr ? "pt" : "en");
|
|
1198
1624
|
}, [isLanguagePtBr]);
|
|
1199
|
-
|
|
1625
|
+
useEffect7(() => {
|
|
1200
1626
|
setIsClient(true);
|
|
1201
1627
|
}, []);
|
|
1202
|
-
return /* @__PURE__ */
|
|
1628
|
+
return /* @__PURE__ */ jsx17(Fragment7, { children: isClient && /* @__PURE__ */ jsx17(
|
|
1203
1629
|
PrimeReactProvider,
|
|
1204
1630
|
{
|
|
1205
1631
|
value: isLanguagePtBr ? { locale: "pt" } : { locale: "en" },
|
|
1206
|
-
children: /* @__PURE__ */
|
|
1632
|
+
children: /* @__PURE__ */ jsx17(
|
|
1207
1633
|
DataTableAdvancedFilterWrapper,
|
|
1208
1634
|
{
|
|
1209
1635
|
rowsPerPageOptions,
|
|
@@ -1230,13 +1656,13 @@ function DataTableAdvancedFilter({
|
|
|
1230
1656
|
}
|
|
1231
1657
|
|
|
1232
1658
|
// src/components/DataTableAdvancedFilter/FilterTemplates.tsx
|
|
1233
|
-
import
|
|
1659
|
+
import Select2 from "react-select";
|
|
1234
1660
|
import { Dropdown } from "primereact/dropdown";
|
|
1235
1661
|
import moment2 from "moment";
|
|
1236
|
-
import { jsx as
|
|
1662
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1237
1663
|
var DateFilterTemplate = (options, mask) => {
|
|
1238
1664
|
const parsedValue = options.value && typeof options.value === "string" ? /* @__PURE__ */ new Date(options.value + "T00:00:00") : options.value;
|
|
1239
|
-
return /* @__PURE__ */
|
|
1665
|
+
return /* @__PURE__ */ jsx18(
|
|
1240
1666
|
Calendar,
|
|
1241
1667
|
{
|
|
1242
1668
|
value: parsedValue,
|
|
@@ -1261,7 +1687,7 @@ var DateFilterTemplate = (options, mask) => {
|
|
|
1261
1687
|
};
|
|
1262
1688
|
var DateTimeFilterTemplate = (options, mask) => {
|
|
1263
1689
|
const value = typeof options.value === "string" ? moment2(options.value).toDate() : options.value ?? null;
|
|
1264
|
-
return /* @__PURE__ */
|
|
1690
|
+
return /* @__PURE__ */ jsx18(
|
|
1265
1691
|
Calendar,
|
|
1266
1692
|
{
|
|
1267
1693
|
value,
|
|
@@ -1295,7 +1721,7 @@ var ValueFilterTemplate = (options, mask) => {
|
|
|
1295
1721
|
const valueToFilter = mask ? mask(rawValue) : rawValue;
|
|
1296
1722
|
options.filterCallback(valueToFilter, options.index);
|
|
1297
1723
|
};
|
|
1298
|
-
return /* @__PURE__ */
|
|
1724
|
+
return /* @__PURE__ */ jsx18(
|
|
1299
1725
|
InputNumber,
|
|
1300
1726
|
{
|
|
1301
1727
|
value: parsedValue,
|
|
@@ -1314,8 +1740,8 @@ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
|
|
|
1314
1740
|
{ label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
|
|
1315
1741
|
];
|
|
1316
1742
|
const currentValue = selectOptions.find((opt) => opt.value === options.value) || null;
|
|
1317
|
-
return /* @__PURE__ */
|
|
1318
|
-
|
|
1743
|
+
return /* @__PURE__ */ jsx18(
|
|
1744
|
+
Select2,
|
|
1319
1745
|
{
|
|
1320
1746
|
options: selectOptions,
|
|
1321
1747
|
value: currentValue,
|
|
@@ -1373,7 +1799,7 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
|
|
|
1373
1799
|
const currentMatchMode = rawFilter.matchMode ?? "contains";
|
|
1374
1800
|
const currentValue = typeof rawFilter.text === "string" ? rawFilter.text : "";
|
|
1375
1801
|
const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
|
|
1376
|
-
return /* @__PURE__ */
|
|
1802
|
+
return /* @__PURE__ */ jsxs12(
|
|
1377
1803
|
"div",
|
|
1378
1804
|
{
|
|
1379
1805
|
className: "filter-wrapper",
|
|
@@ -1384,7 +1810,7 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
|
|
|
1384
1810
|
minWidth: "200px"
|
|
1385
1811
|
},
|
|
1386
1812
|
children: [
|
|
1387
|
-
/* @__PURE__ */
|
|
1813
|
+
/* @__PURE__ */ jsx18(
|
|
1388
1814
|
Dropdown,
|
|
1389
1815
|
{
|
|
1390
1816
|
value: currentMatchMode,
|
|
@@ -1410,7 +1836,7 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
|
|
|
1410
1836
|
}
|
|
1411
1837
|
}
|
|
1412
1838
|
),
|
|
1413
|
-
!isSpecial && /* @__PURE__ */
|
|
1839
|
+
!isSpecial && /* @__PURE__ */ jsx18(
|
|
1414
1840
|
InputText,
|
|
1415
1841
|
{
|
|
1416
1842
|
value: currentValue,
|
|
@@ -1830,6 +2256,9 @@ export {
|
|
|
1830
2256
|
FilterMatchMode5 as FilterMatchMode,
|
|
1831
2257
|
FilterOperator2 as FilterOperator,
|
|
1832
2258
|
Input,
|
|
2259
|
+
InputAutoComplete,
|
|
2260
|
+
InputSelect,
|
|
2261
|
+
LeafcodeThemeProvider,
|
|
1833
2262
|
ModalBase,
|
|
1834
2263
|
SelectFilterTemplate,
|
|
1835
2264
|
TextArea,
|
|
@@ -1837,6 +2266,7 @@ export {
|
|
|
1837
2266
|
buildDynamicCampoFilters,
|
|
1838
2267
|
buildSortingWithFilters,
|
|
1839
2268
|
customMatchModes,
|
|
2269
|
+
defaultTheme,
|
|
1840
2270
|
getDefaultFilterMatchOptionsDate,
|
|
1841
2271
|
getDefaultFilterMatchOptionsEnum,
|
|
1842
2272
|
getDefaultFilterMatchOptionsEnumNotNullable,
|