Skip to content

Commit

Permalink
PATCH: fix(table): update styles and doc + add typings
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRichel committed Nov 14, 2022
1 parent 5c9eb63 commit eff870d
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"ecmaVersion": 11,
"sourceType": "module"
},
"ignorePatterns": ["/dist", "/dist-web"],
"ignorePatterns": ["/dist", "/dist-web", "*.d.ts"],
"rules": {
"prettier/prettier": "error",
"indent": "off",
Expand Down
33 changes: 33 additions & 0 deletions src/BIMDataComponents/BIMDataTable/BIMDataTable.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
declare namespace BIMDataTable {
type Columns = string[] | Column[];
type Rows = string[][] | Object[];

interface Data {
columns: Columns;
rows: Rows;
}

interface Style {
tableWidth?: string;
tableLayout?: string;
rowHeight?: number;
placeholder?: string;
}

interface Config {
rowKey?: string;
selectable?: boolean;
sortable?: boolean;
paginated?: boolean;
perPage?: number;
}

interface Column {
id: string;
type?: "number" | "string" | "enum" | "boolean" | "date";
label?: string;
width?: string;
align?: "left" | "center" | "right";
sort?: (a: any, b: any) => number;
}
}
2 changes: 1 addition & 1 deletion src/BIMDataComponents/BIMDataTable/BIMDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
class="bimdata-table__container__placeholder"
v-if="rows.length === 0"
:style="{
height: `calc(100% - ${placeholder ? rowHeight : 0}px)`,
height: `calc(100% - ${rowHeight}px)`,
}"
>
<slot name="placeholder">
Expand Down
2 changes: 2 additions & 0 deletions src/BIMDataComponents/BIMDataTable/_BIMDataTable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
background-color: var(--color-white);

&__container {
height: 100%;

table {
border-collapse: collapse;
border-spacing: 0;
Expand Down
8 changes: 8 additions & 0 deletions src/web/views/Components/Table/props-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ export default [
"Use this props to define table rows.",
"[ ['John', 'Doe', 23], ['Jane', 'Doe', 24] ]",
],
[
"rowKey",
"String",
"",
"",
"Define the field to be used as a key for each row.",
"",
],
[
"rowHeight",
"Number",
Expand Down

0 comments on commit eff870d

Please sign in to comment.