@vcmap/ui 5.0.0-rc.24 → 5.0.0-rc.25

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.
Files changed (215) hide show
  1. package/build/build.js +132 -14
  2. package/build/buildHelpers.js +196 -92
  3. package/build/bundle.js +56 -0
  4. package/build/commonViteConfig.js +2 -2
  5. package/config/base.config.json +29 -2
  6. package/config/dev.config.json +29 -1
  7. package/config/www.config.json +81 -39
  8. package/dist/assets/@mdi/font/LICENSE +20 -0
  9. package/dist/assets/@mdi/font/css/materialdesignicons.css.map +16 -0
  10. package/dist/assets/@mdi/font/css/materialdesignicons.min.e3f476.css +3 -0
  11. package/dist/assets/@mdi/font/fonts/materialdesignicons-webfont.woff2 +0 -0
  12. package/dist/assets/cesium/Workers/{AxisAlignedBoundingBox-85d9e53a.js → AxisAlignedBoundingBox-4140c51f.js} +1 -1
  13. package/dist/assets/cesium/Workers/{BoundingRectangle-1ee7eb47.js → BoundingRectangle-c714b156.js} +1 -1
  14. package/dist/assets/cesium/Workers/{BoxGeometry-3b2be784.js → BoxGeometry-6f3da43d.js} +1 -1
  15. package/dist/assets/cesium/Workers/{Color-f107c84d.js → Color-8a565ff2.js} +5 -5
  16. package/dist/assets/cesium/Workers/{CoplanarPolygonGeometryLibrary-78d71993.js → CoplanarPolygonGeometryLibrary-4b4d4096.js} +1 -1
  17. package/dist/assets/cesium/Workers/{CorridorGeometryLibrary-50d99b33.js → CorridorGeometryLibrary-7b94502b.js} +1 -1
  18. package/dist/assets/cesium/Workers/{CylinderGeometry-51b0d9bf.js → CylinderGeometry-ca070b87.js} +1 -1
  19. package/dist/assets/cesium/Workers/{EllipseGeometry-bcfb5d87.js → EllipseGeometry-122e51fa.js} +1 -1
  20. package/dist/assets/cesium/Workers/{EllipseGeometryLibrary-e94f8472.js → EllipseGeometryLibrary-4d326efc.js} +1 -1
  21. package/dist/assets/cesium/Workers/{EllipseOutlineGeometry-28e3a1bb.js → EllipseOutlineGeometry-16cc2bd7.js} +1 -1
  22. package/dist/assets/cesium/Workers/{EllipsoidGeometry-b222fa63.js → EllipsoidGeometry-cb148ca2.js} +1 -1
  23. package/dist/assets/cesium/Workers/{EllipsoidOutlineGeometry-38a3fb5b.js → EllipsoidOutlineGeometry-0fa10c79.js} +1 -1
  24. package/dist/assets/cesium/Workers/{EllipsoidTangentPlane-8c89f28c.js → EllipsoidTangentPlane-6dd1b7af.js} +1 -1
  25. package/dist/assets/cesium/Workers/{FrustumGeometry-bdd3a04d.js → FrustumGeometry-ee73037c.js} +1 -1
  26. package/dist/assets/cesium/Workers/{GeometryAttribute-153115c5.js → GeometryAttribute-ff5b4fb1.js} +1 -1
  27. package/dist/assets/cesium/Workers/{GeometryPipeline-acb2399c.js → GeometryPipeline-1f8fbf05.js} +1 -1
  28. package/dist/assets/cesium/Workers/{IntersectionTests-271e513e.js → IntersectionTests-70d39ba9.js} +1 -1
  29. package/dist/assets/cesium/Workers/{OrientedBoundingBox-5e04e31f.js → OrientedBoundingBox-159cf1d6.js} +1 -1
  30. package/dist/assets/cesium/Workers/{PolygonGeometryLibrary-6762b65b.js → PolygonGeometryLibrary-076a5d25.js} +1 -1
  31. package/dist/assets/cesium/Workers/{PolygonPipeline-7dc7a431.js → PolygonPipeline-b9f2810a.js} +1 -1
  32. package/dist/assets/cesium/Workers/{PolylinePipeline-15fde655.js → PolylinePipeline-639192e0.js} +1 -1
  33. package/dist/assets/cesium/Workers/{PolylineVolumeGeometryLibrary-ba7dfed5.js → PolylineVolumeGeometryLibrary-b73549fb.js} +1 -1
  34. package/dist/assets/cesium/Workers/{PrimitivePipeline-68f0b9a2.js → PrimitivePipeline-10ede1b6.js} +1 -1
  35. package/dist/assets/cesium/Workers/{RectangleGeometryLibrary-8eaf23da.js → RectangleGeometryLibrary-c35a7356.js} +1 -1
  36. package/dist/assets/cesium/Workers/{TerrainEncoding-eb8a645a.js → TerrainEncoding-668d242f.js} +1 -1
  37. package/dist/assets/cesium/Workers/{Transforms-f6451f99.js → Transforms-a2a85221.js} +14 -0
  38. package/dist/assets/cesium/Workers/{WallGeometryLibrary-feef3109.js → WallGeometryLibrary-1938bf0d.js} +1 -1
  39. package/dist/assets/cesium/Workers/cesiumWorkerBootstrapper.js +1 -1
  40. package/dist/assets/cesium/Workers/combineGeometry.js +1 -1
  41. package/dist/assets/cesium/Workers/createBoxGeometry.js +1 -1
  42. package/dist/assets/cesium/Workers/createBoxOutlineGeometry.js +1 -1
  43. package/dist/assets/cesium/Workers/createCircleGeometry.js +1 -1
  44. package/dist/assets/cesium/Workers/createCircleOutlineGeometry.js +1 -1
  45. package/dist/assets/cesium/Workers/createCoplanarPolygonGeometry.js +1 -1
  46. package/dist/assets/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
  47. package/dist/assets/cesium/Workers/createCorridorGeometry.js +1 -1
  48. package/dist/assets/cesium/Workers/createCorridorOutlineGeometry.js +1 -1
  49. package/dist/assets/cesium/Workers/createCylinderGeometry.js +1 -1
  50. package/dist/assets/cesium/Workers/createCylinderOutlineGeometry.js +1 -1
  51. package/dist/assets/cesium/Workers/createEllipseGeometry.js +1 -1
  52. package/dist/assets/cesium/Workers/createEllipseOutlineGeometry.js +1 -1
  53. package/dist/assets/cesium/Workers/createEllipsoidGeometry.js +1 -1
  54. package/dist/assets/cesium/Workers/createEllipsoidOutlineGeometry.js +1 -1
  55. package/dist/assets/cesium/Workers/createFrustumGeometry.js +1 -1
  56. package/dist/assets/cesium/Workers/createFrustumOutlineGeometry.js +1 -1
  57. package/dist/assets/cesium/Workers/createGeometry.js +1 -1
  58. package/dist/assets/cesium/Workers/createGroundPolylineGeometry.js +1 -1
  59. package/dist/assets/cesium/Workers/createPlaneGeometry.js +1 -1
  60. package/dist/assets/cesium/Workers/createPlaneOutlineGeometry.js +1 -1
  61. package/dist/assets/cesium/Workers/createPolygonGeometry.js +1 -1
  62. package/dist/assets/cesium/Workers/createPolygonOutlineGeometry.js +1 -1
  63. package/dist/assets/cesium/Workers/createPolylineGeometry.js +1 -1
  64. package/dist/assets/cesium/Workers/createPolylineVolumeGeometry.js +1 -1
  65. package/dist/assets/cesium/Workers/createPolylineVolumeOutlineGeometry.js +1 -1
  66. package/dist/assets/cesium/Workers/createRectangleGeometry.js +1 -1
  67. package/dist/assets/cesium/Workers/createRectangleOutlineGeometry.js +1 -1
  68. package/dist/assets/cesium/Workers/createSimplePolylineGeometry.js +1 -1
  69. package/dist/assets/cesium/Workers/createSphereGeometry.js +1 -1
  70. package/dist/assets/cesium/Workers/createSphereOutlineGeometry.js +1 -1
  71. package/dist/assets/cesium/Workers/createVectorTileGeometries.js +1 -1
  72. package/dist/assets/cesium/Workers/createVectorTilePolygons.js +1 -1
  73. package/dist/assets/cesium/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -1
  74. package/dist/assets/cesium/Workers/createVerticesFromHeightmap.js +1 -1
  75. package/dist/assets/cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +1 -1
  76. package/dist/assets/cesium/Workers/createWallGeometry.js +1 -1
  77. package/dist/assets/cesium/Workers/createWallOutlineGeometry.js +1 -1
  78. package/dist/assets/cesium/Workers/package.js +1 -1
  79. package/dist/assets/cesium/Workers/transferTypedArrayTest.js +1 -1
  80. package/dist/assets/cesium/Workers/upsampleQuantizedTerrainMesh.js +1 -1
  81. package/dist/assets/{cesium.253914.js → cesium.1457fa.js} +58656 -33170
  82. package/dist/assets/cesium.js +1 -1
  83. package/dist/assets/core.47836f.js +19060 -0
  84. package/dist/assets/core.js +1 -1
  85. package/dist/assets/index-bb372634.js +1 -0
  86. package/dist/assets/{ol.1c946a.js → ol.9e4d23.js} +27344 -12118
  87. package/dist/assets/ol.js +1 -1
  88. package/dist/assets/ui.6ed89d.css +5 -0
  89. package/dist/assets/ui.6ed89d.js +13461 -0
  90. package/dist/assets/ui.js +1 -1
  91. package/dist/assets/{vue.c1ece7.js → vue.7327e4.js} +834 -598
  92. package/dist/assets/vue.js +2 -2
  93. package/dist/assets/{vuetify.6efa21.css → vuetify.d2131d.css} +1 -1
  94. package/dist/assets/{vuetify.6efa21.js → vuetify.d2131d.js} +343 -103
  95. package/dist/assets/vuetify.js +2 -2
  96. package/dist/index.html +7 -6
  97. package/index.html +14 -6
  98. package/index.js +17 -2
  99. package/lib/olLib.js +19 -16
  100. package/package.json +15 -14
  101. package/plugins/@vcmap/create-link/fallbackCreateLink.vue +0 -2
  102. package/plugins/@vcmap/simple-graph/index.js +1 -1
  103. package/plugins/@vcmap-show-case/README.md +2 -1
  104. package/plugins/@vcmap-show-case/buttons-example/ButtonsExample.vue +55 -79
  105. package/plugins/@vcmap-show-case/category-tester/CategoriesExample.vue +135 -0
  106. package/plugins/@vcmap-show-case/category-tester/CollectionComponentOptions.vue +209 -0
  107. package/plugins/@vcmap-show-case/category-tester/index.js +19 -1
  108. package/plugins/@vcmap-show-case/collection-manager-example/CollectionManagerExample.vue +182 -0
  109. package/plugins/@vcmap-show-case/collection-manager-example/README.md +3 -0
  110. package/plugins/@vcmap-show-case/collection-manager-example/index.js +74 -0
  111. package/plugins/@vcmap-show-case/collection-manager-example/package.json +5 -0
  112. package/plugins/@vcmap-show-case/form-inputs-example/FormInputsExample.vue +20 -3
  113. package/plugins/@vcmap-show-case/switch-map-callback-example/README.md +21 -0
  114. package/plugins/@vcmap-show-case/switch-map-callback-example/SwitchMapCallback.js +47 -0
  115. package/plugins/@vcmap-show-case/switch-map-callback-example/config.json +3 -0
  116. package/plugins/@vcmap-show-case/switch-map-callback-example/index.js +34 -0
  117. package/plugins/@vcmap-show-case/switch-map-callback-example/package.json +5 -0
  118. package/plugins/@vcmap-show-case/table-example/DataTableExample.vue +0 -1
  119. package/plugins/package.json +3 -1
  120. package/public/assets/@mdi/font/LICENSE +20 -0
  121. package/public/assets/@mdi/font/css/materialdesignicons.css.map +16 -0
  122. package/public/assets/@mdi/font/css/materialdesignicons.min.css +3 -0
  123. package/public/assets/@mdi/font/fonts/materialdesignicons-webfont.woff2 +0 -0
  124. package/public/assets/favicon-128.png +0 -0
  125. package/public/assets/favicon-180.png +0 -0
  126. package/public/assets/favicon-192.png +0 -0
  127. package/public/assets/favicon-32.png +0 -0
  128. package/public/assets/logo-mobile.svg +9 -0
  129. package/public/assets/logo.svg +26 -0
  130. package/src/application/VcsApp.vue +34 -5
  131. package/src/application/VcsAttributions.vue +20 -5
  132. package/src/application/VcsAttributionsFooter.vue +0 -1
  133. package/src/application/VcsNavbar.vue +18 -13
  134. package/src/callback/activateLayersCallback.js +54 -0
  135. package/src/callback/applyLayerStyleCallback.js +63 -0
  136. package/src/callback/deactivateLayersCallback.js +54 -0
  137. package/src/callback/goToViewpointCallback.js +54 -0
  138. package/src/callback/vcsCallback.js +66 -0
  139. package/src/components/buttons/VcsActionButtonList.vue +28 -10
  140. package/src/components/buttons/VcsButton.vue +38 -100
  141. package/src/components/buttons/VcsFormButton.vue +6 -4
  142. package/src/components/buttons/VcsToolButton.vue +161 -0
  143. package/src/components/form-inputs-controls/VcsDatePicker.vue +19 -5
  144. package/src/components/form-inputs-controls/VcsFormSection.vue +0 -1
  145. package/src/components/form-inputs-controls/VcsSelect.vue +16 -2
  146. package/src/components/form-inputs-controls/VcsSlider.vue +72 -0
  147. package/src/components/form-inputs-controls/VcsTextField.vue +24 -13
  148. package/src/components/form-inputs-controls/VcsWizard.vue +13 -14
  149. package/src/components/form-inputs-controls/VcsWizardStep.vue +0 -1
  150. package/src/components/lists/VcsList.vue +3 -2
  151. package/src/components/lists/VcsTreeviewLeaf.vue +0 -1
  152. package/src/components/tables/VcsDataTable.vue +2 -4
  153. package/src/contentTree/LayerTree.vue +15 -9
  154. package/src/contentTree/contentTreeCollection.js +1 -1
  155. package/src/contentTree/contentTreeItem.js +22 -3
  156. package/src/contentTree/groupContentTreeItem.js +1 -0
  157. package/src/contentTree/layerContentTreeItem.js +4 -14
  158. package/src/contentTree/layerGroupContentTreeItem.js +4 -14
  159. package/src/contentTree/obliqueCollectionContentTreeItem.js +4 -0
  160. package/src/contentTree/viewpointContentTreeItem.js +1 -0
  161. package/src/featureInfo/BalloonComponent.vue +0 -1
  162. package/src/featureInfo/abstractFeatureInfoView.js +16 -1
  163. package/src/featureInfo/featureInfo.js +45 -56
  164. package/src/i18n/de.js +5 -2
  165. package/src/i18n/en.js +5 -2
  166. package/src/i18n/i18nCollection.js +1 -2
  167. package/src/init.js +1 -4
  168. package/src/legend/vcsLegend.vue +1 -1
  169. package/src/manager/buttonManager.js +15 -0
  170. package/src/manager/{categoryManager/CategoryComponent.vue → collectionManager/CollectionComponent.vue} +57 -66
  171. package/src/manager/collectionManager/CollectionComponentList.vue +62 -0
  172. package/src/manager/collectionManager/CollectionComponentProvider.vue +38 -0
  173. package/src/manager/collectionManager/CollectionManager.vue +43 -0
  174. package/src/manager/collectionManager/categoryManager.js +83 -0
  175. package/src/manager/collectionManager/collectionComponent.js +453 -0
  176. package/src/manager/collectionManager/collectionManager.js +432 -0
  177. package/src/manager/navbarManager.js +5 -4
  178. package/src/manager/toolbox/GroupToolboxComponent.vue +5 -7
  179. package/src/manager/toolbox/SelectToolboxComponent.vue +6 -9
  180. package/src/manager/toolbox/ToolboxManager.vue +4 -5
  181. package/src/manager/window/WindowComponentHeader.vue +0 -4
  182. package/src/navigation/mapNavigation.vue +34 -8
  183. package/src/navigation/overviewMap.js +7 -1
  184. package/src/notifier/notifierComponent.vue +0 -1
  185. package/src/pluginHelper.js +5 -0
  186. package/src/search/resultItem.vue +0 -1
  187. package/src/search/searchComponent.vue +7 -9
  188. package/src/styles/_theming.scss +2 -2
  189. package/src/styles/_typography.scss +2 -2
  190. package/src/styles/main.scss +8 -0
  191. package/src/styles/vcsFont.scss +1 -22
  192. package/src/vcsUiApp.js +76 -12
  193. package/src/vuePlugins/i18n.js +18 -19
  194. package/src/vuePlugins/vuetify.js +0 -1
  195. package/dist/assets/core.3a8205.js +0 -18426
  196. package/dist/assets/index.91ae2d55.js +0 -1
  197. package/dist/assets/ui.0025be.css +0 -5
  198. package/dist/assets/ui.0025be.js +0 -18534
  199. package/plugins/@vcmap-show-case/category-tester/Categories.vue +0 -291
  200. package/plugins/@vcmap-show-case/category-tester/Category.vue +0 -164
  201. package/src/manager/categoryManager/CategoryComponentList.vue +0 -82
  202. package/src/manager/categoryManager/CategoryManager.vue +0 -47
  203. package/src/manager/categoryManager/categoryManager.js +0 -633
  204. package/start.js +0 -9
  205. /package/{src/assets/favicon-128.png → dist/assets/favicon-128.4c4ce5.png} +0 -0
  206. /package/{src/assets/favicon-180.png → dist/assets/favicon-180.5b99c0.png} +0 -0
  207. /package/{src/assets/favicon-192.png → dist/assets/favicon-192.0e205e.png} +0 -0
  208. /package/{src/assets/favicon-32.png → dist/assets/favicon-32.6b9add.png} +0 -0
  209. /package/dist/assets/{favicon.decf54cc.svg → favicon.d5ec97.svg} +0 -0
  210. /package/dist/assets/font/{TitilliumWeb-Regular.woff2 → TitilliumWeb-Regular.9ca076.woff2} +0 -0
  211. /package/{src/assets/logo-mobile.svg → dist/assets/logo-mobile.2d10a6.svg} +0 -0
  212. /package/{src/assets/logo.svg → dist/assets/logo.27089a.svg} +0 -0
  213. /package/{src → public}/assets/favicon.svg +0 -0
  214. /package/{src → public}/assets/font/OFL.txt +0 -0
  215. /package/{src → public}/assets/font/TitilliumWeb-Regular.woff2 +0 -0
@@ -0,0 +1,432 @@
1
+ import { VcsEvent, Collection } from '@vcmap/core';
2
+ import { check, checkMaybe } from '@vcsuite/check';
3
+ import { validateActions } from '../../components/lists/VcsActionList.vue';
4
+ import CollectionComponent from './collectionComponent.js';
5
+
6
+ /**
7
+ * @callback MappingFunction
8
+ * @param {T} item
9
+ * @param {CollectionComponent<T>} collectionComponent
10
+ * @param {import("@vcmap/ui").VcsListItem & { destroy: (function():void)|undefined }} listItem - you can add a destroy callback for cleanup
11
+ * @template {Object} T
12
+ */
13
+
14
+ /**
15
+ * @callback PredicateFunction
16
+ * @param {T} item
17
+ * @param {CollectionComponent<T>} collectionComponent
18
+ * @returns {boolean}
19
+ * @template {Object} T
20
+ */
21
+
22
+ /**
23
+ * @typedef {Object} ItemMapping
24
+ * @property {PredicateFunction<T>|undefined} predicate
25
+ * @property {MappingFunction<T>} mappingFunction
26
+ * @property {string | symbol} owner
27
+ * @template T
28
+ */
29
+
30
+ /**
31
+ * @typedef {Object} ItemFilter
32
+ * @property {PredicateFunction<T>} filterFunction
33
+ * @property {string | symbol} owner
34
+ * @template T
35
+ */
36
+
37
+ /**
38
+ * @typedef {Object} OwnedAction
39
+ * @property {VcsAction} action
40
+ * @property {number} [weight=0] Optional weight affecting the displaying order
41
+ * @property {string | symbol} owner
42
+ */
43
+
44
+ /**
45
+ * Manages a list of collections as collectionComponents.
46
+ * Sets the correct mapping/filter functions and actions on the collectionComponent
47
+ * Provides an API to add/remove collectionsComponents.
48
+ * @implements {VcsComponentManager<CollectionComponent, CollectionComponentOptions>}
49
+ */
50
+ class CollectionManager {
51
+ constructor() {
52
+ /**
53
+ * @type {VcsEvent<CollectionComponent>}
54
+ */
55
+ this.added = new VcsEvent();
56
+ /**
57
+ * @type {VcsEvent<CollectionComponent>}
58
+ */
59
+ this.removed = new VcsEvent();
60
+ /**
61
+ * @type {Array<string>}
62
+ */
63
+ this.componentIds = [];
64
+ /**
65
+ * @type {Map<string, CollectionComponent>}
66
+ * @private
67
+ */
68
+ this._collectionComponents = new Map();
69
+
70
+ /**
71
+ * @type {Array<ItemMapping & { collectionComponentIds:Array<string> }>}
72
+ * @private
73
+ */
74
+ this._itemMappings = [];
75
+ /**
76
+ * @type {Array<ItemFilter & { collectionComponentIds:Array<string> }>}
77
+ * @private
78
+ */
79
+ this._itemFilters = [];
80
+ /**
81
+ * @type {Array<{actions:Array<VcsAction>,owner:string|symbol,collectionComponentIds:Array<string>}>}
82
+ * @private
83
+ */
84
+ this._actions = [];
85
+ }
86
+
87
+ /**
88
+ * @param {string} id
89
+ * @returns {CollectionComponent|undefined}
90
+ */
91
+ get(id) {
92
+ return this._collectionComponents.get(id);
93
+ }
94
+
95
+ /**
96
+ * @param {string} id
97
+ * @returns {boolean}
98
+ */
99
+ has(id) {
100
+ return this._collectionComponents.has(id);
101
+ }
102
+
103
+ /**
104
+ * @param {import("@vcmap/core").Collection} collection
105
+ * @returns {boolean}
106
+ */
107
+ hasCollection(collection) {
108
+ return [...this._collectionComponents.values()].some(
109
+ (c) => c.collection === collection,
110
+ );
111
+ }
112
+
113
+ /**
114
+ * gets all collection components corresponding to provided collection
115
+ * @param {import("@vcmap/core").Collection} collection
116
+ * @returns {CollectionComponent[]}
117
+ */
118
+ getCollection(collection) {
119
+ return [...this._collectionComponents.values()].filter(
120
+ (c) => c.collection === collection,
121
+ );
122
+ }
123
+
124
+ /**
125
+ * adds a collectionComponent
126
+ * @param {CollectionComponentOptions} collectionComponentOptions
127
+ * @param {string|symbol} owner
128
+ * @returns {CollectionComponent}
129
+ */
130
+ add(collectionComponentOptions, owner) {
131
+ check(collectionComponentOptions, { collection: Collection });
132
+ check(owner, [String, Symbol]);
133
+
134
+ if (
135
+ collectionComponentOptions.id &&
136
+ this.has(collectionComponentOptions.id)
137
+ ) {
138
+ throw new Error(
139
+ `A collection component with id ${collectionComponentOptions.id} has already been registered.`,
140
+ );
141
+ }
142
+
143
+ const collectionComponent = new CollectionComponent(
144
+ collectionComponentOptions,
145
+ owner,
146
+ );
147
+ this._collectionComponents.set(collectionComponent.id, collectionComponent);
148
+ this.componentIds.push(collectionComponent.id);
149
+
150
+ const filterIds = ({ collectionComponentIds }) =>
151
+ collectionComponentIds.includes(collectionComponent.id) ||
152
+ collectionComponentIds.length === 0;
153
+
154
+ this._itemMappings
155
+ .filter(filterIds)
156
+ .forEach(({ collectionComponentIds, ...itemMapping }) =>
157
+ collectionComponent.addItemMapping(itemMapping),
158
+ );
159
+ this._itemFilters
160
+ .filter(filterIds)
161
+ .forEach(({ collectionComponentIds, ...itemFilter }) =>
162
+ collectionComponent.addItemFilter(itemFilter),
163
+ );
164
+ this._actions
165
+ .filter(filterIds)
166
+ .forEach(({ actions, owner: actionOwner }) =>
167
+ collectionComponent.addActions(
168
+ actions.map(({ action }) => ({ action, actionOwner })),
169
+ ),
170
+ );
171
+
172
+ this.added.raiseEvent(collectionComponent);
173
+ return collectionComponent;
174
+ }
175
+
176
+ /**
177
+ * removes a CollectionComponent, Component will not be rendered anymore and will be destroyed. Add CollectionComponent again
178
+ * to show the component again
179
+ * @param {string} id
180
+ */
181
+ remove(id) {
182
+ check(id, String);
183
+ const collectionComponent = this._collectionComponents.get(id);
184
+ if (collectionComponent) {
185
+ const index = this.componentIds.indexOf(id);
186
+ this.componentIds.splice(index, 1);
187
+ this._collectionComponents.delete(id);
188
+ this.removed.raiseEvent(collectionComponent);
189
+ collectionComponent.destroy();
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Gets affected ids for adding mapping and filter functions or actions.
195
+ * If no ids are provided, ids of all managed collectionComponents are returned.
196
+ * @param {Array<string>} [collectionComponentIds]
197
+ * @returns {string[]}
198
+ * @private
199
+ */
200
+ _getAffectedIds(collectionComponentIds) {
201
+ return collectionComponentIds.length > 0
202
+ ? collectionComponentIds
203
+ : [...this._collectionComponents.keys()];
204
+ }
205
+
206
+ /**
207
+ * adds MappingFunction to the collectionManager. For the given collectionComponents each Item will be transformed by the
208
+ * mappingFunction if the predicate returns true.
209
+ * @param {PredicateFunction} predicate
210
+ * @param {MappingFunction} mappingFunction
211
+ * @param {string | symbol} owner
212
+ * @param {Array<string>} [collectionComponentIds] list of collectionComponents this mappingFunction should be used on. If empty, mappingFunction is applied to all managed collectionComponents.
213
+ */
214
+ addMappingFunction(
215
+ predicate,
216
+ mappingFunction,
217
+ owner,
218
+ collectionComponentIds = [],
219
+ ) {
220
+ checkMaybe(predicate, Function);
221
+ check(mappingFunction, Function);
222
+ check(owner, [String, Symbol]);
223
+ check(collectionComponentIds, [String]);
224
+
225
+ /** @type {ItemMapping} */
226
+ const itemMapping = {
227
+ predicate,
228
+ mappingFunction,
229
+ owner,
230
+ };
231
+
232
+ if (
233
+ !this._itemMappings.find((cached) => {
234
+ return (
235
+ cached.mappingFunction === mappingFunction && cached.owner === owner
236
+ );
237
+ })
238
+ ) {
239
+ this._getAffectedIds(collectionComponentIds).forEach((id) => {
240
+ const component = this._collectionComponents.get(id);
241
+ if (component) {
242
+ component.addItemMapping(itemMapping);
243
+ }
244
+ });
245
+ this._itemMappings.push({
246
+ ...itemMapping,
247
+ collectionComponentIds,
248
+ });
249
+ }
250
+ }
251
+
252
+ /**
253
+ * removes the given mappingFunction
254
+ * @param {MappingFunction} mappingFunction
255
+ * @param {string | symbol} owner
256
+ */
257
+ removeMappingFunction(mappingFunction, owner) {
258
+ check(mappingFunction, Function);
259
+ check(owner, [String, Symbol]);
260
+
261
+ [...this._collectionComponents.values()].forEach((collectionComponent) => {
262
+ collectionComponent.removeItemMapping({ mappingFunction, owner });
263
+ });
264
+ this._itemMappings = this._itemMappings.filter(
265
+ (cached) =>
266
+ !(cached.mappingFunction === mappingFunction && cached.owner === owner),
267
+ );
268
+ }
269
+
270
+ /**
271
+ * @param {PredicateFunction} filterFunction
272
+ * @param {string | symbol} owner
273
+ * @param {Array<string>} [collectionComponentIds] list of collectionComponents this filterFunction should be used on. If empty, filterFunction is applied to all managed collectionComponents.
274
+ */
275
+ addFilterFunction(filterFunction, owner, collectionComponentIds = []) {
276
+ check(filterFunction, Function);
277
+ check(owner, [String, Symbol]);
278
+ check(collectionComponentIds, [String]);
279
+
280
+ /** @type {ItemFilter} */
281
+ const itemFilter = {
282
+ filterFunction,
283
+ owner,
284
+ };
285
+
286
+ if (
287
+ !this._itemFilters.find((cached) => {
288
+ return (
289
+ cached.filterFunction === filterFunction && cached.owner === owner
290
+ );
291
+ })
292
+ ) {
293
+ this._getAffectedIds(collectionComponentIds).forEach((id) => {
294
+ const component = this._collectionComponents.get(id);
295
+ if (component) {
296
+ component.addItemFilter(itemFilter);
297
+ }
298
+ });
299
+ this._itemFilters.push({
300
+ ...itemFilter,
301
+ collectionComponentIds,
302
+ });
303
+ }
304
+ }
305
+
306
+ /**
307
+ * removes the given filterFunction
308
+ * @param {PredicateFunction} filterFunction
309
+ * @param {string | symbol} owner
310
+ */
311
+ removeFilterFunction(filterFunction, owner) {
312
+ check(filterFunction, Function);
313
+ check(owner, [String, Symbol]);
314
+
315
+ [...this._collectionComponents.values()].forEach((collectionComponent) => {
316
+ collectionComponent.removeItemFilter({ filterFunction, owner });
317
+ });
318
+ this._itemFilters = this._itemFilters.filter(
319
+ (cached) =>
320
+ !(cached.filterFunction === filterFunction && cached.owner === owner),
321
+ );
322
+ }
323
+
324
+ /**
325
+ * add multiple actions owned by the same owner
326
+ * @param {Array<VcsAction>} actions
327
+ * @param {string | symbol} owner
328
+ * @param {Array<string>} [collectionComponentIds] list of collectionComponents this mappingFunction should be used on. If empty, actions are applied to all managed collectionComponents.
329
+ */
330
+ addActions(actions, owner, collectionComponentIds = []) {
331
+ check(owner, [String, Symbol]);
332
+ check(collectionComponentIds, [String]);
333
+
334
+ if (!validateActions(actions)) {
335
+ throw new Error('Invalid actions Array');
336
+ }
337
+
338
+ if (
339
+ !this._actions.find(
340
+ (cached) => cached.actions === actions && cached.owner === owner,
341
+ )
342
+ ) {
343
+ const ownedActions = actions.map((action) => ({ action, owner }));
344
+ this._getAffectedIds(collectionComponentIds).forEach((id) => {
345
+ const component = this._collectionComponents.get(id);
346
+ if (component) {
347
+ component.addActions(ownedActions);
348
+ }
349
+ });
350
+ this._actions.push({
351
+ actions,
352
+ owner,
353
+ collectionComponentIds,
354
+ });
355
+ }
356
+ }
357
+
358
+ /**
359
+ * @param {Array<VcsAction>} actions
360
+ * @param {string | symbol} owner
361
+ */
362
+ removeActions(actions, owner) {
363
+ check(owner, [String, Symbol]);
364
+
365
+ const ownedActions = actions.map((action) => ({ action, owner }));
366
+ [...this._collectionComponents.values()].forEach((collectionComponent) => {
367
+ collectionComponent.removeActions(ownedActions);
368
+ });
369
+ this._actions = this._actions.filter(
370
+ (cached) => !(cached.actions === actions && cached.owner === owner),
371
+ );
372
+ }
373
+
374
+ /**
375
+ * removes managed collection components or actions and mapping/ filter functions belonging to the given owner.
376
+ * @param {string | symbol} owner
377
+ */
378
+ removeOwner(owner) {
379
+ check(owner, [String, Symbol]);
380
+
381
+ [...this._collectionComponents.values()].forEach((collectionComponent) => {
382
+ if (collectionComponent.owner === owner) {
383
+ this.remove(collectionComponent.id);
384
+ collectionComponent.destroy();
385
+ } else {
386
+ collectionComponent.removeOwner(owner);
387
+ }
388
+ });
389
+
390
+ this._itemMappings = this._itemMappings.filter((itemMapping) => {
391
+ return itemMapping.owner !== owner;
392
+ });
393
+ this._itemFilters = this._itemFilters.filter((itemFilter) => {
394
+ return itemFilter.owner !== owner;
395
+ });
396
+ this._actions = this._actions.filter(
397
+ (ownedAction) => ownedAction.owner !== owner,
398
+ );
399
+ }
400
+
401
+ /**
402
+ * Resets all collectionComponents
403
+ */
404
+ reset() {
405
+ [...this._collectionComponents.values()].forEach((collectionComponent) => {
406
+ collectionComponent.reset();
407
+ });
408
+ }
409
+
410
+ /**
411
+ * Clears the manager of all added categories and item mappings
412
+ */
413
+ clear() {
414
+ [...this.componentIds].forEach((id) => {
415
+ this.remove(id);
416
+ });
417
+ this._itemMappings = [];
418
+ this._itemFilters = [];
419
+ this._actions = [];
420
+ }
421
+
422
+ /**
423
+ * destroys the categoryManager, removes all Listeners and clears all Managed Categories
424
+ */
425
+ destroy() {
426
+ this.clear();
427
+ this.added.destroy();
428
+ this.removed.destroy();
429
+ }
430
+ }
431
+
432
+ export default CollectionManager;
@@ -1,5 +1,5 @@
1
1
  import { check } from '@vcsuite/check';
2
- import ButtonManager from './buttonManager.js';
2
+ import ButtonManager, { sortByWeight } from './buttonManager.js';
3
3
  import { vcsAppSymbol } from '../pluginHelper.js';
4
4
 
5
5
  export const locationSymbol = Symbol('location');
@@ -35,18 +35,19 @@ export function sortByOwner(ownerA, ownerB, order = []) {
35
35
  * @param {Array<ButtonComponent>} buttonComponents
36
36
  * @param {ButtonLocation} location Button render position
37
37
  * @param {string[]} [order] optional order to sort by (plugin names)
38
- * @param {function(ownerA:string, ownerB:string, order: string[]):number} [compareFn=sortByOwner] Per default components are sorted by owner: app first, then plugins
38
+ * @param {function(buttonA:ButtonComponent, buttonB:ButtonComponent):number} [compareFn=sortByOwner] Per default components are sorted by weight (highest first) and owner (app first, then plugins)
39
39
  * @returns {Array<VcsAction>}
40
40
  */
41
41
  export function getActionsByLocation(
42
42
  buttonComponents,
43
43
  location,
44
44
  order = [],
45
- compareFn = sortByOwner,
45
+ compareFn = (a, b) =>
46
+ sortByWeight(a.weight, b.weight) || sortByOwner(a.owner, b.owner, order),
46
47
  ) {
47
48
  return [...buttonComponents]
48
49
  .filter((b) => b[locationSymbol] === location)
49
- .sort((a, b) => compareFn(a.owner, b.owner, order))
50
+ .sort(compareFn)
50
51
  .map((b) => b.action);
51
52
  }
52
53
 
@@ -8,7 +8,7 @@
8
8
  z-index="0"
9
9
  >
10
10
  <template #activator="{ on, attrs }">
11
- <VcsButton
11
+ <VcsToolButton
12
12
  class="vcs-toolbox-toggle-button"
13
13
  width="48"
14
14
  :icon="group.icon"
@@ -18,10 +18,9 @@
18
18
  :color="hasActiveAction ? 'primary' : ''"
19
19
  v-bind="attrs"
20
20
  v-on="on"
21
- large
22
21
  >
23
22
  <v-icon>{{ open ? 'mdi-chevron-up' : 'mdi-chevron-down' }}</v-icon>
24
- </VcsButton>
23
+ </VcsToolButton>
25
24
  </template>
26
25
 
27
26
  <v-toolbar
@@ -33,7 +32,7 @@
33
32
  >
34
33
  <v-toolbar-items class="w-full">
35
34
  <div class="d-flex align-center justify-space-between w-full mx-1">
36
- <VcsButton
35
+ <VcsToolButton
37
36
  v-for="{ id, action } in orderedButtons"
38
37
  :key="id"
39
38
  :tooltip="action.title"
@@ -42,7 +41,6 @@
42
41
  :active="action.active"
43
42
  @click="action.callback($event)"
44
43
  v-bind="{ ...$attrs }"
45
- large
46
44
  />
47
45
  </div>
48
46
  </v-toolbar-items>
@@ -64,7 +62,7 @@
64
62
  <script>
65
63
  import { computed, ref } from 'vue';
66
64
  import { VMenu, VIcon, VToolbar, VToolbarItems } from 'vuetify/lib';
67
- import VcsButton from '../../components/buttons/VcsButton.vue';
65
+ import VcsToolButton from '../../components/buttons/VcsToolButton.vue';
68
66
  import { getComponentsByOrder } from './toolboxManager.js';
69
67
 
70
68
  /**
@@ -81,7 +79,7 @@
81
79
  export default {
82
80
  name: 'ToolboxActionGroup',
83
81
  components: {
84
- VcsButton,
82
+ VcsToolButton,
85
83
  VMenu,
86
84
  VIcon,
87
85
  VToolbar,
@@ -4,7 +4,7 @@
4
4
  :class="{ 'vcs-toolbox-action-select-button--active': open }"
5
5
  style="width: fit-content"
6
6
  >
7
- <VcsButton
7
+ <VcsToolButton
8
8
  :key="group.action.tools[group.action.currentIndex].name"
9
9
  :tooltip="group.action.tools[group.action.currentIndex].title"
10
10
  :icon="group.action.tools[group.action.currentIndex].icon"
@@ -15,7 +15,6 @@
15
15
  class="vcs-toolbox-action-selected"
16
16
  :min-width="32"
17
17
  :width="32"
18
- large
19
18
  />
20
19
  <v-menu
21
20
  v-model="open"
@@ -25,7 +24,7 @@
25
24
  z-index="0"
26
25
  >
27
26
  <template #activator="{ on, attrs }">
28
- <VcsButton
27
+ <VcsToolButton
29
28
  :tooltip="group.action.title"
30
29
  :disabled="group.action.disabled"
31
30
  v-bind="attrs"
@@ -33,10 +32,9 @@
33
32
  class="vcs-toolbox-action-select"
34
33
  :min-width="16"
35
34
  :width="16"
36
- large
37
35
  >
38
36
  <v-icon>{{ open ? 'mdi-chevron-up' : 'mdi-chevron-down' }}</v-icon>
39
- </VcsButton>
37
+ </VcsToolButton>
40
38
  </template>
41
39
 
42
40
  <v-toolbar
@@ -47,7 +45,7 @@
47
45
  >
48
46
  <v-toolbar-items class="w-full">
49
47
  <div class="d-flex align-center justify-space-between w-full mx-1">
50
- <VcsButton
48
+ <VcsToolButton
51
49
  v-for="(item, index) in group.action.tools"
52
50
  :key="`${item.name}-${index}`"
53
51
  :tooltip="item.title"
@@ -55,7 +53,6 @@
55
53
  :disabled="item.disabled"
56
54
  @click="group.action.selected(index)"
57
55
  v-bind="{ ...$attrs }"
58
- large
59
56
  />
60
57
  </div>
61
58
  </v-toolbar-items>
@@ -98,7 +95,7 @@
98
95
  <script>
99
96
  import { ref, computed } from 'vue';
100
97
  import { VMenu, VIcon, VToolbar, VToolbarItems } from 'vuetify/lib';
101
- import VcsButton from '../../components/buttons/VcsButton.vue';
98
+ import VcsToolButton from '../../components/buttons/VcsToolButton.vue';
102
99
 
103
100
  /**
104
101
  * @description
@@ -109,7 +106,7 @@
109
106
  export default {
110
107
  name: 'ToolboxActionSelect',
111
108
  components: {
112
- VcsButton,
109
+ VcsToolButton,
113
110
  VMenu,
114
111
  VIcon,
115
112
  VToolbar,
@@ -25,7 +25,7 @@
25
25
  :group="group"
26
26
  @toggle="(selectOpen) => (open = selectOpen)"
27
27
  />
28
- <VcsButton
28
+ <VcsToolButton
29
29
  v-else
30
30
  :tooltip="group.action.title"
31
31
  :icon="group.action.icon"
@@ -34,7 +34,6 @@
34
34
  :disabled="group.action.disabled"
35
35
  @click.stop="group.action.callback($event)"
36
36
  v-bind="{ ...$attrs }"
37
- large
38
37
  />
39
38
  </div>
40
39
  </v-toolbar-items>
@@ -72,7 +71,7 @@
72
71
  import { getComponentsByOrder, ToolboxType } from './toolboxManager.js';
73
72
  import ToolboxActionSelect from './SelectToolboxComponent.vue';
74
73
  import ToolboxActionGroup from './GroupToolboxComponent.vue';
75
- import VcsButton from '../../components/buttons/VcsButton.vue';
74
+ import VcsToolButton from '../../components/buttons/VcsToolButton.vue';
76
75
 
77
76
  /**
78
77
  * @typedef {Object} ToolboxButtonGroup
@@ -100,7 +99,7 @@
100
99
  components: {
101
100
  ToolboxActionSelect,
102
101
  ToolboxActionGroup,
103
- VcsButton,
102
+ VcsToolButton,
104
103
  VToolbar,
105
104
  VToolbarItems,
106
105
  },
@@ -146,7 +145,7 @@
146
145
  };
147
146
 
148
147
  function handleToolboxButton() {
149
- if (groups.value.length > 0) {
148
+ if (orderedGroups.value.length > 0) {
150
149
  if (!app.navbarManager.has('toolbox')) {
151
150
  app.navbarManager.add(
152
151
  {
@@ -23,14 +23,12 @@
23
23
  <VcsActionButtonList
24
24
  :actions="windowState.headerActions"
25
25
  :overflow-count="windowState.headerActionsOverflow ?? 3"
26
- small
27
26
  />
28
27
  <v-divider vertical inset class="mx-1" />
29
28
  </template>
30
29
  <VcsButton
31
30
  v-if="windowState.infoUrl"
32
31
  @click.stop="infoAction.callback()"
33
- small
34
32
  :icon="infoAction.icon"
35
33
  :tooltip="infoAction.title"
36
34
  class="px-1 d-flex"
@@ -38,14 +36,12 @@
38
36
  <VcsButton
39
37
  v-if="isDockable"
40
38
  @click.stop="pin"
41
- small
42
39
  icon="mdi-pin"
43
40
  tooltip="components.pin"
44
41
  class="px-1 d-flex"
45
42
  />
46
43
  <VcsButton
47
44
  @click.stop="close"
48
- small
49
45
  icon="mdi-close-thick"
50
46
  tooltip="components.close"
51
47
  class="d-flex"