@vc-shell/framework 1.1.35 → 1.1.36
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 +9 -0
- package/dist/framework.js +6 -5
- package/dist/{index-DPWorAyL.js → index-1f7vj53c.js} +1 -1
- package/dist/{index-CSvI0g-3.js → index-B3EnJAC8.js} +1 -1
- package/dist/{index-CsWhyro_.js → index-B7WLbVIY.js} +1 -1
- package/dist/{index-BkUjYKvR.js → index-BJNBY_1Z.js} +1 -1
- package/dist/{index-DrVlbA9k.js → index-BYcFX9Jr.js} +24478 -24428
- package/dist/{index-Da3hS7OH.js → index-C4aTdLn2.js} +1 -1
- package/dist/{index-CT2orLVN.js → index-C90FIKBB.js} +1 -1
- package/dist/{index-DsurL8Xm.js → index-CTeIYm3i.js} +9 -2
- package/dist/{index-DXEquEr8.js → index-CYol-SnB.js} +1 -1
- package/dist/{index-DdCbIqjR.js → index-CghxqR-1.js} +1 -1
- package/dist/{index-BKf0fZTf.js → index-ChFKSOdi.js} +1 -1
- package/dist/{index-CY4rQpKI.js → index-CmSn0lwJ.js} +1 -1
- package/dist/{index-muqinQeC.js → index-CypHdp_8.js} +1 -1
- package/dist/{index-aC11cxfU.js → index-DIN8u1SW.js} +1 -1
- package/dist/{index-DhuupW8j.js → index-DYsowdzj.js} +1 -1
- package/dist/{index-Csqb5hrT.js → index-IlIJwS9e.js} +1 -1
- package/dist/{index-DKzBUQy1.js → index-OiN3G2Yt.js} +1 -1
- package/dist/index.css +2 -2
- package/dist/shared/components/notifications/composables/useContainer/index.d.ts.map +1 -1
- package/dist/shared/composables/index.d.ts +1 -0
- package/dist/shared/composables/index.d.ts.map +1 -1
- package/dist/shared/composables/useTableSort.d.ts +19 -0
- package/dist/shared/composables/useTableSort.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/shared/components/notifications/composables/useContainer/index.ts +6 -2
- package/shared/composables/index.ts +1 -0
- package/shared/composables/useTableSort.ts +99 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vc-shell/framework",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.36",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/framework.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@fullhuman/postcss-purgecss": "^7.0.2",
|
|
72
72
|
"@types/dompurify": "^3.0.5",
|
|
73
|
-
"@vc-shell/api-client-generator": "^1.1.
|
|
74
|
-
"@vc-shell/config-generator": "^1.1.
|
|
75
|
-
"@vc-shell/ts-config": "^1.1.
|
|
73
|
+
"@vc-shell/api-client-generator": "^1.1.36",
|
|
74
|
+
"@vc-shell/config-generator": "^1.1.36",
|
|
75
|
+
"@vc-shell/ts-config": "^1.1.36",
|
|
76
76
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
77
77
|
"@vue/test-utils": "^2.4.5",
|
|
78
78
|
"cypress-signalr-mock": "^1.5.0",
|
|
@@ -181,7 +181,9 @@ export function useContainer(): IUseContainer {
|
|
|
181
181
|
|
|
182
182
|
if (positionToRemoveFrom) {
|
|
183
183
|
// Remove the notification from the corresponding container
|
|
184
|
-
|
|
184
|
+
notificationContainers[positionToRemoveFrom].value = notificationContainers[
|
|
185
|
+
positionToRemoveFrom
|
|
186
|
+
].value.filter((item) => item.notificationId !== id);
|
|
185
187
|
|
|
186
188
|
// If container is empty and there are no pending notifications for this position - remove it
|
|
187
189
|
const hasPendingForPosition = pending.items.some((item) => item.position === positionToRemoveFrom);
|
|
@@ -307,7 +309,9 @@ export function useContainer(): IUseContainer {
|
|
|
307
309
|
// If the position changes, move the notification between containers
|
|
308
310
|
if (option.position && option.position !== containerPosition) {
|
|
309
311
|
// Remove from current container
|
|
310
|
-
|
|
312
|
+
containerToUpdate.value = containerToUpdate.value.filter(
|
|
313
|
+
(item) => item.notificationId !== option.notificationId,
|
|
314
|
+
);
|
|
311
315
|
|
|
312
316
|
// Create updated notification with new properties
|
|
313
317
|
const updatedNotification = {
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
// framework/composables/useTableSort.ts
|
|
3
|
+
import { ref, computed, Ref, WritableComputedRef } from "vue";
|
|
4
|
+
|
|
5
|
+
export type ITableSortDirection = "ASC" | "DESC";
|
|
6
|
+
|
|
7
|
+
export interface TableSortState {
|
|
8
|
+
property: string | null;
|
|
9
|
+
direction: ITableSortDirection | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface UseTableSortOptions {
|
|
13
|
+
initialProperty?: string;
|
|
14
|
+
initialDirection?: ITableSortDirection;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type SortParam = string;
|
|
18
|
+
|
|
19
|
+
export interface UseTableSortReturn {
|
|
20
|
+
// State exposed as writable computed or refs for direct v-model or manipulation if needed
|
|
21
|
+
// Though direct manipulation is less common, usually via handleSortChange
|
|
22
|
+
currentSort: WritableComputedRef<TableSortState>;
|
|
23
|
+
sortExpression: Ref<string | undefined>; // e.g., "name:ASC"
|
|
24
|
+
handleSortChange: (sortParam: SortParam) => void;
|
|
25
|
+
resetSort: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useTableSort(options?: UseTableSortOptions): UseTableSortReturn {
|
|
29
|
+
const currentSortProperty = ref<string | null>(options?.initialProperty || null);
|
|
30
|
+
const currentSortDirection = ref<ITableSortDirection | null>(options?.initialDirection || null);
|
|
31
|
+
|
|
32
|
+
const currentSort: WritableComputedRef<TableSortState> = computed({
|
|
33
|
+
get: () => ({
|
|
34
|
+
property: currentSortProperty.value,
|
|
35
|
+
direction: currentSortDirection.value,
|
|
36
|
+
}),
|
|
37
|
+
set: (newState: TableSortState) => {
|
|
38
|
+
currentSortProperty.value = newState.property;
|
|
39
|
+
currentSortDirection.value = newState.direction;
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const sortExpression = computed<string | undefined>(() => {
|
|
44
|
+
if (currentSortProperty.value && currentSortDirection.value) {
|
|
45
|
+
return `${currentSortProperty.value}:${currentSortDirection.value}`;
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const handleSortChange = (sortParam: SortParam) => {
|
|
51
|
+
console.log("[useTableSort] handleSortChange triggered. Received sortParam:", JSON.stringify(sortParam));
|
|
52
|
+
|
|
53
|
+
let newSortProperty: string | undefined = undefined;
|
|
54
|
+
let newSortDirection: ITableSortDirection | undefined = undefined;
|
|
55
|
+
|
|
56
|
+
const parts = sortParam.split(":");
|
|
57
|
+
if (parts.length === 2) {
|
|
58
|
+
newSortProperty = parts[0];
|
|
59
|
+
const dir = parts[1].toUpperCase();
|
|
60
|
+
if (dir === "ASC" || dir === "DESC") {
|
|
61
|
+
newSortDirection = dir as ITableSortDirection;
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
newSortProperty = sortParam; // Assume it's just the property name
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (newSortProperty) {
|
|
68
|
+
if (currentSortProperty.value === newSortProperty) {
|
|
69
|
+
// Clicked on the same column, toggle direction
|
|
70
|
+
if (newSortDirection) {
|
|
71
|
+
// If table provided a new direction (e.g. 3-state sort)
|
|
72
|
+
currentSortDirection.value = newSortDirection;
|
|
73
|
+
} else {
|
|
74
|
+
// Toggle existing
|
|
75
|
+
currentSortDirection.value = currentSortDirection.value === "ASC" ? "DESC" : "ASC";
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
// Clicked on a new column
|
|
79
|
+
currentSortProperty.value = newSortProperty;
|
|
80
|
+
currentSortDirection.value = newSortDirection || "ASC"; // Default to ASC if no direction provided
|
|
81
|
+
}
|
|
82
|
+
console.log(`[useTableSort] New sort state: ${currentSortProperty.value}:${currentSortDirection.value}`);
|
|
83
|
+
} else {
|
|
84
|
+
console.warn("[useTableSort] Could not determine valid sort property from sortParam:", sortParam);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const resetSort = () => {
|
|
89
|
+
currentSortProperty.value = options?.initialProperty || null;
|
|
90
|
+
currentSortDirection.value = options?.initialDirection || null;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
currentSort,
|
|
95
|
+
sortExpression,
|
|
96
|
+
handleSortChange,
|
|
97
|
+
resetSort,
|
|
98
|
+
};
|
|
99
|
+
}
|