seat-editor 3.3.8 → 3.3.10
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,15 +1,12 @@
|
|
|
1
1
|
import { RefsType } from "../board-v3";
|
|
2
|
+
import { OnCurrentStateChange } from "../view-only-3";
|
|
2
3
|
import { PropertiesProps } from "../../dto/table";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
background: string;
|
|
10
|
-
boundingBox: PropertiesProps | null;
|
|
11
|
-
}) => void;
|
|
12
|
-
onSelectComponent?: (component: PropertiesProps) => void;
|
|
4
|
+
import { ComponentProps } from "../view-only-3/index";
|
|
5
|
+
export interface TableEditorProps<TMeta = undefined> {
|
|
6
|
+
componentProps: ComponentProps<TMeta>[];
|
|
7
|
+
extraComponentProps: ComponentProps<TMeta>[];
|
|
8
|
+
onCurrentStateChange: OnCurrentStateChange<TMeta>;
|
|
9
|
+
onSelectComponent?: (component: ComponentProps<TMeta>) => void;
|
|
13
10
|
mappingKey?: string;
|
|
14
11
|
selectedTableColor?: string;
|
|
15
12
|
colorMatchKey?: [
|
|
@@ -38,7 +38,7 @@ const TableEditor = (props) => {
|
|
|
38
38
|
}, [viewOnly]);
|
|
39
39
|
const onUpdateCurrentState = () => {
|
|
40
40
|
let matchInitialValueWithComponents = initialValue === null || initialValue === void 0 ? void 0 : initialValue.map((item) => {
|
|
41
|
-
if (mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
|
|
41
|
+
if (item && mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
|
|
42
42
|
let findComponent = components === null || components === void 0 ? void 0 : components.find((c) => { var _a; return c.id === ((_a = item === null || item === void 0 ? void 0 : item[mappingKey]) === null || _a === void 0 ? void 0 : _a.id); });
|
|
43
43
|
if (!findComponent)
|
|
44
44
|
return undefined;
|
|
@@ -58,8 +58,10 @@ const TableEditor = (props) => {
|
|
|
58
58
|
const hasUndefined = matchInitialValueWithComponents === null || matchInitialValueWithComponents === void 0 ? void 0 : matchInitialValueWithComponents.some((item) => item === undefined);
|
|
59
59
|
if (!hasUndefined && !viewOnly) {
|
|
60
60
|
onCurrentStateChange({
|
|
61
|
+
// @ts-ignore
|
|
61
62
|
components: matchInitialValueWithComponents,
|
|
62
|
-
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
extraComponents: extraComponents,
|
|
63
65
|
background: backgroundColor,
|
|
64
66
|
boundingBox,
|
|
65
67
|
});
|
|
@@ -74,45 +76,20 @@ const TableEditor = (props) => {
|
|
|
74
76
|
}, [components, extraComponents, backgroundColor]);
|
|
75
77
|
const convertComponentProps = () => {
|
|
76
78
|
let mappingData = componentProps === null || componentProps === void 0 ? void 0 : componentProps.map((item) => {
|
|
77
|
-
if (mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
|
|
78
|
-
return Object.assign({}, item === null || item === void 0 ? void 0 : item[mappingKey]);
|
|
79
|
+
if (item && mappingKey && (item === null || item === void 0 ? void 0 : item[mappingKey])) {
|
|
80
|
+
return Object.assign({}, (typeof (item === null || item === void 0 ? void 0 : item[mappingKey]) === "object" && (item === null || item === void 0 ? void 0 : item[mappingKey]) !== null ? item === null || item === void 0 ? void 0 : item[mappingKey] : {}));
|
|
79
81
|
}
|
|
80
82
|
return item;
|
|
81
83
|
});
|
|
82
84
|
return mappingData;
|
|
83
85
|
};
|
|
84
86
|
useEffect(() => {
|
|
85
|
-
// const isEmptyComponents = components?.length === 0
|
|
86
|
-
// const isEmptyExtraComponents = extraComponents?.length === 0;
|
|
87
|
-
// // const isEmptyBoundingBox = boundingBox === null;
|
|
88
|
-
// if(isEmptyComponents){
|
|
89
|
-
// dispatch({
|
|
90
|
-
// type: "board/setInitialValue",
|
|
91
|
-
// payload: {
|
|
92
|
-
// components: [],
|
|
93
|
-
// extraComponents: extraComponents,
|
|
94
|
-
// backgroundColor: props?.defaultBackground,
|
|
95
|
-
// boundingBox: props?.defaultBoundingBox || null,
|
|
96
|
-
// },
|
|
97
|
-
// });
|
|
98
|
-
// }
|
|
99
|
-
// if(isEmptyExtraComponents){
|
|
100
|
-
// dispatch({
|
|
101
|
-
// type: "board/setInitialValue",
|
|
102
|
-
// payload: {
|
|
103
|
-
// components: components,
|
|
104
|
-
// extraComponents: [],
|
|
105
|
-
// backgroundColor: props?.defaultBackground,
|
|
106
|
-
// boundingBox: props?.defaultBoundingBox || null,
|
|
107
|
-
// },
|
|
108
|
-
// })
|
|
109
|
-
// }
|
|
110
87
|
const initialComponent = !isEqual(components, convertComponentProps()) && componentProps;
|
|
111
88
|
const initialExtraComponent = !isEqual(extraComponents, extraComponentProps) && extraComponentProps;
|
|
112
89
|
if (initialComponent || initialExtraComponent) {
|
|
113
90
|
let mappingData = componentProps === null || componentProps === void 0 ? void 0 : componentProps.map((item) => {
|
|
114
|
-
if (mappingKey && (item === null || item === void 0 ? void 0 : item[props.mappingKey])) {
|
|
115
|
-
return Object.assign({}, item[props.mappingKey]);
|
|
91
|
+
if (item && mappingKey && (item === null || item === void 0 ? void 0 : item[props.mappingKey])) {
|
|
92
|
+
return Object.assign({}, (typeof item[props.mappingKey] === "object" && item[props.mappingKey] !== null ? item[props.mappingKey] : {}));
|
|
116
93
|
}
|
|
117
94
|
return item;
|
|
118
95
|
});
|
|
@@ -134,19 +111,30 @@ const TableEditor = (props) => {
|
|
|
134
111
|
// });
|
|
135
112
|
dispatch({ type: "board/setFlagChange", payload: true });
|
|
136
113
|
}
|
|
137
|
-
//
|
|
114
|
+
// const isEmptyComponents = components?.length === 0
|
|
115
|
+
// const isEmptyExtraComponents = extraComponents?.length === 0;
|
|
116
|
+
// // const isEmptyBoundingBox = boundingBox === null;
|
|
117
|
+
// if(isEmptyComponents){
|
|
138
118
|
// dispatch({
|
|
139
|
-
// type: "board/
|
|
140
|
-
// payload:
|
|
119
|
+
// type: "board/setInitialValue",
|
|
120
|
+
// payload: {
|
|
121
|
+
// components: [],
|
|
122
|
+
// extraComponents: extraComponents,
|
|
123
|
+
// backgroundColor: props?.defaultBackground,
|
|
124
|
+
// boundingBox: props?.defaultBoundingBox || null,
|
|
125
|
+
// },
|
|
141
126
|
// });
|
|
142
|
-
// dispatch({ type: "board/setFlagChange", payload: true });
|
|
143
127
|
// }
|
|
144
|
-
// if
|
|
128
|
+
// if(isEmptyExtraComponents){
|
|
145
129
|
// dispatch({
|
|
146
|
-
// type: "board/
|
|
147
|
-
// payload:
|
|
148
|
-
//
|
|
149
|
-
//
|
|
130
|
+
// type: "board/setInitialValue",
|
|
131
|
+
// payload: {
|
|
132
|
+
// components: components,
|
|
133
|
+
// extraComponents: [],
|
|
134
|
+
// backgroundColor: props?.defaultBackground,
|
|
135
|
+
// boundingBox: props?.defaultBoundingBox || null,
|
|
136
|
+
// },
|
|
137
|
+
// })
|
|
150
138
|
// }
|
|
151
139
|
}, [componentProps, extraComponentProps, props === null || props === void 0 ? void 0 : props.defaultBackground]);
|
|
152
140
|
return (<>
|
|
@@ -18,9 +18,11 @@ export type TableMatchEvent = {
|
|
|
18
18
|
export type ComponentProps<T = undefined> = PropertiesProps & T & {
|
|
19
19
|
[key: string]: PropertiesProps;
|
|
20
20
|
};
|
|
21
|
-
export type OnCurrentStateChange<TMeta = undefined> = ({ components, extraComponents, }: {
|
|
21
|
+
export type OnCurrentStateChange<TMeta = undefined> = ({ components, extraComponents, background, boundingBox, }: {
|
|
22
22
|
components: ComponentProps<TMeta>[];
|
|
23
23
|
extraComponents: ComponentProps<TMeta>[];
|
|
24
|
+
background: string;
|
|
25
|
+
boundingBox: PropertiesProps | null;
|
|
24
26
|
}) => void;
|
|
25
27
|
export type TransformProps = React.ForwardRefExoticComponent<Omit<ReactZoomPanPinchProps, "ref"> & React.RefAttributes<ReactZoomPanPinchContentRef>>;
|
|
26
28
|
export type RefLayerView = {
|
|
@@ -38,7 +38,7 @@ const LayerView = (props) => {
|
|
|
38
38
|
}));
|
|
39
39
|
const dispatch = useAppDispatch();
|
|
40
40
|
useEffect(() => {
|
|
41
|
-
if (!loading) {
|
|
41
|
+
if (!loading && (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state)) {
|
|
42
42
|
dispatch({ type: "panel/setLoading", payload: true });
|
|
43
43
|
}
|
|
44
44
|
// check in null
|
|
@@ -80,7 +80,7 @@ const LayerView = (props) => {
|
|
|
80
80
|
setTimeout(() => {
|
|
81
81
|
dispatch({ type: "panel/setLoading", payload: false });
|
|
82
82
|
}, 1000);
|
|
83
|
-
}, [componentProps, extraComponentProps, defaultBackground]);
|
|
83
|
+
}, [componentProps, extraComponentProps, defaultBackground, loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state]);
|
|
84
84
|
useEffect(() => {
|
|
85
85
|
setTooltip(Object.assign(Object.assign({}, tooltip), { visible: false }));
|
|
86
86
|
}, [privilegedTags]);
|
|
@@ -89,6 +89,8 @@ const LayerView = (props) => {
|
|
|
89
89
|
onCurrentStateChange({
|
|
90
90
|
components: componentsEditor,
|
|
91
91
|
extraComponents: extraComponentsEditor,
|
|
92
|
+
background: backgroundColor,
|
|
93
|
+
boundingBox: boundingBoxProps,
|
|
92
94
|
});
|
|
93
95
|
}, [componentsEditor, extraComponentsEditor]);
|
|
94
96
|
const originalData = ({ id, type, dataParams, }) => {
|