@appscode/design-system 1.0.43-alpha.121 → 1.0.43-alpha.124

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.121",
3
+ "version": "1.0.43-alpha.124",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -10,7 +10,9 @@
10
10
  <ac-button
11
11
  modifier-classes="is-square is-primary"
12
12
  icon-class="copy"
13
- v-clipboard:copy="`${editorTitle}: &quot;${editorContent}&quot;`"
13
+ v-clipboard:copy="
14
+ `${editorTitle}: ${JSON.stringify(parsedContent, null, 4)}`
15
+ "
14
16
  v-clipboard:success="onCopy"
15
17
  v-clipboard:error="onError"
16
18
  />
@@ -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,7 @@
7
7
  :secondaryColor="secondaryColor"
8
8
  />
9
9
  </div>
10
- <div v-else class="haha" ref="cellDiv">
10
+ <div v-else ref="cellDiv">
11
11
  <object-cell
12
12
  v-if="valueType === 'object'"
13
13
  :obj="value"
@@ -65,7 +65,8 @@ export default {
65
65
  computed: {
66
66
  valueType() {
67
67
  if (typeof this.value === "object") {
68
- if (Array.isArray(this.value)) return "array";
68
+ if (this.value === null) return "null";
69
+ else if (Array.isArray(this.value)) return "array";
69
70
  else return "object";
70
71
  } else return typeof this.value;
71
72
  },
@@ -68,7 +68,10 @@ export default {
68
68
  },
69
69
  printableStringObjs() {
70
70
  return this.objKeys.map((key) => {
71
- const value = this.obj[key];
71
+ let value = this.obj[key];
72
+ if (typeof value === "object" && value !== null) {
73
+ value = JSON.stringify(value);
74
+ }
72
75
  const keyValue = `${key}: ${value}`;
73
76
  const exceededLength = keyValue.length > 30;
74
77
  const print = exceededLength ? key : keyValue;
@@ -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>
@@ -10,7 +10,9 @@
10
10
  <ac-button
11
11
  modifier-classes="is-square is-primary"
12
12
  icon-class="copy"
13
- v-clipboard:copy="`${editorTitle}: &quot;${editorContent}&quot;`"
13
+ v-clipboard:copy="
14
+ `${editorTitle}: ${JSON.stringify(parsedContent, null, 4)}`
15
+ "
14
16
  v-clipboard:success="onCopy"
15
17
  v-clipboard:error="onError"
16
18
  />
@@ -8,7 +8,7 @@
8
8
  :secondaryColor="secondaryColor"
9
9
  />
10
10
  </div>
11
- <div v-else class="haha" ref="cellDiv">
11
+ <div v-else ref="cellDiv">
12
12
  <object-cell
13
13
  v-if="valueType === 'object'"
14
14
  :obj="value"
@@ -72,7 +72,8 @@ export default defineComponent({
72
72
  computed: {
73
73
  valueType() {
74
74
  if (typeof this.value === "object") {
75
- if (Array.isArray(this.value)) return "array";
75
+ if (this.value === null) return "null";
76
+ else if (Array.isArray(this.value)) return "array";
76
77
  else return "object";
77
78
  } else return typeof this.value;
78
79
  },
@@ -79,7 +79,10 @@ export default defineComponent({
79
79
  },
80
80
  printableStringObjs() {
81
81
  return this.objKeys.map((key) => {
82
- const value = this.obj[key];
82
+ let value = this.obj[key];
83
+ if (typeof value === "object" && value !== null) {
84
+ value = JSON.stringify(value);
85
+ }
83
86
  const keyValue = `${key}: ${value}`;
84
87
  const exceededLength = keyValue.length > 30;
85
88
  const print = exceededLength ? key : keyValue;
@@ -103,3 +106,4 @@ export default defineComponent({
103
106
  },
104
107
  });
105
108
  </script>
109
+