nuxt-glorious 1.2.1-7 → 1.2.1-9

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-9"
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;
@@ -1,11 +1,12 @@
1
1
  <script lang="ts" setup>
2
2
  import { useGloriousAppSetting } from "../../composables/useGloriousAppSetting";
3
+ import { watch } from "#imports";
3
4
 
4
5
  const props = defineProps({
5
- id: {
6
- required: false,
7
- default: "drawer",
8
- type: String,
6
+ modelValue: {
7
+ required: true,
8
+ default: false,
9
+ type: Boolean,
9
10
  },
10
11
  dir: {
11
12
  require: false,
@@ -13,12 +14,41 @@ const props = defineProps({
13
14
  type: String as () => "rtl" | "ltr",
14
15
  },
15
16
  });
17
+
18
+ const emits = defineEmits(["update:modelValue"]);
19
+
20
+ const addBlurBackground = (): void => {
21
+ const backgroundBlur = document.createElement("div");
22
+ backgroundBlur.classList.add("glorious-scaffold-drawer-bg-blur");
23
+ const nuxt: any = document.getElementById("__nuxt");
24
+ nuxt.appendChild(backgroundBlur);
25
+ backgroundBlur.addEventListener("click", () => {
26
+ console.log("here");
27
+
28
+ emits("update:modelValue", false);
29
+ backgroundBlur.remove();
30
+ });
31
+ };
32
+
33
+ watch(
34
+ () => props.modelValue,
35
+ () => {
36
+ if (props.modelValue) {
37
+ addBlurBackground();
38
+ } else {
39
+ const blur: any = document.querySelector(
40
+ ".glorious-scaffold-drawer-bg-blur"
41
+ );
42
+ if (blur !== null) blur.remove();
43
+ }
44
+ }
45
+ );
16
46
  </script>
17
47
  <template>
18
48
  <div
19
- :id="props.id"
20
49
  :class="[
21
50
  props.dir === null ? useGloriousAppSetting.getSetting().dir : props.dir,
51
+ props.modelValue ? 'open' : 'close',
22
52
  ]"
23
53
  class="drawer close hidden"
24
54
  >
@@ -29,7 +59,7 @@ const props = defineProps({
29
59
  </template>
30
60
 
31
61
  <style>
32
- .bg-blur-drawer {
62
+ .glorious-scaffold-drawer-bg-blur {
33
63
  @apply fixed top-0 right-0 backdrop-blur-sm bg-gray-500 bg-opacity-50 h-full w-full z-[40];
34
64
  }
35
65
 
@@ -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-9",
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",