@ishibashi0112/spreadsheet-grid-solid 1.10.0 → 1.12.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/API_REFERENCE.md +195 -18
- package/README.md +2 -2
- package/dist/{ColumnFilterPopover-mENgY4gl.js → ColumnFilterPopover-t32VGfTq.js} +135 -134
- package/dist/DateEditorCalendar-CWaFuibK.js +118 -0
- package/dist/devWarnings.d.ts +5 -0
- package/dist/editors/CellEditorLayer.d.ts +6 -2
- package/dist/editors/DateTimeCellEditor.d.ts +26 -0
- package/dist/editors/MultiSelectCellEditor.d.ts +24 -0
- package/dist/features/dateTimeEditors.d.ts +2 -0
- package/dist/features/findReplace.d.ts +2 -0
- package/dist/features/multiSelect.d.ts +2 -0
- package/dist/features/richCopy.d.ts +2 -0
- package/dist/features/types.d.ts +21 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5171 -4107
- package/dist/localeText-CCqvpkYM.js +10 -0
- package/dist/portalTokens-LgUwLYnR.js +47 -0
- package/dist/source/chunks/{ColumnFilterPopover-D7INPNVB.jsx → ColumnFilterPopover-JL3HPGXY.jsx} +4 -2
- package/dist/source/chunks/DateEditorCalendar-FVUNVD7Y.jsx +170 -0
- package/dist/source/chunks/{chunk-RJB7JN2Y.jsx → chunk-AI3CSPI3.jsx} +3 -29
- package/dist/source/chunks/chunk-ZW5ET5DO.jsx +28 -0
- package/dist/source/chunks/{toolPanelViews-BRH5PCOI.jsx → toolPanelViews-N6TGBFFW.jsx} +4 -2
- package/dist/source/index.jsx +1629 -218
- package/dist/style.css +1 -1
- package/dist/style.layer.css +1 -1
- package/dist/{toolPanelViews-DMEVr1KV.js → toolPanelViews-CPYtBTQP.js} +2 -1
- package/dist/view/DateEditorCalendar.d.ts +15 -0
- package/dist/view/GridFindBar.d.ts +13 -0
- package/dist/view/GridFindReplace.d.ts +23 -0
- package/dist/view/GridMultiSelectChips.d.ts +6 -0
- package/dist/view/GridPinnedRows.d.ts +1 -0
- package/dist/view/lazyPopups.d.ts +3 -1
- package/package.json +3 -3
- package/dist/portalTokens-Gz03P3fZ.js +0 -52
package/dist/source/index.jsx
CHANGED
|
@@ -13,18 +13,20 @@ import {
|
|
|
13
13
|
runInMountGate
|
|
14
14
|
} from "./chunks/chunk-ZZTXTW4Z.jsx";
|
|
15
15
|
import {
|
|
16
|
-
GridLocaleTextContext,
|
|
17
16
|
GridPortalContext,
|
|
18
17
|
createPortalTokens,
|
|
19
|
-
mergeFeatureLocaleDefaults,
|
|
20
18
|
px,
|
|
21
19
|
readEventKey,
|
|
22
20
|
toEditorKeyEvent,
|
|
23
21
|
toSolidStyle,
|
|
24
|
-
useFeatureLocaleText,
|
|
25
|
-
useGridLocaleText,
|
|
26
22
|
useGridPortal
|
|
27
|
-
} from "./chunks/chunk-
|
|
23
|
+
} from "./chunks/chunk-AI3CSPI3.jsx";
|
|
24
|
+
import {
|
|
25
|
+
GridLocaleTextContext,
|
|
26
|
+
mergeFeatureLocaleDefaults,
|
|
27
|
+
useFeatureLocaleText,
|
|
28
|
+
useGridLocaleText
|
|
29
|
+
} from "./chunks/chunk-ZW5ET5DO.jsx";
|
|
28
30
|
|
|
29
31
|
// src/createSpreadsheetGrid.tsx
|
|
30
32
|
import { merge } from "solid-js";
|
|
@@ -49,8 +51,10 @@ import { ROW_DRAG_HANDLE_COLUMN_KEY as ROW_DRAG_HANDLE_COLUMN_KEY2, moveArrayIte
|
|
|
49
51
|
import {
|
|
50
52
|
resolveSelectionBand,
|
|
51
53
|
resolveSelectionBandSegments,
|
|
52
|
-
resolveSelectionExtents
|
|
54
|
+
resolveSelectionExtents,
|
|
55
|
+
resolveRowRunsPaneRects
|
|
53
56
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectionOverlayGeometry";
|
|
57
|
+
import { findScopeRowRuns } from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/findController";
|
|
54
58
|
import {
|
|
55
59
|
isActiveCellRendered,
|
|
56
60
|
placementRectInPane,
|
|
@@ -112,6 +116,12 @@ import {
|
|
|
112
116
|
peekEditRow,
|
|
113
117
|
resolveFirstEditableColIndex
|
|
114
118
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/newRow";
|
|
119
|
+
import {
|
|
120
|
+
hasRowEditor,
|
|
121
|
+
mayHaveEditorType,
|
|
122
|
+
resolveColumnEditor,
|
|
123
|
+
resolveStaticColumnEditor as resolveStaticColumnEditor2
|
|
124
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/columnEditor";
|
|
115
125
|
import { IME_INPUT_ATTRIBUTE, isImeComposingKeyEvent as isImeComposingKeyEvent2 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
|
|
116
126
|
import {
|
|
117
127
|
createKeyboardController,
|
|
@@ -1601,6 +1611,8 @@ import { toDateInputValue } from "@ishibashi0112/spreadsheet-grid-core/internal/
|
|
|
1601
1611
|
import { resolveTypedStartText } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/editorStart";
|
|
1602
1612
|
import { formatLocaleText as formatLocaleText4 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
1603
1613
|
import { isSearchSelectEditor } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState";
|
|
1614
|
+
import { isDateTimeEditor } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/columnEditor";
|
|
1615
|
+
import { isMultiSelectEditor } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/multiSelect";
|
|
1604
1616
|
|
|
1605
1617
|
// src/editors/TextCellEditor.tsx
|
|
1606
1618
|
import { Show as Show6, createRenderEffect as createRenderEffect3, createSignal as createSignal4, onCleanup as onCleanup3, onSettled as onSettled3, untrack as untrack6 } from "solid-js";
|
|
@@ -2292,6 +2304,12 @@ function CellEditorLayer(props) {
|
|
|
2292
2304
|
const texts = useGridLocaleText();
|
|
2293
2305
|
const editor = () => props.editor;
|
|
2294
2306
|
const kind = createMemo7(() => {
|
|
2307
|
+
if (props.DateTimeEditor && isDateTimeEditor(editor())) {
|
|
2308
|
+
return "dateTime";
|
|
2309
|
+
}
|
|
2310
|
+
if (isMultiSelectEditor(editor())) {
|
|
2311
|
+
return props.MultiSelectEditor ? "multiSelect" : "text";
|
|
2312
|
+
}
|
|
2295
2313
|
const type = editor()?.type;
|
|
2296
2314
|
return type === "number" || type === "select" || type === "date" || type === "custom" ? type : "text";
|
|
2297
2315
|
});
|
|
@@ -2403,6 +2421,25 @@ function CellEditorLayer(props) {
|
|
|
2403
2421
|
initialText={session ? resolveTypedStartText(initialValue, session.value) : void 0}
|
|
2404
2422
|
/>;
|
|
2405
2423
|
}
|
|
2424
|
+
case "dateTime": {
|
|
2425
|
+
const session = untrack11(() => props.session);
|
|
2426
|
+
const current = untrack11(editor);
|
|
2427
|
+
const DateTimeEditor = props.DateTimeEditor;
|
|
2428
|
+
if (!DateTimeEditor || !isDateTimeEditor(current)) {
|
|
2429
|
+
return null;
|
|
2430
|
+
}
|
|
2431
|
+
return <DateTimeEditor
|
|
2432
|
+
{...common}
|
|
2433
|
+
editor={current}
|
|
2434
|
+
columnTitle={session ? session.column.title || session.column.key : ""}
|
|
2435
|
+
value={session ? session.value : initialValue}
|
|
2436
|
+
initialValue={initialValue}
|
|
2437
|
+
popoverSlot={props.slots.popover}
|
|
2438
|
+
themeClassName={props.themeClassName}
|
|
2439
|
+
cellTop={props.rect?.top ?? 0}
|
|
2440
|
+
cellLeft={props.rect?.left ?? 0}
|
|
2441
|
+
/>;
|
|
2442
|
+
}
|
|
2406
2443
|
case "select": {
|
|
2407
2444
|
const session = untrack11(() => props.session);
|
|
2408
2445
|
const current = untrack11(editor);
|
|
@@ -2435,6 +2472,27 @@ function CellEditorLayer(props) {
|
|
|
2435
2472
|
initialText={initialText}
|
|
2436
2473
|
/>;
|
|
2437
2474
|
}
|
|
2475
|
+
case "multiSelect": {
|
|
2476
|
+
const session = untrack11(() => props.session);
|
|
2477
|
+
const current = untrack11(editor);
|
|
2478
|
+
const MultiSelectEditor = props.MultiSelectEditor;
|
|
2479
|
+
if (!MultiSelectEditor || current?.type !== "select") {
|
|
2480
|
+
return null;
|
|
2481
|
+
}
|
|
2482
|
+
const loadOptions = current.loadOptions;
|
|
2483
|
+
return <MultiSelectEditor
|
|
2484
|
+
{...common}
|
|
2485
|
+
popoverSlot={props.slots.popover}
|
|
2486
|
+
themeClassName={props.themeClassName}
|
|
2487
|
+
options={selectOptions()}
|
|
2488
|
+
value={session?.value}
|
|
2489
|
+
search={current.search ?? loadOptions !== void 0}
|
|
2490
|
+
load={loadOptions && session ? (query, signal) => loadOptions({ query, row: session.row, rowKey: session.rowKey, column: session.column, signal }) : void 0}
|
|
2491
|
+
initialText={session ? resolveTypedStartText(initialValue, session.value) : void 0}
|
|
2492
|
+
cellTop={props.rect?.top ?? 0}
|
|
2493
|
+
cellLeft={props.rect?.left ?? 0}
|
|
2494
|
+
/>;
|
|
2495
|
+
}
|
|
2438
2496
|
case "custom": {
|
|
2439
2497
|
const current = untrack11(editor);
|
|
2440
2498
|
if (current?.type !== "custom") {
|
|
@@ -2665,6 +2723,9 @@ function ColumnHoverOverlay(props) {
|
|
|
2665
2723
|
import { createEffect as createEffect3, createMemo as createMemo9 } from "solid-js";
|
|
2666
2724
|
import { AUTO_HEIGHT_MAX_ROWS } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/verticalGeometry";
|
|
2667
2725
|
import { isSearchSelectEditor as isSearchSelectEditor2 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState";
|
|
2726
|
+
import { isMultiSelectEditor as isMultiSelectEditor2 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/multiSelect";
|
|
2727
|
+
import { isDateTimeEditor as isDateTimeEditor2 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/columnEditor";
|
|
2728
|
+
import { resolveStaticColumnEditor } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/columnEditor";
|
|
2668
2729
|
import {
|
|
2669
2730
|
resolveExcelShortcuts,
|
|
2670
2731
|
usesExcelShortcutCommands
|
|
@@ -2682,6 +2743,15 @@ var createChangeEffect = (compute, effect) => {
|
|
|
2682
2743
|
};
|
|
2683
2744
|
var FEATURE_PROPS = {
|
|
2684
2745
|
find: [{ prop: "find", isUsed: (props) => props.find !== void 0 && props.find !== false }],
|
|
2746
|
+
// 追加(1.12.0 / 検索と置換): find={{ replace: true }}(機能が無いと検索だけ。React 版と同じ)。
|
|
2747
|
+
findReplace: [
|
|
2748
|
+
{
|
|
2749
|
+
prop: "find.replace",
|
|
2750
|
+
isUsed: (props) => typeof props.find === "object" && props.find !== null && props.find.replace === true
|
|
2751
|
+
}
|
|
2752
|
+
],
|
|
2753
|
+
// 追加(1.12.0 / 書式つきのコピー): copyFormat="rich"(機能が無いと TSV だけ)。
|
|
2754
|
+
richCopy: [{ prop: "copyFormat", isUsed: (props) => props.copyFormat === "rich" }],
|
|
2685
2755
|
fillHandle: [{ prop: "fillHandle", isUsed: (props) => Boolean(props.fillHandle) }],
|
|
2686
2756
|
// 列の並べ替えは onColumnsChange で有効になる(リサイズ等と共通の prop なので、それでは警告しない)。
|
|
2687
2757
|
columnReorder: [{ prop: "columnDragMotion", isUsed: (props) => props.columnDragMotion !== void 0 }],
|
|
@@ -2693,7 +2763,21 @@ var FEATURE_PROPS = {
|
|
|
2693
2763
|
selectSearch: [
|
|
2694
2764
|
{
|
|
2695
2765
|
prop: "columns[].editor.search / loadOptions / allowFreeText",
|
|
2696
|
-
isUsed: (props) => props.columns.some((column) => isSearchSelectEditor2(column
|
|
2766
|
+
isUsed: (props) => props.columns.some((column) => isSearchSelectEditor2(resolveStaticColumnEditor(column)))
|
|
2767
|
+
}
|
|
2768
|
+
],
|
|
2769
|
+
// 追加(1.11.0): time / datetime / date の picker: 'calendar' のエディタ(React 版と同じ)。
|
|
2770
|
+
dateTimeEditors: [
|
|
2771
|
+
{
|
|
2772
|
+
prop: "columns[].editor.type 'time' / 'datetime' / picker: 'calendar'",
|
|
2773
|
+
isUsed: (props) => props.columns.some((column) => isDateTimeEditor2(resolveStaticColumnEditor(column)))
|
|
2774
|
+
}
|
|
2775
|
+
],
|
|
2776
|
+
// 追加(1.11.0 / 複数選択): multiple: true の select(React 版と同じ)。
|
|
2777
|
+
multiSelect: [
|
|
2778
|
+
{
|
|
2779
|
+
prop: "columns[].editor.multiple",
|
|
2780
|
+
isUsed: (props) => props.columns.some((column) => isMultiSelectEditor2(resolveStaticColumnEditor(column)))
|
|
2697
2781
|
}
|
|
2698
2782
|
],
|
|
2699
2783
|
// 変更の追跡(React 版と同じ)。
|
|
@@ -2927,6 +3011,16 @@ function createShellDevWarningsInDev(args) {
|
|
|
2927
3011
|
);
|
|
2928
3012
|
}
|
|
2929
3013
|
});
|
|
3014
|
+
const findReplaceWarned = /* @__PURE__ */ new Set();
|
|
3015
|
+
createChangeEffect(args.findReplaceOnServerSide, (onServerSide) => {
|
|
3016
|
+
if (onServerSide) {
|
|
3017
|
+
warnOncePerGrid(
|
|
3018
|
+
findReplaceWarned,
|
|
3019
|
+
"findReplaceServerSide",
|
|
3020
|
+
"[SpreadsheetGrid] find \u306E replace \u306F serverSide(dataSource)\u3067\u306F\u4F7F\u3048\u307E\u305B\u3093(\u691C\u7D22\u3060\u3051\u3092\u51FA\u3057\u307E\u3059)\u3002\n[SpreadsheetGrid] find.replace does not work with serverSide (dataSource). Only find is shown."
|
|
3021
|
+
);
|
|
3022
|
+
}
|
|
3023
|
+
});
|
|
2930
3024
|
const newRowWarned = /* @__PURE__ */ new Set();
|
|
2931
3025
|
createChangeEffect(
|
|
2932
3026
|
() => {
|
|
@@ -2963,6 +3057,12 @@ function createShellDevWarningsInDev(args) {
|
|
|
2963
3057
|
warnOncePerGrid(treeDataWarned, warning.id, warning.message);
|
|
2964
3058
|
}
|
|
2965
3059
|
});
|
|
3060
|
+
const multiSelectWarned = /* @__PURE__ */ new Set();
|
|
3061
|
+
createChangeEffect(args.multiSelectWarnings, (warnings) => {
|
|
3062
|
+
for (const warning of warnings) {
|
|
3063
|
+
warnOncePerGrid(multiSelectWarned, warning.id, warning.message);
|
|
3064
|
+
}
|
|
3065
|
+
});
|
|
2966
3066
|
if (!args.filteringAvailable) {
|
|
2967
3067
|
createChangeEffect(
|
|
2968
3068
|
() => args.globalFilterText().trim() !== "" || args.columnFilterCount() > 0,
|
|
@@ -3001,6 +3101,11 @@ var warnHandleCallBeforeMount = (warned, method) => {
|
|
|
3001
3101
|
};
|
|
3002
3102
|
|
|
3003
3103
|
// src/SpreadsheetGrid.tsx
|
|
3104
|
+
import { formatCellText } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/cellText";
|
|
3105
|
+
import {
|
|
3106
|
+
describeMultiSelectColumnProblems,
|
|
3107
|
+
mayBeMultiSelectColumn
|
|
3108
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/multiSelect";
|
|
3004
3109
|
var EMPTY_ROWS = [];
|
|
3005
3110
|
var NEVER_EDITABLE = () => false;
|
|
3006
3111
|
var NO_TREE_DATA_WARNINGS = [];
|
|
@@ -3558,6 +3663,8 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
3558
3663
|
globalFilterText,
|
|
3559
3664
|
columnFilterCount: () => Object.keys(columnFilters()).length,
|
|
3560
3665
|
trackChangesUnavailable: () => !isTrackChangesOn(props.trackChanges) || features.changeTracking === void 0 ? null : isServerSide() ? "serverSide" : props.rowKeyGetter === void 0 ? "rowKeyGetter" : props.onRowsChange == null ? "onRowsChange" : null,
|
|
3666
|
+
// 追加(1.12.0 / 検索と置換): 置換を serverSide で使った(機能があるときだけ。React 版と同じ条件と文言)。
|
|
3667
|
+
findReplaceOnServerSide: () => typeof props.find === "object" && props.find !== null && props.find.replace === true && features.find !== void 0 && features.findReplace !== void 0 && isServerSide(),
|
|
3561
3668
|
// 追加(1.10.0 / 入力行): 入力行が出ない理由(機能があり newRow を指定したときだけ。React 版と同じ条件と文言)。
|
|
3562
3669
|
newRowUnavailable: () => {
|
|
3563
3670
|
if (!newRowGiven() || newRowParts === void 0) {
|
|
@@ -3576,6 +3683,8 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
3576
3683
|
].filter((name) => name !== null).join(" / ");
|
|
3577
3684
|
return missing === "" ? null : { missing };
|
|
3578
3685
|
},
|
|
3686
|
+
// 追加(1.11.0 / 複数選択): 複数選択の列でこの版では効かない書き方(allowFreeText / fillRow / rowGroup。React 版と同じ)。
|
|
3687
|
+
multiSelectWarnings: () => describeMultiSelectColumnProblems(props.columns),
|
|
3579
3688
|
// 追加(1.9.0 / ツリーデータ): 一緒に使えないもの・効かない理由と、木の形の問題(親のキーが rows に無い行・循環・同じキーの行)。
|
|
3580
3689
|
treeDataWarnings: () => {
|
|
3581
3690
|
const parts = treeDataParts;
|
|
@@ -3646,6 +3755,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
3646
3755
|
};
|
|
3647
3756
|
});
|
|
3648
3757
|
const conditionalFormatFeature2 = features.conditionalFormat;
|
|
3758
|
+
const multiSelectParts = features.multiSelect;
|
|
3649
3759
|
const conditionalFormatStats = createMemo10(() => engine.resolveConditionalFormatStats(rowModel(), orderedColumns()));
|
|
3650
3760
|
const totalRowCells = createMemo10(
|
|
3651
3761
|
() => totalRowEnabled() ? engine.resolveTotalRowCells({
|
|
@@ -4510,6 +4620,13 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4510
4620
|
onPasteSkipped: inOwnTick(props.onPasteSkipped),
|
|
4511
4621
|
localeTexts: localeTexts(),
|
|
4512
4622
|
pasteFillsSelection: props.pasteFillsSelection,
|
|
4623
|
+
// 追加(1.12.0 / copyHeaders・書式つきコピー): 見出しの行・列のグループの段・text/html の表(機能 richCopy)・色を読む要素・
|
|
4624
|
+
// カラースケールの min / max(条件付き書式の機能があるときだけ。React 版と同じ)。
|
|
4625
|
+
copyHeaders: props.copyHeaders,
|
|
4626
|
+
columnGroupTree: columnGroupTree(),
|
|
4627
|
+
richCopy: props.copyFormat === "rich" ? features.richCopy : void 0,
|
|
4628
|
+
getCopyColorHost: () => gridRootRef.current,
|
|
4629
|
+
getConditionalFormatStats: features.conditionalFormat ? () => untrack13(conditionalFormatStats) : void 0,
|
|
4513
4630
|
onRowsChange: handleRowsChange(),
|
|
4514
4631
|
onColumnsChange: inOwnTick(props.onColumnsChange),
|
|
4515
4632
|
applyServerSideCellEdits: applyServerSideCellEdits(),
|
|
@@ -4555,6 +4672,9 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4555
4672
|
const findOptions = createMemo10(() => typeof props.find === "object" ? props.find : null);
|
|
4556
4673
|
const findShortcut = createMemo10(() => findEnabled() && (findOptions()?.shortcut ?? true));
|
|
4557
4674
|
const findSnapshot = createExternalStoreSignal(engine.find, "findStore");
|
|
4675
|
+
const findReplaceFeature2 = features.findReplace;
|
|
4676
|
+
const findReplaceWanted = createMemo10(() => findEnabled() && findOptions()?.replace === true && findReplaceFeature2 !== void 0);
|
|
4677
|
+
const findReplaceSnapshot = createExternalStoreSignal(engine.findReplace, "findReplaceStore");
|
|
4558
4678
|
const FindBar = findFeature2?.FindBar;
|
|
4559
4679
|
const findIndex = createMemo10(() => findSnapshot().index);
|
|
4560
4680
|
const findCurrentIndex = createMemo10(() => findSnapshot().currentIndex);
|
|
@@ -4578,6 +4698,10 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4578
4698
|
// 条件付き書式の機能が無ければチップもデータバーも描かれないので、値の文字を探す(React 版 1.0.2 / QB-1)。
|
|
4579
4699
|
conditionalFormat: conditionalFormatFeature2 !== void 0,
|
|
4580
4700
|
toViewRow: findToViewRow(),
|
|
4701
|
+
// 追加(1.11.0 / 複数選択): 複数選択のセルの文字の区切り(チップの印と同じ位置。React 版と同じ)。
|
|
4702
|
+
multiSelectSeparator: localeTexts().multiSelectSeparator,
|
|
4703
|
+
// 追加(1.12.0 / 検索と置換): 「選んだ範囲だけ」の範囲(件数・印・↑↓ も範囲の中だけ。React 版と同じ)。
|
|
4704
|
+
scope: findReplaceSnapshot().scope,
|
|
4581
4705
|
// カレントのヒットへ: クリックと同じ 1 セルの選択 + 見える位置へのスクロール(命令的 API と同じ経路)。
|
|
4582
4706
|
// 変更(1.9.0 の点検 T3-02 / T6-09): 打っている途中の移動('query')で開いた親は、次の文字の移動で閉じ直す(React 版と同じ)。
|
|
4583
4707
|
onNavigate: (rowIndex, colIndex, cause) => {
|
|
@@ -4593,11 +4717,61 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4593
4717
|
onChange: inOwnTick(props.onFindChange)
|
|
4594
4718
|
};
|
|
4595
4719
|
}, "render", "find");
|
|
4596
|
-
const
|
|
4720
|
+
const findReplaceEnabled = createMemo10(
|
|
4721
|
+
() => findReplaceWanted() && !isServerSide() && !editLocked() && props.onRowsChange != null
|
|
4722
|
+
);
|
|
4723
|
+
connectController(engine.findReplace, () => {
|
|
4724
|
+
const treeRowModel = findTreeRowModel();
|
|
4725
|
+
const state = ui();
|
|
4726
|
+
return {
|
|
4727
|
+
enabled: findReplaceEnabled(),
|
|
4728
|
+
find: engine.find,
|
|
4729
|
+
rows: rows(),
|
|
4730
|
+
rowModel: treeRowModel ?? rowModel(),
|
|
4731
|
+
columns: orderedColumns(),
|
|
4732
|
+
caseSensitive: findOptions()?.caseSensitive ?? false,
|
|
4733
|
+
conditionalFormat: conditionalFormatFeature2 !== void 0,
|
|
4734
|
+
multiSelectSeparator: localeTexts().multiSelectSeparator,
|
|
4735
|
+
validationTexts: localeTexts(),
|
|
4736
|
+
toViewRow: findToViewRow(),
|
|
4737
|
+
readOnly: editLocked(),
|
|
4738
|
+
canEditCell: canEditCell(),
|
|
4739
|
+
// 履歴付きの onRowsChange(元に戻すが 1 回・変更の追跡の印も付く)。
|
|
4740
|
+
commitRows: (nextRows) => handleRowsChange()?.(nextRows),
|
|
4741
|
+
getSelection: () => store.getState().selection,
|
|
4742
|
+
viewRowCount: viewRowCount(),
|
|
4743
|
+
viewSignature: [state.sort, state.filters, state.collapsedGroupKeys, orderedColumnKeys()]
|
|
4744
|
+
};
|
|
4745
|
+
}, "render", "findReplace");
|
|
4746
|
+
const openFindFromShortcut = () => {
|
|
4747
|
+
if (findReplaceEnabled()) {
|
|
4748
|
+
engine.findReplace.open(false);
|
|
4749
|
+
return;
|
|
4750
|
+
}
|
|
4751
|
+
engine.find.open();
|
|
4752
|
+
};
|
|
4753
|
+
const openFindReplaceFromShortcut = () => engine.findReplace.open(true);
|
|
4597
4754
|
const closeFindAndRefocus = () => {
|
|
4598
4755
|
engine.find.close();
|
|
4599
4756
|
gridRootRef.current?.focus({ preventScroll: true });
|
|
4600
4757
|
};
|
|
4758
|
+
const findScopeRects = createMemo10(() => {
|
|
4759
|
+
const scope = findSnapshot().open ? findReplaceSnapshot().scope : null;
|
|
4760
|
+
if (scope === null) {
|
|
4761
|
+
return null;
|
|
4762
|
+
}
|
|
4763
|
+
const v = vertical();
|
|
4764
|
+
return resolveRowRunsPaneRects(findScopeRowRuns(scope), scope.startCol, scope.endCol, {
|
|
4765
|
+
paneLayout: paneLayout(),
|
|
4766
|
+
viewRowCount: viewRowCount(),
|
|
4767
|
+
windowFirstRow: v.windowFirstRow,
|
|
4768
|
+
windowLastRow: v.windowLastRow,
|
|
4769
|
+
rowMetrics: v.rowMetrics,
|
|
4770
|
+
detailActive: v.detailActive,
|
|
4771
|
+
detailExtras: v.detailExtras
|
|
4772
|
+
});
|
|
4773
|
+
});
|
|
4774
|
+
const findScopeRectsForPane = (pane) => findScopeRects()?.[pane] ?? [];
|
|
4601
4775
|
const filterPopover = features.filtering?.createFilterPopover({
|
|
4602
4776
|
visibleColumns,
|
|
4603
4777
|
columnFilters,
|
|
@@ -4811,6 +4985,8 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4811
4985
|
onTabPastNewRowDraft: newRowActive() ? engine.newRow.commitFromLastColumn : void 0,
|
|
4812
4986
|
onShortcutKeyDown: excelShortcutCommandsEnabled() ? engine.excelShortcuts.handleKeyDown : void 0,
|
|
4813
4987
|
openFind: findShortcut() ? openFindFromShortcut : void 0,
|
|
4988
|
+
// 追加(1.12.0 / 検索と置換): Ctrl+H で置換の段も開く(置換が使えて shortcut が true のときだけ横取り)。
|
|
4989
|
+
openFindReplace: findShortcut() && findReplaceEnabled() ? openFindReplaceFromShortcut : void 0,
|
|
4814
4990
|
handleCellDoubleClick: tryStartEditCell,
|
|
4815
4991
|
isWholeGridSelected: isWholeGridSelected(),
|
|
4816
4992
|
selectEntireGrid,
|
|
@@ -4903,7 +5079,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4903
5079
|
) === true,
|
|
4904
5080
|
startEdit: edit.startEditWithValue,
|
|
4905
5081
|
// number の列は確定した文字を半角の数値の表記へ直して編集を始めます(読めない変換は捨てる)。
|
|
4906
|
-
resolveEditText: (cell, text) => imeFeature ? imeFeature.resolveImeEditText(untrack13(orderedColumns), cell, text) : text
|
|
5082
|
+
resolveEditText: (cell, text) => imeFeature ? imeFeature.resolveImeEditText(untrack13(orderedColumns), cell, text, untrack13(rowModel)) : text
|
|
4907
5083
|
};
|
|
4908
5084
|
},
|
|
4909
5085
|
"effect",
|
|
@@ -5285,7 +5461,18 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
5285
5461
|
activeToolPanelTab: toolPanel?.activeTab() ?? null,
|
|
5286
5462
|
openToolPanel,
|
|
5287
5463
|
closeToolPanel: toolPanel?.close ?? noop3,
|
|
5288
|
-
find: {
|
|
5464
|
+
find: {
|
|
5465
|
+
open: engine.find.open,
|
|
5466
|
+
close: engine.find.close,
|
|
5467
|
+
next: engine.find.next,
|
|
5468
|
+
prev: engine.find.prev,
|
|
5469
|
+
// 追加(1.12.0 / 検索と置換): openFind({ replace: true }) / replaceNext / replaceAll の委譲先(置換が使えるときだけ)。
|
|
5470
|
+
replace: findReplaceEnabled() ? {
|
|
5471
|
+
open: engine.findReplace.open,
|
|
5472
|
+
replaceCurrent: engine.findReplace.replaceCurrent,
|
|
5473
|
+
replaceAll: engine.findReplace.replaceAll
|
|
5474
|
+
} : void 0
|
|
5475
|
+
},
|
|
5289
5476
|
undoRows: history.undo,
|
|
5290
5477
|
redoRows: history.redo,
|
|
5291
5478
|
canUndoRows: history.canUndo,
|
|
@@ -5570,6 +5757,17 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
5570
5757
|
value: getCellValue2(row, column)
|
|
5571
5758
|
};
|
|
5572
5759
|
});
|
|
5760
|
+
const editingEditor = createMemo10((previous) => {
|
|
5761
|
+
const column = editingColumn();
|
|
5762
|
+
if (column === void 0) {
|
|
5763
|
+
return void 0;
|
|
5764
|
+
}
|
|
5765
|
+
if (!hasRowEditor(column)) {
|
|
5766
|
+
return resolveStaticColumnEditor2(column);
|
|
5767
|
+
}
|
|
5768
|
+
const session = editingSessionInfo();
|
|
5769
|
+
return session ? resolveColumnEditor(column, session.row) : previous;
|
|
5770
|
+
});
|
|
5573
5771
|
const portalClassName = () => [themeClassName(), resolvedMotion() === "off" ? MOTION_OFF_CLASS_NAME : void 0].filter(Boolean).join(" ") || void 0;
|
|
5574
5772
|
const writeRenderedCellValue = (rowKey, column, nextValue) => {
|
|
5575
5773
|
const viewIndex = engine.gridApi.handle.getViewRowIndex(rowKey);
|
|
@@ -5608,8 +5806,12 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
5608
5806
|
</Show12>;
|
|
5609
5807
|
};
|
|
5610
5808
|
const cellTextOf = (row, column) => {
|
|
5611
|
-
|
|
5612
|
-
|
|
5809
|
+
return formatCellText(
|
|
5810
|
+
column,
|
|
5811
|
+
getCellValue2(row, column),
|
|
5812
|
+
row,
|
|
5813
|
+
localeTexts().multiSelectSeparator
|
|
5814
|
+
);
|
|
5613
5815
|
};
|
|
5614
5816
|
const splitFind = findFeature2?.splitTextByFindRanges;
|
|
5615
5817
|
const highlightFind = (content, ranges, findCurrentIndex2) => {
|
|
@@ -5623,22 +5825,34 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
5623
5825
|
</mark> : segment.text;
|
|
5624
5826
|
});
|
|
5625
5827
|
};
|
|
5626
|
-
const isTextCellColumn = (column) => column.key !== ROW_DRAG_HANDLE_COLUMN_KEY2 && !column.renderCell && column
|
|
5828
|
+
const isTextCellColumn = (column) => column.key !== ROW_DRAG_HANDLE_COLUMN_KEY2 && !column.renderCell && !mayHaveEditorType(column, "checkbox") && // 追加(1.11.0 / 複数選択): 複数選択になりうる列はチップを描くので外します(機能があり valueFormatter の無い列)。
|
|
5829
|
+
!(multiSelectParts && column.valueFormatter === void 0 && mayBeMultiSelectColumn(column)) && !(conditionalFormatFeature2 && (column.conditionalFormat?.chips !== void 0 || column.conditionalFormat?.dataBar?.showValue === false));
|
|
5627
5830
|
const cellText = (row, column, ranges, findCurrentIndex2) => highlightFind(cellTextOf(row, column), ranges, findCurrentIndex2);
|
|
5628
|
-
const renderDefaultCellContent = (currentRow, column, cell, treeAggregate) => {
|
|
5831
|
+
const renderDefaultCellContent = (currentRow, column, cell, treeAggregate, notCheckbox = false) => {
|
|
5629
5832
|
if (column.key === ROW_DRAG_HANDLE_COLUMN_KEY2) {
|
|
5630
5833
|
return renderRowDragHandleCell(currentRow(), cell);
|
|
5631
5834
|
}
|
|
5632
5835
|
const unbound = column;
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5836
|
+
const renderCheckbox = (editor) => <CheckboxCell
|
|
5837
|
+
slot={slots().checkbox}
|
|
5838
|
+
label={column.title || column.key}
|
|
5839
|
+
checked={isCheckboxChecked(getCellValue2(currentRow(), unbound), editor())}
|
|
5840
|
+
readOnly={cell.readOnly}
|
|
5841
|
+
onToggle={() => cells.toggleCheckbox({ row: cell.rowIndex, col: cell.colIndex })}
|
|
5842
|
+
/>;
|
|
5843
|
+
if (!column.renderCell && !notCheckbox && hasRowEditor(column)) {
|
|
5844
|
+
const checkboxEditor = createMemo10(() => {
|
|
5845
|
+
const editor = resolveColumnEditor(unbound, currentRow());
|
|
5846
|
+
return editor?.type === "checkbox" ? editor : void 0;
|
|
5847
|
+
});
|
|
5848
|
+
const otherwise = renderDefaultCellContent(currentRow, column, cell, treeAggregate, true);
|
|
5849
|
+
return <Show12 when={checkboxEditor() !== void 0} fallback={otherwise}>
|
|
5850
|
+
{renderCheckbox(() => checkboxEditor() ?? {})}
|
|
5851
|
+
</Show12>;
|
|
5852
|
+
}
|
|
5853
|
+
const staticEditor = resolveStaticColumnEditor2(column);
|
|
5854
|
+
if (!column.renderCell && staticEditor?.type === "checkbox") {
|
|
5855
|
+
return renderCheckbox(() => staticEditor);
|
|
5642
5856
|
}
|
|
5643
5857
|
if (column.renderCell) {
|
|
5644
5858
|
const cellValue = createMemo10(() => getCellValue2(currentRow(), unbound));
|
|
@@ -5725,6 +5939,26 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
5725
5939
|
textOf(currentRow());
|
|
5726
5940
|
return null;
|
|
5727
5941
|
}
|
|
5942
|
+
if (multiSelectParts && unbound.valueFormatter === void 0 && mayBeMultiSelectColumn(unbound)) {
|
|
5943
|
+
const { MultiSelectChips, resolveChipLabels, splitRangesByChips: splitRangesByChips2 } = multiSelectParts;
|
|
5944
|
+
const labels = createMemo10(() => {
|
|
5945
|
+
const row = currentRow();
|
|
5946
|
+
return resolveChipLabels(resolveColumnEditor(unbound, row), getCellValue2(row, unbound), row);
|
|
5947
|
+
});
|
|
5948
|
+
const separator = () => localeTexts().multiSelectSeparator;
|
|
5949
|
+
const chipRanges = createMemo10(() => {
|
|
5950
|
+
const list = labels();
|
|
5951
|
+
const ranges = cell.findRanges;
|
|
5952
|
+
return list && ranges && ranges.length > 0 ? splitRangesByChips2(list, separator().length, ranges) : void 0;
|
|
5953
|
+
});
|
|
5954
|
+
return <Show12 when={labels()} fallback={<span class="ssg-cell-value">{highlightCellFind(textOf(currentRow()))}</span>}>
|
|
5955
|
+
{(list) => <MultiSelectChips
|
|
5956
|
+
labels={list()}
|
|
5957
|
+
separator={separator()}
|
|
5958
|
+
renderLabel={(label, index) => highlightFind(label, chipRanges()?.[index], findCurrentIndex2)}
|
|
5959
|
+
/>}
|
|
5960
|
+
</Show12>;
|
|
5961
|
+
}
|
|
5728
5962
|
const chips = formatRules?.chips;
|
|
5729
5963
|
if (conditionalFormatFeature2 && chips) {
|
|
5730
5964
|
const { GridChip: GridChip2, resolveChipSpec: resolveChipSpec2 } = conditionalFormatFeature2;
|
|
@@ -5849,6 +6083,7 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
5849
6083
|
showCellOverflowTooltip={props.showCellOverflowTooltip ?? false}
|
|
5850
6084
|
conditionalFormat={conditionalFormatFeature2}
|
|
5851
6085
|
conditionalFormatStats={conditionalFormatStats()}
|
|
6086
|
+
multiSelect={multiSelectParts}
|
|
5852
6087
|
slots={slots()}
|
|
5853
6088
|
onPointerEnter={clearHoveredRow}
|
|
5854
6089
|
/>}
|
|
@@ -5974,6 +6209,20 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
5974
6209
|
transform: vertical().bodyLayerTransform
|
|
5975
6210
|
}}
|
|
5976
6211
|
>
|
|
6212
|
+
{
|
|
6213
|
+
/* 追加(1.12.0 / 検索と置換): 「選んだ範囲だけ」の範囲の色(選択の枠より下。React 版と同じ)。 */
|
|
6214
|
+
}
|
|
6215
|
+
{findReplaceFeature2 ? (() => {
|
|
6216
|
+
const { FindScopeOverlay } = findReplaceFeature2;
|
|
6217
|
+
return <For5 each={findScopeRectsForPane(pane)} keyed={false}>
|
|
6218
|
+
{(rect) => <FindScopeOverlay
|
|
6219
|
+
rect={rect()}
|
|
6220
|
+
headerHeight={headerHeight()}
|
|
6221
|
+
leadingWidth={leadingWidth()}
|
|
6222
|
+
baseOffset={vertical().overlayBaseOffset}
|
|
6223
|
+
/>}
|
|
6224
|
+
</For5>;
|
|
6225
|
+
})() : null}
|
|
5977
6226
|
<For5 each={selectionRectsForPane(pane)} keyed={false}>
|
|
5978
6227
|
{(rect) => <Overlay
|
|
5979
6228
|
class="ssg-selection-overlay"
|
|
@@ -6029,12 +6278,14 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
6029
6278
|
leadingWidth={leadingWidth()}
|
|
6030
6279
|
baseOffset={vertical().overlayBaseOffset}
|
|
6031
6280
|
initialValue={() => view().editorInitialValue ?? store.getViewState().editorInitialValue ?? ""}
|
|
6032
|
-
editor={
|
|
6281
|
+
editor={editingEditor()}
|
|
6033
6282
|
session={editingSessionInfo()}
|
|
6034
6283
|
themeClassName={portalClassName()}
|
|
6035
6284
|
slots={slots()}
|
|
6036
6285
|
onCommit={(value, direction, option, forwardText) => edit.commitEdit(value, direction, option, forwardText)}
|
|
6037
6286
|
SearchSelectEditor={features.selectSearch?.SearchSelectCellEditor}
|
|
6287
|
+
DateTimeEditor={features.dateTimeEditors?.DateTimeCellEditor}
|
|
6288
|
+
MultiSelectEditor={features.multiSelect?.MultiSelectCellEditor}
|
|
6038
6289
|
onCancel={edit.cancelEdit}
|
|
6039
6290
|
onCommitToSelection={fillSelectionEnabled() ? engine.excelShortcuts.commitToSelection : void 0}
|
|
6040
6291
|
onRegisterFlush={edit.registerDraftFlush}
|
|
@@ -6372,6 +6623,18 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
6372
6623
|
onPrev={engine.find.prev}
|
|
6373
6624
|
onClose={closeFindAndRefocus}
|
|
6374
6625
|
slot={slots().findBar}
|
|
6626
|
+
replaceParts={findReplaceEnabled() ? findReplaceFeature2 : void 0}
|
|
6627
|
+
replaceSnapshot={findReplaceSnapshot()}
|
|
6628
|
+
onReplaceToggle={() => engine.findReplace.setExpanded(!engine.findReplace.getSnapshot().expanded)}
|
|
6629
|
+
onReplacementChange={engine.findReplace.setReplacement}
|
|
6630
|
+
onReplace={() => {
|
|
6631
|
+
engine.findReplace.replaceCurrent();
|
|
6632
|
+
}}
|
|
6633
|
+
onReplaceAll={() => {
|
|
6634
|
+
void engine.findReplace.replaceAll();
|
|
6635
|
+
}}
|
|
6636
|
+
onScopeChange={engine.findReplace.setScopeEnabled}
|
|
6637
|
+
onReplaceShortcut={() => engine.findReplace.setExpanded(true)}
|
|
6375
6638
|
/>}
|
|
6376
6639
|
</Show12>
|
|
6377
6640
|
{
|
|
@@ -8116,6 +8379,7 @@ import {
|
|
|
8116
8379
|
resolveOpenedFilterColumn
|
|
8117
8380
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/filterPopoverController";
|
|
8118
8381
|
import { inferColumnFilterType } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/inferFilterType";
|
|
8382
|
+
import { resolveStaticColumnEditor as resolveStaticColumnEditor3 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/columnEditor";
|
|
8119
8383
|
import { getCellValue as getCellValue3 } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/permissions";
|
|
8120
8384
|
import { GROUP_AUTO_COLUMN_KEY } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/grouping";
|
|
8121
8385
|
var NO_GROUP_COLUMNS = [];
|
|
@@ -8134,7 +8398,8 @@ function createFilterPopover(inputs) {
|
|
|
8134
8398
|
const rows = inputs.rows();
|
|
8135
8399
|
const isLabelRow = inputs.isLabelRow?.();
|
|
8136
8400
|
const result = inferColumnFilterType({
|
|
8137
|
-
|
|
8401
|
+
// 変更(1.11.0 / 行ごとのエディタ): 行の無い所なので、列の editor で推定します(editorForRow は見ない)。
|
|
8402
|
+
editorType: resolveStaticColumnEditor3(column)?.type,
|
|
8138
8403
|
isServerSide: inputs.isServerSide(),
|
|
8139
8404
|
rowCount: rows.length,
|
|
8140
8405
|
// ラベル行は空として数えます(見出しの文字で数値の列が文字の列に推定されないように)。
|
|
@@ -8359,6 +8624,7 @@ import {
|
|
|
8359
8624
|
resolveSyncSelectOptions,
|
|
8360
8625
|
selectCollectorResult
|
|
8361
8626
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/selectOptionsCollector";
|
|
8627
|
+
import { resolveMultiSelectFilterOptions } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/multiSelect";
|
|
8362
8628
|
import {
|
|
8363
8629
|
createAsyncSelectOptionsSource,
|
|
8364
8630
|
selectAsyncOptionsResult
|
|
@@ -8442,7 +8708,9 @@ function ColumnFilterPopoverHost(props) {
|
|
|
8442
8708
|
rowCount: optionRows().length,
|
|
8443
8709
|
getRawValueAt: getOpenedColumnRawValueAt(),
|
|
8444
8710
|
numeric: numeric(),
|
|
8445
|
-
sourceKey: sourceKey()
|
|
8711
|
+
sourceKey: sourceKey(),
|
|
8712
|
+
// 追加(1.11.0 / 複数選択): 複数選択の列は配列を要素ごとに集める(名前と並びは候補から)。
|
|
8713
|
+
multiOptions: resolveMultiSelectFilterOptions(collectColumn())
|
|
8446
8714
|
}), "render", "filterValueCollector");
|
|
8447
8715
|
const collectorSnapshot = createExternalStoreSignal(collector, "filterValueStore");
|
|
8448
8716
|
const optionsResult = createMemo21(() => {
|
|
@@ -8634,10 +8902,11 @@ function GridFilterChipBar(props) {
|
|
|
8634
8902
|
import { createEffect as createEffect8, createMemo as createMemo22 } from "solid-js";
|
|
8635
8903
|
import { createLazyModule } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/lazyModule";
|
|
8636
8904
|
import { scheduleIdleTask } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/scheduler";
|
|
8637
|
-
var filterPopoverModule = /* @__PURE__ */ createLazyModule(() => import("./chunks/ColumnFilterPopover-
|
|
8638
|
-
var toolPanelModule = /* @__PURE__ */ createLazyModule(() => import("./chunks/toolPanelViews-
|
|
8905
|
+
var filterPopoverModule = /* @__PURE__ */ createLazyModule(() => import("./chunks/ColumnFilterPopover-JL3HPGXY.jsx"));
|
|
8906
|
+
var toolPanelModule = /* @__PURE__ */ createLazyModule(() => import("./chunks/toolPanelViews-N6TGBFFW.jsx"));
|
|
8907
|
+
var dateEditorCalendarModule = /* @__PURE__ */ createLazyModule(() => import("./chunks/DateEditorCalendar-FVUNVD7Y.jsx"));
|
|
8639
8908
|
var preloadGridPopups = async () => {
|
|
8640
|
-
await Promise.all([filterPopoverModule.load(), toolPanelModule.load()]);
|
|
8909
|
+
await Promise.all([filterPopoverModule.load(), toolPanelModule.load(), dateEditorCalendarModule.load()]);
|
|
8641
8910
|
};
|
|
8642
8911
|
var reportLoadError = (error) => {
|
|
8643
8912
|
console.error("[SpreadsheetGrid] \u30DD\u30C3\u30D7\u30AA\u30FC\u30D0\u30FC\u90E8\u54C1\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\n[SpreadsheetGrid] Failed to load the popup components.", error);
|
|
@@ -8699,7 +8968,7 @@ import { splitTextByFindRanges } from "@ishibashi0112/spreadsheet-grid-core/inte
|
|
|
8699
8968
|
import { DEFAULT_FIND_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
8700
8969
|
|
|
8701
8970
|
// src/view/GridFindBar.tsx
|
|
8702
|
-
import { createRenderEffect as createRenderEffect6, createSignal as createSignal14, onSettled as onSettled7, untrack as untrack17 } from "solid-js";
|
|
8971
|
+
import { Show as Show20, createEffect as createEffect9, createRenderEffect as createRenderEffect6, createSignal as createSignal14, onSettled as onSettled7, untrack as untrack17 } from "solid-js";
|
|
8703
8972
|
import { isImeComposingKeyEvent as isImeComposingKeyEvent3 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
|
|
8704
8973
|
function GridFindBar(props) {
|
|
8705
8974
|
const texts = useFeatureLocaleText();
|
|
@@ -8710,6 +8979,20 @@ function GridFindBar(props) {
|
|
|
8710
8979
|
element?.focus();
|
|
8711
8980
|
element?.select();
|
|
8712
8981
|
});
|
|
8982
|
+
let lastFocusRequest = untrack17(() => props.snapshot.focusRequest);
|
|
8983
|
+
createEffect9(
|
|
8984
|
+
() => props.snapshot.focusRequest,
|
|
8985
|
+
(request) => {
|
|
8986
|
+
if (request === lastFocusRequest) {
|
|
8987
|
+
return;
|
|
8988
|
+
}
|
|
8989
|
+
lastFocusRequest = request;
|
|
8990
|
+
const element = untrack17(input);
|
|
8991
|
+
element?.focus();
|
|
8992
|
+
element?.select();
|
|
8993
|
+
},
|
|
8994
|
+
{ name: "findBarFocusRequest" }
|
|
8995
|
+
);
|
|
8713
8996
|
createRenderEffect6(
|
|
8714
8997
|
() => [input(), props.snapshot.query],
|
|
8715
8998
|
([element, query]) => {
|
|
@@ -8754,17 +9037,17 @@ function GridFindBar(props) {
|
|
|
8754
9037
|
} else if (event.key === "Escape") {
|
|
8755
9038
|
event.preventDefault();
|
|
8756
9039
|
props.onClose();
|
|
9040
|
+
} else if (props.replaceParts && event.ctrlKey && !event.metaKey && !event.altKey && event.key.toLowerCase() === "h") {
|
|
9041
|
+
event.preventDefault();
|
|
9042
|
+
props.onReplaceShortcut?.();
|
|
8757
9043
|
}
|
|
8758
9044
|
event.stopPropagation();
|
|
8759
9045
|
};
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
onPointerDown={(event) => event.stopPropagation()}
|
|
8766
|
-
data-ssg-find-bar=""
|
|
8767
|
-
>
|
|
9046
|
+
const main = (parts) => <>
|
|
9047
|
+
{parts ? (() => {
|
|
9048
|
+
const Toggle = parts.FindReplaceToggle;
|
|
9049
|
+
return <Toggle expanded={props.replaceSnapshot?.expanded ?? false} onToggle={() => props.onReplaceToggle?.()} />;
|
|
9050
|
+
})() : null}
|
|
8768
9051
|
<span class="ssg-find-bar-icon" aria-hidden="true">
|
|
8769
9052
|
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round">
|
|
8770
9053
|
<circle cx="11" cy="11" r="7" />
|
|
@@ -8819,6 +9102,45 @@ function GridFindBar(props) {
|
|
|
8819
9102
|
>
|
|
8820
9103
|
×
|
|
8821
9104
|
</button>
|
|
9105
|
+
</>;
|
|
9106
|
+
return <div
|
|
9107
|
+
class={["ssg-find-bar", { "ssg-find-bar--replace": props.replaceParts !== void 0 }, props.slot?.className]}
|
|
9108
|
+
style={{ ...props.slot?.style, top: px(props.headerHeight + 6) }}
|
|
9109
|
+
role="search"
|
|
9110
|
+
aria-label={texts().findLabel}
|
|
9111
|
+
onPointerDown={(event) => event.stopPropagation()}
|
|
9112
|
+
onKeyDown={(event) => {
|
|
9113
|
+
if (event.key === "Escape" && !isImeComposingKeyEvent3(event)) {
|
|
9114
|
+
event.preventDefault();
|
|
9115
|
+
event.stopPropagation();
|
|
9116
|
+
props.onClose();
|
|
9117
|
+
} else if (props.replaceParts && event.ctrlKey && !event.metaKey && !event.altKey && event.key.toLowerCase() === "h") {
|
|
9118
|
+
event.preventDefault();
|
|
9119
|
+
event.stopPropagation();
|
|
9120
|
+
props.onReplaceShortcut?.();
|
|
9121
|
+
}
|
|
9122
|
+
}}
|
|
9123
|
+
data-ssg-find-bar=""
|
|
9124
|
+
>
|
|
9125
|
+
<Show20 when={props.replaceParts} fallback={main()}>
|
|
9126
|
+
{(parts) => <>
|
|
9127
|
+
<div class="ssg-find-bar-row">{main(parts())}</div>
|
|
9128
|
+
<Show20 when={props.replaceSnapshot?.expanded === true && props.replaceSnapshot}>
|
|
9129
|
+
{(snapshot2) => {
|
|
9130
|
+
const Section = untrack17(parts).FindReplaceSection;
|
|
9131
|
+
return <Section
|
|
9132
|
+
snapshot={snapshot2()}
|
|
9133
|
+
matchCount={count()}
|
|
9134
|
+
onReplacementChange={(text) => props.onReplacementChange?.(text)}
|
|
9135
|
+
onReplace={() => props.onReplace?.()}
|
|
9136
|
+
onReplaceAll={() => props.onReplaceAll?.()}
|
|
9137
|
+
onScopeChange={(enabled) => props.onScopeChange?.(enabled)}
|
|
9138
|
+
onClose={() => props.onClose()}
|
|
9139
|
+
/>;
|
|
9140
|
+
}}
|
|
9141
|
+
</Show20>
|
|
9142
|
+
</>}
|
|
9143
|
+
</Show20>
|
|
8822
9144
|
</div>;
|
|
8823
9145
|
}
|
|
8824
9146
|
|
|
@@ -8830,19 +9152,218 @@ var findFeature = {
|
|
|
8830
9152
|
localeText: DEFAULT_FIND_LOCALE_TEXT
|
|
8831
9153
|
};
|
|
8832
9154
|
|
|
9155
|
+
// src/features/findReplace.ts
|
|
9156
|
+
import { createFindReplaceController } from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/findReplaceController";
|
|
9157
|
+
import { DEFAULT_FIND_REPLACE_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
9158
|
+
|
|
9159
|
+
// src/view/GridFindReplace.tsx
|
|
9160
|
+
import { Show as Show21, createRenderEffect as createRenderEffect7, createSignal as createSignal15, untrack as untrack18 } from "solid-js";
|
|
9161
|
+
import { formatLocaleText as formatLocaleText12 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
9162
|
+
import { isImeComposingKeyEvent as isImeComposingKeyEvent4 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
|
|
9163
|
+
var describeFindReplaceNotice = (notice, texts) => {
|
|
9164
|
+
if (notice.kind === "cellSkipped") {
|
|
9165
|
+
switch (notice.reason) {
|
|
9166
|
+
case "unsupported":
|
|
9167
|
+
return texts.findReplaceCellUnsupported;
|
|
9168
|
+
case "notOption":
|
|
9169
|
+
return texts.findReplaceCellNotOption;
|
|
9170
|
+
case "invalid":
|
|
9171
|
+
return formatLocaleText12(texts.findReplaceCellInvalid, { message: notice.message ?? "" });
|
|
9172
|
+
case "unchanged":
|
|
9173
|
+
return texts.findReplaceCellUnchanged;
|
|
9174
|
+
default:
|
|
9175
|
+
return texts.findReplaceCellSkipped;
|
|
9176
|
+
}
|
|
9177
|
+
}
|
|
9178
|
+
if (notice.kind === "scopeNeedsRange") {
|
|
9179
|
+
return texts.findInSelectionNeedsRange;
|
|
9180
|
+
}
|
|
9181
|
+
if (notice.kind === "interrupted") {
|
|
9182
|
+
return texts.findReplaceInterrupted;
|
|
9183
|
+
}
|
|
9184
|
+
if (notice.replaced === 0 && notice.skipped === 0) {
|
|
9185
|
+
return texts.findReplaceNothing;
|
|
9186
|
+
}
|
|
9187
|
+
return notice.skipped > 0 ? formatLocaleText12(texts.findReplacedSkipped, { replaced: notice.replaced, skipped: notice.skipped }) : formatLocaleText12(texts.findReplaced, { replaced: notice.replaced });
|
|
9188
|
+
};
|
|
9189
|
+
function GridFindReplaceToggle(props) {
|
|
9190
|
+
const texts = useFeatureLocaleText();
|
|
9191
|
+
return <button
|
|
9192
|
+
type="button"
|
|
9193
|
+
class="ssg-find-bar-btn ssg-find-bar-toggle"
|
|
9194
|
+
aria-expanded={props.expanded ? "true" : "false"}
|
|
9195
|
+
aria-label={props.expanded ? texts().findReplaceHide : texts().findReplaceShow}
|
|
9196
|
+
data-ssg-tooltip={texts().findReplaceToggleHint}
|
|
9197
|
+
onClick={() => props.onToggle()}
|
|
9198
|
+
>
|
|
9199
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
9200
|
+
<polyline points="9 6 15 12 9 18" />
|
|
9201
|
+
</svg>
|
|
9202
|
+
</button>;
|
|
9203
|
+
}
|
|
9204
|
+
function GridFindReplaceSection(props) {
|
|
9205
|
+
const texts = useFeatureLocaleText();
|
|
9206
|
+
const [input, setInput] = createSignal15();
|
|
9207
|
+
const initialReplacement = untrack18(() => props.snapshot.replacement);
|
|
9208
|
+
createRenderEffect7(
|
|
9209
|
+
() => [input(), props.snapshot.replacement],
|
|
9210
|
+
([element, replacement]) => {
|
|
9211
|
+
if (element && element.value !== replacement) {
|
|
9212
|
+
element.value = replacement;
|
|
9213
|
+
}
|
|
9214
|
+
},
|
|
9215
|
+
{ name: "findReplaceInput" }
|
|
9216
|
+
);
|
|
9217
|
+
const handleKeyDown = (event) => {
|
|
9218
|
+
if (isImeComposingKeyEvent4(event)) {
|
|
9219
|
+
return;
|
|
9220
|
+
}
|
|
9221
|
+
if (event.key === "Enter") {
|
|
9222
|
+
event.preventDefault();
|
|
9223
|
+
if (!props.snapshot.running && props.matchCount > 0) {
|
|
9224
|
+
props.onReplace();
|
|
9225
|
+
}
|
|
9226
|
+
} else if (event.key === "Escape") {
|
|
9227
|
+
event.preventDefault();
|
|
9228
|
+
props.onClose();
|
|
9229
|
+
} else if (event.ctrlKey && !event.metaKey && !event.altKey && event.key.toLowerCase() === "h") {
|
|
9230
|
+
event.preventDefault();
|
|
9231
|
+
}
|
|
9232
|
+
event.stopPropagation();
|
|
9233
|
+
};
|
|
9234
|
+
const message = () => {
|
|
9235
|
+
const snapshot2 = props.snapshot;
|
|
9236
|
+
if (snapshot2.running) {
|
|
9237
|
+
return texts().findReplacing;
|
|
9238
|
+
}
|
|
9239
|
+
return snapshot2.notice ? describeFindReplaceNotice(snapshot2.notice, texts()) : "";
|
|
9240
|
+
};
|
|
9241
|
+
const disabled = () => props.snapshot.running || props.matchCount === 0;
|
|
9242
|
+
return <>
|
|
9243
|
+
<div class="ssg-find-bar-row">
|
|
9244
|
+
<span class="ssg-find-bar-indent" aria-hidden="true" />
|
|
9245
|
+
<input
|
|
9246
|
+
ref={setInput}
|
|
9247
|
+
class="ssg-find-bar-input"
|
|
9248
|
+
type="text"
|
|
9249
|
+
value={initialReplacement}
|
|
9250
|
+
placeholder={texts().findReplacePlaceholder}
|
|
9251
|
+
aria-label={texts().findReplaceInput}
|
|
9252
|
+
onInput={(event) => props.onReplacementChange(event.currentTarget.value)}
|
|
9253
|
+
onKeyDown={handleKeyDown}
|
|
9254
|
+
/>
|
|
9255
|
+
{
|
|
9256
|
+
/* 使えないときは disabled ではなく aria-disabled(押したボタンのフォーカスを body へ落とさない。React 版と同じ)。 */
|
|
9257
|
+
}
|
|
9258
|
+
<button
|
|
9259
|
+
type="button"
|
|
9260
|
+
class="ssg-find-bar-text-btn"
|
|
9261
|
+
onClick={() => {
|
|
9262
|
+
if (!props.snapshot.running) {
|
|
9263
|
+
props.onReplace();
|
|
9264
|
+
}
|
|
9265
|
+
}}
|
|
9266
|
+
aria-disabled={disabled() ? "true" : void 0}
|
|
9267
|
+
data-ssg-tooltip={texts().findReplaceHint}
|
|
9268
|
+
>
|
|
9269
|
+
{texts().findReplace}
|
|
9270
|
+
</button>
|
|
9271
|
+
<button
|
|
9272
|
+
type="button"
|
|
9273
|
+
class="ssg-find-bar-text-btn"
|
|
9274
|
+
onClick={() => {
|
|
9275
|
+
if (props.snapshot.running) {
|
|
9276
|
+
return;
|
|
9277
|
+
}
|
|
9278
|
+
if (props.matchCount === 0) {
|
|
9279
|
+
props.onReplace();
|
|
9280
|
+
} else {
|
|
9281
|
+
props.onReplaceAll();
|
|
9282
|
+
}
|
|
9283
|
+
}}
|
|
9284
|
+
aria-disabled={disabled() ? "true" : void 0}
|
|
9285
|
+
>
|
|
9286
|
+
{texts().findReplaceAll}
|
|
9287
|
+
</button>
|
|
9288
|
+
</div>
|
|
9289
|
+
<div class="ssg-find-bar-options">
|
|
9290
|
+
<label class="ssg-find-bar-check">
|
|
9291
|
+
<input
|
|
9292
|
+
type="checkbox"
|
|
9293
|
+
checked={props.snapshot.scope !== null}
|
|
9294
|
+
onChange={(event) => {
|
|
9295
|
+
const target = event.currentTarget;
|
|
9296
|
+
const wanted = target.checked;
|
|
9297
|
+
target.checked = !wanted;
|
|
9298
|
+
props.onScopeChange(wanted);
|
|
9299
|
+
}}
|
|
9300
|
+
/>
|
|
9301
|
+
{texts().findInSelection}
|
|
9302
|
+
</label>
|
|
9303
|
+
</div>
|
|
9304
|
+
{
|
|
9305
|
+
/* 知らせのたびに文の要素を作り直します(同じ文が続いても読み上げに届く。React 版と同じ)。 */
|
|
9306
|
+
}
|
|
9307
|
+
<div class={["ssg-find-bar-message", { "ssg-find-bar-message--empty": message().length === 0 }]} aria-live="polite">
|
|
9308
|
+
<Show21 when={props.snapshot.noticeId + 1} keyed>
|
|
9309
|
+
{(noticeKey) => {
|
|
9310
|
+
void noticeKey;
|
|
9311
|
+
return <span>{message()}</span>;
|
|
9312
|
+
}}
|
|
9313
|
+
</Show21>
|
|
9314
|
+
</div>
|
|
9315
|
+
</>;
|
|
9316
|
+
}
|
|
9317
|
+
function GridFindScopeOverlay(props) {
|
|
9318
|
+
return <Show21 when={props.rect}>
|
|
9319
|
+
{(rect) => <div
|
|
9320
|
+
class="ssg-find-scope-overlay"
|
|
9321
|
+
style={{
|
|
9322
|
+
position: "absolute",
|
|
9323
|
+
left: px(props.leadingWidth + rect().left),
|
|
9324
|
+
top: px(props.headerHeight + rect().top - props.baseOffset),
|
|
9325
|
+
width: px(rect().width),
|
|
9326
|
+
height: px(rect().height)
|
|
9327
|
+
}}
|
|
9328
|
+
data-ssg-find-scope=""
|
|
9329
|
+
/>}
|
|
9330
|
+
</Show21>;
|
|
9331
|
+
}
|
|
9332
|
+
|
|
9333
|
+
// src/features/findReplace.ts
|
|
9334
|
+
var findReplaceFeature = {
|
|
9335
|
+
createFindReplaceController,
|
|
9336
|
+
FindReplaceToggle: GridFindReplaceToggle,
|
|
9337
|
+
FindReplaceSection: GridFindReplaceSection,
|
|
9338
|
+
FindScopeOverlay: GridFindScopeOverlay,
|
|
9339
|
+
localeText: DEFAULT_FIND_REPLACE_LOCALE_TEXT
|
|
9340
|
+
};
|
|
9341
|
+
|
|
9342
|
+
// src/features/richCopy.ts
|
|
9343
|
+
import {
|
|
9344
|
+
buildClipboardHtml,
|
|
9345
|
+
createClipboardColorResolver,
|
|
9346
|
+
writeRichToClipboard
|
|
9347
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/clipboardHtml";
|
|
9348
|
+
var richCopyFeature = {
|
|
9349
|
+
buildClipboardHtml,
|
|
9350
|
+
createClipboardColorResolver,
|
|
9351
|
+
writeRichToClipboard
|
|
9352
|
+
};
|
|
9353
|
+
|
|
8833
9354
|
// src/features/grouping.ts
|
|
8834
9355
|
import { buildGroupTree, flattenGroupTree } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/grouping";
|
|
8835
9356
|
import { DEFAULT_GROUPING_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
8836
9357
|
|
|
8837
9358
|
// src/view/GridBodyGroupRow.tsx
|
|
8838
|
-
import { For as For11, Show as
|
|
9359
|
+
import { For as For11, Show as Show22, createMemo as createMemo23 } from "solid-js";
|
|
8839
9360
|
import { GROUP_AUTO_COLUMN_KEY as GROUP_AUTO_COLUMN_KEY3 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/grouping";
|
|
8840
9361
|
import {
|
|
8841
9362
|
formatTotalRowCellText,
|
|
8842
9363
|
formatTotalRowNumber,
|
|
8843
9364
|
resolveTotalRowCaption
|
|
8844
9365
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/totalRow";
|
|
8845
|
-
import { formatLocaleText as
|
|
9366
|
+
import { formatLocaleText as formatLocaleText13 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
8846
9367
|
var GROUP_INDENT_PX = 16;
|
|
8847
9368
|
function GridBodyGroupRow(props) {
|
|
8848
9369
|
const texts = useFeatureLocaleText();
|
|
@@ -8865,7 +9386,7 @@ function GridBodyGroupRow(props) {
|
|
|
8865
9386
|
}}
|
|
8866
9387
|
onDblClick={() => props.onGroupToggle(props.groupRow.groupKey)}
|
|
8867
9388
|
>
|
|
8868
|
-
<
|
|
9389
|
+
<Show22 when={props.ownsRowHeader}>
|
|
8869
9390
|
<div
|
|
8870
9391
|
role={rowHeaderIsCell() ? "rowheader" : void 0}
|
|
8871
9392
|
aria-colindex={rowHeaderIsCell() ? 1 : void 0}
|
|
@@ -8890,7 +9411,7 @@ function GridBodyGroupRow(props) {
|
|
|
8890
9411
|
>
|
|
8891
9412
|
{props.showRowCheckbox ? null : props.rowIndex + 1}
|
|
8892
9413
|
</div>
|
|
8893
|
-
</
|
|
9414
|
+
</Show22>
|
|
8894
9415
|
<For11 each={props.entries} keyed={(entry) => entry.column.key}>
|
|
8895
9416
|
{(entry) => {
|
|
8896
9417
|
const unbound = createMemo23(() => entry().column);
|
|
@@ -8933,19 +9454,19 @@ function GridBodyGroupRow(props) {
|
|
|
8933
9454
|
"z-index": 1
|
|
8934
9455
|
}}
|
|
8935
9456
|
>
|
|
8936
|
-
<
|
|
9457
|
+
<Show22
|
|
8937
9458
|
when={isAutoGroupColumn()}
|
|
8938
|
-
fallback={<
|
|
9459
|
+
fallback={<Show22 when={aggregate()}>
|
|
8939
9460
|
{(shown) => <span
|
|
8940
9461
|
class="ssg-group-value"
|
|
8941
9462
|
data-ssg-tooltip-overflow={shown().text !== "" ? shown().caption !== void 0 ? `${shown().caption} ${shown().text}` : shown().text : void 0}
|
|
8942
9463
|
>
|
|
8943
|
-
<
|
|
9464
|
+
<Show22 when={shown().caption !== void 0 && shown().text !== ""}>
|
|
8944
9465
|
<span class="ssg-group-caption">{shown().caption}</span>
|
|
8945
|
-
</
|
|
9466
|
+
</Show22>
|
|
8946
9467
|
{shown().text}
|
|
8947
9468
|
</span>}
|
|
8948
|
-
</
|
|
9469
|
+
</Show22>}
|
|
8949
9470
|
>
|
|
8950
9471
|
<span
|
|
8951
9472
|
aria-hidden="true"
|
|
@@ -8957,7 +9478,7 @@ function GridBodyGroupRow(props) {
|
|
|
8957
9478
|
tabindex={-1}
|
|
8958
9479
|
class="ssg-group-toggle"
|
|
8959
9480
|
aria-expanded={props.isCollapsed ? "false" : "true"}
|
|
8960
|
-
aria-label={
|
|
9481
|
+
aria-label={formatLocaleText13(props.isCollapsed ? texts().expandGroup : texts().collapseGroup, {
|
|
8961
9482
|
group: groupLabel()
|
|
8962
9483
|
})}
|
|
8963
9484
|
onClick={() => props.onGroupToggle(props.groupRow.groupKey)}
|
|
@@ -8967,9 +9488,9 @@ function GridBodyGroupRow(props) {
|
|
|
8967
9488
|
</button>
|
|
8968
9489
|
<span class="ssg-group-label">{groupLabel()}</span>
|
|
8969
9490
|
<span class="ssg-group-count">
|
|
8970
|
-
{
|
|
9491
|
+
{formatLocaleText13(texts().groupRowCount, { count: formatTotalRowNumber(props.groupRow.leafCount) })}
|
|
8971
9492
|
</span>
|
|
8972
|
-
</
|
|
9493
|
+
</Show22>
|
|
8973
9494
|
</div>;
|
|
8974
9495
|
}}
|
|
8975
9496
|
</For11>
|
|
@@ -9005,7 +9526,7 @@ import {
|
|
|
9005
9526
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/labelRows";
|
|
9006
9527
|
|
|
9007
9528
|
// src/view/GridBodyLabelRow.tsx
|
|
9008
|
-
import { Show as
|
|
9529
|
+
import { Show as Show23, createMemo as createMemo24 } from "solid-js";
|
|
9009
9530
|
var createLabelRowRenderContext = (labelRow, rowIndex, rowKey) => {
|
|
9010
9531
|
const row = createMemo24(() => labelRow().row);
|
|
9011
9532
|
const sourceRowIndex = createMemo24(() => labelRow().sourceIndex);
|
|
@@ -9055,7 +9576,7 @@ function GridBodyLabelRow(props) {
|
|
|
9055
9576
|
transform: `translateY(${props.top}px)`
|
|
9056
9577
|
}}
|
|
9057
9578
|
>
|
|
9058
|
-
<
|
|
9579
|
+
<Show23 when={props.ownsRowHeader}>
|
|
9059
9580
|
<div
|
|
9060
9581
|
aria-hidden="true"
|
|
9061
9582
|
class={["ssg-header-cell", "ssg-row-header-cell", "ssg-row-header-cell--label", props.slots.rowHeaderCell?.className]}
|
|
@@ -9066,8 +9587,8 @@ function GridBodyLabelRow(props) {
|
|
|
9066
9587
|
height: px(props.rowHeight)
|
|
9067
9588
|
}}
|
|
9068
9589
|
/>
|
|
9069
|
-
</
|
|
9070
|
-
<
|
|
9590
|
+
</Show23>
|
|
9591
|
+
<Show23 when={props.renderContent}>
|
|
9071
9592
|
{(render) => <div
|
|
9072
9593
|
role="rowheader"
|
|
9073
9594
|
aria-colindex={1}
|
|
@@ -9081,17 +9602,17 @@ function GridBodyLabelRow(props) {
|
|
|
9081
9602
|
{render()(ctx)}
|
|
9082
9603
|
</div>
|
|
9083
9604
|
</div>}
|
|
9084
|
-
</
|
|
9605
|
+
</Show23>
|
|
9085
9606
|
</div>;
|
|
9086
9607
|
}
|
|
9087
9608
|
|
|
9088
9609
|
// src/view/GridStickyLabelLayer.tsx
|
|
9089
|
-
import { Show as
|
|
9610
|
+
import { Show as Show24, createMemo as createMemo25, onSettled as onSettled8 } from "solid-js";
|
|
9090
9611
|
var FOCUSABLE_SELECTOR = 'a[href], button, input, select, textarea, [tabindex], [contenteditable="true"]';
|
|
9091
9612
|
function GridStickyLabelLayer(props) {
|
|
9092
|
-
return <
|
|
9613
|
+
return <Show24 when={props.entry}>
|
|
9093
9614
|
{(entry) => <StickyLabel layer={props} entry={entry} />}
|
|
9094
|
-
</
|
|
9615
|
+
</Show24>;
|
|
9095
9616
|
}
|
|
9096
9617
|
function StickyLabel(props) {
|
|
9097
9618
|
const layer = props.layer;
|
|
@@ -9153,7 +9674,7 @@ function StickyLabel(props) {
|
|
|
9153
9674
|
...props.entry().pushOffset > 0 ? { transform: `translateY(${-props.entry().pushOffset}px)` } : null
|
|
9154
9675
|
}}
|
|
9155
9676
|
>
|
|
9156
|
-
<
|
|
9677
|
+
<Show24 when={layer.ownsRowHeader}>
|
|
9157
9678
|
<div
|
|
9158
9679
|
class={["ssg-header-cell", "ssg-row-header-cell", "ssg-row-header-cell--label", layer.slots.rowHeaderCell?.className]}
|
|
9159
9680
|
style={{
|
|
@@ -9163,8 +9684,8 @@ function StickyLabel(props) {
|
|
|
9163
9684
|
height: px(height())
|
|
9164
9685
|
}}
|
|
9165
9686
|
/>
|
|
9166
|
-
</
|
|
9167
|
-
<
|
|
9687
|
+
</Show24>
|
|
9688
|
+
<Show24 when={layer.renderContent}>
|
|
9168
9689
|
{(render) => <div
|
|
9169
9690
|
class="ssg-label-row-content-holder"
|
|
9170
9691
|
style={{ left: px(layer.contentStickyLeft), width: px(layer.contentWidth), height: px(height()) }}
|
|
@@ -9173,12 +9694,12 @@ function StickyLabel(props) {
|
|
|
9173
9694
|
class={["ssg-label-row-content", layer.slots.labelRowContent?.className]}
|
|
9174
9695
|
style={layer.slots.labelRowContent?.style}
|
|
9175
9696
|
>
|
|
9176
|
-
<
|
|
9697
|
+
<Show24 when={[rowKey(), render()]} keyed>
|
|
9177
9698
|
{([, renderContent]) => renderContent(ctx)}
|
|
9178
|
-
</
|
|
9699
|
+
</Show24>
|
|
9179
9700
|
</div>
|
|
9180
9701
|
</div>}
|
|
9181
|
-
</
|
|
9702
|
+
</Show24>
|
|
9182
9703
|
</div>
|
|
9183
9704
|
</div>
|
|
9184
9705
|
);
|
|
@@ -9201,12 +9722,12 @@ import { createSaveStatusController } from "@ishibashi0112/spreadsheet-grid-core
|
|
|
9201
9722
|
import { DEFAULT_SERVER_SIDE_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
9202
9723
|
|
|
9203
9724
|
// src/primitives/serverSide.ts
|
|
9204
|
-
import { createMemo as createMemo26, untrack as
|
|
9725
|
+
import { createMemo as createMemo26, untrack as untrack19 } from "solid-js";
|
|
9205
9726
|
import {
|
|
9206
9727
|
createServerSideRowModel
|
|
9207
9728
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/serverSideRowModel";
|
|
9208
9729
|
function createServerSide(args) {
|
|
9209
|
-
const controller = createServerSideRowModel(
|
|
9730
|
+
const controller = createServerSideRowModel(untrack19(args));
|
|
9210
9731
|
let updated = false;
|
|
9211
9732
|
let pendingRange = null;
|
|
9212
9733
|
connectController(
|
|
@@ -9255,21 +9776,21 @@ function createServerSide(args) {
|
|
|
9255
9776
|
}
|
|
9256
9777
|
|
|
9257
9778
|
// src/view/GridServerSideErrorBars.tsx
|
|
9258
|
-
import { Show as
|
|
9259
|
-
import { formatLocaleText as
|
|
9779
|
+
import { Show as Show25, createSignal as createSignal16 } from "solid-js";
|
|
9780
|
+
import { formatLocaleText as formatLocaleText14 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
9260
9781
|
function GridServerSideErrorBars(props) {
|
|
9261
|
-
const [dismissedLoadError, setDismissedLoadError] =
|
|
9262
|
-
const [dismissedWriteError, setDismissedWriteError] =
|
|
9782
|
+
const [dismissedLoadError, setDismissedLoadError] = createSignal16(null);
|
|
9783
|
+
const [dismissedWriteError, setDismissedWriteError] = createSignal16(null);
|
|
9263
9784
|
const texts = () => props.localeTexts;
|
|
9264
9785
|
const shownLoadError = () => props.loadError !== null && props.loadError !== dismissedLoadError() ? props.loadError : null;
|
|
9265
9786
|
const shownWriteError = () => props.writeError !== null && props.writeError !== dismissedWriteError() ? props.writeError : null;
|
|
9266
|
-
return <
|
|
9787
|
+
return <Show25 when={shownLoadError() !== null || shownWriteError() !== null}>
|
|
9267
9788
|
<div class="ssg-ssrm-error-bars">
|
|
9268
|
-
<
|
|
9789
|
+
<Show25 when={shownLoadError()}>
|
|
9269
9790
|
{(loadError) => <div class={["ssg-ssrm-error-bar", props.slot?.className]} style={props.slot?.style} role="alert">
|
|
9270
9791
|
<span class="ssg-ssrm-error-bar-dot" aria-hidden="true" />
|
|
9271
9792
|
<span class="ssg-ssrm-error-bar-msg">
|
|
9272
|
-
{
|
|
9793
|
+
{formatLocaleText14(texts().loadFailed, { count: loadError().failedBlockCount })}
|
|
9273
9794
|
</span>
|
|
9274
9795
|
<button type="button" class="ssg-ssrm-error-bar-retry" onClick={() => props.onRetry()}>
|
|
9275
9796
|
{texts().retry}
|
|
@@ -9283,12 +9804,12 @@ function GridServerSideErrorBars(props) {
|
|
|
9283
9804
|
×
|
|
9284
9805
|
</button>
|
|
9285
9806
|
</div>}
|
|
9286
|
-
</
|
|
9287
|
-
<
|
|
9807
|
+
</Show25>
|
|
9808
|
+
<Show25 when={shownWriteError()}>
|
|
9288
9809
|
{(writeError) => <div class={["ssg-ssrm-error-bar", props.slot?.className]} style={props.slot?.style} role="alert">
|
|
9289
9810
|
<span class="ssg-ssrm-error-bar-dot" aria-hidden="true" />
|
|
9290
9811
|
<span class="ssg-ssrm-error-bar-msg">
|
|
9291
|
-
{
|
|
9812
|
+
{formatLocaleText14(texts().saveFailed, { count: writeError().failedRowCount })}
|
|
9292
9813
|
</span>
|
|
9293
9814
|
<button
|
|
9294
9815
|
type="button"
|
|
@@ -9299,13 +9820,13 @@ function GridServerSideErrorBars(props) {
|
|
|
9299
9820
|
×
|
|
9300
9821
|
</button>
|
|
9301
9822
|
</div>}
|
|
9302
|
-
</
|
|
9823
|
+
</Show25>
|
|
9303
9824
|
</div>
|
|
9304
|
-
</
|
|
9825
|
+
</Show25>;
|
|
9305
9826
|
}
|
|
9306
9827
|
|
|
9307
9828
|
// src/view/GridBodySkeletonRow.tsx
|
|
9308
|
-
import { For as For12, Show as
|
|
9829
|
+
import { For as For12, Show as Show26 } from "solid-js";
|
|
9309
9830
|
var SKELETON_BAR_WIDTHS = ["62%", "46%", "78%", "54%"];
|
|
9310
9831
|
function GridBodySkeletonRow(props) {
|
|
9311
9832
|
return <div
|
|
@@ -9322,7 +9843,7 @@ function GridBodySkeletonRow(props) {
|
|
|
9322
9843
|
transform: `translateY(${props.top}px)`
|
|
9323
9844
|
}}
|
|
9324
9845
|
>
|
|
9325
|
-
<
|
|
9846
|
+
<Show26 when={props.ownsRowHeader}>
|
|
9326
9847
|
<div
|
|
9327
9848
|
role="rowheader"
|
|
9328
9849
|
aria-colindex={1}
|
|
@@ -9346,11 +9867,11 @@ function GridBodySkeletonRow(props) {
|
|
|
9346
9867
|
height: px(props.rowHeight)
|
|
9347
9868
|
}}
|
|
9348
9869
|
>
|
|
9349
|
-
<
|
|
9870
|
+
<Show26 when={props.showRowCheckbox} fallback={props.rowIndex + 1}>
|
|
9350
9871
|
<RowSelectionCheckbox slot={props.slots.checkbox} state="unchecked" disabled />
|
|
9351
|
-
</
|
|
9872
|
+
</Show26>
|
|
9352
9873
|
</div>
|
|
9353
|
-
</
|
|
9874
|
+
</Show26>
|
|
9354
9875
|
<For12 each={props.entries} keyed={(entry) => entry.logicalIndex}>
|
|
9355
9876
|
{(entry) => {
|
|
9356
9877
|
const cell = () => ({ row: props.rowIndex, col: entry().logicalIndex });
|
|
@@ -9405,22 +9926,25 @@ var motionExtrasFeature = {
|
|
|
9405
9926
|
import { DEFAULT_PINNED_ROWS_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
9406
9927
|
|
|
9407
9928
|
// src/view/GridPinnedRows.tsx
|
|
9408
|
-
import { For as For13, Show as
|
|
9929
|
+
import { For as For13, Show as Show27, createMemo as createMemo27 } from "solid-js";
|
|
9409
9930
|
import { resolveSlotProps as resolveSlotProps3 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/slotProps";
|
|
9410
9931
|
import { isSyntheticColumnKey as isSyntheticColumnKey4 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/detailRow";
|
|
9411
9932
|
import { isCheckboxChecked as isCheckboxChecked2 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/checkboxEditor";
|
|
9412
|
-
import {
|
|
9933
|
+
import { resolveColumnEditor as resolveColumnEditor2 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/columnEditor";
|
|
9934
|
+
import { formatLocaleText as formatLocaleText15 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
9413
9935
|
import { getCellValue as getCellValue5 } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/permissions";
|
|
9936
|
+
import { formatCellText as formatCellText2 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/cellText";
|
|
9414
9937
|
var noop4 = () => {
|
|
9415
9938
|
};
|
|
9939
|
+
var plainLabel = (label) => label;
|
|
9416
9940
|
var PIN_ICON_PATH = "M9.8 1.5 14.5 6.2l-1.4 1.4-1-.9-2.6 2.6.3 3.2-1.4 1.4-2.6-2.6-3.3 3.3-.7-.7 3.3-3.3L2.5 8l1.4-1.4 3.2.3 2.6-2.6-.9-1z";
|
|
9417
9941
|
function GridPinnedRows(props) {
|
|
9418
9942
|
const texts = useFeatureLocaleText();
|
|
9419
9943
|
const hidden = () => !props.ownsRowHeader && props.entries.length === 0;
|
|
9420
9944
|
return <>
|
|
9421
|
-
<
|
|
9945
|
+
<Show27 when={props.bodyHeight > 0}>
|
|
9422
9946
|
<div aria-hidden="true" style={{ height: px(props.bodyHeight) }} />
|
|
9423
|
-
</
|
|
9947
|
+
</Show27>
|
|
9424
9948
|
<div
|
|
9425
9949
|
class={["ssg-pinned-rows", `ssg-pinned-rows--${props.position}`]}
|
|
9426
9950
|
style={{ [props.position]: px(props.stickyOffset), height: px(props.rows.length * props.rowHeight) }}
|
|
@@ -9450,7 +9974,7 @@ function GridPinnedRows(props) {
|
|
|
9450
9974
|
class={["ssg-pinned-row", rowSlot().className]}
|
|
9451
9975
|
style={{ ...rowSlot().style, height: px(props.rowHeight), top: px(index * props.rowHeight) }}
|
|
9452
9976
|
>
|
|
9453
|
-
<
|
|
9977
|
+
<Show27 when={props.ownsRowHeader}>
|
|
9454
9978
|
<div
|
|
9455
9979
|
role="rowheader"
|
|
9456
9980
|
aria-colindex={1}
|
|
@@ -9473,7 +9997,7 @@ function GridPinnedRows(props) {
|
|
|
9473
9997
|
class="ssg-pinned-row-icon"
|
|
9474
9998
|
viewBox="0 0 16 16"
|
|
9475
9999
|
role="img"
|
|
9476
|
-
aria-label={
|
|
10000
|
+
aria-label={formatLocaleText15(
|
|
9477
10001
|
props.position === "top" ? texts().pinnedTopRow : texts().pinnedBottomRow,
|
|
9478
10002
|
{ row: index + 1 }
|
|
9479
10003
|
)}
|
|
@@ -9481,7 +10005,7 @@ function GridPinnedRows(props) {
|
|
|
9481
10005
|
<path d={PIN_ICON_PATH} />
|
|
9482
10006
|
</svg>
|
|
9483
10007
|
</div>
|
|
9484
|
-
</
|
|
10008
|
+
</Show27>
|
|
9485
10009
|
<For13 each={props.entries} keyed={(entry) => entry.column.key}>
|
|
9486
10010
|
{(entry) => {
|
|
9487
10011
|
const unbound = createMemo27(() => entry().column);
|
|
@@ -9535,11 +10059,12 @@ function GridPinnedRows(props) {
|
|
|
9535
10059
|
if (current.renderCell) {
|
|
9536
10060
|
return current.renderCell({ ...context, tree: void 0, setValue: noop4 });
|
|
9537
10061
|
}
|
|
9538
|
-
|
|
10062
|
+
const cellEditor = resolveColumnEditor2(current, context.row);
|
|
10063
|
+
if (cellEditor?.type === "checkbox") {
|
|
9539
10064
|
return <CheckboxCell
|
|
9540
10065
|
slot={props.slots.checkbox}
|
|
9541
10066
|
label={current.title || current.key}
|
|
9542
|
-
checked={isCheckboxChecked2(context.value,
|
|
10067
|
+
checked={isCheckboxChecked2(context.value, cellEditor)}
|
|
9543
10068
|
readOnly
|
|
9544
10069
|
onToggle={noop4}
|
|
9545
10070
|
/>;
|
|
@@ -9549,7 +10074,16 @@ function GridPinnedRows(props) {
|
|
|
9549
10074
|
if (format?.dataBar?.showValue === false) {
|
|
9550
10075
|
return null;
|
|
9551
10076
|
}
|
|
9552
|
-
const
|
|
10077
|
+
const multiSelect = props.multiSelect;
|
|
10078
|
+
const chipLabels = multiSelect && current.valueFormatter === void 0 ? multiSelect.resolveChipLabels(cellEditor, context.value, context.row) : void 0;
|
|
10079
|
+
if (multiSelect && chipLabels !== void 0) {
|
|
10080
|
+
return <multiSelect.MultiSelectChips
|
|
10081
|
+
labels={chipLabels}
|
|
10082
|
+
separator={texts().multiSelectSeparator}
|
|
10083
|
+
renderLabel={plainLabel}
|
|
10084
|
+
/>;
|
|
10085
|
+
}
|
|
10086
|
+
const text = formatCellText2(current, context.value, context.row, texts().multiSelectSeparator);
|
|
9553
10087
|
const chips = unbound().conditionalFormat?.chips;
|
|
9554
10088
|
const chip = feature && chips ? feature.resolveChipSpec(chips, context) : null;
|
|
9555
10089
|
if (feature && chip) {
|
|
@@ -9588,7 +10122,7 @@ function GridPinnedRows(props) {
|
|
|
9588
10122
|
height: px(props.rowHeight)
|
|
9589
10123
|
}}
|
|
9590
10124
|
>
|
|
9591
|
-
<
|
|
10125
|
+
<Show27 when={dataBar()}>
|
|
9592
10126
|
{(bar) => <span
|
|
9593
10127
|
class={["ssg-cf-bar", { "ssg-cf-bar--negative": bar().negative }]}
|
|
9594
10128
|
style={{
|
|
@@ -9598,7 +10132,7 @@ function GridPinnedRows(props) {
|
|
|
9598
10132
|
}}
|
|
9599
10133
|
aria-hidden="true"
|
|
9600
10134
|
/>}
|
|
9601
|
-
</
|
|
10135
|
+
</Show27>
|
|
9602
10136
|
{content()}
|
|
9603
10137
|
</div>;
|
|
9604
10138
|
}}
|
|
@@ -9620,7 +10154,7 @@ var pinnedRowsFeature = {
|
|
|
9620
10154
|
import { DEFAULT_ROW_DRAG_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
9621
10155
|
|
|
9622
10156
|
// src/primitives/rowDrag.ts
|
|
9623
|
-
import { createEffect as
|
|
10157
|
+
import { createEffect as createEffect10, createMemo as createMemo28, untrack as untrack20 } from "solid-js";
|
|
9624
10158
|
import {
|
|
9625
10159
|
createRowDragController
|
|
9626
10160
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/rowDragController";
|
|
@@ -9636,8 +10170,8 @@ function createRowDrag(inputs) {
|
|
|
9636
10170
|
const centerIndicatorRef = { current: null };
|
|
9637
10171
|
const rightIndicatorRef = { current: null };
|
|
9638
10172
|
const canDropAt = createMemo28(() => createRowDropCheck(inputs.canDropRow(), inputs.rows(), inputs.resolveRowKey()));
|
|
9639
|
-
const getRowDragLabel = (viewIndex) => resolveRowDragLabel(
|
|
9640
|
-
const getDragRow = (viewIndex) => getDragRowToken(
|
|
10173
|
+
const getRowDragLabel = (viewIndex) => resolveRowDragLabel(untrack20(inputs.rowModel), untrack20(inputs.visibleColumns), viewIndex, untrack20(inputs.dragRowLabel));
|
|
10174
|
+
const getDragRow = (viewIndex) => getDragRowToken(untrack20(inputs.rowModel), viewIndex);
|
|
9641
10175
|
const locateDragRow = createMemo28(() => {
|
|
9642
10176
|
const rowModel = inputs.rowModel();
|
|
9643
10177
|
const hasRowKeys = inputs.hasRowKeys();
|
|
@@ -9660,7 +10194,7 @@ function createRowDrag(inputs) {
|
|
|
9660
10194
|
"effect",
|
|
9661
10195
|
"rowDrag"
|
|
9662
10196
|
);
|
|
9663
|
-
|
|
10197
|
+
createEffect10(inputs.rowModel, () => {
|
|
9664
10198
|
controller.applyReorderSettle();
|
|
9665
10199
|
}, { name: "rowDragSettle" });
|
|
9666
10200
|
return {
|
|
@@ -9714,7 +10248,7 @@ import { resolveScrollHintOptions } from "@ishibashi0112/spreadsheet-grid-core/i
|
|
|
9714
10248
|
import { DEFAULT_SCROLL_HINT_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
9715
10249
|
|
|
9716
10250
|
// src/view/GridScrollHint.tsx
|
|
9717
|
-
import { For as For14, Show as
|
|
10251
|
+
import { For as For14, Show as Show28, createMemo as createMemo29, createSignal as createSignal17, createEffect as createEffect11 } from "solid-js";
|
|
9718
10252
|
import { physicalToLogicalScrollTop as physicalToLogicalScrollTop3 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/verticalGeometry";
|
|
9719
10253
|
import { resolveDataRowNumber as resolveDataRowNumber3 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/labelRows";
|
|
9720
10254
|
import {
|
|
@@ -9723,7 +10257,7 @@ import {
|
|
|
9723
10257
|
computeScrollHintTrackPointerScrollTop,
|
|
9724
10258
|
resolveScrollHintDetail
|
|
9725
10259
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/scrollHint";
|
|
9726
|
-
import { formatLocaleText as
|
|
10260
|
+
import { formatLocaleText as formatLocaleText16 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
9727
10261
|
var SCROLL_HINT_LINGER_MS = 1e3;
|
|
9728
10262
|
var SCROLL_HINT_BUBBLE_GAP_PX = 8;
|
|
9729
10263
|
var SCROLL_HINT_GUTTER_WIDTH_PX = 14;
|
|
@@ -9732,11 +10266,11 @@ var SCROLL_HINT_OVERLAY_TRACK_ZONE_PX = 8;
|
|
|
9732
10266
|
var SCROLL_HINT_JUMP_LABEL_FLIP_PX = 28;
|
|
9733
10267
|
function GridScrollHint(props) {
|
|
9734
10268
|
const texts = useFeatureLocaleText();
|
|
9735
|
-
const [scrollActive, setScrollActive] =
|
|
9736
|
-
const [hovered, setHovered] =
|
|
9737
|
-
const [scrollbarWidth, setScrollbarWidth] =
|
|
9738
|
-
const [trackPointerY, setTrackPointerY] =
|
|
9739
|
-
const [dragging, setDragging] =
|
|
10269
|
+
const [scrollActive, setScrollActive] = createSignal17(false);
|
|
10270
|
+
const [hovered, setHovered] = createSignal17(false);
|
|
10271
|
+
const [scrollbarWidth, setScrollbarWidth] = createSignal17(0);
|
|
10272
|
+
const [trackPointerY, setTrackPointerY] = createSignal17(null);
|
|
10273
|
+
const [dragging, setDragging] = createSignal17(false);
|
|
9740
10274
|
let lingerTimer = null;
|
|
9741
10275
|
let dragGrab = null;
|
|
9742
10276
|
let gutter;
|
|
@@ -9752,7 +10286,7 @@ function GridScrollHint(props) {
|
|
|
9752
10286
|
})
|
|
9753
10287
|
);
|
|
9754
10288
|
const shown = createMemo29(() => track() !== null && props.rowMetrics.rowCount > 0);
|
|
9755
|
-
|
|
10289
|
+
createEffect11(scrollbar, (customScrollbar) => {
|
|
9756
10290
|
const element = props.scrollContainerRef.current;
|
|
9757
10291
|
if (!element) {
|
|
9758
10292
|
return void 0;
|
|
@@ -9801,7 +10335,7 @@ function GridScrollHint(props) {
|
|
|
9801
10335
|
}
|
|
9802
10336
|
};
|
|
9803
10337
|
}, { name: "scrollHintListeners" });
|
|
9804
|
-
|
|
10338
|
+
createEffect11(
|
|
9805
10339
|
() => scrollbar() && shown(),
|
|
9806
10340
|
(on) => {
|
|
9807
10341
|
const element = props.scrollContainerRef.current;
|
|
@@ -9918,9 +10452,9 @@ function GridScrollHint(props) {
|
|
|
9918
10452
|
setTrackPointerY(null);
|
|
9919
10453
|
}
|
|
9920
10454
|
};
|
|
9921
|
-
return <
|
|
10455
|
+
return <Show28 when={shown()}>
|
|
9922
10456
|
<div class={["ssg-scroll-hint", props.slot?.className]} style={props.slot?.style} aria-hidden="true">
|
|
9923
|
-
<
|
|
10457
|
+
<Show28 when={props.options.ruler && rulerTicks().length > 0}>
|
|
9924
10458
|
<div
|
|
9925
10459
|
class={["ssg-scroll-hint-ruler", { "ssg-scroll-hint-ruler--visible": rulerVisible() }]}
|
|
9926
10460
|
style={{ top: px(props.headerHeight), right: px(rightInset()) }}
|
|
@@ -9934,8 +10468,8 @@ function GridScrollHint(props) {
|
|
|
9934
10468
|
</div>}
|
|
9935
10469
|
</For14>
|
|
9936
10470
|
</div>
|
|
9937
|
-
</
|
|
9938
|
-
<
|
|
10471
|
+
</Show28>
|
|
10472
|
+
<Show28 when={jumpPreview()}>
|
|
9939
10473
|
{(preview) => <div class="ssg-scroll-hint-jumpline" style={{ top: px(preview().lineY), right: px(rightInset()) }}>
|
|
9940
10474
|
<span
|
|
9941
10475
|
class={[
|
|
@@ -9945,17 +10479,17 @@ function GridScrollHint(props) {
|
|
|
9945
10479
|
}
|
|
9946
10480
|
]}
|
|
9947
10481
|
>
|
|
9948
|
-
{
|
|
9949
|
-
<
|
|
10482
|
+
{formatLocaleText16(texts().scrollHintJump, { row: rowNumberOf(preview().rowIndex).toLocaleString() })}
|
|
10483
|
+
<Show28 when={preview().detail !== null}>
|
|
9950
10484
|
<span class="ssg-scroll-hint-jumpline-detail">
|
|
9951
10485
|
{` ${texts().scrollHintJumpSeparator} `}
|
|
9952
10486
|
{preview().detail}
|
|
9953
10487
|
</span>
|
|
9954
|
-
</
|
|
10488
|
+
</Show28>
|
|
9955
10489
|
</span>
|
|
9956
10490
|
</div>}
|
|
9957
|
-
</
|
|
9958
|
-
<
|
|
10491
|
+
</Show28>
|
|
10492
|
+
<Show28 when={props.options.bubble}>
|
|
9959
10493
|
<div
|
|
9960
10494
|
class={["ssg-scroll-hint-bubble", { "ssg-scroll-hint-bubble--visible": visible() }]}
|
|
9961
10495
|
style={{
|
|
@@ -9964,17 +10498,17 @@ function GridScrollHint(props) {
|
|
|
9964
10498
|
}}
|
|
9965
10499
|
>
|
|
9966
10500
|
<span class="ssg-scroll-hint-bubble-main">
|
|
9967
|
-
{
|
|
10501
|
+
{formatLocaleText16(texts().scrollHintRow, { row: rowNumberOf(topRowIndex()).toLocaleString() })}
|
|
9968
10502
|
<span class="ssg-scroll-hint-bubble-total">
|
|
9969
10503
|
{" "}/ {dataRowCount().toLocaleString()}
|
|
9970
10504
|
</span>
|
|
9971
10505
|
</span>
|
|
9972
|
-
<
|
|
10506
|
+
<Show28 when={detail() !== null}>
|
|
9973
10507
|
<span class="ssg-scroll-hint-bubble-detail">{detail()}</span>
|
|
9974
|
-
</
|
|
10508
|
+
</Show28>
|
|
9975
10509
|
</div>
|
|
9976
|
-
</
|
|
9977
|
-
<
|
|
10510
|
+
</Show28>
|
|
10511
|
+
<Show28 when={scrollbar()}>
|
|
9978
10512
|
<div
|
|
9979
10513
|
ref={(element) => {
|
|
9980
10514
|
gutter = element;
|
|
@@ -9998,9 +10532,9 @@ function GridScrollHint(props) {
|
|
|
9998
10532
|
style={{ top: px(track()?.thumbTop ?? 0), height: px(track()?.thumbHeight ?? 0) }}
|
|
9999
10533
|
/>
|
|
10000
10534
|
</div>
|
|
10001
|
-
</
|
|
10535
|
+
</Show28>
|
|
10002
10536
|
</div>
|
|
10003
|
-
</
|
|
10537
|
+
</Show28>;
|
|
10004
10538
|
}
|
|
10005
10539
|
|
|
10006
10540
|
// src/features/scrollHint.ts
|
|
@@ -10014,7 +10548,7 @@ var scrollHintFeature = {
|
|
|
10014
10548
|
import { DEFAULT_SELECT_SEARCH_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
10015
10549
|
|
|
10016
10550
|
// src/editors/SearchSelectCellEditor.tsx
|
|
10017
|
-
import { For as For15, Show as
|
|
10551
|
+
import { For as For15, Show as Show29, createEffect as createEffect12, createMemo as createMemo30, createRenderEffect as createRenderEffect8, createSignal as createSignal18, createUniqueId as createUniqueId6, onCleanup as onCleanup13, onSettled as onSettled9, untrack as untrack21 } from "solid-js";
|
|
10018
10552
|
import { Portal as Portal5 } from "@solidjs/web";
|
|
10019
10553
|
import {
|
|
10020
10554
|
computeSelectPopoverPlacement as computeSelectPopoverPlacement2,
|
|
@@ -10032,26 +10566,26 @@ import {
|
|
|
10032
10566
|
import {
|
|
10033
10567
|
createSearchSelectEditorController
|
|
10034
10568
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/searchSelectEditorController";
|
|
10035
|
-
import { isImeComposingKeyEvent as
|
|
10569
|
+
import { isImeComposingKeyEvent as isImeComposingKeyEvent5 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
|
|
10036
10570
|
import { isCommitToSelectionKey as isCommitToSelectionKey2 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/editorKeys";
|
|
10037
10571
|
function MatchedText(props) {
|
|
10038
10572
|
const parts = createMemo30(() => splitSelectSearchText(props.text, props.range));
|
|
10039
10573
|
return <For15 each={parts()} keyed={false}>
|
|
10040
|
-
{(part) => <
|
|
10574
|
+
{(part) => <Show29 when={part().match} fallback={part().text}>
|
|
10041
10575
|
<mark class="ssg-select-editor-match">{part().text}</mark>
|
|
10042
|
-
</
|
|
10576
|
+
</Show29>}
|
|
10043
10577
|
</For15>;
|
|
10044
10578
|
}
|
|
10045
10579
|
function SearchSelectCellEditor(props) {
|
|
10046
10580
|
const texts = useFeatureLocaleText();
|
|
10047
10581
|
const portal = useGridPortal();
|
|
10048
|
-
const [input, setInput] =
|
|
10049
|
-
const [scroller, setScroller] =
|
|
10050
|
-
const [popover, setPopover] =
|
|
10582
|
+
const [input, setInput] = createSignal18();
|
|
10583
|
+
const [scroller, setScroller] = createSignal18();
|
|
10584
|
+
const [popover, setPopover] = createSignal18();
|
|
10051
10585
|
createTopAlignedInput(input, () => props.alignTop ?? false, () => props.cellHeight ?? 0);
|
|
10052
10586
|
const listId = createUniqueId6();
|
|
10053
10587
|
const pointerMoved = createPointerMoveFilter2();
|
|
10054
|
-
const [error, setError] =
|
|
10588
|
+
const [error, setError] = createSignal18(null);
|
|
10055
10589
|
let commitToSelectionPending = false;
|
|
10056
10590
|
const commitWithResult = (committed, direction, option, forwardText) => {
|
|
10057
10591
|
const toSelection = commitToSelectionPending ? props.onCommitToSelection : void 0;
|
|
@@ -10062,7 +10596,7 @@ function SearchSelectCellEditor(props) {
|
|
|
10062
10596
|
}
|
|
10063
10597
|
return result;
|
|
10064
10598
|
};
|
|
10065
|
-
const controller =
|
|
10599
|
+
const controller = untrack21(
|
|
10066
10600
|
() => createSearchSelectEditorController({
|
|
10067
10601
|
options: props.options,
|
|
10068
10602
|
value: props.value,
|
|
@@ -10074,20 +10608,20 @@ function SearchSelectCellEditor(props) {
|
|
|
10074
10608
|
onCancel: () => props.onCancel()
|
|
10075
10609
|
})
|
|
10076
10610
|
);
|
|
10077
|
-
const [snapshot2, setSnapshot] =
|
|
10078
|
-
|
|
10611
|
+
const [snapshot2, setSnapshot] = createSignal18(controller.getSnapshot(), { name: "searchSelectSnapshot" });
|
|
10612
|
+
createEffect12(
|
|
10079
10613
|
() => props.options,
|
|
10080
10614
|
outsideGraphApply((options) => controller.setOptions(options)),
|
|
10081
10615
|
{ name: "searchSelectOptions" }
|
|
10082
10616
|
);
|
|
10083
|
-
props.onRegisterFlush?.(
|
|
10617
|
+
props.onRegisterFlush?.(untrack21(() => props.allowFreeText) ? controller.flush : null);
|
|
10084
10618
|
const rowHeight = resolveSelectOptionRowHeight2();
|
|
10085
|
-
const [placement2, setPlacement] =
|
|
10086
|
-
const [scrollTop, setScrollTop] =
|
|
10619
|
+
const [placement2, setPlacement] = createSignal18(null);
|
|
10620
|
+
const [scrollTop, setScrollTop] = createSignal18(0);
|
|
10087
10621
|
const listRows = createMemo30(() => Math.max(snapshot2().results.length, 1));
|
|
10088
10622
|
const viewportHeight = createMemo30(() => Math.min(listRows(), 8) * rowHeight);
|
|
10089
10623
|
const measure = () => {
|
|
10090
|
-
const element =
|
|
10624
|
+
const element = untrack21(input);
|
|
10091
10625
|
if (!element) {
|
|
10092
10626
|
return;
|
|
10093
10627
|
}
|
|
@@ -10096,7 +10630,7 @@ function SearchSelectCellEditor(props) {
|
|
|
10096
10630
|
element,
|
|
10097
10631
|
computeSelectPopoverPlacement2(
|
|
10098
10632
|
element.getBoundingClientRect(),
|
|
10099
|
-
|
|
10633
|
+
untrack21(listRows),
|
|
10100
10634
|
window.innerWidth,
|
|
10101
10635
|
window.innerHeight,
|
|
10102
10636
|
rowHeight,
|
|
@@ -10118,10 +10652,10 @@ function SearchSelectCellEditor(props) {
|
|
|
10118
10652
|
};
|
|
10119
10653
|
let disposed = false;
|
|
10120
10654
|
onSettled9(() => {
|
|
10121
|
-
const element =
|
|
10655
|
+
const element = untrack21(input);
|
|
10122
10656
|
if (element) {
|
|
10123
10657
|
element.focus();
|
|
10124
|
-
if (
|
|
10658
|
+
if (untrack21(() => props.initialText) === void 0) {
|
|
10125
10659
|
element.select();
|
|
10126
10660
|
} else {
|
|
10127
10661
|
element.setSelectionRange(element.value.length, element.value.length);
|
|
@@ -10144,7 +10678,7 @@ function SearchSelectCellEditor(props) {
|
|
|
10144
10678
|
disposed = true;
|
|
10145
10679
|
});
|
|
10146
10680
|
let measuredKey;
|
|
10147
|
-
|
|
10681
|
+
createEffect12(
|
|
10148
10682
|
() => `${listRows()}:${props.cellTop ?? 0}:${props.cellLeft ?? 0}`,
|
|
10149
10683
|
outsideGraphApply((key) => {
|
|
10150
10684
|
const previous = measuredKey;
|
|
@@ -10155,13 +10689,13 @@ function SearchSelectCellEditor(props) {
|
|
|
10155
10689
|
}),
|
|
10156
10690
|
{ name: "searchSelectMeasure" }
|
|
10157
10691
|
);
|
|
10158
|
-
|
|
10692
|
+
createEffect12(
|
|
10159
10693
|
() => [snapshot2().results, scroller(), viewportHeight()],
|
|
10160
10694
|
outsideGraphApply(([, element, height]) => reveal(element, height)),
|
|
10161
10695
|
{ name: "searchSelectReveal" }
|
|
10162
10696
|
);
|
|
10163
10697
|
const handleKeyDown = (event) => {
|
|
10164
|
-
if (
|
|
10698
|
+
if (isImeComposingKeyEvent5(event)) {
|
|
10165
10699
|
return;
|
|
10166
10700
|
}
|
|
10167
10701
|
const before = controller.getSnapshot().highlight;
|
|
@@ -10172,7 +10706,7 @@ function SearchSelectCellEditor(props) {
|
|
|
10172
10706
|
}
|
|
10173
10707
|
if (controller.keyDown(toEditorKeyEvent(event), props.enterMove) && controller.getSnapshot().highlight !== before) {
|
|
10174
10708
|
setError(null);
|
|
10175
|
-
reveal(
|
|
10709
|
+
reveal(untrack21(scroller), untrack21(viewportHeight));
|
|
10176
10710
|
}
|
|
10177
10711
|
};
|
|
10178
10712
|
const results = () => snapshot2().results;
|
|
@@ -10189,7 +10723,7 @@ function SearchSelectCellEditor(props) {
|
|
|
10189
10723
|
};
|
|
10190
10724
|
const freeTextOnly = () => props.allowFreeText === true && status() === "ready" && snapshot2().filtered && results().length === 0;
|
|
10191
10725
|
const mount = () => placement2() !== null && !freeTextOnly() ? portal.container() : null;
|
|
10192
|
-
const initialText =
|
|
10726
|
+
const initialText = untrack21(() => snapshot2().text);
|
|
10193
10727
|
const view = <>
|
|
10194
10728
|
<input
|
|
10195
10729
|
ref={setInput}
|
|
@@ -10223,7 +10757,7 @@ function SearchSelectCellEditor(props) {
|
|
|
10223
10757
|
style={props.align ? { "text-align": props.align } : void 0}
|
|
10224
10758
|
/>
|
|
10225
10759
|
<CellEditorError message={error()} />
|
|
10226
|
-
<
|
|
10760
|
+
<Show29 when={mount()}>
|
|
10227
10761
|
{(container) => <Portal5 mount={container()}>
|
|
10228
10762
|
<div
|
|
10229
10763
|
ref={setPopover}
|
|
@@ -10244,7 +10778,7 @@ function SearchSelectCellEditor(props) {
|
|
|
10244
10778
|
}}
|
|
10245
10779
|
onPointerDown={(event) => event.preventDefault()}
|
|
10246
10780
|
>
|
|
10247
|
-
<
|
|
10781
|
+
<Show29 when={status() === "error"}>
|
|
10248
10782
|
<div class="ssg-select-editor-empty ssg-select-editor-error" role="alert">
|
|
10249
10783
|
<span class="ssg-select-editor-error-text" title={snapshot2().errorMessage ?? void 0}>
|
|
10250
10784
|
{texts().selectSearchFailed}
|
|
@@ -10253,13 +10787,13 @@ function SearchSelectCellEditor(props) {
|
|
|
10253
10787
|
{texts().retry}
|
|
10254
10788
|
</button>
|
|
10255
10789
|
</div>
|
|
10256
|
-
</
|
|
10257
|
-
<
|
|
10790
|
+
</Show29>
|
|
10791
|
+
<Show29 when={status() !== "error" && results().length === 0}>
|
|
10258
10792
|
<div class="ssg-select-editor-empty" role="status">
|
|
10259
10793
|
{status() === "loading" ? texts().selectSearchLoading : snapshot2().filtered ? texts().selectSearchNoMatch : texts().noOptions}
|
|
10260
10794
|
</div>
|
|
10261
|
-
</
|
|
10262
|
-
<
|
|
10795
|
+
</Show29>
|
|
10796
|
+
<Show29 when={results().length > 0}>
|
|
10263
10797
|
<div
|
|
10264
10798
|
ref={setScroller}
|
|
10265
10799
|
role="listbox"
|
|
@@ -10283,33 +10817,33 @@ function SearchSelectCellEditor(props) {
|
|
|
10283
10817
|
{ "ssg-select-editor-option--highlighted": item().index === snapshot2().highlight }
|
|
10284
10818
|
]}
|
|
10285
10819
|
style={{ top: px(item().index * rowHeight) }}
|
|
10286
|
-
onClick={() => controller.choose(
|
|
10820
|
+
onClick={() => controller.choose(untrack21(item).index)}
|
|
10287
10821
|
onPointerEnter={(event) => revealOverflowTitle2(event.currentTarget)}
|
|
10288
10822
|
onPointerMove={(event) => {
|
|
10289
10823
|
if (pointerMoved(event)) {
|
|
10290
|
-
controller.hover(
|
|
10824
|
+
controller.hover(untrack21(item).index);
|
|
10291
10825
|
}
|
|
10292
10826
|
}}
|
|
10293
10827
|
>
|
|
10294
10828
|
<span class="ssg-select-editor-option-label">
|
|
10295
10829
|
<MatchedText text={item().result.option.label} range={item().result.labelMatch} />
|
|
10296
10830
|
</span>
|
|
10297
|
-
<
|
|
10831
|
+
<Show29 when={item().result.option.description}>
|
|
10298
10832
|
{(description) => <span class="ssg-select-editor-option-description">
|
|
10299
10833
|
<MatchedText text={description()} range={item().result.descriptionMatch} />
|
|
10300
10834
|
</span>}
|
|
10301
|
-
</
|
|
10835
|
+
</Show29>
|
|
10302
10836
|
</div>}
|
|
10303
10837
|
</For15>
|
|
10304
10838
|
</div>
|
|
10305
10839
|
</div>
|
|
10306
|
-
</
|
|
10840
|
+
</Show29>
|
|
10307
10841
|
</div>
|
|
10308
10842
|
</Portal5>}
|
|
10309
|
-
</
|
|
10843
|
+
</Show29>
|
|
10310
10844
|
</>;
|
|
10311
10845
|
createPortalTokens(popover, () => props.themeClassName, placement2);
|
|
10312
|
-
|
|
10846
|
+
createRenderEffect8(
|
|
10313
10847
|
() => [input(), snapshot2().text],
|
|
10314
10848
|
([element, text]) => {
|
|
10315
10849
|
if (element && element.value !== text) {
|
|
@@ -10327,23 +10861,892 @@ var selectSearchFeature = {
|
|
|
10327
10861
|
localeText: DEFAULT_SELECT_SEARCH_LOCALE_TEXT
|
|
10328
10862
|
};
|
|
10329
10863
|
|
|
10330
|
-
// src/features/
|
|
10331
|
-
import {
|
|
10332
|
-
import {
|
|
10333
|
-
buildRevertMenuItems,
|
|
10334
|
-
describeUnsavedCell,
|
|
10335
|
-
formatUnsavedSummary
|
|
10336
|
-
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/changeTracking";
|
|
10337
|
-
import { DEFAULT_CHANGE_TRACKING_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
10338
|
-
var changeTrackingFeature = {
|
|
10339
|
-
createChangeTracker,
|
|
10340
|
-
describeUnsavedCell,
|
|
10341
|
-
formatUnsavedSummary,
|
|
10342
|
-
buildRevertMenuItems,
|
|
10343
|
-
localeText: DEFAULT_CHANGE_TRACKING_LOCALE_TEXT
|
|
10344
|
-
};
|
|
10864
|
+
// src/features/dateTimeEditors.ts
|
|
10865
|
+
import { DEFAULT_DATE_TIME_EDITORS_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
10345
10866
|
|
|
10346
|
-
// src/
|
|
10867
|
+
// src/editors/DateTimeCellEditor.tsx
|
|
10868
|
+
import { For as For16, Show as Show30, createEffect as createEffect13, createMemo as createMemo31, createRenderEffect as createRenderEffect9, createSignal as createSignal19, createUniqueId as createUniqueId7, onCleanup as onCleanup14, onSettled as onSettled10, untrack as untrack22 } from "solid-js";
|
|
10869
|
+
import { Portal as Portal6 } from "@solidjs/web";
|
|
10870
|
+
import { handleEditorKeyDown as handleEditorKeyDown4 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/editorKeys";
|
|
10871
|
+
import { formatLocaleText as formatLocaleText17 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
10872
|
+
import { isImeComposingKeyEvent as isImeComposingKeyEvent6 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
|
|
10873
|
+
import { toDateInputValue as toDateInputValue2 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/editorValues";
|
|
10874
|
+
import { toDateTimeValue, toTimeValue } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/dateTimeValues";
|
|
10875
|
+
import {
|
|
10876
|
+
centerTimeListRow,
|
|
10877
|
+
isCoarsePointer,
|
|
10878
|
+
placeDateTimePopup,
|
|
10879
|
+
resolveDateTimeTypedText,
|
|
10880
|
+
resolveDefaultTime,
|
|
10881
|
+
resolveTimePartRange,
|
|
10882
|
+
resolveTimeStep
|
|
10883
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/dateTimeEditor";
|
|
10884
|
+
import {
|
|
10885
|
+
resolveSelectListWindow as resolveSelectListWindow2,
|
|
10886
|
+
revealSelectListRow as revealSelectListRow2
|
|
10887
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectSearch";
|
|
10888
|
+
import {
|
|
10889
|
+
computeSelectPopoverPlacement as computeSelectPopoverPlacement3,
|
|
10890
|
+
resolveSelectOptionRowHeight as resolveSelectOptionRowHeight3
|
|
10891
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState";
|
|
10892
|
+
import { withAnchorVisibility as withAnchorVisibility3 } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/editorVisibleBounds";
|
|
10893
|
+
import {
|
|
10894
|
+
createDateTimeEditorController
|
|
10895
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/dateTimeEditorController";
|
|
10896
|
+
var TIME_LIST_MIN_WIDTH = 96;
|
|
10897
|
+
function DateTimeCellEditor(props) {
|
|
10898
|
+
const kind = untrack22(() => props.editor.type);
|
|
10899
|
+
const defaultTime = resolveDefaultTime(untrack22(() => props.editor.type === "datetime" ? props.editor.defaultTime : void 0));
|
|
10900
|
+
const typedText = untrack22(() => resolveDateTimeTypedText(kind, props.initialValue, props.value, defaultTime));
|
|
10901
|
+
if (typedText === void 0 && isCoarsePointer()) {
|
|
10902
|
+
if (kind === "date") {
|
|
10903
|
+
return <DateCellEditor
|
|
10904
|
+
ariaLabel={props.ariaLabel}
|
|
10905
|
+
enterMove={props.enterMove}
|
|
10906
|
+
initialValue={toDateInputValue2(untrack22(() => props.value))}
|
|
10907
|
+
onCommit={(value, direction) => props.onCommit(value, direction)}
|
|
10908
|
+
onCancel={() => props.onCancel()}
|
|
10909
|
+
onCommitToSelection={props.onCommitToSelection}
|
|
10910
|
+
onRegisterFlush={(flush) => props.onRegisterFlush?.(flush)}
|
|
10911
|
+
align={props.align}
|
|
10912
|
+
cellHeight={props.cellHeight}
|
|
10913
|
+
alignTop={props.alignTop}
|
|
10914
|
+
/>;
|
|
10915
|
+
}
|
|
10916
|
+
return <NativeDateTimeEditor {...props} kind={kind} defaultTime={defaultTime} />;
|
|
10917
|
+
}
|
|
10918
|
+
return <TypedDateTimeEditor {...props} kind={kind} defaultTime={defaultTime} typedText={typedText} />;
|
|
10919
|
+
}
|
|
10920
|
+
function NativeDateTimeEditor(props) {
|
|
10921
|
+
const [input, setInput] = createSignal19();
|
|
10922
|
+
const [error, setError] = createSignal19(null);
|
|
10923
|
+
createTopAlignedInput(input, () => props.alignTop ?? false, () => props.cellHeight ?? 0);
|
|
10924
|
+
const kind = untrack22(() => props.kind);
|
|
10925
|
+
const startValue = untrack22(
|
|
10926
|
+
() => kind === "time" ? toTimeValue(props.value) : toDateTimeValue(props.value, props.defaultTime)
|
|
10927
|
+
);
|
|
10928
|
+
const step = resolveTimeStep(untrack22(() => props.editor.type === "date" ? void 0 : props.editor.step));
|
|
10929
|
+
let edited = false;
|
|
10930
|
+
const resolveValue = (current) => edited ? current : untrack22(() => props.value);
|
|
10931
|
+
let disposed = false;
|
|
10932
|
+
onCleanup14(() => {
|
|
10933
|
+
disposed = true;
|
|
10934
|
+
});
|
|
10935
|
+
props.onRegisterFlush?.(() => {
|
|
10936
|
+
untrack22(() => {
|
|
10937
|
+
const element = input();
|
|
10938
|
+
if (element && edited) {
|
|
10939
|
+
props.onCommit(element.value);
|
|
10940
|
+
}
|
|
10941
|
+
});
|
|
10942
|
+
});
|
|
10943
|
+
onSettled10(() => {
|
|
10944
|
+
untrack22(input)?.focus();
|
|
10945
|
+
});
|
|
10946
|
+
return <>
|
|
10947
|
+
<input
|
|
10948
|
+
ref={setInput}
|
|
10949
|
+
type={kind === "time" ? "time" : "datetime-local"}
|
|
10950
|
+
step={step * 60}
|
|
10951
|
+
value={startValue}
|
|
10952
|
+
onInput={() => {
|
|
10953
|
+
edited = true;
|
|
10954
|
+
setError(null);
|
|
10955
|
+
}}
|
|
10956
|
+
onKeyDown={(event) => handleEditorKeyDown4(toEditorKeyEvent(event), {
|
|
10957
|
+
value: event.currentTarget.value,
|
|
10958
|
+
onCommit: (current, direction) => props.onCommit(resolveValue(current), direction),
|
|
10959
|
+
onCancel: () => props.onCancel(),
|
|
10960
|
+
onRejected: setError,
|
|
10961
|
+
enterMove: props.enterMove,
|
|
10962
|
+
onCommitToSelection: props.onCommitToSelection === void 0 ? void 0 : (current) => props.onCommitToSelection?.(resolveValue(current)),
|
|
10963
|
+
blockHomeEnd: true
|
|
10964
|
+
})}
|
|
10965
|
+
onBlur={(event) => {
|
|
10966
|
+
if (disposed) {
|
|
10967
|
+
return;
|
|
10968
|
+
}
|
|
10969
|
+
const result = props.onCommit(resolveValue(event.currentTarget.value));
|
|
10970
|
+
if (result && result.status === "rejected") {
|
|
10971
|
+
props.onCancel();
|
|
10972
|
+
}
|
|
10973
|
+
}}
|
|
10974
|
+
aria-label={props.ariaLabel}
|
|
10975
|
+
aria-invalid={error() !== null ? "true" : void 0}
|
|
10976
|
+
class={["ssg-cell-editor-input", { "ssg-cell-editor-input--invalid": error() !== null }]}
|
|
10977
|
+
style={props.align ? { "text-align": props.align } : void 0}
|
|
10978
|
+
/>
|
|
10979
|
+
<CellEditorError message={error()} />
|
|
10980
|
+
</>;
|
|
10981
|
+
}
|
|
10982
|
+
var samePlacement = (a, b) => a === b || a !== null && b !== null && a.left === b.left && a.top === b.top && a.width === b.width && a.maxHeight === b.maxHeight && a.hidden === b.hidden;
|
|
10983
|
+
function TypedDateTimeEditor(props) {
|
|
10984
|
+
const texts = useFeatureLocaleText();
|
|
10985
|
+
const portal = useGridPortal();
|
|
10986
|
+
const kind = untrack22(() => props.kind);
|
|
10987
|
+
const editor = untrack22(() => props.editor);
|
|
10988
|
+
const typedText = untrack22(() => props.typedText);
|
|
10989
|
+
const invalidMessage = () => kind === "date" ? texts().enterDate : kind === "time" ? texts().enterTime : texts().enterDateTime;
|
|
10990
|
+
const [input, setInput] = createSignal19();
|
|
10991
|
+
const [popover, setPopover] = createSignal19();
|
|
10992
|
+
const [scroller, setScroller] = createSignal19();
|
|
10993
|
+
createTopAlignedInput(input, () => props.alignTop ?? false, () => props.cellHeight ?? 0);
|
|
10994
|
+
const popupId = createUniqueId7();
|
|
10995
|
+
const handlers = {
|
|
10996
|
+
onCommit: (value, direction) => props.onCommit(value, direction),
|
|
10997
|
+
onCancel: () => props.onCancel(),
|
|
10998
|
+
get onCommitToSelection() {
|
|
10999
|
+
const toSelection = props.onCommitToSelection;
|
|
11000
|
+
return toSelection === void 0 ? void 0 : (value) => toSelection(value);
|
|
11001
|
+
},
|
|
11002
|
+
get invalidMessage() {
|
|
11003
|
+
return invalidMessage();
|
|
11004
|
+
},
|
|
11005
|
+
get invalidTimeMessage() {
|
|
11006
|
+
return texts().enterTime;
|
|
11007
|
+
}
|
|
11008
|
+
};
|
|
11009
|
+
const controller = untrack22(
|
|
11010
|
+
() => createDateTimeEditorController({
|
|
11011
|
+
kind,
|
|
11012
|
+
value: props.value,
|
|
11013
|
+
initialText: typedText,
|
|
11014
|
+
defaultTime: props.defaultTime,
|
|
11015
|
+
step: editor.type === "date" ? void 0 : editor.step,
|
|
11016
|
+
list: editor.type === "time" && editor.picker === "list",
|
|
11017
|
+
invalidMessage: invalidMessage(),
|
|
11018
|
+
onCommit: handlers.onCommit,
|
|
11019
|
+
onCancel: handlers.onCancel
|
|
11020
|
+
})
|
|
11021
|
+
);
|
|
11022
|
+
controller.setHandlers(handlers);
|
|
11023
|
+
const [snapshot2, setSnapshot] = createSignal19(controller.getSnapshot(), { name: "dateTimeEditorSnapshot" });
|
|
11024
|
+
onCleanup14(controller.subscribe(() => setSnapshot(controller.getSnapshot())));
|
|
11025
|
+
props.onRegisterFlush?.(controller.flush);
|
|
11026
|
+
const hasCalendar = kind !== "time";
|
|
11027
|
+
const hasList = editor.type === "time" && editor.picker === "list";
|
|
11028
|
+
const timeInput = editor.type === "datetime" && editor.timeInput === true;
|
|
11029
|
+
const popupWanted = hasCalendar || hasList;
|
|
11030
|
+
const calendarViews = createLazyModuleSignal(
|
|
11031
|
+
dateEditorCalendarModule,
|
|
11032
|
+
{ needed: () => hasCalendar, prefetch: () => false },
|
|
11033
|
+
"dateEditorCalendar"
|
|
11034
|
+
);
|
|
11035
|
+
const popupReady = () => hasList || hasCalendar && calendarViews() !== null;
|
|
11036
|
+
const rowHeight = resolveSelectOptionRowHeight3();
|
|
11037
|
+
const listCount = controller.timeList.length;
|
|
11038
|
+
const viewportHeight = Math.min(listCount, 8) * rowHeight;
|
|
11039
|
+
const [placement2, setPlacement] = createSignal19(null);
|
|
11040
|
+
const [scrollTop, setScrollTop] = createSignal19(0);
|
|
11041
|
+
const measure = () => {
|
|
11042
|
+
const anchor = untrack22(input);
|
|
11043
|
+
if (!anchor) {
|
|
11044
|
+
return;
|
|
11045
|
+
}
|
|
11046
|
+
const rect = anchor.getBoundingClientRect();
|
|
11047
|
+
let next;
|
|
11048
|
+
if (hasList) {
|
|
11049
|
+
next = withAnchorVisibility3(
|
|
11050
|
+
anchor,
|
|
11051
|
+
computeSelectPopoverPlacement3(rect, listCount, window.innerWidth, window.innerHeight, rowHeight, TIME_LIST_MIN_WIDTH)
|
|
11052
|
+
);
|
|
11053
|
+
} else {
|
|
11054
|
+
const element = untrack22(popover);
|
|
11055
|
+
if (!element) {
|
|
11056
|
+
return;
|
|
11057
|
+
}
|
|
11058
|
+
next = withAnchorVisibility3(
|
|
11059
|
+
anchor,
|
|
11060
|
+
placeDateTimePopup(rect, { width: element.offsetWidth, height: element.offsetHeight }, window.innerWidth, window.innerHeight)
|
|
11061
|
+
);
|
|
11062
|
+
}
|
|
11063
|
+
if (!samePlacement(untrack22(placement2), next)) {
|
|
11064
|
+
setPlacement(next);
|
|
11065
|
+
}
|
|
11066
|
+
};
|
|
11067
|
+
let disposed = false;
|
|
11068
|
+
onCleanup14(() => {
|
|
11069
|
+
disposed = true;
|
|
11070
|
+
});
|
|
11071
|
+
onSettled10(() => {
|
|
11072
|
+
const element = untrack22(input);
|
|
11073
|
+
if (element) {
|
|
11074
|
+
element.focus();
|
|
11075
|
+
if (typedText === void 0) {
|
|
11076
|
+
element.select();
|
|
11077
|
+
} else {
|
|
11078
|
+
element.setSelectionRange(element.value.length, element.value.length);
|
|
11079
|
+
}
|
|
11080
|
+
}
|
|
11081
|
+
if (!popupWanted) {
|
|
11082
|
+
return void 0;
|
|
11083
|
+
}
|
|
11084
|
+
window.addEventListener("resize", measure);
|
|
11085
|
+
window.addEventListener("scroll", measure, true);
|
|
11086
|
+
return () => {
|
|
11087
|
+
window.removeEventListener("resize", measure);
|
|
11088
|
+
window.removeEventListener("scroll", measure, true);
|
|
11089
|
+
};
|
|
11090
|
+
});
|
|
11091
|
+
createEffect13(
|
|
11092
|
+
() => [popover(), snapshot2(), popupReady(), props.cellTop ?? 0, props.cellLeft ?? 0],
|
|
11093
|
+
outsideGraphApply(([element, , ready]) => {
|
|
11094
|
+
if (popupWanted && ready && (hasList || element)) {
|
|
11095
|
+
measure();
|
|
11096
|
+
}
|
|
11097
|
+
}),
|
|
11098
|
+
{ name: "dateTimeEditorMeasure" }
|
|
11099
|
+
);
|
|
11100
|
+
const opened = () => placement2() !== null;
|
|
11101
|
+
let lastAnchor = null;
|
|
11102
|
+
createEffect13(
|
|
11103
|
+
() => [scroller(), opened(), snapshot2().listAnchor],
|
|
11104
|
+
outsideGraphApply(([element, isOpened, anchor]) => {
|
|
11105
|
+
if (!hasList || !isOpened || !element) {
|
|
11106
|
+
return;
|
|
11107
|
+
}
|
|
11108
|
+
const first = lastAnchor === null;
|
|
11109
|
+
if (!first && lastAnchor === anchor) {
|
|
11110
|
+
return;
|
|
11111
|
+
}
|
|
11112
|
+
lastAnchor = anchor;
|
|
11113
|
+
const next = first ? centerTimeListRow(anchor, viewportHeight, rowHeight, listCount) : revealSelectListRow2(anchor, element.scrollTop, viewportHeight, rowHeight);
|
|
11114
|
+
if (next !== element.scrollTop) {
|
|
11115
|
+
element.scrollTop = next;
|
|
11116
|
+
}
|
|
11117
|
+
setScrollTop(next);
|
|
11118
|
+
}),
|
|
11119
|
+
{ name: "dateTimeEditorRevealTime" }
|
|
11120
|
+
);
|
|
11121
|
+
const focusInsideEditor = (next) => next instanceof Node && (untrack22(input)?.contains(next) === true || untrack22(popover)?.contains(next) === true);
|
|
11122
|
+
const handleBlur = (event) => {
|
|
11123
|
+
if (!disposed && !focusInsideEditor(event.relatedTarget)) {
|
|
11124
|
+
controller.blur();
|
|
11125
|
+
}
|
|
11126
|
+
};
|
|
11127
|
+
const handleKeyDown = (event, target) => {
|
|
11128
|
+
if (isImeComposingKeyEvent6(event)) {
|
|
11129
|
+
return;
|
|
11130
|
+
}
|
|
11131
|
+
if (target === "time") {
|
|
11132
|
+
controller.keyDownTime(toEditorKeyEvent(event), props.enterMove);
|
|
11133
|
+
} else {
|
|
11134
|
+
controller.keyDown(toEditorKeyEvent(event), props.enterMove);
|
|
11135
|
+
}
|
|
11136
|
+
};
|
|
11137
|
+
const notice = () => snapshot2().notice;
|
|
11138
|
+
const noticeInPopup = () => {
|
|
11139
|
+
const current = placement2();
|
|
11140
|
+
return notice() !== null && popupWanted && popupReady() && current !== null && current.hidden !== true;
|
|
11141
|
+
};
|
|
11142
|
+
const highlight = () => snapshot2().listHighlight;
|
|
11143
|
+
const activeId = () => hasList && opened() && highlight() >= 0 ? `${popupId}-${highlight()}` : void 0;
|
|
11144
|
+
const label = () => formatLocaleText17(hasList ? texts().timeEditorList : texts().dateEditorCalendar, { column: props.columnTitle });
|
|
11145
|
+
const visible = createMemo31(() => {
|
|
11146
|
+
const window_ = resolveSelectListWindow2(scrollTop(), viewportHeight, rowHeight, listCount);
|
|
11147
|
+
return controller.timeList.slice(window_.start, window_.end).map((time, offset) => ({ time, index: window_.start + offset }));
|
|
11148
|
+
});
|
|
11149
|
+
const mount = () => popupWanted && popupReady() ? portal.container() : null;
|
|
11150
|
+
const startText = untrack22(() => snapshot2().text);
|
|
11151
|
+
const noticeNode = () => <Show30 when={notice() !== null}>
|
|
11152
|
+
<div class="ssg-date-editor-notice" role="alert">
|
|
11153
|
+
{notice()}
|
|
11154
|
+
</div>
|
|
11155
|
+
</Show30>;
|
|
11156
|
+
const view = <>
|
|
11157
|
+
<input
|
|
11158
|
+
ref={setInput}
|
|
11159
|
+
type="text"
|
|
11160
|
+
value={startText}
|
|
11161
|
+
inputmode={kind === "time" ? "numeric" : void 0}
|
|
11162
|
+
onInput={(event) => controller.input(event.currentTarget.value, event.isComposing)}
|
|
11163
|
+
onCompositionEnd={(event) => controller.input(event.currentTarget.value, false)}
|
|
11164
|
+
onKeyDown={(event) => handleKeyDown(event, "date")}
|
|
11165
|
+
onBlur={handleBlur}
|
|
11166
|
+
role={popupWanted ? "combobox" : void 0}
|
|
11167
|
+
aria-haspopup={hasCalendar ? "dialog" : hasList ? "listbox" : void 0}
|
|
11168
|
+
aria-expanded={popupWanted ? opened() ? "true" : "false" : void 0}
|
|
11169
|
+
aria-controls={popupWanted && opened() ? popupId : void 0}
|
|
11170
|
+
aria-activedescendant={activeId()}
|
|
11171
|
+
aria-label={props.ariaLabel}
|
|
11172
|
+
aria-invalid={notice() !== null ? "true" : void 0}
|
|
11173
|
+
autocomplete="off"
|
|
11174
|
+
spellcheck="false"
|
|
11175
|
+
class={[
|
|
11176
|
+
"ssg-cell-editor-input",
|
|
11177
|
+
"ssg-cell-editor-input--date-time",
|
|
11178
|
+
{ "ssg-cell-editor-input--invalid": notice() !== null }
|
|
11179
|
+
]}
|
|
11180
|
+
style={props.align ? { "text-align": props.align } : void 0}
|
|
11181
|
+
/>
|
|
11182
|
+
<CellEditorError message={noticeInPopup() ? null : notice()} />
|
|
11183
|
+
<Show30 when={mount()}>
|
|
11184
|
+
{(container) => <Portal6 mount={container()}>
|
|
11185
|
+
<div
|
|
11186
|
+
ref={setPopover}
|
|
11187
|
+
id={hasCalendar ? popupId : void 0}
|
|
11188
|
+
role={hasCalendar ? "dialog" : void 0}
|
|
11189
|
+
aria-label={hasCalendar ? label() : void 0}
|
|
11190
|
+
class={[
|
|
11191
|
+
"ssg-select-editor-popover",
|
|
11192
|
+
"ssg-date-editor-popover",
|
|
11193
|
+
hasCalendar ? "ssg-date-editor-popover--calendar" : "ssg-date-editor-popover--times",
|
|
11194
|
+
props.themeClassName,
|
|
11195
|
+
props.popoverSlot?.className
|
|
11196
|
+
]}
|
|
11197
|
+
style={{
|
|
11198
|
+
...props.popoverSlot?.style,
|
|
11199
|
+
left: px(placement2()?.left ?? 0),
|
|
11200
|
+
top: px(placement2()?.top ?? 0),
|
|
11201
|
+
width: placement2()?.width !== void 0 ? px(placement2()?.width ?? 0) : void 0,
|
|
11202
|
+
"max-height": placement2()?.maxHeight !== void 0 ? px(placement2()?.maxHeight ?? 0) : void 0,
|
|
11203
|
+
visibility: placement2() === null || placement2()?.hidden ? "hidden" : void 0
|
|
11204
|
+
}}
|
|
11205
|
+
onPointerDown={(event) => {
|
|
11206
|
+
if (!(event.target instanceof HTMLInputElement)) {
|
|
11207
|
+
event.preventDefault();
|
|
11208
|
+
}
|
|
11209
|
+
}}
|
|
11210
|
+
>
|
|
11211
|
+
<Show30
|
|
11212
|
+
when={hasCalendar ? calendarViews() : null}
|
|
11213
|
+
fallback={<Show30 when={hasList}>
|
|
11214
|
+
{noticeNode()}
|
|
11215
|
+
<div
|
|
11216
|
+
ref={setScroller}
|
|
11217
|
+
role="listbox"
|
|
11218
|
+
id={popupId}
|
|
11219
|
+
aria-label={label()}
|
|
11220
|
+
class="ssg-select-editor-scroller"
|
|
11221
|
+
style={{ height: px(viewportHeight) }}
|
|
11222
|
+
onScroll={(event) => setScrollTop(event.currentTarget.scrollTop)}
|
|
11223
|
+
>
|
|
11224
|
+
<div class="ssg-select-editor-rows" role="presentation" style={{ height: px(listCount * rowHeight) }}>
|
|
11225
|
+
<For16 each={visible()} keyed={false}>
|
|
11226
|
+
{(item) => <div
|
|
11227
|
+
id={`${popupId}-${item().index}`}
|
|
11228
|
+
role="option"
|
|
11229
|
+
aria-selected={item().index === highlight() ? "true" : "false"}
|
|
11230
|
+
aria-setsize={listCount}
|
|
11231
|
+
aria-posinset={item().index + 1}
|
|
11232
|
+
class={[
|
|
11233
|
+
"ssg-select-editor-option",
|
|
11234
|
+
{ "ssg-select-editor-option--highlighted": item().index === highlight() }
|
|
11235
|
+
]}
|
|
11236
|
+
style={{ top: px(item().index * rowHeight) }}
|
|
11237
|
+
onClick={() => controller.chooseTime(untrack22(item).index)}
|
|
11238
|
+
>
|
|
11239
|
+
{item().time}
|
|
11240
|
+
</div>}
|
|
11241
|
+
</For16>
|
|
11242
|
+
</div>
|
|
11243
|
+
</div>
|
|
11244
|
+
</Show30>}
|
|
11245
|
+
>
|
|
11246
|
+
{(views) => {
|
|
11247
|
+
const Calendar = untrack22(views).DateEditorCalendar;
|
|
11248
|
+
return <Calendar
|
|
11249
|
+
controller={controller}
|
|
11250
|
+
snapshot={snapshot2()}
|
|
11251
|
+
timeInput={timeInput}
|
|
11252
|
+
timeInputLabel={texts().dateTimeEditorTime}
|
|
11253
|
+
onTimeKeyDown={(event) => handleKeyDown(event, "time")}
|
|
11254
|
+
onTimeBlur={handleBlur}
|
|
11255
|
+
notice={noticeNode()}
|
|
11256
|
+
/>;
|
|
11257
|
+
}}
|
|
11258
|
+
</Show30>
|
|
11259
|
+
</div>
|
|
11260
|
+
</Portal6>}
|
|
11261
|
+
</Show30>
|
|
11262
|
+
</>;
|
|
11263
|
+
createPortalTokens(popover, () => props.themeClassName, placement2);
|
|
11264
|
+
createRenderEffect9(
|
|
11265
|
+
() => [input(), snapshot2().text],
|
|
11266
|
+
([element, text]) => {
|
|
11267
|
+
if (element && element.value !== text) {
|
|
11268
|
+
element.value = text;
|
|
11269
|
+
}
|
|
11270
|
+
},
|
|
11271
|
+
{ name: "dateTimeEditorInputText" }
|
|
11272
|
+
);
|
|
11273
|
+
const timeSelection = createMemo31(() => snapshot2().timeSelection);
|
|
11274
|
+
createRenderEffect9(
|
|
11275
|
+
() => [input(), timeSelection()],
|
|
11276
|
+
([element, timeSelection2]) => {
|
|
11277
|
+
if (!element || timeSelection2 === 0) {
|
|
11278
|
+
return;
|
|
11279
|
+
}
|
|
11280
|
+
const text = untrack22(() => snapshot2().text);
|
|
11281
|
+
if (element.value !== text) {
|
|
11282
|
+
element.value = text;
|
|
11283
|
+
}
|
|
11284
|
+
const range = resolveTimePartRange(text);
|
|
11285
|
+
if (range) {
|
|
11286
|
+
element.setSelectionRange(range[0], range[1]);
|
|
11287
|
+
}
|
|
11288
|
+
},
|
|
11289
|
+
{ name: "dateTimeEditorTimeSelection" }
|
|
11290
|
+
);
|
|
11291
|
+
return view;
|
|
11292
|
+
}
|
|
11293
|
+
|
|
11294
|
+
// src/features/dateTimeEditors.ts
|
|
11295
|
+
var dateTimeEditorsFeature = {
|
|
11296
|
+
DateTimeCellEditor,
|
|
11297
|
+
localeText: DEFAULT_DATE_TIME_EDITORS_LOCALE_TEXT
|
|
11298
|
+
};
|
|
11299
|
+
|
|
11300
|
+
// src/features/multiSelect.ts
|
|
11301
|
+
import { DEFAULT_MULTI_SELECT_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
11302
|
+
import {
|
|
11303
|
+
resolveMultiSelectChipLabels,
|
|
11304
|
+
splitRangesByChips
|
|
11305
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/multiSelect";
|
|
11306
|
+
|
|
11307
|
+
// src/editors/MultiSelectCellEditor.tsx
|
|
11308
|
+
import { For as For17, Show as Show31, createEffect as createEffect14, createMemo as createMemo32, createRenderEffect as createRenderEffect10, createSignal as createSignal20, createUniqueId as createUniqueId8, onCleanup as onCleanup15, onSettled as onSettled11, untrack as untrack23 } from "solid-js";
|
|
11309
|
+
import { Portal as Portal7 } from "@solidjs/web";
|
|
11310
|
+
import {
|
|
11311
|
+
computeSelectPopoverPlacement as computeSelectPopoverPlacement4,
|
|
11312
|
+
resolveSelectOptionRowHeight as resolveSelectOptionRowHeight4,
|
|
11313
|
+
SELECT_SEARCH_POPOVER_MIN_WIDTH as SELECT_SEARCH_POPOVER_MIN_WIDTH2,
|
|
11314
|
+
createPointerMoveFilter as createPointerMoveFilter3
|
|
11315
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState";
|
|
11316
|
+
import { withAnchorVisibility as withAnchorVisibility4 } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/editorVisibleBounds";
|
|
11317
|
+
import { revealOverflowTitle as revealOverflowTitle3 } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/overflowTitle";
|
|
11318
|
+
import {
|
|
11319
|
+
resolveSelectListWindow as resolveSelectListWindow3,
|
|
11320
|
+
revealSelectListRow as revealSelectListRow3,
|
|
11321
|
+
splitSelectSearchText as splitSelectSearchText2
|
|
11322
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectSearch";
|
|
11323
|
+
import { createMultiSelectEditorController } from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/multiSelectEditorController";
|
|
11324
|
+
import { MULTI_SELECT_VISIBLE_ROWS } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/multiSelect";
|
|
11325
|
+
import { isImeComposingKeyEvent as isImeComposingKeyEvent7 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
|
|
11326
|
+
import { isCommitToSelectionKey as isCommitToSelectionKey3 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/editorKeys";
|
|
11327
|
+
function MatchedText2(props) {
|
|
11328
|
+
const parts = createMemo32(() => splitSelectSearchText2(props.text, props.range));
|
|
11329
|
+
return <For17 each={parts()} keyed={false}>
|
|
11330
|
+
{(part) => <Show31 when={part().match} fallback={part().text}>
|
|
11331
|
+
<mark class="ssg-select-editor-match">{part().text}</mark>
|
|
11332
|
+
</Show31>}
|
|
11333
|
+
</For17>;
|
|
11334
|
+
}
|
|
11335
|
+
var SVG_NOT_FOCUSABLE6 = { focusable: "false" };
|
|
11336
|
+
function CheckIcon() {
|
|
11337
|
+
return <svg
|
|
11338
|
+
viewBox="0 0 12 12"
|
|
11339
|
+
fill="none"
|
|
11340
|
+
stroke="currentColor"
|
|
11341
|
+
stroke-width="1.8"
|
|
11342
|
+
stroke-linecap="round"
|
|
11343
|
+
stroke-linejoin="round"
|
|
11344
|
+
{...SVG_NOT_FOCUSABLE6}
|
|
11345
|
+
>
|
|
11346
|
+
<path d="M2.6 6.3 4.9 8.6 9.4 3.7" />
|
|
11347
|
+
</svg>;
|
|
11348
|
+
}
|
|
11349
|
+
function MultiSelectCellEditor(props) {
|
|
11350
|
+
const texts = useFeatureLocaleText();
|
|
11351
|
+
const portal = useGridPortal();
|
|
11352
|
+
const [box, setBox] = createSignal20();
|
|
11353
|
+
const [input, setInput] = createSignal20();
|
|
11354
|
+
const [scroller, setScroller] = createSignal20();
|
|
11355
|
+
const [popover, setPopover] = createSignal20();
|
|
11356
|
+
const listId = createUniqueId8();
|
|
11357
|
+
const pointerMoved = createPointerMoveFilter3();
|
|
11358
|
+
const [error, setError] = createSignal20(null);
|
|
11359
|
+
const search = untrack23(() => props.search);
|
|
11360
|
+
const hint = () => search ? texts().multiSelectSearchHint : texts().multiSelectHint;
|
|
11361
|
+
const commitWithResult = (committed, direction) => {
|
|
11362
|
+
const result = props.onCommit(committed, direction);
|
|
11363
|
+
if (result && result.status === "rejected") {
|
|
11364
|
+
setError(result.message);
|
|
11365
|
+
}
|
|
11366
|
+
return result;
|
|
11367
|
+
};
|
|
11368
|
+
const controller = untrack23(
|
|
11369
|
+
() => createMultiSelectEditorController({
|
|
11370
|
+
options: props.options,
|
|
11371
|
+
value: props.value,
|
|
11372
|
+
initialText: props.initialText,
|
|
11373
|
+
search,
|
|
11374
|
+
load: props.load ? (query, signal) => props.load(query, signal) : void 0,
|
|
11375
|
+
onCommit: commitWithResult,
|
|
11376
|
+
onCancel: () => props.onCancel()
|
|
11377
|
+
})
|
|
11378
|
+
);
|
|
11379
|
+
const [snapshot2, setSnapshot] = createSignal20(controller.getSnapshot(), { name: "multiSelectSnapshot" });
|
|
11380
|
+
createEffect14(
|
|
11381
|
+
() => props.options,
|
|
11382
|
+
outsideGraphApply((options) => controller.setOptions(options)),
|
|
11383
|
+
{ name: "multiSelectOptions" }
|
|
11384
|
+
);
|
|
11385
|
+
props.onRegisterFlush?.(controller.flush);
|
|
11386
|
+
const rowHeight = resolveSelectOptionRowHeight4();
|
|
11387
|
+
const [placement2, setPlacement] = createSignal20(null);
|
|
11388
|
+
const [scrollTop, setScrollTop] = createSignal20(0);
|
|
11389
|
+
const listRows = createMemo32(() => Math.max(snapshot2().results.length, 1));
|
|
11390
|
+
const visibleRows = createMemo32(() => Math.min(listRows(), MULTI_SELECT_VISIBLE_ROWS));
|
|
11391
|
+
const viewportHeight = createMemo32(() => visibleRows() * rowHeight);
|
|
11392
|
+
const measure = () => {
|
|
11393
|
+
const element = untrack23(box);
|
|
11394
|
+
if (!element) {
|
|
11395
|
+
return;
|
|
11396
|
+
}
|
|
11397
|
+
setPlacement(
|
|
11398
|
+
withAnchorVisibility4(
|
|
11399
|
+
element,
|
|
11400
|
+
computeSelectPopoverPlacement4(
|
|
11401
|
+
element.getBoundingClientRect(),
|
|
11402
|
+
untrack23(visibleRows) + 1,
|
|
11403
|
+
window.innerWidth,
|
|
11404
|
+
window.innerHeight,
|
|
11405
|
+
rowHeight,
|
|
11406
|
+
SELECT_SEARCH_POPOVER_MIN_WIDTH2
|
|
11407
|
+
)
|
|
11408
|
+
)
|
|
11409
|
+
);
|
|
11410
|
+
};
|
|
11411
|
+
const reveal = (element, height) => {
|
|
11412
|
+
if (!element) {
|
|
11413
|
+
return;
|
|
11414
|
+
}
|
|
11415
|
+
const current = controller.getSnapshot().highlight;
|
|
11416
|
+
const next = current < 0 ? 0 : revealSelectListRow3(current, element.scrollTop, height, rowHeight);
|
|
11417
|
+
if (next !== element.scrollTop) {
|
|
11418
|
+
element.scrollTop = next;
|
|
11419
|
+
}
|
|
11420
|
+
setScrollTop(next);
|
|
11421
|
+
};
|
|
11422
|
+
let disposed = false;
|
|
11423
|
+
onSettled11(() => {
|
|
11424
|
+
const element = search ? untrack23(input) : untrack23(box);
|
|
11425
|
+
if (element) {
|
|
11426
|
+
element.focus();
|
|
11427
|
+
if (element instanceof HTMLInputElement) {
|
|
11428
|
+
element.setSelectionRange(element.value.length, element.value.length);
|
|
11429
|
+
}
|
|
11430
|
+
}
|
|
11431
|
+
setSnapshot(controller.getSnapshot());
|
|
11432
|
+
const unsubscribe = controller.subscribe(() => setSnapshot(controller.getSnapshot()));
|
|
11433
|
+
const detach = controller.attach();
|
|
11434
|
+
measure();
|
|
11435
|
+
window.addEventListener("resize", measure);
|
|
11436
|
+
window.addEventListener("scroll", measure, true);
|
|
11437
|
+
return () => {
|
|
11438
|
+
window.removeEventListener("resize", measure);
|
|
11439
|
+
window.removeEventListener("scroll", measure, true);
|
|
11440
|
+
detach();
|
|
11441
|
+
unsubscribe();
|
|
11442
|
+
};
|
|
11443
|
+
});
|
|
11444
|
+
onCleanup15(() => {
|
|
11445
|
+
disposed = true;
|
|
11446
|
+
});
|
|
11447
|
+
let measuredKey;
|
|
11448
|
+
createEffect14(
|
|
11449
|
+
() => `${visibleRows()}:${props.cellTop ?? 0}:${props.cellLeft ?? 0}`,
|
|
11450
|
+
outsideGraphApply((key) => {
|
|
11451
|
+
const previous = measuredKey;
|
|
11452
|
+
measuredKey = key;
|
|
11453
|
+
if (previous !== void 0 && previous !== key) {
|
|
11454
|
+
measure();
|
|
11455
|
+
}
|
|
11456
|
+
}),
|
|
11457
|
+
{ name: "multiSelectMeasure" }
|
|
11458
|
+
);
|
|
11459
|
+
createEffect14(
|
|
11460
|
+
() => [snapshot2().results, scroller(), viewportHeight()],
|
|
11461
|
+
outsideGraphApply(([, element, height]) => reveal(element, height)),
|
|
11462
|
+
{ name: "multiSelectReveal" }
|
|
11463
|
+
);
|
|
11464
|
+
const handleKeyDown = (event) => {
|
|
11465
|
+
if (isImeComposingKeyEvent7(event)) {
|
|
11466
|
+
return;
|
|
11467
|
+
}
|
|
11468
|
+
if (props.onCommitToSelection !== void 0 && isCommitToSelectionKey3(event)) {
|
|
11469
|
+
event.preventDefault();
|
|
11470
|
+
const result = props.onCommitToSelection(controller.valueToCommit());
|
|
11471
|
+
if (result && result.status === "rejected") {
|
|
11472
|
+
setError(result.message);
|
|
11473
|
+
}
|
|
11474
|
+
return;
|
|
11475
|
+
}
|
|
11476
|
+
const before = controller.getSnapshot();
|
|
11477
|
+
if (controller.keyDown(toEditorKeyEvent(event), props.enterMove)) {
|
|
11478
|
+
const after = controller.getSnapshot();
|
|
11479
|
+
if (after.selected !== before.selected) {
|
|
11480
|
+
setError(null);
|
|
11481
|
+
}
|
|
11482
|
+
if (after.highlight !== before.highlight) {
|
|
11483
|
+
reveal(untrack23(scroller), untrack23(viewportHeight));
|
|
11484
|
+
}
|
|
11485
|
+
}
|
|
11486
|
+
};
|
|
11487
|
+
const handleBlur = () => {
|
|
11488
|
+
if (!disposed) {
|
|
11489
|
+
controller.blur();
|
|
11490
|
+
}
|
|
11491
|
+
};
|
|
11492
|
+
const results = () => snapshot2().results;
|
|
11493
|
+
const status = () => snapshot2().status;
|
|
11494
|
+
const visible = createMemo32(() => {
|
|
11495
|
+
const list = results();
|
|
11496
|
+
const window_ = resolveSelectListWindow3(scrollTop(), viewportHeight(), rowHeight, list.length);
|
|
11497
|
+
return list.slice(window_.start, window_.end).map((result, offset) => ({ result, index: window_.start + offset }));
|
|
11498
|
+
});
|
|
11499
|
+
const listShown = () => placement2() !== null && results().length > 0;
|
|
11500
|
+
const activeId = () => {
|
|
11501
|
+
const { highlight } = snapshot2();
|
|
11502
|
+
return listShown() && highlight >= 0 && results()[highlight] ? `${listId}-${highlight}` : void 0;
|
|
11503
|
+
};
|
|
11504
|
+
const mount = () => placement2() !== null ? portal.container() : null;
|
|
11505
|
+
const initialText = untrack23(() => snapshot2().text);
|
|
11506
|
+
const justify = () => props.align === "right" ? "flex-end" : props.align === "center" ? "center" : void 0;
|
|
11507
|
+
const view = <>
|
|
11508
|
+
<div
|
|
11509
|
+
ref={setBox}
|
|
11510
|
+
class={[
|
|
11511
|
+
"ssg-cell-editor-input",
|
|
11512
|
+
"ssg-cell-editor-input--multi",
|
|
11513
|
+
{
|
|
11514
|
+
"ssg-cell-editor-input--multi-search": search,
|
|
11515
|
+
"ssg-cell-editor-input--multi-top": props.alignTop === true,
|
|
11516
|
+
"ssg-cell-editor-input--invalid": error() !== null
|
|
11517
|
+
}
|
|
11518
|
+
]}
|
|
11519
|
+
style={justify() ? { "justify-content": justify() } : void 0}
|
|
11520
|
+
tabindex={search ? void 0 : 0}
|
|
11521
|
+
role={search ? void 0 : "combobox"}
|
|
11522
|
+
aria-label={search ? void 0 : props.ariaLabel}
|
|
11523
|
+
aria-expanded={search ? void 0 : listShown() ? "true" : "false"}
|
|
11524
|
+
aria-controls={search ? void 0 : listShown() ? listId : void 0}
|
|
11525
|
+
aria-activedescendant={search ? void 0 : activeId()}
|
|
11526
|
+
aria-invalid={search ? void 0 : error() !== null ? "true" : void 0}
|
|
11527
|
+
onKeyDown={search ? void 0 : handleKeyDown}
|
|
11528
|
+
onBlur={search ? void 0 : handleBlur}
|
|
11529
|
+
onPointerDown={(event) => {
|
|
11530
|
+
const field2 = untrack23(input);
|
|
11531
|
+
if (search && event.target !== field2) {
|
|
11532
|
+
event.preventDefault();
|
|
11533
|
+
field2?.focus();
|
|
11534
|
+
}
|
|
11535
|
+
}}
|
|
11536
|
+
>
|
|
11537
|
+
<span class="ssg-multi-select-editor-chips">
|
|
11538
|
+
<For17 each={snapshot2().chips} keyed={(chip) => chip.value}>
|
|
11539
|
+
{(chip) => <span class="ssg-multi-select-chip">
|
|
11540
|
+
<span class="ssg-multi-select-chip-label">{chip().label}</span>
|
|
11541
|
+
<button
|
|
11542
|
+
type="button"
|
|
11543
|
+
tabindex={-1}
|
|
11544
|
+
class="ssg-multi-select-chip-remove"
|
|
11545
|
+
aria-label={chip().label}
|
|
11546
|
+
onPointerDown={(event) => event.preventDefault()}
|
|
11547
|
+
onClick={() => {
|
|
11548
|
+
setError(null);
|
|
11549
|
+
controller.remove(untrack23(chip).value);
|
|
11550
|
+
}}
|
|
11551
|
+
>
|
|
11552
|
+
×
|
|
11553
|
+
</button>
|
|
11554
|
+
</span>}
|
|
11555
|
+
</For17>
|
|
11556
|
+
</span>
|
|
11557
|
+
<Show31 when={search}>
|
|
11558
|
+
<input
|
|
11559
|
+
ref={setInput}
|
|
11560
|
+
type="text"
|
|
11561
|
+
value={initialText}
|
|
11562
|
+
onInput={(event) => controller.input(event.currentTarget.value, event.isComposing)}
|
|
11563
|
+
onCompositionEnd={(event) => controller.input(event.currentTarget.value, false)}
|
|
11564
|
+
onKeyDown={handleKeyDown}
|
|
11565
|
+
onBlur={handleBlur}
|
|
11566
|
+
role="combobox"
|
|
11567
|
+
aria-autocomplete="list"
|
|
11568
|
+
aria-label={props.ariaLabel}
|
|
11569
|
+
aria-expanded={listShown() ? "true" : "false"}
|
|
11570
|
+
aria-controls={listShown() ? listId : void 0}
|
|
11571
|
+
aria-activedescendant={activeId()}
|
|
11572
|
+
aria-invalid={error() !== null ? "true" : void 0}
|
|
11573
|
+
autocomplete="off"
|
|
11574
|
+
spellcheck="false"
|
|
11575
|
+
class="ssg-multi-select-editor-search"
|
|
11576
|
+
/>
|
|
11577
|
+
</Show31>
|
|
11578
|
+
</div>
|
|
11579
|
+
{
|
|
11580
|
+
/* 変更(1.11.0 / レビュー EB-4): 一覧を出している間は、検査で拒まれた知らせを一覧の下(操作の説明の所)に出します
|
|
11581
|
+
(セルの下の吹き出しは一覧に隠れていた)。一覧が隠れているときだけ吹き出し。React 版と同じ。 */
|
|
11582
|
+
}
|
|
11583
|
+
<CellEditorError message={mount() !== null && placement2()?.hidden !== true ? null : error()} />
|
|
11584
|
+
<Show31 when={mount()}>
|
|
11585
|
+
{(container) => <Portal7 mount={container()}>
|
|
11586
|
+
<div
|
|
11587
|
+
ref={setPopover}
|
|
11588
|
+
class={[
|
|
11589
|
+
"ssg-select-editor-popover",
|
|
11590
|
+
"ssg-select-editor-popover--search",
|
|
11591
|
+
"ssg-select-editor-popover--multi",
|
|
11592
|
+
{ "ssg-select-editor-popover--loading": status() === "loading" && results().length > 0 },
|
|
11593
|
+
props.themeClassName,
|
|
11594
|
+
props.popoverSlot?.className
|
|
11595
|
+
]}
|
|
11596
|
+
style={{
|
|
11597
|
+
...props.popoverSlot?.style,
|
|
11598
|
+
left: px(placement2()?.left ?? 0),
|
|
11599
|
+
top: px(placement2()?.top ?? 0),
|
|
11600
|
+
width: px(placement2()?.width ?? 0),
|
|
11601
|
+
"max-height": px(placement2()?.maxHeight ?? 0),
|
|
11602
|
+
visibility: placement2()?.hidden ? "hidden" : void 0
|
|
11603
|
+
}}
|
|
11604
|
+
onPointerDown={(event) => event.preventDefault()}
|
|
11605
|
+
>
|
|
11606
|
+
<Show31 when={status() === "error"}>
|
|
11607
|
+
<div class="ssg-select-editor-empty ssg-select-editor-error" role="alert">
|
|
11608
|
+
<span class="ssg-select-editor-error-text" title={snapshot2().errorMessage ?? void 0}>
|
|
11609
|
+
{texts().multiSelectFailed}
|
|
11610
|
+
</span>
|
|
11611
|
+
<button type="button" class="ssg-select-editor-retry" tabindex={-1} onClick={() => controller.retry()}>
|
|
11612
|
+
{texts().retry}
|
|
11613
|
+
</button>
|
|
11614
|
+
</div>
|
|
11615
|
+
</Show31>
|
|
11616
|
+
<Show31 when={status() !== "error" && results().length === 0}>
|
|
11617
|
+
<div class="ssg-select-editor-empty" role="status">
|
|
11618
|
+
{status() === "loading" ? texts().multiSelectLoading : snapshot2().filtered ? texts().multiSelectNoMatch : texts().noOptions}
|
|
11619
|
+
</div>
|
|
11620
|
+
</Show31>
|
|
11621
|
+
<Show31 when={results().length > 0}>
|
|
11622
|
+
<div
|
|
11623
|
+
ref={setScroller}
|
|
11624
|
+
role="listbox"
|
|
11625
|
+
id={listId}
|
|
11626
|
+
aria-label={props.ariaLabel}
|
|
11627
|
+
aria-multiselectable="true"
|
|
11628
|
+
aria-busy={status() === "loading" ? "true" : void 0}
|
|
11629
|
+
class="ssg-select-editor-scroller"
|
|
11630
|
+
style={{ height: px(viewportHeight()) }}
|
|
11631
|
+
onScroll={(event) => setScrollTop(event.currentTarget.scrollTop)}
|
|
11632
|
+
>
|
|
11633
|
+
<div class="ssg-select-editor-rows" role="presentation" style={{ height: px(results().length * rowHeight) }}>
|
|
11634
|
+
<For17 each={visible()} keyed={false}>
|
|
11635
|
+
{(item) => {
|
|
11636
|
+
const checked = () => snapshot2().selected.includes(item().result.option.value);
|
|
11637
|
+
return <div
|
|
11638
|
+
id={`${listId}-${item().index}`}
|
|
11639
|
+
role="option"
|
|
11640
|
+
aria-selected={checked() ? "true" : "false"}
|
|
11641
|
+
aria-setsize={results().length}
|
|
11642
|
+
aria-posinset={item().index + 1}
|
|
11643
|
+
class={[
|
|
11644
|
+
"ssg-select-editor-option",
|
|
11645
|
+
{
|
|
11646
|
+
"ssg-select-editor-option--highlighted": item().index === snapshot2().highlight,
|
|
11647
|
+
"ssg-select-editor-option--checked": checked()
|
|
11648
|
+
}
|
|
11649
|
+
]}
|
|
11650
|
+
style={{ top: px(item().index * rowHeight) }}
|
|
11651
|
+
onClick={() => {
|
|
11652
|
+
setError(null);
|
|
11653
|
+
controller.toggle(untrack23(item).index);
|
|
11654
|
+
}}
|
|
11655
|
+
onPointerEnter={(event) => revealOverflowTitle3(event.currentTarget)}
|
|
11656
|
+
onPointerMove={(event) => {
|
|
11657
|
+
if (pointerMoved(event)) {
|
|
11658
|
+
controller.hover(untrack23(item).index);
|
|
11659
|
+
}
|
|
11660
|
+
}}
|
|
11661
|
+
>
|
|
11662
|
+
<span class="ssg-multi-select-check" aria-hidden="true">
|
|
11663
|
+
<Show31 when={checked()}>
|
|
11664
|
+
<CheckIcon />
|
|
11665
|
+
</Show31>
|
|
11666
|
+
</span>
|
|
11667
|
+
<span class="ssg-select-editor-option-label">
|
|
11668
|
+
<MatchedText2 text={item().result.option.label} range={item().result.labelMatch} />
|
|
11669
|
+
</span>
|
|
11670
|
+
<Show31 when={item().result.option.description}>
|
|
11671
|
+
{(description) => <span class="ssg-select-editor-option-description">
|
|
11672
|
+
<MatchedText2 text={description()} range={item().result.descriptionMatch} />
|
|
11673
|
+
</span>}
|
|
11674
|
+
</Show31>
|
|
11675
|
+
</div>;
|
|
11676
|
+
}}
|
|
11677
|
+
</For17>
|
|
11678
|
+
</div>
|
|
11679
|
+
</div>
|
|
11680
|
+
</Show31>
|
|
11681
|
+
<Show31
|
|
11682
|
+
when={error() === null}
|
|
11683
|
+
fallback={<div class="ssg-multi-select-hint ssg-multi-select-hint--error" role="alert" style={{ "min-height": px(rowHeight) }}>
|
|
11684
|
+
{error()}
|
|
11685
|
+
</div>}
|
|
11686
|
+
>
|
|
11687
|
+
<Show31 when={hint() !== ""}>
|
|
11688
|
+
<div class="ssg-multi-select-hint" aria-hidden="true" style={{ "min-height": px(rowHeight) }}>
|
|
11689
|
+
{hint()}
|
|
11690
|
+
</div>
|
|
11691
|
+
</Show31>
|
|
11692
|
+
</Show31>
|
|
11693
|
+
</div>
|
|
11694
|
+
</Portal7>}
|
|
11695
|
+
</Show31>
|
|
11696
|
+
</>;
|
|
11697
|
+
createPortalTokens(popover, () => props.themeClassName, placement2);
|
|
11698
|
+
createRenderEffect10(
|
|
11699
|
+
() => [input(), snapshot2().text],
|
|
11700
|
+
([element, text]) => {
|
|
11701
|
+
if (element && element.value !== text) {
|
|
11702
|
+
element.value = text;
|
|
11703
|
+
}
|
|
11704
|
+
},
|
|
11705
|
+
{ name: "multiSelectInputText" }
|
|
11706
|
+
);
|
|
11707
|
+
return view;
|
|
11708
|
+
}
|
|
11709
|
+
|
|
11710
|
+
// src/view/GridMultiSelectChips.tsx
|
|
11711
|
+
import { For as For18, Show as Show32 } from "solid-js";
|
|
11712
|
+
function GridMultiSelectChips(props) {
|
|
11713
|
+
return <Show32 when={props.labels.length > 0}>
|
|
11714
|
+
<span class="ssg-multi-select-chips" data-ssg-tooltip-overflow={props.labels.join(props.separator)}>
|
|
11715
|
+
<For18 each={props.labels} keyed={false}>
|
|
11716
|
+
{(label, index) => <span class="ssg-multi-select-chip">
|
|
11717
|
+
<span class="ssg-multi-select-chip-label">{props.renderLabel(label(), index)}</span>
|
|
11718
|
+
</span>}
|
|
11719
|
+
</For18>
|
|
11720
|
+
</span>
|
|
11721
|
+
</Show32>;
|
|
11722
|
+
}
|
|
11723
|
+
|
|
11724
|
+
// src/features/multiSelect.ts
|
|
11725
|
+
var multiSelectFeature = {
|
|
11726
|
+
MultiSelectCellEditor,
|
|
11727
|
+
MultiSelectChips: GridMultiSelectChips,
|
|
11728
|
+
resolveChipLabels: resolveMultiSelectChipLabels,
|
|
11729
|
+
splitRangesByChips,
|
|
11730
|
+
localeText: DEFAULT_MULTI_SELECT_LOCALE_TEXT
|
|
11731
|
+
};
|
|
11732
|
+
|
|
11733
|
+
// src/features/changeTracking.ts
|
|
11734
|
+
import { createChangeTracker } from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/changeTracker";
|
|
11735
|
+
import {
|
|
11736
|
+
buildRevertMenuItems,
|
|
11737
|
+
describeUnsavedCell,
|
|
11738
|
+
formatUnsavedSummary
|
|
11739
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/changeTracking";
|
|
11740
|
+
import { DEFAULT_CHANGE_TRACKING_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
11741
|
+
var changeTrackingFeature = {
|
|
11742
|
+
createChangeTracker,
|
|
11743
|
+
describeUnsavedCell,
|
|
11744
|
+
formatUnsavedSummary,
|
|
11745
|
+
buildRevertMenuItems,
|
|
11746
|
+
localeText: DEFAULT_CHANGE_TRACKING_LOCALE_TEXT
|
|
11747
|
+
};
|
|
11748
|
+
|
|
11749
|
+
// src/features/excelShortcuts.ts
|
|
10347
11750
|
import { createExcelShortcutCommands } from "@ishibashi0112/spreadsheet-grid-core/internal/engine/excelShortcutCommands";
|
|
10348
11751
|
var excelShortcutsFeature = {
|
|
10349
11752
|
createExcelShortcutCommands
|
|
@@ -10371,29 +11774,29 @@ import { createTreeStage } from "@ishibashi0112/spreadsheet-grid-core/internal/e
|
|
|
10371
11774
|
import { DEFAULT_TREE_DATA_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
10372
11775
|
|
|
10373
11776
|
// src/view/GridTreeCell.tsx
|
|
10374
|
-
import { createMemo as
|
|
10375
|
-
import { formatLocaleText as
|
|
11777
|
+
import { createMemo as createMemo33, Show as Show33 } from "solid-js";
|
|
11778
|
+
import { formatLocaleText as formatLocaleText18 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
10376
11779
|
import {
|
|
10377
11780
|
formatTotalRowCellText as formatTotalRowCellText2,
|
|
10378
11781
|
resolveTotalRowCaption as resolveTotalRowCaption2
|
|
10379
11782
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/totalRow";
|
|
10380
11783
|
function GridTreeCellPrefix(props) {
|
|
10381
11784
|
const texts = useFeatureLocaleText();
|
|
10382
|
-
const label =
|
|
11785
|
+
const label = createMemo33(() => {
|
|
10383
11786
|
const name = props.rowLabel.trim();
|
|
10384
|
-
return
|
|
10385
|
-
row: name !== "" ? name :
|
|
11787
|
+
return formatLocaleText18(props.open ? texts().collapseTreeRow : texts().expandTreeRow, {
|
|
11788
|
+
row: name !== "" ? name : formatLocaleText18(texts().treeRowNumber, { row: props.rowNumber })
|
|
10386
11789
|
});
|
|
10387
11790
|
});
|
|
10388
11791
|
return <>
|
|
10389
|
-
<
|
|
11792
|
+
<Show33 when={props.level > 0}>
|
|
10390
11793
|
<span
|
|
10391
11794
|
aria-hidden="true"
|
|
10392
11795
|
class="ssg-tree-indent"
|
|
10393
11796
|
style={{ width: `calc(var(--ssg-tree-indent) * ${props.level})` }}
|
|
10394
11797
|
/>
|
|
10395
|
-
</
|
|
10396
|
-
<
|
|
11798
|
+
</Show33>
|
|
11799
|
+
<Show33 when={props.hasChildren} fallback={<span aria-hidden="true" class="ssg-tree-spacer" />}>
|
|
10397
11800
|
<button
|
|
10398
11801
|
type="button"
|
|
10399
11802
|
tabindex={-1}
|
|
@@ -10414,28 +11817,28 @@ function GridTreeCellPrefix(props) {
|
|
|
10414
11817
|
>
|
|
10415
11818
|
{props.open ? "\u25BE" : "\u25B8"}
|
|
10416
11819
|
</button>
|
|
10417
|
-
</
|
|
11820
|
+
</Show33>
|
|
10418
11821
|
</>;
|
|
10419
11822
|
}
|
|
10420
11823
|
function GridTreeAggregateValue(props) {
|
|
10421
11824
|
const texts = useFeatureLocaleText();
|
|
10422
|
-
const shown =
|
|
11825
|
+
const shown = createMemo33(() => {
|
|
10423
11826
|
const column = props.column;
|
|
10424
11827
|
const kind = typeof column.aggFunc === "string" ? column.aggFunc : "custom";
|
|
10425
11828
|
const text = formatTotalRowCellText2(column, { value: props.value, kind });
|
|
10426
11829
|
return text === "" ? null : { text, caption: resolveTotalRowCaption2(kind, texts()) };
|
|
10427
11830
|
});
|
|
10428
|
-
return <
|
|
11831
|
+
return <Show33 when={shown()}>
|
|
10429
11832
|
{(current) => <span
|
|
10430
11833
|
class="ssg-group-value ssg-tree-aggregate"
|
|
10431
11834
|
data-ssg-tooltip-overflow={current().caption !== void 0 ? `${current().caption} ${current().text}` : current().text}
|
|
10432
11835
|
>
|
|
10433
|
-
<
|
|
11836
|
+
<Show33 when={current().caption !== void 0}>
|
|
10434
11837
|
<span class="ssg-group-caption">{current().caption}</span>
|
|
10435
|
-
</
|
|
11838
|
+
</Show33>
|
|
10436
11839
|
{current().text}
|
|
10437
11840
|
</span>}
|
|
10438
|
-
</
|
|
11841
|
+
</Show33>;
|
|
10439
11842
|
}
|
|
10440
11843
|
|
|
10441
11844
|
// src/features/treeData.ts
|
|
@@ -10455,7 +11858,7 @@ var treeDataFeature = {
|
|
|
10455
11858
|
import { DEFAULT_AGGREGATES_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
10456
11859
|
|
|
10457
11860
|
// src/primitives/selectionAggregates.ts
|
|
10458
|
-
import { createMemo as
|
|
11861
|
+
import { createMemo as createMemo34 } from "solid-js";
|
|
10459
11862
|
import {
|
|
10460
11863
|
createSelectionAggregatesRunner,
|
|
10461
11864
|
resolveSyncSelectionAggregates,
|
|
@@ -10467,15 +11870,15 @@ import {
|
|
|
10467
11870
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectionAggregates";
|
|
10468
11871
|
function createSelectionAggregates(args) {
|
|
10469
11872
|
const stabilizeTarget = createSelectionAggregateTargetStabilizer();
|
|
10470
|
-
const target =
|
|
11873
|
+
const target = createMemo34(() => {
|
|
10471
11874
|
const current = args();
|
|
10472
11875
|
return stabilizeTarget(
|
|
10473
11876
|
current.enabled ? resolveSelectionAggregateTarget(current.selection, current.viewRowCount, current.orderedColumns) : null
|
|
10474
11877
|
);
|
|
10475
11878
|
});
|
|
10476
|
-
const rowModel =
|
|
10477
|
-
const key =
|
|
10478
|
-
const syncResult =
|
|
11879
|
+
const rowModel = createMemo34(() => args().rowModel);
|
|
11880
|
+
const key = createMemo34(() => ({ rowModel: rowModel(), target: target() }));
|
|
11881
|
+
const syncResult = createMemo34(() => resolveSyncSelectionAggregates(key()));
|
|
10479
11882
|
const runner = createSelectionAggregatesRunner();
|
|
10480
11883
|
connectController(
|
|
10481
11884
|
runner,
|
|
@@ -10484,16 +11887,16 @@ function createSelectionAggregates(args) {
|
|
|
10484
11887
|
"selectionAggregates"
|
|
10485
11888
|
);
|
|
10486
11889
|
const snapshot2 = createExternalStoreSignal(runner, "selectionAggregatesStore");
|
|
10487
|
-
return
|
|
11890
|
+
return createMemo34(() => selectSelectionAggregatesResult(syncResult(), snapshot2(), key()));
|
|
10488
11891
|
}
|
|
10489
11892
|
|
|
10490
11893
|
// src/view/GridSelectionAggregates.tsx
|
|
10491
|
-
import { For as
|
|
11894
|
+
import { For as For19, Show as Show34, createMemo as createMemo35 } from "solid-js";
|
|
10492
11895
|
import { formatSelectionAggregateNumber } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectionAggregates";
|
|
10493
|
-
import { formatLocaleText as
|
|
11896
|
+
import { formatLocaleText as formatLocaleText19 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
10494
11897
|
function GridSelectionAggregates(props) {
|
|
10495
11898
|
const texts = useFeatureLocaleText();
|
|
10496
|
-
const chips =
|
|
11899
|
+
const chips = createMemo35(() => {
|
|
10497
11900
|
const aggregates = props.aggregates;
|
|
10498
11901
|
if (!aggregates) {
|
|
10499
11902
|
return null;
|
|
@@ -10503,7 +11906,7 @@ function GridSelectionAggregates(props) {
|
|
|
10503
11906
|
return [
|
|
10504
11907
|
{
|
|
10505
11908
|
key: "computing",
|
|
10506
|
-
text:
|
|
11909
|
+
text: formatLocaleText19(localeTexts.aggregateComputing, { percent: Math.floor(aggregates.progress * 100) })
|
|
10507
11910
|
}
|
|
10508
11911
|
];
|
|
10509
11912
|
}
|
|
@@ -10526,12 +11929,12 @@ function GridSelectionAggregates(props) {
|
|
|
10526
11929
|
}
|
|
10527
11930
|
return list;
|
|
10528
11931
|
});
|
|
10529
|
-
return <
|
|
11932
|
+
return <Show34 when={chips()}>
|
|
10530
11933
|
{(list) => <div class={["ssg-bar-aggregates", { "ssg-bar-aggregates--trailing": props.trailing }]}>
|
|
10531
11934
|
<div class="ssg-bar-aggregates-inner" title={list().map((chip) => chip.text).join(" ")}>
|
|
10532
11935
|
<div class="ssg-bar-aggregates-list">
|
|
10533
11936
|
<span class="ssg-bar-aggregates-fit" aria-hidden="true" />
|
|
10534
|
-
<
|
|
11937
|
+
<For19 each={list()} keyed={(chip) => chip.key}>
|
|
10535
11938
|
{(chip, index) => <span
|
|
10536
11939
|
class={[
|
|
10537
11940
|
"ssg-bar-chip",
|
|
@@ -10542,16 +11945,16 @@ function GridSelectionAggregates(props) {
|
|
|
10542
11945
|
]}
|
|
10543
11946
|
style={{ order: String(-index()) }}
|
|
10544
11947
|
>
|
|
10545
|
-
<
|
|
11948
|
+
<Show34 when={chip().label !== void 0} fallback={chip().text}>
|
|
10546
11949
|
{chip().label}
|
|
10547
11950
|
<b class="ssg-bar-aggregate-value">{chip().value}</b>
|
|
10548
|
-
</
|
|
11951
|
+
</Show34>
|
|
10549
11952
|
</span>}
|
|
10550
|
-
</
|
|
11953
|
+
</For19>
|
|
10551
11954
|
</div>
|
|
10552
11955
|
</div>
|
|
10553
11956
|
</div>}
|
|
10554
|
-
</
|
|
11957
|
+
</Show34>;
|
|
10555
11958
|
}
|
|
10556
11959
|
|
|
10557
11960
|
// src/features/selectionAggregates.ts
|
|
@@ -10562,7 +11965,7 @@ var selectionAggregatesFeature = {
|
|
|
10562
11965
|
};
|
|
10563
11966
|
|
|
10564
11967
|
// src/primitives/toolPanel.ts
|
|
10565
|
-
import { createMemo as
|
|
11968
|
+
import { createMemo as createMemo36 } from "solid-js";
|
|
10566
11969
|
import {
|
|
10567
11970
|
createToolPanelController,
|
|
10568
11971
|
resolveActiveToolPanelTab,
|
|
@@ -10581,7 +11984,7 @@ function createToolPanel(inputs) {
|
|
|
10581
11984
|
onSuppressedEscape: inputs.onSuppressedEscape
|
|
10582
11985
|
}), "render", "toolPanel");
|
|
10583
11986
|
const snapshot2 = createExternalStoreSignal(controller, "toolPanelStore");
|
|
10584
|
-
const availableTabs =
|
|
11987
|
+
const availableTabs = createMemo36(
|
|
10585
11988
|
() => resolveAvailableToolPanelTabs({
|
|
10586
11989
|
canUseFilterTab: inputs.canUseFilterTab(),
|
|
10587
11990
|
canUseColumnsTab: inputs.canUseColumnsTab(),
|
|
@@ -10590,10 +11993,10 @@ function createToolPanel(inputs) {
|
|
|
10590
11993
|
{ equals: sameTabs }
|
|
10591
11994
|
);
|
|
10592
11995
|
return {
|
|
10593
|
-
activeTab:
|
|
11996
|
+
activeTab: createMemo36(() => resolveActiveToolPanelTab(snapshot2().requestedTab, availableTabs())),
|
|
10594
11997
|
availableTabs,
|
|
10595
|
-
layout:
|
|
10596
|
-
flashTick:
|
|
11998
|
+
layout: createMemo36(() => snapshot2().layout),
|
|
11999
|
+
flashTick: createMemo36(() => snapshot2().flashTick),
|
|
10597
12000
|
panelRef: controller.panelRef,
|
|
10598
12001
|
open: controller.open,
|
|
10599
12002
|
close: controller.close,
|
|
@@ -10617,7 +12020,7 @@ import {
|
|
|
10617
12020
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/totalRow";
|
|
10618
12021
|
|
|
10619
12022
|
// src/view/GridTotalRow.tsx
|
|
10620
|
-
import { For as
|
|
12023
|
+
import { For as For20, Show as Show35, createMemo as createMemo37 } from "solid-js";
|
|
10621
12024
|
import {
|
|
10622
12025
|
formatTotalRowCellText as formatTotalRowCellText3,
|
|
10623
12026
|
resolveTotalRowCaption as resolveTotalRowCaption3
|
|
@@ -10644,7 +12047,7 @@ function GridTotalRow(props) {
|
|
|
10644
12047
|
...props.stickyBottom > 0 ? { bottom: px(props.stickyBottom) } : null
|
|
10645
12048
|
}}
|
|
10646
12049
|
>
|
|
10647
|
-
<
|
|
12050
|
+
<Show35 when={props.ownsRowHeader}>
|
|
10648
12051
|
<div
|
|
10649
12052
|
role={rowHeaderIsCell() ? "rowheader" : void 0}
|
|
10650
12053
|
aria-colindex={rowHeaderIsCell() ? 1 : void 0}
|
|
@@ -10659,13 +12062,13 @@ function GridTotalRow(props) {
|
|
|
10659
12062
|
>
|
|
10660
12063
|
{rowHeaderText() === "" ? null : rowHeaderText()}
|
|
10661
12064
|
</div>
|
|
10662
|
-
</
|
|
10663
|
-
<
|
|
12065
|
+
</Show35>
|
|
12066
|
+
<For20 each={props.entries} keyed={(entry) => entry.column.key}>
|
|
10664
12067
|
{(entry) => {
|
|
10665
|
-
const unbound =
|
|
12068
|
+
const unbound = createMemo37(() => entry().column);
|
|
10666
12069
|
const cell = () => props.cells.get(unbound().key);
|
|
10667
12070
|
const isLabelCell = () => unbound().key === props.labelColumnKey;
|
|
10668
|
-
const content =
|
|
12071
|
+
const content = createMemo37(() => {
|
|
10669
12072
|
const total = cell();
|
|
10670
12073
|
if (total) {
|
|
10671
12074
|
const column = unbound();
|
|
@@ -10717,7 +12120,7 @@ function GridTotalRow(props) {
|
|
|
10717
12120
|
{content()}
|
|
10718
12121
|
</div>;
|
|
10719
12122
|
}}
|
|
10720
|
-
</
|
|
12123
|
+
</For20>
|
|
10721
12124
|
</div>
|
|
10722
12125
|
</>;
|
|
10723
12126
|
}
|
|
@@ -10743,8 +12146,12 @@ var fullGridFeatures = {
|
|
|
10743
12146
|
scrollHint: scrollHintFeature,
|
|
10744
12147
|
motionExtras: motionExtrasFeature,
|
|
10745
12148
|
find: findFeature,
|
|
12149
|
+
findReplace: findReplaceFeature,
|
|
12150
|
+
richCopy: richCopyFeature,
|
|
10746
12151
|
imeDirectInput: imeDirectInputFeature,
|
|
10747
12152
|
selectSearch: selectSearchFeature,
|
|
12153
|
+
dateTimeEditors: dateTimeEditorsFeature,
|
|
12154
|
+
multiSelect: multiSelectFeature,
|
|
10748
12155
|
changeTracking: changeTrackingFeature,
|
|
10749
12156
|
excelShortcuts: excelShortcutsFeature,
|
|
10750
12157
|
newRow: newRowFeature,
|
|
@@ -10792,21 +12199,25 @@ export {
|
|
|
10792
12199
|
conditionalFormatFeature,
|
|
10793
12200
|
contextMenuFeature,
|
|
10794
12201
|
createSpreadsheetGrid,
|
|
12202
|
+
dateTimeEditorsFeature,
|
|
10795
12203
|
excelShortcutsFeature,
|
|
10796
12204
|
exportFeature,
|
|
10797
12205
|
fillHandleFeature,
|
|
10798
12206
|
filteringFeature,
|
|
10799
12207
|
findFeature,
|
|
12208
|
+
findReplaceFeature,
|
|
10800
12209
|
groupingFeature,
|
|
10801
12210
|
imeDirectInputFeature,
|
|
10802
12211
|
labelRowFeature,
|
|
10803
12212
|
motionExtrasFeature,
|
|
12213
|
+
multiSelectFeature,
|
|
10804
12214
|
newRowFeature,
|
|
10805
12215
|
numberFormatter,
|
|
10806
12216
|
numberParser,
|
|
10807
12217
|
pinnedRowsFeature,
|
|
10808
12218
|
preloadGridPopups,
|
|
10809
12219
|
restoreColumnsFromState,
|
|
12220
|
+
richCopyFeature,
|
|
10810
12221
|
rowDragFeature,
|
|
10811
12222
|
scrollHintFeature,
|
|
10812
12223
|
selectSearchFeature,
|