@appscode/design-system 1.0.43-alpha.144 → 1.0.43-alpha.147
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/v2/editor/Editor.vue +8 -5
- package/vue-components/v2/editor/MonacoEditor.vue +125 -0
- package/vue-components/v3/modal/Modal.vue +26 -16
- package/vue-components/v3/table/MultiInfoTable.vue +143 -0
- package/vue-components/v3/table/Table.vue +6 -6
- package/vue-components/v3/table/TableContainer.vue +34 -0
package/package.json
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
/>
|
|
8
8
|
<monaco-editor
|
|
9
9
|
v-if="activeTab === 'edit'"
|
|
10
|
-
ref="monacoEditor"
|
|
11
10
|
@editorDidMount="onEditorMount"
|
|
12
11
|
key="edit"
|
|
13
12
|
:class="`vh-${editorHeight} is-clipped`"
|
|
14
|
-
|
|
13
|
+
:value="editorContent"
|
|
14
|
+
@change="onChange"
|
|
15
15
|
:language="language"
|
|
16
16
|
:options="{
|
|
17
17
|
minimap: {
|
|
@@ -82,10 +82,11 @@ export default {
|
|
|
82
82
|
default: "off",
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
|
+
|
|
85
86
|
components: {
|
|
86
87
|
EditorTabs: () => import("../tabs/EditorTabs.vue"),
|
|
87
88
|
MonacoEditor: () => ({
|
|
88
|
-
component: import("vue
|
|
89
|
+
component: import("./MonacoEditor.vue"),
|
|
89
90
|
loading: Preloader,
|
|
90
91
|
delay: 200,
|
|
91
92
|
error: Banner,
|
|
@@ -136,8 +137,10 @@ export default {
|
|
|
136
137
|
},
|
|
137
138
|
|
|
138
139
|
methods: {
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
onChange(e) {
|
|
141
|
+
if (typeof e === "string") this.editorContent = e;
|
|
142
|
+
},
|
|
143
|
+
onEditorMount(editor) {
|
|
141
144
|
// add event listeners
|
|
142
145
|
editor.onDidBlurEditorText(() => {
|
|
143
146
|
this.$emit("input", this.editorContent);
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="monaco-editor-vue2" :style="style"></div>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import * as monaco from "monaco-editor";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
name: "MonacoEditor",
|
|
10
|
+
props: {
|
|
11
|
+
diffEditor: { type: Boolean, default: false },
|
|
12
|
+
width: { type: [String, Number], default: "100%" },
|
|
13
|
+
height: { type: [String, Number], default: "100%" },
|
|
14
|
+
original: String,
|
|
15
|
+
value: String,
|
|
16
|
+
language: { type: String, default: "javascript" },
|
|
17
|
+
theme: { type: String, default: "vs" },
|
|
18
|
+
options: {
|
|
19
|
+
type: Object,
|
|
20
|
+
default() {
|
|
21
|
+
return {};
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
computed: {
|
|
26
|
+
style() {
|
|
27
|
+
const fixedWidth = this.width.toString().includes("%")
|
|
28
|
+
? this.width
|
|
29
|
+
: `${this.width}px`;
|
|
30
|
+
const fixedHeight = this.height.toString().includes("%")
|
|
31
|
+
? this.height
|
|
32
|
+
: `${this.height}px`;
|
|
33
|
+
return {
|
|
34
|
+
width: fixedWidth,
|
|
35
|
+
height: fixedHeight,
|
|
36
|
+
"text-align": "left",
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
mounted() {
|
|
41
|
+
this.initMonaco();
|
|
42
|
+
},
|
|
43
|
+
beforeDestroy() {
|
|
44
|
+
this.editor && this.editor.dispose();
|
|
45
|
+
},
|
|
46
|
+
methods: {
|
|
47
|
+
initMonaco() {
|
|
48
|
+
this.$emit("editorWillMount", this.monaco);
|
|
49
|
+
const { value, language, theme, options } = this;
|
|
50
|
+
this.editor = monaco.editor[
|
|
51
|
+
this.diffEditor ? "createDiffEditor" : "create"
|
|
52
|
+
](this.$el, {
|
|
53
|
+
value: value,
|
|
54
|
+
language: language,
|
|
55
|
+
theme: theme,
|
|
56
|
+
...options,
|
|
57
|
+
});
|
|
58
|
+
this.diffEditor && this._setModel(this.value, this.original);
|
|
59
|
+
|
|
60
|
+
// @event `change`
|
|
61
|
+
const editor = this._getEditor();
|
|
62
|
+
editor.onDidChangeModelContent((event) => {
|
|
63
|
+
const value = editor.getValue();
|
|
64
|
+
if (this.value !== value) {
|
|
65
|
+
this.$emit("change", value, event);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
this.$emit("editorDidMount", this.editor);
|
|
70
|
+
},
|
|
71
|
+
_setModel(value, original) {
|
|
72
|
+
const { language } = this;
|
|
73
|
+
const originalModel = monaco.editor.createModel(original, language);
|
|
74
|
+
const modifiedModel = monaco.editor.createModel(value, language);
|
|
75
|
+
this.editor.setModel({
|
|
76
|
+
original: originalModel,
|
|
77
|
+
modified: modifiedModel,
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
_setValue(value) {
|
|
81
|
+
let editor = this._getEditor();
|
|
82
|
+
if (editor) return editor.setValue(value);
|
|
83
|
+
},
|
|
84
|
+
_getValue() {
|
|
85
|
+
let editor = this._getEditor();
|
|
86
|
+
if (!editor) return "";
|
|
87
|
+
return editor.getValue();
|
|
88
|
+
},
|
|
89
|
+
_getEditor() {
|
|
90
|
+
if (!this.editor) return null;
|
|
91
|
+
return this.diffEditor ? this.editor.getModifiedEditor() : this.editor;
|
|
92
|
+
},
|
|
93
|
+
_setOriginal() {
|
|
94
|
+
const { original } = this.editor.getModel();
|
|
95
|
+
original.setValue(this.original);
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
watch: {
|
|
99
|
+
options: {
|
|
100
|
+
deep: true,
|
|
101
|
+
handler(options) {
|
|
102
|
+
this.editor.updateOptions(options);
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
value() {
|
|
106
|
+
this.value !== this._getValue() && this._setValue(this.value);
|
|
107
|
+
},
|
|
108
|
+
original() {
|
|
109
|
+
this._setOriginal();
|
|
110
|
+
},
|
|
111
|
+
language() {
|
|
112
|
+
if (!this.editor) return;
|
|
113
|
+
if (this.diffEditor) {
|
|
114
|
+
const { original, modified } = this.editor.getModel();
|
|
115
|
+
monaco.editor.setModelLanguage(original, this.language);
|
|
116
|
+
monaco.editor.setModelLanguage(modified, this.language);
|
|
117
|
+
} else
|
|
118
|
+
monaco.editor.setModelLanguage(this.editor.getModel(), this.language);
|
|
119
|
+
},
|
|
120
|
+
theme() {
|
|
121
|
+
monaco.editor.setTheme(this.theme);
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
</script>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
v-if="showModal"
|
|
7
7
|
class="ac-modal is-middle-alignment"
|
|
8
8
|
:class="modifierClasses"
|
|
9
|
-
@click.self="
|
|
9
|
+
@click.self="onModalOutsideClick"
|
|
10
10
|
>
|
|
11
11
|
<div class="ac-modal-inner">
|
|
12
12
|
<!-- modal header start -->
|
|
@@ -37,7 +37,9 @@
|
|
|
37
37
|
<!-- modal body end -->
|
|
38
38
|
|
|
39
39
|
<!-- modal footer start -->
|
|
40
|
-
<div
|
|
40
|
+
<div
|
|
41
|
+
class="ac-modal-footer action-footer is-flex is-align-items-center is-justify-content-space-between"
|
|
42
|
+
>
|
|
41
43
|
<div>
|
|
42
44
|
<slot name="modal-footer-left" />
|
|
43
45
|
</div>
|
|
@@ -58,36 +60,40 @@ export default defineComponent({
|
|
|
58
60
|
props: {
|
|
59
61
|
open: {
|
|
60
62
|
type: Boolean,
|
|
61
|
-
default: false
|
|
63
|
+
default: false
|
|
62
64
|
},
|
|
63
65
|
title: {
|
|
64
66
|
type: String,
|
|
65
|
-
default: "Modal"
|
|
67
|
+
default: "Modal"
|
|
66
68
|
},
|
|
67
69
|
modifierClasses: {
|
|
68
70
|
type: String,
|
|
69
|
-
default: ""
|
|
71
|
+
default: ""
|
|
70
72
|
},
|
|
71
73
|
isCloseOptionDisabled: {
|
|
72
74
|
type: Boolean,
|
|
73
|
-
default: false
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
ignoreOutsideClick: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: false
|
|
74
80
|
}
|
|
75
81
|
},
|
|
76
82
|
emits: ["closemodal"],
|
|
77
83
|
|
|
78
84
|
components: {
|
|
79
85
|
HeaderItems: defineAsyncComponent(() =>
|
|
80
|
-
import("../../v2/header/HeaderItems.vue").then(
|
|
86
|
+
import("../../v2/header/HeaderItems.vue").then(module => module.default)
|
|
81
87
|
),
|
|
82
88
|
HeaderItem: defineAsyncComponent(() =>
|
|
83
|
-
import("../../v2/header/HeaderItem.vue").then(
|
|
89
|
+
import("../../v2/header/HeaderItem.vue").then(module => module.default)
|
|
84
90
|
),
|
|
85
91
|
Buttons: defineAsyncComponent(() =>
|
|
86
|
-
import("../../v2/button/Buttons.vue").then(
|
|
92
|
+
import("../../v2/button/Buttons.vue").then(module => module.default)
|
|
87
93
|
),
|
|
88
94
|
AcButton: defineAsyncComponent(() =>
|
|
89
|
-
import("../button/Button.vue").then(
|
|
90
|
-
)
|
|
95
|
+
import("../button/Button.vue").then(module => module.default)
|
|
96
|
+
)
|
|
91
97
|
},
|
|
92
98
|
|
|
93
99
|
data() {
|
|
@@ -95,7 +101,7 @@ export default defineComponent({
|
|
|
95
101
|
showModal: false,
|
|
96
102
|
crossIcon: import.meta.globEager(
|
|
97
103
|
"/src/assets/icons/modal/close-icon.svg"
|
|
98
|
-
)["/src/assets/icons/modal/close-icon.svg"].default
|
|
104
|
+
)["/src/assets/icons/modal/close-icon.svg"].default
|
|
99
105
|
};
|
|
100
106
|
},
|
|
101
107
|
|
|
@@ -108,8 +114,8 @@ export default defineComponent({
|
|
|
108
114
|
} else {
|
|
109
115
|
this.destroyModal();
|
|
110
116
|
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
113
119
|
},
|
|
114
120
|
|
|
115
121
|
methods: {
|
|
@@ -123,13 +129,17 @@ export default defineComponent({
|
|
|
123
129
|
this.showModal = true;
|
|
124
130
|
document.addEventListener("keydown", this.onKeyDown);
|
|
125
131
|
},
|
|
132
|
+
onModalOutsideClick() {
|
|
133
|
+
if (this.ignoreOutsideClick) return;
|
|
134
|
+
this.destroyModal();
|
|
135
|
+
},
|
|
126
136
|
destroyModal() {
|
|
127
137
|
if (this.isCloseOptionDisabled) return;
|
|
128
138
|
this.showModal = false;
|
|
129
139
|
document.removeEventListener("keydown", this.onKeyDown);
|
|
130
140
|
|
|
131
141
|
this.$emit("closemodal", true);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
134
144
|
});
|
|
135
145
|
</script>
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<table-container>
|
|
3
|
+
<table
|
|
4
|
+
class="table ac-info-table is-fullwidth"
|
|
5
|
+
:class="{ 'pl-0 pr-0': removeContentPadding }"
|
|
6
|
+
>
|
|
7
|
+
<tbody v-if="isFullTableLoaderActive">
|
|
8
|
+
<table-row v-for="i in loaderCols" :key="i">
|
|
9
|
+
<table-cell>
|
|
10
|
+
<cell-value :is-loader-active="true" />
|
|
11
|
+
</table-cell>
|
|
12
|
+
<table-cell>
|
|
13
|
+
<cell-value :is-loader-active="true" />
|
|
14
|
+
</table-cell>
|
|
15
|
+
</table-row>
|
|
16
|
+
</tbody>
|
|
17
|
+
<tbody
|
|
18
|
+
v-else
|
|
19
|
+
:class="{
|
|
20
|
+
'no-data-available has-text-centered p-10': isTableEmpty,
|
|
21
|
+
'pl-0 pr-0': removeContentPadding,
|
|
22
|
+
}"
|
|
23
|
+
>
|
|
24
|
+
<template v-if="!isTableEmpty">
|
|
25
|
+
<table-row
|
|
26
|
+
v-for="(tableHeader, idx) in tableHeaders"
|
|
27
|
+
:key="headerLabels[idx]"
|
|
28
|
+
>
|
|
29
|
+
<table-cell>
|
|
30
|
+
<slot :name="`table-cell-icon-${idx}`" />
|
|
31
|
+
{{ headerLabels[idx] }}
|
|
32
|
+
</table-cell>
|
|
33
|
+
<table-cell v-if="isLoaderActive">
|
|
34
|
+
<cell-value :is-loader-active="true" />
|
|
35
|
+
</table-cell>
|
|
36
|
+
<slot v-else :name="`slot-${idx}`" />
|
|
37
|
+
</table-row>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<empty-table-info v-else />
|
|
41
|
+
</tbody>
|
|
42
|
+
</table>
|
|
43
|
+
|
|
44
|
+
<!-- pagination start -->
|
|
45
|
+
<slot name="table-pagination" />
|
|
46
|
+
<!-- pagination end -->
|
|
47
|
+
</table-container>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script>
|
|
51
|
+
import { defineComponent, defineAsyncComponent } from "vue";
|
|
52
|
+
|
|
53
|
+
export default defineComponent({
|
|
54
|
+
props: {
|
|
55
|
+
isLoaderActive: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
59
|
+
isTableEmpty: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: true,
|
|
62
|
+
},
|
|
63
|
+
tableHeaders: {
|
|
64
|
+
type: Array,
|
|
65
|
+
default: () => [],
|
|
66
|
+
},
|
|
67
|
+
removeContentPadding: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
components: {
|
|
74
|
+
TableContainer: defineAsyncComponent(() =>
|
|
75
|
+
import("../../v2/table/TableContainer.vue").then(
|
|
76
|
+
(module) => module.default
|
|
77
|
+
)
|
|
78
|
+
),
|
|
79
|
+
EmptyTableInfo: defineAsyncComponent(() =>
|
|
80
|
+
import("../../v2/table/EmptyTableInfo.vue").then(
|
|
81
|
+
(module) => module.default
|
|
82
|
+
)
|
|
83
|
+
),
|
|
84
|
+
TableRow: defineAsyncComponent(() =>
|
|
85
|
+
import("./TableRow.vue").then((module) => module.default)
|
|
86
|
+
),
|
|
87
|
+
TableCell: defineAsyncComponent(() =>
|
|
88
|
+
import("./TableCell.vue").then((module) => module.default)
|
|
89
|
+
),
|
|
90
|
+
CellValue: defineAsyncComponent(() =>
|
|
91
|
+
import("./table-cell/CellValue.vue").then((module) => module.default)
|
|
92
|
+
),
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
data() {
|
|
96
|
+
return {
|
|
97
|
+
loaderCols: 5,
|
|
98
|
+
headerSortables: [],
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
computed: {
|
|
103
|
+
isFullTableLoaderActive() {
|
|
104
|
+
return !this.tableHeaders.length;
|
|
105
|
+
},
|
|
106
|
+
headerLabels() {
|
|
107
|
+
return this.tableHeaders.map((th) =>
|
|
108
|
+
typeof th === "string" ? th : th?.name || "Label"
|
|
109
|
+
);
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
watch: {
|
|
114
|
+
tableHeaders: {
|
|
115
|
+
immediate: true,
|
|
116
|
+
handler(n) {
|
|
117
|
+
if (this.headerSortables.length === n.length) {
|
|
118
|
+
n.forEach((th, idx) => {
|
|
119
|
+
if (this.headerSortables[idx].enabled !== !!th?.sort?.enable) {
|
|
120
|
+
this.headerSortables[idx].enabled = !!th?.sort?.enable;
|
|
121
|
+
this.headerSortables[idx].mode = "";
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
} else {
|
|
125
|
+
this.headerSortables = n.map((th) => {
|
|
126
|
+
if (typeof th === "string") {
|
|
127
|
+
return {
|
|
128
|
+
enabled: false,
|
|
129
|
+
mode: "",
|
|
130
|
+
};
|
|
131
|
+
} else {
|
|
132
|
+
return {
|
|
133
|
+
enabled: !!th?.sort?.enable,
|
|
134
|
+
mode: "",
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<table-container>
|
|
2
|
+
<table-container ref="ac-table-container" @scroller="handleScroller">
|
|
3
3
|
<table
|
|
4
4
|
ref="ac-table"
|
|
5
5
|
class="table ac-table ac-striped"
|
|
@@ -140,12 +140,10 @@ export default defineComponent({
|
|
|
140
140
|
default: 1920,
|
|
141
141
|
},
|
|
142
142
|
},
|
|
143
|
-
emits: ["sort"],
|
|
143
|
+
emits: ["sort", "scroller"],
|
|
144
144
|
components: {
|
|
145
145
|
TableContainer: defineAsyncComponent(() =>
|
|
146
|
-
import("
|
|
147
|
-
(module) => module.default
|
|
148
|
-
)
|
|
146
|
+
import("./TableContainer.vue").then((module) => module.default)
|
|
149
147
|
),
|
|
150
148
|
TableRow: defineAsyncComponent(() =>
|
|
151
149
|
import("./TableRow.vue").then((module) => module.default)
|
|
@@ -222,7 +220,6 @@ export default defineComponent({
|
|
|
222
220
|
},
|
|
223
221
|
},
|
|
224
222
|
},
|
|
225
|
-
|
|
226
223
|
updated() {
|
|
227
224
|
this.$nextTick(() => {
|
|
228
225
|
this.onWindowResize();
|
|
@@ -230,6 +227,9 @@ export default defineComponent({
|
|
|
230
227
|
},
|
|
231
228
|
|
|
232
229
|
methods: {
|
|
230
|
+
handleScroller(value) {
|
|
231
|
+
this.$emit("scroller", value);
|
|
232
|
+
},
|
|
233
233
|
onWindowResize() {
|
|
234
234
|
if (this.$refs["ac-table"] && this.isDynamicWidthTable) {
|
|
235
235
|
const tableWidth = this.$refs["ac-table"].clientWidth;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ac-table-container table-container" ref="tableContainer">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { emit } from 'process'
|
|
9
|
+
import { defineComponent, ref, onMounted, nextTick } from 'vue'
|
|
10
|
+
|
|
11
|
+
export default defineComponent({
|
|
12
|
+
emits: ['scroller'],
|
|
13
|
+
|
|
14
|
+
setup(props, { emit }) {
|
|
15
|
+
const tableContainer = ref(null)
|
|
16
|
+
|
|
17
|
+
function isScrollerShowing() {
|
|
18
|
+
return tableContainer.value.scrollWidth > tableContainer.value.clientWidth
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
onMounted(() => {
|
|
22
|
+
setTimeout(() => {
|
|
23
|
+
nextTick(() => {
|
|
24
|
+
emit('scroller', isScrollerShowing())
|
|
25
|
+
})
|
|
26
|
+
}, 50)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
tableContainer,
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
</script>
|