seat-editor 3.5.10 → 3.5.12

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,9 +2,18 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { Modal } from "antd";
4
4
  import { useAppSelector, useAppDispatch } from "../../hooks/use-redux";
5
+ import { useEffect } from "react";
5
6
  const ModalPreview = ({ children }) => {
6
7
  const { isPreview } = useAppSelector((state) => state.tool);
7
8
  const dispatch = useAppDispatch();
9
+ useEffect(() => {
10
+ if (!isPreview) {
11
+ dispatch({
12
+ type: "board/setTagType",
13
+ payload: "default",
14
+ });
15
+ }
16
+ }, [isPreview]);
8
17
  return (_jsx(Modal, { open: isPreview, onCancel: () => dispatch({ type: "tool/setTooglePreview", payload: false }), width: 700, title: "Preview Board", centered: true, footer: null, children: _jsx("div", { className: "flex flex-col p-4 h-[500px]", children: children }) }));
9
18
  };
10
19
  export default ModalPreview;
@@ -1,9 +1,18 @@
1
1
  "use client";
2
2
  import { Modal } from "antd";
3
3
  import { useAppSelector, useAppDispatch } from "../../hooks/use-redux";
4
+ import { useEffect } from "react";
4
5
  const ModalPreview = ({ children }) => {
5
6
  const { isPreview } = useAppSelector((state) => state.tool);
6
7
  const dispatch = useAppDispatch();
8
+ useEffect(() => {
9
+ if (!isPreview) {
10
+ dispatch({
11
+ type: "board/setTagType",
12
+ payload: "default",
13
+ });
14
+ }
15
+ }, [isPreview]);
7
16
  return (<Modal open={isPreview} onCancel={() => dispatch({ type: "tool/setTooglePreview", payload: false })} width={700} title="Preview Board" centered footer={null}>
8
17
  <div className="flex flex-col p-4 h-[500px]">{children}</div>
9
18
  </Modal>);
@@ -1,5 +1,5 @@
1
1
  declare const MIN_HEIGHT = 90;
2
- declare const MIN_WIDTH = 90;
2
+ declare const MIN_WIDTH = 60;
3
3
  declare const MIN_X = 10;
4
4
  declare const MIN_Y = 10;
5
5
  export { MIN_HEIGHT, MIN_WIDTH, MIN_X, MIN_Y };
@@ -1,5 +1,5 @@
1
1
  const MIN_HEIGHT = 90;
2
- const MIN_WIDTH = 90;
2
+ const MIN_WIDTH = 60;
3
3
  const MIN_X = 10;
4
4
  const MIN_Y = 10;
5
5
  export { MIN_HEIGHT, MIN_WIDTH, MIN_X, MIN_Y };
@@ -122,7 +122,6 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
122
122
  const allBox = groupIdSelection === null || groupIdSelection === void 0 ? void 0 : groupIdSelection.map((id) => {
123
123
  var _a;
124
124
  const { g } = (_a = getAttributeElements(svgRef.current, [String(id)])) === null || _a === void 0 ? void 0 : _a[0];
125
- const translate = getTranslate(g);
126
125
  const size = getGlobalBBox(svgRef.current, g);
127
126
  return Object.assign({}, size);
128
127
  });
@@ -121,7 +121,6 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
121
121
  const allBox = groupIdSelection === null || groupIdSelection === void 0 ? void 0 : groupIdSelection.map((id) => {
122
122
  var _a;
123
123
  const { g } = (_a = getAttributeElements(svgRef.current, [String(id)])) === null || _a === void 0 ? void 0 : _a[0];
124
- const translate = getTranslate(g);
125
124
  const size = getGlobalBBox(svgRef.current, g);
126
125
  return Object.assign({}, size);
127
126
  });
@@ -60,9 +60,14 @@ export const getSeatPosition = (shape, props, defaultValue) => {
60
60
  export const adjustHeightWidthForSeatShape = (shape, props, valuesChanges) => {
61
61
  if (shape === null || shape === void 0 ? void 0 : shape.includes("circle")) {
62
62
  const sizeDefault = Math.min(props.width, props.height);
63
- let sizeFinal = sizeDefault < MIN_WIDTH ? MIN_WIDTH : sizeDefault;
64
- if ((valuesChanges === null || valuesChanges === void 0 ? void 0 : valuesChanges.width) || (valuesChanges === null || valuesChanges === void 0 ? void 0 : valuesChanges.height)) {
65
- sizeFinal = (valuesChanges === null || valuesChanges === void 0 ? void 0 : valuesChanges.width) || (valuesChanges === null || valuesChanges === void 0 ? void 0 : valuesChanges.height) || sizeDefault;
63
+ let sizeFinal = sizeDefault < MIN_HEIGHT ? MIN_HEIGHT : sizeDefault;
64
+ if (valuesChanges === null || valuesChanges === void 0 ? void 0 : valuesChanges.width) {
65
+ sizeFinal =
66
+ (valuesChanges === null || valuesChanges === void 0 ? void 0 : valuesChanges.width) < MIN_HEIGHT ? MIN_HEIGHT : valuesChanges === null || valuesChanges === void 0 ? void 0 : valuesChanges.width;
67
+ }
68
+ if (valuesChanges === null || valuesChanges === void 0 ? void 0 : valuesChanges.height) {
69
+ sizeFinal =
70
+ (valuesChanges === null || valuesChanges === void 0 ? void 0 : valuesChanges.height) < MIN_HEIGHT ? MIN_HEIGHT : valuesChanges === null || valuesChanges === void 0 ? void 0 : valuesChanges.height;
66
71
  }
67
72
  return Object.assign(Object.assign({}, props), { height: isNaN(sizeFinal) ? MIN_WIDTH : sizeFinal, width: isNaN(sizeFinal) ? MIN_HEIGHT : sizeFinal });
68
73
  }
@@ -113,9 +118,7 @@ export function isSameAllByKey(arr, key) {
113
118
  export function getValueIfSame(arr, key) {
114
119
  var _a;
115
120
  if (key === "opacity") {
116
- return isSameAllByKey(arr, key)
117
- ? Number(arr[0][key]) * 100
118
- : undefined;
121
+ return isSameAllByKey(arr, key) ? Number(arr[0][key]) * 100 : undefined;
119
122
  }
120
123
  if (key === "labels") {
121
124
  return (arr === null || arr === void 0 ? void 0 : arr.every((item) => { var _a; return _.isEqual(item === null || item === void 0 ? void 0 : item[key], (_a = arr === null || arr === void 0 ? void 0 : arr[0]) === null || _a === void 0 ? void 0 : _a[key]); }))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.5.10",
3
+ "version": "3.5.12",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",