@himanshu-sorathiya/react-kit 1.0.14 → 1.0.16
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/index.d.ts +165 -97
- package/dist/index.js +523 -326
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,24 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
+
import React$1 from 'react';
|
|
3
4
|
import { CSSProperties, RefObject } from 'react';
|
|
4
5
|
|
|
6
|
+
export interface FuzzyHighlighterProps {
|
|
7
|
+
text: string;
|
|
8
|
+
query: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
caseSensitive?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function FuzzyHighlighter({ text, query, className, caseSensitive, }: FuzzyHighlighterProps): React$1.JSX.Element;
|
|
5
13
|
export interface ModalLayoutProps {
|
|
6
14
|
modalId: string;
|
|
7
|
-
children: React.ReactNode;
|
|
15
|
+
children: React$1.ReactNode;
|
|
8
16
|
wrapperClassName?: string;
|
|
9
|
-
wrapperStyle?: CSSProperties;
|
|
17
|
+
wrapperStyle?: React$1.CSSProperties;
|
|
10
18
|
containerClassName?: string;
|
|
11
|
-
containerStyle?: CSSProperties;
|
|
19
|
+
containerStyle?: React$1.CSSProperties;
|
|
12
20
|
}
|
|
13
21
|
export declare function ModalLayout({ modalId, children, wrapperClassName, wrapperStyle, containerClassName, containerStyle, }: ModalLayoutProps): import("react").ReactPortal | null;
|
|
14
|
-
export interface DebounceOptions {
|
|
15
|
-
maxWait?: number;
|
|
16
|
-
leading?: boolean;
|
|
17
|
-
trailing?: boolean;
|
|
18
|
-
}
|
|
19
|
-
export interface UseDebounceReturn<Args extends any[]> {
|
|
20
|
-
debouncedFunc: (...args: Args) => void;
|
|
21
|
-
cancel: () => void;
|
|
22
|
-
flush: () => void;
|
|
23
|
-
isPending: boolean;
|
|
24
|
-
}
|
|
25
|
-
export declare function useDebounce<Args extends any[]>(func: (...args: Args) => void, delay: number, options?: DebounceOptions): UseDebounceReturn<Args>;
|
|
26
|
-
export interface DebouncedValueOptions {
|
|
27
|
-
maxWait?: number;
|
|
28
|
-
leading?: boolean;
|
|
29
|
-
trailing?: boolean;
|
|
30
|
-
}
|
|
31
|
-
export type UseDebouncedValueReturn<T> = T;
|
|
32
|
-
export declare function useDebouncedValue<T>(value: T, delay: number, options?: DebouncedValueOptions): UseDebouncedValueReturn<T>;
|
|
33
22
|
export type FilterType = "text" | "number" | "boolean" | "date" | "select" | "multiselect" | "custom";
|
|
34
23
|
export type TextOperator = "contains" | "equals" | "startsWith" | "endsWith" | "notContains";
|
|
35
24
|
export type NumberOperator = "equals" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "between";
|
|
@@ -133,70 +122,79 @@ export type UseFuzzySearchFields<T> = {
|
|
|
133
122
|
}[];
|
|
134
123
|
export type UseFuzzySearchReturn<T> = T[];
|
|
135
124
|
export declare function useFuzzySearch<T>(data: T[], query: string, fields: UseFuzzySearchFields<T>, options?: FuzzySearchOptions): UseFuzzySearchReturn<T>;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
"keypress"
|
|
140
|
-
];
|
|
141
|
-
export type KeyEventType = (typeof validKeyEventTypes)[number];
|
|
142
|
-
export interface BaseKeyOptions {
|
|
143
|
-
enabled?: boolean;
|
|
144
|
-
target?: RefObject<HTMLElement | null> | Window;
|
|
145
|
-
preventDefault?: boolean;
|
|
146
|
-
stopPropagation?: boolean;
|
|
147
|
-
ignoreWhenFocusedInInputs?: boolean;
|
|
148
|
-
ctrlKey?: boolean;
|
|
149
|
-
shiftKey?: boolean;
|
|
150
|
-
altKey?: boolean;
|
|
151
|
-
metaKey?: boolean;
|
|
125
|
+
export interface Group<T> {
|
|
126
|
+
key: string;
|
|
127
|
+
items: T[];
|
|
152
128
|
}
|
|
153
|
-
export
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
isOpen: boolean;
|
|
164
|
-
id: string | null;
|
|
165
|
-
data: TData | undefined;
|
|
129
|
+
export interface UseGroupingReturn<T> {
|
|
130
|
+
groupedRecord: Record<string, T[]>;
|
|
131
|
+
groupedArray: Group<T>[];
|
|
132
|
+
groupKeys: string[];
|
|
133
|
+
totalGroups: number;
|
|
134
|
+
activeGroupBy: string | undefined;
|
|
135
|
+
changeGroupBy: (newField: string) => void;
|
|
136
|
+
clearGrouping: () => void;
|
|
137
|
+
resetGrouping: () => void;
|
|
138
|
+
getGroupItems: (groupKey: string) => T[];
|
|
166
139
|
}
|
|
167
|
-
export
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
140
|
+
export declare function useGrouping<T = unknown>({ items, initialGroupBy, }: {
|
|
141
|
+
items: T[];
|
|
142
|
+
initialGroupBy?: string;
|
|
143
|
+
}): UseGroupingReturn<T>;
|
|
144
|
+
export interface UsePaginationReturn<T> {
|
|
145
|
+
pageItems: T[];
|
|
146
|
+
pageSize: number;
|
|
147
|
+
pageIndex: number;
|
|
148
|
+
totalPages: number;
|
|
149
|
+
canPrevious: boolean;
|
|
150
|
+
canNext: boolean;
|
|
151
|
+
nextPage: () => void;
|
|
152
|
+
previousPage: () => void;
|
|
153
|
+
goToFirstPage: () => void;
|
|
154
|
+
goToLastPage: () => void;
|
|
155
|
+
goToPage: (newPageIndex: number) => void;
|
|
156
|
+
changePageSize: (newPageSize: number) => void;
|
|
157
|
+
resetPageIndex: () => void;
|
|
158
|
+
resetPageSize: () => void;
|
|
159
|
+
resetPagination: () => void;
|
|
171
160
|
}
|
|
172
|
-
export
|
|
173
|
-
export
|
|
174
|
-
export declare function useModalActions(): UseModalActionsReturn;
|
|
175
|
-
export declare function useModal<TData = unknown>(): UseModalReturn<TData>;
|
|
161
|
+
export declare function usePagination<T>(data: T[], initialPageSize: number, initialPageIndex?: number): UsePaginationReturn<T>;
|
|
162
|
+
export type SelectionId = string | number;
|
|
176
163
|
export interface UseMultipleSelectionReturn<T> {
|
|
177
|
-
selectedIds:
|
|
164
|
+
selectedIds: SelectionId[];
|
|
178
165
|
selectedCount: number;
|
|
179
166
|
selectedItems: T[];
|
|
180
167
|
isEmpty: boolean;
|
|
181
|
-
select: (item:
|
|
182
|
-
deselect: (item:
|
|
183
|
-
toggle: (item:
|
|
184
|
-
isSelected: (item:
|
|
185
|
-
replaceSelection: (newSelectedItems: (string | number)[] | T[]) => void;
|
|
168
|
+
select: (item: SelectionId | T) => void;
|
|
169
|
+
deselect: (item: SelectionId | T) => void;
|
|
170
|
+
toggle: (item: SelectionId | T) => void;
|
|
171
|
+
isSelected: (item: SelectionId | T) => boolean;
|
|
186
172
|
resetSelection: () => void;
|
|
173
|
+
replaceSelection: (newSelectedItems: SelectionId[] | T[]) => void;
|
|
187
174
|
selectAll: () => void;
|
|
188
175
|
deselectAll: () => void;
|
|
189
176
|
toggleAll: () => void;
|
|
190
177
|
invertSelection: () => void;
|
|
191
|
-
selectMultiple: (newItems:
|
|
192
|
-
deselectMultiple: (itemsToRemove:
|
|
193
|
-
retainOnly: (itemsToRetain:
|
|
178
|
+
selectMultiple: (newItems: SelectionId[] | T[]) => void;
|
|
179
|
+
deselectMultiple: (itemsToRemove: SelectionId[] | T[]) => void;
|
|
180
|
+
retainOnly: (itemsToRetain: SelectionId[] | T[]) => void;
|
|
194
181
|
}
|
|
195
182
|
export declare function useMultipleSelection<T = unknown>({ items, field, initialSelectedIds, }: {
|
|
196
183
|
items: T[];
|
|
197
184
|
field?: string;
|
|
198
|
-
initialSelectedIds?:
|
|
185
|
+
initialSelectedIds?: SelectionId[];
|
|
199
186
|
}): UseMultipleSelectionReturn<T>;
|
|
187
|
+
type SelectionId$1 = string | number;
|
|
188
|
+
export interface UseSingleSelectionReturn {
|
|
189
|
+
selectedId: SelectionId$1 | undefined;
|
|
190
|
+
hasSelection: boolean;
|
|
191
|
+
select: (id: SelectionId$1) => void;
|
|
192
|
+
deselect: () => void;
|
|
193
|
+
toggle: (id: SelectionId$1) => void;
|
|
194
|
+
isSelected: (id: SelectionId$1) => boolean;
|
|
195
|
+
resetSelection: () => void;
|
|
196
|
+
}
|
|
197
|
+
export declare function useSingleSelection(initialSelectedId?: SelectionId$1): UseSingleSelectionReturn;
|
|
200
198
|
export interface UseOrderReturn<T> {
|
|
201
199
|
orderedItems: T[];
|
|
202
200
|
moveUp: (index: number) => void;
|
|
@@ -207,38 +205,34 @@ export interface UseOrderReturn<T> {
|
|
|
207
205
|
moveToBottom: (index: number) => void;
|
|
208
206
|
move: (fromIndex: number, toIndex: number) => void;
|
|
209
207
|
swap: (indexA: number, indexB: number) => void;
|
|
210
|
-
replaceOrder: (newOrderedItems: T[]) => void;
|
|
211
208
|
resetOrder: () => void;
|
|
209
|
+
replaceOrder: (newOrderedItems: T[]) => void;
|
|
212
210
|
}
|
|
213
211
|
export declare function useOrder<T>(initialItems: T[]): UseOrderReturn<T>;
|
|
214
|
-
export
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
export declare function usePagination<T>(data: T[], initialPageSize: number, initialPageIndex?: number): UsePaginationReturn<T>;
|
|
232
|
-
export interface UseSingleSelectionReturn {
|
|
233
|
-
selectedId: string | number | undefined;
|
|
234
|
-
hasSelection: boolean;
|
|
235
|
-
select: (id: string | number) => void;
|
|
236
|
-
deselect: () => void;
|
|
237
|
-
toggle: (id: string | number) => void;
|
|
238
|
-
isSelected: (id: string | number) => boolean;
|
|
239
|
-
resetSelection: () => void;
|
|
212
|
+
export type PinId = string | number;
|
|
213
|
+
export interface UsePinReturn<T> {
|
|
214
|
+
pinnedIds: PinId[];
|
|
215
|
+
pinnedItems: T[];
|
|
216
|
+
unpinnedItems: T[];
|
|
217
|
+
pinnedCount: number;
|
|
218
|
+
hasPins: boolean;
|
|
219
|
+
isAtMaxLimit: boolean;
|
|
220
|
+
pin: (itemOrId: PinId | T) => void;
|
|
221
|
+
unpin: (itemOrId: PinId | T) => void;
|
|
222
|
+
togglePin: (itemOrId: PinId | T) => void;
|
|
223
|
+
isPinned: (itemOrId: PinId | T) => boolean;
|
|
224
|
+
clearPins: () => void;
|
|
225
|
+
resetPins: () => void;
|
|
226
|
+
replacePins: (newPinnedItems: PinId[] | T[]) => void;
|
|
227
|
+
pinMultiple: (newItems: PinId[] | T[]) => void;
|
|
228
|
+
unpinMultiple: (itemsToRemove: PinId[] | T[]) => void;
|
|
240
229
|
}
|
|
241
|
-
export declare function
|
|
230
|
+
export declare function usePin<T = unknown>({ items, field, initialPinnedIds, maxPins, }: {
|
|
231
|
+
items: T[];
|
|
232
|
+
field?: string;
|
|
233
|
+
initialPinnedIds?: PinId[];
|
|
234
|
+
maxPins?: number;
|
|
235
|
+
}): UsePinReturn<T>;
|
|
242
236
|
export type SortType = "numeric" | "alphabetical" | "alphanumeric" | "boolean" | "date" | "basic" | "custom";
|
|
243
237
|
export interface BaseSortOptions {
|
|
244
238
|
desc?: boolean;
|
|
@@ -280,6 +274,54 @@ export interface UseSortReturn<T> {
|
|
|
280
274
|
getSortIndex: (id: string) => number | undefined;
|
|
281
275
|
}
|
|
282
276
|
export declare function useSort<T>(data: T[], initialSorts?: SortState): UseSortReturn<T>;
|
|
277
|
+
export interface UseModalStateReturn<TData> {
|
|
278
|
+
isOpen: boolean;
|
|
279
|
+
id: string | null;
|
|
280
|
+
data: TData | undefined;
|
|
281
|
+
}
|
|
282
|
+
export interface UseModalActionsReturn {
|
|
283
|
+
openModal: <T = unknown>(id: string, data?: T) => void;
|
|
284
|
+
closeModal: () => void;
|
|
285
|
+
clearModal: () => void;
|
|
286
|
+
}
|
|
287
|
+
export type UseModalReturn<TData> = UseModalStateReturn<TData> & UseModalActionsReturn;
|
|
288
|
+
export declare function useModalState<TData = unknown>(): UseModalStateReturn<TData>;
|
|
289
|
+
export declare function useModalActions(): UseModalActionsReturn;
|
|
290
|
+
export declare function useModal<TData = unknown>(): UseModalReturn<TData>;
|
|
291
|
+
export type VisibilityId = number | string;
|
|
292
|
+
export interface UseVisibilityReturn<T> {
|
|
293
|
+
visibleIds: VisibilityId[];
|
|
294
|
+
visibleItems: T[];
|
|
295
|
+
hiddenItems: T[];
|
|
296
|
+
visibleCount: number;
|
|
297
|
+
isVisible: (itemOrId: VisibilityId | T) => boolean;
|
|
298
|
+
show: (itemOrId: VisibilityId | T) => void;
|
|
299
|
+
hide: (itemOrId: VisibilityId | T) => void;
|
|
300
|
+
toggleVisibility: (itemOrId: VisibilityId | T) => void;
|
|
301
|
+
showAll: (itemsArray?: VisibilityId[] | T[]) => void;
|
|
302
|
+
hideAll: (itemsArray?: VisibilityId[] | T[]) => void;
|
|
303
|
+
resetVisibility: () => void;
|
|
304
|
+
replaceVisibility: (newItems: VisibilityId[] | T[]) => void;
|
|
305
|
+
}
|
|
306
|
+
export declare function useVisibility<T = unknown>({ items, field, initialVisibleIds, }: {
|
|
307
|
+
items: T[];
|
|
308
|
+
field?: string;
|
|
309
|
+
initialVisibleIds?: VisibilityId[];
|
|
310
|
+
}): UseVisibilityReturn<T>;
|
|
311
|
+
export interface DebounceOptions {
|
|
312
|
+
maxWait?: number;
|
|
313
|
+
leading?: boolean;
|
|
314
|
+
trailing?: boolean;
|
|
315
|
+
}
|
|
316
|
+
export interface UseDebounceReturn<Args extends any[]> {
|
|
317
|
+
debouncedFunc: (...args: Args) => void;
|
|
318
|
+
cancel: () => void;
|
|
319
|
+
flush: () => void;
|
|
320
|
+
isPending: boolean;
|
|
321
|
+
}
|
|
322
|
+
export declare function useDebounce<Args extends any[]>(func: (...args: Args) => void, delay: number, options?: DebounceOptions): UseDebounceReturn<Args>;
|
|
323
|
+
export type UseDebouncedValueReturn<T> = T;
|
|
324
|
+
export declare function useDebouncedValue<T>(value: T, delay: number, options?: DebounceOptions): UseDebouncedValueReturn<T>;
|
|
283
325
|
export interface ThrottleOptions {
|
|
284
326
|
leading?: boolean;
|
|
285
327
|
trailing?: boolean;
|
|
@@ -291,5 +333,31 @@ export interface UseThrottleReturn<Args extends any[]> {
|
|
|
291
333
|
isPending: boolean;
|
|
292
334
|
}
|
|
293
335
|
export declare function useThrottle<Args extends any[]>(func: (...args: Args) => void, delay: number, options?: ThrottleOptions): UseThrottleReturn<Args>;
|
|
336
|
+
declare const validKeyEventTypes: readonly [
|
|
337
|
+
"keydown",
|
|
338
|
+
"keyup",
|
|
339
|
+
"keypress"
|
|
340
|
+
];
|
|
341
|
+
export type KeyEventType = (typeof validKeyEventTypes)[number];
|
|
342
|
+
export interface BaseKeyOptions {
|
|
343
|
+
enabled?: boolean;
|
|
344
|
+
target?: React$1.RefObject<HTMLElement | null> | Window;
|
|
345
|
+
preventDefault?: boolean;
|
|
346
|
+
stopPropagation?: boolean;
|
|
347
|
+
ignoreWhenFocusedInInputs?: boolean;
|
|
348
|
+
ctrlKey?: boolean;
|
|
349
|
+
shiftKey?: boolean;
|
|
350
|
+
altKey?: boolean;
|
|
351
|
+
metaKey?: boolean;
|
|
352
|
+
}
|
|
353
|
+
export type KeyOptions = BaseKeyOptions & ({
|
|
354
|
+
eventType?: "keydown" | "keypress";
|
|
355
|
+
preventRepeat?: boolean;
|
|
356
|
+
} | {
|
|
357
|
+
eventType: "keyup";
|
|
358
|
+
preventRepeat?: never;
|
|
359
|
+
});
|
|
360
|
+
export type UseKeyReturn = void;
|
|
361
|
+
export declare function useKey(key: string, handler: (e: KeyboardEvent) => void, { enabled, preventDefault, stopPropagation, eventType, preventRepeat, ignoreWhenFocusedInInputs, ctrlKey, shiftKey, altKey, metaKey, target, }?: KeyOptions): UseKeyReturn;
|
|
294
362
|
|
|
295
363
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,44 +1,66 @@
|
|
|
1
1
|
import { createContext as e, useCallback as t, useContext as n, useEffect as r, useLayoutEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
//#region src/
|
|
5
|
-
|
|
2
|
+
import { Fragment as c, jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import { createPortal as u } from "react-dom";
|
|
4
|
+
//#region src/ui/highlight/FuzzyHighlighter.tsx
|
|
5
|
+
function d({ text: e, query: t, className: n = "", caseSensitive: r = !1 }) {
|
|
6
|
+
let i = t.trim();
|
|
7
|
+
if (!i || !e) return /* @__PURE__ */ l(c, { children: e });
|
|
8
|
+
let a = i.split(/\s+/).filter((e) => e.length > 0);
|
|
9
|
+
if (a.length === 0) return /* @__PURE__ */ l(c, { children: e });
|
|
10
|
+
let o = `fuzzy-highlight ${n}`.trim(), s = [...a].sort((e, t) => t.length - e.length).map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")), u = [...s];
|
|
11
|
+
if (s.length > 1) {
|
|
12
|
+
let e = a.map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("\\s+");
|
|
13
|
+
u.unshift(e);
|
|
14
|
+
}
|
|
15
|
+
if (i.length > 1 && i === i.toUpperCase() && /^[A-Z]+$/.test(i)) {
|
|
16
|
+
let e = i.split("").map((e) => `\\b${e}`).join("[^a-z0-9]*");
|
|
17
|
+
u.unshift(e);
|
|
18
|
+
}
|
|
19
|
+
let d = `(${u.join("|")})`, f = new RegExp(d, r ? "g" : "gi");
|
|
20
|
+
return /* @__PURE__ */ l(c, { children: e.split(f).map((e, t) => f.test(e) ? /* @__PURE__ */ l("strong", {
|
|
21
|
+
className: o,
|
|
22
|
+
children: e
|
|
23
|
+
}, t) : e) });
|
|
24
|
+
}
|
|
6
25
|
//#endregion
|
|
7
|
-
//#region src/
|
|
8
|
-
|
|
9
|
-
|
|
26
|
+
//#region src/ui/modal/ModalContext.tsx
|
|
27
|
+
var f = e(null), p = e(null);
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/ui/modal/useModal.ts
|
|
30
|
+
function m() {
|
|
31
|
+
let e = n(f);
|
|
10
32
|
if (!e) throw Error("useModalState must be used within a ModalProvider");
|
|
11
33
|
return e;
|
|
12
34
|
}
|
|
13
|
-
function
|
|
14
|
-
let e = n(
|
|
35
|
+
function h() {
|
|
36
|
+
let e = n(p);
|
|
15
37
|
if (!e) throw Error("useModalActions must be used within a ModalProvider");
|
|
16
38
|
return e;
|
|
17
39
|
}
|
|
18
|
-
function
|
|
40
|
+
function g() {
|
|
19
41
|
return {
|
|
20
|
-
...
|
|
21
|
-
...
|
|
42
|
+
...m(),
|
|
43
|
+
...h()
|
|
22
44
|
};
|
|
23
45
|
}
|
|
24
46
|
//#endregion
|
|
25
|
-
//#region src/
|
|
26
|
-
function
|
|
27
|
-
let { isOpen: d, id:
|
|
47
|
+
//#region src/ui/modal/Modal.tsx
|
|
48
|
+
function _({ modalId: e, children: t, wrapperClassName: n = "", wrapperStyle: i, containerClassName: a = "", containerStyle: c }) {
|
|
49
|
+
let { isOpen: d, id: f } = m(), { closeModal: p, clearModal: g } = h(), [_, v] = s(!1), y = o(null), b = f === e, x = d && b;
|
|
28
50
|
return r(() => {
|
|
29
51
|
let e = y.current;
|
|
30
52
|
e && (x && !e.open ? (v(!1), e.showModal()) : !x && e.open && v(!0));
|
|
31
|
-
}, [x]), typeof document > "u" || !b && !_ ? null :
|
|
53
|
+
}, [x]), typeof document > "u" || !b && !_ ? null : u(/* @__PURE__ */ l("dialog", {
|
|
32
54
|
ref: y,
|
|
33
55
|
onCancel: (e) => {
|
|
34
|
-
e.preventDefault(),
|
|
56
|
+
e.preventDefault(), p();
|
|
35
57
|
},
|
|
36
|
-
onClose:
|
|
58
|
+
onClose: p,
|
|
37
59
|
onClick: (e) => {
|
|
38
60
|
let t = y.current;
|
|
39
61
|
if (!t) return;
|
|
40
62
|
let n = t.getBoundingClientRect();
|
|
41
|
-
(e.clientX < n.x || e.clientX > n.x + n.width || e.clientY < n.y || e.clientY > n.y + n.height) &&
|
|
63
|
+
(e.clientX < n.x || e.clientX > n.x + n.width || e.clientY < n.y || e.clientY > n.y + n.height) && p();
|
|
42
64
|
},
|
|
43
65
|
onAnimationEnd: () => {
|
|
44
66
|
if (_) {
|
|
@@ -50,54 +72,21 @@ function h({ modalId: e, children: t, wrapperClassName: n = "", wrapperStyle: i,
|
|
|
50
72
|
style: i,
|
|
51
73
|
children: /* @__PURE__ */ l("div", {
|
|
52
74
|
className: `modal-container ${a}`.trim(),
|
|
53
|
-
style:
|
|
75
|
+
style: c,
|
|
54
76
|
children: t
|
|
55
77
|
})
|
|
56
78
|
}), document.body);
|
|
57
79
|
}
|
|
58
80
|
//#endregion
|
|
59
|
-
//#region src/
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
r
|
|
63
|
-
|
|
64
|
-
}, [e]);
|
|
65
|
-
let _ = t(() => {
|
|
66
|
-
p.current &&= (clearTimeout(p.current), null), m.current = -1, h.current = -1, g.current = null, c(!1);
|
|
67
|
-
}, []), v = t(() => {
|
|
68
|
-
p.current && g.current && (clearTimeout(p.current), p.current = null, f.current(...g.current), m.current = Date.now(), h.current = -1, g.current = null, c(!1));
|
|
69
|
-
}, []);
|
|
70
|
-
return r(() => () => {
|
|
71
|
-
_();
|
|
72
|
-
}, [_]), {
|
|
73
|
-
debouncedFunc: t((...e) => {
|
|
74
|
-
c(!0), h.current = Date.now(), g.current = e, m.current === -1 && (m.current = Date.now(), u === !0 && f.current(...e)), l !== void 0 && Date.now() - m.current >= l ? (p.current && clearTimeout(p.current), f.current(...e), m.current = -1, c(!1)) : (p.current && clearTimeout(p.current), p.current = setTimeout(() => {
|
|
75
|
-
h.current !== m.current && d !== !1 && f.current(...e), m.current = -1, c(!1);
|
|
76
|
-
}, n));
|
|
77
|
-
}, [
|
|
78
|
-
n,
|
|
79
|
-
l,
|
|
80
|
-
d,
|
|
81
|
-
u
|
|
82
|
-
]),
|
|
83
|
-
cancel: _,
|
|
84
|
-
flush: v,
|
|
85
|
-
isPending: a
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region src/hooks/useDebouncedValue.ts
|
|
90
|
-
function _(e, t, n = {}) {
|
|
91
|
-
let [i, a] = s(e), { debouncedFunc: o } = g((e) => {
|
|
92
|
-
a(e);
|
|
93
|
-
}, t, n);
|
|
94
|
-
return r(() => {
|
|
95
|
-
o(e);
|
|
96
|
-
}, [e, o]), i;
|
|
81
|
+
//#region src/shared/utils.ts
|
|
82
|
+
function v(e, t, n) {
|
|
83
|
+
if (typeof e != "object" || !e) return e;
|
|
84
|
+
let r = t ?? n ?? "";
|
|
85
|
+
return Array.isArray(r) ? r.reduce((e, t) => e?.[t], e) : r.includes(".") ? r.split(".").reduce((e, t) => e?.[t], e) : e?.[r];
|
|
97
86
|
}
|
|
98
87
|
//#endregion
|
|
99
|
-
//#region src/utils
|
|
100
|
-
var
|
|
88
|
+
//#region src/state/filter/utils.ts
|
|
89
|
+
var y = {
|
|
101
90
|
text: {
|
|
102
91
|
contains: (e, t, n) => e == null ? !1 : n?.caseSensitive ? String(e).includes(String(t)) : String(e).toLowerCase().includes(String(t).toLowerCase()),
|
|
103
92
|
equals: (e, t, n) => e == null ? !1 : n?.caseSensitive ? String(e) === String(t) : String(e).toLowerCase() === String(t).toLowerCase(),
|
|
@@ -153,48 +142,41 @@ var v = {
|
|
|
153
142
|
}
|
|
154
143
|
};
|
|
155
144
|
//#endregion
|
|
156
|
-
//#region src/
|
|
157
|
-
function y(e, t, n) {
|
|
158
|
-
if (typeof e != "object" || !e) return e;
|
|
159
|
-
let r = t ?? n ?? "";
|
|
160
|
-
return Array.isArray(r) ? r.reduce((e, t) => e?.[t], e) : r.includes(".") ? r.split(".").reduce((e, t) => e?.[t], e) : e?.[r];
|
|
161
|
-
}
|
|
162
|
-
//#endregion
|
|
163
|
-
//#region src/hooks/useFilter.ts
|
|
145
|
+
//#region src/state/filter/useFilter.ts
|
|
164
146
|
function b(e, n = []) {
|
|
165
|
-
let
|
|
166
|
-
let t =
|
|
147
|
+
let r = o(n), [i, c] = s(() => n), l = a(() => {
|
|
148
|
+
let t = i.filter((e) => e.isActive !== !1).map((e) => ({
|
|
167
149
|
...e,
|
|
168
150
|
pathArray: (e.field || e.id).split(".")
|
|
169
151
|
}));
|
|
170
152
|
return e.filter((e) => t.every((t) => {
|
|
171
|
-
let { id: n, type: r, operator: i, value: a, compare: o, pathArray: s } = t, c =
|
|
172
|
-
if (r === "custom") return o
|
|
173
|
-
let l =
|
|
153
|
+
let { id: n, type: r, operator: i, value: a, compare: o, pathArray: s } = t, c = v(e, s, n);
|
|
154
|
+
if (r === "custom") return !o || o(c, a, e);
|
|
155
|
+
let l = y[r];
|
|
174
156
|
if (!l) return !0;
|
|
175
157
|
let u = l[i];
|
|
176
|
-
return u
|
|
158
|
+
return !u || u(c, a, t);
|
|
177
159
|
}));
|
|
178
|
-
}, [e,
|
|
179
|
-
|
|
180
|
-
}, []),
|
|
181
|
-
|
|
182
|
-
}, []),
|
|
183
|
-
|
|
184
|
-
}, []),
|
|
185
|
-
|
|
186
|
-
}, [
|
|
187
|
-
|
|
160
|
+
}, [e, i]), u = t((e) => {
|
|
161
|
+
c((t) => t.some((t) => t.id === e.id) ? t.map((t) => t.id === e.id ? e : t) : [...t, e]);
|
|
162
|
+
}, []), d = t((e) => {
|
|
163
|
+
c((t) => Array.isArray(e) ? t.filter((t) => !e.includes(t.id)) : t.filter((t) => t.id !== e));
|
|
164
|
+
}, []), f = t(() => {
|
|
165
|
+
c([]);
|
|
166
|
+
}, []), p = t(() => {
|
|
167
|
+
c(r.current);
|
|
168
|
+
}, []), m = t((e) => {
|
|
169
|
+
c(e);
|
|
188
170
|
}, []);
|
|
189
171
|
return {
|
|
190
|
-
filteredItems:
|
|
191
|
-
filters:
|
|
192
|
-
upsertFilter:
|
|
193
|
-
removeFilter:
|
|
194
|
-
clearFilters:
|
|
195
|
-
resetFilters:
|
|
172
|
+
filteredItems: l,
|
|
173
|
+
filters: i,
|
|
174
|
+
upsertFilter: u,
|
|
175
|
+
removeFilter: d,
|
|
176
|
+
clearFilters: f,
|
|
177
|
+
resetFilters: p,
|
|
196
178
|
toggleFilter: t((e) => {
|
|
197
|
-
|
|
179
|
+
c((t) => t.some((t) => t.id === e.id) ? t.map((t) => t.id === e.id ? {
|
|
198
180
|
...t,
|
|
199
181
|
isActive: t.isActive === !1
|
|
200
182
|
} : t) : [...t, {
|
|
@@ -203,27 +185,27 @@ function b(e, n = []) {
|
|
|
203
185
|
}]);
|
|
204
186
|
}, []),
|
|
205
187
|
updateFilterConfig: t((e, t) => {
|
|
206
|
-
|
|
188
|
+
c((n) => n.map((n) => n.id === e ? {
|
|
207
189
|
...n,
|
|
208
190
|
...t
|
|
209
191
|
} : n));
|
|
210
192
|
}, []),
|
|
211
|
-
replaceFilters:
|
|
212
|
-
getFilterValue: t((e) =>
|
|
193
|
+
replaceFilters: m,
|
|
194
|
+
getFilterValue: t((e) => i.find((t) => t.id === e)?.value, [i]),
|
|
213
195
|
updateFilterValue: t((e, t) => {
|
|
214
|
-
|
|
196
|
+
c((n) => n.map((n) => n.id === e ? {
|
|
215
197
|
...n,
|
|
216
198
|
value: t
|
|
217
199
|
} : n));
|
|
218
200
|
}, []),
|
|
219
201
|
isFilterActive: t((e) => {
|
|
220
|
-
let t =
|
|
202
|
+
let t = i.find((t) => t.id === e);
|
|
221
203
|
return t ? t.isActive !== !1 : !1;
|
|
222
|
-
}, [
|
|
204
|
+
}, [i])
|
|
223
205
|
};
|
|
224
206
|
}
|
|
225
207
|
//#endregion
|
|
226
|
-
//#region src/utils
|
|
208
|
+
//#region src/state/fuzzy-search/utils.ts
|
|
227
209
|
function x(e, t, n = !1) {
|
|
228
210
|
let r = e.trim(), i = t.trim(), a = r.length > 1 && r === r.toUpperCase() && /^[A-Z]+$/.test(r);
|
|
229
211
|
if (n || (r = r.toLowerCase(), i = i.toLowerCase()), r === i) return 1;
|
|
@@ -272,12 +254,12 @@ function x(e, t, n = !1) {
|
|
|
272
254
|
return Math.max(0, _ * .45);
|
|
273
255
|
}
|
|
274
256
|
//#endregion
|
|
275
|
-
//#region src/
|
|
257
|
+
//#region src/state/fuzzy-search/useFuzzySearch.ts
|
|
276
258
|
function S(e, t, n, r = {}) {
|
|
277
259
|
let i = r.threshold ?? .01, o = r.caseSensitive ?? !1, s = r.matchStrategy ?? "any", c = r.exactPhraseBonus ?? !0, l = a(() => n.length === 0 || e.length === 0 ? [] : e.map((e, t) => {
|
|
278
260
|
let r = [], i = [];
|
|
279
261
|
for (let { field: t, weight: a } of n) {
|
|
280
|
-
let n =
|
|
262
|
+
let n = v(e, t);
|
|
281
263
|
if (Array.isArray(n)) {
|
|
282
264
|
for (let e of n) if (e != null && e !== "" && typeof e != "object") {
|
|
283
265
|
let t = String(e);
|
|
@@ -354,198 +336,36 @@ function S(e, t, n, r = {}) {
|
|
|
354
336
|
]);
|
|
355
337
|
}
|
|
356
338
|
//#endregion
|
|
357
|
-
//#region src/
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
]
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}, [
|
|
370
|
-
|
|
371
|
-
}, [n]),
|
|
372
|
-
let t = h && "current" in h ? h.current : h;
|
|
373
|
-
if (!t) return;
|
|
374
|
-
let n = e.toLowerCase(), r = C.includes(c) ? c : "keydown", i = l && r !== "keyup";
|
|
375
|
-
function o() {
|
|
376
|
-
v.current = !1;
|
|
377
|
-
}
|
|
378
|
-
function y(e) {
|
|
379
|
-
if (!(e instanceof KeyboardEvent)) return;
|
|
380
|
-
let t = e.key.toLowerCase();
|
|
381
|
-
(t === n || d && t === "control" || f && t === "shift" || p && t === "alt" || m && t === "meta") && (v.current = !1);
|
|
382
|
-
}
|
|
383
|
-
function b(e) {
|
|
384
|
-
if (!(e instanceof KeyboardEvent) || !_.current) return;
|
|
385
|
-
let t = e.target;
|
|
386
|
-
if (!(u && t instanceof HTMLElement && (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement || t.isContentEditable)) && e.ctrlKey === d && e.shiftKey === f && e.altKey === p && e.metaKey === m && n === e.key.toLowerCase()) {
|
|
387
|
-
if (i && v.current) return;
|
|
388
|
-
v.current = !0, g.current(e), a && e.preventDefault(), s && e.stopPropagation();
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
return t.addEventListener(r, b), i && (t.addEventListener("keyup", y), window.addEventListener("blur", o)), () => {
|
|
392
|
-
t.removeEventListener(r, b), i && (t.removeEventListener("keyup", y), window.removeEventListener("blur", o));
|
|
393
|
-
};
|
|
394
|
-
}, [
|
|
395
|
-
e,
|
|
396
|
-
a,
|
|
397
|
-
s,
|
|
398
|
-
c,
|
|
399
|
-
l,
|
|
400
|
-
u,
|
|
401
|
-
d,
|
|
402
|
-
f,
|
|
403
|
-
p,
|
|
404
|
-
m,
|
|
405
|
-
h
|
|
406
|
-
]);
|
|
407
|
-
}
|
|
408
|
-
//#endregion
|
|
409
|
-
//#region src/hooks/useMultipleSelection.ts
|
|
410
|
-
function T({ items: e, field: n, initialSelectedIds: r = [] }) {
|
|
411
|
-
let [i, o] = s(new Set(r)), c = t((e) => {
|
|
412
|
-
o((t) => {
|
|
413
|
-
let r = new Set(t), i = y(e, n);
|
|
414
|
-
return r.add(i), r;
|
|
415
|
-
});
|
|
416
|
-
}, [n]), l = t((e) => {
|
|
417
|
-
o((t) => {
|
|
418
|
-
let r = new Set(t), i = y(e, n);
|
|
419
|
-
return r.delete(i), r;
|
|
420
|
-
});
|
|
421
|
-
}, [n]), u = t((e) => {
|
|
422
|
-
o((t) => {
|
|
423
|
-
let r = new Set(t), i = y(e, n);
|
|
424
|
-
return r.has(i) ? r.delete(i) : r.add(i), r;
|
|
425
|
-
});
|
|
426
|
-
}, [n]), d = t((e) => {
|
|
427
|
-
let t = y(e, n);
|
|
428
|
-
return i.has(t);
|
|
429
|
-
}, [i, n]), f = t((e) => {
|
|
430
|
-
let t = e.map((e) => y(e, n));
|
|
431
|
-
o(new Set(t));
|
|
432
|
-
}, [n]), p = t(() => o(new Set(r)), [r]), m = t(() => {
|
|
433
|
-
let t = e.map((e) => y(e, n));
|
|
434
|
-
o(new Set(t));
|
|
435
|
-
}, [e, n]), h = t(() => {
|
|
436
|
-
o(/* @__PURE__ */ new Set());
|
|
437
|
-
}, []), g = t(() => o((t) => {
|
|
438
|
-
if (t.size === e.length) return /* @__PURE__ */ new Set();
|
|
439
|
-
let r = e.map((e) => y(e, n));
|
|
440
|
-
return new Set(r);
|
|
441
|
-
}), [e, n]), _ = t(() => o((t) => {
|
|
442
|
-
if (t.size === e.length) return /* @__PURE__ */ new Set();
|
|
443
|
-
let r = e.filter((e) => !t.has(y(e, n))).map((e) => y(e, n));
|
|
444
|
-
return new Set(r);
|
|
445
|
-
}), [e, n]), v = t((e) => {
|
|
446
|
-
o((t) => {
|
|
447
|
-
let r = new Set(t);
|
|
448
|
-
return e.map((e) => y(e, n)).forEach((e) => r.add(e)), r;
|
|
449
|
-
});
|
|
450
|
-
}, [n]), b = t((e) => {
|
|
451
|
-
o((t) => {
|
|
452
|
-
let r = new Set(t);
|
|
453
|
-
return e.map((e) => y(e, n)).forEach((e) => r.delete(e)), r;
|
|
454
|
-
});
|
|
455
|
-
}, [n]), x = t((e) => {
|
|
456
|
-
o((t) => {
|
|
457
|
-
let r = /* @__PURE__ */ new Set();
|
|
458
|
-
return e.map((e) => y(e, n)).forEach((e) => t.has(e) && r.add(e)), r;
|
|
459
|
-
});
|
|
460
|
-
}, [n]), S = a(() => e.filter((e) => {
|
|
461
|
-
let t = y(e, n);
|
|
462
|
-
return i.has(t);
|
|
463
|
-
}), [
|
|
464
|
-
e,
|
|
465
|
-
n,
|
|
466
|
-
i
|
|
467
|
-
]);
|
|
468
|
-
return {
|
|
469
|
-
selectedIds: [...i],
|
|
470
|
-
selectedCount: i.size,
|
|
471
|
-
selectedItems: S,
|
|
472
|
-
isEmpty: i.size === 0,
|
|
473
|
-
select: c,
|
|
474
|
-
deselect: l,
|
|
475
|
-
toggle: u,
|
|
476
|
-
isSelected: d,
|
|
477
|
-
replaceSelection: f,
|
|
478
|
-
resetSelection: p,
|
|
479
|
-
selectAll: m,
|
|
480
|
-
deselectAll: h,
|
|
481
|
-
toggleAll: g,
|
|
482
|
-
invertSelection: _,
|
|
483
|
-
selectMultiple: v,
|
|
484
|
-
deselectMultiple: b,
|
|
485
|
-
retainOnly: x
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
//#endregion
|
|
489
|
-
//#region src/hooks/useOrder.ts
|
|
490
|
-
function E(e) {
|
|
491
|
-
let n = o(e), [r, i] = s(e);
|
|
339
|
+
//#region src/state/grouping/useGrouping.ts
|
|
340
|
+
function C({ items: e, initialGroupBy: n }) {
|
|
341
|
+
let [r, i] = s(n), o = a(() => r ? e.reduce((e, t) => {
|
|
342
|
+
let n = v(t, r), i = n == null ? "Unknown" : String(n);
|
|
343
|
+
return e[i] || (e[i] = []), e[i].push(t), e;
|
|
344
|
+
}, {}) : { Ungrouped: e }, [e, r]), c = a(() => Object.keys(o).map((e) => ({
|
|
345
|
+
key: e,
|
|
346
|
+
items: o[e]
|
|
347
|
+
})), [o]), l = a(() => Object.keys(o), [o]), u = t((e) => {
|
|
348
|
+
i(e);
|
|
349
|
+
}, []), d = t(() => {
|
|
350
|
+
i(void 0);
|
|
351
|
+
}, []), f = t(() => {
|
|
352
|
+
i(n);
|
|
353
|
+
}, [n]), p = t((e) => o[e] || [], [o]);
|
|
492
354
|
return {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
typeof e == "number" && i((t) => {
|
|
503
|
-
if (e < 0 || e >= t.length - 1) return t;
|
|
504
|
-
let n = [...t];
|
|
505
|
-
return [n[e], n[e + 1]] = [n[e + 1], n[e]], n;
|
|
506
|
-
});
|
|
507
|
-
}, []),
|
|
508
|
-
canMoveUp: t((e) => e > 0, []),
|
|
509
|
-
canMoveDown: t((e) => e < r.length - 1, [r.length]),
|
|
510
|
-
moveToTop: t((e) => {
|
|
511
|
-
typeof e == "number" && i((t) => {
|
|
512
|
-
if (e <= 0 || e >= t.length) return t;
|
|
513
|
-
let n = [...t], [r] = n.splice(e, 1);
|
|
514
|
-
return n.unshift(r), n;
|
|
515
|
-
});
|
|
516
|
-
}, []),
|
|
517
|
-
moveToBottom: t((e) => {
|
|
518
|
-
typeof e == "number" && i((t) => {
|
|
519
|
-
if (e < 0 || e >= t.length - 1) return t;
|
|
520
|
-
let n = [...t], [r] = n.splice(e, 1);
|
|
521
|
-
return n.push(r), n;
|
|
522
|
-
});
|
|
523
|
-
}, []),
|
|
524
|
-
move: t((e, t) => {
|
|
525
|
-
typeof e != "number" || typeof t != "number" || e === t || i((n) => {
|
|
526
|
-
if (e < 0 || e >= n.length || t < 0 || t >= n.length) return n;
|
|
527
|
-
let r = [...n], [i] = r.splice(e, 1);
|
|
528
|
-
return r.splice(t, 0, i), r;
|
|
529
|
-
});
|
|
530
|
-
}, []),
|
|
531
|
-
swap: t((e, t) => {
|
|
532
|
-
typeof e != "number" || typeof t != "number" || e === t || i((n) => {
|
|
533
|
-
if (e < 0 || e >= n.length || t < 0 || t >= n.length) return n;
|
|
534
|
-
let r = [...n];
|
|
535
|
-
return [r[e], r[t]] = [r[t], r[e]], r;
|
|
536
|
-
});
|
|
537
|
-
}, []),
|
|
538
|
-
replaceOrder: t((e) => {
|
|
539
|
-
i(e);
|
|
540
|
-
}, []),
|
|
541
|
-
resetOrder: t(() => {
|
|
542
|
-
i(n.current);
|
|
543
|
-
}, [])
|
|
355
|
+
groupedRecord: o,
|
|
356
|
+
groupedArray: c,
|
|
357
|
+
groupKeys: l,
|
|
358
|
+
totalGroups: l.length,
|
|
359
|
+
activeGroupBy: r,
|
|
360
|
+
changeGroupBy: u,
|
|
361
|
+
clearGrouping: d,
|
|
362
|
+
resetGrouping: f,
|
|
363
|
+
getGroupItems: p
|
|
544
364
|
};
|
|
545
365
|
}
|
|
546
366
|
//#endregion
|
|
547
|
-
//#region src/
|
|
548
|
-
function
|
|
367
|
+
//#region src/state/pagination/usePagination.ts
|
|
368
|
+
function w(e, n, r = 0) {
|
|
549
369
|
let [i, o] = s(n), [c, l] = s(r), u = Math.max(1, Math.ceil(e.length / Math.max(1, i))), d = Math.min(Math.max(0, c), u - 1);
|
|
550
370
|
return c !== d && l(d), {
|
|
551
371
|
pageItems: a(() => typeof i != "number" || i < 1 ? [] : e.slice(c * i, (c + 1) * i), [
|
|
@@ -600,8 +420,88 @@ function D(e, n, r = 0) {
|
|
|
600
420
|
};
|
|
601
421
|
}
|
|
602
422
|
//#endregion
|
|
603
|
-
//#region src/
|
|
604
|
-
function
|
|
423
|
+
//#region src/state/selection/useMultipleSelection.ts
|
|
424
|
+
function T({ items: e, field: n, initialSelectedIds: r = [] }) {
|
|
425
|
+
let i = o(r), [c, l] = s(() => new Set(r)), u = t((e) => {
|
|
426
|
+
l((t) => {
|
|
427
|
+
let r = new Set(t), i = v(e, n);
|
|
428
|
+
return r.add(i), r;
|
|
429
|
+
});
|
|
430
|
+
}, [n]), d = t((e) => {
|
|
431
|
+
l((t) => {
|
|
432
|
+
let r = new Set(t), i = v(e, n);
|
|
433
|
+
return r.delete(i), r;
|
|
434
|
+
});
|
|
435
|
+
}, [n]), f = t((e) => {
|
|
436
|
+
l((t) => {
|
|
437
|
+
let r = new Set(t), i = v(e, n);
|
|
438
|
+
return r.has(i) ? r.delete(i) : r.add(i), r;
|
|
439
|
+
});
|
|
440
|
+
}, [n]), p = t((e) => {
|
|
441
|
+
let t = v(e, n);
|
|
442
|
+
return c.has(t);
|
|
443
|
+
}, [c, n]), m = t(() => l(new Set(i.current)), []), h = t((e) => {
|
|
444
|
+
let t = e.map((e) => v(e, n));
|
|
445
|
+
l(new Set(t));
|
|
446
|
+
}, [n]), g = t(() => {
|
|
447
|
+
let t = e.map((e) => v(e, n));
|
|
448
|
+
l(new Set(t));
|
|
449
|
+
}, [e, n]), _ = t(() => {
|
|
450
|
+
l(/* @__PURE__ */ new Set());
|
|
451
|
+
}, []), y = t(() => l((t) => {
|
|
452
|
+
if (t.size === e.length) return /* @__PURE__ */ new Set();
|
|
453
|
+
let r = e.map((e) => v(e, n));
|
|
454
|
+
return new Set(r);
|
|
455
|
+
}), [e, n]), b = t(() => l((t) => {
|
|
456
|
+
if (t.size === e.length) return /* @__PURE__ */ new Set();
|
|
457
|
+
let r = e.filter((e) => !t.has(v(e, n))).map((e) => v(e, n));
|
|
458
|
+
return new Set(r);
|
|
459
|
+
}), [e, n]), x = t((e) => {
|
|
460
|
+
l((t) => {
|
|
461
|
+
let r = new Set(t);
|
|
462
|
+
return e.map((e) => v(e, n)).forEach((e) => r.add(e)), r;
|
|
463
|
+
});
|
|
464
|
+
}, [n]), S = t((e) => {
|
|
465
|
+
l((t) => {
|
|
466
|
+
let r = new Set(t);
|
|
467
|
+
return e.map((e) => v(e, n)).forEach((e) => r.delete(e)), r;
|
|
468
|
+
});
|
|
469
|
+
}, [n]), C = t((e) => {
|
|
470
|
+
l((t) => {
|
|
471
|
+
let r = /* @__PURE__ */ new Set();
|
|
472
|
+
return e.map((e) => v(e, n)).forEach((e) => t.has(e) && r.add(e)), r;
|
|
473
|
+
});
|
|
474
|
+
}, [n]), w = a(() => e.filter((e) => {
|
|
475
|
+
let t = v(e, n);
|
|
476
|
+
return c.has(t);
|
|
477
|
+
}), [
|
|
478
|
+
e,
|
|
479
|
+
n,
|
|
480
|
+
c
|
|
481
|
+
]);
|
|
482
|
+
return {
|
|
483
|
+
selectedIds: [...c],
|
|
484
|
+
selectedCount: c.size,
|
|
485
|
+
selectedItems: w,
|
|
486
|
+
isEmpty: c.size === 0,
|
|
487
|
+
select: u,
|
|
488
|
+
deselect: d,
|
|
489
|
+
toggle: f,
|
|
490
|
+
isSelected: p,
|
|
491
|
+
replaceSelection: h,
|
|
492
|
+
resetSelection: m,
|
|
493
|
+
selectAll: g,
|
|
494
|
+
deselectAll: _,
|
|
495
|
+
toggleAll: y,
|
|
496
|
+
invertSelection: b,
|
|
497
|
+
selectMultiple: x,
|
|
498
|
+
deselectMultiple: S,
|
|
499
|
+
retainOnly: C
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region src/state/selection/useSingleSelection.ts
|
|
504
|
+
function E(e) {
|
|
605
505
|
let [n, r] = s(e), i = t((e) => r(e), []), a = t(() => r(void 0), []), o = t((e) => r((t) => t === e ? void 0 : e), []), c = t((e) => n === e, [n]), l = t(() => r(e), [e]);
|
|
606
506
|
return {
|
|
607
507
|
selectedId: n,
|
|
@@ -614,7 +514,142 @@ function O(e) {
|
|
|
614
514
|
};
|
|
615
515
|
}
|
|
616
516
|
//#endregion
|
|
617
|
-
//#region src/
|
|
517
|
+
//#region src/state/sort/useOrder.ts
|
|
518
|
+
function D(e) {
|
|
519
|
+
let n = o(e), [r, i] = s(() => e), a = t((e) => {
|
|
520
|
+
typeof e == "number" && i((t) => {
|
|
521
|
+
if (e <= 0 || e >= t.length) return t;
|
|
522
|
+
let n = [...t];
|
|
523
|
+
return [n[e], n[e - 1]] = [n[e - 1], n[e]], n;
|
|
524
|
+
});
|
|
525
|
+
}, []), c = t((e) => {
|
|
526
|
+
typeof e == "number" && i((t) => {
|
|
527
|
+
if (e < 0 || e >= t.length - 1) return t;
|
|
528
|
+
let n = [...t];
|
|
529
|
+
return [n[e], n[e + 1]] = [n[e + 1], n[e]], n;
|
|
530
|
+
});
|
|
531
|
+
}, []), l = t((e) => e > 0, []), u = t((e) => e < r.length - 1, [r.length]), d = t((e) => {
|
|
532
|
+
typeof e == "number" && i((t) => {
|
|
533
|
+
if (e <= 0 || e >= t.length) return t;
|
|
534
|
+
let n = [...t], [r] = n.splice(e, 1);
|
|
535
|
+
return n.unshift(r), n;
|
|
536
|
+
});
|
|
537
|
+
}, []), f = t((e) => {
|
|
538
|
+
typeof e == "number" && i((t) => {
|
|
539
|
+
if (e < 0 || e >= t.length - 1) return t;
|
|
540
|
+
let n = [...t], [r] = n.splice(e, 1);
|
|
541
|
+
return n.push(r), n;
|
|
542
|
+
});
|
|
543
|
+
}, []), p = t((e, t) => {
|
|
544
|
+
typeof e != "number" || typeof t != "number" || e === t || i((n) => {
|
|
545
|
+
if (e < 0 || e >= n.length || t < 0 || t >= n.length) return n;
|
|
546
|
+
let r = [...n], [i] = r.splice(e, 1);
|
|
547
|
+
return r.splice(t, 0, i), r;
|
|
548
|
+
});
|
|
549
|
+
}, []), m = t((e, t) => {
|
|
550
|
+
typeof e != "number" || typeof t != "number" || e === t || i((n) => {
|
|
551
|
+
if (e < 0 || e >= n.length || t < 0 || t >= n.length) return n;
|
|
552
|
+
let r = [...n];
|
|
553
|
+
return [r[e], r[t]] = [r[t], r[e]], r;
|
|
554
|
+
});
|
|
555
|
+
}, []), h = t(() => {
|
|
556
|
+
i(n.current);
|
|
557
|
+
}, []);
|
|
558
|
+
return {
|
|
559
|
+
orderedItems: r,
|
|
560
|
+
moveUp: a,
|
|
561
|
+
moveDown: c,
|
|
562
|
+
canMoveUp: l,
|
|
563
|
+
canMoveDown: u,
|
|
564
|
+
moveToTop: d,
|
|
565
|
+
moveToBottom: f,
|
|
566
|
+
move: p,
|
|
567
|
+
swap: m,
|
|
568
|
+
replaceOrder: t((e) => {
|
|
569
|
+
i(e);
|
|
570
|
+
}, []),
|
|
571
|
+
resetOrder: h
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
//#endregion
|
|
575
|
+
//#region src/state/sort/usePin.ts
|
|
576
|
+
function O({ items: e, field: n, initialPinnedIds: r = [], maxPins: i = 2 ** 53 - 1 }) {
|
|
577
|
+
let c = o(r), [l, u] = s(() => new Set(r)), d = t((e) => {
|
|
578
|
+
u((t) => {
|
|
579
|
+
if (t.size >= i) return t;
|
|
580
|
+
let r = new Set(t), a = v(e, n);
|
|
581
|
+
return r.add(a), r;
|
|
582
|
+
});
|
|
583
|
+
}, [n, i]), f = t((e) => {
|
|
584
|
+
u((t) => {
|
|
585
|
+
let r = new Set(t), i = v(e, n);
|
|
586
|
+
return r.delete(i), r;
|
|
587
|
+
});
|
|
588
|
+
}, [n]), p = t((e) => {
|
|
589
|
+
u((t) => {
|
|
590
|
+
let r = new Set(t), a = v(e, n);
|
|
591
|
+
if (r.has(a)) r.delete(a);
|
|
592
|
+
else {
|
|
593
|
+
if (r.size >= i) return t;
|
|
594
|
+
r.add(a);
|
|
595
|
+
}
|
|
596
|
+
return r;
|
|
597
|
+
});
|
|
598
|
+
}, [n, i]), m = t((e) => {
|
|
599
|
+
let t = v(e, n);
|
|
600
|
+
return l.has(t);
|
|
601
|
+
}, [l, n]), h = t(() => u(/* @__PURE__ */ new Set()), []), g = t(() => u(new Set(c.current)), [c]), _ = t((e) => {
|
|
602
|
+
let t = e.map((e) => v(e, n));
|
|
603
|
+
u(new Set(t.slice(0, i)));
|
|
604
|
+
}, [n, i]), y = t((e) => {
|
|
605
|
+
u((t) => {
|
|
606
|
+
let r = new Set(t), a = e.map((e) => v(e, n));
|
|
607
|
+
for (let e of a) {
|
|
608
|
+
if (r.size >= i && !r.has(e)) break;
|
|
609
|
+
r.add(e);
|
|
610
|
+
}
|
|
611
|
+
return r;
|
|
612
|
+
});
|
|
613
|
+
}, [n, i]), b = t((e) => {
|
|
614
|
+
u((t) => {
|
|
615
|
+
let r = new Set(t);
|
|
616
|
+
return e.map((e) => v(e, n)).forEach((e) => r.delete(e)), r;
|
|
617
|
+
});
|
|
618
|
+
}, [n]), x = a(() => e.filter((e) => {
|
|
619
|
+
let t = v(e, n);
|
|
620
|
+
return l.has(t);
|
|
621
|
+
}), [
|
|
622
|
+
e,
|
|
623
|
+
n,
|
|
624
|
+
l
|
|
625
|
+
]), S = a(() => e.filter((e) => {
|
|
626
|
+
let t = v(e, n);
|
|
627
|
+
return !l.has(t);
|
|
628
|
+
}), [
|
|
629
|
+
e,
|
|
630
|
+
n,
|
|
631
|
+
l
|
|
632
|
+
]);
|
|
633
|
+
return {
|
|
634
|
+
pinnedIds: [...l],
|
|
635
|
+
pinnedItems: x,
|
|
636
|
+
unpinnedItems: S,
|
|
637
|
+
pinnedCount: l.size,
|
|
638
|
+
hasPins: l.size > 0,
|
|
639
|
+
isAtMaxLimit: l.size >= i,
|
|
640
|
+
pin: d,
|
|
641
|
+
unpin: f,
|
|
642
|
+
togglePin: p,
|
|
643
|
+
isPinned: m,
|
|
644
|
+
clearPins: h,
|
|
645
|
+
resetPins: g,
|
|
646
|
+
replacePins: _,
|
|
647
|
+
pinMultiple: y,
|
|
648
|
+
unpinMultiple: b
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
//#endregion
|
|
652
|
+
//#region src/state/sort/utils.ts
|
|
618
653
|
function k(e, t, n = {}) {
|
|
619
654
|
let { sortUndefined: r, desc: i = !1 } = n, a = I(e, t, r, i);
|
|
620
655
|
if (a !== null) return a;
|
|
@@ -673,16 +708,16 @@ function I(e, t, n = "last", r) {
|
|
|
673
708
|
return null;
|
|
674
709
|
}
|
|
675
710
|
//#endregion
|
|
676
|
-
//#region src/
|
|
711
|
+
//#region src/state/sort/useSort.ts
|
|
677
712
|
function L(e, n = []) {
|
|
678
|
-
let
|
|
679
|
-
let t =
|
|
713
|
+
let r = o(n), [i, c] = s(() => n), l = a(() => {
|
|
714
|
+
let t = i.map((e) => ({
|
|
680
715
|
...e,
|
|
681
716
|
pathArray: (e.field || e.id).split(".")
|
|
682
717
|
}));
|
|
683
718
|
return [...e].sort((e, n) => {
|
|
684
719
|
for (let r of t) {
|
|
685
|
-
let { type: t, id: i, desc: a = !1, invertSorting: o = !1, pathArray: s } = r, c =
|
|
720
|
+
let { type: t, id: i, desc: a = !1, invertSorting: o = !1, pathArray: s } = r, c = v(e, s, i), l = v(n, s, i), u;
|
|
686
721
|
switch (t) {
|
|
687
722
|
case "numeric":
|
|
688
723
|
u = A(c, l, r);
|
|
@@ -711,33 +746,33 @@ function L(e, n = []) {
|
|
|
711
746
|
}
|
|
712
747
|
return 0;
|
|
713
748
|
});
|
|
714
|
-
}, [
|
|
715
|
-
|
|
716
|
-
}, []),
|
|
717
|
-
let { multi: r = !1, ...
|
|
718
|
-
|
|
719
|
-
let
|
|
720
|
-
if (!
|
|
721
|
-
let
|
|
749
|
+
}, [i, e]), u = t((e) => c((t) => t.some((t) => t.id === e.id) ? t.map((t) => t.id === e.id ? e : t) : [...t, e]), []), d = t((e) => {
|
|
750
|
+
c((t) => Array.isArray(e) ? t.filter((t) => !e.includes(t.id)) : t.filter((t) => t.id !== e));
|
|
751
|
+
}, []), f = t(() => c([]), []), p = t(() => c(r.current), []), m = t((e) => c(e), []), h = t((e, t, n) => {
|
|
752
|
+
let { multi: r = !1, ...i } = n || {};
|
|
753
|
+
c((n) => {
|
|
754
|
+
let a = n.find((t) => t.id === e);
|
|
755
|
+
if (!a) {
|
|
756
|
+
let a = {
|
|
722
757
|
id: e,
|
|
723
758
|
type: t,
|
|
724
|
-
...
|
|
759
|
+
...i,
|
|
725
760
|
desc: !1
|
|
726
761
|
};
|
|
727
|
-
return r ? [...n,
|
|
762
|
+
return r ? [...n, a] : [a];
|
|
728
763
|
}
|
|
729
|
-
if (!
|
|
764
|
+
if (!a.desc) {
|
|
730
765
|
let t = {
|
|
731
|
-
...i,
|
|
732
766
|
...a,
|
|
767
|
+
...i,
|
|
733
768
|
desc: !0
|
|
734
769
|
};
|
|
735
770
|
return r ? n.map((n) => n.id === e ? t : n) : [t];
|
|
736
771
|
}
|
|
737
|
-
if (
|
|
772
|
+
if (a.disableSortRemoval || i.disableSortRemoval) {
|
|
738
773
|
let t = {
|
|
739
|
-
...i,
|
|
740
774
|
...a,
|
|
775
|
+
...i,
|
|
741
776
|
desc: !1
|
|
742
777
|
};
|
|
743
778
|
return r ? n.map((n) => n.id === e ? t : n) : [t];
|
|
@@ -746,31 +781,141 @@ function L(e, n = []) {
|
|
|
746
781
|
});
|
|
747
782
|
}, []);
|
|
748
783
|
return {
|
|
749
|
-
sortedItems:
|
|
750
|
-
sorts:
|
|
751
|
-
upsertSorts:
|
|
752
|
-
removeSort:
|
|
753
|
-
clearSorts:
|
|
754
|
-
resetSorts:
|
|
755
|
-
replaceSorts:
|
|
784
|
+
sortedItems: l,
|
|
785
|
+
sorts: i,
|
|
786
|
+
upsertSorts: u,
|
|
787
|
+
removeSort: d,
|
|
788
|
+
clearSorts: f,
|
|
789
|
+
resetSorts: p,
|
|
790
|
+
replaceSorts: m,
|
|
756
791
|
getSortDirection: t((e) => {
|
|
757
|
-
let t =
|
|
792
|
+
let t = i.find((t) => t.id === e);
|
|
758
793
|
return t ? t.desc ? "desc" : "asc" : void 0;
|
|
759
|
-
}, [
|
|
760
|
-
toggleSort:
|
|
794
|
+
}, [i]),
|
|
795
|
+
toggleSort: h,
|
|
761
796
|
getNextSortingOrder: t((e) => {
|
|
762
|
-
let t =
|
|
797
|
+
let t = i.find((t) => t.id === e);
|
|
763
798
|
return t ? t.desc ? t.disableSortRemoval ? "asc" : "none" : "desc" : "asc";
|
|
764
|
-
}, [
|
|
799
|
+
}, [i]),
|
|
765
800
|
getSortIndex: t((e) => {
|
|
766
|
-
let t =
|
|
801
|
+
let t = i.findIndex((t) => t.id === e);
|
|
767
802
|
return t === -1 ? void 0 : t + 1;
|
|
768
|
-
}, [
|
|
803
|
+
}, [i])
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
//#endregion
|
|
807
|
+
//#region src/ui/visibility/useVisibility.ts
|
|
808
|
+
function R({ items: e, field: n, initialVisibleIds: r = [] }) {
|
|
809
|
+
let i = o(r), [c, l] = s(() => new Set(r)), u = t((e) => {
|
|
810
|
+
let t = v(e, n);
|
|
811
|
+
return c.has(t);
|
|
812
|
+
}, [c, n]), d = t((e) => {
|
|
813
|
+
l((t) => {
|
|
814
|
+
let r = new Set(t), i = v(e, n);
|
|
815
|
+
return r.add(i), r;
|
|
816
|
+
});
|
|
817
|
+
}, [n]), f = t((e) => {
|
|
818
|
+
l((t) => {
|
|
819
|
+
let r = new Set(t), i = v(e, n);
|
|
820
|
+
return r.delete(i), r;
|
|
821
|
+
});
|
|
822
|
+
}, [n]), p = t((e) => {
|
|
823
|
+
l((t) => {
|
|
824
|
+
let r = new Set(t), i = v(e, n);
|
|
825
|
+
return r.has(i) ? r.delete(i) : r.add(i), r;
|
|
826
|
+
});
|
|
827
|
+
}, [n]), m = t((t) => {
|
|
828
|
+
l((r) => {
|
|
829
|
+
let i = new Set(r);
|
|
830
|
+
return (t ?? e).forEach((e) => {
|
|
831
|
+
i.add(v(e, n));
|
|
832
|
+
}), i;
|
|
833
|
+
});
|
|
834
|
+
}, [e, n]), h = t((t) => {
|
|
835
|
+
l((r) => {
|
|
836
|
+
let i = new Set(r);
|
|
837
|
+
return (t ?? e).forEach((e) => {
|
|
838
|
+
i.delete(v(e, n));
|
|
839
|
+
}), i;
|
|
840
|
+
});
|
|
841
|
+
}, [e, n]), g = t(() => {
|
|
842
|
+
l(() => new Set(i.current));
|
|
843
|
+
}, []), _ = t((e) => {
|
|
844
|
+
let t = e.map((e) => v(e, n));
|
|
845
|
+
l(() => new Set(t));
|
|
846
|
+
}, [n]), y = a(() => e.filter((e) => {
|
|
847
|
+
let t = v(e, n);
|
|
848
|
+
return c.has(t);
|
|
849
|
+
}), [
|
|
850
|
+
e,
|
|
851
|
+
n,
|
|
852
|
+
c
|
|
853
|
+
]), b = a(() => e.filter((e) => {
|
|
854
|
+
let t = v(e, n);
|
|
855
|
+
return !c.has(t);
|
|
856
|
+
}), [
|
|
857
|
+
e,
|
|
858
|
+
n,
|
|
859
|
+
c
|
|
860
|
+
]);
|
|
861
|
+
return {
|
|
862
|
+
visibleIds: [...c],
|
|
863
|
+
visibleItems: y,
|
|
864
|
+
hiddenItems: b,
|
|
865
|
+
visibleCount: c.size,
|
|
866
|
+
isVisible: u,
|
|
867
|
+
show: d,
|
|
868
|
+
hide: f,
|
|
869
|
+
toggleVisibility: p,
|
|
870
|
+
showAll: m,
|
|
871
|
+
hideAll: h,
|
|
872
|
+
replaceVisibility: _,
|
|
873
|
+
resetVisibility: g
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
//#endregion
|
|
877
|
+
//#region src/performance/debounce/useDebounce.ts
|
|
878
|
+
function z(e, n, i = {}) {
|
|
879
|
+
let [a, c] = s(!1), l = i.maxWait, u = !!i.leading, d = !u && i.trailing === !1 ? !0 : i.trailing ?? !u, f = o(e), p = o(null), m = o(-1), h = o(-1), g = o(null);
|
|
880
|
+
r(() => {
|
|
881
|
+
f.current = e;
|
|
882
|
+
}, [e]);
|
|
883
|
+
let _ = t(() => {
|
|
884
|
+
p.current &&= (clearTimeout(p.current), null), m.current = -1, h.current = -1, g.current = null, c(!1);
|
|
885
|
+
}, []), v = t(() => {
|
|
886
|
+
p.current && g.current && (clearTimeout(p.current), p.current = null, f.current(...g.current), m.current = Date.now(), h.current = -1, g.current = null, c(!1));
|
|
887
|
+
}, []);
|
|
888
|
+
return r(() => () => {
|
|
889
|
+
_();
|
|
890
|
+
}, [_]), {
|
|
891
|
+
debouncedFunc: t((...e) => {
|
|
892
|
+
c(!0), h.current = Date.now(), g.current = e, m.current === -1 && (m.current = Date.now(), u === !0 && f.current(...e)), l !== void 0 && Date.now() - m.current >= l ? (p.current && clearTimeout(p.current), f.current(...e), m.current = -1, c(!1)) : (p.current && clearTimeout(p.current), p.current = setTimeout(() => {
|
|
893
|
+
h.current !== m.current && d !== !1 && f.current(...e), m.current = -1, c(!1);
|
|
894
|
+
}, n));
|
|
895
|
+
}, [
|
|
896
|
+
n,
|
|
897
|
+
l,
|
|
898
|
+
d,
|
|
899
|
+
u
|
|
900
|
+
]),
|
|
901
|
+
cancel: _,
|
|
902
|
+
flush: v,
|
|
903
|
+
isPending: a
|
|
769
904
|
};
|
|
770
905
|
}
|
|
771
906
|
//#endregion
|
|
772
|
-
//#region src/
|
|
773
|
-
function
|
|
907
|
+
//#region src/performance/debounce/useDebouncedValue.ts
|
|
908
|
+
function B(e, t, n = {}) {
|
|
909
|
+
let [i, a] = s(e), { debouncedFunc: o } = z((e) => {
|
|
910
|
+
a(e);
|
|
911
|
+
}, t, n);
|
|
912
|
+
return r(() => {
|
|
913
|
+
o(e);
|
|
914
|
+
}, [e, o]), i;
|
|
915
|
+
}
|
|
916
|
+
//#endregion
|
|
917
|
+
//#region src/performance/throttle/useThrottle.ts
|
|
918
|
+
function V(e, n, i = {}) {
|
|
774
919
|
let [a, c] = s(!1), l = i.leading ?? !0, u = i.trailing ?? !0, d = o(e), f = o(null), p = o(-1), m = o(null);
|
|
775
920
|
r(() => {
|
|
776
921
|
d.current = e;
|
|
@@ -804,4 +949,56 @@ function R(e, n, i = {}) {
|
|
|
804
949
|
};
|
|
805
950
|
}
|
|
806
951
|
//#endregion
|
|
807
|
-
|
|
952
|
+
//#region src/events/key/constants.ts
|
|
953
|
+
var H = [
|
|
954
|
+
"keydown",
|
|
955
|
+
"keyup",
|
|
956
|
+
"keypress"
|
|
957
|
+
];
|
|
958
|
+
//#endregion
|
|
959
|
+
//#region src/events/key/useKey.ts
|
|
960
|
+
function U(e, t, { enabled: n = !0, preventDefault: a = !0, stopPropagation: s = !0, eventType: c = "keydown", preventRepeat: l = !1, ignoreWhenFocusedInInputs: u = !0, ctrlKey: d = !1, shiftKey: f = !1, altKey: p = !1, metaKey: m = !1, target: h = window } = {}) {
|
|
961
|
+
let g = o(t), _ = o(n), v = o(!1);
|
|
962
|
+
i(() => {
|
|
963
|
+
g.current = t;
|
|
964
|
+
}, [t]), r(() => {
|
|
965
|
+
_.current = n;
|
|
966
|
+
}, [n]), r(() => {
|
|
967
|
+
let t = h && "current" in h ? h.current : h;
|
|
968
|
+
if (!t) return;
|
|
969
|
+
let n = e.toLowerCase(), r = H.includes(c) ? c : "keydown", i = l && r !== "keyup";
|
|
970
|
+
function o() {
|
|
971
|
+
v.current = !1;
|
|
972
|
+
}
|
|
973
|
+
function y(e) {
|
|
974
|
+
if (!(e instanceof KeyboardEvent)) return;
|
|
975
|
+
let t = e.key.toLowerCase();
|
|
976
|
+
(t === n || d && t === "control" || f && t === "shift" || p && t === "alt" || m && t === "meta") && (v.current = !1);
|
|
977
|
+
}
|
|
978
|
+
function b(e) {
|
|
979
|
+
if (!(e instanceof KeyboardEvent) || !_.current) return;
|
|
980
|
+
let t = e.target;
|
|
981
|
+
if (!(u && t instanceof HTMLElement && (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement || t.isContentEditable)) && e.ctrlKey === d && e.shiftKey === f && e.altKey === p && e.metaKey === m && n === e.key.toLowerCase()) {
|
|
982
|
+
if (i && v.current) return;
|
|
983
|
+
v.current = !0, g.current(e), a && e.preventDefault(), s && e.stopPropagation();
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
return t.addEventListener(r, b), i && (t.addEventListener("keyup", y), window.addEventListener("blur", o)), () => {
|
|
987
|
+
t.removeEventListener(r, b), i && (t.removeEventListener("keyup", y), window.removeEventListener("blur", o));
|
|
988
|
+
};
|
|
989
|
+
}, [
|
|
990
|
+
e,
|
|
991
|
+
a,
|
|
992
|
+
s,
|
|
993
|
+
c,
|
|
994
|
+
l,
|
|
995
|
+
u,
|
|
996
|
+
d,
|
|
997
|
+
f,
|
|
998
|
+
p,
|
|
999
|
+
m,
|
|
1000
|
+
h
|
|
1001
|
+
]);
|
|
1002
|
+
}
|
|
1003
|
+
//#endregion
|
|
1004
|
+
export { d as FuzzyHighlighter, _ as ModalLayout, z as useDebounce, B as useDebouncedValue, b as useFilter, S as useFuzzySearch, C as useGrouping, U as useKey, g as useModal, h as useModalActions, m as useModalState, T as useMultipleSelection, D as useOrder, w as usePagination, O as usePin, E as useSingleSelection, L as useSort, V as useThrottle, R as useVisibility };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@himanshu-sorathiya/react-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "An opinionated collection of react hooks, and reusable UI components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"react-dom": "^19.2.6",
|
|
43
43
|
"typescript": "~6.0.2",
|
|
44
44
|
"typescript-eslint": "^8.59.2",
|
|
45
|
-
"vite": "^8.
|
|
45
|
+
"vite": "^8.1.4"
|
|
46
46
|
},
|
|
47
47
|
"sideEffects": [
|
|
48
48
|
"**/*.css"
|