@opengis/filter 0.0.1 โ 0.0.2
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 +56 -122
- package/dist/filter.cjs.js +5 -5
- package/dist/filter.es.js +1855 -1742
- package/dist/filter.umd.js +5 -5
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,148 +1,82 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Filter Panel
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A flexible and extensible filter component system for Vue 3.
|
|
4
|
+
Ideal for building customizable filter UIs with checkbox, radio, or custom slot fields.
|
|
4
5
|
|
|
5
6
|
---
|
|
6
7
|
|
|
7
|
-
##
|
|
8
|
+
## Features
|
|
8
9
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
10
|
+
- Schema-based filter rendering (radio, checkbox)
|
|
11
|
+
- Slot-based extensibility for custom filters
|
|
12
|
+
- Built-in clear/reset support
|
|
13
|
+
- Emits `change` and `clear` events
|
|
14
|
+
- Popover support with positioning logic
|
|
15
|
+
- Show more / limit options logic
|
|
16
|
+
- Written in TypeScript
|
|
17
|
+
- Fully styleable with Tailwind CSS
|
|
18
|
+
- Mobile-friendly and responsive
|
|
16
19
|
|
|
17
20
|
---
|
|
21
|
+
## Documentation
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
### Live Demo & Docs
|
|
20
24
|
|
|
25
|
+
Check out the documentation and live demo here:
|
|
26
|
+
- [FIlter](https://filter.opengis.info)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Install & Usage
|
|
30
|
+
|
|
31
|
+
### 1. Install the packag
|
|
21
32
|
```bash
|
|
22
|
-
npm
|
|
33
|
+
npm i @opengis/filter
|
|
23
34
|
```
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
// main.ts
|
|
35
|
+
### 2. Register the component
|
|
36
|
+
```typescript
|
|
37
|
+
// main.ts or main.js
|
|
27
38
|
import { createApp } from 'vue'
|
|
28
39
|
import App from './App.vue'
|
|
29
|
-
import
|
|
40
|
+
import InlineFilter from 'filter'
|
|
30
41
|
|
|
31
|
-
createApp(App).component('
|
|
42
|
+
createApp(App).component('Filter', InlineFilter).mount('#app')
|
|
32
43
|
```
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## โ
Example Usage
|
|
44
|
+
### 3. Use it in your template
|
|
37
45
|
|
|
38
46
|
```vue
|
|
47
|
+
|
|
39
48
|
<template>
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
v-model:page="page"
|
|
44
|
-
v-model:limit="limit"
|
|
45
|
-
v-model:sort="sort"
|
|
46
|
-
:filters="filters"
|
|
47
|
-
>
|
|
48
|
-
<table class="w-full text-sm">
|
|
49
|
-
<thead>
|
|
50
|
-
<tr>
|
|
51
|
-
<th>ID</th>
|
|
52
|
-
<th>Name</th>
|
|
53
|
-
<th>Price</th>
|
|
54
|
-
<th>Status</th>
|
|
55
|
-
</tr>
|
|
56
|
-
</thead>
|
|
57
|
-
<tbody>
|
|
58
|
-
<tr v-for="row in rows" :key="row.id">
|
|
59
|
-
<td>{{ row.id }}</td>
|
|
60
|
-
<td>{{ row.name }}</td>
|
|
61
|
-
<td>{{ row.price }}</td>
|
|
62
|
-
<td>
|
|
63
|
-
<span :class="badgeClass(row.status)">
|
|
64
|
-
{{ row.status }}
|
|
65
|
-
</span>
|
|
66
|
-
</td>
|
|
67
|
-
</tr>
|
|
68
|
-
</tbody>
|
|
69
|
-
</table>
|
|
70
|
-
</TableCRM>
|
|
49
|
+
<filter :schema="schema" @change="filter = $event" @clear="console.log($event.data)">
|
|
50
|
+
<filter-field :options="options" label="test label" limit=1 name="test" type="checkbox"/>
|
|
51
|
+
</filter>
|
|
71
52
|
</template>
|
|
72
53
|
|
|
73
54
|
<script setup lang="ts">
|
|
74
|
-
import {
|
|
75
|
-
import
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
55
|
+
import {ref} from 'vue'
|
|
56
|
+
import {ListItem, Schema} from "./forms.model";
|
|
57
|
+
|
|
58
|
+
const options: ListItem[] = [
|
|
59
|
+
{
|
|
60
|
+
value: 'is_video',
|
|
61
|
+
label: 'Video',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
value: 'is_photo',
|
|
65
|
+
label: 'Photo',
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
const schema = ref({
|
|
70
|
+
name: {type: 'radio', label: 'ะะฐัะฒะฝัััั ัะพัะพ / ะฒัะดะตะพ', options}
|
|
71
|
+
} as Schema);
|
|
72
|
+
|
|
73
|
+
const selectedIcon = ref('')
|
|
74
|
+
const myIcons = ['home', 'user', 'settings', 'arrow-left', 'check'] // your SVG names
|
|
92
75
|
</script>
|
|
93
76
|
```
|
|
94
77
|
|
|
95
78
|
---
|
|
96
79
|
|
|
97
|
-
##
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|--------------|-----------------------------|------------------------------------------|
|
|
101
|
-
| `url` | `string` | API endpoint for fetching table data |
|
|
102
|
-
| `columns` | `Column[]` | List of column definitions |
|
|
103
|
-
| `filters` | `Record<string, any>` | Active filters to apply to the request |
|
|
104
|
-
| `page` | `number` (v-model) | Current page |
|
|
105
|
-
| `limit` | `number` (v-model) | Items per page |
|
|
106
|
-
| `sort` | `{ field, direction }` (v-model) | Current sort field and direction |
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## ๐ Column Format
|
|
111
|
-
|
|
112
|
-
```ts
|
|
113
|
-
type Column = {
|
|
114
|
-
name: string // field name from the API response
|
|
115
|
-
label: string // column header label
|
|
116
|
-
type?: 'text' | 'number' | 'date' | 'badge' | 'custom'
|
|
117
|
-
sortable?: boolean // whether this column is sortable
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## ๐ก API Response Format
|
|
124
|
-
|
|
125
|
-
The component expects the API to return:
|
|
126
|
-
|
|
127
|
-
```json
|
|
128
|
-
{
|
|
129
|
-
"data": [ /* array of row objects */ ],
|
|
130
|
-
"total": 100
|
|
131
|
-
}
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
## ๐ค Events
|
|
137
|
-
|
|
138
|
-
| Event | Triggered When |
|
|
139
|
-
|------------------|-------------------------------------|
|
|
140
|
-
| `update:page` | Page number changes |
|
|
141
|
-
| `update:limit` | Page size (limit) changes |
|
|
142
|
-
| `update:sort` | Sorting field or direction changes |
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## ๐งฉ Use Cases
|
|
147
|
-
|
|
148
|
-
Perfect for admin panels, CRM systems, product catalogs, user/order tables, etc.
|
|
80
|
+
## Contributions
|
|
81
|
+
We welcome contributions!
|
|
82
|
+
Feel free to open issues, suggest features, or submit pull requests.
|