@teipublisher/pb-components 3.0.9 → 3.2.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/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ # [3.2.0](https://github.com/eeditiones/tei-publisher-components/compare/v3.1.0...v3.2.0) (2026-03-26)
2
+
3
+
4
+ ### Features
5
+
6
+ * **pb-table-grid:** allow columns to be hidden/shown dynamically ([297fb8b](https://github.com/eeditiones/tei-publisher-components/commit/297fb8bd93701b88281bfb2cd19e6a631cb2880e))
7
+ * **pb-table-grid:** highlight currently selected row ([27bf14d](https://github.com/eeditiones/tei-publisher-components/commit/27bf14d4d44413ea4f673157e40fbcce0228e81c))
8
+
9
+ # [3.1.0](https://github.com/eeditiones/tei-publisher-components/compare/v3.0.9...v3.1.0) (2026-03-25)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **pb-table-grid:** make search string in pb-table-grid localizable ([25079f1](https://github.com/eeditiones/tei-publisher-components/commit/25079f1084a52f5f0a8a4943f3c9c3d1f237ddc5))
15
+
16
+
17
+ ### Features
18
+
19
+ * **pb-table-grid:** add attribute to move pagination to the top ([fbb8b90](https://github.com/eeditiones/tei-publisher-components/commit/fbb8b901e625365102e88571e71646f785319ded))
20
+ * **pb-table-grid:** make pb-table-grid stylable like other components ([01b6705](https://github.com/eeditiones/tei-publisher-components/commit/01b6705f43cba8dfdf20c8c5923918680003764a))
21
+
1
22
  ## [3.0.9](https://github.com/eeditiones/tei-publisher-components/compare/v3.0.8...v3.0.9) (2026-03-18)
2
23
 
3
24
 
@@ -160,7 +160,8 @@
160
160
  "demo/pb-formula.html": "Demo"
161
161
  },
162
162
  "pb-table-grid": {
163
- "demo/pb-table-grid.html": "Demo"
163
+ "demo/pb-table-grid.html": "Demo",
164
+ "demo/pb-table-grid2.html": "Demo with Search"
164
165
  },
165
166
  "pb-custom-form": {
166
167
  "demo/pb-custom-form.html": "Demo"
@@ -0,0 +1,89 @@
1
+ <html>
2
+ <head>
3
+ <title>Using pb-table-grid with Search and Pagination</title>
4
+ <script>
5
+ // This patches the normal 'fetch' to handle calls to `/philosophers.json`. The public
6
+ // demos are static pages. Handle the sorting and filtering that would normaly happen on
7
+ // the back-end
8
+ let cache = null;
9
+ const originalFetch = window.fetch;
10
+ window.fetch = async (url, opts) => {
11
+ const u = new URL(String(url));
12
+ if (!u.pathname.endsWith('/philosophers.json')) {
13
+ // Fall back to regular fetch
14
+ return originalFetch.call(this, url, opts);
15
+ }
16
+ if (!cache) {
17
+ const resp = await originalFetch.call(this, u, opts);
18
+ cache = (await resp.json()).results;
19
+ }
20
+ // Keep the cached value intact
21
+ let results = [...cache];
22
+ const { searchParams } = u;
23
+ const search = searchParams.get('search');
24
+ const orderField = searchParams.get('order');
25
+ const dir = searchParams.get('dir');
26
+ const limit = parseInt(searchParams.get('limit') || '5', 10);
27
+ const start = parseInt(searchParams.get('start') || '1', 10);
28
+ if (search) {
29
+ const term = search.toLowerCase();
30
+ results = results.filter(r => Object.values(r).some(v => v.toLowerCase().includes(term)));
31
+ }
32
+ if (orderField) {
33
+ results.sort((a, b) => {
34
+ const av = a[orderField] ?? '';
35
+ const bv = b[orderField] ?? '';
36
+ return dir === 'desc' ? bv.localeCompare(av) : av.localeCompare(bv);
37
+ });
38
+ }
39
+ const count = results.length;
40
+ results = results.slice(Math.max(0, start - 1), Math.max(0, start - 1) + limit);
41
+ return new Response(JSON.stringify({ count, results }), {
42
+ headers: { 'Content-Type': 'application/json' },
43
+ });
44
+ };
45
+ </script>
46
+ <script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script><script type="module" src="../pb-components-bundle.js"></script>
47
+ </head>
48
+ <body>
49
+ <h1>Using pb-table-grid with Search and Pagination</h1>
50
+
51
+ <pb-page theme="components.css" url-path="query" api-version="1.0.0">
52
+ <label>
53
+ <input id="compact-view" type="checkbox" />
54
+ Compact view (hide "Born" and "Died" columns)
55
+ </label>
56
+ <pb-table-grid
57
+ id="philosophers-grid"
58
+ class="table-grid"
59
+ source="./philosophers.json"
60
+ css-path="../css/gridjs"
61
+ resizable
62
+ search
63
+ per-page="5"
64
+ pagination-top
65
+ >
66
+ <pb-table-column label="Name" property="name" sort width="25%"></pb-table-column>
67
+ <pb-table-column label="Born" property="birth" sort width="15%"></pb-table-column>
68
+ <pb-table-column label="Died" property="death" sort width="15%"></pb-table-column>
69
+ <pb-table-column
70
+ label="Nationality"
71
+ property="nationality"
72
+ sort
73
+ width="20%"
74
+ ></pb-table-column>
75
+ <pb-table-column label="Known For" property="known_for"></pb-table-column>
76
+ </pb-table-grid>
77
+ </pb-page>
78
+ <script type="module">
79
+ const compactCheckbox = document.getElementById('compact-view');
80
+ const tableGrid = document.getElementById('philosophers-grid');
81
+
82
+ compactCheckbox.addEventListener('change', () => {
83
+ tableGrid.visibleColumns = compactCheckbox.checked
84
+ ? ['name', 'nationality', 'known_for']
85
+ : ['name', 'birth', 'death', 'nationality', 'known_for'];
86
+ });
87
+ </script>
88
+ </body>
89
+ </html>
@@ -0,0 +1,180 @@
1
+ {
2
+ "count": 25,
3
+ "results": [
4
+ {
5
+ "name": "Immanuel Kant",
6
+ "birth": "1724-04-22",
7
+ "death": "1804-02-12",
8
+ "nationality": "German",
9
+ "known_for": "Critique of Pure Reason"
10
+ },
11
+ {
12
+ "name": "Friedrich Nietzsche",
13
+ "birth": "1844-10-15",
14
+ "death": "1900-08-25",
15
+ "nationality": "German",
16
+ "known_for": "Thus Spoke Zarathustra"
17
+ },
18
+ {
19
+ "name": "Georg Wilhelm Friedrich Hegel",
20
+ "birth": "1770-08-27",
21
+ "death": "1831-11-14",
22
+ "nationality": "German",
23
+ "known_for": "Phenomenology of Spirit"
24
+ },
25
+ {
26
+ "name": "Gottfried Wilhelm Leibniz",
27
+ "birth": "1646-07-01",
28
+ "death": "1716-11-14",
29
+ "nationality": "German",
30
+ "known_for": "Monadology"
31
+ },
32
+ {
33
+ "name": "Søren Kierkegaard",
34
+ "birth": "1813-05-05",
35
+ "death": "1855-11-11",
36
+ "nationality": "Danish",
37
+ "known_for": "Either/Or"
38
+ },
39
+ {
40
+ "name": "Ludwig Feuerbach",
41
+ "birth": "1804-07-28",
42
+ "death": "1872-09-13",
43
+ "nationality": "German",
44
+ "known_for": "The Essence of Christianity"
45
+ },
46
+ {
47
+ "name": "René Descartes",
48
+ "birth": "1596-03-31",
49
+ "death": "1650-02-11",
50
+ "nationality": "French",
51
+ "known_for": "Meditations on First Philosophy"
52
+ },
53
+ {
54
+ "name": "Baruch Spinoza",
55
+ "birth": "1632-11-24",
56
+ "death": "1677-02-21",
57
+ "nationality": "Dutch",
58
+ "known_for": "Ethics"
59
+ },
60
+ {
61
+ "name": "John Locke",
62
+ "birth": "1632-08-29",
63
+ "death": "1704-10-28",
64
+ "nationality": "English",
65
+ "known_for": "An Essay Concerning Human Understanding"
66
+ },
67
+ {
68
+ "name": "David Hume",
69
+ "birth": "1711-05-07",
70
+ "death": "1776-08-25",
71
+ "nationality": "Scottish",
72
+ "known_for": "A Treatise of Human Nature"
73
+ },
74
+ {
75
+ "name": "John Stuart Mill",
76
+ "birth": "1806-05-20",
77
+ "death": "1873-05-08",
78
+ "nationality": "English",
79
+ "known_for": "Utilitarianism"
80
+ },
81
+ {
82
+ "name": "Arthur Schopenhauer",
83
+ "birth": "1788-02-22",
84
+ "death": "1860-09-21",
85
+ "nationality": "German",
86
+ "known_for": "The World as Will and Representation"
87
+ },
88
+ {
89
+ "name": "Gottlob Frege",
90
+ "birth": "1848-11-08",
91
+ "death": "1925-07-26",
92
+ "nationality": "German",
93
+ "known_for": "Begriffsschrift"
94
+ },
95
+ {
96
+ "name": "Bertrand Russell",
97
+ "birth": "1872-05-18",
98
+ "death": "1970-02-02",
99
+ "nationality": "British",
100
+ "known_for": "Principia Mathematica"
101
+ },
102
+ {
103
+ "name": "Ludwig Wittgenstein",
104
+ "birth": "1889-04-26",
105
+ "death": "1951-04-29",
106
+ "nationality": "Austrian",
107
+ "known_for": "Tractatus Logico-Philosophicus"
108
+ },
109
+ {
110
+ "name": "Martin Heidegger",
111
+ "birth": "1889-09-26",
112
+ "death": "1976-05-26",
113
+ "nationality": "German",
114
+ "known_for": "Being and Time"
115
+ },
116
+ {
117
+ "name": "Jean-Paul Sartre",
118
+ "birth": "1905-06-21",
119
+ "death": "1980-04-15",
120
+ "nationality": "French",
121
+ "known_for": "Being and Nothingness"
122
+ },
123
+ {
124
+ "name": "Simone de Beauvoir",
125
+ "birth": "1908-01-09",
126
+ "death": "1986-04-14",
127
+ "nationality": "French",
128
+ "known_for": "The Second Sex"
129
+ },
130
+ {
131
+ "name": "Hannah Arendt",
132
+ "birth": "1906-10-14",
133
+ "death": "1975-12-04",
134
+ "nationality": "German-American",
135
+ "known_for": "The Origins of Totalitarianism"
136
+ },
137
+ {
138
+ "name": "Edmund Husserl",
139
+ "birth": "1859-04-08",
140
+ "death": "1938-04-27",
141
+ "nationality": "German",
142
+ "known_for": "Logical Investigations"
143
+ },
144
+ {
145
+ "name": "Karl Marx",
146
+ "birth": "1818-05-05",
147
+ "death": "1883-03-14",
148
+ "nationality": "German",
149
+ "known_for": "Das Kapital"
150
+ },
151
+ {
152
+ "name": "Friedrich Engels",
153
+ "birth": "1820-11-28",
154
+ "death": "1895-08-05",
155
+ "nationality": "German",
156
+ "known_for": "The Communist Manifesto"
157
+ },
158
+ {
159
+ "name": "Auguste Comte",
160
+ "birth": "1798-01-19",
161
+ "death": "1857-09-05",
162
+ "nationality": "French",
163
+ "known_for": "The Course in Positive Philosophy"
164
+ },
165
+ {
166
+ "name": "Henri Bergson",
167
+ "birth": "1859-10-18",
168
+ "death": "1941-01-04",
169
+ "nationality": "French",
170
+ "known_for": "Time and Free Will"
171
+ },
172
+ {
173
+ "name": "Ernst Cassirer",
174
+ "birth": "1874-07-28",
175
+ "death": "1945-04-13",
176
+ "nationality": "German",
177
+ "known_for": "Philosophy of Symbolic Forms"
178
+ }
179
+ ]
180
+ }