@vendure/dashboard 3.5.3-master-202601300300 → 3.5.3
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/vite/utils/plugin-discovery.js +3 -3
- package/dist/vite/vite-plugin-lingui-babel.d.ts +15 -2
- package/dist/vite/vite-plugin-lingui-babel.js +90 -8
- package/dist/vite/vite-plugin-translations.js +2 -2
- package/package.json +3 -3
- package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +22 -3
- package/src/app/routes/_authenticated/_customers/customers.graphql.ts +1 -0
- package/src/app/routes/_authenticated/_customers/customers.tsx +3 -0
- package/src/app/routes/_authenticated/_orders/components/draft-order-status.tsx +48 -0
- package/src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx +22 -6
- package/src/app/routes/_authenticated/_payment-methods/payment-methods_.$id.tsx +1 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants.graphql.ts +9 -3
- package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +49 -30
- package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +1 -0
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx +1 -0
- package/src/i18n/locales/ar.po +58 -5
- package/src/i18n/locales/en.po +58 -5
- package/src/lib/components/data-input/index.ts +1 -0
- package/src/lib/components/ui/alert.tsx +2 -0
- package/src/lib/framework/extension-api/input-component-extensions.tsx +2 -0
- package/src/lib/framework/form-engine/form-schema-tools.ts +4 -1
- package/src/lib/framework/page/detail-page-route-loader.tsx +6 -4
- package/src/lib/framework/page/detail-page.tsx +22 -37
- package/src/lib/graphql/graphql-env.d.ts +30 -13
- package/src/lib/hooks/use-job-queue-polling.ts +160 -0
package/src/i18n/locales/ar.po
CHANGED
|
@@ -754,6 +754,31 @@ msgstr "تم حذف الملاحظة بنجاح"
|
|
|
754
754
|
msgid "Failed to delete note"
|
|
755
755
|
msgstr "فشل حذف الملاحظة"
|
|
756
756
|
|
|
757
|
+
#. js-lingui-explicit-id
|
|
758
|
+
#: src/i18n/common-strings.ts:43
|
|
759
|
+
#~ msgid "refundReason.CustomerRequest"
|
|
760
|
+
#~ msgstr "طلب العميل"
|
|
761
|
+
|
|
762
|
+
#. js-lingui-explicit-id
|
|
763
|
+
#: src/i18n/common-strings.ts:44
|
|
764
|
+
#~ msgid "refundReason.NotAvailable"
|
|
765
|
+
#~ msgstr "غير متاح"
|
|
766
|
+
|
|
767
|
+
#. js-lingui-explicit-id
|
|
768
|
+
#: src/i18n/common-strings.ts:45
|
|
769
|
+
#~ msgid "refundReason.DamagedInShipping"
|
|
770
|
+
#~ msgstr "تضرر أثناء الشحن"
|
|
771
|
+
|
|
772
|
+
#. js-lingui-explicit-id
|
|
773
|
+
#: src/i18n/common-strings.ts:46
|
|
774
|
+
#~ msgid "refundReason.WrongItem"
|
|
775
|
+
#~ msgstr "منتج خاطئ"
|
|
776
|
+
|
|
777
|
+
#. js-lingui-explicit-id
|
|
778
|
+
#: src/i18n/common-strings.ts:47
|
|
779
|
+
#~ msgid "refundReason.Other"
|
|
780
|
+
#~ msgstr "أخرى"
|
|
781
|
+
|
|
757
782
|
#: src/lib/components/data-table/human-readable-operator.tsx:26
|
|
758
783
|
msgid "!="
|
|
759
784
|
msgstr "!="
|
|
@@ -885,6 +910,10 @@ msgstr "إضافة مجموعة خيارات أخرى"
|
|
|
885
910
|
msgid "Add asset"
|
|
886
911
|
msgstr "إضافة ملف"
|
|
887
912
|
|
|
913
|
+
#: src/app/routes/_authenticated/_orders/components/draft-order-status.tsx:25
|
|
914
|
+
msgid "Add at least one item to the order"
|
|
915
|
+
msgstr "أضف عنصرًا واحدًا على الأقل إلى الطلب"
|
|
916
|
+
|
|
888
917
|
#: src/lib/components/layout/channel-switcher.tsx:212
|
|
889
918
|
msgid "Add channel"
|
|
890
919
|
msgstr "إضافة قناة"
|
|
@@ -1827,6 +1856,10 @@ msgstr "اكتمل طلب المسودة"
|
|
|
1827
1856
|
msgid "Draft order deleted"
|
|
1828
1857
|
msgstr "تم حذف طلب المسودة"
|
|
1829
1858
|
|
|
1859
|
+
#: src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx:336
|
|
1860
|
+
msgid "Draft order status"
|
|
1861
|
+
msgstr "حالة طلب المسودة"
|
|
1862
|
+
|
|
1830
1863
|
#: src/lib/components/data-input/custom-field-list-input.tsx:72
|
|
1831
1864
|
msgid "Drag to reorder"
|
|
1832
1865
|
msgstr "اسحب لإعادة الترتيب"
|
|
@@ -1893,7 +1926,7 @@ msgstr "تحرير التخطيط"
|
|
|
1893
1926
|
msgid "Edit link"
|
|
1894
1927
|
msgstr "تحرير الرابط"
|
|
1895
1928
|
|
|
1896
|
-
#: src/app/routes/_authenticated/_zones/zones.tsx:
|
|
1929
|
+
#: src/app/routes/_authenticated/_zones/zones.tsx:40
|
|
1897
1930
|
msgid "Edit members"
|
|
1898
1931
|
msgstr "تحرير الأعضاء"
|
|
1899
1932
|
|
|
@@ -2350,7 +2383,7 @@ msgid "Failed to update global settings"
|
|
|
2350
2383
|
msgstr "فشل تحديث الإعدادات العامة"
|
|
2351
2384
|
|
|
2352
2385
|
#: src/app/routes/_authenticated/_orders/components/order-detail-shared.tsx:92
|
|
2353
|
-
#: src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx:
|
|
2386
|
+
#: src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx:60
|
|
2354
2387
|
msgid "Failed to update order"
|
|
2355
2388
|
msgstr "فشل تحديث الطلب"
|
|
2356
2389
|
|
|
@@ -3352,6 +3385,10 @@ msgstr "إيقاف"
|
|
|
3352
3385
|
msgid "Old email:"
|
|
3353
3386
|
msgstr "البريد الإلكتروني القديم:"
|
|
3354
3387
|
|
|
3388
|
+
#: src/app/routes/_authenticated/_orders/components/draft-order-status.tsx:29
|
|
3389
|
+
msgid "Only draft orders can be completed"
|
|
3390
|
+
msgstr "يمكن إكمال طلبات المسودة فقط"
|
|
3391
|
+
|
|
3355
3392
|
#: src/app/routes/_authenticated/_products/products_.$id_.variants.tsx:269
|
|
3356
3393
|
msgid "Option"
|
|
3357
3394
|
msgstr "الخيار"
|
|
@@ -3417,6 +3454,14 @@ msgstr "تم تحديث الحقول المخصصة للطلب"
|
|
|
3417
3454
|
msgid "Order delivered"
|
|
3418
3455
|
msgstr "تم تسليم الطلب"
|
|
3419
3456
|
|
|
3457
|
+
#: src/app/routes/_authenticated/_orders/components/draft-order-status.tsx:36
|
|
3458
|
+
msgid "Order draft is ready to be completed"
|
|
3459
|
+
msgstr "طلب المسودة جاهز للإكمال"
|
|
3460
|
+
|
|
3461
|
+
#: src/app/routes/_authenticated/_orders/components/draft-order-status.tsx:34
|
|
3462
|
+
msgid "Order draft isn't ready to be completed"
|
|
3463
|
+
msgstr "طلب المسودة غير جاهز للإكمال"
|
|
3464
|
+
|
|
3420
3465
|
#: src/app/routes/_authenticated/_orders/components/order-history/order-history-utils.tsx:75
|
|
3421
3466
|
msgid "Order fulfilled"
|
|
3422
3467
|
msgstr "تم تنفيذ الطلب"
|
|
@@ -3851,7 +3896,7 @@ msgstr "الاستردادات ({0})"
|
|
|
3851
3896
|
msgid "Regenerate slug from source field"
|
|
3852
3897
|
msgstr "إعادة إنشاء الرابط المختصر من الحقل المصدر"
|
|
3853
3898
|
|
|
3854
|
-
#: src/app/routes/_authenticated/_zones/zones.tsx:
|
|
3899
|
+
#: src/app/routes/_authenticated/_zones/zones.tsx:37
|
|
3855
3900
|
msgid "Regions"
|
|
3856
3901
|
msgstr "المناطق"
|
|
3857
3902
|
|
|
@@ -4089,6 +4134,10 @@ msgstr "حدد بلدًا"
|
|
|
4089
4134
|
msgid "Select a currency"
|
|
4090
4135
|
msgstr "حدد عملة"
|
|
4091
4136
|
|
|
4137
|
+
#: src/app/routes/_authenticated/_orders/components/draft-order-status.tsx:23
|
|
4138
|
+
msgid "Select a customer to continue"
|
|
4139
|
+
msgstr "اختر عميلاً للمتابعة"
|
|
4140
|
+
|
|
4092
4141
|
#: src/app/routes/_authenticated/_collections/components/move-collections-dialog.tsx:83
|
|
4093
4142
|
msgid "Select a destination collection"
|
|
4094
4143
|
msgstr "حدد مجموعة وجهة"
|
|
@@ -4213,7 +4262,11 @@ msgstr "طلبات البائعين"
|
|
|
4213
4262
|
msgid "Sellers"
|
|
4214
4263
|
msgstr "البائعون"
|
|
4215
4264
|
|
|
4216
|
-
#: src/app/routes/_authenticated/_orders/
|
|
4265
|
+
#: src/app/routes/_authenticated/_orders/components/draft-order-status.tsx:27
|
|
4266
|
+
msgid "Set a shipping address and select a shipping method"
|
|
4267
|
+
msgstr "قم بتعيين عنوان الشحن واختيار طريقة الشحن"
|
|
4268
|
+
|
|
4269
|
+
#: src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx:414
|
|
4217
4270
|
msgid "Set custom fields"
|
|
4218
4271
|
msgstr "تعيين الحقول المخصصة"
|
|
4219
4272
|
|
|
@@ -4594,7 +4647,7 @@ msgid "Successfully updated global settings"
|
|
|
4594
4647
|
msgstr "تم تحديث الإعدادات العامة بنجاح"
|
|
4595
4648
|
|
|
4596
4649
|
#: src/app/routes/_authenticated/_orders/components/order-detail-shared.tsx:88
|
|
4597
|
-
#: src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx:
|
|
4650
|
+
#: src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx:56
|
|
4598
4651
|
msgid "Successfully updated order"
|
|
4599
4652
|
msgstr "تم تحديث الطلب بنجاح"
|
|
4600
4653
|
|
package/src/i18n/locales/en.po
CHANGED
|
@@ -754,6 +754,31 @@ msgstr "Note deleted successfully"
|
|
|
754
754
|
msgid "Failed to delete note"
|
|
755
755
|
msgstr "Failed to delete note"
|
|
756
756
|
|
|
757
|
+
#. js-lingui-explicit-id
|
|
758
|
+
#: src/i18n/common-strings.ts:43
|
|
759
|
+
#~ msgid "refundReason.CustomerRequest"
|
|
760
|
+
#~ msgstr "Customer request"
|
|
761
|
+
|
|
762
|
+
#. js-lingui-explicit-id
|
|
763
|
+
#: src/i18n/common-strings.ts:44
|
|
764
|
+
#~ msgid "refundReason.NotAvailable"
|
|
765
|
+
#~ msgstr "Item not available"
|
|
766
|
+
|
|
767
|
+
#. js-lingui-explicit-id
|
|
768
|
+
#: src/i18n/common-strings.ts:45
|
|
769
|
+
#~ msgid "refundReason.DamagedInShipping"
|
|
770
|
+
#~ msgstr "Damaged in shipping"
|
|
771
|
+
|
|
772
|
+
#. js-lingui-explicit-id
|
|
773
|
+
#: src/i18n/common-strings.ts:46
|
|
774
|
+
#~ msgid "refundReason.WrongItem"
|
|
775
|
+
#~ msgstr "Wrong item shipped"
|
|
776
|
+
|
|
777
|
+
#. js-lingui-explicit-id
|
|
778
|
+
#: src/i18n/common-strings.ts:47
|
|
779
|
+
#~ msgid "refundReason.Other"
|
|
780
|
+
#~ msgstr "Other"
|
|
781
|
+
|
|
757
782
|
#: src/lib/components/data-table/human-readable-operator.tsx:26
|
|
758
783
|
msgid "!="
|
|
759
784
|
msgstr "!="
|
|
@@ -885,6 +910,10 @@ msgstr "Add another option group"
|
|
|
885
910
|
msgid "Add asset"
|
|
886
911
|
msgstr "Add asset"
|
|
887
912
|
|
|
913
|
+
#: src/app/routes/_authenticated/_orders/components/draft-order-status.tsx:25
|
|
914
|
+
msgid "Add at least one item to the order"
|
|
915
|
+
msgstr "Add at least one item to the order"
|
|
916
|
+
|
|
888
917
|
#: src/lib/components/layout/channel-switcher.tsx:212
|
|
889
918
|
msgid "Add channel"
|
|
890
919
|
msgstr "Add channel"
|
|
@@ -1827,6 +1856,10 @@ msgstr "Draft order completed"
|
|
|
1827
1856
|
msgid "Draft order deleted"
|
|
1828
1857
|
msgstr "Draft order deleted"
|
|
1829
1858
|
|
|
1859
|
+
#: src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx:336
|
|
1860
|
+
msgid "Draft order status"
|
|
1861
|
+
msgstr "Draft order status"
|
|
1862
|
+
|
|
1830
1863
|
#: src/lib/components/data-input/custom-field-list-input.tsx:72
|
|
1831
1864
|
msgid "Drag to reorder"
|
|
1832
1865
|
msgstr "Drag to reorder"
|
|
@@ -1893,7 +1926,7 @@ msgstr "Edit Layout"
|
|
|
1893
1926
|
msgid "Edit link"
|
|
1894
1927
|
msgstr "Edit link"
|
|
1895
1928
|
|
|
1896
|
-
#: src/app/routes/_authenticated/_zones/zones.tsx:
|
|
1929
|
+
#: src/app/routes/_authenticated/_zones/zones.tsx:40
|
|
1897
1930
|
msgid "Edit members"
|
|
1898
1931
|
msgstr "Edit members"
|
|
1899
1932
|
|
|
@@ -2350,7 +2383,7 @@ msgid "Failed to update global settings"
|
|
|
2350
2383
|
msgstr "Failed to update global settings"
|
|
2351
2384
|
|
|
2352
2385
|
#: src/app/routes/_authenticated/_orders/components/order-detail-shared.tsx:92
|
|
2353
|
-
#: src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx:
|
|
2386
|
+
#: src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx:60
|
|
2354
2387
|
msgid "Failed to update order"
|
|
2355
2388
|
msgstr "Failed to update order"
|
|
2356
2389
|
|
|
@@ -3352,6 +3385,10 @@ msgstr "Off"
|
|
|
3352
3385
|
msgid "Old email:"
|
|
3353
3386
|
msgstr "Old email:"
|
|
3354
3387
|
|
|
3388
|
+
#: src/app/routes/_authenticated/_orders/components/draft-order-status.tsx:29
|
|
3389
|
+
msgid "Only draft orders can be completed"
|
|
3390
|
+
msgstr "Only draft orders can be completed"
|
|
3391
|
+
|
|
3355
3392
|
#: src/app/routes/_authenticated/_products/products_.$id_.variants.tsx:269
|
|
3356
3393
|
msgid "Option"
|
|
3357
3394
|
msgstr "Option"
|
|
@@ -3417,6 +3454,14 @@ msgstr "Order custom fields updated"
|
|
|
3417
3454
|
msgid "Order delivered"
|
|
3418
3455
|
msgstr "Order delivered"
|
|
3419
3456
|
|
|
3457
|
+
#: src/app/routes/_authenticated/_orders/components/draft-order-status.tsx:36
|
|
3458
|
+
msgid "Order draft is ready to be completed"
|
|
3459
|
+
msgstr "Order draft is ready to be completed"
|
|
3460
|
+
|
|
3461
|
+
#: src/app/routes/_authenticated/_orders/components/draft-order-status.tsx:34
|
|
3462
|
+
msgid "Order draft isn't ready to be completed"
|
|
3463
|
+
msgstr "Order draft isn't ready to be completed"
|
|
3464
|
+
|
|
3420
3465
|
#: src/app/routes/_authenticated/_orders/components/order-history/order-history-utils.tsx:75
|
|
3421
3466
|
msgid "Order fulfilled"
|
|
3422
3467
|
msgstr "Order fulfilled"
|
|
@@ -3851,7 +3896,7 @@ msgstr "Refunds ({0})"
|
|
|
3851
3896
|
msgid "Regenerate slug from source field"
|
|
3852
3897
|
msgstr "Regenerate slug from source field"
|
|
3853
3898
|
|
|
3854
|
-
#: src/app/routes/_authenticated/_zones/zones.tsx:
|
|
3899
|
+
#: src/app/routes/_authenticated/_zones/zones.tsx:37
|
|
3855
3900
|
msgid "Regions"
|
|
3856
3901
|
msgstr "Regions"
|
|
3857
3902
|
|
|
@@ -4089,6 +4134,10 @@ msgstr "Select a country"
|
|
|
4089
4134
|
msgid "Select a currency"
|
|
4090
4135
|
msgstr "Select a currency"
|
|
4091
4136
|
|
|
4137
|
+
#: src/app/routes/_authenticated/_orders/components/draft-order-status.tsx:23
|
|
4138
|
+
msgid "Select a customer to continue"
|
|
4139
|
+
msgstr "Select a customer to continue"
|
|
4140
|
+
|
|
4092
4141
|
#: src/app/routes/_authenticated/_collections/components/move-collections-dialog.tsx:83
|
|
4093
4142
|
msgid "Select a destination collection"
|
|
4094
4143
|
msgstr "Select a destination collection"
|
|
@@ -4213,7 +4262,11 @@ msgstr "Seller orders"
|
|
|
4213
4262
|
msgid "Sellers"
|
|
4214
4263
|
msgstr "Sellers"
|
|
4215
4264
|
|
|
4216
|
-
#: src/app/routes/_authenticated/_orders/
|
|
4265
|
+
#: src/app/routes/_authenticated/_orders/components/draft-order-status.tsx:27
|
|
4266
|
+
msgid "Set a shipping address and select a shipping method"
|
|
4267
|
+
msgstr "Set a shipping address and select a shipping method"
|
|
4268
|
+
|
|
4269
|
+
#: src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx:414
|
|
4217
4270
|
msgid "Set custom fields"
|
|
4218
4271
|
msgstr "Set custom fields"
|
|
4219
4272
|
|
|
@@ -4594,7 +4647,7 @@ msgid "Successfully updated global settings"
|
|
|
4594
4647
|
msgstr "Successfully updated global settings"
|
|
4595
4648
|
|
|
4596
4649
|
#: src/app/routes/_authenticated/_orders/components/order-detail-shared.tsx:88
|
|
4597
|
-
#: src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx:
|
|
4650
|
+
#: src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx:56
|
|
4598
4651
|
msgid "Successfully updated order"
|
|
4599
4652
|
msgstr "Successfully updated order"
|
|
4600
4653
|
|
|
@@ -4,6 +4,7 @@ export * from './customer-group-input.js';
|
|
|
4
4
|
export * from './datetime-input.js';
|
|
5
5
|
export * from './facet-value-input.js';
|
|
6
6
|
export * from './money-input.js';
|
|
7
|
+
export * from './number-input.js';
|
|
7
8
|
export * from './rich-text-input.js';
|
|
8
9
|
export * from './select-with-options.js';
|
|
9
10
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
CustomerGroupInput,
|
|
5
5
|
FacetValueInput,
|
|
6
6
|
MoneyInput,
|
|
7
|
+
NumberInput,
|
|
7
8
|
ProductMultiInput,
|
|
8
9
|
RichTextInput,
|
|
9
10
|
SelectWithOptions,
|
|
@@ -39,6 +40,7 @@ inputComponents.set('relation-form-input', DefaultRelationInput);
|
|
|
39
40
|
inputComponents.set('select-form-input', SelectWithOptions);
|
|
40
41
|
inputComponents.set('product-multi-form-input', ProductMultiInput);
|
|
41
42
|
inputComponents.set('combination-mode-form-input', CombinationModeInput);
|
|
43
|
+
inputComponents.set('number-form-input', NumberInput);
|
|
42
44
|
inputComponents.set('text-form-input', TextInput);
|
|
43
45
|
|
|
44
46
|
export function getInputComponent(id: string | undefined): DashboardFormComponent | undefined {
|
|
@@ -309,7 +309,10 @@ export function createFormSchemaFromFields(
|
|
|
309
309
|
customFieldConfigs && customFieldConfigs.length > 0
|
|
310
310
|
? processCustomFieldsSchema(customFieldConfigs, isTranslationContext)
|
|
311
311
|
: {};
|
|
312
|
-
|
|
312
|
+
// Use .passthrough() to preserve custom field values that aren't in the schema
|
|
313
|
+
// This is essential for nested entities (e.g., ProductVariantPrice) whose custom
|
|
314
|
+
// field configs aren't passed to the parent form schema builder
|
|
315
|
+
schemaConfig[field.name] = z.object(customFieldsSchema).passthrough().optional();
|
|
313
316
|
} else if (field.typeInfo) {
|
|
314
317
|
const isNestedTranslationContext = field.name === 'translations' || isTranslationContext;
|
|
315
318
|
let nestedType: ZodType = createFormSchemaFromFields(
|
|
@@ -16,7 +16,7 @@ export interface DetailPageRouteLoaderConfig<T extends TypedDocumentNode<any, an
|
|
|
16
16
|
* the detail query document) get correctly applied at the route loader level.
|
|
17
17
|
*/
|
|
18
18
|
pageId?: string;
|
|
19
|
-
queryDocument: T;
|
|
19
|
+
queryDocument: T | (() => T);
|
|
20
20
|
breadcrumb: (
|
|
21
21
|
isNew: boolean,
|
|
22
22
|
entity: DetailEntity<T>,
|
|
@@ -38,12 +38,14 @@ export function detailPageRouteLoader<T extends TypedDocumentNode<any, any>>({
|
|
|
38
38
|
params: any;
|
|
39
39
|
location: ParsedLocation;
|
|
40
40
|
}) => {
|
|
41
|
+
const resolvedQueryDocument = typeof queryDocument === 'function' ? queryDocument() : queryDocument;
|
|
42
|
+
|
|
41
43
|
if (!params.id) {
|
|
42
44
|
throw new Error('ID param is required');
|
|
43
45
|
}
|
|
44
46
|
const isNew = params.id === NEW_ENTITY_PATH;
|
|
45
47
|
const { extendedQuery: extendedQueryDocument } = extendDetailFormQuery(
|
|
46
|
-
addCustomFields(
|
|
48
|
+
addCustomFields(resolvedQueryDocument),
|
|
47
49
|
pageId,
|
|
48
50
|
);
|
|
49
51
|
const result = isNew
|
|
@@ -53,8 +55,8 @@ export function detailPageRouteLoader<T extends TypedDocumentNode<any, any>>({
|
|
|
53
55
|
{ id: params.id },
|
|
54
56
|
);
|
|
55
57
|
|
|
56
|
-
const entityField = getQueryName(
|
|
57
|
-
const entityName = getQueryTypeFieldInfo(
|
|
58
|
+
const entityField = getQueryName(resolvedQueryDocument);
|
|
59
|
+
const entityName = getQueryTypeFieldInfo(resolvedQueryDocument)?.type;
|
|
58
60
|
|
|
59
61
|
if (!isNew && !result[entityField]) {
|
|
60
62
|
throw new Error(`${entityName} with the ID ${params.id} was not found`);
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import { DateTimeInput } from '@/vdb/components/data-input/datetime-input.js';
|
|
2
1
|
import { FormFieldWrapper } from '@/vdb/components/shared/form-field-wrapper.js';
|
|
2
|
+
import { TranslatableFormFieldWrapper } from '@/vdb/components/shared/translatable-form-field.js';
|
|
3
3
|
import { Button } from '@/vdb/components/ui/button.js';
|
|
4
|
-
import { Checkbox } from '@/vdb/components/ui/checkbox.js';
|
|
5
|
-
import { Input } from '@/vdb/components/ui/input.js';
|
|
6
4
|
import { NEW_ENTITY_PATH } from '@/vdb/constants.js';
|
|
5
|
+
import { DefaultInputForType } from '@/vdb/framework/form-engine/default-input-for-type.js';
|
|
7
6
|
import { useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
|
|
8
7
|
import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
9
8
|
import { Trans } from '@lingui/react/macro';
|
|
10
9
|
import { AnyRoute, useNavigate } from '@tanstack/react-router';
|
|
11
10
|
import { ResultOf, VariablesOf } from 'gql.tada';
|
|
12
11
|
import { toast } from 'sonner';
|
|
12
|
+
import { ControllerRenderProps, FieldPath, FieldValues } from 'react-hook-form';
|
|
13
13
|
import {
|
|
14
14
|
FieldInfo,
|
|
15
15
|
getEntityName,
|
|
16
16
|
getOperationVariablesFields,
|
|
17
17
|
} from '../document-introspection/get-document-structure.js';
|
|
18
|
-
|
|
19
|
-
import { NumberInput } from '@/vdb/components/data-input/number-input.js';
|
|
20
|
-
import { TranslatableFormFieldWrapper } from '@/vdb/components/shared/translatable-form-field.js';
|
|
21
|
-
import { FormControl } from '@/vdb/components/ui/form.js';
|
|
22
|
-
import { ControllerRenderProps, FieldPath, FieldValues } from 'react-hook-form';
|
|
23
18
|
import {
|
|
24
19
|
CustomFieldsPageBlock,
|
|
25
20
|
DetailFormGrid,
|
|
@@ -97,6 +92,18 @@ export interface DetailPageFieldProps<
|
|
|
97
92
|
field: ControllerRenderProps<TFieldValues, TName>;
|
|
98
93
|
}
|
|
99
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Maps GraphQL schema types (PascalCase) to form engine types (lowercase)
|
|
97
|
+
*/
|
|
98
|
+
const graphqlTypeMap: Record<string, string> = {
|
|
99
|
+
Int: 'int',
|
|
100
|
+
Float: 'float',
|
|
101
|
+
Boolean: 'boolean',
|
|
102
|
+
DateTime: 'datetime',
|
|
103
|
+
String: 'string',
|
|
104
|
+
ID: 'string',
|
|
105
|
+
};
|
|
106
|
+
|
|
100
107
|
/**
|
|
101
108
|
* Renders form input components based on field type
|
|
102
109
|
*/
|
|
@@ -104,33 +111,13 @@ function FieldInputRenderer<
|
|
|
104
111
|
TFieldValues extends FieldValues = FieldValues,
|
|
105
112
|
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
106
113
|
>({ fieldInfo, field }: DetailPageFieldProps<TFieldValues, TName>) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
);
|
|
115
|
-
case 'DateTime':
|
|
116
|
-
return (
|
|
117
|
-
<FormControl>
|
|
118
|
-
<DateTimeInput {...field} />
|
|
119
|
-
</FormControl>
|
|
120
|
-
);
|
|
121
|
-
case 'Boolean':
|
|
122
|
-
return (
|
|
123
|
-
<FormControl>
|
|
124
|
-
<Checkbox value={field.value} onCheckedChange={field.onChange} />
|
|
125
|
-
</FormControl>
|
|
126
|
-
);
|
|
127
|
-
default:
|
|
128
|
-
return (
|
|
129
|
-
<FormControl>
|
|
130
|
-
<Input {...field} />
|
|
131
|
-
</FormControl>
|
|
132
|
-
);
|
|
133
|
-
}
|
|
114
|
+
const type = graphqlTypeMap[fieldInfo.type] ?? 'string';
|
|
115
|
+
return (
|
|
116
|
+
<DefaultInputForType
|
|
117
|
+
{...field}
|
|
118
|
+
fieldDef={{ type, name: fieldInfo.name } as any}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
134
121
|
}
|
|
135
122
|
|
|
136
123
|
/**
|
|
@@ -219,7 +206,6 @@ export function DetailPage<
|
|
|
219
206
|
control={form.control}
|
|
220
207
|
name={fieldInfo.name as never}
|
|
221
208
|
label={fieldInfo.name}
|
|
222
|
-
renderFormControl={false}
|
|
223
209
|
render={({ field }) => (
|
|
224
210
|
<FieldInputRenderer fieldInfo={fieldInfo} field={field} />
|
|
225
211
|
)}
|
|
@@ -237,7 +223,6 @@ export function DetailPage<
|
|
|
237
223
|
control={form.control}
|
|
238
224
|
name={fieldInfo.name as never}
|
|
239
225
|
label={fieldInfo.name}
|
|
240
|
-
renderFormControl={false}
|
|
241
226
|
render={({ field }) => (
|
|
242
227
|
<FieldInputRenderer fieldInfo={fieldInfo} field={field} />
|
|
243
228
|
)}
|