@appscode/design-system 2.1.8 → 2.2.0

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 (72) hide show
  1. package/package.json +1 -1
  2. package/vue-components/v3/form-fields/Switch.vue +1 -1
  3. package/vue-components/v2/banner/Banner.vue +0 -12
  4. package/vue-components/v2/breadcrumbs/Breadcrumb.vue +0 -84
  5. package/vue-components/v2/button/Button.vue +0 -70
  6. package/vue-components/v2/button/Buttons.vue +0 -5
  7. package/vue-components/v2/button/DownloadBtn.vue +0 -45
  8. package/vue-components/v2/card/Card.vue +0 -37
  9. package/vue-components/v2/card/CardContent.vue +0 -5
  10. package/vue-components/v2/card/CardHeader.vue +0 -10
  11. package/vue-components/v2/card/Cards.vue +0 -5
  12. package/vue-components/v2/card/OverviewCard.vue +0 -10
  13. package/vue-components/v2/card/OverviewCards.vue +0 -20
  14. package/vue-components/v2/card/PaymentCard.vue +0 -69
  15. package/vue-components/v2/card/PaymentCardOptionButtons.vue +0 -35
  16. package/vue-components/v2/card/PaymentCards.vue +0 -48
  17. package/vue-components/v2/content/ContentHeader.vue +0 -50
  18. package/vue-components/v2/content/ContentLayout.vue +0 -9
  19. package/vue-components/v2/content/ContentTable.vue +0 -62
  20. package/vue-components/v2/editor/Editor.vue +0 -144
  21. package/vue-components/v2/editor/FilteredFileEditor.vue +0 -177
  22. package/vue-components/v2/editor/MonacoEditor.vue +0 -118
  23. package/vue-components/v2/editor/ResourceKeyValueEditor.vue +0 -199
  24. package/vue-components/v2/form/Form.vue +0 -54
  25. package/vue-components/v2/form/FormFooterControl.vue +0 -5
  26. package/vue-components/v2/form/FormFooterControls.vue +0 -5
  27. package/vue-components/v2/form-fields/AcSingleInput.vue +0 -20
  28. package/vue-components/v2/form-fields/Input.vue +0 -17
  29. package/vue-components/v2/header/Header.vue +0 -34
  30. package/vue-components/v2/header/HeaderItem.vue +0 -5
  31. package/vue-components/v2/header/HeaderItems.vue +0 -5
  32. package/vue-components/v2/icons/Ellipsis.vue +0 -4
  33. package/vue-components/v2/loaders/ResourceLoader.vue +0 -101
  34. package/vue-components/v2/loaders/SidebarLoader.vue +0 -43
  35. package/vue-components/v2/modal/Modal.vue +0 -137
  36. package/vue-components/v2/modals/DeleteConfirmationModal.vue +0 -74
  37. package/vue-components/v2/modals/JsonShowModal.vue +0 -69
  38. package/vue-components/v2/navbar/Appdrawer.vue +0 -74
  39. package/vue-components/v2/navbar/Navbar.vue +0 -29
  40. package/vue-components/v2/navbar/NavbarItem.vue +0 -7
  41. package/vue-components/v2/navbar/NavbarItemContent.vue +0 -5
  42. package/vue-components/v2/navbar/ThemeMode.vue +0 -114
  43. package/vue-components/v2/navbar/User.vue +0 -190
  44. package/vue-components/v2/notification/Notification.vue +0 -92
  45. package/vue-components/v2/notification/NotificationItem.vue +0 -42
  46. package/vue-components/v2/pagination/Pagination.vue +0 -214
  47. package/vue-components/v2/preloader/Preloader.vue +0 -26
  48. package/vue-components/v2/searchbars/SearchBar.vue +0 -31
  49. package/vue-components/v2/sidebar/ClusterSwitcher.vue +0 -126
  50. package/vue-components/v2/sidebar/Sidebar.vue +0 -5
  51. package/vue-components/v2/sidebar/SidebarItem.vue +0 -59
  52. package/vue-components/v2/sidebar/SidebarItemWithDropDown.vue +0 -114
  53. package/vue-components/v2/tab/TabItem.vue +0 -16
  54. package/vue-components/v2/tab/Tabs.vue +0 -7
  55. package/vue-components/v2/tab/TabsBody.vue +0 -5
  56. package/vue-components/v2/table/EmptyTableImage.vue +0 -3
  57. package/vue-components/v2/table/EmptyTableInfo.vue +0 -6
  58. package/vue-components/v2/table/FakeTableCell.vue +0 -35
  59. package/vue-components/v2/table/InfoTable.vue +0 -91
  60. package/vue-components/v2/table/NarrowTable.vue +0 -17
  61. package/vue-components/v2/table/Table.vue +0 -212
  62. package/vue-components/v2/table/TableCell.vue +0 -26
  63. package/vue-components/v2/table/TableContainer.vue +0 -5
  64. package/vue-components/v2/table/TableRow.vue +0 -50
  65. package/vue-components/v2/table/table-cell/ArrayCell.vue +0 -94
  66. package/vue-components/v2/table/table-cell/CellValue.vue +0 -125
  67. package/vue-components/v2/table/table-cell/GenericCell.vue +0 -56
  68. package/vue-components/v2/table/table-cell/ObjectCell.vue +0 -93
  69. package/vue-components/v2/table/table-cell/ValueWithModal.vue +0 -34
  70. package/vue-components/v2/tabs/EditorTabs.vue +0 -28
  71. package/vue-components/v2/tag/Tag.vue +0 -16
  72. package/vue-components/v2/tag/Tags.vue +0 -5
@@ -1,212 +0,0 @@
1
- <template>
2
- <table-container>
3
- <table
4
- ref="ac-table"
5
- class="table ac-table ac-striped"
6
- :class="{
7
- 'is-fullwidth': !isDynamicWidthTable || isFullTableLoaderActive || isTableEmpty || isLoaderActive,
8
- }"
9
- >
10
- <thead>
11
- <table-row v-if="isFullTableLoaderActive">
12
- <th v-for="i in loaderCols" :key="i">
13
- <cell-value :is-loader-active="true" />
14
- </th>
15
- </table-row>
16
- <table-row v-else>
17
- <th
18
- v-for="(tableHeader, idx) in tableHeaders"
19
- :key="idx"
20
- :class="{
21
- sorting: headerSortables[idx] && headerSortables[idx].enabled,
22
- 'sorting-desc': headerSortables[idx] && headerSortables[idx].mode === 'desc',
23
- 'sorting-asc': headerSortables[idx] && headerSortables[idx].mode === 'asc',
24
- 'has-text-centered': typeof tableHeader === 'string' ? false : tableHeader.textAlign === 'center',
25
- 'has-text-left': typeof tableHeader === 'string' ? false : tableHeader.textAlign === 'left',
26
- 'has-text-right': typeof tableHeader === 'string' ? false : tableHeader.textAlign === 'right',
27
- }"
28
- @click.prevent="headerSortables[idx] && headerSortables[idx].enabled && emitSortEvent(idx)"
29
- >
30
- {{ headerLabels[idx] }}
31
- <span
32
- v-if="tableHeader.dashboard && tableHeader.dashboard.status && tableHeader.dashboard.status !== 'Success'"
33
- class="icon has-text-danger"
34
- :title="tableHeader.dashboard && tableHeader.dashboard.message"
35
- >
36
- <i class="fa fa-exclamation-triangle" />
37
- </span>
38
- </th>
39
- <th ref="action-section" v-if="actionable" style="min-width: 100px"></th>
40
- <fake-table-cell v-if="fakeCellWidth > 0" :is-header-cell="true" :fake-cell-width="fakeCellWidth" />
41
- </table-row>
42
- </thead>
43
- <!-- table row loaders -->
44
- <tbody v-if="isFullTableLoaderActive || isLoaderActive">
45
- <table-row v-if="isFullTableLoaderActive">
46
- <th v-for="i in loaderCols" :key="i">
47
- <cell-value :is-loader-active="true" />
48
- </th>
49
- </table-row>
50
- <table-row v-else>
51
- <table-cell v-for="(tableHeader, idx) in tableHeaders" :key="headerLabels[idx]">
52
- <cell-value :is-loader-active="true" :cell-title="headerLabels[idx]" />
53
- </table-cell>
54
- </table-row>
55
- </tbody>
56
- <!-- table row loaders -->
57
- <template v-else>
58
- <tbody v-if="!isTableEmpty">
59
- <!-- table rows -->
60
- <slot :fake-cell-width="fakeCellWidth" />
61
- </tbody>
62
- <tbody v-else>
63
- <table-row class="is-hoverless">
64
- <table-cell
65
- :colspan="actionable ? tableHeaders.length + 1 : tableHeaders.length"
66
- class="no-data-available has-text-centered"
67
- >
68
- <empty-table-info />
69
- </table-cell>
70
- </table-row>
71
- </tbody>
72
- </template>
73
- </table>
74
-
75
- <!-- table footer info start -->
76
- <slot name="table-footer-info" />
77
- <!-- table footer info end -->
78
-
79
- <!-- pagination start -->
80
- <slot name="table-pagination" />
81
- <!-- pagination end -->
82
- </table-container>
83
- </template>
84
-
85
- <script>
86
- export default {
87
- props: {
88
- isLoaderActive: {
89
- type: Boolean,
90
- default: false,
91
- },
92
- isTableEmpty: {
93
- type: Boolean,
94
- default: true,
95
- },
96
- tableHeaders: {
97
- type: Array,
98
- default: () => [],
99
- },
100
- actionable: {
101
- type: Boolean,
102
- default: false,
103
- },
104
- isDynamicWidthTable: {
105
- type: Boolean,
106
- default: false,
107
- },
108
- fullWidth: {
109
- type: Number,
110
- default: 1920,
111
- },
112
- },
113
- components: {
114
- TableContainer: () => import("./TableContainer.vue"),
115
- TableRow: () => import("./TableRow.vue"),
116
- TableCell: () => import("./TableCell.vue"),
117
- CellValue: () => import("./table-cell/CellValue.vue"),
118
- EmptyTableInfo: () => import("./EmptyTableInfo.vue"),
119
- FakeTableCell: () => import("./FakeTableCell.vue"),
120
- },
121
-
122
- data() {
123
- return {
124
- fakeCellWidth: 0,
125
- headerSortables: [],
126
- };
127
- },
128
-
129
- computed: {
130
- loaderCols() {
131
- if (this.isFullTableLoaderActive) {
132
- return 5;
133
- } else if (this.isLoaderActive) {
134
- return Math.max(this.tableHeaders.length + 1, 5);
135
- } else {
136
- return this.tableHeaders.length || 5;
137
- }
138
- },
139
- isFullTableLoaderActive() {
140
- return !this.tableHeaders.length;
141
- },
142
- headerLabels() {
143
- return this.tableHeaders.map((th) => (typeof th === "string" ? th : th.name || "Label"));
144
- },
145
- },
146
-
147
- watch: {
148
- tableHeaders: {
149
- immediate: true,
150
- handler(n) {
151
- if (this.headerSortables.length === n.length) {
152
- n.forEach((th, idx) => {
153
- if (this.headerSortables[idx].enabled !== !!(th && th.sort && th.sort.enable)) {
154
- this.headerSortables[idx].enabled = !!(th && th.sort && th.sort.enable);
155
- this.headerSortables[idx].mode = "";
156
- }
157
- });
158
- } else {
159
- this.headerSortables = n.map((th) => {
160
- if (typeof th === "string") {
161
- return {
162
- enabled: false,
163
- mode: "",
164
- };
165
- } else {
166
- return {
167
- enabled: !!(th && th.sort && th.sort.enable),
168
- mode: "",
169
- };
170
- }
171
- });
172
- }
173
- },
174
- },
175
- },
176
-
177
- updated() {
178
- this.$nextTick(() => {
179
- this.onWindowResize();
180
- });
181
- },
182
-
183
- methods: {
184
- onWindowResize() {
185
- if (this.$refs["ac-table"] && this.isDynamicWidthTable) {
186
- const tableWidth = this.$refs["ac-table"].clientWidth;
187
- const d = this.fullWidth - tableWidth;
188
- this.fakeCellWidth = d;
189
- }
190
- },
191
- emitSortEvent(index) {
192
- const emitValue = {
193
- index,
194
- label: this.tableHeaders[index].name,
195
- mode: "",
196
- };
197
-
198
- this.headerSortables.forEach((hs, idx) => {
199
- if (idx !== index) hs.mode = "";
200
- else {
201
- if (hs.mode === "asc") hs.mode = "desc";
202
- else hs.mode = "asc";
203
-
204
- emitValue.mode = hs.mode;
205
- }
206
- });
207
-
208
- this.$emit("sort", emitValue);
209
- },
210
- },
211
- };
212
- </script>
@@ -1,26 +0,0 @@
1
- <template>
2
- <td :style="styleOb">
3
- <slot />
4
- </td>
5
- </template>
6
-
7
- <script>
8
- export default {
9
- props: {
10
- cellWidth: {
11
- type: Number,
12
- default: null,
13
- },
14
- },
15
-
16
- computed: {
17
- styleOb() {
18
- const ob = {};
19
- if (this.cellWidth) {
20
- ob.width = `${this.cellWidth}px`;
21
- }
22
- return ob || {};
23
- },
24
- },
25
- };
26
- </script>
@@ -1,5 +0,0 @@
1
- <template>
2
- <div class="ac-table-container table-container">
3
- <slot />
4
- </div>
5
- </template>
@@ -1,50 +0,0 @@
1
- <template>
2
- <router-link v-if="link" :event="link !== '' ? 'click' : ''" :to="link" custom v-slot="{ navigate }">
3
- <tr class="is-link" @click="navigate" data-testid="ac-table-row">
4
- <slot />
5
- <fake-table-cell v-if="fakeCellWidth > 0" :fake-cell-width="fakeCellWidth" />
6
- </tr>
7
- </router-link>
8
-
9
- <tr
10
- v-else
11
- :class="{
12
- 'is-selected': isSelected,
13
- 'is-hoverless': !isSelected,
14
- 'is-disabled': isDisabled,
15
- }"
16
- data-testid="ac-table-row"
17
- @click.prevent="$emit('rowselect', true)"
18
- >
19
- <slot />
20
- <fake-table-cell v-if="fakeCellWidth > 0" :fake-cell-width="fakeCellWidth" />
21
- </tr>
22
- </template>
23
-
24
- <script>
25
- export default {
26
- props: {
27
- link: {
28
- type: String,
29
- default: "",
30
- },
31
- isSelected: {
32
- type: Boolean,
33
- default: false,
34
- },
35
- isDisabled: {
36
- type: Boolean,
37
- default: false,
38
- },
39
- fakeCellWidth: {
40
- type: Number,
41
- default: 0,
42
- },
43
- },
44
-
45
- components: {
46
- TableCell: () => import("./TableCell.vue"),
47
- FakeTableCell: () => import("./FakeTableCell.vue"),
48
- },
49
- };
50
- </script>
@@ -1,94 +0,0 @@
1
- <template>
2
- <tags v-if="printableStringObjs.length">
3
- <tag
4
- v-for="(printableStringOb, idx) in printableStringObjs.slice(0, indexOfCharacterLengthExceed)"
5
- :key="`${printableStringOb.print}-${idx}`"
6
- >
7
- <value-with-modal
8
- v-if="printableStringOb.exceededLength"
9
- :title="`${cellTitle}: ${idx}`"
10
- :value="printableStringOb.value"
11
- :print="printableStringOb.print"
12
- />
13
- <template v-else> {{ printableStringOb.print }} </template>
14
- </tag>
15
-
16
- <tag v-if="indexOfCharacterLengthExceed !== printableStringObjs.length">
17
- <a @click.prevent.stop="showFullData = true">
18
- <ellipsis-icon />
19
- <json-show-modal
20
- :open="showFullData"
21
- @closemodal="showFullData = false"
22
- :editor-title="cellTitle"
23
- :editor-content="items"
24
- />
25
- </a>
26
- </tag>
27
- </tags>
28
- <p v-else>-</p>
29
- </template>
30
-
31
- <script>
32
- export default {
33
- props: {
34
- cellTitle: {
35
- type: String,
36
- default: "Array",
37
- },
38
- items: {
39
- type: Array,
40
- default: () => [],
41
- },
42
- maxCharacterLength: {
43
- type: Number,
44
- default: undefined,
45
- },
46
- },
47
- components: {
48
- Tags: () => import("../../tag/Tags.vue"),
49
- Tag: () => import("../../tag/Tag.vue"),
50
- EllipsisIcon: () => import("../../icons/Ellipsis.vue"),
51
- JsonShowModal: () => import("../../modals/JsonShowModal.vue"),
52
- ValueWithModal: () => import("./ValueWithModal.vue"),
53
- },
54
-
55
- data() {
56
- return {
57
- showFullData: false,
58
- };
59
- },
60
-
61
- computed: {
62
- printableStringObjs() {
63
- return this.items.map((item) => {
64
- const value = item;
65
- let exceededLength = false;
66
- let print = item;
67
- if (typeof item === "object") {
68
- exceededLength = true;
69
- print = item["Name"] || item["name"] || item[Object.keys(item)[0]];
70
- } else {
71
- const stringifiedValue = JSON.stringify(item);
72
- exceededLength = stringifiedValue.length > 27;
73
- print = exceededLength ? `${stringifiedValue.slice(0, 27)}...` : stringifiedValue;
74
- }
75
- return { value, exceededLength, print };
76
- });
77
- },
78
- indexOfCharacterLengthExceed() {
79
- let idx = -1;
80
- let cumulativeLen = 0;
81
- for (const [index, po] of this.printableStringObjs.entries()) {
82
- const newLen = cumulativeLen + po.print.length;
83
- if (newLen > this.maxCharacterLength) {
84
- idx = index;
85
- break;
86
- }
87
- cumulativeLen = newLen;
88
- }
89
-
90
- return idx === -1 ? this.printableStringObjs.length : idx;
91
- },
92
- },
93
- };
94
- </script>
@@ -1,125 +0,0 @@
1
- <template>
2
- <div v-if="isLoaderActive" ref="cellLoaderDiv" :style="{ maxWidth: '300px' }">
3
- <content-loader
4
- :height="10"
5
- :width="computedCellWidth || 300"
6
- :primaryColor="primaryColor"
7
- :secondaryColor="secondaryColor"
8
- />
9
- </div>
10
- <div v-else ref="cellDiv">
11
- <object-cell
12
- v-if="valueType === 'object'"
13
- :obj="value"
14
- :cell-title="cellTitle"
15
- :max-character-length="maxCharacterLength"
16
- data-testid="object-cell-value"
17
- />
18
- <array-cell
19
- v-else-if="valueType === 'array'"
20
- :items="value"
21
- :cell-title="cellTitle"
22
- :max-character-length="maxCharacterLength"
23
- data-testid="array-cell-value"
24
- />
25
- <template v-else>
26
- <span class="is-ellipsis-1" :title="tooltip" data-testid="cell-value">{{
27
- value || (value === 0 ? 0 : "-")
28
- }}</span>
29
- </template>
30
- </div>
31
- </template>
32
-
33
- <script>
34
- import {
35
- loaderLightThemePrimaryColor,
36
- loaderDarkThemePrimaryColor,
37
- loaderLightThemeSecondaryColor,
38
- loaderDarkThemeSecondaryColor,
39
- } from "@appscode/design-system/plugins/theme";
40
-
41
- export default {
42
- props: {
43
- isLoaderActive: {
44
- type: Boolean,
45
- default: false,
46
- },
47
- cellTitle: {
48
- type: String,
49
- default: "Cell",
50
- },
51
- value: {
52
- type: null,
53
- default: "",
54
- },
55
- tooltip: {
56
- type: String,
57
- defualt: "",
58
- },
59
- },
60
- components: {
61
- ContentLoader: () => import("vue-content-loader").then(({ ContentLoader }) => ContentLoader),
62
- ObjectCell: () => import("./ObjectCell.vue"),
63
- ArrayCell: () => import("./ArrayCell.vue"),
64
- },
65
-
66
- computed: {
67
- valueType() {
68
- if (typeof this.value === "object") {
69
- if (this.value === null) return "null";
70
- else if (Array.isArray(this.value)) return "array";
71
- else return "object";
72
- } else return typeof this.value;
73
- },
74
- maxCharacterLength() {
75
- return Math.ceil(this.computedCellWidth / 8);
76
- },
77
- primaryColor() {
78
- return document.documentElement.classList.contains("is-dark-theme")
79
- ? loaderDarkThemePrimaryColor
80
- : loaderLightThemePrimaryColor;
81
- },
82
- secondaryColor() {
83
- return document.documentElement.classList.contains("is-dark-theme")
84
- ? loaderDarkThemeSecondaryColor
85
- : loaderLightThemeSecondaryColor;
86
- },
87
- },
88
-
89
- data() {
90
- return {
91
- computedCellWidth: null,
92
- };
93
- },
94
-
95
- mounted() {
96
- this.calcCellWidth();
97
- },
98
-
99
- watch: {
100
- isLoaderActive() {
101
- this.calcCellWidth();
102
- },
103
- },
104
-
105
- methods: {
106
- calcCellWidth() {
107
- if (this.isLoaderActive) {
108
- this.$nextTick(() => {
109
- const cellLoaderDiv = this.$refs.cellLoaderDiv;
110
- if (cellLoaderDiv) {
111
- this.computedCellWidth = cellLoaderDiv.offsetWidth;
112
- }
113
- });
114
- } else {
115
- this.$nextTick(() => {
116
- const cellDiv = this.$refs.cellDiv;
117
- if (cellDiv) {
118
- this.computedCellWidth = cellDiv.offsetWidth;
119
- }
120
- });
121
- }
122
- },
123
- },
124
- };
125
- </script>
@@ -1,56 +0,0 @@
1
- <template>
2
- <span
3
- :class="{
4
- 'is-flex': cellDescriptor.type !== 'object',
5
- 'is-align-items-center': cellValue.icon,
6
- 'is-justify-content-center': cellDescriptor.textAlign === 'center',
7
- 'is-justify-content-left': cellDescriptor.textAlign === 'left',
8
- 'is-justify-content-right': cellDescriptor.textAlign === 'right',
9
- }"
10
- >
11
- <span v-if="cellValue.icon" class="icon p-0 mr-10">
12
- <img width="15" :src="cellValue.icon" />
13
- </span>
14
- <router-link v-if="cellValue.link" :to="getCellLink(cellValue)">
15
- {{ cellValue.data }}
16
- </router-link>
17
- <tag v-else-if="cellValue.color" :class="`is-${cellValue.color}`">
18
- {{ cellValue.data }}
19
- </tag>
20
- <cell-value
21
- v-else
22
- :cell-title="cellDescriptor.name"
23
- :value="cellValue.data || '-'"
24
- :tooltip="cellValue.tooltip || JSON.stringify(cellValue.data)"
25
- />
26
- </span>
27
- </template>
28
- <script>
29
- export default {
30
- components: {
31
- Tag: () => import("../../tag/Tag.vue"),
32
- CellValue: () => import("../table-cell/CellValue.vue"),
33
- },
34
- props: {
35
- cellDescriptor: {
36
- type: Object,
37
- default: () => ({}),
38
- },
39
- cellValue: {
40
- type: Object,
41
- default: () => ({}),
42
- },
43
- },
44
- methods: {
45
- getCellLink(cell) {
46
- const inject = (str, obj) => str.replace(/\${(.*?)}/g, (x, g) => obj[g]);
47
- const { user, cluster } = this.$route.params;
48
- const link = inject(cell.link || "", {
49
- username: user,
50
- clustername: cluster,
51
- });
52
- return link;
53
- },
54
- },
55
- };
56
- </script>
@@ -1,93 +0,0 @@
1
- <template>
2
- <tags v-if="printableStringObjs.length">
3
- <tag
4
- v-for="printableStringOb in printableStringObjs.slice(0, indexOfCharacterLengthExceed)"
5
- :key="printableStringOb.key"
6
- >
7
- <value-with-modal
8
- v-if="printableStringOb.exceededLength"
9
- :title="printableStringOb.key"
10
- :value="printableStringOb.value"
11
- :print="printableStringOb.print"
12
- />
13
- <template v-else> {{ printableStringOb.print }} </template>
14
- </tag>
15
-
16
- <tag v-if="indexOfCharacterLengthExceed !== printableStringObjs.length">
17
- <a @click.prevent.stop="showFullData = true">
18
- <ellipsis-icon />
19
- <json-show-modal
20
- :open="showFullData"
21
- @closemodal="showFullData = false"
22
- :editor-title="cellTitle"
23
- :editor-content="obj"
24
- />
25
- </a>
26
- </tag>
27
- </tags>
28
- <p v-else>-</p>
29
- </template>
30
-
31
- <script>
32
- export default {
33
- props: {
34
- cellTitle: {
35
- type: String,
36
- default: "Object",
37
- },
38
- obj: {
39
- type: Object,
40
- default: () => ({}),
41
- },
42
- maxCharacterLength: {
43
- type: Number,
44
- default: undefined,
45
- },
46
- },
47
- components: {
48
- Tags: () => import("../../tag/Tags.vue"),
49
- Tag: () => import("../../tag/Tag.vue"),
50
- EllipsisIcon: () => import("../../icons/Ellipsis.vue"),
51
- JsonShowModal: () => import("../../modals/JsonShowModal.vue"),
52
- ValueWithModal: () => import("./ValueWithModal.vue"),
53
- },
54
-
55
- data() {
56
- return {
57
- showFullData: false,
58
- };
59
- },
60
-
61
- computed: {
62
- objKeys() {
63
- return Object.keys(this.obj) || [];
64
- },
65
- printableStringObjs() {
66
- return this.objKeys.map((key) => {
67
- let value = this.obj[key];
68
- if (typeof value === "object" && value !== null) {
69
- value = JSON.stringify(value);
70
- }
71
- const keyValue = `${key}: ${value}`;
72
- const exceededLength = keyValue.length > 30;
73
- const print = exceededLength ? key : keyValue;
74
- return { key, value, keyValue, exceededLength, print };
75
- });
76
- },
77
- indexOfCharacterLengthExceed() {
78
- let idx = -1;
79
- let cumulativeLen = 0;
80
- for (const [index, po] of this.printableStringObjs.entries()) {
81
- const newLen = cumulativeLen + po.print.length;
82
- if (newLen > this.maxCharacterLength) {
83
- idx = index;
84
- break;
85
- }
86
- cumulativeLen = newLen;
87
- }
88
-
89
- return idx === -1 ? this.printableStringObjs.length : idx;
90
- },
91
- },
92
- };
93
- </script>
@@ -1,34 +0,0 @@
1
- <template>
2
- <a @click.prevent.stop="showModal = true">
3
- {{ print }}
4
-
5
- <json-show-modal :open="showModal" @closemodal="showModal = false" :editor-title="title" :editor-content="value" />
6
- </a>
7
- </template>
8
-
9
- <script>
10
- export default {
11
- props: {
12
- title: {
13
- type: String,
14
- default: "",
15
- },
16
- value: {
17
- type: null,
18
- default: "",
19
- },
20
- print: {
21
- type: String,
22
- default: "",
23
- },
24
- },
25
- components: {
26
- JsonShowModal: () => import("../../modals/JsonShowModal.vue"),
27
- },
28
- data() {
29
- return {
30
- showModal: false,
31
- };
32
- },
33
- };
34
- </script>