reneco-hierarchized-picker 0.3.8 → 0.3.9
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/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/reneco-hierarchized-picker.cjs.entry.js +58 -8
- package/dist/cjs/reneco-hierarchized-picker.cjs.js +1 -1
- package/dist/collection/components/hierarchized-picker/hierarchized-picker.js +91 -8
- package/dist/custom-elements/index.js +59 -9
- package/dist/esm/loader.js +1 -1
- package/dist/esm/reneco-hierarchized-picker.entry.js +58 -8
- package/dist/esm/reneco-hierarchized-picker.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/reneco-hierarchized-picker.entry.js +1 -1
- package/dist/esm-es5/reneco-hierarchized-picker.js +1 -1
- package/dist/reneco-hierarchized-picker/{p-343f1f73.system.entry.js → p-46c83227.system.entry.js} +1 -1
- package/dist/reneco-hierarchized-picker/p-73168a50.system.js +1 -1
- package/dist/reneco-hierarchized-picker/{p-3dc0df8c.entry.js → p-aedc893b.entry.js} +1 -1
- package/dist/reneco-hierarchized-picker/reneco-hierarchized-picker.esm.js +1 -1
- package/dist/types/components/hierarchized-picker/hierarchized-picker.d.ts +16 -0
- package/dist/types/components.d.ts +5 -0
- package/package.json +1 -1
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["reneco-hierarchized-picker.cjs",[[0,"reneco-hierarchized-picker",{"options":[16],"valueChangeCallback":[16],"disabled":[4],"newoptions":[1],"newfilter":[1],"isDisabled":[32],"theOptions":[32],"componentID":[32],"rawData":[32],"pickerClass":[32],"displayedValue":[32],"value":[32],"shownTree":[32],"hasFocus":[32],"errorToLog":[32],"getValue":[64],"refreshPicker":[64],"setOptions":[64],"filterTree":[64],"showSelectedNodes":[64],"clearPicker":[64]}]]]], options);
|
|
17
|
+
return index.bootstrapLazy([["reneco-hierarchized-picker.cjs",[[0,"reneco-hierarchized-picker",{"options":[16],"valueChangeCallback":[16],"disabled":[4],"newoptions":[1],"newfilter":[1],"isDisabled":[32],"theOptions":[32],"componentID":[32],"rawData":[32],"pickerClass":[32],"displayedValue":[32],"value":[32],"shownTree":[32],"searchResultData":[32],"hasFocus":[32],"errorToLog":[32],"getValue":[64],"refreshPicker":[64],"getSearchResult":[64],"setOptions":[64],"filterTree":[64],"showSelectedNodes":[64],"clearPicker":[64]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -17833,10 +17833,13 @@ const HierarchizedPickerComponent = class {
|
|
|
17833
17833
|
this.valueChange = index.createEvent(this, "valueChange", 7);
|
|
17834
17834
|
this.itemDropped = index.createEvent(this, "itemDropped", 7);
|
|
17835
17835
|
this.itemContextMenuItemClick = index.createEvent(this, "itemContextMenuItemClick", 7);
|
|
17836
|
+
this.searchResult = index.createEvent(this, "searchResult", 7);
|
|
17836
17837
|
this.canload = true; // Determines wether the component may be loaded
|
|
17837
17838
|
this.ready = false; // State to determine if all the elements of the component have been loaded
|
|
17838
17839
|
this.searchToDisplay = 0; // Counter to trigger the research on proper time
|
|
17839
17840
|
this.ignoreOptionsChanges = true; // Determines wether the options @Prop under @Watch will be ignored (to avoid circular calls)
|
|
17841
|
+
this.realSearchResultData = {}; // Contains the last search's result's data that will be returned
|
|
17842
|
+
this.lastSearchMatchCounter = 0; // Counter of number of matches for last search
|
|
17840
17843
|
this.setValueOnClick = true; // Tells wether we edit the picker value on click in the tree
|
|
17841
17844
|
this.mylog = console.log; // Custom log function for debug purposes
|
|
17842
17845
|
// Used to control wether we're draging over the same node, prevents the same event to be called multiple times
|
|
@@ -17860,6 +17863,7 @@ const HierarchizedPickerComponent = class {
|
|
|
17860
17863
|
this.displayedValue = undefined;
|
|
17861
17864
|
this.value = [];
|
|
17862
17865
|
this.shownTree = false;
|
|
17866
|
+
this.searchResultData = {};
|
|
17863
17867
|
this.hasFocus = undefined;
|
|
17864
17868
|
this.errorToLog = '';
|
|
17865
17869
|
}
|
|
@@ -17891,6 +17895,23 @@ const HierarchizedPickerComponent = class {
|
|
|
17891
17895
|
}
|
|
17892
17896
|
this.setNewOption(this.theOptions);
|
|
17893
17897
|
}
|
|
17898
|
+
getSearchResultWithCounter(searchResult) {
|
|
17899
|
+
return { data: searchResult, matches: this.lastSearchMatchCounter };
|
|
17900
|
+
}
|
|
17901
|
+
searchResultDataChange(newValue, oldValue) {
|
|
17902
|
+
if (newValue && newValue != oldValue) {
|
|
17903
|
+
if (newValue === null || newValue === void 0 ? void 0 : newValue.value) {
|
|
17904
|
+
this.realSearchResultData = this.getSearchResultWithCounter(newValue);
|
|
17905
|
+
this.searchResult.emit(this.realSearchResultData);
|
|
17906
|
+
}
|
|
17907
|
+
else {
|
|
17908
|
+
this.realSearchResultData = {};
|
|
17909
|
+
}
|
|
17910
|
+
}
|
|
17911
|
+
}
|
|
17912
|
+
getSearchResult() {
|
|
17913
|
+
return Promise.resolve(this.getSearchResultWithCounter(this.searchResultData));
|
|
17914
|
+
}
|
|
17894
17915
|
logError(messageToLog) {
|
|
17895
17916
|
try {
|
|
17896
17917
|
console.error('--- Hierarchized picker ' + this.componentID + ' ERROR ---', messageToLog);
|
|
@@ -18473,18 +18494,25 @@ const HierarchizedPickerComponent = class {
|
|
|
18473
18494
|
that.mylog('XHR ONLOAD', e, xhr.statusText);
|
|
18474
18495
|
if (xhr.readyState === 4) {
|
|
18475
18496
|
if (xhr.status === 200) {
|
|
18476
|
-
|
|
18497
|
+
const parsedResult = JSON.parse(xhr.responseText);
|
|
18498
|
+
that.mylog('XHR 200', parsedResult);
|
|
18477
18499
|
if (that.rawData) {
|
|
18478
|
-
that.rawData = that.searchAndMergeDataClassification(that.rawData,
|
|
18500
|
+
that.rawData = that.searchAndMergeDataClassification(that.rawData, parsedResult);
|
|
18479
18501
|
}
|
|
18480
18502
|
else {
|
|
18481
|
-
that.rawData =
|
|
18503
|
+
that.rawData = parsedResult;
|
|
18482
18504
|
}
|
|
18483
|
-
resolve(
|
|
18505
|
+
resolve(parsedResult);
|
|
18484
18506
|
if (init) {
|
|
18485
18507
|
that.formatDefaultValue();
|
|
18486
18508
|
that.showSelectedNodes();
|
|
18487
18509
|
}
|
|
18510
|
+
if (options.search) {
|
|
18511
|
+
that.searchResultData = parsedResult;
|
|
18512
|
+
}
|
|
18513
|
+
else {
|
|
18514
|
+
that.searchResultData = {};
|
|
18515
|
+
}
|
|
18488
18516
|
that.ready = true;
|
|
18489
18517
|
}
|
|
18490
18518
|
else {
|
|
@@ -18526,14 +18554,21 @@ const HierarchizedPickerComponent = class {
|
|
|
18526
18554
|
this.mylog('getDataFromSource XHR ONLOAD', e, xhr.statusText);
|
|
18527
18555
|
if (xhr.readyState === 4) {
|
|
18528
18556
|
if (xhr.status === 200) {
|
|
18529
|
-
|
|
18557
|
+
const parsedResult = JSON.parse(xhr.responseText);
|
|
18558
|
+
this.mylog('getDataFromSource XHR 200', parsedResult);
|
|
18530
18559
|
if (this.rawData) {
|
|
18531
|
-
this.rawData = this.searchAndMergeData(this.rawData,
|
|
18560
|
+
this.rawData = this.searchAndMergeData(this.rawData, parsedResult);
|
|
18561
|
+
}
|
|
18562
|
+
else {
|
|
18563
|
+
this.rawData = parsedResult;
|
|
18564
|
+
}
|
|
18565
|
+
resolve(parsedResult);
|
|
18566
|
+
if (options.searchedValue) {
|
|
18567
|
+
this.searchResultData = parsedResult;
|
|
18532
18568
|
}
|
|
18533
18569
|
else {
|
|
18534
|
-
this.
|
|
18570
|
+
this.searchResultData = {};
|
|
18535
18571
|
}
|
|
18536
|
-
resolve(JSON.parse(xhr.responseText));
|
|
18537
18572
|
this.ready = true;
|
|
18538
18573
|
}
|
|
18539
18574
|
else {
|
|
@@ -18740,6 +18775,9 @@ const HierarchizedPickerComponent = class {
|
|
|
18740
18775
|
}
|
|
18741
18776
|
}
|
|
18742
18777
|
triggerTreeDisplay(dataToLoad, searched) {
|
|
18778
|
+
if (searched) {
|
|
18779
|
+
this.lastSearchMatchCounter = 0;
|
|
18780
|
+
}
|
|
18743
18781
|
if (this.theOptions.origin == 'thesaurus') {
|
|
18744
18782
|
this.translateDataFromThesaurus(dataToLoad, searched);
|
|
18745
18783
|
}
|
|
@@ -18821,6 +18859,9 @@ const HierarchizedPickerComponent = class {
|
|
|
18821
18859
|
const matched = searchValue(objToPush, false);
|
|
18822
18860
|
objToPush.isDesaturated = !matched;
|
|
18823
18861
|
objToPush.searchMatch = searchValue(objToPush, true);
|
|
18862
|
+
if (objToPush.searchMatch) {
|
|
18863
|
+
this.lastSearchMatchCounter = this.lastSearchMatchCounter + 1;
|
|
18864
|
+
}
|
|
18824
18865
|
pushMe = matched || this.theOptions.searchResultPresentsUnMatched;
|
|
18825
18866
|
}
|
|
18826
18867
|
else {
|
|
@@ -18874,6 +18915,9 @@ const HierarchizedPickerComponent = class {
|
|
|
18874
18915
|
const matched = searchValue(objToPush, false);
|
|
18875
18916
|
objToPush.isDesaturated = !matched;
|
|
18876
18917
|
objToPush.searchMatch = searchValue(objToPush, true);
|
|
18918
|
+
if (objToPush.searchMatch) {
|
|
18919
|
+
this.lastSearchMatchCounter = this.lastSearchMatchCounter + 1;
|
|
18920
|
+
}
|
|
18877
18921
|
pushMe = matched || this.theOptions.searchResultPresentsUnMatched;
|
|
18878
18922
|
}
|
|
18879
18923
|
else {
|
|
@@ -18927,6 +18971,9 @@ const HierarchizedPickerComponent = class {
|
|
|
18927
18971
|
const matched = searchValue(objToPush, false);
|
|
18928
18972
|
objToPush.isDesaturated = !matched;
|
|
18929
18973
|
objToPush.searchMatch = searchValue(objToPush, true);
|
|
18974
|
+
if (objToPush.searchMatch) {
|
|
18975
|
+
that.lastSearchMatchCounter = that.lastSearchMatchCounter + 1;
|
|
18976
|
+
}
|
|
18930
18977
|
pushMe = matched || that.theOptions.searchResultPresentsUnMatched;
|
|
18931
18978
|
}
|
|
18932
18979
|
else {
|
|
@@ -19395,6 +19442,8 @@ const HierarchizedPickerComponent = class {
|
|
|
19395
19442
|
else {
|
|
19396
19443
|
this.translateDataForTree(this.rawData);
|
|
19397
19444
|
}
|
|
19445
|
+
//Reset searched data
|
|
19446
|
+
this.searchResultData = {};
|
|
19398
19447
|
//Reset autocomplete
|
|
19399
19448
|
this.displayAutocompleteWithResults(null, '');
|
|
19400
19449
|
//Recheck previously selected fields ?
|
|
@@ -19677,6 +19726,7 @@ const HierarchizedPickerComponent = class {
|
|
|
19677
19726
|
}
|
|
19678
19727
|
get el() { return index.getElement(this); }
|
|
19679
19728
|
static get watchers() { return {
|
|
19729
|
+
"searchResultData": ["searchResultDataChange"],
|
|
19680
19730
|
"errorToLog": ["logError"],
|
|
19681
19731
|
"newoptions": ["setNewOptions"],
|
|
19682
19732
|
"newfilter": ["setNewFilter"],
|
|
@@ -17,7 +17,7 @@ const patchBrowser = () => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(options => {
|
|
20
|
-
return index.bootstrapLazy([["reneco-hierarchized-picker.cjs",[[0,"reneco-hierarchized-picker",{"options":[16],"valueChangeCallback":[16],"disabled":[4],"newoptions":[1],"newfilter":[1],"isDisabled":[32],"theOptions":[32],"componentID":[32],"rawData":[32],"pickerClass":[32],"displayedValue":[32],"value":[32],"shownTree":[32],"hasFocus":[32],"errorToLog":[32],"getValue":[64],"refreshPicker":[64],"setOptions":[64],"filterTree":[64],"showSelectedNodes":[64],"clearPicker":[64]}]]]], options);
|
|
20
|
+
return index.bootstrapLazy([["reneco-hierarchized-picker.cjs",[[0,"reneco-hierarchized-picker",{"options":[16],"valueChangeCallback":[16],"disabled":[4],"newoptions":[1],"newfilter":[1],"isDisabled":[32],"theOptions":[32],"componentID":[32],"rawData":[32],"pickerClass":[32],"displayedValue":[32],"value":[32],"shownTree":[32],"searchResultData":[32],"hasFocus":[32],"errorToLog":[32],"getValue":[64],"refreshPicker":[64],"getSearchResult":[64],"setOptions":[64],"filterTree":[64],"showSelectedNodes":[64],"clearPicker":[64]}]]]], options);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
exports.setNonce = index.setNonce;
|
|
@@ -57,6 +57,8 @@ export class HierarchizedPickerComponent {
|
|
|
57
57
|
this.ready = false; // State to determine if all the elements of the component have been loaded
|
|
58
58
|
this.searchToDisplay = 0; // Counter to trigger the research on proper time
|
|
59
59
|
this.ignoreOptionsChanges = true; // Determines wether the options @Prop under @Watch will be ignored (to avoid circular calls)
|
|
60
|
+
this.realSearchResultData = {}; // Contains the last search's result's data that will be returned
|
|
61
|
+
this.lastSearchMatchCounter = 0; // Counter of number of matches for last search
|
|
60
62
|
this.setValueOnClick = true; // Tells wether we edit the picker value on click in the tree
|
|
61
63
|
this.mylog = console.log; // Custom log function for debug purposes
|
|
62
64
|
// Used to control wether we're draging over the same node, prevents the same event to be called multiple times
|
|
@@ -80,6 +82,7 @@ export class HierarchizedPickerComponent {
|
|
|
80
82
|
this.displayedValue = undefined;
|
|
81
83
|
this.value = [];
|
|
82
84
|
this.shownTree = false;
|
|
85
|
+
this.searchResultData = {};
|
|
83
86
|
this.hasFocus = undefined;
|
|
84
87
|
this.errorToLog = '';
|
|
85
88
|
}
|
|
@@ -111,6 +114,23 @@ export class HierarchizedPickerComponent {
|
|
|
111
114
|
}
|
|
112
115
|
this.setNewOption(this.theOptions);
|
|
113
116
|
}
|
|
117
|
+
getSearchResultWithCounter(searchResult) {
|
|
118
|
+
return { data: searchResult, matches: this.lastSearchMatchCounter };
|
|
119
|
+
}
|
|
120
|
+
searchResultDataChange(newValue, oldValue) {
|
|
121
|
+
if (newValue && newValue != oldValue) {
|
|
122
|
+
if (newValue === null || newValue === void 0 ? void 0 : newValue.value) {
|
|
123
|
+
this.realSearchResultData = this.getSearchResultWithCounter(newValue);
|
|
124
|
+
this.searchResult.emit(this.realSearchResultData);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
this.realSearchResultData = {};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
getSearchResult() {
|
|
132
|
+
return Promise.resolve(this.getSearchResultWithCounter(this.searchResultData));
|
|
133
|
+
}
|
|
114
134
|
logError(messageToLog) {
|
|
115
135
|
try {
|
|
116
136
|
console.error('--- Hierarchized picker ' + this.componentID + ' ERROR ---', messageToLog);
|
|
@@ -696,18 +716,25 @@ export class HierarchizedPickerComponent {
|
|
|
696
716
|
that.mylog('XHR ONLOAD', e, xhr.statusText);
|
|
697
717
|
if (xhr.readyState === 4) {
|
|
698
718
|
if (xhr.status === 200) {
|
|
699
|
-
|
|
719
|
+
const parsedResult = JSON.parse(xhr.responseText);
|
|
720
|
+
that.mylog('XHR 200', parsedResult);
|
|
700
721
|
if (that.rawData) {
|
|
701
|
-
that.rawData = that.searchAndMergeDataClassification(that.rawData,
|
|
722
|
+
that.rawData = that.searchAndMergeDataClassification(that.rawData, parsedResult);
|
|
702
723
|
}
|
|
703
724
|
else {
|
|
704
|
-
that.rawData =
|
|
725
|
+
that.rawData = parsedResult;
|
|
705
726
|
}
|
|
706
|
-
resolve(
|
|
727
|
+
resolve(parsedResult);
|
|
707
728
|
if (init) {
|
|
708
729
|
that.formatDefaultValue();
|
|
709
730
|
that.showSelectedNodes();
|
|
710
731
|
}
|
|
732
|
+
if (options.search) {
|
|
733
|
+
that.searchResultData = parsedResult;
|
|
734
|
+
}
|
|
735
|
+
else {
|
|
736
|
+
that.searchResultData = {};
|
|
737
|
+
}
|
|
711
738
|
that.ready = true;
|
|
712
739
|
}
|
|
713
740
|
else {
|
|
@@ -749,14 +776,21 @@ export class HierarchizedPickerComponent {
|
|
|
749
776
|
this.mylog('getDataFromSource XHR ONLOAD', e, xhr.statusText);
|
|
750
777
|
if (xhr.readyState === 4) {
|
|
751
778
|
if (xhr.status === 200) {
|
|
752
|
-
|
|
779
|
+
const parsedResult = JSON.parse(xhr.responseText);
|
|
780
|
+
this.mylog('getDataFromSource XHR 200', parsedResult);
|
|
753
781
|
if (this.rawData) {
|
|
754
|
-
this.rawData = this.searchAndMergeData(this.rawData,
|
|
782
|
+
this.rawData = this.searchAndMergeData(this.rawData, parsedResult);
|
|
783
|
+
}
|
|
784
|
+
else {
|
|
785
|
+
this.rawData = parsedResult;
|
|
786
|
+
}
|
|
787
|
+
resolve(parsedResult);
|
|
788
|
+
if (options.searchedValue) {
|
|
789
|
+
this.searchResultData = parsedResult;
|
|
755
790
|
}
|
|
756
791
|
else {
|
|
757
|
-
this.
|
|
792
|
+
this.searchResultData = {};
|
|
758
793
|
}
|
|
759
|
-
resolve(JSON.parse(xhr.responseText));
|
|
760
794
|
this.ready = true;
|
|
761
795
|
}
|
|
762
796
|
else {
|
|
@@ -963,6 +997,9 @@ export class HierarchizedPickerComponent {
|
|
|
963
997
|
}
|
|
964
998
|
}
|
|
965
999
|
triggerTreeDisplay(dataToLoad, searched) {
|
|
1000
|
+
if (searched) {
|
|
1001
|
+
this.lastSearchMatchCounter = 0;
|
|
1002
|
+
}
|
|
966
1003
|
if (this.theOptions.origin == 'thesaurus') {
|
|
967
1004
|
this.translateDataFromThesaurus(dataToLoad, searched);
|
|
968
1005
|
}
|
|
@@ -1044,6 +1081,9 @@ export class HierarchizedPickerComponent {
|
|
|
1044
1081
|
const matched = searchValue(objToPush, false);
|
|
1045
1082
|
objToPush.isDesaturated = !matched;
|
|
1046
1083
|
objToPush.searchMatch = searchValue(objToPush, true);
|
|
1084
|
+
if (objToPush.searchMatch) {
|
|
1085
|
+
this.lastSearchMatchCounter = this.lastSearchMatchCounter + 1;
|
|
1086
|
+
}
|
|
1047
1087
|
pushMe = matched || this.theOptions.searchResultPresentsUnMatched;
|
|
1048
1088
|
}
|
|
1049
1089
|
else {
|
|
@@ -1097,6 +1137,9 @@ export class HierarchizedPickerComponent {
|
|
|
1097
1137
|
const matched = searchValue(objToPush, false);
|
|
1098
1138
|
objToPush.isDesaturated = !matched;
|
|
1099
1139
|
objToPush.searchMatch = searchValue(objToPush, true);
|
|
1140
|
+
if (objToPush.searchMatch) {
|
|
1141
|
+
this.lastSearchMatchCounter = this.lastSearchMatchCounter + 1;
|
|
1142
|
+
}
|
|
1100
1143
|
pushMe = matched || this.theOptions.searchResultPresentsUnMatched;
|
|
1101
1144
|
}
|
|
1102
1145
|
else {
|
|
@@ -1150,6 +1193,9 @@ export class HierarchizedPickerComponent {
|
|
|
1150
1193
|
const matched = searchValue(objToPush, false);
|
|
1151
1194
|
objToPush.isDesaturated = !matched;
|
|
1152
1195
|
objToPush.searchMatch = searchValue(objToPush, true);
|
|
1196
|
+
if (objToPush.searchMatch) {
|
|
1197
|
+
that.lastSearchMatchCounter = that.lastSearchMatchCounter + 1;
|
|
1198
|
+
}
|
|
1153
1199
|
pushMe = matched || that.theOptions.searchResultPresentsUnMatched;
|
|
1154
1200
|
}
|
|
1155
1201
|
else {
|
|
@@ -1618,6 +1664,8 @@ export class HierarchizedPickerComponent {
|
|
|
1618
1664
|
else {
|
|
1619
1665
|
this.translateDataForTree(this.rawData);
|
|
1620
1666
|
}
|
|
1667
|
+
//Reset searched data
|
|
1668
|
+
this.searchResultData = {};
|
|
1621
1669
|
//Reset autocomplete
|
|
1622
1670
|
this.displayAutocompleteWithResults(null, '');
|
|
1623
1671
|
//Recheck previously selected fields ?
|
|
@@ -2013,6 +2061,7 @@ export class HierarchizedPickerComponent {
|
|
|
2013
2061
|
"displayedValue": {},
|
|
2014
2062
|
"value": {},
|
|
2015
2063
|
"shownTree": {},
|
|
2064
|
+
"searchResultData": {},
|
|
2016
2065
|
"hasFocus": {},
|
|
2017
2066
|
"errorToLog": {}
|
|
2018
2067
|
};
|
|
@@ -2063,6 +2112,21 @@ export class HierarchizedPickerComponent {
|
|
|
2063
2112
|
"resolved": "any",
|
|
2064
2113
|
"references": {}
|
|
2065
2114
|
}
|
|
2115
|
+
}, {
|
|
2116
|
+
"method": "searchResult",
|
|
2117
|
+
"name": "searchResult",
|
|
2118
|
+
"bubbles": true,
|
|
2119
|
+
"cancelable": true,
|
|
2120
|
+
"composed": true,
|
|
2121
|
+
"docs": {
|
|
2122
|
+
"tags": [],
|
|
2123
|
+
"text": "This event is emitted when the component's value is modified, providing the new value of the component"
|
|
2124
|
+
},
|
|
2125
|
+
"complexType": {
|
|
2126
|
+
"original": "any",
|
|
2127
|
+
"resolved": "any",
|
|
2128
|
+
"references": {}
|
|
2129
|
+
}
|
|
2066
2130
|
}];
|
|
2067
2131
|
}
|
|
2068
2132
|
static get methods() {
|
|
@@ -2102,6 +2166,22 @@ export class HierarchizedPickerComponent {
|
|
|
2102
2166
|
"tags": []
|
|
2103
2167
|
}
|
|
2104
2168
|
},
|
|
2169
|
+
"getSearchResult": {
|
|
2170
|
+
"complexType": {
|
|
2171
|
+
"signature": "() => Promise<{ data: any; matches: number; }>",
|
|
2172
|
+
"parameters": [],
|
|
2173
|
+
"references": {
|
|
2174
|
+
"Promise": {
|
|
2175
|
+
"location": "global"
|
|
2176
|
+
}
|
|
2177
|
+
},
|
|
2178
|
+
"return": "Promise<{ data: any; matches: number; }>"
|
|
2179
|
+
},
|
|
2180
|
+
"docs": {
|
|
2181
|
+
"text": "",
|
|
2182
|
+
"tags": []
|
|
2183
|
+
}
|
|
2184
|
+
},
|
|
2105
2185
|
"setOptions": {
|
|
2106
2186
|
"complexType": {
|
|
2107
2187
|
"signature": "(newOptions: IConf) => Promise<void>",
|
|
@@ -2187,6 +2267,9 @@ export class HierarchizedPickerComponent {
|
|
|
2187
2267
|
static get elementRef() { return "el"; }
|
|
2188
2268
|
static get watchers() {
|
|
2189
2269
|
return [{
|
|
2270
|
+
"propName": "searchResultData",
|
|
2271
|
+
"methodName": "searchResultDataChange"
|
|
2272
|
+
}, {
|
|
2190
2273
|
"propName": "errorToLog",
|
|
2191
2274
|
"methodName": "logError"
|
|
2192
2275
|
}, {
|
|
@@ -17831,10 +17831,13 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
17831
17831
|
this.valueChange = createEvent(this, "valueChange", 7);
|
|
17832
17832
|
this.itemDropped = createEvent(this, "itemDropped", 7);
|
|
17833
17833
|
this.itemContextMenuItemClick = createEvent(this, "itemContextMenuItemClick", 7);
|
|
17834
|
+
this.searchResult = createEvent(this, "searchResult", 7);
|
|
17834
17835
|
this.canload = true; // Determines wether the component may be loaded
|
|
17835
17836
|
this.ready = false; // State to determine if all the elements of the component have been loaded
|
|
17836
17837
|
this.searchToDisplay = 0; // Counter to trigger the research on proper time
|
|
17837
17838
|
this.ignoreOptionsChanges = true; // Determines wether the options @Prop under @Watch will be ignored (to avoid circular calls)
|
|
17839
|
+
this.realSearchResultData = {}; // Contains the last search's result's data that will be returned
|
|
17840
|
+
this.lastSearchMatchCounter = 0; // Counter of number of matches for last search
|
|
17838
17841
|
this.setValueOnClick = true; // Tells wether we edit the picker value on click in the tree
|
|
17839
17842
|
this.mylog = console.log; // Custom log function for debug purposes
|
|
17840
17843
|
// Used to control wether we're draging over the same node, prevents the same event to be called multiple times
|
|
@@ -17858,6 +17861,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
17858
17861
|
this.displayedValue = undefined;
|
|
17859
17862
|
this.value = [];
|
|
17860
17863
|
this.shownTree = false;
|
|
17864
|
+
this.searchResultData = {};
|
|
17861
17865
|
this.hasFocus = undefined;
|
|
17862
17866
|
this.errorToLog = '';
|
|
17863
17867
|
}
|
|
@@ -17889,6 +17893,23 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
17889
17893
|
}
|
|
17890
17894
|
this.setNewOption(this.theOptions);
|
|
17891
17895
|
}
|
|
17896
|
+
getSearchResultWithCounter(searchResult) {
|
|
17897
|
+
return { data: searchResult, matches: this.lastSearchMatchCounter };
|
|
17898
|
+
}
|
|
17899
|
+
searchResultDataChange(newValue, oldValue) {
|
|
17900
|
+
if (newValue && newValue != oldValue) {
|
|
17901
|
+
if (newValue === null || newValue === void 0 ? void 0 : newValue.value) {
|
|
17902
|
+
this.realSearchResultData = this.getSearchResultWithCounter(newValue);
|
|
17903
|
+
this.searchResult.emit(this.realSearchResultData);
|
|
17904
|
+
}
|
|
17905
|
+
else {
|
|
17906
|
+
this.realSearchResultData = {};
|
|
17907
|
+
}
|
|
17908
|
+
}
|
|
17909
|
+
}
|
|
17910
|
+
getSearchResult() {
|
|
17911
|
+
return Promise.resolve(this.getSearchResultWithCounter(this.searchResultData));
|
|
17912
|
+
}
|
|
17892
17913
|
logError(messageToLog) {
|
|
17893
17914
|
try {
|
|
17894
17915
|
console.error('--- Hierarchized picker ' + this.componentID + ' ERROR ---', messageToLog);
|
|
@@ -18471,18 +18492,25 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
18471
18492
|
that.mylog('XHR ONLOAD', e, xhr.statusText);
|
|
18472
18493
|
if (xhr.readyState === 4) {
|
|
18473
18494
|
if (xhr.status === 200) {
|
|
18474
|
-
|
|
18495
|
+
const parsedResult = JSON.parse(xhr.responseText);
|
|
18496
|
+
that.mylog('XHR 200', parsedResult);
|
|
18475
18497
|
if (that.rawData) {
|
|
18476
|
-
that.rawData = that.searchAndMergeDataClassification(that.rawData,
|
|
18498
|
+
that.rawData = that.searchAndMergeDataClassification(that.rawData, parsedResult);
|
|
18477
18499
|
}
|
|
18478
18500
|
else {
|
|
18479
|
-
that.rawData =
|
|
18501
|
+
that.rawData = parsedResult;
|
|
18480
18502
|
}
|
|
18481
|
-
resolve(
|
|
18503
|
+
resolve(parsedResult);
|
|
18482
18504
|
if (init) {
|
|
18483
18505
|
that.formatDefaultValue();
|
|
18484
18506
|
that.showSelectedNodes();
|
|
18485
18507
|
}
|
|
18508
|
+
if (options.search) {
|
|
18509
|
+
that.searchResultData = parsedResult;
|
|
18510
|
+
}
|
|
18511
|
+
else {
|
|
18512
|
+
that.searchResultData = {};
|
|
18513
|
+
}
|
|
18486
18514
|
that.ready = true;
|
|
18487
18515
|
}
|
|
18488
18516
|
else {
|
|
@@ -18524,14 +18552,21 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
18524
18552
|
this.mylog('getDataFromSource XHR ONLOAD', e, xhr.statusText);
|
|
18525
18553
|
if (xhr.readyState === 4) {
|
|
18526
18554
|
if (xhr.status === 200) {
|
|
18527
|
-
|
|
18555
|
+
const parsedResult = JSON.parse(xhr.responseText);
|
|
18556
|
+
this.mylog('getDataFromSource XHR 200', parsedResult);
|
|
18528
18557
|
if (this.rawData) {
|
|
18529
|
-
this.rawData = this.searchAndMergeData(this.rawData,
|
|
18558
|
+
this.rawData = this.searchAndMergeData(this.rawData, parsedResult);
|
|
18559
|
+
}
|
|
18560
|
+
else {
|
|
18561
|
+
this.rawData = parsedResult;
|
|
18562
|
+
}
|
|
18563
|
+
resolve(parsedResult);
|
|
18564
|
+
if (options.searchedValue) {
|
|
18565
|
+
this.searchResultData = parsedResult;
|
|
18530
18566
|
}
|
|
18531
18567
|
else {
|
|
18532
|
-
this.
|
|
18568
|
+
this.searchResultData = {};
|
|
18533
18569
|
}
|
|
18534
|
-
resolve(JSON.parse(xhr.responseText));
|
|
18535
18570
|
this.ready = true;
|
|
18536
18571
|
}
|
|
18537
18572
|
else {
|
|
@@ -18738,6 +18773,9 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
18738
18773
|
}
|
|
18739
18774
|
}
|
|
18740
18775
|
triggerTreeDisplay(dataToLoad, searched) {
|
|
18776
|
+
if (searched) {
|
|
18777
|
+
this.lastSearchMatchCounter = 0;
|
|
18778
|
+
}
|
|
18741
18779
|
if (this.theOptions.origin == 'thesaurus') {
|
|
18742
18780
|
this.translateDataFromThesaurus(dataToLoad, searched);
|
|
18743
18781
|
}
|
|
@@ -18819,6 +18857,9 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
18819
18857
|
const matched = searchValue(objToPush, false);
|
|
18820
18858
|
objToPush.isDesaturated = !matched;
|
|
18821
18859
|
objToPush.searchMatch = searchValue(objToPush, true);
|
|
18860
|
+
if (objToPush.searchMatch) {
|
|
18861
|
+
this.lastSearchMatchCounter = this.lastSearchMatchCounter + 1;
|
|
18862
|
+
}
|
|
18822
18863
|
pushMe = matched || this.theOptions.searchResultPresentsUnMatched;
|
|
18823
18864
|
}
|
|
18824
18865
|
else {
|
|
@@ -18872,6 +18913,9 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
18872
18913
|
const matched = searchValue(objToPush, false);
|
|
18873
18914
|
objToPush.isDesaturated = !matched;
|
|
18874
18915
|
objToPush.searchMatch = searchValue(objToPush, true);
|
|
18916
|
+
if (objToPush.searchMatch) {
|
|
18917
|
+
this.lastSearchMatchCounter = this.lastSearchMatchCounter + 1;
|
|
18918
|
+
}
|
|
18875
18919
|
pushMe = matched || this.theOptions.searchResultPresentsUnMatched;
|
|
18876
18920
|
}
|
|
18877
18921
|
else {
|
|
@@ -18925,6 +18969,9 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
18925
18969
|
const matched = searchValue(objToPush, false);
|
|
18926
18970
|
objToPush.isDesaturated = !matched;
|
|
18927
18971
|
objToPush.searchMatch = searchValue(objToPush, true);
|
|
18972
|
+
if (objToPush.searchMatch) {
|
|
18973
|
+
that.lastSearchMatchCounter = that.lastSearchMatchCounter + 1;
|
|
18974
|
+
}
|
|
18928
18975
|
pushMe = matched || that.theOptions.searchResultPresentsUnMatched;
|
|
18929
18976
|
}
|
|
18930
18977
|
else {
|
|
@@ -19393,6 +19440,8 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
19393
19440
|
else {
|
|
19394
19441
|
this.translateDataForTree(this.rawData);
|
|
19395
19442
|
}
|
|
19443
|
+
//Reset searched data
|
|
19444
|
+
this.searchResultData = {};
|
|
19396
19445
|
//Reset autocomplete
|
|
19397
19446
|
this.displayAutocompleteWithResults(null, '');
|
|
19398
19447
|
//Recheck previously selected fields ?
|
|
@@ -19675,6 +19724,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
19675
19724
|
}
|
|
19676
19725
|
get el() { return this; }
|
|
19677
19726
|
static get watchers() { return {
|
|
19727
|
+
"searchResultData": ["searchResultDataChange"],
|
|
19678
19728
|
"errorToLog": ["logError"],
|
|
19679
19729
|
"newoptions": ["setNewOptions"],
|
|
19680
19730
|
"newfilter": ["setNewFilter"],
|
|
@@ -19684,7 +19734,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
|
|
|
19684
19734
|
static get style() { return hierarchizedPickerCss; }
|
|
19685
19735
|
};
|
|
19686
19736
|
|
|
19687
|
-
const RenecoHierarchizedPicker = /*@__PURE__*/proxyCustomElement(HierarchizedPickerComponent, [0,"reneco-hierarchized-picker",{"options":[16],"valueChangeCallback":[16],"disabled":[4],"newoptions":[1],"newfilter":[1],"isDisabled":[32],"theOptions":[32],"componentID":[32],"rawData":[32],"pickerClass":[32],"displayedValue":[32],"value":[32],"shownTree":[32],"hasFocus":[32],"errorToLog":[32]}]);
|
|
19737
|
+
const RenecoHierarchizedPicker = /*@__PURE__*/proxyCustomElement(HierarchizedPickerComponent, [0,"reneco-hierarchized-picker",{"options":[16],"valueChangeCallback":[16],"disabled":[4],"newoptions":[1],"newfilter":[1],"isDisabled":[32],"theOptions":[32],"componentID":[32],"rawData":[32],"pickerClass":[32],"displayedValue":[32],"value":[32],"shownTree":[32],"searchResultData":[32],"hasFocus":[32],"errorToLog":[32]}]);
|
|
19688
19738
|
const defineCustomElements = (opts) => {
|
|
19689
19739
|
if (typeof customElements !== 'undefined') {
|
|
19690
19740
|
[
|
package/dist/esm/loader.js
CHANGED
|
@@ -11,7 +11,7 @@ const patchEsm = () => {
|
|
|
11
11
|
const defineCustomElements = (win, options) => {
|
|
12
12
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
13
13
|
return patchEsm().then(() => {
|
|
14
|
-
return bootstrapLazy([["reneco-hierarchized-picker",[[0,"reneco-hierarchized-picker",{"options":[16],"valueChangeCallback":[16],"disabled":[4],"newoptions":[1],"newfilter":[1],"isDisabled":[32],"theOptions":[32],"componentID":[32],"rawData":[32],"pickerClass":[32],"displayedValue":[32],"value":[32],"shownTree":[32],"hasFocus":[32],"errorToLog":[32],"getValue":[64],"refreshPicker":[64],"setOptions":[64],"filterTree":[64],"showSelectedNodes":[64],"clearPicker":[64]}]]]], options);
|
|
14
|
+
return bootstrapLazy([["reneco-hierarchized-picker",[[0,"reneco-hierarchized-picker",{"options":[16],"valueChangeCallback":[16],"disabled":[4],"newoptions":[1],"newfilter":[1],"isDisabled":[32],"theOptions":[32],"componentID":[32],"rawData":[32],"pickerClass":[32],"displayedValue":[32],"value":[32],"shownTree":[32],"searchResultData":[32],"hasFocus":[32],"errorToLog":[32],"getValue":[64],"refreshPicker":[64],"getSearchResult":[64],"setOptions":[64],"filterTree":[64],"showSelectedNodes":[64],"clearPicker":[64]}]]]], options);
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
|