seat-editor 3.5.13 → 3.5.14

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 (57) hide show
  1. package/dist/app/new-board/page.js +1 -0
  2. package/dist/app/new-board/page.jsx +1 -0
  3. package/dist/components/form-tools/shape.d.ts +1 -0
  4. package/dist/components/form-tools/shape.js +13 -3
  5. package/dist/components/form-tools/shape.jsx +17 -2
  6. package/dist/components/icons/camera.d.ts +1 -0
  7. package/dist/components/icons/camera.js +5 -0
  8. package/dist/components/icons/camera.jsx +26 -0
  9. package/dist/components/icons/circle.d.ts +1 -0
  10. package/dist/components/icons/circle.js +5 -0
  11. package/dist/components/icons/circle.jsx +36 -0
  12. package/dist/components/icons/index.d.ts +9 -0
  13. package/dist/components/icons/index.js +9 -0
  14. package/dist/components/icons/square.d.ts +1 -0
  15. package/dist/components/icons/square.js +5 -0
  16. package/dist/components/icons/square.jsx +26 -0
  17. package/dist/components/icons/type-1.d.ts +1 -0
  18. package/dist/components/icons/type-1.js +5 -0
  19. package/dist/components/icons/type-1.jsx +148 -0
  20. package/dist/components/icons/type-2.d.ts +1 -0
  21. package/dist/components/icons/type-2.js +5 -0
  22. package/dist/components/icons/type-2.jsx +138 -0
  23. package/dist/components/icons/type-3.d.ts +1 -0
  24. package/dist/components/icons/type-3.js +5 -0
  25. package/dist/components/icons/type-3.jsx +138 -0
  26. package/dist/components/icons/type-4.d.ts +1 -0
  27. package/dist/components/icons/type-4.js +5 -0
  28. package/dist/components/icons/type-4.jsx +98 -0
  29. package/dist/components/icons/type-5.d.ts +1 -0
  30. package/dist/components/icons/type-5.js +5 -0
  31. package/dist/components/icons/type-5.jsx +108 -0
  32. package/dist/features/board-v3/index.js +3 -1
  33. package/dist/features/board-v3/index.jsx +5 -2
  34. package/dist/features/package/index.js +1 -1
  35. package/dist/features/package/index.jsx +2 -2
  36. package/dist/features/panel/index.js +3 -1
  37. package/dist/features/panel/index.jsx +3 -1
  38. package/dist/features/panel/polygon.js +1 -1
  39. package/dist/features/panel/polygon.jsx +1 -1
  40. package/dist/features/panel/select-tool.js +1 -1
  41. package/dist/features/panel/select-tool.jsx +1 -1
  42. package/dist/features/panel/selected-group.d.ts +3 -1
  43. package/dist/features/panel/selected-group.js +9 -8
  44. package/dist/features/panel/selected-group.jsx +15 -8
  45. package/dist/features/panel/upload-group-tool.d.ts +10 -0
  46. package/dist/features/panel/upload-group-tool.js +147 -0
  47. package/dist/features/panel/upload-group-tool.jsx +180 -0
  48. package/dist/features/panel/upload-tool.d.ts +2 -2
  49. package/dist/features/panel/upload-tool.js +45 -4
  50. package/dist/features/panel/upload-tool.jsx +108 -10
  51. package/dist/features/side-tool/index.js +13 -11
  52. package/dist/features/side-tool/index.jsx +7 -2
  53. package/dist/provider/antd-provider.js +3 -0
  54. package/dist/provider/antd-provider.jsx +3 -0
  55. package/dist/utils/agent.d.ts +1 -0
  56. package/dist/utils/agent.js +8 -0
  57. package/package.json +1 -1
@@ -9,10 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  import { useState, useEffect } from "react";
12
- import { Upload, Image, Button, Form, Flex } from "antd";
12
+ import { Upload, Image as ImageAntd, Button, Form, Flex, Select, InputNumber, ColorPicker, } from "antd";
13
13
  import { InboxOutlined, LoadingOutlined } from "@ant-design/icons";
14
14
  import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
15
- import SectionShape from "../../components/form-tools/shape";
15
+ import { MIN_HEIGHT, MIN_WIDTH, MIN_X, MIN_Y } from "../board-v3/constant";
16
+ import { optionsShape } from "@/components/form-tools/shape";
16
17
  const { Dragger } = Upload;
17
18
  const UploadTool = ({ name, type, action, defaultValue, transform, }) => {
18
19
  // const src = Form.useWatch("src");
@@ -162,13 +163,13 @@ const UploadTool = ({ name, type, action, defaultValue, transform, }) => {
162
163
  return (<Form.Item label="" name="src" className="w-full">
163
164
  {defaultSrc ? (<>
164
165
  <div className="w-full flex flex-col items-center gap-2 max-h-[200px] overflow-y-auto">
165
- <Image src={defaultSrc}/>
166
+ <ImageAntd src={defaultSrc}/>
166
167
  </div>
167
168
  <Flex vertical gap={5}>
168
- <Button type="primary" onClick={handleDelete} className="w-full mt-4" loading={loading}>
169
+ <Button type="default" onClick={handleDelete} className="w-full mt-4" loading={loading}>
169
170
  Edit
170
171
  </Button>
171
- <Button type="default" onClick={deleteImages} className="w-full" loading={loading}>
172
+ <Button type="primary" onClick={deleteImages} className="w-full" loading={loading}>
172
173
  Delete
173
174
  </Button>
174
175
  </Flex>
@@ -188,10 +189,107 @@ const UploadTool = ({ name, type, action, defaultValue, transform, }) => {
188
189
  </p>
189
190
  </>)}
190
191
  </Dragger>)}
191
- {(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id) && (<>
192
- <SectionShape allowChangeShape={type === "component"}/>
193
- {/* <SectionLabel /> */}
194
- </>)}
195
192
  </Form.Item>);
196
193
  };
197
- export default UploadTool;
194
+ const { Option } = Select;
195
+ const UploadToolForm = (props) => {
196
+ const shape = Form.useWatch("shape");
197
+ const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
198
+ const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
199
+ const maxSeat = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey]) || 0;
200
+ return (<div className="py-2">
201
+ <h1 className="heading-s">Shape</h1>
202
+ <Flex gap={2} className="w-full">
203
+ <Form.Item label="Name" name="shape" className="w-full">
204
+ <Select className="w-full">
205
+ {optionsShape === null || optionsShape === void 0 ? void 0 : optionsShape.map((item) => {
206
+ const disabled = item.value === "table-seat-rect-circle" && maxSeat > 4;
207
+ return (<Option key={item.value} value={item.value} disabled={disabled} className="flex w-full items-center">
208
+ <Flex gap={5} align="center" justify="between">
209
+ {item.icon}
210
+ <span>
211
+ {item.value === "table-seat-rect-circle"
212
+ ? `Type 5 (only for 4 ${seatKey})`
213
+ : item.label}
214
+ </span>
215
+ </Flex>
216
+ </Option>);
217
+ })}
218
+ </Select>
219
+ </Form.Item>
220
+ </Flex>
221
+ <UploadTool {...props}/>
222
+ <Flex gap={2} className="w-full">
223
+ <Form.Item label="Width" name="width" className="w-full">
224
+ <InputNumber suffix="px" controls name="width" min={MIN_WIDTH} step={1} parser={(value) => {
225
+ var _a;
226
+ const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
227
+ return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
228
+ }}/>
229
+ </Form.Item>
230
+ <Form.Item label="Height" name="height" className="w-full">
231
+ <InputNumber suffix="px" controls step={1} name="height" min={MIN_HEIGHT} parser={(value) => {
232
+ var _a;
233
+ const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
234
+ return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
235
+ }}/>
236
+ </Form.Item>
237
+ {!(shape === null || shape === void 0 ? void 0 : shape.includes("circle")) && (<Form.Item label="Radius" name="radius" className="w-full">
238
+ <InputNumber suffix="px" name="radius" parser={(value) => {
239
+ var _a;
240
+ const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
241
+ return onlyNumber === "" ? 1 : Math.max(1, Number(onlyNumber));
242
+ }}/>
243
+ </Form.Item>)}
244
+ </Flex>
245
+ <Flex gap={2}>
246
+ <Form.Item label="Position X" name="x" className="w-full">
247
+ <InputNumber name="x" step={1} min={MIN_X}/>
248
+ </Form.Item>
249
+ <Form.Item label="Position Y" name="y" className="w-full">
250
+ <InputNumber name="y" step={1} min={MIN_Y}/>
251
+ </Form.Item>
252
+ <Form.Item label="Rotation" name="rotation" className="w-full">
253
+ <InputNumber suffix="°" min={0} step={1} max={360} name="rotation" parser={(value) => {
254
+ if (!value)
255
+ return 0;
256
+ const num = Number(value.replace(/\D/g, ""));
257
+ if (Number.isNaN(num))
258
+ return 0;
259
+ return Math.min(360, Math.max(0, num));
260
+ }}/>
261
+ </Form.Item>
262
+ </Flex>
263
+ <Flex gap={2}>
264
+ {/* <Form.Item
265
+ label="Fill"
266
+ name={"fill"}
267
+ getValueFromEvent={(color) => color.toHexString()}
268
+ className="w-full "
269
+ disabled
270
+ >
271
+ <ColorPicker allowClear format="hex" defaultFormat="hex" />
272
+ </Form.Item> */}
273
+ <Form.Item label="Stroke Fill" name={"stroke"} getValueFromEvent={(color) => color.toHexString()} className="w-full ">
274
+ <ColorPicker allowClear format="hex" defaultFormat="hex"/>
275
+ </Form.Item>
276
+ <Form.Item label="Stroke Size" name={"strokeWidth"} className="w-full">
277
+ <InputNumber />
278
+ </Form.Item>
279
+ </Flex>
280
+ <Flex>
281
+ <Form.Item label="opacity" name={"opacity"} className="w-full">
282
+ <InputNumber step={10} max={100} min={0} name="opacity" parser={(value) => {
283
+ if (value === undefined || value === null || value === "")
284
+ return null;
285
+ const cleaned = value.replace(/[^0-9.]/g, "");
286
+ const num = Number(cleaned);
287
+ if (Number.isNaN(num))
288
+ return null;
289
+ return Math.min(100, Math.max(0, num));
290
+ }} suffix="%"/>
291
+ </Form.Item>
292
+ </Flex>
293
+ </div>);
294
+ };
295
+ export default UploadToolForm;
@@ -347,17 +347,19 @@ const SideTool = ({ dragOnly, deleteAutorized, }) => {
347
347
  content: _jsx("div", { children: "Fill Tool" }),
348
348
  trigger: "hover",
349
349
  placement: "right",
350
- } }) }), _jsx(Popover, { trigger: "click", placement: "right", open: openPreview, onOpenChange: setOpenPreview, content: _jsxs(Flex, { vertical: true, children: [_jsx(Button, { icon: _jsx(Scan, {}), type: "text", name: "Bounding Box", onClick: () => hanldeSelectTool("bounding-box"), style: active === "bounding-box" ? { color: "red" } : {} }), _jsx(Button, { icon: preview ? _jsx(EyeOff, {}) : _jsx(Eye, {}), type: "text", name: "Preview", onClick: handleOpenModalPreview, style: active === "preview" ? { color: "red" } : {} })] }), children: _jsx(ButtonTools, { buttonProps: {
351
- icon: _jsx(ScanEye, {}),
352
- type: "text",
353
- name: "Preview",
354
- onClick: () => setOpenPreview((prev) => !prev),
355
- style: (active === "bounding-box") || (active === "preview") ? { color: "red" } : {},
356
- }, items: [], popoverProps: {
357
- content: _jsx("div", { children: "Layour View Tool" }),
358
- trigger: "hover",
359
- placement: "right",
360
- } }) }), _jsx(ButtonTools, { buttonProps: {
350
+ } }) }), _jsx(Popover, { trigger: "click", placement: "right", open: openPreview, onOpenChange: setOpenPreview, content: _jsxs(Flex, { vertical: true, children: [_jsx(Button, { icon: _jsx(Scan, {}), type: "text", name: "Bounding Box", onClick: () => hanldeSelectTool("bounding-box"), style: active === "bounding-box" ? { color: "red" } : {} }), _jsx(Button, { icon: preview ? _jsx(EyeOff, {}) : _jsx(Eye, {}), type: "text", name: "Preview", onClick: handleOpenModalPreview, style: active === "preview" ? { color: "red" } : {} })] }), children: _jsxs(Flex, { className: "relative", children: [_jsx(ButtonTools, { buttonProps: {
351
+ icon: _jsx(ScanEye, {}),
352
+ type: "text",
353
+ name: "Preview",
354
+ onClick: () => setOpenPreview((prev) => !prev),
355
+ style: active === "bounding-box" || active === "preview"
356
+ ? { color: "red" }
357
+ : {},
358
+ }, items: [], popoverProps: {
359
+ content: _jsx("div", { children: "Layour View Tool" }),
360
+ trigger: "hover",
361
+ placement: "right",
362
+ } }), _jsx("span", { className: "absolute right-[-5px] top-[2px]", children: ">" })] }) }), _jsx(ButtonTools, { buttonProps: {
361
363
  icon: _jsx(Grid, {}),
362
364
  onClick: () => toggleGrid(),
363
365
  type: "text",
@@ -368,17 +368,22 @@ const SideTool = ({ dragOnly, deleteAutorized, }) => {
368
368
  <Button icon={<Scan />} type="text" name="Bounding Box" onClick={() => hanldeSelectTool("bounding-box")} style={active === "bounding-box" ? { color: "red" } : {}}/>
369
369
  <Button icon={preview ? <EyeOff /> : <Eye />} type="text" name="Preview" onClick={handleOpenModalPreview} style={active === "preview" ? { color: "red" } : {}}/>
370
370
  </Flex>}>
371
- <ButtonTools buttonProps={{
371
+ <Flex className="relative">
372
+ <ButtonTools buttonProps={{
372
373
  icon: <ScanEye />,
373
374
  type: "text",
374
375
  name: "Preview",
375
376
  onClick: () => setOpenPreview((prev) => !prev),
376
- style: (active === "bounding-box") || (active === "preview") ? { color: "red" } : {},
377
+ style: active === "bounding-box" || active === "preview"
378
+ ? { color: "red" }
379
+ : {},
377
380
  }} items={[]} popoverProps={{
378
381
  content: <div>Layour View Tool</div>,
379
382
  trigger: "hover",
380
383
  placement: "right",
381
384
  }}/>
385
+ <span className="absolute right-[-5px] top-[2px]">{">"}</span>
386
+ </Flex>
382
387
  </Popover>
383
388
 
384
389
  <ButtonTools buttonProps={{
@@ -37,6 +37,9 @@ export const AntdProvider = ({ children, themeColor }) => {
37
37
  },
38
38
  Button: {
39
39
  colorPrimary: themeColor
40
+ },
41
+ Select: {
42
+ optionHeight: 40,
40
43
  }
41
44
  },
42
45
  }, children: children }) }));
@@ -37,6 +37,9 @@ export const AntdProvider = ({ children, themeColor }) => {
37
37
  },
38
38
  Button: {
39
39
  colorPrimary: themeColor
40
+ },
41
+ Select: {
42
+ optionHeight: 40,
40
43
  }
41
44
  },
42
45
  }}>
@@ -0,0 +1 @@
1
+ export declare const getOS: () => "mac" | "windows";
@@ -0,0 +1,8 @@
1
+ export const getOS = () => {
2
+ const ua = navigator.userAgent.toLowerCase();
3
+ if (ua.includes("mac"))
4
+ return "mac";
5
+ if (ua.includes("win"))
6
+ return "windows";
7
+ return "windows";
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.5.13",
3
+ "version": "3.5.14",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",