fluency-v8-components 1.3.5 → 1.3.7

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 (178) hide show
  1. package/dist/fluency-v8-components.es.js +1 -1
  2. package/dist/fluency-v8-components.umd.js +99 -99
  3. package/dist/{index-q2NbjdVo.mjs → index-ChEFiXF5.mjs} +12 -11
  4. package/dist/{index.es-PAPL4E6Y.mjs → index.es-CjjN70eV.mjs} +1 -1
  5. package/package.json +3 -2
  6. package/src/assets/images/ai.svg +1 -0
  7. package/src/assets/images/github-dark.svg +1 -0
  8. package/src/assets/images/github.svg +1 -0
  9. package/src/assets/images/high-priority.svg +1 -0
  10. package/src/assets/images/power-off.svg +1 -0
  11. package/src/assets/images/save.svg +1 -0
  12. package/src/assets/index.ts +15 -0
  13. package/src/assets/main.css +495 -0
  14. package/src/assets/prism-theme.css +290 -0
  15. package/src/components/buttons/ActionButtons.vue +374 -0
  16. package/src/components/buttons/DropdownButton.vue +104 -0
  17. package/src/components/buttons/IconButton.vue +63 -0
  18. package/src/components/buttons/ImageButton.vue +16 -0
  19. package/src/components/buttons/MenuButton.vue +138 -0
  20. package/src/components/buttons/SubmitButtons.vue +51 -0
  21. package/src/components/buttons/TextButton.vue +40 -0
  22. package/src/components/charts/AlertChart.vue +376 -0
  23. package/src/components/charts/BarChart.vue +212 -0
  24. package/src/components/charts/BarChartHorizontal.vue +243 -0
  25. package/src/components/charts/CronChart.vue +146 -0
  26. package/src/components/charts/EmptyChart.vue +76 -0
  27. package/src/components/charts/GradientChart.vue +310 -0
  28. package/src/components/charts/LineChart.test.js +59 -0
  29. package/src/components/charts/LineChart.vue +434 -0
  30. package/src/components/charts/PieChart.vue +293 -0
  31. package/src/components/charts/ProgressChart.vue +106 -0
  32. package/src/components/charts/StackedChart.vue +364 -0
  33. package/src/components/charts/StackedChartClustered.vue +395 -0
  34. package/src/components/charts/TimelineChart.vue +215 -0
  35. package/src/components/charts/WorkflowChart.vue +520 -0
  36. package/src/components/common/AutoCompleteSearchBar.vue +100 -0
  37. package/src/components/common/AutoRefreshButton.vue +53 -0
  38. package/src/components/common/Breadcrumb.vue +45 -0
  39. package/src/components/common/ButtonToggle.vue +24 -0
  40. package/src/components/common/Card.vue +116 -0
  41. package/src/components/common/Carousel.vue +66 -0
  42. package/src/components/common/CategoryCard.vue +28 -0
  43. package/src/components/common/CodeEditor.vue +59 -0
  44. package/src/components/common/DatePicker.vue +21 -0
  45. package/src/components/common/DatePickerInput.vue +109 -0
  46. package/src/components/common/Dialog.vue +103 -0
  47. package/src/components/common/EditorHeading.vue +10 -0
  48. package/src/components/common/EventList.vue +41 -0
  49. package/src/components/common/Facet.vue +206 -0
  50. package/src/components/common/Feed.vue +58 -0
  51. package/src/components/common/Flag.vue +27 -0
  52. package/src/components/common/HomeCard.vue +20 -0
  53. package/src/components/common/ItemBox.vue +49 -0
  54. package/src/components/common/Loading.vue +19 -0
  55. package/src/components/common/LoadingDots.vue +12 -0
  56. package/src/components/common/PageHeading.vue +30 -0
  57. package/src/components/common/Pagination.vue +105 -0
  58. package/src/components/common/Popover.vue +24 -0
  59. package/src/components/common/PowerToggle.vue +130 -0
  60. package/src/components/common/ProgressBar.vue +33 -0
  61. package/src/components/common/RadioButtons.vue +52 -0
  62. package/src/components/common/Schedule.vue +79 -0
  63. package/src/components/common/SearchBar.vue +30 -0
  64. package/src/components/common/Separator.vue +3 -0
  65. package/src/components/common/Slideout.vue +95 -0
  66. package/src/components/common/Sort.vue +83 -0
  67. package/src/components/common/Table.vue +48 -0
  68. package/src/components/common/Tabs.vue +129 -0
  69. package/src/components/common/Tag.vue +53 -0
  70. package/src/components/common/Tooltip.vue +49 -0
  71. package/src/components/common/VerticalTabs.vue +34 -0
  72. package/src/components/common/card/CardItem.vue +27 -0
  73. package/src/components/common/card/CardItemGroup.vue +45 -0
  74. package/src/components/common/facet/Leaf.vue +97 -0
  75. package/src/components/common/facet/TriState.vue +37 -0
  76. package/src/components/common/table/TableData.vue +48 -0
  77. package/src/components/common/table/TableHeader.vue +21 -0
  78. package/src/components/dialogs/ChooseValueDialog.vue +97 -0
  79. package/src/components/dialogs/ConfirmDialog.vue +73 -0
  80. package/src/components/dialogs/CopyDialog.vue +51 -0
  81. package/src/components/dialogs/DownloadDialog.vue +48 -0
  82. package/src/components/dialogs/NameDescDialog.vue +74 -0
  83. package/src/components/dialogs/NameDialog.vue +56 -0
  84. package/src/components/dialogs/PopupEditor.vue +113 -0
  85. package/src/components/dialogs/ProgressDialog.vue +58 -0
  86. package/src/components/dialogs/ResetPasswordDialog.vue +58 -0
  87. package/src/components/dialogs/Wizard.vue +99 -0
  88. package/src/components/dialogs/wizard/Stepper.vue +31 -0
  89. package/src/components/form/CheckBox.vue +26 -0
  90. package/src/components/form/Editor.vue +93 -0
  91. package/src/components/form/FormCol.vue +19 -0
  92. package/src/components/form/FormRow.vue +19 -0
  93. package/src/components/form/FormSection.vue +21 -0
  94. package/src/components/form/GreyForm.vue +7 -0
  95. package/src/components/form/GreyInput.vue +51 -0
  96. package/src/components/form/GreyInputAutocomplete.vue +100 -0
  97. package/src/components/form/GreyInputCopy.vue +66 -0
  98. package/src/components/form/GreyInputGrow.vue +42 -0
  99. package/src/components/form/GreyInputToken.vue +78 -0
  100. package/src/components/form/GreyPassword.vue +36 -0
  101. package/src/components/form/GreySelect.vue +154 -0
  102. package/src/components/form/GreySelectInput.vue +123 -0
  103. package/src/components/form/GreySelectInputMultiple.vue +218 -0
  104. package/src/components/form/GreyTel.vue +58 -0
  105. package/src/components/form/HamburgerItem.vue +95 -0
  106. package/src/components/form/KeyValueEntry.vue +74 -0
  107. package/src/components/form/RadioInput.vue +38 -0
  108. package/src/components/form/UploadFile.vue +99 -0
  109. package/src/components/icons/AiIcon.vue +6 -0
  110. package/src/components/icons/GithubIcon.vue +18 -0
  111. package/src/components/icons/HighPriorityIcon.vue +6 -0
  112. package/src/components/icons/PowerOffIcon.vue +6 -0
  113. package/src/components/icons/SaveIcon.vue +6 -0
  114. package/src/components/index.js +134 -0
  115. package/src/components/menu/DialogMenu.vue +142 -0
  116. package/src/components/menu/GrandChild.vue +39 -0
  117. package/src/components/menu/GridMenu.vue +88 -0
  118. package/src/components/menu/MenuAvatar.vue +66 -0
  119. package/src/components/menu/MenuDesktop.vue +90 -0
  120. package/src/components/notifications/Notify.vue +123 -0
  121. package/src/components/notifications/NotifyList.vue +130 -0
  122. package/src/components/page-structure/FacetPage.vue +77 -0
  123. package/src/components/query/Child.vue +63 -0
  124. package/src/components/query/LVDBQuery.vue +38 -0
  125. package/src/components/status/Active.vue +44 -0
  126. package/src/components/status/ScoreLevel.vue +43 -0
  127. package/src/components/status/Status.vue +51 -0
  128. package/src/components/status/TaskDot.vue +25 -0
  129. package/src/components/status/TaskStatus.vue +26 -0
  130. package/src/components/status/TicketStatus.vue +201 -0
  131. package/src/components/status/Trend.vue +20 -0
  132. package/src/components/tables/ArgumentRunTable.vue +96 -0
  133. package/src/components/tables/ArgumentTable.vue +67 -0
  134. package/src/components/tables/CloudFormationParameters.vue +25 -0
  135. package/src/constants/colors.js +248 -0
  136. package/src/constants/font-map.js +128 -0
  137. package/src/constants/fpl2.js +162 -0
  138. package/src/constants/icon-svg.js +405 -0
  139. package/src/constants/schedule.js +52 -0
  140. package/src/fpl/AddPanel.vue +237 -0
  141. package/src/fpl/Configs/Alert.vue +16 -0
  142. package/src/fpl/Configs/AlertSprite.vue +2 -0
  143. package/src/fpl/Configs/Chart.vue +63 -0
  144. package/src/fpl/Configs/Config.js +154 -0
  145. package/src/fpl/Configs/Counter.vue +35 -0
  146. package/src/fpl/Configs/Histogram.vue +70 -0
  147. package/src/fpl/Configs/IPMap.vue +37 -0
  148. package/src/fpl/Configs/Image.vue +163 -0
  149. package/src/fpl/Configs/MetricChart.vue +20 -0
  150. package/src/fpl/Configs/PieChart.vue +37 -0
  151. package/src/fpl/Configs/SparkChart.vue +41 -0
  152. package/src/fpl/Configs/StackedBarChart.vue +49 -0
  153. package/src/fpl/Configs/Table.vue +211 -0
  154. package/src/fpl/Configs/Text.vue +14 -0
  155. package/src/fpl/Configs/TopNChart.vue +37 -0
  156. package/src/fpl/Outputs/FPLAlert.vue +64 -0
  157. package/src/fpl/Outputs/FPLStream.vue +41 -0
  158. package/src/fpl/Outputs/FPLTable.vue +77 -0
  159. package/src/fpl/Panel.vue +202 -0
  160. package/src/fpl/Panels/Alert.vue +85 -0
  161. package/src/fpl/Panels/AlertSprite.vue +9 -0
  162. package/src/fpl/Panels/Chart.vue +98 -0
  163. package/src/fpl/Panels/Counter.vue +43 -0
  164. package/src/fpl/Panels/Histogram.vue +138 -0
  165. package/src/fpl/Panels/IPMap.vue +48 -0
  166. package/src/fpl/Panels/Image.vue +35 -0
  167. package/src/fpl/Panels/MetricChart.vue +97 -0
  168. package/src/fpl/Panels/PieChart.vue +54 -0
  169. package/src/fpl/Panels/SparkChart.vue +166 -0
  170. package/src/fpl/Panels/StackedBarChart.vue +74 -0
  171. package/src/fpl/Panels/Table.vue +103 -0
  172. package/src/fpl/Panels/Text.vue +24 -0
  173. package/src/fpl/Panels/TopNChart.vue +69 -0
  174. package/src/fpl/index.js +39 -0
  175. package/src/utils/download.js +220 -0
  176. package/src/utils/formatOutput.js +156 -0
  177. package/src/utils/random.js +32 -0
  178. package/src/utils/timeUtils.js +138 -0
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <div
3
+ v-for="(tab, index) in props.options"
4
+ :key="index"
5
+ @click="updateValue(tab)"
6
+ :class="[
7
+ current === tab
8
+ ? 'bg-sky-100 dark:bg-slate-700 text-sky-700 dark:text-sky-100'
9
+ : 'text-slate-500 dark:text-slate-200 opacity-50',
10
+ 'cursor-pointer rounded-md px-4 py-2 hover:bg-sky-100 dark:hover:bg-slate-800',
11
+ ]"
12
+ >
13
+ {{ tab }}
14
+ </div>
15
+ </template>
16
+
17
+ <script setup lang="ts">
18
+ const props = defineProps({
19
+ current: {
20
+ type: String,
21
+ required: true,
22
+ },
23
+ options: {
24
+ type: Array as any,
25
+ required: true,
26
+ },
27
+ });
28
+
29
+ const emits = defineEmits(["update:tab"]);
30
+
31
+ function updateValue(value: string) {
32
+ emits("update:tab", value);
33
+ }
34
+ </script>
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div class="flex justify-between gap-x-4 py-3">
3
+ <dt class="text-sm font-light">
4
+ {{ props.title }}
5
+ </dt>
6
+ <dd :class="[
7
+ 'flex flex-wrap items-start gap-x-2 text-sm gap-y-1',
8
+ { 'break-all': props.break },
9
+ ]">
10
+ {{ props.value }}
11
+ <slot />
12
+ </dd>
13
+ </div>
14
+ </template>
15
+ <script lang="ts" setup>
16
+ const props = defineProps({
17
+ title: {
18
+ type: [String, Number],
19
+ required: true,
20
+ },
21
+ value: [String, Number],
22
+ break: {
23
+ type: Boolean,
24
+ default: false,
25
+ },
26
+ })
27
+ </script>
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <div class="py-2">
3
+ <span class="row"> {{ props.title }} </span>
4
+ <div class="px-2">
5
+ <div v-for="field in props.fields" class="flex justify-between gap-x-4">
6
+ <dt class="text-sm font-light">{{ field.name }}</dt>
7
+ <dd
8
+ :class="[
9
+ 'flex flex-wrap items-start gap-x-2 text-sm gap-y-1',
10
+ { 'icon-yellow': field.color === 'yellow'},
11
+ { 'icon-red': field.color === 'red'},
12
+ { 'icon-green': field.color === 'green'},
13
+ { 'cursor-pointer hover:font-bold': props.clickable },
14
+ ]"
15
+ @click.stop="emits('clickField', field)"
16
+ >
17
+ {{ field.value }}
18
+ </dd>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </template>
23
+ <script lang="ts" setup>
24
+ type Field = {
25
+ name: string | number;
26
+ value: string | number;
27
+ color: string;
28
+ }
29
+
30
+ const props = defineProps({
31
+ title: {
32
+ type: String,
33
+ required: true,
34
+ },
35
+ fields: {
36
+ type: Array as () => Field[],
37
+ required: true,
38
+ },
39
+ clickable: {
40
+ type: Boolean,
41
+ default: false,
42
+ },
43
+ });
44
+ const emits = defineEmits(['clickField']);
45
+ </script>
@@ -0,0 +1,97 @@
1
+ <template>
2
+ <div class="text-sm font-light">
3
+ <div class="flex justify-between pt-3 pb-1 relative">
4
+ <div
5
+ class="text-base font-normal max-w-3/4 truncate"
6
+ @mouseover="tooltip = true"
7
+ @mouseout="tooltip = false"
8
+ >
9
+ {{ parent.title }}
10
+ <span class="font-light">({{ children.length }})</span>
11
+ </div>
12
+ <div class="flex">
13
+ <PlusCircleIcon class="icon-lg" :class="noMore()" @click="topUp()" />
14
+ <MinusCircleIcon class="icon-lg" :class="noLess()" @click="topDown()" />
15
+ </div>
16
+ <Tooltip
17
+ v-if="props.tooltip"
18
+ :tooltip="parent.label"
19
+ :showingTooltip="tooltip"
20
+ direction="top"
21
+ class="left-20"
22
+ />
23
+ </div>
24
+ <div
25
+ v-for="child in children.slice(0, topLevel)"
26
+ class="flex justify-between py-1"
27
+ >
28
+ <div class="flex items-center min-w-0">
29
+ <tri-state
30
+ :state="child.state"
31
+ @newState="updateParent(parent.label, child.label, $event)"
32
+ />
33
+ <div class="px-2 truncate">
34
+ {{ !child.label ? "-" : child.label }}
35
+ </div>
36
+ </div>
37
+ <div>{{ child.count }}</div>
38
+ </div>
39
+ </div>
40
+ </template>
41
+
42
+ <script lang="ts" setup>
43
+ import { ref } from "vue";
44
+ import { PlusCircleIcon, MinusCircleIcon } from "@heroicons/vue/20/solid";
45
+ import { Tooltip } from "@/components";
46
+ import TriState from "./TriState.vue";
47
+
48
+ const props = defineProps({
49
+ parent: {
50
+ type: Object,
51
+ default: {},
52
+ },
53
+ children: {
54
+ type: Array<any>,
55
+ default: [],
56
+ },
57
+ clear: Number,
58
+ facetOptions: Object,
59
+ tooltip: {
60
+ type: Boolean,
61
+ default: false,
62
+ },
63
+ });
64
+ const emits = defineEmits(["newState"]);
65
+ const topLevel = ref(props.parent.show);
66
+ const tooltip = ref(false);
67
+
68
+ function noMore() {
69
+ if (topLevel.value < props.children.length) {
70
+ return "text-sky-600 cursor-pointer";
71
+ }
72
+ return "text-gray-400 cursor-not-allowed";
73
+ }
74
+
75
+ function noLess() {
76
+ if (topLevel.value === 0 || props.children.length === 0) {
77
+ return "text-gray-400 cursor-not-allowed";
78
+ }
79
+ return "text-sky-600 cursor-pointer";
80
+ }
81
+
82
+ function topUp() {
83
+ if (topLevel.value < props.children.length) {
84
+ topLevel.value += 5;
85
+ }
86
+ }
87
+
88
+ function topDown() {
89
+ if (topLevel.value > 0) {
90
+ topLevel.value -= 5;
91
+ }
92
+ }
93
+
94
+ function updateParent(parent: string, child: string, newState: string) {
95
+ emits("newState", parent, child, newState);
96
+ }
97
+ </script>
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <div @click="changeState()">
3
+ <div v-if="showState === 'unchecked'">
4
+ <CheckBox />
5
+ </div>
6
+ <div v-if="showState === 'checked'">
7
+ <CheckBox :checked="true" />
8
+ </div>
9
+ <div v-if="showState === 'ignored'">
10
+ <CheckBox :indeterminate="true" />
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ import { ref } from "vue";
17
+ import { CheckBox } from "@/components";
18
+
19
+ const props = defineProps(["state"]);
20
+ const emits = defineEmits(["newState"]);
21
+
22
+ const showState = ref(props.state);
23
+
24
+ function changeState() {
25
+ switch (showState.value) {
26
+ case "unchecked":
27
+ showState.value = "checked";
28
+ break;
29
+ case "checked":
30
+ showState.value = "ignored";
31
+ break;
32
+ default:
33
+ showState.value = "unchecked";
34
+ }
35
+ emits("newState", showState.value);
36
+ }
37
+ </script>
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <td
3
+ :colspan="props.colspan"
4
+ :class="[
5
+ 'table-font',
6
+ {
7
+ 'cursor-pointer hover:white-bg-hover dark:hover:dark-bg-hover':
8
+ props.hover,
9
+ },
10
+ { 'break-all': props.break },
11
+ ]"
12
+ >
13
+ <span
14
+ :class="[
15
+ { 'flex text-right justify-end': props.right && !props.center },
16
+ { 'flex justify-center': props.center },
17
+ ]"
18
+ >
19
+ {{ props.title }}
20
+ <slot />
21
+ </span>
22
+ </td>
23
+ </template>
24
+ <script setup>
25
+ const props = defineProps({
26
+ title: [String, Number, Array],
27
+ colspan: {
28
+ type: String,
29
+ default: "1",
30
+ },
31
+ center: {
32
+ type: Boolean,
33
+ default: false,
34
+ },
35
+ right: {
36
+ type: Boolean,
37
+ default: false,
38
+ },
39
+ hover: {
40
+ type: Boolean,
41
+ default: false,
42
+ },
43
+ break: {
44
+ type: Boolean,
45
+ default: false,
46
+ },
47
+ });
48
+ </script>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <th scope="col" :colspan="props.colspan" class="std-table-header">
3
+ <span :class="['', { 'flex justify-center': props.center }]">
4
+ {{ props.title }}
5
+ <slot />
6
+ </span>
7
+ </th>
8
+ </template>
9
+ <script setup>
10
+ const props = defineProps({
11
+ title: String,
12
+ colspan: {
13
+ type: String,
14
+ default: "1",
15
+ },
16
+ center: {
17
+ type: Boolean,
18
+ default: false,
19
+ },
20
+ });
21
+ </script>
@@ -0,0 +1,97 @@
1
+ <template>
2
+ <Dialog :open="open" :title="title">
3
+ <template #content>
4
+ <FormCol :fieldName="nameField">
5
+ <GreySelect
6
+ v-model="entry.key"
7
+ :options="values"
8
+ @update:model-value="setVal($event)"
9
+ />
10
+ </FormCol>
11
+ <FormCol
12
+ v-if="valueOptions.length > 1"
13
+ fieldName="Select Attribute Value"
14
+ >
15
+ <GreySelect v-model="entry.val" :options="valueOptions" />
16
+ </FormCol>
17
+ <FormCol fieldName="Selected Value">
18
+ <GreyInputGrow :value="entry.val" readonly />
19
+ </FormCol>
20
+ </template>
21
+ <template #footer>
22
+ <SubmitButtons
23
+ :saveText="saveButtonText"
24
+ @save="emits('save', entry)"
25
+ @close="close"
26
+ />
27
+ </template>
28
+ </Dialog>
29
+ </template>
30
+ <script setup>
31
+ import { ref, computed } from "vue";
32
+ import {
33
+ Dialog,
34
+ GreyInputGrow,
35
+ GreySelect,
36
+ FormCol,
37
+ SubmitButtons,
38
+ } from "@/components";
39
+
40
+ // props and emits
41
+ const props = defineProps({
42
+ title: {
43
+ type: String,
44
+ default: "Add",
45
+ },
46
+ nameField: {
47
+ type: String,
48
+ default: "Name",
49
+ },
50
+ saveButtonText: {
51
+ type: String,
52
+ default: "Save",
53
+ },
54
+ values: {
55
+ type: Array,
56
+ default: () => [],
57
+ },
58
+ });
59
+ const emits = defineEmits(["save"]);
60
+ // states
61
+ const open = ref(false);
62
+ const entry = ref({});
63
+ // computed
64
+ const valueOptions = computed(() => {
65
+ const selected = props.values.find((v) => v.value === entry.value.key);
66
+ if (selected) {
67
+ return selected.values.map((v) => ({
68
+ label: v,
69
+ value: v,
70
+ }));
71
+ } else {
72
+ return [];
73
+ }
74
+ });
75
+ // function defs
76
+ function setVal(val) {
77
+ const selected = props.values.find((v) => v.value === val);
78
+ if (selected) {
79
+ entry.value.val = selected.values[0];
80
+ }
81
+ }
82
+
83
+ function close() {
84
+ open.value = false;
85
+ }
86
+
87
+ function openModal(e) {
88
+ open.value = true;
89
+ entry.value = {};
90
+ }
91
+
92
+ defineExpose({
93
+ open,
94
+ openModal,
95
+ close,
96
+ });
97
+ </script>
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <Dialog :open="open" :title="title" @close="closeModal">
3
+ <template #content>
4
+ <div class="mt-2">
5
+ <p class="text-sm overflow-x-auto text-ellipsis">
6
+ {{ msg }}
7
+ </p>
8
+ </div>
9
+ </template>
10
+ <template #footer>
11
+ <TextButton
12
+ :text="confirmMsg"
13
+ :loading="loading"
14
+ @click="confirmAction"
15
+ />
16
+ <TextButton :text="cancelMsg" color="red" @click="cancel" />
17
+ </template>
18
+ </Dialog>
19
+ </template>
20
+
21
+ <script lang="ts" setup>
22
+ import { ref } from "vue";
23
+ import { TextButton, Dialog } from "@/components";
24
+
25
+ const open = ref(false);
26
+ const msg = ref("");
27
+ const title = ref("");
28
+ const action = ref(() => {});
29
+ const cancelAction = ref(() => {});
30
+ const confirmMsg = ref("Yes");
31
+ const cancelMsg = ref("No");
32
+ const loading = ref(false);
33
+
34
+ // function defs
35
+ function openModal(
36
+ t: string,
37
+ m: string,
38
+ a: () => void,
39
+ c: () => void,
40
+ confirm = "Yes",
41
+ cancel = "No"
42
+ ) {
43
+ title.value = t;
44
+ msg.value = m;
45
+ action.value = a;
46
+ cancelAction.value = c;
47
+ open.value = true;
48
+ confirmMsg.value = confirm;
49
+ cancelMsg.value = cancel;
50
+ }
51
+
52
+ async function confirmAction() {
53
+ loading.value = true;
54
+ await action.value();
55
+ loading.value = false;
56
+ closeModal();
57
+ }
58
+
59
+ function cancel() {
60
+ if (cancelAction.value) {
61
+ cancelAction.value();
62
+ }
63
+ closeModal();
64
+ }
65
+
66
+ function closeModal() {
67
+ open.value = false;
68
+ }
69
+
70
+ defineExpose({
71
+ openModal,
72
+ });
73
+ </script>
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <Dialog :open="open" :title="title" @close="closeModal">
3
+ <template #content>
4
+ <div class="mt-2">
5
+ <p class="break-all text-sm text-gray-600 dark:text-gray-400 font-bold">
6
+ {{ token }}
7
+ </p>
8
+ <p class="text-sm text-gray-500">
9
+ {{ msg }}
10
+ </p>
11
+ </div>
12
+ </template>
13
+ <template #footer>
14
+ <TextButton text="Copy" color="green" @click="copyAction" />
15
+ <TextButton text="Close" color="red" @click="closeModal" />
16
+ </template>
17
+ </Dialog>
18
+ </template>
19
+
20
+ <script lang="ts" setup>
21
+ import { ref } from "vue";
22
+ import { TextButton, Dialog } from "@/components";
23
+
24
+ const emits = defineEmits(["notify"]);
25
+
26
+ const open = ref(false);
27
+ const msg = ref("");
28
+ const title = ref("");
29
+ const token = ref("");
30
+
31
+ // function defs
32
+ function openModal(t: string, m: string, secret: string) {
33
+ title.value = t;
34
+ msg.value = m;
35
+ token.value = secret;
36
+ open.value = true;
37
+ }
38
+
39
+ function copyAction() {
40
+ navigator.clipboard.writeText(token.value);
41
+ emits("notify", "Token copied to clipboard", "", true);
42
+ }
43
+
44
+ function closeModal() {
45
+ open.value = false;
46
+ }
47
+
48
+ defineExpose({
49
+ openModal,
50
+ });
51
+ </script>
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <Dialog :open="open" :title="title" size="medium">
3
+ <template #footer>
4
+ <SubmitButtons
5
+ saveText="Download"
6
+ @save="downloadFile"
7
+ @close="closeModal"
8
+ />
9
+ </template>
10
+ </Dialog>
11
+ </template>
12
+ <script setup>
13
+ import { ref } from "vue";
14
+ import { Dialog, SubmitButtons } from "@/components";
15
+
16
+ // props and emits
17
+ const props = defineProps({});
18
+ const emits = defineEmits(["notify", "notifyList", "close"]);
19
+ // states
20
+ const open = ref(false);
21
+ const title = ref("Title");
22
+ const target = ref(null);
23
+
24
+ // function defs
25
+ function openModal(titleArg, file) {
26
+ open.value = true;
27
+ title.value = titleArg;
28
+ target.value = file;
29
+ }
30
+
31
+ function downloadFile() {
32
+ // download file then close dialog
33
+ window.open(target.value, "_blank");
34
+ closeModal();
35
+ }
36
+
37
+ function closeModal() {
38
+ open.value = false;
39
+ title.value = "Title";
40
+ target.value = null;
41
+ emits("close");
42
+ }
43
+
44
+ defineExpose({
45
+ openModal,
46
+ closeModal,
47
+ });
48
+ </script>
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <Dialog :open="open" :title="title">
3
+ <template #content>
4
+ <FormCol fieldName="Name">
5
+ <GreyInput v-model="entry.name" :error="error.name" />
6
+ </FormCol>
7
+ <FormCol fieldName="Description">
8
+ <GreyInput v-model="entry.description" />
9
+ </FormCol>
10
+ </template>
11
+ <template #footer>
12
+ <SubmitButtons
13
+ :saveText="saveButtonText"
14
+ :loading="loading"
15
+ @save="save"
16
+ @close="close"
17
+ />
18
+ </template>
19
+ </Dialog>
20
+ </template>
21
+ <script setup>
22
+ import { ref } from "vue";
23
+ import { Dialog, GreyInput, FormCol, SubmitButtons } from "@/components";
24
+
25
+ const props = defineProps({
26
+ title: {
27
+ type: String,
28
+ default: "Add",
29
+ },
30
+ saveButtonText: {
31
+ type: String,
32
+ default: "Save",
33
+ },
34
+ loading: {
35
+ type: Boolean,
36
+ default: false,
37
+ },
38
+ });
39
+ const emits = defineEmits(["save", "notifyList"]);
40
+ // states
41
+ const open = ref(false);
42
+ const entry = ref({});
43
+ const error = ref({});
44
+
45
+ // function defs
46
+ function close() {
47
+ error.value = {};
48
+ open.value = false;
49
+ }
50
+
51
+ function save() {
52
+ error.value = {};
53
+ if (!entry.value.name) {
54
+ error.value.name = "Name is required";
55
+ emits("notifyList", "Error", ["Name is required"], false);
56
+ return;
57
+ }
58
+ emits("save", entry.value);
59
+ }
60
+
61
+ function openModal(e) {
62
+ open.value = true;
63
+ entry.value = {
64
+ name: e.name,
65
+ description: e.description || "",
66
+ };
67
+ }
68
+
69
+ defineExpose({
70
+ open,
71
+ openModal,
72
+ close,
73
+ });
74
+ </script>