nuxt-glorious 2.0.0-develop-2 → 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-2"
4
+ "version": "2.0.0-develop-4"
5
5
  }
package/dist/module.mjs CHANGED
@@ -57,6 +57,7 @@ const module = defineNuxtModule({
57
57
  dir: resolver.resolve("./runtime/assets")
58
58
  });
59
59
  });
60
+ addPlugin(resolver.resolve("./runtime/plugins/modalClose"));
60
61
  addPlugin(resolver.resolve("./runtime/plugins/InputComponent"));
61
62
  addRouteMiddleware({
62
63
  name: "g-auth-strategy",
@@ -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[
@@ -26,14 +26,6 @@ watch(
26
26
  }
27
27
  }
28
28
  )
29
-
30
- onMounted(() => {
31
- document.onkeydown = (e) => {
32
- if (e.code === 'Escape') {
33
- modelValue.value = false
34
- }
35
- }
36
- })
37
29
  </script>
38
30
 
39
31
  <template>
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import { defineNuxtPlugin } from "#imports";
2
+ import { GloriousStore } from "../stores/GloriousStore.mjs";
3
+ export default defineNuxtPlugin((nuxtApp) => {
4
+ const gs = GloriousStore();
5
+ nuxtApp.hook("app:beforeMount", () => {
6
+ document.onkeydown = (e) => {
7
+ if (e.code === "Escape") {
8
+ Object.entries(gs.modals).map((item, index) => {
9
+ const [key, value] = item;
10
+ if (value) {
11
+ gs.modals[key] = false;
12
+ }
13
+ });
14
+ }
15
+ };
16
+ });
17
+ });
@@ -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
  }
@@ -10,6 +10,7 @@ export const GloriousStore = defineStore("GloriousStore", {
10
10
  keepData: {},
11
11
  forms: {},
12
12
  response: {},
13
+ modals: {},
13
14
  keepResponse: []
14
15
  }),
15
16
  getters: {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.0-develop-2",
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",
@@ -1,4 +0,0 @@
1
- export interface ModuleOptions {
2
- }
3
- declare const _default: import("@nuxt/schema").NuxtModule<ModuleOptions, ModuleOptions, false>;
4
- export default _default;
@@ -1,94 +0,0 @@
1
- import {
2
- defineNuxtModule,
3
- addPlugin,
4
- addComponentsDir,
5
- createResolver,
6
- addImportsDir,
7
- installModule,
8
- addRouteMiddleware
9
- } from "@nuxt/kit";
10
- import defu from "defu";
11
- export default defineNuxtModule({
12
- meta: {
13
- name: "glorious",
14
- configKey: "glorious"
15
- },
16
- // Default configuration options of the Nuxt module
17
- defaults: {},
18
- async setup(options, nuxt) {
19
- const resolver = createResolver(import.meta.url);
20
- nuxt.options.runtimeConfig.public.glorious = defu(nuxt.options.glorious, {
21
- fetch: {
22
- baseURL: "/",
23
- credentials: "same-origin"
24
- },
25
- seo: {
26
- suffix: "",
27
- title: "",
28
- description: ""
29
- },
30
- auth: {
31
- cookie: {
32
- name: "ga-token",
33
- httpOnly: false
34
- },
35
- redirect: {
36
- logout: "/login",
37
- login: "/login"
38
- },
39
- strategy: {
40
- provider: "",
41
- //[laravel-passport]
42
- endpoints: {
43
- userInfo: {
44
- url: "/",
45
- method: "GET",
46
- pick: ""
47
- }
48
- }
49
- }
50
- }
51
- });
52
- await installModule("@nuxtjs/tailwindcss", {
53
- // module configuration
54
- exposeConfig: true,
55
- config: {
56
- darkMode: "class",
57
- content: {
58
- files: [
59
- resolver.resolve("./runtime/components/G/**/*.{vue,mjs,ts}"),
60
- resolver.resolve("./runtime/*.{mjs,js,ts}")
61
- ]
62
- }
63
- }
64
- });
65
- await installModule("@pinia/nuxt");
66
- addImportsDir(resolver.resolve("runtime/composables"));
67
- addImportsDir(resolver.resolve("runtime/stores"));
68
- addImportsDir(resolver.resolve("runtime/middlewares"));
69
- addComponentsDir({
70
- path: resolver.resolve("runtime/components"),
71
- global: true,
72
- watch: false
73
- });
74
- nuxt.hook("nitro:config", async (nitro) => {
75
- nitro.publicAssets.push({
76
- dir: resolver.resolve("./runtime/assets")
77
- });
78
- });
79
- addPlugin(resolver.resolve("./runtime/plugins/glorious-app-setting"));
80
- addPlugin({
81
- src: resolver.resolve("./runtime/plugins/InputComponent"),
82
- mode: "client"
83
- });
84
- addRouteMiddleware({
85
- name: "g-auth-strategy",
86
- path: resolver.resolve("./runtime/middlewares/AuthStrategy"),
87
- global: true
88
- });
89
- addRouteMiddleware({
90
- name: "g-auth",
91
- path: resolver.resolve("./runtime/middlewares/Auth")
92
- });
93
- }
94
- });