@capillarytech/blaze-ui 5.0.6 → 5.0.8

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.
Files changed (73) hide show
  1. package/.npmrc +2 -0
  2. package/CapCondition/messages.d.ts +85 -0
  3. package/CapCondition/messages.d.ts.map +1 -0
  4. package/CapConditionPreview/MIGRATION_ANALYSIS.md +70 -0
  5. package/CapConditionPreview/README.md +40 -0
  6. package/CapConditionPreview/constants.d.ts +24 -0
  7. package/CapConditionPreview/constants.d.ts.map +1 -0
  8. package/CapConditionPreview/index.d.ts +7 -0
  9. package/CapConditionPreview/index.d.ts.map +1 -0
  10. package/CapConditionPreview/index.js +132 -184
  11. package/CapConditionPreview/index.js.map +1 -1
  12. package/CapConditionPreview/tests/USE_CASES_CapConditionPreview.md +65 -0
  13. package/CapConditionPreview/types.d.ts +82 -0
  14. package/CapConditionPreview/types.d.ts.map +1 -0
  15. package/CapListLayout/index.js +193 -25
  16. package/CapListLayout/index.js.map +1 -1
  17. package/CapNavigation/index.js +6 -7
  18. package/CapNavigation/index.js.map +1 -1
  19. package/CapSteps/Status.md +40 -0
  20. package/CapSteps/index.d.ts +30 -0
  21. package/CapSteps/index.d.ts.map +1 -0
  22. package/CapSteps/index.js +657 -24
  23. package/CapSteps/index.js.map +1 -1
  24. package/CapSteps/types.d.ts +26 -0
  25. package/CapSteps/types.d.ts.map +1 -0
  26. package/CapTab/README.md +406 -0
  27. package/CapTab/Status.md +104 -0
  28. package/CapTab/index.d.ts +1 -27
  29. package/CapTab/index.d.ts.map +1 -1
  30. package/CapTab/index.js +56 -7
  31. package/CapTab/index.js.map +1 -1
  32. package/CapTab/tests/USE_CASE_GAPS.md +143 -0
  33. package/CapTab/types.d.ts +29 -0
  34. package/CapTab/types.d.ts.map +1 -0
  35. package/CapTabV3/ANALYSIS.md +60 -0
  36. package/CapTabV3/README.md +156 -0
  37. package/CapTabV3/Status.md +52 -0
  38. package/CapTabV3/index.d.ts +9 -0
  39. package/CapTabV3/index.d.ts.map +1 -0
  40. package/CapTabV3/index.js +105 -67
  41. package/CapTabV3/index.js.map +1 -1
  42. package/CapTabV3/tests/USE_CASE_GAPS.md +149 -0
  43. package/CapTabV3/types.d.ts +28 -0
  44. package/CapTabV3/types.d.ts.map +1 -0
  45. package/CapTable/README.md +160 -0
  46. package/CapTable/Status.md +41 -0
  47. package/CapTable/index.d.ts +2 -21
  48. package/CapTable/index.d.ts.map +1 -1
  49. package/CapTable/index.js +193 -25
  50. package/CapTable/index.js.map +1 -1
  51. package/CapTable/types.d.ts +46 -0
  52. package/CapTable/types.d.ts.map +1 -0
  53. package/CapTable/utils.d.ts +24 -0
  54. package/CapTable/utils.d.ts.map +1 -0
  55. package/CapTimePicker/index.js +51 -129
  56. package/CapTimePicker/index.js.map +1 -1
  57. package/CapUserProfile/index.js +6 -7
  58. package/CapUserProfile/index.js.map +1 -1
  59. package/CapVerticalGroupTable/index.js +193 -25
  60. package/CapVerticalGroupTable/index.js.map +1 -1
  61. package/index.d.ts +7 -3
  62. package/index.d.ts.map +1 -1
  63. package/index.js +1271 -233
  64. package/index.js.map +1 -1
  65. package/package.json +1 -1
  66. package/utils/getCapThemeConfig.d.ts.map +1 -1
  67. package/utils/index.js +9 -1
  68. package/utils/index.js.map +1 -1
  69. package/.DS_Store +0 -0
  70. package/CapTimePicker/index.d.ts +0 -11
  71. package/CapTimePicker/index.d.ts.map +0 -1
  72. package/CapTimePicker/types.d.ts +0 -95
  73. package/CapTimePicker/types.d.ts.map +0 -1
@@ -9775,12 +9775,14 @@ var _lodash = __webpack_require__(42551);
9775
9775
  var _react = _interopRequireWildcard(__webpack_require__(9206));
9776
9776
  var _LocaleHoc = _interopRequireDefault(__webpack_require__(39879));
9777
9777
  var _styles = _interopRequireDefault(__webpack_require__(40845));
9778
+ var _utils = __webpack_require__(99394);
9778
9779
  var _jsxRuntime = __webpack_require__(74848);
9779
- const _excluded = ["id", "className", "children", "infiniteScroll", "pagination", "dataSource", "offset_limit", "setPagination", "scroll", "showLoader"];
9780
+ const _excluded = ["id", "className", "children", "infiniteScroll", "virtual", "pagination", "dataSource", "offset_limit", "setPagination", "scroll", "showLoader", "columns", "rowSelection", "locale"];
9780
9781
  /**
9781
9782
  * CapTable - Migrated to Ant Design v5
9782
9783
  * A table component that supports:
9783
- * - Infinite scrolling with virtualization
9784
+ * - Infinite scrolling with manual scroll event handling
9785
+ * - Optional virtual scrolling for large datasets (requires explicit column widths)
9784
9786
  * - Sequential data loading
9785
9787
  * - Optimized scroll performance
9786
9788
  */
@@ -9789,7 +9791,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
9789
9791
  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); }
9790
9792
  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; }
9791
9793
  const SCROLL_THRESHOLD = 80; // Percentage of scroll to trigger load
9792
- const DEBOUNCE_DELAY = 250; // ms to wait between scroll events
9794
+ const THROTTLE_DELAY = 50; // ms to wait between scroll events (matching original cap-ui-library)
9793
9795
  const DEFAULT_SCROLL_HEIGHT = 400;
9794
9796
  const CapTable = _ref => {
9795
9797
  let {
@@ -9797,27 +9799,43 @@ const CapTable = _ref => {
9797
9799
  className,
9798
9800
  children,
9799
9801
  infiniteScroll,
9802
+ virtual,
9803
+ pagination: _pagination,
9800
9804
  dataSource,
9801
9805
  offset_limit,
9802
9806
  setPagination,
9803
9807
  scroll,
9804
- showLoader
9808
+ showLoader,
9809
+ columns,
9810
+ rowSelection,
9811
+ locale
9805
9812
  } = _ref,
9806
9813
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
9807
9814
  const scrollRef = (0, _react.useRef)(null);
9808
9815
  const [hasMore, setHasMore] = (0, _react.useState)(true);
9809
- const currentOffsetRef = (0, _react.useRef)(0);
9816
+
9817
+ // Transform deprecated props
9818
+ const transformedColumns = (0, _react.useMemo)(() => (0, _utils.transformColumns)(columns), [columns]);
9819
+ const transformedRowSelection = (0, _react.useMemo)(() => (0, _utils.transformRowSelection)(rowSelection), [rowSelection]);
9820
+ const transformedPagination = (0, _react.useMemo)(() => (0, _utils.transformPagination)(_pagination), [_pagination]);
9821
+ const filterCheckAllLocale = (0, _react.useMemo)(() => (0, _utils.getFilterCheckAllLocale)(columns), [columns]);
9822
+
9823
+ // Merge locale with filterCheckAll if needed
9824
+ const mergedLocale = (0, _react.useMemo)(() => {
9825
+ if (!filterCheckAllLocale) return locale;
9826
+ return _extends({}, locale, filterCheckAllLocale);
9827
+ }, [locale, filterCheckAllLocale]);
9810
9828
  const loadMore = (0, _react.useCallback)(() => {
9811
9829
  if (!showLoader && hasMore && setPagination && offset_limit) {
9812
- const nextOffset = currentOffsetRef.current + 1;
9830
+ // Increment offset by limit (matching original cap-ui-library behavior)
9831
+ const nextOffset = offset_limit.offset + (offset_limit.limit || 10);
9813
9832
  const newOffsetLimit = _extends({}, offset_limit, {
9814
9833
  offset: nextOffset
9815
9834
  });
9816
- currentOffsetRef.current = nextOffset;
9817
9835
  setPagination(newOffsetLimit);
9818
9836
  }
9819
9837
  }, [showLoader, hasMore, setPagination, offset_limit]);
9820
- const handleScroll = (0, _react.useCallback)((0, _lodash.debounce)(event => {
9838
+ const handleScroll = (0, _react.useCallback)((0, _lodash.throttle)(event => {
9821
9839
  const target = event.target;
9822
9840
  if (!target || !infiniteScroll || !hasMore || showLoader) return;
9823
9841
  const scrollTop = Math.ceil(target.scrollTop);
@@ -9827,7 +9845,7 @@ const CapTable = _ref => {
9827
9845
  if (scrolledPercentage >= SCROLL_THRESHOLD) {
9828
9846
  loadMore();
9829
9847
  }
9830
- }, DEBOUNCE_DELAY), [infiniteScroll, showLoader, hasMore, loadMore]);
9848
+ }, THROTTLE_DELAY), [infiniteScroll, showLoader, hasMore, loadMore]);
9831
9849
 
9832
9850
  // Setup scroll listener and handle initial load
9833
9851
  (0, _react.useEffect)(() => {
@@ -9840,10 +9858,13 @@ const CapTable = _ref => {
9840
9858
  passive: true
9841
9859
  });
9842
9860
 
9843
- // Check if initial load needed
9844
- const shouldLoadInitially = tableBody.scrollHeight <= tableBody.clientHeight && !showLoader && hasMore;
9845
- if (shouldLoadInitially) {
9846
- currentOffsetRef.current = 0;
9861
+ // Check if initial load needed (matching original cap-ui-library behavior)
9862
+ // Only trigger if: dataSource >= limit AND content doesn't overflow scroll area
9863
+ const limit = (offset_limit == null ? void 0 : offset_limit.limit) || 10;
9864
+ const hasEnoughData = dataSource && dataSource.length >= limit;
9865
+ const scrollY = scroll != null && scroll.y ? Number(scroll.y) : 0;
9866
+ const isNotOverflowing = scrollY && tableBody.scrollHeight <= scrollY;
9867
+ if (hasEnoughData && isNotOverflowing && !showLoader && hasMore) {
9847
9868
  loadMore();
9848
9869
  }
9849
9870
 
@@ -9853,31 +9874,61 @@ const CapTable = _ref => {
9853
9874
  (_scrollRef$current = scrollRef.current) == null || _scrollRef$current.removeEventListener('scroll', handleScroll);
9854
9875
  handleScroll.cancel();
9855
9876
  };
9856
- }, [id, handleScroll, showLoader, hasMore, loadMore]);
9877
+ }, [id, handleScroll, showLoader, hasMore, loadMore, dataSource, offset_limit, scroll]);
9857
9878
 
9858
- // Handle data changes
9879
+ // Handle data changes - reset hasMore when data changes
9859
9880
  (0, _react.useEffect)(() => {
9860
- if (!(dataSource != null && dataSource.length)) {
9861
- currentOffsetRef.current = 0;
9862
- setHasMore(true);
9863
- } else {
9864
- setHasMore(true);
9865
- }
9881
+ setHasMore(true);
9866
9882
  }, [dataSource]);
9867
9883
  const tableClassName = (0, _classnames.default)(_styles.default['cap-table-v2'], className, {
9868
9884
  [_styles.default['show-loader']]: showLoader
9869
9885
  });
9886
+
9887
+ // Calculate scroll.x for virtual tables if not explicitly provided
9888
+ // Virtual tables require a numeric scroll.x to calculate row widths correctly
9889
+ const scrollX = (0, _react.useMemo)(() => {
9890
+ // If explicitly provided, use that value
9891
+ if ((scroll == null ? void 0 : scroll.x) !== undefined) {
9892
+ return scroll.x;
9893
+ }
9894
+
9895
+ // For virtual tables, calculate total width from column widths
9896
+ if (virtual && transformedColumns) {
9897
+ const totalWidth = transformedColumns.reduce((sum, col) => {
9898
+ if (typeof col.width === 'number') {
9899
+ return sum + col.width;
9900
+ }
9901
+ if (typeof col.width === 'string') {
9902
+ const parsed = parseInt(col.width, 10);
9903
+ return sum + (isNaN(parsed) ? 0 : parsed);
9904
+ }
9905
+ return sum;
9906
+ }, 0);
9907
+
9908
+ // Warn in development if columns don't have widths
9909
+ if (totalWidth === 0 && "production" === 'development') // removed by dead control flow
9910
+ {}
9911
+ return totalWidth > 0 ? totalWidth : undefined;
9912
+ }
9913
+ return undefined;
9914
+ }, [scroll == null ? void 0 : scroll.x, virtual, transformedColumns]);
9915
+
9916
+ // Use transformed pagination or false for infinite scroll
9917
+ const finalPagination = infiniteScroll ? false : transformedPagination;
9870
9918
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.Table, _extends({
9871
9919
  id: id,
9872
9920
  className: tableClassName,
9873
9921
  dataSource: dataSource,
9874
- pagination: false,
9922
+ columns: transformedColumns,
9923
+ rowSelection: transformedRowSelection,
9924
+ pagination: finalPagination,
9925
+ locale: mergedLocale,
9875
9926
  scroll: {
9876
- x: scroll == null ? void 0 : scroll.x,
9927
+ x: scrollX,
9877
9928
  y: (scroll == null ? void 0 : scroll.y) || DEFAULT_SCROLL_HEIGHT,
9878
9929
  scrollToFirstRowOnChange: false
9879
9930
  },
9880
- virtual: infiniteScroll
9931
+ virtual: virtual
9881
9932
  }, rest, {
9882
9933
  children: children
9883
9934
  }));
@@ -19799,7 +19850,7 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(31601);
19799
19850
  var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(76314);
19800
19851
  var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
19801
19852
  // Module
19802
- ___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 .ant-table .ant-table-body table{table-layout:fixed;width:100%}.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}`, ""]);
19853
+ ___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}`, ""]);
19803
19854
  // Exports
19804
19855
  ___CSS_LOADER_EXPORT___.locals = {
19805
19856
  "cap-table-v2": `cap-table-v2`,
@@ -22360,6 +22411,123 @@ function toNumber(value) {
22360
22411
  module.exports = toNumber;
22361
22412
 
22362
22413
 
22414
+ /***/ }),
22415
+
22416
+ /***/ 99394:
22417
+ /***/ ((__unused_webpack_module, exports) => {
22418
+
22419
+ "use strict";
22420
+
22421
+
22422
+ exports.__esModule = true;
22423
+ exports.getFilterCheckAllLocale = getFilterCheckAllLocale;
22424
+ exports.transformColumns = transformColumns;
22425
+ exports.transformPagination = transformPagination;
22426
+ exports.transformRowSelection = transformRowSelection;
22427
+ const _excluded = ["position"],
22428
+ _excluded2 = ["filterDropdownOpen", "onFilterDropdownOpenChange"],
22429
+ _excluded3 = ["onSelectInvert", "onChange"];
22430
+ 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); }
22431
+ 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; }
22432
+ /**
22433
+ * Transform deprecated pagination.position to pagination.placement
22434
+ */
22435
+ function transformPagination(pagination) {
22436
+ if (!pagination || pagination === false) return pagination;
22437
+ const _ref = pagination,
22438
+ {
22439
+ position
22440
+ } = _ref,
22441
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
22442
+ if (position && Array.isArray(position)) {
22443
+ // Map position array to placement (use first position as placement)
22444
+ const positionToPlacement = {
22445
+ topLeft: 'topLeft',
22446
+ topCenter: 'topLeft',
22447
+ topRight: 'topRight',
22448
+ bottomLeft: 'bottomLeft',
22449
+ bottomCenter: 'bottomLeft',
22450
+ bottomRight: 'bottomRight'
22451
+ };
22452
+ const placement = positionToPlacement[position[0]] || 'bottomRight';
22453
+ return _extends({}, rest, {
22454
+ position: [placement]
22455
+ });
22456
+ }
22457
+ return pagination;
22458
+ }
22459
+
22460
+ /**
22461
+ * Transform deprecated column props:
22462
+ * - filterDropdownOpen → filterDropdownProps.open
22463
+ * - onFilterDropdownOpenChange → filterDropdownProps.onOpenChange
22464
+ * - filterCheckall → locale.filterCheckAll (handled at table level)
22465
+ */
22466
+ function transformColumns(columns) {
22467
+ if (!columns) return columns;
22468
+ return columns.map(column => {
22469
+ const _ref2 = column,
22470
+ {
22471
+ filterDropdownOpen,
22472
+ onFilterDropdownOpenChange
22473
+ } = _ref2,
22474
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
22475
+ const transformed = _extends({}, rest);
22476
+
22477
+ // Transform filterDropdownOpen and onFilterDropdownOpenChange to filterDropdownProps
22478
+ if (filterDropdownOpen !== undefined || onFilterDropdownOpenChange !== undefined) {
22479
+ transformed.filterDropdownProps = _extends({}, transformed.filterDropdownProps, filterDropdownOpen !== undefined && {
22480
+ open: filterDropdownOpen
22481
+ }, onFilterDropdownOpenChange !== undefined && {
22482
+ onOpenChange: onFilterDropdownOpenChange
22483
+ });
22484
+ }
22485
+ return transformed;
22486
+ });
22487
+ }
22488
+
22489
+ /**
22490
+ * Transform deprecated rowSelection.onSelectInvert to onChange
22491
+ */
22492
+ function transformRowSelection(rowSelection) {
22493
+ if (!rowSelection) return rowSelection;
22494
+ const _ref3 = rowSelection,
22495
+ {
22496
+ onSelectInvert,
22497
+ onChange
22498
+ } = _ref3,
22499
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
22500
+ if (onSelectInvert && !onChange) {
22501
+ // Wrap onSelectInvert in onChange
22502
+ return _extends({}, rest, {
22503
+ onChange: selectedRowKeys => {
22504
+ onSelectInvert(selectedRowKeys);
22505
+ }
22506
+ });
22507
+ }
22508
+ return _extends({}, rest, {
22509
+ onChange
22510
+ });
22511
+ }
22512
+
22513
+ /**
22514
+ * Check if any column has deprecated filterCheckall and return locale override
22515
+ */
22516
+ function getFilterCheckAllLocale(columns) {
22517
+ if (!columns) return undefined;
22518
+ for (const column of columns) {
22519
+ const {
22520
+ filterCheckall
22521
+ } = column;
22522
+ if (filterCheckall !== undefined) {
22523
+ return {
22524
+ filterCheckAll: filterCheckall
22525
+ };
22526
+ }
22527
+ }
22528
+ return undefined;
22529
+ }
22530
+
22363
22531
  /***/ }),
22364
22532
 
22365
22533
  /***/ 99780: