pict 1.0.381 → 1.0.382
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.
package/dist/pict.js
CHANGED
|
@@ -771,7 +771,7 @@ generateUUIDv4(){let tmpBuffer=new Array(16);var tmpRandomBytes=this.randomByteG
|
|
|
771
771
|
tmpRandomBytes[6]=tmpRandomBytes[6]&0x0f|0x40;tmpRandomBytes[8]=tmpRandomBytes[8]&0x3f|0x80;return this.bytesToUUID(tmpRandomBytes);}// Simple random UUID generation
|
|
772
772
|
generateRandom(){let tmpUUID='';for(let i=0;i<this._UUIDLength;i++){tmpUUID+=this._UUIDRandomDictionary.charAt(Math.floor(Math.random()*(this._UUIDRandomDictionary.length-1)));}return tmpUUID;}// Adapted from node-uuid (https://github.com/kelektiv/node-uuid)
|
|
773
773
|
getUUID(){if(this._UUIDModeRandom){return this.generateRandom();}else{return this.generateUUIDv4();}}}// This is for backwards compatibility
|
|
774
|
-
function autoConstruct(pSettings){return new FableUUID(pSettings);}module.exports=FableUUID;module.exports.new=autoConstruct;},{"../package.json":64,"./Fable-UUID-Random.js":65,"fable-serviceproviderbase":59}],67:[function(require,module,exports){module.exports={"name":"fable","version":"3.1.
|
|
774
|
+
function autoConstruct(pSettings){return new FableUUID(pSettings);}module.exports=FableUUID;module.exports.new=autoConstruct;},{"../package.json":64,"./Fable-UUID-Random.js":65,"fable-serviceproviderbase":59}],67:[function(require,module,exports){module.exports={"name":"fable","version":"3.1.77","description":"A service dependency injection, configuration and logging library.","main":"source/Fable.js","scripts":{"start":"node source/Fable.js","coverage":"npx quack coverage","test":"npx quack test","build":"npx quack build","prepublishOnly":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t fable-image:local","docker-dev-run":"docker run -it -d --name fable-dev -p 30001:8080 -p 38086:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/fable\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" fable-image:local","docker-dev-shell":"docker exec -it fable-dev /bin/bash","tests":"npx quack test -g"},"mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"browser":{"./source/service/Fable-Service-EnvironmentData.js":"./source/service/Fable-Service-EnvironmentData-Web.js","./source/service/Fable-Service-FilePersistence.js":"./source/service/Fable-Service-FilePersistence-Web.js"},"repository":{"type":"git","url":"https://github.com/fable-retold/fable.git"},"keywords":["entity","behavior"],"author":"Steven Velozo <steven@velozo.com> (http://velozo.com/)","license":"MIT","bugs":{"url":"https://github.com/fable-retold/fable/issues"},"homepage":"https://github.com/fable-retold/fable","devDependencies":{"pict-docuserve":"^1.4.19","quackage":"^1.3.0"},"dependencies":{"async.eachlimit":"^0.5.2","async.waterfall":"^0.5.2","big.js":"^7.0.1","cachetrax":"^1.0.6","cookie":"^1.1.1","data-arithmatic":"^1.0.7","dayjs":"^1.11.19","fable-log":"^3.0.18","fable-serviceproviderbase":"^3.0.19","fable-settings":"^3.0.16","fable-uuid":"^3.0.14","manyfest":"^1.0.49","simple-get":"^4.0.1"}};},{}],68:[function(require,module,exports){/**
|
|
775
775
|
* Fable Application Services Support Library
|
|
776
776
|
* @author <steven@velozo.com>
|
|
777
777
|
*/// Pre-init services
|
|
@@ -1319,7 +1319,19 @@ this.plugin_advancedFormat=require('dayjs/plugin/advancedFormat');this.dayJS.ext
|
|
|
1319
1319
|
* @param {string|Date|number} pDateEnd - The end date. Can be a string, Date object, or timestamp. Defaults to the current date if not provided.
|
|
1320
1320
|
* @param {boolean} pRequireEndDate - If true, the end date must be provided; otherwise, it defaults to the current date.
|
|
1321
1321
|
* @returns {number} The difference in years between the two dates. Returns NaN if the start date is invalid.
|
|
1322
|
-
*/dateYearDifference(pDateStart,pDateEnd){let pRequireEndDate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}if((pRequireEndDate||pRequireEndDate==1||pRequireEndDate=='1')&&(pDateEnd===undefined||pDateEnd===null||pDateEnd==='')){return NaN;}let tmpStartDate=this.dayJS(pDateStart);let tmpEndDate=this.dayJS(pDateEnd);return tmpEndDate.diff(tmpStartDate,'year');}dateAddMilliseconds(pDate,pAmount){return this.dateMath(pDate,pAmount,'millisecond','add');}dateAddSeconds(pDate,pAmount){return this.dateMath(pDate,pAmount,'second','add');}dateAddMinutes(pDate,pAmount){return this.dateMath(pDate,pAmount,'minute','add');}dateAddHours(pDate,pAmount){return this.dateMath(pDate,pAmount,'hour','add');}dateAddDays(pDate,pAmount){return this.dateMath(pDate,pAmount,'day','add');}dateAddWeeks(pDate,pAmount){return this.dateMath(pDate,pAmount,'week','add');}dateAddMonths(pDate,pAmount){return this.dateMath(pDate,pAmount,'month','add');}dateAddYears(pDate,pAmount){return this.dateMath(pDate,pAmount,'year','add');}dateMath(pDate,pAmount,pUnit,pOperation){try{let tmpDate=this.dayJS.utc(pDate);if(pOperation==='add'){tmpDate=tmpDate.add(pAmount,pUnit);}else if(pOperation==='subtract'){tmpDate=tmpDate.subtract(pAmount,pUnit);}return this.dayJS.utc(tmpDate).toISOString();}catch(pError){return undefined;}}
|
|
1322
|
+
*/dateYearDifference(pDateStart,pDateEnd){let pRequireEndDate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(pDateStart===undefined||pDateStart===null||pDateStart===''){return NaN;}if((pRequireEndDate||pRequireEndDate==1||pRequireEndDate=='1')&&(pDateEnd===undefined||pDateEnd===null||pDateEnd==='')){return NaN;}let tmpStartDate=this.dayJS(pDateStart);let tmpEndDate=this.dayJS(pDateEnd);return tmpEndDate.diff(tmpStartDate,'year');}dateAddMilliseconds(pDate,pAmount){return this.dateMath(pDate,pAmount,'millisecond','add');}dateAddSeconds(pDate,pAmount){return this.dateMath(pDate,pAmount,'second','add');}dateAddMinutes(pDate,pAmount){return this.dateMath(pDate,pAmount,'minute','add');}dateAddHours(pDate,pAmount){return this.dateMath(pDate,pAmount,'hour','add');}dateAddDays(pDate,pAmount){return this.dateMath(pDate,pAmount,'day','add');}dateAddWeeks(pDate,pAmount){return this.dateMath(pDate,pAmount,'week','add');}dateAddMonths(pDate,pAmount){return this.dateMath(pDate,pAmount,'month','add');}dateAddYears(pDate,pAmount){return this.dateMath(pDate,pAmount,'year','add');}dateMath(pDate,pAmount,pUnit,pOperation){try{let tmpDate=this.dayJS.utc(pDate);if(pOperation==='add'){tmpDate=tmpDate.add(pAmount,pUnit);}else if(pOperation==='subtract'){tmpDate=tmpDate.subtract(pAmount,pUnit);}return this.dayJS.utc(tmpDate).toISOString();}catch(pError){return undefined;}}/**
|
|
1323
|
+
* Format a date value with dayjs format tokens, rendered in a timezone.
|
|
1324
|
+
*
|
|
1325
|
+
* Timezone resolution: the explicit parameter wins; otherwise the
|
|
1326
|
+
* dayjs default set via `dayJS.tz.setDefault(...)` (the host
|
|
1327
|
+
* application's configured timezone — e.g. pict apps set this to the
|
|
1328
|
+
* document's project timezone); otherwise the host's local zone.
|
|
1329
|
+
*
|
|
1330
|
+
* @param {string|number|Date} pDateValue - ISO string, epoch millis, or Date
|
|
1331
|
+
* @param {string} pFormat - dayjs format tokens (e.g. 'YYYY-MM-DD h:mm A')
|
|
1332
|
+
* @param {string} [pTimezone] - optional IANA zone override (e.g. 'America/Chicago')
|
|
1333
|
+
* @return {string|undefined} the formatted string, or undefined on an unparseable value
|
|
1334
|
+
*/formatDate(pDateValue,pFormat,pTimezone){try{let tmpDate=this.dayJS(pDateValue);if(!tmpDate.isValid()){return undefined;}let tmpFormat=typeof pFormat==='string'&&pFormat.length>0?pFormat:'YYYY-MM-DD HH:mm:ss';tmpDate=typeof pTimezone==='string'&&pTimezone.length>0?tmpDate.tz(pTimezone):tmpDate.tz();return tmpDate.format(tmpFormat);}catch(pError){return undefined;}}dateFromParts(pYear,pMonth,pDay){let pHour=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;let pMinute=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;let pSecond=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;let pMillisecond=arguments.length>6&&arguments[6]!==undefined?arguments[6]:0;try{let tmpDate=this.dayJS.utc().year(pYear).month(pMonth-1).date(pDay).hour(pHour).minute(pMinute).second(pSecond).millisecond(pMillisecond);return tmpDate.toISOString();}catch(pError){return undefined;}}}module.exports=DateManipulation;},{"dayjs":32,"dayjs/plugin/advancedFormat":33,"dayjs/plugin/isoWeek":34,"dayjs/plugin/relativeTime":35,"dayjs/plugin/timezone":36,"dayjs/plugin/utc":37,"dayjs/plugin/weekOfYear":38,"dayjs/plugin/weekday":39,"fable-serviceproviderbase":59}],75:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');class FableServiceEnvironmentData extends libFableServiceBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='EnvironmentData';this.Environment=`node.js`;}}module.exports=FableServiceEnvironmentData;},{"fable-serviceproviderbase":59}],76:[function(require,module,exports){const libFableServiceBase=require('fable-serviceproviderbase');/* Trying a different pattern for this service ...
|
|
1323
1335
|
*
|
|
1324
1336
|
* This service is a simple expression parser that can handle math expressions, with magic(tm) lookup of addresses with a manifest.
|
|
1325
1337
|
*
|
|
@@ -1618,7 +1630,7 @@ tmpCurrentTokenType='Value';tmpCurrentToken+=tmpCharacter;// continue;
|
|
|
1618
1630
|
// tmpResults.ExpressionParserLog.push(`ExpressionParser.tokenize found an unknown character code ${tmpCharCode} character ${tmpCharacter} in the expression: ${pExpression} at index ${i}`);
|
|
1619
1631
|
// this.log.warn(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);
|
|
1620
1632
|
}if(tmpCurrentTokenType&&tmpCurrentToken.length>0){tmpResults.RawTokens.push(tmpCurrentToken);}tmpResults.OriginalRawTokens=Array.from(tmpResults.RawTokens);// Potentially mutate the tokens based on directives in the tokenized expression
|
|
1621
|
-
this.TokenizerDirectiveMutation.parseDirectives(tmpResults);return tmpResults.RawTokens;}}module.exports=ExpressionTokenizer;},{"./Fable-Service-ExpressionParser-Base.js":77}],80:[function(require,module,exports){module.exports={"sqrt":{"Name":"Square Root","Address":"fable.Math.sqrtPrecise"},"percent":{"Name":"Compute Percent (in IS over OF format)","Address":"fable.Math.percentagePrecise"},"compare":{"Name":"Compare","Address":"fable.Math.comparePrecise"},"abs":{"Name":"Absolute Value","Address":"fable.Math.absPrecise"},"floor":{"Name":"Floor Value","Address":"fable.Math.floorPrecise"},"ceil":{"Name":"Ceiling Value","Address":"fable.Math.ceilPrecise"},"rad":{"Name":"Degrees to Radians","Address":"fable.Math.radPrecise"},"pi":{"Name":"Pi","Address":"fable.Math.piPrecise"},"euler":{"Name":"Euler","Address":"fable.Math.eulerPrecise"},"log":{"Name":"Logarithm","Address":"fable.Math.logPrecise"},"exp":{"Name":"Eulers Number to the Power Of N","Address":"fable.Math.expPrecise"},"sin":{"Name":"Sine","Address":"fable.Math.sin"},"cos":{"Name":"Cosine","Address":"fable.Math.cos"},"tan":{"Name":"Tangent","Address":"fable.Math.tan"},"count":{"Name":"Count Set Elements","Address":"fable.Math.countSetElements"},"countset":{"Name":"Count Set Elements","Address":"fable.Math.countSetElements"},"sortset":{"Name":"Sort Set","Address":"fable.Math.sortSetPrecise"},"bucketset":{"Name":"Bucket Set","Address":"fable.Math.bucketSetPrecise"},"sorthistogram":{"Name":"Sort Histogram","Address":"fable.Math.sortHistogramPrecise"},"sorthistogrambykeys":{"Name":"Sort Histogram by Keys","Address":"fable.Math.sortHistogramByKeys"},"max":{"Name":"Maximum","Address":"fable.Math.maxPrecise"},"min":{"Name":"Minimum","Address":"fable.Math.minPrecise"},"sum":{"Name":"Sum","Address":"fable.Math.sumPrecise"},"avg":{"Name":"Average","Address":"fable.Math.averagePrecise"},"mean":{"Name":"Mean","Address":"fable.Math.meanPrecise"},"median":{"Name":"Median","Address":"fable.Math.medianPrecise"},"mode":{"Name":"Mode","Address":"fable.Math.modePrecise"},"var":{"Name":"Variance (Sample)","Address":"fable.Math.variancePrecise"},"vara":{"Name":"Variance (Sample)","Address":"fable.Math.variancePrecise"},"varp":{"Name":"Variance (Population)","Address":"fable.Math.populationVariancePrecise"},"stdev":{"Name":"Standard Deviation (Sample)","Address":"fable.Math.standardDeviationPrecise"},"stdeva":{"Name":"Standard Deviation (Sample)","Address":"fable.Math.standardDeviationPrecise"},"stdevp":{"Name":"Standard Deviation (Population)","Address":"fable.Math.populationStandardDeviationPrecise"},"round":{"Name":"Round","Address":"fable.Math.roundPrecise"},"tofixed":{"Name":"To Fixed","Address":"fable.Math.toFixedPrecise"},"cumulativesummation":{"Name":"Sum each value in a Histogram or Value Map cumulatively, creating or setting a property with the result on each row","Address":"fable.Math.cumulativeSummation"},"subtractingsummation":{"Name":"Subtract each subsequent value in a Histogram or Value Map cumulatively (by default from the first row), creating or setting a property with the result on each row.","Address":"fable.Math.subtractingSummation"},"iterativeseries":{"Name":"Perform an Iterative Series of Mathematical Operations on Set Elements","Address":"fable.Math.iterativeSeries"},"countsetelements":{"Name":"Count Set Elements in a Histogram or Value Map","Address":"fable.Math.countSetElements"},"getvalue":{"Name":"Get Value from Application State or Services (AppData, etc.)","Address":"fable.Utility.getInternalValueByHash","AddressParameterIndices":[0]},"setvalue":{"Name":"Set Value to Application State or Services (AppData, etc.)","Address":"fable.Utility.setInternalValueByHash","AddressParameterIndices":[0]},"objectkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"objectvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"generatearrayofobjectsfromsets":{"Name":"Generate Array of Objects from Sets","Address":"fable.Utility.generateArrayOfObjectsFromSets"},"objectvaluessortbyexternalobjectarray":{"Name":"Get Array of an Object's values sorted by an external array","Address":"fable.Utility.objectValuesSortByExternalArray"},"setkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"setvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"histogramkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"histogramvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"createarrayfromabsolutevalues":{"Name":"Create Array from Absolute Values","Address":"fable.Utility.createArrayFromAbsoluteValues"},"flatten":{"Name":"flatten an array of values","Address":"fable.Utility.flattenArrayOfSolverInputs"},"findfirstvaluebyexactmatch":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByExactMatchInternal","AddressParameterIndices":[0,1,3]},"findfirstvaluebystringincludes":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByStringIncludesInternal","AddressParameterIndices":[0,1,3]},"match":{"Name":"Implementation of sheets MATCH() function","Address":"fable.Utility.findIndexInternal","AddressParameterIndices":[1]},"resolvehtmlentities":{"Name":"resolve HTML entities","Address":"fable.DataFormat.resolveHtmlEntities"},"concat":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsInternal"},"concatraw":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsRawInternal"},"arrayconcat":{"Name":"concatenate two or more arrays generating a single output array","Address":"fable.Utility.concatenateArrays"},"join":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsInternal"},"joinraw":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsRawInternal"},"if":{"Name":"perform a conditional operator on two values, and choose one of two outcomes based on the result","Address":"fable.Logic.checkIf"},"when":{"Name":"perform a 'truthy' check on one value, and return one of two outcomes based on the result","Address":"fable.Logic.when"},"ternary":{"Name":"numeric-aware ternary selection (used by ? :: operator desugaring)","Address":"fable.Logic.ternary"},"entryinset":{"Name":"Entry in Set","Address":"fable.Math.entryInSet"},"smallestinset":{"Name":"Smallest in Set","Address":"fable.Math.smallestInSet"},"largestinset":{"Name":"Largest in Set","Address":"fable.Math.largestInSet"},"aggregationhistogram":{"Name":"Generate a Histogram by Exact Value Aggregation","Address":"fable.Math.histogramAggregationByExactValueFromInternalState"},"aggregationhistogrambyobject":{"Name":"Generate a Histogram by Exact Value Aggregation from Object Property","Address":"fable.Math.histogramAggregationByExactValue"},"distributionhistogram":{"Name":"Generate a Histogram Based on Value Distribution","Address":"fable.Math.histogramDistributionByExactValueFromInternalState"},"distributionhistogrambyobject":{"Name":"Generate a Histogram Based on Value Distribution from Object Property","Address":"fable.Math.histogramDistributionByExactValue"},"setconcatenate":{"Name":"Set Concatenate","Address":"fable.Math.setConcatenate"},"getvaluearray":{"Name":"Get Value Array from Application State or Services (AppData, etc.)","Address":"fable.Utility.createValueArrayByHashParametersFromInternal","AddressParameterIndices":[0,1,2,3,4,5,6,7,8,9]},"getvalueobject":{"Name":"Get Value Object from Application State or Services (AppData, etc.)","Address":"fable.Utility.createValueObjectByHashParametersFromInternal","AddressParameterIndices":[0,1,2,3,4,5,6,7,8,9]},"cleanvaluearray":{"Name":"Clean Value Array","Address":"fable.Math.cleanValueArray"},"cleanvalueobject":{"Name":"Clean Value Object","Address":"fable.Math.cleanValueObject"},"polynomialregression":{"Name":"Perform an nth degree Polynomial Regression on a Set of X and Y Values","Address":"fable.Math.polynomialRegression"},"randominteger":{"Name":"Random Integer","Address":"fable.DataGeneration.randomInteger"},"randomintegerbetween":{"Name":"Random Integer Between Two Numbers","Address":"fable.DataGeneration.randomIntegerBetween"},"randomintegerupto":{"Name":"Random Integer","Address":"fable.DataGeneration.randomIntegerUpTo"},"randomfloat":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloat"},"randomfloatbetween":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloatBetween"},"randomfloatupto":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloatUpTo"},"datemilliseconddifference":{"Name":"Date Difference in Milliseconds","Address":"fable.Dates.dateMillisecondDifference"},"dateseconddifference":{"Name":"Date Difference in Seconds","Address":"fable.Dates.dateSecondDifference"},"dateminutedifference":{"Name":"Date Difference in Minutes","Address":"fable.Dates.dateMinuteDifference"},"datehourdifference":{"Name":"Date Difference in Hours","Address":"fable.Dates.dateHourDifference"},"datedaydifference":{"Name":"Date Difference in Days","Address":"fable.Dates.dateDayDifference"},"dateweekdifference":{"Name":"Date Difference in Weeks","Address":"fable.Dates.dateWeekDifference"},"datemonthdifference":{"Name":"Date Difference in Months","Address":"fable.Dates.dateMonthDifference"},"dateyeardifference":{"Name":"Date Difference in Years","Address":"fable.Dates.dateYearDifference"},"datemathadd":{"Name":"Date Math Add","Address":"fable.Dates.dateMath"},"dateaddmilliseconds":{"Name":"Date Add Milliseconds","Address":"fable.Dates.dateAddMilliseconds"},"dateaddseconds":{"Name":"Date Add Seconds","Address":"fable.Dates.dateAddSeconds"},"dateaddminutes":{"Name":"Date Add Minutes","Address":"fable.Dates.dateAddMinutes"},"dateaddhours":{"Name":"Date Add Hours","Address":"fable.Dates.dateAddHours"},"dateadddays":{"Name":"Date Add Days","Address":"fable.Dates.dateAddDays"},"dateaddweeks":{"Name":"Date Add Weeks","Address":"fable.Dates.dateAddWeeks"},"dateaddmonths":{"Name":"Date Add Months","Address":"fable.Dates.dateAddMonths"},"dateaddyears":{"Name":"Date Add Years","Address":"fable.Dates.dateAddYears"},"datefromparts":{"Name":"Date From Parts","Address":"fable.Dates.dateFromParts"},"slice":{"Name":"Slice Array","Address":"fable.Utility.slice"},"createvalueobjectbyhashes":{"Name":"Create Value Object by Hashes","Address":"fable.Utility.createValueObjectByHashes","AddressParameterIndices":[0,1,2,3,4,5,6,7,8,9]},"slope":{"Name":"Slope of Linear Regression Line (Excel SLOPE equivalent)","Address":"fable.Math.slopePrecise"},"intercept":{"Name":"Y-Intercept of Linear Regression Line (Excel INTERCEPT equivalent)","Address":"fable.Math.interceptPrecise"},"leastsquares":{"Name":"Perform a Least Squares Regression on a Set of Independent Variable Vectors and a Dependent Variable Vector","Address":"fable.Math.leastSquares"},"linest":{"Name":"Perform a Least Squares Regression on a Set of Independent Variable Vectors and a Dependent Variable Vector","Address":"fable.Math.leastSquares"},"matrixtranspose":{"Name":"Transpose a Matrix","Address":"fable.Math.matrixTranspose"},"matrixmultiply":{"Name":"Multiply Two Matrices","Address":"fable.Math.matrixMultiply"},"matrixvectormultiply":{"Name":"Multiply a Matrix by a Vector","Address":"fable.Math.matrixVectorMultiply"},"matrixinverse":{"Name":"Inverse a Matrix","Address":"fable.Math.matrixInverse"},"gaussianelimination":{"Name":"Solve a System of Linear Equations using Gaussian Elimination","Address":"fable.Math.gaussianElimination"},"predict":{"Name":"Predict Y Values from X Values using a Regression Model","Address":"fable.Math.predictFromRegressionModel"},"stringcountsegments":{"Name":"Count Segments in a String","Address":"fable.DataFormat.stringCountSegments"},"stringgetsegments":{"Name":"Get Segments from a String","Address":"fable.DataFormat.stringGetSegments"},"bezierpoint":{"Name":"Evaluate a Point on a Cubic Bezier Curve at Parameter t","Address":"fable.Math.bezierPoint"},"beziercurvefit":{"Name":"Fit a Cubic Bezier Curve to a Set of Data Points","Address":"fable.Math.bezierCurveFit"},"generateguid":{"Name":"Generate a GUID string","Address":"fable.getUUID"},"isnumeric":{"Name":"Is Numeric (1/0; trims strings, empty/text are not numeric)","Address":"fable.Math.isNumeric"},"tonumber":{"Name":"To Number (with fallback for non-numeric values)","Address":"fable.Math.toNumber"}};},{}],81:[function(require,module,exports){const libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');class ExpressionParserLinter extends libExpressionParserOperationBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='ExpressionParser-Linter';}lintTokenizedExpression(pTokenizedExpression,pResultObject){let tmpResults=typeof pResultObject==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.LinterResults=[];// Guard against bad data being passed in
|
|
1633
|
+
this.TokenizerDirectiveMutation.parseDirectives(tmpResults);return tmpResults.RawTokens;}}module.exports=ExpressionTokenizer;},{"./Fable-Service-ExpressionParser-Base.js":77}],80:[function(require,module,exports){module.exports={"sqrt":{"Name":"Square Root","Address":"fable.Math.sqrtPrecise"},"percent":{"Name":"Compute Percent (in IS over OF format)","Address":"fable.Math.percentagePrecise"},"compare":{"Name":"Compare","Address":"fable.Math.comparePrecise"},"abs":{"Name":"Absolute Value","Address":"fable.Math.absPrecise"},"floor":{"Name":"Floor Value","Address":"fable.Math.floorPrecise"},"ceil":{"Name":"Ceiling Value","Address":"fable.Math.ceilPrecise"},"rad":{"Name":"Degrees to Radians","Address":"fable.Math.radPrecise"},"pi":{"Name":"Pi","Address":"fable.Math.piPrecise"},"euler":{"Name":"Euler","Address":"fable.Math.eulerPrecise"},"log":{"Name":"Logarithm","Address":"fable.Math.logPrecise"},"exp":{"Name":"Eulers Number to the Power Of N","Address":"fable.Math.expPrecise"},"sin":{"Name":"Sine","Address":"fable.Math.sin"},"cos":{"Name":"Cosine","Address":"fable.Math.cos"},"tan":{"Name":"Tangent","Address":"fable.Math.tan"},"count":{"Name":"Count Set Elements","Address":"fable.Math.countSetElements"},"countset":{"Name":"Count Set Elements","Address":"fable.Math.countSetElements"},"sortset":{"Name":"Sort Set","Address":"fable.Math.sortSetPrecise"},"bucketset":{"Name":"Bucket Set","Address":"fable.Math.bucketSetPrecise"},"sorthistogram":{"Name":"Sort Histogram","Address":"fable.Math.sortHistogramPrecise"},"sorthistogrambykeys":{"Name":"Sort Histogram by Keys","Address":"fable.Math.sortHistogramByKeys"},"max":{"Name":"Maximum","Address":"fable.Math.maxPrecise"},"min":{"Name":"Minimum","Address":"fable.Math.minPrecise"},"sum":{"Name":"Sum","Address":"fable.Math.sumPrecise"},"avg":{"Name":"Average","Address":"fable.Math.averagePrecise"},"mean":{"Name":"Mean","Address":"fable.Math.meanPrecise"},"median":{"Name":"Median","Address":"fable.Math.medianPrecise"},"mode":{"Name":"Mode","Address":"fable.Math.modePrecise"},"var":{"Name":"Variance (Sample)","Address":"fable.Math.variancePrecise"},"vara":{"Name":"Variance (Sample)","Address":"fable.Math.variancePrecise"},"varp":{"Name":"Variance (Population)","Address":"fable.Math.populationVariancePrecise"},"stdev":{"Name":"Standard Deviation (Sample)","Address":"fable.Math.standardDeviationPrecise"},"stdeva":{"Name":"Standard Deviation (Sample)","Address":"fable.Math.standardDeviationPrecise"},"stdevp":{"Name":"Standard Deviation (Population)","Address":"fable.Math.populationStandardDeviationPrecise"},"round":{"Name":"Round","Address":"fable.Math.roundPrecise"},"tofixed":{"Name":"To Fixed","Address":"fable.Math.toFixedPrecise"},"cumulativesummation":{"Name":"Sum each value in a Histogram or Value Map cumulatively, creating or setting a property with the result on each row","Address":"fable.Math.cumulativeSummation"},"subtractingsummation":{"Name":"Subtract each subsequent value in a Histogram or Value Map cumulatively (by default from the first row), creating or setting a property with the result on each row.","Address":"fable.Math.subtractingSummation"},"iterativeseries":{"Name":"Perform an Iterative Series of Mathematical Operations on Set Elements","Address":"fable.Math.iterativeSeries"},"countsetelements":{"Name":"Count Set Elements in a Histogram or Value Map","Address":"fable.Math.countSetElements"},"getvalue":{"Name":"Get Value from Application State or Services (AppData, etc.)","Address":"fable.Utility.getInternalValueByHash","AddressParameterIndices":[0]},"setvalue":{"Name":"Set Value to Application State or Services (AppData, etc.)","Address":"fable.Utility.setInternalValueByHash","AddressParameterIndices":[0]},"objectkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"objectvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"generatearrayofobjectsfromsets":{"Name":"Generate Array of Objects from Sets","Address":"fable.Utility.generateArrayOfObjectsFromSets"},"objectvaluessortbyexternalobjectarray":{"Name":"Get Array of an Object's values sorted by an external array","Address":"fable.Utility.objectValuesSortByExternalArray"},"setkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"setvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"histogramkeystoarray":{"Name":"Get Array of an Object's keys","Address":"fable.Utility.objectKeysToArray"},"histogramvaluestoarray":{"Name":"Get Array of an Object's values","Address":"fable.Utility.objectValuesToArray"},"createarrayfromabsolutevalues":{"Name":"Create Array from Absolute Values","Address":"fable.Utility.createArrayFromAbsoluteValues"},"flatten":{"Name":"flatten an array of values","Address":"fable.Utility.flattenArrayOfSolverInputs"},"findfirstvaluebyexactmatch":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByExactMatchInternal","AddressParameterIndices":[0,1,3]},"findfirstvaluebystringincludes":{"Name":"find + map on array of objects","Address":"fable.Utility.findFirstValueByStringIncludesInternal","AddressParameterIndices":[0,1,3]},"match":{"Name":"Implementation of sheets MATCH() function","Address":"fable.Utility.findIndexInternal","AddressParameterIndices":[1]},"resolvehtmlentities":{"Name":"resolve HTML entities","Address":"fable.DataFormat.resolveHtmlEntities"},"concat":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsInternal"},"concatraw":{"Name":"concatenate an array of values and output a string","Address":"fable.DataFormat.concatenateStringsRawInternal"},"arrayconcat":{"Name":"concatenate two or more arrays generating a single output array","Address":"fable.Utility.concatenateArrays"},"join":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsInternal"},"joinraw":{"Name":"join an array of values and output a string","Address":"fable.DataFormat.joinStringsRawInternal"},"if":{"Name":"perform a conditional operator on two values, and choose one of two outcomes based on the result","Address":"fable.Logic.checkIf"},"when":{"Name":"perform a 'truthy' check on one value, and return one of two outcomes based on the result","Address":"fable.Logic.when"},"ternary":{"Name":"numeric-aware ternary selection (used by ? :: operator desugaring)","Address":"fable.Logic.ternary"},"entryinset":{"Name":"Entry in Set","Address":"fable.Math.entryInSet"},"smallestinset":{"Name":"Smallest in Set","Address":"fable.Math.smallestInSet"},"largestinset":{"Name":"Largest in Set","Address":"fable.Math.largestInSet"},"aggregationhistogram":{"Name":"Generate a Histogram by Exact Value Aggregation","Address":"fable.Math.histogramAggregationByExactValueFromInternalState"},"aggregationhistogrambyobject":{"Name":"Generate a Histogram by Exact Value Aggregation from Object Property","Address":"fable.Math.histogramAggregationByExactValue"},"distributionhistogram":{"Name":"Generate a Histogram Based on Value Distribution","Address":"fable.Math.histogramDistributionByExactValueFromInternalState"},"distributionhistogrambyobject":{"Name":"Generate a Histogram Based on Value Distribution from Object Property","Address":"fable.Math.histogramDistributionByExactValue"},"setconcatenate":{"Name":"Set Concatenate","Address":"fable.Math.setConcatenate"},"getvaluearray":{"Name":"Get Value Array from Application State or Services (AppData, etc.)","Address":"fable.Utility.createValueArrayByHashParametersFromInternal","AddressParameterIndices":[0,1,2,3,4,5,6,7,8,9]},"getvalueobject":{"Name":"Get Value Object from Application State or Services (AppData, etc.)","Address":"fable.Utility.createValueObjectByHashParametersFromInternal","AddressParameterIndices":[0,1,2,3,4,5,6,7,8,9]},"cleanvaluearray":{"Name":"Clean Value Array","Address":"fable.Math.cleanValueArray"},"cleanvalueobject":{"Name":"Clean Value Object","Address":"fable.Math.cleanValueObject"},"polynomialregression":{"Name":"Perform an nth degree Polynomial Regression on a Set of X and Y Values","Address":"fable.Math.polynomialRegression"},"randominteger":{"Name":"Random Integer","Address":"fable.DataGeneration.randomInteger"},"randomintegerbetween":{"Name":"Random Integer Between Two Numbers","Address":"fable.DataGeneration.randomIntegerBetween"},"randomintegerupto":{"Name":"Random Integer","Address":"fable.DataGeneration.randomIntegerUpTo"},"randomfloat":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloat"},"randomfloatbetween":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloatBetween"},"randomfloatupto":{"Name":"Random Float","Address":"fable.DataGeneration.randomFloatUpTo"},"datemilliseconddifference":{"Name":"Date Difference in Milliseconds","Address":"fable.Dates.dateMillisecondDifference"},"dateseconddifference":{"Name":"Date Difference in Seconds","Address":"fable.Dates.dateSecondDifference"},"dateminutedifference":{"Name":"Date Difference in Minutes","Address":"fable.Dates.dateMinuteDifference"},"datehourdifference":{"Name":"Date Difference in Hours","Address":"fable.Dates.dateHourDifference"},"datedaydifference":{"Name":"Date Difference in Days","Address":"fable.Dates.dateDayDifference"},"dateweekdifference":{"Name":"Date Difference in Weeks","Address":"fable.Dates.dateWeekDifference"},"datemonthdifference":{"Name":"Date Difference in Months","Address":"fable.Dates.dateMonthDifference"},"dateyeardifference":{"Name":"Date Difference in Years","Address":"fable.Dates.dateYearDifference"},"datemathadd":{"Name":"Date Math Add","Address":"fable.Dates.dateMath"},"dateaddmilliseconds":{"Name":"Date Add Milliseconds","Address":"fable.Dates.dateAddMilliseconds"},"dateaddseconds":{"Name":"Date Add Seconds","Address":"fable.Dates.dateAddSeconds"},"dateaddminutes":{"Name":"Date Add Minutes","Address":"fable.Dates.dateAddMinutes"},"dateaddhours":{"Name":"Date Add Hours","Address":"fable.Dates.dateAddHours"},"dateadddays":{"Name":"Date Add Days","Address":"fable.Dates.dateAddDays"},"dateaddweeks":{"Name":"Date Add Weeks","Address":"fable.Dates.dateAddWeeks"},"dateaddmonths":{"Name":"Date Add Months","Address":"fable.Dates.dateAddMonths"},"dateaddyears":{"Name":"Date Add Years","Address":"fable.Dates.dateAddYears"},"datefromparts":{"Name":"Date From Parts","Address":"fable.Dates.dateFromParts"},"slice":{"Name":"Slice Array","Address":"fable.Utility.slice"},"createvalueobjectbyhashes":{"Name":"Create Value Object by Hashes","Address":"fable.Utility.createValueObjectByHashes","AddressParameterIndices":[0,1,2,3,4,5,6,7,8,9]},"slope":{"Name":"Slope of Linear Regression Line (Excel SLOPE equivalent)","Address":"fable.Math.slopePrecise"},"intercept":{"Name":"Y-Intercept of Linear Regression Line (Excel INTERCEPT equivalent)","Address":"fable.Math.interceptPrecise"},"leastsquares":{"Name":"Perform a Least Squares Regression on a Set of Independent Variable Vectors and a Dependent Variable Vector","Address":"fable.Math.leastSquares"},"linest":{"Name":"Perform a Least Squares Regression on a Set of Independent Variable Vectors and a Dependent Variable Vector","Address":"fable.Math.leastSquares"},"matrixtranspose":{"Name":"Transpose a Matrix","Address":"fable.Math.matrixTranspose"},"matrixmultiply":{"Name":"Multiply Two Matrices","Address":"fable.Math.matrixMultiply"},"matrixvectormultiply":{"Name":"Multiply a Matrix by a Vector","Address":"fable.Math.matrixVectorMultiply"},"matrixinverse":{"Name":"Inverse a Matrix","Address":"fable.Math.matrixInverse"},"gaussianelimination":{"Name":"Solve a System of Linear Equations using Gaussian Elimination","Address":"fable.Math.gaussianElimination"},"predict":{"Name":"Predict Y Values from X Values using a Regression Model","Address":"fable.Math.predictFromRegressionModel"},"stringcountsegments":{"Name":"Count Segments in a String","Address":"fable.DataFormat.stringCountSegments"},"stringgetsegments":{"Name":"Get Segments from a String","Address":"fable.DataFormat.stringGetSegments"},"bezierpoint":{"Name":"Evaluate a Point on a Cubic Bezier Curve at Parameter t","Address":"fable.Math.bezierPoint"},"beziercurvefit":{"Name":"Fit a Cubic Bezier Curve to a Set of Data Points","Address":"fable.Math.bezierCurveFit"},"generateguid":{"Name":"Generate a GUID string","Address":"fable.getUUID"},"isnumeric":{"Name":"Is Numeric (1/0; trims strings, empty/text are not numeric)","Address":"fable.Math.isNumeric"},"tonumber":{"Name":"To Number (with fallback for non-numeric values)","Address":"fable.Math.toNumber"},"aggregationjoinbyobject":{"Name":"Collect (join) per-key string values by Exact Value from Object Property","Address":"fable.Math.histogramAggregationJoinByExactValue"},"dateformat":{"Name":"Format a Date with dayjs tokens in a timezone (explicit param, else the configured default)","Address":"fable.Dates.formatDate"},"chartticks":{"Name":"Compute readable chart axis tick labels (sparse same-length array) from a dense value set","Address":"fable.Math.chartTickLabels"},"setdensity":{"Name":"Analyze ordered-set density: natural boundaries (calendar units / nice numeric steps / positions) fitting a budget","Address":"fable.Math.analyzeSetDensity"}};},{}],81:[function(require,module,exports){const libExpressionParserOperationBase=require('./Fable-Service-ExpressionParser-Base.js');class ExpressionParserLinter extends libExpressionParserOperationBase{constructor(pFable,pOptions,pServiceHash){super(pFable,pOptions,pServiceHash);this.serviceType='ExpressionParser-Linter';}lintTokenizedExpression(pTokenizedExpression,pResultObject){let tmpResults=typeof pResultObject==='object'?pResultObject:{ExpressionParserLog:[]};tmpResults.LinterResults=[];// Guard against bad data being passed in
|
|
1622
1634
|
if(!Array.isArray(pTokenizedExpression)){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.lintTokenizedExpression was passed a non-array tokenized expression.`);tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return pTokenizedExpression;}if(pTokenizedExpression.length<1){tmpResults.ExpressionParserLog.push(`ERROR: ExpressionParser.lintTokenizedExpression was passed an empty tokenized expression.`);tmpResults.LinterResults.push(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);this.log.error(tmpResults.ExpressionParserLog[tmpResults.ExpressionParserLog.length-1]);return pTokenizedExpression;}// 1. Check for balanced parenthesis
|
|
1623
1635
|
let tmpParenthesisDepth=0;// If it is in a state address, we don't care about the parenthesis
|
|
1624
1636
|
// State addresses are between squiggly brackets
|
|
@@ -2220,11 +2232,62 @@ let tmpCleanedObject={};let tmpKeys=Object.keys(pValueObject);for(let i=0;i<tmpK
|
|
|
2220
2232
|
* Make a histogram of representative counts for exact values (.tostring() is the keys to count)
|
|
2221
2233
|
* @param {Array} pValueSet
|
|
2222
2234
|
* @param {string} pValueAddress
|
|
2223
|
-
*/histogramDistributionByExactValue(pValueObjectSet,pValueAddress,pManifest){if(!Array.isArray(pValueObjectSet)){return pValueObjectSet;}
|
|
2235
|
+
*/histogramDistributionByExactValue(pValueObjectSet,pValueAddress,pManifest){if(!Array.isArray(pValueObjectSet)){return pValueObjectSet;}let tmpHistogram={};for(let i=0;i<pValueObjectSet.length;i++){// Without a value address, the set elements themselves are counted
|
|
2236
|
+
// (plain value sets); with one, count the addressed property.
|
|
2237
|
+
let tmpRawValue=pValueAddress?this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueAddress,pManifest):pValueObjectSet[i];if(tmpRawValue===undefined||tmpRawValue===null){continue;}let tmpValue=tmpRawValue.toString();if(!(tmpValue in tmpHistogram)){tmpHistogram[tmpValue]=0;}tmpHistogram[tmpValue]=tmpHistogram[tmpValue]+1;}return tmpHistogram;}histogramDistributionByExactValueFromInternalState(pValueObjectSetAddress,pValueAddress){if(!pValueObjectSetAddress){return{};}// The expression parser hands the resolved SET, not an address —
|
|
2238
|
+
// delegate directly so DISTRIBUTIONHISTOGRAM(set) works.
|
|
2239
|
+
if(Array.isArray(pValueObjectSetAddress)){return this.histogramDistributionByExactValue(pValueObjectSetAddress,pValueAddress);}let tmpValueObjectSet=this.fable.Utility.getInternalValueByHash(pValueObjectSetAddress);return this.histogramDistributionByExactValue(tmpValueObjectSet,pValueAddress);}/**
|
|
2224
2240
|
* Make a histogram of representative counts for exact values (.tostring() is the keys to count)
|
|
2225
2241
|
* @param {Array} pValueSet
|
|
2226
2242
|
* @param {string} pValueAddress
|
|
2227
|
-
|
|
2243
|
+
*//**
|
|
2244
|
+
* Analyze the density of an ordered value set and find natural boundary
|
|
2245
|
+
* positions that fit a budget — the generic core behind axis ticks, HTML
|
|
2246
|
+
* group headers, timeline scrubbers, and any other "too many labels"
|
|
2247
|
+
* presentation problem.
|
|
2248
|
+
*
|
|
2249
|
+
* Domain handling:
|
|
2250
|
+
* - Date-like sets: boundaries where values cross calendar units,
|
|
2251
|
+
* using the finest unit (day, week, month, quarter, year) that fits
|
|
2252
|
+
* the budget; labels formatted at the unit's natural grain.
|
|
2253
|
+
* - Numeric sets: boundaries where values cross multiples of a "nice"
|
|
2254
|
+
* step (1 / 2 / 2.5 / 5 x 10^k) chosen to fit the budget; labels are
|
|
2255
|
+
* the crossed multiples.
|
|
2256
|
+
* - Everything else (ordinal): uniform positional boundaries.
|
|
2257
|
+
*
|
|
2258
|
+
* Assumes the set is ordered (an axis/sequence); unordered input
|
|
2259
|
+
* degrades to ordinal handling.
|
|
2260
|
+
*
|
|
2261
|
+
* @param {Array} pValueSet - ordered values, one per position
|
|
2262
|
+
* @param {number} [pMaximumBoundaries=12] - boundary budget (clamped 2..100)
|
|
2263
|
+
* @return {{ SetType: string, Unit: string, Boundaries: Array<{Index: number, Value: any, Label: string}> }}
|
|
2264
|
+
*/analyzeSetDensity(pValueSet,pMaximumBoundaries){let tmpBudget=parseInt(pMaximumBoundaries,10);tmpBudget=isNaN(tmpBudget)?12:Math.max(2,Math.min(100,tmpBudget));const tmpResult={SetType:'ordinal',Unit:'position',Boundaries:[]};if(!Array.isArray(pValueSet)||pValueSet.length<1){return tmpResult;}if(pValueSet.length<=tmpBudget){tmpResult.Boundaries=pValueSet.map((pValue,pIndex)=>({Index:pIndex,Value:pValue,Label:pValue===undefined||pValue===null?'':pValue.toString()}));return tmpResult;}const tmpNumbers=pValueSet.map(pValue=>this.parsePrecise(pValue,NaN));const tmpIsNumericSet=tmpNumbers.every(pNumber=>!isNaN(pNumber));const tmpDayJS=this.fable.Dates.dayJS;const tmpIsDateSet=!tmpIsNumericSet&&pValueSet.every(pValue=>pValue!==undefined&&pValue!==null&&pValue!==''&&tmpDayJS(pValue.toString()).isValid());if(tmpIsDateSet){tmpResult.SetType='date';const tmpUnitLadder=[{Unit:'day',Key:'YYYY-MM-DD',Label:'MMM D'},{Unit:'week',Key:'GGGG-WW',Label:'MMM D'},{Unit:'month',Key:'YYYY-MM',Label:'MMM YYYY'},{Unit:'quarter',Key:'YYYY-Q',Label:'[Q]Q YYYY'},{Unit:'year',Key:'YYYY',Label:'YYYY'}];const tmpParsed=pValueSet.map(pValue=>tmpDayJS(pValue.toString()));for(let u=0;u<tmpUnitLadder.length;u++){const tmpBucketKeys=tmpParsed.map(pDate=>pDate.format(tmpUnitLadder[u].Key));const tmpDistinct=new Set(tmpBucketKeys).size;if(tmpDistinct<=tmpBudget||u===tmpUnitLadder.length-1){tmpResult.Unit=tmpUnitLadder[u].Unit;const tmpBoundaryStride=Math.max(1,Math.ceil(tmpDistinct/tmpBudget));let tmpSeen={};let tmpBoundaryIndex=-1;for(let i=0;i<pValueSet.length;i++){if(tmpBucketKeys[i]in tmpSeen){continue;}tmpSeen[tmpBucketKeys[i]]=true;tmpBoundaryIndex++;if(tmpBoundaryIndex%tmpBoundaryStride!==0){continue;}tmpResult.Boundaries.push({Index:i,Value:pValueSet[i],Label:tmpParsed[i].format(tmpUnitLadder[u].Label)});}return tmpResult;}}}if(tmpIsNumericSet){tmpResult.SetType='number';// Nice step: smallest of {1, 2, 2.5, 5} x 10^k giving <= budget
|
|
2265
|
+
// boundary crossings over the value range.
|
|
2266
|
+
const tmpMinimum=Math.min(...tmpNumbers);const tmpMaximum=Math.max(...tmpNumbers);const tmpRange=tmpMaximum-tmpMinimum;if(tmpRange>0){const tmpRawStep=tmpRange/tmpBudget;const tmpMagnitude=Math.pow(10,Math.floor(Math.log10(tmpRawStep)));let tmpStep=10*tmpMagnitude;for(const tmpNice of[1,2,2.5,5]){if(tmpNice*tmpMagnitude>=tmpRawStep){tmpStep=tmpNice*tmpMagnitude;break;}}tmpResult.Unit=`step:${tmpStep}`;let tmpLastBucket=null;for(let i=0;i<pValueSet.length;i++){const tmpBucket=Math.floor(tmpNumbers[i]/tmpStep);if(tmpBucket===tmpLastBucket){continue;}tmpLastBucket=tmpBucket;const tmpNiceValue=tmpBucket*tmpStep;tmpResult.Boundaries.push({Index:i,Value:pValueSet[i],Label:this.roundPrecise(tmpNiceValue,6).toString()});}if(tmpResult.Boundaries.length<=tmpBudget){return tmpResult;}// Non-monotonic data can cross steps many times — degrade.
|
|
2267
|
+
tmpResult.Boundaries=[];}}// Ordinal: uniform positional stride.
|
|
2268
|
+
tmpResult.SetType=tmpResult.SetType==='ordinal'?'ordinal':tmpResult.SetType;tmpResult.Unit='position';const tmpStride=Math.ceil(pValueSet.length/tmpBudget);for(let i=0;i<pValueSet.length;i+=tmpStride){tmpResult.Boundaries.push({Index:i,Value:pValueSet[i],Label:pValueSet[i]===undefined||pValueSet[i]===null?'':pValueSet[i].toString()});}return tmpResult;}/**
|
|
2269
|
+
* Chart-shaped projection of analyzeSetDensity: a sparse label array of
|
|
2270
|
+
* the SAME LENGTH as the input ('' at non-boundary positions), dropping
|
|
2271
|
+
* directly into a category chart's labels with alignment preserved.
|
|
2272
|
+
*
|
|
2273
|
+
* @param {Array} pValueSet
|
|
2274
|
+
* @param {number} [pMaximumTicks=12]
|
|
2275
|
+
* @return {Array<string>}
|
|
2276
|
+
*/chartTickLabels(pValueSet,pMaximumTicks){if(!Array.isArray(pValueSet)){return pValueSet;}const tmpAnalysis=this.analyzeSetDensity(pValueSet,pMaximumTicks);const tmpLabels=new Array(pValueSet.length).fill('');for(const tmpBoundary of tmpAnalysis.Boundaries){tmpLabels[tmpBoundary.Index]=tmpBoundary.Label;}return tmpLabels;}/**
|
|
2277
|
+
* Collect (join) per-key string values from a set of objects — the
|
|
2278
|
+
* string-valued sibling of histogramAggregationByExactValue. Returns an
|
|
2279
|
+
* insertion-ordered { key: "v1<separator>v2..." } object, so
|
|
2280
|
+
* OBJECTKEYSTOARRAY / OBJECTVALUESTOARRAY produce aligned parallel
|
|
2281
|
+
* arrays. Values join verbatim (no numeric coercion); undefined/null
|
|
2282
|
+
* values are skipped.
|
|
2283
|
+
*
|
|
2284
|
+
* @param {Array} pValueObjectSet
|
|
2285
|
+
* @param {string} pValueAddress - address of the grouping key on each object
|
|
2286
|
+
* @param {string} pValueJoinAddress - address of the value to collect
|
|
2287
|
+
* @param {string} pSeparator - separator placed between collected values
|
|
2288
|
+
* @param {object} pManifest
|
|
2289
|
+
* @return {Object<string, string>}
|
|
2290
|
+
*/histogramAggregationJoinByExactValue(pValueObjectSet,pValueAddress,pValueJoinAddress,pSeparator,pManifest){if(!Array.isArray(pValueObjectSet)){return pValueObjectSet;}if(!pValueAddress||!pValueJoinAddress){return{};}let tmpSeparator=typeof pSeparator==='string'?pSeparator:',';let tmpHistogram={};for(let i=0;i<pValueObjectSet.length;i++){let tmpKey=this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueAddress,pManifest);if(tmpKey===undefined||tmpKey===null){continue;}tmpKey=tmpKey.toString();let tmpValue=this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueJoinAddress,pManifest);if(tmpValue===undefined||tmpValue===null){continue;}tmpHistogram[tmpKey]=tmpKey in tmpHistogram?tmpHistogram[tmpKey]+tmpSeparator+tmpValue.toString():tmpValue.toString();}return tmpHistogram;}histogramAggregationByExactValue(pValueObjectSet,pValueAddress,pValueAmountAddress,pManifest){if(!Array.isArray(pValueObjectSet)){return pValueObjectSet;}if(!pValueAddress||!pValueAmountAddress){return{};}let tmpHistogram={};for(let i=0;i<pValueObjectSet.length;i++){let tmpValue=this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueAddress,pManifest);if(typeof tmpValue===undefined){continue;}let tmpAmount=this.parsePrecise(this.fable.Utility.getValueByHash(pValueObjectSet[i],pValueAmountAddress,pManifest),NaN);if(!(tmpValue in tmpHistogram)){tmpHistogram[tmpValue]=0;}if(!isNaN(tmpAmount)){tmpHistogram[tmpValue]=this.addPrecise(tmpHistogram[tmpValue],tmpAmount);}}return tmpHistogram;}/**
|
|
2228
2291
|
* Aggregates a histogram by exact value from an internal state object.
|
|
2229
2292
|
*
|
|
2230
2293
|
* @param {string} pValueObjectSetAddress - The address of the internal value object set.
|
|
@@ -6134,7 +6197,7 @@ try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.
|
|
|
6134
6197
|
// presumably different callback function.
|
|
6135
6198
|
// This makes sure that own properties are retained, so that
|
|
6136
6199
|
// decorations and such are not lost along the way.
|
|
6137
|
-
module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],191:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],192:[function(require,module,exports){module.exports={"name":"pict","version":"1.0.
|
|
6200
|
+
module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],191:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],192:[function(require,module,exports){module.exports={"name":"pict","version":"1.0.382","description":"Pict browser library.","main":"source/Pict.js","scripts":{"start":"node source/Pict.js","test":"npx quack test","tests":"npx quack test -g","coverage":"npx quack coverage","build":"npx quack build","prepublishOnly":"npx quack build","docker-dev-build":"docker build ./ -f Dockerfile_LUXURYCode -t pict-image:local","docker-dev-run":"docker run -it -d --name pict-dev -p 37447:8080 -p 19506:8086 -v \"$PWD/.config:/home/coder/.config\" -v \"$PWD:/home/coder/pict\" -u \"$(id -u):$(id -g)\" -e \"DOCKER_USER=$USER\" pict-image:local","docker-dev-shell":"docker exec -it pict-dev /bin/bash","lint":"eslint source/**/*.js test/**/*.js","types":"tsc -p ."},"files":["source/","dist/","types/"],"types":"types/source/Pict.d.ts","mocha":{"diff":true,"extension":["js"],"package":"./package.json","reporter":"spec","slow":"75","timeout":"5000","ui":"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},"repository":{"type":"git","url":"git+https://stevenvelozo@github.com/stevenvelozo/pict.git"},"author":"steven velozo <steven@velozo.com>","license":"MIT","bugs":{"url":"https://github.com/fable-retold/pict/issues"},"homepage":"https://github.com/fable-retold/pict#readme","devDependencies":{"@eslint/js":"^9.39.1","@types/jquery":"^3.5.33","@types/sinon":"^17.0.4","eslint":"^9.39.1","globals":"^16.5.0","pict-docuserve":"^1.4.19","quackage":"^1.3.0","sinon":"^20.0.0","typescript":"^5.9.3"},"dependencies":{"cachetrax":"^1.0.6","fable":"^3.1.77","pict-application":"^1.0.34","pict-provider":"^1.0.13","pict-template":"^1.0.15","pict-view":"^1.0.68"}};},{}],193:[function(require,module,exports){// This assumes Pict has been required in the browser. Delcare these as globals so linter can do its job.
|
|
6138
6201
|
/* global Pict, _Pict: writeable *//**
|
|
6139
6202
|
* Simple function to load a pict Application
|
|
6140
6203
|
*
|
|
@@ -8539,8 +8602,10 @@ let tmpDayJS=this.fable.Dates.dayJS.utc(tmpDateValue);return tmpDayJS.format(tmp
|
|
|
8539
8602
|
* @param {any} [pState] - A catchall state object for plumbing data through template processing.
|
|
8540
8603
|
*
|
|
8541
8604
|
* @return {string} The rendered template
|
|
8542
|
-
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpData=typeof pRecord==='object'?pRecord:{};let tmpDateValue=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray,null,pScope,pState);if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDateTimeYMD]::[${tmpHash}] with data:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDateTimeYMD]::[${tmpHash}]`);}//
|
|
8543
|
-
|
|
8605
|
+
*/render(pTemplateHash,pRecord,pContextArray,pScope,pState){let tmpHash=pTemplateHash.trim();let tmpData=typeof pRecord==='object'?pRecord:{};let tmpDateValue=this.resolveStateFromAddress(tmpHash,tmpData,pContextArray,null,pScope,pState);if(this.pict.LogNoisiness>4){this.log.trace(`PICT Template [fDateTimeYMD]::[${tmpHash}] with data:`,tmpData);}else if(this.pict.LogNoisiness>3){this.log.trace(`PICT Template [fDateTimeYMD]::[${tmpHash}]`);}// A missing value must render as empty — dayjs.utc(undefined) is NOW,
|
|
8606
|
+
// which silently writes today's date into absent date fields.
|
|
8607
|
+
if(tmpDateValue===undefined||tmpDateValue===null||tmpDateValue===''){return'';}// Because this is "Date Only", we force the time to be UTC 00:00:00 and go with the date part only.
|
|
8608
|
+
let tmpDayJS=this.fable.Dates.dayJS.utc(tmpDateValue);if(!tmpDayJS.isValid()){return'';}//FIXME: this is kind of wacked out; -62167219200000 is the unix ms timestamp for 0000-01-01 00:00:00 UTC
|
|
8544
8609
|
// not even sure showing negative is right; showing the era is probably better (BCE vs CE)
|
|
8545
8610
|
//const prefix = tmpDayJS.valueOf() < -62167219200000 ? '-' : '';
|
|
8546
8611
|
const tmpPrefix='';return tmpPrefix+tmpDayJS.format('YYYY-MM-DD');}}module.exports=PictTemplateProviderDateOnlyYMD;},{"pict-template":144}],243:[function(require,module,exports){const libPictTemplate=require('pict-template');class PictTemplateProviderDateTimeFormat extends libPictTemplate{/**
|