seat-editor 3.6.10 → 3.6.11
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.
|
@@ -106,6 +106,11 @@ export interface LayerViewProps<TMeta = undefined> {
|
|
|
106
106
|
isSelectNode?: boolean;
|
|
107
107
|
onMakeSelection?: (component: ComponentProps<TMeta>[]) => void;
|
|
108
108
|
onDragTable?: (e: React.PointerEvent<SVGSVGElement>, component: ComponentProps<TMeta>) => void;
|
|
109
|
+
groupSelection?: {
|
|
110
|
+
colorGroupSelection: string[];
|
|
111
|
+
dataKey: string;
|
|
112
|
+
selection: Record<number, string[]>;
|
|
113
|
+
};
|
|
109
114
|
}
|
|
110
115
|
declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
|
|
111
116
|
export default LayerView;
|
|
@@ -28,7 +28,7 @@ const LayerView = (props) => {
|
|
|
28
28
|
dragTable: false,
|
|
29
29
|
selectNode: false,
|
|
30
30
|
connectingNode: false
|
|
31
|
-
}, onMakeSelection
|
|
31
|
+
}, onMakeSelection } = props;
|
|
32
32
|
const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
|
|
33
33
|
const tableGhost = useRef(null);
|
|
34
34
|
const hoverUnderghostId = useRef(null);
|
|
@@ -27,7 +27,7 @@ const LayerView = (props) => {
|
|
|
27
27
|
dragTable: false,
|
|
28
28
|
selectNode: false,
|
|
29
29
|
connectingNode: false
|
|
30
|
-
}, onMakeSelection
|
|
30
|
+
}, onMakeSelection } = props;
|
|
31
31
|
const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
|
|
32
32
|
const tableGhost = useRef(null);
|
|
33
33
|
const hoverUnderghostId = useRef(null);
|
|
@@ -55,4 +55,8 @@ export declare const renderElements: (elementEditor: ComponentProps[], mappingKe
|
|
|
55
55
|
x: number;
|
|
56
56
|
y: number;
|
|
57
57
|
};
|
|
58
|
-
} | null
|
|
58
|
+
} | null, groupSelection?: {
|
|
59
|
+
colorGroupSelection: string[];
|
|
60
|
+
dataKey: string;
|
|
61
|
+
selection: Record<number, string[]>;
|
|
62
|
+
}) => ComponentProps[];
|
|
@@ -25,9 +25,7 @@ export const getRectEdge = (from, to, width, height) => {
|
|
|
25
25
|
const localAngle = angle + rad;
|
|
26
26
|
const absCos = Math.abs(Math.cos(localAngle));
|
|
27
27
|
const absSin = Math.abs(Math.sin(localAngle));
|
|
28
|
-
const offset = (h / 2) * absCos <= (w / 2) * absSin
|
|
29
|
-
? (h / 2) / absSin
|
|
30
|
-
: (w / 2) / absCos;
|
|
28
|
+
const offset = (h / 2) * absCos <= (w / 2) * absSin ? h / 2 / absSin : w / 2 / absCos;
|
|
31
29
|
const localEdgeX = Math.cos(localAngle) * offset;
|
|
32
30
|
const localEdgeY = Math.sin(localAngle) * offset;
|
|
33
31
|
const worldEdge = rotatePoint(localEdgeX, localEdgeY, rotation);
|
|
@@ -67,7 +65,13 @@ export const buildPath = (points) => {
|
|
|
67
65
|
return d;
|
|
68
66
|
};
|
|
69
67
|
// ─── renderElements ──────────────────────────────────────────────────────────
|
|
70
|
-
|
|
68
|
+
const findIndexByValue = (obj, targetValue) => {
|
|
69
|
+
if (!obj || targetValue)
|
|
70
|
+
return undefined;
|
|
71
|
+
const foundEntry = Object.entries(obj).find(([_, values]) => values.includes(targetValue));
|
|
72
|
+
return foundEntry ? Number(foundEntry[0]) : undefined;
|
|
73
|
+
};
|
|
74
|
+
export const renderElements = (elementEditor, mappingKey, tableMatchKey, connecting, groupSelection) => {
|
|
71
75
|
return elementEditor.map((editorItem) => {
|
|
72
76
|
var _a, _b;
|
|
73
77
|
const isUsingMapping = mappingKey &&
|
|
@@ -80,7 +84,22 @@ export const renderElements = (elementEditor, mappingKey, tableMatchKey, connect
|
|
|
80
84
|
if (hasKey)
|
|
81
85
|
return item.value == (editorItem === null || editorItem === void 0 ? void 0 : editorItem[item.key]);
|
|
82
86
|
});
|
|
83
|
-
|
|
87
|
+
// console.log({ finalProps })
|
|
88
|
+
const findIndexSelection = findIndexByValue(groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.selection, finalProps === null || finalProps === void 0 ? void 0 : finalProps[groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.dataKey]);
|
|
89
|
+
let fill = finalProps === null || finalProps === void 0 ? void 0 : finalProps.fill;
|
|
90
|
+
if (findIndexSelection) {
|
|
91
|
+
fill = groupSelection === null || groupSelection === void 0 ? void 0 : groupSelection.colorGroupSelection[findIndexSelection];
|
|
92
|
+
}
|
|
93
|
+
if ((_a = tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.properties) === null || _a === void 0 ? void 0 : _a.fill) {
|
|
94
|
+
fill = (_b = tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.properties) === null || _b === void 0 ? void 0 : _b.fill;
|
|
95
|
+
}
|
|
96
|
+
if ((connecting === null || connecting === void 0 ? void 0 : connecting.fromId) == (finalProps === null || finalProps === void 0 ? void 0 : finalProps.id)) {
|
|
97
|
+
fill = "#7239EA";
|
|
98
|
+
}
|
|
99
|
+
// fill =
|
|
100
|
+
// connecting?.fromId == finalProps?.id
|
|
101
|
+
// ? "#7239EA"
|
|
102
|
+
// : tableMatch?.properties?.fill ?? finalProps?.fill;
|
|
84
103
|
finalProps = Object.assign(Object.assign(Object.assign({}, finalProps), tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.properties), { fill: fill, className: tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.className, element: tableMatch === null || tableMatch === void 0 ? void 0 : tableMatch.element });
|
|
85
104
|
}
|
|
86
105
|
return finalProps;
|