【angular5项目积累总结】列表多选样式框(1)
憋不住想说一下:angular坑太多,各种教程各种不完整,官网还只是简单的画饼充饥,没办法只有自己研究自己总结,便于以后提高工作效率。
第一种:
view
code
list.css
:host {
display: flex;
width: 100%;
border-left: 1px solid #ccc;
} .fxs-contextMenu {
width: 125px;
margin-left: -115px;
}
.ext-ad-appslist-image {
height: 30px;
width: 30px;
display: inline-block;
vertical-align: middle;
padding: 0px 10px;
}
.search-select {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
border-width: 1px;
border-style: solid;
color: inherit;
display: inline-block;
padding: 2px 5px 2px 2px;
min-height: 15px;
border-color: #bbb;
background-color: #fff;
color: #252525;
width: 26.5%;
}
.search-input {
width: 65%;
padding: 4px;
}
.fxs-grid-selection-cell-wrapper {
display: inline-block;
vertical-align: middle;
}
.fxc-grid2 table thead tr th a {
line-height: 34px;
}
.fxc-grid2.fxc-grid-sorting a.fxc-sortable {
height:38px;
}
.azc-checkboxElementContainer {
display: flex;
width: 17px;
float: left;
margin-top: 9px;
}
.checkbox-pointer {
cursor: pointer;
}
list.html
<panel-component [menuItems]="menuItems" headerTitle="Web 应用列表" initWidth="450px" (closeEvent)="onClose()">
<div class="ext-hubs-browse-grid-parent" style="margin:20px;height:100%;" (click)="activeContextMenu(null,false,null,null)">
<!--查询-->
<div class="ext-hubs-browse-resourcefilter fxc-base fxc-resourcefilter">
<div class="fxc-resourcefilter-summary-filters">
<div class="fxc-base msportalfx-form-formelement azc-textField fxc-TextField fxc-resourcefilter-visible fxc-resourcefilter-filter">
<div class="azc-formElementContainer">
<div class="azc-formElementContainer azc-formElementSubLabelContainer">
<div class="fxc-base azc-control azc-editableControl azc-validatableControl azc-inputbox azc-textBox azc-validatableControl-none" data-canfocus="true" data-editable="true">
<div class="azc-inputbox-wrapper azc-textBox-wrapper" tabindex="-1" style="outline: none">
<input [(ngModel)]="searchName" (keyup)="loadWebApp()" aria-describedby="2a5d6185-45de-4683-a402-5c36596aa0a1" aria-inval aria-label="按名称筛选..."
aria-multiline="false" class="azc-input azc-formControl azc-validation-border search-input"
placeholder="按应用名称搜索" spellcheck="false" type="text">
<select class="search-select" [(ngModel)]="searchCategory" (change)="loadWebApp()">
<option value="0">所有应用</option>
<option *ngFor="let category of lstCategory" [value]='category.key'>{{category.value}}</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--列表信息-->
<div class="ext-hubs-browse-grid fxc-base fxs-grid-focus fxc-grid-sorting fxc-grid-scrolling fxc-grid-resizing fxs-grid-selection fxc-grid-contextMenu fxc-grid-grouping fxc-grid2 azc-control fxc-grid-verticalScroll">
<div class="fxc-grid-container azc-br-muted">
<div class="fxc-grid-tableContainer azc-br-muted" style="padding-top: 42px;">
<div class="fxc-grid-tableScrollContainer azc-br-muted">
<table class="fxc-grid-tableHeader fxs-grid-multiselection" data-grid-activation="true" style="width: calc(100% - 17px);">
<thead>
<tr>
<th class="fxc-grid-sorting-header fxc-grid-column-header " style="width:35%;">
<div class="fxc-grid-header-wrapper">
<div class="azc-checkboxElementContainer checkbox-pointer" (click)="onAllCheck()">
<div class="fxc-base azc-control azc-editableControl azc-validatableControl azc-checkBox azc-input azc-validatableControl-none">
<span class="azc-fill-text azc-validation-border">
<svg focusable="false" class="azc-checkBox-svg azc-check-svg" version="1.1" xmlns="http://www.w3.org/2000/svg'" xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="11px" height="11px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" space="preserve" style="visibility: hidden;" [ngStyle]="{'visibility':isAllChecked?'':'hidden'}">
<path d="M0.6 8.9L0.1 8.3C0 8.1 0 7.9 0.1 7.7l1.5-1.4c0.1-0.1 0.2-0.1 0.3-0.1 0.1 0 0.2 0 0.3 0.1l4.2 4.5 7.3-9.3c0.1-0.1 0.2-0.1 0.3-0.1 0.1 0 0.2 0 0.2 0.1l1.7 1.3c0.1 0.1 0.1 0.1 0.1 0.2 0 0.1 0 0.2-0.1 0.3L6.6 15.2 0.6 8.9z"></path>
</svg>
<svg focusable="false" class="azc-checkBox-svg azc-indeterminate-svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12px" height="12px" enable="" background="new 0 0 24 24" space="preserve" [ngStyle]="{'visibility':isHasChecked?'':'hidden'}">
<rect x="1px" y="1px" width="9" height="9"></rect>
</svg>
</span>
</div>
</div>
<a aria-sort="none" class="fxc-sortable fxc-none" style="width: 70%;">
<span class="fxc-grid-headerlabel">显示名称</span>
</a>
<div class="fxc-grid-resizableColumn-handle">
<div class="fxc-grid-resizableColumn-handle-line azc-bg-muted">
</div>
</div>
</div>
</th>
<th class="fxc-grid-sorting-header fxc-grid-column-header " style="width:25%;">
<div class="fxc-grid-header-wrapper">
<a aria-sort="none" class="fxc-sortable fxc-none">
<span class="fxc-grid-headerlabel">App ID</span>
</a>
<div class="fxc-grid-resizableColumn-handle">
<div class="fxc-grid-resizableColumn-handle-line azc-bg-muted">
</div>
</div>
</div>
</th>
<th class="fxc-grid-sorting-header fxc-grid-column-header " style="width:20%;">
<div class="fxc-grid-header-wrapper">
<a aria-sort="none" class="fxc-sortable fxc-none">
<span class="fxc-grid-headerlabel">类型</span>
</a>
<div class="fxc-grid-resizableColumn-handle">
<div class="fxc-grid-resizableColumn-handle-line azc-bg-muted">
</div>
</div>
</div>
</th>
<th class="fxc-grid-sorting-header fxc-grid-column-header " style="width:16%;">
<div class="fxc-grid-header-wrapper">
<a aria-sort="none" class="fxc-sortable fxc-none">
<span class="fxc-grid-headerlabel">状态</span>
</a>
<div class="fxc-grid-resizableColumn-handle">
<div class="fxc-grid-resizableColumn-handle-line azc-bg-muted">
</div>
</div>
</div>
</th>
</tr>
</thead>
</table>
<div class="fxc-grid-tableContent" style="height:calc(100% - 120px); position: relative; overflow-x: hidden;">
<table class="fxc-grid-full fxs-grid-multiselection" data-grid-activation="true" style="position: absolute;">
<tbody class="fxc-grid-groupdata ">
<tr class="fxc-grid-row fxs-portal-focus fxs-portal-hover" [ngClass]="{'fxs-portal-selected':app.isSelected}" *ngFor="let app of lstApp;let i = index" (click)="onOpenDetailById(app.id,i)">
<td class="fxc-grid-cell azc-br-muted" style="width:33%;">
<div class="azc-vivaControl">
<div class="fxs-grid-selection-cell-wrapper fxs-portal-border azc-fill-text checkbox-pointer" (click)="onCheck(i,$event)">
<div class="fxs-grid-selection-cell-check">
<div class="fx-grid-formatters-svg">
<span class="fx-grid-formatters-svgicon" style="height: 11px; width: 11px;">
<svg height="100%" width="100%" aria-hidden="true" role="presentation" focusable="false" [ngStyle]="{'visibility':app.isChecked?'':'hidden'}">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#FxSymbol0-0c2"></use>
</svg>
</span>
</div>
</div>
</div>
<img *ngIf="app.category == 1" class="ext-ad-appslist-image" alt="应用程序图标" src="https://gallery.windowsazure.cn/artifact/20161101/Microsoft.WebSite.2.2.0/Icons/Small.png">
<!--<img *ngIf="app.category == 2" class="ext-ad-appslist-image" alt="应用程序图标" src="https://gallery.windowsazure.cn/artifact/20161101/Microsoft.Zumo.1.0.21/Icons/Small.png">-->
<img *ngIf="app.category == 2" class="ext-ad-appslist-image" alt="应用程序图标" src="https://gallery.windowsazure.cn/artifact/20161101/Microsoft.ApiApp.1.0.1/Icons/Small.png">
<span data-bind="text: value" class="msportalfx-text-ellipsis">{{app.displayName}}</span>
</div>
</td>
<td class="fxc-grid-cell azc-br-muted" style="width:25%;">
<div class="azc-grid-cellContent">{{app.name}}</div>
</td>
<td class="fxc-grid-cell azc-br-muted" style="width:16%;">
<div class="azc-grid-cellContent">{{getDictLabel(lstCategory,app.category)}}</div>
</td>
<td class="fxc-grid-cell azc-br-muted" style="width:16%;" align="center">
<div class="azc-grid-cellContent">{{getDictLabel(lstAppStatus,(app.status + 1))}}</div>
</td>
<td class="fxc-grid-contextMenuShortcut-cell azc-br-muted">
<a (click)="activeContextMenu($event,true,i,app)" class="msportalfx-inherit-color fxs-portal-svg" href="javascript:;" role="button" title="单击以打开上下文菜单" tabindex="0">
<svg height="100%" width="100%" aria-hidden="true" role="presentation" focusable="false"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#FxSymbol0-013"></use></svg>
</a>
</td>
</tr> </tbody>
</table> </div>
</div> </div> </div>
<div aria-hidden="true" class="fxs-hide-accessible-label">
</div>
<div class="azc-resize azc-resize-shrink">
<div class="azc-resize-content" style="width: 200%; min-width: 1px; height: 200%; min-height: 1px;">
</div> </div>
<div class="azc-resize azc-resize-grow">
<div class="azc-resize-content" style="width: 517px; height: 518px;">
</div> </div>
<div class="fxs-commands-contextMenu fxs-contextMenu fxs-popup fxs-portal-bg-txt-br" [ngClass]="{'fxs-contextMenu-active' : isActiveMenu}" [ngStyle]="{'top.px': menuTop,'left.px': menuLeft}">
<ul role="menu" class="fxs-contextMenu-itemList" data-bind="foreach: { data: commands, afterRender: afterRender }, attr: { 'aria-label': ariaLabel }" aria-label="上下文菜单">
<li role="menuitem" class="fxs-contextMenu-item fxs-portal-hover" tabindex="0" aria-posinset="1" aria-setsize="1" (click)="onOpenDetail()">
<div class="fxs-contextMenu-text fxs-portal-text msportalfx-text-ellipsis" data-bind="text: text">查看</div>
</li>
<li role="menuitem" class="fxs-contextMenu-item fxs-portal-hover" tabindex="0" aria-posinset="1" aria-setsize="1" (click)="removeCurApp()">
<div class="fxs-contextMenu-text fxs-portal-text msportalfx-text-ellipsis" data-bind="text: text">删除</div>
</li>
</ul>
</div>
</div>
</div>
</panel-component>
<router-outlet></router-outlet>
list.ts
import { Component } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { AppStoreService } from '../service/appStoreService'
import { CommonService } from '../../providers/commonService'; @Component({
selector: 'all-app',
templateUrl: './allApp.html',
styleUrls: ['./allApp.css']
}) export class AllApp {
constructor(
private router: Router,
private actRouter: ActivatedRoute,
private appStoreService: AppStoreService,
private comService: CommonService) {
this.subscribeUpdate(comService);
} lstApp: any;
lstCategory: any;
lstAppStatus: any;
searchName: string;
searchCategory: any = 0;
isActiveMenu: boolean = false;
menuTop: any;
menuLeft: any;
currIndex: any;
currApp: any;
isAllChecked: boolean = false;
isHasChecked: boolean = false;
parentUrl: string;
menuItems: any = [
{ title: "应用注册", icon: "#FxSymbol0-010", event: this.regWebApp.bind(this) },
{ title: "应用审核", icon: "#FxSymbol0-077", event: this.auditWebApp.bind(this) },
{ title: "刷新", icon: "#FxSymbol0-0c4", event: this.loadWebApp.bind(this) }, ] ngOnInit(): void {
this.actRouter.parent.params.subscribe((params) => {
this.parentUrl = this.router.url;
this.loadWebApp();
});
this.appStoreService.GetCategoryList((rtv) => {
this.lstCategory = rtv;
});
this.appStoreService.GetAppSatus((rtv) => {
this.lstAppStatus = rtv;
});
} loadWebApp() {
this.appStoreService.AllApp(this.searchName, this.searchCategory,(result) => {
this.lstApp = result;
})
} onClose() {
this.router.navigate(['/home'], {});
}
activeContextMenu(event: any, isActive: boolean,index: any,app: any) {
this.isActiveMenu = isActive;
if (event) {
this.menuLeft = event.pageX - 20;
this.menuTop = event.pageY - 10;
event.stopPropagation();
}
this.currIndex = index;
this.currApp = app;
}
removeCurApp() {
let _this = this;
this.currApp.id && this.appStoreService.DeleteApp(this.currApp.id, (result) => {
_this.loadWebApp()
})
}
getDictLabel(dict: any, key: any) {
if (dict && dict.length > 0) {
let curItem = dict.filter(item => { return item.key == key });
return curItem.length > 0 ? curItem[0].value : '';
}
}
regWebApp() {
this.router.navigate([this.parentUrl +'/create'], {});
}
onOpenDetail() {
this.currApp.id && this.router.navigate([this.parentUrl + '/' + this.currApp.id]);
}
onOpenDetailById(id: string, index: any) {
this.lstApp.map((app, i) => i == index ? app.isSelected = true : app.isSelected = false);
id && this.router.navigate([this.parentUrl + '/' + id]);
}
subscribeUpdate(comService: CommonService) {
this.comService.notifyObservable$.subscribe(data => {
if (data == 'refreshWebApp') {
this.loadWebApp();
}
}, error => {
console.log(`subscribe error:${error}`)
})
}
auditWebApp() {
this.router.navigate([this.parentUrl + '/regAudit']);
}
onAllCheck() {
this.isAllChecked = !this.isAllChecked;
this.lstApp.map(app => app.isChecked = this.isAllChecked);
this.isHasChecked = false;
}
onCheck(index: any,event: any) {
this.lstApp[index].isChecked = !this.lstApp[index].isChecked;
let isAllCheck = this.lstApp.every(app => { return app.isChecked == true });
isAllCheck ? this.isAllChecked = true : this.isAllChecked = false;
let isHasCheck = this.lstApp.some(app => { return app.isChecked == true });
isHasCheck && !isAllCheck ? this.isHasChecked = true : this.isHasChecked = false;
event && event.stopPropagation();
}
}
【angular5项目积累总结】列表多选样式框(1)的更多相关文章
- 【angular5项目积累总结】列表多选样式框(2)
view code list.css :host { display: flex; width: 100%; border-left: 1px solid #ccc; font: normal 12p ...
- 【angular5 项目积累总结】项目公共样式
main.css @font-face { font-family: 'wf_segoe-ui_normal'; src: local('Segoe UI'),url('../fonts/segoe- ...
- 【angular5项目积累总结】遇到的一些问题以及解决办法
1.项目中字符串特别是\r\n,替换成br之后,在页面换行无法生效? 答:绑定元素 innerHTML. <div class="panel-body" [innerHTML ...
- 【angular5项目积累总结】消息订阅服务
code import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; @Injectable ...
- 【angular5项目积累总结】优秀组件以及应用实例
1.手机端 图片预览组件 组件:sideshow 效果图:(预览图全屏 且可以左右移动) code: <div class="row ui-app-s ...
- 【angular5项目积累总结】表单复杂校验
view code form.css :host { display: flex; width: 100%; height:100%; border-left:1px solid #ccc; } .i ...
- 【angular5项目积累总结】侧栏菜单 navmenu
View Code import { Component, OnInit } from '@angular/core'; import { HttpClient } from '@angular/co ...
- 【angular5项目积累总结】avatar组件
View Code import { Component, HostListener, ElementRef } from '@angular/core'; import { Adal4Service ...
- 【angular5项目积累总结】breadcrumb面包屑组件
view code <div class="fxs-breadcrumb-wrapper" aria-label="Navigation history" ...
随机推荐
- (zxing.net)一维码EAN 8的简介、实现与解码
一.简介 一维码EAN 8:属于国际标准条码,由8个数字组成,属EAN的简易编码形式(EAN缩短码).当包装面积小于120平方公分以下无法使用标准码时,可以申请使用缩短码. 依结构的不同,EAN条码可 ...
- ES6——Class的继承
class 的继承和使用. 子类继承父类,使用extends关键字. 为父类知道那个静态方法,使用 static方法名字super: 在构造函数中,可以当一个函数来使用,相当于调用父类的构造函数. 在 ...
- 「WC2006」水管局长
题目链接 戳我 \(Solution\) 这道题实际上是维护一个最小生成树,因为正的搞不好搞,所以反着搞会比较好,现将没有没删掉的边留下来生成一颗最小生成树,再加边就好了,现在\(LCT\) 来看看怎 ...
- 【flask macro】No caller defined
https://segmentfault.com/q/1010000005352059/a-1020000005352912 先码着 有时间了再换成caller() 先用老方法吧...
- angular核心原理解析1:angular自启动过程
angularJS的源代码整体上来说是一个自执行函数,在angularJS加载完成后,就会自动执行了. angular源代码中: angular = window.angular || (window ...
- AngularJS入门讲解3:$http服务和路由讲解
上一课的例子中,我们的模型数据是硬编码的,也就是说,我们的数据不是从服务器请求回来的. 这里,我们先讲解,如何从服务器获取数据: function PhoneListCtrl($scope, $htt ...
- iphone 自学常用网址
https://www.gitbook.com/book/numbbbbb/-the-swift-programming-language-/details https://github.com/ip ...
- python --爬虫--爬取百度翻译
import requestsimport json class baidufanyi: def __init__(self, trans_str): self.lang_detect_url = ' ...
- [转]CocoaPods安装和使用教程
[转载自:http://code4app.com/article/cocoapods-install-usage] 目录 CocoaPods是什么? 如何下载和安装CocoaPods? 如何使用Coc ...
- 解决无法运行Terminator出现以下问题: File "/usr/bin/terminator"...SyntaxError: invalid syntax
在安装或者启动Terminator时可能出现这个问题: lin@Dev:~$ terminator File "/usr/bin/terminator", line 123 exc ...