@yuneta/gobj-ui 7.26.36 → 7.26.37
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/package.json +1 -1
- package/src/tabulator.css +19 -3
- package/src/tabulator_css.test.js +63 -0
package/package.json
CHANGED
package/src/tabulator.css
CHANGED
|
@@ -186,11 +186,16 @@
|
|
|
186
186
|
* (`.tabulator-editing {padding: 0}`) and the control brings its own, so
|
|
187
187
|
* the text jumps sideways too. Inherit the font and restore the cell's 4px
|
|
188
188
|
* so entering edit mode changes nothing but the caret.
|
|
189
|
+
*
|
|
190
|
+
* A box to type in, never a box to TICK: a checkbox or a radio given the
|
|
191
|
+
* whole cell is drawn as a square the size of the cell -- the tickCross
|
|
192
|
+
* editor of a boolean (estadodelaire's "validated") opened as a huge empty
|
|
193
|
+
* box on a phone, which read as broken. Those keep their own size.
|
|
189
194
|
* ==================================================================== */
|
|
190
|
-
.tabulator-row .tabulator-cell.tabulator-editing input,
|
|
195
|
+
.tabulator-row .tabulator-cell.tabulator-editing input:not([type=checkbox]):not([type=radio]),
|
|
191
196
|
.tabulator-row .tabulator-cell.tabulator-editing select,
|
|
192
197
|
.tabulator-row .tabulator-cell.tabulator-editing textarea,
|
|
193
|
-
.tabulator .tabulator-header .tabulator-header-filter input,
|
|
198
|
+
.tabulator .tabulator-header .tabulator-header-filter input:not([type=checkbox]):not([type=radio]),
|
|
194
199
|
.tabulator .tabulator-header .tabulator-header-filter select {
|
|
195
200
|
font-family: inherit;
|
|
196
201
|
font-size: inherit;
|
|
@@ -199,11 +204,22 @@
|
|
|
199
204
|
padding: 0 4px;
|
|
200
205
|
}
|
|
201
206
|
|
|
202
|
-
.tabulator-row .tabulator-cell.tabulator-editing input,
|
|
207
|
+
.tabulator-row .tabulator-cell.tabulator-editing input:not([type=checkbox]):not([type=radio]),
|
|
203
208
|
.tabulator-row .tabulator-cell.tabulator-editing select {
|
|
204
209
|
height: 100%;
|
|
205
210
|
}
|
|
206
211
|
|
|
212
|
+
/* The box to tick, sized for a finger where there is one: the browser's
|
|
213
|
+
* own checkbox is ~13px, too small to hit on a phone -- and the cell
|
|
214
|
+
* is no size for it either (above). */
|
|
215
|
+
@media (pointer: coarse) {
|
|
216
|
+
.tabulator-row .tabulator-cell.tabulator-editing input[type=checkbox],
|
|
217
|
+
.tabulator-row .tabulator-cell.tabulator-editing input[type=radio] {
|
|
218
|
+
width: 1.5rem;
|
|
219
|
+
height: 1.5rem;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
207
223
|
/*
|
|
208
224
|
* The CELL EDITOR in dark theme.
|
|
209
225
|
*
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/***********************************************************************
|
|
2
|
+
* tabulator_css.test.js
|
|
3
|
+
*
|
|
4
|
+
* The stylesheet of the tables: an editor fills its cell only when
|
|
5
|
+
* it is a box to TYPE in. A checkbox or a radio given width and
|
|
6
|
+
* height 100% is drawn as a square the size of the cell (the
|
|
7
|
+
* tickCross editor of estadodelaire's "validated" opened as a huge
|
|
8
|
+
* empty box on a phone, gobj-ui 7.26.36).
|
|
9
|
+
*
|
|
10
|
+
* Read as text, as the window layer's invariants are: jsdom applies
|
|
11
|
+
* no stylesheet.
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) 2026, ArtGins.
|
|
14
|
+
* All Rights Reserved.
|
|
15
|
+
***********************************************************************/
|
|
16
|
+
import {describe, test, expect} from "vitest";
|
|
17
|
+
import {readFileSync} from "node:fs";
|
|
18
|
+
import {dirname, join} from "node:path";
|
|
19
|
+
import {fileURLToPath} from "node:url";
|
|
20
|
+
|
|
21
|
+
const CSS = readFileSync(join(dirname(fileURLToPath(import.meta.url)), "tabulator.css"), "utf8")
|
|
22
|
+
.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
23
|
+
|
|
24
|
+
/* Every rule: its selectors, and its body. */
|
|
25
|
+
function rules()
|
|
26
|
+
{
|
|
27
|
+
const out = [];
|
|
28
|
+
const re = /([^{}]+)\{([^{}]*)\}/g;
|
|
29
|
+
let m;
|
|
30
|
+
while((m = re.exec(CSS)) !== null) {
|
|
31
|
+
out.push({
|
|
32
|
+
selectors: m[1].split(",").map((s) => s.trim()).filter(Boolean),
|
|
33
|
+
body: m[2]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
describe("an editor fills its cell only when it is a box to type in", () => {
|
|
40
|
+
test("no rule sizes a checkbox or a radio of a table to its cell", () => {
|
|
41
|
+
const offenders = [];
|
|
42
|
+
for(const r of rules()) {
|
|
43
|
+
if(!/\b(width|height)\s*:\s*100%/.test(r.body)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
for(const sel of r.selectors) {
|
|
47
|
+
/* A bare `input` in a cell editor or a header filter reaches
|
|
48
|
+
* a checkbox too, unless the selector leaves it out. */
|
|
49
|
+
if(/\binput\b/.test(sel) && /tabulator/.test(sel) &&
|
|
50
|
+
!(/:not\(\[type=checkbox\]\)/.test(sel) && /:not\(\[type=radio\]\)/.test(sel))) {
|
|
51
|
+
offenders.push(sel);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
expect(offenders).toEqual([]);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("a text input of a cell being edited still fills it", () => {
|
|
59
|
+
const fill = rules().filter((r) => /\bwidth\s*:\s*100%/.test(r.body) &&
|
|
60
|
+
r.selectors.some((s) => /tabulator-editing input:not\(\[type=checkbox\]\)/.test(s)));
|
|
61
|
+
expect(fill.length).toBeGreaterThan(0);
|
|
62
|
+
});
|
|
63
|
+
});
|