limitng 0.24.2 → 0.24.3

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 (377) hide show
  1. package/fesm2022/limitng-alt-buyuk-kart.mjs +191 -37
  2. package/fesm2022/limitng-alt-buyuk-kart.mjs.map +1 -1
  3. package/fesm2022/limitng-alt-kucuk-kart.mjs +157 -32
  4. package/fesm2022/limitng-alt-kucuk-kart.mjs.map +1 -1
  5. package/fesm2022/limitng-api-models-bildirimler.mjs +41 -45
  6. package/fesm2022/limitng-api-models-bildirimler.mjs.map +1 -1
  7. package/fesm2022/limitng-api-models-enums.mjs +345 -350
  8. package/fesm2022/limitng-api-models-enums.mjs.map +1 -1
  9. package/fesm2022/limitng-api-models-fourDConstants.mjs +84 -88
  10. package/fesm2022/limitng-api-models-fourDConstants.mjs.map +1 -1
  11. package/fesm2022/limitng-api-models-kisisel-izinislemleri-izindetaylari.mjs +25 -30
  12. package/fesm2022/limitng-api-models-kisisel-izinislemleri-izindetaylari.mjs.map +1 -1
  13. package/fesm2022/limitng-api-models-kisisel-izinislemleri-izinfiltre.mjs +17 -22
  14. package/fesm2022/limitng-api-models-kisisel-izinislemleri-izinfiltre.mjs.map +1 -1
  15. package/fesm2022/limitng-api-models-kisisel-izinislemleri-izinguncelle.mjs +0 -4
  16. package/fesm2022/limitng-api-models-kisisel-izinislemleri-izinliste.mjs +28 -32
  17. package/fesm2022/limitng-api-models-kisisel-izinislemleri-izinliste.mjs.map +1 -1
  18. package/fesm2022/limitng-api-models-kisisel-izinislemleri.mjs +1 -5
  19. package/fesm2022/limitng-api-models-kisisel-izinislemleri.mjs.map +1 -1
  20. package/fesm2022/limitng-api-models-kisisel-masrafislemleri-masrafdetaylari.mjs +61 -66
  21. package/fesm2022/limitng-api-models-kisisel-masrafislemleri-masrafdetaylari.mjs.map +1 -1
  22. package/fesm2022/limitng-api-models-kisisel-masrafislemleri-masraffiltre.mjs +18 -23
  23. package/fesm2022/limitng-api-models-kisisel-masrafislemleri-masraffiltre.mjs.map +1 -1
  24. package/fesm2022/limitng-api-models-kisisel-masrafislemleri-masrafguncelle.mjs +0 -4
  25. package/fesm2022/limitng-api-models-kisisel-masrafislemleri-masrafliste.mjs +47 -51
  26. package/fesm2022/limitng-api-models-kisisel-masrafislemleri-masrafliste.mjs.map +1 -1
  27. package/fesm2022/limitng-api-models-kisisel-masrafislemleri.mjs +1 -5
  28. package/fesm2022/limitng-api-models-kisisel-masrafislemleri.mjs.map +1 -1
  29. package/fesm2022/limitng-api-models-kisisel-onayislemleri-onaydetaylari.mjs +47 -51
  30. package/fesm2022/limitng-api-models-kisisel-onayislemleri-onaydetaylari.mjs.map +1 -1
  31. package/fesm2022/limitng-api-models-kisisel-onayislemleri-onayfiltre.mjs +37 -42
  32. package/fesm2022/limitng-api-models-kisisel-onayislemleri-onayfiltre.mjs.map +1 -1
  33. package/fesm2022/limitng-api-models-kisisel-onayislemleri-onayguncelle.mjs +11 -15
  34. package/fesm2022/limitng-api-models-kisisel-onayislemleri-onayguncelle.mjs.map +1 -1
  35. package/fesm2022/limitng-api-models-kisisel-onayislemleri-onayliste.mjs +37 -41
  36. package/fesm2022/limitng-api-models-kisisel-onayislemleri-onayliste.mjs.map +1 -1
  37. package/fesm2022/limitng-api-models-kisisel-onayislemleri.mjs +1 -5
  38. package/fesm2022/limitng-api-models-kisisel-onayislemleri.mjs.map +1 -1
  39. package/fesm2022/limitng-api-models-kisisel.mjs +1 -5
  40. package/fesm2022/limitng-api-models-kisisel.mjs.map +1 -1
  41. package/fesm2022/limitng-api-models-logbook.mjs +130 -135
  42. package/fesm2022/limitng-api-models-logbook.mjs.map +1 -1
  43. package/fesm2022/limitng-api-models-login.mjs +61 -79
  44. package/fesm2022/limitng-api-models-login.mjs.map +1 -1
  45. package/fesm2022/limitng-api-models-onay-onayagonderdetaylari.mjs +57 -61
  46. package/fesm2022/limitng-api-models-onay-onayagonderdetaylari.mjs.map +1 -1
  47. package/fesm2022/limitng-api-models-onay-onaybilgi.mjs +0 -4
  48. package/fesm2022/limitng-api-models-onay.mjs +1 -5
  49. package/fesm2022/limitng-api-models-onay.mjs.map +1 -1
  50. package/fesm2022/limitng-api-models-ortak.mjs +169 -178
  51. package/fesm2022/limitng-api-models-ortak.mjs.map +1 -1
  52. package/fesm2022/limitng-api-models-ozet-ozetdata.mjs +0 -4
  53. package/fesm2022/limitng-api-models-ozet-ozetkartalan.mjs +0 -4
  54. package/fesm2022/limitng-api-models-ozet.mjs +1 -5
  55. package/fesm2022/limitng-api-models-ozet.mjs.map +1 -1
  56. package/fesm2022/limitng-api-models-raporlar-izinraporu-izinrapordetaylari.mjs +9 -13
  57. package/fesm2022/limitng-api-models-raporlar-izinraporu-izinrapordetaylari.mjs.map +1 -1
  58. package/fesm2022/limitng-api-models-raporlar-izinraporu-izinraporliste.mjs +21 -26
  59. package/fesm2022/limitng-api-models-raporlar-izinraporu-izinraporliste.mjs.map +1 -1
  60. package/fesm2022/limitng-api-models-raporlar-izinraporu.mjs +1 -5
  61. package/fesm2022/limitng-api-models-raporlar-izinraporu.mjs.map +1 -1
  62. package/fesm2022/limitng-api-models-raporlar-listedensec.mjs +32 -30
  63. package/fesm2022/limitng-api-models-raporlar-listedensec.mjs.map +1 -1
  64. package/fesm2022/limitng-api-models-raporlar-rapordetaylari.mjs +75 -79
  65. package/fesm2022/limitng-api-models-raporlar-rapordetaylari.mjs.map +1 -1
  66. package/fesm2022/limitng-api-models-raporlar-raporzamanlama.mjs +43 -47
  67. package/fesm2022/limitng-api-models-raporlar-raporzamanlama.mjs.map +1 -1
  68. package/fesm2022/limitng-api-models-raporlar-tablodansec.mjs +22 -26
  69. package/fesm2022/limitng-api-models-raporlar-tablodansec.mjs.map +1 -1
  70. package/fesm2022/limitng-api-models-raporlar.mjs +1 -5
  71. package/fesm2022/limitng-api-models-raporlar.mjs.map +1 -1
  72. package/fesm2022/limitng-api-models-sistemozet.mjs +192 -196
  73. package/fesm2022/limitng-api-models-sistemozet.mjs.map +1 -1
  74. package/fesm2022/limitng-api-models-sistemraporlari.mjs +9 -14
  75. package/fesm2022/limitng-api-models-sistemraporlari.mjs.map +1 -1
  76. package/fesm2022/limitng-api-models-timeSheet-timeSheetGirisListeler.mjs +315 -320
  77. package/fesm2022/limitng-api-models-timeSheet-timeSheetGirisListeler.mjs.map +1 -1
  78. package/fesm2022/limitng-api-models-timeSheet-timeSheetLog.mjs +15 -19
  79. package/fesm2022/limitng-api-models-timeSheet-timeSheetLog.mjs.map +1 -1
  80. package/fesm2022/limitng-api-models-timeSheet-timeSheetOzetListe.mjs +24 -29
  81. package/fesm2022/limitng-api-models-timeSheet-timeSheetOzetListe.mjs.map +1 -1
  82. package/fesm2022/limitng-api-models-timeSheet-timeSheetSecenekler.mjs +32 -36
  83. package/fesm2022/limitng-api-models-timeSheet-timeSheetSecenekler.mjs.map +1 -1
  84. package/fesm2022/limitng-api-models-timeSheet.mjs +1 -5
  85. package/fesm2022/limitng-api-models-timeSheet.mjs.map +1 -1
  86. package/fesm2022/limitng-api-models-xl-xlConfig.mjs +376 -420
  87. package/fesm2022/limitng-api-models-xl-xlConfig.mjs.map +1 -1
  88. package/fesm2022/limitng-api-models-xl-xlConstants.mjs +60 -64
  89. package/fesm2022/limitng-api-models-xl-xlConstants.mjs.map +1 -1
  90. package/fesm2022/limitng-api-models-xl-xlOptions.mjs +35 -39
  91. package/fesm2022/limitng-api-models-xl-xlOptions.mjs.map +1 -1
  92. package/fesm2022/limitng-api-models-xl-xlTools.mjs +3 -8
  93. package/fesm2022/limitng-api-models-xl-xlTools.mjs.map +1 -1
  94. package/fesm2022/limitng-api-models-xl.mjs +1 -5
  95. package/fesm2022/limitng-api-models-xl.mjs.map +1 -1
  96. package/fesm2022/limitng-api-models.mjs +1 -5
  97. package/fesm2022/limitng-api-models.mjs.map +1 -1
  98. package/fesm2022/limitng-api.mjs +731 -862
  99. package/fesm2022/limitng-api.mjs.map +1 -1
  100. package/fesm2022/limitng-blob-response-handler.mjs +1359 -1615
  101. package/fesm2022/limitng-blob-response-handler.mjs.map +1 -1
  102. package/fesm2022/limitng-dikey-baslikli-panel-sol.mjs +121 -27
  103. package/fesm2022/limitng-dikey-baslikli-panel-sol.mjs.map +1 -1
  104. package/fesm2022/limitng-dikey-baslikli-panel.mjs +121 -27
  105. package/fesm2022/limitng-dikey-baslikli-panel.mjs.map +1 -1
  106. package/fesm2022/limitng-directives-adAlani.directive.mjs +100 -83
  107. package/fesm2022/limitng-directives-adAlani.directive.mjs.map +1 -1
  108. package/fesm2022/limitng-directives-adresAlani.directive.mjs +101 -84
  109. package/fesm2022/limitng-directives-adresAlani.directive.mjs.map +1 -1
  110. package/fesm2022/limitng-directives-buyukHarf.directive.mjs +83 -69
  111. package/fesm2022/limitng-directives-buyukHarf.directive.mjs.map +1 -1
  112. package/fesm2022/limitng-directives-ciftBoslukTek.directive.mjs +83 -69
  113. package/fesm2022/limitng-directives-ciftBoslukTek.directive.mjs.map +1 -1
  114. package/fesm2022/limitng-directives-dirty.directive.mjs +70 -34
  115. package/fesm2022/limitng-directives-dirty.directive.mjs.map +1 -1
  116. package/fesm2022/limitng-directives-disable.directive.mjs +289 -155
  117. package/fesm2022/limitng-directives-disable.directive.mjs.map +1 -1
  118. package/fesm2022/limitng-directives-flexBasis.directive.mjs +187 -63
  119. package/fesm2022/limitng-directives-flexBasis.directive.mjs.map +1 -1
  120. package/fesm2022/limitng-directives-ilkHarfBuyuk.directive.mjs +83 -69
  121. package/fesm2022/limitng-directives-ilkHarfBuyuk.directive.mjs.map +1 -1
  122. package/fesm2022/limitng-directives-imleciBasaAl.directive.mjs +56 -45
  123. package/fesm2022/limitng-directives-imleciBasaAl.directive.mjs.map +1 -1
  124. package/fesm2022/limitng-directives-kodAlani.directive.mjs +106 -93
  125. package/fesm2022/limitng-directives-kodAlani.directive.mjs.map +1 -1
  126. package/fesm2022/limitng-directives-maksimumUzunluk.directive.mjs +106 -71
  127. package/fesm2022/limitng-directives-maksimumUzunluk.directive.mjs.map +1 -1
  128. package/fesm2022/limitng-directives-okTuslariylaIcerdeGezin.directive.mjs +44 -28
  129. package/fesm2022/limitng-directives-okTuslariylaIcerdeGezin.directive.mjs.map +1 -1
  130. package/fesm2022/limitng-directives-sagSolBoslukSil.directive.mjs +82 -68
  131. package/fesm2022/limitng-directives-sagSolBoslukSil.directive.mjs.map +1 -1
  132. package/fesm2022/limitng-directives-standartAlan.directive.mjs +100 -83
  133. package/fesm2022/limitng-directives-standartAlan.directive.mjs.map +1 -1
  134. package/fesm2022/limitng-directives-sutunGenisligi.directive.mjs +255 -96
  135. package/fesm2022/limitng-directives-sutunGenisligi.directive.mjs.map +1 -1
  136. package/fesm2022/limitng-directives-translate-key.directive.ts.mjs +52 -37
  137. package/fesm2022/limitng-directives-translate-key.directive.ts.mjs.map +1 -1
  138. package/fesm2022/limitng-directives-tumBoslukSil.directive.mjs +83 -69
  139. package/fesm2022/limitng-directives-tumBoslukSil.directive.mjs.map +1 -1
  140. package/fesm2022/limitng-directives-tumIlkHarfBuyuk.directive.mjs +93 -70
  141. package/fesm2022/limitng-directives-tumIlkHarfBuyuk.directive.mjs.map +1 -1
  142. package/fesm2022/limitng-directives.mjs +1747 -1046
  143. package/fesm2022/limitng-directives.mjs.map +1 -1
  144. package/fesm2022/limitng-filtre-bar.mjs +241 -90
  145. package/fesm2022/limitng-filtre-bar.mjs.map +1 -1
  146. package/fesm2022/limitng-geri-ileri-detay.mjs +331 -229
  147. package/fesm2022/limitng-geri-ileri-detay.mjs.map +1 -1
  148. package/fesm2022/limitng-geri-ileri-liste.mjs +378 -281
  149. package/fesm2022/limitng-geri-ileri-liste.mjs.map +1 -1
  150. package/fesm2022/limitng-pipes-ayAdiPipe.mjs +54 -40
  151. package/fesm2022/limitng-pipes-ayAdiPipe.mjs.map +1 -1
  152. package/fesm2022/limitng-pipes-boolToPlus.pipe.mjs +42 -23
  153. package/fesm2022/limitng-pipes-boolToPlus.pipe.mjs.map +1 -1
  154. package/fesm2022/limitng-pipes-boolToPlusMinus.pipe.mjs +42 -23
  155. package/fesm2022/limitng-pipes-boolToPlusMinus.pipe.mjs.map +1 -1
  156. package/fesm2022/limitng-pipes-dateToText.pipe.mjs +43 -24
  157. package/fesm2022/limitng-pipes-dateToText.pipe.mjs.map +1 -1
  158. package/fesm2022/limitng-pipes-evetHayir.pipe.mjs +50 -33
  159. package/fesm2022/limitng-pipes-evetHayir.pipe.mjs.map +1 -1
  160. package/fesm2022/limitng-pipes-global-filter-formatter.pipe.mjs +51 -36
  161. package/fesm2022/limitng-pipes-global-filter-formatter.pipe.mjs.map +1 -1
  162. package/fesm2022/limitng-pipes-mecraTuru.pipe.mjs +43 -24
  163. package/fesm2022/limitng-pipes-mecraTuru.pipe.mjs.map +1 -1
  164. package/fesm2022/limitng-pipes-safe.pipe.mjs +53 -34
  165. package/fesm2022/limitng-pipes-safe.pipe.mjs.map +1 -1
  166. package/fesm2022/limitng-pipes-toSeverity.pipe.mjs +50 -30
  167. package/fesm2022/limitng-pipes-toSeverity.pipe.mjs.map +1 -1
  168. package/fesm2022/limitng-pipes-tooltip-formatter.pipe.mjs +56 -47
  169. package/fesm2022/limitng-pipes-tooltip-formatter.pipe.mjs.map +1 -1
  170. package/fesm2022/limitng-pipes.mjs +1 -5
  171. package/fesm2022/limitng-pipes.mjs.map +1 -1
  172. package/fesm2022/limitng-rapor-kart-models.mjs +18 -23
  173. package/fesm2022/limitng-rapor-kart-models.mjs.map +1 -1
  174. package/fesm2022/limitng-rapor-kart.mjs +215 -58
  175. package/fesm2022/limitng-rapor-kart.mjs.map +1 -1
  176. package/fesm2022/limitng-sol-buyuk-kart.mjs +184 -37
  177. package/fesm2022/limitng-sol-buyuk-kart.mjs.map +1 -1
  178. package/fesm2022/limitng-sol-kucuk-kart.mjs +150 -32
  179. package/fesm2022/limitng-sol-kucuk-kart.mjs.map +1 -1
  180. package/fesm2022/limitng-yatay-baslikli-panel.mjs +231 -49
  181. package/fesm2022/limitng-yatay-baslikli-panel.mjs.map +1 -1
  182. package/fesm2022/limitng.mjs +6 -11
  183. package/package.json +1 -1
  184. package/types/limitng-alt-buyuk-kart.d.ts +48 -20
  185. package/types/limitng-alt-buyuk-kart.d.ts.map +1 -1
  186. package/types/limitng-alt-kucuk-kart.d.ts +43 -15
  187. package/types/limitng-alt-kucuk-kart.d.ts.map +1 -1
  188. package/types/limitng-api-models-bildirimler.d.ts +29 -32
  189. package/types/limitng-api-models-bildirimler.d.ts.map +1 -1
  190. package/types/limitng-api-models-enums.d.ts +389 -391
  191. package/types/limitng-api-models-enums.d.ts.map +1 -1
  192. package/types/limitng-api-models-fourDConstants.d.ts +83 -85
  193. package/types/limitng-api-models-fourDConstants.d.ts.map +1 -1
  194. package/types/limitng-api-models-kisisel-izinislemleri-izindetaylari.d.ts +23 -27
  195. package/types/limitng-api-models-kisisel-izinislemleri-izindetaylari.d.ts.map +1 -1
  196. package/types/limitng-api-models-kisisel-izinislemleri-izinfiltre.d.ts +10 -13
  197. package/types/limitng-api-models-kisisel-izinislemleri-izinfiltre.d.ts.map +1 -1
  198. package/types/limitng-api-models-kisisel-izinislemleri-izinguncelle.d.ts +5 -8
  199. package/types/limitng-api-models-kisisel-izinislemleri-izinguncelle.d.ts.map +1 -1
  200. package/types/limitng-api-models-kisisel-izinislemleri-izinliste.d.ts +24 -27
  201. package/types/limitng-api-models-kisisel-izinislemleri-izinliste.d.ts.map +1 -1
  202. package/types/limitng-api-models-kisisel-izinislemleri.d.ts +3 -3
  203. package/types/limitng-api-models-kisisel-izinislemleri.d.ts.map +1 -1
  204. package/types/limitng-api-models-kisisel-masrafislemleri-masrafdetaylari.d.ts +57 -61
  205. package/types/limitng-api-models-kisisel-masrafislemleri-masrafdetaylari.d.ts.map +1 -1
  206. package/types/limitng-api-models-kisisel-masrafislemleri-masraffiltre.d.ts +11 -14
  207. package/types/limitng-api-models-kisisel-masrafislemleri-masraffiltre.d.ts.map +1 -1
  208. package/types/limitng-api-models-kisisel-masrafislemleri-masrafguncelle.d.ts +6 -9
  209. package/types/limitng-api-models-kisisel-masrafislemleri-masrafguncelle.d.ts.map +1 -1
  210. package/types/limitng-api-models-kisisel-masrafislemleri-masrafliste.d.ts +70 -74
  211. package/types/limitng-api-models-kisisel-masrafislemleri-masrafliste.d.ts.map +1 -1
  212. package/types/limitng-api-models-kisisel-masrafislemleri.d.ts +3 -3
  213. package/types/limitng-api-models-kisisel-masrafislemleri.d.ts.map +1 -1
  214. package/types/limitng-api-models-kisisel-onayislemleri-onaydetaylari.d.ts +71 -74
  215. package/types/limitng-api-models-kisisel-onayislemleri-onaydetaylari.d.ts.map +1 -1
  216. package/types/limitng-api-models-kisisel-onayislemleri-onayfiltre.d.ts +30 -33
  217. package/types/limitng-api-models-kisisel-onayislemleri-onayfiltre.d.ts.map +1 -1
  218. package/types/limitng-api-models-kisisel-onayislemleri-onayguncelle.d.ts +7 -9
  219. package/types/limitng-api-models-kisisel-onayislemleri-onayguncelle.d.ts.map +1 -1
  220. package/types/limitng-api-models-kisisel-onayislemleri-onayliste.d.ts +30 -32
  221. package/types/limitng-api-models-kisisel-onayislemleri-onayliste.d.ts.map +1 -1
  222. package/types/limitng-api-models-kisisel-onayislemleri.d.ts +3 -3
  223. package/types/limitng-api-models-kisisel-onayislemleri.d.ts.map +1 -1
  224. package/types/limitng-api-models-kisisel.d.ts +3 -3
  225. package/types/limitng-api-models-kisisel.d.ts.map +1 -1
  226. package/types/limitng-api-models-logbook.d.ts +100 -103
  227. package/types/limitng-api-models-logbook.d.ts.map +1 -1
  228. package/types/limitng-api-models-login.d.ts +52 -55
  229. package/types/limitng-api-models-login.d.ts.map +1 -1
  230. package/types/limitng-api-models-onay-onayagonderdetaylari.d.ts +61 -65
  231. package/types/limitng-api-models-onay-onayagonderdetaylari.d.ts.map +1 -1
  232. package/types/limitng-api-models-onay-onaybilgi.d.ts +3 -5
  233. package/types/limitng-api-models-onay-onaybilgi.d.ts.map +1 -1
  234. package/types/limitng-api-models-onay.d.ts +3 -3
  235. package/types/limitng-api-models-onay.d.ts.map +1 -1
  236. package/types/limitng-api-models-ortak.d.ts +240 -244
  237. package/types/limitng-api-models-ortak.d.ts.map +1 -1
  238. package/types/limitng-api-models-ozet-ozetdata.d.ts +16 -19
  239. package/types/limitng-api-models-ozet-ozetdata.d.ts.map +1 -1
  240. package/types/limitng-api-models-ozet-ozetkartalan.d.ts +11 -13
  241. package/types/limitng-api-models-ozet-ozetkartalan.d.ts.map +1 -1
  242. package/types/limitng-api-models-ozet.d.ts +3 -3
  243. package/types/limitng-api-models-ozet.d.ts.map +1 -1
  244. package/types/limitng-api-models-raporlar-izinraporu-izinrapordetaylari.d.ts +13 -16
  245. package/types/limitng-api-models-raporlar-izinraporu-izinrapordetaylari.d.ts.map +1 -1
  246. package/types/limitng-api-models-raporlar-izinraporu-izinraporliste.d.ts +14 -17
  247. package/types/limitng-api-models-raporlar-izinraporu-izinraporliste.d.ts.map +1 -1
  248. package/types/limitng-api-models-raporlar-izinraporu.d.ts +3 -3
  249. package/types/limitng-api-models-raporlar-izinraporu.d.ts.map +1 -1
  250. package/types/limitng-api-models-raporlar-listedensec.d.ts +21 -24
  251. package/types/limitng-api-models-raporlar-listedensec.d.ts.map +1 -1
  252. package/types/limitng-api-models-raporlar-rapordetaylari.d.ts +53 -55
  253. package/types/limitng-api-models-raporlar-rapordetaylari.d.ts.map +1 -1
  254. package/types/limitng-api-models-raporlar-raporzamanlama.d.ts +41 -44
  255. package/types/limitng-api-models-raporlar-raporzamanlama.d.ts.map +1 -1
  256. package/types/limitng-api-models-raporlar-tablodansec.d.ts +23 -26
  257. package/types/limitng-api-models-raporlar-tablodansec.d.ts.map +1 -1
  258. package/types/limitng-api-models-raporlar.d.ts +3 -3
  259. package/types/limitng-api-models-raporlar.d.ts.map +1 -1
  260. package/types/limitng-api-models-sistemozet.d.ts +169 -173
  261. package/types/limitng-api-models-sistemozet.d.ts.map +1 -1
  262. package/types/limitng-api-models-sistemraporlari.d.ts +9 -13
  263. package/types/limitng-api-models-sistemraporlari.d.ts.map +1 -1
  264. package/types/limitng-api-models-timeSheet-timeSheetGirisListeler.d.ts +295 -299
  265. package/types/limitng-api-models-timeSheet-timeSheetGirisListeler.d.ts.map +1 -1
  266. package/types/limitng-api-models-timeSheet-timeSheetLog.d.ts +12 -15
  267. package/types/limitng-api-models-timeSheet-timeSheetLog.d.ts.map +1 -1
  268. package/types/limitng-api-models-timeSheet-timeSheetOzetListe.d.ts +17 -20
  269. package/types/limitng-api-models-timeSheet-timeSheetOzetListe.d.ts.map +1 -1
  270. package/types/limitng-api-models-timeSheet-timeSheetSecenekler.d.ts +28 -30
  271. package/types/limitng-api-models-timeSheet-timeSheetSecenekler.d.ts.map +1 -1
  272. package/types/limitng-api-models-timeSheet.d.ts +3 -3
  273. package/types/limitng-api-models-timeSheet.d.ts.map +1 -1
  274. package/types/limitng-api-models-xl-xlConfig.d.ts +196 -199
  275. package/types/limitng-api-models-xl-xlConfig.d.ts.map +1 -1
  276. package/types/limitng-api-models-xl-xlConstants.d.ts +59 -61
  277. package/types/limitng-api-models-xl-xlConstants.d.ts.map +1 -1
  278. package/types/limitng-api-models-xl-xlOptions.d.ts +23 -26
  279. package/types/limitng-api-models-xl-xlOptions.d.ts.map +1 -1
  280. package/types/limitng-api-models-xl-xlTools.d.ts +2 -5
  281. package/types/limitng-api-models-xl-xlTools.d.ts.map +1 -1
  282. package/types/limitng-api-models-xl.d.ts +3 -3
  283. package/types/limitng-api-models-xl.d.ts.map +1 -1
  284. package/types/limitng-api-models.d.ts +3 -3
  285. package/types/limitng-api-models.d.ts.map +1 -1
  286. package/types/limitng-api.d.ts +69 -76
  287. package/types/limitng-api.d.ts.map +1 -1
  288. package/types/limitng-blob-response-handler.d.ts +324 -330
  289. package/types/limitng-blob-response-handler.d.ts.map +1 -1
  290. package/types/limitng-dikey-baslikli-panel-sol.d.ts +30 -12
  291. package/types/limitng-dikey-baslikli-panel-sol.d.ts.map +1 -1
  292. package/types/limitng-dikey-baslikli-panel.d.ts +30 -12
  293. package/types/limitng-dikey-baslikli-panel.d.ts.map +1 -1
  294. package/types/limitng-directives-adAlani.directive.d.ts +26 -27
  295. package/types/limitng-directives-adAlani.directive.d.ts.map +1 -1
  296. package/types/limitng-directives-adresAlani.directive.d.ts +26 -27
  297. package/types/limitng-directives-adresAlani.directive.d.ts.map +1 -1
  298. package/types/limitng-directives-buyukHarf.directive.d.ts +24 -25
  299. package/types/limitng-directives-buyukHarf.directive.d.ts.map +1 -1
  300. package/types/limitng-directives-ciftBoslukTek.directive.d.ts +24 -25
  301. package/types/limitng-directives-ciftBoslukTek.directive.d.ts.map +1 -1
  302. package/types/limitng-directives-dirty.directive.d.ts +15 -12
  303. package/types/limitng-directives-dirty.directive.d.ts.map +1 -1
  304. package/types/limitng-directives-disable.directive.d.ts +40 -38
  305. package/types/limitng-directives-disable.directive.d.ts.map +1 -1
  306. package/types/limitng-directives-flexBasis.directive.d.ts +39 -24
  307. package/types/limitng-directives-flexBasis.directive.d.ts.map +1 -1
  308. package/types/limitng-directives-ilkHarfBuyuk.directive.d.ts +24 -25
  309. package/types/limitng-directives-ilkHarfBuyuk.directive.d.ts.map +1 -1
  310. package/types/limitng-directives-imleciBasaAl.directive.d.ts +11 -14
  311. package/types/limitng-directives-imleciBasaAl.directive.d.ts.map +1 -1
  312. package/types/limitng-directives-kodAlani.directive.d.ts +26 -29
  313. package/types/limitng-directives-kodAlani.directive.d.ts.map +1 -1
  314. package/types/limitng-directives-maksimumUzunluk.directive.d.ts +31 -26
  315. package/types/limitng-directives-maksimumUzunluk.directive.d.ts.map +1 -1
  316. package/types/limitng-directives-okTuslariylaIcerdeGezin.directive.d.ts +6 -9
  317. package/types/limitng-directives-okTuslariylaIcerdeGezin.directive.d.ts.map +1 -1
  318. package/types/limitng-directives-sagSolBoslukSil.directive.d.ts +24 -25
  319. package/types/limitng-directives-sagSolBoslukSil.directive.d.ts.map +1 -1
  320. package/types/limitng-directives-standartAlan.directive.d.ts +26 -27
  321. package/types/limitng-directives-standartAlan.directive.d.ts.map +1 -1
  322. package/types/limitng-directives-sutunGenisligi.directive.d.ts +53 -32
  323. package/types/limitng-directives-sutunGenisligi.directive.d.ts.map +1 -1
  324. package/types/limitng-directives-translate-key.directive.ts.d.ts +9 -12
  325. package/types/limitng-directives-translate-key.directive.ts.d.ts.map +1 -1
  326. package/types/limitng-directives-tumBoslukSil.directive.d.ts +24 -25
  327. package/types/limitng-directives-tumBoslukSil.directive.d.ts.map +1 -1
  328. package/types/limitng-directives-tumIlkHarfBuyuk.directive.d.ts +26 -26
  329. package/types/limitng-directives-tumIlkHarfBuyuk.directive.d.ts.map +1 -1
  330. package/types/limitng-directives.d.ts +386 -323
  331. package/types/limitng-directives.d.ts.map +1 -1
  332. package/types/limitng-filtre-bar.d.ts +55 -30
  333. package/types/limitng-filtre-bar.d.ts.map +1 -1
  334. package/types/limitng-geri-ileri-detay.d.ts +59 -57
  335. package/types/limitng-geri-ileri-detay.d.ts.map +1 -1
  336. package/types/limitng-geri-ileri-liste.d.ts +66 -64
  337. package/types/limitng-geri-ileri-liste.d.ts.map +1 -1
  338. package/types/limitng-pipes-ayAdiPipe.d.ts +8 -11
  339. package/types/limitng-pipes-ayAdiPipe.d.ts.map +1 -1
  340. package/types/limitng-pipes-boolToPlus.pipe.d.ts +7 -10
  341. package/types/limitng-pipes-boolToPlus.pipe.d.ts.map +1 -1
  342. package/types/limitng-pipes-boolToPlusMinus.pipe.d.ts +7 -10
  343. package/types/limitng-pipes-boolToPlusMinus.pipe.d.ts.map +1 -1
  344. package/types/limitng-pipes-dateToText.pipe.d.ts +7 -10
  345. package/types/limitng-pipes-dateToText.pipe.d.ts.map +1 -1
  346. package/types/limitng-pipes-evetHayir.pipe.d.ts +9 -12
  347. package/types/limitng-pipes-evetHayir.pipe.d.ts.map +1 -1
  348. package/types/limitng-pipes-global-filter-formatter.pipe.d.ts +8 -11
  349. package/types/limitng-pipes-global-filter-formatter.pipe.d.ts.map +1 -1
  350. package/types/limitng-pipes-mecraTuru.pipe.d.ts +7 -10
  351. package/types/limitng-pipes-mecraTuru.pipe.d.ts.map +1 -1
  352. package/types/limitng-pipes-safe.pipe.d.ts +9 -12
  353. package/types/limitng-pipes-safe.pipe.d.ts.map +1 -1
  354. package/types/limitng-pipes-toSeverity.pipe.d.ts +8 -12
  355. package/types/limitng-pipes-toSeverity.pipe.d.ts.map +1 -1
  356. package/types/limitng-pipes-tooltip-formatter.pipe.d.ts +8 -11
  357. package/types/limitng-pipes-tooltip-formatter.pipe.d.ts.map +1 -1
  358. package/types/limitng-pipes.d.ts +3 -3
  359. package/types/limitng-pipes.d.ts.map +1 -1
  360. package/types/limitng-rapor-kart-models.d.ts +14 -17
  361. package/types/limitng-rapor-kart-models.d.ts.map +1 -1
  362. package/types/limitng-rapor-kart.d.ts +36 -24
  363. package/types/limitng-rapor-kart.d.ts.map +1 -1
  364. package/types/limitng-sol-buyuk-kart.d.ts +47 -19
  365. package/types/limitng-sol-buyuk-kart.d.ts.map +1 -1
  366. package/types/limitng-sol-kucuk-kart.d.ts +42 -14
  367. package/types/limitng-sol-kucuk-kart.d.ts.map +1 -1
  368. package/types/limitng-yatay-baslikli-panel.d.ts +66 -22
  369. package/types/limitng-yatay-baslikli-panel.d.ts.map +1 -1
  370. package/types/limitng.d.ts +6 -7
  371. package/fesm2022/limitng-api-models-kisisel-izinislemleri-izinguncelle.mjs.map +0 -1
  372. package/fesm2022/limitng-api-models-kisisel-masrafislemleri-masrafguncelle.mjs.map +0 -1
  373. package/fesm2022/limitng-api-models-onay-onaybilgi.mjs.map +0 -1
  374. package/fesm2022/limitng-api-models-ozet-ozetdata.mjs.map +0 -1
  375. package/fesm2022/limitng-api-models-ozet-ozetkartalan.mjs.map +0 -1
  376. package/fesm2022/limitng.mjs.map +0 -1
  377. package/types/limitng.d.ts.map +0 -1
@@ -1,1619 +1,1363 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, Injectable } from '@angular/core';
3
- import { saveAs } from 'file-saver';
4
- import { TranslateService } from '@ngx-translate/core';
5
- import { GlobalFunctions } from 'limitng/api';
6
- import { Workbook } from 'exceljs';
7
- import JSZip from 'jszip';
8
- import { VariableType, NumberFormatlar, FontStyle } from 'limitng/api/models/fourDConstants';
9
- import { XLHAlign, XLVAlign } from 'limitng/api/models/xl/xlConstants';
10
-
11
- class ExcelRaporuSonuc {
12
- constructor() {
13
- this.book = {
14
- author: 'MedPlan',
15
- activeSheetNo: 1
16
- };
17
- this.defaultFont = {
18
- name: 'Calibri',
19
- size: 11
20
- };
21
- this.currentTableStyle = '';
22
- this.sifirlariBasmaSayi = false;
23
- this.sifirlariBasmaTarih = false;
24
- // Yeni format: her sheet kendi tablolarını, üst bilgilerini ve notlarını taşır
25
- this.sheets = [];
26
- this.window = {
27
- displayGridLines: false
28
- };
29
- }
30
- }
31
-
1
+ import * as i0 from "@angular/core";
2
+ import { Injectable, inject } from "@angular/core";
3
+ import { saveAs } from "file-saver";
4
+ import { TranslateService } from "@ngx-translate/core";
5
+ import { GlobalFunctions } from "limitng/api";
6
+ import { Workbook } from "exceljs";
7
+ import JSZip from "jszip";
8
+ import { FontStyle, NumberFormatlar, VariableType } from "limitng/api/models/fourDConstants";
9
+ import { XLHAlign, XLVAlign } from "limitng/api/models/xl/xlConstants";
10
+ var ExcelRaporuSonuc = class {
11
+ constructor() {
12
+ this.book = {
13
+ author: "MedPlan",
14
+ activeSheetNo: 1
15
+ };
16
+ this.defaultFont = {
17
+ name: "Calibri",
18
+ size: 11
19
+ };
20
+ this.currentTableStyle = "";
21
+ this.sifirlariBasmaSayi = false;
22
+ this.sifirlariBasmaTarih = false;
23
+ this.sheets = [];
24
+ this.window = { displayGridLines: false };
25
+ }
26
+ };
32
27
  const TOKEN_DESENI = /\s*(\d+(?:\.\d+)?|[A-Za-z_]+|[()+\-*/,])/gy;
33
- class ToplamFormuluHesaplayici {
34
- constructor(formul) {
35
- this.konum = 0;
36
- this.tokenlar = ToplamFormuluHesaplayici.tokenlaraAyir(formul);
37
- }
38
- static hesapla(formul) {
39
- try {
40
- const hesaplayici = new ToplamFormuluHesaplayici(formul);
41
- const sonuc = hesaplayici.ifade();
42
- return hesaplayici.konum === hesaplayici.tokenlar.length && Number.isFinite(sonuc) ? sonuc : undefined;
43
- }
44
- catch {
45
- return undefined;
46
- }
47
- }
48
- static tokenlaraAyir(formul) {
49
- const tokenlar = [];
50
- TOKEN_DESENI.lastIndex = 0;
51
- let eslesme = TOKEN_DESENI.exec(formul);
52
- let okunan = 0;
53
- while (eslesme) {
54
- const deger = eslesme[1];
55
- okunan = TOKEN_DESENI.lastIndex;
56
- if (/^\d/.test(deger)) {
57
- tokenlar.push({ deger, tur: 'sayi' });
58
- }
59
- else if (/^[A-Za-z_]/.test(deger)) {
60
- tokenlar.push({ deger: deger.toUpperCase(), tur: 'ad' });
61
- }
62
- else {
63
- tokenlar.push({ deger, tur: 'op' });
64
- }
65
- eslesme = TOKEN_DESENI.exec(formul);
66
- }
67
- if (formul.slice(okunan).trim()) {
68
- throw new Error('Geçersiz formül');
69
- }
70
- return tokenlar;
71
- }
72
- ifade() {
73
- let sonuc = this.terim();
74
- while (this.sonrakiOperatorMu('+', '-')) {
75
- const islem = this.tokenlar[this.konum++].deger;
76
- const sag = this.terim();
77
- sonuc = islem === '+' ? sonuc + sag : sonuc - sag;
78
- }
79
- return sonuc;
80
- }
81
- terim() {
82
- let sonuc = this.birim();
83
- while (this.sonrakiOperatorMu('*', '/')) {
84
- const islem = this.tokenlar[this.konum++].deger;
85
- const sag = this.birim();
86
- if (islem === '/' && sag === 0) {
87
- throw new Error('Sıfıra bölme');
88
- }
89
- sonuc = islem === '*' ? sonuc * sag : sonuc / sag;
90
- }
91
- return sonuc;
92
- }
93
- birim() {
94
- const token = this.tokenlar[this.konum++];
95
- if (!token) {
96
- throw new Error('Beklenmeyen son');
97
- }
98
- if (token.tur === 'sayi') {
99
- return Number(token.deger);
100
- }
101
- if (token.tur === 'op' && token.deger === '-') {
102
- return -this.birim();
103
- }
104
- if (token.tur === 'op' && token.deger === '(') {
105
- const sonuc = this.ifade();
106
- this.operatorBekle(')');
107
- return sonuc;
108
- }
109
- if (token.tur === 'ad') {
110
- return this.fonksiyon(token.deger);
111
- }
112
- throw new Error('Geçersiz token');
113
- }
114
- fonksiyon(ad) {
115
- this.operatorBekle('(');
116
- if (ad === 'ABS') {
117
- const sonuc = Math.abs(this.ifade());
118
- this.operatorBekle(')');
119
- return sonuc;
120
- }
121
- if (ad === 'IFERROR') {
122
- const baslangic = this.konum;
123
- let sonuc;
124
- try {
125
- sonuc = this.ifade();
126
- }
127
- catch {
128
- this.konum = baslangic;
129
- this.virguleKadarAtla();
130
- }
131
- this.operatorBekle(',');
132
- const yedek = this.ifade();
133
- this.operatorBekle(')');
134
- return sonuc ?? yedek;
135
- }
136
- throw new Error(`Desteklenmeyen fonksiyon: ${ad}`);
137
- }
138
- virguleKadarAtla() {
139
- let derinlik = 0;
140
- while (this.konum < this.tokenlar.length) {
141
- const { deger, tur } = this.tokenlar[this.konum];
142
- if (tur === 'op' && deger === '(') {
143
- derinlik++;
144
- }
145
- else if (tur === 'op' && deger === ')') {
146
- derinlik--;
147
- }
148
- else if (tur === 'op' && deger === ',' && derinlik === 0) {
149
- return;
150
- }
151
- this.konum++;
152
- }
153
- }
154
- sonrakiOperatorMu(...operatorler) {
155
- const token = this.tokenlar[this.konum];
156
- return token?.tur === 'op' && operatorler.includes(token.deger);
157
- }
158
- operatorBekle(operator) {
159
- const token = this.tokenlar[this.konum++];
160
- if (token?.tur !== 'op' || token.deger !== operator) {
161
- throw new Error(`Beklenen: ${operator}`);
162
- }
163
- }
164
- }
165
-
166
- class JsonToExcelTableBuilder {
167
- constructor(table) {
168
- this.table = table;
169
- }
170
- addColumn(column) {
171
- this.table.columns.push({
172
- arrayType: VariableType.text,
173
- ...column
174
- });
175
- return this;
176
- }
177
- setRows(rows) {
178
- this.table.collection = rows;
179
- return this;
180
- }
181
- setStartColumn(sol) {
182
- this.table.sol = sol;
183
- return this;
184
- }
185
- setStartRow(ust) {
186
- this.table.ust = ust;
187
- return this;
188
- }
189
- getColumnSayisi() {
190
- return this.table.columns.length;
191
- }
192
- addOutlineGroup(groupStart, groupEnd, collapsed = false) {
193
- this.table.outlineGroups ??= [];
194
- this.table.outlineGroups.push({ groupStart, groupEnd, collapsed });
195
- return this;
196
- }
197
- setOutlineSummaryPosition(position) {
198
- this.table.outlineSummaryPosition = position;
199
- return this;
200
- }
201
- }
202
- class JsonToExcelSheetBuilder {
203
- constructor(sheet) {
204
- this.sheet = sheet;
205
- }
206
- addTable(rows, options = {}) {
207
- const table = {
208
- collection: rows,
209
- columns: [],
210
- ...(options.autoFit !== undefined && { autoFit: options.autoFit }),
211
- ...(options.data && { data: options.data }),
212
- ...(options.footer && { footer: options.footer }),
213
- ...(options.header && { header: options.header }),
214
- ...(options.sol !== undefined && { sol: options.sol }),
215
- ...(options.toplamEtiketi !== undefined && { toplamEtiketi: options.toplamEtiketi }),
216
- ...(options.toplamSatiri !== undefined && { toplamSatiri: options.toplamSatiri }),
217
- ...(options.ust !== undefined && { ust: options.ust })
218
- };
219
- this.sheet.tables ??= [];
220
- this.sheet.tables.push(table);
221
- return new JsonToExcelTableBuilder(table);
222
- }
223
- addUstBilgi(ustBilgi, font) {
224
- this.sheet.ustBilgiler ??= [];
225
- this.sheet.ustBilgiler.push(JsonToExcelParser.ustBilgiEkle(ustBilgi, font));
226
- return this;
227
- }
228
- getUstBilgiSayisi() {
229
- return this.sheet.ustBilgiler?.length ?? 0;
230
- }
231
- getSheetNo() {
232
- return this.sheet.sheetNo;
233
- }
234
- setSheetName(sheetName) {
235
- this.sheet.sheetName = sheetName;
236
- return this;
237
- }
238
- setZoom(zoom) {
239
- this.sheet.zoom = zoom;
240
- return this;
241
- }
242
- }
243
- class JsonToExcelReportBuilder {
244
- constructor() {
245
- this.sonuc = new ExcelRaporuSonuc();
246
- }
247
- addSheet(sheetName, options = {}) {
248
- const sheet = {
249
- sheetName,
250
- sheetNo: this.sonuc.sheets.length + 1,
251
- ...(options.pageSetup && { pageSetup: options.pageSetup }),
252
- ...(options.zoom !== undefined && { zoom: options.zoom })
253
- };
254
- this.sonuc.sheets.push(sheet);
255
- return new JsonToExcelSheetBuilder(sheet);
256
- }
257
- build() {
258
- return this.sonuc;
259
- }
260
- setAuthor(author) {
261
- this.sonuc.book.author = author;
262
- return this;
263
- }
264
- setCurrentTableStyle(currentTableStyle) {
265
- this.sonuc.currentTableStyle = currentTableStyle;
266
- return this;
267
- }
268
- setSubject(subject) {
269
- this.sonuc.book.subject = subject;
270
- return this;
271
- }
272
- }
273
- class JsonToExcelParser {
274
- static async indir(sonuc, dosyaAdi) {
275
- const blob = await this.blobOlustur(sonuc);
276
- const normalizeDosyaAdi = this.dosyaAdiDuzenle(dosyaAdi);
277
- saveAs(blob, `${normalizeDosyaAdi}.xlsx`);
278
- }
279
- static async blobOlustur(sonuc) {
280
- const workbook = this.workbookOlustur(sonuc);
281
- const buffer = await workbook.xlsx.writeBuffer();
282
- const toplamFormulluBuffer = await this.toplamSatiriFormulleriniYaz(workbook, buffer);
283
- const duzeltilmisBuffer = await this.sheetOzellikSiralariniDuzelt(workbook, toplamFormulluBuffer);
284
- return new Blob([duzeltilmisBuffer], {
285
- type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
286
- });
287
- }
288
- static async toplamSatiriFormulleriniYaz(workbook, buffer) {
289
- const tabloFormulleri = new Map();
290
- for (const worksheet of workbook.worksheets) {
291
- for (const tablo of worksheet.getTables()) {
292
- const formuller = new Map();
293
- for (const [index, kolon] of tablo.table.columns.entries()) {
294
- if (kolon.totalsRowFunction === 'custom' && kolon.totalsRowFormula) {
295
- formuller.set(index + 1, kolon.totalsRowFormula);
296
- }
297
- }
298
- if (formuller.size) {
299
- tabloFormulleri.set(tablo.table.name, formuller);
300
- }
301
- }
302
- }
303
- if (!tabloFormulleri.size) {
304
- return buffer;
305
- }
306
- // Ekr: JSZip, sadece atılan excelde custom toplam formülü varsa(Fark % ağırlıklı oran hesaplaması gibi) çalışır.
307
- const zip = await JSZip.loadAsync(buffer);
308
- const tabloDosyalari = Object.keys(zip.files).filter(ad => /^xl\/tables\/table\d+\.xml$/.test(ad));
309
- await Promise.all(tabloDosyalari.map(async (dosyaAdi) => {
310
- const xml = await zip.file(dosyaAdi).async('string');
311
- const tabloAdi = /<table [^>]*?\bname="([^"]*)"/.exec(xml)?.[1];
312
- const formuller = tabloAdi ? tabloFormulleri.get(tabloAdi) : undefined;
313
- if (!formuller) {
314
- return;
315
- }
316
- const yeniXml = xml.replaceAll(/<tableColumn id="(\d+)"([^>]*?) totalsRowFunction="custom"([^>]*?)\/>/g, (eslesme, id, once, sonra) => {
317
- const formul = formuller.get(Number(id));
318
- return formul
319
- ? `<tableColumn id="${id}"${once} totalsRowFunction="custom"${sonra}><totalsRowFormula>${this.xmlKacis(formul)}</totalsRowFormula></tableColumn>`
320
- : eslesme;
321
- });
322
- zip.file(dosyaAdi, yeniXml);
323
- }));
324
- return zip.generateAsync({ type: 'arraybuffer' });
325
- }
326
- static async sheetOzellikSiralariniDuzelt(workbook, buffer) {
327
- const gruplamaVar = workbook.worksheets.some(worksheet => worksheet.properties.outlineProperties !== undefined);
328
- if (!gruplamaVar) {
329
- return buffer;
330
- }
331
- const sheetPrSirasi = ['tabColor', 'outlinePr', 'pageSetUpPr'];
332
- const zip = await JSZip.loadAsync(buffer);
333
- const sheetDosyalari = Object.keys(zip.files).filter(ad => /^xl\/worksheets\/sheet\d+\.xml$/.test(ad));
334
- await Promise.all(sheetDosyalari.map(async (dosyaAdi) => {
335
- const xml = await zip.file(dosyaAdi).async('string');
336
- const yeniXml = xml.replace(/<sheetPr>(.*?)<\/sheetPr>/s, (eslesme, icerik) => {
337
- const cocuklar = icerik.match(/<(?:tabColor|outlinePr|pageSetUpPr)\b[^>]*\/>/g);
338
- if (!cocuklar) {
339
- return eslesme;
340
- }
341
- const sira = (cocuk) => sheetPrSirasi.indexOf(/^<(\w+)/.exec(cocuk)[1]);
342
- const sirali = [...cocuklar].sort((a, b) => sira(a) - sira(b));
343
- return `<sheetPr>${sirali.join('')}</sheetPr>`;
344
- });
345
- if (yeniXml !== xml) {
346
- zip.file(dosyaAdi, yeniXml);
347
- }
348
- }));
349
- return zip.generateAsync({ type: 'arraybuffer' });
350
- }
351
- static xmlKacis(metin) {
352
- return metin
353
- .replaceAll('&', '&amp;')
354
- .replaceAll('<', '&lt;')
355
- .replaceAll('>', '&gt;');
356
- }
357
- static standartPageSetupOlustur() {
358
- return {
359
- bottomMargin: 1,
360
- centerHorizontally: true,
361
- centerVertically: true,
362
- fitToPagesTall: 1,
363
- fitToPagesWide: 1,
364
- leftMargin: 1,
365
- orientation: 2,
366
- rightMargin: 1,
367
- topMargin: 1
368
- };
369
- }
370
- static ustBilgiEkle(ustBilgi, font) {
371
- return font ? { font, ustBilgi } : { ustBilgi };
372
- }
373
- static raporOlustur() {
374
- return new JsonToExcelReportBuilder();
375
- }
376
- static workbookOlustur(sonuc) {
377
- const workbook = new Workbook();
378
- workbook.created = new Date();
379
- workbook.calcProperties.fullCalcOnLoad = true;
380
- const gridLinesGorunur = sonuc.window.displayGridLines;
381
- if (this.yeniYapiMi(sonuc)) {
382
- workbook.creator = sonuc.book.author || 'MedPlan';
383
- workbook.subject = '';
384
- workbook.description = '';
385
- this.yeniFormatSheetsYaz(workbook, sonuc, gridLinesGorunur);
386
- }
387
- else {
388
- workbook.creator = sonuc.book.author || 'MedPlan';
389
- workbook.subject = this.konuVer(sonuc.book, sonuc.ustBilgiler?.[0]?.ustBilgi);
390
- workbook.description = sonuc.book.comments || '';
391
- this.eskiFormatSheetsYaz(workbook, sonuc, gridLinesGorunur);
392
- }
393
- this.aktifSayfayiAyarla(workbook, sonuc.book.activeSheetNo, workbook.worksheets.length);
394
- return workbook;
395
- }
396
- static yeniYapiMi(sonuc) {
397
- const ilkSheet = sonuc.sheets[0];
398
- if (Array.isArray(ilkSheet?.tables)) {
399
- return true;
400
- }
401
- const runtimeSonuc = sonuc;
402
- return !Array.isArray(runtimeSonuc.tables);
403
- }
404
- static yeniFormatSheetsYaz(workbook, sonuc, gridLinesGorunur) {
405
- for (let index = 0; index < sonuc.sheets.length; index++) {
406
- const sheet = sonuc.sheets[index];
407
- const sheetAdi = this.sayfaAdiDuzenle(sheet.sheetName || 'Rapor', index + 1);
408
- const worksheet = workbook.addWorksheet(sheetAdi);
409
- const zoomScale = sheet.zoom && sheet.zoom > 0 ? sheet.zoom : undefined;
410
- worksheet.views = [{ showGridLines: gridLinesGorunur, ...(zoomScale !== undefined && { zoomScale }) }];
411
- this.sayfaDuzeniniBelirle(worksheet, sheet);
412
- const ustBilgiler = sheet.ustBilgiler ?? [];
413
- this.yeniFormatUstBilgileriYaz(worksheet, ustBilgiler, sonuc.defaultFont);
414
- let sonSatir = ustBilgiler.length + 1;
415
- for (const table of sheet.tables ?? []) {
416
- sonSatir = Math.max(sonSatir, this.tabloyuYaz(worksheet, sonuc, table));
417
- }
418
- if (sheet.notlar?.length) {
419
- this.notlariYazList(worksheet, sheet.notlar, sheet.not?.font, sonSatir + 2, sonuc.defaultFont);
420
- }
421
- }
422
- if (sonuc.sheets.length === 0) {
423
- const worksheet = workbook.addWorksheet('Rapor');
424
- worksheet.views = [{ showGridLines: gridLinesGorunur }];
425
- }
426
- }
427
- static eskiFormatSheetsYaz(workbook, sonuc, gridLinesGorunur) {
428
- const tablesBySheet = this.sheetBazliTablolar(sonuc);
429
- const ustBilgiler = sonuc.ustBilgiler ?? [];
430
- const notlar = sonuc.notlar ?? [];
431
- for (const sheetGrup of tablesBySheet) {
432
- const worksheet = workbook.addWorksheet(sheetGrup.sheetName);
433
- worksheet.views = [{ showGridLines: gridLinesGorunur }];
434
- this.ustBilgileriYaz(worksheet, ustBilgiler, sonuc.defaultFont);
435
- let sonSatir = 1;
436
- for (const table of sheetGrup.tables) {
437
- sonSatir = Math.max(sonSatir, this.tabloyuYaz(worksheet, sonuc, table));
438
- }
439
- this.notlariYazList(worksheet, notlar, sonuc.not?.font, sonSatir + 2, sonuc.defaultFont);
440
- }
441
- if (tablesBySheet.length === 0) {
442
- const worksheet = workbook.addWorksheet(this.bosRaporSheetAdiniVer(sonuc));
443
- worksheet.views = [{ showGridLines: gridLinesGorunur }];
444
- this.ustBilgileriYaz(worksheet, ustBilgiler, sonuc.defaultFont);
445
- this.notlariYazList(worksheet, notlar, sonuc.not?.font, ustBilgiler.length + 2, sonuc.defaultFont);
446
- }
447
- }
448
- static sheetBazliTablolar(sonuc) {
449
- const grouped = new Map();
450
- for (const table of sonuc.tables ?? []) {
451
- const sheetNo = this.tableSheetNoVer(table);
452
- const sheetKey = this.sheetKeyVer(table, sheetNo, grouped.size + 1);
453
- const existing = grouped.get(sheetKey);
454
- if (existing) {
455
- existing.tables.push(table);
456
- continue;
457
- }
458
- grouped.set(sheetKey, {
459
- sheetName: this.sheetAdiniBelirle(sonuc, table, grouped.size + 1, sheetNo),
460
- ...(sheetNo !== undefined && { sheetNo }),
461
- tables: [table]
462
- });
463
- }
464
- return Array.from(grouped.values()).sort((a, b) => this.sheetGrupSirasiVer(a) - this.sheetGrupSirasiVer(b));
465
- }
466
- static tableSheetNoVer(table) {
467
- const runtimeTable = table;
468
- return runtimeTable.sheetNo;
469
- }
470
- static sheetKeyVer(table, sheetNo, index) {
471
- if (sheetNo !== undefined) {
472
- return `sheet-no-${sheetNo}`;
473
- }
474
- const eskiSheetName = table.sheetName?.trim();
475
- if (eskiSheetName) {
476
- return `sheet-name-${eskiSheetName}`;
477
- }
478
- return `sheet-index-${index}`;
479
- }
480
- static sheetAdiniBelirle(sonuc, table, index, sheetNo) {
481
- const jsonSheet = this.jsonSheetBul(sonuc.sheets, sheetNo, index);
482
- if (jsonSheet?.sheetName?.trim()) {
483
- return this.sayfaAdiDuzenle(jsonSheet.sheetName, index);
484
- }
485
- return this.sayfaAdiDuzenle(table.sheetName || 'Rapor', index);
486
- }
487
- static jsonSheetBul(sheets, sheetNo, index) {
488
- if (sheetNo !== undefined) {
489
- return sheets.find(sheet => sheet.sheetNo === sheetNo);
490
- }
491
- return sheets.find(sheet => sheet.sheetNo === index) ?? sheets[index - 1];
492
- }
493
- static konuVer(book, ilkUstBilgi) {
494
- return book.subject || ilkUstBilgi || 'Rapor';
495
- }
496
- static bosRaporSheetAdiniVer(sonuc) {
497
- const ilkSheetAdi = sonuc.sheets[0]?.sheetName;
498
- return this.sayfaAdiDuzenle(ilkSheetAdi || 'Rapor', 1);
499
- }
500
- static aktifSayfayiAyarla(workbook, activeSheetNo, toplamSheetSayisi) {
501
- const aktifTab = this.aktifTabNoVer(activeSheetNo, toplamSheetSayisi);
502
- if (aktifTab === undefined) {
503
- return;
504
- }
505
- workbook.views = [{
506
- activeTab: aktifTab,
507
- firstSheet: aktifTab,
508
- height: 20000,
509
- visibility: 'visible',
510
- width: 20000,
511
- x: 0,
512
- y: 0
513
- }];
514
- }
515
- static aktifTabNoVer(activeSheetNo, toplamSheetSayisi) {
516
- if (toplamSheetSayisi <= 0) {
517
- return undefined;
518
- }
519
- const aktifSheetNo = Number.isFinite(activeSheetNo) && activeSheetNo > 0 ? activeSheetNo : 1;
520
- return Math.min(aktifSheetNo - 1, toplamSheetSayisi - 1);
521
- }
522
- static sheetGrupSirasiVer(sheetGrup) {
523
- return sheetGrup.sheetNo ?? Number.MAX_SAFE_INTEGER;
524
- }
525
- static yeniFormatUstBilgileriYaz(worksheet, ustBilgiler, defaultFont) {
526
- for (let index = 0; index < ustBilgiler.length; index++) {
527
- const ustBilgi = ustBilgiler[index];
528
- const hucre = worksheet.getCell(index + 1, 1);
529
- hucre.value = ustBilgi.ustBilgi;
530
- this.hucreFontunuUygula(hucre, ustBilgi.font, defaultFont);
531
- hucre.alignment = { horizontal: 'left', vertical: 'middle', wrapText: false };
532
- }
533
- }
534
- static ustBilgileriYaz(worksheet, ustBilgiler, defaultFont) {
535
- for (const ustBilgi of ustBilgiler) {
536
- const hucre = worksheet.getCell(ustBilgi.rowNo ?? 1, 1);
537
- hucre.value = ustBilgi.ustBilgi;
538
- this.hucreFontunuUygula(hucre, ustBilgi.font, defaultFont);
539
- hucre.alignment = { horizontal: 'left', vertical: 'middle', wrapText: false };
540
- }
541
- }
542
- static notlariYazList(worksheet, notlar, notFont, baslangicSatiri, defaultFont) {
543
- let satirNo = baslangicSatiri;
544
- for (const not of notlar) {
545
- const cell = worksheet.getCell(satirNo, 1);
546
- cell.value = not;
547
- this.hucreFontunuUygula(cell, notFont, defaultFont);
548
- cell.alignment = { vertical: 'middle', wrapText: true };
549
- satirNo++;
550
- }
551
- }
552
- static sayfaDuzeniniBelirle(worksheet, sheet) {
553
- const { pageSetup } = sheet;
554
- if (!pageSetup) {
555
- return;
556
- }
557
- if (pageSetup.orientation === 2) {
558
- worksheet.pageSetup.orientation = 'landscape';
559
- }
560
- else if (pageSetup.orientation === 1) {
561
- worksheet.pageSetup.orientation = 'portrait';
562
- }
563
- const hasMargin = pageSetup.leftMargin !== undefined ||
564
- pageSetup.rightMargin !== undefined ||
565
- pageSetup.topMargin !== undefined ||
566
- pageSetup.bottomMargin !== undefined ||
567
- pageSetup.headerMargin !== undefined ||
568
- pageSetup.footerMargin !== undefined;
569
- if (hasMargin) {
570
- worksheet.pageSetup.margins = {
571
- left: pageSetup.leftMargin ?? 0.7,
572
- right: pageSetup.rightMargin ?? 0.7,
573
- top: pageSetup.topMargin ?? 0.75,
574
- bottom: pageSetup.bottomMargin ?? 0.75,
575
- header: pageSetup.headerMargin ?? 0.3,
576
- footer: pageSetup.footerMargin ?? 0.3
577
- };
578
- }
579
- if (pageSetup.centerHorizontally !== undefined) {
580
- worksheet.pageSetup.horizontalCentered = pageSetup.centerHorizontally;
581
- }
582
- if (pageSetup.centerVertically !== undefined) {
583
- worksheet.pageSetup.verticalCentered = pageSetup.centerVertically;
584
- }
585
- const fitTall = pageSetup.fitToPagesTall;
586
- const fitWide = pageSetup.fitToPagesWide;
587
- if (fitTall !== undefined || fitWide !== undefined || pageSetup.fitToPagesTAut || pageSetup.fitToPagesWAut) {
588
- worksheet.pageSetup.fitToPage = true;
589
- worksheet.pageSetup.fitToHeight = pageSetup.fitToPagesTAut ? 0 : (fitTall ?? 1);
590
- worksheet.pageSetup.fitToWidth = pageSetup.fitToPagesWAut ? 0 : (fitWide ?? 1);
591
- }
592
- if (typeof pageSetup.zoom === 'number' && pageSetup.zoom > 0) {
593
- worksheet.pageSetup.scale = pageSetup.zoom;
594
- }
595
- if (pageSetup.printArea) {
596
- worksheet.pageSetup.printArea = pageSetup.printArea;
597
- }
598
- const pageHeader = this.baslikAltbilgiMetniOlustur(pageSetup.leftHeader, pageSetup.centerHeader, pageSetup.rightHeader);
599
- const pageFooter = this.baslikAltbilgiMetniOlustur(pageSetup.leftFooter, pageSetup.centerFooter, pageSetup.rightFooter);
600
- if (pageHeader) {
601
- worksheet.headerFooter.oddHeader = pageHeader;
602
- }
603
- if (pageFooter) {
604
- worksheet.headerFooter.oddFooter = pageFooter;
605
- }
606
- }
607
- static baslikAltbilgiMetniOlustur(sol, orta, sag) {
608
- const parcalar = [];
609
- if (sol) {
610
- parcalar.push(`&L${sol}`);
611
- }
612
- if (orta) {
613
- parcalar.push(`&C${orta}`);
614
- }
615
- if (sag) {
616
- parcalar.push(`&R${sag}`);
617
- }
618
- return parcalar.length ? parcalar.join('') : undefined;
619
- }
620
- static tabloyuYaz(worksheet, sonuc, kaynakTable) {
621
- const table = kaynakTable;
622
- const toplamSatiriVar = table.toplamSatiri === true && table.collection.length > 0 && table.columns.length > 0;
623
- if (!table.columns.length) {
624
- return table.ust ?? 1;
625
- }
626
- const startRow = Math.max(1, table.ust ?? 1);
627
- const startCol = Math.max(1, table.sol ?? 1);
628
- const gecerliTableStyle = this.gecerliTableStyleVer(sonuc.currentTableStyle);
629
- const headerTitlelari = table.columns.map(column => this.baslikMetniniHazirla(column.header.title || ''));
630
- const gorunenBaslikMetinleri = headerTitlelari.map(title => title.replaceAll('\n', ' '));
631
- const tabloKolonAdlari = this.benzersizKolonAdlariOlustur(gorunenBaslikMetinleri);
632
- const tabloAdi = this.tabloAdiOlustur(worksheet.name, startRow, startCol);
633
- const headerFont = table.header?.font;
634
- const uygulanacakHeaderFont = headerFont?.color ? headerFont : {
635
- ...headerFont,
636
- color: 'FFFFFFFF'
637
- };
638
- const dataFont = table.data?.font;
639
- const hiddenRowSet = new Set(table.hiddenRows ?? []);
640
- const formulCeller = [];
641
- const hucreFontRenkleri = [];
642
- const satirlar = table.collection.map((rowData, rowIndex) => table.columns.map((column, colIndex) => {
643
- const hazirHucre = this.hucreDegeriniHazirla(rowData, column, sonuc.sifirlariBasmaSayi);
644
- hucreFontRenkleri[rowIndex] ??= [];
645
- hucreFontRenkleri[rowIndex][colIndex] = hazirHucre.fontColorArgb;
646
- if (hazirHucre.deger !== null && typeof hazirHucre.deger === 'object' && 'formula' in hazirHucre.deger) {
647
- formulCeller.push({ rowIndex, colIndex, column, formula: hazirHucre.deger });
648
- return '';
649
- }
650
- return hazirHucre.deger;
651
- }));
652
- const toplamHucreleri = toplamSatiriVar ? this.toplamHucreleriniHazirla(table) : [];
653
- this.kolonGrubuYaz(worksheet, startRow, startCol, table);
654
- const headerRow = worksheet.getRow(startRow);
655
- const tableStyle = this.tableStyleDonustur(gecerliTableStyle);
656
- const bosSatirEklendi = satirlar.length === 0;
657
- const tabloSatirlari = bosSatirEklendi ? [table.columns.map(() => '')] : satirlar;
658
- worksheet.addTable({
659
- name: tabloAdi,
660
- ref: worksheet.getCell(startRow, startCol).address,
661
- headerRow: true,
662
- totalsRow: toplamSatiriVar,
663
- ...(tableStyle && { style: tableStyle }),
664
- columns: tabloKolonAdlari.map((ad, index) => ({
665
- name: ad,
666
- filterButton: true,
667
- ...(toplamSatiriVar && this.toplamSatiriKolonuVer(toplamHucreleri[index]?.deger, index, this.toplamFonksiyonuVer(table.columns[index]), table.columns[index].toplamFormulu
668
- ? this.toplamFormuluExcelMetniVer(table, table.columns[index].toplamFormulu, tabloAdi, tabloKolonAdlari)
669
- : undefined))
670
- })),
671
- rows: tabloSatirlari
672
- });
673
- if (bosSatirEklendi) {
674
- worksheet.getRow(startRow + 1).hidden = true;
675
- }
676
- this.kolonGenislikleriniUygula(worksheet, startCol, table.columns, satirlar, table.autoFit, toplamHucreleri.map(hucre => hucre.deger));
677
- this.kolonGruplariniUygula(worksheet, startCol, table);
678
- for (let colIndex = 0; colIndex < table.columns.length; colIndex++) {
679
- const column = table.columns[colIndex];
680
- const cell = headerRow.getCell(startCol + colIndex);
681
- cell.alignment = {
682
- horizontal: this.yatayHizaDonustur(column.header.horizontalAlignment),
683
- vertical: 'bottom',
684
- wrapText: false
685
- };
686
- this.hucreFontunuUygula(cell, uygulanacakHeaderFont, sonuc.defaultFont);
687
- }
688
- for (let rowIndex = 0; rowIndex < table.collection.length; rowIndex++) {
689
- const wsRow = worksheet.getRow(startRow + 1 + rowIndex);
690
- const satir1Bazli = rowIndex + 1;
691
- if (hiddenRowSet.has(satir1Bazli)) {
692
- wsRow.hidden = true;
693
- }
694
- const rowHeight = table.rowHeights?.find(rh => rh.rowNo === satir1Bazli);
695
- if (rowHeight?.height) {
696
- wsRow.height = rowHeight.height;
697
- }
698
- for (let colIndex = 0; colIndex < table.columns.length; colIndex++) {
699
- const column = table.columns[colIndex];
700
- const cell = wsRow.getCell(startCol + colIndex);
701
- const hucreDegeri = satirlar[rowIndex][colIndex];
702
- cell.value = hucreDegeri;
703
- this.hucreFontunuUygula(cell, dataFont, sonuc.defaultFont);
704
- const hucreFontRengi = hucreFontRenkleri[rowIndex]?.[colIndex];
705
- if (hucreFontRengi) {
706
- cell.font = { ...(cell.font ?? {}), color: { argb: hucreFontRengi } };
707
- }
708
- const numFmt = this.numberFormatDonustur(this.kolonFormatiniBelirle(column));
709
- if (numFmt) {
710
- cell.numFmt = numFmt;
711
- }
712
- else if (hucreDegeri instanceof Date) {
713
- cell.numFmt = this.varsayilanTarihFormatiniVer();
714
- }
715
- const hucreHizasi = this.hucreYatayHizasiniBelirle(column);
716
- cell.alignment = {
717
- ...(hucreHizasi !== undefined && { horizontal: hucreHizasi }),
718
- vertical: this.dikeyHizaDonustur(column.verticalAlignment),
719
- wrapText: false
720
- };
721
- // Sütun rengi
722
- const colFontColor = table.columnFontColors?.[colIndex];
723
- if (colFontColor) {
724
- const argb = this.argbDonustur(colFontColor);
725
- if (argb) {
726
- cell.font = { ...(cell.font ?? {}), color: { argb } };
727
- }
728
- }
729
- const colIntColor = this.kolonRenginiBul(table.columnInteriorColors, colIndex);
730
- if (colIntColor) {
731
- const argb = this.argbDonustur(colIntColor);
732
- if (argb) {
733
- cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb } };
734
- }
735
- }
736
- // Satır rengi (sütun rengini ezer)
737
- const rowFontColor = table.rowFontColors?.find(rc => rc.rowNo === satir1Bazli);
738
- if (rowFontColor) {
739
- const argb = this.argbDonustur(rowFontColor.color);
740
- if (argb) {
741
- cell.font = { ...(cell.font ?? {}), color: { argb } };
742
- }
743
- }
744
- const rowIntColor = table.rowInteriorColors?.find(rc => rc.rowNo === satir1Bazli);
745
- if (rowIntColor) {
746
- const argb = this.argbDonustur(rowIntColor.color);
747
- if (argb) {
748
- cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb } };
749
- }
750
- }
751
- }
752
- }
753
- for (const { rowIndex, colIndex, column, formula } of formulCeller) {
754
- const cell = worksheet.getRow(startRow + 1 + rowIndex).getCell(startCol + colIndex);
755
- cell.value = formula;
756
- const formulHizasi = this.hucreYatayHizasiniBelirle(column);
757
- cell.alignment = {
758
- ...(cell.alignment ?? {}),
759
- ...(formulHizasi !== undefined && { horizontal: formulHizasi })
760
- };
761
- }
762
- let sonSatir = startRow + table.collection.length;
763
- if (toplamSatiriVar) {
764
- sonSatir++;
765
- this.toplamSatiriniYaz(worksheet, sonuc, table, toplamHucreleri, sonSatir, startCol);
766
- }
767
- this.farkRenkleriniUygula(worksheet, table, startRow + 1, sonSatir, startCol);
768
- // Footer satırları
769
- const footer = table.footer;
770
- if (footer?.basilacak) {
771
- const ustBosluk = footer.ustBosluk ?? 0;
772
- const satirSayisi = footer.satirSayisi ?? 1;
773
- const footerBasSatir = sonSatir + 1 + ustBosluk;
774
- for (let fi = 0; fi < satirSayisi; fi++) {
775
- const footerRow = worksheet.getRow(footerBasSatir + fi);
776
- for (let colIndex = 0; colIndex < table.columns.length; colIndex++) {
777
- const column = table.columns[colIndex];
778
- const cell = footerRow.getCell(startCol + colIndex);
779
- this.hucreFontunuUygula(cell, footer.font, sonuc.defaultFont);
780
- const colFooter = column.footer;
781
- if (colFooter?.isFunction) {
782
- const footerFormula = this.footerFormulunuOlustur(column, colIndex, startRow, startCol, table.collection.length);
783
- if (footerFormula) {
784
- cell.value = { formula: footerFormula };
785
- const numFmt = this.numberFormatDonustur(this.kolonFormatiniBelirle(column));
786
- if (numFmt) {
787
- cell.numFmt = numFmt;
788
- }
789
- }
790
- }
791
- else if (colFooter?.title) {
792
- cell.value = colFooter.title;
793
- }
794
- const footerHizasi = colFooter?.isFunction
795
- ? this.hucreYatayHizasiniBelirle(column)
796
- : this.yatayHizaDonustur(colFooter?.horizontalAlignment);
797
- cell.alignment = {
798
- ...(footerHizasi !== undefined && { horizontal: footerHizasi }),
799
- vertical: 'middle',
800
- wrapText: false
801
- };
802
- }
803
- }
804
- sonSatir = footerBasSatir + satirSayisi - 1;
805
- }
806
- return sonSatir;
807
- }
808
- static farkRenkleriniUygula(worksheet, table, ilkSatir, sonSatir, startCol) {
809
- if (!table.collection.length) {
810
- return;
811
- }
812
- for (let colIndex = 0; colIndex < table.columns.length; colIndex++) {
813
- if (!table.columns[colIndex].farkRenkli) {
814
- continue;
815
- }
816
- const ilkHucre = worksheet.getCell(ilkSatir, startCol + colIndex).address;
817
- const sonHucre = worksheet.getCell(sonSatir, startCol + colIndex).address;
818
- worksheet.addConditionalFormatting({
819
- ref: `${ilkHucre}:${sonHucre}`,
820
- rules: [
821
- { type: 'cellIs', operator: 'greaterThan', formulae: [0], priority: 1, style: { font: { color: { argb: 'FF16A34A' } } } },
822
- { type: 'cellIs', operator: 'lessThan', formulae: [0], priority: 2, style: { font: { color: { argb: 'FFDC2626' } } } }
823
- ]
824
- });
825
- }
826
- }
827
- static toplamHucreleriniHazirla(table) {
828
- return table.columns.map((column, colIndex) => {
829
- if (colIndex === 0) {
830
- return { deger: table.toplamEtiketi ?? 'Toplam' };
831
- }
832
- if (column.toplamFormulu) {
833
- return { deger: this.toplamFormuluSonucuVer(table, column.toplamFormulu) ?? null };
834
- }
835
- const fonksiyon = this.toplamFonksiyonuVer(column);
836
- if (!fonksiyon) {
837
- return { deger: null };
838
- }
839
- const { adet, toplam } = this.kolonToplaminiVer(table, column.property);
840
- if (fonksiyon === 'average') {
841
- return { deger: adet ? toplam / adet : 0 };
842
- }
843
- return { deger: toplam };
844
- });
845
- }
846
- static kolonToplaminiVer(table, property) {
847
- let toplam = 0;
848
- let adet = 0;
849
- for (const row of table.collection) {
850
- const hamDeger = row[property];
851
- const sayi = Number(hamDeger);
852
- if (hamDeger !== null && hamDeger !== undefined && hamDeger !== '' && Number.isFinite(sayi)) {
853
- toplam += sayi;
854
- adet++;
855
- }
856
- }
857
- return { adet, toplam };
858
- }
859
- static toplamFormulundekiKolonlariVer(table, formul) {
860
- const properties = [...formul.matchAll(/\{([^{}]+)\}/g)].map(eslesme => eslesme[1]);
861
- const tumKolonlarVar = properties.every(property => table.columns.some(kolon => kolon.property === property));
862
- return properties.length && tumKolonlarVar ? properties : undefined;
863
- }
864
- static toplamFormuluSonucuVer(table, formul) {
865
- if (!this.toplamFormulundekiKolonlariVer(table, formul)) {
866
- return undefined;
867
- }
868
- const sayisalFormul = formul.replaceAll(/\{([^{}]+)\}/g, (_eslesme, property) => {
869
- const { toplam } = this.kolonToplaminiVer(table, property);
870
- return toplam < 0 ? `(${toplam})` : String(toplam);
871
- });
872
- return ToplamFormuluHesaplayici.hesapla(sayisalFormul);
873
- }
874
- static toplamFormuluExcelMetniVer(table, formul, tabloAdi, kolonAdlari) {
875
- if (!this.toplamFormulundekiKolonlariVer(table, formul)) {
876
- return undefined;
877
- }
878
- return formul.replaceAll(/\{([^{}]+)\}/g, (_eslesme, property) => {
879
- const kolonAdi = kolonAdlari[table.columns.findIndex(kolon => kolon.property === property)];
880
- const kacisliAd = kolonAdi.replaceAll(/[[\]#']/g, '\'$&');
881
- return `SUBTOTAL(109,${tabloAdi}[${kacisliAd}])`;
882
- });
883
- }
884
- static toplamFonksiyonuVer(column) {
885
- if (column.toplamFonksiyonu === 'none' || column.toplamFormulu) {
886
- return undefined;
887
- }
888
- return column.toplamFonksiyonu ?? (this.sayisalKolonMu(column.arrayType) ? 'sum' : undefined);
889
- }
890
- static toplamSatiriKolonuVer(deger, kolonIndex, fonksiyon, excelFormulu) {
891
- if (kolonIndex === 0) {
892
- return { totalsRowLabel: typeof deger === 'string' ? deger : '' };
893
- }
894
- if (excelFormulu) {
895
- return {
896
- totalsRowFormula: excelFormulu,
897
- totalsRowFunction: 'custom',
898
- ...(typeof deger === 'number' && { totalsRowResult: deger })
899
- };
900
- }
901
- return fonksiyon ? { totalsRowFunction: fonksiyon } : undefined;
902
- }
903
- static toplamSatiriniYaz(worksheet, sonuc, table, toplamHucreleri, satirNo, startCol) {
904
- const wsRow = worksheet.getRow(satirNo);
905
- for (let colIndex = 0; colIndex < table.columns.length; colIndex++) {
906
- const column = table.columns[colIndex];
907
- const cell = wsRow.getCell(startCol + colIndex);
908
- const deger = toplamHucreleri[colIndex]?.deger;
909
- if (colIndex > 0 && typeof deger === 'number' && typeof cell.value === 'object' && cell.value !== null && 'formula' in cell.value) {
910
- cell.value = { ...cell.value, result: deger };
911
- }
912
- this.hucreFontunuUygula(cell, table.data?.font, sonuc.defaultFont);
913
- cell.font = { ...(cell.font ?? {}), bold: true };
914
- if (column.farkRenkli && typeof deger === 'number' && deger !== 0) {
915
- cell.font = { ...cell.font, color: { argb: deger > 0 ? 'FF16A34A' : 'FFDC2626' } };
916
- }
917
- cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFDDEBF7' } };
918
- const numFmt = this.numberFormatDonustur(this.kolonFormatiniBelirle(column));
919
- if (numFmt) {
920
- cell.numFmt = numFmt;
921
- }
922
- const hucreHizasi = this.hucreYatayHizasiniBelirle(column);
923
- cell.alignment = {
924
- ...(hucreHizasi !== undefined && { horizontal: hucreHizasi }),
925
- vertical: this.dikeyHizaDonustur(column.verticalAlignment),
926
- wrapText: false
927
- };
928
- }
929
- }
930
- static kolonGenislikleriniUygula(worksheet, startCol, columns, satirlar, autoFit, ekSatir) {
931
- const filtreButonuBoslukPayi = 1.25;
932
- const veriSagBoslukPayi = 1;
933
- const autoFitAktif = autoFit !== false;
934
- for (let index = 0; index < columns.length; index++) {
935
- const worksheetColumn = worksheet.getColumn(startCol + index);
936
- const tasarimGenisligi = (columns[index].width ?? 0) > 0 ? Math.round(columns[index].width / 7) : 0;
937
- if (!autoFitAktif) {
938
- worksheetColumn.width = tasarimGenisligi > 0 ? tasarimGenisligi : 10;
939
- continue;
940
- }
941
- const baslikUzunlugu = this.metinUzunlugu(this.baslikMetniniHazirla(columns[index].header.title));
942
- let veriUzunlugu = ekSatir ? this.hucreMetinUzunlugu(ekSatir[index]) : 0;
943
- for (const satir of satirlar) {
944
- veriUzunlugu = Math.max(veriUzunlugu, this.hucreMetinUzunlugu(satir[index]));
945
- }
946
- worksheetColumn.width = Math.max(10, tasarimGenisligi, baslikUzunlugu + 2 + filtreButonuBoslukPayi, veriUzunlugu + 2 + veriSagBoslukPayi);
947
- }
948
- }
949
- static baslikMetniniHazirla(metin) {
950
- return metin
951
- .replaceAll('\r\n', ' ')
952
- .replaceAll('\r', ' ')
953
- .replaceAll('\n', ' ')
954
- .trim();
955
- }
956
- static hucreMetinUzunlugu(deger) {
957
- if (deger === null || deger === undefined) {
958
- return 0;
959
- }
960
- if (typeof deger === 'string') {
961
- return this.metinUzunlugu(deger);
962
- }
963
- if (typeof deger === 'number' || typeof deger === 'boolean') {
964
- return String(deger).length;
965
- }
966
- if (deger instanceof Date) {
967
- return '14.05.2026 09:13:29'.length;
968
- }
969
- if (typeof deger === 'object' && 'formula' in deger) {
970
- return this.metinUzunlugu(String(deger.formula));
971
- }
972
- return this.metinUzunlugu(String(deger));
973
- }
974
- static hucreYatayHizasiniBelirle(column) {
975
- if (this.sayisalKolonMu(column.arrayType)) {
976
- return 'right';
977
- }
978
- if (this.booleanKolonMu(column.arrayType)) {
979
- return 'center';
980
- }
981
- if (column.horizontalAlignment === undefined) {
982
- return undefined;
983
- }
984
- return this.yatayHizaDonustur(column.horizontalAlignment);
985
- }
986
- static kolonFormatiniBelirle(column) {
987
- if (column.format !== undefined && column.format !== NumberFormatlar.belirsiz) {
988
- return column.format;
989
- }
990
- switch (column.arrayType) {
991
- case VariableType.integer:
992
- case VariableType.longint:
993
- return NumberFormatlar.long;
994
- case VariableType.real:
995
- return NumberFormatlar.real;
996
- case VariableType.date:
997
- return NumberFormatlar.tarih;
998
- default:
999
- return column.format;
1000
- }
1001
- }
1002
- static sayisalKolonMu(arrayType) {
1003
- switch (arrayType) {
1004
- case VariableType.integer:
1005
- case VariableType.longint:
1006
- case VariableType.real:
1007
- return true;
1008
- default:
1009
- return false;
1010
- }
1011
- }
1012
- static booleanKolonMu(arrayType) {
1013
- return arrayType === VariableType.boolean;
1014
- }
1015
- static metinUzunlugu(metin) {
1016
- return metin
1017
- .replaceAll('\r', '')
1018
- .split('\n')
1019
- .reduce((max, parca) => Math.max(max, parca.trim().length), 0);
1020
- }
1021
- static kolonGruplariniUygula(worksheet, startCol, table) {
1022
- const gruplar = this.gecerliKolonGruplariniVer(table);
1023
- if (!gruplar.length) {
1024
- return;
1025
- }
1026
- const kolonSayisi = table.columns.length;
1027
- const ozetSolda = table.outlineSummaryPosition === 'left';
1028
- const seviyeler = new Array(kolonSayisi).fill(0);
1029
- const gizliler = new Array(kolonSayisi).fill(false);
1030
- const kapaliOzetler = new Set();
1031
- for (const grup of gruplar) {
1032
- for (let index = grup.baslangic; index <= grup.bitis; index++) {
1033
- seviyeler[index] = Math.min(seviyeler[index] + 1, this.enYuksekKolonGrupSeviyesi);
1034
- if (grup.kapali) {
1035
- gizliler[index] = true;
1036
- }
1037
- }
1038
- const ozetIndex = ozetSolda ? grup.baslangic - 1 : grup.bitis + 1;
1039
- if (grup.kapali && ozetIndex >= 0 && ozetIndex < kolonSayisi) {
1040
- kapaliOzetler.add(ozetIndex);
1041
- }
1042
- }
1043
- worksheet.properties.outlineLevelCol = Math.max(worksheet.properties.outlineLevelCol ?? 0, ...seviyeler);
1044
- worksheet.properties.outlineProperties = { summaryBelow: true, summaryRight: !ozetSolda };
1045
- for (let index = 0; index < kolonSayisi; index++) {
1046
- const worksheetColumn = worksheet.getColumn(startCol + index);
1047
- worksheetColumn.outlineLevel = seviyeler[index];
1048
- if (gizliler[index]) {
1049
- worksheetColumn.hidden = true;
1050
- }
1051
- Object.defineProperty(worksheetColumn, 'collapsed', { value: kapaliOzetler.has(index), configurable: true });
1052
- Object.defineProperty(worksheetColumn, 'equivalentTo', { value: () => false, configurable: true });
1053
- }
1054
- }
1055
- static { this.enYuksekKolonGrupSeviyesi = 7; }
1056
- static gecerliKolonGruplariniVer(table) {
1057
- const adaylar = (table.outlineGroups ?? [])
1058
- .map(grup => ({
1059
- baslangic: table.columns.findIndex(column => column.property === grup.groupStart),
1060
- bitis: table.columns.findIndex(column => column.property === grup.groupEnd),
1061
- kapali: grup.collapsed === true
1062
- }))
1063
- .filter(grup => grup.baslangic >= 0 && grup.bitis >= grup.baslangic)
1064
- .sort((a, b) => a.baslangic - b.baslangic || b.bitis - a.bitis);
1065
- const kabulEdilenler = [];
1066
- for (const aday of adaylar) {
1067
- const cakisiyor = kabulEdilenler.some(grup => aday.baslangic <= grup.bitis && aday.bitis > grup.bitis);
1068
- if (!cakisiyor) {
1069
- kabulEdilenler.push(aday);
1070
- }
1071
- }
1072
- return kabulEdilenler;
1073
- }
1074
- static kolonGrubuYaz(worksheet, startRow, startCol, table) {
1075
- const columnGroups = table.columnGroup;
1076
- if (!columnGroups?.length || startRow <= 1) {
1077
- return;
1078
- }
1079
- const grupSatiri = startRow - 1;
1080
- for (const columnGroup of columnGroups) {
1081
- const baslangicIndex = table.columns.findIndex(column => column.property === columnGroup.groupStart);
1082
- const bitisIndex = table.columns.findIndex(column => column.property === columnGroup.groupEnd);
1083
- const baslangicKolonu = baslangicIndex >= 0 ? startCol + baslangicIndex : undefined;
1084
- const bitisKolonu = bitisIndex >= 0 ? startCol + bitisIndex : undefined;
1085
- if (!baslangicKolonu || !bitisKolonu || bitisKolonu < baslangicKolonu) {
1086
- continue;
1087
- }
1088
- worksheet.mergeCells(grupSatiri, baslangicKolonu, grupSatiri, bitisKolonu);
1089
- const grupHucre = worksheet.getCell(grupSatiri, baslangicKolonu);
1090
- grupHucre.value = columnGroup.groupName;
1091
- grupHucre.alignment = { horizontal: 'center', vertical: 'middle' };
1092
- grupHucre.font = { bold: true, size: 11, color: { argb: 'FFF79646' } };
1093
- grupHucre.fill = {
1094
- type: 'pattern',
1095
- pattern: 'solid',
1096
- fgColor: { argb: 'FFFFFFFF' }
1097
- };
1098
- for (let col = baslangicKolonu; col <= bitisKolonu; col++) {
1099
- const hucre = worksheet.getCell(grupSatiri, col);
1100
- hucre.border = {
1101
- ...hucre.border,
1102
- top: { style: 'medium', color: { argb: 'FFF79646' } },
1103
- ...(col === baslangicKolonu ? { left: { style: 'medium', color: { argb: 'FFF79646' } } } : (hucre.border?.left ? { left: hucre.border.left } : {})),
1104
- ...(col === bitisKolonu ? { right: { style: 'medium', color: { argb: 'FFF79646' } } } : (hucre.border?.right ? { right: hucre.border.right } : {}))
1105
- };
1106
- }
1107
- }
1108
- }
1109
- static hucreDegeriniHazirla(row, column, sifirlariBasmaSayi) {
1110
- const value = row[column.property];
1111
- if ((typeof value === 'string') && value.startsWith('=')) {
1112
- return { deger: { formula: this.excelFormuluneDonustur(value) } };
1113
- }
1114
- const sifirDegerMi = (typeof value === 'number' && value === 0) ||
1115
- (typeof value === 'string' && this.sayisalKolonMu(column.arrayType) && value.trim() !== '' && Number(value) === 0);
1116
- if (sifirDegerMi && sifirlariBasmaSayi) {
1117
- return { deger: null };
1118
- }
1119
- if (value === null || value === undefined) {
1120
- return { deger: '' };
1121
- }
1122
- const htmlHucre = (column.htmlKoduGelebilir === true) && typeof value === 'string' ? this.htmlHucreIceriginiHazirla(value) : undefined;
1123
- const normallesenDeger = htmlHucre?.deger ?? value;
1124
- if ((typeof normallesenDeger === 'string') && normallesenDeger.startsWith('=')) {
1125
- return this.hazirHucreDegeriOlustur({ formula: this.excelFormuluneDonustur(normallesenDeger) }, htmlHucre?.fontColorArgb);
1126
- }
1127
- if ((typeof value === 'string') && (typeof normallesenDeger === 'string')) {
1128
- const tarihMetni = this.tarihStringiniExcelMetnineDonustur(normallesenDeger, column);
1129
- if (tarihMetni) {
1130
- return this.hazirHucreDegeriOlustur(tarihMetni, htmlHucre?.fontColorArgb);
1131
- }
1132
- const tarihDegeri = this.tarihStringiniDateeDonustur(normallesenDeger);
1133
- if (tarihDegeri) {
1134
- return this.hazirHucreDegeriOlustur(tarihDegeri, htmlHucre?.fontColorArgb);
1135
- }
1136
- }
1137
- if (normallesenDeger instanceof Date) {
1138
- return this.hazirHucreDegeriOlustur(this.excelIcinTarihiNormalizeEt(normallesenDeger), htmlHucre?.fontColorArgb);
1139
- }
1140
- if (this.booleanKolonMu(column.arrayType)) {
1141
- return this.hazirHucreDegeriOlustur(normallesenDeger === true ? '+' : '', htmlHucre?.fontColorArgb);
1142
- }
1143
- if ((typeof normallesenDeger === 'number') || (typeof normallesenDeger === 'string')) {
1144
- return this.hazirHucreDegeriOlustur(normallesenDeger, htmlHucre?.fontColorArgb);
1145
- }
1146
- return this.hazirHucreDegeriOlustur(String(normallesenDeger), htmlHucre?.fontColorArgb);
1147
- }
1148
- static hazirHucreDegeriOlustur(deger, fontColorArgb) {
1149
- return {
1150
- deger,
1151
- ...(fontColorArgb ? { fontColorArgb } : {})
1152
- };
1153
- }
1154
- static htmlHucreIceriginiHazirla(value) {
1155
- if (!/[<>]/.test(value)) {
1156
- return undefined;
1157
- }
1158
- const deger = value
1159
- .replaceAll(/<br\s*\/?>/gi, '\n')
1160
- .replaceAll(/<\/p\s*>/gi, '\n')
1161
- .replaceAll(/<p\b[^>]*>/gi, '')
1162
- .replaceAll(/<\/div\s*>/gi, '\n')
1163
- .replaceAll(/<div\b[^>]*>/gi, '')
1164
- .replaceAll(/<[^>]+>/g, '')
1165
- .replaceAll(/&nbsp;/gi, ' ')
1166
- .trim();
1167
- const colorValue = this.htmlFontRenginiBul(value);
1168
- const fontColorArgb = this.argbDonustur(colorValue);
1169
- if ((deger === value) && !fontColorArgb) {
1170
- return undefined;
1171
- }
1172
- return { deger, ...(fontColorArgb && { fontColorArgb }) };
1173
- }
1174
- static htmlFontRenginiBul(value) {
1175
- const fontColorMatch = /<font\b[^>]*\bcolor\s*=\s*["']?([^"' >]+)["']?[^>]*>/i.exec(value);
1176
- if (fontColorMatch?.[1]) {
1177
- return fontColorMatch[1].trim();
1178
- }
1179
- const styleColorMatch = /<(?:font|span)\b[^>]*\bstyle\s*=\s*["'][^"']*\bcolor\s*:\s*([^;"']+)/i.exec(value);
1180
- if (styleColorMatch?.[1]) {
1181
- return styleColorMatch[1].trim();
1182
- }
1183
- return undefined;
1184
- }
1185
- static tarihStringiniDateeDonustur(value) {
1186
- const trimmedValue = value.trim();
1187
- const isoDateMatch = /^(\d{4})-(\d{2})-(\d{2})(?:$|[T\s])/.exec(trimmedValue);
1188
- if (!isoDateMatch) {
1189
- return undefined;
1190
- }
1191
- const year = Number(isoDateMatch[1]);
1192
- const month = Number(isoDateMatch[2]);
1193
- const day = Number(isoDateMatch[3]);
1194
- if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)) {
1195
- return undefined;
1196
- }
1197
- const date = new Date(year, month - 1, day);
1198
- if (date.getFullYear() !== year || date.getMonth() !== (month - 1) || date.getDate() !== day) {
1199
- return undefined;
1200
- }
1201
- return new Date(Date.UTC(year, month - 1, day, 12, 0, 0, 0));
1202
- }
1203
- static tarihStringiniExcelMetnineDonustur(value, column) {
1204
- if (!this.sadeceTarihKolonuMu(column)) {
1205
- return undefined;
1206
- }
1207
- const trimmedValue = value.trim();
1208
- const isoDateMatch = /^(\d{4})-(\d{2})-(\d{2})$/.exec(trimmedValue);
1209
- if (!isoDateMatch) {
1210
- return undefined;
1211
- }
1212
- const year = Number(isoDateMatch[1]);
1213
- const month = Number(isoDateMatch[2]);
1214
- const day = Number(isoDateMatch[3]);
1215
- if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)) {
1216
- return undefined;
1217
- }
1218
- const date = new Date(year, month - 1, day);
1219
- if (date.getFullYear() !== year || date.getMonth() !== (month - 1) || date.getDate() !== day) {
1220
- return undefined;
1221
- }
1222
- return `${String(day).padStart(2, '0')}.${String(month).padStart(2, '0')}.${year}`;
1223
- }
1224
- static excelIcinTarihiNormalizeEt(value) {
1225
- if (value.getHours() !== 0 || value.getMinutes() !== 0 || value.getSeconds() !== 0 || value.getMilliseconds() !== 0) {
1226
- return value;
1227
- }
1228
- return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), 12, 0, 0, 0));
1229
- }
1230
- static varsayilanTarihFormatiniVer() {
1231
- return 'dd.mm.yyyy';
1232
- }
1233
- static sadeceTarihKolonuMu(column) {
1234
- return this.kolonFormatiniBelirle(column) === NumberFormatlar.tarih;
1235
- }
1236
- static benzersizKolonAdlariOlustur(adlar) {
1237
- const sayaclar = new Map();
1238
- return adlar.map(ad => {
1239
- const temelAd = ad || ' ';
1240
- const sayi = sayaclar.get(temelAd) ?? 0;
1241
- sayaclar.set(temelAd, sayi + 1);
1242
- return sayi === 0 ? temelAd : `${temelAd}_${sayi}`;
1243
- });
1244
- }
1245
- static hucreFontunuUygula(cell, font, defaultFont) {
1246
- const style = font?.style ?? 0;
1247
- const excelFont = {};
1248
- const fontName = font?.name || defaultFont?.name;
1249
- if (fontName) {
1250
- excelFont.name = fontName;
1251
- }
1252
- const fontSize = (font?.size && font.size > 0) ? font.size : defaultFont?.size;
1253
- if (fontSize && fontSize > 0) {
1254
- excelFont.size = fontSize;
1255
- }
1256
- if (font?.color) {
1257
- const color = this.argbDonustur(font.color);
1258
- if (color) {
1259
- excelFont.color = { argb: color };
1260
- }
1261
- }
1262
- excelFont.bold = Boolean(style & FontStyle.bold);
1263
- excelFont.italic = Boolean(style & FontStyle.italic);
1264
- excelFont.underline = Boolean(style & FontStyle.underline);
1265
- cell.font = excelFont;
1266
- }
1267
- static gecerliTableStyleVer(tableStyle) {
1268
- if (!tableStyle) {
1269
- return undefined;
1270
- }
1271
- const style = tableStyle.trim();
1272
- if (/^TableStyleLight([1-9]|1\d|2[0-1])$/.test(style)) {
1273
- return style;
1274
- }
1275
- if (/^TableStyleMedium([1-9]|1\d|2[0-1])$/.test(style)) {
1276
- return style;
1277
- }
1278
- if (/^TableStyleDark([1-9]|10|11)$/.test(style)) {
1279
- return style;
1280
- }
1281
- return undefined;
1282
- }
1283
- static tableStyleDonustur(theme) {
1284
- if (!theme) {
1285
- return undefined;
1286
- }
1287
- return {
1288
- theme: theme,
1289
- showRowStripes: true
1290
- };
1291
- }
1292
- static tabloAdiOlustur(sheetName, startRow, startCol) {
1293
- const temizSheetName = sheetName.replaceAll(/[^A-Za-z0-9]/g, '_');
1294
- return `T_${temizSheetName}_R${startRow}C${startCol}`;
1295
- }
1296
- static yatayHizaDonustur(value) {
1297
- switch (value) {
1298
- case XLHAlign.xlHAlignCenter: return 'center';
1299
- case XLHAlign.xlHAlignCenterAcrossSelection: return 'centerContinuous';
1300
- case XLHAlign.xlHAlignDistributed: return 'distributed';
1301
- case XLHAlign.xlHAlignFill: return 'fill';
1302
- case XLHAlign.xlHAlignGeneral: return 'left';
1303
- case XLHAlign.xlHAlignJustify: return 'justify';
1304
- case XLHAlign.xlHAlignLeft: return 'left';
1305
- case XLHAlign.xlHAlignRight: return 'right';
1306
- default: return 'left';
1307
- }
1308
- }
1309
- static dikeyHizaDonustur(value) {
1310
- switch (value) {
1311
- case XLVAlign.xlVAlignTop: return 'top';
1312
- case XLVAlign.xlVAlignBottom: return 'bottom';
1313
- case XLVAlign.xlVAlignDistributed: return 'distributed';
1314
- case XLVAlign.xlVAlignJustify: return 'justify';
1315
- default: return 'middle';
1316
- }
1317
- }
1318
- static argbDonustur(color) {
1319
- if (!color) {
1320
- return undefined;
1321
- }
1322
- const cssColor = color.trim().toLowerCase();
1323
- const rgbMatch = cssColor.match(/^rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);
1324
- if (rgbMatch) {
1325
- const rgbDegerleri = rgbMatch.slice(1).map(value => Number(value));
1326
- if (rgbDegerleri.every(value => Number.isInteger(value) && value >= 0 && value <= 255)) {
1327
- return `FF${rgbDegerleri.map(value => value.toString(16).padStart(2, '0')).join('').toUpperCase()}`;
1328
- }
1329
- }
1330
- const namedColors = {
1331
- black: 'FF000000',
1332
- blue: 'FF0000FF',
1333
- cyan: 'FF00FFFF',
1334
- gray: 'FF808080',
1335
- green: 'FF008000',
1336
- grey: 'FF808080',
1337
- magenta: 'FFFF00FF',
1338
- orange: 'FFFFA500',
1339
- purple: 'FF800080',
1340
- red: 'FFFF0000',
1341
- white: 'FFFFFFFF',
1342
- yellow: 'FFFFFF00'
1343
- };
1344
- if (namedColors[cssColor]) {
1345
- return namedColors[cssColor];
1346
- }
1347
- const hexColor = cssColor.replace('#', '');
1348
- if (/^[0-9a-f]{6}$/i.test(hexColor)) {
1349
- return `FF${hexColor.toUpperCase()}`;
1350
- }
1351
- if (/^[0-9A-Fa-f]{8}$/.test(color)) {
1352
- return color.toUpperCase();
1353
- }
1354
- const numericColor = Number(color);
1355
- if (!Number.isFinite(numericColor)) {
1356
- return undefined;
1357
- }
1358
- const r = numericColor & 255;
1359
- const g = (numericColor >> 8) & 255;
1360
- const b = (numericColor >> 16) & 255;
1361
- return `FF${[r, g, b].map(value => value.toString(16).padStart(2, '0')).join('').toUpperCase()}`;
1362
- }
1363
- static kolonRenginiBul(kolonRenkleri, colIndex) {
1364
- const kolonRengi = kolonRenkleri?.[colIndex];
1365
- if (typeof kolonRengi === 'string') {
1366
- return kolonRengi;
1367
- }
1368
- const kolonNo = colIndex + 1;
1369
- for (const kolon of kolonRenkleri ?? []) {
1370
- if (typeof kolon === 'object' && kolon.columnNo === kolonNo) {
1371
- return kolon.color;
1372
- }
1373
- }
1374
- return undefined;
1375
- }
1376
- static excelFormuluneDonustur(formul) {
1377
- const ceviriler = {
1378
- 'TOPLA': 'SUM',
1379
- 'EĞER': 'IF',
1380
- 'VE': 'AND',
1381
- 'VEYA': 'OR',
1382
- 'YUVARLA': 'ROUND',
1383
- 'EĞERSAY': 'COUNTIF',
1384
- 'ETOPLA': 'SUMIF',
1385
- 'ORTALAMA': 'AVERAGE',
1386
- 'MİN': 'MIN',
1387
- 'MAK': 'MAX'
1388
- };
1389
- let sonuc = formul.slice(1).replaceAll(';', ',');
1390
- for (const [kaynak, hedef] of Object.entries(ceviriler)) {
1391
- const pattern = new RegExp(`\\b${kaynak}\\b`, 'g');
1392
- sonuc = sonuc.replace(pattern, hedef);
1393
- }
1394
- return sonuc;
1395
- }
1396
- static footerFormulunuOlustur(column, colIndex, startRow, startCol, veriSatirSayisi) {
1397
- if (!veriSatirSayisi) {
1398
- return undefined;
1399
- }
1400
- const fonksiyon = String(column.footer?.function ?? '').trim().toUpperCase();
1401
- if (!fonksiyon) {
1402
- return undefined;
1403
- }
1404
- const kolonHarf = worksheetColumnName(startCol + colIndex);
1405
- const ilkVeriSatiri = startRow + 1;
1406
- const sonVeriSatiri = startRow + veriSatirSayisi;
1407
- const aralik = `${kolonHarf}${ilkVeriSatiri}:${kolonHarf}${sonVeriSatiri}`;
1408
- if (fonksiyon === 'SUBTOTAL') {
1409
- return `SUBTOTAL(9,${aralik})`;
1410
- }
1411
- const desteklenenFonksiyonlar = ['SUM', 'AVERAGE', 'COUNT', 'COUNTA', 'MAX', 'MIN'];
1412
- if (desteklenenFonksiyonlar.includes(fonksiyon)) {
1413
- return `${fonksiyon}(${aralik})`;
1414
- }
1415
- return undefined;
1416
- }
1417
- static sayfaAdiDuzenle(sheetName, index) {
1418
- const temizAd = sheetName
1419
- .replaceAll(/[\\/*?:[\]]/g, ' ')
1420
- .trim()
1421
- .slice(0, 31);
1422
- if (temizAd) {
1423
- return temizAd;
1424
- }
1425
- return `Sheet${index}`;
1426
- }
1427
- static dosyaAdiDuzenle(dosyaAdi) {
1428
- const temizAd = dosyaAdi
1429
- .replaceAll(/[<>:"/\\|?*]/g, ' ')
1430
- .trim()
1431
- .replaceAll(/\s+/g, ' ');
1432
- if (temizAd) {
1433
- return temizAd;
1434
- }
1435
- return 'Rapor';
1436
- }
1437
- static numberFormatDonustur(format) {
1438
- switch (format) {
1439
- case NumberFormatlar.long:
1440
- case 2:
1441
- case 5:
1442
- case 11:
1443
- return '#,##0';
1444
- case NumberFormatlar.real:
1445
- case 7:
1446
- case 12:
1447
- return '#,##0.00';
1448
- case 8:
1449
- return 'hh:mm';
1450
- case NumberFormatlar.tarih:
1451
- return 'dd.mm.yyyy';
1452
- case NumberFormatlar.tarih_yyyymmdd_tireli:
1453
- return 'yyyy-mm-dd';
1454
- case NumberFormatlar.tarih_AAAAYYYY:
1455
- return 'mmmm yyyy';
1456
- case NumberFormatlar.tarih_GGAAAAYYYY:
1457
- return 'dd mmmm yyyy';
1458
- case NumberFormatlar.tarih_YYYYMMDD:
1459
- return 'yyyy/mm/dd';
1460
- case NumberFormatlar.tarih_LongDate:
1461
- return 'dd mmmm yyyy dddd';
1462
- case NumberFormatlar.tarih_ga:
1463
- return 'd.m;@';
1464
- case NumberFormatlar.tarih_ggaa:
1465
- return 'dd.mm';
1466
- case NumberFormatlar.tarih_gaaaa:
1467
- return 'd.mmmm';
1468
- case NumberFormatlar.tarih_ggaaa:
1469
- return 'dd.mmm';
1470
- case NumberFormatlar.tarih_ggaaaa:
1471
- return 'dd.mmmm';
1472
- case NumberFormatlar.yuzde_BirHane:
1473
- return '0.0%';
1474
- case NumberFormatlar.genel:
1475
- return 'General';
1476
- case NumberFormatlar.metin:
1477
- return '@';
1478
- case NumberFormatlar.imp:
1479
- return '#,##0 "imp"';
1480
- case NumberFormatlar.clicks:
1481
- return '#,##0 "Clicks"';
1482
- case NumberFormatlar.gun:
1483
- return '#,##0 "Gün"';
1484
- case NumberFormatlar.view:
1485
- return '#,##0 "View"';
1486
- case NumberFormatlar.session:
1487
- return '#,##0 "Session"';
1488
- case NumberFormatlar.kisi:
1489
- return '#,##0 "Kişi"';
1490
- case NumberFormatlar.okunma:
1491
- return '#,##0 "Okunma"';
1492
- case NumberFormatlar.dinlenme:
1493
- return '#,##0 "Dinlenme"';
1494
- case NumberFormatlar.lead:
1495
- return '#,##0 "Lead"';
1496
- case NumberFormatlar.gizli:
1497
- return ';;;';
1498
- case 28:
1499
- return '#,##0.00 "₺"';
1500
- default:
1501
- return undefined;
1502
- }
1503
- }
1504
- }
28
+ var ToplamFormuluHesaplayici = class ToplamFormuluHesaplayici {
29
+ constructor(formul) {
30
+ this.konum = 0;
31
+ this.tokenlar = ToplamFormuluHesaplayici.tokenlaraAyir(formul);
32
+ }
33
+ static hesapla(formul) {
34
+ try {
35
+ const hesaplayici = new ToplamFormuluHesaplayici(formul);
36
+ const sonuc = hesaplayici.ifade();
37
+ return hesaplayici.konum === hesaplayici.tokenlar.length && Number.isFinite(sonuc) ? sonuc : void 0;
38
+ } catch {
39
+ return;
40
+ }
41
+ }
42
+ static tokenlaraAyir(formul) {
43
+ const tokenlar = [];
44
+ TOKEN_DESENI.lastIndex = 0;
45
+ let eslesme = TOKEN_DESENI.exec(formul);
46
+ let okunan = 0;
47
+ while (eslesme) {
48
+ const deger = eslesme[1];
49
+ okunan = TOKEN_DESENI.lastIndex;
50
+ if (/^\d/.test(deger)) tokenlar.push({
51
+ deger,
52
+ tur: "sayi"
53
+ });
54
+ else if (/^[A-Za-z_]/.test(deger)) tokenlar.push({
55
+ deger: deger.toUpperCase(),
56
+ tur: "ad"
57
+ });
58
+ else tokenlar.push({
59
+ deger,
60
+ tur: "op"
61
+ });
62
+ eslesme = TOKEN_DESENI.exec(formul);
63
+ }
64
+ if (formul.slice(okunan).trim()) throw new Error("Geçersiz formül");
65
+ return tokenlar;
66
+ }
67
+ ifade() {
68
+ let sonuc = this.terim();
69
+ while (this.sonrakiOperatorMu("+", "-")) {
70
+ const islem = this.tokenlar[this.konum++].deger;
71
+ const sag = this.terim();
72
+ sonuc = islem === "+" ? sonuc + sag : sonuc - sag;
73
+ }
74
+ return sonuc;
75
+ }
76
+ terim() {
77
+ let sonuc = this.birim();
78
+ while (this.sonrakiOperatorMu("*", "/")) {
79
+ const islem = this.tokenlar[this.konum++].deger;
80
+ const sag = this.birim();
81
+ if (islem === "/" && sag === 0) throw new Error("Sıfıra bölme");
82
+ sonuc = islem === "*" ? sonuc * sag : sonuc / sag;
83
+ }
84
+ return sonuc;
85
+ }
86
+ birim() {
87
+ const token = this.tokenlar[this.konum++];
88
+ if (!token) throw new Error("Beklenmeyen son");
89
+ if (token.tur === "sayi") return Number(token.deger);
90
+ if (token.tur === "op" && token.deger === "-") return -this.birim();
91
+ if (token.tur === "op" && token.deger === "(") {
92
+ const sonuc = this.ifade();
93
+ this.operatorBekle(")");
94
+ return sonuc;
95
+ }
96
+ if (token.tur === "ad") return this.fonksiyon(token.deger);
97
+ throw new Error("Geçersiz token");
98
+ }
99
+ fonksiyon(ad) {
100
+ this.operatorBekle("(");
101
+ if (ad === "ABS") {
102
+ const sonuc = Math.abs(this.ifade());
103
+ this.operatorBekle(")");
104
+ return sonuc;
105
+ }
106
+ if (ad === "IFERROR") {
107
+ const baslangic = this.konum;
108
+ let sonuc;
109
+ try {
110
+ sonuc = this.ifade();
111
+ } catch {
112
+ this.konum = baslangic;
113
+ this.virguleKadarAtla();
114
+ }
115
+ this.operatorBekle(",");
116
+ const yedek = this.ifade();
117
+ this.operatorBekle(")");
118
+ return sonuc ?? yedek;
119
+ }
120
+ throw new Error(`Desteklenmeyen fonksiyon: ${ad}`);
121
+ }
122
+ virguleKadarAtla() {
123
+ let derinlik = 0;
124
+ while (this.konum < this.tokenlar.length) {
125
+ const { deger, tur } = this.tokenlar[this.konum];
126
+ if (tur === "op" && deger === "(") derinlik++;
127
+ else if (tur === "op" && deger === ")") derinlik--;
128
+ else if (tur === "op" && deger === "," && derinlik === 0) return;
129
+ this.konum++;
130
+ }
131
+ }
132
+ sonrakiOperatorMu(...operatorler) {
133
+ const token = this.tokenlar[this.konum];
134
+ return token?.tur === "op" && operatorler.includes(token.deger);
135
+ }
136
+ operatorBekle(operator) {
137
+ const token = this.tokenlar[this.konum++];
138
+ if (token?.tur !== "op" || token.deger !== operator) throw new Error(`Beklenen: ${operator}`);
139
+ }
140
+ };
141
+ var JsonToExcelTableBuilder = class {
142
+ constructor(table) {
143
+ this.table = table;
144
+ }
145
+ addColumn(column) {
146
+ this.table.columns.push({
147
+ arrayType: VariableType.text,
148
+ ...column
149
+ });
150
+ return this;
151
+ }
152
+ setRows(rows) {
153
+ this.table.collection = rows;
154
+ return this;
155
+ }
156
+ setStartColumn(sol) {
157
+ this.table.sol = sol;
158
+ return this;
159
+ }
160
+ setStartRow(ust) {
161
+ this.table.ust = ust;
162
+ return this;
163
+ }
164
+ getColumnSayisi() {
165
+ return this.table.columns.length;
166
+ }
167
+ addOutlineGroup(groupStart, groupEnd, collapsed = false) {
168
+ this.table.outlineGroups ??= [];
169
+ this.table.outlineGroups.push({
170
+ groupStart,
171
+ groupEnd,
172
+ collapsed
173
+ });
174
+ return this;
175
+ }
176
+ setOutlineSummaryPosition(position) {
177
+ this.table.outlineSummaryPosition = position;
178
+ return this;
179
+ }
180
+ };
181
+ var JsonToExcelSheetBuilder = class {
182
+ constructor(sheet) {
183
+ this.sheet = sheet;
184
+ }
185
+ addTable(rows, options = {}) {
186
+ const table = {
187
+ collection: rows,
188
+ columns: [],
189
+ ...options.autoFit !== void 0 && { autoFit: options.autoFit },
190
+ ...options.data && { data: options.data },
191
+ ...options.footer && { footer: options.footer },
192
+ ...options.header && { header: options.header },
193
+ ...options.sol !== void 0 && { sol: options.sol },
194
+ ...options.toplamEtiketi !== void 0 && { toplamEtiketi: options.toplamEtiketi },
195
+ ...options.toplamSatiri !== void 0 && { toplamSatiri: options.toplamSatiri },
196
+ ...options.ust !== void 0 && { ust: options.ust }
197
+ };
198
+ this.sheet.tables ??= [];
199
+ this.sheet.tables.push(table);
200
+ return new JsonToExcelTableBuilder(table);
201
+ }
202
+ addUstBilgi(ustBilgi, font) {
203
+ this.sheet.ustBilgiler ??= [];
204
+ this.sheet.ustBilgiler.push(JsonToExcelParser.ustBilgiEkle(ustBilgi, font));
205
+ return this;
206
+ }
207
+ getUstBilgiSayisi() {
208
+ return this.sheet.ustBilgiler?.length ?? 0;
209
+ }
210
+ getSheetNo() {
211
+ return this.sheet.sheetNo;
212
+ }
213
+ setSheetName(sheetName) {
214
+ this.sheet.sheetName = sheetName;
215
+ return this;
216
+ }
217
+ setZoom(zoom) {
218
+ this.sheet.zoom = zoom;
219
+ return this;
220
+ }
221
+ };
222
+ var JsonToExcelReportBuilder = class {
223
+ constructor() {
224
+ this.sonuc = new ExcelRaporuSonuc();
225
+ }
226
+ addSheet(sheetName, options = {}) {
227
+ const sheet = {
228
+ sheetName,
229
+ sheetNo: this.sonuc.sheets.length + 1,
230
+ ...options.pageSetup && { pageSetup: options.pageSetup },
231
+ ...options.zoom !== void 0 && { zoom: options.zoom }
232
+ };
233
+ this.sonuc.sheets.push(sheet);
234
+ return new JsonToExcelSheetBuilder(sheet);
235
+ }
236
+ build() {
237
+ return this.sonuc;
238
+ }
239
+ setAuthor(author) {
240
+ this.sonuc.book.author = author;
241
+ return this;
242
+ }
243
+ setCurrentTableStyle(currentTableStyle) {
244
+ this.sonuc.currentTableStyle = currentTableStyle;
245
+ return this;
246
+ }
247
+ setSubject(subject) {
248
+ this.sonuc.book.subject = subject;
249
+ return this;
250
+ }
251
+ };
252
+ var JsonToExcelParser = class {
253
+ static async indir(sonuc, dosyaAdi) {
254
+ const blob = await this.blobOlustur(sonuc);
255
+ const normalizeDosyaAdi = this.dosyaAdiDuzenle(dosyaAdi);
256
+ saveAs(blob, `${normalizeDosyaAdi}.xlsx`);
257
+ }
258
+ static async blobOlustur(sonuc) {
259
+ const workbook = this.workbookOlustur(sonuc);
260
+ const buffer = await workbook.xlsx.writeBuffer();
261
+ const toplamFormulluBuffer = await this.toplamSatiriFormulleriniYaz(workbook, buffer);
262
+ const duzeltilmisBuffer = await this.sheetOzellikSiralariniDuzelt(workbook, toplamFormulluBuffer);
263
+ return new Blob([duzeltilmisBuffer], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
264
+ }
265
+ static async toplamSatiriFormulleriniYaz(workbook, buffer) {
266
+ const tabloFormulleri = /* @__PURE__ */ new Map();
267
+ for (const worksheet of workbook.worksheets) for (const tablo of worksheet.getTables()) {
268
+ const formuller = /* @__PURE__ */ new Map();
269
+ for (const [index, kolon] of tablo.table.columns.entries()) if (kolon.totalsRowFunction === "custom" && kolon.totalsRowFormula) formuller.set(index + 1, kolon.totalsRowFormula);
270
+ if (formuller.size) tabloFormulleri.set(tablo.table.name, formuller);
271
+ }
272
+ if (!tabloFormulleri.size) return buffer;
273
+ const zip = await JSZip.loadAsync(buffer);
274
+ const tabloDosyalari = Object.keys(zip.files).filter((ad) => /^xl\/tables\/table\d+\.xml$/.test(ad));
275
+ await Promise.all(tabloDosyalari.map(async (dosyaAdi) => {
276
+ const xml = await zip.file(dosyaAdi).async("string");
277
+ const tabloAdi = /<table [^>]*?\bname="([^"]*)"/.exec(xml)?.[1];
278
+ const formuller = tabloAdi ? tabloFormulleri.get(tabloAdi) : void 0;
279
+ if (!formuller) return;
280
+ const yeniXml = xml.replaceAll(/<tableColumn id="(\d+)"([^>]*?) totalsRowFunction="custom"([^>]*?)\/>/g, (eslesme, id, once, sonra) => {
281
+ const formul = formuller.get(Number(id));
282
+ return formul ? `<tableColumn id="${id}"${once} totalsRowFunction="custom"${sonra}><totalsRowFormula>${this.xmlKacis(formul)}</totalsRowFormula></tableColumn>` : eslesme;
283
+ });
284
+ zip.file(dosyaAdi, yeniXml);
285
+ }));
286
+ return zip.generateAsync({ type: "arraybuffer" });
287
+ }
288
+ static async sheetOzellikSiralariniDuzelt(workbook, buffer) {
289
+ if (!workbook.worksheets.some((worksheet) => worksheet.properties.outlineProperties !== void 0)) return buffer;
290
+ const sheetPrSirasi = [
291
+ "tabColor",
292
+ "outlinePr",
293
+ "pageSetUpPr"
294
+ ];
295
+ const zip = await JSZip.loadAsync(buffer);
296
+ const sheetDosyalari = Object.keys(zip.files).filter((ad) => /^xl\/worksheets\/sheet\d+\.xml$/.test(ad));
297
+ await Promise.all(sheetDosyalari.map(async (dosyaAdi) => {
298
+ const xml = await zip.file(dosyaAdi).async("string");
299
+ const yeniXml = xml.replace(/<sheetPr>(.*?)<\/sheetPr>/s, (eslesme, icerik) => {
300
+ const cocuklar = icerik.match(/<(?:tabColor|outlinePr|pageSetUpPr)\b[^>]*\/>/g);
301
+ if (!cocuklar) return eslesme;
302
+ const sira = (cocuk) => sheetPrSirasi.indexOf(/^<(\w+)/.exec(cocuk)[1]);
303
+ return `<sheetPr>${[...cocuklar].sort((a, b) => sira(a) - sira(b)).join("")}</sheetPr>`;
304
+ });
305
+ if (yeniXml !== xml) zip.file(dosyaAdi, yeniXml);
306
+ }));
307
+ return zip.generateAsync({ type: "arraybuffer" });
308
+ }
309
+ static xmlKacis(metin) {
310
+ return metin.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
311
+ }
312
+ static standartPageSetupOlustur() {
313
+ return {
314
+ bottomMargin: 1,
315
+ centerHorizontally: true,
316
+ centerVertically: true,
317
+ fitToPagesTall: 1,
318
+ fitToPagesWide: 1,
319
+ leftMargin: 1,
320
+ orientation: 2,
321
+ rightMargin: 1,
322
+ topMargin: 1
323
+ };
324
+ }
325
+ static ustBilgiEkle(ustBilgi, font) {
326
+ return font ? {
327
+ font,
328
+ ustBilgi
329
+ } : { ustBilgi };
330
+ }
331
+ static raporOlustur() {
332
+ return new JsonToExcelReportBuilder();
333
+ }
334
+ static workbookOlustur(sonuc) {
335
+ const workbook = new Workbook();
336
+ workbook.created = /* @__PURE__ */ new Date();
337
+ workbook.calcProperties.fullCalcOnLoad = true;
338
+ const gridLinesGorunur = sonuc.window.displayGridLines;
339
+ if (this.yeniYapiMi(sonuc)) {
340
+ workbook.creator = sonuc.book.author || "MedPlan";
341
+ workbook.subject = "";
342
+ workbook.description = "";
343
+ this.yeniFormatSheetsYaz(workbook, sonuc, gridLinesGorunur);
344
+ } else {
345
+ workbook.creator = sonuc.book.author || "MedPlan";
346
+ workbook.subject = this.konuVer(sonuc.book, sonuc.ustBilgiler?.[0]?.ustBilgi);
347
+ workbook.description = sonuc.book.comments || "";
348
+ this.eskiFormatSheetsYaz(workbook, sonuc, gridLinesGorunur);
349
+ }
350
+ this.aktifSayfayiAyarla(workbook, sonuc.book.activeSheetNo, workbook.worksheets.length);
351
+ return workbook;
352
+ }
353
+ static yeniYapiMi(sonuc) {
354
+ const ilkSheet = sonuc.sheets[0];
355
+ if (Array.isArray(ilkSheet?.tables)) return true;
356
+ const runtimeSonuc = sonuc;
357
+ return !Array.isArray(runtimeSonuc.tables);
358
+ }
359
+ static yeniFormatSheetsYaz(workbook, sonuc, gridLinesGorunur) {
360
+ for (let index = 0; index < sonuc.sheets.length; index++) {
361
+ const sheet = sonuc.sheets[index];
362
+ const sheetAdi = this.sayfaAdiDuzenle(sheet.sheetName || "Rapor", index + 1);
363
+ const worksheet = workbook.addWorksheet(sheetAdi);
364
+ const zoomScale = sheet.zoom && sheet.zoom > 0 ? sheet.zoom : void 0;
365
+ worksheet.views = [{
366
+ showGridLines: gridLinesGorunur,
367
+ ...zoomScale !== void 0 && { zoomScale }
368
+ }];
369
+ this.sayfaDuzeniniBelirle(worksheet, sheet);
370
+ const ustBilgiler = sheet.ustBilgiler ?? [];
371
+ this.yeniFormatUstBilgileriYaz(worksheet, ustBilgiler, sonuc.defaultFont);
372
+ let sonSatir = ustBilgiler.length + 1;
373
+ for (const table of sheet.tables ?? []) sonSatir = Math.max(sonSatir, this.tabloyuYaz(worksheet, sonuc, table));
374
+ if (sheet.notlar?.length) this.notlariYazList(worksheet, sheet.notlar, sheet.not?.font, sonSatir + 2, sonuc.defaultFont);
375
+ }
376
+ if (sonuc.sheets.length === 0) {
377
+ const worksheet = workbook.addWorksheet("Rapor");
378
+ worksheet.views = [{ showGridLines: gridLinesGorunur }];
379
+ }
380
+ }
381
+ static eskiFormatSheetsYaz(workbook, sonuc, gridLinesGorunur) {
382
+ const tablesBySheet = this.sheetBazliTablolar(sonuc);
383
+ const ustBilgiler = sonuc.ustBilgiler ?? [];
384
+ const notlar = sonuc.notlar ?? [];
385
+ for (const sheetGrup of tablesBySheet) {
386
+ const worksheet = workbook.addWorksheet(sheetGrup.sheetName);
387
+ worksheet.views = [{ showGridLines: gridLinesGorunur }];
388
+ this.ustBilgileriYaz(worksheet, ustBilgiler, sonuc.defaultFont);
389
+ let sonSatir = 1;
390
+ for (const table of sheetGrup.tables) sonSatir = Math.max(sonSatir, this.tabloyuYaz(worksheet, sonuc, table));
391
+ this.notlariYazList(worksheet, notlar, sonuc.not?.font, sonSatir + 2, sonuc.defaultFont);
392
+ }
393
+ if (tablesBySheet.length === 0) {
394
+ const worksheet = workbook.addWorksheet(this.bosRaporSheetAdiniVer(sonuc));
395
+ worksheet.views = [{ showGridLines: gridLinesGorunur }];
396
+ this.ustBilgileriYaz(worksheet, ustBilgiler, sonuc.defaultFont);
397
+ this.notlariYazList(worksheet, notlar, sonuc.not?.font, ustBilgiler.length + 2, sonuc.defaultFont);
398
+ }
399
+ }
400
+ static sheetBazliTablolar(sonuc) {
401
+ const grouped = /* @__PURE__ */ new Map();
402
+ for (const table of sonuc.tables ?? []) {
403
+ const sheetNo = this.tableSheetNoVer(table);
404
+ const sheetKey = this.sheetKeyVer(table, sheetNo, grouped.size + 1);
405
+ const existing = grouped.get(sheetKey);
406
+ if (existing) {
407
+ existing.tables.push(table);
408
+ continue;
409
+ }
410
+ grouped.set(sheetKey, {
411
+ sheetName: this.sheetAdiniBelirle(sonuc, table, grouped.size + 1, sheetNo),
412
+ ...sheetNo !== void 0 && { sheetNo },
413
+ tables: [table]
414
+ });
415
+ }
416
+ return Array.from(grouped.values()).sort((a, b) => this.sheetGrupSirasiVer(a) - this.sheetGrupSirasiVer(b));
417
+ }
418
+ static tableSheetNoVer(table) {
419
+ return table.sheetNo;
420
+ }
421
+ static sheetKeyVer(table, sheetNo, index) {
422
+ if (sheetNo !== void 0) return `sheet-no-${sheetNo}`;
423
+ const eskiSheetName = table.sheetName?.trim();
424
+ if (eskiSheetName) return `sheet-name-${eskiSheetName}`;
425
+ return `sheet-index-${index}`;
426
+ }
427
+ static sheetAdiniBelirle(sonuc, table, index, sheetNo) {
428
+ const jsonSheet = this.jsonSheetBul(sonuc.sheets, sheetNo, index);
429
+ if (jsonSheet?.sheetName?.trim()) return this.sayfaAdiDuzenle(jsonSheet.sheetName, index);
430
+ return this.sayfaAdiDuzenle(table.sheetName || "Rapor", index);
431
+ }
432
+ static jsonSheetBul(sheets, sheetNo, index) {
433
+ if (sheetNo !== void 0) return sheets.find((sheet) => sheet.sheetNo === sheetNo);
434
+ return sheets.find((sheet) => sheet.sheetNo === index) ?? sheets[index - 1];
435
+ }
436
+ static konuVer(book, ilkUstBilgi) {
437
+ return book.subject || ilkUstBilgi || "Rapor";
438
+ }
439
+ static bosRaporSheetAdiniVer(sonuc) {
440
+ const ilkSheetAdi = sonuc.sheets[0]?.sheetName;
441
+ return this.sayfaAdiDuzenle(ilkSheetAdi || "Rapor", 1);
442
+ }
443
+ static aktifSayfayiAyarla(workbook, activeSheetNo, toplamSheetSayisi) {
444
+ const aktifTab = this.aktifTabNoVer(activeSheetNo, toplamSheetSayisi);
445
+ if (aktifTab === void 0) return;
446
+ workbook.views = [{
447
+ activeTab: aktifTab,
448
+ firstSheet: aktifTab,
449
+ height: 2e4,
450
+ visibility: "visible",
451
+ width: 2e4,
452
+ x: 0,
453
+ y: 0
454
+ }];
455
+ }
456
+ static aktifTabNoVer(activeSheetNo, toplamSheetSayisi) {
457
+ if (toplamSheetSayisi <= 0) return;
458
+ return Math.min((Number.isFinite(activeSheetNo) && activeSheetNo > 0 ? activeSheetNo : 1) - 1, toplamSheetSayisi - 1);
459
+ }
460
+ static sheetGrupSirasiVer(sheetGrup) {
461
+ return sheetGrup.sheetNo ?? Number.MAX_SAFE_INTEGER;
462
+ }
463
+ static yeniFormatUstBilgileriYaz(worksheet, ustBilgiler, defaultFont) {
464
+ for (let index = 0; index < ustBilgiler.length; index++) {
465
+ const ustBilgi = ustBilgiler[index];
466
+ const hucre = worksheet.getCell(index + 1, 1);
467
+ hucre.value = ustBilgi.ustBilgi;
468
+ this.hucreFontunuUygula(hucre, ustBilgi.font, defaultFont);
469
+ hucre.alignment = {
470
+ horizontal: "left",
471
+ vertical: "middle",
472
+ wrapText: false
473
+ };
474
+ }
475
+ }
476
+ static ustBilgileriYaz(worksheet, ustBilgiler, defaultFont) {
477
+ for (const ustBilgi of ustBilgiler) {
478
+ const hucre = worksheet.getCell(ustBilgi.rowNo ?? 1, 1);
479
+ hucre.value = ustBilgi.ustBilgi;
480
+ this.hucreFontunuUygula(hucre, ustBilgi.font, defaultFont);
481
+ hucre.alignment = {
482
+ horizontal: "left",
483
+ vertical: "middle",
484
+ wrapText: false
485
+ };
486
+ }
487
+ }
488
+ static notlariYazList(worksheet, notlar, notFont, baslangicSatiri, defaultFont) {
489
+ let satirNo = baslangicSatiri;
490
+ for (const not of notlar) {
491
+ const cell = worksheet.getCell(satirNo, 1);
492
+ cell.value = not;
493
+ this.hucreFontunuUygula(cell, notFont, defaultFont);
494
+ cell.alignment = {
495
+ vertical: "middle",
496
+ wrapText: true
497
+ };
498
+ satirNo++;
499
+ }
500
+ }
501
+ static sayfaDuzeniniBelirle(worksheet, sheet) {
502
+ const { pageSetup } = sheet;
503
+ if (!pageSetup) return;
504
+ if (pageSetup.orientation === 2) worksheet.pageSetup.orientation = "landscape";
505
+ else if (pageSetup.orientation === 1) worksheet.pageSetup.orientation = "portrait";
506
+ if (pageSetup.leftMargin !== void 0 || pageSetup.rightMargin !== void 0 || pageSetup.topMargin !== void 0 || pageSetup.bottomMargin !== void 0 || pageSetup.headerMargin !== void 0 || pageSetup.footerMargin !== void 0) worksheet.pageSetup.margins = {
507
+ left: pageSetup.leftMargin ?? .7,
508
+ right: pageSetup.rightMargin ?? .7,
509
+ top: pageSetup.topMargin ?? .75,
510
+ bottom: pageSetup.bottomMargin ?? .75,
511
+ header: pageSetup.headerMargin ?? .3,
512
+ footer: pageSetup.footerMargin ?? .3
513
+ };
514
+ if (pageSetup.centerHorizontally !== void 0) worksheet.pageSetup.horizontalCentered = pageSetup.centerHorizontally;
515
+ if (pageSetup.centerVertically !== void 0) worksheet.pageSetup.verticalCentered = pageSetup.centerVertically;
516
+ const fitTall = pageSetup.fitToPagesTall;
517
+ const fitWide = pageSetup.fitToPagesWide;
518
+ if (fitTall !== void 0 || fitWide !== void 0 || pageSetup.fitToPagesTAut || pageSetup.fitToPagesWAut) {
519
+ worksheet.pageSetup.fitToPage = true;
520
+ worksheet.pageSetup.fitToHeight = pageSetup.fitToPagesTAut ? 0 : fitTall ?? 1;
521
+ worksheet.pageSetup.fitToWidth = pageSetup.fitToPagesWAut ? 0 : fitWide ?? 1;
522
+ }
523
+ if (typeof pageSetup.zoom === "number" && pageSetup.zoom > 0) worksheet.pageSetup.scale = pageSetup.zoom;
524
+ if (pageSetup.printArea) worksheet.pageSetup.printArea = pageSetup.printArea;
525
+ const pageHeader = this.baslikAltbilgiMetniOlustur(pageSetup.leftHeader, pageSetup.centerHeader, pageSetup.rightHeader);
526
+ const pageFooter = this.baslikAltbilgiMetniOlustur(pageSetup.leftFooter, pageSetup.centerFooter, pageSetup.rightFooter);
527
+ if (pageHeader) worksheet.headerFooter.oddHeader = pageHeader;
528
+ if (pageFooter) worksheet.headerFooter.oddFooter = pageFooter;
529
+ }
530
+ static baslikAltbilgiMetniOlustur(sol, orta, sag) {
531
+ const parcalar = [];
532
+ if (sol) parcalar.push(`&L${sol}`);
533
+ if (orta) parcalar.push(`&C${orta}`);
534
+ if (sag) parcalar.push(`&R${sag}`);
535
+ return parcalar.length ? parcalar.join("") : void 0;
536
+ }
537
+ static tabloyuYaz(worksheet, sonuc, kaynakTable) {
538
+ const table = kaynakTable;
539
+ const toplamSatiriVar = table.toplamSatiri === true && table.collection.length > 0 && table.columns.length > 0;
540
+ if (!table.columns.length) return table.ust ?? 1;
541
+ const startRow = Math.max(1, table.ust ?? 1);
542
+ const startCol = Math.max(1, table.sol ?? 1);
543
+ const gecerliTableStyle = this.gecerliTableStyleVer(sonuc.currentTableStyle);
544
+ const gorunenBaslikMetinleri = table.columns.map((column) => this.baslikMetniniHazirla(column.header.title || "")).map((title) => title.replaceAll("\n", " "));
545
+ const tabloKolonAdlari = this.benzersizKolonAdlariOlustur(gorunenBaslikMetinleri);
546
+ const tabloAdi = this.tabloAdiOlustur(worksheet.name, startRow, startCol);
547
+ const headerFont = table.header?.font;
548
+ const uygulanacakHeaderFont = headerFont?.color ? headerFont : {
549
+ ...headerFont,
550
+ color: "FFFFFFFF"
551
+ };
552
+ const dataFont = table.data?.font;
553
+ const hiddenRowSet = new Set(table.hiddenRows ?? []);
554
+ const formulCeller = [];
555
+ const hucreFontRenkleri = [];
556
+ const satirlar = table.collection.map((rowData, rowIndex) => table.columns.map((column, colIndex) => {
557
+ const hazirHucre = this.hucreDegeriniHazirla(rowData, column, sonuc.sifirlariBasmaSayi);
558
+ hucreFontRenkleri[rowIndex] ??= [];
559
+ hucreFontRenkleri[rowIndex][colIndex] = hazirHucre.fontColorArgb;
560
+ if (hazirHucre.deger !== null && typeof hazirHucre.deger === "object" && "formula" in hazirHucre.deger) {
561
+ formulCeller.push({
562
+ rowIndex,
563
+ colIndex,
564
+ column,
565
+ formula: hazirHucre.deger
566
+ });
567
+ return "";
568
+ }
569
+ return hazirHucre.deger;
570
+ }));
571
+ const toplamHucreleri = toplamSatiriVar ? this.toplamHucreleriniHazirla(table) : [];
572
+ this.kolonGrubuYaz(worksheet, startRow, startCol, table);
573
+ const headerRow = worksheet.getRow(startRow);
574
+ const tableStyle = this.tableStyleDonustur(gecerliTableStyle);
575
+ const bosSatirEklendi = satirlar.length === 0;
576
+ const tabloSatirlari = bosSatirEklendi ? [table.columns.map(() => "")] : satirlar;
577
+ worksheet.addTable({
578
+ name: tabloAdi,
579
+ ref: worksheet.getCell(startRow, startCol).address,
580
+ headerRow: true,
581
+ totalsRow: toplamSatiriVar,
582
+ ...tableStyle && { style: tableStyle },
583
+ columns: tabloKolonAdlari.map((ad, index) => ({
584
+ name: ad,
585
+ filterButton: true,
586
+ ...toplamSatiriVar && this.toplamSatiriKolonuVer(toplamHucreleri[index]?.deger, index, this.toplamFonksiyonuVer(table.columns[index]), table.columns[index].toplamFormulu ? this.toplamFormuluExcelMetniVer(table, table.columns[index].toplamFormulu, tabloAdi, tabloKolonAdlari) : void 0)
587
+ })),
588
+ rows: tabloSatirlari
589
+ });
590
+ if (bosSatirEklendi) worksheet.getRow(startRow + 1).hidden = true;
591
+ this.kolonGenislikleriniUygula(worksheet, startCol, table.columns, satirlar, table.autoFit, toplamHucreleri.map((hucre) => hucre.deger));
592
+ this.kolonGruplariniUygula(worksheet, startCol, table);
593
+ for (let colIndex = 0; colIndex < table.columns.length; colIndex++) {
594
+ const column = table.columns[colIndex];
595
+ const cell = headerRow.getCell(startCol + colIndex);
596
+ cell.alignment = {
597
+ horizontal: this.yatayHizaDonustur(column.header.horizontalAlignment),
598
+ vertical: "bottom",
599
+ wrapText: false
600
+ };
601
+ this.hucreFontunuUygula(cell, uygulanacakHeaderFont, sonuc.defaultFont);
602
+ }
603
+ for (let rowIndex = 0; rowIndex < table.collection.length; rowIndex++) {
604
+ const wsRow = worksheet.getRow(startRow + 1 + rowIndex);
605
+ const satir1Bazli = rowIndex + 1;
606
+ if (hiddenRowSet.has(satir1Bazli)) wsRow.hidden = true;
607
+ const rowHeight = table.rowHeights?.find((rh) => rh.rowNo === satir1Bazli);
608
+ if (rowHeight?.height) wsRow.height = rowHeight.height;
609
+ for (let colIndex = 0; colIndex < table.columns.length; colIndex++) {
610
+ const column = table.columns[colIndex];
611
+ const cell = wsRow.getCell(startCol + colIndex);
612
+ const hucreDegeri = satirlar[rowIndex][colIndex];
613
+ cell.value = hucreDegeri;
614
+ this.hucreFontunuUygula(cell, dataFont, sonuc.defaultFont);
615
+ const hucreFontRengi = hucreFontRenkleri[rowIndex]?.[colIndex];
616
+ if (hucreFontRengi) cell.font = {
617
+ ...cell.font ?? {},
618
+ color: { argb: hucreFontRengi }
619
+ };
620
+ const numFmt = this.numberFormatDonustur(this.kolonFormatiniBelirle(column));
621
+ if (numFmt) cell.numFmt = numFmt;
622
+ else if (hucreDegeri instanceof Date) cell.numFmt = this.varsayilanTarihFormatiniVer();
623
+ const hucreHizasi = this.hucreYatayHizasiniBelirle(column);
624
+ cell.alignment = {
625
+ ...hucreHizasi !== void 0 && { horizontal: hucreHizasi },
626
+ vertical: this.dikeyHizaDonustur(column.verticalAlignment),
627
+ wrapText: false
628
+ };
629
+ const colFontColor = table.columnFontColors?.[colIndex];
630
+ if (colFontColor) {
631
+ const argb = this.argbDonustur(colFontColor);
632
+ if (argb) cell.font = {
633
+ ...cell.font ?? {},
634
+ color: { argb }
635
+ };
636
+ }
637
+ const colIntColor = this.kolonRenginiBul(table.columnInteriorColors, colIndex);
638
+ if (colIntColor) {
639
+ const argb = this.argbDonustur(colIntColor);
640
+ if (argb) cell.fill = {
641
+ type: "pattern",
642
+ pattern: "solid",
643
+ fgColor: { argb }
644
+ };
645
+ }
646
+ const rowFontColor = table.rowFontColors?.find((rc) => rc.rowNo === satir1Bazli);
647
+ if (rowFontColor) {
648
+ const argb = this.argbDonustur(rowFontColor.color);
649
+ if (argb) cell.font = {
650
+ ...cell.font ?? {},
651
+ color: { argb }
652
+ };
653
+ }
654
+ const rowIntColor = table.rowInteriorColors?.find((rc) => rc.rowNo === satir1Bazli);
655
+ if (rowIntColor) {
656
+ const argb = this.argbDonustur(rowIntColor.color);
657
+ if (argb) cell.fill = {
658
+ type: "pattern",
659
+ pattern: "solid",
660
+ fgColor: { argb }
661
+ };
662
+ }
663
+ }
664
+ }
665
+ for (const { rowIndex, colIndex, column, formula } of formulCeller) {
666
+ const cell = worksheet.getRow(startRow + 1 + rowIndex).getCell(startCol + colIndex);
667
+ cell.value = formula;
668
+ const formulHizasi = this.hucreYatayHizasiniBelirle(column);
669
+ cell.alignment = {
670
+ ...cell.alignment ?? {},
671
+ ...formulHizasi !== void 0 && { horizontal: formulHizasi }
672
+ };
673
+ }
674
+ let sonSatir = startRow + table.collection.length;
675
+ if (toplamSatiriVar) {
676
+ sonSatir++;
677
+ this.toplamSatiriniYaz(worksheet, sonuc, table, toplamHucreleri, sonSatir, startCol);
678
+ }
679
+ this.farkRenkleriniUygula(worksheet, table, startRow + 1, sonSatir, startCol);
680
+ const footer = table.footer;
681
+ if (footer?.basilacak) {
682
+ const ustBosluk = footer.ustBosluk ?? 0;
683
+ const satirSayisi = footer.satirSayisi ?? 1;
684
+ const footerBasSatir = sonSatir + 1 + ustBosluk;
685
+ for (let fi = 0; fi < satirSayisi; fi++) {
686
+ const footerRow = worksheet.getRow(footerBasSatir + fi);
687
+ for (let colIndex = 0; colIndex < table.columns.length; colIndex++) {
688
+ const column = table.columns[colIndex];
689
+ const cell = footerRow.getCell(startCol + colIndex);
690
+ this.hucreFontunuUygula(cell, footer.font, sonuc.defaultFont);
691
+ const colFooter = column.footer;
692
+ if (colFooter?.isFunction) {
693
+ const footerFormula = this.footerFormulunuOlustur(column, colIndex, startRow, startCol, table.collection.length);
694
+ if (footerFormula) {
695
+ cell.value = { formula: footerFormula };
696
+ const numFmt = this.numberFormatDonustur(this.kolonFormatiniBelirle(column));
697
+ if (numFmt) cell.numFmt = numFmt;
698
+ }
699
+ } else if (colFooter?.title) cell.value = colFooter.title;
700
+ const footerHizasi = colFooter?.isFunction ? this.hucreYatayHizasiniBelirle(column) : this.yatayHizaDonustur(colFooter?.horizontalAlignment);
701
+ cell.alignment = {
702
+ ...footerHizasi !== void 0 && { horizontal: footerHizasi },
703
+ vertical: "middle",
704
+ wrapText: false
705
+ };
706
+ }
707
+ }
708
+ sonSatir = footerBasSatir + satirSayisi - 1;
709
+ }
710
+ return sonSatir;
711
+ }
712
+ static farkRenkleriniUygula(worksheet, table, ilkSatir, sonSatir, startCol) {
713
+ if (!table.collection.length) return;
714
+ for (let colIndex = 0; colIndex < table.columns.length; colIndex++) {
715
+ if (!table.columns[colIndex].farkRenkli) continue;
716
+ const ilkHucre = worksheet.getCell(ilkSatir, startCol + colIndex).address;
717
+ const sonHucre = worksheet.getCell(sonSatir, startCol + colIndex).address;
718
+ worksheet.addConditionalFormatting({
719
+ ref: `${ilkHucre}:${sonHucre}`,
720
+ rules: [{
721
+ type: "cellIs",
722
+ operator: "greaterThan",
723
+ formulae: [0],
724
+ priority: 1,
725
+ style: { font: { color: { argb: "FF16A34A" } } }
726
+ }, {
727
+ type: "cellIs",
728
+ operator: "lessThan",
729
+ formulae: [0],
730
+ priority: 2,
731
+ style: { font: { color: { argb: "FFDC2626" } } }
732
+ }]
733
+ });
734
+ }
735
+ }
736
+ static toplamHucreleriniHazirla(table) {
737
+ return table.columns.map((column, colIndex) => {
738
+ if (colIndex === 0) return { deger: table.toplamEtiketi ?? "Toplam" };
739
+ if (column.toplamFormulu) return { deger: this.toplamFormuluSonucuVer(table, column.toplamFormulu) ?? null };
740
+ const fonksiyon = this.toplamFonksiyonuVer(column);
741
+ if (!fonksiyon) return { deger: null };
742
+ const { adet, toplam } = this.kolonToplaminiVer(table, column.property);
743
+ if (fonksiyon === "average") return { deger: adet ? toplam / adet : 0 };
744
+ return { deger: toplam };
745
+ });
746
+ }
747
+ static kolonToplaminiVer(table, property) {
748
+ let toplam = 0;
749
+ let adet = 0;
750
+ for (const row of table.collection) {
751
+ const hamDeger = row[property];
752
+ const sayi = Number(hamDeger);
753
+ if (hamDeger !== null && hamDeger !== void 0 && hamDeger !== "" && Number.isFinite(sayi)) {
754
+ toplam += sayi;
755
+ adet++;
756
+ }
757
+ }
758
+ return {
759
+ adet,
760
+ toplam
761
+ };
762
+ }
763
+ static toplamFormulundekiKolonlariVer(table, formul) {
764
+ const properties = [...formul.matchAll(/\{([^{}]+)\}/g)].map((eslesme) => eslesme[1]);
765
+ const tumKolonlarVar = properties.every((property) => table.columns.some((kolon) => kolon.property === property));
766
+ return properties.length && tumKolonlarVar ? properties : void 0;
767
+ }
768
+ static toplamFormuluSonucuVer(table, formul) {
769
+ if (!this.toplamFormulundekiKolonlariVer(table, formul)) return;
770
+ const sayisalFormul = formul.replaceAll(/\{([^{}]+)\}/g, (_eslesme, property) => {
771
+ const { toplam } = this.kolonToplaminiVer(table, property);
772
+ return toplam < 0 ? `(${toplam})` : String(toplam);
773
+ });
774
+ return ToplamFormuluHesaplayici.hesapla(sayisalFormul);
775
+ }
776
+ static toplamFormuluExcelMetniVer(table, formul, tabloAdi, kolonAdlari) {
777
+ if (!this.toplamFormulundekiKolonlariVer(table, formul)) return;
778
+ return formul.replaceAll(/\{([^{}]+)\}/g, (_eslesme, property) => {
779
+ return `SUBTOTAL(109,${tabloAdi}[${kolonAdlari[table.columns.findIndex((kolon) => kolon.property === property)].replaceAll(/[[\]#']/g, "'$&")}])`;
780
+ });
781
+ }
782
+ static toplamFonksiyonuVer(column) {
783
+ if (column.toplamFonksiyonu === "none" || column.toplamFormulu) return;
784
+ return column.toplamFonksiyonu ?? (this.sayisalKolonMu(column.arrayType) ? "sum" : void 0);
785
+ }
786
+ static toplamSatiriKolonuVer(deger, kolonIndex, fonksiyon, excelFormulu) {
787
+ if (kolonIndex === 0) return { totalsRowLabel: typeof deger === "string" ? deger : "" };
788
+ if (excelFormulu) return {
789
+ totalsRowFormula: excelFormulu,
790
+ totalsRowFunction: "custom",
791
+ ...typeof deger === "number" && { totalsRowResult: deger }
792
+ };
793
+ return fonksiyon ? { totalsRowFunction: fonksiyon } : void 0;
794
+ }
795
+ static toplamSatiriniYaz(worksheet, sonuc, table, toplamHucreleri, satirNo, startCol) {
796
+ const wsRow = worksheet.getRow(satirNo);
797
+ for (let colIndex = 0; colIndex < table.columns.length; colIndex++) {
798
+ const column = table.columns[colIndex];
799
+ const cell = wsRow.getCell(startCol + colIndex);
800
+ const deger = toplamHucreleri[colIndex]?.deger;
801
+ if (colIndex > 0 && typeof deger === "number" && typeof cell.value === "object" && cell.value !== null && "formula" in cell.value) cell.value = {
802
+ ...cell.value,
803
+ result: deger
804
+ };
805
+ this.hucreFontunuUygula(cell, table.data?.font, sonuc.defaultFont);
806
+ cell.font = {
807
+ ...cell.font ?? {},
808
+ bold: true
809
+ };
810
+ if (column.farkRenkli && typeof deger === "number" && deger !== 0) cell.font = {
811
+ ...cell.font,
812
+ color: { argb: deger > 0 ? "FF16A34A" : "FFDC2626" }
813
+ };
814
+ cell.fill = {
815
+ type: "pattern",
816
+ pattern: "solid",
817
+ fgColor: { argb: "FFDDEBF7" }
818
+ };
819
+ const numFmt = this.numberFormatDonustur(this.kolonFormatiniBelirle(column));
820
+ if (numFmt) cell.numFmt = numFmt;
821
+ const hucreHizasi = this.hucreYatayHizasiniBelirle(column);
822
+ cell.alignment = {
823
+ ...hucreHizasi !== void 0 && { horizontal: hucreHizasi },
824
+ vertical: this.dikeyHizaDonustur(column.verticalAlignment),
825
+ wrapText: false
826
+ };
827
+ }
828
+ }
829
+ static kolonGenislikleriniUygula(worksheet, startCol, columns, satirlar, autoFit, ekSatir) {
830
+ const filtreButonuBoslukPayi = 1.25;
831
+ const veriSagBoslukPayi = 1;
832
+ const autoFitAktif = autoFit !== false;
833
+ for (let index = 0; index < columns.length; index++) {
834
+ const worksheetColumn = worksheet.getColumn(startCol + index);
835
+ const tasarimGenisligi = (columns[index].width ?? 0) > 0 ? Math.round(columns[index].width / 7) : 0;
836
+ if (!autoFitAktif) {
837
+ worksheetColumn.width = tasarimGenisligi > 0 ? tasarimGenisligi : 10;
838
+ continue;
839
+ }
840
+ const baslikUzunlugu = this.metinUzunlugu(this.baslikMetniniHazirla(columns[index].header.title));
841
+ let veriUzunlugu = ekSatir ? this.hucreMetinUzunlugu(ekSatir[index]) : 0;
842
+ for (const satir of satirlar) veriUzunlugu = Math.max(veriUzunlugu, this.hucreMetinUzunlugu(satir[index]));
843
+ worksheetColumn.width = Math.max(10, tasarimGenisligi, baslikUzunlugu + 2 + filtreButonuBoslukPayi, veriUzunlugu + 2 + veriSagBoslukPayi);
844
+ }
845
+ }
846
+ static baslikMetniniHazirla(metin) {
847
+ return metin.replaceAll("\r\n", " ").replaceAll("\r", " ").replaceAll("\n", " ").trim();
848
+ }
849
+ static hucreMetinUzunlugu(deger) {
850
+ if (deger === null || deger === void 0) return 0;
851
+ if (typeof deger === "string") return this.metinUzunlugu(deger);
852
+ if (typeof deger === "number" || typeof deger === "boolean") return String(deger).length;
853
+ if (deger instanceof Date) return 19;
854
+ if (typeof deger === "object" && "formula" in deger) return this.metinUzunlugu(String(deger.formula));
855
+ return this.metinUzunlugu(String(deger));
856
+ }
857
+ static hucreYatayHizasiniBelirle(column) {
858
+ if (this.sayisalKolonMu(column.arrayType)) return "right";
859
+ if (this.booleanKolonMu(column.arrayType)) return "center";
860
+ if (column.horizontalAlignment === void 0) return;
861
+ return this.yatayHizaDonustur(column.horizontalAlignment);
862
+ }
863
+ static kolonFormatiniBelirle(column) {
864
+ if (column.format !== void 0 && column.format !== NumberFormatlar.belirsiz) return column.format;
865
+ switch (column.arrayType) {
866
+ case VariableType.integer:
867
+ case VariableType.longint: return NumberFormatlar.long;
868
+ case VariableType.real: return NumberFormatlar.real;
869
+ case VariableType.date: return NumberFormatlar.tarih;
870
+ default: return column.format;
871
+ }
872
+ }
873
+ static sayisalKolonMu(arrayType) {
874
+ switch (arrayType) {
875
+ case VariableType.integer:
876
+ case VariableType.longint:
877
+ case VariableType.real: return true;
878
+ default: return false;
879
+ }
880
+ }
881
+ static booleanKolonMu(arrayType) {
882
+ return arrayType === VariableType.boolean;
883
+ }
884
+ static metinUzunlugu(metin) {
885
+ return metin.replaceAll("\r", "").split("\n").reduce((max, parca) => Math.max(max, parca.trim().length), 0);
886
+ }
887
+ static kolonGruplariniUygula(worksheet, startCol, table) {
888
+ const gruplar = this.gecerliKolonGruplariniVer(table);
889
+ if (!gruplar.length) return;
890
+ const kolonSayisi = table.columns.length;
891
+ const ozetSolda = table.outlineSummaryPosition === "left";
892
+ const seviyeler = new Array(kolonSayisi).fill(0);
893
+ const gizliler = new Array(kolonSayisi).fill(false);
894
+ const kapaliOzetler = /* @__PURE__ */ new Set();
895
+ for (const grup of gruplar) {
896
+ for (let index = grup.baslangic; index <= grup.bitis; index++) {
897
+ seviyeler[index] = Math.min(seviyeler[index] + 1, this.enYuksekKolonGrupSeviyesi);
898
+ if (grup.kapali) gizliler[index] = true;
899
+ }
900
+ const ozetIndex = ozetSolda ? grup.baslangic - 1 : grup.bitis + 1;
901
+ if (grup.kapali && ozetIndex >= 0 && ozetIndex < kolonSayisi) kapaliOzetler.add(ozetIndex);
902
+ }
903
+ worksheet.properties.outlineLevelCol = Math.max(worksheet.properties.outlineLevelCol ?? 0, ...seviyeler);
904
+ worksheet.properties.outlineProperties = {
905
+ summaryBelow: true,
906
+ summaryRight: !ozetSolda
907
+ };
908
+ for (let index = 0; index < kolonSayisi; index++) {
909
+ const worksheetColumn = worksheet.getColumn(startCol + index);
910
+ worksheetColumn.outlineLevel = seviyeler[index];
911
+ if (gizliler[index]) worksheetColumn.hidden = true;
912
+ Object.defineProperty(worksheetColumn, "collapsed", {
913
+ value: kapaliOzetler.has(index),
914
+ configurable: true
915
+ });
916
+ Object.defineProperty(worksheetColumn, "equivalentTo", {
917
+ value: () => false,
918
+ configurable: true
919
+ });
920
+ }
921
+ }
922
+ static {
923
+ this.enYuksekKolonGrupSeviyesi = 7;
924
+ }
925
+ static gecerliKolonGruplariniVer(table) {
926
+ const adaylar = (table.outlineGroups ?? []).map((grup) => ({
927
+ baslangic: table.columns.findIndex((column) => column.property === grup.groupStart),
928
+ bitis: table.columns.findIndex((column) => column.property === grup.groupEnd),
929
+ kapali: grup.collapsed === true
930
+ })).filter((grup) => grup.baslangic >= 0 && grup.bitis >= grup.baslangic).sort((a, b) => a.baslangic - b.baslangic || b.bitis - a.bitis);
931
+ const kabulEdilenler = [];
932
+ for (const aday of adaylar) if (!kabulEdilenler.some((grup) => aday.baslangic <= grup.bitis && aday.bitis > grup.bitis)) kabulEdilenler.push(aday);
933
+ return kabulEdilenler;
934
+ }
935
+ static kolonGrubuYaz(worksheet, startRow, startCol, table) {
936
+ const columnGroups = table.columnGroup;
937
+ if (!columnGroups?.length || startRow <= 1) return;
938
+ const grupSatiri = startRow - 1;
939
+ for (const columnGroup of columnGroups) {
940
+ const baslangicIndex = table.columns.findIndex((column) => column.property === columnGroup.groupStart);
941
+ const bitisIndex = table.columns.findIndex((column) => column.property === columnGroup.groupEnd);
942
+ const baslangicKolonu = baslangicIndex >= 0 ? startCol + baslangicIndex : void 0;
943
+ const bitisKolonu = bitisIndex >= 0 ? startCol + bitisIndex : void 0;
944
+ if (!baslangicKolonu || !bitisKolonu || bitisKolonu < baslangicKolonu) continue;
945
+ worksheet.mergeCells(grupSatiri, baslangicKolonu, grupSatiri, bitisKolonu);
946
+ const grupHucre = worksheet.getCell(grupSatiri, baslangicKolonu);
947
+ grupHucre.value = columnGroup.groupName;
948
+ grupHucre.alignment = {
949
+ horizontal: "center",
950
+ vertical: "middle"
951
+ };
952
+ grupHucre.font = {
953
+ bold: true,
954
+ size: 11,
955
+ color: { argb: "FFF79646" }
956
+ };
957
+ grupHucre.fill = {
958
+ type: "pattern",
959
+ pattern: "solid",
960
+ fgColor: { argb: "FFFFFFFF" }
961
+ };
962
+ for (let col = baslangicKolonu; col <= bitisKolonu; col++) {
963
+ const hucre = worksheet.getCell(grupSatiri, col);
964
+ hucre.border = {
965
+ ...hucre.border,
966
+ top: {
967
+ style: "medium",
968
+ color: { argb: "FFF79646" }
969
+ },
970
+ ...col === baslangicKolonu ? { left: {
971
+ style: "medium",
972
+ color: { argb: "FFF79646" }
973
+ } } : hucre.border?.left ? { left: hucre.border.left } : {},
974
+ ...col === bitisKolonu ? { right: {
975
+ style: "medium",
976
+ color: { argb: "FFF79646" }
977
+ } } : hucre.border?.right ? { right: hucre.border.right } : {}
978
+ };
979
+ }
980
+ }
981
+ }
982
+ static hucreDegeriniHazirla(row, column, sifirlariBasmaSayi) {
983
+ const value = row[column.property];
984
+ if (typeof value === "string" && value.startsWith("=")) return { deger: { formula: this.excelFormuluneDonustur(value) } };
985
+ if ((typeof value === "number" && value === 0 || typeof value === "string" && this.sayisalKolonMu(column.arrayType) && value.trim() !== "" && Number(value) === 0) && sifirlariBasmaSayi) return { deger: null };
986
+ if (value === null || value === void 0) return { deger: "" };
987
+ const htmlHucre = column.htmlKoduGelebilir === true && typeof value === "string" ? this.htmlHucreIceriginiHazirla(value) : void 0;
988
+ const normallesenDeger = htmlHucre?.deger ?? value;
989
+ if (typeof normallesenDeger === "string" && normallesenDeger.startsWith("=")) return this.hazirHucreDegeriOlustur({ formula: this.excelFormuluneDonustur(normallesenDeger) }, htmlHucre?.fontColorArgb);
990
+ if (typeof value === "string" && typeof normallesenDeger === "string") {
991
+ const tarihMetni = this.tarihStringiniExcelMetnineDonustur(normallesenDeger, column);
992
+ if (tarihMetni) return this.hazirHucreDegeriOlustur(tarihMetni, htmlHucre?.fontColorArgb);
993
+ const tarihDegeri = this.tarihStringiniDateeDonustur(normallesenDeger);
994
+ if (tarihDegeri) return this.hazirHucreDegeriOlustur(tarihDegeri, htmlHucre?.fontColorArgb);
995
+ }
996
+ if (normallesenDeger instanceof Date) return this.hazirHucreDegeriOlustur(this.excelIcinTarihiNormalizeEt(normallesenDeger), htmlHucre?.fontColorArgb);
997
+ if (this.booleanKolonMu(column.arrayType)) return this.hazirHucreDegeriOlustur(normallesenDeger === true ? "+" : "", htmlHucre?.fontColorArgb);
998
+ if (typeof normallesenDeger === "number" || typeof normallesenDeger === "string") return this.hazirHucreDegeriOlustur(normallesenDeger, htmlHucre?.fontColorArgb);
999
+ return this.hazirHucreDegeriOlustur(String(normallesenDeger), htmlHucre?.fontColorArgb);
1000
+ }
1001
+ static hazirHucreDegeriOlustur(deger, fontColorArgb) {
1002
+ return {
1003
+ deger,
1004
+ ...fontColorArgb ? { fontColorArgb } : {}
1005
+ };
1006
+ }
1007
+ static htmlHucreIceriginiHazirla(value) {
1008
+ if (!/[<>]/.test(value)) return;
1009
+ const deger = value.replaceAll(/<br\s*\/?>/gi, "\n").replaceAll(/<\/p\s*>/gi, "\n").replaceAll(/<p\b[^>]*>/gi, "").replaceAll(/<\/div\s*>/gi, "\n").replaceAll(/<div\b[^>]*>/gi, "").replaceAll(/<[^>]+>/g, "").replaceAll(/&nbsp;/gi, " ").trim();
1010
+ const colorValue = this.htmlFontRenginiBul(value);
1011
+ const fontColorArgb = this.argbDonustur(colorValue);
1012
+ if (deger === value && !fontColorArgb) return;
1013
+ return {
1014
+ deger,
1015
+ ...fontColorArgb && { fontColorArgb }
1016
+ };
1017
+ }
1018
+ static htmlFontRenginiBul(value) {
1019
+ const fontColorMatch = /<font\b[^>]*\bcolor\s*=\s*["']?([^"' >]+)["']?[^>]*>/i.exec(value);
1020
+ if (fontColorMatch?.[1]) return fontColorMatch[1].trim();
1021
+ const styleColorMatch = /<(?:font|span)\b[^>]*\bstyle\s*=\s*["'][^"']*\bcolor\s*:\s*([^;"']+)/i.exec(value);
1022
+ if (styleColorMatch?.[1]) return styleColorMatch[1].trim();
1023
+ }
1024
+ static tarihStringiniDateeDonustur(value) {
1025
+ const trimmedValue = value.trim();
1026
+ const isoDateMatch = /^(\d{4})-(\d{2})-(\d{2})(?:$|[T\s])/.exec(trimmedValue);
1027
+ if (!isoDateMatch) return;
1028
+ const year = Number(isoDateMatch[1]);
1029
+ const month = Number(isoDateMatch[2]);
1030
+ const day = Number(isoDateMatch[3]);
1031
+ if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)) return;
1032
+ const date = new Date(year, month - 1, day);
1033
+ if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) return;
1034
+ return new Date(Date.UTC(year, month - 1, day, 12, 0, 0, 0));
1035
+ }
1036
+ static tarihStringiniExcelMetnineDonustur(value, column) {
1037
+ if (!this.sadeceTarihKolonuMu(column)) return;
1038
+ const trimmedValue = value.trim();
1039
+ const isoDateMatch = /^(\d{4})-(\d{2})-(\d{2})$/.exec(trimmedValue);
1040
+ if (!isoDateMatch) return;
1041
+ const year = Number(isoDateMatch[1]);
1042
+ const month = Number(isoDateMatch[2]);
1043
+ const day = Number(isoDateMatch[3]);
1044
+ if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)) return;
1045
+ const date = new Date(year, month - 1, day);
1046
+ if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) return;
1047
+ return `${String(day).padStart(2, "0")}.${String(month).padStart(2, "0")}.${year}`;
1048
+ }
1049
+ static excelIcinTarihiNormalizeEt(value) {
1050
+ if (value.getHours() !== 0 || value.getMinutes() !== 0 || value.getSeconds() !== 0 || value.getMilliseconds() !== 0) return value;
1051
+ return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), 12, 0, 0, 0));
1052
+ }
1053
+ static varsayilanTarihFormatiniVer() {
1054
+ return "dd.mm.yyyy";
1055
+ }
1056
+ static sadeceTarihKolonuMu(column) {
1057
+ return this.kolonFormatiniBelirle(column) === NumberFormatlar.tarih;
1058
+ }
1059
+ static benzersizKolonAdlariOlustur(adlar) {
1060
+ const sayaclar = /* @__PURE__ */ new Map();
1061
+ return adlar.map((ad) => {
1062
+ const temelAd = ad || " ";
1063
+ const sayi = sayaclar.get(temelAd) ?? 0;
1064
+ sayaclar.set(temelAd, sayi + 1);
1065
+ return sayi === 0 ? temelAd : `${temelAd}_${sayi}`;
1066
+ });
1067
+ }
1068
+ static hucreFontunuUygula(cell, font, defaultFont) {
1069
+ const style = font?.style ?? 0;
1070
+ const excelFont = {};
1071
+ const fontName = font?.name || defaultFont?.name;
1072
+ if (fontName) excelFont.name = fontName;
1073
+ const fontSize = font?.size && font.size > 0 ? font.size : defaultFont?.size;
1074
+ if (fontSize && fontSize > 0) excelFont.size = fontSize;
1075
+ if (font?.color) {
1076
+ const color = this.argbDonustur(font.color);
1077
+ if (color) excelFont.color = { argb: color };
1078
+ }
1079
+ excelFont.bold = Boolean(style & FontStyle.bold);
1080
+ excelFont.italic = Boolean(style & FontStyle.italic);
1081
+ excelFont.underline = Boolean(style & FontStyle.underline);
1082
+ cell.font = excelFont;
1083
+ }
1084
+ static gecerliTableStyleVer(tableStyle) {
1085
+ if (!tableStyle) return;
1086
+ const style = tableStyle.trim();
1087
+ if (/^TableStyleLight([1-9]|1\d|2[0-1])$/.test(style)) return style;
1088
+ if (/^TableStyleMedium([1-9]|1\d|2[0-1])$/.test(style)) return style;
1089
+ if (/^TableStyleDark([1-9]|10|11)$/.test(style)) return style;
1090
+ }
1091
+ static tableStyleDonustur(theme) {
1092
+ if (!theme) return;
1093
+ return {
1094
+ theme,
1095
+ showRowStripes: true
1096
+ };
1097
+ }
1098
+ static tabloAdiOlustur(sheetName, startRow, startCol) {
1099
+ return `T_${sheetName.replaceAll(/[^A-Za-z0-9]/g, "_")}_R${startRow}C${startCol}`;
1100
+ }
1101
+ static yatayHizaDonustur(value) {
1102
+ switch (value) {
1103
+ case XLHAlign.xlHAlignCenter: return "center";
1104
+ case XLHAlign.xlHAlignCenterAcrossSelection: return "centerContinuous";
1105
+ case XLHAlign.xlHAlignDistributed: return "distributed";
1106
+ case XLHAlign.xlHAlignFill: return "fill";
1107
+ case XLHAlign.xlHAlignGeneral: return "left";
1108
+ case XLHAlign.xlHAlignJustify: return "justify";
1109
+ case XLHAlign.xlHAlignLeft: return "left";
1110
+ case XLHAlign.xlHAlignRight: return "right";
1111
+ default: return "left";
1112
+ }
1113
+ }
1114
+ static dikeyHizaDonustur(value) {
1115
+ switch (value) {
1116
+ case XLVAlign.xlVAlignTop: return "top";
1117
+ case XLVAlign.xlVAlignBottom: return "bottom";
1118
+ case XLVAlign.xlVAlignDistributed: return "distributed";
1119
+ case XLVAlign.xlVAlignJustify: return "justify";
1120
+ default: return "middle";
1121
+ }
1122
+ }
1123
+ static argbDonustur(color) {
1124
+ if (!color) return;
1125
+ const cssColor = color.trim().toLowerCase();
1126
+ const rgbMatch = cssColor.match(/^rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);
1127
+ if (rgbMatch) {
1128
+ const rgbDegerleri = rgbMatch.slice(1).map((value) => Number(value));
1129
+ if (rgbDegerleri.every((value) => Number.isInteger(value) && value >= 0 && value <= 255)) return `FF${rgbDegerleri.map((value) => value.toString(16).padStart(2, "0")).join("").toUpperCase()}`;
1130
+ }
1131
+ const namedColors = {
1132
+ black: "FF000000",
1133
+ blue: "FF0000FF",
1134
+ cyan: "FF00FFFF",
1135
+ gray: "FF808080",
1136
+ green: "FF008000",
1137
+ grey: "FF808080",
1138
+ magenta: "FFFF00FF",
1139
+ orange: "FFFFA500",
1140
+ purple: "FF800080",
1141
+ red: "FFFF0000",
1142
+ white: "FFFFFFFF",
1143
+ yellow: "FFFFFF00"
1144
+ };
1145
+ if (namedColors[cssColor]) return namedColors[cssColor];
1146
+ const hexColor = cssColor.replace("#", "");
1147
+ if (/^[0-9a-f]{6}$/i.test(hexColor)) return `FF${hexColor.toUpperCase()}`;
1148
+ if (/^[0-9A-Fa-f]{8}$/.test(color)) return color.toUpperCase();
1149
+ const numericColor = Number(color);
1150
+ if (!Number.isFinite(numericColor)) return;
1151
+ return `FF${[
1152
+ numericColor & 255,
1153
+ numericColor >> 8 & 255,
1154
+ numericColor >> 16 & 255
1155
+ ].map((value) => value.toString(16).padStart(2, "0")).join("").toUpperCase()}`;
1156
+ }
1157
+ static kolonRenginiBul(kolonRenkleri, colIndex) {
1158
+ const kolonRengi = kolonRenkleri?.[colIndex];
1159
+ if (typeof kolonRengi === "string") return kolonRengi;
1160
+ const kolonNo = colIndex + 1;
1161
+ for (const kolon of kolonRenkleri ?? []) if (typeof kolon === "object" && kolon.columnNo === kolonNo) return kolon.color;
1162
+ }
1163
+ static excelFormuluneDonustur(formul) {
1164
+ const ceviriler = {
1165
+ "TOPLA": "SUM",
1166
+ "EĞER": "IF",
1167
+ "VE": "AND",
1168
+ "VEYA": "OR",
1169
+ "YUVARLA": "ROUND",
1170
+ "EĞERSAY": "COUNTIF",
1171
+ "ETOPLA": "SUMIF",
1172
+ "ORTALAMA": "AVERAGE",
1173
+ "MİN": "MIN",
1174
+ "MAK": "MAX"
1175
+ };
1176
+ let sonuc = formul.slice(1).replaceAll(";", ",");
1177
+ for (const [kaynak, hedef] of Object.entries(ceviriler)) {
1178
+ const pattern = new RegExp(`\\b${kaynak}\\b`, "g");
1179
+ sonuc = sonuc.replace(pattern, hedef);
1180
+ }
1181
+ return sonuc;
1182
+ }
1183
+ static footerFormulunuOlustur(column, colIndex, startRow, startCol, veriSatirSayisi) {
1184
+ if (!veriSatirSayisi) return;
1185
+ const fonksiyon = String(column.footer?.function ?? "").trim().toUpperCase();
1186
+ if (!fonksiyon) return;
1187
+ const kolonHarf = worksheetColumnName(startCol + colIndex);
1188
+ const aralik = `${kolonHarf}${startRow + 1}:${kolonHarf}${startRow + veriSatirSayisi}`;
1189
+ if (fonksiyon === "SUBTOTAL") return `SUBTOTAL(9,${aralik})`;
1190
+ if ([
1191
+ "SUM",
1192
+ "AVERAGE",
1193
+ "COUNT",
1194
+ "COUNTA",
1195
+ "MAX",
1196
+ "MIN"
1197
+ ].includes(fonksiyon)) return `${fonksiyon}(${aralik})`;
1198
+ }
1199
+ static sayfaAdiDuzenle(sheetName, index) {
1200
+ const temizAd = sheetName.replaceAll(/[\\/*?:[\]]/g, " ").trim().slice(0, 31);
1201
+ if (temizAd) return temizAd;
1202
+ return `Sheet${index}`;
1203
+ }
1204
+ static dosyaAdiDuzenle(dosyaAdi) {
1205
+ const temizAd = dosyaAdi.replaceAll(/[<>:"/\\|?*]/g, " ").trim().replaceAll(/\s+/g, " ");
1206
+ if (temizAd) return temizAd;
1207
+ return "Rapor";
1208
+ }
1209
+ static numberFormatDonustur(format) {
1210
+ switch (format) {
1211
+ case NumberFormatlar.long:
1212
+ case 2:
1213
+ case 5:
1214
+ case 11: return "#,##0";
1215
+ case NumberFormatlar.real:
1216
+ case 7:
1217
+ case 12: return "#,##0.00";
1218
+ case 8: return "hh:mm";
1219
+ case NumberFormatlar.tarih: return "dd.mm.yyyy";
1220
+ case NumberFormatlar.tarih_yyyymmdd_tireli: return "yyyy-mm-dd";
1221
+ case NumberFormatlar.tarih_AAAAYYYY: return "mmmm yyyy";
1222
+ case NumberFormatlar.tarih_GGAAAAYYYY: return "dd mmmm yyyy";
1223
+ case NumberFormatlar.tarih_YYYYMMDD: return "yyyy/mm/dd";
1224
+ case NumberFormatlar.tarih_LongDate: return "dd mmmm yyyy dddd";
1225
+ case NumberFormatlar.tarih_ga: return "d.m;@";
1226
+ case NumberFormatlar.tarih_ggaa: return "dd.mm";
1227
+ case NumberFormatlar.tarih_gaaaa: return "d.mmmm";
1228
+ case NumberFormatlar.tarih_ggaaa: return "dd.mmm";
1229
+ case NumberFormatlar.tarih_ggaaaa: return "dd.mmmm";
1230
+ case NumberFormatlar.yuzde_BirHane: return "0.0%";
1231
+ case NumberFormatlar.genel: return "General";
1232
+ case NumberFormatlar.metin: return "@";
1233
+ case NumberFormatlar.imp: return "#,##0 \"imp\"";
1234
+ case NumberFormatlar.clicks: return "#,##0 \"Clicks\"";
1235
+ case NumberFormatlar.gun: return "#,##0 \"Gün\"";
1236
+ case NumberFormatlar.view: return "#,##0 \"View\"";
1237
+ case NumberFormatlar.session: return "#,##0 \"Session\"";
1238
+ case NumberFormatlar.kisi: return "#,##0 \"Kişi\"";
1239
+ case NumberFormatlar.okunma: return "#,##0 \"Okunma\"";
1240
+ case NumberFormatlar.dinlenme: return "#,##0 \"Dinlenme\"";
1241
+ case NumberFormatlar.lead: return "#,##0 \"Lead\"";
1242
+ case NumberFormatlar.gizli: return ";;;";
1243
+ case 28: return "#,##0.00 \"₺\"";
1244
+ default: return;
1245
+ }
1246
+ }
1247
+ };
1505
1248
  function worksheetColumnName(columnNumber) {
1506
- let kalan = columnNumber;
1507
- let sonuc = '';
1508
- while (kalan > 0) {
1509
- const mod = (kalan - 1) % 26;
1510
- sonuc = String.fromCharCode(65 + mod) + sonuc;
1511
- kalan = Math.floor((kalan - 1) / 26);
1512
- }
1513
- return sonuc;
1514
- }
1515
-
1516
- class BlobResponseHandlerService {
1517
- constructor() {
1518
- this.translateService = inject(TranslateService);
1519
- }
1520
- handleReportResponse(response, successDetailKey, htmlTitle = 'Rapor Sonucu') {
1521
- const body = response.body;
1522
- if (!body) {
1523
- return null;
1524
- }
1525
- const contentDisposition = response.headers.get('content-disposition');
1526
- const contentType = response.headers.get('Content-Type') ?? body.type;
1527
- if (contentDisposition) {
1528
- return this.handleDownload(body, contentDisposition, contentType, successDetailKey);
1529
- }
1530
- this.handleViewHtml(body, htmlTitle);
1531
- return null;
1532
- }
1533
- downloadResponse(response) {
1534
- const body = response.body;
1535
- if (!body) {
1536
- return false;
1537
- }
1538
- const contentDisposition = response.headers.get('content-disposition');
1539
- if (!contentDisposition) {
1540
- return false;
1541
- }
1542
- const contentType = response.headers.get('Content-Type') ?? (body instanceof Blob ? body.type : 'application/octet-stream');
1543
- this.downloadBlob(body, contentDisposition, contentType);
1544
- return true;
1545
- }
1546
- viewHtmlBody(body, htmlTitle = 'Rapor Sonucu') {
1547
- if (!body) {
1548
- return;
1549
- }
1550
- this.handleViewHtml(body, htmlTitle);
1551
- }
1552
- async handleJsonExcelResponse(body, options) {
1553
- if (!body) {
1554
- return null;
1555
- }
1556
- try {
1557
- const jsonStr = await body.text();
1558
- const result = Object.assign(options.createResult(), JSON.parse(jsonStr));
1559
- const fileName = options.getFileName?.(result) ?? options.fileName;
1560
- if (!fileName) {
1561
- return null;
1562
- }
1563
- await JsonToExcelParser.indir(result, fileName);
1564
- return {
1565
- severity: 'success',
1566
- summary: this.translateService.instant('genel.bilgi'),
1567
- detail: options.successDetail ?? this.translateService.instant(options.successDetailKey ?? '')
1568
- };
1569
- }
1570
- catch (error) {
1571
- console.error(options.errorLogMessage, error);
1572
- return null;
1573
- }
1574
- }
1575
- handleDownload(body, contentDisposition, contentType, successDetailKey) {
1576
- this.downloadBlob(body, contentDisposition, contentType);
1577
- return {
1578
- severity: 'success',
1579
- summary: this.translateService.instant('genel.bilgi'),
1580
- detail: this.translateService.instant(successDetailKey)
1581
- };
1582
- }
1583
- downloadBlob(body, contentDisposition, contentType) {
1584
- const decodedContentDisposition = contentDisposition.replaceAll(/\\u([0-9A-Fa-f]{4})/g, (_, code) => String.fromCodePoint(Number.parseInt(code, 16)));
1585
- const filename = GlobalFunctions.getFilenameFromContentDisposition(decodedContentDisposition);
1586
- const blob = new Blob([body], { type: contentType });
1587
- saveAs(blob, filename);
1588
- }
1589
- handleViewHtml(body, htmlTitle) {
1590
- body.text().then((html) => {
1591
- const wnd = window.open('', '_blank');
1592
- if (!wnd) {
1593
- return;
1594
- }
1595
- wnd.document.title = htmlTitle;
1596
- const iframe = wnd.document.createElement('iframe');
1597
- iframe.style.width = '100%';
1598
- iframe.style.height = '100%';
1599
- iframe.style.border = 'none';
1600
- iframe.setAttribute('srcdoc', html);
1601
- wnd.document.body.style.margin = '0';
1602
- wnd.document.body.style.padding = '0';
1603
- wnd.document.body.appendChild(iframe);
1604
- });
1605
- }
1606
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: BlobResponseHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1607
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: BlobResponseHandlerService, providedIn: 'root' }); }
1249
+ let kalan = columnNumber;
1250
+ let sonuc = "";
1251
+ while (kalan > 0) {
1252
+ const mod = (kalan - 1) % 26;
1253
+ sonuc = String.fromCharCode(65 + mod) + sonuc;
1254
+ kalan = Math.floor((kalan - 1) / 26);
1255
+ }
1256
+ return sonuc;
1608
1257
  }
1609
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: BlobResponseHandlerService, decorators: [{
1610
- type: Injectable,
1611
- args: [{ providedIn: 'root' }]
1612
- }] });
1613
-
1614
- /**
1615
- * Generated bundle index. Do not edit.
1616
- */
1617
-
1258
+ var BlobResponseHandlerService = class BlobResponseHandlerService {
1259
+ constructor() {
1260
+ this.translateService = inject(TranslateService);
1261
+ }
1262
+ handleReportResponse(response, successDetailKey, htmlTitle = "Rapor Sonucu") {
1263
+ const body = response.body;
1264
+ if (!body) return null;
1265
+ const contentDisposition = response.headers.get("content-disposition");
1266
+ const contentType = response.headers.get("Content-Type") ?? body.type;
1267
+ if (contentDisposition) return this.handleDownload(body, contentDisposition, contentType, successDetailKey);
1268
+ this.handleViewHtml(body, htmlTitle);
1269
+ return null;
1270
+ }
1271
+ downloadResponse(response) {
1272
+ const body = response.body;
1273
+ if (!body) return false;
1274
+ const contentDisposition = response.headers.get("content-disposition");
1275
+ if (!contentDisposition) return false;
1276
+ const contentType = response.headers.get("Content-Type") ?? (body instanceof Blob ? body.type : "application/octet-stream");
1277
+ this.downloadBlob(body, contentDisposition, contentType);
1278
+ return true;
1279
+ }
1280
+ viewHtmlBody(body, htmlTitle = "Rapor Sonucu") {
1281
+ if (!body) return;
1282
+ this.handleViewHtml(body, htmlTitle);
1283
+ }
1284
+ async handleJsonExcelResponse(body, options) {
1285
+ if (!body) return null;
1286
+ try {
1287
+ const jsonStr = await body.text();
1288
+ const result = Object.assign(options.createResult(), JSON.parse(jsonStr));
1289
+ const fileName = options.getFileName?.(result) ?? options.fileName;
1290
+ if (!fileName) return null;
1291
+ await JsonToExcelParser.indir(result, fileName);
1292
+ return {
1293
+ severity: "success",
1294
+ summary: this.translateService.instant("genel.bilgi"),
1295
+ detail: options.successDetail ?? this.translateService.instant(options.successDetailKey ?? "")
1296
+ };
1297
+ } catch (error) {
1298
+ console.error(options.errorLogMessage, error);
1299
+ return null;
1300
+ }
1301
+ }
1302
+ handleDownload(body, contentDisposition, contentType, successDetailKey) {
1303
+ this.downloadBlob(body, contentDisposition, contentType);
1304
+ return {
1305
+ severity: "success",
1306
+ summary: this.translateService.instant("genel.bilgi"),
1307
+ detail: this.translateService.instant(successDetailKey)
1308
+ };
1309
+ }
1310
+ downloadBlob(body, contentDisposition, contentType) {
1311
+ const decodedContentDisposition = contentDisposition.replaceAll(/\\u([0-9A-Fa-f]{4})/g, (_, code) => String.fromCodePoint(Number.parseInt(code, 16)));
1312
+ const filename = GlobalFunctions.getFilenameFromContentDisposition(decodedContentDisposition);
1313
+ const blob = new Blob([body], { type: contentType });
1314
+ saveAs(blob, filename);
1315
+ }
1316
+ handleViewHtml(body, htmlTitle) {
1317
+ body.text().then((html) => {
1318
+ const wnd = window.open("", "_blank");
1319
+ if (!wnd) return;
1320
+ wnd.document.title = htmlTitle;
1321
+ const iframe = wnd.document.createElement("iframe");
1322
+ iframe.style.width = "100%";
1323
+ iframe.style.height = "100%";
1324
+ iframe.style.border = "none";
1325
+ iframe.setAttribute("srcdoc", html);
1326
+ wnd.document.body.style.margin = "0";
1327
+ wnd.document.body.style.padding = "0";
1328
+ wnd.document.body.appendChild(iframe);
1329
+ });
1330
+ }
1331
+ static {
1332
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1333
+ minVersion: "12.0.0",
1334
+ version: "22.2.3",
1335
+ ngImport: i0,
1336
+ type: BlobResponseHandlerService,
1337
+ deps: [],
1338
+ target: i0.ɵɵFactoryTarget.Injectable
1339
+ });
1340
+ }
1341
+ static {
1342
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
1343
+ minVersion: "12.0.0",
1344
+ version: "22.2.3",
1345
+ ngImport: i0,
1346
+ type: BlobResponseHandlerService,
1347
+ providedIn: "root"
1348
+ });
1349
+ }
1350
+ };
1351
+ i0.ɵɵngDeclareClassMetadata({
1352
+ minVersion: "12.0.0",
1353
+ version: "22.2.3",
1354
+ ngImport: i0,
1355
+ type: BlobResponseHandlerService,
1356
+ decorators: [{
1357
+ type: Injectable,
1358
+ args: [{ providedIn: "root" }]
1359
+ }]
1360
+ });
1618
1361
  export { BlobResponseHandlerService, ExcelRaporuSonuc, JsonToExcelParser, JsonToExcelReportBuilder, JsonToExcelSheetBuilder, JsonToExcelTableBuilder };
1619
- //# sourceMappingURL=limitng-blob-response-handler.mjs.map
1362
+
1363
+ //# sourceMappingURL=limitng-blob-response-handler.mjs.map