nuxt-glorious 1.2.1-5 → 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-5"
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
 
@@ -0,0 +1,77 @@
1
+ .glorious-simple-table {
2
+ @apply overflow-x-auto;
3
+ }
4
+ .glorious-simple-table.color-orange > table {
5
+ @apply border border-orange-400;
6
+ }
7
+ .glorious-simple-table.color-orange > table > thead {
8
+ @apply rounded-t-md overflow-hidden;
9
+ @apply bg-orange-400;
10
+ }
11
+ .glorious-simple-table.color-orange > table > tbody > tr:nth-child(even) {
12
+ @apply bg-orange-50;
13
+ }
14
+ .glorious-simple-table.color-orange > table > tbody > tr > td {
15
+ @apply px-4 py-1 text-center;
16
+ }
17
+ .glorious-simple-table.color-blue > table {
18
+ @apply border border-blue-400;
19
+ }
20
+ .glorious-simple-table.color-blue > table > thead {
21
+ @apply rounded-t-md overflow-hidden;
22
+ @apply bg-blue-400;
23
+ }
24
+ .glorious-simple-table.color-blue > table > tbody > tr:nth-child(even) {
25
+ @apply bg-blue-50;
26
+ }
27
+ .glorious-simple-table.color-blue > table > tbody > tr > td {
28
+ @apply px-4 py-1 text-center;
29
+ }
30
+ .glorious-simple-table.color-gray > table {
31
+ @apply border border-gray-400;
32
+ }
33
+ .glorious-simple-table.color-gray > table > thead {
34
+ @apply rounded-t-md overflow-hidden;
35
+ @apply bg-gray-400;
36
+ }
37
+ .glorious-simple-table.color-gray > table > tbody > tr:nth-child(even) {
38
+ @apply bg-gray-50;
39
+ }
40
+ .glorious-simple-table.color-gray > table > tbody > tr > td {
41
+ @apply px-4 py-1 text-center;
42
+ }
43
+ .glorious-simple-table.color-red > table {
44
+ @apply border border-red-400;
45
+ }
46
+ .glorious-simple-table.color-red > table > thead {
47
+ @apply rounded-t-md overflow-hidden;
48
+ @apply bg-red-400;
49
+ }
50
+ .glorious-simple-table.color-red > table > tbody > tr:nth-child(even) {
51
+ @apply bg-red-50;
52
+ }
53
+ .glorious-simple-table.color-red > table > tbody > tr > td {
54
+ @apply px-4 py-1 text-center;
55
+ }
56
+ .glorious-simple-table.color-green > table {
57
+ @apply border border-green-400;
58
+ }
59
+ .glorious-simple-table.color-green > table > thead {
60
+ @apply rounded-t-md overflow-hidden;
61
+ @apply bg-green-400;
62
+ }
63
+ .glorious-simple-table.color-green > table > tbody > tr:nth-child(even) {
64
+ @apply bg-green-50;
65
+ }
66
+ .glorious-simple-table.color-green > table > tbody > tr > td {
67
+ @apply px-4 py-1 text-center;
68
+ }
69
+ .glorious-simple-table > table {
70
+ @apply w-full;
71
+ }
72
+ .glorious-simple-table > table > thead > tr > th {
73
+ @apply px-4 py-2 text-center;
74
+ }
75
+ .glorious-simple-table > table > tbody > tr > td {
76
+ @apply px-4 py-1 text-center;
77
+ }
@@ -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,
@@ -0,0 +1,119 @@
1
+ <script lang="ts" setup>
2
+ type simpleTableInterface = {
3
+ head: Array<String>;
4
+ body: Array<any>;
5
+ };
6
+
7
+ const props = defineProps({
8
+ color: {
9
+ required: false,
10
+ default: "blue",
11
+ type: String as () => "orange" | "blue" | "gray" | "red" | "green",
12
+ },
13
+ table: {
14
+ required: true,
15
+ type: Object as () => simpleTableInterface,
16
+ },
17
+ });
18
+ </script>
19
+
20
+ <template>
21
+ <div class="glorious-simple-table" :class="[`color-${props.color}`]">
22
+ <table>
23
+ <thead>
24
+ <tr>
25
+ <th v-for="(headItem, index) in props.table.head" :key="index">
26
+ {{ headItem }}
27
+ </th>
28
+ </tr>
29
+ </thead>
30
+ <tbody>
31
+ <tr v-for="(bodyItem, index) in props.table.body" :key="index">
32
+ <td v-for="(bodyRecord, rIndex) in bodyItem" :key="rIndex">
33
+ {{ bodyRecord }}
34
+ </td>
35
+ </tr>
36
+ </tbody>
37
+ </table>
38
+ </div>
39
+ </template>
40
+
41
+ <style>
42
+ .glorious-simple-table {
43
+ @apply overflow-x-auto;
44
+ }
45
+ .glorious-simple-table.color-orange > table {
46
+ @apply border border-orange-400;
47
+ }
48
+ .glorious-simple-table.color-orange > table > thead {
49
+ @apply rounded-t-md overflow-hidden;
50
+ @apply bg-orange-400;
51
+ }
52
+ .glorious-simple-table.color-orange > table > tbody > tr:nth-child(even) {
53
+ @apply bg-orange-50;
54
+ }
55
+ .glorious-simple-table.color-orange > table > tbody > tr > td {
56
+ @apply px-4 py-1 text-center;
57
+ }
58
+ .glorious-simple-table.color-blue > table {
59
+ @apply border border-blue-400;
60
+ }
61
+ .glorious-simple-table.color-blue > table > thead {
62
+ @apply rounded-t-md overflow-hidden;
63
+ @apply bg-blue-400;
64
+ }
65
+ .glorious-simple-table.color-blue > table > tbody > tr:nth-child(even) {
66
+ @apply bg-blue-50;
67
+ }
68
+ .glorious-simple-table.color-blue > table > tbody > tr > td {
69
+ @apply px-4 py-1 text-center;
70
+ }
71
+ .glorious-simple-table.color-gray > table {
72
+ @apply border border-gray-400;
73
+ }
74
+ .glorious-simple-table.color-gray > table > thead {
75
+ @apply rounded-t-md overflow-hidden;
76
+ @apply bg-gray-400;
77
+ }
78
+ .glorious-simple-table.color-gray > table > tbody > tr:nth-child(even) {
79
+ @apply bg-gray-50;
80
+ }
81
+ .glorious-simple-table.color-gray > table > tbody > tr > td {
82
+ @apply px-4 py-1 text-center;
83
+ }
84
+ .glorious-simple-table.color-red > table {
85
+ @apply border border-red-400;
86
+ }
87
+ .glorious-simple-table.color-red > table > thead {
88
+ @apply rounded-t-md overflow-hidden;
89
+ @apply bg-red-400;
90
+ }
91
+ .glorious-simple-table.color-red > table > tbody > tr:nth-child(even) {
92
+ @apply bg-red-50;
93
+ }
94
+ .glorious-simple-table.color-red > table > tbody > tr > td {
95
+ @apply px-4 py-1 text-center;
96
+ }
97
+ .glorious-simple-table.color-green > table {
98
+ @apply border border-green-400;
99
+ }
100
+ .glorious-simple-table.color-green > table > thead {
101
+ @apply rounded-t-md overflow-hidden;
102
+ @apply bg-green-400;
103
+ }
104
+ .glorious-simple-table.color-green > table > tbody > tr:nth-child(even) {
105
+ @apply bg-green-50;
106
+ }
107
+ .glorious-simple-table.color-green > table > tbody > tr > td {
108
+ @apply px-4 py-1 text-center;
109
+ }
110
+ .glorious-simple-table > table {
111
+ @apply w-full;
112
+ }
113
+ .glorious-simple-table > table > thead > tr > th {
114
+ @apply px-4 py-2 text-center;
115
+ }
116
+ .glorious-simple-table > table > tbody > tr > td {
117
+ @apply px-4 py-1 text-center;
118
+ }
119
+ </style>
@@ -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-5",
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",