nuxt-glorious 1.2.1-7 → 1.2.1-8

Sign up to get free protection for your applications and to get access to all the features.
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "glorious",
3
3
  "configKey": "glorious",
4
- "version": "1.2.1-7"
4
+ "version": "1.2.1-8"
5
5
  }
@@ -1,4 +1,4 @@
1
- .bg-blur-drawer {
1
+ .glorious-scaffold-drawer-bg-blur {
2
2
  @apply fixed top-0 right-0 backdrop-blur-sm bg-gray-500 bg-opacity-50 h-full w-full z-[40];
3
3
  }
4
4
 
@@ -23,6 +23,9 @@ const props = defineProps({
23
23
  });
24
24
 
25
25
  const emits = defineEmits(["update:modelValue"]);
26
+
27
+ const inputFunction = (event: any) =>
28
+ emits("update:modelValue", event.currentTarget.checked);
26
29
  </script>
27
30
 
28
31
  <template>
@@ -30,7 +33,7 @@ const emits = defineEmits(["update:modelValue"]);
30
33
  <input
31
34
  type="checkbox"
32
35
  :disabled="props.disabled"
33
- @input="emits('update:modelValue', $event?.currentTarget.checked)"
36
+ @input="inputFunction($event)"
34
37
  />
35
38
  <div></div>
36
39
  </label>
@@ -42,7 +42,8 @@ onMounted(() => {
42
42
  }
43
43
  }
44
44
 
45
- document.getElementById("countDown" + id).innerText = timeString;
45
+ const countDownElement: any = document.getElementById("countDown" + id);
46
+ countDownElement.innerText = timeString;
46
47
 
47
48
  if (second === 0) {
48
49
  isEnd.value = true;
@@ -2,10 +2,10 @@
2
2
  import { useGloriousAppSetting } from "../../composables/useGloriousAppSetting";
3
3
 
4
4
  const props = defineProps({
5
- id: {
6
- required: false,
7
- default: "drawer",
8
- type: String,
5
+ modelValue: {
6
+ required: true,
7
+ default: false,
8
+ type: Boolean,
9
9
  },
10
10
  dir: {
11
11
  require: false,
@@ -13,12 +13,41 @@ const props = defineProps({
13
13
  type: String as () => "rtl" | "ltr",
14
14
  },
15
15
  });
16
+
17
+ const emits = defineEmits(["update:modelValue"]);
18
+
19
+ const addBlurBackground = (): void => {
20
+ const backgroundBlur = document.createElement("div");
21
+ backgroundBlur.classList.add("glorious-scaffold-drawer-bg-blur");
22
+ const nuxt: any = document.getElementById("__nuxt");
23
+ nuxt.appendChild(backgroundBlur);
24
+ backgroundBlur.addEventListener("click", () => {
25
+ console.log("here");
26
+
27
+ emits("update:modelValue", false);
28
+ backgroundBlur.remove();
29
+ });
30
+ };
31
+
32
+ watch(
33
+ () => props.modelValue,
34
+ () => {
35
+ if (props.modelValue) {
36
+ addBlurBackground();
37
+ } else {
38
+ const blur: any = document.querySelector(
39
+ ".glorious-scaffold-drawer-bg-blur"
40
+ );
41
+ if (blur !== null) blur.remove();
42
+ }
43
+ }
44
+ );
16
45
  </script>
17
46
  <template>
18
47
  <div
19
- :id="props.id"
20
48
  :class="[
21
49
  props.dir === null ? useGloriousAppSetting.getSetting().dir : props.dir,
50
+ props.modelValue ? 'open' : 'close',
22
51
  ]"
23
52
  class="drawer close hidden"
24
53
  >
@@ -29,7 +58,7 @@ const props = defineProps({
29
58
  </template>
30
59
 
31
60
  <style>
32
- .bg-blur-drawer {
61
+ .glorious-scaffold-drawer-bg-blur {
33
62
  @apply fixed top-0 right-0 backdrop-blur-sm bg-gray-500 bg-opacity-50 h-full w-full z-[40];
34
63
  }
35
64
 
@@ -1,5 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import { GloriousStore } from "#imports";
2
+ import { GloriousStore } from "../../stores/GloriousStore";
3
+
3
4
  const props = defineProps({
4
5
  error: {
5
6
  required: false,
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { onMounted, useId, watch } from "#imports";
2
+ import { watch } from "#imports";
3
3
  const props = defineProps({
4
4
  modelValue: {
5
5
  required: true,
@@ -36,6 +36,9 @@ const props = defineProps({
36
36
  });
37
37
 
38
38
  const emits = defineEmits(["update:modelValue"]);
39
+
40
+ const inputFunction = (event: any) =>
41
+ emits("update:modelValue", event.currentTarget.checked);
39
42
  </script>
40
43
 
41
44
  <template>
@@ -46,7 +49,7 @@ const emits = defineEmits(["update:modelValue"]);
46
49
  :disabled="props.disabled"
47
50
  :value="props.value"
48
51
  :checked="props.checked"
49
- @input="emits('update:modelValue', $event?.currentTarget.value)"
52
+ @input="inputFunction($event)"
50
53
  />
51
54
  <div></div>
52
55
  </label>
@@ -1,5 +1,9 @@
1
1
  <script lang="ts" setup>
2
2
  import { ref, watch } from "#imports";
3
+ interface selectOptionsInterface {
4
+ text: string;
5
+ value: [string, object];
6
+ }
3
7
  const props = defineProps({
4
8
  modelValue: {
5
9
  required: false,
@@ -9,7 +13,7 @@ const props = defineProps({
9
13
  options: {
10
14
  required: true,
11
15
  default: [],
12
- type: Array<object>,
16
+ type: Array<selectOptionsInterface>,
13
17
  },
14
18
  color: {
15
19
  required: false,
@@ -42,7 +46,7 @@ const props = defineProps({
42
46
  type: String,
43
47
  },
44
48
  });
45
- const selectValue = ref(null);
49
+ const selectValue: any = ref(null);
46
50
  const emits = defineEmits(["update:modelValue"]);
47
51
  watch(
48
52
  () => selectValue.value,
@@ -29,12 +29,10 @@ export default function(url, options = defaultOptions) {
29
29
  } catch (e) {
30
30
  }
31
31
  },
32
- onResponse({ response: res }) {
32
+ onResponse() {
33
33
  try {
34
34
  gs.loading[gKey] = false;
35
35
  gs.forms[gKey].errors = [];
36
- if (res.status >= 200 && res.status <= 299 && Object.prototype.hasOwnProperty.call(options, "saveBody") && !options.saveBody)
37
- gs.forms[gKey].form = {};
38
36
  } catch (e) {
39
37
  }
40
38
  },
@@ -1,9 +1,9 @@
1
1
  import {
2
- GloriousStore,
3
2
  defineNuxtRouteMiddleware,
4
3
  useCookie,
5
4
  useNuxtApp
6
5
  } from "#imports";
6
+ import { GloriousStore } from "../stores/GloriousStore.mjs";
7
7
  export default defineNuxtRouteMiddleware(() => {
8
8
  const nuxtApp = useNuxtApp();
9
9
  const moduleConfig = nuxtApp.$config.public.glorious;
@@ -3,6 +3,7 @@ export declare const GloriousStore: import("pinia").StoreDefinition<"GloriousSto
3
3
  }, {
4
4
  formCreate(key: string | Array<string>): void;
5
5
  modalCreate(key: string | Array<string>): void;
6
+ drawerCreate(key: string | Array<string>): void;
6
7
  authLogout(): void;
7
8
  authSetToken(token: string, to?: string | null): void;
8
9
  authParseToken(token: any): any;
@@ -45,6 +45,14 @@ export const GloriousStore = defineStore("GloriousStore", {
45
45
  this.modals[item] = defaultValue;
46
46
  });
47
47
  },
48
+ drawerCreate(key) {
49
+ this.drawers = {};
50
+ if (typeof key === "string") this.drawers[key] = false;
51
+ else
52
+ key.map((item) => {
53
+ this.drawers[item] = false;
54
+ });
55
+ },
48
56
  authLogout() {
49
57
  const moduleConfig = useRuntimeConfig();
50
58
  const token = useCookie(moduleConfig.public.glorious.auth.cookie.name);
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.1-7",
2
+ "version": "1.2.1-8",
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",