+
-
-
@@ -110,41 +133,18 @@ const triggerLabel = computed(() => {
}
.plugin-card-container {
- column-gap: 50px;
display: grid;
- grid-auto-rows: 1fr;
+ gap: $kui-space-90;
+ grid-template-columns: repeat(auto-fit, minmax(0, 335px)); // display as many cards as possible in a row, with a max width of 335px
+ justify-content: space-around;
margin-top: $kui-space-90;
- row-gap: $kui-space-90;
- .plugin-card-cursor-pointer {
- cursor: pointer;
- }
-
- :deep(.kong-card) {
- display: flex;
- flex: 1 0 0;
- flex-direction: column;
- margin: $kui-space-0;
- padding: $kui-space-0;
- text-align: center;
- }
-
- :deep(.k-card-body) {
- display: flex;
- flex: 1;
- flex-direction: column;
- }
-
- @media (min-width: $kui-breakpoint-phablet) {
- grid-template-columns: repeat(2, 1fr);
- }
-
- @media (min-width: $kui-breakpoint-tablet) {
- grid-template-columns: repeat(3, 1fr);
+ @media (min-width: $kui-breakpoint-laptop) {
+ justify-content: flex-start;
}
- @media (min-width: $kui-breakpoint-laptop) {
- grid-template-columns: repeat(4, 1fr);
+ .plugin-card-cursor-pointer {
+ cursor: pointer;
}
}
diff --git a/packages/entities/entities-plugins/src/composables/usePluginHelpers.ts b/packages/entities/entities-plugins/src/composables/usePluginHelpers.ts
index 4571dd2df5..118d47506a 100644
--- a/packages/entities/entities-plugins/src/composables/usePluginHelpers.ts
+++ b/packages/entities/entities-plugins/src/composables/usePluginHelpers.ts
@@ -1,6 +1,6 @@
import type { ConfigurationSchema } from '@kong-ui-public/entities-shared'
import { ConfigurationSchemaType, useStringHelpers } from '@kong-ui-public/entities-shared'
-import type { PluginType } from '../types'
+import type PluginSelectCard from './../components/select/PluginSelectCard.vue'
export default function useHelpers() {
const { capitalize } = useStringHelpers()
@@ -91,16 +91,6 @@ export default function useHelpers() {
}
}
- const getPluginCards = (type: 'all' | 'visible' | 'hidden', plugins: PluginType[], pluginsPerRow: number) => {
- if (type === 'all') {
- return plugins
- } else if (type === 'visible') {
- return plugins.slice(0, pluginsPerRow)
- }
-
- return plugins.slice(pluginsPerRow)
- }
-
const convertToDotNotation = (key: string) => {
return key.replace(/-/g, '.')
}
@@ -121,12 +111,12 @@ export default function useHelpers() {
keys.reduce((acc: Record
, cur: string, curIdx: number) => {
return acc[cur] ||
- // If current key in acc is the next
- // item in the split array (dot notation)
- // set its value
- (acc[cur] = isNaN(keys[curIdx + 1] as any)
- ? (keys.length - 1 === curIdx ? obj[key] : {})
- : [])
+ // If current key in acc is the next
+ // item in the split array (dot notation)
+ // set its value
+ (acc[cur] = isNaN(keys[curIdx + 1] as any)
+ ? (keys.length - 1 === curIdx ? obj[key] : {})
+ : [])
}, result)
}
@@ -161,13 +151,45 @@ export default function useHelpers() {
return capitalize(label.replace(/_/g, ' '))
}
+ /**
+ * Get the height of the tallest card
+ */
+ const getTallestPluginCardHeight = (elements: Array>): number => {
+ let tallestCardHeight = 0
+
+ if (elements.length) {
+ for (let i = 0; i < elements.length; i++) {
+ const card = elements[i].$el
+ // find height of tallest card
+ tallestCardHeight = card.offsetHeight > tallestCardHeight ? card.offsetHeight : tallestCardHeight
+ }
+ }
+
+ return tallestCardHeight
+ }
+
+ /**
+ * Determines the visibility of the collapse trigger
+ * If the number of cards is greater than the number of columns displayed, show the trigger
+ */
+ const getToggleVisibility = (container: HTMLElement, childrenCount: number): boolean => {
+ if (container && childrenCount) {
+ const displayedColumns = window?.getComputedStyle(container)?.getPropertyValue('grid-template-columns')?.split(' ').length
+
+ return childrenCount > displayedColumns
+ }
+
+ return true
+ }
+
return {
setFieldType,
- getPluginCards,
convertToDotNotation,
unFlattenObject,
isObjectEmpty,
unsetNullForeignKey,
formatPluginFieldLabel,
+ getTallestPluginCardHeight,
+ getToggleVisibility,
}
}
diff --git a/packages/entities/entities-plugins/src/locales/en.json b/packages/entities/entities-plugins/src/locales/en.json
index c4aa27266a..eb383be219 100644
--- a/packages/entities/entities-plugins/src/locales/en.json
+++ b/packages/entities/entities-plugins/src/locales/en.json
@@ -464,7 +464,7 @@
"unavailable_tooltip": "This plugin is not available",
"already_exists": "This plugin is already applied to this resource",
"misc_plugins": "Other Plugins",
- "view_more": "View {count} more",
+ "view_more": "View more",
"view_less": "View less",
"tabs": {
"kong": {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f167510039..7b75589f54 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1736,15 +1736,14 @@ packages:
'@evilmartians/lefthook@1.7.1':
resolution: {integrity: sha512-Wp8DaTMHZM1tUV4Mow6nG+6zq+giruD5054zHmFIDLXlPQxqYxnZMqJg0aYxe16vYwqFmH6NIClEMRdtGucO0Q==}
- cpu: [x64, arm64, ia32]
os: [darwin, linux, win32]
hasBin: true
- '@floating-ui/core@1.6.2':
- resolution: {integrity: sha512-+2XpQV9LLZeanU4ZevzRnGFg2neDeKHgFLjP6YLW+tly0IvrhqT4u8enLGjLH3qeh85g19xY5rsAusfwTdn5lg==}
+ '@floating-ui/core@1.6.4':
+ resolution: {integrity: sha512-a4IowK4QkXl4SCWTGUR0INAfEOX3wtsYw3rKK5InQEHMGObkR8Xk44qYQD9P4r6HHw0iIfK6GUKECmY8sTkqRA==}
- '@floating-ui/dom@1.6.5':
- resolution: {integrity: sha512-Nsdud2X65Dz+1RHjAIP0t8z5e2ff/IRbei6BqFrl1urT8sDVzM1HMQ+R0XcU5ceRfyO3I6ayeqIfh+6Wb8LGTw==}
+ '@floating-ui/dom@1.6.7':
+ resolution: {integrity: sha512-wmVfPG5o2xnKDU4jx/m4w5qva9FWHcnZ8BvzEe90D/RpwsJaTAVYPEPdQ8sbr/N8zZTAHlZUTQdqg8ZUbzHmng==}
'@floating-ui/utils@0.2.4':
resolution: {integrity: sha512-dWO2pw8hhi+WrXq1YJy2yCuWoL20PddgGaqTgVe4cOS9Q6qklXCiA1tJEqX6BEwRNSCP84/afac9hd4MS+zEUA==}
@@ -2681,6 +2680,9 @@ packages:
'@types/lodash@4.17.5':
resolution: {integrity: sha512-MBIOHVZqVqgfro1euRDWX7OO0fBVUUMrN6Pwm8LQsz8cWhEpihlvR70ENj3f40j58TNxZaWv2ndSkInykNBBJw==}
+ '@types/lodash@4.17.7':
+ resolution: {integrity: sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==}
+
'@types/mapbox__point-geometry@0.1.4':
resolution: {integrity: sha512-mUWlSxAmYLfwnRBmgYV86tgYmMIICX4kza8YnE/eIlywGe2XoOxlpVnXWwir92xRLjwyarqwpu2EJKD2pk0IUA==}
@@ -9652,20 +9654,20 @@ snapshots:
'@evilmartians/lefthook@1.7.1': {}
- '@floating-ui/core@1.6.2':
+ '@floating-ui/core@1.6.4':
dependencies:
'@floating-ui/utils': 0.2.4
- '@floating-ui/dom@1.6.5':
+ '@floating-ui/dom@1.6.7':
dependencies:
- '@floating-ui/core': 1.6.2
+ '@floating-ui/core': 1.6.4
'@floating-ui/utils': 0.2.4
'@floating-ui/utils@0.2.4': {}
'@floating-ui/vue@1.1.1(vue@3.3.13(typescript@5.3.3))':
dependencies:
- '@floating-ui/dom': 1.6.5
+ '@floating-ui/dom': 1.6.7
'@floating-ui/utils': 0.2.4
vue-demi: 0.14.8(vue@3.3.13(typescript@5.3.3))
transitivePeerDependencies:
@@ -9674,7 +9676,7 @@ snapshots:
'@floating-ui/vue@1.1.1(vue@3.4.31(typescript@5.3.3))':
dependencies:
- '@floating-ui/dom': 1.6.5
+ '@floating-ui/dom': 1.6.7
'@floating-ui/utils': 0.2.4
vue-demi: 0.14.8(vue@3.4.31(typescript@5.3.3))
transitivePeerDependencies:
@@ -11233,6 +11235,8 @@ snapshots:
'@types/lodash@4.17.5': {}
+ '@types/lodash@4.17.7': {}
+
'@types/mapbox__point-geometry@0.1.4': {}
'@types/mapbox__vector-tile@1.3.4':
@@ -17895,7 +17899,7 @@ snapshots:
v-calendar@3.1.2(@popperjs/core@2.11.8)(vue@3.3.13(typescript@5.3.3)):
dependencies:
'@popperjs/core': 2.11.8
- '@types/lodash': 4.17.5
+ '@types/lodash': 4.17.7
'@types/resize-observer-browser': 0.1.11
date-fns: 2.30.0
date-fns-tz: 2.0.1(date-fns@2.30.0)
@@ -17906,7 +17910,7 @@ snapshots:
v-calendar@3.1.2(@popperjs/core@2.11.8)(vue@3.4.31(typescript@5.3.3)):
dependencies:
'@popperjs/core': 2.11.8
- '@types/lodash': 4.17.5
+ '@types/lodash': 4.17.7
'@types/resize-observer-browser': 0.1.11
date-fns: 2.30.0
date-fns-tz: 2.0.1(date-fns@2.30.0)