├── .angular-cli.json ├── .editorconfig ├── .gitignore ├── .npmignore ├── .travis.yml ├── LICENSE ├── README.md ├── e2e ├── app.e2e-spec.ts ├── app.po.ts └── tsconfig.e2e.json ├── gulpfile.js ├── karma.conf.js ├── lib ├── checkbox │ └── style │ │ ├── index.less │ │ └── mixin.less ├── components │ ├── nz-tree.component.ts │ ├── nz-tree.options.ts │ └── style │ │ ├── index.less │ │ ├── mixin.less │ │ └── patch.less ├── index.ts ├── package.json ├── spec │ └── directive.spec.ts ├── style │ ├── color │ │ ├── bezierEasing.less │ │ ├── colorPalette.less │ │ ├── colors.less │ │ └── tinyColor.less │ ├── core │ │ ├── base.less │ │ ├── iconfont.less │ │ ├── index.less │ │ ├── motion.less │ │ ├── motion │ │ │ ├── fade.less │ │ │ ├── move.less │ │ │ ├── other.less │ │ │ ├── slide.less │ │ │ ├── swing.less │ │ │ └── zoom.less │ │ └── normalize.less │ ├── index.less │ ├── index.tsx │ ├── mixins │ │ ├── clearfix.less │ │ ├── compatibility.less │ │ ├── iconfont.less │ │ ├── index.less │ │ ├── motion.less │ │ ├── opacity.less │ │ └── size.less │ └── themes │ │ └── default.less ├── tsconfig.json └── tsconfig.spec.json ├── package.json ├── protractor.conf.js ├── rollup.config.js ├── scripts ├── inline-resources.js └── typings.d.ts ├── src ├── app │ ├── app.component.ts │ ├── app.module.ts │ └── demo │ │ ├── async.component.ts │ │ ├── basic.component.ts │ │ ├── custom.component.ts │ │ ├── draggable.component.ts │ │ ├── generate-data.ts │ │ ├── home.component.ts │ │ ├── line.component.ts │ │ ├── linkage.component.ts │ │ └── searchable.component.ts ├── assets │ ├── .gitkeep │ └── fork.png ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.css ├── test.ts ├── tsconfig.app.json ├── tsconfig.spec.json └── typings.d.ts ├── tsconfig.json ├── tsconfig.publish.json └── tslint.json /.angular-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "project": { 4 | "name": "ng-tree-antd" 5 | }, 6 | "apps": [ 7 | { 8 | "root": "src", 9 | "outDir": "dist", 10 | "assets": [ 11 | "assets", 12 | "favicon.ico" 13 | ], 14 | "index": "index.html", 15 | "main": "main.ts", 16 | "polyfills": "polyfills.ts", 17 | "test": "test.ts", 18 | "tsconfig": "tsconfig.app.json", 19 | "testTsconfig": "tsconfig.spec.json", 20 | "prefix": "app", 21 | "styles": [ 22 | "styles.css" 23 | ], 24 | "scripts": [], 25 | "environmentSource": "environments/environment.ts", 26 | "environments": { 27 | "dev": "environments/environment.ts", 28 | "prod": "environments/environment.prod.ts" 29 | } 30 | } 31 | ], 32 | "e2e": { 33 | "protractor": { 34 | "config": "./protractor.conf.js" 35 | } 36 | }, 37 | "lint": [ 38 | { 39 | "project": "src/tsconfig.app.json", 40 | "exclude": "**/node_modules/**" 41 | }, 42 | { 43 | "project": "src/tsconfig.spec.json", 44 | "exclude": "**/node_modules/**" 45 | }, 46 | { 47 | "project": "e2e/tsconfig.e2e.json", 48 | "exclude": "**/node_modules/**" 49 | } 50 | ], 51 | "test": { 52 | "karma": { 53 | "config": "./karma.conf.js" 54 | } 55 | }, 56 | "defaults": { 57 | "styleExt": "css", 58 | "component": {} 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 4 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependency directory 2 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 3 | /node_modules 4 | npm-debug.log 5 | .lib 6 | .ng_build 7 | package-lock.json 8 | 9 | # WebStorm 10 | .idea 11 | .vscode 12 | 13 | # ignore build and dist for now 14 | /demo/dist 15 | /dist 16 | /coverage 17 | 18 | # ignore inline compiling 19 | /logs 20 | 21 | # AoT generated files 22 | factories 23 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # Compiled binary addons (http://nodejs.org/api/addons.html) 20 | build/Release 21 | 22 | # Dependency directory 23 | # Commenting this out is preferred by some people, see 24 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 25 | node_modules 26 | 27 | # Users Environment Variables 28 | .lock-wscript 29 | .tsdrc 30 | 31 | #IntelliJ configuration files 32 | .idea 33 | 34 | dist 35 | dev 36 | docs 37 | lib 38 | test 39 | tmp 40 | 41 | Thumbs.db 42 | .DS_Store 43 | 44 | *.ts 45 | !*.d.ts 46 | 47 | src/app/example* 48 | src/public 49 | typings 50 | *_spec.* 51 | CONTRIBUTING.md 52 | gulpfile.ts 53 | favicon.ico 54 | karma-shim.js 55 | karma.conf.js 56 | make.js 57 | protractor.conf.js 58 | test-main.js 59 | tsconfig.json 60 | tslint.json 61 | typedoc.json 62 | typings.json 63 | webpack.config.js 64 | *.yml 65 | .jshintrc 66 | .editorconfig 67 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | language: node_js 3 | node_js: 4 | - "8.5.0" 5 | 6 | addons: 7 | chrome: stable 8 | 9 | git: 10 | depth: 1 11 | 12 | before_install: 13 | - export CHROME_BIN=chromium-browser 14 | - export DISPLAY=:99.0 15 | - sh -e /etc/init.d/xvfb start 16 | 17 | install: 18 | - npm install 19 | 20 | script: 21 | - npm run test 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-present 卡色 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 项目不会再发布兼容 ng-zorro-antd `0.7.0` 版本,已经内置 `nz-tree` 组件;`0.6.x` 之前的依然可用。 2 | 3 | # ng-tree-antd 4 | 5 | A antd style of based on angular-tree-component. 6 | 7 | [](https://www.npmjs.com/package/ng-tree-antd) 8 | [](https://travis-ci.org/cipchk/ng-tree-antd) 9 | 10 | ## Demo 11 | 12 | [Live Demo](https://cipchk.github.io/ng-tree-antd/) & [stackblitz](https://stackblitz.com/edit/ng-tree-antd?file=app%2Fapp.component.ts) 13 | 14 | ## Dependencies 15 | 16 | + `angular-tree-component` **^7.0.1** 17 | 18 | ## Usage & Installation 19 | 20 | Install `ng-tree-antd` from `npm` 21 | 22 | ``` 23 | npm install ng-tree-antd --save 24 | ``` 25 | 26 | Import the `NzTreeModule` in to your root `AppModule`. 27 | 28 | ``` 29 | import { NzTreeModule } from 'ng-tree-antd'; 30 | import { NgZorroAntdModule } from 'ng-zorro-antd'; 31 | 32 | @NgModule({ 33 | imports: [BrowserModule, NzTreeModule, NgZorroAntdModule.forRoot()], 34 | declarations: [AppComponent], 35 | bootstrap: [AppComponent] 36 | }) 37 | export class AppModule { } 38 | ``` 39 | 40 | ### Usage 41 | 42 | ```typescript 43 | import { Component } from '@angular/core'; 44 | import { generateData } from './generate-data'; 45 | 46 | @Component({ 47 | selector: 'demo', 48 | template: ` 49 | 52 | ` 53 | }) 54 | export class DemoDraggableComponent { 55 | nodes = [ 56 | { 57 | name: 'root1' 58 | }, 59 | { 60 | name: 'root2' 61 | }, 62 | { 63 | name: 'root3' 64 | }, 65 | { 66 | name: 'async root4', 67 | hasChildren: true 68 | } 69 | ]; 70 | 71 | options = { 72 | allowDrag: true 73 | }; 74 | 75 | onEvent(ev: any) { 76 | console.log('onEvent', ev); 77 | } 78 | } 79 | ``` 80 | 81 | ## `nzNodes` DATA 82 | 83 | the `nzNodes` is array of the tree, and each node may contain the following fileds: 84 | 85 | + `id` unique id 86 | + `name` default displayed filed, you can setting `displayField` of `options` property 87 | + `checked` specifies whether the checkbox is selected 88 | + `disableCheckbox` disable checkbox 89 | + `halfChecked` achieve a 'check all' effect 90 | + `children` an array of the node's children. 91 | + `hasChildren` for async data load, so you need setting `getChildren` of `options` property 92 | 93 | ## API 94 | 95 | | Name | Type | Default | Summary | 96 | | ------- | ------------- | ----- | ----- | 97 | | nzNodes | `any[]` | | see [inputs](https://angular2-tree.readme.io/docs/inputs) | 98 | | nzAutoExpandParent | `boolean, number` | `false` | 是否自动展开父节点,当数字时展开最大节点 | 99 | | nzAllowChildLinkage | `boolean` | `true` | 是否开启父节点的checkbox状态的会影响子节点状态 | 100 | | nzAllowParentLinkage | `boolean` | `true` | 是否开启子节点的checkbox状态的会影响父节点状态 | 101 | | nzCheckable | `boolean` | `false` | Add a `checkbox` before the node | 102 | | nzShowLine | `boolean` | `false` | Shows a connecting line | 103 | | nzOptions | `TreeOptions` | | see [options](https://angular2-tree.readme.io/docs/options) | 104 | | nzTitle | `TemplateRef` | | Custom title | 105 | | nzLoading | `TemplateRef` | | Custom Loading | 106 | | nzShiftSelectedMulti | `boolean` | `true` | selected multi when shift key | 107 | | nzToggleExpanded | `EventEmitter` | | see [events](https://angular2-tree.readme.io/docs/events) | 108 | | nzActivate | `EventEmitter` | | | 109 | | nzDeactivate | `EventEmitter` | | | 110 | | nzFocus | `EventEmitter` | | | 111 | | nzBlur | `EventEmitter` | | | 112 | | nzUpdateData | `EventEmitter` | | | 113 | | nzInitialized | `EventEmitter` | | | 114 | | nzMoveNode | `EventEmitter` | | | 115 | | nzCopyNode | `EventEmitter` | | | 116 | | nzLoadNodeChildren | `EventEmitter` | | | 117 | | nzChangeFilter | `EventEmitter` | | | 118 | | nzEvent | `EventEmitter` | | | 119 | | nzStateChange | `EventEmitter` | | | 120 | | nzCheck | `EventEmitter` | | fired `checkbox` is changed | 121 | 122 | ## Troubleshooting 123 | 124 | Please follow this guidelines when reporting bugs and feature requests: 125 | 126 | 1. Use [GitHub Issues](https://github.com/cipchk/ng-tree-antd/issues) board to report bugs and feature requests (not our email address) 127 | 2. Please **always** write steps to reproduce the error. That way we can focus on fixing the bug, not scratching our heads trying to reproduce it. 128 | 129 | Thanks for understanding! 130 | 131 | ### License 132 | 133 | The MIT License (see the [LICENSE](https://github.com/cipchk/ng-tree-antd/blob/master/LICENSE) file for the full text) 134 | -------------------------------------------------------------------------------- /e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('ng-tree-antd App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to app!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | const gulp = require('gulp'); 2 | const rollup = require('gulp-rollup'); 3 | const rename = require('gulp-rename'); 4 | const replace = require('gulp-replace'); 5 | const less = require('gulp-less'); 6 | const bump = require('gulp-bump'); 7 | const inline_recources = require('./scripts/inline-resources'); 8 | // @ts-ignore 9 | const VERSION = require('./package.json').version; 10 | 11 | const paths = { 12 | build: './.ng_build', 13 | lib: './.lib' 14 | }; 15 | 16 | gulp.task('copy-sources', copySources); 17 | gulp.task('inline-resources', copyResources); 18 | // @ts-ignore 19 | gulp.task('bundle', bundleUmd); 20 | gulp.task('bump', bumpVersions); 21 | 22 | function bumpVersions() { 23 | gulp.src([ './package.json'], {base: './'}) 24 | .pipe(bump({ 25 | version: VERSION 26 | })) 27 | .pipe(gulp.dest('./')); 28 | } 29 | function copySources() { 30 | gulp.src('./lib/**/*') 31 | .pipe(gulp.dest(paths.build)) 32 | .on('end', replaceLessWithCSS) 33 | ; 34 | } 35 | 36 | function replaceLessWithCSS() { 37 | gulp.src(`${paths.build}/**/*.ts`) 38 | .pipe(replace('.less', '.css')) 39 | .pipe(gulp.dest(paths.build)) 40 | .on('end', compileLess); 41 | } 42 | 43 | function compileLess() { 44 | gulp.src([ 45 | `${paths.build}/**/*.less` 46 | ]) 47 | .pipe(less()) 48 | .pipe(gulp.dest(paths.build)); 49 | } 50 | 51 | function copyResources() { 52 | gulp.src([ 53 | `./LICENSE`, 54 | `./README.md`, 55 | `./rollup.config.js`, 56 | `./package.json`, 57 | `${paths.build}/**/*.html`, 58 | `${paths.build}/**/*.css`, 59 | `${paths.build}/**/*.less` 60 | ]) 61 | .pipe(gulp.dest(paths.lib)) 62 | .on('end', () => inline_recources(paths.lib)); 63 | } 64 | 65 | function bundleUmd() { 66 | bundle(`${paths.lib}/`); 67 | } 68 | 69 | function bundle(path) { 70 | const config = require(path + 'rollup.config.js'); 71 | gulp.src(path + `**/*.js`) 72 | .pipe(rollup(Object.assign({}, config, { 73 | name: config.name, 74 | input: `${path}index.js` 75 | }))) 76 | .pipe(rename(config.output)) 77 | .pipe(gulp.dest(`${path}bundles`)); 78 | } 79 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /lib/checkbox/style/index.less: -------------------------------------------------------------------------------- 1 | @import "../../style/themes/default"; 2 | @import "./mixin"; 3 | 4 | .antCheckboxFn(); 5 | -------------------------------------------------------------------------------- /lib/checkbox/style/mixin.less: -------------------------------------------------------------------------------- 1 | @import "../../style/mixins/index"; 2 | 3 | .antCheckboxFn(@checkbox-prefix-cls: ~"@{ant-prefix}-checkbox") { 4 | @checkbox-inner-prefix-cls: ~"@{checkbox-prefix-cls}-inner"; 5 | // 一般状态 6 | .@{checkbox-prefix-cls} { 7 | white-space: nowrap; 8 | cursor: pointer; 9 | outline: none; 10 | display: inline-block; 11 | line-height: 1; 12 | position: relative; 13 | vertical-align: text-bottom; 14 | 15 | .@{checkbox-prefix-cls}-wrapper:hover &-inner, 16 | &:hover &-inner, 17 | &-input:focus + &-inner { 18 | border-color: @primary-color; 19 | } 20 | 21 | &-checked:after { 22 | position: absolute; 23 | top: 0; 24 | left: 0; 25 | width: 100%; 26 | height: 100%; 27 | border-radius: @border-radius-sm; 28 | border: 1px solid @primary-color; 29 | content: ''; 30 | animation: antCheckboxEffect 0.36s ease-in-out; 31 | animation-fill-mode: both; 32 | visibility: hidden; 33 | } 34 | 35 | &:hover:after, 36 | .@{checkbox-prefix-cls}-wrapper:hover &:after { 37 | visibility: visible; 38 | } 39 | 40 | &-inner { 41 | position: relative; 42 | top: 0; 43 | left: 0; 44 | display: block; 45 | width: @checkbox-size; 46 | height: @checkbox-size; 47 | border: @border-width-base @border-style-base @border-color-base; 48 | border-radius: @border-radius-sm; 49 | background-color: #fff; 50 | transition: all .3s; 51 | 52 | &:after { 53 | @check-width: (@checkbox-size / 14) * 5px; 54 | @check-height: (@checkbox-size / 14) * 8px; 55 | transform: rotate(45deg) scale(0); 56 | position: absolute; 57 | left: (@checkbox-size - @check-width) / 2 - 0.5px * (@checkbox-size / 14); 58 | top: (@checkbox-size - @check-height) / 2 - 2px * (@checkbox-size / 14); 59 | display: table; 60 | width: @check-width; 61 | height: @check-height; 62 | border: 2px solid #fff; 63 | border-top: 0; 64 | border-left: 0; 65 | content: ' '; 66 | transition: all .1s @ease-in-back; 67 | } 68 | } 69 | 70 | &-input { 71 | position: absolute; 72 | left: 0; 73 | z-index: 1; 74 | cursor: pointer; 75 | .opacity(0); 76 | top: 0; 77 | bottom: 0; 78 | right: 0; 79 | width: 100%; 80 | height: 100%; 81 | } 82 | } 83 | 84 | // 半选状态 85 | .@{checkbox-prefix-cls}-indeterminate .@{checkbox-inner-prefix-cls}:after { 86 | @indeterminate-width: (@checkbox-size / 14) * 8px; 87 | @indeterminate-height: (@checkbox-size / 14) * 1px; 88 | content: ' '; 89 | transform: scale(1); 90 | position: absolute; 91 | left: (@checkbox-size - 2 - @indeterminate-width) / 2; 92 | top: (@checkbox-size - 3 - @indeterminate-height) / 2; 93 | width: @indeterminate-width; 94 | height: @indeterminate-height; 95 | } 96 | 97 | .@{checkbox-prefix-cls}-indeterminate.@{checkbox-prefix-cls}-disabled .@{checkbox-inner-prefix-cls}:after { 98 | border-color: @disabled-color; 99 | } 100 | 101 | // 选中状态 102 | .@{checkbox-prefix-cls}-checked .@{checkbox-inner-prefix-cls}:after { 103 | transform: rotate(45deg) scale(1); 104 | position: absolute; 105 | display: table; 106 | border: 2px solid #fff; 107 | border-top: 0; 108 | border-left: 0; 109 | content: ' '; 110 | transition: all .2s @ease-out-back .1s; 111 | } 112 | 113 | .@{checkbox-prefix-cls}-checked, 114 | .@{checkbox-prefix-cls}-indeterminate { 115 | .@{checkbox-inner-prefix-cls} { 116 | background-color: @primary-color; 117 | border-color: @primary-color; 118 | } 119 | } 120 | 121 | .@{checkbox-prefix-cls}-disabled { 122 | cursor: not-allowed; 123 | 124 | &.@{checkbox-prefix-cls}-checked { 125 | .@{checkbox-inner-prefix-cls}:after { 126 | animation-name: none; 127 | border-color: @disabled-color; 128 | } 129 | } 130 | 131 | .@{checkbox-prefix-cls}-input { 132 | cursor: not-allowed; 133 | } 134 | 135 | .@{checkbox-inner-prefix-cls} { 136 | border-color: @border-color-base !important; 137 | background-color: @input-disabled-bg; 138 | &:after { 139 | animation-name: none; 140 | border-color: @input-disabled-bg; 141 | } 142 | } 143 | 144 | & + span { 145 | color: @disabled-color; 146 | cursor: not-allowed; 147 | } 148 | } 149 | 150 | .@{checkbox-prefix-cls}-wrapper { 151 | cursor: pointer; 152 | font-size: @font-size-base; 153 | display: inline-block; 154 | & + & { 155 | margin-left: 8px; 156 | } 157 | } 158 | 159 | .@{checkbox-prefix-cls}-wrapper + span, 160 | .@{checkbox-prefix-cls} + span { 161 | padding-left: 8px; 162 | padding-right: 8px; 163 | } 164 | 165 | .@{checkbox-prefix-cls}-group { 166 | font-size: @font-size-base; 167 | &-item { 168 | display: inline-block; 169 | margin-right: 8px; 170 | &:last-child { 171 | margin-right: 0; 172 | } 173 | } 174 | &-item + &-item { 175 | margin-left: 0; 176 | } 177 | } 178 | 179 | // @ie8: \0screen; 180 | 181 | // // IE8 hack for https://github.com/ant-design/ant-design/issues/2148 182 | // @media @ie8 { 183 | // .@{checkbox-prefix-cls}-checked .@{checkbox-prefix-cls}-inner:before, 184 | // .@{checkbox-prefix-cls}-checked .@{checkbox-prefix-cls}-inner:after { 185 | // .iconfont-font("\e632"); 186 | // font-weight: bold; 187 | // font-size: 8px; 188 | // border: 0; 189 | // color: #fff; 190 | // left: 2px; 191 | // top: 3px; 192 | // position: absolute; 193 | // } 194 | // } 195 | } 196 | 197 | @keyframes antCheckboxEffect { 198 | 0% { 199 | transform: scale(1); 200 | opacity: 0.5; 201 | } 202 | 100% { 203 | transform: scale(1.6); 204 | opacity: 0; 205 | } 206 | } 207 | -------------------------------------------------------------------------------- /lib/components/nz-tree.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnChanges, SimpleChanges, Input, Output, EventEmitter, ViewChild, ViewEncapsulation, ContentChild, TemplateRef, OnInit, SimpleChange } from '@angular/core'; 2 | import { TreeComponent, TreeModel, TreeNode, TREE_ACTIONS, IActionMapping } from 'angular-tree-component'; 3 | import { NzTreeOptions } from './nz-tree.options'; 4 | 5 | @Component({ 6 | selector: 'nz-tree', 7 | template: ` 8 | 21 | 22 | 29 | 30 | 36 | 39 | 40 | 46 | 47 | 48 | 62 | 63 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | `, 75 | encapsulation: ViewEncapsulation.None, 76 | styleUrls: [ 77 | './style/index.less', 78 | './style/patch.less' 79 | ] 80 | }) 81 | export class NzTreeComponent implements OnInit, OnChanges { 82 | _options: NzTreeOptions; 83 | 84 | @Input() nzNodes: any[]; 85 | @Input() nzCheckable = false; 86 | @Input() nzAutoExpandParent: boolean | number = false; 87 | @Input() nzAllowChildLinkage = true; 88 | @Input() nzAllowParentLinkage = true; 89 | @Input() nzShowLine = false; 90 | @Input() nzOptions: any; 91 | @Input() nzShiftSelectedMulti = true; 92 | @ContentChild('nzTitle') nzTitle: TemplateRef; 93 | @ContentChild('nzLoading') nzLoading: TemplateRef; 94 | 95 | @Output() nzToggleExpanded = new EventEmitter(); 96 | @Output() nzActivate = new EventEmitter(); 97 | @Output() nzDeactivate = new EventEmitter(); 98 | @Output() nzFocus = new EventEmitter(); 99 | @Output() nzBlur = new EventEmitter(); 100 | @Output() nzUpdateData = new EventEmitter(); 101 | @Output() nzInitialized = new EventEmitter(); 102 | @Output() nzMoveNode = new EventEmitter(); 103 | @Output() nzCopyNode = new EventEmitter(); 104 | @Output() nzLoadNodeChildren = new EventEmitter(); 105 | @Output() nzChangeFilter = new EventEmitter(); 106 | @Output() nzEvent = new EventEmitter(); 107 | @Output() nzStateChange = new EventEmitter(); 108 | @Output() nzCheck = new EventEmitter(); 109 | 110 | @ViewChild(TreeComponent) 111 | tree: TreeComponent; 112 | 113 | get treeModel(): TreeModel { 114 | return this.tree.treeModel; 115 | } 116 | 117 | toggleCheck(node: TreeNode) { 118 | if (node.data.disableCheckbox) return ; 119 | node.data.checked = !node.data.checked; 120 | node.data.halfChecked = false; 121 | this.updateCheckState(node, node.data.checked); 122 | this.fireEvent({ eventName: 'check', node: node, checked: node.data.checked }); 123 | } 124 | 125 | private traverseData( 126 | nodes: any[], 127 | callback: (node: any, level: number, parent: any, nodes: any[]) => void 128 | ): void { 129 | const traverse = (subTreeNodes: any[], level: number, parent: any) => { 130 | if (Array.isArray(subTreeNodes)) { 131 | subTreeNodes = subTreeNodes.filter(item => !!item); 132 | } 133 | subTreeNodes.forEach((item, index) => { 134 | // if (!item.children) item.children = []; 135 | if (item.children && item.children.length > 0) { 136 | traverse(item.children, ++level, item); 137 | } 138 | callback( 139 | item, 140 | level, 141 | parent, 142 | subTreeNodes 143 | ); 144 | }); 145 | }; 146 | traverse(nodes, 0, null); 147 | } 148 | 149 | private updateCheckState(node: TreeNode, checkIt: boolean) { 150 | const childLoop = (parentNode: TreeNode) => { 151 | if (!parentNode.children) return; 152 | for (const childNode of parentNode.children) { 153 | if (!childNode.data.disableCheckbox) { 154 | childNode.data.halfChecked = false; 155 | childNode.data.checked = checkIt; 156 | } 157 | childLoop(childNode); 158 | } 159 | }; 160 | 161 | if (this.nzAllowChildLinkage) { 162 | childLoop(node); 163 | } 164 | 165 | const parentLoop = (childNode: TreeNode) => { 166 | if (!childNode.parent) return; 167 | const parentNode = childNode.parent; 168 | let childrenCount = parentNode.children.length; 169 | let checkedChildrenCount = 0; 170 | for (const item of parentNode.children) { 171 | if (item.data.disableCheckbox) { 172 | childrenCount -= 1; 173 | continue; 174 | } 175 | if (item.data.checked === true) checkedChildrenCount++; 176 | else if (item.data.halfChecked === true) checkedChildrenCount += 0.5; 177 | } 178 | if (checkedChildrenCount === childrenCount) { 179 | parentNode.data.checked = true; 180 | parentNode.data.halfChecked = false; 181 | } else if (checkedChildrenCount > 0) { 182 | parentNode.data.checked = false; 183 | parentNode.data.halfChecked = true; 184 | } else { 185 | parentNode.data.checked = false; 186 | parentNode.data.halfChecked = false; 187 | } 188 | parentLoop(parentNode); 189 | }; 190 | if (this.nzAllowParentLinkage) { 191 | parentLoop(node); 192 | } 193 | } 194 | 195 | fireEvent(event: any) { 196 | const eventName = event && event.eventName; 197 | if (eventName && typeof eventName === 'string') { 198 | const emitEventName = 'nz' + (eventName.charAt(0).toUpperCase() + eventName.slice(1)); 199 | const emitObj = this[emitEventName]; 200 | if (this[emitEventName]) this[emitEventName].emit(event); 201 | } 202 | this.nzEvent.emit(event); 203 | } 204 | 205 | private traverseNode(): this { 206 | // nzAutoExpandParent 207 | let maxLevel = 0; 208 | let expand = this.nzAutoExpandParent; 209 | if (typeof expand === 'number') { 210 | maxLevel = expand; 211 | expand = true; 212 | } 213 | this.traverseData(this.nzNodes, (node, level, parent, nodes) => { 214 | // expand 215 | if (expand && typeof node.isExpanded === 'undefined') { 216 | node.isExpanded = maxLevel === 0 || level <= maxLevel; 217 | console.log(node); 218 | } 219 | // checked 220 | if (!parent || node.checked) return; 221 | const validNodes = nodes.filter(w => !w.disableCheckbox); 222 | const checkCount = validNodes.filter(w => w.checked).length; 223 | if (checkCount === 0) return; 224 | 225 | if (checkCount === validNodes.length) 226 | parent.checked = true; 227 | else 228 | parent.halfChecked = true; 229 | }); 230 | return this; 231 | } 232 | 233 | ngOnInit() { 234 | console.log('this._options', this._options); 235 | } 236 | 237 | ngOnChanges(changes: { [P in keyof this]?: SimpleChange } & SimpleChanges): void { 238 | const actionMapping: IActionMapping = { }; 239 | if (this.nzShiftSelectedMulti) { 240 | actionMapping.mouse = { 241 | click: (tree, node, $event: any) => { 242 | $event.shiftKey 243 | ? TREE_ACTIONS.TOGGLE_ACTIVE_MULTI(tree, node, $event) 244 | : TREE_ACTIONS.TOGGLE_ACTIVE(tree, node, $event); 245 | } 246 | }; 247 | } 248 | this._options = Object.assign({ 249 | actionMapping, 250 | animateExpand: true 251 | }, this.nzOptions); 252 | if (changes.nzNodes) { 253 | this.traverseNode(); 254 | } 255 | } 256 | } 257 | -------------------------------------------------------------------------------- /lib/components/nz-tree.options.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { ITreeOptions } from 'angular-tree-component'; 3 | 4 | export interface NzTreeOptions extends ITreeOptions {} 5 | -------------------------------------------------------------------------------- /lib/components/style/index.less: -------------------------------------------------------------------------------- 1 | @import "../../style/themes/default"; 2 | @import "../../style/mixins/index"; 3 | @import "../../checkbox/style/mixin"; 4 | @import "./mixin"; 5 | 6 | @tree-prefix-cls: ~"@{ant-prefix}-tree"; 7 | @tree-showline-icon-color: @text-color-secondary; 8 | 9 | .antCheckboxFn(@checkbox-prefix-cls: ~"@{ant-prefix}-tree-checkbox"); 10 | 11 | .@{tree-prefix-cls} { 12 | margin: 0; 13 | padding: 0; 14 | font-size: @font-size-base; 15 | li { 16 | padding: 4px 0; 17 | margin: 0; 18 | list-style: none; 19 | white-space: nowrap; 20 | outline: 0; 21 | span[draggable], 22 | span[draggable="true"] { 23 | user-select: none; 24 | border-top: 2px transparent solid; 25 | border-bottom: 2px transparent solid; 26 | margin-top: -2px; 27 | /* Required to make elements draggable in old WebKit */ 28 | -khtml-user-drag: element; 29 | -webkit-user-drag: element; 30 | } 31 | &.drag-over { 32 | > span[draggable] { 33 | background-color: @primary-color; 34 | color: white; 35 | opacity: 0.8; 36 | } 37 | } 38 | &.drag-over-gap-top { 39 | > span[draggable] { 40 | border-top-color: @primary-color; 41 | } 42 | } 43 | &.drag-over-gap-bottom { 44 | > span[draggable] { 45 | border-bottom-color: @primary-color; 46 | } 47 | } 48 | &.filter-node { 49 | > span { 50 | color: @highlight-color !important; 51 | font-weight: 500 !important; 52 | } 53 | } 54 | ul { 55 | margin: 0; 56 | padding: 0 0 0 18px; 57 | } 58 | .@{tree-prefix-cls}-node-content-wrapper { 59 | display: inline-block; 60 | padding: 3px 5px; 61 | border-radius: @border-radius-sm; 62 | margin: 0; 63 | cursor: pointer; 64 | text-decoration: none; 65 | vertical-align: top; 66 | color: @text-color; 67 | transition: all .3s; 68 | position: relative; 69 | &:hover { 70 | background-color: @item-hover-bg; 71 | } 72 | &.@{tree-prefix-cls}-node-selected { 73 | background-color: @primary-2; 74 | } 75 | } 76 | span { 77 | &.@{tree-prefix-cls}-checkbox { 78 | margin: 0 4px 0 2px; 79 | vertical-align: middle; 80 | } 81 | &.@{tree-prefix-cls}-switcher, 82 | &.@{tree-prefix-cls}-iconEle { 83 | margin: 0; 84 | width: 24px; 85 | height: 24px; 86 | line-height: 24px; 87 | display: inline-block; 88 | vertical-align: middle; 89 | border: 0 none; 90 | cursor: pointer; 91 | outline: none; 92 | text-align: center; 93 | } 94 | &.@{tree-prefix-cls}-icon_loading { 95 | position: absolute; 96 | left: 0; 97 | top: 1px; 98 | background: #fff; 99 | transform: translateX(-100%); 100 | transition: all .3s; 101 | &:after { 102 | display: inline-block; 103 | .iconfont-font("\e6ae"); 104 | animation: loadingCircle 1s infinite linear; 105 | color: @primary-color; 106 | } 107 | } 108 | &.@{tree-prefix-cls}-switcher { 109 | &.@{tree-prefix-cls}-switcher-noop { 110 | cursor: default; 111 | } 112 | &.@{tree-prefix-cls}-switcher_open { 113 | .antTreeSwitcherIcon(); 114 | } 115 | &.@{tree-prefix-cls}-switcher_close { 116 | .antTreeSwitcherIcon(); 117 | .ie-rotate(3); 118 | &:after { 119 | transform: rotate(270deg) scale(0.59); 120 | } 121 | } 122 | } 123 | } 124 | &:last-child > span { 125 | &.@{tree-prefix-cls}-switcher, 126 | &.@{tree-prefix-cls}-iconEle { 127 | &:before { 128 | display: none; 129 | } 130 | } 131 | } 132 | } 133 | > li { 134 | &:first-child { 135 | padding-top: 7px; 136 | } 137 | &:last-child { 138 | padding-bottom: 7px; 139 | } 140 | } 141 | &-child-tree { 142 | display: none; 143 | &-open { 144 | display: block; 145 | } 146 | } 147 | li&-treenode-disabled { 148 | > span, 149 | > .@{tree-prefix-cls}-node-content-wrapper, 150 | > .@{tree-prefix-cls}-node-content-wrapper span, 151 | > span.@{tree-prefix-cls}-switcher { 152 | color: @disabled-color; 153 | cursor: not-allowed; 154 | } 155 | > .@{tree-prefix-cls}-node-content-wrapper:hover { 156 | background: transparent; 157 | } 158 | } 159 | &-icon__open { 160 | margin-right: 2px; 161 | vertical-align: top; 162 | } 163 | &-icon__close { 164 | margin-right: 2px; 165 | vertical-align: top; 166 | } 167 | // Tree with line 168 | &&-show-line { 169 | li { 170 | position: relative; 171 | span { 172 | &.@{tree-prefix-cls}-switcher { 173 | background: @component-background; 174 | color: @text-color; 175 | &.@{tree-prefix-cls}-switcher-noop { 176 | .antTreeShowLineIcon("tree-doc-icon"); 177 | } 178 | &.@{tree-prefix-cls}-switcher_open { 179 | color: @tree-showline-icon-color; 180 | .antTreeShowLineIcon("tree-showline-open-icon"); 181 | } 182 | &.@{tree-prefix-cls}-switcher_close { 183 | color: @tree-showline-icon-color; 184 | .antTreeShowLineIcon("tree-showline-close-icon"); 185 | } 186 | } 187 | } 188 | } 189 | li:not(:last-child):before { 190 | content: ' '; 191 | width: 1px; 192 | border-left: 1px solid @border-color-base; 193 | height: 100%; 194 | position: absolute; 195 | left: 12px; 196 | margin: 18px 0; 197 | } 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /lib/components/style/mixin.less: -------------------------------------------------------------------------------- 1 | @import "../../style/mixins/index"; 2 | 3 | @tree-default-open-icon: "\e606"; 4 | @tree-showline-open-icon: "\e621"; 5 | @tree-showline-close-icon: "\e645"; 6 | @tree-doc-icon: "\e664"; 7 | 8 | .antTreeSwitcherIcon(@type: "tree-default-open-icon") { 9 | &:after { 10 | .iconfont-size-under-12px(7px); 11 | display: inline-block; 12 | .iconfont-font(@@type); 13 | font-weight: bold; 14 | transition: transform .3s; 15 | } 16 | } 17 | 18 | .antTreeShowLineIcon(@type) { 19 | &:after { 20 | .iconfont-size-under-12px(12px); 21 | display: inline-block; 22 | .iconfont-font(@@type); 23 | vertical-align: baseline; 24 | font-weight: normal; 25 | transition: transform .3s; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/components/style/patch.less: -------------------------------------------------------------------------------- 1 | @import "../../style/themes/default"; 2 | @import "../../style/mixins/index"; 3 | @import "../../checkbox/style/mixin"; 4 | @import "./mixin"; 5 | @tree-prefix-cls: ~"@{ant-prefix}-tree"; 6 | @tree-showline-icon-color: @text-color-secondary; 7 | .antCheckboxFn(@checkbox-prefix-cls: ~"@{ant-prefix}-tree-checkbox"); 8 | .@{tree-prefix-cls} { 9 | margin: 0; 10 | padding: 0; 11 | font-size: @font-size-base; 12 | span[draggable="true"] { 13 | user-select: none; 14 | border-top: 2px transparent solid; 15 | border-bottom: 2px transparent solid; 16 | margin-top: -2px; 17 | /* Required to make elements draggable in old WebKit */ 18 | -khtml-user-drag: element; 19 | -webkit-user-drag: element; 20 | } 21 | .node-drop-slot { 22 | display: block; 23 | height: 2px; 24 | &.is-dragging-over { 25 | background-color: @primary-color; 26 | } 27 | } 28 | &-node { 29 | padding: 4px 0; 30 | margin: 0; 31 | list-style: none; 32 | white-space: nowrap; 33 | outline: 0; 34 | position: relative; 35 | .tree-children { 36 | margin: 0; 37 | padding: 0 0 0 18px; 38 | overflow: hidden; 39 | } 40 | .tree-node-loading { 41 | position: absolute; 42 | left: 1px; 43 | top: 5px; 44 | background: #fff; 45 | transition: all .3s; 46 | width: 24px; 47 | height: 24px; 48 | line-height: 24px; 49 | display: inline-block; 50 | vertical-align: middle; 51 | text-align: center; 52 | &:after { 53 | display: inline-block; 54 | .iconfont-font("\e6ae"); 55 | animation: loadingCircle 1s infinite linear; 56 | color: @primary-color; 57 | } 58 | } 59 | } 60 | .@{tree-prefix-cls}-node-content-wrapper { 61 | display: inline-block; 62 | padding: 3px 5px; 63 | border-radius: @border-radius-sm; 64 | margin: 0; 65 | cursor: pointer; 66 | text-decoration: none; 67 | vertical-align: top; 68 | color: @text-color; 69 | transition: all .3s; 70 | position: relative; 71 | user-select: none; 72 | &:hover { 73 | background-color: @item-hover-bg; 74 | } 75 | &.@{tree-prefix-cls}-node-selected { 76 | background-color: @primary-2; 77 | } 78 | &.is-dragging-over { 79 | background-color: @primary-color; 80 | color: white; 81 | opacity: 0.8; 82 | } 83 | } 84 | span { 85 | &.@{tree-prefix-cls}-checkbox { 86 | margin: 0 4px 0 2px; 87 | vertical-align: middle; 88 | } 89 | &.@{tree-prefix-cls}-switcher, 90 | &.@{tree-prefix-cls}-iconEle { 91 | margin: 0; 92 | width: 24px; 93 | height: 24px; 94 | line-height: 24px; 95 | display: inline-block; 96 | vertical-align: middle; 97 | border: 0 none; 98 | cursor: pointer; 99 | outline: none; 100 | text-align: center; 101 | } 102 | &.@{tree-prefix-cls}-icon_loading { 103 | position: absolute; 104 | left: 0; 105 | top: 1px; 106 | background: #fff; 107 | transform: translateX(-100%); 108 | transition: all .3s; 109 | &:after { 110 | display: inline-block; 111 | .iconfont-font("\e6ae"); 112 | animation: loadingCircle 1s infinite linear; 113 | color: @primary-color; 114 | } 115 | } 116 | &.@{tree-prefix-cls}-switcher { 117 | &.@{tree-prefix-cls}-switcher-noop { 118 | cursor: default; 119 | } 120 | &.@{tree-prefix-cls}-switcher_open { 121 | .antTreeSwitcherIcon(); 122 | } 123 | &.@{tree-prefix-cls}-switcher_close { 124 | .antTreeSwitcherIcon(); 125 | .ie-rotate(3); 126 | &:after { 127 | transform: rotate(270deg) scale(0.59); 128 | } 129 | } 130 | } 131 | } 132 | &:last-child>span { 133 | &.@{tree-prefix-cls}-switcher, 134 | &.@{tree-prefix-cls}-iconEle { 135 | &:before { 136 | display: none; 137 | } 138 | } 139 | } // Tree with line 140 | &&-show-line { 141 | .ant-tree-node { 142 | position: relative; 143 | user-select: none; 144 | span { 145 | &.@{tree-prefix-cls}-switcher { 146 | background: @component-background; 147 | color: @text-color; 148 | &.@{tree-prefix-cls}-switcher-noop { 149 | .antTreeShowLineIcon("tree-doc-icon"); 150 | } 151 | &.@{tree-prefix-cls}-switcher_open { 152 | color: @tree-showline-icon-color; 153 | .antTreeShowLineIcon("tree-showline-open-icon"); 154 | } 155 | &.@{tree-prefix-cls}-switcher_close { 156 | color: @tree-showline-icon-color; 157 | .antTreeShowLineIcon("tree-showline-close-icon"); 158 | } 159 | } 160 | } 161 | } 162 | tree-node:not(:last-child) .ant-tree-node:before { 163 | content: ' '; 164 | width: 1px; 165 | border-left: 1px solid @border-color-base; 166 | height: 100%; 167 | position: absolute; 168 | left: 11px; 169 | margin: 24px 0; 170 | } 171 | } 172 | } 173 | -------------------------------------------------------------------------------- /lib/index.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { NgModule, ModuleWithProviders } from '@angular/core'; 3 | import { TreeModule } from 'angular-tree-component'; 4 | 5 | import { NzTreeComponent } from './components/nz-tree.component'; 6 | 7 | export { NzTreeOptions } from './components/nz-tree.options'; 8 | export { NzTreeComponent } from './components/nz-tree.component'; 9 | 10 | @NgModule({ 11 | imports: [CommonModule, TreeModule], 12 | declarations: [NzTreeComponent], 13 | exports: [NzTreeComponent] 14 | }) 15 | export class NzTreeModule { } 16 | -------------------------------------------------------------------------------- /lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ng-tree-antd", 3 | "peerDependencies": { 4 | "ng-zorro-antd": "^5.0.0", 5 | "angular-tree-component": "^5.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /lib/spec/directive.spec.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { NzTreeModule } from '../index'; 5 | 6 | const html = ``; 7 | 8 | describe('Component: ng-tree-antd', () => { 9 | let fixture: ComponentFixture; 10 | let context: TestNGComponent; 11 | let element: any; 12 | let clean: any; 13 | 14 | beforeEach(() => { 15 | TestBed.configureTestingModule({ 16 | declarations: [TestNGComponent], 17 | imports: [NzTreeModule] 18 | }); 19 | TestBed.overrideComponent(TestNGComponent, {set: {template: html}}); 20 | fixture = TestBed.createComponent(TestNGComponent); 21 | context = fixture.componentInstance; 22 | element = fixture.nativeElement.querySelector('#c1'); 23 | clean = fixture.nativeElement.querySelector('#c2'); 24 | fixture.detectChanges(); 25 | }); 26 | 27 | it('fixture should not be null', () => { 28 | expect(fixture).not.toBeNull(); 29 | }); 30 | }); 31 | 32 | @Component({ 33 | selector: 'ng-tree-antd-test', 34 | template: '' 35 | }) 36 | class TestNGComponent { 37 | } 38 | -------------------------------------------------------------------------------- /lib/style/color/bezierEasing.less: -------------------------------------------------------------------------------- 1 | /* stylelint-disable declaration-bang-space-before */ 2 | .bezierEasingMixin() { 3 | @functions: ~`(function() { 4 | var NEWTON_ITERATIONS = 4; 5 | var NEWTON_MIN_SLOPE = 0.001; 6 | var SUBDIVISION_PRECISION = 0.0000001; 7 | var SUBDIVISION_MAX_ITERATIONS = 10; 8 | 9 | var kSplineTableSize = 11; 10 | var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0); 11 | 12 | var float32ArraySupported = typeof Float32Array === 'function'; 13 | 14 | function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; } 15 | function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; } 16 | function C (aA1) { return 3.0 * aA1; } 17 | 18 | // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2. 19 | function calcBezier (aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; } 20 | 21 | // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2. 22 | function getSlope (aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); } 23 | 24 | function binarySubdivide (aX, aA, aB, mX1, mX2) { 25 | var currentX, currentT, i = 0; 26 | do { 27 | currentT = aA + (aB - aA) / 2.0; 28 | currentX = calcBezier(currentT, mX1, mX2) - aX; 29 | if (currentX > 0.0) { 30 | aB = currentT; 31 | } else { 32 | aA = currentT; 33 | } 34 | } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); 35 | return currentT; 36 | } 37 | 38 | function newtonRaphsonIterate (aX, aGuessT, mX1, mX2) { 39 | for (var i = 0; i < NEWTON_ITERATIONS; ++i) { 40 | var currentSlope = getSlope(aGuessT, mX1, mX2); 41 | if (currentSlope === 0.0) { 42 | return aGuessT; 43 | } 44 | var currentX = calcBezier(aGuessT, mX1, mX2) - aX; 45 | aGuessT -= currentX / currentSlope; 46 | } 47 | return aGuessT; 48 | } 49 | 50 | var BezierEasing = function (mX1, mY1, mX2, mY2) { 51 | if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) { 52 | throw new Error('bezier x values must be in [0, 1] range'); 53 | } 54 | 55 | // Precompute samples table 56 | var sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); 57 | if (mX1 !== mY1 || mX2 !== mY2) { 58 | for (var i = 0; i < kSplineTableSize; ++i) { 59 | sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2); 60 | } 61 | } 62 | 63 | function getTForX (aX) { 64 | var intervalStart = 0.0; 65 | var currentSample = 1; 66 | var lastSample = kSplineTableSize - 1; 67 | 68 | for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) { 69 | intervalStart += kSampleStepSize; 70 | } 71 | --currentSample; 72 | 73 | // Interpolate to provide an initial guess for t 74 | var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]); 75 | var guessForT = intervalStart + dist * kSampleStepSize; 76 | 77 | var initialSlope = getSlope(guessForT, mX1, mX2); 78 | if (initialSlope >= NEWTON_MIN_SLOPE) { 79 | return newtonRaphsonIterate(aX, guessForT, mX1, mX2); 80 | } else if (initialSlope === 0.0) { 81 | return guessForT; 82 | } else { 83 | return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2); 84 | } 85 | } 86 | 87 | return function BezierEasing (x) { 88 | if (mX1 === mY1 && mX2 === mY2) { 89 | return x; // linear 90 | } 91 | // Because JavaScript number are imprecise, we should guarantee the extremes are right. 92 | if (x === 0) { 93 | return 0; 94 | } 95 | if (x === 1) { 96 | return 1; 97 | } 98 | return calcBezier(getTForX(x), mY1, mY2); 99 | }; 100 | }; 101 | 102 | this.colorEasing = BezierEasing(0.26, 0.09, 0.37, 0.18); 103 | })()`; 104 | } 105 | // It is hacky way to make this function will be compiled preferentially by less 106 | // resolve error: `ReferenceError: colorPalette is not defined` 107 | // https://github.com/ant-design/ant-motion/issues/44 108 | .bezierEasingMixin(); 109 | -------------------------------------------------------------------------------- /lib/style/color/colorPalette.less: -------------------------------------------------------------------------------- 1 | @import "bezierEasing"; 2 | @import "tinyColor"; 3 | 4 | // We create a very complex algorithm which take the place of original tint/shade color system 5 | // to make sure no one can understand it 👻 6 | // and create an entire color palette magicly by inputing just a single primary color. 7 | // We are using bezier-curve easing function and some color manipulations like tint/shade/darken/spin 8 | .colorPaletteMixin() { 9 | @functions: ~`(function() { 10 | var warmDark = 0.5; // warm color darken radio 11 | var warmRotate = -26; // warm color rotate degree 12 | var coldDark = 0.55; // cold color darken radio 13 | var coldRotate = 10; // cold color rotate degree 14 | var getShadeColor = function(c) { 15 | var shadeColor = tinycolor(c); 16 | // warm and cold color will darken in different radio, and rotate in different degree 17 | // warmer color 18 | if (shadeColor.toRgb().r > shadeColor.toRgb().b) { 19 | return shadeColor.darken(shadeColor.toHsl().l * warmDark * 100).spin(warmRotate).toHexString(); 20 | } 21 | // colder color 22 | return shadeColor.darken(shadeColor.toHsl().l * coldDark * 100).spin(coldRotate).toHexString(); 23 | } 24 | var primaryEasing = colorEasing(0.6); 25 | this.colorPalette = function(color, index) { 26 | var currentEasing = colorEasing(index * 0.1); 27 | // return light colors after tint 28 | if (index <= 6) { 29 | return tinycolor.mix( 30 | '#ffffff', 31 | color, 32 | currentEasing * 100 / primaryEasing 33 | ).toHexString(); 34 | } 35 | return tinycolor.mix( 36 | getShadeColor(color), 37 | color, 38 | (1 - (currentEasing - primaryEasing) / (1 - primaryEasing)) * 100 39 | ).toHexString(); 40 | }; 41 | })()`; 42 | } 43 | // It is hacky way to make this function will be compiled preferentially by less 44 | // resolve error: `ReferenceError: colorPalette is not defined` 45 | // https://github.com/ant-design/ant-motion/issues/44 46 | .colorPaletteMixin(); 47 | -------------------------------------------------------------------------------- /lib/style/color/colors.less: -------------------------------------------------------------------------------- 1 | @import 'colorPalette'; 2 | 3 | // color palettes 4 | @blue-1: color(~`colorPalette("@{blue-6}", 1)`); 5 | @blue-2: color(~`colorPalette("@{blue-6}", 2)`); 6 | @blue-3: color(~`colorPalette("@{blue-6}", 3)`); 7 | @blue-4: color(~`colorPalette("@{blue-6}", 4)`); 8 | @blue-5: color(~`colorPalette("@{blue-6}", 5)`); 9 | @blue-6: #108ee9; 10 | @blue-7: color(~`colorPalette("@{blue-6}", 7)`); 11 | @blue-8: color(~`colorPalette("@{blue-6}", 8)`); 12 | @blue-9: color(~`colorPalette("@{blue-6}", 9)`); 13 | @blue-10: color(~`colorPalette("@{blue-6}", 10)`); 14 | 15 | @purple-1: color(~`colorPalette("@{purple-6}", 1)`); 16 | @purple-2: color(~`colorPalette("@{purple-6}", 2)`); 17 | @purple-3: color(~`colorPalette("@{purple-6}", 3)`); 18 | @purple-4: color(~`colorPalette("@{purple-6}", 4)`); 19 | @purple-5: color(~`colorPalette("@{purple-6}", 5)`); 20 | @purple-6: #7265e6; 21 | @purple-7: color(~`colorPalette("@{purple-6}", 7)`); 22 | @purple-8: color(~`colorPalette("@{purple-6}", 8)`); 23 | @purple-9: color(~`colorPalette("@{purple-6}", 9)`); 24 | @purple-10: color(~`colorPalette("@{purple-6}", 10)`); 25 | 26 | @cyan-1: color(~`colorPalette("@{cyan-6}", 1)`); 27 | @cyan-2: color(~`colorPalette("@{cyan-6}", 2)`); 28 | @cyan-3: color(~`colorPalette("@{cyan-6}", 3)`); 29 | @cyan-4: color(~`colorPalette("@{cyan-6}", 4)`); 30 | @cyan-5: color(~`colorPalette("@{cyan-6}", 5)`); 31 | @cyan-6: #00a2ae; 32 | @cyan-7: color(~`colorPalette("@{cyan-6}", 7)`); 33 | @cyan-8: color(~`colorPalette("@{cyan-6}", 8)`); 34 | @cyan-9: color(~`colorPalette("@{cyan-6}", 9)`); 35 | @cyan-10: color(~`colorPalette("@{cyan-6}", 10)`); 36 | 37 | @green-1: color(~`colorPalette("@{green-6}", 1)`); 38 | @green-2: color(~`colorPalette("@{green-6}", 2)`); 39 | @green-3: color(~`colorPalette("@{green-6}", 3)`); 40 | @green-4: color(~`colorPalette("@{green-6}", 4)`); 41 | @green-5: color(~`colorPalette("@{green-6}", 5)`); 42 | @green-6: #00a854; 43 | @green-7: color(~`colorPalette("@{green-6}", 7)`); 44 | @green-8: color(~`colorPalette("@{green-6}", 8)`); 45 | @green-9: color(~`colorPalette("@{green-6}", 9)`); 46 | @green-10: color(~`colorPalette("@{green-6}", 10)`); 47 | 48 | @pink-1: color(~`colorPalette("@{pink-6}", 1)`); 49 | @pink-2: color(~`colorPalette("@{pink-6}", 2)`); 50 | @pink-3: color(~`colorPalette("@{pink-6}", 3)`); 51 | @pink-4: color(~`colorPalette("@{pink-6}", 4)`); 52 | @pink-5: color(~`colorPalette("@{pink-6}", 5)`); 53 | @pink-6: #f5317f; 54 | @pink-7: color(~`colorPalette("@{pink-6}", 7)`); 55 | @pink-8: color(~`colorPalette("@{pink-6}", 8)`); 56 | @pink-9: color(~`colorPalette("@{pink-6}", 9)`); 57 | @pink-10: color(~`colorPalette("@{pink-6}", 10)`); 58 | 59 | @red-1: color(~`colorPalette("@{red-6}", 1)`); 60 | @red-2: color(~`colorPalette("@{red-6}", 2)`); 61 | @red-3: color(~`colorPalette("@{red-6}", 3)`); 62 | @red-4: color(~`colorPalette("@{red-6}", 4)`); 63 | @red-5: color(~`colorPalette("@{red-6}", 5)`); 64 | @red-6: #f04134; 65 | @red-7: color(~`colorPalette("@{red-6}", 7)`); 66 | @red-8: color(~`colorPalette("@{red-6}", 8)`); 67 | @red-9: color(~`colorPalette("@{red-6}", 9)`); 68 | @red-10: color(~`colorPalette("@{red-6}", 10)`); 69 | 70 | @orange-1: color(~`colorPalette("@{orange-6}", 1)`); 71 | @orange-2: color(~`colorPalette("@{orange-6}", 2)`); 72 | @orange-3: color(~`colorPalette("@{orange-6}", 3)`); 73 | @orange-4: color(~`colorPalette("@{orange-6}", 4)`); 74 | @orange-5: color(~`colorPalette("@{orange-6}", 5)`); 75 | @orange-6: #f56a00; 76 | @orange-7: color(~`colorPalette("@{orange-6}", 7)`); 77 | @orange-8: color(~`colorPalette("@{orange-6}", 8)`); 78 | @orange-9: color(~`colorPalette("@{orange-6}", 9)`); 79 | @orange-10: color(~`colorPalette("@{orange-6}", 10)`); 80 | 81 | @yellow-1: color(~`colorPalette("@{yellow-6}", 1)`); 82 | @yellow-2: color(~`colorPalette("@{yellow-6}", 2)`); 83 | @yellow-3: color(~`colorPalette("@{yellow-6}", 3)`); 84 | @yellow-4: color(~`colorPalette("@{yellow-6}", 4)`); 85 | @yellow-5: color(~`colorPalette("@{yellow-6}", 5)`); 86 | @yellow-6: #ffbf00; 87 | @yellow-7: color(~`colorPalette("@{yellow-6}", 7)`); 88 | @yellow-8: color(~`colorPalette("@{yellow-6}", 8)`); 89 | @yellow-9: color(~`colorPalette("@{yellow-6}", 9)`); 90 | @yellow-10: color(~`colorPalette("@{yellow-6}", 10)`); 91 | -------------------------------------------------------------------------------- /lib/style/color/tinyColor.less: -------------------------------------------------------------------------------- 1 | /* stylelint-disable declaration-bang-space-before */ 2 | .tinyColorMixin() { 3 | @functions: ~`(function() { 4 | // TinyColor v1.4.1 5 | // https://github.com/bgrins/TinyColor 6 | // 2016-07-07, Brian Grinstead, MIT License 7 | var trimLeft = /^\s+/, 8 | trimRight = /\s+$/, 9 | tinyCounter = 0, 10 | mathRound = Math.round, 11 | mathMin = Math.min, 12 | mathMax = Math.max, 13 | mathRandom = Math.random; 14 | 15 | function tinycolor (color, opts) { 16 | 17 | color = (color) ? color : ''; 18 | opts = opts || { }; 19 | 20 | // If input is already a tinycolor, return itself 21 | if (color instanceof tinycolor) { 22 | return color; 23 | } 24 | // If we are called as a function, call using new instead 25 | if (!(this instanceof tinycolor)) { 26 | return new tinycolor(color, opts); 27 | } 28 | 29 | var rgb = inputToRGB(color); 30 | this._originalInput = color, 31 | this._r = rgb.r, 32 | this._g = rgb.g, 33 | this._b = rgb.b, 34 | this._a = rgb.a, 35 | this._roundA = mathRound(100*this._a) / 100, 36 | this._format = opts.format || rgb.format; 37 | this._gradientType = opts.gradientType; 38 | 39 | // Don't let the range of [0,255] come back in [0,1]. 40 | // Potentially lose a little bit of precision here, but will fix issues where 41 | // .5 gets interpreted as half of the total, instead of half of 1 42 | // If it was supposed to be 128, this was already taken care of by inputToRgb 43 | if (this._r < 1) { this._r = mathRound(this._r); } 44 | if (this._g < 1) { this._g = mathRound(this._g); } 45 | if (this._b < 1) { this._b = mathRound(this._b); } 46 | 47 | this._ok = rgb.ok; 48 | this._tc_id = tinyCounter++; 49 | } 50 | 51 | tinycolor.prototype = { 52 | isDark: function() { 53 | return this.getBrightness() < 128; 54 | }, 55 | isLight: function() { 56 | return !this.isDark(); 57 | }, 58 | isValid: function() { 59 | return this._ok; 60 | }, 61 | getOriginalInput: function() { 62 | return this._originalInput; 63 | }, 64 | getFormat: function() { 65 | return this._format; 66 | }, 67 | getAlpha: function() { 68 | return this._a; 69 | }, 70 | getBrightness: function() { 71 | //http://www.w3.org/TR/AERT#color-contrast 72 | var rgb = this.toRgb(); 73 | return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; 74 | }, 75 | getLuminance: function() { 76 | //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef 77 | var rgb = this.toRgb(); 78 | var RsRGB, GsRGB, BsRGB, R, G, B; 79 | RsRGB = rgb.r/255; 80 | GsRGB = rgb.g/255; 81 | BsRGB = rgb.b/255; 82 | 83 | if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);} 84 | if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);} 85 | if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);} 86 | return (0.2126 * R) + (0.7152 * G) + (0.0722 * B); 87 | }, 88 | setAlpha: function(value) { 89 | this._a = boundAlpha(value); 90 | this._roundA = mathRound(100*this._a) / 100; 91 | return this; 92 | }, 93 | toHsv: function() { 94 | var hsv = rgbToHsv(this._r, this._g, this._b); 95 | return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; 96 | }, 97 | toHsvString: function() { 98 | var hsv = rgbToHsv(this._r, this._g, this._b); 99 | var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); 100 | return (this._a == 1) ? 101 | "hsv(" + h + ", " + s + "%, " + v + "%)" : 102 | "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; 103 | }, 104 | toHsl: function() { 105 | var hsl = rgbToHsl(this._r, this._g, this._b); 106 | return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; 107 | }, 108 | toHslString: function() { 109 | var hsl = rgbToHsl(this._r, this._g, this._b); 110 | var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); 111 | return (this._a == 1) ? 112 | "hsl(" + h + ", " + s + "%, " + l + "%)" : 113 | "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; 114 | }, 115 | toHex: function(allow3Char) { 116 | return rgbToHex(this._r, this._g, this._b, allow3Char); 117 | }, 118 | toHexString: function(allow3Char) { 119 | return '#' + this.toHex(allow3Char); 120 | }, 121 | toHex8: function(allow4Char) { 122 | return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); 123 | }, 124 | toHex8String: function(allow4Char) { 125 | return '#' + this.toHex8(allow4Char); 126 | }, 127 | toRgb: function() { 128 | return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; 129 | }, 130 | toRgbString: function() { 131 | return (this._a == 1) ? 132 | "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : 133 | "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; 134 | }, 135 | toPercentageRgb: function() { 136 | return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; 137 | }, 138 | toPercentageRgbString: function() { 139 | return (this._a == 1) ? 140 | "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : 141 | "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; 142 | }, 143 | toName: function() { 144 | if (this._a === 0) { 145 | return "transparent"; 146 | } 147 | 148 | if (this._a < 1) { 149 | return false; 150 | } 151 | 152 | return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; 153 | }, 154 | toFilter: function(secondColor) { 155 | var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a); 156 | var secondHex8String = hex8String; 157 | var gradientType = this._gradientType ? "GradientType = 1, " : ""; 158 | 159 | if (secondColor) { 160 | var s = tinycolor(secondColor); 161 | secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a); 162 | } 163 | 164 | return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; 165 | }, 166 | toString: function(format) { 167 | var formatSet = !!format; 168 | format = format || this._format; 169 | 170 | var formattedString = false; 171 | var hasAlpha = this._a < 1 && this._a >= 0; 172 | var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); 173 | 174 | if (needsAlphaFormat) { 175 | // Special case for "transparent", all other non-alpha formats 176 | // will return rgba when there is transparency. 177 | if (format === "name" && this._a === 0) { 178 | return this.toName(); 179 | } 180 | return this.toRgbString(); 181 | } 182 | if (format === "rgb") { 183 | formattedString = this.toRgbString(); 184 | } 185 | if (format === "prgb") { 186 | formattedString = this.toPercentageRgbString(); 187 | } 188 | if (format === "hex" || format === "hex6") { 189 | formattedString = this.toHexString(); 190 | } 191 | if (format === "hex3") { 192 | formattedString = this.toHexString(true); 193 | } 194 | if (format === "hex4") { 195 | formattedString = this.toHex8String(true); 196 | } 197 | if (format === "hex8") { 198 | formattedString = this.toHex8String(); 199 | } 200 | if (format === "name") { 201 | formattedString = this.toName(); 202 | } 203 | if (format === "hsl") { 204 | formattedString = this.toHslString(); 205 | } 206 | if (format === "hsv") { 207 | formattedString = this.toHsvString(); 208 | } 209 | 210 | return formattedString || this.toHexString(); 211 | }, 212 | clone: function() { 213 | return tinycolor(this.toString()); 214 | }, 215 | 216 | _applyModification: function(fn, args) { 217 | var color = fn.apply(null, [this].concat([].slice.call(args))); 218 | this._r = color._r; 219 | this._g = color._g; 220 | this._b = color._b; 221 | this.setAlpha(color._a); 222 | return this; 223 | }, 224 | lighten: function() { 225 | return this._applyModification(lighten, arguments); 226 | }, 227 | brighten: function() { 228 | return this._applyModification(brighten, arguments); 229 | }, 230 | darken: function() { 231 | return this._applyModification(darken, arguments); 232 | }, 233 | desaturate: function() { 234 | return this._applyModification(desaturate, arguments); 235 | }, 236 | saturate: function() { 237 | return this._applyModification(saturate, arguments); 238 | }, 239 | greyscale: function() { 240 | return this._applyModification(greyscale, arguments); 241 | }, 242 | spin: function() { 243 | return this._applyModification(spin, arguments); 244 | }, 245 | 246 | _applyCombination: function(fn, args) { 247 | return fn.apply(null, [this].concat([].slice.call(args))); 248 | }, 249 | analogous: function() { 250 | return this._applyCombination(analogous, arguments); 251 | }, 252 | complement: function() { 253 | return this._applyCombination(complement, arguments); 254 | }, 255 | monochromatic: function() { 256 | return this._applyCombination(monochromatic, arguments); 257 | }, 258 | splitcomplement: function() { 259 | return this._applyCombination(splitcomplement, arguments); 260 | }, 261 | triad: function() { 262 | return this._applyCombination(triad, arguments); 263 | }, 264 | tetrad: function() { 265 | return this._applyCombination(tetrad, arguments); 266 | } 267 | }; 268 | 269 | // If input is an object, force 1 into "1.0" to handle ratios properly 270 | // String input requires "1.0" as input, so 1 will be treated as 1 271 | tinycolor.fromRatio = function(color, opts) { 272 | if (typeof color == "object") { 273 | var newColor = {}; 274 | for (var i in color) { 275 | if (color.hasOwnProperty(i)) { 276 | if (i === "a") { 277 | newColor[i] = color[i]; 278 | } 279 | else { 280 | newColor[i] = convertToPercentage(color[i]); 281 | } 282 | } 283 | } 284 | color = newColor; 285 | } 286 | 287 | return tinycolor(color, opts); 288 | }; 289 | 290 | // Given a string or object, convert that input to RGB 291 | // Possible string inputs: 292 | // 293 | // "red" 294 | // "#f00" or "f00" 295 | // "#ff0000" or "ff0000" 296 | // "#ff000000" or "ff000000" 297 | // "rgb 255 0 0" or "rgb (255, 0, 0)" 298 | // "rgb 1.0 0 0" or "rgb (1, 0, 0)" 299 | // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" 300 | // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" 301 | // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" 302 | // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" 303 | // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" 304 | // 305 | function inputToRGB(color) { 306 | 307 | var rgb = { r: 0, g: 0, b: 0 }; 308 | var a = 1; 309 | var s = null; 310 | var v = null; 311 | var l = null; 312 | var ok = false; 313 | var format = false; 314 | 315 | if (typeof color == "string") { 316 | color = stringInputToObject(color); 317 | } 318 | 319 | if (typeof color == "object") { 320 | if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { 321 | rgb = rgbToRgb(color.r, color.g, color.b); 322 | ok = true; 323 | format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; 324 | } 325 | else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { 326 | s = convertToPercentage(color.s); 327 | v = convertToPercentage(color.v); 328 | rgb = hsvToRgb(color.h, s, v); 329 | ok = true; 330 | format = "hsv"; 331 | } 332 | else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { 333 | s = convertToPercentage(color.s); 334 | l = convertToPercentage(color.l); 335 | rgb = hslToRgb(color.h, s, l); 336 | ok = true; 337 | format = "hsl"; 338 | } 339 | 340 | if (color.hasOwnProperty("a")) { 341 | a = color.a; 342 | } 343 | } 344 | 345 | a = boundAlpha(a); 346 | 347 | return { 348 | ok: ok, 349 | format: color.format || format, 350 | r: mathMin(255, mathMax(rgb.r, 0)), 351 | g: mathMin(255, mathMax(rgb.g, 0)), 352 | b: mathMin(255, mathMax(rgb.b, 0)), 353 | a: a 354 | }; 355 | } 356 | 357 | // Conversion Functions 358 | // -------------------- 359 | 360 | // rgbToHsl, rgbToHsv, hslToRgb, hsvToRgb modified from: 361 | // 362 | 363 | // rgbToRgb 364 | // Handle bounds / percentage checking to conform to CSS color spec 365 | // 366 | // *Assumes:* r, g, b in [0, 255] or [0, 1] 367 | // *Returns:* { r, g, b } in [0, 255] 368 | function rgbToRgb(r, g, b){ 369 | return { 370 | r: bound01(r, 255) * 255, 371 | g: bound01(g, 255) * 255, 372 | b: bound01(b, 255) * 255 373 | }; 374 | } 375 | 376 | // rgbToHsl 377 | // Converts an RGB color value to HSL. 378 | // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] 379 | // *Returns:* { h, s, l } in [0,1] 380 | function rgbToHsl(r, g, b) { 381 | 382 | r = bound01(r, 255); 383 | g = bound01(g, 255); 384 | b = bound01(b, 255); 385 | 386 | var max = mathMax(r, g, b), min = mathMin(r, g, b); 387 | var h, s, l = (max + min) / 2; 388 | 389 | if(max == min) { 390 | h = s = 0; // achromatic 391 | } 392 | else { 393 | var d = max - min; 394 | s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 395 | switch(max) { 396 | case r: h = (g - b) / d + (g < b ? 6 : 0); break; 397 | case g: h = (b - r) / d + 2; break; 398 | case b: h = (r - g) / d + 4; break; 399 | } 400 | 401 | h /= 6; 402 | } 403 | 404 | return { h: h, s: s, l: l }; 405 | } 406 | 407 | // hslToRgb 408 | // Converts an HSL color value to RGB. 409 | // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] 410 | // *Returns:* { r, g, b } in the set [0, 255] 411 | function hslToRgb(h, s, l) { 412 | var r, g, b; 413 | 414 | h = bound01(h, 360); 415 | s = bound01(s, 100); 416 | l = bound01(l, 100); 417 | 418 | function hue2rgb(p, q, t) { 419 | if(t < 0) t += 1; 420 | if(t > 1) t -= 1; 421 | if(t < 1/6) return p + (q - p) * 6 * t; 422 | if(t < 1/2) return q; 423 | if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; 424 | return p; 425 | } 426 | 427 | if(s === 0) { 428 | r = g = b = l; // achromatic 429 | } 430 | else { 431 | var q = l < 0.5 ? l * (1 + s) : l + s - l * s; 432 | var p = 2 * l - q; 433 | r = hue2rgb(p, q, h + 1/3); 434 | g = hue2rgb(p, q, h); 435 | b = hue2rgb(p, q, h - 1/3); 436 | } 437 | 438 | return { r: r * 255, g: g * 255, b: b * 255 }; 439 | } 440 | 441 | // rgbToHsv 442 | // Converts an RGB color value to HSV 443 | // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] 444 | // *Returns:* { h, s, v } in [0,1] 445 | function rgbToHsv(r, g, b) { 446 | 447 | r = bound01(r, 255); 448 | g = bound01(g, 255); 449 | b = bound01(b, 255); 450 | 451 | var max = mathMax(r, g, b), min = mathMin(r, g, b); 452 | var h, s, v = max; 453 | 454 | var d = max - min; 455 | s = max === 0 ? 0 : d / max; 456 | 457 | if(max == min) { 458 | h = 0; // achromatic 459 | } 460 | else { 461 | switch(max) { 462 | case r: h = (g - b) / d + (g < b ? 6 : 0); break; 463 | case g: h = (b - r) / d + 2; break; 464 | case b: h = (r - g) / d + 4; break; 465 | } 466 | h /= 6; 467 | } 468 | return { h: h, s: s, v: v }; 469 | } 470 | 471 | // hsvToRgb 472 | // Converts an HSV color value to RGB. 473 | // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] 474 | // *Returns:* { r, g, b } in the set [0, 255] 475 | function hsvToRgb(h, s, v) { 476 | 477 | h = bound01(h, 360) * 6; 478 | s = bound01(s, 100); 479 | v = bound01(v, 100); 480 | 481 | var i = Math.floor(h), 482 | f = h - i, 483 | p = v * (1 - s), 484 | q = v * (1 - f * s), 485 | t = v * (1 - (1 - f) * s), 486 | mod = i % 6, 487 | r = [v, q, p, p, t, v][mod], 488 | g = [t, v, v, q, p, p][mod], 489 | b = [p, p, t, v, v, q][mod]; 490 | 491 | return { r: r * 255, g: g * 255, b: b * 255 }; 492 | } 493 | 494 | // rgbToHex 495 | // Converts an RGB color to hex 496 | // Assumes r, g, and b are contained in the set [0, 255] 497 | // Returns a 3 or 6 character hex 498 | function rgbToHex(r, g, b, allow3Char) { 499 | 500 | var hex = [ 501 | pad2(mathRound(r).toString(16)), 502 | pad2(mathRound(g).toString(16)), 503 | pad2(mathRound(b).toString(16)) 504 | ]; 505 | 506 | // Return a 3 character hex if possible 507 | if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { 508 | return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); 509 | } 510 | 511 | return hex.join(""); 512 | } 513 | 514 | // rgbaToHex 515 | // Converts an RGBA color plus alpha transparency to hex 516 | // Assumes r, g, b are contained in the set [0, 255] and 517 | // a in [0, 1]. Returns a 4 or 8 character rgba hex 518 | function rgbaToHex(r, g, b, a, allow4Char) { 519 | 520 | var hex = [ 521 | pad2(mathRound(r).toString(16)), 522 | pad2(mathRound(g).toString(16)), 523 | pad2(mathRound(b).toString(16)), 524 | pad2(convertDecimalToHex(a)) 525 | ]; 526 | 527 | // Return a 4 character hex if possible 528 | if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { 529 | return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); 530 | } 531 | 532 | return hex.join(""); 533 | } 534 | 535 | // rgbaToArgbHex 536 | // Converts an RGBA color to an ARGB Hex8 string 537 | // Rarely used, but required for "toFilter()" 538 | function rgbaToArgbHex(r, g, b, a) { 539 | 540 | var hex = [ 541 | pad2(convertDecimalToHex(a)), 542 | pad2(mathRound(r).toString(16)), 543 | pad2(mathRound(g).toString(16)), 544 | pad2(mathRound(b).toString(16)) 545 | ]; 546 | 547 | return hex.join(""); 548 | } 549 | 550 | // equals 551 | // Can be called with any tinycolor input 552 | tinycolor.equals = function (color1, color2) { 553 | if (!color1 || !color2) { return false; } 554 | return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); 555 | }; 556 | 557 | tinycolor.random = function() { 558 | return tinycolor.fromRatio({ 559 | r: mathRandom(), 560 | g: mathRandom(), 561 | b: mathRandom() 562 | }); 563 | }; 564 | 565 | // Modification Functions 566 | // ---------------------- 567 | // Thanks to less.js for some of the basics here 568 | // 569 | 570 | function desaturate(color, amount) { 571 | amount = (amount === 0) ? 0 : (amount || 10); 572 | var hsl = tinycolor(color).toHsl(); 573 | hsl.s -= amount / 100; 574 | hsl.s = clamp01(hsl.s); 575 | return tinycolor(hsl); 576 | } 577 | 578 | function saturate(color, amount) { 579 | amount = (amount === 0) ? 0 : (amount || 10); 580 | var hsl = tinycolor(color).toHsl(); 581 | hsl.s += amount / 100; 582 | hsl.s = clamp01(hsl.s); 583 | return tinycolor(hsl); 584 | } 585 | 586 | function greyscale(color) { 587 | return tinycolor(color).desaturate(100); 588 | } 589 | 590 | function lighten (color, amount) { 591 | amount = (amount === 0) ? 0 : (amount || 10); 592 | var hsl = tinycolor(color).toHsl(); 593 | hsl.l += amount / 100; 594 | hsl.l = clamp01(hsl.l); 595 | return tinycolor(hsl); 596 | } 597 | 598 | function brighten(color, amount) { 599 | amount = (amount === 0) ? 0 : (amount || 10); 600 | var rgb = tinycolor(color).toRgb(); 601 | rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); 602 | rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); 603 | rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100)))); 604 | return tinycolor(rgb); 605 | } 606 | 607 | function darken (color, amount) { 608 | amount = (amount === 0) ? 0 : (amount || 10); 609 | var hsl = tinycolor(color).toHsl(); 610 | hsl.l -= amount / 100; 611 | hsl.l = clamp01(hsl.l); 612 | return tinycolor(hsl); 613 | } 614 | 615 | // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. 616 | // Values outside of this range will be wrapped into this range. 617 | function spin(color, amount) { 618 | var hsl = tinycolor(color).toHsl(); 619 | var hue = (hsl.h + amount) % 360; 620 | hsl.h = hue < 0 ? 360 + hue : hue; 621 | return tinycolor(hsl); 622 | } 623 | 624 | // Combination Functions 625 | // --------------------- 626 | // Thanks to jQuery xColor for some of the ideas behind these 627 | // 628 | 629 | function complement(color) { 630 | var hsl = tinycolor(color).toHsl(); 631 | hsl.h = (hsl.h + 180) % 360; 632 | return tinycolor(hsl); 633 | } 634 | 635 | function triad(color) { 636 | var hsl = tinycolor(color).toHsl(); 637 | var h = hsl.h; 638 | return [ 639 | tinycolor(color), 640 | tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), 641 | tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) 642 | ]; 643 | } 644 | 645 | function tetrad(color) { 646 | var hsl = tinycolor(color).toHsl(); 647 | var h = hsl.h; 648 | return [ 649 | tinycolor(color), 650 | tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), 651 | tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), 652 | tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) 653 | ]; 654 | } 655 | 656 | function splitcomplement(color) { 657 | var hsl = tinycolor(color).toHsl(); 658 | var h = hsl.h; 659 | return [ 660 | tinycolor(color), 661 | tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), 662 | tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) 663 | ]; 664 | } 665 | 666 | function analogous(color, results, slices) { 667 | results = results || 6; 668 | slices = slices || 30; 669 | 670 | var hsl = tinycolor(color).toHsl(); 671 | var part = 360 / slices; 672 | var ret = [tinycolor(color)]; 673 | 674 | for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { 675 | hsl.h = (hsl.h + part) % 360; 676 | ret.push(tinycolor(hsl)); 677 | } 678 | return ret; 679 | } 680 | 681 | function monochromatic(color, results) { 682 | results = results || 6; 683 | var hsv = tinycolor(color).toHsv(); 684 | var h = hsv.h, s = hsv.s, v = hsv.v; 685 | var ret = []; 686 | var modification = 1 / results; 687 | 688 | while (results--) { 689 | ret.push(tinycolor({ h: h, s: s, v: v})); 690 | v = (v + modification) % 1; 691 | } 692 | 693 | return ret; 694 | } 695 | 696 | // Utility Functions 697 | // --------------------- 698 | 699 | tinycolor.mix = function(color1, color2, amount) { 700 | amount = (amount === 0) ? 0 : (amount || 50); 701 | 702 | var rgb1 = tinycolor(color1).toRgb(); 703 | var rgb2 = tinycolor(color2).toRgb(); 704 | 705 | var p = amount / 100; 706 | 707 | var rgba = { 708 | r: ((rgb2.r - rgb1.r) * p) + rgb1.r, 709 | g: ((rgb2.g - rgb1.g) * p) + rgb1.g, 710 | b: ((rgb2.b - rgb1.b) * p) + rgb1.b, 711 | a: ((rgb2.a - rgb1.a) * p) + rgb1.a 712 | }; 713 | 714 | return tinycolor(rgba); 715 | }; 716 | 717 | // Readability Functions 718 | // --------------------- 719 | // false 738 | // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false 739 | tinycolor.isReadable = function(color1, color2, wcag2) { 740 | var readability = tinycolor.readability(color1, color2); 741 | var wcag2Parms, out; 742 | 743 | out = false; 744 | 745 | wcag2Parms = validateWCAG2Parms(wcag2); 746 | switch (wcag2Parms.level + wcag2Parms.size) { 747 | case "AAsmall": 748 | case "AAAlarge": 749 | out = readability >= 4.5; 750 | break; 751 | case "AAlarge": 752 | out = readability >= 3; 753 | break; 754 | case "AAAsmall": 755 | out = readability >= 7; 756 | break; 757 | } 758 | return out; 759 | 760 | }; 761 | 762 | // mostReadable 763 | // Given a base color and a list of possible foreground or background 764 | // colors for that base, returns the most readable color. 765 | // Optionally returns Black or White if the most readable color is unreadable. 766 | // *Example* 767 | // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" 768 | // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" 769 | // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" 770 | // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" 771 | tinycolor.mostReadable = function(baseColor, colorList, args) { 772 | var bestColor = null; 773 | var bestScore = 0; 774 | var readability; 775 | var includeFallbackColors, level, size ; 776 | args = args || {}; 777 | includeFallbackColors = args.includeFallbackColors ; 778 | level = args.level; 779 | size = args.size; 780 | 781 | for (var i= 0; i < colorList.length ; i++) { 782 | readability = tinycolor.readability(baseColor, colorList[i]); 783 | if (readability > bestScore) { 784 | bestScore = readability; 785 | bestColor = tinycolor(colorList[i]); 786 | } 787 | } 788 | 789 | if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) { 790 | return bestColor; 791 | } 792 | else { 793 | args.includeFallbackColors=false; 794 | return tinycolor.mostReadable(baseColor,["#fff", "#000"],args); 795 | } 796 | }; 797 | 798 | // Big List of Colors 799 | // ------------------ 800 | // 801 | var names = tinycolor.names = { 802 | aliceblue: "f0f8ff", 803 | antiquewhite: "faebd7", 804 | aqua: "0ff", 805 | aquamarine: "7fffd4", 806 | azure: "f0ffff", 807 | beige: "f5f5dc", 808 | bisque: "ffe4c4", 809 | black: "000", 810 | blanchedalmond: "ffebcd", 811 | blue: "00f", 812 | blueviolet: "8a2be2", 813 | brown: "a52a2a", 814 | burlywood: "deb887", 815 | burntsienna: "ea7e5d", 816 | cadetblue: "5f9ea0", 817 | chartreuse: "7fff00", 818 | chocolate: "d2691e", 819 | coral: "ff7f50", 820 | cornflowerblue: "6495ed", 821 | cornsilk: "fff8dc", 822 | crimson: "dc143c", 823 | cyan: "0ff", 824 | darkblue: "00008b", 825 | darkcyan: "008b8b", 826 | darkgoldenrod: "b8860b", 827 | darkgray: "a9a9a9", 828 | darkgreen: "006400", 829 | darkgrey: "a9a9a9", 830 | darkkhaki: "bdb76b", 831 | darkmagenta: "8b008b", 832 | darkolivegreen: "556b2f", 833 | darkorange: "ff8c00", 834 | darkorchid: "9932cc", 835 | darkred: "8b0000", 836 | darksalmon: "e9967a", 837 | darkseagreen: "8fbc8f", 838 | darkslateblue: "483d8b", 839 | darkslategray: "2f4f4f", 840 | darkslategrey: "2f4f4f", 841 | darkturquoise: "00ced1", 842 | darkviolet: "9400d3", 843 | deeppink: "ff1493", 844 | deepskyblue: "00bfff", 845 | dimgray: "696969", 846 | dimgrey: "696969", 847 | dodgerblue: "1e90ff", 848 | firebrick: "b22222", 849 | floralwhite: "fffaf0", 850 | forestgreen: "228b22", 851 | fuchsia: "f0f", 852 | gainsboro: "dcdcdc", 853 | ghostwhite: "f8f8ff", 854 | gold: "ffd700", 855 | goldenrod: "daa520", 856 | gray: "808080", 857 | green: "008000", 858 | greenyellow: "adff2f", 859 | grey: "808080", 860 | honeydew: "f0fff0", 861 | hotpink: "ff69b4", 862 | indianred: "cd5c5c", 863 | indigo: "4b0082", 864 | ivory: "fffff0", 865 | khaki: "f0e68c", 866 | lavender: "e6e6fa", 867 | lavenderblush: "fff0f5", 868 | lawngreen: "7cfc00", 869 | lemonchiffon: "fffacd", 870 | lightblue: "add8e6", 871 | lightcoral: "f08080", 872 | lightcyan: "e0ffff", 873 | lightgoldenrodyellow: "fafad2", 874 | lightgray: "d3d3d3", 875 | lightgreen: "90ee90", 876 | lightgrey: "d3d3d3", 877 | lightpink: "ffb6c1", 878 | lightsalmon: "ffa07a", 879 | lightseagreen: "20b2aa", 880 | lightskyblue: "87cefa", 881 | lightslategray: "789", 882 | lightslategrey: "789", 883 | lightsteelblue: "b0c4de", 884 | lightyellow: "ffffe0", 885 | lime: "0f0", 886 | limegreen: "32cd32", 887 | linen: "faf0e6", 888 | magenta: "f0f", 889 | maroon: "800000", 890 | mediumaquamarine: "66cdaa", 891 | mediumblue: "0000cd", 892 | mediumorchid: "ba55d3", 893 | mediumpurple: "9370db", 894 | mediumseagreen: "3cb371", 895 | mediumslateblue: "7b68ee", 896 | mediumspringgreen: "00fa9a", 897 | mediumturquoise: "48d1cc", 898 | mediumvioletred: "c71585", 899 | midnightblue: "191970", 900 | mintcream: "f5fffa", 901 | mistyrose: "ffe4e1", 902 | moccasin: "ffe4b5", 903 | navajowhite: "ffdead", 904 | navy: "000080", 905 | oldlace: "fdf5e6", 906 | olive: "808000", 907 | olivedrab: "6b8e23", 908 | orange: "ffa500", 909 | orangered: "ff4500", 910 | orchid: "da70d6", 911 | palegoldenrod: "eee8aa", 912 | palegreen: "98fb98", 913 | paleturquoise: "afeeee", 914 | palevioletred: "db7093", 915 | papayawhip: "ffefd5", 916 | peachpuff: "ffdab9", 917 | peru: "cd853f", 918 | pink: "ffc0cb", 919 | plum: "dda0dd", 920 | powderblue: "b0e0e6", 921 | purple: "800080", 922 | rebeccapurple: "663399", 923 | red: "f00", 924 | rosybrown: "bc8f8f", 925 | royalblue: "4169e1", 926 | saddlebrown: "8b4513", 927 | salmon: "fa8072", 928 | sandybrown: "f4a460", 929 | seagreen: "2e8b57", 930 | seashell: "fff5ee", 931 | sienna: "a0522d", 932 | silver: "c0c0c0", 933 | skyblue: "87ceeb", 934 | slateblue: "6a5acd", 935 | slategray: "708090", 936 | slategrey: "708090", 937 | snow: "fffafa", 938 | springgreen: "00ff7f", 939 | steelblue: "4682b4", 940 | tan: "d2b48c", 941 | teal: "008080", 942 | thistle: "d8bfd8", 943 | tomato: "ff6347", 944 | turquoise: "40e0d0", 945 | violet: "ee82ee", 946 | wheat: "f5deb3", 947 | white: "fff", 948 | whitesmoke: "f5f5f5", 949 | yellow: "ff0", 950 | yellowgreen: "9acd32" 951 | }; 952 | 953 | // Make it easy to access colors via hexNames[hex] 954 | var hexNames = tinycolor.hexNames = flip(names); 955 | 956 | // Utilities 957 | // --------- 958 | 959 | // { 'name1': 'val1' } becomes { 'val1': 'name1' } 960 | function flip(o) { 961 | var flipped = { }; 962 | for (var i in o) { 963 | if (o.hasOwnProperty(i)) { 964 | flipped[o[i]] = i; 965 | } 966 | } 967 | return flipped; 968 | } 969 | 970 | // Return a valid alpha value [0,1] with all invalid values being set to 1 971 | function boundAlpha(a) { 972 | a = parseFloat(a); 973 | 974 | if (isNaN(a) || a < 0 || a > 1) { 975 | a = 1; 976 | } 977 | 978 | return a; 979 | } 980 | 981 | // Take input from [0, n] and return it as [0, 1] 982 | function bound01(n, max) { 983 | if (isOnePointZero(n)) { n = "100%"; } 984 | 985 | var processPercent = isPercentage(n); 986 | n = mathMin(max, mathMax(0, parseFloat(n))); 987 | 988 | // Automatically convert percentage into number 989 | if (processPercent) { 990 | n = parseInt(n * max, 10) / 100; 991 | } 992 | 993 | // Handle floating point rounding errors 994 | if ((Math.abs(n - max) < 0.000001)) { 995 | return 1; 996 | } 997 | 998 | // Convert into [0, 1] range if it isn't already 999 | return (n % max) / parseFloat(max); 1000 | } 1001 | 1002 | // Force a number between 0 and 1 1003 | function clamp01(val) { 1004 | return mathMin(1, mathMax(0, val)); 1005 | } 1006 | 1007 | // Parse a base-16 hex value into a base-10 integer 1008 | function parseIntFromHex(val) { 1009 | return parseInt(val, 16); 1010 | } 1011 | 1012 | // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 1013 | // 1014 | function isOnePointZero(n) { 1015 | return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; 1016 | } 1017 | 1018 | // Check to see if string passed in is a percentage 1019 | function isPercentage(n) { 1020 | return typeof n === "string" && n.indexOf('%') != -1; 1021 | } 1022 | 1023 | // Force a hex value to have 2 characters 1024 | function pad2(c) { 1025 | return c.length == 1 ? '0' + c : '' + c; 1026 | } 1027 | 1028 | // Replace a decimal with it's percentage value 1029 | function convertToPercentage(n) { 1030 | if (n <= 1) { 1031 | n = (n * 100) + "%"; 1032 | } 1033 | 1034 | return n; 1035 | } 1036 | 1037 | // Converts a decimal to a hex value 1038 | function convertDecimalToHex(d) { 1039 | return Math.round(parseFloat(d) * 255).toString(16); 1040 | } 1041 | // Converts a hex value to a decimal 1042 | function convertHexToDecimal(h) { 1043 | return (parseIntFromHex(h) / 255); 1044 | } 1045 | 1046 | var matchers = (function() { 1047 | 1048 | // 1049 | var CSS_INTEGER = "[-\\+]?\\d+%?"; 1050 | 1051 | // 1052 | var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; 1053 | 1054 | // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. 1055 | var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; 1056 | 1057 | // Actual matching. 1058 | // Parentheses and commas are optional, but not required. 1059 | // Whitespace can take the place of commas or opening paren 1060 | var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; 1061 | var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; 1062 | 1063 | return { 1064 | CSS_UNIT: new RegExp(CSS_UNIT), 1065 | rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), 1066 | rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), 1067 | hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), 1068 | hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), 1069 | hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), 1070 | hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), 1071 | hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, 1072 | hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, 1073 | hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, 1074 | hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ 1075 | }; 1076 | })(); 1077 | 1078 | // isValidCSSUnit 1079 | // Take in a single string / number and check to see if it looks like a CSS unit 1080 | // (see matchers above for definition). 1081 | function isValidCSSUnit(color) { 1082 | return !!matchers.CSS_UNIT.exec(color); 1083 | } 1084 | 1085 | // stringInputToObject 1086 | // Permissive string parsing. Take in a number of formats, and output an object 1087 | // based on detected format. Returns { r, g, b } or { h, s, l } or { h, s, v} 1088 | function stringInputToObject(color) { 1089 | 1090 | color = color.replace(trimLeft, '').replace(trimRight, '').toLowerCase(); 1091 | var named = false; 1092 | if (names[color]) { 1093 | color = names[color]; 1094 | named = true; 1095 | } 1096 | else if (color == 'transparent') { 1097 | return { r: 0, g: 0, b: 0, a: 0, format: "name" }; 1098 | } 1099 | 1100 | // Try to match string input using regular expressions. 1101 | // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] 1102 | // Just return an object and let the conversion functions handle that. 1103 | // This way the result will be the same whether the tinycolor is initialized with string or object. 1104 | var match; 1105 | if ((match = matchers.rgb.exec(color))) { 1106 | return { r: match[1], g: match[2], b: match[3] }; 1107 | } 1108 | if ((match = matchers.rgba.exec(color))) { 1109 | return { r: match[1], g: match[2], b: match[3], a: match[4] }; 1110 | } 1111 | if ((match = matchers.hsl.exec(color))) { 1112 | return { h: match[1], s: match[2], l: match[3] }; 1113 | } 1114 | if ((match = matchers.hsla.exec(color))) { 1115 | return { h: match[1], s: match[2], l: match[3], a: match[4] }; 1116 | } 1117 | if ((match = matchers.hsv.exec(color))) { 1118 | return { h: match[1], s: match[2], v: match[3] }; 1119 | } 1120 | if ((match = matchers.hsva.exec(color))) { 1121 | return { h: match[1], s: match[2], v: match[3], a: match[4] }; 1122 | } 1123 | if ((match = matchers.hex8.exec(color))) { 1124 | return { 1125 | r: parseIntFromHex(match[1]), 1126 | g: parseIntFromHex(match[2]), 1127 | b: parseIntFromHex(match[3]), 1128 | a: convertHexToDecimal(match[4]), 1129 | format: named ? "name" : "hex8" 1130 | }; 1131 | } 1132 | if ((match = matchers.hex6.exec(color))) { 1133 | return { 1134 | r: parseIntFromHex(match[1]), 1135 | g: parseIntFromHex(match[2]), 1136 | b: parseIntFromHex(match[3]), 1137 | format: named ? "name" : "hex" 1138 | }; 1139 | } 1140 | if ((match = matchers.hex4.exec(color))) { 1141 | return { 1142 | r: parseIntFromHex(match[1] + '' + match[1]), 1143 | g: parseIntFromHex(match[2] + '' + match[2]), 1144 | b: parseIntFromHex(match[3] + '' + match[3]), 1145 | a: convertHexToDecimal(match[4] + '' + match[4]), 1146 | format: named ? "name" : "hex8" 1147 | }; 1148 | } 1149 | if ((match = matchers.hex3.exec(color))) { 1150 | return { 1151 | r: parseIntFromHex(match[1] + '' + match[1]), 1152 | g: parseIntFromHex(match[2] + '' + match[2]), 1153 | b: parseIntFromHex(match[3] + '' + match[3]), 1154 | format: named ? "name" : "hex" 1155 | }; 1156 | } 1157 | 1158 | return false; 1159 | } 1160 | 1161 | function validateWCAG2Parms(parms) { 1162 | // return valid WCAG2 parms for isReadable. 1163 | // If input parms are invalid, return {"level":"AA", "size":"small"} 1164 | var level, size; 1165 | parms = parms || {"level":"AA", "size":"small"}; 1166 | level = (parms.level || "AA").toUpperCase(); 1167 | size = (parms.size || "small").toLowerCase(); 1168 | if (level !== "AA" && level !== "AAA") { 1169 | level = "AA"; 1170 | } 1171 | if (size !== "small" && size !== "large") { 1172 | size = "small"; 1173 | } 1174 | return {"level":level, "size":size}; 1175 | } 1176 | 1177 | this.tinycolor = tinycolor; 1178 | 1179 | })()`; 1180 | } 1181 | // It is hacky way to make this function will be compiled preferentially by less 1182 | // resolve error: `ReferenceError: colorPalette is not defined` 1183 | // https://github.com/ant-design/ant-motion/issues/44 1184 | .tinyColorMixin(); 1185 | -------------------------------------------------------------------------------- /lib/style/core/base.less: -------------------------------------------------------------------------------- 1 | @import "./normalize.less"; 2 | 3 | // http://stackoverflow.com/a/13611748/3040605 4 | @font-face { 5 | font-family: "Helvetica Neue For Number"; 6 | src: local("Helvetica Neue"); 7 | unicode-range: U+30-39; 8 | } 9 | 10 | * { 11 | box-sizing: border-box; 12 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); // remove tap highlight color for mobile safari 13 | } 14 | 15 | *:before, 16 | *:after { 17 | box-sizing: border-box; 18 | } 19 | 20 | // HTML & Body reset 21 | html, body { 22 | .square(100%); 23 | } 24 | 25 | body { 26 | font-family: @font-family; 27 | font-size: @font-size-base; 28 | line-height: @line-height-base; 29 | color: @text-color; 30 | background-color: @body-background; 31 | } 32 | 33 | // unify the setting of elements's margin and padding for browsers 34 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section { 35 | margin: 0; 36 | padding: 0; 37 | } 38 | 39 | // Reset fonts for relevant elements 40 | button,input,select,textarea { 41 | font-family: inherit; 42 | font-size: inherit; 43 | line-height: inherit; 44 | color: inherit; 45 | } 46 | 47 | input[type="text"], 48 | textarea { 49 | -webkit-appearance: none; 50 | } 51 | 52 | ul, 53 | ol { 54 | list-style: none; 55 | } 56 | 57 | // Remove the clear button of a text input control in IE10+ 58 | input::-ms-clear, input::-ms-reveal { 59 | display: none; 60 | } 61 | 62 | ::selection { 63 | background: @primary-color; 64 | color: #fff; 65 | } 66 | 67 | // Headers 68 | h1, h2, h3, h4, h5, h6 { 69 | color: @heading-color; 70 | font-weight: 500; 71 | } 72 | 73 | // Links 74 | a { 75 | color: @link-color; 76 | background: transparent; 77 | text-decoration: @link-decoration; 78 | outline: none; 79 | cursor: pointer; 80 | transition: color .3s ease; 81 | 82 | &:focus { 83 | text-decoration: underline; 84 | text-decoration-skip: ink; 85 | } 86 | 87 | &:hover { 88 | color: @link-hover-color; 89 | } 90 | 91 | &:active { 92 | color: @link-active-color; 93 | } 94 | 95 | &:active, 96 | &:hover { 97 | outline: 0; 98 | text-decoration: @link-hover-decoration; 99 | } 100 | 101 | &[disabled] { 102 | color: @disabled-color; 103 | cursor: not-allowed; 104 | pointer-events: none; 105 | } 106 | } 107 | 108 | .@{ant-prefix}-divider { 109 | margin: 0 6px; 110 | display: inline-block; 111 | height: 8px; 112 | width: 1px; 113 | background: #ccc; 114 | } 115 | 116 | code, 117 | kbd, 118 | pre, 119 | samp { 120 | font-family: @code-family; 121 | } 122 | 123 | // Utility classes 124 | .clearfix { 125 | .clearfix(); 126 | } 127 | -------------------------------------------------------------------------------- /lib/style/core/iconfont.less: -------------------------------------------------------------------------------- 1 | @import '../themes/default'; 2 | @import "../mixins/iconfont"; 3 | 4 | // font-face 5 | @font-face { 6 | font-family: 'anticon'; 7 | src: url('@{icon-url}.eot'); /* IE9*/ 8 | src: 9 | /* IE6-IE8 */ 10 | url('@{icon-url}.eot?#iefix') format('embedded-opentype'), 11 | /* chrome、firefox */ 12 | url('@{icon-url}.woff') format('woff'), 13 | /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ 14 | url('@{icon-url}.ttf') format('truetype'), 15 | /* iOS 4.1- */ 16 | url('@{icon-url}.svg#iconfont') format('svg'); 17 | } 18 | 19 | .@{iconfont-css-prefix} { 20 | .iconfont-mixin(); 21 | } 22 | 23 | .@{iconfont-css-prefix}-step-forward:before { content: "\e600"; } 24 | .@{iconfont-css-prefix}-step-backward:before { content: "\e601"; } 25 | .@{iconfont-css-prefix}-forward:before { content: "\e602"; } 26 | .@{iconfont-css-prefix}-backward:before { content: "\e603"; } 27 | .@{iconfont-css-prefix}-caret-right:before { content: "\e604"; } 28 | .@{iconfont-css-prefix}-caret-left:before { content: "\e605"; } 29 | .@{iconfont-css-prefix}-caret-down:before { content: "\e606"; } 30 | .@{iconfont-css-prefix}-caret-up:before { content: "\e607"; } 31 | .@{iconfont-css-prefix}-right-circle:before { content: "\e608"; } 32 | .@{iconfont-css-prefix}-circle-right:before { content: "\e608"; } // antd@1.x compatibility alias: right-circle 33 | .@{iconfont-css-prefix}-caret-circle-right:before { content: "\e608"; } // antd@1.x compatibility alias: right-circle 34 | .@{iconfont-css-prefix}-left-circle:before { content: "\e609"; } 35 | .@{iconfont-css-prefix}-circle-left:before { content: "\e609"; } // antd@1.x compatibility alias: left-circle 36 | .@{iconfont-css-prefix}-caret-circle-left:before { content: "\e609"; } // antd@1.x compatibility alias: left-circle 37 | .@{iconfont-css-prefix}-up-circle:before { content: "\e60a"; } 38 | .@{iconfont-css-prefix}-circle-up:before { content: "\e60a"; } // antd@1.x compatibility alias: up-circle 39 | .@{iconfont-css-prefix}-caret-circle-up:before { content: "\e60a"; } // antd@1.x compatibility alias: up-circle 40 | .@{iconfont-css-prefix}-down-circle:before { content: "\e60b"; } 41 | .@{iconfont-css-prefix}-circle-down:before { content: "\e60b"; } // antd@1.x compatibility alias: down-circle 42 | .@{iconfont-css-prefix}-caret-circle-down:before { content: "\e60b"; } // antd@1.x compatibility alias: down-circle 43 | .@{iconfont-css-prefix}-right-circle-o:before { content: "\e60c"; } 44 | .@{iconfont-css-prefix}-circle-o-right:before { content: "\e60c"; } // antd@1.x compatibility alias: right-circle-o 45 | .@{iconfont-css-prefix}-caret-circle-o-right:before { content: "\e60c"; } // antd@1.x compatibility alias: right-circle-o 46 | .@{iconfont-css-prefix}-left-circle-o:before { content: "\e60d"; } 47 | .@{iconfont-css-prefix}-circle-o-left:before { content: "\e60d"; } // antd@1.x compatibility alias: left-circle-o 48 | .@{iconfont-css-prefix}-caret-circle-o-left:before { content: "\e60d"; } // antd@1.x compatibility alias: left-circle-o 49 | .@{iconfont-css-prefix}-up-circle-o:before { content: "\e60e"; } 50 | .@{iconfont-css-prefix}-circle-o-up:before { content: "\e60e"; } // antd@1.x compatibility alias: up-circle-o 51 | .@{iconfont-css-prefix}-caret-circle-o-up:before { content: "\e60e"; } // antd@1.x compatibility alias: up-circle-o 52 | .@{iconfont-css-prefix}-down-circle-o:before { content: "\e60f"; } 53 | .@{iconfont-css-prefix}-circle-o-down:before { content: "\e60f"; } // antd@1.x compatibility alias: down-circle-o 54 | .@{iconfont-css-prefix}-caret-circle-o-down:before { content: "\e60f"; } // antd@1.x compatibility alias: down-circle-o 55 | .@{iconfont-css-prefix}-verticle-left:before { content: "\e610"; } 56 | .@{iconfont-css-prefix}-verticle-right:before { content: "\e611"; } 57 | .@{iconfont-css-prefix}-rollback:before { content: "\e612"; } 58 | .@{iconfont-css-prefix}-retweet:before { content: "\e613"; } 59 | .@{iconfont-css-prefix}-shrink:before { content: "\e614"; } 60 | .@{iconfont-css-prefix}-arrows-alt:before { content: "\e615"; } 61 | .@{iconfont-css-prefix}-arrow-salt:before { content: "\e615"; } // antd@1.x compatibility alias: arrows-alt 62 | .@{iconfont-css-prefix}-reload:before { content: "\e616"; } 63 | .@{iconfont-css-prefix}-double-right:before { content: "\e617"; } 64 | .@{iconfont-css-prefix}-double-left:before { content: "\e618"; } 65 | .@{iconfont-css-prefix}-arrow-down:before { content: "\e619"; } 66 | .@{iconfont-css-prefix}-arrow-up:before { content: "\e61a"; } 67 | .@{iconfont-css-prefix}-arrow-right:before { content: "\e61b"; } 68 | .@{iconfont-css-prefix}-arrow-left:before { content: "\e61c"; } 69 | .@{iconfont-css-prefix}-down:before { content: "\e61d"; } 70 | .@{iconfont-css-prefix}-up:before { content: "\e61e"; } 71 | .@{iconfont-css-prefix}-right:before { content: "\e61f"; } 72 | .@{iconfont-css-prefix}-left:before { content: "\e620"; } 73 | .@{iconfont-css-prefix}-minus-square-o:before { content: "\e621"; } 74 | .@{iconfont-css-prefix}-minus-circle:before { content: "\e622"; } 75 | .@{iconfont-css-prefix}-minus-circle-o:before { content: "\e623"; } 76 | .@{iconfont-css-prefix}-minus:before { content: "\e624"; } 77 | .@{iconfont-css-prefix}-plus-circle-o:before { content: "\e625"; } 78 | .@{iconfont-css-prefix}-plus-circle:before { content: "\e626"; } 79 | .@{iconfont-css-prefix}-plus:before { content: "\e627"; } 80 | .@{iconfont-css-prefix}-info-circle:before { content: "\e628"; } 81 | .@{iconfont-css-prefix}-info-circle-o:before { content: "\e629"; } 82 | .@{iconfont-css-prefix}-info:before { content: "\e62a"; } 83 | .@{iconfont-css-prefix}-exclamation:before { content: "\e62b"; } 84 | .@{iconfont-css-prefix}-exclamation-circle:before { content: "\e62c"; } 85 | .@{iconfont-css-prefix}-exclamation-circle-o:before { content: "\e62d"; } 86 | .@{iconfont-css-prefix}-close-circle:before { content: "\e62e"; } 87 | .@{iconfont-css-prefix}-cross-circle:before { content: "\e62e"; } // antd@1.x compatibility alias: close-circle 88 | .@{iconfont-css-prefix}-close-circle-o:before { content: "\e62f"; } 89 | .@{iconfont-css-prefix}-cross-circle-o:before { content: "\e62f"; } // antd@1.x compatibility alias: close-circle-o 90 | .@{iconfont-css-prefix}-check-circle:before { content: "\e630"; } 91 | .@{iconfont-css-prefix}-check-circle-o:before { content: "\e631"; } 92 | .@{iconfont-css-prefix}-check:before { content: "\e632"; } 93 | .@{iconfont-css-prefix}-close:before { content: "\e633"; } 94 | .@{iconfont-css-prefix}-cross:before { content: "\e633"; } // antd@1.x compatibility alias: close 95 | .@{iconfont-css-prefix}-customer-service:before { content: "\e634"; } 96 | .@{iconfont-css-prefix}-customerservice:before { content: "\e634"; } // antd@1.x compatibility alias: customer-service 97 | .@{iconfont-css-prefix}-credit-card:before { content: "\e635"; } 98 | .@{iconfont-css-prefix}-code-o:before { content: "\e636"; } 99 | .@{iconfont-css-prefix}-book:before { content: "\e637"; } 100 | .@{iconfont-css-prefix}-bar-chart:before { content: "\e638"; } 101 | .@{iconfont-css-prefix}-bars:before { content: "\e639"; } 102 | .@{iconfont-css-prefix}-question:before { content: "\e63a"; } 103 | .@{iconfont-css-prefix}-question-circle:before { content: "\e63b"; } 104 | .@{iconfont-css-prefix}-question-circle-o:before { content: "\e63c"; } 105 | .@{iconfont-css-prefix}-pause:before { content: "\e63d"; } 106 | .@{iconfont-css-prefix}-pause-circle:before { content: "\e63e"; } 107 | .@{iconfont-css-prefix}-pause-circle-o:before { content: "\e63f"; } 108 | .@{iconfont-css-prefix}-clock-circle:before { content: "\e640"; } 109 | .@{iconfont-css-prefix}-clock-circle-o:before { content: "\e641"; } 110 | .@{iconfont-css-prefix}-swap:before { content: "\e642"; } 111 | .@{iconfont-css-prefix}-swap-left:before { content: "\e643"; } 112 | .@{iconfont-css-prefix}-swap-right:before { content: "\e644"; } 113 | .@{iconfont-css-prefix}-plus-square-o:before { content: "\e645"; } 114 | .@{iconfont-css-prefix}-frown:before { content: "\e646"; } 115 | .@{iconfont-css-prefix}-frown-circle:before { content: "\e646"; } // antd@1.x compatibility alias: frown 116 | .@{iconfont-css-prefix}-ellipsis:before { content: "\e647"; } 117 | .@{iconfont-css-prefix}-copy:before { content: "\e648"; } 118 | .@{iconfont-css-prefix}-menu-fold:before { content: "\e658"; } 119 | .@{iconfont-css-prefix}-mail:before { content: "\e659"; } 120 | .@{iconfont-css-prefix}-logout:before { content: "\e65a"; } 121 | .@{iconfont-css-prefix}-link:before { content: "\e65b"; } 122 | .@{iconfont-css-prefix}-area-chart:before { content: "\e65c"; } 123 | .@{iconfont-css-prefix}-line-chart:before { content: "\e65d"; } 124 | .@{iconfont-css-prefix}-home:before { content: "\e65e"; } 125 | .@{iconfont-css-prefix}-laptop:before { content: "\e65f"; } 126 | .@{iconfont-css-prefix}-star:before { content: "\e660"; } 127 | .@{iconfont-css-prefix}-star-o:before { content: "\e661"; } 128 | .@{iconfont-css-prefix}-folder:before { content: "\e662"; } 129 | .@{iconfont-css-prefix}-filter:before { content: "\e663"; } 130 | .@{iconfont-css-prefix}-file:before { content: "\e664"; } 131 | .@{iconfont-css-prefix}-exception:before { content: "\e665"; } 132 | .@{iconfont-css-prefix}-meh:before { content: "\e666"; } 133 | .@{iconfont-css-prefix}-meh-circle:before { content: "\e666"; } // antd@1.x compatibility alias: meh 134 | .@{iconfont-css-prefix}-meh-o:before { content: "\e667"; } 135 | .@{iconfont-css-prefix}-shopping-cart:before { content: "\e668"; } 136 | .@{iconfont-css-prefix}-save:before { content: "\e669"; } 137 | .@{iconfont-css-prefix}-user:before { content: "\e66a"; } 138 | .@{iconfont-css-prefix}-video-camera:before { content: "\e66b"; } 139 | .@{iconfont-css-prefix}-to-top:before { content: "\e66c"; } 140 | .@{iconfont-css-prefix}-team:before { content: "\e66d"; } 141 | .@{iconfont-css-prefix}-tablet:before { content: "\e66e"; } 142 | .@{iconfont-css-prefix}-solution:before { content: "\e66f"; } 143 | .@{iconfont-css-prefix}-search:before { content: "\e670"; } 144 | .@{iconfont-css-prefix}-share-alt:before { content: "\e671"; } 145 | .@{iconfont-css-prefix}-setting:before { content: "\e672"; } 146 | .@{iconfont-css-prefix}-poweroff:before { content: "\e6d5"; } 147 | .@{iconfont-css-prefix}-picture:before { content: "\e674"; } 148 | .@{iconfont-css-prefix}-phone:before { content: "\e675"; } 149 | .@{iconfont-css-prefix}-paper-clip:before { content: "\e676"; } 150 | .@{iconfont-css-prefix}-notification:before { content: "\e677"; } 151 | .@{iconfont-css-prefix}-mobile:before { content: "\e678"; } 152 | .@{iconfont-css-prefix}-menu-unfold:before { content: "\e679"; } 153 | .@{iconfont-css-prefix}-inbox:before { content: "\e67a"; } 154 | .@{iconfont-css-prefix}-lock:before { content: "\e67b"; } 155 | .@{iconfont-css-prefix}-qrcode:before { content: "\e67c"; } 156 | .@{iconfont-css-prefix}-play-circle:before { content: "\e6d0"; } 157 | .@{iconfont-css-prefix}-play-circle-o:before { content: "\e6d1"; } 158 | .@{iconfont-css-prefix}-tag:before { content: "\e6d2"; } 159 | .@{iconfont-css-prefix}-tag-o:before { content: "\e6d3"; } 160 | .@{iconfont-css-prefix}-tags:before { content: "\e67d"; } 161 | .@{iconfont-css-prefix}-tags-o:before { content: "\e67e"; } 162 | .@{iconfont-css-prefix}-cloud-o:before { content: "\e67f"; } 163 | .@{iconfont-css-prefix}-cloud:before { content: "\e680"; } 164 | .@{iconfont-css-prefix}-cloud-upload:before { content: "\e681"; } 165 | .@{iconfont-css-prefix}-cloud-download:before { content: "\e682"; } 166 | .@{iconfont-css-prefix}-cloud-download-o:before { content: "\e683"; } 167 | .@{iconfont-css-prefix}-cloud-upload-o:before { content: "\e684"; } 168 | .@{iconfont-css-prefix}-environment:before { content: "\e685"; } 169 | .@{iconfont-css-prefix}-environment-o:before { content: "\e686"; } 170 | .@{iconfont-css-prefix}-eye:before { content: "\e687"; } 171 | .@{iconfont-css-prefix}-eye-o:before { content: "\e688"; } 172 | .@{iconfont-css-prefix}-camera:before { content: "\e689"; } 173 | .@{iconfont-css-prefix}-camera-o:before { content: "\e68a"; } 174 | .@{iconfont-css-prefix}-windows:before { content: "\e68b"; } 175 | .@{iconfont-css-prefix}-apple:before { content: "\e68c"; } 176 | .@{iconfont-css-prefix}-apple-o:before { content: "\e6d4"; } 177 | .@{iconfont-css-prefix}-android:before { content: "\e938"; } 178 | .@{iconfont-css-prefix}-android-o:before { content: "\e68d"; } 179 | .@{iconfont-css-prefix}-aliwangwang:before { content: "\e68e"; } 180 | .@{iconfont-css-prefix}-aliwangwang-o:before { content: "\e68f"; } 181 | .@{iconfont-css-prefix}-export:before { content: "\e691"; } 182 | .@{iconfont-css-prefix}-edit:before { content: "\e692"; } 183 | .@{iconfont-css-prefix}-circle-down-o:before { content: "\e693"; } 184 | .@{iconfont-css-prefix}-circle-down-:before { content: "\e694"; } 185 | .@{iconfont-css-prefix}-appstore-o:before { content: "\e695"; } 186 | .@{iconfont-css-prefix}-appstore:before { content: "\e696"; } 187 | .@{iconfont-css-prefix}-scan:before { content: "\e697"; } 188 | .@{iconfont-css-prefix}-file-text:before { content: "\e698"; } 189 | .@{iconfont-css-prefix}-folder-open:before { content: "\e699"; } 190 | .@{iconfont-css-prefix}-hdd:before { content: "\e69a"; } 191 | .@{iconfont-css-prefix}-ie:before { content: "\e69b"; } 192 | .@{iconfont-css-prefix}-file-jpg:before { content: "\e69c"; } 193 | .@{iconfont-css-prefix}-like:before { content: "\e64c"; } 194 | .@{iconfont-css-prefix}-like-o:before { content: "\e69d"; } 195 | .@{iconfont-css-prefix}-dislike:before { content: "\e64b"; } 196 | .@{iconfont-css-prefix}-dislike-o:before { content: "\e69e"; } 197 | .@{iconfont-css-prefix}-delete:before { content: "\e69f"; } 198 | .@{iconfont-css-prefix}-enter:before { content: "\e6a0"; } 199 | .@{iconfont-css-prefix}-pushpin-o:before { content: "\e6a1"; } 200 | .@{iconfont-css-prefix}-pushpin:before { content: "\e6a2"; } 201 | .@{iconfont-css-prefix}-heart:before { content: "\e6a3"; } 202 | .@{iconfont-css-prefix}-heart-o:before { content: "\e6a4"; } 203 | .@{iconfont-css-prefix}-pay-circle:before { content: "\e6a5"; } 204 | .@{iconfont-css-prefix}-pay-circle-o:before { content: "\e6a6"; } 205 | .@{iconfont-css-prefix}-smile:before { content: "\e6a7"; } 206 | .@{iconfont-css-prefix}-smile-circle:before { content: "\e6a7"; } // antd@1.x compatibility alias: smile 207 | .@{iconfont-css-prefix}-smile-o:before { content: "\e6a8"; } 208 | .@{iconfont-css-prefix}-frown-o:before { content: "\e6a9"; } 209 | .@{iconfont-css-prefix}-calculator:before { content: "\e6aa"; } 210 | .@{iconfont-css-prefix}-message:before { content: "\e6ab"; } 211 | .@{iconfont-css-prefix}-chrome:before { content: "\e6ac"; } 212 | .@{iconfont-css-prefix}-github:before { content: "\e6ad"; } 213 | .@{iconfont-css-prefix}-file-unknown:before { content: "\e6af"; } 214 | .@{iconfont-css-prefix}-file-excel:before { content: "\e6b0"; } 215 | .@{iconfont-css-prefix}-file-ppt:before { content: "\e6b1"; } 216 | .@{iconfont-css-prefix}-file-word:before { content: "\e6b2"; } 217 | .@{iconfont-css-prefix}-file-pdf:before { content: "\e6b3"; } 218 | .@{iconfont-css-prefix}-desktop:before { content: "\e6b4"; } 219 | .@{iconfont-css-prefix}-upload:before { content: "\e6b6"; } 220 | .@{iconfont-css-prefix}-download:before { content: "\e6b7"; } 221 | .@{iconfont-css-prefix}-pie-chart:before { content: "\e6b8"; } 222 | .@{iconfont-css-prefix}-unlock:before { content: "\e6ba"; } 223 | .@{iconfont-css-prefix}-calendar:before { content: "\e6bb"; } 224 | .@{iconfont-css-prefix}-windows-o:before { content: "\e6bc"; } 225 | .@{iconfont-css-prefix}-dot-chart:before { content: "\e6bd"; } 226 | .@{iconfont-css-prefix}-bar-chart:before { content: "\e6be"; } 227 | .@{iconfont-css-prefix}-code:before { content: "\e6bf"; } 228 | .@{iconfont-css-prefix}-api:before { content: "\e951"; } 229 | .@{iconfont-css-prefix}-plus-square:before { content: "\e6c0"; } 230 | .@{iconfont-css-prefix}-minus-square:before { content: "\e6c1"; } 231 | .@{iconfont-css-prefix}-close-square:before { content: "\e6c2"; } 232 | .@{iconfont-css-prefix}-close-square-o:before { content: "\e6c3"; } 233 | .@{iconfont-css-prefix}-check-square:before { content: "\e6c4"; } 234 | .@{iconfont-css-prefix}-check-square-o:before { content: "\e6c5"; } 235 | .@{iconfont-css-prefix}-fast-backward:before { content: "\e6c6"; } 236 | .@{iconfont-css-prefix}-fast-forward:before { content: "\e6c7"; } 237 | .@{iconfont-css-prefix}-up-square:before { content: "\e6c8"; } 238 | .@{iconfont-css-prefix}-down-square:before { content: "\e6c9"; } 239 | .@{iconfont-css-prefix}-left-square:before { content: "\e6ca"; } 240 | .@{iconfont-css-prefix}-right-square:before { content: "\e6cb"; } 241 | .@{iconfont-css-prefix}-right-square-o:before { content: "\e6cc"; } 242 | .@{iconfont-css-prefix}-left-square-o:before { content: "\e6cd"; } 243 | .@{iconfont-css-prefix}-down-square-o:before { content: "\e6ce"; } 244 | .@{iconfont-css-prefix}-up-square-o:before { content: "\e6cf"; } 245 | .@{iconfont-css-prefix}-loading:before { content: "\e64d"; } 246 | .@{iconfont-css-prefix}-loading-3-quarters:before { content: "\e6ae"; } 247 | .@{iconfont-css-prefix}-bulb:before { content: "\e649"; } 248 | .@{iconfont-css-prefix}-select:before { content: "\e64a"; } 249 | .@{iconfont-css-prefix}-addfile:before, 250 | .@{iconfont-css-prefix}-file-add:before { content: "\e910"; } 251 | .@{iconfont-css-prefix}-addfolder:before, 252 | .@{iconfont-css-prefix}-folder-add:before { content: "\e914"; } 253 | .@{iconfont-css-prefix}-switcher:before { content: "\e913"; } 254 | .@{iconfont-css-prefix}-rocket:before { content: "\e90f"; } 255 | .@{iconfont-css-prefix}-dingding:before { content: "\e923"; } 256 | .@{iconfont-css-prefix}-dingding-o:before { content: "\e925"; } 257 | .@{iconfont-css-prefix}-bell:before { content: "\e64e"; } 258 | .@{iconfont-css-prefix}-disconnect:before { content: "\e64f"; } 259 | .@{iconfont-css-prefix}-database:before { content: "\e650"; } 260 | .@{iconfont-css-prefix}-compass:before { content: "\e6db"; } 261 | .@{iconfont-css-prefix}-barcode:before { content: "\e652"; } 262 | .@{iconfont-css-prefix}-hourglass:before { content: "\e653"; } 263 | .@{iconfont-css-prefix}-key:before { content: "\e654"; } 264 | .@{iconfont-css-prefix}-flag:before { content: "\e655"; } 265 | .@{iconfont-css-prefix}-layout:before { content: "\e656"; } 266 | .@{iconfont-css-prefix}-login:before { content: "\e657"; } 267 | .@{iconfont-css-prefix}-printer:before { content: "\e673"; } 268 | .@{iconfont-css-prefix}-sound:before { content: "\e6e9"; } 269 | .@{iconfont-css-prefix}-usb:before { content: "\e6d7"; } 270 | .@{iconfont-css-prefix}-skin:before { content: "\e6d8"; } 271 | .@{iconfont-css-prefix}-tool:before { content: "\e6d9"; } 272 | .@{iconfont-css-prefix}-sync:before { content: "\e6da"; } 273 | .@{iconfont-css-prefix}-wifi:before { content: "\e6d6"; } 274 | .@{iconfont-css-prefix}-car:before { content: "\e6dc"; } 275 | .@{iconfont-css-prefix}-copyright:before { content: "\e6de"; } 276 | .@{iconfont-css-prefix}-schedule:before { content: "\e6df"; } 277 | .@{iconfont-css-prefix}-user-add:before { content: "\e6ed"; } 278 | .@{iconfont-css-prefix}-user-delete:before { content: "\e6e0"; } 279 | .@{iconfont-css-prefix}-usergroup-add:before { content: "\e6dd"; } 280 | .@{iconfont-css-prefix}-usergroup-delete:before { content: "\e6e1"; } 281 | .@{iconfont-css-prefix}-man:before { content: "\e6e2"; } 282 | .@{iconfont-css-prefix}-woman:before { content: "\e6ec"; } 283 | .@{iconfont-css-prefix}-shop:before { content: "\e6e3"; } 284 | .@{iconfont-css-prefix}-gift:before { content: "\e6e4"; } 285 | .@{iconfont-css-prefix}-idcard:before { content: "\e6e5"; } 286 | .@{iconfont-css-prefix}-medicine-box:before { content: "\e6e6"; } 287 | .@{iconfont-css-prefix}-red-envelope:before { content: "\e6e7"; } 288 | .@{iconfont-css-prefix}-coffee:before { content: "\e6e8"; } 289 | .@{iconfont-css-prefix}-trademark:before { content: "\e651"; } 290 | .@{iconfont-css-prefix}-safety:before { content: "\e6ea"; } 291 | .@{iconfont-css-prefix}-wallet:before { content: "\e6eb"; } 292 | .@{iconfont-css-prefix}-bank:before { content: "\e6ee"; } 293 | .@{iconfont-css-prefix}-trophy:before { content: "\e6ef"; } 294 | .@{iconfont-css-prefix}-contacts:before { content: "\e6f0"; } 295 | .@{iconfont-css-prefix}-global:before { content: "\e6f1"; } 296 | .@{iconfont-css-prefix}-shake:before { content: "\e94f"; } 297 | .@{iconfont-css-prefix}-fork:before { content: "\e6f2"; } 298 | .@{iconfont-css-prefix}-spin:before { 299 | display: inline-block; 300 | animation: loadingCircle 1s infinite linear; 301 | } 302 | -------------------------------------------------------------------------------- /lib/style/core/index.less: -------------------------------------------------------------------------------- 1 | @import "../mixins/index"; 2 | @import "base"; 3 | @import "iconfont"; 4 | @import "motion"; 5 | -------------------------------------------------------------------------------- /lib/style/core/motion.less: -------------------------------------------------------------------------------- 1 | @import "../mixins/motion"; 2 | @import "motion/fade"; 3 | @import "motion/move"; 4 | @import "motion/other"; 5 | @import "motion/slide"; 6 | @import "motion/swing"; 7 | @import "motion/zoom"; 8 | 9 | // For common/openAnimation 10 | .ant-motion-collapse { 11 | overflow: hidden; 12 | &-active { 13 | transition: height .15s @ease-in-out, opacity .15s @ease-in-out !important; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/style/core/motion/fade.less: -------------------------------------------------------------------------------- 1 | .fade-motion(@className, @keyframeName) { 2 | .make-motion(@className, @keyframeName); 3 | .@{className}-enter, 4 | .@{className}-appear { 5 | opacity: 0; 6 | animation-timing-function: linear; 7 | } 8 | .@{className}-leave { 9 | animation-timing-function: linear; 10 | } 11 | } 12 | 13 | .fade-motion(fade, antFade); 14 | 15 | @keyframes antFadeIn { 16 | 0% { 17 | opacity: 0; 18 | } 19 | 100% { 20 | opacity: 1; 21 | } 22 | } 23 | 24 | @keyframes antFadeOut { 25 | 0% { 26 | opacity: 1; 27 | } 28 | 100% { 29 | opacity: 0; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/style/core/motion/move.less: -------------------------------------------------------------------------------- 1 | .move-motion(@className, @keyframeName) { 2 | .make-motion(@className, @keyframeName); 3 | .@{className}-enter, 4 | .@{className}-appear { 5 | opacity: 0; 6 | animation-timing-function: @ease-out-circ; 7 | } 8 | .@{className}-leave { 9 | animation-timing-function: @ease-in-circ; 10 | } 11 | } 12 | 13 | .move-motion(move-up, antMoveUp); 14 | .move-motion(move-down, antMoveDown); 15 | .move-motion(move-left, antMoveLeft); 16 | .move-motion(move-right, antMoveRight); 17 | 18 | @keyframes antMoveDownIn { 19 | 0% { 20 | transform-origin: 0 0; 21 | transform: translateY(100%); 22 | opacity: 0; 23 | } 24 | 100% { 25 | transform-origin: 0 0; 26 | transform: translateY(0%); 27 | opacity: 1; 28 | } 29 | } 30 | 31 | @keyframes antMoveDownOut { 32 | 0% { 33 | transform-origin: 0 0; 34 | transform: translateY(0%); 35 | opacity: 1; 36 | } 37 | 100% { 38 | transform-origin: 0 0; 39 | transform: translateY(100%); 40 | opacity: 0; 41 | } 42 | } 43 | 44 | @keyframes antMoveLeftIn { 45 | 0% { 46 | transform-origin: 0 0; 47 | transform: translateX(-100%); 48 | opacity: 0; 49 | } 50 | 100% { 51 | transform-origin: 0 0; 52 | transform: translateX(0%); 53 | opacity: 1; 54 | } 55 | } 56 | 57 | @keyframes antMoveLeftOut { 58 | 0% { 59 | transform-origin: 0 0; 60 | transform: translateX(0%); 61 | opacity: 1; 62 | } 63 | 100% { 64 | transform-origin: 0 0; 65 | transform: translateX(-100%); 66 | opacity: 0; 67 | } 68 | } 69 | 70 | @keyframes antMoveRightIn { 71 | 0% { 72 | opacity: 0; 73 | transform-origin: 0 0; 74 | transform: translateX(100%); 75 | } 76 | 100% { 77 | opacity: 1; 78 | transform-origin: 0 0; 79 | transform: translateX(0%); 80 | } 81 | } 82 | 83 | @keyframes antMoveRightOut { 84 | 0% { 85 | transform-origin: 0 0; 86 | transform: translateX(0%); 87 | opacity: 1; 88 | } 89 | 100% { 90 | transform-origin: 0 0; 91 | transform: translateX(100%); 92 | opacity: 0; 93 | } 94 | } 95 | 96 | @keyframes antMoveUpIn { 97 | 0% { 98 | transform-origin: 0 0; 99 | transform: translateY(-100%); 100 | opacity: 0; 101 | } 102 | 100% { 103 | transform-origin: 0 0; 104 | transform: translateY(0%); 105 | opacity: 1; 106 | } 107 | } 108 | 109 | @keyframes antMoveUpOut { 110 | 0% { 111 | transform-origin: 0 0; 112 | transform: translateY(0%); 113 | opacity: 1; 114 | } 115 | 100% { 116 | transform-origin: 0 0; 117 | transform: translateY(-100%); 118 | opacity: 0; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /lib/style/core/motion/other.less: -------------------------------------------------------------------------------- 1 | @keyframes loadingCircle { 2 | 0% { 3 | transform-origin: 50% 50%; 4 | transform: rotate(0deg); 5 | } 6 | 100% { 7 | transform-origin: 50% 50%; 8 | transform: rotate(360deg); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /lib/style/core/motion/slide.less: -------------------------------------------------------------------------------- 1 | .slide-motion(@className, @keyframeName) { 2 | .make-motion(@className, @keyframeName); 3 | .@{className}-enter, 4 | .@{className}-appear { 5 | opacity: 0; 6 | animation-timing-function: @ease-out-quint; 7 | } 8 | .@{className}-leave { 9 | animation-timing-function: @ease-in-quint; 10 | } 11 | } 12 | 13 | .slide-motion(slide-up, antSlideUp); 14 | .slide-motion(slide-down, antSlideDown); 15 | .slide-motion(slide-left, antSlideLeft); 16 | .slide-motion(slide-right, antSlideRight); 17 | 18 | @keyframes antSlideUpIn { 19 | 0% { 20 | opacity: 0; 21 | transform-origin: 0% 0%; 22 | transform: scaleY(.8); 23 | } 24 | 100% { 25 | opacity: 1; 26 | transform-origin: 0% 0%; 27 | transform: scaleY(1); 28 | } 29 | } 30 | 31 | @keyframes antSlideUpOut { 32 | 0% { 33 | opacity: 1; 34 | transform-origin: 0% 0%; 35 | transform: scaleY(1); 36 | } 37 | 100% { 38 | opacity: 0; 39 | transform-origin: 0% 0%; 40 | transform: scaleY(.8); 41 | } 42 | } 43 | 44 | @keyframes antSlideDownIn { 45 | 0% { 46 | opacity: 0; 47 | transform-origin: 100% 100%; 48 | transform: scaleY(.8); 49 | } 50 | 100% { 51 | opacity: 1; 52 | transform-origin: 100% 100%; 53 | transform: scaleY(1); 54 | } 55 | } 56 | 57 | @keyframes antSlideDownOut { 58 | 0% { 59 | opacity: 1; 60 | transform-origin: 100% 100%; 61 | transform: scaleY(1); 62 | } 63 | 100% { 64 | opacity: 0; 65 | transform-origin: 100% 100%; 66 | transform: scaleY(.8); 67 | } 68 | } 69 | 70 | @keyframes antSlideLeftIn { 71 | 0% { 72 | opacity: 0; 73 | transform-origin: 0% 0%; 74 | transform: scaleX(.8); 75 | } 76 | 100% { 77 | opacity: 1; 78 | transform-origin: 0% 0%; 79 | transform: scaleX(1); 80 | } 81 | } 82 | 83 | @keyframes antSlideLeftOut { 84 | 0% { 85 | opacity: 1; 86 | transform-origin: 0% 0%; 87 | transform: scaleX(1); 88 | } 89 | 100% { 90 | opacity: 0; 91 | transform-origin: 0% 0%; 92 | transform: scaleX(.8); 93 | } 94 | } 95 | 96 | @keyframes antSlideRightIn { 97 | 0% { 98 | opacity: 0; 99 | transform-origin: 100% 0%; 100 | transform: scaleX(.8); 101 | } 102 | 100% { 103 | opacity: 1; 104 | transform-origin: 100% 0%; 105 | transform: scaleX(1); 106 | } 107 | } 108 | 109 | @keyframes antSlideRightOut { 110 | 0% { 111 | opacity: 1; 112 | transform-origin: 100% 0%; 113 | transform: scaleX(1); 114 | } 115 | 100% { 116 | opacity: 0; 117 | transform-origin: 100% 0%; 118 | transform: scaleX(.8); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /lib/style/core/motion/swing.less: -------------------------------------------------------------------------------- 1 | .swing-motion(@className, @keyframeName) { 2 | .@{className}-enter, 3 | .@{className}-appear { 4 | .motion-common(); 5 | animation-play-state: paused; 6 | } 7 | .@{className}-enter.@{className}-enter-active, 8 | .@{className}-appear.@{className}-appear-active { 9 | animation-name: ~"@{keyframeName}In"; 10 | animation-play-state: running; 11 | } 12 | } 13 | 14 | .swing-motion(swing, antSwing); 15 | 16 | @keyframes antSwingIn { 17 | 0%, 18 | 100% { 19 | transform: translateX(0); 20 | } 21 | 20% { 22 | transform: translateX(-10px); 23 | } 24 | 40% { 25 | transform: translateX(10px); 26 | } 27 | 60% { 28 | transform: translateX(-5px); 29 | } 30 | 80% { 31 | transform: translateX(5px); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/style/core/motion/zoom.less: -------------------------------------------------------------------------------- 1 | .zoom-motion(@className, @keyframeName, @duration: @animation-duration-base) { 2 | .make-motion(@className, @keyframeName, @duration); 3 | .@{className}-enter, 4 | .@{className}-appear { 5 | transform: scale(0); // need this by yiminghe 6 | animation-timing-function: @ease-out-circ; 7 | } 8 | .@{className}-leave { 9 | animation-timing-function: @ease-in-out-circ; 10 | } 11 | } 12 | 13 | // For Modal, Select choosen item 14 | .zoom-motion(zoom, antZoom); 15 | // For Popover, Popconfirm, Dropdown 16 | .zoom-motion(zoom-big, antZoomBig); 17 | // For Tooltip 18 | .zoom-motion(zoom-big-fast, antZoomBig, @animation-duration-fast); 19 | 20 | .zoom-motion(zoom-up, antZoomUp); 21 | .zoom-motion(zoom-down, antZoomDown); 22 | .zoom-motion(zoom-left, antZoomLeft); 23 | .zoom-motion(zoom-right, antZoomRight); 24 | 25 | @keyframes antZoomIn { 26 | 0% { 27 | opacity: 0; 28 | transform: scale(0.2); 29 | } 30 | 100% { 31 | opacity: 1; 32 | transform: scale(1); 33 | } 34 | } 35 | 36 | @keyframes antZoomOut { 37 | 0% { 38 | transform: scale(1); 39 | } 40 | 100% { 41 | opacity: 0; 42 | transform: scale(0.2); 43 | } 44 | } 45 | 46 | @keyframes antZoomBigIn { 47 | 0% { 48 | opacity: 0; 49 | transform: scale(.8); 50 | } 51 | 100% { 52 | transform: scale(1); 53 | } 54 | } 55 | 56 | @keyframes antZoomBigOut { 57 | 0% { 58 | transform: scale(1); 59 | } 60 | 100% { 61 | opacity: 0; 62 | transform: scale(.8); 63 | } 64 | } 65 | 66 | @keyframes antZoomUpIn { 67 | 0% { 68 | opacity: 0; 69 | transform-origin: 50% 0%; 70 | transform: scale(.8); 71 | } 72 | 100% { 73 | transform-origin: 50% 0%; 74 | transform: scale(1); 75 | } 76 | } 77 | 78 | @keyframes antZoomUpOut { 79 | 0% { 80 | transform-origin: 50% 0%; 81 | transform: scale(1); 82 | } 83 | 100% { 84 | opacity: 0; 85 | transform-origin: 50% 0%; 86 | transform: scale(.8); 87 | } 88 | } 89 | 90 | @keyframes antZoomLeftIn { 91 | 0% { 92 | opacity: 0; 93 | transform-origin: 0% 50%; 94 | transform: scale(.8); 95 | } 96 | 100% { 97 | transform-origin: 0% 50%; 98 | transform: scale(1); 99 | } 100 | } 101 | 102 | @keyframes antZoomLeftOut { 103 | 0% { 104 | transform-origin: 0% 50%; 105 | transform: scale(1); 106 | } 107 | 100% { 108 | opacity: 0; 109 | transform-origin: 0% 50%; 110 | transform: scale(.8); 111 | } 112 | } 113 | 114 | @keyframes antZoomRightIn { 115 | 0% { 116 | opacity: 0; 117 | transform-origin: 100% 50%; 118 | transform: scale(.8); 119 | } 120 | 100% { 121 | transform-origin: 100% 50%; 122 | transform: scale(1); 123 | } 124 | } 125 | 126 | @keyframes antZoomRightOut { 127 | 0% { 128 | transform-origin: 100% 50%; 129 | transform: scale(1); 130 | } 131 | 100% { 132 | opacity: 0; 133 | transform-origin: 100% 50%; 134 | transform: scale(.8); 135 | } 136 | } 137 | 138 | @keyframes antZoomDownIn { 139 | 0% { 140 | opacity: 0; 141 | transform-origin: 50% 100%; 142 | transform: scale(.8); 143 | } 144 | 100% { 145 | transform-origin: 50% 100%; 146 | transform: scale(1); 147 | } 148 | } 149 | 150 | @keyframes antZoomDownOut { 151 | 0% { 152 | transform-origin: 50% 100%; 153 | transform: scale(1); 154 | } 155 | 100% { 156 | opacity: 0; 157 | transform-origin: 50% 100%; 158 | transform: scale(.8); 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /lib/style/core/normalize.less: -------------------------------------------------------------------------------- 1 | /*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */ 2 | 3 | /* Document 4 | ========================================================================== */ 5 | 6 | /** 7 | * 1. Correct the line height in all browsers. 8 | * 2. Prevent adjustments of font size after orientation changes in 9 | * IE on Windows Phone and in iOS. 10 | */ 11 | 12 | html { 13 | line-height: 1.15; /* 1 */ 14 | -ms-text-size-adjust: 100%; /* 2 */ 15 | -webkit-text-size-adjust: 100%; /* 2 */ 16 | } 17 | 18 | /* Sections 19 | ========================================================================== */ 20 | 21 | /** 22 | * Remove the margin in all browsers (opinionated). 23 | */ 24 | 25 | body { 26 | margin: 0; 27 | } 28 | 29 | /** 30 | * Add the correct display in IE 9-. 31 | */ 32 | 33 | article, 34 | aside, 35 | footer, 36 | header, 37 | nav, 38 | section { 39 | display: block; 40 | } 41 | 42 | /** 43 | * Correct the font size and margin on `h1` elements within `section` and 44 | * `article` contexts in Chrome, Firefox, and Safari. 45 | */ 46 | 47 | h1 { 48 | font-size: 2em; 49 | margin: 0.67em 0; 50 | } 51 | 52 | /* Grouping content 53 | ========================================================================== */ 54 | 55 | /** 56 | * Add the correct display in IE 9-. 57 | * 1. Add the correct display in IE. 58 | */ 59 | 60 | figcaption, 61 | figure, 62 | main { /* 1 */ 63 | display: block; 64 | } 65 | 66 | /** 67 | * Add the correct margin in IE 8. 68 | */ 69 | 70 | figure { 71 | margin: 1em 40px; 72 | } 73 | 74 | /** 75 | * 1. Add the correct box sizing in Firefox. 76 | * 2. Show the overflow in Edge and IE. 77 | */ 78 | 79 | hr { 80 | box-sizing: content-box; /* 1 */ 81 | height: 0; /* 1 */ 82 | overflow: visible; /* 2 */ 83 | } 84 | 85 | /** 86 | * 1. Correct the inheritance and scaling of font size in all browsers. 87 | * 2. Correct the odd `em` font sizing in all browsers. 88 | */ 89 | 90 | pre { 91 | font-family: monospace, monospace; /* 1 */ /* stylelint-disable-line */ 92 | font-size: 1em; /* 2 */ 93 | } 94 | 95 | /* Text-level semantics 96 | ========================================================================== */ 97 | 98 | /** 99 | * 1. Remove the gray background on active links in IE 10. 100 | * 2. Remove gaps in links underline in iOS 8+ and Safari 8+. 101 | */ 102 | 103 | a { 104 | background-color: transparent; /* 1 */ 105 | -webkit-text-decoration-skip: objects; /* 2 */ 106 | } 107 | 108 | /** 109 | * 1. Remove the bottom border in Chrome 57- and Firefox 39-. 110 | * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. 111 | */ 112 | 113 | abbr[title] { 114 | border-bottom: none; /* 1 */ 115 | text-decoration: underline; /* 2 */ 116 | text-decoration: underline dotted; /* 2 */ 117 | } 118 | 119 | /** 120 | * Prevent the duplicate application of `bolder` by the next rule in Safari 6. 121 | */ 122 | 123 | b, 124 | strong { 125 | font-weight: inherit; 126 | } 127 | 128 | /** 129 | * Add the correct font weight in Chrome, Edge, and Safari. 130 | */ 131 | 132 | b, 133 | strong { 134 | font-weight: bolder; 135 | } 136 | 137 | /** 138 | * 1. Correct the inheritance and scaling of font size in all browsers. 139 | * 2. Correct the odd `em` font sizing in all browsers. 140 | */ 141 | 142 | code, 143 | kbd, 144 | samp { 145 | font-family: monospace, monospace; /* 1 */ /* stylelint-disable-line */ 146 | font-size: 1em; /* 2 */ 147 | } 148 | 149 | /** 150 | * Add the correct font style in Android 4.3-. 151 | */ 152 | 153 | dfn { 154 | font-style: italic; 155 | } 156 | 157 | /** 158 | * Add the correct background and color in IE 9-. 159 | */ 160 | 161 | mark { 162 | background-color: #ff0; 163 | color: #000; 164 | } 165 | 166 | /** 167 | * Add the correct font size in all browsers. 168 | */ 169 | 170 | small { 171 | font-size: 80%; 172 | } 173 | 174 | /** 175 | * Prevent `sub` and `sup` elements from affecting the line height in 176 | * all browsers. 177 | */ 178 | 179 | sub, 180 | sup { 181 | font-size: 75%; 182 | line-height: 0; 183 | position: relative; 184 | vertical-align: baseline; 185 | } 186 | 187 | sub { 188 | bottom: -0.25em; 189 | } 190 | 191 | sup { 192 | top: -0.5em; 193 | } 194 | 195 | /* Embedded content 196 | ========================================================================== */ 197 | 198 | /** 199 | * Add the correct display in IE 9-. 200 | */ 201 | 202 | audio, 203 | video { 204 | display: inline-block; 205 | } 206 | 207 | /** 208 | * Add the correct display in iOS 4-7. 209 | */ 210 | 211 | audio:not([controls]) { 212 | display: none; 213 | height: 0; 214 | } 215 | 216 | /** 217 | * Remove the border on images inside links in IE 10-. 218 | */ 219 | 220 | img { 221 | border-style: none; 222 | } 223 | 224 | /** 225 | * Hide the overflow in IE. 226 | */ 227 | 228 | svg:not(:root) { 229 | overflow: hidden; 230 | } 231 | 232 | /* Forms 233 | ========================================================================== */ 234 | 235 | /** 236 | * 1. Change the font styles in all browsers (opinionated). 237 | * 2. Remove the margin in Firefox and Safari. 238 | */ 239 | 240 | button, 241 | input, 242 | optgroup, 243 | select, 244 | textarea { 245 | font-family: sans-serif; /* 1 */ 246 | font-size: 100%; /* 1 */ 247 | line-height: 1.15; /* 1 */ 248 | margin: 0; /* 2 */ 249 | } 250 | 251 | /** 252 | * Show the overflow in IE. 253 | * 1. Show the overflow in Edge. 254 | */ 255 | 256 | button, 257 | input { /* 1 */ 258 | overflow: visible; 259 | } 260 | 261 | /** 262 | * Remove the inheritance of text transform in Edge, Firefox, and IE. 263 | * 1. Remove the inheritance of text transform in Firefox. 264 | */ 265 | 266 | button, 267 | select { /* 1 */ 268 | text-transform: none; 269 | } 270 | 271 | /** 272 | * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video` 273 | * controls in Android 4. 274 | * 2. Correct the inability to style clickable types in iOS and Safari. 275 | */ 276 | 277 | button, 278 | html [type="button"], /* 1 */ 279 | [type="reset"], 280 | [type="submit"] { 281 | -webkit-appearance: button; /* 2 */ 282 | } 283 | 284 | /** 285 | * Remove the inner border and padding in Firefox. 286 | */ 287 | 288 | button::-moz-focus-inner, 289 | [type="button"]::-moz-focus-inner, 290 | [type="reset"]::-moz-focus-inner, 291 | [type="submit"]::-moz-focus-inner { 292 | border-style: none; 293 | padding: 0; 294 | } 295 | 296 | /** 297 | * Restore the focus styles unset by the previous rule. 298 | */ 299 | 300 | button:-moz-focusring, 301 | [type="button"]:-moz-focusring, 302 | [type="reset"]:-moz-focusring, 303 | [type="submit"]:-moz-focusring { 304 | outline: 1px dotted ButtonText; 305 | } 306 | 307 | /** 308 | * Correct the padding in Firefox. 309 | */ 310 | 311 | fieldset { 312 | padding: 0.35em 0.75em 0.625em; 313 | } 314 | 315 | /** 316 | * 1. Correct the text wrapping in Edge and IE. 317 | * 2. Correct the color inheritance from `fieldset` elements in IE. 318 | * 3. Remove the padding so developers are not caught out when they zero out 319 | * `fieldset` elements in all browsers. 320 | */ 321 | 322 | legend { 323 | box-sizing: border-box; /* 1 */ 324 | color: inherit; /* 2 */ 325 | display: table; /* 1 */ 326 | max-width: 100%; /* 1 */ 327 | padding: 0; /* 3 */ 328 | white-space: normal; /* 1 */ 329 | } 330 | 331 | /** 332 | * 1. Add the correct display in IE 9-. 333 | * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera. 334 | */ 335 | 336 | progress { 337 | display: inline-block; /* 1 */ 338 | vertical-align: baseline; /* 2 */ 339 | } 340 | 341 | /** 342 | * Remove the default vertical scrollbar in IE. 343 | */ 344 | 345 | textarea { 346 | overflow: auto; 347 | } 348 | 349 | /** 350 | * 1. Add the correct box sizing in IE 10-. 351 | * 2. Remove the padding in IE 10-. 352 | */ 353 | 354 | [type="checkbox"], 355 | [type="radio"] { 356 | box-sizing: border-box; /* 1 */ 357 | padding: 0; /* 2 */ 358 | } 359 | 360 | /** 361 | * Correct the cursor style of increment and decrement buttons in Chrome. 362 | */ 363 | 364 | [type="number"]::-webkit-inner-spin-button, 365 | [type="number"]::-webkit-outer-spin-button { 366 | height: auto; 367 | } 368 | 369 | /** 370 | * 1. Correct the odd appearance in Chrome and Safari. 371 | * 2. Correct the outline style in Safari. 372 | */ 373 | 374 | [type="search"] { 375 | -webkit-appearance: textfield; /* 1 */ 376 | outline-offset: -2px; /* 2 */ 377 | } 378 | 379 | /** 380 | * Remove the inner padding and cancel buttons in Chrome and Safari on macOS. 381 | */ 382 | 383 | [type="search"]::-webkit-search-cancel-button, 384 | [type="search"]::-webkit-search-decoration { 385 | -webkit-appearance: none; 386 | } 387 | 388 | /** 389 | * 1. Correct the inability to style clickable types in iOS and Safari. 390 | * 2. Change font properties to `inherit` in Safari. 391 | */ 392 | 393 | ::-webkit-file-upload-button { 394 | -webkit-appearance: button; /* 1 */ 395 | font: inherit; /* 2 */ 396 | } 397 | 398 | /* Interactive 399 | ========================================================================== */ 400 | 401 | /* 402 | * Add the correct display in IE 9-. 403 | * 1. Add the correct display in Edge, IE, and Firefox. 404 | */ 405 | 406 | details, /* 1 */ 407 | menu { 408 | display: block; 409 | } 410 | 411 | /* 412 | * Add the correct display in all browsers. 413 | */ 414 | 415 | summary { 416 | display: list-item; 417 | } 418 | 419 | /* Scripting 420 | ========================================================================== */ 421 | 422 | /** 423 | * Add the correct display in IE 9-. 424 | */ 425 | 426 | canvas { 427 | display: inline-block; 428 | } 429 | 430 | /** 431 | * Add the correct display in IE. 432 | */ 433 | 434 | template { 435 | display: none; 436 | } 437 | 438 | /* Hidden 439 | ========================================================================== */ 440 | 441 | /** 442 | * Add the correct display in IE 10-. 443 | */ 444 | 445 | [hidden] { 446 | display: none; 447 | } 448 | -------------------------------------------------------------------------------- /lib/style/index.less: -------------------------------------------------------------------------------- 1 | @import "./themes/default"; 2 | @import "./core/index"; 3 | -------------------------------------------------------------------------------- /lib/style/index.tsx: -------------------------------------------------------------------------------- 1 | import './index.less'; 2 | -------------------------------------------------------------------------------- /lib/style/mixins/clearfix.less: -------------------------------------------------------------------------------- 1 | // mixins for clearfix 2 | // ------------------------ 3 | .clearfix() { 4 | zoom: 1; 5 | &:before, 6 | &:after { 7 | content: " "; 8 | display: table; 9 | } 10 | &:after { 11 | clear: both; 12 | visibility: hidden; 13 | font-size: 0; 14 | height: 0; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/style/mixins/compatibility.less: -------------------------------------------------------------------------------- 1 | // Compatibility for browsers. 2 | 3 | // rotate for ie8 and blow 4 | .ie-rotate(@rotation) { 5 | // -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=@{rotation})"; 6 | } 7 | 8 | // rotate for ie8 and blow 9 | // degrees unit 10 | .ie-rotate-via-degrees(@degrees) { 11 | } 12 | 13 | // support rotate for all browsers 14 | .cross-rotate(@degrees) { 15 | .rotate(@degrees); 16 | .ie-rotate-via-degrees(@degrees); 17 | } 18 | 19 | // Placeholder text 20 | .placeholder(@color: @input-placeholder-color) { 21 | // Firefox 22 | &::-moz-placeholder { 23 | color: @color; 24 | opacity: 1; // Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526 25 | } 26 | // Internet Explorer 10+ 27 | &:-ms-input-placeholder { 28 | color: @color; 29 | } 30 | // Safari and Chrome 31 | &::-webkit-input-placeholder { 32 | color: @color; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/style/mixins/iconfont.less: -------------------------------------------------------------------------------- 1 | .iconfont-mixin() { 2 | display: inline-block; 3 | font-style: normal; 4 | vertical-align: baseline; 5 | text-align: center; 6 | text-transform: none; 7 | line-height: 1; 8 | text-rendering: optimizeLegibility; 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | &:before { 12 | display: block; 13 | font-family: "anticon" !important; 14 | } 15 | } 16 | 17 | .iconfont-font(@content) { 18 | font-family: 'anticon'; 19 | text-rendering: optimizeLegibility; 20 | -webkit-font-smoothing: antialiased; 21 | -moz-osx-font-smoothing: grayscale; 22 | content: @content; 23 | } 24 | 25 | // for iconfont font size 26 | // fix chrome 12px bug, support ie 27 | .iconfont-size-under-12px(@size, @rotate: 0deg) { 28 | display: inline-block; 29 | @font-scale: unit(@size / 12px); 30 | font-size: @font-size-base; 31 | // ie8-9 32 | // font-size: ~"@{size} \9"; // lesshint duplicateProperty: false 33 | transform: scale(@font-scale) rotate(@rotate); 34 | .ie-rotate-via-degrees(@rotate); 35 | :root & { 36 | font-size: @font-size-base; // reset ie9 and above 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/style/mixins/index.less: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------------------------------- 3 | @import "opacity"; 4 | @import "size"; 5 | @import "compatibility"; 6 | @import "clearfix"; 7 | @import "iconfont"; 8 | @import "motion"; 9 | -------------------------------------------------------------------------------- /lib/style/mixins/motion.less: -------------------------------------------------------------------------------- 1 | @import '../themes/default'; 2 | 3 | .motion-common(@duration: @animation-duration-base) { 4 | animation-duration: @duration; 5 | animation-fill-mode: both; 6 | } 7 | 8 | .motion-common-leave(@duration: @animation-duration-base) { 9 | animation-duration: @duration; 10 | animation-fill-mode: both; 11 | } 12 | 13 | .make-motion(@className, @keyframeName, @duration: @animation-duration-base) { 14 | .@{className}-enter, 15 | .@{className}-appear { 16 | .motion-common(@duration); 17 | animation-play-state: paused; 18 | } 19 | .@{className}-leave { 20 | .motion-common-leave(@duration); 21 | animation-play-state: paused; 22 | } 23 | .@{className}-enter.@{className}-enter-active, 24 | .@{className}-appear.@{className}-appear-active { 25 | animation-name: ~"@{keyframeName}In"; 26 | animation-play-state: running; 27 | } 28 | .@{className}-leave.@{className}-leave-active { 29 | animation-name: ~"@{keyframeName}Out"; 30 | animation-play-state: running; 31 | pointer-events: none; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/style/mixins/opacity.less: -------------------------------------------------------------------------------- 1 | // Opacity 2 | 3 | .opacity(@opacity) { 4 | opacity: @opacity; 5 | // IE8 filter 6 | // @opacity-ie: (@opacity * 100); 7 | // filter: ~"alpha(opacity=@{opacity-ie})"; 8 | } 9 | -------------------------------------------------------------------------------- /lib/style/mixins/size.less: -------------------------------------------------------------------------------- 1 | // Sizing shortcuts 2 | 3 | .size(@width; @height) { 4 | width: @width; 5 | height: @height; 6 | } 7 | 8 | .square(@size) { 9 | .size(@size; @size); 10 | } 11 | -------------------------------------------------------------------------------- /lib/style/themes/default.less: -------------------------------------------------------------------------------- 1 | /* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */ 2 | @import "../color/colors"; 3 | 4 | // The prefix to use on all css classes from ant. 5 | @ant-prefix : ant; 6 | 7 | // -------- Colors ----------- 8 | @primary-color : @blue-6; 9 | @info-color : @blue-6; 10 | @success-color : @green-6; 11 | @error-color : @red-6; 12 | @highlight-color : @red-6; 13 | @warning-color : @yellow-6; 14 | @normal-color : #d9d9d9; 15 | 16 | // Color used by default to control hover and active backgrounds and for 17 | // alert info backgrounds. 18 | @primary-1: color(~`colorPalette("@{primary-color}", 1)`); // replace tint(@primary-color, 90%) 19 | @primary-2: color(~`colorPalette("@{primary-color}", 2)`); // replace tint(@primary-color, 80%) 20 | @primary-3: color(~`colorPalette("@{primary-color}", 3)`); // unused 21 | @primary-4: color(~`colorPalette("@{primary-color}", 4)`); // unused 22 | @primary-5: color(~`colorPalette("@{primary-color}", 5)`); // color used to control the text color in many active and hover states, replace tint(@primary-color, 20%) 23 | @primary-6: @primary-color; // color used to control the text color of active buttons, don't use, use @primary-color 24 | @primary-7: color(~`colorPalette("@{primary-color}", 7)`); // replace shade(@primary-color, 5%) 25 | @primary-8: color(~`colorPalette("@{primary-color}", 8)`); // unused 26 | @primary-9: color(~`colorPalette("@{primary-color}", 9)`); // unused 27 | @primary-10: color(~`colorPalette("@{primary-color}", 10)`); // unused 28 | 29 | // Base Scaffolding Variables 30 | // --- 31 | 32 | // Background color for `` 33 | @body-background : #fff; 34 | // Base background color for most components 35 | @component-background : #fff; 36 | @font-family-no-number : -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; 37 | @font-family : "Helvetica Neue For Number", @font-family-no-number; 38 | @code-family : Consolas, Menlo, Courier, monospace; 39 | @heading-color : fade(#000, 85%); 40 | @text-color : fade(#000, 65%); 41 | @text-color-secondary : fade(#000, 43%); 42 | @heading-color-dark : fade(#fff, 97%); 43 | @text-color-dark : fade(#fff, 91%); 44 | @text-color-secondary-dark: fade(#fff, 67%); 45 | @font-size-base : 12px; 46 | @font-size-lg : @font-size-base + 2px; 47 | @line-height-base : 1.5; 48 | @border-radius-base : 4px; 49 | @border-radius-sm : 2px; 50 | 51 | // The background colors for active and hover states for things like 52 | // list items or table cells. 53 | @item-active-bg : @primary-1; 54 | @item-hover-bg : @primary-1; 55 | 56 | // ICONFONT 57 | @iconfont-css-prefix : anticon; 58 | @icon-url : "https://at.alicdn.com/t/font_zck90zmlh7hf47vi"; 59 | 60 | // LINK 61 | @link-color : @primary-color; 62 | @link-hover-color : @primary-5; 63 | @link-active-color : @primary-7; 64 | @link-decoration : none; 65 | @link-hover-decoration : none; 66 | 67 | // Animation 68 | @ease-out : cubic-bezier(0.215, 0.61, 0.355, 1); 69 | @ease-in : cubic-bezier(0.55, 0.055, 0.675, 0.19); 70 | @ease-in-out : cubic-bezier(0.645, 0.045, 0.355, 1); 71 | @ease-out-back : cubic-bezier(0.12, 0.4, 0.29, 1.46); 72 | @ease-in-back : cubic-bezier(0.71, -0.46, 0.88, 0.6); 73 | @ease-in-out-back : cubic-bezier(0.71, -0.46, 0.29, 1.46); 74 | @ease-out-circ : cubic-bezier(0.08, 0.82, 0.17, 1); 75 | @ease-in-circ : cubic-bezier(0.6, 0.04, 0.98, 0.34); 76 | @ease-in-out-circ : cubic-bezier(0.78, 0.14, 0.15, 0.86); 77 | @ease-out-quint : cubic-bezier(0.23, 1, 0.32, 1); 78 | @ease-in-quint : cubic-bezier(0.755, 0.05, 0.855, 0.06); 79 | @ease-in-out-quint : cubic-bezier(0.86, 0, 0.07, 1); 80 | 81 | // Border color 82 | @border-color-base : #d9d9d9; // base border outline a component 83 | @border-color-split : #e9e9e9; // split border inside a component 84 | @border-width-base : 1px; // width of the border for a component 85 | @border-style-base : solid; // style of a components border 86 | 87 | // Outline 88 | @outline-blur-size : 0; 89 | @outline-width : 2px; 90 | @outline-color : @primary-color; 91 | 92 | // Default background color for disabled states, Collapse wrappers, 93 | // and several active and hover states. 94 | @background-color-base : #f7f7f7; 95 | @background-color-active: #eee; 96 | 97 | // Disabled states 98 | @disabled-color : fade(#000, 25%); 99 | @disabled-bg : @background-color-base; 100 | @disabled-color-dark : fade(#fff, 35%); 101 | 102 | // Shadow 103 | @shadow-color : rgba(0, 0, 0, .2); 104 | @box-shadow-base : @shadow-1-down; 105 | @shadow-1-up : 0 -1px 6px @shadow-color; 106 | @shadow-1-down : 0 1px 6px @shadow-color; 107 | @shadow-1-left : -1px 0 6px @shadow-color; 108 | @shadow-1-right : 1px 0 6px @shadow-color; 109 | @shadow-2 : 0 2px 8px @shadow-color; 110 | 111 | // Buttons 112 | @btn-font-weight : 500; 113 | @btn-border-radius-base : @border-radius-base; 114 | @btn-border-radius-sm : @border-radius-base; 115 | 116 | @btn-primary-color : #fff; 117 | @btn-primary-bg : @primary-color; 118 | 119 | @btn-default-color : @text-color; 120 | @btn-default-bg : #fff; 121 | @btn-default-border : @border-color-base; 122 | 123 | @btn-danger-color : @error-color; 124 | @btn-danger-bg : @background-color-base; 125 | @btn-danger-border : @border-color-base; 126 | 127 | @btn-disable-color : @disabled-color; 128 | @btn-disable-bg : @disabled-bg; 129 | @btn-disable-border : @border-color-base; 130 | 131 | @btn-padding-base : 0 15px; 132 | @btn-font-size-lg : @font-size-lg; 133 | @btn-padding-lg : @btn-padding-base; 134 | @btn-padding-sm : 0 7px; 135 | 136 | @btn-height-base : 28px; 137 | @btn-height-lg : 32px; 138 | @btn-height-sm : 22px; 139 | 140 | @btn-circle-size : @btn-height-base; 141 | @btn-circle-size-lg : @btn-height-lg; 142 | @btn-circle-size-sm : @btn-height-sm; 143 | 144 | @btn-group-border : @primary-7; 145 | 146 | // Checkbox 147 | @checkbox-size : 14px; 148 | 149 | // Radio buttons 150 | @radio-button-bg : @btn-default-bg; 151 | @radio-button-color : @btn-default-color; 152 | 153 | // Media queries breakpoints 154 | // Extra small screen / phone 155 | @screen-xs : 480px; 156 | @screen-xs-min : @screen-xs; 157 | 158 | // Small screen / tablet 159 | @screen-sm : 768px; 160 | @screen-sm-min : @screen-sm; 161 | 162 | // Medium screen / desktop 163 | @screen-md : 992px; 164 | @screen-md-min : @screen-md; 165 | 166 | // Large screen / wide desktop 167 | @screen-lg : 1200px; 168 | @screen-lg-min : @screen-lg; 169 | 170 | // Extra Large screen / full hd 171 | @screen-xl : 1600px; 172 | @screen-xl-min : @screen-xl; 173 | 174 | // provide a maximum 175 | @screen-xs-max : (@screen-sm-min - 1px); 176 | @screen-sm-max : (@screen-md-min - 1px); 177 | @screen-md-max : (@screen-lg-min - 1px); 178 | @screen-lg-max : (@screen-xl-min - 1px); 179 | 180 | // Grid system 181 | @grid-columns : 24; 182 | @grid-gutter-width : 0; 183 | 184 | // Layout 185 | @layout-body-background : #ececec; 186 | @layout-header-background : #404040; 187 | @layout-footer-background : @layout-body-background; 188 | @layout-header-height : 64px; 189 | @layout-header-padding : 0 50px; 190 | @layout-footer-padding : 24px 50px; 191 | @layout-sider-background : @layout-header-background; 192 | @layout-trigger-height : 48px; 193 | @layout-trigger-background : tint(@heading-color, 20%); 194 | @layout-trigger-color : #fff; 195 | @layout-zero-trigger-width : 36px; 196 | @layout-zero-trigger-height : 42px; 197 | 198 | // z-index list 199 | @zindex-affix : 10; 200 | @zindex-back-top : 10; 201 | @zindex-modal-mask : 1000; 202 | @zindex-modal : 1000; 203 | @zindex-notification : 1010; 204 | @zindex-message : 1010; 205 | @zindex-popover : 1030; 206 | @zindex-picker : 1050; 207 | @zindex-dropdown : 1050; 208 | @zindex-tooltip : 1060; 209 | 210 | // Animation 211 | @animation-duration-slow: .3s; // Modal 212 | @animation-duration-base: .2s; 213 | @animation-duration-fast: .1s; // Tooltip 214 | 215 | // Form 216 | // --- 217 | @label-required-color : @highlight-color; 218 | @label-color : @heading-color; 219 | @form-item-margin-bottom : 24px; 220 | @form-item-trailing-colon : true; 221 | @form-vertical-label-padding : 0 0 8px; 222 | @form-vertical-label-margin : 0; 223 | 224 | // Input 225 | // --- 226 | @input-height-base : 28px; 227 | @input-height-lg : 32px; 228 | @input-height-sm : 22px; 229 | @input-padding-horizontal : 7px; 230 | @input-padding-horizontal-base : @input-padding-horizontal; 231 | @input-padding-horizontal-sm : @input-padding-horizontal; 232 | @input-padding-horizontal-lg : @input-padding-horizontal; 233 | @input-padding-vertical-base : 4px; 234 | @input-padding-vertical-sm : 1px; 235 | @input-padding-vertical-lg : 6px; 236 | @input-placeholder-color : hsv(0, 0, 75%); 237 | @input-color : @text-color; 238 | @input-border-color : @border-color-base; 239 | @input-bg : #fff; 240 | @input-addon-bg : #eee; 241 | @input-hover-border-color : @primary-color; 242 | @input-disabled-bg : @disabled-bg; 243 | 244 | // Tooltip 245 | // --- 246 | //* Tooltip max width 247 | @tooltip-max-width: 250px; 248 | //** Tooltip text color 249 | @tooltip-color: #fff; 250 | //** Tooltip background color 251 | @tooltip-bg: rgba(0, 0, 0, .75); 252 | //** Tooltip arrow width 253 | @tooltip-arrow-width: 5px; 254 | //** Tooltip distance with trigger 255 | @tooltip-distance: @tooltip-arrow-width - 1px + 4px; 256 | //** Tooltip arrow color 257 | @tooltip-arrow-color: @tooltip-bg; 258 | 259 | // Popover 260 | // --- 261 | //** Popover body background color 262 | @popover-bg: #fff; 263 | //** Popover text color 264 | @popover-color: @text-color; 265 | //** Popover maximum width 266 | @popover-min-width: 177px; 267 | //** Popover arrow width 268 | @popover-arrow-width: 4px; 269 | //** Popover arrow color 270 | @popover-arrow-color: @popover-bg; 271 | //** Popover outer arrow width 272 | @popover-arrow-outer-width: (@popover-arrow-width + 1px); 273 | //** Popover outer arrow color 274 | @popover-arrow-outer-color: fadeout(@border-color-base, 30%); 275 | //** Popover distance with trigger 276 | @popover-distance: @popover-arrow-width + 4px; 277 | 278 | // Modal 279 | // -- 280 | @modal-mask-bg: rgba(55, 55, 55, 0.6); 281 | 282 | // Progress 283 | // -- 284 | @progress-default-color: @primary-color; 285 | @progress-remaining-color: @background-color-base; 286 | 287 | // Menu 288 | // --- 289 | @menu-dark-bg: @layout-header-background; 290 | @menu-dark-submenu-bg: #333; 291 | @menu-collapsed-width: 64px; 292 | 293 | // Spin 294 | // --- 295 | @spin-dot-size-sm: 14px; 296 | @spin-dot-size: 20px; 297 | @spin-dot-size-lg: 32px; 298 | 299 | // Table 300 | // -- 301 | @table-header-bg: @background-color-base; 302 | @table-header-sort-bg: @background-color-active; 303 | @table-row-hover-bg: @primary-1; 304 | @table-selected-row-bg: #fafafa; 305 | @table-padding-vertical: 16px; 306 | @table-padding-horizontal: 8px; 307 | 308 | // Tag 309 | // -- 310 | @tag-default-bg: #f3f3f3; 311 | @tag-default-color: @text-color; 312 | @tag-font-size: @font-size-base; 313 | 314 | // TimePicker 315 | // --- 316 | @time-picker-panel-column-width: 56px; 317 | @time-picker-panel-width: @time-picker-panel-column-width * 3; 318 | @time-picker-selected-bg: @background-color-base; 319 | 320 | // Carousel 321 | // --- 322 | @carousel-dot-width: 16px; 323 | @carousel-dot-height: 3px; 324 | @carousel-dot-active-width: 24px; 325 | 326 | // Badge 327 | // --- 328 | @badge-height: 20px; 329 | @badge-dot-size: 8px; 330 | @badge-font-size: @font-size-base; 331 | 332 | // Rate 333 | // --- 334 | @rate-star-color: #f5a623; 335 | @rate-star-bg: #e9e9e9; 336 | 337 | // Card 338 | // --- 339 | @card-head-height: 48px; 340 | @card-head-color: @heading-color; 341 | @card-head-background: @component-background; 342 | 343 | // Tabs 344 | // --- 345 | @tabs-card-head-background: #f9f9f9; 346 | @tabs-title-font-size: @font-size-lg; 347 | 348 | // BackTop 349 | @back-top-color: #fff; 350 | @back-top-bg: rgba(64, 64, 64, 0.4); 351 | @back-top-hover-bg: rgba(64, 64, 64, 0.6); 352 | 353 | // Avatar 354 | @avatar-size-base: 32px; 355 | @avatar-size-lg: 40px; 356 | @avatar-size-sm: 24px; 357 | @avatar-font-size-base: 18px; 358 | @avatar-font-size-lg: 24px; 359 | @avatar-font-size-sm: 14px; 360 | @avatar-bg: #ccc; 361 | @avatar-color: #fff; 362 | @avatar-border-radius: @border-radius-base; 363 | -------------------------------------------------------------------------------- /lib/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "../dist", 4 | "target": "es5", 5 | "module": "es2015", 6 | "moduleResolution": "node", 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "sourceMap": true, 10 | "inlineSources": true, 11 | "noImplicitAny": true, 12 | "declaration": true, 13 | "skipLibCheck": false, 14 | "stripInternal": true, 15 | "allowSyntheticDefaultImports": true, 16 | "noUnusedLocals": false, 17 | "noUnusedParameters": false, 18 | "lib": ["dom", "es6"], 19 | "types": [ 20 | "jasmine" 21 | ], 22 | "typeRoots": [ 23 | "../node_modules/@types" 24 | ] 25 | }, 26 | "exclude": [ 27 | "node_modules" 28 | ], 29 | "files": [ 30 | "../scripts/typings.d.ts", 31 | "./index.ts" 32 | ], 33 | "angularCompilerOptions": { 34 | "genDir": "../temp/factories", 35 | "strictMetadataEmit": true, 36 | "skipTemplateCodegen": true 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "../dist/out-tsc", 5 | "baseUrl": ".", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "sourceMap": true, 9 | "declaration": false, 10 | "moduleResolution": "node", 11 | "emitDecoratorMetadata": true, 12 | "experimentalDecorators": true, 13 | "typeRoots": [ 14 | "../node_modules/@types" 15 | ], 16 | "types": [ 17 | "jasmine", 18 | "webpack" 19 | ], 20 | "lib": [ 21 | "es2016", 22 | "dom" 23 | ] 24 | }, 25 | "include": [ 26 | "../scripts/typings.d.ts", 27 | "../scripts/test.ts", 28 | "**/*.ts", 29 | "**/*.d.ts" 30 | ], 31 | "exclude": [ 32 | "../demo", 33 | "../node_modules" 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ng-tree-antd", 3 | "version": "2.2.3", 4 | "license": "MIT", 5 | "description": "Angular for tinymce", 6 | "main": "./bundles/ng-tree-antd.umd.js", 7 | "author": "cipchk", 8 | "homepage": "https://cipchk.github.io/ng-tree-antd/", 9 | "bugs": { 10 | "url": "https://github.com/cipchk/ng-tree-antd/issues" 11 | }, 12 | "keywords": [ 13 | "ng-tree-antd", 14 | "angular-tree", 15 | "angular4-tree", 16 | "ng2-tree", 17 | "ng4-tree", 18 | "ng-antd-tree", 19 | "antd-tree", 20 | "tree" 21 | ], 22 | "scripts": { 23 | "ng": "ng", 24 | "start": "ng serve", 25 | "build": "ng build", 26 | "test": "ng test -sr -sm=false", 27 | "test-coverage": "ng test -sr -cc -sm=false", 28 | "lint": "ng lint", 29 | "e2e": "ng e2e", 30 | "demo.gh-pages": "ng build --prod --build-optimizer && gh-pages -d dist", 31 | "clean:tmp": "rimraf .ng_build .ng_compiled", 32 | "clean:tmp:lib": "npm run clean:tmp && rimraf .lib", 33 | "build:copy-sources": "gulp copy-sources", 34 | "build:inline-resources": "gulp inline-resources", 35 | "build:ts": "tsc -p tsconfig.publish.json && ngc -p tsconfig.publish.json", 36 | "build:bundle": "gulp bundle", 37 | "build:package": "npm-run-all -s clean:tmp:lib build:copy-sources build:ts build:inline-resources build:bundle clean:tmp", 38 | "version:bump": "gulp bump", 39 | "release:prepare": "npm run build:package", 40 | "release:validity": "npm run version:bump && npm run release:prepare", 41 | "release": "npm run version:bump && npm run release:prepare && npm publish --access=public .lib" 42 | }, 43 | "peerDependencies": { 44 | "ng-zorro-antd": ">=0.5.x", 45 | "angular-tree-component": "^7.0.1", 46 | "@angular/common": ">=4.3.x || >5.x", 47 | "@angular/core": ">=4.3.x || >5.x", 48 | "@angular/compiler": ">=4.3.x || >5.x", 49 | "typescript": ">=2.3.x" 50 | }, 51 | "dependencies": { 52 | "@angular/animations": "^5.0.0", 53 | "@angular/common": "^5.0.0", 54 | "@angular/compiler": "^5.0.0", 55 | "@angular/core": "^5.0.0", 56 | "@angular/forms": "^5.0.0", 57 | "@angular/http": "^5.0.0", 58 | "@angular/platform-browser": "^5.0.0", 59 | "@angular/platform-browser-dynamic": "^5.0.0", 60 | "@angular/router": "^5.0.0", 61 | "core-js": "^2.4.1", 62 | "ngx-highlight-js": "^1.0.3", 63 | "rxjs": "^5.5.2", 64 | "zone.js": "^0.8.14" 65 | }, 66 | "devDependencies": { 67 | "@angular/cli": "^1.6.0", 68 | "@angular/compiler-cli": "^5.0.0", 69 | "@angular/language-service": "^5.0.0", 70 | "@types/jasmine": "~2.5.53", 71 | "@types/jasminewd2": "~2.0.2", 72 | "@types/node": "~6.0.60", 73 | "angular-tree-component": "^7.0.1", 74 | "codelyzer": "^4.0.1", 75 | "gulp": "^3.9.1", 76 | "gulp-bump": "^2.8.0", 77 | "gulp-clean": "^0.3.2", 78 | "gulp-clean-css": "^3.2.0", 79 | "gulp-cli": "^1.3.0", 80 | "gulp-connect": "^5.0.0", 81 | "gulp-dom": "^0.9.17", 82 | "gulp-flatten": "^0.3.1", 83 | "gulp-if": "^2.0.2", 84 | "gulp-less": "^3.3.2", 85 | "gulp-markdown": "^1.2.0", 86 | "gulp-rename": "^1.2.2", 87 | "gulp-replace": "^0.6.0", 88 | "gulp-rollup": "^2.15.0", 89 | "gulp-transform": "^1.1.0", 90 | "jasmine-core": "~2.6.2", 91 | "jasmine-spec-reporter": "~4.1.0", 92 | "karma": "~1.7.0", 93 | "karma-chrome-launcher": "~2.1.1", 94 | "karma-cli": "~1.0.1", 95 | "karma-coverage-istanbul-reporter": "^1.2.1", 96 | "karma-jasmine": "~1.1.0", 97 | "karma-jasmine-html-reporter": "^0.2.2", 98 | "ng-zorro-antd": "^0.6.9", 99 | "protractor": "~5.1.2", 100 | "rollup-plugin-node-resolve": "^3.0.0", 101 | "rollup-plugin-replace": "^2.0.0", 102 | "ts-node": "~3.2.0", 103 | "tslint": "~5.7.0", 104 | "typescript": "~2.4.2" 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | const resolve = require('rollup-plugin-node-resolve'); 2 | const replace = require('rollup-plugin-replace'); 3 | 4 | const globals = { 5 | '@angular/core': 'ng.core', 6 | '@angular/common': 'ng.common', 7 | '@angular/platform-browser': 'ng.platformBrowser', 8 | 9 | 'angular-tree-component': 'angular-tree-component' 10 | }; 11 | 12 | module.exports = { 13 | sourcemap: true, 14 | rollup: require('rollup'), 15 | context: 'this', 16 | name: 'ng-tree-antd', 17 | output: 'ng-tree-antd.umd.js', 18 | format: 'umd', 19 | plugins: [ 20 | resolve({ 21 | jsnext: true, 22 | main: true 23 | }) 24 | ], 25 | external: Object.keys(globals), 26 | globals: globals 27 | }; 28 | -------------------------------------------------------------------------------- /scripts/inline-resources.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const fs = require('fs'); 6 | const path = require('path'); 7 | const glob = require('glob'); 8 | 9 | /** 10 | * Simple Promiseify function that takes a Node API and return a version that supports promises. 11 | * We use promises instead of synchronized functions to make the process less I/O bound and 12 | * faster. It also simplify the code. 13 | */ 14 | function promiseify(fn) { 15 | return function () { 16 | const args = [].slice.call(arguments, 0); 17 | return new Promise((resolve, reject) => { 18 | fn.apply(this, args.concat([function (err, value) { 19 | if (err) { 20 | reject(err); 21 | } else { 22 | resolve(value); 23 | } 24 | }])); 25 | }); 26 | }; 27 | } 28 | 29 | const readFile = promiseify(fs.readFile); 30 | const writeFile = promiseify(fs.writeFile); 31 | 32 | 33 | function inlineResources(globs) { 34 | if (typeof globs == 'string') { 35 | globs = [globs]; 36 | } 37 | 38 | /** 39 | * For every argument, inline the templates and styles under it and write the new file. 40 | */ 41 | return Promise.all(globs.map(pattern => { 42 | if (pattern.indexOf('*') < 0) { 43 | // Argument is a directory target, add glob patterns to include every files. 44 | pattern = path.join(pattern, '**', '*'); 45 | } 46 | 47 | const files = glob.sync(pattern, {}) 48 | .filter(name => /\.js$/.test(name)); // Matches only JavaScript files. 49 | 50 | // Generate all files content with inlined templates. 51 | return Promise.all(files.map(filePath => { 52 | return readFile(filePath, 'utf-8') 53 | .then(content => inlineResourcesFromString(content, url => { 54 | return path.join(path.dirname(filePath), url); 55 | })) 56 | .then(content => writeFile(filePath, content)) 57 | .catch(err => { 58 | console.error('An error occurred: ', err); 59 | }); 60 | })); 61 | })); 62 | } 63 | 64 | /** 65 | * Inline resources from a string content. 66 | * @param content {string} The source file's content. 67 | * @param urlResolver {Function} A resolver that takes a URL and return a path. 68 | * @returns {string} The content with resources inlined. 69 | */ 70 | function inlineResourcesFromString(content, urlResolver) { 71 | // Curry through the inlining functions. 72 | return [ 73 | inlineTemplate, 74 | inlineStyle, 75 | removeModuleId 76 | ].reduce((content, fn) => fn(content, urlResolver), content); 77 | } 78 | 79 | if (require.main === module) { 80 | inlineResources(process.argv.slice(2)); 81 | } 82 | 83 | 84 | /** 85 | * Inline the templates for a source file. Simply search for instances of `templateUrl: ...` and 86 | * replace with `template: ...` (with the content of the file included). 87 | * @param content {string} The source file's content. 88 | * @param urlResolver {Function} A resolver that takes a URL and return a path. 89 | * @return {string} The content with all templates inlined. 90 | */ 91 | function inlineTemplate(content, urlResolver) { 92 | return content.replace(/templateUrl:\s*'([^']+?\.html)'/g, function (m, templateUrl) { 93 | const templateFile = urlResolver(templateUrl); 94 | const templateContent = fs.readFileSync(templateFile, 'utf-8'); 95 | const shortenedTemplate = templateContent 96 | .replace(/([\n\r]\s*)+/gm, ' ') 97 | .replace(/"/g, '\\"'); 98 | return `template: "${shortenedTemplate}"`; 99 | }); 100 | } 101 | 102 | 103 | /** 104 | * Inline the styles for a source file. Simply search for instances of `styleUrls: [...]` and 105 | * replace with `styles: [...]` (with the content of the file included). 106 | * @param urlResolver {Function} A resolver that takes a URL and return a path. 107 | * @param content {string} The source file's content. 108 | * @return {string} The content with all styles inlined. 109 | */ 110 | function inlineStyle(content, urlResolver) { 111 | return content.replace(/styleUrls:\s*(\[[\s\S]*?\])/gm, function (m, styleUrls) { 112 | const urls = eval(styleUrls); 113 | return 'styles: [' + 114 | urls.map(styleUrl => { 115 | const styleFile = urlResolver(styleUrl); 116 | const styleContent = fs.readFileSync(styleFile, 'utf-8'); 117 | const shortenedStyle = styleContent 118 | .replace(/([\n\r]\s*)+/gm, ' ') 119 | .replace(/content: "([^"]+)"/g, 'content: "\\$1"') 120 | .replace(/"/g, '\\"'); 121 | return `"${shortenedStyle}"`; 122 | }) 123 | .join(',\n') + 124 | ']'; 125 | }); 126 | } 127 | 128 | 129 | /** 130 | * Remove every mention of `moduleId: module.id`. 131 | * @param content {string} The source file's content. 132 | * @returns {string} The content with all moduleId: mentions removed. 133 | */ 134 | function removeModuleId(content) { 135 | return content.replace(/\s*moduleId:\s*module\.id\s*,?\s*/gm, ''); 136 | } 137 | 138 | 139 | module.exports = inlineResources; 140 | module.exports.inlineResourcesFromString = inlineResourcesFromString; 141 | -------------------------------------------------------------------------------- /scripts/typings.d.ts: -------------------------------------------------------------------------------- 1 | // Typings reference file, you can add your own global typings here 2 | // https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html 3 | // tslint:disable 4 | declare const System: any; 5 | declare const ENV: string; 6 | // google code-prettify 7 | declare const PR: any; 8 | 9 | declare module jasmine { 10 | interface Matchers { 11 | toHaveCssClass(expected: any): boolean; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ViewEncapsulation } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | template: ` 6 | ng-tree-antd 7 | A antd style of based on angular-tree-component, README.md. 8 | 9 | 10 | 11 | ` 12 | }) 13 | export class AppComponent { 14 | } 15 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { HttpModule } from '@angular/http'; 2 | import { NgModule, Input } from '@angular/core'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { Routes, RouterModule } from '@angular/router'; 5 | import { BrowserModule } from '@angular/platform-browser'; 6 | import { CommonModule } from '@angular/common'; 7 | 8 | import { NgZorroAntdModule } from 'ng-zorro-antd'; 9 | 10 | import { NzTreeModule } from '../../lib'; 11 | 12 | import { AppComponent } from './app.component'; 13 | import { DemoBasicComponent } from './demo/basic.component'; 14 | import { DemoAsyncComponent } from './demo/async.component'; 15 | import { HomeComponent } from './demo/home.component'; 16 | import { DemoDraggableComponent } from './demo/draggable.component'; 17 | import { DemoSearchableComponent } from './demo/searchable.component'; 18 | import { DemoLineComponent } from './demo/line.component'; 19 | import { DemoCustomComponent } from './demo/custom.component'; 20 | import { DemoLinkageComponent } from './demo/linkage.component'; 21 | 22 | @NgModule({ 23 | imports: [ 24 | BrowserModule, 25 | FormsModule, 26 | HttpModule, 27 | CommonModule, 28 | 29 | NzTreeModule, 30 | NgZorroAntdModule.forRoot() 31 | ], 32 | declarations: [ 33 | AppComponent, 34 | HomeComponent, 35 | DemoBasicComponent, 36 | DemoAsyncComponent, 37 | DemoDraggableComponent, 38 | DemoSearchableComponent, 39 | DemoLineComponent, 40 | DemoCustomComponent, 41 | DemoLinkageComponent 42 | ], 43 | providers: [ ], 44 | bootstrap: [AppComponent] 45 | }) 46 | 47 | export class AppModule { 48 | } 49 | -------------------------------------------------------------------------------- /src/app/demo/async.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'demo-async', 5 | template: ` 6 | Async 7 | 11 | ` 12 | }) 13 | export class DemoAsyncComponent { 14 | nodes = [ 15 | { 16 | name: 'root1', 17 | hasChildren: true 18 | }, 19 | { 20 | name: 'root2', 21 | hasChildren: true 22 | }, 23 | { 24 | name: 'root3', 25 | hasChildren: true 26 | }, 27 | { 28 | name: 'root4', 29 | hasChildren: true 30 | } 31 | ]; 32 | 33 | options = { 34 | getChildren: (node: any) => { 35 | return new Promise((resolve, reject) => { 36 | setTimeout(() => resolve([ 37 | { name: 'async data1' }, 38 | { name: 'async data2', hasChildren: true } 39 | ]), 1000); 40 | }); 41 | } 42 | }; 43 | 44 | onEvent(ev: any) { 45 | console.log('async', 'onEvent', ev); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/app/demo/basic.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { generateData } from './generate-data'; 3 | 4 | @Component({ 5 | selector: 'demo-basic', 6 | template: ` 7 | basic 8 | 11 | ` 12 | }) 13 | export class DemoBasicComponent { 14 | nodes = []; 15 | 16 | ngOnInit() { 17 | generateData(this.nodes, 3, 2, 1); 18 | } 19 | 20 | onEvent(ev: any) { 21 | console.log('basic', 'onEvent', ev); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/app/demo/custom.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { generateData } from './generate-data'; 3 | 4 | @Component({ 5 | selector: 'demo-custom', 6 | template: ` 7 | custom 8 | 11 | 12 | {{node.displayField}} 13 | 14 | 15 | ` 16 | }) 17 | export class DemoCustomComponent implements OnInit { 18 | nodes = []; 19 | 20 | ngOnInit() { 21 | generateData(this.nodes, 3, 2, 1); 22 | this.nodes[0].children[2].checked = true; 23 | this.nodes[1].children[0].checked = true; 24 | this.nodes[2].checked = true; 25 | } 26 | 27 | onEvent(ev: any) { 28 | console.log('basic', 'onEvent', ev); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/app/demo/draggable.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { generateData } from './generate-data'; 3 | 4 | @Component({ 5 | selector: 'demo-draggable', 6 | template: ` 7 | draggable 8 | 11 | ` 12 | }) 13 | export class DemoDraggableComponent { 14 | nodes = []; 15 | 16 | options = { 17 | allowDrag: true 18 | }; 19 | 20 | ngOnInit() { 21 | generateData(this.nodes, 3, 2, 1); 22 | } 23 | 24 | onEvent(ev: any) { 25 | console.log('basic', 'onEvent', ev); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/app/demo/generate-data.ts: -------------------------------------------------------------------------------- 1 | export function generateData(nodes, _x, _y, _z, _preKey?: any, _tns?: any) { 2 | const preKey = _preKey || '0'; 3 | const tns = _tns || nodes; 4 | 5 | const children = []; 6 | for (let i = 0; i < _x; i++) { 7 | const key = `${preKey}-${i}`; 8 | tns.push({ name: key, id: key, disableCheckbox: i === 1 }); 9 | if (i < _y) { 10 | children.push(key); 11 | } 12 | } 13 | if (_z < 0) { 14 | return tns; 15 | } 16 | const level = _z - 1; 17 | children.forEach((key, index) => { 18 | tns[index].children = []; 19 | return generateData(nodes, _x, _y, level, key, tns[index].children); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /src/app/demo/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-home', 5 | template: ` 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ` 16 | }) 17 | export class HomeComponent { 18 | } 19 | -------------------------------------------------------------------------------- /src/app/demo/line.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { generateData } from './generate-data'; 3 | 4 | @Component({ 5 | selector: 'demo-line', 6 | template: ` 7 | Line 8 | 11 | ` 12 | }) 13 | export class DemoLineComponent { 14 | nodes = []; 15 | 16 | ngOnInit() { 17 | generateData(this.nodes, 3, 2, 1); 18 | } 19 | 20 | onEvent(ev: any) { 21 | console.log('line', 'onEvent', ev); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/app/demo/linkage.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { generateData } from './generate-data'; 3 | 4 | @Component({ 5 | selector: 'demo-linkage', 6 | template: ` 7 | Linkage 8 | 13 | ` 14 | }) 15 | export class DemoLinkageComponent { 16 | nodes = []; 17 | 18 | ngOnInit() { 19 | generateData(this.nodes, 3, 2, 1); 20 | } 21 | 22 | onEvent(ev: any) { 23 | console.log('DemoLinkageComponent', 'onEvent', ev); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/app/demo/searchable.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ViewChild } from '@angular/core'; 2 | import { generateData } from './generate-data'; 3 | import { NzTreeComponent } from '../../../lib'; 4 | 5 | @Component({ 6 | selector: 'demo-searchable', 7 | template: ` 8 | Searchable 9 | 10 | 14 | ` 15 | }) 16 | export class DemoSearchableComponent { 17 | q: string = ''; 18 | 19 | nodes = []; 20 | 21 | options = { 22 | allowDrag: false 23 | }; 24 | 25 | @ViewChild(NzTreeComponent) tree: NzTreeComponent; 26 | filterNodes() { 27 | this.tree.treeModel.filterNodes(this.q); 28 | if (!this.q) this.tree.treeModel.collapseAll(); 29 | } 30 | 31 | ngOnInit() { 32 | generateData(this.nodes, 3, 2, 1); 33 | } 34 | 35 | onEvent(ev: any) { 36 | console.log('basic', 'onEvent', ev); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ng-tree-antd/5d6975def37df5943f69773a6349fc66880bbc0a/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/assets/fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ng-tree-antd/5d6975def37df5943f69773a6349fc66880bbc0a/src/assets/fork.png -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ng-tree-antd/5d6975def37df5943f69773a6349fc66880bbc0a/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ng-tree-antd | A antd style of based on angular-tree-component. 7 | 8 | 9 | 10 | 15 | 16 | 17 | 18 | 19 | Loading... 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 38 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 39 | 40 | /** IE10 and IE11 requires the following for the Reflect API. */ 41 | // import 'core-js/es6/reflect'; 42 | 43 | 44 | /** Evergreen browsers require these. **/ 45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. 46 | import 'core-js/es7/reflect'; 47 | 48 | 49 | /** 50 | * Required to support Web Animations `@angular/platform-browser/animations`. 51 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation 52 | **/ 53 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 54 | 55 | 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js/dist/zone'; // Included with Angular CLI. 61 | 62 | 63 | 64 | /*************************************************************************************************** 65 | * APPLICATION IMPORTS 66 | */ 67 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('../lib/', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts" 15 | ], 16 | "include": [ 17 | "../lib/**/*.spec.ts", 18 | "**/*.spec.ts", 19 | "**/*.d.ts" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tsconfig.publish.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "emitDecoratorMetadata": true, 5 | "experimentalDecorators": true, 6 | "lib": [ 7 | "es7", 8 | "dom" 9 | ], 10 | "module": "es2015", 11 | "moduleResolution": "node", 12 | "noEmitOnError": true, 13 | "outDir": "./.lib", 14 | "rootDir": "./.ng_build", 15 | "sourceMap": true, 16 | "target": "es5", 17 | "inlineSources": true, 18 | "stripInternal": true, 19 | "baseUrl": ".", 20 | "paths": { 21 | }, 22 | "skipLibCheck": true, 23 | "typeRoots": [ 24 | "node_modules/@types" 25 | ] 26 | }, 27 | "include": [ 28 | "./.ng_build/**/*" 29 | ], 30 | "exclude": [ 31 | "./.ng_build/**/*.e2e.ts", 32 | "./.ng_build/**/*.spec.ts" 33 | ], 34 | "angularCompilerOptions": { 35 | "skipTemplateCodegen": true, 36 | "strictMetadataEmit": true, 37 | "genDir": "./.ng_compiled" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": false, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs", 22 | "rxjs/Rx" 23 | ], 24 | "import-spacing": true, 25 | "indent": [ 26 | true, 27 | "spaces" 28 | ], 29 | "interface-over-type-literal": true, 30 | "label-position": true, 31 | "max-line-length": [ 32 | false, 33 | 140 34 | ], 35 | "member-access": false, 36 | "member-ordering": [ 37 | true, 38 | { 39 | "order": [ 40 | "static-field", 41 | "instance-field", 42 | "static-method", 43 | "instance-method" 44 | ] 45 | } 46 | ], 47 | "no-arg": true, 48 | "no-bitwise": true, 49 | "no-console": [ 50 | true, 51 | "debug", 52 | "info", 53 | "time", 54 | "timeEnd", 55 | "trace" 56 | ], 57 | "no-construct": true, 58 | "no-debugger": true, 59 | "no-duplicate-super": true, 60 | "no-empty": false, 61 | "no-empty-interface": true, 62 | "no-eval": true, 63 | "no-inferrable-types": [ 64 | true, 65 | "ignore-params" 66 | ], 67 | "no-misused-new": true, 68 | "no-non-null-assertion": true, 69 | "no-shadowed-variable": true, 70 | "no-string-literal": false, 71 | "no-string-throw": true, 72 | "no-switch-case-fall-through": true, 73 | "no-trailing-whitespace": true, 74 | "no-unnecessary-initializer": true, 75 | "no-unused-expression": true, 76 | "no-use-before-declare": true, 77 | "no-var-keyword": true, 78 | "object-literal-sort-keys": false, 79 | "one-line": [ 80 | true, 81 | "check-open-brace", 82 | "check-catch", 83 | "check-else", 84 | "check-whitespace" 85 | ], 86 | "prefer-const": true, 87 | "quotemark": [ 88 | true, 89 | "single" 90 | ], 91 | "radix": true, 92 | "semicolon": [ 93 | true, 94 | "always" 95 | ], 96 | "triple-equals": [ 97 | true, 98 | "allow-null-check" 99 | ], 100 | "typedef-whitespace": [ 101 | true, 102 | { 103 | "call-signature": "nospace", 104 | "index-signature": "nospace", 105 | "parameter": "nospace", 106 | "property-declaration": "nospace", 107 | "variable-declaration": "nospace" 108 | } 109 | ], 110 | "typeof-compare": true, 111 | "unified-signatures": true, 112 | "variable-name": false, 113 | "whitespace": [ 114 | true, 115 | "check-branch", 116 | "check-decl", 117 | "check-operator", 118 | "check-separator", 119 | "check-type" 120 | ], 121 | "directive-selector": [ 122 | false, 123 | "attribute", 124 | "app", 125 | "camelCase" 126 | ], 127 | "component-selector": [ 128 | false, 129 | "element", 130 | "app", 131 | "kebab-case" 132 | ], 133 | "no-output-on-prefix": true, 134 | "use-input-property-decorator": true, 135 | "use-output-property-decorator": true, 136 | "use-host-property-decorator": true, 137 | "no-input-rename": true, 138 | "no-output-rename": true, 139 | "use-life-cycle-interface": true, 140 | "use-pipe-transform-interface": true, 141 | "component-class-suffix": true, 142 | "directive-class-suffix": true 143 | } 144 | } 145 | --------------------------------------------------------------------------------
A antd style of based on angular-tree-component, README.md.