@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 CHANGED
@@ -1,148 +1,82 @@
1
- # ๐Ÿ“Š TableCRM
1
+ # Filter Panel
2
2
 
3
- A reusable Vue 3 component for rendering data tables with external `<table>` markup. Supports automatic data loading, pagination, sorting, and column formatting (`text`, `badge`, `date`, `number`, `custom`).
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
- ## ๐Ÿš€ Features
8
+ ## Features
8
9
 
9
- - Uses external HTML `<table>` structure
10
- - Automatically loads data from API
11
- - Supports sorting and pagination
12
- - Column formatting: `text`, `number`, `date`, `badge`, `custom`
13
- - Syncs with URL-like query params: `page`, `limit`, `sort`, `filter`
14
- - Handles loading, empty, and error states
15
- - Built with TypeScript + Composition API
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
- ## ๐Ÿ’พ Installation
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 install @your-org/table-crm
33
+ npm i @opengis/filter
23
34
  ```
24
-
25
- ```ts
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 TableCRM from '@your-org/table-crm'
40
+ import InlineFilter from 'filter'
30
41
 
31
- createApp(App).component('TableCRM', TableCRM).mount('#app')
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
- <TableCRM
41
- url="/api/products"
42
- :columns="columns"
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 { ref } from 'vue'
75
- import type { Column } from '@your-org/table-crm'
76
-
77
- const page = ref(1)
78
- const limit = ref(10)
79
- const sort = ref({ field: 'name', direction: 'asc' })
80
- const filters = ref({})
81
-
82
- const columns: Column[] = [
83
- { name: 'id', label: 'ID', type: 'text' },
84
- { name: 'name', label: 'Name', type: 'text', sortable: true },
85
- { name: 'price', label: 'Price', type: 'number', sortable: true },
86
- { name: 'status', label: 'Status', type: 'badge' },
87
- ]
88
-
89
- function badgeClass(status: string) {
90
- return status === 'active' ? 'text-green-600' : 'text-gray-400'
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
- ## โš™๏ธ Props
98
-
99
- | Prop | Type | Description |
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.