@vendure/dashboard 3.5.0-minor-202510031341 → 3.5.0-minor-202510071456
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/default-page.html +1 -1
- package/dist/vite/utils/tsconfig-utils.js +2 -1
- package/package.json +5 -4
- package/src/app/routes/_authenticated/_global-settings/global-settings.tsx +4 -8
- package/src/app/routes/_authenticated/_global-settings/utils/global-languages.ts +268 -0
- package/src/app/routes/_authenticated/_orders/components/order-address.tsx +15 -15
- package/src/app/routes/_authenticated/_orders/components/order-detail-shared.tsx +4 -4
- package/src/app/routes/_authenticated/_product-variants/components/add-currency-dropdown.tsx +49 -0
- package/src/app/routes/_authenticated/_product-variants/components/add-stock-location-dropdown.tsx +56 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants.graphql.ts +12 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +178 -50
- package/src/app/routes/_authenticated/_products/components/product-variants-table.tsx +0 -11
- package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +3 -14
- package/src/lib/components/data-input/customer-group-input.tsx +0 -1
- package/src/lib/components/data-input/money-input.tsx +7 -11
- package/src/lib/components/data-input/number-input.tsx +6 -1
- package/src/lib/components/data-table/data-table-filter-badge.tsx +15 -8
- package/src/lib/components/data-table/data-table.tsx +2 -2
- package/src/lib/components/layout/generated-breadcrumbs.tsx +4 -12
- package/src/lib/components/shared/configurable-operation-input.tsx +1 -1
- package/src/lib/framework/dashboard-widget/latest-orders-widget/index.tsx +0 -2
- package/src/lib/framework/extension-api/types/layout.ts +41 -1
- package/src/lib/framework/form-engine/value-transformers.ts +8 -1
- package/src/lib/framework/layout-engine/page-layout.tsx +58 -48
- package/src/lib/framework/page/detail-page.tsx +12 -15
- package/src/lib/providers/channel-provider.tsx +1 -0
|
@@ -119,12 +119,12 @@ export function Page({ children, pageId, entity, form, submitHandler, ...props }
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
function PageContent({
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
pageHeader,
|
|
123
|
+
pageContent,
|
|
124
|
+
form,
|
|
125
|
+
submitHandler,
|
|
126
|
+
...props
|
|
127
|
+
}: {
|
|
128
128
|
pageHeader: React.ReactNode;
|
|
129
129
|
pageContent: React.ReactNode;
|
|
130
130
|
form?: UseFormReturn<any>;
|
|
@@ -146,11 +146,11 @@ function PageContent({
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
export function PageContentWithOptionalForm({
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
form,
|
|
150
|
+
pageHeader,
|
|
151
|
+
pageContent,
|
|
152
|
+
submitHandler,
|
|
153
|
+
}: {
|
|
154
154
|
form?: UseFormReturn<any>;
|
|
155
155
|
pageHeader: React.ReactNode;
|
|
156
156
|
pageContent: React.ReactNode;
|
|
@@ -235,22 +235,32 @@ export function PageLayout({ children, className }: Readonly<PageLayoutProps>) {
|
|
|
235
235
|
childBlock.props.blockId ??
|
|
236
236
|
(isOfType(childBlock, CustomFieldsPageBlock) ? 'custom-fields' : undefined);
|
|
237
237
|
const extensionBlock = extensionBlocks.find(block => block.location.position.blockId === blockId);
|
|
238
|
+
|
|
238
239
|
if (extensionBlock) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
240
|
+
let extensionBlockShouldRender = true;
|
|
241
|
+
if (typeof extensionBlock?.shouldRender === 'function') {
|
|
242
|
+
extensionBlockShouldRender = extensionBlock.shouldRender(page);
|
|
243
|
+
}
|
|
244
|
+
const ExtensionBlock =
|
|
245
|
+
extensionBlock.component && extensionBlockShouldRender ? (
|
|
246
|
+
<PageBlock
|
|
247
|
+
key={childBlock.key}
|
|
248
|
+
column={extensionBlock.location.column}
|
|
249
|
+
blockId={extensionBlock.id}
|
|
250
|
+
title={extensionBlock.title}
|
|
251
|
+
>
|
|
252
|
+
{<extensionBlock.component context={page} />}
|
|
253
|
+
</PageBlock>
|
|
254
|
+
) : undefined;
|
|
249
255
|
if (extensionBlock.location.position.order === 'before') {
|
|
250
|
-
finalChildArray.push(ExtensionBlock, childBlock);
|
|
256
|
+
finalChildArray.push(...[ExtensionBlock, childBlock].filter(x => !!x));
|
|
251
257
|
} else if (extensionBlock.location.position.order === 'after') {
|
|
252
|
-
finalChildArray.push(childBlock, ExtensionBlock);
|
|
253
|
-
} else if (
|
|
258
|
+
finalChildArray.push(...[childBlock, ExtensionBlock].filter(x => !!x));
|
|
259
|
+
} else if (
|
|
260
|
+
extensionBlock.location.position.order === 'replace' &&
|
|
261
|
+
extensionBlockShouldRender &&
|
|
262
|
+
ExtensionBlock
|
|
263
|
+
) {
|
|
254
264
|
finalChildArray.push(ExtensionBlock);
|
|
255
265
|
}
|
|
256
266
|
} else {
|
|
@@ -425,9 +435,9 @@ function EntityInfoDropdown({ entity }: Readonly<{ entity: any }>) {
|
|
|
425
435
|
* @since 3.3.0
|
|
426
436
|
*/
|
|
427
437
|
export function PageActionBarRight({
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
438
|
+
children,
|
|
439
|
+
dropdownMenuItems,
|
|
440
|
+
}: Readonly<{
|
|
431
441
|
children: React.ReactNode;
|
|
432
442
|
dropdownMenuItems?: InlineDropdownItem[];
|
|
433
443
|
}>) {
|
|
@@ -458,9 +468,9 @@ export function PageActionBarRight({
|
|
|
458
468
|
}
|
|
459
469
|
|
|
460
470
|
function PageActionBarItem({
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
471
|
+
item,
|
|
472
|
+
page,
|
|
473
|
+
}: Readonly<{ item: DashboardActionBarItem; page: PageContextValue }>) {
|
|
464
474
|
return (
|
|
465
475
|
<PermissionGuard requires={item.requiresPermission ?? []}>
|
|
466
476
|
<item.component context={page} />
|
|
@@ -469,9 +479,9 @@ function PageActionBarItem({
|
|
|
469
479
|
}
|
|
470
480
|
|
|
471
481
|
function PageActionBarDropdown({
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
482
|
+
items,
|
|
483
|
+
page,
|
|
484
|
+
}: Readonly<{ items: DashboardActionBarItem[]; page: PageContextValue }>) {
|
|
475
485
|
return (
|
|
476
486
|
<DropdownMenu>
|
|
477
487
|
<DropdownMenuTrigger asChild>
|
|
@@ -550,13 +560,13 @@ export type PageBlockProps = {
|
|
|
550
560
|
* @since 3.3.0
|
|
551
561
|
*/
|
|
552
562
|
export function PageBlock({
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
563
|
+
children,
|
|
564
|
+
title,
|
|
565
|
+
description,
|
|
566
|
+
className,
|
|
567
|
+
blockId,
|
|
568
|
+
column,
|
|
569
|
+
}: Readonly<PageBlockProps>) {
|
|
560
570
|
const contextValue = useMemo(
|
|
561
571
|
() => ({
|
|
562
572
|
blockId,
|
|
@@ -595,10 +605,10 @@ export function PageBlock({
|
|
|
595
605
|
* @since 3.3.0
|
|
596
606
|
*/
|
|
597
607
|
export function FullWidthPageBlock({
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
608
|
+
children,
|
|
609
|
+
className,
|
|
610
|
+
blockId,
|
|
611
|
+
}: Readonly<Pick<PageBlockProps, 'children' | 'className' | 'blockId'>>) {
|
|
602
612
|
const contextValue = useMemo(() => ({ blockId, column: 'main' as const }), [blockId]);
|
|
603
613
|
return (
|
|
604
614
|
<PageBlockContext.Provider value={contextValue}>
|
|
@@ -625,10 +635,10 @@ export function FullWidthPageBlock({
|
|
|
625
635
|
* @since 3.3.0
|
|
626
636
|
*/
|
|
627
637
|
export function CustomFieldsPageBlock({
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
638
|
+
column,
|
|
639
|
+
entityType,
|
|
640
|
+
control,
|
|
641
|
+
}: Readonly<{
|
|
632
642
|
column: 'main' | 'side';
|
|
633
643
|
entityType: string;
|
|
634
644
|
control: Control<any, any>;
|
|
@@ -5,8 +5,8 @@ import { Checkbox } from '@/vdb/components/ui/checkbox.js';
|
|
|
5
5
|
import { Input } from '@/vdb/components/ui/input.js';
|
|
6
6
|
import { NEW_ENTITY_PATH } from '@/vdb/constants.js';
|
|
7
7
|
import { useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
|
|
8
|
-
import { Trans } from '@lingui/react/macro';
|
|
9
8
|
import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
9
|
+
import { Trans } from '@lingui/react/macro';
|
|
10
10
|
import { AnyRoute, useNavigate } from '@tanstack/react-router';
|
|
11
11
|
import { ResultOf, VariablesOf } from 'gql.tada';
|
|
12
12
|
import { toast } from 'sonner';
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
getOperationVariablesFields,
|
|
17
17
|
} from '../document-introspection/get-document-structure.js';
|
|
18
18
|
|
|
19
|
+
import { NumberInput } from '@/vdb/components/data-input/number-input.js';
|
|
19
20
|
import { TranslatableFormFieldWrapper } from '@/vdb/components/shared/translatable-form-field.js';
|
|
20
21
|
import { FormControl } from '@/vdb/components/ui/form.js';
|
|
21
22
|
import { ControllerRenderProps, FieldPath, FieldValues } from 'react-hook-form';
|
|
@@ -108,11 +109,7 @@ function FieldInputRenderer<
|
|
|
108
109
|
case 'Float':
|
|
109
110
|
return (
|
|
110
111
|
<FormControl>
|
|
111
|
-
<
|
|
112
|
-
type="number"
|
|
113
|
-
value={field.value}
|
|
114
|
-
onChange={e => field.onChange(e.target.valueAsNumber)}
|
|
115
|
-
/>
|
|
112
|
+
<NumberInput {...field} />
|
|
116
113
|
</FormControl>
|
|
117
114
|
);
|
|
118
115
|
case 'DateTime':
|
|
@@ -152,15 +149,15 @@ export function DetailPage<
|
|
|
152
149
|
C extends TypedDocumentNode<any, any>,
|
|
153
150
|
U extends TypedDocumentNode<any, any>,
|
|
154
151
|
>({
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
152
|
+
pageId,
|
|
153
|
+
route,
|
|
154
|
+
entityName: passedEntityName,
|
|
155
|
+
queryDocument,
|
|
156
|
+
createDocument,
|
|
157
|
+
updateDocument,
|
|
158
|
+
setValuesForUpdate,
|
|
159
|
+
title,
|
|
160
|
+
}: DetailPageProps<T, C, U>) {
|
|
164
161
|
const params = route.useParams();
|
|
165
162
|
const creatingNewEntity = params.id === NEW_ENTITY_PATH;
|
|
166
163
|
const navigate = useNavigate();
|