@vendure/dashboard 3.3.6-master-202507030648 → 3.3.6-master-202507030732
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/package.json +4 -4
- package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +1 -1
- package/src/app/routes/_authenticated/_payment-methods/payment-methods_.$id.tsx +1 -1
- package/src/app/routes/_authenticated/_products/products_.$id.tsx +1 -1
- package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +1 -1
- package/src/lib/components/data-input/money-input.tsx +2 -9
- package/src/lib/components/shared/form-field-wrapper.tsx +22 -13
- package/src/lib/framework/component-registry/component-registry.tsx +5 -3
- package/src/lib/framework/page/detail-page.tsx +28 -17
- package/src/lib/index.ts +5 -6
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/dashboard",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.3.6-master-
|
|
4
|
+
"version": "3.3.6-master-202507030732",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"@types/react-dom": "^19.0.4",
|
|
87
87
|
"@types/react-grid-layout": "^1.3.5",
|
|
88
88
|
"@uidotdev/usehooks": "^2.4.1",
|
|
89
|
-
"@vendure/common": "^3.3.6-master-
|
|
90
|
-
"@vendure/core": "^3.3.6-master-
|
|
89
|
+
"@vendure/common": "^3.3.6-master-202507030732",
|
|
90
|
+
"@vendure/core": "^3.3.6-master-202507030732",
|
|
91
91
|
"@vitejs/plugin-react": "^4.3.4",
|
|
92
92
|
"awesome-graphql-client": "^2.1.0",
|
|
93
93
|
"class-variance-authority": "^0.7.1",
|
|
@@ -130,5 +130,5 @@
|
|
|
130
130
|
"lightningcss-linux-arm64-musl": "^1.29.3",
|
|
131
131
|
"lightningcss-linux-x64-musl": "^1.29.1"
|
|
132
132
|
},
|
|
133
|
-
"gitHead": "
|
|
133
|
+
"gitHead": "0caf3b1c7a4e75924dab2e3e92673c34dadc36f9"
|
|
134
134
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RichTextInput } from '@/vdb/components/data-input/
|
|
1
|
+
import { RichTextInput } from '@/vdb/components/data-input/rich-text-input.js';
|
|
2
2
|
import { EntityAssets } from '@/vdb/components/shared/entity-assets.js';
|
|
3
3
|
import { ErrorPage } from '@/vdb/components/shared/error-page.js';
|
|
4
4
|
import { FormFieldWrapper } from '@/vdb/components/shared/form-field-wrapper.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RichTextInput } from '@/vdb/components/data-input/
|
|
1
|
+
import { RichTextInput } from '@/vdb/components/data-input/rich-text-input.js';
|
|
2
2
|
import { ErrorPage } from '@/vdb/components/shared/error-page.js';
|
|
3
3
|
import { FormFieldWrapper } from '@/vdb/components/shared/form-field-wrapper.js';
|
|
4
4
|
import { PermissionGuard } from '@/vdb/components/shared/permission-guard.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RichTextInput } from '@/vdb/components/data-input/
|
|
1
|
+
import { RichTextInput } from '@/vdb/components/data-input/rich-text-input.js';
|
|
2
2
|
import { AssignedFacetValues } from '@/vdb/components/shared/assigned-facet-values.js';
|
|
3
3
|
import { EntityAssets } from '@/vdb/components/shared/entity-assets.js';
|
|
4
4
|
import { ErrorPage } from '@/vdb/components/shared/error-page.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DateTimeInput } from '@/vdb/components/data-input/datetime-input.js';
|
|
2
|
-
import { RichTextInput } from '@/vdb/components/data-input/
|
|
2
|
+
import { RichTextInput } from '@/vdb/components/data-input/rich-text-input.js';
|
|
3
3
|
import { ErrorPage } from '@/vdb/components/shared/error-page.js';
|
|
4
4
|
import { FormFieldWrapper } from '@/vdb/components/shared/form-field-wrapper.js';
|
|
5
5
|
import { PermissionGuard } from '@/vdb/components/shared/permission-guard.js';
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
+
import { DataInputComponentProps } from '@/vdb/framework/component-registry/component-registry.js';
|
|
1
2
|
import { useLocalFormat } from '@/vdb/hooks/use-local-format.js';
|
|
2
3
|
import { useUserSettings } from '@/vdb/hooks/use-user-settings.js';
|
|
3
4
|
import { useEffect, useMemo, useState } from 'react';
|
|
4
5
|
import { AffixedInput } from './affixed-input.js';
|
|
5
6
|
|
|
6
7
|
// Original component
|
|
7
|
-
function MoneyInputInternal({
|
|
8
|
-
value,
|
|
9
|
-
currency,
|
|
10
|
-
onChange,
|
|
11
|
-
}: {
|
|
12
|
-
value: number;
|
|
13
|
-
currency: string;
|
|
14
|
-
onChange: (value: number) => void;
|
|
15
|
-
}) {
|
|
8
|
+
function MoneyInputInternal({ value, currency, onChange }: DataInputComponentProps) {
|
|
16
9
|
const {
|
|
17
10
|
settings: { displayLanguage, displayLocale },
|
|
18
11
|
} = useUserSettings();
|
|
@@ -1,25 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
FormDescription,
|
|
4
|
-
FormItem,
|
|
5
|
-
FormLabel,
|
|
6
|
-
FormMessage,
|
|
7
|
-
FormField,
|
|
8
|
-
} from '../ui/form.js';
|
|
9
|
-
import { FieldValues, FieldPath } from 'react-hook-form';
|
|
1
|
+
import { FieldPath, FieldValues } from 'react-hook-form';
|
|
2
|
+
import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '../ui/form.js';
|
|
10
3
|
|
|
11
4
|
export type FormFieldWrapperProps<
|
|
12
5
|
TFieldValues extends FieldValues = FieldValues,
|
|
13
|
-
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues
|
|
6
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
14
7
|
> = React.ComponentProps<typeof FormField<TFieldValues, TName>> & {
|
|
15
8
|
label?: React.ReactNode;
|
|
16
9
|
description?: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* @description
|
|
12
|
+
* Whether to render the form control.
|
|
13
|
+
* If false, the form control will not be rendered.
|
|
14
|
+
* This is useful when you want to render the form control in a custom way, e.g. for <Select/> components,
|
|
15
|
+
* where the FormControl needs to nested in the root component.
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
renderFormControl?: boolean;
|
|
17
19
|
};
|
|
18
20
|
|
|
19
21
|
export function FormFieldWrapper<
|
|
20
22
|
TFieldValues extends FieldValues = FieldValues,
|
|
21
|
-
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues
|
|
22
|
-
>({
|
|
23
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
24
|
+
>({
|
|
25
|
+
control,
|
|
26
|
+
name,
|
|
27
|
+
render,
|
|
28
|
+
label,
|
|
29
|
+
description,
|
|
30
|
+
renderFormControl = true,
|
|
31
|
+
}: FormFieldWrapperProps<TFieldValues, TName>) {
|
|
23
32
|
return (
|
|
24
33
|
<FormField
|
|
25
34
|
control={control}
|
|
@@ -27,7 +36,7 @@ export function FormFieldWrapper<
|
|
|
27
36
|
render={renderArgs => (
|
|
28
37
|
<FormItem>
|
|
29
38
|
{label && <FormLabel>{label}</FormLabel>}
|
|
30
|
-
<FormControl>{render(renderArgs)}</FormControl>
|
|
39
|
+
{renderFormControl ? <FormControl>{render(renderArgs)}</FormControl> : render(renderArgs)}
|
|
31
40
|
{description && <FormDescription>{description}</FormDescription>}
|
|
32
41
|
<FormMessage />
|
|
33
42
|
</FormItem>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { ControllerRenderProps, FieldPath, FieldValues } from 'react-hook-form';
|
|
2
3
|
import { addDisplayComponent, getDisplayComponent } from '../extension-api/display-component-extensions.js';
|
|
3
4
|
import { addInputComponent, getInputComponent } from '../extension-api/input-component-extensions.js';
|
|
4
5
|
|
|
@@ -13,9 +14,10 @@ export interface DataDisplayComponentProps {
|
|
|
13
14
|
[key: string]: any;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
export interface DataInputComponentProps
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
export interface DataInputComponentProps<
|
|
18
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
19
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
20
|
+
> extends ControllerRenderProps<TFieldValues, TName> {
|
|
19
21
|
[key: string]: any;
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from '../document-introspection/get-document-structure.js';
|
|
18
18
|
|
|
19
19
|
import { TranslatableFormFieldWrapper } from '@/vdb/components/shared/translatable-form-field.js';
|
|
20
|
+
import { FormControl } from '@/vdb/components/ui/form.js';
|
|
20
21
|
import { ControllerRenderProps, FieldPath, FieldValues } from 'react-hook-form';
|
|
21
22
|
import { useComponentRegistry } from '../component-registry/component-registry.js';
|
|
22
23
|
import { generateInputComponentKey } from '../extension-api/input-component-extensions.js';
|
|
@@ -120,23 +121,31 @@ function FieldInputRenderer<
|
|
|
120
121
|
return <InputComponent {...field} />;
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
124
|
+
const DefaultComponent = () => {
|
|
125
|
+
switch (fieldInfo.type) {
|
|
126
|
+
case 'Int':
|
|
127
|
+
case 'Float':
|
|
128
|
+
return (
|
|
129
|
+
<Input
|
|
130
|
+
type="number"
|
|
131
|
+
value={field.value}
|
|
132
|
+
onChange={e => field.onChange(e.target.valueAsNumber)}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
case 'DateTime':
|
|
136
|
+
return <DateTimeInput {...field} />;
|
|
137
|
+
case 'Boolean':
|
|
138
|
+
return <Checkbox value={field.value} onCheckedChange={field.onChange} />;
|
|
139
|
+
default:
|
|
140
|
+
return <Input {...field} />;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<FormControl>
|
|
146
|
+
<DefaultComponent />
|
|
147
|
+
</FormControl>
|
|
148
|
+
);
|
|
140
149
|
}
|
|
141
150
|
|
|
142
151
|
/**
|
|
@@ -227,6 +236,7 @@ export function DetailPage<
|
|
|
227
236
|
control={form.control}
|
|
228
237
|
name={fieldInfo.name as never}
|
|
229
238
|
label={fieldInfo.name}
|
|
239
|
+
renderFormControl={false}
|
|
230
240
|
render={({ field }) => (
|
|
231
241
|
<FieldInputRenderer
|
|
232
242
|
fieldInfo={fieldInfo}
|
|
@@ -249,6 +259,7 @@ export function DetailPage<
|
|
|
249
259
|
control={form.control}
|
|
250
260
|
name={fieldInfo.name as never}
|
|
251
261
|
label={fieldInfo.name}
|
|
262
|
+
renderFormControl={false}
|
|
252
263
|
render={({ field }) => (
|
|
253
264
|
<FieldInputRenderer
|
|
254
265
|
fieldInfo={fieldInfo}
|
package/src/lib/index.ts
CHANGED
|
@@ -8,11 +8,10 @@ export * from './components/data-input/affixed-input.js';
|
|
|
8
8
|
export * from './components/data-input/customer-group-input.js';
|
|
9
9
|
export * from './components/data-input/datetime-input.js';
|
|
10
10
|
export * from './components/data-input/facet-value-input.js';
|
|
11
|
-
export * from './components/data-input/index.js';
|
|
12
11
|
export * from './components/data-input/money-input.js';
|
|
13
12
|
export * from './components/data-input/relation-input.js';
|
|
14
13
|
export * from './components/data-input/relation-selector.js';
|
|
15
|
-
export * from './components/data-input/
|
|
14
|
+
export * from './components/data-input/rich-text-input.js';
|
|
16
15
|
export * from './components/data-table/add-filter-menu.js';
|
|
17
16
|
export * from './components/data-table/data-table-bulk-action-item.js';
|
|
18
17
|
export * from './components/data-table/data-table-bulk-actions.js';
|
|
@@ -187,6 +186,10 @@ export * from './framework/page/use-detail-page.js';
|
|
|
187
186
|
export * from './framework/page/use-extended-router.js';
|
|
188
187
|
export * from './framework/registry/global-registry.js';
|
|
189
188
|
export * from './framework/registry/registry-types.js';
|
|
189
|
+
export * from './graphql/api.js';
|
|
190
|
+
export * from './graphql/common-operations.js';
|
|
191
|
+
export * from './graphql/fragments.js';
|
|
192
|
+
export * from './graphql/graphql.js';
|
|
190
193
|
export * from './hooks/use-auth.js';
|
|
191
194
|
export * from './hooks/use-channel.js';
|
|
192
195
|
export * from './hooks/use-custom-field-config.js';
|
|
@@ -203,7 +206,3 @@ export * from './hooks/use-theme.js';
|
|
|
203
206
|
export * from './hooks/use-user-settings.js';
|
|
204
207
|
export * from './lib/trans.js';
|
|
205
208
|
export * from './lib/utils.js';
|
|
206
|
-
export * from './graphql/api.js';
|
|
207
|
-
export * from './graphql/common-operations.js';
|
|
208
|
-
export * from './graphql/fragments.js';
|
|
209
|
-
export * from './graphql/graphql.js';
|