@movalib/movalib-commons 1.68.21 → 1.68.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/components/QrCodePLVContainer/PLVComponent.d.ts +1 -3
- package/dist/src/components/QrCodePLVContainer/PLVComponent.js +7 -14
- package/package.json +1 -1
- package/src/components/QrCodePLVContainer/PLVComponent.tsx +8 -10
- package/src/components/QrCodePLVContainer/QrCodePLVContainer.tsx +10 -12
|
@@ -13,7 +13,5 @@ type PLVComponentProps = {
|
|
|
13
13
|
export declare class PLVComponent extends React.Component<PLVComponentProps> {
|
|
14
14
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
}
|
|
16
|
-
export declare
|
|
17
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
}
|
|
16
|
+
export declare const PLVComponentV2: React.ForwardRefExoticComponent<PLVComponentProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
17
|
export {};
|
|
@@ -127,20 +127,13 @@ var PLVComponent = /** @class */ (function (_super) {
|
|
|
127
127
|
return PLVComponent;
|
|
128
128
|
}(react_1.default.Component));
|
|
129
129
|
exports.PLVComponent = PLVComponent;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
width: this.props.printSize === PrintSize.A4 ? '210mm' : this.props.printSize === PrintSize.A3 ? '297mm' : '0mm',
|
|
138
|
-
height: this.props.printSize === PrintSize.A4 ? '297mm' : this.props.printSize === PrintSize.A3 ? '420mm' : '0mm',
|
|
139
|
-
}, children: (0, jsx_runtime_1.jsx)(material_1.Grid, { container: true, children: (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, children: (0, jsx_runtime_1.jsx)("img", { src: this.props.url, style: { display: 'block', width: '100%', height: '100%', objectFit: 'cover' } }) }) }) }));
|
|
140
|
-
};
|
|
141
|
-
return PLVComponentV2;
|
|
142
|
-
}(react_1.default.Component));
|
|
143
|
-
exports.PLVComponentV2 = PLVComponentV2;
|
|
130
|
+
exports.PLVComponentV2 = react_1.default.forwardRef(function (_a, ref) {
|
|
131
|
+
var url = _a.url, printSize = _a.printSize;
|
|
132
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: 'printable-content', style: {
|
|
133
|
+
width: printSize === PrintSize.A4 ? '210mm' : printSize === PrintSize.A3 ? '297mm' : '0mm',
|
|
134
|
+
height: printSize === PrintSize.A4 ? '297mm' : printSize === PrintSize.A3 ? '420mm' : '0mm',
|
|
135
|
+
}, children: (0, jsx_runtime_1.jsx)(material_1.Grid, { container: true, children: (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, children: (0, jsx_runtime_1.jsx)("img", { src: url, style: { display: 'block', width: '100%', height: '100%', objectFit: 'cover' } }) }) }) }));
|
|
136
|
+
});
|
|
144
137
|
// CSS pour cacher le contenu à l'écran mais le rendre imprimable
|
|
145
138
|
var css = "\nbody {\n margin: 0;\n }\n .highlight {\n background-color: #BCD46C; /* Couleur de surlignage */\n margin: 4px 4px; /* Espacement autour du texte surlign\u00E9 */\n padding-left : 8px;\n padding-right: 8px;\n font-weight: 500;\n color: white;\n }\n .not-highlight {\n margin: 4px 4px; /* Espacement autour du texte surlign\u00E9 */\n padding-left : 8px;\n padding-right: 8px;\n color: #BCD46C;\n }\n\n .printable-content {\n margin: 0;\n padding: 0;\n visibility: hidden;\n position: absolute;\n left: -10000px;\n top: -10000px;\n\n }\n @media print {\n body {\n margin: 0;\n }\n .printable-content {\n margin: 0;\n padding: 0;\n visibility: visible;\n position: static;\n }\n }\n";
|
|
146
139
|
var styleSheet = document.createElement('style');
|
package/package.json
CHANGED
|
@@ -181,28 +181,26 @@ export class PLVComponent extends React.Component<PLVComponentProps> {
|
|
|
181
181
|
|
|
182
182
|
|
|
183
183
|
|
|
184
|
-
export
|
|
185
|
-
|
|
184
|
+
export const PLVComponentV2 = React.forwardRef<HTMLDivElement, PLVComponentProps>(
|
|
185
|
+
({ url, printSize }, ref) => {
|
|
186
186
|
return (
|
|
187
187
|
<div
|
|
188
|
+
ref={ref}
|
|
188
189
|
className='printable-content'
|
|
189
190
|
style={{
|
|
190
|
-
width:
|
|
191
|
-
|
|
192
|
-
height:
|
|
193
|
-
this.props.printSize === PrintSize.A4 ? '297mm' : this.props.printSize === PrintSize.A3 ? '420mm' : '0mm',
|
|
191
|
+
width: printSize === PrintSize.A4 ? '210mm' : printSize === PrintSize.A3 ? '297mm' : '0mm',
|
|
192
|
+
height: printSize === PrintSize.A4 ? '297mm' : printSize === PrintSize.A3 ? '420mm' : '0mm',
|
|
194
193
|
}}
|
|
195
194
|
>
|
|
196
|
-
|
|
195
|
+
<Grid container>
|
|
197
196
|
<Grid item xs={12}>
|
|
198
|
-
<img src={
|
|
197
|
+
<img src={url} style={{ display: 'block', width: '100%', height: '100%', objectFit: 'cover' }} />
|
|
199
198
|
</Grid>
|
|
200
199
|
</Grid>
|
|
201
200
|
</div>
|
|
202
201
|
);
|
|
203
202
|
}
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
);
|
|
206
204
|
// CSS pour cacher le contenu à l'écran mais le rendre imprimable
|
|
207
205
|
const css = `
|
|
208
206
|
body {
|
|
@@ -37,8 +37,8 @@ export const QrCodePLVContainer = ({ data }: { data: string }) => {
|
|
|
37
37
|
|
|
38
38
|
const qrCodeRef = useRef<HTMLDivElement>(null);
|
|
39
39
|
const theme = useTheme();
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const PLVrefA4 = useRef<HTMLDivElement>(null);
|
|
41
|
+
const PLVrefA3 = useRef<HTMLDivElement>(null);
|
|
42
42
|
//si sur l'impression des PLV en A4 ou A3 le Qrcode est flou,
|
|
43
43
|
//il faut modifier la width et height, imageSize du qrCodeOptions et mettre les mêmes valeurs que dans le optionQrcode de la fonction printPLV
|
|
44
44
|
const qrCodeOptions: Options = useMemo(
|
|
@@ -234,17 +234,15 @@ const blob = new Blob([modifiedPdfBytes.buffer as ArrayBuffer], { type: "applica
|
|
|
234
234
|
}
|
|
235
235
|
setSelectedChoice(e.target.value as SelectChoice);
|
|
236
236
|
};
|
|
237
|
+
const printA3PLV = useReactToPrint({
|
|
238
|
+
contentRef: PLVrefA3,
|
|
239
|
+
documentTitle: "Movalib_PLV_A3",
|
|
240
|
+
});
|
|
237
241
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
const printA4PLV = useReactToPrint({
|
|
244
|
-
contentRef: PLVrefA4 as unknown as React.RefObject<HTMLElement>,
|
|
245
|
-
documentTitle: "Movalib_PLV_A4",
|
|
246
|
-
});
|
|
247
|
-
|
|
242
|
+
const printA4PLV = useReactToPrint({
|
|
243
|
+
contentRef: PLVrefA4,
|
|
244
|
+
documentTitle: "Movalib_PLV_A4",
|
|
245
|
+
});
|
|
248
246
|
const onClickDownload = useMemo(() => {
|
|
249
247
|
switch (selectedChoice) {
|
|
250
248
|
case "A3":
|