@iservice365/layer-common 0.0.4 → 0.0.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 0.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 07a1941: chore: adjust navigation drawer and header
8
+
3
9
  ## 0.0.4
4
10
 
5
11
  ### Patch Changes
@@ -1,23 +1,6 @@
1
1
  <template>
2
2
  <v-app-bar scroll-behavior="elevate" scroll-threshold="200">
3
- <div style="width: 264px" class="ml-2">
4
- <v-app-bar-nav-icon @click="drawer = !drawer"></v-app-bar-nav-icon>
5
- </div>
6
-
7
- <v-row no-gutters>
8
- <v-col cols="6">
9
- <v-text-field
10
- v-model="search"
11
- width="100%"
12
- prepend-inner-icon="mdi-magnify"
13
- variant="solo-filled"
14
- flat
15
- density="comfortable"
16
- hide-details
17
- rounded="xl"
18
- />
19
- </v-col>
20
- </v-row>
3
+ <v-app-bar-nav-icon @click="drawer = !drawer"></v-app-bar-nav-icon>
21
4
 
22
5
  <template #append>
23
6
  <v-btn
@@ -94,13 +77,15 @@
94
77
  <script setup lang="ts">
95
78
  import { useTheme } from "vuetify";
96
79
 
80
+ const menu = defineModel("menu", { type: Boolean });
81
+
97
82
  const search = defineModel("search", { type: String });
98
83
 
99
84
  const { drawer } = useLocal();
100
85
 
101
86
  const { redirect } = useUtils();
102
87
 
103
- const { APP_ACCOUNT, APP_NAME, APP_NAME_ROUTE } = useRuntimeConfig().public;
88
+ const { APP_ACCOUNT, APP_NAME } = useRuntimeConfig().public;
104
89
 
105
90
  const theme = useTheme();
106
91
 
@@ -1,45 +1,34 @@
1
1
  <template>
2
- <v-navigation-drawer
3
- v-model="drawer"
4
- permanent
5
- floating
6
- class="pr-2 bg-primary"
7
- >
2
+ <v-navigation-drawer v-model="drawer" permanent floating class="bg-primary">
8
3
  <v-list>
9
4
  <v-list-item>
10
- <v-list-item-content>
11
- <v-list-item-title class="text-h6 text-white">
12
- {{ APP_NAME }}
13
- </v-list-item-title>
14
- </v-list-item-content>
5
+ <v-list-item-title class="text-h6 text-white">
6
+ {{ APP_NAME }}
7
+ </v-list-item-title>
15
8
  </v-list-item>
16
9
  <slot name="action" />
17
10
  <template
18
11
  v-for="(navigationItem, navigationIndex) in props.navigationItems"
19
- :key="`${navigationItem.route.name}-${navigationIndex}`"
12
+ :key="`${navigationItem.title}-${navigationIndex}`"
20
13
  >
21
14
  <NavigationItem
15
+ v-if="navigationItem.route && navigationItem.route.name"
22
16
  :title="navigationItem.title"
23
17
  :icon="navigationItem.icon"
24
18
  :route="navigationItem.route"
25
19
  :children="navigationItem.children"
26
20
  />
27
- </template>
28
21
 
29
- <v-list-subheader>
30
- <span class="font-weight-bold text-white">iService365 Services</span>
31
- </v-list-subheader>
32
- <template
33
- v-for="(service, serviceIndex) in services"
34
- :key="`${service.id}-${serviceIndex}`"
35
- >
36
22
  <NavigationItem
37
- :name="`${service.id}-${serviceIndex}`"
38
- :title="service.title"
39
- :icon="service.icon"
40
- :link="service.link"
23
+ v-else-if="navigationItem.link"
24
+ :title="navigationItem.title"
25
+ :icon="navigationItem.icon"
26
+ :link="navigationItem.link"
27
+ :children="navigationItem.children"
41
28
  />
42
29
  </template>
30
+
31
+ <slot name="services"> </slot>
43
32
  </v-list>
44
33
  </v-navigation-drawer>
45
34
  </template>
@@ -51,40 +40,5 @@ const props = defineProps({
51
40
 
52
41
  const { drawer } = useLocal();
53
42
 
54
- const {
55
- APP_NAME,
56
- APP_SECURITY,
57
- APP_HYGIENE,
58
- APP_PROPERTY_MANAGEMENT,
59
- APP_MECHANICAL_ELECTRICAL,
60
- } = useRuntimeConfig().public;
61
-
62
- const services = computed(() => {
63
- return [
64
- {
65
- id: "security",
66
- title: "Security",
67
- icon: "mdi-shield",
68
- link: APP_SECURITY,
69
- },
70
- {
71
- id: "hygiene",
72
- title: "Hygiene",
73
- icon: "mdi-spray-bottle",
74
- link: APP_HYGIENE,
75
- },
76
- {
77
- id: "property-management",
78
- title: "Property Management",
79
- icon: "mdi-home-city-outline",
80
- link: APP_PROPERTY_MANAGEMENT,
81
- },
82
- {
83
- id: "mechanical-electrical",
84
- title: "Mechanical & Electrical",
85
- icon: "mdi-tools",
86
- link: APP_MECHANICAL_ELECTRICAL,
87
- },
88
- ];
89
- });
43
+ const { APP_NAME } = useRuntimeConfig().public;
90
44
  </script>
@@ -1,12 +1,7 @@
1
1
  <template>
2
2
  <v-list-group v-if="children && children.length">
3
3
  <template #activator="{ props }">
4
- <v-list-item
5
- v-bind="props"
6
- :prepend-icon="icon"
7
- rounded="e-pill"
8
- class="text-subtitle-2"
9
- >
4
+ <v-list-item v-bind="props" :prepend-icon="icon" class="text-subtitle-2">
10
5
  {{ title }}
11
6
  </v-list-item>
12
7
  </template>
@@ -22,11 +17,10 @@
22
17
  </v-list-group>
23
18
 
24
19
  <v-list-item
25
- v-if="props.route.name"
20
+ v-if="props.route && props.route.name"
26
21
  :key="props.name"
27
22
  :prepend-icon="icon"
28
23
  :to="props.route"
29
- rounded="e-pill"
30
24
  class="text-subtitle-2"
31
25
  >
32
26
  {{ title }}
@@ -37,7 +31,6 @@
37
31
  :key="props.name"
38
32
  :prepend-icon="icon"
39
33
  :href="props.link"
40
- rounded="e-pill"
41
34
  class="text-subtitle-2"
42
35
  >
43
36
  {{ title }}
@@ -57,9 +50,9 @@ const props = defineProps({
57
50
  default: "",
58
51
  },
59
52
  route: {
60
- type: Object,
53
+ type: Object as PropType<Record<string, any>>,
61
54
  default() {
62
- return { name: "", params: {} };
55
+ return { name: "" };
63
56
  },
64
57
  },
65
58
  link: {
@@ -0,0 +1,86 @@
1
+ <template>
2
+ <v-menu
3
+ v-model="menu"
4
+ location="bottom"
5
+ offset="5px"
6
+ :close-on-content-click="false"
7
+ >
8
+ <template #activator="{ props }">
9
+ <v-list>
10
+ <v-list-item
11
+ v-bind="props"
12
+ :key="props.title"
13
+ :prepend-icon="prop.icon"
14
+ append-icon="mdi-chevron-down"
15
+ :to="props.route"
16
+ class="text-subtitle-2 font-weight-bold"
17
+ >
18
+ Select {{ prop.title }}
19
+ </v-list-item>
20
+ </v-list>
21
+ </template>
22
+
23
+ <v-card width="300px" rounded="lg" class="pa-4">
24
+ <span class="text-subtitle-2 font-weight-bold">
25
+ Switch {{ prop.title }} context
26
+ </span>
27
+ <v-text-field density="compact" width="100%" hide-details class="mb-2">
28
+ <template #prepend-inner>
29
+ <v-icon>mdi-magnify</v-icon>
30
+ </template>
31
+ </v-text-field>
32
+ <v-divider />
33
+ <v-list class="pa-0 my-2" density="compact" max-height="200px">
34
+ <v-list-item
35
+ density="compact"
36
+ class="text-caption font-weight-bold"
37
+ v-for="item in prop.items"
38
+ :key="item.value"
39
+ @click="emit('click:switch', item.value)"
40
+ >
41
+ <v-icon size="16" class="mr-2">
42
+ {{ prop.selected === item.value ? "mdi-check" : "" }}
43
+ </v-icon>
44
+
45
+ {{ item.text }}
46
+ </v-list-item>
47
+ </v-list>
48
+
49
+ <slot name="footer"></slot>
50
+ </v-card>
51
+ </v-menu>
52
+ </template>
53
+
54
+ <script setup lang="ts">
55
+ const prop = defineProps({
56
+ title: {
57
+ type: String,
58
+ required: true,
59
+ default: "app",
60
+ },
61
+ items: {
62
+ type: Array as PropType<Array<Record<string, any>>>,
63
+ required: false,
64
+ default: () => [],
65
+ },
66
+ selected: {
67
+ type: String,
68
+ required: false,
69
+ default: "",
70
+ },
71
+ icon: {
72
+ type: String,
73
+ required: false,
74
+ default: "mdi-domain",
75
+ },
76
+ logo: {
77
+ type: String,
78
+ required: false,
79
+ default: "",
80
+ },
81
+ });
82
+
83
+ const emit = defineEmits(["click:switch"]);
84
+
85
+ const menu = defineModel<boolean>({ required: false, default: false });
86
+ </script>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@iservice365/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "0.0.4",
5
+ "version": "0.0.5",
6
6
  "main": "./nuxt.config.ts",
7
7
  "publishConfig": {
8
8
  "access": "public"
package/types/local.d.ts CHANGED
@@ -32,6 +32,7 @@ declare type TNavigationItem = {
32
32
  title: string;
33
33
  icon?: string;
34
34
  route?: TNavigationRoute;
35
+ link?: string;
35
36
  children?: TNavigationItem[];
36
37
  };
37
38