seat-editor 3.4.3 → 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.
- package/dist/app/constant.d.ts +14 -19
- package/dist/app/constant.js +32 -20
- package/dist/app/new-board/page.js +1 -1
- package/dist/app/new-board/page.jsx +1 -1
- package/dist/app/only-view/page.js +6 -4
- package/dist/app/only-view/page.jsx +6 -4
- package/dist/components/form-tools/label.js +13 -13
- package/dist/components/form-tools/label.jsx +18 -11
- package/dist/components/form-tools/shape.js +2 -18
- package/dist/components/form-tools/shape.jsx +2 -10
- package/dist/features/board-v3/board-slice.js +4 -4
- package/dist/features/board-v3/index.js +24 -4
- package/dist/features/board-v3/index.jsx +24 -4
- package/dist/features/board-v3/utils.d.ts +2 -1
- package/dist/features/board-v3/utils.js +44 -18
- package/dist/features/panel/index.js +28 -4
- package/dist/features/panel/index.jsx +28 -4
- package/dist/features/panel/selected-group.js +16 -4
- package/dist/features/panel/selected-group.jsx +26 -7
- package/dist/features/panel/table-seat-circle.js +9 -2
- package/dist/features/panel/table-seat-circle.jsx +10 -3
- package/dist/features/panel/table-seat-square.js +8 -2
- package/dist/features/panel/table-seat-square.jsx +9 -3
- package/dist/features/panel/utils.d.ts +1 -1
- package/dist/features/panel/utils.js +37 -19
- package/dist/features/view-only-3/index.d.ts +7 -5
- package/dist/features/view-only-3/index.js +71 -16
- package/dist/features/view-only-3/index.jsx +71 -16
- package/package.json +1 -1
package/dist/app/constant.d.ts
CHANGED
|
@@ -347,11 +347,12 @@ export declare const data4: ({
|
|
|
347
347
|
x: number;
|
|
348
348
|
y: number;
|
|
349
349
|
labels: {
|
|
350
|
+
label: string;
|
|
351
|
+
fontColor: string;
|
|
350
352
|
x: number;
|
|
351
353
|
y: number;
|
|
352
|
-
label: string;
|
|
353
354
|
fontSize: number;
|
|
354
|
-
|
|
355
|
+
rotation: number;
|
|
355
356
|
}[];
|
|
356
357
|
id: string;
|
|
357
358
|
stroke: string;
|
|
@@ -418,19 +419,14 @@ export declare const data4: ({
|
|
|
418
419
|
})[];
|
|
419
420
|
opacity: number;
|
|
420
421
|
rotation: number;
|
|
421
|
-
seatCount: number;
|
|
422
422
|
openSpace: number;
|
|
423
423
|
seatFill: string;
|
|
424
|
-
seatPositions: {
|
|
425
|
-
top: number;
|
|
426
|
-
bottom: number;
|
|
427
|
-
left: number;
|
|
428
|
-
right: number;
|
|
429
|
-
};
|
|
430
424
|
radius?: undefined;
|
|
425
|
+
seatCount?: undefined;
|
|
431
426
|
};
|
|
432
427
|
} | {
|
|
433
428
|
status: number;
|
|
429
|
+
capacity: number;
|
|
434
430
|
properties: {
|
|
435
431
|
x: number;
|
|
436
432
|
y: number;
|
|
@@ -512,19 +508,19 @@ export declare const data4: ({
|
|
|
512
508
|
offsetX?: undefined;
|
|
513
509
|
offsetY?: undefined;
|
|
514
510
|
})[];
|
|
515
|
-
seatPositions: {
|
|
516
|
-
top: number;
|
|
517
|
-
bottom: number;
|
|
518
|
-
left: number;
|
|
519
|
-
right: number;
|
|
520
|
-
};
|
|
521
511
|
opacity: number;
|
|
522
512
|
rotation: number;
|
|
523
|
-
|
|
524
|
-
|
|
513
|
+
labels: {
|
|
514
|
+
label: string;
|
|
515
|
+
fontColor: string;
|
|
516
|
+
x: number;
|
|
517
|
+
y: number;
|
|
518
|
+
fontSize: number;
|
|
519
|
+
rotation: number;
|
|
520
|
+
}[];
|
|
521
|
+
seatCount?: undefined;
|
|
525
522
|
};
|
|
526
523
|
uuid_table?: undefined;
|
|
527
|
-
capacity?: undefined;
|
|
528
524
|
} | {
|
|
529
525
|
properties: {
|
|
530
526
|
x: number;
|
|
@@ -580,7 +576,6 @@ export declare const data4: ({
|
|
|
580
576
|
seatCount: number;
|
|
581
577
|
openSpace?: undefined;
|
|
582
578
|
seatFill?: undefined;
|
|
583
|
-
seatPositions?: undefined;
|
|
584
579
|
radius?: undefined;
|
|
585
580
|
};
|
|
586
581
|
uuid_table?: undefined;
|
package/dist/app/constant.js
CHANGED
|
@@ -3437,7 +3437,7 @@ export const test4 = [
|
|
|
3437
3437
|
seatCount: 0,
|
|
3438
3438
|
uuid_table: "d088bba0-e990-410e-aea9-08548175a0b9",
|
|
3439
3439
|
gapTags: 20,
|
|
3440
|
-
}
|
|
3440
|
+
},
|
|
3441
3441
|
},
|
|
3442
3442
|
{
|
|
3443
3443
|
status: 1,
|
|
@@ -3527,17 +3527,18 @@ export const data4 = [
|
|
|
3527
3527
|
{
|
|
3528
3528
|
uuid_table: "axxxxx",
|
|
3529
3529
|
status: 0,
|
|
3530
|
-
capacity:
|
|
3530
|
+
capacity: 4,
|
|
3531
3531
|
properties: {
|
|
3532
3532
|
x: 500,
|
|
3533
3533
|
y: 520,
|
|
3534
3534
|
labels: [
|
|
3535
3535
|
{
|
|
3536
|
+
label: "3",
|
|
3537
|
+
fontColor: "#000000",
|
|
3536
3538
|
x: 0,
|
|
3537
|
-
y:
|
|
3538
|
-
label: "New Table 5",
|
|
3539
|
+
y: 0,
|
|
3539
3540
|
fontSize: 12,
|
|
3540
|
-
|
|
3541
|
+
rotation: 0,
|
|
3541
3542
|
},
|
|
3542
3543
|
],
|
|
3543
3544
|
id: "1761194669729132000",
|
|
@@ -3613,15 +3614,15 @@ export const data4 = [
|
|
|
3613
3614
|
],
|
|
3614
3615
|
opacity: 1,
|
|
3615
3616
|
rotation: 0,
|
|
3616
|
-
seatCount: 10,
|
|
3617
|
+
// seatCount: 10,
|
|
3617
3618
|
openSpace: 0.3,
|
|
3618
3619
|
seatFill: "#ed8989",
|
|
3619
|
-
seatPositions: {
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
},
|
|
3620
|
+
// seatPositions: {
|
|
3621
|
+
// top: 3,
|
|
3622
|
+
// bottom: 3,
|
|
3623
|
+
// left: 3,
|
|
3624
|
+
// right: 3,
|
|
3625
|
+
// },
|
|
3625
3626
|
},
|
|
3626
3627
|
},
|
|
3627
3628
|
// {
|
|
@@ -3881,6 +3882,7 @@ export const data4 = [
|
|
|
3881
3882
|
// },
|
|
3882
3883
|
{
|
|
3883
3884
|
status: 2,
|
|
3885
|
+
capacity: 4,
|
|
3884
3886
|
properties: {
|
|
3885
3887
|
x: 100,
|
|
3886
3888
|
y: 100,
|
|
@@ -3959,15 +3961,25 @@ export const data4 = [
|
|
|
3959
3961
|
gap: 2,
|
|
3960
3962
|
},
|
|
3961
3963
|
],
|
|
3962
|
-
seatPositions: {
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
},
|
|
3964
|
+
// seatPositions: {
|
|
3965
|
+
// top: 1,
|
|
3966
|
+
// bottom: 1,
|
|
3967
|
+
// left: 1,
|
|
3968
|
+
// right: 1,
|
|
3969
|
+
// },
|
|
3968
3970
|
opacity: 1,
|
|
3969
3971
|
rotation: 0,
|
|
3970
|
-
|
|
3972
|
+
labels: [
|
|
3973
|
+
{
|
|
3974
|
+
label: "3",
|
|
3975
|
+
fontColor: "#000000",
|
|
3976
|
+
x: 0,
|
|
3977
|
+
y: 0,
|
|
3978
|
+
fontSize: 12,
|
|
3979
|
+
rotation: 0,
|
|
3980
|
+
},
|
|
3981
|
+
],
|
|
3982
|
+
// seatCount: 6,
|
|
3971
3983
|
},
|
|
3972
3984
|
},
|
|
3973
3985
|
{
|
|
@@ -5569,7 +5581,7 @@ export const dummyExtra6 = [
|
|
|
5569
5581
|
{
|
|
5570
5582
|
x: 100,
|
|
5571
5583
|
y: 100,
|
|
5572
|
-
id:
|
|
5584
|
+
id: "1754137739279",
|
|
5573
5585
|
src: "https://cdn.table.link/prod/5bf923de-2366-4a11-9b8b-e92de0afbf05/3a65cb36-7d85-4c38-9403-a15f94641920/68d45207-d66b-4bb5-92a2-4e5a87715e98/rsvp/1754137739126863915_BOI Reg.png",
|
|
5574
5586
|
fill: "red",
|
|
5575
5587
|
// image:
|
|
@@ -41,7 +41,7 @@ export default function NewBoard() {
|
|
|
41
41
|
// properties: item?.properties?.
|
|
42
42
|
// }
|
|
43
43
|
// })
|
|
44
|
-
return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex flex-col relative justify-center", children: [_jsx("div", { className: "w-full h-[1000px] bg-white border-r border-gray-200" }), _jsx("div", { className: "flex-1 h-full", children: _jsx(SeatEditor, { componentProps: initialValue, viewOnly:
|
|
44
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex flex-col relative justify-center", children: [_jsx("div", { className: "w-full h-[1000px] bg-white border-r border-gray-200" }), _jsx("div", { className: "flex-1 h-full", children: _jsx(SeatEditor, { componentProps: initialValue, viewOnly: viewOnly, dragOnly: true, deleteAutorized: {
|
|
45
45
|
component: true,
|
|
46
46
|
extraComponent: true,
|
|
47
47
|
}, action: handleUploadImage, mappingKey: "properties", onCurrentStateChange: (setState) => {
|
|
@@ -51,7 +51,7 @@ export default function NewBoard() {
|
|
|
51
51
|
{viewOnly ? "Edit Mode ddd" : "View Mode"}
|
|
52
52
|
</button> */}
|
|
53
53
|
<div className="flex-1 h-full">
|
|
54
|
-
<SeatEditor componentProps={initialValue} viewOnly={
|
|
54
|
+
<SeatEditor componentProps={initialValue} viewOnly={viewOnly} dragOnly={true} deleteAutorized={{
|
|
55
55
|
component: true,
|
|
56
56
|
extraComponent: true,
|
|
57
57
|
}} action={handleUploadImage} mappingKey="properties" onCurrentStateChange={(setState) => {
|
|
@@ -174,7 +174,7 @@ const TouchScrollDetect = () => {
|
|
|
174
174
|
key: "rsvp_time",
|
|
175
175
|
items: ["text", "icon"],
|
|
176
176
|
},
|
|
177
|
-
], defaultBackground: "#000000", mappingKey: "properties", componentProps: [], onDrop: (e, data) => handleDrop(e, data), onSwitch: (e, data) => handleSwitch(e, data), extraComponentProps: [], onSelectComponent: (component) => {
|
|
177
|
+
], defaultBackground: "#000000", mappingKey: "properties", componentProps: [], onDoubleClick: (data) => console.log(data), onDrop: (e, data) => handleDrop(e, data), onSwitch: (e, data) => handleSwitch(e, data), extraComponentProps: [], onSelectComponent: (component) => {
|
|
178
178
|
handleSelectTable(component);
|
|
179
179
|
}, dragTableBlockKey: [
|
|
180
180
|
{
|
|
@@ -216,8 +216,10 @@ const TouchScrollDetect = () => {
|
|
|
216
216
|
icon: _jsx(UserIcon, {}),
|
|
217
217
|
key: "user",
|
|
218
218
|
},
|
|
219
|
-
],
|
|
220
|
-
|
|
221
|
-
|
|
219
|
+
],
|
|
220
|
+
// viewStyles={{
|
|
221
|
+
// paddingTop: 10,
|
|
222
|
+
// }}
|
|
223
|
+
transformProps: {} })] })] })] }));
|
|
222
224
|
};
|
|
223
225
|
export default TouchScrollDetect;
|
|
@@ -198,7 +198,7 @@ const TouchScrollDetect = () => {
|
|
|
198
198
|
key: "rsvp_time",
|
|
199
199
|
items: ["text", "icon"],
|
|
200
200
|
},
|
|
201
|
-
]} defaultBackground="#000000" mappingKey="properties" componentProps={[]} onDrop={(e, data) => handleDrop(e, data)} onSwitch={(e, data) => handleSwitch(e, data)} extraComponentProps={[]} onSelectComponent={(component) => {
|
|
201
|
+
]} defaultBackground="#000000" mappingKey="properties" componentProps={[]} onDoubleClick={(data) => console.log(data)} onDrop={(e, data) => handleDrop(e, data)} onSwitch={(e, data) => handleSwitch(e, data)} extraComponentProps={[]} onSelectComponent={(component) => {
|
|
202
202
|
handleSelectTable(component);
|
|
203
203
|
}} dragTableBlockKey={[
|
|
204
204
|
{
|
|
@@ -240,9 +240,11 @@ const TouchScrollDetect = () => {
|
|
|
240
240
|
icon: <UserIcon />,
|
|
241
241
|
key: "user",
|
|
242
242
|
},
|
|
243
|
-
]}
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
]}
|
|
244
|
+
// viewStyles={{
|
|
245
|
+
// paddingTop: 10,
|
|
246
|
+
// }}
|
|
247
|
+
transformProps={{}}/>
|
|
246
248
|
</div>
|
|
247
249
|
</div>
|
|
248
250
|
</div>);
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { Button, ColorPicker, Flex, Form, Input, InputNumber, Divider } from "antd";
|
|
3
|
+
import { Button, ColorPicker, Flex, Form, Input, InputNumber, Divider, } from "antd";
|
|
4
4
|
const SectionLabel = () => {
|
|
5
|
-
return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Section Labeling" }), _jsx(Divider, { style: { margin: 4 } }), _jsx(Form.Item, { label: "Labels in table", name: "labels", className: "w-full", children: _jsx(Form.List, { name: "labels", children: (fields, { add, remove }) => (_jsxs(_Fragment, { children: [fields.map((field) => (_jsxs("div", { className: "w-full", children: [_jsx(Flex, { gap: 5, className: "w-full flex justify-between", children: _jsx(Form.Item, { name: [field.name, "label"], label: "Text", className: "w-full", children: _jsx(Input, {}) }) }), _jsxs(Flex, { gap: 5, className: "w-full flex justify-between", children: [_jsx(Form.Item, { name: [field.name, "x"], label: "Position X", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "y"], label: "Position Y", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "rotation"], label: "Rotation", children: _jsx(InputNumber, { suffix: "\u00B0", min: 0, max: 360, parser: (value) => {
|
|
5
|
+
return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Section Labeling" }), _jsx(Divider, { style: { margin: 4 } }), _jsx(Form.Item, { label: "Labels in table", name: "labels", className: "w-full", children: _jsx(Form.List, { name: "labels", children: (fields, { add, remove }) => (_jsxs(_Fragment, { children: [fields.map((field) => (_jsxs("div", { className: "w-full flex-col mb-2", children: [_jsx(Flex, { gap: 5, className: "w-full flex justify-between", children: _jsx(Form.Item, { name: [field.name, "label"], label: "Text", className: "w-full", children: _jsx(Input, {}) }) }), _jsxs(Flex, { gap: 5, className: "w-full flex justify-between", children: [_jsx(Form.Item, { name: [field.name, "x"], label: "Position X", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "y"], label: "Position Y", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "rotation"], label: "Rotation", children: _jsx(InputNumber, { suffix: "\u00B0", min: 0, max: 360, parser: (value) => {
|
|
6
6
|
if (!value)
|
|
7
7
|
return 0;
|
|
8
8
|
const num = Number(value.replace(/\D/g, ""));
|
|
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" }) })] })
|
|
13
|
-
// type="dashed"
|
|
14
|
-
, {
|
|
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
|
|
15
13
|
// type="dashed"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
, {
|
|
15
|
+
// type="dashed"
|
|
16
|
+
onClick: () => remove(fields.indexOf(field)), className: "w-full", children: "Remove" }) }))] }, field.key))), _jsx(Flex, { gap: 2, className: "w-full mt-2", children: _jsx(Button, { type: "primary", onClick: () => add({
|
|
17
|
+
label: "",
|
|
18
|
+
fontColor: "#000000",
|
|
19
|
+
x: 0,
|
|
20
|
+
y: 0,
|
|
21
|
+
fontSize: 12,
|
|
22
|
+
rotation: 0,
|
|
23
|
+
}), className: "w-full", children: "Add" }) })] })) }) }), _jsx("div", { className: "divider-dashed" })] }));
|
|
24
24
|
};
|
|
25
25
|
export default SectionLabel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Button, ColorPicker, Flex, Form, Input, InputNumber, Divider } from "antd";
|
|
2
|
+
import { Button, ColorPicker, Flex, Form, Input, InputNumber, Divider, } from "antd";
|
|
3
3
|
const SectionLabel = () => {
|
|
4
4
|
return (<div className="py-2">
|
|
5
5
|
<h1 className="heading-s">Section Labeling</h1>
|
|
@@ -8,12 +8,11 @@ const SectionLabel = () => {
|
|
|
8
8
|
<Form.Item label="Labels in table" name={"labels"} className="w-full">
|
|
9
9
|
<Form.List name="labels">
|
|
10
10
|
{(fields, { add, remove }) => (<>
|
|
11
|
-
{fields.map((field) => (<div key={field.key} className="w-full">
|
|
11
|
+
{fields.map((field) => (<div key={field.key} className="w-full flex-col mb-2">
|
|
12
12
|
<Flex gap={5} className="w-full flex justify-between">
|
|
13
13
|
<Form.Item name={[field.name, "label"]} label="Text" className="w-full">
|
|
14
14
|
<Input />
|
|
15
15
|
</Form.Item>
|
|
16
|
-
|
|
17
16
|
</Flex>
|
|
18
17
|
<Flex gap={5} className="w-full flex justify-between">
|
|
19
18
|
<Form.Item name={[field.name, "x"]} label="Position X">
|
|
@@ -41,21 +40,29 @@ const SectionLabel = () => {
|
|
|
41
40
|
<ColorPicker allowClear format="hex" defaultFormat="hex"/>
|
|
42
41
|
</Form.Item>
|
|
43
42
|
</Flex>
|
|
43
|
+
{fields.length < 2 && (<Flex gap={2} className="w-full">
|
|
44
|
+
<Button
|
|
45
|
+
// type="dashed"
|
|
46
|
+
onClick={() => remove(fields.indexOf(field))} className="w-full">
|
|
47
|
+
Remove
|
|
48
|
+
</Button>
|
|
49
|
+
</Flex>)}
|
|
44
50
|
</div>))}
|
|
45
|
-
<Flex gap={2} className="w-full">
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
<Flex gap={2} className="w-full mt-2">
|
|
52
|
+
{/* <Button
|
|
53
|
+
// type="dashed"
|
|
54
|
+
onClick={() => remove(fields.length - 1)}
|
|
55
|
+
className="w-full"
|
|
56
|
+
>
|
|
57
|
+
Remove
|
|
58
|
+
</Button> */}
|
|
52
59
|
<Button type="primary" onClick={() => add({
|
|
53
60
|
label: "",
|
|
54
61
|
fontColor: "#000000",
|
|
55
62
|
x: 0,
|
|
56
63
|
y: 0,
|
|
57
64
|
fontSize: 12,
|
|
58
|
-
rotation: 0
|
|
65
|
+
rotation: 0,
|
|
59
66
|
})} className="w-full">
|
|
60
67
|
Add
|
|
61
68
|
</Button>
|
|
@@ -42,23 +42,7 @@ const SectionShape = ({ allowChangeShape = true, }) => {
|
|
|
42
42
|
const seatKey = useAppSelector((state) => state.panel.seatDefaultKey);
|
|
43
43
|
const selectedComponent = useAppSelector((state) => state.panel.selectedComponent);
|
|
44
44
|
const maxSeat = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent[seatKey]) || 0;
|
|
45
|
-
return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Shape" }), allowChangeShape && (_jsx(Flex, { gap: 2, className: "w-full", children: _jsx(Form.Item, { label: "Name", name: "shape", className: "w-full", children: _jsx(Select
|
|
46
|
-
// options={optionsShape.map((item) => ({
|
|
47
|
-
// ...item,
|
|
48
|
-
// label:
|
|
49
|
-
// item.value === "table-seat-rect-circle"
|
|
50
|
-
// ? `Type 5 (only for 4 ${seatKey})`
|
|
51
|
-
// : item.label,
|
|
52
|
-
// }))}
|
|
53
|
-
, {
|
|
54
|
-
// options={optionsShape.map((item) => ({
|
|
55
|
-
// ...item,
|
|
56
|
-
// label:
|
|
57
|
-
// item.value === "table-seat-rect-circle"
|
|
58
|
-
// ? `Type 5 (only for 4 ${seatKey})`
|
|
59
|
-
// : item.label,
|
|
60
|
-
// }))}
|
|
61
|
-
className: "w-full", children: optionsShape === null || optionsShape === void 0 ? void 0 : optionsShape.map((item) => {
|
|
45
|
+
return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Shape" }), allowChangeShape && (_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: optionsShape === null || optionsShape === void 0 ? void 0 : optionsShape.map((item) => {
|
|
62
46
|
const disabled = item.value === "table-seat-rect-circle" && maxSeat > 4;
|
|
63
47
|
return (_jsx(Option, { value: item.value, disabled: disabled, children: item.value === "table-seat-rect-circle" ?
|
|
64
48
|
`Type 5 (only for 4 ${seatKey})` : item.label }, item.value));
|
|
@@ -88,7 +72,7 @@ const SectionShape = ({ allowChangeShape = true, }) => {
|
|
|
88
72
|
const num = Number(cleaned);
|
|
89
73
|
if (Number.isNaN(num))
|
|
90
74
|
return null;
|
|
91
|
-
return Math.min(
|
|
75
|
+
return Math.min(100, Math.max(0, num));
|
|
92
76
|
}, suffix: "%" }) }) })] }));
|
|
93
77
|
};
|
|
94
78
|
export default SectionShape;
|
|
@@ -45,15 +45,7 @@ const SectionShape = ({ allowChangeShape = true, }) => {
|
|
|
45
45
|
<h1 className="heading-s">Shape</h1>
|
|
46
46
|
{allowChangeShape && (<Flex gap={2} className="w-full">
|
|
47
47
|
<Form.Item label="Name" name="shape" className="w-full">
|
|
48
|
-
<Select
|
|
49
|
-
// options={optionsShape.map((item) => ({
|
|
50
|
-
// ...item,
|
|
51
|
-
// label:
|
|
52
|
-
// item.value === "table-seat-rect-circle"
|
|
53
|
-
// ? `Type 5 (only for 4 ${seatKey})`
|
|
54
|
-
// : item.label,
|
|
55
|
-
// }))}
|
|
56
|
-
className="w-full">
|
|
48
|
+
<Select className="w-full">
|
|
57
49
|
{optionsShape === null || optionsShape === void 0 ? void 0 : optionsShape.map((item) => {
|
|
58
50
|
const disabled = item.value === "table-seat-rect-circle" && maxSeat > 4;
|
|
59
51
|
return (<Option key={item.value} value={item.value} disabled={disabled}>
|
|
@@ -125,7 +117,7 @@ const SectionShape = ({ allowChangeShape = true, }) => {
|
|
|
125
117
|
const num = Number(cleaned);
|
|
126
118
|
if (Number.isNaN(num))
|
|
127
119
|
return null;
|
|
128
|
-
return Math.min(
|
|
120
|
+
return Math.min(100, Math.max(0, num));
|
|
129
121
|
}} suffix="%"/>
|
|
130
122
|
</Form.Item>
|
|
131
123
|
</Flex>
|
|
@@ -210,14 +210,14 @@ const boardSlice = createSlice({
|
|
|
210
210
|
state.pointer -= 1;
|
|
211
211
|
}
|
|
212
212
|
const prev = state.historyChanges[state.pointer];
|
|
213
|
-
state.components =
|
|
214
|
-
state.extraComponents =
|
|
213
|
+
state.components = prev === null || prev === void 0 ? void 0 : prev.components;
|
|
214
|
+
state.extraComponents = prev === null || prev === void 0 ? void 0 : prev.extraComponents;
|
|
215
215
|
state.boundingBox = prev === null || prev === void 0 ? void 0 : prev.boundingBox;
|
|
216
216
|
state.backgroundColor = prev === null || prev === void 0 ? void 0 : prev.backgroundColor;
|
|
217
217
|
}
|
|
218
218
|
else if (state.pointer === 1) {
|
|
219
|
-
state.components =
|
|
220
|
-
state.extraComponents =
|
|
219
|
+
state.components = (_b = (_a = state.historyChanges) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.components;
|
|
220
|
+
state.extraComponents = (_d = (_c = state.historyChanges) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.extraComponents;
|
|
221
221
|
state.boundingBox = (_f = (_e = state.historyChanges) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.boundingBox;
|
|
222
222
|
state.backgroundColor = (_h = (_g = state.historyChanges) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.backgroundColor;
|
|
223
223
|
state.pointer = 0;
|
|
@@ -340,7 +340,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
340
340
|
const isInitialCreateElemente = toolElement.includes(activeTool) && !isCreateElementRef.current;
|
|
341
341
|
const isInitialCreateBoundingBox = activeTool === "bounding-box";
|
|
342
342
|
const isInitialCreateText = activeTool === "text" && !isCreateElementRef.current;
|
|
343
|
-
console.log({
|
|
343
|
+
// console.log({isInitialCreateText,},isCreateElementRef.current)
|
|
344
344
|
if (isInitialCreateElemente) {
|
|
345
345
|
const tables = createTableGhost({
|
|
346
346
|
x,
|
|
@@ -432,7 +432,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
432
432
|
hadSelectionRef.current = true;
|
|
433
433
|
}
|
|
434
434
|
if (downOutSelectionBox) {
|
|
435
|
-
console.log("downOutSelectionBox");
|
|
435
|
+
// console.log("downOutSelectionBox");
|
|
436
436
|
hadSelectionRef.current = false;
|
|
437
437
|
onMoveSelectionBoxRef.current = false;
|
|
438
438
|
handleUnSelectComponent();
|
|
@@ -854,6 +854,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
854
854
|
const activeId = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id;
|
|
855
855
|
const svg = svgRef.current;
|
|
856
856
|
const { g, element, seats, seatGroup } = getAttributeElement(svg, activeId);
|
|
857
|
+
const isZeroRotate = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.rotation) === 0 && !(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape.includes("circle"));
|
|
857
858
|
const elementSelect = {
|
|
858
859
|
x: selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.x,
|
|
859
860
|
y: selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.y,
|
|
@@ -878,6 +879,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
878
879
|
dy,
|
|
879
880
|
rotate: 0,
|
|
880
881
|
handle: resizeSide,
|
|
882
|
+
isZeroRotate,
|
|
881
883
|
});
|
|
882
884
|
updateSelectionGuides(svg, resultSelection, {
|
|
883
885
|
vLeft: "v-left",
|
|
@@ -890,8 +892,26 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
890
892
|
updateSelectionBox(svg, resultSelection, activeId);
|
|
891
893
|
const scaleX = resultSelection.width / oldSel.width;
|
|
892
894
|
const scaleY = resultSelection.height / oldSel.height;
|
|
893
|
-
|
|
894
|
-
|
|
895
|
+
let newWidth = elementSelect.width * scaleX;
|
|
896
|
+
let newHeight = elementSelect.height * scaleY;
|
|
897
|
+
if (isZeroRotate) {
|
|
898
|
+
if (resizeSide === "right") {
|
|
899
|
+
newWidth = elementSelect.width + dx;
|
|
900
|
+
newHeight = elementSelect.height;
|
|
901
|
+
}
|
|
902
|
+
else if (resizeSide === "bottom") {
|
|
903
|
+
newWidth = elementSelect.width;
|
|
904
|
+
newHeight = elementSelect.height + dy;
|
|
905
|
+
}
|
|
906
|
+
else if (resizeSide === "left") {
|
|
907
|
+
newWidth = elementSelect.width - dx;
|
|
908
|
+
newHeight = elementSelect.height;
|
|
909
|
+
}
|
|
910
|
+
else if (resizeSide === "top") {
|
|
911
|
+
newWidth = elementSelect.width;
|
|
912
|
+
newHeight = elementSelect.height - dy;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
895
915
|
// Jarak relatif element dari pojok kiri atas selection (sebelum resize)
|
|
896
916
|
const relativeX = elementSelect.x - oldSel.x;
|
|
897
917
|
const relativeY = elementSelect.y - oldSel.y;
|
|
@@ -339,7 +339,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
339
339
|
const isInitialCreateElemente = toolElement.includes(activeTool) && !isCreateElementRef.current;
|
|
340
340
|
const isInitialCreateBoundingBox = activeTool === "bounding-box";
|
|
341
341
|
const isInitialCreateText = activeTool === "text" && !isCreateElementRef.current;
|
|
342
|
-
console.log({
|
|
342
|
+
// console.log({isInitialCreateText,},isCreateElementRef.current)
|
|
343
343
|
if (isInitialCreateElemente) {
|
|
344
344
|
const tables = createTableGhost({
|
|
345
345
|
x,
|
|
@@ -431,7 +431,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
431
431
|
hadSelectionRef.current = true;
|
|
432
432
|
}
|
|
433
433
|
if (downOutSelectionBox) {
|
|
434
|
-
console.log("downOutSelectionBox");
|
|
434
|
+
// console.log("downOutSelectionBox");
|
|
435
435
|
hadSelectionRef.current = false;
|
|
436
436
|
onMoveSelectionBoxRef.current = false;
|
|
437
437
|
handleUnSelectComponent();
|
|
@@ -853,6 +853,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
853
853
|
const activeId = selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.id;
|
|
854
854
|
const svg = svgRef.current;
|
|
855
855
|
const { g, element, seats, seatGroup } = getAttributeElement(svg, activeId);
|
|
856
|
+
const isZeroRotate = (selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.rotation) === 0 && !(selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.shape.includes("circle"));
|
|
856
857
|
const elementSelect = {
|
|
857
858
|
x: selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.x,
|
|
858
859
|
y: selectedComponent === null || selectedComponent === void 0 ? void 0 : selectedComponent.y,
|
|
@@ -877,6 +878,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
877
878
|
dy,
|
|
878
879
|
rotate: 0,
|
|
879
880
|
handle: resizeSide,
|
|
881
|
+
isZeroRotate,
|
|
880
882
|
});
|
|
881
883
|
updateSelectionGuides(svg, resultSelection, {
|
|
882
884
|
vLeft: "v-left",
|
|
@@ -889,8 +891,26 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
|
|
|
889
891
|
updateSelectionBox(svg, resultSelection, activeId);
|
|
890
892
|
const scaleX = resultSelection.width / oldSel.width;
|
|
891
893
|
const scaleY = resultSelection.height / oldSel.height;
|
|
892
|
-
|
|
893
|
-
|
|
894
|
+
let newWidth = elementSelect.width * scaleX;
|
|
895
|
+
let newHeight = elementSelect.height * scaleY;
|
|
896
|
+
if (isZeroRotate) {
|
|
897
|
+
if (resizeSide === "right") {
|
|
898
|
+
newWidth = elementSelect.width + dx;
|
|
899
|
+
newHeight = elementSelect.height;
|
|
900
|
+
}
|
|
901
|
+
else if (resizeSide === "bottom") {
|
|
902
|
+
newWidth = elementSelect.width;
|
|
903
|
+
newHeight = elementSelect.height + dy;
|
|
904
|
+
}
|
|
905
|
+
else if (resizeSide === "left") {
|
|
906
|
+
newWidth = elementSelect.width - dx;
|
|
907
|
+
newHeight = elementSelect.height;
|
|
908
|
+
}
|
|
909
|
+
else if (resizeSide === "top") {
|
|
910
|
+
newWidth = elementSelect.width;
|
|
911
|
+
newHeight = elementSelect.height - dy;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
894
914
|
// Jarak relatif element dari pojok kiri atas selection (sebelum resize)
|
|
895
915
|
const relativeX = elementSelect.x - oldSel.x;
|
|
896
916
|
const relativeY = elementSelect.y - oldSel.y;
|
|
@@ -9,7 +9,7 @@ export declare const resizeElementSelection: ({ selectionStart, currentSelection
|
|
|
9
9
|
width: number;
|
|
10
10
|
height: number;
|
|
11
11
|
};
|
|
12
|
-
export declare function resizeBox({ box, dx, dy, rotate, handle }: {
|
|
12
|
+
export declare function resizeBox({ box, dx, dy, rotate, handle, isZeroRotate, }: {
|
|
13
13
|
box: {
|
|
14
14
|
x: number;
|
|
15
15
|
y: number;
|
|
@@ -20,6 +20,7 @@ export declare function resizeBox({ box, dx, dy, rotate, handle }: {
|
|
|
20
20
|
dy: number;
|
|
21
21
|
rotate: number;
|
|
22
22
|
handle: ResizeHandle;
|
|
23
|
+
isZeroRotate?: boolean;
|
|
23
24
|
}): {
|
|
24
25
|
x: number;
|
|
25
26
|
y: number;
|