Re: [PR] refactor(Table): Use Table instead of html in CollectionTable [superset]

Wed, 23 Apr 2025 06:14:50 -0700


geido commented on code in PR #33159:
URL: https://github.com/apache/superset/pull/33159#discussion_r2056027921


##########
superset-frontend/src/components/Datasource/CollectionTable.tsx:
##########
@@ -16,87 +16,30 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { PureComponent } from 'react';
+import { PureComponent, ReactNode } from 'react';
 
 import { nanoid } from 'nanoid';
 
 import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
 import { t, styled } from '@superset-ui/core';
 
 import { Icons } from 'src/components/Icons';
+import { FilterValue } from 'react-table';
 import { Button } from '../Button';
 import Fieldset from './Fieldset';
 import { recurseReactClone } from './utils';
 import {
-  SortOrder,
   type CRUDCollectionProps,
   type CRUDCollectionState,
   type Sort,
 } from './types';
-
-function createCollectionArray(collection: Record<PropertyKey, any>) {
-  return Object.keys(collection).map(k => collection[k]);
-}
-
-function createKeyedCollection(arr: Array<object>) {
-  const collectionArray = arr.map((o: any) => ({
-    ...o,
-    id: o.id || nanoid(),
-  }));
-
-  const collection: Record<PropertyKey, any> = {};
-  collectionArray.forEach((o: any) => {
-    collection[o.id] = o;
-  });
-
-  return {
-    collection,
-    collectionArray,
-  };
-}
-
-const CrudTableWrapper = styled.div<{ stickyHeader?: boolean }>`
-  ${({ stickyHeader }) =>
-    stickyHeader &&
-    `
-      height: 350px;
-      overflow-y: auto;
-      overflow-x: auto;
-
-      .table {
-        min-width: 800px;
-      }
-      thead th {
-        background: #fff;
-        position: sticky;
-        top: 0;
-        z-index: 9;
-        min
-      }
-    `}
-  ${({ theme }) => `
-    th span {
-      vertical-align: ${theme.sizeUnit * -2}px;
-    }
-    .text-right {
-      text-align: right;
-    }
-    .empty-collection {
-      padding: ${theme.sizeUnit * 2 + 2}px;
-    }
-    .tiny-cell {
-      width: ${theme.sizeUnit + 1}px;
-    }
-    i.fa-caret-down,
-    i.fa-caret-up {
-      width: ${theme.sizeUnit + 1}px;
-    }
-    td.expanded {
-      border-top: 0;
-      padding: 0;
-    }
-  `}
-`;
+import Table, {
+  ColumnsType,
+  SortOrder,
+  SorterResult,
+  TablePaginationConfig,

Review Comment:
   These need to be imported as type for proper tree shaking 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to