seat-editor 3.4.4 → 3.4.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.
@@ -25,6 +25,7 @@ import { applyResizeToSvgElement, getGlobalBBox, updateSelectionBox, } from "../
25
25
  import { SEAT_SHAPES } from "../../utils/constant";
26
26
  import { adjustHeightWidthForSeatShape, getSeatCount, getSeatPosition, isSeatShape, } from "./utils";
27
27
  import SeatSquare from "./table-seat-square";
28
+ import _ from "lodash";
28
29
  const ControlPanels = (props) => {
29
30
  const { action, transform } = props;
30
31
  const dispatch = useAppDispatch();
@@ -75,6 +76,12 @@ const ControlPanels = (props) => {
75
76
  ? Number(arr[0][key]) * 100
76
77
  : undefined;
77
78
  }
79
+ if (key === "labels") {
80
+ const test = arr === null || arr === void 0 ? void 0 : arr.every((item) => _.isEqual(item[key], arr[0][key]));
81
+ return (arr === null || arr === void 0 ? void 0 : arr.every((item) => _.isEqual(item[key], arr[0][key])))
82
+ ? arr[0][key]
83
+ : [];
84
+ }
78
85
  return isSameAllByKey(arr, key) ? arr[0][key] : undefined;
79
86
  }
80
87
  form.setFieldsValue({
@@ -90,6 +97,10 @@ const ControlPanels = (props) => {
90
97
  radius: getValueIfSame(selectedGroup, "radius"),
91
98
  shape: getValueIfSame(selectedGroup, "shape"),
92
99
  labels: getValueIfSame(selectedGroup, "labels"),
100
+ seatCount: getValueIfSame(selectedGroup, "seatCount"),
101
+ seatPositions: getValueIfSame(selectedGroup, "seatPositions"),
102
+ seatFill: getValueIfSame(selectedGroup, "seatFill"),
103
+ openSpace: getValueIfSame(selectedGroup, "openSpace"),
93
104
  });
94
105
  }
95
106
  else {
@@ -110,7 +121,9 @@ const ControlPanels = (props) => {
110
121
  const seatDefault = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey];
111
122
  return Object.assign(Object.assign(Object.assign({}, defaults), props), { shape: (_b = props.shape) !== null && _b !== void 0 ? _b : shape, height: (_c = adjustHeightWidthForSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape, props)) === null || _c === void 0 ? void 0 : _c.height, width: (_d = adjustHeightWidthForSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape, props)) === null || _d === void 0 ? void 0 : _d.width, fill: props.fill, seatCount: getSeatCount(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape, props, seatDefault), seatPositions: getSeatPosition(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape, props, seatDefault), openSpace: isSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape)
112
123
  ? (_e = props.openSpace) !== null && _e !== void 0 ? _e : 0
113
- : undefined, seatFill: isSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape) ? (_f = props.seatFill) !== null && _f !== void 0 ? _f : theme === null || theme === void 0 ? void 0 : theme.primaryColor : undefined, text: shape === "text" ? (_g = props.text) !== null && _g !== void 0 ? _g : defaults.text : undefined, fontColor: shape === "text" ? (_h = props.fontColor) !== null && _h !== void 0 ? _h : defaults.fontColor : undefined, radius: props.radius });
124
+ : undefined, seatFill: isSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape)
125
+ ? (_f = props.seatFill) !== null && _f !== void 0 ? _f : theme === null || theme === void 0 ? void 0 : theme.primaryColor
126
+ : undefined, text: shape === "text" ? (_g = props.text) !== null && _g !== void 0 ? _g : defaults.text : undefined, fontColor: shape === "text" ? (_h = props.fontColor) !== null && _h !== void 0 ? _h : defaults.fontColor : undefined, radius: props.radius });
114
127
  };
115
128
  const debouncedSyncComponents = useRef(debounce((data) => {
116
129
  dispatch({ type: "board/setFlagChange", payload: true });
@@ -179,7 +192,7 @@ const ControlPanels = (props) => {
179
192
  updateSelectionBox(svg, getBBox);
180
193
  };
181
194
  const handleChangeComponent = (values, allValues) => {
182
- var _a, _b;
195
+ var _a, _b, _c;
183
196
  const { shape } = allValues, restProps = __rest(allValues, ["shape"]);
184
197
  const newValues = createShape(shape, restProps, selectedComponent);
185
198
  if (selectedComponent) {
@@ -187,8 +200,19 @@ const ControlPanels = (props) => {
187
200
  debouncedSyncComponents.current(Object.assign(Object.assign(Object.assign({}, (selectedComponent || {})), newValues), { opacity: ((_a = newValues === null || newValues === void 0 ? void 0 : newValues.opacity) !== null && _a !== void 0 ? _a : 100) / 100, openSpace: ((_b = newValues === null || newValues === void 0 ? void 0 : newValues.openSpace) !== null && _b !== void 0 ? _b : 0) / 100 }));
188
201
  }
189
202
  if ((selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.length) > 0) {
190
- const { width, height, x, y, fill, stroke, opacity, rotation, strokeWidth, radius, shape, seatCount, seatFill, seatPositions, labels, } = newValues;
191
- const updatedGroup = selectedGroup.map((comp) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, comp), (width !== undefined ? { width } : {})), (height !== undefined ? { height } : {})), (x !== undefined ? { x } : {})), (y !== undefined ? { y } : {})), (fill !== undefined ? { fill } : {})), (stroke !== undefined ? { stroke } : {})), (opacity !== undefined ? { opacity: opacity / 100 } : {})), (rotation !== undefined ? { rotation } : {})), (strokeWidth !== undefined ? { strokeWidth } : {})), (radius !== undefined ? { radius } : {})), (shape !== undefined ? { shape } : {})), (seatCount !== undefined ? { seatCount } : {})), (seatFill !== undefined ? { seatFill } : {})), (seatPositions !== undefined ? { seatPositions } : {})), (labels !== undefined ? { labels } : {}))));
203
+ const { width, height, x, y, fill, stroke, opacity, rotation, strokeWidth, radius, shape, seatCount, seatFill, seatPositions, labels, openSpace, } = newValues;
204
+ const seatPositionsNew = (_c = Object.values(seatPositions)) === null || _c === void 0 ? void 0 : _c.some((item) => _.isNaN(item));
205
+ const updatedGroup = selectedGroup.map((comp) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, comp), (width !== undefined ? { width } : {})), (height !== undefined ? { height } : {})), (x !== undefined ? { x } : {})), (y !== undefined ? { y } : {})), (fill !== undefined ? { fill } : {})), (stroke !== undefined ? { stroke } : {})), (opacity !== undefined ? { opacity: Number(opacity) / 100 } : {})), (rotation !== undefined ? { rotation } : {})), (strokeWidth !== undefined ? { strokeWidth } : {})), (radius !== undefined ? { radius } : {})), (shape !== undefined ? { shape } : {})), (seatFill !== undefined ? { seatFill } : {})), (labels !== undefined ? { labels } : {})), (seatPositions !== undefined
206
+ ? {
207
+ seatPositions: seatPositionsNew
208
+ ? getSeatPosition(shape, comp, comp === null || comp === void 0 ? void 0 : comp[seatKey])
209
+ : seatPositions,
210
+ }
211
+ : {})), (seatCount !== undefined
212
+ ? {
213
+ seatCount: seatCount !== null && seatCount !== void 0 ? seatCount : getSeatCount(shape, comp, comp === null || comp === void 0 ? void 0 : comp[seatKey]),
214
+ }
215
+ : {})), (openSpace !== undefined ? { openSpace } : {}))));
192
216
  let minX = Infinity;
193
217
  let minY = Infinity;
194
218
  let maxX = -Infinity;
@@ -24,6 +24,7 @@ import { applyResizeToSvgElement, getGlobalBBox, updateSelectionBox, } from "../
24
24
  import { SEAT_SHAPES } from "../../utils/constant";
25
25
  import { adjustHeightWidthForSeatShape, getSeatCount, getSeatPosition, isSeatShape, } from "./utils";
26
26
  import SeatSquare from "./table-seat-square";
27
+ import _ from "lodash";
27
28
  const ControlPanels = (props) => {
28
29
  const { action, transform } = props;
29
30
  const dispatch = useAppDispatch();
@@ -74,6 +75,12 @@ const ControlPanels = (props) => {
74
75
  ? Number(arr[0][key]) * 100
75
76
  : undefined;
76
77
  }
78
+ if (key === "labels") {
79
+ const test = arr === null || arr === void 0 ? void 0 : arr.every((item) => _.isEqual(item[key], arr[0][key]));
80
+ return (arr === null || arr === void 0 ? void 0 : arr.every((item) => _.isEqual(item[key], arr[0][key])))
81
+ ? arr[0][key]
82
+ : [];
83
+ }
77
84
  return isSameAllByKey(arr, key) ? arr[0][key] : undefined;
78
85
  }
79
86
  form.setFieldsValue({
@@ -89,6 +96,10 @@ const ControlPanels = (props) => {
89
96
  radius: getValueIfSame(selectedGroup, "radius"),
90
97
  shape: getValueIfSame(selectedGroup, "shape"),
91
98
  labels: getValueIfSame(selectedGroup, "labels"),
99
+ seatCount: getValueIfSame(selectedGroup, "seatCount"),
100
+ seatPositions: getValueIfSame(selectedGroup, "seatPositions"),
101
+ seatFill: getValueIfSame(selectedGroup, "seatFill"),
102
+ openSpace: getValueIfSame(selectedGroup, "openSpace"),
92
103
  });
93
104
  }
94
105
  else {
@@ -109,7 +120,9 @@ const ControlPanels = (props) => {
109
120
  const seatDefault = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey];
110
121
  return Object.assign(Object.assign(Object.assign({}, defaults), props), { shape: (_b = props.shape) !== null && _b !== void 0 ? _b : shape, height: (_c = adjustHeightWidthForSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape, props)) === null || _c === void 0 ? void 0 : _c.height, width: (_d = adjustHeightWidthForSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape, props)) === null || _d === void 0 ? void 0 : _d.width, fill: props.fill, seatCount: getSeatCount(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape, props, seatDefault), seatPositions: getSeatPosition(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape, props, seatDefault), openSpace: isSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape)
111
122
  ? (_e = props.openSpace) !== null && _e !== void 0 ? _e : 0
112
- : undefined, seatFill: isSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape) ? (_f = props.seatFill) !== null && _f !== void 0 ? _f : theme === null || theme === void 0 ? void 0 : theme.primaryColor : undefined, text: shape === "text" ? (_g = props.text) !== null && _g !== void 0 ? _g : defaults.text : undefined, fontColor: shape === "text" ? (_h = props.fontColor) !== null && _h !== void 0 ? _h : defaults.fontColor : undefined, radius: props.radius });
123
+ : undefined, seatFill: isSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape)
124
+ ? (_f = props.seatFill) !== null && _f !== void 0 ? _f : theme === null || theme === void 0 ? void 0 : theme.primaryColor
125
+ : undefined, text: shape === "text" ? (_g = props.text) !== null && _g !== void 0 ? _g : defaults.text : undefined, fontColor: shape === "text" ? (_h = props.fontColor) !== null && _h !== void 0 ? _h : defaults.fontColor : undefined, radius: props.radius });
113
126
  };
114
127
  const debouncedSyncComponents = useRef(debounce((data) => {
115
128
  dispatch({ type: "board/setFlagChange", payload: true });
@@ -178,7 +191,7 @@ const ControlPanels = (props) => {
178
191
  updateSelectionBox(svg, getBBox);
179
192
  };
180
193
  const handleChangeComponent = (values, allValues) => {
181
- var _a, _b;
194
+ var _a, _b, _c;
182
195
  const { shape } = allValues, restProps = __rest(allValues, ["shape"]);
183
196
  const newValues = createShape(shape, restProps, selectedComponent);
184
197
  if (selectedComponent) {
@@ -186,8 +199,19 @@ const ControlPanels = (props) => {
186
199
  debouncedSyncComponents.current(Object.assign(Object.assign(Object.assign({}, (selectedComponent || {})), newValues), { opacity: ((_a = newValues === null || newValues === void 0 ? void 0 : newValues.opacity) !== null && _a !== void 0 ? _a : 100) / 100, openSpace: ((_b = newValues === null || newValues === void 0 ? void 0 : newValues.openSpace) !== null && _b !== void 0 ? _b : 0) / 100 }));
187
200
  }
188
201
  if ((selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.length) > 0) {
189
- const { width, height, x, y, fill, stroke, opacity, rotation, strokeWidth, radius, shape, seatCount, seatFill, seatPositions, labels, } = newValues;
190
- const updatedGroup = selectedGroup.map((comp) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, comp), (width !== undefined ? { width } : {})), (height !== undefined ? { height } : {})), (x !== undefined ? { x } : {})), (y !== undefined ? { y } : {})), (fill !== undefined ? { fill } : {})), (stroke !== undefined ? { stroke } : {})), (opacity !== undefined ? { opacity: opacity / 100 } : {})), (rotation !== undefined ? { rotation } : {})), (strokeWidth !== undefined ? { strokeWidth } : {})), (radius !== undefined ? { radius } : {})), (shape !== undefined ? { shape } : {})), (seatCount !== undefined ? { seatCount } : {})), (seatFill !== undefined ? { seatFill } : {})), (seatPositions !== undefined ? { seatPositions } : {})), (labels !== undefined ? { labels } : {}))));
202
+ const { width, height, x, y, fill, stroke, opacity, rotation, strokeWidth, radius, shape, seatCount, seatFill, seatPositions, labels, openSpace, } = newValues;
203
+ const seatPositionsNew = (_c = Object.values(seatPositions)) === null || _c === void 0 ? void 0 : _c.some((item) => _.isNaN(item));
204
+ const updatedGroup = selectedGroup.map((comp) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, comp), (width !== undefined ? { width } : {})), (height !== undefined ? { height } : {})), (x !== undefined ? { x } : {})), (y !== undefined ? { y } : {})), (fill !== undefined ? { fill } : {})), (stroke !== undefined ? { stroke } : {})), (opacity !== undefined ? { opacity: Number(opacity) / 100 } : {})), (rotation !== undefined ? { rotation } : {})), (strokeWidth !== undefined ? { strokeWidth } : {})), (radius !== undefined ? { radius } : {})), (shape !== undefined ? { shape } : {})), (seatFill !== undefined ? { seatFill } : {})), (labels !== undefined ? { labels } : {})), (seatPositions !== undefined
205
+ ? {
206
+ seatPositions: seatPositionsNew
207
+ ? getSeatPosition(shape, comp, comp === null || comp === void 0 ? void 0 : comp[seatKey])
208
+ : seatPositions,
209
+ }
210
+ : {})), (seatCount !== undefined
211
+ ? {
212
+ seatCount: seatCount !== null && seatCount !== void 0 ? seatCount : getSeatCount(shape, comp, comp === null || comp === void 0 ? void 0 : comp[seatKey]),
213
+ }
214
+ : {})), (openSpace !== undefined ? { openSpace } : {}))));
191
215
  let minX = Infinity;
192
216
  let minY = Infinity;
193
217
  let maxX = -Infinity;
@@ -5,9 +5,13 @@ import { ColorPicker, Flex, Form, InputNumber, Select } from "antd";
5
5
  import SeatCircle from "./table-seat-circle";
6
6
  import SeatSquare from "./table-seat-square";
7
7
  import { useAppSelector } from "../../hooks/use-redux";
8
+ import SectionLabel from "@/components/form-tools/label";
9
+ const { Option } = Select;
8
10
  const SelectedGroup = () => {
11
+ var _a;
9
12
  const shape = Form.useWatch("shape");
10
13
  const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
14
+ const allShapeSelected = selectedGroup.map((item) => item.shape);
11
15
  const sameShape = [
12
16
  "table-seat-circle",
13
17
  "table-seat-rect-circle",
@@ -16,10 +20,18 @@ const SelectedGroup = () => {
16
20
  "table-seat-rect-square",
17
21
  "table-seat-half-square",
18
22
  ].includes(shape);
19
- const allShapeSelected = selectedGroup.map((item) => item.shape);
20
23
  const shapeIncludeImage = ["background", "image-table", "polygon"].some((shape) => allShapeSelected.includes(shape));
24
+ const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
21
25
  const shapeAllIncludePolygon = allShapeSelected.includes("polygon");
22
- return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: " Group Selection" }), _jsxs("div", { className: "py-2", children: [!shapeIncludeImage && (_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: [["table-seat-circle", "table-seat-rect-circle"].includes(shape) && _jsx(SeatCircle, {}), [
26
+ const optionsSelect = (_a = optionsShape === null || optionsShape === void 0 ? void 0 : optionsShape.slice(0, -1)) === null || _a === void 0 ? void 0 : _a.map((item) => {
27
+ return Object.assign(Object.assign({}, item), { disabled: allShapeSelected.includes(item.value) });
28
+ });
29
+ const maxSeat = selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.some((item) => (item === null || item === void 0 ? void 0 : item[seatKey]) > 4);
30
+ return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: " Group Selection" }), _jsxs("div", { className: "py-2", children: [_jsx(Flex, { gap: 2, className: "w-full", children: _jsx(Form.Item, { label: "Name", name: "shape", className: "w-full", children: _jsx(Select, { className: "w-full", children: optionsSelect === null || optionsSelect === void 0 ? void 0 : optionsSelect.map((item) => {
31
+ const disabled = item.value === "table-seat-rect-circle" && maxSeat;
32
+ return (_jsx(Option, { value: item.value, disabled: disabled, children: item.value === "table-seat-rect-circle" ?
33
+ `Type 5 (only for 4 ${seatKey})` : item.label }, item.value));
34
+ }) }) }) }), _jsxs(Flex, { gap: 2, className: "w-full", children: [["table-seat-circle", "table-seat-rect-circle"].includes(shape) && _jsx(SeatCircle, {}), [
23
35
  "table-seat-square",
24
36
  "table-seat-square",
25
37
  "table-seat-rect-square",
@@ -37,7 +49,7 @@ const SelectedGroup = () => {
37
49
  const num = Number(cleaned);
38
50
  if (Number.isNaN(num))
39
51
  return null;
40
- return Math.min(0, Math.max(0, num));
41
- }, suffix: "%" }) })] })] }))] })] }) }));
52
+ return Math.min(100, Math.max(0, num));
53
+ }, suffix: "%" }) })] }), _jsx(SectionLabel, {})] }))] })] }) }));
42
54
  };
43
55
  export default SelectedGroup;
@@ -4,9 +4,13 @@ import { ColorPicker, Flex, Form, InputNumber, Select } from "antd";
4
4
  import SeatCircle from "./table-seat-circle";
5
5
  import SeatSquare from "./table-seat-square";
6
6
  import { useAppSelector } from "../../hooks/use-redux";
7
+ import SectionLabel from "@/components/form-tools/label";
8
+ const { Option } = Select;
7
9
  const SelectedGroup = () => {
10
+ var _a;
8
11
  const shape = Form.useWatch("shape");
9
12
  const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
13
+ const allShapeSelected = selectedGroup.map((item) => item.shape);
10
14
  const sameShape = [
11
15
  "table-seat-circle",
12
16
  "table-seat-rect-circle",
@@ -15,18 +19,32 @@ const SelectedGroup = () => {
15
19
  "table-seat-rect-square",
16
20
  "table-seat-half-square",
17
21
  ].includes(shape);
18
- const allShapeSelected = selectedGroup.map((item) => item.shape);
19
22
  const shapeIncludeImage = ["background", "image-table", "polygon"].some((shape) => allShapeSelected.includes(shape));
23
+ const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
20
24
  const shapeAllIncludePolygon = allShapeSelected.includes("polygon");
25
+ const optionsSelect = (_a = optionsShape === null || optionsShape === void 0 ? void 0 : optionsShape.slice(0, -1)) === null || _a === void 0 ? void 0 : _a.map((item) => {
26
+ return Object.assign(Object.assign({}, item), { disabled: allShapeSelected.includes(item.value) });
27
+ });
28
+ const maxSeat = selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.some((item) => (item === null || item === void 0 ? void 0 : item[seatKey]) > 4);
21
29
  return (<>
22
30
  <div className="py-2">
23
31
  <h1 className="heading-s"> Group Selection</h1>
24
32
  <div className="py-2">
25
- {!shapeIncludeImage && (<Flex gap={2} className="w-full">
26
- <Form.Item label="Name" name="shape" className="w-full">
27
- <Select options={optionsShape} className="w-full"/>
28
- </Form.Item>
29
- </Flex>)}
33
+ {/* {!shapeIncludeImage && ( */}
34
+ <Flex gap={2} className="w-full">
35
+ <Form.Item label="Name" name="shape" className="w-full">
36
+ <Select className="w-full">
37
+ {optionsSelect === null || optionsSelect === void 0 ? void 0 : optionsSelect.map((item) => {
38
+ const disabled = item.value === "table-seat-rect-circle" && maxSeat;
39
+ return (<Option key={item.value} value={item.value} disabled={disabled}>
40
+ {item.value === "table-seat-rect-circle" ?
41
+ `Type 5 (only for 4 ${seatKey})` : item.label}
42
+ </Option>);
43
+ })}
44
+ </Select>
45
+ </Form.Item>
46
+ </Flex>
47
+ {/* )} */}
30
48
  <Flex gap={2} className="w-full">
31
49
  {["table-seat-circle", "table-seat-rect-circle"].includes(shape) && <SeatCircle />}
32
50
  {[
@@ -89,10 +107,11 @@ const SelectedGroup = () => {
89
107
  const num = Number(cleaned);
90
108
  if (Number.isNaN(num))
91
109
  return null;
92
- return Math.min(0, Math.max(0, num));
110
+ return Math.min(100, Math.max(0, num));
93
111
  }} suffix="%"/>
94
112
  </Form.Item>
95
113
  </Flex>
114
+ <SectionLabel />
96
115
  </>)}
97
116
  </div>
98
117
  </div>
@@ -4,11 +4,14 @@ 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
6
  import { useAppSelector } from "../../hooks/use-redux";
7
+ import { isEmpty } from "lodash";
7
8
  const SeatCircle = () => {
8
9
  const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
9
10
  const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
10
11
  const seatCountDefault = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey];
11
12
  const disabled = seatCountDefault > 0;
12
- 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: disabled }) }), _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, {})] }) }));
13
+ const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
14
+ const allShapeSelected = selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.map((item) => item.shape);
15
+ return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx(SectionShape, { allowChangeShape: isEmpty(allShapeSelected) }), _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: disabled }) }), _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, {})] }) }));
13
16
  };
14
17
  export default SeatCircle;
@@ -3,14 +3,17 @@ 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
5
  import { useAppSelector } from "../../hooks/use-redux";
6
+ import { isEmpty } from "lodash";
6
7
  const SeatCircle = () => {
7
8
  const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
8
9
  const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
9
10
  const seatCountDefault = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey];
10
11
  const disabled = seatCountDefault > 0;
12
+ const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
13
+ const allShapeSelected = selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.map((item) => item.shape);
11
14
  return (<>
12
15
  <div className="py-2">
13
- <SectionShape />
16
+ <SectionShape allowChangeShape={isEmpty(allShapeSelected)}/>
14
17
  <h1 className="heading-s">Section Seating</h1>
15
18
  <Divider style={{ margin: 4 }}/>
16
19
  <Flex>
@@ -4,12 +4,18 @@ 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
6
  import { useAppSelector } from "../../hooks/use-redux";
7
+ import { isEmpty } from "lodash";
7
8
  const SeatSquare = () => {
8
9
  const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
10
+ const allGroups = useAppSelector((state) => state.panel.selectedGroup);
9
11
  const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
10
12
  const isSeatCustom = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "table-seat-rect-circle";
13
+ const allGroupCustom = allGroups === null || allGroups === void 0 ? void 0 : allGroups.some((g) => g.shape === "table-seat-rect-circle");
14
+ const allGroupCount = allGroups === null || allGroups === void 0 ? void 0 : allGroups.some((g) => (g === null || g === void 0 ? void 0 : g[seatKey]) > 0);
11
15
  const seatCountDefault = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey];
12
- const disabled = seatCountDefault > 0;
13
- 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 } }), _jsx(Flex, { className: "w-full", children: _jsx(Form.Item, { name: "openSpace", label: "Open Space", className: "w-full", children: _jsx(InputNumber, { max: 100, min: 0, step: 10, suffix: "%", disabled: isSeatCustom }) }) }), _jsxs(Row, { gutter: [16, 16], children: [_jsxs(Col, { span: 12, children: [_jsx(Form.Item, { name: ["seatPositions", "top"], label: "Top", className: "w-full", children: _jsx(InputNumber, { min: 0, step: 1, disabled: disabled }) }), _jsx(Form.Item, { name: ["seatPositions", "left"], label: "Left", className: "w-full", children: _jsx(InputNumber, { min: 0, step: 1, disabled: disabled }) })] }), _jsxs(Col, { span: 12, children: [_jsx(Form.Item, { name: ["seatPositions", "right"], label: "Right", className: "w-full", children: _jsx(InputNumber, { min: 0, step: 1, disabled: disabled }) }), _jsx(Form.Item, { name: ["seatPositions", "bottom"], label: "Bottom", className: "w-full", children: _jsx(InputNumber, { min: 0, step: 1, disabled: disabled }) })] })] }), _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, {})] }) }));
16
+ const disabled = seatCountDefault > 0 || allGroupCount;
17
+ const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
18
+ const allShapeSelected = selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.map((item) => item.shape);
19
+ return (_jsx(_Fragment, { children: _jsxs("div", { className: "py-2", children: [_jsx(SectionShape, { allowChangeShape: isEmpty(allShapeSelected) }), _jsx("h1", { className: "heading-s", children: "Section Seating" }), _jsx(Divider, { style: { margin: 4 } }), _jsx(Flex, { className: "w-full", children: _jsx(Form.Item, { name: "openSpace", label: "Open Space", className: "w-full", children: _jsx(InputNumber, { max: 100, min: 0, step: 10, suffix: "%", disabled: isSeatCustom || allGroupCustom }) }) }), _jsxs(Row, { gutter: [16, 16], children: [_jsxs(Col, { span: 12, children: [_jsx(Form.Item, { name: ["seatPositions", "top"], label: "Top", className: "w-full", children: _jsx(InputNumber, { min: 0, step: 1, disabled: disabled }) }), _jsx(Form.Item, { name: ["seatPositions", "left"], label: "Left", className: "w-full", children: _jsx(InputNumber, { min: 0, step: 1, disabled: disabled }) })] }), _jsxs(Col, { span: 12, children: [_jsx(Form.Item, { name: ["seatPositions", "right"], label: "Right", className: "w-full", children: _jsx(InputNumber, { min: 0, step: 1, disabled: disabled }) }), _jsx(Form.Item, { name: ["seatPositions", "bottom"], label: "Bottom", className: "w-full", children: _jsx(InputNumber, { min: 0, step: 1, disabled: disabled }) })] })] }), _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, {})] }) }));
14
20
  };
15
21
  export default SeatSquare;
@@ -3,20 +3,26 @@ 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
5
  import { useAppSelector } from "../../hooks/use-redux";
6
+ import { isEmpty } from "lodash";
6
7
  const SeatSquare = () => {
7
8
  const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
9
+ const allGroups = useAppSelector((state) => state.panel.selectedGroup);
8
10
  const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
9
11
  const isSeatCustom = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape) === "table-seat-rect-circle";
12
+ const allGroupCustom = allGroups === null || allGroups === void 0 ? void 0 : allGroups.some((g) => g.shape === "table-seat-rect-circle");
13
+ const allGroupCount = allGroups === null || allGroups === void 0 ? void 0 : allGroups.some((g) => (g === null || g === void 0 ? void 0 : g[seatKey]) > 0);
10
14
  const seatCountDefault = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey];
11
- const disabled = seatCountDefault > 0;
15
+ const disabled = seatCountDefault > 0 || allGroupCount;
16
+ const selectedGroup = useAppSelector((state) => state.panel.selectedGroup);
17
+ const allShapeSelected = selectedGroup === null || selectedGroup === void 0 ? void 0 : selectedGroup.map((item) => item.shape);
12
18
  return (<>
13
19
  <div className="py-2">
14
- <SectionShape />
20
+ <SectionShape allowChangeShape={isEmpty(allShapeSelected)}/>
15
21
  <h1 className="heading-s">Section Seating</h1>
16
22
  <Divider style={{ margin: 4 }}/>
17
23
  <Flex className="w-full">
18
24
  <Form.Item name="openSpace" label="Open Space" className="w-full">
19
- <InputNumber max={100} min={0} step={10} suffix="%" disabled={isSeatCustom}/>
25
+ <InputNumber max={100} min={0} step={10} suffix="%" disabled={isSeatCustom || allGroupCustom}/>
20
26
  </Form.Item>
21
27
  </Flex>
22
28
  <Row gutter={[16, 16]}>
@@ -2,14 +2,6 @@ import { SEAT_SHAPES } from "../../utils/constant";
2
2
  import { MIN_HEIGHT, MIN_WIDTH } from "../board-v3/constant";
3
3
  export const isSeatShape = (shape) => SEAT_SHAPES.includes(shape);
4
4
  export const getSeatCount = (shape, props, defaultValue) => {
5
- // if (shape === "table-seat-circle") {
6
- // if (props?.seatCount) {
7
- // return props.seatCount;
8
- // } else if (props?.seatPositions) {
9
- // const { top = 0, bottom = 0, left = 0, right = 0 } = props.seatPositions;
10
- // return top + bottom + left + right;
11
- // }
12
- // }
13
5
  if (!defaultValue) {
14
6
  if (props === null || props === void 0 ? void 0 : props.seatCount) {
15
7
  return props.seatCount;
@@ -22,15 +14,16 @@ export const getSeatCount = (shape, props, defaultValue) => {
22
14
  };
23
15
  export const getSeatPosition = (shape, props, defaultValue) => {
24
16
  let seatCountDefault = defaultValue;
17
+ // console.log({ seatCountDefault})
25
18
  if (shape === "table-seat-rect-circle") {
26
19
  if (seatCountDefault > 4) {
27
20
  seatCountDefault = 4;
28
21
  }
29
- console.log(props === null || props === void 0 ? void 0 : props.seatPositions);
22
+ // console.log(props?.seatPositions);
30
23
  if (getTotalSeats(props === null || props === void 0 ? void 0 : props.seatPositions) > 4) {
31
24
  return distributeSeats(4);
32
25
  }
33
- console.log(getTotalSeats(props === null || props === void 0 ? void 0 : props.seatPositions));
26
+ // console.log(distributeSeats(seatCountDefault),"haduh");
34
27
  return (props === null || props === void 0 ? void 0 : props.seatPositions) &&
35
28
  getTotalSeats(props === null || props === void 0 ? void 0 : props.seatPositions) <= seatCountDefault
36
29
  ? normalizeSeatPosition(props === null || props === void 0 ? void 0 : props.seatPositions)
@@ -39,6 +39,7 @@ export interface LayerViewProps<TMeta = undefined> {
39
39
  extraComponentProps?: ComponentProps[];
40
40
  onCurrentStateChange?: OnCurrentStateChange;
41
41
  onSelectComponent?: (component: ComponentProps<TMeta>) => void;
42
+ onDoubleClick?: (component: ComponentProps<TMeta>) => void;
42
43
  mappingKey?: string;
43
44
  tableMatchKey?: TableMatchKey[];
44
45
  eventMatchTable?: TableMatchEvent[];
@@ -84,11 +85,12 @@ export interface LayerViewProps<TMeta = undefined> {
84
85
  defaultBoundingBox?: PropertiesProps;
85
86
  viewOnly?: boolean;
86
87
  actionPrivileged?: {
87
- select: boolean;
88
- move: boolean;
89
- switch: boolean;
90
- drop: boolean;
91
- rightClick: boolean;
88
+ select?: boolean;
89
+ move?: boolean;
90
+ switch?: boolean;
91
+ drop?: boolean;
92
+ rightClick?: boolean;
93
+ double?: boolean;
92
94
  };
93
95
  }
94
96
  declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
@@ -7,13 +7,14 @@ import Layers from "../../components/layer-v4";
7
7
  import { getTranslate } from "../board-v3/utils";
8
8
  import { Spin } from "antd";
9
9
  const LayerView = (props) => {
10
- const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, loadingRender, actionPrivileged = {
10
+ const { componentProps, extraComponentProps, onSelectComponent, onDoubleClick, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, loadingRender, actionPrivileged = {
11
11
  select: true,
12
12
  move: true,
13
13
  switch: true,
14
14
  drop: true,
15
- rightClick: true
16
- } } = props;
15
+ rightClick: true,
16
+ double: true,
17
+ }, } = props;
17
18
  const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
18
19
  const tableGhost = useRef(null);
19
20
  const hoverUnderghostId = useRef(null);
@@ -131,6 +132,18 @@ const LayerView = (props) => {
131
132
  }
132
133
  return data;
133
134
  };
135
+ const handleDoubleClick = (items, e) => {
136
+ const find = componentsEditor.find((item) => {
137
+ var _a;
138
+ if (mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
139
+ return item[mappingKey].id == ((_a = items[mappingKey]) === null || _a === void 0 ? void 0 : _a.id);
140
+ }
141
+ return (item === null || item === void 0 ? void 0 : item.id) == (items === null || items === void 0 ? void 0 : items.id);
142
+ });
143
+ onDoubleClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.double) && onDoubleClick(find);
144
+ const seletedTable = mappingKey ? find[mappingKey] : find;
145
+ setSelectedTable(seletedTable);
146
+ };
134
147
  const handleSelectComponent = (items, e) => {
135
148
  const find = componentsEditor.find((item) => {
136
149
  var _a;
@@ -140,9 +153,14 @@ const LayerView = (props) => {
140
153
  return (item === null || item === void 0 ? void 0 : item.id) == (items === null || items === void 0 ? void 0 : items.id);
141
154
  });
142
155
  const rightClick = e.button === 2;
143
- const click = e.button === 0;
144
- (onRightClick && rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.rightClick)) && onRightClick(e, find);
145
- (onSelectComponent && !rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.select)) && onSelectComponent(find);
156
+ onRightClick &&
157
+ rightClick &&
158
+ (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.rightClick) &&
159
+ onRightClick(e, find);
160
+ onSelectComponent &&
161
+ !rightClick &&
162
+ (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.select) &&
163
+ onSelectComponent(find);
146
164
  const seletedTable = mappingKey ? find[mappingKey] : find;
147
165
  setSelectedTable(seletedTable);
148
166
  };
@@ -164,10 +182,15 @@ const LayerView = (props) => {
164
182
  }
165
183
  if (i === componentsEditor.length - 1 &&
166
184
  (extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.length) === 0) {
167
- minX = minX > 10 ? minX - 10 : minX;
168
- minY = minY > 10 ? minY - 10 : minY;
169
- maxX = maxX + 10;
170
- maxY = maxY + 10;
185
+ const centerX = (minX + maxX) / 2;
186
+ const centerY = (minY + maxY) / 2;
187
+ const padding = 20;
188
+ const width = maxX - minX + padding * 2;
189
+ const height = maxY - minY + padding * 2;
190
+ minX = centerX - width / 2;
191
+ minY = centerY - height / 2;
192
+ maxX = maxX - minX + padding * 2;
193
+ maxY = maxY - minY + padding * 2;
171
194
  }
172
195
  });
173
196
  extraComponentsEditor === null || extraComponentsEditor === void 0 ? void 0 : extraComponentsEditor.forEach((values) => {
@@ -217,7 +240,7 @@ const LayerView = (props) => {
217
240
  // width: maxX + paddingX * 2,
218
241
  // height: maxY + paddingY + (maxY + paddingY) * 0.5,
219
242
  // };
220
- // console.log(minX, minY, maxX, maxY,props?.viewStyles, "bounding box");
243
+ // console.log(minX, minY, maxX, maxY, props?.viewStyles, "bounding box");
221
244
  return {
222
245
  minX: minX - (((_l = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _l === void 0 ? void 0 : _l.paddingLeft) || 0),
223
246
  minY: minY - (((_m = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _m === void 0 ? void 0 : _m.paddingTop) || 0),
@@ -280,7 +303,7 @@ const LayerView = (props) => {
280
303
  };
281
304
  // drop from out layout editor
282
305
  if (type === "drop") {
283
- (onDrop && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.drop)) && onDrop(event, data);
306
+ onDrop && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.drop) && onDrop(event, data);
284
307
  }
285
308
  // cari elemen bentuk (rect / circle / path)
286
309
  const shape = group.querySelector("rect") ||
@@ -302,6 +325,10 @@ const LayerView = (props) => {
302
325
  const transformed = point.matrixTransform((_a = svg.getScreenCTM()) === null || _a === void 0 ? void 0 : _a.inverse());
303
326
  return { x: transformed.x, y: transformed.y };
304
327
  };
328
+ const lastClickRef = useRef(0);
329
+ const clickTimerRef = useRef(null);
330
+ const ignoreNextRef = useRef(false);
331
+ const DOUBLE_DELAY = 250;
305
332
  const handlePointerDown = (e) => {
306
333
  var _a;
307
334
  const svg = svgRef.current;
@@ -328,7 +355,9 @@ const LayerView = (props) => {
328
355
  : !((_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
329
356
  const dataRaw = originalData({ id: ghostId, type: "find" });
330
357
  return _.value === (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
331
- }))) && ((actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.move) && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.switch));
358
+ }))) &&
359
+ (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.move) &&
360
+ (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.switch);
332
361
  if (ghostAttributes) {
333
362
  Object.keys(ghostAttributes).forEach((key) => {
334
363
  ghost.setAttribute(key, ghostAttributes[key]);
@@ -431,7 +460,27 @@ const LayerView = (props) => {
431
460
  visible: rightClick,
432
461
  });
433
462
  const findDayaById = originalData({ id: dataId, type: "find" });
434
- handleSelectComponent(findDayaById, e);
463
+ const now = Date.now();
464
+ if (ignoreNextRef.current) {
465
+ ignoreNextRef.current = false;
466
+ return;
467
+ }
468
+ const diff = now - lastClickRef.current;
469
+ if (diff < DOUBLE_DELAY) {
470
+ if (clickTimerRef.current) {
471
+ handleDoubleClick(findDayaById, e);
472
+ clearTimeout(clickTimerRef.current);
473
+ clickTimerRef.current = null;
474
+ }
475
+ ignoreNextRef.current = true;
476
+ lastClickRef.current = 0;
477
+ return;
478
+ }
479
+ lastClickRef.current = now;
480
+ clickTimerRef.current = window.setTimeout(() => {
481
+ handleSelectComponent(findDayaById, e);
482
+ clickTimerRef.current = null;
483
+ }, DOUBLE_DELAY);
435
484
  }
436
485
  if (isDragging.current && hasMoved && allowedDrag) {
437
486
  // drag between group
@@ -568,7 +617,11 @@ const LayerView = (props) => {
568
617
  wheelPanning: true,
569
618
  }, wheel: {
570
619
  disabled: false,
571
- }, onTransformed: ({ state: { scale } }) => setScale(scale), minScale: 1, maxScale: 1000, initialScale: 1, smooth: true, centerOnInit: true }, props.transformProps, { children: _jsxs(TransformComponent, { wrapperStyle: {
620
+ },
621
+ // doubleClick={{
622
+ // disabled: true,
623
+ // }}
624
+ onTransformed: ({ state: { scale } }) => setScale(scale), minScale: 1, maxScale: 1000, initialScale: 1, smooth: true, centerOnInit: true }, props.transformProps, { children: _jsxs(TransformComponent, { wrapperStyle: {
572
625
  width: "100%",
573
626
  height: "100%",
574
627
  // overflow: "visible",
@@ -577,7 +630,9 @@ const LayerView = (props) => {
577
630
  width: "100%",
578
631
  height: "100%",
579
632
  // pointerEvents: disabled ? "none" : "auto",
580
- }, children: [_jsxs("svg", Object.assign({ id: "workspace", onContextMenu: (e) => e.preventDefault(), onDrop: (e) => handleTableEvent(e, "drop"), onPointerDown: handlePointerDown, onPointerUp: handleMouseUp, ref: svgRef, width: "100%", height: "100%",
633
+ }, children: [_jsxs("svg", Object.assign({ id: "workspace", onContextMenu: (e) => e.preventDefault(), onDrop: (e) => handleTableEvent(e, "drop"), onPointerDown: handlePointerDown, onPointerUp: handleMouseUp,
634
+ // onDoubleClick={handleDoubleClick}
635
+ ref: svgRef, width: "100%", height: "100%",
581
636
  // scale={5}
582
637
  overflow: "hidden", viewBox: viewBox, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
583
638
  background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,