@opengis/table 0.0.1 → 0.0.11
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/README.md +42 -49
- package/index.css +1 -0
- package/index.mjs +811 -0
- package/index.umd.js +1 -0
- package/package.json +5 -47
- package/dist/index.css +0 -1
- package/dist/index.mjs +0 -695
- package/dist/index.umd.js +0 -1
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
# DataTable Component
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Full-featured table component for Vue 3 with TypeScript, supporting pagination, row selection, sorting, and custom slots.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
- ✅
|
|
8
|
-
- ✅
|
|
9
|
-
- ✅
|
|
10
|
-
- ✅
|
|
11
|
-
- ✅
|
|
12
|
-
- ✅
|
|
13
|
-
- ✅
|
|
14
|
-
- ✅
|
|
7
|
+
- ✅ Pagination with local data or through API
|
|
8
|
+
- ✅ Row selection with checkboxes
|
|
9
|
+
- ✅ Different table sizes (small, medium, large)
|
|
10
|
+
- ✅ Data formatting (text, numbers, dates, badges, arrays)
|
|
11
|
+
- ✅ **Custom slots for columns**
|
|
12
|
+
- ✅ Loading state and error handling
|
|
13
|
+
- ✅ Dark theme
|
|
14
|
+
- ✅ Adaptive design
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Custom column slots
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
The component supports custom slots to create custom table cells. Use `template #body` in the `Column` component:
|
|
19
19
|
|
|
20
20
|
```vue
|
|
21
21
|
<DataTable :rows="data" tableClass="w-full" tableStyle="min-width: 50rem">
|
|
22
|
-
<Column field="name" header="
|
|
22
|
+
<Column field="name" header="Name">
|
|
23
23
|
<template #body="{ data }">
|
|
24
24
|
<div>
|
|
25
25
|
<div class="font-medium">{{ data.name.main }}</div>
|
|
@@ -27,20 +27,20 @@
|
|
|
27
27
|
</div>
|
|
28
28
|
</template>
|
|
29
29
|
</Column>
|
|
30
|
-
<Column field="status" header="
|
|
30
|
+
<Column field="status" header="Status">
|
|
31
31
|
<template #body="{ data }">
|
|
32
32
|
<span :class="getStatusClass(data.status)" class="px-2 py-1 rounded-full text-xs">
|
|
33
33
|
{{ data.status }}
|
|
34
34
|
</span>
|
|
35
35
|
</template>
|
|
36
36
|
</Column>
|
|
37
|
-
<Column field="actions" header="
|
|
37
|
+
<Column field="actions" header="Actions">
|
|
38
38
|
<template #body="{ data }">
|
|
39
39
|
<div class="flex gap-2">
|
|
40
|
-
<button @click="handleView(data)" title="
|
|
40
|
+
<button @click="handleView(data)" title="View">
|
|
41
41
|
<i class="fas fa-eye"></i>
|
|
42
42
|
</button>
|
|
43
|
-
<button @click="handleEdit(data)" title="
|
|
43
|
+
<button @click="handleEdit(data)" title="Edit">
|
|
44
44
|
<i class="fas fa-edit"></i>
|
|
45
45
|
</button>
|
|
46
46
|
</div>
|
|
@@ -49,18 +49,18 @@
|
|
|
49
49
|
</DataTable>
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
###
|
|
52
|
+
### Slot parameters
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
The `#body` slot receives an object with the following properties:
|
|
55
55
|
|
|
56
|
-
- `data` -
|
|
57
|
-
- `value` -
|
|
56
|
+
- `data` - full row data object
|
|
57
|
+
- `value` - value of the specific column field
|
|
58
58
|
|
|
59
|
-
###
|
|
59
|
+
### Examples
|
|
60
60
|
|
|
61
|
-
#### 1.
|
|
61
|
+
#### 1. Compound name with subtitle
|
|
62
62
|
```vue
|
|
63
|
-
<Column field="name" header="
|
|
63
|
+
<Column field="name" header="Name">
|
|
64
64
|
<template #body="{ data }">
|
|
65
65
|
<div>
|
|
66
66
|
<div class="font-medium">{{ data.name.main }}</div>
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
</Column>
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
#### 2.
|
|
73
|
+
#### 2. Badge with color
|
|
74
74
|
```vue
|
|
75
|
-
<Column field="role" header="
|
|
75
|
+
<Column field="role" header="Role">
|
|
76
76
|
<template #body="{ data }">
|
|
77
|
-
<span :class="data.role === '
|
|
77
|
+
<span :class="data.role === 'admin' ? 'bg-blue-100 text-blue-800' : 'bg-green-100 text-green-800'"
|
|
78
78
|
class="px-2 py-1 rounded-full text-xs font-medium">
|
|
79
79
|
{{ data.role }}
|
|
80
80
|
</span>
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
</Column>
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
#### 3.
|
|
85
|
+
#### 3. Status with icon
|
|
86
86
|
```vue
|
|
87
|
-
<Column field="status" header="
|
|
87
|
+
<Column field="status" header="Status">
|
|
88
88
|
<template #body="{ data }">
|
|
89
89
|
<div class="flex items-center gap-2">
|
|
90
90
|
<span :class="getStatusIconClass(data.status)" class="text-lg">
|
|
@@ -96,15 +96,15 @@
|
|
|
96
96
|
</Column>
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
#### 4.
|
|
99
|
+
#### 4. Action buttons
|
|
100
100
|
```vue
|
|
101
|
-
<Column field="actions" header="
|
|
101
|
+
<Column field="actions" header="Actions">
|
|
102
102
|
<template #body="{ data }">
|
|
103
103
|
<div class="flex gap-2">
|
|
104
|
-
<button @click.stop="handleView(data)" title="
|
|
104
|
+
<button @click.stop="handleView(data)" title="View">
|
|
105
105
|
<i class="fas fa-eye"></i>
|
|
106
106
|
</button>
|
|
107
|
-
<button @click.stop="handleDownload(data)" title="
|
|
107
|
+
<button @click.stop="handleDownload(data)" title="Download">
|
|
108
108
|
<i class="fas fa-download"></i>
|
|
109
109
|
</button>
|
|
110
110
|
</div>
|
|
@@ -112,15 +112,15 @@
|
|
|
112
112
|
</Column>
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
**Important:** Use `@click.stop` for buttons in slots to prevent row click triggering.
|
|
116
116
|
|
|
117
|
-
##
|
|
117
|
+
## Installation
|
|
118
118
|
|
|
119
119
|
```bash
|
|
120
|
-
npm install @
|
|
120
|
+
npm install @opengis/table
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
##
|
|
123
|
+
## Usage
|
|
124
124
|
|
|
125
125
|
```vue
|
|
126
126
|
<template>
|
|
@@ -133,7 +133,7 @@ npm install @your-org/datatable
|
|
|
133
133
|
</template>
|
|
134
134
|
|
|
135
135
|
<script setup>
|
|
136
|
-
import { DataTable, Column } from '@
|
|
136
|
+
import { DataTable, Column } from '@opengis/table';
|
|
137
137
|
|
|
138
138
|
const data = ref([
|
|
139
139
|
{ id: 1, name: 'Product A', category: 'Electronics' },
|
|
@@ -148,19 +148,12 @@ const columns = ref([
|
|
|
148
148
|
</script>
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
##
|
|
151
|
+
## Theme options
|
|
152
152
|
|
|
153
|
-
|
|
|
153
|
+
| Prop | Type | Default | Description |
|
|
154
154
|
|-------|-----|------------------|------|
|
|
155
|
-
| `theme` | `'light' \| 'dark' \| 'auto'` | `'light'` |
|
|
155
|
+
| `theme` | `'light' \| 'dark' \| 'auto'` | `'light'` | Table theme |
|
|
156
156
|
|
|
157
|
-
##
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
npm install
|
|
161
|
-
npm run dev
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
## Ліцензія
|
|
157
|
+
## License
|
|
165
158
|
|
|
166
159
|
MIT
|
package/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.badge[data-v-aaab5e06]{transition:all .2s ease-in-out}.badge[data-v-aaab5e06]:hover{transform:scale(1.05)}
|