@appscode/design-system 1.0.3-alpha.8 → 1.0.43-alpha.101

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.
Files changed (114) hide show
  1. package/base/utilities/_default.scss +285 -23
  2. package/base/utilities/_derived-variables.scss +2 -15
  3. package/base/utilities/_initial-variables.scss +99 -64
  4. package/base/utilities/_mixin.scss +90 -10
  5. package/base/utilities/_typography.scss +23 -7
  6. package/base/utilities/dark-theme.scss +25 -0
  7. package/components/_ac-accordion.scss +1 -0
  8. package/components/_ac-alert-box.scss +47 -11
  9. package/components/_ac-card.scss +55 -20
  10. package/components/_ac-code-highlight.scss +7 -1
  11. package/components/_ac-content-layout.scss +4 -4
  12. package/components/_ac-drag.scss +6 -6
  13. package/components/_ac-input.scss +140 -38
  14. package/components/_ac-modal.scss +5 -4
  15. package/components/_ac-multi-select.scss +220 -18
  16. package/components/_ac-options.scss +31 -16
  17. package/components/_ac-select-box.scss +15 -5
  18. package/components/_ac-table.scss +88 -47
  19. package/components/_ac-tabs.scss +72 -23
  20. package/components/_ac-tags.scss +2 -2
  21. package/components/_ac-terminal.scss +272 -0
  22. package/components/_app-drawer.scss +6 -6
  23. package/components/_breadcumb.scss +8 -3
  24. package/components/_buttons.scss +86 -33
  25. package/components/_card-body-wrapper.scss +3 -3
  26. package/components/_dashboard-header.scss +1 -1
  27. package/components/_direct-deploy.scss +69 -0
  28. package/components/_go-to-top.scss +1 -1
  29. package/components/_graph.scss +45 -0
  30. package/components/_image-upload.scss +6 -4
  31. package/components/_left-sidebar-menu.scss +206 -46
  32. package/components/_monaco-editor.scss +1 -1
  33. package/components/_navbar.scss +104 -27
  34. package/components/_overview-info.scss +4 -4
  35. package/components/_overview-page.scss +1 -2
  36. package/components/_pagination.scss +45 -7
  37. package/components/_payment-card.scss +28 -12
  38. package/components/_preloader.scss +1 -1
  39. package/components/_preview-modal.scss +8 -8
  40. package/components/_pricing-table.scss +1 -1
  41. package/components/_progress-bar.scss +5 -5
  42. package/components/_subscription-card.scss +15 -8
  43. package/components/_table-of-content.scss +1 -1
  44. package/components/_tfa.scss +69 -0
  45. package/components/_widget-menu.scss +9 -9
  46. package/components/_wizard.scss +32 -20
  47. package/components/ac-toaster/_ac-toasted.scss +40 -8
  48. package/components/bbum/_card-team.scss +18 -10
  49. package/components/bbum/_information-center.scss +19 -5
  50. package/components/bbum/_mobile-desktop.scss +6 -6
  51. package/components/bbum/_post.scss +5 -4
  52. package/components/bbum/_sign-up-notification.scss +6 -6
  53. package/components/bbum/_single-post-preview.scss +9 -9
  54. package/components/bbum/_user-profile.scss +97 -90
  55. package/components/ui-builder/_ui-builder.scss +31 -12
  56. package/components/ui-builder/_vue-open-api.scss +98 -0
  57. package/layouts/_404.scss +2 -1
  58. package/layouts/_code-preview.scss +14 -6
  59. package/main.scss +4 -0
  60. package/package.json +2 -7
  61. package/plugins/theme.js +142 -0
  62. package/plugins/vue-toaster.js +7 -6
  63. package/vue-components/v2/breadcrumbs/Breadcrumb.vue +95 -0
  64. package/vue-components/v2/card/CardContent.vue +5 -0
  65. package/vue-components/v2/card/CardHeader.vue +12 -0
  66. package/vue-components/v2/card/OverviewCard.vue +10 -0
  67. package/vue-components/v2/card/OverviewCards.vue +5 -0
  68. package/vue-components/v2/card/PaymentCards.vue +16 -10
  69. package/vue-components/v2/content/ContentHeader.vue +1 -1
  70. package/vue-components/v2/editor/Editor.vue +37 -17
  71. package/vue-components/v2/editor/ResourceKeyValueEditor.vue +232 -0
  72. package/vue-components/v2/header/Header.vue +0 -1
  73. package/vue-components/v2/modal/Modal.vue +32 -14
  74. package/vue-components/v2/modals/JsonShowModal.vue +0 -1
  75. package/vue-components/v2/navbar/Appdrawer.vue +9 -6
  76. package/vue-components/v2/navbar/ThemeMode.vue +120 -0
  77. package/vue-components/v2/pagination/Pagination.vue +8 -1
  78. package/vue-components/v2/preloader/Preloader.vue +5 -5
  79. package/vue-components/v2/sidebar/ClusterSwitcher.vue +126 -0
  80. package/vue-components/v2/sidebar/SidebarItem.vue +24 -2
  81. package/vue-components/v2/table/InfoTable.vue +13 -3
  82. package/vue-components/v2/table/Table.vue +75 -5
  83. package/vue-components/v2/table/TableRow.vue +17 -8
  84. package/vue-components/v2/table/table-cell/CellValue.vue +10 -1
  85. package/vue-components/v2/tabs/EditorTabs.vue +1 -1
  86. package/vue-components/v3/button/Button.vue +73 -0
  87. package/vue-components/v3/content/ContentHeader.vue +54 -0
  88. package/vue-components/v3/content/ContentTable.vue +65 -0
  89. package/vue-components/v3/dropdown/DropdownDivider.vue +3 -0
  90. package/vue-components/v3/dropdown/DropdownItem.vue +5 -0
  91. package/vue-components/v3/dropdown/DropdownMenu.vue +111 -0
  92. package/vue-components/v3/editor/Editor.vue +157 -0
  93. package/vue-components/v3/form-fields/Input.vue +21 -0
  94. package/vue-components/v3/header/Header.vue +45 -0
  95. package/vue-components/v3/modal/Modal.vue +135 -0
  96. package/vue-components/v3/modals/JsonShowModal.vue +87 -0
  97. package/vue-components/v3/navbar/Appdrawer.vue +63 -0
  98. package/vue-components/v3/navbar/ThemeMode.vue +128 -0
  99. package/vue-components/v3/navbar/User.vue +64 -0
  100. package/vue-components/v3/pagination/Pagination.vue +159 -0
  101. package/vue-components/v3/searchbars/SearchBar.vue +47 -0
  102. package/vue-components/v3/sidebar/ClusterSwitcher.vue +133 -0
  103. package/vue-components/v3/tab/TabItem.vue +17 -0
  104. package/vue-components/v3/table/FakeTableCell.vue +39 -0
  105. package/vue-components/v3/table/InfoTable.vue +105 -0
  106. package/vue-components/v3/table/Table.vue +238 -0
  107. package/vue-components/v3/table/TableCell.vue +28 -0
  108. package/vue-components/v3/table/TableRow.vue +60 -0
  109. package/vue-components/v3/table/table-cell/ArrayCell.vue +111 -0
  110. package/vue-components/v3/table/table-cell/CellValue.vue +117 -0
  111. package/vue-components/v3/table/table-cell/ObjectCell.vue +105 -0
  112. package/vue-components/v3/table/table-cell/ValueWithModal.vue +43 -0
  113. package/vue-components/v3/tabs/EditorTabs.vue +36 -0
  114. package/vue-components/v3/tag/Tag.vue +17 -0
@@ -0,0 +1,238 @@
1
+ <template>
2
+ <table-container>
3
+ <table
4
+ ref="ac-table"
5
+ class="table ac-table ac-striped"
6
+ :class="{
7
+ 'is-fullwidth':
8
+ !isDynamicWidthTable ||
9
+ isFullTableLoaderActive ||
10
+ isTableEmpty ||
11
+ isLoaderActive,
12
+ }"
13
+ >
14
+ <thead>
15
+ <table-row v-if="isFullTableLoaderActive">
16
+ <th v-for="i in loaderCols" :key="i">
17
+ <cell-value :is-loader-active="true" />
18
+ </th>
19
+ </table-row>
20
+ <table-row v-else>
21
+ <th
22
+ v-for="(tableHeader, idx) in tableHeaders"
23
+ :key="idx"
24
+ :class="{
25
+ sorting: headerSortables[idx].enabled,
26
+ 'sorting-desc': headerSortables[idx].mode === 'desc',
27
+ 'sorting-asc': headerSortables[idx].mode === 'asc',
28
+ }"
29
+ @click.prevent="headerSortables[idx].enabled && emitSortEvent(idx)"
30
+ >
31
+ {{ headerLabels[idx] }}
32
+ </th>
33
+ <th
34
+ ref="action-section"
35
+ v-if="actionable"
36
+ style="min-width: 100px"
37
+ ></th>
38
+ <fake-table-cell
39
+ v-if="fakeCellWidth > 0"
40
+ :is-header-cell="true"
41
+ :fake-cell-width="fakeCellWidth"
42
+ />
43
+ </table-row>
44
+ </thead>
45
+ <!-- table row loaders -->
46
+ <tbody v-if="isFullTableLoaderActive || isLoaderActive">
47
+ <table-row v-if="isFullTableLoaderActive">
48
+ <th v-for="i in loaderCols" :key="i">
49
+ <cell-value :is-loader-active="true" />
50
+ </th>
51
+ </table-row>
52
+ <table-row v-else>
53
+ <table-cell
54
+ v-for="(tableHeader, idx) in tableHeaders"
55
+ :key="headerLabels[idx]"
56
+ >
57
+ <cell-value
58
+ :is-loader-active="true"
59
+ :cell-title="headerLabels[idx]"
60
+ />
61
+ </table-cell>
62
+ </table-row>
63
+ </tbody>
64
+ <!-- table row loaders -->
65
+ <template v-else>
66
+ <tbody v-if="!isTableEmpty">
67
+ <!-- table rows -->
68
+ <slot :fake-cell-width="fakeCellWidth" />
69
+ </tbody>
70
+ <tbody v-else>
71
+ <table-row class="is-hoverless">
72
+ <table-cell
73
+ :colspan="
74
+ actionable ? tableHeaders.length + 1 : tableHeaders.length
75
+ "
76
+ class="no-data-available has-text-centered"
77
+ >
78
+ <empty-table-info />
79
+ </table-cell>
80
+ </table-row>
81
+ </tbody>
82
+ </template>
83
+ </table>
84
+ <!-- pagination start -->
85
+ <slot name="table-pagination" />
86
+ <!-- pagination end -->
87
+ </table-container>
88
+ </template>
89
+
90
+ <script>
91
+ import { defineComponent, defineAsyncComponent } from "vue";
92
+
93
+ export default defineComponent({
94
+ props: {
95
+ isLoaderActive: {
96
+ type: Boolean,
97
+ default: false,
98
+ },
99
+ isTableEmpty: {
100
+ type: Boolean,
101
+ default: true,
102
+ },
103
+ tableHeaders: {
104
+ type: Array,
105
+ default: () => [],
106
+ },
107
+ actionable: {
108
+ type: Boolean,
109
+ default: false,
110
+ },
111
+ isDynamicWidthTable: {
112
+ type: Boolean,
113
+ default: false,
114
+ },
115
+ fullWidth: {
116
+ type: Number,
117
+ default: 1920,
118
+ },
119
+ },
120
+ emits: ["sort"],
121
+ components: {
122
+ TableContainer: defineAsyncComponent(() =>
123
+ import("../../v2/table/TableContainer.vue").then(
124
+ (module) => module.default
125
+ )
126
+ ),
127
+ TableRow: defineAsyncComponent(() =>
128
+ import("./TableRow.vue").then((module) => module.default)
129
+ ),
130
+ TableCell: defineAsyncComponent(() =>
131
+ import("./TableCell.vue").then((module) => module.default)
132
+ ),
133
+ CellValue: defineAsyncComponent(() =>
134
+ import("./table-cell/CellValue.vue").then((module) => module.default)
135
+ ),
136
+ EmptyTableInfo: defineAsyncComponent(() =>
137
+ import("../../v2/table/EmptyTableInfo.vue").then(
138
+ (module) => module.default
139
+ )
140
+ ),
141
+ FakeTableCell: defineAsyncComponent(() =>
142
+ import("./FakeTableCell.vue").then((module) => module.default)
143
+ ),
144
+ },
145
+
146
+ data() {
147
+ return {
148
+ fakeCellWidth: 0,
149
+ headerSortables: [],
150
+ };
151
+ },
152
+
153
+ computed: {
154
+ loaderCols() {
155
+ if (this.isFullTableLoaderActive) {
156
+ return 5;
157
+ } else if (this.isLoaderActive) {
158
+ return Math.max(this.tableHeaders.length + 1, 5);
159
+ } else {
160
+ return this.tableHeaders.length || 5;
161
+ }
162
+ },
163
+ isFullTableLoaderActive() {
164
+ return !this.tableHeaders.length;
165
+ },
166
+ headerLabels() {
167
+ return this.tableHeaders.map((th) =>
168
+ typeof th === "string" ? th : th?.label || "Label"
169
+ );
170
+ },
171
+ },
172
+
173
+ watch: {
174
+ tableHeaders: {
175
+ immediate: true,
176
+ handler(n) {
177
+ if (this.headerSortables.length === n.length) {
178
+ n.forEach((th, idx) => {
179
+ if (this.headerSortables[idx].enabled !== !!th?.sortable) {
180
+ this.headerSortables[idx].enabled = !!th?.sortable;
181
+ this.headerSortables[idx].mode = "";
182
+ }
183
+ });
184
+ } else {
185
+ this.headerSortables = n.map((th) => {
186
+ if (typeof th === "string") {
187
+ return {
188
+ enabled: false,
189
+ mode: "",
190
+ };
191
+ } else {
192
+ return {
193
+ enabled: !!th?.sortable,
194
+ mode: "",
195
+ };
196
+ }
197
+ });
198
+ }
199
+ },
200
+ },
201
+ },
202
+
203
+ updated() {
204
+ this.$nextTick(() => {
205
+ this.onWindowResize();
206
+ });
207
+ },
208
+
209
+ methods: {
210
+ onWindowResize() {
211
+ if (this.$refs["ac-table"] && this.isDynamicWidthTable) {
212
+ const tableWidth = this.$refs["ac-table"].clientWidth;
213
+ const d = this.fullWidth - tableWidth;
214
+ this.fakeCellWidth = d;
215
+ }
216
+ },
217
+ emitSortEvent(index) {
218
+ const emitValue = {
219
+ index,
220
+ label: this.tableHeaders[index].label,
221
+ mode: "",
222
+ };
223
+
224
+ this.headerSortables.forEach((hs, idx) => {
225
+ if (idx !== index) hs.mode = "";
226
+ else {
227
+ if (hs.mode === "asc") hs.mode = "desc";
228
+ else hs.mode = "asc";
229
+
230
+ emitValue.mode = hs.mode;
231
+ }
232
+ });
233
+
234
+ this.$emit("sort", emitValue);
235
+ },
236
+ },
237
+ });
238
+ </script>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <td :style="styleOb">
3
+ <slot />
4
+ </td>
5
+ </template>
6
+
7
+ <script>
8
+ import { defineComponent } from "vue";
9
+
10
+ export default defineComponent({
11
+ props: {
12
+ cellWidth: {
13
+ type: Number,
14
+ default: null,
15
+ },
16
+ },
17
+
18
+ computed: {
19
+ styleOb() {
20
+ const ob = {};
21
+ if (this.cellWidth) {
22
+ ob.width = `${this.cellWidth}px`;
23
+ }
24
+ return ob || {};
25
+ },
26
+ },
27
+ });
28
+ </script>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <router-link
3
+ v-if="link"
4
+ event="click"
5
+ :to="link"
6
+ custom
7
+ v-slot="{ navigate }"
8
+ >
9
+ <tr class="is-link" @click="navigate" v-bind="$attrs">
10
+ <slot />
11
+ <fake-table-cell
12
+ v-if="fakeCellWidth > 0"
13
+ :fake-cell-width="fakeCellWidth"
14
+ />
15
+ </tr>
16
+ </router-link>
17
+ <tr
18
+ v-else
19
+ :class="{ 'is-selected': isSelected, 'is-hoverless': !isSelected }"
20
+ @click.prevent="$emit('rowselect', true)"
21
+ >
22
+ <slot />
23
+ <fake-table-cell
24
+ v-if="fakeCellWidth > 0"
25
+ :fake-cell-width="fakeCellWidth"
26
+ />
27
+ </tr>
28
+ </template>
29
+
30
+ <script>
31
+ import { defineComponent, defineAsyncComponent } from "vue";
32
+
33
+ export default defineComponent({
34
+ props: {
35
+ link: {
36
+ type: String,
37
+ default: "",
38
+ },
39
+ isSelected: {
40
+ type: Boolean,
41
+ default: false,
42
+ },
43
+ fakeCellWidth: {
44
+ type: Number,
45
+ default: 0,
46
+ },
47
+ },
48
+
49
+ emits: ["rowselect"],
50
+
51
+ components: {
52
+ TableCell: defineAsyncComponent(() =>
53
+ import("./TableCell.vue").then((module) => module.default)
54
+ ),
55
+ FakeTableCell: defineAsyncComponent(() =>
56
+ import("./FakeTableCell.vue").then((module) => module.default)
57
+ ),
58
+ },
59
+ });
60
+ </script>
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <tags v-if="printableStringObjs.length">
3
+ <tag
4
+ v-for="(printableStringOb, idx) in printableStringObjs.slice(
5
+ 0,
6
+ indexOfCharacterLengthExceed
7
+ )"
8
+ :key="`${printableStringOb.print}-${idx}`"
9
+ >
10
+ <value-with-modal
11
+ v-if="printableStringOb.exceededLength"
12
+ :title="`${cellTitle}: ${idx}`"
13
+ :value="printableStringOb.value"
14
+ :print="printableStringOb.print"
15
+ />
16
+ <template v-else> {{ printableStringOb.print }} </template>
17
+ </tag>
18
+
19
+ <tag v-if="indexOfCharacterLengthExceed !== printableStringObjs.length">
20
+ <a @click.prevent.stop="showFullData = true">
21
+ <ellipsis-icon />
22
+ <json-show-modal
23
+ :open="showFullData"
24
+ @closemodal="showFullData = false"
25
+ :editor-title="cellTitle"
26
+ :editor-content="items"
27
+ />
28
+ </a>
29
+ </tag>
30
+ </tags>
31
+ <p v-else>-</p>
32
+ </template>
33
+
34
+ <script>
35
+ import { defineComponent, defineAsyncComponent } from "vue";
36
+
37
+ export default defineComponent({
38
+ props: {
39
+ cellTitle: {
40
+ type: String,
41
+ default: "Array",
42
+ },
43
+ items: {
44
+ type: Array,
45
+ default: () => [],
46
+ },
47
+ maxCharacterLength: {
48
+ type: Number,
49
+ default: undefined,
50
+ },
51
+ },
52
+ components: {
53
+ Tags: defineAsyncComponent(() =>
54
+ import("../../../v2/tag/Tags.vue").then((module) => module.default)
55
+ ),
56
+ Tag: defineAsyncComponent(() =>
57
+ import("../../tag/Tag.vue").then((module) => module.default)
58
+ ),
59
+ EllipsisIcon: defineAsyncComponent(() =>
60
+ import("../../../v2/icons/Ellipsis.vue").then((module) => module.default)
61
+ ),
62
+ JsonShowModal: defineAsyncComponent(() =>
63
+ import("../../modals/JsonShowModal.vue").then((module) => module.default)
64
+ ),
65
+ ValueWithModal: defineAsyncComponent(() =>
66
+ import("./ValueWithModal.vue").then((module) => module.default)
67
+ ),
68
+ },
69
+
70
+ data() {
71
+ return {
72
+ showFullData: false,
73
+ };
74
+ },
75
+
76
+ computed: {
77
+ printableStringObjs() {
78
+ return this.items.map((item) => {
79
+ const value = item;
80
+ let exceededLength = false;
81
+ let print = item;
82
+ if (typeof item === "object") {
83
+ exceededLength = true;
84
+ print = item["Name"] || item["name"] || item[Object.keys(item)[0]];
85
+ } else {
86
+ const stringifiedValue = JSON.stringify(item);
87
+ exceededLength = stringifiedValue.length > 27;
88
+ print = exceededLength
89
+ ? `${stringifiedValue.slice(0, 27)}...`
90
+ : stringifiedValue;
91
+ }
92
+ return { value, exceededLength, print };
93
+ });
94
+ },
95
+ indexOfCharacterLengthExceed() {
96
+ let idx = -1;
97
+ let cumulativeLen = 0;
98
+ for (const [index, po] of this.printableStringObjs.entries()) {
99
+ const newLen = cumulativeLen + po.print.length;
100
+ if (newLen > this.maxCharacterLength) {
101
+ idx = index;
102
+ break;
103
+ }
104
+ cumulativeLen = newLen;
105
+ }
106
+
107
+ return idx === -1 ? this.printableStringObjs.length : idx;
108
+ },
109
+ },
110
+ });
111
+ </script>
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <div v-if="isLoaderActive" ref="cellLoaderDiv" :style="{ maxWidth: '300px' }">
3
+ <content-loader
4
+ :view-box="`0 0 ${computedCellWidth || 300} 10`"
5
+ :speed="2"
6
+ :key="computedCellWidth"
7
+ :primaryColor="primaryColor"
8
+ :secondaryColor="secondaryColor"
9
+ />
10
+ </div>
11
+ <div v-else class="haha" ref="cellDiv">
12
+ <object-cell
13
+ v-if="valueType === 'object'"
14
+ :obj="value"
15
+ :cell-title="cellTitle"
16
+ :max-character-length="maxCharacterLength"
17
+ />
18
+ <array-cell
19
+ v-else-if="valueType === 'array'"
20
+ :items="value"
21
+ :cell-title="cellTitle"
22
+ :max-character-length="maxCharacterLength"
23
+ />
24
+ <template v-else>
25
+ <span class="is-ellipsis-1" :title="value">{{
26
+ value || (value === 0 ? 0 : "-")
27
+ }}</span>
28
+ </template>
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+ import { defineComponent, defineAsyncComponent } from "vue";
34
+ import { loaderLightThemePrimaryColor, loaderDarkThemePrimaryColor, loaderLightThemeSecondaryColor, loaderDarkThemeSecondaryColor } from "@appscode/design-system/plugins/theme";
35
+
36
+ export default defineComponent({
37
+ props: {
38
+ isLoaderActive: {
39
+ type: Boolean,
40
+ default: false,
41
+ },
42
+ cellTitle: {
43
+ type: String,
44
+ default: "Cell",
45
+ },
46
+ value: {
47
+ type: null,
48
+ default: "",
49
+ },
50
+ },
51
+ components: {
52
+ ContentLoader: defineAsyncComponent(() =>
53
+ import("vue-content-loader").then(({ ContentLoader }) => ContentLoader)
54
+ ),
55
+ ObjectCell: defineAsyncComponent(() =>
56
+ import("./ObjectCell.vue").then((module) => module.default)
57
+ ),
58
+ ArrayCell: defineAsyncComponent(() =>
59
+ import("./ArrayCell.vue").then((module) => module.default)
60
+ ),
61
+ },
62
+
63
+ computed: {
64
+ valueType() {
65
+ if (typeof this.value === "object") {
66
+ if (Array.isArray(this.value)) return "array";
67
+ else return "object";
68
+ } else return typeof this.value;
69
+ },
70
+ maxCharacterLength() {
71
+ return Math.ceil(this.computedCellWidth / 8);
72
+ },
73
+ primaryColor() {
74
+ return document.documentElement.classList.contains("is-dark-theme") ? loaderDarkThemePrimaryColor : loaderLightThemePrimaryColor;
75
+ },
76
+ secondaryColor() {
77
+ return document.documentElement.classList.contains("is-dark-theme") ? loaderDarkThemeSecondaryColor : loaderLightThemeSecondaryColor;
78
+ }
79
+ },
80
+
81
+ data() {
82
+ return {
83
+ computedCellWidth: null,
84
+ };
85
+ },
86
+
87
+ mounted() {
88
+ this.calcCellWidth();
89
+ },
90
+
91
+ watch: {
92
+ isLoaderActive() {
93
+ this.calcCellWidth();
94
+ },
95
+ },
96
+
97
+ methods: {
98
+ calcCellWidth() {
99
+ if (this.isLoaderActive) {
100
+ this.$nextTick(() => {
101
+ const cellLoaderDiv = this.$refs.cellLoaderDiv;
102
+ if (cellLoaderDiv) {
103
+ this.computedCellWidth = cellLoaderDiv.offsetWidth;
104
+ }
105
+ });
106
+ } else {
107
+ this.$nextTick(() => {
108
+ const cellDiv = this.$refs.cellDiv;
109
+ if (cellDiv) {
110
+ this.computedCellWidth = cellDiv.offsetWidth;
111
+ }
112
+ });
113
+ }
114
+ },
115
+ },
116
+ });
117
+ </script>
@@ -0,0 +1,105 @@
1
+ <template>
2
+ <tags v-if="printableStringObjs.length">
3
+ <tag
4
+ v-for="printableStringOb in printableStringObjs.slice(
5
+ 0,
6
+ indexOfCharacterLengthExceed
7
+ )"
8
+ :key="printableStringOb.key"
9
+ >
10
+ <value-with-modal
11
+ v-if="printableStringOb.exceededLength"
12
+ :title="printableStringOb.key"
13
+ :value="printableStringOb.value"
14
+ :print="printableStringOb.print"
15
+ />
16
+ <template v-else> {{ printableStringOb.print }} </template>
17
+ </tag>
18
+
19
+ <tag v-if="indexOfCharacterLengthExceed !== printableStringObjs.length">
20
+ <a @click.prevent.stop="showFullData = true">
21
+ <ellipsis-icon />
22
+ <json-show-modal
23
+ :open="showFullData"
24
+ @closemodal="showFullData = false"
25
+ :editor-title="cellTitle"
26
+ :editor-content="obj"
27
+ />
28
+ </a>
29
+ </tag>
30
+ </tags>
31
+ <p v-else>-</p>
32
+ </template>
33
+
34
+ <script>
35
+ import { defineComponent, defineAsyncComponent } from "vue";
36
+
37
+ export default defineComponent({
38
+ props: {
39
+ cellTitle: {
40
+ type: String,
41
+ default: "Object",
42
+ },
43
+ obj: {
44
+ type: Object,
45
+ default: () => ({}),
46
+ },
47
+ maxCharacterLength: {
48
+ type: Number,
49
+ default: undefined,
50
+ },
51
+ },
52
+ components: {
53
+ Tags: defineAsyncComponent(() =>
54
+ import("../../../v2/tag/Tags.vue").then((module) => module.default)
55
+ ),
56
+ Tag: defineAsyncComponent(() =>
57
+ import("../../tag/Tag.vue").then((module) => module.default)
58
+ ),
59
+ EllipsisIcon: defineAsyncComponent(() =>
60
+ import("../../../v2/icons/Ellipsis.vue").then((module) => module.default)
61
+ ),
62
+ JsonShowModal: defineAsyncComponent(() =>
63
+ import("../../modals/JsonShowModal.vue").then((module) => module.default)
64
+ ),
65
+ ValueWithModal: defineAsyncComponent(() =>
66
+ import("./ValueWithModal.vue").then((module) => module.default)
67
+ ),
68
+ },
69
+
70
+ data() {
71
+ return {
72
+ showFullData: false,
73
+ };
74
+ },
75
+
76
+ computed: {
77
+ objKeys() {
78
+ return Object.keys(this.obj) || [];
79
+ },
80
+ printableStringObjs() {
81
+ return this.objKeys.map((key) => {
82
+ const value = this.obj[key];
83
+ const keyValue = `${key}: ${value}`;
84
+ const exceededLength = keyValue.length > 30;
85
+ const print = exceededLength ? key : keyValue;
86
+ return { key, value, keyValue, exceededLength, print };
87
+ });
88
+ },
89
+ indexOfCharacterLengthExceed() {
90
+ let idx = -1;
91
+ let cumulativeLen = 0;
92
+ for (const [index, po] of this.printableStringObjs.entries()) {
93
+ const newLen = cumulativeLen + po.print.length;
94
+ if (newLen > this.maxCharacterLength) {
95
+ idx = index;
96
+ break;
97
+ }
98
+ cumulativeLen = newLen;
99
+ }
100
+
101
+ return idx === -1 ? this.printableStringObjs.length : idx;
102
+ },
103
+ },
104
+ });
105
+ </script>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <a @click.prevent.stop="showModal = true">
3
+ {{ print }}
4
+
5
+ <json-show-modal
6
+ :open="showModal"
7
+ @closemodal="showModal = false"
8
+ :editor-title="title"
9
+ :editor-content="value"
10
+ />
11
+ </a>
12
+ </template>
13
+
14
+ <script>
15
+ import { defineComponent, defineAsyncComponent } from "vue";
16
+
17
+ export default defineComponent({
18
+ props: {
19
+ title: {
20
+ type: String,
21
+ default: "",
22
+ },
23
+ value: {
24
+ type: null,
25
+ default: "",
26
+ },
27
+ print: {
28
+ type: String,
29
+ default: "",
30
+ },
31
+ },
32
+ components: {
33
+ JsonShowModal: defineAsyncComponent(() =>
34
+ import("../../modals/JsonShowModal.vue").then((module) => module.default)
35
+ ),
36
+ },
37
+ data() {
38
+ return {
39
+ showModal: false,
40
+ };
41
+ },
42
+ });
43
+ </script>