design-system-next 2.15.5 → 2.15.7
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/design-system-next.es.js +1066 -1048
- package/dist/design-system-next.es.js.gz +0 -0
- package/dist/design-system-next.umd.js +7 -7
- package/dist/design-system-next.umd.js.gz +0 -0
- package/dist/package.json.d.ts +1 -1
- package/package.json +1 -1
- package/src/App.vue +1644 -3
- package/src/components/sidenav/use-sidenav.ts +41 -6
|
@@ -88,7 +88,12 @@ export const useSidenav = (props: SidenavPropTypes, emit: SetupContext<SidenavEm
|
|
|
88
88
|
|
|
89
89
|
const getPathFromUrl = (url: string): string => {
|
|
90
90
|
const parsedUrl = new URL(url);
|
|
91
|
-
|
|
91
|
+
|
|
92
|
+
if (!parsedUrl) return '';
|
|
93
|
+
|
|
94
|
+
const { pathname, search, hash } = parsedUrl;
|
|
95
|
+
|
|
96
|
+
return `${pathname}${search}${hash}`;
|
|
92
97
|
};
|
|
93
98
|
|
|
94
99
|
const navLinkCondition = (link: NavItem) => {
|
|
@@ -231,20 +236,50 @@ export const useSidenav = (props: SidenavPropTypes, emit: SetupContext<SidenavEm
|
|
|
231
236
|
|
|
232
237
|
// Utility function to convert string attributes to array
|
|
233
238
|
const convertAttributesToArray = (attributes: string | Attributes[] | undefined): Attributes[] => {
|
|
234
|
-
if (!attributes)
|
|
235
|
-
|
|
236
|
-
|
|
239
|
+
if (!attributes) return [];
|
|
240
|
+
|
|
241
|
+
const parseAttributeValue = (raw: unknown): unknown => {
|
|
242
|
+
if (raw === null || raw === undefined) return raw;
|
|
243
|
+
if (typeof raw !== 'string') return raw;
|
|
244
|
+
|
|
245
|
+
const trimmed = raw.trim();
|
|
246
|
+
|
|
247
|
+
if (!trimmed.startsWith('{') || !trimmed.endsWith('}')) return raw;
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
let jsonLike = trimmed
|
|
251
|
+
// Remove leading/trailing braces will keep them for JSON parse
|
|
252
|
+
.replace(/([{,]\s*)([A-Za-z0-9_]+)\s*:/g, '$1"$2":') // quote keys
|
|
253
|
+
.replace(/'([^']*)'/g, '"$1"'); // single to double quotes inside values
|
|
254
|
+
|
|
255
|
+
// If the string still contains escaped quotes from being embedded in JSON previously, unescape them
|
|
256
|
+
jsonLike = jsonLike.replace(/\\"/g, '"');
|
|
257
|
+
|
|
258
|
+
return JSON.parse(jsonLike);
|
|
259
|
+
} catch {
|
|
260
|
+
return raw;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
let array: Attributes[] = [];
|
|
237
265
|
|
|
238
266
|
if (typeof attributes === 'string') {
|
|
239
267
|
try {
|
|
240
268
|
const parsed = JSON.parse(attributes);
|
|
241
|
-
|
|
269
|
+
array = Array.isArray(parsed) ? parsed : [parsed];
|
|
242
270
|
} catch {
|
|
243
271
|
return [];
|
|
244
272
|
}
|
|
273
|
+
} else if (Array.isArray(attributes)) {
|
|
274
|
+
array = attributes;
|
|
245
275
|
}
|
|
246
276
|
|
|
247
|
-
|
|
277
|
+
// Parse each attribute's value if necessary
|
|
278
|
+
return array.map((attr: Attributes) => {
|
|
279
|
+
if (!attr) return attr;
|
|
280
|
+
const parsedValue = typeof attr.value === 'string' ? parseAttributeValue(attr.value) : attr.value;
|
|
281
|
+
return { ...attr, value: parsedValue } as Attributes;
|
|
282
|
+
});
|
|
248
283
|
};
|
|
249
284
|
|
|
250
285
|
const setNavLinkItems = async () => {
|