@algorisys/zen-ui-solid 13.8.0 → 13.8.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 (198) hide show
  1. package/dist/components/form/checkbox/checkbox.d.ts.map +1 -1
  2. package/dist/components/form/radio/radio-group.d.ts.map +1 -1
  3. package/dist/components/form/slider/slider.d.ts.map +1 -1
  4. package/dist/components/form/switch/switch.d.ts.map +1 -1
  5. package/dist/index208.js +13 -13
  6. package/dist/index209.js +2 -2
  7. package/dist/index210.js +5 -5
  8. package/dist/index211.js +12 -12
  9. package/dist/index212.js +13 -13
  10. package/dist/index213.js +10 -10
  11. package/dist/index214.js +10 -10
  12. package/dist/index215.js +9 -9
  13. package/dist/index216.js +9 -9
  14. package/dist/index218.js +14 -14
  15. package/dist/index219.js +14 -14
  16. package/dist/index220.js +13 -13
  17. package/dist/index221.js +1 -1
  18. package/dist/index222.js +5 -5
  19. package/dist/index223.js +9 -9
  20. package/dist/index224.js +24 -24
  21. package/dist/index225.js +5 -5
  22. package/dist/index226.js +3 -3
  23. package/dist/index249.js +10 -10
  24. package/dist/index250.js +3 -3
  25. package/dist/index252.js +2 -2
  26. package/dist/index257.js +1 -1
  27. package/dist/index258.js +1 -1
  28. package/dist/index271.js +5 -5
  29. package/dist/index271.js.map +1 -1
  30. package/dist/index272.js +5 -3
  31. package/dist/index272.js.map +1 -1
  32. package/dist/index273.js +3 -17
  33. package/dist/index273.js.map +1 -1
  34. package/dist/index274.js +17 -16
  35. package/dist/index274.js.map +1 -1
  36. package/dist/index275.js +16 -3
  37. package/dist/index275.js.map +1 -1
  38. package/dist/index276.js +3 -3
  39. package/dist/index276.js.map +1 -1
  40. package/dist/index277.js +3 -26
  41. package/dist/index277.js.map +1 -1
  42. package/dist/index278.js +26 -11
  43. package/dist/index278.js.map +1 -1
  44. package/dist/index279.js +10 -7
  45. package/dist/index279.js.map +1 -1
  46. package/dist/index280.js +8 -49
  47. package/dist/index280.js.map +1 -1
  48. package/dist/index281.js +49 -13
  49. package/dist/index281.js.map +1 -1
  50. package/dist/index282.js +12 -6
  51. package/dist/index282.js.map +1 -1
  52. package/dist/index283.js +7 -4
  53. package/dist/index283.js.map +1 -1
  54. package/dist/index284.js +4 -5
  55. package/dist/index284.js.map +1 -1
  56. package/dist/index286.js +6 -260
  57. package/dist/index286.js.map +1 -1
  58. package/dist/index287.js +105 -64
  59. package/dist/index287.js.map +1 -1
  60. package/dist/index288.js +67 -19
  61. package/dist/index288.js.map +1 -1
  62. package/dist/index289.js +72 -3
  63. package/dist/index289.js.map +1 -1
  64. package/dist/index290.js +22 -15
  65. package/dist/index290.js.map +1 -1
  66. package/dist/index291.js +58 -7
  67. package/dist/index291.js.map +1 -1
  68. package/dist/index292.js +3 -384
  69. package/dist/index292.js.map +1 -1
  70. package/dist/index293.js +16 -35
  71. package/dist/index293.js.map +1 -1
  72. package/dist/index294.js +384 -6
  73. package/dist/index294.js.map +1 -1
  74. package/dist/index295.js +92 -19
  75. package/dist/index295.js.map +1 -1
  76. package/dist/index296.js +34 -391
  77. package/dist/index296.js.map +1 -1
  78. package/dist/index297.js +6 -118
  79. package/dist/index297.js.map +1 -1
  80. package/dist/index298.js +17 -48
  81. package/dist/index298.js.map +1 -1
  82. package/dist/index299.js +62 -16
  83. package/dist/index299.js.map +1 -1
  84. package/dist/index300.js +48 -58
  85. package/dist/index300.js.map +1 -1
  86. package/dist/index301.js +31 -62
  87. package/dist/index301.js.map +1 -1
  88. package/dist/index302.js +16 -20
  89. package/dist/index302.js.map +1 -1
  90. package/dist/index303.js +58 -56
  91. package/dist/index303.js.map +1 -1
  92. package/dist/index304.js +20 -10
  93. package/dist/index304.js.map +1 -1
  94. package/dist/index305.js +10 -117
  95. package/dist/index305.js.map +1 -1
  96. package/dist/index306.js +920 -20
  97. package/dist/index306.js.map +1 -1
  98. package/dist/index307.js +37 -19
  99. package/dist/index307.js.map +1 -1
  100. package/dist/index308.js +256 -18
  101. package/dist/index308.js.map +1 -1
  102. package/dist/index309.js +114 -71
  103. package/dist/index309.js.map +1 -1
  104. package/dist/index310.js +556 -891
  105. package/dist/index310.js.map +1 -1
  106. package/dist/index311.js +121 -36
  107. package/dist/index311.js.map +1 -1
  108. package/dist/index312.js +17 -114
  109. package/dist/index312.js.map +1 -1
  110. package/dist/index313.js +363 -560
  111. package/dist/index313.js.map +1 -1
  112. package/dist/index314.js +85 -118
  113. package/dist/index314.js.map +1 -1
  114. package/dist/index315.js +16 -112
  115. package/dist/index315.js.map +1 -1
  116. package/dist/index316.js +115 -67
  117. package/dist/index316.js.map +1 -1
  118. package/dist/index317.js +21 -16
  119. package/dist/index317.js.map +1 -1
  120. package/dist/index318.js +19 -91
  121. package/dist/index318.js.map +1 -1
  122. package/dist/index319.js +20 -87
  123. package/dist/index319.js.map +1 -1
  124. package/dist/index320.js +71 -16
  125. package/dist/index320.js.map +1 -1
  126. package/dist/index321.js +118 -32
  127. package/dist/index321.js.map +1 -1
  128. package/dist/index323.js +1 -1
  129. package/dist/index324.js +93 -63
  130. package/dist/index324.js.map +1 -1
  131. package/dist/index325.js +5 -116
  132. package/dist/index325.js.map +1 -1
  133. package/dist/index326.js +38 -7
  134. package/dist/index326.js.map +1 -1
  135. package/dist/index327.js +44 -7
  136. package/dist/index327.js.map +1 -1
  137. package/dist/index328.js +2 -13
  138. package/dist/index328.js.map +1 -1
  139. package/dist/index329.js +65 -7
  140. package/dist/index329.js.map +1 -1
  141. package/dist/index330.js +115 -3
  142. package/dist/index330.js.map +1 -1
  143. package/dist/index331.js +608 -3
  144. package/dist/index331.js.map +1 -1
  145. package/dist/index332.js +295 -4
  146. package/dist/index332.js.map +1 -1
  147. package/dist/index333.js +88 -5
  148. package/dist/index333.js.map +1 -1
  149. package/dist/index334.js +11 -95
  150. package/dist/index334.js.map +1 -1
  151. package/dist/index335.js +20 -5
  152. package/dist/index335.js.map +1 -1
  153. package/dist/index336.js +62 -38
  154. package/dist/index336.js.map +1 -1
  155. package/dist/index337.js +33 -43
  156. package/dist/index337.js.map +1 -1
  157. package/dist/index338.js +7 -2
  158. package/dist/index338.js.map +1 -1
  159. package/dist/index339.js +6 -608
  160. package/dist/index339.js.map +1 -1
  161. package/dist/index340.js +11 -294
  162. package/dist/index340.js.map +1 -1
  163. package/dist/index341.js +6 -88
  164. package/dist/index341.js.map +1 -1
  165. package/dist/index342.js +3 -10
  166. package/dist/index342.js.map +1 -1
  167. package/dist/index343.js +3 -19
  168. package/dist/index343.js.map +1 -1
  169. package/dist/index344.js +4 -61
  170. package/dist/index344.js.map +1 -1
  171. package/dist/index345.js +5 -33
  172. package/dist/index345.js.map +1 -1
  173. package/dist/index346.js +3 -466
  174. package/dist/index346.js.map +1 -1
  175. package/dist/index347.js +9 -125
  176. package/dist/index347.js.map +1 -1
  177. package/dist/index348.js +33 -134
  178. package/dist/index348.js.map +1 -1
  179. package/dist/index349.js +21 -3
  180. package/dist/index349.js.map +1 -1
  181. package/dist/index350.js +5 -5
  182. package/dist/index351.js +2 -2
  183. package/dist/index357.js +464 -8
  184. package/dist/index357.js.map +1 -1
  185. package/dist/index358.js +126 -33
  186. package/dist/index358.js.map +1 -1
  187. package/dist/index359.js +133 -20
  188. package/dist/index359.js.map +1 -1
  189. package/dist/index53.js +21 -15
  190. package/dist/index53.js.map +1 -1
  191. package/dist/index54.js +15 -9
  192. package/dist/index54.js.map +1 -1
  193. package/dist/index55.js +20 -14
  194. package/dist/index55.js.map +1 -1
  195. package/dist/index62.js +42 -22
  196. package/dist/index62.js.map +1 -1
  197. package/dist/server/index.js +50 -12
  198. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index329.js","sources":["../../../node_modules/.bun/@modular-forms+solid@0.25.1+ee58d66d663bac7b/node_modules/@modular-forms/solid/dist/source/utils/getFieldNames.js"],"sourcesContent":["import { untrack } from 'solid-js';\nimport { removeInvalidNames } from './removeInvalidNames';\n/**\n * Returns a list with the names of all fields.\n *\n * @param form The form of the fields.\n * @param shouldValid Whether to be valid.\n *\n * @returns All field names of the form.\n */\nexport function getFieldNames(form, shouldValid = true) {\n // Get name of every field\n const fieldNames = [...untrack(form.internal.fieldNames.get)];\n // Remove invalid field names\n if (shouldValid) {\n removeInvalidNames(form, fieldNames);\n }\n // Return field names\n return fieldNames;\n}\n"],"names":["getFieldNames","form","shouldValid","fieldNames","untrack","removeInvalidNames"],"mappings":";;AAUO,SAASA,EAAcC,GAAMC,IAAc,IAAM;AAEpD,QAAMC,IAAa,CAAC,GAAGC,EAAQH,EAAK,SAAS,WAAW,GAAG,CAAC;AAE5D,SAAIC,KACAG,EAAmBJ,GAAME,CAAU,GAGhCA;AACX;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index329.js","sources":["../src/components/pivot/internal/windowed-virtual-list.tsx"],"sourcesContent":["import { type Component, type JSX, Show } from \"solid-js\";\nimport {\n pivotFilterWindowValueAt,\n type PivotFilterOptionsWindow,\n} from \"@algorisys/zen-ui-core/virtual-window\";\nimport { Loading } from \"../../loading/loading\";\nimport { VirtualizedItems } from \"../../listbox/virtualized-items\";\nimport { useLocale } from \"../../locale/locale\";\n\n/**\n * A listbox over values that are not all loaded.\n *\n * The windowing is VirtualizedItems' sparse mode now. This file used to carry\n * its own createVirtualizer, its own absolute-positioned row layer and its own\n * RAF-throttled scroll listener — all of which VirtualizedItems already had in\n * dense form. The one thing genuinely missing from the library was \"the list is\n * longer than what is loaded\", so that went INTO VirtualizedItems, where every\n * other listbox and DataTable's filters can reach it, rather than staying in an\n * `internal/` folder where nothing could. This file's own sibling said as much:\n * the constants exist to keep \"pivot grids, filter dropdowns, and future large\n * lists\" consistent — a cross-cutting intent with nowhere to cross to.\n *\n * What is left is the part that IS about pivot filters: the option row and the\n * skeleton for a row whose page has not arrived.\n *\n * Mirrors the React binding.\n */\n\nconst DEFAULT_ROW_HEIGHT_PX = 36;\nconst DEFAULT_OVERSCAN_ROWS = 4;\n\nexport type WindowedVirtualListProps = {\n label: string;\n totalCount: number;\n optionsWindows: PivotFilterOptionsWindow[];\n loadingWindow: boolean;\n onVisibleRange: (minIndex: number, maxIndex: number) => void;\n renderRow: (value: string) => JSX.Element;\n isSelected?: (value: string) => boolean;\n // rowHeight / overscan / class / listClass / ariaLabel / renderSkeleton are\n // gone: every one was optional, defaulted, and passed by nobody. They were\n // generalisation for a reuse an `internal/` folder forbids — and the reuse\n // that DID want them is served by VirtualizedItems, which is public.\n};\n\nexport const WindowedVirtualList: Component<WindowedVirtualListProps> = (props) => {\n const loc = useLocale();\n return (\n <div class=\"zen-flex zen-flex-col\">\n <div role=\"listbox\" aria-label={loc.t(\"pivot.values\", { label: props.label })} aria-multiselectable=\"true\" aria-busy={props.loadingWindow || undefined}>\n <VirtualizedItems<string>\n totalCount={props.totalCount}\n // Sparse by GLOBAL index: value 120 lives at offset 20 of the page that\n // starts at 100. undefined means \"not loaded\", not \"no value\".\n getItem={(index) => pivotFilterWindowValueAt(props.optionsWindows, index)}\n onVisibleRange={(min, max) => props.onVisibleRange(min, max)}\n estimateSize={DEFAULT_ROW_HEIGHT_PX}\n overscan={DEFAULT_OVERSCAN_ROWS}\n maxHeight={256}\n class=\"zen-p-1\"\n >\n {({ item }) => (\n <div role=\"option\" aria-selected={item ? (props.isSelected?.(item) ?? false) : false} class=\"zen-h-full zen-w-full\">\n <Show\n when={item}\n fallback={\n // A skeleton, not a blank: an empty row reads as \"no value\"\n // rather than \"not yet\".\n <div class=\"zen-flex zen-h-full zen-items-center zen-gap-2 zen-px-2\" aria-busy=\"true\" aria-label={loc.t(\"pivot.loadingValue\")}>\n <span\n class=\"zen-size-4 zen-shrink-0 zen-rounded-zen-sm zen-border zen-border-zen-border zen-bg-zen-muted motion-safe:zen-animate-pulse\"\n aria-hidden=\"true\"\n />\n <div\n class=\"zen-h-3 zen-w-3/4 zen-rounded-zen-sm zen-bg-zen-muted motion-safe:zen-animate-pulse\"\n aria-hidden=\"true\"\n />\n </div>\n }\n >\n {(value) => props.renderRow(value())}\n </Show>\n </div>\n )}\n </VirtualizedItems>\n </div>\n <Show when={props.loadingWindow}>\n <div class=\"zen-flex zen-justify-center zen-border-t zen-border-zen-border zen-px-2 zen-py-2\">\n <Loading size=\"sm\" label={loc.t(\"pivot.loadingMore\")} />\n </div>\n </Show>\n </div>\n );\n};\n"],"names":["DEFAULT_ROW_HEIGHT_PX","DEFAULT_OVERSCAN_ROWS","WindowedVirtualList","props","loc","useLocale","_el$","_$getNextElement","_tmpl$2","_el$2","firstChild","_el$4","nextSibling","_el$5","_co$","_$getNextMarker","_$insert","_$createComponent","VirtualizedItems","totalCount","getItem","index","pivotFilterWindowValueAt","optionsWindows","onVisibleRange","min","max","estimateSize","overscan","maxHeight","children","item","_el$6","_tmpl$3","Show","when","fallback","_el$7","_tmpl$4","_$effect","_$setAttribute","t","value","renderRow","isSelected","loadingWindow","_el$3","_tmpl$","Loading","size","label","_p$","_v$","_v$2","undefined","e"],"mappings":";;;;;;;AA4BA,MAAMA,IAAwB,IACxBC,IAAwB,GAgBjBC,IAA4DC,CAAAA,MAAU;AACjF,QAAMC,IAAMC,EAAAA;AACZ,UAAA,MAAA;AAAA,QAAAC,IAAAC,EAAAC,CAAA,GAAAC,IAAAH,EAAAI,YAAAC,IAAAF,EAAAG,aAAA,CAAAC,GAAAC,CAAA,IAAAC,EAAAJ,EAAAC,WAAA;AAAAI,WAAAA,EAAAP,GAAAQ,EAGOC,GAAgB;AAAA,MAAA,IACfC,aAAU;AAAA,eAAEhB,EAAMgB;AAAAA,MAAU;AAAA,MAG5BC,SAAUC,CAAAA,MAAUC,EAAyBnB,EAAMoB,gBAAgBF,CAAK;AAAA,MACxEG,gBAAgBA,CAACC,GAAKC,MAAQvB,EAAMqB,eAAeC,GAAKC,CAAG;AAAA,MAC3DC,cAAc3B;AAAAA,MACd4B,UAAU3B;AAAAA,MACV4B,WAAW;AAAA,MAAG,OAAA;AAAA,MAAAC,UAGbA,CAAC;AAAA,QAAEC,MAAAA;AAAAA,MAAAA,OAAM,MAAA;AAAA,YAAAC,IA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AAA,GAAAF;AAAAA,IAAA,GAAA;AAAA,MAAAI,GAAAD;AAAAA,MAAAb,GAAAa;AAAAA,IAAAA,CAAA,GAAAhD;AAAAA,EAAA,GAAA;AA4C5J;"}
package/dist/index330.js CHANGED
@@ -1,7 +1,119 @@
1
- function n(e, t) {
2
- return +t.replace(`${e}.`, "").split(".")[0];
1
+ import { createSignal as f, onCleanup as P } from "solid-js";
2
+ import { pivotFilterWindowCoversRange as V, VIRTUAL_SCROLL_FETCH_DEBOUNCE_MS as U, prunePivotFilterWindows as N, pivotFilterMissingWindowStarts as q, pickNearestWindowStart as x } from "./index285.js";
3
+ const B = 300;
4
+ function G(a) {
5
+ const [h, C] = f(!1), [b, c] = f(!1), [m, v] = f([]), [L, E] = f(0), [S, w] = f(null);
6
+ let r, u, s = null, d = 0;
7
+ const l = /* @__PURE__ */ new Set(), _ = () => a.isActive?.() ?? !0;
8
+ function g() {
9
+ v([]), E(0), w(null), l.clear(), s = null;
10
+ }
11
+ function R(e, n) {
12
+ v((t) => {
13
+ const i = N(
14
+ t,
15
+ e,
16
+ n,
17
+ a.pageSize
18
+ );
19
+ return i.length === t.length && i.every(
20
+ (o, W) => o.startIndex === t[W]?.startIndex
21
+ ) ? t : i;
22
+ });
23
+ }
24
+ function p() {
25
+ u && clearTimeout(u), u = setTimeout(() => {
26
+ u = void 0, A();
27
+ }, U);
28
+ }
29
+ function M(e) {
30
+ const { startIndex: n, page: t, previousTotal: i } = e, o = t.total ?? t.values.length;
31
+ return t.values.length === 0 && n > 0 ? Math.min(o > 0 ? o : i, n) : n === 0 || o > 0 ? o : i;
32
+ }
33
+ async function T(e, n = !1) {
34
+ const t = ++d;
35
+ l.add(e), n ? (C(!0), w(null)) : c(!0);
36
+ try {
37
+ const i = a.getSearch(), o = await a.loadPage(e, a.pageSize, i);
38
+ if (t !== d)
39
+ return;
40
+ v((F) => [...F.filter(
41
+ (O) => O.startIndex !== e
42
+ ), { startIndex: e, values: o.values }]);
43
+ const W = M;
44
+ E(
45
+ (F) => W({ startIndex: e, page: o, previousTotal: F })
46
+ ), s && R(s.min, s.max);
47
+ } catch (i) {
48
+ if (t !== d)
49
+ return;
50
+ if (n) {
51
+ g();
52
+ const o = i instanceof Error ? i.message : "Failed to load options.";
53
+ w(o);
54
+ }
55
+ } finally {
56
+ l.delete(e);
57
+ const i = t === d, o = l.size === 0;
58
+ (i || o) && (n && i && C(!1), o && (c(!1), p()));
59
+ }
60
+ }
61
+ function y(e) {
62
+ r && clearTimeout(r), r = setTimeout(() => {
63
+ r = void 0, g(), T(0, !0);
64
+ }, B);
65
+ }
66
+ function z() {
67
+ g(), T(0, !0);
68
+ }
69
+ function A() {
70
+ const e = s;
71
+ if (!e || !_() || h() || S() || l.size > 0) {
72
+ l.size === 0 && c(!1);
73
+ return;
74
+ }
75
+ const n = q(
76
+ m(),
77
+ e.min,
78
+ e.max,
79
+ a.pageSize
80
+ );
81
+ if (n.length === 0) {
82
+ R(e.min, e.max), l.size === 0 && c(!1);
83
+ return;
84
+ }
85
+ const t = x(
86
+ n,
87
+ Math.floor((e.min + e.max) / 2),
88
+ a.pageSize
89
+ );
90
+ l.has(t) || T(t);
91
+ }
92
+ function D(e, n) {
93
+ const t = s && s.min === e && s.max === n;
94
+ s = { min: e, max: n }, !t && (!h() && !S() && !V(
95
+ m(),
96
+ e,
97
+ n,
98
+ a.pageSize
99
+ ) && c(!0), p());
100
+ }
101
+ return P(() => {
102
+ r && clearTimeout(r), u && clearTimeout(u);
103
+ }), {
104
+ loading: h,
105
+ loadingWindow: b,
106
+ optionsWindows: m,
107
+ totalCount: L,
108
+ loadError: S,
109
+ handleVisibleRange: D,
110
+ scheduleFetch: y,
111
+ openPanelFetch: z,
112
+ resetListState: g,
113
+ reload: z
114
+ };
3
115
  }
4
116
  export {
5
- n as getPathIndex
117
+ G as useWindowedOptionPages
6
118
  };
7
119
  //# sourceMappingURL=index330.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index330.js","sources":["../../../node_modules/.bun/@modular-forms+solid@0.25.1+ee58d66d663bac7b/node_modules/@modular-forms/solid/dist/source/utils/getPathIndex.js"],"sourcesContent":["/**\n * Returns the index of the path in the field array.\n *\n * @param name The name of the field array.\n * @param path The path to get the index from.\n *\n * @returns The field index in the array.\n */\nexport function getPathIndex(name, path) {\n return +path.replace(`${name}.`, '').split('.')[0];\n}\n"],"names":["getPathIndex","name","path"],"mappings":"AAQO,SAASA,EAAaC,GAAMC,GAAM;AACrC,SAAO,CAACA,EAAK,QAAQ,GAAGD,CAAI,KAAK,EAAE,EAAE,MAAM,GAAG,EAAE,CAAC;AACrD;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index330.js","sources":["../src/components/pivot/internal/use-windowed-option-pages.ts"],"sourcesContent":["import { createSignal, onCleanup } from \"solid-js\";\nimport {\n pivotFilterMissingWindowStarts,\n pivotFilterWindowCoversRange,\n prunePivotFilterWindows,\n type PivotFilterOptionsWindow,\n} from \"@algorisys/zen-ui-core/virtual-window\";\nimport { VIRTUAL_SCROLL_FETCH_DEBOUNCE_MS } from \"@algorisys/zen-ui-core/virtual-window\";\nimport { pickNearestWindowStart } from \"@algorisys/zen-ui-core/virtual-window\";\n\nconst DEFAULT_SEARCH_DEBOUNCE_MS = 300;\n\nexport type WindowedOptionPage = {\n values: string[];\n hasMore: boolean;\n total: number;\n};\n\nexport type UseWindowedOptionPagesProps = {\n pageSize: number;\n /** When false, visible-range flushes are skipped (e.g. closed dropdown). */\n isActive?: () => boolean;\n getSearch: () => string;\n loadPage: (\n offset: number,\n limit: number,\n search: string,\n ) => Promise<WindowedOptionPage>;\n // searchDebounceMs / resolveTotal / onError are gone. All three were\n // optional, defaulted, and passed by nobody — generalisation for a second\n // caller that does not exist. resolveTotal's doc even described it (\"default\n // matches column-filter behavior\"), which is how imported abstraction reads\n // once the thing it was imported for never arrives. The errors that onError\n // was for are surfaced through `loadError` instead, which the UI actually\n // reads.\n};\n\n/**\n * Sliding-window fetch controller for virtual option lists (column filters,\n * pivot filter members, and similar).\n */\nexport function useWindowedOptionPages(props: UseWindowedOptionPagesProps) {\n const [loading, setLoading] = createSignal(false);\n const [loadingWindow, setLoadingWindow] = createSignal(false);\n const [optionsWindows, setOptionsWindows] = createSignal<\n PivotFilterOptionsWindow[]\n >([]);\n const [totalCount, setTotalCount] = createSignal(0);\n const [loadError, setLoadError] = createSignal<string | null>(null);\n\n let searchDebounce: ReturnType<typeof setTimeout> | undefined;\n let visibleRangeDebounce: ReturnType<typeof setTimeout> | undefined;\n let lastVisibleRange: { min: number; max: number } | null = null;\n let fetchSequence = 0;\n const inFlightWindowStarts = new Set<number>();\n\n const isActive = () => props.isActive?.() ?? true;\n\n\n function resetListState() {\n setOptionsWindows([]);\n setTotalCount(0);\n setLoadError(null);\n inFlightWindowStarts.clear();\n lastVisibleRange = null;\n }\n\n function maybePruneWindows(minIndex: number, maxIndex: number) {\n setOptionsWindows((current) => {\n const pruned = prunePivotFilterWindows(\n current,\n minIndex,\n maxIndex,\n props.pageSize,\n );\n if (\n pruned.length === current.length &&\n pruned.every(\n (window, index) => window.startIndex === current[index]?.startIndex,\n )\n ) {\n return current;\n }\n return pruned;\n });\n }\n\n function scheduleVisibleRangeFlush() {\n if (visibleRangeDebounce) {\n clearTimeout(visibleRangeDebounce);\n }\n visibleRangeDebounce = setTimeout(() => {\n visibleRangeDebounce = undefined;\n flushVisibleRange();\n }, VIRTUAL_SCROLL_FETCH_DEBOUNCE_MS);\n }\n\n function defaultResolveTotal(args: {\n startIndex: number;\n page: WindowedOptionPage;\n previousTotal: number;\n }): number {\n const { startIndex, page, previousTotal } = args;\n const reportedTotal = page.total ?? page.values.length;\n if (page.values.length === 0 && startIndex > 0) {\n return Math.min(reportedTotal > 0 ? reportedTotal : previousTotal, startIndex);\n }\n if (startIndex === 0 || reportedTotal > 0) {\n return reportedTotal;\n }\n return previousTotal;\n }\n\n async function fetchWindow(startIndex: number, initial = false) {\n const sequence = ++fetchSequence;\n inFlightWindowStarts.add(startIndex);\n if (initial) {\n setLoading(true);\n setLoadError(null);\n } else {\n setLoadingWindow(true);\n }\n try {\n const search = props.getSearch();\n const page = await props.loadPage(startIndex, props.pageSize, search);\n if (sequence !== fetchSequence) {\n return;\n }\n setOptionsWindows((current) => {\n const next = current.filter(\n (window) => window.startIndex !== startIndex,\n );\n return [...next, { startIndex, values: page.values }];\n });\n const resolve = defaultResolveTotal;\n setTotalCount((previousTotal) =>\n resolve({ startIndex, page, previousTotal }),\n );\n if (lastVisibleRange) {\n maybePruneWindows(lastVisibleRange.min, lastVisibleRange.max);\n }\n } catch (caught) {\n if (sequence !== fetchSequence) {\n return;\n }\n if (initial) {\n resetListState();\n const message =\n caught instanceof Error\n ? caught.message\n : \"Failed to load options.\";\n setLoadError(message);\n }\n } finally {\n inFlightWindowStarts.delete(startIndex);\n const isCurrent = sequence === fetchSequence;\n const noMoreInFlight = inFlightWindowStarts.size === 0;\n if (isCurrent || noMoreInFlight) {\n if (initial && isCurrent) {\n setLoading(false);\n }\n if (noMoreInFlight) {\n setLoadingWindow(false);\n scheduleVisibleRangeFlush();\n }\n }\n }\n }\n\n function scheduleFetch(search: string) {\n if (searchDebounce) {\n clearTimeout(searchDebounce);\n }\n searchDebounce = setTimeout(() => {\n searchDebounce = undefined;\n resetListState();\n void fetchWindow(0, true);\n }, DEFAULT_SEARCH_DEBOUNCE_MS);\n void search;\n }\n\n function openPanelFetch() {\n resetListState();\n void fetchWindow(0, true);\n }\n\n function flushVisibleRange() {\n const range = lastVisibleRange;\n if (\n !range ||\n !isActive() ||\n loading() ||\n loadError() ||\n inFlightWindowStarts.size > 0\n ) {\n if (inFlightWindowStarts.size === 0) {\n setLoadingWindow(false);\n }\n return;\n }\n const missingStarts = pivotFilterMissingWindowStarts(\n optionsWindows(),\n range.min,\n range.max,\n props.pageSize,\n );\n if (missingStarts.length === 0) {\n maybePruneWindows(range.min, range.max);\n if (inFlightWindowStarts.size === 0) {\n setLoadingWindow(false);\n }\n return;\n }\n const desiredStart = pickNearestWindowStart(\n missingStarts,\n Math.floor((range.min + range.max) / 2),\n props.pageSize,\n );\n if (inFlightWindowStarts.has(desiredStart)) {\n return;\n }\n void fetchWindow(desiredStart);\n }\n\n function handleVisibleRange(minIndex: number, maxIndex: number) {\n const unchanged =\n lastVisibleRange &&\n lastVisibleRange.min === minIndex &&\n lastVisibleRange.max === maxIndex;\n lastVisibleRange = { min: minIndex, max: maxIndex };\n if (unchanged) {\n return;\n }\n if (\n !loading() &&\n !loadError() &&\n !pivotFilterWindowCoversRange(\n optionsWindows(),\n minIndex,\n maxIndex,\n props.pageSize,\n )\n ) {\n setLoadingWindow(true);\n }\n scheduleVisibleRangeFlush();\n }\n\n onCleanup(() => {\n if (searchDebounce) {\n clearTimeout(searchDebounce);\n }\n if (visibleRangeDebounce) {\n clearTimeout(visibleRangeDebounce);\n }\n });\n\n return {\n loading,\n loadingWindow,\n optionsWindows,\n totalCount,\n loadError,\n handleVisibleRange,\n scheduleFetch,\n openPanelFetch,\n resetListState,\n reload: openPanelFetch,\n };\n}\n"],"names":["DEFAULT_SEARCH_DEBOUNCE_MS","useWindowedOptionPages","props","loading","setLoading","createSignal","loadingWindow","setLoadingWindow","optionsWindows","setOptionsWindows","totalCount","setTotalCount","loadError","setLoadError","searchDebounce","visibleRangeDebounce","lastVisibleRange","fetchSequence","inFlightWindowStarts","isActive","resetListState","maybePruneWindows","minIndex","maxIndex","current","pruned","prunePivotFilterWindows","window","index","scheduleVisibleRangeFlush","flushVisibleRange","VIRTUAL_SCROLL_FETCH_DEBOUNCE_MS","defaultResolveTotal","args","startIndex","page","previousTotal","reportedTotal","fetchWindow","initial","sequence","search","resolve","caught","message","isCurrent","noMoreInFlight","scheduleFetch","openPanelFetch","range","missingStarts","pivotFilterMissingWindowStarts","desiredStart","pickNearestWindowStart","handleVisibleRange","unchanged","pivotFilterWindowCoversRange","onCleanup"],"mappings":";;AAUA,MAAMA,IAA6B;AA+B5B,SAASC,EAAuBC,GAAoC;AACzE,QAAM,CAACC,GAASC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