@threestarsoftware/tssgrid 0.1.30 → 0.1.31
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 +5 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/plugins/tss-comment.js +24 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
TssGrid の各リリースの変更点。日付は JST。形式は [Keep a Changelog](https://keepachangelog.com/ja/1.1.0/) 準拠(ゆるめ)。
|
|
4
4
|
数値は特記なき限り**自社調べ**(headless Chrome / Windows 11・環境差あり)。
|
|
5
5
|
|
|
6
|
+
## [0.1.31] - 2026-10-29
|
|
7
|
+
|
|
8
|
+
### 改善(プラグイン)
|
|
9
|
+
- **`tss-comment` を実機タッチ対応** — これまで吹き出しは**ホバー(`mouseover`)**だけで、スマホ等のタッチ端末では合成 hover 任せ=不安定だった。**タッチのときはタップで吹き出しをトグル**するよう分岐(同じセル再タップ・コメント外タップで閉じる)。マウスは従来どおりホバー(`pointerdown` の `pointerType` で判定)。desktop の挙動は不変。
|
|
10
|
+
|
|
6
11
|
## [0.1.30] - 2026-10-28
|
|
7
12
|
|
|
8
13
|
### 追加(プラグイン)
|
package/README.md
CHANGED
|
@@ -547,7 +547,7 @@ new TssGrid(el, { columns: [{ type: 'time', editor: t }] });
|
|
|
547
547
|
|
|
548
548
|
### 同梱プラグイン: セルのコメント(tss-comment・Excel のメモ風)
|
|
549
549
|
|
|
550
|
-
`plugins/tss-comment.js`=
|
|
550
|
+
`plugins/tss-comment.js`= セルに注釈を付ける。コメントのあるセルは**右上に赤い三角**、**PC はホバー・スマホはタップで吹き出し**、**右クリック or Shift+F2 で挿入・編集・削除**。動く例: [`examples/comment.html`](https://tssgrid.threestarsoftware.co.jp/examples/comment.html)。
|
|
551
551
|
|
|
552
552
|
**★他プラグインと干渉しません**:セルのフック(`cellClass`/`cellStyle`/`editor`/`format`)を一切奪わず、コメント済みの `<td>` に自前でクラスを足すだけ(再描画追従は `MutationObserver`)。条件付き書式・heatmap・cascade/calendar と**同じセルで共存**できます。
|
|
553
553
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threestarsoftware/tssgrid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"description": "軽量・ノービルド・日本語IME堅牢な編集グリッド(vanilla JS / 依存なし / MIT)。Excel ライクな入力画面を <script> タグ1本で。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ThreeStarSoftware (https://www.threestarsoftware.co.jp/)",
|
package/plugins/tss-comment.js
CHANGED
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
|
|
48
48
|
var host = grid.root || (grid.table.closest && grid.table.closest('.tssgrid')) || grid.table;
|
|
49
49
|
var store = new Map(); // key(id\0dataKey) -> text
|
|
50
|
-
var bubble = null, editor = null, edCell = null, outside = null, hideT = 0, rafId = 0, dead = false;
|
|
50
|
+
var bubble = null, bubbleTd = null, editor = null, edCell = null, outside = null, hideT = 0, rafId = 0, dead = false;
|
|
51
|
+
var lastTouch = false; // 直前の入力がタッチか。スマホはホバーが無い=合成 mouseover に頼らず tap で出す
|
|
51
52
|
|
|
52
53
|
// 初期コメント(保存済み)を取り込む
|
|
53
54
|
(opts.comments || []).forEach(function (cm) {
|
|
@@ -103,9 +104,11 @@
|
|
|
103
104
|
bubble.textContent = text;
|
|
104
105
|
document.body.appendChild(bubble);
|
|
105
106
|
place(bubble, td);
|
|
107
|
+
bubbleTd = td;
|
|
106
108
|
}
|
|
107
|
-
function hideBubble() { if (bubble) { bubble.remove(); bubble = null; } }
|
|
109
|
+
function hideBubble() { if (bubble) { bubble.remove(); bubble = null; } bubbleTd = null; }
|
|
108
110
|
function onOver(e) {
|
|
111
|
+
if (lastTouch) return; // タッチはホバーに頼らず onTap で出す(合成 mouseover の誤発火を避ける)
|
|
109
112
|
var td = e.target.closest && e.target.closest('td.tg-comment-mark');
|
|
110
113
|
if (!td || !grid.table.contains(td)) return;
|
|
111
114
|
if (hideT) { clearTimeout(hideT); hideT = 0; }
|
|
@@ -114,11 +117,24 @@
|
|
|
114
117
|
if (text != null) showBubble(td, text);
|
|
115
118
|
}
|
|
116
119
|
function onOut(e) {
|
|
120
|
+
if (lastTouch) return;
|
|
117
121
|
var td = e.target.closest && e.target.closest('td.tg-comment-mark');
|
|
118
122
|
if (!td) return;
|
|
119
123
|
if (e.relatedTarget && td.contains(e.relatedTarget)) return; // セル内の移動は無視
|
|
120
124
|
hideT = setTimeout(hideBubble, 60);
|
|
121
125
|
}
|
|
126
|
+
// 入力種別の記録。マウス=hover、タッチ=tap に振り分ける(pointerdown が click の前に走る)。
|
|
127
|
+
function onPointerDown(e) { if (e.pointerType) lastTouch = (e.pointerType === 'touch'); }
|
|
128
|
+
function onTouchStart() { lastTouch = true; } // PointerEvent 非対応ブラウザの保険
|
|
129
|
+
// タッチ時のみ: コメント済みセルのタップで吹き出しをトグル(同セル再タップ・コメント外タップで閉じる)。
|
|
130
|
+
function onTap(e) {
|
|
131
|
+
if (!lastTouch) return; // マウスのクリックは無視=desktop は hover のまま
|
|
132
|
+
var td = e.target.closest && e.target.closest('td.tg-comment-mark');
|
|
133
|
+
if (!td || !grid.table.contains(td)) { hideBubble(); return; }
|
|
134
|
+
if (bubble && bubbleTd === td) { hideBubble(); return; }
|
|
135
|
+
var r = +td.getAttribute('data-r'), c = +td.getAttribute('data-c'), text = getText(r, c);
|
|
136
|
+
if (text != null) showBubble(td, text);
|
|
137
|
+
}
|
|
122
138
|
|
|
123
139
|
// ── 編集ポップアップ ───────────────────────────────────
|
|
124
140
|
function openEditor(r, c) {
|
|
@@ -198,6 +214,9 @@
|
|
|
198
214
|
|
|
199
215
|
grid.table.addEventListener('mouseover', onOver);
|
|
200
216
|
grid.table.addEventListener('mouseout', onOut);
|
|
217
|
+
grid.table.addEventListener('pointerdown', onPointerDown, true);
|
|
218
|
+
grid.table.addEventListener('touchstart', onTouchStart, { capture: true, passive: true });
|
|
219
|
+
grid.table.addEventListener('click', onTap);
|
|
201
220
|
host.addEventListener('keydown', onKey, true);
|
|
202
221
|
scheduleDecorate();
|
|
203
222
|
|
|
@@ -241,6 +260,9 @@
|
|
|
241
260
|
try { mo.disconnect(); } catch (e) { /* noop */ }
|
|
242
261
|
grid.table && grid.table.removeEventListener('mouseover', onOver);
|
|
243
262
|
grid.table && grid.table.removeEventListener('mouseout', onOut);
|
|
263
|
+
grid.table && grid.table.removeEventListener('pointerdown', onPointerDown, true);
|
|
264
|
+
grid.table && grid.table.removeEventListener('touchstart', onTouchStart, true);
|
|
265
|
+
grid.table && grid.table.removeEventListener('click', onTap);
|
|
244
266
|
host.removeEventListener('keydown', onKey, true);
|
|
245
267
|
if (outside) { document.removeEventListener('mousedown', outside, true); outside = null; }
|
|
246
268
|
hideBubble(); closeEditor();
|