@niyamulahsan/create-deskapp 1.2.5 → 1.2.6

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 (104) hide show
  1. package/package.json +1 -1
  2. package/template/.env.example +20 -13
  3. package/template/AGENTS.md +699 -0
  4. package/template/package.json +3 -0
  5. package/template/src/config/app.ts +26 -24
  6. package/template/src/config/winsetup.ts +93 -91
  7. package/template/src/core/api/binding-error.ts +57 -0
  8. package/template/src/core/api/bindings.generated.ts +2 -0
  9. package/template/src/core/api/generate.manifest.ts +84 -80
  10. package/template/src/core/api/registry.ts +58 -48
  11. package/template/src/core/config.ts +101 -99
  12. package/template/src/core/database/aggregate.ts +89 -85
  13. package/template/src/core/database/config.ts +50 -48
  14. package/template/src/core/database/connection.ts +116 -114
  15. package/template/src/core/database/migrate-hooks.ts +86 -84
  16. package/template/src/core/database/paginate.ts +226 -224
  17. package/template/src/core/database/reset.ts +21 -19
  18. package/template/src/core/database/seed.ts +169 -167
  19. package/template/src/core/database/status.ts +37 -35
  20. package/template/src/core/env.ts +108 -106
  21. package/template/src/core/facade.ts +63 -61
  22. package/template/src/core/maker/db/fresh.ts +10 -8
  23. package/template/src/core/maker/db/generate.ts +13 -11
  24. package/template/src/core/maker/db/helpers.ts +92 -96
  25. package/template/src/core/maker/db/migrate.ts +37 -35
  26. package/template/src/core/maker/db/mod.ts +93 -91
  27. package/template/src/core/maker/db/module-migrate.ts +56 -54
  28. package/template/src/core/maker/db/push.ts +23 -21
  29. package/template/src/core/maker/db/reset.ts +8 -6
  30. package/template/src/core/maker/db/seed.ts +9 -7
  31. package/template/src/core/maker/db/status.ts +8 -6
  32. package/template/src/core/maker/help.ts +59 -57
  33. package/template/src/core/maker/make/controller.ts +25 -22
  34. package/template/src/core/maker/make/helpers.ts +97 -91
  35. package/template/src/core/maker/make/mod.ts +69 -67
  36. package/template/src/core/maker/make/model.ts +16 -14
  37. package/template/src/core/maker/make/module.ts +53 -39
  38. package/template/src/core/maker/make/seeder.ts +23 -21
  39. package/template/src/core/maker/make/test.ts +33 -30
  40. package/template/src/core/maker/mod.ts +85 -83
  41. package/template/src/core/maker/run/mod.ts +134 -132
  42. package/template/src/core/maker/stub.ts +26 -24
  43. package/template/src/core/maker/stubs/controller/controller.controller.stub +57 -55
  44. package/template/src/core/maker/stubs/controller/controller.schema.stub +18 -13
  45. package/template/src/core/maker/stubs/facade/facade.stub +21 -0
  46. package/template/src/core/maker/stubs/model/model.stub +10 -8
  47. package/template/src/core/maker/stubs/seeder/seeder.stub +18 -16
  48. package/template/src/core/maker/stubs/test/test.stub +9 -7
  49. package/template/src/core/maker/sync-config.ts +93 -94
  50. package/template/src/core/utils/password.ts +29 -27
  51. package/template/src/core/utils/playwright.ts +123 -121
  52. package/template/src/core/utils/queue.ts +68 -66
  53. package/template/src/core/utils/scheduler.ts +62 -60
  54. package/template/src/core/utils/storage.ts +3 -1
  55. package/template/src/core/utils/validation.ts +37 -35
  56. package/template/src/database/schema.ts +2 -0
  57. package/template/src/main.ts +120 -118
  58. package/template/src/modules/app/__tests__/demo.controller.test.ts +75 -0
  59. package/template/src/modules/app/__tests__/net.controller.test.ts +65 -0
  60. package/template/src/modules/app/__tests__/playwright.controller.test.ts +50 -0
  61. package/template/src/modules/app/__tests__/storage.controller.test.ts +114 -0
  62. package/template/src/modules/app/__tests__/window.controller.test.ts +98 -0
  63. package/template/src/modules/app/controllers/demo.controller.ts +120 -118
  64. package/template/src/modules/app/controllers/net.controller.ts +50 -48
  65. package/template/src/modules/app/controllers/playwright.controller.ts +142 -140
  66. package/template/src/modules/app/controllers/storage.controller.ts +231 -229
  67. package/template/src/modules/app/controllers/window.controller.ts +2 -0
  68. package/template/src/modules/app/facade.ts +21 -0
  69. package/template/src/preload.ts +25 -2
  70. package/template/src/ui/src/App.vue +4 -2
  71. package/template/src/ui/src/app.ts +38 -23
  72. package/template/src/ui/src/bindings.d.ts +18 -16
  73. package/template/src/ui/src/components/Button.vue +34 -32
  74. package/template/src/ui/src/components/Checkbox.vue +26 -29
  75. package/template/src/ui/src/components/Input.vue +221 -227
  76. package/template/src/ui/src/components/InputGroup.vue +141 -0
  77. package/template/src/ui/src/components/InputPasswordToggle.vue +204 -0
  78. package/template/src/ui/src/components/Modal.vue +65 -55
  79. package/template/src/ui/src/components/Spinner.vue +44 -42
  80. package/template/src/ui/src/components/Switch.vue +62 -65
  81. package/template/src/ui/src/components/TextArea.vue +108 -121
  82. package/template/src/ui/src/components/Toast.vue +55 -56
  83. package/template/src/ui/src/components/datatable/DataTableSkeleton.vue +100 -98
  84. package/template/src/ui/src/components/datatable/Pagination.vue +153 -125
  85. package/template/src/ui/src/components/datatable/SelectOpption.vue +36 -35
  86. package/template/src/ui/src/components/datatable/index.vue +336 -258
  87. package/template/src/ui/src/env.d.ts +16 -13
  88. package/template/src/ui/src/global.d.ts +21 -2
  89. package/template/src/ui/src/helpers/nformatter.ts +12 -10
  90. package/template/src/ui/src/pages/dashboard/index.vue +690 -687
  91. package/template/src/ui/src/plugins/browserDetect.ts +57 -0
  92. package/template/src/ui/src/plugins/gum.ts +576 -549
  93. package/template/src/ui/src/plugins/pulse.ts +2 -0
  94. package/template/src/ui/src/plugins/routeProgress.ts +89 -0
  95. package/template/src/ui/src/router/index.ts +44 -25
  96. package/template/src/ui/src/stores/example.ts +2 -0
  97. package/template/src/ui/vite.config.ts +40 -38
  98. package/template/src/window/app-menu.ts +89 -87
  99. package/template/src/window/config.ts +14 -12
  100. package/template/src/window/context-menu.ts +23 -21
  101. package/template/src/window/dialogs.ts +92 -90
  102. package/template/src/window/manager.ts +2 -0
  103. package/template/src/window/native.ts +47 -45
  104. package/template/src/window/tray.ts +132 -130
@@ -0,0 +1,141 @@
1
+ <!-- ./src/ui/src/components/InputGroup.vue -->
2
+
3
+ <template>
4
+ <div :class="topclass">
5
+ <div class="position-relative">
6
+ <label :for="inputId" class="text-capitalize d-flex align-items-center mb-1" :class="{ 'd-none': !inputLabel }">
7
+ <div class="position-relative">
8
+ <span class="text-capitalize" v-html="inputLabel"></span>
9
+ <span class="position-absolute text-danger rounded-circle bg-danger must" :class="{ 'd-none': !props.must }"></span>
10
+ </div>
11
+ <div :class="hoodClass" style="font-size: 12px; margin-top: 0.15rem" v-html="hoodHtml"></div>
12
+ </label>
13
+ <div class="input-group">
14
+ <div class="position-relative" :style="props.half ? 'width: 50%;' : 'width: 35%;'">
15
+ <input
16
+ ref="inputRef"
17
+ :id="inputId"
18
+ type="text"
19
+ class="form-control flex-grow-0 px-1 text-center rounded-0 rounded-start"
20
+ :maxlength="maxLengthAttr"
21
+ :value="props.modelValue"
22
+ v-bind="$attrs"
23
+ @input="updateModel"
24
+ >
25
+ <div class="position-absolute bottom-0 end-0 pe-1 text-secondary max" :class="{ 'd-none': !max }">
26
+ {{ maxCounter }}
27
+ </div>
28
+ </div>
29
+ <input
30
+ type="text"
31
+ class="form-control text-center border-start second-input"
32
+ :style="props.half ? 'width: 50%;' : 'width: 62%;'"
33
+ :placeholder="placeholder1"
34
+ :value="props.calcdata"
35
+ readonly
36
+ >
37
+ </div>
38
+ </div>
39
+ <div :id="`${inputId}Help`" class="form-text text-danger" :class="{ 'd-none': !props.err }">
40
+ {{ props.err }}
41
+ </div>
42
+ </div>
43
+ </template>
44
+
45
+ <script setup lang="ts">
46
+ import { computed, nextTick, onMounted, ref, useAttrs } from "vue";
47
+
48
+ defineOptions({ name: "InputGroup", inheritAttrs: false });
49
+
50
+ type InputGroupCategory = "number" | "decimal" | "mobile" | string;
51
+
52
+ interface InputGroupProps {
53
+ focus?: boolean;
54
+ must?: boolean;
55
+ half?: boolean;
56
+ err?: string | boolean;
57
+ modelValue?: string | number;
58
+ category?: InputGroupCategory;
59
+ calcdata?: string | number;
60
+ hood?: string | number | boolean;
61
+ }
62
+
63
+ const $attrs = useAttrs();
64
+ const inputRef = ref<HTMLInputElement | null>(null);
65
+ const props = withDefaults(defineProps<InputGroupProps>(), {
66
+ err: false,
67
+ modelValue: "",
68
+ calcdata: ""
69
+ });
70
+
71
+ const topclass = computed(() => ($attrs.topclass as string | undefined) || "mb-3");
72
+ const inputId = computed(() => ($attrs.id as string | undefined) || "");
73
+ const inputLabel = computed(() => ($attrs.label as string | undefined) || "");
74
+ const placeholder1 = computed(() => ($attrs.placeholder1 as string | undefined) || "");
75
+
76
+ const max = computed<number | null>(() => {
77
+ const raw = $attrs.maxlength as string | number | undefined;
78
+ return raw != null ? Number(raw) : null;
79
+ });
80
+
81
+ const maxLengthAttr = computed<number | undefined>(() => max.value ?? undefined);
82
+ const maxCounter = computed(() => (max.value == null ? "" : max.value - String(props.modelValue).length));
83
+
84
+ const hoodHtml = computed(() => (props.hood === false || props.hood == null ? "" : String(props.hood)));
85
+ const hoodClass = computed(() => [
86
+ "text-uppercase w-50 text-end text-primary fw-semibold",
87
+ props.half ? "w-50" : "w-100",
88
+ !props.hood && "d-none"
89
+ ]);
90
+
91
+ const emit = defineEmits<(event: "update:modelValue", value: string | number) => void>();
92
+
93
+ const updateModel = (e: Event) => {
94
+ const target = e.target as HTMLInputElement;
95
+
96
+ if (props.category === "number") {
97
+ emit("update:modelValue", (target.value = target.value.replace(/[^\d]/gi, "")));
98
+ } else if (props.category === "decimal") {
99
+ let val = target.value;
100
+ val = val.replace(/[^0-9.]/g, "");
101
+
102
+ const parts = val.split(".");
103
+ if (parts.length > 2) {
104
+ val = `${parts[0]}.${parts.slice(1).join("")}`;
105
+ }
106
+
107
+ emit("update:modelValue", (target.value = val));
108
+ } else if (props.category === "mobile") {
109
+ const digits = target.value.replace(/[^\d]/g, "");
110
+ let val = digits;
111
+ if (target.value.includes("+")) {
112
+ val = `+${digits}`;
113
+ }
114
+ emit("update:modelValue", (target.value = val));
115
+ } else {
116
+ emit("update:modelValue", target.value);
117
+ }
118
+ };
119
+
120
+ onMounted(async () => {
121
+ const shouldFocus = props.focus !== false && props.focus !== undefined;
122
+ if (!shouldFocus) return;
123
+
124
+ await nextTick();
125
+ // preventScroll: focusing inside a modal must not scroll the modal/page
126
+ inputRef.value?.focus({ preventScroll: true });
127
+ });
128
+ </script>
129
+
130
+ <style lang="scss" scoped>
131
+ .must {
132
+ width: 4px;
133
+ height: 4px;
134
+ margin-left: 2px;
135
+ margin-top: 5px;
136
+ }
137
+
138
+ .max {
139
+ font-size: 0.6rem;
140
+ }
141
+ </style>
@@ -0,0 +1,204 @@
1
+ <!-- ./src/ui/src/components/InputPasswordToggle.vue -->
2
+
3
+ <template>
4
+ <div :class="topclass">
5
+ <div class="position-relative">
6
+ <label :for="inputId" class="d-flex align-items-center" :class="{ 'd-none': !inputLabel }">
7
+ <div class="position-relative">
8
+ <span class="text-capitalize mb-1" v-html="inputLabel"></span>
9
+ <span class="position-absolute text-danger rounded-circle bg-danger must" :class="{ 'd-none': !props.must }"></span>
10
+ </div>
11
+ <div
12
+ class="text-end ms-auto text-primary align-self-center"
13
+ :class="{ 'd-none': !props.hood }"
14
+ style="font-size: 12px; margin-top: 0.15rem"
15
+ v-html="hoodHtml"
16
+ ></div>
17
+ </label>
18
+
19
+ <div class="input-group border-0 mb-3">
20
+ <input
21
+ ref="inputRef"
22
+ class="form-control shadow-none"
23
+ :type="showPassword ? 'text' : 'password'"
24
+ :value="props.modelValue"
25
+ :maxlength="maxLengthAttr"
26
+ :readonly="props.readonly"
27
+ v-bind="$attrs"
28
+ @input="updateModel"
29
+ >
30
+ <button class="input-group-text p-0 position-relative z-1" type="button" @click="togglePassword">
31
+ <i class="py-2 px-3" :class="showPassword ? 'bi bi-eye' : 'bi bi-eye-slash'" style="font-size: 15px"></i>
32
+ </button>
33
+ </div>
34
+ <!-- <input class="form-control" v-model="model" :maxlength="max" v-bind="$attrs"> vue3.3 (2nd way)/3.4 -->
35
+ <div class="position-absolute bottom-0 end-0 pe-1 text-secondary max" :class="{ 'd-none': !max }">
36
+ {{ maxCounter }}
37
+ </div>
38
+ </div>
39
+ <div :id="`${inputId}Help`" class="form-text mt-1 text-danger" :class="{ 'd-none': !props.err }">
40
+ {{ props.err }}
41
+ </div>
42
+ </div>
43
+ </template>
44
+
45
+ <script setup lang="ts">
46
+ import { computed, nextTick, onMounted, ref, useAttrs } from "vue";
47
+ import { browserDetect } from "@/ui/plugins/browserDetect";
48
+
49
+ defineOptions({ name: "InputPasswordToggle", inheritAttrs: false });
50
+ const { isFirefox } = browserDetect;
51
+
52
+ const $attrs = useAttrs();
53
+ const inputRef = ref<HTMLInputElement | null>(null);
54
+ type InputPasswordCategory = "number" | "decimal" | "mobile" | "tax-period" | "bin" | "challan-number" | string;
55
+
56
+ interface InputPasswordProps {
57
+ focus?: boolean;
58
+ must?: boolean;
59
+ err?: string | boolean;
60
+ modelValue?: string | number;
61
+ category?: InputPasswordCategory;
62
+ hood?: string | boolean | number;
63
+ readonly?: boolean;
64
+ }
65
+
66
+ const props = withDefaults(defineProps<InputPasswordProps>(), {
67
+ err: false,
68
+ modelValue: ""
69
+ });
70
+
71
+ const topclass = computed(() => ($attrs.topclass as string | undefined) || "mb-3");
72
+ const inputId = computed(() => ($attrs.id as string | undefined) || "");
73
+ const inputLabel = computed(() => ($attrs.label as string | undefined) || "");
74
+ const inputType = computed(() => ($attrs.type as string | undefined) || "text");
75
+
76
+ const max = computed<number | null>(() => {
77
+ const raw = $attrs.maxlength as string | number | undefined;
78
+ return raw != null ? Number(raw) : null;
79
+ });
80
+ const maxLengthAttr = computed<number | undefined>(() => max.value ?? undefined);
81
+
82
+ const hoodHtml = computed(() => (props.hood === false || props.hood == null ? "" : String(props.hood)));
83
+
84
+ const maxCounter = computed(() => {
85
+ if (max.value == null) {
86
+ return "";
87
+ }
88
+
89
+ if (!isFirefox && inputType.value === "month") {
90
+ return "";
91
+ }
92
+
93
+ return max.value - String(props.modelValue).length;
94
+ });
95
+
96
+ const emit = defineEmits<(event: "update:modelValue", value: string | number) => void>();
97
+ const updateModel = (e: Event) => {
98
+ const target = e.target as HTMLInputElement;
99
+
100
+ if (props.category === "number") {
101
+ emit("update:modelValue", (target.value = target.value.replace(/[^\d]/gi, "")));
102
+ } else if (props.category === "decimal") {
103
+ let val = target.value.replace(/[^\d.]/g, "");
104
+ const parts = val.split(".");
105
+ val = parts[0];
106
+ if (parts.length > 1) {
107
+ val += `.${parts.slice(1).join("")}`;
108
+ }
109
+ emit("update:modelValue", (target.value = val));
110
+ } else if (props.category === "mobile") {
111
+ let digits = target.value.replace(/[^\d]/g, ""); // only digits
112
+ let val = digits;
113
+ if (target.value.includes("+")) {
114
+ val = `+${digits}`;
115
+ }
116
+ emit("update:modelValue", (target.value = val));
117
+ } else if (props.category === "tax-period") {
118
+ let val = target.value.replace(/[^\d-]/g, ""); // Only numbers and hyphen
119
+ val = val.replace(/-/g, ""); // Remove all hyphens
120
+ val = val.slice(0, 6); // Only 6 digits (YYYYMM)
121
+
122
+ if (val.length > 4) {
123
+ let year = val.slice(0, 4);
124
+ let month = val.slice(4, 6);
125
+
126
+ // Only correct if both month digits entered
127
+ if (month.length === 2) {
128
+ let m = parseInt(month, 10);
129
+ // Clamp month between 1 and 12
130
+ if (m < 1) m = 1;
131
+ if (m > 12) m = 12;
132
+ // Always pad to 2 digits
133
+ month = m.toString().padStart(2, "0");
134
+ }
135
+
136
+ val = `${year}-${month}`;
137
+ }
138
+
139
+ emit("update:modelValue", (target.value = val));
140
+ } else if (props.category === "bin") {
141
+ let digits = target.value.replace(/[^\d]/g, "");
142
+ digits = digits.slice(0, 14);
143
+ let formatted = digits;
144
+ if (digits.length > 9) {
145
+ formatted = `${digits.slice(0, 9)}-${digits.slice(9, 14)}`;
146
+ }
147
+ emit("update:modelValue", (target.value = formatted));
148
+ } else if (props.category === "challan-number") {
149
+ let digits = target.value.replace(/[^\d]/g, "");
150
+ digits = digits.slice(0, 16);
151
+ let formatted = digits;
152
+ if (digits.length > 4) {
153
+ formatted = `${digits.slice(0, 4)}-${digits.slice(4, 16)}`;
154
+ }
155
+ emit("update:modelValue", (target.value = formatted));
156
+ } else {
157
+ emit("update:modelValue", target.value);
158
+ }
159
+ };
160
+
161
+ const showPassword = ref(false);
162
+ const togglePassword = () => (showPassword.value = !showPassword.value);
163
+
164
+ onMounted(async () => {
165
+ const shouldFocus = props.focus !== false && props.focus !== undefined;
166
+ if (!shouldFocus) return;
167
+
168
+ await nextTick();
169
+ // preventScroll: focusing inside a modal must not scroll the modal/page
170
+ inputRef.value?.focus({ preventScroll: true });
171
+ });
172
+ </script>
173
+
174
+ <style lang="scss" scoped>
175
+ input {
176
+ &:read-only {
177
+ background-color: #f8f8f8;
178
+ }
179
+
180
+ &::placeholder {
181
+ color: #bfbfbf;
182
+ }
183
+ }
184
+
185
+ button:focus-visible {
186
+ border: none;
187
+ box-shadow: none;
188
+ }
189
+
190
+ .form-text {
191
+ font-size: 0.75rem;
192
+ }
193
+
194
+ .must {
195
+ width: 4px;
196
+ height: 4px;
197
+ margin-left: 2px;
198
+ margin-top: 5px;
199
+ }
200
+
201
+ .max {
202
+ font-size: 0.6rem;
203
+ }
204
+ </style>
@@ -1,55 +1,65 @@
1
- <template>
2
- <Teleport to="#modal-show">
3
- <div :id="props.id" ref="modal" class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1"
4
- :aria-labelledby="`${props.id}Label`">
5
- <div :class="`modal-dialog modal-dialog-centered modal-dialog-scrollable modal-${props.size}`">
6
- <div class="modal-content border">
7
- <div class="modal-header">
8
- <div class="d-flex w-100 justify-content-between align-items-center">
9
- <h5 id="modalScrollableTitle" class="modal-title me-3">{{ props.title }}</h5>
10
- <button ref="closeButton" type="button" class="btn-close shadow-none" data-bs-dismiss="modal"
11
- aria-label="Close"></button>
12
- <slot name="modal-header-extra"></slot>
13
- </div>
14
- </div>
15
- <div class="modal-body">
16
- <slot name="modalbody"></slot>
17
- </div>
18
- <div class="modal-footer py-2">
19
- <slot name="modalfooter"></slot>
20
- </div>
21
- </div>
22
- </div>
23
- </div>
24
- </Teleport>
25
- </template>
26
-
27
- <script setup lang="ts">
28
- import { ref } from "vue";
29
-
30
- type ModalSize = "sm" | "md" | "lg" | "xl" | string;
31
-
32
- interface ModalProps {
33
- id: string;
34
- title?: string;
35
- size?: ModalSize;
36
- }
37
-
38
- defineOptions({ name: "Modal", inheritAttrs: false });
39
-
40
- const props = withDefaults(defineProps<ModalProps>(), {
41
- title: "",
42
- size: "md"
43
- });
44
-
45
- const modal = ref<HTMLElement | null>(null);
46
- const closeButton = ref<HTMLButtonElement | null>(null);
47
-
48
- const close = () => {
49
- closeButton.value?.click();
50
- };
51
-
52
- defineExpose({ close });
53
- </script>
54
-
55
- <style lang="scss" scoped></style>
1
+ <!-- ./src/ui/src/components/Modal.vue -->
2
+
3
+ <template>
4
+ <Teleport to="#modal-show">
5
+ <div
6
+ :id="props.id"
7
+ ref="modal"
8
+ class="modal fade"
9
+ data-bs-backdrop="static"
10
+ data-bs-keyboard="false"
11
+ tabindex="-1"
12
+ :aria-labelledby="`${props.id}Label`"
13
+ >
14
+ <div :class="`modal-dialog modal-dialog-centered modal-dialog-scrollable modal-${props.size}`">
15
+ <div class="modal-content border">
16
+ <div class="modal-header">
17
+ <div class="d-flex w-100 justify-content-between align-items-center">
18
+ <h5 id="modalScrollableTitle" class="modal-title me-3">{{ props.title }}</h5>
19
+ <button ref="closeButton" type="button" class="btn-close shadow-none" data-bs-dismiss="modal" aria-label="Close"></button>
20
+ <slot name="modal-header-extra"></slot>
21
+ </div>
22
+ </div>
23
+ <div class="modal-body">
24
+ <slot name="modalbody"></slot>
25
+ </div>
26
+ <div class="modal-footer py-2">
27
+ <slot name="modalfooter"></slot>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </Teleport>
33
+ </template>
34
+
35
+ <script setup lang="ts">
36
+ import { Modal } from "bootstrap";
37
+ import { onMounted, ref } from "vue";
38
+
39
+ interface ModalProps {
40
+ id: string;
41
+ title?: string;
42
+ size?: string;
43
+ }
44
+
45
+ const props = withDefaults(defineProps<ModalProps>(), {
46
+ title: "",
47
+ size: "md"
48
+ });
49
+
50
+ const modal = ref<HTMLElement | null>(null);
51
+ let bsModal: Modal | null = null;
52
+
53
+ onMounted(() => {
54
+ if (modal.value) {
55
+ bsModal = new Modal(modal.value);
56
+ }
57
+ });
58
+
59
+ const open = () => bsModal?.show();
60
+ const close = () => bsModal?.hide();
61
+
62
+ defineExpose({ open, close });
63
+ </script>
64
+
65
+ <style lang="scss" scoped></style>
@@ -1,42 +1,44 @@
1
- <template>
2
- <div class="h-100" v-bind="$attrs">
3
- <div class="h-100 d-flex align-items-center justify-content-center">
4
- <div class="spinner-grow" :style="spinnerStyle" role="status">
5
- <span class="visually-hidden">Loading...</span>
6
- </div>
7
- <div class="fw-bold ms-2">
8
- <span v-if="props.text" :class="props.textsize" :style="textStyle">
9
- {{ props.text }}
10
- </span>
11
- <span v-else>Loading...</span>
12
- </div>
13
- </div>
14
- </div>
15
- </template>
16
-
17
- <script setup lang="ts">
18
- import { computed } from "vue";
19
-
20
- defineOptions({ name: "Spinner", inheritAttrs: false });
21
-
22
- interface SpinnerProps {
23
- size?: string;
24
- text?: string;
25
- textsize?: string;
26
- }
27
-
28
- const props = withDefaults(defineProps<SpinnerProps>(), {
29
- size: "3rem",
30
- text: "",
31
- textsize: ""
32
- });
33
-
34
- const spinnerStyle = computed(() => ({
35
- width: props.size,
36
- height: props.size
37
- }));
38
-
39
- const textStyle = computed(() => ({
40
- fontSize: props.textsize || undefined
41
- }));
42
- </script>
1
+ <!-- ./src/ui/src/components/Spinner.vue -->
2
+
3
+ <template>
4
+ <div class="h-100" v-bind="$attrs">
5
+ <div class="h-100 d-flex align-items-center justify-content-center">
6
+ <div class="spinner-grow" :style="spinnerStyle" role="status">
7
+ <span class="visually-hidden">Loading...</span>
8
+ </div>
9
+ <div class="fw-bold ms-2">
10
+ <span v-if="props.text" :class="props.textsize" :style="textStyle">
11
+ {{ props.text }}
12
+ </span>
13
+ <span v-else>Loading...</span>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import { computed } from "vue";
21
+
22
+ defineOptions({ name: "Spinner", inheritAttrs: false });
23
+
24
+ interface SpinnerProps {
25
+ size?: string;
26
+ text?: string;
27
+ textsize?: string;
28
+ }
29
+
30
+ const props = withDefaults(defineProps<SpinnerProps>(), {
31
+ size: "3rem",
32
+ text: "",
33
+ textsize: ""
34
+ });
35
+
36
+ const spinnerStyle = computed(() => ({
37
+ width: props.size,
38
+ height: props.size
39
+ }));
40
+
41
+ const textStyle = computed(() => ({
42
+ fontSize: props.textsize || undefined
43
+ }));
44
+ </script>