@community-release/nx-ui 0.0.67 → 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.67"
4
+ "version": "0.0.72"
5
5
  }
@@ -14,7 +14,7 @@
14
14
  <div class="title">{{ title }}</div>
15
15
  <div class="btn-toggle"></div>
16
16
  </button>
17
- <div :id="`acc-content-${cid}`" class="text" role="region" :aria-labelledby="`acc-button-${cid}`">
17
+ <div :id="`acc-content-${cid}`" class="text" role="region" :aria-labelledby="`acc-button-${cid}`" :inert="accordionData.open.value !== id">
18
18
  <div><slot /></div>
19
19
  </div>
20
20
  </section>
@@ -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
  }
@@ -1,70 +1,74 @@
1
1
  <template>
2
2
  <div class="component-ui-spoiler" :class="{'tag-active': isShown}">
3
- <div class="content">
3
+ <div :id="cid" class="content" :inert="!isShown">
4
4
  <div>
5
5
  <slot></slot>
6
6
  </div>
7
7
  </div>
8
- <div class="title" @click="handleClick">{{ isShown ? hideText : showText }}</div>
8
+ <ui-button variant="flat" class="title" @click="handleClick" :aria-expanded="isShown.toString()" :aria-controls="cid">{{ isShown ? hideText : showText }}</ui-button>
9
9
  </div>
10
10
  </template>
11
11
 
12
12
  <script setup>
13
- import { watch, ref } from 'vue';
13
+ // Imports
14
+ import { watch, ref } from 'vue';
15
+ import uniq from './helpers/uniq';
14
16
 
15
17
  // Data
16
- const emit = defineEmits(['update:modelValue']);
17
- const props = defineProps({
18
- showText: {
19
- type: String,
20
- default: 'Show'
21
- },
22
- hideText: {
23
- type: String,
24
- default: 'Hide'
25
- },
26
- modelValue: {
27
- type: [Boolean, null],
28
- default: null
29
- }
30
- });
31
-
32
- let isShown = ref(false);
33
- let hasModel = props.modelValue !== null;
18
+ const emit = defineEmits(['update:modelValue']);
19
+ const props = defineProps({
20
+ showText: {
21
+ type: String,
22
+ default: 'Show'
23
+ },
24
+ hideText: {
25
+ type: String,
26
+ default: 'Hide'
27
+ },
28
+ modelValue: {
29
+ type: [Boolean, null],
30
+ default: null
31
+ }
32
+ });
34
33
 
35
- if (hasModel) {
36
- watch(() => props.modelValue, (v) => {
37
- isShown.value = v;
38
- }, { immediate: true });
39
- }
34
+ const cid = 'spoiler-' + uniq();
35
+ let isShown = ref(false);
36
+ let hasModel = props.modelValue !== null;
37
+
38
+ if (hasModel) {
39
+ watch(() => props.modelValue, (v) => {
40
+ isShown.value = v;
41
+ }, { immediate: true });
42
+ }
40
43
 
41
44
  // Methods
42
- function handleClick() {
43
- if (hasModel) {
44
- emit('update:modelValue', !isShown.value);
45
- } else {
46
- isShown.value = !isShown.value;
45
+ function handleClick() {
46
+ if (hasModel) {
47
+ emit('update:modelValue', !isShown.value);
48
+ } else {
49
+ isShown.value = !isShown.value;
50
+ }
47
51
  }
48
- }
49
52
  </script>
50
53
 
51
54
  <style lang="less">
52
55
  .component-ui-spoiler {
53
- @com-space-mini: var(--ui-space-mini);
56
+ @com-space-micro: var(--ui-space-micro);
54
57
  @com-ani-ease: var(--ui-ani-ease);
55
58
  @com-ani-time: var(--ui-ani-time);
56
59
  @com-color-primary-text: var(--ui-color-primary-text);
57
60
  @com-font-weight-medium: var(--ui-font-weight-medium);
58
61
 
59
62
  > .title {
60
- padding-top: @com-space-mini;
63
+ margin-left: calc(@com-space-micro * -1);
64
+ }
61
65
 
62
- color: @com-color-primary-text;
63
- font-weight: @com-font-weight-medium;
64
- cursor: pointer;
66
+ > .title {
67
+ padding-inline: @com-space-micro;
65
68
 
66
- -webkit-user-select: none;
67
- user-select: none;
69
+ .button-content .slot-default {
70
+ padding-inline: 0;
71
+ }
68
72
  }
69
73
 
70
74
  > .content {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@community-release/nx-ui",
3
- "version": "0.0.67",
3
+ "version": "0.0.72",
4
4
  "packageManager": "pnpm@10.14.0",
5
5
  "description": "nx-ui - Nuxt UI library",
6
6
  "repository": {