seat-editor 3.4.6 → 3.4.7

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.
@@ -9,7 +9,7 @@ const SectionLabel = () => {
9
9
  if (Number.isNaN(num))
10
10
  return 0;
11
11
  return Math.min(360, Math.max(0, num));
12
- } }) })] }), _jsxs(Flex, { gap: 5, children: [_jsx(Form.Item, { name: [field.name, "fontSize"], label: "Size", children: _jsx(InputNumber, { suffix: "px" }) }), _jsx(Form.Item, { name: [field.name, "fontColor"], label: "Color", getValueFromEvent: (color) => color.toHexString(), children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })] }), fields.length < 2 && (_jsx(Flex, { gap: 2, className: "w-full", children: _jsx(Button
12
+ } }) })] }), _jsxs(Flex, { gap: 5, children: [_jsx(Form.Item, { name: [field.name, "fontSize"], label: "Size", children: _jsx(InputNumber, { suffix: "px" }) }), _jsx(Form.Item, { name: [field.name, "fontColor"], label: "Color", getValueFromEvent: (color) => color.toHexString(), children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })] }), fields.length > 1 && (_jsx(Flex, { gap: 2, className: "w-full", children: _jsx(Button
13
13
  // type="dashed"
14
14
  , {
15
15
  // type="dashed"
@@ -40,7 +40,7 @@ const SectionLabel = () => {
40
40
  <ColorPicker allowClear format="hex" defaultFormat="hex"/>
41
41
  </Form.Item>
42
42
  </Flex>
43
- {fields.length < 2 && (<Flex gap={2} className="w-full">
43
+ {fields.length > 1 && (<Flex gap={2} className="w-full">
44
44
  <Button
45
45
  // type="dashed"
46
46
  onClick={() => remove(fields.indexOf(field))} className="w-full">
@@ -37,8 +37,9 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
37
37
  const { isShowTagType } = useAppSelector((state) => state.board);
38
38
  const showLabels = !["type-1", "type-2"].includes(isShowTagType) && !iconTags;
39
39
  const renderShape = (item) => {
40
- var _a, _b, _c, _d, _e, _f;
40
+ var _a, _b, _c, _d, _e, _f, _g;
41
41
  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;
42
+ const fontSizeFromLabel = (_a = labels === null || labels === void 0 ? void 0 : labels[0]) === null || _a === void 0 ? void 0 : _a.fontSize;
42
43
  const renderTags = (data) => {
43
44
  var _a;
44
45
  const tags = data !== null && data !== void 0 ? data : tagsDummy(((_a = labels === null || labels === void 0 ? void 0 : labels[0]) === null || _a === void 0 ? void 0 : _a.label) || "Table", getIconFromId(id));
@@ -51,7 +52,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
51
52
  : undefined;
52
53
  if (tags && (tags === null || tags === void 0 ? void 0 : tags.length) > 0) {
53
54
  const gapBetweenTags = Number(gapTags || 20);
54
- const defaultFontSize = Number(fontSize || 12);
55
+ const defaultFontSize = Number(fontSize || fontSizeFromLabel || 12);
55
56
  // Hitung total tinggi semua grup tag (buat center vertikal)
56
57
  const totalTagHeight = (tags === null || tags === void 0 ? void 0 : tags.filter((tag) => privileged === null || privileged === void 0 ? void 0 : privileged.find((p) => p.key === tag.key)).reduce((sum, tag) => {
57
58
  var _a;
@@ -344,7 +345,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
344
345
  }) }))] })] }, id));
345
346
  case "table-seat-circle": {
346
347
  const seatCount = item.seatCount;
347
- const openSpace = (_a = item.openSpace) !== null && _a !== void 0 ? _a : 0;
348
+ const openSpace = (_b = item.openSpace) !== null && _b !== void 0 ? _b : 0;
348
349
  // LOCAL SPACE (tanpa x,y)
349
350
  const centerX = width / 2;
350
351
  const centerY = height / 2;
@@ -539,10 +540,10 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
539
540
  const openSpace = item.openSpace || 0; // from 0 to 0.9
540
541
  const r = 10;
541
542
  const seatPositions = item.seatPositions;
542
- const topCount = (_b = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.top) !== null && _b !== void 0 ? _b : 0;
543
- const bottomCount = (_c = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.bottom) !== null && _c !== void 0 ? _c : 0;
544
- const leftCount = (_d = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.left) !== null && _d !== void 0 ? _d : 0;
545
- const rightCount = (_e = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.right) !== null && _e !== void 0 ? _e : 0;
543
+ const topCount = (_c = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.top) !== null && _c !== void 0 ? _c : 0;
544
+ const bottomCount = (_d = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.bottom) !== null && _d !== void 0 ? _d : 0;
545
+ const leftCount = (_e = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.left) !== null && _e !== void 0 ? _e : 0;
546
+ const rightCount = (_f = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.right) !== null && _f !== void 0 ? _f : 0;
546
547
  // split seats evenly on top and bottom
547
548
  const seatCountTopBottom = Math.ceil(Math.max(topCount, bottomCount) / 2);
548
549
  const seatCountLeftRight = Math.ceil(Math.max(leftCount, rightCount) / 2);
@@ -683,12 +684,12 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
683
684
  radius: seatRadius,
684
685
  spacing: spacingHeight,
685
686
  }).map((cy) => ({ cx: width - seatRadius * 0.1, cy, id: "right" }));
686
- const seats = (_f = [
687
+ const seats = (_g = [
687
688
  ...topSeats,
688
689
  ...bottomSeats,
689
690
  ...leftSeats,
690
691
  ...rightSeats,
691
- ]) === null || _f === void 0 ? void 0 : _f.map((seat) => (Object.assign(Object.assign({}, seat), { d: arcByDirection({
692
+ ]) === null || _g === void 0 ? void 0 : _g.map((seat) => (Object.assign(Object.assign({}, seat), { d: arcByDirection({
692
693
  cx: seat.cx,
693
694
  cy: seat.cy,
694
695
  r: seatRadius,
@@ -35,8 +35,9 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
35
35
  const { isShowTagType } = useAppSelector((state) => state.board);
36
36
  const showLabels = !["type-1", "type-2"].includes(isShowTagType) && !iconTags;
37
37
  const renderShape = (item) => {
38
- var _a, _b, _c, _d, _e, _f;
38
+ var _a, _b, _c, _d, _e, _f, _g;
39
39
  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;
40
+ const fontSizeFromLabel = (_a = labels === null || labels === void 0 ? void 0 : labels[0]) === null || _a === void 0 ? void 0 : _a.fontSize;
40
41
  const renderTags = (data) => {
41
42
  var _a;
42
43
  const tags = data !== null && data !== void 0 ? data : tagsDummy(((_a = labels === null || labels === void 0 ? void 0 : labels[0]) === null || _a === void 0 ? void 0 : _a.label) || "Table", getIconFromId(id));
@@ -49,7 +50,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
49
50
  : undefined;
50
51
  if (tags && (tags === null || tags === void 0 ? void 0 : tags.length) > 0) {
51
52
  const gapBetweenTags = Number(gapTags || 20);
52
- const defaultFontSize = Number(fontSize || 12);
53
+ const defaultFontSize = Number(fontSize || fontSizeFromLabel || 12);
53
54
  // Hitung total tinggi semua grup tag (buat center vertikal)
54
55
  const totalTagHeight = (tags === null || tags === void 0 ? void 0 : tags.filter((tag) => privileged === null || privileged === void 0 ? void 0 : privileged.find((p) => p.key === tag.key)).reduce((sum, tag) => {
55
56
  var _a;
@@ -372,7 +373,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
372
373
  </g>);
373
374
  case "table-seat-circle": {
374
375
  const seatCount = item.seatCount;
375
- const openSpace = (_a = item.openSpace) !== null && _a !== void 0 ? _a : 0;
376
+ const openSpace = (_b = item.openSpace) !== null && _b !== void 0 ? _b : 0;
376
377
  // LOCAL SPACE (tanpa x,y)
377
378
  const centerX = width / 2;
378
379
  const centerY = height / 2;
@@ -595,10 +596,10 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
595
596
  const openSpace = item.openSpace || 0; // from 0 to 0.9
596
597
  const r = 10;
597
598
  const seatPositions = item.seatPositions;
598
- const topCount = (_b = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.top) !== null && _b !== void 0 ? _b : 0;
599
- const bottomCount = (_c = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.bottom) !== null && _c !== void 0 ? _c : 0;
600
- const leftCount = (_d = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.left) !== null && _d !== void 0 ? _d : 0;
601
- const rightCount = (_e = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.right) !== null && _e !== void 0 ? _e : 0;
599
+ const topCount = (_c = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.top) !== null && _c !== void 0 ? _c : 0;
600
+ const bottomCount = (_d = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.bottom) !== null && _d !== void 0 ? _d : 0;
601
+ const leftCount = (_e = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.left) !== null && _e !== void 0 ? _e : 0;
602
+ const rightCount = (_f = seatPositions === null || seatPositions === void 0 ? void 0 : seatPositions.right) !== null && _f !== void 0 ? _f : 0;
602
603
  // split seats evenly on top and bottom
603
604
  const seatCountTopBottom = Math.ceil(Math.max(topCount, bottomCount) / 2);
604
605
  const seatCountLeftRight = Math.ceil(Math.max(leftCount, rightCount) / 2);
@@ -755,12 +756,12 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
755
756
  radius: seatRadius,
756
757
  spacing: spacingHeight,
757
758
  }).map((cy) => ({ cx: width - seatRadius * 0.1, cy, id: "right" }));
758
- const seats = (_f = [
759
+ const seats = (_g = [
759
760
  ...topSeats,
760
761
  ...bottomSeats,
761
762
  ...leftSeats,
762
763
  ...rightSeats,
763
- ]) === null || _f === void 0 ? void 0 : _f.map((seat) => (Object.assign(Object.assign({}, seat), { d: arcByDirection({
764
+ ]) === null || _g === void 0 ? void 0 : _g.map((seat) => (Object.assign(Object.assign({}, seat), { d: arcByDirection({
764
765
  cx: seat.cx,
765
766
  cy: seat.cy,
766
767
  r: seatRadius,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.4.6",
3
+ "version": "3.4.7",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",