@threestarsoftware/tssgrid 0.1.12 → 0.1.13

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
@@ -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.13] - 2026-09-24
7
+
8
+ ### 追加
9
+ - **エディタ系プラグイン6つに型定義 `.d.ts` を同梱(TypeScript ファースト)** — `columns[c].editor` に入れるエディタ工場プラグインを **`import` するだけで型が効く**ように。対象は `tss-combo` / `tss-autocomplete` / `tss-cascade` / `tss-calendar` / `tss-datetime` / `tss-time`。UMD 形(`export =` + `export as namespace`)なので **module import でも `<script>` グローバルでも**型が効く。戻り値は `EditorDef` を満たし、静的メソッド(`TssCombo.codeOf` / `TssCascade.pathFormat`・`pathOf` / `TssDatetime.format`)や単体 `openAt` も型付け。`package.json` の `exports` に6プラグインの `types` エントリを追加(その他の `usePlugin`/`format` 系プラグインは従来どおり untyped=必要なら5行のアンビエント宣言で補える。README 参照)。コア無改変。
10
+
6
11
  ## [0.1.12] - 2026-09-24
7
12
 
8
13
  ### 追加
package/README.md CHANGED
@@ -56,6 +56,18 @@ import '@threestarsoftware/tssgrid/tssgrid.css';
56
56
  ```
57
57
  **型定義 (`.d.ts`) 同梱**なので TypeScript ではそのまま補完が効きます(APIリファレンス → [tssgrid…/api](https://tssgrid.threestarsoftware.co.jp/api.html))。
58
58
 
59
+ **プラグインの型(TypeScript)**: エディタ系プラグインは **`.d.ts` 同梱で `import` するだけで型が効きます**(`.js` 付きで import):
60
+ ```ts
61
+ import TssCombo from '@threestarsoftware/tssgrid/plugins/tss-combo.js'; // ← 型が効く
62
+ // 対応: tss-combo / tss-autocomplete / tss-cascade / tss-calendar / tss-datetime / tss-time
63
+ columns: [{ data: 'pay', editor: TssCombo({ options: [{ code: '01', label: '現金' }], other: { code: '99', label: 'その他' }, codeField: 'payCode' }) }];
64
+ ```
65
+ それ以外のプラグイン(`usePlugin` 系・`format` ヘルパ系)は型定義がまだ無いので、必要なら5行のアンビエント宣言で補えます(`editor.open/close` を持つ戻り値は `EditorDef`):
66
+ ```ts
67
+ import type { EditorDef } from '@threestarsoftware/tssgrid';
68
+ declare function TssXxx(opts: any): EditorDef; // 未同梱プラグインの暫定宣言
69
+ ```
70
+
59
71
  **Node / CommonJS**:
60
72
 
61
73
  ```js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threestarsoftware/tssgrid",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "軽量・ノービルド・日本語IME堅牢な編集グリッド(vanilla JS / 依存なし / MIT)。Excel ライクな入力画面を <script> タグ1本で。",
5
5
  "license": "MIT",
6
6
  "author": "ThreeStarSoftware (https://www.threestarsoftware.co.jp/)",
@@ -35,6 +35,30 @@
35
35
  "default": "./src/tssgrid.js"
36
36
  },
37
37
  "./tssgrid.css": "./src/tssgrid.css",
38
+ "./plugins/tss-combo.js": {
39
+ "types": "./plugins/tss-combo.d.ts",
40
+ "default": "./plugins/tss-combo.js"
41
+ },
42
+ "./plugins/tss-autocomplete.js": {
43
+ "types": "./plugins/tss-autocomplete.d.ts",
44
+ "default": "./plugins/tss-autocomplete.js"
45
+ },
46
+ "./plugins/tss-cascade.js": {
47
+ "types": "./plugins/tss-cascade.d.ts",
48
+ "default": "./plugins/tss-cascade.js"
49
+ },
50
+ "./plugins/tss-calendar.js": {
51
+ "types": "./plugins/tss-calendar.d.ts",
52
+ "default": "./plugins/tss-calendar.js"
53
+ },
54
+ "./plugins/tss-datetime.js": {
55
+ "types": "./plugins/tss-datetime.d.ts",
56
+ "default": "./plugins/tss-datetime.js"
57
+ },
58
+ "./plugins/tss-time.js": {
59
+ "types": "./plugins/tss-time.d.ts",
60
+ "default": "./plugins/tss-time.js"
61
+ },
38
62
  "./plugins/*": "./plugins/*",
39
63
  "./package.json": "./package.json"
40
64
  },
@@ -0,0 +1,32 @@
1
+ // TssAutocomplete — 候補サジェスト付きテキスト入力(TssGrid カスタムエディタ)。
2
+ import { EditorDef } from '../src/tssgrid';
3
+
4
+ export = TssAutocomplete;
5
+ export as namespace TssAutocomplete;
6
+
7
+ declare function TssAutocomplete(opts: TssAutocomplete.Options): EditorDef;
8
+
9
+ declare namespace TssAutocomplete {
10
+ interface SourceCtx { row: any; r: number; c: number; grid: any; }
11
+
12
+ interface Options {
13
+ /** 候補。配列 or `(query, ctx) => string[]`(動的候補)。 */
14
+ source: string[] | ((query: string, ctx: SourceCtx) => string[]);
15
+ /** 共有 input に乗る型(既定 true)=打鍵の1文字目・IME 直打ちが効く。false で自前 input ポップアップ。 */
16
+ inline?: boolean;
17
+ /** true=候補から選んだ値のみ許可(既定 false=自由入力可)。 */
18
+ strict?: boolean;
19
+ /** この文字数以上で候補を出す(既定 0=開いた時点で全件)。 */
20
+ minChars?: number;
21
+ /** 候補表示の最大件数(既定 20)。 */
22
+ max?: number;
23
+ /** 照合方法(既定 'includes')。大文字小文字は無視。 */
24
+ match?: 'includes' | 'startsWith' | ((item: string, query: string) => boolean);
25
+ /** シングルクリックで開く(既定 true)。 */
26
+ openOnClick?: boolean;
27
+ /** セル右端の目印(既定 '▾')。 */
28
+ icon?: string;
29
+ /** ポップアップに付ける任意クラス。 */
30
+ className?: string;
31
+ }
32
+ }
@@ -0,0 +1,44 @@
1
+ // TssCalendar — 休日対応カレンダー(TssGrid カスタムエディタ/単体ピッカーとしても)。保存値は 'YYYY-MM-DD'。
2
+ import { EditorDef } from '../src/tssgrid';
3
+
4
+ export = TssCalendar;
5
+ export as namespace TssCalendar;
6
+
7
+ declare function TssCalendar(opts?: TssCalendar.Options): TssCalendar.Editor;
8
+
9
+ declare namespace TssCalendar {
10
+ /** 休日マップ。`'YYYY-MM-DD'` → 名称文字列 or `{name, type?}`。 */
11
+ type Holidays = Record<string, string | { name: string; type?: string }>;
12
+
13
+ interface Options {
14
+ holidays?: Holidays;
15
+ /** 週末とみなす曜日(0=日, 6=土。既定 [0,6])。 */
16
+ weekend?: number[];
17
+ /** 曜日ラベル(既定 ['日','月',…,'土'])。 */
18
+ weekLabels?: string[];
19
+ /** 月見出し(既定 `y年(m+1)月`)。 */
20
+ monthLabel?: (year: number, month: number) => string;
21
+ /** 選択可能範囲('YYYY-MM-DD')。 */
22
+ min?: string;
23
+ max?: string;
24
+ /** 年プルダウンの範囲。 */
25
+ yearMin?: number;
26
+ yearMax?: number;
27
+ /** 選択不可にする種別(例 ['holiday','weekend'])。 */
28
+ disable?: Array<'holiday' | 'weekend' | string>;
29
+ /** 共有 input に乗る型(既定 true)=直打ち可・矢印は本体へ。false でフォーカス奪取型。 */
30
+ inline?: boolean;
31
+ /** シングルクリックで開く(既定 true)。 */
32
+ openOnClick?: boolean;
33
+ /** セル右端の目印(既定 '📅'。'' で消す)。 */
34
+ icon?: string;
35
+ /** ポップアップに付ける任意クラス。 */
36
+ className?: string;
37
+ }
38
+
39
+ /** グリッドの `editor` として使えるほか、単体で `openAt` を呼べる。 */
40
+ interface Editor extends EditorDef {
41
+ /** アンカー要素の下に開き、日付選択で `onPick(iso)` を呼ぶ(単体ピッカー用)。 */
42
+ openAt(anchorEl: Element, isoValue: string, onPick: (iso: string) => void): void;
43
+ }
44
+ }
@@ -0,0 +1,26 @@
1
+ // TssCascade — 多段(フライアウト)プルダウン(TssGrid カスタムエディタ・ポップアップ型)。
2
+ import { EditorDef } from '../src/tssgrid';
3
+
4
+ export = TssCascade;
5
+ export as namespace TssCascade;
6
+
7
+ declare function TssCascade(opts: TssCascade.Options): EditorDef;
8
+
9
+ declare namespace TssCascade {
10
+ /** ノード。枝は `children`、葉は `value`(未指定なら `label` を保存)。 */
11
+ interface Node { label: string; value?: string | number; children?: Node[]; }
12
+
13
+ interface Options {
14
+ /** 入れ子の選択肢。 */
15
+ options: Node[];
16
+ /** シングルクリックで開く(既定 true)。 */
17
+ openOnClick?: boolean;
18
+ /** ポップアップに付ける任意クラス。 */
19
+ className?: string;
20
+ }
21
+
22
+ /** 列 format 用: 値 → 「大 / 中 / 小」のパス文字列を返す関数。 */
23
+ function pathFormat(options: Node[], opts?: { separator?: string }): (value: any) => string;
24
+ /** 値 → パス文字列(単発)。 */
25
+ function pathOf(options: Node[], value: any, separator?: string): string;
26
+ }
@@ -0,0 +1,37 @@
1
+ // TssCombo — コード付きプルダウン+「その他」で自由入力(TssGrid カスタムエディタ)。
2
+ // UMD: `import TssCombo from '@threestarsoftware/tssgrid/plugins/tss-combo.js'` でも、<script> タグのグローバル `TssCombo` でも使える。
3
+ import { EditorDef } from '../src/tssgrid';
4
+
5
+ export = TssCombo;
6
+ export as namespace TssCombo;
7
+
8
+ declare function TssCombo(opts: TssCombo.Options): EditorDef;
9
+
10
+ declare namespace TssCombo {
11
+ /** 選択肢1件。`code`(別名 `value`)と表示 `label`。文字列を渡すと code=label。 */
12
+ interface Option { code?: string | number; value?: string | number; label?: string; }
13
+
14
+ interface Options {
15
+ /** 選択肢。`{code,label}` か文字列(code=label)の配列。 */
16
+ options: Array<Option | string>;
17
+ /** 「その他」を有効化。`true` で `{code:'99', label:'その他'}`。選ぶと入力欄に切替。省略で自由入力なし。 */
18
+ other?: boolean | Option;
19
+ /** コードの書き戻し先の列(data キー or 列 index)。省略時はコードを書かず値だけ確定。 */
20
+ codeField?: string | number;
21
+ /** その他モードの入力欄プレースホルダ(既定 '自由入力')。 */
22
+ otherPlaceholder?: string;
23
+ /** シングルクリックで開く(既定 true)。 */
24
+ openOnClick?: boolean;
25
+ /** セル右端の目印(既定 '▾')。 */
26
+ icon?: string;
27
+ /** ポップアップに付ける任意クラス。 */
28
+ className?: string;
29
+ }
30
+
31
+ /**
32
+ * 値 → コードを引く関数を返す(同じ options/other から)。undo/redo・貼付でコードを値に追従させたい時、
33
+ * `onAfterChange` の中で `grid.setValueRaw(r, コード列, codeOf(grid.getValue(r, 値列)))` のように使う。
34
+ * 値が選択肢に無ければ other の code、空なら ''。
35
+ */
36
+ function codeOf(opts: { options: Array<Option | string>; other?: boolean | Option }): (value: any) => string;
37
+ }
@@ -0,0 +1,42 @@
1
+ // TssDatetime — 日付+時刻ピッカー(TssGrid カスタムエディタ/単体でも)。保存値は 'YYYY-MM-DDTHH:MM'。
2
+ import { EditorDef } from '../src/tssgrid';
3
+
4
+ export = TssDatetime;
5
+ export as namespace TssDatetime;
6
+
7
+ declare function TssDatetime(opts?: TssDatetime.Options): TssDatetime.Editor;
8
+
9
+ declare namespace TssDatetime {
10
+ type Holidays = Record<string, string | { name: string; type?: string }>;
11
+
12
+ interface Options {
13
+ holidays?: Holidays;
14
+ weekend?: number[];
15
+ weekLabels?: string[];
16
+ /** 選択可能範囲('YYYY-MM-DD')。 */
17
+ min?: string;
18
+ max?: string;
19
+ yearMin?: number;
20
+ yearMax?: number;
21
+ /** 分刻み(既定 1)。 */
22
+ step?: number;
23
+ /** AM/PM 表示(既定 false=24h)。 */
24
+ hour12?: boolean;
25
+ /** 共有 input に乗る型(既定 true)=直打ち可。false でフォーカス奪取型。 */
26
+ inline?: boolean;
27
+ /** シングルクリックで開く(既定 true)。 */
28
+ openOnClick?: boolean;
29
+ /** セル右端の目印(既定 '📅')。 */
30
+ icon?: string;
31
+ /** ポップアップに付ける任意クラス。 */
32
+ className?: string;
33
+ }
34
+
35
+ interface Editor extends EditorDef {
36
+ /** アンカー要素の下に開き、選択で `onPick('YYYY-MM-DDTHH:MM')` を呼ぶ(単体用)。 */
37
+ openAt(anchorEl: Element, value: string, onPick: (value: string) => void): void;
38
+ }
39
+
40
+ /** 列 format 用: 保存値 'YYYY-MM-DDTHH:MM' を表示整形。 */
41
+ function format(value: any, opts?: { hour12?: boolean }): string;
42
+ }
@@ -0,0 +1,29 @@
1
+ // TssTime — 時/分プルダウン方式の時刻エディタ(TssGrid カスタムエディタ/単体でも)。保存値は 24h 'HH:MM'。
2
+ import { EditorDef } from '../src/tssgrid';
3
+
4
+ export = TssTime;
5
+ export as namespace TssTime;
6
+
7
+ declare function TssTime(opts?: TssTime.Options): TssTime.Editor;
8
+
9
+ declare namespace TssTime {
10
+ interface Options {
11
+ /** 分刻み(既定 1)。 */
12
+ step?: number;
13
+ /** AM/PM 表示(既定 false=24h)。 */
14
+ hour12?: boolean;
15
+ /** 共有 input に乗る型(既定 true)=直打ち可。false でフォーカス奪取型。 */
16
+ inline?: boolean;
17
+ /** シングルクリックで開く(既定 true)。 */
18
+ openOnClick?: boolean;
19
+ /** セル右端の目印(既定 '🕐')。 */
20
+ icon?: string;
21
+ /** ポップアップに付ける任意クラス。 */
22
+ className?: string;
23
+ }
24
+
25
+ interface Editor extends EditorDef {
26
+ /** アンカー要素の下に開き、選択で `onPick('HH:MM')` を呼ぶ(単体用)。 */
27
+ openAt(anchorEl: Element, value: string, onPick: (value: string) => void): void;
28
+ }
29
+ }