@pdfme/ui 1.1.3 → 1.1.5
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/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} +1 -1
- 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/Guides.d.ts +0 -0
- package/dist/types/{src/components → components}/Designer/Main/Mask.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Main/Moveable.d.ts +0 -0
- package/dist/types/{src/components → components}/Designer/Main/Selecto.d.ts +0 -1
- package/dist/types/{src/components → components}/Designer/Main/index.d.ts +0 -0
- 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/Item.d.ts +0 -0
- package/dist/types/{src/components → components}/Designer/Sidebar/ListView/SelectableSortableContainer.d.ts +1 -2
- package/dist/types/{src/components → components}/Designer/Sidebar/ListView/SelectableSortableItem.d.ts +0 -0
- 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 +0 -1
- 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}/Paper.d.ts +0 -0
- package/dist/types/{src/components → components}/Preview.d.ts +0 -1
- package/dist/types/{src/components → components}/Root.d.ts +0 -0
- 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/constants.d.ts → constants.d.ts} +0 -0
- package/dist/types/{src/contexts.d.ts → contexts.d.ts} +1 -1
- package/dist/types/{src/helper.d.ts → helper.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
- package/dist/types/{src/index.d.ts → index.d.ts} +3 -3
- package/package.json +16 -23
- package/src/Designer.tsx +9 -9
- package/src/Form.tsx +8 -8
- package/src/Viewer.tsx +8 -8
- package/src/class.ts +5 -6
- 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/Selecto.tsx +1 -1
- package/src/components/Designer/Main/index.tsx +9 -9
- package/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.tsx +2 -2
- package/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.tsx +2 -2
- package/src/components/Designer/Sidebar/DetailView/TextPropEditor.tsx +1 -1
- 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 +4 -3
- package/src/components/Schemas/BarcodeSchema.tsx +2 -2
- package/src/components/Schemas/ImageSchema.tsx +3 -3
- package/src/components/Schemas/SchemaUI.tsx +4 -4
- package/src/components/Schemas/TextSchema.tsx +2 -2
- package/src/contexts.ts +2 -2
- package/src/helper.ts +4 -1
- package/src/hooks.ts +2 -2
- package/src/i18n.ts +1 -1
- package/src/index.ts +3 -3
- package/tsconfig.json +22 -0
- package/vite.config.ts +0 -0
- package/webpack.config.js +49 -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 -63
- package/dist/cjs/src/Designer.js.map +0 -1
- package/dist/cjs/src/Form.js +0 -37
- package/dist/cjs/src/Form.js.map +0 -1
- package/dist/cjs/src/Viewer.js +0 -27
- package/dist/cjs/src/Viewer.js.map +0 -1
- package/dist/cjs/src/class.js +0 -118
- 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 -58
- package/dist/esm/src/Designer.js.map +0 -1
- package/dist/esm/src/Form.js +0 -32
- package/dist/esm/src/Form.js.map +0 -1
- package/dist/esm/src/Viewer.js +0 -22
- package/dist/esm/src/Viewer.js.map +0 -1
- package/dist/esm/src/class.js +0 -113
- 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/tsconfig.cjs.json +0 -10
- package/tsconfig.esm.json +0 -10
@@ -16,9 +16,9 @@ import {
|
|
16
16
|
verticalListSortingStrategy,
|
17
17
|
} from '@dnd-kit/sortable';
|
18
18
|
import { SchemaForUI } from '@pdfme/common';
|
19
|
-
import Item from './Item
|
20
|
-
import SelectableSortableItem from './SelectableSortableItem
|
21
|
-
import { SidebarProps } from '../index
|
19
|
+
import Item from './Item';
|
20
|
+
import SelectableSortableItem from './SelectableSortableItem';
|
21
|
+
import { SidebarProps } from '../index';
|
22
22
|
|
23
23
|
const SelectableSortableContainer = (
|
24
24
|
props: Pick<
|
@@ -106,55 +106,59 @@ const SelectableSortableContainer = (
|
|
106
106
|
setClonedItems(null);
|
107
107
|
}}
|
108
108
|
>
|
109
|
-
|
110
|
-
<
|
111
|
-
<
|
112
|
-
{
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
</SortableContext>
|
129
|
-
</div>
|
130
|
-
{createPortal(
|
131
|
-
<DragOverlay adjustScale>
|
132
|
-
{activeId ? (
|
133
|
-
<>
|
134
|
-
<ul style={{ margin: 0, padding: 0, listStyle: 'none' }}>
|
135
|
-
<Item
|
136
|
-
value={schemas.find((schema) => schema.id === activeId)!.key}
|
137
|
-
style={{ color: '#fff', background: '#18a0fb' }}
|
138
|
-
dragOverlay
|
109
|
+
<>
|
110
|
+
<div style={{ height, overflowY: 'auto' }}>
|
111
|
+
<SortableContext items={schemas} strategy={verticalListSortingStrategy}>
|
112
|
+
<ul style={{ margin: 0, padding: 0, listStyle: 'none', borderRadius: 5 }}>
|
113
|
+
{schemas.map((schema) => (
|
114
|
+
<SelectableSortableItem
|
115
|
+
key={schema.id}
|
116
|
+
style={{
|
117
|
+
border: `1px solid ${
|
118
|
+
schema.id === hoveringSchemaId ? '#18a0fb' : 'transparent'
|
119
|
+
}`,
|
120
|
+
}}
|
121
|
+
schema={schema}
|
122
|
+
schemas={schemas}
|
123
|
+
isSelected={isItemSelected(schema.id) || activeId === schema.id}
|
124
|
+
onEdit={onEdit}
|
125
|
+
onSelect={onSelectionChanged}
|
126
|
+
onMouseEnter={() => onChangeHoveringSchemaId(schema.id)}
|
127
|
+
onMouseLeave={() => onChangeHoveringSchemaId(null)}
|
139
128
|
/>
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
129
|
+
))}
|
130
|
+
</ul>
|
131
|
+
</SortableContext>
|
132
|
+
</div>
|
133
|
+
{createPortal(
|
134
|
+
<DragOverlay adjustScale>
|
135
|
+
{activeId ? (
|
136
|
+
<>
|
137
|
+
<ul style={{ margin: 0, padding: 0, listStyle: 'none' }}>
|
138
|
+
<Item
|
139
|
+
value={schemas.find((schema) => schema.id === activeId)!.key}
|
140
|
+
style={{ color: '#fff', background: '#18a0fb' }}
|
141
|
+
dragOverlay
|
142
|
+
/>
|
143
|
+
</ul>
|
144
|
+
<ul style={{ margin: 0, padding: 0, listStyle: 'none' }}>
|
145
|
+
{selectedSchemas
|
146
|
+
.filter((item) => item.id !== activeId)
|
147
|
+
.map((item) => (
|
148
|
+
<Item
|
149
|
+
key={item.id}
|
150
|
+
value={item.key}
|
151
|
+
style={{ color: '#fff', background: '#18a0fb' }}
|
152
|
+
dragOverlay
|
153
|
+
/>
|
154
|
+
))}
|
155
|
+
</ul>
|
156
|
+
</>
|
157
|
+
) : null}
|
158
|
+
</DragOverlay>,
|
159
|
+
document.body
|
160
|
+
)}
|
161
|
+
</>
|
158
162
|
</DndContext>
|
159
163
|
);
|
160
164
|
};
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { useSortable } from '@dnd-kit/sortable';
|
3
3
|
import { SchemaForUI } from '@pdfme/common';
|
4
|
-
import { I18nContext } from '../../../../contexts
|
5
|
-
import Item from './Item
|
6
|
-
import { useMountStatus } from '../../../../hooks
|
4
|
+
import { I18nContext } from '../../../../contexts';
|
5
|
+
import Item from './Item';
|
6
|
+
import { useMountStatus } from '../../../../hooks';
|
7
7
|
|
8
8
|
interface Props {
|
9
9
|
isSelected: boolean;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React, { useContext, useState } from 'react';
|
2
|
-
import { RULER_HEIGHT, SIDEBAR_WIDTH } from '../../../../constants
|
3
|
-
import { I18nContext } from '../../../../contexts
|
4
|
-
import Divider from '../../../Divider
|
5
|
-
import SelectableSortableContainer from './SelectableSortableContainer
|
6
|
-
import { SidebarProps } from '../index
|
2
|
+
import { RULER_HEIGHT, SIDEBAR_WIDTH } from '../../../../constants';
|
3
|
+
import { I18nContext } from '../../../../contexts';
|
4
|
+
import Divider from '../../../Divider';
|
5
|
+
import SelectableSortableContainer from './SelectableSortableContainer';
|
6
|
+
import { SidebarProps } from '../index';
|
7
7
|
|
8
8
|
const ListView = (
|
9
9
|
props: Pick<
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import React, { useState, useContext } from 'react';
|
2
2
|
import { SchemaForUI, Size } from '@pdfme/common';
|
3
|
-
import { RULER_HEIGHT, SIDEBAR_WIDTH } from '../../../constants
|
4
|
-
import { I18nContext } from '../../../contexts
|
3
|
+
import { RULER_HEIGHT, SIDEBAR_WIDTH } from '../../../constants';
|
4
|
+
import { I18nContext } from '../../../contexts';
|
5
5
|
import { ArrowLeftIcon, ArrowRightIcon } from '@heroicons/react/24/outline';
|
6
|
-
import ListView from './ListView/index
|
7
|
-
import DetailView from './DetailView/index
|
6
|
+
import ListView from './ListView/index';
|
7
|
+
import DetailView from './DetailView/index';
|
8
8
|
|
9
9
|
export type SidebarProps = {
|
10
10
|
height: number;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React, { useRef, useState, useEffect, useContext, useCallback } from 'react';
|
2
2
|
import { DesignerReactProps, Template, SchemaForUI } from '@pdfme/common';
|
3
|
-
import Sidebar from './Sidebar/index
|
4
|
-
import Main from './Main/index
|
5
|
-
import { ZOOM, RULER_HEIGHT } from '../../constants
|
6
|
-
import { I18nContext } from '../../contexts
|
3
|
+
import Sidebar from './Sidebar/index';
|
4
|
+
import Main from './Main/index';
|
5
|
+
import { ZOOM, RULER_HEIGHT } from '../../constants';
|
6
|
+
import { I18nContext } from '../../contexts';
|
7
7
|
import {
|
8
8
|
uuid,
|
9
9
|
set,
|
@@ -18,11 +18,11 @@ import {
|
|
18
18
|
getUniqSchemaKey,
|
19
19
|
moveCommandToChangeSchemasArg,
|
20
20
|
getPagesScrollTopByIndex,
|
21
|
-
} from '../../helper
|
22
|
-
import { useUIPreProcessor, useScrollPageCursor } from '../../hooks
|
23
|
-
import Root from '../Root
|
24
|
-
import Error from '../Error
|
25
|
-
import CtlBar from '../CtlBar/index
|
21
|
+
} from '../../helper';
|
22
|
+
import { useUIPreProcessor, useScrollPageCursor } from '../../hooks';
|
23
|
+
import Root from '../Root';
|
24
|
+
import Error from '../Error';
|
25
|
+
import CtlBar from '../CtlBar/index';
|
26
26
|
|
27
27
|
const TemplateEditor = ({
|
28
28
|
template,
|
package/src/components/Error.tsx
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { Size } from '@pdfme/common';
|
3
|
-
import { I18nContext } from '../contexts
|
3
|
+
import { I18nContext } from '../contexts';
|
4
4
|
|
5
5
|
const Error = ({ size, error }: { size: Size; error: Error }) => {
|
6
6
|
const i18n = useContext(I18nContext);
|
package/src/components/Paper.tsx
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { MutableRefObject, ReactNode, useContext } from 'react';
|
2
2
|
import { SchemaForUI, Size, getFallbackFontName } from '@pdfme/common';
|
3
|
-
import { FontContext } from '../contexts
|
4
|
-
import { ZOOM, RULER_HEIGHT } from '../constants
|
3
|
+
import { FontContext } from '../contexts';
|
4
|
+
import { ZOOM, RULER_HEIGHT } from '../constants';
|
5
5
|
|
6
6
|
const Paper = (porps: {
|
7
7
|
paperRefs: MutableRefObject<HTMLDivElement[]>;
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import React, { useCallback, useRef, useState, useEffect } from 'react';
|
2
2
|
import { PreviewReactProps, SchemaForUI } from '@pdfme/common';
|
3
|
-
import { ZOOM, RULER_HEIGHT } from '../constants
|
4
|
-
import UnitPager from './UnitPager
|
5
|
-
import Root from './Root
|
6
|
-
import Error from './Error
|
7
|
-
import CtlBar from './CtlBar/index
|
8
|
-
import Paper from './Paper
|
9
|
-
import SchemaUI from './Schemas/SchemaUI
|
10
|
-
import { useUIPreProcessor, useScrollPageCursor } from '../hooks
|
11
|
-
import { templateSchemas2SchemasList, getPagesScrollTopByIndex } from '../helper
|
3
|
+
import { ZOOM, RULER_HEIGHT } from '../constants';
|
4
|
+
import UnitPager from './UnitPager';
|
5
|
+
import Root from './Root';
|
6
|
+
import Error from './Error';
|
7
|
+
import CtlBar from './CtlBar/index';
|
8
|
+
import Paper from './Paper';
|
9
|
+
import SchemaUI from './Schemas/SchemaUI';
|
10
|
+
import { useUIPreProcessor, useScrollPageCursor } from '../hooks';
|
11
|
+
import { templateSchemas2SchemasList, getPagesScrollTopByIndex } from '../helper';
|
12
12
|
|
13
13
|
const Preview = ({ template, inputs, size, onChangeInput }: PreviewReactProps) => {
|
14
14
|
const rootRef = useRef<HTMLDivElement>(null);
|
package/src/components/Root.tsx
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
import type {} from 'css-font-loading-module';
|
2
1
|
import React, { useContext, forwardRef, ReactNode, Ref, useEffect } from 'react';
|
3
2
|
import { Size } from '@pdfme/common';
|
4
|
-
import { FontContext } from '../contexts
|
5
|
-
import Spinner from './Spinner
|
3
|
+
import { FontContext } from '../contexts';
|
4
|
+
import Spinner from './Spinner';
|
6
5
|
|
7
6
|
type Props = { size: Size; scale: number; children: ReactNode };
|
8
7
|
|
@@ -18,7 +17,9 @@ const Root = ({ size, scale, children }: Props, ref: Ref<HTMLDivElement>) => {
|
|
18
17
|
});
|
19
18
|
Promise.all(fontFaces).then((loadedFontFaces) => {
|
20
19
|
loadedFontFaces.forEach((loadedFontFace) => {
|
20
|
+
// @ts-ignore
|
21
21
|
if (document && document.fonts && document.fonts.add) {
|
22
|
+
// @ts-ignore
|
22
23
|
document.fonts.add(loadedFontFace);
|
23
24
|
}
|
24
25
|
});
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { forwardRef, Ref } from 'react';
|
2
2
|
import { validateBarcodeInput, BarCodeType, BarcodeSchema } from '@pdfme/common';
|
3
|
-
import { ZOOM } from '../../constants
|
4
|
-
import { SchemaUIProps } from './SchemaUI
|
3
|
+
import { ZOOM } from '../../constants';
|
4
|
+
import { SchemaUIProps } from './SchemaUI';
|
5
5
|
|
6
6
|
const barcodeExampleImageObj: { [key: string]: string } = {
|
7
7
|
qrcode:
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import React, { useState, forwardRef, ChangeEvent, Ref } from 'react';
|
2
2
|
import { ImageSchema } from '@pdfme/common';
|
3
|
-
import { SchemaUIProps } from './SchemaUI
|
4
|
-
import { readFiles } from '../../helper
|
5
|
-
import { ZOOM } from '../../constants
|
3
|
+
import { SchemaUIProps } from './SchemaUI';
|
4
|
+
import { readFiles } from '../../helper';
|
5
|
+
import { ZOOM } from '../../constants';
|
6
6
|
import { XMarkIcon } from '@heroicons/react/24/outline';
|
7
7
|
|
8
8
|
type Props = SchemaUIProps & { schema: ImageSchema };
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React, { forwardRef, RefObject, Ref, ReactNode } from 'react';
|
2
2
|
import { SchemaForUI, isTextSchema, isImageSchema, isBarcodeSchema } from '@pdfme/common';
|
3
|
-
import { ZOOM, SELECTABLE_CLASSNAME } from '../../constants
|
4
|
-
import TextSchema from './TextSchema
|
5
|
-
import ImageSchema from './ImageSchema
|
6
|
-
import BarcodeSchema from './BarcodeSchema
|
3
|
+
import { ZOOM, SELECTABLE_CLASSNAME } from '../../constants';
|
4
|
+
import TextSchema from './TextSchema';
|
5
|
+
import ImageSchema from './ImageSchema';
|
6
|
+
import BarcodeSchema from './BarcodeSchema';
|
7
7
|
|
8
8
|
export interface SchemaUIProps {
|
9
9
|
schema: SchemaForUI;
|
@@ -7,8 +7,8 @@ import {
|
|
7
7
|
DEFAULT_FONT_COLOR,
|
8
8
|
TextSchema,
|
9
9
|
} from '@pdfme/common';
|
10
|
-
import { SchemaUIProps } from './SchemaUI
|
11
|
-
import { ZOOM } from '../../constants
|
10
|
+
import { SchemaUIProps } from './SchemaUI';
|
11
|
+
import { ZOOM } from '../../constants';
|
12
12
|
|
13
13
|
type Props = SchemaUIProps & { schema: TextSchema };
|
14
14
|
|
package/src/contexts.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { createContext } from 'react';
|
2
|
-
import { curriedI18n } from './i18n
|
3
|
-
import { DEFAULT_LANG } from './constants
|
2
|
+
import { curriedI18n } from './i18n';
|
3
|
+
import { DEFAULT_LANG } from './constants';
|
4
4
|
import { getDefaultFont } from '@pdfme/common';
|
5
5
|
|
6
6
|
export const I18nContext = createContext(curriedI18n(DEFAULT_LANG));
|
package/src/helper.ts
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
// TODO そもそもこのpdfjs-distはtscでビルドできない
|
2
|
+
// 昔のpdfmeのソースからwebpackのビルドに戻す
|
3
|
+
// 多分tree-shakingは動かないかもしれないけど、とりあえず動くようにするべき
|
1
4
|
// @ts-ignore
|
2
5
|
import PDFJSWorker from 'pdfjs-dist/build/pdf.worker.entry.js';
|
3
6
|
import { getDocument, GlobalWorkerOptions } from 'pdfjs-dist/legacy/build/pdf.js';
|
@@ -15,7 +18,7 @@ import {
|
|
15
18
|
DEFAULT_CHARACTER_SPACING,
|
16
19
|
DEFAULT_LINE_HEIGHT,
|
17
20
|
} from '@pdfme/common';
|
18
|
-
import { ZOOM, RULER_HEIGHT } from './constants
|
21
|
+
import { ZOOM, RULER_HEIGHT } from './constants';
|
19
22
|
|
20
23
|
export const uuid = () =>
|
21
24
|
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
package/src/hooks.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { RefObject, useRef, useState, useCallback, useEffect } from 'react';
|
2
2
|
import { Template, Size, getB64BasePdf } from '@pdfme/common';
|
3
|
-
import { pdf2Pngs, getPdfPageSizes, b64toBlob } from './helper
|
4
|
-
import { ZOOM, RULER_HEIGHT } from './constants
|
3
|
+
import { pdf2Pngs, getPdfPageSizes, b64toBlob } from './helper';
|
4
|
+
import { ZOOM, RULER_HEIGHT } from './constants';
|
5
5
|
|
6
6
|
export const usePrevious = <T>(value: T) => {
|
7
7
|
const ref = useRef<T | null>(null);
|
package/src/i18n.ts
CHANGED
package/src/index.ts
CHANGED
package/tsconfig.json
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"noImplicitAny": true,
|
4
|
+
"target": "ES2015",
|
5
|
+
"jsx": "react",
|
6
|
+
"esModuleInterop": true,
|
7
|
+
"isolatedModules": true,
|
8
|
+
"declaration": true,
|
9
|
+
"declarationDir": "dist/types",
|
10
|
+
"module": "ES2015",
|
11
|
+
"lib": ["es6", "dom", "es2016", "es2017"],
|
12
|
+
"moduleResolution": "node",
|
13
|
+
"allowSyntheticDefaultImports": true,
|
14
|
+
"strict": true,
|
15
|
+
"types": ["node", "jest", "@types/jest"],
|
16
|
+
"typeRoots": ["node_modules/@types"],
|
17
|
+
"sourceMap": true
|
18
|
+
},
|
19
|
+
"baseUrl": ".",
|
20
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
21
|
+
"exclude": ["node_modules"]
|
22
|
+
}
|
package/vite.config.ts
ADDED
File without changes
|
@@ -0,0 +1,49 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
const webpack = require('webpack');
|
3
|
+
const pkg = require('./package.json');
|
4
|
+
|
5
|
+
const isProduction = process.env.NODE_ENV === 'production';
|
6
|
+
|
7
|
+
const BANNER = [
|
8
|
+
'@name ' + pkg.name,
|
9
|
+
'@version ' + pkg.version + ' | ' + new Date().toDateString(),
|
10
|
+
'@author ' + pkg.author,
|
11
|
+
'@license ' + pkg.license,
|
12
|
+
].join('\n');
|
13
|
+
|
14
|
+
const config = {
|
15
|
+
optimization: { minimize: isProduction },
|
16
|
+
resolve: {
|
17
|
+
extensions: ['.ts', '.tsx', '.js'],
|
18
|
+
alias: { process: 'process/browser' },
|
19
|
+
},
|
20
|
+
plugins: [
|
21
|
+
// new BundleAnalyzerPlugin(),
|
22
|
+
new webpack.ProvidePlugin({
|
23
|
+
process: 'process/browser',
|
24
|
+
}),
|
25
|
+
new webpack.BannerPlugin({
|
26
|
+
banner: BANNER,
|
27
|
+
entryOnly: true,
|
28
|
+
}),
|
29
|
+
],
|
30
|
+
devtool: 'source-map',
|
31
|
+
entry: './src/index.ts',
|
32
|
+
output: {
|
33
|
+
path: path.resolve(__dirname, 'dist'),
|
34
|
+
filename: 'index.js',
|
35
|
+
globalObject: 'this',
|
36
|
+
library: {
|
37
|
+
type: 'umd',
|
38
|
+
},
|
39
|
+
},
|
40
|
+
module: {
|
41
|
+
rules: [
|
42
|
+
{
|
43
|
+
test: /\.tsx?$/,
|
44
|
+
use: 'ts-loader',
|
45
|
+
},
|
46
|
+
],
|
47
|
+
},
|
48
|
+
};
|
49
|
+
module.exports = config;
|
@@ -1,79 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.getSampleTemplate = exports.setupUIMock = void 0;
|
27
|
-
const hooks = __importStar(require("../../src/hooks.js"));
|
28
|
-
const helper_js_1 = require("../../src/helper.js");
|
29
|
-
const common_1 = require("@pdfme/common");
|
30
|
-
const setupUIMock = () => {
|
31
|
-
const backgrounds = ['data:image/png;base64,a...'];
|
32
|
-
const pageSizes = [{ height: 297, width: 210 }];
|
33
|
-
const mock = jest.spyOn(hooks, 'useUIPreProcessor');
|
34
|
-
mock.mockImplementation(() => ({ backgrounds, pageSizes, scale: 1, error: null }));
|
35
|
-
helper_js_1.getPdfPageSizes = jest.fn().mockReturnValue(Promise.resolve(pageSizes));
|
36
|
-
helper_js_1.pdf2Pngs = jest.fn().mockReturnValue(Promise.resolve(backgrounds));
|
37
|
-
helper_js_1.uuid = jest
|
38
|
-
.fn()
|
39
|
-
.mockReturnValueOnce('1')
|
40
|
-
.mockReturnValueOnce('2')
|
41
|
-
.mockReturnValueOnce('3')
|
42
|
-
.mockReturnValueOnce('4')
|
43
|
-
.mockReturnValueOnce('5');
|
44
|
-
const FontFace = jest.fn().mockReturnValue({ load: () => Promise.resolve() });
|
45
|
-
global.window.FontFace = FontFace;
|
46
|
-
};
|
47
|
-
exports.setupUIMock = setupUIMock;
|
48
|
-
const getSampleTemplate = () => ({
|
49
|
-
columns: ['field1', 'field2'],
|
50
|
-
sampledata: [
|
51
|
-
{
|
52
|
-
field1: 'bb',
|
53
|
-
field2: 'aaaaaaaaaaaa',
|
54
|
-
},
|
55
|
-
],
|
56
|
-
basePdf: common_1.BLANK_PDF,
|
57
|
-
schemas: [
|
58
|
-
{
|
59
|
-
field1: {
|
60
|
-
type: 'text',
|
61
|
-
position: { x: 20, y: 20 },
|
62
|
-
width: 100,
|
63
|
-
height: 15,
|
64
|
-
alignment: 'left',
|
65
|
-
fontSize: 30,
|
66
|
-
characterSpacing: 0,
|
67
|
-
lineHeight: 1,
|
68
|
-
},
|
69
|
-
field2: {
|
70
|
-
type: 'image',
|
71
|
-
position: { x: 20, y: 35 },
|
72
|
-
width: 100,
|
73
|
-
height: 40,
|
74
|
-
},
|
75
|
-
},
|
76
|
-
],
|
77
|
-
});
|
78
|
-
exports.getSampleTemplate = getSampleTemplate;
|
79
|
-
//# sourceMappingURL=helper.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../__tests__/assets/helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4C;AAC5C,mDAAsE;AACtE,0CAAoD;AAE7C,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,MAAM,WAAW,GAAG,CAAC,4BAA4B,CAAC,CAAC;IACnD,MAAM,SAAS,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;IACpD,IAAI,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAClF,2BAA6B,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACtF,oBAAsB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IACjF,gBAAkB,GAAG,IAAI;SACvB,EAAE,EAAE;SACJ,mBAAmB,CAAC,GAAG,CAAC;SACxB,mBAAmB,CAAC,GAAG,CAAC;SACxB,mBAAmB,CAAC,GAAG,CAAC;SACxB,mBAAmB,CAAC,GAAG,CAAC;SACxB,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC9E,MAAM,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACpC,CAAC,CAAC;AAhBW,QAAA,WAAW,eAgBtB;AAEK,MAAM,iBAAiB,GAAG,GAAa,EAAE,CAAC,CAAC;IAChD,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC7B,UAAU,EAAE;QACV;YACE,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,cAAc;SACvB;KACF;IACD,OAAO,EAAE,kBAAS;IAClB,OAAO,EAAE;QACP;YACE,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;gBAC1B,KAAK,EAAE,GAAG;gBACV,MAAM,EAAE,EAAE;gBACV,SAAS,EAAE,MAAM;gBACjB,QAAQ,EAAE,EAAE;gBACZ,gBAAgB,EAAE,CAAC;gBACnB,UAAU,EAAE,CAAC;aACd;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;gBAC1B,KAAK,EAAE,GAAG;gBACV,MAAM,EAAE,EAAE;aACX;SACF;KACF;CACF,CAAC,CAAC;AA7BU,QAAA,iBAAiB,qBA6B3B"}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
/**
|
16
|
-
* @jest-environment jsdom
|
17
|
-
*/
|
18
|
-
const react_1 = __importDefault(require("react"));
|
19
|
-
const react_2 = require("@testing-library/react");
|
20
|
-
require("@testing-library/jest-dom");
|
21
|
-
const index_js_1 = __importDefault(require("../../src/components/Designer/index.js"));
|
22
|
-
const contexts_js_1 = require("../../src/contexts.js");
|
23
|
-
const i18n_js_1 = require("../../src/i18n.js");
|
24
|
-
const constants_js_1 = require("../../src/constants.js");
|
25
|
-
const common_1 = require("@pdfme/common");
|
26
|
-
const helper_js_1 = require("../assets/helper.js");
|
27
|
-
test('Designer snapshot', () => __awaiter(void 0, void 0, void 0, function* () {
|
28
|
-
(0, helper_js_1.setupUIMock)();
|
29
|
-
let container = document.createElement('a');
|
30
|
-
(0, react_2.act)(() => {
|
31
|
-
const { container: c } = (0, react_2.render)(react_1.default.createElement(contexts_js_1.I18nContext.Provider, { value: (0, i18n_js_1.curriedI18n)('en') },
|
32
|
-
react_1.default.createElement(contexts_js_1.FontContext.Provider, { value: (0, common_1.getDefaultFont)() },
|
33
|
-
react_1.default.createElement(index_js_1.default, { template: (0, helper_js_1.getSampleTemplate)(), onSaveTemplate: console.log, onChangeTemplate: console.log, size: { width: 1200, height: 1200 } }))));
|
34
|
-
container = c;
|
35
|
-
});
|
36
|
-
yield (0, react_2.waitFor)(() => Boolean(container === null || container === void 0 ? void 0 : container.getElementsByClassName(constants_js_1.SELECTABLE_CLASSNAME)));
|
37
|
-
expect(container.firstChild).toMatchSnapshot();
|
38
|
-
}));
|
39
|
-
//# sourceMappingURL=Designer.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Designer.test.js","sourceRoot":"","sources":["../../../../__tests__/components/Designer.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;GAEG;AACH,kDAA0B;AAC1B,kDAA8D;AAC9D,qCAAmC;AACnC,sFAA8D;AAC9D,uDAAiE;AACjE,+CAAgD;AAChD,yDAA8D;AAC9D,0CAA+C;AAC/C,mDAAqE;AAErE,IAAI,CAAC,mBAAmB,EAAE,GAAS,EAAE;IACnC,IAAA,uBAAW,GAAE,CAAC;IACd,IAAI,SAAS,GAAgB,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACzD,IAAA,WAAG,EAAC,GAAG,EAAE;QACP,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,IAAA,cAAM,EAC7B,8BAAC,yBAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAA,qBAAW,EAAC,IAAI,CAAC;YAC5C,8BAAC,yBAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAA,uBAAc,GAAE;gBAC3C,8BAAC,kBAAQ,IACP,QAAQ,EAAE,IAAA,6BAAiB,GAAE,EAC7B,cAAc,EAAE,OAAO,CAAC,GAAG,EAC3B,gBAAgB,EAAE,OAAO,CAAC,GAAG,EAC7B,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GACnC,CACmB,CACF,CACxB,CAAC;QACF,SAAS,GAAG,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,MAAM,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,sBAAsB,CAAC,mCAAoB,CAAC,CAAC,CAAC,CAAC;IACtF,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,CAAC;AACjD,CAAC,CAAA,CAAC,CAAC"}
|
@@ -1,51 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
/**
|
16
|
-
* @jest-environment jsdom
|
17
|
-
*/
|
18
|
-
const react_1 = __importDefault(require("react"));
|
19
|
-
const react_2 = require("@testing-library/react");
|
20
|
-
require("@testing-library/jest-dom");
|
21
|
-
const Preview_1 = __importDefault(require("../../src/components/Preview"));
|
22
|
-
const contexts_1 = require("../../src/contexts");
|
23
|
-
const i18n_1 = require("../../src/i18n");
|
24
|
-
const constants_1 = require("../../src/constants");
|
25
|
-
const common_1 = require("@pdfme/common");
|
26
|
-
const helper_1 = require("../assets/helper");
|
27
|
-
test('Preview(as Viewer) snapshot', () => __awaiter(void 0, void 0, void 0, function* () {
|
28
|
-
(0, helper_1.setupUIMock)();
|
29
|
-
let container = document.createElement('a');
|
30
|
-
(0, react_2.act)(() => {
|
31
|
-
const { container: c } = (0, react_2.render)(react_1.default.createElement(contexts_1.I18nContext.Provider, { value: (0, i18n_1.curriedI18n)('en') },
|
32
|
-
react_1.default.createElement(contexts_1.FontContext.Provider, { value: (0, common_1.getDefaultFont)() },
|
33
|
-
react_1.default.createElement(Preview_1.default, { template: (0, helper_1.getSampleTemplate)(), inputs: [{ field1: 'field1', field2: 'field2' }], size: { width: 1200, height: 1200 } }))));
|
34
|
-
container = c;
|
35
|
-
});
|
36
|
-
yield (0, react_2.waitFor)(() => Boolean(container === null || container === void 0 ? void 0 : container.getElementsByClassName(constants_1.SELECTABLE_CLASSNAME)));
|
37
|
-
expect(container.firstChild).toMatchSnapshot();
|
38
|
-
}));
|
39
|
-
test('Preview(as Form) snapshot', () => __awaiter(void 0, void 0, void 0, function* () {
|
40
|
-
(0, helper_1.setupUIMock)();
|
41
|
-
let container = document.createElement('a');
|
42
|
-
(0, react_2.act)(() => {
|
43
|
-
const { container: c } = (0, react_2.render)(react_1.default.createElement(contexts_1.I18nContext.Provider, { value: (0, i18n_1.curriedI18n)('en') },
|
44
|
-
react_1.default.createElement(contexts_1.FontContext.Provider, { value: (0, common_1.getDefaultFont)() },
|
45
|
-
react_1.default.createElement(Preview_1.default, { template: (0, helper_1.getSampleTemplate)(), inputs: [{ field1: 'field1', field2: 'field2' }], size: { width: 1200, height: 1200 }, onChangeInput: console.log }))));
|
46
|
-
container = c;
|
47
|
-
});
|
48
|
-
yield (0, react_2.waitFor)(() => Boolean(container === null || container === void 0 ? void 0 : container.getElementsByClassName(constants_1.SELECTABLE_CLASSNAME)));
|
49
|
-
expect(container.firstChild).toMatchSnapshot();
|
50
|
-
}));
|
51
|
-
//# sourceMappingURL=Preview.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Preview.test.js","sourceRoot":"","sources":["../../../../__tests__/components/Preview.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;GAEG;AACH,kDAA0B;AAC1B,kDAA8D;AAC9D,qCAAmC;AACnC,2EAAmD;AACnD,iDAA8D;AAC9D,yCAA6C;AAC7C,mDAA2D;AAC3D,0CAA+C;AAC/C,6CAAkE;AAElE,IAAI,CAAC,6BAA6B,EAAE,GAAS,EAAE;IAC7C,IAAA,oBAAW,GAAE,CAAC;IACd,IAAI,SAAS,GAAgB,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACzD,IAAA,WAAG,EAAC,GAAG,EAAE;QACP,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,IAAA,cAAM,EAC7B,8BAAC,sBAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAA,kBAAW,EAAC,IAAI,CAAC;YAC5C,8BAAC,sBAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAA,uBAAc,GAAE;gBAC3C,8BAAC,iBAAO,IACN,QAAQ,EAAE,IAAA,0BAAiB,GAAE,EAC7B,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAChD,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GACnC,CACmB,CACF,CACxB,CAAC;QACF,SAAS,GAAG,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,MAAM,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,sBAAsB,CAAC,gCAAoB,CAAC,CAAC,CAAC,CAAC;IACtF,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,CAAC;AACjD,CAAC,CAAA,CAAC,CAAC;AAEH,IAAI,CAAC,2BAA2B,EAAE,GAAS,EAAE;IAC3C,IAAA,oBAAW,GAAE,CAAC;IACd,IAAI,SAAS,GAAgB,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACzD,IAAA,WAAG,EAAC,GAAG,EAAE;QACP,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,IAAA,cAAM,EAC7B,8BAAC,sBAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAA,kBAAW,EAAC,IAAI,CAAC;YAC5C,8BAAC,sBAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAA,uBAAc,GAAE;gBAC3C,8BAAC,iBAAO,IACN,QAAQ,EAAE,IAAA,0BAAiB,GAAE,EAC7B,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAChD,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EACnC,aAAa,EAAE,OAAO,CAAC,GAAG,GAC1B,CACmB,CACF,CACxB,CAAC;QACF,SAAS,GAAG,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,MAAM,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,sBAAsB,CAAC,gCAAoB,CAAC,CAAC,CAAC,CAAC;IACtF,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,CAAC;AACjD,CAAC,CAAA,CAAC,CAAC"}
|