【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" ...
随机推荐
- osgi.net框架
osgi.net是一个动态的模块化框架.它向用户提供了模块化与插件化.面向服务构架和模块扩展支持等功能.该平台是OSGi联盟定义的服务平台规范移植到.NET的实现. 简介 尤埃开放服务平台是一个基于. ...
- 用jquery-table2excel,进行导出excel
jquery-table2excel是一款可以将HTML表格的内容导出到微软Excel电子表格中的jQuery插件.该插件可以根据你的需要导出表格中的内容,不需要的行可以不导出. 它文件体积小,使用非 ...
- oracle数据导出导入(exp/imp)
1.本地数据库导入导出 1.导出 (运行---cmd中操作)exp 用户名/密码@数据库实例名file=本地存放路径eg: exp jnjp/jnjp@ORCL file=C:/jnjp.dmp 2. ...
- sharepoint 2013 升级要求
1. 安装过程合理: A. 可以同时在管理中心.两台前端.搜索服务器上安装重新发布的SP1补丁包(所提供的链接) B. 等待所有SP1补丁包安装完成,依次在管理中心.两台前端.搜索服务器上运行配置向导 ...
- php实现循环链表
<?php /** * php实现链表 * Date: 2018/5/18 * Time: 下午5:59 */ class Node { public $nodeId = 0; public $ ...
- Linux基础实验(二)
一)基础实验: 1. 新建文件a.txt,并用权限模式.权限值两种方式修改权限为rwxrwx--x 新建文件:touch a.txt 权限模式:chmod ug=rwx o=x a.tx ...
- samba服务器的安装与配置(之前是因为没有把共享文件权限放开!)(windows7和centOS6)
注:centOS6跟centOS7安装方法不一样哦.以下是centOS6的安装过程. 安装:yum -y install samba 启动:/etc/init.d/smb start 设置开机启动:c ...
- find查找文件命令 - Linux系统中的常用技巧整理
“find”在Linux系统中是比较常用的文件查找命令,使用方法有很多,可以拥有查找文件.文件目录.文件更新时间.文件大小.文件权限及对比文件时间.下面是整理的“find”常用方法,方便以后需要的时候 ...
- CODEVS-1018单词接龙
单词接龙 原题:传送门 解题思路: 此题是典型的深搜题目,首先确定递归变量,表示字母的数量,每当满足一定条件,就往下一层递归,否则回溯 判断由哪个单词开始(因为可能字母首位可能相同),再确定之后所连单 ...
- SpringMVC 的 切面
官网路径:https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#beans 一:术语介绍 通知 ...