@corva/ui 0.77.0-11 → 0.77.0-12
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("lodash"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("lodash"),n=require("../convert.js"),r=require("./goalsConfig.js");exports.convertGoalValue=function(e,i,o){if(void 0===o&&(o="TO_SHOW"),!r.GoalsConfig[i])return e;var s=r.GoalsConfig[i],a=s.unitType,l=s.unit,g=s.convertToShow,u=s.convertToSave;if(!l&&!g&&!u)return e;if("TO_SHOW"===o){if(""===e)return e;var _=g?g(e):n.convertValue(+e,a,l,null,16),f=t.round(_,2);return String(f)}return"TO_SAVE"===o?e?String(u?u(e):n.convertValue(+e,a,n.getUnitPreference(a),l,16)):"":void 0},exports.getGoalsConfig=function(){return e.__assign(e.__assign({},r.GoalsConfig),{cost_per_ft:e.__assign(e.__assign({},r.GoalsConfig.cost_per_ft),{label:"Cost/".concat(n.getUnitDescription(n.getUnitPreference("length")).singular)}),cost_per_lat_ft:e.__assign(e.__assign({},r.GoalsConfig.cost_per_lat_ft),{label:"Lateral Cost/".concat(n.getUnitDescription(n.getUnitPreference("length")).singular)})})},exports.getGoalsUnitDisplay=function(e){if(!r.GoalsConfig[e])return"";var t=r.GoalsConfig[e],i=t.unit,o=t.unitType,s=t.formatUnitDisplay;return o||s?s?s(n.getUnitPreference(o)):"percent"===o?i:n.getUnitDisplay(o):""};
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/goalsConfig/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/goalsConfig/utils.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAe,MAAM,eAAe,CAAC;AAExD,aAAK,aAAa,GAAG,SAAS,GAAG,SAAS,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,mBAAmB,YAAa,MAAM,WAYlD,CAAC;AAEF,eAAO,MAAM,gBAAgB,cAChB,MAAM,WACR,MAAM,kBACA,aAAa,WA6B7B,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,OAAO,MAAM,EAAE,UAAU,CAY1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{round as r}from"lodash";import{getUnitPreference as n,getUnitDisplay as
|
|
1
|
+
import{__assign as t}from'./../../ext-esm/tslib/tslib.es6.js';import{round as r}from"lodash";import{getUnitPreference as n,getUnitDisplay as o,convertValue as e,getUnitDescription as i}from"../convert.js";import{GoalsConfig as a}from"./goalsConfig.js";var l=function(t){if(!a[t])return"";var r=a[t],e=r.unit,i=r.unitType,l=r.formatUnitDisplay;return i||l?l?l(n(i)):"percent"===i?e:o(i):""},u=function(t,o,i){if(void 0===i&&(i="TO_SHOW"),!a[o])return t;var l=a[o],u=l.unitType,f=l.unit,s=l.convertToShow,c=l.convertToSave;if(!f&&!s&&!c)return t;if("TO_SHOW"===i){if(""===t)return t;var _=s?s(t):e(+t,u,f,null,16),p=r(_,2);return String(p)}return"TO_SAVE"===i?t?String(c?c(t):e(+t,u,n(u),f,16)):"":void 0},f=function(){return t(t({},a),{cost_per_ft:t(t({},a.cost_per_ft),{label:"Cost/".concat(i(n("length")).singular)}),cost_per_lat_ft:t(t({},a.cost_per_lat_ft),{label:"Lateral Cost/".concat(i(n("length")).singular)})})};export{u as convertGoalValue,f as getGoalsConfig,l as getGoalsUnitDisplay};
|