@vendure/dashboard 3.4.3-master-202509260228 → 3.5.0-minor-202509261210
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/plugin/api/api-extensions.js +11 -14
- package/dist/plugin/api/metrics.resolver.d.ts +2 -2
- package/dist/plugin/api/metrics.resolver.js +2 -2
- package/dist/plugin/config/metrics-strategies.d.ts +9 -9
- package/dist/plugin/config/metrics-strategies.js +6 -6
- package/dist/plugin/constants.d.ts +2 -0
- package/dist/plugin/constants.js +3 -1
- package/dist/plugin/dashboard.plugin.js +13 -0
- package/dist/plugin/service/metrics.service.d.ts +3 -3
- package/dist/plugin/service/metrics.service.js +37 -53
- package/dist/plugin/types.d.ts +9 -12
- package/dist/plugin/types.js +7 -11
- package/dist/vite/vite-plugin-vendure-dashboard.js +2 -2
- package/package.json +4 -4
- package/src/app/routes/_authenticated/_collections/collections.tsx +7 -2
- package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +15 -2
- package/src/app/routes/_authenticated/_facets/facets_.$id.tsx +14 -2
- package/src/app/routes/_authenticated/_product-variants/product-variants.graphql.ts +10 -0
- package/src/app/routes/_authenticated/_products/components/product-option-group-badge.tsx +19 -0
- package/src/app/routes/_authenticated/_products/components/product-options-table.tsx +111 -0
- package/src/app/routes/_authenticated/_products/product-option-groups.graphql.ts +103 -0
- package/src/app/routes/_authenticated/_products/products.graphql.ts +13 -1
- package/src/app/routes/_authenticated/_products/products.tsx +27 -3
- package/src/app/routes/_authenticated/_products/products_.$id.tsx +26 -9
- package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$id.tsx +181 -0
- package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$productOptionGroupId.options_.$id.tsx +208 -0
- package/src/app/routes/_authenticated/_zones/components/zone-countries-sheet.tsx +4 -1
- package/src/app/routes/_authenticated/index.tsx +41 -24
- package/src/lib/components/data-display/json.tsx +16 -1
- package/src/lib/components/data-input/index.ts +3 -0
- package/src/lib/components/data-input/slug-input.tsx +296 -0
- package/src/lib/components/data-table/add-filter-menu.tsx +13 -6
- package/src/lib/components/data-table/data-table-bulk-action-item.tsx +38 -1
- package/src/lib/components/data-table/data-table-context.tsx +91 -0
- package/src/lib/components/data-table/data-table-filter-badge.tsx +9 -5
- package/src/lib/components/data-table/data-table-view-options.tsx +17 -8
- package/src/lib/components/data-table/data-table.tsx +146 -94
- package/src/lib/components/data-table/global-views-bar.tsx +97 -0
- package/src/lib/components/data-table/global-views-sheet.tsx +11 -0
- package/src/lib/components/data-table/manage-global-views-button.tsx +26 -0
- package/src/lib/components/data-table/my-views-button.tsx +47 -0
- package/src/lib/components/data-table/refresh-button.tsx +12 -3
- package/src/lib/components/data-table/save-view-button.tsx +45 -0
- package/src/lib/components/data-table/save-view-dialog.tsx +113 -0
- package/src/lib/components/data-table/use-generated-columns.tsx +3 -1
- package/src/lib/components/data-table/user-views-sheet.tsx +11 -0
- package/src/lib/components/data-table/views-sheet.tsx +297 -0
- package/src/lib/components/date-range-picker.tsx +184 -0
- package/src/lib/components/shared/paginated-list-data-table.tsx +59 -32
- package/src/lib/components/ui/button.tsx +1 -1
- package/src/lib/framework/dashboard-widget/latest-orders-widget/index.tsx +29 -2
- package/src/lib/framework/dashboard-widget/metrics-widget/index.tsx +10 -7
- package/src/lib/framework/dashboard-widget/metrics-widget/metrics-widget.graphql.ts +9 -3
- package/src/lib/framework/dashboard-widget/orders-summary/index.tsx +19 -75
- package/src/lib/framework/dashboard-widget/widget-filters-context.tsx +33 -0
- package/src/lib/framework/document-introspection/add-custom-fields.spec.ts +319 -9
- package/src/lib/framework/document-introspection/add-custom-fields.ts +60 -31
- package/src/lib/framework/document-introspection/get-document-structure.spec.ts +1 -159
- package/src/lib/framework/document-introspection/include-only-selected-list-fields.spec.ts +1840 -0
- package/src/lib/framework/document-introspection/include-only-selected-list-fields.ts +940 -0
- package/src/lib/framework/document-introspection/testing-utils.ts +161 -0
- package/src/lib/framework/extension-api/display-component-extensions.tsx +2 -0
- package/src/lib/framework/extension-api/types/data-table.ts +62 -4
- package/src/lib/framework/extension-api/types/navigation.ts +16 -0
- package/src/lib/framework/form-engine/utils.ts +34 -0
- package/src/lib/framework/page/list-page.tsx +289 -4
- package/src/lib/framework/page/use-extended-router.tsx +59 -17
- package/src/lib/graphql/api.ts +4 -2
- package/src/lib/graphql/graphql-env.d.ts +13 -10
- package/src/lib/hooks/use-extended-list-query.ts +5 -0
- package/src/lib/hooks/use-saved-views.ts +230 -0
- package/src/lib/index.ts +15 -0
- package/src/lib/types/saved-views.ts +39 -0
- package/src/lib/utils/saved-views-utils.ts +40 -0
package/src/lib/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * from './components/data-input/relation-input.js';
|
|
|
22
22
|
export * from './components/data-input/relation-selector.js';
|
|
23
23
|
export * from './components/data-input/rich-text-input.js';
|
|
24
24
|
export * from './components/data-input/select-with-options.js';
|
|
25
|
+
export * from './components/data-input/slug-input.js';
|
|
25
26
|
export * from './components/data-input/struct-form-input.js';
|
|
26
27
|
export * from './components/data-input/text-input.js';
|
|
27
28
|
export * from './components/data-input/textarea-input.js';
|
|
@@ -29,6 +30,7 @@ export * from './components/data-table/add-filter-menu.js';
|
|
|
29
30
|
export * from './components/data-table/data-table-bulk-action-item.js';
|
|
30
31
|
export * from './components/data-table/data-table-bulk-actions.js';
|
|
31
32
|
export * from './components/data-table/data-table-column-header.js';
|
|
33
|
+
export * from './components/data-table/data-table-context.js';
|
|
32
34
|
export * from './components/data-table/data-table-faceted-filter.js';
|
|
33
35
|
export * from './components/data-table/data-table-filter-badge.js';
|
|
34
36
|
export * from './components/data-table/data-table-filter-dialog.js';
|
|
@@ -41,11 +43,20 @@ export * from './components/data-table/filters/data-table-datetime-filter.js';
|
|
|
41
43
|
export * from './components/data-table/filters/data-table-id-filter.js';
|
|
42
44
|
export * from './components/data-table/filters/data-table-number-filter.js';
|
|
43
45
|
export * from './components/data-table/filters/data-table-string-filter.js';
|
|
46
|
+
export * from './components/data-table/global-views-bar.js';
|
|
47
|
+
export * from './components/data-table/global-views-sheet.js';
|
|
44
48
|
export * from './components/data-table/human-readable-operator.js';
|
|
49
|
+
export * from './components/data-table/manage-global-views-button.js';
|
|
50
|
+
export * from './components/data-table/my-views-button.js';
|
|
45
51
|
export * from './components/data-table/refresh-button.js';
|
|
52
|
+
export * from './components/data-table/save-view-button.js';
|
|
53
|
+
export * from './components/data-table/save-view-dialog.js';
|
|
46
54
|
export * from './components/data-table/types.js';
|
|
47
55
|
export * from './components/data-table/use-all-bulk-actions.js';
|
|
48
56
|
export * from './components/data-table/use-generated-columns.js';
|
|
57
|
+
export * from './components/data-table/user-views-sheet.js';
|
|
58
|
+
export * from './components/data-table/views-sheet.js';
|
|
59
|
+
export * from './components/date-range-picker.js';
|
|
49
60
|
export * from './components/labeled-data.js';
|
|
50
61
|
export * from './components/layout/app-layout.js';
|
|
51
62
|
export * from './components/layout/app-sidebar.js';
|
|
@@ -98,9 +109,11 @@ export * from './components/shared/form-field-wrapper.js';
|
|
|
98
109
|
export * from './components/shared/history-timeline/history-entry-date.js';
|
|
99
110
|
export * from './components/shared/history-timeline/history-note-checkbox.js';
|
|
100
111
|
export * from './components/shared/history-timeline/history-note-editor.js';
|
|
112
|
+
export * from './components/shared/history-timeline/history-note-entry.js';
|
|
101
113
|
export * from './components/shared/history-timeline/history-note-input.js';
|
|
102
114
|
export * from './components/shared/history-timeline/history-timeline-with-grouping.js';
|
|
103
115
|
export * from './components/shared/history-timeline/history-timeline.js';
|
|
116
|
+
export * from './components/shared/history-timeline/use-history-note-editor.js';
|
|
104
117
|
export * from './components/shared/icon-mark.js';
|
|
105
118
|
export * from './components/shared/language-selector.js';
|
|
106
119
|
export * from './components/shared/logo-mark.js';
|
|
@@ -183,6 +196,7 @@ export * from './framework/dashboard-widget/metrics-widget/chart.js';
|
|
|
183
196
|
export * from './framework/dashboard-widget/metrics-widget/metrics-widget.graphql.js';
|
|
184
197
|
export * from './framework/dashboard-widget/orders-summary/order-summary-widget.graphql.js';
|
|
185
198
|
export * from './framework/dashboard-widget/widget-extensions.js';
|
|
199
|
+
export * from './framework/dashboard-widget/widget-filters-context.js';
|
|
186
200
|
export * from './framework/data-table/data-table-extensions.js';
|
|
187
201
|
export * from './framework/defaults.js';
|
|
188
202
|
export * from './framework/document-extension/extend-detail-form-query.js';
|
|
@@ -259,6 +273,7 @@ export * from './hooks/use-mobile.js';
|
|
|
259
273
|
export * from './hooks/use-page-block.js';
|
|
260
274
|
export * from './hooks/use-page.js';
|
|
261
275
|
export * from './hooks/use-permissions.js';
|
|
276
|
+
export * from './hooks/use-saved-views.js';
|
|
262
277
|
export * from './hooks/use-server-config.js';
|
|
263
278
|
export * from './hooks/use-theme.js';
|
|
264
279
|
export * from './hooks/use-user-settings.js';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ColumnFiltersState } from '@tanstack/react-table';
|
|
2
|
+
|
|
3
|
+
export interface SavedView {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
scope: 'user' | 'global';
|
|
7
|
+
filters: ColumnFiltersState;
|
|
8
|
+
searchTerm?: string;
|
|
9
|
+
pageId?: string;
|
|
10
|
+
blockId?: string;
|
|
11
|
+
createdAt: string; // ISO timestamp string
|
|
12
|
+
updatedAt: string; // ISO timestamp string
|
|
13
|
+
createdBy?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface SavedViewsData {
|
|
17
|
+
userViews: SavedView[];
|
|
18
|
+
globalViews: SavedView[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface SavedViewsStore {
|
|
22
|
+
[pageId: string]: {
|
|
23
|
+
[blockId: string]: SavedView[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface SaveViewInput {
|
|
28
|
+
name: string;
|
|
29
|
+
scope: 'user' | 'global';
|
|
30
|
+
filters: ColumnFiltersState;
|
|
31
|
+
searchTerm?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface UpdateViewInput {
|
|
35
|
+
id: string;
|
|
36
|
+
name?: string;
|
|
37
|
+
filters?: ColumnFiltersState;
|
|
38
|
+
searchTerm?: string;
|
|
39
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ColumnFiltersState } from '@tanstack/react-table';
|
|
2
|
+
|
|
3
|
+
import { SavedView } from '../types/saved-views.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Checks if the current filters and search term match any of the provided saved views
|
|
7
|
+
* @param currentFilters - The current column filters
|
|
8
|
+
* @param currentSearchTerm - The current search term
|
|
9
|
+
* @param views - Array of saved views to check against
|
|
10
|
+
* @returns The matching saved view if found, undefined otherwise
|
|
11
|
+
*/
|
|
12
|
+
export function findMatchingSavedView(
|
|
13
|
+
currentFilters: ColumnFiltersState,
|
|
14
|
+
currentSearchTerm: string,
|
|
15
|
+
views: SavedView[],
|
|
16
|
+
): SavedView | undefined {
|
|
17
|
+
return views.find(view => {
|
|
18
|
+
const filtersMatch = JSON.stringify(view.filters) === JSON.stringify(currentFilters);
|
|
19
|
+
const searchMatch = (view.searchTerm || '') === currentSearchTerm;
|
|
20
|
+
return filtersMatch && searchMatch;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Checks if the current filters match any saved view (user or global)
|
|
26
|
+
* @param currentFilters - The current column filters
|
|
27
|
+
* @param currentSearchTerm - The current search term
|
|
28
|
+
* @param userViews - Array of user saved views
|
|
29
|
+
* @param globalViews - Array of global saved views
|
|
30
|
+
* @returns true if a matching view is found, false otherwise
|
|
31
|
+
*/
|
|
32
|
+
export function isMatchingSavedView(
|
|
33
|
+
currentFilters: ColumnFiltersState,
|
|
34
|
+
currentSearchTerm: string,
|
|
35
|
+
userViews: SavedView[],
|
|
36
|
+
globalViews: SavedView[],
|
|
37
|
+
): boolean {
|
|
38
|
+
const allViews = [...userViews, ...globalViews];
|
|
39
|
+
return findMatchingSavedView(currentFilters, currentSearchTerm, allViews) !== undefined;
|
|
40
|
+
}
|