nuxt-glorious 1.2.9-9-1 → 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-1"
4
+ "version": "1.2.9-9-3"
5
5
  }
@@ -72,12 +72,21 @@ 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
- if (tags.value.length === 0) tags.value = []
76
-
77
- const value: any = option
78
- tags.value.push(value)
79
- modelValue.value = tags.value
80
- inputValue.value = ''
75
+ if (
76
+ typeof tags.value === 'string' ||
77
+ typeof tags.value === 'undefined' ||
78
+ tags.value.length === 0
79
+ )
80
+ tags.value = []
81
+
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
+ }
81
90
  }
82
91
 
83
92
  const removeTag = (tag: string) => {
@@ -108,7 +117,10 @@ const inputClicked = (event: any) => {
108
117
  gio.forEach((element: any) => element.classList.add('hidden'))
109
118
 
110
119
  const optionsElement = event.currentTarget.parentElement.children[1]
111
- if (optionsElement.classList.contains('hidden'))
120
+ if (
121
+ typeof optionsElement !== 'undefined' &&
122
+ optionsElement.classList.contains('hidden')
123
+ )
112
124
  optionsElement.classList.remove('hidden')
113
125
  }
114
126
  }
@@ -143,6 +155,7 @@ const inputClicked = (event: any) => {
143
155
  `size-${props.size}`,
144
156
  `glorious-input-${props.color}`,
145
157
  props.type === 'password' ? 'pl-[30px] pr-3' : 'px-3',
158
+ `mode-${props.mode}`,
146
159
  ]"
147
160
  :placeholder="props.placeholder"
148
161
  :disabled="props.disabled"
@@ -171,20 +184,12 @@ const inputClicked = (event: any) => {
171
184
  :class="[`size-${props.size}`]"
172
185
  >
173
186
  <div
174
- v-if="props.loadingOptions"
175
- class="flex justify-center"
187
+ v-for="(option, index) in props.options"
188
+ :key="index"
189
+ @click="addTagViaOption(option, $event)"
176
190
  >
177
- <GLoading color="green" />
191
+ {{ option[props.displayTextKey] }}
178
192
  </div>
179
- <template v-else>
180
- <div
181
- v-for="(option, index) in props.options"
182
- :key="index"
183
- @click="addTagViaOption(option, $event)"
184
- >
185
- {{ option[props.displayTextKey] }}
186
- </div>
187
- </template>
188
193
  </div>
189
194
  </div>
190
195
  <div
@@ -210,6 +215,12 @@ const inputClicked = (event: any) => {
210
215
  :name="props.icon"
211
216
  :size="computeIconSize"
212
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>
213
224
  </div>
214
225
  <GErrorText :error="props.error" />
215
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-1",
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",