@omegagrid/core 0.10.1 → 0.10.2

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 (317) hide show
  1. package/package.json +2 -2
  2. package/dist/common/actions.d.ts +0 -16
  3. package/dist/common/actions.d.ts.map +0 -1
  4. package/dist/common/actions.js +0 -14
  5. package/dist/common/actions.js.map +0 -1
  6. package/dist/common/colors.d.ts +0 -39
  7. package/dist/common/colors.d.ts.map +0 -1
  8. package/dist/common/colors.js +0 -59
  9. package/dist/common/colors.js.map +0 -1
  10. package/dist/common/csv.d.ts +0 -23
  11. package/dist/common/csv.d.ts.map +0 -1
  12. package/dist/common/csv.js +0 -93
  13. package/dist/common/csv.js.map +0 -1
  14. package/dist/common/dates.d.ts +0 -32
  15. package/dist/common/dates.d.ts.map +0 -1
  16. package/dist/common/dates.js +0 -172
  17. package/dist/common/dates.js.map +0 -1
  18. package/dist/common/device.d.ts +0 -2
  19. package/dist/common/device.d.ts.map +0 -1
  20. package/dist/common/device.js +0 -13
  21. package/dist/common/device.js.map +0 -1
  22. package/dist/common/dom.d.ts +0 -90
  23. package/dist/common/dom.d.ts.map +0 -1
  24. package/dist/common/dom.js +0 -308
  25. package/dist/common/dom.js.map +0 -1
  26. package/dist/common/events.d.ts +0 -15
  27. package/dist/common/events.d.ts.map +0 -1
  28. package/dist/common/events.js +0 -33
  29. package/dist/common/events.js.map +0 -1
  30. package/dist/common/html.d.ts +0 -3
  31. package/dist/common/html.d.ts.map +0 -1
  32. package/dist/common/html.js +0 -25
  33. package/dist/common/html.js.map +0 -1
  34. package/dist/common/index.d.ts +0 -19
  35. package/dist/common/index.d.ts.map +0 -1
  36. package/dist/common/index.js +0 -19
  37. package/dist/common/index.js.map +0 -1
  38. package/dist/common/linkedList.d.ts +0 -24
  39. package/dist/common/linkedList.d.ts.map +0 -1
  40. package/dist/common/linkedList.js +0 -65
  41. package/dist/common/linkedList.js.map +0 -1
  42. package/dist/common/loaders.d.ts +0 -17
  43. package/dist/common/loaders.d.ts.map +0 -1
  44. package/dist/common/loaders.js +0 -54
  45. package/dist/common/loaders.js.map +0 -1
  46. package/dist/common/logger.d.ts +0 -25
  47. package/dist/common/logger.d.ts.map +0 -1
  48. package/dist/common/logger.js +0 -57
  49. package/dist/common/logger.js.map +0 -1
  50. package/dist/common/matrix.d.ts +0 -6
  51. package/dist/common/matrix.d.ts.map +0 -1
  52. package/dist/common/matrix.js +0 -17
  53. package/dist/common/matrix.js.map +0 -1
  54. package/dist/common/numbers.d.ts +0 -26
  55. package/dist/common/numbers.d.ts.map +0 -1
  56. package/dist/common/numbers.js +0 -239
  57. package/dist/common/numbers.js.map +0 -1
  58. package/dist/common/options.d.ts +0 -17
  59. package/dist/common/options.d.ts.map +0 -1
  60. package/dist/common/options.js +0 -29
  61. package/dist/common/options.js.map +0 -1
  62. package/dist/common/paper.d.ts +0 -8
  63. package/dist/common/paper.d.ts.map +0 -1
  64. package/dist/common/paper.js +0 -17
  65. package/dist/common/paper.js.map +0 -1
  66. package/dist/common/shortcutManager.d.ts +0 -17
  67. package/dist/common/shortcutManager.d.ts.map +0 -1
  68. package/dist/common/shortcutManager.js +0 -49
  69. package/dist/common/shortcutManager.js.map +0 -1
  70. package/dist/common/tree.d.ts +0 -87
  71. package/dist/common/tree.d.ts.map +0 -1
  72. package/dist/common/tree.js +0 -204
  73. package/dist/common/tree.js.map +0 -1
  74. package/dist/common/utils.d.ts +0 -30
  75. package/dist/common/utils.d.ts.map +0 -1
  76. package/dist/common/utils.js +0 -136
  77. package/dist/common/utils.js.map +0 -1
  78. package/dist/constants.d.ts +0 -48
  79. package/dist/constants.d.ts.map +0 -1
  80. package/dist/constants.js +0 -24
  81. package/dist/constants.js.map +0 -1
  82. package/dist/index.d.ts +0 -8
  83. package/dist/index.d.ts.map +0 -1
  84. package/dist/index.js +0 -8
  85. package/dist/index.js.map +0 -1
  86. package/dist/model/adapter.d.ts +0 -8
  87. package/dist/model/adapter.d.ts.map +0 -1
  88. package/dist/model/adapter.js +0 -13
  89. package/dist/model/adapter.js.map +0 -1
  90. package/dist/model/component.d.ts +0 -19
  91. package/dist/model/component.d.ts.map +0 -1
  92. package/dist/model/component.js +0 -84
  93. package/dist/model/component.js.map +0 -1
  94. package/dist/model/componentSlice.d.ts +0 -8
  95. package/dist/model/componentSlice.d.ts.map +0 -1
  96. package/dist/model/componentSlice.js +0 -10
  97. package/dist/model/componentSlice.js.map +0 -1
  98. package/dist/model/componentStore.d.ts +0 -12
  99. package/dist/model/componentStore.d.ts.map +0 -1
  100. package/dist/model/componentStore.js +0 -26
  101. package/dist/model/componentStore.js.map +0 -1
  102. package/dist/model/index.d.ts +0 -6
  103. package/dist/model/index.d.ts.map +0 -1
  104. package/dist/model/index.js +0 -6
  105. package/dist/model/index.js.map +0 -1
  106. package/dist/model/plugins.d.ts +0 -13
  107. package/dist/model/plugins.d.ts.map +0 -1
  108. package/dist/model/plugins.js +0 -27
  109. package/dist/model/plugins.js.map +0 -1
  110. package/dist/themes/definitions/tmDark.d.ts +0 -4
  111. package/dist/themes/definitions/tmDark.d.ts.map +0 -1
  112. package/dist/themes/definitions/tmDark.js +0 -83
  113. package/dist/themes/definitions/tmDark.js.map +0 -1
  114. package/dist/themes/definitions/tmLight.d.ts +0 -4
  115. package/dist/themes/definitions/tmLight.d.ts.map +0 -1
  116. package/dist/themes/definitions/tmLight.js +0 -83
  117. package/dist/themes/definitions/tmLight.js.map +0 -1
  118. package/dist/themes/helpers.d.ts +0 -7
  119. package/dist/themes/helpers.d.ts.map +0 -1
  120. package/dist/themes/helpers.js +0 -34
  121. package/dist/themes/helpers.js.map +0 -1
  122. package/dist/themes/index.d.ts +0 -18
  123. package/dist/themes/index.d.ts.map +0 -1
  124. package/dist/themes/index.js +0 -48
  125. package/dist/themes/index.js.map +0 -1
  126. package/dist/themes/mixins.d.ts +0 -10
  127. package/dist/themes/mixins.d.ts.map +0 -1
  128. package/dist/themes/mixins.js +0 -39
  129. package/dist/themes/mixins.js.map +0 -1
  130. package/dist/themes/transformations.d.ts +0 -9
  131. package/dist/themes/transformations.d.ts.map +0 -1
  132. package/dist/themes/transformations.js +0 -48
  133. package/dist/themes/transformations.js.map +0 -1
  134. package/dist/types.d.ts +0 -130
  135. package/dist/types.d.ts.map +0 -1
  136. package/dist/types.js +0 -12
  137. package/dist/types.js.map +0 -1
  138. package/dist/ui/accordion.d.ts +0 -16
  139. package/dist/ui/accordion.d.ts.map +0 -1
  140. package/dist/ui/accordion.js +0 -209
  141. package/dist/ui/accordion.js.map +0 -1
  142. package/dist/ui/alert.d.ts +0 -15
  143. package/dist/ui/alert.d.ts.map +0 -1
  144. package/dist/ui/alert.js +0 -101
  145. package/dist/ui/alert.js.map +0 -1
  146. package/dist/ui/baseElement.d.ts +0 -7
  147. package/dist/ui/baseElement.d.ts.map +0 -1
  148. package/dist/ui/baseElement.js +0 -10
  149. package/dist/ui/baseElement.js.map +0 -1
  150. package/dist/ui/button.d.ts +0 -21
  151. package/dist/ui/button.d.ts.map +0 -1
  152. package/dist/ui/button.js +0 -100
  153. package/dist/ui/button.js.map +0 -1
  154. package/dist/ui/button.style.d.ts +0 -2
  155. package/dist/ui/button.style.d.ts.map +0 -1
  156. package/dist/ui/button.style.js +0 -60
  157. package/dist/ui/button.style.js.map +0 -1
  158. package/dist/ui/checkbox.d.ts +0 -14
  159. package/dist/ui/checkbox.d.ts.map +0 -1
  160. package/dist/ui/checkbox.js +0 -47
  161. package/dist/ui/checkbox.js.map +0 -1
  162. package/dist/ui/close.d.ts +0 -6
  163. package/dist/ui/close.d.ts.map +0 -1
  164. package/dist/ui/close.js +0 -33
  165. package/dist/ui/close.js.map +0 -1
  166. package/dist/ui/colorpicker.d.ts +0 -24
  167. package/dist/ui/colorpicker.d.ts.map +0 -1
  168. package/dist/ui/colorpicker.js +0 -228
  169. package/dist/ui/colorpicker.js.map +0 -1
  170. package/dist/ui/container.d.ts +0 -39
  171. package/dist/ui/container.d.ts.map +0 -1
  172. package/dist/ui/container.js +0 -313
  173. package/dist/ui/container.js.map +0 -1
  174. package/dist/ui/dropdown.d.ts +0 -48
  175. package/dist/ui/dropdown.d.ts.map +0 -1
  176. package/dist/ui/dropdown.js +0 -300
  177. package/dist/ui/dropdown.js.map +0 -1
  178. package/dist/ui/dropdownColorPicker.d.ts +0 -12
  179. package/dist/ui/dropdownColorPicker.d.ts.map +0 -1
  180. package/dist/ui/dropdownColorPicker.js +0 -60
  181. package/dist/ui/dropdownColorPicker.js.map +0 -1
  182. package/dist/ui/dropdownList.d.ts +0 -8
  183. package/dist/ui/dropdownList.d.ts.map +0 -1
  184. package/dist/ui/dropdownList.js +0 -48
  185. package/dist/ui/dropdownList.js.map +0 -1
  186. package/dist/ui/dropdownMenu.d.ts +0 -11
  187. package/dist/ui/dropdownMenu.d.ts.map +0 -1
  188. package/dist/ui/dropdownMenu.js +0 -61
  189. package/dist/ui/dropdownMenu.js.map +0 -1
  190. package/dist/ui/expander.d.ts +0 -28
  191. package/dist/ui/expander.d.ts.map +0 -1
  192. package/dist/ui/expander.js +0 -144
  193. package/dist/ui/expander.js.map +0 -1
  194. package/dist/ui/fileInput.d.ts +0 -24
  195. package/dist/ui/fileInput.d.ts.map +0 -1
  196. package/dist/ui/fileInput.js +0 -130
  197. package/dist/ui/fileInput.js.map +0 -1
  198. package/dist/ui/fileInput.style.d.ts +0 -2
  199. package/dist/ui/fileInput.style.d.ts.map +0 -1
  200. package/dist/ui/fileInput.style.js +0 -73
  201. package/dist/ui/fileInput.style.js.map +0 -1
  202. package/dist/ui/floatingWindow.d.ts +0 -19
  203. package/dist/ui/floatingWindow.d.ts.map +0 -1
  204. package/dist/ui/floatingWindow.js +0 -87
  205. package/dist/ui/floatingWindow.js.map +0 -1
  206. package/dist/ui/icon.d.ts +0 -46
  207. package/dist/ui/icon.d.ts.map +0 -1
  208. package/dist/ui/icon.js +0 -189
  209. package/dist/ui/icon.js.map +0 -1
  210. package/dist/ui/icon.style.d.ts +0 -2
  211. package/dist/ui/icon.style.d.ts.map +0 -1
  212. package/dist/ui/icon.style.js +0 -556
  213. package/dist/ui/icon.style.js.map +0 -1
  214. package/dist/ui/images.d.ts +0 -2
  215. package/dist/ui/images.d.ts.map +0 -1
  216. package/dist/ui/images.js +0 -14
  217. package/dist/ui/images.js.map +0 -1
  218. package/dist/ui/index.d.ts +0 -32
  219. package/dist/ui/index.d.ts.map +0 -1
  220. package/dist/ui/index.js +0 -32
  221. package/dist/ui/index.js.map +0 -1
  222. package/dist/ui/input.d.ts +0 -12
  223. package/dist/ui/input.d.ts.map +0 -1
  224. package/dist/ui/input.js +0 -45
  225. package/dist/ui/input.js.map +0 -1
  226. package/dist/ui/input.style.d.ts +0 -2
  227. package/dist/ui/input.style.d.ts.map +0 -1
  228. package/dist/ui/input.style.js +0 -36
  229. package/dist/ui/input.style.js.map +0 -1
  230. package/dist/ui/label.d.ts +0 -16
  231. package/dist/ui/label.d.ts.map +0 -1
  232. package/dist/ui/label.js +0 -90
  233. package/dist/ui/label.js.map +0 -1
  234. package/dist/ui/list.d.ts +0 -87
  235. package/dist/ui/list.d.ts.map +0 -1
  236. package/dist/ui/list.js +0 -427
  237. package/dist/ui/list.js.map +0 -1
  238. package/dist/ui/list.style.d.ts +0 -2
  239. package/dist/ui/list.style.d.ts.map +0 -1
  240. package/dist/ui/list.style.js +0 -35
  241. package/dist/ui/list.style.js.map +0 -1
  242. package/dist/ui/loader.d.ts +0 -6
  243. package/dist/ui/loader.d.ts.map +0 -1
  244. package/dist/ui/loader.js +0 -25
  245. package/dist/ui/loader.js.map +0 -1
  246. package/dist/ui/menu.d.ts +0 -41
  247. package/dist/ui/menu.d.ts.map +0 -1
  248. package/dist/ui/menu.js +0 -154
  249. package/dist/ui/menu.js.map +0 -1
  250. package/dist/ui/menu.style.d.ts +0 -3
  251. package/dist/ui/menu.style.d.ts.map +0 -1
  252. package/dist/ui/menu.style.js +0 -50
  253. package/dist/ui/menu.style.js.map +0 -1
  254. package/dist/ui/numericInput.d.ts +0 -37
  255. package/dist/ui/numericInput.d.ts.map +0 -1
  256. package/dist/ui/numericInput.js +0 -175
  257. package/dist/ui/numericInput.js.map +0 -1
  258. package/dist/ui/numericInput.style.d.ts +0 -2
  259. package/dist/ui/numericInput.style.d.ts.map +0 -1
  260. package/dist/ui/numericInput.style.js +0 -29
  261. package/dist/ui/numericInput.style.js.map +0 -1
  262. package/dist/ui/overlay.d.ts +0 -17
  263. package/dist/ui/overlay.d.ts.map +0 -1
  264. package/dist/ui/overlay.js +0 -87
  265. package/dist/ui/overlay.js.map +0 -1
  266. package/dist/ui/overlay.style.d.ts +0 -2
  267. package/dist/ui/overlay.style.d.ts.map +0 -1
  268. package/dist/ui/overlay.style.js +0 -46
  269. package/dist/ui/overlay.style.js.map +0 -1
  270. package/dist/ui/panel.d.ts +0 -25
  271. package/dist/ui/panel.d.ts.map +0 -1
  272. package/dist/ui/panel.js +0 -151
  273. package/dist/ui/panel.js.map +0 -1
  274. package/dist/ui/panel.style.d.ts +0 -2
  275. package/dist/ui/panel.style.d.ts.map +0 -1
  276. package/dist/ui/panel.style.js +0 -73
  277. package/dist/ui/panel.style.js.map +0 -1
  278. package/dist/ui/sizer.d.ts +0 -53
  279. package/dist/ui/sizer.d.ts.map +0 -1
  280. package/dist/ui/sizer.js +0 -203
  281. package/dist/ui/sizer.js.map +0 -1
  282. package/dist/ui/slider.d.ts +0 -52
  283. package/dist/ui/slider.d.ts.map +0 -1
  284. package/dist/ui/slider.js +0 -213
  285. package/dist/ui/slider.js.map +0 -1
  286. package/dist/ui/slider.style.d.ts +0 -2
  287. package/dist/ui/slider.style.d.ts.map +0 -1
  288. package/dist/ui/slider.style.js +0 -61
  289. package/dist/ui/slider.style.js.map +0 -1
  290. package/dist/ui/sortableList.d.ts +0 -39
  291. package/dist/ui/sortableList.d.ts.map +0 -1
  292. package/dist/ui/sortableList.js +0 -167
  293. package/dist/ui/sortableList.js.map +0 -1
  294. package/dist/ui/splitContainer.d.ts +0 -52
  295. package/dist/ui/splitContainer.d.ts.map +0 -1
  296. package/dist/ui/splitContainer.js +0 -252
  297. package/dist/ui/splitContainer.js.map +0 -1
  298. package/dist/ui/splitContainer.style.d.ts +0 -2
  299. package/dist/ui/splitContainer.style.d.ts.map +0 -1
  300. package/dist/ui/splitContainer.style.js +0 -62
  301. package/dist/ui/splitContainer.style.js.map +0 -1
  302. package/dist/ui/switch.d.ts +0 -22
  303. package/dist/ui/switch.d.ts.map +0 -1
  304. package/dist/ui/switch.js +0 -83
  305. package/dist/ui/switch.js.map +0 -1
  306. package/dist/ui/switch.style.d.ts +0 -2
  307. package/dist/ui/switch.style.d.ts.map +0 -1
  308. package/dist/ui/switch.style.js +0 -149
  309. package/dist/ui/switch.style.js.map +0 -1
  310. package/dist/ui/tooltip.d.ts +0 -24
  311. package/dist/ui/tooltip.d.ts.map +0 -1
  312. package/dist/ui/tooltip.js +0 -143
  313. package/dist/ui/tooltip.js.map +0 -1
  314. package/dist/ui/tooltip.style.d.ts +0 -2
  315. package/dist/ui/tooltip.style.d.ts.map +0 -1
  316. package/dist/ui/tooltip.style.js +0 -112
  317. package/dist/ui/tooltip.style.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omegagrid/core",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Core components",
6
6
  "main": "./dist/index.js",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@fortawesome/fontawesome-svg-core": "^7.0.1",
39
- "@omegagrid/localize": "^0.10.1",
39
+ "@omegagrid/localize": "^0.10.2",
40
40
  "color": "^4.2.3",
41
41
  "date-fns": "^3.2.0",
42
42
  "lit": "^3.1.1",
@@ -1,16 +0,0 @@
1
- export type Action = {
2
- key: string;
3
- value?: unknown;
4
- type?: string;
5
- icon?: string;
6
- };
7
- export declare class ActionEvent<TArgs = null> extends Event {
8
- readonly scope: string;
9
- readonly action: Action;
10
- readonly args: TArgs;
11
- constructor(scope: string, action: Action, args?: TArgs, init?: EventInit & {
12
- common?: boolean;
13
- });
14
- }
15
- export declare function dispatchActionEvent<TArgs>(target: EventTarget, scope: string, action: Action, args?: TArgs, init?: EventInit): void;
16
- //# sourceMappingURL=actions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/common/actions.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,qBAAa,WAAW,CAAC,KAAK,GAAG,IAAI,CAAE,SAAQ,KAAK;aAElC,KAAK,EAAE,MAAM;aACb,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,KAAK;gBAFX,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,KAAY,EAClC,IAAI,GAAE,SAAS,GAAG;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAM;CAK1C;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,KAAY,EAAE,IAAI,GAAE,SAAgB,QAGxI"}
@@ -1,14 +0,0 @@
1
- export class ActionEvent extends Event {
2
- constructor(scope, action, args = null, init = {}) {
3
- init = Object.assign({ common: true, composed: true, bubbles: true }, init);
4
- super(`${scope}.action${init.common ? `` : `.${action.key}`}`, init);
5
- this.scope = scope;
6
- this.action = action;
7
- this.args = args;
8
- }
9
- }
10
- export function dispatchActionEvent(target, scope, action, args = null, init = null) {
11
- target.dispatchEvent(new ActionEvent(scope, action, args, Object.assign({ common: false }, init)));
12
- target.dispatchEvent(new ActionEvent(scope, action, args, Object.assign({ common: true }, init)));
13
- }
14
- //# sourceMappingURL=actions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/common/actions.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,WAA0B,SAAQ,KAAK;IACnD,YACiB,KAAa,EACb,MAAc,EACd,OAAc,IAAI,EAClC,OAAuC,EAAE;QAEzC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAC,EAAE,IAAI,CAAC,CAAC;QAC1E,KAAK,CAAC,GAAG,KAAK,UAAU,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;QANrD,UAAK,GAAL,KAAK,CAAQ;QACb,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAc;IAKnC,CAAC;CACD;AAED,MAAM,UAAU,mBAAmB,CAAQ,MAAmB,EAAE,KAAa,EAAE,MAAc,EAAE,OAAc,IAAI,EAAE,OAAkB,IAAI;IACxI,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAC,MAAM,EAAE,KAAK,EAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACjG,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACjG,CAAC","sourcesContent":["export type Action = {\n\tkey: string,\n\tvalue?: unknown,\n\ttype?: string,\n\ticon?: string\n}\n\nexport class ActionEvent<TArgs = null> extends Event {\n\tconstructor(\n\t\tpublic readonly scope: string,\n\t\tpublic readonly action: Action,\n\t\tpublic readonly args: TArgs = null,\n\t\tinit: EventInit & {common?: boolean} = {}\n\t) {\n\t\tinit = Object.assign({common: true, composed: true, bubbles: true}, init);\n\t\tsuper(`${scope}.action${init.common ? `` : `.${action.key}`}`, init);\n\t}\n}\n\nexport function dispatchActionEvent<TArgs>(target: EventTarget, scope: string, action: Action, args: TArgs = null, init: EventInit = null) {\n\ttarget.dispatchEvent(new ActionEvent(scope, action, args, Object.assign({common: false}, init)));\n\ttarget.dispatchEvent(new ActionEvent(scope, action, args, Object.assign({common: true}, init)));\n}"]}
@@ -1,39 +0,0 @@
1
- /**
2
- * @param color Color string based of color-string library (https://github.com/Qix-/color-string#readme)
3
- * @param amount
4
- * @returns Color hex string
5
- */
6
- export declare function lighten(color: string, amount?: number): string;
7
- /**
8
- * @param color Color string based of color-string library (https://github.com/Qix-/color-string#readme)
9
- * @param amount
10
- * @returns Color hex string
11
- */
12
- export declare function darken(color: string, amount?: number): string;
13
- /**
14
- * @param color Color string based of color-string library (https://github.com/Qix-/color-string#readme)
15
- * @param amount
16
- * @returns Color hex string
17
- */
18
- export declare function alpha(color: string, amount?: number): string;
19
- /**
20
- * @param color Color string based of color-string library (https://github.com/Qix-/color-string#readme)
21
- * @returns Color hex string
22
- */
23
- export declare function getComplmentaryColor(color: string): string;
24
- /**
25
- * @param startColor Color string based of color-string library (https://github.com/Qix-/color-string#readme)
26
- * @param endColor Color string based of color-string library (https://github.com/Qix-/color-string#readme)
27
- * @param amount
28
- * @returns Color hex string
29
- */
30
- export declare function mix(startColor: string, endColor: string, amount?: number): string;
31
- export declare function contrastColor(strColor: string): string;
32
- /**
33
- * Trims the leading hash sign.
34
- * @param strColor
35
- * @returns
36
- */
37
- export declare function plainHex(strColor: string): string;
38
- export declare function css(strColor: string): string;
39
- //# sourceMappingURL=colors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/common/colors.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,SAAO,GAAI,MAAM,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,SAAO,GAAI,MAAM,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,SAAO,GAAI,MAAM,CAE3D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,UAGjD;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAO,GAAI,MAAM,CAEhF;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAItD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,UAExC;AAED,wBAAgB,GAAG,CAAC,QAAQ,EAAE,MAAM,UAEnC"}
@@ -1,59 +0,0 @@
1
- import Color from 'color';
2
- /**
3
- * @param color Color string based of color-string library (https://github.com/Qix-/color-string#readme)
4
- * @param amount
5
- * @returns Color hex string
6
- */
7
- export function lighten(color, amount = 0.15) {
8
- return Color(color).lighten(amount).hex().toString();
9
- }
10
- /**
11
- * @param color Color string based of color-string library (https://github.com/Qix-/color-string#readme)
12
- * @param amount
13
- * @returns Color hex string
14
- */
15
- export function darken(color, amount = 0.15) {
16
- return Color(color).darken(amount).hex().toString();
17
- }
18
- /**
19
- * @param color Color string based of color-string library (https://github.com/Qix-/color-string#readme)
20
- * @param amount
21
- * @returns Color hex string
22
- */
23
- export function alpha(color, amount = 0.15) {
24
- return Color(color).alpha(amount).hexa().toString();
25
- }
26
- /**
27
- * @param color Color string based of color-string library (https://github.com/Qix-/color-string#readme)
28
- * @returns Color hex string
29
- */
30
- export function getComplmentaryColor(color) {
31
- const clr = Color(color);
32
- return clr.red(255 - clr.red()).green(255 - clr.green()).blue(255 - clr.red()).hex().toString();
33
- }
34
- /**
35
- * @param startColor Color string based of color-string library (https://github.com/Qix-/color-string#readme)
36
- * @param endColor Color string based of color-string library (https://github.com/Qix-/color-string#readme)
37
- * @param amount
38
- * @returns Color hex string
39
- */
40
- export function mix(startColor, endColor, amount = 0.15) {
41
- return Color(startColor).mix(Color(endColor), amount).hex().toString();
42
- }
43
- export function contrastColor(strColor) {
44
- const color = Color(strColor);
45
- const luminance = 0.299 * color.red() + 0.587 * color.green() + 0.114 * color.blue();
46
- return luminance > 128 ? '#000000' : '#FFFFFF';
47
- }
48
- /**
49
- * Trims the leading hash sign.
50
- * @param strColor
51
- * @returns
52
- */
53
- export function plainHex(strColor) {
54
- return strColor && strColor[0] == '#' ? strColor.substring(1) : strColor;
55
- }
56
- export function css(strColor) {
57
- return strColor && strColor[0] != '#' ? ('#' + strColor) : strColor;
58
- }
59
- //# sourceMappingURL=colors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/common/colors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,KAAa,EAAE,MAAM,GAAG,IAAI;IACnD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,KAAa,EAAE,MAAM,GAAG,IAAI;IAClD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;AACrD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,MAAM,GAAG,IAAI;IACjD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAA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AM,UAAU,GAAG,CAAC,QAAgB;IACnC,OAAO,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AACrE,CAAC","sourcesContent":["import Color from 'color';\n\n/**\n * @param color Color string based of color-string library (https://github.com/Qix-/color-string#readme)\n * @param amount \n * @returns Color hex string\n */\nexport function lighten(color: string, amount = 0.15) : string {\n\treturn Color(color).lighten(amount).hex().toString();\n}\n\n/**\n * @param color Color string based of color-string library (https://github.com/Qix-/color-string#readme)\n * @param amount \n * @returns Color hex string\n */\nexport function darken(color: string, amount = 0.15) : string {\n\treturn Color(color).darken(amount).hex().toString();\n}\n\n/**\n * @param color Color string based of color-string library (https://github.com/Qix-/color-string#readme)\n * @param amount \n * @returns Color hex string\n */\nexport function alpha(color: string, amount = 0.15) : string {\n\treturn Color(color).alpha(amount).hexa().toString();\n}\n\n/**\n * @param color Color string based of color-string library (https://github.com/Qix-/color-string#readme)\n * @returns Color hex string\n */\nexport function getComplmentaryColor(color: string) {\n\tconst clr = Color(color);\n\treturn clr.red(255 - clr.red()).green(255 - clr.green()).blue(255 - clr.red()).hex().toString();\n}\n\n/**\n * @param startColor Color string based of color-string library (https://github.com/Qix-/color-string#readme)\n * @param endColor Color string based of color-string library (https://github.com/Qix-/color-string#readme)\n * @param amount \n * @returns Color hex string\n */\nexport function mix(startColor: string, endColor: string, amount = 0.15) : string {\n\treturn Color(startColor).mix(Color(endColor), amount).hex().toString();\n}\n\nexport function contrastColor(strColor: string): string {\n\tconst color = Color(strColor);\n const luminance = 0.299 * color.red() + 0.587 * color.green() + 0.114 * color.blue();\n return luminance > 128 ? '#000000' : '#FFFFFF';\n}\n\n/**\n * Trims the leading hash sign.\n * @param strColor \n * @returns \n */\nexport function plainHex(strColor: string) {\n\treturn strColor && strColor[0] == '#' ? strColor.substring(1) : strColor;\n}\n\nexport function css(strColor: string) {\n\treturn strColor && strColor[0] != '#' ? ('#' + strColor) : strColor;\n}"]}
@@ -1,23 +0,0 @@
1
- import { Matrix } from "../types";
2
- export type CsvDelimiter = ',' | ';' | '\t' | '|';
3
- export type CsvQuote = '' | '"' | '\'';
4
- export type CsvDescription = {
5
- delimiter: CsvDelimiter;
6
- quote: CsvQuote;
7
- encoding: string;
8
- decimalSeparator: '.' | ',';
9
- header: boolean;
10
- };
11
- export declare const DEFAULT_CSV_DESCRIPTION: CsvDescription;
12
- export declare class CsvReader {
13
- private csv;
14
- private offset;
15
- private length;
16
- private description;
17
- constructor(csv: string, description: Partial<CsvDescription>);
18
- get eof(): boolean;
19
- readLine(): string[];
20
- }
21
- export declare function arrayToCsv(data: Matrix, csvDescription?: Partial<CsvDescription>): string;
22
- export declare function csvToArray(csv: string, csvDescription?: Partial<CsvDescription>): Matrix<string>;
23
- //# sourceMappingURL=csv.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../src/common/csv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,MAAM,MAAM,YAAY,GAAG,GAAG,GAAC,GAAG,GAAC,IAAI,GAAC,GAAG,CAAC;AAC5C,MAAM,MAAM,QAAQ,GAAG,EAAE,GAAC,GAAG,GAAC,IAAI,CAAC;AAEnC,MAAM,MAAM,cAAc,GAAG;IAC5B,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,EAAE,QAAQ,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,GAAG,GAAC,GAAG,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAA;CACf,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,cAMrC,CAAC;AAEF,qBAAa,SAAS;IAOpB,OAAO,CAAC,GAAG;IALZ,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,WAAW,CAAiB;gBAG3B,GAAG,EAAE,MAAM,EACnB,WAAW,EAAE,OAAO,CAAC,cAAc,CAAC;IAMrC,IAAI,GAAG,YAAwC;IAE/C,QAAQ;CA6CR;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAI,MAAM,CAe1F;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAWhG"}
@@ -1,93 +0,0 @@
1
- import { trim } from "./utils";
2
- export const DEFAULT_CSV_DESCRIPTION = {
3
- delimiter: '\t',
4
- quote: '',
5
- encoding: 'utf-8',
6
- decimalSeparator: '.',
7
- header: false,
8
- };
9
- export class CsvReader {
10
- constructor(csv, description) {
11
- this.csv = csv;
12
- this.offset = 0;
13
- this.length = csv.length;
14
- this.description = Object.assign({}, DEFAULT_CSV_DESCRIPTION, description);
15
- }
16
- get eof() { return this.offset >= this.length; }
17
- readLine() {
18
- if (this.eof)
19
- return null;
20
- const values = [];
21
- let char, value = '', insideQuotedString = false;
22
- while (this.offset < this.length) {
23
- char = this.csv.charAt(this.offset++);
24
- if (char === '\n') {
25
- if (insideQuotedString) {
26
- continue;
27
- }
28
- else {
29
- values.push(value);
30
- value = null;
31
- break;
32
- }
33
- }
34
- if (char === '\r')
35
- continue;
36
- if (insideQuotedString) {
37
- if (char === this.description.quote) {
38
- value = trim(value, this.description.quote);
39
- insideQuotedString = false;
40
- }
41
- else {
42
- value += char;
43
- }
44
- }
45
- else {
46
- if (char == this.description.delimiter) {
47
- values.push(value);
48
- value = '';
49
- }
50
- else if (value == '' && char == this.description.quote) {
51
- insideQuotedString = true;
52
- value = '';
53
- }
54
- else {
55
- value += char;
56
- }
57
- }
58
- }
59
- if (value != null)
60
- values.push(value);
61
- return values;
62
- }
63
- }
64
- export function arrayToCsv(data, csvDescription) {
65
- csvDescription = Object.assign({}, DEFAULT_CSV_DESCRIPTION, csvDescription);
66
- let csv = '';
67
- for (let r = 0; r < data.length; r++) {
68
- csv += data[r].map((v) => {
69
- if (v == null)
70
- return '';
71
- else if (isNaN(v))
72
- return (v ?? "").toString().replace(csvDescription.delimiter, " ");
73
- else if (csvDescription.decimalSeparator != '.')
74
- return v.toString().replace('.', csvDescription.decimalSeparator);
75
- else
76
- return v.toString();
77
- }).join(csvDescription.delimiter) + "\n";
78
- }
79
- return csv;
80
- }
81
- export function csvToArray(csv, csvDescription) {
82
- const data = [];
83
- let line;
84
- const reader = new CsvReader(csv, csvDescription);
85
- while (!reader.eof) {
86
- line = reader.readLine();
87
- if (line && line.length > 0) {
88
- data.push(line);
89
- }
90
- }
91
- return data;
92
- }
93
- //# sourceMappingURL=csv.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"csv.js","sourceRoot":"","sources":["../../src/common/csv.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAa/B,MAAM,CAAC,MAAM,uBAAuB,GAAmB;IACtD,SAAS,EAAE,IAAI;IACf,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,OAAO;IACjB,gBAAgB,EAAE,GAAG;IACrB,MAAM,EAAE,KAAK;CACb,CAAC;AAEF,MAAM,OAAO,SAAS;IAMrB,YACS,GAAW,EACnB,WAAoC;QAD5B,QAAG,GAAH,GAAG,CAAQ;QALZ,WAAM,GAAG,CAAC,CAAC;QAQlB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,uBAAuB,EAAE,WAAW,CAAC,CAAC;IAC5E,CAAC;IAED,IAAI,GAAG,KAAK,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAA,CAAC,CAAC;IAE/C,QAAQ;QACP,IAAI,IAAI,CAAC,GAAG;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AAE,cAAc,CAAC,CAAC;IAClD,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACpB,IAAI,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QACzB,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["import { Matrix } from \"../types\";\nimport { trim } from \"./utils\";\n\nexport type CsvDelimiter = ','|';'|'\\t'|'|';\nexport type CsvQuote = ''|'\"'|'\\'';\n\nexport type CsvDescription = {\n\tdelimiter: CsvDelimiter,\n\tquote: CsvQuote,\n\tencoding: string,\n\tdecimalSeparator: '.'|',';\n\theader: boolean\n}\n\nexport const DEFAULT_CSV_DESCRIPTION: CsvDescription = {\n\tdelimiter: '\\t',\n\tquote: '',\n\tencoding: 'utf-8',\n\tdecimalSeparator: '.',\n\theader: false,\n};\n\nexport class CsvReader {\n\n\tprivate offset = 0;\n\tprivate length: number;\n\tprivate description: CsvDescription;\n\n\tconstructor(\n\t\tprivate csv: string, \n\t\tdescription: Partial<CsvDescription>\n\t) {\n\t\tthis.length = csv.length;\n\t\tthis.description = Object.assign({}, DEFAULT_CSV_DESCRIPTION, description);\n\t}\n\n\tget eof() { return this.offset >= this.length }\n\n\treadLine() {\n\t\tif (this.eof) return null;\n\n\t\tconst values: string[] = [];\n\t\tlet char: string, value = '', insideQuotedString = false;\n\t\twhile (this.offset < this.length) {\n\t\t\tchar = this.csv.charAt(this.offset++);\n\n\t\t\tif (char === '\\n') {\n\t\t\t\tif (insideQuotedString) {\n\t\t\t\t\tcontinue;\n\t\t\t\t} else {\n\t\t\t\t\tvalues.push(value);\n\t\t\t\t\tvalue = null;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (char === '\\r') continue;\n\n\t\t\tif (insideQuotedString) {\n\t\t\t\tif (char === this.description.quote) {\n\t\t\t\t\tvalue = trim(value, this.description.quote);\n\t\t\t\t\tinsideQuotedString = false;\n\t\t\t\t} else {\n\t\t\t\t\tvalue += char;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (char == this.description.delimiter) {\n\t\t\t\t\tvalues.push(value);\n\t\t\t\t\tvalue = '';\n\t\t\t\t} else if (value == '' && char == this.description.quote) {\n\t\t\t\t\tinsideQuotedString = true;\n\t\t\t\t\tvalue = '';\n\t\t\t\t} else {\n\t\t\t\t\tvalue += char;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (value != null) values.push(value);\n\t\t\n\t\treturn values;\n\t}\n\n}\n\nexport function arrayToCsv(data: Matrix, csvDescription?: Partial<CsvDescription>) : string {\n\tcsvDescription = Object.assign({}, DEFAULT_CSV_DESCRIPTION, csvDescription);\n\tlet csv = '';\n\tfor (let r = 0; r < data.length; r++) {\n\t\tcsv += data[r].map((v: unknown) => {\n\t\t\tif (v == null)\n\t\t\t\treturn '';\n\t\t\telse if (isNaN(v as number))\n\t\t\t\treturn (v ?? \"\").toString().replace(csvDescription.delimiter, \" \")\n\t\t\telse if (csvDescription.decimalSeparator != '.') \n\t\t\t\treturn v.toString().replace('.', csvDescription.decimalSeparator);\n\t\t\telse return v.toString();\n\t\t}).join(csvDescription.delimiter) + \"\\n\";\n\t}\n\treturn csv;\n}\n\nexport function csvToArray(csv: string, csvDescription?: Partial<CsvDescription>): Matrix<string> {\n\tconst data: Matrix<string> = [];\n\tlet line: string[];\n\tconst reader = new CsvReader(csv, csvDescription);\n\twhile (!reader.eof) {\n\t\tline = reader.readLine();\n\t\tif (line && line.length > 0) {\n\t\t\tdata.push(line);\n\t\t}\n\t}\n\treturn data;\n}"]}
@@ -1,32 +0,0 @@
1
- import { Locale } from 'date-fns';
2
- export declare function registerDateLocale(locale: Locale): void;
3
- export type DateFormatString = string;
4
- export type DateFormatterFunction = (date: number | string | Date, format?: string) => string;
5
- /**
6
- * Primitive way to guess date format from string
7
- * @param date
8
- * @param locale
9
- * @return string
10
- */
11
- export declare function detectFormat(date: string, locale: string): "MM/dd/yyyy" | "dd.MM.yyyy" | "yyyy-MM-dd";
12
- export declare function isISODate(date: string): boolean;
13
- export declare function detectDefaultFormat(locale?: string): string;
14
- export type DateFormatOptions = {
15
- locale?: string;
16
- withTime?: boolean;
17
- };
18
- export declare function getDateFormat(opt?: DateFormatOptions): DateFormatString;
19
- export declare function format(date: number | string | Date, format?: DateFormatString, locale?: string): string;
20
- export declare function parse(date: string, locale: string): Date;
21
- export declare function getDateFormatter(locale: string, format?: DateFormatString): DateFormatterFunction;
22
- export declare function getDateLocale(code: string): Locale;
23
- export declare function createDateFormatter(locale: string, defaultFormat?: DateFormatString): DateFormatterFunction;
24
- export declare function getFiscalYear(date: Date, monthOffset: number): number;
25
- export declare function getFiscalQuarter(date: Date, monthOffset: number): number;
26
- export declare function stripTime(date: Date): Date;
27
- export declare function getFiscalYearBounds(date: Date, monthOffset: number): [Date, Date];
28
- export declare function getFiscalISOWeek(date: Date, monthOffset?: number, firstDayOfWeek?: number): [number, number];
29
- export declare function dateToSerialDate(date: Date): number;
30
- export declare function serialDateToDate(sn: number): Date;
31
- export declare function workday(sn: number, count: number, holidays?: number[]): number;
32
- //# sourceMappingURL=dates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../../src/common/dates.ts"],"names":[],"mappings":"AAAA,OAAO,EAEK,MAAM,EACjB,MAAM,UAAU,CAAC;AASlB,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,QAEhD;AAKD,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AACtC,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAC,MAAM,GAAC,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAM1F;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI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AM,CAAC,CA2BnG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,UAE1C;AAID,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,QAM1C;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,UAarE"}
@@ -1,172 +0,0 @@
1
- import { addMonths, compareAsc, differenceInDays, endOfMonth, format as fnsFormat, parseISO, getISODay, parse as fnsParse, subDays, subMonths, subYears, intlFormat, startOfDay } from 'date-fns';
2
- import { mod } from './numbers';
3
- import { isString } from './utils';
4
- import { enUS } from 'date-fns/locale/en-US';
5
- import { cs } from 'date-fns/locale/cs';
6
- import { getLocale, getRegionISOCode } from '@omegagrid/localize';
7
- const localeMap = new Map();
8
- export function registerDateLocale(locale) {
9
- localeMap.set(locale.code, locale);
10
- }
11
- registerDateLocale(enUS);
12
- registerDateLocale(cs);
13
- const formatterMap = new Map();
14
- const DETECTION_REGEX = /^(\d{1,2})[./](\d{1,2})[./](\d{4})$/;
15
- /**
16
- * Primitive way to guess date format from string
17
- * @param date
18
- * @param locale
19
- * @return string
20
- */
21
- export function detectFormat(date, locale) {
22
- if (DETECTION_REGEX.test(date.replace(/\s/g, ''))) {
23
- if (locale.startsWith('en') && date[2] === '/') {
24
- return 'MM/dd/yyyy';
25
- }
26
- else {
27
- return 'dd.MM.yyyy';
28
- }
29
- }
30
- else {
31
- return 'yyyy-MM-dd';
32
- }
33
- }
34
- export function isISODate(date) {
35
- return date.length >= 10 && date[4] === '-' && date[7] === '-';
36
- }
37
- let defaultFormats;
38
- export function detectDefaultFormat(locale) {
39
- locale = locale ?? getLocale();
40
- defaultFormats = defaultFormats ?? new Map();
41
- if (defaultFormats.has(locale))
42
- return defaultFormats.get(locale);
43
- let format;
44
- try {
45
- const isoCode = getRegionISOCode(locale);
46
- format = detectFormat(intlFormat(startOfDay(new Date()), { locale: isoCode }), isoCode);
47
- }
48
- catch (_error) {
49
- format = 'yyyy-MM-dd';
50
- }
51
- defaultFormats.set(locale, format);
52
- return format;
53
- }
54
- export function getDateFormat(opt) {
55
- let format = detectDefaultFormat(opt?.locale);
56
- if (opt?.withTime) {
57
- format += ' HH:mm:ss';
58
- }
59
- return format;
60
- }
61
- export function format(date, format, locale) {
62
- return getDateFormatter(locale ?? getLocale(), format)(date);
63
- }
64
- export function parse(date, locale) {
65
- const d = fnsParse(date, detectFormat(date, locale), new Date());
66
- return isNaN(d.getTime()) ? null : d;
67
- }
68
- export function getDateFormatter(locale, format) {
69
- format = format ?? detectDefaultFormat(locale);
70
- const map = formatterMap.has(locale) ? formatterMap.get(locale) : formatterMap.set(locale, new Map()).get(locale);
71
- if (!map.has(format))
72
- map.set(format, createDateFormatter(locale, format));
73
- return map.get(format);
74
- }
75
- export function getDateLocale(code) {
76
- if (localeMap.has(code))
77
- return localeMap.get(code);
78
- code = code.split('-')[0];
79
- if (localeMap.has(code))
80
- return localeMap.get(code);
81
- return localeMap.get('en-US');
82
- }
83
- // https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
84
- export function createDateFormatter(locale, defaultFormat) {
85
- defaultFormat = defaultFormat ?? detectDefaultFormat(locale);
86
- return (date, strFormat) => {
87
- if (isString(date)) {
88
- date = isISODate(date) ? parseISO(date) : parse(date, locale);
89
- }
90
- else if (!(date instanceof Date) && !isNaN(date)) {
91
- date = serialDateToDate(date);
92
- }
93
- if (date == null)
94
- return '';
95
- return fnsFormat(date, strFormat || defaultFormat, { locale: getDateLocale(locale) });
96
- };
97
- }
98
- export function getFiscalYear(date, monthOffset) {
99
- const y = date.getFullYear();
100
- const m = date.getMonth() + 1;
101
- return monthOffset >= 0
102
- ? y - Math.floor((12 - m + monthOffset) / 12)
103
- : y + Math.floor((m - monthOffset - 1) / 12);
104
- }
105
- export function getFiscalQuarter(date, monthOffset) {
106
- const m = mod(date.getMonth() - monthOffset, 12);
107
- return Math.floor(m / 3) + 1;
108
- }
109
- export function stripTime(date) {
110
- date.setHours(0);
111
- date.setMinutes(0);
112
- date.setSeconds(0);
113
- date.setMilliseconds(0);
114
- return date;
115
- }
116
- export function getFiscalYearBounds(date, monthOffset) {
117
- let min = new Date(date.getFullYear(), mod(monthOffset, 12), 1);
118
- if (compareAsc(date, min) < 0)
119
- min = subYears(min, 1);
120
- return [min, stripTime(endOfMonth(addMonths(new Date(min), 11)))];
121
- }
122
- export function getFiscalISOWeek(date, monthOffset = 0, firstDayOfWeek = 1) {
123
- const [fyMin, fyMax] = getFiscalYearBounds(date, monthOffset);
124
- const doy = differenceInDays(date, fyMin) + 1;
125
- const dow = ((getISODay(date) + firstDayOfWeek - 2) % 7) + 1;
126
- let fy = getFiscalYear(date, monthOffset);
127
- // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_the_week_number_from_an_ordinal_date
128
- let w = Math.floor((10 + doy - dow) / 7);
129
- // https://en.wikipedia.org/wiki/ISO_week_date#Weeks_per_year
130
- if (w == 0) {
131
- const lastWeekDay = subDays(fyMin, 4);
132
- const doyLastWeekDay = differenceInDays(lastWeekDay, subMonths(fyMin, 12)) + 1;
133
- const dowLastWeekDay = (getISODay(lastWeekDay) + firstDayOfWeek - 1) % 7;
134
- w = Math.floor((10 + doyLastWeekDay - dowLastWeekDay) / 7);
135
- --fy;
136
- }
137
- else if (w > 52) {
138
- const lastWeekDay = subDays(fyMax, 3);
139
- const doyLastWeekDay = differenceInDays(lastWeekDay, fyMin) + 1;
140
- const dowLastWeekDay = (getISODay(lastWeekDay) + firstDayOfWeek - 1) % 7;
141
- if (w > Math.floor((10 + doyLastWeekDay - dowLastWeekDay) / 7)) {
142
- w = 1;
143
- ++fy;
144
- }
145
- }
146
- return [w, fy];
147
- }
148
- export function dateToSerialDate(date) {
149
- return 25569.0 + ((date.getTime() - (date.getTimezoneOffset() * 60 * 1000)) / (1000 * 60 * 60 * 24));
150
- }
151
- // https://stackoverflow.com/a/67130235
152
- export function serialDateToDate(sn) {
153
- // for dates > 1900-02-28
154
- return new Date(Date.UTC(0, 0, sn - 1));
155
- // for dates <= 1900-02-28
156
- // return new Date(Date.UTC(0, 0, excelSerialDate));
157
- }
158
- export function workday(sn, count, holidays) {
159
- const date = serialDateToDate(sn);
160
- let wd = date.getDay();
161
- let holidayMap;
162
- if (holidays && holidays.length > 0)
163
- holidays.forEach(h => holidayMap.set(h, h));
164
- while (count > 0) {
165
- ++sn;
166
- wd = (++wd > 7 ? 1 : wd);
167
- if (wd < 6 && (!holidayMap || !holidayMap.has(sn)))
168
- --count;
169
- }
170
- return sn;
171
- }
172
- //# sourceMappingURL=dates.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dates.js","sourceRoot":"","sources":["../../src/common/dates.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,IAAI,SAAS,EAAE,QAAQ,EAClF,SAAS,EAAU,KAAK,IAAI,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAC1F,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAElE,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;AAE5C,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAChD,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACpC,CAAC;AAED,kBAAkB,CAAC,IAAI,CAAC,CAAC;AACzB,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAKvB,MAAM,YAAY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AAI,CAAC,MAAM,EAAE,CAAC;IACvB,IAAI,UAA+B,CAAC;IACpC,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAEjF,OAAO,KAAK,GAAG,CAAC,EAAE,CAAC;QAClB,EAAE,EAAE,CAAC;QACL,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACzB,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAAE,EAAE,KAAK,CAAC;IAC7D,CAAC;IAED,OAAO,EAAE,CAAC;AACX,CAAC","sourcesContent":["import { \n\taddMonths, compareAsc, differenceInDays, endOfMonth, format as fnsFormat, parseISO,\n\tgetISODay, Locale, parse as fnsParse, subDays, subMonths, subYears, intlFormat, startOfDay\n} from 'date-fns';\nimport { mod } from './numbers';\nimport { isString } from './utils';\nimport { enUS } from 'date-fns/locale/en-US';\nimport { cs } from 'date-fns/locale/cs';\nimport { getLocale, getRegionISOCode } from '@omegagrid/localize';\n\nconst localeMap = new Map<string, Locale>();\n\nexport function registerDateLocale(locale: Locale) {\n\tlocaleMap.set(locale.code, locale);\n}\n\nregisterDateLocale(enUS);\nregisterDateLocale(cs);\n\nexport type DateFormatString = string;\nexport type DateFormatterFunction = (date: number|string|Date, format?: string) => string;\n\nconst formatterMap = new Map<string, Map<DateFormatString, DateFormatterFunction>>();\n\nconst DETECTION_REGEX = /^(\\d{1,2})[./](\\d{1,2})[./](\\d{4})$/;\n\n/**\n * Primitive way to guess date format from string\n * @param date \n * @param locale \n * @return string\n */\nexport function detectFormat(date: string, locale: string) {\n\tif (DETECTION_REGEX.test(date.replace(/\\s/g, ''))) {\n\t\tif (locale.startsWith('en') && date[2] === '/') {\n\t\t\treturn 'MM/dd/yyyy';\n\t\t} else {\n\t\t\treturn 'dd.MM.yyyy';\n\t\t}\n\t} else {\n\t\treturn 'yyyy-MM-dd';\n\t}\n}\n\nexport function isISODate(date: string) {\n\treturn date.length >= 10 && date[4] === '-' && date[7] === '-';\n}\n\nlet defaultFormats: Map<string, string>;\nexport function detectDefaultFormat(locale?: string) {\n\tlocale = locale ?? getLocale();\n\tdefaultFormats = defaultFormats ?? new Map();\n\tif (defaultFormats.has(locale)) return defaultFormats.get(locale);\n\t\n\tlet format: string;\n\ttry {\n\t\tconst isoCode = getRegionISOCode(locale);\n\t\tformat = detectFormat(intlFormat(startOfDay(new Date()), {locale: isoCode}), isoCode);\n\t} catch (_error) {\n\t\tformat = 'yyyy-MM-dd';\n\t}\n\tdefaultFormats.set(locale, format);\n\treturn format;\n}\n\nexport type DateFormatOptions = {\n\tlocale?: string;\n\twithTime?: boolean;\n}\n\nexport function getDateFormat(opt?: DateFormatOptions): DateFormatString {\n\tlet format = detectDefaultFormat(opt?.locale);\n\tif (opt?.withTime) {\n\t\tformat += ' HH:mm:ss';\n\t}\n\treturn format;\n}\n\nexport function format(date: number|string|Date, format?: DateFormatString, locale?: string) {\n\treturn getDateFormatter(locale ?? getLocale(), format)(date as number|string|Date);\n}\n\nexport function parse(date: string, locale: string) {\n\tconst d = fnsParse(date as string, detectFormat(date as string, locale), new Date());\n\treturn isNaN(d.getTime()) ? null : d;\n}\n\nexport function getDateFormatter(locale: string, format?: DateFormatString) : DateFormatterFunction {\n\tformat = format ?? detectDefaultFormat(locale);\n\tconst map = formatterMap.has(locale) ? formatterMap.get(locale) : formatterMap.set(locale, new Map()).get(locale);\n\tif (!map.has(format)) map.set(format, createDateFormatter(locale, format));\n\treturn map.get(format);\n}\n\nexport function getDateLocale(code: string) {\n\tif (localeMap.has(code)) return localeMap.get(code);\n\tcode = code.split('-')[0];\n\tif (localeMap.has(code)) return localeMap.get(code);\n\treturn localeMap.get('en-US');\n}\n\n// https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\nexport function createDateFormatter(locale: string, defaultFormat?: DateFormatString) : DateFormatterFunction {\n\tdefaultFormat = defaultFormat ?? detectDefaultFormat(locale);\n\treturn (date: number|string|Date, strFormat?: string) => {\n\t\tif (isString(date)) {\n\t\t\tdate = isISODate(date) ? parseISO(date as string) : parse(date as string, locale);\n\t\t} else if (!(date instanceof Date) && !isNaN(date as number)) {\n\t\t\tdate = serialDateToDate(date as number);\n\t\t}\n\t\t\n\t\tif (date == null) return '';\n\t\treturn fnsFormat(date as Date, strFormat || defaultFormat, {locale: getDateLocale(locale)});\n\t};\n}\n\nexport function getFiscalYear(date: Date, monthOffset: number) {\n\tconst y = date.getFullYear();\n\tconst m = date.getMonth() + 1;\n\treturn monthOffset >= 0\n\t\t? y - Math.floor((12 - m + monthOffset) / 12)\n\t\t: y + Math.floor((m - monthOffset - 1) / 12);\n}\n\nexport function getFiscalQuarter(date: Date, monthOffset: number) {\n\tconst m = mod(date.getMonth() - monthOffset, 12);\n\treturn Math.floor(m / 3) + 1;\n}\n\nexport function stripTime(date: Date) {\n\tdate.setHours(0);\n\tdate.setMinutes(0);\n\tdate.setSeconds(0);\n\tdate.setMilliseconds(0);\n\treturn date;\n}\n\nexport function getFiscalYearBounds(date: Date, monthOffset: number): [Date, Date] {\n\tlet min = new Date(date.getFullYear(), mod(monthOffset, 12), 1);\n\tif (compareAsc(date, min) < 0) min = subYears(min, 1);\n\treturn [min, stripTime(endOfMonth(addMonths(new Date(min), 11)))];\n}\n\nexport function getFiscalISOWeek(date: Date, monthOffset = 0, firstDayOfWeek = 1) : [number, number] {\n\tconst [fyMin, fyMax] = getFiscalYearBounds(date, monthOffset);\n\tconst doy = differenceInDays(date, fyMin) + 1;\n\tconst dow = ((getISODay(date) + firstDayOfWeek - 2) % 7) + 1;\n\tlet fy = getFiscalYear(date, monthOffset);\n\n\t// https://en.wikipedia.org/wiki/ISO_week_date#Calculating_the_week_number_from_an_ordinal_date\n\tlet w = Math.floor((10 + doy - dow) / 7);\n\n\t// https://en.wikipedia.org/wiki/ISO_week_date#Weeks_per_year\n\tif (w == 0) {\n\t\tconst lastWeekDay = subDays(fyMin, 4); \n\t\tconst doyLastWeekDay = differenceInDays(lastWeekDay, subMonths(fyMin, 12)) + 1;\n\t\tconst dowLastWeekDay = (getISODay(lastWeekDay) + firstDayOfWeek - 1) % 7;\n\t\tw = Math.floor((10 + doyLastWeekDay - dowLastWeekDay) / 7);\n\t\t--fy;\n\t} else if (w > 52) {\n\t\tconst lastWeekDay = subDays(fyMax, 3); \n\t\tconst doyLastWeekDay = differenceInDays(lastWeekDay, fyMin) + 1;\n\t\tconst dowLastWeekDay = (getISODay(lastWeekDay) + firstDayOfWeek - 1) % 7;\n\t\tif (w > Math.floor((10 + doyLastWeekDay - dowLastWeekDay) / 7)) {\n\t\t\tw = 1;\n\t\t\t++fy;\n\t\t}\n\t}\n\n\treturn [w, fy];\n}\n\nexport function dateToSerialDate(date: Date) {\n\treturn 25569.0 + ((date.getTime() - (date.getTimezoneOffset() * 60 * 1000)) / (1000 * 60 * 60 * 24));\n}\n\n\n// https://stackoverflow.com/a/67130235\nexport function serialDateToDate(sn: number) {\n\t// for dates > 1900-02-28\n\treturn new Date(Date.UTC(0, 0, sn - 1));\n\n\t// for dates <= 1900-02-28\n\t// return new Date(Date.UTC(0, 0, excelSerialDate));\n}\n\nexport function workday(sn: number, count: number, holidays?: number[]) {\n\tconst date = serialDateToDate(sn);\n\tlet wd = date.getDay();\n\tlet holidayMap: Map<number, number>;\n\tif (holidays && holidays.length > 0) holidays.forEach(h => holidayMap.set(h, h));\n\n\twhile (count > 0) {\n\t\t++sn;\n\t\twd = (++wd > 7 ? 1 : wd);\n\t\tif (wd < 6 && (!holidayMap || !holidayMap.has(sn))) --count;\n\t}\n\t\n\treturn sn;\n}"]}
@@ -1,2 +0,0 @@
1
- export declare function detect(): 'mobile' | 'tablet' | 'desktop';
2
- //# sourceMappingURL=device.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/common/device.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,IAAI,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAUxD"}
@@ -1,13 +0,0 @@
1
- export function detect() {
2
- const width = window.innerWidth;
3
- if (width <= 768) {
4
- return 'mobile';
5
- }
6
- else if (width > 768 && width <= 1024) {
7
- return 'tablet';
8
- }
9
- else {
10
- return 'desktop';
11
- }
12
- }
13
- //# sourceMappingURL=device.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/common/device.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,MAAM;IACrB,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;IAEhC,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;QAClB,OAAO,QAAQ,CAAC;IACjB,CAAC;SAAM,IAAI,KAAK,GAAG,GAAG,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QACzC,OAAO,QAAQ,CAAC;IACjB,CAAC;SAAM,CAAC;QACP,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC","sourcesContent":["export function detect(): 'mobile' | 'tablet' | 'desktop' {\n\tconst width = window.innerWidth;\n\n\tif (width <= 768) {\n\t\treturn 'mobile';\n\t} else if (width > 768 && width <= 1024) {\n\t\treturn 'tablet';\n\t} else {\n\t\treturn 'desktop';\n\t}\n}"]}