module-package-comp 2.3.1 → 2.3.2
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/.prettierrc +5 -0
- package/dist/component/ExtraInfoSection.d.ts +6 -0
- package/dist/component/ExtraInfoSection.js +30 -0
- package/dist/component/ExtraInfoSection.js.map +1 -0
- package/dist/component/PdfExportModal.d.ts +2 -3
- package/dist/component/PdfExportModal.js +38 -259
- package/dist/component/PdfExportModal.js.map +1 -1
- package/dist/component/RubricDisplayer.d.ts +3 -5
- package/dist/component/RubricDisplayer.js +38 -30
- package/dist/component/RubricDisplayer.js.map +1 -1
- package/dist/index.css +38 -0
- package/dist/util/pdfExport.d.ts +21 -0
- package/dist/util/pdfExport.js +165 -0
- package/dist/util/pdfExport.js.map +1 -0
- package/dist/util/rubricDisplayer.d.ts +3 -3
- package/dist/util/rubricDisplayer.js +3 -3
- package/dist/util/rubricDisplayer.js.map +1 -1
- package/package.json +1 -1
package/.prettierrc
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type ExtraInfoSectionProps = {
|
|
2
|
+
extraInfo: Record<string, unknown>;
|
|
3
|
+
setExtraInfo: React.Dispatch<React.SetStateAction<Record<string, unknown>>>;
|
|
4
|
+
};
|
|
5
|
+
export declare function ExtraInfoSection({ extraInfo, setExtraInfo, }: ExtraInfoSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
export function ExtraInfoSection({ extraInfo, setExtraInfo, }) {
|
|
4
|
+
const [newKey, setNewKey] = useState("");
|
|
5
|
+
const [newValueType, setNewValueType] = useState("text");
|
|
6
|
+
const [newValue, setNewValue] = useState("");
|
|
7
|
+
const handleAdd = () => {
|
|
8
|
+
if (!newKey.trim())
|
|
9
|
+
return;
|
|
10
|
+
let parsedValue = newValue;
|
|
11
|
+
if (newValueType === "number") {
|
|
12
|
+
parsedValue = Number(newValue) || 0;
|
|
13
|
+
}
|
|
14
|
+
else if (newValueType === "boolean") {
|
|
15
|
+
parsedValue = newValue === "true";
|
|
16
|
+
}
|
|
17
|
+
setExtraInfo((prev) => (Object.assign(Object.assign({}, prev), { [newKey.trim()]: parsedValue })));
|
|
18
|
+
setNewKey("");
|
|
19
|
+
setNewValue("");
|
|
20
|
+
};
|
|
21
|
+
const handleRemove = (key) => {
|
|
22
|
+
setExtraInfo((prev) => {
|
|
23
|
+
const updated = Object.assign({}, prev);
|
|
24
|
+
delete updated[key];
|
|
25
|
+
return updated;
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
return (_jsxs("div", { className: "mb-6", children: [_jsx("h3", { className: "text-sm font-medium text-gray-700 mb-3", children: "Informations suppl\u00E9mentaires" }), Object.keys(extraInfo).length > 0 && (_jsx("div", { className: "flex flex-wrap gap-2 mb-3", children: Object.entries(extraInfo).map(([key, value]) => (_jsxs("div", { className: "flex items-center gap-2 px-3 py-1.5 bg-blue-50 border border-blue-200 rounded-lg text-sm", children: [_jsxs("span", { className: "font-medium text-blue-700", children: [key, ":"] }), _jsx("span", { className: "text-blue-600", children: String(value) }), _jsx("button", { type: "button", onClick: () => handleRemove(key), className: "ml-1 text-blue-400 hover:text-blue-600", children: _jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })] }, key))) })), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("input", { type: "text", value: newKey, onChange: (e) => setNewKey(e.target.value), placeholder: "Cl\u00E9", className: "flex-1 px-3 py-2 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" }), _jsxs("select", { value: newValueType, onChange: (e) => setNewValueType(e.target.value), className: "px-3 py-2 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500", children: [_jsx("option", { value: "text", children: "Texte" }), _jsx("option", { value: "number", children: "Nombre" }), _jsx("option", { value: "date", children: "Date" }), _jsx("option", { value: "boolean", children: "Oui/Non" })] }), newValueType === "boolean" ? (_jsxs("select", { value: newValue, onChange: (e) => setNewValue(e.target.value), className: "flex-1 px-3 py-2 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500", children: [_jsx("option", { value: "", children: "Choisir..." }), _jsx("option", { value: "true", children: "Oui" }), _jsx("option", { value: "false", children: "Non" })] })) : (_jsx("input", { type: newValueType === "date" ? "date" : newValueType, value: newValue, onChange: (e) => setNewValue(e.target.value), placeholder: "Valeur", className: "flex-1 px-3 py-2 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" })), _jsx("button", { type: "button", onClick: handleAdd, disabled: !newKey.trim() || !newValue, className: "px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 disabled:bg-gray-300 disabled:cursor-not-allowed transition-colors", children: "OK" })] })] }));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ExtraInfoSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtraInfoSection.js","sourceRoot":"","sources":["../../src/component/ExtraInfoSection.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AASjC,MAAM,UAAU,gBAAgB,CAAC,EAC/B,SAAS,EACT,YAAY,GACU;IACtB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAY,MAAM,CAAC,CAAC;IACpE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC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,KAAK,EAAC,MAAM,oBAAa,EACjC,iBAAQ,KAAK,EAAC,OAAO,oBAAa,IAC3B,CACV,CAAC,CAAC,CAAC,CACF,gBACE,IAAI,EAAE,YAAY,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,EACrD,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5C,WAAW,EAAC,QAAQ,EACpB,SAAS,EAAC,mHAAmH,GAC7H,CACH,EACD,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EACrC,SAAS,EAAC,sJAAsJ,mBAGzJ,IACL,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RubricDataValues } from "../util/type";
|
|
2
2
|
type PdfExportModalProps = {
|
|
3
3
|
isOpen: boolean;
|
|
4
4
|
onClose: () => void;
|
|
5
|
-
components: Component[];
|
|
6
5
|
dataValues: RubricDataValues;
|
|
7
6
|
title?: string;
|
|
8
7
|
extra?: Record<string, unknown>;
|
|
9
8
|
};
|
|
10
|
-
export declare function PdfExportModal({ isOpen, onClose,
|
|
9
|
+
export declare function PdfExportModal({ isOpen, onClose, dataValues, title, extra, }: PdfExportModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
10
|
export {};
|
|
@@ -1,292 +1,71 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { formatValue, generatePdfHtml, openPdfPrintWindow, } from "../util/pdfExport";
|
|
4
|
+
import { ExtraInfoSection } from "./ExtraInfoSection";
|
|
5
|
+
export function PdfExportModal({ isOpen, onClose, dataValues, title, extra, }) {
|
|
6
|
+
// All attributes selected by default
|
|
5
7
|
const [selectedAttributes, setSelectedAttributes] = useState(() => {
|
|
6
8
|
const initial = {};
|
|
7
|
-
|
|
8
|
-
const compData = dataValues[comp._id];
|
|
9
|
+
for (const [compName, compData] of Object.entries(dataValues)) {
|
|
9
10
|
if (compData) {
|
|
10
|
-
initial[
|
|
11
|
-
Object.keys(compData)
|
|
12
|
-
initial[
|
|
13
|
-
}
|
|
11
|
+
initial[compName] = {};
|
|
12
|
+
for (const attrName of Object.keys(compData)) {
|
|
13
|
+
initial[compName][attrName] = true;
|
|
14
|
+
}
|
|
14
15
|
}
|
|
15
|
-
}
|
|
16
|
+
}
|
|
16
17
|
return initial;
|
|
17
18
|
});
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (compData) {
|
|
26
|
-
if (!updated[comp._id]) {
|
|
27
|
-
updated[comp._id] = {};
|
|
28
|
-
}
|
|
29
|
-
Object.keys(compData).forEach((attrName) => {
|
|
30
|
-
// Only add if not already tracked (preserve user's selection)
|
|
31
|
-
if (updated[comp._id][attrName] === undefined) {
|
|
32
|
-
updated[comp._id][attrName] = true;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return updated;
|
|
38
|
-
});
|
|
39
|
-
}, [components, dataValues]);
|
|
40
|
-
// Get components that have data
|
|
41
|
-
const componentsWithData = useMemo(() => {
|
|
42
|
-
return components.filter((comp) => {
|
|
43
|
-
const data = dataValues[comp._id];
|
|
44
|
-
return data && Object.keys(data).length > 0;
|
|
45
|
-
});
|
|
46
|
-
}, [components, dataValues]);
|
|
47
|
-
// Toggle attribute selection
|
|
48
|
-
const toggleAttribute = (componentId, attributeName) => {
|
|
19
|
+
const [pdfTitle, setPdfTitle] = useState(() => title !== null && title !== void 0 ? title : "");
|
|
20
|
+
const [extraInfo, setExtraInfo] = useState(() => extra !== null && extra !== void 0 ? extra : {});
|
|
21
|
+
// Components that have data (keys are now labels)
|
|
22
|
+
const componentNames = Object.entries(dataValues)
|
|
23
|
+
.filter(([, data]) => data && Object.keys(data).length > 0)
|
|
24
|
+
.map(([name]) => name);
|
|
25
|
+
const toggleAttribute = (compName, attrName) => {
|
|
49
26
|
setSelectedAttributes((prev) => {
|
|
50
27
|
var _a;
|
|
51
|
-
return (Object.assign(Object.assign({}, prev), { [
|
|
28
|
+
return (Object.assign(Object.assign({}, prev), { [compName]: Object.assign(Object.assign({}, prev[compName]), { [attrName]: !((_a = prev[compName]) === null || _a === void 0 ? void 0 : _a[attrName]) }) }));
|
|
52
29
|
});
|
|
53
30
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const compData = dataValues[componentId];
|
|
31
|
+
const toggleAllForComponent = (compName, selected) => {
|
|
32
|
+
const compData = dataValues[compName];
|
|
57
33
|
if (!compData)
|
|
58
34
|
return;
|
|
59
|
-
setSelectedAttributes((prev) => (Object.assign(Object.assign({}, prev), { [
|
|
35
|
+
setSelectedAttributes((prev) => (Object.assign(Object.assign({}, prev), { [compName]: Object.keys(compData).reduce((acc, attrName) => {
|
|
60
36
|
acc[attrName] = selected;
|
|
61
37
|
return acc;
|
|
62
38
|
}, {}) })));
|
|
63
39
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const attr = component.attributes.find((a) => a.name === attrName);
|
|
67
|
-
return (attr === null || attr === void 0 ? void 0 : attr.label) || attrName;
|
|
68
|
-
};
|
|
69
|
-
// Format value for display
|
|
70
|
-
const formatValue = (value) => {
|
|
71
|
-
if (typeof value === "object") {
|
|
72
|
-
if (Array.isArray(value)) {
|
|
73
|
-
return value.join(", ");
|
|
74
|
-
}
|
|
75
|
-
return JSON.stringify(value, null, 2);
|
|
76
|
-
}
|
|
77
|
-
return String(value);
|
|
78
|
-
};
|
|
79
|
-
// Check if all attributes are selected for a component
|
|
80
|
-
const areAllSelected = (componentId) => {
|
|
81
|
-
const compData = dataValues[componentId];
|
|
40
|
+
const areAllSelected = (compName) => {
|
|
41
|
+
const compData = dataValues[compName];
|
|
82
42
|
if (!compData)
|
|
83
43
|
return false;
|
|
84
|
-
return Object.keys(compData).every((attrName) => { var _a; return (_a = selectedAttributes[
|
|
44
|
+
return Object.keys(compData).every((attrName) => { var _a; return (_a = selectedAttributes[compName]) === null || _a === void 0 ? void 0 : _a[attrName]; });
|
|
85
45
|
};
|
|
86
|
-
// Generate PDF content and download
|
|
87
46
|
const handleDownload = () => {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
printWindow.document.write(`
|
|
95
|
-
<!DOCTYPE html>
|
|
96
|
-
<html>
|
|
97
|
-
<head>
|
|
98
|
-
<title>Sauvegarde</title>
|
|
99
|
-
<style>
|
|
100
|
-
* {
|
|
101
|
-
margin: 0;
|
|
102
|
-
padding: 0;
|
|
103
|
-
box-sizing: border-box;
|
|
104
|
-
}
|
|
105
|
-
body {
|
|
106
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
107
|
-
padding: 40px;
|
|
108
|
-
color: #333;
|
|
109
|
-
line-height: 1.6;
|
|
110
|
-
}
|
|
111
|
-
.header {
|
|
112
|
-
text-align: center;
|
|
113
|
-
margin-bottom: 30px;
|
|
114
|
-
padding-bottom: 20px;
|
|
115
|
-
border-bottom: 2px solid #2563eb;
|
|
116
|
-
}
|
|
117
|
-
.header h1 {
|
|
118
|
-
color: #1e40af;
|
|
119
|
-
font-size: 24px;
|
|
120
|
-
margin-bottom: 5px;
|
|
121
|
-
}
|
|
122
|
-
.header p {
|
|
123
|
-
color: #6b7280;
|
|
124
|
-
font-size: 12px;
|
|
125
|
-
}
|
|
126
|
-
.component {
|
|
127
|
-
margin-bottom: 30px;
|
|
128
|
-
page-break-inside: avoid;
|
|
129
|
-
}
|
|
130
|
-
.component-title {
|
|
131
|
-
background: #2563eb;
|
|
132
|
-
color: white;
|
|
133
|
-
padding: 10px 15px;
|
|
134
|
-
font-size: 16px;
|
|
135
|
-
font-weight: 600;
|
|
136
|
-
border-radius: 8px 8px 0 0;
|
|
137
|
-
}
|
|
138
|
-
.component-content {
|
|
139
|
-
border: 1px solid #e5e7eb;
|
|
140
|
-
border-top: none;
|
|
141
|
-
border-radius: 0 0 8px 8px;
|
|
142
|
-
padding: 15px;
|
|
143
|
-
}
|
|
144
|
-
.attribute {
|
|
145
|
-
display: flex;
|
|
146
|
-
padding: 10px 0;
|
|
147
|
-
border-bottom: 1px solid #f3f4f6;
|
|
148
|
-
}
|
|
149
|
-
.attribute:last-child {
|
|
150
|
-
border-bottom: none;
|
|
151
|
-
}
|
|
152
|
-
.attribute-name {
|
|
153
|
-
font-weight: 600;
|
|
154
|
-
color: #374151;
|
|
155
|
-
width: 200px;
|
|
156
|
-
flex-shrink: 0;
|
|
157
|
-
}
|
|
158
|
-
.attribute-value {
|
|
159
|
-
color: #4b5563;
|
|
160
|
-
flex: 1;
|
|
161
|
-
word-break: break-word;
|
|
162
|
-
}
|
|
163
|
-
.extra-info {
|
|
164
|
-
margin-bottom: 30px;
|
|
165
|
-
padding: 15px;
|
|
166
|
-
background: #f9fafb;
|
|
167
|
-
border-radius: 8px;
|
|
168
|
-
border: 1px solid #e5e7eb;
|
|
169
|
-
}
|
|
170
|
-
.extra-item {
|
|
171
|
-
display: inline-block;
|
|
172
|
-
margin-right: 20px;
|
|
173
|
-
margin-bottom: 5px;
|
|
174
|
-
}
|
|
175
|
-
.extra-label {
|
|
176
|
-
font-weight: 600;
|
|
177
|
-
color: #374151;
|
|
178
|
-
}
|
|
179
|
-
.extra-value {
|
|
180
|
-
color: #4b5563;
|
|
181
|
-
margin-left: 5px;
|
|
182
|
-
}
|
|
183
|
-
@media print {
|
|
184
|
-
body { padding: 20px; }
|
|
185
|
-
.component { page-break-inside: avoid; }
|
|
186
|
-
@page {
|
|
187
|
-
margin: 20mm;
|
|
188
|
-
margin-top: 10mm;
|
|
189
|
-
margin-bottom: 10mm;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
/* Hide browser headers/footers */
|
|
193
|
-
@page {
|
|
194
|
-
size: auto;
|
|
195
|
-
margin: 10mm;
|
|
196
|
-
}
|
|
197
|
-
</style>
|
|
198
|
-
</head>
|
|
199
|
-
<body>
|
|
200
|
-
${content}
|
|
201
|
-
<script>
|
|
202
|
-
window.onload = function() {
|
|
203
|
-
window.print();
|
|
204
|
-
window.onafterprint = function() {
|
|
205
|
-
window.close();
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
</script>
|
|
209
|
-
</body>
|
|
210
|
-
</html>
|
|
211
|
-
`);
|
|
212
|
-
printWindow.document.close();
|
|
213
|
-
};
|
|
214
|
-
// Generate HTML content for PDF
|
|
215
|
-
const generatePdfContent = () => {
|
|
216
|
-
const date = new Date().toLocaleDateString("fr-FR", {
|
|
217
|
-
year: "numeric",
|
|
218
|
-
month: "long",
|
|
219
|
-
day: "numeric",
|
|
220
|
-
hour: "2-digit",
|
|
221
|
-
minute: "2-digit",
|
|
222
|
-
});
|
|
223
|
-
let html = `
|
|
224
|
-
<div class="header">
|
|
225
|
-
<h1>${title || "Export de Rubrique"}</h1>
|
|
226
|
-
<p>Généré le ${date}</p>
|
|
227
|
-
</div>
|
|
228
|
-
`;
|
|
229
|
-
// Add extra fields if provided
|
|
230
|
-
if (extra && Object.keys(extra).length > 0) {
|
|
231
|
-
html += `
|
|
232
|
-
<div class="extra-info">
|
|
233
|
-
`;
|
|
234
|
-
Object.entries(extra).forEach(([key, value]) => {
|
|
235
|
-
html += `
|
|
236
|
-
<div class="extra-item">
|
|
237
|
-
<span class="extra-label">${key} :</span>
|
|
238
|
-
<span class="extra-value">${String(value)}</span>
|
|
239
|
-
</div>
|
|
240
|
-
`;
|
|
241
|
-
});
|
|
242
|
-
html += `
|
|
243
|
-
</div>
|
|
244
|
-
`;
|
|
245
|
-
}
|
|
246
|
-
componentsWithData.forEach((component) => {
|
|
247
|
-
const compData = dataValues[component._id];
|
|
248
|
-
if (!compData)
|
|
249
|
-
return;
|
|
250
|
-
const selectedAttrs = Object.entries(compData).filter(([attrName]) => { var _a, _b; return (_b = (_a = selectedAttributes[component._id]) === null || _a === void 0 ? void 0 : _a[attrName]) !== null && _b !== void 0 ? _b : true; });
|
|
251
|
-
if (selectedAttrs.length === 0)
|
|
252
|
-
return;
|
|
253
|
-
html += `
|
|
254
|
-
<div class="component">
|
|
255
|
-
<div class="component-title">${component.label || component.name}</div>
|
|
256
|
-
<div class="component-content">
|
|
257
|
-
`;
|
|
258
|
-
selectedAttrs.forEach(([attrName, value]) => {
|
|
259
|
-
const label = getAttributeLabel(component, attrName);
|
|
260
|
-
const formattedValue = formatValue(value);
|
|
261
|
-
html += `
|
|
262
|
-
<div class="attribute">
|
|
263
|
-
<div class="attribute-name">${label}</div>
|
|
264
|
-
<div class="attribute-value">${formattedValue}</div>
|
|
265
|
-
</div>
|
|
266
|
-
`;
|
|
267
|
-
});
|
|
268
|
-
html += `
|
|
269
|
-
</div>
|
|
270
|
-
</div>
|
|
271
|
-
`;
|
|
47
|
+
const html = generatePdfHtml({
|
|
48
|
+
title: pdfTitle,
|
|
49
|
+
extraInfo,
|
|
50
|
+
dataValues,
|
|
51
|
+
selectedAttributes,
|
|
272
52
|
});
|
|
273
|
-
|
|
53
|
+
openPdfPrintWindow(html);
|
|
274
54
|
};
|
|
275
55
|
if (!isOpen)
|
|
276
56
|
return null;
|
|
277
|
-
return (_jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [_jsx("div", { className: "absolute inset-0 bg-black/50", onClick: onClose }), _jsxs("div", { className: "relative bg-white rounded-xl shadow-2xl w-full max-w-3xl max-h-[90vh] flex flex-col mx-4", children: [_jsxs("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-200", children: [_jsx("h2", { className: "text-xl font-semibold text-gray-800", children: "Exporter en PDF" }), _jsx("
|
|
278
|
-
const compData = dataValues[
|
|
57
|
+
return (_jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [_jsx("div", { className: "absolute inset-0 bg-black/50", onClick: onClose }), _jsxs("div", { className: "relative bg-white rounded-xl shadow-2xl w-full max-w-3xl max-h-[90vh] flex flex-col mx-4", children: [_jsxs("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-200", children: [_jsx("h2", { className: "text-xl font-semibold text-gray-800", children: "Exporter en PDF" }), _jsx("button", { type: "button", onClick: onClose, className: "p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-lg transition-colors", children: _jsx("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })] }), _jsxs("div", { className: "flex-1 overflow-y-auto p-6", children: [_jsxs("div", { className: "mb-6", children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Titre du document" }), _jsx("input", { type: "text", value: pdfTitle, onChange: (e) => setPdfTitle(e.target.value), placeholder: "Export de Rubrique", className: "w-full px-3 py-2 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" })] }), _jsx(ExtraInfoSection, { extraInfo: extraInfo, setExtraInfo: setExtraInfo }), _jsx("hr", { className: "mb-4 border-gray-200" }), _jsx("p", { className: "text-sm text-gray-600 mb-4", children: "S\u00E9lectionnez les attributs \u00E0 inclure dans le PDF :" }), componentNames.length === 0 ? (_jsx("div", { className: "text-center py-8 text-gray-500", children: "Aucune donn\u00E9e \u00E0 exporter" })) : (_jsx("div", { className: "space-y-6", children: componentNames.map((compName) => {
|
|
58
|
+
const compData = dataValues[compName];
|
|
279
59
|
if (!compData)
|
|
280
60
|
return null;
|
|
281
|
-
const allSelected = areAllSelected(
|
|
282
|
-
return (_jsxs("div", { className: "border border-gray-200 rounded-lg overflow-hidden", children: [_jsxs("div", { className: "bg-gray-50 px-4 py-3 flex items-center justify-between border-b border-gray-200", children: [_jsx("h3", { className: "font-semibold text-gray-800", children:
|
|
61
|
+
const allSelected = areAllSelected(compName);
|
|
62
|
+
return (_jsxs("div", { className: "border border-gray-200 rounded-lg overflow-hidden", children: [_jsxs("div", { className: "bg-gray-50 px-4 py-3 flex items-center justify-between border-b border-gray-200", children: [_jsx("h3", { className: "font-semibold text-gray-800", children: compName }), _jsx("button", { type: "button", onClick: () => toggleAllForComponent(compName, !allSelected), className: "text-sm text-blue-600 hover:text-blue-700 font-medium", children: allSelected
|
|
283
63
|
? "Tout désélectionner"
|
|
284
64
|
: "Tout sélectionner" })] }), _jsx("div", { className: "divide-y divide-gray-100", children: Object.entries(compData).map(([attrName, value]) => {
|
|
285
65
|
var _a, _b;
|
|
286
|
-
const isSelected = (_b = (_a = selectedAttributes[
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}) })] }, component._id));
|
|
66
|
+
const isSelected = (_b = (_a = selectedAttributes[compName]) === null || _a === void 0 ? void 0 : _a[attrName]) !== null && _b !== void 0 ? _b : true;
|
|
67
|
+
return (_jsxs("label", { className: `flex items-start gap-3 px-4 py-3 cursor-pointer hover:bg-gray-50 transition-colors ${!isSelected ? "opacity-50" : ""}`, children: [_jsx("input", { type: "checkbox", checked: isSelected, onChange: () => toggleAttribute(compName, attrName), className: "mt-1 w-4 h-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500" }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("div", { className: "font-medium text-gray-700", children: attrName }), _jsx("div", { className: "text-sm text-gray-500 truncate", children: formatValue(value) })] })] }, attrName));
|
|
68
|
+
}) })] }, compName));
|
|
290
69
|
}) }))] }), _jsxs("div", { className: "px-6 py-4 border-t border-gray-200 bg-gray-50 flex justify-end gap-3", children: [_jsx("button", { type: "button", onClick: onClose, className: "px-4 py-2 text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors font-medium", children: "Annuler" }), _jsxs("button", { type: "button", onClick: handleDownload, className: "flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium", children: [_jsx("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) }), "T\u00E9l\u00E9charger le PDF"] })] })] })] }));
|
|
291
70
|
}
|
|
292
71
|
//# sourceMappingURL=PdfExportModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdfExportModal.js","sourceRoot":"","sources":["../../src/component/PdfExportModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"PdfExportModal.js","sourceRoot":"","sources":["../../src/component/PdfExportModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EACL,WAAW,EACX,eAAe,EACf,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAYtD,MAAM,UAAU,cAAc,CAAC,EAC7B,MAAM,EACN,OAAO,EACP,UAAU,EACV,KAAK,EACL,KAAK,GACe;IACpB,qCAAqC;IACrC,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAC/C,QAAQ,CAAqB,GAAG,EAAE;QAChC,MAAM,OAAO,GAAuB,EAAE,CAAC;QACvC,KAAK,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAC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B,SAAS,EAAC,mHAAmH,wBAGtH,EACT,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,cAAc,EACvB,SAAS,EAAC,qHAAqH,aAE/H,cACE,SAAS,EAAC,SAAS,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,OAAO,EAAC,WAAW,YAEnB,eACE,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,WAAW,EAAE,CAAC,EACd,CAAC,EAAC,iIAAiI,GACnI,GACE,oCAEC,IACL,IACF,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { Component, Data,
|
|
1
|
+
import { Component, Data, PermissionType, RubricDataValues } from "../util/type";
|
|
2
2
|
type RubricDisplayerProps = {
|
|
3
3
|
components: Component[];
|
|
4
4
|
datas?: (Data | null)[];
|
|
5
|
-
dataValues: RubricDataValues;
|
|
6
|
-
setDataValues: (values: RubricDataValues) => void;
|
|
7
5
|
onSubmit?: (modifiedValues: RubricDataValues) => void;
|
|
8
|
-
|
|
6
|
+
permissions?: PermissionType[];
|
|
9
7
|
pdfTitle?: string;
|
|
10
8
|
pdfExtra?: Record<string, unknown>;
|
|
11
9
|
};
|
|
12
|
-
export declare function RubricDisplayer({ components, datas,
|
|
10
|
+
export declare function RubricDisplayer({ components, datas, onSubmit, permissions, pdfTitle, pdfExtra, }: RubricDisplayerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
11
|
export {};
|
|
@@ -2,46 +2,35 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useMemo, useEffect } from "react";
|
|
3
3
|
import { ComponentDisplayer } from "./ComponentDisplayer";
|
|
4
4
|
import { PdfExportModal } from "./PdfExportModal";
|
|
5
|
-
import {
|
|
6
|
-
export function RubricDisplayer({ components, datas = [],
|
|
5
|
+
import { groupDataByComponentIndex, extractLatestDataValues, formatDate, getComponentPermission, } from "../util/rubricDisplayer";
|
|
6
|
+
export function RubricDisplayer({ components, datas = [], onSubmit, permissions, pdfTitle, pdfExtra, }) {
|
|
7
7
|
var _a, _b;
|
|
8
8
|
const [selectedComponentIndex, setSelectedComponentIndex] = useState(0);
|
|
9
9
|
const [selectedHistoryIndex, setSelectedHistoryIndex] = useState({});
|
|
10
|
-
const [isInitialized, setIsInitialized] = useState(false);
|
|
11
10
|
const [isPdfModalOpen, setIsPdfModalOpen] = useState(false);
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const [pdfDataValues, setPdfDataValues] = useState({});
|
|
12
|
+
// Internal state for form values
|
|
13
|
+
const [dataValues, setDataValues] = useState(() => extractLatestDataValues(components, datas));
|
|
14
|
+
// Store original values for diff comparison
|
|
15
|
+
const [originalValues, setOriginalValues] = useState(() => structuredClone(extractLatestDataValues(components, datas)));
|
|
16
|
+
// Re-initialize when datas changes (e.g. navigating between rubrics)
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (datas.length === 0)
|
|
19
|
+
return;
|
|
20
|
+
const initialValues = extractLatestDataValues(components, datas);
|
|
21
|
+
setDataValues(initialValues);
|
|
22
|
+
setOriginalValues(structuredClone(initialValues));
|
|
23
|
+
}, [datas, components]);
|
|
14
24
|
// Group existing data by component (using index-based mapping)
|
|
15
25
|
// Note: datas may contain null values - index position matters for component mapping
|
|
16
26
|
const componentDataMap = useMemo(() => groupDataByComponentIndex(components, datas), [components, datas]);
|
|
17
|
-
// Initialize dataValues from datas on first render (if datas exist and dataValues is empty)
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
const hasValidData = datas.some((d) => d !== null);
|
|
20
|
-
if (!isInitialized && hasValidData && components.length > 0) {
|
|
21
|
-
const hasExistingData = Object.keys(dataValues).length > 0;
|
|
22
|
-
if (!hasExistingData) {
|
|
23
|
-
// Extract latest values from datas and initialize dataValues
|
|
24
|
-
const initialValues = extractLatestDataValues(components, datas);
|
|
25
|
-
if (Object.keys(initialValues).length > 0) {
|
|
26
|
-
setDataValues(initialValues);
|
|
27
|
-
// Store DEEP COPY of original values for later comparison
|
|
28
|
-
setOriginalValues(JSON.parse(JSON.stringify(initialValues)));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// If dataValues already has data, use DEEP COPY as original
|
|
33
|
-
setOriginalValues(JSON.parse(JSON.stringify(dataValues)));
|
|
34
|
-
}
|
|
35
|
-
setIsInitialized(true);
|
|
36
|
-
}
|
|
37
|
-
}, [datas, components, dataValues, setDataValues, isInitialized]);
|
|
38
27
|
// Get current component
|
|
39
28
|
const currentComponent = components[selectedComponentIndex];
|
|
40
29
|
if (!currentComponent)
|
|
41
30
|
return null;
|
|
42
31
|
const currentComponentId = currentComponent._id;
|
|
43
32
|
// Get permission for current component
|
|
44
|
-
const componentPermission = getComponentPermission(
|
|
33
|
+
const componentPermission = getComponentPermission(permissions, currentComponent.name);
|
|
45
34
|
const isDisabled = componentPermission === "read";
|
|
46
35
|
// Get history for current component
|
|
47
36
|
const componentHistory = ((_a = componentDataMap.get(currentComponentId)) === null || _a === void 0 ? void 0 : _a.history) || [];
|
|
@@ -101,9 +90,28 @@ export function RubricDisplayer({ components, datas = [], dataValues, setDataVal
|
|
|
101
90
|
onSubmit(modifiedValues);
|
|
102
91
|
}
|
|
103
92
|
};
|
|
104
|
-
|
|
93
|
+
// Transform dataValues into display-ready format for PDF
|
|
94
|
+
// Component IDs → component labels, attribute names → attribute labels
|
|
95
|
+
const openPdfModal = () => {
|
|
96
|
+
const transformed = {};
|
|
97
|
+
for (const comp of components) {
|
|
98
|
+
const compData = dataValues[comp._id];
|
|
99
|
+
if (!compData || Object.keys(compData).length === 0)
|
|
100
|
+
continue;
|
|
101
|
+
const labeledData = {};
|
|
102
|
+
for (const [attrName, value] of Object.entries(compData)) {
|
|
103
|
+
const attr = comp.attributes.find((a) => a.name === attrName);
|
|
104
|
+
const label = (attr === null || attr === void 0 ? void 0 : attr.label) || attrName;
|
|
105
|
+
labeledData[label] = value;
|
|
106
|
+
}
|
|
107
|
+
transformed[comp.label || comp.name] = labeledData;
|
|
108
|
+
}
|
|
109
|
+
setPdfDataValues(transformed);
|
|
110
|
+
setIsPdfModalOpen(true);
|
|
111
|
+
};
|
|
112
|
+
return (_jsxs("div", { className: "w-full", children: [_jsx("div", { className: "flex justify-end mb-4", children: _jsxs("button", { type: "button", onClick: openPdfModal, className: "flex items-center gap-2 px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors font-medium text-sm", children: [_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) }), "Exporter PDF"] }) }), _jsx("div", { className: "flex flex-wrap gap-2 mb-6 border-b border-gray-200 pb-4", children: components.map((component, index) => {
|
|
105
113
|
var _a;
|
|
106
|
-
const compPermission = getComponentPermission(
|
|
114
|
+
const compPermission = getComponentPermission(permissions, component.name);
|
|
107
115
|
const hasData = (((_a = componentDataMap.get(component._id)) === null || _a === void 0 ? void 0 : _a.history.length) || 0) > 0;
|
|
108
116
|
return (_jsxs("button", { type: "button", onClick: () => setSelectedComponentIndex(index), className: `
|
|
109
117
|
px-4 py-2 rounded-lg font-medium text-sm transition-all
|
|
@@ -146,6 +154,6 @@ export function RubricDisplayer({ components, datas = [], dataValues, setDataVal
|
|
|
146
154
|
? "bg-blue-300"
|
|
147
155
|
: "bg-gray-300"}
|
|
148
156
|
`, title: comp.label || comp.name }, comp._id));
|
|
149
|
-
}) }), _jsx(PdfExportModal, { isOpen: isPdfModalOpen, onClose: () => setIsPdfModalOpen(false),
|
|
157
|
+
}) }), _jsx(PdfExportModal, { isOpen: isPdfModalOpen, onClose: () => setIsPdfModalOpen(false), dataValues: pdfDataValues, title: pdfTitle, extra: pdfExtra })] }));
|
|
150
158
|
}
|
|
151
159
|
//# sourceMappingURL=RubricDisplayer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RubricDisplayer.js","sourceRoot":"","sources":["../../src/component/RubricDisplayer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"RubricDisplayer.js","sourceRoot":"","sources":["../../src/component/RubricDisplayer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,UAAU,EACV,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAWjC,MAAM,UAAU,eAAe,CAAC,EAC9B,UAAU,EACV,KAAK,GAAG,EAAE,EACV,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,GACa;;IACrB,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxE,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,CAE9D,EAAE,CAAC,CAAC;IACN,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAmB,EAAE,CAAC,CAAC;IAEzE,iC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,CAAC,CAAC;oBACtC,MAAM,OAAO,GAAG,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;oBAE7D,OAAO,CACL,iBAEE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAC/C,SAAS,EAAE;;kBAGP,sBAAsB,KAAK,KAAK;4BAC9B,CAAC,CAAC,uBAAuB;4BACzB,CAAC,CAAC,OAAO;gCACP,CAAC,CAAC,aAAa;gCACf,CAAC,CAAC,aACR;eACD,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,IAbzB,IAAI,CAAC,GAAG,CAcb,CACH,CAAC;gBACJ,CAAC,CAAC,GACE,EAGN,KAAC,cAAc,IACb,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,EACvC,UAAU,EAAE,aAAa,EACzB,KAAK,EAAE,QAAQ,EACf,KAAK,EAAE,QAAQ,GACf,IACE,CACP,CAAC;AACJ,CAAC"}
|
package/dist/index.css
CHANGED
|
@@ -642,6 +642,10 @@ video {
|
|
|
642
642
|
margin-bottom: 0.5rem;
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
.mb-3 {
|
|
646
|
+
margin-bottom: 0.75rem;
|
|
647
|
+
}
|
|
648
|
+
|
|
645
649
|
.mb-4 {
|
|
646
650
|
margin-bottom: 1rem;
|
|
647
651
|
}
|
|
@@ -654,6 +658,10 @@ video {
|
|
|
654
658
|
margin-bottom: 2rem;
|
|
655
659
|
}
|
|
656
660
|
|
|
661
|
+
.ml-1 {
|
|
662
|
+
margin-left: 0.25rem;
|
|
663
|
+
}
|
|
664
|
+
|
|
657
665
|
.ml-2 {
|
|
658
666
|
margin-left: 0.5rem;
|
|
659
667
|
}
|
|
@@ -912,6 +920,11 @@ video {
|
|
|
912
920
|
border-top-width: 1px;
|
|
913
921
|
}
|
|
914
922
|
|
|
923
|
+
.border-blue-200 {
|
|
924
|
+
--tw-border-opacity: 1;
|
|
925
|
+
border-color: rgb(191 219 254 / var(--tw-border-opacity));
|
|
926
|
+
}
|
|
927
|
+
|
|
915
928
|
.border-blue-500 {
|
|
916
929
|
--tw-border-opacity: 1;
|
|
917
930
|
border-color: rgb(59 130 246 / var(--tw-border-opacity));
|
|
@@ -1184,6 +1197,11 @@ video {
|
|
|
1184
1197
|
color: rgb(0 0 0 / var(--tw-text-opacity));
|
|
1185
1198
|
}
|
|
1186
1199
|
|
|
1200
|
+
.text-blue-400 {
|
|
1201
|
+
--tw-text-opacity: 1;
|
|
1202
|
+
color: rgb(96 165 250 / var(--tw-text-opacity));
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1187
1205
|
.text-blue-500 {
|
|
1188
1206
|
--tw-text-opacity: 1;
|
|
1189
1207
|
color: rgb(59 130 246 / var(--tw-text-opacity));
|
|
@@ -1329,6 +1347,11 @@ video {
|
|
|
1329
1347
|
--tw-bg-opacity: 1;
|
|
1330
1348
|
}
|
|
1331
1349
|
|
|
1350
|
+
.hover\:text-blue-600:hover {
|
|
1351
|
+
--tw-text-opacity: 1;
|
|
1352
|
+
color: rgb(37 99 235 / var(--tw-text-opacity));
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1332
1355
|
.hover\:text-blue-700:hover {
|
|
1333
1356
|
--tw-text-opacity: 1;
|
|
1334
1357
|
color: rgb(29 78 216 / var(--tw-text-opacity));
|
|
@@ -1353,6 +1376,12 @@ video {
|
|
|
1353
1376
|
outline-offset: 2px;
|
|
1354
1377
|
}
|
|
1355
1378
|
|
|
1379
|
+
.focus\:ring-2:focus {
|
|
1380
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
1381
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
1382
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1356
1385
|
.focus\:ring-blue-500:focus {
|
|
1357
1386
|
--tw-ring-opacity: 1;
|
|
1358
1387
|
--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity));
|
|
@@ -1362,6 +1391,15 @@ video {
|
|
|
1362
1391
|
pointer-events: none;
|
|
1363
1392
|
}
|
|
1364
1393
|
|
|
1394
|
+
.disabled\:cursor-not-allowed:disabled {
|
|
1395
|
+
cursor: not-allowed;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
.disabled\:bg-gray-300:disabled {
|
|
1399
|
+
--tw-bg-opacity: 1;
|
|
1400
|
+
background-color: rgb(209 213 219 / var(--tw-bg-opacity));
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1365
1403
|
.disabled\:bg-gray-400:disabled {
|
|
1366
1404
|
--tw-bg-opacity: 1;
|
|
1367
1405
|
background-color: rgb(156 163 175 / var(--tw-bg-opacity));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RubricDataValues } from "./type";
|
|
2
|
+
/**
|
|
3
|
+
* Format a value (string or object) for display
|
|
4
|
+
*/
|
|
5
|
+
export declare function formatValue(value: string | object): string;
|
|
6
|
+
type GeneratePdfHtmlParams = {
|
|
7
|
+
title: string;
|
|
8
|
+
extraInfo: Record<string, unknown>;
|
|
9
|
+
dataValues: RubricDataValues;
|
|
10
|
+
selectedAttributes: Record<string, Record<string, boolean>>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Build the full HTML content for the PDF document.
|
|
14
|
+
* dataValues keys are component labels, attribute keys are attribute labels.
|
|
15
|
+
*/
|
|
16
|
+
export declare function generatePdfHtml({ title, extraInfo, dataValues, selectedAttributes, }: GeneratePdfHtmlParams): string;
|
|
17
|
+
/**
|
|
18
|
+
* Open a print window with the generated HTML and trigger browser print dialog
|
|
19
|
+
*/
|
|
20
|
+
export declare function openPdfPrintWindow(htmlContent: string): void;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format a value (string or object) for display
|
|
3
|
+
*/
|
|
4
|
+
export function formatValue(value) {
|
|
5
|
+
if (typeof value === "object") {
|
|
6
|
+
if (Array.isArray(value)) {
|
|
7
|
+
return value.join(", ");
|
|
8
|
+
}
|
|
9
|
+
return JSON.stringify(value, null, 2);
|
|
10
|
+
}
|
|
11
|
+
return String(value);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Build the full HTML content for the PDF document.
|
|
15
|
+
* dataValues keys are component labels, attribute keys are attribute labels.
|
|
16
|
+
*/
|
|
17
|
+
export function generatePdfHtml({ title, extraInfo, dataValues, selectedAttributes, }) {
|
|
18
|
+
const date = new Date().toLocaleDateString("fr-FR", {
|
|
19
|
+
year: "numeric",
|
|
20
|
+
month: "long",
|
|
21
|
+
day: "numeric",
|
|
22
|
+
hour: "2-digit",
|
|
23
|
+
minute: "2-digit",
|
|
24
|
+
});
|
|
25
|
+
let html = `
|
|
26
|
+
<div class="header">
|
|
27
|
+
<h1>${title || "Export de Rubrique"}</h1>
|
|
28
|
+
<p>Généré le ${date}</p>
|
|
29
|
+
</div>
|
|
30
|
+
`;
|
|
31
|
+
// Extra fields
|
|
32
|
+
if (Object.keys(extraInfo).length > 0) {
|
|
33
|
+
html += `<div class="extra-info">`;
|
|
34
|
+
Object.entries(extraInfo).forEach(([key, value]) => {
|
|
35
|
+
html += `
|
|
36
|
+
<div class="extra-item">
|
|
37
|
+
<span class="extra-label">${key} :</span>
|
|
38
|
+
<span class="extra-value">${String(value)}</span>
|
|
39
|
+
</div>
|
|
40
|
+
`;
|
|
41
|
+
});
|
|
42
|
+
html += `</div>`;
|
|
43
|
+
}
|
|
44
|
+
// Iterate over components (keys are labels)
|
|
45
|
+
Object.entries(dataValues).forEach(([compName, compData]) => {
|
|
46
|
+
if (!compData || Object.keys(compData).length === 0)
|
|
47
|
+
return;
|
|
48
|
+
const selectedAttrs = Object.entries(compData).filter(([attrName]) => { var _a, _b; return (_b = (_a = selectedAttributes[compName]) === null || _a === void 0 ? void 0 : _a[attrName]) !== null && _b !== void 0 ? _b : true; });
|
|
49
|
+
if (selectedAttrs.length === 0)
|
|
50
|
+
return;
|
|
51
|
+
html += `
|
|
52
|
+
<div class="component">
|
|
53
|
+
<div class="component-title">${compName}</div>
|
|
54
|
+
<div class="component-content">
|
|
55
|
+
`;
|
|
56
|
+
selectedAttrs.forEach(([attrName, value]) => {
|
|
57
|
+
html += `
|
|
58
|
+
<div class="attribute">
|
|
59
|
+
<div class="attribute-name">${attrName}</div>
|
|
60
|
+
<div class="attribute-value">${formatValue(value)}</div>
|
|
61
|
+
</div>
|
|
62
|
+
`;
|
|
63
|
+
});
|
|
64
|
+
html += `
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
`;
|
|
68
|
+
});
|
|
69
|
+
return html;
|
|
70
|
+
}
|
|
71
|
+
const PDF_STYLES = `
|
|
72
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
73
|
+
body {
|
|
74
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
75
|
+
padding: 40px;
|
|
76
|
+
color: #333;
|
|
77
|
+
line-height: 1.6;
|
|
78
|
+
}
|
|
79
|
+
.header {
|
|
80
|
+
text-align: center;
|
|
81
|
+
margin-bottom: 30px;
|
|
82
|
+
padding-bottom: 20px;
|
|
83
|
+
border-bottom: 2px solid #2563eb;
|
|
84
|
+
}
|
|
85
|
+
.header h1 { color: #1e40af; font-size: 24px; margin-bottom: 5px; }
|
|
86
|
+
.header p { color: #6b7280; font-size: 12px; }
|
|
87
|
+
.component { margin-bottom: 30px; page-break-inside: avoid; }
|
|
88
|
+
.component-title {
|
|
89
|
+
background: #2563eb;
|
|
90
|
+
color: white;
|
|
91
|
+
padding: 10px 15px;
|
|
92
|
+
font-size: 16px;
|
|
93
|
+
font-weight: 600;
|
|
94
|
+
border-radius: 8px 8px 0 0;
|
|
95
|
+
}
|
|
96
|
+
.component-content {
|
|
97
|
+
border: 1px solid #e5e7eb;
|
|
98
|
+
border-top: none;
|
|
99
|
+
border-radius: 0 0 8px 8px;
|
|
100
|
+
padding: 15px;
|
|
101
|
+
}
|
|
102
|
+
.attribute {
|
|
103
|
+
display: flex;
|
|
104
|
+
padding: 10px 0;
|
|
105
|
+
border-bottom: 1px solid #f3f4f6;
|
|
106
|
+
}
|
|
107
|
+
.attribute:last-child { border-bottom: none; }
|
|
108
|
+
.attribute-name {
|
|
109
|
+
font-weight: 600;
|
|
110
|
+
color: #374151;
|
|
111
|
+
width: 200px;
|
|
112
|
+
flex-shrink: 0;
|
|
113
|
+
}
|
|
114
|
+
.attribute-value {
|
|
115
|
+
color: #4b5563;
|
|
116
|
+
flex: 1;
|
|
117
|
+
word-break: break-word;
|
|
118
|
+
}
|
|
119
|
+
.extra-info {
|
|
120
|
+
margin-bottom: 30px;
|
|
121
|
+
padding: 15px;
|
|
122
|
+
background: #f9fafb;
|
|
123
|
+
border-radius: 8px;
|
|
124
|
+
border: 1px solid #e5e7eb;
|
|
125
|
+
}
|
|
126
|
+
.extra-item { display: inline-block; margin-right: 20px; margin-bottom: 5px; }
|
|
127
|
+
.extra-label { font-weight: 600; color: #374151; }
|
|
128
|
+
.extra-value { color: #4b5563; margin-left: 5px; }
|
|
129
|
+
@media print {
|
|
130
|
+
body { padding: 20px; }
|
|
131
|
+
.component { page-break-inside: avoid; }
|
|
132
|
+
@page { margin: 20mm; margin-top: 10mm; margin-bottom: 10mm; }
|
|
133
|
+
}
|
|
134
|
+
@page { size: auto; margin: 10mm; }
|
|
135
|
+
`;
|
|
136
|
+
/**
|
|
137
|
+
* Open a print window with the generated HTML and trigger browser print dialog
|
|
138
|
+
*/
|
|
139
|
+
export function openPdfPrintWindow(htmlContent) {
|
|
140
|
+
const printWindow = window.open("", "_blank");
|
|
141
|
+
if (!printWindow) {
|
|
142
|
+
alert("Veuillez autoriser les popups pour télécharger le PDF");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
printWindow.document.write(`
|
|
146
|
+
<!DOCTYPE html>
|
|
147
|
+
<html>
|
|
148
|
+
<head>
|
|
149
|
+
<title>Sauvegarde</title>
|
|
150
|
+
<style>${PDF_STYLES}</style>
|
|
151
|
+
</head>
|
|
152
|
+
<body>
|
|
153
|
+
${htmlContent}
|
|
154
|
+
<script>
|
|
155
|
+
window.onload = function() {
|
|
156
|
+
window.print();
|
|
157
|
+
window.onafterprint = function() { window.close(); };
|
|
158
|
+
};
|
|
159
|
+
</script>
|
|
160
|
+
</body>
|
|
161
|
+
</html>
|
|
162
|
+
`);
|
|
163
|
+
printWindow.document.close();
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=pdfExport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdfExport.js","sourceRoot":"","sources":["../../src/util/pdfExport.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAsB;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AASD;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,KAAK,EACL,SAAS,EACT,UAAU,EACV,kBAAkB,GACI;IACtB,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAClD,IAA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IAAI,IAAI;;wCAE0B,QAAQ;yCACP,WAAW,CAAC,KAAK,CAAC;;OAEpD,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,IAAI,IAAI;;;KAGP,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgElB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAmB;IACpD,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC9C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,KAAK,CAAC,uDAAuD,CAAC,CAAC;QAC/D,OAAO;IACT,CAAC;IAED,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC;;;;;iBAKZ,UAAU;;;UAGjB,WAAW;;;;;;;;;GASlB,CAAC,CAAC;IACH,WAAW,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Component, Data,
|
|
1
|
+
import { Component, Data, ComponentDataHistory, RubricDataValues, PermissionType } from "./type";
|
|
2
2
|
/**
|
|
3
3
|
* Get permission level for a specific component
|
|
4
4
|
*/
|
|
5
|
-
export declare function getComponentPermission(
|
|
5
|
+
export declare function getComponentPermission(permissions: PermissionType[] | undefined, componentName: string): "read" | "write" | null;
|
|
6
6
|
/**
|
|
7
7
|
* Check if user can edit a component (has write permission)
|
|
8
8
|
*/
|
|
9
|
-
export declare function canEditComponent(permission:
|
|
9
|
+
export declare function canEditComponent(permission: PermissionType[] | undefined, componentName: string): boolean;
|
|
10
10
|
/**
|
|
11
11
|
* Groups data by component using INDEX-BASED mapping for first N items,
|
|
12
12
|
* then COMPONENT ID matching for historical items.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get permission level for a specific component
|
|
3
3
|
*/
|
|
4
|
-
export function getComponentPermission(
|
|
5
|
-
if (!
|
|
4
|
+
export function getComponentPermission(permissions, componentName) {
|
|
5
|
+
if (!permissions)
|
|
6
6
|
return null;
|
|
7
|
-
const perm =
|
|
7
|
+
const perm = permissions.find((p) => p.component === componentName);
|
|
8
8
|
return (perm === null || perm === void 0 ? void 0 : perm.permission) || null;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rubricDisplayer.js","sourceRoot":"","sources":["../../src/util/rubricDisplayer.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,
|
|
1
|
+
{"version":3,"file":"rubricDisplayer.js","sourceRoot":"","sources":["../../src/util/rubricDisplayer.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,WAAyC,EACzC,aAAqB;IAErB,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC9B,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,aAAa,CAAC,CAAC;IACpE,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,KAAI,IAAI,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,UAAwC,EACxC,aAAqB;IAErB,OAAO,sBAAsB,CAAC,UAAU,EAAE,aAAa,CAAC,KAAK,OAAO,CAAC;AACvE,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,yBAAyB,CACvC,UAAuB,EACvB,KAAsB;IAEtB,MAAM,MAAM,GAAG,IAAI,GAAG,EAAgC,CAAC;IACvD,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAEzC,+CAA+C;IAC/C,UAAU,CA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