nuxt-glorious 1.2.9-9-2 → 1.2.9-9-3

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": "1.2.9-9-2"
4
+ "version": "1.2.9-9-3"
5
5
  }
@@ -72,8 +72,6 @@ const addTag = (event: any) => {
72
72
 
73
73
  const addTagViaOption = (option: any, event: any) => {
74
74
  // event.stopPropagation() if want not close with window
75
- console.log(typeof tags.value)
76
-
77
75
  if (
78
76
  typeof tags.value === 'string' ||
79
77
  typeof tags.value === 'undefined' ||
@@ -81,10 +79,14 @@ const addTagViaOption = (option: any, event: any) => {
81
79
  )
82
80
  tags.value = []
83
81
 
84
- const value: any = option
85
- tags.value.push(value)
86
- modelValue.value = tags.value
87
- inputValue.value = ''
82
+ const find = tags.value.find((item: any) => item.value === option.value)
83
+
84
+ if (typeof find === 'undefined') {
85
+ const value: any = option
86
+ tags.value.push(value)
87
+ modelValue.value = tags.value
88
+ inputValue.value = ''
89
+ }
88
90
  }
89
91
 
90
92
  const removeTag = (tag: string) => {
@@ -115,7 +117,10 @@ const inputClicked = (event: any) => {
115
117
  gio.forEach((element: any) => element.classList.add('hidden'))
116
118
 
117
119
  const optionsElement = event.currentTarget.parentElement.children[1]
118
- if (optionsElement.classList.contains('hidden'))
120
+ if (
121
+ typeof optionsElement !== 'undefined' &&
122
+ optionsElement.classList.contains('hidden')
123
+ )
119
124
  optionsElement.classList.remove('hidden')
120
125
  }
121
126
  }
@@ -150,6 +155,7 @@ const inputClicked = (event: any) => {
150
155
  `size-${props.size}`,
151
156
  `glorious-input-${props.color}`,
152
157
  props.type === 'password' ? 'pl-[30px] pr-3' : 'px-3',
158
+ `mode-${props.mode}`,
153
159
  ]"
154
160
  :placeholder="props.placeholder"
155
161
  :disabled="props.disabled"
@@ -178,20 +184,12 @@ const inputClicked = (event: any) => {
178
184
  :class="[`size-${props.size}`]"
179
185
  >
180
186
  <div
181
- v-if="props.loadingOptions"
182
- class="flex justify-center"
187
+ v-for="(option, index) in props.options"
188
+ :key="index"
189
+ @click="addTagViaOption(option, $event)"
183
190
  >
184
- <GLoading color="green" />
191
+ {{ option[props.displayTextKey] }}
185
192
  </div>
186
- <template v-else>
187
- <div
188
- v-for="(option, index) in props.options"
189
- :key="index"
190
- @click="addTagViaOption(option, $event)"
191
- >
192
- {{ option[props.displayTextKey] }}
193
- </div>
194
- </template>
195
193
  </div>
196
194
  </div>
197
195
  <div
@@ -217,6 +215,12 @@ const inputClicked = (event: any) => {
217
215
  :name="props.icon"
218
216
  :size="computeIconSize"
219
217
  />
218
+ <div
219
+ v-if="props.loadingOptions"
220
+ class="absolute top-1 bottom-0 my-auto left-1"
221
+ >
222
+ <GLoading color="green" />
223
+ </div>
220
224
  </div>
221
225
  <GErrorText :error="props.error" />
222
226
  </div>
@@ -38,6 +38,7 @@ const firstVal = selectValue.value
38
38
  *
39
39
  </span>
40
40
  </span>
41
+ {{ selectValue === '' }}
41
42
  <div class="grow flex relative">
42
43
  <select
43
44
  v-model="selectValue"
@@ -48,6 +49,9 @@ const firstVal = selectValue.value
48
49
  `color-${props.color}`,
49
50
  props.size,
50
51
  hasValidationError(props.error) ? 'validation-error' : '',
52
+ selectValue === null || selectValue === ''
53
+ ? 'text-gray-500'
54
+ : 'text-black',
51
55
  ]"
52
56
  >
53
57
  <option
@@ -2,12 +2,28 @@ import { defineNuxtPlugin } from "#imports";
2
2
  export default defineNuxtPlugin((nuxtApp) => {
3
3
  nuxtApp.hook("app:beforeMount", () => {
4
4
  window.addEventListener("click", (event) => {
5
+ function getElementPosition(element) {
6
+ let rect = element.getBoundingClientRect();
7
+ let scrollTop = window.pageYOffset || document.documentElement.scrollTop;
8
+ return rect.top + scrollTop;
9
+ }
5
10
  if (!event.target.matches(".glorious-input-field")) {
6
11
  const options = document.querySelectorAll(".glorious-input-options");
7
12
  options.forEach((el) => {
8
13
  el.classList.add("hidden");
9
14
  });
10
15
  }
16
+ if (event.target.matches(".glorious-input-field") && event.target.classList.contains("mode-tag")) {
17
+ if (typeof event.target.nextElementSibling?.offsetHeight !== "undefined") {
18
+ if (window.innerHeight < getElementPosition(event.target) + event.target.offsetHeight + event.target.nextElementSibling.offsetHeight) {
19
+ event.target.nextElementSibling.style.width = `${event.target.offsetWidth}px`;
20
+ event.target.nextElementSibling.style.top = `${getElementPosition(event.target) - event.target.nextElementSibling.offsetHeight}px`;
21
+ } else {
22
+ event.target.nextElementSibling.style.width = `${event.target.offsetWidth}px`;
23
+ event.target.nextElementSibling.style.top = `${getElementPosition(event.target) + event.target.offsetHeight}px`;
24
+ }
25
+ }
26
+ }
11
27
  });
12
28
  });
13
29
  });
@@ -174,14 +174,11 @@
174
174
  }
175
175
 
176
176
  .glorious-input-options {
177
- @apply p-1 shadow-lg absolute w-full bg-white rounded border-gray-200 border max-h-[200px] overflow-y-auto z-40;
177
+ @apply p-1 shadow-lg fixed w-full bg-white rounded border-gray-200 border max-h-[200px] overflow-y-auto z-40;
178
178
  }
179
179
  .glorious-input-options > div {
180
180
  @apply py-2 hover:bg-gray-100 cursor-pointer rounded px-2;
181
181
  }
182
- .glorious-input-options.size-md {
183
- @apply top-11;
184
- }
185
182
  .glorious-input div > input::placeholder {
186
183
  @apply text-gray-500;
187
184
  }
@@ -70,15 +70,15 @@
70
70
  .glorious-input {
71
71
  // -------------------------------------------------- OPTION
72
72
  &-options {
73
- @apply p-1 shadow-lg absolute w-full bg-white rounded border-gray-200 border max-h-[200px] overflow-y-auto z-40;
73
+ @apply p-1 shadow-lg fixed w-full bg-white rounded border-gray-200 border max-h-[200px] overflow-y-auto z-40;
74
74
 
75
75
  > div {
76
76
  @apply py-2 hover:bg-gray-100 cursor-pointer rounded px-2;
77
77
  }
78
78
 
79
- &.size-md {
80
- @apply top-11;
81
- }
79
+ // &.size-md {
80
+ // @apply top-11;
81
+ // }
82
82
  }
83
83
 
84
84
  div > input::placeholder {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.9-9-2",
2
+ "version": "1.2.9-9-3",
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",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "scripts": {
22
22
  "prepack": "nuxt-module-build build && cp -R src/runtime/style dist/runtime",
23
- "dev": "nuxi dev playground",
23
+ "dev": "nuxi dev --port=3001 playground",
24
24
  "dev:build": "nuxi build playground",
25
25
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
26
26
  "release": "npm run prepack && npm publish",