adminforth 1.1.47 → 1.1.49
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/modules/codeInjector.js +13 -22
- package/dist/modules/styleGenerator.js +39 -0
- package/dist/modules/styles.js +84 -53
- package/dist/modules/utils.js +44 -0
- package/dist/spa/spa/index.html +1 -1
- package/dist/spa/spa/src/App.vue +16 -16
- package/dist/spa/spa/src/components/MenuLink.vue +3 -3
- package/dist/spa/spa/src/components/ResourceForm.vue +3 -3
- package/dist/spa/spa/src/components/ResourceListTable.vue +7 -64
- package/dist/spa/spa/src/components/SkeleteLoader.vue +23 -0
- package/dist/spa/spa/src/views/ListView.vue +1 -1
- package/dist/spa/spa/src/views/ShowView.vue +3 -3
- package/dist/spa/spa/tailwind.config.js +3 -1
- package/modules/codeInjector.ts +10 -18
- package/modules/styleGenerator.ts +45 -0
- package/modules/styles.ts +95 -48
- package/modules/utils.ts +48 -0
- package/package.json +1 -1
- package/spa/index.html +1 -1
- package/spa/src/App.vue +16 -16
- package/spa/src/components/MenuLink.vue +3 -3
- package/spa/src/components/ResourceForm.vue +3 -3
- package/spa/src/components/ResourceListTable.vue +7 -64
- package/spa/src/components/SkeleteLoader.vue +23 -0
- package/spa/src/views/ListView.vue +1 -1
- package/spa/src/views/ShowView.vue +3 -3
- package/spa/tailwind.config.js +3 -1
- package/types/AdminForthConfig.ts +6 -4
package/modules/codeInjector.ts
CHANGED
|
@@ -7,10 +7,10 @@ import os from 'os';
|
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import { promisify } from 'util';
|
|
9
9
|
import AdminForth from '../index.js';
|
|
10
|
-
import { ADMIN_FORTH_ABSOLUTE_PATH } from './utils.js';
|
|
11
|
-
import { getComponentNameFromPath } from './utils.js';
|
|
10
|
+
import { ADMIN_FORTH_ABSOLUTE_PATH, getComponentNameFromPath, transformObject, deepMerge } from './utils.js';
|
|
12
11
|
import { styles } from './styles.js'
|
|
13
12
|
import { AdminForthComponentDeclaration, CodeInjectorType } from '../types/AdminForthConfig.js';
|
|
13
|
+
import { StylesGenerator } from './styleGenerator.js';
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -290,8 +290,6 @@ class CodeInjector implements CodeInjectorType {
|
|
|
290
290
|
});
|
|
291
291
|
});
|
|
292
292
|
});
|
|
293
|
-
|
|
294
|
-
|
|
295
293
|
});
|
|
296
294
|
|
|
297
295
|
customResourceComponents.forEach((filePath) => {
|
|
@@ -340,20 +338,14 @@ class CodeInjector implements CodeInjectorType {
|
|
|
340
338
|
}
|
|
341
339
|
await fs.promises.writeFile(appVuePath, appVueContent);
|
|
342
340
|
|
|
343
|
-
// generate tailwind extend styles
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
} else {
|
|
352
|
-
let tailwindConfigPath = path.join(CodeInjector.SPA_TMP_PATH, 'tailwind.config.js');
|
|
353
|
-
let tailwindConfigContent = await fs.promises.readFile(tailwindConfigPath, 'utf-8');
|
|
354
|
-
tailwindConfigContent = tailwindConfigContent.replace('/* IMPORTANT:ADMINFORTH TAILWIND STYLES */',styles());
|
|
355
|
-
await fs.promises.writeFile(tailwindConfigPath, tailwindConfigContent);
|
|
356
|
-
}
|
|
341
|
+
// generate tailwind extend styles
|
|
342
|
+
const stylesGenerator = new StylesGenerator(this.adminforth.config.customization?.styles);
|
|
343
|
+
const stylesText = JSON.stringify(stylesGenerator.mergeStyles(), null, 2).slice(1, -1);
|
|
344
|
+
let tailwindConfigPath = path.join(CodeInjector.SPA_TMP_PATH, 'tailwind.config.js');
|
|
345
|
+
let tailwindConfigContent = await fs.promises.readFile(tailwindConfigPath, 'utf-8');
|
|
346
|
+
tailwindConfigContent = tailwindConfigContent.replace('/* IMPORTANT:ADMINFORTH TAILWIND STYLES */', stylesText);
|
|
347
|
+
await fs.promises.writeFile(tailwindConfigPath, tailwindConfigContent);
|
|
348
|
+
|
|
357
349
|
|
|
358
350
|
const routerVuePath = path.join(CodeInjector.SPA_TMP_PATH, 'src', 'router', 'index.ts');
|
|
359
351
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { transformObject,deepMerge } from "./utils.js";
|
|
2
|
+
import { styles } from "./styles.js";
|
|
3
|
+
|
|
4
|
+
const aliasObject ={ lightSidebarText:'lightSidebarIcons',darkSidebarText:'darkSidebarIcons',lightSidebarTextHover:'lightSidebarIconsHover',darkSidebarTextHover:'darkSidebarIconsHover'}
|
|
5
|
+
|
|
6
|
+
export class StylesGenerator {
|
|
7
|
+
styleConfig: any;
|
|
8
|
+
defaultStyles: any;
|
|
9
|
+
|
|
10
|
+
constructor(styleConfig: any) {
|
|
11
|
+
if (!styleConfig) {
|
|
12
|
+
console.log("No styles provided using default styles.");
|
|
13
|
+
}
|
|
14
|
+
this.styleConfig = styleConfig;
|
|
15
|
+
this.defaultStyles = styles();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private generatePlainStyles(styleObj:any) {
|
|
19
|
+
let plainCustomStyles = {}
|
|
20
|
+
if (styleObj) {
|
|
21
|
+
Object.keys(styleObj).forEach((k)=>{
|
|
22
|
+
plainCustomStyles[k] = transformObject(styleObj[k])
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
return plainCustomStyles;
|
|
26
|
+
}
|
|
27
|
+
private changeAliases(plateStyles: any) {
|
|
28
|
+
if (!plateStyles || !plateStyles.colors) {
|
|
29
|
+
return plateStyles;
|
|
30
|
+
}
|
|
31
|
+
let colors = plateStyles.colors;
|
|
32
|
+
Object.keys(aliasObject).forEach((aliasName) => {
|
|
33
|
+
if (colors[aliasObject[aliasName]]) return;
|
|
34
|
+
if (!colors[aliasName]) return;
|
|
35
|
+
colors[aliasObject[aliasName]] = colors[aliasName];
|
|
36
|
+
})
|
|
37
|
+
return plateStyles;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
mergeStyles() {
|
|
41
|
+
let mergedStyles = deepMerge(this.defaultStyles, this.changeAliases(this.generatePlainStyles(this.styleConfig)));
|
|
42
|
+
return mergedStyles;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
package/modules/styles.ts
CHANGED
|
@@ -1,53 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export const styles = () => ({
|
|
4
|
+
colors: {
|
|
5
|
+
lightHtml: "#FFFFFF", // main background
|
|
6
|
+
|
|
7
|
+
lightNavbar: "#FFFFFF", // navbar background
|
|
8
|
+
lightNavbarHover: "#D3D3D3", // in development
|
|
9
|
+
lightNavbarText: "#333333", // in development
|
|
10
|
+
lightNavbarTextHover: "#333333", // in development
|
|
11
|
+
lightNavbarIcons: "#333333", // in development
|
|
12
|
+
lightNavbarIconsHover: "#333333", // in development
|
|
13
|
+
lightNavbarLogo: "#333333", // in development
|
|
14
|
+
lightNavbarBorder: "rgb(229 231 235)", // border
|
|
15
|
+
|
|
16
|
+
lightSidebar: "#ffffff", // sidebar background
|
|
17
|
+
lightSidebarBorder: "rgb(229 231 235)", // sidebar right border
|
|
18
|
+
lightSidebarHover: "rgb(243 244 246)", // in development
|
|
19
|
+
lightSidebarActive: "rgb(233, 234, 236)", // in development
|
|
20
|
+
lightSidebarItemHover: "rgb(243 244 246)", // sidebar list item hover
|
|
21
|
+
lightSidebarItemActive: "rgb(233, 234, 236)", // sidebar list item active
|
|
22
|
+
lightSidebarText: "#4b5563", // sidebar list item text
|
|
23
|
+
lightSidebarTextHover: "#333333", // sidebar list item text hover
|
|
24
|
+
lightSidebarTextActive: "#333333", // sidebar list item text active
|
|
25
|
+
lightSidebarDevider: "#E0E0E0", // sidebar devider
|
|
26
|
+
lightSidebarIcons: "#6b7280", // sidebar list item icons
|
|
27
|
+
lightSidebarIconsHover: "#333333", // sidebar list item icons hover
|
|
28
|
+
lightSidebarHeading: "#333333", // sidebar heading
|
|
29
|
+
|
|
30
|
+
lightList: "#FFFFFF", // list view background
|
|
31
|
+
lightListTable: "#FFFFFF", // list view table background
|
|
32
|
+
lightListTableHeading: "rgb(249 250 251)", // list view table heading
|
|
33
|
+
lightListTableHeadingText: "#333333", // list view table heading text
|
|
34
|
+
lightListTableText: "#333333", // list view table text
|
|
35
|
+
lightListTableRowHover: "rgb(249 250 251)", // list view row hover
|
|
36
|
+
lightListBreadcrumbsText: "#666666", // list view breadcrumbs text
|
|
37
|
+
lightListBorder: "#DDDDDD", // list view rows border
|
|
38
|
+
|
|
39
|
+
lightForm: "#FFFFFF", // show view background
|
|
40
|
+
lightFormBorder: "#F5F5F5", // show view rows border
|
|
41
|
+
lightFormHeading: "#EDEDED", // show view heading
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
// colors for dark theme
|
|
45
|
+
darkHtml: "#111827",
|
|
46
|
+
|
|
47
|
+
darkNavbar: "#111827",
|
|
48
|
+
darkNavbarHover: "#444444",
|
|
49
|
+
darkNavbarText: "#FFFFFF",
|
|
50
|
+
darkNavbarTextHover: "#FFFFFF",
|
|
51
|
+
darkNavbarIcons: "#FFFFFF",
|
|
52
|
+
darkNavbarIconsHover: "#FFFFFF",
|
|
53
|
+
darkNavbarLogo: "#FFFFFF",
|
|
54
|
+
darkNavbarBorder: "#e5e7eb",
|
|
55
|
+
|
|
56
|
+
darkSidebar: "#1f2937",
|
|
57
|
+
darkSidebarBorder: "#374151",
|
|
58
|
+
darkSidebarHover: "#374151",
|
|
59
|
+
darkSidebarActive: "#444444",
|
|
60
|
+
darkSidebarItemHover: "#374151",
|
|
61
|
+
darkSidebarItemActive: "#52525b",
|
|
62
|
+
darkSidebarItemActiveText: "#FFFFFF",
|
|
63
|
+
darkSidebarText: "#9ca3af",
|
|
64
|
+
darkSidebarTextHover: "#FFFFFF",
|
|
65
|
+
darkSidebarTextActive: "#FFFFFF",
|
|
66
|
+
darkSidebarDevider: "#374151",
|
|
67
|
+
darkSidebarIcons: "#9ca3af",
|
|
68
|
+
darkSidebarIconsHover: "#FFFFFF",
|
|
69
|
+
darkSidebarHeading: "#FFFFFF",
|
|
70
|
+
|
|
71
|
+
darkList: "#111111",
|
|
72
|
+
darkListTable: "#1f2937",
|
|
73
|
+
darkListTableHeading: "#334155",
|
|
74
|
+
darkListTableHeadingText: "#9ca3af",
|
|
75
|
+
darkListTableText: "#9ca3af",
|
|
76
|
+
darkListTableRowHover: "#4b5563",
|
|
77
|
+
darkListBreadcrumbsText: "#BBBBBB",
|
|
78
|
+
darkListBorder: "#444444",
|
|
79
|
+
|
|
80
|
+
darkForm: "#111111",
|
|
81
|
+
darkFormBorder: "#222222",
|
|
82
|
+
darkFormHeading: "#333333"
|
|
83
|
+
|
|
40
84
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
85
|
+
boxShadow: {
|
|
86
|
+
customLight: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
|
|
87
|
+
headerShadow: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
|
|
88
|
+
listTableShadow: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow
|
|
89
|
+
resourseFormShadow: "0 4px 8px rgba(0, 0, 0, 0.1)" // Lighter shadow
|
|
46
90
|
},
|
|
47
|
-
|
|
48
|
-
"
|
|
91
|
+
fontSize: {
|
|
92
|
+
"headerText-size": "1rem"
|
|
49
93
|
},
|
|
50
|
-
|
|
94
|
+
borderRadius: {
|
|
51
95
|
"default": "2px"
|
|
52
96
|
}
|
|
53
|
-
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
package/modules/utils.ts
CHANGED
|
@@ -36,4 +36,52 @@ export function getComponentNameFromPath(filePath) {
|
|
|
36
36
|
|
|
37
37
|
export function listify(param?: Array<Function>) {
|
|
38
38
|
return param || [];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function deepMerge(target, source) {
|
|
42
|
+
if (typeof target !== 'object' || target === null) {
|
|
43
|
+
return source;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (let key in source) {
|
|
47
|
+
if (source.hasOwnProperty(key)) {
|
|
48
|
+
if (typeof source[key] === 'object' && source[key] !== null) {
|
|
49
|
+
if (!target[key]) {
|
|
50
|
+
target[key] = {};
|
|
51
|
+
}
|
|
52
|
+
deepMerge(target[key], source[key]);
|
|
53
|
+
} else {
|
|
54
|
+
target[key] = source[key];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return target;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function toCamelCase(str) {
|
|
63
|
+
return str.replace(/[-_](.)/g, (_, char) => char.toUpperCase());
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function transformObject(obj, parentKey = '', result = {}) {
|
|
67
|
+
for (const key in obj) {
|
|
68
|
+
if (obj.hasOwnProperty(key)) {
|
|
69
|
+
const camelCaseKey = toCamelCase(parentKey ? `${parentKey}_${key}` : key);
|
|
70
|
+
if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
|
|
71
|
+
transformObject(obj[key], camelCaseKey, result);
|
|
72
|
+
} else {
|
|
73
|
+
result[camelCaseKey] = obj[key];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//remove 'Default' from keys
|
|
78
|
+
for (const key in result) {
|
|
79
|
+
if (key.includes('Main')) {
|
|
80
|
+
const newKey = key.replace('Main', '');
|
|
81
|
+
result[newKey] = result[key];
|
|
82
|
+
delete result[key];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return result;
|
|
39
87
|
}
|
package/package.json
CHANGED
package/spa/index.html
CHANGED
package/spa/src/App.vue
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<nav
|
|
3
3
|
v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady"
|
|
4
|
-
class="fixed h-14 top-0 z-20 w-full border-b shadow-sm bg-
|
|
4
|
+
class="fixed h-14 top-0 z-20 w-full border-b shadow-sm bg-lightNavbar shadow-headerShadow dark:bg-darkNavbar dark:border-darkSidebarDevider">
|
|
5
5
|
<div class="px-3 py-3 lg:px-5 lg:pl-3">
|
|
6
6
|
<div class="flex items-center justify-between">
|
|
7
7
|
<div class="flex items-center justify-start rtl:justify-end">
|
|
8
8
|
<button @click="sideBarOpen = !sideBarOpen"
|
|
9
|
-
type="button" class="inline-flex items-center p-2 text-sm rounded-lg sm:hidden hover:bg-
|
|
9
|
+
type="button" class="inline-flex items-center p-2 text-sm rounded-lg sm:hidden hover:bg-lightSidebarItemHover focus:outline-none focus:ring-2 focus:ring-lightSidebarDevider dark:text-darkSidebarIcons dark:hover:bg-darkSidebarHover dark:focus:ring-lightSidebarDevider">
|
|
10
10
|
<span class="sr-only">Open sidebar</span>
|
|
11
11
|
<svg class="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
|
12
12
|
<path clip-rule="evenodd" fill-rule="evenodd" d="M2 4.75A.75.75 0 012.75 4h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 4.75zm0 10.5a.75.75 0 01.75-.75h7.5a.75.75 0 010 1.5h-7.5a.75.75 0 01-.75-.75zM2 10a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 10z"></path>
|
|
@@ -17,25 +17,25 @@
|
|
|
17
17
|
<div class="flex items-center">
|
|
18
18
|
<div class="flex items-center ms-3 ">
|
|
19
19
|
<div>
|
|
20
|
-
<button type="button" class="flex text-sm bg-
|
|
20
|
+
<button type="button" class="flex text-sm bg- rounded-full focus:ring-4 focus:ring-lightSidebarDevider dark:focus:ring-darkSidebarDevider dark:bg-" aria-expanded="false" data-dropdown-toggle="dropdown-user">
|
|
21
21
|
<span class="sr-only">Open user menu</span>
|
|
22
|
-
<svg class="w-8 h-8 text-
|
|
22
|
+
<svg class="w-8 h-8 text-lightSidebarIcons dark:text-darkSidebarIcons" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
|
|
23
23
|
<path fill-rule="evenodd" d="M12 20a7.966 7.966 0 0 1-5.002-1.756l.002.001v-.683c0-1.794 1.492-3.25 3.333-3.25h3.334c1.84 0 3.333 1.456 3.333 3.25v.683A7.966 7.966 0 0 1 12 20ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10c0 5.5-4.44 9.963-9.932 10h-.138C6.438 21.962 2 17.5 2 12Zm10-5c-1.84 0-3.333 1.455-3.333 3.25S10.159 13.5 12 13.5c1.84 0 3.333-1.455 3.333-3.25S13.841 7 12 7Z" clip-rule="evenodd"/>
|
|
24
24
|
</svg>
|
|
25
25
|
</button>
|
|
26
26
|
</div>
|
|
27
|
-
<div class="z-50 hidden my-4 text-base list-none bg-white divide-y divide-gray-100 rounded shadow dark:shadow-black dark:bg-
|
|
27
|
+
<div class="z-50 hidden my-4 text-base list-none bg-white divide-y divide-gray-100 rounded shadow dark:shadow-black dark:bg-darkSidebar dark:divide-darkSidebarDevider dark:shadow-black" id="dropdown-user">
|
|
28
28
|
<div class="px-4 py-3" role="none">
|
|
29
|
-
<p class="text-sm text-gray-900 dark:text-
|
|
29
|
+
<p class="text-sm text-gray-900 dark:text-darkNavbarText" role="none" v-if="coreStore.userFullname">
|
|
30
30
|
{{ coreStore.userFullname }}
|
|
31
31
|
</p>
|
|
32
|
-
<p class="text-sm font-medium text-gray-900 truncate dark:text-
|
|
32
|
+
<p class="text-sm font-medium text-gray-900 truncate dark:text-darkSidebarText" role="none">
|
|
33
33
|
{{ coreStore.username }}
|
|
34
34
|
</p>
|
|
35
35
|
</div>
|
|
36
36
|
<ul class="py-1" role="none">
|
|
37
37
|
<li>
|
|
38
|
-
<span @click="toggleTheme" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black hover:bg-
|
|
38
|
+
<span @click="toggleTheme" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black hover:bg-lightHtml dark:text-darkSidebarTextHover dark:hover:bg-darkHtml dark:hover:text-darkSidebarTextActive" role="menuitem">
|
|
39
39
|
{{ theme === 'dark' ? 'Light' : 'Dark' }}
|
|
40
40
|
<IconMoonSolid class="w-5 h-5 text-blue-300" v-if="theme !== 'dark'" />
|
|
41
41
|
<IconSunSolid class="w-5 h-5 text-yellow-300" v-else />
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
</span>
|
|
44
44
|
</li>
|
|
45
45
|
<li>
|
|
46
|
-
<button @click="logout" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black hover:bg-html
|
|
46
|
+
<button @click="logout" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black hover:bg-html dark:text-darkSidebarTextHover dark:hover:bg-darkSidebarItemHover dark:hover:text-darkSidebarTextActive w-full" role="menuitem">Sign out</button>
|
|
47
47
|
</li>
|
|
48
48
|
</ul>
|
|
49
49
|
</div>
|
|
@@ -59,30 +59,30 @@
|
|
|
59
59
|
|
|
60
60
|
v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady"
|
|
61
61
|
|
|
62
|
-
id="logo-
|
|
62
|
+
id="logo-lightSidebar" class="fixed bg-lightSidebar border-none top-0 left-0 z-20 w-64 h-screen transition-transform bg-lightSidebar dark:bg-darkSidebar border-r border-lightSidebarBorder sm:translate-x-0 dark:bg-darkSidebar dark:border-darkSidebarBorder"
|
|
63
63
|
:class="{ '-translate-x-full': !sideBarOpen, 'transform-none': sideBarOpen }"
|
|
64
64
|
aria-label="Sidebar"
|
|
65
65
|
>
|
|
66
|
-
<div class="h-full px-3 pb-4 overflow-y-auto bg-
|
|
66
|
+
<div class="h-full px-3 pb-4 overflow-y-auto bg-lightSidebar dark:bg-darkSidebar border-r dark:border-darkSidebarBorder">
|
|
67
67
|
<div class="flex ms-2 md:me-24 m-4 ">
|
|
68
68
|
<img :src="loadFile(coreStore.config?.brandLogo || '@/assets/logo.svg')" :alt="`${ coreStore.config?.brandName } Logo`" class="h-8 me-3" />
|
|
69
|
-
<span class="self-center text-
|
|
69
|
+
<span class="self-center text-lightNavbarText-size font-semibold sm:text-lightNavbarText-size whitespace-nowrap dark:text-darkNavbarText text-lightNavbarLogo">
|
|
70
70
|
{{ coreStore.config?.brandName }}
|
|
71
71
|
</span>
|
|
72
72
|
</div>
|
|
73
73
|
|
|
74
74
|
<ul class="space-y-2 font-medium">
|
|
75
75
|
<template v-for="(item, i) in coreStore.menu" :key="`menu-${i}`">
|
|
76
|
-
<div v-if="item.type === 'divider'" class="border-t border-
|
|
76
|
+
<div v-if="item.type === 'divider'" class="border-t border-lightSidebarDevider dark:border-darkSidebarDevider"></div>
|
|
77
77
|
<div v-else-if="item.type === 'gap'" class="flex items-center justify-center h-8"></div>
|
|
78
78
|
<div v-else-if="item.type === 'heading'" class="flex items-center justify-left pl-2 h-8 text-gray-400 dark:text-gray-400
|
|
79
79
|
">{{ item.label }}</div>
|
|
80
|
-
<li v-else-if="item.children">
|
|
81
|
-
<button @click="clickOnMenuItem(i)" type="button" class="flex items-center w-full p-2 text-base text-
|
|
80
|
+
<li v-else-if="item.children" class=" ">
|
|
81
|
+
<button @click="clickOnMenuItem(i)" type="button" class="flex items-center w-full p-2 text-base text-lightSidebarText rounded-default transition duration-75 group hover:bg-lightSidebarItemHover hover:text-lightSidebarTextHover dark:text-darkSidebarText dark:hover:bg-darkSidebarHover dark:hover:text-darkSidebarTextHover"
|
|
82
82
|
:aria-controls="`dropdown-example${i}`"
|
|
83
83
|
:data-collapse-toggle="`dropdown-example${i}`"
|
|
84
84
|
>
|
|
85
|
-
<component v-if="item.icon" :is="getIcon(item.icon)" class="w-5 h-5 text-
|
|
85
|
+
<component v-if="item.icon" :is="getIcon(item.icon)" class="w-5 h-5 text-lightSidebarIcons group-hover:text-lightSidebarIconsHover transition duration-75 dark:group-hover:text-darkSidebarIconsHover dark:text-darkSidebarIcons" ></component>
|
|
86
86
|
|
|
87
87
|
<span class="flex-1 ms-3 text-left rtl:text-right whitespace-nowrap">{{ item.label }}</span>
|
|
88
88
|
<svg :class="{'rotate-180': opened.includes(i) }" class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<RouterLink
|
|
3
3
|
:to="{name: item.resourceId ? 'resource-list' : item.path, params: item.resourceId ? { resourceId: item.resourceId }: {}}"
|
|
4
|
-
class="flex items-center py-2 text-
|
|
4
|
+
class="flex group items-center py-2 text-lightSidebarText dark:text-darkSidebarText rounded-default hover:bg-lightSidebarItemHover hover:text-lightSidebarTextHover dark:hover:bg-darkSidebarHover dark:hover:text-darkSidebarTextHover active:bg-lightSidebarActive dark:active:bg-darkSidebarHover" role="menuitem"
|
|
5
5
|
:class="{
|
|
6
6
|
'px-4': isChild,
|
|
7
7
|
'px-2': !isChild,
|
|
8
|
-
'bg-
|
|
8
|
+
'bg-sidebarActive dark:bg-gray-700': item.resourceId ?
|
|
9
9
|
($route.params.resourceId === item.resourceId && $route.name === 'resource-list') :
|
|
10
10
|
($route.name === item.path)
|
|
11
11
|
}"
|
|
12
12
|
>
|
|
13
|
-
<component v-if="item.icon" :is="getIcon(item.icon)" class="w-5 h-5 text-
|
|
13
|
+
<component v-if="item.icon" :is="getIcon(item.icon)" class="w-5 h-5 text-lightSidebarIcons dark:text-darkSidebarIcons transition duration-75 group-hover:text-lightSidebarIconsHover dark:group-hover:text-darkSidebarIconsHover" ></component>
|
|
14
14
|
<span class="ms-3">{{ item.label }}</span>
|
|
15
15
|
</RouterLink>
|
|
16
16
|
</template>
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
<div class="rounded-default">
|
|
3
3
|
|
|
4
4
|
<div
|
|
5
|
-
class="relative shadow-
|
|
5
|
+
class="relative shadow-resourseFormShadow sm:rounded-lg dark:shadow-2xl dark:shadow-black rounded-default"
|
|
6
6
|
>
|
|
7
7
|
<form autocomplete="off" @submit.prevent>
|
|
8
8
|
<table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 ">
|
|
9
|
-
<thead class="text-xs text-gray-700 uppercase bg-
|
|
9
|
+
<thead class="text-xs text-gray-700 uppercase bg-lightormHeading dark:bg-gray-700 dark:text-gray-400">
|
|
10
10
|
<tr>
|
|
11
11
|
<th scope="col" class="px-6 py-3">
|
|
12
12
|
Field
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
</thead>
|
|
19
19
|
<tbody>
|
|
20
20
|
<tr v-for="column, i in editableColumns" :key="column.name"
|
|
21
|
-
class="bg-
|
|
21
|
+
class="bg-ligftForm dark:bg-gray-800 border-b dark:border-gray-700"
|
|
22
22
|
>
|
|
23
23
|
<!-- if column is in customComponentsPerColumn, use this component. If not, use this code -->
|
|
24
24
|
<template v-if="column?.components?.[props.source].file">
|
|
@@ -1,30 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- table -->
|
|
3
|
-
<div class="relative overflow-x-auto shadow-
|
|
3
|
+
<div class="relative overflow-x-auto shadow-listTableShadow dark:shadow-black overflow-y-hidden rounded-default">
|
|
4
4
|
|
|
5
5
|
<!-- skelet loader -->
|
|
6
6
|
<div role="status" v-if="!resource || !resource.columns"
|
|
7
7
|
class="max-w p-4 space-y-4 divide-y divide-gray-200 rounded shadow animate-pulse dark:divide-gray-700 md:p-6 dark:border-gray-700">
|
|
8
|
-
|
|
9
|
-
<div>
|
|
10
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
11
|
-
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
12
|
-
</div>
|
|
13
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
<div class="flex items-center justify-between h-16 pt-4" v-for="i in new Array(10)">
|
|
17
|
-
<div>
|
|
18
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
19
|
-
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
20
|
-
</div>
|
|
21
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
22
|
-
</div>
|
|
23
|
-
<span class="sr-only">Loading...</span>
|
|
8
|
+
|
|
24
9
|
</div>
|
|
25
10
|
|
|
26
11
|
<table v-else class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 rounded-default">
|
|
27
|
-
<thead class="text-xs text-view-table-heading-text bg-
|
|
12
|
+
<thead class="text-xs text-view-table-heading-text bg-lightListTableHeading dark:bg-darkListTableHeading dark:text-gray-400">
|
|
28
13
|
<tr>
|
|
29
14
|
<th scope="col" class="p-4">
|
|
30
15
|
<div v-if="rows && rows.length" class="flex items-center">
|
|
@@ -69,51 +54,8 @@
|
|
|
69
54
|
</tr>
|
|
70
55
|
</thead>
|
|
71
56
|
<tbody>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<div role="status"
|
|
76
|
-
class="max-w p-4 space-y-4 divide-y divide-gray-200 rounded animate-pulse dark:divide-gray-700 md:p-6 dark:border-gray-700">
|
|
77
|
-
<div class="flex items-center justify-between">
|
|
78
|
-
<div>
|
|
79
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
80
|
-
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
81
|
-
</div>
|
|
82
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
83
|
-
</div>
|
|
84
|
-
<div class="flex items-center justify-between pt-4">
|
|
85
|
-
<div>
|
|
86
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
87
|
-
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
88
|
-
</div>
|
|
89
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
90
|
-
</div>
|
|
91
|
-
<div class="flex items-center justify-between pt-4">
|
|
92
|
-
<div>
|
|
93
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
94
|
-
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
95
|
-
</div>
|
|
96
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
97
|
-
</div>
|
|
98
|
-
<div class="flex items-center justify-between pt-4">
|
|
99
|
-
<div>
|
|
100
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
101
|
-
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
102
|
-
</div>
|
|
103
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
104
|
-
</div>
|
|
105
|
-
<div class="flex items-center justify-between pt-4">
|
|
106
|
-
<div>
|
|
107
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
108
|
-
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
109
|
-
</div>
|
|
110
|
-
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
111
|
-
</div>
|
|
112
|
-
<span class="sr-only">Loading...</span>
|
|
113
|
-
</div>
|
|
114
|
-
</td>
|
|
115
|
-
</tr>
|
|
116
|
-
<tr v-else-if="rows.length === 0" class="bg-list-view-table-bg border-b dark:bg-gray-800 dark:border-gray-700">
|
|
57
|
+
<SkeleteLoader v-if="!rows?.length" :columns="10" :rows="10"/>
|
|
58
|
+
<tr v-else-if="rows.length === 0" class="bg-lightListTable border-b dark:bg-darkListTable dark:border-darkListTableBorder">
|
|
117
59
|
<td :colspan="resource?.columns.length + 2">
|
|
118
60
|
|
|
119
61
|
<div id="toast-simple"
|
|
@@ -127,7 +69,7 @@
|
|
|
127
69
|
</tr>
|
|
128
70
|
|
|
129
71
|
<tr @click="onClick($event,row)" v-else v-for="(row, rowI) in rows" :key="row.id"
|
|
130
|
-
class="bg-
|
|
72
|
+
class="bg-lightListTable border-b dark:bg-darkListTable border-lightListBorder dark:border-gray-700 hover:bg-lightListTableRowHover dark:hover:bg-darkListTableRowHover cursor-pointer">
|
|
131
73
|
<td class="w-4 p-4 cursor-default" @click="(e)=>{e.stopPropagation()}">
|
|
132
74
|
<div class="flex items center ">
|
|
133
75
|
<input
|
|
@@ -287,6 +229,7 @@ import ValueRenderer from '@/components/ValueRenderer.vue';
|
|
|
287
229
|
import { getCustomComponent } from '@/utils';
|
|
288
230
|
import { useCoreStore } from '@/stores/core';
|
|
289
231
|
import { showSuccesTost } from '@/composables/useFrontendApi';
|
|
232
|
+
import SkeleteLoader from '@/components/SkeleteLoader.vue';
|
|
290
233
|
|
|
291
234
|
import {
|
|
292
235
|
IconInboxOutline,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tr v-for="c in new Array(props.columns)" class="bg-lightListTable border-b dark:bg-darkListTable dark:border-darkListBorder">
|
|
3
|
+
<td v-for="r in new Array(props.rows)" class="items-center px-6 py-20 cursor-default" >
|
|
4
|
+
<div role="status" class="max-w-sm animate-pulse">
|
|
5
|
+
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px]"></div>
|
|
6
|
+
</div>
|
|
7
|
+
</td>
|
|
8
|
+
</tr>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup>
|
|
12
|
+
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
columns:Number,
|
|
15
|
+
rows:Number
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<style lang="scss" scoped>
|
|
22
|
+
|
|
23
|
+
</style>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
v-if="checkboxes.length"
|
|
23
23
|
data-tooltip-target="tooltip-remove-all"
|
|
24
24
|
data-tooltip-placement="bottom"
|
|
25
|
-
class="flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-
|
|
25
|
+
class="flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-darkListTable dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 rounded-default"
|
|
26
26
|
>
|
|
27
27
|
<IconBanOutline class="w-5 h-5 "/>
|
|
28
28
|
|