@runlume/admin-ui 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/README.en.md +6 -13
  2. package/README.md +5 -11
  3. package/dist-package/_virtual/_rolldown/runtime.cjs +1 -0
  4. package/dist-package/admin-ui.cjs +1 -0
  5. package/dist-package/admin-ui.d.ts +41 -1
  6. package/dist-package/admin-ui.d.ts.map +1 -1
  7. package/dist-package/admin-ui.js +79 -0
  8. package/dist-package/components/calendar.cjs +1 -0
  9. package/dist-package/components/calendar.d.ts +13 -0
  10. package/dist-package/components/calendar.d.ts.map +1 -0
  11. package/dist-package/components/calendar.js +91 -0
  12. package/dist-package/components/cascader.cjs +1 -0
  13. package/dist-package/components/cascader.d.ts +19 -0
  14. package/dist-package/components/cascader.d.ts.map +1 -0
  15. package/dist-package/components/cascader.js +85 -0
  16. package/dist-package/components/charts.cjs +1 -0
  17. package/dist-package/components/charts.d.ts +80 -0
  18. package/dist-package/components/charts.d.ts.map +1 -0
  19. package/dist-package/components/charts.js +374 -0
  20. package/dist-package/components/code-block.cjs +1 -0
  21. package/dist-package/components/code-block.d.ts +7 -0
  22. package/dist-package/components/code-block.d.ts.map +1 -0
  23. package/dist-package/components/code-block.js +47 -0
  24. package/dist-package/components/column-chart.cjs +1 -0
  25. package/dist-package/components/column-chart.d.ts +18 -0
  26. package/dist-package/components/column-chart.d.ts.map +1 -0
  27. package/dist-package/components/column-chart.js +89 -0
  28. package/dist-package/components/combobox.cjs +1 -0
  29. package/dist-package/components/combobox.d.ts +24 -0
  30. package/dist-package/components/combobox.d.ts.map +1 -0
  31. package/dist-package/components/combobox.js +111 -0
  32. package/dist-package/components/confirm-dialog.cjs +1 -0
  33. package/dist-package/components/confirm-dialog.d.ts +17 -0
  34. package/dist-package/components/confirm-dialog.d.ts.map +1 -0
  35. package/dist-package/components/confirm-dialog.js +44 -0
  36. package/dist-package/components/count-to.cjs +1 -0
  37. package/dist-package/components/count-to.d.ts +13 -0
  38. package/dist-package/components/count-to.d.ts.map +1 -0
  39. package/dist-package/components/count-to.js +36 -0
  40. package/dist-package/components/cursor-pagination.cjs +1 -0
  41. package/dist-package/components/cursor-pagination.d.ts +11 -0
  42. package/dist-package/components/cursor-pagination.d.ts.map +1 -0
  43. package/dist-package/components/cursor-pagination.js +39 -0
  44. package/dist-package/components/data-table.cjs +1 -0
  45. package/dist-package/components/data-table.d.ts +69 -0
  46. package/dist-package/components/data-table.d.ts.map +1 -0
  47. package/dist-package/components/data-table.js +377 -0
  48. package/dist-package/components/descriptions.cjs +1 -0
  49. package/dist-package/components/descriptions.d.ts +16 -0
  50. package/dist-package/components/descriptions.d.ts.map +1 -0
  51. package/dist-package/components/descriptions.js +28 -0
  52. package/dist-package/components/editable-table.cjs +1 -0
  53. package/dist-package/components/editable-table.d.ts +27 -0
  54. package/dist-package/components/editable-table.d.ts.map +1 -0
  55. package/dist-package/components/editable-table.js +212 -0
  56. package/dist-package/components/filter-presets.cjs +1 -0
  57. package/dist-package/components/filter-presets.d.ts +11 -0
  58. package/dist-package/components/filter-presets.d.ts.map +1 -0
  59. package/dist-package/components/filter-presets.js +17 -0
  60. package/dist-package/components/fixed-bar.cjs +1 -0
  61. package/dist-package/components/fixed-bar.d.ts +11 -0
  62. package/dist-package/components/fixed-bar.d.ts.map +1 -0
  63. package/dist-package/components/fixed-bar.js +18 -0
  64. package/dist-package/components/image-preview.cjs +1 -0
  65. package/dist-package/components/image-preview.d.ts +14 -0
  66. package/dist-package/components/image-preview.d.ts.map +1 -0
  67. package/dist-package/components/image-preview.js +166 -0
  68. package/dist-package/components/layout-container.cjs +1 -0
  69. package/dist-package/components/layout-container.d.ts +17 -0
  70. package/dist-package/components/layout-container.d.ts.map +1 -0
  71. package/dist-package/components/layout-container.js +85 -0
  72. package/dist-package/components/mention.cjs +1 -0
  73. package/dist-package/components/mention.d.ts +20 -0
  74. package/dist-package/components/mention.d.ts.map +1 -0
  75. package/dist-package/components/mention.js +126 -0
  76. package/dist-package/components/multi-select.cjs +1 -0
  77. package/dist-package/components/multi-select.d.ts +17 -0
  78. package/dist-package/components/multi-select.d.ts.map +1 -0
  79. package/dist-package/components/multi-select.js +126 -0
  80. package/dist-package/components/multi-step-loader.cjs +1 -0
  81. package/dist-package/components/multi-step-loader.d.ts +18 -0
  82. package/dist-package/components/multi-step-loader.d.ts.map +1 -0
  83. package/dist-package/components/multi-step-loader.js +38 -0
  84. package/dist-package/components/page-button.cjs +1 -0
  85. package/dist-package/components/page-button.d.ts +6 -0
  86. package/dist-package/components/page-button.d.ts.map +1 -0
  87. package/dist-package/components/page-button.js +24 -0
  88. package/dist-package/components/page-pager.cjs +1 -0
  89. package/dist-package/components/page-pager.d.ts +11 -0
  90. package/dist-package/components/page-pager.d.ts.map +1 -0
  91. package/dist-package/components/page-pager.js +51 -0
  92. package/dist-package/components/page.cjs +1 -0
  93. package/dist-package/components/page.d.ts +34 -0
  94. package/dist-package/components/page.d.ts.map +1 -0
  95. package/dist-package/components/page.js +208 -0
  96. package/dist-package/components/pagination-bar.cjs +1 -0
  97. package/dist-package/components/pagination-bar.d.ts +8 -0
  98. package/dist-package/components/pagination-bar.d.ts.map +1 -0
  99. package/dist-package/components/pagination-bar.js +23 -0
  100. package/dist-package/components/password-strength.cjs +1 -0
  101. package/dist-package/components/password-strength.d.ts +11 -0
  102. package/dist-package/components/password-strength.d.ts.map +1 -0
  103. package/dist-package/components/password-strength.js +70 -0
  104. package/dist-package/components/rate.cjs +1 -0
  105. package/dist-package/components/rate.d.ts +13 -0
  106. package/dist-package/components/rate.d.ts.map +1 -0
  107. package/dist-package/components/rate.js +56 -0
  108. package/dist-package/components/resizable-panel.cjs +1 -0
  109. package/dist-package/components/resizable-panel.d.ts +15 -0
  110. package/dist-package/components/resizable-panel.d.ts.map +1 -0
  111. package/dist-package/components/resizable-panel.js +56 -0
  112. package/dist-package/components/search-filters.cjs +1 -0
  113. package/dist-package/components/search-filters.d.ts +31 -0
  114. package/dist-package/components/search-filters.d.ts.map +1 -0
  115. package/dist-package/components/search-filters.js +110 -0
  116. package/dist-package/components/sortable-list.cjs +1 -0
  117. package/dist-package/components/sortable-list.d.ts +14 -0
  118. package/dist-package/components/sortable-list.d.ts.map +1 -0
  119. package/dist-package/components/sortable-list.js +48 -0
  120. package/dist-package/components/sparkline.cjs +1 -0
  121. package/dist-package/components/sparkline.d.ts +11 -0
  122. package/dist-package/components/sparkline.d.ts.map +1 -0
  123. package/dist-package/components/sparkline.js +50 -0
  124. package/dist-package/components/status-badge.cjs +1 -0
  125. package/dist-package/components/status-badge.d.ts +4 -0
  126. package/dist-package/components/status-badge.d.ts.map +1 -0
  127. package/dist-package/components/status-badge.js +28 -0
  128. package/dist-package/components/steps.cjs +1 -0
  129. package/dist-package/components/steps.d.ts +15 -0
  130. package/dist-package/components/steps.d.ts.map +1 -0
  131. package/dist-package/components/steps.js +41 -0
  132. package/dist-package/components/storage-box.cjs +1 -0
  133. package/dist-package/components/storage-box.d.ts +19 -0
  134. package/dist-package/components/storage-box.d.ts.map +1 -0
  135. package/dist-package/components/storage-box.js +153 -0
  136. package/dist-package/components/table-cell-overflow.cjs +1 -0
  137. package/dist-package/components/table-cell-overflow.d.ts +5 -0
  138. package/dist-package/components/table-cell-overflow.d.ts.map +1 -0
  139. package/dist-package/components/table-cell-overflow.js +31 -0
  140. package/dist-package/components/table-toolbar.cjs +1 -0
  141. package/dist-package/components/table-toolbar.d.ts +5 -0
  142. package/dist-package/components/table-toolbar.d.ts.map +1 -0
  143. package/dist-package/components/table-toolbar.js +11 -0
  144. package/dist-package/components/timeline.cjs +1 -0
  145. package/dist-package/components/timeline.d.ts +14 -0
  146. package/dist-package/components/timeline.d.ts.map +1 -0
  147. package/dist-package/components/timeline.js +40 -0
  148. package/dist-package/components/transfer.cjs +1 -0
  149. package/dist-package/components/transfer.d.ts +18 -0
  150. package/dist-package/components/transfer.d.ts.map +1 -0
  151. package/dist-package/components/transfer.js +98 -0
  152. package/dist-package/components/tree-table.cjs +1 -0
  153. package/dist-package/components/tree-table.d.ts +23 -0
  154. package/dist-package/components/tree-table.d.ts.map +1 -0
  155. package/dist-package/components/tree-table.js +53 -0
  156. package/dist-package/components/tree.cjs +1 -0
  157. package/dist-package/components/tree.d.ts +36 -0
  158. package/dist-package/components/tree.d.ts.map +1 -0
  159. package/dist-package/components/tree.js +204 -0
  160. package/dist-package/components/trend.cjs +1 -0
  161. package/dist-package/components/trend.d.ts +19 -0
  162. package/dist-package/components/trend.d.ts.map +1 -0
  163. package/dist-package/components/trend.js +18 -0
  164. package/dist-package/components/ui/alert-dialog.cjs +1 -0
  165. package/dist-package/components/ui/alert-dialog.js +57 -0
  166. package/dist-package/components/ui/alert.cjs +1 -0
  167. package/dist-package/components/ui/alert.js +63 -0
  168. package/dist-package/components/ui/avatar.cjs +1 -0
  169. package/dist-package/components/ui/avatar.js +27 -0
  170. package/dist-package/components/ui/badge.cjs +1 -0
  171. package/dist-package/components/ui/badge.js +40 -0
  172. package/dist-package/components/ui/breadcrumb.cjs +1 -0
  173. package/dist-package/components/ui/breadcrumb.js +70 -0
  174. package/dist-package/components/ui/button.cjs +1 -0
  175. package/dist-package/components/ui/button.js +58 -0
  176. package/dist-package/components/ui/card.cjs +1 -0
  177. package/dist-package/components/ui/card.js +55 -0
  178. package/dist-package/components/ui/checkbox.cjs +1 -0
  179. package/dist-package/components/ui/checkbox.js +19 -0
  180. package/dist-package/components/ui/collapsible.cjs +1 -0
  181. package/dist-package/components/ui/collapsible.js +32 -0
  182. package/dist-package/components/ui/context-menu.cjs +1 -0
  183. package/dist-package/components/ui/context-menu.js +46 -0
  184. package/dist-package/components/ui/date-input.cjs +1 -0
  185. package/dist-package/components/ui/date-input.js +183 -0
  186. package/dist-package/components/ui/date-range-input.cjs +1 -0
  187. package/dist-package/components/ui/date-range-input.js +209 -0
  188. package/dist-package/components/ui/date-time-input.cjs +1 -0
  189. package/dist-package/components/ui/date-time-input.js +23 -0
  190. package/dist-package/components/ui/dialog.cjs +1 -0
  191. package/dist-package/components/ui/dialog.js +189 -0
  192. package/dist-package/components/ui/dropdown-menu.cjs +1 -0
  193. package/dist-package/components/ui/dropdown-menu.js +124 -0
  194. package/dist-package/components/ui/file-upload.cjs +1 -0
  195. package/dist-package/components/ui/file-upload.js +160 -0
  196. package/dist-package/components/ui/hover-card.cjs +1 -0
  197. package/dist-package/components/ui/hover-card.js +28 -0
  198. package/dist-package/components/ui/input-otp.cjs +1 -0
  199. package/dist-package/components/ui/input-otp.js +33 -0
  200. package/dist-package/components/ui/input.cjs +1 -0
  201. package/dist-package/components/ui/input.js +65 -0
  202. package/dist-package/components/ui/kbd.cjs +1 -0
  203. package/dist-package/components/ui/kbd.js +20 -0
  204. package/dist-package/components/ui/label.cjs +1 -0
  205. package/dist-package/components/ui/label.js +14 -0
  206. package/dist-package/components/ui/native-select.cjs +1 -0
  207. package/dist-package/components/ui/native-select.js +125 -0
  208. package/dist-package/components/ui/number-field.cjs +1 -0
  209. package/dist-package/components/ui/number-field.js +50 -0
  210. package/dist-package/components/ui/progress.cjs +1 -0
  211. package/dist-package/components/ui/progress.js +28 -0
  212. package/dist-package/components/ui/radio-group.cjs +1 -0
  213. package/dist-package/components/ui/radio-group.js +27 -0
  214. package/dist-package/components/ui/scroll-area.cjs +1 -0
  215. package/dist-package/components/ui/scroll-area.js +25 -0
  216. package/dist-package/components/ui/select.cjs +1 -0
  217. package/dist-package/components/ui/select.js +23 -0
  218. package/dist-package/components/ui/separator.cjs +1 -0
  219. package/dist-package/components/ui/separator.js +17 -0
  220. package/dist-package/components/ui/sheet.cjs +1 -0
  221. package/dist-package/components/ui/sheet.js +86 -0
  222. package/dist-package/components/ui/sidebar.cjs +1 -0
  223. package/dist-package/components/ui/sidebar.js +350 -0
  224. package/dist-package/components/ui/skeleton.cjs +1 -0
  225. package/dist-package/components/ui/skeleton.js +12 -0
  226. package/dist-package/components/ui/slider.cjs +1 -0
  227. package/dist-package/components/ui/slider.js +36 -0
  228. package/dist-package/components/ui/switch.cjs +1 -0
  229. package/dist-package/components/ui/switch.js +14 -0
  230. package/dist-package/components/ui/table.cjs +1 -0
  231. package/dist-package/components/ui/table.js +66 -0
  232. package/dist-package/components/ui/tabs.cjs +1 -0
  233. package/dist-package/components/ui/tabs.js +47 -0
  234. package/dist-package/components/ui/tag-variants.cjs +1 -0
  235. package/dist-package/components/ui/tag-variants.js +15 -0
  236. package/dist-package/components/ui/tag.cjs +1 -0
  237. package/dist-package/components/ui/tag.js +31 -0
  238. package/dist-package/components/ui/textarea.cjs +1 -0
  239. package/dist-package/components/ui/textarea.js +13 -0
  240. package/dist-package/components/ui/time-input.cjs +1 -0
  241. package/dist-package/components/ui/time-input.js +89 -0
  242. package/dist-package/components/ui/tooltip.cjs +1 -0
  243. package/dist-package/components/ui/tooltip.js +35 -0
  244. package/dist-package/hooks/use-mobile.cjs +1 -0
  245. package/dist-package/hooks/use-mobile.js +11 -0
  246. package/dist-package/lib/dialog-focus.cjs +1 -0
  247. package/dist-package/lib/dialog-focus.js +10 -0
  248. package/dist-package/lib/metrics.cjs +1 -0
  249. package/dist-package/lib/metrics.d.ts +18 -0
  250. package/dist-package/lib/metrics.d.ts.map +1 -0
  251. package/dist-package/lib/metrics.js +22 -0
  252. package/dist-package/lib/pager.cjs +1 -0
  253. package/dist-package/lib/pager.d.ts +8 -0
  254. package/dist-package/lib/pager.d.ts.map +1 -0
  255. package/dist-package/lib/pager.js +18 -0
  256. package/dist-package/lib/password.cjs +1 -0
  257. package/dist-package/lib/password.d.ts +14 -0
  258. package/dist-package/lib/password.d.ts.map +1 -0
  259. package/dist-package/lib/password.js +34 -0
  260. package/dist-package/lib/presets.cjs +1 -0
  261. package/dist-package/lib/presets.d.ts +25 -0
  262. package/dist-package/lib/presets.d.ts.map +1 -0
  263. package/dist-package/lib/presets.js +48 -0
  264. package/dist-package/lib/range.cjs +1 -0
  265. package/dist-package/lib/range.js +57 -0
  266. package/dist-package/lib/storage-key.cjs +1 -0
  267. package/dist-package/lib/storage-key.d.ts +2 -0
  268. package/dist-package/lib/storage-key.d.ts.map +1 -0
  269. package/dist-package/lib/storage-key.js +6 -0
  270. package/dist-package/lib/table-prefs.cjs +1 -0
  271. package/dist-package/lib/table-prefs.d.ts +17 -0
  272. package/dist-package/lib/table-prefs.d.ts.map +1 -0
  273. package/dist-package/lib/table-prefs.js +64 -0
  274. package/dist-package/lib/tree.cjs +1 -0
  275. package/dist-package/lib/tree.d.ts +37 -0
  276. package/dist-package/lib/tree.d.ts.map +1 -0
  277. package/dist-package/lib/tree.js +57 -0
  278. package/dist-package/lib/use-ui-translation.cjs +1 -0
  279. package/dist-package/lib/use-ui-translation.d.ts +15 -0
  280. package/dist-package/lib/use-ui-translation.d.ts.map +1 -0
  281. package/dist-package/lib/use-ui-translation.js +65 -0
  282. package/dist-package/lib/utils.cjs +1 -0
  283. package/dist-package/lib/utils.js +8 -0
  284. package/dist-package/styles.css +1 -1
  285. package/package.json +25 -15
  286. package/dist-package/index.js +0 -12212
@@ -0,0 +1,89 @@
1
+ import { cn as e } from "../../lib/utils.js";
2
+ import { useUiTranslation as t } from "../../lib/use-ui-translation.js";
3
+ import { inputBaseClass as n } from "./input.js";
4
+ import * as r from "react";
5
+ import { Popover as i } from "radix-ui";
6
+ import { Clock as a } from "lucide-react";
7
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
+ //#region src/components/ui/time-input.tsx
9
+ function c({ ref: c, className: l, disabled: u, readOnly: d, onKeyDown: f, ...p }) {
10
+ let { i18n: m } = t(), h = m.language.startsWith("en"), g = r.useRef(null), [_, v] = r.useState(!1), [y, b] = r.useState("00:00");
11
+ r.useImperativeHandle(c, () => g.current);
12
+ function x(e) {
13
+ e && b(g.current.value || "00:00"), v(e);
14
+ }
15
+ function S(e, t) {
16
+ let n = y.split(":");
17
+ n[e] = t;
18
+ let r = n.join(":"), i = g.current;
19
+ Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value").set.call(i, r), i.dispatchEvent(new Event("input", { bubbles: !0 })), i.dispatchEvent(new Event("change", { bubbles: !0 })), b(r);
20
+ }
21
+ return /* @__PURE__ */ s(i.Root, {
22
+ open: _,
23
+ onOpenChange: x,
24
+ children: [/* @__PURE__ */ o(i.Anchor, {
25
+ asChild: !0,
26
+ children: /* @__PURE__ */ s("div", {
27
+ className: "relative w-full min-w-0",
28
+ children: [/* @__PURE__ */ o("input", {
29
+ ...p,
30
+ ref: g,
31
+ disabled: u,
32
+ readOnly: d,
33
+ className: e(n, "themed-time-input pr-10", l),
34
+ onKeyDown: (e) => {
35
+ f?.(e), !e.defaultPrevented && e.altKey && e.key === "ArrowDown" && !u && !d && (e.preventDefault(), x(!0));
36
+ }
37
+ }), /* @__PURE__ */ o(i.Trigger, {
38
+ asChild: !0,
39
+ children: /* @__PURE__ */ o("button", {
40
+ type: "button",
41
+ disabled: u || d,
42
+ "aria-label": h ? "Choose time" : "选择时间",
43
+ className: "absolute right-1 top-1/2 flex size-8 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-50",
44
+ children: /* @__PURE__ */ o(a, { className: "size-4" })
45
+ })
46
+ })]
47
+ })
48
+ }), /* @__PURE__ */ o(i.Portal, { children: /* @__PURE__ */ s(i.Content, {
49
+ align: "start",
50
+ sideOffset: 4,
51
+ "aria-label": h ? "Choose time" : "选择时间",
52
+ className: "z-50 w-48 rounded-xl border bg-popover p-2 text-popover-foreground shadow-md",
53
+ children: [/* @__PURE__ */ o("div", {
54
+ className: "grid grid-cols-2 gap-2",
55
+ children: [24, 60].map((t, n) => /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("p", {
56
+ className: "pb-2 text-center text-xs text-muted-foreground",
57
+ children: n === 0 ? h ? "Hour" : "时" : h ? "Minute" : "分"
58
+ }), /* @__PURE__ */ o("div", {
59
+ className: "h-48 space-y-1 overflow-y-auto",
60
+ role: "group",
61
+ "aria-label": n === 0 ? h ? "Hour" : "时" : h ? "Minute" : "分",
62
+ children: Array.from({ length: t }, (t, r) => {
63
+ let i = String(r).padStart(2, "0"), a = y.split(":")[n] === i;
64
+ return /* @__PURE__ */ o("button", {
65
+ type: "button",
66
+ "aria-pressed": a,
67
+ ref: (e) => {
68
+ e && a && e.scrollIntoView?.({ block: "nearest" });
69
+ },
70
+ onClick: () => S(n, i),
71
+ className: e("h-8 w-full rounded-md text-sm tabular-nums outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring", a && "bg-primary text-primary-foreground hover:bg-primary"),
72
+ children: i
73
+ }, i);
74
+ })
75
+ })] }, n))
76
+ }), /* @__PURE__ */ o("div", {
77
+ className: "mt-2 flex justify-end border-t pt-2",
78
+ children: /* @__PURE__ */ o("button", {
79
+ type: "button",
80
+ onClick: () => v(!1),
81
+ className: "rounded-md px-3 py-1 text-sm text-primary hover:bg-accent",
82
+ children: h ? "Done" : "完成"
83
+ })
84
+ })]
85
+ }) })]
86
+ });
87
+ }
88
+ //#endregion
89
+ export { c as TimeInput };
@@ -0,0 +1 @@
1
+ const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("radix-ui"),i=require("react/jsx-runtime");function a({delayDuration:e=0,...t}){return(0,i.jsx)(r.Tooltip.Provider,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function o({...e}){return(0,i.jsx)(r.Tooltip.Root,{"data-slot":`tooltip`,...e})}function s({...e}){return(0,i.jsx)(r.Tooltip.Trigger,{"data-slot":`tooltip-trigger`,...e})}function c({className:e,sideOffset:n=0,children:a,...o}){return(0,i.jsx)(r.Tooltip.Portal,{children:(0,i.jsxs)(r.Tooltip.Content,{"data-slot":`tooltip-content`,sideOffset:n,className:t.cn(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...o,children:[a,(0,i.jsx)(r.Tooltip.Arrow,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}exports.Tooltip=o,exports.TooltipContent=c,exports.TooltipProvider=a,exports.TooltipTrigger=s;
@@ -0,0 +1,35 @@
1
+ import { cn as e } from "../../lib/utils.js";
2
+ import "react";
3
+ import { Tooltip as t } from "radix-ui";
4
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
+ //#region src/components/ui/tooltip.tsx
6
+ function i({ delayDuration: e = 0, ...r }) {
7
+ return /* @__PURE__ */ n(t.Provider, {
8
+ "data-slot": "tooltip-provider",
9
+ delayDuration: e,
10
+ ...r
11
+ });
12
+ }
13
+ function a({ ...e }) {
14
+ return /* @__PURE__ */ n(t.Root, {
15
+ "data-slot": "tooltip",
16
+ ...e
17
+ });
18
+ }
19
+ function o({ ...e }) {
20
+ return /* @__PURE__ */ n(t.Trigger, {
21
+ "data-slot": "tooltip-trigger",
22
+ ...e
23
+ });
24
+ }
25
+ function s({ className: i, sideOffset: a = 0, children: o, ...s }) {
26
+ return /* @__PURE__ */ n(t.Portal, { children: /* @__PURE__ */ r(t.Content, {
27
+ "data-slot": "tooltip-content",
28
+ sideOffset: a,
29
+ className: e("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", i),
30
+ ...s,
31
+ children: [o, /* @__PURE__ */ n(t.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })]
32
+ }) });
33
+ }
34
+ //#endregion
35
+ export { a as Tooltip, s as TooltipContent, i as TooltipProvider, o as TooltipTrigger };
@@ -0,0 +1 @@
1
+ const e=require("../_virtual/_rolldown/runtime.cjs");let t=require("react");t=e.__toESM(t,1);function n(){let e=`(max-width: 1023px)`,[n,r]=t.useState(()=>typeof window>`u`?!1:window.matchMedia(e).matches);return t.useEffect(()=>{let t=window.matchMedia(e),n=e=>r(e.matches);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),n}exports.useIsMobile=n;
@@ -0,0 +1,11 @@
1
+ import * as e from "react";
2
+ //#region src/hooks/use-mobile.ts
3
+ function t() {
4
+ let t = "(max-width: 1023px)", [n, r] = e.useState(() => typeof window > "u" ? !1 : window.matchMedia(t).matches);
5
+ return e.useEffect(() => {
6
+ let e = window.matchMedia(t), n = (e) => r(e.matches);
7
+ return e.addEventListener("change", n), () => e.removeEventListener("change", n);
8
+ }, [t]), n;
9
+ }
10
+ //#endregion
11
+ export { t as useIsMobile };
@@ -0,0 +1 @@
1
+ function e(e){let t=e.target;t instanceof HTMLElement&&queueMicrotask(()=>{let e=t.ownerDocument.activeElement;t.isConnected&&e instanceof HTMLElement&&t.contains(e)&&e.matches(`[data-slot="dialog-close"], [data-slot="sheet-close"]`)&&t.focus({preventScroll:!0})})}exports.avoidInitialCloseFocus=e;
@@ -0,0 +1,10 @@
1
+ //#region src/lib/dialog-focus.ts
2
+ function e(e) {
3
+ let t = e.target;
4
+ t instanceof HTMLElement && queueMicrotask(() => {
5
+ let e = t.ownerDocument.activeElement;
6
+ t.isConnected && e instanceof HTMLElement && t.contains(e) && e.matches("[data-slot=\"dialog-close\"], [data-slot=\"sheet-close\"]") && t.focus({ preventScroll: !0 });
7
+ });
8
+ }
9
+ //#endregion
10
+ export { e as avoidInitialCloseFocus };
@@ -0,0 +1 @@
1
+ function e(e,t={}){let{decimals:n=0,separator:r=`,`,prefix:i=``,suffix:a=``}=t,[o=`0`,s]=e.toFixed(n).split(`.`);return`${i}${r?o.replace(/\B(?=(\d{3})+(?!\d))/g,r):o}${s?`.${s}`:``}${a}`}function t(e,t,n,r=2){if(!e.length)return[];let i=Math.min(...e),a=Math.max(...e),o=Math.max(n-r*2,1),s=e.length>1?(t-r*2)/(e.length-1):0,c=a===i;return e.map((e,t)=>({x:r+t*s,y:c?r+o/2:r+o-(e-i)/(a-i)*o}))}function n(e,t=!1){return e.length?!t||e.length<3?e.map((e,t)=>`${t?`L`:`M`}${e.x} ${e.y}`).join(` `):e.map((t,n)=>{if(!n)return`M${t.x} ${t.y}`;let r=e[n-1]??t,i=(r.x+t.x)/2;return`C${i} ${r.y} ${i} ${t.y} ${t.x} ${t.y}`}).join(` `):``}exports.formatNumber=e,exports.sparklinePath=n,exports.sparklinePoints=t;
@@ -0,0 +1,18 @@
1
+ /** 指标卡的数值格式化与迷你趋势线取点。 */
2
+ export declare function formatNumber(value: number, options?: {
3
+ decimals?: number;
4
+ separator?: string;
5
+ prefix?: string;
6
+ suffix?: string;
7
+ }): string;
8
+ export type SparklinePoint = {
9
+ x: number;
10
+ y: number;
11
+ };
12
+ /** 把数值序列映射到 SVG 坐标,y 轴反向(值越大越靠上)。 */
13
+ export declare function sparklinePoints(values: number[], width: number, height: number, padding?: number): SparklinePoint[];
14
+ export declare function sparklinePath(points: SparklinePoint[], smooth?: boolean): string;
15
+ export declare function trendDirection(values: number[]): 'up' | 'down' | 'flat';
16
+ /** 与上期对比的百分比变化,用于指标卡的涨跌徽标。 */
17
+ export declare function trendPercent(current: number, previous: number): number | undefined;
18
+ //# sourceMappingURL=metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/lib/metrics.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,UAO1F;AAED,MAAM,MAAM,cAAc,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,qCAAqC;AACrC,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EAAE,EAChB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,SAAI,GACV,cAAc,EAAE,CAclB;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,MAAM,UAAQ,UAYrE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAOvE;AAED,8BAA8B;AAC9B,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGlF"}
@@ -0,0 +1,22 @@
1
+ //#region src/lib/metrics.ts
2
+ function e(e, t = {}) {
3
+ let { decimals: n = 0, separator: r = ",", prefix: i = "", suffix: a = "" } = t, [o = "0", s] = e.toFixed(n).split(".");
4
+ return `${i}${r ? o.replace(/\B(?=(\d{3})+(?!\d))/g, r) : o}${s ? `.${s}` : ""}${a}`;
5
+ }
6
+ function t(e, t, n, r = 2) {
7
+ if (!e.length) return [];
8
+ let i = Math.min(...e), a = Math.max(...e), o = Math.max(n - r * 2, 1), s = e.length > 1 ? (t - r * 2) / (e.length - 1) : 0, c = a === i;
9
+ return e.map((e, t) => ({
10
+ x: r + t * s,
11
+ y: c ? r + o / 2 : r + o - (e - i) / (a - i) * o
12
+ }));
13
+ }
14
+ function n(e, t = !1) {
15
+ return e.length ? !t || e.length < 3 ? e.map((e, t) => `${t ? "L" : "M"}${e.x} ${e.y}`).join(" ") : e.map((t, n) => {
16
+ if (!n) return `M${t.x} ${t.y}`;
17
+ let r = e[n - 1] ?? t, i = (r.x + t.x) / 2;
18
+ return `C${i} ${r.y} ${i} ${t.y} ${t.x} ${t.y}`;
19
+ }).join(" ") : "";
20
+ }
21
+ //#endregion
22
+ export { e as formatNumber, n as sparklinePath, t as sparklinePoints };
@@ -0,0 +1 @@
1
+ function e(e,t,n=1){let r=Math.max(1,Math.floor(t)),i=Math.min(Math.max(1,Math.floor(e)),r);if(r<=n*2+5)return Array.from({length:r},(e,t)=>t+1);let a=r,o=Math.max(1,i-n),s=Math.min(a,i+n),c=[];if(o>2)c.push(1,null);else for(let e=1;e<o;e+=1)c.push(e);for(let e=o;e<=s;e+=1)c.push(e);if(s<a-1)c.push(null,a);else for(let e=s+1;e<=a;e+=1)c.push(e);return c}function t(e,t){let n=Number(e.trim());if(!(!Number.isInteger(n)||n<1||n>Math.max(1,t)))return n}exports.pagerItems=e,exports.parsePageInput=t;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 页码分页器的可见页计算(带省略号)。
3
+ * 返回的 `null` 表示省略号。
4
+ */
5
+ export declare function pagerItems(page: number, pageCount: number, siblings?: number): (number | null)[];
6
+ /** 跳页输入解析:只接受范围内的整数,其余返回 undefined。 */
7
+ export declare function parsePageInput(value: string, pageCount: number): number | undefined;
8
+ //# sourceMappingURL=pager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pager.d.ts","sourceRoot":"","sources":["../../src/lib/pager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAgB3F;AAED,uCAAuC;AACvC,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAInF"}
@@ -0,0 +1,18 @@
1
+ //#region src/lib/pager.ts
2
+ function e(e, t, n = 1) {
3
+ let r = Math.max(1, Math.floor(t)), i = Math.min(Math.max(1, Math.floor(e)), r);
4
+ if (r <= n * 2 + 5) return Array.from({ length: r }, (e, t) => t + 1);
5
+ let a = r, o = Math.max(1, i - n), s = Math.min(a, i + n), c = [];
6
+ if (o > 2) c.push(1, null);
7
+ else for (let e = 1; e < o; e += 1) c.push(e);
8
+ for (let e = o; e <= s; e += 1) c.push(e);
9
+ if (s < a - 1) c.push(null, a);
10
+ else for (let e = s + 1; e <= a; e += 1) c.push(e);
11
+ return c;
12
+ }
13
+ function t(e, t) {
14
+ let n = Number(e.trim());
15
+ if (!(!Number.isInteger(n) || n < 1 || n > Math.max(1, t))) return n;
16
+ }
17
+ //#endregion
18
+ export { e as pagerItems, t as parsePageInput };
@@ -0,0 +1 @@
1
+ var e=[{key:`length`,test:e=>e.length>=8},{key:`upper`,test:e=>/[A-Z]/.test(e)},{key:`lower`,test:e=>/[a-z]/.test(e)},{key:`digit`,test:e=>/\d/.test(e)},{key:`symbol`,test:e=>/[^\dA-Za-z]/.test(e)}];function t(t,n=e){let r=n.filter(e=>e.test(t)).map(e=>e.key),i=n.filter(e=>!e.test(t)).map(e=>e.key),a=r.length;return{matched:r,missing:i,score:a,level:t===``?`empty`:a>=5?`strong`:a>=3?`medium`:`weak`}}exports.passwordRules=e,exports.passwordStrength=t;
@@ -0,0 +1,14 @@
1
+ /** 密码强度规则与评分。 */
2
+ export type PasswordRule = {
3
+ key: string;
4
+ test: (value: string) => boolean;
5
+ };
6
+ export declare const passwordRules: PasswordRule[];
7
+ export type PasswordStrength = {
8
+ matched: string[];
9
+ missing: string[];
10
+ score: number;
11
+ level: 'empty' | 'weak' | 'medium' | 'strong';
12
+ };
13
+ export declare function passwordStrength(value: string, rules?: PasswordRule[]): PasswordStrength;
14
+ //# sourceMappingURL=password.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../src/lib/password.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,MAAM,MAAM,YAAY,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;CAAE,CAAA;AAE5E,eAAO,MAAM,aAAa,EAAE,YAAY,EAMvC,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAA;CAC9C,CAAA;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,YAAY,EAAkB,GACpC,gBAAgB,CAOlB"}
@@ -0,0 +1,34 @@
1
+ //#region src/lib/password.ts
2
+ var e = [
3
+ {
4
+ key: "length",
5
+ test: (e) => e.length >= 8
6
+ },
7
+ {
8
+ key: "upper",
9
+ test: (e) => /[A-Z]/.test(e)
10
+ },
11
+ {
12
+ key: "lower",
13
+ test: (e) => /[a-z]/.test(e)
14
+ },
15
+ {
16
+ key: "digit",
17
+ test: (e) => /\d/.test(e)
18
+ },
19
+ {
20
+ key: "symbol",
21
+ test: (e) => /[^\dA-Za-z]/.test(e)
22
+ }
23
+ ];
24
+ function t(t, n = e) {
25
+ let r = n.filter((e) => e.test(t)).map((e) => e.key), i = n.filter((e) => !e.test(t)).map((e) => e.key), a = r.length;
26
+ return {
27
+ matched: r,
28
+ missing: i,
29
+ score: a,
30
+ level: t === "" ? "empty" : a >= 5 ? "strong" : a >= 3 ? "medium" : "weak"
31
+ };
32
+ }
33
+ //#endregion
34
+ export { e as passwordRules, t as passwordStrength };
@@ -0,0 +1 @@
1
+ const e=require("./storage-key.cjs");function t(t){try{let n=JSON.parse(localStorage.getItem(e.storageKey(t))??`[]`);return Array.isArray(n)?n.filter(e=>typeof e==`object`&&!!e&&typeof e.name==`string`&&`value`in e):[]}catch{return[]}}function n(e,t,n=20){return[t,...e.filter(e=>e.name!==t.name)].slice(0,n)}function r(e,t,n){return!e.find(e=>e.name===t)||!n.trim()||e.some(e=>e.name===n)?e:e.map(e=>e.name===t?{...e,name:n}:e)}function i(e,t,n){let r=t.trim();return r?e.some(e=>e.name===r&&e.name!==n):!1}function a(e,t=72){if(e==null)return``;if(typeof e!=`object`)return String(e);if(Array.isArray(e))return e.map(e=>a(e,t)).join(` / `);let n=Object.entries(e).flatMap(([e,n])=>{if(n===``||n==null)return[];if(Array.isArray(n)){let t=n.filter(e=>e!==``&&e!=null);return t.length?[`${e}: ${t.join(`/`)}`]:[]}if(typeof n==`object`){let r=a(n,t);return r?[`${e}: ${r}`]:[]}return[`${e}: ${String(n)}`]}).join(` · `);return n.length>t?`${n.slice(0,t)}…`:n}function o(t,n){try{localStorage.setItem(e.storageKey(t),JSON.stringify(n))}catch{}}exports.describePresetValue=a,exports.presetNameTaken=i,exports.readPresets=t,exports.renamePreset=r,exports.upsertPreset=n,exports.writePresets=o;
@@ -0,0 +1,25 @@
1
+ export type Preset<T> = {
2
+ name: string;
3
+ value: T;
4
+ /** 保存时间(ISO),用于列表排序与展示。 */
5
+ savedAt?: string;
6
+ /** 业务自定义说明,展示在列表里帮助识别。 */
7
+ note?: string;
8
+ };
9
+ /** 读取本地保存的筛选预设;存储不可用时返回空列表。 */
10
+ export declare function readPresets<T>(key: string): Preset<T>[];
11
+ /** 覆盖已保存的快照(同名覆盖)。 */
12
+ export declare function upsertPreset<T>(presets: Preset<T>[], next: Preset<T>, limit?: number): Preset<T>[];
13
+ export declare function renamePreset<T>(presets: Preset<T>[], from: string, to: string): Preset<T>[];
14
+ /**
15
+ * 名称是否已被占用(保存 / 重命名前的唯一性校验)。
16
+ * `except` 用于重命名时忽略自己。
17
+ */
18
+ export declare function presetNameTaken<T>(presets: Preset<T>[], name: string, except?: string): boolean;
19
+ /**
20
+ * 通用快照摘要:把筛选条件拼成一行可读文案(预设的默认摘要用,调用方可以覆盖)。
21
+ * 空字符串、空数组会被跳过,避免出现 `关键字: — · 状态: · 日期:` 这种噪音。
22
+ */
23
+ export declare function describePresetValue(value: unknown, limit?: number): string;
24
+ export declare function writePresets<T>(key: string, presets: Preset<T>[]): void;
25
+ //# sourceMappingURL=presets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/lib/presets.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,CAAC,CAAA;IACR,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,+BAA+B;AAC/B,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAcvD;AAED,sBAAsB;AACtB,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,SAAK,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAG9F;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAI3F;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAI/F;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAK,GAAG,MAAM,CAkBtE;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,QAMhE"}
@@ -0,0 +1,48 @@
1
+ import { storageKey as e } from "./storage-key.js";
2
+ //#region src/lib/presets.ts
3
+ function t(t) {
4
+ try {
5
+ let n = JSON.parse(localStorage.getItem(e(t)) ?? "[]");
6
+ return Array.isArray(n) ? n.filter((e) => typeof e == "object" && !!e && typeof e.name == "string" && "value" in e) : [];
7
+ } catch {
8
+ return [];
9
+ }
10
+ }
11
+ function n(e, t, n = 20) {
12
+ return [t, ...e.filter((e) => e.name !== t.name)].slice(0, n);
13
+ }
14
+ function r(e, t, n) {
15
+ return !e.find((e) => e.name === t) || !n.trim() || e.some((e) => e.name === n) ? e : e.map((e) => e.name === t ? {
16
+ ...e,
17
+ name: n
18
+ } : e);
19
+ }
20
+ function i(e, t, n) {
21
+ let r = t.trim();
22
+ return r ? e.some((e) => e.name === r && e.name !== n) : !1;
23
+ }
24
+ function a(e, t = 72) {
25
+ if (e == null) return "";
26
+ if (typeof e != "object") return String(e);
27
+ if (Array.isArray(e)) return e.map((e) => a(e, t)).join(" / ");
28
+ let n = Object.entries(e).flatMap(([e, n]) => {
29
+ if (n === "" || n == null) return [];
30
+ if (Array.isArray(n)) {
31
+ let t = n.filter((e) => e !== "" && e != null);
32
+ return t.length ? [`${e}: ${t.join("/")}`] : [];
33
+ }
34
+ if (typeof n == "object") {
35
+ let r = a(n, t);
36
+ return r ? [`${e}: ${r}`] : [];
37
+ }
38
+ return [`${e}: ${String(n)}`];
39
+ }).join(" · ");
40
+ return n.length > t ? `${n.slice(0, t)}…` : n;
41
+ }
42
+ function o(t, n) {
43
+ try {
44
+ localStorage.setItem(e(t), JSON.stringify(n));
45
+ } catch {}
46
+ }
47
+ //#endregion
48
+ export { a as describePresetValue, i as presetNameTaken, t as readPresets, r as renamePreset, n as upsertPreset, o as writePresets };
@@ -0,0 +1 @@
1
+ var e=e=>String(e).padStart(2,`0`),t=t=>`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())}`;function n(e=new Date){let n=new Date(e),r=new Date(e);r.setDate(r.getDate()-6);let i=new Date(e);i.setDate(i.getDate()-29);let a=new Date(e.getFullYear(),e.getMonth(),1);return[{key:`today`,range:{from:t(e),to:t(e)}},{key:`week`,range:{from:t(r),to:t(e)}},{key:`month`,range:{from:t(i),to:t(e)}},{key:`monthStart`,range:{from:t(a),to:t(n)}}]}function r(e){return!!(e.from&&e.to&&e.to<e.from)}function i(e,t=1){let n=new Date(e.getFullYear(),e.getMonth(),1),r=(n.getDay()-t+7)%7,i=new Date(n);return i.setDate(n.getDate()-r),Array.from({length:42},(e,t)=>{let n=new Date(i);return n.setDate(i.getDate()+t),n})}function a(e,t){return e.from&&t===e.from?`start`:e.to&&t===e.to?`end`:e.from&&e.to&&t>e.from&&t<e.to?`in-range`:`outside`}function o(e,t=` ~ `){return!e.from&&!e.to?``:`${e.from??``}${t}${e.to??``}`}exports.dayKey=t,exports.invalidRange=r,exports.monthGrid=i,exports.rangeLabel=o,exports.rangeShortcuts=n,exports.rangeState=a;
@@ -0,0 +1,57 @@
1
+ //#region src/lib/range.ts
2
+ var e = (e) => String(e).padStart(2, "0"), t = (t) => `${t.getFullYear()}-${e(t.getMonth() + 1)}-${e(t.getDate())}`;
3
+ function n(e = /* @__PURE__ */ new Date()) {
4
+ let n = new Date(e), r = new Date(e);
5
+ r.setDate(r.getDate() - 6);
6
+ let i = new Date(e);
7
+ i.setDate(i.getDate() - 29);
8
+ let a = new Date(e.getFullYear(), e.getMonth(), 1);
9
+ return [
10
+ {
11
+ key: "today",
12
+ range: {
13
+ from: t(e),
14
+ to: t(e)
15
+ }
16
+ },
17
+ {
18
+ key: "week",
19
+ range: {
20
+ from: t(r),
21
+ to: t(e)
22
+ }
23
+ },
24
+ {
25
+ key: "month",
26
+ range: {
27
+ from: t(i),
28
+ to: t(e)
29
+ }
30
+ },
31
+ {
32
+ key: "monthStart",
33
+ range: {
34
+ from: t(a),
35
+ to: t(n)
36
+ }
37
+ }
38
+ ];
39
+ }
40
+ function r(e) {
41
+ return !!(e.from && e.to && e.to < e.from);
42
+ }
43
+ function i(e, t = 1) {
44
+ let n = new Date(e.getFullYear(), e.getMonth(), 1), r = (n.getDay() - t + 7) % 7, i = new Date(n);
45
+ return i.setDate(n.getDate() - r), Array.from({ length: 42 }, (e, t) => {
46
+ let n = new Date(i);
47
+ return n.setDate(i.getDate() + t), n;
48
+ });
49
+ }
50
+ function a(e, t) {
51
+ return e.from && t === e.from ? "start" : e.to && t === e.to ? "end" : e.from && e.to && t > e.from && t < e.to ? "in-range" : "outside";
52
+ }
53
+ function o(e, t = " ~ ") {
54
+ return !e.from && !e.to ? "" : `${e.from ?? ""}${t}${e.to ?? ""}`;
55
+ }
56
+ //#endregion
57
+ export { t as dayKey, r as invalidRange, i as monthGrid, o as rangeLabel, n as rangeShortcuts, a as rangeState };
@@ -0,0 +1 @@
1
+ function e(e){return`runlume.${e}`}exports.storageKey=e;
@@ -0,0 +1,2 @@
1
+ export declare function storageKey(key: string): string;
2
+ //# sourceMappingURL=storage-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-key.d.ts","sourceRoot":"","sources":["../../src/lib/storage-key.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C"}
@@ -0,0 +1,6 @@
1
+ //#region src/lib/storage-key.ts
2
+ function e(e) {
3
+ return `runlume.${e}`;
4
+ }
5
+ //#endregion
6
+ export { e as storageKey };
@@ -0,0 +1 @@
1
+ const e=require("./storage-key.cjs");function t(t){if(!t)return{sizes:{},order:[]};try{let n=JSON.parse(localStorage.getItem(e.storageKey(`table.${t}`))??`{}`);if(typeof n!=`object`||!n)return{sizes:{},order:[]};let r=n,i=`sizes`in r&&typeof r.sizes==`object`&&r.sizes!==null?r.sizes:r;return{sizes:Object.fromEntries(Object.entries(i).filter(([,e])=>typeof e==`number`&&Number.isFinite(e))),order:Array.isArray(r.order)?r.order.filter(e=>typeof e==`string`):[]}}catch{return{sizes:{},order:[]}}}function n(t,n){if(t)try{localStorage.setItem(e.storageKey(`table.${t}`),JSON.stringify(n))}catch{}}function r(e){return t(e).sizes}function i(e){return t(e).order}var a=new Map;function o(e,t){return a.set(e,t),()=>{a.delete(e)}}function s(t){if(t){a.get(t)?.();try{localStorage.removeItem(e.storageKey(`table.${t}`))}catch{}}}function c(e,t){n(e,{sizes:t,order:i(e)})}function l(e,t){n(e,{sizes:r(e),order:t})}exports.readColumnOrder=i,exports.readColumnSizes=r,exports.readTablePrefs=t,exports.registerTableReset=o,exports.resetTableLayout=s,exports.writeColumnOrder=l,exports.writeColumnSizes=c;
@@ -0,0 +1,17 @@
1
+ /** 表格列宽 / 列顺序偏好:只保存浏览器侧展示偏好,不进入业务数据。 */
2
+ export type ColumnSizes = Record<string, number>;
3
+ export type ColumnOrder = string[];
4
+ /** 一份完整的表格布局偏好:列宽 + 列顺序。 */
5
+ export type TableLayout = {
6
+ sizes: ColumnSizes;
7
+ order: ColumnOrder;
8
+ };
9
+ export declare function readTablePrefs(storageId: string | undefined): TableLayout;
10
+ export declare function readColumnSizes(storageId: string | undefined): ColumnSizes;
11
+ export declare function readColumnOrder(storageId: string | undefined): ColumnOrder;
12
+ export declare function registerTableReset(storageId: string, reset: () => void): () => void;
13
+ /** 恢复默认列宽与列顺序:清掉本地偏好并通知正在显示的表格复位。 */
14
+ export declare function resetTableLayout(storageId: string | undefined): void;
15
+ export declare function writeColumnSizes(storageId: string | undefined, sizes: ColumnSizes): void;
16
+ export declare function writeColumnOrder(storageId: string | undefined, order: ColumnOrder): void;
17
+ //# sourceMappingURL=table-prefs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-prefs.d.ts","sourceRoot":"","sources":["../../src/lib/table-prefs.ts"],"names":[],"mappings":"AAEA,wCAAwC;AACxC,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAChD,MAAM,MAAM,WAAW,GAAG,MAAM,EAAE,CAAA;AAElC,4BAA4B;AAC5B,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,CAAA;AAEpE,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,CAwBzE;AAWD,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,CAE1E;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,CAE1E;AAKD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,cAKtE;AAED,qCAAqC;AACrC,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,QAQ7D;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,WAAW,QAEjF;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,WAAW,QAEjF"}
@@ -0,0 +1,64 @@
1
+ import { storageKey as e } from "./storage-key.js";
2
+ //#region src/lib/table-prefs.ts
3
+ function t(t) {
4
+ if (!t) return {
5
+ sizes: {},
6
+ order: []
7
+ };
8
+ try {
9
+ let n = JSON.parse(localStorage.getItem(e(`table.${t}`)) ?? "{}");
10
+ if (typeof n != "object" || !n) return {
11
+ sizes: {},
12
+ order: []
13
+ };
14
+ let r = n, i = "sizes" in r && typeof r.sizes == "object" && r.sizes !== null ? r.sizes : r;
15
+ return {
16
+ sizes: Object.fromEntries(Object.entries(i).filter(([, e]) => typeof e == "number" && Number.isFinite(e))),
17
+ order: Array.isArray(r.order) ? r.order.filter((e) => typeof e == "string") : []
18
+ };
19
+ } catch {
20
+ return {
21
+ sizes: {},
22
+ order: []
23
+ };
24
+ }
25
+ }
26
+ function n(t, n) {
27
+ if (t) try {
28
+ localStorage.setItem(e(`table.${t}`), JSON.stringify(n));
29
+ } catch {}
30
+ }
31
+ function r(e) {
32
+ return t(e).sizes;
33
+ }
34
+ function i(e) {
35
+ return t(e).order;
36
+ }
37
+ var a = /* @__PURE__ */ new Map();
38
+ function o(e, t) {
39
+ return a.set(e, t), () => {
40
+ a.delete(e);
41
+ };
42
+ }
43
+ function s(t) {
44
+ if (t) {
45
+ a.get(t)?.();
46
+ try {
47
+ localStorage.removeItem(e(`table.${t}`));
48
+ } catch {}
49
+ }
50
+ }
51
+ function c(e, t) {
52
+ n(e, {
53
+ sizes: t,
54
+ order: i(e)
55
+ });
56
+ }
57
+ function l(e, t) {
58
+ n(e, {
59
+ sizes: r(e),
60
+ order: t
61
+ });
62
+ }
63
+ //#endregion
64
+ export { i as readColumnOrder, r as readColumnSizes, t as readTablePrefs, o as registerTableReset, s as resetTableLayout, l as writeColumnOrder, c as writeColumnSizes };
@@ -0,0 +1 @@
1
+ function e(e){return[...e].sort((e,t)=>(e.sortOrder??0)-(t.sortOrder??0)||e.id.localeCompare(t.id))}function t(t,n){let r=new Map(t.map(e=>[e.id,e])),i=new Map,a=[];for(let e of r.values())e.parentId&&e.parentId!==e.id&&r.has(e.parentId)?i.set(e.parentId,[...i.get(e.parentId)??[],e]):a.push(e);!a.length&&r.size&&a.push(...r.values());let o=[],s=new Set;function c(t,r){if(s.has(t.id))return;s.add(t.id);let a=i.get(t.id)??[];o.push({node:t,depth:r,hasChildren:a.length>0,expanded:n.has(t.id)}),n.has(t.id)&&e(a).forEach(e=>c(e,r+1))}return e(a).forEach(e=>c(e,0)),o}function n(t){let n=new Map,r=new Set(t.map(e=>e.id));for(let e of t)e.parentId&&e.parentId!==e.id&&r.has(e.parentId)&&n.set(e.parentId,[...n.get(e.parentId)??[],e]);for(let[t,r]of n)n.set(t,e(r));return n}function r(e,t){return(n(e).get(t)??[]).map(e=>e.id)}function i(e,t){let r=n(e),i=[],a=new Set;function o(e){a.has(e)||(a.add(e),i.push(e),(r.get(e)??[]).forEach(e=>o(e.id)))}return o(t),i}function a(e,t){let n=new Map(e.map(e=>[e.id,e])),r=[],i=new Set([t]),a=n.get(t)?.parentId;for(;a&&n.has(a)&&!i.has(a);)i.add(a),r.push(a),a=n.get(a)?.parentId;return r}function o(e,t,n){return t.has(n)?`checked`:i(e,n).slice(1).some(e=>t.has(e))?`indeterminate`:`unchecked`}function s(e,t,n,o){let s=new Set(t);for(let t of i(e,n))o?s.add(t):s.delete(t);for(let t of a(e,n)){let n=r(e,t);n.length&&n.every(e=>s.has(e))?s.add(t):s.delete(t)}return s}exports.ancestorIds=a,exports.checkState=o,exports.childIds=r,exports.flattenTree=t,exports.sortNodes=e,exports.subtreeIds=i,exports.toggleChecked=s;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * 层级数据的通用工具。节点用 `parentId` 表达父子关系,顺序按 `sortOrder`
3
+ * 再按 id 排列;`flattenTree` 只展开 `expanded` 中的节点,供列表树与表格树共用。
4
+ */
5
+ export type TreeNode<T> = {
6
+ id: string;
7
+ /** 根节点传 `null`;指向不存在的父节点时按根节点处理。 */
8
+ parentId?: string | null;
9
+ sortOrder?: number;
10
+ data: T;
11
+ };
12
+ export type FlatTreeRow<T> = {
13
+ node: TreeNode<T>;
14
+ depth: number;
15
+ hasChildren: boolean;
16
+ expanded: boolean;
17
+ };
18
+ /** 同级顺序:先按 `sortOrder`,再按 id,保证渲染与勾选级联顺序一致。 */
19
+ export declare function sortNodes<T>(items: TreeNode<T>[]): TreeNode<T>[];
20
+ export declare function flattenTree<T>(nodes: TreeNode<T>[], expanded: ReadonlySet<string>): FlatTreeRow<T>[];
21
+ /** 直接子节点 id,按同级顺序。 */
22
+ export declare function childIds<T>(nodes: TreeNode<T>[], id: string): string[];
23
+ /** 节点自身与全部后代 id,用于勾选父节点时级联子节点。 */
24
+ export declare function subtreeIds<T>(nodes: TreeNode<T>[], id: string): string[];
25
+ /** 从直接父节点到根的 id 顺序。 */
26
+ export declare function ancestorIds<T>(nodes: TreeNode<T>[], id: string): string[];
27
+ /**
28
+ * 勾选态:自身被勾选为 checked;自身未勾选但存在被勾选的后代(含孙子)为
29
+ * indeterminate。半选要按"全部后代"判断,只看向下一层会让祖父显示成未勾选。
30
+ */
31
+ export declare function checkState<T>(nodes: TreeNode<T>[], checked: ReadonlySet<string>, id: string): 'checked' | 'indeterminate' | 'unchecked';
32
+ /**
33
+ * 勾选某个节点后的完整勾选集合:向下级联子树,向上让"子节点全选"的父节点自动勾选,
34
+ * 否则取消父节点(半选由 `checkState` 推导)。
35
+ */
36
+ export declare function toggleChecked<T>(nodes: TreeNode<T>[], checked: ReadonlySet<string>, id: string, next: boolean): Set<string>;
37
+ //# sourceMappingURL=tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/lib/tree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,CAAC,CAAA;CACR,CAAA;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,+CAA+C;AAC/C,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,CAIhE;AAED,wBAAgB,WAAW,CAAC,CAAC,EAC3B,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,EACpB,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,GAC5B,WAAW,CAAC,CAAC,CAAC,EAAE,CAwBlB;AAaD,sBAAsB;AACtB,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAEtE;AAED,kCAAkC;AAClC,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAYxE;AAED,uBAAuB;AACvB,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAWzE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,EACpB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,EAC5B,EAAE,EAAE,MAAM,GACT,SAAS,GAAG,eAAe,GAAG,WAAW,CAI3C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,EACpB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,EAC5B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,OAAO,GACZ,GAAG,CAAC,MAAM,CAAC,CAYb"}