Skip to content

Commit

Permalink
fix(MD-4117): increase line wdith (#247)
Browse files Browse the repository at this point in the history
* fix(MD-4117): increase line wdith

* fix(MD-4221): increase icon size

* fix(MD-4210): check for view data on expand row

* fix(MD-4223): check for svg data

* fix(QB-18718): update hit rect on first column view

* fix(MD-4201): remove NA text

---------

Co-authored-by: Vittorio Cellucci <vel@qlik.com>
  • Loading branch information
vcellu and vcellu committed Mar 29, 2023
1 parent 88c6a4c commit 108b4b2
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
if(recyclerView != null) {
recyclerView.updateHitRect(w, h);
}
if(firstColumnView != null) {
firstColumnView.updateHitRect(w, h);
}
}

void createRecyclerView() {
Expand Down
3 changes: 2 additions & 1 deletion ios/ColumnResizerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ColumnResizerView: UIView {
var centerConstraint = NSLayoutConstraint()
var index = 0
var linePath = UIBezierPath()
var lineWidth: CGFloat = 1.0
weak var tableView: TableView?
weak var adjacentTable: TableView?
weak var button: ResizerButtonView?
Expand Down Expand Up @@ -155,7 +156,7 @@ class ColumnResizerView: UIView {
linePath.removeAllPoints()
linePath.move(to: CGPoint(x: x, y: 0))
linePath.addLine(to: CGPoint(x: x, y: rect.height))
linePath.lineWidth = 1
linePath.lineWidth = self.lineWidth

let color = pressed ? .black : borderColor
color.setStroke()
Expand Down
8 changes: 8 additions & 0 deletions ios/PaddedLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,21 @@ class PaddedLabel: UILabel, SelectionsListener, ConstraintCellProtocol {
}

func setImageLabel(_ col: DataColumn, cell: DataCell) {
if let qText = cell.qText {
if qText.starts(with: "data:image/svg+xml") {
self.text = qText
return
}
}

if setLabelFromStyle(style: "imageLabel", col: col, cell: cell) {
return
}
_ = setLabelFromStyle(style: "imageUrl", col: col, cell: cell)
}

func setLabelFromStyle(style: String, col: DataColumn, cell: DataCell) -> Bool {

if let imageIndex = col.stylingInfo?.firstIndex(of: style) {
if let text = cell.qAttrExps?.qValues?[imageIndex].qText {
self.text = text
Expand Down
2 changes: 1 addition & 1 deletion ios/TableViewFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class TableViewFactory {
resizer.headerView = firstColumnTableView.headerView
resizer.totalsView = firstColumnTableView.totalView
resizer.selectionsBand = firstColumnTableView.dataCollectionView?.selectionBand

resizer.lineWidth = 2.0
resizer.translatesAutoresizingMaskIntoConstraints = false
resizer.borderColor = ColorParser.fromCSS(cssString: containerView.tableTheme?.borderBackgroundColor ?? "lightgray")
containerView.hScrollViewDelegate.grabber = resizer
Expand Down
2 changes: 1 addition & 1 deletion ios/TotalCellsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TotalCellsView: UIView {
textView.removeFromSuperview()
}
let view = UILabel()
view.text = "NA"
view.text = ""
view.textAlignment = .right
view.font = UIFont.systemFont(ofSize: 14)
addSubview(view)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type CellProps = {

const Cell: React.FC<CellProps> = ({ rowData, colData, style, viewData }) => {
const getCell = useCallback(() => {
if (colData.representation.type === 'miniChart') {
if (colData.representation.type === 'miniChart' && !viewData) {
return (
<MiniChart
style={styles.miniChart}
Expand Down
4 changes: 0 additions & 4 deletions src/components/ImageCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export type ImageCellProps = {
};

const ImageCell: React.FC<ImageCellProps> = ({ rowData, colData, style }) => {
console.log('row data', rowData);
const imageUrl = useMemo(() => {
if (colData?.representation?.imageSetting === 'label') {
return rowData.qText;
Expand All @@ -23,16 +22,13 @@ const ImageCell: React.FC<ImageCellProps> = ({ rowData, colData, style }) => {
return rowData.qText;
}, [colData, rowData]);

console.log(rowData);

const xmlSVG = useMemo(() => {
if (rowData?.qText?.startsWith('data:image/svg+xml,')) {
return rowData.qText.substring('data:image/svg+xml,'.length);
}
return null;
}, [rowData]);

console.log(xmlSVG);
return (
<View style={style}>
{xmlSVG !== null ? (
Expand Down
15 changes: 13 additions & 2 deletions src/components/TextCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ const iconMap = new Map([
['dot', 'circle'],
]);

const extractText = ({rowData, colData}) => {
if(colData.representation?.type === 'image') {
const index = colData.stylingInfo?.findIndex((item: any) => item === 'imageLabel');
if (index !== -1 && index < rowData.qAttrExps?.qValues?.length) {
return rowData.qAttrExps.qValues[index].qText;
}
}
return rowData.qText;
}

const TextCell: React.FC<TextCellProps> = ({ rowData, colData }) => {
const extendedTextStyle = useMemo(() => {
let color;
Expand Down Expand Up @@ -57,13 +67,13 @@ const TextCell: React.FC<TextCellProps> = ({ rowData, colData }) => {

return (
<View style={styles.textRow}>
<Text style={[styles.textCol2, extendedTextStyle]}>{rowData.qText}</Text>
<Text style={[styles.textCol2, extendedTextStyle]}>{extractText({rowData, colData})}</Text>
{iconStyle?.name ? (
<MaterialIcons
style={[styles.icon]}
name={iconStyle.name}
color={iconStyle.color}
size={16}
size={20}
/>
) : null}
</View>
Expand All @@ -88,6 +98,7 @@ const styles = StyleSheet.create({
},
icon: {
marginLeft: 8,
alignSelf: 'center',
},
});

Expand Down

0 comments on commit 108b4b2

Please sign in to comment.