@gridsheet/react-core 0.12.3 → 0.12.4-alpha.0

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.
Files changed (307) hide show
  1. package/dist/components/Cell.d.ts.map +1 -1
  2. package/dist/components/Emitter.d.ts.map +1 -1
  3. package/dist/components/GridSheet.d.ts.map +1 -1
  4. package/dist/components/HeaderLeftCell.d.ts.map +1 -1
  5. package/dist/components/HeaderTopCell.d.ts.map +1 -1
  6. package/dist/components/Resizer.d.ts.map +1 -1
  7. package/dist/components/SearchBox.d.ts.map +1 -1
  8. package/dist/components/Tabular.d.ts.map +1 -1
  9. package/dist/constants.d.ts.map +1 -1
  10. package/dist/formula/evaluator.d.ts.map +1 -1
  11. package/dist/formula/functions/__base.d.ts.map +1 -1
  12. package/dist/formula/solver.d.ts.map +1 -1
  13. package/dist/index.d.ts +1824 -1
  14. package/dist/index.js +5205 -11
  15. package/dist/lib/structs.d.ts.map +1 -1
  16. package/dist/lib/table.d.ts.map +1 -1
  17. package/dist/lib/time.d.ts.map +1 -1
  18. package/dist/lib/virtualization.d.ts.map +1 -1
  19. package/dist/parsers/core.d.ts.map +1 -1
  20. package/dist/renderers/core.d.ts.map +1 -1
  21. package/dist/store/actions.d.ts.map +1 -1
  22. package/dist/store/index.d.ts.map +1 -1
  23. package/dist/types.d.ts.map +1 -1
  24. package/package.json +13 -3
  25. package/dist/components/Cell.d.ts +0 -8
  26. package/dist/components/Cell.js +0 -199
  27. package/dist/components/Cell.js.map +0 -1
  28. package/dist/components/ContextMenu.d.ts +0 -3
  29. package/dist/components/ContextMenu.js +0 -207
  30. package/dist/components/ContextMenu.js.map +0 -1
  31. package/dist/components/Editor.d.ts +0 -3
  32. package/dist/components/Editor.js +0 -304
  33. package/dist/components/Editor.js.map +0 -1
  34. package/dist/components/Emitter.d.ts +0 -9
  35. package/dist/components/Emitter.js +0 -26
  36. package/dist/components/Emitter.js.map +0 -1
  37. package/dist/components/GridSheet.d.ts +0 -4
  38. package/dist/components/GridSheet.js +0 -110
  39. package/dist/components/GridSheet.js.map +0 -1
  40. package/dist/components/HeaderLeftCell.d.ts +0 -7
  41. package/dist/components/HeaderLeftCell.js +0 -67
  42. package/dist/components/HeaderLeftCell.js.map +0 -1
  43. package/dist/components/HeaderTopCell.d.ts +0 -7
  44. package/dist/components/HeaderTopCell.js +0 -68
  45. package/dist/components/HeaderTopCell.js.map +0 -1
  46. package/dist/components/Resizer.d.ts +0 -3
  47. package/dist/components/Resizer.js +0 -83
  48. package/dist/components/Resizer.js.map +0 -1
  49. package/dist/components/SearchBox.d.ts +0 -3
  50. package/dist/components/SearchBox.js +0 -52
  51. package/dist/components/SearchBox.js.map +0 -1
  52. package/dist/components/StoreInitializer.d.ts +0 -4
  53. package/dist/components/StoreInitializer.js +0 -68
  54. package/dist/components/StoreInitializer.js.map +0 -1
  55. package/dist/components/Tabular.d.ts +0 -9
  56. package/dist/components/Tabular.js +0 -84
  57. package/dist/components/Tabular.js.map +0 -1
  58. package/dist/constants.d.ts +0 -18
  59. package/dist/constants.js +0 -21
  60. package/dist/constants.js.map +0 -1
  61. package/dist/formula/evaluator.d.ts +0 -91
  62. package/dist/formula/evaluator.js +0 -541
  63. package/dist/formula/evaluator.js.map +0 -1
  64. package/dist/formula/functions/__base.d.ts +0 -23
  65. package/dist/formula/functions/__base.js +0 -16
  66. package/dist/formula/functions/__base.js.map +0 -1
  67. package/dist/formula/functions/__utils.d.ts +0 -6
  68. package/dist/formula/functions/__utils.js +0 -102
  69. package/dist/formula/functions/__utils.js.map +0 -1
  70. package/dist/formula/functions/abs.d.ts +0 -12
  71. package/dist/formula/functions/abs.js +0 -21
  72. package/dist/formula/functions/abs.js.map +0 -1
  73. package/dist/formula/functions/abs.spec.d.ts +0 -2
  74. package/dist/formula/functions/abs.spec.js +0 -29
  75. package/dist/formula/functions/abs.spec.js.map +0 -1
  76. package/dist/formula/functions/acos.d.ts +0 -12
  77. package/dist/formula/functions/acos.js +0 -29
  78. package/dist/formula/functions/acos.js.map +0 -1
  79. package/dist/formula/functions/add.d.ts +0 -13
  80. package/dist/formula/functions/add.js +0 -50
  81. package/dist/formula/functions/add.js.map +0 -1
  82. package/dist/formula/functions/and.d.ts +0 -19
  83. package/dist/formula/functions/and.js +0 -28
  84. package/dist/formula/functions/and.js.map +0 -1
  85. package/dist/formula/functions/asin.d.ts +0 -12
  86. package/dist/formula/functions/asin.js +0 -29
  87. package/dist/formula/functions/asin.js.map +0 -1
  88. package/dist/formula/functions/atan.d.ts +0 -12
  89. package/dist/formula/functions/atan.js +0 -26
  90. package/dist/formula/functions/atan.js.map +0 -1
  91. package/dist/formula/functions/atan2.d.ts +0 -12
  92. package/dist/formula/functions/atan2.js +0 -32
  93. package/dist/formula/functions/atan2.js.map +0 -1
  94. package/dist/formula/functions/average.d.ts +0 -19
  95. package/dist/formula/functions/average.js +0 -41
  96. package/dist/formula/functions/average.js.map +0 -1
  97. package/dist/formula/functions/col.d.ts +0 -14
  98. package/dist/formula/functions/col.js +0 -30
  99. package/dist/formula/functions/col.js.map +0 -1
  100. package/dist/formula/functions/concat.d.ts +0 -12
  101. package/dist/formula/functions/concat.js +0 -27
  102. package/dist/formula/functions/concat.js.map +0 -1
  103. package/dist/formula/functions/concatenate.d.ts +0 -19
  104. package/dist/formula/functions/concatenate.js +0 -25
  105. package/dist/formula/functions/concatenate.js.map +0 -1
  106. package/dist/formula/functions/cos.d.ts +0 -12
  107. package/dist/formula/functions/cos.js +0 -26
  108. package/dist/formula/functions/cos.js.map +0 -1
  109. package/dist/formula/functions/count.d.ts +0 -19
  110. package/dist/formula/functions/count.js +0 -35
  111. package/dist/formula/functions/count.js.map +0 -1
  112. package/dist/formula/functions/counta.d.ts +0 -19
  113. package/dist/formula/functions/counta.js +0 -35
  114. package/dist/formula/functions/counta.js.map +0 -1
  115. package/dist/formula/functions/countif.d.ts +0 -13
  116. package/dist/formula/functions/countif.js +0 -30
  117. package/dist/formula/functions/countif.js.map +0 -1
  118. package/dist/formula/functions/divide.d.ts +0 -12
  119. package/dist/formula/functions/divide.js +0 -33
  120. package/dist/formula/functions/divide.js.map +0 -1
  121. package/dist/formula/functions/eq.d.ts +0 -12
  122. package/dist/formula/functions/eq.js +0 -25
  123. package/dist/formula/functions/eq.js.map +0 -1
  124. package/dist/formula/functions/exp.d.ts +0 -12
  125. package/dist/formula/functions/exp.js +0 -28
  126. package/dist/formula/functions/exp.js.map +0 -1
  127. package/dist/formula/functions/gt.d.ts +0 -12
  128. package/dist/formula/functions/gt.js +0 -27
  129. package/dist/formula/functions/gt.js.map +0 -1
  130. package/dist/formula/functions/gte.d.ts +0 -12
  131. package/dist/formula/functions/gte.js +0 -27
  132. package/dist/formula/functions/gte.js.map +0 -1
  133. package/dist/formula/functions/hlookup.d.ts +0 -18
  134. package/dist/formula/functions/hlookup.js +0 -74
  135. package/dist/formula/functions/hlookup.js.map +0 -1
  136. package/dist/formula/functions/if.d.ts +0 -17
  137. package/dist/formula/functions/if.js +0 -36
  138. package/dist/formula/functions/if.js.map +0 -1
  139. package/dist/formula/functions/iferror.d.ts +0 -20
  140. package/dist/formula/functions/iferror.js +0 -41
  141. package/dist/formula/functions/iferror.js.map +0 -1
  142. package/dist/formula/functions/iferror.spec.d.ts +0 -2
  143. package/dist/formula/functions/iferror.spec.js +0 -61
  144. package/dist/formula/functions/iferror.spec.js.map +0 -1
  145. package/dist/formula/functions/len.d.ts +0 -12
  146. package/dist/formula/functions/len.js +0 -26
  147. package/dist/formula/functions/len.js.map +0 -1
  148. package/dist/formula/functions/lenb.d.ts +0 -12
  149. package/dist/formula/functions/lenb.js +0 -26
  150. package/dist/formula/functions/lenb.js.map +0 -1
  151. package/dist/formula/functions/ln.d.ts +0 -12
  152. package/dist/formula/functions/ln.js +0 -29
  153. package/dist/formula/functions/ln.js.map +0 -1
  154. package/dist/formula/functions/log.d.ts +0 -12
  155. package/dist/formula/functions/log.js +0 -35
  156. package/dist/formula/functions/log.js.map +0 -1
  157. package/dist/formula/functions/log10.d.ts +0 -12
  158. package/dist/formula/functions/log10.js +0 -29
  159. package/dist/formula/functions/log10.js.map +0 -1
  160. package/dist/formula/functions/lt.d.ts +0 -12
  161. package/dist/formula/functions/lt.js +0 -27
  162. package/dist/formula/functions/lt.js.map +0 -1
  163. package/dist/formula/functions/lte.d.ts +0 -12
  164. package/dist/formula/functions/lte.js +0 -27
  165. package/dist/formula/functions/lte.js.map +0 -1
  166. package/dist/formula/functions/max.d.ts +0 -19
  167. package/dist/formula/functions/max.js +0 -44
  168. package/dist/formula/functions/max.js.map +0 -1
  169. package/dist/formula/functions/min.d.ts +0 -19
  170. package/dist/formula/functions/min.js +0 -44
  171. package/dist/formula/functions/min.js.map +0 -1
  172. package/dist/formula/functions/minus.d.ts +0 -13
  173. package/dist/formula/functions/minus.js +0 -50
  174. package/dist/formula/functions/minus.js.map +0 -1
  175. package/dist/formula/functions/mod.d.ts +0 -12
  176. package/dist/formula/functions/mod.js +0 -31
  177. package/dist/formula/functions/mod.js.map +0 -1
  178. package/dist/formula/functions/mod.spec.d.ts +0 -2
  179. package/dist/formula/functions/mod.spec.js +0 -52
  180. package/dist/formula/functions/mod.spec.js.map +0 -1
  181. package/dist/formula/functions/multiply.d.ts +0 -12
  182. package/dist/formula/functions/multiply.js +0 -27
  183. package/dist/formula/functions/multiply.js.map +0 -1
  184. package/dist/formula/functions/ne.d.ts +0 -12
  185. package/dist/formula/functions/ne.js +0 -25
  186. package/dist/formula/functions/ne.js.map +0 -1
  187. package/dist/formula/functions/not.d.ts +0 -12
  188. package/dist/formula/functions/not.js +0 -30
  189. package/dist/formula/functions/not.js.map +0 -1
  190. package/dist/formula/functions/now.d.ts +0 -9
  191. package/dist/formula/functions/now.js +0 -21
  192. package/dist/formula/functions/now.js.map +0 -1
  193. package/dist/formula/functions/or.d.ts +0 -19
  194. package/dist/formula/functions/or.js +0 -28
  195. package/dist/formula/functions/or.js.map +0 -1
  196. package/dist/formula/functions/pi.d.ts +0 -9
  197. package/dist/formula/functions/pi.js +0 -19
  198. package/dist/formula/functions/pi.js.map +0 -1
  199. package/dist/formula/functions/power.d.ts +0 -12
  200. package/dist/formula/functions/power.js +0 -24
  201. package/dist/formula/functions/power.js.map +0 -1
  202. package/dist/formula/functions/product.d.ts +0 -19
  203. package/dist/formula/functions/product.js +0 -37
  204. package/dist/formula/functions/product.js.map +0 -1
  205. package/dist/formula/functions/radians.d.ts +0 -12
  206. package/dist/formula/functions/radians.js +0 -26
  207. package/dist/formula/functions/radians.js.map +0 -1
  208. package/dist/formula/functions/rand.d.ts +0 -9
  209. package/dist/formula/functions/rand.js +0 -19
  210. package/dist/formula/functions/rand.js.map +0 -1
  211. package/dist/formula/functions/round.d.ts +0 -17
  212. package/dist/formula/functions/round.js +0 -34
  213. package/dist/formula/functions/round.js.map +0 -1
  214. package/dist/formula/functions/rounddown.d.ts +0 -17
  215. package/dist/formula/functions/rounddown.js +0 -34
  216. package/dist/formula/functions/rounddown.js.map +0 -1
  217. package/dist/formula/functions/roundup.d.ts +0 -17
  218. package/dist/formula/functions/roundup.js +0 -34
  219. package/dist/formula/functions/roundup.js.map +0 -1
  220. package/dist/formula/functions/row.d.ts +0 -14
  221. package/dist/formula/functions/row.js +0 -30
  222. package/dist/formula/functions/row.js.map +0 -1
  223. package/dist/formula/functions/sin.d.ts +0 -12
  224. package/dist/formula/functions/sin.js +0 -26
  225. package/dist/formula/functions/sin.js.map +0 -1
  226. package/dist/formula/functions/sqrt.d.ts +0 -12
  227. package/dist/formula/functions/sqrt.js +0 -29
  228. package/dist/formula/functions/sqrt.js.map +0 -1
  229. package/dist/formula/functions/sum.d.ts +0 -19
  230. package/dist/formula/functions/sum.js +0 -44
  231. package/dist/formula/functions/sum.js.map +0 -1
  232. package/dist/formula/functions/sum.spec.d.ts +0 -2
  233. package/dist/formula/functions/sum.spec.js +0 -40
  234. package/dist/formula/functions/sum.spec.js.map +0 -1
  235. package/dist/formula/functions/sumif.d.ts +0 -18
  236. package/dist/formula/functions/sumif.js +0 -59
  237. package/dist/formula/functions/sumif.js.map +0 -1
  238. package/dist/formula/functions/tan.d.ts +0 -12
  239. package/dist/formula/functions/tan.js +0 -26
  240. package/dist/formula/functions/tan.js.map +0 -1
  241. package/dist/formula/functions/uminus.d.ts +0 -12
  242. package/dist/formula/functions/uminus.js +0 -23
  243. package/dist/formula/functions/uminus.js.map +0 -1
  244. package/dist/formula/functions/vlookup.d.ts +0 -18
  245. package/dist/formula/functions/vlookup.js +0 -74
  246. package/dist/formula/functions/vlookup.js.map +0 -1
  247. package/dist/formula/mapping.d.ts +0 -114
  248. package/dist/formula/mapping.js +0 -114
  249. package/dist/formula/mapping.js.map +0 -1
  250. package/dist/formula/solver.d.ts +0 -12
  251. package/dist/formula/solver.js +0 -64
  252. package/dist/formula/solver.js.map +0 -1
  253. package/dist/index.js.map +0 -1
  254. package/dist/lib/autofill.d.ts +0 -17
  255. package/dist/lib/autofill.js +0 -389
  256. package/dist/lib/autofill.js.map +0 -1
  257. package/dist/lib/clipboard.d.ts +0 -3
  258. package/dist/lib/clipboard.js +0 -45
  259. package/dist/lib/clipboard.js.map +0 -1
  260. package/dist/lib/converters.d.ts +0 -10
  261. package/dist/lib/converters.js +0 -127
  262. package/dist/lib/converters.js.map +0 -1
  263. package/dist/lib/structs.d.ts +0 -60
  264. package/dist/lib/structs.js +0 -251
  265. package/dist/lib/structs.js.map +0 -1
  266. package/dist/lib/table.d.ts +0 -299
  267. package/dist/lib/table.js +0 -989
  268. package/dist/lib/table.js.map +0 -1
  269. package/dist/lib/time.d.ts +0 -14
  270. package/dist/lib/time.js +0 -60
  271. package/dist/lib/time.js.map +0 -1
  272. package/dist/lib/virtualization.d.ts +0 -30
  273. package/dist/lib/virtualization.js +0 -114
  274. package/dist/lib/virtualization.js.map +0 -1
  275. package/dist/parsers/core.d.ts +0 -36
  276. package/dist/parsers/core.js +0 -123
  277. package/dist/parsers/core.js.map +0 -1
  278. package/dist/renderers/checkbox.d.ts +0 -5
  279. package/dist/renderers/checkbox.js +0 -10
  280. package/dist/renderers/checkbox.js.map +0 -1
  281. package/dist/renderers/core.d.ts +0 -48
  282. package/dist/renderers/core.js +0 -143
  283. package/dist/renderers/core.js.map +0 -1
  284. package/dist/renderers/thousand_separator.d.ts +0 -5
  285. package/dist/renderers/thousand_separator.js +0 -14
  286. package/dist/renderers/thousand_separator.js.map +0 -1
  287. package/dist/store/actions.d.ts +0 -198
  288. package/dist/store/actions.js +0 -519
  289. package/dist/store/actions.js.map +0 -1
  290. package/dist/store/helpers.d.ts +0 -28
  291. package/dist/store/helpers.js +0 -78
  292. package/dist/store/helpers.js.map +0 -1
  293. package/dist/store/index.d.ts +0 -11
  294. package/dist/store/index.js +0 -3
  295. package/dist/store/index.js.map +0 -1
  296. package/dist/styles/embedder.d.ts +0 -2
  297. package/dist/styles/embedder.js +0 -16
  298. package/dist/styles/embedder.js.map +0 -1
  299. package/dist/styles/minified.d.ts +0 -3
  300. package/dist/styles/minified.js +0 -4
  301. package/dist/styles/minified.js.map +0 -1
  302. package/dist/types.d.ts +0 -213
  303. package/dist/types.js +0 -2
  304. package/dist/types.js.map +0 -1
  305. package/dist/utils.d.ts +0 -2
  306. package/dist/utils.js +0 -7
  307. package/dist/utils.js.map +0 -1
@@ -1,60 +0,0 @@
1
- import { MatrixType, AreaType, ZoneType, RangeType, PointType, Y, X, CellsByAddressType, ShapeType, MatricesByAddress, CellType } from "../types";
2
- export declare const slideArea: (area: AreaType, y: Y, x: X) => AreaType;
3
- export declare const superposeArea: (srcArea: AreaType, dstArea: AreaType) => ShapeType;
4
- export declare const concatAreas: (area1: AreaType, area2: AreaType) => AreaType;
5
- export declare const zoneToArea: (zone: ZoneType) => AreaType;
6
- export declare const areaToZone: (area: AreaType) => ZoneType;
7
- export declare const areaToRange: (area: AreaType) => string;
8
- export declare const rangeToArea: (range: string) => AreaType;
9
- export declare const between: (range: RangeType, index: number) => boolean;
10
- export declare const among: (area: AreaType, point: PointType) => boolean;
11
- declare type ShapeExtension = {
12
- base?: number;
13
- };
14
- export declare const zoneShape: ({ base, ...zone }: ZoneType & ShapeExtension) => ShapeType;
15
- export declare const areaShape: ({ base, ...area }: AreaType & ShapeExtension) => ShapeType;
16
- export declare const matrixShape: ({ base, matrix, }: {
17
- matrix: MatrixType<any>;
18
- } & ShapeExtension) => ShapeType;
19
- export declare const makeSequence: (start: number, stop: number, step?: number) => number[];
20
- export declare const oa2aa: (oa: {
21
- [s: string]: any;
22
- }[], fields: string[]) => MatrixType<any>;
23
- export declare const aa2oa: (aa: MatrixType<any>, fields: string[]) => {
24
- [s: string]: any;
25
- };
26
- export declare const putMatrix: <T = any>(dst: T[][], src: T[][], dstArea: AreaType) => MatricesByAddress<T>;
27
- export declare const createMatrix: <T = any>(numRows: number, numCols: number, fill?: T | undefined) => T[][];
28
- export declare const cropMatrix: <T = any>(matrix: T[][], area: AreaType) => T[][];
29
- export declare const generateInitialSimple: <T>({ cells, ensured, matrix, flattenAs, }: {
30
- cells?: CellsByAddressType | undefined;
31
- ensured?: {
32
- numRows?: number | undefined;
33
- numCols?: number | undefined;
34
- } | undefined;
35
- flattenAs?: keyof CellType<any> | undefined;
36
- matrix?: MatrixType<any> | undefined;
37
- }) => CellsByAddressType;
38
- export declare const generateInitial: ({ cells, ensured, matrices, flattenAs, }?: {
39
- cells?: CellsByAddressType | undefined;
40
- ensured?: {
41
- numRows?: number | undefined;
42
- numCols?: number | undefined;
43
- } | undefined;
44
- flattenAs?: keyof CellType<any> | undefined;
45
- matrices?: MatricesByAddress<any> | undefined;
46
- }) => CellsByAddressType;
47
- export declare const upsert: <T>({ cells, matrices, flattenAs, }: {
48
- cells?: CellsByAddressType | undefined;
49
- flattenAs?: keyof CellType<any> | undefined;
50
- matrices?: MatricesByAddress<T> | undefined;
51
- }) => CellsByAddressType;
52
- export declare const getMaxSizesFromCells: (cells?: CellsByAddressType) => {
53
- numRows: number;
54
- numCols: number;
55
- };
56
- export declare const range: (start: number, end: number) => number[];
57
- export declare const complementSelectingArea: (selectingArea: AreaType, choosing: PointType) => AreaType;
58
- export declare const isSameArea: (area1: AreaType, area2: AreaType) => boolean;
59
- export {};
60
- //# sourceMappingURL=structs.d.ts.map
@@ -1,251 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { a2p, p2a } from "./converters";
13
- export const slideArea = (area, y, x) => {
14
- const { top, left, bottom, right } = area;
15
- return { top: top + y, left: left + x, bottom: bottom + y, right: right + x };
16
- };
17
- export const superposeArea = (srcArea, dstArea) => {
18
- const { height: srcHeight, width: srcWidth } = areaShape(srcArea);
19
- const { height: dstHeight, width: dstWidth } = areaShape(dstArea);
20
- // biggerHeight, biggerWidth
21
- return {
22
- height: srcHeight > dstHeight ? srcHeight : dstHeight,
23
- width: srcWidth > dstWidth ? srcWidth : dstWidth,
24
- };
25
- };
26
- export const concatAreas = (area1, area2) => {
27
- const result = Object.assign({}, area1);
28
- if (area2.left < area1.left) {
29
- result.left = area2.left;
30
- }
31
- if (area2.right > area1.right) {
32
- result.right = area2.right;
33
- }
34
- if (area2.top < area1.top) {
35
- result.top = area2.top;
36
- }
37
- if (area2.bottom > area1.bottom) {
38
- result.bottom = area2.bottom;
39
- }
40
- return result;
41
- };
42
- export const zoneToArea = (zone) => {
43
- const [top, bottom] = zone.startY < zone.endY
44
- ? [zone.startY, zone.endY]
45
- : [zone.endY, zone.startY];
46
- const [left, right] = zone.startX < zone.endX
47
- ? [zone.startX, zone.endX]
48
- : [zone.endX, zone.startX];
49
- return { top, left, bottom, right };
50
- };
51
- export const areaToZone = (area) => {
52
- return {
53
- startY: area.top,
54
- startX: area.left,
55
- endY: area.bottom,
56
- endX: area.right,
57
- };
58
- };
59
- export const areaToRange = (area) => {
60
- const { top, left, bottom, right } = area;
61
- return `${p2a({ y: top, x: left })}${p2a({
62
- y: bottom,
63
- x: right,
64
- })}`;
65
- };
66
- export const rangeToArea = (range) => {
67
- const cells = range.split(":");
68
- const [start, end] = cells;
69
- const { y: top, x: left } = a2p(start);
70
- const { y: bottom, x: right } = a2p(end);
71
- return { top, left, bottom, right };
72
- };
73
- export const between = (range, index) => {
74
- if (range.start === -1 || range.end === -1) {
75
- return false;
76
- }
77
- return ((range.start <= index && index <= range.end) ||
78
- (range.end <= index && index <= range.start));
79
- };
80
- export const among = (area, point) => {
81
- if (area.top === -1 ||
82
- area.left === -1 ||
83
- area.bottom === -1 ||
84
- area.right === -1) {
85
- return false;
86
- }
87
- const { y, x } = point;
88
- const { top, left, bottom, right } = area;
89
- return top <= y && y <= bottom && left <= x && x <= right;
90
- };
91
- export const zoneShape = (_a) => {
92
- var { base = 0 } = _a, zone = __rest(_a, ["base"]);
93
- return {
94
- height: base + Math.abs(zone.startY - zone.endY),
95
- width: base + Math.abs(zone.startX - zone.endX),
96
- };
97
- };
98
- export const areaShape = (_a) => {
99
- var { base = 0 } = _a, area = __rest(_a, ["base"]);
100
- return {
101
- height: base + Math.abs(area.top - area.bottom),
102
- width: base + Math.abs(area.left - area.right),
103
- };
104
- };
105
- export const matrixShape = ({ base = 0, matrix, }) => {
106
- const h = matrix.length;
107
- if (h === 0) {
108
- return { height: 0, width: 0 };
109
- }
110
- return { height: base + h, width: base + matrix[0].length };
111
- };
112
- export const makeSequence = (start, stop, step = 1) => {
113
- return Array.from({ length: (stop - start - 1) / step + 1 }, (_, i) => start + i * step);
114
- };
115
- export const oa2aa = (oa, fields) => {
116
- const aa = [];
117
- oa.forEach((o) => {
118
- const a = [];
119
- fields.forEach((field) => {
120
- a.push(o[field]);
121
- });
122
- aa.push(a);
123
- });
124
- return aa;
125
- };
126
- export const aa2oa = (aa, fields) => {
127
- const oa = [];
128
- aa.forEach((a) => {
129
- const o = {};
130
- a.forEach((v, i) => {
131
- if (i >= fields.length) {
132
- return;
133
- }
134
- const field = fields[i];
135
- o[field] = v;
136
- });
137
- oa.push(o);
138
- });
139
- return oa;
140
- };
141
- export const putMatrix = (dst, src, dstArea) => {
142
- const lostRows = {};
143
- const { top, left, bottom, right } = dstArea;
144
- const { height: dstNumRows, width: dstNumCols } = matrixShape({
145
- matrix: dst,
146
- base: 1,
147
- });
148
- for (let y = top; y <= bottom; y++) {
149
- const lostRow = [];
150
- for (let x = left; x <= right; x++) {
151
- const value = src[y - top][x - left];
152
- // -1 means excluding headers
153
- if (y < dstNumRows - 1 && x < dstNumCols - 1) {
154
- dst[y][x] = value;
155
- continue;
156
- }
157
- if (lostRow.length === 0) {
158
- lostRows[p2a({ y, x })] = [lostRow];
159
- }
160
- lostRow.push(value);
161
- }
162
- }
163
- return lostRows;
164
- };
165
- export const createMatrix = (numRows, numCols, fill) => {
166
- return [...Array(numRows)].map(() => Array(numCols).fill(fill));
167
- };
168
- export const cropMatrix = (matrix, area) => {
169
- const { top, left, bottom, right } = area;
170
- return matrix
171
- .slice(top, bottom + 1)
172
- .map((cols) => cols.slice(left, right + 1));
173
- };
174
- export const generateInitialSimple = ({ cells = {}, ensured = {}, matrix = [], flattenAs = "value", }) => {
175
- return generateInitial({
176
- cells,
177
- ensured,
178
- matrices: { A1: matrix },
179
- flattenAs,
180
- });
181
- };
182
- export const generateInitial = ({ cells = {}, ensured = {}, matrices = {}, flattenAs = "value", } = {}) => {
183
- upsert({ cells, flattenAs, matrices });
184
- const { numRows, numCols } = Object.assign({ numRows: 1, numCols: 1 }, ensured);
185
- const rightBottom = p2a({ y: numRows, x: numCols });
186
- if (cells[rightBottom] == null) {
187
- cells[rightBottom] = {};
188
- }
189
- return cells;
190
- };
191
- export const upsert = ({ cells = {}, matrices = {}, flattenAs, }) => {
192
- Object.keys(matrices).forEach((address) => {
193
- const matrix = matrices[address];
194
- const { y: baseY, x: baseX } = a2p(address);
195
- matrix.forEach((row, y) => {
196
- row.forEach((e, x) => {
197
- const id = p2a({ y: baseY + y, x: baseX + x });
198
- if (flattenAs) {
199
- const cell = cells[id];
200
- cells[id] = Object.assign({ [flattenAs]: e }, cell);
201
- }
202
- else {
203
- cells[id] = e;
204
- }
205
- });
206
- });
207
- });
208
- return cells;
209
- };
210
- export const getMaxSizesFromCells = (cells = {}) => {
211
- let [lastY, lastX] = [0, 0];
212
- Object.keys(cells).map((address) => {
213
- const { y, x } = a2p(address);
214
- if (lastY < y) {
215
- lastY = y;
216
- }
217
- if (lastX < x) {
218
- lastX = x;
219
- }
220
- });
221
- return { numRows: lastY, numCols: lastX };
222
- };
223
- export const range = (start, end) => {
224
- const list = [];
225
- for (let i = start; i <= end; i++) {
226
- list.push(i);
227
- }
228
- return list;
229
- };
230
- export const complementSelectingArea = (selectingArea, choosing) => {
231
- if (selectingArea.left === -1) {
232
- selectingArea = { left: choosing.x, top: choosing.y, right: choosing.x, bottom: choosing.y };
233
- }
234
- return selectingArea;
235
- };
236
- export const isSameArea = (area1, area2) => {
237
- if (area1.top !== area2.top) {
238
- return false;
239
- }
240
- if (area1.left !== area2.left) {
241
- return false;
242
- }
243
- if (area1.bottom !== area2.bottom) {
244
- return false;
245
- }
246
- if (area1.right !== area2.right) {
247
- return false;
248
- }
249
- return true;
250
- };
251
- //# sourceMappingURL=structs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../src/lib/structs.ts"],"names":[],"mappings":";;;;;;;;;;;AAaA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAc,EAAE,CAAI,EAAE,CAAI,EAAY,EAAE;IAChE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAC1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AAC,IAAI,KAAK,CAAC,CAAC,EAAE;QAC7B,aAAa,GAAG,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,EAAC,CAAC;KAC5F;IACD,OAAO,aAAa,CAAC;AACvB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAe,EAAE,KAAe,EAAE,EAAE;IAC7D,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,EAAE;QAC3B,OAAO,KAAK,CAAC;KACd;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,EAAE;QAC7B,OAAO,KAAK,CAAC;KACd;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE;QACjC,OAAO,KAAK,CAAC;KACd;IACD,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAA"}
@@ -1,299 +0,0 @@
1
- import { Id, AreaType, CellsByIdType, CellsByAddressType, PointType, WriterType, Address, CellFilter, Labelers, MatrixType, CellType, Parsers, Renderers, HistoryType, StoreReflectionType, ShapeType } from "../types";
2
- import { FunctionMapping } from "../formula/functions/__base";
3
- import { functions as functionsDefault } from "../formula/mapping";
4
- declare type Props = {
5
- numRows?: number;
6
- numCols?: number;
7
- cells?: CellsByAddressType;
8
- parsers?: Parsers;
9
- renderers?: Renderers;
10
- labelers?: Labelers;
11
- useBigInt?: boolean;
12
- historyLimit?: number;
13
- minNumRows?: number;
14
- maxNumRows?: number;
15
- minNumCols?: number;
16
- maxNumCols?: number;
17
- headerHeight?: number;
18
- headerWidth?: number;
19
- functions?: typeof functionsDefault;
20
- };
21
- declare type GetProps = {
22
- evaluates?: boolean;
23
- raise?: boolean;
24
- filter?: CellFilter;
25
- };
26
- declare type MoveProps = {
27
- src: AreaType;
28
- dst: AreaType;
29
- reflection?: StoreReflectionType;
30
- };
31
- declare type GetFlattenProps = GetProps & {
32
- key?: keyof CellType;
33
- };
34
- declare type GetPropsWithArea = GetProps & {
35
- area?: AreaType;
36
- };
37
- declare type GetFlattenPropsWithArea = GetFlattenProps & {
38
- area?: AreaType;
39
- };
40
- export interface UserTable {
41
- changedAt: Date;
42
- lastChangedAt?: Date;
43
- top: number;
44
- left: number;
45
- bottom: number;
46
- right: number;
47
- minNumRows: number;
48
- maxNumRows: number;
49
- minNumCols: number;
50
- maxNumCols: number;
51
- totalWidth: number;
52
- totalHeight: number;
53
- headerWidth: number;
54
- headerHeight: number;
55
- getRectSize(area: AreaType): ShapeType;
56
- getAddressById(id: Id, slideY: number, slideX: number): string | undefined;
57
- getAddressesByIds(ids: CellsByIdType): CellsByAddressType;
58
- getPointById(id: Id): PointType;
59
- getByPoint(point: PointType): CellType | undefined;
60
- getById(id: Id): CellType | undefined;
61
- getNumRows(base?: number): number;
62
- getNumCols(base?: number): number;
63
- getMatrixFlatten(args?: GetFlattenPropsWithArea): any[][];
64
- getObjectFlatten(args?: GetFlattenProps): CellsByAddressType;
65
- getRowsFlatten(args?: GetFlattenProps): CellsByAddressType[];
66
- getColsFlatten(args?: GetFlattenProps): CellsByAddressType[];
67
- getMatrix(args?: GetPropsWithArea): (CellType | null)[][];
68
- getObject(args?: GetProps): CellsByAddressType;
69
- getRows(args?: GetProps): CellsByAddressType[];
70
- getCols(args?: GetProps): CellsByAddressType[];
71
- move(args: MoveProps): UserTable;
72
- copy(args: MoveProps): UserTable;
73
- update(args: {
74
- diff: CellsByAddressType;
75
- partial?: boolean;
76
- updateChangedAt?: boolean;
77
- reflection?: StoreReflectionType;
78
- }): UserTable;
79
- writeMatrix(args: {
80
- point: PointType;
81
- matrix: MatrixType<string>;
82
- updateChangedAt?: boolean;
83
- reflection?: StoreReflectionType;
84
- }): UserTable;
85
- write(args: {
86
- point: PointType;
87
- value: string;
88
- updateChangedAt?: boolean;
89
- reflection?: StoreReflectionType;
90
- }): UserTable;
91
- addRowsAndUpdate(args: {
92
- y: number;
93
- numRows: number;
94
- baseY: number;
95
- diff: CellsByAddressType;
96
- partial?: boolean;
97
- updateChangedAt?: boolean;
98
- reflection?: StoreReflectionType;
99
- }): UserTable;
100
- addRows(args: {
101
- y: number;
102
- numRows: number;
103
- baseY: number;
104
- reflection?: StoreReflectionType;
105
- }): UserTable;
106
- removeRows(args: {
107
- y: number;
108
- numRows: number;
109
- reflection?: StoreReflectionType;
110
- }): UserTable;
111
- addColsAndUpdate(args: {
112
- x: number;
113
- numCols: number;
114
- baseX: number;
115
- diff: CellsByAddressType;
116
- partial?: boolean;
117
- updateChangedAt?: boolean;
118
- reflection?: StoreReflectionType;
119
- }): UserTable;
120
- addCols(args: {
121
- x: number;
122
- numCols: number;
123
- baseX: number;
124
- reflection?: StoreReflectionType;
125
- }): UserTable;
126
- removeCols(args: {
127
- x: number;
128
- numCols: number;
129
- reflection?: StoreReflectionType;
130
- }): UserTable;
131
- undo(): {
132
- history: HistoryType | null;
133
- newTable: UserTable;
134
- };
135
- redo(): {
136
- history: HistoryType | null;
137
- newTable: UserTable;
138
- };
139
- getHistories(): HistoryType[];
140
- getHistoryIndex(): number;
141
- getHistorySize(): number;
142
- }
143
- export declare class Table implements UserTable {
144
- changedAt: Date;
145
- lastChangedAt?: Date;
146
- minNumRows: number;
147
- maxNumRows: number;
148
- minNumCols: number;
149
- maxNumCols: number;
150
- totalWidth: number;
151
- totalHeight: number;
152
- headerWidth: number;
153
- headerHeight: number;
154
- private head;
155
- private idMatrix;
156
- private data;
157
- private area;
158
- private parsers;
159
- private renderers;
160
- private labelers;
161
- private functions;
162
- private lastHistory?;
163
- private histories;
164
- private historyIndex;
165
- private addressesById;
166
- private historyLimit;
167
- private solvedCaches;
168
- constructor({ numRows, numCols, cells, parsers, renderers, labelers, useBigInt, historyLimit: historyLimit, minNumRows, maxNumRows, minNumCols, maxNumCols, headerWidth, headerHeight, functions, }: Props);
169
- private generateId;
170
- getRectSize({ top, left, bottom, right }: AreaType): {
171
- width: number;
172
- height: number;
173
- };
174
- private setTotalSize;
175
- private shallowCopy;
176
- getAddressById(id: Id, slideY?: number, slideX?: number): string | undefined;
177
- getAddressesByIds(ids: CellsByIdType): CellsByAddressType;
178
- getPointById(id: Id): PointType;
179
- private getId;
180
- getByPoint(point: PointType): CellType<any> | undefined;
181
- getById(id: Id): CellType<any> | undefined;
182
- getNumRows(base?: number): number;
183
- getNumCols(base?: number): number;
184
- get top(): number;
185
- get left(): number;
186
- get bottom(): number;
187
- get right(): number;
188
- getMatrixFlatten({ area, key, evaluates, raise, filter, }?: GetFlattenPropsWithArea): any[][];
189
- getObjectFlatten({ key, evaluates, raise, filter, }?: GetFlattenProps): CellsByAddressType;
190
- getRowsFlatten({ key, evaluates, raise, filter, }?: GetFlattenProps): CellsByAddressType[];
191
- getColsFlatten({ key, evaluates, raise, filter, }?: GetFlattenProps): CellsByAddressType[];
192
- getMatrix({ area, evaluates, raise, filter, }?: GetPropsWithArea): (CellType | null)[][];
193
- getObject({ evaluates, raise, filter, }?: GetProps): CellsByAddressType;
194
- getRows({ evaluates, raise, filter, }?: GetProps): CellsByAddressType[];
195
- getCols({ evaluates, raise, filter, }?: GetProps): CellsByAddressType[];
196
- private pushHistory;
197
- private cleanObsolete;
198
- private cleanStrayed;
199
- private getNewIdMatrix;
200
- private getIdMatrixFromArea;
201
- private setChangedAt;
202
- private copyCellLayout;
203
- move({ src, dst, reflection, }: MoveProps): Table;
204
- copy({ src, dst, reflection, }: MoveProps): Table;
205
- private _update;
206
- update({ diff, partial, updateChangedAt, reflection, }: {
207
- diff: CellsByAddressType;
208
- partial?: boolean;
209
- updateChangedAt?: boolean;
210
- reflection?: StoreReflectionType;
211
- }): Table;
212
- writeMatrix({ point, matrix, updateChangedAt, reflection, }: {
213
- point: PointType;
214
- matrix: MatrixType<string>;
215
- updateChangedAt?: boolean;
216
- reflection?: StoreReflectionType;
217
- }): Table;
218
- write({ point, value, updateChangedAt, reflection, }: {
219
- point: PointType;
220
- value: string;
221
- updateChangedAt?: boolean;
222
- reflection?: StoreReflectionType;
223
- }): Table;
224
- addRowsAndUpdate({ y, numRows, baseY, diff, partial, updateChangedAt, reflection, }: {
225
- y: number;
226
- numRows: number;
227
- baseY: number;
228
- diff: CellsByAddressType;
229
- partial?: boolean;
230
- updateChangedAt?: boolean;
231
- reflection?: StoreReflectionType;
232
- }): Table;
233
- addRows({ y, numRows, baseY, reflection, }: {
234
- y: number;
235
- numRows: number;
236
- baseY: number;
237
- reflection?: StoreReflectionType;
238
- }): Table;
239
- removeRows({ y, numRows, reflection, }: {
240
- y: number;
241
- numRows: number;
242
- reflection?: StoreReflectionType;
243
- }): Table;
244
- addColsAndUpdate({ x, numCols, baseX, diff, partial, updateChangedAt, reflection, }: {
245
- x: number;
246
- numCols: number;
247
- baseX: number;
248
- diff: CellsByAddressType;
249
- partial?: boolean;
250
- updateChangedAt?: boolean;
251
- reflection?: StoreReflectionType;
252
- }): Table;
253
- addCols({ x, numCols, baseX, reflection, }: {
254
- x: number;
255
- numCols: number;
256
- baseX: number;
257
- reflection?: StoreReflectionType;
258
- }): Table;
259
- removeCols({ x, numCols, reflection, }: {
260
- x: number;
261
- numCols: number;
262
- reflection?: StoreReflectionType;
263
- }): Table;
264
- getHistories(): HistoryType[];
265
- getHistoryIndex(): number;
266
- getHistorySize(): number;
267
- getHistoryLimit(): number;
268
- setFunctions(additionalFunctions: FunctionMapping): void;
269
- getArea(): AreaType;
270
- parse(point: PointType, value: string): CellType<any>;
271
- render(point: PointType, writer?: WriterType): any;
272
- stringify(point: PointType, value?: any, evaluates?: boolean): string;
273
- trim(area: AreaType): ReadonlyTable;
274
- getIdByAddress(address: Address): string | undefined;
275
- private applyDiff;
276
- undo(): {
277
- history: null;
278
- newTable: Table;
279
- } | {
280
- history: HistoryType;
281
- newTable: Table;
282
- };
283
- redo(): {
284
- history: null;
285
- newTable: Table;
286
- } | {
287
- history: HistoryType;
288
- newTable: Table;
289
- };
290
- getFunction(name: string): any;
291
- getLabel(key: string, n: number): string;
292
- getBase(): this;
293
- getSolvedCache(key: string): any;
294
- setSolvedCache(key: string, value: any): void;
295
- }
296
- export declare class ReadonlyTable extends Table {
297
- }
298
- export {};
299
- //# sourceMappingURL=table.d.ts.map