UNPKG

1.9 kBPlain TextView Raw
1import { GRID_PROPERTY_TYPES } from "@egjs/grid";
2
3const ua = typeof window !== "undefined" ? window.navigator.userAgent : "";
4
5export const IS_IOS = /iPhone|iPad/.test(ua);
6export const CONTAINER_CLASS_NAME = "infinitegrid-container";
7export const IGNORE_PROPERITES_MAP = {
8 renderOnPropertyChange: true,
9 useFit: true,
10 autoResize: true,
11} as const;
12
13
14export const INFINITEGRID_PROPERTY_TYPES = {
15 ...GRID_PROPERTY_TYPES,
16};
17
18export const DIRECTION = {
19 START: "start",
20 END: "end",
21 NONE: "",
22} as const;
23
24export const INFINITEGRID_EVENTS = {
25 CHANGE_SCROLL: "changeScroll",
26 REQUEST_APPEND: "requestAppend",
27 REQUEST_PREPEND: "requestPrepend",
28 RENDER_COMPLETE: "renderComplete",
29 CONTENT_ERROR: "contentError",
30} as const;
31
32// type?: ITEM_TYPE;
33// groupKey?: string | number;
34// key?: string | number;
35// element?: HTMLElement | null;
36// html?: string;
37// data?: Record<string, any>;
38export const ITEM_INFO_PROPERTIES = {
39 type: true,
40 groupKey: true,
41 key: true,
42 element: true,
43 html: true,
44 data: true,
45};
46
47
48export const INFINITEGRID_METHODS = [
49 "updateItems",
50 "getItems",
51 "getVisibleItems",
52 "getGroups",
53 "getVisibleGroups",
54 "renderItems",
55 "getContainerElement",
56 "getScrollContainerElement",
57 "getWrapperElement",
58 "setStatus",
59 "getStatus",
60 "removePlaceholders",
61 "prependPlaceholders",
62 "appendPlaceholders",
63 "getStartCursor",
64 "getEndCursor",
65 "setCursors",
66] as const;
67
68
69export enum GROUP_TYPE {
70 NORMAL = 0,
71 VIRTUAL = 1,
72 LOADING = 2,
73}
74
75export enum ITEM_TYPE {
76 NORMAL = 0,
77 VIRTUAL = 1,
78 LOADING = 2,
79}
80
81export enum STATUS_TYPE {
82 // does not remove anything.
83 NOT_REMOVE = 0,
84 // Minimize information on invisible items
85 MINIMIZE_INVISIBLE_ITEMS = 1,
86 // Minimize information on invisible groups
87 MINIMIZE_INVISIBLE_GROUPS = 2,
88 // remove invisible groups
89 REMOVE_INVISIBLE_GROUPS = 3,
90}
91
92
93export const INVISIBLE_POS = -9999;