@payloadcms/ui 3.42.0 → 3.43.0-internal.c5bbc84
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/elements/CopyLocaleData/index.d.ts.map +1 -1
- package/dist/elements/CopyLocaleData/index.js +6 -1
- package/dist/elements/CopyLocaleData/index.js.map +1 -1
- package/dist/elements/FolderView/CollectionTypePill/index.d.ts.map +1 -1
- package/dist/elements/FolderView/CollectionTypePill/index.js +13 -10
- package/dist/elements/FolderView/CollectionTypePill/index.js.map +1 -1
- package/dist/elements/FolderView/CurrentFolderActions/index.d.ts.map +1 -1
- package/dist/elements/FolderView/CurrentFolderActions/index.js +17 -11
- package/dist/elements/FolderView/CurrentFolderActions/index.js.map +1 -1
- package/dist/elements/FolderView/Drawers/EditFolderAction/index.d.ts +1 -3
- package/dist/elements/FolderView/Drawers/EditFolderAction/index.d.ts.map +1 -1
- package/dist/elements/FolderView/Drawers/EditFolderAction/index.js +7 -4
- package/dist/elements/FolderView/Drawers/EditFolderAction/index.js.map +1 -1
- package/dist/elements/FolderView/Drawers/MoveToFolder/index.d.ts +1 -0
- package/dist/elements/FolderView/Drawers/MoveToFolder/index.d.ts.map +1 -1
- package/dist/elements/FolderView/Drawers/MoveToFolder/index.js +230 -201
- package/dist/elements/FolderView/Drawers/MoveToFolder/index.js.map +1 -1
- package/dist/elements/FolderView/FolderFileCard/index.d.ts +8 -0
- package/dist/elements/FolderView/FolderFileCard/index.d.ts.map +1 -1
- package/dist/elements/FolderView/FolderFileCard/index.js +82 -0
- package/dist/elements/FolderView/FolderFileCard/index.js.map +1 -1
- package/dist/elements/FolderView/FolderFileTable/index.d.ts +1 -22
- package/dist/elements/FolderView/FolderFileTable/index.d.ts.map +1 -1
- package/dist/elements/FolderView/FolderFileTable/index.js +245 -163
- package/dist/elements/FolderView/FolderFileTable/index.js.map +1 -1
- package/dist/elements/FolderView/ItemCardGrid/index.d.ts +2 -8
- package/dist/elements/FolderView/ItemCardGrid/index.d.ts.map +1 -1
- package/dist/elements/FolderView/ItemCardGrid/index.js +24 -90
- package/dist/elements/FolderView/ItemCardGrid/index.js.map +1 -1
- package/dist/elements/FolderView/SortByPill/index.d.ts.map +1 -1
- package/dist/elements/FolderView/SortByPill/index.js +17 -15
- package/dist/elements/FolderView/SortByPill/index.js.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListCreateNewDocInFolderButton.d.ts.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListCreateNewDocInFolderButton.js +8 -10
- package/dist/elements/ListHeader/TitleActions/ListCreateNewDocInFolderButton.js.map +1 -1
- package/dist/exports/client/index.js +22 -22
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/rsc/index.d.ts +1 -0
- package/dist/exports/rsc/index.d.ts.map +1 -1
- package/dist/exports/rsc/index.js +1 -0
- package/dist/exports/rsc/index.js.map +1 -1
- package/dist/fields/Relationship/Input.d.ts.map +1 -1
- package/dist/fields/Relationship/Input.js +1 -0
- package/dist/fields/Relationship/Input.js.map +1 -1
- package/dist/providers/Folders/index.d.ts +59 -46
- package/dist/providers/Folders/index.d.ts.map +1 -1
- package/dist/providers/Folders/index.js +163 -572
- package/dist/providers/Folders/index.js.map +1 -1
- package/dist/providers/ServerFunctions/index.d.ts +6 -1
- package/dist/providers/ServerFunctions/index.d.ts.map +1 -1
- package/dist/providers/ServerFunctions/index.js +19 -0
- package/dist/providers/ServerFunctions/index.js.map +1 -1
- package/dist/providers/TableColumns/index.js +1 -0
- package/dist/providers/TableColumns/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utilities/getFolderResultsComponentAndData.d.ts +29 -0
- package/dist/utilities/getFolderResultsComponentAndData.d.ts.map +1 -0
- package/dist/utilities/getFolderResultsComponentAndData.js +128 -0
- package/dist/utilities/getFolderResultsComponentAndData.js.map +1 -0
- package/dist/views/BrowseByFolder/index.d.ts +1 -4
- package/dist/views/BrowseByFolder/index.d.ts.map +1 -1
- package/dist/views/BrowseByFolder/index.js +219 -158
- package/dist/views/BrowseByFolder/index.js.map +1 -1
- package/dist/views/CollectionFolder/ListSelection/index.d.ts.map +1 -1
- package/dist/views/CollectionFolder/ListSelection/index.js +25 -50
- package/dist/views/CollectionFolder/ListSelection/index.js.map +1 -1
- package/dist/views/CollectionFolder/index.d.ts +1 -1
- package/dist/views/CollectionFolder/index.d.ts.map +1 -1
- package/dist/views/CollectionFolder/index.js +186 -153
- package/dist/views/CollectionFolder/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
5
|
import { getTranslation } from '@payloadcms/translations';
|
|
3
6
|
import { extractID } from 'payload/shared';
|
|
4
7
|
import React from 'react';
|
|
5
8
|
import { DocumentIcon } from '../../../icons/Document/index.js';
|
|
6
9
|
import { useConfig } from '../../../providers/Config/index.js';
|
|
10
|
+
import { useFolder } from '../../../providers/Folders/index.js';
|
|
7
11
|
import { useTranslation } from '../../../providers/Translation/index.js';
|
|
8
12
|
import { formatDate } from '../../../utilities/formatDocTitle/formatDateTitle.js';
|
|
9
13
|
import { ColoredFolderIcon } from '../ColoredFolderIcon/index.js';
|
|
@@ -11,179 +15,257 @@ import { DraggableTableRow } from '../DraggableTableRow/index.js';
|
|
|
11
15
|
import { SimpleTable, TableHeader } from '../SimpleTable/index.js';
|
|
12
16
|
import './index.scss';
|
|
13
17
|
const baseClass = 'folder-file-table';
|
|
14
|
-
export function FolderFileTable({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
export function FolderFileTable(t0) {
|
|
19
|
+
const $ = _c(39);
|
|
20
|
+
const {
|
|
21
|
+
showRelationCell: t1
|
|
22
|
+
} = t0;
|
|
23
|
+
const showRelationCell = t1 === undefined ? true : t1;
|
|
24
|
+
const {
|
|
25
|
+
documents,
|
|
26
|
+
focusedRowIndex,
|
|
27
|
+
isDragging,
|
|
28
|
+
onItemClick,
|
|
29
|
+
onItemKeyPress,
|
|
30
|
+
selectedItemKeys,
|
|
31
|
+
subfolders
|
|
32
|
+
} = useFolder();
|
|
27
33
|
const {
|
|
28
34
|
config
|
|
29
35
|
} = useConfig();
|
|
30
36
|
const {
|
|
37
|
+
i18n,
|
|
31
38
|
t
|
|
32
39
|
} = useTranslation();
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
map
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
const [columns] = React.useState(() => {
|
|
41
|
-
const columnsToShow = [{
|
|
42
|
-
name: 'name',
|
|
43
|
-
label: t('general:name')
|
|
44
|
-
}, {
|
|
45
|
-
name: 'createdAt',
|
|
46
|
-
label: t('general:createdAt')
|
|
47
|
-
}, {
|
|
48
|
-
name: 'updatedAt',
|
|
49
|
-
label: t('general:updatedAt')
|
|
50
|
-
}];
|
|
51
|
-
if (showRelationCell) {
|
|
52
|
-
columnsToShow.push({
|
|
53
|
-
name: 'type',
|
|
54
|
-
label: t('version:type')
|
|
40
|
+
let t2;
|
|
41
|
+
if ($[0] !== config || $[1] !== i18n) {
|
|
42
|
+
t2 = () => {
|
|
43
|
+
const map = {};
|
|
44
|
+
config.collections.forEach(collection => {
|
|
45
|
+
map[collection.slug] = getTranslation(collection.labels?.singular, i18n);
|
|
55
46
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
47
|
+
return map;
|
|
48
|
+
};
|
|
49
|
+
$[0] = config;
|
|
50
|
+
$[1] = i18n;
|
|
51
|
+
$[2] = t2;
|
|
52
|
+
} else {
|
|
53
|
+
t2 = $[2];
|
|
54
|
+
}
|
|
55
|
+
const [relationToMap] = React.useState(t2);
|
|
56
|
+
let t3;
|
|
57
|
+
if ($[3] !== showRelationCell || $[4] !== t) {
|
|
58
|
+
t3 = () => {
|
|
59
|
+
const columnsToShow = [{
|
|
60
|
+
name: "name",
|
|
61
|
+
label: t("general:name")
|
|
62
|
+
}, {
|
|
63
|
+
name: "createdAt",
|
|
64
|
+
label: t("general:createdAt")
|
|
65
|
+
}, {
|
|
66
|
+
name: "updatedAt",
|
|
67
|
+
label: t("general:updatedAt")
|
|
68
|
+
}];
|
|
69
|
+
if (showRelationCell) {
|
|
70
|
+
columnsToShow.push({
|
|
71
|
+
name: "type",
|
|
72
|
+
label: t("version:type")
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return columnsToShow;
|
|
76
|
+
};
|
|
77
|
+
$[3] = showRelationCell;
|
|
78
|
+
$[4] = t;
|
|
79
|
+
$[5] = t3;
|
|
80
|
+
} else {
|
|
81
|
+
t3 = $[5];
|
|
82
|
+
}
|
|
83
|
+
const [columns] = React.useState(t3);
|
|
84
|
+
let t4;
|
|
85
|
+
if ($[6] !== columns || $[7] !== config || $[8] !== documents || $[9] !== focusedRowIndex || $[10] !== i18n || $[11] !== isDragging || $[12] !== onItemClick || $[13] !== onItemKeyPress || $[14] !== relationToMap || $[15] !== selectedItemKeys || $[16] !== subfolders) {
|
|
86
|
+
let t5;
|
|
87
|
+
if ($[18] !== columns || $[19] !== config || $[20] !== focusedRowIndex || $[21] !== i18n || $[22] !== isDragging || $[23] !== onItemClick || $[24] !== onItemKeyPress || $[25] !== relationToMap || $[26] !== selectedItemKeys) {
|
|
88
|
+
t5 = (subfolder, rowIndex) => {
|
|
89
|
+
const {
|
|
90
|
+
itemKey,
|
|
91
|
+
relationTo,
|
|
92
|
+
value
|
|
93
|
+
} = subfolder;
|
|
94
|
+
const subfolderID = extractID(value);
|
|
95
|
+
return _jsx(DraggableTableRow, {
|
|
96
|
+
columns: columns.map((t6, index) => {
|
|
97
|
+
const {
|
|
98
|
+
name: name_0
|
|
99
|
+
} = t6;
|
|
100
|
+
let cellValue = "\u2014";
|
|
101
|
+
if (name_0 === "name" && value._folderOrDocumentTitle !== undefined) {
|
|
102
|
+
cellValue = value._folderOrDocumentTitle;
|
|
103
|
+
}
|
|
104
|
+
if ((name_0 === "createdAt" || name_0 === "updatedAt") && value[name_0]) {
|
|
105
|
+
cellValue = formatDate({
|
|
106
|
+
date: value[name_0],
|
|
107
|
+
i18n,
|
|
108
|
+
pattern: config.admin.dateFormat
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
if (name_0 === "type") {
|
|
112
|
+
cellValue = relationToMap[relationTo] || relationTo;
|
|
113
|
+
}
|
|
114
|
+
if (index === 0) {
|
|
115
|
+
return _jsxs("span", {
|
|
116
|
+
className: `${baseClass}__cell-with-icon`,
|
|
117
|
+
children: [_jsx(ColoredFolderIcon, {}), cellValue]
|
|
118
|
+
}, `${itemKey}-${name_0}`);
|
|
119
|
+
} else {
|
|
120
|
+
return cellValue;
|
|
121
|
+
}
|
|
122
|
+
}),
|
|
123
|
+
disabled: isDragging && selectedItemKeys?.has(itemKey),
|
|
124
|
+
dragData: {
|
|
125
|
+
id: subfolderID,
|
|
126
|
+
type: "folder"
|
|
127
|
+
},
|
|
102
128
|
id: subfolderID,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
event,
|
|
121
|
-
index: rowIndex,
|
|
122
|
-
item: subfolder
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}, `${rowIndex}-${itemKey}`);
|
|
126
|
-
}), ...documents.map((document, unadjustedIndex) => {
|
|
127
|
-
const {
|
|
128
|
-
itemKey,
|
|
129
|
-
relationTo,
|
|
130
|
-
value
|
|
131
|
-
} = document;
|
|
132
|
-
const documentID = extractID(value);
|
|
133
|
-
const rowIndex = unadjustedIndex + subfolders.length;
|
|
134
|
-
return /*#__PURE__*/_jsx(DraggableTableRow, {
|
|
135
|
-
columns: columns.map(({
|
|
136
|
-
name
|
|
137
|
-
}, index) => {
|
|
138
|
-
let cellValue = '—';
|
|
139
|
-
if (name === 'name' && value._folderOrDocumentTitle !== undefined) {
|
|
140
|
-
cellValue = value._folderOrDocumentTitle;
|
|
141
|
-
}
|
|
142
|
-
if ((name === 'createdAt' || name === 'updatedAt') && value[name]) {
|
|
143
|
-
cellValue = formatDate({
|
|
144
|
-
date: value[name],
|
|
145
|
-
i18n,
|
|
146
|
-
pattern: dateFormat
|
|
129
|
+
isDroppable: true,
|
|
130
|
+
isFocused: focusedRowIndex === rowIndex,
|
|
131
|
+
isSelected: selectedItemKeys.has(itemKey),
|
|
132
|
+
isSelecting: selectedItemKeys.size > 0,
|
|
133
|
+
itemKey,
|
|
134
|
+
onClick: event => {
|
|
135
|
+
onItemClick({
|
|
136
|
+
event,
|
|
137
|
+
index: rowIndex,
|
|
138
|
+
item: subfolder
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
onKeyDown: event_0 => {
|
|
142
|
+
onItemKeyPress({
|
|
143
|
+
event: event_0,
|
|
144
|
+
index: rowIndex,
|
|
145
|
+
item: subfolder
|
|
147
146
|
});
|
|
148
147
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
148
|
+
}, `${rowIndex}-${itemKey}`);
|
|
149
|
+
};
|
|
150
|
+
$[18] = columns;
|
|
151
|
+
$[19] = config;
|
|
152
|
+
$[20] = focusedRowIndex;
|
|
153
|
+
$[21] = i18n;
|
|
154
|
+
$[22] = isDragging;
|
|
155
|
+
$[23] = onItemClick;
|
|
156
|
+
$[24] = onItemKeyPress;
|
|
157
|
+
$[25] = relationToMap;
|
|
158
|
+
$[26] = selectedItemKeys;
|
|
159
|
+
$[27] = t5;
|
|
160
|
+
} else {
|
|
161
|
+
t5 = $[27];
|
|
162
|
+
}
|
|
163
|
+
let t6;
|
|
164
|
+
if ($[28] !== columns || $[29] !== config || $[30] !== focusedRowIndex || $[31] !== i18n || $[32] !== isDragging || $[33] !== onItemClick || $[34] !== onItemKeyPress || $[35] !== relationToMap || $[36] !== selectedItemKeys || $[37] !== subfolders.length) {
|
|
165
|
+
t6 = (document, unadjustedIndex) => {
|
|
166
|
+
const {
|
|
167
|
+
itemKey: itemKey_0,
|
|
168
|
+
relationTo: relationTo_0,
|
|
169
|
+
value: value_0
|
|
170
|
+
} = document;
|
|
171
|
+
const documentID = extractID(value_0);
|
|
172
|
+
const rowIndex_0 = unadjustedIndex + subfolders.length;
|
|
173
|
+
return _jsx(DraggableTableRow, {
|
|
174
|
+
columns: columns.map((t7, index_0) => {
|
|
175
|
+
const {
|
|
176
|
+
name: name_1
|
|
177
|
+
} = t7;
|
|
178
|
+
let cellValue_0 = "\u2014";
|
|
179
|
+
if (name_1 === "name" && value_0._folderOrDocumentTitle !== undefined) {
|
|
180
|
+
cellValue_0 = value_0._folderOrDocumentTitle;
|
|
181
|
+
}
|
|
182
|
+
if ((name_1 === "createdAt" || name_1 === "updatedAt") && value_0[name_1]) {
|
|
183
|
+
cellValue_0 = formatDate({
|
|
184
|
+
date: value_0[name_1],
|
|
185
|
+
i18n,
|
|
186
|
+
pattern: config.admin.dateFormat
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
if (name_1 === "type") {
|
|
190
|
+
cellValue_0 = relationToMap[relationTo_0] || relationTo_0;
|
|
191
|
+
}
|
|
192
|
+
if (index_0 === 0) {
|
|
193
|
+
return _jsxs("span", {
|
|
194
|
+
className: `${baseClass}__cell-with-icon`,
|
|
195
|
+
children: [_jsx(DocumentIcon, {}), cellValue_0]
|
|
196
|
+
}, `${itemKey_0}-${name_1}`);
|
|
197
|
+
} else {
|
|
198
|
+
return cellValue_0;
|
|
199
|
+
}
|
|
200
|
+
}),
|
|
201
|
+
disabled: isDragging || selectedItemKeys?.has(itemKey_0),
|
|
202
|
+
dragData: {
|
|
203
|
+
id: documentID,
|
|
204
|
+
type: "document"
|
|
205
|
+
},
|
|
163
206
|
id: documentID,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
207
|
+
isFocused: focusedRowIndex === rowIndex_0,
|
|
208
|
+
isSelected: selectedItemKeys.has(itemKey_0),
|
|
209
|
+
isSelecting: selectedItemKeys.size > 0,
|
|
210
|
+
itemKey: itemKey_0,
|
|
211
|
+
onClick: event_1 => {
|
|
212
|
+
onItemClick({
|
|
213
|
+
event: event_1,
|
|
214
|
+
index: rowIndex_0,
|
|
215
|
+
item: document
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
onKeyDown: event_2 => {
|
|
219
|
+
onItemKeyPress({
|
|
220
|
+
event: event_2,
|
|
221
|
+
index: rowIndex_0,
|
|
222
|
+
item: document
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}, `${rowIndex_0}-${itemKey_0}`);
|
|
226
|
+
};
|
|
227
|
+
$[28] = columns;
|
|
228
|
+
$[29] = config;
|
|
229
|
+
$[30] = focusedRowIndex;
|
|
230
|
+
$[31] = i18n;
|
|
231
|
+
$[32] = isDragging;
|
|
232
|
+
$[33] = onItemClick;
|
|
233
|
+
$[34] = onItemKeyPress;
|
|
234
|
+
$[35] = relationToMap;
|
|
235
|
+
$[36] = selectedItemKeys;
|
|
236
|
+
$[37] = subfolders.length;
|
|
237
|
+
$[38] = t6;
|
|
238
|
+
} else {
|
|
239
|
+
t6 = $[38];
|
|
240
|
+
}
|
|
241
|
+
t4 = _jsx(SimpleTable, {
|
|
242
|
+
headerCells: columns.map(_temp),
|
|
243
|
+
tableRows: [...subfolders.map(t5), ...documents.map(t6)]
|
|
244
|
+
});
|
|
245
|
+
$[6] = columns;
|
|
246
|
+
$[7] = config;
|
|
247
|
+
$[8] = documents;
|
|
248
|
+
$[9] = focusedRowIndex;
|
|
249
|
+
$[10] = i18n;
|
|
250
|
+
$[11] = isDragging;
|
|
251
|
+
$[12] = onItemClick;
|
|
252
|
+
$[13] = onItemKeyPress;
|
|
253
|
+
$[14] = relationToMap;
|
|
254
|
+
$[15] = selectedItemKeys;
|
|
255
|
+
$[16] = subfolders;
|
|
256
|
+
$[17] = t4;
|
|
257
|
+
} else {
|
|
258
|
+
t4 = $[17];
|
|
259
|
+
}
|
|
260
|
+
return t4;
|
|
261
|
+
}
|
|
262
|
+
function _temp(t0) {
|
|
263
|
+
const {
|
|
264
|
+
name,
|
|
265
|
+
label
|
|
266
|
+
} = t0;
|
|
267
|
+
return _jsx(TableHeader, {
|
|
268
|
+
children: label
|
|
269
|
+
}, name);
|
|
188
270
|
}
|
|
189
271
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getTranslation","extractID","React","DocumentIcon","useConfig","useTranslation","formatDate","ColoredFolderIcon","DraggableTableRow","SimpleTable","TableHeader","baseClass","FolderFileTable","dateFormat","disabledItems","Set","documents","focusedRowIndex","i18n","isMovingItems","onRowClick","onRowPress","selectedItems","showRelationCell","subfolders","config","t","relationToMap","useState","map","collections","forEach","collection","slug","labels","singular","columns","columnsToShow","name","label","push","_jsx","headerCells","tableRows","subfolder","rowIndex","itemKey","relationTo","value","subfolderID","index","cellValue","_folderOrDocumentTitle","undefined","date","pattern","_jsxs","className","disabled","has","dragData","id","type","isDroppable","isFocused","isSelected","isSelecting","size","onClick","event","item","onKeyDown","document","unadjustedIndex","documentID","length"],"sources":["../../../../src/elements/FolderView/FolderFileTable/index.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { FolderDocumentItemKey, FolderOrDocument } from 'payload/shared'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { extractID } from 'payload/shared'\nimport React from 'react'\n\nimport type { FormatDateArgs } from '../../../utilities/formatDocTitle/formatDateTitle.js'\n\nimport { DocumentIcon } from '../../../icons/Document/index.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport { formatDate } from '../../../utilities/formatDocTitle/formatDateTitle.js'\nimport { ColoredFolderIcon } from '../ColoredFolderIcon/index.js'\nimport { DraggableTableRow } from '../DraggableTableRow/index.js'\nimport { SimpleTable, TableHeader } from '../SimpleTable/index.js'\nimport './index.scss'\n\nconst baseClass = 'folder-file-table'\n\ntype Props = {\n dateFormat: FormatDateArgs['pattern']\n disabledItems?: Set<FolderDocumentItemKey>\n documents: FolderOrDocument[]\n focusedRowIndex: number\n i18n: I18nClient\n isMovingItems: boolean\n onRowClick: (args: {\n event: React.MouseEvent<Element>\n index: number\n item: FolderOrDocument\n }) => void\n onRowPress: (args: {\n event: React.KeyboardEvent<Element>\n index: number\n item: FolderOrDocument\n }) => void\n selectedItems: Set<FolderDocumentItemKey>\n showRelationCell?: boolean\n subfolders: FolderOrDocument[]\n}\n\nexport function FolderFileTable({\n dateFormat,\n disabledItems = new Set(),\n documents,\n focusedRowIndex,\n i18n,\n isMovingItems,\n onRowClick,\n onRowPress,\n selectedItems,\n showRelationCell = true,\n subfolders,\n}: Props) {\n const { config } = useConfig()\n const { t } = useTranslation()\n\n const [relationToMap] = React.useState(() => {\n const map: Record<string, string> = {}\n config.collections.forEach((collection) => {\n map[collection.slug] = getTranslation(collection.labels?.singular, i18n)\n })\n return map\n })\n\n const [columns] = React.useState(() => {\n const columnsToShow = [\n {\n name: 'name',\n label: t('general:name'),\n },\n {\n name: 'createdAt',\n label: t('general:createdAt'),\n },\n {\n name: 'updatedAt',\n label: t('general:updatedAt'),\n },\n ]\n\n if (showRelationCell) {\n columnsToShow.push({\n name: 'type',\n label: t('version:type'),\n })\n }\n\n return columnsToShow\n })\n\n return (\n <SimpleTable\n headerCells={columns.map(({ name, label }) => (\n <TableHeader key={name}>{label}</TableHeader>\n ))}\n tableRows={[\n ...subfolders.map((subfolder, rowIndex) => {\n const { itemKey, relationTo, value } = subfolder\n const subfolderID = extractID(value)\n\n return (\n <DraggableTableRow\n columns={columns.map(({ name }, index) => {\n let cellValue: React.ReactNode = '—'\n if (name === 'name' && value._folderOrDocumentTitle !== undefined) {\n cellValue = value._folderOrDocumentTitle\n }\n\n if ((name === 'createdAt' || name === 'updatedAt') && value[name]) {\n cellValue = formatDate({ date: value[name], i18n, pattern: dateFormat })\n }\n\n if (name === 'type') {\n cellValue = relationToMap[relationTo] || relationTo\n }\n\n if (index === 0) {\n return (\n <span className={`${baseClass}__cell-with-icon`} key={`${itemKey}-${name}`}>\n <ColoredFolderIcon />\n {cellValue}\n </span>\n )\n } else {\n return cellValue\n }\n })}\n disabled={\n (isMovingItems && selectedItems?.has(itemKey)) || disabledItems?.has(itemKey)\n }\n dragData={{\n id: subfolderID,\n type: 'folder',\n }}\n id={subfolderID}\n isDroppable\n isFocused={focusedRowIndex === rowIndex}\n isSelected={selectedItems.has(itemKey)}\n isSelecting={selectedItems.size > 0}\n itemKey={itemKey}\n key={`${rowIndex}-${itemKey}`}\n onClick={(event) => {\n void onRowClick({\n event,\n index: rowIndex,\n item: subfolder,\n })\n }}\n onKeyDown={(event) => {\n void onRowPress({\n event,\n index: rowIndex,\n item: subfolder,\n })\n }}\n />\n )\n }),\n\n ...documents.map((document, unadjustedIndex) => {\n const { itemKey, relationTo, value } = document\n const documentID = extractID(value)\n const rowIndex = unadjustedIndex + subfolders.length\n\n return (\n <DraggableTableRow\n columns={columns.map(({ name }, index) => {\n let cellValue: React.ReactNode = '—'\n if (name === 'name' && value._folderOrDocumentTitle !== undefined) {\n cellValue = value._folderOrDocumentTitle\n }\n\n if ((name === 'createdAt' || name === 'updatedAt') && value[name]) {\n cellValue = formatDate({ date: value[name], i18n, pattern: dateFormat })\n }\n\n if (name === 'type') {\n cellValue = relationToMap[relationTo] || relationTo\n }\n\n if (index === 0) {\n return (\n <span className={`${baseClass}__cell-with-icon`} key={`${itemKey}-${name}`}>\n <DocumentIcon />\n {cellValue}\n </span>\n )\n } else {\n return cellValue\n }\n })}\n disabled={isMovingItems || disabledItems?.has(itemKey)}\n dragData={{\n id: documentID,\n type: 'document',\n }}\n id={documentID}\n isFocused={focusedRowIndex === rowIndex}\n isSelected={selectedItems.has(itemKey)}\n isSelecting={selectedItems.size > 0}\n itemKey={itemKey}\n key={`${rowIndex}-${itemKey}`}\n onClick={(event) => {\n void onRowClick({\n event,\n index: rowIndex,\n item: document,\n })\n }}\n onKeyDown={(event) => {\n void onRowPress({\n event,\n index: rowIndex,\n item: document,\n })\n }}\n />\n )\n }),\n ]}\n />\n )\n}\n"],"mapp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"version":3,"file":"index.js","names":["c","_c","getTranslation","extractID","React","DocumentIcon","useConfig","useFolder","useTranslation","formatDate","ColoredFolderIcon","DraggableTableRow","SimpleTable","TableHeader","baseClass","FolderFileTable","t0","$","showRelationCell","t1","undefined","documents","focusedRowIndex","isDragging","onItemClick","onItemKeyPress","selectedItemKeys","subfolders","config","i18n","t","t2","map","collections","forEach","collection","slug","labels","singular","relationToMap","useState","t3","columnsToShow","name","label","push","columns","t4","t5","subfolder","rowIndex","itemKey","relationTo","value","subfolderID","_jsx","t6","index","name_0","cellValue","_folderOrDocumentTitle","pattern","admin","dateFormat","_jsxs","className","children","disabled","has","dragData","id","type","isDroppable","isFocused","isSelected","isSelecting","size","onClick","event","item","onKeyDown","event_0","length","document","unadjustedIndex","itemKey_0","relationTo_0","value_0","documentID","rowIndex_0","t7","index_0","name_1","cellValue_0","event_1","event_2","headerCells","_temp","tableRows"],"sources":["../../../../src/elements/FolderView/FolderFileTable/index.tsx"],"sourcesContent":["'use client'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { extractID } from 'payload/shared'\nimport React from 'react'\n\nimport { DocumentIcon } from '../../../icons/Document/index.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useFolder } from '../../../providers/Folders/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport { formatDate } from '../../../utilities/formatDocTitle/formatDateTitle.js'\nimport { ColoredFolderIcon } from '../ColoredFolderIcon/index.js'\nimport { DraggableTableRow } from '../DraggableTableRow/index.js'\nimport { SimpleTable, TableHeader } from '../SimpleTable/index.js'\nimport './index.scss'\n\nconst baseClass = 'folder-file-table'\n\ntype Props = {\n showRelationCell?: boolean\n}\n\nexport function FolderFileTable({ showRelationCell = true }: Props) {\n const {\n documents,\n focusedRowIndex,\n isDragging,\n onItemClick,\n onItemKeyPress,\n selectedItemKeys,\n subfolders,\n } = useFolder()\n const { config } = useConfig()\n const { i18n, t } = useTranslation()\n\n const [relationToMap] = React.useState(() => {\n const map: Record<string, string> = {}\n config.collections.forEach((collection) => {\n map[collection.slug] = getTranslation(collection.labels?.singular, i18n)\n })\n return map\n })\n\n const [columns] = React.useState(() => {\n const columnsToShow = [\n {\n name: 'name',\n label: t('general:name'),\n },\n {\n name: 'createdAt',\n label: t('general:createdAt'),\n },\n {\n name: 'updatedAt',\n label: t('general:updatedAt'),\n },\n ]\n\n if (showRelationCell) {\n columnsToShow.push({\n name: 'type',\n label: t('version:type'),\n })\n }\n\n return columnsToShow\n })\n\n return (\n <SimpleTable\n headerCells={columns.map(({ name, label }) => (\n <TableHeader key={name}>{label}</TableHeader>\n ))}\n tableRows={[\n ...subfolders.map((subfolder, rowIndex) => {\n const { itemKey, relationTo, value } = subfolder\n const subfolderID = extractID(value)\n\n return (\n <DraggableTableRow\n columns={columns.map(({ name }, index) => {\n let cellValue: React.ReactNode = '—'\n if (name === 'name' && value._folderOrDocumentTitle !== undefined) {\n cellValue = value._folderOrDocumentTitle\n }\n\n if ((name === 'createdAt' || name === 'updatedAt') && value[name]) {\n cellValue = formatDate({\n date: value[name],\n i18n,\n pattern: config.admin.dateFormat,\n })\n }\n\n if (name === 'type') {\n cellValue = relationToMap[relationTo] || relationTo\n }\n\n if (index === 0) {\n return (\n <span className={`${baseClass}__cell-with-icon`} key={`${itemKey}-${name}`}>\n <ColoredFolderIcon />\n {cellValue}\n </span>\n )\n } else {\n return cellValue\n }\n })}\n disabled={isDragging && selectedItemKeys?.has(itemKey)}\n dragData={{\n id: subfolderID,\n type: 'folder',\n }}\n id={subfolderID}\n isDroppable\n isFocused={focusedRowIndex === rowIndex}\n isSelected={selectedItemKeys.has(itemKey)}\n isSelecting={selectedItemKeys.size > 0}\n itemKey={itemKey}\n key={`${rowIndex}-${itemKey}`}\n onClick={(event) => {\n void onItemClick({\n event,\n index: rowIndex,\n item: subfolder,\n })\n }}\n onKeyDown={(event) => {\n void onItemKeyPress({\n event,\n index: rowIndex,\n item: subfolder,\n })\n }}\n />\n )\n }),\n\n ...documents.map((document, unadjustedIndex) => {\n const { itemKey, relationTo, value } = document\n const documentID = extractID(value)\n const rowIndex = unadjustedIndex + subfolders.length\n\n return (\n <DraggableTableRow\n columns={columns.map(({ name }, index) => {\n let cellValue: React.ReactNode = '—'\n if (name === 'name' && value._folderOrDocumentTitle !== undefined) {\n cellValue = value._folderOrDocumentTitle\n }\n\n if ((name === 'createdAt' || name === 'updatedAt') && value[name]) {\n cellValue = formatDate({\n date: value[name],\n i18n,\n pattern: config.admin.dateFormat,\n })\n }\n\n if (name === 'type') {\n cellValue = relationToMap[relationTo] || relationTo\n }\n\n if (index === 0) {\n return (\n <span className={`${baseClass}__cell-with-icon`} key={`${itemKey}-${name}`}>\n <DocumentIcon />\n {cellValue}\n </span>\n )\n } else {\n return cellValue\n }\n })}\n disabled={isDragging || selectedItemKeys?.has(itemKey)}\n dragData={{\n id: documentID,\n type: 'document',\n }}\n id={documentID}\n isFocused={focusedRowIndex === rowIndex}\n isSelected={selectedItemKeys.has(itemKey)}\n isSelecting={selectedItemKeys.size > 0}\n itemKey={itemKey}\n key={`${rowIndex}-${itemKey}`}\n onClick={(event) => {\n void onItemClick({\n event,\n index: rowIndex,\n item: document,\n })\n }}\n onKeyDown={(event) => {\n void onItemKeyPress({\n event,\n index: rowIndex,\n item: document,\n })\n }}\n />\n )\n }),\n ]}\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAC1B,OAAOC,KAAA,MAAW;AAElB,SAASC,YAAY,QAAQ;AAC7B,SAASC,SAAS,QAAQ;AAC1B,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,WAAW,EAAEC,WAAW,QAAQ;AACzC,OAAO;AAEP,MAAMC,SAAA,GAAY;AAMlB,OAAO,S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tE,cAAA;cAAAqD,KAAA,EACHA,OAAA;cAAArB,KAAA,EACOP,UAAA;cAAA6B,IAAA,EACDI;YAAA,CACR;UAAA;QAAA,GAbG,GAAGjC,UAAA,IAAYC,SAAA,EAAS;MAAA;MAiBnClC,CAAA,OAAA6B,OAAA;MAAA7B,CAAA,OAAAW,MAAA;MAAAX,CAAA,OAAAK,eAAA;MAAAL,CAAA,OAAAY,IAAA;MAAAZ,CAAA,OAAAM,UAAA;MAAAN,CAAA,OAAAO,WAAA;MAAAP,CAAA,OAAAQ,cAAA;MAAAR,CAAA,OAAAsB,aAAA;MAAAtB,CAAA,OAAAS,gBAAA;MAAAT,CAAA,OAAAU,UAAA,CAAAuD,MAAA;MAAAjE,CAAA,OAAAuC,EAAA;IAAA;MAAAA,EAAA,GAAAvC,CAAA;IAAA;IArIJ8B,EAAA,GAAAQ,IAAA,CAAA3C,WAAA;MAAAoF,WAAA,EACelD,OAAA,CAAAd,GAAA,CAAAiE,KACO;MAAAC,SAAA,MAGfvE,UAAA,CAAAK,GAAA,CAAegB,EA+DlB,MAEG3B,SAAA,CAAAW,GAAA,CAAcwB,EA+DjB;IAAA,C;;;;;;;;;;;;;;;;SArIJT,E;;AAhDG,SAAAkD,MAAAjF,EAAA;EAiDyB;IAAA2B,IAAA;IAAAC;EAAA,IAAA5B,EAAe;EAAA,OACvCuC,IAAA,CAAA1C,WAAA;IAAAqD,QAAA,EAAyBtB;EAAA,GAAPD,IAAA;AAAA","ignoreList":[]}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FolderOrDocument } from 'payload/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import './index.scss';
|
|
4
4
|
type ItemCardGridProps = {
|
|
5
|
-
disabledItemKeys?: Set<FolderDocumentItemKey>;
|
|
6
5
|
items: FolderOrDocument[];
|
|
7
|
-
RenderActionGroup?: (args: {
|
|
8
|
-
index: number;
|
|
9
|
-
item: FolderOrDocument;
|
|
10
|
-
}) => React.ReactNode;
|
|
11
|
-
selectedItemKeys: Set<FolderDocumentItemKey>;
|
|
12
6
|
title?: string;
|
|
13
7
|
} & ({
|
|
14
8
|
subfolderCount: number;
|
|
@@ -17,6 +11,6 @@ type ItemCardGridProps = {
|
|
|
17
11
|
subfolderCount?: never;
|
|
18
12
|
type: 'folder';
|
|
19
13
|
});
|
|
20
|
-
export declare function ItemCardGrid({ type,
|
|
14
|
+
export declare function ItemCardGrid({ type, items, subfolderCount, title }: ItemCardGridProps): React.JSX.Element;
|
|
21
15
|
export {};
|
|
22
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/FolderView/ItemCardGrid/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/FolderView/ItemCardGrid/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,cAAc,CAAA;AAIrB,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,gBAAgB,EAAE,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,CACA;IACE,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;CACb,GACD;IACE,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,IAAI,EAAE,QAAQ,CAAA;CACf,CACJ,CAAA;AACD,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,iBAAiB,qBAgBrF"}
|
|
@@ -1,100 +1,34 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { c as _c } from "react/compiler-runtime";
|
|
4
3
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
4
|
import React from 'react';
|
|
6
|
-
import {
|
|
7
|
-
import { FolderFileCard } from '../FolderFileCard/index.js';
|
|
5
|
+
import { ContextFolderFileCard } from '../FolderFileCard/index.js';
|
|
8
6
|
import './index.scss';
|
|
9
7
|
const baseClass = 'item-card-grid';
|
|
10
|
-
export function ItemCardGrid(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
subfolderCount,
|
|
19
|
-
title
|
|
20
|
-
} = t0;
|
|
21
|
-
const {
|
|
22
|
-
focusedRowIndex,
|
|
23
|
-
isDragging,
|
|
24
|
-
onItemClick,
|
|
25
|
-
onItemKeyPress,
|
|
26
|
-
selectedIndexes
|
|
27
|
-
} = useFolder();
|
|
28
|
-
let t1;
|
|
29
|
-
if ($[0] !== title) {
|
|
30
|
-
t1 = title && _jsx("p", {
|
|
8
|
+
export function ItemCardGrid({
|
|
9
|
+
type,
|
|
10
|
+
items,
|
|
11
|
+
subfolderCount,
|
|
12
|
+
title
|
|
13
|
+
}) {
|
|
14
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
15
|
+
children: [title && /*#__PURE__*/_jsx("p", {
|
|
31
16
|
className: `${baseClass}__title`,
|
|
32
17
|
children: title
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
value
|
|
49
|
-
} = item;
|
|
50
|
-
return _jsx(FolderFileCard, {
|
|
51
|
-
disabled: isDragging && selectedItemKeys.has(itemKey) || disabledItemKeys?.has(itemKey),
|
|
52
|
-
id: value.id,
|
|
53
|
-
isFocused: focusedRowIndex === index,
|
|
54
|
-
isSelected: selectedItemKeys.has(itemKey),
|
|
55
|
-
itemKey,
|
|
56
|
-
onClick: event => {
|
|
57
|
-
onItemClick({
|
|
58
|
-
event,
|
|
59
|
-
index,
|
|
60
|
-
item
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
onKeyDown: event_0 => {
|
|
64
|
-
onItemKeyPress({
|
|
65
|
-
event: event_0,
|
|
66
|
-
index,
|
|
67
|
-
item
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
PopupActions: RenderActionGroup ? RenderActionGroup({
|
|
71
|
-
index,
|
|
72
|
-
item
|
|
73
|
-
}) : null,
|
|
74
|
-
previewUrl: value?.url,
|
|
75
|
-
selectedCount: selectedIndexes.size,
|
|
76
|
-
title: value._folderOrDocumentTitle,
|
|
77
|
-
type
|
|
78
|
-
}, itemKey);
|
|
79
|
-
})
|
|
80
|
-
})]
|
|
81
|
-
});
|
|
82
|
-
$[2] = RenderActionGroup;
|
|
83
|
-
$[3] = disabledItemKeys;
|
|
84
|
-
$[4] = focusedRowIndex;
|
|
85
|
-
$[5] = isDragging;
|
|
86
|
-
$[6] = items;
|
|
87
|
-
$[7] = onItemClick;
|
|
88
|
-
$[8] = onItemKeyPress;
|
|
89
|
-
$[9] = selectedIndexes;
|
|
90
|
-
$[10] = selectedItemKeys;
|
|
91
|
-
$[11] = subfolderCount;
|
|
92
|
-
$[12] = t1;
|
|
93
|
-
$[13] = type;
|
|
94
|
-
$[14] = t2;
|
|
95
|
-
} else {
|
|
96
|
-
t2 = $[14];
|
|
97
|
-
}
|
|
98
|
-
return t2;
|
|
18
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
19
|
+
className: baseClass,
|
|
20
|
+
children: !items || items?.length === 0 ? null : items.map((item, _index) => {
|
|
21
|
+
const index = _index + (subfolderCount || 0);
|
|
22
|
+
const {
|
|
23
|
+
itemKey
|
|
24
|
+
} = item;
|
|
25
|
+
return /*#__PURE__*/_jsx(ContextFolderFileCard, {
|
|
26
|
+
index: index,
|
|
27
|
+
item: item,
|
|
28
|
+
type: type
|
|
29
|
+
}, itemKey);
|
|
30
|
+
})
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
99
33
|
}
|
|
100
34
|
//# sourceMappingURL=index.js.map
|