quasar-ui-danx 0.3.9 → 0.3.11

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-danx",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -1,31 +1,31 @@
1
1
  <template>
2
2
  <div>
3
3
  <FieldLabel
4
- v-if="!noLabel"
5
- :field="field"
6
- :show-name="showName"
7
- class="text-sm font-semibold text-gray-700 block mb-2"
4
+ v-if="!noLabel"
5
+ :field="field"
6
+ :show-name="showName"
7
+ class="text-sm font-semibold text-gray-700 block mb-2"
8
8
  />
9
9
  <template v-if="readonly">
10
10
  <div
11
- class="border border-gray-300 rounded-md p-2 bg-gray-100"
12
- v-html="modelValue"
11
+ class="border border-gray-300 rounded-md p-2 bg-gray-100"
12
+ v-html="modelValue"
13
13
  />
14
14
  </template>
15
15
  <TinyMceEditor
16
- v-else
17
- class="mt-2"
18
- :api-key="apiKey"
19
- :disabled="disable"
20
- :model-value="modelValue"
21
- @update:model-value="$emit('update:model-value', $event)"
16
+ v-else
17
+ class="mt-2"
18
+ :api-key="danxOptions.tinyMceApiKey"
19
+ :disabled="disable"
20
+ :model-value="modelValue"
21
+ @update:model-value="$emit('update:model-value', $event)"
22
22
  />
23
23
  </div>
24
24
  </template>
25
25
 
26
26
  <script setup>
27
27
  import { default as TinyMceEditor } from "@tinymce/tinymce-vue";
28
- import { apiKey } from "../../../../vendor/tinymce-config";
28
+ import { danxOptions } from "../../../../config";
29
29
  import FieldLabel from "./FieldLabel";
30
30
 
31
31
  defineEmits(["update:model-value"]);
@@ -1,7 +1,9 @@
1
1
  import { QNotifyCreateOptions } from "quasar";
2
+ import { Ref, shallowRef } from "vue";
2
3
  import { FileUploadOptions } from "../helpers";
3
4
 
4
5
  export interface DanxOptions {
6
+ tinyMceApiKey: string;
5
7
  fileUpload: FileUploadOptions;
6
8
  flashMessages: {
7
9
  default: QNotifyCreateOptions;
@@ -11,7 +13,8 @@ export interface DanxOptions {
11
13
  };
12
14
  }
13
15
 
14
- export let danxOptions: DanxOptions = {
16
+ export const danxOptions: Ref<DanxOptions> = shallowRef({
17
+ tinyMceApiKey: "set-api-key-in-danx-options",
15
18
  fileUpload: {
16
19
  directory: "file-upload",
17
20
  presignedUploadUrl: null,
@@ -23,11 +26,11 @@ export let danxOptions: DanxOptions = {
23
26
  warning: {},
24
27
  error: {}
25
28
  }
26
- };
29
+ });
27
30
 
28
31
  export function configure(options: DanxOptions) {
29
- danxOptions = {
30
- ...danxOptions,
32
+ danxOptions.value = {
33
+ ...danxOptions.value,
31
34
  ...options
32
35
  };
33
36
  }
@@ -38,7 +38,7 @@ export class FileUpload {
38
38
  this.onAllCompleteCb = null;
39
39
 
40
40
  this.options = {
41
- ...danxOptions.fileUpload,
41
+ ...danxOptions.value.fileUpload,
42
42
  ...options
43
43
  };
44
44
 
@@ -37,7 +37,7 @@ export class FlashMessages {
37
37
  classes: "bg-gray-500 text-white",
38
38
  position: "top",
39
39
  closeBtn: "X",
40
- ...danxOptions.flashMessages.default,
40
+ ...danxOptions.value.flashMessages.default,
41
41
  ...options
42
42
  });
43
43
  }
@@ -48,7 +48,7 @@ export class FlashMessages {
48
48
  classes: "bg-green-300 !text-green-900",
49
49
  icon: "check",
50
50
  ...options,
51
- ...danxOptions.flashMessages.success
51
+ ...danxOptions.value.flashMessages.success
52
52
  });
53
53
  }
54
54
 
@@ -57,7 +57,7 @@ export class FlashMessages {
57
57
  classes: "bg-red-300 !text-red-900",
58
58
  icon: "error",
59
59
  ...options,
60
- ...danxOptions.flashMessages.error
60
+ ...danxOptions.value.flashMessages.error
61
61
  });
62
62
  }
63
63
 
@@ -66,12 +66,12 @@ export class FlashMessages {
66
66
  classes: "bg-yellow-300 !text-yellow-900",
67
67
  icon: "warning",
68
68
  ...options,
69
- ...danxOptions.flashMessages.warning
69
+ ...danxOptions.value.flashMessages.warning
70
70
  });
71
71
  }
72
72
 
73
73
  static combine(type: string, messages: string[] | { message: string, Message: string }[], options = {}) {
74
- // @ts-ignore
74
+ // @ts-expect-error - type is a string
75
75
  const messageType = FlashMessages[type];
76
76
 
77
77
  if (typeof messageType !== "function") {
@@ -1 +0,0 @@
1
- export const apiKey = "YOUR_API_KEY";