@appscode/design-system 2.2.39 → 2.2.41
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/v3/avatar/Avatar.vue +1 -1
- package/vue-components/v3/form-fields/AcSelect.vue +8 -6
- package/vue-components/v3/form-fields/Accordion.vue +1 -1
- package/vue-components/v3/form-fields/SingleStepFormArray.vue +4 -1
- package/vue-components/v3/modal/DeleteModal.vue +72 -0
- package/vue-components/v3/modal/DialogModal.vue +156 -0
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ interface Props {
|
|
|
11
11
|
|
|
12
12
|
withDefaults(defineProps<Props>(), {
|
|
13
13
|
size: "32x32",
|
|
14
|
-
imgUrl: "https://bulma.io/images/placeholders/32x32.png",
|
|
14
|
+
imgUrl: "https://bulma.io/assets/images/placeholders/32x32.png",
|
|
15
15
|
rounded: false,
|
|
16
16
|
roundedClass: "",
|
|
17
17
|
dots: false,
|
|
@@ -89,12 +89,14 @@ const onSelect = (selectedOption: unknown, id: string) => emit("select", selecte
|
|
|
89
89
|
<div
|
|
90
90
|
ref="multiselectDivId"
|
|
91
91
|
class="multi-select-wrapper"
|
|
92
|
-
:class="
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
:class="[
|
|
93
|
+
wrapperDivCustomClass,
|
|
94
|
+
{
|
|
95
|
+
'has-refresh-button': hasRefreshBtn,
|
|
96
|
+
'is-disable': disabled || isLoaderActive,
|
|
97
|
+
'has-clear-button': allowEmpty && model,
|
|
98
|
+
},
|
|
99
|
+
]"
|
|
98
100
|
data-testid="cluster-status-select-header"
|
|
99
101
|
>
|
|
100
102
|
<label
|
|
@@ -181,7 +181,10 @@ function readableTime(utcTime: string) {
|
|
|
181
181
|
<tbody>
|
|
182
182
|
<template v-for="(itemRow, idxRow) in dataForTable" :key="idxRow">
|
|
183
183
|
<tr data-testid="ac-table-row">
|
|
184
|
-
<td
|
|
184
|
+
<td
|
|
185
|
+
v-for="(itemColumn, idx) in itemRow.cells"
|
|
186
|
+
:key="itemColumn.data as string || 'namespace' + idx"
|
|
187
|
+
>
|
|
185
188
|
<template v-if="tableHeaders[idx].type === 'date'">
|
|
186
189
|
{{ readableTime(itemColumn.data as string) }}
|
|
187
190
|
</template>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { defineAsyncComponent } from "vue";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
title?: string;
|
|
6
|
+
message?: string;
|
|
7
|
+
itemName?: string;
|
|
8
|
+
modifierClasses?: string;
|
|
9
|
+
isDeleteActive?: boolean;
|
|
10
|
+
disableModalClose?: boolean;
|
|
11
|
+
ignoreOutsideClick?: boolean;
|
|
12
|
+
hideActionFooter?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
withDefaults(defineProps<Props>(), {
|
|
16
|
+
title: "Delete Modal",
|
|
17
|
+
message: "Do you want to delete",
|
|
18
|
+
itemName: "item",
|
|
19
|
+
modifierClasses: "is-normal",
|
|
20
|
+
isDeleteActive: false,
|
|
21
|
+
disableModalClose: false,
|
|
22
|
+
ignoreOutsideClick: false,
|
|
23
|
+
hideActionFooter: false,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
defineEmits(["onDelete"]);
|
|
27
|
+
|
|
28
|
+
const open = defineModel({ type: Boolean });
|
|
29
|
+
|
|
30
|
+
const Modal = defineAsyncComponent(() => import("./DialogModal.vue"));
|
|
31
|
+
const AcButton = defineAsyncComponent(() => import("./../button/Button.vue"));
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<!-- modal start -->
|
|
36
|
+
|
|
37
|
+
<modal
|
|
38
|
+
v-model="open"
|
|
39
|
+
:title="title"
|
|
40
|
+
:class="modifierClasses"
|
|
41
|
+
:hide-action-footer="hideActionFooter"
|
|
42
|
+
:disable-modal-close="disableModalClose"
|
|
43
|
+
:ignore-outside-click="ignoreOutsideClick"
|
|
44
|
+
>
|
|
45
|
+
<!-- freedom content start -->
|
|
46
|
+
<div class="action-message pt-35 pb-35 has-text-centered">
|
|
47
|
+
<h5 class="is-message">{{ message }} {{ itemName ? "" : "?" }}</h5>
|
|
48
|
+
<p class="is-description">{{ itemName }} {{ itemName ? "?" : "" }}</p>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<!-- freedom content end -->
|
|
52
|
+
|
|
53
|
+
<!-- modal footer start -->
|
|
54
|
+
<template #modal-footer-controls>
|
|
55
|
+
<ac-button
|
|
56
|
+
@click.stop="open = false"
|
|
57
|
+
title="Cancel"
|
|
58
|
+
modifier-classes="is-outlined"
|
|
59
|
+
:disabled="isDeleteActive || disableModalClose"
|
|
60
|
+
data-testid="delete-confirmation-modal-close-button"
|
|
61
|
+
/>
|
|
62
|
+
<ac-button
|
|
63
|
+
title="Yes"
|
|
64
|
+
modifier-classes="is-danger"
|
|
65
|
+
:is-loader-active="isDeleteActive"
|
|
66
|
+
@click.stop="$emit('onDelete', itemName)"
|
|
67
|
+
data-testid="delete-confirmation-modal-confirm-button"
|
|
68
|
+
/>
|
|
69
|
+
</template>
|
|
70
|
+
</modal>
|
|
71
|
+
<!-- modal end -->
|
|
72
|
+
</template>
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { defineAsyncComponent, ref, watch, nextTick } from "vue";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
title?: string;
|
|
6
|
+
ignoreOutsideClick?: boolean;
|
|
7
|
+
hideActionFooter?: boolean;
|
|
8
|
+
disableModalClose?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
12
|
+
title: "Modal",
|
|
13
|
+
disableModalClose: false,
|
|
14
|
+
ignoreOutsideClick: false,
|
|
15
|
+
hideActionFooter: false,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const HeaderItems = defineAsyncComponent(() => import("./../header/HeaderItems.vue"));
|
|
19
|
+
|
|
20
|
+
const dialogModal = ref<HTMLDialogElement | null>(null);
|
|
21
|
+
|
|
22
|
+
const model = defineModel({ type: Boolean });
|
|
23
|
+
|
|
24
|
+
const onKeyDown = (e: KeyboardEvent) => {
|
|
25
|
+
if (model.value && e.keyCode === 27) {
|
|
26
|
+
destroyModal();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const initializeModal = () => {
|
|
31
|
+
model.value = true;
|
|
32
|
+
document.addEventListener("keydown", onKeyDown);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const destroyModal = () => {
|
|
36
|
+
if (props.disableModalClose) return;
|
|
37
|
+
model.value = false;
|
|
38
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
watch(
|
|
42
|
+
() => model.value,
|
|
43
|
+
(n) => {
|
|
44
|
+
if (n) {
|
|
45
|
+
initializeModal();
|
|
46
|
+
openDialog();
|
|
47
|
+
} else {
|
|
48
|
+
destroyModal();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const handleBackdropClick = (event: MouseEvent) => {
|
|
54
|
+
if (event.target === dialogModal.value && !props.ignoreOutsideClick) {
|
|
55
|
+
destroyModal();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const openDialog = async () => {
|
|
60
|
+
await nextTick();
|
|
61
|
+
if (dialogModal.value) {
|
|
62
|
+
dialogModal.value.showModal();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const handleCancel = (event: Event) => {
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
};
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<template>
|
|
72
|
+
<dialog v-if="model" ref="dialogModal" @click="handleBackdropClick" @cancel="handleCancel" class="ac-modal">
|
|
73
|
+
<div class="ac-modal-inner" @click.stop>
|
|
74
|
+
<div class="ac-modal-header">
|
|
75
|
+
<h5>{{ title }}</h5>
|
|
76
|
+
<header-items>
|
|
77
|
+
<slot name="modal-header-controls" />
|
|
78
|
+
</header-items>
|
|
79
|
+
|
|
80
|
+
<div class="header-items is-flex is-align-items-center">
|
|
81
|
+
<div class="header-item">
|
|
82
|
+
<button
|
|
83
|
+
@click="destroyModal"
|
|
84
|
+
class="button ac-button is-white"
|
|
85
|
+
data-testid="modal-generic-close-icon"
|
|
86
|
+
:disabled="disableModalClose"
|
|
87
|
+
>
|
|
88
|
+
<span class="icon">
|
|
89
|
+
<svg
|
|
90
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
91
|
+
fill="none"
|
|
92
|
+
viewBox="0 0 24 24"
|
|
93
|
+
stroke-width="1.5"
|
|
94
|
+
stroke="currentColor"
|
|
95
|
+
class="size-6"
|
|
96
|
+
>
|
|
97
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" />
|
|
98
|
+
</svg>
|
|
99
|
+
</span>
|
|
100
|
+
</button>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<div class="ac-modal-body ac-vscrollbar" data-testid="ac-modal-content-with-scroll">
|
|
106
|
+
<div class="ac-modal-content">
|
|
107
|
+
<div class="action-message pt-35 pb-35 has-text-centered">
|
|
108
|
+
<slot />
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<div
|
|
114
|
+
v-if="!hideActionFooter"
|
|
115
|
+
class="ac-modal-footer action-footer is-flex is-align-items-center is-justify-content-space-between"
|
|
116
|
+
>
|
|
117
|
+
<div>
|
|
118
|
+
<slot name="modal-footer-left" />
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<div class="buttons has-text-right is-block">
|
|
122
|
+
<slot name="modal-footer-controls" />
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</dialog>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<style lang="scss" scoped>
|
|
130
|
+
@import "../../../vue-components/styles/components/modal";
|
|
131
|
+
|
|
132
|
+
.ac-modal {
|
|
133
|
+
position: unset;
|
|
134
|
+
min-height: auto;
|
|
135
|
+
&:after {
|
|
136
|
+
position: unset;
|
|
137
|
+
background-color: unset;
|
|
138
|
+
opacity: 1;
|
|
139
|
+
}
|
|
140
|
+
.ac-modal-inner {
|
|
141
|
+
box-shadow: none;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
dialog {
|
|
146
|
+
background: transparent;
|
|
147
|
+
border: none;
|
|
148
|
+
&::backdrop {
|
|
149
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
dialog:focus {
|
|
154
|
+
outline: none;
|
|
155
|
+
}
|
|
156
|
+
</style>
|