You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/10/01 18:14:45 UTC
[GitHub] [superset] stellalc7 opened a new pull request #16939: fix(styling): resizable table
stellalc7 opened a new pull request #16939:
URL: https://github.com/apache/superset/pull/16939
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
### SUMMARY
fixed styling for resizable table
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] geido commented on a change in pull request #16939: fix(styling): resizable table
Posted by GitBox <gi...@apache.org>.
geido commented on a change in pull request #16939:
URL: https://github.com/apache/superset/pull/16939#discussion_r721177314
##########
File path: superset-frontend/src/SqlLab/components/ResultSet.tsx
##########
@@ -449,6 +455,7 @@ export default class ResultSet extends React.PureComponent<
({ data } = this.state);
}
const { columns } = this.props.query.results;
+ console.log('RESULT_COL:', columns)
Review comment:
```suggestion
```
##########
File path: superset-frontend/src/components/FilterableTable/FilterableTable.tsx
##########
@@ -544,54 +547,32 @@ export default class FilterableTable extends PureComponent<
) as List<Datum>;
}
- let { height } = this.props;
- let totalTableHeight = height;
- if (
- this.container.current &&
- this.totalTableWidth > this.container.current.clientWidth
- ) {
- // exclude the height of the horizontal scroll bar from the height of the table
- // and the height of the table container if the content overflows
- height -= SCROLL_BAR_HEIGHT;
- totalTableHeight -= SCROLL_BAR_HEIGHT;
- }
+ //let { height } = this.props;
+ //let totalTableHeight = height;
+ //if (
+ // this.container.current &&
+ // this.totalTableWidth > this.container.current.clientWidth
+ //) {
+ // // exclude the height of the horizontal scroll bar from the height of the table
+ // // and the height of the table container if the content overflows
+ // height -= SCROLL_BAR_HEIGHT;
+ // totalTableHeight -= SCROLL_BAR_HEIGHT;
+ //}
+
+ //const rowGetter = ({ index }: { index: number }) =>
+ // this.getDatum(sortedAndFilteredList, index);
Review comment:
```suggestion
```
##########
File path: superset-frontend/src/components/FilterableTable/ResizableTable.tsx
##########
@@ -0,0 +1,233 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React, { useEffect } from 'react';
+//import isEqual from 'lodash/isEqual';
+import { styled } from '@superset-ui/core';
+import {
+ useFilters,
+ useGlobalFilter,
+ usePagination,
+ useSortBy,
+ useTable,
+ useResizeColumns,
+ useBlockLayout,
+} from 'react-table';
+import { Empty } from 'src/common/components';
+//import { TableCollection, Pagination } from 'src/components/dataViewCommon';
Review comment:
```suggestion
```
##########
File path: superset-frontend/src/components/FilterableTable/ResizableTable.tsx
##########
@@ -0,0 +1,233 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React, { useEffect } from 'react';
+//import isEqual from 'lodash/isEqual';
+import { styled } from '@superset-ui/core';
+import {
+ useFilters,
+ useGlobalFilter,
+ usePagination,
+ useSortBy,
+ useTable,
+ useResizeColumns,
+ useBlockLayout,
+} from 'react-table';
+import { Empty } from 'src/common/components';
+//import { TableCollection, Pagination } from 'src/components/dataViewCommon';
+import TableDisplay from './TableDisplay';
+import { SortByType } from './types';
+
+export enum EmptyWrapperType {
+ Default = 'Default',
+ Small = 'Small',
+}
+
+export interface ResizableTableProps {
+ columns: any[];
+ data: any[];
+ filterText?: string;
+ totalCount?: number;
+ initialSortBy?: SortByType;
+ loading?: boolean;
+ emptyWrapperType?: EmptyWrapperType;
+ noDataText?: string;
+ className?: string;
+ showRowCount?: boolean;
+ scrollTable?: boolean;
+ small?: boolean;
+}
+
+const EmptyWrapper = styled.div`
+ margin: ${({ theme }) => theme.gridUnit * 40}px 0;
+`;
+
+const ResizableTableStyles = styled.div<{
+ isPaginationSticky?: boolean;
+ scrollTable?: boolean;
+ small?: boolean;
+}>`
+ ${({ scrollTable, theme }) =>
+ scrollTable &&
+ `
+ flex: 1 1 auto;
+ margin-bottom: ${theme.gridUnit * 4}px;
+ overflow: auto;
+ `}
+ .table {
+ border: 1px solid black;
+ width: 100%;
+ }
+ .table-row {
+ }
+
+ .table-cell {
+ ${({ small }) =>
+ small &&
+ `
+ `}
+ }
+ }
+
+ th[role='columnheader'] {
+ z-index: 1;
+ border-bottom: 1px solid black;
+ {/*border-bottom: ${({ theme }) =>
+ `${theme.gridUnit - 2}px solid ${theme.colors.grayscale.light2}`};
+ ${({ small }) => small && `padding-bottom: 0;`}*/}
Review comment:
```suggestion
```
##########
File path: superset-frontend/src/SqlLab/components/ResultSet.tsx
##########
@@ -36,6 +36,7 @@ import ExploreCtasResultsButton from './ExploreCtasResultsButton';
import ExploreResultsButton from './ExploreResultsButton';
import HighlightedSql from './HighlightedSql';
import FilterableTable from '../../components/FilterableTable/FilterableTable';
+//import GlobalFilter from '../../components/FilterableTable/GlobalFilter';
Review comment:
```suggestion
```
##########
File path: superset-frontend/src/components/FilterableTable/FilterableTable.tsx
##########
@@ -186,6 +186,17 @@ export default class FilterableTable extends PureComponent<
return list.get(index % list.size);
}
+ getColumnsWithAccessor(arr: string[]) {
+ let res = [];
+ res = arr.map(name => {
+ let colObj = {
+ Header: name,
+ accessor: name,
+ };
+ return colObj;
+ });
+ return res;
+ }
Review comment:
```suggestion
getColumnsWithAccessor(arr: string[]) {
const res = arr.map(name => (
{
Header: name,
accessor: name,
}
));
return res;
}
```
##########
File path: superset-frontend/src/components/FilterableTable/ResizableTable.tsx
##########
@@ -0,0 +1,233 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React, { useEffect } from 'react';
+//import isEqual from 'lodash/isEqual';
Review comment:
```suggestion
```
##########
File path: superset-frontend/src/components/FilterableTable/ResizableTable.tsx
##########
@@ -0,0 +1,233 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React, { useEffect } from 'react';
+//import isEqual from 'lodash/isEqual';
+import { styled } from '@superset-ui/core';
+import {
+ useFilters,
+ useGlobalFilter,
+ usePagination,
+ useSortBy,
+ useTable,
+ useResizeColumns,
+ useBlockLayout,
+} from 'react-table';
+import { Empty } from 'src/common/components';
+//import { TableCollection, Pagination } from 'src/components/dataViewCommon';
+import TableDisplay from './TableDisplay';
+import { SortByType } from './types';
+
+export enum EmptyWrapperType {
+ Default = 'Default',
+ Small = 'Small',
+}
+
+export interface ResizableTableProps {
+ columns: any[];
+ data: any[];
Review comment:
Same as `columns`, can we use a more specific type?
##########
File path: superset-frontend/src/SqlLab/components/ResultSet.tsx
##########
@@ -64,12 +65,17 @@ enum LIMITING_FACTOR {
const LOADING_STYLES: CSSProperties = { position: 'relative', minHeight: 100 };
+interface ReactTableColumns{
+ Header: string;
Review comment:
Is there a reason why this should be uppercase?
##########
File path: superset-frontend/src/components/FilterableTable/ResizableTable.tsx
##########
@@ -0,0 +1,233 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React, { useEffect } from 'react';
+//import isEqual from 'lodash/isEqual';
+import { styled } from '@superset-ui/core';
+import {
+ useFilters,
+ useGlobalFilter,
+ usePagination,
+ useSortBy,
+ useTable,
+ useResizeColumns,
+ useBlockLayout,
+} from 'react-table';
+import { Empty } from 'src/common/components';
+//import { TableCollection, Pagination } from 'src/components/dataViewCommon';
+import TableDisplay from './TableDisplay';
+import { SortByType } from './types';
+
+export enum EmptyWrapperType {
+ Default = 'Default',
+ Small = 'Small',
+}
+
+export interface ResizableTableProps {
+ columns: any[];
Review comment:
Can we use a more specific type?
##########
File path: superset-frontend/src/components/FilterableTable/ResizableTable.tsx
##########
@@ -0,0 +1,233 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React, { useEffect } from 'react';
+//import isEqual from 'lodash/isEqual';
+import { styled } from '@superset-ui/core';
+import {
+ useFilters,
+ useGlobalFilter,
+ usePagination,
+ useSortBy,
+ useTable,
+ useResizeColumns,
+ useBlockLayout,
+} from 'react-table';
+import { Empty } from 'src/common/components';
+//import { TableCollection, Pagination } from 'src/components/dataViewCommon';
+import TableDisplay from './TableDisplay';
+import { SortByType } from './types';
+
+export enum EmptyWrapperType {
+ Default = 'Default',
+ Small = 'Small',
+}
+
+export interface ResizableTableProps {
+ columns: any[];
+ data: any[];
+ filterText?: string;
+ totalCount?: number;
+ initialSortBy?: SortByType;
+ loading?: boolean;
+ emptyWrapperType?: EmptyWrapperType;
+ noDataText?: string;
+ className?: string;
+ showRowCount?: boolean;
+ scrollTable?: boolean;
+ small?: boolean;
+}
+
+const EmptyWrapper = styled.div`
+ margin: ${({ theme }) => theme.gridUnit * 40}px 0;
+`;
+
+const ResizableTableStyles = styled.div<{
+ isPaginationSticky?: boolean;
+ scrollTable?: boolean;
+ small?: boolean;
+}>`
+ ${({ scrollTable, theme }) =>
+ scrollTable &&
+ `
+ flex: 1 1 auto;
+ margin-bottom: ${theme.gridUnit * 4}px;
+ overflow: auto;
+ `}
+ .table {
+ border: 1px solid black;
+ width: 100%;
+ }
+ .table-row {
+ }
+
+ .table-cell {
+ ${({ small }) =>
+ small &&
+ `
+ `}
+ }
+ }
+
+ th[role='columnheader'] {
+ z-index: 1;
+ border-bottom: 1px solid black;
+ {/*border-bottom: ${({ theme }) =>
+ `${theme.gridUnit - 2}px solid ${theme.colors.grayscale.light2}`};
+ ${({ small }) => small && `padding-bottom: 0;`}*/}
+ border-right: 1px solid black;
+ text-overflow: elipsis;
+ overflow: hidden;
+ }
+
+ tr.table-row:nth-child(odd) {
+ background-color: ${({ theme }) => `${theme.colors.grayscale.light2}`};
+ }
+ tr,
+ td {
+ margin: 0;
+ border-bottom: 1px solid black;
+ border-right: 1px solid black;
+
+ .resizer {
+ display: inline-block;
+ width: 10px;
+ height: 100%;
+ position: absolute;
+ right: 0;
+ top: 0;
+ transform: translateX(50%);
+ z-index: 1;
+ ${'' /* prevents from scrolling while dragging on touch devices */}
+ touch-action:none;
Review comment:
```suggestion
touch-action: none;
```
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org