@pdfme/ui 3.4.3 → 4.0.0

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.
Files changed (51) hide show
  1. package/dist/index.es.js +60294 -59344
  2. package/dist/index.umd.js +116 -117
  3. package/dist/types/class.d.ts +60 -10
  4. package/dist/types/components/AppContextProvider.d.ts +2 -2
  5. package/dist/types/components/CtlBar.d.ts +2 -0
  6. package/dist/types/components/Designer/Canvas/Padding.d.ts +6 -0
  7. package/dist/types/components/Designer/Canvas/index.d.ts +2 -1
  8. package/dist/types/components/Designer/LeftSidebar.d.ts +8 -0
  9. package/dist/types/components/Designer/index.d.ts +2 -1
  10. package/dist/types/components/Preview.d.ts +1 -1
  11. package/dist/types/components/Renderer.d.ts +4 -3
  12. package/dist/types/constants.d.ts +1 -1
  13. package/dist/types/contexts.d.ts +12 -3
  14. package/dist/types/helper.d.ts +21 -33
  15. package/dist/types/hooks.d.ts +1 -0
  16. package/dist/types/types.d.ts +0 -1
  17. package/package.json +1 -1
  18. package/src/Designer.tsx +8 -3
  19. package/src/Form.tsx +6 -3
  20. package/src/Viewer.tsx +0 -1
  21. package/src/class.ts +28 -5
  22. package/src/components/AppContextProvider.tsx +3 -1
  23. package/src/components/CtlBar.tsx +57 -6
  24. package/src/components/Designer/Canvas/Padding.tsx +54 -0
  25. package/src/components/Designer/Canvas/index.tsx +89 -22
  26. package/src/components/Designer/LeftSidebar.tsx +81 -0
  27. package/src/components/Designer/{Sidebar → RightSidebar}/DetailView/index.tsx +8 -13
  28. package/src/components/Designer/{Sidebar → RightSidebar}/ListView/index.tsx +3 -11
  29. package/src/components/Designer/{Sidebar → RightSidebar}/index.tsx +5 -20
  30. package/src/components/Designer/index.tsx +166 -101
  31. package/src/components/Paper.tsx +1 -2
  32. package/src/components/Preview.tsx +72 -22
  33. package/src/components/Renderer.tsx +12 -11
  34. package/src/constants.ts +1 -1
  35. package/src/helper.ts +114 -118
  36. package/src/hooks.ts +46 -14
  37. package/src/i18n.ts +194 -7
  38. package/src/types.ts +0 -1
  39. /package/dist/types/components/Designer/{Sidebar → RightSidebar}/DetailView/AlignWidget.d.ts +0 -0
  40. /package/dist/types/components/Designer/{Sidebar → RightSidebar}/DetailView/WidgetRenderer.d.ts +0 -0
  41. /package/dist/types/components/Designer/{Sidebar → RightSidebar}/DetailView/index.d.ts +0 -0
  42. /package/dist/types/components/Designer/{Sidebar → RightSidebar}/ListView/Item.d.ts +0 -0
  43. /package/dist/types/components/Designer/{Sidebar → RightSidebar}/ListView/SelectableSortableContainer.d.ts +0 -0
  44. /package/dist/types/components/Designer/{Sidebar → RightSidebar}/ListView/SelectableSortableItem.d.ts +0 -0
  45. /package/dist/types/components/Designer/{Sidebar → RightSidebar}/ListView/index.d.ts +0 -0
  46. /package/dist/types/components/Designer/{Sidebar → RightSidebar}/index.d.ts +0 -0
  47. /package/src/components/Designer/{Sidebar → RightSidebar}/DetailView/AlignWidget.tsx +0 -0
  48. /package/src/components/Designer/{Sidebar → RightSidebar}/DetailView/WidgetRenderer.tsx +0 -0
  49. /package/src/components/Designer/{Sidebar → RightSidebar}/ListView/Item.tsx +0 -0
  50. /package/src/components/Designer/{Sidebar → RightSidebar}/ListView/SelectableSortableContainer.tsx +0 -0
  51. /package/src/components/Designer/{Sidebar → RightSidebar}/ListView/SelectableSortableItem.tsx +0 -0
@@ -11,10 +11,10 @@ import React, {
11
11
  } from 'react';
12
12
  import { theme, Button } from 'antd';
13
13
  import { OnDrag, OnResize, OnClick, OnRotate } from 'react-moveable';
14
- import { ZOOM, SchemaForUI, Size, ChangeSchemas } from '@pdfme/common';
14
+ import { ZOOM, SchemaForUI, Size, ChangeSchemas, BasePdf, isBlankPdf } from '@pdfme/common';
15
15
  import { PluginsRegistry } from '../../../contexts';
16
16
  import { CloseOutlined } from '@ant-design/icons';
17
- import { RULER_HEIGHT, SIDEBAR_WIDTH } from '../../../constants';
17
+ import { RULER_HEIGHT, RIGHT_SIDEBAR_WIDTH } from '../../../constants';
18
18
  import { usePrevious } from '../../../hooks';
19
19
  import { uuid, round, flatten } from '../../../helper';
20
20
  import Paper from '../../Paper';
@@ -23,6 +23,11 @@ import Selecto from './Selecto';
23
23
  import Moveable from './Moveable';
24
24
  import Guides from './Guides';
25
25
  import Mask from './Mask';
26
+ import Padding from './Padding';
27
+
28
+
29
+ const mm2px = (mm: number) => mm * 3.7795275591;
30
+
26
31
 
27
32
  const DELETE_BTN_ID = uuid();
28
33
  const fmt4Num = (prop: string) => Number(prop.replace('px', ''));
@@ -70,6 +75,7 @@ interface GuidesInterface {
70
75
  }
71
76
 
72
77
  interface Props {
78
+ basePdf: BasePdf;
73
79
  height: number;
74
80
  hoveringSchemaId: string | null;
75
81
  onChangeHoveringSchemaId: (id: string | null) => void;
@@ -89,6 +95,7 @@ interface Props {
89
95
 
90
96
  const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
91
97
  const {
98
+ basePdf,
92
99
  pageCursor,
93
100
  scale,
94
101
  backgrounds,
@@ -106,7 +113,6 @@ const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
106
113
  } = props;
107
114
  const { token } = theme.useToken();
108
115
  const pluginsRegistry = useContext(PluginsRegistry);
109
-
110
116
  const verticalGuides = useRef<GuidesInterface[]>([]);
111
117
  const horizontalGuides = useRef<GuidesInterface[]>([]);
112
118
  const moveable = useRef<any>(null);
@@ -142,7 +148,7 @@ const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
142
148
 
143
149
  useEffect(() => {
144
150
  moveable.current?.updateRect();
145
- if (prevSchemas === null) {
151
+ if (!prevSchemas) {
146
152
  return;
147
153
  }
148
154
 
@@ -154,9 +160,37 @@ const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
154
160
  }
155
161
  }, [pageCursor, schemasList, prevSchemas]);
156
162
 
157
- const onDrag = ({ target, left, top }: OnDrag) => {
158
- target.style.left = `${left < 0 ? 0 : left}px`;
159
- target.style.top = `${top < 0 ? 0 : top}px`;
163
+ const onDrag = ({ target, top, left }: OnDrag) => {
164
+ const { width: _width, height: _height } = target.style;
165
+ const targetWidth = fmt(_width);
166
+ const targetHeight = fmt(_height);
167
+ const actualTop = top / ZOOM;
168
+ const actualLeft = left / ZOOM;
169
+ const { width: pageWidth, height: pageHeight } = pageSizes[pageCursor];
170
+ let topPadding = 0;
171
+ let rightPadding = 0;
172
+ let bottomPadding = 0;
173
+ let leftPadding = 0;
174
+
175
+ if (isBlankPdf(basePdf)) {
176
+ const [t, r, b, l] = basePdf.padding;
177
+ topPadding = t * ZOOM;
178
+ rightPadding = r;
179
+ bottomPadding = b;
180
+ leftPadding = l * ZOOM;
181
+ }
182
+
183
+ if (actualTop + targetHeight > pageHeight - bottomPadding) {
184
+ target.style.top = `${(pageHeight - targetHeight - bottomPadding) * ZOOM}px`;
185
+ } else {
186
+ target.style.top = `${top < topPadding ? topPadding : top}px`;
187
+ }
188
+
189
+ if (actualLeft + targetWidth > pageWidth - rightPadding) {
190
+ target.style.left = `${(pageWidth - targetWidth - rightPadding) * ZOOM}px`;
191
+ } else {
192
+ target.style.left = `${left < leftPadding ? leftPadding : left}px`;
193
+ }
160
194
  };
161
195
 
162
196
  const onDragEnd = ({ target }: { target: HTMLElement | SVGElement }) => {
@@ -195,24 +229,24 @@ const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
195
229
  changeSchemas(flatten(arg));
196
230
  };
197
231
 
198
- const onResizeEnd = async ({ target }: { target: HTMLElement | SVGElement }) => {
232
+ const onResizeEnd = ({ target }: { target: HTMLElement | SVGElement }) => {
199
233
  const { id, style } = target;
200
234
  const { width, height, top, left } = style;
201
235
  changeSchemas([
236
+ { key: 'position.x', value: fmt(left), schemaId: id },
237
+ { key: 'position.y', value: fmt(top), schemaId: id },
202
238
  { key: 'width', value: fmt(width), schemaId: id },
203
239
  { key: 'height', value: fmt(height), schemaId: id },
204
- { key: 'position.y', value: fmt(top), schemaId: id },
205
- { key: 'position.x', value: fmt(left), schemaId: id },
206
240
  ]);
207
241
 
208
242
  const targetSchema = schemasList[pageCursor].find((schema) => schema.id === id);
209
243
 
210
244
  if (!targetSchema) return;
211
245
 
246
+ targetSchema.position.x = fmt(left);
247
+ targetSchema.position.y = fmt(top);
212
248
  targetSchema.width = fmt(width);
213
249
  targetSchema.height = fmt(height);
214
- targetSchema.position.y = fmt(top);
215
- targetSchema.position.x = fmt(left);
216
250
  };
217
251
 
218
252
  const onResizeEnds = ({ targets }: { targets: (HTMLElement | SVGElement)[] }) => {
@@ -227,13 +261,43 @@ const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
227
261
 
228
262
  const onResize = ({ target, width, height, direction }: OnResize) => {
229
263
  if (!target) return;
230
- const s = target.style;
231
- const newLeft = fmt4Num(s.left) + (fmt4Num(s.width) - width);
232
- const newTop = fmt4Num(s.top) + (fmt4Num(s.height) - height);
264
+ let topPadding = 0;
265
+ let rightPadding = 0;
266
+ let bottomPadding = 0;
267
+ let leftPadding = 0;
268
+
269
+ if (isBlankPdf(basePdf)) {
270
+ const [t, r, b, l] = basePdf.padding;
271
+ topPadding = t * ZOOM;
272
+ rightPadding = mm2px(r);
273
+ bottomPadding = mm2px(b);
274
+ leftPadding = l * ZOOM;
275
+ }
276
+
277
+ const pageWidth = mm2px(pageSizes[pageCursor].width);
278
+ const pageHeight = mm2px(pageSizes[pageCursor].height);
279
+
233
280
  const obj: { top?: string; left?: string; width: string; height: string } = {
234
281
  width: `${width}px`,
235
282
  height: `${height}px`,
236
283
  };
284
+
285
+ const s = target.style;
286
+ let newLeft = fmt4Num(s.left) + (fmt4Num(s.width) - width);
287
+ let newTop = fmt4Num(s.top) + (fmt4Num(s.height) - height);
288
+ if (newLeft < leftPadding) {
289
+ newLeft = leftPadding;
290
+ }
291
+ if (newTop < topPadding) {
292
+ newTop = topPadding;
293
+ }
294
+ if (newLeft + width > pageWidth - rightPadding) {
295
+ obj.width = `${pageWidth - rightPadding - newLeft}px`;
296
+ }
297
+ if (newTop + height > pageHeight - bottomPadding) {
298
+ obj.height = `${pageHeight - bottomPadding - newTop}px`;
299
+ }
300
+
237
301
  const d = direction.toString();
238
302
  if (isTopLeftResize(d)) {
239
303
  obj.top = `${newTop}px`;
@@ -255,7 +319,7 @@ const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
255
319
  };
256
320
 
257
321
  const rotatable = useMemo(() => {
258
- const selectedSchemas = schemasList[pageCursor].filter((s) =>
322
+ const selectedSchemas = (schemasList[pageCursor] || []).filter((s) =>
259
323
  activeElements.map((ae) => ae.id).includes(s.id)
260
324
  );
261
325
  const schemaTypes = selectedSchemas.map((s) => s.type);
@@ -274,7 +338,7 @@ const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
274
338
  style={{
275
339
  position: 'relative',
276
340
  overflow: 'auto',
277
- marginRight: sidebarOpen ? SIDEBAR_WIDTH : 0,
341
+ marginRight: sidebarOpen ? RIGHT_SIDEBAR_WIDTH : 0,
278
342
  ...size,
279
343
  }}
280
344
  ref={ref}
@@ -329,6 +393,7 @@ const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
329
393
  {!editing && activeElements.length > 0 && pageCursor === index && (
330
394
  <DeleteButton activeElements={activeElements} />
331
395
  )}
396
+ <Padding basePdf={basePdf} />
332
397
  <Guides
333
398
  paperSize={paperSize}
334
399
  horizontalRef={(e) => {
@@ -372,19 +437,21 @@ const Canvas = (props: Props, ref: Ref<HTMLDivElement>) => {
372
437
  <Renderer
373
438
  key={schema.id}
374
439
  schema={schema}
440
+ basePdf={basePdf}
441
+ value={schema.content || ''}
375
442
  onChangeHoveringSchemaId={onChangeHoveringSchemaId}
376
443
  mode={
377
444
  editing && activeElements.map((ae) => ae.id).includes(schema.id)
378
445
  ? 'designer'
379
446
  : 'viewer'
380
447
  }
381
- onChange={(value) => {
382
- changeSchemas([{ key: 'data', value, schemaId: schema.id }]);
448
+ onChange={(arg) => {
449
+ const args = Array.isArray(arg) ? arg : [arg];
450
+ changeSchemas(args.map(({ key, value }) => ({ key, value, schemaId: schema.id })));
383
451
  }}
384
452
  stopEditing={() => setEditing(false)}
385
- outline={`1px ${hoveringSchemaId === schema.id ? 'solid' : 'dashed'} ${
386
- schema.readOnly ? 'transparent' : token.colorPrimary
387
- }`}
453
+ outline={`1px ${hoveringSchemaId === schema.id ? 'solid' : 'dashed'} ${schema.readOnly && hoveringSchemaId !== schema.id ? 'transparent' : token.colorPrimary
454
+ }`}
388
455
  scale={scale}
389
456
  />
390
457
  )}
@@ -0,0 +1,81 @@
1
+ import React, { useContext } from 'react';
2
+ import {
3
+ Schema,
4
+ Plugin,
5
+ BasePdf,
6
+ } from '@pdfme/common';
7
+ import { theme, Button } from 'antd';
8
+ import { useDraggable } from '@dnd-kit/core';
9
+ import { CSS } from "@dnd-kit/utilities";
10
+ import Renderer from '../Renderer';
11
+ import { PluginsRegistry } from '../../contexts';
12
+
13
+ const Draggable = (props: { plugin: Plugin<any>, scale: number, basePdf: BasePdf, children: React.ReactNode }) => {
14
+ const { scale, basePdf, plugin } = props;
15
+ const { token } = theme.useToken();
16
+ const defaultSchema = plugin.propPanel.defaultSchema as Schema;
17
+ const draggable = useDraggable({ id: defaultSchema.type, data: defaultSchema });
18
+ const { listeners, setNodeRef, attributes, transform, isDragging } = draggable;
19
+ const style = { transform: CSS.Translate.toString(transform) }
20
+
21
+ return (
22
+ <div ref={setNodeRef} style={style} {...listeners} {...attributes}>
23
+ {isDragging &&
24
+ <div style={{ transform: `scale(${scale})` }}>
25
+ <Renderer
26
+ key={defaultSchema.type}
27
+ schema={{ ...defaultSchema, id: defaultSchema.type, key: defaultSchema.type }}
28
+ basePdf={basePdf}
29
+ value={defaultSchema.content || ''}
30
+ onChangeHoveringSchemaId={() => { void 0 }}
31
+ mode={'viewer'}
32
+ outline={`1px solid ${token.colorPrimary}`}
33
+ scale={scale}
34
+ />
35
+ </div>
36
+ }
37
+ <div style={{ visibility: isDragging ? 'hidden' : 'visible' }}>
38
+ {props.children}
39
+ </div>
40
+ </div>
41
+ );
42
+ }
43
+
44
+ const LeftSidebar = ({ height, scale, basePdf }: { height: number, scale: number, basePdf: BasePdf }) => {
45
+ const { token } = theme.useToken();
46
+ const pluginsRegistry = useContext(PluginsRegistry);
47
+
48
+ return <div
49
+ style={{
50
+ left: 0,
51
+ position: 'absolute',
52
+ right: 0,
53
+ zIndex: 1,
54
+ height,
55
+ background: token.colorBgLayout,
56
+ textAlign: 'center',
57
+ width: 45,
58
+ }}
59
+ >
60
+ {Object.entries(pluginsRegistry).map(([label, plugin]) => {
61
+ if (!plugin?.propPanel.defaultSchema) return null;
62
+ return <Draggable
63
+ key={label}
64
+ scale={scale}
65
+ basePdf={basePdf}
66
+ plugin={plugin}>
67
+ <Button
68
+ title={label}
69
+ style={{ width: 35, height: 35, marginTop: '0.25rem', padding: '0.25rem' }}>
70
+ {plugin.propPanel.defaultSchema.icon ?
71
+ <div dangerouslySetInnerHTML={{ __html: plugin.propPanel.defaultSchema.icon }} />
72
+ :
73
+ <div style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}>{label}</div>
74
+ }
75
+ </Button>
76
+ </Draggable>
77
+ })}
78
+ </div>
79
+ }
80
+
81
+ export default LeftSidebar
@@ -75,7 +75,7 @@ const DetailView = (
75
75
  const handleWatch = (newSchema: any) => {
76
76
  const changes = [];
77
77
  for (let key in newSchema) {
78
- if (['id', 'data'].includes(key)) continue;
78
+ if (['id', 'content'].includes(key)) continue;
79
79
  if (newSchema[key] !== (activeSchema as any)[key]) {
80
80
  let value = newSchema[key];
81
81
  // FIXME memo: https://github.com/pdfme/pdfme/pull/367#issuecomment-1857468274
@@ -123,15 +123,15 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
123
123
  key: { title: i18n('fieldName'), type: 'string', required: true, span: 14 },
124
124
  '-': { type: 'void', widget: 'Divider' },
125
125
  align: { title: i18n('align'), type: 'void', widget: 'AlignWidget' },
126
- x: { title: 'X', type: 'number', widget: 'inputNumber', required: true, span: 8 },
127
- y: { title: 'Y', type: 'number', widget: 'inputNumber', required: true, span: 8 },
126
+ x: { title: 'X', type: 'number', widget: 'inputNumber', required: true, span: 8, min: 0 },
127
+ y: { title: 'Y', type: 'number', widget: 'inputNumber', required: true, span: 8, min: 0 },
128
128
  rotate: {
129
129
  title: i18n('rotate'),
130
130
  type: 'number',
131
131
  widget: 'inputNumber',
132
132
  disabled: defaultSchema?.rotate === undefined,
133
133
  max: 360,
134
- min: 0,
134
+ props: { min: 0 },
135
135
  span: 8,
136
136
  },
137
137
  width: {
@@ -140,7 +140,7 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
140
140
  widget: 'inputNumber',
141
141
  required: true,
142
142
  span: 8,
143
- min: 0,
143
+ props: { min: 0 },
144
144
  },
145
145
  height: {
146
146
  title: i18n('height'),
@@ -148,18 +148,14 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
148
148
  widget: 'inputNumber',
149
149
  required: true,
150
150
  span: 8,
151
- min: 0,
151
+ props: { min: 0 },
152
152
  },
153
153
  opacity: {
154
154
  title: i18n('opacity'),
155
155
  type: 'number',
156
156
  widget: 'inputNumber',
157
157
  disabled: defaultSchema?.opacity === undefined,
158
- props: {
159
- step: 0.1,
160
- },
161
- max: 1,
162
- min: 0,
158
+ props: { step: 0.1, min: 0, max: 1 },
163
159
  span: 8,
164
160
  },
165
161
  },
@@ -210,8 +206,7 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
210
206
  style={{
211
207
  height: getSidebarContentHeight(size.height),
212
208
  overflowY: 'auto',
213
- overflowX: 'hidden',
214
- borderBottom: `1px solid ${token.colorSplit}`,
209
+ overflowX: 'hidden'
215
210
  }}
216
211
  >
217
212
  <FormRender
@@ -1,6 +1,6 @@
1
1
  import React, { useContext, useState } from 'react';
2
2
  import type { SidebarProps } from '../../../../types';
3
- import { SIDEBAR_WIDTH } from '../../../../constants';
3
+ import { RIGHT_SIDEBAR_WIDTH } from '../../../../constants';
4
4
  import { I18nContext } from '../../../../contexts';
5
5
  import { getSidebarContentHeight } from '../../../../helper';
6
6
  import { theme, Input, Typography, Divider, Button } from 'antd';
@@ -76,7 +76,7 @@ const ListView = (
76
76
  style={{
77
77
  paddingLeft: 30,
78
78
  height: height - headHeight,
79
- width: SIDEBAR_WIDTH - 35,
79
+ width: RIGHT_SIDEBAR_WIDTH - 35,
80
80
  lineHeight: '2.75rem',
81
81
  }}
82
82
  />
@@ -89,15 +89,7 @@ const ListView = (
89
89
  onEdit={onEdit}
90
90
  />
91
91
  )}
92
- <div
93
- style={{
94
- display: 'flex',
95
- alignItems: 'center',
96
- justifyContent: 'flex-end',
97
- height: headHeight,
98
- borderBottom: `1px solid ${token.colorSplit}`,
99
- }}
100
- >
92
+ <div style={{ paddingTop: '0.5rem', display: 'flex', alignItems: 'center', justifyContent: 'flex-end' }}>
101
93
  {isBulkUpdateFieldNamesMode ? (
102
94
  <>
103
95
  <Button size="small" type="text" onClick={commitBulk}>
@@ -1,17 +1,15 @@
1
- import React, { useContext } from 'react';
1
+ import React from 'react';
2
2
  import { theme, Button } from 'antd';
3
3
  import type { SidebarProps } from '../../../types';
4
- import { SIDEBAR_WIDTH } from '../../../constants';
5
- import { I18nContext } from '../../../contexts';
4
+ import { RIGHT_SIDEBAR_WIDTH } from '../../../constants';
6
5
  import { ArrowLeftOutlined, ArrowRightOutlined } from '@ant-design/icons';
7
6
  import ListView from './ListView/index';
8
7
  import DetailView from './DetailView/index';
9
8
 
10
9
  const Sidebar = (props: SidebarProps) => {
11
- const { sidebarOpen, setSidebarOpen, activeElements, schemas, addSchema } = props;
10
+ const { sidebarOpen, setSidebarOpen, activeElements, schemas } = props;
12
11
 
13
12
  const { token } = theme.useToken();
14
- const i18n = useContext(I18nContext);
15
13
  const getActiveSchemas = () =>
16
14
  schemas.filter((s) => activeElements.map((ae) => ae.id).includes(s.id));
17
15
  const getLastActiveSchema = () => {
@@ -26,7 +24,7 @@ const Sidebar = (props: SidebarProps) => {
26
24
  right: 0,
27
25
  zIndex: 1,
28
26
  height: '100%',
29
- width: sidebarOpen ? SIDEBAR_WIDTH : 0,
27
+ width: sidebarOpen ? RIGHT_SIDEBAR_WIDTH : 0,
30
28
  }}
31
29
  >
32
30
  <div>
@@ -45,7 +43,7 @@ const Sidebar = (props: SidebarProps) => {
45
43
  />
46
44
  <div
47
45
  style={{
48
- width: SIDEBAR_WIDTH,
46
+ width: RIGHT_SIDEBAR_WIDTH,
49
47
  height: '100%',
50
48
  display: sidebarOpen ? 'block' : 'none',
51
49
  top: 0,
@@ -65,19 +63,6 @@ const Sidebar = (props: SidebarProps) => {
65
63
  <DetailView {...props} activeSchema={getLastActiveSchema()} />
66
64
  )}
67
65
  </div>
68
- <div
69
- style={{
70
- position: 'absolute',
71
- bottom: '1.5rem',
72
- marginTop: '1rem',
73
- left: '50%',
74
- transform: 'translateX(-50%)',
75
- }}
76
- >
77
- <Button type="primary" style={{ fontWeight: 600 }} onClick={addSchema}>
78
- {i18n('addNewField')}
79
- </Button>
80
- </div>
81
66
  </div>
82
67
  </div>
83
68
  </div>