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