@ishibashi0112/spreadsheet-grid-solid 1.10.0 → 1.11.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 +125 -13
- 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 +4 -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/multiSelect.d.ts +2 -0
- package/dist/features/types.d.ts +13 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4914 -4168
- 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 +1102 -71
- 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/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
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext as e, createMemo as t, useContext as n } from "solid-js";
|
|
2
|
+
import { DEFAULT_GRID_LOCALE_TEXT as r } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
3
|
+
import { resolvePopupLocaleText as i } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextPopups";
|
|
4
|
+
//#region src/context/localeText.ts
|
|
5
|
+
var a = e(() => r), o = () => n(a), s = () => n(a), c = () => {
|
|
6
|
+
let e = o();
|
|
7
|
+
return t(() => i(e()));
|
|
8
|
+
}, l = (e) => Object.assign({}, r, ...Object.values(e).map((e) => e?.localeText));
|
|
9
|
+
//#endregion
|
|
10
|
+
export { c as a, o as i, l as n, s as r, a as t };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createContext as e, createEffect as t, useContext as n } from "solid-js";
|
|
2
|
+
import { syncPopupOrigin as r } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/popupContainer";
|
|
3
|
+
import { isTabKeyEvent as i } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
|
|
4
|
+
import { watchPortalTokens as a } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/portalTokens";
|
|
5
|
+
//#region src/primitives/style.ts
|
|
6
|
+
var o = /* @__PURE__ */ new Set([
|
|
7
|
+
"opacity",
|
|
8
|
+
"z-index",
|
|
9
|
+
"flex",
|
|
10
|
+
"flex-grow",
|
|
11
|
+
"flex-shrink",
|
|
12
|
+
"line-height",
|
|
13
|
+
"order",
|
|
14
|
+
"font-weight"
|
|
15
|
+
]), s = (e) => e.startsWith("--") ? e : e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), c = (e) => {
|
|
16
|
+
if (!e) return;
|
|
17
|
+
let t = {};
|
|
18
|
+
for (let [n, r] of Object.entries(e)) {
|
|
19
|
+
if (r == null || r === !1) continue;
|
|
20
|
+
let e = s(n);
|
|
21
|
+
t[e] = typeof r == "number" && !o.has(e) ? `${r}px` : String(r);
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
}, l = (e) => `${e}px`, u = (e) => i(e) ? "Tab" : e.key, d = (e) => ({
|
|
25
|
+
key: u(e),
|
|
26
|
+
altKey: e.altKey,
|
|
27
|
+
ctrlKey: e.ctrlKey,
|
|
28
|
+
metaKey: e.metaKey,
|
|
29
|
+
shiftKey: e.shiftKey,
|
|
30
|
+
isComposing: e.isComposing,
|
|
31
|
+
keyCode: e.keyCode,
|
|
32
|
+
currentTarget: e.currentTarget,
|
|
33
|
+
preventDefault: () => e.preventDefault()
|
|
34
|
+
}), f = e({
|
|
35
|
+
source: () => null,
|
|
36
|
+
container: () => typeof document > "u" ? null : document.body
|
|
37
|
+
}), p = () => n(f);
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/primitives/portalTokens.ts
|
|
40
|
+
function m(e, n, i, o) {
|
|
41
|
+
let { source: s } = p();
|
|
42
|
+
t(() => [e(), n()], ([e]) => e ? a(s, e) : void 0, { name: "portalTokens" }), o?.origin !== !1 && t(() => [e(), i()], ([e]) => {
|
|
43
|
+
e && r(e);
|
|
44
|
+
}, { name: "portalLayout" });
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { d as a, u as i, f as n, l as o, p as r, c as s, m as t };
|
package/dist/source/chunks/{ColumnFilterPopover-D7INPNVB.jsx → ColumnFilterPopover-JL3HPGXY.jsx}
RENAMED
|
@@ -12,9 +12,11 @@ import {
|
|
|
12
12
|
createPortalTokens,
|
|
13
13
|
px,
|
|
14
14
|
readEventKey,
|
|
15
|
-
useGridPortal
|
|
15
|
+
useGridPortal
|
|
16
|
+
} from "./chunk-AI3CSPI3.jsx";
|
|
17
|
+
import {
|
|
16
18
|
usePopupLocaleText
|
|
17
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ZW5ET5DO.jsx";
|
|
18
20
|
|
|
19
21
|
// src/view/ColumnFilterPopover.tsx
|
|
20
22
|
import {
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
usePopupLocaleText
|
|
3
|
+
} from "./chunk-ZW5ET5DO.jsx";
|
|
4
|
+
|
|
5
|
+
// src/view/DateEditorCalendar.tsx
|
|
6
|
+
import { For, Show, createMemo, createRenderEffect, untrack } from "solid-js";
|
|
7
|
+
import { formatDateKey } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/filtering";
|
|
8
|
+
import {
|
|
9
|
+
buildCalendarDayCells,
|
|
10
|
+
buildYearGrid,
|
|
11
|
+
yearGridStart
|
|
12
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/datePickerCalendar";
|
|
13
|
+
import { formatLocaleText } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
14
|
+
function DateEditorCalendar(props) {
|
|
15
|
+
const texts = usePopupLocaleText();
|
|
16
|
+
const todayKey = formatDateKey(/* @__PURE__ */ new Date());
|
|
17
|
+
const year = createMemo(() => props.snapshot.calendarYear);
|
|
18
|
+
const month = createMemo(() => props.snapshot.calendarMonth);
|
|
19
|
+
const view = () => props.snapshot.calendarView;
|
|
20
|
+
const title = createMemo(
|
|
21
|
+
() => view() === "days" ? formatLocaleText(texts().calendarTitle, { year: year(), month: month() + 1 }) : view() === "months" ? formatLocaleText(texts().calendarYear, { year: year() }) : `${yearGridStart(year())} \u2013 ${yearGridStart(year()) + 11}`
|
|
22
|
+
);
|
|
23
|
+
const days = createMemo(() => buildCalendarDayCells(year(), month()));
|
|
24
|
+
let timeElement;
|
|
25
|
+
createRenderEffect(
|
|
26
|
+
() => props.snapshot.timeText,
|
|
27
|
+
(text) => {
|
|
28
|
+
if (timeElement && timeElement.value !== text) {
|
|
29
|
+
timeElement.value = text;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
return <>
|
|
34
|
+
{props.notice}
|
|
35
|
+
<div class="ssg-dp-nav">
|
|
36
|
+
<button
|
|
37
|
+
type="button"
|
|
38
|
+
tabindex={-1}
|
|
39
|
+
class="ssg-dp-nav-btn"
|
|
40
|
+
aria-label={texts().calendarPrevious}
|
|
41
|
+
onClick={() => props.controller.navigate(-1)}
|
|
42
|
+
>
|
|
43
|
+
‹
|
|
44
|
+
</button>
|
|
45
|
+
<button
|
|
46
|
+
type="button"
|
|
47
|
+
tabindex={-1}
|
|
48
|
+
class="ssg-dp-nav-title"
|
|
49
|
+
disabled={view() === "years"}
|
|
50
|
+
aria-label={texts().calendarChangeView}
|
|
51
|
+
onClick={() => props.controller.drillUp()}
|
|
52
|
+
>
|
|
53
|
+
{title()}
|
|
54
|
+
</button>
|
|
55
|
+
<button
|
|
56
|
+
type="button"
|
|
57
|
+
tabindex={-1}
|
|
58
|
+
class="ssg-dp-nav-btn"
|
|
59
|
+
aria-label={texts().calendarNext}
|
|
60
|
+
onClick={() => props.controller.navigate(1)}
|
|
61
|
+
>
|
|
62
|
+
›
|
|
63
|
+
</button>
|
|
64
|
+
</div>
|
|
65
|
+
<Show
|
|
66
|
+
when={view() === "days"}
|
|
67
|
+
fallback={<div class="ssg-dp-grid">
|
|
68
|
+
<Show
|
|
69
|
+
when={view() === "months"}
|
|
70
|
+
fallback={<For each={buildYearGrid(year())}>
|
|
71
|
+
{(entry) => <button
|
|
72
|
+
type="button"
|
|
73
|
+
tabindex={-1}
|
|
74
|
+
class={["ssg-dp-cell", { "ssg-dp-cell--selected": entry === year() }]}
|
|
75
|
+
onClick={() => props.controller.chooseYear(entry)}
|
|
76
|
+
>
|
|
77
|
+
{entry}
|
|
78
|
+
</button>}
|
|
79
|
+
</For>}
|
|
80
|
+
>
|
|
81
|
+
<For each={texts().calendarMonths}>
|
|
82
|
+
{(label, index) => <button
|
|
83
|
+
type="button"
|
|
84
|
+
tabindex={-1}
|
|
85
|
+
class={["ssg-dp-cell", { "ssg-dp-cell--selected": index() === month() }]}
|
|
86
|
+
onClick={() => props.controller.chooseMonth(untrack(index))}
|
|
87
|
+
>
|
|
88
|
+
{label}
|
|
89
|
+
</button>}
|
|
90
|
+
</For>
|
|
91
|
+
</Show>
|
|
92
|
+
</div>}
|
|
93
|
+
>
|
|
94
|
+
<div class="ssg-dp-dow" aria-hidden="true">
|
|
95
|
+
<For each={texts().calendarWeekdays}>
|
|
96
|
+
{(label, index) => <span class={{ "ssg-dp-dow--sun": index() === 0, "ssg-dp-dow--sat": index() === 6 }}>{label}</span>}
|
|
97
|
+
</For>
|
|
98
|
+
</div>
|
|
99
|
+
<div class="ssg-dp-days">
|
|
100
|
+
{
|
|
101
|
+
/* 変更(1.11.0 の実アプリの点検 ED5-03): 日のボタンは位置で使い回します(keyed={false})。月を動かすたび・打つたびに
|
|
102
|
+
作り直した日の記録で 42 個のボタンを作り直し、開発時に UNSTABLE_LIST_IDENTITY が出ていた。 */
|
|
103
|
+
}
|
|
104
|
+
<For each={days()} keyed={false}>
|
|
105
|
+
{(cell) => <button
|
|
106
|
+
type="button"
|
|
107
|
+
tabindex={-1}
|
|
108
|
+
class={[
|
|
109
|
+
"ssg-dp-day",
|
|
110
|
+
{
|
|
111
|
+
"ssg-dp-day--out": !cell().inCurrentMonth,
|
|
112
|
+
"ssg-dp-day--today": cell().key === todayKey,
|
|
113
|
+
"ssg-dp-day--selected": cell().key === props.snapshot.selectedDate
|
|
114
|
+
}
|
|
115
|
+
]}
|
|
116
|
+
aria-label={cell().key}
|
|
117
|
+
aria-pressed={cell().key === props.snapshot.selectedDate ? "true" : "false"}
|
|
118
|
+
onClick={() => props.controller.chooseDay(untrack(cell).key)}
|
|
119
|
+
>
|
|
120
|
+
{cell().day}
|
|
121
|
+
</button>}
|
|
122
|
+
</For>
|
|
123
|
+
</div>
|
|
124
|
+
</Show>
|
|
125
|
+
<Show when={props.timeInput}>
|
|
126
|
+
<label class="ssg-date-editor-time">
|
|
127
|
+
<span class="ssg-date-editor-time-label">{props.timeInputLabel}</span>
|
|
128
|
+
<input
|
|
129
|
+
ref={(element) => {
|
|
130
|
+
timeElement = element;
|
|
131
|
+
}}
|
|
132
|
+
type="text"
|
|
133
|
+
inputmode="numeric"
|
|
134
|
+
autocomplete="off"
|
|
135
|
+
spellcheck="false"
|
|
136
|
+
class="ssg-date-editor-time-input"
|
|
137
|
+
value={untrack(() => props.snapshot.timeText)}
|
|
138
|
+
placeholder="--:--"
|
|
139
|
+
onInput={(event) => props.controller.inputTime(event.currentTarget.value, event.isComposing)}
|
|
140
|
+
onCompositionEnd={(event) => props.controller.inputTime(event.currentTarget.value, false)}
|
|
141
|
+
onKeyDown={(event) => props.onTimeKeyDown?.(event)}
|
|
142
|
+
onBlur={(event) => props.onTimeBlur?.(event)}
|
|
143
|
+
/>
|
|
144
|
+
</label>
|
|
145
|
+
</Show>
|
|
146
|
+
<div class="ssg-dp-foot">
|
|
147
|
+
<Show when={view() !== "days"}>
|
|
148
|
+
<button type="button" tabindex={-1} class="ssg-dp-foot-btn" onClick={() => props.controller.drillDown()}>
|
|
149
|
+
{texts().calendarBack}
|
|
150
|
+
</button>
|
|
151
|
+
</Show>
|
|
152
|
+
<button type="button" tabindex={-1} class="ssg-dp-foot-btn" onClick={() => props.controller.chooseToday()}>
|
|
153
|
+
{texts().calendarToday}
|
|
154
|
+
</button>
|
|
155
|
+
<button
|
|
156
|
+
type="button"
|
|
157
|
+
tabindex={-1}
|
|
158
|
+
class="ssg-dp-foot-btn ssg-dp-foot-btn--muted"
|
|
159
|
+
onClick={() => props.controller.clear()}
|
|
160
|
+
>
|
|
161
|
+
{texts().clear}
|
|
162
|
+
</button>
|
|
163
|
+
</div>
|
|
164
|
+
</>;
|
|
165
|
+
}
|
|
166
|
+
var DateEditorCalendar_default = DateEditorCalendar;
|
|
167
|
+
export {
|
|
168
|
+
DateEditorCalendar,
|
|
169
|
+
DateEditorCalendar_default as default
|
|
170
|
+
};
|
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
// src/context/localeText.ts
|
|
2
|
-
import { createContext, createMemo, useContext } from "solid-js";
|
|
3
|
-
import {
|
|
4
|
-
resolvePopupLocaleText
|
|
5
|
-
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextPopups";
|
|
6
|
-
import {
|
|
7
|
-
DEFAULT_GRID_LOCALE_TEXT
|
|
8
|
-
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
9
|
-
var GridLocaleTextContext = createContext(() => DEFAULT_GRID_LOCALE_TEXT);
|
|
10
|
-
var useGridLocaleText = () => useContext(GridLocaleTextContext);
|
|
11
|
-
var useFeatureLocaleText = () => useContext(GridLocaleTextContext);
|
|
12
|
-
var usePopupLocaleText = () => {
|
|
13
|
-
const texts = useGridLocaleText();
|
|
14
|
-
return createMemo(() => resolvePopupLocaleText(texts()));
|
|
15
|
-
};
|
|
16
|
-
var mergeFeatureLocaleDefaults = (features) => Object.assign(
|
|
17
|
-
{},
|
|
18
|
-
DEFAULT_GRID_LOCALE_TEXT,
|
|
19
|
-
...Object.values(features).map((feature) => feature?.localeText)
|
|
20
|
-
);
|
|
21
|
-
|
|
22
1
|
// src/primitives/style.ts
|
|
23
2
|
var UNITLESS = /* @__PURE__ */ new Set(["opacity", "z-index", "flex", "flex-grow", "flex-shrink", "line-height", "order", "font-weight"]);
|
|
24
3
|
var toKebab = (key) => key.startsWith("--") ? key : key.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);
|
|
@@ -54,12 +33,12 @@ var toEditorKeyEvent = (event) => ({
|
|
|
54
33
|
});
|
|
55
34
|
|
|
56
35
|
// src/context/portal.ts
|
|
57
|
-
import { createContext
|
|
58
|
-
var GridPortalContext =
|
|
36
|
+
import { createContext, useContext } from "solid-js";
|
|
37
|
+
var GridPortalContext = createContext({
|
|
59
38
|
source: () => null,
|
|
60
39
|
container: () => typeof document === "undefined" ? null : document.body
|
|
61
40
|
});
|
|
62
|
-
var useGridPortal = () =>
|
|
41
|
+
var useGridPortal = () => useContext(GridPortalContext);
|
|
63
42
|
|
|
64
43
|
// src/primitives/portalTokens.ts
|
|
65
44
|
import { createEffect } from "solid-js";
|
|
@@ -87,11 +66,6 @@ function createPortalTokens(portal, modifierClassName, layout, options) {
|
|
|
87
66
|
}
|
|
88
67
|
|
|
89
68
|
export {
|
|
90
|
-
GridLocaleTextContext,
|
|
91
|
-
useGridLocaleText,
|
|
92
|
-
useFeatureLocaleText,
|
|
93
|
-
usePopupLocaleText,
|
|
94
|
-
mergeFeatureLocaleDefaults,
|
|
95
69
|
toSolidStyle,
|
|
96
70
|
px,
|
|
97
71
|
readEventKey,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/context/localeText.ts
|
|
2
|
+
import { createContext, createMemo, useContext } from "solid-js";
|
|
3
|
+
import {
|
|
4
|
+
resolvePopupLocaleText
|
|
5
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextPopups";
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_GRID_LOCALE_TEXT
|
|
8
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
9
|
+
var GridLocaleTextContext = createContext(() => DEFAULT_GRID_LOCALE_TEXT);
|
|
10
|
+
var useGridLocaleText = () => useContext(GridLocaleTextContext);
|
|
11
|
+
var useFeatureLocaleText = () => useContext(GridLocaleTextContext);
|
|
12
|
+
var usePopupLocaleText = () => {
|
|
13
|
+
const texts = useGridLocaleText();
|
|
14
|
+
return createMemo(() => resolvePopupLocaleText(texts()));
|
|
15
|
+
};
|
|
16
|
+
var mergeFeatureLocaleDefaults = (features) => Object.assign(
|
|
17
|
+
{},
|
|
18
|
+
DEFAULT_GRID_LOCALE_TEXT,
|
|
19
|
+
...Object.values(features).map((feature) => feature?.localeText)
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
GridLocaleTextContext,
|
|
24
|
+
useGridLocaleText,
|
|
25
|
+
useFeatureLocaleText,
|
|
26
|
+
usePopupLocaleText,
|
|
27
|
+
mergeFeatureLocaleDefaults
|
|
28
|
+
};
|
|
@@ -5,9 +5,11 @@ import {
|
|
|
5
5
|
createPortalTokens,
|
|
6
6
|
px,
|
|
7
7
|
readEventKey,
|
|
8
|
-
useGridPortal
|
|
8
|
+
useGridPortal
|
|
9
|
+
} from "./chunk-AI3CSPI3.jsx";
|
|
10
|
+
import {
|
|
9
11
|
usePopupLocaleText
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZW5ET5DO.jsx";
|
|
11
13
|
|
|
12
14
|
// src/view/ToolPanel.tsx
|
|
13
15
|
import { For, Show, createEffect, createMemo, createSignal, createUniqueId, onCleanup, onSettled, untrack } from "solid-js";
|