@pdfme/ui 1.1.4 → 1.1.6
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/.eslintrc.js +2 -2
- package/dist/index.js +3 -0
- package/dist/index.js.LICENSE.txt +95 -0
- package/dist/index.js.map +1 -0
- package/dist/types/{src/Designer.d.ts → Designer.d.ts} +1 -1
- package/dist/types/{src/Form.d.ts → Form.d.ts} +1 -1
- package/dist/types/{src/Viewer.d.ts → Viewer.d.ts} +1 -1
- package/dist/types/{src/class.d.ts → class.d.ts} +2 -4
- package/dist/types/{src/components → components}/CtlBar/Pager.d.ts +0 -1
- package/dist/types/{src/components → components}/CtlBar/Zoom.d.ts +0 -1
- package/dist/types/{src/components → components}/CtlBar/index.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Main/Mask.d.ts +0 -1
- package/dist/types/components/Designer/Main/Moveable.d.ts +32 -0
- package/dist/types/{src/components → components}/Designer/Main/Selecto.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/ExampleInputEditor.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/PositionAndSizeEditor.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/TextPropEditor.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/TypeAndKeyEditor.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/index.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/ListView/SelectableSortableContainer.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/ListView/index.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/index.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/index.d.ts +1 -2
- package/dist/types/{src/components → components}/Divider.d.ts +0 -1
- package/dist/types/{src/components → components}/Error.d.ts +0 -1
- package/dist/types/{src/components → components}/Preview.d.ts +0 -1
- package/dist/types/{src/components → components}/Schemas/BarcodeSchema.d.ts +1 -1
- package/dist/types/{src/components → components}/Schemas/ImageSchema.d.ts +1 -1
- package/dist/types/{src/components → components}/Schemas/SchemaUI.d.ts +1 -1
- package/dist/types/{src/components → components}/Schemas/TextSchema.d.ts +1 -1
- package/dist/types/{src/components → components}/Spinner.d.ts +0 -1
- package/dist/types/{src/components → components}/UnitPager.d.ts +0 -1
- package/dist/types/{src/contexts.d.ts → contexts.d.ts} +2 -2
- package/dist/types/{src/helper.d.ts → helper.d.ts} +0 -1
- package/dist/types/index.d.ts +7 -0
- package/package.json +16 -23
- package/src/Designer.tsx +10 -8
- package/src/Form.tsx +9 -7
- package/src/Viewer.tsx +9 -7
- package/src/class.ts +6 -10
- package/src/components/CtlBar/Pager.tsx +1 -1
- package/src/components/CtlBar/index.tsx +2 -2
- package/src/components/Designer/Main/Guides.tsx +1 -1
- package/src/components/Designer/Main/Mask.tsx +1 -1
- package/src/components/Designer/Main/Moveable.tsx +27 -15
- package/src/components/Designer/Main/Selecto.tsx +1 -1
- package/src/components/Designer/Main/index.tsx +55 -38
- package/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.tsx +5 -5
- package/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.tsx +15 -2
- package/src/components/Designer/Sidebar/DetailView/TextPropEditor.tsx +3 -2
- package/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.tsx +2 -2
- package/src/components/Designer/Sidebar/DetailView/index.tsx +7 -7
- package/src/components/Designer/Sidebar/ListView/Item.tsx +1 -1
- package/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.tsx +55 -51
- package/src/components/Designer/Sidebar/ListView/SelectableSortableItem.tsx +3 -3
- package/src/components/Designer/Sidebar/ListView/index.tsx +5 -5
- package/src/components/Designer/Sidebar/index.tsx +4 -4
- package/src/components/Designer/index.tsx +9 -9
- package/src/components/Error.tsx +1 -1
- package/src/components/Paper.tsx +2 -2
- package/src/components/Preview.tsx +9 -9
- package/src/components/Root.tsx +14 -12
- package/src/components/Schemas/BarcodeSchema.tsx +2 -2
- package/src/components/Schemas/ImageSchema.tsx +5 -5
- package/src/components/Schemas/SchemaUI.tsx +5 -4
- package/src/components/Schemas/TextSchema.tsx +2 -2
- package/src/contexts.ts +2 -2
- package/src/helper.ts +1 -8
- package/src/hooks.ts +2 -2
- package/src/i18n.ts +1 -1
- package/src/index.ts +45 -6
- package/tsconfig.json +22 -0
- package/webpack.config.js +35 -0
- package/dist/cjs/__tests__/assets/helper.js +0 -79
- package/dist/cjs/__tests__/assets/helper.js.map +0 -1
- package/dist/cjs/__tests__/components/Designer.test.js +0 -39
- package/dist/cjs/__tests__/components/Designer.test.js.map +0 -1
- package/dist/cjs/__tests__/components/Preview.test.js +0 -51
- package/dist/cjs/__tests__/components/Preview.test.js.map +0 -1
- package/dist/cjs/__tests__/helper.test.js +0 -94
- package/dist/cjs/__tests__/helper.test.js.map +0 -1
- package/dist/cjs/src/Designer.js +0 -61
- package/dist/cjs/src/Designer.js.map +0 -1
- package/dist/cjs/src/Form.js +0 -35
- package/dist/cjs/src/Form.js.map +0 -1
- package/dist/cjs/src/Viewer.js +0 -25
- package/dist/cjs/src/Viewer.js.map +0 -1
- package/dist/cjs/src/class.js +0 -119
- package/dist/cjs/src/class.js.map +0 -1
- package/dist/cjs/src/components/CtlBar/Pager.js +0 -49
- package/dist/cjs/src/components/CtlBar/Pager.js.map +0 -1
- package/dist/cjs/src/components/CtlBar/Zoom.js +0 -31
- package/dist/cjs/src/components/CtlBar/Zoom.js.map +0 -1
- package/dist/cjs/src/components/CtlBar/index.js +0 -33
- package/dist/cjs/src/components/CtlBar/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/Guides.js +0 -33
- package/dist/cjs/src/components/Designer/Main/Guides.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/Mask.js +0 -18
- package/dist/cjs/src/components/Designer/Main/Mask.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/Moveable.js +0 -37
- package/dist/cjs/src/components/Designer/Main/Moveable.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/Selecto.js +0 -11
- package/dist/cjs/src/components/Designer/Main/Selecto.js.map +0 -1
- package/dist/cjs/src/components/Designer/Main/index.js +0 -224
- package/dist/cjs/src/components/Designer/Main/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js +0 -69
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js +0 -184
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/TextPropEditor.js +0 -116
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/TextPropEditor.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js +0 -72
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/index.js +0 -54
- package/dist/cjs/src/components/Designer/Sidebar/DetailView/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/ListView/Item.js +0 -76
- package/dist/cjs/src/components/Designer/Sidebar/ListView/Item.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js +0 -108
- package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js +0 -62
- package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/ListView/index.js +0 -84
- package/dist/cjs/src/components/Designer/Sidebar/ListView/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/Sidebar/index.js +0 -105
- package/dist/cjs/src/components/Designer/Sidebar/index.js.map +0 -1
- package/dist/cjs/src/components/Designer/index.js +0 -235
- package/dist/cjs/src/components/Designer/index.js.map +0 -1
- package/dist/cjs/src/components/Divider.js +0 -9
- package/dist/cjs/src/components/Divider.js.map +0 -1
- package/dist/cjs/src/components/Error.js +0 -41
- package/dist/cjs/src/components/Error.js.map +0 -1
- package/dist/cjs/src/components/Paper.js +0 -63
- package/dist/cjs/src/components/Paper.js.map +0 -1
- package/dist/cjs/src/components/Preview.js +0 -102
- package/dist/cjs/src/components/Preview.js.map +0 -1
- package/dist/cjs/src/components/Root.js +0 -52
- package/dist/cjs/src/components/Root.js.map +0 -1
- package/dist/cjs/src/components/Schemas/BarcodeSchema.js +0 -94
- package/dist/cjs/src/components/Schemas/BarcodeSchema.js.map +0 -1
- package/dist/cjs/src/components/Schemas/ImageSchema.js +0 -72
- package/dist/cjs/src/components/Schemas/ImageSchema.js.map +0 -1
- package/dist/cjs/src/components/Schemas/SchemaUI.js +0 -55
- package/dist/cjs/src/components/Schemas/SchemaUI.js.map +0 -1
- package/dist/cjs/src/components/Schemas/TextSchema.js +0 -54
- package/dist/cjs/src/components/Schemas/TextSchema.js.map +0 -1
- package/dist/cjs/src/components/Spinner.js +0 -31
- package/dist/cjs/src/components/Spinner.js.map +0 -1
- package/dist/cjs/src/components/UnitPager.js +0 -63
- package/dist/cjs/src/components/UnitPager.js.map +0 -1
- package/dist/cjs/src/constants.js +0 -10
- package/dist/cjs/src/constants.js.map +0 -1
- package/dist/cjs/src/contexts.js +0 -10
- package/dist/cjs/src/contexts.js.map +0 -1
- package/dist/cjs/src/helper.js +0 -466
- package/dist/cjs/src/helper.js.map +0 -1
- package/dist/cjs/src/hooks.js +0 -100
- package/dist/cjs/src/hooks.js.map +0 -1
- package/dist/cjs/src/i18n.js +0 -50
- package/dist/cjs/src/i18n.js.map +0 -1
- package/dist/cjs/src/index.js +0 -24
- package/dist/cjs/src/index.js.map +0 -1
- package/dist/esm/__tests__/assets/helper.js +0 -51
- package/dist/esm/__tests__/assets/helper.js.map +0 -1
- package/dist/esm/__tests__/components/Designer.test.js +0 -34
- package/dist/esm/__tests__/components/Designer.test.js.map +0 -1
- package/dist/esm/__tests__/components/Preview.test.js +0 -46
- package/dist/esm/__tests__/components/Preview.test.js.map +0 -1
- package/dist/esm/__tests__/helper.test.js +0 -92
- package/dist/esm/__tests__/helper.test.js.map +0 -1
- package/dist/esm/src/Designer.js +0 -56
- package/dist/esm/src/Designer.js.map +0 -1
- package/dist/esm/src/Form.js +0 -30
- package/dist/esm/src/Form.js.map +0 -1
- package/dist/esm/src/Viewer.js +0 -20
- package/dist/esm/src/Viewer.js.map +0 -1
- package/dist/esm/src/class.js +0 -114
- package/dist/esm/src/class.js.map +0 -1
- package/dist/esm/src/components/CtlBar/Pager.js +0 -24
- package/dist/esm/src/components/CtlBar/Pager.js.map +0 -1
- package/dist/esm/src/components/CtlBar/Zoom.js +0 -26
- package/dist/esm/src/components/CtlBar/Zoom.js.map +0 -1
- package/dist/esm/src/components/CtlBar/index.js +0 -28
- package/dist/esm/src/components/CtlBar/index.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/Guides.js +0 -28
- package/dist/esm/src/components/Designer/Main/Guides.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/Mask.js +0 -13
- package/dist/esm/src/components/Designer/Main/Mask.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/Moveable.js +0 -9
- package/dist/esm/src/components/Designer/Main/Moveable.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/Selecto.js +0 -6
- package/dist/esm/src/components/Designer/Main/Selecto.js.map +0 -1
- package/dist/esm/src/components/Designer/Main/index.js +0 -196
- package/dist/esm/src/components/Designer/Main/index.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js +0 -44
- package/dist/esm/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js +0 -179
- package/dist/esm/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/TextPropEditor.js +0 -91
- package/dist/esm/src/components/Designer/Sidebar/DetailView/TextPropEditor.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js +0 -47
- package/dist/esm/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/DetailView/index.js +0 -26
- package/dist/esm/src/components/Designer/Sidebar/DetailView/index.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/ListView/Item.js +0 -51
- package/dist/esm/src/components/Designer/Sidebar/ListView/Item.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js +0 -80
- package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js +0 -34
- package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/ListView/index.js +0 -56
- package/dist/esm/src/components/Designer/Sidebar/ListView/index.js.map +0 -1
- package/dist/esm/src/components/Designer/Sidebar/index.js +0 -77
- package/dist/esm/src/components/Designer/Sidebar/index.js.map +0 -1
- package/dist/esm/src/components/Designer/index.js +0 -207
- package/dist/esm/src/components/Designer/index.js.map +0 -1
- package/dist/esm/src/components/Divider.js +0 -4
- package/dist/esm/src/components/Divider.js.map +0 -1
- package/dist/esm/src/components/Error.js +0 -16
- package/dist/esm/src/components/Error.js.map +0 -1
- package/dist/esm/src/components/Paper.js +0 -38
- package/dist/esm/src/components/Paper.js.map +0 -1
- package/dist/esm/src/components/Preview.js +0 -74
- package/dist/esm/src/components/Preview.js.map +0 -1
- package/dist/esm/src/components/Root.js +0 -24
- package/dist/esm/src/components/Root.js.map +0 -1
- package/dist/esm/src/components/Schemas/BarcodeSchema.js +0 -69
- package/dist/esm/src/components/Schemas/BarcodeSchema.js.map +0 -1
- package/dist/esm/src/components/Schemas/ImageSchema.js +0 -47
- package/dist/esm/src/components/Schemas/ImageSchema.js.map +0 -1
- package/dist/esm/src/components/Schemas/SchemaUI.js +0 -27
- package/dist/esm/src/components/Schemas/SchemaUI.js.map +0 -1
- package/dist/esm/src/components/Schemas/TextSchema.js +0 -29
- package/dist/esm/src/components/Schemas/TextSchema.js.map +0 -1
- package/dist/esm/src/components/Spinner.js +0 -26
- package/dist/esm/src/components/Spinner.js.map +0 -1
- package/dist/esm/src/components/UnitPager.js +0 -58
- package/dist/esm/src/components/UnitPager.js.map +0 -1
- package/dist/esm/src/constants.js +0 -7
- package/dist/esm/src/constants.js.map +0 -1
- package/dist/esm/src/contexts.js +0 -7
- package/dist/esm/src/contexts.js.map +0 -1
- package/dist/esm/src/helper.js +0 -439
- package/dist/esm/src/helper.js.map +0 -1
- package/dist/esm/src/hooks.js +0 -93
- package/dist/esm/src/hooks.js.map +0 -1
- package/dist/esm/src/i18n.js +0 -46
- package/dist/esm/src/i18n.js.map +0 -1
- package/dist/esm/src/index.js +0 -6
- package/dist/esm/src/index.js.map +0 -1
- package/dist/types/__tests__/assets/helper.d.ts +0 -3
- package/dist/types/__tests__/components/Designer.test.d.ts +0 -1
- package/dist/types/__tests__/components/Preview.test.d.ts +0 -1
- package/dist/types/__tests__/helper.test.d.ts +0 -1
- package/dist/types/src/components/Designer/Main/Moveable.d.ts +0 -31
- package/dist/types/src/index.d.ts +0 -6
- package/tsconfig.cjs.json +0 -10
- package/tsconfig.esm.json +0 -10
- /package/dist/types/{src/components → components}/Designer/Main/Guides.d.ts +0 -0
- /package/dist/types/{src/components → components}/Designer/Main/index.d.ts +0 -0
- /package/dist/types/{src/components → components}/Designer/Sidebar/ListView/Item.d.ts +0 -0
- /package/dist/types/{src/components → components}/Designer/Sidebar/ListView/SelectableSortableItem.d.ts +0 -0
- /package/dist/types/{src/components → components}/Paper.d.ts +0 -0
- /package/dist/types/{src/components → components}/Root.d.ts +0 -0
- /package/dist/types/{src/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/types/{src/hooks.d.ts → hooks.d.ts} +0 -0
- /package/dist/types/{src/i18n.d.ts → i18n.d.ts} +0 -0
@@ -1,27 +0,0 @@
|
|
1
|
-
import React, { forwardRef } from 'react';
|
2
|
-
import { isTextSchema, isImageSchema, isBarcodeSchema } from '@pdfme/common';
|
3
|
-
import { ZOOM, SELECTABLE_CLASSNAME } from '../../constants.js';
|
4
|
-
import TextSchema from './TextSchema.js';
|
5
|
-
import ImageSchema from './ImageSchema.js';
|
6
|
-
import BarcodeSchema from './BarcodeSchema.js';
|
7
|
-
const Wrapper = ({ children, border, onChangeHoveringSchemaId, schema, }) => (React.createElement("div", { title: schema.key, onMouseEnter: () => onChangeHoveringSchemaId && onChangeHoveringSchemaId(schema.id), onMouseLeave: () => onChangeHoveringSchemaId && onChangeHoveringSchemaId(null), className: SELECTABLE_CLASSNAME, id: schema.id, style: {
|
8
|
-
position: 'absolute',
|
9
|
-
cursor: 'pointer',
|
10
|
-
height: schema.height * ZOOM,
|
11
|
-
width: schema.width * ZOOM,
|
12
|
-
top: schema.position.y * ZOOM,
|
13
|
-
left: schema.position.x * ZOOM,
|
14
|
-
border,
|
15
|
-
} }, children));
|
16
|
-
const SchemaUI = (props, ref) => {
|
17
|
-
const r = {
|
18
|
-
[props.editable ? 'ref' : '']: ref,
|
19
|
-
};
|
20
|
-
const { schema } = props;
|
21
|
-
return (React.createElement(Wrapper, Object.assign({}, props),
|
22
|
-
isTextSchema(schema) && React.createElement(TextSchema, Object.assign({}, r, props, { schema: schema })),
|
23
|
-
isImageSchema(schema) && React.createElement(ImageSchema, Object.assign({}, r, props, { schema: schema })),
|
24
|
-
isBarcodeSchema(schema) && React.createElement(BarcodeSchema, Object.assign({}, r, props, { schema: schema }))));
|
25
|
-
};
|
26
|
-
export default forwardRef(SchemaUI);
|
27
|
-
//# sourceMappingURL=SchemaUI.js.map
|
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CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAwD;KACxF,CAAC;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEzB,OAAO,CACL,oBAAC,OAAO,oBAAK,KAAK;QACf,YAAY,CAAC,MAAM,CAAC,IAAI,oBAAC,UAAU,oBAAK,CAAC,EAAM,KAAK,IAAE,MAAM,EAAE,MAAM,IAAI;QACxE,aAAa,CAAC,MAAM,CAAC,IAAI,oBAAC,WAAW,oBAAK,CAAC,EAAM,KAAK,IAAE,MAAM,EAAE,MAAM,IAAI;QAC1E,eAAe,CAAC,MAAM,CAAC,IAAI,oBAAC,aAAa,oBAAK,CAAC,EAAM,KAAK,IAAE,MAAM,EAAE,MAAM,IAAI,CACvE,CACX,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,UAAU,CAAgD,QAAQ,CAAC,CAAC"}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import React, { forwardRef } from 'react';
|
2
|
-
import { DEFAULT_FONT_SIZE, DEFAULT_ALIGNMENT, DEFAULT_LINE_HEIGHT, DEFAULT_CHARACTER_SPACING, DEFAULT_FONT_COLOR, } from '@pdfme/common';
|
3
|
-
import { ZOOM } from '../../constants.js';
|
4
|
-
const TextSchemaUI = ({ schema, editable, placeholder, tabIndex, onChange }, ref) => {
|
5
|
-
var _a, _b, _c, _d, _e;
|
6
|
-
const style = {
|
7
|
-
padding: 0,
|
8
|
-
resize: 'none',
|
9
|
-
position: 'absolute',
|
10
|
-
fontFamily: schema.fontName ? `'${schema.fontName}'` : 'inherit',
|
11
|
-
height: schema.height * ZOOM,
|
12
|
-
// Increase the width by 1 point. (0.75 pixels)
|
13
|
-
width: (schema.width + ((_a = schema.characterSpacing) !== null && _a !== void 0 ? _a : DEFAULT_CHARACTER_SPACING) * 0.75) * ZOOM,
|
14
|
-
textAlign: (_b = schema.alignment) !== null && _b !== void 0 ? _b : DEFAULT_ALIGNMENT,
|
15
|
-
fontSize: `${(_c = schema.fontSize) !== null && _c !== void 0 ? _c : DEFAULT_FONT_SIZE}pt`,
|
16
|
-
letterSpacing: `${(_d = schema.characterSpacing) !== null && _d !== void 0 ? _d : DEFAULT_CHARACTER_SPACING}pt`,
|
17
|
-
lineHeight: `${(_e = schema.lineHeight) !== null && _e !== void 0 ? _e : DEFAULT_LINE_HEIGHT}em`,
|
18
|
-
whiteSpace: 'pre-line',
|
19
|
-
wordBreak: 'break-all',
|
20
|
-
border: 'none',
|
21
|
-
color: schema.fontColor ? schema.fontColor : DEFAULT_FONT_COLOR,
|
22
|
-
backgroundColor: schema.data && schema.backgroundColor ? schema.backgroundColor : 'rgb(242 244 255 / 75%)',
|
23
|
-
};
|
24
|
-
return editable ? (React.createElement("textarea", { ref: ref, placeholder: placeholder, tabIndex: tabIndex, style: style, onChange: (e) => onChange(e.target.value), value: schema.data })) : (React.createElement("div", { style: style }, schema.data.split('').map((l, i) => (React.createElement("span", { key: i, style: {
|
25
|
-
letterSpacing: String(schema.data).length === i + 1 ? 0 : 'inherit',
|
26
|
-
} }, l)))));
|
27
|
-
};
|
28
|
-
export default forwardRef(TextSchemaUI);
|
29
|
-
//# sourceMappingURL=TextSchema.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"TextSchema.js","sourceRoot":"","sources":["../../../../../src/components/Schemas/TextSchema.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAO,MAAM,OAAO,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,GAEnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAI1C,MAAM,YAAY,GAAG,CACnB,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAS,EAC5D,GAA6B,EAC7B,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ACzC,KAAK,EAAE,MAAM,CAAC,IAAI,GACR,CACb,CAAC,CAAC,CAAC,CACF,6BAAK,KAAK,EAAE,KAAK,IAEd,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnC,8BACE,GAAG,EAAE,CAAC,EACN,KAAK,EAAE;YACL,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;SACpE,IAEA,CAAC,CACG,CACR,CAAC,CACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAA6B,YAAY,CAAC,CAAC"}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
const Spinner = () => (React.createElement(React.Fragment, null,
|
3
|
-
React.createElement("style", null, `
|
4
|
-
@keyframes spin {
|
5
|
-
0% { transform: rotate(0deg) }
|
6
|
-
|
7
|
-
100% { transform: rotate(359deg) }
|
8
|
-
}
|
9
|
-
`),
|
10
|
-
React.createElement("div", { style: {
|
11
|
-
width: '100%',
|
12
|
-
height: '100%',
|
13
|
-
display: 'flex',
|
14
|
-
alignItems: 'center',
|
15
|
-
justifyContent: 'center',
|
16
|
-
} },
|
17
|
-
React.createElement("div", { style: {
|
18
|
-
width: 65,
|
19
|
-
height: 65,
|
20
|
-
borderRadius: '50%',
|
21
|
-
border: '4px solid',
|
22
|
-
borderColor: '#4285f4 rgba(0,0,0,0.1) rgba(0,0,0,0.1)',
|
23
|
-
animation: 'spin 1s ease infinite',
|
24
|
-
} }))));
|
25
|
-
export default Spinner;
|
26
|
-
//# sourceMappingURL=Spinner.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../../../../src/components/Spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,CACpB;IACE,mCACG;;;;;;KAMF,CACO;IACR,6BACE,KAAK,EAAE;YACL,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,MAAM;YACf,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;SACzB;QAED,6BACE,KAAK,EAAE;gBACL,KAAK,EAAE,EAAE;gBACT,MAAM,EAAE,EAAE;gBACV,YAAY,EAAE,KAAK;gBACnB,MAAM,EAAE,WAAW;gBACnB,WAAW,EAAE,yCAAyC;gBACtD,SAAS,EAAE,uBAAuB;aACnC,GACI,CACH,CACL,CACJ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -1,58 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { ChevronLeftIcon, ChevronDoubleLeftIcon, ChevronRightIcon, ChevronDoubleRightIcon, } from '@heroicons/react/24/outline';
|
3
|
-
const buttonHeight = 38;
|
4
|
-
const buttonWrapStyle = {
|
5
|
-
pointerEvents: 'initial',
|
6
|
-
position: 'sticky',
|
7
|
-
zIndex: 1,
|
8
|
-
backgroundColor: '#777777bd',
|
9
|
-
borderRadius: 2,
|
10
|
-
padding: '0.5rem',
|
11
|
-
display: 'flex',
|
12
|
-
alignItems: 'center',
|
13
|
-
justifyContent: 'space-around',
|
14
|
-
boxSizing: 'border-box',
|
15
|
-
width: 110,
|
16
|
-
height: buttonHeight,
|
17
|
-
};
|
18
|
-
const btnStyle = {
|
19
|
-
cursor: 'pointer',
|
20
|
-
border: 'none',
|
21
|
-
background: 'none',
|
22
|
-
display: 'flex',
|
23
|
-
alignItems: 'center',
|
24
|
-
};
|
25
|
-
const UnitPager = ({ size, unitCursor, unitNum, setUnitCursor }) => {
|
26
|
-
if (unitNum <= 1)
|
27
|
-
return React.createElement(React.Fragment, null);
|
28
|
-
return (React.createElement("div", { style: Object.assign({ position: 'absolute' }, size) },
|
29
|
-
React.createElement("div", { style: {
|
30
|
-
position: 'sticky',
|
31
|
-
width: '100%',
|
32
|
-
zIndex: 1,
|
33
|
-
pointerEvents: 'none',
|
34
|
-
top: `calc(50% - ${buttonHeight / 2}px)`,
|
35
|
-
display: 'flex',
|
36
|
-
alignItems: 'center',
|
37
|
-
} },
|
38
|
-
unitCursor > 0 && (React.createElement("div", { style: Object.assign({ left: '1rem', marginLeft: '1rem' }, buttonWrapStyle) },
|
39
|
-
React.createElement("button", { style: Object.assign({ paddingLeft: '0.5rem' }, btnStyle), disabled: unitCursor <= 0, onClick: () => setUnitCursor(0) },
|
40
|
-
React.createElement(ChevronDoubleLeftIcon, { width: 20, height: 20, color: '#fff' })),
|
41
|
-
React.createElement("button", { style: Object.assign({ paddingLeft: '0.5rem' }, btnStyle), disabled: unitCursor <= 0, onClick: () => setUnitCursor(unitCursor - 1) },
|
42
|
-
React.createElement(ChevronLeftIcon, { width: 20, height: 20, color: '#fff' })),
|
43
|
-
React.createElement("strong", { style: { color: 'white', fontSize: '0.9rem' } },
|
44
|
-
unitCursor + 1,
|
45
|
-
"/",
|
46
|
-
unitNum))),
|
47
|
-
unitCursor + 1 < unitNum && (React.createElement("div", { style: Object.assign({ right: '1rem', marginLeft: 'auto', marginRight: '1rem' }, buttonWrapStyle) },
|
48
|
-
React.createElement("strong", { style: { color: 'white', fontSize: '0.9rem' } },
|
49
|
-
unitCursor + 1,
|
50
|
-
"/",
|
51
|
-
unitNum),
|
52
|
-
React.createElement("button", { style: Object.assign({ paddingRight: '0.5rem' }, btnStyle), disabled: unitCursor + 1 >= unitNum, onClick: () => setUnitCursor(unitCursor + 1) },
|
53
|
-
React.createElement(ChevronRightIcon, { width: 20, height: 20, color: '#fff' })),
|
54
|
-
React.createElement("button", { style: Object.assign({ paddingRight: '0.5rem' }, btnStyle), disabled: unitCursor + 1 >= unitNum, onClick: () => setUnitCursor(unitNum - 1) },
|
55
|
-
React.createElement(ChevronDoubleRightIcon, { width: 20, height: 20, color: '#fff' })))))));
|
56
|
-
};
|
57
|
-
export default UnitPager;
|
58
|
-
//# sourceMappingURL=UnitPager.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"UnitPager.js","sourceRoot":"","sources":["../../../../src/components/UnitPager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AAGrC,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,eAAe,GAAwB;IAC3C,aAAa,EAAE,SAAS;IACxB,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,CAAC;IACT,eAAe,EAAE,WAAW;IAC5B,YAAY,EAAE,CAAC;IACf,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,cAAc;IAC9B,SAAS,EAAE,YAAY;IACvB,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,YAAY;CACrB,CAAC;AAEF,MAAM,QAAQ,GAAwB;IACpC,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;CACrB,CAAC;AASF,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAS,EAAE,EAAE;IACxE,IAAI,OAAO,IAAI,CAAC;QAAE,OAAO,yCAAK,CAAC;IAE/B,OAAO,CACL,6BAAK,KAAK,kBAAI,QAAQ,EAAE,UAAU,IAAK,IAAI;QACzC,6BACE,KAAK,EAAE;gBACL,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,CAAC;gBACT,aAAa,EAAE,MAAM;gBACrB,GAAG,EAAE,cAAc,YAAY,GAAG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IAAI,OAAO,EACnC,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,UAAU,GAAG,CAAC,CAAC;oBAE5C,oBAAC,gBAAgB,IAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,GAAI,CACnD;gBACT,gCACE,KAAK,kBAAI,YAAY,EAAE,QAAQ,IAAK,QAAQ,GAC5C,QAAQ,EAAE,UAAU,GAAG,CAAC,IAAI,OAAO,EACnC,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,OAAO,GAAG,CAAC,CAAC;oBAEzC,oBAAC,sBAAsB,IAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,GAAI,CACzD,CACL,CACP,CACG,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
export const DEFAULT_LANG = 'en';
|
2
|
-
export const DESTROYED_ERR_MSG = 'this instance is already destroyed';
|
3
|
-
export const ZOOM = 3.7795275591;
|
4
|
-
export const SELECTABLE_CLASSNAME = 'selectable';
|
5
|
-
export const RULER_HEIGHT = 30;
|
6
|
-
export const SIDEBAR_WIDTH = 300;
|
7
|
-
//# sourceMappingURL=constants.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,IAAa,CAAC;AAE1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,oCAAoC,CAAC;AAEtE,MAAM,CAAC,MAAM,IAAI,GAAG,YAAY,CAAC;AAEjC,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC"}
|
package/dist/esm/src/contexts.js
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
import { createContext } from 'react';
|
2
|
-
import { curriedI18n } from './i18n.js';
|
3
|
-
import { DEFAULT_LANG } from './constants.js';
|
4
|
-
import { getDefaultFont } from '@pdfme/common';
|
5
|
-
export const I18nContext = createContext(curriedI18n(DEFAULT_LANG));
|
6
|
-
export const FontContext = createContext(getDefaultFont());
|
7
|
-
//# sourceMappingURL=contexts.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"contexts.js","sourceRoot":"","sources":["../../../src/contexts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,cAAc,EAAE,CAAC,CAAC"}
|
package/dist/esm/src/helper.js
DELETED
@@ -1,439 +0,0 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
|
-
// @ts-ignore
|
11
|
-
import PDFJSWorker from 'pdfjs-dist/build/pdf.worker.entry.js';
|
12
|
-
import { getDocument, GlobalWorkerOptions } from 'pdfjs-dist/legacy/build/pdf.js';
|
13
|
-
GlobalWorkerOptions.workerSrc = PDFJSWorker;
|
14
|
-
import hotkeys from 'hotkeys-js';
|
15
|
-
import { getB64BasePdf, b64toUint8Array, DEFAULT_ALIGNMENT, DEFAULT_FONT_SIZE, DEFAULT_CHARACTER_SPACING, DEFAULT_LINE_HEIGHT, } from '@pdfme/common';
|
16
|
-
import { ZOOM, RULER_HEIGHT } from './constants.js';
|
17
|
-
export const uuid = () => 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
18
|
-
const r = (Math.random() * 16) | 0;
|
19
|
-
const v = c == 'x' ? r : (r & 0x3) | 0x8;
|
20
|
-
return v.toString(16);
|
21
|
-
});
|
22
|
-
export const set = (obj, path, value) => {
|
23
|
-
path = Array.isArray(path) ? path : path.replace('[', '.').replace(']', '').split('.');
|
24
|
-
let src = obj;
|
25
|
-
path.forEach((key, index, array) => {
|
26
|
-
if (index == path.length - 1) {
|
27
|
-
src[key] = value;
|
28
|
-
}
|
29
|
-
else {
|
30
|
-
if (!src.hasOwnProperty(key)) {
|
31
|
-
const next = array[index + 1];
|
32
|
-
src[key] = String(Number(next)) === next ? [] : {};
|
33
|
-
}
|
34
|
-
src = src[key];
|
35
|
-
}
|
36
|
-
});
|
37
|
-
};
|
38
|
-
export const debounce = (cb, wait = 20) => {
|
39
|
-
let h = null;
|
40
|
-
const callable = (...args) => {
|
41
|
-
if (h)
|
42
|
-
clearTimeout(h);
|
43
|
-
h = setTimeout(() => cb(...args), wait);
|
44
|
-
};
|
45
|
-
return callable;
|
46
|
-
};
|
47
|
-
const shift = (number, precision, reverseShift) => {
|
48
|
-
if (reverseShift) {
|
49
|
-
precision = -precision;
|
50
|
-
}
|
51
|
-
const numArray = `${number}`.split('e');
|
52
|
-
return Number(`${numArray[0]}e${numArray[1] ? Number(numArray[1]) + precision : precision}`);
|
53
|
-
};
|
54
|
-
export const round = (number, precision) => {
|
55
|
-
return shift(Math.round(shift(number, precision, false)), precision, true);
|
56
|
-
};
|
57
|
-
export const cloneDeep = (value) => JSON.parse(JSON.stringify(value));
|
58
|
-
export const flatten = (arr) => [].concat(...arr);
|
59
|
-
const up = 'up';
|
60
|
-
const shiftUp = 'shift+up';
|
61
|
-
const down = 'down';
|
62
|
-
const shiftDown = 'shift+down';
|
63
|
-
const left = 'left';
|
64
|
-
const shiftLeft = 'shift+left';
|
65
|
-
const right = 'right';
|
66
|
-
const shiftRight = 'shift+right';
|
67
|
-
const rmWin = 'backspace';
|
68
|
-
const rmMac = 'delete';
|
69
|
-
const esc = 'esc';
|
70
|
-
const copyWin = 'ctrl+c';
|
71
|
-
const copyMac = 'command+c';
|
72
|
-
const pasteWin = 'ctrl+v';
|
73
|
-
const pasteMac = 'command+v';
|
74
|
-
const redoWin = 'ctrl+y';
|
75
|
-
const redoMac = 'shift+command+z';
|
76
|
-
const undoWin = 'ctrl+z';
|
77
|
-
const undoMac = 'command+z';
|
78
|
-
const saveWin = 'ctrl+s';
|
79
|
-
const saveMac = 'command+s';
|
80
|
-
const selectAllWin = 'ctrl+a';
|
81
|
-
const selectAllMac = 'command+a';
|
82
|
-
const keys = [
|
83
|
-
up,
|
84
|
-
shiftUp,
|
85
|
-
down,
|
86
|
-
shiftDown,
|
87
|
-
left,
|
88
|
-
shiftLeft,
|
89
|
-
right,
|
90
|
-
shiftRight,
|
91
|
-
rmMac,
|
92
|
-
rmWin,
|
93
|
-
esc,
|
94
|
-
copyWin,
|
95
|
-
copyMac,
|
96
|
-
pasteWin,
|
97
|
-
pasteMac,
|
98
|
-
redoWin,
|
99
|
-
redoMac,
|
100
|
-
undoWin,
|
101
|
-
undoMac,
|
102
|
-
saveWin,
|
103
|
-
saveMac,
|
104
|
-
selectAllWin,
|
105
|
-
selectAllMac,
|
106
|
-
];
|
107
|
-
export const initShortCuts = (arg) => {
|
108
|
-
hotkeys(keys.join(), (e, handler) => {
|
109
|
-
switch (handler.shortcut) {
|
110
|
-
case up:
|
111
|
-
case shiftUp:
|
112
|
-
e.preventDefault();
|
113
|
-
arg.move('up', hotkeys.shift);
|
114
|
-
break;
|
115
|
-
case down:
|
116
|
-
case shiftDown:
|
117
|
-
e.preventDefault();
|
118
|
-
arg.move('down', hotkeys.shift);
|
119
|
-
break;
|
120
|
-
case left:
|
121
|
-
case shiftLeft:
|
122
|
-
e.preventDefault();
|
123
|
-
arg.move('left', hotkeys.shift);
|
124
|
-
break;
|
125
|
-
case right:
|
126
|
-
case shiftRight:
|
127
|
-
e.preventDefault();
|
128
|
-
arg.move('right', hotkeys.shift);
|
129
|
-
break;
|
130
|
-
case rmWin:
|
131
|
-
case rmMac:
|
132
|
-
arg.remove();
|
133
|
-
break;
|
134
|
-
case esc:
|
135
|
-
arg.esc();
|
136
|
-
break;
|
137
|
-
case copyWin:
|
138
|
-
case copyMac:
|
139
|
-
arg.copy();
|
140
|
-
break;
|
141
|
-
case pasteWin:
|
142
|
-
case pasteMac:
|
143
|
-
arg.paste();
|
144
|
-
break;
|
145
|
-
case redoWin:
|
146
|
-
case redoMac:
|
147
|
-
arg.redo();
|
148
|
-
break;
|
149
|
-
case undoWin:
|
150
|
-
case undoMac:
|
151
|
-
arg.undo();
|
152
|
-
break;
|
153
|
-
case saveWin:
|
154
|
-
case saveMac:
|
155
|
-
e.preventDefault();
|
156
|
-
arg.save();
|
157
|
-
break;
|
158
|
-
case selectAllWin:
|
159
|
-
case selectAllMac:
|
160
|
-
e.preventDefault();
|
161
|
-
arg.selectAll();
|
162
|
-
break;
|
163
|
-
default:
|
164
|
-
break;
|
165
|
-
}
|
166
|
-
});
|
167
|
-
};
|
168
|
-
export const destroyShortCuts = () => {
|
169
|
-
hotkeys.unbind(keys.join());
|
170
|
-
};
|
171
|
-
const readFile = (file, type) => {
|
172
|
-
return new Promise((r) => {
|
173
|
-
const fileReader = new FileReader();
|
174
|
-
fileReader.addEventListener('load', (e) => {
|
175
|
-
if (e && e.target && e.target.result && file !== null) {
|
176
|
-
r(e.target.result);
|
177
|
-
}
|
178
|
-
});
|
179
|
-
if (file !== null) {
|
180
|
-
if (type === 'text') {
|
181
|
-
fileReader.readAsText(file);
|
182
|
-
}
|
183
|
-
else if (type === 'dataURL') {
|
184
|
-
fileReader.readAsDataURL(file);
|
185
|
-
}
|
186
|
-
else if (type === 'arrayBuffer') {
|
187
|
-
fileReader.readAsArrayBuffer(file);
|
188
|
-
}
|
189
|
-
}
|
190
|
-
});
|
191
|
-
};
|
192
|
-
export const readFiles = (files, type) => {
|
193
|
-
return new Promise((r) => {
|
194
|
-
const fileReader = new FileReader();
|
195
|
-
fileReader.addEventListener('load', (e) => {
|
196
|
-
if (e && e.target && e.target.result && files !== null) {
|
197
|
-
r(e.target.result);
|
198
|
-
}
|
199
|
-
});
|
200
|
-
if (files !== null && files[0]) {
|
201
|
-
readFile(files[0], type).then((data) => r(data));
|
202
|
-
}
|
203
|
-
});
|
204
|
-
};
|
205
|
-
const pt2mm = (pt) => {
|
206
|
-
// https://www.ddc.co.jp/words/archives/20090701114500.html
|
207
|
-
const mmRatio = 0.3527;
|
208
|
-
return parseFloat(String(pt)) * mmRatio;
|
209
|
-
};
|
210
|
-
export const px2mm = (px) => {
|
211
|
-
// http://www.unitconversion.org/typography/millimeters-to-pixels-y-conversion.html
|
212
|
-
const mmRatio = 0.264583333;
|
213
|
-
return parseFloat(String(px)) * mmRatio;
|
214
|
-
};
|
215
|
-
export const getPdfPageSizes = (pdfBlob) => __awaiter(void 0, void 0, void 0, function* () {
|
216
|
-
const url = URL.createObjectURL(pdfBlob);
|
217
|
-
const pdfDoc = yield getDocument({ url }).promise;
|
218
|
-
const promises = Promise.all(new Array(pdfDoc.numPages).fill('').map((_, i) => __awaiter(void 0, void 0, void 0, function* () {
|
219
|
-
const pageSize = yield pdfDoc.getPage(i + 1).then((page) => {
|
220
|
-
const { height, width } = page.getViewport({ scale: 1 });
|
221
|
-
return { height: pt2mm(height), width: pt2mm(width) };
|
222
|
-
});
|
223
|
-
return pageSize;
|
224
|
-
})));
|
225
|
-
URL.revokeObjectURL(url);
|
226
|
-
return promises;
|
227
|
-
});
|
228
|
-
const pdf2Images = (pdfBlob, width, imageType) => __awaiter(void 0, void 0, void 0, function* () {
|
229
|
-
const url = URL.createObjectURL(pdfBlob);
|
230
|
-
const pdfDoc = yield getDocument({ url }).promise;
|
231
|
-
const promises = Promise.all(new Array(pdfDoc.numPages).fill('').map((_, i) => __awaiter(void 0, void 0, void 0, function* () {
|
232
|
-
const image = yield pdfDoc.getPage(i + 1).then((page) => {
|
233
|
-
const canvas = document.createElement('canvas');
|
234
|
-
canvas.width = width * 2;
|
235
|
-
const canvasContext = canvas.getContext('2d');
|
236
|
-
const scaleRequired = canvas.width / page.getViewport({ scale: 1 }).width;
|
237
|
-
const viewport = page.getViewport({ scale: scaleRequired });
|
238
|
-
canvas.height = viewport.height;
|
239
|
-
return page
|
240
|
-
.render({ canvasContext, viewport })
|
241
|
-
.promise.then(() => canvas.toDataURL(`image/${imageType}`));
|
242
|
-
});
|
243
|
-
return image;
|
244
|
-
})));
|
245
|
-
URL.revokeObjectURL(url);
|
246
|
-
return promises;
|
247
|
-
});
|
248
|
-
export const pdf2Pngs = (pdfBlob, width) => pdf2Images(pdfBlob, width, 'png');
|
249
|
-
export const b64toBlob = (base64) => {
|
250
|
-
const uniy8Array = b64toUint8Array(base64);
|
251
|
-
const [, , mimeType] = base64.match(/(:)([a-z/]+)(;)/);
|
252
|
-
return new Blob([uniy8Array.buffer], { type: mimeType });
|
253
|
-
};
|
254
|
-
const sortSchemasList = (template, pageNum) => new Array(pageNum).fill('').reduce((acc, _, i) => {
|
255
|
-
acc.push(template.schemas[i]
|
256
|
-
? Object.entries(template.schemas[i])
|
257
|
-
.sort((a, b) => {
|
258
|
-
var _a, _b;
|
259
|
-
const aIndex = ((_a = template.columns) !== null && _a !== void 0 ? _a : []).findIndex((c) => c === a[0]);
|
260
|
-
const bIndex = ((_b = template.columns) !== null && _b !== void 0 ? _b : []).findIndex((c) => c === b[0]);
|
261
|
-
return aIndex > bIndex ? 1 : -1;
|
262
|
-
})
|
263
|
-
.map((e) => {
|
264
|
-
const [key, value] = e;
|
265
|
-
const data = template.sampledata ? template.sampledata[0][key] : '';
|
266
|
-
return Object.assign(value, {
|
267
|
-
key,
|
268
|
-
data,
|
269
|
-
id: uuid(),
|
270
|
-
});
|
271
|
-
})
|
272
|
-
: []);
|
273
|
-
return acc;
|
274
|
-
}, []);
|
275
|
-
export const templateSchemas2SchemasList = (_template) => __awaiter(void 0, void 0, void 0, function* () {
|
276
|
-
const template = cloneDeep(_template);
|
277
|
-
const sortedSchemasList = sortSchemasList(template, template.schemas.length);
|
278
|
-
const basePdf = yield getB64BasePdf(template.basePdf);
|
279
|
-
const pdfBlob = b64toBlob(basePdf);
|
280
|
-
const pageSizes = yield getPdfPageSizes(pdfBlob);
|
281
|
-
const ssl = sortedSchemasList.length;
|
282
|
-
const psl = pageSizes.length;
|
283
|
-
const schemasList = (ssl < psl
|
284
|
-
? sortedSchemasList.concat(new Array(psl - ssl).fill(cloneDeep([])))
|
285
|
-
: sortedSchemasList.slice(0, pageSizes.length)).map((schema, i) => {
|
286
|
-
Object.values(schema).forEach((value) => {
|
287
|
-
const { width, height } = pageSizes[i];
|
288
|
-
const xEdge = value.position.x + value.width;
|
289
|
-
const yEdge = value.position.y + value.height;
|
290
|
-
if (width < xEdge) {
|
291
|
-
const diff = xEdge - width;
|
292
|
-
value.position.x += diff;
|
293
|
-
}
|
294
|
-
if (height < yEdge) {
|
295
|
-
const diff = yEdge - height;
|
296
|
-
value.position.y += diff;
|
297
|
-
}
|
298
|
-
});
|
299
|
-
return schema;
|
300
|
-
});
|
301
|
-
return schemasList;
|
302
|
-
});
|
303
|
-
export const fmtTemplate = (template, schemasList) => {
|
304
|
-
const schemaAddedTemplate = Object.assign(Object.assign({}, template), { schemas: cloneDeep(schemasList).map((schema) => schema.reduce((acc, cur) => {
|
305
|
-
const k = cur.key;
|
306
|
-
// @ts-ignore
|
307
|
-
delete cur.id;
|
308
|
-
// @ts-ignore
|
309
|
-
delete cur.key;
|
310
|
-
// @ts-ignore
|
311
|
-
delete cur.data;
|
312
|
-
acc[k] = cur;
|
313
|
-
return acc;
|
314
|
-
}, {})), columns: cloneDeep(schemasList).reduce((acc, cur) => acc.concat(cur.map((s) => s.key)), []), sampledata: [
|
315
|
-
cloneDeep(schemasList).reduce((acc, cur) => {
|
316
|
-
cur.forEach((c) => {
|
317
|
-
acc[c.key] = c.data;
|
318
|
-
});
|
319
|
-
return acc;
|
320
|
-
}, {}),
|
321
|
-
], basePdf: template.basePdf });
|
322
|
-
return schemaAddedTemplate;
|
323
|
-
};
|
324
|
-
export const getInitialSchema = () => ({
|
325
|
-
id: uuid(),
|
326
|
-
key: '',
|
327
|
-
data: '',
|
328
|
-
type: 'text',
|
329
|
-
position: { x: 0, y: 0 },
|
330
|
-
width: 35,
|
331
|
-
height: 7,
|
332
|
-
alignment: DEFAULT_ALIGNMENT,
|
333
|
-
fontSize: DEFAULT_FONT_SIZE,
|
334
|
-
characterSpacing: DEFAULT_CHARACTER_SPACING,
|
335
|
-
lineHeight: DEFAULT_LINE_HEIGHT,
|
336
|
-
});
|
337
|
-
export const getSampleByType = (type) => {
|
338
|
-
const defaultValue = {
|
339
|
-
text: 'text',
|
340
|
-
image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAALuAQMAAADL0wGJAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAGUExURbzAw+rv8fKruy0AAAPoSURBVHja7dwxbtwwEEBRCkKwRQodYftcYk+ROkcJz5NTsEuZK/AIKlIQAUEnke0VqQ0pA5zxWvFnZcD2s0CNuENxPOZBc0QDDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8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h4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHl+d/A9cKjmiL040TAAAAAElFTkSuQmCC',
|
341
|
-
qrcode: 'https://pdfme.com/',
|
342
|
-
japanpost: '6540123789-A-K-Z',
|
343
|
-
ean13: '2112345678900',
|
344
|
-
ean8: '02345673',
|
345
|
-
code39: 'THIS IS CODE 39',
|
346
|
-
code128: 'This is Code 128!',
|
347
|
-
nw7: 'A0123456789B',
|
348
|
-
itf14: '04601234567893',
|
349
|
-
upca: '416000336108',
|
350
|
-
upce: '00123457',
|
351
|
-
};
|
352
|
-
return defaultValue[type] ? defaultValue[type] : '';
|
353
|
-
};
|
354
|
-
export const getKeepRatioHeightByWidth = (type, width) => {
|
355
|
-
const raito = {
|
356
|
-
image: 1,
|
357
|
-
qrcode: 1,
|
358
|
-
japanpost: 0.09,
|
359
|
-
ean13: 0.4,
|
360
|
-
ean8: 0.5,
|
361
|
-
code39: 0.5,
|
362
|
-
code128: 0.5,
|
363
|
-
nw7: 0.5,
|
364
|
-
itf14: 0.3,
|
365
|
-
upca: 0.4,
|
366
|
-
upce: 0.5,
|
367
|
-
};
|
368
|
-
return width * (raito[type] ? raito[type] : 1);
|
369
|
-
};
|
370
|
-
export const getUniqSchemaKey = (arg) => {
|
371
|
-
const { copiedSchemaKey, schema, stackUniqSchemaKeys } = arg;
|
372
|
-
const schemaKeys = schema.map((s) => s.key).concat(stackUniqSchemaKeys);
|
373
|
-
const tmp = schemaKeys.reduce((acc, cur) => Object.assign(acc, { originalKey: cur, copiedNum: 0 }), {});
|
374
|
-
const extractOriginalKey = (key) => key.replace(/ copy$| copy [0-9]*$/, '');
|
375
|
-
schemaKeys
|
376
|
-
.filter((key) => / copy$| copy [0-9]*$/.test(key))
|
377
|
-
.forEach((key) => {
|
378
|
-
var _a;
|
379
|
-
const originalKey = extractOriginalKey(key);
|
380
|
-
const match = key.match(/[0-9]*$/);
|
381
|
-
const copiedNum = match && match[0] ? Number(match[0]) : 1;
|
382
|
-
if (((_a = tmp[originalKey]) !== null && _a !== void 0 ? _a : 0) < copiedNum) {
|
383
|
-
tmp[originalKey] = copiedNum;
|
384
|
-
}
|
385
|
-
});
|
386
|
-
const originalKey = extractOriginalKey(copiedSchemaKey);
|
387
|
-
if (tmp[originalKey]) {
|
388
|
-
const copiedNum = tmp[originalKey];
|
389
|
-
const uniqKey = `${originalKey} copy ${copiedNum + 1}`;
|
390
|
-
stackUniqSchemaKeys.push(uniqKey);
|
391
|
-
return uniqKey;
|
392
|
-
}
|
393
|
-
const uniqKey = `${copiedSchemaKey} copy`;
|
394
|
-
stackUniqSchemaKeys.push(uniqKey);
|
395
|
-
return uniqKey;
|
396
|
-
};
|
397
|
-
export const moveCommandToChangeSchemasArg = (props) => {
|
398
|
-
const { command, activeSchemas, isShift, pageSize } = props;
|
399
|
-
const key = command === 'up' || command === 'down' ? 'y' : 'x';
|
400
|
-
const num = isShift ? 0.1 : 1;
|
401
|
-
const getValue = (as) => {
|
402
|
-
let value = 0;
|
403
|
-
const { position } = as;
|
404
|
-
switch (command) {
|
405
|
-
case 'up':
|
406
|
-
value = round(position.y - num, 2);
|
407
|
-
break;
|
408
|
-
case 'down':
|
409
|
-
value = round(position.y + num, 2);
|
410
|
-
break;
|
411
|
-
case 'left':
|
412
|
-
value = round(position.x - num, 2);
|
413
|
-
break;
|
414
|
-
case 'right':
|
415
|
-
value = round(position.x + num, 2);
|
416
|
-
break;
|
417
|
-
default:
|
418
|
-
break;
|
419
|
-
}
|
420
|
-
return value > 0 ? value : 0;
|
421
|
-
};
|
422
|
-
return activeSchemas.map((as) => {
|
423
|
-
let value = getValue(as);
|
424
|
-
const { width, height } = as;
|
425
|
-
if (key === 'x') {
|
426
|
-
value = value > pageSize.width - width ? round(pageSize.width - width, 2) : value;
|
427
|
-
}
|
428
|
-
else {
|
429
|
-
value = value > pageSize.height - height ? round(pageSize.height - height, 2) : value;
|
430
|
-
}
|
431
|
-
return { key: `position.${key}`, value, schemaId: as.id };
|
432
|
-
});
|
433
|
-
};
|
434
|
-
export const getPagesScrollTopByIndex = (pageSizes, index, scale) => {
|
435
|
-
return pageSizes
|
436
|
-
.slice(0, index)
|
437
|
-
.reduce((acc, cur) => acc + (cur.height * ZOOM + RULER_HEIGHT * scale) * scale, 0);
|
438
|
-
};
|
439
|
-
//# sourceMappingURL=helper.js.map
|