@capillarytech/blaze-ui 5.21.0 → 5.22.0
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/CapLanguageProvider/actions.js +125 -0
- package/CapLanguageProvider/actions.js.map +1 -0
- package/CapLanguageProvider/constants.js +37 -0
- package/CapLanguageProvider/constants.js.map +1 -0
- package/package.json +1 -1
- package/CapActionBar/README.md +0 -11
- package/CapAdvancedIcon/README.md +0 -185
- package/CapAdvancedIcon/use-cases.md +0 -44
- package/CapAlert/README.md +0 -144
- package/CapAppNotEnabled/README.md +0 -84
- package/CapAskAira/README.md +0 -328
- package/CapBanner/README.md +0 -4
- package/CapBlock/README.md +0 -175
- package/CapBorderedBox/Status.md +0 -40
- package/CapCSVFileUploader/README.md +0 -124
- package/CapCSVFileUploader/Status.md +0 -47
- package/CapCard/README.md +0 -85
- package/CapCard/Status.md +0 -41
- package/CapCardBox/README.md +0 -169
- package/CapCardBox/Status.md +0 -52
- package/CapCarousel/README.md +0 -190
- package/CapCarousel/Status.md +0 -73
- package/CapCheckbox/README.md +0 -254
- package/CapCheckbox/Status.md +0 -41
- package/CapColorPicker/README.md +0 -112
- package/CapColorPicker/Status.md +0 -52
- package/CapColorPicker/tests/USE_CASES_ANALYSIS.md +0 -92
- package/CapColoredTag/README.md +0 -167
- package/CapColoredTag/Status.md +0 -49
- package/CapConditionPreview/MIGRATION_ANALYSIS.md +0 -70
- package/CapConditionPreview/README.md +0 -40
- package/CapConditionPreview/tests/USE_CASES_CapConditionPreview.md +0 -65
- package/CapCustomCard/README.md +0 -182
- package/CapCustomCard/Status.md +0 -40
- package/CapCustomCarousel/Status.md +0 -69
- package/CapCustomCheckboxList/README.md +0 -178
- package/CapCustomCheckboxList/Status.md +0 -52
- package/CapCustomCheckboxList/tests/USE_CASES_ANALYSIS.md +0 -174
- package/CapCustomList/README.md +0 -117
- package/CapCustomList/Status.md +0 -77
- package/CapCustomList/tests/USE_CASES_ANALYSIS.md +0 -124
- package/CapCustomSelect/README.md +0 -38
- package/CapDatePicker/README.md +0 -139
- package/CapDateRangePicker/README.md +0 -159
- package/CapDateTimePicker/README.md +0 -136
- package/CapDateTimeRangePicker/README.md +0 -243
- package/CapDivider/README.md +0 -122
- package/CapDrawer/README.md +0 -207
- package/CapDrawer/Status.md +0 -52
- package/CapDrawer/tests/MISSING_USE_CASES.md +0 -170
- package/CapDropdown/README.md +0 -515
- package/CapDropdown/Status.md +0 -45
- package/CapDropdown/tests/USE_CASES_ANALYSIS.md +0 -137
- package/CapError/README.md +0 -88
- package/CapErrorBoundary/CapErrorBoundary-use-cases.md +0 -89
- package/CapErrorBoundary/README.md +0 -150
- package/CapErrorStateIllustration/README.md +0 -222
- package/CapErrorStateIllustration/USE_CASES.md +0 -33
- package/CapExpressionEditor/README.md +0 -32
- package/CapForm/README.md +0 -132
- package/CapForm/Status.md +0 -40
- package/CapForm/tests/PHASE1_UNFULFILLED_USE_CASES.md +0 -113
- package/CapForm/tests/USE_CASES_ANALYSIS.md +0 -119
- package/CapFormItem/README.md +0 -320
- package/CapFormItem/Status.md +0 -73
- package/CapFormItem/tests/USE_CASES_ANALYSIS.md +0 -84
- package/CapGraph/README.md +0 -69
- package/CapGraph/USE_CASES.md +0 -66
- package/CapHamburgerMenu/README.md +0 -234
- package/CapHamburgerMenu/USE_CASES.md +0 -48
- package/CapHeader/Status.md +0 -41
- package/CapHeading/README.md +0 -220
- package/CapHeading/Status.md +0 -41
- package/CapIcon/README.md +0 -207
- package/CapIllustration/Status.md +0 -41
- package/CapImage/README.md +0 -50
- package/CapImportMFEComponent/README.md +0 -121
- package/CapInfoNote/Status.md +0 -40
- package/CapInfoNote/tests/USE_CASES_ANALYSIS.md +0 -114
- package/CapInput/README.md +0 -196
- package/CapInput/Status.md +0 -123
- package/CapInput/tests/USE_CASES_ANALYSIS.md +0 -169
- package/CapLanguageProvider/CapLanguageProvider-use-cases.md +0 -56
- package/CapLanguageProvider/README.md +0 -206
- package/CapLevelGraphRenderer/CapLevelGraphRenderer-test-cases.md +0 -50
- package/CapLevelGraphRenderer/README.md +0 -123
- package/CapLevelGraphRenderer/Tooltip_MIGRATION_ANALYSIS.md +0 -120
- package/CapLink/README.md +0 -203
- package/CapLink/Status.md +0 -32
- package/CapLink/tests/CapLink.missingUseCases.md +0 -95
- package/CapList/README.md +0 -129
- package/CapList/Status.md +0 -69
- package/CapListLayout/README.md +0 -7
- package/CapLogin/README.md +0 -7
- package/CapMenu/README.md +0 -86
- package/CapModal/README.md +0 -357
- package/CapModal/Status.md +0 -52
- package/CapModal/tests/USE_CASES_GAPS.md +0 -207
- package/CapMultiSelect/README.md +0 -170
- package/CapMultiSelect/tests/USE_CASES_ANALYSIS.md +0 -29
- package/CapMultiSelectDatePicker/README.md +0 -11
- package/CapNavigation/README.md +0 -72
- package/CapNotification/README.md +0 -228
- package/CapNotificationDropdown/README.md +0 -5
- package/CapPopover/README.md +0 -234
- package/CapProgress/Status.md +0 -40
- package/CapRadio/Status.md +0 -54
- package/CapRadioButton/README.md +0 -152
- package/CapRadioButton/Status.md +0 -70
- package/CapRadioButton/tests/USE_CASES_ANALYSIS.md +0 -120
- package/CapRadioCard/README.md +0 -161
- package/CapRadioCard/Status.md +0 -78
- package/CapRadioGroup/README.md +0 -141
- package/CapRadioGroup/Status.md +0 -59
- package/CapReorderComponent/README.md +0 -179
- package/CapReorderComponent/Status.md +0 -41
- package/CapRoadMap/README.md +0 -126
- package/CapRoadMap/Status.md +0 -53
- package/CapRoadMap/tests/USE_CASE_GAPS.md +0 -92
- package/CapRow/README.md +0 -424
- package/CapSKUUploader/README.md +0 -189
- package/CapSKUUploader/Status.md +0 -66
- package/CapSecondaryTopBar/README.md +0 -7
- package/CapSelect/README.md +0 -243
- package/CapSelectFilter/README.md +0 -121
- package/CapShape/README.md +0 -96
- package/CapShape/Status.md +0 -36
- package/CapShape/tests/USE_CASES_ANALYSIS.md +0 -120
- package/CapSideBar/README.md +0 -298
- package/CapSideBar/Status.md +0 -5
- package/CapSlideBox/README.md +0 -68
- package/CapSlider/README.md +0 -423
- package/CapSlider/Status.md +0 -48
- package/CapSlider/tests/TEST_COVERAGE.md +0 -118
- package/CapSnackBar/README.md +0 -222
- package/CapSnackBar/Status.md +0 -41
- package/CapSomethingWentWrong/README.md +0 -97
- package/CapSplit/README.md +0 -19
- package/CapStatisticCard/README.md +0 -138
- package/CapStatus/README.md +0 -148
- package/CapStatus/Status.md +0 -40
- package/CapSteps/Status.md +0 -40
- package/CapStepsAccordian/README.md +0 -305
- package/CapStepsAccordian/Status.md +0 -48
- package/CapSupportVideosWrapper/README.md +0 -14
- package/CapSwitch/README.md +0 -351
- package/CapTab/README.md +0 -406
- package/CapTab/Status.md +0 -104
- package/CapTab/tests/USE_CASE_GAPS.md +0 -143
- package/CapTabV3/ANALYSIS.md +0 -60
- package/CapTabV3/README.md +0 -156
- package/CapTabV3/Status.md +0 -52
- package/CapTabV3/tests/USE_CASE_GAPS.md +0 -149
- package/CapTable/README.md +0 -160
- package/CapTable/Status.md +0 -41
- package/CapTag/README.md +0 -16
- package/CapTagDropdown/README.md +0 -171
- package/CapTagDropdown/Status.md +0 -55
- package/CapTimePicker/README.md +0 -170
- package/CapTooltip/README.md +0 -336
- package/CapTooltipWithInfo/Status.md +0 -75
- package/CapTopBar/README.md +0 -146
- package/CapTree/README.md +0 -124
- package/CapTree/Status.md +0 -48
- package/CapTree/tests/STATUS.md +0 -154
- package/CapTreeSelect/README.md +0 -217
- package/CapTreeSelect/Status.md +0 -52
- package/CapTruncateList/README.md +0 -13
- package/CapUnifiedSelect/README.md +0 -40
- package/CapUploader/README.md +0 -313
- package/CapUploader/Status.md +0 -76
- package/CapUploader/tests/USE_CASES_ANALYSIS.md +0 -225
- package/CapUserProfile/README.md +0 -105
- package/CapUserProfile/Status.md +0 -95
- package/CapVirtualList/README.md +0 -162
- package/CapVirtualList/Status.md +0 -71
- package/assets/HOCs/ComponentWithLabelHOC/README.md +0 -230
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
# CapLanguageProvider
|
|
2
|
-
|
|
3
|
-
A wrapper component that provides internationalization (i18n) support for Capillary applications by integrating Ant Design's ConfigProvider, React Intl's IntlProvider, and Locize translation management.
|
|
4
|
-
|
|
5
|
-
## Migration from Ant Design v3 to v6
|
|
6
|
-
|
|
7
|
-
This component has been migrated from Ant Design v3 to v6 with the following changes:
|
|
8
|
-
|
|
9
|
-
### Breaking Changes
|
|
10
|
-
|
|
11
|
-
**None** - The component maintains full backward compatibility. No API changes were required.
|
|
12
|
-
|
|
13
|
-
### Code Improvements
|
|
14
|
-
|
|
15
|
-
1. **Removed PropTypes**: All PropTypes have been removed and replaced with TypeScript interfaces in `types.ts`
|
|
16
|
-
2. **Type Safety**: Full TypeScript support with exported types for all interfaces
|
|
17
|
-
3. **Code Organization**: All type definitions moved to dedicated `types.ts` file
|
|
18
|
-
4. **Documentation**: Added comprehensive JSDoc comments for better developer experience
|
|
19
|
-
|
|
20
|
-
### What Stayed the Same
|
|
21
|
-
|
|
22
|
-
- All props and their behavior
|
|
23
|
-
- Redux integration pattern (connect HOC)
|
|
24
|
-
- Locale loading logic (user.iso_lang → localStorage.locale → default)
|
|
25
|
-
- Locale format conversion (hyphen/underscore handling)
|
|
26
|
-
- Spinner visibility logic
|
|
27
|
-
- Login page skip behavior
|
|
28
|
-
- Moment and dayjs locale synchronization
|
|
29
|
-
- Antd locale dynamic import with fallback
|
|
30
|
-
|
|
31
|
-
### What Changed
|
|
32
|
-
|
|
33
|
-
- **Removed**: PropTypes imports and static propTypes assignments
|
|
34
|
-
- **Added**: TypeScript types in `types.ts`
|
|
35
|
-
- **Improved**: Type safety with exported interfaces
|
|
36
|
-
|
|
37
|
-
## Usage
|
|
38
|
-
|
|
39
|
-
```tsx
|
|
40
|
-
import { CapLanguageProvider } from '@capillarytech/blaze-ui';
|
|
41
|
-
|
|
42
|
-
function App() {
|
|
43
|
-
return (
|
|
44
|
-
<CapLanguageProvider>
|
|
45
|
-
<YourApp />
|
|
46
|
-
</CapLanguageProvider>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Props
|
|
52
|
-
|
|
53
|
-
| Prop | Type | Default | Description |
|
|
54
|
-
|------|------|---------|-------------|
|
|
55
|
-
| `user` | `UserData` | `undefined` | User data object containing `iso_lang` property |
|
|
56
|
-
| `actions` | `Actions` | `undefined` | Redux action creators (injected via connect) |
|
|
57
|
-
| `children` | `React.ReactNode` | `undefined` | Child component to wrap |
|
|
58
|
-
| `language` | `LanguageState` | `undefined` | Language state from Redux store |
|
|
59
|
-
| `messages` | `Record<string, string>` | `undefined` | Translation messages object |
|
|
60
|
-
| `supportedLocalesDetails` | `SupportedLocalesDetails` | `undefined` | Supported locales details from Redux |
|
|
61
|
-
| `className` | `string` | `undefined` | CSS class name for the spinner wrapper |
|
|
62
|
-
| `spinnerVisible` | `boolean` | `true` | Whether to show loading spinner |
|
|
63
|
-
| `supportedLocalesApi` | `string` | `undefined` | API endpoint for fetching supported locales |
|
|
64
|
-
| `locizeApi` | `string` | `undefined` | API endpoint for fetching Locize translations |
|
|
65
|
-
|
|
66
|
-
## Locale Loading Priority
|
|
67
|
-
|
|
68
|
-
The component loads locales in the following priority order:
|
|
69
|
-
|
|
70
|
-
1. **User ISO Language** (`user.iso_lang`) - Highest priority
|
|
71
|
-
2. **LocalStorage Locale** (`localStorage.getItem('locale')`) - Fallback
|
|
72
|
-
3. **Default** (`en-US`) - Final fallback
|
|
73
|
-
|
|
74
|
-
## Locale Format Conversion
|
|
75
|
-
|
|
76
|
-
The component automatically converts locale formats for different libraries:
|
|
77
|
-
|
|
78
|
-
- **Antd**: Uses underscore format (e.g., `en_US`, `fr_FR`)
|
|
79
|
-
- **React Intl**: Uses 2-letter format (e.g., `en`, `fr`)
|
|
80
|
-
- **Locize**: Uses the mapped `locize_locale` from `supportedLocales`
|
|
81
|
-
|
|
82
|
-
### Examples
|
|
83
|
-
|
|
84
|
-
| Input | Antd Format | React Intl Format | Locize Format |
|
|
85
|
-
|-------|-------------|------------------|---------------|
|
|
86
|
-
| `en_US` | `en_US` | `en` | `en-US` (from supportedLocales) |
|
|
87
|
-
| `en-US` | `en_US` | `en` | `en-US` (from supportedLocales) |
|
|
88
|
-
| `fr-FR` | `fr_FR` | `fr` | `fr-FR` (from supportedLocales) |
|
|
89
|
-
|
|
90
|
-
## Spinner Visibility
|
|
91
|
-
|
|
92
|
-
The spinner is shown when:
|
|
93
|
-
- `spinnerVisible` is `true` (default)
|
|
94
|
-
- Not on login page (`/login` path)
|
|
95
|
-
- AND (`language.localeLoading === 'REQUEST'` OR `supportedLocalesDetails.fetchSupportedLocalesStatus === 'REQUEST'`)
|
|
96
|
-
|
|
97
|
-
## Login Page Behavior
|
|
98
|
-
|
|
99
|
-
When the component detects it's on a login page (`/login` path):
|
|
100
|
-
- `getSupportedLocales` is called with `isSkip: true`
|
|
101
|
-
- `getLocizeMessage` is called with `isSkip: true`
|
|
102
|
-
- Spinner never shows, regardless of loading state
|
|
103
|
-
|
|
104
|
-
## Redux Integration
|
|
105
|
-
|
|
106
|
-
The component uses Redux connect HOC to inject:
|
|
107
|
-
- `language` state from `makeSelectLanguage()` selector
|
|
108
|
-
- `supportedLocalesDetails` state from `makeSelectSupportedLocalesDetails()` selector
|
|
109
|
-
- `actions` from `bindActionCreators(action, dispatch)`
|
|
110
|
-
|
|
111
|
-
## Date Library Synchronization
|
|
112
|
-
|
|
113
|
-
The component synchronizes locale settings for both Moment.js and Day.js:
|
|
114
|
-
- `moment.locale(locale)` - Sets Moment.js locale
|
|
115
|
-
- `dayjs.locale(locale)` - Sets Day.js locale
|
|
116
|
-
|
|
117
|
-
Both libraries are kept in sync when the locale changes.
|
|
118
|
-
|
|
119
|
-
## TypeScript Support
|
|
120
|
-
|
|
121
|
-
All types are exported from the component:
|
|
122
|
-
|
|
123
|
-
```tsx
|
|
124
|
-
import type {
|
|
125
|
-
CapLanguageProviderProps,
|
|
126
|
-
SupportedLocale,
|
|
127
|
-
UserData,
|
|
128
|
-
LanguageState,
|
|
129
|
-
Actions,
|
|
130
|
-
SupportedLocalesDetails,
|
|
131
|
-
} from '@capillarytech/blaze-ui';
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Examples
|
|
135
|
-
|
|
136
|
-
### Basic Usage
|
|
137
|
-
|
|
138
|
-
```tsx
|
|
139
|
-
import { CapLanguageProvider } from '@capillarytech/blaze-ui';
|
|
140
|
-
|
|
141
|
-
function App() {
|
|
142
|
-
return (
|
|
143
|
-
<CapLanguageProvider>
|
|
144
|
-
<YourApp />
|
|
145
|
-
</CapLanguageProvider>
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### With Custom Messages
|
|
151
|
-
|
|
152
|
-
```tsx
|
|
153
|
-
import { CapLanguageProvider } from '@capillarytech/blaze-ui';
|
|
154
|
-
|
|
155
|
-
const messages = {
|
|
156
|
-
'app.title': 'My Application',
|
|
157
|
-
'app.welcome': 'Welcome!',
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
function App() {
|
|
161
|
-
return (
|
|
162
|
-
<CapLanguageProvider messages={messages}>
|
|
163
|
-
<YourApp />
|
|
164
|
-
</CapLanguageProvider>
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### With Custom Spinner ClassName
|
|
170
|
-
|
|
171
|
-
```tsx
|
|
172
|
-
import { CapLanguageProvider } from '@capillarytech/blaze-ui';
|
|
173
|
-
|
|
174
|
-
function App() {
|
|
175
|
-
return (
|
|
176
|
-
<CapLanguageProvider className="custom-spinner-wrapper">
|
|
177
|
-
<YourApp />
|
|
178
|
-
</CapLanguageProvider>
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
### With API Endpoints
|
|
184
|
-
|
|
185
|
-
```tsx
|
|
186
|
-
import { CapLanguageProvider } from '@capillarytech/blaze-ui';
|
|
187
|
-
|
|
188
|
-
function App() {
|
|
189
|
-
return (
|
|
190
|
-
<CapLanguageProvider
|
|
191
|
-
supportedLocalesApi="/api/supported-locales"
|
|
192
|
-
locizeApi="/api/locize"
|
|
193
|
-
>
|
|
194
|
-
<YourApp />
|
|
195
|
-
</CapLanguageProvider>
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
## Notes
|
|
201
|
-
|
|
202
|
-
- The component requires a single child element (uses `React.Children.only()`)
|
|
203
|
-
- Locale loading happens asynchronously via Redux actions
|
|
204
|
-
- Antd locale modules are dynamically imported with fallback to `en_US` on error
|
|
205
|
-
- The component logs locale information to console in development
|
|
206
|
-
- Moment.js and Day.js locales are synchronized automatically
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Test Cases: CapLevelGraphRenderer (Antd v3→v6)
|
|
2
|
-
|
|
3
|
-
## Component Analysis
|
|
4
|
-
- **Component**: CapLevelGraphRenderer
|
|
5
|
-
- **Complexity**: medium
|
|
6
|
-
- **Source**: blaze-ui/components/CapLevelGraphRenderer/
|
|
7
|
-
- **Dependencies**: @antv/x6, React, CapButton, CapIcon
|
|
8
|
-
- **Key Features**: Graph rendering with nodes, forward/reverse connections, pagination, tooltips
|
|
9
|
-
|
|
10
|
-
## Test Cases (≤20 for medium complexity)
|
|
11
|
-
|
|
12
|
-
| ID | Use Case | Props/Config | Expected Visual/Behavior | Priority | Storybook Story | Notes |
|
|
13
|
-
|---|---|---|---|---|---|---|
|
|
14
|
-
| UC-001 | Basic rendering with nodes and connections | `nodes=[{id: 'tier1', height: 295, component: MockComponent}, {id: 'tier2', height: 500, component: MockComponent}]`, `connections=[{sourceId: 'tier2', targetId: 'tier1'}]`, `graphId="test-graph"` | Graph renders with 2 nodes, forward connection between nodes, reverse connection visible, pagination controls visible | P0 | BasicRendering | Core functionality - must render graph |
|
|
15
|
-
| UC-002 | Empty state - no nodes | `nodes=[]`, `connections=[]`, `graphId="test-graph"` | Graph container renders, no nodes visible, pagination buttons disabled, no errors | P1 | EmptyState | Edge case - empty data |
|
|
16
|
-
| UC-003 | Single node without connections | `nodes=[{id: 'tier1', height: 295, component: MockComponent}]`, `connections=[]`, `graphId="test-graph"` | Single node renders, no connections drawn, pagination buttons disabled | P1 | SingleNode | Minimal valid state |
|
|
17
|
-
| UC-004 | Multiple nodes with forward connections only | `nodes=[{id: 'tier1', height: 200}, {id: 'tier2', height: 300}, {id: 'tier3', height: 250}]`, `connections=[]`, `graphId="test-graph"` | 3 nodes render in sequence, forward connections between adjacent nodes visible, no reverse connections | P0 | ForwardConnections | Default forward connection behavior |
|
|
18
|
-
| UC-005 | Reverse connections - level by level | `nodes=[{id: 'tier1', height: 200}, {id: 'tier2', height: 300}, {id: 'tier3', height: 250}]`, `connections=[{sourceId: 'tier3', targetId: 'tier1'}, {sourceId: 'tier2', targetId: 'tier1'}]`, `graphId="test-graph"` | Reverse connections render at different levels, avoid overlapping nodes, connections properly routed | P0 | ReverseConnections | Core reverse connection algorithm |
|
|
19
|
-
| UC-006 | All styling props | `className="custom-class"`, `graphStyles={{border: '1px solid red'}}`, `containerStyles={{padding: '10px'}}`, `scrollClassName="custom-scroll"`, `graphId="test-graph"` | Custom classes and styles applied to respective containers, visual styling visible | P1 | StylingProps | Grouped all style-related props |
|
|
20
|
-
| UC-007 | All layout/dimension props | `graphWidth="800px"`, `graphHeight="600px"`, `defaultStartX=50`, `defaultStartY=50`, `offsetHeight=30`, `defaultEleWidth=150`, `defaultEleDistance=40`, `offsetLineDistance=25`, `graphId="test-graph"` | Graph renders at specified dimensions, nodes positioned correctly, spacing matches props | P1 | LayoutProps | Grouped all layout configuration |
|
|
21
|
-
| UC-008 | Connection styling props | `lineStrokeColor="#ff0000"`, `forwardConnProps={{strokeWidth: 3}}`, `reverseConnProps={{strokeDasharray: '5,5'}}`, `graphId="test-graph"` | Forward connections use red color and thicker stroke, reverse connections use dashed style | P1 | ConnectionStyling | Grouped connection appearance props |
|
|
22
|
-
| UC-009 | Tooltip functionality - forward arrows | `showToolTip=true`, `allowForwardArrowTooltip=true`, `nodes=[{id: 'tier1', height: 200, toolTip: 'Tier 1'}, {id: 'tier2', height: 300, toolTip: 'Tier 2'}]`, `connections=[]`, `graphId="test-graph"` | Hovering forward connection shows tooltip with "Tier 1 - Tier 2" format | P1 | ForwardArrowTooltip | Tooltip on forward connections |
|
|
23
|
-
| UC-010 | Tooltip functionality - reverse arrows | `showToolTip=true`, `allowReverseArrowTooltip=true`, `nodes=[{id: 'tier1', height: 200, toolTip: 'Tier 1'}, {id: 'tier2', height: 300, toolTip: 'Tier 2'}]`, `connections=[{sourceId: 'tier2', targetId: 'tier1'}]`, `graphId="test-graph"` | Hovering reverse connection shows tooltip with combined tooltip text | P1 | ReverseArrowTooltip | Tooltip on reverse connections |
|
|
24
|
-
| UC-011 | Tooltip disabled | `showToolTip=false`, `nodes=[{id: 'tier1', height: 200, toolTip: 'Tier 1'}]`, `graphId="test-graph"` | No tooltip appears on hover, tooltip tool not registered | P2 | TooltipDisabled | Tooltip feature toggle |
|
|
25
|
-
| UC-012 | Pagination - previous button interaction | `nodes=[5 nodes with width 100, distance 20]`, `graphWidth="300px"`, `graphId="test-graph"` | Click previous button scrolls graph left, button disabled at start, scroll position updates | P0 | PaginationPrevious | Pagination navigation |
|
|
26
|
-
| UC-013 | Pagination - next button interaction | `nodes=[5 nodes with width 100, distance 20]`, `graphWidth="300px"`, `graphId="test-graph"` | Click next button scrolls graph right, button disabled at end, scroll position updates | P0 | PaginationNext | Pagination navigation |
|
|
27
|
-
| UC-014 | Pagination button states | `nodes=[3 nodes]`, `graphWidth="500px"` (fits all), `graphId="test-graph"` | Both buttons disabled when all nodes visible, buttons enabled when content exceeds viewport | P1 | PaginationStates | Button disabled logic |
|
|
28
|
-
| UC-015 | Scroller props customization | `scrollerProps={{padding: 10, pannable: true}}`, `graphId="test-graph"` | Scroller applies custom padding and panning behavior, graph respects scroller config | P2 | ScrollerProps | Advanced scroller configuration |
|
|
29
|
-
| UC-016 | Node props - component rendering | `nodes=[{id: 'tier1', height: 200, component: CustomComponent, props: {label: 'Test'}}]`, `graphId="test-graph"` | Custom React component renders inside node with passed props, component visible in graph | P0 | NodeComponent | Node content rendering |
|
|
30
|
-
| UC-017 | Complex connection scenarios | `nodes=[4 nodes]`, `connections=[multiple overlapping reverse connections]`, `graphId="test-graph"` | Multiple reverse connections render at different levels, no overlaps, proper routing around nodes | P0 | ComplexConnections | Edge case - complex graph topology |
|
|
31
|
-
| UC-018 | Missing graphId (required prop) | `nodes=[{id: 'tier1', height: 200}]` (no graphId) | Component throws error or handles gracefully, PropTypes validation catches missing prop | P0 | MissingGraphId | Required prop validation |
|
|
32
|
-
| UC-019 | Invalid connections | `nodes=[{id: 'tier1'}, {id: 'tier2'}]`, `connections=[{sourceId: 'invalid', targetId: 'tier1'}]`, `graphId="test-graph"` | Component handles invalid connection gracefully, only valid connections render, no errors | P1 | InvalidConnections | Edge case - invalid data |
|
|
33
|
-
| UC-020 | Migration - antv/x6 Graph API | Standard props with nodes and connections | Graph initializes correctly, nodes and edges added via x6 API, React components render in nodes, events work | P0 | MigrationX6API | Verify @antv/x6 integration works in v6 context |
|
|
34
|
-
|
|
35
|
-
## Grouping Rationale
|
|
36
|
-
|
|
37
|
-
- **UC-006**: Grouped all style props (className, graphStyles, containerStyles, scrollClassName) into single test
|
|
38
|
-
- **UC-007**: Grouped all layout/dimension props (graphWidth, graphHeight, positioning, spacing) into single test
|
|
39
|
-
- **UC-008**: Grouped connection styling props (lineStrokeColor, forwardConnProps, reverseConnProps) into single test
|
|
40
|
-
- **UC-009-011**: Tooltip tests grouped by feature (forward, reverse, disabled)
|
|
41
|
-
- **UC-012-014**: Pagination tests grouped by interaction type (previous, next, states)
|
|
42
|
-
|
|
43
|
-
## Notes
|
|
44
|
-
|
|
45
|
-
- Component uses @antv/x6 Graph library - verify compatibility with Antd v6
|
|
46
|
-
- Tooltip uses custom TooltipTool class extending ToolsView.ToolItem
|
|
47
|
-
- Pagination uses CapButton and CapIcon components
|
|
48
|
-
- Node components render via react-shape in x6
|
|
49
|
-
- Reverse connections use level-based algorithm to avoid overlaps
|
|
50
|
-
- Component requires DOM element with graphId for initialization
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
# CapLevelGraphRenderer
|
|
2
|
-
|
|
3
|
-
Graph renderer component that displays nodes with custom React components and draws level-by-level backward edges using the @antv/x6 Graph library.
|
|
4
|
-
|
|
5
|
-
## Migration (Antd v3 → v6)
|
|
6
|
-
|
|
7
|
-
- **Antd usage**: This component does **not** use any Ant Design components directly. It uses the `@antv/x6` Graph library for rendering. The component uses Cap UI components (`CapButton`, `CapIcon`) for pagination controls. No Antd theme config or API changes apply.
|
|
8
|
-
- **PropTypes removed**: All runtime PropTypes were removed and replaced with TypeScript types from `types.ts`.
|
|
9
|
-
- **defaultProps removed**: All `defaultProps` were removed and converted to destructuring with default values in the function signature.
|
|
10
|
-
- **Styles**: `styles.scss` uses CSS Modules with one `:global` override for Ant Design icon spacing (with mandatory `// OVERRIDE:` comment).
|
|
11
|
-
|
|
12
|
-
## Props
|
|
13
|
-
|
|
14
|
-
See `types.ts` for full interfaces. Main props:
|
|
15
|
-
|
|
16
|
-
| Prop | Type | Description |
|
|
17
|
-
|------|------|-------------|
|
|
18
|
-
| `nodes` | `GraphNode[]` | Array of nodes to render. Each node requires `id`, `component`, `height`, and optionally `props` and `toolTip`. Default: `[]` |
|
|
19
|
-
| `graphId` | `string` | **Required.** Unique identifier for the graph container DOM element. |
|
|
20
|
-
| `connections` | `GraphConnection[]` | Array of connections between nodes. Each connection has `sourceId` and `targetId`. Default: `[]` |
|
|
21
|
-
| `graphWidth` | `number \| string` | Width of the graph container. Default: `'500px'` |
|
|
22
|
-
| `graphHeight` | `number \| string` | Height of the graph container. Default: `'500px'` |
|
|
23
|
-
| `showToolTip` | `boolean` | Whether to show tooltips on edges. Default: `false` |
|
|
24
|
-
| `allowForwardArrowTooltip` | `boolean` | Whether to allow tooltips on forward arrows. Default: `false` |
|
|
25
|
-
| `allowReverseArrowTooltip` | `boolean` | Whether to allow tooltips on reverse arrows. Default: `false` |
|
|
26
|
-
| `defaultEleWidth` | `number` | Default width for each node element. Default: `100` |
|
|
27
|
-
| `defaultEleDistance` | `number` | Default distance between node elements. Default: `20` |
|
|
28
|
-
| `offsetHeight` | `number` | Offset height for connection lines from node top. Default: `20` |
|
|
29
|
-
| `offsetLineDistance` | `number` | Offset distance for reverse connection lines. Default: `18` |
|
|
30
|
-
| `defaultStartX` | `number` | Default starting X coordinate. Default: `0` |
|
|
31
|
-
| `defaultStartY` | `number` | Default starting Y coordinate. Default: `0` |
|
|
32
|
-
| `lineStrokeColor` | `string` | Color for connection lines. Default: `'gray'` |
|
|
33
|
-
| `forwardConnProps` | `Record<string, unknown>` | Props to apply to forward connections. Default: `{}` |
|
|
34
|
-
| `reverseConnProps` | `Record<string, unknown>` | Props to apply to reverse connections. Default: `{}` |
|
|
35
|
-
| `scrollerProps` | `Record<string, unknown>` | Props to pass to the x6 scroller. Default: `{}` |
|
|
36
|
-
| `scrollClassName` | `string` | CSS class name for the scroller. Default: `''` |
|
|
37
|
-
| `graphStyles` | `React.CSSProperties` | Inline styles for the graph container. Default: `{}` |
|
|
38
|
-
| `containerStyles` | `React.CSSProperties` | Inline styles for the container wrapper. Default: `{}` |
|
|
39
|
-
| `className` | `string` | Additional CSS class name. Default: `''` |
|
|
40
|
-
|
|
41
|
-
## Usage
|
|
42
|
-
|
|
43
|
-
```tsx
|
|
44
|
-
import CapLevelGraphRenderer from '@capillarytech/blaze-ui/components/CapLevelGraphRenderer';
|
|
45
|
-
import type { GraphNode, GraphConnection } from '@capillarytech/blaze-ui/components/CapLevelGraphRenderer/types';
|
|
46
|
-
|
|
47
|
-
const MyComponent = () => {
|
|
48
|
-
const nodes: GraphNode[] = [
|
|
49
|
-
{
|
|
50
|
-
id: 'tier1',
|
|
51
|
-
component: MyCustomComponent,
|
|
52
|
-
height: 295,
|
|
53
|
-
props: { label: 'Tier 1' },
|
|
54
|
-
toolTip: 'First Tier',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
id: 'tier2',
|
|
58
|
-
component: MyCustomComponent,
|
|
59
|
-
height: 500,
|
|
60
|
-
props: { label: 'Tier 2' },
|
|
61
|
-
toolTip: 'Second Tier',
|
|
62
|
-
},
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
const connections: GraphConnection[] = [
|
|
66
|
-
{ sourceId: 'tier2', targetId: 'tier1' },
|
|
67
|
-
];
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<CapLevelGraphRenderer
|
|
71
|
-
graphId="my-graph"
|
|
72
|
-
nodes={nodes}
|
|
73
|
-
connections={connections}
|
|
74
|
-
graphWidth="800px"
|
|
75
|
-
graphHeight="600px"
|
|
76
|
-
showToolTip={true}
|
|
77
|
-
allowForwardArrowTooltip={true}
|
|
78
|
-
allowReverseArrowTooltip={true}
|
|
79
|
-
/>
|
|
80
|
-
);
|
|
81
|
-
};
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Features
|
|
85
|
-
|
|
86
|
-
- **Custom Node Components**: Each node can render a custom React component
|
|
87
|
-
- **Forward Connections**: Automatically draws forward connections between adjacent nodes
|
|
88
|
-
- **Reverse Connections**: Calculates and draws reverse connections level-by-level to avoid overlaps
|
|
89
|
-
- **Pagination**: Built-in pagination controls for horizontal scrolling
|
|
90
|
-
- **Tooltips**: Optional tooltips on edges (forward and reverse arrows)
|
|
91
|
-
- **Customizable Styling**: Supports custom styles for graph container, connections, and scroller
|
|
92
|
-
|
|
93
|
-
## Breaking Changes
|
|
94
|
-
|
|
95
|
-
None. This component did not use Ant Design components or deprecated APIs.
|
|
96
|
-
|
|
97
|
-
## Dependencies
|
|
98
|
-
|
|
99
|
-
- `@antv/x6`: Graph rendering library (version: ^1.12.4)
|
|
100
|
-
- `@antv/x6-react-shape`: React shape plugin for x6 (version: ^1.2.3)
|
|
101
|
-
- `classnames`, `lodash` (already in blaze-ui dependencies)
|
|
102
|
-
|
|
103
|
-
## Style Overrides
|
|
104
|
-
|
|
105
|
-
The component uses one `:global` override for Ant Design icon spacing:
|
|
106
|
-
|
|
107
|
-
```scss
|
|
108
|
-
// OVERRIDE: Specific icon spacing override - no token available for nested icon margin within button
|
|
109
|
-
:global {
|
|
110
|
-
& > span + .anticon {
|
|
111
|
-
margin: 0;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
This override is necessary because there's no design token available for nested icon margin within button components.
|
|
117
|
-
|
|
118
|
-
## Notes
|
|
119
|
-
|
|
120
|
-
- The component requires a DOM element with the specified `graphId` to exist before rendering
|
|
121
|
-
- The component uses module-level objects (`nodePostionObj`, `edgeObj`) for state tracking
|
|
122
|
-
- Reverse connections are calculated using a level-based algorithm to prevent overlaps
|
|
123
|
-
- The graph instance is managed via React refs
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# Migration Analysis Report: Tooltip.tsx
|
|
2
|
-
|
|
3
|
-
## STAGE 1: Pre-Analysis
|
|
4
|
-
|
|
5
|
-
### Analysis Report for Tooltip.tsx
|
|
6
|
-
|
|
7
|
-
#### 1. Antd Style Overrides Found
|
|
8
|
-
|
|
9
|
-
| Line # | Old Override | Can Tokenize? | Token Path | Token Value | Override Reason |
|
|
10
|
-
|--------|-------------|---------------|------------|-------------|-----------------|
|
|
11
|
-
| N/A | None | N/A | N/A | N/A | No Antd style overrides found |
|
|
12
|
-
|
|
13
|
-
**Tokenizable overrides**: 0
|
|
14
|
-
**Non-tokenizable overrides**: 0
|
|
15
|
-
**Status**: No Antd style overrides found - will skip theme config update
|
|
16
|
-
|
|
17
|
-
#### 2. API Breaking Changes
|
|
18
|
-
|
|
19
|
-
| Old API | New API | Affected Props |
|
|
20
|
-
|---------|---------|----------------|
|
|
21
|
-
| `visible` (CapTooltip) | `open` (CapTooltip) | Line 27: `visible` prop used |
|
|
22
|
-
|
|
23
|
-
**Note**: The file uses deprecated `visible` prop on CapTooltip component. Should use `open` instead.
|
|
24
|
-
|
|
25
|
-
#### 3. Backward Compatibility Plan
|
|
26
|
-
|
|
27
|
-
| Deprecated Prop | Fallback Logic |
|
|
28
|
-
|----------------|----------------|
|
|
29
|
-
| `visible` (CapTooltip) | Use `open` prop instead (CapTooltip handles backward compatibility internally) |
|
|
30
|
-
|
|
31
|
-
#### 4. Type Definitions Needed
|
|
32
|
-
|
|
33
|
-
- **TooltipToolOptions interface**: Type for constructor props/options
|
|
34
|
-
- `tooltip?: string` - Tooltip text content
|
|
35
|
-
- **Class property types**:
|
|
36
|
-
- `knob: HTMLElement` - DOM element for tooltip rendering
|
|
37
|
-
- `delay: number` - Delay in milliseconds
|
|
38
|
-
- `tooltipVisible: boolean` - Current tooltip visibility state
|
|
39
|
-
- `timer: ReturnType<typeof setTimeout>` - Timer reference
|
|
40
|
-
- **Method parameter types**:
|
|
41
|
-
- `toggleTooltip(visible: boolean): void`
|
|
42
|
-
- `updatePosition(e?: MouseEvent): void`
|
|
43
|
-
- `onMouseMove(e: MouseEvent): void`
|
|
44
|
-
|
|
45
|
-
#### 5. PropTypes Removal
|
|
46
|
-
|
|
47
|
-
- [x] Component uses PropTypes: **NO**
|
|
48
|
-
- [x] PropTypes file exists: **NO**
|
|
49
|
-
- [x] PropTypes imports found: **NO**
|
|
50
|
-
- [x] Component.propTypes assignments found: **NO**
|
|
51
|
-
- **Action Required**: None - no PropTypes found
|
|
52
|
-
|
|
53
|
-
#### 6. DefaultProps Removal
|
|
54
|
-
|
|
55
|
-
- [x] Component uses defaultProps: **NO**
|
|
56
|
-
- [x] Component.defaultProps assignments found: **NO**
|
|
57
|
-
- [x] Old function syntax with props parameter: **NO** (class-based component)
|
|
58
|
-
- [x] Default values assigned inside function body: **YES** (line 10: `this.delay = 100`)
|
|
59
|
-
- **Action Required**: None - defaultProps not used, default value assignment is acceptable for class properties
|
|
60
|
-
|
|
61
|
-
#### 7. External Package Dependencies
|
|
62
|
-
|
|
63
|
-
**External packages found**:
|
|
64
|
-
- `@antv/x6` - Already in package.json (added in main component migration)
|
|
65
|
-
- `react-dom/client` - Already available (React dependency)
|
|
66
|
-
|
|
67
|
-
**Package status**:
|
|
68
|
-
- All dependencies already present
|
|
69
|
-
|
|
70
|
-
#### 8. Component-Specific Notes
|
|
71
|
-
|
|
72
|
-
- Class-based component extending `ToolsView.ToolItem` from @antv/x6
|
|
73
|
-
- Uses React 18 `createRoot` API (already migrated)
|
|
74
|
-
- Uses deprecated `visible` prop on CapTooltip - needs update to `open`
|
|
75
|
-
- Missing TypeScript types for class properties and method parameters
|
|
76
|
-
- Uses DOM manipulation directly (acceptable for x6 tool implementation)
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## STAGE 2: Theme Config Update
|
|
81
|
-
|
|
82
|
-
**Status**: No theme config changes required
|
|
83
|
-
|
|
84
|
-
**Reason**: No Antd style overrides found. Component uses @antv/x6 ToolsView.ToolItem and CapTooltip component.
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## STAGE 3: Implementation Required
|
|
89
|
-
|
|
90
|
-
1. **Add TypeScript types**:
|
|
91
|
-
- Define interface for TooltipToolOptions
|
|
92
|
-
- Add type annotations for class properties
|
|
93
|
-
- Add type annotations for method parameters
|
|
94
|
-
|
|
95
|
-
2. **Fix deprecated prop usage**:
|
|
96
|
-
- Change `visible` to `open` on CapTooltip (line 27)
|
|
97
|
-
|
|
98
|
-
3. **Improve type safety**:
|
|
99
|
-
- Add proper types for DOM elements and event handlers
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## STAGE 3: Implementation Complete
|
|
104
|
-
|
|
105
|
-
All changes have been implemented:
|
|
106
|
-
- ✅ **TypeScript types added**: Created interfaces for TooltipToolOptions, GraphInstance, and CellViewInstance
|
|
107
|
-
- ✅ **Class property types**: Added proper types for knob, delay, tooltipVisible, timer, and root
|
|
108
|
-
- ✅ **Method parameter types**: Added types for toggleTooltip, updatePosition, onMouseMove, onMouseLeave
|
|
109
|
-
- ✅ **Deprecated prop fixed**: Changed `visible` to `open` on CapTooltip (line 84)
|
|
110
|
-
- ✅ **Type safety improved**: Used type assertions for @antv/x6 properties that aren't fully typed
|
|
111
|
-
- ✅ **Cleanup added**: Added proper cleanup in onRemove method (unmount React root, clear timer)
|
|
112
|
-
|
|
113
|
-
**Key Changes**:
|
|
114
|
-
1. Fixed deprecated `visible` prop → `open` prop on CapTooltip
|
|
115
|
-
2. Added TypeScript interfaces for options and x6 instance types
|
|
116
|
-
3. Added proper type annotations for all class properties and methods
|
|
117
|
-
4. Improved cleanup with React root unmounting
|
|
118
|
-
5. Used type assertions for @antv/x6 properties that aren't fully exposed in TypeScript definitions
|
|
119
|
-
|
|
120
|
-
**Migration Status**: ✅ COMPLETE
|