@trebco/treb 32.7.0 → 32.8.1
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-export-worker.mjs +2 -2
- package/dist/treb-spreadsheet.mjs +8 -8
- package/dist/treb.d.ts +1 -1
- package/package.json +1 -1
- package/treb-calculator/src/calculator.ts +22 -3
- package/treb-calculator/src/functions/base-functions.ts +20 -0
- package/treb-embed/src/embedded-spreadsheet.ts +5 -0
- package/treb-embed/style/grid.scss +5 -0
- package/treb-grid/src/types/grid.ts +4 -0
- package/treb-grid/src/util/ua.ts +7 -3
package/dist/treb.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -273,13 +273,32 @@ export class Calculator extends Graph {
|
|
|
273
273
|
* this is a function that does sumif/averageif/countif.
|
|
274
274
|
* args is one or more sets of [criteria_range, criteria]
|
|
275
275
|
*/
|
|
276
|
-
const XIf = (type: 'sum'|'count'|'average', value_range: CellValue[][], ...args: unknown[]): UnionValue => {
|
|
276
|
+
const XIf = (type: 'sum'|'count'|'average', value_range: CellValue[][]|CellValue, ...args: unknown[]): UnionValue => {
|
|
277
|
+
|
|
278
|
+
// there's a bug here if the value range is a single value?
|
|
279
|
+
// that happens if countif passes in a one-cell range... we should
|
|
280
|
+
// handle this in the caller, or here?
|
|
281
|
+
|
|
282
|
+
// NOTE we also have to address this in the set of
|
|
283
|
+
// arguments, in which each pair could have a single
|
|
284
|
+
// value as the criterion
|
|
285
|
+
|
|
286
|
+
if (!Array.isArray(value_range)) {
|
|
287
|
+
value_range = [[value_range]];
|
|
288
|
+
}
|
|
277
289
|
|
|
278
290
|
const filter: boolean[] = [];
|
|
279
291
|
|
|
280
292
|
for (let i = 0; i < args.length; i += 2) {
|
|
281
|
-
|
|
282
|
-
|
|
293
|
+
|
|
294
|
+
let criteria_range = args[i] as (CellValue|CellValue[][]);
|
|
295
|
+
if (!Array.isArray(criteria_range)) {
|
|
296
|
+
criteria_range = [[criteria_range]];
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
{ // if (Array.isArray(args[i])) {
|
|
300
|
+
|
|
301
|
+
const step = CountIfInternal(criteria_range, args[i+1] as CellValue);
|
|
283
302
|
if (step.type !== ValueType.array) {
|
|
284
303
|
return step;
|
|
285
304
|
}
|
|
@@ -959,6 +959,26 @@ export const BaseFunctionLibrary: FunctionMap = {
|
|
|
959
959
|
},
|
|
960
960
|
},
|
|
961
961
|
|
|
962
|
+
Factdouble: {
|
|
963
|
+
description: 'Returns the double factorial of a number',
|
|
964
|
+
arguments: [
|
|
965
|
+
{ name: 'number', unroll: true },
|
|
966
|
+
],
|
|
967
|
+
fn: (number: number): UnionValue => {
|
|
968
|
+
number = Math.round(number);
|
|
969
|
+
|
|
970
|
+
let value = 1;
|
|
971
|
+
while (number > 1) {
|
|
972
|
+
value *= number;
|
|
973
|
+
number -= 2;
|
|
974
|
+
}
|
|
975
|
+
return {
|
|
976
|
+
type: ValueType.number,
|
|
977
|
+
value,
|
|
978
|
+
}
|
|
979
|
+
},
|
|
980
|
+
},
|
|
981
|
+
|
|
962
982
|
Power: {
|
|
963
983
|
description: 'Returns base raised to the given power',
|
|
964
984
|
arguments: [
|
|
@@ -894,6 +894,11 @@ export class EmbeddedSpreadsheet<USER_DATA_TYPE = unknown> {
|
|
|
894
894
|
else if (UA.is_mac) {
|
|
895
895
|
container.parentElement?.classList.add('treb-ua-osx');
|
|
896
896
|
}
|
|
897
|
+
|
|
898
|
+
if (UA.is_iphone) {
|
|
899
|
+
container.parentElement?.classList.add('treb-ua-iphone');
|
|
900
|
+
}
|
|
901
|
+
|
|
897
902
|
}
|
|
898
903
|
|
|
899
904
|
// container is "treb-views", which contains individual "treb-view"
|
|
@@ -43,6 +43,9 @@
|
|
|
43
43
|
position: absolute;
|
|
44
44
|
pointer-events: none;
|
|
45
45
|
|
|
46
|
+
// patch for ios safari bug
|
|
47
|
+
transform: translateZ(0);
|
|
48
|
+
|
|
46
49
|
rect {
|
|
47
50
|
stroke: var(--treb-spill-border-color, rgb(92, 92, 224));
|
|
48
51
|
stroke-dasharray: var(--treb-spill-border-dasharray, 0);
|
|
@@ -311,6 +314,7 @@
|
|
|
311
314
|
background: transparent;
|
|
312
315
|
position: absolute;
|
|
313
316
|
z-index: $z-index-grid-selection;
|
|
317
|
+
transform: translateZ(0); // patch for ios safari bug
|
|
314
318
|
-moz-transform: scale(1); // firefox anti-blur
|
|
315
319
|
}
|
|
316
320
|
|
|
@@ -323,6 +327,7 @@
|
|
|
323
327
|
position: absolute;
|
|
324
328
|
z-index: $z-index-frozen-selection;
|
|
325
329
|
overflow: hidden; // needed for IE11 (put in legacy?)
|
|
330
|
+
transform: translateZ(0); // patch for ios safari bug
|
|
326
331
|
-moz-transform: scale(1); // firefox anti-blur
|
|
327
332
|
pointer-events: none;
|
|
328
333
|
|
|
@@ -7889,6 +7889,10 @@ export class Grid extends GridBase {
|
|
|
7889
7889
|
*/
|
|
7890
7890
|
protected ResizeColumnsInternal(command: ResizeColumnsCommand) {
|
|
7891
7891
|
|
|
7892
|
+
if (this.headless) {
|
|
7893
|
+
return super.ResizeColumnsInternal(command);
|
|
7894
|
+
}
|
|
7895
|
+
|
|
7892
7896
|
const sheet = command.sheet_id ? this.FindSheet(command.sheet_id) : this.active_sheet;
|
|
7893
7897
|
|
|
7894
7898
|
// normalize
|
package/treb-grid/src/util/ua.ts
CHANGED
|
@@ -39,6 +39,9 @@ class UAType {
|
|
|
39
39
|
/** more testing. ios safari doesn't support grid+sticky (apparently) */
|
|
40
40
|
public readonly is_ipad = /iPad|iPhone/.test(user_agent);
|
|
41
41
|
|
|
42
|
+
/** for iphone so we can change font size to prevent auto-zoom */
|
|
43
|
+
public readonly is_iphone = /iPhone/.test(user_agent);
|
|
44
|
+
|
|
42
45
|
/** more testing. firefox android doesn't support grid+sticky (apparently) */
|
|
43
46
|
public readonly is_android = /android|samsung/i.test(user_agent);
|
|
44
47
|
|
|
@@ -84,19 +87,20 @@ class UAType {
|
|
|
84
87
|
/webkit|firefox/i.test(user_agent);
|
|
85
88
|
}
|
|
86
89
|
|
|
87
|
-
const null_ua = {
|
|
90
|
+
const null_ua: UAType = {
|
|
88
91
|
|
|
89
92
|
is_edge: false,
|
|
90
93
|
is_ipad: false,
|
|
94
|
+
is_iphone: false,
|
|
91
95
|
is_android: false,
|
|
92
96
|
is_firefox: false,
|
|
93
97
|
is_safari: false,
|
|
94
98
|
is_mac: false,
|
|
95
99
|
is_chrome: false,
|
|
96
|
-
trident: false,
|
|
100
|
+
// trident: false,
|
|
97
101
|
is_windows: false,
|
|
98
102
|
is_modern: true,
|
|
99
|
-
is_node: true,
|
|
103
|
+
// is_node: true,
|
|
100
104
|
is_mobile: false,
|
|
101
105
|
|
|
102
106
|
};
|