{"version":3,"file":"leanforms-next.js","names":["window","leanformsNext","loginMessageShown","constructor","this","DEFAULT_GRIDCOLUMN_WIDTH","HEADER_HEIGHT","MIN_GRIDCOLUMN_WIDTH","RESPONSIVE_WIDTH","isIos","test","navigator","platform","maxTouchPoints","isIosPWA","standalone","$","ajaxPrefilter","options","originalOptions","xhr","antiforgeryToken","val","setRequestHeader","antiforgeryHeader","offlineUserList","offlineGroupList","responsive","document","documentElement","getBoundingClientRect","width","toString","version","onAjaxError","e","args","event","XMLHttpRequest","loginRequired","status","statusText","showLoginMessage","responseText","onLine","resources","noNetworkMessage","contentType","getResponseHeader","isHtml","includes","isJson","handleError","message","errorMessage","JSON","parse","core","notify","toLowerCase","indexOf","console","log","Error","applyColumnsWidths","gridReference","gridWidthsInput","key","value","length","columns","data","colWidths","split","i","columnWidth","Math","max","find","eq","css","editSchedule","targetWindow","title","scheduleId","interval","reminderDays","append","kendoWindow","position","top","scrollTop","left","getPopupWidth","minHeight","modal","iframe","content","baseUrl","encodeURIComponent","close","deactivate","destroy","getOfflineGroups","Promise","resolve","reject","indexedDatabase","organizationUnits","get","then","groups","catch","getOfflineUsers","users","getOfflineUsersFromGroup","groupId","all","group","g","filter","user","userIds","getPopupHeight","desiredHeight","tabWindow","maxHeight","height","parseFloat","newDesiredHeight","min","desiredWidth","maxWidth","getImageBrowserConfig","relativePath","transport","read","url","type","dataType","thumbnailUrl","uploadUrl","imageUrl","getState","getFromUrl","enableSaveGridState","response","fetch","ok","json","clientState","getQueryParameter","decodeURIComponent","loadXml","xmlString","parseXML","markNetworkError","err","TypeError","previewAttachment","button","target","attachmentContainer","closest","imageElement","querySelector","displayName","naturalHeight","naturalWidth","heightFactor","body","offsetHeight","widthFactor","offsetWidth","factor","headerSize","parseDimensionValue","readCssVar","paddingBlock","win","innerText","endsWith","attachmentPreview","preview","visible","href","center","open","kendoDialog","resizable","src","animation","saveColumnsWidths","minWidth","cols","widthData","map","join","ajax","stringify","error","saveState","dataSource","sort","page","parameter","filters","isEmbed","pageUrl","getEmbedUrl","searchParams","set","delete","setEmbedUrl","newUrl","setQueryParameter","location","history","replaceState","newTabUrl","security","sessionExpired","getPageQueryParameter","loginLabel","closable","duration","offsetBlock","purify","updateSearchFilterMenu","grid","sender","fieldHeader","thead","field","fieldType","cellIndex","isDateField","filterWindow","container","on","preventDefault","filterEvent","form","filterType","element","id","selectedValue","dateKendoFilter","operator","currentFilters","newFilters","push","popup","updateSearchFilters","newFilter","isNew","index","parseOption","option","createElement","setAttribute","text"],"sources":["../../../scripts/leanforms/leanforms-next.js"],"sourcesContent":["// #region: Class definition *********************************************************************/\r\n/**\r\n * This class contains the core javascript functions for the 'next' LeanForms version.\r\n */\r\nwindow.leanformsNext = new class {\r\n\r\n // #region: Private Fields *******************************************************************/\r\n #loginMessageShown;\r\n // #endregion ********************************************************************************/\r\n\r\n // #region: Constructor **********************************************************************/\r\n /**\r\n * The constructor does work that needs to be executed exactly once.\r\n */\r\n constructor() {\r\n\r\n // Magic numbers.\r\n this.DEFAULT_GRIDCOLUMN_WIDTH = 150;\r\n this.HEADER_HEIGHT = 41;\r\n this.MIN_GRIDCOLUMN_WIDTH = 40;\r\n this.RESPONSIVE_WIDTH = 450;\r\n\r\n // iOS PWA detection.\r\n var isIos = /iPad|iPhone|iPod/.test(window.navigator.platform) || (window.navigator.platform === \"MacIntel\" && window.navigator.maxTouchPoints > 1);\r\n this.isIosPWA = isIos && \"standalone\" in window.navigator && window.navigator.standalone;\r\n\r\n // Setup CSRF safety for AJAX:\r\n $.ajaxPrefilter(function (options, originalOptions, xhr) {\r\n const antiforgeryToken = $(\"[name=__RequestVerificationToken]\").val();\r\n if (antiforgeryToken && antiforgeryToken !== \"\") {\r\n xhr.setRequestHeader(antiforgeryHeader, antiforgeryToken);\r\n }\r\n });\r\n\r\n // References for offline user/groups lists.\r\n this.offlineUserList;\r\n this.offlineGroupList;\r\n\r\n // For kendo pager, when responsive a select is shown to select the pages (instead of buttons).\r\n this.responsive = document.documentElement.getBoundingClientRect().width < this.RESPONSIVE_WIDTH;\r\n }\r\n // #endregion ********************************************************************************/\r\n\r\n // #region: Build ****************************************************************************/\r\n /**\r\n * Identifies class.\r\n * @returns {string} The string representation of this class.\r\n */\r\n toString() {\r\n return \"[leanformsNext]\";\r\n }\r\n\r\n static toString() {\r\n return \"[leanformsNext]\";\r\n }\r\n\r\n /** \r\n * Identifies the version.\r\n * @returns {string} The version number of this class.\r\n */\r\n static version() {\r\n return \"1.0.0\";\r\n }\r\n // #endregion ********************************************************************************/\r\n\r\n // #region: Events ***************************************************************************/\r\n /**\r\n * Show the login message or an error toast.\r\n * @param {Event} e The event data provided from the error handler in an ajax call.\r\n */\r\n onAjaxError = (e, ...args) => {\r\n const event = e.xhr || e.XMLHttpRequest || e;\r\n const loginRequired = (event.status === 200 && event.statusText === \"parsererror\") || event.status === 401;\r\n\r\n if (loginRequired) {\r\n return this.showLoginMessage();\r\n }\r\n\r\n // Parse for a message sent from the server but ignore any error pages sent (contains a body tag). Check if we're offline.\r\n const responseText = (window.navigator.onLine ? null : resources.noNetworkMessage) ?? event.responseText ?? \"\";\r\n const contentType = event?.getResponseHeader?.(\"content-type\");\r\n\r\n // Default to 'html' that will show the default error message.\r\n const isHtml = contentType?.includes(\"html\") ?? true;\r\n const isJson = contentType?.includes(\"json\");\r\n\r\n // Ignore any error pages sent. Using null for the message will show the default error to the user.\r\n if (isHtml) {\r\n return this.handleError({ message: null, e, ...args });\r\n }\r\n\r\n const errorMessage = isJson ? JSON.parse(responseText) : responseText;\r\n\r\n return this.handleError({ message: typeof errorMessage === \"string\" ? errorMessage : null, e, ...args });\r\n }\r\n\r\n /**\r\n * Displays an error notification.\r\n */\r\n handleError = ({ message, ...args } = {}) => {\r\n // Ignore large exception content.\r\n core.notify(\"error\", message?.toLowerCase().indexOf(\"exception\") > -1 ? null : message);\r\n\r\n console.log(message ?? \"no-message\", args ?? \"no-args\");\r\n if (args?.[0] instanceof Error) {\r\n throw args[0];\r\n }\r\n }\r\n // #endregion ********************************************************************************/\r\n\r\n // #region: Public Methods *******************************************************************/\r\n /**\r\n * Set column widths for a given grid and an array of widths (that is saved for the user).\r\n * @param {HTMLElement} gridReference The (Kendo) grid that should have the widths applied.\r\n * @param {HTMLElement} gridWidthsInput The hidden input the widths values are (to be) stored.\r\n * @param {String} key The key reference for the data to, typically the grid name/type.\r\n */\r\n applyColumnsWidths(gridReference, gridWidthsInput, key) {\r\n if (gridWidthsInput.value.length === 0) {\r\n return;\r\n }\r\n\r\n const columns = gridReference.data(\"kendoGrid\").columns.length;\r\n const colWidths = gridWidthsInput.value.split(';');\r\n for (var i = 0; i < columns; i++) {\r\n const columnWidth = Math.max(this.MIN_GRIDCOLUMN_WIDTH, +colWidths[i] || this.DEFAULT_GRIDCOLUMN_WIDTH);\r\n\r\n gridReference.find(\".k-grid-header-wrap\").find(\"colgroup col\").eq(i).css({ width: columnWidth + \"px\" });\r\n gridReference.find(\".k-grid-content\").find(\"colgroup col\").eq(i).css({ width: columnWidth + \"px\" });\r\n }\r\n }\r\n\r\n /**\r\n * Opens a dialog where a schedule can be edited.\r\n * @param {Object} targetWindow The target window.\r\n * @param {String} title The window title.\r\n * @param {Integer} scheduleId The schedule identifier.\r\n * @param {Integer} interval The schedule interval.\r\n * @param {Integer} reminderDays The schedule reminder days.\r\n */\r\n editSchedule(targetWindow, title, scheduleId, interval, reminderDays) {\r\n var $ = targetWindow.$;\r\n\r\n if ($(\"#scheduler-dialog\").length) {\r\n // Already has an open window.\r\n return;\r\n }\r\n\r\n $(\"body\").css(\"overflow\", \"hidden\");\r\n $(\"#windowcontainer\").append('
');\r\n $(\"#scheduler-dialog\").kendoWindow({\r\n position: {\r\n top: $(targetWindow).scrollTop() + 20,\r\n left: \"20%\"\r\n },\r\n width: leanformsNext.getPopupWidth(600),\r\n // minHeight reduces resize flash on load.\r\n minHeight: 282,\r\n title: title,\r\n modal: true,\r\n iframe: false,\r\n content: `${baseUrl}/Dialogs/SchedulerDialog?id=${scheduleId}&interval=${encodeURIComponent(interval || '')}&reminder-days=${reminderDays || ''}`,\r\n close: function () { $(\"body\").css(\"overflow\", \"\"); },\r\n deactivate: function () {\r\n this.destroy();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Get the groups from the stored users list.\r\n */\r\n getOfflineGroups() {\r\n return new Promise((resolve, reject) => {\r\n if (this.offlineGroupList) {\r\n return resolve(this.offlineGroupList);\r\n }\r\n\r\n indexedDatabase.organizationUnits.get(\"groups\").then((groups) => {\r\n this.offlineGroupList = groups.value;\r\n\r\n resolve(this.offlineGroupList);\r\n }).catch(reject);\r\n });\r\n }\r\n\r\n /**\r\n * Get the users from the stored users list.\r\n */\r\n getOfflineUsers() {\r\n return new Promise((resolve, reject) => {\r\n if (this.offlineUserList) {\r\n return resolve(this.offlineUserList);\r\n }\r\n\r\n indexedDatabase.organizationUnits.get(\"users\").then((users) => {\r\n this.offlineUserList = users.value;\r\n\r\n resolve(this.offlineUserList);\r\n }).catch(reject);\r\n });\r\n }\r\n\r\n /**\r\n * Gets the \r\n * @param {Integer} groupId The id of the group to get the id from.\r\n */\r\n getOfflineUsersFromGroup(groupId) {\r\n return Promise.all([this.getOfflineGroups(), this.getOfflineUsers()]).\r\n then((data) => {\r\n const groups = data[0];\r\n const users = data[1];\r\n const group = groups.find((g) => {\r\n return groupId === +g.value;\r\n });\r\n\r\n return users.filter((user) => {\r\n return group.userIds.indexOf(+user.value) > -1;\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Returns the height for the popup window, either the requested height or the available height.\r\n * @param {Integer} desiredHeight The preferred window height.\r\n * @param {Window} tabWindow The preferred (tab)window object, defaults to 'window'.\r\n */\r\n getPopupHeight(desiredHeight, tabWindow) {\r\n const maxHeight = $(tabWindow ?? window).height();\r\n if (typeof desiredHeight === \"string\" && desiredHeight.indexOf(\"%\") > -1) {\r\n desiredHeight = maxHeight * parseFloat(desiredHeight, 10) / 100;\r\n }\r\n\r\n const newDesiredHeight = desiredHeight + this.HEADER_HEIGHT;\r\n\r\n return Math.min(maxHeight, newDesiredHeight);\r\n }\r\n\r\n /**\r\n * Returns the width for the popup window, either the requested width or the available width.\r\n * @param {Integer} desiredWidth The preferred window height.\r\n * @param {Window} tabWindow The preferred (tab)window object, defaults to 'window'.\r\n */\r\n getPopupWidth(desiredWidth, tabWindow) {\r\n const maxWidth = $(tabWindow ?? window).width();\r\n if (typeof desiredWidth === \"string\" && desiredWidth.indexOf(\"%\") > -1) {\r\n desiredWidth = maxWidth * parseFloat(desiredWidth, 10) / 100;\r\n }\r\n\r\n return Math.min(maxWidth, desiredWidth);\r\n }\r\n\r\n /**\r\n * Declares references/urls related to images (on the server).\r\n * @param {String} relativePath A realtive path to use, defaults to '../'.\r\n * @returns {Object} The configuration for the editor.\r\n */\r\n getImageBrowserConfig(relativePath = \"../\") {\r\n return {\r\n transport: {\r\n read: {\r\n url: `${baseUrl}/api/ImageBrowser`,\r\n type: \"GET\",\r\n dataType: \"json\"\r\n },\r\n destroy: {\r\n url: `${baseUrl}/api/ImageBrowser`,\r\n type: \"DELETE\"\r\n },\r\n thumbnailUrl: `${baseUrl}/api/ImageBrowser/thumbnail`,\r\n uploadUrl: `${baseUrl}/api/ImageBrowser/upload`,\r\n imageUrl: `${relativePath}api/ImageBrowser/image?path={0}`\r\n }\r\n };\r\n }\r\n\r\n /**\r\n * Get the client state locally or from the database (if allowed).\r\n * @param {String} key The reference to get the data for. Can be null for ignoring.\r\n * @param {Window} tabWindow The tab window. Defaults to top.window\r\n * @param {Boolean} getFromUrl True to get client state from URL.\r\n */\r\n async getState(key, tabWindow, getFromUrl) {\r\n if (enableSaveGridState && key) {\r\n const response = await core.fetch({ url: baseUrl + \"/api/settings/state/\" + key })\r\n .catch(leanformsNext.onAjaxError);\r\n\r\n if (response.ok) {\r\n return await response?.json();\r\n }\r\n }\r\n\r\n if (getFromUrl) {\r\n let clientState = core.getQueryParameter(\"client-state\", tabWindow ?? top.window) ?? \"\";\r\n return clientState === \"\" ? \"\" : JSON.parse(decodeURIComponent(clientState));\r\n }\r\n }\r\n\r\n /**\r\n * Parses a given string to XML (jQuery).\r\n * @param {String} xmlString The string to create actual XML from\r\n */\r\n loadXml(xmlString) {\r\n return $($.parseXML(xmlString));\r\n }\r\n\r\n /**\r\n * \r\n * @param {Error} err\r\n */\r\n markNetworkError(err) {\r\n if (err instanceof TypeError) {\r\n // It's not guaranteed that this is actually caused by a connection issue\r\n // but thanks to browser differences it's hard to get closer than this.\r\n throw new Error(\"lf-failed-fetch\");\r\n }\r\n else {\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Parses a given string to XML (jQuery).\r\n * @param {Event} e The trigger event.\r\n */\r\n previewAttachment(e) {\r\n const button = e.target;\r\n const attachmentContainer = button.closest(\".attachment-container\");\r\n const imageElement = attachmentContainer.querySelector(\".attachment-item\");\r\n const displayName = attachmentContainer.querySelector(\".display-name\");\r\n\r\n // Get the original size of the image.\r\n const height = imageElement.naturalHeight;\r\n const width = imageElement.naturalWidth;\r\n\r\n // Available size (keep a little space around the dialog).\r\n const heightFactor = (0.9 * document.body.offsetHeight) / height;\r\n const widthFactor = (0.9 * document.body.offsetWidth) / width;\r\n\r\n // So we need to scale the image/dialog down, or not when image is smaller than available height/width.\r\n const factor = Math.min(heightFactor, widthFactor, 1);\r\n\r\n // Dialog sizes.\r\n const headerSize = core.parseDimensionValue(core.readCssVar(\"--titlebar-block-size\"));\r\n const paddingBlock = core.parseDimensionValue(core.readCssVar(\"--padding-block\"));\r\n\r\n // Avoid scrolling outer body when popup is open.\r\n $(\"body\").css(\"overflow\", \"hidden\");\r\n\r\n // Display the preview in a dialog.\r\n var win = $(\"
\");\r\n $(\"#windowcontainer\").append(win);\r\n\r\n if (displayName.innerText.endsWith(\"pdf\")) {\r\n\r\n $(\"#dialog\").kendoWindow({\r\n width: leanformsNext.getPopupWidth(900),\r\n height: leanformsNext.getPopupHeight(700),\r\n title: resources.attachmentPreview.preview + \": \" + displayName.innerText,\r\n visible: false,\r\n modal: true,\r\n iframe: true,\r\n content: baseUrl + \"/Dialogs/PdfViewer?pdf=\" + encodeURIComponent(displayName.href),\r\n close: function () {\r\n $(\"body\").css(\"overflow\", \"\");\r\n },\r\n deactivate: function () {\r\n this.destroy();\r\n }\r\n }).data(\"kendoWindow\").center().open();\r\n }\r\n else {\r\n $(\"#dialog\").kendoDialog({\r\n height: factor * height + headerSize + (2 * paddingBlock),\r\n width: factor * width,\r\n title: resources.attachmentPreview.preview + \": \" + displayName.innerText,\r\n modal: true,\r\n resizable: false,\r\n iframe: false,\r\n content: ``,\r\n animation: false,\r\n close: function () {\r\n $(\"body\").css(\"overflow\", \"\");\r\n },\r\n deactivate: function () {\r\n this.destroy();\r\n }\r\n }).data(\"kendoDialog\").open();\r\n }\r\n }\r\n\r\n /**\r\n * Saves the columns width string to the settings table.\r\n * @param {HTMLElement} gridReference The (Kendo) grid that the widths are for.\r\n * @param {HTMLElement} gridWidthsInput The hidden input to store the widths values.\r\n * @param {String} key The key to store the data to, typically the grid name/type.\r\n * @param {Integer} minWidth The min width to use, defaults to 60.\r\n */\r\n saveColumnsWidths(gridReference, gridWidthsInput, key, minWidth = 0) {\r\n const cols = gridReference.find(\".k-grid-header-wrap\").find(\"colgroup col\");\r\n\r\n const widthData = cols.map(function (i) {\r\n const columnWidth = $(this).width();\r\n return Math.max(columnWidth, minWidth);\r\n }).get().join(\";\");\r\n\r\n // Store local and on the server, when changed.\r\n if (gridWidthsInput.value !== widthData) {\r\n gridWidthsInput.value = widthData;\r\n $.ajax({\r\n url: baseUrl + \"/api/settings/columns/\" + key,\r\n type: \"PUT\",\r\n data: JSON.stringify(widthData),\r\n contentType: \"application/json\",\r\n error: leanformsNext.onAjaxError\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Saves the client state to the querystring, and to the database (if allowed).\r\n * @param {DataSource} dataSource The Kendo Grid datasource to read the settings from.\r\n * @param {Window} tabWindow The tab window. Can be null.\r\n * @param {String} key The reference to store the data for. Can be null to not save on teh server.\r\n */\r\n saveState(dataSource, tabWindow, key) {\r\n const clientState = {\r\n sort: dataSource.sort(),\r\n filter: dataSource.filter()\r\n };\r\n\r\n // Store on the server, when allowed.\r\n if (enableSaveGridState && key) {\r\n $.ajax({\r\n url: baseUrl + \"/api/settings/state/\" + key,\r\n type: \"PUT\",\r\n contentType: \"application/json\",\r\n data: JSON.stringify(clientState),\r\n error: leanformsNext.onAjaxError\r\n });\r\n }\r\n else {\r\n const page = dataSource.page();\r\n let parameter = null;\r\n\r\n if (page > 1) {\r\n clientState.page = page;\r\n }\r\n\r\n if (clientState.sort?.length > 0 || clientState.filter?.filters?.length > 0 || page > 1) {\r\n parameter = JSON.stringify(clientState);\r\n }\r\n\r\n // Save in querystring (for bookmarking and browser back/forward).\r\n if (isEmbed) {\r\n const pageUrl = core.getEmbedUrl();\r\n\r\n if (parameter) {\r\n pageUrl.searchParams.set(\"client-state\", parameter);\r\n } else {\r\n pageUrl.searchParams.delete(\"client-state\");\r\n }\r\n \r\n core.setEmbedUrl(pageUrl);\r\n } else {\r\n const newUrl = core.setQueryParameter(top.window.location.href, \"client-state\", parameter);\r\n top.window.history.replaceState(null, \"\", newUrl);\r\n }\r\n\r\n // Set in tab for history navigation.\r\n if (tabWindow) {\r\n const newTabUrl = core.setQueryParameter(tabWindow.location.href, \"client-state\", parameter);\r\n tabWindow.history.replaceState(null, \"\", newTabUrl);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Show the user a message that the session has ended and the user needs to login again.\r\n * When the button is clicked the login view will be loaded in the top most window.\r\n */\r\n showLoginMessage() {\r\n if (!this.#loginMessageShown) {\r\n const message =\r\n `${resources.security.sessionExpired}` +\r\n ``;\r\n\r\n this.#loginMessageShown = true;\r\n return core.notify(\"warn\", message, { closable: false, duration: 0, offsetBlock: 150, purify: false });\r\n }\r\n\r\n return;\r\n }\r\n\r\n /**\r\n * Parses a provided date/time filter for the 'contains' operator.\r\n * @param {EventData} e All Kendo 'FilterMenuInit' eventdata from the grid. \r\n */\r\n updateSearchFilterMenu(e) {\r\n const grid = e.sender;\r\n const fieldHeader = grid.thead.find(\"th[data-field='\" + e.field + \"']\")[0];\r\n const fieldType = grid.columns[fieldHeader?.cellIndex].type;\r\n const isDateField = [\"date\", \"time\", \"datetime\"].indexOf(fieldType) > -1;\r\n\r\n if (!isDateField) {\r\n return;\r\n }\r\n\r\n // Parse a date column (with a partial date for using with the 'contains' operators).\r\n // If we do not modify the filter Kendo will pass 'null' and thus the filter will be ignored.\r\n var filterWindow = $(e.container);\r\n\r\n // Ignore the change event on the datepicker, so kendo does not parses a value to null (a single year only par example).\r\n filterWindow.on(\"change\", \"input\", function (event) {\r\n event.preventDefault();\r\n });\r\n\r\n filterWindow.on(\"click\", \"button[type=submit]\", function (filterEvent) {\r\n var form = $(this.form);\r\n var filterType = form.find(\"select[data-role=dropdownlist]\").eq(0).val();\r\n\r\n // Only do this on the contains operator.\r\n // On the report page, do this for all operators. The server side handling is different there.\r\n if (filterType !== \"contains\" && grid.element[0].id !== \"divReportGrid\") {\r\n return;\r\n }\r\n\r\n filterEvent.preventDefault();\r\n var selectedValue = form.find(\"input\").eq(0).val();\r\n var dateKendoFilter = {\r\n field: e.field,\r\n operator: filterType,\r\n value: selectedValue\r\n };\r\n\r\n var currentFilters = grid.dataSource.filter();\r\n if (currentFilters) {\r\n var newFilters = currentFilters.filters.filter(function (filter) {\r\n return filter.field !== dateKendoFilter.field;\r\n });\r\n newFilters.push(dateKendoFilter);\r\n currentFilters.filters = newFilters;\r\n }\r\n else {\r\n currentFilters = dateKendoFilter;\r\n }\r\n\r\n grid.dataSource.filter(currentFilters);\r\n grid.thead.find(\"th[data-field='\" + e.field + \"']\").data(\"kendoFilterMenu\").popup.close();\r\n });\r\n }\r\n\r\n /**\r\n * Updates the search filters for a given grid.\r\n * @param {any} grid The source grid (for the data).\r\n * @param {any} field The field (column) to operate on.\r\n * @param {any} operator The operator to use.\r\n * @param {any} value The value to compare against (the selected filter),\r\n * @returns {Object} The filtered data source.\r\n */\r\n updateSearchFilters(grid, field, operator, value) {\r\n const newFilter = { field: field, operator: operator, value: value };\r\n const dataSource = grid.dataSource;\r\n let filters = null;\r\n\r\n if (dataSource.filter() != null) {\r\n filters = dataSource.filter().filters;\r\n }\r\n\r\n if (filters == null) {\r\n filters = [newFilter];\r\n }\r\n else {\r\n var isNew = true;\r\n for (var index = 0; index < filters.length; index++) {\r\n if (filters[index].field == field) {\r\n isNew = false;\r\n break;\r\n }\r\n }\r\n\r\n if (isNew) {\r\n filters.push(newFilter);\r\n }\r\n else {\r\n filters[index] = newFilter;\r\n }\r\n }\r\n\r\n dataSource.filter(filters);\r\n }\r\n // #endregion ********************************************************************************/\r\n\r\n // #region: Private Methods ******************************************************************/\r\n /**\r\n * Generate an option element from provided data.\r\n * @param {Object} data The (json) object containing text and value.\r\n * @param {String} data Optional the value that should be selected.\r\n */\r\n #parseOption(data, value) {\r\n const option = document.createElement(\"option\");\r\n if (value === data.value) {\r\n option.setAttribute(\"selected\", \"\");\r\n }\r\n\r\n option.value = data.value === \"-1\" ? \"\" : data.value;\r\n option.text = data.text;\r\n\r\n return option;\r\n }\r\n // #endregion ********************************************************************************/\r\n \r\n}();\r\n// #endregion ************************************************************************************/"],"mappings":"AAIAA,OAAOC,cAAgB,IAAI,MAGvBC,mBAOA,WAAAC,GAGIC,KAAKC,yBAA2B,IAChCD,KAAKE,cAAgB,GACrBF,KAAKG,qBAAuB,GAC5BH,KAAKI,iBAAmB,IAGxB,IAAIC,MAAQ,mBAAmBC,KAAKV,OAAOW,UAAUC,WAAcZ,OAAOW,UAAUC,WAAa,YAAcZ,OAAOW,UAAUE,eAAiB,EACjJT,KAAKU,SAAWL,OAAS,eAAgBT,OAAOW,WAAaX,OAAOW,UAAUI,WAG9EC,EAAEC,eAAc,SAAUC,QAASC,gBAAiBC,KAChD,MAAMC,iBAAmBL,EAAE,qCAAqCM,MAChE,GAAID,kBAAoBA,mBAAqB,GAAI,CAC7CD,IAAIG,iBAAiBC,kBAAmBH,iBAC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