react-ink-scripter 0.0.23 → 0.0.25
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/cjs/index.js +18 -5
- package/dist/esm/IFrame.d.ts +2 -2
- package/dist/esm/index.js +6 -5
- package/package.json +35 -28
package/dist/cjs/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var reactDom = require('react-dom');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var
|
|
7
|
+
var _typeof = require('@babel/runtime/helpers/typeof');
|
|
8
8
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
9
9
|
|
|
10
10
|
var IFrame = react.forwardRef(function (props, ref) {
|
|
@@ -24,7 +24,7 @@ var IFrame = react.forwardRef(function (props, ref) {
|
|
|
24
24
|
var attachBody = iframeRef === null || iframeRef === void 0 ? void 0 : (_iframeRef$current = iframeRef.current) === null || _iframeRef$current === void 0 ? void 0 : (_iframeRef$current$co = _iframeRef$current.contentWindow) === null || _iframeRef$current$co === void 0 ? void 0 : (_iframeRef$current$co2 = _iframeRef$current$co.document) === null || _iframeRef$current$co2 === void 0 ? void 0 : _iframeRef$current$co2.body;
|
|
25
25
|
var attachHead = iframeRef === null || iframeRef === void 0 ? void 0 : (_iframeRef$current2 = iframeRef.current) === null || _iframeRef$current2 === void 0 ? void 0 : (_iframeRef$current2$c = _iframeRef$current2.contentWindow) === null || _iframeRef$current2$c === void 0 ? void 0 : (_iframeRef$current2$c2 = _iframeRef$current2$c.document) === null || _iframeRef$current2$c2 === void 0 ? void 0 : _iframeRef$current2$c2.head;
|
|
26
26
|
react.useImperativeHandle(ref, function () {
|
|
27
|
-
return iframeRef === null || iframeRef === void 0 ? void 0 : iframeRef.current;
|
|
27
|
+
return (iframeRef === null || iframeRef === void 0 ? void 0 : iframeRef.current) || undefined;
|
|
28
28
|
}, []);
|
|
29
29
|
return jsxRuntime.jsxs("iframe", {
|
|
30
30
|
ref: iframeRef,
|
|
@@ -37,6 +37,18 @@ var IFrame = react.forwardRef(function (props, ref) {
|
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
+
function r(e) {
|
|
41
|
+
var t,
|
|
42
|
+
f,
|
|
43
|
+
n = "";
|
|
44
|
+
if ("string" == typeof e || "number" == typeof e) n += e;else if ("object" == _typeof(e)) if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);else for (t in e) e[t] && (n && (n += " "), n += t);
|
|
45
|
+
return n;
|
|
46
|
+
}
|
|
47
|
+
function clsx() {
|
|
48
|
+
for (var e, t, f = 0, n = ""; f < arguments.length;) (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
49
|
+
return n;
|
|
50
|
+
}
|
|
51
|
+
|
|
40
52
|
var PrinterFrame = react.forwardRef(function (props, ref) {
|
|
41
53
|
var _iframeRef$current2, _iframeRef$current2$c, _iframeRef$current2$c2, _iframeRef$current3, _iframeRef$current3$c, _iframeRef$current3$c2, _iframeRef$current4, _iframeRef$current4$c, _iframeRef$current4$c2;
|
|
42
54
|
var styleCss = props.styleCss,
|
|
@@ -193,11 +205,12 @@ var TableCell = function TableCell(_ref2) {
|
|
|
193
205
|
header = item.header,
|
|
194
206
|
colSpan = item.colSpan,
|
|
195
207
|
rowSpan = item.rowSpan,
|
|
196
|
-
value = item.value
|
|
208
|
+
value = item.value,
|
|
209
|
+
className = item.className;
|
|
197
210
|
if (header) {
|
|
198
211
|
return jsxRuntime.jsx("th", {
|
|
199
212
|
id: id,
|
|
200
|
-
className:
|
|
213
|
+
className: clsx('inks-cell', className),
|
|
201
214
|
colSpan: colSpan,
|
|
202
215
|
rowSpan: rowSpan,
|
|
203
216
|
children: value
|
|
@@ -205,7 +218,7 @@ var TableCell = function TableCell(_ref2) {
|
|
|
205
218
|
}
|
|
206
219
|
return jsxRuntime.jsx("td", {
|
|
207
220
|
id: id,
|
|
208
|
-
className:
|
|
221
|
+
className: clsx('inks-cell', className),
|
|
209
222
|
colSpan: colSpan,
|
|
210
223
|
rowSpan: rowSpan,
|
|
211
224
|
children: value
|
package/dist/esm/IFrame.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
2
|
export interface IFrameProps {
|
|
3
3
|
className?: string;
|
|
4
4
|
styleCss?: string;
|
|
@@ -6,4 +6,4 @@ export interface IFrameProps {
|
|
|
6
6
|
width?: string | number;
|
|
7
7
|
height?: string | number;
|
|
8
8
|
}
|
|
9
|
-
export declare const IFrame: ForwardRefExoticComponent<IFrameProps & RefAttributes<
|
|
9
|
+
export declare const IFrame: import("react").ForwardRefExoticComponent<IFrameProps & import("react").RefAttributes<HTMLIFrameElement | undefined>>;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef, useRef, useMemo, useImperativeHandle, useState, useCallback, useLayoutEffect } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
|
-
import clsx from 'clsx';
|
|
5
4
|
|
|
6
5
|
const IFrame = forwardRef((props, ref) => {
|
|
7
6
|
const { styleCss, className, children, width, height } = props;
|
|
@@ -12,11 +11,13 @@ const IFrame = forwardRef((props, ref) => {
|
|
|
12
11
|
const attachBody = iframeRef?.current?.contentWindow?.document?.body;
|
|
13
12
|
const attachHead = iframeRef?.current?.contentWindow?.document?.head;
|
|
14
13
|
useImperativeHandle(ref, () => {
|
|
15
|
-
return iframeRef?.current;
|
|
14
|
+
return iframeRef?.current || undefined;
|
|
16
15
|
}, []);
|
|
17
16
|
return (jsxs("iframe", { ref: iframeRef, className: className, width: frameWidth, height: frameHeight, children: [attachBody && createPortal(children, attachBody), attachHead && createPortal(jsx("style", { children: styleCss }), attachHead)] }));
|
|
18
17
|
});
|
|
19
18
|
|
|
19
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
20
|
+
|
|
20
21
|
const PrinterFrame = forwardRef((props, ref) => {
|
|
21
22
|
const { styleCss, open, className, children, actionRef, src, containerId, width, height, } = props;
|
|
22
23
|
const iframeRef = useRef(null);
|
|
@@ -134,11 +135,11 @@ const TableCell = ({ item }) => {
|
|
|
134
135
|
if (typeof item === 'string') {
|
|
135
136
|
return jsx("td", { className: "inks-cell", children: item });
|
|
136
137
|
}
|
|
137
|
-
const { id, header, colSpan, rowSpan, value } = item;
|
|
138
|
+
const { id, header, colSpan, rowSpan, value, className } = item;
|
|
138
139
|
if (header) {
|
|
139
|
-
return (jsx("th", { id: id, className:
|
|
140
|
+
return (jsx("th", { id: id, className: clsx('inks-cell', className), colSpan: colSpan, rowSpan: rowSpan, children: value }));
|
|
140
141
|
}
|
|
141
|
-
return (jsx("td", { id: id, className:
|
|
142
|
+
return (jsx("td", { id: id, className: clsx('inks-cell', className), colSpan: colSpan, rowSpan: rowSpan, children: value }));
|
|
142
143
|
};
|
|
143
144
|
const TableRow = ({ cells }) => {
|
|
144
145
|
if (!cells.length) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-ink-scripter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"description": "a react component for generate page to print",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -9,7 +9,13 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/lawrsp/react-ink-scripter.git"
|
|
11
11
|
},
|
|
12
|
-
"keywords": [
|
|
12
|
+
"keywords": [
|
|
13
|
+
"react",
|
|
14
|
+
"component",
|
|
15
|
+
"print",
|
|
16
|
+
"printer",
|
|
17
|
+
"iframe"
|
|
18
|
+
],
|
|
13
19
|
"author": "lawrsp",
|
|
14
20
|
"license": "MIT",
|
|
15
21
|
"bugs": {
|
|
@@ -17,55 +23,51 @@
|
|
|
17
23
|
},
|
|
18
24
|
"homepage": "https://github.com/lawrsp/react-ink-scripter#readme",
|
|
19
25
|
"scripts": {
|
|
20
|
-
"dev": "
|
|
26
|
+
"dev": "storybook dev -p 6016",
|
|
21
27
|
"prepack": "json -f package.json -I -e \"delete this.devDependencies;delete this.scripts;\"",
|
|
22
28
|
"build": "rimraf dist && rollup -c && yarn copy-styles",
|
|
23
29
|
"copy-styles": "node ./copy-styles.mjs",
|
|
24
30
|
"preview": "vite preview",
|
|
25
|
-
"storybook": "
|
|
26
|
-
"build-storybook": "build
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"clsx": "^1.2.1"
|
|
31
|
+
"storybook": "storybook dev -p 6006",
|
|
32
|
+
"build-storybook": "storybook build"
|
|
30
33
|
},
|
|
31
34
|
"devDependencies": {
|
|
32
|
-
"@babel/runtime": "^7.21.0",
|
|
33
|
-
"react": "^18.2.0",
|
|
34
|
-
"react-dom": "^18.2.0",
|
|
35
35
|
"@babel/core": "^7.21.0",
|
|
36
36
|
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
37
37
|
"@babel/plugin-transform-runtime": "^7.21.0",
|
|
38
38
|
"@babel/preset-env": "^7.20.2",
|
|
39
39
|
"@babel/preset-react": "^7.18.6",
|
|
40
40
|
"@babel/preset-typescript": "^7.21.0",
|
|
41
|
+
"@babel/runtime": "^7.21.0",
|
|
41
42
|
"@rollup/plugin-babel": "^6.0.3",
|
|
42
43
|
"@rollup/plugin-commonjs": "^24.0.1",
|
|
43
44
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
44
45
|
"@rollup/plugin-strip": "^3.0.2",
|
|
45
46
|
"@rollup/plugin-typescript": "^11.0.0",
|
|
46
|
-
"@storybook/addon-
|
|
47
|
-
"@storybook/
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@storybook/react": "^6.5.16",
|
|
52
|
-
"@storybook/testing-library": "^0.0.13",
|
|
53
|
-
"@types/react": "^18.0.27",
|
|
54
|
-
"@types/react-dom": "^18.0.10",
|
|
55
|
-
"@vitejs/plugin-react": "^3.1.0",
|
|
47
|
+
"@storybook/addon-docs": "^10.1.2",
|
|
48
|
+
"@storybook/react-vite": "^10.1.2",
|
|
49
|
+
"@types/react": "^19.2.7",
|
|
50
|
+
"@types/react-dom": "^19.2.3",
|
|
51
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
56
52
|
"babel-loader": "^8.3.0",
|
|
53
|
+
"clsx": "^1.2.1",
|
|
57
54
|
"json": "^11.0.0",
|
|
55
|
+
"react": "^19.2.0",
|
|
56
|
+
"react-dom": "^19.2.0",
|
|
58
57
|
"rimraf": "^4.1.3",
|
|
59
58
|
"rollup": "^3.18.0",
|
|
60
59
|
"rollup-plugin-sizes": "^1.0.5",
|
|
60
|
+
"storybook": "^10.1.2",
|
|
61
|
+
"tslib": "^2.8.1",
|
|
61
62
|
"typescript": "^4.9.3",
|
|
62
|
-
"vite": "^
|
|
63
|
+
"vite": "^7.2.4"
|
|
63
64
|
},
|
|
64
65
|
"peerDependencies": {
|
|
65
|
-
"@types/react": "^17.0.0 || ^18.0.0",
|
|
66
|
-
"@types/react-dom": "^17.0.0 || ^18.0.0",
|
|
67
|
-
"
|
|
68
|
-
"react
|
|
66
|
+
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
67
|
+
"@types/react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
68
|
+
"clsx": "^1.2.0 || ^2.1.0",
|
|
69
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
70
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
69
71
|
},
|
|
70
72
|
"peerDependenciesMeta": {
|
|
71
73
|
"@types/react": {
|
|
@@ -75,6 +77,11 @@
|
|
|
75
77
|
"optional": true
|
|
76
78
|
}
|
|
77
79
|
},
|
|
78
|
-
"sideEffects": [
|
|
79
|
-
|
|
80
|
+
"sideEffects": [
|
|
81
|
+
"*.css"
|
|
82
|
+
],
|
|
83
|
+
"files": [
|
|
84
|
+
"dist"
|
|
85
|
+
],
|
|
86
|
+
"packageManager": "yarn@4.0.2+sha256.825003a0f561ad09a3b1ac4a3b3ea6207af2796d54f62a9420520915721f5186"
|
|
80
87
|
}
|