nuxt-glorious 0.7.9-7 → 0.8.1-oteacher

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": "0.7.9-7"
4
+ "version": "0.8.1-oteacher"
5
5
  }
@@ -30,7 +30,7 @@
30
30
  }
31
31
 
32
32
  .outline.glorious-button-orange, .outline.glorious-button-blue, .outline.glorious-button-gray, .outline.glorious-button-red, .outline.glorious-button-primary {
33
- @apply bg-transparent border outline-none;
33
+ @apply border outline-none;
34
34
  }
35
35
 
36
36
  .glorious-button-orange > div.loading, .glorious-button-blue > div.loading, .glorious-button-gray > div.loading, .glorious-button-red > div.loading, .glorious-button-primary > div.loading {
@@ -3,7 +3,7 @@
3
3
  }
4
4
 
5
5
  .drawer {
6
- @apply fixed top-0 bg-white h-full w-[300px] z-[50];
6
+ @apply fixed top-0 h-full w-[300px] z-[50];
7
7
  }
8
8
  .drawer.close.rtl {
9
9
  animation: drawer-close-right 250ms normal forwards;
@@ -14,5 +14,5 @@
14
14
  @apply absolute top-0 bottom-0 my-auto z-[20];
15
15
  }
16
16
  .glorious-dropdown.open > div:last-child {
17
- @apply bg-white px-2 py-2 rounded-md shadow absolute z-[41] left-[16px] top-5 flex;
17
+ @apply px-2 py-2 rounded-md shadow absolute z-[41] left-[16px] top-5 flex;
18
18
  }
@@ -3,7 +3,7 @@
3
3
  }
4
4
 
5
5
  .glorious-modal {
6
- @apply fixed bg-white md:top-[15%] z-50 right-0 left-0 mx-auto p-3 md:rounded-md rounded-t-md md:bottom-0 bottom-0 overflow-y-auto;
6
+ @apply fixed md:top-[15%] z-50 right-0 left-0 mx-auto p-3 md:rounded-md rounded-t-md md:bottom-0 bottom-0 overflow-y-auto;
7
7
  }
8
8
  .glorious-modal.size-full {
9
9
  @apply w-full h-full top-0 rounded-none;
@@ -1,5 +1,5 @@
1
1
  .glorious-paginate > div {
2
- @apply border border-gray-50 rounded-xl h-8 flex items-center px-1 bg-white shadow-md gap-1 w-max;
2
+ @apply border border-gray-50 rounded-xl h-8 flex items-center px-1 shadow-md gap-1 w-max;
3
3
  direction: rtl;
4
4
  }
5
5
  .glorious-paginate > div > div {
@@ -104,7 +104,7 @@ const props = defineProps({
104
104
  }
105
105
 
106
106
  .outline.glorious-button-orange, .outline.glorious-button-blue, .outline.glorious-button-gray, .outline.glorious-button-red, .outline.glorious-button-primary {
107
- @apply bg-transparent border outline-none;
107
+ @apply border outline-none;
108
108
  }
109
109
 
110
110
  .glorious-button-orange > div.loading, .glorious-button-blue > div.loading, .glorious-button-gray > div.loading, .glorious-button-red > div.loading, .glorious-button-primary > div.loading {
@@ -27,7 +27,7 @@ const props = defineProps({
27
27
  }
28
28
 
29
29
  .drawer {
30
- @apply fixed top-0 bg-white h-full w-[300px] z-[50];
30
+ @apply fixed top-0 h-full w-[300px] z-[50];
31
31
  }
32
32
  .drawer.close.rtl {
33
33
  animation: drawer-close-right 250ms normal forwards;
@@ -58,6 +58,6 @@ onMounted(() => {
58
58
  @apply absolute top-0 bottom-0 my-auto z-[20];
59
59
  }
60
60
  .glorious-dropdown.open > div:last-child {
61
- @apply bg-white px-2 py-2 rounded-md shadow absolute z-[41] left-[16px] top-5 flex;
61
+ @apply px-2 py-2 rounded-md shadow absolute z-[41] left-[16px] top-5 flex;
62
62
  }
63
63
  </style>
@@ -48,7 +48,7 @@ const props = defineProps({
48
48
  }
49
49
 
50
50
  .glorious-modal {
51
- @apply fixed bg-white md:top-[15%] z-50 right-0 left-0 mx-auto p-3 md:rounded-md rounded-t-md md:bottom-0 bottom-0 overflow-y-auto;
51
+ @apply fixed md:top-[15%] z-50 right-0 left-0 mx-auto p-3 md:rounded-md rounded-t-md md:bottom-0 bottom-0 overflow-y-auto;
52
52
  }
53
53
  .glorious-modal.size-full {
54
54
  @apply w-full h-full top-0 rounded-none;
@@ -111,7 +111,7 @@ watch(
111
111
 
112
112
  <style>
113
113
  .glorious-paginate > div {
114
- @apply border border-gray-50 rounded-xl h-8 flex items-center px-1 bg-white shadow-md gap-1 w-max;
114
+ @apply border border-gray-50 rounded-xl h-8 flex items-center px-1 shadow-md gap-1 w-max;
115
115
  direction: rtl;
116
116
  }
117
117
  .glorious-paginate > div > div {
@@ -6,6 +6,7 @@ interface gloriousFetchOptions {
6
6
  lazy?: Boolean;
7
7
  headers?: Object;
8
8
  body?: Object;
9
+ bodyType: "formData" | "formDataCustom" | "normal";
9
10
  method?: "POST" | "GET" | "PATCH" | "PUT" | "DELETE" | "HEAD";
10
11
  credentials?: "same-origin" | "include";
11
12
  }
@@ -10,6 +10,7 @@ const defaultOptions = {
10
10
  headers: {
11
11
  Accept: "application/json"
12
12
  },
13
+ bodyType: "normal",
13
14
  body: {},
14
15
  credentials: "same-origin"
15
16
  };
@@ -20,26 +21,10 @@ export default function(url, options) {
20
21
  const gKey = computeGKey(options.gKey, url);
21
22
  options.params = computeParams(options.params);
22
23
  options.headers = { ...options.headers, ...computeAuth() };
23
- if (Object.entries(options.body).length === 0)
24
+ if (options.bodyType === "formData")
25
+ options.body = computeFormData(options);
26
+ if (options.bodyType === "normal" && Object.entries(options.body).length === 0)
24
27
  delete options.body;
25
- if (Object.prototype.hasOwnProperty.call(options, "bodyType") && options.bodyType === "formData") {
26
- const form = new FormData();
27
- Object.entries(options.body).forEach((item) => {
28
- if (item[1] === null)
29
- return;
30
- if (Object.prototype.hasOwnProperty.call(options, "fileKey") && options.fileKey.includes(item[0]))
31
- form.append(item[0], item[1]);
32
- else {
33
- if (typeof item[1] === "object")
34
- Object.entries(item[1]).forEach((nestedItem, index) => {
35
- form.append(`${item[0]}[${index}]`, nestedItem[1]);
36
- });
37
- else
38
- form.append(`${item[0]}`, item[1]);
39
- }
40
- });
41
- options.body = form;
42
- }
43
28
  const opt = {
44
29
  ...options,
45
30
  onRequest() {
@@ -105,3 +90,18 @@ function computeAuth() {
105
90
  header.Authorization = "Bearer " + token.value;
106
91
  return header;
107
92
  }
93
+ function computeFormData(options) {
94
+ const form = new FormData();
95
+ Object.entries(options.body).forEach((item) => {
96
+ if (item[1] === null)
97
+ return;
98
+ if (typeof item[1] === "object" && typeof item[1].lastModifiedDate === "undefined")
99
+ Object.entries(item[1]).forEach((nestedItem, index) => {
100
+ form.append(`${item[0]}[${index}]`, nestedItem[1]);
101
+ });
102
+ else {
103
+ form.append(`${item[0]}`, item[1]);
104
+ }
105
+ });
106
+ return form;
107
+ }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.7.9-7",
2
+ "version": "0.8.1-oteacher",
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",