Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
plantain-00 committed Feb 5, 2018
1 parent d174932 commit 1a8a8f2
Show file tree
Hide file tree
Showing 11 changed files with 733 additions and 216 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
},
"homepage": "https://github.com/plantain-00/select2-component#readme",
"devDependencies": {
"@angular/compiler": "5.2.2",
"@angular/compiler-cli": "5.2.2",
"@angular/core": "5.2.2",
"@commitlint/cli": "6.0.2",
"@commitlint/config-conventional": "6.0.2",
"@angular/compiler": "5.2.3",
"@angular/compiler-cli": "5.2.3",
"@angular/core": "5.2.3",
"@commitlint/cli": "6.1.0",
"@commitlint/config-conventional": "6.1.0",
"@types/jasmine": "2.8.6",
"@types/puppeteer": "1.0.0",
"autoprefixer": "7.2.5",
"clean-css-cli": "4.1.10",
"clean-scripts": "1.7.0",
"file2variable-cli": "1.8.1",
"file2variable-cli": "1.8.3",
"github-fork-ribbon-css": "0.2.1",
"http-server": "0.11.1",
"jasmine": "2.9.0",
Expand All @@ -43,8 +43,8 @@
"karma-webpack": "2.0.9",
"lerna": "2.8.0",
"less": "2.7.3",
"markdownlint-cli": "0.6.0",
"no-unused-export": "1.4.5",
"markdownlint-cli": "0.7.0",
"no-unused-export": "1.5.0",
"postcss-cli": "4.1.1",
"puppeteer": "1.0.0",
"rev-static": "3.4.1",
Expand All @@ -54,7 +54,7 @@
"stylelint-config-standard": "18.0.0",
"tslint": "5.9.1",
"tslint-config-standard": "7.0.0",
"typescript": "2.6.2",
"typescript": "2.7.1",
"watch-then-execute": "1.1.1",
"webpack": "3.10.0"
},
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/angular/demo/jit/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
</style>
<a class="github-fork-ribbon right-bottom" href="https://github.com/plantain-00/select2-component" title="Fork me on GitHub" target="_blank" rel="noopener">Fork me on GitHub</a>
<app></app>
<script src="./index.bundle-1d88580ae83908ed1c9dc40475ff22cf.js" crossOrigin="anonymous" integrity="sha256-6lhXGSeIRG2yRw5Tu8hL/UK1RTNxsIEfVbsJwzgI9+k="></script>
<script src="./index.bundle-4dbcce4bc9cf3f7e6999530fe5607c49.js" crossOrigin="anonymous" integrity="sha256-SEnP6fRAxp6j1vXYyM3CWkJU3W1PExRowlOrmzPkk9w="></script>
112 changes: 56 additions & 56 deletions packages/angular/src/index.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,52 +29,52 @@ export class Select2Hint { }
})
export class Select2 implements ControlValueAccessor {

/** data of options & optiongrps */
@Input() data: common.Select2Data
/** minimal data of show the search field */
/** data of options & optiongrps */
@Input() data!: common.Select2Data
/** minimal data of show the search field */
@Input() minCountForSearch?: number
@Input() placeholder?: string
@Input() customSearchEnabled?: boolean
@Input() multiple?: boolean

/** use the material style */
/** use the material style */
@Input() material?: '' | true

/** use it for change the pattern of the filter search */
@Input() editPattern: (str: string) => string
/** use it for change the pattern of the filter search */
@Input() editPattern!: (str: string) => string

@Output() update = new EventEmitter()
@Output() open = new EventEmitter()
@Output() search = new EventEmitter()

option: common.Select2Option | common.Select2Option[] | null = null
isOpen = false
searchStyle: string
@ViewChild('selection') selection: ElementRef
@ViewChild('results') private results: ElementRef
@ViewChild('searchInput') private searchInput: ElementRef
searchStyle!: string
@ViewChild('selection') selection!: ElementRef
@ViewChild('results') private results!: ElementRef
@ViewChild('searchInput') private searchInput!: ElementRef
private hoveringValue: common.Select2Value | null | undefined = null
private innerSearchText = ''
private lastScrollTopIndex = 0
private isSearchboxHidden: boolean
private selectionElement: HTMLElement
private searchInputElement: HTMLElement
private resultsElement: HTMLElement
private isSearchboxHidden!: boolean
private selectionElement!: HTMLElement
private searchInputElement!: HTMLElement
private resultsElement!: HTMLElement

// tslint:disable:member-ordering
private _stateChanges = new Subject<void>()

/** Whether the element is focused or not. */
/** Whether the element is focused or not. */
focused = false

/** View -> model callback called when select has been touched */
/** View -> model callback called when select has been touched */
private _onTouched = () => {
// do nothing
// do nothing
}

/** View -> model callback called when value changes */
/** View -> model callback called when value changes */
private _onChange: (value: any) => void = () => {
// do nothing
// do nothing
}

get searchText () {
Expand Down Expand Up @@ -122,35 +122,35 @@ export class Select2 implements ControlValueAccessor {
return common.getSelectionStyle(this.multiple)
}

/** Unique id of the element. */
/** Unique id of the element. */
@Input()
get id () { return this._id }
set id (value: string) { this._id = value || this._uid }

/** Whether the element is required. */
/** Whether the element is required. */
@Input()
get required () { return this._required }
set required (value: any) { this._required = this._coerceBooleanProperty(value) }

/** Whether the element is disabled. */
/** Whether the element is disabled. */
@Input()
get disabled () { return this._control ? this._control.disabled : this._disabled }
set disabled (value: any) { this._disabled = this._coerceBooleanProperty(value) }

/** Whether the element is readonly. */
/** Whether the element is readonly. */
@Input()
get readonly () { return this._readonly }
set readonly (value: any) { this._readonly = this._coerceBooleanProperty(value) }

/** The input element's value. */
/** The input element's value. */
@Input()
get value () { return this._value }
set value (value: common.Select2UpdateValue) {
this._value = value
this.writeValue(value)
}

/** Tab index for the select2 element. */
/** Tab index for the select2 element. */
@Input()
get tabIndex (): number { return this.disabled ? -1 : this._tabIndex }
set tabIndex (value: number) {
Expand All @@ -159,17 +159,17 @@ export class Select2 implements ControlValueAccessor {
}
}

/** Tab index for the element. */
/** Tab index for the element. */
private _tabIndex: number

private _disabled = false
private _required = false
private _readonly = false
private _clickDetection = false
private _clickDetectionFc: (e: MouseEvent) => void
private _id: string
private _id!: string
private _uid: string = `select2-${nextUniqueId++}`
private _value: common.Select2UpdateValue
private _value!: common.Select2UpdateValue
private _previousNativeValue: common.Select2UpdateValue = this._value

constructor (
Expand Down Expand Up @@ -493,41 +493,41 @@ export class Select2 implements ControlValueAccessor {
}
}

/**
* Sets the model value. Implemented as part of ControlValueAccessor.
* @param value
*/
/**
* Sets the model value. Implemented as part of ControlValueAccessor.
* @param value
*/
writeValue (value: any) {
this._setSelectionByValue(value)
}

/**
* Saves a callback function to be invoked when the select's value
* changes from user input. Part of the ControlValueAccessor interface
* required to integrate with Angular's core forms API.
*
* @param fn Callback to be triggered when the value changes.
*/
/**
* Saves a callback function to be invoked when the select's value
* changes from user input. Part of the ControlValueAccessor interface
* required to integrate with Angular's core forms API.
*
* @param fn Callback to be triggered when the value changes.
*/
registerOnChange (fn: (value: any) => void): void {
this._onChange = fn
}

/**
* Saves a callback function to be invoked when the select is blurred
* by the user. Part of the ControlValueAccessor interface required
* to integrate with Angular's core forms API.
*
* @param fn Callback to be triggered when the component has been touched.
*/
/**
* Saves a callback function to be invoked when the select is blurred
* by the user. Part of the ControlValueAccessor interface required
* to integrate with Angular's core forms API.
*
* @param fn Callback to be triggered when the component has been touched.
*/
registerOnTouched (fn: () => {}): void {
this._onTouched = fn
}

/**
* Sets whether the component should be disabled.
* Implemented as part of ControlValueAccessor.
* @param isDisabled
*/
/**
* Sets whether the component should be disabled.
* Implemented as part of ControlValueAccessor.
* @param isDisabled
*/
setDisabledState (isDisabled: boolean) {
this.disabled = isDisabled
}
Expand All @@ -541,10 +541,10 @@ export class Select2 implements ControlValueAccessor {
return !!(isInvalid && (isTouched || isSubmitted))
}

/**
* Sets the selected option based on a value. If no option can be
* found with the designated value, the select trigger is cleared.
*/
/**
* Sets the selected option based on a value. If no option can be
* found with the designated value, the select trigger is cleared.
*/
private _setSelectionByValue (value: any | any[]): void {
if (this.option || (value !== undefined && value !== null)) {
const isArray = Array.isArray(value)
Expand All @@ -560,7 +560,7 @@ export class Select2 implements ControlValueAccessor {
}
}

/** Does some manual dirty checking on the native input `value` property. */
/** Does some manual dirty checking on the native input `value` property. */
private _dirtyCheckNativeValue () {
const newValue = this.value

Expand Down
2 changes: 1 addition & 1 deletion packages/angular/src/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
*/
// tslint:disable

export const indexTemplateHtml = `<div [class]="containerStyle"><div class="selection" #selection [attr.tabindex]="!this.isOpen ? tabIndex : '-1'" (click)="toggleOpenAndClose()" (focus)="focusin()" (blur)="focusout()" (keydown)="openKey($event)" [class.select2-focused]="focused"><div [class]="selectionStyle" role="combobox"><span *ngIf="!multiple" class="select2-selection__rendered" [title]="option ? option.label : ''"><span *ngIf="!option">&nbsp;</span><ng-container *ngIf="option">{{option.label}}</ng-container><span [class.select2-selection__placeholder__option]="option" class="select2-selection__placeholder">{{placeholder}}</span></span><span *ngIf="!multiple" class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span><ul *ngIf="multiple" class="select2-selection__rendered"><span [class.select2-selection__placeholder__option]="option?.length > 0" class="select2-selection__placeholder">{{placeholder}}</span><li *ngFor="let op of option; trackBy: trackBy" class="select2-selection__choice" [title]="op.label"><span (click)="removeSelection($event, op)" class="select2-selection__choice__remove" role="presentation">×</span>{{op.label}}</li></ul></div><div class="select2-subscript-wrapper"><ng-content select="select2-hint"></ng-content></div></div><div [class]="dropdownStyle"><div class="select2-dropdown select2-dropdown--below"><div [class]="searchStyle"><input #searchInput [id]="id + '-search-field'" [(value)]="searchText" (keydown)="keyDown($event)" (keyup)="searchUpdate($event)" class="select2-search__field" type="search" role="textbox" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" [attr.tabindex]="this.isOpen ? tabIndex : '-1'"></div><div class="select2-results"><ul #results class="select2-results__options" role="tree" tabindex="-1" (keydown)="keyDown($event)"><ng-template ngFor [ngForOf]="filteredData" let-groupOrOption [ngForTrackBy]="trackBy"><li *ngIf="groupOrOption.options" class="select2-results__option" role="group"><strong [attr.class]="'select2-results__group' + (groupOrOption.classes ? ' ' + groupOrOption.classes : '')">{{groupOrOption.label}}</strong><ul class="select2-results__options select2-results__options--nested"><li *ngFor="let option of groupOrOption.options; trackBy:trackBy" [class]="getOptionStyle(option)" role="treeitem" [attr.aria-selected]="isSelected(option)" [attr.aria-disabled]="isDisabled(option)" (mouseenter)="mouseenter(option)" (click)="click(option)">{{option.label}}</li></ul></li><li *ngIf="!groupOrOption.options" [class]="getOptionStyle(groupOrOption)" role="treeitem" [attr.aria-selected]="isSelected(groupOrOption)" [attr.aria-disabled]="isDisabled(groupOrOption)" (mouseenter)="mouseenter(groupOrOption)" (click)="click(groupOrOption)">{{groupOrOption.label}}</li></ng-template></ul></div></div></div></div>`;
export const indexTemplateHtml = `<div [class]="containerStyle"><div class="selection" #selection [attr.tabindex]="!this.isOpen ? tabIndex : '-1'" (click)="toggleOpenAndClose()" (focus)="focusin()" (blur)="focusout()" (keydown)="openKey(\$event)" [class.select2-focused]="focused"><div [class]="selectionStyle" role="combobox"><span *ngIf="!multiple" class="select2-selection__rendered" [title]="option ? option.label : ''"><span *ngIf="!option">&nbsp;</span><ng-container *ngIf="option">{{option.label}}</ng-container><span [class.select2-selection__placeholder__option]="option" class="select2-selection__placeholder">{{placeholder}}</span></span><span *ngIf="!multiple" class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span><ul *ngIf="multiple" class="select2-selection__rendered"><span [class.select2-selection__placeholder__option]="option?.length > 0" class="select2-selection__placeholder">{{placeholder}}</span><li *ngFor="let op of option; trackBy: trackBy" class="select2-selection__choice" [title]="op.label"><span (click)="removeSelection(\$event, op)" class="select2-selection__choice__remove" role="presentation">×</span>{{op.label}}</li></ul></div><div class="select2-subscript-wrapper"><ng-content select="select2-hint"></ng-content></div></div><div [class]="dropdownStyle"><div class="select2-dropdown select2-dropdown--below"><div [class]="searchStyle"><input #searchInput [id]="id + '-search-field'" [(value)]="searchText" (keydown)="keyDown(\$event)" (keyup)="searchUpdate(\$event)" class="select2-search__field" type="search" role="textbox" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" [attr.tabindex]="this.isOpen ? tabIndex : '-1'"></div><div class="select2-results"><ul #results class="select2-results__options" role="tree" tabindex="-1" (keydown)="keyDown(\$event)"><ng-template ngFor [ngForOf]="filteredData" let-groupOrOption [ngForTrackBy]="trackBy"><li *ngIf="groupOrOption.options" class="select2-results__option" role="group"><strong [attr.class]="'select2-results__group' + (groupOrOption.classes ? ' ' + groupOrOption.classes : '')">{{groupOrOption.label}}</strong><ul class="select2-results__options select2-results__options--nested"><li *ngFor="let option of groupOrOption.options; trackBy:trackBy" [class]="getOptionStyle(option)" role="treeitem" [attr.aria-selected]="isSelected(option)" [attr.aria-disabled]="isDisabled(option)" (mouseenter)="mouseenter(option)" (click)="click(option)">{{option.label}}</li></ul></li><li *ngIf="!groupOrOption.options" [class]="getOptionStyle(groupOrOption)" role="treeitem" [attr.aria-selected]="isSelected(groupOrOption)" [attr.aria-disabled]="isDisabled(groupOrOption)" (mouseenter)="mouseenter(groupOrOption)" (click)="click(groupOrOption)">{{groupOrOption.label}}</li></ng-template></ul></div></div></div></div>`
// tslint:enable
8 changes: 4 additions & 4 deletions packages/react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ export class Select2 extends React.PureComponent<{
private focusoutTimer?: NodeJS.Timer
private innerSearchText = ''
private lastScrollTopIndex = 0
private isSearchboxHidden: boolean
private searchStyle: string
private isSearchboxHidden!: boolean
private searchStyle!: string

private searchInputElement: HTMLElement
private resultsElement: HTMLElement
private searchInputElement!: HTMLElement
private resultsElement!: HTMLElement

private get searchText () {
return this.innerSearchText
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/demo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { data1, data2, data3, data5 } from 'select2-component/demo/'
props: ['option']
})
class CustomOption extends Vue {
option: Select2Option
option!: Select2Option
}
Vue.component('custom-option', CustomOption)

Expand Down
10 changes: 5 additions & 5 deletions packages/vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { indexTemplateHtml, indexTemplateHtmlStatic } from './variables'
props: ['data', 'value', 'disabled', 'minCountForSearch', 'placeholder', 'customSearchEnabled', 'multiple']
})
export class Select2 extends Vue {
data: common.Select2Data
data!: common.Select2Data
value?: common.Select2UpdateValue
disabled?: boolean
minCountForSearch?: number
Expand All @@ -19,15 +19,15 @@ export class Select2 extends Vue {
multiple?: boolean

option: common.Select2Option | common.Select2Option[] | null = null
searchStyle: string
searchStyle!: string
private hoveringValue: common.Select2Value | null | undefined = null
private isOpen = false
private focusoutTimer?: NodeJS.Timer
private innerSearchText = ''
private lastScrollTopIndex = 0
private isSearchboxHidden: boolean
private searchInputElement: HTMLElement
private resultsElement: HTMLElement
private isSearchboxHidden!: boolean
private searchInputElement!: HTMLElement
private resultsElement!: HTMLElement

get searchText () {
return this.innerSearchText
Expand Down
Loading

0 comments on commit 1a8a8f2

Please sign in to comment.