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.
- package/dist/fluency-v8-components.es.js +1 -1
- package/dist/fluency-v8-components.umd.js +99 -99
- package/dist/{index-q2NbjdVo.mjs → index-ChEFiXF5.mjs} +12 -11
- package/dist/{index.es-PAPL4E6Y.mjs → index.es-CjjN70eV.mjs} +1 -1
- package/package.json +3 -2
- package/src/assets/images/ai.svg +1 -0
- package/src/assets/images/github-dark.svg +1 -0
- package/src/assets/images/github.svg +1 -0
- package/src/assets/images/high-priority.svg +1 -0
- package/src/assets/images/power-off.svg +1 -0
- package/src/assets/images/save.svg +1 -0
- package/src/assets/index.ts +15 -0
- package/src/assets/main.css +495 -0
- package/src/assets/prism-theme.css +290 -0
- package/src/components/buttons/ActionButtons.vue +374 -0
- package/src/components/buttons/DropdownButton.vue +104 -0
- package/src/components/buttons/IconButton.vue +63 -0
- package/src/components/buttons/ImageButton.vue +16 -0
- package/src/components/buttons/MenuButton.vue +138 -0
- package/src/components/buttons/SubmitButtons.vue +51 -0
- package/src/components/buttons/TextButton.vue +40 -0
- package/src/components/charts/AlertChart.vue +376 -0
- package/src/components/charts/BarChart.vue +212 -0
- package/src/components/charts/BarChartHorizontal.vue +243 -0
- package/src/components/charts/CronChart.vue +146 -0
- package/src/components/charts/EmptyChart.vue +76 -0
- package/src/components/charts/GradientChart.vue +310 -0
- package/src/components/charts/LineChart.test.js +59 -0
- package/src/components/charts/LineChart.vue +434 -0
- package/src/components/charts/PieChart.vue +293 -0
- package/src/components/charts/ProgressChart.vue +106 -0
- package/src/components/charts/StackedChart.vue +364 -0
- package/src/components/charts/StackedChartClustered.vue +395 -0
- package/src/components/charts/TimelineChart.vue +215 -0
- package/src/components/charts/WorkflowChart.vue +520 -0
- package/src/components/common/AutoCompleteSearchBar.vue +100 -0
- package/src/components/common/AutoRefreshButton.vue +53 -0
- package/src/components/common/Breadcrumb.vue +45 -0
- package/src/components/common/ButtonToggle.vue +24 -0
- package/src/components/common/Card.vue +116 -0
- package/src/components/common/Carousel.vue +66 -0
- package/src/components/common/CategoryCard.vue +28 -0
- package/src/components/common/CodeEditor.vue +59 -0
- package/src/components/common/DatePicker.vue +21 -0
- package/src/components/common/DatePickerInput.vue +109 -0
- package/src/components/common/Dialog.vue +103 -0
- package/src/components/common/EditorHeading.vue +10 -0
- package/src/components/common/EventList.vue +41 -0
- package/src/components/common/Facet.vue +206 -0
- package/src/components/common/Feed.vue +58 -0
- package/src/components/common/Flag.vue +27 -0
- package/src/components/common/HomeCard.vue +20 -0
- package/src/components/common/ItemBox.vue +49 -0
- package/src/components/common/Loading.vue +19 -0
- package/src/components/common/LoadingDots.vue +12 -0
- package/src/components/common/PageHeading.vue +30 -0
- package/src/components/common/Pagination.vue +105 -0
- package/src/components/common/Popover.vue +24 -0
- package/src/components/common/PowerToggle.vue +130 -0
- package/src/components/common/ProgressBar.vue +33 -0
- package/src/components/common/RadioButtons.vue +52 -0
- package/src/components/common/Schedule.vue +79 -0
- package/src/components/common/SearchBar.vue +30 -0
- package/src/components/common/Separator.vue +3 -0
- package/src/components/common/Slideout.vue +95 -0
- package/src/components/common/Sort.vue +83 -0
- package/src/components/common/Table.vue +48 -0
- package/src/components/common/Tabs.vue +129 -0
- package/src/components/common/Tag.vue +53 -0
- package/src/components/common/Tooltip.vue +49 -0
- package/src/components/common/VerticalTabs.vue +34 -0
- package/src/components/common/card/CardItem.vue +27 -0
- package/src/components/common/card/CardItemGroup.vue +45 -0
- package/src/components/common/facet/Leaf.vue +97 -0
- package/src/components/common/facet/TriState.vue +37 -0
- package/src/components/common/table/TableData.vue +48 -0
- package/src/components/common/table/TableHeader.vue +21 -0
- package/src/components/dialogs/ChooseValueDialog.vue +97 -0
- package/src/components/dialogs/ConfirmDialog.vue +73 -0
- package/src/components/dialogs/CopyDialog.vue +51 -0
- package/src/components/dialogs/DownloadDialog.vue +48 -0
- package/src/components/dialogs/NameDescDialog.vue +74 -0
- package/src/components/dialogs/NameDialog.vue +56 -0
- package/src/components/dialogs/PopupEditor.vue +113 -0
- package/src/components/dialogs/ProgressDialog.vue +58 -0
- package/src/components/dialogs/ResetPasswordDialog.vue +58 -0
- package/src/components/dialogs/Wizard.vue +99 -0
- package/src/components/dialogs/wizard/Stepper.vue +31 -0
- package/src/components/form/CheckBox.vue +26 -0
- package/src/components/form/Editor.vue +93 -0
- package/src/components/form/FormCol.vue +19 -0
- package/src/components/form/FormRow.vue +19 -0
- package/src/components/form/FormSection.vue +21 -0
- package/src/components/form/GreyForm.vue +7 -0
- package/src/components/form/GreyInput.vue +51 -0
- package/src/components/form/GreyInputAutocomplete.vue +100 -0
- package/src/components/form/GreyInputCopy.vue +66 -0
- package/src/components/form/GreyInputGrow.vue +42 -0
- package/src/components/form/GreyInputToken.vue +78 -0
- package/src/components/form/GreyPassword.vue +36 -0
- package/src/components/form/GreySelect.vue +154 -0
- package/src/components/form/GreySelectInput.vue +123 -0
- package/src/components/form/GreySelectInputMultiple.vue +218 -0
- package/src/components/form/GreyTel.vue +58 -0
- package/src/components/form/HamburgerItem.vue +95 -0
- package/src/components/form/KeyValueEntry.vue +74 -0
- package/src/components/form/RadioInput.vue +38 -0
- package/src/components/form/UploadFile.vue +99 -0
- package/src/components/icons/AiIcon.vue +6 -0
- package/src/components/icons/GithubIcon.vue +18 -0
- package/src/components/icons/HighPriorityIcon.vue +6 -0
- package/src/components/icons/PowerOffIcon.vue +6 -0
- package/src/components/icons/SaveIcon.vue +6 -0
- package/src/components/index.js +134 -0
- package/src/components/menu/DialogMenu.vue +142 -0
- package/src/components/menu/GrandChild.vue +39 -0
- package/src/components/menu/GridMenu.vue +88 -0
- package/src/components/menu/MenuAvatar.vue +66 -0
- package/src/components/menu/MenuDesktop.vue +90 -0
- package/src/components/notifications/Notify.vue +123 -0
- package/src/components/notifications/NotifyList.vue +130 -0
- package/src/components/page-structure/FacetPage.vue +77 -0
- package/src/components/query/Child.vue +63 -0
- package/src/components/query/LVDBQuery.vue +38 -0
- package/src/components/status/Active.vue +44 -0
- package/src/components/status/ScoreLevel.vue +43 -0
- package/src/components/status/Status.vue +51 -0
- package/src/components/status/TaskDot.vue +25 -0
- package/src/components/status/TaskStatus.vue +26 -0
- package/src/components/status/TicketStatus.vue +201 -0
- package/src/components/status/Trend.vue +20 -0
- package/src/components/tables/ArgumentRunTable.vue +96 -0
- package/src/components/tables/ArgumentTable.vue +67 -0
- package/src/components/tables/CloudFormationParameters.vue +25 -0
- package/src/constants/colors.js +248 -0
- package/src/constants/font-map.js +128 -0
- package/src/constants/fpl2.js +162 -0
- package/src/constants/icon-svg.js +405 -0
- package/src/constants/schedule.js +52 -0
- package/src/fpl/AddPanel.vue +237 -0
- package/src/fpl/Configs/Alert.vue +16 -0
- package/src/fpl/Configs/AlertSprite.vue +2 -0
- package/src/fpl/Configs/Chart.vue +63 -0
- package/src/fpl/Configs/Config.js +154 -0
- package/src/fpl/Configs/Counter.vue +35 -0
- package/src/fpl/Configs/Histogram.vue +70 -0
- package/src/fpl/Configs/IPMap.vue +37 -0
- package/src/fpl/Configs/Image.vue +163 -0
- package/src/fpl/Configs/MetricChart.vue +20 -0
- package/src/fpl/Configs/PieChart.vue +37 -0
- package/src/fpl/Configs/SparkChart.vue +41 -0
- package/src/fpl/Configs/StackedBarChart.vue +49 -0
- package/src/fpl/Configs/Table.vue +211 -0
- package/src/fpl/Configs/Text.vue +14 -0
- package/src/fpl/Configs/TopNChart.vue +37 -0
- package/src/fpl/Outputs/FPLAlert.vue +64 -0
- package/src/fpl/Outputs/FPLStream.vue +41 -0
- package/src/fpl/Outputs/FPLTable.vue +77 -0
- package/src/fpl/Panel.vue +202 -0
- package/src/fpl/Panels/Alert.vue +85 -0
- package/src/fpl/Panels/AlertSprite.vue +9 -0
- package/src/fpl/Panels/Chart.vue +98 -0
- package/src/fpl/Panels/Counter.vue +43 -0
- package/src/fpl/Panels/Histogram.vue +138 -0
- package/src/fpl/Panels/IPMap.vue +48 -0
- package/src/fpl/Panels/Image.vue +35 -0
- package/src/fpl/Panels/MetricChart.vue +97 -0
- package/src/fpl/Panels/PieChart.vue +54 -0
- package/src/fpl/Panels/SparkChart.vue +166 -0
- package/src/fpl/Panels/StackedBarChart.vue +74 -0
- package/src/fpl/Panels/Table.vue +103 -0
- package/src/fpl/Panels/Text.vue +24 -0
- package/src/fpl/Panels/TopNChart.vue +69 -0
- package/src/fpl/index.js +39 -0
- package/src/utils/download.js +220 -0
- package/src/utils/formatOutput.js +156 -0
- package/src/utils/random.js +32 -0
- package/src/utils/timeUtils.js +138 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Combobox
|
|
3
|
+
as="div"
|
|
4
|
+
v-model="selected"
|
|
5
|
+
multiple
|
|
6
|
+
:class="[
|
|
7
|
+
'input-block py-0 relative',
|
|
8
|
+
error ? 'ring-red-600 ' : '',
|
|
9
|
+
readonly ? 'disabled' : '',
|
|
10
|
+
]"
|
|
11
|
+
@update:model-value="updateSelected"
|
|
12
|
+
>
|
|
13
|
+
<div class="relative w-full rounded-lg text-left min-h-9">
|
|
14
|
+
<div
|
|
15
|
+
class="flex flex-auto flex-wrap"
|
|
16
|
+
:class="{ 'pb-2': selected.length > 0 }"
|
|
17
|
+
>
|
|
18
|
+
<div
|
|
19
|
+
v-for="val in selected"
|
|
20
|
+
class="flex items-center ml-2 select-chip mt-2"
|
|
21
|
+
>
|
|
22
|
+
<div class="text-xs font-normal leading-none max-w-full flex-initial">
|
|
23
|
+
{{ val.label }}
|
|
24
|
+
</div>
|
|
25
|
+
<div
|
|
26
|
+
v-if="!readonly"
|
|
27
|
+
class="relative z-10 flex flex-auto flex-row-reverse"
|
|
28
|
+
>
|
|
29
|
+
<XMarkIcon
|
|
30
|
+
class="icon cursor-pointer hover:opacity-75"
|
|
31
|
+
@click="remove(val)"
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<ComboboxInput
|
|
37
|
+
v-if="allowInput"
|
|
38
|
+
class="z-1 w-full border-none pr-10 text-sm bg-transparent focus:ring-0"
|
|
39
|
+
:displayValue="() => query"
|
|
40
|
+
:disabled="readonly"
|
|
41
|
+
@change="query = $event.target.value"
|
|
42
|
+
@keyup.enter="add()"
|
|
43
|
+
/>
|
|
44
|
+
<ComboboxButton
|
|
45
|
+
v-if="!allowInput"
|
|
46
|
+
:disabled="readonly"
|
|
47
|
+
class="absolute w-full inset-y-0 left-0 flex items-center pl-3"
|
|
48
|
+
>
|
|
49
|
+
<span v-if="selected.length === 0" class="block truncate">
|
|
50
|
+
Select Values
|
|
51
|
+
</span>
|
|
52
|
+
</ComboboxButton>
|
|
53
|
+
<ComboboxButton
|
|
54
|
+
class="absolute inset-y-0 right-0 flex items-center pr-2"
|
|
55
|
+
:disabled="readonly"
|
|
56
|
+
>
|
|
57
|
+
<ChevronUpDownIcon class="icon-md text-gray-400" aria-hidden="true" />
|
|
58
|
+
</ComboboxButton>
|
|
59
|
+
</div>
|
|
60
|
+
<TransitionRoot
|
|
61
|
+
leave="transition ease-in duration-100"
|
|
62
|
+
leaveFrom="opacity-100"
|
|
63
|
+
leaveTo="opacity-0"
|
|
64
|
+
@after-leave="query = ''"
|
|
65
|
+
>
|
|
66
|
+
<ComboboxOptions
|
|
67
|
+
class="input-block absolute z-20 mt-1 max-h-56 w-full overflow-auto rounded-md bg-white p-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-hidden sm:text-sm"
|
|
68
|
+
>
|
|
69
|
+
<div
|
|
70
|
+
v-if="filteredOptions.length === 0 && query !== ''"
|
|
71
|
+
class="relative px-4 py-2 text-white"
|
|
72
|
+
@click="add()"
|
|
73
|
+
>
|
|
74
|
+
{{ query }}
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<ComboboxOption
|
|
78
|
+
v-for="option in filteredOptions"
|
|
79
|
+
as="template"
|
|
80
|
+
:value="option"
|
|
81
|
+
v-slot="{ selected, active }"
|
|
82
|
+
>
|
|
83
|
+
<li
|
|
84
|
+
:class="[
|
|
85
|
+
active ? 'bg-indigo-600 text-white' : '',
|
|
86
|
+
'relative cursor-default select-none py-2 pl-3 pr-9',
|
|
87
|
+
]"
|
|
88
|
+
>
|
|
89
|
+
<span
|
|
90
|
+
class="block truncate"
|
|
91
|
+
:class="{ 'font-semibold': selected, 'font-normal': !selected }"
|
|
92
|
+
>
|
|
93
|
+
{{ option.label }}
|
|
94
|
+
</span>
|
|
95
|
+
<span
|
|
96
|
+
v-if="selected"
|
|
97
|
+
class="text-white absolute inset-y-0 right-1 flex items-center pr-4,"
|
|
98
|
+
>
|
|
99
|
+
<CheckIcon class="icon-md" aria-hidden="true" />
|
|
100
|
+
</span>
|
|
101
|
+
</li>
|
|
102
|
+
</ComboboxOption>
|
|
103
|
+
</ComboboxOptions>
|
|
104
|
+
</TransitionRoot>
|
|
105
|
+
</Combobox>
|
|
106
|
+
<div v-if="error" class="text-red-600 text-sm">
|
|
107
|
+
{{ error }}
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
|
110
|
+
|
|
111
|
+
<script setup>
|
|
112
|
+
import { ref, computed, watch } from "vue";
|
|
113
|
+
import {
|
|
114
|
+
Combobox,
|
|
115
|
+
ComboboxInput,
|
|
116
|
+
ComboboxButton,
|
|
117
|
+
ComboboxOptions,
|
|
118
|
+
ComboboxOption,
|
|
119
|
+
TransitionRoot,
|
|
120
|
+
} from "@headlessui/vue";
|
|
121
|
+
import {
|
|
122
|
+
CheckIcon,
|
|
123
|
+
ChevronUpDownIcon,
|
|
124
|
+
XMarkIcon,
|
|
125
|
+
} from "@heroicons/vue/20/solid";
|
|
126
|
+
|
|
127
|
+
// props and emits
|
|
128
|
+
const props = defineProps({
|
|
129
|
+
selected: {
|
|
130
|
+
type: Array,
|
|
131
|
+
default: () => [],
|
|
132
|
+
},
|
|
133
|
+
options: {
|
|
134
|
+
type: Array,
|
|
135
|
+
default: () => [],
|
|
136
|
+
},
|
|
137
|
+
readonly: {
|
|
138
|
+
type: [Boolean, Number],
|
|
139
|
+
default: false,
|
|
140
|
+
},
|
|
141
|
+
error: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: "",
|
|
144
|
+
},
|
|
145
|
+
sorted: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
default: false,
|
|
148
|
+
},
|
|
149
|
+
allowInput: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
default: true,
|
|
152
|
+
},
|
|
153
|
+
preventNew: {
|
|
154
|
+
type: Boolean,
|
|
155
|
+
default: false,
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
const emits = defineEmits(["update"]);
|
|
159
|
+
// states
|
|
160
|
+
const selected = ref([]);
|
|
161
|
+
const query = ref("");
|
|
162
|
+
// computed
|
|
163
|
+
const sortedOptions = computed(() =>
|
|
164
|
+
props.sorted
|
|
165
|
+
? props.options.sort((a, b) => a.label.localeCompare(b.label))
|
|
166
|
+
: props.options
|
|
167
|
+
);
|
|
168
|
+
const filteredOptions = computed(() =>
|
|
169
|
+
query.value === ""
|
|
170
|
+
? sortedOptions.value.slice(0, 50)
|
|
171
|
+
: sortedOptions.value
|
|
172
|
+
.filter((option) => {
|
|
173
|
+
return option.label.toLowerCase().includes(query.value.toLowerCase());
|
|
174
|
+
})
|
|
175
|
+
.slice(0, 50)
|
|
176
|
+
);
|
|
177
|
+
// watcher
|
|
178
|
+
watch(
|
|
179
|
+
() => props.selected,
|
|
180
|
+
(newVal, oldVal) => {
|
|
181
|
+
if (JSON.stringify(selected.value) !== JSON.stringify(props.selected)) {
|
|
182
|
+
updateLocalSelected();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
// mounted
|
|
187
|
+
updateLocalSelected();
|
|
188
|
+
// function defs
|
|
189
|
+
function add() {
|
|
190
|
+
if (props.preventNew) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (selected.value.find((v) => v.value === query.value)) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
selected.value.push({ label: query.value, value: query.value });
|
|
197
|
+
query.value = "";
|
|
198
|
+
updateSelected(selected.value);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function remove(val) {
|
|
202
|
+
selected.value = selected.value.filter((v) => v.value !== val.value);
|
|
203
|
+
updateSelected(selected.value);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function updateSelected(val) {
|
|
207
|
+
const vals = val.map((v) => v.value);
|
|
208
|
+
emits("update", vals);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function updateLocalSelected() {
|
|
212
|
+
const vals = props.selected.map((v) => {
|
|
213
|
+
const option = props.options.find((o) => o.value === v);
|
|
214
|
+
return option || { label: v, value: v };
|
|
215
|
+
});
|
|
216
|
+
selected.value = vals;
|
|
217
|
+
}
|
|
218
|
+
</script>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<input
|
|
3
|
+
v-model="formatted"
|
|
4
|
+
type="tel"
|
|
5
|
+
:class="[
|
|
6
|
+
'input-block',
|
|
7
|
+
error ? 'ring-red-600 ' : '',
|
|
8
|
+
readonly ? 'disabled' : '',
|
|
9
|
+
]"
|
|
10
|
+
placeholder="(xxx)-xxx-xxxx"
|
|
11
|
+
@input="onChange"
|
|
12
|
+
/>
|
|
13
|
+
<div v-if="error" class="text-red-600 text-sm">
|
|
14
|
+
{{ error }}
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
export default {
|
|
20
|
+
props: {
|
|
21
|
+
error: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "",
|
|
24
|
+
},
|
|
25
|
+
readonly: {
|
|
26
|
+
type: [Boolean, Number],
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
emits: ["update"],
|
|
31
|
+
data() {
|
|
32
|
+
return {
|
|
33
|
+
formatted: "",
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
onChange(event) {
|
|
38
|
+
const input = event.target.value.replace(/\D/g, "");
|
|
39
|
+
let val = input;
|
|
40
|
+
if (val.length > 10) {
|
|
41
|
+
val = val.slice(0, 10);
|
|
42
|
+
}
|
|
43
|
+
if (input.length > 6) {
|
|
44
|
+
this.formatted = `(${val.slice(0, 3)})-${val.slice(3, 6)}-${val.slice(
|
|
45
|
+
6
|
|
46
|
+
)}`;
|
|
47
|
+
} else if (input.length > 3) {
|
|
48
|
+
this.formatted = `(${val.slice(0, 3)})-${val.slice(3)}`;
|
|
49
|
+
} else if (input.length > 0) {
|
|
50
|
+
this.formatted = `(${val})`;
|
|
51
|
+
} else {
|
|
52
|
+
this.formatted = "";
|
|
53
|
+
}
|
|
54
|
+
this.$emit("update", val);
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
</script>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="[
|
|
4
|
+
'cursor-pointer input-block my-2 px-5 py-1 rounded-lg relative',
|
|
5
|
+
draggable ? `draggable${index} select-none` : '',
|
|
6
|
+
'hover:bg-neutral-200 dark:hover:bg-neutral-600',
|
|
7
|
+
]"
|
|
8
|
+
>
|
|
9
|
+
<span class="flex items-center">
|
|
10
|
+
<Bars3Icon v-if="draggable" class="icon-md flex-shrink-0 mr-4" />
|
|
11
|
+
<span class="ml-1 block truncate">{{ name }}</span>
|
|
12
|
+
<span class="absolute right-2">
|
|
13
|
+
<slot name="right" />
|
|
14
|
+
</span>
|
|
15
|
+
</span>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
<script setup>
|
|
19
|
+
import { ref, watch } from "vue";
|
|
20
|
+
import interact from "interactjs";
|
|
21
|
+
import { Bars3Icon } from "@heroicons/vue/20/solid";
|
|
22
|
+
|
|
23
|
+
const props = defineProps({
|
|
24
|
+
name: String,
|
|
25
|
+
draggable: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
itemCount: Number,
|
|
30
|
+
index: Number,
|
|
31
|
+
reset: Boolean,
|
|
32
|
+
});
|
|
33
|
+
const emits = defineEmits(["reorder", "reset"]);
|
|
34
|
+
const position = ref({ x: 0, y: 0 });
|
|
35
|
+
setDraggable();
|
|
36
|
+
|
|
37
|
+
watch(
|
|
38
|
+
() => props.itemCount,
|
|
39
|
+
() => {
|
|
40
|
+
setDraggable();
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
watch(
|
|
44
|
+
() => props.reset,
|
|
45
|
+
() => {
|
|
46
|
+
setDraggable();
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
function setDraggable() {
|
|
51
|
+
const relativePositions = getRelativePositions();
|
|
52
|
+
interact(`.draggable${props.index}`).draggable({
|
|
53
|
+
listeners: {
|
|
54
|
+
start(event) {
|
|
55
|
+
position.value.x = 0;
|
|
56
|
+
position.value.y = 0;
|
|
57
|
+
},
|
|
58
|
+
move(event) {
|
|
59
|
+
const prev = relativePositions.findIndex(
|
|
60
|
+
(pos) => position.value.y > pos - 1 && position.value.y < pos + 1
|
|
61
|
+
);
|
|
62
|
+
position.value.x += event.dx;
|
|
63
|
+
position.value.y += event.dy;
|
|
64
|
+
// if touch something, change the order
|
|
65
|
+
const target = relativePositions.find(
|
|
66
|
+
(pos) => position.value.y > pos - 1 && position.value.y < pos + 1
|
|
67
|
+
);
|
|
68
|
+
if (target || target === 0) {
|
|
69
|
+
emits("reorder", relativePositions.indexOf(target), prev);
|
|
70
|
+
} else {
|
|
71
|
+
event.target.style.transform = `translate(${position.value.x}px, ${position.value.y}px)`;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
end() {
|
|
75
|
+
emits("reset");
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
modifiers: [
|
|
79
|
+
interact.modifiers.snap({
|
|
80
|
+
targets: relativePositions.map((pos) => ({ x: 0, y: pos })),
|
|
81
|
+
offset: "startCoords",
|
|
82
|
+
}),
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function getRelativePositions() {
|
|
88
|
+
const arr = [];
|
|
89
|
+
for (let i = 0; i < props.itemCount; i++) {
|
|
90
|
+
const diff = i - props.index;
|
|
91
|
+
arr.push(diff * 40);
|
|
92
|
+
}
|
|
93
|
+
return arr;
|
|
94
|
+
}
|
|
95
|
+
</script>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Table :data="[0]">
|
|
3
|
+
<template #header>
|
|
4
|
+
<tr>
|
|
5
|
+
<TableHeader title="Name" />
|
|
6
|
+
<TableHeader title="Value" />
|
|
7
|
+
<TableHeader title=" " />
|
|
8
|
+
</tr>
|
|
9
|
+
</template>
|
|
10
|
+
<template #rows>
|
|
11
|
+
<tr v-for="(item, index) in local" :key="index">
|
|
12
|
+
<TableData>
|
|
13
|
+
<GreyInput v-model="item[keyName]" :readonly="readonly" />
|
|
14
|
+
</TableData>
|
|
15
|
+
<TableData>
|
|
16
|
+
<GreyInput v-model="item[valueName]" :readonly="readonly" />
|
|
17
|
+
</TableData>
|
|
18
|
+
<TableData>
|
|
19
|
+
<IconButton
|
|
20
|
+
color="red"
|
|
21
|
+
:disabled="readonly"
|
|
22
|
+
@click="local.splice(index, 1)"
|
|
23
|
+
>
|
|
24
|
+
<TrashIcon class="icon-md" aria-hidden="true" />
|
|
25
|
+
</IconButton>
|
|
26
|
+
</TableData>
|
|
27
|
+
</tr>
|
|
28
|
+
<tr>
|
|
29
|
+
<th colspan="3">
|
|
30
|
+
<TextButton text="Add" :disabled="readonly" @click="addRow" />
|
|
31
|
+
</th>
|
|
32
|
+
</tr>
|
|
33
|
+
</template>
|
|
34
|
+
</Table>
|
|
35
|
+
<div v-if="error" class="text-red-600 text-sm">
|
|
36
|
+
{{ error }}
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
<script setup>
|
|
40
|
+
import { ref, watch } from "vue";
|
|
41
|
+
import {
|
|
42
|
+
IconButton,
|
|
43
|
+
Table,
|
|
44
|
+
TableData,
|
|
45
|
+
TableHeader,
|
|
46
|
+
TextButton,
|
|
47
|
+
GreyInput,
|
|
48
|
+
} from "@/components";
|
|
49
|
+
import { TrashIcon } from "@heroicons/vue/20/solid";
|
|
50
|
+
|
|
51
|
+
const props = defineProps({
|
|
52
|
+
kvarray: Array,
|
|
53
|
+
keyName: String,
|
|
54
|
+
valueName: String,
|
|
55
|
+
readonly: Boolean,
|
|
56
|
+
error: String,
|
|
57
|
+
});
|
|
58
|
+
const emits = defineEmits(["update"]);
|
|
59
|
+
|
|
60
|
+
const local = ref(props.kvarray);
|
|
61
|
+
const watchLocal = watch(local, (newVal) => {
|
|
62
|
+
emits("update", newVal);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
function addRow() {
|
|
66
|
+
const entry = {};
|
|
67
|
+
entry[props.keyName] = "";
|
|
68
|
+
entry[props.valueName] = "";
|
|
69
|
+
if (!local.value) {
|
|
70
|
+
local.value = [];
|
|
71
|
+
}
|
|
72
|
+
local.value.push(entry);
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<input
|
|
3
|
+
type="radio"
|
|
4
|
+
:class="[
|
|
5
|
+
'icon text-indigo-600 focus:ring-indigo-600',
|
|
6
|
+
$attrs.readonly ? 'disabled' : '',
|
|
7
|
+
]"
|
|
8
|
+
:value="radioValue"
|
|
9
|
+
:checked="radioValue === $attrs.modelValue"
|
|
10
|
+
v-bind="$attrs"
|
|
11
|
+
@input="onChange"
|
|
12
|
+
/>
|
|
13
|
+
<span v-if="label" class="ml-2 text-sm">{{ label }}</span>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
export default {
|
|
18
|
+
props: {
|
|
19
|
+
error: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "",
|
|
22
|
+
},
|
|
23
|
+
radioValue: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
label: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
onChange(event) {
|
|
34
|
+
this.$emit("update:modelValue", event.target.value);
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="['w-full', active ? 'white-bg-hover dark:dark-bg-hover' : '']"
|
|
4
|
+
id="upload-drop"
|
|
5
|
+
:data-active="active"
|
|
6
|
+
@drop.prevent="dropFile"
|
|
7
|
+
@dragenter.prevent="active = true"
|
|
8
|
+
@dragover.prevent="active = true"
|
|
9
|
+
@dragleave.prevent="active = false"
|
|
10
|
+
>
|
|
11
|
+
<div class="mt-2 sm:col-span-2 sm:mt-0">
|
|
12
|
+
<div
|
|
13
|
+
class="flex justify-center rounded-lg border border-dashed px-6 py-10 border-gray-400 dark:border-white"
|
|
14
|
+
>
|
|
15
|
+
<div class="text-center">
|
|
16
|
+
<div class="mt-4 flex text-sm leading-6">
|
|
17
|
+
<label
|
|
18
|
+
for="file-upload"
|
|
19
|
+
class="relative cursor-pointer rounded-md font-bold"
|
|
20
|
+
>
|
|
21
|
+
<span>Click here to upload a file</span>
|
|
22
|
+
<input
|
|
23
|
+
id="file-upload"
|
|
24
|
+
name="file-upload"
|
|
25
|
+
type="file"
|
|
26
|
+
class="sr-only"
|
|
27
|
+
:accept="formats.join(', ')"
|
|
28
|
+
@change="uploaded"
|
|
29
|
+
/>
|
|
30
|
+
</label>
|
|
31
|
+
<p class="pl-1">or drop the file here</p>
|
|
32
|
+
</div>
|
|
33
|
+
<p class="text-xs leading-5">
|
|
34
|
+
Accepts {{ formats.join(" ") }} formats
|
|
35
|
+
</p>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script setup>
|
|
43
|
+
import { onMounted, ref } from "vue";
|
|
44
|
+
|
|
45
|
+
const props = defineProps({
|
|
46
|
+
formats: {
|
|
47
|
+
type: Array,
|
|
48
|
+
default: () => [".json"],
|
|
49
|
+
},
|
|
50
|
+
readerFunction: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "text",
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
const emits = defineEmits(["upload", "notify"]);
|
|
56
|
+
const events = ["dragenter", "dragover", "dragleave", "drop", "notify"];
|
|
57
|
+
const active = ref(false);
|
|
58
|
+
|
|
59
|
+
function uploaded(e) {
|
|
60
|
+
if (!e.target.files || !e.target.files.length) return;
|
|
61
|
+
const file = e.target.files[0];
|
|
62
|
+
const fileType = file.name.substring(
|
|
63
|
+
file.name.lastIndexOf("."),
|
|
64
|
+
file.name.length
|
|
65
|
+
);
|
|
66
|
+
if (!props.formats.some((format) => format === fileType)) {
|
|
67
|
+
emits("notify", "Error", "Invalid file format", false);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const reader = new FileReader();
|
|
71
|
+
reader.onload = (e) => {
|
|
72
|
+
// const data = JSON.parse(e.target.result);
|
|
73
|
+
const data = e.target.result;
|
|
74
|
+
emits("upload", data);
|
|
75
|
+
};
|
|
76
|
+
if (props.readerFunction === "data") {
|
|
77
|
+
reader.readAsDataURL(file);
|
|
78
|
+
} else {
|
|
79
|
+
reader.readAsText(file);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function dropFile(e) {
|
|
84
|
+
uploaded({ target: e.dataTransfer });
|
|
85
|
+
active.value = false;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function preventDefaults(e) {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
onMounted(() => {
|
|
93
|
+
events.forEach((eventName) => {
|
|
94
|
+
document
|
|
95
|
+
.getElementById("upload-drop")
|
|
96
|
+
.addEventListener(eventName, preventDefaults);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<img :src="src" alt="avatar" />
|
|
3
|
+
</template>
|
|
4
|
+
<script setup>
|
|
5
|
+
import { computed } from "vue";
|
|
6
|
+
import { githubDark, github } from "@/assets";
|
|
7
|
+
// props
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
theme: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: "light",
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
// computed
|
|
15
|
+
const src = computed(() => {
|
|
16
|
+
return props.theme === "dark" ? githubDark : github;
|
|
17
|
+
});
|
|
18
|
+
</script>
|