@trebco/treb 37.0.0 → 37.0.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.
Files changed (528) hide show
  1. package/build/package.json +119 -0
  2. package/build/treb-base-types/src/api_types.d.ts +11 -0
  3. package/build/treb-base-types/src/api_types.js +22 -0
  4. package/build/treb-base-types/src/api_types.js.map +1 -0
  5. package/build/treb-base-types/src/area-utils.d.ts +9 -0
  6. package/build/treb-base-types/src/area-utils.js +50 -0
  7. package/build/treb-base-types/src/area-utils.js.map +1 -0
  8. package/build/treb-base-types/src/area.d.ts +182 -0
  9. package/build/treb-base-types/src/area.js +715 -0
  10. package/build/treb-base-types/src/area.js.map +1 -0
  11. package/build/treb-base-types/src/basic_types.d.ts +20 -0
  12. package/build/treb-base-types/src/basic_types.js +22 -0
  13. package/build/treb-base-types/src/basic_types.js.map +1 -0
  14. package/build/treb-base-types/src/cell.d.ts +167 -0
  15. package/build/treb-base-types/src/cell.js +432 -0
  16. package/build/treb-base-types/src/cell.js.map +1 -0
  17. package/build/treb-base-types/src/cells.d.ts +251 -0
  18. package/build/treb-base-types/src/cells.js +1136 -0
  19. package/build/treb-base-types/src/cells.js.map +1 -0
  20. package/build/treb-base-types/src/color.d.ts +35 -0
  21. package/build/treb-base-types/src/color.js +162 -0
  22. package/build/treb-base-types/src/color.js.map +1 -0
  23. package/build/treb-base-types/src/dom-utilities.d.ts +70 -0
  24. package/build/treb-base-types/src/dom-utilities.js +144 -0
  25. package/build/treb-base-types/src/dom-utilities.js.map +1 -0
  26. package/build/treb-base-types/src/evaluate-options.d.ts +35 -0
  27. package/build/treb-base-types/src/evaluate-options.js +22 -0
  28. package/build/treb-base-types/src/evaluate-options.js.map +1 -0
  29. package/build/treb-base-types/src/font-stack.d.ts +37 -0
  30. package/build/treb-base-types/src/font-stack.js +93 -0
  31. package/build/treb-base-types/src/font-stack.js.map +1 -0
  32. package/build/treb-base-types/src/gradient.d.ts +18 -0
  33. package/build/treb-base-types/src/gradient.js +86 -0
  34. package/build/treb-base-types/src/gradient.js.map +1 -0
  35. package/build/treb-base-types/src/import.d.ts +48 -0
  36. package/build/treb-base-types/src/import.js +22 -0
  37. package/build/treb-base-types/src/import.js.map +1 -0
  38. package/build/treb-base-types/src/index-standalone.d.ts +6 -0
  39. package/build/treb-base-types/src/index-standalone.js +27 -0
  40. package/build/treb-base-types/src/index-standalone.js.map +1 -0
  41. package/build/treb-base-types/src/index.d.ts +22 -0
  42. package/build/treb-base-types/src/index.js +45 -0
  43. package/build/treb-base-types/src/index.js.map +1 -0
  44. package/build/treb-base-types/src/layout.d.ts +22 -0
  45. package/build/treb-base-types/src/layout.js +22 -0
  46. package/build/treb-base-types/src/layout.js.map +1 -0
  47. package/build/treb-base-types/src/localization.d.ts +37 -0
  48. package/build/treb-base-types/src/localization.js +157 -0
  49. package/build/treb-base-types/src/localization.js.map +1 -0
  50. package/build/treb-base-types/src/rectangle.d.ts +51 -0
  51. package/build/treb-base-types/src/rectangle.js +123 -0
  52. package/build/treb-base-types/src/rectangle.js.map +1 -0
  53. package/build/treb-base-types/src/render_text.d.ts +34 -0
  54. package/build/treb-base-types/src/render_text.js +22 -0
  55. package/build/treb-base-types/src/render_text.js.map +1 -0
  56. package/build/treb-base-types/src/style.d.ts +214 -0
  57. package/build/treb-base-types/src/style.js +373 -0
  58. package/build/treb-base-types/src/style.js.map +1 -0
  59. package/build/treb-base-types/src/table.d.ts +58 -0
  60. package/build/treb-base-types/src/table.js +27 -0
  61. package/build/treb-base-types/src/table.js.map +1 -0
  62. package/build/treb-base-types/src/text_part.d.ts +26 -0
  63. package/build/treb-base-types/src/text_part.js +47 -0
  64. package/build/treb-base-types/src/text_part.js.map +1 -0
  65. package/build/treb-base-types/src/theme.d.ts +120 -0
  66. package/build/treb-base-types/src/theme.js +460 -0
  67. package/build/treb-base-types/src/theme.js.map +1 -0
  68. package/build/treb-base-types/src/union.d.ts +73 -0
  69. package/build/treb-base-types/src/union.js +61 -0
  70. package/build/treb-base-types/src/union.js.map +1 -0
  71. package/build/treb-base-types/src/value-type.d.ts +86 -0
  72. package/build/treb-base-types/src/value-type.js +168 -0
  73. package/build/treb-base-types/src/value-type.js.map +1 -0
  74. package/build/treb-base-types/src/worker-proxy.d.ts +95 -0
  75. package/build/treb-base-types/src/worker-proxy.js +221 -0
  76. package/build/treb-base-types/src/worker-proxy.js.map +1 -0
  77. package/build/treb-calculator/src/calculator.d.ts +249 -0
  78. package/build/treb-calculator/src/calculator.js +2755 -0
  79. package/build/treb-calculator/src/calculator.js.map +1 -0
  80. package/build/treb-calculator/src/complex-math.d.ts +75 -0
  81. package/build/treb-calculator/src/complex-math.js +559 -0
  82. package/build/treb-calculator/src/complex-math.js.map +1 -0
  83. package/build/treb-calculator/src/dag/array-vertex.d.ts +71 -0
  84. package/build/treb-calculator/src/dag/array-vertex.js +156 -0
  85. package/build/treb-calculator/src/dag/array-vertex.js.map +1 -0
  86. package/build/treb-calculator/src/dag/calculation_leaf_vertex.d.ts +48 -0
  87. package/build/treb-calculator/src/dag/calculation_leaf_vertex.js +84 -0
  88. package/build/treb-calculator/src/dag/calculation_leaf_vertex.js.map +1 -0
  89. package/build/treb-calculator/src/dag/graph.d.ts +134 -0
  90. package/build/treb-calculator/src/dag/graph.js +842 -0
  91. package/build/treb-calculator/src/dag/graph.js.map +1 -0
  92. package/build/treb-calculator/src/dag/spreadsheet_vertex.d.ts +58 -0
  93. package/build/treb-calculator/src/dag/spreadsheet_vertex.js +232 -0
  94. package/build/treb-calculator/src/dag/spreadsheet_vertex.js.map +1 -0
  95. package/build/treb-calculator/src/dag/spreadsheet_vertex_base.d.ts +20 -0
  96. package/build/treb-calculator/src/dag/spreadsheet_vertex_base.js +25 -0
  97. package/build/treb-calculator/src/dag/spreadsheet_vertex_base.js.map +1 -0
  98. package/build/treb-calculator/src/dag/state_leaf_vertex.d.ts +43 -0
  99. package/build/treb-calculator/src/dag/state_leaf_vertex.js +81 -0
  100. package/build/treb-calculator/src/dag/state_leaf_vertex.js.map +1 -0
  101. package/build/treb-calculator/src/dag/vertex.d.ts +71 -0
  102. package/build/treb-calculator/src/dag/vertex.js +274 -0
  103. package/build/treb-calculator/src/dag/vertex.js.map +1 -0
  104. package/build/treb-calculator/src/descriptors.d.ts +189 -0
  105. package/build/treb-calculator/src/descriptors.js +22 -0
  106. package/build/treb-calculator/src/descriptors.js.map +1 -0
  107. package/build/treb-calculator/src/expression-calculator.d.ts +127 -0
  108. package/build/treb-calculator/src/expression-calculator.js +1033 -0
  109. package/build/treb-calculator/src/expression-calculator.js.map +1 -0
  110. package/build/treb-calculator/src/function-error.d.ts +35 -0
  111. package/build/treb-calculator/src/function-error.js +85 -0
  112. package/build/treb-calculator/src/function-error.js.map +1 -0
  113. package/build/treb-calculator/src/function-library.d.ts +22 -0
  114. package/build/treb-calculator/src/function-library.js +96 -0
  115. package/build/treb-calculator/src/function-library.js.map +1 -0
  116. package/build/treb-calculator/src/functions/base-functions.d.ts +7 -0
  117. package/build/treb-calculator/src/functions/base-functions.js +2611 -0
  118. package/build/treb-calculator/src/functions/base-functions.js.map +1 -0
  119. package/build/treb-calculator/src/functions/beta.d.ts +17 -0
  120. package/build/treb-calculator/src/functions/beta.js +201 -0
  121. package/build/treb-calculator/src/functions/beta.js.map +1 -0
  122. package/build/treb-calculator/src/functions/checkbox.d.ts +3 -0
  123. package/build/treb-calculator/src/functions/checkbox.js +128 -0
  124. package/build/treb-calculator/src/functions/checkbox.js.map +1 -0
  125. package/build/treb-calculator/src/functions/complex-functions.d.ts +2 -0
  126. package/build/treb-calculator/src/functions/complex-functions.js +217 -0
  127. package/build/treb-calculator/src/functions/complex-functions.js.map +1 -0
  128. package/build/treb-calculator/src/functions/date-utils.d.ts +3 -0
  129. package/build/treb-calculator/src/functions/date-utils.js +59 -0
  130. package/build/treb-calculator/src/functions/date-utils.js.map +1 -0
  131. package/build/treb-calculator/src/functions/finance-functions.d.ts +2 -0
  132. package/build/treb-calculator/src/functions/finance-functions.js +547 -0
  133. package/build/treb-calculator/src/functions/finance-functions.js.map +1 -0
  134. package/build/treb-calculator/src/functions/fp.d.ts +2 -0
  135. package/build/treb-calculator/src/functions/fp.js +463 -0
  136. package/build/treb-calculator/src/functions/fp.js.map +1 -0
  137. package/build/treb-calculator/src/functions/function-utilities.d.ts +2 -0
  138. package/build/treb-calculator/src/functions/function-utilities.js +36 -0
  139. package/build/treb-calculator/src/functions/function-utilities.js.map +1 -0
  140. package/build/treb-calculator/src/functions/gamma.d.ts +20 -0
  141. package/build/treb-calculator/src/functions/gamma.js +142 -0
  142. package/build/treb-calculator/src/functions/gamma.js.map +1 -0
  143. package/build/treb-calculator/src/functions/information-functions.d.ts +2 -0
  144. package/build/treb-calculator/src/functions/information-functions.js +71 -0
  145. package/build/treb-calculator/src/functions/information-functions.js.map +1 -0
  146. package/build/treb-calculator/src/functions/lambda-functions.d.ts +2 -0
  147. package/build/treb-calculator/src/functions/lambda-functions.js +85 -0
  148. package/build/treb-calculator/src/functions/lambda-functions.js.map +1 -0
  149. package/build/treb-calculator/src/functions/matrix-functions.d.ts +2 -0
  150. package/build/treb-calculator/src/functions/matrix-functions.js +144 -0
  151. package/build/treb-calculator/src/functions/matrix-functions.js.map +1 -0
  152. package/build/treb-calculator/src/functions/normal.d.ts +2 -0
  153. package/build/treb-calculator/src/functions/normal.js +32 -0
  154. package/build/treb-calculator/src/functions/normal.js.map +1 -0
  155. package/build/treb-calculator/src/functions/regex-functions.d.ts +2 -0
  156. package/build/treb-calculator/src/functions/regex-functions.js +188 -0
  157. package/build/treb-calculator/src/functions/regex-functions.js.map +1 -0
  158. package/build/treb-calculator/src/functions/sparkline.d.ts +37 -0
  159. package/build/treb-calculator/src/functions/sparkline.js +264 -0
  160. package/build/treb-calculator/src/functions/sparkline.js.map +1 -0
  161. package/build/treb-calculator/src/functions/statistics-functions.d.ts +6 -0
  162. package/build/treb-calculator/src/functions/statistics-functions.js +989 -0
  163. package/build/treb-calculator/src/functions/statistics-functions.js.map +1 -0
  164. package/build/treb-calculator/src/functions/students-t.d.ts +3 -0
  165. package/build/treb-calculator/src/functions/students-t.js +64 -0
  166. package/build/treb-calculator/src/functions/students-t.js.map +1 -0
  167. package/build/treb-calculator/src/functions/text-functions.d.ts +3 -0
  168. package/build/treb-calculator/src/functions/text-functions.js +320 -0
  169. package/build/treb-calculator/src/functions/text-functions.js.map +1 -0
  170. package/build/treb-calculator/src/index.d.ts +2 -0
  171. package/build/treb-calculator/src/index.js +22 -0
  172. package/build/treb-calculator/src/index.js.map +1 -0
  173. package/build/treb-calculator/src/notifier-types.d.ts +26 -0
  174. package/build/treb-calculator/src/notifier-types.js +22 -0
  175. package/build/treb-calculator/src/notifier-types.js.map +1 -0
  176. package/build/treb-calculator/src/primitives.d.ts +15 -0
  177. package/build/treb-calculator/src/primitives.js +398 -0
  178. package/build/treb-calculator/src/primitives.js.map +1 -0
  179. package/build/treb-calculator/src/utilities.d.ts +68 -0
  180. package/build/treb-calculator/src/utilities.js +324 -0
  181. package/build/treb-calculator/src/utilities.js.map +1 -0
  182. package/build/treb-charts/src/chart-functions.d.ts +8 -0
  183. package/build/treb-charts/src/chart-functions.js +209 -0
  184. package/build/treb-charts/src/chart-functions.js.map +1 -0
  185. package/build/treb-charts/src/chart-types.d.ts +233 -0
  186. package/build/treb-charts/src/chart-types.js +57 -0
  187. package/build/treb-charts/src/chart-types.js.map +1 -0
  188. package/build/treb-charts/src/chart-utils.d.ts +106 -0
  189. package/build/treb-charts/src/chart-utils.js +1060 -0
  190. package/build/treb-charts/src/chart-utils.js.map +1 -0
  191. package/build/treb-charts/src/chart.d.ts +23 -0
  192. package/build/treb-charts/src/chart.js +94 -0
  193. package/build/treb-charts/src/chart.js.map +1 -0
  194. package/build/treb-charts/src/default-chart-renderer.d.ts +16 -0
  195. package/build/treb-charts/src/default-chart-renderer.js +533 -0
  196. package/build/treb-charts/src/default-chart-renderer.js.map +1 -0
  197. package/build/treb-charts/src/index.d.ts +5 -0
  198. package/build/treb-charts/src/index.js +24 -0
  199. package/build/treb-charts/src/index.js.map +1 -0
  200. package/build/treb-charts/src/main.d.ts +1 -0
  201. package/build/treb-charts/src/main.js +34 -0
  202. package/build/treb-charts/src/main.js.map +1 -0
  203. package/build/treb-charts/src/quicksort.d.ts +1 -0
  204. package/build/treb-charts/src/quicksort.js +49 -0
  205. package/build/treb-charts/src/quicksort.js.map +1 -0
  206. package/build/treb-charts/src/rectangle.d.ts +18 -0
  207. package/build/treb-charts/src/rectangle.js +41 -0
  208. package/build/treb-charts/src/rectangle.js.map +1 -0
  209. package/build/treb-charts/src/renderer-type.d.ts +24 -0
  210. package/build/treb-charts/src/renderer-type.js +22 -0
  211. package/build/treb-charts/src/renderer-type.js.map +1 -0
  212. package/build/treb-charts/src/renderer.d.ts +127 -0
  213. package/build/treb-charts/src/renderer.js +1518 -0
  214. package/build/treb-charts/src/renderer.js.map +1 -0
  215. package/build/treb-charts/src/util.d.ts +18 -0
  216. package/build/treb-charts/src/util.js +71 -0
  217. package/build/treb-charts/src/util.js.map +1 -0
  218. package/build/treb-data-model/src/annotation.d.ts +167 -0
  219. package/build/treb-data-model/src/annotation.js +120 -0
  220. package/build/treb-data-model/src/annotation.js.map +1 -0
  221. package/build/treb-data-model/src/conditional_format.d.ts +155 -0
  222. package/build/treb-data-model/src/conditional_format.js +62 -0
  223. package/build/treb-data-model/src/conditional_format.js.map +1 -0
  224. package/build/treb-data-model/src/data-validation.d.ts +28 -0
  225. package/build/treb-data-model/src/data-validation.js +22 -0
  226. package/build/treb-data-model/src/data-validation.js.map +1 -0
  227. package/build/treb-data-model/src/data_model.d.ts +173 -0
  228. package/build/treb-data-model/src/data_model.js +637 -0
  229. package/build/treb-data-model/src/data_model.js.map +1 -0
  230. package/build/treb-data-model/src/index.d.ts +13 -0
  231. package/build/treb-data-model/src/index.js +28 -0
  232. package/build/treb-data-model/src/index.js.map +1 -0
  233. package/build/treb-data-model/src/language-model.d.ts +22 -0
  234. package/build/treb-data-model/src/language-model.js +22 -0
  235. package/build/treb-data-model/src/language-model.js.map +1 -0
  236. package/build/treb-data-model/src/named.d.ts +124 -0
  237. package/build/treb-data-model/src/named.js +372 -0
  238. package/build/treb-data-model/src/named.js.map +1 -0
  239. package/build/treb-data-model/src/serialize_options.d.ts +49 -0
  240. package/build/treb-data-model/src/serialize_options.js +22 -0
  241. package/build/treb-data-model/src/serialize_options.js.map +1 -0
  242. package/build/treb-data-model/src/sheet.d.ts +499 -0
  243. package/build/treb-data-model/src/sheet.js +2904 -0
  244. package/build/treb-data-model/src/sheet.js.map +1 -0
  245. package/build/treb-data-model/src/sheet_collection.d.ts +58 -0
  246. package/build/treb-data-model/src/sheet_collection.js +112 -0
  247. package/build/treb-data-model/src/sheet_collection.js.map +1 -0
  248. package/build/treb-data-model/src/sheet_selection.d.ts +42 -0
  249. package/build/treb-data-model/src/sheet_selection.js +39 -0
  250. package/build/treb-data-model/src/sheet_selection.js.map +1 -0
  251. package/build/treb-data-model/src/sheet_types.d.ts +104 -0
  252. package/build/treb-data-model/src/sheet_types.js +22 -0
  253. package/build/treb-data-model/src/sheet_types.js.map +1 -0
  254. package/build/treb-data-model/src/types.d.ts +59 -0
  255. package/build/treb-data-model/src/types.js +22 -0
  256. package/build/treb-data-model/src/types.js.map +1 -0
  257. package/build/treb-embed/src/custom-element/spreadsheet-constructor.d.ts +75 -0
  258. package/build/treb-embed/src/custom-element/spreadsheet-constructor.js +1144 -0
  259. package/build/treb-embed/src/custom-element/spreadsheet-constructor.js.map +1 -0
  260. package/build/treb-embed/src/custom-element/treb-global.d.ts +36 -0
  261. package/build/treb-embed/src/custom-element/treb-global.js +64 -0
  262. package/build/treb-embed/src/custom-element/treb-global.js.map +1 -0
  263. package/build/treb-embed/src/custom-element/treb-spreadsheet-element.d.ts +1 -0
  264. package/build/treb-embed/src/custom-element/treb-spreadsheet-element.js +61 -0
  265. package/build/treb-embed/src/custom-element/treb-spreadsheet-element.js.map +1 -0
  266. package/build/treb-embed/src/embedded-spreadsheet.d.ts +1358 -0
  267. package/build/treb-embed/src/embedded-spreadsheet.js +5205 -0
  268. package/build/treb-embed/src/embedded-spreadsheet.js.map +1 -0
  269. package/build/treb-embed/src/index.d.ts +12 -0
  270. package/build/treb-embed/src/index.js +34 -0
  271. package/build/treb-embed/src/index.js.map +1 -0
  272. package/build/treb-embed/src/options.d.ts +266 -0
  273. package/build/treb-embed/src/options.js +56 -0
  274. package/build/treb-embed/src/options.js.map +1 -0
  275. package/build/treb-embed/src/plugin.d.ts +9 -0
  276. package/build/treb-embed/src/plugin.js +22 -0
  277. package/build/treb-embed/src/plugin.js.map +1 -0
  278. package/build/treb-embed/src/progress-dialog.d.ts +49 -0
  279. package/build/treb-embed/src/progress-dialog.js +178 -0
  280. package/build/treb-embed/src/progress-dialog.js.map +1 -0
  281. package/build/treb-embed/src/selection-state.d.ts +15 -0
  282. package/build/treb-embed/src/selection-state.js +22 -0
  283. package/build/treb-embed/src/selection-state.js.map +1 -0
  284. package/build/treb-embed/src/spinner.d.ts +8 -0
  285. package/build/treb-embed/src/spinner.js +40 -0
  286. package/build/treb-embed/src/spinner.js.map +1 -0
  287. package/build/treb-embed/src/toolbar-message.d.ts +72 -0
  288. package/build/treb-embed/src/toolbar-message.js +22 -0
  289. package/build/treb-embed/src/toolbar-message.js.map +1 -0
  290. package/build/treb-embed/src/types.d.ts +185 -0
  291. package/build/treb-embed/src/types.js +45 -0
  292. package/build/treb-embed/src/types.js.map +1 -0
  293. package/build/treb-embed/tsconfig.tsbuildinfo +1 -0
  294. package/build/treb-export/src/address-type.d.ts +34 -0
  295. package/build/treb-export/src/address-type.js +53 -0
  296. package/build/treb-export/src/address-type.js.map +1 -0
  297. package/build/treb-export/src/base-template.d.ts +1 -0
  298. package/build/treb-export/src/base-template.js +22 -0
  299. package/build/treb-export/src/base-template.js.map +1 -0
  300. package/build/treb-export/src/column-width.d.ts +2 -0
  301. package/build/treb-export/src/column-width.js +80 -0
  302. package/build/treb-export/src/column-width.js.map +1 -0
  303. package/build/treb-export/src/drawing/bubble-chart-template.d.ts +514 -0
  304. package/build/treb-export/src/drawing/bubble-chart-template.js +544 -0
  305. package/build/treb-export/src/drawing/bubble-chart-template.js.map +1 -0
  306. package/build/treb-export/src/drawing/chart-template-components2.d.ts +365 -0
  307. package/build/treb-export/src/drawing/chart-template-components2.js +386 -0
  308. package/build/treb-export/src/drawing/chart-template-components2.js.map +1 -0
  309. package/build/treb-export/src/drawing/chart.d.ts +26 -0
  310. package/build/treb-export/src/drawing/chart.js +247 -0
  311. package/build/treb-export/src/drawing/chart.js.map +1 -0
  312. package/build/treb-export/src/drawing/column-chart-template2.d.ts +490 -0
  313. package/build/treb-export/src/drawing/column-chart-template2.js +518 -0
  314. package/build/treb-export/src/drawing/column-chart-template2.js.map +1 -0
  315. package/build/treb-export/src/drawing/donut-chart-template2.d.ts +272 -0
  316. package/build/treb-export/src/drawing/donut-chart-template2.js +293 -0
  317. package/build/treb-export/src/drawing/donut-chart-template2.js.map +1 -0
  318. package/build/treb-export/src/drawing/drawing.d.ts +49 -0
  319. package/build/treb-export/src/drawing/drawing.js +193 -0
  320. package/build/treb-export/src/drawing/drawing.js.map +1 -0
  321. package/build/treb-export/src/drawing/embedded-image.d.ts +12 -0
  322. package/build/treb-export/src/drawing/embedded-image.js +54 -0
  323. package/build/treb-export/src/drawing/embedded-image.js.map +1 -0
  324. package/build/treb-export/src/drawing/scatter-chart-template2.d.ts +520 -0
  325. package/build/treb-export/src/drawing/scatter-chart-template2.js +551 -0
  326. package/build/treb-export/src/drawing/scatter-chart-template2.js.map +1 -0
  327. package/build/treb-export/src/export.d.ts +72 -0
  328. package/build/treb-export/src/export.js +2039 -0
  329. package/build/treb-export/src/export.js.map +1 -0
  330. package/build/treb-export/src/import-export-messages.d.ts +31 -0
  331. package/build/treb-export/src/import-export-messages.js +22 -0
  332. package/build/treb-export/src/import-export-messages.js.map +1 -0
  333. package/build/treb-export/src/import.d.ts +33 -0
  334. package/build/treb-export/src/import.js +1258 -0
  335. package/build/treb-export/src/import.js.map +1 -0
  336. package/build/treb-export/src/index.worker.d.ts +1 -0
  337. package/build/treb-export/src/index.worker.js +93 -0
  338. package/build/treb-export/src/index.worker.js.map +1 -0
  339. package/build/treb-export/src/metadata.d.ts +51 -0
  340. package/build/treb-export/src/metadata.js +153 -0
  341. package/build/treb-export/src/metadata.js.map +1 -0
  342. package/build/treb-export/src/ooxml.d.ts +7 -0
  343. package/build/treb-export/src/ooxml.js +41 -0
  344. package/build/treb-export/src/ooxml.js.map +1 -0
  345. package/build/treb-export/src/relationship.d.ts +8 -0
  346. package/build/treb-export/src/relationship.js +27 -0
  347. package/build/treb-export/src/relationship.js.map +1 -0
  348. package/build/treb-export/src/shared-strings.d.ts +11 -0
  349. package/build/treb-export/src/shared-strings.js +105 -0
  350. package/build/treb-export/src/shared-strings.js.map +1 -0
  351. package/build/treb-export/src/template-2.d.ts +1 -0
  352. package/build/treb-export/src/template-2.js +22 -0
  353. package/build/treb-export/src/template-2.js.map +1 -0
  354. package/build/treb-export/src/unescape_xml.d.ts +1 -0
  355. package/build/treb-export/src/unescape_xml.js +61 -0
  356. package/build/treb-export/src/unescape_xml.js.map +1 -0
  357. package/build/treb-export/src/workbook-sheet.d.ts +75 -0
  358. package/build/treb-export/src/workbook-sheet.js +128 -0
  359. package/build/treb-export/src/workbook-sheet.js.map +1 -0
  360. package/build/treb-export/src/workbook-style.d.ts +110 -0
  361. package/build/treb-export/src/workbook-style.js +1134 -0
  362. package/build/treb-export/src/workbook-style.js.map +1 -0
  363. package/build/treb-export/src/workbook-theme.d.ts +13 -0
  364. package/build/treb-export/src/workbook-theme.js +85 -0
  365. package/build/treb-export/src/workbook-theme.js.map +1 -0
  366. package/build/treb-export/src/workbook.d.ts +123 -0
  367. package/build/treb-export/src/workbook.js +644 -0
  368. package/build/treb-export/src/workbook.js.map +1 -0
  369. package/build/treb-export/src/xml-test.d.ts +9 -0
  370. package/build/treb-export/src/xml-test.js +52 -0
  371. package/build/treb-export/src/xml-test.js.map +1 -0
  372. package/build/treb-export/src/xml-utils.d.ts +76 -0
  373. package/build/treb-export/src/xml-utils.js +223 -0
  374. package/build/treb-export/src/xml-utils.js.map +1 -0
  375. package/build/treb-export/src/zip-wrapper.d.ts +22 -0
  376. package/build/treb-export/src/zip-wrapper.js +93 -0
  377. package/build/treb-export/src/zip-wrapper.js.map +1 -0
  378. package/build/treb-format/src/format.d.ts +130 -0
  379. package/build/treb-format/src/format.js +805 -0
  380. package/build/treb-format/src/format.js.map +1 -0
  381. package/build/treb-format/src/format_cache.d.ts +55 -0
  382. package/build/treb-format/src/format_cache.js +166 -0
  383. package/build/treb-format/src/format_cache.js.map +1 -0
  384. package/build/treb-format/src/format_parser.d.ts +70 -0
  385. package/build/treb-format/src/format_parser.js +618 -0
  386. package/build/treb-format/src/format_parser.js.map +1 -0
  387. package/build/treb-format/src/index.d.ts +4 -0
  388. package/build/treb-format/src/index.js +25 -0
  389. package/build/treb-format/src/index.js.map +1 -0
  390. package/build/treb-format/src/number_format_section.d.ts +58 -0
  391. package/build/treb-format/src/number_format_section.js +78 -0
  392. package/build/treb-format/src/number_format_section.js.map +1 -0
  393. package/build/treb-format/src/value_parser.d.ts +48 -0
  394. package/build/treb-format/src/value_parser.js +244 -0
  395. package/build/treb-format/src/value_parser.js.map +1 -0
  396. package/build/treb-grid/src/editors/autocomplete.d.ts +39 -0
  397. package/build/treb-grid/src/editors/autocomplete.js +316 -0
  398. package/build/treb-grid/src/editors/autocomplete.js.map +1 -0
  399. package/build/treb-grid/src/editors/autocomplete_matcher.d.ts +74 -0
  400. package/build/treb-grid/src/editors/autocomplete_matcher.js +212 -0
  401. package/build/treb-grid/src/editors/autocomplete_matcher.js.map +1 -0
  402. package/build/treb-grid/src/editors/editor.d.ts +214 -0
  403. package/build/treb-grid/src/editors/editor.js +879 -0
  404. package/build/treb-grid/src/editors/editor.js.map +1 -0
  405. package/build/treb-grid/src/editors/external_editor.d.ts +11 -0
  406. package/build/treb-grid/src/editors/external_editor.js +118 -0
  407. package/build/treb-grid/src/editors/external_editor.js.map +1 -0
  408. package/build/treb-grid/src/editors/formula_bar.d.ts +85 -0
  409. package/build/treb-grid/src/editors/formula_bar.js +444 -0
  410. package/build/treb-grid/src/editors/formula_bar.js.map +1 -0
  411. package/build/treb-grid/src/editors/overlay_editor.d.ts +85 -0
  412. package/build/treb-grid/src/editors/overlay_editor.js +353 -0
  413. package/build/treb-grid/src/editors/overlay_editor.js.map +1 -0
  414. package/build/treb-grid/src/index.d.ts +12 -0
  415. package/build/treb-grid/src/index.js +28 -0
  416. package/build/treb-grid/src/index.js.map +1 -0
  417. package/build/treb-grid/src/layout/base_layout.d.ts +346 -0
  418. package/build/treb-grid/src/layout/base_layout.js +2050 -0
  419. package/build/treb-grid/src/layout/base_layout.js.map +1 -0
  420. package/build/treb-grid/src/layout/grid_layout.d.ts +19 -0
  421. package/build/treb-grid/src/layout/grid_layout.js +235 -0
  422. package/build/treb-grid/src/layout/grid_layout.js.map +1 -0
  423. package/build/treb-grid/src/layout/mock-layout.d.ts +10 -0
  424. package/build/treb-grid/src/layout/mock-layout.js +37 -0
  425. package/build/treb-grid/src/layout/mock-layout.js.map +1 -0
  426. package/build/treb-grid/src/render/selection-renderer.d.ts +97 -0
  427. package/build/treb-grid/src/render/selection-renderer.js +315 -0
  428. package/build/treb-grid/src/render/selection-renderer.js.map +1 -0
  429. package/build/treb-grid/src/render/svg_header_overlay.d.ts +20 -0
  430. package/build/treb-grid/src/render/svg_header_overlay.js +76 -0
  431. package/build/treb-grid/src/render/svg_header_overlay.js.map +1 -0
  432. package/build/treb-grid/src/render/svg_selection_block.d.ts +27 -0
  433. package/build/treb-grid/src/render/svg_selection_block.js +106 -0
  434. package/build/treb-grid/src/render/svg_selection_block.js.map +1 -0
  435. package/build/treb-grid/src/render/tile_renderer.d.ts +121 -0
  436. package/build/treb-grid/src/render/tile_renderer.js +1609 -0
  437. package/build/treb-grid/src/render/tile_renderer.js.map +1 -0
  438. package/build/treb-grid/src/types/border_constants.d.ts +9 -0
  439. package/build/treb-grid/src/types/border_constants.js +34 -0
  440. package/build/treb-grid/src/types/border_constants.js.map +1 -0
  441. package/build/treb-grid/src/types/clipboard_data.d.ts +11 -0
  442. package/build/treb-grid/src/types/clipboard_data.js +22 -0
  443. package/build/treb-grid/src/types/clipboard_data.js.map +1 -0
  444. package/build/treb-grid/src/types/clipboard_data2.d.ts +46 -0
  445. package/build/treb-grid/src/types/clipboard_data2.js +22 -0
  446. package/build/treb-grid/src/types/clipboard_data2.js.map +1 -0
  447. package/build/treb-grid/src/types/drag_mask.d.ts +10 -0
  448. package/build/treb-grid/src/types/drag_mask.js +78 -0
  449. package/build/treb-grid/src/types/drag_mask.js.map +1 -0
  450. package/build/treb-grid/src/types/external_editor_config.d.ts +33 -0
  451. package/build/treb-grid/src/types/external_editor_config.js +22 -0
  452. package/build/treb-grid/src/types/external_editor_config.js.map +1 -0
  453. package/build/treb-grid/src/types/grid.d.ts +806 -0
  454. package/build/treb-grid/src/types/grid.js +6410 -0
  455. package/build/treb-grid/src/types/grid.js.map +1 -0
  456. package/build/treb-grid/src/types/grid_base.d.ts +442 -0
  457. package/build/treb-grid/src/types/grid_base.js +3523 -0
  458. package/build/treb-grid/src/types/grid_base.js.map +1 -0
  459. package/build/treb-grid/src/types/grid_command.d.ts +408 -0
  460. package/build/treb-grid/src/types/grid_command.js +75 -0
  461. package/build/treb-grid/src/types/grid_command.js.map +1 -0
  462. package/build/treb-grid/src/types/grid_events.d.ts +93 -0
  463. package/build/treb-grid/src/types/grid_events.js +36 -0
  464. package/build/treb-grid/src/types/grid_events.js.map +1 -0
  465. package/build/treb-grid/src/types/grid_options.d.ts +50 -0
  466. package/build/treb-grid/src/types/grid_options.js +34 -0
  467. package/build/treb-grid/src/types/grid_options.js.map +1 -0
  468. package/build/treb-grid/src/types/scale-control.d.ts +21 -0
  469. package/build/treb-grid/src/types/scale-control.js +148 -0
  470. package/build/treb-grid/src/types/scale-control.js.map +1 -0
  471. package/build/treb-grid/src/types/set_range_options.d.ts +24 -0
  472. package/build/treb-grid/src/types/set_range_options.js +22 -0
  473. package/build/treb-grid/src/types/set_range_options.js.map +1 -0
  474. package/build/treb-grid/src/types/tab_bar.d.ts +84 -0
  475. package/build/treb-grid/src/types/tab_bar.js +426 -0
  476. package/build/treb-grid/src/types/tab_bar.js.map +1 -0
  477. package/build/treb-grid/src/types/tile.d.ts +29 -0
  478. package/build/treb-grid/src/types/tile.js +22 -0
  479. package/build/treb-grid/src/types/tile.js.map +1 -0
  480. package/build/treb-grid/src/types/update_flags.d.ts +48 -0
  481. package/build/treb-grid/src/types/update_flags.js +22 -0
  482. package/build/treb-grid/src/types/update_flags.js.map +1 -0
  483. package/build/treb-grid/src/util/fontmetrics.d.ts +21 -0
  484. package/build/treb-grid/src/util/fontmetrics.js +82 -0
  485. package/build/treb-grid/src/util/fontmetrics.js.map +1 -0
  486. package/build/treb-grid/src/util/ua.d.ts +33 -0
  487. package/build/treb-grid/src/util/ua.js +86 -0
  488. package/build/treb-grid/src/util/ua.js.map +1 -0
  489. package/build/treb-parser/src/csv-parser.d.ts +13 -0
  490. package/build/treb-parser/src/csv-parser.js +107 -0
  491. package/build/treb-parser/src/csv-parser.js.map +1 -0
  492. package/build/treb-parser/src/index.d.ts +4 -0
  493. package/build/treb-parser/src/index.js +25 -0
  494. package/build/treb-parser/src/index.js.map +1 -0
  495. package/build/treb-parser/src/md-parser.d.ts +97 -0
  496. package/build/treb-parser/src/md-parser.js +403 -0
  497. package/build/treb-parser/src/md-parser.js.map +1 -0
  498. package/build/treb-parser/src/parser-types.d.ts +345 -0
  499. package/build/treb-parser/src/parser-types.js +53 -0
  500. package/build/treb-parser/src/parser-types.js.map +1 -0
  501. package/build/treb-parser/src/parser.d.ts +422 -0
  502. package/build/treb-parser/src/parser.js +2418 -0
  503. package/build/treb-parser/src/parser.js.map +1 -0
  504. package/build/treb-utils/src/event_source.d.ts +34 -0
  505. package/build/treb-utils/src/event_source.js +110 -0
  506. package/build/treb-utils/src/event_source.js.map +1 -0
  507. package/build/treb-utils/src/ievent_source.d.ts +9 -0
  508. package/build/treb-utils/src/ievent_source.js +22 -0
  509. package/build/treb-utils/src/ievent_source.js.map +1 -0
  510. package/build/treb-utils/src/index.d.ts +6 -0
  511. package/build/treb-utils/src/index.js +30 -0
  512. package/build/treb-utils/src/index.js.map +1 -0
  513. package/build/treb-utils/src/measurement.d.ts +42 -0
  514. package/build/treb-utils/src/measurement.js +145 -0
  515. package/build/treb-utils/src/measurement.js.map +1 -0
  516. package/build/treb-utils/src/scale.d.ts +16 -0
  517. package/build/treb-utils/src/scale.js +106 -0
  518. package/build/treb-utils/src/scale.js.map +1 -0
  519. package/build/treb-utils/src/serialize_html.d.ts +5 -0
  520. package/build/treb-utils/src/serialize_html.js +128 -0
  521. package/build/treb-utils/src/serialize_html.js.map +1 -0
  522. package/build/treb-utils/src/validate_uri.d.ts +20 -0
  523. package/build/treb-utils/src/validate_uri.js +55 -0
  524. package/build/treb-utils/src/validate_uri.js.map +1 -0
  525. package/dist/{chunk-XD5PEZBZ.mjs → chunk-E35ONJUS.mjs} +1 -1
  526. package/dist/treb-export-worker.mjs +2 -2
  527. package/dist/treb-spreadsheet.mjs +4 -4
  528. package/package.json +1 -1
@@ -0,0 +1,444 @@
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2026 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+ // import type { Area, Cell, Theme } from 'treb-base-types';
22
+ import { Editor } from './editor';
23
+ import { Autocomplete } from './autocomplete';
24
+ import { DOMContext } from 'treb-base-types';
25
+ // ---
26
+ export class FormulaBar extends Editor {
27
+ options;
28
+ committed = false;
29
+ tolled;
30
+ /**
31
+ * if we're showing a spill array and it's not the first cell, show
32
+ * the formula using a shadow style (and it's not editable).
33
+ */
34
+ shadow_ = false;
35
+ get shadow() { return this.shadow_; }
36
+ set shadow(shadow) {
37
+ this.shadow_ = shadow;
38
+ if (this.active_editor?.node) {
39
+ if (shadow) {
40
+ this.active_editor.node.classList.add('treb-editor-shadow');
41
+ }
42
+ else {
43
+ this.active_editor.node.classList.remove('treb-editor-shadow');
44
+ }
45
+ }
46
+ }
47
+ /** is the _editor_ currently focused */
48
+ // tslint:disable-next-line:variable-name
49
+ focused_ = false;
50
+ /** accessor for focused field */
51
+ get focused() { return this.focused_; }
52
+ /** address label (may also show other things... ?) */
53
+ address_label_container;
54
+ /** address label (may also show other things... ?) */
55
+ address_label;
56
+ /** the function button (optional?) */
57
+ button;
58
+ /** */
59
+ expand_button;
60
+ /* * corner for resizing formula editor * /
61
+ private drag_corner!: HTMLDivElement;
62
+
63
+ / * * for math * /
64
+ private lines = 1;
65
+
66
+ private last_formula = '';
67
+ */
68
+ label_update_timer = 0;
69
+ /** get formula text */
70
+ get formula() {
71
+ return this.active_editor ? this.active_editor.node.textContent || '' : '';
72
+ }
73
+ /** set formula text */
74
+ set formula(text) {
75
+ if (this.active_editor) {
76
+ this.active_editor.node.textContent = text;
77
+ this.active_editor.formatted_text = undefined;
78
+ }
79
+ // this.last_formula = text;
80
+ }
81
+ /** get address label text */
82
+ get label() {
83
+ return this.address_label?.textContent || '';
84
+ }
85
+ /**
86
+ * set address label text. if the label is too long for the box,
87
+ * add a title attribute for a tooltip.
88
+ */
89
+ set label(text) {
90
+ if (!text.trim().length) {
91
+ this.address_label.innerHTML = '&nbsp;';
92
+ this.address_label.removeAttribute('title');
93
+ }
94
+ else {
95
+ this.address_label.textContent = text;
96
+ if (!this.label_update_timer) {
97
+ this.label_update_timer = requestAnimationFrame(() => {
98
+ this.label_update_timer = 0;
99
+ // should this be in a Yield callback? need to check IE11...
100
+ // yes
101
+ if (this.address_label.scrollWidth > this.address_label.offsetWidth) {
102
+ this.address_label.setAttribute('title', text);
103
+ }
104
+ else {
105
+ this.address_label.removeAttribute('title');
106
+ }
107
+ });
108
+ }
109
+ }
110
+ }
111
+ /** toggle editable property: supports locked cells */
112
+ set editable(editable) {
113
+ if (!this.active_editor || !this.container_node)
114
+ return;
115
+ if (editable) {
116
+ this.active_editor.node.setAttribute('contenteditable', 'true'); // is that required?
117
+ this.container_node.removeAttribute('locked');
118
+ }
119
+ else {
120
+ this.active_editor.node.removeAttribute('contenteditable');
121
+ this.container_node.setAttribute('locked', '');
122
+ }
123
+ }
124
+ constructor(container,
125
+ // parser: Parser,
126
+ // theme: Theme,
127
+ model, view, options, autocomplete) {
128
+ super(model, view, autocomplete);
129
+ this.options = options;
130
+ const DOM = DOMContext.GetInstance(container.ownerDocument);
131
+ const inner_node = container.querySelector('.treb-formula-bar');
132
+ inner_node.removeAttribute('hidden');
133
+ this.address_label_container = inner_node.querySelector('.treb-address-label');
134
+ this.address_label = this.address_label_container.firstElementChild;
135
+ this.InitAddressLabel();
136
+ /*
137
+ if (this.options.insert_function_button) {
138
+ this.button = DOM.Create('button', 'formula-button', inner_node);
139
+ this.button.addEventListener('click', () => {
140
+ const formula: string = this.active_editor ? this.active_editor.node.textContent || '' : '';
141
+ this.Publish({ type: 'formula-button', formula });
142
+ });
143
+ }
144
+ */
145
+ this.container_node = container.querySelector('.treb-editor-container');
146
+ const target = this.container_node.firstElementChild;
147
+ const descriptor = {
148
+ node: target,
149
+ };
150
+ this.active_editor = descriptor;
151
+ this.nodes = [descriptor];
152
+ // ------------------
153
+ if (target) {
154
+ this.RegisterListener(descriptor, 'input', (event) => {
155
+ // we send an extra event when we insert a reference.
156
+ // so filter that out. this might cause problems for other
157
+ // callers -- could we use a different filter?
158
+ if (event.isTrusted) {
159
+ this.UpdateText(descriptor);
160
+ this.UpdateColors(); // will send a local event
161
+ }
162
+ });
163
+ }
164
+ // ------------------
165
+ //
166
+ // change the default back. this was changed when we were trying to figure
167
+ // out what was happening with IME, but it had nothing to do with spellcheck.
168
+ //
169
+ this.active_editor.node.spellcheck = false; // change the default back
170
+ this.RegisterListener(descriptor, 'focusin', () => {
171
+ const restore = this.tolled !== undefined;
172
+ this.tolled = undefined;
173
+ // this.editor_node.addEventListener('focusin', () => {
174
+ // can't happen
175
+ if (!this.active_editor) {
176
+ return;
177
+ }
178
+ // console.info('focus in');
179
+ let text = this.active_editor.node.textContent || '';
180
+ if (this.shadow) {
181
+ this.shadow = false;
182
+ text = '';
183
+ this.active_editor.node.textContent = text;
184
+ this.active_editor.formatted_text = undefined; // why do we clear this here?
185
+ }
186
+ if (text[0] === '{' && text[text.length - 1] === '}') {
187
+ text = text.substring(1, text.length - 1);
188
+ this.active_editor.node.textContent = text;
189
+ this.active_editor.formatted_text = undefined; // why do we clear this here?
190
+ }
191
+ // not here // this.editor_node.spellcheck = (text[0] !== '='); // true except for functions
192
+ this.autocomplete?.ResetBlock();
193
+ this.UpdateText(this.active_editor);
194
+ this.UpdateColors(undefined, true); // toll update event -- we will send in order, below
195
+ if (restore) {
196
+ // FIXME: we probably want to hold the caret so we can restore
197
+ // to a particular place. or set the caret explicitly.
198
+ const node = this.NodeAtIndex(text.length - 1);
199
+ // console.info({text, node});
200
+ if (node) {
201
+ this.SetCaret({ node: node, offset: (node.textContent || '').length });
202
+ }
203
+ }
204
+ this.committed = false;
205
+ this.Publish([
206
+ { type: 'start-editing', editor: 'formula-bar' },
207
+ { type: 'update', text, cell: this.active_cell, dependencies: this.composite_dependencies },
208
+ ]);
209
+ this.focused_ = true;
210
+ });
211
+ this.RegisterListener(descriptor, 'focusout', (event) => {
212
+ // this is new, to support an external "insert function" dialog.
213
+ // still working out the semantics, but essentially we won't commit
214
+ // and we'll keep pending text. we need some sort of flag to indicate
215
+ // that we're in the editing state.
216
+ const toll = (event.relatedTarget instanceof HTMLElement && event.relatedTarget.dataset.tollEditor);
217
+ if (this.selecting) {
218
+ console.info('focusout, but selecting...');
219
+ }
220
+ this.autocomplete?.Hide();
221
+ const text = (this.active_editor ?
222
+ this.GetTextContent(this.active_editor.node).join('') : '').trim();
223
+ if (toll) {
224
+ let substring = text;
225
+ if (this.active_editor?.node) {
226
+ const s2c = this.SubstringToCaret2(this.active_editor.node, true);
227
+ substring = s2c[0];
228
+ }
229
+ this.committed = true;
230
+ this.tolled = {
231
+ text,
232
+ substring,
233
+ };
234
+ this.Publish({
235
+ type: 'toll',
236
+ value: text,
237
+ });
238
+ }
239
+ else if (this.committed) {
240
+ this.Publish([
241
+ { type: 'stop-editing' },
242
+ ]);
243
+ }
244
+ else {
245
+ this.committed = true;
246
+ this.Publish({
247
+ type: 'commit',
248
+ value: text,
249
+ });
250
+ }
251
+ // huh? we're publishing this twice?
252
+ this.Publish([
253
+ { type: 'stop-editing' },
254
+ ]);
255
+ this.focused_ = false;
256
+ if (this.active_editor) {
257
+ this.active_editor.node.spellcheck = false; // for firefox
258
+ }
259
+ });
260
+ this.RegisterListener(descriptor, 'keydown', this.FormulaKeyDown.bind(this));
261
+ this.RegisterListener(descriptor, 'keyup', this.FormulaKeyUp.bind(this));
262
+ // why is this here, instead of in markup? just an oversight?
263
+ if (this.options.expand_formula_button) {
264
+ let focus_related_target;
265
+ this.expand_button = DOM.Create('button', 'expand-button', inner_node, {
266
+ events: {
267
+ focus: (event) => {
268
+ focus_related_target = event.relatedTarget instanceof HTMLElement ? event.relatedTarget : undefined;
269
+ },
270
+ click: (event) => {
271
+ event.stopPropagation();
272
+ event.preventDefault();
273
+ if (this.active_editor) {
274
+ this.active_editor.node.scrollTop = 0;
275
+ }
276
+ if (inner_node.hasAttribute('expanded')) {
277
+ inner_node.removeAttribute('expanded');
278
+ }
279
+ else {
280
+ inner_node.setAttribute('expanded', '');
281
+ }
282
+ if (focus_related_target) {
283
+ focus_related_target.focus();
284
+ }
285
+ },
286
+ },
287
+ });
288
+ }
289
+ }
290
+ /**
291
+ * we might be overthinking this, we don't necessarily need to restore.
292
+ *
293
+ * this method will focus the editor and set the caret (to the end, atm)
294
+ * in case of a tolled editor. the idea is you call Restore() after your
295
+ * dialog is complete and it's like you are back where you started.
296
+ *
297
+ * alternatively, call `Release()` to clean up any saved state.
298
+ */
299
+ Restore() {
300
+ const target = this.container_node?.firstElementChild;
301
+ if (target) {
302
+ target.focus();
303
+ }
304
+ }
305
+ /**
306
+ * release anything that's been tolled. call this if you toll the editor
307
+ * but don't want to restore it when you are done. I think this will be
308
+ * the default.
309
+ */
310
+ Release() {
311
+ this.tolled = undefined;
312
+ }
313
+ IsElement(element) {
314
+ return element === this.active_editor?.node;
315
+ }
316
+ IsExpandButton(element) {
317
+ return this.expand_button && (element === this.expand_button);
318
+ }
319
+ InitAddressLabel() {
320
+ this.address_label.contentEditable = 'true';
321
+ this.address_label.spellcheck = false;
322
+ // on focus, select all
323
+ // Q: do we do this in other places? we should consolidate
324
+ // A: I don't think we do just this, usually there's additional logic for % and such
325
+ this.address_label.addEventListener('focusin', () => {
326
+ const doc = this.address_label.ownerDocument;
327
+ // FIXME: close any open editors? (...)
328
+ // we're now doing this async for all browsers... it's only really
329
+ // necessary for IE11 and safari, but doesn't hurt
330
+ requestAnimationFrame(() => {
331
+ const selection = doc.defaultView.getSelection();
332
+ const range = doc.createRange();
333
+ range.selectNodeContents(this.address_label);
334
+ selection?.removeAllRanges();
335
+ selection?.addRange(range);
336
+ });
337
+ });
338
+ this.address_label.addEventListener('keydown', (event) => {
339
+ if (event.isComposing) {
340
+ return;
341
+ }
342
+ switch (event.key) {
343
+ case 'Enter':
344
+ event.stopPropagation();
345
+ event.preventDefault();
346
+ this.Publish({
347
+ type: 'address-label-event',
348
+ text: this.address_label.textContent || undefined,
349
+ });
350
+ break;
351
+ case 'Esc':
352
+ case 'Escape':
353
+ event.stopPropagation();
354
+ event.preventDefault();
355
+ this.Publish({ type: 'address-label-event' });
356
+ break;
357
+ }
358
+ });
359
+ }
360
+ GetTextContent(node) {
361
+ const children = node.childNodes;
362
+ const buffer = [];
363
+ for (let i = 0; i < children.length; i++) {
364
+ const child = children[i];
365
+ switch (child.nodeType) {
366
+ case Node.ELEMENT_NODE:
367
+ buffer.push(...this.GetTextContent(child));
368
+ if (child instanceof Element && child.tagName === 'DIV') {
369
+ buffer.push('\n');
370
+ }
371
+ break;
372
+ case Node.TEXT_NODE:
373
+ if (child.nodeValue) {
374
+ buffer.push(child.nodeValue);
375
+ }
376
+ break;
377
+ }
378
+ }
379
+ return buffer;
380
+ }
381
+ FormulaKeyUp(event) {
382
+ if (event.isComposing) {
383
+ return;
384
+ }
385
+ if (this.autocomplete) {
386
+ const ac_result = this.autocomplete.HandleKey('keyup', event);
387
+ if (ac_result.handled) {
388
+ return;
389
+ }
390
+ // this.FlushReference();
391
+ }
392
+ }
393
+ FormulaKeyDown(event) {
394
+ if (event.isComposing) {
395
+ return;
396
+ }
397
+ if (this.autocomplete) {
398
+ const ac_result = this.autocomplete.HandleKey('keydown', event);
399
+ if (ac_result.accept)
400
+ this.AcceptAutocomplete(ac_result);
401
+ if (ac_result.handled)
402
+ return;
403
+ }
404
+ switch (event.key) {
405
+ case 'F4':
406
+ if (this.selecting) {
407
+ this.Publish({ type: 'toggle-reference' });
408
+ }
409
+ break;
410
+ case 'Enter':
411
+ case 'Tab':
412
+ {
413
+ // this.selecting_ = false;
414
+ const array = (event.key === 'Enter' && event.ctrlKey && event.shiftKey);
415
+ // I think we use this nontstandard routine so that we preserve
416
+ // newlines? not sure. would like to see the motivation for it.
417
+ const text = (this.active_editor ?
418
+ this.GetTextContent(this.active_editor.node).join('') : '').trim();
419
+ this.committed = true;
420
+ this.Publish({
421
+ type: 'commit',
422
+ // selection: this.selection,
423
+ value: text,
424
+ event,
425
+ array,
426
+ });
427
+ // this.FlushReference();
428
+ }
429
+ break;
430
+ case 'Escape':
431
+ case 'Esc':
432
+ // this.selecting_ = false;
433
+ this.committed = true;
434
+ this.Publish({ type: 'discard' });
435
+ // this.FlushReference();
436
+ break;
437
+ default:
438
+ return;
439
+ }
440
+ event.stopPropagation();
441
+ event.preventDefault();
442
+ }
443
+ }
444
+ //# sourceMappingURL=formula_bar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formula_bar.js","sourceRoot":"","sources":["../../../../treb-grid/src/editors/formula_bar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4DAA4D;AAC5D,OAAO,EAAE,MAAM,EAAgD,MAAM,UAAU,CAAC;AAIhF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAsC7C,MAAM;AAEN,MAAM,OAAO,UAAW,SAAQ,MAA2C;IAiI/D;IA9HH,SAAS,GAAG,KAAK,CAAC;IAElB,MAAM,CAAuC;IAEpD;;;OAGG;IACI,OAAO,GAAG,KAAK,CAAC;IAEvB,IAAW,MAAM,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5C,IAAW,MAAM,CAAC,MAAe;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC;YAC7B,IAAI,MAAM,EAAE,CAAC;gBACX,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;YAC9D,CAAC;iBACI,CAAC;gBACJ,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;YAClE,CAAC;QACF,CAAC;IACH,CAAC;IAED,wCAAwC;IACxC,yCAAyC;IAClC,QAAQ,GAAG,KAAK,CAAC;IAExB,iCAAiC;IACjC,IAAW,OAAO,KAAc,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AAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;oBAErE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;oBACtB,IAAI,CAAC,OAAO,CAAC;wBACX,IAAI,EAAE,QAAQ;wBACd,6BAA6B;wBAC7B,KAAK,EAAE,IAAI;wBACX,KAAK;wBACL,KAAK;qBACN,CAAC,CAAC;oBAEH,yBAAyB;gBAC3B,CAAC;gBACD,MAAM;YAER,KAAK,QAAQ,CAAC;YACd,KAAK,KAAK;gBACR,2BAA2B;gBAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;gBACtB,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;gBAClC,yBAAyB;gBACzB,MAAM;YAER;gBACE,OAAO;QACT,CAAC;QAED,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,KAAK,CAAC,cAAc,EAAE,CAAC;IAEzB,CAAC;CAEF"}
@@ -0,0 +1,85 @@
1
+ import { Editor } from './editor';
2
+ import { Cell, type CellStyle, type CellValue, Rectangle, type Theme } from 'treb-base-types';
3
+ import { DataModel, type ViewModel, type GridSelection } from 'treb-data-model';
4
+ import { Autocomplete } from './autocomplete';
5
+ export type OverlayEditorResult = 'handled' | 'commit' | 'discard';
6
+ /**
7
+ * but when to send it?
8
+ */
9
+ export interface ResetSelectionEvent {
10
+ type: 'reset-selection';
11
+ }
12
+ export declare class OverlayEditor extends Editor<ResetSelectionEvent> {
13
+ private container;
14
+ private theme;
15
+ /**
16
+ * selection being edited. note that this is private rather than protected
17
+ * in an effort to prevent subclasses from accidentally using shallow copies
18
+ */
19
+ private internal_selection;
20
+ /** accessor for selection */
21
+ get selection(): GridSelection;
22
+ /** set selection, deep copy */
23
+ set selection(rhs: GridSelection);
24
+ /** possibly carrying over a font face (+size?) */
25
+ edit_style?: CellStyle;
26
+ /**
27
+ * this is a flag used to indicate when we need to reset the selection.
28
+ * the issue has to do with selecting cells via arrow keys; if you do
29
+ * that twice, the second time the selection starts on the cell you
30
+ * selected the first time. so we want to fix that.
31
+ *
32
+ * I guess that used to work with an 'end-selection' event (although it
33
+ * didn't change the sheet) but that doesn't happen anymore because
34
+ * selecting state is determined dynamically now.
35
+ */
36
+ reset_selection: boolean;
37
+ /** we could use the descriptor reference */
38
+ edit_node: HTMLElement & ElementContentEditable;
39
+ /** narrowing from superclass */
40
+ container_node: HTMLElement;
41
+ /** special node for ICE */
42
+ edit_inset: HTMLElement;
43
+ scale: number;
44
+ /** shadow property */
45
+ private internal_editing;
46
+ /** accessor */
47
+ get editing(): boolean;
48
+ /**
49
+ * this is only set one time for each state, so it would be more
50
+ * efficient to inline it unless that's going to change
51
+ */
52
+ protected set editing(state: boolean);
53
+ constructor(container: HTMLElement, theme: Theme, model: DataModel, view: ViewModel, autocomplete: Autocomplete);
54
+ UpdateCaption(text?: string): void;
55
+ Focus(text?: string): void;
56
+ CloseEditor(): void;
57
+ /**
58
+ * remove contents, plus add mozilla junk node
59
+ */
60
+ ClearContents(): void;
61
+ /**
62
+ * start editing. I'm not sure why we're passing the selection around,
63
+ * but I don't want to take it out until I can answer that question.
64
+ *
65
+ * something to do with keyboard selection? (which needs to be fixed)?
66
+ */
67
+ Edit(gridselection: GridSelection, rect: Rectangle, cell: Cell, value?: CellValue, event?: Event, edit_style?: CellStyle): void;
68
+ GetEditState(): {
69
+ text: string;
70
+ substring: string;
71
+ };
72
+ /**
73
+ * check if we want to handle this key. we have some special cases (tab,
74
+ * enter, escape) where we do take some action but we also let the
75
+ * spreadsheet handle the key. for those we have some additional return
76
+ * values.
77
+ *
78
+ * NOTE this is *not* added as an event handler -- it's called by the grid
79
+ *
80
+ * @param event
81
+ * @returns
82
+ */
83
+ HandleKeyDown(event: KeyboardEvent): OverlayEditorResult | undefined;
84
+ UpdateScale(scale: number): void;
85
+ }