@capillarytech/blaze-ui 5.0.6 → 5.0.7
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/.npmrc +2 -0
- package/CapCondition/messages.d.ts +85 -0
- package/CapCondition/messages.d.ts.map +1 -0
- package/CapConditionPreview/MIGRATION_ANALYSIS.md +70 -0
- package/CapConditionPreview/README.md +40 -0
- package/CapConditionPreview/constants.d.ts +24 -0
- package/CapConditionPreview/constants.d.ts.map +1 -0
- package/CapConditionPreview/index.d.ts +7 -0
- package/CapConditionPreview/index.d.ts.map +1 -0
- package/CapConditionPreview/index.js +131 -183
- package/CapConditionPreview/index.js.map +1 -1
- package/CapConditionPreview/tests/USE_CASES_CapConditionPreview.md +65 -0
- package/CapConditionPreview/types.d.ts +82 -0
- package/CapConditionPreview/types.d.ts.map +1 -0
- package/CapListLayout/index.js +193 -25
- package/CapListLayout/index.js.map +1 -1
- package/CapNavigation/index.js +6 -7
- package/CapNavigation/index.js.map +1 -1
- package/CapSteps/Status.md +40 -0
- package/CapSteps/index.d.ts +30 -0
- package/CapSteps/index.d.ts.map +1 -0
- package/CapSteps/index.js +657 -24
- package/CapSteps/index.js.map +1 -1
- package/CapSteps/types.d.ts +26 -0
- package/CapSteps/types.d.ts.map +1 -0
- package/CapTab/README.md +406 -0
- package/CapTab/Status.md +104 -0
- package/CapTab/index.d.ts +1 -27
- package/CapTab/index.d.ts.map +1 -1
- package/CapTab/index.js +56 -7
- package/CapTab/index.js.map +1 -1
- package/CapTab/tests/USE_CASE_GAPS.md +143 -0
- package/CapTab/types.d.ts +29 -0
- package/CapTab/types.d.ts.map +1 -0
- package/CapTabV3/ANALYSIS.md +60 -0
- package/CapTabV3/README.md +156 -0
- package/CapTabV3/Status.md +52 -0
- package/CapTabV3/index.d.ts +9 -0
- package/CapTabV3/index.d.ts.map +1 -0
- package/CapTabV3/index.js +105 -67
- package/CapTabV3/index.js.map +1 -1
- package/CapTabV3/tests/USE_CASE_GAPS.md +149 -0
- package/CapTabV3/types.d.ts +28 -0
- package/CapTabV3/types.d.ts.map +1 -0
- package/CapTable/README.md +160 -0
- package/CapTable/Status.md +41 -0
- package/CapTable/index.d.ts +2 -21
- package/CapTable/index.d.ts.map +1 -1
- package/CapTable/index.js +193 -25
- package/CapTable/index.js.map +1 -1
- package/CapTable/types.d.ts +46 -0
- package/CapTable/types.d.ts.map +1 -0
- package/CapTable/utils.d.ts +24 -0
- package/CapTable/utils.d.ts.map +1 -0
- package/CapTimePicker/index.js +51 -129
- package/CapTimePicker/index.js.map +1 -1
- package/CapUserProfile/index.js +6 -7
- package/CapUserProfile/index.js.map +1 -1
- package/CapVerticalGroupTable/index.js +193 -25
- package/CapVerticalGroupTable/index.js.map +1 -1
- package/index.d.ts +7 -3
- package/index.d.ts.map +1 -1
- package/index.js +1271 -233
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/utils/getCapThemeConfig.d.ts.map +1 -1
- package/utils/index.js +9 -1
- package/utils/index.js.map +1 -1
- package/.DS_Store +0 -0
- package/CapTimePicker/index.d.ts +0 -11
- package/CapTimePicker/index.d.ts.map +0 -1
- package/CapTimePicker/types.d.ts +0 -95
- package/CapTimePicker/types.d.ts.map +0 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Test Cases: CapConditionPreview (Antd v3→v6)
|
|
2
|
+
|
|
3
|
+
**Component:** CapConditionPreview
|
|
4
|
+
**Complexity:** medium (≤20 test cases)
|
|
5
|
+
**Source:** blaze-ui/components/CapConditionPreview/
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Google Sheets
|
|
10
|
+
|
|
11
|
+
**Spreadsheet ID:** `1Xt8l8Q6Hw0cUYV65SlGvGcPnOtzprr0fukDR9UWJ3kg`
|
|
12
|
+
**Tab:** CapConditionPreview
|
|
13
|
+
|
|
14
|
+
### Steps (run in your environment)
|
|
15
|
+
|
|
16
|
+
1. Check connection: `COMPOSIO_CHECK_ACTIVE_CONNECTION` toolkit="googlesheets"
|
|
17
|
+
2. Create tab: `GOOGLESHEETS_ADD_SHEET` with title `CapConditionPreview`, gridProperties `{ "rowCount": 100, "columnCount": 7 }`
|
|
18
|
+
3. Write data: `GOOGLESHEETS_VALUES_UPDATE` with range `CapConditionPreview!A1` and the values table below.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Use cases table (for Storybook + migration validation)
|
|
23
|
+
|
|
24
|
+
| ID | Use Case | Props/Config | Expected Visual/Behavior | Priority | Storybook Story | Notes |
|
|
25
|
+
|----|----------|--------------|---------------------------|----------|-----------------|--------|
|
|
26
|
+
| UC-001 | All data type and operator variants | type: NUMBER \| STRING \| LIST \| MULTI_SELECT \| STRING_LIST \| ENTRY_TRIGGER_EVENT_ATTRIBUTE \| DATE; operator: EQ, GT, LT, GTE, LTE, IN_RANGE, NEQ, IN, NOT_IN, IS_EXACT_DATE, IS_BEFORE_DATE, IS_AFTER_DATE, IS_INBETWEEN_DATES, IS_BEFORE_DAYS, IS_AFTER_DAYS; operand/listData/dateTypeData as needed | Correct label and value for each type and operator (e.g. "greater than" + "42" for NUMBER+GT; "Include whose … is on 1/15/2024" for DATE SINGLE) | P0 | TypeAndOperatorVariants | Grouped all type + operator combos into one test |
|
|
27
|
+
| UC-002 | Include vs Exclude and hideNumberAndProductFields | isExcluded: true \| false; hideNumberAndProductFields: true \| false | "Exclude" vs "Include"; when hideNumberAndProductFields true, operand/operator block hidden for STRING/NUMBER/etc., condition name and "whose" still visible | P0 | VisualStates | Default, excluded, and journey/store profile modes |
|
|
28
|
+
| UC-003 | Store upload states (STORE_FILTER) | additionalFields.STORE_FILTER with storeSource: UPLOAD; storeUploadIsInProgress \| isStoreUploadFailed \| isStoreUploadInvalid \| success (operand count) | Progress icon + "Upload in progress"; error icon + "Upload failed" or "Invalid file uploaded"; or "N Stores" when success | P0 | StoreUploadStates | Grouped in progress / failed / invalid / success |
|
|
29
|
+
| UC-004 | ViewMoreLink and SKU download interactions | ViewMoreLink with onClick; setPopoverVisible, onClickConfigure, blockId; MULTI_SELECT + listData (SKU) for download link | Click View more → setPopoverVisible(false) and onClickConfigure(blockId); click "uploaded" → CSV download with SKU list and skuFileName | P0 | Interactions | All interactive handlers in one test |
|
|
30
|
+
| UC-005 | Content: normal, empty, long | operand/listData: normal values; empty listData or []; long operand string; additionalFields: {} vs multiple entries | Renders without crash; empty list shows attachment icon or empty state; long text truncates or wraps; multiple additional conditions show "and" + lineItemMsg | P1 | ContentVariants | Normal, empty, long, multiple conditions |
|
|
31
|
+
| UC-006 | Styling (className) | className: "custom-class" | Root has class "custom-class" and "cap-condition-wrapper"; layout and styled labels (pill background) unchanged | P1 | Styling | className only; no style prop on component |
|
|
32
|
+
| UC-007 | Additional fields (EXTENDED_FIELD, CUSTOM_FIELD, STORE_FILTER, multiple) | additionalFields: EXTENDED_FIELD, CUSTOM_FIELD, STORE_FILTER; expression with operator/operand; multiple keys | Correct description, operator label, and OperandValues for each; "only for lineitems with" and "and" between items when multiple | P0 | AdditionalFields | Grouped all additional field variants |
|
|
33
|
+
| UC-008 | DATE_TYPE sub-variants (RANGE, SINGLE, DAYS_AFTER, DAYS_BEFORE) | type: DATE; dateTypeData: RANGE (startDate, endDate), SINGLE (date or contextData.profileName), DAYS_AFTER/DAYS_BEFORE (days, contextData) | RANGE: "between" + two formatted dates; SINGLE: date or "End date of {profileName} event date attribute"; DAYS_AFTER/BEFORE: "{days} days after/before" + End date of profile | P0 | DateTypeVariants | Grouped RANGE, SINGLE, DAYS_AFTER, DAYS_BEFORE |
|
|
34
|
+
| UC-009 | DATE_TYPE edge cases | dateTypeData: null, undefined; dateType: null, "", "INVALID_TYPE"; startDate/endDate/date: null, undefined, "", invalid string | No date content rendered when null/undefined/invalid; no crash; empty dates show "and" only where applicable | P1 | DateTypeEdgeCases | Production-safe null/undefined/invalid handling |
|
|
35
|
+
| UC-010 | STRING_LIST single vs multiple | type: STRING_LIST; operand: [single] vs [v1, v2, …] | Single: "value1" only; multiple: "value1 +N more" with correct count | P1 | StringListContent | Grouped single and multiple values |
|
|
36
|
+
| UC-011 | MULTI_SELECT: SKU (download) vs non-SKU vs store upload | type: MULTI_SELECT; listData; additionalFields SKU vs none vs STORE_FILTER with UPLOAD | SKU: TruncateList + "uploaded" download link; non-SKU: TruncateList only; store upload: StoreUploadMsg + View more | P0 | MultiSelectVariants | SKU download, list-only, store upload |
|
|
37
|
+
| UC-012 | Entry trigger event attribute | type: ENTRY_TRIGGER_EVENT_ATTRIBUTE; entryTriggerEventAttribute: string; operator | Shows operator label and "Entry trigger event attribute" + attribute name (e.g. "fact1") | P1 | EntryTriggerAttribute | Single test for entry trigger block |
|
|
38
|
+
| UC-013 | Event handlers and callbacks | ViewMoreLink onClick, setPopoverVisible, onClickConfigure; download (setAttribute href/download) | All callbacks invoked with correct args; download link gets correct data URI and filename | P1 | EventHandlers | Grouped all handlers; no mock of Cap components |
|
|
39
|
+
| UC-014 | OperandsMapping labels (i18n) | All operator keys: equalMsg, greaterThanMsg, lessThanMsg, greaterThanOrEqualMsg, lessThanorEqualMsg, inRangeMsg, notEqualMsg, inMsg, notInMsg, date msgs | Correct translated label for each operator in UI | P1 | OperandsMapping | Grouped all operator label props |
|
|
40
|
+
| UC-015 | Empty or missing operand / listData | operand: null, undefined, ""; listData: null, []; type NUMBER/STRING/LIST/MULTI_SELECT | No crash; missing values render empty or fallback (e.g. attachment icon for MULTI_SELECT with no listData) | P1 | EmptyOperand | Edge case for missing data |
|
|
41
|
+
| UC-016 | DATE_TYPE_SINGLE with contextData vs raw date | dateTypeData: SINGLE with date only vs contextData only vs both (contextData takes precedence) | Raw date: formatted date; contextData: "End date of {profileName} event date attribute"; both: contextData branch shown | P1 | DateSingleContext | Precedence and profile name display |
|
|
42
|
+
| UC-017 | Format date for preview (YYYY-MM-DD, ISO, invalid) | dateTypeData with date: "2024-01-15", "2024-01-15T00:00:00.000Z", "invalid" | YYYY-MM-DD and ISO format as en-US locale; invalid returns empty string, no broken UI | P1 | FormatDateForPreview | Timezone-safe and invalid handling |
|
|
43
|
+
| UC-018 | Migration parity (v3 → v6) | Same props as v3 usage; FormattedMessage (react-intl); no antd in component | Same copy and structure as v3; FormattedMessage resolves; no antd dependency in CapConditionPreview | P0 | MigrationParity | i18n and structure parity |
|
|
44
|
+
| UC-019 | Default and optional props | listData=null, hideNumberAndProductFields=false; omit optional msg props (use defaults from LocaleHoc) | Sensible defaults; no crash when optional props omitted; LocaleHoc provides messages | P2 | DefaultProps | Grouped default/optional behavior |
|
|
45
|
+
| UC-020 | Multiple additional conditions (and + lineItemMsg) | additionalFields with 2+ entries (e.g. EXTENDED_FIELD + CUSTOM_FIELD) | First condition without "and"; subsequent with "and" + lineItemMsg; each shows description + operator + OperandValues | P1 | MultipleAdditionalConditions | And/lineItemMsg grouping |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Requirements checklist
|
|
50
|
+
|
|
51
|
+
- Stay within strict limit for complexity level: **medium ≤20** (20 rows).
|
|
52
|
+
- Group similar scenarios aggressively (types, operators, store states, date variants, events).
|
|
53
|
+
- Each test is manually verifiable in Storybook and with RTL.
|
|
54
|
+
- Focus on real-world usage (conditions, store filter, SKU, dates).
|
|
55
|
+
- Prioritize P0/P1 over P2.
|
|
56
|
+
- Grouping rationale noted in Notes column.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Testing notes (Do / Don't)
|
|
61
|
+
|
|
62
|
+
- **Do:** Use React Testing Library with Jest; prefer `data-testid` for querying; clear mocks between tests if applicable.
|
|
63
|
+
- **Don't:** Mock Cap UI Library components unless instructed; avoid over-reliance on getByRole; don’t write overly complex tests.
|
|
64
|
+
|
|
65
|
+
**If approaching limit, merge more test cases. Quality > quantity.**
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** Context data for date conditions (e.g. profile name) */
|
|
3
|
+
export interface DateTypeContextData {
|
|
4
|
+
profileName?: string;
|
|
5
|
+
}
|
|
6
|
+
/** Shape of dateTypeData prop for DATE type conditions */
|
|
7
|
+
export interface DateTypeData {
|
|
8
|
+
dateType?: 'RANGE' | 'SINGLE' | 'DAYS_AFTER' | 'DAYS_BEFORE';
|
|
9
|
+
startDate?: string | null;
|
|
10
|
+
endDate?: string | null;
|
|
11
|
+
date?: string | null;
|
|
12
|
+
days?: number;
|
|
13
|
+
contextData?: DateTypeContextData | null;
|
|
14
|
+
}
|
|
15
|
+
/** Expression inside additionalFields entries */
|
|
16
|
+
export interface LinkedConditionExpression {
|
|
17
|
+
operator?: string;
|
|
18
|
+
operand?: string[];
|
|
19
|
+
storeSource?: string;
|
|
20
|
+
isStoreUploadFailed?: boolean;
|
|
21
|
+
isStoreUploadInvalid?: boolean;
|
|
22
|
+
storeUploadIsInProgress?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** Single entry in additionalFields */
|
|
25
|
+
export interface AdditionalFieldEntry {
|
|
26
|
+
description?: string;
|
|
27
|
+
factId?: string;
|
|
28
|
+
expression?: LinkedConditionExpression;
|
|
29
|
+
}
|
|
30
|
+
/** DstData passed to component (e.g. couponSeriesNames fallback) */
|
|
31
|
+
export interface DstData {
|
|
32
|
+
couponSeriesNames?: string[];
|
|
33
|
+
}
|
|
34
|
+
/** View more link component props */
|
|
35
|
+
export interface ViewMoreLinkProps {
|
|
36
|
+
onClick: () => void;
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
}
|
|
39
|
+
export interface CapConditionPreviewProps {
|
|
40
|
+
className?: string;
|
|
41
|
+
type?: string;
|
|
42
|
+
operand?: number | string | string[];
|
|
43
|
+
operator?: string;
|
|
44
|
+
dstData?: DstData;
|
|
45
|
+
listData?: string[] | null;
|
|
46
|
+
additionalFields?: Record<string, AdditionalFieldEntry>;
|
|
47
|
+
isExcluded?: boolean;
|
|
48
|
+
conditionName?: string;
|
|
49
|
+
/** Message strings (typically from translations) */
|
|
50
|
+
excludeMsg?: string;
|
|
51
|
+
includeMsg?: string;
|
|
52
|
+
whoseMsg?: string;
|
|
53
|
+
isMsg?: string;
|
|
54
|
+
andMsg?: string;
|
|
55
|
+
equalMsg?: string;
|
|
56
|
+
greaterThanMsg?: string;
|
|
57
|
+
lessThanMsg?: string;
|
|
58
|
+
greaterThanOrEqualMsg?: string;
|
|
59
|
+
lessThanorEqualMsg?: string;
|
|
60
|
+
inRangeMsg?: string;
|
|
61
|
+
notEqualMsg?: string;
|
|
62
|
+
lineItemMsg?: string;
|
|
63
|
+
addedSKUsMsg?: string;
|
|
64
|
+
skuFileName?: string;
|
|
65
|
+
uploadedMsg?: string;
|
|
66
|
+
inMsg?: string;
|
|
67
|
+
notInMsg?: string;
|
|
68
|
+
/** When true, hides operand/operator block (e.g. for Store profile, Custom fields in journey) */
|
|
69
|
+
hideNumberAndProductFields?: boolean;
|
|
70
|
+
viewMoreMsg?: string;
|
|
71
|
+
storesMsg?: string;
|
|
72
|
+
uploadInProgressMsg?: string;
|
|
73
|
+
ViewMoreLink?: React.ComponentType<ViewMoreLinkProps>;
|
|
74
|
+
onClickConfigure?: (blockId: string) => void;
|
|
75
|
+
blockId?: string;
|
|
76
|
+
setPopoverVisible?: (visible: boolean) => void;
|
|
77
|
+
uploadFailedErrorMsg?: string;
|
|
78
|
+
uploadInvalidErrorMsg?: string;
|
|
79
|
+
entryTriggerEventAttribute?: string;
|
|
80
|
+
dateTypeData?: DateTypeData | null;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../components/CapConditionPreview/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,2DAA2D;AAC3D,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,0DAA0D;AAC1D,MAAM,WAAW,YAAY;IAC3B,QAA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,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;CACpC"}
|
package/CapListLayout/index.js
CHANGED
|
@@ -10118,12 +10118,14 @@ var _lodash = __webpack_require__(42551);
|
|
|
10118
10118
|
var _react = _interopRequireWildcard(__webpack_require__(9206));
|
|
10119
10119
|
var _LocaleHoc = _interopRequireDefault(__webpack_require__(39879));
|
|
10120
10120
|
var _styles = _interopRequireDefault(__webpack_require__(40845));
|
|
10121
|
+
var _utils = __webpack_require__(99394);
|
|
10121
10122
|
var _jsxRuntime = __webpack_require__(74848);
|
|
10122
|
-
const _excluded = ["id", "className", "children", "infiniteScroll", "pagination", "dataSource", "offset_limit", "setPagination", "scroll", "showLoader"];
|
|
10123
|
+
const _excluded = ["id", "className", "children", "infiniteScroll", "virtual", "pagination", "dataSource", "offset_limit", "setPagination", "scroll", "showLoader", "columns", "rowSelection", "locale"];
|
|
10123
10124
|
/**
|
|
10124
10125
|
* CapTable - Migrated to Ant Design v5
|
|
10125
10126
|
* A table component that supports:
|
|
10126
|
-
* - Infinite scrolling with
|
|
10127
|
+
* - Infinite scrolling with manual scroll event handling
|
|
10128
|
+
* - Optional virtual scrolling for large datasets (requires explicit column widths)
|
|
10127
10129
|
* - Sequential data loading
|
|
10128
10130
|
* - Optimized scroll performance
|
|
10129
10131
|
*/
|
|
@@ -10132,7 +10134,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
10132
10134
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
10133
10135
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10134
10136
|
const SCROLL_THRESHOLD = 80; // Percentage of scroll to trigger load
|
|
10135
|
-
const
|
|
10137
|
+
const THROTTLE_DELAY = 50; // ms to wait between scroll events (matching original cap-ui-library)
|
|
10136
10138
|
const DEFAULT_SCROLL_HEIGHT = 400;
|
|
10137
10139
|
const CapTable = _ref => {
|
|
10138
10140
|
let {
|
|
@@ -10140,27 +10142,43 @@ const CapTable = _ref => {
|
|
|
10140
10142
|
className,
|
|
10141
10143
|
children,
|
|
10142
10144
|
infiniteScroll,
|
|
10145
|
+
virtual,
|
|
10146
|
+
pagination: _pagination,
|
|
10143
10147
|
dataSource,
|
|
10144
10148
|
offset_limit,
|
|
10145
10149
|
setPagination,
|
|
10146
10150
|
scroll,
|
|
10147
|
-
showLoader
|
|
10151
|
+
showLoader,
|
|
10152
|
+
columns,
|
|
10153
|
+
rowSelection,
|
|
10154
|
+
locale
|
|
10148
10155
|
} = _ref,
|
|
10149
10156
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
10150
10157
|
const scrollRef = (0, _react.useRef)(null);
|
|
10151
10158
|
const [hasMore, setHasMore] = (0, _react.useState)(true);
|
|
10152
|
-
|
|
10159
|
+
|
|
10160
|
+
// Transform deprecated props
|
|
10161
|
+
const transformedColumns = (0, _react.useMemo)(() => (0, _utils.transformColumns)(columns), [columns]);
|
|
10162
|
+
const transformedRowSelection = (0, _react.useMemo)(() => (0, _utils.transformRowSelection)(rowSelection), [rowSelection]);
|
|
10163
|
+
const transformedPagination = (0, _react.useMemo)(() => (0, _utils.transformPagination)(_pagination), [_pagination]);
|
|
10164
|
+
const filterCheckAllLocale = (0, _react.useMemo)(() => (0, _utils.getFilterCheckAllLocale)(columns), [columns]);
|
|
10165
|
+
|
|
10166
|
+
// Merge locale with filterCheckAll if needed
|
|
10167
|
+
const mergedLocale = (0, _react.useMemo)(() => {
|
|
10168
|
+
if (!filterCheckAllLocale) return locale;
|
|
10169
|
+
return _extends({}, locale, filterCheckAllLocale);
|
|
10170
|
+
}, [locale, filterCheckAllLocale]);
|
|
10153
10171
|
const loadMore = (0, _react.useCallback)(() => {
|
|
10154
10172
|
if (!showLoader && hasMore && setPagination && offset_limit) {
|
|
10155
|
-
|
|
10173
|
+
// Increment offset by limit (matching original cap-ui-library behavior)
|
|
10174
|
+
const nextOffset = offset_limit.offset + (offset_limit.limit || 10);
|
|
10156
10175
|
const newOffsetLimit = _extends({}, offset_limit, {
|
|
10157
10176
|
offset: nextOffset
|
|
10158
10177
|
});
|
|
10159
|
-
currentOffsetRef.current = nextOffset;
|
|
10160
10178
|
setPagination(newOffsetLimit);
|
|
10161
10179
|
}
|
|
10162
10180
|
}, [showLoader, hasMore, setPagination, offset_limit]);
|
|
10163
|
-
const handleScroll = (0, _react.useCallback)((0, _lodash.
|
|
10181
|
+
const handleScroll = (0, _react.useCallback)((0, _lodash.throttle)(event => {
|
|
10164
10182
|
const target = event.target;
|
|
10165
10183
|
if (!target || !infiniteScroll || !hasMore || showLoader) return;
|
|
10166
10184
|
const scrollTop = Math.ceil(target.scrollTop);
|
|
@@ -10170,7 +10188,7 @@ const CapTable = _ref => {
|
|
|
10170
10188
|
if (scrolledPercentage >= SCROLL_THRESHOLD) {
|
|
10171
10189
|
loadMore();
|
|
10172
10190
|
}
|
|
10173
|
-
},
|
|
10191
|
+
}, THROTTLE_DELAY), [infiniteScroll, showLoader, hasMore, loadMore]);
|
|
10174
10192
|
|
|
10175
10193
|
// Setup scroll listener and handle initial load
|
|
10176
10194
|
(0, _react.useEffect)(() => {
|
|
@@ -10183,10 +10201,13 @@ const CapTable = _ref => {
|
|
|
10183
10201
|
passive: true
|
|
10184
10202
|
});
|
|
10185
10203
|
|
|
10186
|
-
// Check if initial load needed
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10204
|
+
// Check if initial load needed (matching original cap-ui-library behavior)
|
|
10205
|
+
// Only trigger if: dataSource >= limit AND content doesn't overflow scroll area
|
|
10206
|
+
const limit = (offset_limit == null ? void 0 : offset_limit.limit) || 10;
|
|
10207
|
+
const hasEnoughData = dataSource && dataSource.length >= limit;
|
|
10208
|
+
const scrollY = scroll != null && scroll.y ? Number(scroll.y) : 0;
|
|
10209
|
+
const isNotOverflowing = scrollY && tableBody.scrollHeight <= scrollY;
|
|
10210
|
+
if (hasEnoughData && isNotOverflowing && !showLoader && hasMore) {
|
|
10190
10211
|
loadMore();
|
|
10191
10212
|
}
|
|
10192
10213
|
|
|
@@ -10196,31 +10217,61 @@ const CapTable = _ref => {
|
|
|
10196
10217
|
(_scrollRef$current = scrollRef.current) == null || _scrollRef$current.removeEventListener('scroll', handleScroll);
|
|
10197
10218
|
handleScroll.cancel();
|
|
10198
10219
|
};
|
|
10199
|
-
}, [id, handleScroll, showLoader, hasMore, loadMore]);
|
|
10220
|
+
}, [id, handleScroll, showLoader, hasMore, loadMore, dataSource, offset_limit, scroll]);
|
|
10200
10221
|
|
|
10201
|
-
// Handle data changes
|
|
10222
|
+
// Handle data changes - reset hasMore when data changes
|
|
10202
10223
|
(0, _react.useEffect)(() => {
|
|
10203
|
-
|
|
10204
|
-
currentOffsetRef.current = 0;
|
|
10205
|
-
setHasMore(true);
|
|
10206
|
-
} else {
|
|
10207
|
-
setHasMore(true);
|
|
10208
|
-
}
|
|
10224
|
+
setHasMore(true);
|
|
10209
10225
|
}, [dataSource]);
|
|
10210
10226
|
const tableClassName = (0, _classnames.default)(_styles.default['cap-table-v2'], className, {
|
|
10211
10227
|
[_styles.default['show-loader']]: showLoader
|
|
10212
10228
|
});
|
|
10229
|
+
|
|
10230
|
+
// Calculate scroll.x for virtual tables if not explicitly provided
|
|
10231
|
+
// Virtual tables require a numeric scroll.x to calculate row widths correctly
|
|
10232
|
+
const scrollX = (0, _react.useMemo)(() => {
|
|
10233
|
+
// If explicitly provided, use that value
|
|
10234
|
+
if ((scroll == null ? void 0 : scroll.x) !== undefined) {
|
|
10235
|
+
return scroll.x;
|
|
10236
|
+
}
|
|
10237
|
+
|
|
10238
|
+
// For virtual tables, calculate total width from column widths
|
|
10239
|
+
if (virtual && transformedColumns) {
|
|
10240
|
+
const totalWidth = transformedColumns.reduce((sum, col) => {
|
|
10241
|
+
if (typeof col.width === 'number') {
|
|
10242
|
+
return sum + col.width;
|
|
10243
|
+
}
|
|
10244
|
+
if (typeof col.width === 'string') {
|
|
10245
|
+
const parsed = parseInt(col.width, 10);
|
|
10246
|
+
return sum + (isNaN(parsed) ? 0 : parsed);
|
|
10247
|
+
}
|
|
10248
|
+
return sum;
|
|
10249
|
+
}, 0);
|
|
10250
|
+
|
|
10251
|
+
// Warn in development if columns don't have widths
|
|
10252
|
+
if (totalWidth === 0 && "production" === 'development') // removed by dead control flow
|
|
10253
|
+
{}
|
|
10254
|
+
return totalWidth > 0 ? totalWidth : undefined;
|
|
10255
|
+
}
|
|
10256
|
+
return undefined;
|
|
10257
|
+
}, [scroll == null ? void 0 : scroll.x, virtual, transformedColumns]);
|
|
10258
|
+
|
|
10259
|
+
// Use transformed pagination or false for infinite scroll
|
|
10260
|
+
const finalPagination = infiniteScroll ? false : transformedPagination;
|
|
10213
10261
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.Table, _extends({
|
|
10214
10262
|
id: id,
|
|
10215
10263
|
className: tableClassName,
|
|
10216
10264
|
dataSource: dataSource,
|
|
10217
|
-
|
|
10265
|
+
columns: transformedColumns,
|
|
10266
|
+
rowSelection: transformedRowSelection,
|
|
10267
|
+
pagination: finalPagination,
|
|
10268
|
+
locale: mergedLocale,
|
|
10218
10269
|
scroll: {
|
|
10219
|
-
x:
|
|
10270
|
+
x: scrollX,
|
|
10220
10271
|
y: (scroll == null ? void 0 : scroll.y) || DEFAULT_SCROLL_HEIGHT,
|
|
10221
10272
|
scrollToFirstRowOnChange: false
|
|
10222
10273
|
},
|
|
10223
|
-
virtual:
|
|
10274
|
+
virtual: virtual
|
|
10224
10275
|
}, rest, {
|
|
10225
10276
|
children: children
|
|
10226
10277
|
}));
|
|
@@ -20353,7 +20404,7 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(31601);
|
|
|
20353
20404
|
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(76314);
|
|
20354
20405
|
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
|
|
20355
20406
|
// Module
|
|
20356
|
-
___CSS_LOADER_EXPORT___.push([module.id, `.cap-table-v2 .ant-table{border:.071rem solid #dfe2e7}.cap-table-v2 .ant-table .ant-table-thead>tr>th{font-size:.857rem;line-height:1.142rem;text-align:left;padding:1.142rem 1.714rem}.cap-table-v2 .ant-table .ant-table-thead>tr>th .ant-table-column-sorter{vertical-align:unset}.cap-table-v2 .ant-table .ant-table-tbody>tr>td{padding:1.142rem 1.714rem;border-bottom:.071rem solid #dfe2e7}.cap-table-v2 .ant-table .ant-table-tbody>tr:last-child>td{border-bottom:none}.cap-table-v2
|
|
20407
|
+
___CSS_LOADER_EXPORT___.push([module.id, `.cap-table-v2{width:100%}.cap-table-v2 .ant-table-tbody .ant-table-row.ant-table-row-selected>.ant-table-cell{background:#fafafa}.cap-table-v2 .ant-table-tbody .ant-table-row.ant-table-row-selected:hover>.ant-table-cell{background:#faf9f4}.cap-table-v2 .ant-table{border:.071rem solid #dfe2e7}.cap-table-v2 .ant-table .ant-table-thead>tr>th{font-size:.857rem;line-height:1.142rem;text-align:left;padding:1.142rem 1.714rem}.cap-table-v2 .ant-table .ant-table-thead>tr>th .ant-table-column-sorter{vertical-align:unset}.cap-table-v2 .ant-table .ant-table-tbody>tr>td{padding:1.142rem 1.714rem;border-bottom:.071rem solid #dfe2e7}.cap-table-v2 .ant-table .ant-table-tbody>tr:last-child>td{border-bottom:none}.cap-table-v2.show-loader .ant-table-body>table>tbody::after{content:"Loading...";display:flex;justify-content:center;position:absolute;width:100%;align-items:center;height:4.286rem;text-align:center;font-size:1.143rem;color:cap-g04;border-top:.071rem solid #dfe2e7}`, ""]);
|
|
20357
20408
|
// Exports
|
|
20358
20409
|
___CSS_LOADER_EXPORT___.locals = {
|
|
20359
20410
|
"cap-table-v2": `cap-table-v2`,
|
|
@@ -23002,6 +23053,123 @@ function toNumber(value) {
|
|
|
23002
23053
|
module.exports = toNumber;
|
|
23003
23054
|
|
|
23004
23055
|
|
|
23056
|
+
/***/ }),
|
|
23057
|
+
|
|
23058
|
+
/***/ 99394:
|
|
23059
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
23060
|
+
|
|
23061
|
+
"use strict";
|
|
23062
|
+
|
|
23063
|
+
|
|
23064
|
+
exports.__esModule = true;
|
|
23065
|
+
exports.getFilterCheckAllLocale = getFilterCheckAllLocale;
|
|
23066
|
+
exports.transformColumns = transformColumns;
|
|
23067
|
+
exports.transformPagination = transformPagination;
|
|
23068
|
+
exports.transformRowSelection = transformRowSelection;
|
|
23069
|
+
const _excluded = ["position"],
|
|
23070
|
+
_excluded2 = ["filterDropdownOpen", "onFilterDropdownOpenChange"],
|
|
23071
|
+
_excluded3 = ["onSelectInvert", "onChange"];
|
|
23072
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
23073
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
23074
|
+
/**
|
|
23075
|
+
* Transform deprecated pagination.position to pagination.placement
|
|
23076
|
+
*/
|
|
23077
|
+
function transformPagination(pagination) {
|
|
23078
|
+
if (!pagination || pagination === false) return pagination;
|
|
23079
|
+
const _ref = pagination,
|
|
23080
|
+
{
|
|
23081
|
+
position
|
|
23082
|
+
} = _ref,
|
|
23083
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
23084
|
+
if (position && Array.isArray(position)) {
|
|
23085
|
+
// Map position array to placement (use first position as placement)
|
|
23086
|
+
const positionToPlacement = {
|
|
23087
|
+
topLeft: 'topLeft',
|
|
23088
|
+
topCenter: 'topLeft',
|
|
23089
|
+
topRight: 'topRight',
|
|
23090
|
+
bottomLeft: 'bottomLeft',
|
|
23091
|
+
bottomCenter: 'bottomLeft',
|
|
23092
|
+
bottomRight: 'bottomRight'
|
|
23093
|
+
};
|
|
23094
|
+
const placement = positionToPlacement[position[0]] || 'bottomRight';
|
|
23095
|
+
return _extends({}, rest, {
|
|
23096
|
+
position: [placement]
|
|
23097
|
+
});
|
|
23098
|
+
}
|
|
23099
|
+
return pagination;
|
|
23100
|
+
}
|
|
23101
|
+
|
|
23102
|
+
/**
|
|
23103
|
+
* Transform deprecated column props:
|
|
23104
|
+
* - filterDropdownOpen → filterDropdownProps.open
|
|
23105
|
+
* - onFilterDropdownOpenChange → filterDropdownProps.onOpenChange
|
|
23106
|
+
* - filterCheckall → locale.filterCheckAll (handled at table level)
|
|
23107
|
+
*/
|
|
23108
|
+
function transformColumns(columns) {
|
|
23109
|
+
if (!columns) return columns;
|
|
23110
|
+
return columns.map(column => {
|
|
23111
|
+
const _ref2 = column,
|
|
23112
|
+
{
|
|
23113
|
+
filterDropdownOpen,
|
|
23114
|
+
onFilterDropdownOpenChange
|
|
23115
|
+
} = _ref2,
|
|
23116
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
23117
|
+
const transformed = _extends({}, rest);
|
|
23118
|
+
|
|
23119
|
+
// Transform filterDropdownOpen and onFilterDropdownOpenChange to filterDropdownProps
|
|
23120
|
+
if (filterDropdownOpen !== undefined || onFilterDropdownOpenChange !== undefined) {
|
|
23121
|
+
transformed.filterDropdownProps = _extends({}, transformed.filterDropdownProps, filterDropdownOpen !== undefined && {
|
|
23122
|
+
open: filterDropdownOpen
|
|
23123
|
+
}, onFilterDropdownOpenChange !== undefined && {
|
|
23124
|
+
onOpenChange: onFilterDropdownOpenChange
|
|
23125
|
+
});
|
|
23126
|
+
}
|
|
23127
|
+
return transformed;
|
|
23128
|
+
});
|
|
23129
|
+
}
|
|
23130
|
+
|
|
23131
|
+
/**
|
|
23132
|
+
* Transform deprecated rowSelection.onSelectInvert to onChange
|
|
23133
|
+
*/
|
|
23134
|
+
function transformRowSelection(rowSelection) {
|
|
23135
|
+
if (!rowSelection) return rowSelection;
|
|
23136
|
+
const _ref3 = rowSelection,
|
|
23137
|
+
{
|
|
23138
|
+
onSelectInvert,
|
|
23139
|
+
onChange
|
|
23140
|
+
} = _ref3,
|
|
23141
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
23142
|
+
if (onSelectInvert && !onChange) {
|
|
23143
|
+
// Wrap onSelectInvert in onChange
|
|
23144
|
+
return _extends({}, rest, {
|
|
23145
|
+
onChange: selectedRowKeys => {
|
|
23146
|
+
onSelectInvert(selectedRowKeys);
|
|
23147
|
+
}
|
|
23148
|
+
});
|
|
23149
|
+
}
|
|
23150
|
+
return _extends({}, rest, {
|
|
23151
|
+
onChange
|
|
23152
|
+
});
|
|
23153
|
+
}
|
|
23154
|
+
|
|
23155
|
+
/**
|
|
23156
|
+
* Check if any column has deprecated filterCheckall and return locale override
|
|
23157
|
+
*/
|
|
23158
|
+
function getFilterCheckAllLocale(columns) {
|
|
23159
|
+
if (!columns) return undefined;
|
|
23160
|
+
for (const column of columns) {
|
|
23161
|
+
const {
|
|
23162
|
+
filterCheckall
|
|
23163
|
+
} = column;
|
|
23164
|
+
if (filterCheckall !== undefined) {
|
|
23165
|
+
return {
|
|
23166
|
+
filterCheckAll: filterCheckall
|
|
23167
|
+
};
|
|
23168
|
+
}
|
|
23169
|
+
}
|
|
23170
|
+
return undefined;
|
|
23171
|
+
}
|
|
23172
|
+
|
|
23005
23173
|
/***/ }),
|
|
23006
23174
|
|
|
23007
23175
|
/***/ 99780:
|