@ng-select/ng-select 3.6.2 → 3.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -3
- package/bundles/ng-select-ng-select.umd.js +126 -19
- package/bundles/ng-select-ng-select.umd.js.map +1 -1
- package/bundles/ng-select-ng-select.umd.min.js +1 -1
- package/bundles/ng-select-ng-select.umd.min.js.map +1 -1
- package/esm2015/lib/ng-select.component.js +43 -6
- package/esm2015/lib/selection-model.js +47 -15
- package/esm5/lib/ng-select.component.js +51 -6
- package/esm5/lib/selection-model.js +57 -12
- package/fesm2015/ng-select-ng-select.js +88 -19
- package/fesm2015/ng-select-ng-select.js.map +1 -1
- package/fesm5/ng-select-ng-select.js +106 -16
- package/fesm5/ng-select-ng-select.js.map +1 -1
- package/lib/ng-select.component.d.ts +4 -0
- package/lib/selection-model.d.ts +1 -0
- package/ng-select-ng-select.metadata.json +1 -1
- package/package.json +1 -1
- package/scss/ant.design.theme.scss +1 -0
- package/scss/default.theme.scss +1 -0
- package/scss/material.theme.scss +1 -0
- package/scss/ng-select.component.scss +0 -1
- package/themes/ant.design.theme.css +1 -1
- package/themes/default.theme.css +1 -1
- package/themes/material.theme.css +1 -1
|
@@ -3256,6 +3256,7 @@ var NgSelectComponent = /** @class */ (function () {
|
|
|
3256
3256
|
this.readonly = false;
|
|
3257
3257
|
this.searchWhileComposing = true;
|
|
3258
3258
|
this.minTermLength = 0;
|
|
3259
|
+
this.editableSearchTerm = false;
|
|
3259
3260
|
this.keyDownFn = (/**
|
|
3260
3261
|
* @param {?} _
|
|
3261
3262
|
* @return {?}
|
|
@@ -3282,6 +3283,7 @@ var NgSelectComponent = /** @class */ (function () {
|
|
|
3282
3283
|
this.searchTerm = null;
|
|
3283
3284
|
this.dropdownId = newId();
|
|
3284
3285
|
this.escapeHTML = true;
|
|
3286
|
+
this.useDefaultClass = true;
|
|
3285
3287
|
this._items = [];
|
|
3286
3288
|
this._defaultLabel = 'label';
|
|
3287
3289
|
this._pressedKeys = [];
|
|
@@ -3396,6 +3398,17 @@ var NgSelectComponent = /** @class */ (function () {
|
|
|
3396
3398
|
configurable: true
|
|
3397
3399
|
});
|
|
3398
3400
|
;
|
|
3401
|
+
Object.defineProperty(NgSelectComponent.prototype, "_editableSearchTerm", {
|
|
3402
|
+
get: /**
|
|
3403
|
+
* @private
|
|
3404
|
+
* @return {?}
|
|
3405
|
+
*/
|
|
3406
|
+
function () {
|
|
3407
|
+
return this.editableSearchTerm && !this.multiple;
|
|
3408
|
+
},
|
|
3409
|
+
enumerable: true,
|
|
3410
|
+
configurable: true
|
|
3411
|
+
});
|
|
3399
3412
|
Object.defineProperty(NgSelectComponent.prototype, "selectedItems", {
|
|
3400
3413
|
get: /**
|
|
3401
3414
|
* @return {?}
|
|
@@ -3723,7 +3736,12 @@ var NgSelectComponent = /** @class */ (function () {
|
|
|
3723
3736
|
return;
|
|
3724
3737
|
}
|
|
3725
3738
|
this.isOpen = false;
|
|
3726
|
-
this.
|
|
3739
|
+
if (!this._editableSearchTerm) {
|
|
3740
|
+
this._clearSearch();
|
|
3741
|
+
}
|
|
3742
|
+
else {
|
|
3743
|
+
this.itemsList.resetFilteredItems();
|
|
3744
|
+
}
|
|
3727
3745
|
this.itemsList.unmarkItem();
|
|
3728
3746
|
this._onTouched();
|
|
3729
3747
|
this.closeEvent.emit();
|
|
@@ -3747,6 +3765,9 @@ var NgSelectComponent = /** @class */ (function () {
|
|
|
3747
3765
|
else {
|
|
3748
3766
|
this.select(item);
|
|
3749
3767
|
}
|
|
3768
|
+
if (this._editableSearchTerm) {
|
|
3769
|
+
this._setSearchTermFromItems();
|
|
3770
|
+
}
|
|
3750
3771
|
this._onSelectionChanged();
|
|
3751
3772
|
};
|
|
3752
3773
|
/**
|
|
@@ -3760,7 +3781,7 @@ var NgSelectComponent = /** @class */ (function () {
|
|
|
3760
3781
|
function (item) {
|
|
3761
3782
|
if (!item.selected) {
|
|
3762
3783
|
this.itemsList.select(item);
|
|
3763
|
-
if (this.clearSearchOnAdd) {
|
|
3784
|
+
if (this.clearSearchOnAdd && !this._editableSearchTerm) {
|
|
3764
3785
|
this._clearSearch();
|
|
3765
3786
|
}
|
|
3766
3787
|
this._updateNgModel();
|
|
@@ -3940,7 +3961,7 @@ var NgSelectComponent = /** @class */ (function () {
|
|
|
3940
3961
|
return;
|
|
3941
3962
|
}
|
|
3942
3963
|
this.searchTerm = term;
|
|
3943
|
-
if (this._isTypeahead && this._validTerm) {
|
|
3964
|
+
if (this._isTypeahead && (this._validTerm || this.minTermLength === 0)) {
|
|
3944
3965
|
this.typeahead.next(term);
|
|
3945
3966
|
}
|
|
3946
3967
|
if (!this._isTypeahead) {
|
|
@@ -3968,6 +3989,9 @@ var NgSelectComponent = /** @class */ (function () {
|
|
|
3968
3989
|
if (this.focused) {
|
|
3969
3990
|
return;
|
|
3970
3991
|
}
|
|
3992
|
+
if (this._editableSearchTerm) {
|
|
3993
|
+
this._setSearchTermFromItems();
|
|
3994
|
+
}
|
|
3971
3995
|
this.element.classList.add('ng-select-focused');
|
|
3972
3996
|
this.focusEvent.emit($event);
|
|
3973
3997
|
this.focused = true;
|
|
@@ -3986,6 +4010,9 @@ var NgSelectComponent = /** @class */ (function () {
|
|
|
3986
4010
|
if (!this.isOpen && !this.disabled) {
|
|
3987
4011
|
this._onTouched();
|
|
3988
4012
|
}
|
|
4013
|
+
if (this._editableSearchTerm) {
|
|
4014
|
+
this._setSearchTermFromItems();
|
|
4015
|
+
}
|
|
3989
4016
|
this.focused = false;
|
|
3990
4017
|
};
|
|
3991
4018
|
/**
|
|
@@ -4013,6 +4040,19 @@ var NgSelectComponent = /** @class */ (function () {
|
|
|
4013
4040
|
this._cd.detectChanges();
|
|
4014
4041
|
}
|
|
4015
4042
|
};
|
|
4043
|
+
/**
|
|
4044
|
+
* @private
|
|
4045
|
+
* @return {?}
|
|
4046
|
+
*/
|
|
4047
|
+
NgSelectComponent.prototype._setSearchTermFromItems = /**
|
|
4048
|
+
* @private
|
|
4049
|
+
* @return {?}
|
|
4050
|
+
*/
|
|
4051
|
+
function () {
|
|
4052
|
+
/** @type {?} */
|
|
4053
|
+
var selected = this.selectedItems && this.selectedItems[0];
|
|
4054
|
+
this.searchTerm = (selected && selected.label) || null;
|
|
4055
|
+
};
|
|
4016
4056
|
/**
|
|
4017
4057
|
* @private
|
|
4018
4058
|
* @param {?} items
|
|
@@ -4627,10 +4667,10 @@ var NgSelectComponent = /** @class */ (function () {
|
|
|
4627
4667
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
4628
4668
|
host: {
|
|
4629
4669
|
'role': 'listbox',
|
|
4630
|
-
'class': '
|
|
4670
|
+
'[class.ng-select]': 'useDefaultClass',
|
|
4631
4671
|
'[class.ng-select-single]': '!multiple',
|
|
4632
4672
|
},
|
|
4633
|
-
styles: [".ng-select{position:relative;display:block;box-sizing:border-box}.ng-select div,.ng-select input,.ng-select span{box-sizing:border-box}.ng-select [hidden]{display:none}.ng-select.ng-select-searchable .ng-select-container .ng-value-container .ng-input{opacity:1}.ng-select.ng-select-opened .ng-select-container{z-index:1001}.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-placeholder,.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-value{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.ng-select.ng-select-disabled .ng-arrow-wrapper{cursor:default}.ng-select.ng-select-filtered .ng-placeholder{display:none}.ng-select .ng-select-container{
|
|
4673
|
+
styles: [".ng-select{position:relative;display:block;box-sizing:border-box}.ng-select div,.ng-select input,.ng-select span{box-sizing:border-box}.ng-select [hidden]{display:none}.ng-select.ng-select-searchable .ng-select-container .ng-value-container .ng-input{opacity:1}.ng-select.ng-select-opened .ng-select-container{z-index:1001}.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-placeholder,.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-value{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.ng-select.ng-select-disabled .ng-arrow-wrapper{cursor:default}.ng-select.ng-select-filtered .ng-placeholder{display:none}.ng-select .ng-select-container{cursor:default;display:-webkit-box;display:flex;outline:0;overflow:hidden;position:relative;width:100%}.ng-select .ng-select-container .ng-value-container{display:-webkit-box;display:flex;-webkit-box-flex:1;flex:1}.ng-select .ng-select-container .ng-value-container .ng-input{opacity:0}.ng-select .ng-select-container .ng-value-container .ng-input>input{box-sizing:content-box;background:none;border:0;box-shadow:none;outline:0;cursor:default;width:100%}.ng-select .ng-select-container .ng-value-container .ng-input>input::-ms-clear{display:none}.ng-select .ng-select-container .ng-value-container .ng-input>input[readonly]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:0;padding:0}.ng-select.ng-select-single.ng-select-filtered .ng-select-container .ng-value-container .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-select-container .ng-value-container,.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{position:absolute;left:0;width:100%}.ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container{flex-wrap:wrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon{cursor:pointer}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-input{-webkit-box-flex:1;flex:1;z-index:2}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{position:absolute;z-index:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ng-select .ng-clear-wrapper .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-spinner-loader{border-radius:50%;width:17px;height:17px;margin-right:5px;font-size:10px;position:relative;text-indent:-9999em;border-top:2px solid rgba(66,66,66,.2);border-right:2px solid rgba(66,66,66,.2);border-bottom:2px solid rgba(66,66,66,.2);border-left:2px solid #424242;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:.8s linear infinite load8;animation:.8s linear infinite load8}.ng-select .ng-spinner-loader:after{border-radius:50%;width:17px;height:17px}@-webkit-keyframes load8{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load8{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ng-select .ng-arrow-wrapper{cursor:pointer;position:relative;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ng-select .ng-arrow-wrapper .ng-arrow{pointer-events:none;display:inline-block;height:0;width:0;position:relative}.ng-dropdown-panel{box-sizing:border-box;position:absolute;opacity:0;width:100%;z-index:1050;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;box-sizing:border-box;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option{box-sizing:border-box;cursor:pointer;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .highlighted{font-weight:700;text-decoration:underline}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option.disabled{cursor:default}.ng-dropdown-panel .scroll-host{overflow:hidden;overflow-y:auto;position:relative;display:block;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .scrollable-content{top:0;left:0;width:100%;height:100%;position:absolute}.ng-dropdown-panel .total-padding{width:1px;opacity:0}"]
|
|
4634
4674
|
}] }
|
|
4635
4675
|
];
|
|
4636
4676
|
/** @nocollapse */
|
|
@@ -4677,6 +4717,7 @@ var NgSelectComponent = /** @class */ (function () {
|
|
|
4677
4717
|
readonly: [{ type: Input }],
|
|
4678
4718
|
searchWhileComposing: [{ type: Input }],
|
|
4679
4719
|
minTermLength: [{ type: Input }],
|
|
4720
|
+
editableSearchTerm: [{ type: Input }],
|
|
4680
4721
|
keyDownFn: [{ type: Input }],
|
|
4681
4722
|
typeahead: [{ type: Input }, { type: HostBinding, args: ['class.ng-select-typeahead',] }],
|
|
4682
4723
|
multiple: [{ type: Input }, { type: HostBinding, args: ['class.ng-select-multiple',] }],
|
|
@@ -4789,6 +4830,8 @@ if (false) {
|
|
|
4789
4830
|
/** @type {?} */
|
|
4790
4831
|
NgSelectComponent.prototype.minTermLength;
|
|
4791
4832
|
/** @type {?} */
|
|
4833
|
+
NgSelectComponent.prototype.editableSearchTerm;
|
|
4834
|
+
/** @type {?} */
|
|
4792
4835
|
NgSelectComponent.prototype.keyDownFn;
|
|
4793
4836
|
/** @type {?} */
|
|
4794
4837
|
NgSelectComponent.prototype.typeahead;
|
|
@@ -4866,6 +4909,8 @@ if (false) {
|
|
|
4866
4909
|
NgSelectComponent.prototype.focused;
|
|
4867
4910
|
/** @type {?} */
|
|
4868
4911
|
NgSelectComponent.prototype.escapeHTML;
|
|
4912
|
+
/** @type {?} */
|
|
4913
|
+
NgSelectComponent.prototype.useDefaultClass;
|
|
4869
4914
|
/**
|
|
4870
4915
|
* @type {?}
|
|
4871
4916
|
* @private
|
|
@@ -5029,7 +5074,7 @@ var DefaultSelectionModel = /** @class */ (function () {
|
|
|
5029
5074
|
*/
|
|
5030
5075
|
function (item, multiple, groupAsModel) {
|
|
5031
5076
|
item.selected = true;
|
|
5032
|
-
if (
|
|
5077
|
+
if (!item.children || (!multiple && groupAsModel)) {
|
|
5033
5078
|
this._selected.push(item);
|
|
5034
5079
|
}
|
|
5035
5080
|
if (multiple) {
|
|
@@ -5047,8 +5092,19 @@ var DefaultSelectionModel = /** @class */ (function () {
|
|
|
5047
5092
|
else if (item.children) {
|
|
5048
5093
|
this._setChildrenSelectedState(item.children, true);
|
|
5049
5094
|
this._removeChildren(item);
|
|
5050
|
-
if (
|
|
5051
|
-
this._selected = __spread(this._selected
|
|
5095
|
+
if (groupAsModel && this._activeChildren(item)) {
|
|
5096
|
+
this._selected = __spread(this._selected.filter((/**
|
|
5097
|
+
* @param {?} x
|
|
5098
|
+
* @return {?}
|
|
5099
|
+
*/
|
|
5100
|
+
function (x) { return x.parent !== item; })), [item]);
|
|
5101
|
+
}
|
|
5102
|
+
else {
|
|
5103
|
+
this._selected = __spread(this._selected, item.children.filter((/**
|
|
5104
|
+
* @param {?} x
|
|
5105
|
+
* @return {?}
|
|
5106
|
+
*/
|
|
5107
|
+
function (x) { return !x.disabled; })));
|
|
5052
5108
|
}
|
|
5053
5109
|
}
|
|
5054
5110
|
}
|
|
@@ -5081,7 +5137,7 @@ var DefaultSelectionModel = /** @class */ (function () {
|
|
|
5081
5137
|
* @param {?} x
|
|
5082
5138
|
* @return {?}
|
|
5083
5139
|
*/
|
|
5084
|
-
function (x) { return x !== item; }))));
|
|
5140
|
+
function (x) { return x !== item && !x.disabled; }))));
|
|
5085
5141
|
item.parent.selected = false;
|
|
5086
5142
|
}
|
|
5087
5143
|
else if (item.children) {
|
|
@@ -5118,11 +5174,24 @@ var DefaultSelectionModel = /** @class */ (function () {
|
|
|
5118
5174
|
* @return {?}
|
|
5119
5175
|
*/
|
|
5120
5176
|
function (children, selected) {
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5177
|
+
var e_1, _a;
|
|
5178
|
+
try {
|
|
5179
|
+
for (var children_1 = __values(children), children_1_1 = children_1.next(); !children_1_1.done; children_1_1 = children_1.next()) {
|
|
5180
|
+
var child = children_1_1.value;
|
|
5181
|
+
if (child.disabled) {
|
|
5182
|
+
continue;
|
|
5183
|
+
}
|
|
5184
|
+
child.selected = selected;
|
|
5185
|
+
}
|
|
5186
|
+
}
|
|
5187
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
5188
|
+
finally {
|
|
5189
|
+
try {
|
|
5190
|
+
if (children_1_1 && !children_1_1.done && (_a = children_1.return)) _a.call(children_1);
|
|
5191
|
+
}
|
|
5192
|
+
finally { if (e_1) throw e_1.error; }
|
|
5193
|
+
}
|
|
5194
|
+
;
|
|
5126
5195
|
};
|
|
5127
5196
|
/**
|
|
5128
5197
|
* @private
|
|
@@ -5135,11 +5204,15 @@ var DefaultSelectionModel = /** @class */ (function () {
|
|
|
5135
5204
|
* @return {?}
|
|
5136
5205
|
*/
|
|
5137
5206
|
function (parent) {
|
|
5138
|
-
this._selected = this._selected.filter((/**
|
|
5207
|
+
this._selected = __spread(this._selected.filter((/**
|
|
5139
5208
|
* @param {?} x
|
|
5140
5209
|
* @return {?}
|
|
5141
5210
|
*/
|
|
5142
|
-
function (x) { return x.parent !== parent; }))
|
|
5211
|
+
function (x) { return x.parent !== parent; })), parent.children.filter((/**
|
|
5212
|
+
* @param {?} x
|
|
5213
|
+
* @return {?}
|
|
5214
|
+
*/
|
|
5215
|
+
function (x) { return x.parent === parent && x.disabled && x.selected; })));
|
|
5143
5216
|
};
|
|
5144
5217
|
/**
|
|
5145
5218
|
* @private
|
|
@@ -5158,6 +5231,23 @@ var DefaultSelectionModel = /** @class */ (function () {
|
|
|
5158
5231
|
*/
|
|
5159
5232
|
function (x) { return x !== parent; }));
|
|
5160
5233
|
};
|
|
5234
|
+
/**
|
|
5235
|
+
* @private
|
|
5236
|
+
* @param {?} item
|
|
5237
|
+
* @return {?}
|
|
5238
|
+
*/
|
|
5239
|
+
DefaultSelectionModel.prototype._activeChildren = /**
|
|
5240
|
+
* @private
|
|
5241
|
+
* @param {?} item
|
|
5242
|
+
* @return {?}
|
|
5243
|
+
*/
|
|
5244
|
+
function (item) {
|
|
5245
|
+
return item.children.every((/**
|
|
5246
|
+
* @param {?} x
|
|
5247
|
+
* @return {?}
|
|
5248
|
+
*/
|
|
5249
|
+
function (x) { return !x.disabled || x.selected; }));
|
|
5250
|
+
};
|
|
5161
5251
|
return DefaultSelectionModel;
|
|
5162
5252
|
}());
|
|
5163
5253
|
if (false) {
|