inviton-powerduck 0.0.119 → 0.0.120
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/components/dropdown/index.tsx +21 -21
- package/package.json +1 -1
|
@@ -430,12 +430,12 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
430
430
|
getFormatResult() {
|
|
431
431
|
if (this.trailingButton) {
|
|
432
432
|
const self = this;
|
|
433
|
-
return
|
|
433
|
+
return (row) => {
|
|
434
434
|
const retVal = $(`<span class="s2-ri-withtb">${row.text
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
435
|
+
}<button class="s2-trailing-button ${self.trailingButton.cssClass || ''
|
|
436
|
+
} btn-sm">${self.trailingButton.icon != null ? `<i class="${self.trailingButton.icon}"></i> ` : ''
|
|
437
|
+
}${self.trailingButton.text || ''
|
|
438
|
+
}</button></span>`);
|
|
439
439
|
retVal.find('button').click((e) => {
|
|
440
440
|
try {
|
|
441
441
|
clearTimeout(self.preventDefaultTimeout);
|
|
@@ -507,7 +507,7 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
507
507
|
},
|
|
508
508
|
});
|
|
509
509
|
|
|
510
|
-
dropDown.onCancel =
|
|
510
|
+
dropDown.onCancel = () => {
|
|
511
511
|
selectedItems = null;
|
|
512
512
|
dropDown = null;
|
|
513
513
|
};
|
|
@@ -610,6 +610,7 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
610
610
|
|
|
611
611
|
this.tagsAdded(eventArgs);
|
|
612
612
|
forceClose = eventArgs.closeSelection;
|
|
613
|
+
return;
|
|
613
614
|
}
|
|
614
615
|
}
|
|
615
616
|
|
|
@@ -850,9 +851,7 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
850
851
|
return stripDiacritics(text).toUpperCase();
|
|
851
852
|
};
|
|
852
853
|
const stripDiacritics = (text: string) => {
|
|
853
|
-
|
|
854
|
-
return DIACRITICS[a] || a;
|
|
855
|
-
}
|
|
854
|
+
const match = a => DIACRITICS[a] || a;
|
|
856
855
|
|
|
857
856
|
return text.replace(/[^\u0000-\u007E]/g, match);
|
|
858
857
|
};
|
|
@@ -923,7 +922,7 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
923
922
|
let validTagsButtons = false;
|
|
924
923
|
let tagsTemplate = this.tagsTemplate;
|
|
925
924
|
if (this.tags == true && this.tagsAdded != null) {
|
|
926
|
-
s2Args.createTag =
|
|
925
|
+
s2Args.createTag = (params) => {
|
|
927
926
|
const term = $.trim(params.term);
|
|
928
927
|
if (term === '') {
|
|
929
928
|
return null;
|
|
@@ -937,7 +936,7 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
937
936
|
};
|
|
938
937
|
|
|
939
938
|
if (this.tagsNewPlaceLast != false) {
|
|
940
|
-
s2Args.insertTag =
|
|
939
|
+
s2Args.insertTag = (data, tag) => {
|
|
941
940
|
// Insert the tag at the end of the results
|
|
942
941
|
data.push(tag);
|
|
943
942
|
};
|
|
@@ -948,7 +947,7 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
948
947
|
validTagsButtons = true;
|
|
949
948
|
tagsTemplate
|
|
950
949
|
= '<li class="select2-selection__choice select2-selection__choice-with-button"><span class="select2-selection__choice__remove" role="presentation"><i class="fas fa-times"></i></span></li>';
|
|
951
|
-
s2Args.templateSelection =
|
|
950
|
+
s2Args.templateSelection = (state): string | JQuery => {
|
|
952
951
|
if (!state) { return ''; }
|
|
953
952
|
|
|
954
953
|
if (!state.id) { return state.text; }
|
|
@@ -985,9 +984,7 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
985
984
|
|
|
986
985
|
if (!this.useMultiCheckboxes()) {
|
|
987
986
|
const currentMethod = instance.dataAdapter.current;
|
|
988
|
-
const getCurrentData = () =>
|
|
989
|
-
return instance.dataAccessor?.getData();
|
|
990
|
-
};
|
|
987
|
+
const getCurrentData = () => instance.dataAccessor?.getData();
|
|
991
988
|
|
|
992
989
|
const getSelected = () => {
|
|
993
990
|
const retArr = [];
|
|
@@ -1045,8 +1042,13 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
1045
1042
|
|
|
1046
1043
|
instance.dataAdapter.select = (data) => {
|
|
1047
1044
|
const adapter = instance.dataAdapter;
|
|
1048
|
-
if (adapter.$element.prop('multiple')) {
|
|
1045
|
+
if (adapter.$element.prop('multiple') || s2Args.tags) {
|
|
1049
1046
|
adapter.current((currentData) => {
|
|
1047
|
+
const isNewTag = data.newTag;
|
|
1048
|
+
if (isNewTag) {
|
|
1049
|
+
data.selected = true;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1050
1052
|
data = [data];
|
|
1051
1053
|
data.push.apply(data, currentData);
|
|
1052
1054
|
unselectOthers(getCurrentData(), data.map(p => p.id));
|
|
@@ -1098,11 +1100,11 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
1098
1100
|
};
|
|
1099
1101
|
|
|
1100
1102
|
if (!isNullOrEmpty(tagsTemplate)) {
|
|
1101
|
-
DropdownSelect2Helper.getSelect2Instance(s2Elem).selection.selectionContainer =
|
|
1103
|
+
DropdownSelect2Helper.getSelect2Instance(s2Elem).selection.selectionContainer = () => {
|
|
1102
1104
|
const retVal = $(tagsTemplate);
|
|
1103
1105
|
if (self.tagsShouldPrependContent != false) {
|
|
1104
1106
|
const oldAppend = retVal.append;
|
|
1105
|
-
retVal.append =
|
|
1107
|
+
retVal.append = (elem) => {
|
|
1106
1108
|
retVal.prepend(elem);
|
|
1107
1109
|
retVal.append = oldAppend;
|
|
1108
1110
|
} as any;
|
|
@@ -1165,9 +1167,7 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
|
|
|
1165
1167
|
}
|
|
1166
1168
|
}
|
|
1167
1169
|
|
|
1168
|
-
DropdownSelect2Helper.getSelect2Instance(s2Elem).dataAccessor.getData = () =>
|
|
1169
|
-
return opts;
|
|
1170
|
-
};
|
|
1170
|
+
DropdownSelect2Helper.getSelect2Instance(s2Elem).dataAccessor.getData = () => opts;
|
|
1171
1171
|
|
|
1172
1172
|
if (this.containerCssClass?.length > 0) {
|
|
1173
1173
|
DropdownSelect2Helper.getSelect2Instance(s2Elem).$dropdown.addClass(this.containerCssClass);
|