@object-ui/plugin-detail 3.0.3 → 3.1.1
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/.turbo/turbo-build.log +45 -8
- package/CHANGELOG.md +11 -0
- package/dist/AddressField-B1iVr404.js +96 -0
- package/dist/AutoNumberField-BxnFqllo.js +8 -0
- package/dist/AvatarField-Duw4xOLZ.js +82 -0
- package/dist/BooleanField-CZ4axVeq.js +37 -0
- package/dist/CodeField-BSz-mk2v.js +21 -0
- package/dist/ColorField-B522ad8m.js +42 -0
- package/dist/CurrencyField-Cwr3_pow.js +43 -0
- package/dist/DateField-DCo6dxud.js +21 -0
- package/dist/DateTimeField-BWfBuANO.js +28 -0
- package/dist/EmailField-CpwbdVCU.js +31 -0
- package/dist/FileField-DVAUAJ8e.js +133 -0
- package/dist/FormulaField-CJkkwIK8.js +9 -0
- package/dist/GeolocationField-DNCKitgo.js +123 -0
- package/dist/GridField-DSblZNfp.js +30 -0
- package/dist/ImageField-DBAlnMon.js +90 -0
- package/dist/LocationField-DsHsXA6R.js +31 -0
- package/dist/LookupField-CsT0QQz2.js +96 -0
- package/dist/MasterDetailField-Db8b7Gqs.js +108 -0
- package/dist/NumberField-0IGp7lcA.js +26 -0
- package/dist/ObjectField-BLApgJtS.js +48 -0
- package/dist/PasswordField-pHKyNlmo.js +38 -0
- package/dist/PercentField-CwgKmlIb.js +63 -0
- package/dist/PhoneField-lKtbYOdN.js +31 -0
- package/dist/QRCodeField-BTTasT3w.js +77 -0
- package/dist/RatingField-De2X-l44.js +47 -0
- package/dist/RichTextField-B5QnvUOr.js +38 -0
- package/dist/SelectField-C9AZRHWu.js +26 -0
- package/dist/SignatureField-BgcEmYzd.js +85 -0
- package/dist/SliderField-BzrttVOY.js +30 -0
- package/dist/SummaryField-ugYPYxjP.js +9 -0
- package/dist/TextAreaField-DSE_CaU6.js +39 -0
- package/dist/TextField-DFQ4T9PR.js +32 -0
- package/dist/TimeField-F0cfmsps.js +21 -0
- package/dist/UrlField-DLXrFIH-.js +33 -0
- package/dist/UserField-PXMmxJY9.js +49 -0
- package/dist/VectorField-CKg9jdGa.js +25 -0
- package/dist/index-qQ1C-yUR.js +59976 -0
- package/dist/index.js +32 -55026
- package/dist/index.umd.cjs +41 -30
- package/dist/plugin-detail.css +1 -1
- package/dist/src/ActivityTimeline.d.ts +20 -0
- package/dist/src/ActivityTimeline.d.ts.map +1 -0
- package/dist/src/CommentAttachment.d.ts +25 -0
- package/dist/src/CommentAttachment.d.ts.map +1 -0
- package/dist/src/CommentInput.d.ts +24 -0
- package/dist/src/CommentInput.d.ts.map +1 -0
- package/dist/src/DetailSection.d.ts +8 -0
- package/dist/src/DetailSection.d.ts.map +1 -1
- package/dist/src/DetailView.d.ts +4 -0
- package/dist/src/DetailView.d.ts.map +1 -1
- package/dist/src/DetailView.stories.d.ts +8 -0
- package/dist/src/DetailView.stories.d.ts.map +1 -1
- package/dist/src/DiffView.d.ts +24 -0
- package/dist/src/DiffView.d.ts.map +1 -0
- package/dist/src/FieldChangeItem.d.ts +21 -0
- package/dist/src/FieldChangeItem.d.ts.map +1 -0
- package/dist/src/HeaderHighlight.d.ts +18 -0
- package/dist/src/HeaderHighlight.d.ts.map +1 -0
- package/dist/src/InlineCreateRelated.d.ts +32 -0
- package/dist/src/InlineCreateRelated.d.ts.map +1 -0
- package/dist/src/MentionAutocomplete.d.ts +43 -0
- package/dist/src/MentionAutocomplete.d.ts.map +1 -0
- package/dist/src/PointInTimeRestore.d.ts +28 -0
- package/dist/src/PointInTimeRestore.d.ts.map +1 -0
- package/dist/src/ReactionPicker.d.ts +25 -0
- package/dist/src/ReactionPicker.d.ts.map +1 -0
- package/dist/src/RecordActivityTimeline.d.ts +49 -0
- package/dist/src/RecordActivityTimeline.d.ts.map +1 -0
- package/dist/src/RecordChatterPanel.d.ts +48 -0
- package/dist/src/RecordChatterPanel.d.ts.map +1 -0
- package/dist/src/RecordComments.d.ts +20 -0
- package/dist/src/RecordComments.d.ts.map +1 -0
- package/dist/src/RecordNavigationEnhanced.d.ts +18 -0
- package/dist/src/RecordNavigationEnhanced.d.ts.map +1 -0
- package/dist/src/RelatedList.d.ts +20 -0
- package/dist/src/RelatedList.d.ts.map +1 -1
- package/dist/src/RelationshipGraph.d.ts +23 -0
- package/dist/src/RelationshipGraph.d.ts.map +1 -0
- package/dist/src/RichTextCommentInput.d.ts +24 -0
- package/dist/src/RichTextCommentInput.d.ts.map +1 -0
- package/dist/src/SectionGroup.d.ts +21 -0
- package/dist/src/SectionGroup.d.ts.map +1 -0
- package/dist/src/SubscriptionToggle.d.ts +22 -0
- package/dist/src/SubscriptionToggle.d.ts.map +1 -0
- package/dist/src/ThreadedReplies.d.ts +26 -0
- package/dist/src/ThreadedReplies.d.ts.map +1 -0
- package/dist/src/autoLayout.d.ts +34 -0
- package/dist/src/autoLayout.d.ts.map +1 -0
- package/dist/src/index.d.ts +40 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/useDetailTranslation.d.ts +34 -0
- package/dist/src/useDetailTranslation.d.ts.map +1 -0
- package/package.json +8 -7
- package/src/ActivityTimeline.tsx +184 -0
- package/src/CommentAttachment.tsx +192 -0
- package/src/CommentInput.tsx +81 -0
- package/src/DetailSection.tsx +81 -10
- package/src/DetailView.stories.tsx +76 -0
- package/src/DetailView.tsx +519 -66
- package/src/DiffView.tsx +231 -0
- package/src/FieldChangeItem.tsx +46 -0
- package/src/HeaderHighlight.tsx +67 -0
- package/src/InlineCreateRelated.tsx +291 -0
- package/src/MentionAutocomplete.tsx +123 -0
- package/src/PointInTimeRestore.tsx +261 -0
- package/src/ReactionPicker.tsx +106 -0
- package/src/RecordActivityTimeline.tsx +429 -0
- package/src/RecordChatterPanel.tsx +202 -0
- package/src/RecordComments.tsx +215 -0
- package/src/RecordNavigationEnhanced.tsx +211 -0
- package/src/RelatedList.tsx +314 -19
- package/src/RelationshipGraph.tsx +286 -0
- package/src/RichTextCommentInput.tsx +348 -0
- package/src/SectionGroup.tsx +101 -0
- package/src/SubscriptionToggle.tsx +60 -0
- package/src/ThreadedReplies.tsx +161 -0
- package/src/__tests__/ActivityTimeline.test.tsx +119 -0
- package/src/__tests__/ActivityTimelineFiltering.test.tsx +143 -0
- package/src/__tests__/CommentInput.test.tsx +57 -0
- package/src/__tests__/DetailSection.test.tsx +320 -0
- package/src/__tests__/DetailView.test.tsx +415 -1
- package/src/__tests__/FieldChangeItem.test.tsx +119 -0
- package/src/__tests__/HeaderHighlight.test.tsx +68 -0
- package/src/__tests__/MentionAutocomplete.test.tsx +97 -0
- package/src/__tests__/ReactionPicker.test.tsx +113 -0
- package/src/__tests__/RecordActivityTimeline.test.tsx +395 -0
- package/src/__tests__/RecordChatterPanel.test.tsx +227 -0
- package/src/__tests__/RecordComments.test.tsx +96 -0
- package/src/__tests__/RecordCommentsPinSearch.test.tsx +133 -0
- package/src/__tests__/RelatedList.test.tsx +160 -0
- package/src/__tests__/SectionGroup.test.tsx +101 -0
- package/src/__tests__/SubscriptionToggle.test.tsx +84 -0
- package/src/__tests__/ThreadedReplies.test.tsx +212 -0
- package/src/__tests__/autoLayout.test.ts +184 -0
- package/src/__tests__/phase12-features.test.tsx +583 -0
- package/src/__tests__/roadmap-features.test.tsx +478 -0
- package/src/autoLayout.ts +111 -0
- package/src/index.tsx +50 -0
- package/src/useDetailTranslation.ts +114 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectUI
|
|
3
|
+
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useObjectTranslation } from '@object-ui/react';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Create a safe translation hook with fallback to defaults.
|
|
13
|
+
* Follows the same pattern as useGridTranslation / useListViewTranslation.
|
|
14
|
+
*
|
|
15
|
+
* @param defaults - Fallback English translations keyed by i18n key
|
|
16
|
+
* @param testKey - A key to test if i18n is properly configured
|
|
17
|
+
*/
|
|
18
|
+
export function createSafeTranslationHook(
|
|
19
|
+
defaults: Record<string, string>,
|
|
20
|
+
testKey: string,
|
|
21
|
+
) {
|
|
22
|
+
return function useSafeTranslation() {
|
|
23
|
+
try {
|
|
24
|
+
const result = useObjectTranslation();
|
|
25
|
+
const testValue = result.t(testKey);
|
|
26
|
+
if (testValue === testKey) {
|
|
27
|
+
return {
|
|
28
|
+
t: (key: string, options?: Record<string, unknown>) => {
|
|
29
|
+
let value = defaults[key] || key;
|
|
30
|
+
if (options) {
|
|
31
|
+
for (const [k, v] of Object.entries(options)) {
|
|
32
|
+
value = value.replace(`{{${k}}}`, String(v));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return value;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return { t: result.t };
|
|
40
|
+
} catch {
|
|
41
|
+
return {
|
|
42
|
+
t: (key: string, options?: Record<string, unknown>) => {
|
|
43
|
+
let value = defaults[key] || key;
|
|
44
|
+
if (options) {
|
|
45
|
+
for (const [k, v] of Object.entries(options)) {
|
|
46
|
+
value = value.replace(`{{${k}}}`, String(v));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return value;
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Default English translations for detail view components.
|
|
58
|
+
* Used as fallback when no I18nProvider is available.
|
|
59
|
+
*/
|
|
60
|
+
export const DETAIL_DEFAULT_TRANSLATIONS: Record<string, string> = {
|
|
61
|
+
'detail.back': 'Back',
|
|
62
|
+
'detail.edit': 'Edit',
|
|
63
|
+
'detail.editInline': 'Edit inline',
|
|
64
|
+
'detail.save': 'Save',
|
|
65
|
+
'detail.saveChanges': 'Save changes',
|
|
66
|
+
'detail.editFieldsInline': 'Edit fields inline',
|
|
67
|
+
'detail.share': 'Share',
|
|
68
|
+
'detail.duplicate': 'Duplicate',
|
|
69
|
+
'detail.export': 'Export',
|
|
70
|
+
'detail.viewHistory': 'View history',
|
|
71
|
+
'detail.delete': 'Delete',
|
|
72
|
+
'detail.moreActions': 'More actions',
|
|
73
|
+
'detail.addToFavorites': 'Add to favorites',
|
|
74
|
+
'detail.removeFromFavorites': 'Remove from favorites',
|
|
75
|
+
'detail.previousRecord': 'Previous record',
|
|
76
|
+
'detail.nextRecord': 'Next record',
|
|
77
|
+
'detail.recordOf': '{{current}} of {{total}}',
|
|
78
|
+
'detail.recordNotFound': 'Record not found',
|
|
79
|
+
'detail.recordNotFoundDescription': 'The record you are looking for does not exist or may have been deleted.',
|
|
80
|
+
'detail.goBack': 'Go back',
|
|
81
|
+
'detail.details': 'Details',
|
|
82
|
+
'detail.related': 'Related',
|
|
83
|
+
'detail.relatedRecords': '{{count}} records',
|
|
84
|
+
'detail.relatedRecordOne': '{{count}} record',
|
|
85
|
+
'detail.noRelatedRecords': 'No related records found',
|
|
86
|
+
'detail.loading': 'Loading...',
|
|
87
|
+
'detail.copyToClipboard': 'Copy to clipboard',
|
|
88
|
+
'detail.copied': 'Copied!',
|
|
89
|
+
'detail.deleteConfirmation': 'Are you sure you want to delete this record?',
|
|
90
|
+
'detail.editRecord': 'Edit record',
|
|
91
|
+
'detail.viewAll': 'View All',
|
|
92
|
+
'detail.new': 'New',
|
|
93
|
+
'detail.emptyValue': '—',
|
|
94
|
+
'detail.activity': 'Activity',
|
|
95
|
+
'detail.editRow': 'Edit',
|
|
96
|
+
'detail.deleteRow': 'Delete',
|
|
97
|
+
'detail.deleteRowConfirmation': 'Are you sure you want to delete this record?',
|
|
98
|
+
'detail.actions': 'Actions',
|
|
99
|
+
'detail.previousPage': 'Previous',
|
|
100
|
+
'detail.nextPage': 'Next',
|
|
101
|
+
'detail.pageOf': 'Page {{current}} of {{total}}',
|
|
102
|
+
'detail.sortBy': 'Sort by',
|
|
103
|
+
'detail.filterPlaceholder': 'Filter...',
|
|
104
|
+
'detail.highlightFields': 'Key Fields',
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Translation hook for detail view components.
|
|
109
|
+
* Falls back to DETAIL_DEFAULT_TRANSLATIONS when no I18nProvider is available.
|
|
110
|
+
*/
|
|
111
|
+
export const useDetailTranslation = createSafeTranslationHook(
|
|
112
|
+
DETAIL_DEFAULT_TRANSLATIONS,
|
|
113
|
+
'detail.back',
|
|
114
|
+
);
|