@opengis/admin 0.1.52 → 0.1.54
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{add-page-D3Thmccd.js → add-page-DTF2UYpa.js} +1 -1
- package/dist/{admin-interface-mBxwmjkA.js → admin-interface-CAxK1XOD.js} +2 -2
- package/dist/{admin-view-Cu4fu-mJ.js → admin-view-C9ImK2sO.js} +1 -1
- package/dist/admin.js +1 -1
- package/dist/admin.umd.cjs +51 -51
- package/dist/{card-page-Csfrh5xr.js → card-page-2mrzfvH7.js} +8 -8
- package/dist/{card-view-BaO818Yt.js → card-view-D8biFeBR.js} +1 -1
- package/dist/{edit-page-BlkwSxqs.js → edit-page-C97TQRUy.js} +1 -1
- package/dist/{import-file-DUlLgT0y.js → import-file-BNnG8cW-.js} +5244 -5235
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/plugin.js +1 -1
- package/server/routes/calendar/controllers/calendar.data.js +89 -0
- package/server/routes/calendar/index.mjs +17 -0
- package/server/routes/data/controllers/tableData.js +0 -4
- package/server/routes/data/schema.js +1 -2
- package/server/routes/menu/controllers/getMenu.js +0 -1
- package/utils.js +11 -40
package/dist/style.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.map-popup__vertical[data-v-3f5a9aff]{overflow:auto;max-height:300px}.map-popup__vertical[data-v-3f5a9aff]::-webkit-scrollbar{width:6px;height:6px;background-color:#f5f5f5}.map-popup__vertical[data-v-3f5a9aff]::-webkit-scrollbar-thumb{border-radius:5px;background-color:#dedede}.map-popup__vertical[data-v-3f5a9aff]::-webkit-scrollbar-track{background-color:#f5f5f5}.map__popup-body[data-v-3f5a9aff]{table-layout:fixed;width:100%}.map__popup-body-item[data-v-3f5a9aff]:not(:last-child){border-bottom:1px solid #eeeeee}.map__popup-body-item td[data-v-3f5a9aff]{width:50%;word-wrap:break-word;text-align:start}.map__popup-body-item td[data-v-3f5a9aff]:first-child{font-weight:600}.popup-image[data-v-deb51e0a]{max-width:100%;max-height:220px;margin-bottom:10px;-o-object-fit:contain;object-fit:contain}.maplibregl-ctrl-bottom-right,.maplibregl-popup-close-button{display:none}.widget-file .vs-button{background-color:#2563eb;color:#fff;font-size:.875rem;line-height:1.25rem;font-weight:600}.ui-dialog__modal div.flex.justify-between.items-center.py-3.px-4.border-b{border-bottom-width:0px;--tw-text-opacity: 1;color:#1f2937;font-weight:500;font-size:1.125rem;line-height:1.75rem;padding-bottom:0rem}.ui-dialog__modal .ui-dialog__content .p-4{padding-top:0rem}.widget-images__item-desc span:first-child:after{content:"";width:2px;height:2px;border-radius:50%;display:flex;align-items:center;background:#676a6c;margin:0 5px}.disabled{cursor:not-allowed!important}.item__text-content,.item{transition:all .5s cubic-bezier(.4,0,.2,1)}.item:hover .item__text-content{opacity:.8}.vs-widget-images .vs-button{background-color:#2563eb;color:#fff;font-size:.875rem;line-height:1.25rem;font-weight:600}.ProseMirror-focused{outline:none}.editor-toolbar{background-color:#f9fafb}.editor-content{min-height:160px}button{transition:background-color .2s ease;outline:none}button:focus{outline:none}.editor-content ul{margin-left:20px}.editor-content ul>li{list-style:disc}.editor-content ol{list-style-type:decimal;margin-left:20px}.editor-content pre{background-color:#e7e7e7;border-radius:4px;padding:0 2px}.mention-popup{background-color:#fafafa;padding:10px;border-radius:10px;box-shadow:0 4px 6px #0000001a;max-width:200px;overflow-y:auto;width:auto}.mention{padding:2px 4px;border-radius:8px;background-color:#e7e7e7}.mention-option{padding:5px 10px;cursor:pointer;transition:background-color .2s;border-radius:8px}.mention-option:hover{background-color:#f0f0f0}.border-top:not(:first-child){--tw-border-opacity: 1;border-color:#e5e7eb;border-top-width:1px}.widget-comment-form .vs-button{padding:.625rem 1rem;font-size:.75rem;line-height:1rem;font-weight:500}.widget-comment-form .vs-button:focus{border:transparent;--tw-ring-opacity: 1;--tw-ring-color: rgb(191 219 254);--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 rgba(0, 0, 0, 0))}li[data-v-95b2773a]{cursor:move}.grid[data-v-
|
1
|
+
.vs-popover>div{text-align:start}.map-popup__vertical[data-v-3f5a9aff]{overflow:auto;max-height:300px}.map-popup__vertical[data-v-3f5a9aff]::-webkit-scrollbar{width:6px;height:6px;background-color:#f5f5f5}.map-popup__vertical[data-v-3f5a9aff]::-webkit-scrollbar-thumb{border-radius:5px;background-color:#dedede}.map-popup__vertical[data-v-3f5a9aff]::-webkit-scrollbar-track{background-color:#f5f5f5}.map__popup-body[data-v-3f5a9aff]{table-layout:fixed;width:100%}.map__popup-body-item[data-v-3f5a9aff]:not(:last-child){border-bottom:1px solid #eeeeee}.map__popup-body-item td[data-v-3f5a9aff]{width:50%;word-wrap:break-word;text-align:start}.map__popup-body-item td[data-v-3f5a9aff]:first-child{font-weight:600}.popup-image[data-v-deb51e0a]{max-width:100%;max-height:220px;margin-bottom:10px;-o-object-fit:contain;object-fit:contain}.maplibregl-ctrl-bottom-right,.maplibregl-popup-close-button{display:none}.widget-file .vs-button{background-color:#2563eb;color:#fff;font-size:.875rem;line-height:1.25rem;font-weight:600}.ui-dialog__modal div.flex.justify-between.items-center.py-3.px-4.border-b{border-bottom-width:0px;--tw-text-opacity: 1;color:#1f2937;font-weight:500;font-size:1.125rem;line-height:1.75rem;padding-bottom:0rem}.ui-dialog__modal .ui-dialog__content .p-4{padding-top:0rem}.widget-images__item-desc span:first-child:after{content:"";width:2px;height:2px;border-radius:50%;display:flex;align-items:center;background:#676a6c;margin:0 5px}.disabled{cursor:not-allowed!important}.item__text-content,.item{transition:all .5s cubic-bezier(.4,0,.2,1)}.item:hover .item__text-content{opacity:.8}.vs-widget-images .vs-button{background-color:#2563eb;color:#fff;font-size:.875rem;line-height:1.25rem;font-weight:600}.ProseMirror-focused{outline:none}.editor-toolbar{background-color:#f9fafb}.editor-content{min-height:160px}button{transition:background-color .2s ease;outline:none}button:focus{outline:none}.editor-content ul{margin-left:20px}.editor-content ul>li{list-style:disc}.editor-content ol{list-style-type:decimal;margin-left:20px}.editor-content pre{background-color:#e7e7e7;border-radius:4px;padding:0 2px}.mention-popup{background-color:#fafafa;padding:10px;border-radius:10px;box-shadow:0 4px 6px #0000001a;max-width:200px;overflow-y:auto;width:auto}.mention{padding:2px 4px;border-radius:8px;background-color:#e7e7e7}.mention-option{padding:5px 10px;cursor:pointer;transition:background-color .2s;border-radius:8px}.mention-option:hover{background-color:#f0f0f0}.border-top:not(:first-child){--tw-border-opacity: 1;border-color:#e5e7eb;border-top-width:1px}.widget-comment-form .vs-button{padding:.625rem 1rem;font-size:.75rem;line-height:1rem;font-weight:500}.widget-comment-form .vs-button:focus{border:transparent;--tw-ring-opacity: 1;--tw-ring-color: rgb(191 219 254);--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 rgba(0, 0, 0, 0))}li[data-v-95b2773a]{cursor:move}.grid[data-v-ed2cfe89]{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:1rem}.admin-wrapper[data-v-e777119e]{display:flex;height:100vh;align-items:start}.vs-popover__content>div{padding:.25rem}.hs-accordion-heading[data-v-4139bc00]{display:flex;align-items:center}.hs-accordion-toggle[data-v-4139bc00]{cursor:pointer}.hs-accordion-content[data-v-4139bc00]{padding-left:1.5rem}.table-info-card .editor-container{min-width:200px;width:270px}.slide-fade-enter-active[data-v-bbbe9039],.slide-fade-leave-active[data-v-bbbe9039]{transition:all .3s linear}.slide-fade-enter-from[data-v-bbbe9039],.slide-fade-leave-to[data-v-bbbe9039]{transform:translate(20px);opacity:0}
|
package/package.json
CHANGED
package/plugin.js
CHANGED
@@ -2,7 +2,6 @@ import fp from 'fastify-plugin';
|
|
2
2
|
import path from 'node:path';
|
3
3
|
|
4
4
|
import { addHook, getTemplatePath, getTemplate, pgClients } from '@opengis/fastify-table/utils.js';
|
5
|
-
// import { addHook, getTemplatePath, getTemplate, pgClients } from './utils.js'; // test!
|
6
5
|
|
7
6
|
import config from './config.js';
|
8
7
|
import getMenu from './server/routes/menu/controllers/getMenu.js';
|
@@ -154,6 +153,7 @@ async function plugin(fastify, opts = config) {
|
|
154
153
|
// API
|
155
154
|
|
156
155
|
fastify.register(import('./server/routes/properties/index.mjs'), opts);
|
156
|
+
fastify.register(import('./server/routes/calendar/index.mjs'), opts);
|
157
157
|
fastify.register(import('./server/routes/notifications/index.mjs'), opts);
|
158
158
|
fastify.register(import('./server/routes/templates/index.mjs'), opts);
|
159
159
|
fastify.register(import('./server/routes/menu/index.mjs'), opts);
|
@@ -0,0 +1,89 @@
|
|
1
|
+
import { /* getSelectVal, */ getMeta, getTemplate } from '@opengis/fastify-table/utils.js';
|
2
|
+
|
3
|
+
export default async function calendarData({
|
4
|
+
pg, funcs, params = {}, query = {}, session = {},
|
5
|
+
}) {
|
6
|
+
const { name } = params;
|
7
|
+
const { uid } = session.passport?.user || {};
|
8
|
+
if (!name) {
|
9
|
+
return { message: 'not enough params: name', status: 400 };
|
10
|
+
}
|
11
|
+
const { date, sql } = query;
|
12
|
+
|
13
|
+
try {
|
14
|
+
const body = await getTemplate('calendar', name);
|
15
|
+
|
16
|
+
if (!body) {
|
17
|
+
return { message: `calendar not found: ${name}`, status: 404 };
|
18
|
+
}
|
19
|
+
|
20
|
+
const {
|
21
|
+
title,
|
22
|
+
table,
|
23
|
+
query: query1 = '1=1',
|
24
|
+
meta = {},
|
25
|
+
filter = [],
|
26
|
+
} = body;
|
27
|
+
|
28
|
+
if (!table) {
|
29
|
+
return { message: 'not enough calendar params: table', status: 404 };
|
30
|
+
}
|
31
|
+
if (!pg.pk?.[table]) {
|
32
|
+
return { message: `table pkey not found: ${table}`, status: 404 };
|
33
|
+
}
|
34
|
+
|
35
|
+
const filterWhere = filter?.length && query.filter?.length
|
36
|
+
? filter.filter((el) => (Object.hasOwn(el, 'enabled') ? el?.enabled : true))
|
37
|
+
.map((el) => {
|
38
|
+
const val = query.filter.split(',').find((e) => e?.split('=')?.shift()?.includes(el.column || el.name))?.split('=')?.pop();
|
39
|
+
if (val) return el.column && val ? `(${[`${el.column}::text='${val.replace(/'/g,"''")}'::text`, el.query].filter((el) => el).join(' and ')})` : el.query;
|
40
|
+
}).filter((el) => el).join(' and ')
|
41
|
+
: undefined;
|
42
|
+
// console.log(filterWhere);
|
43
|
+
|
44
|
+
const queryWhere = await funcs.handlebars.compile(query1)({ uid });
|
45
|
+
const filterDate = date ? `date_trunc('month', "${meta?.date || meta?.start}"::date)='${date}'::date` : undefined;
|
46
|
+
const where = [queryWhere, filterDate, filterWhere].filter((el) => el).join(' and ');
|
47
|
+
|
48
|
+
const filtersByColumn = filter.filter((el) => (Object.hasOwn(el, 'enabled') ? el?.enabled : true) && el?.column);
|
49
|
+
|
50
|
+
const filters = [];
|
51
|
+
if (filtersByColumn?.length) {
|
52
|
+
await Promise.all(filtersByColumn.map(async (el) => {
|
53
|
+
const { rows: filterData = [] } = await pg.query(`select "${el.column}" as id, count(*) from ${table}
|
54
|
+
where ${el.query || '1=1'} and ${filterWhere || '1=1'} group by "${el.column}"`);
|
55
|
+
if (!filterData?.length) return;
|
56
|
+
|
57
|
+
// const clsData = await getSelectVal({ pg, name: el.cls, values: filterData.map((el) => el.id) });
|
58
|
+
const clsData = el.cls ? await getTemplate(['cls', 'select'], el.cls) : undefined;
|
59
|
+
|
60
|
+
if (!el.cls) {
|
61
|
+
filterData.forEach((el1) => filters.push(el1));
|
62
|
+
return;
|
63
|
+
}
|
64
|
+
|
65
|
+
filterData.forEach((el1) => {
|
66
|
+
const cls = clsData.find((item) => item.id === el1.id.toString());
|
67
|
+
Object.assign(el1, { title: cls?.text, color: cls?.color });
|
68
|
+
filters.push(el1);
|
69
|
+
});
|
70
|
+
}));
|
71
|
+
}
|
72
|
+
|
73
|
+
const tableMeta = await getMeta({ pg, table });
|
74
|
+
const columnList = tableMeta?.columns?.map((el) => el?.name);
|
75
|
+
const columns = Object.keys(meta).filter((el) => ['date', 'start','end','title','status'].includes(el) && columnList.includes(meta[el])).map((el) => `"${meta[el]}" as ${el}`);
|
76
|
+
|
77
|
+
if (!columns?.length) {
|
78
|
+
return { message: `calendar param meta is invalid: invalid/empty keys`, status: 404 };
|
79
|
+
}
|
80
|
+
|
81
|
+
const q = `select ${columns.join(',')} from ${table} where ${where}`;
|
82
|
+
if (sql) return q;
|
83
|
+
|
84
|
+
const { rows = [] } = await pg.query(q);
|
85
|
+
return { title, filters, rows };
|
86
|
+
} catch (err) {
|
87
|
+
return { error: err.toString(), status: 500 };
|
88
|
+
}
|
89
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import calendarData from "./controllers/calendar.data.js";
|
2
|
+
|
3
|
+
const schema = {
|
4
|
+
query: {
|
5
|
+
type: 'object',
|
6
|
+
properties: {
|
7
|
+
date: {
|
8
|
+
type: 'string',
|
9
|
+
format: 'date',
|
10
|
+
},
|
11
|
+
},
|
12
|
+
},
|
13
|
+
};
|
14
|
+
|
15
|
+
export default async function route(fastify) {
|
16
|
+
fastify.get('/calendar/:name', { schema }, calendarData);
|
17
|
+
}
|
@@ -2,10 +2,6 @@ import {
|
|
2
2
|
getMeta, getAccess, getTemplate, metaFormat, getSelectVal, gisIRColumn,
|
3
3
|
} from "@opengis/fastify-table/utils.js";
|
4
4
|
|
5
|
-
// import {
|
6
|
-
// getMeta, getAccess, getTemplate, metaFormat, getSelectVal, gisIRColumn,
|
7
|
-
// } from '../../../../utils.js'; // test!
|
8
|
-
|
9
5
|
import getFilterSQL from "./funcs/getFilterSQL/index.js";
|
10
6
|
|
11
7
|
import assignTokens from './utils/assignTokens.js';
|
package/utils.js
CHANGED
@@ -1,50 +1,21 @@
|
|
1
|
+
import yamlSafe from 'js-yaml';
|
2
|
+
|
1
3
|
import getSettings from './server/routes/properties/funcs/getSettings.js';
|
2
4
|
import setSettings from './server/routes/properties/funcs/setSettings.js';
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
getMeta,
|
12
|
-
getAccess,
|
13
|
-
getTemplate,
|
14
|
-
metaFormat,
|
15
|
-
getSelectVal,
|
16
|
-
gisIRColumn,
|
17
|
-
} from '@opengis/fastify-table/utils.js';
|
6
|
+
function loadSafe (yml) {
|
7
|
+
try {
|
8
|
+
return yamlSafe.load(yml);
|
9
|
+
} catch (err) {
|
10
|
+
return { error: err.toString() };
|
11
|
+
}
|
12
|
+
};
|
18
13
|
|
19
|
-
|
20
|
-
// addHook,
|
21
|
-
// getTemplatePath,
|
22
|
-
// pgClients,
|
23
|
-
// applyHook,
|
24
|
-
// userTemplateDir,
|
25
|
-
// addTemplateDir,
|
26
|
-
// getMeta,
|
27
|
-
// getAccess,
|
28
|
-
// getTemplate,
|
29
|
-
// metaFormat,
|
30
|
-
// getSelectVal,
|
31
|
-
// gisIRColumn,
|
32
|
-
// } from '../fastify-table/utils.js'; // test!
|
14
|
+
Object.assign(yamlSafe, { loadSafe });
|
33
15
|
|
34
16
|
export default null;
|
35
17
|
export {
|
36
|
-
|
37
|
-
getTemplatePath,
|
38
|
-
pgClients,
|
39
|
-
applyHook,
|
18
|
+
yamlSafe,
|
40
19
|
getSettings,
|
41
20
|
setSettings,
|
42
|
-
userTemplateDir,
|
43
|
-
addTemplateDir,
|
44
|
-
getMeta,
|
45
|
-
getAccess,
|
46
|
-
getTemplate,
|
47
|
-
metaFormat,
|
48
|
-
getSelectVal,
|
49
|
-
gisIRColumn,
|
50
21
|
};
|