Your IP : 216.73.216.26


Current Path : /home2/wtmwscom/public_html/post/Portal/scripts/
Upload File :
Current File : /home2/wtmwscom/public_html/post/Portal/scripts/OutSystemsUI_007.js

define("OutSystemsUI.Interaction.DropdownSearch.mvc$model", ["OutSystems/ClientRuntime/Main", "OutSystemsUI.model", "OutSystemsUI.model$DropdownItemList", "OutSystemsUI.model$DropdownItemRec"], function (OutSystems, OutSystemsUIModel) {
var OS = OutSystems.Internal;


var VariablesRecord = (function (_super) {
__extends(VariablesRecord, _super);
function VariablesRecord(defaults) {
_super.apply(this, arguments);
}
VariablesRecord.attributesToDeclare = function () {
return [
this.attr("ChoicesObj", "choicesObjVar", "ChoicesObj", true, false, OS.Types.Object, function () {
return null;
}, false), 
this.attr("IsSelecting", "isSelectingVar", "IsSelecting", true, false, OS.Types.Boolean, function () {
return false;
}, false), 
this.attr("ItemList", "itemListIn", "ItemList", true, false, OS.Types.RecordList, function () {
return OS.DataTypes.ImmutableBase.getData(new OutSystemsUIModel.DropdownItemList());
}, false, OutSystemsUIModel.DropdownItemList), 
this.attr("_itemListInDataFetchStatus", "_itemListInDataFetchStatus", "_itemListInDataFetchStatus", true, false, OS.Types.Integer, function () {
return /*Fetched*/ 1;
}, false), 
this.attr("SelectedItem", "selectedItemIn", "SelectedItem", true, false, OS.Types.Record, function () {
return OS.DataTypes.ImmutableBase.getData(new OutSystemsUIModel.DropdownItemRec());
}, false, OutSystemsUIModel.DropdownItemRec), 
this.attr("_selectedItemInDataFetchStatus", "_selectedItemInDataFetchStatus", "_selectedItemInDataFetchStatus", true, false, OS.Types.Integer, function () {
return /*Fetched*/ 1;
}, false), 
this.attr("IsDisabled", "isDisabledIn", "IsDisabled", true, false, OS.Types.Boolean, function () {
return false;
}, false), 
this.attr("_isDisabledInDataFetchStatus", "_isDisabledInDataFetchStatus", "_isDisabledInDataFetchStatus", true, false, OS.Types.Integer, function () {
return /*Fetched*/ 1;
}, false), 
this.attr("EmptyText", "emptyTextIn", "EmptyText", true, false, OS.Types.Text, function () {
return "Select an item";
}, false), 
this.attr("_emptyTextInDataFetchStatus", "_emptyTextInDataFetchStatus", "_emptyTextInDataFetchStatus", true, false, OS.Types.Integer, function () {
return /*Fetched*/ 1;
}, false), 
this.attr("SearchPrompt", "searchPromptIn", "SearchPrompt", true, false, OS.Types.Text, function () {
return "Search";
}, false), 
this.attr("_searchPromptInDataFetchStatus", "_searchPromptInDataFetchStatus", "_searchPromptInDataFetchStatus", true, false, OS.Types.Integer, function () {
return /*Fetched*/ 1;
}, false), 
this.attr("NoResultsText", "noResultsTextIn", "NoResultsText", true, false, OS.Types.Text, function () {
return "No results found";
}, false), 
this.attr("_noResultsTextInDataFetchStatus", "_noResultsTextInDataFetchStatus", "_noResultsTextInDataFetchStatus", true, false, OS.Types.Integer, function () {
return /*Fetched*/ 1;
}, false), 
this.attr("AdvancedFormat", "advancedFormatIn", "AdvancedFormat", true, false, OS.Types.Text, function () {
return "{}";
}, false), 
this.attr("_advancedFormatInDataFetchStatus", "_advancedFormatInDataFetchStatus", "_advancedFormatInDataFetchStatus", true, false, OS.Types.Integer, function () {
return /*Fetched*/ 1;
}, false), 
this.attr("ExtendedClass", "extendedClassIn", "ExtendedClass", true, false, OS.Types.Text, function () {
return "";
}, false), 
this.attr("_extendedClassInDataFetchStatus", "_extendedClassInDataFetchStatus", "_extendedClassInDataFetchStatus", true, false, OS.Types.Integer, function () {
return /*Fetched*/ 1;
}, false)
].concat(_super.attributesToDeclare.call(this));
};
VariablesRecord.init();
return VariablesRecord;
})(OS.DataTypes.GenericRecord);
var WidgetsRecord = (function (_super) {
__extends(WidgetsRecord, _super);
function WidgetsRecord() {
_super.apply(this, arguments);
}
WidgetsRecord.getWidgetsType = function () {
return {};
};

return WidgetsRecord;
})(OS.Model.BaseWidgetRecordMap);
var Model = (function (_super) {
__extends(Model, _super);
function Model() {
_super.apply(this, arguments);
}
Model.getVariablesRecordConstructor = function () {
return VariablesRecord;
};
Model.getWidgetsRecordConstructor = function () {
return WidgetsRecord;
};
Object.defineProperty(Model, "hasValidationWidgets", {
enumerable: true,
configurable: true,
get: function () {
return false;
}
});

Model.prototype.setInputs = function (inputs) {
if("ItemList" in inputs) {
this.variables.itemListIn = inputs.ItemList;
if("_itemListInDataFetchStatus" in inputs) {
this.variables._itemListInDataFetchStatus = inputs._itemListInDataFetchStatus;
}

}

if("SelectedItem" in inputs) {
this.variables.selectedItemIn = inputs.SelectedItem;
if("_selectedItemInDataFetchStatus" in inputs) {
this.variables._selectedItemInDataFetchStatus = inputs._selectedItemInDataFetchStatus;
}

}

if("IsDisabled" in inputs) {
this.variables.isDisabledIn = inputs.IsDisabled;
if("_isDisabledInDataFetchStatus" in inputs) {
this.variables._isDisabledInDataFetchStatus = inputs._isDisabledInDataFetchStatus;
}

}

if("EmptyText" in inputs) {
this.variables.emptyTextIn = inputs.EmptyText;
if("_emptyTextInDataFetchStatus" in inputs) {
this.variables._emptyTextInDataFetchStatus = inputs._emptyTextInDataFetchStatus;
}

}

if("SearchPrompt" in inputs) {
this.variables.searchPromptIn = inputs.SearchPrompt;
if("_searchPromptInDataFetchStatus" in inputs) {
this.variables._searchPromptInDataFetchStatus = inputs._searchPromptInDataFetchStatus;
}

}

if("NoResultsText" in inputs) {
this.variables.noResultsTextIn = inputs.NoResultsText;
if("_noResultsTextInDataFetchStatus" in inputs) {
this.variables._noResultsTextInDataFetchStatus = inputs._noResultsTextInDataFetchStatus;
}

}

if("AdvancedFormat" in inputs) {
this.variables.advancedFormatIn = inputs.AdvancedFormat;
if("_advancedFormatInDataFetchStatus" in inputs) {
this.variables._advancedFormatInDataFetchStatus = inputs._advancedFormatInDataFetchStatus;
}

}

if("ExtendedClass" in inputs) {
this.variables.extendedClassIn = inputs.ExtendedClass;
if("_extendedClassInDataFetchStatus" in inputs) {
this.variables._extendedClassInDataFetchStatus = inputs._extendedClassInDataFetchStatus;
}

}

};
return Model;
})(OS.Model.BaseViewModel);
return new OS.Model.ModelFactory(Model);
});
define("OutSystemsUI.Interaction.DropdownSearch.mvc$view", ["OutSystems/ClientRuntime/Main", "OutSystemsUI.model", "OutSystemsUI.controller", "react", "OutSystems/ReactView/Main", "OutSystemsUI.Interaction.DropdownSearch.mvc$model", "OutSystemsUI.Interaction.DropdownSearch.mvc$controller", "OutSystems/ReactWidgets/Main", "OutSystemsUI.model$DropdownItemList", "OutSystemsUI.model$DropdownItemRec"], function (OutSystems, OutSystemsUIModel, OutSystemsUIController, React, OSView, OutSystemsUI_Interaction_DropdownSearch_mvc_model, OutSystemsUI_Interaction_DropdownSearch_mvc_controller, OSWidgets) {
    var OS = OutSystems.Internal;
var PlaceholderContent = OSView.Widget.PlaceholderContent;
var IteratorPlaceholderContent = OSView.Widget.IteratorPlaceholderContent;


    var View = (function (_super) {
        __extends(View,_super);
        function View() {
            try {
                this.initialize.apply(this, arguments);
            } catch (error) {
                View.handleError(error);
                throw error;
            }
        }
        View.prototype.initialize = function() {
            _super.apply(this, arguments);
        };
        View.displayName = "Interaction.DropdownSearch";
        View.getCssDependencies = function() {
            return ["css/OutSystemsReactWidgets.css"];
        };
        View.getJsDependencies = function() {
            return ["scripts/OutSystemsUI.Choices.js"];
        };
        View.getBlocks = function() {
            return [];
        };
        Object.defineProperty(View.prototype, "modelFactory", {
            get: function () {
                return OutSystemsUI_Interaction_DropdownSearch_mvc_model;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(View.prototype, "controllerFactory", {
            get: function () {
                return OutSystemsUI_Interaction_DropdownSearch_mvc_controller;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(View.prototype, "title", {
            get: function () {
                return "";
            },
            enumerable: true,
            configurable: true
        });
        View.prototype.internalRender = function() {
            var model = this.model;
            var controller = this.controller;
            var idService = this.idService;
            var validationService = controller.validationService;
            var widgetsRecordProvider = this.widgetsRecordProvider;
            var callContext = controller.callContext();
            var $if = View.ifWidget;
            var asPrimitiveValue = View.asPrimitiveValue;
            var _this = this;

            return React.createElement("div", this.getRootNodeProperties(), $if(false, false, this, function () {
return [];
}, function () {
return [React.createElement(OSWidgets.AdvancedHtml, {
extendedProperties: {
className: "dropdown-search-select"
},
tag: "select",
_idProps: {
service: idService,
name: "DropdownSelect"
},
_widgetRecordProvider: widgetsRecordProvider
})];
}));
        };
        return View;
    })(OSView.BaseView.BaseWebBlock);
	
    return View;
});
define("OutSystemsUI.Interaction.DropdownSearch.mvc$controller", ["OutSystems/ClientRuntime/Main", "OutSystemsUI.model", "OutSystemsUI.controller", "OutSystemsUI.languageResources", "OutSystemsUI.Interaction.DropdownSearch.mvc$controller.Init.InitJS", "OutSystemsUI.Interaction.DropdownSearch.mvc$controller.OnDestroy.OnDestroyJS", "OutSystemsUI.Interaction.DropdownSearch.mvc$controller.OnParametersChanged.CheckObjectStatusJS", "OutSystemsUI.model$DropdownItemList", "OutSystemsUI.model$DropdownItemRec"], function (OutSystems, OutSystemsUIModel, OutSystemsUIController, OutSystemsUILanguageResources, OutSystemsUI_Interaction_DropdownSearch_mvc_controller_Init_InitJS, OutSystemsUI_Interaction_DropdownSearch_mvc_controller_OnDestroy_OnDestroyJS, OutSystemsUI_Interaction_DropdownSearch_mvc_controller_OnParametersChanged_CheckObjectStatusJS) {
var OS = OutSystems.Internal;
var Controller = (function (_super) {
__extends(Controller, _super);
function Controller() {
_super.apply(this, arguments);
var controller = this.controller;
this.clientActionProxies = {
onShowDropdown$Action: function () {
return controller.executeActionInsideJSNode(controller._onShowDropdown$Action.bind(controller), controller.callContext(), function (actionResults) {
return {};
});
},
onHideDropdown$Action: function () {
return controller.executeActionInsideJSNode(controller._onHideDropdown$Action.bind(controller), controller.callContext(), function (actionResults) {
return {};
});
},
onChangeListener$Action: function (valueIn, labelIn) {
valueIn = (valueIn === undefined) ? "" : valueIn;
labelIn = (labelIn === undefined) ? "" : labelIn;
return controller.executeActionInsideJSNode(controller._onChangeListener$Action.bind(controller, OS.DataConversion.JSNodeParamConverter.from(valueIn, OS.Types.Text), OS.DataConversion.JSNodeParamConverter.from(labelIn, OS.Types.Text)), controller.callContext(), function (actionResults) {
return {};
});
}
};
this.dataFetchDependenciesOriginal = {};
this.dataFetchDependentsGraph = {};
this.useImprovedDataFetch = false;
this.hasDependenciesBetweenSources = false;
this.shouldSendClientVarsToDataSources = false;
}
// Server Actions

// Aggregates and Data Actions

Controller.prototype.dataFetchActionNames = [];
// Client Actions
Controller.prototype._init$Action = function (callContext) {
var model = this.model;
var controller = this.controller;
var idService = this.idService;
controller.ensureControllerAlive("Init");
callContext = controller.callContext(callContext);
var vars = new OS.DataTypes.VariableHolder(new (controller.constructor.getVariableGroupType("OutSystemsUI.Interaction.DropdownSearch.Init$vars"))());
var listIndexOfVar = new OS.DataTypes.VariableHolder();
var initJSResult = new OS.DataTypes.VariableHolder();
var jSONSerializeItemListVar = new OS.DataTypes.VariableHolder(new OS.DataTypes.JSONSerializeOutputType());
if(((model.variables.itemListIn.length > 0))) {
// Execute Action: ListIndexOf
listIndexOfVar.value = OS.SystemActions.listIndexOf(model.variables.itemListIn, function (p) {
return (p.valueAttr === model.variables.selectedItemIn.valueAttr);
}, callContext);

// SelectedPosition = ListIndexOf.Position
vars.value.selectedPositionVar = listIndexOfVar.value.positionOut;
// JSON Serialize: JSONSerializeItemList
jSONSerializeItemListVar.value.jSONOut = OS.JSONUtils.serializeToJSON(model.variables.itemListIn, false, false);
initJSResult.value = controller.safeExecuteJSNode(OutSystemsUI_Interaction_DropdownSearch_mvc_controller_Init_InitJS, "Init", "Init", {
NullValue: OS.DataConversion.JSNodeParamConverter.to(OS.BuiltinFunctions.nullIdentifier(), OS.Types.Integer),
WidgetId: OS.DataConversion.JSNodeParamConverter.to(idService.getId("DropdownSelect"), OS.Types.Text),
SelectedPosition: OS.DataConversion.JSNodeParamConverter.to(vars.value.selectedPositionVar, OS.Types.Integer),
searchPlaceholderValue: OS.DataConversion.JSNodeParamConverter.to(model.variables.searchPromptIn, OS.Types.Text),
ExtendedClass: OS.DataConversion.JSNodeParamConverter.to(model.variables.extendedClassIn, OS.Types.Text),
noResultsText: OS.DataConversion.JSNodeParamConverter.to(model.variables.noResultsTextIn, OS.Types.Text),
IsDisabled: OS.DataConversion.JSNodeParamConverter.to(model.variables.isDisabledIn, OS.Types.Boolean),
NullText: OS.DataConversion.JSNodeParamConverter.to(OS.BuiltinFunctions.nullTextIdentifier(), OS.Types.Text),
EmptyValue: OS.DataConversion.JSNodeParamConverter.to(model.variables.emptyTextIn, OS.Types.Text),
AdvancedFormat: OS.DataConversion.JSNodeParamConverter.to(model.variables.advancedFormatIn, OS.Types.Text),
ItemList: OS.DataConversion.JSNodeParamConverter.to(jSONSerializeItemListVar.value.jSONOut, OS.Types.Text),
ChoicesObj: OS.DataConversion.JSNodeParamConverter.to(null, OS.Types.Object)
}, function ($parameters) {
var jsNodeResult = new (controller.constructor.getVariableGroupType("OutSystemsUI.Interaction.DropdownSearch.Init$initJSResult"))();
jsNodeResult.choicesObjOut = OS.DataConversion.JSNodeParamConverter.from($parameters.ChoicesObj, OS.Types.Object);
return jsNodeResult;
}, {
OnShowDropdown: controller.clientActionProxies.onShowDropdown$Action,
OnHideDropdown: controller.clientActionProxies.onHideDropdown$Action,
OnChangeListener: controller.clientActionProxies.onChangeListener$Action
}, {});
// ChoicesObj = Init.ChoicesObj
model.variables.choicesObjVar = initJSResult.value.choicesObjOut;
}

};
Controller.registerVariableGroupType("OutSystemsUI.Interaction.DropdownSearch.Init$vars", [{
name: "SelectedPosition",
attrName: "selectedPositionVar",
mandatory: false,
dataType: OS.Types.Integer,
defaultValue: function () {
return -1;
}
}]);
Controller.registerVariableGroupType("OutSystemsUI.Interaction.DropdownSearch.Init$initJSResult", [{
name: "ChoicesObj",
attrName: "choicesObjOut",
mandatory: true,
dataType: OS.Types.Object,
defaultValue: function () {
return null;
}
}]);
Controller.prototype._onChangeListener$Action = function (valueIn, labelIn, callContext) {
var model = this.model;
var controller = this.controller;
var idService = this.idService;
controller.ensureControllerAlive("OnChangeListener");
callContext = controller.callContext(callContext);
var vars = new OS.DataTypes.VariableHolder(new (controller.constructor.getVariableGroupType("OutSystemsUI.Interaction.DropdownSearch.OnChangeListener$vars"))());
vars.value.valueInLocal = valueIn;
vars.value.labelInLocal = labelIn;
return OS.Flow.executeAsyncFlow(function () {
// SelectedItem
// SelectedItem.Value = Value
model.variables.selectedItemIn.valueAttr = vars.value.valueInLocal;
// SelectedItem.Text = Label
model.variables.selectedItemIn.textAttr = vars.value.labelInLocal;
// Trigger Event: OnSelect
return controller.onSelect$Action(model.variables.selectedItemIn, callContext);
});
};
Controller.registerVariableGroupType("OutSystemsUI.Interaction.DropdownSearch.OnChangeListener$vars", [{
name: "Value",
attrName: "valueInLocal",
mandatory: false,
dataType: OS.Types.Text,
defaultValue: function () {
return "";
}
}, {
name: "Label",
attrName: "labelInLocal",
mandatory: false,
dataType: OS.Types.Text,
defaultValue: function () {
return "";
}
}]);
Controller.prototype._onShowDropdown$Action = function (callContext) {
var model = this.model;
var controller = this.controller;
var idService = this.idService;
controller.ensureControllerAlive("OnShowDropdown");
callContext = controller.callContext(callContext);
// IsSelecting = True
model.variables.isSelectingVar = true;
};
Controller.prototype._onHideDropdown$Action = function (callContext) {
var model = this.model;
var controller = this.controller;
var idService = this.idService;
controller.ensureControllerAlive("OnHideDropdown");
callContext = controller.callContext(callContext);
// IsSelecting = False
model.variables.isSelectingVar = false;
};
Controller.prototype._onDestroy$Action = function (callContext) {
var model = this.model;
var controller = this.controller;
var idService = this.idService;
controller.ensureControllerAlive("OnDestroy");
callContext = controller.callContext(callContext);
controller.safeExecuteJSNode(OutSystemsUI_Interaction_DropdownSearch_mvc_controller_OnDestroy_OnDestroyJS, "OnDestroy", "OnDestroy", {
ChoicesObj: OS.DataConversion.JSNodeParamConverter.to(model.variables.choicesObjVar, OS.Types.Object)
}, function ($parameters) {
}, {}, {});
};
Controller.prototype._onParametersChanged$Action = function (callContext) {
var model = this.model;
var controller = this.controller;
var idService = this.idService;
controller.ensureControllerAlive("OnParametersChanged");
callContext = controller.callContext(callContext);
var checkObjectStatusJSResult = new OS.DataTypes.VariableHolder();
if((!(model.variables.isSelectingVar))) {
checkObjectStatusJSResult.value = controller.safeExecuteJSNode(OutSystemsUI_Interaction_DropdownSearch_mvc_controller_OnParametersChanged_CheckObjectStatusJS, "CheckObjectStatus", "OnParametersChanged", {
Object: OS.DataConversion.JSNodeParamConverter.to(model.variables.choicesObjVar, OS.Types.Object),
ObjectIsDefined: OS.DataConversion.JSNodeParamConverter.to(false, OS.Types.Boolean)
}, function ($parameters) {
var jsNodeResult = new (controller.constructor.getVariableGroupType("OutSystemsUI.Interaction.DropdownSearch.OnParametersChanged$checkObjectStatusJSResult"))();
jsNodeResult.objectIsDefinedOut = OS.DataConversion.JSNodeParamConverter.from($parameters.ObjectIsDefined, OS.Types.Boolean);
return jsNodeResult;
}, {}, {});
// ObjectIsDefined
if((checkObjectStatusJSResult.value.objectIsDefinedOut)) {
// Execute Action: OnDestroy
controller._onDestroy$Action(callContext);
}

// Execute Action: Init
controller._init$Action(callContext);
}

};
Controller.registerVariableGroupType("OutSystemsUI.Interaction.DropdownSearch.OnParametersChanged$checkObjectStatusJSResult", [{
name: "ObjectIsDefined",
attrName: "objectIsDefinedOut",
mandatory: true,
dataType: OS.Types.Boolean,
defaultValue: function () {
return false;
}
}]);

Controller.prototype.init$Action = function (callContext) {
var controller = this.controller;
return controller.safeExecuteClientAction(controller._init$Action, callContext);

};
Controller.prototype.onChangeListener$Action = function (valueIn, labelIn, callContext) {
var controller = this.controller;
return controller.safeExecuteClientAction(controller._onChangeListener$Action, callContext, valueIn, labelIn);

};
Controller.prototype.onShowDropdown$Action = function (callContext) {
var controller = this.controller;
return controller.safeExecuteClientAction(controller._onShowDropdown$Action, callContext);

};
Controller.prototype.onHideDropdown$Action = function (callContext) {
var controller = this.controller;
return controller.safeExecuteClientAction(controller._onHideDropdown$Action, callContext);

};
Controller.prototype.onDestroy$Action = function (callContext) {
var controller = this.controller;
return controller.safeExecuteClientAction(controller._onDestroy$Action, callContext);

};
Controller.prototype.onParametersChanged$Action = function (callContext) {
var controller = this.controller;
return controller.safeExecuteClientAction(controller._onParametersChanged$Action, callContext);

};
Controller.prototype.onSelect$Action = function () {
return Promise.resolve();
};

// Event Handler Actions
Controller.prototype.onInitializeEventHandler = null;
Controller.prototype.onReadyEventHandler = function (callContext) {
var controller = this.controller;
var model = this.model;
var idService = this.idService;

return controller.init$Action(callContext);

};
Controller.prototype.onRenderEventHandler = null;
Controller.prototype.onDestroyEventHandler = function (callContext) {
var controller = this.controller;
var model = this.model;
var idService = this.idService;

return controller.onDestroy$Action(callContext);

};
Controller.prototype.onParametersChangedEventHandler = function (callContext) {
var controller = this.controller;
var model = this.model;
var idService = this.idService;

return controller.onParametersChanged$Action(callContext);

};
Controller.prototype.handleError = function (ex) {
return controller.handleError(ex);
};
Controller.checkPermissions = function () {
};
Controller.prototype.getDefaultTimeout = function () {
return OutSystemsUIController.default.defaultTimeout;
};
return Controller;
})(OS.Controller.BaseViewController);
return new OS.Controller.ControllerFactory(Controller, OutSystemsUILanguageResources);
});
define("OutSystemsUI.Interaction.DropdownSearch.mvc$controller.Init.InitJS", [], function () {
return function ($parameters, $actions, $roles, $public) {
var str = String($parameters.AdvancedFormat);
var paramList = JSON.parse($parameters.ItemList);
var elementId = document.getElementById($parameters.WidgetId);
var isRTL = document.body.classList.contains('is-rtl');
var isDisabled = $parameters.IsDisabled;
var showEmptySelected = true;
var choices;
var itemList = [];

// Map paramList to a new one, as the library only supports 'value' and 'label'
for(var i = 0; i < paramList.length; i++) {
    itemList.push({value:paramList[i].Value, label: paramList[i].Text});
}

// Function to set the options and parameters and init the Choices
var init = function(){
    
    // Validate if SelectedItem is set
    if($parameters.SelectedPosition >= 0) {
        itemList[$parameters.SelectedPosition].selected = true;
        showEmptySelected = false;
    } 
    
    // Set default options 
    var options = {
        choices: itemList,
        itemSelectText: "",
        noResultsText: $parameters.noResultsText,
        searchPlaceholderValue: $parameters.searchPlaceholderValue,
        classNames: {containerOuter: 'choices ' + $parameters.ExtendedClass},
        fuseOptions: {
            includeMatches: true,
            threshold: 0.2,
            location: 0,
            distance: 100,
            maxPatternLength: 32,
            minMatchCharLength: 1
        }
    };
    
    if(str.length > 0) {
        var json = JSON.stringify(eval('(' + str + ')'));  
        options = mergeJSON(options, JSON.parse(json));
    }
    
    // Create choices
    choices = new Choices(elementId, options);
    
    // Add placeholder only if not using selectedItem and EmptyValue isn't empty
    if($parameters.EmptyValue !== "") {
        choices.setChoices([{value: $parameters.NullValue, label: $parameters.EmptyValue, selected: showEmptySelected, disabled: false, placeholder: true}], 'value', 'label', false);
    }
    
    // Assign choices object to output, to be able to destroy it OnDestroy
    $parameters.ChoicesObj = choices;
    
    // Creates div around search input
    createEl('.choices__input--cloned', 'div', 'search--wrapper');
    
    // Set Disabled status
    if(isDisabled) {
        choices.disable();
    } else {
        choices.enable();
    }
    
    // Set rtl attributes
    if(isRTL) {
        choices.containerOuter.element.setAttribute('dir', 'rtl');
        choices.choiceList.element.setAttribute('dir', 'rtl');
    }
    
    // Add change listener on opening Dropdown, to pass set IsSelecting to true
    choices.passedElement.element.addEventListener('showDropdown', function(event){
        $actions.OnShowDropdown();
    });
    
    // Add change listener on closing Dropdown, to pass set IsSelecting to false
    choices.passedElement.element.addEventListener('hideDropdown', function(event){
        $actions.OnHideDropdown();
    });
    
    // Add change listener on input, to pass currentValue to event
    choices.passedElement.element.addEventListener('choice', function(event){
        
        // Check if is Placeholder to pass Null Values
        var isPlaceholder = event.detail.choice.placeholder;
        var currentValue = isPlaceholder ? $parameters.NullValue : event.detail.choice.value;
        var currentLabel = isPlaceholder ? $parameters.NullText : event.detail.choice.label;
        
        $actions.OnChangeListener(currentValue, currentLabel);
    });
};

// Recursive Function for closest()
var closestFn = function(element, classToSearch) {
    if(element && element.classList.contains(classToSearch)) {
        return element;
    } else if(!element || element && element.classList.contains('layout')) {
        return false;
    } else {
        return closestFn(element.parentElement, classToSearch);
    }
};

// Function to create div around search input (necessary for css search icon)
var createEl = function(query, tag, className) {
   var queryList = document.querySelectorAll(query);
   
   for(var i = 0; i < queryList.length; i++) {
        var elem = queryList[i];
        var wrapper = document.createElement(tag);

        if(!closestFn(elem, className)){
            elem.parentElement.insertBefore(wrapper, elem);
            wrapper.appendChild(elem);
            wrapper.classList.add(className);
        }
   }
};

// AdvancedFormat
function mergeJSON(target, add) {
    function isObject(obj) {
        if (typeof obj == 'object') {
            for (var key in obj) {
                if (obj.hasOwnProperty(key)) {
                    return true; // search for first object prop
                }
            }
        }
        return false;
    }
    for (var key in add) {
        if (add.hasOwnProperty(key)) {
            if (target[key] && isObject(target[key]) && isObject(add[key])) {
                mergeJSON(target[key], add[key]);
            } else {
                target[key] = add[key];
            }
        }
    }
    return target;
}

// Call init
init();


};
});
define("OutSystemsUI.Interaction.DropdownSearch.mvc$controller.OnDestroy.OnDestroyJS", [], function () {
return function ($parameters, $actions, $roles, $public) {
$parameters.ChoicesObj.destroy();

};
});
define("OutSystemsUI.Interaction.DropdownSearch.mvc$controller.OnParametersChanged.CheckObjectStatusJS", [], function () {
return function ($parameters, $actions, $roles, $public) {
$parameters.ObjectIsDefined = $parameters.Object !== null;
};
});