Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(sandbox): add example #2479

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions sandbox/pages/SandboxTableView/SandboxTableView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -437,19 +437,31 @@
</template>
</KTableView>
</SandboxSectionComponent>
<SandboxSectionComponent title="Table Inputs">
<KTableView
:data="tableInpustData"
:headers="tableInputsHeaders"
hide-pagination
row-key="id"
>
<template #value="{ row }">
<KInput v-model="tableInputsFormData[row.id]" />
</template>
</KTableView>
</SandboxSectionComponent>
</div>
</SandboxLayout>
</template>

<script setup lang="ts">
import { inject, ref } from 'vue'
import { computed, inject, reactive, ref } from 'vue'
import SandboxTitleComponent from '../../components/SandboxTitleComponent.vue'
import SandboxSectionComponent from '../../components/SandboxSectionComponent.vue'
import type { TableHeader, TableViewData, TableSortPayload, RowLink, PageChangeData, PageSizeChangeData, RowBulkAction } from '@/types'
import type { TableViewHeader, TableViewData, TableSortPayload, RowLink, PageChangeData, PageSizeChangeData, RowBulkAction } from '@/types'
import SandboxTableViewActions from './SandboxTableViewActions.vue'
import { AddIcon } from '@kong/icons'

const headers = (hidable: boolean = false, sortable: boolean = false, bulkActions: boolean = false): TableHeader[] => {
const headers = (hidable: boolean = false, sortable: boolean = false, bulkActions: boolean = false): TableViewHeader[] => {
return [
{ key: 'actions', label: 'Row actions' },
{ key: 'name', label: 'Full Name' },
Expand Down Expand Up @@ -639,6 +651,24 @@ const getRowOneTwoLink = (row: Record<string, any>): RowLink => {

return {}
}

const tableInputsFormData = reactive<Record<string, string>>({
foo: '',
bar: '',
})

const tableInputsHeaders: TableViewHeader[] = [{ key: 'value', label: 'Value' }]

const tableInpustData = computed((): TableViewData => [
{
id: 'foo',
value: tableInputsFormData.foo,
},
{
id: 'bar',
value: tableInputsFormData.bar,
},
])
</script>

<style lang="scss" scoped>
Expand Down