@opengis/cms 0.0.12 → 0.0.13
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/cms.js +3518 -3375
- package/dist/cms.umd.cjs +12 -12
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/server/routes/site/controllers/listMedia.js +23 -10
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.draggable-item[data-v-
|
|
1
|
+
.draggable-item[data-v-b98f5b2f]{cursor:move;-webkit-user-select:none;user-select:none;padding:4px;transition:all .2s ease;border-radius:6px;border:2px solid transparent;position:relative;z-index:1}.draggable-item[data-v-b98f5b2f]:hover{background-color:#f3f4f6}.draggable-item.drag-over[data-v-b98f5b2f]{background-color:#e0f2fe;border-color:#3b82f6;box-shadow:0 0 0 2px #3b82f633;transform:scale(1.02)}.draggable-item.dragging[data-v-b98f5b2f]{opacity:.5;background-color:#dbeafe;border-color:#3b82f6}.draggable-item button[data-v-b98f5b2f]{position:relative;z-index:2}.drop-zone[data-v-b98f5b2f]{height:4px;margin-bottom:4px;transition:all .2s ease}.drop-zone-active[data-v-b98f5b2f]{background-color:#3b82f6;transform:scale(1.01)}.root-drag-over[data-v-8b028afb]{border-color:#3b82f6;background-color:#dbeafe;box-shadow:0 0 0 4px #3b82f633;transform:scale(1.01)}
|
package/package.json
CHANGED
|
@@ -35,26 +35,39 @@ export default async function listMedia(req, reply) {
|
|
|
35
35
|
[relpath],
|
|
36
36
|
);
|
|
37
37
|
|
|
38
|
-
if (!rows.length && false) {
|
|
39
|
-
return { data: [], relpath, msg: 'empty rows' };
|
|
40
|
-
}
|
|
41
|
-
|
|
42
38
|
const isDirectory = (await stat(dirpath)).isDirectory();
|
|
43
39
|
|
|
44
40
|
const items = isDirectory ? await readdir(dirpath, { withFileTypes: true }) : [];
|
|
45
41
|
|
|
42
|
+
const subdirs = items
|
|
43
|
+
.filter(el => el.isDirectory())
|
|
44
|
+
.map(el => ({ type: 'dir', name: el.name }));
|
|
45
|
+
|
|
46
|
+
if (subdirs.length) {
|
|
47
|
+
await Promise.all(subdirs.map(async (item) => {
|
|
48
|
+
const items = isDirectory ? await readdir(path.join(dirpath, item.name)) : [];
|
|
49
|
+
Object.assign(item, { count: items.length });
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const result = { relpath, data: rows.concat(subdirs) };
|
|
54
|
+
|
|
55
|
+
if (config.debug) {
|
|
56
|
+
Object.assign(result, { rootDir });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!rows.length) {
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
|
|
46
63
|
rows.forEach(row => Object.assign(row, {
|
|
64
|
+
type: 'file',
|
|
47
65
|
url: `${req.routeOptions.url}/${row.id}/file`,
|
|
48
66
|
filepath: row.url,
|
|
67
|
+
name: row.filename,
|
|
49
68
|
metadata: `${req.routeOptions.url}/${row.id}`,
|
|
50
69
|
exists: !!items.find(el => el.isFile() && el.name === path.basename(row.url))
|
|
51
70
|
}));
|
|
52
71
|
|
|
53
|
-
const result = { relpath, data: rows };
|
|
54
|
-
|
|
55
|
-
if (config.debug) {
|
|
56
|
-
Object.assign(result, { rootDir });
|
|
57
|
-
}
|
|
58
|
-
|
|
59
72
|
return result;
|
|
60
73
|
}
|