@iservice365/layer-common 0.0.4 → 0.0.6

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,17 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 0.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 5251017: Enhance switch context component
8
+
9
+ ## 0.0.5
10
+
11
+ ### Patch Changes
12
+
13
+ - 07a1941: chore: adjust navigation drawer and header
14
+
3
15
  ## 0.0.4
4
16
 
5
17
  ### 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,87 @@
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 class="pa-0">
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
+ <v-list-item-title class="text-truncate">
19
+ {{ selected || `Select ${props.title}` }}
20
+ </v-list-item-title>
21
+ </v-list-item>
22
+ </v-list>
23
+ </template>
24
+
25
+ <v-card width="300px" rounded="lg" class="pa-4">
26
+ <span class="text-subtitle-2 font-weight-bold">
27
+ Switch {{ prop.title }} context
28
+ </span>
29
+ <v-text-field density="compact" width="100%" hide-details class="mb-2">
30
+ <template #prepend-inner>
31
+ <v-icon>mdi-magnify</v-icon>
32
+ </template>
33
+ </v-text-field>
34
+ <v-divider />
35
+ <v-list class="pa-0 my-2" density="compact" max-height="200px">
36
+ <v-list-item
37
+ density="compact"
38
+ class="text-caption font-weight-bold"
39
+ v-for="item in prop.items"
40
+ :key="item.value"
41
+ @click="selected = item.value"
42
+ >
43
+ <v-icon size="16" class="mr-2">
44
+ {{ selected === item.value ? "mdi-check" : "" }}
45
+ </v-icon>
46
+
47
+ {{ item.text }}
48
+ </v-list-item>
49
+ </v-list>
50
+
51
+ <slot name="footer"></slot>
52
+ </v-card>
53
+ </v-menu>
54
+ </template>
55
+
56
+ <script setup lang="ts">
57
+ const prop = defineProps({
58
+ title: {
59
+ type: String,
60
+ required: true,
61
+ default: "app",
62
+ },
63
+ items: {
64
+ type: Array as PropType<Array<Record<string, any>>>,
65
+ required: false,
66
+ default: () => [],
67
+ },
68
+ icon: {
69
+ type: String,
70
+ required: false,
71
+ default: "mdi-domain",
72
+ },
73
+ logo: {
74
+ type: String,
75
+ required: false,
76
+ default: "",
77
+ },
78
+ });
79
+
80
+ const emit = defineEmits(["click:switch"]);
81
+
82
+ const menu = defineModel<boolean>("menu", { required: false, default: false });
83
+ const selected = defineModel<string>("selected", {
84
+ required: false,
85
+ default: "",
86
+ });
87
+ </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.6",
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