nuxt-glorious 2.0.0-develop-3 → 2.0.0-develop-4

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": "nuxt-glorious",
3
3
  "configKey": "glorious",
4
- "version": "2.0.0-develop-3"
4
+ "version": "2.0.0-develop-4"
5
5
  }
@@ -4,7 +4,7 @@ import { hasValidationError, getAttribute } from '../helper'
4
4
  import _props from '../props/Input'
5
5
 
6
6
  const props: any = defineProps(_props)
7
- const modelValue = defineModel()
7
+ const modelValue: any = defineModel()
8
8
  const { numbersWithSeparateSamePrice } = useGloriousCore()
9
9
  modelValue.value = ''
10
10
  const inputValue: any = ref(null)
@@ -68,6 +68,18 @@ const addTag = (event: any) => {
68
68
  inputValue.value = ''
69
69
  }
70
70
 
71
+ const isSelected = (value: any): boolean => {
72
+ if (typeof tags.value !== 'object' && typeof modelValue.value !== 'object')
73
+ return false
74
+
75
+ console.log()
76
+
77
+ return (
78
+ tags.value.some((item: any) => item.value === value) ||
79
+ (typeof modelValue.value === 'object' &&
80
+ modelValue.value.some((item: any) => item.value === value))
81
+ )
82
+ }
71
83
  const addTagViaOption = (option: any, event: any) => {
72
84
  // event.stopPropagation() if want not close with window
73
85
  if (
@@ -77,9 +89,7 @@ const addTagViaOption = (option: any, event: any) => {
77
89
  )
78
90
  tags.value = []
79
91
 
80
- const find = tags.value.find((item: any) => item.value === option.value)
81
-
82
- if (typeof find === 'undefined') {
92
+ if (!isSelected(option.value)) {
83
93
  const value: any = option
84
94
  tags.value.push(value)
85
95
  modelValue.value = tags.value
@@ -202,6 +212,11 @@ const inputClicked = (event: any) => {
202
212
  v-for="(option, index) in props.options"
203
213
  :key="index"
204
214
  @click="addTagViaOption(option, $event)"
215
+ :class="[
216
+ isSelected(option.value)
217
+ ? '!cursor-not-allowed bg-gray-50'
218
+ : '',
219
+ ]"
205
220
  >
206
221
  {{
207
222
  option[
@@ -741,6 +741,9 @@ button:focus-visible {
741
741
  .glorious-scaffold-modal-footer > button {
742
742
  @apply min-w-24;
743
743
  }
744
+ .glorious-scaffold-modal div.glorious-input-options {
745
+ @apply fixed;
746
+ }
744
747
  .glorious-scaffold-modal-bg-blur {
745
748
  @apply fixed top-0 right-0 backdrop-blur-sm bg-gray-500 opacity-50 h-full w-full z-[40];
746
749
  }
@@ -13,6 +13,9 @@
13
13
  .glorious-scaffold-modal-footer > button {
14
14
  @apply min-w-24;
15
15
  }
16
+ .glorious-scaffold-modal div.glorious-input-options {
17
+ @apply fixed;
18
+ }
16
19
  .glorious-scaffold-modal-bg-blur {
17
20
  @apply fixed top-0 right-0 backdrop-blur-sm bg-gray-500 opacity-50 h-full w-full z-[40];
18
21
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.0-develop-3",
2
+ "version": "2.0.0-develop-4",
3
3
  "name": "nuxt-glorious",
4
4
  "description": "This package provides many things needed by a project, including server requests and authentication, SEO and other requirements of a project.",
5
5
  "repository": "sajadhzj/nuxt-glorious",