seat-editor 3.2.11 → 3.2.13

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.
@@ -3,7 +3,7 @@ import { isEmpty, omit } from "lodash";
3
3
  import { arcByDirection, distributeWithSpacing } from "../layer-v3/utils";
4
4
  import { PRIVILEGED_TAGS, tagsDummy } from "./constant";
5
5
  import { useAppSelector } from "../../hooks/use-redux";
6
- const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighlightGroup, onForceRestoreGroup, selectedTableColor, privilegedTags, }) => {
6
+ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighlightGroup, onForceRestoreGroup, selectedTableColor, privilegedTags = [], }) => {
7
7
  const { isShowTagType } = useAppSelector((state) => state.board);
8
8
  const showLabels = !(["type-1", "type-2"].includes(isShowTagType)) && !iconTags;
9
9
  const renderShape = (item) => {
@@ -11,7 +11,8 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
11
11
  const { id, x, y, width, height, fill, opacity, rotate = 0, rotation, shape, text, stroke, strokeWidth, labels, fontSize, fontColor, seatFill, src, tags, gapTags, label, points, seatPositions, radius, } = item;
12
12
  const renderTags = (data) => {
13
13
  const tags = data !== null && data !== void 0 ? data : tagsDummy("tes");
14
- const privileged = (privilegedTags !== null && privilegedTags !== void 0 ? privilegedTags : isShowTagType === "type-1") ? PRIVILEGED_TAGS["CURRENT_TIME"] : isShowTagType === "type-2" ? PRIVILEGED_TAGS["NEXT_3_RESERVATION"] : undefined;
14
+ const privileged = !isEmpty(privilegedTags) ? privilegedTags : isShowTagType === "type-1" ? PRIVILEGED_TAGS["CURRENT_TIME"] : isShowTagType === "type-2" ? PRIVILEGED_TAGS["NEXT_3_RESERVATION"] : undefined;
15
+ console.log({ privileged, privilegedTags });
15
16
  if (tags && (tags === null || tags === void 0 ? void 0 : tags.length) > 0) {
16
17
  const gapBetweenTags = Number(gapTags || 20);
17
18
  const defaultFontSize = Number(fontSize || 12);
@@ -248,7 +249,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
248
249
  unhighlightGroup(group);
249
250
  }}>
250
251
  <g transform={`rotate(${rotation}, 0,0)`}>
251
- <rect key={`${id}-rect`} width={width} height={height} fill={fill} rx={radius} {...omit(item, ["x", "y", "label", "points"])} {...commonProps}/>
252
+ <rect key={`${id}-rect`} width={width} height={height} fill={fill} rx={radius} {...omit(item, ["x", "y", "label", "points", "tags"])} {...commonProps}/>
252
253
  {renderTags(tags)}
253
254
  {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`} pointerEvents="none">
254
255
  {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
@@ -314,7 +315,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
314
315
  }}>
315
316
  {" "}
316
317
  <g transform={`rotate(${-rotation}, 0, 0)`}>
317
- <circle key={id} cx={width / 2} cy={height / 2} r={Math.min(height, width) / 2} fill={fill} {...commonProps}/>
318
+ <circle key={id} cx={width / 2} cy={height / 2} r={Math.min(height, width) / 2} fill={fill} {...commonProps} {...omit(item, ["x", "y", "label", "points", "tags"])}/>
318
319
  {renderTags(tags)}
319
320
  {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
320
321
  {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
@@ -391,9 +392,9 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
391
392
  unhighlightGroup(group);
392
393
  }}>
393
394
  <g transform={`rotate(${rotation}, 0, 0)`}>
394
- <circle cx={centerX} cy={centerY} r={tableRadius} fill={selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill} {...commonProps}/>
395
+ <circle cx={centerX} cy={centerY} r={tableRadius} fill={selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill} {...omit(item, ["x", "y", "label", "points", "tags"])} {...commonProps}/>
395
396
  <g data-seat={`${id}-seats`}>
396
- {seatCircles.map(({ cx, cy }, i) => (<circle key={`${id}-seat-${i}`} cx={cx} cy={cy} r={seatRadius} fill={seatFill}/>))}
397
+ {seatCircles.map(({ cx, cy }, i) => (<circle key={`${id}-seat-${i}`} cx={cx} cy={cy} r={seatRadius} fill={seatFill} className={item === null || item === void 0 ? void 0 : item.className}/>))}
397
398
  </g>
398
399
 
399
400
  {renderTags(tags)}
@@ -531,9 +532,9 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
531
532
  }}>
532
533
  <g transform={`rotate(${rotation}, 0, 0)`}>
533
534
  {/* Seats */}
534
- <circle cx={width / 2} cy={height / 2} r={tableRadius} {...commonProps} fill={fill}/>
535
+ <circle cx={width / 2} cy={height / 2} r={tableRadius} fill={fill} {...omit(item, ["x", "y", "label", "points", "tags"])} {...commonProps}/>
535
536
  <g key={`${id}-seats`} data-seat={`${id}-seats`}>
536
- {seats === null || seats === void 0 ? void 0 : seats.map(({ height, width, x, y, id }, i) => (<rect x={x} y={y} key={`${id}-seat-${i}`} id={`seat-${id}`} height={height} width={width} rx={radius / 4} fill={seatFill}/>))}
537
+ {seats === null || seats === void 0 ? void 0 : seats.map(({ height, width, x, y, id }, i) => (<rect x={x} y={y} key={`${id}-seat-${i}`} id={`seat-${id}`} height={height} width={width} rx={radius / 4} fill={seatFill} className={item === null || item === void 0 ? void 0 : item.className}/>))}
537
538
  </g>
538
539
  {renderTags(tags)}
539
540
  {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
@@ -647,12 +648,12 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
647
648
  }}>
648
649
  <g transform={`rotate(${rotate}, 0, 0)`}>
649
650
  {/* Square Table */}
650
- <rect width={width} height={height} {...commonProps} fill={selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill}/>
651
+ <rect width={width} height={height} {...commonProps} fill={selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill} {...omit(item, ["x", "y", "label", "points", "tags"])}/>
651
652
  {renderTags(tags)}
652
653
 
653
654
  {/* Seats */}
654
655
  <g key={`${id}-seats`} data-seat={`${id}-seats`} transform={`translate(${-x}, ${-y})`}>
655
- {[...topSeats, ...bottomSeats, ...leftSeats, ...rightSeats].map(({ cx, cy, id }, i) => (<circle key={`${id}-seat-${i}`} id={`seat-${id}`} cx={cx} cy={cy} r={r} fill={seatFill}/>))}
656
+ {[...topSeats, ...bottomSeats, ...leftSeats, ...rightSeats].map(({ cx, cy, id }, i) => (<circle key={`${id}-seat-${i}`} id={`seat-${id}`} cx={cx} cy={cy} r={r} fill={seatFill} className={item === null || item === void 0 ? void 0 : item.className}/>))}
656
657
  </g>
657
658
  {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
658
659
  {labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
@@ -769,9 +770,9 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
769
770
  }}>
770
771
  <g transform={`rotate(${rotation}, 0, 0)`}>
771
772
  {/* Seats */}
772
- <rect width={width} height={height} rx={radius} {...commonProps} fill={fill}/>
773
+ <rect width={width} height={height} rx={radius} {...commonProps} fill={fill} {...omit(item, ["x", "y", "label", "points", "tags"])}/>
773
774
  <g key={`${id}-seats`} data-seat={`${id}-seats`}>
774
- {seats === null || seats === void 0 ? void 0 : seats.map(({ d, id }, i) => (<path key={`${id}-seat-${i}`} id={`seat-${id}`} d={d} fill="white"/>))}
775
+ {seats === null || seats === void 0 ? void 0 : seats.map(({ d, id }, i) => (<path key={`${id}-seat-${i}`} id={`seat-${id}`} d={d} fill="white" className={item === null || item === void 0 ? void 0 : item.className}/>))}
775
776
  </g>
776
777
  {renderTags(tags)}
777
778
  {showLabels && (<g transform={`rotate(${-rotation}, ${width / 2}, ${height / 2})`}>
@@ -913,7 +914,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
913
914
  }}>
914
915
  <g transform={`rotate(${rotation}, 0, 0)`}>
915
916
  {/* Seats */}
916
- <rect width={width} height={height} rx={radius} {...commonProps} fill={fill}/>
917
+ <rect width={width} height={height} rx={radius} {...commonProps} fill={fill} {...omit(item, ["x", "y", "label", "points", "tags"])}/>
917
918
  <g key={`${id}-seats`} data-seat={`${id}-seats`} transform={`translate(${-x}, ${-y})`}>
918
919
  {seats === null || seats === void 0 ? void 0 : seats.map(({ height, width, x, y, id }, i) => (<rect x={x} y={y} key={`${id}-seat-${i}`} id={`seat-${id}`} height={height} width={width} rx={radius / 4} fill={seatFill}/>))}
919
920
  </g>
@@ -8,7 +8,7 @@ export type TableGhost = {
8
8
  };
9
9
  export type TableMatchKey = {
10
10
  key: string | number;
11
- properties: PropertiesProps;
11
+ properties?: PropertiesProps;
12
12
  className?: string;
13
13
  };
14
14
  export type TableMatchEvent = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.2.11",
3
+ "version": "3.2.13",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",