Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sample-demo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyen Ha
sample-demo
Commits
5fb074b8
Commit
5fb074b8
authored
Dec 08, 2020
by
Nguyen Ha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parent
7f3ca032
Pipeline
#1451
failed with stages
Changes
11
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
312 additions
and
541 deletions
+312
-541
angular.json
angular.json
+7
-4
package.json
package.json
+1
-1
src/app/app.component.html
src/app/app.component.html
+8
-532
src/app/app.component.scss
src/app/app.component.scss
+0
-0
src/app/app.component.ts
src/app/app.component.ts
+135
-2
src/app/app.module.ts
src/app/app.module.ts
+7
-2
src/app/components/grid/grid.component.html
src/app/components/grid/grid.component.html
+59
-0
src/app/components/grid/grid.component.scss
src/app/components/grid/grid.component.scss
+53
-0
src/app/components/grid/grid.component.ts
src/app/components/grid/grid.component.ts
+36
-0
src/app/components/grid/grid.ts
src/app/components/grid/grid.ts
+6
-0
src/styles.scss
src/styles.scss
+0
-0
No files found.
angular.json
View file @
5fb074b8
...
...
@@ -24,7 +24,7 @@
"src/assets"
],
"styles"
:
[
"src/styles.css"
"src/styles.
s
css"
],
"scripts"
:
[]
},
...
...
@@ -87,7 +87,7 @@
"src/assets"
],
"styles"
:
[
"src/styles.css"
"src/styles.
s
css"
],
"scripts"
:
[]
}
...
...
@@ -120,5 +120,8 @@
}
}
},
"defaultProject"
:
"sample"
}
"defaultProject"
:
"sample"
,
"cli"
:
{
"analytics"
:
false
}
}
\ No newline at end of file
package.json
View file @
5fb074b8
...
...
@@ -3,7 +3,7 @@
"version"
:
"0.0.0"
,
"scripts"
:
{
"ng"
:
"ng"
,
"start"
:
"ng serve"
,
"start"
:
"ng serve
--port 4500
"
,
"build"
:
"ng build"
,
"test"
:
"ng test"
,
"lint"
:
"ng lint"
,
...
...
src/app/app.component.html
View file @
5fb074b8
This diff is collapsed.
Click to expand it.
src/app/app.component.css
→
src/app/app.component.
s
css
View file @
5fb074b8
File moved
src/app/app.component.ts
View file @
5fb074b8
import
{
Component
}
from
'
@angular/core
'
;
import
{
IGridCell
}
from
'
./components/grid/grid
'
;
const
sampleGridCells
:
IGridCell
[]
=
[
{
label
:
'
Name
'
,
align
:
'
left
'
,
field
:
'
name
'
,
width
:
200
},
{
label
:
'
Account Number
'
,
align
:
'
center
'
,
field
:
'
account_number
'
,
width
:
150
},
{
label
:
'
Balance
'
,
align
:
'
right
'
,
field
:
'
balance
'
,
width
:
140
},
];
@
Component
({
selector
:
'
app-root
'
,
templateUrl
:
'
./app.component.html
'
,
styleUrls
:
[
'
./app.component.
css
'
]
styleUrls
:
[
'
./app.component.
scss
'
],
})
export
class
AppComponent
{
title
=
'
sample
'
;
isLoading
=
false
;
gridCells
:
IGridCell
[]
=
sampleGridCells
;
totalRows
=
50
;
samples
:
any
[]
=
[
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1111
'
,
balance
:
'
1111
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1133
'
,
balance
:
'
1133
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
},
{
name
:
'
Nguyen Van Ha
'
,
account_number
:
'
1122
'
,
balance
:
'
1122
'
}
];
onLoaded
():
void
{}
}
src/app/app.module.ts
View file @
5fb074b8
...
...
@@ -2,15 +2,20 @@ import { BrowserModule } from '@angular/platform-browser';
import
{
NgModule
}
from
'
@angular/core
'
;
import
{
AppComponent
}
from
'
./app.component
'
;
import
{
GridComponent
}
from
'
./components/grid/grid.component
'
;
@
NgModule
({
declarations
:
[
AppComponent
AppComponent
,
GridComponent
],
imports
:
[
BrowserModule
],
exports
:
[
GridComponent
],
providers
:
[],
bootstrap
:
[
AppComponent
]
bootstrap
:
[
AppComponent
]
,
})
export
class
AppModule
{
}
src/app/components/grid/grid.component.html
0 → 100644
View file @
5fb074b8
<div
class=
"grid__body"
#gridBodyRef
>
<div
class=
"grid__no-items"
*ngIf=
"!isLoading && (!rows || !rows.length); else hasItems"
>
<span>
no items
</span>
</div>
<ng-template
#hasItems
>
<table
class=
"table"
>
<thead>
<tr>
<th
scope=
"col"
*ngFor=
"let cell of cells;"
[ngClass]=
"{
'grid__block--left': cell.align === 'left',
'grid__block--center': cell.align === 'center',
'grid__block--right': cell.align === 'right'
}"
[style.width.px]=
"cell.width"
>
{{cell.label}}
</th>
</tr>
</thead>
<tbody
class=
"tbody-custom"
>
<tr
class=
"grid__item"
*ngFor=
"let item of rows;"
>
<td
class=
"grid__block"
*ngFor=
"let cell of cells;"
[ngClass]=
"{
'grid__block--left': cell.align === 'left',
'grid__block--center': cell.align === 'center',
'grid__block--right': cell.align === 'right'
}"
[style.width.px]=
"cell.width"
>
{{item[cell.field]}}
</td>
</tr>
</tbody>
<div
class=
"pagination"
>
<a
href=
"#"
>
«
</a>
<a
href=
"#"
class=
"active"
>
1
</a>
<a
href=
"#"
>
2
</a>
<a
href=
"#"
>
3
</a>
<a
href=
"#"
>
4
</a>
<a
href=
"#"
>
5
</a>
<a
href=
"#"
>
6
</a>
<a
href=
"#"
>
»
</a>
</div>
</table>
<!-- <a class="grid__row" *ngFor="let item of rows;">
<div class="grid__item">
<div class="grid__block" *ngFor="let cell of cells, index as i" [ngClass]="{
'grid__block--left': cell.align === 'left',
'grid__block--center': cell.align === 'center',
'grid__block--right': cell.align === 'right'
}" [style.width.px]="cell.width">
<ng-container *ngTemplateOutlet="cellContentsArray[i]; context: { item: item }"></ng-container>
</div>
</div>
</a> -->
</ng-template>
<!-- <ng-template #row let-item="item">
{{row|json}}
</ng-template> -->
</div>
\ No newline at end of file
src/app/components/grid/grid.component.scss
0 → 100644
View file @
5fb074b8
table
{
width
:
100%
;
th
{
background
:
rgb
(
0
,
140
,
255
);
color
:
white
;
}
th
,
td
{
border-bottom
:
.5px
solid
#333
;
padding
:
10px
5px
;
}
}
.grid__block--left
{
text-align
:
left
;
}
.grid__block--center
{
text-align
:
center
;
}
.grid__block--right
{
text-align
:
right
;
}
tbody
{
display
:block
;
height
:
200px
;
overflow
:auto
;
}
thead
,
tbody
tr
{
display
:table
;
width
:
100%
;
table-layout
:fixed
;
}
thead
{
width
:
calc
(
100%
-
1em
)
}
.pagination
{
margin-top
:
30px
;
display
:
flex
;
justify-content
:
center
;
}
.pagination
a
{
color
:
black
;
float
:
left
;
padding
:
8px
16px
;
text-decoration
:
none
;
}
.pagination
a
.active
{
background-color
:
rgb
(
0
,
140
,
255
);
color
:
white
;
}
.pagination
a
:hover:not
(
.active
)
{
background-color
:
#ddd
;}
src/app/components/grid/grid.component.ts
0 → 100644
View file @
5fb074b8
import
{
AfterViewInit
,
ChangeDetectionStrategy
,
ChangeDetectorRef
,
Component
,
ContentChildren
,
EventEmitter
,
Input
,
OnInit
,
Output
,
QueryList
,
TemplateRef
,
}
from
'
@angular/core
'
;
import
{
IGridCell
}
from
'
./grid
'
;
@
Component
({
selector
:
'
app-grid
'
,
templateUrl
:
'
./grid.component.html
'
,
styleUrls
:
[
'
./grid.component.scss
'
],
changeDetection
:
ChangeDetectionStrategy
.
OnPush
,
})
export
class
GridComponent
implements
OnInit
,
AfterViewInit
{
@
Input
()
cells
:
IGridCell
[]
=
[];
@
Input
()
rows
:
[]
=
[];
@
Input
()
totalRows
:
number
;
@
Input
()
isLoading
=
false
;
@
Input
()
pagingMode
:
string
|
'
paging
'
|
'
scroll
'
;
// tslint:disable-next-line: no-output-rename
@
Output
(
'
isLoaded
'
)
isLoaded
=
new
EventEmitter
<
any
>
();
constructor
(
private
cdr
:
ChangeDetectorRef
)
{}
ngOnInit
():
void
{}
ngAfterViewInit
():
void
{}
}
src/app/components/grid/grid.ts
0 → 100644
View file @
5fb074b8
export
interface
IGridCell
{
label
:
string
;
align
:
'
center
'
|
'
left
'
|
'
right
'
;
field
:
string
;
width
?:
number
;
}
src/styles.css
→
src/styles.
s
css
View file @
5fb074b8
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment