@pstdio/ui 0.43.0-nightly.20261012031318 → 0.43.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/{MermaidComponent-Ck8YZ-eC.js → MermaidComponent-X7N-8w2S.js} +2 -2
- package/dist/{MermaidComponent-Ck8YZ-eC.js.map → MermaidComponent-X7N-8w2S.js.map} +1 -1
- package/dist/chat-ui.d.ts +50 -50
- package/dist/chat-ui.js +2 -2
- package/dist/{collection-view-grouping-DmjlnPQj.js → collection-view-grouping-DnuJ1U4R.js} +24 -24
- package/dist/{collection-view-grouping-DmjlnPQj.js.map → collection-view-grouping-DnuJ1U4R.js.map} +1 -1
- package/dist/{collection-view-search-CW7B2YP1.js → collection-view-search-D_7Qvz7p.js} +22 -16
- package/dist/collection-view-search-D_7Qvz7p.js.map +1 -0
- package/dist/collection-view.d.ts +90 -3
- package/dist/collection-view.js +112 -2
- package/dist/collection-view.js.map +1 -0
- package/dist/{data-table-stats-row-B2MYAoHu.js → data-table-stats-row-C8CtvdDt.js} +2 -2
- package/dist/{data-table-stats-row-B2MYAoHu.js.map → data-table-stats-row-C8CtvdDt.js.map} +1 -1
- package/dist/data-table.d.ts +1 -2
- package/dist/data-table.js +14 -14
- package/dist/data-table.js.map +1 -1
- package/dist/{display-sort-control-CmFg-wcP.js → display-sort-control-n3L5WvkJ.js} +86 -86
- package/dist/{display-sort-control-CmFg-wcP.js.map → display-sort-control-n3L5WvkJ.js.map} +1 -1
- package/dist/{edit-mode-data-table-oEYutEBB.js → edit-mode-data-table-BclZ-pWe.js} +8 -8
- package/dist/{edit-mode-data-table-oEYutEBB.js.map → edit-mode-data-table-BclZ-pWe.js.map} +1 -1
- package/dist/{index-DNurZJZ3.d.ts → index-DjZsR4Ey.d.ts} +1 -1
- package/dist/index.d.ts +50 -50
- package/dist/kanban-renderer.d.ts +1 -1
- package/dist/kanban-renderer.js +79 -79
- package/dist/kanban-renderer.js.map +1 -1
- package/dist/{markdown-editor-oklbG4fY.js → markdown-editor-CN4qOKky.js} +4 -4
- package/dist/{markdown-editor-oklbG4fY.js.map → markdown-editor-CN4qOKky.js.map} +1 -1
- package/dist/{param-editor-Br3Qm5B4.js → param-editor-28dBRSV4.js} +2 -2
- package/dist/{param-editor-Br3Qm5B4.js.map → param-editor-28dBRSV4.js.map} +1 -1
- package/dist/{param-editor-field-Cg-C40tt.js → param-editor-field-GxhFb86w.js} +2 -2
- package/dist/{param-editor-field-Cg-C40tt.js.map → param-editor-field-GxhFb86w.js.map} +1 -1
- package/dist/param-editor.js +2 -2
- package/dist/{rich-text-DSZ23B46.js → rich-text-DOK4dDeb.js} +2 -2
- package/dist/{rich-text-DSZ23B46.js.map → rich-text-DOK4dDeb.js.map} +1 -1
- package/dist/rich-text.js +3 -3
- package/dist/{workspace-badge-BKtB805G.d.ts → workspace-badge-oFp29Gbe.d.ts} +1 -1
- package/package.json +2 -2
- package/dist/collection-view-search-CW7B2YP1.js.map +0 -1
- package/dist/index-DgwJmKVC.d.ts +0 -80
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as e } from "./markdown-editor-
|
|
1
|
+
import { g as e } from "./markdown-editor-CN4qOKky.js";
|
|
2
2
|
import { t } from "./mermaid-renderer-DybQ_2Cp.js";
|
|
3
3
|
import { Box as n, Button as r, Flex as i, Textarea as a } from "@chakra-ui/react";
|
|
4
4
|
import { c as o } from "react/compiler-runtime";
|
|
@@ -87,4 +87,4 @@ function m(m) {
|
|
|
87
87
|
//#endregion
|
|
88
88
|
export { m as default };
|
|
89
89
|
|
|
90
|
-
//# sourceMappingURL=MermaidComponent-
|
|
90
|
+
//# sourceMappingURL=MermaidComponent-X7N-8w2S.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MermaidComponent-
|
|
1
|
+
{"version":3,"file":"MermaidComponent-X7N-8w2S.js","names":["Box","Button","Flex","Textarea","useLexicalComposerContext","useLexicalEditable","$getNodeByKey","useEffect","useState","MermaidRenderer","$isMermaidNode","MermaidComponentProps","code","nodeKey","MermaidComponent","props","$","_c","editor","isEditable","isEditing","setIsEditing","draftCode","setDraftCode","previewCode","setPreviewCode","t0","t1","t2","update","node","setCode","commitCodeChanges","t3","cancelEditing","t4","undefined","t5","t6","t7","Symbol","for","event","target","value","t8","t9","_c","$isMermaidNode","MermaidComponent","$","c","props","editor","useLexicalComposerContext","isEditable","useLexicalEditable","isEditing","setIsEditing","useState","draftCode","setDraftCode","code","previewCode","setPreviewCode","t0","t1","useEffect","t2","nodeKey","node","$getNodeByKey","commitCodeChanges","t3","cancelEditing","t4","t5","MermaidRenderer","Button","t6","Flex","t7","event","t8","Box","Textarea","t9"],"sources":["../src/components/rich-text/shared/plugins/MermaidPlugin/MermaidComponent.tsx"],"sourcesContent":["import { Box, Button, Flex, Textarea } from \"@chakra-ui/react\";\nimport { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { useLexicalEditable } from \"@lexical/react/useLexicalEditable\";\nimport { $getNodeByKey } from \"lexical\";\nimport { useEffect, useState } from \"react\";\nimport { MermaidRenderer } from \"@/components/mermaid-renderer\";\nimport { $isMermaidNode } from \"./MermaidNode\";\n\ninterface MermaidComponentProps {\n code: string;\n nodeKey: string;\n}\n\nexport default function MermaidComponent(props: MermaidComponentProps) {\n const { code, nodeKey } = props;\n const [editor] = useLexicalComposerContext();\n const isEditable = useLexicalEditable();\n const [isEditing, setIsEditing] = useState(false);\n const [draftCode, setDraftCode] = useState(code);\n const [previewCode, setPreviewCode] = useState(code);\n\n useEffect(() => {\n setDraftCode(code);\n setPreviewCode(code);\n }, [code]);\n\n const commitCodeChanges = () => {\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if ($isMermaidNode(node)) {\n node.setCode(draftCode);\n }\n });\n\n setPreviewCode(draftCode);\n setIsEditing(false);\n };\n\n const cancelEditing = () => {\n setDraftCode(previewCode);\n setIsEditing(false);\n };\n\n if (!isEditing) {\n return (\n <MermaidRenderer\n key={previewCode}\n code={previewCode}\n isEditable={isEditable}\n onRequestEdit={isEditable ? () => setIsEditing(true) : undefined}\n />\n );\n }\n\n return (\n <Box borderWidth=\"1px\" borderColor=\"border.subtle\" borderRadius=\"md\" overflow=\"hidden\" width=\"100%\">\n <Flex justifyContent=\"flex-end\" alignItems=\"center\" gap=\"xs\" paddingX=\"sm\" paddingY=\"xs\" bg=\"bg.muted\">\n <Button size=\"xs\" variant=\"subtle\" onClick={cancelEditing}>\n Cancel\n </Button>\n <Button size=\"xs\" onClick={commitCodeChanges}>\n Preview\n </Button>\n </Flex>\n <Box padding=\"sm\" bg=\"bg.muted\">\n <Textarea\n value={draftCode}\n onChange={(event) => setDraftCode(event.target.value)}\n minHeight=\"180px\"\n resize=\"vertical\"\n fontFamily=\"mono\"\n fontSize=\"sm\"\n spellCheck={false}\n />\n </Box>\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;;AAaA,SAAec,EAAAC,GAAA;CAAA,IAAAC,IAAAC,EAAA,EAAA,GACb,EAAAL,SAAAC,eAA0BE,GAC1B,CAAAG,KAAiBd,EAA0B,GAC3Ce,IAAmBd,EAAmB,GACtC,CAAAe,GAAAC,KAAkCb,EAAS,EAAK,GAChD,CAAAc,GAAAC,KAAkCf,EAASI,CAAI,GAC/C,CAAAY,GAAAC,KAAsCjB,EAASI,CAAI,GAAEc,GAAAC;CAErDpB,AAFqDS,EAAA,OAAAJ,KAK5Cc,IAAAV,EAAA,IAAAW,IAAAX,EAAA,OAHCU,UAAA;EAERD,AADAF,EAAaX,CAAI,GACjBa,EAAeb,CAAI;CAAC,GACnBe,IAAA,CAACf,CAAI,GAACI,EAAA,KAAAJ,GAAAI,EAAA,KAAAU,GAAAV,EAAA,KAAAW,IAHTpB,EAAUmB,GAGPC,CAAM;CAAC,IAAAC;CAAA,AAAAZ,EAAA,OAAAM,KAAAN,EAAA,OAAAE,KAAAF,EAAA,OAAAH,KAEgBe,UAAA;EASxBP,AARAH,EAAMW,aAAQ;GACZ,I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ChangeEventHandler<HTMLDivElement, Element> | undefined;
|
|
15
15
|
onError?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
16
16
|
onSubmit?: import("react").SubmitEventHandler<HTMLDivElement> | undefined;
|
|
17
|
-
id?: string | undefined | undefined;
|
|
18
17
|
resource?: string | undefined | undefined;
|
|
18
|
+
id?: string | undefined | undefined;
|
|
19
19
|
children: ((context: import("use-stick-to-bottom").StickToBottomContext) => import("react").ReactNode) | import("react").ReactNode;
|
|
20
|
-
slot?: string | undefined | undefined;
|
|
21
|
-
style?: import("react").CSSProperties | undefined;
|
|
22
|
-
title?: string | undefined | undefined;
|
|
23
|
-
color?: string | undefined | undefined;
|
|
24
|
-
content?: string | undefined | undefined;
|
|
25
|
-
translate?: "yes" | "no" | undefined | undefined;
|
|
26
|
-
initial?: (import("use-stick-to-bottom").Animation | boolean) | undefined;
|
|
27
|
-
hidden?: boolean | undefined | undefined;
|
|
28
|
-
"aria-roledescription"?: string | undefined | undefined;
|
|
29
|
-
role?: import("react").AriaRole | undefined;
|
|
30
|
-
defaultChecked?: boolean | undefined | undefined;
|
|
31
|
-
defaultValue?: string | number | readonly string[] | undefined;
|
|
32
|
-
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
33
20
|
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
34
|
-
accessKey?: string | undefined | undefined;
|
|
35
|
-
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
36
|
-
autoFocus?: boolean | undefined | undefined;
|
|
37
21
|
className?: string | undefined | undefined;
|
|
38
|
-
|
|
39
|
-
contextMenu?: string | undefined | undefined;
|
|
40
|
-
dir?: string | undefined | undefined;
|
|
41
|
-
draggable?: (boolean | "true" | "false") | undefined;
|
|
42
|
-
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
22
|
+
color?: string | undefined | undefined;
|
|
43
23
|
lang?: string | undefined | undefined;
|
|
44
24
|
nonce?: string | undefined | undefined;
|
|
45
|
-
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
46
|
-
tabIndex?: number | undefined | undefined;
|
|
47
|
-
radioGroup?: string | undefined | undefined;
|
|
48
|
-
about?: string | undefined | undefined;
|
|
49
|
-
datatype?: string | undefined | undefined;
|
|
50
|
-
inlist?: any;
|
|
51
|
-
prefix?: string | undefined | undefined;
|
|
52
|
-
property?: string | undefined | undefined;
|
|
53
|
-
rel?: string | undefined | undefined;
|
|
54
|
-
rev?: string | undefined | undefined;
|
|
55
|
-
typeof?: string | undefined | undefined;
|
|
56
|
-
vocab?: string | undefined | undefined;
|
|
57
|
-
autoCorrect?: string | undefined | undefined;
|
|
58
|
-
autoSave?: string | undefined | undefined;
|
|
59
|
-
itemProp?: string | undefined | undefined;
|
|
60
|
-
itemScope?: boolean | undefined | undefined;
|
|
61
|
-
itemType?: string | undefined | undefined;
|
|
62
|
-
itemID?: string | undefined | undefined;
|
|
63
|
-
itemRef?: string | undefined | undefined;
|
|
64
|
-
results?: number | undefined | undefined;
|
|
65
|
-
security?: string | undefined | undefined;
|
|
66
|
-
unselectable?: "on" | "off" | undefined | undefined;
|
|
67
|
-
popover?: "" | "auto" | "manual" | "hint" | undefined | undefined;
|
|
68
|
-
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
69
|
-
popoverTarget?: string | undefined | undefined;
|
|
70
|
-
inert?: boolean | undefined | undefined;
|
|
71
|
-
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
72
|
-
exportparts?: string | undefined | undefined;
|
|
73
25
|
part?: string | undefined | undefined;
|
|
26
|
+
slot?: string | undefined | undefined;
|
|
27
|
+
style?: import("react").CSSProperties | undefined;
|
|
28
|
+
role?: import("react").AriaRole | undefined;
|
|
29
|
+
tabIndex?: number | undefined | undefined;
|
|
74
30
|
"aria-activedescendant"?: string | undefined | undefined;
|
|
75
31
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
76
32
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
|
|
@@ -112,6 +68,7 @@ export declare const ChatPrimitives: {
|
|
|
112
68
|
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
113
69
|
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined | undefined;
|
|
114
70
|
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
71
|
+
"aria-roledescription"?: string | undefined | undefined;
|
|
115
72
|
"aria-rowcount"?: number | undefined | undefined;
|
|
116
73
|
"aria-rowindex"?: number | undefined | undefined;
|
|
117
74
|
"aria-rowindextext"?: string | undefined | undefined;
|
|
@@ -291,6 +248,49 @@ export declare const ChatPrimitives: {
|
|
|
291
248
|
onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
292
249
|
onTransitionStart?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
293
250
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
251
|
+
title?: string | undefined | undefined;
|
|
252
|
+
content?: string | undefined | undefined;
|
|
253
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
254
|
+
initial?: (import("use-stick-to-bottom").Animation | boolean) | undefined;
|
|
255
|
+
hidden?: boolean | undefined | undefined;
|
|
256
|
+
defaultChecked?: boolean | undefined | undefined;
|
|
257
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
258
|
+
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
259
|
+
accessKey?: string | undefined | undefined;
|
|
260
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
261
|
+
autoFocus?: boolean | undefined | undefined;
|
|
262
|
+
contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
|
|
263
|
+
contextMenu?: string | undefined | undefined;
|
|
264
|
+
dir?: string | undefined | undefined;
|
|
265
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
266
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
267
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
268
|
+
radioGroup?: string | undefined | undefined;
|
|
269
|
+
about?: string | undefined | undefined;
|
|
270
|
+
datatype?: string | undefined | undefined;
|
|
271
|
+
inlist?: any;
|
|
272
|
+
prefix?: string | undefined | undefined;
|
|
273
|
+
property?: string | undefined | undefined;
|
|
274
|
+
rel?: string | undefined | undefined;
|
|
275
|
+
rev?: string | undefined | undefined;
|
|
276
|
+
typeof?: string | undefined | undefined;
|
|
277
|
+
vocab?: string | undefined | undefined;
|
|
278
|
+
autoCorrect?: string | undefined | undefined;
|
|
279
|
+
autoSave?: string | undefined | undefined;
|
|
280
|
+
itemProp?: string | undefined | undefined;
|
|
281
|
+
itemScope?: boolean | undefined | undefined;
|
|
282
|
+
itemType?: string | undefined | undefined;
|
|
283
|
+
itemID?: string | undefined | undefined;
|
|
284
|
+
itemRef?: string | undefined | undefined;
|
|
285
|
+
results?: number | undefined | undefined;
|
|
286
|
+
security?: string | undefined | undefined;
|
|
287
|
+
unselectable?: "on" | "off" | undefined | undefined;
|
|
288
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined | undefined;
|
|
289
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
290
|
+
popoverTarget?: string | undefined | undefined;
|
|
291
|
+
inert?: boolean | undefined | undefined;
|
|
292
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
293
|
+
exportparts?: string | undefined | undefined;
|
|
294
294
|
damping?: number | undefined;
|
|
295
295
|
stiffness?: number | undefined;
|
|
296
296
|
mass?: number | undefined;
|
package/dist/chat-ui.js
CHANGED
|
@@ -8,8 +8,8 @@ import { t as c } from "./empty-state-3mVV_pV-.js";
|
|
|
8
8
|
import { t as l } from "./icon-options-Tt6Wzhtv.js";
|
|
9
9
|
import { n as u, t as d } from "./radio-CiFrDN6O.js";
|
|
10
10
|
import { n as f, t as p } from "./queued-follow-up-Bj_vtMgd.js";
|
|
11
|
-
import { A as m, C as h, E as g, M as _, S as v, T as y, j as b, k as x, w as S } from "./markdown-editor-
|
|
12
|
-
import { c as C, l as w, o as T, s as E } from "./rich-text-
|
|
11
|
+
import { A as m, C as h, E as g, M as _, S as v, T as y, j as b, k as x, w as S } from "./markdown-editor-CN4qOKky.js";
|
|
12
|
+
import { c as C, l as w, o as T, s as E } from "./rich-text-DOK4dDeb.js";
|
|
13
13
|
import { t as D } from "./diff-bubble-DewUd_2w.js";
|
|
14
14
|
import { AbsoluteCenter as O, Avatar as k, Box as A, Button as j, Card as M, Code as N, Field as P, Flex as F, HStack as I, Icon as L, IconButton as R, Image as z, Input as B, Kbd as V, Link as H, Menu as U, Popover as ee, Portal as te, Skeleton as ne, Span as re, Spinner as W, Stack as G, Tag as ie, Text as K, Textarea as ae, Timeline as oe, Tooltip as q, chakra as se, createSlotRecipeContext as ce, defineSlotRecipe as le, useRecipe as ue, useSlotRecipe as de } from "@chakra-ui/react";
|
|
15
15
|
import { c as J } from "react/compiler-runtime";
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as e, E as t, O as n, S as r, b as i, t as a, w as o, y as s } from "./collection-view-search-D_7Qvz7p.js";
|
|
2
2
|
import { Box as c } from "@chakra-ui/react";
|
|
3
3
|
import { jsx as l } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/collection-view/highlighted-text.tsx
|
|
5
5
|
var u = (e) => {
|
|
6
|
-
let { text: t, query: n } = e, r =
|
|
6
|
+
let { text: t, query: n } = e, r = a(t, n);
|
|
7
7
|
if (r.length === 0) return t;
|
|
8
|
-
let i = [],
|
|
9
|
-
for (let [e, n] of r) e >
|
|
10
|
-
text: t.slice(
|
|
8
|
+
let i = [], o = 0;
|
|
9
|
+
for (let [e, n] of r) e > o && i.push({
|
|
10
|
+
text: t.slice(o, e),
|
|
11
11
|
match: !1,
|
|
12
|
-
start:
|
|
12
|
+
start: o
|
|
13
13
|
}), i.push({
|
|
14
14
|
text: t.slice(e, n),
|
|
15
15
|
match: !0,
|
|
16
16
|
start: e
|
|
17
|
-
}),
|
|
18
|
-
return
|
|
19
|
-
text: t.slice(
|
|
17
|
+
}), o = n;
|
|
18
|
+
return o < t.length && i.push({
|
|
19
|
+
text: t.slice(o),
|
|
20
20
|
match: !1,
|
|
21
|
-
start:
|
|
21
|
+
start: o
|
|
22
22
|
}), i.map((e) => e.match ? /* @__PURE__ */ l(c, {
|
|
23
23
|
as: "mark",
|
|
24
24
|
bg: "bg.warning",
|
|
@@ -26,34 +26,34 @@ var u = (e) => {
|
|
|
26
26
|
borderRadius: "2xs",
|
|
27
27
|
children: e.text
|
|
28
28
|
}, e.start) : e.text);
|
|
29
|
-
}, d = (
|
|
29
|
+
}, d = (e, t, r) => {
|
|
30
30
|
if (r.kind !== "enum" && r.kind !== "enum-multi") return 0;
|
|
31
|
-
let i =
|
|
31
|
+
let i = n(r), a = (e) => {
|
|
32
32
|
if (e === void 0) return i.length;
|
|
33
33
|
let t = i.findIndex((t) => t.value === e);
|
|
34
34
|
return t === -1 ? i.length + 1 : t;
|
|
35
35
|
};
|
|
36
|
-
return a(
|
|
37
|
-
}, f = (e) =>
|
|
38
|
-
let a = t
|
|
36
|
+
return a(e) - a(t);
|
|
37
|
+
}, f = (e) => o(e)?.getTime() ?? NaN, p = (t, n, i) => {
|
|
38
|
+
let a = e(t, i), o = e(n, i);
|
|
39
39
|
if (i.compare) return i.compare(a, o);
|
|
40
40
|
if (i.type.kind === "date") return f(a) - f(o);
|
|
41
41
|
if (i.type.kind === "number") return Number(a) - Number(o);
|
|
42
42
|
if (i.type.kind === "enum") {
|
|
43
|
-
let [
|
|
44
|
-
return d(
|
|
43
|
+
let [e] = r(t, i), [a] = r(n, i);
|
|
44
|
+
return d(e, a, i.type);
|
|
45
45
|
}
|
|
46
46
|
return String(a).localeCompare(String(o), void 0, {
|
|
47
47
|
numeric: !0,
|
|
48
48
|
sensitivity: "base"
|
|
49
49
|
});
|
|
50
|
-
}, m = (
|
|
51
|
-
if (n.type.kind === "date") return
|
|
52
|
-
let [i] = r(
|
|
50
|
+
}, m = (t, n) => {
|
|
51
|
+
if (n.type.kind === "date") return o(e(t, n)) === void 0;
|
|
52
|
+
let [i] = r(t, n);
|
|
53
53
|
return i === void 0 || n.type.kind === "number" && !Number.isFinite(Number(i));
|
|
54
54
|
}, h = (e, t) => {
|
|
55
55
|
let n = i(t, e.attributeId);
|
|
56
|
-
if (!n || !
|
|
56
|
+
if (!n || !s(n)) return;
|
|
57
57
|
let r = e.direction === "asc" ? 1 : -1;
|
|
58
58
|
return (e, t) => {
|
|
59
59
|
let i = m(e, n), a = m(t, n);
|
|
@@ -62,8 +62,8 @@ var u = (e) => {
|
|
|
62
62
|
}, g = (e, t, n) => {
|
|
63
63
|
let r = t[0], i = r ? h(r, n) : void 0;
|
|
64
64
|
return i ? [...e].sort(i) : e;
|
|
65
|
-
}, _ = (e) => `No ${e.label.toLowerCase()}`, v = (e,
|
|
66
|
-
if (
|
|
65
|
+
}, _ = (e) => `No ${e.label.toLowerCase()}`, v = (e, n) => e === _(n) ? e : n.type.kind === "enum" || n.type.kind === "enum-multi" ? t(n.type, e) : e, y = (e, t) => {
|
|
66
|
+
if (e !== void 0) return t.type.kind !== "enum" && t.type.kind !== "enum-multi" || n(t.type).some((t) => t.value === e) ? e : void 0;
|
|
67
67
|
}, b = (e, t) => {
|
|
68
68
|
let [n] = r(e, t);
|
|
69
69
|
return y(n, t) ?? _(t);
|
|
@@ -87,4 +87,4 @@ var u = (e) => {
|
|
|
87
87
|
//#endregion
|
|
88
88
|
export { u as a, g as i, b as n, S as r, _ as t };
|
|
89
89
|
|
|
90
|
-
//# sourceMappingURL=collection-view-grouping-
|
|
90
|
+
//# sourceMappingURL=collection-view-grouping-DnuJ1U4R.js.map
|
package/dist/{collection-view-grouping-DmjlnPQj.js.map → collection-view-grouping-DnuJ1U4R.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-view-grouping-DmjlnPQj.js","names":["Box","findSearchRanges","HighlightedTextProps","text","query","HighlightedText","props","ranges","length","parts","Array","match","start","cursor","end","push","slice","map","part","ViewSort","getEnumOptions","AttributeDescriptor","AttributeType","KanbanRendererRow","canSortField","findField","getAttributeStringValues","getAttributeValue","parseViewDate","compareEnumValues","left","right","type","kind","options","toIndex","value","undefined","length","index","findIndex","option","toTime","getTime","Number","NaN","compareFieldValues","a","b","field","compare","leftValue","rightValue","String","localeCompare","numeric","sensitivity","isEmpty","row","isFinite","compileSort","sort","fields","attributeId","direction","leftEmpty","rightEmpty","sortRowsByView","rows","TRow","sorts","enumOptionLabel","getEnumOptions","AttributeDescriptor","KanbanRendererRow","getAttributeStringValues","compareEnumValues","CollectionRowGroup","key","label","rows","TRow","emptyGroupKey","field","toLowerCase","groupLabel","type","kind","resolveGroupValue","value","undefined","some","option","groupKey","row","compareGroupKeys","left","right","empty","Number","ordered","localeCompare","numeric","groupRowsByField","knownKeys","groups","Map","map","group","get","push","set","entries","sort","groupRows","getEnumOptions","getAttributeValue","enumOptionLabel","getAttributeStringValues","findField","canSortField","findSearchRanges","parseViewDate","HighlightedText","props","ranges","text","query","parts","cursor","start","end","part","Box","compareEnumValues","type","options","toIndex","value","index","option","left","right","toTime","compareFieldValues","a","field","b","leftValue","rightValue","isEmpty","row","compileSort","fields","sort","direction","leftEmpty","rightEmpty","sortRowsByView","sorts","compare","rows","emptyGroupKey","groupLabel","key","resolveGroupValue","groupKey","compareGroupKeys","empty","ordered","groupRowsByField","groups","knownKeys","group","groupRows"],"sources":["../src/components/collection-view/highlighted-text.tsx","../src/components/collection-view/collection-view-sort.ts","../src/components/collection-view/collection-view-grouping.ts"],"sourcesContent":["import { Box } from \"@chakra-ui/react\";\nimport { findSearchRanges } from \"./collection-view-search\";\n\nexport interface HighlightedTextProps {\n text: string;\n /** The view's search text. Every match in `text` is marked. */\n query: string;\n}\n\nexport const HighlightedText = (props: HighlightedTextProps) => {\n const { text, query } = props;\n const ranges = findSearchRanges(text, query);\n if (ranges.length === 0) return text;\n const parts: Array<{ text: string; match: boolean; start: number }> = [];\n let cursor = 0;\n for (const [start, end] of ranges) {\n if (start > cursor) parts.push({ text: text.slice(cursor, start), match: false, start: cursor });\n parts.push({ text: text.slice(start, end), match: true, start });\n cursor = end;\n }\n if (cursor < text.length) parts.push({ text: text.slice(cursor), match: false, start: cursor });\n\n return parts.map((part) =>\n part.match ? (\n <Box as=\"mark\" key={part.start} bg=\"bg.warning\" color=\"inherit\" borderRadius=\"2xs\">\n {part.text}\n </Box>\n ) : (\n part.text\n ),\n );\n};\n","import type { ViewSort } from \"@pstdio/sdk/extensions\";\nimport { getEnumOptions } from \"../kanban-renderer/kanban-renderer-enum-helpers\";\nimport type { AttributeDescriptor, AttributeType, KanbanRendererRow } from \"../kanban-renderer/types\";\nimport {\n canSortField,\n findField,\n getAttributeStringValues,\n getAttributeValue,\n parseViewDate,\n} from \"./collection-view-fields\";\n\n/** Option order: declared options first, unknown values after them, missing values last. */\nexport const compareEnumValues = (left: string | undefined, right: string | undefined, type: AttributeType) => {\n if (type.kind !== \"enum\" && type.kind !== \"enum-multi\") return 0;\n const options = getEnumOptions(type);\n const toIndex = (value: string | undefined) => {\n if (value === undefined) return options.length;\n const index = options.findIndex((option) => option.value === value);\n return index === -1 ? options.length + 1 : index;\n };\n return toIndex(left) - toIndex(right);\n};\n\nconst toTime = (value: unknown) => parseViewDate(value)?.getTime() ?? Number.NaN;\n\nconst compareFieldValues = (a: KanbanRendererRow, b: KanbanRendererRow, field: AttributeDescriptor) => {\n const left = getAttributeValue(a, field);\n const right = getAttributeValue(b, field);\n if (field.compare) return field.compare(left, right);\n if (field.type.kind === \"date\") return toTime(left) - toTime(right);\n if (field.type.kind === \"number\") return Number(left) - Number(right);\n if (field.type.kind === \"enum\") {\n const [leftValue] = getAttributeStringValues(a, field);\n const [rightValue] = getAttributeStringValues(b, field);\n return compareEnumValues(leftValue, rightValue, field.type);\n }\n return String(left).localeCompare(String(right), undefined, { numeric: true, sensitivity: \"base\" });\n};\n\nconst isEmpty = (row: KanbanRendererRow, field: AttributeDescriptor) => {\n if (field.type.kind === \"date\") return parseViewDate(getAttributeValue(row, field)) === undefined;\n const [value] = getAttributeStringValues(row, field);\n if (value === undefined) return true;\n if (field.type.kind === \"number\") return !Number.isFinite(Number(value));\n return false;\n};\n\nconst compileSort = (sort: ViewSort, fields: AttributeDescriptor[]) => {\n const field = findField(fields, sort.attributeId);\n if (!field || !canSortField(field)) return undefined;\n const direction = sort.direction === \"asc\" ? 1 : -1;\n // Rows without a value stay last in both directions.\n return (a: KanbanRendererRow, b: KanbanRendererRow) => {\n const leftEmpty = isEmpty(a, field);\n const rightEmpty = isEmpty(b, field);\n if (leftEmpty || rightEmpty) return Number(leftEmpty) - Number(rightEmpty);\n return direction * compareFieldValues(a, b, field);\n };\n};\n\n/** One field decides the order; ties keep their incoming order. */\nexport const sortRowsByView = <TRow extends KanbanRendererRow>(\n rows: TRow[],\n sorts: ViewSort[],\n fields: AttributeDescriptor[],\n) => {\n const sort = sorts[0];\n const compare = sort ? compileSort(sort, fields) : undefined;\n return compare ? [...rows].sort(compare) : rows;\n};\n","import { enumOptionLabel, getEnumOptions } from \"../kanban-renderer/kanban-renderer-enum-helpers\";\nimport type { AttributeDescriptor, KanbanRendererRow } from \"../kanban-renderer/types\";\nimport { getAttributeStringValues } from \"./collection-view-fields\";\nimport { compareEnumValues } from \"./collection-view-sort\";\n\nexport interface CollectionRowGroup<TRow extends KanbanRendererRow = KanbanRendererRow> {\n key: string;\n label: string;\n rows: TRow[];\n}\n\nexport const emptyGroupKey = (field: AttributeDescriptor) => `No ${field.label.toLowerCase()}`;\n\nexport const groupLabel = (key: string, field: AttributeDescriptor) => {\n if (key === emptyGroupKey(field)) return key;\n if (field.type.kind === \"enum\" || field.type.kind === \"enum-multi\") return enumOptionLabel(field.type, key);\n return key;\n};\n\n// Drops values that are no longer a declared option, so rows pointing at a removed\n// status join the \"No <field>\" group instead of an orphaned group for the deleted value.\nconst resolveGroupValue = (value: string | undefined, field: AttributeDescriptor) => {\n if (value === undefined) return undefined;\n if (field.type.kind !== \"enum\" && field.type.kind !== \"enum-multi\") return value;\n return getEnumOptions(field.type).some((option) => option.value === value) ? value : undefined;\n};\n\n/** One group per row. A multi-value field is not offered for grouping, so its first value decides. */\nexport const groupKey = (row: KanbanRendererRow, field: AttributeDescriptor) => {\n const [value] = getAttributeStringValues(row, field);\n return resolveGroupValue(value, field) ?? emptyGroupKey(field);\n};\n\n/** Option fields follow option order, other fields go A to Z, and the \"No <field>\" group comes last. */\nexport const compareGroupKeys = (left: string, right: string, field: AttributeDescriptor) => {\n const empty = emptyGroupKey(field);\n if (left === empty || right === empty) return Number(left === empty) - Number(right === empty);\n const ordered = compareEnumValues(left, right, field.type);\n if (ordered !== 0) return ordered;\n return left.localeCompare(right, undefined, { numeric: true });\n};\n\nexport const groupRowsByField = <TRow extends KanbanRendererRow>(\n rows: TRow[],\n field: AttributeDescriptor,\n knownKeys: string[] = [],\n): CollectionRowGroup<TRow>[] => {\n const groups = new Map<string, TRow[]>(knownKeys.map((key) => [key, []]));\n for (const row of rows) {\n const key = groupKey(row, field);\n const group = groups.get(key);\n if (group) group.push(row);\n else groups.set(key, [row]);\n }\n return [...groups.entries()]\n .sort(([left], [right]) => compareGroupKeys(left, right, field))\n .map(([key, groupRows]) => ({ key, label: groupLabel(key, field), rows: groupRows }));\n};\n"],"mappings":";;;;AASA,IAAaK,KAAmBC,MAAgC;CAC9D,IAAM,EAAEH,SAAMC,aAAUE,GAClBC,IAASN,EAAiBE,GAAMC,CAAK;CAC3C,IAAIG,EAAOC,WAAW,GAAG,OAAOL;CAChC,IAAMM,IAAgE,CAAA,GAClEI,IAAS;C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Me,EAASC,GAAKX,CAAK,GACzByB,IAAQH,EAAOI,IAAI/B,CAAG;EAC5B,AAAI8B,IAAOA,EAAME,KAAKhB,CAAG,IACpBW,EAAOM,IAAIjC,GAAK,CAACgB,CAAG,CAAC;CAC5B;CACA,OAAO,CAAC,GAAGW,EAAOO,QAAQ,CAAC,CAAC,CACzBC,MAAM,CAACjB,IAAO,CAACC,OAAWF,EAAiBC,GAAMC,GAAOd,CAAK,CAAC,CAAC,CAC/DwB,KAAK,CAAC7B,GAAKoC,QAAgB;EAAEpC;EAAKC,OAAOM,EAAWP,GAAKK,CAAK;EAAGH,MAAMkC;CAAU,EAAE;AACxF"}
|
|
1
|
+
{"version":3,"file":"collection-view-grouping-DnuJ1U4R.js","names":["Box","findSearchRanges","HighlightedTextProps","text","query","HighlightedText","props","ranges","length","parts","Array","match","start","cursor","end","push","slice","map","part","ViewSort","getEnumOptions","AttributeDescriptor","AttributeType","KanbanRendererRow","canSortField","findField","getAttributeStringValues","getAttributeValue","parseViewDate","compareEnumValues","left","right","type","kind","options","toIndex","value","undefined","length","index","findIndex","option","toTime","getTime","Number","NaN","compareFieldValues","a","b","field","compare","leftValue","rightValue","String","localeCompare","numeric","sensitivity","isEmpty","row","isFinite","compileSort","sort","fields","attributeId","direction","leftEmpty","rightEmpty","sortRowsByView","rows","TRow","sorts","enumOptionLabel","getEnumOptions","AttributeDescriptor","KanbanRendererRow","getAttributeStringValues","compareEnumValues","CollectionRowGroup","key","label","rows","TRow","emptyGroupKey","field","toLowerCase","groupLabel","type","kind","resolveGroupValue","value","undefined","some","option","groupKey","row","compareGroupKeys","left","right","empty","Number","ordered","localeCompare","numeric","groupRowsByField","knownKeys","groups","Map","map","group","get","push","set","entries","sort","groupRows","getAttributeValue","enumOptionLabel","getEnumOptions","getAttributeStringValues","findField","findSearchRanges","parseViewDate","canSortField","HighlightedText","props","ranges","text","query","parts","cursor","start","end","part","Box","compareEnumValues","type","options","toIndex","value","index","option","left","right","toTime","compareFieldValues","a","field","b","leftValue","rightValue","isEmpty","row","compileSort","fields","sort","direction","leftEmpty","rightEmpty","sortRowsByView","sorts","compare","rows","emptyGroupKey","groupLabel","key","resolveGroupValue","groupKey","compareGroupKeys","empty","ordered","groupRowsByField","groups","knownKeys","group","groupRows"],"sources":["../src/components/collection-view/highlighted-text.tsx","../src/components/collection-view/collection-view-sort.ts","../src/components/collection-view/collection-view-grouping.ts"],"sourcesContent":["import { Box } from \"@chakra-ui/react\";\nimport { findSearchRanges } from \"./collection-view-search\";\n\nexport interface HighlightedTextProps {\n text: string;\n /** The view's search text. Every match in `text` is marked. */\n query: string;\n}\n\nexport const HighlightedText = (props: HighlightedTextProps) => {\n const { text, query } = props;\n const ranges = findSearchRanges(text, query);\n if (ranges.length === 0) return text;\n const parts: Array<{ text: string; match: boolean; start: number }> = [];\n let cursor = 0;\n for (const [start, end] of ranges) {\n if (start > cursor) parts.push({ text: text.slice(cursor, start), match: false, start: cursor });\n parts.push({ text: text.slice(start, end), match: true, start });\n cursor = end;\n }\n if (cursor < text.length) parts.push({ text: text.slice(cursor), match: false, start: cursor });\n\n return parts.map((part) =>\n part.match ? (\n <Box as=\"mark\" key={part.start} bg=\"bg.warning\" color=\"inherit\" borderRadius=\"2xs\">\n {part.text}\n </Box>\n ) : (\n part.text\n ),\n );\n};\n","import type { ViewSort } from \"@pstdio/sdk/extensions\";\nimport { getEnumOptions } from \"../kanban-renderer/kanban-renderer-enum-helpers\";\nimport type { AttributeDescriptor, AttributeType, KanbanRendererRow } from \"../kanban-renderer/types\";\nimport {\n canSortField,\n findField,\n getAttributeStringValues,\n getAttributeValue,\n parseViewDate,\n} from \"./collection-view-fields\";\n\n/** Option order: declared options first, unknown values after them, missing values last. */\nexport const compareEnumValues = (left: string | undefined, right: string | undefined, type: AttributeType) => {\n if (type.kind !== \"enum\" && type.kind !== \"enum-multi\") return 0;\n const options = getEnumOptions(type);\n const toIndex = (value: string | undefined) => {\n if (value === undefined) return options.length;\n const index = options.findIndex((option) => option.value === value);\n return index === -1 ? options.length + 1 : index;\n };\n return toIndex(left) - toIndex(right);\n};\n\nconst toTime = (value: unknown) => parseViewDate(value)?.getTime() ?? Number.NaN;\n\nconst compareFieldValues = (a: KanbanRendererRow, b: KanbanRendererRow, field: AttributeDescriptor) => {\n const left = getAttributeValue(a, field);\n const right = getAttributeValue(b, field);\n if (field.compare) return field.compare(left, right);\n if (field.type.kind === \"date\") return toTime(left) - toTime(right);\n if (field.type.kind === \"number\") return Number(left) - Number(right);\n if (field.type.kind === \"enum\") {\n const [leftValue] = getAttributeStringValues(a, field);\n const [rightValue] = getAttributeStringValues(b, field);\n return compareEnumValues(leftValue, rightValue, field.type);\n }\n return String(left).localeCompare(String(right), undefined, { numeric: true, sensitivity: \"base\" });\n};\n\nconst isEmpty = (row: KanbanRendererRow, field: AttributeDescriptor) => {\n if (field.type.kind === \"date\") return parseViewDate(getAttributeValue(row, field)) === undefined;\n const [value] = getAttributeStringValues(row, field);\n if (value === undefined) return true;\n if (field.type.kind === \"number\") return !Number.isFinite(Number(value));\n return false;\n};\n\nconst compileSort = (sort: ViewSort, fields: AttributeDescriptor[]) => {\n const field = findField(fields, sort.attributeId);\n if (!field || !canSortField(field)) return undefined;\n const direction = sort.direction === \"asc\" ? 1 : -1;\n // Rows without a value stay last in both directions.\n return (a: KanbanRendererRow, b: KanbanRendererRow) => {\n const leftEmpty = isEmpty(a, field);\n const rightEmpty = isEmpty(b, field);\n if (leftEmpty || rightEmpty) return Number(leftEmpty) - Number(rightEmpty);\n return direction * compareFieldValues(a, b, field);\n };\n};\n\n/** One field decides the order; ties keep their incoming order. */\nexport const sortRowsByView = <TRow extends KanbanRendererRow>(\n rows: TRow[],\n sorts: ViewSort[],\n fields: AttributeDescriptor[],\n) => {\n const sort = sorts[0];\n const compare = sort ? compileSort(sort, fields) : undefined;\n return compare ? [...rows].sort(compare) : rows;\n};\n","import { enumOptionLabel, getEnumOptions } from \"../kanban-renderer/kanban-renderer-enum-helpers\";\nimport type { AttributeDescriptor, KanbanRendererRow } from \"../kanban-renderer/types\";\nimport { getAttributeStringValues } from \"./collection-view-fields\";\nimport { compareEnumValues } from \"./collection-view-sort\";\n\nexport interface CollectionRowGroup<TRow extends KanbanRendererRow = KanbanRendererRow> {\n key: string;\n label: string;\n rows: TRow[];\n}\n\nexport const emptyGroupKey = (field: AttributeDescriptor) => `No ${field.label.toLowerCase()}`;\n\nexport const groupLabel = (key: string, field: AttributeDescriptor) => {\n if (key === emptyGroupKey(field)) return key;\n if (field.type.kind === \"enum\" || field.type.kind === \"enum-multi\") return enumOptionLabel(field.type, key);\n return key;\n};\n\n// Drops values that are no longer a declared option, so rows pointing at a removed\n// status join the \"No <field>\" group instead of an orphaned group for the deleted value.\nconst resolveGroupValue = (value: string | undefined, field: AttributeDescriptor) => {\n if (value === undefined) return undefined;\n if (field.type.kind !== \"enum\" && field.type.kind !== \"enum-multi\") return value;\n return getEnumOptions(field.type).some((option) => option.value === value) ? value : undefined;\n};\n\n/** One group per row. A multi-value field is not offered for grouping, so its first value decides. */\nexport const groupKey = (row: KanbanRendererRow, field: AttributeDescriptor) => {\n const [value] = getAttributeStringValues(row, field);\n return resolveGroupValue(value, field) ?? emptyGroupKey(field);\n};\n\n/** Option fields follow option order, other fields go A to Z, and the \"No <field>\" group comes last. */\nexport const compareGroupKeys = (left: string, right: string, field: AttributeDescriptor) => {\n const empty = emptyGroupKey(field);\n if (left === empty || right === empty) return Number(left === empty) - Number(right === empty);\n const ordered = compareEnumValues(left, right, field.type);\n if (ordered !== 0) return ordered;\n return left.localeCompare(right, undefined, { numeric: true });\n};\n\nexport const groupRowsByField = <TRow extends KanbanRendererRow>(\n rows: TRow[],\n field: AttributeDescriptor,\n knownKeys: string[] = [],\n): CollectionRowGroup<TRow>[] => {\n const groups = new Map<string, TRow[]>(knownKeys.map((key) => [key, []]));\n for (const row of rows) {\n const key = groupKey(row, field);\n const group = groups.get(key);\n if (group) group.push(row);\n else groups.set(key, [row]);\n }\n return [...groups.entries()]\n .sort(([left], [right]) => compareGroupKeys(left, right, field))\n .map(([key, groupRows]) => ({ key, label: groupLabel(key, field), rows: groupRows }));\n};\n"],"mappings":";;;;AASA,IAAaK,KAAmBC,MAAgC;CAC9D,IAAM,EAAEH,SAAMC,aAAUE,GAClBC,IAASN,EAAiBE,GAAMC,CAAK;CAC3C,IAAIG,EAAOC,WAAW,GAAG,OAAOL;CAChC,IAAMM,IAAgE,CAAA,GAClEI,IAAS;CACb,KAAK,IAAM,CAACD,GAAOE,MAAQP,GAGzBM,AAFID,IAAQC,KAAQJ,EAAMM,KAAK;EAAEZ,MAAMA,EAAKa,MAAMH,GAAQD,CAAK;EAAGD,OAAO;EAAOC,OAAOC;CAAO,CAAC,GAC/FJ,EAAMM,KAAK;EAAEZ,MAAMA,EAAKa,MAAMJ,GAAOE,CAAG;EAAGH,OAAO;EAAMC;CAAM,CAAC,GAC/DC,IAASC;CAIX,OAFID,IAASV,EAAKK,UAAQC,EAAMM,KAAK;EAAEZ,MAAMA,EAAKa,MAAMH,CAAM;EAAGF,OAAO;EAAOC,OAAOC;CAAO,CAAC,GAEvFJ,EAAMQ,KAAKC,MAChBA,EAAKP,QACH,kBAAC0H,GAAD;EAAK,IAAG;EAAwB,IAAG;EAAa,OAAM;EAAU,cAAa;EAC1EnH,UAAAA,EAAKf;CACH,GAFee,EAAKN,KAEpB,IAELM,EAAKf,IAET;AACF,GCnBa0B,KAAqBC,GAA0BC,GAA2BC,MAAwB;CAC7G,IAAIA,EAAKC,SAAS,UAAUD,EAAKC,SAAS,cAAc,OAAO;CAC/D,IAAMC,IAAUd,EAAeY,CAAI,GAC7BG,KAAWC,MAA8B;EAC7C,IAAIA,MAAUC,KAAAA,GAAW,OAAOH,EAAQI;EACxC,IAAMC,IAAQL,EAAQM,WAAWC,MAAWA,EAAOL,UAAUA,CAAK;EAClE,OAAOG,MAAU,KAAKL,EAAQI,SAAS,IAAIC;CAC7C;CACA,OAAOJ,EAAQL,CAAI,IAAIK,EAAQJ,CA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,MAAY,IACTJ,EAAKK,cAAcJ,GAAOP,KAAAA,GAAW,EAAEY,SAAS,GAAK,CAAC,IADnCF;AAE5B,GAEaG,KACXvB,GACAG,GACAqB,IAAsB,CAAA,MACS;CAC/B,IAAMC,IAAS,IAAIC,IAAoBF,EAAUG,KAAK7B,MAAQ,CAACA,GAAK,CAAA,CAAE,CAAC,CAAC;CACxE,KAAK,IAAMgB,KAAOd,GAAM;EACtB,IAAMF,IAAMe,EAASC,GAAKX,CAAK,GACzByB,IAAQH,EAAOI,IAAI/B,CAAG;EAC5B,AAAI8B,IAAOA,EAAME,KAAKhB,CAAG,IACpBW,EAAOM,IAAIjC,GAAK,CAACgB,CAAG,CAAC;CAC5B;CACA,OAAO,CAAC,GAAGW,EAAOO,QAAQ,CAAC,CAAC,CACzBC,MAAM,CAACjB,IAAO,CAACC,OAAWF,EAAiBC,GAAMC,GAAOd,CAAK,CAAC,CAAC,CAC/DwB,KAAK,CAAC7B,GAAKoC,QAAgB;EAAEpC;EAAKC,OAAOM,EAAWP,GAAKK,CAAK;EAAGH,MAAMkC;CAAU,EAAE;AACxF"}
|
|
@@ -254,7 +254,7 @@ var Ge = {
|
|
|
254
254
|
let [n, r] = Qe[e?.type.kind ?? ""] ?? ["A → Z", "Z → A"];
|
|
255
255
|
return t === "asc" ? n : r;
|
|
256
256
|
}, et = A(!1), tt = (e) => {
|
|
257
|
-
let t = E(
|
|
257
|
+
let t = E(26), { open: n, onOpenChange: r, anchorRef: i, width: a, placement: o, padding: s, testId: c, children: l } = e, u = o === void 0 ? "bottom-start" : o, d = s === void 0 ? "2xs" : s, f = j(et), p;
|
|
258
258
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (p = { mainAxis: 8 }, t[0] = p) : p = t[0];
|
|
259
259
|
let m;
|
|
260
260
|
t[1] === i ? m = t[2] : (m = () => i.current, t[1] = i, t[2] = m);
|
|
@@ -269,34 +269,40 @@ var Ge = {
|
|
|
269
269
|
let g;
|
|
270
270
|
t[6] === r ? g = t[7] : (g = (e) => r(e.open), t[6] = r, t[7] = g);
|
|
271
271
|
let _;
|
|
272
|
-
t[8] ===
|
|
272
|
+
t[8] === i ? _ = t[9] : (_ = (e) => {
|
|
273
|
+
let t = e.detail.originalEvent.target;
|
|
274
|
+
t instanceof Node && i.current?.contains(t) && e.preventDefault();
|
|
275
|
+
}, t[8] = i, t[9] = _);
|
|
276
|
+
let v;
|
|
277
|
+
t[10] === l ? v = t[11] : (v = /* @__PURE__ */ O(et, {
|
|
273
278
|
value: !0,
|
|
274
279
|
children: l
|
|
275
|
-
}), t[
|
|
276
|
-
let
|
|
277
|
-
t[
|
|
280
|
+
}), t[10] = l, t[11] = v);
|
|
281
|
+
let y;
|
|
282
|
+
t[12] !== d || t[13] !== v || t[14] !== c || t[15] !== a ? (y = /* @__PURE__ */ O(x.Positioner, { children: /* @__PURE__ */ O(x.Content, {
|
|
278
283
|
"data-testid": c,
|
|
279
284
|
width: a,
|
|
280
285
|
maxWidth: "calc(100vw - 32px)",
|
|
281
286
|
padding: d,
|
|
282
287
|
gap: "0",
|
|
283
288
|
overflow: "visible",
|
|
284
|
-
children: _
|
|
285
|
-
}) }), t[10] = d, t[11] = _, t[12] = c, t[13] = a, t[14] = v) : v = t[14];
|
|
286
|
-
let y;
|
|
287
|
-
t[15] !== f || t[16] !== v ? (y = /* @__PURE__ */ O(S, {
|
|
288
|
-
disabled: f,
|
|
289
289
|
children: v
|
|
290
|
-
}), t[
|
|
290
|
+
}) }), t[12] = d, t[13] = v, t[14] = c, t[15] = a, t[16] = y) : y = t[16];
|
|
291
291
|
let b;
|
|
292
|
-
|
|
292
|
+
t[17] !== f || t[18] !== y ? (b = /* @__PURE__ */ O(S, {
|
|
293
|
+
disabled: f,
|
|
294
|
+
children: y
|
|
295
|
+
}), t[17] = f, t[18] = y, t[19] = b) : b = t[19];
|
|
296
|
+
let C;
|
|
297
|
+
return t[20] !== n || t[21] !== h || t[22] !== g || t[23] !== _ || t[24] !== b ? (C = /* @__PURE__ */ O(x.Root, {
|
|
293
298
|
open: n,
|
|
294
299
|
lazyMount: !0,
|
|
295
300
|
unmountOnExit: !0,
|
|
296
301
|
positioning: h,
|
|
297
302
|
onOpenChange: g,
|
|
298
|
-
|
|
299
|
-
|
|
303
|
+
onInteractOutside: _,
|
|
304
|
+
children: b
|
|
305
|
+
}), t[20] = n, t[21] = h, t[22] = g, t[23] = _, t[24] = b, t[25] = C) : C = t[25], C;
|
|
300
306
|
}, nt = /^\d{4}-\d{2}-\d{2}$/, rt = (e) => {
|
|
301
307
|
let t = E(9), { rule: n, onChange: r } = e, i = typeof n.value == "number" ? n.value : void 0, a = i === void 0 ? "" : String(i), o;
|
|
302
308
|
t[0] !== a || t[1] !== i ? (o = {
|
|
@@ -1953,6 +1959,6 @@ var fn = (t) => {
|
|
|
1953
1959
|
return r ? e.filter((e) => n(e).some((e) => e.toLocaleLowerCase().includes(r))) : e;
|
|
1954
1960
|
};
|
|
1955
1961
|
//#endregion
|
|
1956
|
-
export {
|
|
1962
|
+
export { ge as A, X as C, xe as D, Se as E, fe as F, ue as I, de as L, _e as M, he as N, ye as O, me as P, Z as S, we as T, Fe as _, tn as a, Y as b, Ht as c, Tt as d, tt as f, Re as g, Ve as h, cn as i, pe as j, be as k, Vt as l, $ as m, _n as n, Xt as o, $e as p, mn as r, Kt as s, gn as t, Bt as u, Q as v, je as w, Me as x, Ee as y };
|
|
1957
1963
|
|
|
1958
|
-
//# sourceMappingURL=collection-view-search-
|
|
1964
|
+
//# sourceMappingURL=collection-view-search-D_7Qvz7p.js.map
|