@trebco/treb 32.6.4 → 32.6.6
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/treb-spreadsheet.mjs +7 -7
- package/package.json +1 -1
- package/treb-base-types/src/value-type.ts +6 -7
- package/treb-calculator/src/functions/base-functions.ts +5 -5
- package/treb-calculator/src/functions/statistics-functions.ts +1 -1
- package/treb-data-model/src/data_model.ts +8 -1
- package/treb-data-model/src/named.ts +5 -2
- package/treb-embed/style/tab-bar.scss +6 -0
package/package.json
CHANGED
|
@@ -166,23 +166,22 @@ export enum ValueType {
|
|
|
166
166
|
// OK we use it all the time now
|
|
167
167
|
object = 5,
|
|
168
168
|
|
|
169
|
+
function = 6, // why was this inserted in the middle?
|
|
170
|
+
|
|
169
171
|
// error is a STRING VALUE... object errors are layered on top? is that
|
|
170
172
|
// correct? (...) it sort of makes sense... since we have separate typing
|
|
171
|
-
error =
|
|
173
|
+
error = 7,
|
|
172
174
|
|
|
173
175
|
// complex is pretty stable by now
|
|
174
|
-
complex =
|
|
176
|
+
complex = 8,
|
|
175
177
|
|
|
176
178
|
// this is new though. this is not a cell value, it's
|
|
177
179
|
// only for union types. perhaps we should move or rename
|
|
178
180
|
// this array, and then cells could have a subset?
|
|
179
|
-
array =
|
|
181
|
+
array = 9,
|
|
180
182
|
|
|
181
183
|
// adding DQ to union
|
|
182
|
-
dimensioned_quantity =
|
|
183
|
-
|
|
184
|
-
// new for lambdas
|
|
185
|
-
function = 10,
|
|
184
|
+
dimensioned_quantity = 10,
|
|
186
185
|
|
|
187
186
|
}
|
|
188
187
|
|
|
@@ -366,9 +366,9 @@ export const BaseFunctionLibrary: FunctionMap = {
|
|
|
366
366
|
|
|
367
367
|
if (integer) {
|
|
368
368
|
const range = max - min + 1;
|
|
369
|
-
for (let i = 0; i <
|
|
369
|
+
for (let i = 0; i < columns; i++) {
|
|
370
370
|
const row: UnionValue[] = [];
|
|
371
|
-
for (let j = 0; j <
|
|
371
|
+
for (let j = 0; j < rows; j++) {
|
|
372
372
|
row.push({
|
|
373
373
|
type: ValueType.number,
|
|
374
374
|
value: Math.floor(Math.random() * range + min),
|
|
@@ -380,9 +380,9 @@ export const BaseFunctionLibrary: FunctionMap = {
|
|
|
380
380
|
else {
|
|
381
381
|
const range = max - min;
|
|
382
382
|
|
|
383
|
-
for (let i = 0; i <
|
|
383
|
+
for (let i = 0; i < columns; i++) {
|
|
384
384
|
const row: UnionValue[] = [];
|
|
385
|
-
for (let j = 0; j <
|
|
385
|
+
for (let j = 0; j < rows; j++) {
|
|
386
386
|
row.push({
|
|
387
387
|
type: ValueType.number,
|
|
388
388
|
value: Math.random() * range + min,
|
|
@@ -391,7 +391,7 @@ export const BaseFunctionLibrary: FunctionMap = {
|
|
|
391
391
|
value.push(row);
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
|
|
394
|
+
|
|
395
395
|
return {
|
|
396
396
|
type: ValueType.array,
|
|
397
397
|
value,
|
|
@@ -486,7 +486,7 @@ export const StatisticsFunctionLibrary: FunctionMap = {
|
|
|
486
486
|
'Norm.S.Inv': {
|
|
487
487
|
description: 'Inverse of the standard normal cumulative distribution',
|
|
488
488
|
arguments: [
|
|
489
|
-
{name: 'probability'},
|
|
489
|
+
{name: 'probability', unroll: true },
|
|
490
490
|
],
|
|
491
491
|
xlfn: true,
|
|
492
492
|
fn: (q: number): UnionValue => {
|
|
@@ -105,7 +105,14 @@ export class DataModel {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
const sheet = this.sheets.ID(sheet_name);
|
|
108
|
-
|
|
108
|
+
|
|
109
|
+
// Q: why require scope in this case? if there _is_ a global name,
|
|
110
|
+
// and no scoped name, why not return that? that seems to be the
|
|
111
|
+
// behavior in excel, although I can't be sure
|
|
112
|
+
|
|
113
|
+
// test: default false
|
|
114
|
+
|
|
115
|
+
return this.named.Get_(parts[1], sheet || 0, false); // true); // require scope in this case
|
|
109
116
|
|
|
110
117
|
|
|
111
118
|
}
|
|
@@ -201,14 +201,17 @@ export class NamedRangeManager {
|
|
|
201
201
|
* that implies that if there are both, we'll prefer the scoped name.
|
|
202
202
|
*
|
|
203
203
|
* now possible to require scope, for qualified scoped names
|
|
204
|
+
*
|
|
205
|
+
* Q: why require scope? what's the benefit of that? (...)
|
|
206
|
+
*
|
|
204
207
|
*/
|
|
205
208
|
public Get_(name: string, scope: number, require_scope = false) {
|
|
206
|
-
|
|
209
|
+
|
|
207
210
|
if (require_scope) {
|
|
208
211
|
return this.named.get(this.ScopedName(name, scope));
|
|
209
212
|
}
|
|
210
213
|
|
|
211
|
-
return this.named.get(this.ScopedName(name, scope))
|
|
214
|
+
return this.named.get(this.ScopedName(name, scope)) ?? this.named.get(name.toLowerCase());
|
|
212
215
|
}
|
|
213
216
|
|
|
214
217
|
/**
|