@community-release/nx-ui 0.0.71 → 0.0.72

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/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "ui",
3
3
  "configKey": "ui",
4
- "version": "0.0.71"
4
+ "version": "0.0.72"
5
5
  }
@@ -84,6 +84,20 @@ const props = defineProps({
84
84
  default: comProps.disabledClusterColor,
85
85
  type: String
86
86
  },
87
+ /**
88
+ * Min distance between clusters
89
+ */
90
+ clusterMinDistance: {
91
+ default: 15,
92
+ type: Number
93
+ },
94
+ /**
95
+ * Distance(in px) between points when they start group in cluster
96
+ */
97
+ clusterDistance: {
98
+ default: 30,
99
+ type: Number
100
+ },
87
101
  });
88
102
 
89
103
  store.coord = props.coord;
@@ -97,6 +111,8 @@ store.markerActiveImage = props.markerActiveImage;
97
111
  store.markerDisabledImage = props.markerDisabledImage;
98
112
  store.clusterColor = props.clusterColor;
99
113
  store.disabledClusterColor = props.disabledClusterColor;
114
+ store.clusterMinDistance = props.clusterMinDistance;
115
+ store.clusterDistance = props.clusterDistance;
100
116
 
101
117
  watch(() => props.disabledMarkers, (v) => {
102
118
  store.setDisabledMarkers(v);
@@ -77,6 +77,8 @@
77
77
  selectedMarker,
78
78
  clusterColor,
79
79
  disabledClusterColor,
80
+ clusterMinDistance,
81
+ clusterDistance,
80
82
  userCoord
81
83
  } = storeToRefs(store);
82
84
 
@@ -160,7 +162,14 @@
160
162
  for (let item of markers.value) {
161
163
  const feature = new Feature(new Point(fromLonLat(item.coord)));
162
164
 
163
- feature.attributes = { id: item.id }; // Add payload data to markers
165
+ // Add payload data to markers
166
+ feature.attributes = {
167
+ id: item.id,
168
+ marker: item?.marker || 'default',
169
+ markerActive: item?.markerActive || 'active',
170
+ markerDisabled: item?.markerDisabled || 'disabled'
171
+ };
172
+
164
173
  result.push(feature);
165
174
  }
166
175
 
@@ -174,8 +183,8 @@
174
183
  */
175
184
  function createCluster(features) {
176
185
  const clusterSource = new Cluster({
177
- distance: 30,
178
- minDistance: 15,
186
+ minDistance: clusterMinDistance.value,
187
+ distance: clusterDistance.value,
179
188
  source: new VectorSource({
180
189
  features // Markers
181
190
  })
@@ -225,6 +234,18 @@
225
234
  });
226
235
  }
227
236
 
237
+ // Iterate all markers
238
+ for (let item of markers.value) {
239
+ if (!(item.marker in styleCache))
240
+ styleCache[item.marker] = new Style({ image: new Icon({ src: item.marker }) });
241
+
242
+ if (!(item.markerActive in styleCache))
243
+ styleCache[item.markerActive] = new Style({ image: new Icon({ src: item.markerActive }) });
244
+
245
+ if (!(item.markerDisabled in styleCache))
246
+ styleCache[item.markerDisabled] = new Style({ image: new Icon({ src: item.markerDisabled }) });
247
+ }
248
+
228
249
  // Markers style function
229
250
  function style(feature) {
230
251
  const allFeatures = feature.get('features');
@@ -234,11 +255,11 @@
234
255
 
235
256
  // If one
236
257
  if (size == 1) {
237
- const markerId = allFeatures[0].attributes.id;
238
- const isDisabled = disabledMarkers.value.includes(markerId);
239
- const isSelected = markerId === selectedMarker.value?.id;
258
+ const markerAttr = allFeatures[0].attributes;
259
+ const isDisabled = disabledMarkers.value.includes(markerAttr.id);
260
+ const isSelected = markerAttr.id === selectedMarker.value?.id;
240
261
 
241
- style = styleCache[isSelected ? 'active' : (isDisabled ? 'disabled' : 'default')];
262
+ style = styleCache[isSelected ? markerAttr.markerActive : (isDisabled ? markerAttr.markerDisabled : markerAttr.marker)];
242
263
 
243
264
  // If cluster
244
265
  } else {
@@ -15,6 +15,8 @@ export const useMapStore: import("pinia").StoreDefinition<"map", {
15
15
  disabledMarkers: never[];
16
16
  clusterColor: string;
17
17
  disabledClusterColor: string;
18
+ clusterMinDistance: number;
19
+ clusterDistance: number;
18
20
  userCoord: never[];
19
21
  }, {
20
22
  /**
@@ -36,6 +36,8 @@ export const useMapStore = defineStore('map', {
36
36
  disabledMarkers: [],
37
37
  clusterColor: '',
38
38
  disabledClusterColor: '',
39
+ clusterMinDistance: 15,
40
+ clusterDistance: 30,
39
41
 
40
42
  userCoord: []
41
43
  }
package/package.json CHANGED
@@ -1,73 +1,73 @@
1
- {
2
- "name": "@community-release/nx-ui",
3
- "version": "0.0.71",
4
- "packageManager": "pnpm@10.14.0",
5
- "description": "nx-ui - Nuxt UI library",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/community-release/nx-ui.git"
9
- },
10
- "license": "MIT",
11
- "type": "module",
12
- "exports": {
13
- ".": {
14
- "import": "./dist/module.mjs",
15
- "require": "./dist/module.cjs"
16
- }
17
- },
18
- "main": "./dist/module.cjs",
19
- "files": [
20
- "dist"
21
- ],
22
- "dependencies": {
23
- "@nuxt/kit": "^3.15.4",
24
- "@nuxtjs/color-mode": "^3.5.2",
25
- "@nuxtjs/i18n": "^9.2.0",
26
- "@pinia/nuxt": "^0.10.1",
27
- "ol": "^9.1.0",
28
- "pinia": "^3.0.1",
29
- "vue": "^3.5.13"
30
- },
31
- "devDependencies": {
32
- "@nuxt/devtools": "latest",
33
- "@nuxt/module-builder": "^0.5.5",
34
- "@nuxt/schema": "^3.11.2",
35
- "@nuxt/test-utils": "^3.19.2",
36
- "@vitejs/plugin-vue": "^5.2.1",
37
- "@vue/test-utils": "^2.4.6",
38
- "@vuedoc/md": "^4.0.0-beta8",
39
- "@vuedoc/parser": "^4.0.0-beta14",
40
- "@vueuse/core": "^13.6.0",
41
- "@vueuse/nuxt": "^13.6.0",
42
- "changelogen": "^0.5.5",
43
- "cross-env": "^7.0.3",
44
- "happy-dom": "^14.12.0",
45
- "less": "^3.9.0",
46
- "less-loader": "^5.0.0",
47
- "nuxt": "^3.15.4",
48
- "playwright-core": "^1.54.1",
49
- "vite-raw-plugin": "^1.0.2",
50
- "vitest": "^1.6.0",
51
- "vue-docgen-cli": "^4.79.0",
52
- "vue-tsc": "^2.0.24"
53
- },
54
- "peerDependencies": {
55
- "vue-router": "^4.5.0"
56
- },
57
- "resolutions": {
58
- "string-width": "4.2.3"
59
- },
60
- "scripts": {
61
- "prepack": "nuxt-module-build build",
62
- "dev": "nuxi dev docs --host --port 7012",
63
- "build": "nuxi build docs",
64
- "prepare": "nuxt-module-build build && nuxt-module-build prepare && nuxi prepare docs",
65
- "release": "npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
66
- "test": "vitest run",
67
- "test:watch": "vitest watch",
68
- "test:com": "vitest components run",
69
- "test:genmocks": "node ./src/utils/generateTestMocks.mjs",
70
- "docs:components": "vue-docgen",
71
- "docs:generate": "npm run generate:production -prefix ./docs"
72
- }
1
+ {
2
+ "name": "@community-release/nx-ui",
3
+ "version": "0.0.72",
4
+ "packageManager": "pnpm@10.14.0",
5
+ "description": "nx-ui - Nuxt UI library",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/community-release/nx-ui.git"
9
+ },
10
+ "license": "MIT",
11
+ "type": "module",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/module.mjs",
15
+ "require": "./dist/module.cjs"
16
+ }
17
+ },
18
+ "main": "./dist/module.cjs",
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "dependencies": {
23
+ "@nuxt/kit": "^3.15.4",
24
+ "@nuxtjs/color-mode": "^3.5.2",
25
+ "@nuxtjs/i18n": "^9.2.0",
26
+ "@pinia/nuxt": "^0.10.1",
27
+ "ol": "^9.1.0",
28
+ "pinia": "^3.0.1",
29
+ "vue": "^3.5.13"
30
+ },
31
+ "devDependencies": {
32
+ "@nuxt/devtools": "latest",
33
+ "@nuxt/module-builder": "^0.5.5",
34
+ "@nuxt/schema": "^3.11.2",
35
+ "@nuxt/test-utils": "^3.19.2",
36
+ "@vitejs/plugin-vue": "^5.2.1",
37
+ "@vue/test-utils": "^2.4.6",
38
+ "@vuedoc/md": "^4.0.0-beta8",
39
+ "@vuedoc/parser": "^4.0.0-beta14",
40
+ "@vueuse/core": "^13.6.0",
41
+ "@vueuse/nuxt": "^13.6.0",
42
+ "changelogen": "^0.5.5",
43
+ "cross-env": "^7.0.3",
44
+ "happy-dom": "^14.12.0",
45
+ "less": "^3.9.0",
46
+ "less-loader": "^5.0.0",
47
+ "nuxt": "^3.15.4",
48
+ "playwright-core": "^1.54.1",
49
+ "vite-raw-plugin": "^1.0.2",
50
+ "vitest": "^1.6.0",
51
+ "vue-docgen-cli": "^4.79.0",
52
+ "vue-tsc": "^2.0.24"
53
+ },
54
+ "peerDependencies": {
55
+ "vue-router": "^4.5.0"
56
+ },
57
+ "resolutions": {
58
+ "string-width": "4.2.3"
59
+ },
60
+ "scripts": {
61
+ "prepack": "nuxt-module-build build",
62
+ "dev": "nuxi dev docs --host --port 7012",
63
+ "build": "nuxi build docs",
64
+ "prepare": "nuxt-module-build build && nuxt-module-build prepare && nuxi prepare docs",
65
+ "release": "npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
66
+ "test": "vitest run",
67
+ "test:watch": "vitest watch",
68
+ "test:com": "vitest components run",
69
+ "test:genmocks": "node ./src/utils/generateTestMocks.mjs",
70
+ "docs:components": "vue-docgen",
71
+ "docs:generate": "npm run generate:production -prefix ./docs"
72
+ }
73
73
  }