@konfuzio/document-validation-ui 0.1.58 → 0.1.59-dev.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfuzio/document-validation-ui",
3
- "version": "0.1.58",
3
+ "version": "0.1.59-dev.1",
4
4
  "repository": "git://github.com:konfuzio-ai/document-validation-ui.git",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -6,7 +6,6 @@
6
6
  position: relative;
7
7
  display: flex;
8
8
  flex-direction: column;
9
- height: 100%;
10
9
 
11
10
  &.disabled {
12
11
  pointer-events: none;
@@ -244,8 +244,24 @@ export default {
244
244
  document.body.removeEventListener("click", this.clickOutside);
245
245
  },
246
246
  methods: {
247
+ orderedSetList(setsList) {
248
+ setsList.sort((a, b) => {
249
+ const nameA = a.label_set.name;
250
+ const nameB = b.label_set.name;
251
+ if (nameA < nameB) {
252
+ return -1;
253
+ }
254
+ if (nameA > nameB) {
255
+ return 1;
256
+ }
257
+
258
+ // names must be equal
259
+ return 0;
260
+ });
261
+ return setsList;
262
+ },
247
263
  loadInfo() {
248
- this.setsList = [...this.annotationSets];
264
+ this.setsList = this.orderedSetList([...this.annotationSets]);
249
265
 
250
266
  this.selectedSet = this.annotationSets.find(
251
267
  (annSet) => annSet.id === this.editAnnotation.annotationSet.id
@@ -252,7 +252,7 @@ export default {
252
252
  },
253
253
  },
254
254
  mounted() {
255
- this.setsList = [...this.annotationSets];
255
+ this.setsList = this.orderedSetList([...this.annotationSets]);
256
256
  if (this.setsList.length === 1) {
257
257
  this.selectedSet = this.setsList[0];
258
258
  }
@@ -266,6 +266,22 @@ export default {
266
266
  document.body.removeEventListener("click", this.clickOutside);
267
267
  },
268
268
  methods: {
269
+ orderedSetList(setsList) {
270
+ setsList.sort((a, b) => {
271
+ const nameA = a.label_set.name;
272
+ const nameB = b.label_set.name;
273
+ if (nameA < nameB) {
274
+ return -1;
275
+ }
276
+ if (nameA > nameB) {
277
+ return 1;
278
+ }
279
+
280
+ // names must be equal
281
+ return 0;
282
+ });
283
+ return setsList;
284
+ },
269
285
  close() {
270
286
  this.$store.dispatch("selection/setSelectedEntities", null);
271
287
  this.$store.dispatch("selection/endSelection");