-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/#2118-do-not-calculate-coverage-o…
…n-external-PR
- Loading branch information
Showing
5 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Example for column name styling for header | ||
|
||
import pandas as pd | ||
|
||
from taipy.gui import Gui, Markdown | ||
|
||
# Sample data in DataFrame format | ||
df = pd.DataFrame({ | ||
"Name": ["Alice", "Bob", "Charlie"], | ||
"Age": [25, 30, 35], | ||
"Job or Occupation": ["Engineer", "Doctor", "Artist"] | ||
}) | ||
|
||
|
||
# Page content with table and header styling | ||
page = Markdown(""" | ||
<|table|data={df}|columns={columns}|> | ||
""", style={".taipy-table-name": {"color": "blue"}, ".taipy-table-job-or-occupation": {"color": "green"}}) | ||
|
||
if __name__ == "__main__": | ||
Gui(page).run(title="Column Name Styling Example") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
frontend/taipy-gui/src/components/Taipy/tableUtils.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { generateHeaderClassName } from "./tableUtils"; | ||
|
||
describe("generateHeaderClassName", () => { | ||
it("should generate a CSS class name with a hyphen prefix and convert to lowercase", () => { | ||
const result = generateHeaderClassName("ColumnName"); | ||
expect(result).toBe("-columnname"); | ||
}); | ||
|
||
it("should replace spaces and special characters with hyphens", () => { | ||
const result = generateHeaderClassName("Column Name@123!"); | ||
expect(result).toBe("-column-name-123-"); | ||
}); | ||
|
||
it("should remove multiple hyphens in a row", () => { | ||
const result = generateHeaderClassName("Column--Name"); | ||
expect(result).toBe("-column-name"); | ||
}); | ||
|
||
it("should handle empty strings and return an empty string", () => { | ||
const result = generateHeaderClassName(""); | ||
expect(result).toBe(""); | ||
}); | ||
|
||
it("should return empty string for the undefined", () => { | ||
const result = generateHeaderClassName(undefined); | ||
expect(result).toBe(""); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters