{"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","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","attachmentContainer","target","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","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","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 // Create a window.\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 // Create a dialog.\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,GAOA,WAAAC,GAGIC,KAAKC,yBAA2B,IAChCD,KAAKE,cAAgB,GACrBF,KAAKG,qBAAuB,GAC5BH,KAAKI,iBAAmB,IAGxB,IAAIC,EAAQ,mBAAmBC,KAAKV,OAAOW,UAAUC,WAA4C,aAA9BZ,OAAOW,UAAUC,UAA2BZ,OAAOW,UAAUE,eAAiB,EACjJT,KAAKU,SAAWL,GAAS,eAAgBT,OAAOW,WAAaX,OAAOW,UAAUI,WAG9EC,EAAEC,eAAc,SAAUC,EAASC,EAAiBC,GAChD,MAAMC,EAAmBL,EAAE,qCAAqCM,MAC5DD,GAAyC,KAArBA,GACpBD,EAAIG,iBAAiBC,kBAAmBH,EAEhD,IAGA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