@react-spectrum/card 3.0.0-alpha.1 → 3.0.0-alpha.2
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/main.css +1 -2
- package/dist/main.js +1296 -1598
- package/dist/main.js.map +1 -1
- package/dist/module.js +1277 -1510
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +8 -14
- package/dist/types.d.ts.map +1 -1
- package/package.json +21 -21
- package/src/Card.tsx +5 -8
- package/src/CardBase.tsx +17 -59
- package/src/CardView.tsx +4 -0
- package/src/GalleryLayout.tsx +90 -88
- package/src/WaterfallLayout.tsx +5 -14
- package/dist/main.css.map +0 -1
package/dist/module.js
CHANGED
|
@@ -1,1661 +1,1428 @@
|
|
|
1
|
-
import { Layout, Rect, LayoutInfo, Size } from "@react-stately/virtualizer";
|
|
2
|
-
import { Virtualizer, VirtualizerItem } from "@react-aria/virtualizer";
|
|
3
|
-
import { useListState } from "@react-stately/list";
|
|
4
|
-
import { useGrid, useGridCell, useGridRow } from "@react-aria/grid";
|
|
5
|
-
import { useCollator, useLocale, useMessageFormatter } from "@react-aria/i18n";
|
|
6
|
-
import { ProgressCircle } from "@react-spectrum/progress";
|
|
7
|
-
import { GridCollection, useGridState } from "@react-stately/grid";
|
|
8
|
-
import { useProviderProps, useProvider } from "@react-spectrum/provider";
|
|
9
|
-
import { useFocusWithin, useHover } from "@react-aria/interactions";
|
|
10
|
-
import _react, { useCallback, useMemo, useRef, useState, useContext, forwardRef } from "react";
|
|
11
|
-
import { FocusRing } from "@react-aria/focus";
|
|
12
|
-
import { filterDOMProps, mergeProps, useLayoutEffect, useResizeObserver, useSlotId } from "@react-aria/utils";
|
|
13
|
-
import { Divider } from "@react-spectrum/divider";
|
|
14
|
-
import { classNames, SlotProvider, useDOMRef, useHasChild, useStyleProps, useUnwrapDOMRef } from "@react-spectrum/utils";
|
|
15
|
-
import { Checkbox } from "@react-spectrum/checkbox";
|
|
16
|
-
import _babelRuntimeHelpersEsmInteropRequireDefault from "@babel/runtime/helpers/esm/interopRequireDefault";
|
|
17
|
-
import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
|
|
18
1
|
import "./main.css";
|
|
2
|
+
import {useStyleProps as $5HlfY$useStyleProps, useDOMRef as $5HlfY$useDOMRef, classNames as $5HlfY$classNames, useUnwrapDOMRef as $5HlfY$useUnwrapDOMRef, useHasChild as $5HlfY$useHasChild, SlotProvider as $5HlfY$SlotProvider} from "@react-spectrum/utils";
|
|
3
|
+
import {GridCollection as $5HlfY$GridCollection, useGridState as $5HlfY$useGridState} from "@react-stately/grid";
|
|
4
|
+
import {ProgressCircle as $5HlfY$ProgressCircle} from "@react-spectrum/progress";
|
|
5
|
+
import $5HlfY$react, {useMemo as $5HlfY$useMemo, useCallback as $5HlfY$useCallback, useRef as $5HlfY$useRef, useState as $5HlfY$useState, useContext as $5HlfY$useContext, forwardRef as $5HlfY$forwardRef} from "react";
|
|
6
|
+
import {useCollator as $5HlfY$useCollator, useMessageFormatter as $5HlfY$useMessageFormatter, useLocale as $5HlfY$useLocale} from "@react-aria/i18n";
|
|
7
|
+
import {useGrid as $5HlfY$useGrid, useGridRow as $5HlfY$useGridRow, useGridCell as $5HlfY$useGridCell} from "@react-aria/grid";
|
|
8
|
+
import {useListState as $5HlfY$useListState} from "@react-stately/list";
|
|
9
|
+
import {useProvider as $5HlfY$useProvider, useProviderProps as $5HlfY$useProviderProps} from "@react-spectrum/provider";
|
|
10
|
+
import {VirtualizerItem as $5HlfY$VirtualizerItem, Virtualizer as $5HlfY$Virtualizer} from "@react-aria/virtualizer";
|
|
11
|
+
import {Checkbox as $5HlfY$Checkbox} from "@react-spectrum/checkbox";
|
|
12
|
+
import {useResizeObserver as $5HlfY$useResizeObserver, useLayoutEffect as $5HlfY$useLayoutEffect, mergeProps as $5HlfY$mergeProps, filterDOMProps as $5HlfY$filterDOMProps, useSlotId as $5HlfY$useSlotId} from "@react-aria/utils";
|
|
13
|
+
import {getFocusableTreeWalker as $5HlfY$getFocusableTreeWalker, FocusRing as $5HlfY$FocusRing} from "@react-aria/focus";
|
|
14
|
+
import {useHover as $5HlfY$useHover, useFocusWithin as $5HlfY$useFocusWithin} from "@react-aria/interactions";
|
|
15
|
+
import {Size as $5HlfY$Size, Rect as $5HlfY$Rect, LayoutInfo as $5HlfY$LayoutInfo, Layout as $5HlfY$Layout} from "@react-stately/virtualizer";
|
|
19
16
|
|
|
20
17
|
function $parcel$interopDefault(a) {
|
|
21
18
|
return a && a.__esModule ? a.default : a;
|
|
22
19
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
$
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
20
|
+
function $parcel$export(e, n, v, s) {
|
|
21
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
22
|
+
}
|
|
23
|
+
var $c6398e7007a75897$exports = {};
|
|
24
|
+
|
|
25
|
+
$parcel$export($c6398e7007a75897$exports, "CardView", () => $c6398e7007a75897$export$7e52c821f7b6f422);
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
var $468be5d76fe318d4$exports = {};
|
|
33
|
+
|
|
34
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card", () => $468be5d76fe318d4$export$4e5e9f191b1edb8, (v) => $468be5d76fe318d4$export$4e5e9f191b1edb8 = v);
|
|
35
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card-heading", () => $468be5d76fe318d4$export$92758a4a0e8d19e4, (v) => $468be5d76fe318d4$export$92758a4a0e8d19e4 = v);
|
|
36
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card-checkboxWrapper", () => $468be5d76fe318d4$export$33977546b63e0df9, (v) => $468be5d76fe318d4$export$33977546b63e0df9 = v);
|
|
37
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card-checkbox", () => $468be5d76fe318d4$export$842da5d48b8f6db2, (v) => $468be5d76fe318d4$export$842da5d48b8f6db2 = v);
|
|
38
|
+
$parcel$export($468be5d76fe318d4$exports, "is-selected", () => $468be5d76fe318d4$export$1e0fb04f31d3c22a, (v) => $468be5d76fe318d4$export$1e0fb04f31d3c22a = v);
|
|
39
|
+
$parcel$export($468be5d76fe318d4$exports, "focus-ring", () => $468be5d76fe318d4$export$f39a09f249340e2a, (v) => $468be5d76fe318d4$export$f39a09f249340e2a = v);
|
|
40
|
+
$parcel$export($468be5d76fe318d4$exports, "is-hovered", () => $468be5d76fe318d4$export$b8813cd5d7824ce7, (v) => $468be5d76fe318d4$export$b8813cd5d7824ce7 = v);
|
|
41
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card-grid", () => $468be5d76fe318d4$export$b3dd760d2dfde29e, (v) => $468be5d76fe318d4$export$b3dd760d2dfde29e = v);
|
|
42
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card-decoration", () => $468be5d76fe318d4$export$48252dc130b62514, (v) => $468be5d76fe318d4$export$48252dc130b62514 = v);
|
|
43
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card-image", () => $468be5d76fe318d4$export$8d5fea71dc66db80, (v) => $468be5d76fe318d4$export$8d5fea71dc66db80 = v);
|
|
44
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card-illustration", () => $468be5d76fe318d4$export$13dd3510ae7a8399, (v) => $468be5d76fe318d4$export$13dd3510ae7a8399 = v);
|
|
45
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card-avatar", () => $468be5d76fe318d4$export$159930c59efb6273, (v) => $468be5d76fe318d4$export$159930c59efb6273 = v);
|
|
46
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card-detail", () => $468be5d76fe318d4$export$16715af38fbd9819, (v) => $468be5d76fe318d4$export$16715af38fbd9819 = v);
|
|
47
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card-content", () => $468be5d76fe318d4$export$d946625b97e8aa17, (v) => $468be5d76fe318d4$export$d946625b97e8aa17 = v);
|
|
48
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card--waterfall", () => $468be5d76fe318d4$export$d9c7209e0e4f7e4d, (v) => $468be5d76fe318d4$export$d9c7209e0e4f7e4d = v);
|
|
49
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card--default", () => $468be5d76fe318d4$export$c7a022df9e10a238, (v) => $468be5d76fe318d4$export$c7a022df9e10a238 = v);
|
|
50
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card--noPreview", () => $468be5d76fe318d4$export$b77922bc0320c9e4, (v) => $468be5d76fe318d4$export$b77922bc0320c9e4 = v);
|
|
51
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card--grid", () => $468be5d76fe318d4$export$59739ab951d2dcc7, (v) => $468be5d76fe318d4$export$59739ab951d2dcc7 = v);
|
|
52
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card--noLayout", () => $468be5d76fe318d4$export$a03d836e6ef3e749, (v) => $468be5d76fe318d4$export$a03d836e6ef3e749 = v);
|
|
53
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card--isQuiet", () => $468be5d76fe318d4$export$92ad04b5ac9296ea, (v) => $468be5d76fe318d4$export$92ad04b5ac9296ea = v);
|
|
54
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card--gallery", () => $468be5d76fe318d4$export$ccd8ffc36bd10cc, (v) => $468be5d76fe318d4$export$ccd8ffc36bd10cc = v);
|
|
55
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-Card--horizontal", () => $468be5d76fe318d4$export$1c52334407225704, (v) => $468be5d76fe318d4$export$1c52334407225704 = v);
|
|
56
|
+
$parcel$export($468be5d76fe318d4$exports, "is-focused", () => $468be5d76fe318d4$export$e7dc768d35940237, (v) => $468be5d76fe318d4$export$e7dc768d35940237 = v);
|
|
57
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-CardView", () => $468be5d76fe318d4$export$2f34e9e3e0b89d95, (v) => $468be5d76fe318d4$export$2f34e9e3e0b89d95 = v);
|
|
58
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-CardView-centeredWrapper", () => $468be5d76fe318d4$export$7fc89689fcfab196, (v) => $468be5d76fe318d4$export$7fc89689fcfab196 = v);
|
|
59
|
+
$parcel$export($468be5d76fe318d4$exports, "spectrum-CardView-row", () => $468be5d76fe318d4$export$4746ac09daa215ae, (v) => $468be5d76fe318d4$export$4746ac09daa215ae = v);
|
|
60
|
+
$parcel$export($468be5d76fe318d4$exports, "is-drop-target", () => $468be5d76fe318d4$export$d8467f38d2d00bd0, (v) => $468be5d76fe318d4$export$d8467f38d2d00bd0 = v);
|
|
61
|
+
var $468be5d76fe318d4$export$4e5e9f191b1edb8;
|
|
62
|
+
var $468be5d76fe318d4$export$92758a4a0e8d19e4;
|
|
63
|
+
var $468be5d76fe318d4$export$33977546b63e0df9;
|
|
64
|
+
var $468be5d76fe318d4$export$842da5d48b8f6db2;
|
|
65
|
+
var $468be5d76fe318d4$export$1e0fb04f31d3c22a;
|
|
66
|
+
var $468be5d76fe318d4$export$f39a09f249340e2a;
|
|
67
|
+
var $468be5d76fe318d4$export$b8813cd5d7824ce7;
|
|
68
|
+
var $468be5d76fe318d4$export$b3dd760d2dfde29e;
|
|
69
|
+
var $468be5d76fe318d4$export$48252dc130b62514;
|
|
70
|
+
var $468be5d76fe318d4$export$8d5fea71dc66db80;
|
|
71
|
+
var $468be5d76fe318d4$export$13dd3510ae7a8399;
|
|
72
|
+
var $468be5d76fe318d4$export$159930c59efb6273;
|
|
73
|
+
var $468be5d76fe318d4$export$16715af38fbd9819;
|
|
74
|
+
var $468be5d76fe318d4$export$d946625b97e8aa17;
|
|
75
|
+
var $468be5d76fe318d4$export$d9c7209e0e4f7e4d;
|
|
76
|
+
var $468be5d76fe318d4$export$c7a022df9e10a238;
|
|
77
|
+
var $468be5d76fe318d4$export$b77922bc0320c9e4;
|
|
78
|
+
var $468be5d76fe318d4$export$59739ab951d2dcc7;
|
|
79
|
+
var $468be5d76fe318d4$export$a03d836e6ef3e749;
|
|
80
|
+
var $468be5d76fe318d4$export$92ad04b5ac9296ea;
|
|
81
|
+
var $468be5d76fe318d4$export$ccd8ffc36bd10cc;
|
|
82
|
+
var $468be5d76fe318d4$export$1c52334407225704;
|
|
83
|
+
var $468be5d76fe318d4$export$e7dc768d35940237;
|
|
84
|
+
var $468be5d76fe318d4$export$2f34e9e3e0b89d95;
|
|
85
|
+
var $468be5d76fe318d4$export$7fc89689fcfab196;
|
|
86
|
+
var $468be5d76fe318d4$export$4746ac09daa215ae;
|
|
87
|
+
var $468be5d76fe318d4$export$d8467f38d2d00bd0;
|
|
88
|
+
$468be5d76fe318d4$export$4e5e9f191b1edb8 = "spectrum-Card_6fdf9f";
|
|
89
|
+
$468be5d76fe318d4$export$92758a4a0e8d19e4 = "spectrum-Card-heading_6fdf9f";
|
|
90
|
+
$468be5d76fe318d4$export$33977546b63e0df9 = "spectrum-Card-checkboxWrapper_6fdf9f";
|
|
91
|
+
$468be5d76fe318d4$export$842da5d48b8f6db2 = "spectrum-Card-checkbox_6fdf9f";
|
|
92
|
+
$468be5d76fe318d4$export$1e0fb04f31d3c22a = "is-selected_6fdf9f";
|
|
93
|
+
$468be5d76fe318d4$export$f39a09f249340e2a = "focus-ring_6fdf9f";
|
|
94
|
+
$468be5d76fe318d4$export$b8813cd5d7824ce7 = "is-hovered_6fdf9f";
|
|
95
|
+
$468be5d76fe318d4$export$b3dd760d2dfde29e = "spectrum-Card-grid_6fdf9f";
|
|
96
|
+
$468be5d76fe318d4$export$48252dc130b62514 = "spectrum-Card-decoration_6fdf9f";
|
|
97
|
+
$468be5d76fe318d4$export$8d5fea71dc66db80 = "spectrum-Card-image_6fdf9f";
|
|
98
|
+
$468be5d76fe318d4$export$13dd3510ae7a8399 = "spectrum-Card-illustration_6fdf9f";
|
|
99
|
+
$468be5d76fe318d4$export$159930c59efb6273 = "spectrum-Card-avatar_6fdf9f";
|
|
100
|
+
$468be5d76fe318d4$export$16715af38fbd9819 = "spectrum-Card-detail_6fdf9f";
|
|
101
|
+
$468be5d76fe318d4$export$d946625b97e8aa17 = "spectrum-Card-content_6fdf9f";
|
|
102
|
+
$468be5d76fe318d4$export$d9c7209e0e4f7e4d = "spectrum-Card--waterfall_6fdf9f";
|
|
103
|
+
$468be5d76fe318d4$export$c7a022df9e10a238 = "spectrum-Card--default_6fdf9f";
|
|
104
|
+
$468be5d76fe318d4$export$b77922bc0320c9e4 = "spectrum-Card--noPreview_6fdf9f";
|
|
105
|
+
$468be5d76fe318d4$export$59739ab951d2dcc7 = "spectrum-Card--grid_6fdf9f";
|
|
106
|
+
$468be5d76fe318d4$export$a03d836e6ef3e749 = "spectrum-Card--noLayout_6fdf9f";
|
|
107
|
+
$468be5d76fe318d4$export$92ad04b5ac9296ea = "spectrum-Card--isQuiet_6fdf9f";
|
|
108
|
+
$468be5d76fe318d4$export$ccd8ffc36bd10cc = "spectrum-Card--gallery_6fdf9f";
|
|
109
|
+
$468be5d76fe318d4$export$1c52334407225704 = "spectrum-Card--horizontal_6fdf9f";
|
|
110
|
+
$468be5d76fe318d4$export$e7dc768d35940237 = "is-focused_6fdf9f";
|
|
111
|
+
$468be5d76fe318d4$export$2f34e9e3e0b89d95 = "spectrum-CardView_6fdf9f";
|
|
112
|
+
$468be5d76fe318d4$export$7fc89689fcfab196 = "spectrum-CardView-centeredWrapper_6fdf9f";
|
|
113
|
+
$468be5d76fe318d4$export$4746ac09daa215ae = "spectrum-CardView-row_6fdf9f";
|
|
114
|
+
$468be5d76fe318d4$export$d8467f38d2d00bd0 = "is-drop-target_6fdf9f";
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
const $9a000cf0a62ebe41$export$64992ac69f286e5c = /*#__PURE__*/ $5HlfY$react.createContext(null);
|
|
119
|
+
function $9a000cf0a62ebe41$export$fea0b38586ec8f13() {
|
|
120
|
+
return $5HlfY$useContext($9a000cf0a62ebe41$export$64992ac69f286e5c);
|
|
64
121
|
}
|
|
65
122
|
|
|
66
|
-
var $a8414e711d6ad206767a67f293235d49$$interop$default = $parcel$interopDefault($a8414e711d6ad206767a67f293235d49$exports);
|
|
67
|
-
|
|
68
|
-
function $c6a745aa43479b6f54b3654a7597126$var$CardBase(props, ref) {
|
|
69
|
-
props = useProviderProps(props);
|
|
70
|
-
let context = $f9069c2077073c56c9fbb170659475$export$useCardViewContext() || {}; // we can call again here, won't change from Card.tsx
|
|
71
|
-
|
|
72
|
-
let {
|
|
73
|
-
state
|
|
74
|
-
} = context;
|
|
75
|
-
let manager = state == null ? void 0 : state.selectionManager;
|
|
76
|
-
let {
|
|
77
|
-
isQuiet,
|
|
78
|
-
orientation = 'vertical',
|
|
79
|
-
articleProps = {},
|
|
80
|
-
item,
|
|
81
|
-
layout
|
|
82
|
-
} = props;
|
|
83
|
-
let key = item == null ? void 0 : item.key;
|
|
84
|
-
let isSelected = manager == null ? void 0 : manager.isSelected(key);
|
|
85
|
-
let isDisabled = state == null ? void 0 : state.disabledKeys.has(key);
|
|
86
|
-
|
|
87
|
-
let onChange = () => manager == null ? void 0 : manager.select(key);
|
|
88
|
-
|
|
89
|
-
let {
|
|
90
|
-
styleProps
|
|
91
|
-
} = useStyleProps(props);
|
|
92
|
-
let {
|
|
93
|
-
cardProps,
|
|
94
|
-
titleProps,
|
|
95
|
-
contentProps
|
|
96
|
-
} = $c6a745aa43479b6f54b3654a7597126$var$useCard(props);
|
|
97
|
-
let domRef = useDOMRef(ref);
|
|
98
|
-
let gridRef = useRef(); // cards are only interactive if there is a selection manager and it allows selection
|
|
99
|
-
|
|
100
|
-
let {
|
|
101
|
-
hoverProps,
|
|
102
|
-
isHovered
|
|
103
|
-
} = useHover({
|
|
104
|
-
isDisabled: manager === undefined || (manager == null ? void 0 : manager.selectionMode) === 'none' || isDisabled
|
|
105
|
-
});
|
|
106
|
-
let [isFocused, setIsFocused] = useState(false);
|
|
107
|
-
let {
|
|
108
|
-
focusWithinProps
|
|
109
|
-
} = useFocusWithin({
|
|
110
|
-
onFocusWithinChange: setIsFocused,
|
|
111
|
-
isDisabled
|
|
112
|
-
});
|
|
113
|
-
let hasFooter = useHasChild("." + $a8414e711d6ad206767a67f293235d49$$interop$default['spectrum-Card-footer'], gridRef); // ToDo: see css for comment about avatar under selector .spectrum-Card--noLayout.spectrum-Card--default
|
|
114
|
-
|
|
115
|
-
let hasPreviewImage = useHasChild("." + $a8414e711d6ad206767a67f293235d49$$interop$default['spectrum-Card-image'], gridRef);
|
|
116
|
-
let hasPreviewIllustration = useHasChild("." + $a8414e711d6ad206767a67f293235d49$$interop$default['spectrum-Card-illustration'], gridRef);
|
|
117
|
-
let hasPreview = hasPreviewImage || hasPreviewIllustration; // this is for horizontal cards
|
|
118
|
-
|
|
119
|
-
let [height, setHeight] = useState(NaN);
|
|
120
|
-
let updateHeight = useCallback(() => {
|
|
121
|
-
if (orientation !== 'horizontal') {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
let cardHeight = gridRef.current.getBoundingClientRect().height;
|
|
126
|
-
setHeight(cardHeight);
|
|
127
|
-
}, [orientation, gridRef, setHeight]);
|
|
128
|
-
useResizeObserver({
|
|
129
|
-
ref: gridRef,
|
|
130
|
-
onResize: updateHeight
|
|
131
|
-
});
|
|
132
|
-
let aspectRatioEnforce = undefined;
|
|
133
|
-
|
|
134
|
-
if (orientation === 'horizontal' && !isNaN(height)) {
|
|
135
|
-
aspectRatioEnforce = {
|
|
136
|
-
height: height + "px",
|
|
137
|
-
width: height + "px"
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
let slots = useMemo(() => ({
|
|
142
|
-
image: _babelRuntimeHelpersEsmExtends({
|
|
143
|
-
UNSAFE_className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-Card-image'),
|
|
144
|
-
objectFit: orientation === 'horizontal' ? 'cover' : 'contain',
|
|
145
|
-
alt: ''
|
|
146
|
-
}, aspectRatioEnforce),
|
|
147
|
-
illustration: _babelRuntimeHelpersEsmExtends({
|
|
148
|
-
UNSAFE_className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-Card-illustration')
|
|
149
|
-
}, aspectRatioEnforce),
|
|
150
|
-
avatar: {
|
|
151
|
-
UNSAFE_className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-Card-avatar'),
|
|
152
|
-
size: 'avatar-size-400'
|
|
153
|
-
},
|
|
154
|
-
heading: _babelRuntimeHelpersEsmExtends({
|
|
155
|
-
UNSAFE_className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-Card-heading')
|
|
156
|
-
}, titleProps),
|
|
157
|
-
content: _babelRuntimeHelpersEsmExtends({
|
|
158
|
-
UNSAFE_className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-Card-content')
|
|
159
|
-
}, contentProps),
|
|
160
|
-
detail: {
|
|
161
|
-
UNSAFE_className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-Card-detail')
|
|
162
|
-
},
|
|
163
|
-
actionmenu: {
|
|
164
|
-
UNSAFE_className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-Card-actions'),
|
|
165
|
-
align: 'end',
|
|
166
|
-
isQuiet: true
|
|
167
|
-
},
|
|
168
|
-
footer: {
|
|
169
|
-
UNSAFE_className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-Card-footer'),
|
|
170
|
-
isHidden: isQuiet
|
|
171
|
-
},
|
|
172
|
-
divider: {
|
|
173
|
-
UNSAFE_className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-Card-divider'),
|
|
174
|
-
size: 'S'
|
|
175
|
-
}
|
|
176
|
-
}), [titleProps, contentProps, height, isQuiet, orientation]); // This is only for quiet grid cards
|
|
177
|
-
|
|
178
|
-
let [isCloseToSquare, setIsCloseToSquare] = useState(false);
|
|
179
|
-
useLayoutEffect(() => {
|
|
180
|
-
if (!(layout === 'grid' && isQuiet)) {
|
|
181
|
-
return;
|
|
182
|
-
} // ToDo: how to handle illustrations? what if the illustration looks like an image? What about swatches/fonts https://spectrum-contributions.corp.adobe.com/page/asset-card-beta/#File-type
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
let image = gridRef.current.querySelector("." + $a8414e711d6ad206767a67f293235d49$$interop$default['spectrum-Card-image'] + " img");
|
|
186
123
|
|
|
187
|
-
if (!image) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
124
|
|
|
191
|
-
let measure = () => {
|
|
192
|
-
let height = image.naturalHeight;
|
|
193
|
-
let width = image.naturalWidth;
|
|
194
|
-
/*
|
|
195
|
-
* ToDo: Choose between min-padding and plain ratio
|
|
196
|
-
* Do we want to just do a ratio measurement when it's close to being a square?
|
|
197
|
-
* or do we want to actually figure out min-padding?
|
|
198
|
-
* Min Padding would require us to check that the padding is not less than the min in both Vertical and Horizontal
|
|
199
|
-
* Unfortunately img contain doesn't actually create padding, which is what this math below can figure out
|
|
200
|
-
* Vs the commented out straight ratio check
|
|
201
|
-
* */
|
|
202
|
-
|
|
203
|
-
let imgTagHeight = image.clientHeight;
|
|
204
|
-
let imgTagWidth = image.clientWidth;
|
|
205
|
-
let ratio = Math.min(imgTagWidth / width, imgTagHeight / height);
|
|
206
|
-
let trueHeight = ratio * height;
|
|
207
|
-
let trueWidth = ratio * width;
|
|
208
|
-
let paddingVertical = imgTagHeight - trueHeight;
|
|
209
|
-
let paddingHorizontal = imgTagWidth - trueWidth;
|
|
210
|
-
|
|
211
|
-
if (paddingVertical < 16 && paddingHorizontal < 16) {
|
|
212
|
-
// ToDo: does this need to be different per scale?
|
|
213
|
-
setIsCloseToSquare(true);
|
|
214
|
-
} else {
|
|
215
|
-
setIsCloseToSquare(false);
|
|
216
|
-
} // let ratio = height / width;
|
|
217
|
-
// if (ratio > 0.9 && ratio < 1.1) {
|
|
218
|
-
// setIsCloseToSquare(true);
|
|
219
|
-
// }
|
|
220
125
|
|
|
126
|
+
function $f5426ba654d120b1$var$CardBase(props, ref) {
|
|
127
|
+
props = $5HlfY$useProviderProps(props);
|
|
128
|
+
let context = $9a000cf0a62ebe41$export$fea0b38586ec8f13() || {
|
|
129
|
+
}; // we can call again here, won't change from Card.tsx
|
|
130
|
+
let { state: state } = context;
|
|
131
|
+
let manager = state?.selectionManager;
|
|
132
|
+
let { isQuiet: isQuiet , orientation: orientation = 'vertical' , articleProps: articleProps = {
|
|
133
|
+
} , item: item , layout: layout , children: children } = props;
|
|
134
|
+
let key = item?.key;
|
|
135
|
+
let isSelected = manager?.isSelected(key);
|
|
136
|
+
let isDisabled = state?.disabledKeys.has(key);
|
|
137
|
+
let onChange = ()=>manager?.select(key)
|
|
138
|
+
;
|
|
139
|
+
let { styleProps: styleProps } = $5HlfY$useStyleProps(props);
|
|
140
|
+
let { cardProps: cardProps , titleProps: titleProps , contentProps: contentProps } = $f5426ba654d120b1$var$useCard(props);
|
|
141
|
+
let domRef = $5HlfY$useDOMRef(ref);
|
|
142
|
+
let gridRef = $5HlfY$useRef();
|
|
143
|
+
let checkboxRef = $5HlfY$useRef(null);
|
|
144
|
+
// cards are only interactive if there is a selection manager and it allows selection
|
|
145
|
+
let { hoverProps: hoverProps , isHovered: isHovered } = $5HlfY$useHover({
|
|
146
|
+
isDisabled: manager === undefined || manager?.selectionMode === 'none' || isDisabled
|
|
147
|
+
});
|
|
148
|
+
let [isFocused, setIsFocused] = $5HlfY$useState(false);
|
|
149
|
+
let { focusWithinProps: focusWithinProps } = $5HlfY$useFocusWithin({
|
|
150
|
+
onFocusWithinChange: setIsFocused,
|
|
151
|
+
isDisabled: isDisabled
|
|
152
|
+
});
|
|
153
|
+
// ToDo: see css for comment about avatar under selector .spectrum-Card--noLayout.spectrum-Card--default
|
|
154
|
+
let hasPreviewImage = $5HlfY$useHasChild(`.${(/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports))['spectrum-Card-image']}`, gridRef);
|
|
155
|
+
let hasPreviewIllustration = $5HlfY$useHasChild(`.${(/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports))['spectrum-Card-illustration']}`, gridRef);
|
|
156
|
+
let hasPreview = hasPreviewImage || hasPreviewIllustration;
|
|
157
|
+
// this is for horizontal cards
|
|
158
|
+
let [height, setHeight] = $5HlfY$useState(NaN);
|
|
159
|
+
let updateHeight = $5HlfY$useCallback(()=>{
|
|
160
|
+
if (orientation !== 'horizontal') return;
|
|
161
|
+
let cardHeight = gridRef.current.getBoundingClientRect().height;
|
|
162
|
+
setHeight(cardHeight);
|
|
163
|
+
}, [
|
|
164
|
+
orientation,
|
|
165
|
+
gridRef,
|
|
166
|
+
setHeight
|
|
167
|
+
]);
|
|
168
|
+
$5HlfY$useResizeObserver({
|
|
169
|
+
ref: gridRef,
|
|
170
|
+
onResize: updateHeight
|
|
171
|
+
});
|
|
172
|
+
let aspectRatioEnforce = undefined;
|
|
173
|
+
if (orientation === 'horizontal' && !isNaN(height)) aspectRatioEnforce = {
|
|
174
|
+
height: `${height}px`,
|
|
175
|
+
width: `${height}px`
|
|
221
176
|
};
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
177
|
+
let slots = $5HlfY$useMemo(()=>({
|
|
178
|
+
image: {
|
|
179
|
+
UNSAFE_className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-Card-image'),
|
|
180
|
+
objectFit: orientation === 'horizontal' ? 'cover' : 'contain',
|
|
181
|
+
alt: '',
|
|
182
|
+
...aspectRatioEnforce
|
|
183
|
+
},
|
|
184
|
+
illustration: {
|
|
185
|
+
UNSAFE_className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-Card-illustration'),
|
|
186
|
+
...aspectRatioEnforce
|
|
187
|
+
},
|
|
188
|
+
avatar: {
|
|
189
|
+
UNSAFE_className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-Card-avatar'),
|
|
190
|
+
size: 'avatar-size-400'
|
|
191
|
+
},
|
|
192
|
+
heading: {
|
|
193
|
+
UNSAFE_className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-Card-heading'),
|
|
194
|
+
...titleProps
|
|
195
|
+
},
|
|
196
|
+
content: {
|
|
197
|
+
UNSAFE_className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-Card-content'),
|
|
198
|
+
...contentProps
|
|
199
|
+
},
|
|
200
|
+
detail: {
|
|
201
|
+
UNSAFE_className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-Card-detail')
|
|
202
|
+
}
|
|
203
|
+
})
|
|
204
|
+
, [
|
|
205
|
+
titleProps,
|
|
206
|
+
contentProps,
|
|
207
|
+
height,
|
|
208
|
+
isQuiet,
|
|
209
|
+
orientation
|
|
210
|
+
]);
|
|
211
|
+
$5HlfY$useLayoutEffect(()=>{
|
|
212
|
+
if (gridRef?.current) {
|
|
213
|
+
let walker = $5HlfY$getFocusableTreeWalker(gridRef.current);
|
|
214
|
+
let nextNode = walker.nextNode();
|
|
215
|
+
while(nextNode != null){
|
|
216
|
+
if (checkboxRef.current && !checkboxRef.current.UNSAFE_getDOMNode().contains(nextNode)) {
|
|
217
|
+
console.warn('Card does not support focusable elements, please contact the team regarding your use case.');
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
nextNode = walker.nextNode();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}, [
|
|
224
|
+
children
|
|
225
|
+
]);
|
|
226
|
+
return(/*#__PURE__*/ $5HlfY$react.createElement($5HlfY$FocusRing, {
|
|
227
|
+
focusRingClass: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'focus-ring')
|
|
228
|
+
}, /*#__PURE__*/ $5HlfY$react.createElement("article", {
|
|
229
|
+
...styleProps,
|
|
230
|
+
...$5HlfY$mergeProps(cardProps, focusWithinProps, hoverProps, $5HlfY$filterDOMProps(props), articleProps),
|
|
231
|
+
ref: domRef,
|
|
232
|
+
className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-Card', {
|
|
233
|
+
'spectrum-Card--default': !isQuiet && orientation !== 'horizontal',
|
|
234
|
+
'spectrum-Card--isQuiet': isQuiet && orientation !== 'horizontal',
|
|
235
|
+
'spectrum-Card--horizontal': orientation === 'horizontal',
|
|
236
|
+
'spectrum-Card--noPreview': !hasPreview,
|
|
237
|
+
'is-hovered': isHovered,
|
|
238
|
+
'is-focused': isFocused,
|
|
239
|
+
'is-selected': isSelected,
|
|
240
|
+
'spectrum-Card--waterfall': layout === 'waterfall',
|
|
241
|
+
'spectrum-Card--gallery': layout === 'gallery',
|
|
242
|
+
'spectrum-Card--grid': layout === 'grid',
|
|
243
|
+
'spectrum-Card--noLayout': layout !== 'waterfall' && layout !== 'gallery' && layout !== 'grid'
|
|
244
|
+
}, styleProps.className)
|
|
245
|
+
}, /*#__PURE__*/ $5HlfY$react.createElement("div", {
|
|
246
|
+
ref: gridRef,
|
|
247
|
+
className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-Card-grid')
|
|
248
|
+
}, manager && manager.selectionMode !== 'none' && /*#__PURE__*/ $5HlfY$react.createElement("div", {
|
|
249
|
+
className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-Card-checkboxWrapper')
|
|
250
|
+
}, /*#__PURE__*/ $5HlfY$react.createElement($5HlfY$Checkbox, {
|
|
251
|
+
ref: checkboxRef,
|
|
252
|
+
isDisabled: isDisabled,
|
|
253
|
+
excludeFromTabOrder: true,
|
|
254
|
+
isSelected: isSelected,
|
|
255
|
+
onChange: onChange,
|
|
256
|
+
UNSAFE_className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-Card-checkbox'),
|
|
257
|
+
isEmphasized: true,
|
|
258
|
+
"aria-label": "select"
|
|
259
|
+
})), /*#__PURE__*/ $5HlfY$react.createElement($5HlfY$SlotProvider, {
|
|
260
|
+
slots: slots
|
|
261
|
+
}, children), /*#__PURE__*/ $5HlfY$react.createElement("div", {
|
|
262
|
+
className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-Card-decoration')
|
|
263
|
+
})))));
|
|
269
264
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
265
|
+
function $f5426ba654d120b1$var$useCard(props) {
|
|
266
|
+
let titleId = $5HlfY$useSlotId();
|
|
267
|
+
let descriptionId = $5HlfY$useSlotId();
|
|
268
|
+
let titleProps = $5HlfY$useMemo(()=>({
|
|
269
|
+
id: titleId
|
|
270
|
+
})
|
|
271
|
+
, [
|
|
272
|
+
titleId
|
|
273
|
+
]);
|
|
274
|
+
let contentProps = $5HlfY$useMemo(()=>({
|
|
275
|
+
id: descriptionId
|
|
276
|
+
})
|
|
277
|
+
, [
|
|
278
|
+
descriptionId
|
|
279
|
+
]);
|
|
280
|
+
return {
|
|
281
|
+
cardProps: {
|
|
282
|
+
...$5HlfY$filterDOMProps(props),
|
|
283
|
+
'aria-labelledby': titleId,
|
|
284
|
+
'aria-describedby': descriptionId,
|
|
285
|
+
tabIndex: 0
|
|
286
|
+
},
|
|
287
|
+
titleProps: titleProps,
|
|
288
|
+
contentProps: contentProps
|
|
289
|
+
};
|
|
289
290
|
}
|
|
290
291
|
/**
|
|
291
292
|
* TODO: Add description of component here.
|
|
292
|
-
*/
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
const $c6a745aa43479b6f54b3654a7597126$export$CardBase = /*#__PURE__*/_react.forwardRef($c6a745aa43479b6f54b3654a7597126$var$CardBase);
|
|
296
|
-
|
|
297
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/ar-AE.json
|
|
298
|
-
var $a48fff6baafc14357869c7ba184ba3$exports = {};
|
|
299
|
-
$a48fff6baafc14357869c7ba184ba3$exports = JSON.parse("{\"loading\":\"جارٍ التحميل...\",\"loadingMore\":\"جارٍ تحميل المزيد...\"}");
|
|
300
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/bg-BG.json
|
|
301
|
-
var $cdfdacf1f444e611d958d2160ceac$exports = {};
|
|
302
|
-
$cdfdacf1f444e611d958d2160ceac$exports = JSON.parse("{\"loading\":\"Зареждане...\",\"loadingMore\":\"Зареждане на още...\"}");
|
|
303
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/cs-CZ.json
|
|
304
|
-
var $cbe005952e45f5a78577dca6f2878787$exports = {};
|
|
305
|
-
$cbe005952e45f5a78577dca6f2878787$exports = JSON.parse("{\"loading\":\"Načítání...\",\"loadingMore\":\"Načítání dalších...\"}");
|
|
306
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/da-DK.json
|
|
307
|
-
var $f3d60c71242396aa28fe25894$exports = {};
|
|
308
|
-
$f3d60c71242396aa28fe25894$exports = JSON.parse("{\"loading\":\"Indlæser ...\",\"loadingMore\":\"Indlæser flere ...\"}");
|
|
309
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/de-DE.json
|
|
310
|
-
var $effe5eedb2232267e20549966e185804$exports = {};
|
|
311
|
-
$effe5eedb2232267e20549966e185804$exports = JSON.parse("{\"loading\":\"Laden...\",\"loadingMore\":\"Mehr laden ...\"}");
|
|
312
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/el-GR.json
|
|
313
|
-
var $e3790519c9dc429f693cd1c5b303472$exports = {};
|
|
314
|
-
$e3790519c9dc429f693cd1c5b303472$exports = JSON.parse("{\"loading\":\"Φόρτωση...\",\"loadingMore\":\"Φόρτωση περισσότερων...\"}");
|
|
315
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/en-US.json
|
|
316
|
-
var $b4dae01fcccf57bb4d98b8d21$exports = {};
|
|
317
|
-
$b4dae01fcccf57bb4d98b8d21$exports = JSON.parse("{\"loading\":\"Loading…\",\"loadingMore\":\"Loading more…\"}");
|
|
318
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/es-ES.json
|
|
319
|
-
var $fec9899ba36d348a6dc14d3a491983d0$exports = {};
|
|
320
|
-
$fec9899ba36d348a6dc14d3a491983d0$exports = JSON.parse("{\"loading\":\"Cargando…\",\"loadingMore\":\"Cargando más…\"}");
|
|
321
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/et-EE.json
|
|
322
|
-
var $d7d9a670ce52baebcd7300d4d45$exports = {};
|
|
323
|
-
$d7d9a670ce52baebcd7300d4d45$exports = JSON.parse("{\"loading\":\"Laadimine...\",\"loadingMore\":\"Laadi rohkem...\"}");
|
|
324
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/fi-FI.json
|
|
325
|
-
var $c904b64cbe7e181eb192f704f32b719f$exports = {};
|
|
326
|
-
$c904b64cbe7e181eb192f704f32b719f$exports = JSON.parse("{\"loading\":\"Ladataan…\",\"loadingMore\":\"Ladataan lisää…\"}");
|
|
327
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/fr-FR.json
|
|
328
|
-
var $a62ed84e7cb29c4190e6a5415184066$exports = {};
|
|
329
|
-
$a62ed84e7cb29c4190e6a5415184066$exports = JSON.parse("{\"loading\":\"Chargement...\",\"loadingMore\":\"Chargement supplémentaire...\"}");
|
|
330
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/he-IL.json
|
|
331
|
-
var $a27a6ef9739766eb9bd4f6e334497e1$exports = {};
|
|
332
|
-
$a27a6ef9739766eb9bd4f6e334497e1$exports = JSON.parse("{\"loading\":\"טוען...\",\"loadingMore\":\"טוען עוד...\"}");
|
|
333
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/hr-HR.json
|
|
334
|
-
var $ab43dbbe6f5c4c5463437d2aa95e57$exports = {};
|
|
335
|
-
$ab43dbbe6f5c4c5463437d2aa95e57$exports = JSON.parse("{\"loading\":\"Učitavam...\",\"loadingMore\":\"Učitavam još...\"}");
|
|
336
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/hu-HU.json
|
|
337
|
-
var $c40c258efe2ea3819bd127742411df$exports = {};
|
|
338
|
-
$c40c258efe2ea3819bd127742411df$exports = JSON.parse("{\"loading\":\"Betöltés folyamatban…\",\"loadingMore\":\"Továbbiak betöltése folyamatban…\"}");
|
|
339
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/it-IT.json
|
|
340
|
-
var $a7202d0459de8e255cdb7037b3d81028$exports = {};
|
|
341
|
-
$a7202d0459de8e255cdb7037b3d81028$exports = JSON.parse("{\"loading\":\"Caricamento...\",\"loadingMore\":\"Caricamento altri...\"}");
|
|
342
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/ja-JP.json
|
|
343
|
-
var $bdcc3c37401ad424fda05ad660e$exports = {};
|
|
344
|
-
$bdcc3c37401ad424fda05ad660e$exports = JSON.parse("{\"loading\":\"読み込み中...\",\"loadingMore\":\"さらに読み込み中...\"}");
|
|
345
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/ko-KR.json
|
|
346
|
-
var $a6de9aee875609d6f16cdb911e9a2ea$exports = {};
|
|
347
|
-
$a6de9aee875609d6f16cdb911e9a2ea$exports = JSON.parse("{\"loading\":\"로드 중\",\"loadingMore\":\"추가 로드 중\"}");
|
|
348
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/lt-LT.json
|
|
349
|
-
var $d73fa3cf8d91580e6c9c495e2097$exports = {};
|
|
350
|
-
$d73fa3cf8d91580e6c9c495e2097$exports = JSON.parse("{\"loading\":\"Įkeliama...\",\"loadingMore\":\"Įkeliama daugiau...\"}");
|
|
351
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/lv-LV.json
|
|
352
|
-
var $adde9cfd2b8dab5551d1aca256f5$exports = {};
|
|
353
|
-
$adde9cfd2b8dab5551d1aca256f5$exports = JSON.parse("{\"loading\":\"Notiek ielāde...\",\"loadingMore\":\"Tiek ielādēts vēl...\"}");
|
|
354
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/nb-NO.json
|
|
355
|
-
var $b340c93bb7a3c43a9de387264349f$exports = {};
|
|
356
|
-
$b340c93bb7a3c43a9de387264349f$exports = JSON.parse("{\"loading\":\"Laster inn ...\",\"loadingMore\":\"Laster inn flere ...\"}");
|
|
357
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/nl-NL.json
|
|
358
|
-
var $fcd8da7d81f7e315441ad585$exports = {};
|
|
359
|
-
$fcd8da7d81f7e315441ad585$exports = JSON.parse("{\"loading\":\"Laden...\",\"loadingMore\":\"Meer laden...\"}");
|
|
360
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/pl-PL.json
|
|
361
|
-
var $cf1c5142cd54b08bd715986e514d74$exports = {};
|
|
362
|
-
$cf1c5142cd54b08bd715986e514d74$exports = JSON.parse("{\"loading\":\"Ładowanie...\",\"loadingMore\":\"Wczytywanie większej liczby...\"}");
|
|
363
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/pt-BR.json
|
|
364
|
-
var $c53077173e193102c50d50047bba2ac$exports = {};
|
|
365
|
-
$c53077173e193102c50d50047bba2ac$exports = JSON.parse("{\"loading\":\"Carregando...\",\"loadingMore\":\"Carregando mais...\"}");
|
|
366
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/pt-PT.json
|
|
367
|
-
var $c060c375054a9bf3691edc74eaf34$exports = {};
|
|
368
|
-
$c060c375054a9bf3691edc74eaf34$exports = JSON.parse("{\"loading\":\"A carregar...\",\"loadingMore\":\"A carregar mais...\"}");
|
|
369
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/ro-RO.json
|
|
370
|
-
var $c2cf417e1f8067f995ffb7f8685a11ee$exports = {};
|
|
371
|
-
$c2cf417e1f8067f995ffb7f8685a11ee$exports = JSON.parse("{\"loading\":\"Se încarcă...\",\"loadingMore\":\"Se încarcă mai multe...\"}");
|
|
372
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/ru-RU.json
|
|
373
|
-
var $b8ce033d285db73f0f0ae204b0aca95d$exports = {};
|
|
374
|
-
$b8ce033d285db73f0f0ae204b0aca95d$exports = JSON.parse("{\"loading\":\"Загрузка...\",\"loadingMore\":\"Дополнительная загрузка...\"}");
|
|
375
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/sk-SK.json
|
|
376
|
-
var $a488925d7c46f74ebab8dc5cc3$exports = {};
|
|
377
|
-
$a488925d7c46f74ebab8dc5cc3$exports = JSON.parse("{\"loading\":\"Načítava sa...\",\"loadingMore\":\"Načítava sa viac...\"}");
|
|
378
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/sl-SI.json
|
|
379
|
-
var $b3de483b2bcf0bc3bf20f31c82afb$exports = {};
|
|
380
|
-
$b3de483b2bcf0bc3bf20f31c82afb$exports = JSON.parse("{\"loading\":\"Nalaganje...\",\"loadingMore\":\"Nalaganje več vsebine...\"}");
|
|
381
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/sr-SP.json
|
|
382
|
-
var $a8d253a375ac942fc38dbda4834b02e9$exports = {};
|
|
383
|
-
$a8d253a375ac942fc38dbda4834b02e9$exports = JSON.parse("{\"loading\":\"Učitavam...\",\"loadingMore\":\"Učitavam još...\"}");
|
|
384
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/sv-SE.json
|
|
385
|
-
var $b561e742c0386e4246d8f2d6e6df93e9$exports = {};
|
|
386
|
-
$b561e742c0386e4246d8f2d6e6df93e9$exports = JSON.parse("{\"loading\":\"Läser in...\",\"loadingMore\":\"Läser in mer...\"}");
|
|
387
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/tr-TR.json
|
|
388
|
-
var $da867bd1099b01253ac759ca7020ee$exports = {};
|
|
389
|
-
$da867bd1099b01253ac759ca7020ee$exports = JSON.parse("{\"loading\":\"Yükleniyor...\",\"loadingMore\":\"Daha fazla yükleniyor...\"}");
|
|
390
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/uk-UA.json
|
|
391
|
-
var $c907146e4b2bc48ffdb20f25884dca4$exports = {};
|
|
392
|
-
$c907146e4b2bc48ffdb20f25884dca4$exports = JSON.parse("{\"loading\":\"Завантаження…\",\"loadingMore\":\"Завантаження інших об’єктів...\"}");
|
|
393
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/zh-CN.json
|
|
394
|
-
var $b747d69bc7146092b42e6b9d8758$exports = {};
|
|
395
|
-
$b747d69bc7146092b42e6b9d8758$exports = JSON.parse("{\"loading\":\"正在加载...\",\"loadingMore\":\"正在加载更多...\"}");
|
|
396
|
-
// ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/zh-TW.json
|
|
397
|
-
var $ea3eb1b4589dd69e29e4f55504e$exports = {};
|
|
398
|
-
$ea3eb1b4589dd69e29e4f55504e$exports = JSON.parse("{\"loading\":\"正在載入\",\"loadingMore\":\"正在載入更多…\"}");
|
|
399
|
-
// @ts-ignore
|
|
400
|
-
const $e295579aca996ab66b8081d2bb9$var$intlMessages = {
|
|
401
|
-
"ar-AE": _babelRuntimeHelpersEsmInteropRequireDefault($a48fff6baafc14357869c7ba184ba3$exports).default,
|
|
402
|
-
"bg-BG": _babelRuntimeHelpersEsmInteropRequireDefault($cdfdacf1f444e611d958d2160ceac$exports).default,
|
|
403
|
-
"cs-CZ": _babelRuntimeHelpersEsmInteropRequireDefault($cbe005952e45f5a78577dca6f2878787$exports).default,
|
|
404
|
-
"da-DK": _babelRuntimeHelpersEsmInteropRequireDefault($f3d60c71242396aa28fe25894$exports).default,
|
|
405
|
-
"de-DE": _babelRuntimeHelpersEsmInteropRequireDefault($effe5eedb2232267e20549966e185804$exports).default,
|
|
406
|
-
"el-GR": _babelRuntimeHelpersEsmInteropRequireDefault($e3790519c9dc429f693cd1c5b303472$exports).default,
|
|
407
|
-
"en-US": _babelRuntimeHelpersEsmInteropRequireDefault($b4dae01fcccf57bb4d98b8d21$exports).default,
|
|
408
|
-
"es-ES": _babelRuntimeHelpersEsmInteropRequireDefault($fec9899ba36d348a6dc14d3a491983d0$exports).default,
|
|
409
|
-
"et-EE": _babelRuntimeHelpersEsmInteropRequireDefault($d7d9a670ce52baebcd7300d4d45$exports).default,
|
|
410
|
-
"fi-FI": _babelRuntimeHelpersEsmInteropRequireDefault($c904b64cbe7e181eb192f704f32b719f$exports).default,
|
|
411
|
-
"fr-FR": _babelRuntimeHelpersEsmInteropRequireDefault($a62ed84e7cb29c4190e6a5415184066$exports).default,
|
|
412
|
-
"he-IL": _babelRuntimeHelpersEsmInteropRequireDefault($a27a6ef9739766eb9bd4f6e334497e1$exports).default,
|
|
413
|
-
"hr-HR": _babelRuntimeHelpersEsmInteropRequireDefault($ab43dbbe6f5c4c5463437d2aa95e57$exports).default,
|
|
414
|
-
"hu-HU": _babelRuntimeHelpersEsmInteropRequireDefault($c40c258efe2ea3819bd127742411df$exports).default,
|
|
415
|
-
"it-IT": _babelRuntimeHelpersEsmInteropRequireDefault($a7202d0459de8e255cdb7037b3d81028$exports).default,
|
|
416
|
-
"ja-JP": _babelRuntimeHelpersEsmInteropRequireDefault($bdcc3c37401ad424fda05ad660e$exports).default,
|
|
417
|
-
"ko-KR": _babelRuntimeHelpersEsmInteropRequireDefault($a6de9aee875609d6f16cdb911e9a2ea$exports).default,
|
|
418
|
-
"lt-LT": _babelRuntimeHelpersEsmInteropRequireDefault($d73fa3cf8d91580e6c9c495e2097$exports).default,
|
|
419
|
-
"lv-LV": _babelRuntimeHelpersEsmInteropRequireDefault($adde9cfd2b8dab5551d1aca256f5$exports).default,
|
|
420
|
-
"nb-NO": _babelRuntimeHelpersEsmInteropRequireDefault($b340c93bb7a3c43a9de387264349f$exports).default,
|
|
421
|
-
"nl-NL": _babelRuntimeHelpersEsmInteropRequireDefault($fcd8da7d81f7e315441ad585$exports).default,
|
|
422
|
-
"pl-PL": _babelRuntimeHelpersEsmInteropRequireDefault($cf1c5142cd54b08bd715986e514d74$exports).default,
|
|
423
|
-
"pt-BR": _babelRuntimeHelpersEsmInteropRequireDefault($c53077173e193102c50d50047bba2ac$exports).default,
|
|
424
|
-
"pt-PT": _babelRuntimeHelpersEsmInteropRequireDefault($c060c375054a9bf3691edc74eaf34$exports).default,
|
|
425
|
-
"ro-RO": _babelRuntimeHelpersEsmInteropRequireDefault($c2cf417e1f8067f995ffb7f8685a11ee$exports).default,
|
|
426
|
-
"ru-RU": _babelRuntimeHelpersEsmInteropRequireDefault($b8ce033d285db73f0f0ae204b0aca95d$exports).default,
|
|
427
|
-
"sk-SK": _babelRuntimeHelpersEsmInteropRequireDefault($a488925d7c46f74ebab8dc5cc3$exports).default,
|
|
428
|
-
"sl-SI": _babelRuntimeHelpersEsmInteropRequireDefault($b3de483b2bcf0bc3bf20f31c82afb$exports).default,
|
|
429
|
-
"sr-SP": _babelRuntimeHelpersEsmInteropRequireDefault($a8d253a375ac942fc38dbda4834b02e9$exports).default,
|
|
430
|
-
"sv-SE": _babelRuntimeHelpersEsmInteropRequireDefault($b561e742c0386e4246d8f2d6e6df93e9$exports).default,
|
|
431
|
-
"tr-TR": _babelRuntimeHelpersEsmInteropRequireDefault($da867bd1099b01253ac759ca7020ee$exports).default,
|
|
432
|
-
"uk-UA": _babelRuntimeHelpersEsmInteropRequireDefault($c907146e4b2bc48ffdb20f25884dca4$exports).default,
|
|
433
|
-
"zh-CN": _babelRuntimeHelpersEsmInteropRequireDefault($b747d69bc7146092b42e6b9d8758$exports).default,
|
|
434
|
-
"zh-TW": _babelRuntimeHelpersEsmInteropRequireDefault($ea3eb1b4589dd69e29e4f55504e$exports).default
|
|
435
|
-
};
|
|
293
|
+
*/ const $f5426ba654d120b1$export$7a6ccaf429ad93a8 = /*#__PURE__*/ $5HlfY$react.forwardRef($f5426ba654d120b1$var$CardBase);
|
|
436
294
|
|
|
437
|
-
function $e295579aca996ab66b8081d2bb9$var$CardView(props, ref) {
|
|
438
|
-
let {
|
|
439
|
-
scale
|
|
440
|
-
} = useProvider();
|
|
441
|
-
let {
|
|
442
|
-
styleProps
|
|
443
|
-
} = useStyleProps(props);
|
|
444
|
-
let domRef = useDOMRef(ref);
|
|
445
|
-
let {
|
|
446
|
-
isQuiet,
|
|
447
|
-
renderEmptyState,
|
|
448
|
-
layout,
|
|
449
|
-
loadingState,
|
|
450
|
-
onLoadMore,
|
|
451
|
-
cardOrientation = 'vertical'
|
|
452
|
-
} = props;
|
|
453
|
-
let collator = useCollator({
|
|
454
|
-
usage: 'search',
|
|
455
|
-
sensitivity: 'base'
|
|
456
|
-
});
|
|
457
|
-
let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
|
|
458
|
-
let cardViewLayout = useMemo(() => typeof layout === 'function' ? new layout({
|
|
459
|
-
collator,
|
|
460
|
-
cardOrientation,
|
|
461
|
-
scale
|
|
462
|
-
}) : layout, [layout, collator, cardOrientation, scale]);
|
|
463
|
-
let layoutType = cardViewLayout.layoutType;
|
|
464
|
-
let formatMessage = useMessageFormatter($e295579aca996ab66b8081d2bb9$var$intlMessages);
|
|
465
|
-
let {
|
|
466
|
-
direction
|
|
467
|
-
} = useLocale();
|
|
468
|
-
let {
|
|
469
|
-
collection
|
|
470
|
-
} = useListState(props);
|
|
471
|
-
let gridCollection = useMemo(() => new GridCollection({
|
|
472
|
-
columnCount: 1,
|
|
473
|
-
items: [...collection].map(item => _babelRuntimeHelpersEsmExtends({}, item, {
|
|
474
|
-
hasChildNodes: true,
|
|
475
|
-
childNodes: [{
|
|
476
|
-
key: "cell-" + item.key,
|
|
477
|
-
type: 'cell',
|
|
478
|
-
value: null,
|
|
479
|
-
level: 0,
|
|
480
|
-
rendered: null,
|
|
481
|
-
textValue: item.textValue,
|
|
482
|
-
hasChildNodes: false,
|
|
483
|
-
childNodes: []
|
|
484
|
-
}]
|
|
485
|
-
}))
|
|
486
|
-
}), [collection]);
|
|
487
|
-
let state = useGridState(_babelRuntimeHelpersEsmExtends({}, props, {
|
|
488
|
-
selectionMode: cardOrientation === 'horizontal' && layoutType === 'grid' ? 'none' : props.selectionMode,
|
|
489
|
-
collection: gridCollection,
|
|
490
|
-
focusMode: 'cell'
|
|
491
|
-
}));
|
|
492
|
-
cardViewLayout.collection = gridCollection;
|
|
493
|
-
cardViewLayout.disabledKeys = state.disabledKeys;
|
|
494
|
-
cardViewLayout.isLoading = isLoading;
|
|
495
|
-
cardViewLayout.direction = direction;
|
|
496
|
-
let {
|
|
497
|
-
gridProps
|
|
498
|
-
} = useGrid(_babelRuntimeHelpersEsmExtends({}, props, {
|
|
499
|
-
isVirtualized: true,
|
|
500
|
-
keyboardDelegate: cardViewLayout
|
|
501
|
-
}), state, domRef);
|
|
502
|
-
|
|
503
|
-
let renderWrapper = (parent, reusableView) => /*#__PURE__*/_react.createElement(VirtualizerItem, {
|
|
504
|
-
key: reusableView.key,
|
|
505
|
-
reusableView: reusableView,
|
|
506
|
-
parent: parent
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
let focusedKey = state.selectionManager.focusedKey;
|
|
510
|
-
let focusedItem = gridCollection.getItem(state.selectionManager.focusedKey);
|
|
511
|
-
|
|
512
|
-
if ((focusedItem == null ? void 0 : focusedItem.parentKey) != null) {
|
|
513
|
-
focusedKey = focusedItem.parentKey;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
let margin = cardViewLayout.margin || 0;
|
|
517
|
-
let virtualizer = cardViewLayout.virtualizer;
|
|
518
|
-
let scrollToItem = useCallback(key => {
|
|
519
|
-
virtualizer && virtualizer.scrollToItem(key, {
|
|
520
|
-
duration: 0,
|
|
521
|
-
offsetY: margin
|
|
522
|
-
});
|
|
523
|
-
}, [margin, virtualizer]); // TODO: does aria-row count and aria-col count need to be modified? Perhaps aria-col count needs to be omitted
|
|
524
|
-
|
|
525
|
-
return /*#__PURE__*/_react.createElement($f9069c2077073c56c9fbb170659475$export$CardViewContext.Provider, {
|
|
526
|
-
value: {
|
|
527
|
-
state,
|
|
528
|
-
isQuiet,
|
|
529
|
-
layout: cardViewLayout,
|
|
530
|
-
cardOrientation
|
|
531
|
-
}
|
|
532
|
-
}, /*#__PURE__*/_react.createElement(Virtualizer, _babelRuntimeHelpersEsmExtends({}, gridProps, styleProps, {
|
|
533
|
-
className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-CardView'),
|
|
534
|
-
ref: domRef,
|
|
535
|
-
focusedKey: focusedKey,
|
|
536
|
-
scrollDirection: "vertical",
|
|
537
|
-
layout: cardViewLayout,
|
|
538
|
-
collection: gridCollection,
|
|
539
|
-
isLoading: isLoading,
|
|
540
|
-
onLoadMore: onLoadMore,
|
|
541
|
-
renderWrapper: renderWrapper,
|
|
542
|
-
transitionDuration: isLoading ? 160 : 220,
|
|
543
|
-
scrollToItem: scrollToItem
|
|
544
|
-
}), (type, item) => {
|
|
545
|
-
if (type === 'item') {
|
|
546
|
-
return /*#__PURE__*/_react.createElement($e295579aca996ab66b8081d2bb9$var$InternalCard, {
|
|
547
|
-
item: item
|
|
548
|
-
});
|
|
549
|
-
} else if (type === 'loader') {
|
|
550
|
-
return /*#__PURE__*/_react.createElement($e295579aca996ab66b8081d2bb9$var$CenteredWrapper, null, /*#__PURE__*/_react.createElement(ProgressCircle, {
|
|
551
|
-
isIndeterminate: true,
|
|
552
|
-
"aria-label": state.collection.size > 0 ? formatMessage('loadingMore') : formatMessage('loading')
|
|
553
|
-
}));
|
|
554
|
-
} else if (type === 'placeholder') {
|
|
555
|
-
let emptyState = renderEmptyState ? renderEmptyState() : null;
|
|
556
|
-
|
|
557
|
-
if (emptyState == null) {
|
|
558
|
-
return null;
|
|
559
|
-
}
|
|
560
295
|
|
|
561
|
-
return /*#__PURE__*/_react.createElement($e295579aca996ab66b8081d2bb9$var$CenteredWrapper, null, emptyState);
|
|
562
|
-
}
|
|
563
|
-
}));
|
|
564
|
-
}
|
|
565
296
|
|
|
566
|
-
function $e295579aca996ab66b8081d2bb9$var$CenteredWrapper(_ref) {
|
|
567
|
-
let {
|
|
568
|
-
children
|
|
569
|
-
} = _ref;
|
|
570
|
-
let {
|
|
571
|
-
state
|
|
572
|
-
} = $f9069c2077073c56c9fbb170659475$export$useCardViewContext();
|
|
573
|
-
return /*#__PURE__*/_react.createElement("div", {
|
|
574
|
-
role: "row",
|
|
575
|
-
"aria-rowindex": state.collection.size + 1,
|
|
576
|
-
className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-CardView-centeredWrapper')
|
|
577
|
-
}, /*#__PURE__*/_react.createElement("div", {
|
|
578
|
-
role: "gridcell"
|
|
579
|
-
}, children));
|
|
580
|
-
}
|
|
581
297
|
|
|
582
|
-
function $e295579aca996ab66b8081d2bb9$var$InternalCard(props) {
|
|
583
|
-
let {
|
|
584
|
-
item
|
|
585
|
-
} = props;
|
|
586
|
-
let cellNode = [...item.childNodes][0];
|
|
587
|
-
let {
|
|
588
|
-
state,
|
|
589
|
-
cardOrientation,
|
|
590
|
-
isQuiet,
|
|
591
|
-
layout
|
|
592
|
-
} = $f9069c2077073c56c9fbb170659475$export$useCardViewContext();
|
|
593
|
-
let layoutType = layout.layoutType;
|
|
594
|
-
let rowRef = useRef();
|
|
595
|
-
let cellRef = useRef();
|
|
596
|
-
let unwrappedRef = useUnwrapDOMRef(cellRef);
|
|
597
|
-
let {
|
|
598
|
-
rowProps
|
|
599
|
-
} = useGridRow({
|
|
600
|
-
node: item,
|
|
601
|
-
isVirtualized: true
|
|
602
|
-
}, state, rowRef);
|
|
603
|
-
let {
|
|
604
|
-
gridCellProps
|
|
605
|
-
} = useGridCell({
|
|
606
|
-
node: cellNode,
|
|
607
|
-
focusMode: 'cell'
|
|
608
|
-
}, state, unwrappedRef);
|
|
609
|
-
|
|
610
|
-
if (layoutType === 'grid' || layoutType === 'gallery') {
|
|
611
|
-
isQuiet = true;
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
if (layoutType !== 'grid') {
|
|
615
|
-
cardOrientation = 'vertical';
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersEsmExtends({}, rowProps, {
|
|
619
|
-
ref: rowRef,
|
|
620
|
-
className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-CardView-row')
|
|
621
|
-
}), /*#__PURE__*/_react.createElement($c6a745aa43479b6f54b3654a7597126$export$CardBase, {
|
|
622
|
-
ref: cellRef,
|
|
623
|
-
articleProps: gridCellProps,
|
|
624
|
-
isQuiet: isQuiet,
|
|
625
|
-
orientation: cardOrientation,
|
|
626
|
-
item: item,
|
|
627
|
-
layout: layoutType
|
|
628
|
-
}, item.rendered));
|
|
629
|
-
}
|
|
630
|
-
/**
|
|
631
|
-
* TODO: Add description of component here.
|
|
632
|
-
*/
|
|
633
298
|
|
|
299
|
+
var $a9688f93454e315e$exports = {};
|
|
300
|
+
var $f1c965522478470a$exports = {};
|
|
301
|
+
$f1c965522478470a$exports = JSON.parse("{\"loading\":\"جارٍ التحميل...\",\"loadingMore\":\"جارٍ تحميل المزيد...\"}");
|
|
634
302
|
|
|
635
|
-
export const CardView = /*#__PURE__*/_react.forwardRef($e295579aca996ab66b8081d2bb9$var$CardView);
|
|
636
303
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
if (options === void 0) {
|
|
640
|
-
options = {};
|
|
641
|
-
}
|
|
304
|
+
var $258f258c73b34140$exports = {};
|
|
305
|
+
$258f258c73b34140$exports = JSON.parse("{\"loading\":\"Зареждане...\",\"loadingMore\":\"Зареждане на още...\"}");
|
|
642
306
|
|
|
643
|
-
super();
|
|
644
|
-
this.contentSize = void 0;
|
|
645
|
-
this.layoutInfos = void 0;
|
|
646
|
-
this.collator = void 0;
|
|
647
|
-
this.lastCollection = void 0;
|
|
648
|
-
this.collection = void 0;
|
|
649
|
-
this.isLoading = void 0;
|
|
650
|
-
this.disabledKeys = new Set();
|
|
651
|
-
this.direction = void 0;
|
|
652
|
-
this.scale = void 0;
|
|
653
|
-
this.margin = void 0;
|
|
654
|
-
this.layoutInfos = new Map();
|
|
655
|
-
this.collator = options.collator;
|
|
656
|
-
this.lastCollection = null;
|
|
657
|
-
this.scale = options.scale || 'medium';
|
|
658
|
-
this.margin = options.margin || 24;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
validate(invalidationContext) {
|
|
662
|
-
this.collection = this.virtualizer.collection;
|
|
663
|
-
this.buildCollection(invalidationContext); // Remove layout info that doesn't exist in new collection
|
|
664
|
-
|
|
665
|
-
if (this.lastCollection) {
|
|
666
|
-
for (let key of this.lastCollection.getKeys()) {
|
|
667
|
-
if (!this.collection.getItem(key)) {
|
|
668
|
-
this.layoutInfos.delete(key);
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
307
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
}
|
|
308
|
+
var $ef5732194bb762aa$exports = {};
|
|
309
|
+
$ef5732194bb762aa$exports = JSON.parse("{\"loading\":\"Načítání...\",\"loadingMore\":\"Načítání dalších...\"}");
|
|
675
310
|
|
|
676
|
-
if (this.collection.size > 0) {
|
|
677
|
-
this.layoutInfos.delete('placeholder');
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
311
|
|
|
681
|
-
|
|
682
|
-
|
|
312
|
+
var $2f662e6bd32420ed$exports = {};
|
|
313
|
+
$2f662e6bd32420ed$exports = JSON.parse("{\"loading\":\"Indlæser ...\",\"loadingMore\":\"Indlæser flere ...\"}");
|
|
683
314
|
|
|
684
315
|
|
|
685
|
-
|
|
316
|
+
var $ddcbccb79eb91ada$exports = {};
|
|
317
|
+
$ddcbccb79eb91ada$exports = JSON.parse("{\"loading\":\"Laden...\",\"loadingMore\":\"Mehr laden ...\"}");
|
|
686
318
|
|
|
687
|
-
getContentSize() {
|
|
688
|
-
return this.contentSize;
|
|
689
|
-
}
|
|
690
319
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
}
|
|
320
|
+
var $41f63e79b056efb8$exports = {};
|
|
321
|
+
$41f63e79b056efb8$exports = JSON.parse("{\"loading\":\"Φόρτωση...\",\"loadingMore\":\"Φόρτωση περισσότερων...\"}");
|
|
694
322
|
|
|
695
|
-
getVisibleLayoutInfos(rect) {
|
|
696
|
-
let res = [];
|
|
697
323
|
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
res.push(layoutInfo);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
324
|
+
var $d70c30e5619eb73d$exports = {};
|
|
325
|
+
$d70c30e5619eb73d$exports = JSON.parse("{\"loading\":\"Loading…\",\"loadingMore\":\"Loading more…\"}");
|
|
703
326
|
|
|
704
|
-
return res;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
isVisible(layoutInfo, rect) {
|
|
708
|
-
return layoutInfo.rect.intersects(rect);
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
getInitialLayoutInfo(layoutInfo) {
|
|
712
|
-
layoutInfo.opacity = 0;
|
|
713
|
-
layoutInfo.transform = 'scale3d(0.8, 0.8, 0.8)';
|
|
714
|
-
return layoutInfo;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
getFinalLayoutInfo(layoutInfo) {
|
|
718
|
-
layoutInfo.opacity = 0;
|
|
719
|
-
layoutInfo.transform = 'scale3d(0.8, 0.8, 0.8)';
|
|
720
|
-
return layoutInfo;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
_findClosestLayoutInfo(target, rect) {
|
|
724
|
-
let layoutInfos = this.getVisibleLayoutInfos(rect);
|
|
725
|
-
let best = null;
|
|
726
|
-
let bestDistance = Infinity; // Calculates distance as the distance between the center of 2 rects.
|
|
727
|
-
|
|
728
|
-
for (let cur of layoutInfos) {
|
|
729
|
-
if (cur.type === 'item') {
|
|
730
|
-
let curRect = cur.rect;
|
|
731
|
-
let targetMidX = (target.x + target.maxX) / 2;
|
|
732
|
-
let targetMidY = (target.y + target.maxY) / 2;
|
|
733
|
-
let curMidX = (curRect.x + curRect.maxX) / 2;
|
|
734
|
-
let curMidY = (curRect.y + curRect.maxY) / 2;
|
|
735
|
-
let dist = Math.pow(targetMidX - curMidX, 2) + Math.pow(targetMidY - curMidY, 2);
|
|
736
|
-
|
|
737
|
-
if (dist < bestDistance) {
|
|
738
|
-
best = cur;
|
|
739
|
-
bestDistance = dist;
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
327
|
|
|
744
|
-
|
|
745
|
-
|
|
328
|
+
var $6af18440b4fc4304$exports = {};
|
|
329
|
+
$6af18440b4fc4304$exports = JSON.parse("{\"loading\":\"Cargando…\",\"loadingMore\":\"Cargando más…\"}");
|
|
746
330
|
|
|
747
|
-
_findClosest(target, rect) {
|
|
748
|
-
let best = this._findClosestLayoutInfo(target, rect);
|
|
749
331
|
|
|
750
|
-
|
|
751
|
-
|
|
332
|
+
var $b256a08d7833d3fe$exports = {};
|
|
333
|
+
$b256a08d7833d3fe$exports = JSON.parse("{\"loading\":\"Laadimine...\",\"loadingMore\":\"Laadi rohkem...\"}");
|
|
752
334
|
|
|
753
|
-
getKeyBelow(key) {
|
|
754
|
-
var _this$_findClosest, _closestRow$childNode;
|
|
755
335
|
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
759
|
-
let rect = new Rect(layoutInfo.rect.x, layoutInfo.rect.maxY + 1, layoutInfo.rect.width, this.virtualizer.visibleRect.height);
|
|
760
|
-
let closestRow = this.collection.getItem((_this$_findClosest = this._findClosest(layoutInfo.rect, rect)) == null ? void 0 : _this$_findClosest.key);
|
|
761
|
-
return closestRow == null ? void 0 : (_closestRow$childNode = closestRow.childNodes[0]) == null ? void 0 : _closestRow$childNode.key;
|
|
762
|
-
}
|
|
336
|
+
var $a2f84e7c5453c507$exports = {};
|
|
337
|
+
$a2f84e7c5453c507$exports = JSON.parse("{\"loading\":\"Ladataan…\",\"loadingMore\":\"Ladataan lisää…\"}");
|
|
763
338
|
|
|
764
|
-
getKeyAbove(key) {
|
|
765
|
-
var _this$_findClosest2, _closestRow$childNode2;
|
|
766
339
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
770
|
-
let rect = new Rect(layoutInfo.rect.x, 0, layoutInfo.rect.width, layoutInfo.rect.y - 1);
|
|
771
|
-
let closestRow = this.collection.getItem((_this$_findClosest2 = this._findClosest(layoutInfo.rect, rect)) == null ? void 0 : _this$_findClosest2.key);
|
|
772
|
-
return closestRow == null ? void 0 : (_closestRow$childNode2 = closestRow.childNodes[0]) == null ? void 0 : _closestRow$childNode2.key;
|
|
773
|
-
}
|
|
340
|
+
var $33476d0b38939258$exports = {};
|
|
341
|
+
$33476d0b38939258$exports = JSON.parse("{\"loading\":\"Chargement...\",\"loadingMore\":\"Chargement supplémentaire...\"}");
|
|
774
342
|
|
|
775
|
-
getKeyRightOf(key) {
|
|
776
|
-
// Expected key is the currently focused cell so we need the parent row key
|
|
777
|
-
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
778
|
-
key = this.direction === 'rtl' ? this.collection.getKeyBefore(parentRowKey) : this.collection.getKeyAfter(parentRowKey);
|
|
779
343
|
|
|
780
|
-
|
|
781
|
-
|
|
344
|
+
var $c7acb2bb2d66bea1$exports = {};
|
|
345
|
+
$c7acb2bb2d66bea1$exports = JSON.parse("{\"loading\":\"טוען...\",\"loadingMore\":\"טוען עוד...\"}");
|
|
782
346
|
|
|
783
|
-
if (item.type === 'item') {
|
|
784
|
-
return item.childNodes[0].key;
|
|
785
|
-
}
|
|
786
347
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
}
|
|
348
|
+
var $8eaef8846866f180$exports = {};
|
|
349
|
+
$8eaef8846866f180$exports = JSON.parse("{\"loading\":\"Učitavam...\",\"loadingMore\":\"Učitavam još...\"}");
|
|
790
350
|
|
|
791
|
-
getKeyLeftOf(key) {
|
|
792
|
-
// Expected key is the currently focused cell so we need the parent row key
|
|
793
|
-
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
794
|
-
key = this.direction === 'rtl' ? this.collection.getKeyAfter(parentRowKey) : this.collection.getKeyBefore(parentRowKey);
|
|
795
351
|
|
|
796
|
-
|
|
797
|
-
|
|
352
|
+
var $1dcad2bb2e9add1c$exports = {};
|
|
353
|
+
$1dcad2bb2e9add1c$exports = JSON.parse("{\"loading\":\"Betöltés folyamatban…\",\"loadingMore\":\"Továbbiak betöltése folyamatban…\"}");
|
|
798
354
|
|
|
799
|
-
if (item.type === 'item') {
|
|
800
|
-
return item.childNodes[0].key;
|
|
801
|
-
}
|
|
802
355
|
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
}
|
|
356
|
+
var $be40348598307b09$exports = {};
|
|
357
|
+
$be40348598307b09$exports = JSON.parse("{\"loading\":\"Caricamento...\",\"loadingMore\":\"Caricamento altri...\"}");
|
|
806
358
|
|
|
807
|
-
getFirstKey() {
|
|
808
|
-
let firstRow = this.collection.getItem(this.collection.getFirstKey());
|
|
809
|
-
return firstRow.childNodes[0].key;
|
|
810
|
-
}
|
|
811
359
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
return lastRow.childNodes[0].key;
|
|
815
|
-
} // TODO: pretty unwieldy because it needs to bounce back and forth between the parent key and the child key
|
|
816
|
-
// Perhaps have layoutInfo store childKey as well so we don't need to do this? Or maybe make the layoutInfos be the cells instead of the rows?
|
|
360
|
+
var $f261faeefcf5de9c$exports = {};
|
|
361
|
+
$f261faeefcf5de9c$exports = JSON.parse("{\"loading\":\"読み込み中...\",\"loadingMore\":\"さらに読み込み中...\"}");
|
|
817
362
|
|
|
818
363
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
822
|
-
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
364
|
+
var $b1e6372a949b2b14$exports = {};
|
|
365
|
+
$b1e6372a949b2b14$exports = JSON.parse("{\"loading\":\"로드 중\",\"loadingMore\":\"추가 로드 중\"}");
|
|
823
366
|
|
|
824
|
-
if (layoutInfo) {
|
|
825
|
-
var _this$collection$getI;
|
|
826
367
|
|
|
827
|
-
|
|
828
|
-
|
|
368
|
+
var $9be4abe6e0c32588$exports = {};
|
|
369
|
+
$9be4abe6e0c32588$exports = JSON.parse("{\"loading\":\"Įkeliama...\",\"loadingMore\":\"Įkeliama daugiau...\"}");
|
|
829
370
|
|
|
830
|
-
let keyAbove = (_this$collection$getI = this.collection.getItem(this.getKeyAbove(key))) == null ? void 0 : _this$collection$getI.parentKey;
|
|
831
|
-
layoutInfo = this.getLayoutInfo(keyAbove);
|
|
832
371
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
var _this$collection$getI2;
|
|
372
|
+
var $4ea933677bb9459b$exports = {};
|
|
373
|
+
$4ea933677bb9459b$exports = JSON.parse("{\"loading\":\"Notiek ielāde...\",\"loadingMore\":\"Tiek ielādēts vēl...\"}");
|
|
836
374
|
|
|
837
|
-
let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
|
|
838
|
-
let keyAbove = (_this$collection$getI2 = this.collection.getItem(this.getKeyAbove(childKey))) == null ? void 0 : _this$collection$getI2.parentKey;
|
|
839
|
-
layoutInfo = this.getLayoutInfo(keyAbove);
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
375
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
return childKey;
|
|
846
|
-
}
|
|
847
|
-
}
|
|
376
|
+
var $f58a9a8c00a78a53$exports = {};
|
|
377
|
+
$f58a9a8c00a78a53$exports = JSON.parse("{\"loading\":\"Laster inn ...\",\"loadingMore\":\"Laster inn flere ...\"}");
|
|
848
378
|
|
|
849
|
-
return this.getFirstKey();
|
|
850
|
-
} // TODO: pretty unwieldy because it needs to bounce back and forth between the parent key and the child key
|
|
851
|
-
// Perhaps have layoutInfo store childKey as well so we don't need to do this?
|
|
852
379
|
|
|
380
|
+
var $d32ce0d586610c7b$exports = {};
|
|
381
|
+
$d32ce0d586610c7b$exports = JSON.parse("{\"loading\":\"Laden...\",\"loadingMore\":\"Meer laden...\"}");
|
|
853
382
|
|
|
854
|
-
getKeyPageBelow(key) {
|
|
855
|
-
// Expected key is the currently focused cell so we need the parent row key
|
|
856
|
-
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
857
|
-
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
858
383
|
|
|
859
|
-
|
|
860
|
-
|
|
384
|
+
var $da9f25495891194a$exports = {};
|
|
385
|
+
$da9f25495891194a$exports = JSON.parse("{\"loading\":\"Ładowanie...\",\"loadingMore\":\"Wczytywanie większej liczby...\"}");
|
|
861
386
|
|
|
862
|
-
let pageY = Math.min(this.virtualizer.contentSize.height, layoutInfo.rect.y - layoutInfo.rect.height + this.virtualizer.visibleRect.height); // If the node is so large that it spans multiple page heights, return the key of the item immediately below
|
|
863
|
-
// Otherwise keep going up until we exceed a single page height worth of nodes
|
|
864
387
|
|
|
865
|
-
|
|
866
|
-
|
|
388
|
+
var $bb528c17e67c1487$exports = {};
|
|
389
|
+
$bb528c17e67c1487$exports = JSON.parse("{\"loading\":\"Carregando...\",\"loadingMore\":\"Carregando mais...\"}");
|
|
867
390
|
|
|
868
|
-
if (layoutInfo && layoutInfo.rect.y < pageY) {
|
|
869
|
-
while (layoutInfo && layoutInfo.rect.y < pageY) {
|
|
870
|
-
var _this$collection$getI4;
|
|
871
391
|
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
layoutInfo = this.getLayoutInfo(keyBelow);
|
|
875
|
-
}
|
|
876
|
-
}
|
|
392
|
+
var $8df1aa3ea22785a5$exports = {};
|
|
393
|
+
$8df1aa3ea22785a5$exports = JSON.parse("{\"loading\":\"A carregar...\",\"loadingMore\":\"A carregar mais...\"}");
|
|
877
394
|
|
|
878
|
-
if (layoutInfo) {
|
|
879
|
-
let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
|
|
880
|
-
return childKey;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
395
|
|
|
884
|
-
|
|
885
|
-
|
|
396
|
+
var $0e96de4cf068fb4b$exports = {};
|
|
397
|
+
$0e96de4cf068fb4b$exports = JSON.parse("{\"loading\":\"Se încarcă...\",\"loadingMore\":\"Se încarcă mai multe...\"}");
|
|
886
398
|
|
|
887
|
-
getKeyForSearch(search, fromKey) {
|
|
888
|
-
if (!this.collator) {
|
|
889
|
-
return null;
|
|
890
|
-
}
|
|
891
399
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
let startItem = collection.getItem(key);
|
|
895
|
-
key = startItem.parentKey;
|
|
400
|
+
var $2db0e6b44aa05e23$exports = {};
|
|
401
|
+
$2db0e6b44aa05e23$exports = JSON.parse("{\"loading\":\"Загрузка...\",\"loadingMore\":\"Дополнительная загрузка...\"}");
|
|
896
402
|
|
|
897
|
-
while (key != null) {
|
|
898
|
-
let item = collection.getItem(key);
|
|
899
403
|
|
|
900
|
-
|
|
901
|
-
|
|
404
|
+
var $cc404e3773f146c7$exports = {};
|
|
405
|
+
$cc404e3773f146c7$exports = JSON.parse("{\"loading\":\"Načítava sa...\",\"loadingMore\":\"Načítava sa viac...\"}");
|
|
902
406
|
|
|
903
|
-
if (this.collator.compare(substring, search) === 0) {
|
|
904
|
-
return [...item.childNodes][0].key;
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
407
|
|
|
908
|
-
|
|
909
|
-
|
|
408
|
+
var $69d915fc7f90e25a$exports = {};
|
|
409
|
+
$69d915fc7f90e25a$exports = JSON.parse("{\"loading\":\"Nalaganje...\",\"loadingMore\":\"Nalaganje več vsebine...\"}");
|
|
910
410
|
|
|
911
|
-
return null;
|
|
912
|
-
}
|
|
913
411
|
|
|
914
|
-
}
|
|
412
|
+
var $a29e14b46a3cea56$exports = {};
|
|
413
|
+
$a29e14b46a3cea56$exports = JSON.parse("{\"loading\":\"Učitavam...\",\"loadingMore\":\"Učitavam još...\"}");
|
|
915
414
|
|
|
916
|
-
const $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS = {
|
|
917
|
-
S: {
|
|
918
|
-
idealRowHeight: 112,
|
|
919
|
-
minItemSize: new Size(96, 96),
|
|
920
|
-
itemSpacing: new Size(8, 16),
|
|
921
|
-
itemPadding: 24,
|
|
922
|
-
dropSpacing: 50,
|
|
923
|
-
margin: 8
|
|
924
|
-
},
|
|
925
|
-
L: {
|
|
926
|
-
idealRowHeight: 208,
|
|
927
|
-
minItemSize: new Size(136, 136),
|
|
928
|
-
itemSpacing: new Size(18, 18),
|
|
929
|
-
itemPadding: {
|
|
930
|
-
'medium': 114,
|
|
931
|
-
'large': 143
|
|
932
|
-
},
|
|
933
|
-
dropSpacing: 100,
|
|
934
|
-
margin: 24
|
|
935
|
-
}
|
|
936
|
-
};
|
|
937
|
-
export class GalleryLayout extends $aae6c2773b778a15b92f7e7612b9cfc5$export$BaseLayout {
|
|
938
|
-
constructor(options) {
|
|
939
|
-
if (options === void 0) {
|
|
940
|
-
options = {};
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
super(options);
|
|
944
|
-
this.idealRowHeight = void 0;
|
|
945
|
-
this.itemSpacing = void 0;
|
|
946
|
-
this.itemPadding = void 0;
|
|
947
|
-
this.minItemSize = void 0;
|
|
948
|
-
this.threshold = void 0;
|
|
949
|
-
let cardSize = 'L';
|
|
950
|
-
this.idealRowHeight = options.idealRowHeight || $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS[cardSize].idealRowHeight;
|
|
951
|
-
this.itemSpacing = options.itemSpacing || $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS[cardSize].itemSpacing;
|
|
952
|
-
this.itemPadding = options.itemPadding != null ? options.itemPadding : $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS[cardSize].itemPadding[this.scale];
|
|
953
|
-
this.minItemSize = options.minItemSize || $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS[cardSize].minItemSize;
|
|
954
|
-
this.threshold = options.threshold || 1;
|
|
955
|
-
this.margin = options.margin != null ? options.margin : $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS[cardSize].margin;
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
get layoutType() {
|
|
959
|
-
return 'gallery';
|
|
960
|
-
}
|
|
961
|
-
/**
|
|
962
|
-
* Takes a row of widths and if there are any widths smaller than the min-width, leech width starting from
|
|
963
|
-
* the widest in the row until it can't give anymore, then move to the second widest and so forth.
|
|
964
|
-
* Do this until all assets meet the min-width.
|
|
965
|
-
* */
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
_distributeWidths(widths) {
|
|
969
|
-
// create a copy of the widths array and sort it largest to smallest
|
|
970
|
-
let sortedWidths = widths.concat().sort((a, b) => a[1] > b[1] ? -1 : 1);
|
|
971
|
-
|
|
972
|
-
for (let width of widths) {
|
|
973
|
-
// for each width, if it's smaller than the min width
|
|
974
|
-
if (width[1] < this.minItemSize.width) {
|
|
975
|
-
// then figure out how much smaller
|
|
976
|
-
let delta = this.minItemSize.width - width[1];
|
|
977
|
-
|
|
978
|
-
for (let item of sortedWidths) {
|
|
979
|
-
// go from the largest width in the row to the smallest
|
|
980
|
-
// if the width is greater than the min width
|
|
981
|
-
if (widths[item[0]][1] > this.minItemSize.width) {
|
|
982
|
-
// subtract the delta from the width, if it's still greater than the min width
|
|
983
|
-
// then we have finished, subtract the delta permanently from that width
|
|
984
|
-
if (widths[item[0]][1] - delta > this.minItemSize.width) {
|
|
985
|
-
widths[item[0]][1] -= delta;
|
|
986
|
-
delta = 0;
|
|
987
|
-
break;
|
|
988
|
-
} else {
|
|
989
|
-
// otherwise, we take as much as we can from the current width and then move on to
|
|
990
|
-
// the next largest and take some width from it
|
|
991
|
-
let maxChange = widths[item[0]][1] - this.minItemSize.width;
|
|
992
|
-
delta -= maxChange;
|
|
993
|
-
widths[item[0]][1] -= maxChange;
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
415
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
} // force the width to be the min width that we just rebalanced for
|
|
416
|
+
var $cb43852ba88bffdc$exports = {};
|
|
417
|
+
$cb43852ba88bffdc$exports = JSON.parse("{\"loading\":\"Läser in...\",\"loadingMore\":\"Läser in mer...\"}");
|
|
1001
418
|
|
|
1002
419
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
}
|
|
420
|
+
var $0467302e539f6db7$exports = {};
|
|
421
|
+
$0467302e539f6db7$exports = JSON.parse("{\"loading\":\"Yükleniyor...\",\"loadingMore\":\"Daha fazla yükleniyor...\"}");
|
|
1006
422
|
|
|
1007
|
-
return true;
|
|
1008
|
-
}
|
|
1009
423
|
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
let visibleHeight = this.virtualizer.visibleRect.height;
|
|
1013
|
-
let y = this.margin;
|
|
1014
|
-
let availableWidth = visibleWidth - this.margin * 2; // Compute aspect ratios for all of the items, and the total width if all items were on in a single row.
|
|
424
|
+
var $5bfb6b3edb939b39$exports = {};
|
|
425
|
+
$5bfb6b3edb939b39$exports = JSON.parse("{\"loading\":\"Завантаження…\",\"loadingMore\":\"Завантаження інших об’єктів...\"}");
|
|
1015
426
|
|
|
1016
|
-
let ratios = [];
|
|
1017
|
-
let totalWidth = 0;
|
|
1018
|
-
let minRatio = this.minItemSize.width / this.minItemSize.height;
|
|
1019
|
-
let maxRatio = availableWidth / this.minItemSize.height;
|
|
1020
427
|
|
|
1021
|
-
|
|
1022
|
-
|
|
428
|
+
var $0a49c0d8a03dff24$exports = {};
|
|
429
|
+
$0a49c0d8a03dff24$exports = JSON.parse("{\"loading\":\"正在加载...\",\"loadingMore\":\"正在加载更多...\"}");
|
|
1023
430
|
|
|
1024
|
-
if (ratio < minRatio) {
|
|
1025
|
-
ratio = minRatio;
|
|
1026
|
-
} else if (ratio > maxRatio && ratio !== minRatio) {
|
|
1027
|
-
ratio = maxRatio;
|
|
1028
|
-
}
|
|
1029
431
|
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
totalWidth += itemWidth;
|
|
1033
|
-
}
|
|
432
|
+
var $53b72944f95de503$exports = {};
|
|
433
|
+
$53b72944f95de503$exports = JSON.parse("{\"loading\":\"正在載入\",\"loadingMore\":\"正在載入更多…\"}");
|
|
1034
434
|
|
|
1035
|
-
totalWidth += this.itemSpacing.width * (this.collection.size - 1); // Determine how many rows we'll need, and partition the items into rows
|
|
1036
|
-
// using the aspect ratios as weights.
|
|
1037
435
|
|
|
1038
|
-
|
|
1039
|
-
|
|
436
|
+
$a9688f93454e315e$exports = {
|
|
437
|
+
"ar-AE": $f1c965522478470a$exports,
|
|
438
|
+
"bg-BG": $258f258c73b34140$exports,
|
|
439
|
+
"cs-CZ": $ef5732194bb762aa$exports,
|
|
440
|
+
"da-DK": $2f662e6bd32420ed$exports,
|
|
441
|
+
"de-DE": $ddcbccb79eb91ada$exports,
|
|
442
|
+
"el-GR": $41f63e79b056efb8$exports,
|
|
443
|
+
"en-US": $d70c30e5619eb73d$exports,
|
|
444
|
+
"es-ES": $6af18440b4fc4304$exports,
|
|
445
|
+
"et-EE": $b256a08d7833d3fe$exports,
|
|
446
|
+
"fi-FI": $a2f84e7c5453c507$exports,
|
|
447
|
+
"fr-FR": $33476d0b38939258$exports,
|
|
448
|
+
"he-IL": $c7acb2bb2d66bea1$exports,
|
|
449
|
+
"hr-HR": $8eaef8846866f180$exports,
|
|
450
|
+
"hu-HU": $1dcad2bb2e9add1c$exports,
|
|
451
|
+
"it-IT": $be40348598307b09$exports,
|
|
452
|
+
"ja-JP": $f261faeefcf5de9c$exports,
|
|
453
|
+
"ko-KR": $b1e6372a949b2b14$exports,
|
|
454
|
+
"lt-LT": $9be4abe6e0c32588$exports,
|
|
455
|
+
"lv-LV": $4ea933677bb9459b$exports,
|
|
456
|
+
"nb-NO": $f58a9a8c00a78a53$exports,
|
|
457
|
+
"nl-NL": $d32ce0d586610c7b$exports,
|
|
458
|
+
"pl-PL": $da9f25495891194a$exports,
|
|
459
|
+
"pt-BR": $bb528c17e67c1487$exports,
|
|
460
|
+
"pt-PT": $8df1aa3ea22785a5$exports,
|
|
461
|
+
"ro-RO": $0e96de4cf068fb4b$exports,
|
|
462
|
+
"ru-RU": $2db0e6b44aa05e23$exports,
|
|
463
|
+
"sk-SK": $cc404e3773f146c7$exports,
|
|
464
|
+
"sl-SI": $69d915fc7f90e25a$exports,
|
|
465
|
+
"sr-SP": $a29e14b46a3cea56$exports,
|
|
466
|
+
"sv-SE": $cb43852ba88bffdc$exports,
|
|
467
|
+
"tr-TR": $0467302e539f6db7$exports,
|
|
468
|
+
"uk-UA": $5bfb6b3edb939b39$exports,
|
|
469
|
+
"zh-CN": $0a49c0d8a03dff24$exports,
|
|
470
|
+
"zh-TW": $53b72944f95de503$exports
|
|
471
|
+
};
|
|
1040
472
|
|
|
1041
|
-
if (availableWidth <= this.minItemSize.width * 2 + this.itemPadding * 2) {
|
|
1042
|
-
rows = this.collection.size;
|
|
1043
|
-
}
|
|
1044
473
|
|
|
1045
|
-
let weightedRatios = ratios.map(ratio => ratio < this.threshold ? ratio + 0.5 * (1 / ratio) : ratio);
|
|
1046
|
-
let partition = $e9ed5e9ac7fa3fdf4332ceb63dd0$var$linearPartition(weightedRatios, rows);
|
|
1047
|
-
let index = 0;
|
|
1048
474
|
|
|
1049
|
-
for (let row of partition) {
|
|
1050
|
-
// Compute the total weight for this row
|
|
1051
|
-
let totalWeight = 0;
|
|
1052
475
|
|
|
1053
|
-
for (let j = index; j < index + row.length; j++) {
|
|
1054
|
-
totalWeight += ratios[j];
|
|
1055
|
-
} // Determine the row height based on the total available width and weight of this row.
|
|
1056
476
|
|
|
1057
477
|
|
|
1058
|
-
let bestRowHeight = (availableWidth - (row.length - 1) * this.itemSpacing.width) / totalWeight; // if this is the last row and the row height is >2x the ideal row height, then cap to the ideal height
|
|
1059
|
-
// probably doing this because if the last row has one extremely tall image, then the row becomes huge
|
|
1060
|
-
// though that can happen anywhere if a row has lots of tall images... so i'm not sure why this one matters
|
|
1061
478
|
|
|
1062
|
-
if (row === partition[partition.length - 1] && bestRowHeight > this.idealRowHeight * 2) {
|
|
1063
|
-
bestRowHeight = this.idealRowHeight;
|
|
1064
|
-
}
|
|
1065
479
|
|
|
1066
|
-
let itemHeight = Math.round(bestRowHeight) + this.itemPadding;
|
|
1067
|
-
let x = this.margin; // if any items are going to end up too small, add a bit of width to them and subtract it from wider objects
|
|
1068
480
|
|
|
1069
|
-
let widths = [];
|
|
1070
481
|
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
482
|
+
function $c6398e7007a75897$var$CardView(props, ref) {
|
|
483
|
+
let { scale: scale } = $5HlfY$useProvider();
|
|
484
|
+
let { styleProps: styleProps } = $5HlfY$useStyleProps(props);
|
|
485
|
+
let domRef = $5HlfY$useDOMRef(ref);
|
|
486
|
+
let { isQuiet: isQuiet , renderEmptyState: renderEmptyState , layout: layout , loadingState: loadingState , onLoadMore: onLoadMore , cardOrientation: cardOrientation = 'vertical' } = props;
|
|
487
|
+
let collator = $5HlfY$useCollator({
|
|
488
|
+
usage: 'search',
|
|
489
|
+
sensitivity: 'base'
|
|
490
|
+
});
|
|
491
|
+
let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
|
|
492
|
+
let cardViewLayout = $5HlfY$useMemo(()=>typeof layout === 'function' ? new layout({
|
|
493
|
+
collator: collator,
|
|
494
|
+
cardOrientation: cardOrientation,
|
|
495
|
+
scale: scale
|
|
496
|
+
}) : layout
|
|
497
|
+
, [
|
|
498
|
+
layout,
|
|
499
|
+
collator,
|
|
500
|
+
cardOrientation,
|
|
501
|
+
scale
|
|
502
|
+
]);
|
|
503
|
+
let layoutType = cardViewLayout.layoutType;
|
|
504
|
+
let formatMessage = $5HlfY$useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($a9688f93454e315e$exports)));
|
|
505
|
+
let { direction: direction } = $5HlfY$useLocale();
|
|
506
|
+
let { collection: collection } = $5HlfY$useListState(props);
|
|
507
|
+
let gridCollection = $5HlfY$useMemo(()=>new $5HlfY$GridCollection({
|
|
508
|
+
columnCount: 1,
|
|
509
|
+
items: [
|
|
510
|
+
...collection
|
|
511
|
+
].map((item)=>({
|
|
512
|
+
// Makes the Grid row use the keys the user provides to the cards so that selection change via interactions returns the card keys
|
|
513
|
+
...item,
|
|
514
|
+
hasChildNodes: true,
|
|
515
|
+
childNodes: [
|
|
516
|
+
{
|
|
517
|
+
key: `cell-${item.key}`,
|
|
518
|
+
type: 'cell',
|
|
519
|
+
value: null,
|
|
520
|
+
level: 0,
|
|
521
|
+
rendered: null,
|
|
522
|
+
textValue: item.textValue,
|
|
523
|
+
hasChildNodes: false,
|
|
524
|
+
childNodes: []
|
|
525
|
+
}
|
|
526
|
+
]
|
|
527
|
+
})
|
|
528
|
+
)
|
|
529
|
+
})
|
|
530
|
+
, [
|
|
531
|
+
collection
|
|
532
|
+
]);
|
|
533
|
+
let state = $5HlfY$useGridState({
|
|
534
|
+
...props,
|
|
535
|
+
selectionMode: cardOrientation === 'horizontal' && layoutType === 'grid' ? 'none' : props.selectionMode,
|
|
536
|
+
collection: gridCollection,
|
|
537
|
+
focusMode: 'cell'
|
|
538
|
+
});
|
|
539
|
+
cardViewLayout.collection = gridCollection;
|
|
540
|
+
cardViewLayout.disabledKeys = state.disabledKeys;
|
|
541
|
+
cardViewLayout.isLoading = isLoading;
|
|
542
|
+
cardViewLayout.direction = direction;
|
|
543
|
+
let { gridProps: gridProps } = $5HlfY$useGrid({
|
|
544
|
+
...props,
|
|
545
|
+
isVirtualized: true,
|
|
546
|
+
keyboardDelegate: cardViewLayout
|
|
547
|
+
}, state, domRef);
|
|
548
|
+
let renderWrapper = (parent, reusableView)=>/*#__PURE__*/ $5HlfY$react.createElement($5HlfY$VirtualizerItem, {
|
|
549
|
+
key: reusableView.key,
|
|
550
|
+
reusableView: reusableView,
|
|
551
|
+
parent: parent
|
|
552
|
+
})
|
|
553
|
+
;
|
|
554
|
+
let focusedKey = state.selectionManager.focusedKey;
|
|
555
|
+
let focusedItem = gridCollection.getItem(state.selectionManager.focusedKey);
|
|
556
|
+
if (focusedItem?.parentKey != null) focusedKey = focusedItem.parentKey;
|
|
557
|
+
let margin = cardViewLayout.margin || 0;
|
|
558
|
+
let virtualizer = cardViewLayout.virtualizer;
|
|
559
|
+
let scrollToItem = $5HlfY$useCallback((key)=>{
|
|
560
|
+
virtualizer && virtualizer.scrollToItem(key, {
|
|
561
|
+
duration: 0,
|
|
562
|
+
offsetY: margin
|
|
563
|
+
});
|
|
564
|
+
}, [
|
|
565
|
+
margin,
|
|
566
|
+
virtualizer
|
|
567
|
+
]);
|
|
568
|
+
// TODO: does aria-row count and aria-col count need to be modified? Perhaps aria-col count needs to be omitted
|
|
569
|
+
return(/*#__PURE__*/ $5HlfY$react.createElement($9a000cf0a62ebe41$export$64992ac69f286e5c.Provider, {
|
|
570
|
+
value: {
|
|
571
|
+
state: state,
|
|
572
|
+
isQuiet: isQuiet,
|
|
573
|
+
layout: cardViewLayout,
|
|
574
|
+
cardOrientation: cardOrientation
|
|
575
|
+
}
|
|
576
|
+
}, /*#__PURE__*/ $5HlfY$react.createElement($5HlfY$Virtualizer, {
|
|
577
|
+
...gridProps,
|
|
578
|
+
...styleProps,
|
|
579
|
+
className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-CardView'),
|
|
580
|
+
ref: domRef,
|
|
581
|
+
focusedKey: focusedKey,
|
|
582
|
+
scrollDirection: "vertical",
|
|
583
|
+
layout: cardViewLayout,
|
|
584
|
+
collection: gridCollection,
|
|
585
|
+
isLoading: isLoading,
|
|
586
|
+
onLoadMore: onLoadMore,
|
|
587
|
+
renderWrapper: renderWrapper,
|
|
588
|
+
transitionDuration: isLoading ? 160 : 220,
|
|
589
|
+
scrollToItem: scrollToItem
|
|
590
|
+
}, (type, item)=>{
|
|
591
|
+
if (type === 'item') return(/*#__PURE__*/ $5HlfY$react.createElement($c6398e7007a75897$var$InternalCard, {
|
|
592
|
+
item: item
|
|
593
|
+
}));
|
|
594
|
+
else if (type === 'loader') return(/*#__PURE__*/ $5HlfY$react.createElement($c6398e7007a75897$var$CenteredWrapper, null, /*#__PURE__*/ $5HlfY$react.createElement($5HlfY$ProgressCircle, {
|
|
595
|
+
isIndeterminate: true,
|
|
596
|
+
"aria-label": state.collection.size > 0 ? formatMessage('loadingMore') : formatMessage('loading')
|
|
597
|
+
})));
|
|
598
|
+
else if (type === 'placeholder') {
|
|
599
|
+
let emptyState = renderEmptyState ? renderEmptyState() : null;
|
|
600
|
+
if (emptyState == null) return null;
|
|
601
|
+
return(/*#__PURE__*/ $5HlfY$react.createElement($c6398e7007a75897$var$CenteredWrapper, null, emptyState));
|
|
602
|
+
}
|
|
603
|
+
})));
|
|
604
|
+
}
|
|
605
|
+
function $c6398e7007a75897$var$CenteredWrapper({ children: children }) {
|
|
606
|
+
let { state: state } = $9a000cf0a62ebe41$export$fea0b38586ec8f13();
|
|
607
|
+
return(/*#__PURE__*/ $5HlfY$react.createElement("div", {
|
|
608
|
+
role: "row",
|
|
609
|
+
"aria-rowindex": state.collection.size + 1,
|
|
610
|
+
className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-CardView-centeredWrapper')
|
|
611
|
+
}, /*#__PURE__*/ $5HlfY$react.createElement("div", {
|
|
612
|
+
role: "gridcell"
|
|
613
|
+
}, children)));
|
|
614
|
+
}
|
|
615
|
+
function $c6398e7007a75897$var$InternalCard(props) {
|
|
616
|
+
let { item: item } = props;
|
|
617
|
+
let cellNode = [
|
|
618
|
+
...item.childNodes
|
|
619
|
+
][0];
|
|
620
|
+
let { state: state , cardOrientation: cardOrientation , isQuiet: isQuiet , layout: layout } = $9a000cf0a62ebe41$export$fea0b38586ec8f13();
|
|
621
|
+
let layoutType = layout.layoutType;
|
|
622
|
+
let rowRef = $5HlfY$useRef();
|
|
623
|
+
let cellRef = $5HlfY$useRef();
|
|
624
|
+
let unwrappedRef = $5HlfY$useUnwrapDOMRef(cellRef);
|
|
625
|
+
let { rowProps: rowProps } = $5HlfY$useGridRow({
|
|
626
|
+
node: item,
|
|
627
|
+
isVirtualized: true
|
|
628
|
+
}, state, rowRef);
|
|
629
|
+
let { gridCellProps: gridCellProps } = $5HlfY$useGridCell({
|
|
630
|
+
node: cellNode,
|
|
631
|
+
focusMode: 'cell'
|
|
632
|
+
}, state, unwrappedRef);
|
|
633
|
+
if (layoutType === 'grid' || layoutType === 'gallery') isQuiet = true;
|
|
634
|
+
if (layoutType !== 'grid') cardOrientation = 'vertical';
|
|
635
|
+
// We don't want to focus the checkbox (or any other focusable elements) within the Card
|
|
636
|
+
// when pressing the arrow keys so we delete the key down handler here. Arrow key navigation between
|
|
637
|
+
// the cards in the CardView is handled by useGrid => useSelectableCollection instead.
|
|
638
|
+
delete gridCellProps.onKeyDownCapture;
|
|
639
|
+
return(/*#__PURE__*/ $5HlfY$react.createElement("div", {
|
|
640
|
+
...rowProps,
|
|
641
|
+
ref: rowRef,
|
|
642
|
+
className: $5HlfY$classNames((/*@__PURE__*/$parcel$interopDefault($468be5d76fe318d4$exports)), 'spectrum-CardView-row')
|
|
643
|
+
}, /*#__PURE__*/ $5HlfY$react.createElement($f5426ba654d120b1$export$7a6ccaf429ad93a8, {
|
|
644
|
+
ref: cellRef,
|
|
645
|
+
articleProps: gridCellProps,
|
|
646
|
+
isQuiet: isQuiet,
|
|
647
|
+
orientation: cardOrientation,
|
|
648
|
+
item: item,
|
|
649
|
+
layout: layoutType
|
|
650
|
+
}, item.rendered)));
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* TODO: Add description of component here.
|
|
654
|
+
*/ const $c6398e7007a75897$export$7e52c821f7b6f422 = /*#__PURE__*/ $5HlfY$react.forwardRef($c6398e7007a75897$var$CardView);
|
|
1075
655
|
|
|
1076
|
-
this._distributeWidths(widths); // Create items for this row.
|
|
1077
656
|
|
|
657
|
+
var $a4ebacd960847d9c$exports = {};
|
|
1078
658
|
|
|
1079
|
-
|
|
1080
|
-
let node = this.collection.rows[j];
|
|
1081
|
-
let itemWidth = Math.max(widths[j - index][1], this.minItemSize.width);
|
|
1082
|
-
let rect = new Rect(x, y, itemWidth, itemHeight);
|
|
1083
|
-
let layoutInfo = new LayoutInfo(node.type, node.key, rect);
|
|
1084
|
-
layoutInfo.allowOverflow = true;
|
|
1085
|
-
this.layoutInfos.set(node.key, layoutInfo);
|
|
1086
|
-
x += itemWidth + this.itemSpacing.width;
|
|
1087
|
-
}
|
|
659
|
+
$parcel$export($a4ebacd960847d9c$exports, "GalleryLayout", () => $a4ebacd960847d9c$export$8e52095834484b61);
|
|
1088
660
|
|
|
1089
|
-
|
|
1090
|
-
|
|
661
|
+
class $5fa895c7c356fbff$export$64943d2e59d72a29 extends $5HlfY$Layout {
|
|
662
|
+
constructor(options = {
|
|
663
|
+
}){
|
|
664
|
+
super();
|
|
665
|
+
this.disabledKeys = new Set();
|
|
666
|
+
this.layoutInfos = new Map();
|
|
667
|
+
this.collator = options.collator;
|
|
668
|
+
this.lastCollection = null;
|
|
669
|
+
this.scale = options.scale || 'medium';
|
|
670
|
+
this.margin = options.margin || 24;
|
|
1091
671
|
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
let rect = new Rect(0, loaderY, visibleWidth, loaderHeight);
|
|
1104
|
-
let loader = new LayoutInfo('loader', 'loader', rect);
|
|
1105
|
-
this.layoutInfos.set('loader', loader);
|
|
1106
|
-
y = loader.rect.maxY;
|
|
672
|
+
validate(invalidationContext) {
|
|
673
|
+
this.collection = this.virtualizer.collection;
|
|
674
|
+
this.buildCollection(invalidationContext);
|
|
675
|
+
// Remove layout info that doesn't exist in new collection
|
|
676
|
+
if (this.lastCollection) {
|
|
677
|
+
for (let key of this.lastCollection.getKeys())if (!this.collection.getItem(key)) this.layoutInfos.delete(key);
|
|
678
|
+
if (!this.isLoading) this.layoutInfos.delete('loader');
|
|
679
|
+
if (this.collection.size > 0) this.layoutInfos.delete('placeholder');
|
|
680
|
+
}
|
|
681
|
+
this.lastCollection = this.collection;
|
|
1107
682
|
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
let rect = new Rect(0, 0, visibleWidth, visibleHeight);
|
|
1111
|
-
let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);
|
|
1112
|
-
this.layoutInfos.set('placeholder', placeholder);
|
|
1113
|
-
y = placeholder.rect.maxY;
|
|
683
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
684
|
+
buildCollection(invalidationContext) {
|
|
1114
685
|
}
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
let cost = Math.max(c1, c2);
|
|
1156
|
-
|
|
1157
|
-
if (!x || cost < currentMin) {
|
|
1158
|
-
currentMin = cost;
|
|
1159
|
-
minX = x;
|
|
686
|
+
getContentSize() {
|
|
687
|
+
return this.contentSize;
|
|
688
|
+
}
|
|
689
|
+
getLayoutInfo(key) {
|
|
690
|
+
return this.layoutInfos.get(key);
|
|
691
|
+
}
|
|
692
|
+
getVisibleLayoutInfos(rect) {
|
|
693
|
+
let res = [];
|
|
694
|
+
for (let layoutInfo of this.layoutInfos.values())if (this.isVisible(layoutInfo, rect)) res.push(layoutInfo);
|
|
695
|
+
return res;
|
|
696
|
+
}
|
|
697
|
+
isVisible(layoutInfo, rect) {
|
|
698
|
+
return layoutInfo.rect.intersects(rect);
|
|
699
|
+
}
|
|
700
|
+
getInitialLayoutInfo(layoutInfo) {
|
|
701
|
+
layoutInfo.opacity = 0;
|
|
702
|
+
layoutInfo.transform = 'scale3d(0.8, 0.8, 0.8)';
|
|
703
|
+
return layoutInfo;
|
|
704
|
+
}
|
|
705
|
+
getFinalLayoutInfo(layoutInfo) {
|
|
706
|
+
layoutInfo.opacity = 0;
|
|
707
|
+
layoutInfo.transform = 'scale3d(0.8, 0.8, 0.8)';
|
|
708
|
+
return layoutInfo;
|
|
709
|
+
}
|
|
710
|
+
_findClosestLayoutInfo(target, rect) {
|
|
711
|
+
let layoutInfos = this.getVisibleLayoutInfos(rect);
|
|
712
|
+
let best = null;
|
|
713
|
+
let bestDistance = Infinity;
|
|
714
|
+
// Calculates distance as the distance between the center of 2 rects.
|
|
715
|
+
for (let cur of layoutInfos)if (cur.type === 'item') {
|
|
716
|
+
let curRect = cur.rect;
|
|
717
|
+
let targetMidX = (target.x + target.maxX) / 2;
|
|
718
|
+
let targetMidY = (target.y + target.maxY) / 2;
|
|
719
|
+
let curMidX = (curRect.x + curRect.maxX) / 2;
|
|
720
|
+
let curMidY = (curRect.y + curRect.maxY) / 2;
|
|
721
|
+
let dist = Math.pow(targetMidX - curMidX, 2) + Math.pow(targetMidY - curMidY, 2);
|
|
722
|
+
if (dist < bestDistance) {
|
|
723
|
+
best = cur;
|
|
724
|
+
bestDistance = dist;
|
|
725
|
+
}
|
|
1160
726
|
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
table[i][j] = currentMin;
|
|
1164
|
-
solution[i - 1][j - 1] = minX;
|
|
727
|
+
return best;
|
|
1165
728
|
}
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
k = k - 2;
|
|
1170
|
-
let result = [];
|
|
1171
|
-
|
|
1172
|
-
while (k >= 0) {
|
|
1173
|
-
if (n >= 1) {
|
|
1174
|
-
let row = [];
|
|
1175
|
-
|
|
1176
|
-
for (let i = solution[n - 1][k] + 1; i < n + 1; i++) {
|
|
1177
|
-
row.push(seq[i]);
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
result.unshift(row);
|
|
1181
|
-
n = solution[n - 1][k];
|
|
729
|
+
_findClosest(target, rect) {
|
|
730
|
+
let best = this._findClosestLayoutInfo(target, rect);
|
|
731
|
+
return best || null;
|
|
1182
732
|
}
|
|
733
|
+
getKeyBelow(key) {
|
|
734
|
+
// Expected key is the currently focused cell so we need the parent row key
|
|
735
|
+
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
736
|
+
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
737
|
+
let rect = new $5HlfY$Rect(layoutInfo.rect.x, layoutInfo.rect.maxY + 1, layoutInfo.rect.width, this.virtualizer.visibleRect.height);
|
|
738
|
+
let closestRow = this.collection.getItem(this._findClosest(layoutInfo.rect, rect)?.key);
|
|
739
|
+
return closestRow?.childNodes[0]?.key;
|
|
740
|
+
}
|
|
741
|
+
getKeyAbove(key) {
|
|
742
|
+
// Expected key is the currently focused cell so we need the parent row key
|
|
743
|
+
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
744
|
+
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
745
|
+
let rect = new $5HlfY$Rect(layoutInfo.rect.x, 0, layoutInfo.rect.width, layoutInfo.rect.y - 1);
|
|
746
|
+
let closestRow = this.collection.getItem(this._findClosest(layoutInfo.rect, rect)?.key);
|
|
747
|
+
return closestRow?.childNodes[0]?.key;
|
|
748
|
+
}
|
|
749
|
+
getKeyRightOf(key) {
|
|
750
|
+
// Expected key is the currently focused cell so we need the parent row key
|
|
751
|
+
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
752
|
+
key = this.direction === 'rtl' ? this.collection.getKeyBefore(parentRowKey) : this.collection.getKeyAfter(parentRowKey);
|
|
753
|
+
while(key != null){
|
|
754
|
+
let item = this.collection.getItem(key);
|
|
755
|
+
// Don't check if item is disabled because we want to be able to focus disabled items in a grid (double check this)
|
|
756
|
+
if (item.type === 'item') return item.childNodes[0].key;
|
|
757
|
+
key = this.direction === 'rtl' ? this.collection.getKeyBefore(key) : this.collection.getKeyAfter(key);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
getKeyLeftOf(key) {
|
|
761
|
+
// Expected key is the currently focused cell so we need the parent row key
|
|
762
|
+
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
763
|
+
key = this.direction === 'rtl' ? this.collection.getKeyAfter(parentRowKey) : this.collection.getKeyBefore(parentRowKey);
|
|
764
|
+
while(key != null){
|
|
765
|
+
let item = this.collection.getItem(key);
|
|
766
|
+
// Don't check if item is disabled because we want to be able to focus disabled items in a grid (double check this)
|
|
767
|
+
if (item.type === 'item') return item.childNodes[0].key;
|
|
768
|
+
key = this.direction === 'rtl' ? this.collection.getKeyAfter(key) : this.collection.getKeyBefore(key);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
getFirstKey() {
|
|
772
|
+
let firstRow = this.collection.getItem(this.collection.getFirstKey());
|
|
773
|
+
return firstRow.childNodes[0].key;
|
|
774
|
+
}
|
|
775
|
+
getLastKey() {
|
|
776
|
+
let lastRow = this.collection.getItem(this.collection.getLastKey());
|
|
777
|
+
return lastRow.childNodes[0].key;
|
|
778
|
+
}
|
|
779
|
+
// TODO: pretty unwieldy because it needs to bounce back and forth between the parent key and the child key
|
|
780
|
+
// Perhaps have layoutInfo store childKey as well so we don't need to do this? Or maybe make the layoutInfos be the cells instead of the rows?
|
|
781
|
+
getKeyPageAbove(key) {
|
|
782
|
+
// Expected key is the currently focused cell so we need the parent row key
|
|
783
|
+
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
784
|
+
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
785
|
+
if (layoutInfo) {
|
|
786
|
+
let pageY = Math.max(0, layoutInfo.rect.y + layoutInfo.rect.height - this.virtualizer.visibleRect.height);
|
|
787
|
+
// If the node is so large that it spans multiple page heights, return the key of the item immediately above
|
|
788
|
+
// Otherwise keep going up until we exceed a single page height worth of nodes
|
|
789
|
+
let keyAbove = this.collection.getItem(this.getKeyAbove(key))?.parentKey;
|
|
790
|
+
layoutInfo = this.getLayoutInfo(keyAbove);
|
|
791
|
+
if (layoutInfo && layoutInfo.rect.y > pageY) while(layoutInfo && layoutInfo.rect.y > pageY){
|
|
792
|
+
let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
|
|
793
|
+
let keyAbove = this.collection.getItem(this.getKeyAbove(childKey))?.parentKey;
|
|
794
|
+
layoutInfo = this.getLayoutInfo(keyAbove);
|
|
795
|
+
}
|
|
796
|
+
if (layoutInfo) {
|
|
797
|
+
let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
|
|
798
|
+
return childKey;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
return this.getFirstKey();
|
|
802
|
+
}
|
|
803
|
+
// TODO: pretty unwieldy because it needs to bounce back and forth between the parent key and the child key
|
|
804
|
+
// Perhaps have layoutInfo store childKey as well so we don't need to do this?
|
|
805
|
+
getKeyPageBelow(key) {
|
|
806
|
+
// Expected key is the currently focused cell so we need the parent row key
|
|
807
|
+
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
808
|
+
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
809
|
+
if (layoutInfo) {
|
|
810
|
+
let pageY = Math.min(this.virtualizer.contentSize.height, layoutInfo.rect.y - layoutInfo.rect.height + this.virtualizer.visibleRect.height);
|
|
811
|
+
// If the node is so large that it spans multiple page heights, return the key of the item immediately below
|
|
812
|
+
// Otherwise keep going up until we exceed a single page height worth of nodes
|
|
813
|
+
let keyBelow = this.collection.getItem(this.getKeyBelow(key))?.parentKey;
|
|
814
|
+
layoutInfo = this.getLayoutInfo(keyBelow);
|
|
815
|
+
if (layoutInfo && layoutInfo.rect.y < pageY) while(layoutInfo && layoutInfo.rect.y < pageY){
|
|
816
|
+
let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
|
|
817
|
+
let keyBelow = this.collection.getItem(this.getKeyBelow(childKey))?.parentKey;
|
|
818
|
+
layoutInfo = this.getLayoutInfo(keyBelow);
|
|
819
|
+
}
|
|
820
|
+
if (layoutInfo) {
|
|
821
|
+
let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
|
|
822
|
+
return childKey;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return this.getLastKey();
|
|
826
|
+
}
|
|
827
|
+
getKeyForSearch(search, fromKey) {
|
|
828
|
+
if (!this.collator) return null;
|
|
829
|
+
let collection = this.collection;
|
|
830
|
+
let key = fromKey ?? this.getFirstKey();
|
|
831
|
+
let startItem = collection.getItem(key);
|
|
832
|
+
key = startItem.parentKey;
|
|
833
|
+
while(key != null){
|
|
834
|
+
let item = collection.getItem(key);
|
|
835
|
+
if (item.textValue) {
|
|
836
|
+
let substring = item.textValue.slice(0, search.length);
|
|
837
|
+
if (this.collator.compare(substring, search) === 0) return [
|
|
838
|
+
...item.childNodes
|
|
839
|
+
][0].key;
|
|
840
|
+
}
|
|
841
|
+
key = this.collection.getKeyAfter(key);
|
|
842
|
+
}
|
|
843
|
+
return null;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
1183
846
|
|
|
1184
|
-
k--;
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
let row = [];
|
|
1188
|
-
|
|
1189
|
-
for (let i = 0; i < n + 1; i++) {
|
|
1190
|
-
row.push(seq[i]);
|
|
1191
|
-
}
|
|
1192
847
|
|
|
1193
|
-
result.unshift(row);
|
|
1194
|
-
return result;
|
|
1195
|
-
}
|
|
1196
848
|
|
|
1197
|
-
const $
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
minSpace: new Size(6, 6),
|
|
1206
|
-
maxColumns: Infinity,
|
|
1207
|
-
dropSpacing: 50
|
|
1208
|
-
},
|
|
1209
|
-
L: {
|
|
1210
|
-
itemPadding: {
|
|
1211
|
-
'vertical': {
|
|
1212
|
-
'medium': 78,
|
|
1213
|
-
'large': 98
|
|
1214
|
-
},
|
|
1215
|
-
'horizontal': {
|
|
1216
|
-
'medium': 150,
|
|
1217
|
-
'large': 170
|
|
1218
|
-
}
|
|
849
|
+
const $a4ebacd960847d9c$var$DEFAULT_OPTIONS = {
|
|
850
|
+
S: {
|
|
851
|
+
idealRowHeight: 112,
|
|
852
|
+
minItemSize: new $5HlfY$Size(96, 96),
|
|
853
|
+
itemSpacing: new $5HlfY$Size(8, 16),
|
|
854
|
+
itemPadding: 24,
|
|
855
|
+
dropSpacing: 50,
|
|
856
|
+
margin: 8
|
|
1219
857
|
},
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
858
|
+
L: {
|
|
859
|
+
idealRowHeight: 208,
|
|
860
|
+
minItemSize: new $5HlfY$Size(136, 136),
|
|
861
|
+
itemSpacing: new $5HlfY$Size(18, 18),
|
|
862
|
+
itemPadding: {
|
|
863
|
+
'medium': 78,
|
|
864
|
+
'large': 99
|
|
865
|
+
},
|
|
866
|
+
dropSpacing: 100,
|
|
867
|
+
margin: 24
|
|
868
|
+
}
|
|
1230
869
|
};
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
870
|
+
class $a4ebacd960847d9c$export$8e52095834484b61 extends $5fa895c7c356fbff$export$64943d2e59d72a29 {
|
|
871
|
+
constructor(options = {
|
|
872
|
+
}){
|
|
873
|
+
super(options);
|
|
874
|
+
let cardSize = 'L';
|
|
875
|
+
this.idealRowHeight = options.idealRowHeight || $a4ebacd960847d9c$var$DEFAULT_OPTIONS[cardSize].idealRowHeight;
|
|
876
|
+
this.itemSpacing = options.itemSpacing || $a4ebacd960847d9c$var$DEFAULT_OPTIONS[cardSize].itemSpacing;
|
|
877
|
+
this.itemPadding = options.itemPadding != null ? options.itemPadding : $a4ebacd960847d9c$var$DEFAULT_OPTIONS[cardSize].itemPadding[this.scale];
|
|
878
|
+
this.minItemSize = options.minItemSize || $a4ebacd960847d9c$var$DEFAULT_OPTIONS[cardSize].minItemSize;
|
|
879
|
+
this.threshold = options.threshold || 1;
|
|
880
|
+
this.margin = options.margin != null ? options.margin : $a4ebacd960847d9c$var$DEFAULT_OPTIONS[cardSize].margin;
|
|
1235
881
|
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
this.minItemSize = void 0;
|
|
1239
|
-
this.maxItemSize = void 0;
|
|
1240
|
-
this.minSpace = void 0;
|
|
1241
|
-
this.maxColumns = void 0;
|
|
1242
|
-
this.itemPadding = void 0;
|
|
1243
|
-
this.cardOrientation = void 0;
|
|
1244
|
-
this.itemSize = void 0;
|
|
1245
|
-
this.numColumns = void 0;
|
|
1246
|
-
this.numRows = void 0;
|
|
1247
|
-
this.horizontalSpacing = void 0;
|
|
1248
|
-
let cardSize = 'L';
|
|
1249
|
-
this.cardOrientation = options.cardOrientation || 'vertical';
|
|
1250
|
-
this.minItemSize = options.minItemSize || $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].minItemSize[this.cardOrientation];
|
|
1251
|
-
this.maxItemSize = options.maxItemSize || $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].maxItemSize;
|
|
1252
|
-
this.margin = options.margin != null ? options.margin : $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].margin;
|
|
1253
|
-
this.minSpace = options.minSpace || $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].minSpace;
|
|
1254
|
-
this.maxColumns = options.maxColumns || $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].maxColumns;
|
|
1255
|
-
this.itemPadding = options.itemPadding != null ? options.itemPadding : $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].itemPadding[this.cardOrientation][this.scale];
|
|
1256
|
-
this.itemSize = null;
|
|
1257
|
-
this.numColumns = 0;
|
|
1258
|
-
this.numRows = 0;
|
|
1259
|
-
this.horizontalSpacing = 0;
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
get layoutType() {
|
|
1263
|
-
return 'grid';
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
getIndexAtPoint(x, y, allowInsertingAtEnd) {
|
|
1267
|
-
if (allowInsertingAtEnd === void 0) {
|
|
1268
|
-
allowInsertingAtEnd = false;
|
|
882
|
+
get layoutType() {
|
|
883
|
+
return 'gallery';
|
|
1269
884
|
}
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
885
|
+
/**
|
|
886
|
+
* Takes a row of widths and if there are any widths smaller than the min-width, leech width starting from
|
|
887
|
+
* the widest in the row until it can't give anymore, then move to the second widest and so forth.
|
|
888
|
+
* Do this until all assets meet the min-width.
|
|
889
|
+
* */ _distributeWidths(widths) {
|
|
890
|
+
// create a copy of the widths array and sort it largest to smallest
|
|
891
|
+
let sortedWidths = widths.concat().sort((a, b)=>a[1] > b[1] ? -1 : 1
|
|
892
|
+
);
|
|
893
|
+
for (let width of widths)// for each width, if it's smaller than the min width
|
|
894
|
+
if (width[1] < this.minItemSize.width) {
|
|
895
|
+
// then figure out how much smaller
|
|
896
|
+
let delta = this.minItemSize.width - width[1];
|
|
897
|
+
for (let item of sortedWidths)// go from the largest width in the row to the smallest
|
|
898
|
+
// if the width is greater than the min width
|
|
899
|
+
if (widths[item[0]][1] > this.minItemSize.width) {
|
|
900
|
+
// subtract the delta from the width, if it's still greater than the min width
|
|
901
|
+
// then we have finished, subtract the delta permanently from that width
|
|
902
|
+
if (widths[item[0]][1] - delta > this.minItemSize.width) {
|
|
903
|
+
widths[item[0]][1] -= delta;
|
|
904
|
+
delta = 0;
|
|
905
|
+
break;
|
|
906
|
+
} else {
|
|
907
|
+
// otherwise, we take as much as we can from the current width and then move on to
|
|
908
|
+
// the next largest and take some width from it
|
|
909
|
+
let maxChange = widths[item[0]][1] - this.minItemSize.width;
|
|
910
|
+
delta -= maxChange;
|
|
911
|
+
widths[item[0]][1] -= maxChange;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
if (delta > 0) return false;
|
|
915
|
+
// force the width to be the min width that we just rebalanced for
|
|
916
|
+
width[1] = this.minItemSize.width;
|
|
1288
917
|
}
|
|
1289
|
-
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
918
|
+
return true;
|
|
919
|
+
}
|
|
920
|
+
buildCollection() {
|
|
921
|
+
let visibleWidth = this.virtualizer.visibleRect.width;
|
|
922
|
+
let visibleHeight = this.virtualizer.visibleRect.height;
|
|
923
|
+
let y = this.margin;
|
|
924
|
+
let availableWidth = visibleWidth - this.margin * 2;
|
|
925
|
+
// If avaliable width is not greater than 0, skip node layout calculations
|
|
926
|
+
if (availableWidth > 0) {
|
|
927
|
+
// Compute aspect ratios for all of the items, and the total width if all items were on in a single row.
|
|
928
|
+
let ratios = [];
|
|
929
|
+
let totalWidth = 0;
|
|
930
|
+
let minRatio = this.minItemSize.width / this.minItemSize.height;
|
|
931
|
+
let maxRatio = availableWidth / this.minItemSize.height;
|
|
932
|
+
for (let node of this.collection){
|
|
933
|
+
let ratio = node.props.width / node.props.height;
|
|
934
|
+
if (ratio < minRatio) ratio = minRatio;
|
|
935
|
+
else if (ratio > maxRatio && ratio !== minRatio) ratio = maxRatio;
|
|
936
|
+
let itemWidth = ratio * this.minItemSize.height;
|
|
937
|
+
ratios.push(ratio);
|
|
938
|
+
totalWidth += itemWidth;
|
|
939
|
+
}
|
|
940
|
+
totalWidth += this.itemSpacing.width * (this.collection.size - 1);
|
|
941
|
+
// Determine how many rows we'll need, and partition the items into rows
|
|
942
|
+
// using the aspect ratios as weights.
|
|
943
|
+
let rows = Math.max(1, Math.ceil(totalWidth / availableWidth));
|
|
944
|
+
// if the available width can't hold two items, then every item will get its own row
|
|
945
|
+
// this leads to a faster run through linear partition and more dependable output for small row widths
|
|
946
|
+
if (availableWidth <= this.minItemSize.width * 2 + this.itemPadding * 2) rows = this.collection.size;
|
|
947
|
+
let weightedRatios = ratios.map((ratio)=>ratio < this.threshold ? ratio + 0.5 * (1 / ratio) : ratio
|
|
948
|
+
);
|
|
949
|
+
let partition = $a4ebacd960847d9c$var$linearPartition(weightedRatios, rows);
|
|
950
|
+
let index = 0;
|
|
951
|
+
for (let row of partition){
|
|
952
|
+
// Compute the total weight for this row
|
|
953
|
+
let totalWeight = 0;
|
|
954
|
+
for(let j = index; j < index + row.length; j++)totalWeight += ratios[j];
|
|
955
|
+
// Determine the row height based on the total available width and weight of this row.
|
|
956
|
+
let bestRowHeight = (availableWidth - (row.length - 1) * this.itemSpacing.width) / totalWeight;
|
|
957
|
+
// if this is the last row and the row height is >2x the ideal row height, then cap to the ideal height
|
|
958
|
+
// probably doing this because if the last row has one extremely tall image, then the row becomes huge
|
|
959
|
+
// though that can happen anywhere if a row has lots of tall images... so i'm not sure why this one matters
|
|
960
|
+
if (row === partition[partition.length - 1] && bestRowHeight > this.idealRowHeight * 2) bestRowHeight = this.idealRowHeight;
|
|
961
|
+
let itemHeight = Math.round(bestRowHeight) + this.itemPadding;
|
|
962
|
+
let x = this.margin;
|
|
963
|
+
// if any items are going to end up too small, add a bit of width to them and subtract it from wider objects
|
|
964
|
+
let widths = [];
|
|
965
|
+
for(let j1 = index; j1 < index + row.length; j1++){
|
|
966
|
+
let width = Math.round(bestRowHeight * ratios[j1]);
|
|
967
|
+
widths.push([
|
|
968
|
+
j1 - index,
|
|
969
|
+
width
|
|
970
|
+
]);
|
|
971
|
+
}
|
|
972
|
+
this._distributeWidths(widths);
|
|
973
|
+
// Create items for this row.
|
|
974
|
+
for(let j2 = index; j2 < index + row.length; j2++){
|
|
975
|
+
let node = this.collection.rows[j2];
|
|
976
|
+
let itemWidth = Math.max(widths[j2 - index][1], this.minItemSize.width);
|
|
977
|
+
let rect = new $5HlfY$Rect(x, y, itemWidth, itemHeight);
|
|
978
|
+
let layoutInfo = new $5HlfY$LayoutInfo(node.type, node.key, rect);
|
|
979
|
+
layoutInfo.allowOverflow = true;
|
|
980
|
+
this.layoutInfos.set(node.key, layoutInfo);
|
|
981
|
+
x += itemWidth + this.itemSpacing.width;
|
|
982
|
+
}
|
|
983
|
+
y += itemHeight + this.itemSpacing.height;
|
|
984
|
+
index += row.length;
|
|
985
|
+
}
|
|
986
|
+
if (this.isLoading) {
|
|
987
|
+
let loaderY = y;
|
|
988
|
+
let loaderHeight = 60;
|
|
989
|
+
// If there aren't any items, make loader take all avaliable room and remove margin from y calculation
|
|
990
|
+
// so it doesn't scroll
|
|
991
|
+
if (this.collection.size === 0) {
|
|
992
|
+
loaderY = 0;
|
|
993
|
+
loaderHeight = visibleHeight || 60;
|
|
994
|
+
}
|
|
995
|
+
let rect = new $5HlfY$Rect(0, loaderY, visibleWidth, loaderHeight);
|
|
996
|
+
let loader = new $5HlfY$LayoutInfo('loader', 'loader', rect);
|
|
997
|
+
this.layoutInfos.set('loader', loader);
|
|
998
|
+
y = loader.rect.maxY;
|
|
999
|
+
}
|
|
1000
|
+
if (this.collection.size === 0 && !this.isLoading) {
|
|
1001
|
+
let rect = new $5HlfY$Rect(0, 0, visibleWidth, visibleHeight);
|
|
1002
|
+
let placeholder = new $5HlfY$LayoutInfo('placeholder', 'placeholder', rect);
|
|
1003
|
+
this.layoutInfos.set('placeholder', placeholder);
|
|
1004
|
+
y = placeholder.rect.maxY;
|
|
1005
|
+
}
|
|
1301
1006
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
let loader = this.layoutInfos.get('loader');
|
|
1306
|
-
|
|
1307
|
-
if (loader && this.isVisible(loader, rect)) {
|
|
1308
|
-
res.push(loader);
|
|
1309
|
-
}
|
|
1007
|
+
this.contentSize = new $5HlfY$Size(visibleWidth, y);
|
|
1310
1008
|
}
|
|
1009
|
+
}
|
|
1010
|
+
// https://www8.cs.umu.se/kurser/TDBA77/VT06/algorithms/BOOK/BOOK2/NODE45.HTM
|
|
1011
|
+
function $a4ebacd960847d9c$var$linearPartition(seq, k) {
|
|
1012
|
+
let n = seq.length;
|
|
1013
|
+
if (k <= 0) return [];
|
|
1014
|
+
if (k >= n) return seq.map((x)=>[
|
|
1015
|
+
x
|
|
1016
|
+
]
|
|
1017
|
+
);
|
|
1018
|
+
if (n === 1) return [
|
|
1019
|
+
seq
|
|
1020
|
+
];
|
|
1021
|
+
let table = Array(n).fill(0).map(()=>Array(k).fill(0)
|
|
1022
|
+
);
|
|
1023
|
+
let solution = Array(n - 1).fill(0).map(()=>Array(k - 1).fill(0)
|
|
1024
|
+
);
|
|
1025
|
+
for(let i = 0; i < n; i++)table[i][0] = seq[i] + (i > 0 ? table[i - 1][0] : 0);
|
|
1026
|
+
for(let i1 = 0; i1 < k; i1++)table[0][i1] = seq[0];
|
|
1027
|
+
for(let i2 = 1; i2 < n; i2++)for(let j = 1; j < k; j++){
|
|
1028
|
+
let currentMin = 0;
|
|
1029
|
+
let minX = Infinity;
|
|
1030
|
+
for(let x = 0; x < i2; x++){
|
|
1031
|
+
let c1 = table[x][j - 1];
|
|
1032
|
+
let c2 = table[i2][0] - table[x][0];
|
|
1033
|
+
let cost = Math.max(c1, c2);
|
|
1034
|
+
if (!x || cost < currentMin) {
|
|
1035
|
+
currentMin = cost;
|
|
1036
|
+
minX = x;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
table[i2][j] = currentMin;
|
|
1040
|
+
solution[i2 - 1][j - 1] = minX;
|
|
1041
|
+
}
|
|
1042
|
+
n = n - 1;
|
|
1043
|
+
k = k - 2;
|
|
1044
|
+
let result = [];
|
|
1045
|
+
while(k >= 0){
|
|
1046
|
+
if (n >= 1) {
|
|
1047
|
+
let row = [];
|
|
1048
|
+
for(let i = solution[n - 1][k] + 1; i < n + 1; i++)row.push(seq[i]);
|
|
1049
|
+
result.unshift(row);
|
|
1050
|
+
n = solution[n - 1][k];
|
|
1051
|
+
}
|
|
1052
|
+
k--;
|
|
1053
|
+
}
|
|
1054
|
+
let row = [];
|
|
1055
|
+
for(let i3 = 0; i3 < n + 1; i3++)row.push(seq[i3]);
|
|
1056
|
+
result.unshift(row);
|
|
1057
|
+
return result;
|
|
1058
|
+
}
|
|
1311
1059
|
|
|
1312
|
-
return res;
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
buildCollection() {
|
|
1316
|
-
let visibleWidth = this.virtualizer.visibleRect.width;
|
|
1317
|
-
let visibleHeight = this.virtualizer.visibleRect.height;
|
|
1318
|
-
let horizontalItemPadding = this.cardOrientation === 'horizontal' ? this.itemPadding : 0;
|
|
1319
|
-
let verticalItemPadding = this.cardOrientation === 'vertical' ? this.itemPadding : 0;
|
|
1320
|
-
let minCardWidth = this.minItemSize.width + horizontalItemPadding; // Compute the number of rows and columns needed to display the content
|
|
1321
|
-
|
|
1322
|
-
let availableWidth = visibleWidth - this.margin * 2;
|
|
1323
|
-
let columns = Math.floor((availableWidth + this.minSpace.width) / (minCardWidth + this.minSpace.width));
|
|
1324
|
-
this.numColumns = Math.max(1, Math.min(this.maxColumns, columns));
|
|
1325
|
-
this.numRows = Math.ceil(this.collection.size / this.numColumns); // Compute the available width (minus the space between items)
|
|
1326
|
-
|
|
1327
|
-
let width = availableWidth - this.minSpace.width * Math.max(0, this.numColumns - 1); // Compute the item width based on the space available
|
|
1328
1060
|
|
|
1329
|
-
|
|
1330
|
-
itemWidth = Math.max(minCardWidth, Math.min(this.maxItemSize.width, itemWidth)); // Compute the item height, which is proportional to the item width
|
|
1061
|
+
var $518ec229733533c6$exports = {};
|
|
1331
1062
|
|
|
1332
|
-
|
|
1333
|
-
let itemHeight = Math.floor(this.minItemSize.height + this.minItemSize.height * t);
|
|
1334
|
-
itemHeight = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, itemHeight)) + verticalItemPadding;
|
|
1335
|
-
this.itemSize = new Size(itemWidth, itemHeight); // Compute the horizontal spacing and content height
|
|
1063
|
+
$parcel$export($518ec229733533c6$exports, "GridLayout", () => $518ec229733533c6$export$7d2b12578154a735);
|
|
1336
1064
|
|
|
1337
|
-
this.horizontalSpacing = this.numColumns < 2 ? 0 : Math.floor((availableWidth - this.numColumns * this.itemSize.width) / (this.numColumns - 1));
|
|
1338
|
-
let y = this.margin;
|
|
1339
|
-
let index = 0;
|
|
1340
1065
|
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1066
|
+
const $518ec229733533c6$var$DEFAULT_OPTIONS = {
|
|
1067
|
+
S: {
|
|
1068
|
+
itemPadding: 20,
|
|
1069
|
+
minItemSize: {
|
|
1070
|
+
'vertical': new $5HlfY$Size(96, 96)
|
|
1071
|
+
},
|
|
1072
|
+
maxItemSize: new $5HlfY$Size(Infinity, Infinity),
|
|
1073
|
+
margin: 8,
|
|
1074
|
+
minSpace: new $5HlfY$Size(6, 6),
|
|
1075
|
+
maxColumns: Infinity,
|
|
1076
|
+
dropSpacing: 50
|
|
1077
|
+
},
|
|
1078
|
+
L: {
|
|
1079
|
+
itemPadding: {
|
|
1080
|
+
'vertical': {
|
|
1081
|
+
'medium': 78,
|
|
1082
|
+
'large': 98
|
|
1083
|
+
},
|
|
1084
|
+
'horizontal': {
|
|
1085
|
+
'medium': 150,
|
|
1086
|
+
'large': 170
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
minItemSize: {
|
|
1090
|
+
'vertical': new $5HlfY$Size(208, 208),
|
|
1091
|
+
'horizontal': new $5HlfY$Size(102, 102)
|
|
1092
|
+
},
|
|
1093
|
+
maxItemSize: new $5HlfY$Size(Infinity, Infinity),
|
|
1094
|
+
margin: 24,
|
|
1095
|
+
minSpace: new $5HlfY$Size(18, 18),
|
|
1096
|
+
maxColumns: Infinity,
|
|
1097
|
+
dropSpacing: 100
|
|
1345
1098
|
}
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1099
|
+
};
|
|
1100
|
+
class $518ec229733533c6$export$7d2b12578154a735 extends $5fa895c7c356fbff$export$64943d2e59d72a29 {
|
|
1101
|
+
constructor(options = {
|
|
1102
|
+
}){
|
|
1103
|
+
super(options);
|
|
1104
|
+
let cardSize = 'L';
|
|
1105
|
+
this.cardOrientation = options.cardOrientation || 'vertical';
|
|
1106
|
+
this.minItemSize = options.minItemSize || $518ec229733533c6$var$DEFAULT_OPTIONS[cardSize].minItemSize[this.cardOrientation];
|
|
1107
|
+
this.maxItemSize = options.maxItemSize || $518ec229733533c6$var$DEFAULT_OPTIONS[cardSize].maxItemSize;
|
|
1108
|
+
this.margin = options.margin != null ? options.margin : $518ec229733533c6$var$DEFAULT_OPTIONS[cardSize].margin;
|
|
1109
|
+
this.minSpace = options.minSpace || $518ec229733533c6$var$DEFAULT_OPTIONS[cardSize].minSpace;
|
|
1110
|
+
this.maxColumns = options.maxColumns || $518ec229733533c6$var$DEFAULT_OPTIONS[cardSize].maxColumns;
|
|
1111
|
+
this.itemPadding = options.itemPadding != null ? options.itemPadding : $518ec229733533c6$var$DEFAULT_OPTIONS[cardSize].itemPadding[this.cardOrientation][this.scale];
|
|
1112
|
+
this.itemSize = null;
|
|
1113
|
+
this.numColumns = 0;
|
|
1114
|
+
this.numRows = 0;
|
|
1115
|
+
this.horizontalSpacing = 0;
|
|
1361
1116
|
}
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
let rect = new Rect(0, 0, visibleWidth, visibleHeight);
|
|
1365
|
-
let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);
|
|
1366
|
-
this.layoutInfos.set('placeholder', placeholder);
|
|
1367
|
-
y = placeholder.rect.maxY;
|
|
1117
|
+
get layoutType() {
|
|
1118
|
+
return 'grid';
|
|
1368
1119
|
}
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
buildChild(node, y, index) {
|
|
1374
|
-
let row = Math.floor(index / this.numColumns);
|
|
1375
|
-
let column = index % this.numColumns;
|
|
1376
|
-
let x = this.margin + column * (this.itemSize.width + this.horizontalSpacing);
|
|
1377
|
-
y = this.margin + row * (this.itemSize.height + this.minSpace.height);
|
|
1378
|
-
let rect = new Rect(x, y, this.itemSize.width, this.itemSize.height); // TODO: Perhaps have it so that the child key for each row is stored with the layoutInfo?
|
|
1379
|
-
|
|
1380
|
-
let layoutInfo = new LayoutInfo(node.type, node.key, rect);
|
|
1381
|
-
layoutInfo.allowOverflow = true;
|
|
1382
|
-
this.layoutInfos.set(node.key, layoutInfo);
|
|
1383
|
-
return layoutInfo;
|
|
1384
|
-
} // Since the collection doesn't represent the visual layout, need to calculate what row and column the current key is in,
|
|
1385
|
-
// then return the key that occupies the row + column below. This can be done by figuring out how many cards exist per column then dividing the
|
|
1386
|
-
// collection contents by that number (which will give us the row distribution)
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
getKeyBelow(key) {
|
|
1390
|
-
var _this$collection$rows;
|
|
1391
|
-
|
|
1392
|
-
// Expected key is the currently focused cell so we need the parent row key
|
|
1393
|
-
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
1394
|
-
let indexRowBelow;
|
|
1395
|
-
let index = this.collection.rows.findIndex(card => card.key === parentRowKey);
|
|
1396
|
-
|
|
1397
|
-
if (index !== -1) {
|
|
1398
|
-
indexRowBelow = index + this.numColumns;
|
|
1399
|
-
} else {
|
|
1400
|
-
return null;
|
|
1120
|
+
getIndexAtPoint(x, y, allowInsertingAtEnd = false) {
|
|
1121
|
+
let itemHeight = this.itemSize.height + this.minSpace.height;
|
|
1122
|
+
let itemWidth = this.itemSize.width + this.horizontalSpacing;
|
|
1123
|
+
return Math.max(0, Math.min(this.collection.size - (allowInsertingAtEnd ? 0 : 1), Math.floor(y / itemHeight) * this.numColumns + Math.floor((x - this.horizontalSpacing) / itemWidth)));
|
|
1401
1124
|
}
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1125
|
+
getVisibleLayoutInfos(rect) {
|
|
1126
|
+
let res = [];
|
|
1127
|
+
let numItems = this.collection.size;
|
|
1128
|
+
if (numItems <= 0 || !this.itemSize) // If there aren't any items in the collection, we are in a loader/placeholder state. Return those layoutInfos as
|
|
1129
|
+
// the currently visible items
|
|
1130
|
+
{
|
|
1131
|
+
if (this.layoutInfos.size > 0) {
|
|
1132
|
+
for (let layoutInfo of this.layoutInfos.values())if (this.isVisible(layoutInfo, rect)) res.push(layoutInfo);
|
|
1133
|
+
}
|
|
1134
|
+
} else {
|
|
1135
|
+
// The approach from v2 uses indexes where other v3 layouts iterate through every node/root node. This feels more efficient
|
|
1136
|
+
let firstVisibleItem = this.getIndexAtPoint(rect.x, rect.y);
|
|
1137
|
+
let lastVisibleItem = this.getIndexAtPoint(rect.maxX, rect.maxY);
|
|
1138
|
+
for(let index = firstVisibleItem; index <= lastVisibleItem; index++){
|
|
1139
|
+
let keyFromIndex = this.collection.rows[index].key;
|
|
1140
|
+
let layoutInfo = this.layoutInfos.get(keyFromIndex);
|
|
1141
|
+
if (layoutInfo && this.isVisible(layoutInfo, rect)) res.push(layoutInfo);
|
|
1142
|
+
}
|
|
1143
|
+
// Check if loader is in view and add to res if so
|
|
1144
|
+
let loader = this.layoutInfos.get('loader');
|
|
1145
|
+
if (loader && this.isVisible(loader, rect)) res.push(loader);
|
|
1146
|
+
}
|
|
1147
|
+
return res;
|
|
1418
1148
|
}
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1149
|
+
buildCollection() {
|
|
1150
|
+
let visibleWidth = this.virtualizer.visibleRect.width;
|
|
1151
|
+
let visibleHeight = this.virtualizer.visibleRect.height;
|
|
1152
|
+
let horizontalItemPadding = this.cardOrientation === 'horizontal' ? this.itemPadding : 0;
|
|
1153
|
+
let verticalItemPadding = this.cardOrientation === 'vertical' ? this.itemPadding : 0;
|
|
1154
|
+
let minCardWidth = this.minItemSize.width + horizontalItemPadding;
|
|
1155
|
+
// Compute the number of rows and columns needed to display the content
|
|
1156
|
+
let availableWidth = visibleWidth - this.margin * 2;
|
|
1157
|
+
let columns = Math.floor((availableWidth + this.minSpace.width) / (minCardWidth + this.minSpace.width));
|
|
1158
|
+
this.numColumns = Math.max(1, Math.min(this.maxColumns, columns));
|
|
1159
|
+
this.numRows = Math.ceil(this.collection.size / this.numColumns);
|
|
1160
|
+
// Compute the available width (minus the space between items)
|
|
1161
|
+
let width = availableWidth - this.minSpace.width * Math.max(0, this.numColumns - 1);
|
|
1162
|
+
// Compute the item width based on the space available
|
|
1163
|
+
let itemWidth = Math.floor(width / this.numColumns);
|
|
1164
|
+
itemWidth = Math.max(minCardWidth, Math.min(this.maxItemSize.width, itemWidth));
|
|
1165
|
+
// Compute the item height, which is proportional to the item width
|
|
1166
|
+
let t = (itemWidth - minCardWidth) / minCardWidth;
|
|
1167
|
+
let itemHeight = Math.floor(this.minItemSize.height + this.minItemSize.height * t);
|
|
1168
|
+
itemHeight = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, itemHeight)) + verticalItemPadding;
|
|
1169
|
+
this.itemSize = new $5HlfY$Size(itemWidth, itemHeight);
|
|
1170
|
+
// Compute the horizontal spacing and content height
|
|
1171
|
+
this.horizontalSpacing = this.numColumns < 2 ? 0 : Math.floor((availableWidth - this.numColumns * this.itemSize.width) / (this.numColumns - 1));
|
|
1172
|
+
let y = this.margin;
|
|
1173
|
+
let index = 0;
|
|
1174
|
+
for (let node of this.collection){
|
|
1175
|
+
let layoutInfo = this.buildChild(node, y, index);
|
|
1176
|
+
y = layoutInfo.rect.maxY;
|
|
1177
|
+
index++;
|
|
1178
|
+
}
|
|
1179
|
+
if (this.isLoading) {
|
|
1180
|
+
let loaderY = y;
|
|
1181
|
+
let loaderHeight = 60;
|
|
1182
|
+
// If there aren't any items, make loader take all avaliable room and remove margin from y calculation
|
|
1183
|
+
// so it doesn't scroll
|
|
1184
|
+
if (this.collection.size === 0) {
|
|
1185
|
+
loaderY = 0;
|
|
1186
|
+
loaderHeight = visibleHeight || 60;
|
|
1187
|
+
}
|
|
1188
|
+
let rect = new $5HlfY$Rect(0, loaderY, visibleWidth, loaderHeight);
|
|
1189
|
+
let loader = new $5HlfY$LayoutInfo('loader', 'loader', rect);
|
|
1190
|
+
this.layoutInfos.set('loader', loader);
|
|
1191
|
+
y = loader.rect.maxY;
|
|
1192
|
+
}
|
|
1193
|
+
if (this.collection.size === 0 && !this.isLoading) {
|
|
1194
|
+
let rect = new $5HlfY$Rect(0, 0, visibleWidth, visibleHeight);
|
|
1195
|
+
let placeholder = new $5HlfY$LayoutInfo('placeholder', 'placeholder', rect);
|
|
1196
|
+
this.layoutInfos.set('placeholder', placeholder);
|
|
1197
|
+
y = placeholder.rect.maxY;
|
|
1198
|
+
}
|
|
1199
|
+
this.contentSize = new $5HlfY$Size(visibleWidth, y);
|
|
1429
1200
|
}
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
this.horizontalSpacing = void 0;
|
|
1442
|
-
this.minItemSize = options.minItemSize || new Size(240, 136);
|
|
1443
|
-
this.maxItemSize = options.maxItemSize || new Size(Infinity, Infinity);
|
|
1444
|
-
this.margin = options.margin != null ? options.margin : 24;
|
|
1445
|
-
this.minSpace = options.minSpace || new Size(18, 18);
|
|
1446
|
-
this.maxColumns = options.maxColumns || Infinity; // TODO: not entirely sure what this is for since the layout will automatically shift itself to the correct vertical space for the card
|
|
1447
|
-
|
|
1448
|
-
this.itemPadding = options.itemPadding != null ? options.itemPadding : 56;
|
|
1449
|
-
this.itemWidth = 0;
|
|
1450
|
-
this.numColumns = 0;
|
|
1451
|
-
this.lastCollection = null;
|
|
1452
|
-
this.collator = options.collator;
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
get layoutType() {
|
|
1456
|
-
return 'waterfall';
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
buildCollection(invalidationContext) {
|
|
1460
|
-
// Compute the number of columns needed to display the content
|
|
1461
|
-
let visibleWidth = this.virtualizer.visibleRect.width;
|
|
1462
|
-
let availableWidth = visibleWidth - this.margin * 2;
|
|
1463
|
-
let columns = Math.floor((availableWidth + this.minSpace.width) / (this.minItemSize.width + this.minSpace.width));
|
|
1464
|
-
this.numColumns = Math.max(1, Math.min(this.maxColumns, columns)); // Compute the available width (minus the space between items)
|
|
1465
|
-
|
|
1466
|
-
let width = availableWidth - this.minSpace.width * (this.numColumns - 1); // Compute the item width based on the space available
|
|
1467
|
-
|
|
1468
|
-
let itemWidth = Math.round(width / this.numColumns);
|
|
1469
|
-
itemWidth = Math.max(this.minItemSize.width, Math.min(this.maxItemSize.width, itemWidth));
|
|
1470
|
-
this.itemWidth = itemWidth; // Compute the horizontal spacing
|
|
1471
|
-
// if only one column, we cannot divide by zero, so set it to 1
|
|
1472
|
-
|
|
1473
|
-
let horizontalSpacing = Math.round((availableWidth - this.numColumns * itemWidth) / Math.max(1, this.numColumns - 1));
|
|
1474
|
-
this.horizontalSpacing = horizontalSpacing; // Setup an array of column heights
|
|
1475
|
-
|
|
1476
|
-
let columnHeights = Array(this.numColumns).fill(this.margin);
|
|
1477
|
-
|
|
1478
|
-
for (let node of this.collection) {
|
|
1479
|
-
let key = node.key; // Compute the height of the item. Use the existing height if available,
|
|
1480
|
-
// otherwise call the delegate to estimate the size.
|
|
1481
|
-
|
|
1482
|
-
let oldLayoutInfo = this.layoutInfos.get(key);
|
|
1483
|
-
let height;
|
|
1484
|
-
let estimatedSize = true;
|
|
1485
|
-
|
|
1486
|
-
if (oldLayoutInfo) {
|
|
1487
|
-
height = oldLayoutInfo.rect.height;
|
|
1488
|
-
estimatedSize = invalidationContext.sizeChanged || oldLayoutInfo.estimatedSize;
|
|
1489
|
-
} else if (node.props.width && node.props.height) {
|
|
1490
|
-
let nodeWidth = node.props.width;
|
|
1491
|
-
let nodeHeight = node.props.height;
|
|
1492
|
-
let scaledHeight = Math.round(nodeWidth * (itemWidth / nodeHeight));
|
|
1493
|
-
height = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, scaledHeight)) + this.itemPadding;
|
|
1494
|
-
} else {
|
|
1495
|
-
height = itemWidth;
|
|
1496
|
-
} // Figure out which column to place the item in, and compute its position.
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
let column = this.getNextColumnIndex(columnHeights);
|
|
1500
|
-
let x = this.margin + column * (itemWidth + horizontalSpacing);
|
|
1501
|
-
let y = columnHeights[column];
|
|
1502
|
-
let rect = new Rect(x, y, itemWidth, height);
|
|
1503
|
-
let layoutInfo = new LayoutInfo(node.type, key, rect);
|
|
1504
|
-
layoutInfo.estimatedSize = estimatedSize;
|
|
1505
|
-
layoutInfo.allowOverflow = true;
|
|
1506
|
-
this.layoutInfos.set(key, layoutInfo); // TODO: From v2 figure out this bit, when does this get called and what to replace this.collectionView._transaction with?
|
|
1507
|
-
// Removing it from v2 doesn't seem to do anything?
|
|
1508
|
-
// if (layoutInfo.estimatedSize && !invalidationContext.contentChanged && !this.collectionView._transaction) {
|
|
1509
|
-
// this.updateItemSize(new IndexPath(section, i));
|
|
1510
|
-
// }
|
|
1511
|
-
|
|
1512
|
-
columnHeights[column] += layoutInfo.rect.height + this.minSpace.height;
|
|
1201
|
+
buildChild(node, y, index) {
|
|
1202
|
+
let row = Math.floor(index / this.numColumns);
|
|
1203
|
+
let column = index % this.numColumns;
|
|
1204
|
+
let x = this.margin + column * (this.itemSize.width + this.horizontalSpacing);
|
|
1205
|
+
y = this.margin + row * (this.itemSize.height + this.minSpace.height);
|
|
1206
|
+
let rect = new $5HlfY$Rect(x, y, this.itemSize.width, this.itemSize.height);
|
|
1207
|
+
// TODO: Perhaps have it so that the child key for each row is stored with the layoutInfo?
|
|
1208
|
+
let layoutInfo = new $5HlfY$LayoutInfo(node.type, node.key, rect);
|
|
1209
|
+
layoutInfo.allowOverflow = true;
|
|
1210
|
+
this.layoutInfos.set(node.key, layoutInfo);
|
|
1211
|
+
return layoutInfo;
|
|
1513
1212
|
}
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
loaderHeight = this.virtualizer.visibleRect.height || 60;
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
let rect = new Rect(0, loaderY, this.virtualizer.visibleRect.width, loaderHeight);
|
|
1530
|
-
let loader = new LayoutInfo('loader', 'loader', rect);
|
|
1531
|
-
this.layoutInfos.set('loader', loader);
|
|
1532
|
-
y = loader.rect.maxY;
|
|
1213
|
+
// Since the collection doesn't represent the visual layout, need to calculate what row and column the current key is in,
|
|
1214
|
+
// then return the key that occupies the row + column below. This can be done by figuring out how many cards exist per column then dividing the
|
|
1215
|
+
// collection contents by that number (which will give us the row distribution)
|
|
1216
|
+
getKeyBelow(key) {
|
|
1217
|
+
// Expected key is the currently focused cell so we need the parent row key
|
|
1218
|
+
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
1219
|
+
let indexRowBelow;
|
|
1220
|
+
let index = this.collection.rows.findIndex((card)=>card.key === parentRowKey
|
|
1221
|
+
);
|
|
1222
|
+
if (index !== -1) indexRowBelow = index + this.numColumns;
|
|
1223
|
+
else return null;
|
|
1224
|
+
return this.collection.rows[indexRowBelow]?.childNodes[0].key || null;
|
|
1533
1225
|
}
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1226
|
+
getKeyAbove(key) {
|
|
1227
|
+
// Expected key is the currently focused cell so we need the parent row key
|
|
1228
|
+
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
1229
|
+
let indexRowAbove;
|
|
1230
|
+
let index = this.collection.rows.findIndex((card)=>card.key === parentRowKey
|
|
1231
|
+
);
|
|
1232
|
+
if (index !== -1) indexRowAbove = index - this.numColumns;
|
|
1233
|
+
else return null;
|
|
1234
|
+
return this.collection.rows[indexRowAbove]?.childNodes[0].key || null;
|
|
1540
1235
|
}
|
|
1236
|
+
}
|
|
1541
1237
|
|
|
1542
|
-
this.contentSize = new Size(this.virtualizer.visibleRect.width, y);
|
|
1543
|
-
}
|
|
1544
1238
|
|
|
1545
|
-
|
|
1546
|
-
let layoutInfo = this.layoutInfos.get(key);
|
|
1239
|
+
var $eb50f2ca3a53d913$exports = {};
|
|
1547
1240
|
|
|
1548
|
-
|
|
1549
|
-
return false;
|
|
1550
|
-
}
|
|
1241
|
+
$parcel$export($eb50f2ca3a53d913$exports, "WaterfallLayout", () => $eb50f2ca3a53d913$export$e9f7cda058ba8df8);
|
|
1551
1242
|
|
|
1552
|
-
if (size.height !== layoutInfo.rect.height) {
|
|
1553
|
-
// TODO: also not sure about copying layout info vs mutating it. Listlayout does the below
|
|
1554
|
-
// but I feel that is because it actually maintained a layoutNode map cache which this doesn't have
|
|
1555
|
-
let newLayoutInfo = layoutInfo.copy();
|
|
1556
|
-
newLayoutInfo.rect.height = size.height;
|
|
1557
|
-
this.layoutInfos.set(key, newLayoutInfo); // TODO: v2 had layoutInfo.estimatedSize = view.estimatedSize || false; but we can't do the same here?
|
|
1558
1243
|
|
|
1559
|
-
|
|
1560
|
-
|
|
1244
|
+
class $eb50f2ca3a53d913$export$e9f7cda058ba8df8 extends $5fa895c7c356fbff$export$64943d2e59d72a29 {
|
|
1245
|
+
constructor(options = {
|
|
1246
|
+
}){
|
|
1247
|
+
// TODO: WaterfallLayout doesn't use card size in v2, but perhaps it should support it? Perhaps it would modify
|
|
1248
|
+
// minItemSize defaults or other things
|
|
1249
|
+
super(options);
|
|
1250
|
+
this.minItemSize = options.minItemSize || new $5HlfY$Size(240, 136);
|
|
1251
|
+
this.maxItemSize = options.maxItemSize || new $5HlfY$Size(Infinity, Infinity);
|
|
1252
|
+
this.margin = options.margin != null ? options.margin : 24;
|
|
1253
|
+
this.minSpace = options.minSpace || new $5HlfY$Size(18, 18);
|
|
1254
|
+
this.maxColumns = options.maxColumns || Infinity;
|
|
1255
|
+
this.itemWidth = 0;
|
|
1256
|
+
this.numColumns = 0;
|
|
1257
|
+
this.lastCollection = null;
|
|
1258
|
+
this.collator = options.collator;
|
|
1561
1259
|
}
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1566
|
-
getNextColumnIndex(columnHeights) {
|
|
1567
|
-
let minIndex = 0;
|
|
1568
|
-
|
|
1569
|
-
for (let i = 0; i < columnHeights.length; i++) {
|
|
1570
|
-
if (columnHeights[i] < columnHeights[minIndex]) {
|
|
1571
|
-
minIndex = i;
|
|
1572
|
-
}
|
|
1260
|
+
get layoutType() {
|
|
1261
|
+
return 'waterfall';
|
|
1573
1262
|
}
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1263
|
+
buildCollection(invalidationContext) {
|
|
1264
|
+
// Compute the number of columns needed to display the content
|
|
1265
|
+
let visibleWidth = this.virtualizer.visibleRect.width;
|
|
1266
|
+
let availableWidth = visibleWidth - this.margin * 2;
|
|
1267
|
+
let columns = Math.floor((availableWidth + this.minSpace.width) / (this.minItemSize.width + this.minSpace.width));
|
|
1268
|
+
this.numColumns = Math.max(1, Math.min(this.maxColumns, columns));
|
|
1269
|
+
// Compute the available width (minus the space between items)
|
|
1270
|
+
let width = availableWidth - this.minSpace.width * (this.numColumns - 1);
|
|
1271
|
+
// Compute the item width based on the space available
|
|
1272
|
+
let itemWidth = Math.round(width / this.numColumns);
|
|
1273
|
+
itemWidth = Math.max(this.minItemSize.width, Math.min(this.maxItemSize.width, itemWidth));
|
|
1274
|
+
this.itemWidth = itemWidth;
|
|
1275
|
+
// Compute the horizontal spacing
|
|
1276
|
+
// if only one column, we cannot divide by zero, so set it to 1
|
|
1277
|
+
let horizontalSpacing = Math.round((availableWidth - this.numColumns * itemWidth) / Math.max(1, this.numColumns - 1));
|
|
1278
|
+
this.horizontalSpacing = horizontalSpacing;
|
|
1279
|
+
// Setup an array of column heights
|
|
1280
|
+
let columnHeights = Array(this.numColumns).fill(this.margin);
|
|
1281
|
+
for (let node of this.collection){
|
|
1282
|
+
let key = node.key;
|
|
1283
|
+
// Compute the height of the item. Use the existing height if available,
|
|
1284
|
+
// otherwise call the delegate to estimate the size.
|
|
1285
|
+
let oldLayoutInfo = this.layoutInfos.get(key);
|
|
1286
|
+
let height;
|
|
1287
|
+
let estimatedSize = true;
|
|
1288
|
+
if (oldLayoutInfo) {
|
|
1289
|
+
height = oldLayoutInfo.rect.height;
|
|
1290
|
+
estimatedSize = invalidationContext.sizeChanged || oldLayoutInfo.estimatedSize;
|
|
1291
|
+
} else if (node.props.width && node.props.height) {
|
|
1292
|
+
let nodeWidth = node.props.width;
|
|
1293
|
+
let nodeHeight = node.props.height;
|
|
1294
|
+
let scaledHeight = Math.round(nodeHeight * (itemWidth / nodeWidth));
|
|
1295
|
+
height = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, scaledHeight));
|
|
1296
|
+
} else height = itemWidth;
|
|
1297
|
+
// Figure out which column to place the item in, and compute its position.
|
|
1298
|
+
let column = this.getNextColumnIndex(columnHeights);
|
|
1299
|
+
let x = this.margin + column * (itemWidth + horizontalSpacing);
|
|
1300
|
+
let y = columnHeights[column];
|
|
1301
|
+
let rect = new $5HlfY$Rect(x, y, itemWidth, height);
|
|
1302
|
+
let layoutInfo = new $5HlfY$LayoutInfo(node.type, key, rect);
|
|
1303
|
+
layoutInfo.estimatedSize = estimatedSize;
|
|
1304
|
+
layoutInfo.allowOverflow = true;
|
|
1305
|
+
this.layoutInfos.set(key, layoutInfo);
|
|
1306
|
+
// TODO: From v2 figure out this bit, when does this get called and what to replace this.collectionView._transaction with?
|
|
1307
|
+
// Removing it from v2 doesn't seem to do anything?
|
|
1308
|
+
// if (layoutInfo.estimatedSize && !invalidationContext.contentChanged && !this.collectionView._transaction) {
|
|
1309
|
+
// this.updateItemSize(new IndexPath(section, i));
|
|
1310
|
+
// }
|
|
1311
|
+
columnHeights[column] += layoutInfo.rect.height + this.minSpace.height;
|
|
1312
|
+
}
|
|
1313
|
+
// Reset all columns to the maximum for the next section
|
|
1314
|
+
let maxHeight = Math.max.apply(Math, columnHeights) - this.minSpace.height + this.margin;
|
|
1315
|
+
columnHeights.fill(maxHeight);
|
|
1316
|
+
let y = columnHeights[0];
|
|
1317
|
+
if (this.isLoading) {
|
|
1318
|
+
let loaderY = y;
|
|
1319
|
+
let loaderHeight = 60;
|
|
1320
|
+
// If there aren't any items, make loader take all avaliable room and remove margin from y calculation
|
|
1321
|
+
// so it doesn't scroll
|
|
1322
|
+
if (this.collection.size === 0) {
|
|
1323
|
+
loaderY = 0;
|
|
1324
|
+
loaderHeight = this.virtualizer.visibleRect.height || 60;
|
|
1325
|
+
}
|
|
1326
|
+
let rect = new $5HlfY$Rect(0, loaderY, this.virtualizer.visibleRect.width, loaderHeight);
|
|
1327
|
+
let loader = new $5HlfY$LayoutInfo('loader', 'loader', rect);
|
|
1328
|
+
this.layoutInfos.set('loader', loader);
|
|
1329
|
+
y = loader.rect.maxY;
|
|
1330
|
+
}
|
|
1331
|
+
if (this.collection.size === 0 && !this.isLoading) {
|
|
1332
|
+
let rect = new $5HlfY$Rect(0, 0, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);
|
|
1333
|
+
let placeholder = new $5HlfY$LayoutInfo('placeholder', 'placeholder', rect);
|
|
1334
|
+
this.layoutInfos.set('placeholder', placeholder);
|
|
1335
|
+
y = placeholder.rect.maxY;
|
|
1336
|
+
}
|
|
1337
|
+
this.contentSize = new $5HlfY$Size(this.virtualizer.visibleRect.width, y);
|
|
1338
|
+
}
|
|
1339
|
+
updateItemSize(key, size) {
|
|
1340
|
+
let layoutInfo = this.layoutInfos.get(key);
|
|
1341
|
+
if (!size || !layoutInfo) return false;
|
|
1342
|
+
if (size.height !== layoutInfo.rect.height) {
|
|
1343
|
+
// TODO: also not sure about copying layout info vs mutating it. Listlayout does the below
|
|
1344
|
+
// but I feel that is because it actually maintained a layoutNode map cache which this doesn't have
|
|
1345
|
+
let newLayoutInfo = layoutInfo.copy();
|
|
1346
|
+
newLayoutInfo.rect.height = size.height < 600 ? size.height : 600;
|
|
1347
|
+
newLayoutInfo.estimatedSize = false;
|
|
1348
|
+
this.layoutInfos.set(key, newLayoutInfo);
|
|
1349
|
+
return true;
|
|
1350
|
+
}
|
|
1351
|
+
return false;
|
|
1352
|
+
}
|
|
1353
|
+
getNextColumnIndex(columnHeights) {
|
|
1354
|
+
let minIndex = 0;
|
|
1355
|
+
for(let i = 0; i < columnHeights.length; i++)if (columnHeights[i] < columnHeights[minIndex]) minIndex = i;
|
|
1356
|
+
return minIndex;
|
|
1594
1357
|
}
|
|
1358
|
+
getClosestRight(key) {
|
|
1359
|
+
let layoutInfo = this.getLayoutInfo(key);
|
|
1360
|
+
// Refactored from v2. Current strategy is to find the closest card in the adjacent column.
|
|
1361
|
+
// This prevent the issue where it was possible that the closest layoutInfo would be two columns over due to the middle card being exceptionally tall
|
|
1362
|
+
// and thus the top corner to top corner distance was massive.
|
|
1363
|
+
// First look for a card to the immediate right of the current card. If we can't find any, look for the nearest card in the entire column to the right of the card
|
|
1364
|
+
let rect = new $5HlfY$Rect(layoutInfo.rect.maxX + 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);
|
|
1365
|
+
key = this._findClosest(layoutInfo.rect, rect)?.key;
|
|
1366
|
+
if (!key) {
|
|
1367
|
+
rect = new $5HlfY$Rect(layoutInfo.rect.maxX + 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);
|
|
1368
|
+
key = this._findClosest(layoutInfo.rect, rect)?.key;
|
|
1369
|
+
}
|
|
1370
|
+
return this.collection.getItem(key)?.childNodes[0]?.key;
|
|
1371
|
+
}
|
|
1372
|
+
getClosestLeft(key) {
|
|
1373
|
+
let layoutInfo = this.getLayoutInfo(key);
|
|
1374
|
+
// First look for a card to the immediate left of the current card. If we can't find any, look for the nearest card in the entire column to the left of the card
|
|
1375
|
+
let rect = new $5HlfY$Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);
|
|
1376
|
+
key = this._findClosest(layoutInfo.rect, rect)?.key;
|
|
1377
|
+
if (!key) {
|
|
1378
|
+
rect = new $5HlfY$Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);
|
|
1379
|
+
key = this._findClosest(layoutInfo.rect, rect)?.key;
|
|
1380
|
+
}
|
|
1381
|
+
return this.collection.getItem(key)?.childNodes[0]?.key;
|
|
1382
|
+
}
|
|
1383
|
+
getKeyRightOf(key) {
|
|
1384
|
+
// Expected key is the currently focused cell so we need the parent row key
|
|
1385
|
+
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
1386
|
+
return this.direction === 'rtl' ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);
|
|
1387
|
+
}
|
|
1388
|
+
getKeyLeftOf(key) {
|
|
1389
|
+
// Expected key is the currently focused cell so we need the parent row key
|
|
1390
|
+
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
1391
|
+
return this.direction === 'rtl' ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1595
1394
|
|
|
1596
|
-
return (_this$collection$getI = this.collection.getItem(key)) == null ? void 0 : (_this$collection$getI2 = _this$collection$getI.childNodes[0]) == null ? void 0 : _this$collection$getI2.key;
|
|
1597
|
-
}
|
|
1598
1395
|
|
|
1599
|
-
|
|
1600
|
-
var _this$_findClosest3, _this$collection$getI3, _this$collection$getI4;
|
|
1396
|
+
var $a39f0127ee2764b3$exports = {};
|
|
1601
1397
|
|
|
1602
|
-
|
|
1398
|
+
$parcel$export($a39f0127ee2764b3$exports, "Card", () => $a39f0127ee2764b3$export$60332b2344f7fe41);
|
|
1603
1399
|
|
|
1604
|
-
let rect = new Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);
|
|
1605
|
-
key = (_this$_findClosest3 = this._findClosest(layoutInfo.rect, rect)) == null ? void 0 : _this$_findClosest3.key;
|
|
1606
1400
|
|
|
1607
|
-
if (!key) {
|
|
1608
|
-
var _this$_findClosest4;
|
|
1609
1401
|
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1402
|
+
let $a39f0127ee2764b3$var$Card = /*#__PURE__*/ $5HlfY$forwardRef((props, ref)=>{
|
|
1403
|
+
let context = $9a000cf0a62ebe41$export$fea0b38586ec8f13();
|
|
1404
|
+
if (context !== null) return null;
|
|
1405
|
+
else return(/*#__PURE__*/ $5HlfY$react.createElement($f5426ba654d120b1$export$7a6ccaf429ad93a8, {
|
|
1406
|
+
...props,
|
|
1407
|
+
ref: ref
|
|
1408
|
+
}));
|
|
1409
|
+
});
|
|
1410
|
+
// @ts-ignore
|
|
1411
|
+
$a39f0127ee2764b3$var$Card.getCollectionNode = function* getCollectionNode(props) {
|
|
1412
|
+
let { children: children , textValue: textValue } = props;
|
|
1413
|
+
yield {
|
|
1414
|
+
type: 'item',
|
|
1415
|
+
props: props,
|
|
1416
|
+
rendered: children,
|
|
1417
|
+
'aria-label': props['aria-label'],
|
|
1418
|
+
hasChildNodes: false,
|
|
1419
|
+
textValue: textValue
|
|
1420
|
+
};
|
|
1421
|
+
};
|
|
1422
|
+
let $a39f0127ee2764b3$export$60332b2344f7fe41 = $a39f0127ee2764b3$var$Card;
|
|
1613
1423
|
|
|
1614
|
-
return (_this$collection$getI3 = this.collection.getItem(key)) == null ? void 0 : (_this$collection$getI4 = _this$collection$getI3.childNodes[0]) == null ? void 0 : _this$collection$getI4.key;
|
|
1615
|
-
}
|
|
1616
1424
|
|
|
1617
|
-
getKeyRightOf(key) {
|
|
1618
|
-
// Expected key is the currently focused cell so we need the parent row key
|
|
1619
|
-
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
1620
|
-
return this.direction === 'rtl' ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);
|
|
1621
|
-
}
|
|
1622
1425
|
|
|
1623
|
-
getKeyLeftOf(key) {
|
|
1624
|
-
// Expected key is the currently focused cell so we need the parent row key
|
|
1625
|
-
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
1626
|
-
return this.direction === 'rtl' ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);
|
|
1627
|
-
}
|
|
1628
1426
|
|
|
1629
|
-
}
|
|
1630
|
-
let $a9aa5597d12298caa047e9b33c6e$var$Card = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1631
|
-
let context = $f9069c2077073c56c9fbb170659475$export$useCardViewContext();
|
|
1632
|
-
|
|
1633
|
-
if (context !== null) {
|
|
1634
|
-
return null;
|
|
1635
|
-
} else {
|
|
1636
|
-
return /*#__PURE__*/_react.createElement($c6a745aa43479b6f54b3654a7597126$export$CardBase, _babelRuntimeHelpersEsmExtends({}, props, {
|
|
1637
|
-
ref: ref
|
|
1638
|
-
}));
|
|
1639
|
-
}
|
|
1640
|
-
}); // TODO: Update the typescript for the below and the export
|
|
1641
|
-
// @ts-ignore
|
|
1642
|
-
// eslint-disable-next-line
|
|
1643
|
-
|
|
1644
|
-
$a9aa5597d12298caa047e9b33c6e$var$Card.getCollectionNode = function* getCollectionNode(props, context) {
|
|
1645
|
-
let {
|
|
1646
|
-
children,
|
|
1647
|
-
textValue
|
|
1648
|
-
} = props;
|
|
1649
|
-
yield {
|
|
1650
|
-
type: 'item',
|
|
1651
|
-
props: props,
|
|
1652
|
-
rendered: children,
|
|
1653
|
-
'aria-label': props['aria-label'],
|
|
1654
|
-
hasChildNodes: false,
|
|
1655
|
-
textValue
|
|
1656
|
-
};
|
|
1657
|
-
}; // eslint-disable-next-line
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
export let Card = $a9aa5597d12298caa047e9b33c6e$var$Card;
|
|
1427
|
+
export {$c6398e7007a75897$export$7e52c821f7b6f422 as CardView, $a4ebacd960847d9c$export$8e52095834484b61 as GalleryLayout, $518ec229733533c6$export$7d2b12578154a735 as GridLayout, $eb50f2ca3a53d913$export$e9f7cda058ba8df8 as WaterfallLayout, $a39f0127ee2764b3$export$60332b2344f7fe41 as Card};
|
|
1661
1428
|
//# sourceMappingURL=module.js.map
|