UNPKG

@gpa-gemstone/common-pages

Version:
67 lines (66 loc) 3.08 kB
"use strict"; //****************************************************************************************************** // Gemstone.tsx - Gbtc // // Copyright (c) 2025, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA may license this file to you under the MIT License (MIT), the "License"; you may not use this // file except in compliance with the License. You may obtain a copy of the License at: // // http://opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 09/12/2025 - Preston Crawford // Generated original version of source code. // //****************************************************************************************************** Object.defineProperty(exports, "__esModule", { value: true }); exports.Gemstone = void 0; var Gemstone; (function (Gemstone) { var HelperFunctions; (function (HelperFunctions) { HelperFunctions.getSearchFilter = function (searchFilter) { return searchFilter.map(function (s) { var castValue = function (val) { switch (s.Type) { case 'number': case 'integer': return Number(val); case 'boolean': return val === '1'; default: return val; } }; var searchText = s.SearchText; if (s.Operator === 'IN' || s.Operator === 'NOT IN') { if (searchText.startsWith('(') && searchText.endsWith(')')) searchText = searchText .slice(1, -1) .split(',') .map(function (v) { return v.trim(); }); } var searchParameter; if (Array.isArray(searchText)) { searchParameter = searchText.map(function (v) { return castValue(v); }); } else { searchParameter = castValue(searchText); } return { FieldName: s.FieldName, SearchParameter: searchParameter, Operator: s.Operator }; }); }; })(HelperFunctions = Gemstone.HelperFunctions || (Gemstone.HelperFunctions = {})); })(Gemstone || (exports.Gemstone = Gemstone = {}));