seat-editor 3.4.0 → 3.4.2

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.
@@ -2,6 +2,9 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useEffect, useState } from "react";
4
4
  import SeatEditor from "../../features/package";
5
+ // import { constantData, data2, data3, extraComponent } from "../constant";
6
+ // import LayerView from "@/features/view-only-2";
7
+ // import SeatEdit from "@/features/package";
5
8
  import { data4 } from "../constant";
6
9
  export default function NewBoard() {
7
10
  const [initialValue, setInitialValue] = useState([]);
@@ -1,6 +1,9 @@
1
1
  "use client";
2
2
  import { useEffect, useState } from "react";
3
3
  import SeatEditor from "../../features/package";
4
+ // import { constantData, data2, data3, extraComponent } from "../constant";
5
+ // import LayerView from "@/features/view-only-2";
6
+ // import SeatEdit from "@/features/package";
4
7
  import { data4 } from "../constant";
5
8
  export default function NewBoard() {
6
9
  const [initialValue, setInitialValue] = useState([]);
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useAppSelector } from "@/hooks/use-redux";
3
+ import { useAppSelector } from "../../hooks/use-redux";
4
4
  import { ColorPicker, Flex, Form, InputNumber, Select } from "antd";
5
5
  const { Option } = Select;
6
6
  export const optionsShape = [
@@ -89,6 +89,6 @@ const SectionShape = ({ allowChangeShape = true, }) => {
89
89
  if (Number.isNaN(num))
90
90
  return null;
91
91
  return Math.min(0, Math.max(0, num));
92
- } }) }) })] }));
92
+ }, suffix: "%" }) }) })] }));
93
93
  };
94
94
  export default SectionShape;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useAppSelector } from "@/hooks/use-redux";
2
+ import { useAppSelector } from "../../hooks/use-redux";
3
3
  import { ColorPicker, Flex, Form, InputNumber, Select } from "antd";
4
4
  const { Option } = Select;
5
5
  export const optionsShape = [
@@ -126,7 +126,7 @@ const SectionShape = ({ allowChangeShape = true, }) => {
126
126
  if (Number.isNaN(num))
127
127
  return null;
128
128
  return Math.min(0, Math.max(0, num));
129
- }}/>
129
+ }} suffix="%"/>
130
130
  </Form.Item>
131
131
  </Flex>
132
132
  </div>);
@@ -14,7 +14,7 @@ const SelectedGroup = () => {
14
14
  "table-seat-square",
15
15
  "table-seat-square",
16
16
  "table-seat-rect-square",
17
- "table-seat-half-square"
17
+ "table-seat-half-square",
18
18
  ].includes(shape);
19
19
  const allShapeSelected = selectedGroup.map((item) => item.shape);
20
20
  const shapeIncludeImage = ["background", "image-table", "polygon"].some((shape) => allShapeSelected.includes(shape));
@@ -23,13 +23,21 @@ const SelectedGroup = () => {
23
23
  "table-seat-square",
24
24
  "table-seat-square",
25
25
  "table-seat-rect-square",
26
- "table-seat-half-square"
27
- ].includes(shape) && _jsx(SeatSquare, {})] }), !sameShape && (_jsxs(_Fragment, { children: [_jsxs(Flex, { gap: 2, className: "w-full", children: [!shapeAllIncludePolygon && (_jsxs(_Fragment, { 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" }) })] })), (!(shape === null || shape === void 0 ? void 0 : shape.includes("circle")) && !shapeAllIncludePolygon) && (_jsx(Form.Item, { label: "Radius", name: "radius", className: "w-full", children: _jsx(InputNumber, { suffix: "px", parser: (value) => {
26
+ "table-seat-half-square",
27
+ ].includes(shape) && _jsx(SeatSquare, {})] }), !sameShape && (_jsxs(_Fragment, { children: [_jsxs(Flex, { gap: 2, className: "w-full", children: [!shapeAllIncludePolygon && (_jsxs(_Fragment, { 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" }) })] })), !(shape === null || shape === void 0 ? void 0 : shape.includes("circle")) && !shapeAllIncludePolygon && (_jsx(Form.Item, { label: "Radius", name: "radius", className: "w-full", children: _jsx(InputNumber, { suffix: "px", parser: (value) => {
28
28
  var _a;
29
29
  const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
30
30
  return onlyNumber === ""
31
31
  ? 1
32
32
  : Math.max(1, Number(onlyNumber));
33
- } }) }))] }), !shapeAllIncludePolygon && (_jsx(_Fragment, { children: _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, { max: 360, min: 0 }) })] }) })), _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 }) })] })] }))] })] }) }));
33
+ } }) }))] }), !shapeAllIncludePolygon && (_jsx(_Fragment, { children: _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, { max: 360, min: 0 }) })] }) })), _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: 10, max: 100, min: 0, parser: (value) => {
34
+ if (value === undefined || value === null || value === "")
35
+ return null;
36
+ const cleaned = value.replace(/[^0-9.]/g, "");
37
+ const num = Number(cleaned);
38
+ if (Number.isNaN(num))
39
+ return null;
40
+ return Math.min(0, Math.max(0, num));
41
+ }, suffix: "%" }) })] })] }))] })] }) }));
34
42
  };
35
43
  export default SelectedGroup;
@@ -13,7 +13,7 @@ const SelectedGroup = () => {
13
13
  "table-seat-square",
14
14
  "table-seat-square",
15
15
  "table-seat-rect-square",
16
- "table-seat-half-square"
16
+ "table-seat-half-square",
17
17
  ].includes(shape);
18
18
  const allShapeSelected = selectedGroup.map((item) => item.shape);
19
19
  const shapeIncludeImage = ["background", "image-table", "polygon"].some((shape) => allShapeSelected.includes(shape));
@@ -33,7 +33,7 @@ const SelectedGroup = () => {
33
33
  "table-seat-square",
34
34
  "table-seat-square",
35
35
  "table-seat-rect-square",
36
- "table-seat-half-square"
36
+ "table-seat-half-square",
37
37
  ].includes(shape) && <SeatSquare />}
38
38
  </Flex>
39
39
  {!sameShape && (<>
@@ -46,7 +46,7 @@ const SelectedGroup = () => {
46
46
  <InputNumber suffix="px"/>
47
47
  </Form.Item>
48
48
  </>)}
49
- {(!(shape === null || shape === void 0 ? void 0 : shape.includes("circle")) && !shapeAllIncludePolygon) && (<Form.Item label="Radius" name={"radius"} className="w-full">
49
+ {!(shape === null || shape === void 0 ? void 0 : shape.includes("circle")) && !shapeAllIncludePolygon && (<Form.Item label="Radius" name={"radius"} className="w-full">
50
50
  <InputNumber suffix="px" parser={(value) => {
51
51
  var _a;
52
52
  const onlyNumber = (_a = value === null || value === void 0 ? void 0 : value.replace(/\D/g, "")) !== null && _a !== void 0 ? _a : "";
@@ -82,7 +82,15 @@ const SelectedGroup = () => {
82
82
  <InputNumber />
83
83
  </Form.Item>
84
84
  <Form.Item label="opacity" name={"opacity"} className="w-full">
85
- <InputNumber step={0.1} max={1} min={0}/>
85
+ <InputNumber step={10} max={100} min={0} parser={(value) => {
86
+ if (value === undefined || value === null || value === "")
87
+ return null;
88
+ const cleaned = value.replace(/[^0-9.]/g, "");
89
+ const num = Number(cleaned);
90
+ if (Number.isNaN(num))
91
+ return null;
92
+ return Math.min(0, Math.max(0, num));
93
+ }} suffix="%"/>
86
94
  </Form.Item>
87
95
  </Flex>
88
96
  </>)}
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { ColorPicker, Flex, Form, Divider, InputNumber } from "antd";
4
4
  import SectionLabel from "../../components/form-tools/label";
5
5
  import SectionShape from "../../components/form-tools/shape";
6
+ // import { useAppSelector } from "@/hooks/use-redux";
6
7
  const SeatCircle = () => {
7
8
  return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx(SectionShape, {}), _jsx("h1", { className: "heading-s", children: "Section Seating" }), _jsx(Divider, { style: { margin: 4 } }), _jsxs(Flex, { children: [_jsx(Form.Item, { name: "seatCount", label: "Seat Count", className: "w-full", children: _jsx(InputNumber, { min: 0, disabled: true }) }), _jsx(Form.Item, { name: "openSpace", label: "Open Space", className: "w-full", children: _jsx(InputNumber, { max: 100, min: 0, step: 10, suffix: "%" }) })] }), _jsx(Flex, { gap: 2, children: _jsx(Form.Item, { label: "Seat Fill", name: "seatFill", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) }) }), _jsx(SectionLabel, {})] }) }));
8
9
  };
@@ -2,6 +2,7 @@
2
2
  import { ColorPicker, Flex, Form, Divider, InputNumber } from "antd";
3
3
  import SectionLabel from "../../components/form-tools/label";
4
4
  import SectionShape from "../../components/form-tools/shape";
5
+ // import { useAppSelector } from "@/hooks/use-redux";
5
6
  const SeatCircle = () => {
6
7
  return (<>
7
8
  <div className="py-2">
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { Col, ColorPicker, Divider, Flex, Form, InputNumber, Row, } from "antd";
4
4
  import SectionLabel from "../../components/form-tools/label";
5
5
  import SectionShape from "../../components/form-tools/shape";
6
- import { useAppSelector } from "@/hooks/use-redux";
6
+ import { useAppSelector } from "../../hooks/use-redux";
7
7
  const SeatSquare = () => {
8
8
  const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
9
9
  const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
@@ -2,7 +2,7 @@
2
2
  import { Col, ColorPicker, Divider, Flex, Form, InputNumber, Row, } from "antd";
3
3
  import SectionLabel from "../../components/form-tools/label";
4
4
  import SectionShape from "../../components/form-tools/shape";
5
- import { useAppSelector } from "@/hooks/use-redux";
5
+ import { useAppSelector } from "../../hooks/use-redux";
6
6
  const SeatSquare = () => {
7
7
  const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
8
8
  const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
@@ -1,4 +1,4 @@
1
- import { PropertiesProps } from "@/dto/table";
1
+ import { PropertiesProps } from "../../dto/table";
2
2
  import { SeatShape } from "../../utils/constant";
3
3
  export declare const isSeatShape: (shape: string) => shape is SeatShape;
4
4
  export declare const getSeatCount: (shape: string, props: PropertiesProps, defaultValue: number) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",