@optionfactory/ful 5.0.4 → 6.0.0
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 +102 -0
- package/dist/ful.iife.js +3 -3
- package/dist/ful.iife.js.map +1 -1
- package/dist/ful.iife.min.js +1 -1
- package/dist/ful.iife.min.js.map +1 -1
- package/dist/ful.min.mjs +1 -1
- package/dist/ful.min.mjs.map +1 -1
- package/dist/ful.mjs +3 -3
- package/dist/ful.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,3 +9,105 @@
|
|
|
9
9
|
<script src="https://cdn.jsdelivr.net/npm/@optionfactory/ful@{VERSION}/dist/ful-client-errors.iife.min.js" integrity="sha384-{INTEGRITY}" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
|
10
10
|
|
|
11
11
|
```
|
|
12
|
+
## 🧱 Elements
|
|
13
|
+
### 📊 `<ful-table>` :
|
|
14
|
+
|
|
15
|
+
It allows you to display and interact with paginated, sortable, and filterable data
|
|
16
|
+
|
|
17
|
+
### ⚙️ Attributes
|
|
18
|
+
| Attribute | Type | Description |
|
|
19
|
+
|------------|------|-------------|
|
|
20
|
+
| `src` | `string` | The API endpoint to fetch data from. |
|
|
21
|
+
| `method` | `string` | HTTP method to use . Default: `GET`. |
|
|
22
|
+
| `autoload` | `boolean` | Automatically loads data when the component is mounted. |
|
|
23
|
+
| `page-size` | `number` | Number of items per page. |
|
|
24
|
+
| `loader` | `string` | Optional custom loader (default: `loaders:table`). |
|
|
25
|
+
---
|
|
26
|
+
### 🧩 Structure
|
|
27
|
+
- **`<schema>`** — defines the columns and how data is rendered.
|
|
28
|
+
Each `<column>` can have:
|
|
29
|
+
- `title`: Column header label
|
|
30
|
+
- `sorter`: Field name for sorting
|
|
31
|
+
- `order`: Initial order (`asc` or `desc`)
|
|
32
|
+
### 💡 Example
|
|
33
|
+
```html
|
|
34
|
+
<ful-table src="/api/users/" autoload page-size="5">
|
|
35
|
+
<schema>
|
|
36
|
+
<column title="ID" sorter="id" order="asc">{{ id }}</column>
|
|
37
|
+
<column title="Name" sorter="name">{{ name }}</column>
|
|
38
|
+
<column title="Email">{{ email }}</column>
|
|
39
|
+
</schema>
|
|
40
|
+
</ful-table>
|
|
41
|
+
```
|
|
42
|
+
* Loads user data from `/api/users/`
|
|
43
|
+
* Displays a paginated, sortable table
|
|
44
|
+
* Allows searching by name via the filter input
|
|
45
|
+
* Requires no additional JavaScript
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## 🧮 Filters
|
|
49
|
+
|
|
50
|
+
Filters are placed inside a container with the slot `filters` : `<div slot="filters">` , and are sent automatically with the table request.
|
|
51
|
+
|
|
52
|
+
Each filter returns a structured value automatically :
|
|
53
|
+
|
|
54
|
+
| Filter | Example Value |
|
|
55
|
+
| ------------------------- | ----------------------------------------- |
|
|
56
|
+
| `<ful-filter-text>` | `["CONTAINS", "IGNORE_CASE", "mario"]` |
|
|
57
|
+
| `<ful-filter-local-date>` | `["BETWEEN", "2024-01-01", "2024-12-31"]` |
|
|
58
|
+
| `<ful-filter-instant>` | `["GTE", "2024-03-12T08:00:00.000Z"]` |
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### ✨ Available Filters
|
|
64
|
+
|
|
65
|
+
| Filter Tag | | Input Type | Operators |
|
|
66
|
+
| ------------------------- | ------------------------------------------------------- | -------------- | ------------------------------------------------ |
|
|
67
|
+
| `<ful-filter-text>` | | text | `CONTAINS`, `STARTS_WITH`, `ENDS_WITH`, `EQ` |
|
|
68
|
+
| `<ful-filter-local-date>` | | date | `EQ`, `NEQ`, `LT`, `GT`, `LTE`, `GTE`, `BETWEEN` |
|
|
69
|
+
| `<ful-filter-instant>` | | datetime-local | same as `LocalDate` |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### 💡 Example
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<ful-table src="/your_api/" autoload page-size="10">
|
|
79
|
+
<div slot="filters" class="row mb-3">
|
|
80
|
+
<ful-filter-text class="col" name="byName">Nome</ful-filter-text>
|
|
81
|
+
<ful-filter-instant class="col" name="byCreatedAt">Data</ful-filter-instant>
|
|
82
|
+
<div class="col-auto align-content-end">
|
|
83
|
+
<button type="submit" class="btn btn-primary">
|
|
84
|
+
<i class="bi bi-search"></i>
|
|
85
|
+
</button>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<schema>
|
|
90
|
+
<column title="Nome" sorter="byName">{{ name }}</column>
|
|
91
|
+
<column title="Email">{{ email }}</column>
|
|
92
|
+
<column title="Data">{{ createdAt }}</column>
|
|
93
|
+
</schema>
|
|
94
|
+
</ful-table>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### ⚙️ Filter Attributes
|
|
98
|
+
|
|
99
|
+
| Attribute | Type | Description |
|
|
100
|
+
| ------------ | -------------- | --------------------------------------------------------------- |
|
|
101
|
+
| `name` | `string` | Parameter name sent with the request
|
|
102
|
+
| `value` | `array` (JSON) | Sets an initial operator and value.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
### ⚙️ Backend Integration
|
|
107
|
+
|
|
108
|
+
Filters work seamlessly with the backend using
|
|
109
|
+
`net.optionfactory.spring.data.jpa.filtering.filters`.
|
|
110
|
+
|
|
111
|
+
> 📝 **Note:**
|
|
112
|
+
> **Annotate the fields in your entity** with the appropriate filter annotations (e.g. `@InstantCompare`, `@LocalDateCompare`, `@TextCompare`).
|
|
113
|
+
> The values sent from `<ful-table>` are automatically matched and processed by the backend.
|
package/dist/ful.iife.js
CHANGED
|
@@ -2284,7 +2284,7 @@ var ful = (function (exports, ftl) {
|
|
|
2284
2284
|
if (idx === -1) {
|
|
2285
2285
|
return;
|
|
2286
2286
|
}
|
|
2287
|
-
this.#values.delete(Array.from(this.#values.keys())
|
|
2287
|
+
this.#values.delete(Array.from(this.#values.keys())[idx]);
|
|
2288
2288
|
this.#changed();
|
|
2289
2289
|
this.#syncBadges();
|
|
2290
2290
|
});
|
|
@@ -2297,7 +2297,7 @@ var ful = (function (exports, ftl) {
|
|
|
2297
2297
|
if (idx === -1) {
|
|
2298
2298
|
return;
|
|
2299
2299
|
}
|
|
2300
|
-
this.#values.delete(Array.from(this.#values.keys())
|
|
2300
|
+
this.#values.delete(Array.from(this.#values.keys())[idx]);
|
|
2301
2301
|
this.#changed();
|
|
2302
2302
|
this.#syncBadges();
|
|
2303
2303
|
});
|
|
@@ -3045,7 +3045,7 @@ var ful = (function (exports, ftl) {
|
|
|
3045
3045
|
#latestRequest;
|
|
3046
3046
|
async render({ slots, observed }) {
|
|
3047
3047
|
const template = this.template();
|
|
3048
|
-
const schema = TableSchemaParser.parse(slots.
|
|
3048
|
+
const schema = TableSchemaParser.parse(slots.schema, template);
|
|
3049
3049
|
const fragment = template.withOverlay({ slots, schema }).render();
|
|
3050
3050
|
const tableWrapper = /** @type HTMLTableElement */ (ftl.Nodes.queryChildren(fragment, '.table-wrapper'));
|
|
3051
3051
|
const table = /** @type HTMLTableElement */ (tableWrapper.querySelector("table"));
|