quasar-ui-danx 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/danx.es.js +7234 -6741
  2. package/dist/danx.es.js.map +1 -1
  3. package/dist/danx.umd.js +11 -5
  4. package/dist/danx.umd.js.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/package.json +3 -1
  7. package/src/components/ActionTable/ActionTable.vue +31 -43
  8. package/src/components/ActionTable/Columns/ActionTableColumn.vue +19 -18
  9. package/src/components/ActionTable/Filters/CollapsableFiltersSidebar.vue +15 -14
  10. package/src/components/ActionTable/Filters/{FilterFieldList.vue → FilterList.vue} +26 -26
  11. package/src/components/ActionTable/Filters/FilterableField.vue +28 -31
  12. package/src/components/ActionTable/Filters/index.ts +2 -2
  13. package/src/components/ActionTable/Form/Fields/EditOnClickTextField.vue +71 -0
  14. package/src/components/ActionTable/Form/Fields/FieldLabel.vue +8 -13
  15. package/src/components/ActionTable/Form/Fields/FileUploadButton.vue +34 -33
  16. package/src/components/ActionTable/Form/Fields/MultiFileField.vue +48 -44
  17. package/src/components/ActionTable/Form/Fields/NumberField.vue +60 -59
  18. package/src/components/ActionTable/Form/Fields/SelectField.vue +124 -138
  19. package/src/components/ActionTable/Form/Fields/SelectWithChildrenField.vue +28 -33
  20. package/src/components/ActionTable/Form/Fields/SingleFileField.vue +15 -15
  21. package/src/components/ActionTable/Form/Fields/SliderNumberField.vue +45 -0
  22. package/src/components/ActionTable/Form/Fields/TextField.vue +47 -66
  23. package/src/components/ActionTable/Form/Fields/index.ts +2 -0
  24. package/src/components/ActionTable/Form/RenderedForm.vue +50 -13
  25. package/src/components/ActionTable/Form/Utilities/MaxLengthCounter.vue +17 -0
  26. package/src/components/ActionTable/Form/Utilities/index.ts +1 -0
  27. package/src/components/ActionTable/Form/index.ts +1 -0
  28. package/src/components/ActionTable/Layouts/ActionTableLayout.vue +22 -16
  29. package/src/components/ActionTable/Toolbars/ActionToolbar.vue +11 -11
  30. package/src/components/ActionTable/listControls.ts +104 -166
  31. package/src/components/ActionTable/listHelpers.ts +2 -3
  32. package/src/components/ActionTable/tableColumns.ts +53 -77
  33. package/src/components/AuditHistory/AuditHistoryItemValue.vue +26 -26
  34. package/src/components/PanelsDrawer/PanelsDrawer.vue +17 -4
  35. package/src/components/PanelsDrawer/PanelsDrawerPanels.vue +6 -11
  36. package/src/components/PanelsDrawer/PanelsDrawerTabs.vue +20 -20
  37. package/src/components/Utility/Dialogs/ConfirmActionDialog.vue +39 -0
  38. package/src/components/Utility/Dialogs/ConfirmDialog.vue +57 -117
  39. package/src/components/Utility/Dialogs/DialogLayout.vue +77 -0
  40. package/src/components/Utility/Dialogs/FullscreenCarouselDialog.vue +42 -36
  41. package/src/components/Utility/Dialogs/InfoDialog.vue +40 -80
  42. package/src/components/Utility/Dialogs/index.ts +1 -0
  43. package/src/components/Utility/Files/FilePreview.vue +76 -73
  44. package/src/components/Utility/Layouts/ContentDrawer.vue +24 -31
  45. package/src/components/Utility/Tools/ActionVnode.vue +3 -3
  46. package/src/components/Utility/Tools/RenderVnode.vue +20 -11
  47. package/src/components/Utility/Transitions/MaxHeightTransition.vue +26 -0
  48. package/src/components/Utility/Transitions/index.ts +1 -0
  49. package/src/config/index.ts +36 -31
  50. package/src/helpers/FileUpload.ts +295 -297
  51. package/src/helpers/FlashMessages.ts +80 -71
  52. package/src/helpers/actions.ts +102 -82
  53. package/src/helpers/download.ts +189 -189
  54. package/src/helpers/downloadPdf.ts +55 -52
  55. package/src/helpers/formats.ts +151 -109
  56. package/src/helpers/index.ts +2 -0
  57. package/src/helpers/multiFileUpload.ts +72 -58
  58. package/src/helpers/objectStore.ts +52 -0
  59. package/src/helpers/request.ts +70 -51
  60. package/src/helpers/routes.ts +29 -0
  61. package/src/helpers/storage.ts +7 -3
  62. package/src/helpers/utils.ts +47 -29
  63. package/src/styles/quasar-reset.scss +94 -68
  64. package/src/styles/themes/danx/dialogs.scss +47 -0
  65. package/src/styles/themes/danx/forms.scss +18 -0
  66. package/src/styles/themes/danx/index.scss +4 -0
  67. package/src/types/actions.d.ts +43 -0
  68. package/src/types/config.d.ts +15 -0
  69. package/src/types/controls.d.ts +99 -0
  70. package/src/types/dialogs.d.ts +32 -0
  71. package/src/types/fields.d.ts +20 -0
  72. package/src/types/files.d.ts +54 -0
  73. package/src/types/formats.d.ts +4 -0
  74. package/src/{components/ActionTable/Form/form.d.ts → types/forms.d.ts} +6 -0
  75. package/src/types/index.d.ts +12 -0
  76. package/src/types/requests.d.ts +13 -0
  77. package/src/types/shared.d.ts +15 -0
  78. package/src/types/tables.d.ts +27 -0
  79. package/types/index.d.ts +1 -1
  80. /package/src/components/ActionTable/Filters/{FilterFieldItem.vue → FilterItem.vue} +0 -0
@@ -1,95 +1,55 @@
1
1
  <template>
2
- <QDialog
3
- :full-height="fullHeight"
4
- :full-width="fullWidth"
5
- :model-value="!!modelValue"
6
- :no-backdrop-dismiss="!backdropDismiss"
7
- :maximized="maximized"
8
- @update:model-value="onClose"
2
+ <DialogLayout
3
+ class="dx-info-dialog"
4
+ v-bind="$props"
5
+ @close="onClose"
9
6
  >
10
- <QCard class="flex flex-col flex-nowrap">
11
- <QCardSection
12
- v-if="title || $slots.title"
13
- class="pl-6 pr-10 border-b border-gray-300"
14
- >
15
- <h3
16
- class="font-normal flex items-center"
17
- :class="titleClass"
7
+ <template
8
+ v-if="$slots.title"
9
+ #title
10
+ >
11
+ <slot name="title" />
12
+ </template>
13
+ <template
14
+ v-if="$slots.subtitle"
15
+ #subtitle
16
+ >
17
+ <slot name="subtitle" />
18
+ </template>
19
+ <template #actions>
20
+ <div class="flex-grow">
21
+ <QBtn
22
+ :label="doneText"
23
+ class="dx-dialog-button dx-dialog-button-done"
24
+ :class="doneClass"
25
+ @click="onClose"
18
26
  >
19
- <slot name="title">
20
- {{ title }}
21
- </slot>
22
- </h3>
23
- <div
24
- v-if="subtitle"
25
- class="mt-1 text-sm"
26
- >
27
- {{ subtitle }}
28
- </div>
29
- </QCardSection>
30
- <QCardSection
31
- v-if="content || $slots.default"
32
- class="px-6 bg-gray-100 flex-grow max-h-full overflow-y-auto"
33
- >
34
- <slot>{{ content }}</slot>
35
- </QCardSection>
36
- <div
37
- class="flex items-center justify-center px-6 py-4 border-t border-gray-300"
38
- >
39
- <div class="flex-grow text-right">
40
- <QBtn
41
- :label="doneText"
42
- class="action-btn btn-white-gray"
43
- @click="onClose"
44
- >
45
- <slot name="done-text" />
46
- </QBtn>
47
- </div>
27
+ <slot name="done-text" />
28
+ </QBtn>
48
29
  </div>
49
- <a
50
- class="absolute top-0 right-0 p-4 text-black"
51
- @click="onClose"
52
- >
53
- <CloseIcon class="w-5" />
54
- </a>
55
- </QCard>
56
- </QDialog>
30
+ <slot name="actions" />
31
+ </template>
32
+ </DialogLayout>
57
33
  </template>
58
34
 
59
35
  <script setup>
60
- import { XIcon as CloseIcon } from "@heroicons/vue/outline";
36
+ import DialogLayout from "./DialogLayout";
61
37
 
62
38
  const emit = defineEmits(["update:model-value", "close"]);
63
39
  defineProps({
64
- modelValue: { type: [Boolean, Object], default: true },
65
- title: {
66
- type: String,
67
- default: ""
68
- },
69
- titleClass: {
70
- type: String,
71
- default: ""
72
- },
73
- subtitle: {
74
- type: String,
75
- default: ""
76
- },
77
- content: {
78
- type: String,
79
- default: ""
80
- },
81
- backdropDismiss: Boolean,
82
- maximized: Boolean,
83
- fullWidth: Boolean,
84
- fullHeight: Boolean,
85
- doneText: {
86
- type: String,
87
- default: "Done"
88
- }
40
+ ...DialogLayout.props,
41
+ doneClass: {
42
+ type: [String, Object],
43
+ default: ""
44
+ },
45
+ doneText: {
46
+ type: String,
47
+ default: "Done"
48
+ }
89
49
  });
90
50
 
91
51
  function onClose() {
92
- emit("update:model-value", false);
93
- emit("close");
52
+ emit("update:model-value", false);
53
+ emit("close");
94
54
  }
95
55
  </script>
@@ -1,3 +1,4 @@
1
+ export { default as ConfirmActionDialog } from "./ConfirmActionDialog.vue";
1
2
  export { default as ConfirmDialog } from "./ConfirmDialog.vue";
2
3
  export { default as FullScreenCarouselDialog } from "./FullscreenCarouselDialog.vue";
3
4
  export { default as FullScreenDialog } from "./FullScreenDialog.vue";
@@ -27,7 +27,7 @@
27
27
  </div>
28
28
  <QImg
29
29
  v-if="thumbUrl || isPreviewable"
30
- fit="scale-down"
30
+ :fit="imageFit"
31
31
  class="non-selectable max-h-full max-w-full h-full"
32
32
  :src="(thumbUrl || previewUrl) + '#t=0.1'"
33
33
  preload="auto"
@@ -54,11 +54,11 @@
54
54
  <slot name="action-button" />
55
55
  </div>
56
56
  <div
57
- v-if="image && image.progress !== undefined"
57
+ v-if="file && file.progress !== undefined"
58
58
  class="absolute-bottom w-full"
59
59
  >
60
60
  <QLinearProgress
61
- :value="image.progress"
61
+ :value="file.progress"
62
62
  size="15px"
63
63
  color="green-600"
64
64
  stripe
@@ -78,7 +78,7 @@
78
78
  <QBtn
79
79
  v-if="downloadable && computedImage?.url"
80
80
  size="sm"
81
- class="!p-1 opacity-70 hover:opacity-100"
81
+ class="dx-file-preview-download py-1 px-2 opacity-70 hover:opacity-100"
82
82
  :class="downloadButtonClass"
83
83
  @click.stop="download(computedImage.url)"
84
84
  >
@@ -88,7 +88,7 @@
88
88
  <QBtn
89
89
  v-if="removable"
90
90
  size="sm"
91
- class="bg-red-900 text-white !p-1 opacity-50 hover:opacity-100"
91
+ class="dx-file-preview-remove bg-red-900 text-white opacity-50 hover:opacity-100 py-1 px-2"
92
92
  @click.stop="onRemove"
93
93
  >
94
94
  <div
@@ -107,106 +107,109 @@
107
107
  <FullScreenCarouselDialog
108
108
  v-if="showPreview && !disabled"
109
109
  :files="relatedFiles || [computedImage]"
110
- :default-slide="computedImage.id"
110
+ :default-slide="computedImage?.id || ''"
111
111
  @close="showPreview = false"
112
112
  />
113
113
  </div>
114
114
  </template>
115
115
 
116
- <script setup>
116
+ <script setup lang="ts">
117
117
  import { DocumentTextIcon as TextFileIcon, DownloadIcon, PlayIcon } from "@heroicons/vue/outline";
118
- import { computed, ref } from "vue";
118
+ import { UploadedFile } from "src/types";
119
+ import { computed, ComputedRef, ref } from "vue";
119
120
  import { download } from "../../../helpers";
120
121
  import { ImageIcon, PdfIcon, TrashIcon as RemoveIcon } from "../../../svg";
121
122
  import { FullScreenCarouselDialog } from "../Dialogs";
122
123
 
124
+ export interface FilePreviewProps {
125
+ src?: string;
126
+ file?: UploadedFile;
127
+ relatedFiles?: UploadedFile[];
128
+ missingIcon?: any;
129
+ downloadButtonClass?: string;
130
+ imageFit?: "cover" | "contain" | "fill" | "none" | "scale-down";
131
+ downloadable?: boolean;
132
+ removable?: boolean;
133
+ disabled?: boolean;
134
+ square?: boolean;
135
+ }
136
+
123
137
  const emit = defineEmits(["remove"]);
124
- const props = defineProps({
125
- src: {
126
- type: String,
127
- default: ""
128
- },
129
- image: {
130
- type: Object,
131
- default: null
132
- },
133
- relatedFiles: {
134
- type: Array,
135
- default: null
136
- },
137
- missingIcon: {
138
- type: [Function, Object],
139
- default: ImageIcon
140
- },
141
- downloadButtonClass: {
142
- type: String,
143
- default: "bg-blue-600 text-white"
144
- },
145
- downloadable: Boolean,
146
- removable: Boolean,
147
- disabled: Boolean,
148
- square: Boolean
138
+
139
+ const props = withDefaults(defineProps<FilePreviewProps>(), {
140
+ src: "",
141
+ file: null,
142
+ relatedFiles: null,
143
+ missingIcon: ImageIcon,
144
+ downloadButtonClass: "bg-blue-600 text-white",
145
+ imageFit: "cover",
146
+ downloadable: false,
147
+ removable: false,
148
+ disabled: false,
149
+ square: false
149
150
  });
150
151
 
151
152
  const showPreview = ref(false);
152
- const computedImage = computed(() => {
153
- if (props.image) {
154
- return props.image;
155
- } else if (props.src) {
156
- return {
157
- id: props.src,
158
- url: props.src,
159
- type: "image/" + props.src.split(".").pop().toLowerCase()
160
- };
161
- }
162
- return null;
153
+ const computedImage: ComputedRef<UploadedFile | null> = computed(() => {
154
+ if (props.file) {
155
+ return props.file;
156
+ } else if (props.src) {
157
+ return {
158
+ id: props.src,
159
+ url: props.src,
160
+ type: "image/" + props.src.split(".").pop()?.toLowerCase(),
161
+ name: "",
162
+ size: 0
163
+ };
164
+ }
165
+ return null;
163
166
  });
164
167
  const mimeType = computed(
165
- () => computedImage.value.type || computedImage.value.mime
168
+ () => computedImage.value?.type || computedImage.value?.mime || ""
166
169
  );
167
- const isImage = computed(() => mimeType.value.match(/^image\//));
168
- const isVideo = computed(() => mimeType.value.match(/^video\//));
169
- const isPdf = computed(() => mimeType.value.match(/^application\/pdf/));
170
+ const isImage = computed(() => !!mimeType.value.match(/^image\//));
171
+ const isVideo = computed(() => !!mimeType.value.match(/^video\//));
172
+ const isPdf = computed(() => !!mimeType.value.match(/^application\/pdf/));
170
173
  const previewUrl = computed(
171
- () => computedImage.value.transcodes?.compress?.url || computedImage.value.blobUrl || computedImage.value.url
174
+ () => computedImage.value?.transcodes?.compress?.url || computedImage.value?.blobUrl || computedImage.value?.url
172
175
  );
173
176
  const thumbUrl = computed(() => {
174
- return computedImage.value.transcodes?.thumb?.url;
177
+ return computedImage.value?.transcodes?.thumb?.url;
175
178
  });
176
179
  const isPreviewable = computed(() => {
177
- return !!thumbUrl.value || isVideo.value || isImage.value;
180
+ return !!thumbUrl.value || isVideo.value || isImage.value;
178
181
  });
179
182
  const isConfirmingRemove = ref(false);
180
183
  function onRemove() {
181
- if (!isConfirmingRemove.value) {
182
- isConfirmingRemove.value = true;
183
- setTimeout(() => {
184
- isConfirmingRemove.value = false;
185
- }, 2000);
186
- } else {
187
- emit("remove");
188
- }
184
+ if (!isConfirmingRemove.value) {
185
+ isConfirmingRemove.value = true;
186
+ setTimeout(() => {
187
+ isConfirmingRemove.value = false;
188
+ }, 2000);
189
+ } else {
190
+ emit("remove");
191
+ }
189
192
  }
190
193
  </script>
191
194
 
192
195
  <style module="cls" lang="scss">
193
196
  .action-button {
194
- position: absolute;
195
- bottom: 1.5em;
196
- right: 1em;
197
- z-index: 1;
197
+ position: absolute;
198
+ bottom: 1.5em;
199
+ right: 1em;
200
+ z-index: 1;
198
201
  }
199
202
 
200
203
  .play-button {
201
- position: absolute;
202
- top: 0;
203
- left: 0;
204
- display: flex;
205
- justify-content: center;
206
- align-items: center;
207
- width: 100%;
208
- height: 100%;
209
- pointer-events: none;
210
- @apply text-blue-200;
204
+ position: absolute;
205
+ top: 0;
206
+ left: 0;
207
+ display: flex;
208
+ justify-content: center;
209
+ align-items: center;
210
+ width: 100%;
211
+ height: 100%;
212
+ pointer-events: none;
213
+ @apply text-blue-200;
211
214
  }
212
215
  </style>
@@ -1,10 +1,11 @@
1
1
  <template>
2
2
  <QDialog
3
- v-model="isShowing"
3
+ :model-value="show"
4
4
  maximized
5
5
  :position="position"
6
6
  :seamless="seamless"
7
7
  :class="{'hide-backdrop': !overlay}"
8
+ @hide="$emit('update:show', false)"
8
9
  >
9
10
  <div>
10
11
  <div
@@ -21,45 +22,37 @@
21
22
  </QDialog>
22
23
  </template>
23
24
 
24
- <script setup>
25
- import { computed } from "vue";
25
+ <script setup lang="ts">
26
+ import { QDialogProps } from "quasar";
26
27
 
27
- const emit = defineEmits(["update:show"]);
28
-
29
- const props = defineProps({
30
- show: Boolean,
31
- seamless: Boolean,
32
- overlay: Boolean,
33
- position: {
34
- type: String,
35
- default: "bottom"
36
- },
37
- contentClass: {
38
- type: String,
39
- default: "py-8 px-12"
40
- },
41
- title: {
42
- type: String,
43
- default: "Edit"
44
- }
45
- });
28
+ export interface ContentDrawerProps {
29
+ show?: boolean,
30
+ overlay?: boolean,
31
+ position?: QDialogProps["position"],
32
+ seamless?: boolean,
33
+ contentClass?: string,
34
+ title?: string
35
+ }
46
36
 
47
- const isShowing = computed({
48
- get: () => props.show,
49
- set: (value) => emit("update:show", value)
37
+ defineEmits(["update:show"]);
38
+ withDefaults(defineProps<ContentDrawerProps>(), {
39
+ show: false,
40
+ position: "bottom",
41
+ contentClass: "py-8 px-12",
42
+ title: "Edit"
50
43
  });
51
44
  </script>
52
45
 
53
46
  <style lang="scss" module="cls">
54
47
  .dialog-title {
55
- @apply font-medium uppercase text-xs px-6 py-3 border-b rounded-t-md bg-slate-100 text-gray-500 border-gray-200;
56
- font-family: "Roboto", sans-serif;
57
- letter-spacing: 0.05em;
58
- box-shadow: 0px -4px 12px rgba(0, 0, 0, 0.25);
48
+ @apply font-medium uppercase text-xs px-6 py-3 border-b rounded-t-md bg-slate-100 text-gray-500 border-gray-200;
49
+ font-family: "Roboto", sans-serif;
50
+ letter-spacing: 0.05em;
51
+ box-shadow: 0px -4px 12px rgba(0, 0, 0, 0.25);
59
52
  }
60
53
 
61
54
  .dialog-content {
62
- @apply bg-white;
63
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
55
+ @apply bg-white;
56
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
64
57
  }
65
58
  </style>
@@ -16,8 +16,8 @@ import RenderVnode from "./RenderVnode";
16
16
 
17
17
  const isSaving = ref(false);
18
18
  async function onConfirm(input) {
19
- isSaving.value = true;
20
- await activeActionVnode.value.confirm(input);
21
- isSaving.value = false;
19
+ isSaving.value = true;
20
+ await activeActionVnode.value.confirm(input);
21
+ isSaving.value = false;
22
22
  }
23
23
  </script>
@@ -2,20 +2,29 @@
2
2
  import { isRef, isVNode } from "vue";
3
3
 
4
4
  const RenderVnode = (props) => {
5
- if (isVNode(props.vnode)) {
6
- return props.vnode;
7
- }
5
+ if (isVNode(props.vnode)) {
6
+ return props.vnode;
7
+ }
8
8
 
9
- if (isRef(props.vnode)) {
10
- return props.vnode.value;
11
- }
9
+ if (isRef(props.vnode)) {
10
+ return props.vnode.value;
11
+ }
12
12
 
13
- if (typeof props.vnode === "function") {
14
- return props.vnode();
15
- }
13
+ if (typeof props.vnode === "function") {
14
+ return props.vnode(props.props);
15
+ }
16
16
 
17
- return null;
17
+ return null;
18
+ };
19
+ RenderVnode.props = {
20
+ vnode: {
21
+ type: [Function, Object],
22
+ required: true
23
+ },
24
+ props: {
25
+ type: Object,
26
+ default: () => ({})
27
+ }
18
28
  };
19
- RenderVnode.props = { vnode: { type: [Function, Object], required: true } };
20
29
  export default RenderVnode;
21
30
  </script>
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <Transition name="maxHeight">
3
+ <slot />
4
+ </Transition>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ defineProps<{
9
+ maxHeight: string,
10
+ }>();
11
+ </script>
12
+ <style lang="scss">
13
+ .maxHeight-enter-active,
14
+ .maxHeight-leave-active {
15
+ transition: all .3s linear;
16
+ max-height: v-bind(maxHeight);
17
+ }
18
+
19
+ .maxHeight-enter-to, .maxHeight-leave-from {
20
+ max-height: v-bind(maxHeight);
21
+ }
22
+
23
+ .maxHeight-enter-from, .maxHeight-leave-to {
24
+ max-height: 0;
25
+ }
26
+ </style>
@@ -1,3 +1,4 @@
1
1
  export { default as ListTransition } from "./ListTransition.vue";
2
+ export { default as MaxHeightTransition } from "./MaxHeightTransition.vue";
2
3
  export { default as SlideTransition } from "./SlideTransition.vue";
3
4
  export { default as StaggeredListTransition } from "./StaggeredListTransition.vue";
@@ -1,36 +1,41 @@
1
- import { QNotifyCreateOptions } from "quasar";
2
- import { Ref, shallowRef } from "vue";
3
- import { FileUploadOptions } from "../helpers";
1
+ import { shallowRef } from "vue";
2
+ import { DanxOptions } from "../types";
4
3
 
5
- export interface DanxOptions {
6
- tinyMceApiKey: string;
7
- fileUpload: FileUploadOptions;
8
- flashMessages: {
9
- default: QNotifyCreateOptions;
10
- success: QNotifyCreateOptions;
11
- warning: QNotifyCreateOptions;
12
- error: QNotifyCreateOptions;
13
- };
14
- }
15
-
16
- export const danxOptions: Ref<DanxOptions> = shallowRef({
17
- tinyMceApiKey: "set-api-key-in-danx-options",
18
- fileUpload: {
19
- directory: "file-upload",
20
- presignedUploadUrl: null,
21
- uploadCompletedUrl: null
22
- },
23
- flashMessages: {
24
- default: {},
25
- success: {},
26
- warning: {},
27
- error: {}
28
- }
4
+ export const danxOptions = shallowRef<DanxOptions>({
5
+ tinyMceApiKey: "set-api-key-in-danx-options",
6
+ request: {
7
+ baseUrl: "",
8
+ headers: {},
9
+ onUnauthorized: undefined
10
+ },
11
+ fileUpload: {
12
+ directory: "file-upload",
13
+ createPresignedUpload: null,
14
+ completePresignedUpload: null
15
+ },
16
+ flashMessages: {
17
+ default: {},
18
+ success: {},
19
+ warning: {},
20
+ error: {}
21
+ }
29
22
  });
30
23
 
31
24
  export function configure(options: DanxOptions) {
32
- danxOptions.value = {
33
- ...danxOptions.value,
34
- ...options
35
- };
25
+ danxOptions.value = {
26
+ ...danxOptions.value,
27
+ ...options,
28
+ fileUpload: {
29
+ ...danxOptions.value.fileUpload,
30
+ ...options.fileUpload
31
+ },
32
+ flashMessages: {
33
+ ...danxOptions.value.flashMessages,
34
+ ...options.flashMessages
35
+ },
36
+ request: {
37
+ ...danxOptions.value.request,
38
+ ...options.request
39
+ }
40
+ };
36
41
  }