@ishibashi0112/spreadsheet-grid-core 1.6.0 → 1.7.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.
Files changed (38) hide show
  1. package/dist/controllers/editController.cjs +1 -1
  2. package/dist/controllers/editController.d.ts +3 -2
  3. package/dist/controllers/editController.js +171 -152
  4. package/dist/controllers/searchSelectEditorController.cjs +1 -0
  5. package/dist/controllers/searchSelectEditorController.d.ts +48 -0
  6. package/dist/controllers/searchSelectEditorController.js +188 -0
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +4 -4
  10. package/dist/locales/en.cjs +1 -1
  11. package/dist/locales/en.js +3 -0
  12. package/dist/logic/fillHandle.cjs +1 -1
  13. package/dist/logic/fillHandle.js +54 -51
  14. package/dist/logic/imeInput.cjs +1 -1
  15. package/dist/logic/imeInput.js +14 -13
  16. package/dist/logic/localeTextFeatures.cjs +1 -1
  17. package/dist/logic/localeTextFeatures.d.ts +5 -0
  18. package/dist/logic/localeTextFeatures.js +10 -6
  19. package/dist/logic/selectEditorState.cjs +1 -1
  20. package/dist/logic/selectEditorState.d.ts +16 -1
  21. package/dist/logic/selectEditorState.js +30 -21
  22. package/dist/logic/selectFillRow.cjs +1 -0
  23. package/dist/logic/selectFillRow.d.ts +4 -0
  24. package/dist/logic/selectFillRow.js +25 -0
  25. package/dist/logic/selectLabels.cjs +1 -1
  26. package/dist/logic/selectLabels.js +25 -22
  27. package/dist/logic/selectSearch.cjs +1 -0
  28. package/dist/logic/selectSearch.d.ts +27 -0
  29. package/dist/logic/selectSearch.js +102 -0
  30. package/dist/model/gridTypes.core.d.ts +69 -6
  31. package/dist/model/gridTypes.unbound.d.ts +1 -0
  32. package/dist/utils/editorVisibleBounds.cjs +1 -1
  33. package/dist/utils/editorVisibleBounds.d.ts +4 -0
  34. package/dist/utils/editorVisibleBounds.js +12 -2
  35. package/dist/utils/overflowTitle.cjs +1 -0
  36. package/dist/utils/overflowTitle.d.ts +1 -0
  37. package/dist/utils/overflowTitle.js +7 -0
  38. package/package.json +1 -1
@@ -35,14 +35,18 @@ var e = {
35
35
  collapseColumnGroup: "{group} を閉じる",
36
36
  dragColumnGroup: "ドラッグで {group} を移動"
37
37
  }, o = {
38
+ selectSearchLoading: "候補を取得中…",
39
+ selectSearchFailed: "候補の取得に失敗しました",
40
+ selectSearchNoMatch: "一致する候補がありません"
41
+ }, s = {
38
42
  contextMenuCell: "セルのメニュー",
39
43
  contextMenuRow: "行のメニュー"
40
- }, s = {
44
+ }, c = {
41
45
  scrollHintRow: "行 {row}",
42
46
  scrollHintJump: "行 {row} へ",
43
47
  scrollHintJumpSeparator: "・",
44
48
  scrollHintTenThousands: "{value}万"
45
- }, c = {
49
+ }, l = {
46
50
  menuFilter: "フィルター…",
47
51
  menuSortAscending: "昇順で並び替え",
48
52
  menuSortDescending: "降順で並び替え",
@@ -60,7 +64,7 @@ var e = {
60
64
  menuColumns: "列の表示",
61
65
  menuResetColumns: "列のリセット",
62
66
  menuResetUnavailable: "この表では列をリセットできません"
63
- }, l = {
67
+ }, u = {
64
68
  findLabel: "セル内検索",
65
69
  findPlaceholder: "検索",
66
70
  findInput: "検索文字列",
@@ -72,16 +76,16 @@ var e = {
72
76
  findNextHint: "次へ(Enter)",
73
77
  findClose: "検索を閉じる",
74
78
  findCloseHint: "閉じる(Esc)"
75
- }, u = {
79
+ }, d = {
76
80
  fillOptions: "オートフィル オプション",
77
81
  fillOptionsCurrent: "オートフィル オプション({kind})",
78
82
  fillSeries: "連続データ",
79
83
  fillCopy: "セルのコピー"
80
- }, d = {
84
+ }, f = {
81
85
  loadFailed: "行の取得に失敗しました({count} ブロック)",
82
86
  dismissLoadError: "エラー通知を閉じる",
83
87
  saveFailed: "変更の保存に失敗しました({count} 行)。値を元に戻しました",
84
88
  dismissSaveError: "保存エラー通知を閉じる"
85
89
  };
86
90
  //#endregion
87
- export { e as DEFAULT_AGGREGATES_LOCALE_TEXT, a as DEFAULT_COLUMN_GROUPS_LOCALE_TEXT, c as DEFAULT_COLUMN_MENU_LOCALE_TEXT, o as DEFAULT_CONTEXT_MENU_LOCALE_TEXT, u as DEFAULT_FILL_HANDLE_LOCALE_TEXT, t as DEFAULT_FILTERING_LOCALE_TEXT, l as DEFAULT_FIND_LOCALE_TEXT, n as DEFAULT_GROUPING_LOCALE_TEXT, i as DEFAULT_PINNED_ROWS_LOCALE_TEXT, r as DEFAULT_ROW_DRAG_LOCALE_TEXT, s as DEFAULT_SCROLL_HINT_LOCALE_TEXT, d as DEFAULT_SERVER_SIDE_LOCALE_TEXT };
91
+ export { e as DEFAULT_AGGREGATES_LOCALE_TEXT, a as DEFAULT_COLUMN_GROUPS_LOCALE_TEXT, l as DEFAULT_COLUMN_MENU_LOCALE_TEXT, s as DEFAULT_CONTEXT_MENU_LOCALE_TEXT, d as DEFAULT_FILL_HANDLE_LOCALE_TEXT, t as DEFAULT_FILTERING_LOCALE_TEXT, u as DEFAULT_FIND_LOCALE_TEXT, n as DEFAULT_GROUPING_LOCALE_TEXT, i as DEFAULT_PINNED_ROWS_LOCALE_TEXT, r as DEFAULT_ROW_DRAG_LOCALE_TEXT, c as DEFAULT_SCROLL_HINT_LOCALE_TEXT, o as DEFAULT_SELECT_SEARCH_LOCALE_TEXT, f as DEFAULT_SERVER_SIDE_LOCALE_TEXT };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./editorKeys.cjs");var t=180,n=28,r=4,i=1,a=8,o=8,s=2,c=700,l=(e,t)=>{let n=String(t??``),r=e.findIndex(e=>e.value===n);return r>=0?r:0},u=(e,t,n)=>{if(n<=0)return 0;let r=e+t;return r<0?0:r>n-1?n-1:r},d=()=>({buffer:``,lastInputTime:0}),f=(e,t,n,r)=>{let i=(n-e.lastInputTime>700?``:e.buffer)+t.toLocaleLowerCase(),a=r.findIndex(e=>e.label.toLocaleLowerCase().startsWith(i));return{state:{buffer:i,lastInputTime:n},index:a>=0?a:null}},p=44,m=()=>typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches?44:28,h=(e,t,n,r,i=28)=>{let c=Math.max(e.width,180),l=Math.max(o,n-c-o),u=Math.min(Math.max(e.left,o),l),d=Math.min(Math.max(t,1),a)*i+8+2,f=e.bottom+s;return{left:u,top:f+d<=r-o?f:Math.max(o,e.top-s-d),width:c,maxHeight:d}},g=/[\uFF01-\uFF5E]/g,_=e=>e.replace(g,e=>String.fromCharCode(e.charCodeAt(0)-65248)).replace(/\u3000/g,` `).toLocaleLowerCase(),v=(e,t)=>{let n=_(t).trim();if(n===``)return null;let r=e.map(e=>_(e.label)),i=r.findIndex(e=>e.startsWith(n));if(i>=0)return i;let a=r.findIndex(e=>e.includes(n));return a>=0?a:null},y=8,b=(t,n)=>{let{key:r}=t,i=n.optionCount;r===`ArrowDown`||r===`ArrowUp`||r===`Home`||r===`End`||r===`PageUp`||r===`PageDown`?(t.preventDefault(),(r===`ArrowDown`||r===`ArrowUp`||i>0)&&n.onMove(e=>x(r,e,i))):r===`Enter`||r===`Tab`?(t.preventDefault(),n.onCommit(r===`Enter`?e.resolveEnterDirection(n.enterMove):t.shiftKey?`left`:`right`)):r===`Escape`?(t.preventDefault(),n.onCancel()):r.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&(t.preventDefault(),n.onTypeahead(r))},x=(e,t,n)=>e===`ArrowDown`||e===`ArrowUp`?u(t,e===`ArrowDown`?1:-1,n):e===`Home`||e===`End`?e===`Home`?0:n-1:Math.min(Math.max((t<0?0:t)+(e===`PageDown`?8:-8),0),n-1),S=(e,t,n,r)=>{let i=l(e,t);if(!n)return{highlight:i,typeahead:d()};let a=f(d(),n,r,e);return{highlight:a.index??i,typeahead:a.state}};exports.SELECT_OPTION_ROW_HEIGHT=n,exports.SELECT_OPTION_ROW_HEIGHT_COARSE=p,exports.SELECT_PAGE_STEP=y,exports.SELECT_POPOVER_BORDER_Y=i,exports.SELECT_POPOVER_MIN_WIDTH=t,exports.SELECT_POPOVER_PADDING_Y=r,exports.SELECT_TYPEAHEAD_RESET_MS=c,exports.computeSelectPopoverPlacement=h,exports.createTypeaheadState=d,exports.findOptionByComposedText=v,exports.handleSelectEditorKeyDown=b,exports.moveHighlight=u,exports.moveSelectHighlight=x,exports.resolveInitialHighlight=l,exports.resolveSelectEditorStart=S,exports.resolveSelectOptionRowHeight=m,exports.typeaheadJump=f;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./editorKeys.cjs");var t=180,n=240,r=28,i=4,a=1,o=8,s=8,c=2,l=()=>{let e=null;return t=>{let n=typeof t.movementX!=`number`||t.movementX!==0||t.movementY!==0||e!==null&&(e.x!==t.clientX||e.y!==t.clientY);return e={x:t.clientX,y:t.clientY},n}},u=700,d=(e,t)=>{let n=String(t??``),r=e.findIndex(e=>e.value===n);return r>=0?r:0},f=(e,t,n)=>{if(n<=0)return 0;let r=e+t;return r<0?0:r>n-1?n-1:r},p=()=>({buffer:``,lastInputTime:0}),m=(e,t,n,r)=>{let i=(n-e.lastInputTime>700?``:e.buffer)+t.toLocaleLowerCase(),a=r.findIndex(e=>e.label.toLocaleLowerCase().startsWith(i));return{state:{buffer:i,lastInputTime:n},index:a>=0?a:null}},h=44,g=()=>typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches?44:28,_=(e,t,n,r,i=28,a=180)=>{let l=Math.max(e.width,a),u=Math.max(s,n-l-s),d=Math.min(Math.max(e.left,s),u),f=Math.min(Math.max(t,1),o)*i+8+2,p=e.bottom+c;return{left:d,top:p+f<=r-s?p:Math.max(s,e.top-c-f),width:l,maxHeight:f}},v=/[\uFF01-\uFF5E]/g,y=e=>e.replace(v,e=>String.fromCharCode(e.charCodeAt(0)-65248)).replace(/\u3000/g,` `).toLocaleLowerCase(),b=(e,t)=>{let n=y(t).trim();if(n===``)return null;let r=e.map(e=>y(e.label)),i=r.findIndex(e=>e.startsWith(n));if(i>=0)return i;let a=r.findIndex(e=>e.includes(n));return a>=0?a:null},x=8,S=(t,n)=>{let{key:r}=t,i=n.optionCount;r===`ArrowDown`||r===`ArrowUp`||r===`Home`||r===`End`||r===`PageUp`||r===`PageDown`?(t.preventDefault(),(r===`ArrowDown`||r===`ArrowUp`||i>0)&&n.onMove(e=>C(r,e,i))):r===`Enter`||r===`Tab`?(t.preventDefault(),n.onCommit(r===`Enter`?e.resolveEnterDirection(n.enterMove):t.shiftKey?`left`:`right`)):r===`Escape`?(t.preventDefault(),n.onCancel()):r.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&(t.preventDefault(),n.onTypeahead(r))},C=(e,t,n)=>e===`ArrowDown`||e===`ArrowUp`?f(t,e===`ArrowDown`?1:-1,n):e===`Home`||e===`End`?e===`Home`?0:n-1:Math.min(Math.max((t<0?0:t)+(e===`PageDown`?8:-8),0),n-1),w=(e,t,n,r)=>{let i=d(e,t);if(!n)return{highlight:i,typeahead:p()};let a=m(p(),n,r,e);return{highlight:a.index??i,typeahead:a.state}},T=e=>e?.type===`select`&&(e.search??(e.loadOptions!==void 0||e.allowFreeText===!0));exports.SELECT_OPTION_ROW_HEIGHT=r,exports.SELECT_OPTION_ROW_HEIGHT_COARSE=h,exports.SELECT_PAGE_STEP=x,exports.SELECT_POPOVER_BORDER_Y=a,exports.SELECT_POPOVER_MIN_WIDTH=t,exports.SELECT_POPOVER_PADDING_Y=i,exports.SELECT_SEARCH_POPOVER_MIN_WIDTH=n,exports.SELECT_TYPEAHEAD_RESET_MS=u,exports.computeSelectPopoverPlacement=_,exports.createPointerMoveFilter=l,exports.createTypeaheadState=p,exports.findOptionByComposedText=b,exports.handleSelectEditorKeyDown=S,exports.isSearchSelectEditor=T,exports.moveHighlight=f,exports.moveSelectHighlight=C,exports.resolveInitialHighlight=d,exports.resolveSelectEditorStart=w,exports.resolveSelectOptionRowHeight=g,exports.typeaheadJump=m;
@@ -1,8 +1,16 @@
1
1
  import type { EditorCommitDirection, EditorEnterMove, GridSelectEditorOption } from '../model/gridTypes.unbound.js';
2
2
  export declare const SELECT_POPOVER_MIN_WIDTH = 180;
3
+ export declare const SELECT_SEARCH_POPOVER_MIN_WIDTH = 240;
3
4
  export declare const SELECT_OPTION_ROW_HEIGHT = 28;
4
5
  export declare const SELECT_POPOVER_PADDING_Y = 4;
5
6
  export declare const SELECT_POPOVER_BORDER_Y = 1;
7
+ export type PointerMoveLike = {
8
+ clientX: number;
9
+ clientY: number;
10
+ movementX?: number | undefined;
11
+ movementY?: number | undefined;
12
+ };
13
+ export declare const createPointerMoveFilter: () => ((event: PointerMoveLike) => boolean);
6
14
  export declare const SELECT_TYPEAHEAD_RESET_MS = 700;
7
15
  export declare const resolveInitialHighlight: (options: readonly GridSelectEditorOption[], currentValue: unknown) => number;
8
16
  export declare const moveHighlight: (current: number, delta: number, optionCount: number) => number;
@@ -20,6 +28,7 @@ export type SelectPopoverPlacement = {
20
28
  top: number;
21
29
  width: number;
22
30
  maxHeight: number;
31
+ hidden?: boolean | undefined;
23
32
  };
24
33
  export declare const SELECT_OPTION_ROW_HEIGHT_COARSE = 44;
25
34
  export declare const resolveSelectOptionRowHeight: () => number;
@@ -28,7 +37,7 @@ export declare const computeSelectPopoverPlacement: (anchorRect: {
28
37
  top: number;
29
38
  bottom: number;
30
39
  width: number;
31
- }, optionCount: number, viewportWidth: number, viewportHeight: number, rowHeight?: number) => SelectPopoverPlacement;
40
+ }, optionCount: number, viewportWidth: number, viewportHeight: number, rowHeight?: number, minWidth?: number) => SelectPopoverPlacement;
32
41
  export declare const findOptionByComposedText: (options: readonly GridSelectEditorOption[], text: string) => number | null;
33
42
  export declare const SELECT_PAGE_STEP = 8;
34
43
  export type SelectEditorKeyEventLike = {
@@ -53,3 +62,9 @@ export declare const resolveSelectEditorStart: (options: readonly GridSelectEdit
53
62
  highlight: number;
54
63
  typeahead: SelectTypeaheadState;
55
64
  };
65
+ export declare const isSearchSelectEditor: (editor: {
66
+ type: string;
67
+ search?: boolean | undefined;
68
+ loadOptions?: unknown;
69
+ allowFreeText?: boolean | undefined;
70
+ } | undefined) => boolean;
@@ -1,16 +1,25 @@
1
1
  import { resolveEnterDirection as e } from "./editorKeys.js";
2
2
  //#region src/logic/selectEditorState.ts
3
- var t = 180, n = 28, r = 4, i = 1, a = 8, o = 8, s = 2, c = 700, l = (e, t) => {
3
+ var t = 180, n = 240, r = 28, i = 4, a = 1, o = 8, s = 8, c = 2, l = () => {
4
+ let e = null;
5
+ return (t) => {
6
+ let n = typeof t.movementX != "number" || t.movementX !== 0 || t.movementY !== 0 || e !== null && (e.x !== t.clientX || e.y !== t.clientY);
7
+ return e = {
8
+ x: t.clientX,
9
+ y: t.clientY
10
+ }, n;
11
+ };
12
+ }, u = 700, d = (e, t) => {
4
13
  let n = String(t ?? ""), r = e.findIndex((e) => e.value === n);
5
14
  return r >= 0 ? r : 0;
6
- }, u = (e, t, n) => {
15
+ }, f = (e, t, n) => {
7
16
  if (n <= 0) return 0;
8
17
  let r = e + t;
9
18
  return r < 0 ? 0 : r > n - 1 ? n - 1 : r;
10
- }, d = () => ({
19
+ }, p = () => ({
11
20
  buffer: "",
12
21
  lastInputTime: 0
13
- }), f = (e, t, n, r) => {
22
+ }), m = (e, t, n, r) => {
14
23
  let i = (n - e.lastInputTime > 700 ? "" : e.buffer) + t.toLocaleLowerCase(), a = r.findIndex((e) => e.label.toLocaleLowerCase().startsWith(i));
15
24
  return {
16
25
  state: {
@@ -19,35 +28,35 @@ var t = 180, n = 28, r = 4, i = 1, a = 8, o = 8, s = 2, c = 700, l = (e, t) => {
19
28
  },
20
29
  index: a >= 0 ? a : null
21
30
  };
22
- }, p = 44, m = () => typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches ? 44 : 28, h = (e, t, n, r, i = 28) => {
23
- let c = Math.max(e.width, 180), l = Math.max(o, n - c - o), u = Math.min(Math.max(e.left, o), l), d = Math.min(Math.max(t, 1), a) * i + 8 + 2, f = e.bottom + s;
31
+ }, h = 44, g = () => typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches ? 44 : 28, _ = (e, t, n, r, i = 28, a = 180) => {
32
+ let l = Math.max(e.width, a), u = Math.max(s, n - l - s), d = Math.min(Math.max(e.left, s), u), f = Math.min(Math.max(t, 1), o) * i + 8 + 2, p = e.bottom + c;
24
33
  return {
25
- left: u,
26
- top: f + d <= r - o ? f : Math.max(o, e.top - s - d),
27
- width: c,
28
- maxHeight: d
34
+ left: d,
35
+ top: p + f <= r - s ? p : Math.max(s, e.top - c - f),
36
+ width: l,
37
+ maxHeight: f
29
38
  };
30
- }, g = /[\uFF01-\uFF5E]/g, _ = (e) => e.replace(g, (e) => String.fromCharCode(e.charCodeAt(0) - 65248)).replace(/\u3000/g, " ").toLocaleLowerCase(), v = (e, t) => {
31
- let n = _(t).trim();
39
+ }, v = /[\uFF01-\uFF5E]/g, y = (e) => e.replace(v, (e) => String.fromCharCode(e.charCodeAt(0) - 65248)).replace(/\u3000/g, " ").toLocaleLowerCase(), b = (e, t) => {
40
+ let n = y(t).trim();
32
41
  if (n === "") return null;
33
- let r = e.map((e) => _(e.label)), i = r.findIndex((e) => e.startsWith(n));
42
+ let r = e.map((e) => y(e.label)), i = r.findIndex((e) => e.startsWith(n));
34
43
  if (i >= 0) return i;
35
44
  let a = r.findIndex((e) => e.includes(n));
36
45
  return a >= 0 ? a : null;
37
- }, y = 8, b = (t, n) => {
46
+ }, x = 8, S = (t, n) => {
38
47
  let { key: r } = t, i = n.optionCount;
39
- r === "ArrowDown" || r === "ArrowUp" || r === "Home" || r === "End" || r === "PageUp" || r === "PageDown" ? (t.preventDefault(), (r === "ArrowDown" || r === "ArrowUp" || i > 0) && n.onMove((e) => x(r, e, i))) : r === "Enter" || r === "Tab" ? (t.preventDefault(), n.onCommit(r === "Enter" ? e(n.enterMove) : t.shiftKey ? "left" : "right")) : r === "Escape" ? (t.preventDefault(), n.onCancel()) : r.length === 1 && !t.ctrlKey && !t.metaKey && !t.altKey && (t.preventDefault(), n.onTypeahead(r));
40
- }, x = (e, t, n) => e === "ArrowDown" || e === "ArrowUp" ? u(t, e === "ArrowDown" ? 1 : -1, n) : e === "Home" || e === "End" ? e === "Home" ? 0 : n - 1 : Math.min(Math.max((t < 0 ? 0 : t) + (e === "PageDown" ? 8 : -8), 0), n - 1), S = (e, t, n, r) => {
41
- let i = l(e, t);
48
+ r === "ArrowDown" || r === "ArrowUp" || r === "Home" || r === "End" || r === "PageUp" || r === "PageDown" ? (t.preventDefault(), (r === "ArrowDown" || r === "ArrowUp" || i > 0) && n.onMove((e) => C(r, e, i))) : r === "Enter" || r === "Tab" ? (t.preventDefault(), n.onCommit(r === "Enter" ? e(n.enterMove) : t.shiftKey ? "left" : "right")) : r === "Escape" ? (t.preventDefault(), n.onCancel()) : r.length === 1 && !t.ctrlKey && !t.metaKey && !t.altKey && (t.preventDefault(), n.onTypeahead(r));
49
+ }, C = (e, t, n) => e === "ArrowDown" || e === "ArrowUp" ? f(t, e === "ArrowDown" ? 1 : -1, n) : e === "Home" || e === "End" ? e === "Home" ? 0 : n - 1 : Math.min(Math.max((t < 0 ? 0 : t) + (e === "PageDown" ? 8 : -8), 0), n - 1), w = (e, t, n, r) => {
50
+ let i = d(e, t);
42
51
  if (!n) return {
43
52
  highlight: i,
44
- typeahead: d()
53
+ typeahead: p()
45
54
  };
46
- let a = f(d(), n, r, e);
55
+ let a = m(p(), n, r, e);
47
56
  return {
48
57
  highlight: a.index ?? i,
49
58
  typeahead: a.state
50
59
  };
51
- };
60
+ }, T = (e) => e?.type === "select" && (e.search ?? (e.loadOptions !== void 0 || e.allowFreeText === !0));
52
61
  //#endregion
53
- export { n as SELECT_OPTION_ROW_HEIGHT, p as SELECT_OPTION_ROW_HEIGHT_COARSE, y as SELECT_PAGE_STEP, i as SELECT_POPOVER_BORDER_Y, t as SELECT_POPOVER_MIN_WIDTH, r as SELECT_POPOVER_PADDING_Y, c as SELECT_TYPEAHEAD_RESET_MS, h as computeSelectPopoverPlacement, d as createTypeaheadState, v as findOptionByComposedText, b as handleSelectEditorKeyDown, u as moveHighlight, x as moveSelectHighlight, l as resolveInitialHighlight, S as resolveSelectEditorStart, m as resolveSelectOptionRowHeight, f as typeaheadJump };
62
+ export { r as SELECT_OPTION_ROW_HEIGHT, h as SELECT_OPTION_ROW_HEIGHT_COARSE, x as SELECT_PAGE_STEP, a as SELECT_POPOVER_BORDER_Y, t as SELECT_POPOVER_MIN_WIDTH, i as SELECT_POPOVER_PADDING_Y, n as SELECT_SEARCH_POPOVER_MIN_WIDTH, u as SELECT_TYPEAHEAD_RESET_MS, _ as computeSelectPopoverPlacement, l as createPointerMoveFilter, p as createTypeaheadState, b as findOptionByComposedText, S as handleSelectEditorKeyDown, T as isSearchSelectEditor, f as moveHighlight, C as moveSelectHighlight, d as resolveInitialHighlight, w as resolveSelectEditorStart, g as resolveSelectOptionRowHeight, m as typeaheadJump };
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./validation.cjs");var t=(t,n,r,i,a,o)=>{let s=t.editor;if(i===void 0||s?.type!==`select`||s.fillRow===void 0)return null;let c=s.fillRow(i,{row:n,rowKey:r});if(typeof c!=`object`||!c)return null;let l=null;for(let r of Object.keys(c)){if(r===t.key)continue;let i=c[r];if(Object.is(n?.[r],i))continue;let s=a.find(e=>e.key===r);s!==void 0&&e.decideCellWrite(s,n,i,o).action===`reject`||((l??={})[r]=i)}return l},n=e=>({key:e,title:e});exports.resolveSelectFillRow=t,exports.toFillRowColumn=n;
@@ -0,0 +1,4 @@
1
+ import type { GridColumn, GridRowKey, GridSelectEditorOption } from '../model/gridTypes.unbound.js';
2
+ import { type ValidationLocaleText } from './validation.js';
3
+ export declare const resolveSelectFillRow: <T>(column: GridColumn<T>, row: T, rowKey: GridRowKey, option: GridSelectEditorOption | undefined, columns: readonly GridColumn<T>[], texts?: ValidationLocaleText) => Record<string, unknown> | null;
4
+ export declare const toFillRowColumn: <T>(key: string) => GridColumn<T>;
@@ -0,0 +1,25 @@
1
+ import { decideCellWrite as e } from "./validation.js";
2
+ //#region src/logic/selectFillRow.ts
3
+ var t = (t, n, r, i, a, o) => {
4
+ let s = t.editor;
5
+ if (i === void 0 || s?.type !== "select" || s.fillRow === void 0) return null;
6
+ let c = s.fillRow(i, {
7
+ row: n,
8
+ rowKey: r
9
+ });
10
+ if (typeof c != "object" || !c) return null;
11
+ let l = null;
12
+ for (let r of Object.keys(c)) {
13
+ if (r === t.key) continue;
14
+ let i = c[r];
15
+ if (Object.is(n?.[r], i)) continue;
16
+ let s = a.find((e) => e.key === r);
17
+ s !== void 0 && e(s, n, i, o).action === "reject" || ((l ??= {})[r] = i);
18
+ }
19
+ return l;
20
+ }, n = (e) => ({
21
+ key: e,
22
+ title: e
23
+ });
24
+ //#endregion
25
+ export { t as resolveSelectFillRow, n as toFillRowColumn };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=new WeakMap,t=t=>{let n=e.get(t);if(!n||n.size!==t.length){n={size:t.length,labelByValue:new Map,valueByLabel:new Map};for(let e of t){n.labelByValue.has(e.value)||n.labelByValue.set(e.value,e.label);let t=e.label.trim();t!==``&&!n.valueByLabel.has(t)&&n.valueByLabel.set(t,e.value)}e.set(t,n)}return n},n=(e,t)=>{let n=e.editor;if(n?.type!==`select`||n.clipboard!==`label`)return;if(typeof n.options!=`function`)return Array.isArray(n.options)?n.options:void 0;if(t===void 0)return;let r=n.options(t);return Array.isArray(r)?r:void 0},r=(e,r,i)=>{if(e.formatClipboardValue&&i!==void 0)return e.formatClipboardValue(r,i);let a=String(r??``),o=n(e,i);if(o===void 0)return a;let s=t(o).labelByValue.get(a);return s===void 0||s.trim()===``?a:s},i=e=>{let r=e.editor;if(!(r?.type!==`select`||r.clipboard!==`label`))return(r,i)=>{let a=n(e,i);if(a===void 0)return r;let o=t(a),s=r.trim(),c=o.valueByLabel.get(s);return c===void 0?o.labelByValue.has(r)?r:o.labelByValue.has(s)?s:r:c}};exports.formatCellClipboardText=r,exports.resolveSelectLabelParser=i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs");var t=new WeakMap,n=e=>{let n=t.get(e);if(!n||n.size!==e.length){n={size:e.length,labelByValue:new Map,valueByLabel:new Map};for(let t of e){n.labelByValue.has(t.value)||n.labelByValue.set(t.value,t.label);let e=t.label.trim();e!==``&&!n.valueByLabel.has(e)&&n.valueByLabel.set(e,t.value)}t.set(e,n)}return n},r=(e,t)=>{let n=e.editor;if(n?.type!==`select`||n.clipboard!==`label`)return;if(typeof n.options!=`function`)return Array.isArray(n.options)?n.options:void 0;if(t===void 0)return;let r=n.options(t);return Array.isArray(r)?r:void 0},i=(e,t,i)=>{if(e.formatClipboardValue&&i!==void 0)return e.formatClipboardValue(t,i);let a=String(t??``),o=r(e,i);if(o===void 0)return a;let s=n(o).labelByValue.get(a);return s===void 0||s.trim()===``?a:s},a=t=>{let i=t.editor;if(!(i?.type!==`select`||i.clipboard!==`label`))return(i,a)=>{let o=r(t,a);if(o===void 0)return i;let s=n(o),c=i.trim(),l=e.getCellValue(a,t);if(c!==``&&typeof l==`string`&&s.labelByValue.get(l)?.trim()===c)return l;let u=s.valueByLabel.get(c);return u===void 0?s.labelByValue.has(i)?i:s.labelByValue.has(c)?c:i:u}};exports.formatCellClipboardText=i,exports.resolveSelectLabelParser=a;
@@ -1,41 +1,44 @@
1
+ import { getCellValue as e } from "../utils/permissions.js";
1
2
  //#region src/logic/selectLabels.ts
2
- var e = /* @__PURE__ */ new WeakMap(), t = (t) => {
3
- let n = e.get(t);
4
- if (!n || n.size !== t.length) {
3
+ var t = /* @__PURE__ */ new WeakMap(), n = (e) => {
4
+ let n = t.get(e);
5
+ if (!n || n.size !== e.length) {
5
6
  n = {
6
- size: t.length,
7
+ size: e.length,
7
8
  labelByValue: /* @__PURE__ */ new Map(),
8
9
  valueByLabel: /* @__PURE__ */ new Map()
9
10
  };
10
- for (let e of t) {
11
- n.labelByValue.has(e.value) || n.labelByValue.set(e.value, e.label);
12
- let t = e.label.trim();
13
- t !== "" && !n.valueByLabel.has(t) && n.valueByLabel.set(t, e.value);
11
+ for (let t of e) {
12
+ n.labelByValue.has(t.value) || n.labelByValue.set(t.value, t.label);
13
+ let e = t.label.trim();
14
+ e !== "" && !n.valueByLabel.has(e) && n.valueByLabel.set(e, t.value);
14
15
  }
15
- e.set(t, n);
16
+ t.set(e, n);
16
17
  }
17
18
  return n;
18
- }, n = (e, t) => {
19
+ }, r = (e, t) => {
19
20
  let n = e.editor;
20
21
  if (n?.type !== "select" || n.clipboard !== "label") return;
21
22
  if (typeof n.options != "function") return Array.isArray(n.options) ? n.options : void 0;
22
23
  if (t === void 0) return;
23
24
  let r = n.options(t);
24
25
  return Array.isArray(r) ? r : void 0;
25
- }, r = (e, r, i) => {
26
- if (e.formatClipboardValue && i !== void 0) return e.formatClipboardValue(r, i);
27
- let a = String(r ?? ""), o = n(e, i);
26
+ }, i = (e, t, i) => {
27
+ if (e.formatClipboardValue && i !== void 0) return e.formatClipboardValue(t, i);
28
+ let a = String(t ?? ""), o = r(e, i);
28
29
  if (o === void 0) return a;
29
- let s = t(o).labelByValue.get(a);
30
+ let s = n(o).labelByValue.get(a);
30
31
  return s === void 0 || s.trim() === "" ? a : s;
31
- }, i = (e) => {
32
- let r = e.editor;
33
- if (!(r?.type !== "select" || r.clipboard !== "label")) return (r, i) => {
34
- let a = n(e, i);
35
- if (a === void 0) return r;
36
- let o = t(a), s = r.trim(), c = o.valueByLabel.get(s);
37
- return c === void 0 ? o.labelByValue.has(r) ? r : o.labelByValue.has(s) ? s : r : c;
32
+ }, a = (t) => {
33
+ let i = t.editor;
34
+ if (!(i?.type !== "select" || i.clipboard !== "label")) return (i, a) => {
35
+ let o = r(t, a);
36
+ if (o === void 0) return i;
37
+ let s = n(o), c = i.trim(), l = e(a, t);
38
+ if (c !== "" && typeof l == "string" && s.labelByValue.get(l)?.trim() === c) return l;
39
+ let u = s.valueByLabel.get(c);
40
+ return u === void 0 ? s.labelByValue.has(i) ? i : s.labelByValue.has(c) ? c : i : u;
38
41
  };
39
42
  };
40
43
  //#endregion
41
- export { r as formatCellClipboardText, i as resolveSelectLabelParser };
44
+ export { i as formatCellClipboardText, a as resolveSelectLabelParser };
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=/\s/,t=/^[゙゚]$/,n=e=>e>=12449&&e<=12534||e===12541||e===12542?e-96:e===12540||e>=8208&&e<=8213||e===8722?45:e,r=e=>{let t=e.charCodeAt(0);if(t<128)return t>=65&&t<=90?String.fromCharCode(t+32):e;let r=e.normalize(`NFKC`).toLowerCase(),i=``;for(let e of r)i+=String.fromCharCode(n(e.charCodeAt(0)))+e.slice(1);return i},i=n=>{let i=``,a=[],o=[],s=0;for(let c of n){let n=s;if(s+=c.length,e.test(c))continue;let l=r(c);for(let e of l){if(t.test(e)&&i.length>0){let t=(i[i.length-1]+e).normalize(`NFC`);if(t.length===1){i=i.slice(0,-1)+t,o[o.length-1]=s;continue}}for(let t=0;t<e.length;t+=1)i+=e[t],a.push(n),o.push(s)}}return{text:i,starts:a,ends:o}},a=e=>i(e).text,o=new WeakMap,s=e=>{let t=o.get(e);if(t===void 0){let n=i(String(e.label??``)),r=e.description?i(String(e.description)):null,s=[n.text];r!==null&&s.push(r.text),e.searchText&&s.push(a(String(e.searchText))),s.push(a(String(e.value??``))),t={label:n,description:r,targets:s},o.set(e,t)}return t},c=(e,t)=>{if(e===null||t===``)return null;let n=e.text.indexOf(t);return n<0?null:[e.starts[n],e.ends[n+t.length-1]]},l=(e,t,n)=>{let r=s(e);return{option:e,index:t,labelMatch:c(r.label,n),descriptionMatch:c(r.description,n)}},u=(e,t)=>{if(t===``)return e.map((e,t)=>l(e,t,``));let n=[],r=[],i=[];return e.forEach((e,a)=>{let{targets:o}=s(e),c=-1;for(let e of o){if(e===t){c=2;break}e.startsWith(t)?c=1:c<0&&e.includes(t)&&(c=0)}c>=0&&(c===2?n:c===1?r:i).push(l(e,a,t))}),n.concat(r,i)},d=(e,t)=>e.map((e,n)=>l(e,n,t)),f=(e,t)=>{let n=a(t);if(n!==``)return e.find(e=>s(e).label.text===n)},p=(e,t)=>{if(t===null||t[0]>=t[1])return[{text:e,match:!1}];let n=[];return t[0]>0&&n.push({text:e.slice(0,t[0]),match:!1}),n.push({text:e.slice(t[0],t[1]),match:!0}),t[1]<e.length&&n.push({text:e.slice(t[1]),match:!1}),n},m=(e,t,n,r,i=4)=>{if(r<=0||n<=0)return{start:0,end:0};let a=Math.floor(Math.max(e,0)/n),o=Math.ceil(Math.max(t,n)/n);return{start:Math.max(0,a-i),end:Math.min(r,a+o+i)}},h=(e,t,n,r)=>{if(e<0)return t;let i=e*r,a=i+r;return i<t?i:a>t+n?Math.max(0,a-n):t};exports.findSelectOptionByLabel=f,exports.foldSearchQuery=a,exports.foldSearchText=i,exports.markSelectSearchMatches=d,exports.resolveSelectListWindow=m,exports.revealSelectListRow=h,exports.searchSelectOptions=u,exports.splitSelectSearchText=p;
@@ -0,0 +1,27 @@
1
+ import type { GridSelectEditorOption } from '../model/gridTypes.unbound.js';
2
+ export type FoldedSearchText = {
3
+ text: string;
4
+ starts: number[];
5
+ ends: number[];
6
+ };
7
+ export type SelectSearchRange = readonly [start: number, end: number];
8
+ export type SelectSearchResult = {
9
+ option: GridSelectEditorOption;
10
+ index: number;
11
+ labelMatch: SelectSearchRange | null;
12
+ descriptionMatch: SelectSearchRange | null;
13
+ };
14
+ export declare const foldSearchText: (text: string) => FoldedSearchText;
15
+ export declare const foldSearchQuery: (query: string) => string;
16
+ export declare const searchSelectOptions: (options: readonly GridSelectEditorOption[], query: string) => SelectSearchResult[];
17
+ export declare const markSelectSearchMatches: (options: readonly GridSelectEditorOption[], query: string) => SelectSearchResult[];
18
+ export declare const findSelectOptionByLabel: (options: readonly GridSelectEditorOption[], text: string) => GridSelectEditorOption | undefined;
19
+ export declare const splitSelectSearchText: (text: string, range: SelectSearchRange | null) => {
20
+ text: string;
21
+ match: boolean;
22
+ }[];
23
+ export declare const resolveSelectListWindow: (scrollTop: number, viewportHeight: number, rowHeight: number, count: number, overscan?: number) => {
24
+ start: number;
25
+ end: number;
26
+ };
27
+ export declare const revealSelectListRow: (index: number, scrollTop: number, viewportHeight: number, rowHeight: number) => number;
@@ -0,0 +1,102 @@
1
+ //#region src/logic/selectSearch.ts
2
+ var e = /\s/, t = /^[゙゚]$/, n = (e) => e >= 12449 && e <= 12534 || e === 12541 || e === 12542 ? e - 96 : e === 12540 || e >= 8208 && e <= 8213 || e === 8722 ? 45 : e, r = (e) => {
3
+ let t = e.charCodeAt(0);
4
+ if (t < 128) return t >= 65 && t <= 90 ? String.fromCharCode(t + 32) : e;
5
+ let r = e.normalize("NFKC").toLowerCase(), i = "";
6
+ for (let e of r) i += String.fromCharCode(n(e.charCodeAt(0))) + e.slice(1);
7
+ return i;
8
+ }, i = (n) => {
9
+ let i = "", a = [], o = [], s = 0;
10
+ for (let c of n) {
11
+ let n = s;
12
+ if (s += c.length, e.test(c)) continue;
13
+ let l = r(c);
14
+ for (let e of l) {
15
+ if (t.test(e) && i.length > 0) {
16
+ let t = (i[i.length - 1] + e).normalize("NFC");
17
+ if (t.length === 1) {
18
+ i = i.slice(0, -1) + t, o[o.length - 1] = s;
19
+ continue;
20
+ }
21
+ }
22
+ for (let t = 0; t < e.length; t += 1) i += e[t], a.push(n), o.push(s);
23
+ }
24
+ }
25
+ return {
26
+ text: i,
27
+ starts: a,
28
+ ends: o
29
+ };
30
+ }, a = (e) => i(e).text, o = /* @__PURE__ */ new WeakMap(), s = (e) => {
31
+ let t = o.get(e);
32
+ if (t === void 0) {
33
+ let n = i(String(e.label ?? "")), r = e.description ? i(String(e.description)) : null, s = [n.text];
34
+ r !== null && s.push(r.text), e.searchText && s.push(a(String(e.searchText))), s.push(a(String(e.value ?? ""))), t = {
35
+ label: n,
36
+ description: r,
37
+ targets: s
38
+ }, o.set(e, t);
39
+ }
40
+ return t;
41
+ }, c = (e, t) => {
42
+ if (e === null || t === "") return null;
43
+ let n = e.text.indexOf(t);
44
+ return n < 0 ? null : [e.starts[n], e.ends[n + t.length - 1]];
45
+ }, l = (e, t, n) => {
46
+ let r = s(e);
47
+ return {
48
+ option: e,
49
+ index: t,
50
+ labelMatch: c(r.label, n),
51
+ descriptionMatch: c(r.description, n)
52
+ };
53
+ }, u = (e, t) => {
54
+ if (t === "") return e.map((e, t) => l(e, t, ""));
55
+ let n = [], r = [], i = [];
56
+ return e.forEach((e, a) => {
57
+ let { targets: o } = s(e), c = -1;
58
+ for (let e of o) {
59
+ if (e === t) {
60
+ c = 2;
61
+ break;
62
+ }
63
+ e.startsWith(t) ? c = 1 : c < 0 && e.includes(t) && (c = 0);
64
+ }
65
+ c >= 0 && (c === 2 ? n : c === 1 ? r : i).push(l(e, a, t));
66
+ }), n.concat(r, i);
67
+ }, d = (e, t) => e.map((e, n) => l(e, n, t)), f = (e, t) => {
68
+ let n = a(t);
69
+ if (n !== "") return e.find((e) => s(e).label.text === n);
70
+ }, p = (e, t) => {
71
+ if (t === null || t[0] >= t[1]) return [{
72
+ text: e,
73
+ match: !1
74
+ }];
75
+ let n = [];
76
+ return t[0] > 0 && n.push({
77
+ text: e.slice(0, t[0]),
78
+ match: !1
79
+ }), n.push({
80
+ text: e.slice(t[0], t[1]),
81
+ match: !0
82
+ }), t[1] < e.length && n.push({
83
+ text: e.slice(t[1]),
84
+ match: !1
85
+ }), n;
86
+ }, m = (e, t, n, r, i = 4) => {
87
+ if (r <= 0 || n <= 0) return {
88
+ start: 0,
89
+ end: 0
90
+ };
91
+ let a = Math.floor(Math.max(e, 0) / n), o = Math.ceil(Math.max(t, n) / n);
92
+ return {
93
+ start: Math.max(0, a - i),
94
+ end: Math.min(r, a + o + i)
95
+ };
96
+ }, h = (e, t, n, r) => {
97
+ if (e < 0) return t;
98
+ let i = e * r, a = i + r;
99
+ return i < t ? i : a > t + n ? Math.max(0, a - n) : t;
100
+ };
101
+ //#endregion
102
+ export { f as findSelectOptionByLabel, a as foldSearchQuery, i as foldSearchText, d as markSelectSearchMatches, m as resolveSelectListWindow, h as revealSelectListRow, u as searchSelectOptions, p as splitSelectSearchText };
@@ -617,7 +617,32 @@ export type CellValueFormatter<T, F extends GridFrameworkTypes = GridFrameworkTy
617
617
  export type EditorCommitDirection = 'down' | 'up' | 'right' | 'left';
618
618
  export type EditorEnterMove = 'down' | 'up' | 'right' | 'left' | 'none';
619
619
  export type GridTextEditorEnterKey = 'commit' | 'newline';
620
- export type GridSelectEditorOption = GridSelectFilterOption;
620
+ export type GridSelectEditorOption = GridSelectFilterOption & {
621
+ /**
622
+ * 検索できる選択エディタ(`search`)の一覧で、名前の右に薄く出す補足(コードなど。1.7.0 から)。検索の対象にもなる。
623
+ */
624
+ description?: string | undefined;
625
+ /**
626
+ * 表示しないが検索の対象にする文字(読みがな・別名など。1.7.0 から)。`search` の列で、打った文字がこれに含まれる
627
+ * 候補も出る。
628
+ */
629
+ searchText?: string | undefined;
630
+ /**
631
+ * 候補に添える付属の値(単価など。1.7.0 から)。グリッドは読まず、`fillRow` の `option.data` でそのまま受け取れる。
632
+ */
633
+ data?: unknown;
634
+ };
635
+ export type GridSelectLoadOptionsParams<T, F extends GridFrameworkTypes = GridFrameworkTypes> = {
636
+ query: string;
637
+ row: T;
638
+ rowKey: GridRowKey;
639
+ column: GridColumn<T, F>;
640
+ signal: AbortSignal;
641
+ };
642
+ export type GridSelectFillRowContext<T> = {
643
+ row: T;
644
+ rowKey: GridRowKey;
645
+ };
621
646
  export type GridColumnEditor<T, F extends GridFrameworkTypes = GridFrameworkTypes> = {
622
647
  type: 'text';
623
648
  multiline?: boolean | undefined;
@@ -646,6 +671,36 @@ export type GridColumnEditor<T, F extends GridFrameworkTypes = GridFrameworkType
646
671
  * @defaultValue `'value'`
647
672
  */
648
673
  clipboard?: 'value' | 'label' | undefined;
674
+ /**
675
+ * `true` で、セルの入力欄に打った文字で候補を絞り込む(1.7.0 から)。探し方は部分一致で、`label` / `description` /
676
+ * `searchText` / `value` を見る(全角と半角、大文字と小文字、ひらがなとカタカナ、空白は区別しない)。先頭が一致する候補が
677
+ * 上、途中が一致する候補がその下。`loadOptions` か `allowFreeText` を書けば省略しても検索になる(`false` を書けば止まる)。
678
+ * `/lite` では `selectSearch` の機能が要る(無ければ今までの select のまま)。
679
+ *
680
+ * @defaultValue `false`
681
+ */
682
+ search?: boolean | undefined;
683
+ /**
684
+ * `true` で、候補に無い文字も入れられる(1.7.0 から)。`Enter` / `Tab` / フォーカスが外れたときに、ハイライトした候補が
685
+ * 無ければ打った文字を列のパーサへ通して書く(打った文字が候補の `label` と同じならその候補を選んだのと同じ)。
686
+ *
687
+ * @defaultValue `false`
688
+ */
689
+ allowFreeText?: boolean | undefined;
690
+ /**
691
+ * 候補をサーバーなどから取る(1.7.0 から)。開いたときに 1 回、その後は打つたびに約 200ms 待ってから
692
+ * `{ query, row, rowKey, column, signal }` で呼ぶ(前の要求は `signal` で中断し、古い応答は捨てる。キャッシュはしない)。
693
+ * あるとき一覧はこの結果で、`options` は今の値の名前を引くため(と `clipboard: 'label'`)にだけ使う(空の配列でよい)。
694
+ */
695
+ loadOptions?: ((params: GridSelectLoadOptionsParams<T, F>) => Promise<readonly GridSelectEditorOption[]>) | undefined;
696
+ /**
697
+ * 候補を選んだとき、ほかの項目も同じ 1 回の編集で書く(1.7.0 から)。返した項目を行へそのまま重ねる(列の `setValue` は
698
+ * 通さない。この列の項目は選んだ値が勝つ)。`onRowsChange` は 1 回(serverSide は `updateRows` 1 回)・元に戻すも 1 回。
699
+ * 読み取り専用の列の項目も書く。`validationMode: 'reject'` の列で通らない値の項目は書かない。値が変わらない確定・
700
+ * 候補の名前と違う打った文字の確定(`allowFreeText`。名前と同じ文字は候補を選んだのと同じで呼ぶ)・貼り付け・フィルでは
701
+ * 呼ばない。検索の無い select の列でも使える。
702
+ */
703
+ fillRow?: ((option: GridSelectEditorOption, context: GridSelectFillRowContext<T>) => Partial<T>) | undefined;
649
704
  } | {
650
705
  type: 'date';
651
706
  /**
@@ -1790,6 +1845,12 @@ export type GridLocaleText = {
1790
1845
  dragColumnGroup: GridLocaleTextTemplate<{
1791
1846
  group: string;
1792
1847
  }>;
1848
+ /** 検索できる選択エディタ(select の `search`)の一覧で、`loadOptions` の候補を取っている間。既定 `候補を取得中…`、英語 `Loading options…`。 */
1849
+ selectSearchLoading: string;
1850
+ /** 同上の取得に失敗したとき(「再試行」のボタンは `retry`)。既定 `候補の取得に失敗しました`、英語 `Couldn't load the options`。 */
1851
+ selectSearchFailed: string;
1852
+ /** 同上で、打った文字に当たる候補が無いとき。既定 `一致する候補がありません`、英語 `No matching options`。 */
1853
+ selectSearchNoMatch: string;
1793
1854
  /** 右クリックメニュー(`enableContextMenu`)をセルで開いたときの読み上げの名前。既定 `セルのメニュー`、英語 `Cell menu`。 */
1794
1855
  contextMenuCell: string;
1795
1856
  /** 同上(行番号で開いたとき)。既定 `行のメニュー`、英語 `Row menu`。 */
@@ -3098,11 +3159,13 @@ export type SpreadsheetGridProps<T, F extends GridFrameworkTypes = GridFramework
3098
3159
  * 桁区切りを半角に直して編集を始め(「12.5」→ `12.5`)、数値として読めない変換は捨てる(「ー」
3099
3160
  * 「。」だけの変換は `-` / `.` の打ち始めとして編集を始める)。custom エディタの列は、
3100
3161
  * エディタの定義に `imeDirectInput: true` を付けたときだけ確定した文字を `ctx.initialText`
3101
- * に入れて編集を始める(1.2.0 から)。それ以外の列(select / date / checkbox / 付けていない custom)
3102
- * と読み取り専用セルでは変換を捨てる(従来どおり何も入らない)。キー操作 / コピー・貼り付け / `Tab`
3103
- * は従来どおり。既定 OFF の理由: 有効中はグリッドにフォーカスがあるあいだ
3104
- * `document.activeElement` が入力欄になり、入力欄では反応しないアプリのショートカット(例: Mantine
3105
- * の `useHotkeys` の既定)が効かなくなるため。詳細は「IME オンのままの直接入力」節。
3162
+ * に入れて編集を始める(1.2.0 から)。検索できる select エディタ(`search` など)
3163
+ * の列は確定した文字で絞った一覧から開く(1.7.0 から)。それ以外の列(select / date / checkbox /
3164
+ * 付けていない custom)と読み取り専用セルでは変換を捨てる(従来どおり何も入らない)。キー操作 /
3165
+ * コピー・貼り付け / `Tab` は従来どおり。既定 OFF の理由:
3166
+ * 有効中はグリッドにフォーカスがあるあいだ `document.activeElement` が入力欄になり、
3167
+ * 入力欄では反応しないアプリのショートカット(例: Mantine の `useHotkeys` の既定)
3168
+ * が効かなくなるため。詳細は「IME オンのままの直接入力」節。
3106
3169
  *
3107
3170
  * @defaultValue `false`
3108
3171
  */
@@ -19,6 +19,7 @@ export type ColumnGroupHeaderRenderContext = Core.ColumnGroupHeaderRenderContext
19
19
  export type CellValueFormatterParams<T> = Core.CellValueFormatterParams<T, UnboundGridTypes>;
20
20
  export type CellValueFormatter<T> = Core.CellValueFormatter<T, UnboundGridTypes>;
21
21
  export type GridColumnEditor<T> = Core.GridColumnEditor<T, UnboundGridTypes>;
22
+ export type GridSelectLoadOptionsParams<T> = Core.GridSelectLoadOptionsParams<T, UnboundGridTypes>;
22
23
  export type CellEditorContext<T> = Core.CellEditorContext<T, UnboundGridTypes>;
23
24
  export type CellValidationContext<T> = Core.CellValidationContext<T, UnboundGridTypes>;
24
25
  export type GridAggFuncParams<T> = Core.GridAggFuncParams<T, UnboundGridTypes>;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./gridVisibleBand.cjs");var t=e=>{let t=e.closest(`.ssg-scroll-container`);if(!t)return null;let n=t.getBoundingClientRect().left+t.clientLeft,r=n+t.clientWidth,i=e.closest(`.ssg-center-pane`)??t.querySelector(`.ssg-center-pane`);if(i){let t=i.previousElementSibling,a=i.nextElementSibling;if(i.contains(e))t&&(n=Math.max(n,t.getBoundingClientRect().right)),a&&(r=Math.min(r,a.getBoundingClientRect().left));else{let i=t?.contains(e)?t:a?.contains(e)?a:null;if(i){let e=i.getBoundingClientRect();n=Math.max(n,e.left),r=Math.min(r,e.right)}}}return r-n>0?{left:n,right:r}:null},n=t=>{let n=e.resolveGridVisibleBand(t);return{top:Math.max(0,n?.top??0),bottom:Math.min(window.innerHeight,n?.bottom??window.innerHeight)}},r=4,i=e=>{let n=t(e);if(!n)return null;let i=Math.floor(n.right-n.left-r*2);return i>0?i:null},a=e=>{let n=t(e);if(!n)return 0;let i=e.getBoundingClientRect(),a=i.right-(n.right-r);return a<=0?0:Math.max(0,Math.min(a,i.left-n.left))};exports.resolveEditorVisibleX=t,exports.resolveEditorVisibleY=n,exports.resolveShiftIntoView=a,exports.resolveVisibleWidth=i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./gridVisibleBand.cjs");var t=e=>{let t=e.closest(`.ssg-scroll-container`);if(!t)return null;let n=t.getBoundingClientRect().left+t.clientLeft,r=n+t.clientWidth,i=e.closest(`.ssg-center-pane`)??t.querySelector(`.ssg-center-pane`);if(i){let t=i.previousElementSibling,a=i.nextElementSibling;if(i.contains(e))t&&(n=Math.max(n,t.getBoundingClientRect().right)),a&&(r=Math.min(r,a.getBoundingClientRect().left));else{let i=t?.contains(e)?t:a?.contains(e)?a:null;if(i){let e=i.getBoundingClientRect();n=Math.max(n,e.left),r=Math.min(r,e.right)}}}return r-n>0?{left:n,right:r}:null},n=t=>{let n=e.resolveGridVisibleBand(t);return{top:Math.max(0,n?.top??0),bottom:Math.min(window.innerHeight,n?.bottom??window.innerHeight)}},r=4,i=e=>{let n=t(e);if(!n)return null;let i=Math.floor(n.right-n.left-r*2);return i>0?i:null},a=e=>{let n=t(e);if(!n)return 0;let i=e.getBoundingClientRect(),a=i.right-(n.right-r);return a<=0?0:Math.max(0,Math.min(a,i.left-n.left))},o=n=>{let r=e.resolveGridVisibleBand(n);if(!r)return!1;let i=n.getBoundingClientRect();if(i.bottom<=r.top+1||i.top>=r.bottom-1)return!0;let a=t(n);return a!==null&&(i.right<=a.left+1||i.left>=a.right-1)},s=(e,t)=>o(e)?{...t,hidden:!0}:t;exports.isEditorOutOfView=o,exports.resolveEditorVisibleX=t,exports.resolveEditorVisibleY=n,exports.resolveShiftIntoView=a,exports.resolveVisibleWidth=i,exports.withAnchorVisibility=s;
@@ -8,3 +8,7 @@ export declare const resolveEditorVisibleY: (element: Element) => {
8
8
  };
9
9
  export declare const resolveVisibleWidth: (element: Element) => number | null;
10
10
  export declare const resolveShiftIntoView: (element: Element) => number;
11
+ export declare const isEditorOutOfView: (element: Element) => boolean;
12
+ export declare const withAnchorVisibility: <P extends object>(element: Element, placement: P) => P & {
13
+ hidden?: boolean | undefined;
14
+ };
@@ -35,6 +35,16 @@ var t = (e) => {
35
35
  if (!n) return 0;
36
36
  let i = e.getBoundingClientRect(), a = i.right - (n.right - r);
37
37
  return a <= 0 ? 0 : Math.max(0, Math.min(a, i.left - n.left));
38
- };
38
+ }, o = (n) => {
39
+ let r = e(n);
40
+ if (!r) return !1;
41
+ let i = n.getBoundingClientRect();
42
+ if (i.bottom <= r.top + 1 || i.top >= r.bottom - 1) return !0;
43
+ let a = t(n);
44
+ return a !== null && (i.right <= a.left + 1 || i.left >= a.right - 1);
45
+ }, s = (e, t) => o(e) ? {
46
+ ...t,
47
+ hidden: !0
48
+ } : t;
39
49
  //#endregion
40
- export { t as resolveEditorVisibleX, n as resolveEditorVisibleY, a as resolveShiftIntoView, i as resolveVisibleWidth };
50
+ export { o as isEditorOutOfView, t as resolveEditorVisibleX, n as resolveEditorVisibleY, a as resolveShiftIntoView, i as resolveVisibleWidth, s as withAnchorVisibility };
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>{let t=Array.from(e.children),n=t.length>0?t:[e];n.some(e=>e.scrollWidth>e.clientWidth)?e.title=n.map(e=>(e.textContent??``).trim()).join(` `):e.removeAttribute(`title`)};exports.revealOverflowTitle=e;
@@ -0,0 +1 @@
1
+ export declare const revealOverflowTitle: (option: HTMLElement) => void;
@@ -0,0 +1,7 @@
1
+ //#region src/utils/overflowTitle.ts
2
+ var e = (e) => {
3
+ let t = Array.from(e.children), n = t.length > 0 ? t : [e];
4
+ n.some((e) => e.scrollWidth > e.clientWidth) ? e.title = n.map((e) => (e.textContent ?? "").trim()).join(" ") : e.removeAttribute("title");
5
+ };
6
+ //#endregion
7
+ export { e as revealOverflowTitle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ishibashi0112/spreadsheet-grid-core",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "SpreadsheetGrid のフレームワーク非依存コア(状態 / 派生値計算 / コマンド / DOM コントローラ)。React 版 @ishibashi0112/spreadsheet-grid と将来の Solid 版が共有します。",
5
5
  "keywords": [
6
6
  "grid",