teraprox-ui-kit 0.1.7 → 0.1.8
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/package.json +1 -1
- package/dist/index.css +0 -152
- package/dist/index.js +0 -2259
- package/dist/index.mjs +0 -2198
package/dist/index.js
DELETED
|
@@ -1,2259 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
ActionButtons: () => ActionButtons,
|
|
34
|
-
AddButton: () => AddButton_default,
|
|
35
|
-
ApproveAndReproveButtons: () => ApproveAndReproveButtons,
|
|
36
|
-
AsyncButton: () => AsyncButton,
|
|
37
|
-
AutoComplete: () => AutoComplete,
|
|
38
|
-
ClickToWriteField: () => ClickToWriteField,
|
|
39
|
-
ColorPicker: () => ColorPicker,
|
|
40
|
-
ConfigObject: () => ConfigObject,
|
|
41
|
-
DeleteButton: () => DeleteButton_default,
|
|
42
|
-
DeleteConfirm: () => DeleteConfirm,
|
|
43
|
-
FindRecursoByTagField: () => FindRecursoByTagField,
|
|
44
|
-
FormField: () => FormField,
|
|
45
|
-
Generic3DotMenu: () => Generic3DotMenu,
|
|
46
|
-
GenericDisplay: () => GenericDisplay_default,
|
|
47
|
-
GenericForm: () => GenericForm_default,
|
|
48
|
-
GenericSelect: () => GenericSelect_default,
|
|
49
|
-
GenericSelectOps: () => GenericSelectOps,
|
|
50
|
-
IconLabelItem: () => IconLabelItem,
|
|
51
|
-
IconLabelList: () => IconLabelList,
|
|
52
|
-
LoadingButton: () => LoadingButton,
|
|
53
|
-
LoadingProgress: () => LoadingProgress,
|
|
54
|
-
MailSender: () => MailSender,
|
|
55
|
-
MenuEvent: () => MenuEvent,
|
|
56
|
-
NavigateButton: () => NavigateButton,
|
|
57
|
-
QrCodeScanButton: () => QrCodeScanButton,
|
|
58
|
-
QrReader: () => QrReader,
|
|
59
|
-
ResponsiveContainer: () => ResponsiveContainer_default,
|
|
60
|
-
StatusBadge: () => StatusBadge,
|
|
61
|
-
StatusIndicator: () => StatusIndicator,
|
|
62
|
-
Switch: () => Switch,
|
|
63
|
-
SwitchOnClick: () => SwitchOnClick,
|
|
64
|
-
UploadArea: () => UploadArea,
|
|
65
|
-
UuidPill: () => UuidPill_default,
|
|
66
|
-
VerticalItemsDisplay: () => VerticalItemsDisplay
|
|
67
|
-
});
|
|
68
|
-
module.exports = __toCommonJS(index_exports);
|
|
69
|
-
|
|
70
|
-
// src/buttons/AddButton.tsx
|
|
71
|
-
var import_react_bootstrap = require("react-bootstrap");
|
|
72
|
-
var import_gr = require("react-icons/gr");
|
|
73
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
74
|
-
var AddButton = ({ callback, hiddenBool, size }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
|
-
import_react_bootstrap.Button,
|
|
76
|
-
{
|
|
77
|
-
hidden: hiddenBool || false,
|
|
78
|
-
variant: "outline-primary",
|
|
79
|
-
onClick: () => callback(),
|
|
80
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_gr.GrAdd, { size: size || 25 })
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
var AddButton_default = AddButton;
|
|
84
|
-
|
|
85
|
-
// src/buttons/DeleteButton.tsx
|
|
86
|
-
var import_react_bootstrap2 = require("react-bootstrap");
|
|
87
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
88
|
-
var DeleteButton = ({ title, onDeleteClick }) => {
|
|
89
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_bootstrap2.Button, { variant: "danger", onClick: () => onDeleteClick(), children: title });
|
|
90
|
-
};
|
|
91
|
-
var DeleteButton_default = DeleteButton;
|
|
92
|
-
|
|
93
|
-
// src/buttons/ActionButtons.tsx
|
|
94
|
-
var import_react2 = require("react");
|
|
95
|
-
var import_react_bootstrap4 = require("react-bootstrap");
|
|
96
|
-
var import_fi = require("react-icons/fi");
|
|
97
|
-
|
|
98
|
-
// src/forms/DeleteConfirm.tsx
|
|
99
|
-
var import_react = require("react");
|
|
100
|
-
var import_react_bootstrap3 = require("react-bootstrap");
|
|
101
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
102
|
-
var DeleteConfirm = ({
|
|
103
|
-
show,
|
|
104
|
-
onHide,
|
|
105
|
-
onConfirm,
|
|
106
|
-
title = "Confirma\xE7\xE3o de Exclus\xE3o",
|
|
107
|
-
dialogText,
|
|
108
|
-
payload,
|
|
109
|
-
needExclusionDetails = false
|
|
110
|
-
}) => {
|
|
111
|
-
const [exclusionDetails, setExclusionDetails] = (0, import_react.useState)("");
|
|
112
|
-
const getDialogContent = () => {
|
|
113
|
-
if (typeof dialogText === "function" && payload) {
|
|
114
|
-
return dialogText(payload);
|
|
115
|
-
}
|
|
116
|
-
return dialogText || "Voc\xEA tem certeza que deseja excluir este item?";
|
|
117
|
-
};
|
|
118
|
-
const isConfirmEnabled = () => {
|
|
119
|
-
if (!needExclusionDetails) return true;
|
|
120
|
-
return exclusionDetails.length >= 8;
|
|
121
|
-
};
|
|
122
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_bootstrap3.Modal, { show, onHide: () => onHide(false), centered: true, children: [
|
|
123
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_bootstrap3.Modal.Header, { closeButton: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_bootstrap3.Modal.Title, { children: title }) }),
|
|
124
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_bootstrap3.Modal.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "d-flex flex-column gap-3", children: [
|
|
125
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: getDialogContent() }) }),
|
|
126
|
-
needExclusionDetails && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_bootstrap3.Form.Group, { children: [
|
|
127
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_bootstrap3.Form.Label, { children: "Motivo da Exclus\xE3o (m\xEDn. 8 caracteres)" }),
|
|
128
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
129
|
-
import_react_bootstrap3.Form.Control,
|
|
130
|
-
{
|
|
131
|
-
as: "textarea",
|
|
132
|
-
rows: 3,
|
|
133
|
-
value: exclusionDetails,
|
|
134
|
-
onChange: (e) => setExclusionDetails(e.target.value),
|
|
135
|
-
placeholder: "Descreva o motivo...",
|
|
136
|
-
autoFocus: true
|
|
137
|
-
}
|
|
138
|
-
)
|
|
139
|
-
] })
|
|
140
|
-
] }) }),
|
|
141
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_bootstrap3.Modal.Footer, { children: [
|
|
142
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_bootstrap3.Button, { variant: "secondary", onClick: () => onHide(false), children: "Cancelar" }),
|
|
143
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
144
|
-
import_react_bootstrap3.Button,
|
|
145
|
-
{
|
|
146
|
-
variant: "danger",
|
|
147
|
-
disabled: !isConfirmEnabled(),
|
|
148
|
-
onClick: () => {
|
|
149
|
-
onConfirm(exclusionDetails);
|
|
150
|
-
onHide(false);
|
|
151
|
-
},
|
|
152
|
-
children: "Confirmar Exclus\xE3o"
|
|
153
|
-
}
|
|
154
|
-
)
|
|
155
|
-
] })
|
|
156
|
-
] });
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
// src/buttons/ActionButtons.tsx
|
|
160
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
161
|
-
var ActionButtons = ({
|
|
162
|
-
onSave,
|
|
163
|
-
saveLabel = "Salvar",
|
|
164
|
-
saveVariant = "primary",
|
|
165
|
-
disabled = false,
|
|
166
|
-
onDelete,
|
|
167
|
-
deleteLabel = "Excluir",
|
|
168
|
-
deleteConfirmMsg,
|
|
169
|
-
needExclusionDetails = false,
|
|
170
|
-
onBack,
|
|
171
|
-
backLabel = "Voltar",
|
|
172
|
-
onCancelEdit,
|
|
173
|
-
cancelEditLabel = "Cancelar",
|
|
174
|
-
onCopy,
|
|
175
|
-
copyLabel = "Copiar Formul\xE1rio",
|
|
176
|
-
isEditing = false,
|
|
177
|
-
useDelayedDelete = false,
|
|
178
|
-
delayedDeleteTimeout = 3e3,
|
|
179
|
-
PermissionWrapper = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children })
|
|
180
|
-
}) => {
|
|
181
|
-
const [showConfirm, setShowConfirm] = (0, import_react2.useState)(false);
|
|
182
|
-
const [isHolding, setIsHolding] = (0, import_react2.useState)(false);
|
|
183
|
-
const [progress, setProgress] = (0, import_react2.useState)(0);
|
|
184
|
-
const timeoutRef = (0, import_react2.useRef)(null);
|
|
185
|
-
const intervalRef = (0, import_react2.useRef)(null);
|
|
186
|
-
const startHold = () => {
|
|
187
|
-
if (disabled || !onDelete) return;
|
|
188
|
-
setIsHolding(true);
|
|
189
|
-
setProgress(0);
|
|
190
|
-
const step = 2;
|
|
191
|
-
const tickTime = delayedDeleteTimeout / (100 / step);
|
|
192
|
-
intervalRef.current = setInterval(() => {
|
|
193
|
-
setProgress((prev) => prev >= 100 ? 100 : prev + step);
|
|
194
|
-
}, tickTime);
|
|
195
|
-
timeoutRef.current = setTimeout(() => {
|
|
196
|
-
stopHold();
|
|
197
|
-
onDelete();
|
|
198
|
-
}, delayedDeleteTimeout);
|
|
199
|
-
};
|
|
200
|
-
const stopHold = () => {
|
|
201
|
-
setIsHolding(false);
|
|
202
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
203
|
-
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
204
|
-
setProgress(0);
|
|
205
|
-
};
|
|
206
|
-
const renderDeleteButton = () => {
|
|
207
|
-
if (!onDelete || !isEditing) return null;
|
|
208
|
-
if (useDelayedDelete) {
|
|
209
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { position: "relative", display: "inline-block", margin: 2 }, children: [
|
|
210
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
211
|
-
import_react_bootstrap4.Button,
|
|
212
|
-
{
|
|
213
|
-
variant: "outline-danger",
|
|
214
|
-
onMouseDown: startHold,
|
|
215
|
-
onMouseUp: stopHold,
|
|
216
|
-
onMouseLeave: stopHold,
|
|
217
|
-
onTouchStart: startHold,
|
|
218
|
-
onTouchEnd: stopHold,
|
|
219
|
-
disabled,
|
|
220
|
-
style: { minWidth: "120px" },
|
|
221
|
-
children: [
|
|
222
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_fi.FiTrash2, { className: "me-2" }),
|
|
223
|
-
isHolding ? "Segure..." : deleteLabel
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
),
|
|
227
|
-
isHolding && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
228
|
-
import_react_bootstrap4.ProgressBar,
|
|
229
|
-
{
|
|
230
|
-
now: progress,
|
|
231
|
-
style: {
|
|
232
|
-
position: "absolute",
|
|
233
|
-
bottom: 0,
|
|
234
|
-
left: 0,
|
|
235
|
-
right: 0,
|
|
236
|
-
height: "4px",
|
|
237
|
-
borderRadius: "0 0 4px 4px"
|
|
238
|
-
},
|
|
239
|
-
variant: "danger"
|
|
240
|
-
}
|
|
241
|
-
)
|
|
242
|
-
] });
|
|
243
|
-
}
|
|
244
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
245
|
-
import_react_bootstrap4.Button,
|
|
246
|
-
{
|
|
247
|
-
variant: "danger",
|
|
248
|
-
onClick: () => setShowConfirm(true),
|
|
249
|
-
disabled,
|
|
250
|
-
style: { margin: 2 },
|
|
251
|
-
children: [
|
|
252
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_fi.FiTrash2, { className: "me-2" }),
|
|
253
|
-
deleteLabel
|
|
254
|
-
]
|
|
255
|
-
}
|
|
256
|
-
);
|
|
257
|
-
};
|
|
258
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
259
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
260
|
-
DeleteConfirm,
|
|
261
|
-
{
|
|
262
|
-
show: showConfirm,
|
|
263
|
-
onHide: setShowConfirm,
|
|
264
|
-
onConfirm: (details) => onDelete && onDelete(details),
|
|
265
|
-
dialogText: deleteConfirmMsg,
|
|
266
|
-
needExclusionDetails
|
|
267
|
-
}
|
|
268
|
-
),
|
|
269
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_bootstrap4.Form.Group, { className: "d-flex flex-wrap align-items-center mt-3 gap-1", children: [
|
|
270
|
-
onBack && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_bootstrap4.Button, { variant: "outline-secondary", onClick: onBack, disabled, style: { margin: 2 }, children: [
|
|
271
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_fi.FiChevronLeft, { className: "me-2" }),
|
|
272
|
-
backLabel
|
|
273
|
-
] }),
|
|
274
|
-
isEditing && onCancelEdit && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_bootstrap4.Button, { variant: "warning", onClick: onCancelEdit, disabled, style: { margin: 2 }, children: [
|
|
275
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_fi.FiRotateCcw, { className: "me-2" }),
|
|
276
|
-
cancelEditLabel
|
|
277
|
-
] }),
|
|
278
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PermissionWrapper, { children: renderDeleteButton() }),
|
|
279
|
-
onSave && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_bootstrap4.Button, { variant: saveVariant, onClick: onSave, disabled, style: { margin: 2 }, children: [
|
|
280
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_fi.FiSave, { className: "me-2" }),
|
|
281
|
-
saveLabel
|
|
282
|
-
] }),
|
|
283
|
-
isEditing && onCopy && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_bootstrap4.Button, { variant: "outline-primary", onClick: onCopy, disabled, style: { margin: 2 }, children: [
|
|
284
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_fi.FiCopy, { className: "me-2" }),
|
|
285
|
-
copyLabel
|
|
286
|
-
] })
|
|
287
|
-
] })
|
|
288
|
-
] });
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
// src/buttons/ApproveAndReproveButtons.tsx
|
|
292
|
-
var import_react3 = require("react");
|
|
293
|
-
var import_react_bootstrap5 = require("react-bootstrap");
|
|
294
|
-
var import_gr2 = require("react-icons/gr");
|
|
295
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
296
|
-
var ApproveAndReproveButtons = ({
|
|
297
|
-
buttonSize = 25,
|
|
298
|
-
approveCallback,
|
|
299
|
-
reproveCallback,
|
|
300
|
-
cancelCallback,
|
|
301
|
-
headerText = "Aprovar?",
|
|
302
|
-
approveText,
|
|
303
|
-
repproveText
|
|
304
|
-
}) => {
|
|
305
|
-
(0, import_react3.useEffect)(() => {
|
|
306
|
-
const keyboardHandler = (e) => {
|
|
307
|
-
if (e.key === "Escape") {
|
|
308
|
-
cancelCallback();
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
window.document.addEventListener("keydown", keyboardHandler);
|
|
312
|
-
return () => window.document.removeEventListener("keydown", keyboardHandler);
|
|
313
|
-
}, [cancelCallback]);
|
|
314
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
315
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: headerText }),
|
|
316
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("br", {}),
|
|
317
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_bootstrap5.Button, { onClick: approveCallback, variant: "success", className: "me-1", children: approveText ? approveText : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_gr2.GrCheckmark, { size: buttonSize }) }),
|
|
318
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_bootstrap5.Button, { onClick: reproveCallback, variant: "danger", children: repproveText ? repproveText : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_gr2.GrClose, { size: buttonSize }) })
|
|
319
|
-
] });
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
// src/buttons/AsyncButton.tsx
|
|
323
|
-
var import_react4 = require("react");
|
|
324
|
-
var import_react_bootstrap7 = require("react-bootstrap");
|
|
325
|
-
|
|
326
|
-
// src/progress/LoadingProgress.tsx
|
|
327
|
-
var import_react_bootstrap6 = require("react-bootstrap");
|
|
328
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
329
|
-
var LoadingProgress = ({ hidden }) => {
|
|
330
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_bootstrap6.Spinner, { hidden, animation: "border", role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "visually-hidden", children: "Carregando..." }) });
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
// src/buttons/AsyncButton.tsx
|
|
334
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
335
|
-
var useAsyncAction = () => {
|
|
336
|
-
const [loading, setLoading] = (0, import_react4.useState)(false);
|
|
337
|
-
const isMounted = (0, import_react4.useRef)(true);
|
|
338
|
-
const isProcessing = (0, import_react4.useRef)(false);
|
|
339
|
-
const execute = async (action) => {
|
|
340
|
-
if (typeof action !== "function") {
|
|
341
|
-
throw new Error("A\xE7\xE3o inv\xE1lida: n\xE3o \xE9 uma fun\xE7\xE3o");
|
|
342
|
-
}
|
|
343
|
-
if (!action || isProcessing.current) return;
|
|
344
|
-
isProcessing.current = true;
|
|
345
|
-
setLoading(true);
|
|
346
|
-
try {
|
|
347
|
-
await action();
|
|
348
|
-
} catch (error) {
|
|
349
|
-
console.error("Async operation failed:", error);
|
|
350
|
-
} finally {
|
|
351
|
-
if (isMounted.current) {
|
|
352
|
-
setLoading(false);
|
|
353
|
-
isProcessing.current = false;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
return { loading, execute };
|
|
358
|
-
};
|
|
359
|
-
var AsyncButton = ({
|
|
360
|
-
onClick,
|
|
361
|
-
children,
|
|
362
|
-
loadingComponent = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LoadingProgress, {}),
|
|
363
|
-
buttonProps
|
|
364
|
-
}) => {
|
|
365
|
-
const { loading, execute } = useAsyncAction();
|
|
366
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
367
|
-
import_react_bootstrap7.Button,
|
|
368
|
-
{
|
|
369
|
-
...buttonProps,
|
|
370
|
-
onClick: () => execute(onClick),
|
|
371
|
-
disabled: loading || buttonProps && buttonProps.disabled,
|
|
372
|
-
children: loading ? loadingComponent : children
|
|
373
|
-
}
|
|
374
|
-
);
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
// src/buttons/Generic3DotMenu.tsx
|
|
378
|
-
var import_react5 = require("react");
|
|
379
|
-
var import_react_bootstrap8 = require("react-bootstrap");
|
|
380
|
-
var import_ci = require("react-icons/ci");
|
|
381
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
382
|
-
var MenuEvent = class {
|
|
383
|
-
/**
|
|
384
|
-
* @param label - O texto que aparecerá no botão.
|
|
385
|
-
* @param callback - A função a ser chamada quando o botão for clicado.
|
|
386
|
-
* @param variant - A variante do botão (padrão: 'primary').
|
|
387
|
-
* @param renderCondition - Condição para renderizar o botão.
|
|
388
|
-
* @param section - A seção para organizar os botões (padrão: 'default').
|
|
389
|
-
*/
|
|
390
|
-
constructor(label, callback, variant = "primary", renderCondition = true, section = "default") {
|
|
391
|
-
this.label = label;
|
|
392
|
-
this.callback = callback;
|
|
393
|
-
this.variant = variant;
|
|
394
|
-
this.renderCondition = renderCondition;
|
|
395
|
-
this.section = section;
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
var Generic3DotMenu = ({
|
|
399
|
-
events,
|
|
400
|
-
tittle = "Op\xE7\xF5es de Controle"
|
|
401
|
-
}) => {
|
|
402
|
-
const [show, setShow] = (0, import_react5.useState)(false);
|
|
403
|
-
const handleClose = () => setShow(false);
|
|
404
|
-
const handleShow = () => setShow(true);
|
|
405
|
-
const shouldRender = (event) => {
|
|
406
|
-
return typeof event.renderCondition === "function" ? event.renderCondition() : event.renderCondition;
|
|
407
|
-
};
|
|
408
|
-
const groupedEvents = events.reduce((sections, event) => {
|
|
409
|
-
const section = event.section || "default";
|
|
410
|
-
if (!sections[section]) {
|
|
411
|
-
sections[section] = [];
|
|
412
|
-
}
|
|
413
|
-
if (shouldRender(event)) {
|
|
414
|
-
sections[section].push(event);
|
|
415
|
-
}
|
|
416
|
-
return sections;
|
|
417
|
-
}, {});
|
|
418
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
419
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ci.CiMenuKebab, { onClick: handleShow, style: { cursor: "pointer" }, size: 25, title: tittle }),
|
|
420
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_bootstrap8.Modal, { show, onHide: handleClose, centered: true, children: [
|
|
421
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_bootstrap8.Modal.Header, { closeButton: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_bootstrap8.Modal.Title, { children: tittle }) }),
|
|
422
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_bootstrap8.Modal.Body, { children: [
|
|
423
|
-
Object.keys(groupedEvents).length === 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-center text-muted", children: "Nenhuma op\xE7\xE3o dispon\xEDvel." }),
|
|
424
|
-
Object.keys(groupedEvents).map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "mb-4", children: [
|
|
425
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h6", { className: "border-bottom pb-2 mb-3", children: section !== "default" ? section : "Op\xE7\xF5es Principais" }),
|
|
426
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "d-grid gap-2", children: groupedEvents[section].map((event, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
427
|
-
import_react_bootstrap8.Button,
|
|
428
|
-
{
|
|
429
|
-
variant: event.variant || "primary",
|
|
430
|
-
onClick: () => {
|
|
431
|
-
event.callback();
|
|
432
|
-
handleClose();
|
|
433
|
-
},
|
|
434
|
-
children: event.label
|
|
435
|
-
},
|
|
436
|
-
index
|
|
437
|
-
)) })
|
|
438
|
-
] }, sectionIndex))
|
|
439
|
-
] }),
|
|
440
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_bootstrap8.Modal.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_bootstrap8.Button, { variant: "secondary", onClick: handleClose, children: "Fechar" }) })
|
|
441
|
-
] })
|
|
442
|
-
] });
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
// src/buttons/LoadingButton.tsx
|
|
446
|
-
var import_react_bootstrap9 = require("react-bootstrap");
|
|
447
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
448
|
-
var LoadingButton = ({
|
|
449
|
-
onClick,
|
|
450
|
-
loading = false,
|
|
451
|
-
label = "Enviar",
|
|
452
|
-
variant = "primary",
|
|
453
|
-
size = "md",
|
|
454
|
-
disabled = false,
|
|
455
|
-
icon = null,
|
|
456
|
-
className = "",
|
|
457
|
-
loadingLabel = "Carregando...",
|
|
458
|
-
...props
|
|
459
|
-
}) => {
|
|
460
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
461
|
-
import_react_bootstrap9.Button,
|
|
462
|
-
{
|
|
463
|
-
variant,
|
|
464
|
-
size,
|
|
465
|
-
disabled: disabled || loading,
|
|
466
|
-
onClick,
|
|
467
|
-
className: `loading-button ${className}`,
|
|
468
|
-
style: { cursor: loading ? "not-allowed" : "pointer" },
|
|
469
|
-
...props,
|
|
470
|
-
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "align-items-center", children: [
|
|
471
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
472
|
-
import_react_bootstrap9.Spinner,
|
|
473
|
-
{
|
|
474
|
-
as: "span",
|
|
475
|
-
animation: "border",
|
|
476
|
-
size: "sm",
|
|
477
|
-
role: "status",
|
|
478
|
-
"aria-hidden": "true",
|
|
479
|
-
className: "me-2"
|
|
480
|
-
}
|
|
481
|
-
),
|
|
482
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: loadingLabel })
|
|
483
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "align-items-center", children: [
|
|
484
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "me-2 d-flex", children: icon }),
|
|
485
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: label })
|
|
486
|
-
] })
|
|
487
|
-
}
|
|
488
|
-
);
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
// src/buttons/NavigateButton.tsx
|
|
492
|
-
var import_react_bootstrap10 = require("react-bootstrap");
|
|
493
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
494
|
-
var NavigateButton = ({
|
|
495
|
-
displayName,
|
|
496
|
-
path,
|
|
497
|
-
config,
|
|
498
|
-
pageName,
|
|
499
|
-
navigator: navigator2,
|
|
500
|
-
onBeforeNavigate,
|
|
501
|
-
variant = "outline-primary",
|
|
502
|
-
style,
|
|
503
|
-
...props
|
|
504
|
-
}) => {
|
|
505
|
-
const handleClick = () => {
|
|
506
|
-
if (onBeforeNavigate) {
|
|
507
|
-
onBeforeNavigate();
|
|
508
|
-
}
|
|
509
|
-
navigator2(path, config, pageName);
|
|
510
|
-
};
|
|
511
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
512
|
-
import_react_bootstrap10.Button,
|
|
513
|
-
{
|
|
514
|
-
style,
|
|
515
|
-
variant,
|
|
516
|
-
onClick: handleClick,
|
|
517
|
-
...props,
|
|
518
|
-
children: displayName
|
|
519
|
-
}
|
|
520
|
-
);
|
|
521
|
-
};
|
|
522
|
-
|
|
523
|
-
// src/buttons/StatusBadge.tsx
|
|
524
|
-
var import_react_bootstrap11 = require("react-bootstrap");
|
|
525
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
526
|
-
var StatusBadge = ({
|
|
527
|
-
status,
|
|
528
|
-
showCheckbox = false,
|
|
529
|
-
checked = false,
|
|
530
|
-
onToggle = () => {
|
|
531
|
-
},
|
|
532
|
-
loading = false,
|
|
533
|
-
customStatusClasses
|
|
534
|
-
}) => {
|
|
535
|
-
const statusClasses = customStatusClasses || {
|
|
536
|
-
PENDENTE: "bg-warning text-dark",
|
|
537
|
-
EXECUTANDO: "bg-success text-white",
|
|
538
|
-
CONCLUIDO: "bg-secondary text-white",
|
|
539
|
-
CANCELED: "bg-danger text-white"
|
|
540
|
-
};
|
|
541
|
-
const badgeClass = statusClasses[status] || "bg-secondary text-white";
|
|
542
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "d-flex align-items-center gap-2", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_bootstrap11.Spinner, { animation: "border", size: "sm" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
543
|
-
showCheckbox && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
544
|
-
import_react_bootstrap11.Form.Check,
|
|
545
|
-
{
|
|
546
|
-
type: "checkbox",
|
|
547
|
-
checked,
|
|
548
|
-
onChange: onToggle,
|
|
549
|
-
className: "me-1"
|
|
550
|
-
}
|
|
551
|
-
),
|
|
552
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: `badge ${badgeClass}`, children: status })
|
|
553
|
-
] }) });
|
|
554
|
-
};
|
|
555
|
-
|
|
556
|
-
// src/buttons/SwitchOnClick.tsx
|
|
557
|
-
var import_react6 = require("react");
|
|
558
|
-
var import_fa = require("react-icons/fa");
|
|
559
|
-
var import_gr3 = require("react-icons/gr");
|
|
560
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
561
|
-
var SwitchOnClick = ({
|
|
562
|
-
children,
|
|
563
|
-
placeHolder = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
564
|
-
"div",
|
|
565
|
-
{
|
|
566
|
-
className: "text-center zoom-container",
|
|
567
|
-
style: {
|
|
568
|
-
fontSize: "1.2rem",
|
|
569
|
-
color: "#666"
|
|
570
|
-
},
|
|
571
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
572
|
-
import_gr3.GrAddCircle,
|
|
573
|
-
{
|
|
574
|
-
size: 25,
|
|
575
|
-
className: "mb-2",
|
|
576
|
-
style: { cursor: "pointer" }
|
|
577
|
-
}
|
|
578
|
-
)
|
|
579
|
-
}
|
|
580
|
-
),
|
|
581
|
-
onSwitchClick,
|
|
582
|
-
onCancel,
|
|
583
|
-
containerClassName = ""
|
|
584
|
-
}) => {
|
|
585
|
-
const [clicked, setClicked] = (0, import_react6.useState)(false);
|
|
586
|
-
const handleClick = () => {
|
|
587
|
-
onSwitchClick && onSwitchClick();
|
|
588
|
-
setClicked(!clicked);
|
|
589
|
-
};
|
|
590
|
-
const handleClose = () => {
|
|
591
|
-
setClicked(false);
|
|
592
|
-
onCancel && onCancel();
|
|
593
|
-
};
|
|
594
|
-
(0, import_react6.useEffect)(() => {
|
|
595
|
-
const handleEscape = (event) => {
|
|
596
|
-
if (event.key === "Escape") {
|
|
597
|
-
handleClose();
|
|
598
|
-
}
|
|
599
|
-
};
|
|
600
|
-
window.addEventListener("keydown", handleEscape);
|
|
601
|
-
return () => window.removeEventListener("keydown", handleEscape);
|
|
602
|
-
}, []);
|
|
603
|
-
if (!clicked) {
|
|
604
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { onClick: handleClick, style: { cursor: "pointer" }, children: placeHolder });
|
|
605
|
-
}
|
|
606
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `switch-on-click-container ${containerClassName}`, children: [
|
|
607
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "close-icon", onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_fa.FaTimes, { title: "Fechar" }) }),
|
|
608
|
-
children({ handleClose })
|
|
609
|
-
] });
|
|
610
|
-
};
|
|
611
|
-
|
|
612
|
-
// src/containers/ResponsiveContainer.tsx
|
|
613
|
-
var import_react_bootstrap12 = require("react-bootstrap");
|
|
614
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
615
|
-
var ResponsiveContainer = ({
|
|
616
|
-
title,
|
|
617
|
-
show,
|
|
618
|
-
setShow,
|
|
619
|
-
children,
|
|
620
|
-
onClose,
|
|
621
|
-
scrollable = false
|
|
622
|
-
}) => {
|
|
623
|
-
const handleClose = () => {
|
|
624
|
-
setShow(false);
|
|
625
|
-
if (onClose) onClose();
|
|
626
|
-
};
|
|
627
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_bootstrap12.Modal, { size: "lg", show, onHide: handleClose, scrollable, children: [
|
|
628
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_bootstrap12.Modal.Header, { closeButton: true, onClick: handleClose }),
|
|
629
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_bootstrap12.ModalBody, { children })
|
|
630
|
-
] });
|
|
631
|
-
};
|
|
632
|
-
var ResponsiveContainer_default = ResponsiveContainer;
|
|
633
|
-
|
|
634
|
-
// src/displays/UuidPill.tsx
|
|
635
|
-
var import_react7 = require("react");
|
|
636
|
-
var import_react_bootstrap13 = require("react-bootstrap");
|
|
637
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
638
|
-
var UuidPill = ({ uuid, bg = "light", textColor = "dark", short = 8 }) => {
|
|
639
|
-
const [copied, setCopied] = (0, import_react7.useState)(false);
|
|
640
|
-
const ref = (0, import_react7.useRef)(null);
|
|
641
|
-
const [showTooltip, setShowTooltip] = (0, import_react7.useState)(false);
|
|
642
|
-
if (!uuid) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-muted", children: "\u2014" });
|
|
643
|
-
const shortId = String(uuid).substring(0, short);
|
|
644
|
-
const handleCopy = async (e) => {
|
|
645
|
-
e.stopPropagation();
|
|
646
|
-
try {
|
|
647
|
-
await navigator.clipboard.writeText(uuid);
|
|
648
|
-
} catch (e2) {
|
|
649
|
-
const ta = document.createElement("textarea");
|
|
650
|
-
ta.value = uuid;
|
|
651
|
-
document.body.appendChild(ta);
|
|
652
|
-
ta.select();
|
|
653
|
-
document.execCommand("copy");
|
|
654
|
-
document.body.removeChild(ta);
|
|
655
|
-
}
|
|
656
|
-
setCopied(true);
|
|
657
|
-
setTimeout(() => setCopied(false), 1500);
|
|
658
|
-
};
|
|
659
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
660
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
661
|
-
import_react_bootstrap13.Badge,
|
|
662
|
-
{
|
|
663
|
-
ref,
|
|
664
|
-
bg,
|
|
665
|
-
text: textColor,
|
|
666
|
-
pill: true,
|
|
667
|
-
className: "border px-2 py-1",
|
|
668
|
-
style: { cursor: "pointer", fontFamily: "monospace", fontSize: "0.8rem", userSelect: "none" },
|
|
669
|
-
onClick: handleCopy,
|
|
670
|
-
onMouseEnter: () => setShowTooltip(true),
|
|
671
|
-
onMouseLeave: () => {
|
|
672
|
-
setShowTooltip(false);
|
|
673
|
-
setCopied(false);
|
|
674
|
-
},
|
|
675
|
-
children: [
|
|
676
|
-
shortId,
|
|
677
|
-
"\u2026"
|
|
678
|
-
]
|
|
679
|
-
}
|
|
680
|
-
),
|
|
681
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_bootstrap13.Overlay, { target: ref.current, show: showTooltip, placement: "top", children: (props) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_bootstrap13.Tooltip, { ...props, children: copied ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { color: "#6f6" }, children: "Copiado!" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { style: { fontFamily: "monospace", fontSize: "0.75rem" }, children: [
|
|
682
|
-
uuid,
|
|
683
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("br", {}),
|
|
684
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { className: "text-muted", children: "Clique para copiar" })
|
|
685
|
-
] }) }) })
|
|
686
|
-
] });
|
|
687
|
-
};
|
|
688
|
-
var UuidPill_default = UuidPill;
|
|
689
|
-
|
|
690
|
-
// src/displays/GenericDisplay.tsx
|
|
691
|
-
var import_react8 = __toESM(require("react"));
|
|
692
|
-
var import_react_bootstrap14 = require("react-bootstrap");
|
|
693
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
694
|
-
var ConfigObject = class {
|
|
695
|
-
constructor(dotNotation, style, onClick, onBlur, onHideClick, hidden, mapData, additionalComponents) {
|
|
696
|
-
this.dotNotation = dotNotation;
|
|
697
|
-
this.style = style;
|
|
698
|
-
this.onClick = onClick;
|
|
699
|
-
this.onBlur = onBlur;
|
|
700
|
-
this.onHideClick = onHideClick;
|
|
701
|
-
this.hidden = hidden;
|
|
702
|
-
this.mapData = mapData;
|
|
703
|
-
this.additionalComponents = additionalComponents || [];
|
|
704
|
-
}
|
|
705
|
-
};
|
|
706
|
-
var getRightConfigObjects = (currentPropertieMap, configObjects) => {
|
|
707
|
-
const curreDotNotation = currentPropertieMap.join(".");
|
|
708
|
-
if (!configObjects) return [];
|
|
709
|
-
return configObjects.filter((configObject) => configObject.dotNotation === curreDotNotation);
|
|
710
|
-
};
|
|
711
|
-
var getStyle = (configObjects) => {
|
|
712
|
-
let styleObject = {};
|
|
713
|
-
configObjects.forEach((configObject) => {
|
|
714
|
-
styleObject = { ...styleObject, ...configObject.style };
|
|
715
|
-
});
|
|
716
|
-
return styleObject;
|
|
717
|
-
};
|
|
718
|
-
var getAdditionalComponentes = (configObjects) => {
|
|
719
|
-
const components = [];
|
|
720
|
-
configObjects.forEach((configObject) => {
|
|
721
|
-
if (configObject.additionalComponents) {
|
|
722
|
-
components.push(...configObject.additionalComponents);
|
|
723
|
-
}
|
|
724
|
-
});
|
|
725
|
-
return components;
|
|
726
|
-
};
|
|
727
|
-
var getOnClick = (configObjects) => {
|
|
728
|
-
return () => {
|
|
729
|
-
configObjects.forEach((configObject) => {
|
|
730
|
-
configObject.onClick && configObject.onClick();
|
|
731
|
-
});
|
|
732
|
-
};
|
|
733
|
-
};
|
|
734
|
-
var buildData = (obj, propertiesMap, configObjects, opn, innerArray, dispatch, isRoot, editButtonRenderer) => {
|
|
735
|
-
const newPropertiesMap = [];
|
|
736
|
-
if (opn) newPropertiesMap.push(...propertiesMap, opn);
|
|
737
|
-
else newPropertiesMap.push(...propertiesMap);
|
|
738
|
-
const innerConfigs = getRightConfigObjects(newPropertiesMap, configObjects);
|
|
739
|
-
const styles = getStyle(innerConfigs);
|
|
740
|
-
const onClick = getOnClick(innerConfigs);
|
|
741
|
-
const extraComponents = getAdditionalComponentes(innerConfigs);
|
|
742
|
-
if (Array.isArray(obj)) {
|
|
743
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_bootstrap14.Container, { onClick, style: { ...styles }, children: [
|
|
744
|
-
opn && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: opn }) }),
|
|
745
|
-
obj.map((o, index) => {
|
|
746
|
-
const mapCopy = [...newPropertiesMap, `[${index}]`];
|
|
747
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_bootstrap14.Row, { style: { padding: 4, ...styles }, children: buildData(o, mapCopy, configObjects, null, true, null, false, editButtonRenderer) }, index);
|
|
748
|
-
})
|
|
749
|
-
] });
|
|
750
|
-
}
|
|
751
|
-
if (typeof obj === "object" && obj != null) {
|
|
752
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
753
|
-
import_react_bootstrap14.Container,
|
|
754
|
-
{
|
|
755
|
-
onClick,
|
|
756
|
-
style: {
|
|
757
|
-
border: innerArray ? "solid" : void 0,
|
|
758
|
-
borderColor: "lightgray",
|
|
759
|
-
borderRadius: innerArray ? 4 : 2,
|
|
760
|
-
borderWidth: 1,
|
|
761
|
-
padding: 4,
|
|
762
|
-
...styles
|
|
763
|
-
},
|
|
764
|
-
children: [
|
|
765
|
-
opn && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: opn }),
|
|
766
|
-
Object.entries(obj).map(
|
|
767
|
-
([key, value]) => buildData(value, newPropertiesMap, configObjects, key, false, null, false, editButtonRenderer)
|
|
768
|
-
),
|
|
769
|
-
extraComponents.length > 0 ? extraComponents.map((comp, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react8.default.Fragment, { children: comp() }, i)) : isRoot && editButtonRenderer ? editButtonRenderer(obj, opn) : null
|
|
770
|
-
]
|
|
771
|
-
}
|
|
772
|
-
);
|
|
773
|
-
}
|
|
774
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_bootstrap14.Col, { children: [
|
|
775
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("strong", { children: [
|
|
776
|
-
opn,
|
|
777
|
-
": "
|
|
778
|
-
] }),
|
|
779
|
-
String(obj)
|
|
780
|
-
] });
|
|
781
|
-
};
|
|
782
|
-
var GenericDisplay = ({
|
|
783
|
-
ops = [],
|
|
784
|
-
loadFunc,
|
|
785
|
-
configObjects,
|
|
786
|
-
rootName,
|
|
787
|
-
context,
|
|
788
|
-
onRefresh,
|
|
789
|
-
editButtonRenderer
|
|
790
|
-
}) => {
|
|
791
|
-
const [innerOptions, setInnerOptions] = (0, import_react8.useState)();
|
|
792
|
-
const refreshFunc = () => {
|
|
793
|
-
if (loadFunc) {
|
|
794
|
-
loadFunc().then((res) => {
|
|
795
|
-
if (Array.isArray(res)) {
|
|
796
|
-
setInnerOptions(res);
|
|
797
|
-
} else {
|
|
798
|
-
setInnerOptions([res]);
|
|
799
|
-
}
|
|
800
|
-
});
|
|
801
|
-
} else {
|
|
802
|
-
setInnerOptions(ops);
|
|
803
|
-
}
|
|
804
|
-
};
|
|
805
|
-
(0, import_react8.useEffect)(() => {
|
|
806
|
-
if (onRefresh) {
|
|
807
|
-
onRefresh(refreshFunc);
|
|
808
|
-
} else {
|
|
809
|
-
refreshFunc();
|
|
810
|
-
}
|
|
811
|
-
}, [context]);
|
|
812
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: innerOptions && innerOptions.map((cObj, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_bootstrap14.Container, { style: { padding: 4, border: "solid" }, children: buildData(cObj, [], configObjects, rootName || null, false, null, true, editButtonRenderer) }, index)) });
|
|
813
|
-
};
|
|
814
|
-
var GenericDisplay_default = GenericDisplay;
|
|
815
|
-
|
|
816
|
-
// src/displays/StatusIndicator.tsx
|
|
817
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
818
|
-
var StatusIndicator = ({
|
|
819
|
-
status,
|
|
820
|
-
count,
|
|
821
|
-
containerClassName = "",
|
|
822
|
-
customLabels
|
|
823
|
-
}) => {
|
|
824
|
-
const statusLabels = customLabels || {
|
|
825
|
-
pendente: "PENDENTE",
|
|
826
|
-
executando: "EXECUTANDO",
|
|
827
|
-
concluido: "CONCLU\xCDDA",
|
|
828
|
-
canceled: "CANCELADA",
|
|
829
|
-
naoAtribuida: "N\xC3O ATRIBUIDA"
|
|
830
|
-
};
|
|
831
|
-
const label = statusLabels[status] || status.toUpperCase();
|
|
832
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `status-flag ${status} ${containerClassName}`, children: [
|
|
833
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "status-label", children: label }),
|
|
834
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "status-count", children: count })
|
|
835
|
-
] });
|
|
836
|
-
};
|
|
837
|
-
|
|
838
|
-
// src/displays/VerticalItemsDisplay.tsx
|
|
839
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
840
|
-
var VerticalItemsDisplay = ({
|
|
841
|
-
item1 = "",
|
|
842
|
-
item2 = "",
|
|
843
|
-
item3 = "",
|
|
844
|
-
className = "",
|
|
845
|
-
style
|
|
846
|
-
}) => {
|
|
847
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className, style, children: [
|
|
848
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: item1 }),
|
|
849
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: item2 }),
|
|
850
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: item3 })
|
|
851
|
-
] });
|
|
852
|
-
};
|
|
853
|
-
|
|
854
|
-
// src/forms/MailSender.tsx
|
|
855
|
-
var import_react9 = require("react");
|
|
856
|
-
var import_react_bootstrap15 = require("react-bootstrap");
|
|
857
|
-
var import_fi2 = require("react-icons/fi");
|
|
858
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
859
|
-
var MailSender = ({
|
|
860
|
-
htmlContent,
|
|
861
|
-
companyName,
|
|
862
|
-
onFetchEmails,
|
|
863
|
-
onSendEmail,
|
|
864
|
-
hide = false,
|
|
865
|
-
renderTrigger
|
|
866
|
-
}) => {
|
|
867
|
-
const [opened, setOpened] = (0, import_react9.useState)(false);
|
|
868
|
-
const [addingEmail, setAddingEmail] = (0, import_react9.useState)(false);
|
|
869
|
-
const [selectedEmails, setSelectedEmails] = (0, import_react9.useState)([]);
|
|
870
|
-
const [emails, setEmails] = (0, import_react9.useState)([]);
|
|
871
|
-
const [loading, setLoading] = (0, import_react9.useState)(false);
|
|
872
|
-
const [postLoading, setPostLoading] = (0, import_react9.useState)(false);
|
|
873
|
-
const [customEmail, setCustomEmail] = (0, import_react9.useState)("");
|
|
874
|
-
const [emailError, setEmailError] = (0, import_react9.useState)("");
|
|
875
|
-
const [searchFilter, setSearchFilter] = (0, import_react9.useState)("");
|
|
876
|
-
const handleOpen = async () => {
|
|
877
|
-
setLoading(true);
|
|
878
|
-
try {
|
|
879
|
-
const data = await onFetchEmails();
|
|
880
|
-
setEmails(data || []);
|
|
881
|
-
setOpened(true);
|
|
882
|
-
} catch (err) {
|
|
883
|
-
console.error("Erro ao buscar e-mails:", err);
|
|
884
|
-
} finally {
|
|
885
|
-
setLoading(false);
|
|
886
|
-
}
|
|
887
|
-
};
|
|
888
|
-
const mailListLinter = () => {
|
|
889
|
-
const result = [];
|
|
890
|
-
const seen = /* @__PURE__ */ new Set();
|
|
891
|
-
if (emails) {
|
|
892
|
-
for (const item of emails) {
|
|
893
|
-
if (item.email && !seen.has(item.email)) {
|
|
894
|
-
seen.add(item.email);
|
|
895
|
-
result.push({ email: item.email });
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
return result;
|
|
900
|
-
};
|
|
901
|
-
const filteredEmails = emails ? mailListLinter().filter(
|
|
902
|
-
(email) => email.email.toLowerCase().includes(searchFilter.toLowerCase()) && !selectedEmails.some((selected) => (selected.email || selected) === email.email)
|
|
903
|
-
) : [];
|
|
904
|
-
const sendEmail = async () => {
|
|
905
|
-
const emailString = selectedEmails.map((email) => email.email ? email.email : email).join(", ");
|
|
906
|
-
const emailData = {
|
|
907
|
-
to: emailString,
|
|
908
|
-
subject: `Relat\xF3rio - ${companyName}`,
|
|
909
|
-
text: `Relat\xF3rio de processo da empresa ${companyName}`,
|
|
910
|
-
html: htmlContent
|
|
911
|
-
};
|
|
912
|
-
setPostLoading(true);
|
|
913
|
-
try {
|
|
914
|
-
await onSendEmail(emailData);
|
|
915
|
-
setSelectedEmails([]);
|
|
916
|
-
setCustomEmail("");
|
|
917
|
-
setOpened(false);
|
|
918
|
-
} catch (err) {
|
|
919
|
-
console.error("Erro ao enviar e-mail:", err);
|
|
920
|
-
} finally {
|
|
921
|
-
setPostLoading(false);
|
|
922
|
-
}
|
|
923
|
-
};
|
|
924
|
-
const validateEmail = (email) => {
|
|
925
|
-
const re = /\S+@\S+\.\S+/;
|
|
926
|
-
return re.test(email);
|
|
927
|
-
};
|
|
928
|
-
const handleEmailAdd = () => {
|
|
929
|
-
if (!customEmail.trim()) {
|
|
930
|
-
setEmailError("Por favor, digite um e-mail");
|
|
931
|
-
return;
|
|
932
|
-
}
|
|
933
|
-
if (!validateEmail(customEmail)) {
|
|
934
|
-
setEmailError("Formato de e-mail inv\xE1lido");
|
|
935
|
-
return;
|
|
936
|
-
}
|
|
937
|
-
if (selectedEmails.some((email) => (email.email || email) === customEmail)) {
|
|
938
|
-
setEmailError("Este e-mail j\xE1 foi selecionado");
|
|
939
|
-
return;
|
|
940
|
-
}
|
|
941
|
-
setSelectedEmails([...selectedEmails, customEmail]);
|
|
942
|
-
setCustomEmail("");
|
|
943
|
-
setEmailError("");
|
|
944
|
-
setAddingEmail(false);
|
|
945
|
-
};
|
|
946
|
-
const handleEmailRemove = (emailToRemove) => {
|
|
947
|
-
setSelectedEmails(
|
|
948
|
-
selectedEmails.filter(
|
|
949
|
-
(email) => (email.email || email) !== (emailToRemove.email || emailToRemove)
|
|
950
|
-
)
|
|
951
|
-
);
|
|
952
|
-
};
|
|
953
|
-
if (hide) return null;
|
|
954
|
-
if (!opened) {
|
|
955
|
-
if (renderTrigger) {
|
|
956
|
-
return renderTrigger({ onClick: handleOpen, loading });
|
|
957
|
-
}
|
|
958
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Button, { disabled: loading, className: "w-100", onClick: handleOpen, children: loading ? "Carregando..." : "Enviar por E-mail" });
|
|
959
|
-
}
|
|
960
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
961
|
-
"div",
|
|
962
|
-
{
|
|
963
|
-
style: {
|
|
964
|
-
backgroundColor: "#f8f9fa",
|
|
965
|
-
borderRadius: "12px",
|
|
966
|
-
overflow: "hidden",
|
|
967
|
-
border: "1px solid #dee2e6",
|
|
968
|
-
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)"
|
|
969
|
-
},
|
|
970
|
-
children: [
|
|
971
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
972
|
-
"div",
|
|
973
|
-
{
|
|
974
|
-
style: {
|
|
975
|
-
background: "linear-gradient(135deg, #28a745 0%, #20c997 100%)",
|
|
976
|
-
color: "white",
|
|
977
|
-
padding: "25px"
|
|
978
|
-
},
|
|
979
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "d-flex justify-content-between align-items-center", children: [
|
|
980
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
|
|
981
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("h4", { className: "mb-1", style: { fontWeight: "600", fontSize: "22px" }, children: [
|
|
982
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiMail, { className: "me-2", size: 20 }),
|
|
983
|
-
"Enviar Relat\xF3rio por E-mail"
|
|
984
|
-
] }),
|
|
985
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("small", { style: { opacity: "0.9", fontSize: "14px" }, children: [
|
|
986
|
-
"Selecione os destinat\xE1rios para envio do relat\xF3rio de ",
|
|
987
|
-
companyName
|
|
988
|
-
] })
|
|
989
|
-
] }),
|
|
990
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "d-flex gap-2", children: [
|
|
991
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
992
|
-
import_react_bootstrap15.Button,
|
|
993
|
-
{
|
|
994
|
-
variant: "light",
|
|
995
|
-
onClick: sendEmail,
|
|
996
|
-
disabled: selectedEmails.length === 0 || postLoading,
|
|
997
|
-
style: {
|
|
998
|
-
borderRadius: "8px",
|
|
999
|
-
fontWeight: "600",
|
|
1000
|
-
minWidth: "130px",
|
|
1001
|
-
height: "40px"
|
|
1002
|
-
},
|
|
1003
|
-
children: postLoading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1004
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Spinner, { size: "sm", className: "me-2" }),
|
|
1005
|
-
"Enviando..."
|
|
1006
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1007
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiSend, { className: "me-2", size: 14 }),
|
|
1008
|
-
"Enviar E-mail"
|
|
1009
|
-
] })
|
|
1010
|
-
}
|
|
1011
|
-
),
|
|
1012
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1013
|
-
import_react_bootstrap15.Button,
|
|
1014
|
-
{
|
|
1015
|
-
variant: "outline-light",
|
|
1016
|
-
onClick: () => setOpened(false),
|
|
1017
|
-
disabled: postLoading,
|
|
1018
|
-
style: { borderRadius: "8px", width: "40px", height: "40px" },
|
|
1019
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiX, { size: 16 })
|
|
1020
|
-
}
|
|
1021
|
-
)
|
|
1022
|
-
] })
|
|
1023
|
-
] })
|
|
1024
|
-
}
|
|
1025
|
-
),
|
|
1026
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { padding: "25px" }, children: [
|
|
1027
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Card, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Card.Body, { style: { padding: "20px" }, children: [
|
|
1028
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Row, { className: "align-items-center", children: [
|
|
1029
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Col, { md: 6, children: [
|
|
1030
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h6", { className: "mb-2", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F527} Filtros e A\xE7\xF5es" }),
|
|
1031
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.InputGroup, { style: { maxWidth: "300px" }, children: [
|
|
1032
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.InputGroup.Text, { style: { backgroundColor: "#f8f9fa", border: "1px solid #dee2e6" }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiSearch, { size: 14, color: "#6c757d" }) }),
|
|
1033
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1034
|
-
import_react_bootstrap15.Form.Control,
|
|
1035
|
-
{
|
|
1036
|
-
type: "text",
|
|
1037
|
-
placeholder: "Buscar e-mails...",
|
|
1038
|
-
value: searchFilter,
|
|
1039
|
-
onChange: (e) => setSearchFilter(e.target.value),
|
|
1040
|
-
style: { border: "1px solid #dee2e6" }
|
|
1041
|
-
}
|
|
1042
|
-
)
|
|
1043
|
-
] })
|
|
1044
|
-
] }),
|
|
1045
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Col, { md: 6, className: "text-end", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1046
|
-
import_react_bootstrap15.Button,
|
|
1047
|
-
{
|
|
1048
|
-
variant: addingEmail ? "outline-secondary" : "outline-primary",
|
|
1049
|
-
size: "sm",
|
|
1050
|
-
onClick: () => setAddingEmail(!addingEmail),
|
|
1051
|
-
disabled: postLoading,
|
|
1052
|
-
style: { borderRadius: "8px" },
|
|
1053
|
-
children: addingEmail ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1054
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiX, { className: "me-1", size: 14 }),
|
|
1055
|
-
"Cancelar"
|
|
1056
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1057
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiPlus, { className: "me-1", size: 14 }),
|
|
1058
|
-
"E-mail Personalizado"
|
|
1059
|
-
] })
|
|
1060
|
-
}
|
|
1061
|
-
) })
|
|
1062
|
-
] }),
|
|
1063
|
-
addingEmail && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1064
|
-
"div",
|
|
1065
|
-
{
|
|
1066
|
-
style: {
|
|
1067
|
-
marginTop: "20px",
|
|
1068
|
-
padding: "20px",
|
|
1069
|
-
backgroundColor: "#f8f9ff",
|
|
1070
|
-
borderRadius: "8px",
|
|
1071
|
-
border: "1px solid #e3f2fd"
|
|
1072
|
-
},
|
|
1073
|
-
children: [
|
|
1074
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h6", { className: "mb-3", style: { color: "#1976d2", fontWeight: "600" }, children: "\u2709\uFE0F Adicionar E-mail Personalizado" }),
|
|
1075
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Row, { className: "align-items-end", children: [
|
|
1076
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Col, { md: 8, children: [
|
|
1077
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Form.Label, { style: { fontSize: "13px", color: "#6c757d", fontWeight: "500" }, children: "Endere\xE7o de E-mail" }),
|
|
1078
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1079
|
-
import_react_bootstrap15.Form.Control,
|
|
1080
|
-
{
|
|
1081
|
-
type: "email",
|
|
1082
|
-
placeholder: "exemplo@empresa.com",
|
|
1083
|
-
value: customEmail,
|
|
1084
|
-
onChange: (e) => {
|
|
1085
|
-
setCustomEmail(e.target.value);
|
|
1086
|
-
if (emailError) setEmailError("");
|
|
1087
|
-
},
|
|
1088
|
-
isInvalid: !!emailError,
|
|
1089
|
-
disabled: postLoading,
|
|
1090
|
-
style: { borderRadius: "8px" },
|
|
1091
|
-
onKeyPress: (e) => e.key === "Enter" && handleEmailAdd()
|
|
1092
|
-
}
|
|
1093
|
-
),
|
|
1094
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Form.Control.Feedback, { type: "invalid", children: emailError })
|
|
1095
|
-
] }),
|
|
1096
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Col, { md: 4, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1097
|
-
import_react_bootstrap15.Button,
|
|
1098
|
-
{
|
|
1099
|
-
variant: "success",
|
|
1100
|
-
onClick: handleEmailAdd,
|
|
1101
|
-
disabled: postLoading,
|
|
1102
|
-
style: { borderRadius: "8px", width: "100%" },
|
|
1103
|
-
children: [
|
|
1104
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiPlus, { className: "me-1", size: 14 }),
|
|
1105
|
-
"Adicionar"
|
|
1106
|
-
]
|
|
1107
|
-
}
|
|
1108
|
-
) })
|
|
1109
|
-
] })
|
|
1110
|
-
]
|
|
1111
|
-
}
|
|
1112
|
-
)
|
|
1113
|
-
] }) }),
|
|
1114
|
-
selectedEmails.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Card, { className: "mb-4", style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Card.Body, { style: { padding: "20px" }, children: [
|
|
1115
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "d-flex justify-content-between align-items-center mb-3", children: [
|
|
1116
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h6", { className: "mb-0", style: { color: "#495057", fontWeight: "600" }, children: "\u{1F4CB} Destinat\xE1rios Selecionados" }),
|
|
1117
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Badge, { bg: "primary", style: { fontSize: "12px", padding: "6px 12px" }, children: [
|
|
1118
|
-
selectedEmails.length,
|
|
1119
|
-
" selecionado",
|
|
1120
|
-
selectedEmails.length > 1 ? "s" : ""
|
|
1121
|
-
] })
|
|
1122
|
-
] }),
|
|
1123
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "d-flex flex-wrap gap-2", children: selectedEmails.map((email, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1124
|
-
"div",
|
|
1125
|
-
{
|
|
1126
|
-
style: {
|
|
1127
|
-
background: "linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%)",
|
|
1128
|
-
border: "1px solid #bbdefb",
|
|
1129
|
-
borderRadius: "20px",
|
|
1130
|
-
padding: "8px 15px",
|
|
1131
|
-
display: "flex",
|
|
1132
|
-
alignItems: "center",
|
|
1133
|
-
fontSize: "14px",
|
|
1134
|
-
fontWeight: "500"
|
|
1135
|
-
},
|
|
1136
|
-
children: [
|
|
1137
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiUser, { size: 12, className: "me-2", color: "#1976d2" }),
|
|
1138
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: email.email || email }),
|
|
1139
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1140
|
-
import_react_bootstrap15.Button,
|
|
1141
|
-
{
|
|
1142
|
-
variant: "link",
|
|
1143
|
-
size: "sm",
|
|
1144
|
-
onClick: () => handleEmailRemove(email),
|
|
1145
|
-
disabled: postLoading,
|
|
1146
|
-
style: {
|
|
1147
|
-
padding: "0 0 0 8px",
|
|
1148
|
-
color: "#dc3545",
|
|
1149
|
-
textDecoration: "none",
|
|
1150
|
-
fontSize: "16px"
|
|
1151
|
-
},
|
|
1152
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiX, { size: 14 })
|
|
1153
|
-
}
|
|
1154
|
-
)
|
|
1155
|
-
]
|
|
1156
|
-
},
|
|
1157
|
-
index
|
|
1158
|
-
)) })
|
|
1159
|
-
] }) }),
|
|
1160
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Card, { style: { border: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.05)" }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Card.Body, { style: { padding: "20px" }, children: [
|
|
1161
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("h6", { className: "mb-3", style: { color: "#495057", fontWeight: "600" }, children: [
|
|
1162
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiUser, { className: "me-2", size: 16 }),
|
|
1163
|
-
"E-mails de ",
|
|
1164
|
-
companyName
|
|
1165
|
-
] }),
|
|
1166
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "text-center py-4", children: [
|
|
1167
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Spinner, {}),
|
|
1168
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "mt-2 text-muted", children: "Carregando e-mails..." })
|
|
1169
|
-
] }) : filteredEmails.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-center py-4", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-muted mb-0", children: searchFilter ? "Nenhum e-mail encontrado com esse filtro" : "Nenhum e-mail dispon\xEDvel" }) }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Row, { children: filteredEmails.map((email) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_bootstrap15.Col, { xs: 12, sm: 6, lg: 4, className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1170
|
-
import_react_bootstrap15.Card,
|
|
1171
|
-
{
|
|
1172
|
-
onClick: () => setSelectedEmails([...selectedEmails, email]),
|
|
1173
|
-
style: {
|
|
1174
|
-
cursor: "pointer",
|
|
1175
|
-
border: "1px solid #e9ecef",
|
|
1176
|
-
borderRadius: "10px",
|
|
1177
|
-
transition: "all 0.2s ease",
|
|
1178
|
-
backgroundColor: "#fff"
|
|
1179
|
-
},
|
|
1180
|
-
onMouseEnter: (e) => {
|
|
1181
|
-
e.currentTarget.style.transform = "translateY(-2px)";
|
|
1182
|
-
e.currentTarget.style.boxShadow = "0 4px 12px rgba(0,0,0,0.1)";
|
|
1183
|
-
e.currentTarget.style.borderColor = "#007bff";
|
|
1184
|
-
},
|
|
1185
|
-
onMouseLeave: (e) => {
|
|
1186
|
-
e.currentTarget.style.transform = "translateY(0)";
|
|
1187
|
-
e.currentTarget.style.boxShadow = "none";
|
|
1188
|
-
e.currentTarget.style.borderColor = "#e9ecef";
|
|
1189
|
-
},
|
|
1190
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_bootstrap15.Card.Body, { style: { padding: "15px", textAlign: "center" }, children: [
|
|
1191
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_fi2.FiMail, { size: 20, color: "#007bff", className: "mb-2" }),
|
|
1192
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1193
|
-
"div",
|
|
1194
|
-
{
|
|
1195
|
-
style: {
|
|
1196
|
-
fontSize: "14px",
|
|
1197
|
-
fontWeight: "500",
|
|
1198
|
-
color: "#2c3e50",
|
|
1199
|
-
wordBreak: "break-word"
|
|
1200
|
-
},
|
|
1201
|
-
children: email.email
|
|
1202
|
-
}
|
|
1203
|
-
)
|
|
1204
|
-
] })
|
|
1205
|
-
}
|
|
1206
|
-
) }, email.email)) })
|
|
1207
|
-
] }) })
|
|
1208
|
-
] })
|
|
1209
|
-
]
|
|
1210
|
-
}
|
|
1211
|
-
);
|
|
1212
|
-
};
|
|
1213
|
-
|
|
1214
|
-
// src/forms/AutoComplete.tsx
|
|
1215
|
-
var import_react10 = require("react");
|
|
1216
|
-
var import_react_bootstrap16 = require("react-bootstrap");
|
|
1217
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1218
|
-
var AutoComplete = ({
|
|
1219
|
-
className,
|
|
1220
|
-
ops = [],
|
|
1221
|
-
sortKey,
|
|
1222
|
-
displayKey,
|
|
1223
|
-
displayKeys,
|
|
1224
|
-
onValueChanged,
|
|
1225
|
-
onSelectedClick,
|
|
1226
|
-
value,
|
|
1227
|
-
actionButton,
|
|
1228
|
-
actionButton2,
|
|
1229
|
-
placeH,
|
|
1230
|
-
title,
|
|
1231
|
-
filter,
|
|
1232
|
-
filterField,
|
|
1233
|
-
loadFunc,
|
|
1234
|
-
loadCondition,
|
|
1235
|
-
onBlurEvent,
|
|
1236
|
-
formatationFunc,
|
|
1237
|
-
onEscKeyDown,
|
|
1238
|
-
onEnterKeyDown,
|
|
1239
|
-
margT,
|
|
1240
|
-
margB,
|
|
1241
|
-
hideComponent,
|
|
1242
|
-
disableComponent = false,
|
|
1243
|
-
disableSelect = false,
|
|
1244
|
-
autoFocusConfig,
|
|
1245
|
-
onLoad,
|
|
1246
|
-
cacheKey,
|
|
1247
|
-
minChars = 0,
|
|
1248
|
-
maxItems,
|
|
1249
|
-
showListOnFocus = true,
|
|
1250
|
-
lazyLoad = false
|
|
1251
|
-
}) => {
|
|
1252
|
-
const [liItem, setListItem] = (0, import_react10.useState)([]);
|
|
1253
|
-
const [options, setOptions] = (0, import_react10.useState)([]);
|
|
1254
|
-
const [input, setInput] = (0, import_react10.useState)("");
|
|
1255
|
-
const [hide, setHide] = (0, import_react10.useState)(true);
|
|
1256
|
-
const [onLoaded, setOnLoaded] = (0, import_react10.useState)(false);
|
|
1257
|
-
const [loading, setLoading] = (0, import_react10.useState)(false);
|
|
1258
|
-
const cacheStore = (0, import_react10.useMemo)(() => {
|
|
1259
|
-
const win = window;
|
|
1260
|
-
if (!win.__AUTO_COMPLETE_CACHE__) {
|
|
1261
|
-
win.__AUTO_COMPLETE_CACHE__ = /* @__PURE__ */ new Map();
|
|
1262
|
-
}
|
|
1263
|
-
return win.__AUTO_COMPLETE_CACHE__;
|
|
1264
|
-
}, []);
|
|
1265
|
-
const sortOptions = (data, key) => {
|
|
1266
|
-
if (!key || !Array.isArray(data)) return data;
|
|
1267
|
-
return [...data].sort((a, b) => String(a[key]).localeCompare(String(b[key])));
|
|
1268
|
-
};
|
|
1269
|
-
(0, import_react10.useEffect)(() => {
|
|
1270
|
-
setInput(value || "");
|
|
1271
|
-
}, [value]);
|
|
1272
|
-
(0, import_react10.useEffect)(() => {
|
|
1273
|
-
const sortedOptions = sortOptions(ops, sortKey);
|
|
1274
|
-
setListItem(sortedOptions);
|
|
1275
|
-
setOptions(sortedOptions);
|
|
1276
|
-
}, [ops, sortKey]);
|
|
1277
|
-
(0, import_react10.useEffect)(() => {
|
|
1278
|
-
const loadData = async () => {
|
|
1279
|
-
if (!(loadCondition && loadFunc)) return;
|
|
1280
|
-
if (lazyLoad && minChars > 0 && !showListOnFocus && (!value || String(value).length < minChars)) {
|
|
1281
|
-
return;
|
|
1282
|
-
}
|
|
1283
|
-
const key = cacheKey ? `${cacheKey}${filter ? `:${filterField}:${filter}` : ""}` : null;
|
|
1284
|
-
if (key && cacheStore.has(key)) {
|
|
1285
|
-
const cacheEntry = cacheStore.get(key);
|
|
1286
|
-
const data = cacheEntry.promise ? await cacheEntry.promise : cacheEntry.data || cacheEntry;
|
|
1287
|
-
setListItem(data);
|
|
1288
|
-
setOptions(data);
|
|
1289
|
-
triggerOnLoad(data);
|
|
1290
|
-
return;
|
|
1291
|
-
}
|
|
1292
|
-
setLoading(true);
|
|
1293
|
-
try {
|
|
1294
|
-
const requestPromise = loadFunc().then((res) => {
|
|
1295
|
-
let newOps = (res == null ? void 0 : res.content) || res;
|
|
1296
|
-
newOps = Array.isArray(newOps) ? newOps.filter((op) => op != null) : [];
|
|
1297
|
-
if (filter && filterField) {
|
|
1298
|
-
newOps = newOps.filter((op) => op[filterField] === filter);
|
|
1299
|
-
}
|
|
1300
|
-
return sortOptions(newOps, sortKey);
|
|
1301
|
-
});
|
|
1302
|
-
if (key) cacheStore.set(key, { promise: requestPromise });
|
|
1303
|
-
const sortedOptions = await requestPromise;
|
|
1304
|
-
setListItem(sortedOptions);
|
|
1305
|
-
setOptions(sortedOptions);
|
|
1306
|
-
if (key) cacheStore.set(key, { data: sortedOptions });
|
|
1307
|
-
triggerOnLoad(sortedOptions);
|
|
1308
|
-
} catch (error) {
|
|
1309
|
-
if (key) cacheStore.delete(key);
|
|
1310
|
-
setListItem([]);
|
|
1311
|
-
} finally {
|
|
1312
|
-
setLoading(false);
|
|
1313
|
-
}
|
|
1314
|
-
};
|
|
1315
|
-
loadData();
|
|
1316
|
-
}, [loadCondition, filter, filterField, sortKey, cacheKey, lazyLoad, minChars, showListOnFocus]);
|
|
1317
|
-
const triggerOnLoad = (data) => {
|
|
1318
|
-
if (onLoad && !onLoaded) {
|
|
1319
|
-
setOnLoaded(true);
|
|
1320
|
-
onLoad(data);
|
|
1321
|
-
}
|
|
1322
|
-
};
|
|
1323
|
-
const keysJoinner = (li) => {
|
|
1324
|
-
if (!displayKeys || !Array.isArray(displayKeys)) return "";
|
|
1325
|
-
return displayKeys.map((key) => `${li[key]} `).join("").trim();
|
|
1326
|
-
};
|
|
1327
|
-
const getDisplayText = (item) => {
|
|
1328
|
-
if (formatationFunc) return formatationFunc(item);
|
|
1329
|
-
if (displayKey) return item[displayKey];
|
|
1330
|
-
if (displayKeys) return keysJoinner(item);
|
|
1331
|
-
return String(item);
|
|
1332
|
-
};
|
|
1333
|
-
const onFieldUpdate = (val) => {
|
|
1334
|
-
const search = val.toLowerCase();
|
|
1335
|
-
const canSearch = search.length >= minChars;
|
|
1336
|
-
if (canSearch && Array.isArray(options)) {
|
|
1337
|
-
const filtered = options.filter((item) => {
|
|
1338
|
-
const text = getDisplayText(item);
|
|
1339
|
-
return String(text).toLowerCase().includes(search);
|
|
1340
|
-
});
|
|
1341
|
-
setListItem(filtered);
|
|
1342
|
-
} else {
|
|
1343
|
-
setListItem(options || []);
|
|
1344
|
-
}
|
|
1345
|
-
onValueChanged == null ? void 0 : onValueChanged(val);
|
|
1346
|
-
setInput(val);
|
|
1347
|
-
setHide(!canSearch && options.length === 0);
|
|
1348
|
-
};
|
|
1349
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1350
|
-
"div",
|
|
1351
|
-
{
|
|
1352
|
-
className,
|
|
1353
|
-
style: { marginTop: margT != null ? margT : 4, marginBottom: margB != null ? margB : 4, position: "relative" },
|
|
1354
|
-
onBlur: (e) => {
|
|
1355
|
-
setTimeout(() => {
|
|
1356
|
-
onBlurEvent == null ? void 0 : onBlurEvent(e, input);
|
|
1357
|
-
setHide(true);
|
|
1358
|
-
}, 200);
|
|
1359
|
-
},
|
|
1360
|
-
onKeyDown: (e) => {
|
|
1361
|
-
if (e.key === "Escape") {
|
|
1362
|
-
setHide(true);
|
|
1363
|
-
onEscKeyDown == null ? void 0 : onEscKeyDown();
|
|
1364
|
-
}
|
|
1365
|
-
if (e.key === "Enter" && onEnterKeyDown) {
|
|
1366
|
-
onEnterKeyDown(input);
|
|
1367
|
-
}
|
|
1368
|
-
},
|
|
1369
|
-
onMouseLeave: () => setHide(true),
|
|
1370
|
-
children: [
|
|
1371
|
-
!hideComponent && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_bootstrap16.InputGroup, { children: [
|
|
1372
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_bootstrap16.FloatingLabel, { controlId: "floatingInput", label: title, style: { zIndex: 0, flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1373
|
-
import_react_bootstrap16.Form.Control,
|
|
1374
|
-
{
|
|
1375
|
-
autoFocus: autoFocusConfig,
|
|
1376
|
-
disabled: disableComponent || disableSelect,
|
|
1377
|
-
placeholder: placeH,
|
|
1378
|
-
autoComplete: "off",
|
|
1379
|
-
value: input,
|
|
1380
|
-
onClickCapture: () => {
|
|
1381
|
-
const canOpen = showListOnFocus && input.length >= minChars;
|
|
1382
|
-
setHide(!canOpen);
|
|
1383
|
-
},
|
|
1384
|
-
onChange: (e) => onFieldUpdate(e.currentTarget.value),
|
|
1385
|
-
type: "text"
|
|
1386
|
-
}
|
|
1387
|
-
) }),
|
|
1388
|
-
loading && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_bootstrap16.InputGroup.Text, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_bootstrap16.Spinner, { animation: "border", size: "sm" }) }),
|
|
1389
|
-
!disableComponent && (actionButton == null ? void 0 : actionButton(() => setInput(""))),
|
|
1390
|
-
!disableComponent && (actionButton2 == null ? void 0 : actionButton2(input))
|
|
1391
|
-
] }),
|
|
1392
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1393
|
-
import_react_bootstrap16.ListGroup,
|
|
1394
|
-
{
|
|
1395
|
-
className: "listgroup-autocomplete shadow-sm",
|
|
1396
|
-
hidden: hide || liItem.length === 0,
|
|
1397
|
-
style: {
|
|
1398
|
-
position: "absolute",
|
|
1399
|
-
top: "100%",
|
|
1400
|
-
left: 0,
|
|
1401
|
-
width: "100%",
|
|
1402
|
-
maxHeight: "250px",
|
|
1403
|
-
overflowY: "auto",
|
|
1404
|
-
zIndex: 1050,
|
|
1405
|
-
backgroundColor: "#fff"
|
|
1406
|
-
},
|
|
1407
|
-
children: (maxItems ? liItem.slice(0, maxItems) : liItem).map((li, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1408
|
-
import_react_bootstrap16.ListGroup.Item,
|
|
1409
|
-
{
|
|
1410
|
-
action: true,
|
|
1411
|
-
onClick: () => {
|
|
1412
|
-
const text = getDisplayText(li);
|
|
1413
|
-
setInput(text);
|
|
1414
|
-
onSelectedClick(li, index, liItem);
|
|
1415
|
-
setHide(true);
|
|
1416
|
-
},
|
|
1417
|
-
children: getDisplayText(li)
|
|
1418
|
-
},
|
|
1419
|
-
index
|
|
1420
|
-
))
|
|
1421
|
-
}
|
|
1422
|
-
)
|
|
1423
|
-
]
|
|
1424
|
-
}
|
|
1425
|
-
);
|
|
1426
|
-
};
|
|
1427
|
-
|
|
1428
|
-
// src/forms/GenericForm.tsx
|
|
1429
|
-
var import_react11 = require("react");
|
|
1430
|
-
var import_react_bootstrap17 = require("react-bootstrap");
|
|
1431
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1432
|
-
var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
|
|
1433
|
-
const [formValues, setFormValues] = (0, import_react11.useState)({});
|
|
1434
|
-
const [errors, setErrors] = (0, import_react11.useState)({});
|
|
1435
|
-
const handleChange = (key, value) => {
|
|
1436
|
-
setFormValues({
|
|
1437
|
-
...formValues,
|
|
1438
|
-
[key]: value
|
|
1439
|
-
});
|
|
1440
|
-
};
|
|
1441
|
-
const validate = () => {
|
|
1442
|
-
const newErrors = {};
|
|
1443
|
-
fields.forEach((field) => {
|
|
1444
|
-
if (field.required && !formValues[field.key]) {
|
|
1445
|
-
newErrors[field.key] = `${field.label} \xE9 obrigat\xF3rio`;
|
|
1446
|
-
}
|
|
1447
|
-
});
|
|
1448
|
-
setErrors(newErrors);
|
|
1449
|
-
return Object.keys(newErrors).length === 0;
|
|
1450
|
-
};
|
|
1451
|
-
const handleSubmit = (e) => {
|
|
1452
|
-
e.preventDefault();
|
|
1453
|
-
if (validate()) {
|
|
1454
|
-
onSubmit(formValues);
|
|
1455
|
-
}
|
|
1456
|
-
};
|
|
1457
|
-
const renderField = (field) => {
|
|
1458
|
-
const { label, key, type, options, placeholder } = field;
|
|
1459
|
-
const value = formValues[key] || "";
|
|
1460
|
-
switch (type) {
|
|
1461
|
-
case "text":
|
|
1462
|
-
case "number":
|
|
1463
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_bootstrap17.Form.Group, { className: "mb-3", children: [
|
|
1464
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Form.Label, { children: label }),
|
|
1465
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1466
|
-
import_react_bootstrap17.Form.Control,
|
|
1467
|
-
{
|
|
1468
|
-
type,
|
|
1469
|
-
placeholder,
|
|
1470
|
-
value,
|
|
1471
|
-
onChange: (e) => handleChange(key, e.target.value),
|
|
1472
|
-
isInvalid: !!errors[key]
|
|
1473
|
-
}
|
|
1474
|
-
),
|
|
1475
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Form.Control.Feedback, { type: "invalid", children: errors[key] })
|
|
1476
|
-
] }, key);
|
|
1477
|
-
case "select": {
|
|
1478
|
-
const orderedOptions = (options || []).filter((opt) => opt && opt.value !== void 0 && opt.label !== void 0).sort((a, b) => a.label.localeCompare(b.label));
|
|
1479
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_bootstrap17.Form.Group, { className: "mb-3", children: [
|
|
1480
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Form.Label, { children: label }),
|
|
1481
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1482
|
-
import_react_bootstrap17.Form.Select,
|
|
1483
|
-
{
|
|
1484
|
-
value,
|
|
1485
|
-
onChange: (e) => handleChange(key, e.target.value),
|
|
1486
|
-
isInvalid: !!errors[key],
|
|
1487
|
-
children: [
|
|
1488
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "Selecione..." }),
|
|
1489
|
-
orderedOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: option.value, children: option.label }, String(option.value)))
|
|
1490
|
-
]
|
|
1491
|
-
}
|
|
1492
|
-
),
|
|
1493
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Form.Control.Feedback, { type: "invalid", children: errors[key] })
|
|
1494
|
-
] }, key);
|
|
1495
|
-
}
|
|
1496
|
-
case "custom-select":
|
|
1497
|
-
if (renderCustomSelect) {
|
|
1498
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
|
|
1499
|
-
renderCustomSelect({
|
|
1500
|
-
label,
|
|
1501
|
-
value,
|
|
1502
|
-
options,
|
|
1503
|
-
onChange: (v) => handleChange(key, v),
|
|
1504
|
-
placeholder
|
|
1505
|
-
}),
|
|
1506
|
-
errors[key] && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "invalid-feedback d-block", children: errors[key] })
|
|
1507
|
-
] }, key);
|
|
1508
|
-
}
|
|
1509
|
-
return null;
|
|
1510
|
-
case "date":
|
|
1511
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_bootstrap17.Form.Group, { className: "mb-3", children: [
|
|
1512
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Form.Label, { children: label }),
|
|
1513
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1514
|
-
import_react_bootstrap17.Form.Control,
|
|
1515
|
-
{
|
|
1516
|
-
type: "date",
|
|
1517
|
-
value,
|
|
1518
|
-
onChange: (e) => handleChange(key, e.target.value),
|
|
1519
|
-
isInvalid: !!errors[key]
|
|
1520
|
-
}
|
|
1521
|
-
),
|
|
1522
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Form.Control.Feedback, { type: "invalid", children: errors[key] })
|
|
1523
|
-
] }, key);
|
|
1524
|
-
default:
|
|
1525
|
-
return null;
|
|
1526
|
-
}
|
|
1527
|
-
};
|
|
1528
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_bootstrap17.Form, { onSubmit: handleSubmit, children: [
|
|
1529
|
-
fields.map((field) => renderField(field)),
|
|
1530
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "d-grid", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_bootstrap17.Button, { variant: "primary", type: "submit", children: "Salvar" }) })
|
|
1531
|
-
] });
|
|
1532
|
-
};
|
|
1533
|
-
var GenericForm_default = GenericForm;
|
|
1534
|
-
|
|
1535
|
-
// src/forms/GenericSelect.tsx
|
|
1536
|
-
var import_react12 = require("react");
|
|
1537
|
-
var import_react_bootstrap18 = require("react-bootstrap");
|
|
1538
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1539
|
-
var GenericSelectOps = class {
|
|
1540
|
-
constructor(noLabel, title, onChange, ops, selection, returnType, displayType, filter, filterField, valueType, loadFunc, loadCondition, actionClick, locked) {
|
|
1541
|
-
this.noLabel = noLabel;
|
|
1542
|
-
this.title = title;
|
|
1543
|
-
this.onChange = onChange;
|
|
1544
|
-
this.ops = ops;
|
|
1545
|
-
this.selection = selection;
|
|
1546
|
-
this.returnType = returnType;
|
|
1547
|
-
this.displayType = displayType;
|
|
1548
|
-
this.filter = filter;
|
|
1549
|
-
this.filterField = filterField;
|
|
1550
|
-
this.valueType = valueType;
|
|
1551
|
-
this.loadFunc = loadFunc;
|
|
1552
|
-
this.loadCondition = loadCondition;
|
|
1553
|
-
this.actionClick = actionClick;
|
|
1554
|
-
this.locked = locked;
|
|
1555
|
-
}
|
|
1556
|
-
};
|
|
1557
|
-
var GenericSelect = ({
|
|
1558
|
-
noLabel,
|
|
1559
|
-
title,
|
|
1560
|
-
onChange,
|
|
1561
|
-
ops,
|
|
1562
|
-
selection,
|
|
1563
|
-
returnType,
|
|
1564
|
-
displayType,
|
|
1565
|
-
filter,
|
|
1566
|
-
filterField,
|
|
1567
|
-
valueType,
|
|
1568
|
-
loadFunc,
|
|
1569
|
-
loadCondition = true,
|
|
1570
|
-
actionClick,
|
|
1571
|
-
locked,
|
|
1572
|
-
isBold,
|
|
1573
|
-
...restProps
|
|
1574
|
-
}) => {
|
|
1575
|
-
const [options, setOptions] = (0, import_react12.useState)(ops || []);
|
|
1576
|
-
(0, import_react12.useEffect)(() => {
|
|
1577
|
-
const loadFunction = async () => {
|
|
1578
|
-
if (loadCondition && loadFunc) {
|
|
1579
|
-
loadFunc().then((res) => {
|
|
1580
|
-
let newOps = res.content ? res.content : res;
|
|
1581
|
-
if (filter && filterField) {
|
|
1582
|
-
newOps = res.filter((op) => op[filterField] == filter);
|
|
1583
|
-
}
|
|
1584
|
-
setOptions(newOps);
|
|
1585
|
-
});
|
|
1586
|
-
}
|
|
1587
|
-
};
|
|
1588
|
-
loadFunction().catch((error) => console.log(error));
|
|
1589
|
-
}, [loadCondition]);
|
|
1590
|
-
const getTrueValue = (clickedIndex) => {
|
|
1591
|
-
const returnValue = options.filter((_op, index) => index == clickedIndex - 1)[0];
|
|
1592
|
-
if (returnType == "index") {
|
|
1593
|
-
onChange(clickedIndex);
|
|
1594
|
-
} else if (returnType) {
|
|
1595
|
-
onChange(returnValue[returnType]);
|
|
1596
|
-
} else {
|
|
1597
|
-
onChange(returnValue);
|
|
1598
|
-
}
|
|
1599
|
-
};
|
|
1600
|
-
const defaultPlaceholder = (restProps == null ? void 0 : restProps.default) || "Seleciona uma Op\xE7\xE3o";
|
|
1601
|
-
const selectContent = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1602
|
-
import_react_bootstrap18.Form.Control,
|
|
1603
|
-
{
|
|
1604
|
-
disabled: locked,
|
|
1605
|
-
as: "select",
|
|
1606
|
-
value: selection,
|
|
1607
|
-
onChange: (event) => getTrueValue(event.target.selectedIndex),
|
|
1608
|
-
children: [
|
|
1609
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("option", { value: void 0, children: [
|
|
1610
|
-
"-- ",
|
|
1611
|
-
defaultPlaceholder,
|
|
1612
|
-
" --"
|
|
1613
|
-
] }, 0),
|
|
1614
|
-
(options == null ? void 0 : options.length) > 0 && options.map((op, index) => {
|
|
1615
|
-
const val = valueType && op[valueType] || op.id || op;
|
|
1616
|
-
let fill = displayType && op[displayType] || op;
|
|
1617
|
-
if (typeof fill == "object") fill = "";
|
|
1618
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: val, children: fill }, op.id || index);
|
|
1619
|
-
})
|
|
1620
|
-
]
|
|
1621
|
-
}
|
|
1622
|
-
);
|
|
1623
|
-
if (actionClick) {
|
|
1624
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
1625
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_bootstrap18.Form.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
|
|
1626
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_bootstrap18.InputGroup, { children: [
|
|
1627
|
-
selectContent,
|
|
1628
|
-
actionClick()
|
|
1629
|
-
] })
|
|
1630
|
-
] });
|
|
1631
|
-
}
|
|
1632
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
1633
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_bootstrap18.Form.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
|
|
1634
|
-
selectContent
|
|
1635
|
-
] });
|
|
1636
|
-
};
|
|
1637
|
-
var GenericSelect_default = GenericSelect;
|
|
1638
|
-
|
|
1639
|
-
// src/forms/FormField.tsx
|
|
1640
|
-
var import_react_bootstrap19 = require("react-bootstrap");
|
|
1641
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1642
|
-
var FormField = ({
|
|
1643
|
-
val,
|
|
1644
|
-
onValueUpdate,
|
|
1645
|
-
onBlur,
|
|
1646
|
-
label,
|
|
1647
|
-
ty,
|
|
1648
|
-
actionClick,
|
|
1649
|
-
actionClick2,
|
|
1650
|
-
reference,
|
|
1651
|
-
others,
|
|
1652
|
-
styleObj,
|
|
1653
|
-
locked,
|
|
1654
|
-
hide,
|
|
1655
|
-
onMouseLv,
|
|
1656
|
-
onEnterPress,
|
|
1657
|
-
className,
|
|
1658
|
-
isInvalid,
|
|
1659
|
-
feedback,
|
|
1660
|
-
onFocus,
|
|
1661
|
-
rows,
|
|
1662
|
-
asTextArea,
|
|
1663
|
-
controlId
|
|
1664
|
-
}) => {
|
|
1665
|
-
const onKeyDownHandler = (event) => {
|
|
1666
|
-
if (event.code === "Enter" || event.key === "Enter") {
|
|
1667
|
-
onEnterPress && onEnterPress(event.target.value);
|
|
1668
|
-
}
|
|
1669
|
-
};
|
|
1670
|
-
const onFocusHandler = (value) => {
|
|
1671
|
-
onFocus && onFocus(value);
|
|
1672
|
-
};
|
|
1673
|
-
const renderField = () => {
|
|
1674
|
-
const fieldProps = {
|
|
1675
|
-
autoComplete: "off",
|
|
1676
|
-
isInvalid,
|
|
1677
|
-
className,
|
|
1678
|
-
...others,
|
|
1679
|
-
onBlur: (event) => onBlur && onBlur(event.target.value, event),
|
|
1680
|
-
disabled: locked,
|
|
1681
|
-
style: styleObj,
|
|
1682
|
-
ref: reference,
|
|
1683
|
-
placeholder: (others == null ? void 0 : others.placeholder) || label,
|
|
1684
|
-
type: ty || "text",
|
|
1685
|
-
value: val != null ? val : "",
|
|
1686
|
-
onChange: (event) => onValueUpdate && onValueUpdate(event.target.value, event)
|
|
1687
|
-
};
|
|
1688
|
-
if (asTextArea) {
|
|
1689
|
-
fieldProps.as = "textarea";
|
|
1690
|
-
fieldProps.rows = rows || 3;
|
|
1691
|
-
}
|
|
1692
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_bootstrap19.Form.Control, { ...fieldProps });
|
|
1693
|
-
};
|
|
1694
|
-
if (hide) return null;
|
|
1695
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1696
|
-
import_react_bootstrap19.Form.Group,
|
|
1697
|
-
{
|
|
1698
|
-
onFocusCapture: (e) => onFocusHandler(e.target.value),
|
|
1699
|
-
onMouseLeave: onMouseLv,
|
|
1700
|
-
onKeyDown: onKeyDownHandler,
|
|
1701
|
-
style: { marginTop: 4, marginBottom: 4, width: "100%" },
|
|
1702
|
-
children: [
|
|
1703
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_bootstrap19.InputGroup, { children: [
|
|
1704
|
-
asTextArea ? renderField() : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_bootstrap19.FloatingLabel, { style: { zIndex: 0, flex: 1 }, label, controlId: controlId || "floatingInput", children: renderField() }),
|
|
1705
|
-
actionClick && actionClick(),
|
|
1706
|
-
actionClick2 && actionClick2()
|
|
1707
|
-
] }),
|
|
1708
|
-
feedback && isInvalid && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_bootstrap19.Form.Control.Feedback, { type: "invalid", style: { display: "block" }, children: feedback })
|
|
1709
|
-
]
|
|
1710
|
-
}
|
|
1711
|
-
);
|
|
1712
|
-
};
|
|
1713
|
-
|
|
1714
|
-
// src/forms/ClickToWriteField.tsx
|
|
1715
|
-
var import_react13 = require("react");
|
|
1716
|
-
var import_react_bootstrap20 = require("react-bootstrap");
|
|
1717
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1718
|
-
var ClickToWriteField = ({
|
|
1719
|
-
buttonDisplay,
|
|
1720
|
-
fieldType = "text",
|
|
1721
|
-
fieldLabel = "",
|
|
1722
|
-
buttonProps,
|
|
1723
|
-
fieldProps,
|
|
1724
|
-
onFieldValueUpdate,
|
|
1725
|
-
enableFieldActionButton = false,
|
|
1726
|
-
fieldActionButtonIcon,
|
|
1727
|
-
fieldActionButtonProps,
|
|
1728
|
-
fieldActionButtonCallback = () => {
|
|
1729
|
-
},
|
|
1730
|
-
onEnterPress,
|
|
1731
|
-
cleanRef
|
|
1732
|
-
}) => {
|
|
1733
|
-
const [showClick, setShowClick] = (0, import_react13.useState)(false);
|
|
1734
|
-
const inputRef = (0, import_react13.useRef)(null);
|
|
1735
|
-
(0, import_react13.useEffect)(() => {
|
|
1736
|
-
if (showClick) {
|
|
1737
|
-
setTimeout(() => {
|
|
1738
|
-
if (inputRef.current) {
|
|
1739
|
-
inputRef.current.focus();
|
|
1740
|
-
cleanRef && cleanRef(inputRef);
|
|
1741
|
-
}
|
|
1742
|
-
}, 100);
|
|
1743
|
-
}
|
|
1744
|
-
}, [showClick, cleanRef]);
|
|
1745
|
-
const handleShowClick = () => {
|
|
1746
|
-
setShowClick(!showClick);
|
|
1747
|
-
};
|
|
1748
|
-
const resolveButtonDisplay = () => {
|
|
1749
|
-
if (typeof buttonDisplay === "function") return buttonDisplay();
|
|
1750
|
-
return buttonDisplay;
|
|
1751
|
-
};
|
|
1752
|
-
const renderFieldActionButtonIcon = () => {
|
|
1753
|
-
if (fieldActionButtonIcon) return fieldActionButtonIcon();
|
|
1754
|
-
return "OK";
|
|
1755
|
-
};
|
|
1756
|
-
const closeOnEscape = (e) => {
|
|
1757
|
-
if (e.key === "Escape") {
|
|
1758
|
-
setShowClick(false);
|
|
1759
|
-
}
|
|
1760
|
-
if (e.key === "Enter" && onEnterPress) {
|
|
1761
|
-
onEnterPress(inputRef);
|
|
1762
|
-
}
|
|
1763
|
-
};
|
|
1764
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", width: "100%", margin: 0, padding: 0 }, children: [
|
|
1765
|
-
!showClick && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1766
|
-
import_react_bootstrap20.Button,
|
|
1767
|
-
{
|
|
1768
|
-
style: { flexGrow: 1 },
|
|
1769
|
-
onClick: handleShowClick,
|
|
1770
|
-
...buttonProps,
|
|
1771
|
-
children: resolveButtonDisplay()
|
|
1772
|
-
}
|
|
1773
|
-
),
|
|
1774
|
-
showClick && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1775
|
-
FormField,
|
|
1776
|
-
{
|
|
1777
|
-
reference: inputRef,
|
|
1778
|
-
others: { ...fieldProps, onKeyUp: closeOnEscape },
|
|
1779
|
-
hide: !showClick,
|
|
1780
|
-
ty: fieldType,
|
|
1781
|
-
label: fieldLabel,
|
|
1782
|
-
onValueUpdate: onFieldValueUpdate,
|
|
1783
|
-
onBlur: () => setShowClick(false),
|
|
1784
|
-
actionClick: () => enableFieldActionButton ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1785
|
-
import_react_bootstrap20.Button,
|
|
1786
|
-
{
|
|
1787
|
-
...fieldActionButtonProps,
|
|
1788
|
-
onClick: () => fieldActionButtonCallback(inputRef),
|
|
1789
|
-
children: renderFieldActionButtonIcon()
|
|
1790
|
-
}
|
|
1791
|
-
) : null
|
|
1792
|
-
}
|
|
1793
|
-
)
|
|
1794
|
-
] });
|
|
1795
|
-
};
|
|
1796
|
-
|
|
1797
|
-
// src/forms/ColorPicker.tsx
|
|
1798
|
-
var import_react_bootstrap21 = require("react-bootstrap");
|
|
1799
|
-
var import_fa2 = require("react-icons/fa");
|
|
1800
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1801
|
-
var ColorPicker = ({
|
|
1802
|
-
selectedColor,
|
|
1803
|
-
onColorChange,
|
|
1804
|
-
presetColors = ["#ff0000", "#ffd700", "#008000", "#0000ff", "#800080"],
|
|
1805
|
-
title = "Cor de Identifica\xE7\xE3o"
|
|
1806
|
-
}) => {
|
|
1807
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1808
|
-
import_react_bootstrap21.Card,
|
|
1809
|
-
{
|
|
1810
|
-
className: "shadow-sm border-primary-hover mb-3",
|
|
1811
|
-
style: { maxWidth: "320px", transition: "0.3s" },
|
|
1812
|
-
children: [
|
|
1813
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_bootstrap21.Card.Header, { className: "bg-light d-flex align-items-center", children: [
|
|
1814
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_fa2.FaPalette, { className: "me-2 text-primary" }),
|
|
1815
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fw-medium", children: title })
|
|
1816
|
-
] }),
|
|
1817
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_bootstrap21.Card.Body, { children: [
|
|
1818
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_bootstrap21.Row, { className: "g-3 align-items-center mb-3", children: [
|
|
1819
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_bootstrap21.Col, { xs: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1820
|
-
"div",
|
|
1821
|
-
{
|
|
1822
|
-
className: "rounded-circle shadow-sm border",
|
|
1823
|
-
style: {
|
|
1824
|
-
width: "40px",
|
|
1825
|
-
height: "40px",
|
|
1826
|
-
backgroundColor: selectedColor,
|
|
1827
|
-
cursor: "pointer",
|
|
1828
|
-
border: "2px solid #dee2e6"
|
|
1829
|
-
},
|
|
1830
|
-
onClick: () => {
|
|
1831
|
-
const el = document.getElementById("color-input-hidden");
|
|
1832
|
-
if (el) el.click();
|
|
1833
|
-
},
|
|
1834
|
-
title: "Clique para abrir o seletor"
|
|
1835
|
-
}
|
|
1836
|
-
) }),
|
|
1837
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_bootstrap21.Col, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1838
|
-
import_react_bootstrap21.Form.Control,
|
|
1839
|
-
{
|
|
1840
|
-
type: "color",
|
|
1841
|
-
id: "color-input-hidden",
|
|
1842
|
-
value: selectedColor,
|
|
1843
|
-
onChange: (e) => onColorChange(e.target.value),
|
|
1844
|
-
className: "form-control-color-lg",
|
|
1845
|
-
style: { width: "100%", height: "40px", cursor: "pointer" }
|
|
1846
|
-
}
|
|
1847
|
-
) })
|
|
1848
|
-
] }),
|
|
1849
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_bootstrap21.Row, { className: "g-2 justify-content-start", children: presetColors.map((cor) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_bootstrap21.Col, { xs: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1850
|
-
"div",
|
|
1851
|
-
{
|
|
1852
|
-
className: "rounded-1 shadow-sm",
|
|
1853
|
-
style: {
|
|
1854
|
-
width: "28px",
|
|
1855
|
-
height: "28px",
|
|
1856
|
-
backgroundColor: cor,
|
|
1857
|
-
cursor: "pointer",
|
|
1858
|
-
border: cor.toLowerCase() === selectedColor.toLowerCase() ? "2px solid #0d6efd" : "1px solid #dee2e6"
|
|
1859
|
-
},
|
|
1860
|
-
onClick: () => onColorChange(cor)
|
|
1861
|
-
}
|
|
1862
|
-
) }, cor)) })
|
|
1863
|
-
] })
|
|
1864
|
-
]
|
|
1865
|
-
}
|
|
1866
|
-
);
|
|
1867
|
-
};
|
|
1868
|
-
|
|
1869
|
-
// src/forms/Switch.tsx
|
|
1870
|
-
var import_react_bootstrap22 = require("react-bootstrap");
|
|
1871
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1872
|
-
var Switch = ({
|
|
1873
|
-
label,
|
|
1874
|
-
onSwitchChange,
|
|
1875
|
-
value,
|
|
1876
|
-
disabled = false,
|
|
1877
|
-
defaultChecked,
|
|
1878
|
-
...props
|
|
1879
|
-
}) => {
|
|
1880
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1881
|
-
import_react_bootstrap22.Form.Check,
|
|
1882
|
-
{
|
|
1883
|
-
...props,
|
|
1884
|
-
disabled,
|
|
1885
|
-
type: "switch",
|
|
1886
|
-
label,
|
|
1887
|
-
checked: value,
|
|
1888
|
-
defaultChecked,
|
|
1889
|
-
onChange: (event) => onSwitchChange && onSwitchChange(event.target.checked)
|
|
1890
|
-
}
|
|
1891
|
-
);
|
|
1892
|
-
};
|
|
1893
|
-
|
|
1894
|
-
// src/forms/UploadArea.tsx
|
|
1895
|
-
var import_react14 = require("react");
|
|
1896
|
-
var import_react_dropzone = require("react-dropzone");
|
|
1897
|
-
var import_fi3 = require("react-icons/fi");
|
|
1898
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1899
|
-
var UploadArea = ({
|
|
1900
|
-
onFilePut,
|
|
1901
|
-
anexo,
|
|
1902
|
-
accept = { "image/jpeg": [], "image/png": [] },
|
|
1903
|
-
maxSize = 50 * 1024 * 1024
|
|
1904
|
-
}) => {
|
|
1905
|
-
const onDrop = (0, import_react14.useCallback)(
|
|
1906
|
-
(acceptedFiles) => {
|
|
1907
|
-
const file = acceptedFiles[0];
|
|
1908
|
-
if (file && typeof onFilePut === "function") {
|
|
1909
|
-
onFilePut(file);
|
|
1910
|
-
}
|
|
1911
|
-
},
|
|
1912
|
-
[onFilePut]
|
|
1913
|
-
);
|
|
1914
|
-
const { getRootProps, getInputProps, isDragActive } = (0, import_react_dropzone.useDropzone)({
|
|
1915
|
-
onDrop,
|
|
1916
|
-
maxSize,
|
|
1917
|
-
accept
|
|
1918
|
-
});
|
|
1919
|
-
const hasAnexo = Boolean(anexo);
|
|
1920
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1921
|
-
"div",
|
|
1922
|
-
{
|
|
1923
|
-
...getRootProps(),
|
|
1924
|
-
className: `upload-area
|
|
1925
|
-
${isDragActive ? "drag-active" : ""}
|
|
1926
|
-
${hasAnexo ? "upload-has-file" : ""}
|
|
1927
|
-
`,
|
|
1928
|
-
children: [
|
|
1929
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { ...getInputProps() }),
|
|
1930
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "upload-content", children: [
|
|
1931
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "upload-icon", children: hasAnexo ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_fi3.FiCheckCircle, { size: 24 }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_fi3.FiUploadCloud, { size: 24 }) }),
|
|
1932
|
-
hasAnexo ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
1933
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "upload-link", children: "Arquivo anexado" }),
|
|
1934
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "upload-info", children: anexo == null ? void 0 : anexo.name })
|
|
1935
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
1936
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { children: [
|
|
1937
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "upload-link", children: "Adicione" }),
|
|
1938
|
-
" ou arraste arquivos aqui"
|
|
1939
|
-
] }),
|
|
1940
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "upload-info", children: [
|
|
1941
|
-
"Formatos aceitos: ",
|
|
1942
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("b", { children: Object.keys(accept).map((t) => t.split("/")[1].toUpperCase()).join(", ") }),
|
|
1943
|
-
" | Tamanho m\xE1ximo:",
|
|
1944
|
-
" ",
|
|
1945
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("b", { children: [
|
|
1946
|
-
(maxSize / (1024 * 1024)).toFixed(0),
|
|
1947
|
-
"MB"
|
|
1948
|
-
] })
|
|
1949
|
-
] })
|
|
1950
|
-
] })
|
|
1951
|
-
] })
|
|
1952
|
-
]
|
|
1953
|
-
}
|
|
1954
|
-
);
|
|
1955
|
-
};
|
|
1956
|
-
|
|
1957
|
-
// src/forms/FindRecursoByTagField.tsx
|
|
1958
|
-
var import_react17 = require("react");
|
|
1959
|
-
var import_gr4 = require("react-icons/gr");
|
|
1960
|
-
|
|
1961
|
-
// src/qr/QrCodeScanButton.tsx
|
|
1962
|
-
var import_react16 = require("react");
|
|
1963
|
-
var import_bs = require("react-icons/bs");
|
|
1964
|
-
|
|
1965
|
-
// src/qr/QrReader.tsx
|
|
1966
|
-
var import_qr_scanner = __toESM(require("qr-scanner"));
|
|
1967
|
-
var import_react15 = require("react");
|
|
1968
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1969
|
-
var QrReader = ({ callback }) => {
|
|
1970
|
-
const scanner = (0, import_react15.useRef)(null);
|
|
1971
|
-
const videoEl = (0, import_react15.useRef)(null);
|
|
1972
|
-
const qrBoxEl = (0, import_react15.useRef)(null);
|
|
1973
|
-
const [qrOn, setQrOn] = (0, import_react15.useState)(true);
|
|
1974
|
-
const [scannedResult, setScannedResult] = (0, import_react15.useState)("");
|
|
1975
|
-
const onScanSuccess = (result) => {
|
|
1976
|
-
setScannedResult(result.data);
|
|
1977
|
-
callback(result.data);
|
|
1978
|
-
};
|
|
1979
|
-
const onScanFail = (err) => {
|
|
1980
|
-
if (typeof err === "string" && !err.includes("No QR code found")) {
|
|
1981
|
-
console.error("QR Scanner Error:", err);
|
|
1982
|
-
}
|
|
1983
|
-
};
|
|
1984
|
-
(0, import_react15.useEffect)(() => {
|
|
1985
|
-
if (videoEl.current && !scanner.current) {
|
|
1986
|
-
scanner.current = new import_qr_scanner.default(videoEl.current, onScanSuccess, {
|
|
1987
|
-
onDecodeError: onScanFail,
|
|
1988
|
-
preferredCamera: "environment",
|
|
1989
|
-
highlightScanRegion: true,
|
|
1990
|
-
highlightCodeOutline: true,
|
|
1991
|
-
overlay: qrBoxEl.current || void 0
|
|
1992
|
-
});
|
|
1993
|
-
scanner.current.start().then(() => setQrOn(true)).catch((err) => {
|
|
1994
|
-
console.error("Failed to start QR Scanner:", err);
|
|
1995
|
-
setQrOn(false);
|
|
1996
|
-
});
|
|
1997
|
-
}
|
|
1998
|
-
return () => {
|
|
1999
|
-
if (scanner.current) {
|
|
2000
|
-
scanner.current.stop();
|
|
2001
|
-
scanner.current.destroy();
|
|
2002
|
-
scanner.current = null;
|
|
2003
|
-
}
|
|
2004
|
-
};
|
|
2005
|
-
}, []);
|
|
2006
|
-
(0, import_react15.useEffect)(() => {
|
|
2007
|
-
if (!qrOn) {
|
|
2008
|
-
alert(
|
|
2009
|
-
"C\xE2mera est\xE1 bloqueada ou inacess\xEDvel. Por favor, habilite a c\xE2mera nas permiss\xF5es do seu navegador e recarregue a p\xE1gina."
|
|
2010
|
-
);
|
|
2011
|
-
}
|
|
2012
|
-
}, [qrOn]);
|
|
2013
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "qr-reader", style: { position: "relative", width: "100%", maxWidth: "500px", margin: "0 auto" }, children: [
|
|
2014
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("video", { ref: videoEl, style: { width: "100%", borderRadius: "8px" } }),
|
|
2015
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref: qrBoxEl, className: "qr-box" }),
|
|
2016
|
-
scannedResult && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2017
|
-
"div",
|
|
2018
|
-
{
|
|
2019
|
-
style: {
|
|
2020
|
-
position: "absolute",
|
|
2021
|
-
top: 10,
|
|
2022
|
-
left: 10,
|
|
2023
|
-
zIndex: 10,
|
|
2024
|
-
background: "rgba(0,0,0,0.6)",
|
|
2025
|
-
color: "white",
|
|
2026
|
-
padding: "4px 8px",
|
|
2027
|
-
borderRadius: "4px",
|
|
2028
|
-
fontSize: "0.8rem"
|
|
2029
|
-
},
|
|
2030
|
-
children: [
|
|
2031
|
-
"Lido: ",
|
|
2032
|
-
scannedResult
|
|
2033
|
-
]
|
|
2034
|
-
}
|
|
2035
|
-
)
|
|
2036
|
-
] });
|
|
2037
|
-
};
|
|
2038
|
-
|
|
2039
|
-
// src/qr/QrCodeScanButton.tsx
|
|
2040
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2041
|
-
var QrCodeScanButton = ({ callback, size = 25 }) => {
|
|
2042
|
-
const [showQr, setShowQr] = (0, import_react16.useState)(false);
|
|
2043
|
-
const toggleQr = () => {
|
|
2044
|
-
setShowQr((prev) => !prev);
|
|
2045
|
-
};
|
|
2046
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2047
|
-
"div",
|
|
2048
|
-
{
|
|
2049
|
-
className: "hoverable-div",
|
|
2050
|
-
style: {
|
|
2051
|
-
border: "solid",
|
|
2052
|
-
borderTopRightRadius: "3px",
|
|
2053
|
-
borderBottomRightRadius: "3px",
|
|
2054
|
-
padding: "8px",
|
|
2055
|
-
borderLeft: "none",
|
|
2056
|
-
borderColor: "#ccc",
|
|
2057
|
-
borderWidth: "1px",
|
|
2058
|
-
cursor: "pointer",
|
|
2059
|
-
display: "flex",
|
|
2060
|
-
alignItems: "center"
|
|
2061
|
-
},
|
|
2062
|
-
onClick: toggleQr,
|
|
2063
|
-
children: [
|
|
2064
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_bs.BsQrCode, { size }),
|
|
2065
|
-
showQr && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2066
|
-
"div",
|
|
2067
|
-
{
|
|
2068
|
-
style: {
|
|
2069
|
-
position: "fixed",
|
|
2070
|
-
top: 0,
|
|
2071
|
-
left: 0,
|
|
2072
|
-
right: 0,
|
|
2073
|
-
bottom: 0,
|
|
2074
|
-
backgroundColor: "rgba(0,0,0,0.8)",
|
|
2075
|
-
zIndex: 9999,
|
|
2076
|
-
display: "flex",
|
|
2077
|
-
flexDirection: "column",
|
|
2078
|
-
alignItems: "center",
|
|
2079
|
-
justifyContent: "center",
|
|
2080
|
-
padding: "20px"
|
|
2081
|
-
},
|
|
2082
|
-
onClick: (e) => e.stopPropagation(),
|
|
2083
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { width: "100%", maxWidth: "500px", backgroundColor: "#fff", borderRadius: "12px", padding: "20px", position: "relative" }, children: [
|
|
2084
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2085
|
-
"div",
|
|
2086
|
-
{
|
|
2087
|
-
onClick: toggleQr,
|
|
2088
|
-
style: { position: "absolute", top: "10px", right: "15px", fontSize: "1.5rem", cursor: "pointer", zIndex: 10001 },
|
|
2089
|
-
children: "\xD7"
|
|
2090
|
-
}
|
|
2091
|
-
),
|
|
2092
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h5", { className: "mb-3 text-center", children: "Escaneie o QR Code" }),
|
|
2093
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2094
|
-
QrReader,
|
|
2095
|
-
{
|
|
2096
|
-
callback: (v) => {
|
|
2097
|
-
toggleQr();
|
|
2098
|
-
callback(v);
|
|
2099
|
-
}
|
|
2100
|
-
}
|
|
2101
|
-
),
|
|
2102
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "mt-3 text-muted text-center small", children: "Aponte a c\xE2mera para o c\xF3digo" })
|
|
2103
|
-
] })
|
|
2104
|
-
}
|
|
2105
|
-
)
|
|
2106
|
-
]
|
|
2107
|
-
}
|
|
2108
|
-
);
|
|
2109
|
-
};
|
|
2110
|
-
|
|
2111
|
-
// src/forms/FindRecursoByTagField.tsx
|
|
2112
|
-
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2113
|
-
var FindRecursoByTagField = ({ callback, recursoController }) => {
|
|
2114
|
-
const [selectedTag, setSelectedTag] = (0, import_react17.useState)("");
|
|
2115
|
-
const [reachedRecurso, setReachedRecurso] = (0, import_react17.useState)(null);
|
|
2116
|
-
const findRecursoByTagIdHandler = async (tagId) => {
|
|
2117
|
-
try {
|
|
2118
|
-
const r = await recursoController.read("findRecursoByTagId", tagId);
|
|
2119
|
-
setReachedRecurso(r);
|
|
2120
|
-
} catch (error) {
|
|
2121
|
-
console.error("Erro ao buscar recurso por tag ID:", error);
|
|
2122
|
-
}
|
|
2123
|
-
};
|
|
2124
|
-
const findRecursoByTagDescriptionHandler = async (description) => {
|
|
2125
|
-
try {
|
|
2126
|
-
const formattedDescription = description.replace(/\s/g, "");
|
|
2127
|
-
const recurso = await recursoController.read(
|
|
2128
|
-
`recurso/findByTagDescription`,
|
|
2129
|
-
formattedDescription
|
|
2130
|
-
);
|
|
2131
|
-
if (!callback) {
|
|
2132
|
-
console.log("Recurso encontrado (sem callback):", recurso);
|
|
2133
|
-
} else {
|
|
2134
|
-
callback(recurso, true);
|
|
2135
|
-
}
|
|
2136
|
-
} catch (error) {
|
|
2137
|
-
console.error("Erro ao buscar recurso por descri\xE7\xE3o de tag:", error);
|
|
2138
|
-
}
|
|
2139
|
-
};
|
|
2140
|
-
const confirmRecursoSelectionButton = () => {
|
|
2141
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2142
|
-
"div",
|
|
2143
|
-
{
|
|
2144
|
-
className: "hoverable-div",
|
|
2145
|
-
style: {
|
|
2146
|
-
border: "solid",
|
|
2147
|
-
borderTopRightRadius: "3px",
|
|
2148
|
-
borderBottomRightRadius: "3px",
|
|
2149
|
-
padding: "8px",
|
|
2150
|
-
borderLeft: "none",
|
|
2151
|
-
borderColor: "#ccc",
|
|
2152
|
-
borderWidth: "1px",
|
|
2153
|
-
cursor: "pointer",
|
|
2154
|
-
display: "flex",
|
|
2155
|
-
alignItems: "center"
|
|
2156
|
-
},
|
|
2157
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2158
|
-
import_gr4.GrCheckmark,
|
|
2159
|
-
{
|
|
2160
|
-
size: 25,
|
|
2161
|
-
onClick: () => reachedRecurso && callback(reachedRecurso, true)
|
|
2162
|
-
}
|
|
2163
|
-
)
|
|
2164
|
-
}
|
|
2165
|
-
);
|
|
2166
|
-
};
|
|
2167
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2168
|
-
AutoComplete,
|
|
2169
|
-
{
|
|
2170
|
-
sortKey: "id",
|
|
2171
|
-
loadCondition: true,
|
|
2172
|
-
loadFunc: () => recursoController.get("findActiveRecursosTags"),
|
|
2173
|
-
displayKey: "descricao",
|
|
2174
|
-
title: "Selecione ou Digite a TAG",
|
|
2175
|
-
isBold: true,
|
|
2176
|
-
actionButton: confirmRecursoSelectionButton,
|
|
2177
|
-
actionButton2: () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2178
|
-
QrCodeScanButton,
|
|
2179
|
-
{
|
|
2180
|
-
callback: (description) => findRecursoByTagDescriptionHandler(description)
|
|
2181
|
-
}
|
|
2182
|
-
),
|
|
2183
|
-
onSelectedClick: (v) => {
|
|
2184
|
-
setSelectedTag(v);
|
|
2185
|
-
findRecursoByTagIdHandler(v.id);
|
|
2186
|
-
},
|
|
2187
|
-
value: (selectedTag == null ? void 0 : selectedTag.descricao) || ""
|
|
2188
|
-
}
|
|
2189
|
-
) });
|
|
2190
|
-
};
|
|
2191
|
-
|
|
2192
|
-
// src/icons/IconLabelItem.tsx
|
|
2193
|
-
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2194
|
-
var IconLabelItem = ({
|
|
2195
|
-
icon,
|
|
2196
|
-
label,
|
|
2197
|
-
containerClassName = "",
|
|
2198
|
-
labelClassName = "",
|
|
2199
|
-
onClick,
|
|
2200
|
-
style
|
|
2201
|
-
}) => {
|
|
2202
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: containerClassName, onClick, style: { ...style, cursor: onClick ? "pointer" : "default" }, children: [
|
|
2203
|
-
icon,
|
|
2204
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: labelClassName, children: label })
|
|
2205
|
-
] });
|
|
2206
|
-
};
|
|
2207
|
-
|
|
2208
|
-
// src/icons/IconLabelList.tsx
|
|
2209
|
-
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2210
|
-
var IconLabelList = ({ items, className = "" }) => {
|
|
2211
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: `icon-label-list ${className}`, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2212
|
-
IconLabelItem,
|
|
2213
|
-
{
|
|
2214
|
-
labelClassName: "icon-label",
|
|
2215
|
-
containerClassName: "icon-label-item",
|
|
2216
|
-
icon: item.icon,
|
|
2217
|
-
label: item.label,
|
|
2218
|
-
onClick: item.onClick
|
|
2219
|
-
},
|
|
2220
|
-
index
|
|
2221
|
-
)) });
|
|
2222
|
-
};
|
|
2223
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
2224
|
-
0 && (module.exports = {
|
|
2225
|
-
ActionButtons,
|
|
2226
|
-
AddButton,
|
|
2227
|
-
ApproveAndReproveButtons,
|
|
2228
|
-
AsyncButton,
|
|
2229
|
-
AutoComplete,
|
|
2230
|
-
ClickToWriteField,
|
|
2231
|
-
ColorPicker,
|
|
2232
|
-
ConfigObject,
|
|
2233
|
-
DeleteButton,
|
|
2234
|
-
DeleteConfirm,
|
|
2235
|
-
FindRecursoByTagField,
|
|
2236
|
-
FormField,
|
|
2237
|
-
Generic3DotMenu,
|
|
2238
|
-
GenericDisplay,
|
|
2239
|
-
GenericForm,
|
|
2240
|
-
GenericSelect,
|
|
2241
|
-
GenericSelectOps,
|
|
2242
|
-
IconLabelItem,
|
|
2243
|
-
IconLabelList,
|
|
2244
|
-
LoadingButton,
|
|
2245
|
-
LoadingProgress,
|
|
2246
|
-
MailSender,
|
|
2247
|
-
MenuEvent,
|
|
2248
|
-
NavigateButton,
|
|
2249
|
-
QrCodeScanButton,
|
|
2250
|
-
QrReader,
|
|
2251
|
-
ResponsiveContainer,
|
|
2252
|
-
StatusBadge,
|
|
2253
|
-
StatusIndicator,
|
|
2254
|
-
Switch,
|
|
2255
|
-
SwitchOnClick,
|
|
2256
|
-
UploadArea,
|
|
2257
|
-
UuidPill,
|
|
2258
|
-
VerticalItemsDisplay
|
|
2259
|
-
});
|