@appscode/design-system 2.4.29 → 2.5.0
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/package.json +1 -1
- package/vue-components/index.ts +1 -0
- package/vue-components/styles/components/form-fields/_check-radio-switch.scss +6 -0
- package/vue-components/v3/form-fields/AcSelect.vue +6 -0
- package/vue-components/v3/form-fields/CheckRadio.vue +33 -3
- package/vue-components/v3/form-fields/SingleStepFormArray.vue +1 -39
- package/vue-components/v3/index.ts +9 -0
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./v3";
|
|
@@ -160,6 +160,12 @@ const onSelect = (selectedOption: unknown, id: string) => emit("select", selecte
|
|
|
160
160
|
<template #noResult>
|
|
161
161
|
<span> {{ noResultText }} </span>
|
|
162
162
|
</template>
|
|
163
|
+
<template #singleLabel="props">
|
|
164
|
+
<slot name="singleLabel" v-bind="props" />
|
|
165
|
+
</template>
|
|
166
|
+
<template #option="props">
|
|
167
|
+
<slot name="option" v-bind="props" />
|
|
168
|
+
</template>
|
|
163
169
|
</multiselect>
|
|
164
170
|
<p v-show="errorMsg" class="is-danger">
|
|
165
171
|
{{ errorMsg }}
|
|
@@ -1,27 +1,54 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
|
|
2
4
|
interface Props {
|
|
3
5
|
options: Array<{
|
|
4
6
|
value: unknown;
|
|
5
7
|
label: string;
|
|
8
|
+
description?: string;
|
|
6
9
|
}>;
|
|
7
10
|
name: string;
|
|
8
11
|
modifierClasses?: string;
|
|
9
12
|
errorMsg?: string;
|
|
10
13
|
isRow?: boolean;
|
|
14
|
+
hasDescription?: boolean;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
|
-
withDefaults(defineProps<Props>(), {
|
|
17
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
14
18
|
modifierClasses: "",
|
|
15
19
|
name: "radio",
|
|
16
20
|
errorMsg: "",
|
|
17
21
|
isRow: false,
|
|
22
|
+
hasDescription: false,
|
|
18
23
|
});
|
|
24
|
+
const includeSelectedClass = (optionValue: unknown) => {
|
|
25
|
+
return props.hasDescription && JSON.stringify(model.value) === JSON.stringify(optionValue);
|
|
26
|
+
};
|
|
27
|
+
const handleClick = (optionValue: unknown) => {
|
|
28
|
+
model.value = optionValue;
|
|
29
|
+
};
|
|
19
30
|
const model = defineModel();
|
|
31
|
+
|
|
32
|
+
const bodyClass = computed(() => {
|
|
33
|
+
if (props.hasDescription) return "gap-16 details-with-checkradio-wrapper";
|
|
34
|
+
else if (!props.isRow) return "is-flex is-flex-wrap-wrap is-flex-direction-column";
|
|
35
|
+
else return "gap-24";
|
|
36
|
+
});
|
|
20
37
|
</script>
|
|
21
38
|
|
|
22
39
|
<template>
|
|
23
|
-
<div
|
|
24
|
-
<div
|
|
40
|
+
<div :class="bodyClass" data-testid="check-radio-element">
|
|
41
|
+
<div
|
|
42
|
+
class="ac-radio"
|
|
43
|
+
v-for="option in options"
|
|
44
|
+
:key="name + option.label"
|
|
45
|
+
:class="{
|
|
46
|
+
'card-select is-clickable': hasDescription,
|
|
47
|
+
'is-selected': includeSelectedClass(option.value),
|
|
48
|
+
}"
|
|
49
|
+
data-testid="check-radio-option"
|
|
50
|
+
@click.prevent="handleClick(option.value)"
|
|
51
|
+
>
|
|
25
52
|
<input
|
|
26
53
|
v-model="model"
|
|
27
54
|
:class="modifierClasses"
|
|
@@ -34,6 +61,9 @@ const model = defineModel();
|
|
|
34
61
|
<p v-show="errorMsg" class="has-text-danger">
|
|
35
62
|
<slot name="message" />
|
|
36
63
|
</p>
|
|
64
|
+
<p v-if="hasDescription" class="is-ellipsis-2 mt-8" :title="option.description">
|
|
65
|
+
{{ option.description }}
|
|
66
|
+
</p>
|
|
37
67
|
<p v-show="errorMsg" class="has-text-danger mb-16">
|
|
38
68
|
{{ errorMsg }}
|
|
39
69
|
</p>
|
|
@@ -9,8 +9,6 @@ import HeroiconsTrash from "~icons/heroicons/trash";
|
|
|
9
9
|
import HeroiconsChevronDownSolid from "~icons/heroicons/chevron-down-solid";
|
|
10
10
|
import HeroiconsChevronUpSolid from "~icons/heroicons/chevron-up-solid";
|
|
11
11
|
|
|
12
|
-
const JsonModal = defineAsyncComponent(() => import("../modals/JsonShowModal.vue"));
|
|
13
|
-
|
|
14
12
|
interface Props {
|
|
15
13
|
disabled?: boolean;
|
|
16
14
|
isCreateDisabled?: boolean;
|
|
@@ -51,8 +49,6 @@ const editFieldIndex = ref(-1);
|
|
|
51
49
|
const isFormHidden = ref(true);
|
|
52
50
|
const isSavingNewElement = ref(false);
|
|
53
51
|
const dataForTable = defineModel<Array<AcTableRow>>({ required: true });
|
|
54
|
-
const isOpen = ref(false);
|
|
55
|
-
const fullNamespaceList = ref<string[]>([]);
|
|
56
52
|
|
|
57
53
|
function onAddClick() {
|
|
58
54
|
isSavingNewElement.value = true;
|
|
@@ -93,29 +89,9 @@ function readableTime(utcTime: unknown) {
|
|
|
93
89
|
if (typeof utcTime === "string") return new Date(utcTime).toLocaleString();
|
|
94
90
|
else return utcTime;
|
|
95
91
|
}
|
|
96
|
-
function truncatedNamespaces(namespaces: string[]): string {
|
|
97
|
-
if (namespaces.length <= 1) {
|
|
98
|
-
return namespaces[0];
|
|
99
|
-
}
|
|
100
|
-
return namespaces.slice(0, 1).join(", ") + ` (+${namespaces.length - 1})`;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function showFullNamespaceList(namespaces: string[]): void {
|
|
104
|
-
isOpen.value = true;
|
|
105
|
-
|
|
106
|
-
fullNamespaceList.value = namespaces;
|
|
107
|
-
}
|
|
108
92
|
</script>
|
|
109
93
|
|
|
110
94
|
<template>
|
|
111
|
-
<json-modal
|
|
112
|
-
v-if="isOpen"
|
|
113
|
-
:open="isOpen"
|
|
114
|
-
:title="'Namespace List'"
|
|
115
|
-
:editor-content="fullNamespaceList"
|
|
116
|
-
@closemodal="isOpen = false"
|
|
117
|
-
></json-modal>
|
|
118
|
-
|
|
119
95
|
<div :class="{ 'ac-nested-elements': label }">
|
|
120
96
|
<!-- Add New Form Start -->
|
|
121
97
|
<template v-if="isSavingNewElement">
|
|
@@ -208,21 +184,7 @@ function showFullNamespaceList(namespaces: string[]): void {
|
|
|
208
184
|
<tr data-testid="ac-table-row">
|
|
209
185
|
<td v-for="(itemColumn, idx) in itemRow.cells" :key="tableHeaders[idx].name + idx">
|
|
210
186
|
<template v-if="tableHeaders[idx].type === 'date'">
|
|
211
|
-
{{ readableTime(itemColumn.data) }}
|
|
212
|
-
</template>
|
|
213
|
-
<template
|
|
214
|
-
v-else-if="tableHeaders[idx].name.toLowerCase() === 'namespace' && Array.isArray(itemColumn.data)"
|
|
215
|
-
>
|
|
216
|
-
<span
|
|
217
|
-
>{{ truncatedNamespaces(itemColumn.data) }}
|
|
218
|
-
<div
|
|
219
|
-
v-if="itemColumn.data.length > 1"
|
|
220
|
-
class="tag is-secondary is-light"
|
|
221
|
-
@click="showFullNamespaceList(itemColumn.data)"
|
|
222
|
-
>
|
|
223
|
-
<a>More </a>
|
|
224
|
-
</div></span
|
|
225
|
-
>
|
|
187
|
+
{{ readableTime(itemColumn.data as string) }}
|
|
226
188
|
</template>
|
|
227
189
|
<template v-else>
|
|
228
190
|
{{ itemColumn.data }}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import AcAccordion from "./accordion/Accordion.vue";
|
|
2
|
+
import AcAlert from "./alert/Alert.vue";
|
|
3
|
+
import AcAlertMessage from "./alert/AlertMessage.vue";
|
|
4
|
+
import AcToast from "./alert/Toast.vue";
|
|
5
|
+
import AcAvatar from "./avatar/Avatar.vue";
|
|
6
|
+
import AcBadge from "./badge-tags/Badge.vue";
|
|
7
|
+
import AcTag from "./badge-tags/Tag.vue";
|
|
8
|
+
|
|
9
|
+
export { AcAccordion, AcAlert, AcAlertMessage, AcToast, AcAvatar, AcBadge, AcTag };
|