├── CHANGELOG.md ├── src ├── assets │ ├── .gitkeep │ └── hljs.min.js ├── app │ ├── app.component.scss │ ├── index.ts │ ├── components │ │ ├── sample-section.component.ts │ │ ├── sample-section.component.html │ │ ├── select-section.ts │ │ └── select │ │ │ ├── single-demo.html │ │ │ ├── multiple-demo.html │ │ │ ├── single-demo.ts │ │ │ └── multiple-demo.ts │ ├── app.component.ts │ ├── app.component.html │ └── app.module.ts ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── ng-multiselect-dropdown │ ├── test │ │ ├── list-filter.pipe.spec.ts │ │ ├── helper.ts │ │ ├── multi-select.component2.spec.ts │ │ ├── multi-select.component1.spec.ts │ │ └── multi-select.component.spec.ts │ └── src │ │ ├── public_api.ts │ │ ├── index.ts │ │ ├── list-filter.pipe.ts │ │ ├── ng-multiselect-dropdown.module.ts │ │ ├── click-outside.directive.ts │ │ ├── multiselect.model.ts │ │ ├── multi-select.component.html │ │ ├── multi-select.component.scss │ │ └── multiselect.component.ts ├── setup-jest.ts ├── typings.d.ts ├── tsconfig.app.json ├── main.ts ├── tsconfig.json ├── tsconfig.spec.json ├── code-viewer │ ├── code-viewer.module.ts │ ├── code-viewer.ts │ └── hljs.min.js ├── jest-global-mocks.ts ├── test.ts ├── index.html ├── polyfills.ts └── styles.scss ├── Screenshots ├── demo.gif ├── ng-multiselect-dropdown.mp4 └── ng-multiselect-dropdown_v0.1.6.gif ├── ng-package.json ├── e2e ├── app.po.ts ├── tsconfig.e2e.json └── app.e2e-spec.ts ├── .editorconfig ├── tsconfig.json ├── publish-package.md ├── protractor.conf.js ├── .gitignore ├── jest.config.js ├── package-lib-template.json ├── karma.conf.js ├── tslint.json ├── package.json ├── angular.json └── README.md /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/index.ts: -------------------------------------------------------------------------------- 1 | export * from './app.component'; 2 | export * from './app.module'; 3 | -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidacm/ng-multiselect-dropdown/master/src/favicon.ico -------------------------------------------------------------------------------- /Screenshots/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidacm/ng-multiselect-dropdown/master/Screenshots/demo.gif -------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/test/list-filter.pipe.spec.ts: -------------------------------------------------------------------------------- 1 | it('sanity test', () => { 2 | expect(1).toBe(1) 3 | }) -------------------------------------------------------------------------------- /src/setup-jest.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular'; 2 | 3 | import './jest-global-mocks'; // browser mocks globally available for every test -------------------------------------------------------------------------------- /src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /Screenshots/ng-multiselect-dropdown.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidacm/ng-multiselect-dropdown/master/Screenshots/ng-multiselect-dropdown.mp4 -------------------------------------------------------------------------------- /Screenshots/ng-multiselect-dropdown_v0.1.6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidacm/ng-multiselect-dropdown/master/Screenshots/ng-multiselect-dropdown_v0.1.6.gif -------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/src/public_api.ts: -------------------------------------------------------------------------------- 1 | export { MultiSelectComponent } from './multiselect.component'; 2 | export { NgMultiSelectDropDownModule } from './ng-multiselect-dropdown.module'; 3 | -------------------------------------------------------------------------------- /ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "dist-lib", 4 | "workingDirectory": ".ng_build", 5 | "lib": { 6 | "entryFile": "src/ng-multiselect-dropdown/src/public_api.ts" 7 | } 8 | } -------------------------------------------------------------------------------- /e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class NgTest2Page { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /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/app/components/sample-section.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'sample-section', 5 | templateUrl: './sample-section.component.html' 6 | }) 7 | export class SampleSectionComponent{ 8 | @Input() public desc: any; 9 | } 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.scss'] 7 | }) 8 | export class AppComponent implements OnInit { 9 | 10 | ngOnInit() { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/src/index.ts: -------------------------------------------------------------------------------- 1 | export { MultiSelectComponent } from './multiselect.component'; 2 | export { ClickOutsideDirective } from './click-outside.directive'; 3 | export { ListFilterPipe } from './list-filter.pipe'; 4 | export { NgMultiSelectDropDownModule } from './ng-multiselect-dropdown.module'; 5 | export { IDropdownSettings } from './multiselect.model' -------------------------------------------------------------------------------- /e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { NgTest2Page } from './app.po'; 2 | 3 | describe('ng-test2 App', () => { 4 | let page: NgTest2Page; 5 | 6 | beforeEach(() => { 7 | page = new NgTest2Page(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to app!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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": ["node_modules/@types"], 12 | "lib": ["es2016","es2015", "dom"] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /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/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./temp/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "mapRoot": "./", 12 | "typeRoots": ["../node_modules/@types"], 13 | "lib": ["es2015", "dom"] 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /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 | "polyfills.ts" 16 | ], 17 | "include": [ 18 | "**/*.spec.ts", 19 | "**/*.d.ts" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /src/code-viewer/code-viewer.module.ts: -------------------------------------------------------------------------------- 1 | import {NgModule, ModuleWithProviders} from '@angular/core'; 2 | import {CommonModule} from '@angular/common'; 3 | import {CodeViewerComponent} from './code-viewer'; 4 | 5 | @NgModule({ 6 | imports: [ 7 | CommonModule 8 | ], 9 | declarations: [ 10 | CodeViewerComponent 11 | ], 12 | exports: [CodeViewerComponent] 13 | }) 14 | export class ShCodeViewer { 15 | static forRoot(): ModuleWithProviders { 16 | return { 17 | ngModule: ShCodeViewer, 18 | providers: [] 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /publish-package.md: -------------------------------------------------------------------------------- 1 | ## step to publish 2 | 3 | 1. yarn build:lib 4 | 2. navigate to dist-lib folder 5 | 3. yarn publish 6 | 4. yarn deployOnly 7 | 8 | ## Angular Multiselect Dropdown 9 | 10 | [![npm version](https://img.shields.io/npm/v/ng-multiselect-dropdown.svg)](https://www.npmjs.com/package/ng-multiselect-dropdown) 11 | [![downloads](https://img.shields.io/npm/dt/ng-multiselect-dropdown.svg)](https://www.npmjs.com/package/ng-multiselect-dropdown) 12 | [![npm](https://img.shields.io/npm/dm/localeval.svg)](https://www.npmjs.com/package/ng-multiselect-dropdown) 13 | [![npm](https://img.shields.io/npm/dw/localeval.svg)](https://www.npmjs.com/package/ng-multiselect-dropdown) 14 | -------------------------------------------------------------------------------- /src/app/components/sample-section.component.html: -------------------------------------------------------------------------------- 1 | 2 | 19 | -------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/src/list-filter.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | import { ListItem } from './multiselect.model'; 4 | 5 | @Pipe({ 6 | name: 'ng2ListFilter', 7 | pure: false 8 | }) 9 | export class ListFilterPipe implements PipeTransform { 10 | transform(items: ListItem[], filter: ListItem): ListItem[] { 11 | if (!items || !filter) { 12 | return items; 13 | } 14 | return items.filter((item: ListItem) => this.applyFilter(item, filter)); 15 | } 16 | 17 | applyFilter(item: ListItem, filter: ListItem): boolean { 18 | return !(filter.text && item.text && item.text.toLowerCase().indexOf(filter.text.toLowerCase()) === -1); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/src/ng-multiselect-dropdown.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, ModuleWithProviders } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { MultiSelectComponent } from './multiselect.component'; 5 | import { ClickOutsideDirective } from './click-outside.directive'; 6 | import { ListFilterPipe } from './list-filter.pipe'; 7 | 8 | @NgModule({ 9 | imports: [CommonModule, FormsModule], 10 | declarations: [MultiSelectComponent, ClickOutsideDirective, ListFilterPipe], 11 | exports: [MultiSelectComponent] 12 | }) 13 | 14 | export class NgMultiSelectDropDownModule { 15 | static forRoot(): ModuleWithProviders { 16 | return { 17 | ngModule: NgMultiSelectDropDownModule 18 | }; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/src/click-outside.directive.ts: -------------------------------------------------------------------------------- 1 | import {Directive, ElementRef, Output, EventEmitter, HostListener} from '@angular/core'; 2 | 3 | @Directive({ 4 | selector: '[clickOutside]' 5 | }) 6 | export class ClickOutsideDirective { 7 | constructor(private _elementRef: ElementRef) { 8 | } 9 | 10 | @Output() 11 | public clickOutside = new EventEmitter(); 12 | 13 | @HostListener('document:click', ['$event', '$event.target']) 14 | public onClick(event: MouseEvent, targetElement: HTMLElement): void { 15 | if (!targetElement) { 16 | return; 17 | } 18 | 19 | const clickedInside = this._elementRef.nativeElement.contains(targetElement); 20 | if (!clickedInside) { 21 | this.clickOutside.emit(event); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /dist-lib 6 | /tmp 7 | /out-tsc 8 | dist-lib.tgz 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # IDEs and editors 14 | /.idea 15 | .project 16 | .classpath 17 | .c9/ 18 | *.launch 19 | .settings/ 20 | *.sublime-workspace 21 | 22 | # IDE - VSCode 23 | .vscode/* 24 | !.vscode/settings.json 25 | !.vscode/tasks.json 26 | !.vscode/launch.json 27 | !.vscode/extensions.json 28 | .vscode 29 | 30 | # misc 31 | /.sass-cache 32 | /connect.lock 33 | /coverage 34 | /libpeerconnection.log 35 | npm-debug.log 36 | testem.log 37 | /typings 38 | yarn-error.log 39 | 40 | # e2e 41 | /e2e/*.js 42 | /e2e/*.map 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | package-lock.json 48 | settings.json 49 | 50 | 51 | TODO.md 52 | ng-multiselect-dropdown - Copy 53 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | // @TODO: try to add ts-check 2 | const jestConfig = { 3 | preset: 'jest-preset-angular', 4 | setupTestFrameworkScriptFile: '/src/setup-jest.ts', 5 | testMatch: [ 6 | '/src/**/__tests__/**/*.+(ts|js)?(x)', 7 | '/src/**/+(*.)+(spec|test).+(ts|js)?(x)', 8 | ], 9 | // // moduleNameMapper: { 10 | // // 'app/(.*)': '/src/app/$1', 11 | // // 'assets/(.*)': '/src/assets/$1', 12 | // // 'environments/(.*)': '/src/environments/$1', 13 | // // }, 14 | // // transformIgnorePatterns: ['node_modules/(?!@ngrx)'], 15 | coveragePathIgnorePatterns: [ 16 | '/node_modules/', 17 | '/out-tsc/', 18 | '/src/.*(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$', 19 | 'src/(setup-jest|jest-global-mocks).ts', 20 | ], 21 | }; 22 | 23 | module.exports = jestConfig; -------------------------------------------------------------------------------- /src/app/components/select-section.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | const tabDesc: any = { 4 | single: { 5 | heading: 'Single' 6 | } 7 | , 8 | multiple1: { 9 | heading: 'Multiple-Example1' 10 | } 11 | }; 12 | 13 | @Component({ 14 | selector: 'select-section', 15 | template: ` 16 |
17 |
18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 |
30 | ` 31 | }) 32 | export class SelectSectionComponent { 33 | public currentHeading = 'Single'; 34 | public tabDesc: any = tabDesc; 35 | } 36 | -------------------------------------------------------------------------------- /package-lib-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ng-multiselect-dropdown", 3 | "version": "0.1.0", 4 | "description": "Angular Multi-Select Dropdown", 5 | "keywords": [ 6 | "angular2", 7 | "angular4", 8 | "angular multiselect dropdown", 9 | "angular2 multiselect dropdown", 10 | "angular4 multiselect dropdown", 11 | "ng2 multiselect dropdown", 12 | "ng4 multiselect dropdown" 13 | ], 14 | "author": "Nilesh Patel", 15 | "license": "MIT", 16 | "repository": { 17 | "type": "git", 18 | "url": "git+ssh://git@github.com/nileshpatel17/ng-multiselect-dropdown.git" 19 | }, 20 | "bugs": { 21 | "url": "https://github.com/nileshpatel17/ng-multiselect-dropdown/issues" 22 | }, 23 | "homepage": "nileshpatel17/ng-multiselect-dropdown#readme", 24 | "peerDependencies": { 25 | "@angular/common": "^2.3.1 || >=4.0.0", 26 | "@angular/core": "^2.3.1 || >=4.0.0", 27 | "@angular/forms": "^2.3.1 || >=4.0.0" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/src/multiselect.model.ts: -------------------------------------------------------------------------------- 1 | export interface IDropdownSettings { 2 | singleSelection?: boolean; 3 | idField?: string; 4 | textField?: string; 5 | enableCheckAll?: boolean; 6 | selectAllText?: string; 7 | unSelectAllText?: string; 8 | allowSearchFilter?: boolean; 9 | clearSearchFilter?: boolean; 10 | maxHeight?: number; 11 | itemsShowLimit?: number; 12 | limitSelection?: number; 13 | searchPlaceholderText?: string; 14 | noDataAvailablePlaceholderText?: string; 15 | closeDropDownOnSelection?: boolean; 16 | showSelectedItemsAtTop?: boolean; 17 | defaultOpen?: boolean; 18 | } 19 | 20 | export class ListItem { 21 | id: String; 22 | text: String; 23 | 24 | public constructor(source: any) { 25 | if (typeof source === 'string') { 26 | this.id = this.text = source; 27 | } 28 | if (typeof source === 'object') { 29 | this.id = source.id; 30 | this.text = source.text; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

ng-multiselect-dropdown

4 |

Native Angular component for Multiple Select

5 | View on GitHub 6 |
7 | 10 | 13 |
14 |
15 |
16 | 17 |
18 | 19 |
20 | 21 |
22 |
23 |
24 |
25 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/0.13/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 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-devkit/build-angular/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; 32 | -------------------------------------------------------------------------------- /src/jest-global-mocks.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | global.CSS = null; 3 | 4 | const webStorageMock = () => { 5 | let storage: Record = {}; 6 | return { 7 | getItem: (key: string) => (key in storage ? storage[key] : null), 8 | setItem: (key: string, value: any) => (storage[key] = value || ''), 9 | removeItem: (key: string) => delete storage[key], 10 | clear: () => (storage = {}), 11 | }; 12 | }; 13 | 14 | Object.defineProperty(window, 'localStorage', { value: webStorageMock() }); 15 | Object.defineProperty(window, 'sessionStorage', { value: webStorageMock() }); 16 | Object.defineProperty(document, 'doctype', { 17 | value: '', 18 | }); 19 | Object.defineProperty(window, 'getComputedStyle', { 20 | value: () => { 21 | return { 22 | display: 'none', 23 | appearance: ['-webkit-appearance'], 24 | }; 25 | }, 26 | }); 27 | /** 28 | * ISSUE: https://github.com/angular/material2/issues/7101 29 | * Workaround for JSDOM missing transform property 30 | */ 31 | Object.defineProperty(document.body.style, 'transform', { 32 | value: () => { 33 | return { 34 | enumerable: true, 35 | configurable: true, 36 | }; 37 | }, 38 | }); -------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/test/helper.ts: -------------------------------------------------------------------------------- 1 | import { Type } from '@angular/core'; 2 | import { FormsModule } from '@angular/forms'; 3 | import { TestBed, ComponentFixture, tick } from '@angular/core/testing'; 4 | import { NgMultiSelectDropDownModule } from './../src/ng-multiselect-dropdown.module'; 5 | 6 | export function newEvent(eventName: string, bubbles = false, cancelable = false) { 7 | let evt = document.createEvent('CustomEvent'); // MUST be 'CustomEvent' 8 | evt.initCustomEvent(eventName, bubbles, cancelable, null); 9 | return evt; 10 | } 11 | 12 | export function createTestingModule(cmp: Type, template: string): ComponentFixture { 13 | TestBed.configureTestingModule({ 14 | imports: [FormsModule, NgMultiSelectDropDownModule], 15 | declarations: [cmp] 16 | }) 17 | .overrideComponent(cmp, { 18 | set: { 19 | template: template 20 | } 21 | }) 22 | .compileComponents(); 23 | const fixture = TestBed.createComponent(cmp); 24 | fixture.detectChanges(); 25 | return fixture; 26 | } 27 | 28 | export function tickAndDetectChanges(fixture) { 29 | fixture.detectChanges(); 30 | tick(); 31 | } 32 | -------------------------------------------------------------------------------- /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('./', 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/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; 3 | import { BrowserModule } from '@angular/platform-browser'; 4 | 5 | import { TabsModule, ButtonsModule } from 'ngx-bootstrap'; 6 | import { NgMultiSelectDropDownModule } from '../ng-multiselect-dropdown/src'; 7 | // import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown'; 8 | 9 | import { SelectSectionComponent } from './components/select-section'; 10 | import { SampleSectionComponent } from './components/sample-section.component'; 11 | import { SingleDemoComponent } from './components/select/single-demo'; 12 | import { MultipleDemoComponent } from './components/select/multiple-demo'; 13 | import { ShCodeViewer } from '../code-viewer/code-viewer.module'; 14 | 15 | import { AppComponent } from './app.component'; 16 | 17 | @NgModule({ 18 | declarations: [SelectSectionComponent, SampleSectionComponent, SingleDemoComponent, MultipleDemoComponent, AppComponent], 19 | imports: [ 20 | FormsModule, 21 | ReactiveFormsModule, 22 | BrowserModule, 23 | TabsModule.forRoot(), 24 | ButtonsModule.forRoot(), 25 | NgMultiSelectDropDownModule.forRoot(), 26 | ShCodeViewer 27 | ], 28 | providers: [], 29 | bootstrap: [AppComponent] 30 | }) 31 | export class AppModule {} 32 | -------------------------------------------------------------------------------- /src/app/components/select/single-demo.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 |

Select a single city

6 |
7 | 9 | 10 |
11 |
12 |
13 |

Option

14 |
15 | 18 |
19 |
20 | 23 |
24 |
25 | 28 |
29 |
30 |
31 |

32 |
33 |
Settings
34 |
35 |
36 |         {{dropdownSettings | json}}
37 |       
38 |
39 |
40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
49 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Angular Multi-Select Dropdown 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 28 | 29 | 30 | 31 | 32 | 33 |

LOADING..

34 |
35 |
36 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/app/components/select/multiple-demo.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Select Multiple Cities

5 |
6 | 7 | 8 |
9 |

10 |
11 |
12 |

Option

13 |
14 | 17 |
18 |
19 | 22 |
23 |
24 | 27 |
28 |
29 | 32 |
33 |
34 | 37 |
38 |
39 |
40 |
41 |
Settings
42 |
43 |
44 |        {{dropdownSettings | json}}
45 |       
46 |
47 |
48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 |
-------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/test/multi-select.component2.spec.ts: -------------------------------------------------------------------------------- 1 | import { Component, Type, ViewChild, DebugElement } from '@angular/core'; 2 | import { FormsModule } from '@angular/forms'; 3 | import { ComponentFixture, fakeAsync } from '@angular/core/testing'; 4 | import { By } from '@angular/platform-browser'; 5 | import { MultiSelectComponent, IDropdownSettings } from './../src'; 6 | import { createTestingModule, tickAndDetectChanges } from './helper' 7 | 8 | @Component({ 9 | template: `` 10 | }) 11 | class Ng2MultiSelectDropdownMultipleSelect { 12 | @ViewChild(MultiSelectComponent) select: MultiSelectComponent; 13 | cities = [ 14 | { item_id: 0, item_text: 'Navsari' }, 15 | { item_id: 1, item_text: 'Mumbai' }, 16 | { item_id: 2, item_text: 'Bangalore' }, 17 | { item_id: 3, item_text: 'Pune' }, 18 | { item_id: 5, item_text: 'New Delhi' } 19 | ]; 20 | selectedItem = [{ item_id: 0, item_text: 'Navsari' }]; 21 | dropdownSettings: IDropdownSettings = { 22 | singleSelection: false, 23 | idField: 'item_id', 24 | textField: 'item_text', 25 | selectAllText: 'Select All', 26 | unSelectAllText: 'UnSelect All', 27 | allowSearchFilter: true, 28 | closeDropDownOnSelection: true, 29 | }; 30 | } 31 | // https://github.com/NileshPatel17/ng-multiselect-dropdown/issues/67 32 | describe('ng-multiselect-component: Issue No: 67( Option with value = 0 does not work)', function () { 33 | let fixture: ComponentFixture; 34 | beforeEach( 35 | fakeAsync(() => { 36 | fixture = createTestingModule( 37 | Ng2MultiSelectDropdownMultipleSelect, 38 | `
39 | 43 | 44 |
` 45 | ); 46 | }) 47 | ); 48 | 49 | it('should have 5 total items', () => { 50 | let selCheckBoxes: HTMLLIElement[]; 51 | const de: DebugElement[] = fixture.debugElement.queryAll(By.css('.item2>li')); 52 | expect(fixture.componentInstance.cities.length).toBe(5) 53 | expect(de.length).toBe(5) 54 | expect(fixture.componentInstance.selectedItem.length).toBe(1) 55 | }) 56 | }); 57 | 58 | -------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/src/multi-select.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | {{_placeholder}} 5 | 6 | {{item.text}} 7 | x 8 | 9 | 10 | +{{itemShowRemaining()}} 11 | 12 | 13 | 14 |
15 | 35 |
-------------------------------------------------------------------------------- /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 | /** Evergreen browsers require these. **/ 41 | import 'core-js/es6/reflect'; 42 | import 'core-js/es7/reflect'; 43 | 44 | 45 | /** 46 | * Required to support Web Animations `@angular/animation`. 47 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation 48 | **/ 49 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 50 | 51 | 52 | 53 | /*************************************************************************************************** 54 | * Zone JS is required by Angular itself. 55 | */ 56 | import 'zone.js/dist/zone'; // Included with Angular CLI. 57 | 58 | 59 | 60 | /*************************************************************************************************** 61 | * APPLICATION IMPORTS 62 | */ 63 | 64 | /** 65 | * Date, currency, decimal and percent pipes. 66 | * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 67 | */ 68 | // import 'intl'; // Run `npm install --save intl`. 69 | /** 70 | * Need to import at least one locale-data with intl. 71 | */ 72 | // import 'intl/locale-data/jsonp/en'; 73 | -------------------------------------------------------------------------------- /src/app/components/select/single-demo.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'single-demo', 5 | templateUrl: './single-demo.html' 6 | }) 7 | export class SingleDemoComponent implements OnInit { 8 | cities: Array = []; 9 | selectedItem: Array = []; 10 | dropdownSettings: any = {}; 11 | closeDropdownSelection = false; 12 | disabled = false; 13 | htmlCode = ` 14 | <ng-multiselect-dropdown 15 | name="city" 16 | [data]="cities" 17 | [(ngModel)]="selectedItem" 18 | [settings]="dropdownSettings" 19 | (onSelect)="onItemSelect($event)" 20 | [disabled]="disabled" 21 | </ng-multiselect-dropdown> 22 | `; 23 | typescriptCode = ` 24 | import { Component, OnInit } from '@angular/core'; 25 | 26 | @Component({ 27 | selector: 'single-demo', 28 | templateUrl: './single-demo.html' 29 | }) 30 | export class SingleDemoComponent implements OnInit { 31 | cities: Array = []; 32 | selectedItem: Array = []; 33 | dropdownSettings: any = {}; 34 | closeDropdownSelection=false; 35 | disabled=false; 36 | 37 | ngOnInit() { 38 | this.cities = ['Mumbai', 'New Delhi', 'Bangaluru', 'Pune', 'Navsari']; 39 | this.selectedItem = ['Pune']; 40 | this.dropdownSettings = { 41 | singleSelection: true, 42 | selectAllText: 'Select All', 43 | unSelectAllText: 'UnSelect All', 44 | allowSearchFilter: true, 45 | closeDropDownOnSelection: this.closeDropdownSelection 46 | }; 47 | } 48 | 49 | onItemSelect(item: any) { 50 | console.log('onItemSelect', item); 51 | } 52 | 53 | toggleCloseDropdownSelection() { 54 | this.closeDropdownSelection = !this.closeDropdownSelection; 55 | this.dropdownSettings = Object.assign({}, this.dropdownSettings,{closeDropDownOnSelection: this.closeDropdownSelection}); 56 | } 57 | 58 | } 59 | `; 60 | 61 | ngOnInit() { 62 | this.cities = ['Mumbai', 'New Delhi', 'Bangaluru', 'Pune', 'Navsari']; 63 | 64 | this.dropdownSettings = { 65 | singleSelection: true, 66 | selectAllText: 'Select All', 67 | unSelectAllText: 'UnSelect All', 68 | allowSearchFilter: true, 69 | closeDropDownOnSelection: this.closeDropdownSelection 70 | }; 71 | this.selectedItem = ['Mumbai']; 72 | } 73 | 74 | onItemSelect(item: any) { 75 | console.log('onItemSelect', item); 76 | console.log('selectedItem', this.selectedItem); 77 | } 78 | 79 | toggleCloseDropdownSelection() { 80 | this.closeDropdownSelection = !this.closeDropdownSelection; 81 | this.dropdownSettings = Object.assign({}, this.dropdownSettings, { closeDropDownOnSelection: this.closeDropdownSelection }); 82 | } 83 | 84 | handleReset() { 85 | this.selectedItem = []; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/code-viewer/code-viewer.ts: -------------------------------------------------------------------------------- 1 | import { ElementRef, Input, OnInit, OnChanges, Component, ViewEncapsulation, ViewChild, AfterViewChecked, SimpleChanges } from '@angular/core'; 2 | 3 | declare let hljs: any; 4 | 5 | @Component({ 6 | selector: 'sh-code-viewer', 7 | template: ` 8 |
  9 |         
 10 |     
11 | `, 12 | encapsulation: ViewEncapsulation.None, 13 | styles: [ 14 | ` 15 | pre{ 16 | padding: 0; 17 | margin: 0; 18 | } 19 | code{ 20 | margin: 0; 21 | padding-top: 0; 22 | } 23 | /* 24 | 25 | Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-license.org/ 26 | 27 | */ 28 | 29 | .hljs { 30 | display: block; 31 | overflow-x: auto; 32 | padding: 0.5em; 33 | background: #23241f; 34 | } 35 | 36 | .hljs, 37 | .hljs-tag, 38 | .hljs-subst { 39 | color: #f8f8f2; 40 | } 41 | 42 | .hljs-strong, 43 | .hljs-emphasis { 44 | color: #a8a8a2; 45 | } 46 | 47 | .hljs-bullet, 48 | .hljs-quote, 49 | .hljs-number, 50 | .hljs-regexp, 51 | .hljs-literal, 52 | .hljs-link { 53 | color: #ae81ff; 54 | } 55 | 56 | .hljs-code, 57 | .hljs-title, 58 | .hljs-section, 59 | .hljs-selector-class { 60 | color: #a6e22e; 61 | } 62 | 63 | .hljs-strong { 64 | font-weight: bold; 65 | } 66 | 67 | .hljs-emphasis { 68 | font-style: italic; 69 | } 70 | 71 | .hljs-keyword, 72 | .hljs-selector-tag, 73 | .hljs-name, 74 | .hljs-attr { 75 | color: #f92672; 76 | } 77 | 78 | .hljs-symbol, 79 | .hljs-attribute { 80 | color: #66d9ef; 81 | } 82 | 83 | .hljs-params, 84 | .hljs-class .hljs-title { 85 | color: #f8f8f2; 86 | } 87 | 88 | .hljs-string, 89 | .hljs-type, 90 | .hljs-built_in, 91 | .hljs-builtin-name, 92 | .hljs-selector-id, 93 | .hljs-selector-attr, 94 | .hljs-selector-pseudo, 95 | .hljs-addition, 96 | .hljs-variable, 97 | .hljs-template-variable { 98 | color: #e6db74; 99 | } 100 | 101 | .hljs-comment, 102 | .hljs-deletion, 103 | .hljs-meta { 104 | color: #75715e; 105 | } 106 | ` 107 | ] 108 | }) 109 | export class CodeViewerComponent implements OnInit, OnChanges, AfterViewChecked { 110 | @Input() useBr: boolean; 111 | @Input() code: string; 112 | @Input() language: string; 113 | @ViewChild('codeView') codeView: ElementRef; 114 | private needUpdate: boolean; 115 | 116 | constructor(private elementRef: ElementRef) {} 117 | 118 | ngOnInit() { 119 | if (this.useBr) { 120 | hljs.configure({ useBR: true }); 121 | } 122 | } 123 | 124 | ngOnChanges(changes: SimpleChanges) { 125 | if (changes['code'] && changes['code'].currentValue) { 126 | this.needUpdate = true; 127 | } 128 | } 129 | 130 | ngAfterViewChecked() { 131 | if (!this.needUpdate) { 132 | return; 133 | } 134 | this.needUpdate = false; 135 | 136 | if (this.codeView.nativeElement.innerHTML) { 137 | hljs.highlightBlock(this.codeView.nativeElement); 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /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": true, 14 | "eofline": true, 15 | "forin": true, 16 | "import-blacklist": [ 17 | true 18 | ], 19 | "import-spacing": true, 20 | "indent": [ 21 | true, 22 | "spaces" 23 | ], 24 | "interface-over-type-literal": true, 25 | "label-position": true, 26 | "max-line-length": [ 27 | true, 28 | 140 29 | ], 30 | "member-access": false, 31 | "member-ordering": [ 32 | true, 33 | { 34 | "order": [ 35 | "static-field", 36 | "instance-field", 37 | "static-method", 38 | "instance-method" 39 | ] 40 | } 41 | ], 42 | "no-arg": true, 43 | "no-bitwise": true, 44 | "no-console": [ 45 | true, 46 | "debug", 47 | "info", 48 | "time", 49 | "timeEnd", 50 | "trace" 51 | ], 52 | "no-construct": true, 53 | "no-debugger": true, 54 | "no-duplicate-super": true, 55 | "no-empty": false, 56 | "no-empty-interface": true, 57 | "no-eval": true, 58 | "no-inferrable-types": [ 59 | true, 60 | "ignore-params" 61 | ], 62 | "no-misused-new": true, 63 | "no-non-null-assertion": true, 64 | "no-shadowed-variable": true, 65 | "no-string-literal": false, 66 | "no-string-throw": true, 67 | "no-switch-case-fall-through": true, 68 | "no-trailing-whitespace": true, 69 | "no-unnecessary-initializer": true, 70 | "no-unused-expression": true, 71 | "no-use-before-declare": true, 72 | "no-var-keyword": true, 73 | "object-literal-sort-keys": false, 74 | "one-line": [ 75 | true, 76 | "check-open-brace", 77 | "check-catch", 78 | "check-else", 79 | "check-whitespace" 80 | ], 81 | "prefer-const": true, 82 | "quotemark": [ 83 | true, 84 | "single" 85 | ], 86 | "radix": true, 87 | "semicolon": [ 88 | true, 89 | "always" 90 | ], 91 | "triple-equals": [ 92 | true, 93 | "allow-null-check" 94 | ], 95 | "typedef-whitespace": [ 96 | true, 97 | { 98 | "call-signature": "nospace", 99 | "index-signature": "nospace", 100 | "parameter": "nospace", 101 | "property-declaration": "nospace", 102 | "variable-declaration": "nospace" 103 | } 104 | ], 105 | "typeof-compare": true, 106 | "unified-signatures": true, 107 | "variable-name": false, 108 | "whitespace": [ 109 | true, 110 | "check-branch", 111 | "check-decl", 112 | "check-operator", 113 | "check-separator", 114 | "check-type" 115 | ], 116 | "directive-selector": [ 117 | true, 118 | "attribute", 119 | "app", 120 | "camelCase" 121 | ], 122 | "component-selector": [ 123 | true, 124 | "element", 125 | "app", 126 | "kebab-case" 127 | ], 128 | "use-input-property-decorator": true, 129 | "use-output-property-decorator": true, 130 | "use-host-property-decorator": true, 131 | "no-input-rename": true, 132 | "no-output-rename": true, 133 | "use-life-cycle-interface": true, 134 | "use-pipe-transform-interface": true, 135 | "component-class-suffix": true, 136 | "directive-class-suffix": true, 137 | "no-access-missing-member": true, 138 | "templates-use-public": true, 139 | "invoke-injectable": true 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ng-multiselect-dropdown", 3 | "version": "0.2.3", 4 | "private": true, 5 | "description": "Angular Multi-Select Dropdown", 6 | "author": "Nilesh Patel", 7 | "license": "MIT", 8 | "scripts": { 9 | "ng": "ng", 10 | "start": "ng serve", 11 | "build": "ng build", 12 | "ng:test": "ng test", 13 | "lint": "ng lint", 14 | "test": "jest --watch", 15 | "test:ci": "jest --runInBand", 16 | "test:coverage": "jest --coverage", 17 | "build:prod": "ng build --prod --base-href https://nileshpatel17.github.io/ng-multiselect-dropdown/", 18 | "clear:lib": "rimraf dist-lib", 19 | "copyfiles": "copyfiles -u 1 ./dist-lib/**/*.* node_modules/ng-multiselect-dropdown", 20 | "build:lib": "yarn clear:lib && ng-packagr -p ng-package.json", 21 | "postbuild:lib": "yarn copyfiles", 22 | "prepublish": "yarn build:prod", 23 | "publish": "ngh --no-silent false --name=\"nileshpatel17\" --email=\"nilesh.nvs@hotmail.com\"", 24 | "deploy": "ng build --prod --bh /ng-multiselect-dropdown/ && angular-cli-ghpages --no-silent --repo=https://github.com/NileshPatel17/ng-multiselect-dropdown.git --name=\"Nilesh Patel\" --email=nilesh.nvs@hotmail.com", 25 | "deployOnly": "angular-cli-ghpages --no-silent --repo=https://github.com/NileshPatel17/ng-multiselect-dropdown.git --name=\"Nilesh Patel\" --email=nilesh.nvs@hotmail.com" 26 | }, 27 | "keywords": [ 28 | "angular2", 29 | "angular4", 30 | "angular multiselect dropdown", 31 | "angular2 multiselect dropdown", 32 | "angular4 multiselect dropdown", 33 | "ng multiselect dropdown", 34 | "ng2 multiselect dropdown", 35 | "ng4 multiselect dropdown" 36 | ], 37 | "repository": { 38 | "type": "git", 39 | "url": "https://github.com/nileshpatel17/ng-multiselect-dropdown.git" 40 | }, 41 | "bugs": { 42 | "url": "https://github.com/nileshpatel17/ng-multiselect-dropdown/issues" 43 | }, 44 | "homepage": "https://github.com/nileshpatel17/ng-multiselect-dropdown#readme", 45 | "peerDependencies": { 46 | "@angular/common": "^4.0.0 || ^6.0.0", 47 | "@angular/core": "^4.0.0 || ^6.0.0" 48 | }, 49 | "devDependencies": { 50 | "@angular-devkit/build-angular": "~0.6.8", 51 | "@angular/animations": "5.2.9", 52 | "@angular/cli": "^6.0.3", 53 | "@angular/common": "5.2.9", 54 | "@angular/compiler": "5.2.9", 55 | "@angular/compiler-cli": "5.2.9", 56 | "@angular/core": ">=5.2.9 <3.0.0||>=5.2.9", 57 | "@angular/forms": "5.2.9", 58 | "@angular/http": "5.2.9", 59 | "@angular/language-service": "5.2.9", 60 | "@angular/platform-browser": "5.2.9", 61 | "@angular/platform-browser-dynamic": "5.2.9", 62 | "@angular/router": "5.2.9", 63 | "@types/jasmine": "~2.5.53", 64 | "@types/jasminewd2": "~2.0.2", 65 | "@types/node": "~6.0.60", 66 | "angular-cli-ghpages": "^0.5.2", 67 | "angular-library-builder": "^1.5.12", 68 | "angular2-markdown": "^1.6.0", 69 | "codelyzer": "~3.0.1", 70 | "copyfiles": "^2.0.0", 71 | "core-js": "^2.4.1", 72 | "jasmine-core": "~2.6.2", 73 | "jasmine-spec-reporter": "~4.1.0", 74 | "jest": "^23.4.1", 75 | "jest-preset-angular": "^5.2.3", 76 | "karma": "~1.7.0", 77 | "karma-chrome-launcher": "~2.1.1", 78 | "karma-cli": "~1.0.1", 79 | "karma-coverage-istanbul-reporter": "^1.2.1", 80 | "karma-jasmine": "~1.1.0", 81 | "karma-jasmine-html-reporter": "^0.2.2", 82 | "ng-multiselect-dropdown": "^0.2.3", 83 | "ng-packagr": "^3.0.3", 84 | "ngx-bootstrap": "^2.0.3", 85 | "protractor": "~5.1.2", 86 | "rimraf": "^2.6.2", 87 | "rxjs": "^6.2.1", 88 | "rxjs-compat": "^6.2.1", 89 | "ts-node": "~3.0.4", 90 | "tslint": "~5.3.2", 91 | "typescript": "2.6.2", 92 | "zone.js": "^0.8.25" 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/test/multi-select.component1.spec.ts: -------------------------------------------------------------------------------- 1 | import { Component, Type, ViewChild, DebugElement } from '@angular/core'; 2 | import { FormsModule } from '@angular/forms'; 3 | import { ComponentFixture, fakeAsync } from '@angular/core/testing'; 4 | import { By } from '@angular/platform-browser'; 5 | import { MultiSelectComponent, IDropdownSettings } from './../src'; 6 | import { createTestingModule, tickAndDetectChanges } from './helper' 7 | 8 | @Component({ 9 | template: `` 10 | }) 11 | class Ng2MultiSelectDropdownMultipleSelect_defaultPlaceHolderText { 12 | @ViewChild(MultiSelectComponent) select: MultiSelectComponent; 13 | cities = []; 14 | selectedItem = []; 15 | dropdownSettings: IDropdownSettings = { 16 | singleSelection: false, 17 | idField: 'item_id', 18 | textField: 'item_text', 19 | selectAllText: 'Select All', 20 | unSelectAllText: 'UnSelect All', 21 | allowSearchFilter: true, 22 | closeDropDownOnSelection: true, 23 | }; 24 | } 25 | 26 | const NO_DATA_AVAILABLE = 'NO DATA AVAILABLE' 27 | @Component({ 28 | template: `` 29 | }) 30 | class Ng2MultiSelectDropdownMultipleSelect_CustomPlaceHolderText { 31 | @ViewChild(MultiSelectComponent) select: MultiSelectComponent; 32 | cities = []; 33 | selectedItem = []; 34 | dropdownSettings: IDropdownSettings = { 35 | singleSelection: false, 36 | idField: 'item_id', 37 | textField: 'item_text', 38 | selectAllText: 'Select All', 39 | unSelectAllText: 'UnSelect All', 40 | allowSearchFilter: true, 41 | closeDropDownOnSelection: true, 42 | noDataAvailablePlaceholderText: NO_DATA_AVAILABLE 43 | }; 44 | } 45 | describe('ng-multiselect-component: default placeholder when no data is available to show', function () { 46 | let fixture: ComponentFixture; 47 | beforeEach( 48 | fakeAsync(() => { 49 | fixture = createTestingModule( 50 | Ng2MultiSelectDropdownMultipleSelect_defaultPlaceHolderText, 51 | `
52 | 56 | 57 |
` 58 | ); 59 | }) 60 | ); 61 | 62 | it('should have default placeholder when no data is available to show', () => { 63 | const de: DebugElement = fixture.debugElement.query(By.css('.no-data')); 64 | const el = de.nativeElement; 65 | expect(el.textContent).toContain('No data available') 66 | }) 67 | }); 68 | describe('ng-multiselect-component: custom placeholder when no data is available to show', function () { 69 | let fixture: ComponentFixture; 70 | beforeEach( 71 | fakeAsync(() => { 72 | fixture = createTestingModule( 73 | Ng2MultiSelectDropdownMultipleSelect_CustomPlaceHolderText, 74 | `
75 | 79 | 80 |
` 81 | ); 82 | }) 83 | ); 84 | 85 | it('should have custom placeholder when no data is available to show', () => { 86 | const de: DebugElement = fixture.debugElement.query(By.css('.no-data')); 87 | const el = de.nativeElement; 88 | expect(el.textContent).toContain(NO_DATA_AVAILABLE) 89 | }) 90 | }); 91 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "ng-multiselect-dropdown-base": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "architect": { 11 | "build": { 12 | "builder": "@angular-devkit/build-angular:browser", 13 | "options": { 14 | "outputPath": "dist", 15 | "index": "src/index.html", 16 | "main": "src/main.ts", 17 | "tsConfig": "src/tsconfig.app.json", 18 | "polyfills": "src/polyfills.ts", 19 | "assets": [ 20 | "src/assets", 21 | "src/favicon.ico" 22 | ], 23 | "styles": [ 24 | "src/styles.scss" 25 | ], 26 | "scripts": [] 27 | }, 28 | "configurations": { 29 | "production": { 30 | "optimization": true, 31 | "outputHashing": "all", 32 | "sourceMap": false, 33 | "extractCss": true, 34 | "namedChunks": false, 35 | "aot": true, 36 | "extractLicenses": true, 37 | "vendorChunk": false, 38 | "buildOptimizer": true, 39 | "fileReplacements": [ 40 | { 41 | "replace": "src/environments/environment.ts", 42 | "with": "src/environments/environment.prod.ts" 43 | } 44 | ] 45 | } 46 | } 47 | }, 48 | "serve": { 49 | "builder": "@angular-devkit/build-angular:dev-server", 50 | "options": { 51 | "browserTarget": "ng-multiselect-dropdown-base:build" 52 | }, 53 | "configurations": { 54 | "production": { 55 | "browserTarget": "ng-multiselect-dropdown-base:build:production" 56 | } 57 | } 58 | }, 59 | "extract-i18n": { 60 | "builder": "@angular-devkit/build-angular:extract-i18n", 61 | "options": { 62 | "browserTarget": "ng-multiselect-dropdown-base:build" 63 | } 64 | }, 65 | "test": { 66 | "builder": "@angular-devkit/build-angular:karma", 67 | "options": { 68 | "main": "src/test.ts", 69 | "karmaConfig": "./karma.conf.js", 70 | "polyfills": "src/polyfills.ts", 71 | "tsConfig": "src/tsconfig.spec.json", 72 | "scripts": [], 73 | "styles": [ 74 | "src/styles.scss" 75 | ], 76 | "assets": [ 77 | "src/assets", 78 | "src/favicon.ico" 79 | ] 80 | } 81 | }, 82 | "lint": { 83 | "builder": "@angular-devkit/build-angular:tslint", 84 | "options": { 85 | "tsConfig": [ 86 | "src/tsconfig.app.json", 87 | "src/tsconfig.spec.json" 88 | ], 89 | "exclude": [ 90 | "**/node_modules/**" 91 | ] 92 | } 93 | } 94 | } 95 | }, 96 | "ng-multiselect-dropdown-base-e2e": { 97 | "root": "", 98 | "sourceRoot": "e2e", 99 | "projectType": "application", 100 | "architect": { 101 | "e2e": { 102 | "builder": "@angular-devkit/build-angular:protractor", 103 | "options": { 104 | "protractorConfig": "./protractor.conf.js", 105 | "devServerTarget": "ng-multiselect-dropdown-base:serve" 106 | } 107 | }, 108 | "lint": { 109 | "builder": "@angular-devkit/build-angular:tslint", 110 | "options": { 111 | "tsConfig": [ 112 | "e2e/tsconfig.e2e.json" 113 | ], 114 | "exclude": [ 115 | "**/node_modules/**" 116 | ] 117 | } 118 | } 119 | } 120 | } 121 | }, 122 | "defaultProject": "ng-multiselect-dropdown-base", 123 | "schematics": { 124 | "@schematics/angular:component": { 125 | "prefix": "ng", 126 | "styleext": "scss" 127 | }, 128 | "@schematics/angular:directive": { 129 | "prefix": "ng" 130 | } 131 | } 132 | } -------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/src/multi-select.component.scss: -------------------------------------------------------------------------------- 1 | $base-color: #337ab7; 2 | $disable-background-color: #eceeef; 3 | .multiselect-dropdown { 4 | position: relative; 5 | width: 100%; 6 | font-size: inherit; 7 | font-family: inherit; 8 | .dropdown-btn { 9 | display: inline-block; 10 | border: 1px solid #adadad; 11 | width: 100%; 12 | padding: 6px 12px; 13 | margin-bottom: 0; 14 | font-weight: normal; 15 | line-height: 1.52857143; 16 | text-align: left; 17 | vertical-align: middle; 18 | cursor: pointer; 19 | background-image: none; 20 | border-radius: 4px; 21 | .selected-item { 22 | border: 1px solid $base-color; 23 | margin-right: 4px; 24 | background: $base-color; 25 | padding: 0px 5px; 26 | color: #fff; 27 | border-radius: 2px; 28 | float: left; 29 | a { 30 | text-decoration: none; 31 | } 32 | } 33 | .selected-item:hover { 34 | box-shadow: 1px 1px #959595; 35 | } 36 | .dropdown-down { 37 | display: inline-block; 38 | top: 10px; 39 | width: 0; 40 | height: 0; 41 | border-top: 10px solid #adadad; 42 | border-left: 10px solid transparent; 43 | border-right: 10px solid transparent; 44 | } 45 | .dropdown-up { 46 | display: inline-block; 47 | width: 0; 48 | height: 0; 49 | border-bottom: 10px solid #adadad; 50 | border-left: 10px solid transparent; 51 | border-right: 10px solid transparent; 52 | } 53 | } 54 | .disabled { 55 | & > span { 56 | background-color: $disable-background-color; 57 | } 58 | } 59 | } 60 | 61 | .dropdown-list { 62 | position: absolute; 63 | padding-top: 6px; 64 | width: 100%; 65 | z-index: 9999; 66 | border: 1px solid #ccc; 67 | border-radius: 3px; 68 | background: #fff; 69 | margin-top: 10px; 70 | box-shadow: 0px 1px 5px #959595; 71 | ul { 72 | padding: 0px; 73 | list-style: none; 74 | overflow: auto; 75 | margin: 0px; 76 | } 77 | li { 78 | padding: 6px 10px; 79 | cursor: pointer; 80 | text-align: left; 81 | } 82 | .filter-textbox { 83 | border-bottom: 1px solid #ccc; 84 | position: relative; 85 | padding: 10px; 86 | input { 87 | border: 0px; 88 | width: 100%; 89 | padding: 0px 0px 0px 26px; 90 | } 91 | input:focus { 92 | outline: none; 93 | } 94 | } 95 | } 96 | 97 | .multiselect-item-checkbox input[type='checkbox'] { 98 | border: 0; 99 | clip: rect(0 0 0 0); 100 | height: 1px; 101 | margin: -1px; 102 | overflow: hidden; 103 | padding: 0; 104 | position: absolute; 105 | width: 1px; 106 | } 107 | 108 | .multiselect-item-checkbox input[type='checkbox']:focus + div:before, 109 | .multiselect-item-checkbox input[type='checkbox']:hover + div:before { 110 | border-color: $base-color; 111 | background-color: #f2f2f2; 112 | } 113 | 114 | .multiselect-item-checkbox input[type='checkbox']:active + div:before { 115 | transition-duration: 0s; 116 | } 117 | 118 | .multiselect-item-checkbox input[type='checkbox'] + div { 119 | position: relative; 120 | padding-left: 2em; 121 | vertical-align: middle; 122 | user-select: none; 123 | cursor: pointer; 124 | margin: 0px; 125 | color: #000; 126 | } 127 | 128 | .multiselect-item-checkbox input[type='checkbox'] + div:before { 129 | box-sizing: content-box; 130 | content: ''; 131 | color: $base-color; 132 | position: absolute; 133 | top: 50%; 134 | left: 0; 135 | width: 14px; 136 | height: 14px; 137 | margin-top: -9px; 138 | border: 2px solid $base-color; 139 | text-align: center; 140 | transition: all 0.4s ease; 141 | } 142 | 143 | .multiselect-item-checkbox input[type='checkbox'] + div:after { 144 | box-sizing: content-box; 145 | content: ''; 146 | background-color: $base-color; 147 | position: absolute; 148 | top: 50%; 149 | left: 4px; 150 | width: 10px; 151 | height: 10px; 152 | margin-top: -5px; 153 | transform: scale(0); 154 | transform-origin: 50%; 155 | transition: transform 200ms ease-out; 156 | } 157 | 158 | .multiselect-item-checkbox input[type='checkbox']:disabled + div:before { 159 | border-color: #cccccc; 160 | } 161 | 162 | .multiselect-item-checkbox 163 | input[type='checkbox']:disabled:focus 164 | + div:before 165 | .multiselect-item-checkbox 166 | input[type='checkbox']:disabled:hover 167 | + div:before { 168 | background-color: inherit; 169 | } 170 | 171 | .multiselect-item-checkbox 172 | input[type='checkbox']:disabled:checked 173 | + div:before { 174 | background-color: #cccccc; 175 | } 176 | 177 | .multiselect-item-checkbox input[type='checkbox'] + div:after { 178 | background-color: transparent; 179 | top: 50%; 180 | left: 4px; 181 | width: 8px; 182 | height: 3px; 183 | margin-top: -4px; 184 | border-style: solid; 185 | border-color: #ffffff; 186 | border-width: 0 0 3px 3px; 187 | border-image: none; 188 | transform: rotate(-45deg) scale(0); 189 | } 190 | 191 | .multiselect-item-checkbox input[type='checkbox']:checked + div:after { 192 | content: ''; 193 | transform: rotate(-45deg) scale(1); 194 | transition: transform 200ms ease-out; 195 | } 196 | 197 | .multiselect-item-checkbox input[type='checkbox']:checked + div:before { 198 | animation: borderscale 200ms ease-in; 199 | background: $base-color; 200 | } 201 | 202 | .multiselect-item-checkbox input[type='checkbox']:checked + div:after { 203 | transform: rotate(-45deg) scale(1); 204 | } 205 | 206 | @keyframes borderscale { 207 | 50% { 208 | box-shadow: 0 0 0 2px $base-color; 209 | } 210 | } 211 | -------------------------------------------------------------------------------- /src/app/components/select/multiple-demo.ts: -------------------------------------------------------------------------------- 1 | import { FormBuilder, FormGroup } from '@angular/forms'; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { IDropdownSettings } from '../../../ng-multiselect-dropdown/src'; 4 | 5 | @Component({ 6 | selector: 'multiple-demo', 7 | templateUrl: './multiple-demo.html' 8 | }) 9 | export class MultipleDemoComponent implements OnInit { 10 | myForm: FormGroup; 11 | disabled = false; 12 | ShowFilter = true; 13 | showAll = true; 14 | limitSelection = false; 15 | cities: Array = []; 16 | selectedItems: Array = []; 17 | dropdownSettings: IDropdownSettings = {}; 18 | htmlCode = ` 19 | <form [formGroup]="myForm"> 20 | <ng-multiselect-dropdown 21 | name="city" 22 | [placeholder]="'Select City'" 23 | [data]="cities" 24 | formControlName="city" 25 | [disabled]="disabled" 26 | [settings]="dropdownSettings" 27 | (onSelect)="onItemSelect($event)"> 28 | </ng-multiselect-dropdown> 29 | </form> 30 | `; 31 | typescriptCode = ` 32 | import { FormBuilder, FormGroup } from '@angular/forms'; 33 | import { Component, OnInit } from '@angular/core'; 34 | 35 | @Component({ 36 | selector: 'multiple-demo', 37 | templateUrl: './multiple-demo.html' 38 | }) 39 | export class MultipleDemoComponent implements OnInit { 40 | myForm:FormGroup; 41 | disabled = false; 42 | ShowFilter = false; 43 | limitSelection = false; 44 | cities: Array = []; 45 | selectedItems: Array = []; 46 | dropdownSettings: any = {}; 47 | constructor(private fb: FormBuilder) {} 48 | 49 | ngOnInit() { 50 | this.cities = [ 51 | { item_id: 1, item_text: 'New Delhi' }, 52 | { item_id: 2, item_text: 'Mumbai' }, 53 | { item_id: 3, item_text: 'Bangalore' }, 54 | { item_id: 4, item_text: 'Pune' }, 55 | { item_id: 5, item_text: 'Chennai' }, 56 | { item_id: 6, item_text: 'Navsari' } 57 | ]; 58 | this.selectedItems = [{ item_id: 4, item_text: 'Pune' }, { item_id: 6, item_text: 'Navsari' }]; 59 | this.dropdownSettings = { 60 | singleSelection: false, 61 | idField: 'item_id', 62 | textField: 'item_text', 63 | selectAllText: 'Select All', 64 | unSelectAllText: 'UnSelect All', 65 | itemsShowLimit: 3, 66 | allowSearchFilter: this.ShowFilter 67 | }; 68 | this.myForm = this.fb.group({ 69 | city: [this.selectedItems] 70 | }); 71 | } 72 | 73 | onItemSelect(item: any) { 74 | console.log('onItemSelect', item); 75 | } 76 | onSelectAll(items: any) { 77 | console.log('onSelectAll', items); 78 | } 79 | toogleShowFilter() { 80 | this.ShowFilter = !this.ShowFilter; 81 | this.dropdownSettings = Object.assign({}, this.dropdownSettings, { allowSearchFilter: this.ShowFilter }); 82 | } 83 | 84 | handleLimitSelection() { 85 | if (this.limitSelection) { 86 | this.dropdownSettings = Object.assign({}, this.dropdownSettings, { limitSelection: 2 }); 87 | } else { 88 | this.dropdownSettings = Object.assign({}, this.dropdownSettings, { limitSelection: null }); 89 | } 90 | } 91 | } 92 | `; 93 | 94 | constructor(private fb: FormBuilder) {} 95 | 96 | ngOnInit() { 97 | this.cities = [ 98 | { item_id: 1, item_text: 'New Delhi' }, 99 | { item_id: 2, item_text: 'Mumbai' }, 100 | { item_id: 3, item_text: 'Bangalore' }, 101 | { item_id: 4, item_text: 'Pune' }, 102 | { item_id: 5, item_text: 'Chennai' }, 103 | { item_id: 6, item_text: 'Navsari' } 104 | ]; 105 | this.selectedItems = [ 106 | { item_id: 4, item_text: 'Pune' }, 107 | { item_id: 6, item_text: 'Navsari' } 108 | ]; 109 | this.dropdownSettings = { 110 | singleSelection: false, 111 | defaultOpen: false, 112 | idField: 'item_id', 113 | textField: 'item_text', 114 | selectAllText: 'Select All', 115 | unSelectAllText: 'UnSelect All', 116 | enableCheckAll: this.showAll, 117 | itemsShowLimit: 3, 118 | allowSearchFilter: this.ShowFilter 119 | }; 120 | this.myForm = this.fb.group({ 121 | city: [this.selectedItems] 122 | }); 123 | } 124 | 125 | onItemSelect(item: any) { 126 | console.log('onItemSelect', item); 127 | console.log('form model', this.myForm.get('city').value); 128 | } 129 | onItemDeSelect(item: any) { 130 | console.log('onItem DeSelect', item); 131 | console.log('form model', this.myForm.get('city').value); 132 | } 133 | 134 | onSelectAll(items: any) { 135 | console.log('onSelectAll', items); 136 | } 137 | 138 | onDropDownClose() { 139 | console.log('dropdown closed'); 140 | } 141 | 142 | toogleShowAll() { 143 | this.showAll = !this.showAll; 144 | this.dropdownSettings = Object.assign({}, this.dropdownSettings, { 145 | enableCheckAll: this.showAll 146 | }); 147 | } 148 | toogleShowFilter() { 149 | this.ShowFilter = !this.ShowFilter; 150 | this.dropdownSettings = Object.assign({}, this.dropdownSettings, { 151 | allowSearchFilter: this.ShowFilter 152 | }); 153 | } 154 | 155 | handleLimitSelection() { 156 | if (this.limitSelection) { 157 | this.dropdownSettings = Object.assign({}, this.dropdownSettings, { 158 | limitSelection: 2 159 | }); 160 | } else { 161 | this.dropdownSettings = Object.assign({}, this.dropdownSettings, { 162 | limitSelection: -1 163 | }); 164 | } 165 | } 166 | 167 | handleReset() { 168 | this.myForm.get('city').setValue([]); 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | .h1, .h2, .h3, h1, h2, h3 { 3 | margin-top: 20px; 4 | margin-bottom: 10px; 5 | } 6 | 7 | .h1, h1 { 8 | font-size: 36px; 9 | } 10 | 11 | .btn-group-lg > .btn, .btn-lg { 12 | font-size: 18px; 13 | } 14 | 15 | section { 16 | padding-top: 30px; 17 | } 18 | 19 | .bd-pageheader { 20 | // margin-top: 51px; 21 | } 22 | 23 | .page-header { 24 | padding-bottom: 9px; 25 | margin: 40px 0 20px; 26 | border-bottom: 1px solid #eee; 27 | } 28 | 29 | .navbar-default .navbar-nav > li > a { 30 | color: #777; 31 | } 32 | 33 | .navbar { 34 | padding: 0; 35 | } 36 | 37 | .navbar-nav .nav-item { 38 | margin-left: 0 !important; 39 | } 40 | 41 | .nav > li > a { 42 | position: relative; 43 | display: block; 44 | padding: 10px 15px; 45 | } 46 | 47 | .nav .navbar-brand { 48 | float: left; 49 | height: 50px; 50 | padding: 15px 15px; 51 | font-size: 18px; 52 | line-height: 20px; 53 | margin-right: 0 !important; 54 | } 55 | 56 | .navbar-brand { 57 | color: #777; 58 | float: left; 59 | height: 50px; 60 | padding: 15px 15px; 61 | font-size: 18px; 62 | line-height: 20px; 63 | } 64 | 65 | .navbar-toggler { 66 | margin-top: 8px; 67 | margin-right: 15px; 68 | } 69 | 70 | .navbar-default .navbar-nav > li > a:focus, .navbar-default .navbar-nav > li > a:hover { 71 | color: #333; 72 | background-color: transparent; 73 | } 74 | 75 | .bd-pageheader, .bs-docs-masthead { 76 | position: relative; 77 | padding: 30px 0; 78 | color: #cdbfe3; 79 | text-align: center; 80 | text-shadow: 0 1px 0 rgba(0, 0, 0, .1); 81 | background-color: #6f5499; 82 | background-image: -webkit-gradient(linear, left top, left bottom, from(#563d7c), to(#6f5499)); 83 | background-image: -webkit-linear-gradient(top, #563d7c 0, #6f5499 100%); 84 | background-image: -o-linear-gradient(top, #563d7c 0, #6f5499 100%); 85 | background-image: linear-gradient(to bottom, #563d7c 0, #6f5499 100%); 86 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#563d7c', endColorstr='#6F5499', GradientType=0); 87 | background-repeat: repeat-x; 88 | } 89 | 90 | .bd-pageheader { 91 | // margin-bottom: 40px; 92 | font-size: 20px; 93 | } 94 | 95 | .bd-pageheader h1 { 96 | margin-top: 0; 97 | color: #fff; 98 | } 99 | 100 | .bd-pageheader p { 101 | margin-bottom: 0; 102 | font-weight: 300; 103 | line-height: 1.4; 104 | } 105 | 106 | .bd-pageheader .btn { 107 | margin: 10px 0; 108 | } 109 | 110 | .scrollable-menu .nav-link { 111 | color: #337ab7; 112 | font-size: 14px; 113 | } 114 | 115 | .scrollable-menu .nav-link:hover { 116 | color: #23527c; 117 | background-color: #eee; 118 | } 119 | 120 | @media (min-width: 992px) { 121 | .bd-pageheader h1, .bd-pageheader p { 122 | margin-right: 380px; 123 | } 124 | } 125 | 126 | @media (min-width: 768px) { 127 | .bd-pageheader { 128 | // padding-top: 60px; 129 | // padding-bottom: 60px; 130 | font-size: 24px; 131 | text-align: left; 132 | } 133 | 134 | .bd-pageheader h1 { 135 | font-size: 60px; 136 | line-height: 1; 137 | } 138 | 139 | .navbar-nav > li > a.nav-link { 140 | padding-top: 15px; 141 | padding-bottom: 15px; 142 | font-size: 14px; 143 | } 144 | 145 | .navbar > .container .navbar-brand, .navbar > .container-fluid .navbar-brand { 146 | margin-left: -15px; 147 | } 148 | } 149 | 150 | @media (max-width: 767px) { 151 | .hidden-xs { 152 | display: none !important; 153 | } 154 | 155 | .navbar .container { 156 | width: 100%; 157 | max-width: 100%; 158 | } 159 | .navbar .container, 160 | .navbar .container .navbar-header { 161 | padding: 0; 162 | margin: 0; 163 | } 164 | } 165 | 166 | @media (max-width: 400px) { 167 | code, kbd { 168 | font-size: 60%; 169 | } 170 | } 171 | 172 | .scrollable-menu { 173 | height: 90vh !important; 174 | width: 100vw; 175 | overflow-x: hidden; 176 | padding: 0 0 20px; 177 | } 178 | 179 | /** 180 | * iPad with portrait orientation. 181 | */ 182 | @media all and (device-width: 768px) and (device-height: 1024px) and (orientation: portrait) { 183 | .scrollable-menu { 184 | height: 1024px !important; 185 | } 186 | } 187 | 188 | /** 189 | * iPad with landscape orientation. 190 | */ 191 | @media all and (device-width: 768px) and (device-height: 1024px) and (orientation: landscape) { 192 | .scrollable-menu { 193 | height: 768px !important; 194 | } 195 | } 196 | 197 | /** 198 | * iPhone 5 199 | * You can also target devices with aspect ratio. 200 | */ 201 | @media screen and (device-aspect-ratio: 40/71) { 202 | .scrollable-menu { 203 | height: 500px !important; 204 | } 205 | } 206 | 207 | .navbar-default .navbar-toggle .icon-bar { 208 | background-color: #888; 209 | } 210 | 211 | .navbar-toggle:focus { 212 | outline: 0 213 | } 214 | 215 | .navbar-toggle .icon-bar { 216 | display: block; 217 | width: 22px; 218 | height: 2px; 219 | border-radius: 1px 220 | } 221 | 222 | .navbar-toggle .icon-bar + .icon-bar { 223 | margin-top: 4px 224 | } 225 | 226 | pre { 227 | white-space: pre-wrap; /* CSS 3 */ 228 | white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ 229 | white-space: -pre-wrap; /* Opera 4-6 */ 230 | white-space: -o-pre-wrap; /* Opera 7 */ 231 | word-wrap: break-word; /* Internet Explorer 5.5+ */ 232 | } 233 | 234 | .chart-legend, .bar-legend, .line-legend, .pie-legend, .radar-legend, .polararea-legend, .doughnut-legend { 235 | list-style-type: none; 236 | margin-top: 5px; 237 | text-align: center; 238 | -webkit-padding-start: 0; 239 | -moz-padding-start: 0; 240 | padding-left: 0 241 | } 242 | 243 | .chart-legend li, .bar-legend li, .line-legend li, .pie-legend li, .radar-legend li, .polararea-legend li, .doughnut-legend li { 244 | display: inline-block; 245 | white-space: nowrap; 246 | position: relative; 247 | margin-bottom: 4px; 248 | border-radius: 5px; 249 | padding: 2px 8px 2px 28px; 250 | font-size: smaller; 251 | cursor: default 252 | } 253 | 254 | .chart-legend li span, .bar-legend li span, .line-legend li span, .pie-legend li span, .radar-legend li span, .polararea-legend li span, .doughnut-legend li span { 255 | display: block; 256 | position: absolute; 257 | left: 0; 258 | top: 0; 259 | width: 20px; 260 | height: 20px; 261 | border-radius: 5px 262 | } -------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/src/multiselect.component.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Component, 3 | HostListener, 4 | forwardRef, 5 | Input, 6 | Output, 7 | EventEmitter, 8 | ChangeDetectionStrategy, 9 | ChangeDetectorRef 10 | } from '@angular/core'; 11 | import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms'; 12 | import { ListItem, IDropdownSettings } from './multiselect.model'; 13 | 14 | export const DROPDOWN_CONTROL_VALUE_ACCESSOR: any = { 15 | provide: NG_VALUE_ACCESSOR, 16 | useExisting: forwardRef(() => MultiSelectComponent), 17 | multi: true 18 | }; 19 | const noop = () => {}; 20 | 21 | @Component({ 22 | selector: 'ng-multiselect-dropdown', 23 | templateUrl: './multi-select.component.html', 24 | styleUrls: ['./multi-select.component.scss'], 25 | providers: [DROPDOWN_CONTROL_VALUE_ACCESSOR], 26 | changeDetection: ChangeDetectionStrategy.OnPush 27 | }) 28 | export class MultiSelectComponent implements ControlValueAccessor { 29 | public _settings: IDropdownSettings; 30 | public _data: Array = []; 31 | public selectedItems: Array = []; 32 | public isDropdownOpen = true; 33 | _placeholder = 'Select'; 34 | filter: ListItem = new ListItem(this.data); 35 | defaultSettings: IDropdownSettings = { 36 | singleSelection: false, 37 | idField: 'id', 38 | textField: 'text', 39 | enableCheckAll: true, 40 | selectAllText: 'Select All', 41 | unSelectAllText: 'UnSelect All', 42 | allowSearchFilter: false, 43 | limitSelection: -1, 44 | clearSearchFilter: true, 45 | maxHeight: 197, 46 | itemsShowLimit: 999999999999, 47 | searchPlaceholderText: 'Search', 48 | noDataAvailablePlaceholderText: 'No data available', 49 | closeDropDownOnSelection: false, 50 | showSelectedItemsAtTop: false, 51 | defaultOpen: false 52 | }; 53 | 54 | @Input() 55 | public set placeholder(value: string) { 56 | if (value) { 57 | this._placeholder = value; 58 | } else { 59 | this._placeholder = 'Select'; 60 | } 61 | } 62 | @Input() 63 | disabled = false; 64 | 65 | @Input() 66 | public set settings(value: IDropdownSettings) { 67 | if (value) { 68 | this._settings = Object.assign(this.defaultSettings, value); 69 | } else { 70 | this._settings = Object.assign(this.defaultSettings); 71 | } 72 | } 73 | 74 | @Input() 75 | public set data(value: Array) { 76 | if (!value) { 77 | this._data = []; 78 | } else { 79 | // const _items = value.filter((item: any) => { 80 | // if (typeof item === 'string' || (typeof item === 'object' && item && item[this._settings.idField] && item[this._settings.textField])) { 81 | // return item; 82 | // } 83 | // }); 84 | this._data = value.map( 85 | (item: any) => 86 | typeof item === 'string' 87 | ? new ListItem(item) 88 | : new ListItem({ 89 | id: item[this._settings.idField], 90 | text: item[this._settings.textField] 91 | }) 92 | ); 93 | } 94 | } 95 | 96 | @Output('onFilterChange') 97 | onFilterChange: EventEmitter = new EventEmitter(); 98 | @Output('onDropDownClose') 99 | onDropDownClose: EventEmitter = new EventEmitter(); 100 | 101 | @Output('onSelect') 102 | onSelect: EventEmitter = new EventEmitter(); 103 | 104 | @Output('onDeSelect') 105 | onDeSelect: EventEmitter = new EventEmitter(); 106 | 107 | @Output('onSelectAll') 108 | onSelectAll: EventEmitter> = new EventEmitter>(); 109 | 110 | @Output('onDeSelectAll') 111 | onDeSelectAll: EventEmitter> = new EventEmitter>(); 112 | 113 | private onTouchedCallback: () => void = noop; 114 | private onChangeCallback: (_: any) => void = noop; 115 | 116 | onFilterTextChange($event) { 117 | this.onFilterChange.emit($event); 118 | } 119 | 120 | constructor(private cdr: ChangeDetectorRef) {} 121 | 122 | onItemClick($event: any, item: ListItem) { 123 | if (this.disabled) { 124 | return false; 125 | } 126 | 127 | const found = this.isSelected(item); 128 | const allowAdd = 129 | this._settings.limitSelection === -1 || 130 | (this._settings.limitSelection > 0 && 131 | this.selectedItems.length < this._settings.limitSelection); 132 | if (!found) { 133 | if (allowAdd) { 134 | this.addSelected(item); 135 | } 136 | } else { 137 | this.removeSelected(item); 138 | } 139 | if ( 140 | this._settings.singleSelection && 141 | this._settings.closeDropDownOnSelection 142 | ) { 143 | this.closeDropdown(); 144 | } 145 | } 146 | 147 | writeValue(value: any) { 148 | if (value !== undefined && value !== null && value.length > 0) { 149 | if (this._settings.singleSelection) { 150 | try { 151 | if (value.length >= 1) { 152 | const firstItem = value[0]; 153 | this.selectedItems = [ 154 | typeof firstItem === 'string' 155 | ? new ListItem(firstItem) 156 | : new ListItem({ 157 | id: firstItem[this._settings.idField], 158 | text: firstItem[this._settings.textField] 159 | }) 160 | ]; 161 | } 162 | } catch (e) { 163 | // console.error(e.body.msg); 164 | } 165 | } else { 166 | const _data = value.map( 167 | (item: any) => 168 | typeof item === 'string' 169 | ? new ListItem(item) 170 | : new ListItem({ 171 | id: item[this._settings.idField], 172 | text: item[this._settings.textField] 173 | }) 174 | ); 175 | if (this._settings.limitSelection > 0) { 176 | this.selectedItems = _data.splice(0, this._settings.limitSelection); 177 | } else { 178 | this.selectedItems = _data; 179 | } 180 | } 181 | } else { 182 | this.selectedItems = []; 183 | } 184 | this.onChangeCallback(value); 185 | } 186 | 187 | // From ControlValueAccessor interface 188 | registerOnChange(fn: any) { 189 | this.onChangeCallback = fn; 190 | } 191 | 192 | // From ControlValueAccessor interface 193 | registerOnTouched(fn: any) { 194 | this.onTouchedCallback = fn; 195 | } 196 | 197 | // Set touched on blur 198 | @HostListener('blur') 199 | public onTouched() { 200 | this.closeDropdown(); 201 | this.onTouchedCallback(); 202 | } 203 | 204 | trackByFn(index, item) { 205 | return item.id; 206 | } 207 | 208 | isSelected(clickedItem: ListItem) { 209 | let found = false; 210 | this.selectedItems.forEach(item => { 211 | if (clickedItem.id === item.id) { 212 | found = true; 213 | } 214 | }); 215 | return found; 216 | } 217 | 218 | isLimitSelectionReached(): boolean { 219 | return this._settings.limitSelection === this.selectedItems.length; 220 | } 221 | 222 | isAllItemsSelected(): boolean { 223 | return this._data.length === this.selectedItems.length; 224 | } 225 | 226 | showButton(): boolean { 227 | if (!this._settings.singleSelection) { 228 | if (this._settings.limitSelection > 0) { 229 | return false; 230 | } 231 | // this._settings.enableCheckAll = this._settings.limitSelection === -1 ? true : false; 232 | return true; // !this._settings.singleSelection && this._settings.enableCheckAll && this._data.length > 0; 233 | } else { 234 | // should be disabled in single selection mode 235 | return false; 236 | } 237 | } 238 | 239 | itemShowRemaining(): number { 240 | return this.selectedItems.length - this._settings.itemsShowLimit; 241 | } 242 | 243 | addSelected(item: ListItem) { 244 | if (this._settings.singleSelection) { 245 | this.selectedItems = []; 246 | this.selectedItems.push(item); 247 | } else { 248 | this.selectedItems.push(item); 249 | } 250 | this.onChangeCallback(this.emittedValue(this.selectedItems)); 251 | this.onSelect.emit(this.emittedValue(item)); 252 | } 253 | 254 | removeSelected(itemSel: ListItem) { 255 | this.selectedItems.forEach(item => { 256 | if (itemSel.id === item.id) { 257 | this.selectedItems.splice(this.selectedItems.indexOf(item), 1); 258 | } 259 | }); 260 | this.onChangeCallback(this.emittedValue(this.selectedItems)); 261 | this.onDeSelect.emit(this.emittedValue(itemSel)); 262 | } 263 | 264 | emittedValue(val: any): any { 265 | const selected = []; 266 | if (Array.isArray(val)) { 267 | val.map(item => { 268 | if (item.id === item.text) { 269 | selected.push(item.text); 270 | } else { 271 | selected.push(this.objectify(item)); 272 | } 273 | }); 274 | } else { 275 | if (val) { 276 | if (val.id === val.text) { 277 | return val.text; 278 | } else { 279 | return this.objectify(val); 280 | } 281 | } 282 | } 283 | return selected; 284 | } 285 | 286 | objectify(val: ListItem) { 287 | const obj = {}; 288 | obj[this._settings.idField] = val.id; 289 | obj[this._settings.textField] = val.text; 290 | return obj; 291 | } 292 | 293 | toggleDropdown(evt) { 294 | evt.preventDefault(); 295 | if (this.disabled && this._settings.singleSelection) { 296 | return; 297 | } 298 | this._settings.defaultOpen = !this._settings.defaultOpen; 299 | if (!this._settings.defaultOpen) { 300 | this.onDropDownClose.emit(); 301 | } 302 | } 303 | 304 | closeDropdown() { 305 | this._settings.defaultOpen = false; 306 | // clear search text 307 | if (this._settings.clearSearchFilter) { 308 | this.filter.text = ''; 309 | } 310 | this.onDropDownClose.emit(); 311 | } 312 | 313 | toggleSelectAll() { 314 | if (this.disabled) { 315 | return false; 316 | } 317 | if (!this.isAllItemsSelected()) { 318 | this.selectedItems = this._data.slice(); 319 | this.onSelectAll.emit(this.emittedValue(this.selectedItems)); 320 | } else { 321 | this.selectedItems = []; 322 | this.onDeSelectAll.emit(this.emittedValue(this.selectedItems)); 323 | } 324 | this.onChangeCallback(this.emittedValue(this.selectedItems)); 325 | } 326 | } 327 | -------------------------------------------------------------------------------- /src/ng-multiselect-dropdown/test/multi-select.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { Component, Type, ViewChild, DebugElement } from '@angular/core'; 2 | import { FormsModule } from '@angular/forms'; 3 | import { ComponentFixture, fakeAsync } from '@angular/core/testing'; 4 | import { By } from '@angular/platform-browser'; 5 | import { MultiSelectComponent } from './../src/multiselect.component'; 6 | import { createTestingModule, tickAndDetectChanges } from './helper'; 7 | 8 | @Component({ 9 | template: `` 10 | }) 11 | class Ng2MultiSelectDropdownSingleSelect { 12 | @ViewChild(MultiSelectComponent) 13 | select: MultiSelectComponent; 14 | cities = [ 15 | { item_id: 1, item_text: 'Mumbai' }, 16 | { item_id: 2, item_text: 'Bangalore' }, 17 | { item_id: 3, item_text: 'Pune' }, 18 | { item_id: 4, item_text: 'Navsari' }, 19 | { item_id: 5, item_text: 'New Delhi' } 20 | ]; 21 | selectedItem = [{ item_id: 4, item_text: 'Navsari' }]; 22 | dropdownSettings = { 23 | singleSelection: true, 24 | idField: 'item_id', 25 | textField: 'item_text', 26 | selectAllText: 'Select All', 27 | unSelectAllText: 'UnSelect All', 28 | badgeShowLimit: 3, 29 | disabled: false, 30 | allowSearchFilter: false, 31 | closeDropDownOnSelection: true 32 | }; 33 | } 34 | @Component({ 35 | template: `` 36 | }) 37 | class Ng2MultiSelectDropdownMultipleSelect { 38 | @ViewChild(MultiSelectComponent) 39 | select: MultiSelectComponent; 40 | cities = [ 41 | { item_id: 1, item_text: 'Mumbai' }, 42 | { item_id: 2, item_text: 'Bangalore' }, 43 | { item_id: 3, item_text: 'Pune' }, 44 | { item_id: 4, item_text: 'Navsari' }, 45 | { item_id: 5, item_text: 'New Delhi' } 46 | ]; 47 | selectedItem = [ 48 | { item_id: 1, item_text: 'Mumbai' }, 49 | { item_id: 4, item_text: 'Navsari' } 50 | ]; 51 | dropdownSettings = { 52 | singleSelection: false, 53 | idField: 'item_id', 54 | textField: 'item_text', 55 | selectAllText: 'Select All', 56 | unSelectAllText: 'UnSelect All', 57 | badgeShowLimit: 3, 58 | disabled: false, 59 | allowSearchFilter: true, 60 | closeDropDownOnSelection: true 61 | }; 62 | } 63 | describe('ng-multiselect-component', function() { 64 | describe('Single Selection', () => { 65 | let fixture: ComponentFixture; 66 | beforeEach(fakeAsync(() => { 67 | fixture = createTestingModule( 68 | Ng2MultiSelectDropdownSingleSelect, 69 | `
70 | 74 | 75 |
` 76 | ); 77 | })); 78 | it('should update internal model on select an item', fakeAsync(() => { 79 | let index = 4; 80 | let selCheckBoxes: HTMLLIElement[]; 81 | const sel = fixture.nativeElement.querySelectorAll( 82 | '.multiselect-item-checkbox' 83 | ); 84 | selCheckBoxes = Array.from(sel); 85 | selCheckBoxes[index].click(); 86 | tickAndDetectChanges(fixture); 87 | expect(fixture.componentInstance.selectedItem.length).toBe(1); 88 | let selItem = fixture.componentInstance.cities[index]; 89 | expect(fixture.componentInstance.selectedItem[0]).toEqual(selItem); 90 | 91 | index = 3; 92 | selCheckBoxes[index].click(); 93 | tickAndDetectChanges(fixture); 94 | expect(fixture.componentInstance.selectedItem.length).toBe(1); 95 | selItem = fixture.componentInstance.cities[index]; 96 | expect(fixture.componentInstance.selectedItem[0]).toEqual(selItem); 97 | 98 | index = 4; 99 | selCheckBoxes[index].click(); 100 | tickAndDetectChanges(fixture); 101 | expect(fixture.componentInstance.selectedItem.length).toBe(1); 102 | selItem = fixture.componentInstance.cities[index]; 103 | expect(fixture.componentInstance.selectedItem[0]).toEqual(selItem); 104 | })); 105 | 106 | it('should dropdown gets close once item is selected', fakeAsync(() => { 107 | tickAndDetectChanges(fixture); 108 | const selDropdown: HTMLElement = fixture.nativeElement.querySelector( 109 | '.multiselect-dropdown' 110 | ); 111 | selDropdown.click(); 112 | tickAndDetectChanges(fixture); 113 | expect(fixture.componentInstance.select._settings.defaultOpen).toBe( 114 | false 115 | ); 116 | })); 117 | 118 | it('selected item should be correct', fakeAsync(() => { 119 | expect(fixture.componentInstance.selectedItem.length).toBe(1); 120 | const selItem = fixture.componentInstance.cities[3]; 121 | expect(fixture.componentInstance.selectedItem[0]).toEqual(selItem); 122 | })); 123 | it('should have default placeholder as "Select"', () => { 124 | const de: DebugElement = fixture.debugElement.query( 125 | By.css('.dropdown-btn>span') 126 | ); 127 | const el = de.nativeElement; 128 | expect(el.textContent).toContain('Select'); 129 | }); 130 | 131 | it('close dropdown if opened and clicked outside dropdown container', fakeAsync(() => { 132 | fixture.componentInstance.select.isDropdownOpen = true; 133 | const de: DebugElement = fixture.debugElement.query(By.css('.container')); 134 | const el = de.nativeElement; 135 | el.click(); 136 | tickAndDetectChanges(fixture); 137 | expect(fixture.componentInstance.select._settings.defaultOpen).toBe( 138 | false 139 | ); 140 | })); 141 | 142 | // it('search filter should work', () => { 143 | // const inputSearch = fixture.nativeElement.query(By.css('input[type=text]')) as HTMLInputElement; 144 | // inputSearch.value = 'navsari'; 145 | // inputSearch.dispatchEvent(newEvent('input')); 146 | // tickAndDetectChanges(fixture); 147 | // const selItems: HTMLLIElement[] = Array.from(document.querySelectorAll('.multiselect-item-checkbox')); 148 | // expect(selItems.length).toBe(1); 149 | // }); 150 | it('dropdown should not open when component is disabled', fakeAsync(() => { 151 | fixture.componentInstance.select.isDropdownOpen = false; 152 | fixture.componentInstance.dropdownSettings.disabled = true; 153 | const de: DebugElement = fixture.debugElement.query( 154 | By.css('.dropdown-btn') 155 | ); 156 | const el = de.nativeElement; 157 | tickAndDetectChanges(fixture); 158 | expect(fixture.componentInstance.select.isDropdownOpen).toBe(false); 159 | })); 160 | }); 161 | describe('Multiple Selection', () => { 162 | let fixture: ComponentFixture; 163 | beforeEach(fakeAsync(() => { 164 | fixture = createTestingModule( 165 | Ng2MultiSelectDropdownMultipleSelect, 166 | `
167 | 171 | 172 |
` 173 | ); 174 | })); 175 | // it('should update internal model on select an item', fakeAsync(() => { 176 | // let index = 4; 177 | // let selCheckBoxes: HTMLLIElement[]; 178 | // const sel = fixture.nativeElement.querySelectorAll('.multiselect-item-checkbox'); 179 | // selCheckBoxes = Array.from(sel); 180 | // selCheckBoxes[index].click(); 181 | // tickAndDetectChanges(fixture); 182 | // expect(fixture.componentInstance.selectedItem.length).toBe(1); 183 | // let selItem = fixture.componentInstance.cities[index]; 184 | // expect(fixture.componentInstance.selectedItem[0]).toEqual(selItem); 185 | 186 | // index = 3; 187 | // selCheckBoxes[index].click(); 188 | // tickAndDetectChanges(fixture); 189 | // expect(fixture.componentInstance.selectedItem.length).toBe(1); 190 | // selItem = fixture.componentInstance.cities[index]; 191 | // expect(fixture.componentInstance.selectedItem[0]).toEqual(selItem); 192 | 193 | // index = 4; 194 | // selCheckBoxes[index].click(); 195 | // tickAndDetectChanges(fixture); 196 | // expect(fixture.componentInstance.selectedItem.length).toBe(1); 197 | // selItem = fixture.componentInstance.cities[index]; 198 | // expect(fixture.componentInstance.selectedItem[0]).toEqual(selItem); 199 | // })); 200 | 201 | it('should dropdown gets close once item is selected', fakeAsync(() => { 202 | tickAndDetectChanges(fixture); 203 | const selDropdown: HTMLElement = fixture.nativeElement.querySelector( 204 | '.multiselect-dropdown' 205 | ); 206 | selDropdown.click(); 207 | tickAndDetectChanges(fixture); 208 | expect(fixture.componentInstance.select._settings.defaultOpen).toBe( 209 | false 210 | ); 211 | })); 212 | 213 | it('selected item should be correct', fakeAsync(() => { 214 | expect(fixture.componentInstance.selectedItem.length).toBe(2); 215 | // const selItem = fixture.componentInstance.cities[3]; 216 | // expect(fixture.componentInstance.selectedItem[0]).toEqual(selItem); 217 | })); 218 | it('should have default placeholder as "Select"', () => { 219 | const de: DebugElement = fixture.debugElement.query( 220 | By.css('.dropdown-btn>span') 221 | ); 222 | const el = de.nativeElement; 223 | expect(el.textContent).toContain('Select'); 224 | }); 225 | it('should have default placeholder for search textbox as "Search"', () => { 226 | const de: DebugElement = fixture.debugElement.query( 227 | By.css('.filter-textbox>input') 228 | ); 229 | const el = de.nativeElement; 230 | expect(el.placeholder).toBe('Search'); 231 | }); 232 | it('close dropdown if opened and clicked outside dropdown container', fakeAsync(() => { 233 | fixture.componentInstance.select.isDropdownOpen = true; 234 | const de: DebugElement = fixture.debugElement.query(By.css('.container')); 235 | const el = de.nativeElement; 236 | el.click(); 237 | tickAndDetectChanges(fixture); 238 | expect(fixture.componentInstance.select._settings.defaultOpen).toBe( 239 | false 240 | ); 241 | })); 242 | 243 | it('should have custom placeholder for "select all text" button', () => { 244 | const de: DebugElement = fixture.debugElement.query( 245 | By.css('.item1>li>div') 246 | ); 247 | const el = de.nativeElement; 248 | expect(el.textContent).toContain('Select All'); 249 | }); 250 | }); 251 | }); 252 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Angular Multiselect Dropdown 2 | 3 | [![npm version](https://img.shields.io/npm/v/ng-multiselect-dropdown.svg)](https://www.npmjs.com/package/ng-multiselect-dropdown) 4 | [![downloads](https://img.shields.io/npm/dt/ng-multiselect-dropdown.svg)](https://www.npmjs.com/package/ng-multiselect-dropdown) 5 | [![downloads](https://img.shields.io/npm/dm/ng-multiselect-dropdown.svg)](https://www.npmjs.com/package/ng-multiselect-dropdown) 6 | 7 | Angular multiselect dropdown component for web applications. Easy to integrate and use. It can be bind to any custom data source. 8 | 9 | # [Demo](https://nileshpatel17.github.io/ng-multiselect-dropdown/) 10 | 11 | ![demo](Screenshots/ng-multiselect-dropdown_v0.1.6.gif) 12 | 13 | ## Getting Started 14 | 15 | ## Features 16 | 17 | - dropdown with single/multiple selction option 18 | - bind to any custom data source 19 | - search item with custom placeholder text 20 | - limit selection 21 | - select/de-select all items 22 | 23 | ### Installation 24 | 25 | ``` 26 | npm install ng-multiselect-dropdown 27 | ``` 28 | 29 | And then include it in your module (see [app.module.ts](https://github.com/NileshPatel17/ng-multiselect-dropdown/blob/master/src/app/app.module.ts)): 30 | 31 | ```ts 32 | import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown'; 33 | // ... 34 | 35 | @NgModule({ 36 | imports: [ 37 | NgMultiSelectDropDownModule.forRoot() 38 | // ... 39 | ] 40 | // ... 41 | }) 42 | export class AppModule {} 43 | ``` 44 | 45 | ### Usage 46 | 47 | ```ts 48 | import { Component, OnInit } from '@angular/core'; 49 | 50 | export class AppComponent implements OnInit { 51 | dropdownList = []; 52 | selectedItems = []; 53 | dropdownSettings = {}; 54 | ngOnInit() { 55 | this.dropdownList = [ 56 | { item_id: 1, item_text: 'Mumbai' }, 57 | { item_id: 2, item_text: 'Bangaluru' }, 58 | { item_id: 3, item_text: 'Pune' }, 59 | { item_id: 4, item_text: 'Navsari' }, 60 | { item_id: 5, item_text: 'New Delhi' } 61 | ]; 62 | this.selectedItems = [ 63 | { item_id: 3, item_text: 'Pune' }, 64 | { item_id: 4, item_text: 'Navsari' } 65 | ]; 66 | this.dropdownSettings = { 67 | singleSelection: false, 68 | idField: 'item_id', 69 | textField: 'item_text', 70 | selectAllText: 'Select All', 71 | unSelectAllText: 'UnSelect All', 72 | itemsShowLimit: 3, 73 | allowSearchFilter: true 74 | }; 75 | } 76 | onItemSelect(item: any) { 77 | console.log(item); 78 | } 79 | onSelectAll(items: any) { 80 | console.log(items); 81 | } 82 | } 83 | ``` 84 | 85 | ```html 86 | 94 | 95 | ``` 96 | 97 | ### Settings 98 | 99 | | Setting | Type | Description | Default Value | 100 | | :----------------------------- | :--------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------ | 101 | | singleSelection | Boolean | Mode of this component. If set `true` user can select more than one option. | false | 102 | | placeholder | String | Text to be show in the dropdown, when no items are selected. | 'Select' | 103 | | disabled | Boolean | Disable the dropdown | false | 104 | | data | Array | Array of items from which to select. Should be an array of objects with id and `text` properties. You can also use custom properties. In that case you need to map idField and `textField` properties. As convenience, you may also pass an array of strings, in which case the same string is used for both the ID and the text(no mapping is required) | n/a | 105 | | idField | String | map id field in case of custom array of object | 'id' | 106 | | textField | String | map text field in case of custom array of object | 'text' | 107 | | enableCheckAll | Boolean | Enable the option to select all items in list | false | 108 | | selectAllText | String | Text to display as the label of select all option | Select All | 109 | | unSelectAllText | String | Text to display as the label of unSelect option | UnSelect All | 110 | | allowSearchFilter | Boolean | Enable filter option for the list. | false | 111 | | searchPlaceholderText | String | custom search placeholder | Search | 112 | | clearSearchFilter | Boolean | clear search filter on dropdown close | true | 113 | | maxHeight | Number | Set maximum height of the dropdown list in px. | 197 | 114 | | itemsShowLimit | Number | Limit the number of items to show in the input field. If not set will show all selected. | All | 115 | | limitSelection | Number | Limit the selection of number of items from the dropdown list. Once the limit is reached, all unselected items gets disabled. | none | 116 | | searchPlaceholderText | String | Custom text for the search placeholder text. Default value would be 'Search' | 'Search' | 117 | | noDataAvailablePlaceholderText | String | Custom text when no data is available. | 'No data available' | 118 | | closeDropDownOnSelection | Boolean | Closes the dropdown when item is selected. applicable only in cas of single selection | false | 119 | | defaultOpen | Boolean | open state of dropdown | false | 120 | 121 | ### Callback Methods 122 | 123 | - `onSelect` - Return the selected item when an item is checked. 124 | Example : (onSelect)="onItemSelect($event)" 125 | - `onSelectAll` - Return the all items. 126 | Example : (onSelectAll)="onSelectAll($event)". 127 | - `onDeSelect` - Return the unselected item when an item is unchecked. 128 | Example : (onDeSelect)="onItemDeSelect($event)" 129 | - `onFilterChange` - Return the key press. 130 | Example : (onFilterChange)="onFilterChange($event)" 131 | - `onDropdownClose`- 132 | Example : (onDropdownClose)="onDropdownClose()" 133 | 134 | ## Run locally 135 | 136 | - Clone the repository or downlod the .zip,.tar files. 137 | - Run `npm install` 138 | - Run `ng serve` for a dev server 139 | - Navigate to `http://localhost:4200/` 140 | 141 | ## Library Build / NPM Package 142 | 143 | Run `yarn build:lib` to build the library and generate an NPM package. The build artifacts will be stored in the dist-lib/ folder. 144 | 145 | ## Running unit tests 146 | 147 | Run `yarn test` to execute the unit tests. 148 | 149 | ## Development 150 | 151 | This project was generated with Angular CLI version 1.7.1. 152 | 153 | ## Contributions 154 | 155 | Contributions are welcome, please open an issue and preferrably file a pull request. 156 | 157 | ### Opening Issue 158 | 159 | Please share sample code using codesandbox.com or stackblitz.com to help me re-produce the issue. 160 | 161 | ## License 162 | 163 | MIT License. 164 | -------------------------------------------------------------------------------- /src/assets/hljs.min.js: -------------------------------------------------------------------------------- 1 | /*! highlight.js v9.9.0 | BSD3 License | git.io/hljslicense */ 2 | !function(e){var t="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):t&&(t.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return t.hljs}))}(function(e){function t(e){return e.replace(/[&<>]/gm,function(e){return L[e]})}function r(e){return e.nodeName.toLowerCase()}function a(e,t){var r=e&&e.exec(t);return r&&0===r.index}function n(e){return C.test(e)}function i(e){var t,r,a,i,s=e.className+" ";if(s+=e.parentNode?e.parentNode.className:"",r=E.exec(s))return y(r[1])?r[1]:"no-highlight";for(s=s.split(/\s+/),t=0,a=s.length;a>t;t++)if(i=s[t],n(i)||y(i))return i}function s(e,t){var r,a={};for(r in e)a[r]=e[r];if(t)for(r in t)a[r]=t[r];return a}function c(e){var t=[];return function a(e,n){for(var i=e.firstChild;i;i=i.nextSibling)3===i.nodeType?n+=i.nodeValue.length:1===i.nodeType&&(t.push({event:"start",offset:n,node:i}),n=a(i,n),r(i).match(/br|hr|img|input/)||t.push({event:"stop",offset:n,node:i}));return n}(e,0),t}function o(e,a,n){function i(){return e.length&&a.length?e[0].offset!==a[0].offset?e[0].offset"}function c(e){u+=""}function o(e){("start"===e.event?s:c)(e.node)}for(var l=0,u="",d=[];e.length||a.length;){var b=i();if(u+=t(n.substring(l,b[0].offset)),l=b[0].offset,b===e){d.reverse().forEach(c);do o(b.splice(0,1)[0]),b=i();while(b===e&&b.length&&b[0].offset===l);d.reverse().forEach(s)}else"start"===b[0].event?d.push(b[0].node):d.pop(),o(b.splice(0,1)[0])}return u+t(n.substr(l))}function l(e){function t(e){return e&&e.source||e}function r(r,a){return new RegExp(t(r),"m"+(e.cI?"i":"")+(a?"g":""))}function a(n,i){if(!n.compiled){if(n.compiled=!0,n.k=n.k||n.bK,n.k){var c={},o=function(t,r){e.cI&&(r=r.toLowerCase()),r.split(" ").forEach(function(e){var r=e.split("|");c[r[0]]=[t,r[1]?Number(r[1]):1]})};"string"==typeof n.k?o("keyword",n.k):N(n.k).forEach(function(e){o(e,n.k[e])}),n.k=c}n.lR=r(n.l||/\w+/,!0),i&&(n.bK&&(n.b="\\b("+n.bK.split(" ").join("|")+")\\b"),n.b||(n.b=/\B|\b/),n.bR=r(n.b),n.e||n.eW||(n.e=/\B|\b/),n.e&&(n.eR=r(n.e)),n.tE=t(n.e)||"",n.eW&&i.tE&&(n.tE+=(n.e?"|":"")+i.tE)),n.i&&(n.iR=r(n.i)),null==n.r&&(n.r=1),n.c||(n.c=[]);var l=[];n.c.forEach(function(e){e.v?e.v.forEach(function(t){l.push(s(e,t))}):l.push("self"===e?n:e)}),n.c=l,n.c.forEach(function(e){a(e,n)}),n.starts&&a(n.starts,i);var u=n.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([n.tE,n.i]).map(t).filter(Boolean);n.t=u.length?r(u.join("|"),!0):{exec:function(){return null}}}}a(e)}function u(e,r,n,i){function s(e,t){var r,n;for(r=0,n=t.c.length;n>r;r++)if(a(t.c[r].bR,e))return t.c[r]}function c(e,t){if(a(e.eR,t)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?c(e.parent,t):void 0}function o(e,t){return!n&&a(t.iR,e)}function b(e,t){var r=v.cI?t[0].toLowerCase():t[0];return e.k.hasOwnProperty(r)&&e.k[r]}function p(e,t,r,a){var n=a?"":S.classPrefix,i='',i+t+s}function m(){var e,r,a,n;if(!N.k)return t(E);for(n="",r=0,N.lR.lastIndex=0,a=N.lR.exec(E);a;)n+=t(E.substring(r,a.index)),e=b(N,a),e?(M+=e[1],n+=p(e[0],t(a[0]))):n+=t(a[0]),r=N.lR.lastIndex,a=N.lR.exec(E);return n+t(E.substr(r))}function f(){var e="string"==typeof N.sL;if(e&&!k[N.sL])return t(E);var r=e?u(N.sL,E,!0,x[N.sL]):d(E,N.sL.length?N.sL:void 0);return N.r>0&&(M+=r.r),e&&(x[N.sL]=r.top),p(r.language,r.value,!1,!0)}function g(){C+=null!=N.sL?f():m(),E=""}function _(e){C+=e.cN?p(e.cN,"",!0):"",N=Object.create(e,{parent:{value:N}})}function h(e,t){if(E+=e,null==t)return g(),0;var r=s(t,N);if(r)return r.skip?E+=t:(r.eB&&(E+=t),g(),r.rB||r.eB||(E=t)),_(r,t),r.rB?0:t.length;var a=c(N,t);if(a){var n=N;n.skip?E+=t:(n.rE||n.eE||(E+=t),g(),n.eE&&(E=t));do N.cN&&(C+=B),N.skip||(M+=N.r),N=N.parent;while(N!==a.parent);return a.starts&&_(a.starts,""),n.rE?0:t.length}if(o(t,N))throw new Error('Illegal lexeme "'+t+'" for mode "'+(N.cN||"")+'"');return E+=t,t.length||1}var v=y(e);if(!v)throw new Error('Unknown language: "'+e+'"');l(v);var w,N=i||v,x={},C="";for(w=N;w!==v;w=w.parent)w.cN&&(C=p(w.cN,"",!0)+C);var E="",M=0;try{for(var L,R,A=0;;){if(N.t.lastIndex=A,L=N.t.exec(r),!L)break;R=h(r.substring(A,L.index),L[0]),A=L.index+R}for(h(r.substr(A)),w=N;w.parent;w=w.parent)w.cN&&(C+=B);return{r:M,value:C,language:e,top:N}}catch($){if($.message&&-1!==$.message.indexOf("Illegal"))return{r:0,value:t(r)};throw $}}function d(e,r){r=r||S.languages||N(k);var a={r:0,value:t(e)},n=a;return r.filter(y).forEach(function(t){var r=u(t,e,!1);r.language=t,r.r>n.r&&(n=r),r.r>a.r&&(n=a,a=r)}),n.language&&(a.second_best=n),a}function b(e){return S.tabReplace||S.useBR?e.replace(M,function(e,t){return S.useBR&&"\n"===e?"
":S.tabReplace?t.replace(/\t/g,S.tabReplace):void 0}):e}function p(e,t,r){var a=t?x[t]:r,n=[e.trim()];return e.match(/\bhljs\b/)||n.push("hljs"),-1===e.indexOf(a)&&n.push(a),n.join(" ").trim()}function m(e){var t,r,a,s,l,m=i(e);n(m)||(S.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div"),t.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):t=e,l=t.textContent,a=m?u(m,l,!0):d(l),r=c(t),r.length&&(s=document.createElementNS("http://www.w3.org/1999/xhtml","div"),s.innerHTML=a.value,a.value=o(r,c(s),l)),a.value=b(a.value),e.innerHTML=a.value,e.className=p(e.className,m,a.language),e.result={language:a.language,re:a.r},a.second_best&&(e.second_best={language:a.second_best.language,re:a.second_best.r}))}function f(e){S=s(S,e)}function g(){if(!g.called){g.called=!0;var e=document.querySelectorAll("pre code");w.forEach.call(e,m)}}function _(){addEventListener("DOMContentLoaded",g,!1),addEventListener("load",g,!1)}function h(t,r){var a=k[t]=r(e);a.aliases&&a.aliases.forEach(function(e){x[e]=t})}function v(){return N(k)}function y(e){return e=(e||"").toLowerCase(),k[e]||k[x[e]]}var w=[],N=Object.keys,k={},x={},C=/^(no-?highlight|plain|text)$/i,E=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,B="
",S={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},L={"&":"&","<":"<",">":">"};return e.highlight=u,e.highlightAuto=d,e.fixMarkup=b,e.highlightBlock=m,e.configure=f,e.initHighlighting=g,e.initHighlightingOnLoad=_,e.registerLanguage=h,e.listLanguages=v,e.getLanguage=y,e.inherit=s,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(t,r,a){var n=e.inherit({cN:"comment",b:t,e:r,c:[]},a||{});return n.c.push(e.PWM),n.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),n},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e.registerLanguage("apache",function(e){var t={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:!0,c:[e.HCM,{cN:"section",b:""},{cN:"attribute",b:/\w+/,r:0,k:{nomarkup:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"meta",b:"\\s\\[",e:"\\]$"},{cN:"variable",b:"[\\$%]\\{",e:"\\}",c:["self",t]},t,e.QSM]}}],i:/\S/}}),e.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},r={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},a={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\._]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,r,a,t]}}),e.registerLanguage("coffeescript",function(e){var t={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super yield import export from as default await then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",built_in:"npm require console print module global window document"},r="[A-Za-z$_][0-9A-Za-z$_]*",a={cN:"subst",b:/#\{/,e:/}/,k:t},n=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,a]},{b:/"/,e:/"/,c:[e.BE,a]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[a,e.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{b:"@"+r},{sL:"javascript",eB:!0,eE:!0,v:[{b:"```",e:"```"},{b:"`",e:"`"}]}];a.c=n;var i=e.inherit(e.TM,{b:r}),s="(\\(.*\\))?\\s*\\B[-=]>",c={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:t,c:["self"].concat(n)}]};return{aliases:["coffee","cson","iced"],k:t,i:/\/\*/,c:n.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+r+"\\s*=\\s*"+s,e:"[-=]>",rB:!0,c:[i,c]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:s,e:"[-=]>",rB:!0,c:[c]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[i]},i]},{b:r+":",e:":",rB:!0,rE:!0,r:0}])}}),e.registerLanguage("cpp",function(e){var t={cN:"keyword",b:"\\b[a-z\\d_]*_t\\b"},r={cN:"string",v:[{b:'(u8?|U)?L?"',e:'"',i:"\\n",c:[e.BE]},{b:'(u8?|U)?R"',e:'"',c:[e.BE]},{b:"'\\\\?.",e:"'",i:"."}]},a={cN:"number",v:[{b:"\\b(0b[01']+)"},{b:"\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{b:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],r:0},n={cN:"meta",b:/#\s*[a-z]+\b/,e:/$/,k:{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef include"},c:[{b:/\\\n/,r:0},e.inherit(r,{cN:"meta-string"}),{cN:"meta-string",b:"<",e:">",i:"\\n"},e.CLCM,e.CBCM]},i=e.IR+"\\s*\\(",s={keyword:"int float while private char catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr",literal:"true false nullptr NULL"},c=[t,e.CLCM,e.CBCM,a,r];return{aliases:["c","cc","h","c++","h++","hpp"],k:s,i:"",k:s,c:["self",t]},{b:e.IR+"::",k:s},{v:[{b:/=/,e:/;/},{b:/\(/,e:/\)/},{bK:"new throw return else",e:/;/}],k:s,c:c.concat([{b:/\(/,e:/\)/,k:s,c:c.concat(["self"]),r:0}]),r:0},{cN:"function",b:"("+e.IR+"[\\*&\\s]+)+"+i,rB:!0,e:/[{;=]/,eE:!0,k:s,i:/[^\w\s\*&]/,c:[{b:i,rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:s,r:0,c:[e.CLCM,e.CBCM,r,a,t]},e.CLCM,e.CBCM,n]}]),exports:{preprocessor:n,strings:r,k:s}}}),e.registerLanguage("cs",function(e){var t={keyword:"abstract as base bool break byte case catch char checked const continue decimal default delegate do double else enum event explicit extern finally fixed float for foreach goto if implicit in int interface internal is lock long object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this try typeof uint ulong unchecked unsafe ushort using virtual void volatile while nameof add alias ascending async await by descending dynamic equals from get global group into join let on orderby partial remove select set value var where yield",literal:"null false true"},r={cN:"string",b:'@"',e:'"',c:[{b:'""'}]},a=e.inherit(r,{i:/\n/}),n={cN:"subst",b:"{",e:"}",k:t},i=e.inherit(n,{i:/\n/}),s={cN:"string",b:/\$"/,e:'"',i:/\n/,c:[{b:"{{"},{b:"}}"},e.BE,i]},c={cN:"string",b:/\$@"/,e:'"',c:[{b:"{{"},{b:"}}"},{b:'""'},n]},o=e.inherit(c,{i:/\n/,c:[{b:"{{"},{b:"}}"},{b:'""'},i]});n.c=[c,s,r,e.ASM,e.QSM,e.CNM,e.CBCM],i.c=[o,s,a,e.ASM,e.QSM,e.CNM,e.inherit(e.CBCM,{i:/\n/})];var l={v:[c,s,r,e.ASM,e.QSM]},u=e.IR+"(<"+e.IR+"(\\s*,\\s*"+e.IR+")*>)?(\\[\\])?";return{aliases:["csharp"],k:t,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:""},{b:""}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},l,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+u+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,r:0,c:[l,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}}),e.registerLanguage("css",function(e){var t="[a-zA-Z-][a-zA-Z0-9_-]*",r={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:t,r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,r]}]}}),e.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"meta",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"comment",v:[{b:/Index: /,e:/$/},{b:/={3,}/,e:/$/},{b:/^\-{3}/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+{3}/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"addition",b:"^\\!",e:"$"}]}}),e.registerLanguage("http",function(e){var t="HTTP/[0-9\\.]+";return{aliases:["https"],i:"\\S",c:[{b:"^"+t,e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{b:"^[A-Z]+ (.*?) "+t+"$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0},{b:t},{cN:"keyword",b:"[A-Z]+"}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{e:"$",r:0}},{b:"\\n\\n",starts:{sL:[],eW:!0}}]}}),e.registerLanguage("ini",function(e){var t={cN:"string",c:[e.BE],v:[{b:"'''",e:"'''",r:10},{b:'"""',e:'"""',r:10},{b:'"',e:'"'},{b:"'",e:"'"}]};return{aliases:["toml"],cI:!0,i:/\S/,c:[e.C(";","$"),e.HCM,{cN:"section",b:/^\s*\[+/,e:/\]+/},{b:/^[a-z0-9\[\]_-]+\s*=\s*/,e:"$",rB:!0,c:[{cN:"attr",b:/[a-z0-9\[\]_-]+/},{b:/=/,eW:!0,r:0,c:[{cN:"literal",b:/\bon|off|true|false|yes|no\b/},{cN:"variable",v:[{b:/\$[\w\d"][\w\d_]*/},{b:/\$\{(.*?)}/}]},t,{cN:"number",b:/([\+\-]+)?[\d]+_[\d_]+/},e.NM]}]}]}}),e.registerLanguage("java",function(e){var t="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=t+"(<"+t+"(\\s*,\\s*"+t+")*>)?",a="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",n="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",i={cN:"number",b:n,r:0};return{aliases:["jsp"],k:a,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+r+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:a,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:a,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},i,{cN:"meta",b:"@[A-Za-z]+"}]}}),e.registerLanguage("javascript",function(e){var t="[A-Za-z$_][0-9A-Za-z$_]*",r={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},a={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},n={cN:"subst",b:"\\$\\{",e:"\\}",k:r,c:[]},i={cN:"string",b:"`",e:"`",c:[e.BE,n]};n.c=[e.ASM,e.QSM,i,a,e.RM];var s=n.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:r,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,i,e.CLCM,e.CBCM,a,{b:/[{,]\s*/,r:0,c:[{b:t+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:t,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+t+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:t},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:r,c:s}]}]},{b://,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:t}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}}),e.registerLanguage("json",function(e){var t={literal:"true false null"},r=[e.QSM,e.CNM],a={e:",",eW:!0,eE:!0,c:r,k:t},n={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(a,{b:/:/})],i:"\\S"},i={b:"\\[",e:"\\]",c:[e.inherit(a)],i:"\\S"};return r.splice(r.length,0,n,i),{c:r,k:t,i:"\\S"}}),e.registerLanguage("makefile",function(e){var t={cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]};return{aliases:["mk","mak"],c:[e.HCM,{b:/^\w+\s*\W*=/,rB:!0,r:0,starts:{e:/\s*\W*=/,eE:!0,starts:{e:/$/,r:0,c:[t]}}},{cN:"section",b:/^[\w]+:\s*$/},{cN:"meta",b:/^\.PHONY:/,e:/$/,k:{"meta-keyword":".PHONY"},l:/[\.\w]+/},{b:/^\t+/,e:/$/,r:0,c:[e.QSM,t]}]}}),e.registerLanguage("xml",function(e){var t="[A-Za-z0-9\\._:-]+",r={eW:!0,i:/`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},e.C("",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[r],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[r],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},r]}]}}),e.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}| )",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:/^\[[^\n]+\]:/,rB:!0,c:[{cN:"symbol",b:/\[/,e:/\]/,eB:!0,eE:!0},{cN:"link",b:/:\s*/,e:/$/,eB:!0}]}]}}),e.registerLanguage("nginx",function(e){var t={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},r={eW:!0,l:"[a-z/_]+",k:{literal:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,t],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0,c:[t]},{cN:"regexp",c:[e.BE,t],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},t]};return{aliases:["nginxconf"],c:[e.HCM,{b:e.UIR+"\\s+{",rB:!0,e:"{",c:[{cN:"section",b:e.UIR}],r:0},{b:e.UIR+"\\s",e:";|{",rB:!0,c:[{cN:"attribute",b:e.UIR,starts:r}],r:0}],i:"[^\\s\\}]"}}),e.registerLanguage("objectivec",function(e){var t={cN:"built_in",b:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},r={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required @encode @package @import @defs @compatibility_alias __bridge __bridge_transfer __bridge_retained __bridge_retain __covariant __contravariant __kindof _Nonnull _Nullable _Null_unspecified __FUNCTION__ __PRETTY_FUNCTION__ __attribute__ getter setter retain unsafe_unretained nonnull nullable null_unspecified null_resettable class instancetype NS_DESIGNATED_INITIALIZER NS_UNAVAILABLE NS_REQUIRES_SUPER NS_RETURNS_INNER_POINTER NS_INLINE NS_AVAILABLE NS_DEPRECATED NS_ENUM NS_OPTIONS NS_SWIFT_UNAVAILABLE NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_REFINED_FOR_SWIFT NS_SWIFT_NAME NS_SWIFT_NOTHROW NS_DURING NS_HANDLER NS_ENDHANDLER NS_VALUERETURN NS_VOIDRETURN",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},a=/[a-zA-Z@][a-zA-Z0-9_]*/,n="@interface @class @protocol @implementation";return{aliases:["mm","objc","obj-c"],k:r,l:a,i:""}]}]},{cN:"class",b:"("+n.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:n,l:a,c:[e.UTM]},{b:"\\."+e.UIR,r:0}]}}),e.registerLanguage("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},a={b:"->{",e:"}"},n={v:[{b:/\$\d/},{b:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{b:/[\$%@][^\s\w{]/,r:0}]},i=[e.BE,r,n],s=[n,e.HCM,e.C("^\\=\\w","\\=cut",{eW:!0}),a,{cN:"string",c:i,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"function",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",eE:!0,r:5,c:[e.TM]},{b:"-\\w\\b",r:0},{b:"^__DATA__$",e:"^__END__$",sL:"mojolicious",c:[{b:"^@@.*",e:"$",cN:"comment"}]}];return r.c=s,a.c=s,{aliases:["pl","pm"],l:/[\w\.]+/,k:t,c:s}}),e.registerLanguage("php",function(e){var t={b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},r={cN:"meta",b:/<\?(php)?|\?>/},a={cN:"string",c:[e.BE,r],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},n={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.HCM,e.C("//","$",{c:[r]}),e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:/<<<['"]?\w+['"]?$/,e:/^\w+;?$/,c:[e.BE,{cN:"subst",v:[{b:/\$\w+/},{b:/\{\$/,e:/\}/}]}]},r,{cN:"keyword",b:/\$this\b/},t,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",t,e.CBCM,a,n]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},a,n]}}),e.registerLanguage("python",function(e){var t={cN:"meta",b:/^(>>>|\.\.\.) /},r={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[t],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[t],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},a={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},n={cN:"params",b:/\(/,e:/\)/,c:["self",t,a,r]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)|=>/,c:[t,a,r,e.HCM,{v:[{cN:"function",bK:"def"},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,n,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}}),e.registerLanguage("ruby",function(e){var t="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r={keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",literal:"true false nil"},a={cN:"doctag",b:"@[A-Za-z]+"},n={b:"#<",e:">"},i=[e.C("#","$",{c:[a]}),e.C("^\\=begin","^\\=end",{c:[a],r:10}),e.C("^__END__","\\n$")],s={cN:"subst",b:"#\\{",e:"}",k:r},c={cN:"string",c:[e.BE,s],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/},{b:/<<(-?)\w+$/,e:/^\s*\w+$/}]},o={cN:"params",b:"\\(",e:"\\)",endsParent:!0,k:r},l=[c,n,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?" 3 | }),{b:"<\\s*",c:[{b:"("+e.IR+"::)?"+e.IR}]}].concat(i)},{cN:"function",bK:"def",e:"$|;",c:[e.inherit(e.TM,{b:t}),o].concat(i)},{b:e.IR+"::"},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":(?!\\s)",c:[c,{b:t}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{cN:"params",b:/\|/,e:/\|/,k:r},{b:"("+e.RSR+"|unless)\\s*",c:[n,{cN:"regexp",c:[e.BE,s],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(i),r:0}].concat(i);s.c=l,o.c=l;var u="[>?]>",d="[\\w#]+\\(\\w+\\):\\d+:\\d+>",b="(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>",p=[{b:/^\s*=>/,starts:{e:"$",c:l}},{cN:"meta",b:"^("+u+"|"+d+"|"+b+")",starts:{e:"$",c:l}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:r,i:/\/\*/,c:i.concat(p).concat(l)}}),e.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*#]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}}),e}); 4 | -------------------------------------------------------------------------------- /src/code-viewer/hljs.min.js: -------------------------------------------------------------------------------- 1 | /*! highlight.js v9.9.0 | BSD3 License | git.io/hljslicense */ 2 | !function(e){var t="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):t&&(t.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return t.hljs}))}(function(e){function t(e){return e.replace(/[&<>]/gm,function(e){return L[e]})}function r(e){return e.nodeName.toLowerCase()}function a(e,t){var r=e&&e.exec(t);return r&&0===r.index}function n(e){return C.test(e)}function i(e){var t,r,a,i,s=e.className+" ";if(s+=e.parentNode?e.parentNode.className:"",r=E.exec(s))return y(r[1])?r[1]:"no-highlight";for(s=s.split(/\s+/),t=0,a=s.length;a>t;t++)if(i=s[t],n(i)||y(i))return i}function s(e,t){var r,a={};for(r in e)a[r]=e[r];if(t)for(r in t)a[r]=t[r];return a}function c(e){var t=[];return function a(e,n){for(var i=e.firstChild;i;i=i.nextSibling)3===i.nodeType?n+=i.nodeValue.length:1===i.nodeType&&(t.push({event:"start",offset:n,node:i}),n=a(i,n),r(i).match(/br|hr|img|input/)||t.push({event:"stop",offset:n,node:i}));return n}(e,0),t}function o(e,a,n){function i(){return e.length&&a.length?e[0].offset!==a[0].offset?e[0].offset"}function c(e){u+=""}function o(e){("start"===e.event?s:c)(e.node)}for(var l=0,u="",d=[];e.length||a.length;){var b=i();if(u+=t(n.substring(l,b[0].offset)),l=b[0].offset,b===e){d.reverse().forEach(c);do o(b.splice(0,1)[0]),b=i();while(b===e&&b.length&&b[0].offset===l);d.reverse().forEach(s)}else"start"===b[0].event?d.push(b[0].node):d.pop(),o(b.splice(0,1)[0])}return u+t(n.substr(l))}function l(e){function t(e){return e&&e.source||e}function r(r,a){return new RegExp(t(r),"m"+(e.cI?"i":"")+(a?"g":""))}function a(n,i){if(!n.compiled){if(n.compiled=!0,n.k=n.k||n.bK,n.k){var c={},o=function(t,r){e.cI&&(r=r.toLowerCase()),r.split(" ").forEach(function(e){var r=e.split("|");c[r[0]]=[t,r[1]?Number(r[1]):1]})};"string"==typeof n.k?o("keyword",n.k):N(n.k).forEach(function(e){o(e,n.k[e])}),n.k=c}n.lR=r(n.l||/\w+/,!0),i&&(n.bK&&(n.b="\\b("+n.bK.split(" ").join("|")+")\\b"),n.b||(n.b=/\B|\b/),n.bR=r(n.b),n.e||n.eW||(n.e=/\B|\b/),n.e&&(n.eR=r(n.e)),n.tE=t(n.e)||"",n.eW&&i.tE&&(n.tE+=(n.e?"|":"")+i.tE)),n.i&&(n.iR=r(n.i)),null==n.r&&(n.r=1),n.c||(n.c=[]);var l=[];n.c.forEach(function(e){e.v?e.v.forEach(function(t){l.push(s(e,t))}):l.push("self"===e?n:e)}),n.c=l,n.c.forEach(function(e){a(e,n)}),n.starts&&a(n.starts,i);var u=n.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([n.tE,n.i]).map(t).filter(Boolean);n.t=u.length?r(u.join("|"),!0):{exec:function(){return null}}}}a(e)}function u(e,r,n,i){function s(e,t){var r,n;for(r=0,n=t.c.length;n>r;r++)if(a(t.c[r].bR,e))return t.c[r]}function c(e,t){if(a(e.eR,t)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?c(e.parent,t):void 0}function o(e,t){return!n&&a(t.iR,e)}function b(e,t){var r=v.cI?t[0].toLowerCase():t[0];return e.k.hasOwnProperty(r)&&e.k[r]}function p(e,t,r,a){var n=a?"":S.classPrefix,i='',i+t+s}function m(){var e,r,a,n;if(!N.k)return t(E);for(n="",r=0,N.lR.lastIndex=0,a=N.lR.exec(E);a;)n+=t(E.substring(r,a.index)),e=b(N,a),e?(M+=e[1],n+=p(e[0],t(a[0]))):n+=t(a[0]),r=N.lR.lastIndex,a=N.lR.exec(E);return n+t(E.substr(r))}function f(){var e="string"==typeof N.sL;if(e&&!k[N.sL])return t(E);var r=e?u(N.sL,E,!0,x[N.sL]):d(E,N.sL.length?N.sL:void 0);return N.r>0&&(M+=r.r),e&&(x[N.sL]=r.top),p(r.language,r.value,!1,!0)}function g(){C+=null!=N.sL?f():m(),E=""}function _(e){C+=e.cN?p(e.cN,"",!0):"",N=Object.create(e,{parent:{value:N}})}function h(e,t){if(E+=e,null==t)return g(),0;var r=s(t,N);if(r)return r.skip?E+=t:(r.eB&&(E+=t),g(),r.rB||r.eB||(E=t)),_(r,t),r.rB?0:t.length;var a=c(N,t);if(a){var n=N;n.skip?E+=t:(n.rE||n.eE||(E+=t),g(),n.eE&&(E=t));do N.cN&&(C+=B),N.skip||(M+=N.r),N=N.parent;while(N!==a.parent);return a.starts&&_(a.starts,""),n.rE?0:t.length}if(o(t,N))throw new Error('Illegal lexeme "'+t+'" for mode "'+(N.cN||"")+'"');return E+=t,t.length||1}var v=y(e);if(!v)throw new Error('Unknown language: "'+e+'"');l(v);var w,N=i||v,x={},C="";for(w=N;w!==v;w=w.parent)w.cN&&(C=p(w.cN,"",!0)+C);var E="",M=0;try{for(var L,R,A=0;;){if(N.t.lastIndex=A,L=N.t.exec(r),!L)break;R=h(r.substring(A,L.index),L[0]),A=L.index+R}for(h(r.substr(A)),w=N;w.parent;w=w.parent)w.cN&&(C+=B);return{r:M,value:C,language:e,top:N}}catch($){if($.message&&-1!==$.message.indexOf("Illegal"))return{r:0,value:t(r)};throw $}}function d(e,r){r=r||S.languages||N(k);var a={r:0,value:t(e)},n=a;return r.filter(y).forEach(function(t){var r=u(t,e,!1);r.language=t,r.r>n.r&&(n=r),r.r>a.r&&(n=a,a=r)}),n.language&&(a.second_best=n),a}function b(e){return S.tabReplace||S.useBR?e.replace(M,function(e,t){return S.useBR&&"\n"===e?"
":S.tabReplace?t.replace(/\t/g,S.tabReplace):void 0}):e}function p(e,t,r){var a=t?x[t]:r,n=[e.trim()];return e.match(/\bhljs\b/)||n.push("hljs"),-1===e.indexOf(a)&&n.push(a),n.join(" ").trim()}function m(e){var t,r,a,s,l,m=i(e);n(m)||(S.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div"),t.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):t=e,l=t.textContent,a=m?u(m,l,!0):d(l),r=c(t),r.length&&(s=document.createElementNS("http://www.w3.org/1999/xhtml","div"),s.innerHTML=a.value,a.value=o(r,c(s),l)),a.value=b(a.value),e.innerHTML=a.value,e.className=p(e.className,m,a.language),e.result={language:a.language,re:a.r},a.second_best&&(e.second_best={language:a.second_best.language,re:a.second_best.r}))}function f(e){S=s(S,e)}function g(){if(!g.called){g.called=!0;var e=document.querySelectorAll("pre code");w.forEach.call(e,m)}}function _(){addEventListener("DOMContentLoaded",g,!1),addEventListener("load",g,!1)}function h(t,r){var a=k[t]=r(e);a.aliases&&a.aliases.forEach(function(e){x[e]=t})}function v(){return N(k)}function y(e){return e=(e||"").toLowerCase(),k[e]||k[x[e]]}var w=[],N=Object.keys,k={},x={},C=/^(no-?highlight|plain|text)$/i,E=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,B="
",S={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},L={"&":"&","<":"<",">":">"};return e.highlight=u,e.highlightAuto=d,e.fixMarkup=b,e.highlightBlock=m,e.configure=f,e.initHighlighting=g,e.initHighlightingOnLoad=_,e.registerLanguage=h,e.listLanguages=v,e.getLanguage=y,e.inherit=s,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(t,r,a){var n=e.inherit({cN:"comment",b:t,e:r,c:[]},a||{});return n.c.push(e.PWM),n.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),n},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e.registerLanguage("apache",function(e){var t={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:!0,c:[e.HCM,{cN:"section",b:""},{cN:"attribute",b:/\w+/,r:0,k:{nomarkup:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"meta",b:"\\s\\[",e:"\\]$"},{cN:"variable",b:"[\\$%]\\{",e:"\\}",c:["self",t]},t,e.QSM]}}],i:/\S/}}),e.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},r={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},a={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\._]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,r,a,t]}}),e.registerLanguage("coffeescript",function(e){var t={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super yield import export from as default await then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",built_in:"npm require console print module global window document"},r="[A-Za-z$_][0-9A-Za-z$_]*",a={cN:"subst",b:/#\{/,e:/}/,k:t},n=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,a]},{b:/"/,e:/"/,c:[e.BE,a]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[a,e.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{b:"@"+r},{sL:"javascript",eB:!0,eE:!0,v:[{b:"```",e:"```"},{b:"`",e:"`"}]}];a.c=n;var i=e.inherit(e.TM,{b:r}),s="(\\(.*\\))?\\s*\\B[-=]>",c={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:t,c:["self"].concat(n)}]};return{aliases:["coffee","cson","iced"],k:t,i:/\/\*/,c:n.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+r+"\\s*=\\s*"+s,e:"[-=]>",rB:!0,c:[i,c]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:s,e:"[-=]>",rB:!0,c:[c]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[i]},i]},{b:r+":",e:":",rB:!0,rE:!0,r:0}])}}),e.registerLanguage("cpp",function(e){var t={cN:"keyword",b:"\\b[a-z\\d_]*_t\\b"},r={cN:"string",v:[{b:'(u8?|U)?L?"',e:'"',i:"\\n",c:[e.BE]},{b:'(u8?|U)?R"',e:'"',c:[e.BE]},{b:"'\\\\?.",e:"'",i:"."}]},a={cN:"number",v:[{b:"\\b(0b[01']+)"},{b:"\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{b:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],r:0},n={cN:"meta",b:/#\s*[a-z]+\b/,e:/$/,k:{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef include"},c:[{b:/\\\n/,r:0},e.inherit(r,{cN:"meta-string"}),{cN:"meta-string",b:"<",e:">",i:"\\n"},e.CLCM,e.CBCM]},i=e.IR+"\\s*\\(",s={keyword:"int float while private char catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr",literal:"true false nullptr NULL"},c=[t,e.CLCM,e.CBCM,a,r];return{aliases:["c","cc","h","c++","h++","hpp"],k:s,i:"",k:s,c:["self",t]},{b:e.IR+"::",k:s},{v:[{b:/=/,e:/;/},{b:/\(/,e:/\)/},{bK:"new throw return else",e:/;/}],k:s,c:c.concat([{b:/\(/,e:/\)/,k:s,c:c.concat(["self"]),r:0}]),r:0},{cN:"function",b:"("+e.IR+"[\\*&\\s]+)+"+i,rB:!0,e:/[{;=]/,eE:!0,k:s,i:/[^\w\s\*&]/,c:[{b:i,rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:s,r:0,c:[e.CLCM,e.CBCM,r,a,t]},e.CLCM,e.CBCM,n]}]),exports:{preprocessor:n,strings:r,k:s}}}),e.registerLanguage("cs",function(e){var t={keyword:"abstract as base bool break byte case catch char checked const continue decimal default delegate do double else enum event explicit extern finally fixed float for foreach goto if implicit in int interface internal is lock long object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this try typeof uint ulong unchecked unsafe ushort using virtual void volatile while nameof add alias ascending async await by descending dynamic equals from get global group into join let on orderby partial remove select set value var where yield",literal:"null false true"},r={cN:"string",b:'@"',e:'"',c:[{b:'""'}]},a=e.inherit(r,{i:/\n/}),n={cN:"subst",b:"{",e:"}",k:t},i=e.inherit(n,{i:/\n/}),s={cN:"string",b:/\$"/,e:'"',i:/\n/,c:[{b:"{{"},{b:"}}"},e.BE,i]},c={cN:"string",b:/\$@"/,e:'"',c:[{b:"{{"},{b:"}}"},{b:'""'},n]},o=e.inherit(c,{i:/\n/,c:[{b:"{{"},{b:"}}"},{b:'""'},i]});n.c=[c,s,r,e.ASM,e.QSM,e.CNM,e.CBCM],i.c=[o,s,a,e.ASM,e.QSM,e.CNM,e.inherit(e.CBCM,{i:/\n/})];var l={v:[c,s,r,e.ASM,e.QSM]},u=e.IR+"(<"+e.IR+"(\\s*,\\s*"+e.IR+")*>)?(\\[\\])?";return{aliases:["csharp"],k:t,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:""},{b:""}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},l,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+u+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,r:0,c:[l,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}}),e.registerLanguage("css",function(e){var t="[a-zA-Z-][a-zA-Z0-9_-]*",r={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:t,r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,r]}]}}),e.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"meta",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"comment",v:[{b:/Index: /,e:/$/},{b:/={3,}/,e:/$/},{b:/^\-{3}/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+{3}/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"addition",b:"^\\!",e:"$"}]}}),e.registerLanguage("http",function(e){var t="HTTP/[0-9\\.]+";return{aliases:["https"],i:"\\S",c:[{b:"^"+t,e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{b:"^[A-Z]+ (.*?) "+t+"$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0},{b:t},{cN:"keyword",b:"[A-Z]+"}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{e:"$",r:0}},{b:"\\n\\n",starts:{sL:[],eW:!0}}]}}),e.registerLanguage("ini",function(e){var t={cN:"string",c:[e.BE],v:[{b:"'''",e:"'''",r:10},{b:'"""',e:'"""',r:10},{b:'"',e:'"'},{b:"'",e:"'"}]};return{aliases:["toml"],cI:!0,i:/\S/,c:[e.C(";","$"),e.HCM,{cN:"section",b:/^\s*\[+/,e:/\]+/},{b:/^[a-z0-9\[\]_-]+\s*=\s*/,e:"$",rB:!0,c:[{cN:"attr",b:/[a-z0-9\[\]_-]+/},{b:/=/,eW:!0,r:0,c:[{cN:"literal",b:/\bon|off|true|false|yes|no\b/},{cN:"variable",v:[{b:/\$[\w\d"][\w\d_]*/},{b:/\$\{(.*?)}/}]},t,{cN:"number",b:/([\+\-]+)?[\d]+_[\d_]+/},e.NM]}]}]}}),e.registerLanguage("java",function(e){var t="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=t+"(<"+t+"(\\s*,\\s*"+t+")*>)?",a="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",n="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",i={cN:"number",b:n,r:0};return{aliases:["jsp"],k:a,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+r+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:a,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:a,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},i,{cN:"meta",b:"@[A-Za-z]+"}]}}),e.registerLanguage("javascript",function(e){var t="[A-Za-z$_][0-9A-Za-z$_]*",r={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},a={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},n={cN:"subst",b:"\\$\\{",e:"\\}",k:r,c:[]},i={cN:"string",b:"`",e:"`",c:[e.BE,n]};n.c=[e.ASM,e.QSM,i,a,e.RM];var s=n.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:r,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,i,e.CLCM,e.CBCM,a,{b:/[{,]\s*/,r:0,c:[{b:t+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:t,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+t+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:t},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:r,c:s}]}]},{b://,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:t}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}}),e.registerLanguage("json",function(e){var t={literal:"true false null"},r=[e.QSM,e.CNM],a={e:",",eW:!0,eE:!0,c:r,k:t},n={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(a,{b:/:/})],i:"\\S"},i={b:"\\[",e:"\\]",c:[e.inherit(a)],i:"\\S"};return r.splice(r.length,0,n,i),{c:r,k:t,i:"\\S"}}),e.registerLanguage("makefile",function(e){var t={cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]};return{aliases:["mk","mak"],c:[e.HCM,{b:/^\w+\s*\W*=/,rB:!0,r:0,starts:{e:/\s*\W*=/,eE:!0,starts:{e:/$/,r:0,c:[t]}}},{cN:"section",b:/^[\w]+:\s*$/},{cN:"meta",b:/^\.PHONY:/,e:/$/,k:{"meta-keyword":".PHONY"},l:/[\.\w]+/},{b:/^\t+/,e:/$/,r:0,c:[e.QSM,t]}]}}),e.registerLanguage("xml",function(e){var t="[A-Za-z0-9\\._:-]+",r={eW:!0,i:/`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},e.C("",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[r],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[r],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},r]}]}}),e.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}| )",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:/^\[[^\n]+\]:/,rB:!0,c:[{cN:"symbol",b:/\[/,e:/\]/,eB:!0,eE:!0},{cN:"link",b:/:\s*/,e:/$/,eB:!0}]}]}}),e.registerLanguage("nginx",function(e){var t={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},r={eW:!0,l:"[a-z/_]+",k:{literal:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,t],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0,c:[t]},{cN:"regexp",c:[e.BE,t],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},t]};return{aliases:["nginxconf"],c:[e.HCM,{b:e.UIR+"\\s+{",rB:!0,e:"{",c:[{cN:"section",b:e.UIR}],r:0},{b:e.UIR+"\\s",e:";|{",rB:!0,c:[{cN:"attribute",b:e.UIR,starts:r}],r:0}],i:"[^\\s\\}]"}}),e.registerLanguage("objectivec",function(e){var t={cN:"built_in",b:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},r={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required @encode @package @import @defs @compatibility_alias __bridge __bridge_transfer __bridge_retained __bridge_retain __covariant __contravariant __kindof _Nonnull _Nullable _Null_unspecified __FUNCTION__ __PRETTY_FUNCTION__ __attribute__ getter setter retain unsafe_unretained nonnull nullable null_unspecified null_resettable class instancetype NS_DESIGNATED_INITIALIZER NS_UNAVAILABLE NS_REQUIRES_SUPER NS_RETURNS_INNER_POINTER NS_INLINE NS_AVAILABLE NS_DEPRECATED NS_ENUM NS_OPTIONS NS_SWIFT_UNAVAILABLE NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_REFINED_FOR_SWIFT NS_SWIFT_NAME NS_SWIFT_NOTHROW NS_DURING NS_HANDLER NS_ENDHANDLER NS_VALUERETURN NS_VOIDRETURN",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},a=/[a-zA-Z@][a-zA-Z0-9_]*/,n="@interface @class @protocol @implementation";return{aliases:["mm","objc","obj-c"],k:r,l:a,i:""}]}]},{cN:"class",b:"("+n.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:n,l:a,c:[e.UTM]},{b:"\\."+e.UIR,r:0}]}}),e.registerLanguage("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},a={b:"->{",e:"}"},n={v:[{b:/\$\d/},{b:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{b:/[\$%@][^\s\w{]/,r:0}]},i=[e.BE,r,n],s=[n,e.HCM,e.C("^\\=\\w","\\=cut",{eW:!0}),a,{cN:"string",c:i,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"function",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",eE:!0,r:5,c:[e.TM]},{b:"-\\w\\b",r:0},{b:"^__DATA__$",e:"^__END__$",sL:"mojolicious",c:[{b:"^@@.*",e:"$",cN:"comment"}]}];return r.c=s,a.c=s,{aliases:["pl","pm"],l:/[\w\.]+/,k:t,c:s}}),e.registerLanguage("php",function(e){var t={b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},r={cN:"meta",b:/<\?(php)?|\?>/},a={cN:"string",c:[e.BE,r],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},n={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.HCM,e.C("//","$",{c:[r]}),e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:/<<<['"]?\w+['"]?$/,e:/^\w+;?$/,c:[e.BE,{cN:"subst",v:[{b:/\$\w+/},{b:/\{\$/,e:/\}/}]}]},r,{cN:"keyword",b:/\$this\b/},t,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",t,e.CBCM,a,n]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},a,n]}}),e.registerLanguage("python",function(e){var t={cN:"meta",b:/^(>>>|\.\.\.) /},r={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[t],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[t],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},a={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},n={cN:"params",b:/\(/,e:/\)/,c:["self",t,a,r]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)|=>/,c:[t,a,r,e.HCM,{v:[{cN:"function",bK:"def"},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,n,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}}),e.registerLanguage("ruby",function(e){var t="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r={keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",literal:"true false nil"},a={cN:"doctag",b:"@[A-Za-z]+"},n={b:"#<",e:">"},i=[e.C("#","$",{c:[a]}),e.C("^\\=begin","^\\=end",{c:[a],r:10}),e.C("^__END__","\\n$")],s={cN:"subst",b:"#\\{",e:"}",k:r},c={cN:"string",c:[e.BE,s],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/},{b:/<<(-?)\w+$/,e:/^\s*\w+$/}]},o={cN:"params",b:"\\(",e:"\\)",endsParent:!0,k:r},l=[c,n,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?" 3 | }),{b:"<\\s*",c:[{b:"("+e.IR+"::)?"+e.IR}]}].concat(i)},{cN:"function",bK:"def",e:"$|;",c:[e.inherit(e.TM,{b:t}),o].concat(i)},{b:e.IR+"::"},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":(?!\\s)",c:[c,{b:t}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{cN:"params",b:/\|/,e:/\|/,k:r},{b:"("+e.RSR+"|unless)\\s*",c:[n,{cN:"regexp",c:[e.BE,s],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(i),r:0}].concat(i);s.c=l,o.c=l;var u="[>?]>",d="[\\w#]+\\(\\w+\\):\\d+:\\d+>",b="(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>",p=[{b:/^\s*=>/,starts:{e:"$",c:l}},{cN:"meta",b:"^("+u+"|"+d+"|"+b+")",starts:{e:"$",c:l}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:r,i:/\/\*/,c:i.concat(p).concat(l)}}),e.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*#]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}}),e}); 4 | --------------------------------------------------------------------------------