@appscode/design-system 1.0.43-alpha.120 → 1.0.43-alpha.123

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appscode/design-system",
3
- "version": "1.0.43-alpha.120",
3
+ "version": "1.0.43-alpha.123",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -37,7 +37,7 @@
37
37
  :original-value="activeFile.content"
38
38
  :language="activeFile.format"
39
39
  :read-only="isEditorReadOnly"
40
- :editor-height="60"
40
+ :editor-height="editorHeight"
41
41
  :show-minimap="showMinimap"
42
42
  />
43
43
  <span v-else> *************** </span>
@@ -80,6 +80,10 @@ export default {
80
80
  showMinimap: {
81
81
  type: Boolean,
82
82
  default: false
83
+ },
84
+ editorHeight: {
85
+ type: Number,
86
+ default: 60
83
87
  }
84
88
  },
85
89
  data() {
@@ -55,8 +55,9 @@
55
55
  :toggle-hide-value="toggleHideValue"
56
56
  :is-preview-loading="isPreviewLoading"
57
57
  :is-editor-read-only="isEditorReadOnly"
58
- :previewYamls="previewYamls"
59
- :showMinimap="showMinimap"
58
+ :preview-yamls="previewYamls"
59
+ :show-minimap="showMinimap"
60
+ :editor-height="editorHeight"
60
61
  @setActiveKey="setActiveKey"
61
62
  />
62
63
  </template>
@@ -114,6 +115,10 @@ export default {
114
115
  deleteModalStatus: {
115
116
  type: String,
116
117
  default: "closed"
118
+ },
119
+ editorHeight: {
120
+ type: Number,
121
+ default: 60
117
122
  }
118
123
  },
119
124
  data() {
@@ -10,7 +10,7 @@
10
10
  </span>
11
11
  </a>
12
12
 
13
- <ul :ref="title" :style="{ maxHeight: dropDownSectionHeight }">
13
+ <ul ref="sectionItems" :style="{ maxHeight: dropDownSectionHeight }">
14
14
  <slot />
15
15
  </ul>
16
16
  </li>
@@ -23,10 +23,6 @@ export default {
23
23
  type: Boolean,
24
24
  default: false,
25
25
  },
26
- isLoaderActive: {
27
- type: Boolean,
28
- default: false,
29
- },
30
26
  title: {
31
27
  type: String,
32
28
  default: "Sidebar Item",
@@ -41,27 +37,32 @@ export default {
41
37
  return {
42
38
  dropDownStatus: "close",
43
39
  dropDownSectionHeight: null,
40
+ isCompMounted: false,
44
41
  };
45
42
  },
46
43
 
47
- watch: {
48
- isLoaderActive(n) {
49
- if (!n) {
50
- this.$nextTick(() => {
51
- // for expanding dropdown
52
- this.setDropdownMaxHeight("open");
53
- });
44
+ mounted() {
45
+ this.isCompMounted = true;
46
+ setTimeout(() => {
47
+ // for expanding dropdown
48
+ if (this.isDropDownOpen) {
49
+ this.setDropdownMaxHeight("open");
50
+ } else {
51
+ this.setDropdownMaxHeight("close");
54
52
  }
55
- },
53
+ }, 700);
54
+ },
55
+
56
+ watch: {
56
57
  title(n, o) {
57
- if (n && !this.isLoaderActive) {
58
+ if (n && this.isCompMounted) {
58
59
  this.$nextTick(() => {
59
60
  // for expanding dropdown
60
61
  this.setDropdownMaxHeight("open");
61
62
  });
62
63
  }
63
64
 
64
- if (o && !this.isLoaderActive) {
65
+ if (o && this.isCompMounted) {
65
66
  this.$nextTick(() => {
66
67
  // for expanding dropdown
67
68
  this.setDropdownMaxHeight("close");
@@ -84,7 +85,7 @@ export default {
84
85
  this.$emit("dropDownItemChange");
85
86
 
86
87
  this.$nextTick(() => {
87
- const dropDownUl = this.$refs[this.title];
88
+ const dropDownUl = this.$refs["sectionItems"];
88
89
  if (dropDownUl)
89
90
  this.dropDownSectionHeight = `${dropDownUl.scrollHeight}px`;
90
91
  });
@@ -99,11 +100,9 @@ export default {
99
100
  methods: {
100
101
  setDropdownMaxHeight(mode) {
101
102
  if (mode === "open") {
102
- this.$refs[this.title][0].style.maxHeight = `${
103
- this.$refs[this.title][0].scrollHeight
104
- }px`;
103
+ this.dropDownSectionHeight = `${this.$refs["sectionItems"].scrollHeight}px`;
105
104
  } else {
106
- this.$refs[this.title][0].style.maxHeight = null;
105
+ this.dropDownSectionHeight = null;
107
106
  }
108
107
  },
109
108
  toggleDropDownStatus() {
@@ -7,7 +7,6 @@
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`"
@@ -16,12 +15,12 @@
16
15
  :language="language"
17
16
  :options="{
18
17
  minimap: {
19
- enabled: calcShowMinimap
18
+ enabled: calcShowMinimap,
20
19
  },
21
20
  theme: theme,
22
21
  readOnly: readOnly,
23
22
  wordWrap: wordWrap,
24
- scrollBeyondLastLine: false
23
+ scrollBeyondLastLine: false,
25
24
  }"
26
25
  />
27
26
  <monaco-editor
@@ -32,12 +31,12 @@
32
31
  :language="language"
33
32
  :options="{
34
33
  minimap: {
35
- enabled: calcShowMinimap
34
+ enabled: calcShowMinimap,
36
35
  },
37
36
  theme: theme,
38
37
  readOnly: true,
39
38
  wordWrap: wordWrap,
40
- scrollBeyondLastLine: false
39
+ scrollBeyondLastLine: false,
41
40
  }"
42
41
  :original="originalEditorContent"
43
42
  :diff-editor="true"
@@ -51,35 +50,35 @@ export default defineComponent({
51
50
  props: {
52
51
  value: {
53
52
  type: String,
54
- default: ""
53
+ default: "",
55
54
  },
56
55
  originalValue: {
57
56
  type: String,
58
- default: ""
57
+ default: "",
59
58
  },
60
59
  readOnly: {
61
60
  type: Boolean,
62
- default: false
61
+ default: false,
63
62
  },
64
63
  language: {
65
64
  type: String,
66
- default: "yaml"
65
+ default: "yaml",
67
66
  },
68
67
  showMinimap: {
69
68
  type: Boolean,
70
- default: true
69
+ default: true,
71
70
  },
72
71
  editorHeight: {
73
72
  type: Number,
74
- default: 40
73
+ default: 40,
75
74
  },
76
75
  editorTheme: {
77
76
  type: String,
78
- default: ""
77
+ default: "",
79
78
  },
80
79
  wordWrap: {
81
80
  type: String,
82
- default: "off"
81
+ default: "off",
83
82
  },
84
83
  },
85
84
 
@@ -87,23 +86,18 @@ export default defineComponent({
87
86
 
88
87
  components: {
89
88
  EditorTabs: defineAsyncComponent(() =>
90
- import("../tabs/EditorTabs.vue").then(module => module.default)
89
+ import("../tabs/EditorTabs.vue").then((module) => module.default)
91
90
  ),
92
91
  MonacoEditor: defineAsyncComponent(() =>
93
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
94
- // @ts-ignore
95
- import("vue-monaco").then(module => {
96
- module.default.render = () => h("div");
97
- return module.default;
98
- })
99
- )
92
+ import("monaco-editor-vue3").then((module) => module.default)
93
+ ),
100
94
  },
101
95
 
102
96
  data() {
103
97
  return {
104
98
  activeTab: "edit",
105
99
  editorContent: "",
106
- originalEditorContent: ""
100
+ originalEditorContent: "",
107
101
  };
108
102
  },
109
103
 
@@ -119,7 +113,7 @@ export default defineComponent({
119
113
  ? "vs-dark"
120
114
  : "vs")
121
115
  );
122
- }
116
+ },
123
117
  },
124
118
 
125
119
  watch: {
@@ -129,7 +123,7 @@ export default defineComponent({
129
123
  if (this.editorContent !== n) {
130
124
  this.editorContent = n;
131
125
  }
132
- }
126
+ },
133
127
  },
134
128
  originalValue: {
135
129
  immediate: true,
@@ -137,21 +131,20 @@ export default defineComponent({
137
131
  if (this.originalEditorContent !== n) {
138
132
  this.originalEditorContent = n;
139
133
  }
140
- }
141
- }
134
+ },
135
+ },
142
136
  },
143
137
 
144
138
  methods: {
145
139
  onChange(e) {
146
140
  if (typeof e === "string") this.editorContent = e;
147
141
  },
148
- onEditorMount() {
149
- const editor = this.$refs.monacoEditor.getEditor();
142
+ onEditorMount(editor) {
150
143
  // add event listeners
151
144
  editor.onDidBlurEditorText(() => {
152
145
  this.$emit("update:modelValue", this.editorContent);
153
146
  });
154
- }
155
- }
147
+ },
148
+ },
156
149
  });
157
150
  </script>