seat-editor 1.6.21 → 1.6.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/app/constant.d.ts +43 -0
  2. package/dist/app/constant.js +2747 -0
  3. package/dist/app/layout.d.ts +1 -1
  4. package/dist/app/{layout.js → layout.jsx} +7 -2
  5. package/dist/app/new-board/page.d.ts +1 -1
  6. package/dist/app/new-board/page.jsx +2 -2
  7. package/dist/app/old-board/page.d.ts +2 -1
  8. package/dist/app/old-board/{page.js → page.jsx} +215 -82
  9. package/dist/app/only-view/page.d.ts +1 -1
  10. package/dist/app/only-view/{page.js → page.jsx} +1 -2
  11. package/dist/app/page.d.ts +1 -1
  12. package/dist/app/page.jsx +13 -0
  13. package/dist/app/test/page.d.ts +2 -1
  14. package/dist/app/test/{page.js → page.jsx} +5 -3
  15. package/dist/app/v2/page.d.ts +1 -1
  16. package/dist/app/v2/page.jsx +13 -0
  17. package/dist/components/button-tools/index.d.ts +1 -1
  18. package/dist/components/button-tools/index.jsx +17 -0
  19. package/dist/components/form-tools/label.d.ts +1 -1
  20. package/dist/components/form-tools/label.jsx +44 -0
  21. package/dist/components/form-tools/shape.d.ts +1 -1
  22. package/dist/components/form-tools/shape.jsx +66 -0
  23. package/dist/components/input/number-indicator.d.ts +1 -1
  24. package/dist/components/input/{number-indicator.js → number-indicator.jsx} +11 -2
  25. package/dist/components/joystick/index.d.ts +2 -1
  26. package/dist/components/joystick/{index.js → index.jsx} +14 -13
  27. package/dist/components/layer/index.d.ts +1 -1
  28. package/dist/components/layer/index.jsx +383 -0
  29. package/dist/components/layer-v2/index.d.ts +1 -1
  30. package/dist/components/layer-v2/index.jsx +370 -0
  31. package/dist/components/lib/index.d.ts +1 -1
  32. package/dist/components/lib/{index.js → index.jsx} +7 -2
  33. package/dist/components/modal-preview/index.d.ts +1 -1
  34. package/dist/components/modal-preview/index.jsx +11 -0
  35. package/dist/features/board/index.d.ts +1 -1
  36. package/dist/features/board/{index.js → index.jsx} +90 -31
  37. package/dist/features/board-v2/index.d.ts +2 -1
  38. package/dist/features/board-v2/{index.js → index.jsx} +98 -39
  39. package/dist/features/navbar/index.d.ts +1 -1
  40. package/dist/features/navbar/index.jsx +5 -0
  41. package/dist/features/package/index.d.ts +1 -1
  42. package/dist/features/package/{index.js → index.jsx} +16 -6
  43. package/dist/features/panel/index.d.ts +1 -1
  44. package/dist/features/panel/{index.js → index.jsx} +16 -8
  45. package/dist/features/panel/select-tool.d.ts +1 -1
  46. package/dist/features/panel/{select-tool.js → select-tool.jsx} +20 -8
  47. package/dist/features/panel/square-circle-tool.d.ts +1 -1
  48. package/dist/features/panel/{square-circle-tool.js → square-circle-tool.jsx} +4 -2
  49. package/dist/features/panel/table-seat-circle.d.ts +1 -1
  50. package/dist/features/panel/table-seat-circle.jsx +31 -0
  51. package/dist/features/panel/text-tool.d.ts +1 -1
  52. package/dist/features/panel/text-tool.jsx +26 -0
  53. package/dist/features/panel/upload-tool.d.ts +1 -1
  54. package/dist/features/panel/{upload-tool.js → upload-tool.jsx} +24 -2
  55. package/dist/features/side-tool/index.d.ts +1 -1
  56. package/dist/features/side-tool/{index.js → index.jsx} +90 -71
  57. package/dist/features/view/index.d.ts +1 -1
  58. package/dist/features/view-only/index.d.ts +1 -1
  59. package/dist/features/view-only/{index.js → index.jsx} +44 -35
  60. package/dist/provider/antd-provider.jsx +46 -0
  61. package/dist/provider/redux-provider.d.ts +1 -1
  62. package/dist/provider/{redux-provider.js → redux-provider.jsx} +1 -2
  63. package/dist/provider/store-provider.d.ts +1 -1
  64. package/dist/provider/{store-provider.js → store-provider.jsx} +3 -2
  65. package/package.json +1 -1
  66. package/dist/app/new-board/page.js +0 -34
  67. package/dist/app/page.js +0 -8
  68. package/dist/app/v2/page.js +0 -8
  69. package/dist/components/button-tools/index.js +0 -11
  70. package/dist/components/form-tools/label.js +0 -7
  71. package/dist/components/form-tools/shape.js +0 -25
  72. package/dist/components/layer/index.js +0 -295
  73. package/dist/components/layer-v2/index.js +0 -282
  74. package/dist/components/modal-preview/index.js +0 -10
  75. package/dist/features/navbar/index.js +0 -6
  76. package/dist/features/panel/table-seat-circle.js +0 -9
  77. package/dist/features/panel/text-tool.js +0 -7
  78. package/dist/features/view/index.js +0 -221
  79. package/dist/provider/antd-provider.js +0 -43
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
2
  import { Circle, CopyPlus, Eye, EyeOff, Image, Layers2, MousePointer, PaintBucket, Ratio, SquareMousePointer, Trash, Type, Upload, Hand, Layers, Ruler, Grid, MousePointer2, } from "lucide-react";
4
3
  import ButtonTools from "../../components/button-tools";
5
4
  import { Divider, ColorPicker, Button, message, } from "antd";
@@ -16,22 +15,22 @@ const SideTool = ({ dragOnly, deleteAutorized, }) => {
16
15
  {
17
16
  id: "select",
18
17
  name: "Select Tool",
19
- icon: _jsx(MousePointer, {}),
18
+ icon: <MousePointer />,
20
19
  },
21
20
  {
22
21
  id: "grab",
23
22
  name: "Grab Tool",
24
- icon: _jsx(Hand, {}),
23
+ icon: <Hand />,
25
24
  },
26
25
  {
27
26
  id: "ruler",
28
27
  name: "Ruler",
29
- icon: _jsx(Ruler, {}),
28
+ icon: <Ruler />,
30
29
  },
31
30
  {
32
31
  id: "node",
33
32
  name: "Node Tool",
34
- icon: _jsx(MousePointer2, {}),
33
+ icon: <MousePointer2 />,
35
34
  },
36
35
  ];
37
36
  const actionsTools = [
@@ -43,22 +42,22 @@ const SideTool = ({ dragOnly, deleteAutorized, }) => {
43
42
  {
44
43
  id: "square",
45
44
  name: "Square",
46
- icon: _jsx(SquareMousePointer, {}),
45
+ icon: <SquareMousePointer />,
47
46
  },
48
47
  {
49
48
  id: "circle",
50
49
  name: "Circle",
51
- icon: _jsx(Circle, {}),
50
+ icon: <Circle />,
52
51
  },
53
52
  {
54
53
  id: "table-seat-circle",
55
54
  name: "Table Seat Circle",
56
- icon: _jsx(Ratio, {}),
55
+ icon: <Ratio />,
57
56
  },
58
57
  {
59
58
  id: "image-table",
60
59
  name: "Image Table",
61
- icon: _jsx(Upload, {}),
60
+ icon: <Upload />,
62
61
  },
63
62
  // {
64
63
  // id: "table-seat-square",
@@ -75,12 +74,12 @@ const SideTool = ({ dragOnly, deleteAutorized, }) => {
75
74
  {
76
75
  id: "background",
77
76
  name: "Background",
78
- icon: _jsx(Image, {}),
77
+ icon: <Image />,
79
78
  },
80
79
  {
81
80
  id: "text",
82
81
  name: "Text",
83
- icon: _jsx(Type, {}),
82
+ icon: <Type />,
84
83
  },
85
84
  // {
86
85
  // id: "background-color",
@@ -234,72 +233,92 @@ const SideTool = ({ dragOnly, deleteAutorized, }) => {
234
233
  });
235
234
  dispatch({ type: "board/setFlagChange", payload: true });
236
235
  };
237
- return (_jsxs("div", { className: "h-full left-0 flex flex-col items-center border-r-2 border-gray-300 bg-white px-2 pt-4", children: [tools === null || tools === void 0 ? void 0 : tools.map((tool) => (_jsx(ButtonTools, { buttonProps: {
236
+ return (<div className="h-full left-0 flex flex-col items-center border-r-2 border-gray-300 bg-white px-2 pt-4">
237
+ {tools === null || tools === void 0 ? void 0 : tools.map((tool) => (<ButtonTools key={tool.id} buttonProps={{
238
+ icon: tool.icon,
239
+ type: "text",
240
+ name: tool.name,
241
+ onClick: () => hanldeSelectTool(tool.id),
242
+ style: active === tool.id ? { color: "red" } : {},
243
+ }} popoverProps={{
244
+ content: <div>{tool.name}</div>,
245
+ trigger: "hover",
246
+ placement: "right",
247
+ }} items={[]}/>))}
248
+ {!dragOnly && (<>
249
+ <ButtonTools buttonProps={{
250
+ icon: <CopyPlus />,
251
+ type: "text",
252
+ name: "duplicate",
253
+ onClick: () => handleDuplicateComponent(),
254
+ }} items={[]} popoverProps={{
255
+ content: <div>Duplicate</div>,
256
+ trigger: "hover",
257
+ placement: "right",
258
+ }}/>
259
+
260
+ <ButtonTools buttonProps={{
261
+ onClick: () => handleOverride(),
262
+ icon: <Layers2 />,
263
+ type: "text",
264
+ name: "override",
265
+ }} items={[]} popoverProps={{
266
+ content: <div>Override Right</div>,
267
+ trigger: "hover",
268
+ placement: "right",
269
+ }}/>
270
+ <ButtonTools buttonProps={{
271
+ onClick: () => handleOverrideLeft(),
272
+ icon: <Layers />,
273
+ type: "text",
274
+ name: "override",
275
+ }} items={[]} popoverProps={{
276
+ content: <div>Override Left</div>,
277
+ trigger: "hover",
278
+ placement: "right",
279
+ }}/>
280
+
281
+ <Divider />
282
+ {actionsTools === null || actionsTools === void 0 ? void 0 : actionsTools.map((tool) => (<ButtonTools key={tool.id} buttonProps={{
238
283
  icon: tool.icon,
239
284
  type: "text",
240
285
  name: tool.name,
241
286
  onClick: () => hanldeSelectTool(tool.id),
242
287
  style: active === tool.id ? { color: "red" } : {},
243
- }, popoverProps: {
244
- content: _jsx("div", { children: tool.name }),
288
+ }} popoverProps={{
289
+ content: <div>{tool.name}</div>,
245
290
  trigger: "hover",
246
291
  placement: "right",
247
- }, items: [] }, tool.id))), !dragOnly && (_jsxs(_Fragment, { children: [_jsx(ButtonTools, { buttonProps: {
248
- icon: _jsx(CopyPlus, {}),
249
- type: "text",
250
- name: "duplicate",
251
- onClick: () => handleDuplicateComponent(),
252
- }, items: [], popoverProps: {
253
- content: _jsx("div", { children: "Duplicate" }),
254
- trigger: "hover",
255
- placement: "right",
256
- } }), _jsx(ButtonTools, { buttonProps: {
257
- onClick: () => handleOverride(),
258
- icon: _jsx(Layers2, {}),
259
- type: "text",
260
- name: "override",
261
- }, items: [], popoverProps: {
262
- content: _jsx("div", { children: "Override Right" }),
263
- trigger: "hover",
264
- placement: "right",
265
- } }), _jsx(ButtonTools, { buttonProps: {
266
- onClick: () => handleOverrideLeft(),
267
- icon: _jsx(Layers, {}),
268
- type: "text",
269
- name: "override",
270
- }, items: [], popoverProps: {
271
- content: _jsx("div", { children: "Override Left" }),
272
- trigger: "hover",
273
- placement: "right",
274
- } }), _jsx(Divider, {}), actionsTools === null || actionsTools === void 0 ? void 0 : actionsTools.map((tool) => (_jsx(ButtonTools, { buttonProps: {
275
- icon: tool.icon,
276
- type: "text",
277
- name: tool.name,
278
- onClick: () => hanldeSelectTool(tool.id),
279
- style: active === tool.id ? { color: "red" } : {},
280
- }, popoverProps: {
281
- content: _jsx("div", { children: tool.name }),
282
- trigger: "hover",
283
- placement: "right",
284
- }, items: [] }, tool.id))), _jsx(Divider, {})] })), controlTools === null || controlTools === void 0 ? void 0 : controlTools.map((tool) => (_jsx(ButtonTools, { buttonProps: {
285
- icon: tool.icon,
286
- type: "text",
287
- name: tool.name,
288
- onClick: () => hanldeSelectTool(tool.id),
289
- style: active === tool.id ? { color: "red" } : {},
290
- }, popoverProps: {
291
- content: _jsx("div", { children: tool.name }),
292
- trigger: "hover",
293
- placement: "right",
294
- }, items: [] }, tool.id))), _jsx(ColorPicker, { value: color, onChange: handleChangeColorBackground, children: _jsx(Button, { icon: _jsx(PaintBucket, {}), type: "text", name: "Background Color", onClick: () => hanldeSelectTool("background-color"), style: active === "background-color" ? { color: "red" } : {} }) }), _jsx(Button, { icon: preview ? _jsx(EyeOff, {}) : _jsx(Eye, {}), type: "text", name: "Preview", onClick: handleOpenModalPreview, style: active === "preview" ? { color: "red" } : {} }), _jsx(Button, { icon: _jsx(Grid, {}), type: "text", name: "Grid", onClick: () => toggleGrid() }), _jsx(ButtonTools, { buttonProps: {
295
- onClick: () => handleRemoveComponent(),
296
- icon: _jsx(Trash, {}),
297
- type: "text",
298
- name: "trash",
299
- }, items: [], popoverProps: {
300
- content: _jsx("div", { children: "Trash" }),
301
- trigger: "hover",
302
- placement: "right",
303
- } })] }));
292
+ }} items={[]}/>))}
293
+
294
+ <Divider />
295
+ </>)}
296
+ {controlTools === null || controlTools === void 0 ? void 0 : controlTools.map((tool) => (<ButtonTools key={tool.id} buttonProps={{
297
+ icon: tool.icon,
298
+ type: "text",
299
+ name: tool.name,
300
+ onClick: () => hanldeSelectTool(tool.id),
301
+ style: active === tool.id ? { color: "red" } : {},
302
+ }} popoverProps={{
303
+ content: <div>{tool.name}</div>,
304
+ trigger: "hover",
305
+ placement: "right",
306
+ }} items={[]}/>))}
307
+ <ColorPicker value={color} onChange={handleChangeColorBackground}>
308
+ <Button icon={<PaintBucket />} type="text" name="Background Color" onClick={() => hanldeSelectTool("background-color")} style={active === "background-color" ? { color: "red" } : {}}/>
309
+ </ColorPicker>
310
+ <Button icon={preview ? <EyeOff /> : <Eye />} type="text" name="Preview" onClick={handleOpenModalPreview} style={active === "preview" ? { color: "red" } : {}}/>
311
+ <Button icon={<Grid />} type="text" name="Grid" onClick={() => toggleGrid()}/>
312
+ <ButtonTools buttonProps={{
313
+ onClick: () => handleRemoveComponent(),
314
+ icon: <Trash />,
315
+ type: "text",
316
+ name: "trash",
317
+ }} items={[]} popoverProps={{
318
+ content: <div>Trash</div>,
319
+ trigger: "hover",
320
+ placement: "right",
321
+ }}/>
322
+ </div>);
304
323
  };
305
324
  export default SideTool;
@@ -15,5 +15,5 @@ export interface LayerViewProps {
15
15
  containerProps?: any;
16
16
  svgProps?: any;
17
17
  }
18
- declare const LayerView: (props: LayerViewProps) => import("react/jsx-runtime").JSX.Element;
18
+ declare const LayerView: (props: LayerViewProps) => import("react").JSX.Element;
19
19
  export default LayerView;
@@ -15,5 +15,5 @@ export interface LayerViewProps {
15
15
  containerProps?: any;
16
16
  svgProps?: any;
17
17
  }
18
- declare const LayerView: (props: LayerViewProps) => import("react/jsx-runtime").JSX.Element;
18
+ declare const LayerView: (props: LayerViewProps) => import("react").JSX.Element;
19
19
  export default LayerView;
@@ -1,6 +1,5 @@
1
1
  "use client";
2
2
  "use client";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
3
  import { useEffect, useMemo, useRef, useState } from "react";
5
4
  import { TransformWrapper, TransformComponent, } from "react-zoom-pan-pinch";
6
5
  import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
@@ -53,7 +52,7 @@ const LayerView = (props) => {
53
52
  setSelectedTable(find);
54
53
  };
55
54
  const boundingBox = useMemo(() => {
56
- var _a, _b, _c, _d, _e, _f;
55
+ var _a, _b, _c, _d, _e, _f, _g;
57
56
  if (!componentsEditor && (componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.length) === 0) {
58
57
  return { minX: 0, minY: 0, width: 500, height: 500 };
59
58
  }
@@ -103,19 +102,21 @@ const LayerView = (props) => {
103
102
  maxY = Math.max(maxY, values.y + values.height);
104
103
  }
105
104
  });
105
+ let backgroundHasOne = false;
106
106
  if ((extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.length) === 1 && ((_b = (_a = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _a === void 0 ? void 0 : _a.shape) === null || _b === void 0 ? void 0 : _b.includes("background"))) {
107
+ backgroundHasOne = true;
107
108
  minX = (_c = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _c === void 0 ? void 0 : _c.x;
108
109
  minY = (_d = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _d === void 0 ? void 0 : _d.y;
109
110
  maxX = (_e = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _e === void 0 ? void 0 : _e.width;
110
111
  maxY = (_f = extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor[0]) === null || _f === void 0 ? void 0 : _f.height;
111
112
  }
112
- if ((extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.length) < 1) {
113
+ if ((extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.length) < 1 && ["background", "text"].includes((_g = componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor[0]) === null || _g === void 0 ? void 0 : _g.shape)) {
113
114
  minX = minX - minX * 0.5;
114
115
  minY = minY - minY * 0.5;
115
116
  }
116
117
  return {
117
- minX,
118
- minY,
118
+ minX: backgroundHasOne ? minX : minX - minX * 0.5,
119
+ minY: backgroundHasOne ? minY : minY - minY * 0.5,
119
120
  width: maxX,
120
121
  height: maxY,
121
122
  };
@@ -159,39 +160,47 @@ const LayerView = (props) => {
159
160
  }
160
161
  };
161
162
  }, []);
162
- return (_jsx("div", Object.assign({ className: "relative w-full h-full flex-1", ref: containerRef, style: {
163
+ return (<div className="relative w-full h-full flex-1" ref={containerRef} style={{
163
164
  height: "100vh",
164
165
  overflow: "auto",
165
166
  WebkitOverflowScrolling: "touch",
166
167
  touchAction: "pan-y",
167
- } }, props.containerProps, { children: _jsx(TransformWrapper, Object.assign({ ref: transformRef }, props.transformProps, { disabled: fingerCount === 1 && scale === 1, disablePadding: true,
168
- // panning={{
169
- // disabled: false,
170
- // velocityDisabled: true,
171
- // }}
172
- // limitToBounds={false}
173
- // doubleClick={{ disabled: true }}
174
- // pinch={{ disabled: false }}
175
- // wheel={{ disabled: true }}
176
- // disabled={true}
177
- // disablePadding={true}
178
- centerZoomedOut: true, onTransformed: ({ state: { scale } }) => setScale(scale), minScale: 1, maxScale: 1000, initialScale: 1,
179
- // pinch={{ step: 1 }}
180
- smooth: true, children: _jsx(TransformComponent, { wrapperStyle: {
181
- width: "100%",
182
- height: "100%",
183
- overflow: "visible",
184
- }, contentStyle: {
185
- width: "100%",
186
- height: "100%",
187
- }, children: _jsx("svg", Object.assign({}, props.svgProps, { id: "workspace", ref: svgRef, width: "100%", height: "100%", viewBox: `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
188
- background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,
189
- display: "block",
190
- pointerEvents: "auto",
191
- // touchAction: "pan-y",
192
- }, children: _jsx(Layers, { mode: "view", components: [
193
- ...extraComponentsEditor,
194
- ...renderElements(componentsEditor, mappingKey, colorMatchKey),
195
- ], onClick: handleSelectComponent, selectedTable: selectedTable, selectedTableColor: selectedTableColor }) })) }) })) })));
168
+ }} {...props.containerProps}>
169
+ <TransformWrapper ref={transformRef} {...props.transformProps} disabled={fingerCount === 1 && scale === 1} disablePadding={true}
170
+ // panning={{
171
+ // disabled: false,
172
+ // velocityDisabled: true,
173
+ // }}
174
+ // limitToBounds={false}
175
+ // doubleClick={{ disabled: true }}
176
+ // pinch={{ disabled: false }}
177
+ // wheel={{ disabled: true }}
178
+ // disabled={true}
179
+ // disablePadding={true}
180
+ centerZoomedOut={true} onTransformed={({ state: { scale } }) => setScale(scale)} minScale={1} maxScale={1000} initialScale={1}
181
+ // pinch={{ step: 1 }}
182
+ smooth={true}>
183
+ <TransformComponent wrapperStyle={{
184
+ width: "100%",
185
+ height: "100%",
186
+ overflow: "visible",
187
+ }} contentStyle={{
188
+ width: "100%",
189
+ height: "100%",
190
+ }}>
191
+ <svg {...props.svgProps} id="workspace" ref={svgRef} width="100%" height="100%" viewBox={`${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`} className="h-full" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" style={{
192
+ background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,
193
+ display: "block",
194
+ pointerEvents: "auto",
195
+ // touchAction: "pan-y",
196
+ }}>
197
+ <Layers mode="view" components={[
198
+ ...extraComponentsEditor,
199
+ ...renderElements(componentsEditor, mappingKey, colorMatchKey),
200
+ ]} onClick={handleSelectComponent} selectedTable={selectedTable} selectedTableColor={selectedTableColor}/>
201
+ </svg>
202
+ </TransformComponent>
203
+ </TransformWrapper>
204
+ </div>);
196
205
  };
197
206
  export default LayerView;
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { useEffect } from "react";
3
+ import { ConfigProvider } from "antd";
4
+ import { AntdRegistry } from "@ant-design/nextjs-registry";
5
+ import { useAppSelector, useAppDispatch } from "../hooks/use-redux";
6
+ export const AntdProvider = ({ children, themeColor }) => {
7
+ const dispatch = useAppDispatch();
8
+ const theme = useAppSelector((state) => state.theme);
9
+ useEffect(() => {
10
+ if (themeColor !== theme.primaryColor) {
11
+ dispatch({
12
+ type: "theme/setPrimaryColor",
13
+ payload: themeColor
14
+ });
15
+ }
16
+ }, [themeColor]);
17
+ return (<AntdRegistry>
18
+ <ConfigProvider theme={{
19
+ token: {
20
+ colorPrimary: themeColor,
21
+ },
22
+ // token: {
23
+ // colorPrimary: theme.theme["--primary-color"],
24
+ // colorPrimaryBorderHover: theme.theme["--primary-color"],
25
+ // fontFamily: "var(--font-inter), sans-serif",
26
+ // colorError: theme.theme["--danger"],
27
+ // controlOutlineWidth: 4,
28
+ // controlOutline: theme.theme["--surface-color"],
29
+ // colorBgContainerDisabled: "var(--netral-03)",
30
+ // colorTextPlaceholder: "var(--netral-06)",
31
+ // },
32
+ components: {
33
+ Form: {
34
+ labelFontSize: 14,
35
+ fontWeightStrong: 500,
36
+ itemMarginBottom: 12,
37
+ },
38
+ Button: {
39
+ colorPrimary: themeColor
40
+ }
41
+ },
42
+ }}>
43
+ {children}
44
+ </ConfigProvider>
45
+ </AntdRegistry>);
46
+ };
@@ -1,3 +1,3 @@
1
1
  export declare const ReduxProvider: ({ children }: {
2
2
  children: React.ReactNode;
3
- }) => import("react/jsx-runtime").JSX.Element;
3
+ }) => import("react").JSX.Element;
@@ -1,7 +1,6 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { store } from "../libs/store";
4
3
  import { Provider } from "react-redux";
5
4
  export const ReduxProvider = ({ children }) => {
6
- return _jsx(Provider, { store: store, children: children });
5
+ return <Provider store={store}>{children}</Provider>;
7
6
  };
@@ -1,4 +1,4 @@
1
1
  export declare const StoreProvider: ({ children, themeColor, }: {
2
2
  children: React.ReactNode;
3
3
  themeColor?: string;
4
- }) => import("react/jsx-runtime").JSX.Element;
4
+ }) => import("react").JSX.Element;
@@ -1,9 +1,10 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { ReduxProvider } from "./redux-provider";
4
3
  import { AntdProvider } from "./antd-provider";
5
4
  import { injectSeatEditorCSS } from "../utils/injectCss";
6
5
  export const StoreProvider = ({ children, themeColor = "red", }) => {
7
6
  injectSeatEditorCSS();
8
- return (_jsx(ReduxProvider, { children: _jsx(AntdProvider, { themeColor: themeColor, children: children }) }));
7
+ return (<ReduxProvider>
8
+ <AntdProvider themeColor={themeColor}>{children}</AntdProvider>
9
+ </ReduxProvider>);
9
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "1.6.21",
3
+ "version": "1.6.22",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,34 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { useEffect, useState } from "react";
4
- import SeatEditor from "../../features/package";
5
- import { data2 } from "../constant";
6
- export default function NewBoard() {
7
- const [initialValue, setInitialValue] = useState([]);
8
- const [extraComponents, setExtraComponents] = useState([]);
9
- const [backgroundColor, setBackgroundColor] = useState("#ffffff");
10
- const [viewOnly, setViewOnly] = useState(true);
11
- useEffect(() => {
12
- setInitialValue(data2);
13
- setExtraComponents([
14
- {}
15
- ]);
16
- }, []);
17
- return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex flex-col relative justify-center", children: [_jsx("button", { className: "bg-blue-500 text-white px-4 py-2 rounded", onClick: () => setViewOnly(!viewOnly), children: viewOnly ? "Edit Mode" : "View Mode" }), _jsx("div", { className: "flex-1 h-full", children: _jsx(SeatEditor, { componentProps: initialValue, viewOnly: viewOnly, dragOnly: true, deleteAutorized: {
18
- component: true,
19
- extraComponent: true,
20
- }, mappingKey: "properties", onCurrentStateChange: (setState) => {
21
- var _a, _b, _c, _d;
22
- if (((_a = setState === null || setState === void 0 ? void 0 : setState.components) === null || _a === void 0 ? void 0 : _a.length) > 0) {
23
- setInitialValue((_b = setState === null || setState === void 0 ? void 0 : setState.components) !== null && _b !== void 0 ? _b : []);
24
- }
25
- if (setState === null || setState === void 0 ? void 0 : setState.backgroundColor) {
26
- setBackgroundColor(setState === null || setState === void 0 ? void 0 : setState.backgroundColor);
27
- }
28
- if (((_c = setState === null || setState === void 0 ? void 0 : setState.extraComponents) === null || _c === void 0 ? void 0 : _c.length) > 0) {
29
- setExtraComponents((_d = setState === null || setState === void 0 ? void 0 : setState.extraComponents) !== null && _d !== void 0 ? _d : []);
30
- }
31
- }, extraComponentProps: extraComponents, defaultBackground: backgroundColor,
32
- // dragOnly={true}
33
- statusKey: "status" }) })] }) }));
34
- }
package/dist/app/page.js DELETED
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import Board from "../features/board";
3
- import SideTool from "../features/side-tool";
4
- import ControlPanels from "../features/panel";
5
- const TableEditor = () => {
6
- return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex relative", children: [_jsx(SideTool, {}), _jsx(Board, {}), _jsx(ControlPanels, {})] }) }));
7
- };
8
- export default TableEditor;
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import Board from "../../features/board-v2";
3
- import SideTool from "../../features/side-tool";
4
- import ControlPanels from "../../features/panel";
5
- const TableEditor = () => {
6
- return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex relative", children: [_jsx(SideTool, {}), _jsx(Board, {}), _jsx(ControlPanels, {})] }) }));
7
- };
8
- export default TableEditor;
@@ -1,11 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Button, Popover } from "antd";
4
- const ButtonTools = (props) => {
5
- const { buttonProps, items, popoverProps } = props;
6
- if (items.length === 0) {
7
- return (_jsx(Popover, Object.assign({ trigger: "hover" }, popoverProps, { children: _jsx(Button, Object.assign({}, buttonProps)) })));
8
- }
9
- return (_jsx(Popover, { content: _jsxs("div", { children: [_jsx(Button, { children: "Button 1" }), _jsx(Button, { children: "Button 2" })] }), trigger: "click", children: _jsx(Button, Object.assign({}, buttonProps)) }));
10
- };
11
- export default ButtonTools;
@@ -1,7 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { Button, ColorPicker, Flex, Form, Input, InputNumber } from "antd";
4
- const SectionLabel = () => {
5
- return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Section Labeling" }), _jsx(Form.Item, { label: "Labels in square", name: "labels", children: _jsx(Form.List, { name: "labels", children: (fields, { add, remove }) => (_jsxs(_Fragment, { children: [fields.map((field) => (_jsxs("div", { children: [_jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { name: [field.name, "label"], label: "Text", children: _jsx(Input, {}) }), _jsx(Form.Item, { name: [field.name, "fontColor"], label: "Color", getValueFromEvent: (color) => color.toHexString(), children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { name: [field.name, "x"], label: "X", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "y"], label: "Y", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "fontSize"], label: "Size", children: _jsx(InputNumber, { suffix: "px" }) })] })] }, field.key))), _jsxs(Flex, { gap: 2, children: [_jsx(Button, { type: "primary", onClick: () => add(), className: "btn btn-primary", children: "Add" }), _jsx(Button, { type: "primary", onClick: () => remove(fields.length - 1), className: "btn btn-primary", children: "Remove" })] })] })) }) }), _jsx("div", { className: "divider-dashed" })] }));
6
- };
7
- export default SectionLabel;
@@ -1,25 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { ColorPicker, Flex, Form, InputNumber, Select } from "antd";
4
- const SectionShape = () => {
5
- const optionsShape = [
6
- {
7
- value: "circle",
8
- label: "Circle",
9
- },
10
- {
11
- value: "square",
12
- label: "Square",
13
- },
14
- {
15
- value: "table-seat-circle",
16
- label: "Table Seat Circle",
17
- },
18
- {
19
- label: "Image Table",
20
- value: "image-table",
21
- },
22
- ];
23
- return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Shape" }), _jsx(Flex, { gap: 2, className: "w-full", children: _jsx(Form.Item, { label: "Name", name: "shape", className: "w-full", children: _jsx(Select, { options: optionsShape, className: "w-full" }) }) }), _jsxs(Flex, { gap: 2, className: "w-full", children: [_jsx(Form.Item, { label: "Width", name: "width", className: "w-full", children: _jsx(InputNumber, { suffix: "px" }) }), _jsx(Form.Item, { label: "Height", name: "height", className: "w-full", children: _jsx(InputNumber, { suffix: "px" }) })] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { label: "Position X", name: "x", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { label: "Position Y", name: "y", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { label: "Rotation", name: "rotation", className: "w-full", children: _jsx(InputNumber, {}) })] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { label: "Fill", name: "fill", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) }), _jsx(Form.Item, { label: "Stroke", name: "stroke", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })] }), _jsxs(Flex, { children: [_jsx(Form.Item, { label: "Stroke Width", name: "strokeWidth", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { label: "opacity", name: "opacity", className: "w-full", children: _jsx(InputNumber, { step: 0.1, max: 1, min: 0 }) })] })] }));
24
- };
25
- export default SectionShape;