seat-editor 3.3.22 → 3.3.24

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.
@@ -1,13 +1,14 @@
1
1
  "use client";
2
2
  import { useEffect, useState } from "react";
3
3
  import SeatEditor from "../../features/package";
4
+ import { data4 } from "../constant";
4
5
  export default function NewBoard() {
5
6
  const [initialValue, setInitialValue] = useState([]);
6
7
  const [extraComponents, setExtraComponents] = useState([]);
7
8
  const [backgroundColor, setBackgroundColor] = useState("#000000");
8
9
  const [viewOnly, setViewOnly] = useState(false);
9
10
  useEffect(() => {
10
- setInitialValue([]);
11
+ setInitialValue(data4);
11
12
  setExtraComponents([]);
12
13
  }, []);
13
14
  const handleUploadImage = (file) => {
@@ -47,7 +48,7 @@ export default function NewBoard() {
47
48
  {viewOnly ? "Edit Mode ddd" : "View Mode"}
48
49
  </button> */}
49
50
  <div className="flex-1 h-full">
50
- <SeatEditor componentProps={test} viewOnly={viewOnly} dragOnly={true} deleteAutorized={{
51
+ <SeatEditor componentProps={initialValue} viewOnly={viewOnly} dragOnly={true} deleteAutorized={{
51
52
  component: true,
52
53
  extraComponent: true,
53
54
  }} action={handleUploadImage} mappingKey="properties" onCurrentStateChange={(setState) => {
@@ -398,7 +398,7 @@ const Layers = ({ components, selectedComponent, activeTool, selectionLines, })
398
398
  {/* Seats */}
399
399
  <rect width={width} height={height} rx={radius} {...commonProps} fill={fill}/>
400
400
  <g key={`${id}-seats`} data-seat={`${id}-seats`}>
401
- {seats === null || seats === void 0 ? void 0 : seats.map(({ d, id }, i) => (<path key={`${id}-seat-${i}`} id={`seat-${id}`} d={d} fill="white"/>))}
401
+ {seats === null || seats === void 0 ? void 0 : seats.map(({ d, id }, i) => (<path key={`${id}-seat-${i}`} id={`seat-${id}`} d={d} fill={seatFill}/>))}
402
402
  </g>
403
403
  <g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
404
404
  {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
@@ -52,8 +52,8 @@ const boardSlice = createSlice({
52
52
  state.extraComponents = state.extraComponents.filter((component) => component.id !== action.payload.id);
53
53
  },
54
54
  updateComponent: (state, action) => {
55
- const index = state.components.findIndex((component) => component.id === action.payload.id);
56
- const indexExtra = state.extraComponents.findIndex((extraComponent) => extraComponent.id === action.payload.id);
55
+ const index = state.components.findIndex((component) => String(component.id) == String(action.payload.id));
56
+ const indexExtra = state.extraComponents.findIndex((extraComponent) => String(extraComponent.id) == String(action.payload.id));
57
57
  // state.historyChanges.push({
58
58
  // components: [...state.components],
59
59
  // extraComponents: [...state.extraComponents],
@@ -80,8 +80,8 @@ const boardSlice = createSlice({
80
80
  updateComponentsBulk: (state, action) => {
81
81
  const updates = action.payload;
82
82
  updates.forEach((update) => {
83
- const index = state.components.findIndex((component) => component.id === update.id);
84
- const indexExtra = state.extraComponents.findIndex((extra) => extra.id === update.id);
83
+ const index = state.components.findIndex((component) => component.id == update.id);
84
+ const indexExtra = state.extraComponents.findIndex((extra) => extra.id == update.id);
85
85
  if (index !== -1) {
86
86
  state.components[index] = Object.assign(Object.assign({}, state.components[index]), update);
87
87
  }
@@ -106,7 +106,7 @@ const boardSlice = createSlice({
106
106
  updateSelectedGroupComponent: (state, action) => {
107
107
  const allComponents = action.payload;
108
108
  forEach(allComponents, (component) => {
109
- const index = state.components.findIndex((c) => c.id === component.id);
109
+ const index = state.components.findIndex((c) => c.id == component.id);
110
110
  if (index !== -1) {
111
111
  state.components[index] = Object.assign(Object.assign({}, state.components[index]), component);
112
112
  }
@@ -203,7 +203,7 @@ const boardSlice = createSlice({
203
203
  var _a, _b, _c, _d, _e, _f, _g, _h;
204
204
  if (state.pointer > 1) {
205
205
  const lengthHistory = state.historyChanges.length;
206
- if (lengthHistory === state.pointer) {
206
+ if (lengthHistory == state.pointer) {
207
207
  state.pointer = lengthHistory - 2;
208
208
  }
209
209
  else {
@@ -93,11 +93,11 @@ const ControlPanels = (props) => {
93
93
  }
94
94
  }, [tool, show]);
95
95
  const createShape = (shape, props = {}) => {
96
- var _a, _b, _c, _d, _e, _f, _g, _h;
96
+ var _a, _b, _c, _d, _e, _f, _g;
97
97
  const defaults = (_a = SEAT_SHAPES[shape]) !== null && _a !== void 0 ? _a : {};
98
98
  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), seatPositions: getSeatPosition(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape, props), openSpace: isSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape) ? (_e = props.openSpace) !== null && _e !== void 0 ? _e : 0 : undefined, seatFill: isSeatShape(shape !== null && shape !== void 0 ? shape : props === null || props === void 0 ? void 0 : props.shape)
99
- ? (_f = props.seatFill) !== null && _f !== void 0 ? _f : "transparent"
100
- : 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 });
99
+ ? props.seatFill
100
+ : undefined, text: shape === "text" ? (_f = props.text) !== null && _f !== void 0 ? _f : defaults.text : undefined, fontColor: shape === "text" ? (_g = props.fontColor) !== null && _g !== void 0 ? _g : defaults.fontColor : undefined, radius: props.radius });
101
101
  };
102
102
  const debouncedSyncComponents = useRef(debounce((data) => {
103
103
  dispatch({ type: "board/setFlagChange", payload: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.3.22",
3
+ "version": "3.3.24",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",