mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-24 23:10:24 +02:00
[#7759] added shift+click bulk selection
This commit is contained in:
1 parent
09af56b342
commit
7964a8ce43
11 files changed
+113
-29
No files matched your search
@@ -78,18 +78,6 @@ export function pageExportCollections(route) {
|
||||
}
|
||||
}
|
||||
|
||||
function toggleSelectCollection(collection) {
|
||||
const bulkSelected = JSON.parse(JSON.stringify(data.bulkSelected));
|
||||
if (!data.bulkSelected[collection.id]) {
|
||||
bulkSelected[collection.id] = collection;
|
||||
} else {
|
||||
delete bulkSelected[collection.id];
|
||||
}
|
||||
|
||||
// reassign to trigger the getter's Object.keys
|
||||
data.bulkSelected = bulkSelected;
|
||||
}
|
||||
|
||||
return t.div(
|
||||
{
|
||||
pbEvent: "pageExportCollections",
|
||||
@@ -150,8 +138,33 @@ export function pageExportCollections(route) {
|
||||
id: checkboxId,
|
||||
type: "checkbox",
|
||||
checked: () => !!data.bulkSelected[collection.id],
|
||||
onchange: () => {
|
||||
toggleSelectCollection(collection);
|
||||
onclick: (e) => {
|
||||
e.target.__shiftKey = e.shiftKey;
|
||||
},
|
||||
onchange: (e) => {
|
||||
let bulkSelected = Object.assign({}, data.bulkSelected);
|
||||
|
||||
// range select
|
||||
if (e.target.__shiftKey) {
|
||||
e.target.__shiftKey = false;
|
||||
|
||||
app.utils.bulkSelectRange(
|
||||
data.collections,
|
||||
bulkSelected,
|
||||
collection,
|
||||
e.target.checked,
|
||||
);
|
||||
}
|
||||
|
||||
// toggle current collection
|
||||
if (e.target.checked) {
|
||||
bulkSelected[collection.id] = collection;
|
||||
} else {
|
||||
delete bulkSelected[collection.id];
|
||||
}
|
||||
|
||||
// reassign to trigger the getter's Object.keys
|
||||
data.bulkSelected = bulkSelected;
|
||||
},
|
||||
}),
|
||||
t.label({ htmlFor: checkboxId }, collection.name),
|
||||
|
||||
Reference in new issue
Block a user