slick-table 0.0.15 → 0.0.16

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 (340) hide show
  1. package/.prettierignore +2 -0
  2. package/.prettierrc +22 -0
  3. package/dist/tsconfig.build-types.tsbuildinfo +1 -1
  4. package/dist/types/index.d.ts +2 -1
  5. package/dist/types/index.d.ts.map +1 -1
  6. package/eslint.config.js +23 -0
  7. package/index.html +13 -0
  8. package/package.json +9 -5
  9. package/src/App.tsx +9 -0
  10. package/src/app/styles/global.scss +31 -0
  11. package/src/app/styles/slickgrid.scss +13 -0
  12. package/src/app/types/index.d.ts +9 -0
  13. package/src/entities/portal/index.ts +3 -0
  14. package/src/entities/portal/lib/index.ts +1 -0
  15. package/src/entities/portal/lib/visibility/index.ts +1 -0
  16. package/src/entities/portal/lib/visibility/makeVisible.ts +9 -0
  17. package/src/entities/portal/model/index.ts +1 -0
  18. package/src/entities/portal/model/portalId.ts +1 -0
  19. package/src/entities/portal/ui/Overlay/Overlay.style.ts +14 -0
  20. package/src/entities/portal/ui/Overlay/Overlay.test.tsx +19 -0
  21. package/src/entities/portal/ui/Overlay/Overlay.tsx +20 -0
  22. package/src/entities/portal/ui/Overlay/index.ts +1 -0
  23. package/src/entities/portal/ui/Portal.style.ts +20 -0
  24. package/src/entities/portal/ui/Portal.test.tsx +48 -0
  25. package/src/entities/portal/ui/Portal.tsx +26 -0
  26. package/src/entities/portal/ui/index.ts +1 -0
  27. package/src/features/column-filters/index.ts +1 -0
  28. package/src/features/column-filters/lib/filter/applyFilter.ts +25 -0
  29. package/src/features/column-filters/lib/filter/index.ts +1 -0
  30. package/src/features/column-filters/lib/hooks/index.ts +2 -0
  31. package/src/features/column-filters/lib/hooks/useOpenMenu.ts +43 -0
  32. package/src/features/column-filters/lib/hooks/useSubscribeToEvent.ts +17 -0
  33. package/src/features/column-filters/lib/index.ts +4 -0
  34. package/src/features/column-filters/lib/props/datePickerProps.tsx +11 -0
  35. package/src/features/column-filters/lib/props/index.ts +1 -0
  36. package/src/features/column-filters/lib/select/firstIn.ts +22 -0
  37. package/src/features/column-filters/lib/select/index.ts +1 -0
  38. package/src/features/column-filters/model/consts/defaultValue.ts +6 -0
  39. package/src/features/column-filters/model/consts/index.ts +2 -0
  40. package/src/features/column-filters/model/consts/label.ts +5 -0
  41. package/src/features/column-filters/model/index.ts +2 -0
  42. package/src/features/column-filters/model/types/IProps.ts +9 -0
  43. package/src/features/column-filters/model/types/index.ts +1 -0
  44. package/src/features/column-filters/ui/BooleanInput/BooleanInput.style.ts +10 -0
  45. package/src/features/column-filters/ui/BooleanInput/BooleanInput.tsx +53 -0
  46. package/src/features/column-filters/ui/BooleanInput/index.ts +1 -0
  47. package/src/features/column-filters/ui/ButtonReset/ButtonReset.style.ts +10 -0
  48. package/src/features/column-filters/ui/ButtonReset/ButtonReset.tsx +39 -0
  49. package/src/features/column-filters/ui/ButtonReset/index.ts +1 -0
  50. package/src/features/column-filters/ui/ColumnFilters.style.ts +12 -0
  51. package/src/features/column-filters/ui/ColumnFilters.tsx +41 -0
  52. package/src/features/column-filters/ui/DateBetween/DateBetween.tsx +52 -0
  53. package/src/features/column-filters/ui/DateBetween/index.ts +1 -0
  54. package/src/features/column-filters/ui/DateInput/DateInput.tsx +36 -0
  55. package/src/features/column-filters/ui/DateInput/index.ts +1 -0
  56. package/src/features/column-filters/ui/InputArea/InputArea.tsx +63 -0
  57. package/src/features/column-filters/ui/InputArea/index.ts +1 -0
  58. package/src/features/column-filters/ui/MultipleSelect/index.ts +1 -0
  59. package/src/features/column-filters/ui/MultipleSelect/lib/index.ts +2 -0
  60. package/src/features/column-filters/ui/MultipleSelect/lib/props/index.ts +1 -0
  61. package/src/features/column-filters/ui/MultipleSelect/lib/props/props.ts +36 -0
  62. package/src/features/column-filters/ui/MultipleSelect/lib/sorting/ascending.ts +17 -0
  63. package/src/features/column-filters/ui/MultipleSelect/lib/sorting/index.ts +1 -0
  64. package/src/features/column-filters/ui/MultipleSelect/model/IValue.ts +1 -0
  65. package/src/features/column-filters/ui/MultipleSelect/model/index.ts +1 -0
  66. package/src/features/column-filters/ui/MultipleSelect/ui/MultipleSelect.style.ts +9 -0
  67. package/src/features/column-filters/ui/MultipleSelect/ui/MultipleSelect.tsx +72 -0
  68. package/src/features/column-filters/ui/MultipleSelect/ui/index.ts +1 -0
  69. package/src/features/column-filters/ui/NumberBetween/NumberBetween.tsx +42 -0
  70. package/src/features/column-filters/ui/NumberBetween/index.ts +1 -0
  71. package/src/features/column-filters/ui/NumberInput/NumberInput.tsx +24 -0
  72. package/src/features/column-filters/ui/NumberInput/index.ts +1 -0
  73. package/src/features/column-filters/ui/SelectFilter/index.ts +1 -0
  74. package/src/features/column-filters/ui/SelectFilter/model/index.ts +1 -0
  75. package/src/features/column-filters/ui/SelectFilter/model/options/index.ts +1 -0
  76. package/src/features/column-filters/ui/SelectFilter/model/options/options.ts +66 -0
  77. package/src/features/column-filters/ui/SelectFilter/ui/SelectFilter.tsx +50 -0
  78. package/src/features/column-filters/ui/SelectFilter/ui/index.ts +1 -0
  79. package/src/features/column-filters/ui/TextInput/TextInput.tsx +23 -0
  80. package/src/features/column-filters/ui/TextInput/index.ts +1 -0
  81. package/src/features/column-filters/ui/index.ts +1 -0
  82. package/src/features/context-menu/index.ts +1 -0
  83. package/src/features/context-menu/lib/hooks/index.ts +1 -0
  84. package/src/features/context-menu/lib/hooks/useSubscribeToEvent.ts +25 -0
  85. package/src/features/context-menu/lib/index.ts +1 -0
  86. package/src/features/context-menu/ui/ButtonDownloadCSV/ButtonDownloadCSV.tsx +34 -0
  87. package/src/features/context-menu/ui/ButtonDownloadCSV/index.ts +1 -0
  88. package/src/features/context-menu/ui/ButtonGroup/ButtonGroup.tsx +28 -0
  89. package/src/features/context-menu/ui/ButtonGroup/index.ts +1 -0
  90. package/src/features/context-menu/ui/ButtonResetFilters/index.ts +1 -0
  91. package/src/features/context-menu/ui/ButtonResetFilters/lib/index.ts +1 -0
  92. package/src/features/context-menu/ui/ButtonResetFilters/lib/visibility/hasFiltersApplied.ts +8 -0
  93. package/src/features/context-menu/ui/ButtonResetFilters/lib/visibility/index.ts +1 -0
  94. package/src/features/context-menu/ui/ButtonResetFilters/ui/ButtonResetFilters.tsx +39 -0
  95. package/src/features/context-menu/ui/ButtonResetFilters/ui/index.ts +1 -0
  96. package/src/features/context-menu/ui/ButtonUngroup/ButtonUngroup.tsx +28 -0
  97. package/src/features/context-menu/ui/ButtonUngroup/index.ts +1 -0
  98. package/src/features/context-menu/ui/CollapseAll/CollapseAll.tsx +31 -0
  99. package/src/features/context-menu/ui/CollapseAll/index.ts +1 -0
  100. package/src/features/context-menu/ui/ContextMenu.style.ts +29 -0
  101. package/src/features/context-menu/ui/ContextMenu.tsx +51 -0
  102. package/src/features/context-menu/ui/CopyToClipboard/CopyToClipboard.tsx +42 -0
  103. package/src/features/context-menu/ui/CopyToClipboard/index.ts +1 -0
  104. package/src/features/context-menu/ui/ExpandAll/ExpandAll.tsx +30 -0
  105. package/src/features/context-menu/ui/ExpandAll/index.ts +1 -0
  106. package/src/features/context-menu/ui/Print/index.ts +1 -0
  107. package/src/features/context-menu/ui/Print/ui/Print.tsx +25 -0
  108. package/src/features/context-menu/ui/Print/ui/index.ts +1 -0
  109. package/src/features/context-menu/ui/index.ts +1 -0
  110. package/src/index.scss +2 -0
  111. package/src/index.ts +2 -0
  112. package/src/main.tsx +15 -0
  113. package/src/pages/main/index.ts +1 -0
  114. package/src/pages/main/lib/columns.ts +33 -0
  115. package/src/pages/main/lib/index.ts +3 -0
  116. package/src/pages/main/lib/options.ts +6 -0
  117. package/src/pages/main/lib/table.ts +11 -0
  118. package/src/pages/main/ui/Main.style.ts +18 -0
  119. package/src/pages/main/ui/Main.tsx +30 -0
  120. package/src/pages/main/ui/index.ts +1 -0
  121. package/src/setupTests.ts +5 -0
  122. package/src/shared/lib/an-event/index.ts +31 -0
  123. package/src/shared/lib/datetime/dateToString.spec.ts +11 -0
  124. package/src/shared/lib/datetime/dateToString.ts +8 -0
  125. package/src/shared/lib/datetime/getTime.spec.ts +10 -0
  126. package/src/shared/lib/datetime/getTime.ts +3 -0
  127. package/src/shared/lib/datetime/index.ts +2 -0
  128. package/src/shared/lib/debounce/index.ts +11 -0
  129. package/src/shared/lib/dom/elementNotVisible.spec.ts +72 -0
  130. package/src/shared/lib/dom/elementNotVisible.ts +9 -0
  131. package/src/shared/lib/dom/index.ts +1 -0
  132. package/src/shared/lib/format/IOptions.ts +11 -0
  133. package/src/shared/lib/format/addParentheses.spec.ts +9 -0
  134. package/src/shared/lib/format/addParentheses.ts +7 -0
  135. package/src/shared/lib/format/formatNumber.spec.ts +50 -0
  136. package/src/shared/lib/format/formatNumber.ts +62 -0
  137. package/src/shared/lib/format/index.ts +2 -0
  138. package/src/shared/lib/numbers/index.ts +1 -0
  139. package/src/shared/lib/numbers/toNumber.spec.ts +25 -0
  140. package/src/shared/lib/numbers/toNumber.ts +11 -0
  141. package/src/shared/lib/regexp/dates.spec.ts +23 -0
  142. package/src/shared/lib/regexp/dates.ts +6 -0
  143. package/src/shared/lib/regexp/escapeSpecialChar.spec.ts +24 -0
  144. package/src/shared/lib/regexp/escapeSpecialChar.ts +4 -0
  145. package/src/shared/lib/regexp/index.ts +2 -0
  146. package/src/shared/lib/slickgrid/index.ts +68 -0
  147. package/src/shared/lib/slickgrid/lib/callbacks/getOnKeyDownCallback.ts +12 -0
  148. package/src/shared/lib/slickgrid/lib/callbacks/index.ts +4 -0
  149. package/src/shared/lib/slickgrid/lib/callbacks/onCellChange.ts +14 -0
  150. package/src/shared/lib/slickgrid/lib/callbacks/onRowCountChanged.ts +12 -0
  151. package/src/shared/lib/slickgrid/lib/callbacks/onRowsChanged.ts +8 -0
  152. package/src/shared/lib/slickgrid/lib/contextMenu/index.ts +1 -0
  153. package/src/shared/lib/slickgrid/lib/contextMenu/openContextMenu.ts +17 -0
  154. package/src/shared/lib/slickgrid/lib/editors/Autocomplete/Autocomplete.ts +152 -0
  155. package/src/shared/lib/slickgrid/lib/editors/Autocomplete/EditorAutocomplete.ts +66 -0
  156. package/src/shared/lib/slickgrid/lib/editors/Autocomplete/EditorSelectWithSearch.ts +79 -0
  157. package/src/shared/lib/slickgrid/lib/editors/Autocomplete/index.ts +3 -0
  158. package/src/shared/lib/slickgrid/lib/editors/EditorAmount.ts +82 -0
  159. package/src/shared/lib/slickgrid/lib/editors/EditorDate.ts +127 -0
  160. package/src/shared/lib/slickgrid/lib/editors/EditorSelectNumber.ts +16 -0
  161. package/src/shared/lib/slickgrid/lib/editors/EditorSelectString.ts +95 -0
  162. package/src/shared/lib/slickgrid/lib/editors/index.ts +9 -0
  163. package/src/shared/lib/slickgrid/lib/formatters/DateFormatter.ts +9 -0
  164. package/src/shared/lib/slickgrid/lib/formatters/FormatterCheck.ts +11 -0
  165. package/src/shared/lib/slickgrid/lib/formatters/PercentFormatter.spec.ts +11 -0
  166. package/src/shared/lib/slickgrid/lib/formatters/PercentFormatter.ts +8 -0
  167. package/src/shared/lib/slickgrid/lib/formatters/StringFormatter.ts +2 -0
  168. package/src/shared/lib/slickgrid/lib/formatters/getFormatterNumber.ts +17 -0
  169. package/src/shared/lib/slickgrid/lib/formatters/index.ts +5 -0
  170. package/src/shared/lib/slickgrid/lib/functions/addNewRow.ts +23 -0
  171. package/src/shared/lib/slickgrid/lib/functions/commitCurrentEdit.ts +6 -0
  172. package/src/shared/lib/slickgrid/lib/functions/copySelectedRows.ts +35 -0
  173. package/src/shared/lib/slickgrid/lib/functions/deleteRows.ts +20 -0
  174. package/src/shared/lib/slickgrid/lib/functions/getActiveRowId.ts +16 -0
  175. package/src/shared/lib/slickgrid/lib/functions/getDisplayedRows.ts +13 -0
  176. package/src/shared/lib/slickgrid/lib/functions/getLastRow.ts +6 -0
  177. package/src/shared/lib/slickgrid/lib/functions/getMaxId.ts +13 -0
  178. package/src/shared/lib/slickgrid/lib/functions/index.ts +10 -0
  179. package/src/shared/lib/slickgrid/lib/functions/isDeletionDangerous.ts +21 -0
  180. package/src/shared/lib/slickgrid/lib/functions/wereEdited.ts +12 -0
  181. package/src/shared/lib/slickgrid/lib/grouping/index.ts +1 -0
  182. package/src/shared/lib/slickgrid/lib/grouping/sumTotalsFormatter.ts +21 -0
  183. package/src/shared/lib/slickgrid/lib/highlighting/getColumnsHash.ts +8 -0
  184. package/src/shared/lib/slickgrid/lib/highlighting/highlightCell.ts +21 -0
  185. package/src/shared/lib/slickgrid/lib/highlighting/highlightColumns.ts +24 -0
  186. package/src/shared/lib/slickgrid/lib/highlighting/index.ts +2 -0
  187. package/src/shared/lib/slickgrid/lib/hooks/eventClickOnTable.ts +17 -0
  188. package/src/shared/lib/slickgrid/lib/hooks/index.ts +3 -0
  189. package/src/shared/lib/slickgrid/lib/hooks/useHotKeys.ts +39 -0
  190. package/src/shared/lib/slickgrid/lib/hooks/useListenIfTablesWereEdited.ts +36 -0
  191. package/src/shared/lib/slickgrid/lib/hooks/useUpdateTotal.ts +19 -0
  192. package/src/shared/lib/slickgrid/lib/hotKeys/hotKeysCopy.ts +7 -0
  193. package/src/shared/lib/slickgrid/lib/hotKeys/hotKeysDelete.ts +7 -0
  194. package/src/shared/lib/slickgrid/lib/hotKeys/hotKeysRedo.ts +7 -0
  195. package/src/shared/lib/slickgrid/lib/hotKeys/hotKeysReverse.ts +7 -0
  196. package/src/shared/lib/slickgrid/lib/hotKeys/hotKeysUndo.ts +7 -0
  197. package/src/shared/lib/slickgrid/lib/hotKeys/index.ts +7 -0
  198. package/src/shared/lib/slickgrid/lib/hotKeys/nothingToCopy.ts +14 -0
  199. package/src/shared/lib/slickgrid/lib/hotKeys/positionToPaste.ts +12 -0
  200. package/src/shared/lib/slickgrid/lib/index.ts +59 -0
  201. package/src/shared/lib/slickgrid/lib/selection/getUpdates.ts +41 -0
  202. package/src/shared/lib/slickgrid/lib/selection/index.ts +2 -0
  203. package/src/shared/lib/slickgrid/lib/selection/selectedRows.ts +17 -0
  204. package/src/shared/lib/slickgrid/lib/sorting/ColumnSorter.ts +89 -0
  205. package/src/shared/lib/slickgrid/lib/sorting/index.ts +1 -0
  206. package/src/shared/lib/slickgrid/lib/totals-row/addTitle.ts +8 -0
  207. package/src/shared/lib/slickgrid/lib/totals-row/addTotalSum.ts +16 -0
  208. package/src/shared/lib/slickgrid/lib/totals-row/index.ts +2 -0
  209. package/src/shared/lib/slickgrid/lib/totals-row/totalAmountOf.ts +13 -0
  210. package/src/shared/lib/slickgrid/lib/totals-row/updateTotal.ts +25 -0
  211. package/src/shared/lib/slickgrid/lib/totals-row/updateTotals.ts +10 -0
  212. package/src/shared/lib/slickgrid/lib/validators/DateValidator.ts +12 -0
  213. package/src/shared/lib/slickgrid/lib/validators/EmptyStringValidator.ts +5 -0
  214. package/src/shared/lib/slickgrid/lib/validators/LengthValidator.ts +7 -0
  215. package/src/shared/lib/slickgrid/lib/validators/index.ts +3 -0
  216. package/src/shared/lib/slickgrid/model/SlickTable/csvDownloadManager/DownloadManager.ts +110 -0
  217. package/src/shared/lib/slickgrid/model/SlickTable/csvDownloadManager/index.ts +1 -0
  218. package/src/shared/lib/slickgrid/model/SlickTable/filters/DeletedRowsFilter.test.ts +36 -0
  219. package/src/shared/lib/slickgrid/model/SlickTable/filters/DeletedRowsFilter.ts +12 -0
  220. package/src/shared/lib/slickgrid/model/SlickTable/filters/Filter.ts +54 -0
  221. package/src/shared/lib/slickgrid/model/SlickTable/filters/WithoutFilter.ts +30 -0
  222. package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/ColumnFilter/DecoratorColumnFilter.ts +53 -0
  223. package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/ColumnFilter/Filter.ts +108 -0
  224. package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/ColumnFilter/index.ts +1 -0
  225. package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/DecoratorEndingDate.ts +16 -0
  226. package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/DecoratorFilter.ts +55 -0
  227. package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/DecoratorPeriod.ts +24 -0
  228. package/src/shared/lib/slickgrid/model/SlickTable/filters/decorators/index.ts +4 -0
  229. package/src/shared/lib/slickgrid/model/SlickTable/filters/index.ts +9 -0
  230. package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/DefaultHotKeys.ts +118 -0
  231. package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/WithoutHotKeys.ts +20 -0
  232. package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/HotKeysDecorator.ts +32 -0
  233. package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/PreventCopying.ts +21 -0
  234. package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/RedoUndoOnly.ts +25 -0
  235. package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/WithConfirmationOfDeletion.ts +33 -0
  236. package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/decorators/index.ts +4 -0
  237. package/src/shared/lib/slickgrid/model/SlickTable/hotKeys/index.ts +9 -0
  238. package/src/shared/lib/slickgrid/model/SlickTable/index.ts +18 -0
  239. package/src/shared/lib/slickgrid/model/SlickTable/printer/DefaultPrinter.ts +179 -0
  240. package/src/shared/lib/slickgrid/model/SlickTable/printer/index.ts +1 -0
  241. package/src/shared/lib/slickgrid/model/SlickTable/printer/model/consts/cssStyles.ts +46 -0
  242. package/src/shared/lib/slickgrid/model/SlickTable/printer/model/consts/index.ts +1 -0
  243. package/src/shared/lib/slickgrid/model/SlickTable/printer/model/index.ts +1 -0
  244. package/src/shared/lib/slickgrid/model/SlickTable/table/SlickTable.ts +148 -0
  245. package/src/shared/lib/slickgrid/model/SlickTable/table/index.ts +1 -0
  246. package/src/shared/lib/slickgrid/model/events/eventContextMenu.ts +10 -0
  247. package/src/shared/lib/slickgrid/model/events/index.ts +1 -0
  248. package/src/shared/lib/slickgrid/model/index.ts +17 -0
  249. package/src/shared/lib/slickgrid/ui/HeaderButtons/index.ts +2 -0
  250. package/src/shared/lib/slickgrid/ui/HeaderButtons/lib/handleClick/handleHeaderButtons.ts +27 -0
  251. package/src/shared/lib/slickgrid/ui/HeaderButtons/lib/handleClick/index.ts +1 -0
  252. package/src/shared/lib/slickgrid/ui/HeaderButtons/lib/highlighting/headerButtons.ts +45 -0
  253. package/src/shared/lib/slickgrid/ui/HeaderButtons/lib/highlighting/index.ts +1 -0
  254. package/src/shared/lib/slickgrid/ui/HeaderButtons/lib/index.ts +2 -0
  255. package/src/shared/lib/slickgrid/ui/HeaderButtons/model/buttons/index.ts +1 -0
  256. package/src/shared/lib/slickgrid/ui/HeaderButtons/model/buttons/openColumnFilter.ts +10 -0
  257. package/src/shared/lib/slickgrid/ui/HeaderButtons/model/event/eventOpenColumnFilters.ts +13 -0
  258. package/src/shared/lib/slickgrid/ui/HeaderButtons/model/event/index.ts +1 -0
  259. package/src/shared/lib/slickgrid/ui/HeaderButtons/model/index.ts +2 -0
  260. package/src/shared/lib/slickgrid/ui/SlickgridTable/index.ts +1 -0
  261. package/src/shared/lib/slickgrid/ui/SlickgridTable/lib/callbacks/index.ts +1 -0
  262. package/src/shared/lib/slickgrid/ui/SlickgridTable/lib/callbacks/onAddNewRow.ts +34 -0
  263. package/src/shared/lib/slickgrid/ui/SlickgridTable/lib/hooks/index.ts +1 -0
  264. package/src/shared/lib/slickgrid/ui/SlickgridTable/lib/hooks/useGrid.ts +140 -0
  265. package/src/shared/lib/slickgrid/ui/SlickgridTable/lib/index.ts +2 -0
  266. package/src/shared/lib/slickgrid/ui/SlickgridTable/model/defaultOptions.ts +8 -0
  267. package/src/shared/lib/slickgrid/ui/SlickgridTable/model/index.ts +2 -0
  268. package/src/shared/lib/slickgrid/ui/SlickgridTable/model/types/Props.ts +42 -0
  269. package/src/shared/lib/slickgrid/ui/SlickgridTable/model/types/index.ts +1 -0
  270. package/src/shared/lib/slickgrid/ui/SlickgridTable/ui/SlickgridTable.tsx +51 -0
  271. package/src/shared/lib/slickgrid/ui/SlickgridTable/ui/index.ts +1 -0
  272. package/src/shared/lib/slickgrid/ui/columns/columnCheckboxSelector/columnCheckboxSelector.ts +7 -0
  273. package/src/shared/lib/slickgrid/ui/columns/columnCheckboxSelector/index.ts +1 -0
  274. package/src/shared/lib/slickgrid/ui/columns/columnIsEdited/index.ts +1 -0
  275. package/src/shared/lib/slickgrid/ui/columns/columnIsEdited/lib/index.ts +1 -0
  276. package/src/shared/lib/slickgrid/ui/columns/columnIsEdited/lib/setEditedMark.spec.ts +11 -0
  277. package/src/shared/lib/slickgrid/ui/columns/columnIsEdited/lib/setEditedMark.ts +7 -0
  278. package/src/shared/lib/slickgrid/ui/columns/columnIsEdited/ui/columnIsEdited.ts +16 -0
  279. package/src/shared/lib/slickgrid/ui/columns/columnIsEdited/ui/index.ts +1 -0
  280. package/src/shared/lib/slickgrid/ui/columns/index.ts +2 -0
  281. package/src/shared/lib/slickgrid/ui/index.ts +9 -0
  282. package/src/shared/lib/slickgrid/ui/styles/WithTableStyles/WithTableStyles.style.ts +156 -0
  283. package/src/shared/lib/slickgrid/ui/styles/WithTableStyles/WithTableStyles.tsx +11 -0
  284. package/src/shared/lib/slickgrid/ui/styles/WithTableStyles/index.ts +1 -0
  285. package/src/shared/lib/slickgrid/ui/styles/index.ts +1 -0
  286. package/src/shared/lib/slickgrid/ui/styles/keyframes/index.ts +1 -0
  287. package/src/shared/lib/slickgrid/ui/styles/keyframes/wink.ts +7 -0
  288. package/src/shared/lib/sorting/Sort.ts +26 -0
  289. package/src/shared/lib/sorting/index.ts +1 -0
  290. package/src/shared/lib/stringCalculator/index.ts +2 -0
  291. package/src/shared/lib/stringCalculator/stringCalculator.js +834 -0
  292. package/src/shared/lib/stringCalculator/stringCalculator.spec.ts +16 -0
  293. package/src/shared/lib/strings/deleteDoubleQuotes.spec.ts +11 -0
  294. package/src/shared/lib/strings/deleteDoubleQuotes.ts +5 -0
  295. package/src/shared/lib/strings/index.ts +3 -0
  296. package/src/shared/lib/strings/removeHtml.spec.ts +29 -0
  297. package/src/shared/lib/strings/removeHtml.ts +5 -0
  298. package/src/shared/lib/strings/toStringWithCommas.spec.ts +16 -0
  299. package/src/shared/lib/strings/toStringWithCommas.ts +15 -0
  300. package/src/shared/model/consts/columnId.ts +1 -0
  301. package/src/shared/model/consts/dateFormats.ts +5 -0
  302. package/src/shared/model/consts/index.ts +4 -0
  303. package/src/shared/model/consts/invalidDate.ts +1 -0
  304. package/src/shared/model/consts/noPrivilegesMessage.ts +1 -0
  305. package/src/shared/model/enums/EColumnFilter.ts +16 -0
  306. package/src/shared/model/enums/EColumnFiltersGroup.ts +10 -0
  307. package/src/shared/model/enums/EDateFormat.ts +11 -0
  308. package/src/shared/model/enums/EKey.ts +8 -0
  309. package/src/shared/model/enums/EKeyCode.ts +8 -0
  310. package/src/shared/model/enums/ESortType.ts +6 -0
  311. package/src/shared/model/enums/index.ts +6 -0
  312. package/src/shared/model/types/IArguments.ts +14 -0
  313. package/src/shared/model/types/IColumn.ts +13 -0
  314. package/src/shared/model/types/IColumnFilterValue.ts +4 -0
  315. package/src/shared/model/types/IDownloadManager.ts +6 -0
  316. package/src/shared/model/types/IEditedRow.ts +5 -0
  317. package/src/shared/model/types/IExternalVariables.ts +1 -0
  318. package/src/shared/model/types/IFilter.ts +30 -0
  319. package/src/shared/model/types/IGrouping.ts +12 -0
  320. package/src/shared/model/types/IHotKeysBehavior.ts +15 -0
  321. package/src/shared/model/types/IObserver.ts +3 -0
  322. package/src/shared/model/types/IPrinter.ts +24 -0
  323. package/src/shared/model/types/ISlickRow.ts +1 -0
  324. package/src/shared/model/types/ISlickTable.ts +38 -0
  325. package/src/shared/model/types/TGridRow.ts +6 -0
  326. package/src/shared/model/types/index.ts +14 -0
  327. package/src/shared/ui/ContextSelect/ContextSelect.style.ts +9 -0
  328. package/src/shared/ui/ContextSelect/ContextSelect.tsx +87 -0
  329. package/src/shared/ui/ContextSelect/index.ts +2 -0
  330. package/src/shared/ui/notification/index.ts +1 -0
  331. package/src/shared/ui/notification/model/index.ts +1 -0
  332. package/src/shared/ui/notification/ui/index.style.ts +13 -0
  333. package/src/shared/ui/notification/ui/index.tsx +41 -0
  334. package/src/shared/ui/styles/WithDatePickerStyles.ts +11 -0
  335. package/src/shared/ui/styles/index.ts +1 -0
  336. package/src/vite-env.d.ts +1 -0
  337. package/tsconfig.build-types.json +21 -0
  338. package/tsconfig.build.json +17 -0
  339. package/tsconfig.json +23 -0
  340. package/vite.config.ts +34 -0
@@ -0,0 +1,834 @@
1
+ export const stringCalculator = (function () {
2
+ /* eslint-disable */
3
+ const o = function (k, v, o, l) {
4
+ for (o = o || {}, l = k.length; l--; o[k[l]] = v);
5
+ return o;
6
+ },
7
+ $V0 = [1, 3],
8
+ $V1 = [1, 4],
9
+ $V2 = [1, 5],
10
+ $V3 = [1, 6],
11
+ $V4 = [1, 7],
12
+ $V5 = [1, 9],
13
+ $V6 = [1, 10],
14
+ $V7 = [1, 11],
15
+ $V8 = [1, 12],
16
+ $V9 = [1, 13],
17
+ $Va = [1, 14],
18
+ $Vb = [1, 15],
19
+ $Vc = [5, 6, 7, 8, 9, 10, 11, 12, 14],
20
+ $Vd = [5, 6, 7, 14],
21
+ $Ve = [5, 6, 7, 8, 9, 14];
22
+ const parser = {
23
+ trace: function trace() {},
24
+ yy: {},
25
+ symbols_: {
26
+ error: 2,
27
+ expressions: 3,
28
+ e: 4,
29
+ EOF: 5,
30
+ "+": 6,
31
+ "-": 7,
32
+ "*": 8,
33
+ "/": 9,
34
+ "^": 10,
35
+ "!": 11,
36
+ "%": 12,
37
+ "(": 13,
38
+ ")": 14,
39
+ NUMBER: 15,
40
+ E: 16,
41
+ PI: 17,
42
+ $accept: 0,
43
+ $end: 1,
44
+ },
45
+ terminals_: {
46
+ 2: "error",
47
+ 5: "EOF",
48
+ 6: "+",
49
+ 7: "-",
50
+ 8: "*",
51
+ 9: "/",
52
+ 10: "^",
53
+ 11: "!",
54
+ 12: "%",
55
+ 13: "(",
56
+ 14: ")",
57
+ 15: "NUMBER",
58
+ 16: "E",
59
+ 17: "PI",
60
+ },
61
+ productions_: [
62
+ 0,
63
+ [3, 2],
64
+ [4, 3],
65
+ [4, 3],
66
+ [4, 3],
67
+ [4, 3],
68
+ [4, 3],
69
+ [4, 2],
70
+ [4, 2],
71
+ [4, 2],
72
+ [4, 3],
73
+ [4, 1],
74
+ [4, 1],
75
+ [4, 1],
76
+ ],
77
+ performAction: function anonymous(
78
+ yytext,
79
+ yyleng,
80
+ yylineno,
81
+ yy,
82
+ yystate /* action[1] */,
83
+ $$ /* vstack */,
84
+ _$ /* lstack */,
85
+ ) {
86
+ /* this == yyval */
87
+
88
+ const $0 = $$.length - 1;
89
+ switch (yystate) {
90
+ case 1:
91
+ // eslint-disable-next-line no-restricted-globals
92
+ //typeof console !== 'undefined' ? console.log($$[$0-1]) : print($$[$0-1]);
93
+ return $$[$0 - 1];
94
+ break;
95
+ case 2:
96
+ this.$ = $$[$0 - 2] + $$[$0];
97
+ break;
98
+ case 3:
99
+ this.$ = $$[$0 - 2] - $$[$0];
100
+ break;
101
+ case 4:
102
+ this.$ = $$[$0 - 2] * $$[$0];
103
+ break;
104
+ case 5:
105
+ this.$ = $$[$0 - 2] / $$[$0];
106
+ break;
107
+ case 6:
108
+ this.$ = Math.pow($$[$0 - 2], $$[$0]);
109
+ break;
110
+ case 7:
111
+ this.$ = (function fact(n) {
112
+ return n == 0 ? 1 : fact(n - 1) * n;
113
+ })($$[$0 - 1]);
114
+
115
+ break;
116
+ case 8:
117
+ this.$ = $$[$0 - 1] / 100;
118
+ break;
119
+ case 9:
120
+ this.$ = -$$[$0];
121
+ break;
122
+ case 10:
123
+ this.$ = $$[$0 - 1];
124
+ break;
125
+ case 11:
126
+ this.$ = Number(yytext);
127
+ break;
128
+ case 12:
129
+ this.$ = Math.E;
130
+ break;
131
+ case 13:
132
+ this.$ = Math.PI;
133
+ break;
134
+ }
135
+ },
136
+ table: [
137
+ { 3: 1, 4: 2, 7: $V0, 13: $V1, 15: $V2, 16: $V3, 17: $V4 },
138
+ { 1: [3] },
139
+ { 5: [1, 8], 6: $V5, 7: $V6, 8: $V7, 9: $V8, 10: $V9, 11: $Va, 12: $Vb },
140
+ { 4: 16, 7: $V0, 13: $V1, 15: $V2, 16: $V3, 17: $V4 },
141
+ { 4: 17, 7: $V0, 13: $V1, 15: $V2, 16: $V3, 17: $V4 },
142
+ o($Vc, [2, 11]),
143
+ o($Vc, [2, 12]),
144
+ o($Vc, [2, 13]),
145
+ { 1: [2, 1] },
146
+ { 4: 18, 7: $V0, 13: $V1, 15: $V2, 16: $V3, 17: $V4 },
147
+ { 4: 19, 7: $V0, 13: $V1, 15: $V2, 16: $V3, 17: $V4 },
148
+ { 4: 20, 7: $V0, 13: $V1, 15: $V2, 16: $V3, 17: $V4 },
149
+ { 4: 21, 7: $V0, 13: $V1, 15: $V2, 16: $V3, 17: $V4 },
150
+ { 4: 22, 7: $V0, 13: $V1, 15: $V2, 16: $V3, 17: $V4 },
151
+ o($Vc, [2, 7]),
152
+ o($Vc, [2, 8]),
153
+ o($Vc, [2, 9]),
154
+ {
155
+ 6: $V5,
156
+ 7: $V6,
157
+ 8: $V7,
158
+ 9: $V8,
159
+ 10: $V9,
160
+ 11: $Va,
161
+ 12: $Vb,
162
+ 14: [1, 23],
163
+ },
164
+ o($Vd, [2, 2], { 8: $V7, 9: $V8, 10: $V9, 11: $Va, 12: $Vb }),
165
+ o($Vd, [2, 3], { 8: $V7, 9: $V8, 10: $V9, 11: $Va, 12: $Vb }),
166
+ o($Ve, [2, 4], { 10: $V9, 11: $Va, 12: $Vb }),
167
+ o($Ve, [2, 5], { 10: $V9, 11: $Va, 12: $Vb }),
168
+ o([5, 6, 7, 8, 9, 10, 14], [2, 6], { 11: $Va, 12: $Vb }),
169
+ o($Vc, [2, 10]),
170
+ ],
171
+ defaultActions: { 8: [2, 1] },
172
+ parseError: function parseError(str, hash) {
173
+ if (hash.recoverable) {
174
+ this.trace(str);
175
+ } else {
176
+ const error = new Error(str);
177
+ error.hash = hash;
178
+ throw error;
179
+ }
180
+ },
181
+ parse: function parse(input) {
182
+ const self = this;
183
+ let stack = [0];
184
+ const tstack = [];
185
+ let vstack = [null];
186
+ let lstack = [];
187
+ const table = this.table;
188
+ let yytext = "";
189
+ let yylineno = 0;
190
+ let yyleng = 0;
191
+ let recovering = 0;
192
+ const TERROR = 2;
193
+ const EOF = 1;
194
+ const args = lstack.slice.call(arguments, 1);
195
+ const lexer = Object.create(this.lexer);
196
+ const sharedState = { yy: {} };
197
+ for (let k in this.yy) {
198
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
199
+ sharedState.yy[k] = this.yy[k];
200
+ }
201
+ }
202
+ lexer.setInput(input, sharedState.yy);
203
+ sharedState.yy.lexer = lexer;
204
+ sharedState.yy.parser = this;
205
+ if (typeof lexer.yylloc == "undefined") {
206
+ lexer.yylloc = {};
207
+ }
208
+ let yyloc = lexer.yylloc;
209
+ lstack.push(yyloc);
210
+ const ranges = lexer.options && lexer.options.ranges;
211
+ if (typeof sharedState.yy.parseError === "function") {
212
+ this.parseError = sharedState.yy.parseError;
213
+ } else {
214
+ this.parseError = Object.getPrototypeOf(this).parseError;
215
+ }
216
+ function popStack(n) {
217
+ stack.length = stack.length - 2 * n;
218
+ vstack.length = vstack.length - n;
219
+ lstack.length = lstack.length - n;
220
+ }
221
+ _token_stack: var lex = function () {
222
+ let token;
223
+ token = lexer.lex() || EOF;
224
+ if (typeof token !== "number") {
225
+ token = self.symbols_[token] || token;
226
+ }
227
+ return token;
228
+ };
229
+ // eslint-disable-next-line no-constant-condition
230
+ let symbol;
231
+ let preErrorSymbol;
232
+ let state;
233
+ let action;
234
+ let a;
235
+ let r;
236
+ const yyval = {};
237
+ let p;
238
+ let len;
239
+ let newState;
240
+ let expected;
241
+ // eslint-disable-next-line no-constant-condition
242
+ while (true) {
243
+ state = stack[stack.length - 1];
244
+ if (this.defaultActions[state]) {
245
+ action = this.defaultActions[state];
246
+ } else {
247
+ if (symbol === null || typeof symbol == "undefined") {
248
+ symbol = lex();
249
+ }
250
+ action = table[state] && table[state][symbol];
251
+ }
252
+ if (typeof action === "undefined" || !action.length || !action[0]) {
253
+ let errStr = "";
254
+ expected = [];
255
+ for (p in table[state]) {
256
+ if (this.terminals_[p] && p > TERROR) {
257
+ expected.push("'" + this.terminals_[p] + "'");
258
+ }
259
+ }
260
+ if (lexer.showPosition) {
261
+ errStr =
262
+ "Parse error on line " +
263
+ (yylineno + 1) +
264
+ ":\n" +
265
+ lexer.showPosition() +
266
+ "\nExpecting " +
267
+ expected.join(", ") +
268
+ ", got '" +
269
+ (this.terminals_[symbol] || symbol) +
270
+ "'";
271
+ } else {
272
+ errStr =
273
+ "Parse error on line " +
274
+ (yylineno + 1) +
275
+ ": Unexpected " +
276
+ (symbol == EOF
277
+ ? "end of input"
278
+ : "'" + (this.terminals_[symbol] || symbol) + "'");
279
+ }
280
+ this.parseError(errStr, {
281
+ text: lexer.match,
282
+ token: this.terminals_[symbol] || symbol,
283
+ line: lexer.yylineno,
284
+ loc: yyloc,
285
+ expected: expected,
286
+ });
287
+ }
288
+ if (action[0] instanceof Array && action.length > 1) {
289
+ throw new Error(
290
+ "Parse Error: multiple actions possible at state: " +
291
+ state +
292
+ ", token: " +
293
+ symbol,
294
+ );
295
+ }
296
+ switch (action[0]) {
297
+ case 1:
298
+ stack.push(symbol);
299
+ vstack.push(lexer.yytext);
300
+ lstack.push(lexer.yylloc);
301
+ stack.push(action[1]);
302
+ symbol = null;
303
+ if (!preErrorSymbol) {
304
+ yyleng = lexer.yyleng;
305
+ yytext = lexer.yytext;
306
+ yylineno = lexer.yylineno;
307
+ yyloc = lexer.yylloc;
308
+ if (recovering > 0) {
309
+ recovering--;
310
+ }
311
+ } else {
312
+ symbol = preErrorSymbol;
313
+ preErrorSymbol = null;
314
+ }
315
+ break;
316
+ case 2:
317
+ len = this.productions_[action[1]][1];
318
+ yyval.$ = vstack[vstack.length - len];
319
+ yyval._$ = {
320
+ first_line: lstack[lstack.length - (len || 1)].first_line,
321
+ last_line: lstack[lstack.length - 1].last_line,
322
+ first_column: lstack[lstack.length - (len || 1)].first_column,
323
+ last_column: lstack[lstack.length - 1].last_column,
324
+ };
325
+ if (ranges) {
326
+ yyval._$.range = [
327
+ lstack[lstack.length - (len || 1)].range[0],
328
+ lstack[lstack.length - 1].range[1],
329
+ ];
330
+ }
331
+ r = this.performAction.apply(
332
+ yyval,
333
+ [
334
+ yytext,
335
+ yyleng,
336
+ yylineno,
337
+ sharedState.yy,
338
+ action[1],
339
+ vstack,
340
+ lstack,
341
+ ].concat(args),
342
+ );
343
+ if (typeof r !== "undefined") {
344
+ return r;
345
+ }
346
+ if (len) {
347
+ stack = stack.slice(0, -1 * len * 2);
348
+ vstack = vstack.slice(0, -1 * len);
349
+ lstack = lstack.slice(0, -1 * len);
350
+ }
351
+ stack.push(this.productions_[action[1]][0]);
352
+ vstack.push(yyval.$);
353
+ lstack.push(yyval._$);
354
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
355
+ stack.push(newState);
356
+ break;
357
+ case 3:
358
+ return true;
359
+ }
360
+ }
361
+ return true;
362
+ },
363
+ };
364
+ /* generated by jison-lex 0.3.4 */
365
+ const lexer = (function () {
366
+ const lexer = {
367
+ EOF: 1,
368
+
369
+ parseError: function parseError(str, hash) {
370
+ if (this.yy.parser) {
371
+ this.yy.parser.parseError(str, hash);
372
+ } else {
373
+ throw new Error(str);
374
+ }
375
+ },
376
+
377
+ // resets the lexer, sets new input
378
+ setInput: function (input, yy) {
379
+ this.yy = yy || this.yy || {};
380
+ this._input = input;
381
+ this._more = this._backtrack = this.done = false;
382
+ this.yylineno = this.yyleng = 0;
383
+ this.yytext = this.matched = this.match = "";
384
+ this.conditionStack = ["INITIAL"];
385
+ this.yylloc = {
386
+ first_line: 1,
387
+ first_column: 0,
388
+ last_line: 1,
389
+ last_column: 0,
390
+ };
391
+ if (this.options.ranges) {
392
+ this.yylloc.range = [0, 0];
393
+ }
394
+ this.offset = 0;
395
+ return this;
396
+ },
397
+
398
+ // consumes and returns one char from the input
399
+ input: function () {
400
+ const ch = this._input[0];
401
+ this.yytext += ch;
402
+ this.yyleng++;
403
+ this.offset++;
404
+ this.match += ch;
405
+ this.matched += ch;
406
+ const lines = ch.match(/(?:\r\n?|\n).*/g);
407
+ if (lines) {
408
+ this.yylineno++;
409
+ this.yylloc.last_line++;
410
+ } else {
411
+ this.yylloc.last_column++;
412
+ }
413
+ if (this.options.ranges) {
414
+ this.yylloc.range[1]++;
415
+ }
416
+
417
+ this._input = this._input.slice(1);
418
+ return ch;
419
+ },
420
+
421
+ // unshifts one char (or a string) into the input
422
+ unput: function (ch) {
423
+ const len = ch.length;
424
+ const lines = ch.split(/(?:\r\n?|\n)/g);
425
+
426
+ this._input = ch + this._input;
427
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
428
+ //this.yyleng -= len;
429
+ this.offset -= len;
430
+ const oldLines = this.match.split(/(?:\r\n?|\n)/g);
431
+ this.match = this.match.substr(0, this.match.length - 1);
432
+ this.matched = this.matched.substr(0, this.matched.length - 1);
433
+
434
+ if (lines.length - 1) {
435
+ this.yylineno -= lines.length - 1;
436
+ }
437
+ const r = this.yylloc.range;
438
+
439
+ this.yylloc = {
440
+ first_line: this.yylloc.first_line,
441
+ last_line: this.yylineno + 1,
442
+ first_column: this.yylloc.first_column,
443
+ last_column: lines
444
+ ? (lines.length === oldLines.length
445
+ ? this.yylloc.first_column
446
+ : 0) +
447
+ oldLines[oldLines.length - lines.length].length -
448
+ lines[0].length
449
+ : this.yylloc.first_column - len,
450
+ };
451
+
452
+ if (this.options.ranges) {
453
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
454
+ }
455
+ this.yyleng = this.yytext.length;
456
+ return this;
457
+ },
458
+
459
+ // When called from action, caches matched text and appends it on next action
460
+ more: function () {
461
+ this._more = true;
462
+ return this;
463
+ },
464
+
465
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
466
+ reject: function () {
467
+ if (this.options.backtrack_lexer) {
468
+ this._backtrack = true;
469
+ } else {
470
+ return this.parseError(
471
+ "Lexical error on line " +
472
+ (this.yylineno + 1) +
473
+ ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" +
474
+ this.showPosition(),
475
+ {
476
+ text: "",
477
+ token: null,
478
+ line: this.yylineno,
479
+ },
480
+ );
481
+ }
482
+ return this;
483
+ },
484
+
485
+ // retain first n characters of the match
486
+ less: function (n) {
487
+ this.unput(this.match.slice(n));
488
+ },
489
+
490
+ // displays already matched input, i.e. for error messages
491
+ pastInput: function () {
492
+ const past = this.matched.substr(
493
+ 0,
494
+ this.matched.length - this.match.length,
495
+ );
496
+ return (
497
+ (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "")
498
+ );
499
+ },
500
+
501
+ // displays upcoming input, i.e. for error messages
502
+ upcomingInput: function () {
503
+ let next = this.match;
504
+ if (next.length < 20) {
505
+ next += this._input.substr(0, 20 - next.length);
506
+ }
507
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(
508
+ /\n/g,
509
+ "",
510
+ );
511
+ },
512
+
513
+ // displays the character position where the lexing error occurred, i.e. for error messages
514
+ showPosition: function () {
515
+ const pre = this.pastInput();
516
+ const c = new Array(pre.length + 1).join("-");
517
+ return pre + this.upcomingInput() + "\n" + c + "^";
518
+ },
519
+
520
+ // test the lexed token: return FALSE when not a match, otherwise return token
521
+ test_match: function (match, indexed_rule) {
522
+ let token;
523
+ let lines;
524
+ let backup;
525
+
526
+ if (this.options.backtrack_lexer) {
527
+ // save context
528
+ backup = {
529
+ yylineno: this.yylineno,
530
+ yylloc: {
531
+ first_line: this.yylloc.first_line,
532
+ last_line: this.last_line,
533
+ first_column: this.yylloc.first_column,
534
+ last_column: this.yylloc.last_column,
535
+ },
536
+ yytext: this.yytext,
537
+ match: this.match,
538
+ matches: this.matches,
539
+ matched: this.matched,
540
+ yyleng: this.yyleng,
541
+ offset: this.offset,
542
+ _more: this._more,
543
+ _input: this._input,
544
+ yy: this.yy,
545
+ conditionStack: this.conditionStack.slice(0),
546
+ done: this.done,
547
+ };
548
+ if (this.options.ranges) {
549
+ backup.yylloc.range = this.yylloc.range.slice(0);
550
+ }
551
+ }
552
+
553
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
554
+ if (lines) {
555
+ this.yylineno += lines.length;
556
+ }
557
+ this.yylloc = {
558
+ first_line: this.yylloc.last_line,
559
+ last_line: this.yylineno + 1,
560
+ first_column: this.yylloc.last_column,
561
+ last_column: lines
562
+ ? lines[lines.length - 1].length -
563
+ lines[lines.length - 1].match(/\r?\n?/)[0].length
564
+ : this.yylloc.last_column + match[0].length,
565
+ };
566
+ this.yytext += match[0];
567
+ this.match += match[0];
568
+ this.matches = match;
569
+ this.yyleng = this.yytext.length;
570
+ if (this.options.ranges) {
571
+ this.yylloc.range = [this.offset, (this.offset += this.yyleng)];
572
+ }
573
+ this._more = false;
574
+ this._backtrack = false;
575
+ this._input = this._input.slice(match[0].length);
576
+ this.matched += match[0];
577
+ token = this.performAction.call(
578
+ this,
579
+ this.yy,
580
+ this,
581
+ indexed_rule,
582
+ this.conditionStack[this.conditionStack.length - 1],
583
+ );
584
+ if (this.done && this._input) {
585
+ this.done = false;
586
+ }
587
+ if (token) {
588
+ return token;
589
+ } else if (this._backtrack) {
590
+ // recover context
591
+ for (let k in backup) {
592
+ this[k] = backup[k];
593
+ }
594
+ return false; // rule action called reject() implying the next rule should be tested instead.
595
+ }
596
+ return false;
597
+ },
598
+
599
+ // return next match in input
600
+ next: function () {
601
+ if (this.done) {
602
+ return this.EOF;
603
+ }
604
+ if (!this._input) {
605
+ this.done = true;
606
+ }
607
+
608
+ let token;
609
+ let match;
610
+ let tempMatch;
611
+ let index;
612
+ if (!this._more) {
613
+ this.yytext = "";
614
+ this.match = "";
615
+ }
616
+ const rules = this._currentRules();
617
+ for (let i = 0; i < rules.length; i++) {
618
+ tempMatch = this._input.match(this.rules[rules[i]]);
619
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
620
+ match = tempMatch;
621
+ index = i;
622
+ if (this.options.backtrack_lexer) {
623
+ token = this.test_match(tempMatch, rules[i]);
624
+ if (token !== false) {
625
+ return token;
626
+ } else if (this._backtrack) {
627
+ match = false;
628
+ continue; // rule action called reject() implying a rule MISmatch.
629
+ } else {
630
+ // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
631
+ return false;
632
+ }
633
+ } else if (!this.options.flex) {
634
+ break;
635
+ }
636
+ }
637
+ }
638
+ if (match) {
639
+ token = this.test_match(match, rules[index]);
640
+ if (token !== false) {
641
+ return token;
642
+ }
643
+ // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
644
+ return false;
645
+ }
646
+ if (this._input === "") {
647
+ return this.EOF;
648
+ } else {
649
+ return this.parseError(
650
+ "Lexical error on line " +
651
+ (this.yylineno + 1) +
652
+ ". Unrecognized text.\n" +
653
+ this.showPosition(),
654
+ {
655
+ text: "",
656
+ token: null,
657
+ line: this.yylineno,
658
+ },
659
+ );
660
+ }
661
+ },
662
+
663
+ // return next match that has a token
664
+ lex: function lex() {
665
+ const r = this.next();
666
+ if (r) {
667
+ return r;
668
+ } else {
669
+ return this.lex();
670
+ }
671
+ },
672
+
673
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
674
+ begin: function begin(condition) {
675
+ this.conditionStack.push(condition);
676
+ },
677
+
678
+ // pop the previously active lexer condition state off the condition stack
679
+ popState: function popState() {
680
+ const n = this.conditionStack.length - 1;
681
+ if (n > 0) {
682
+ return this.conditionStack.pop();
683
+ } else {
684
+ return this.conditionStack[0];
685
+ }
686
+ },
687
+
688
+ // produce the lexer rule set which is active for the currently active lexer condition state
689
+ _currentRules: function _currentRules() {
690
+ if (
691
+ this.conditionStack.length &&
692
+ this.conditionStack[this.conditionStack.length - 1]
693
+ ) {
694
+ return this.conditions[
695
+ this.conditionStack[this.conditionStack.length - 1]
696
+ ].rules;
697
+ } else {
698
+ return this.conditions["INITIAL"].rules;
699
+ }
700
+ },
701
+
702
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
703
+ topState: function topState(n) {
704
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
705
+ if (n >= 0) {
706
+ return this.conditionStack[n];
707
+ } else {
708
+ return "INITIAL";
709
+ }
710
+ },
711
+
712
+ // alias for begin(condition)
713
+ pushState: function pushState(condition) {
714
+ this.begin(condition);
715
+ },
716
+
717
+ // return the number of states currently on the stack
718
+ stateStackSize: function stateStackSize() {
719
+ return this.conditionStack.length;
720
+ },
721
+ options: {},
722
+ performAction: function anonymous(
723
+ yy,
724
+ yy_,
725
+ $avoiding_name_collisions,
726
+ YY_START,
727
+ ) {
728
+ const YYSTATE = YY_START;
729
+ switch ($avoiding_name_collisions) {
730
+ case 0 /* skip whitespace */:
731
+ break;
732
+ case 1:
733
+ return 15;
734
+ break;
735
+ case 2:
736
+ return 8;
737
+ break;
738
+ case 3:
739
+ return 9;
740
+ break;
741
+ case 4:
742
+ return 7;
743
+ break;
744
+ case 5:
745
+ return 6;
746
+ break;
747
+ case 6:
748
+ return 10;
749
+ break;
750
+ case 7:
751
+ return 11;
752
+ break;
753
+ case 8:
754
+ return 12;
755
+ break;
756
+ case 9:
757
+ return 13;
758
+ break;
759
+ case 10:
760
+ return 14;
761
+ break;
762
+ case 11:
763
+ return 17;
764
+ break;
765
+ case 12:
766
+ return 16;
767
+ break;
768
+ case 13:
769
+ return 5;
770
+ break;
771
+ case 14:
772
+ return "INVALID";
773
+ break;
774
+ }
775
+ },
776
+ rules: [
777
+ /^(?:\s+)/,
778
+ /^(?:[0-9]+(\.[0-9]+)?\b)/,
779
+ /^(?:\*)/,
780
+ /^(?:\/)/,
781
+ /^(?:-)/,
782
+ /^(?:\+)/,
783
+ /^(?:\^)/,
784
+ /^(?:!)/,
785
+ /^(?:%)/,
786
+ /^(?:\()/,
787
+ /^(?:\))/,
788
+ /^(?:PI\b)/,
789
+ /^(?:E\b)/,
790
+ /^(?:$)/,
791
+ /^(?:.)/,
792
+ ],
793
+ conditions: {
794
+ INITIAL: {
795
+ rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
796
+ inclusive: true,
797
+ },
798
+ },
799
+ };
800
+ return lexer;
801
+ })();
802
+ parser.lexer = lexer;
803
+ function Parser() {
804
+ this.yy = {};
805
+ // to get rid of TS error when using method stringCalculator.parse()
806
+ this.parse = this.parse.bind(this);
807
+ }
808
+ Parser.prototype = parser;
809
+ parser.Parser = Parser;
810
+ return new Parser();
811
+ })();
812
+
813
+ if (typeof require !== "undefined" && typeof exports !== "undefined") {
814
+ exports.parser = stringCalculator;
815
+ exports.Parser = stringCalculator.Parser;
816
+ exports.parse = function () {
817
+ return stringCalculator.parse.apply(stringCalculator, arguments);
818
+ };
819
+ // exports.main = function commonjsMain(args) {
820
+ // if (!args[1]) {
821
+ // console.log("Usage: " + args[0] + " FILE");
822
+ // process.exit(1);
823
+ // }
824
+ // const source = require("fs").readFileSync(
825
+ // require("path").normalize(args[1]),
826
+ // "utf8",
827
+ // );
828
+ // return exports.parser.parse(source);
829
+ // };
830
+ // if (typeof module !== "undefined" && require.main === module) {
831
+ // exports.main(process.argv.slice(1));
832
+ // }
833
+ }
834
+ /* eslint-enable */