@timus-networks/theme 2.4.42 → 2.4.44

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@timus-networks/theme",
3
3
  "configKey": "themeOptions",
4
- "version": "2.4.42",
4
+ "version": "2.4.44",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -11,7 +11,7 @@ const __filename = __cjs_url__.fileURLToPath(import.meta.url);
11
11
  const __dirname = __cjs_path__.dirname(__filename);
12
12
  const require = __cjs_mod__.createRequire(import.meta.url);
13
13
  const name = "@timus-networks/theme";
14
- const version = "2.4.42";
14
+ const version = "2.4.44";
15
15
  const description = "A comprehensive Nuxt.js module providing a tailored theme experience with integrated TailwindCSS support for applications.";
16
16
  const type = "module";
17
17
  const exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timus-networks/theme",
3
- "version": "2.4.42",
3
+ "version": "2.4.44",
4
4
  "description": "A comprehensive Nuxt.js module providing a tailored theme experience with integrated TailwindCSS support for applications.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,72 +0,0 @@
1
- # Path Array Documentation
2
-
3
- This document describes the `path` array, which defines routing and navigation rules for a web application.
4
-
5
- ## Structure
6
-
7
- Each object in the `path` array typically contains the following properties:
8
-
9
- - `regex`: A regular expression to match URL paths
10
- - `label`: A text label (usually a translation key) for the path
11
- - `path` (optional): A redirect path or default path
12
- - `hidden` (optional): A boolean indicating if the path should be hidden in navigation
13
- - `rest`: Additional regex to match against the remaining path
14
-
15
- ## Key Concepts
16
-
17
- 1. **Regular Expression Matching**: The `regex` property is used to match the current route. This allows for flexible and powerful route matching.
18
-
19
- 2. **Hidden Routes**: By setting `hidden: true`, you can prevent certain routes from appearing in the breadcrumb. This is useful for intermediate pages or when you want to simplify the breadcrumb trail.
20
-
21
- 3. **Custom Redirects**: The `path` property allows you to specify a custom destination when a breadcrumb item is clicked. If not specified, it defaults to the matched path.
22
-
23
- 4. **Rest Path Handling**: The `rest` property is an additional condition. It's used to match against the remaining path after the main `regex` match. This allows for more granular control over when a rule should apply.
24
-
25
- 5. **Labeling**: The `label` property specifies the translation key for the breadcrumb text. This supports internationalization.
26
-
27
- ## Usage Notes
28
-
29
- - Order matters in the `PathList`. The component will use the last matching rule it finds, so more specific rules should come later in the list.
30
-
31
- - The `regex` property can include capturing groups, which can be used to extract dynamic parts of the route (like IDs).
32
-
33
- - When using the `rest` property, the rule will only apply if both the main `regex` and the `rest` regex match.
34
-
35
- - If no matching rule is found in `PathList`, the component will automatically generate a label based on the route segments.
36
-
37
- ## Examples
38
-
39
- 1. **Basic Route**
40
-
41
- ```javascript
42
- {
43
- regex: /^\/settings$/,
44
- path: '/settings/administrators?tab=administrators',
45
- label: 'header.settings.text',
46
- }
47
- ```
48
-
49
- This will match the "/settings" route, display "Settings" (or its translation), and redirect to the administrators tab when clicked.
50
-
51
- 2. **Hidden Route**
52
-
53
- ```javascript
54
- {
55
- regex: /^\/migrations$/,
56
- hidden: true,
57
- }
58
- ```
59
-
60
- This will prevent the "/migrations" route from appearing in the breadcrumb.
61
-
62
- 3. **Dynamic Route with Rest Condition**
63
- ```javascript
64
- {
65
- regex: /^\/customers\/([A-Za-z0-9\-_]+)$/,
66
- rest: /^subscriptions$/,
67
- hidden: true,
68
- }
69
- ```
70
- This will hide the customer ID from the breadcrumb when viewing subscriptions, resulting in a cleaner "Home > Customers > Subscriptions" breadcrumb instead of "Home > Customers > [CustomerID] > Subscriptions".
71
-
72
- By carefully crafting your `PathList`, you can create intuitive and clean breadcrumb navigation for your application.
@@ -1,159 +0,0 @@
1
- <template>
2
- <div class="flex gap-4 items-center">
3
- <template v-if="false">
4
- <!-- Back butonu entegre etmek istersek bu v-if'i silmek işi çözer -->
5
- <el-button v-if="route.path !== '/'" class="isax-arrow-left outline" size="mini" @click="goBack" />
6
- </template>
7
- <el-breadcrumb separator="">
8
- <el-breadcrumb-item v-for="(crumb, index) in list" :key="index" v-bind="index < list.length - 1 ? { to: { path: crumb.path } } : {}">
9
- {{ $t(crumb.label) }}
10
- <!--{{ crumb }} Tüm Objeyi Görüntülemek İçin Bunu Kullan -->
11
- </el-breadcrumb-item>
12
- </el-breadcrumb>
13
- </div>
14
- </template>
15
-
16
- <script lang="ts">
17
- /**
18
- * tab,id,action gibi query parametrelerini alır route'un sonuna ekler ve onları da route.path gibi gösterir.
19
- * bu parametresi sadece mevcutsa eklenir. Örnek: http://localhost:3000/customers/123?tab=details
20
- * bu route'da tab=details olacak ve path'i resolve ederken ['customers', '123', 'details'] şu şekilde bir listeye dikkat edecektir.
21
- *
22
- * `hidden` ile match eden route `hidden` olarak tanimlanabilmektedir. Mesela http://localhost:3000/customers/details/123 adresinde
23
- * {regex: `^\/customers\/details$`, hidden: true} gibi bir route tanımlandığında detail ile ilgili bir route breadrump'a eklenmez. Ama öncesindeki
24
- * customers ve sonrasında 123 ile ilgili tanımlar yapıldıysa onlar eklenir (yapılmadıysa otomatik ekleyecektir).
25
- *
26
- * `rest` olarak tanımlanmışsa, match eden route'un sonrasında kalan path'a bakar ve rest ile belirtilen regex bu path ile match
27
- * ederse o zaman ister `hidden` ile gizlersiniz, isterseniz `label` ile text'ini güncellersiniz. Örneğin birbirinin benzeri 2 adet link var diyelim.
28
- * http://localhost:3000/customers/123, http://localhost:3000/customers/123/subscriptions gibi. 123 ile biten route'a bir text yazdırmak isterken
29
- * diğerinin 123'e ait path'ine bir şey yazdırmak istemiyor olabilirsiniz.
30
- * O zaman ilk route için {regex: `^\/customers\/([A-Za-z0-9\-_]+)$`, label: 'header.customers.details.text'} tanımlarken
31
- * ikincisi için {regex: `^\/customers\/([A-Za-z0-9\-_]+)$`, rest: `^\/subscriptions$`, hidden: true} demeniz yeterli olacaktır.
32
- * Rest burada ikinci bir condition gibi çalışmakadır.
33
- *
34
- * `path` ile match eden route tıklanıldığında path ile belirtilen route'a yönlendirilir. Tanımlanmazsa kendi path'ini alacaktır.
35
- *
36
- *`label` ile istediğiniz match eden route'a text verebilirsiniz.
37
- *
38
- * Rest ile ilgili detaylı açıklama:
39
- *
40
- * bu `customers/1363/subscriptions` gibi bir linki resolve ederken `1363` ile ilgili bir şey yazmasına engel olacaktır.
41
- * bunu yaparken regex'i match eden route'un (customers/1363) sonrasında kalan path'a bakar, `rest` ile belirtilen
42
- * Regex ile uyuşuyorsa (buradaki örnekte `subscriptions`) parantez içerisinde belirtilen kısmı navigasyona eklemez.
43
- * Sonuç: `customers/subscriptions` şeklinde algılar.
44
- *
45
- * Dilerseniz `hidden:true` ile bu route gizleyebilirsiniz. Bu durumda breadcrumbda `home > customer > subscription` gibi bir sıralama yapılacaktır.
46
- * Ya da `label` ile yeni bir isim verebilirsiniz.
47
- * {
48
- * regex: /^\/customers\/([A-Za-z0-9\-_]+)$/,
49
- * rest: /^subscriptions$/,
50
- * hidden: true,
51
- * },
52
- * {
53
- * regex: /^\/customers\/([A-Za-z0-9\-_]+)$/,
54
- * rest: /^subscriptions$/,
55
- * label: "yeni isim",
56
- * },
57
- */
58
- </script>
59
-
60
- <script setup lang="ts">
61
- import { computed } from 'vue';
62
- import { useRoute, useRouter } from 'vue-router';
63
-
64
- interface Breadcrumb {
65
- regex: string;
66
- path: string;
67
- label: string;
68
- hidden?: boolean;
69
- rest?: string;
70
- auto?: boolean;
71
- value?: string;
72
- }
73
-
74
- interface Props {
75
- onChange?: Array<() => void>;
76
- paths: Array<Breadcrumb>;
77
- }
78
-
79
- const props = withDefaults(defineProps<Props>(), {
80
- onChange: () => [],
81
- paths: () => [],
82
- });
83
- const route = useRoute();
84
- const list = computed<Breadcrumb[]>(() => {
85
- const pathArray = route.path.split('/');
86
- const { tab, id } = route.query;
87
- const breadcrumbs: Breadcrumb[] = [];
88
- let link = '';
89
-
90
- breadcrumbs.push({
91
- path: '/',
92
- label: 'header.home.text',
93
- regex: '\/',
94
- });
95
-
96
- pathArray.filter(Boolean).forEach((path, index) => {
97
- link += '/' + path;
98
- if (index === pathArray.length - 2 && id && !tab) {
99
- link += '?id=' + id;
100
- }
101
- const matched = findBestMatch(link);
102
-
103
- if (matched && !matched?.hidden) {
104
- breadcrumbs.push(matched);
105
- }
106
- });
107
-
108
- if (tab) {
109
- const matched = findBestMatch(link + '/' + tab);
110
-
111
- if (matched && !matched?.hidden) {
112
- breadcrumbs.push(matched);
113
- }
114
- }
115
-
116
- return breadcrumbs;
117
- });
118
- const findBestMatch = (url: string): Breadcrumb | null => {
119
- let bestMatch: Breadcrumb | null = null;
120
- let maxMatchLength = 0;
121
-
122
- props.paths.forEach((route: Breadcrumb) => {
123
- const regex = new RegExp(route.regex);
124
-
125
- if (regex.test(url)) {
126
- const match = url.match(regex);
127
-
128
- if (match && match[0].length > maxMatchLength) {
129
- maxMatchLength = match[0].length;
130
- route.path = route.path ?? match[0]; // route.path tanımsızsa match[0] ile güncelle
131
-
132
- if (match[1]) [, route.value] = match; // match[1] mevcutsa route.value güncelle, yoksa eski değeri koru
133
-
134
- bestMatch = route;
135
- }
136
- }
137
- });
138
-
139
- if (!bestMatch) {
140
- let label = 'header';
141
- const filteredArray = url.split('/').filter(Boolean);
142
-
143
- filteredArray.forEach((path) => {
144
- label = label + `.${path}`;
145
- });
146
-
147
- bestMatch = {
148
- label: label + '.text',
149
- path: url,
150
- auto: true,
151
- regex: '',
152
- };
153
- }
154
-
155
- return bestMatch;
156
- };
157
- const router = useRouter();
158
- const goBack = () => router.go(-1);
159
- </script>
@@ -1,6 +0,0 @@
1
- import type { TabsPaneContext } from 'element-plus';
2
- export declare function useBreadcrumb(): {
3
- activeTab: import("vue").Ref<string, string>;
4
- tabChanged: (tab: TabsPaneContext) => void;
5
- setupBreadcrumbs: (tabs: string[]) => void;
6
- };
@@ -1,42 +0,0 @@
1
- import { onUnmounted, ref } from "vue";
2
- import { useRoute, useRouter } from "#app";
3
- export function useBreadcrumb() {
4
- const route = useRoute();
5
- const router = useRouter();
6
- const activeTab = ref(route.query.tab);
7
- const breadcrumbTimeout = ref(null);
8
- const tabList = ref([]);
9
- onUnmounted(() => {
10
- if (breadcrumbTimeout.value) {
11
- clearTimeout(breadcrumbTimeout.value);
12
- }
13
- });
14
- const tabChanged = (tab) => {
15
- if (breadcrumbTimeout.value) {
16
- clearTimeout(breadcrumbTimeout.value);
17
- }
18
- breadcrumbTimeout.value = setTimeout(() => {
19
- router.push({
20
- path: route.path,
21
- query: {
22
- ...route.query,
23
- tab: tab.paneName,
24
- page: route.query.tab !== tab.paneName ? 1 : route.query.page
25
- }
26
- });
27
- }, 0);
28
- };
29
- const setActiveTab = (tab) => {
30
- activeTab.value = tabList.value.includes(tab) ? tab : tabList.value[0];
31
- tabChanged({ paneName: activeTab.value });
32
- };
33
- const setupBreadcrumbs = (tabs) => {
34
- tabList.value = tabs;
35
- setActiveTab(activeTab.value);
36
- };
37
- return {
38
- activeTab,
39
- tabChanged,
40
- setupBreadcrumbs
41
- };
42
- }