@seanyeh77/ui 0.21.0 → 0.23.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/dist/bundle.js +17 -16
- package/dist/bundle.js.map +1 -1
- package/dist/{format-entry-B2vEJCCf.js → format-entry-CwOAT4YT.js} +23 -1
- package/dist/format-entry-CwOAT4YT.js.map +1 -0
- package/dist/format.js +1 -1
- package/dist/index.d.ts +55 -3
- package/dist/index.js +1184 -442
- package/dist/index.js.map +1 -1
- package/dist/styles.css +267 -15
- package/docs/Card.md +7 -1
- package/docs/CodeView.md +20 -0
- package/docs/DataTable.md +27 -0
- package/docs/InlineCode.md +1 -0
- package/docs/Markdown.md +2 -1
- package/docs/Section.md +9 -3
- package/docs/guidelines.md +4 -4
- package/package.json +2 -2
- package/dist/format-entry-B2vEJCCf.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { a as parseDate, c as addMessages, d as unitFor, i as format, l as setLocale, n as fileSize, o as sameDay, r as fmtDate, s as I18N, t as dayAdd, u as tr } from "./format-entry-
|
|
2
|
+
import { a as parseDate, c as addMessages, d as unitFor, i as format, l as setLocale, n as fileSize, o as sameDay, r as fmtDate, s as I18N, t as dayAdd, u as tr } from "./format-entry-CwOAT4YT.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
6
6
|
import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
7
7
|
import { Menu as Menu$1 } from "@base-ui/react/menu";
|
|
8
|
+
import { PreviewCard } from "@base-ui/react/preview-card";
|
|
8
9
|
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
9
10
|
import { Combobox } from "@base-ui/react/combobox";
|
|
10
11
|
import { Select as Select$1 } from "@base-ui/react/select";
|
|
@@ -103,7 +104,9 @@ const PH = {
|
|
|
103
104
|
"file-code": "<path d=\"M181.66,146.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32Zm-72-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L91.31,152l18.35-18.34A8,8,0,0,0,109.66,122.34ZM216,88V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31Zm40,136V96H152a8,8,0,0,1-8-8V40H56V216H200Z\"/>",
|
|
104
105
|
hash: "<path d=\"M224,88H175.4l8.47-46.57a8,8,0,0,0-15.74-2.86l-9,49.43H111.4l8.47-46.57a8,8,0,0,0-15.74-2.86L95.14,88H48a8,8,0,0,0,0,16H92.23L83.5,152H32a8,8,0,0,0,0,16H80.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,80,224a8,8,0,0,0,7.86-6.57l9-49.43H144.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,144,224a8,8,0,0,0,7.86-6.57l9-49.43H208a8,8,0,0,0,0-16H163.77l8.73-48H224a8,8,0,0,0,0-16Zm-76.5,64H99.77l8.73-48h47.73Z\"/>",
|
|
105
106
|
command: "<path d=\"M180,144H160V112h20a36,36,0,1,0-36-36V96H112V76a36,36,0,1,0-36,36H96v32H76a36,36,0,1,0,36,36V160h32v20a36,36,0,1,0,36-36ZM160,76a20,20,0,1,1,20,20H160ZM56,76a20,20,0,0,1,40,0V96H76A20,20,0,0,1,56,76ZM96,180a20,20,0,1,1-20-20H96Zm16-68h32v32H112Zm68,88a20,20,0,0,1-20-20V160h20a20,20,0,0,1,0,40Z\"/>",
|
|
106
|
-
tag: "<path d=\"M243.31,136,144,36.69A15.86,15.86,0,0,0,132.69,32H40a8,8,0,0,0-8,8v92.69A15.86,15.86,0,0,0,36.69,144L136,243.31a16,16,0,0,0,22.63,0l84.68-84.68a16,16,0,0,0,0-22.63Zm-96,96L48,132.69V48h84.69L232,147.31ZM96,84A12,12,0,1,1,84,72,12,12,0,0,1,96,84Z\"/>"
|
|
107
|
+
tag: "<path d=\"M243.31,136,144,36.69A15.86,15.86,0,0,0,132.69,32H40a8,8,0,0,0-8,8v92.69A15.86,15.86,0,0,0,36.69,144L136,243.31a16,16,0,0,0,22.63,0l84.68-84.68a16,16,0,0,0,0-22.63Zm-96,96L48,132.69V48h84.69L232,147.31ZM96,84A12,12,0,1,1,84,72,12,12,0,0,1,96,84Z\"/>",
|
|
108
|
+
"sort-ascending": "<path d=\"M128,128a8,8,0,0,1-8,8H48a8,8,0,0,1,0-16h72A8,8,0,0,1,128,128ZM48,72H184a8,8,0,0,0,0-16H48a8,8,0,0,0,0,16Zm56,112H48a8,8,0,0,0,0,16h56a8,8,0,0,0,0-16Zm125.66-21.66a8,8,0,0,0-11.32,0L192,188.69V112a8,8,0,0,0-16,0v76.69l-26.34-26.35a8,8,0,0,0-11.32,11.32l40,40a8,8,0,0,0,11.32,0l40-40A8,8,0,0,0,229.66,162.34Z\"/>",
|
|
109
|
+
"dots-six-vertical": "<path d=\"M104,60A12,12,0,1,1,92,48,12,12,0,0,1,104,60Zm60,12a12,12,0,1,0-12-12A12,12,0,0,0,164,72ZM92,116a12,12,0,1,0,12,12A12,12,0,0,0,92,116Zm72,0a12,12,0,1,0,12,12A12,12,0,0,0,164,116ZM92,184a12,12,0,1,0,12,12A12,12,0,0,0,92,184Zm72,0a12,12,0,1,0,12,12A12,12,0,0,0,164,184Z\"/>"
|
|
107
110
|
};
|
|
108
111
|
const PH_FILL = {
|
|
109
112
|
archive: "<path d=\"M224,48H32A16,16,0,0,0,16,64V88a16,16,0,0,0,16,16v88a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V104a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm-72,96H104a8,8,0,0,1,0-16h48a8,8,0,0,1,0,16Zm72-56H32V64H224V88Z\"/>",
|
|
@@ -199,7 +202,9 @@ const PH_FILL = {
|
|
|
199
202
|
"file-code": "<path d=\"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34Zm-104,88a8,8,0,0,1-11.32,11.32l-24-24a8,8,0,0,1,0-11.32l24-24a8,8,0,0,1,11.32,11.32L91.31,152Zm72-12.68-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32l24,24A8,8,0,0,1,181.66,157.66ZM152,88V44l44,44Z\"/>",
|
|
200
203
|
hash: "<path d=\"M116.25,112h31.5l-8,32h-31.5ZM224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48Zm-16,56a8,8,0,0,0-8-8H168.25l7.51-30.06a8,8,0,0,0-15.52-3.88L151.75,96h-31.5l7.51-30.06a8,8,0,0,0-15.52-3.88L103.75,96H64a8,8,0,0,0,0,16H99.75l-8,32H56a8,8,0,0,0,0,16H87.75l-7.51,30.06a8,8,0,0,0,5.82,9.7,8.13,8.13,0,0,0,2,.24,8,8,0,0,0,7.75-6.06L104.25,160h31.5l-7.51,30.06a8,8,0,0,0,5.82,9.7A8.13,8.13,0,0,0,136,200a8,8,0,0,0,7.75-6.06L152.25,160H192a8,8,0,0,0,0-16H156.25l8-32H200A8,8,0,0,0,208,104Z\"/>",
|
|
201
204
|
command: "<path d=\"M116,116h24v24H116ZM86,72a14,14,0,0,0,0,28h14V86A14,14,0,0,0,86,72Zm98,14a14,14,0,0,0-28,0v14h14A14,14,0,0,0,184,86ZM72,170a14,14,0,0,0,28,0V156H86A14,14,0,0,0,72,170ZM224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48Zm-68,92V116h14a30,30,0,1,0-30-30v14H116V86a30,30,0,1,0-30,30h14v24H86a30,30,0,1,0,30,30V156h24v14a30,30,0,1,0,30-30Zm0,30a14,14,0,1,0,14-14H156Z\"/>",
|
|
202
|
-
tag: "<path d=\"M243.31,136,144,36.69A15.86,15.86,0,0,0,132.69,32H40a8,8,0,0,0-8,8v92.69A15.86,15.86,0,0,0,36.69,144L136,243.31a16,16,0,0,0,22.63,0l84.68-84.68a16,16,0,0,0,0-22.63ZM84,96A12,12,0,1,1,96,84,12,12,0,0,1,84,96Z\"/>"
|
|
205
|
+
tag: "<path d=\"M243.31,136,144,36.69A15.86,15.86,0,0,0,132.69,32H40a8,8,0,0,0-8,8v92.69A15.86,15.86,0,0,0,36.69,144L136,243.31a16,16,0,0,0,22.63,0l84.68-84.68a16,16,0,0,0,0-22.63ZM84,96A12,12,0,1,1,96,84,12,12,0,0,1,84,96Z\"/>",
|
|
206
|
+
"sort-ascending": "<path d=\"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,72h96a8,8,0,0,1,0,16H72a8,8,0,0,1,0-16Zm40,112H72a8,8,0,0,1,0-16h40a8,8,0,0,1,0,16Zm8-48H72a8,8,0,0,1,0-16h48a8,8,0,0,1,0,16Zm77.66,29.66-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L160,164.69V120a8,8,0,0,1,16,0v44.69l10.34-10.35a8,8,0,0,1,11.32,11.32Z\"/>",
|
|
207
|
+
"dots-six-vertical": "<path d=\"M192,16H64A16,16,0,0,0,48,32V224a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V32A16,16,0,0,0,192,16ZM100,200a12,12,0,1,1,12-12A12,12,0,0,1,100,200Zm0-60a12,12,0,1,1,12-12A12,12,0,0,1,100,140Zm0-60a12,12,0,1,1,12-12A12,12,0,0,1,100,80Zm56,120a12,12,0,1,1,12-12A12,12,0,0,1,156,200Zm0-60a12,12,0,1,1,12-12A12,12,0,0,1,156,140Zm0-60a12,12,0,1,1,12-12A12,12,0,0,1,156,80Z\"/>"
|
|
203
208
|
};
|
|
204
209
|
/** Lucide names that map to a Phosphor icon. */
|
|
205
210
|
const PH_ALIAS = {
|
|
@@ -2157,7 +2162,7 @@ const AFTER = /([,.([{;])/;
|
|
|
2157
2162
|
/** A piece of code with soft break points after commas, dots and opening brackets, and operators kept together. */
|
|
2158
2163
|
const PATH_IN_CODE = /(?<![\w./-])((?:\.{1,2}\/)?(?:[\w.-]+\/)+[\w.-]+\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?|[\w.-]+\.[A-Za-z0-9]+:\d+(?:-\d+)?)(?![\w/])/g;
|
|
2159
2164
|
/** The paths in a comment or string as links (refHref, onRef); the rest stays text. */
|
|
2160
|
-
function withPaths(text, refHref, onRef) {
|
|
2165
|
+
function withPaths(text, refHref, onRef, tab) {
|
|
2161
2166
|
const out = [];
|
|
2162
2167
|
let at = 0;
|
|
2163
2168
|
for (const m of text.matchAll(PATH_IN_CODE)) {
|
|
@@ -2174,11 +2179,13 @@ function withPaths(text, refHref, onRef) {
|
|
|
2174
2179
|
className: "ui-cv-ref",
|
|
2175
2180
|
href,
|
|
2176
2181
|
onClick: click,
|
|
2182
|
+
tabIndex: tab,
|
|
2177
2183
|
children: v
|
|
2178
2184
|
}, m.index) : /* @__PURE__ */ jsx("button", {
|
|
2179
2185
|
type: "button",
|
|
2180
2186
|
className: "ui-cv-ref",
|
|
2181
2187
|
onClick: click,
|
|
2188
|
+
tabIndex: tab,
|
|
2182
2189
|
children: v
|
|
2183
2190
|
}, m.index));
|
|
2184
2191
|
at = m.index + v.length;
|
|
@@ -2207,8 +2214,62 @@ function breakable(text) {
|
|
|
2207
2214
|
});
|
|
2208
2215
|
return out;
|
|
2209
2216
|
}
|
|
2217
|
+
const NAME_CHAR = /[\p{L}\p{N}_$]/u;
|
|
2218
|
+
/** UTF-16 index of a 1-based column counted in code points; -1 past the end. */
|
|
2219
|
+
function colIndex(s, col) {
|
|
2220
|
+
let i = 0;
|
|
2221
|
+
for (let c = 1; c < col; c++) {
|
|
2222
|
+
if (i >= s.length) return -1;
|
|
2223
|
+
i += (s.codePointAt(i) ?? 0) > 65535 ? 2 : 1;
|
|
2224
|
+
}
|
|
2225
|
+
return i;
|
|
2226
|
+
}
|
|
2227
|
+
/** The first whole `text` on the line: not inside a longer name, and not the tail of a dotted one (x.runtime.deploy). */
|
|
2228
|
+
function findName(s, text) {
|
|
2229
|
+
for (let i = s.indexOf(text); i >= 0; i = s.indexOf(text, i + 1)) {
|
|
2230
|
+
const before = s[i - 1] ?? "";
|
|
2231
|
+
const after = s[i + text.length] ?? "";
|
|
2232
|
+
if (!NAME_CHAR.test(before) && before !== "." && !NAME_CHAR.test(after)) return i;
|
|
2233
|
+
}
|
|
2234
|
+
return -1;
|
|
2235
|
+
}
|
|
2236
|
+
/** Each line's links, sorted, without overlaps; what does not match is left out with a development warning. */
|
|
2237
|
+
function matchLinks(lines, start, links) {
|
|
2238
|
+
const out = /* @__PURE__ */ new Map();
|
|
2239
|
+
links?.forEach((l, i) => {
|
|
2240
|
+
const s = lines[l.line - start];
|
|
2241
|
+
if (s == null) {
|
|
2242
|
+
devWarn(true, "CodeView", `第 ${l.line} 行不在程式碼裡,連結「${l.text}」沒有加上。line 和 target 一樣從 start(${start})算起。`);
|
|
2243
|
+
return;
|
|
2244
|
+
}
|
|
2245
|
+
let from = -1;
|
|
2246
|
+
if (l.col != null) {
|
|
2247
|
+
const at = colIndex(s, l.col);
|
|
2248
|
+
if (at >= 0 && s.startsWith(l.text, at)) from = at;
|
|
2249
|
+
else devWarn(true, "CodeView", `第 ${l.line} 行第 ${l.col} 欄不是「${l.text}」,連結沒有加上。col 從 1 開始、以字元計;位元組或 UTF-16 位置要先換算。`);
|
|
2250
|
+
} else {
|
|
2251
|
+
from = findName(s, l.text);
|
|
2252
|
+
devWarn(from < 0, "CodeView", `第 ${l.line} 行找不到完整的「${l.text}」,連結沒有加上。text 要和程式碼一字不差(整個帶點的名稱),或給 col。`);
|
|
2253
|
+
}
|
|
2254
|
+
if (from < 0) return;
|
|
2255
|
+
const hit = {
|
|
2256
|
+
from,
|
|
2257
|
+
to: from + l.text.length,
|
|
2258
|
+
i
|
|
2259
|
+
};
|
|
2260
|
+
const list = out.get(l.line) ?? [];
|
|
2261
|
+
if (list.some((h) => h.from < hit.to && hit.from < h.to)) {
|
|
2262
|
+
devWarn(true, "CodeView", `第 ${l.line} 行的「${l.text}」和另一個連結重疊,沒有加上。同一行出現兩次的名稱,第二個要給 col。`);
|
|
2263
|
+
return;
|
|
2264
|
+
}
|
|
2265
|
+
list.push(hit);
|
|
2266
|
+
out.set(l.line, list);
|
|
2267
|
+
});
|
|
2268
|
+
for (const list of out.values()) list.sort((a, b) => a.from - b.from);
|
|
2269
|
+
return out;
|
|
2270
|
+
}
|
|
2210
2271
|
/** Source with line numbers and an optional target line: soft accent background, long lines wrap, light syntax colors. */
|
|
2211
|
-
function CodeView({ code, start = 1, target, context = 2, file, fileHref, onFile, title, language, languageLabel, highlight = true, tokenizer = tokenize, refHref, onRef, maxHeight, sections, copy, lineNumbers = true, onCopy, onCopyError, className, ref }) {
|
|
2272
|
+
function CodeView({ code, start = 1, target, context = 2, file, fileHref, onFile, title, language, languageLabel, highlight = true, tokenizer = tokenize, refHref, onRef, links, onLink, preview, maxHeight, sections, copy, lineNumbers = true, onCopy, onCopyError, className, ref }) {
|
|
2212
2273
|
const lines = React.useMemo(() => String(code || "").replace(/\n$/, "").split("\n"), [code]);
|
|
2213
2274
|
const lang = language || languageOf(file);
|
|
2214
2275
|
const toks = React.useMemo(() => highlight ? tokenizer(lines, lang) : lines.map((l) => [["", l]]), [
|
|
@@ -2217,6 +2278,71 @@ function CodeView({ code, start = 1, target, context = 2, file, fileHref, onFile
|
|
|
2217
2278
|
highlight,
|
|
2218
2279
|
tokenizer
|
|
2219
2280
|
]);
|
|
2281
|
+
const hits = React.useMemo(() => matchLinks(lines, start, links), [
|
|
2282
|
+
lines,
|
|
2283
|
+
start,
|
|
2284
|
+
links
|
|
2285
|
+
]);
|
|
2286
|
+
const nav = hits.size > 0;
|
|
2287
|
+
const [armed, setArmed] = React.useState(false);
|
|
2288
|
+
const inside = React.useRef(false);
|
|
2289
|
+
React.useEffect(() => {
|
|
2290
|
+
if (!nav) return;
|
|
2291
|
+
const key = (e) => {
|
|
2292
|
+
if (e.key === "Control" || e.key === "Meta") setArmed(e.type === "keydown" && inside.current);
|
|
2293
|
+
};
|
|
2294
|
+
const off = () => setArmed(false);
|
|
2295
|
+
window.addEventListener("keydown", key);
|
|
2296
|
+
window.addEventListener("keyup", key);
|
|
2297
|
+
window.addEventListener("blur", off);
|
|
2298
|
+
return () => {
|
|
2299
|
+
window.removeEventListener("keydown", key);
|
|
2300
|
+
window.removeEventListener("keyup", key);
|
|
2301
|
+
window.removeEventListener("blur", off);
|
|
2302
|
+
};
|
|
2303
|
+
}, [nav]);
|
|
2304
|
+
const [pv, setPv] = React.useState(null);
|
|
2305
|
+
const pvId = React.useId();
|
|
2306
|
+
const showTimer = React.useRef(void 0);
|
|
2307
|
+
const hideTimer = React.useRef(void 0);
|
|
2308
|
+
React.useEffect(() => () => {
|
|
2309
|
+
clearTimeout(showTimer.current);
|
|
2310
|
+
clearTimeout(hideTimer.current);
|
|
2311
|
+
}, []);
|
|
2312
|
+
const pvSoon = (el) => {
|
|
2313
|
+
if (!preview) return;
|
|
2314
|
+
clearTimeout(hideTimer.current);
|
|
2315
|
+
clearTimeout(showTimer.current);
|
|
2316
|
+
if (pv?.el === el) return;
|
|
2317
|
+
showTimer.current = setTimeout(() => setPv({
|
|
2318
|
+
i: Number(el.dataset.link),
|
|
2319
|
+
el
|
|
2320
|
+
}), 500);
|
|
2321
|
+
};
|
|
2322
|
+
const pvLater = () => {
|
|
2323
|
+
clearTimeout(showTimer.current);
|
|
2324
|
+
clearTimeout(hideTimer.current);
|
|
2325
|
+
hideTimer.current = setTimeout(() => setPv(null), 200);
|
|
2326
|
+
};
|
|
2327
|
+
const pvKeep = () => clearTimeout(hideTimer.current);
|
|
2328
|
+
const linkEl = (t) => t instanceof Element ? t.closest(".ui-cv-name") : null;
|
|
2329
|
+
const open = (el, e) => {
|
|
2330
|
+
const link = links?.[Number(el.dataset.link)];
|
|
2331
|
+
if (!link) return;
|
|
2332
|
+
clearTimeout(showTimer.current);
|
|
2333
|
+
setPv(null);
|
|
2334
|
+
if (onLink) onLink(link, e);
|
|
2335
|
+
else if (link.href) window.location.assign(link.href);
|
|
2336
|
+
};
|
|
2337
|
+
const onLinkClick = (e) => {
|
|
2338
|
+
const el = linkEl(e.target);
|
|
2339
|
+
if (!el) return;
|
|
2340
|
+
const href = links?.[Number(el.dataset.link)]?.href;
|
|
2341
|
+
if (e.shiftKey && href) return;
|
|
2342
|
+
e.preventDefault();
|
|
2343
|
+
const type = e.nativeEvent.pointerType;
|
|
2344
|
+
if (e.detail === 0 || type === "touch" || type === "pen" || e.ctrlKey || e.metaKey) open(el, e);
|
|
2345
|
+
};
|
|
2220
2346
|
const [ta, tb] = target == null ? [null, null] : Array.isArray(target) ? target : [target, target];
|
|
2221
2347
|
const narrow = useNarrow();
|
|
2222
2348
|
const [all, setAll] = React.useState(false);
|
|
@@ -2245,6 +2371,64 @@ function CodeView({ code, start = 1, target, context = 2, file, fileHref, onFile
|
|
|
2245
2371
|
if (b && el && b.scrollHeight > b.clientHeight) b.scrollTop += el.getBoundingClientRect().top - b.getBoundingClientRect().top - b.clientHeight / 2 + el.offsetHeight / 2;
|
|
2246
2372
|
}, [ta, code]);
|
|
2247
2373
|
const digits = String(start + lines.length - 1).length;
|
|
2374
|
+
const piece = (cls, text, key, inLink) => cls ? /* @__PURE__ */ jsx("span", {
|
|
2375
|
+
className: cls,
|
|
2376
|
+
children: !inLink && (refHref || onRef) && (cls === "is-comment" || cls === "is-string") ? withPaths(text, refHref, onRef, nav ? -1 : void 0) : breakable(text)
|
|
2377
|
+
}, key) : /* @__PURE__ */ jsx(React.Fragment, { children: breakable(text) }, key);
|
|
2378
|
+
const nameLink = (hit, kids) => {
|
|
2379
|
+
const link = links?.[hit.i];
|
|
2380
|
+
if (!link) return null;
|
|
2381
|
+
return /* @__PURE__ */ jsx("a", {
|
|
2382
|
+
className: "ui-cv-name",
|
|
2383
|
+
href: link.href,
|
|
2384
|
+
role: link.href ? void 0 : "link",
|
|
2385
|
+
tabIndex: -1,
|
|
2386
|
+
draggable: false,
|
|
2387
|
+
"data-link": hit.i,
|
|
2388
|
+
"aria-label": link.label,
|
|
2389
|
+
"aria-describedby": pv?.i === hit.i ? pvId : void 0,
|
|
2390
|
+
title: preview ? void 0 : link.label,
|
|
2391
|
+
children: kids
|
|
2392
|
+
}, "n" + hit.i);
|
|
2393
|
+
};
|
|
2394
|
+
const lineContent = (line, lineHits) => {
|
|
2395
|
+
if (!lineHits) return line.map(([cls, text], j) => piece(cls, text, String(j), false));
|
|
2396
|
+
const out = [];
|
|
2397
|
+
let group = [];
|
|
2398
|
+
let open = null;
|
|
2399
|
+
const flush = () => {
|
|
2400
|
+
if (open) out.push(nameLink(open, group));
|
|
2401
|
+
open = null;
|
|
2402
|
+
group = [];
|
|
2403
|
+
};
|
|
2404
|
+
let pos = 0;
|
|
2405
|
+
let h = 0;
|
|
2406
|
+
line.forEach(([cls, text], j) => {
|
|
2407
|
+
let k = 0;
|
|
2408
|
+
while (k < text.length) {
|
|
2409
|
+
const at = pos + k;
|
|
2410
|
+
while (h < lineHits.length && lineHits[h].to <= at) h++;
|
|
2411
|
+
const next = lineHits[h];
|
|
2412
|
+
const hit = next && next.from <= at ? next : null;
|
|
2413
|
+
const end = Math.min(pos + text.length, hit ? hit.to : next ? next.from : Infinity);
|
|
2414
|
+
const key = j + "." + k;
|
|
2415
|
+
if (hit) {
|
|
2416
|
+
if (open !== hit) {
|
|
2417
|
+
flush();
|
|
2418
|
+
open = hit;
|
|
2419
|
+
}
|
|
2420
|
+
group.push(piece(cls, text.slice(k, end - pos), key, true));
|
|
2421
|
+
} else {
|
|
2422
|
+
flush();
|
|
2423
|
+
out.push(piece(cls, text.slice(k, end - pos), key, false));
|
|
2424
|
+
}
|
|
2425
|
+
k = end - pos;
|
|
2426
|
+
}
|
|
2427
|
+
pos += text.length;
|
|
2428
|
+
});
|
|
2429
|
+
flush();
|
|
2430
|
+
return out;
|
|
2431
|
+
};
|
|
2248
2432
|
const rows = [];
|
|
2249
2433
|
for (let i = from; i < to; i++) {
|
|
2250
2434
|
const n = start + i;
|
|
@@ -2265,14 +2449,33 @@ function CodeView({ code, start = 1, target, context = 2, file, fileHref, onFile
|
|
|
2265
2449
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2266
2450
|
className: "ui-visually-hidden ui-cv-sr",
|
|
2267
2451
|
children: tr("第 {n} 行", { n }) + indentText(lines[i]) + tr(":")
|
|
2268
|
-
}), toks[i].
|
|
2269
|
-
className: cls,
|
|
2270
|
-
children: (refHref || onRef) && (cls === "is-comment" || cls === "is-string") ? withPaths(text, refHref, onRef) : breakable(text)
|
|
2271
|
-
}, j) : /* @__PURE__ */ jsx(React.Fragment, { children: breakable(text) }, j))]
|
|
2452
|
+
}), lineContent(toks[i], hits.get(n))]
|
|
2272
2453
|
})]
|
|
2273
2454
|
}, i));
|
|
2274
2455
|
}
|
|
2275
2456
|
const keys = [
|
|
2457
|
+
...nav ? [
|
|
2458
|
+
{
|
|
2459
|
+
k: "ArrowUp ArrowDown",
|
|
2460
|
+
label: "↑↓",
|
|
2461
|
+
what: tr("上一行/下一行")
|
|
2462
|
+
},
|
|
2463
|
+
{
|
|
2464
|
+
k: "ArrowLeft ArrowRight",
|
|
2465
|
+
label: "←→",
|
|
2466
|
+
what: tr("上一個/下一個連結")
|
|
2467
|
+
},
|
|
2468
|
+
{
|
|
2469
|
+
k: "Enter",
|
|
2470
|
+
label: "Enter",
|
|
2471
|
+
what: tr("開啟")
|
|
2472
|
+
},
|
|
2473
|
+
{
|
|
2474
|
+
k: "Escape",
|
|
2475
|
+
label: "Esc",
|
|
2476
|
+
what: tr("回到這一行")
|
|
2477
|
+
}
|
|
2478
|
+
] : [],
|
|
2276
2479
|
{
|
|
2277
2480
|
k: "Home",
|
|
2278
2481
|
label: "Home",
|
|
@@ -2305,11 +2508,55 @@ function CodeView({ code, start = 1, target, context = 2, file, fileHref, onFile
|
|
|
2305
2508
|
];
|
|
2306
2509
|
const onMove = (e) => {
|
|
2307
2510
|
if (e.altKey || e.ctrlKey || e.metaKey) return;
|
|
2308
|
-
const
|
|
2511
|
+
const pre = e.currentTarget;
|
|
2512
|
+
const items = [...pre.querySelectorAll("[role=\"listitem\"]")];
|
|
2309
2513
|
if (!items.length) return;
|
|
2310
2514
|
const nOf = (el) => Number(el.dataset.n);
|
|
2311
|
-
const
|
|
2515
|
+
const act = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
2516
|
+
const curLine = act && act !== pre ? act.closest("[role=\"listitem\"]") : null;
|
|
2517
|
+
const at = curLine ? items.indexOf(curLine) : -1;
|
|
2312
2518
|
const now = at < 0 ? -1 : at;
|
|
2519
|
+
const focusLine = (el) => {
|
|
2520
|
+
if (!el) return;
|
|
2521
|
+
el.tabIndex = -1;
|
|
2522
|
+
el.focus();
|
|
2523
|
+
};
|
|
2524
|
+
if (nav) {
|
|
2525
|
+
const stops = [...pre.querySelectorAll(".ui-cv-name, .ui-cv-ref")];
|
|
2526
|
+
const onStop = act ? stops.indexOf(act) : -1;
|
|
2527
|
+
if (e.key === "Escape") {
|
|
2528
|
+
if (pv) setPv(null);
|
|
2529
|
+
else if (onStop >= 0) focusLine(curLine ?? void 0);
|
|
2530
|
+
else if (curLine) pre.focus();
|
|
2531
|
+
else return;
|
|
2532
|
+
e.preventDefault();
|
|
2533
|
+
return;
|
|
2534
|
+
}
|
|
2535
|
+
if (e.key === "Enter" && act && onStop >= 0 && act.classList.contains("ui-cv-name") && !act.hasAttribute("href")) {
|
|
2536
|
+
e.preventDefault();
|
|
2537
|
+
open(act, e);
|
|
2538
|
+
return;
|
|
2539
|
+
}
|
|
2540
|
+
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
2541
|
+
e.preventDefault();
|
|
2542
|
+
if (now < 0) focusLine(items.find((el) => el.classList.contains("is-target")) ?? items[0]);
|
|
2543
|
+
else focusLine(items[Math.max(0, Math.min(items.length - 1, now + (e.key === "ArrowDown" ? 1 : -1)))]);
|
|
2544
|
+
return;
|
|
2545
|
+
}
|
|
2546
|
+
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
2547
|
+
e.preventDefault();
|
|
2548
|
+
const fwd = e.key === "ArrowRight";
|
|
2549
|
+
let to;
|
|
2550
|
+
if (onStop >= 0) to = stops[onStop + (fwd ? 1 : -1)];
|
|
2551
|
+
else {
|
|
2552
|
+
const n = curLine ? nOf(curLine) : ta ?? nOf(items[0]);
|
|
2553
|
+
const lineOf = (el) => Number(el.closest("[role=\"listitem\"]")?.dataset.n);
|
|
2554
|
+
to = fwd ? stops.find((el) => lineOf(el) >= n) : stops.filter((el) => lineOf(el) <= n).pop();
|
|
2555
|
+
}
|
|
2556
|
+
to?.focus();
|
|
2557
|
+
return;
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2313
2560
|
let to = -1;
|
|
2314
2561
|
let said = "";
|
|
2315
2562
|
if (e.key === "Home") to = 0;
|
|
@@ -2385,17 +2632,62 @@ function CodeView({ code, start = 1, target, context = 2, file, fileHref, onFile
|
|
|
2385
2632
|
head,
|
|
2386
2633
|
/* @__PURE__ */ jsx("pre", {
|
|
2387
2634
|
ref: body,
|
|
2388
|
-
className: "ui-cv-body",
|
|
2389
2635
|
style: maxHeight ? { maxHeight } : void 0,
|
|
2390
2636
|
tabIndex: 0,
|
|
2391
2637
|
"aria-label": tr("程式碼"),
|
|
2392
2638
|
"aria-keyshortcuts": keys.map((k) => k.k).join(" "),
|
|
2393
2639
|
onKeyDown: onMove,
|
|
2640
|
+
...nav ? {
|
|
2641
|
+
onClick: onLinkClick,
|
|
2642
|
+
onPointerEnter: () => inside.current = true,
|
|
2643
|
+
onPointerLeave: () => {
|
|
2644
|
+
inside.current = false;
|
|
2645
|
+
setArmed(false);
|
|
2646
|
+
},
|
|
2647
|
+
onPointerMove: (e) => {
|
|
2648
|
+
const held = e.ctrlKey || e.metaKey;
|
|
2649
|
+
if (held !== armed) setArmed(held);
|
|
2650
|
+
},
|
|
2651
|
+
onPointerOver: (e) => {
|
|
2652
|
+
const el = linkEl(e.target);
|
|
2653
|
+
if (el && e.pointerType === "mouse") pvSoon(el);
|
|
2654
|
+
},
|
|
2655
|
+
onPointerOut: (e) => {
|
|
2656
|
+
const el = linkEl(e.target);
|
|
2657
|
+
if (el && !el.contains(e.relatedTarget)) pvLater();
|
|
2658
|
+
},
|
|
2659
|
+
onFocus: (e) => {
|
|
2660
|
+
const el = linkEl(e.target);
|
|
2661
|
+
if (el && el.matches(":focus-visible")) pvSoon(el);
|
|
2662
|
+
},
|
|
2663
|
+
onBlur: (e) => {
|
|
2664
|
+
if (linkEl(e.target)) pvLater();
|
|
2665
|
+
}
|
|
2666
|
+
} : null,
|
|
2667
|
+
className: cx("ui-cv-body", armed && "is-armed"),
|
|
2394
2668
|
children: /* @__PURE__ */ jsx("code", {
|
|
2395
2669
|
role: "list",
|
|
2396
2670
|
children: rows
|
|
2397
2671
|
})
|
|
2398
2672
|
}),
|
|
2673
|
+
preview && pv && links?.[pv.i] ? /* @__PURE__ */ jsx(PreviewCard.Root, {
|
|
2674
|
+
open: true,
|
|
2675
|
+
onOpenChange: (o) => o ? void 0 : setPv(null),
|
|
2676
|
+
children: /* @__PURE__ */ jsx(PreviewCard.Portal, { children: /* @__PURE__ */ jsx(PreviewCard.Positioner, {
|
|
2677
|
+
anchor: pv.el,
|
|
2678
|
+
side: "bottom",
|
|
2679
|
+
align: "start",
|
|
2680
|
+
sideOffset: 6,
|
|
2681
|
+
className: "ui-float",
|
|
2682
|
+
children: /* @__PURE__ */ jsx(PreviewCard.Popup, {
|
|
2683
|
+
id: pvId,
|
|
2684
|
+
className: "ui-popover ui-cv-preview",
|
|
2685
|
+
onPointerEnter: pvKeep,
|
|
2686
|
+
onPointerLeave: pvLater,
|
|
2687
|
+
children: preview(links[pv.i])
|
|
2688
|
+
})
|
|
2689
|
+
}) })
|
|
2690
|
+
}) : null,
|
|
2399
2691
|
/* @__PURE__ */ jsx("div", {
|
|
2400
2692
|
className: "ui-cv-keys",
|
|
2401
2693
|
"aria-hidden": "true",
|
|
@@ -2859,6 +3151,121 @@ function ScrollHint({ show, done }) {
|
|
|
2859
3151
|
}), touch ? tr("左右滑動") : tr("向右捲動")]
|
|
2860
3152
|
}) : null;
|
|
2861
3153
|
}
|
|
3154
|
+
/** The right border of a header cell, dragged to set the column's width. ← → 16 px, Enter or a double-click back
|
|
3155
|
+
* to the widths by content. Hidden on touch screens (CSS), where 「放大表格」 shows the whole table instead. */
|
|
3156
|
+
function ColResize(p) {
|
|
3157
|
+
const [on, setOn] = React.useState(false);
|
|
3158
|
+
const from = React.useRef(null);
|
|
3159
|
+
const min = p.min ?? 48;
|
|
3160
|
+
const set = (w) => p.onWidth(Math.max(min, Math.round(w)));
|
|
3161
|
+
const drag = (v) => {
|
|
3162
|
+
setOn(v);
|
|
3163
|
+
p.onDragging?.(v);
|
|
3164
|
+
};
|
|
3165
|
+
return /* @__PURE__ */ jsx("span", {
|
|
3166
|
+
className: cx("ui-col-resize", on && "is-dragging"),
|
|
3167
|
+
role: "separator",
|
|
3168
|
+
"aria-orientation": "vertical",
|
|
3169
|
+
"aria-label": tr("調整「{name}」欄寬", { name: p.name }),
|
|
3170
|
+
"aria-valuenow": Math.round(p.width),
|
|
3171
|
+
"aria-valuemin": min,
|
|
3172
|
+
tabIndex: 0,
|
|
3173
|
+
onClick: (e) => e.stopPropagation(),
|
|
3174
|
+
onPointerDown: (e) => {
|
|
3175
|
+
if (e.button !== 0) return;
|
|
3176
|
+
e.preventDefault();
|
|
3177
|
+
e.stopPropagation();
|
|
3178
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
3179
|
+
from.current = {
|
|
3180
|
+
x: e.clientX,
|
|
3181
|
+
w: p.start()
|
|
3182
|
+
};
|
|
3183
|
+
drag(true);
|
|
3184
|
+
},
|
|
3185
|
+
onPointerMove: (e) => {
|
|
3186
|
+
if (from.current) set(from.current.w + e.clientX - from.current.x);
|
|
3187
|
+
},
|
|
3188
|
+
onPointerUp: () => {
|
|
3189
|
+
from.current = null;
|
|
3190
|
+
drag(false);
|
|
3191
|
+
},
|
|
3192
|
+
onPointerCancel: () => {
|
|
3193
|
+
from.current = null;
|
|
3194
|
+
drag(false);
|
|
3195
|
+
},
|
|
3196
|
+
onDoubleClick: (e) => {
|
|
3197
|
+
e.stopPropagation();
|
|
3198
|
+
p.onReset();
|
|
3199
|
+
},
|
|
3200
|
+
onKeyDown: (e) => {
|
|
3201
|
+
if (e.altKey || e.metaKey || e.ctrlKey) return;
|
|
3202
|
+
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
3203
|
+
e.preventDefault();
|
|
3204
|
+
e.stopPropagation();
|
|
3205
|
+
set(p.start() + (e.key === "ArrowRight" ? 16 : -16));
|
|
3206
|
+
} else if (e.key === "Enter") {
|
|
3207
|
+
e.preventDefault();
|
|
3208
|
+
e.stopPropagation();
|
|
3209
|
+
p.onReset();
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
});
|
|
3213
|
+
}
|
|
3214
|
+
/** The 「放大表格」 icon: 32 px, no border, at the table's top right. */
|
|
3215
|
+
function ZoomButton({ onClick }) {
|
|
3216
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
3217
|
+
className: "ui-table-zoom",
|
|
3218
|
+
icon: "corners-out",
|
|
3219
|
+
label: tr("放大表格"),
|
|
3220
|
+
onClick
|
|
3221
|
+
});
|
|
3222
|
+
}
|
|
3223
|
+
/** The whole table in a wide dialog (at most 1200 px). A plain click on a link inside (a function, a path) closes the
|
|
3224
|
+
* dialog after the link has done its job; Ctrl, ⌘, Shift or the middle button open a new tab and keep it open. */
|
|
3225
|
+
function TableDialog(p) {
|
|
3226
|
+
if (!p.open) return null;
|
|
3227
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
3228
|
+
open: true,
|
|
3229
|
+
onClose: p.onClose,
|
|
3230
|
+
title: p.title || tr("表格"),
|
|
3231
|
+
className: "ui-table-dialog",
|
|
3232
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
3233
|
+
className: "ui-table-dialog-body",
|
|
3234
|
+
onClick: (e) => {
|
|
3235
|
+
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;
|
|
3236
|
+
const link = e.target.closest("a[href], [role=\"link\"], .ui-code.is-link, .ui-md-link");
|
|
3237
|
+
if (link && e.currentTarget.contains(link)) p.onClose();
|
|
3238
|
+
},
|
|
3239
|
+
children: p.children
|
|
3240
|
+
})
|
|
3241
|
+
});
|
|
3242
|
+
}
|
|
3243
|
+
/** The 「複製成 Markdown」 icon: copies the text, turns into a check for 2 s and says 「已複製」, as CodeView's copy. */
|
|
3244
|
+
function CopyMarkdownButton(p) {
|
|
3245
|
+
const [done, setDone] = React.useState(false);
|
|
3246
|
+
const timer = React.useRef(void 0);
|
|
3247
|
+
React.useEffect(() => () => clearTimeout(timer.current), []);
|
|
3248
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
3249
|
+
className: cx("ui-table-copy", done && "is-copied", p.className),
|
|
3250
|
+
icon: done ? CHECK : "copy",
|
|
3251
|
+
label: done ? tr("已複製") : tr("複製成 Markdown"),
|
|
3252
|
+
onClick: () => copyText(p.text()).then(() => {
|
|
3253
|
+
setDone(true);
|
|
3254
|
+
announce(tr("已複製"));
|
|
3255
|
+
clearTimeout(timer.current);
|
|
3256
|
+
timer.current = setTimeout(() => setDone(false), 2e3);
|
|
3257
|
+
}, () => p.onCopyError?.())
|
|
3258
|
+
});
|
|
3259
|
+
}
|
|
3260
|
+
/** A table as GitHub Markdown: | in a cell is escaped, line breaks become spaces. */
|
|
3261
|
+
function markdownTable(heads, rows) {
|
|
3262
|
+
const cell = (s) => s.replace(/\r?\n/g, " ").replace(/\|/g, "\\|").trim();
|
|
3263
|
+
return [
|
|
3264
|
+
`| ${heads.map(cell).join(" | ")} |`,
|
|
3265
|
+
`|${heads.map(() => "---").join("|")}|`,
|
|
3266
|
+
...rows.map((r) => `| ${r.map(cell).join(" | ")} |`)
|
|
3267
|
+
].join("\n");
|
|
3268
|
+
}
|
|
2862
3269
|
// src/components/DataTable/filters.ts
|
|
2863
3270
|
const field = (row, key) => row[key];
|
|
2864
3271
|
/** Cell text: money as NT$ 1,280, dates as 2026/11/04(三), numbers with their unit after them. */
|
|
@@ -2964,6 +3371,27 @@ function writeUrl(prefix, filters, values, q) {
|
|
|
2964
3371
|
const s = sp.toString();
|
|
2965
3372
|
history.replaceState(history.state, "", location.pathname + (s ? "?" + s : "") + location.hash);
|
|
2966
3373
|
}
|
|
3374
|
+
/** The sort from the URL (?sort=prog,-dt: in order, a leading - is descending); null when the URL has none. */
|
|
3375
|
+
function readSort(prefix) {
|
|
3376
|
+
const v = new URLSearchParams(location.search).get(param(prefix, "sort"));
|
|
3377
|
+
if (v == null) return null;
|
|
3378
|
+
return v.split(",").filter(Boolean).map((t) => t.startsWith("-") ? {
|
|
3379
|
+
key: t.slice(1),
|
|
3380
|
+
dir: "desc"
|
|
3381
|
+
} : {
|
|
3382
|
+
key: t,
|
|
3383
|
+
dir: "asc"
|
|
3384
|
+
});
|
|
3385
|
+
}
|
|
3386
|
+
/** Writes the sort into the URL without a history entry; nothing when it is the table's default. */
|
|
3387
|
+
function writeSort(prefix, levels, initial) {
|
|
3388
|
+
const sp = new URLSearchParams(location.search);
|
|
3389
|
+
const text = (l) => l.map((s) => (s.dir === "desc" ? "-" : "") + s.key).join(",");
|
|
3390
|
+
if (text(levels) === text(initial)) sp.delete(param(prefix, "sort"));
|
|
3391
|
+
else sp.set(param(prefix, "sort"), text(levels));
|
|
3392
|
+
const s = sp.toString();
|
|
3393
|
+
history.replaceState(history.state, "", location.pathname + (s ? "?" + s : "") + location.hash);
|
|
3394
|
+
}
|
|
2967
3395
|
// src/internal/FloatingPanel.tsx
|
|
2968
3396
|
/** A positioned panel next to its trigger: flips when there is no room, closes on Esc and outside press, returns focus. */
|
|
2969
3397
|
function FloatingPanel({ open, onOpenChange, trigger, side = "bottom", align = "start", sideOffset = 6, className, openOnHover, anchor, boundary, children, ...aria }) {
|
|
@@ -3237,6 +3665,212 @@ function LongText({ children }) {
|
|
|
3237
3665
|
children: body
|
|
3238
3666
|
});
|
|
3239
3667
|
}
|
|
3668
|
+
// src/components/DataTable/SortButton.tsx
|
|
3669
|
+
/** 「由小到大」 or 「由大到小」. */
|
|
3670
|
+
const dirWord = (dir) => dir === "asc" ? tr("由小到大") : tr("由大到小");
|
|
3671
|
+
const ARROW = {
|
|
3672
|
+
asc: "↑",
|
|
3673
|
+
desc: "↓"
|
|
3674
|
+
};
|
|
3675
|
+
/** The whole sort read out: 「依 程式 由小到大,再依 ΔT 由大到小排序」. */
|
|
3676
|
+
function sortSentence(levels, cols) {
|
|
3677
|
+
if (!levels.length) return tr("已還原原本的順序");
|
|
3678
|
+
const name = (k) => cols.find((c) => c.key === k)?.label ?? k;
|
|
3679
|
+
return tr("依 {list} 排序", { list: levels.map((l) => name(l.key) + " " + dirWord(l.dir)).join(tr(",再依 ")) });
|
|
3680
|
+
}
|
|
3681
|
+
/** The toolbar's 「排序」 button: it shows the current sort and opens a panel to add, order, flip and remove levels. */
|
|
3682
|
+
function SortButton({ cols, levels, max, onChange, boundary, short }) {
|
|
3683
|
+
const [open, setOpen] = React.useState(false);
|
|
3684
|
+
const [adding, setAdding] = React.useState(false);
|
|
3685
|
+
const [drag, setDrag] = React.useState(null);
|
|
3686
|
+
const listRef = React.useRef(null);
|
|
3687
|
+
const firstAdd = React.useRef(null);
|
|
3688
|
+
const addId = React.useId();
|
|
3689
|
+
React.useEffect(() => {
|
|
3690
|
+
if (adding) firstAdd.current?.focus();
|
|
3691
|
+
}, [adding]);
|
|
3692
|
+
const name = (k) => cols.find((c) => c.key === k)?.label ?? k;
|
|
3693
|
+
const first = (k) => cols.find((c) => c.key === k)?.numeric ? "desc" : "asc";
|
|
3694
|
+
const rest = cols.filter((c) => !levels.some((l) => l.key === c.key));
|
|
3695
|
+
const move = (from, to, focus) => {
|
|
3696
|
+
if (to < 0 || to >= levels.length || from === to) return;
|
|
3697
|
+
const next = levels.slice();
|
|
3698
|
+
next.splice(to, 0, next.splice(from, 1)[0]);
|
|
3699
|
+
onChange(next);
|
|
3700
|
+
if (focus) requestAnimationFrame(() => listRef.current?.querySelectorAll(".ui-dt-sortgrip")[to]?.focus());
|
|
3701
|
+
};
|
|
3702
|
+
const shown = levels.map((l) => name(l.key) + " " + ARROW[l.dir]).join(tr("、"));
|
|
3703
|
+
const read = levels.map((l) => name(l.key) + " " + dirWord(l.dir)).join(tr("、"));
|
|
3704
|
+
return /* @__PURE__ */ jsxs(FloatingPanel, {
|
|
3705
|
+
open,
|
|
3706
|
+
onOpenChange: (o) => {
|
|
3707
|
+
setOpen(o);
|
|
3708
|
+
if (!o) setAdding(false);
|
|
3709
|
+
},
|
|
3710
|
+
boundary,
|
|
3711
|
+
className: "ui-dt-sortpop",
|
|
3712
|
+
"aria-label": tr("排序"),
|
|
3713
|
+
trigger: /* @__PURE__ */ jsxs("button", {
|
|
3714
|
+
type: "button",
|
|
3715
|
+
className: cx("ui-btn", "ui-btn-secondary", "ui-dt-sortbtn", open && "is-open", levels.length > 0 && "is-on"),
|
|
3716
|
+
"aria-label": levels.length ? tr("排序:{list}", { list: read }) : tr("排序"),
|
|
3717
|
+
children: [
|
|
3718
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
3719
|
+
name: "sort-ascending",
|
|
3720
|
+
size: 18
|
|
3721
|
+
}),
|
|
3722
|
+
/* @__PURE__ */ jsx("span", {
|
|
3723
|
+
className: "ui-dt-sortbtn-text",
|
|
3724
|
+
children: !levels.length ? tr("排序") : short ? tr("排序") : tr("排序:{list}", { list: shown })
|
|
3725
|
+
}),
|
|
3726
|
+
short && levels.length ? /* @__PURE__ */ jsx("span", {
|
|
3727
|
+
className: "ui-pop-count",
|
|
3728
|
+
children: levels.length
|
|
3729
|
+
}) : null
|
|
3730
|
+
]
|
|
3731
|
+
}),
|
|
3732
|
+
children: [
|
|
3733
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3734
|
+
className: "ui-dt-filterhead",
|
|
3735
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3736
|
+
className: "ui-popover-title",
|
|
3737
|
+
children: tr("排序")
|
|
3738
|
+
}), levels.length ? /* @__PURE__ */ jsx("button", {
|
|
3739
|
+
type: "button",
|
|
3740
|
+
className: "ui-link-btn",
|
|
3741
|
+
onClick: () => onChange([]),
|
|
3742
|
+
children: tr("清除全部")
|
|
3743
|
+
}) : null]
|
|
3744
|
+
}),
|
|
3745
|
+
levels.length ? /* @__PURE__ */ jsx("ol", {
|
|
3746
|
+
className: "ui-dt-sortlist",
|
|
3747
|
+
ref: listRef,
|
|
3748
|
+
children: levels.map((l, i) => /* @__PURE__ */ jsxs("li", {
|
|
3749
|
+
className: cx("ui-dt-sortlvl", drag?.from === i && "is-dragging", drag && drag.over === i && drag.from !== i && "is-over"),
|
|
3750
|
+
draggable: true,
|
|
3751
|
+
onDragStart: (e) => {
|
|
3752
|
+
e.dataTransfer.effectAllowed = "move";
|
|
3753
|
+
e.dataTransfer.setData("text/plain", String(i));
|
|
3754
|
+
setDrag({
|
|
3755
|
+
from: i,
|
|
3756
|
+
over: i
|
|
3757
|
+
});
|
|
3758
|
+
},
|
|
3759
|
+
onDragOver: (e) => {
|
|
3760
|
+
e.preventDefault();
|
|
3761
|
+
if (drag && drag.over !== i) setDrag({
|
|
3762
|
+
...drag,
|
|
3763
|
+
over: i
|
|
3764
|
+
});
|
|
3765
|
+
},
|
|
3766
|
+
onDrop: (e) => {
|
|
3767
|
+
e.preventDefault();
|
|
3768
|
+
if (drag) move(drag.from, i);
|
|
3769
|
+
setDrag(null);
|
|
3770
|
+
},
|
|
3771
|
+
onDragEnd: () => setDrag(null),
|
|
3772
|
+
children: [
|
|
3773
|
+
/* @__PURE__ */ jsx("button", {
|
|
3774
|
+
type: "button",
|
|
3775
|
+
className: "ui-dt-sortgrip",
|
|
3776
|
+
"aria-label": tr("「{name}」第 {n} 排序;按 Alt+↑ ↓ 調整順序", {
|
|
3777
|
+
name: name(l.key),
|
|
3778
|
+
n: i + 1
|
|
3779
|
+
}),
|
|
3780
|
+
"aria-keyshortcuts": "Alt+ArrowUp Alt+ArrowDown",
|
|
3781
|
+
onKeyDown: (e) => {
|
|
3782
|
+
if (!e.altKey || e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
|
|
3783
|
+
e.preventDefault();
|
|
3784
|
+
move(i, i + (e.key === "ArrowUp" ? -1 : 1), true);
|
|
3785
|
+
},
|
|
3786
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
3787
|
+
name: "dots-six-vertical",
|
|
3788
|
+
size: 16
|
|
3789
|
+
})
|
|
3790
|
+
}),
|
|
3791
|
+
/* @__PURE__ */ jsx("span", {
|
|
3792
|
+
className: "ui-dt-sortn",
|
|
3793
|
+
children: i + 1
|
|
3794
|
+
}),
|
|
3795
|
+
/* @__PURE__ */ jsx("span", {
|
|
3796
|
+
className: "ui-dt-sortname",
|
|
3797
|
+
children: name(l.key)
|
|
3798
|
+
}),
|
|
3799
|
+
/* @__PURE__ */ jsx("span", {
|
|
3800
|
+
className: "ui-dt-sortdir",
|
|
3801
|
+
role: "radiogroup",
|
|
3802
|
+
"aria-label": tr("「{name}」的方向", { name: name(l.key) }),
|
|
3803
|
+
children: ["asc", "desc"].map((d) => /* @__PURE__ */ jsxs("button", {
|
|
3804
|
+
type: "button",
|
|
3805
|
+
role: "radio",
|
|
3806
|
+
"aria-checked": l.dir === d,
|
|
3807
|
+
className: cx(l.dir === d && "is-on"),
|
|
3808
|
+
onClick: () => onChange(levels.map((x, j) => j === i ? {
|
|
3809
|
+
key: x.key,
|
|
3810
|
+
dir: d
|
|
3811
|
+
} : x)),
|
|
3812
|
+
children: [
|
|
3813
|
+
ARROW[d],
|
|
3814
|
+
" ",
|
|
3815
|
+
dirWord(d)
|
|
3816
|
+
]
|
|
3817
|
+
}, d))
|
|
3818
|
+
}),
|
|
3819
|
+
/* @__PURE__ */ jsx("button", {
|
|
3820
|
+
type: "button",
|
|
3821
|
+
className: "ui-dt-sortrm",
|
|
3822
|
+
"aria-label": tr("移除「{name}」排序", { name: name(l.key) }),
|
|
3823
|
+
onClick: () => onChange(levels.filter((_, j) => j !== i)),
|
|
3824
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
3825
|
+
name: "x",
|
|
3826
|
+
size: 16
|
|
3827
|
+
})
|
|
3828
|
+
})
|
|
3829
|
+
]
|
|
3830
|
+
}, l.key))
|
|
3831
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
3832
|
+
className: "ui-dt-sortnone",
|
|
3833
|
+
children: tr("照資料原本的順序。")
|
|
3834
|
+
}),
|
|
3835
|
+
rest.length && levels.length < max ? adding ? /* @__PURE__ */ jsxs("div", {
|
|
3836
|
+
className: "ui-dt-sortadd",
|
|
3837
|
+
role: "group",
|
|
3838
|
+
"aria-labelledby": addId,
|
|
3839
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3840
|
+
id: addId,
|
|
3841
|
+
className: "ui-dt-sortaddhead",
|
|
3842
|
+
children: levels.length ? tr("再依哪一欄") : tr("依哪一欄排序")
|
|
3843
|
+
}), rest.map((c, i) => /* @__PURE__ */ jsxs("button", {
|
|
3844
|
+
ref: i === 0 ? firstAdd : void 0,
|
|
3845
|
+
type: "button",
|
|
3846
|
+
className: "ui-dt-opt",
|
|
3847
|
+
onClick: () => {
|
|
3848
|
+
onChange([...levels, {
|
|
3849
|
+
key: c.key,
|
|
3850
|
+
dir: first(c.key)
|
|
3851
|
+
}]);
|
|
3852
|
+
setAdding(false);
|
|
3853
|
+
},
|
|
3854
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
3855
|
+
name: "plus",
|
|
3856
|
+
size: 16
|
|
3857
|
+
}), c.label]
|
|
3858
|
+
}, c.key))]
|
|
3859
|
+
}) : /* @__PURE__ */ jsxs("button", {
|
|
3860
|
+
type: "button",
|
|
3861
|
+
className: "ui-link-btn ui-dt-sortmore",
|
|
3862
|
+
onClick: () => setAdding(true),
|
|
3863
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
3864
|
+
name: "plus",
|
|
3865
|
+
size: 16
|
|
3866
|
+
}), levels.length ? tr("再依…") : tr("排序依據…")]
|
|
3867
|
+
}) : levels.length >= max && rest.length ? /* @__PURE__ */ jsx("p", {
|
|
3868
|
+
className: "ui-dt-sortnone",
|
|
3869
|
+
children: tr("最多 {n} 層排序。", { n: max })
|
|
3870
|
+
}) : null
|
|
3871
|
+
]
|
|
3872
|
+
});
|
|
3873
|
+
}
|
|
3240
3874
|
// src/components/DataTable/DataTable.tsx
|
|
3241
3875
|
const MOVE = {
|
|
3242
3876
|
dur: 320,
|
|
@@ -3286,10 +3920,19 @@ function DataTable(p) {
|
|
|
3286
3920
|
q: "",
|
|
3287
3921
|
values: {}
|
|
3288
3922
|
};
|
|
3289
|
-
const
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3923
|
+
const maxSort = Math.max(1, p.maxSort ?? Infinity);
|
|
3924
|
+
const sortCols = cols.filter((c) => c.sortable !== false).map((c) => ({
|
|
3925
|
+
key: c.key,
|
|
3926
|
+
label: c.label,
|
|
3927
|
+
numeric: c.numeric
|
|
3928
|
+
}));
|
|
3929
|
+
const firstDir = (key) => sortCols.find((c) => c.key === key)?.numeric ? "desc" : "asc";
|
|
3930
|
+
const validSort = (l) => l.filter((x, i) => sortCols.some((c) => c.key === x.key) && l.findIndex((y) => y.key === x.key) === i).slice(0, maxSort).map((x) => ({
|
|
3931
|
+
key: x.key,
|
|
3932
|
+
dir: x.dir ?? firstDir(x.key)
|
|
3933
|
+
}));
|
|
3934
|
+
const initialSort = validSort(p.defaultSort ?? []);
|
|
3935
|
+
const [sort, setSort] = React.useState(() => validSort((urlSync && typeof location !== "undefined" ? readSort(urlKey) : null) ?? initialSort));
|
|
3293
3936
|
const [page, setPage] = React.useState(0);
|
|
3294
3937
|
const [q, setQ] = React.useState(() => fromUrl().q);
|
|
3295
3938
|
const [values, setValues] = React.useState(() => fromUrl().values);
|
|
@@ -3302,6 +3945,26 @@ function DataTable(p) {
|
|
|
3302
3945
|
const [sel, setSel] = React.useState({});
|
|
3303
3946
|
const [sumVal, setSumVal] = React.useState("all");
|
|
3304
3947
|
const [fit, setFit] = React.useState({});
|
|
3948
|
+
const [widths, setWidthsState] = React.useState(() => {
|
|
3949
|
+
if (!p.widthKey) return null;
|
|
3950
|
+
try {
|
|
3951
|
+
const v = JSON.parse(localStorage.getItem("ui-dt-width:" + p.widthKey) || "null");
|
|
3952
|
+
return v && typeof v === "object" ? v : null;
|
|
3953
|
+
} catch {
|
|
3954
|
+
return null;
|
|
3955
|
+
}
|
|
3956
|
+
});
|
|
3957
|
+
const setWidths = (w) => {
|
|
3958
|
+
setWidthsState(w);
|
|
3959
|
+
if (!p.widthKey) return;
|
|
3960
|
+
try {
|
|
3961
|
+
if (w) localStorage.setItem("ui-dt-width:" + p.widthKey, JSON.stringify(w));
|
|
3962
|
+
else localStorage.removeItem("ui-dt-width:" + p.widthKey);
|
|
3963
|
+
} catch {}
|
|
3964
|
+
};
|
|
3965
|
+
const [zoomed, setZoomed] = React.useState(false);
|
|
3966
|
+
const [zoomWidths, setZoomWidths] = React.useState(null);
|
|
3967
|
+
const zoomRef = React.useRef(null);
|
|
3305
3968
|
const [resetKey, setResetKey] = React.useState(p.resetKey);
|
|
3306
3969
|
const resetting = resetKey !== p.resetKey;
|
|
3307
3970
|
if (resetting) {
|
|
@@ -3311,15 +3974,16 @@ function DataTable(p) {
|
|
|
3311
3974
|
setPage(0);
|
|
3312
3975
|
setSel({});
|
|
3313
3976
|
setSumVal("all");
|
|
3314
|
-
setSort(
|
|
3315
|
-
key: null,
|
|
3316
|
-
dir: "desc"
|
|
3317
|
-
});
|
|
3977
|
+
setSort(initialSort);
|
|
3318
3978
|
setToggled({});
|
|
3319
3979
|
setOpened({});
|
|
3320
3980
|
setFit({});
|
|
3321
3981
|
}
|
|
3322
3982
|
const valuesKey = JSON.stringify(values);
|
|
3983
|
+
const sortKey = JSON.stringify(sort);
|
|
3984
|
+
React.useEffect(() => {
|
|
3985
|
+
if (urlSync && typeof location !== "undefined") writeSort(urlKey, sort, initialSort);
|
|
3986
|
+
}, [sortKey]);
|
|
3323
3987
|
React.useEffect(() => {
|
|
3324
3988
|
if (urlSync && filters.length) writeUrl(urlKey, filters, values, q);
|
|
3325
3989
|
}, [valuesKey, q]);
|
|
@@ -3348,15 +4012,22 @@ function DataTable(p) {
|
|
|
3348
4012
|
const passes = (r, skip) => (!searching || searchHit(r, cols, filters, q, search ? search.keys : void 0)) && filters.every((f) => f.key === skip || matches(f, r, values[f.key]));
|
|
3349
4013
|
let list = all.filter((x) => passes(x.r));
|
|
3350
4014
|
const activeN = filters.filter((f) => isActive(values[f.key])).length;
|
|
3351
|
-
if (sort.
|
|
3352
|
-
const
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
4015
|
+
if (sort.length) {
|
|
4016
|
+
const by = sort.map((l) => {
|
|
4017
|
+
const col = cols.find((c) => c.key === l.key);
|
|
4018
|
+
return {
|
|
4019
|
+
val: (r) => col?.sortValue ? col.sortValue(r) : get(r, l.key),
|
|
4020
|
+
d: l.dir === "asc" ? 1 : -1
|
|
4021
|
+
};
|
|
4022
|
+
});
|
|
3356
4023
|
list = [...list].sort((a, b) => {
|
|
3357
|
-
const
|
|
3358
|
-
|
|
3359
|
-
|
|
4024
|
+
for (const { val, d } of by) {
|
|
4025
|
+
const x = val(a.r);
|
|
4026
|
+
const y = val(b.r);
|
|
4027
|
+
const c = typeof x === "number" && typeof y === "number" ? x - y : String(x).localeCompare(String(y), "zh-Hant");
|
|
4028
|
+
if (c) return c * d;
|
|
4029
|
+
}
|
|
4030
|
+
return a.i - b.i;
|
|
3360
4031
|
});
|
|
3361
4032
|
}
|
|
3362
4033
|
const shownKey = `${q}|${valuesKey}|${sumVal}|${view}`;
|
|
@@ -3471,22 +4142,39 @@ function DataTable(p) {
|
|
|
3471
4142
|
}).onfinish = () => ghost.remove();
|
|
3472
4143
|
});
|
|
3473
4144
|
});
|
|
3474
|
-
const
|
|
3475
|
-
if (c.sortable === false) return;
|
|
3476
|
-
const first = c.numeric ? "desc" : "asc";
|
|
4145
|
+
const changeSort = (next) => {
|
|
3477
4146
|
capture("sort");
|
|
3478
|
-
|
|
4147
|
+
setSort(next);
|
|
4148
|
+
announce(sortSentence(next, sortCols));
|
|
4149
|
+
};
|
|
4150
|
+
const sortBy = (c, add = false) => {
|
|
4151
|
+
if (c.sortable === false) return;
|
|
4152
|
+
const first = firstDir(c.key);
|
|
4153
|
+
const flip = first === "asc" ? "desc" : "asc";
|
|
4154
|
+
const i = sort.findIndex((l) => l.key === c.key);
|
|
4155
|
+
if (add) {
|
|
4156
|
+
if (i < 0) {
|
|
4157
|
+
if (sort.length < maxSort) changeSort([...sort, {
|
|
4158
|
+
key: c.key,
|
|
4159
|
+
dir: first
|
|
4160
|
+
}]);
|
|
4161
|
+
else announce(tr("最多 {n} 層排序。", { n: maxSort }));
|
|
4162
|
+
} else if (sort[i].dir === first) changeSort(sort.map((l, j) => j === i ? {
|
|
4163
|
+
key: l.key,
|
|
4164
|
+
dir: flip
|
|
4165
|
+
} : l));
|
|
4166
|
+
else changeSort(sort.filter((_, j) => j !== i));
|
|
4167
|
+
return;
|
|
4168
|
+
}
|
|
4169
|
+
if (sort.length !== 1 || i !== 0) changeSort([{
|
|
3479
4170
|
key: c.key,
|
|
3480
4171
|
dir: first
|
|
3481
|
-
});
|
|
3482
|
-
else if (sort.dir === first)
|
|
4172
|
+
}]);
|
|
4173
|
+
else if (sort[0].dir === first) changeSort([{
|
|
3483
4174
|
key: c.key,
|
|
3484
|
-
dir:
|
|
3485
|
-
});
|
|
3486
|
-
else
|
|
3487
|
-
key: null,
|
|
3488
|
-
dir: "desc"
|
|
3489
|
-
});
|
|
4175
|
+
dir: flip
|
|
4176
|
+
}]);
|
|
4177
|
+
else changeSort([]);
|
|
3490
4178
|
};
|
|
3491
4179
|
const goPage = (n) => {
|
|
3492
4180
|
if (n === pageNow || n < 0 || n >= pages) return;
|
|
@@ -3514,16 +4202,31 @@ function DataTable(p) {
|
|
|
3514
4202
|
const expander = longCols.length > 0 && !narrow;
|
|
3515
4203
|
const EXP = 40;
|
|
3516
4204
|
const minOf = (c) => Math.max(c.width || (c.numeric ? 96 : 120), fit[c.key] || 0);
|
|
3517
|
-
const
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
4205
|
+
const layout = (w) => {
|
|
4206
|
+
const colW = (c) => w ? `${w[c.key] ?? minOf(c)}px` : `minmax(${minOf(c)}px, ${c.grow || (c.width ? 1 : c.numeric ? .8 : 1)}fr)`;
|
|
4207
|
+
return {
|
|
4208
|
+
gridTemplateColumns: [
|
|
4209
|
+
expander ? "40px" : null,
|
|
4210
|
+
selectable ? "46px" : null,
|
|
4211
|
+
...shownCols.map(colW),
|
|
4212
|
+
hasAct ? actW + "px" : null
|
|
4213
|
+
].filter(Boolean).join(" "),
|
|
4214
|
+
minWidth: (expander ? EXP : 0) + (selectable ? 46 : 0) + shownCols.reduce((a, c) => a + (w ? w[c.key] ?? minOf(c) : minOf(c)), 0) + (hasAct ? actW : 0)
|
|
4215
|
+
};
|
|
4216
|
+
};
|
|
4217
|
+
const pageGrid = layout(widths);
|
|
4218
|
+
const zoomGrid = layout(zoomWidths);
|
|
4219
|
+
const drawn = (root) => {
|
|
4220
|
+
const out = {};
|
|
4221
|
+
for (const c of shownCols) {
|
|
4222
|
+
const el = root?.querySelector(`.ui-dt-head [data-col="${CSS.escape(c.key)}"]`);
|
|
4223
|
+
out[c.key] = el ? Math.ceil(el.getBoundingClientRect().width) : minOf(c);
|
|
4224
|
+
}
|
|
4225
|
+
return out;
|
|
4226
|
+
};
|
|
4227
|
+
const headMin = (root, key) => {
|
|
4228
|
+
const el = root?.querySelector(`.ui-dt-head [data-col="${CSS.escape(key)}"] > :first-child`);
|
|
4229
|
+
return Math.max(48, el ? Math.ceil(el.getBoundingClientRect().width) + 24 : 48);
|
|
3527
4230
|
};
|
|
3528
4231
|
React.useLayoutEffect(() => {
|
|
3529
4232
|
const root = rootRef.current;
|
|
@@ -3563,100 +4266,142 @@ function DataTable(p) {
|
|
|
3563
4266
|
}, [narrow, resetKey]);
|
|
3564
4267
|
const stickyStyle = (ci) => ci === 0 && sticky ? { left: (expander ? EXP : 0) + (selectable ? 46 : 0) } : void 0;
|
|
3565
4268
|
const cellClass = (c, ci, ...more) => cx("ui-dt-cell", isNum(c) && "is-num", ci === 0 && sticky && "is-sticky", ...more);
|
|
3566
|
-
const
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
children: [
|
|
3604
|
-
expander ? /* @__PURE__ */ jsx("div", {
|
|
3605
|
-
className: "ui-dt-cell ui-dt-exp",
|
|
3606
|
-
role: "columnheader",
|
|
3607
|
-
"aria-label": tr("詳細")
|
|
3608
|
-
}) : null,
|
|
3609
|
-
selectable ? /* @__PURE__ */ jsx("div", {
|
|
3610
|
-
className: "ui-dt-cell ui-dt-sel",
|
|
3611
|
-
role: "columnheader",
|
|
3612
|
-
children: /* @__PURE__ */ jsx(RowCheck, {
|
|
3613
|
-
v: allOn ? true : mixed ? "mixed" : false,
|
|
3614
|
-
label: tr("全選"),
|
|
3615
|
-
onClick: () => toggle(visIds, !allOn)
|
|
4269
|
+
const headOf = (inZoom) => {
|
|
4270
|
+
const gridStyle = inZoom ? zoomGrid : pageGrid;
|
|
4271
|
+
const minW = gridStyle.minWidth;
|
|
4272
|
+
const w = inZoom ? zoomWidths : widths;
|
|
4273
|
+
const setW = inZoom ? setZoomWidths : setWidths;
|
|
4274
|
+
const root = () => inZoom ? zoomRef.current : rootRef.current;
|
|
4275
|
+
return selectable && selIds.length && p.bulkActions ? /* @__PURE__ */ jsxs("div", {
|
|
4276
|
+
className: "ui-dt-row ui-dt-head ui-dt-bulk",
|
|
4277
|
+
role: "row",
|
|
4278
|
+
style: { minWidth: minW },
|
|
4279
|
+
children: [
|
|
4280
|
+
/* @__PURE__ */ jsx("div", {
|
|
4281
|
+
className: "ui-dt-cell",
|
|
4282
|
+
role: "columnheader",
|
|
4283
|
+
children: /* @__PURE__ */ jsx(RowCheck, {
|
|
4284
|
+
v: allOn ? true : "mixed",
|
|
4285
|
+
label: tr("全選"),
|
|
4286
|
+
onClick: () => toggle(visIds, !allOn)
|
|
4287
|
+
})
|
|
4288
|
+
}),
|
|
4289
|
+
/* @__PURE__ */ jsx("span", {
|
|
4290
|
+
className: "ui-dt-bulk-count",
|
|
4291
|
+
children: tr("已選 {n} 筆", { n: selIds.length })
|
|
4292
|
+
}),
|
|
4293
|
+
/* @__PURE__ */ jsx("span", {
|
|
4294
|
+
className: "ui-dt-bulk-actions",
|
|
4295
|
+
children: p.bulkActions(selIds, clear)
|
|
4296
|
+
}),
|
|
4297
|
+
/* @__PURE__ */ jsx("button", {
|
|
4298
|
+
type: "button",
|
|
4299
|
+
className: "ui-dt-bulk-close",
|
|
4300
|
+
"aria-label": tr("取消選取"),
|
|
4301
|
+
onClick: clear,
|
|
4302
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
4303
|
+
name: "x",
|
|
4304
|
+
size: 14
|
|
4305
|
+
})
|
|
3616
4306
|
})
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
4307
|
+
]
|
|
4308
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
4309
|
+
className: "ui-dt-row ui-dt-head",
|
|
4310
|
+
role: "row",
|
|
4311
|
+
style: gridStyle,
|
|
4312
|
+
children: [
|
|
4313
|
+
expander ? /* @__PURE__ */ jsx("div", {
|
|
4314
|
+
className: "ui-dt-cell ui-dt-exp",
|
|
3621
4315
|
role: "columnheader",
|
|
3622
|
-
"aria-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
size: 14,
|
|
3632
|
-
className: "ui-dt-arrow"
|
|
3633
|
-
})]
|
|
4316
|
+
"aria-label": tr("詳細")
|
|
4317
|
+
}) : null,
|
|
4318
|
+
selectable ? /* @__PURE__ */ jsx("div", {
|
|
4319
|
+
className: "ui-dt-cell ui-dt-sel",
|
|
4320
|
+
role: "columnheader",
|
|
4321
|
+
children: /* @__PURE__ */ jsx(RowCheck, {
|
|
4322
|
+
v: allOn ? true : mixed ? "mixed" : false,
|
|
4323
|
+
label: tr("全選"),
|
|
4324
|
+
onClick: () => toggle(visIds, !allOn)
|
|
3634
4325
|
})
|
|
3635
|
-
},
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
4326
|
+
}) : null,
|
|
4327
|
+
shownCols.map((c, ci) => {
|
|
4328
|
+
const at = sort.findIndex((l) => l.key === c.key);
|
|
4329
|
+
const cur = at >= 0;
|
|
4330
|
+
const many = sort.length > 1;
|
|
4331
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4332
|
+
role: "columnheader",
|
|
4333
|
+
"aria-sort": at === 0 ? sort[0].dir === "asc" ? "ascending" : "descending" : "none",
|
|
4334
|
+
className: cellClass(c, ci),
|
|
4335
|
+
style: stickyStyle(ci),
|
|
4336
|
+
"data-col": c.key,
|
|
4337
|
+
children: [c.sortable === false ? c.label : /* @__PURE__ */ jsxs("button", {
|
|
4338
|
+
type: "button",
|
|
4339
|
+
className: cx("ui-dt-sort", cur && "is-on"),
|
|
4340
|
+
"aria-label": cur && many ? tr("{name},第 {n} 排序,{dir}", {
|
|
4341
|
+
name: c.label,
|
|
4342
|
+
n: at + 1,
|
|
4343
|
+
dir: dirWord(sort[at].dir)
|
|
4344
|
+
}) : void 0,
|
|
4345
|
+
"aria-keyshortcuts": "Shift+Enter",
|
|
4346
|
+
onClick: (e) => sortBy(c, e.shiftKey),
|
|
4347
|
+
onKeyDown: (e) => {
|
|
4348
|
+
if (e.shiftKey && (e.key === "Enter" || e.key === " ")) {
|
|
4349
|
+
e.preventDefault();
|
|
4350
|
+
sortBy(c, true);
|
|
4351
|
+
}
|
|
4352
|
+
},
|
|
4353
|
+
children: [
|
|
4354
|
+
/* @__PURE__ */ jsx("span", { children: c.label }),
|
|
4355
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
4356
|
+
d: ARROWS[cur ? sort[at].dir : "none"],
|
|
4357
|
+
size: 14,
|
|
4358
|
+
className: "ui-dt-arrow"
|
|
4359
|
+
}),
|
|
4360
|
+
cur && many ? /* @__PURE__ */ jsx("span", {
|
|
4361
|
+
className: "ui-dt-sortpri",
|
|
4362
|
+
"aria-hidden": "true",
|
|
4363
|
+
children: at + 1
|
|
4364
|
+
}) : null
|
|
4365
|
+
]
|
|
4366
|
+
}), narrow ? null : /* @__PURE__ */ jsx(ColResize, {
|
|
4367
|
+
name: c.label,
|
|
4368
|
+
width: w?.[c.key] ?? minOf(c),
|
|
4369
|
+
start: () => (w ?? drawn(root()))[c.key] ?? minOf(c),
|
|
4370
|
+
onWidth: (px) => setW({
|
|
4371
|
+
...w ?? drawn(root()),
|
|
4372
|
+
[c.key]: Math.max(headMin(root(), c.key), px)
|
|
4373
|
+
}),
|
|
4374
|
+
onReset: () => setW(null)
|
|
4375
|
+
})]
|
|
4376
|
+
}, c.key);
|
|
4377
|
+
}),
|
|
4378
|
+
hasAct ? /* @__PURE__ */ jsx("div", {
|
|
4379
|
+
className: "ui-dt-cell",
|
|
4380
|
+
role: "columnheader",
|
|
4381
|
+
"aria-label": tr("操作")
|
|
4382
|
+
}) : null
|
|
4383
|
+
]
|
|
4384
|
+
});
|
|
4385
|
+
};
|
|
3644
4386
|
const mark = searching ? q : "";
|
|
3645
4387
|
const cellInner = (r, c) => {
|
|
3646
4388
|
const raw = get(r, c.key);
|
|
3647
4389
|
let v;
|
|
3648
4390
|
if (c.render) v = c.render(r);
|
|
3649
|
-
else if (c.unit && raw !== null && raw !== void 0 && raw !== "") v = /* @__PURE__ */ jsxs(
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
4391
|
+
else if (c.unit && raw !== null && raw !== void 0 && raw !== "") v = /* @__PURE__ */ jsxs("span", {
|
|
4392
|
+
className: "ui-dt-qty",
|
|
4393
|
+
children: [
|
|
4394
|
+
markMatch(cellText({
|
|
4395
|
+
...c,
|
|
4396
|
+
unit: void 0
|
|
4397
|
+
}, raw), mark),
|
|
4398
|
+
" ",
|
|
4399
|
+
/* @__PURE__ */ jsx("span", {
|
|
4400
|
+
className: "ui-unit",
|
|
4401
|
+
children: c.unit
|
|
4402
|
+
})
|
|
4403
|
+
]
|
|
4404
|
+
});
|
|
3660
4405
|
else v = markMatch(cellText(c, raw), mark);
|
|
3661
4406
|
return v;
|
|
3662
4407
|
};
|
|
@@ -3682,6 +4427,267 @@ function DataTable(p) {
|
|
|
3682
4427
|
}
|
|
3683
4428
|
return "";
|
|
3684
4429
|
};
|
|
4430
|
+
const copyMarkdown = () => {
|
|
4431
|
+
const all = list.map((x) => x.r);
|
|
4432
|
+
if (p.copyText) return p.copyText(all);
|
|
4433
|
+
return markdownTable(shownCols.map((c) => c.label), all.map((r) => shownCols.map((c) => String(c.fullText?.(r) ?? c.searchText?.(r) ?? cellText(c, get(r, c.key)) ?? ""))));
|
|
4434
|
+
};
|
|
4435
|
+
const toolsView = (inZoom) => /* @__PURE__ */ jsxs("div", {
|
|
4436
|
+
className: "ui-dt-tools",
|
|
4437
|
+
children: [
|
|
4438
|
+
search !== false ? /* @__PURE__ */ jsx(SearchField, {
|
|
4439
|
+
value: q,
|
|
4440
|
+
onChange: (v) => {
|
|
4441
|
+
setQ(v);
|
|
4442
|
+
setPage(0);
|
|
4443
|
+
},
|
|
4444
|
+
placeholder: search.placeholder || tr("搜尋"),
|
|
4445
|
+
label: search.placeholder || tr("搜尋"),
|
|
4446
|
+
className: "ui-dt-search"
|
|
4447
|
+
}) : null,
|
|
4448
|
+
filters.length ? /* @__PURE__ */ jsx(FilterButton, {
|
|
4449
|
+
boundary: inZoom ? zoomRef : rootRef,
|
|
4450
|
+
filters,
|
|
4451
|
+
values,
|
|
4452
|
+
activeCount: activeN,
|
|
4453
|
+
count: (f, v) => all.filter((x) => passes(x.r, f.key) && matches(f, x.r, f.type === "list" ? [v] : void 0)).length,
|
|
4454
|
+
onChange: (key, v) => {
|
|
4455
|
+
setValues({
|
|
4456
|
+
...values,
|
|
4457
|
+
[key]: v
|
|
4458
|
+
});
|
|
4459
|
+
setPage(0);
|
|
4460
|
+
},
|
|
4461
|
+
onClear: () => {
|
|
4462
|
+
setValues({});
|
|
4463
|
+
setPage(0);
|
|
4464
|
+
}
|
|
4465
|
+
}) : null,
|
|
4466
|
+
/* @__PURE__ */ jsxs("span", {
|
|
4467
|
+
className: "ui-dt-result",
|
|
4468
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
4469
|
+
"aria-hidden": "true",
|
|
4470
|
+
children: seenOnly(tr("{n} / {total} 筆", {
|
|
4471
|
+
n: "",
|
|
4472
|
+
total: ""
|
|
4473
|
+
}), [format.number(list.length), format.number(baseCount)])
|
|
4474
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
4475
|
+
className: "ui-visually-hidden",
|
|
4476
|
+
children: format.fractionLabel(list.length, baseCount, tr("筆"))
|
|
4477
|
+
})]
|
|
4478
|
+
}),
|
|
4479
|
+
p.copy !== false ? /* @__PURE__ */ jsx(CopyMarkdownButton, {
|
|
4480
|
+
text: copyMarkdown,
|
|
4481
|
+
onCopyError: p.onCopyError
|
|
4482
|
+
}) : null,
|
|
4483
|
+
sortCols.length ? /* @__PURE__ */ jsx(SortButton, {
|
|
4484
|
+
cols: sortCols,
|
|
4485
|
+
levels: sort,
|
|
4486
|
+
max: maxSort,
|
|
4487
|
+
onChange: changeSort,
|
|
4488
|
+
boundary: inZoom ? zoomRef : rootRef,
|
|
4489
|
+
short: narrow
|
|
4490
|
+
}) : null,
|
|
4491
|
+
p.columnMenu !== false && cols.length > 2 ? /* @__PURE__ */ jsx(ColumnMenu, {
|
|
4492
|
+
cols,
|
|
4493
|
+
hidden,
|
|
4494
|
+
onToggle: (k) => setToggled({
|
|
4495
|
+
...toggled,
|
|
4496
|
+
[k]: !hidden[k]
|
|
4497
|
+
})
|
|
4498
|
+
}) : null
|
|
4499
|
+
]
|
|
4500
|
+
});
|
|
4501
|
+
const tableView = (inZoom) => {
|
|
4502
|
+
const grid = inZoom ? zoomGrid : pageGrid;
|
|
4503
|
+
const pfx = inZoom ? uid + "z" : uid;
|
|
4504
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4505
|
+
className: cx("ui-dt-scroller", scrollMore && !inZoom && "has-more"),
|
|
4506
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
4507
|
+
className: "ui-dt-scroll",
|
|
4508
|
+
ref: inZoom ? void 0 : scrollRef,
|
|
4509
|
+
onScroll: inZoom ? void 0 : onScroll,
|
|
4510
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
4511
|
+
className: "ui-dt-table",
|
|
4512
|
+
role: "table",
|
|
4513
|
+
"aria-label": p.label || p.caption,
|
|
4514
|
+
children: [
|
|
4515
|
+
headOf(inZoom),
|
|
4516
|
+
/* @__PURE__ */ jsx("div", {
|
|
4517
|
+
ref: inZoom ? void 0 : bodyRef,
|
|
4518
|
+
className: "ui-dt-body",
|
|
4519
|
+
role: "rowgroup",
|
|
4520
|
+
children: vis.length ? vis.map((x, i) => {
|
|
4521
|
+
const id = visIds[i];
|
|
4522
|
+
const on = !!sel[id];
|
|
4523
|
+
const open = expander && !!opened[id];
|
|
4524
|
+
const detailId = `${pfx}-d-${idPart(id)}`;
|
|
4525
|
+
const rowName = shownCols[0] ? String(cellText(shownCols[0], get(x.r, shownCols[0].key)) ?? "") : "";
|
|
4526
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
4527
|
+
"data-rid": id,
|
|
4528
|
+
ref: inZoom ? void 0 : (el) => {
|
|
4529
|
+
rowEls.current[id] = el;
|
|
4530
|
+
},
|
|
4531
|
+
role: "row",
|
|
4532
|
+
"aria-labelledby": shownCols.length ? `${pfx}-n-${start + i}` : void 0,
|
|
4533
|
+
className: cx("ui-dt-row", i % 2 && "is-even", on && "is-selected", selectable && "has-sel", expander && "has-exp"),
|
|
4534
|
+
style: grid,
|
|
4535
|
+
onClick: expander ? (e) => {
|
|
4536
|
+
const t = e.target;
|
|
4537
|
+
if (t.closest(ROW_CONTROLS) && t.closest(ROW_CONTROLS) !== e.currentTarget) return;
|
|
4538
|
+
if (String(window.getSelection() ?? "")) return;
|
|
4539
|
+
setOpened({
|
|
4540
|
+
...opened,
|
|
4541
|
+
[id]: !open
|
|
4542
|
+
});
|
|
4543
|
+
} : void 0,
|
|
4544
|
+
children: [
|
|
4545
|
+
expander ? /* @__PURE__ */ jsx("div", {
|
|
4546
|
+
className: "ui-dt-cell ui-dt-exp",
|
|
4547
|
+
role: "cell",
|
|
4548
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
4549
|
+
type: "button",
|
|
4550
|
+
className: cx("ui-dt-exp-btn", open && "is-open"),
|
|
4551
|
+
"aria-expanded": open,
|
|
4552
|
+
"aria-controls": open ? detailId : void 0,
|
|
4553
|
+
"aria-label": tr(open ? "收合 {name}" : "展開 {name}", { name: rowName }),
|
|
4554
|
+
onClick: () => setOpened({
|
|
4555
|
+
...opened,
|
|
4556
|
+
[id]: !open
|
|
4557
|
+
}),
|
|
4558
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
4559
|
+
name: "caret-right",
|
|
4560
|
+
size: 16
|
|
4561
|
+
})
|
|
4562
|
+
})
|
|
4563
|
+
}) : null,
|
|
4564
|
+
selectable ? /* @__PURE__ */ jsx("div", {
|
|
4565
|
+
className: "ui-dt-cell ui-dt-sel",
|
|
4566
|
+
role: "cell",
|
|
4567
|
+
children: /* @__PURE__ */ jsx(RowCheck, {
|
|
4568
|
+
v: on,
|
|
4569
|
+
label: tr("選取第 {n} 筆", { n: start + i + 1 }),
|
|
4570
|
+
onClick: () => toggle([id], !on)
|
|
4571
|
+
})
|
|
4572
|
+
}) : null,
|
|
4573
|
+
shownCols.map((c, ci) => /* @__PURE__ */ jsx("div", {
|
|
4574
|
+
role: "cell",
|
|
4575
|
+
id: ci === 0 ? `${pfx}-n-${start + i}` : void 0,
|
|
4576
|
+
"aria-description": c.fullText ? c.fullText(x.r) || void 0 : void 0,
|
|
4577
|
+
"data-label": c.label,
|
|
4578
|
+
"data-col": c.key,
|
|
4579
|
+
className: cellClass(c, ci, c.long && "is-long", mobileClass(c, ci)),
|
|
4580
|
+
style: stickyStyle(ci),
|
|
4581
|
+
children: cell(x.r, c)
|
|
4582
|
+
}, c.key)),
|
|
4583
|
+
hasAct ? /* @__PURE__ */ jsx("div", {
|
|
4584
|
+
className: "ui-dt-cell ui-dt-acts",
|
|
4585
|
+
role: "cell",
|
|
4586
|
+
children: p.rowActions?.(x.r)
|
|
4587
|
+
}) : null
|
|
4588
|
+
]
|
|
4589
|
+
}), open ? /* @__PURE__ */ jsx("div", {
|
|
4590
|
+
id: detailId,
|
|
4591
|
+
role: "row",
|
|
4592
|
+
className: cx("ui-dt-detail", i % 2 && "is-even"),
|
|
4593
|
+
style: { minWidth: grid.minWidth },
|
|
4594
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
4595
|
+
role: "cell",
|
|
4596
|
+
className: "ui-dt-detail-cell",
|
|
4597
|
+
style: { paddingLeft: EXP + (selectable ? 46 : 0) + 12 },
|
|
4598
|
+
children: longCols.map((c) => /* @__PURE__ */ jsxs("div", {
|
|
4599
|
+
className: "ui-dt-detail-item",
|
|
4600
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
4601
|
+
className: "ui-dt-detail-label",
|
|
4602
|
+
children: c.label
|
|
4603
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
4604
|
+
className: "ui-dt-detail-text",
|
|
4605
|
+
children: c.fullText ? c.fullText(x.r) : cellInner(x.r, c)
|
|
4606
|
+
})]
|
|
4607
|
+
}, c.key))
|
|
4608
|
+
})
|
|
4609
|
+
}) : null] }, id);
|
|
4610
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
4611
|
+
className: "ui-dt-empty",
|
|
4612
|
+
children: [p.emptyText || tr("沒有符合的資料"), q || activeN ? /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, {
|
|
4613
|
+
onClick: clearFilters,
|
|
4614
|
+
children: tr("清除篩選")
|
|
4615
|
+
}) }) : null]
|
|
4616
|
+
})
|
|
4617
|
+
}),
|
|
4618
|
+
p.totals && list.length ? /* @__PURE__ */ jsxs("div", {
|
|
4619
|
+
className: "ui-dt-row ui-dt-total",
|
|
4620
|
+
role: "row",
|
|
4621
|
+
style: grid,
|
|
4622
|
+
children: [
|
|
4623
|
+
expander ? /* @__PURE__ */ jsx("div", {
|
|
4624
|
+
className: "ui-dt-cell",
|
|
4625
|
+
role: "cell"
|
|
4626
|
+
}) : null,
|
|
4627
|
+
selectable ? /* @__PURE__ */ jsx("div", {
|
|
4628
|
+
className: "ui-dt-cell",
|
|
4629
|
+
role: "cell"
|
|
4630
|
+
}) : null,
|
|
4631
|
+
shownCols.map((c, ci) => /* @__PURE__ */ jsx("div", {
|
|
4632
|
+
role: "cell",
|
|
4633
|
+
className: cellClass(c, ci),
|
|
4634
|
+
style: stickyStyle(ci),
|
|
4635
|
+
children: total(c, ci)
|
|
4636
|
+
}, c.key)),
|
|
4637
|
+
hasAct ? /* @__PURE__ */ jsx("div", {
|
|
4638
|
+
className: "ui-dt-cell",
|
|
4639
|
+
role: "cell"
|
|
4640
|
+
}) : null
|
|
4641
|
+
]
|
|
4642
|
+
}) : null
|
|
4643
|
+
]
|
|
4644
|
+
})
|
|
4645
|
+
})
|
|
4646
|
+
});
|
|
4647
|
+
};
|
|
4648
|
+
const footView = /* @__PURE__ */ jsx(Fragment, { children: pages > 1 ? /* @__PURE__ */ jsxs("div", {
|
|
4649
|
+
className: "ui-dt-foot",
|
|
4650
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
4651
|
+
className: "ui-dt-range",
|
|
4652
|
+
children: monoNums(tr("第 {a}–{b} 筆,共 {n} 筆", {
|
|
4653
|
+
a: "",
|
|
4654
|
+
b: "",
|
|
4655
|
+
n: ""
|
|
4656
|
+
}), [
|
|
4657
|
+
start + 1,
|
|
4658
|
+
Math.min(list.length, start + pageSize),
|
|
4659
|
+
format.number(list.length)
|
|
4660
|
+
])
|
|
4661
|
+
}), /* @__PURE__ */ jsxs("nav", {
|
|
4662
|
+
className: "ui-dt-pages",
|
|
4663
|
+
"aria-label": tr("分頁"),
|
|
4664
|
+
children: [
|
|
4665
|
+
/* @__PURE__ */ jsx("button", {
|
|
4666
|
+
type: "button",
|
|
4667
|
+
className: "ui-dt-page",
|
|
4668
|
+
"aria-label": tr("上一頁"),
|
|
4669
|
+
disabled: pageNow === 0,
|
|
4670
|
+
onClick: () => goPage(pageNow - 1),
|
|
4671
|
+
children: "‹"
|
|
4672
|
+
}),
|
|
4673
|
+
Array.from({ length: pages }, (_, i) => /* @__PURE__ */ jsx("button", {
|
|
4674
|
+
type: "button",
|
|
4675
|
+
className: cx("ui-dt-page", i === pageNow && "is-on"),
|
|
4676
|
+
"aria-current": i === pageNow ? "page" : void 0,
|
|
4677
|
+
onClick: () => goPage(i),
|
|
4678
|
+
children: String(i + 1)
|
|
4679
|
+
}, i)),
|
|
4680
|
+
/* @__PURE__ */ jsx("button", {
|
|
4681
|
+
type: "button",
|
|
4682
|
+
className: "ui-dt-page",
|
|
4683
|
+
"aria-label": tr("下一頁"),
|
|
4684
|
+
disabled: pageNow >= pages - 1,
|
|
4685
|
+
onClick: () => goPage(pageNow + 1),
|
|
4686
|
+
children: "›"
|
|
4687
|
+
})
|
|
4688
|
+
]
|
|
4689
|
+
})]
|
|
4690
|
+
}) : null });
|
|
3685
4691
|
return /* @__PURE__ */ jsxs("div", {
|
|
3686
4692
|
ref: rootRef,
|
|
3687
4693
|
className: cx("ui-dt", selIds.length && "has-sel", p.className),
|
|
@@ -3740,250 +4746,31 @@ function DataTable(p) {
|
|
|
3740
4746
|
count: sumAll.filter((x) => String(get(x.r, summary.key)) === String(it.value)).length
|
|
3741
4747
|
}))]
|
|
3742
4748
|
}) : null,
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
setQ(v);
|
|
3750
|
-
setPage(0);
|
|
3751
|
-
},
|
|
3752
|
-
placeholder: search.placeholder || tr("搜尋"),
|
|
3753
|
-
label: search.placeholder || tr("搜尋"),
|
|
3754
|
-
className: "ui-dt-search"
|
|
3755
|
-
}) : null,
|
|
3756
|
-
filters.length ? /* @__PURE__ */ jsx(FilterButton, {
|
|
3757
|
-
boundary: rootRef,
|
|
3758
|
-
filters,
|
|
3759
|
-
values,
|
|
3760
|
-
activeCount: activeN,
|
|
3761
|
-
count: (f, v) => all.filter((x) => passes(x.r, f.key) && matches(f, x.r, f.type === "list" ? [v] : void 0)).length,
|
|
3762
|
-
onChange: (key, v) => {
|
|
3763
|
-
setValues({
|
|
3764
|
-
...values,
|
|
3765
|
-
[key]: v
|
|
3766
|
-
});
|
|
3767
|
-
setPage(0);
|
|
3768
|
-
},
|
|
3769
|
-
onClear: () => {
|
|
3770
|
-
setValues({});
|
|
3771
|
-
setPage(0);
|
|
3772
|
-
}
|
|
3773
|
-
}) : null,
|
|
3774
|
-
/* @__PURE__ */ jsxs("span", {
|
|
3775
|
-
className: "ui-dt-result",
|
|
3776
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
3777
|
-
"aria-hidden": "true",
|
|
3778
|
-
children: seenOnly(tr("{n} / {total} 筆", {
|
|
3779
|
-
n: "",
|
|
3780
|
-
total: ""
|
|
3781
|
-
}), [format.number(list.length), format.number(baseCount)])
|
|
3782
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
3783
|
-
className: "ui-visually-hidden",
|
|
3784
|
-
children: format.fractionLabel(list.length, baseCount, tr("筆"))
|
|
3785
|
-
})]
|
|
3786
|
-
}),
|
|
3787
|
-
p.columnMenu !== false && cols.length > 2 ? /* @__PURE__ */ jsx(ColumnMenu, {
|
|
3788
|
-
cols,
|
|
3789
|
-
hidden,
|
|
3790
|
-
onToggle: (k) => setToggled({
|
|
3791
|
-
...toggled,
|
|
3792
|
-
[k]: !hidden[k]
|
|
3793
|
-
})
|
|
3794
|
-
}) : null
|
|
3795
|
-
]
|
|
3796
|
-
}),
|
|
3797
|
-
/* @__PURE__ */ jsx("div", {
|
|
3798
|
-
className: cx("ui-dt-scroller", scrollMore && "has-more"),
|
|
3799
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
3800
|
-
className: "ui-dt-scroll",
|
|
3801
|
-
ref: scrollRef,
|
|
3802
|
-
onScroll,
|
|
3803
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
3804
|
-
className: "ui-dt-table",
|
|
3805
|
-
role: "table",
|
|
3806
|
-
"aria-label": p.label || p.caption,
|
|
3807
|
-
children: [
|
|
3808
|
-
head,
|
|
3809
|
-
/* @__PURE__ */ jsx("div", {
|
|
3810
|
-
ref: bodyRef,
|
|
3811
|
-
className: "ui-dt-body",
|
|
3812
|
-
role: "rowgroup",
|
|
3813
|
-
children: vis.length ? vis.map((x, i) => {
|
|
3814
|
-
const id = visIds[i];
|
|
3815
|
-
const on = !!sel[id];
|
|
3816
|
-
const open = expander && !!opened[id];
|
|
3817
|
-
const detailId = `${uid}-d-${idPart(id)}`;
|
|
3818
|
-
const rowName = shownCols[0] ? String(cellText(shownCols[0], get(x.r, shownCols[0].key)) ?? "") : "";
|
|
3819
|
-
return /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
3820
|
-
"data-rid": id,
|
|
3821
|
-
ref: (el) => {
|
|
3822
|
-
rowEls.current[id] = el;
|
|
3823
|
-
},
|
|
3824
|
-
role: "row",
|
|
3825
|
-
"aria-labelledby": shownCols.length ? `${uid}-n-${start + i}` : void 0,
|
|
3826
|
-
className: cx("ui-dt-row", i % 2 && "is-even", on && "is-selected", selectable && "has-sel", expander && "has-exp"),
|
|
3827
|
-
style: gridStyle,
|
|
3828
|
-
onClick: expander ? (e) => {
|
|
3829
|
-
const t = e.target;
|
|
3830
|
-
if (t.closest(ROW_CONTROLS) && t.closest(ROW_CONTROLS) !== e.currentTarget) return;
|
|
3831
|
-
if (String(window.getSelection() ?? "")) return;
|
|
3832
|
-
setOpened({
|
|
3833
|
-
...opened,
|
|
3834
|
-
[id]: !open
|
|
3835
|
-
});
|
|
3836
|
-
} : void 0,
|
|
3837
|
-
children: [
|
|
3838
|
-
expander ? /* @__PURE__ */ jsx("div", {
|
|
3839
|
-
className: "ui-dt-cell ui-dt-exp",
|
|
3840
|
-
role: "cell",
|
|
3841
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
3842
|
-
type: "button",
|
|
3843
|
-
className: cx("ui-dt-exp-btn", open && "is-open"),
|
|
3844
|
-
"aria-expanded": open,
|
|
3845
|
-
"aria-controls": open ? detailId : void 0,
|
|
3846
|
-
"aria-label": tr(open ? "收合 {name}" : "展開 {name}", { name: rowName }),
|
|
3847
|
-
onClick: () => setOpened({
|
|
3848
|
-
...opened,
|
|
3849
|
-
[id]: !open
|
|
3850
|
-
}),
|
|
3851
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
3852
|
-
name: "caret-right",
|
|
3853
|
-
size: 16
|
|
3854
|
-
})
|
|
3855
|
-
})
|
|
3856
|
-
}) : null,
|
|
3857
|
-
selectable ? /* @__PURE__ */ jsx("div", {
|
|
3858
|
-
className: "ui-dt-cell ui-dt-sel",
|
|
3859
|
-
role: "cell",
|
|
3860
|
-
children: /* @__PURE__ */ jsx(RowCheck, {
|
|
3861
|
-
v: on,
|
|
3862
|
-
label: tr("選取第 {n} 筆", { n: start + i + 1 }),
|
|
3863
|
-
onClick: () => toggle([id], !on)
|
|
3864
|
-
})
|
|
3865
|
-
}) : null,
|
|
3866
|
-
shownCols.map((c, ci) => /* @__PURE__ */ jsx("div", {
|
|
3867
|
-
role: "cell",
|
|
3868
|
-
id: ci === 0 ? `${uid}-n-${start + i}` : void 0,
|
|
3869
|
-
"aria-description": c.fullText ? c.fullText(x.r) || void 0 : void 0,
|
|
3870
|
-
"data-label": c.label,
|
|
3871
|
-
"data-col": c.key,
|
|
3872
|
-
className: cellClass(c, ci, c.long && "is-long", mobileClass(c, ci)),
|
|
3873
|
-
style: stickyStyle(ci),
|
|
3874
|
-
children: cell(x.r, c)
|
|
3875
|
-
}, c.key)),
|
|
3876
|
-
hasAct ? /* @__PURE__ */ jsx("div", {
|
|
3877
|
-
className: "ui-dt-cell ui-dt-acts",
|
|
3878
|
-
role: "cell",
|
|
3879
|
-
children: p.rowActions?.(x.r)
|
|
3880
|
-
}) : null
|
|
3881
|
-
]
|
|
3882
|
-
}), open ? /* @__PURE__ */ jsx("div", {
|
|
3883
|
-
id: detailId,
|
|
3884
|
-
role: "row",
|
|
3885
|
-
className: cx("ui-dt-detail", i % 2 && "is-even"),
|
|
3886
|
-
style: { minWidth: minW },
|
|
3887
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
3888
|
-
role: "cell",
|
|
3889
|
-
className: "ui-dt-detail-cell",
|
|
3890
|
-
style: { paddingLeft: EXP + (selectable ? 46 : 0) + 12 },
|
|
3891
|
-
children: longCols.map((c) => /* @__PURE__ */ jsxs("div", {
|
|
3892
|
-
className: "ui-dt-detail-item",
|
|
3893
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
3894
|
-
className: "ui-dt-detail-label",
|
|
3895
|
-
children: c.label
|
|
3896
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
3897
|
-
className: "ui-dt-detail-text",
|
|
3898
|
-
children: c.fullText ? c.fullText(x.r) : cellInner(x.r, c)
|
|
3899
|
-
})]
|
|
3900
|
-
}, c.key))
|
|
3901
|
-
})
|
|
3902
|
-
}) : null] }, id);
|
|
3903
|
-
}) : /* @__PURE__ */ jsxs("div", {
|
|
3904
|
-
className: "ui-dt-empty",
|
|
3905
|
-
children: [p.emptyText || tr("沒有符合的資料"), q || activeN ? /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, {
|
|
3906
|
-
onClick: clearFilters,
|
|
3907
|
-
children: tr("清除篩選")
|
|
3908
|
-
}) }) : null]
|
|
3909
|
-
})
|
|
3910
|
-
}),
|
|
3911
|
-
p.totals && list.length ? /* @__PURE__ */ jsxs("div", {
|
|
3912
|
-
className: "ui-dt-row ui-dt-total",
|
|
3913
|
-
role: "row",
|
|
3914
|
-
style: gridStyle,
|
|
3915
|
-
children: [
|
|
3916
|
-
expander ? /* @__PURE__ */ jsx("div", {
|
|
3917
|
-
className: "ui-dt-cell",
|
|
3918
|
-
role: "cell"
|
|
3919
|
-
}) : null,
|
|
3920
|
-
selectable ? /* @__PURE__ */ jsx("div", {
|
|
3921
|
-
className: "ui-dt-cell",
|
|
3922
|
-
role: "cell"
|
|
3923
|
-
}) : null,
|
|
3924
|
-
shownCols.map((c, ci) => /* @__PURE__ */ jsx("div", {
|
|
3925
|
-
role: "cell",
|
|
3926
|
-
className: cellClass(c, ci),
|
|
3927
|
-
style: stickyStyle(ci),
|
|
3928
|
-
children: total(c, ci)
|
|
3929
|
-
}, c.key)),
|
|
3930
|
-
hasAct ? /* @__PURE__ */ jsx("div", {
|
|
3931
|
-
className: "ui-dt-cell",
|
|
3932
|
-
role: "cell"
|
|
3933
|
-
}) : null
|
|
3934
|
-
]
|
|
3935
|
-
}) : null
|
|
3936
|
-
]
|
|
3937
|
-
})
|
|
3938
|
-
})
|
|
3939
|
-
}),
|
|
4749
|
+
toolsView(false),
|
|
4750
|
+
p.zoom !== false && !narrow ? /* @__PURE__ */ jsx("div", {
|
|
4751
|
+
className: "ui-dt-zoom",
|
|
4752
|
+
children: /* @__PURE__ */ jsx(ZoomButton, { onClick: () => setZoomed(true) })
|
|
4753
|
+
}) : null,
|
|
4754
|
+
tableView(false),
|
|
3940
4755
|
/* @__PURE__ */ jsx(ScrollHint, {
|
|
3941
4756
|
show: overflows,
|
|
3942
4757
|
done: scrolled
|
|
3943
4758
|
}),
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
}), [
|
|
3953
|
-
start + 1,
|
|
3954
|
-
Math.min(list.length, start + pageSize),
|
|
3955
|
-
format.number(list.length)
|
|
3956
|
-
])
|
|
3957
|
-
}), /* @__PURE__ */ jsxs("nav", {
|
|
3958
|
-
className: "ui-dt-pages",
|
|
3959
|
-
"aria-label": tr("分頁"),
|
|
4759
|
+
footView,
|
|
4760
|
+
/* @__PURE__ */ jsx(TableDialog, {
|
|
4761
|
+
open: zoomed,
|
|
4762
|
+
onClose: () => setZoomed(false),
|
|
4763
|
+
title: p.caption || p.label,
|
|
4764
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
4765
|
+
ref: zoomRef,
|
|
4766
|
+
className: "ui-dt ui-dt-zoomed",
|
|
3960
4767
|
children: [
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
"aria-label": tr("上一頁"),
|
|
3965
|
-
disabled: pageNow === 0,
|
|
3966
|
-
onClick: () => goPage(pageNow - 1),
|
|
3967
|
-
children: "‹"
|
|
3968
|
-
}),
|
|
3969
|
-
Array.from({ length: pages }, (_, i) => /* @__PURE__ */ jsx("button", {
|
|
3970
|
-
type: "button",
|
|
3971
|
-
className: cx("ui-dt-page", i === pageNow && "is-on"),
|
|
3972
|
-
"aria-current": i === pageNow ? "page" : void 0,
|
|
3973
|
-
onClick: () => goPage(i),
|
|
3974
|
-
children: String(i + 1)
|
|
3975
|
-
}, i)),
|
|
3976
|
-
/* @__PURE__ */ jsx("button", {
|
|
3977
|
-
type: "button",
|
|
3978
|
-
className: "ui-dt-page",
|
|
3979
|
-
"aria-label": tr("下一頁"),
|
|
3980
|
-
disabled: pageNow >= pages - 1,
|
|
3981
|
-
onClick: () => goPage(pageNow + 1),
|
|
3982
|
-
children: "›"
|
|
3983
|
-
})
|
|
4768
|
+
toolsView(true),
|
|
4769
|
+
tableView(true),
|
|
4770
|
+
footView
|
|
3984
4771
|
]
|
|
3985
|
-
})
|
|
3986
|
-
})
|
|
4772
|
+
})
|
|
4773
|
+
})
|
|
3987
4774
|
]
|
|
3988
4775
|
});
|
|
3989
4776
|
}
|
|
@@ -5229,34 +6016,28 @@ function MdDetails({ summary, children }) {
|
|
|
5229
6016
|
})]
|
|
5230
6017
|
});
|
|
5231
6018
|
}
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
* (
|
|
6019
|
+
/** A Markdown table: column borders in the header drag; the corner button shows the whole table in a wide dialog.
|
|
6020
|
+
* Under 480 px every row is a card instead, without either. The border, the dialog and the copy icon are the same as
|
|
6021
|
+
* DataTable's (internal/tableTools). */
|
|
5235
6022
|
function MdTable(p) {
|
|
5236
6023
|
const [widths, setWidths] = React.useState(null);
|
|
5237
6024
|
const [big, setBig] = React.useState(false);
|
|
5238
|
-
const [dragging, setDragging] = React.useState(
|
|
5239
|
-
const [measured, setMeasured] = React.useState([]);
|
|
6025
|
+
const [dragging, setDragging] = React.useState(false);
|
|
5240
6026
|
const table = React.useRef(null);
|
|
5241
|
-
const
|
|
5242
|
-
const
|
|
6027
|
+
const measure = () => [...table.current?.querySelectorAll("thead th") ?? []].map((th) => Math.ceil(th.getBoundingClientRect().width));
|
|
6028
|
+
const [measured, setMeasured] = React.useState([]);
|
|
5243
6029
|
React.useLayoutEffect(() => {
|
|
5244
6030
|
const el = table.current;
|
|
5245
6031
|
if (!el) return;
|
|
5246
6032
|
const update = () => {
|
|
5247
|
-
const m =
|
|
6033
|
+
const m = [...el.querySelectorAll("thead th")].map((th) => Math.ceil(th.getBoundingClientRect().width));
|
|
5248
6034
|
setMeasured((old) => old.length === m.length && old.every((v, i) => v === m[i]) ? old : m);
|
|
5249
6035
|
};
|
|
5250
6036
|
update();
|
|
5251
6037
|
const ro = new ResizeObserver(update);
|
|
5252
6038
|
ro.observe(el);
|
|
5253
6039
|
return () => ro.disconnect();
|
|
5254
|
-
}, [
|
|
5255
|
-
const widen = (j, base, to) => {
|
|
5256
|
-
const next = base.slice();
|
|
5257
|
-
next[j] = Math.max(MIN_COL, Math.round(to));
|
|
5258
|
-
setWidths(next);
|
|
5259
|
-
};
|
|
6040
|
+
}, []);
|
|
5260
6041
|
const body = (resize) => /* @__PURE__ */ jsxs("table", {
|
|
5261
6042
|
ref: resize ? table : void 0,
|
|
5262
6043
|
className: "ui-md-table",
|
|
@@ -5269,49 +6050,17 @@ function MdTable(p) {
|
|
|
5269
6050
|
resize && widths ? /* @__PURE__ */ jsx("colgroup", { children: widths.map((w, j) => /* @__PURE__ */ jsx("col", { style: { width: w } }, j)) }) : null,
|
|
5270
6051
|
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: p.heads.map((h, j) => /* @__PURE__ */ jsxs("th", {
|
|
5271
6052
|
style: p.align(j),
|
|
5272
|
-
children: [h, resize ? /* @__PURE__ */ jsx(
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
onPointerDown: (e) => {
|
|
5281
|
-
if (e.button !== 0) return;
|
|
5282
|
-
e.preventDefault();
|
|
5283
|
-
e.currentTarget.setPointerCapture(e.pointerId);
|
|
5284
|
-
drag.current = {
|
|
5285
|
-
j,
|
|
5286
|
-
x: e.clientX,
|
|
5287
|
-
base: widths ?? measure()
|
|
5288
|
-
};
|
|
5289
|
-
setDragging(j);
|
|
5290
|
-
},
|
|
5291
|
-
onPointerMove: (e) => {
|
|
5292
|
-
const d = drag.current;
|
|
5293
|
-
if (d) widen(d.j, d.base, d.base[d.j] + e.clientX - d.x);
|
|
5294
|
-
},
|
|
5295
|
-
onPointerUp: () => {
|
|
5296
|
-
drag.current = null;
|
|
5297
|
-
setDragging(-1);
|
|
5298
|
-
},
|
|
5299
|
-
onPointerCancel: () => {
|
|
5300
|
-
drag.current = null;
|
|
5301
|
-
setDragging(-1);
|
|
6053
|
+
children: [h, resize ? /* @__PURE__ */ jsx(ColResize, {
|
|
6054
|
+
name: p.headText[j],
|
|
6055
|
+
width: widths?.[j] ?? measured[j] ?? 0,
|
|
6056
|
+
start: () => (widths ?? measure())[j],
|
|
6057
|
+
onWidth: (w) => {
|
|
6058
|
+
const next = (widths ?? measure()).slice();
|
|
6059
|
+
next[j] = w;
|
|
6060
|
+
setWidths(next);
|
|
5302
6061
|
},
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
if (e.altKey || e.metaKey || e.ctrlKey) return;
|
|
5306
|
-
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
5307
|
-
e.preventDefault();
|
|
5308
|
-
const base = widths ?? measure();
|
|
5309
|
-
widen(j, base, base[j] + (e.key === "ArrowRight" ? 16 : -16));
|
|
5310
|
-
} else if (e.key === "Enter") {
|
|
5311
|
-
e.preventDefault();
|
|
5312
|
-
setWidths(null);
|
|
5313
|
-
}
|
|
5314
|
-
}
|
|
6062
|
+
onReset: () => setWidths(null),
|
|
6063
|
+
onDragging: setDragging
|
|
5315
6064
|
}) : null]
|
|
5316
6065
|
}, j)) }) }),
|
|
5317
6066
|
/* @__PURE__ */ jsx("tbody", { children: p.rows.map((r, ri) => /* @__PURE__ */ jsx("tr", { children: r.map((cell, j) => /* @__PURE__ */ jsx("td", {
|
|
@@ -5323,16 +6072,11 @@ function MdTable(p) {
|
|
|
5323
6072
|
]
|
|
5324
6073
|
});
|
|
5325
6074
|
return /* @__PURE__ */ jsxs("div", {
|
|
5326
|
-
className: cx("ui-md-tablebox", dragging
|
|
6075
|
+
className: cx("ui-md-tablebox", dragging && "is-resizing"),
|
|
5327
6076
|
children: [
|
|
5328
6077
|
/* @__PURE__ */ jsx("div", {
|
|
5329
6078
|
className: "ui-md-table-tools",
|
|
5330
|
-
children: /* @__PURE__ */ jsx(
|
|
5331
|
-
className: "ui-md-table-big",
|
|
5332
|
-
icon: "corners-out",
|
|
5333
|
-
label: tr("放大表格"),
|
|
5334
|
-
onClick: () => setBig(true)
|
|
5335
|
-
})
|
|
6079
|
+
children: /* @__PURE__ */ jsx(ZoomButton, { onClick: () => setBig(true) })
|
|
5336
6080
|
}),
|
|
5337
6081
|
/* @__PURE__ */ jsx("div", {
|
|
5338
6082
|
className: "ui-md-table-wrap",
|
|
@@ -5341,11 +6085,9 @@ function MdTable(p) {
|
|
|
5341
6085
|
"aria-label": p.label,
|
|
5342
6086
|
children: body(true)
|
|
5343
6087
|
}),
|
|
5344
|
-
|
|
5345
|
-
open:
|
|
6088
|
+
/* @__PURE__ */ jsx(TableDialog, {
|
|
6089
|
+
open: big,
|
|
5346
6090
|
onClose: () => setBig(false),
|
|
5347
|
-
title: tr("表格"),
|
|
5348
|
-
className: "ui-md-table-dialog",
|
|
5349
6091
|
children: /* @__PURE__ */ jsx("div", {
|
|
5350
6092
|
className: "ui-md ui-md-table-wrap",
|
|
5351
6093
|
tabIndex: 0,
|
|
@@ -5353,7 +6095,7 @@ function MdTable(p) {
|
|
|
5353
6095
|
"aria-label": p.label,
|
|
5354
6096
|
children: body(false)
|
|
5355
6097
|
})
|
|
5356
|
-
})
|
|
6098
|
+
})
|
|
5357
6099
|
]
|
|
5358
6100
|
});
|
|
5359
6101
|
}
|