@searpent/react-image-annotate 2.0.8 → 2.0.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.
- package/Annotator/index.js +97 -74
- package/Annotator/reducers/general-reducer.js +7 -0
- package/GroupsEditorSidebarBox/index.js +148 -0
- package/ImageCanvas/index.js +1 -1
- package/MainLayout/index.js +7 -4
- package/PageSelector/page-selector.css +9 -0
- package/RegionLabel/index.js +9 -2
- package/RegionSelectAndTransformBoxes/index.js +4 -2
- package/RegionSelectorSidebarBox/index.js +7 -1
- package/hooks/use-colors.js +3 -28
- package/package.json +1 -1
- package/site.css +5 -0
package/Annotator/index.js
CHANGED
|
@@ -13,68 +13,82 @@ import historyHandler from "./reducers/history-handler.js";
|
|
|
13
13
|
import imageReducer from "./reducers/image-reducer.js";
|
|
14
14
|
import useEventCallback from "use-event-callback";
|
|
15
15
|
import videoReducer from "./reducers/video-reducer.js";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
16
|
+
|
|
17
|
+
function extractAllowedGroups(images) {
|
|
18
|
+
var allowedGroups = [];
|
|
19
|
+
images.forEach(function (image) {
|
|
20
|
+
return image.regions.forEach(function (_ref) {
|
|
21
|
+
var groupId = _ref.groupId;
|
|
22
|
+
|
|
23
|
+
if (!allowedGroups.includes(groupId)) {
|
|
24
|
+
allowedGroups.push(groupId);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
return allowedGroups;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export var Annotator = function Annotator(_ref2) {
|
|
32
|
+
var images = _ref2.images,
|
|
33
|
+
allowedArea = _ref2.allowedArea,
|
|
34
|
+
_ref2$selectedImage = _ref2.selectedImage,
|
|
35
|
+
selectedImage = _ref2$selectedImage === void 0 ? images && images.length > 0 ? 0 : undefined : _ref2$selectedImage,
|
|
36
|
+
showPointDistances = _ref2.showPointDistances,
|
|
37
|
+
pointDistancePrecision = _ref2.pointDistancePrecision,
|
|
38
|
+
_ref2$showTags = _ref2.showTags,
|
|
39
|
+
showTags = _ref2$showTags === void 0 ? getFromLocalStorage("showTags", true) : _ref2$showTags,
|
|
40
|
+
_ref2$enabledTools = _ref2.enabledTools,
|
|
41
|
+
enabledTools = _ref2$enabledTools === void 0 ? ["select", "create-point", "create-box", "create-polygon", "create-line", "create-expanding-line", "show-mask"] : _ref2$enabledTools,
|
|
42
|
+
_ref2$selectedTool = _ref2.selectedTool,
|
|
43
|
+
selectedTool = _ref2$selectedTool === void 0 ? "select" : _ref2$selectedTool,
|
|
44
|
+
_ref2$regionTagList = _ref2.regionTagList,
|
|
45
|
+
regionTagList = _ref2$regionTagList === void 0 ? [] : _ref2$regionTagList,
|
|
46
|
+
_ref2$regionClsList = _ref2.regionClsList,
|
|
47
|
+
regionClsList = _ref2$regionClsList === void 0 ? [] : _ref2$regionClsList,
|
|
48
|
+
_ref2$imageTagList = _ref2.imageTagList,
|
|
49
|
+
imageTagList = _ref2$imageTagList === void 0 ? [] : _ref2$imageTagList,
|
|
50
|
+
_ref2$imageClsList = _ref2.imageClsList,
|
|
51
|
+
imageClsList = _ref2$imageClsList === void 0 ? [] : _ref2$imageClsList,
|
|
52
|
+
_ref2$keyframes = _ref2.keyframes,
|
|
53
|
+
keyframes = _ref2$keyframes === void 0 ? {} : _ref2$keyframes,
|
|
54
|
+
_ref2$taskDescription = _ref2.taskDescription,
|
|
55
|
+
taskDescription = _ref2$taskDescription === void 0 ? "" : _ref2$taskDescription,
|
|
56
|
+
_ref2$fullImageSegmen = _ref2.fullImageSegmentationMode,
|
|
57
|
+
fullImageSegmentationMode = _ref2$fullImageSegmen === void 0 ? false : _ref2$fullImageSegmen,
|
|
58
|
+
RegionEditLabel = _ref2.RegionEditLabel,
|
|
59
|
+
videoSrc = _ref2.videoSrc,
|
|
60
|
+
_ref2$videoTime = _ref2.videoTime,
|
|
61
|
+
videoTime = _ref2$videoTime === void 0 ? 0 : _ref2$videoTime,
|
|
62
|
+
videoName = _ref2.videoName,
|
|
63
|
+
onExit = _ref2.onExit,
|
|
64
|
+
onNextImage = _ref2.onNextImage,
|
|
65
|
+
onPrevImage = _ref2.onPrevImage,
|
|
66
|
+
keypointDefinitions = _ref2.keypointDefinitions,
|
|
67
|
+
_ref2$autoSegmentatio = _ref2.autoSegmentationOptions,
|
|
68
|
+
autoSegmentationOptions = _ref2$autoSegmentatio === void 0 ? {
|
|
54
69
|
type: "autoseg"
|
|
55
|
-
} :
|
|
56
|
-
hideHeader =
|
|
57
|
-
hideHeaderText =
|
|
58
|
-
hideNext =
|
|
59
|
-
hidePrev =
|
|
60
|
-
hideClone =
|
|
61
|
-
hideSettings =
|
|
62
|
-
hideFullScreen =
|
|
63
|
-
hideSave =
|
|
64
|
-
allowComments =
|
|
65
|
-
onImagesChange =
|
|
66
|
-
groups =
|
|
67
|
-
onGroupSelect =
|
|
68
|
-
hideHistory =
|
|
69
|
-
hideNotEditingLabel =
|
|
70
|
-
showEditor =
|
|
71
|
-
showPageSelector =
|
|
72
|
-
clsColors =
|
|
73
|
-
groupColors =
|
|
74
|
-
onRecalc =
|
|
75
|
-
onSave =
|
|
76
|
-
|
|
77
|
-
metadata = _ref.metadata;
|
|
70
|
+
} : _ref2$autoSegmentatio,
|
|
71
|
+
hideHeader = _ref2.hideHeader,
|
|
72
|
+
hideHeaderText = _ref2.hideHeaderText,
|
|
73
|
+
hideNext = _ref2.hideNext,
|
|
74
|
+
hidePrev = _ref2.hidePrev,
|
|
75
|
+
hideClone = _ref2.hideClone,
|
|
76
|
+
hideSettings = _ref2.hideSettings,
|
|
77
|
+
hideFullScreen = _ref2.hideFullScreen,
|
|
78
|
+
hideSave = _ref2.hideSave,
|
|
79
|
+
allowComments = _ref2.allowComments,
|
|
80
|
+
onImagesChange = _ref2.onImagesChange,
|
|
81
|
+
groups = _ref2.groups,
|
|
82
|
+
onGroupSelect = _ref2.onGroupSelect,
|
|
83
|
+
hideHistory = _ref2.hideHistory,
|
|
84
|
+
hideNotEditingLabel = _ref2.hideNotEditingLabel,
|
|
85
|
+
showEditor = _ref2.showEditor,
|
|
86
|
+
showPageSelector = _ref2.showPageSelector,
|
|
87
|
+
clsColors = _ref2.clsColors,
|
|
88
|
+
groupColors = _ref2.groupColors,
|
|
89
|
+
onRecalc = _ref2.onRecalc,
|
|
90
|
+
onSave = _ref2.onSave,
|
|
91
|
+
metadata = _ref2.metadata;
|
|
78
92
|
|
|
79
93
|
if (typeof selectedImage === "string") {
|
|
80
94
|
selectedImage = (images || []).findIndex(function (img) {
|
|
@@ -83,6 +97,7 @@ export var Annotator = function Annotator(_ref) {
|
|
|
83
97
|
if (selectedImage === -1) selectedImage = undefined;
|
|
84
98
|
}
|
|
85
99
|
|
|
100
|
+
var allowedGroups = extractAllowedGroups(images);
|
|
86
101
|
var annotationType = images ? "image" : "video";
|
|
87
102
|
|
|
88
103
|
var _useReducer = useReducer(historyHandler(combineReducers(annotationType === "image" ? imageReducer : videoReducer, generalReducer)), makeImmutable(_objectSpread({
|
|
@@ -118,7 +133,8 @@ export var Annotator = function Annotator(_ref) {
|
|
|
118
133
|
}, {
|
|
119
134
|
imagesUpdatedAt: null,
|
|
120
135
|
imagesSavedAt: null,
|
|
121
|
-
metadata: metadata
|
|
136
|
+
metadata: metadata,
|
|
137
|
+
allowedGroups: allowedGroups || []
|
|
122
138
|
}))),
|
|
123
139
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
124
140
|
state = _useReducer2[0],
|
|
@@ -147,7 +163,7 @@ export var Annotator = function Annotator(_ref) {
|
|
|
147
163
|
var handleSaveClick =
|
|
148
164
|
/*#__PURE__*/
|
|
149
165
|
function () {
|
|
150
|
-
var
|
|
166
|
+
var _ref3 = _asyncToGenerator(
|
|
151
167
|
/*#__PURE__*/
|
|
152
168
|
_regeneratorRuntime.mark(function _callee(e) {
|
|
153
169
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -179,7 +195,7 @@ export var Annotator = function Annotator(_ref) {
|
|
|
179
195
|
}));
|
|
180
196
|
|
|
181
197
|
return function handleSaveClick(_x) {
|
|
182
|
-
return
|
|
198
|
+
return _ref3.apply(this, arguments);
|
|
183
199
|
};
|
|
184
200
|
}();
|
|
185
201
|
|
|
@@ -191,16 +207,23 @@ export var Annotator = function Annotator(_ref) {
|
|
|
191
207
|
}
|
|
192
208
|
};
|
|
193
209
|
|
|
194
|
-
var handleMetadataChange = function handleMetadataChange(
|
|
195
|
-
var name =
|
|
196
|
-
value =
|
|
197
|
-
imageIndex =
|
|
210
|
+
var handleMetadataChange = function handleMetadataChange(_ref4) {
|
|
211
|
+
var name = _ref4.name,
|
|
212
|
+
value = _ref4.value,
|
|
213
|
+
imageIndex = _ref4.imageIndex;
|
|
198
214
|
dispatchToReducer({
|
|
199
215
|
type: "UPDATE_METADATA",
|
|
200
216
|
name: name,
|
|
201
217
|
value: value,
|
|
202
218
|
imageIndex: imageIndex
|
|
203
219
|
});
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
var handleAddGroup = function handleAddGroup(group) {
|
|
223
|
+
dispatchToReducer({
|
|
224
|
+
type: "ADD_GROUP",
|
|
225
|
+
group: group
|
|
226
|
+
});
|
|
204
227
|
}; // trigger this on every BBox manipulation (there is currently no way to detect adding of new box!)
|
|
205
228
|
|
|
206
229
|
|
|
@@ -228,10 +251,10 @@ export var Annotator = function Annotator(_ref) {
|
|
|
228
251
|
}, [onImagesChange, selectedImage]);
|
|
229
252
|
if (!images && !videoSrc) return 'Missing required prop "images" or "videoSrc"';
|
|
230
253
|
|
|
231
|
-
var
|
|
232
|
-
|
|
233
|
-
recalcActive =
|
|
234
|
-
saveActive =
|
|
254
|
+
var _ref5 = state.imagesSavedAt < state.imagesUpdatedAt ? [true, true] : [false, false],
|
|
255
|
+
_ref6 = _slicedToArray(_ref5, 2),
|
|
256
|
+
recalcActive = _ref6[0],
|
|
257
|
+
saveActive = _ref6[1];
|
|
235
258
|
|
|
236
259
|
return React.createElement(SettingsProvider, {
|
|
237
260
|
clsColors: clsColors,
|
|
@@ -261,8 +284,8 @@ export var Annotator = function Annotator(_ref) {
|
|
|
261
284
|
onSave: handleSaveClick,
|
|
262
285
|
saveActive: recalcActive,
|
|
263
286
|
recalcActive: saveActive,
|
|
264
|
-
|
|
265
|
-
|
|
287
|
+
onMetadataChange: handleMetadataChange,
|
|
288
|
+
onAddGroup: handleAddGroup
|
|
266
289
|
}));
|
|
267
290
|
};
|
|
268
291
|
export default Annotator;
|
|
@@ -1144,6 +1144,13 @@ export default (function (state, action) {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
1146
|
|
|
1147
|
+
case "ADD_GROUP":
|
|
1148
|
+
{
|
|
1149
|
+
var group = action.group;
|
|
1150
|
+
var newAllowedGroups = [].concat(_toConsumableArray(state.allowedGroups), [group]);
|
|
1151
|
+
return setIn(state, ["allowedGroups"], newAllowedGroups);
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1147
1154
|
default:
|
|
1148
1155
|
break;
|
|
1149
1156
|
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { memo, useState } from "react";
|
|
3
|
+
import SidebarBoxContainer from "../SidebarBoxContainer";
|
|
4
|
+
import FilterNoneIcon from '@mui/icons-material/FilterNone';
|
|
5
|
+
import { styled } from "@mui/material/styles";
|
|
6
|
+
import { createTheme, ThemeProvider } from "@mui/material/styles";
|
|
7
|
+
import { grey } from "@mui/material/colors";
|
|
8
|
+
var theme = createTheme();
|
|
9
|
+
var GroupItemDiv = styled("div")(function (_ref) {
|
|
10
|
+
var theme = _ref.theme;
|
|
11
|
+
return {
|
|
12
|
+
display: "flex",
|
|
13
|
+
flexDirection: "column",
|
|
14
|
+
marginBottom: "1rem",
|
|
15
|
+
"& > label": {
|
|
16
|
+
fontSize: "1rem",
|
|
17
|
+
marginBottom: ".5rem",
|
|
18
|
+
textTransform: "capitalize"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
var GroupItem = function GroupItem(_ref2) {
|
|
24
|
+
var group = _ref2.group;
|
|
25
|
+
// const handleDelete = e => {
|
|
26
|
+
// e.preventDefault()
|
|
27
|
+
// const { value } = e.target
|
|
28
|
+
// console.log("deleting group:", value)
|
|
29
|
+
// }
|
|
30
|
+
return React.createElement(GroupItemDiv, null, group);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var GroupList = function GroupList(_ref3) {
|
|
34
|
+
var groups = _ref3.groups;
|
|
35
|
+
return React.createElement("div", null, React.createElement("h2", null, "Groups"), groups.map(function (g) {
|
|
36
|
+
return React.createElement(GroupItem, {
|
|
37
|
+
key: g,
|
|
38
|
+
group: g
|
|
39
|
+
});
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
var AddGroupFormDiv = styled("div")(function (_ref4) {
|
|
44
|
+
var theme = _ref4.theme;
|
|
45
|
+
return {
|
|
46
|
+
display: "flex",
|
|
47
|
+
flexDirection: "row" // marginBottom: "1rem",
|
|
48
|
+
// "& > label": {
|
|
49
|
+
// fontSize: "1rem",
|
|
50
|
+
// marginBottom: ".5rem",
|
|
51
|
+
// textTransform: "capitalize"
|
|
52
|
+
// }
|
|
53
|
+
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
var AddGroupFrom = function AddGroupFrom(_ref5) {
|
|
58
|
+
var onAddGroup = _ref5.onAddGroup;
|
|
59
|
+
|
|
60
|
+
var _useState = useState(""),
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
value = _useState2[0],
|
|
63
|
+
setValue = _useState2[1];
|
|
64
|
+
|
|
65
|
+
var handleChange = function handleChange(e) {
|
|
66
|
+
setValue(e.target.value);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var handleSubmit = function handleSubmit(e) {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
onAddGroup(value);
|
|
72
|
+
setValue('');
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return React.createElement(AddGroupFormDiv, null, React.createElement("form", {
|
|
76
|
+
onSubmit: handleSubmit,
|
|
77
|
+
style: {
|
|
78
|
+
display: "flex",
|
|
79
|
+
paddingRight: "6px"
|
|
80
|
+
}
|
|
81
|
+
}, React.createElement("input", {
|
|
82
|
+
type: "text",
|
|
83
|
+
value: value,
|
|
84
|
+
name: "new-group",
|
|
85
|
+
placeholder: "New group name",
|
|
86
|
+
onChange: handleChange,
|
|
87
|
+
style: {
|
|
88
|
+
marginRight: "1rem"
|
|
89
|
+
}
|
|
90
|
+
}), React.createElement("input", {
|
|
91
|
+
type: "submit",
|
|
92
|
+
value: "Create group"
|
|
93
|
+
})));
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
var DivContainer = styled("div")(function (_ref6) {
|
|
97
|
+
var theme = _ref6.theme;
|
|
98
|
+
return {
|
|
99
|
+
paddingLeft: 16,
|
|
100
|
+
paddingRight: 16,
|
|
101
|
+
fontSize: 12,
|
|
102
|
+
"& h1": {
|
|
103
|
+
fontSize: 18
|
|
104
|
+
},
|
|
105
|
+
"& h2": {
|
|
106
|
+
fontSize: 14
|
|
107
|
+
},
|
|
108
|
+
"& h3": {
|
|
109
|
+
fontSize: 12
|
|
110
|
+
},
|
|
111
|
+
"& h4": {
|
|
112
|
+
fontSize: 12
|
|
113
|
+
},
|
|
114
|
+
"& h5": {
|
|
115
|
+
fontSize: 12
|
|
116
|
+
},
|
|
117
|
+
"& h6": {
|
|
118
|
+
fontSize: 12
|
|
119
|
+
},
|
|
120
|
+
"& p": {
|
|
121
|
+
fontSize: 12
|
|
122
|
+
},
|
|
123
|
+
"& a": {},
|
|
124
|
+
"& img": {
|
|
125
|
+
width: "100%"
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
export var GroupsEditorSidebarBox = function GroupsEditorSidebarBox(_ref7) {
|
|
130
|
+
var groups = _ref7.groups,
|
|
131
|
+
onAddGroup = _ref7.onAddGroup;
|
|
132
|
+
return React.createElement(ThemeProvider, {
|
|
133
|
+
theme: theme
|
|
134
|
+
}, React.createElement(SidebarBoxContainer, {
|
|
135
|
+
title: "Groups",
|
|
136
|
+
icon: React.createElement(FilterNoneIcon, {
|
|
137
|
+
style: {
|
|
138
|
+
color: grey[700]
|
|
139
|
+
}
|
|
140
|
+
}),
|
|
141
|
+
expandedByDefault: true
|
|
142
|
+
}, React.createElement(DivContainer, null, React.createElement("h2", null, "Add new group"), React.createElement(AddGroupFrom, {
|
|
143
|
+
onAddGroup: onAddGroup
|
|
144
|
+
}), React.createElement(GroupList, {
|
|
145
|
+
groups: groups
|
|
146
|
+
}))));
|
|
147
|
+
};
|
|
148
|
+
export default memo(GroupsEditorSidebarBox);
|
package/ImageCanvas/index.js
CHANGED
package/MainLayout/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import SettingsDialog from "../SettingsDialog";
|
|
|
18
18
|
import TagsSidebarBox from "../TagsSidebarBox";
|
|
19
19
|
import TaskDescription from "../TaskDescriptionSidebarBox";
|
|
20
20
|
import MetadataEditor from "../MetadataEditorSidebarBox";
|
|
21
|
+
import GroupsEditor from "../GroupsEditorSidebarBox";
|
|
21
22
|
import Workspace from "react-material-workspace-layout/Workspace";
|
|
22
23
|
import classnames from "classnames";
|
|
23
24
|
import getActiveImage from "../Annotator/reducers/get-active-image";
|
|
@@ -113,9 +114,8 @@ export var MainLayout = function MainLayout(_ref4) {
|
|
|
113
114
|
recalcActive = _ref4$recalcActive === void 0 ? false : _ref4$recalcActive,
|
|
114
115
|
_ref4$saveActive = _ref4.saveActive,
|
|
115
116
|
saveActive = _ref4$saveActive === void 0 ? false : _ref4$saveActive,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
onMetadataChange = _ref4.onMetadataChange;
|
|
117
|
+
onMetadataChange = _ref4.onMetadataChange,
|
|
118
|
+
onAddGroup = _ref4.onAddGroup;
|
|
119
119
|
var classes = useStyles();
|
|
120
120
|
var settings = useSettings();
|
|
121
121
|
var fullScreenHandle = useFullScreenHandle();
|
|
@@ -223,7 +223,7 @@ export var MainLayout = function MainLayout(_ref4) {
|
|
|
223
223
|
onRegionClassAdded: onRegionClassAdded,
|
|
224
224
|
allowComments: state.allowComments,
|
|
225
225
|
hideNotEditingLabel: hideNotEditingLabel,
|
|
226
|
-
allowedGroups: allowedGroups
|
|
226
|
+
allowedGroups: state.allowedGroups
|
|
227
227
|
}));
|
|
228
228
|
var onClickIconSidebarItem = useEventCallback(function (item) {
|
|
229
229
|
dispatch({
|
|
@@ -447,6 +447,9 @@ export var MainLayout = function MainLayout(_ref4) {
|
|
|
447
447
|
}), React.createElement(MetadataEditor, {
|
|
448
448
|
state: state,
|
|
449
449
|
onMetadataChange: onMetadataChange
|
|
450
|
+
}), React.createElement(GroupsEditor, {
|
|
451
|
+
groups: state.allowedGroups,
|
|
452
|
+
onAddGroup: onAddGroup
|
|
450
453
|
})].filter(Boolean)
|
|
451
454
|
}, canvas), showEditor && React.createElement(EditorWrapper, {
|
|
452
455
|
id: "editor-wrapper"
|
|
@@ -50,6 +50,15 @@
|
|
|
50
50
|
width: 100%;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
.bottom-buttons button:hover {
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.bottom-buttons button:disabled {
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
opacity: .5;
|
|
60
|
+
}
|
|
61
|
+
|
|
53
62
|
.bottom-buttons button.info {
|
|
54
63
|
background-color: transparent;
|
|
55
64
|
border-radius: 0.5rem;
|
package/RegionLabel/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread";
|
|
2
3
|
import React, { useRef, memo } from "react";
|
|
3
4
|
import Paper from "@mui/material/Paper";
|
|
@@ -40,6 +41,12 @@ export var RegionLabel = function RegionLabel(_ref) {
|
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
if (hideNotEditingLabel && !editing) return null;
|
|
44
|
+
var allowedGroupsForSelect = allowedGroups.map(function (g) {
|
|
45
|
+
return {
|
|
46
|
+
value: "".concat(g),
|
|
47
|
+
label: "".concat(g)
|
|
48
|
+
};
|
|
49
|
+
});
|
|
43
50
|
return React.createElement(ThemeProvider, {
|
|
44
51
|
theme: theme
|
|
45
52
|
}, React.createElement(Paper, {
|
|
@@ -137,10 +144,10 @@ export var RegionLabel = function RegionLabel(_ref) {
|
|
|
137
144
|
}));
|
|
138
145
|
},
|
|
139
146
|
placeholder: "Group",
|
|
140
|
-
value:
|
|
147
|
+
value: allowedGroupsForSelect.find(function (g) {
|
|
141
148
|
return g.value === region.groupId;
|
|
142
149
|
}),
|
|
143
|
-
options:
|
|
150
|
+
options: _toConsumableArray(allowedGroupsForSelect)
|
|
144
151
|
}), (allowedTags || []).length > 0 && React.createElement("div", {
|
|
145
152
|
style: {
|
|
146
153
|
marginTop: 4
|
|
@@ -11,8 +11,10 @@ var TransformGrabber = styled("div")(function (_ref) {
|
|
|
11
11
|
return {
|
|
12
12
|
width: 8,
|
|
13
13
|
height: 8,
|
|
14
|
-
zIndex:
|
|
15
|
-
|
|
14
|
+
zIndex: 10,
|
|
15
|
+
backgroundColor: "#454545",
|
|
16
|
+
border: "2px solid black",
|
|
17
|
+
borderRadius: "50%",
|
|
16
18
|
position: "absolute"
|
|
17
19
|
};
|
|
18
20
|
});
|
|
@@ -18,6 +18,7 @@ import VisibleOffIcon from "@mui/icons-material/VisibilityOff";
|
|
|
18
18
|
import styles from "./styles";
|
|
19
19
|
import classnames from "classnames";
|
|
20
20
|
import isEqual from "lodash/isEqual";
|
|
21
|
+
import useColors from "../hooks/use-colors";
|
|
21
22
|
var theme = createTheme();
|
|
22
23
|
var useStyles = makeStyles(function (theme) {
|
|
23
24
|
return styles;
|
|
@@ -151,6 +152,11 @@ var Row = function Row(_ref4) {
|
|
|
151
152
|
color = _ref4.color,
|
|
152
153
|
cls = _ref4.cls,
|
|
153
154
|
index = _ref4.index;
|
|
155
|
+
|
|
156
|
+
var _useColors = useColors(),
|
|
157
|
+
groupColor = _useColors.groupColor;
|
|
158
|
+
|
|
159
|
+
var gc = groupColor(r.groupId);
|
|
154
160
|
return React.createElement(RowLayout, {
|
|
155
161
|
header: false,
|
|
156
162
|
highlighted: highlighted,
|
|
@@ -160,7 +166,7 @@ var Row = function Row(_ref4) {
|
|
|
160
166
|
order: "#".concat(index + 1),
|
|
161
167
|
classification: React.createElement(Chip, {
|
|
162
168
|
text: cls || "",
|
|
163
|
-
color: color || "
|
|
169
|
+
color: color || gc || "lime"
|
|
164
170
|
}),
|
|
165
171
|
area: "",
|
|
166
172
|
trash: React.createElement(TrashIcon, {
|
package/hooks/use-colors.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useSettings } from "../SettingsProvider";
|
|
2
|
+
var DEFAULT_GROUP_COLOR = "#32CD32";
|
|
2
3
|
|
|
3
4
|
function defaultClsColor(cls) {
|
|
4
5
|
switch (cls) {
|
|
@@ -49,28 +50,6 @@ function defaultClsColor(cls) {
|
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
function defaultGroupColor(groupId) {
|
|
53
|
-
switch (groupId) {
|
|
54
|
-
case "0":
|
|
55
|
-
return "#FDDFDF";
|
|
56
|
-
|
|
57
|
-
case "1":
|
|
58
|
-
return "#FCF7DE";
|
|
59
|
-
|
|
60
|
-
case "2":
|
|
61
|
-
return "#DEFDE0";
|
|
62
|
-
|
|
63
|
-
case "3":
|
|
64
|
-
return "#DEF3FD";
|
|
65
|
-
|
|
66
|
-
case "4":
|
|
67
|
-
return "#F0DEFD";
|
|
68
|
-
|
|
69
|
-
default:
|
|
70
|
-
return "#F0DEFD";
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
53
|
var useColors = function useColors() {
|
|
75
54
|
var _useSettings = useSettings(),
|
|
76
55
|
clsColors = _useSettings.clsColors,
|
|
@@ -84,12 +63,8 @@ var useColors = function useColors() {
|
|
|
84
63
|
return defaultClsColor(cls);
|
|
85
64
|
};
|
|
86
65
|
|
|
87
|
-
var groupColor = function groupColor(
|
|
88
|
-
|
|
89
|
-
return groupColors[groupId];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return defaultGroupColor(groupId);
|
|
66
|
+
var groupColor = function groupColor(idx) {
|
|
67
|
+
return groupColors[idx % groupColors.length] || DEFAULT_GROUP_COLOR;
|
|
93
68
|
};
|
|
94
69
|
|
|
95
70
|
return {
|
package/package.json
CHANGED