@acorex/core 16.0.2 → 17.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (311) hide show
  1. package/common/README.md +3 -0
  2. package/common/countries/countries.data.d.ts +2 -0
  3. package/common/countries/country.d.ts +13 -0
  4. package/common/index.d.ts +2 -0
  5. package/config/README.md +3 -0
  6. package/config/index.d.ts +2 -0
  7. package/config/lib/configs.d.ts +6 -0
  8. package/config/lib/configs.service.d.ts +12 -0
  9. package/date-time/README.md +3 -0
  10. package/date-time/index.d.ts +10 -0
  11. package/date-time/lib/calendar.service.d.ts +27 -0
  12. package/date-time/lib/dateTime.config.d.ts +12 -0
  13. package/date-time/lib/datetime.class.d.ts +138 -0
  14. package/date-time/lib/datetime.module.d.ts +8 -0
  15. package/date-time/lib/datetime.pipe.d.ts +12 -0
  16. package/date-time/lib/formatters/datetime-formatter.d.ts +19 -0
  17. package/date-time/lib/formatters/timeleft-formatter.d.ts +16 -0
  18. package/date-time/lib/georgian.calendar.d.ts +21 -0
  19. package/date-time/lib/holidays.loader.d.ts +21 -0
  20. package/date-time/lib/jalali.calendar.d.ts +40 -0
  21. package/esm2022/common/acorex-core-common.mjs +5 -0
  22. package/esm2022/common/countries/countries.data.mjs +2625 -0
  23. package/esm2022/common/countries/country.mjs +2 -0
  24. package/esm2022/common/index.mjs +3 -0
  25. package/esm2022/config/acorex-core-config.mjs +5 -0
  26. package/esm2022/config/index.mjs +3 -0
  27. package/esm2022/config/lib/configs.mjs +7 -0
  28. package/esm2022/config/lib/configs.service.mjs +27 -0
  29. package/esm2022/date-time/acorex-core-date-time.mjs +5 -0
  30. package/esm2022/date-time/index.mjs +11 -0
  31. package/esm2022/date-time/lib/calendar.service.mjs +100 -0
  32. package/esm2022/date-time/lib/dateTime.config.mjs +50 -0
  33. package/esm2022/date-time/lib/datetime.class.mjs +337 -0
  34. package/esm2022/date-time/lib/datetime.module.mjs +27 -0
  35. package/esm2022/date-time/lib/datetime.pipe.mjs +29 -0
  36. package/esm2022/date-time/lib/formatters/datetime-formatter.mjs +32 -0
  37. package/esm2022/date-time/lib/formatters/timeleft-formatter.mjs +91 -0
  38. package/esm2022/date-time/lib/georgian.calendar.mjs +203 -0
  39. package/esm2022/date-time/lib/holidays.loader.mjs +13 -0
  40. package/esm2022/date-time/lib/jalali.calendar.mjs +440 -0
  41. package/esm2022/events/acorex-core-events.mjs +5 -0
  42. package/esm2022/events/index.mjs +3 -0
  43. package/esm2022/events/lib/event.service.mjs +43 -0
  44. package/esm2022/events/lib/event.type.mjs +6 -0
  45. package/esm2022/file/acorex-core-file.mjs +5 -0
  46. package/esm2022/file/index.mjs +7 -0
  47. package/esm2022/file/lib/file-download-ref.class.mjs +12 -0
  48. package/esm2022/file/lib/file-download-result.class.mjs +45 -0
  49. package/esm2022/file/lib/file-size-formatter.mjs +24 -0
  50. package/esm2022/file/lib/file-upload-ref.class.mjs +12 -0
  51. package/esm2022/file/lib/file.module.mjs +20 -0
  52. package/esm2022/file/lib/file.service.mjs +103 -0
  53. package/esm2022/format/acorex-core-format.mjs +5 -0
  54. package/esm2022/format/index.mjs +8 -0
  55. package/esm2022/format/lib/format.config.mjs +3 -0
  56. package/esm2022/format/lib/format.module.mjs +64 -0
  57. package/esm2022/format/lib/format.pipe.mjs +37 -0
  58. package/esm2022/format/lib/format.service.mjs +95 -0
  59. package/esm2022/format/lib/format.types.mjs +2 -0
  60. package/esm2022/format/lib/formatters/number-formatter.mjs +74 -0
  61. package/esm2022/format/lib/formatters/string-formatter.mjs +15 -0
  62. package/esm2022/image/acorex-core-image.mjs +5 -0
  63. package/esm2022/image/index.mjs +2 -0
  64. package/esm2022/image/lib/image.service.mjs +43 -0
  65. package/esm2022/index.mjs +2 -44
  66. package/esm2022/memorize/acorex-core-memorize.mjs +5 -0
  67. package/esm2022/memorize/index.mjs +2 -0
  68. package/esm2022/memorize/lib/memorize.decorator.mjs +19 -0
  69. package/esm2022/pipes/acorex-core-pipes.mjs +5 -0
  70. package/esm2022/pipes/index.mjs +2 -0
  71. package/esm2022/pipes/lib/safe/safe.pipe.mjs +38 -0
  72. package/esm2022/platform/acorex-core-platform.mjs +5 -0
  73. package/esm2022/platform/index.mjs +2 -0
  74. package/esm2022/platform/lib/platform.service.mjs +225 -0
  75. package/esm2022/storage/acorex-core-storage.mjs +5 -0
  76. package/esm2022/storage/cookie-storage.service.mjs +202 -0
  77. package/esm2022/storage/index.mjs +5 -0
  78. package/esm2022/storage/local-storage.service.mjs +58 -0
  79. package/esm2022/storage/session-storage.service.mjs +22 -0
  80. package/esm2022/storage/storage.interface.mjs +2 -0
  81. package/esm2022/translation/acorex-core-translation.mjs +5 -0
  82. package/esm2022/translation/index.mjs +9 -0
  83. package/esm2022/translation/lib/translation-scope.resolver.mjs +11 -0
  84. package/esm2022/translation/lib/translation.config.mjs +20 -0
  85. package/esm2022/translation/lib/translation.loader.mjs +14 -0
  86. package/esm2022/translation/lib/translation.module.mjs +40 -0
  87. package/esm2022/translation/lib/translation.service.mjs +173 -0
  88. package/esm2022/translation/lib/translation.types.mjs +2 -0
  89. package/esm2022/translation/lib/translator.directive.mjs +28 -0
  90. package/esm2022/translation/lib/translator.pipe.mjs +23 -0
  91. package/esm2022/types/acorex-core-types.mjs +5 -0
  92. package/esm2022/types/index.mjs +2 -0
  93. package/esm2022/utils/acorex-core-utils.mjs +5 -0
  94. package/esm2022/utils/index.mjs +6 -0
  95. package/esm2022/utils/lib/auto-unsubscribe.mjs +36 -0
  96. package/esm2022/utils/lib/color-util.mjs +111 -0
  97. package/esm2022/utils/lib/drawing-util.mjs +35 -0
  98. package/esm2022/utils/lib/html-util.mjs +39 -0
  99. package/esm2022/utils/lib/string-util.mjs +19 -0
  100. package/esm2022/validation/acorex-core-validation.mjs +5 -0
  101. package/esm2022/validation/index.mjs +18 -0
  102. package/esm2022/validation/lib/rules/between-rule.mjs +31 -0
  103. package/esm2022/validation/lib/rules/callback-rule.mjs +29 -0
  104. package/esm2022/validation/lib/rules/equal-rule.mjs +26 -0
  105. package/esm2022/validation/lib/rules/greater-than.mjs +29 -0
  106. package/esm2022/validation/lib/rules/length-rule.mjs +26 -0
  107. package/esm2022/validation/lib/rules/less-than-rule.mjs +29 -0
  108. package/esm2022/validation/lib/rules/maxlength-rule.mjs +27 -0
  109. package/esm2022/validation/lib/rules/minlength-rule.mjs +26 -0
  110. package/esm2022/validation/lib/rules/regex-rule.mjs +49 -0
  111. package/esm2022/validation/lib/rules/required-rule.mjs +36 -0
  112. package/esm2022/validation/lib/validation.config.mjs +33 -0
  113. package/esm2022/validation/lib/validation.module.mjs +84 -0
  114. package/esm2022/validation/lib/validation.service.mjs +98 -0
  115. package/esm2022/validation/lib/validation.types.mjs +3 -0
  116. package/events/README.md +3 -0
  117. package/events/index.d.ts +2 -0
  118. package/{lib/services → events/lib}/event.service.d.ts +8 -0
  119. package/events/lib/event.type.d.ts +5 -0
  120. package/fesm2022/acorex-core-common.mjs +2631 -0
  121. package/fesm2022/acorex-core-common.mjs.map +1 -0
  122. package/fesm2022/acorex-core-config.mjs +39 -0
  123. package/fesm2022/acorex-core-config.mjs.map +1 -0
  124. package/fesm2022/acorex-core-date-time.mjs +1305 -0
  125. package/fesm2022/acorex-core-date-time.mjs.map +1 -0
  126. package/fesm2022/acorex-core-events.mjs +56 -0
  127. package/fesm2022/acorex-core-events.mjs.map +1 -0
  128. package/fesm2022/acorex-core-file.mjs +214 -0
  129. package/fesm2022/acorex-core-file.mjs.map +1 -0
  130. package/fesm2022/acorex-core-format.mjs +282 -0
  131. package/fesm2022/acorex-core-format.mjs.map +1 -0
  132. package/fesm2022/acorex-core-image.mjs +50 -0
  133. package/fesm2022/acorex-core-image.mjs.map +1 -0
  134. package/fesm2022/acorex-core-memorize.mjs +26 -0
  135. package/fesm2022/acorex-core-memorize.mjs.map +1 -0
  136. package/fesm2022/acorex-core-pipes.mjs +44 -0
  137. package/fesm2022/acorex-core-pipes.mjs.map +1 -0
  138. package/fesm2022/acorex-core-platform.mjs +232 -0
  139. package/fesm2022/acorex-core-platform.mjs.map +1 -0
  140. package/fesm2022/acorex-core-storage.mjs +285 -0
  141. package/fesm2022/acorex-core-storage.mjs.map +1 -0
  142. package/fesm2022/acorex-core-translation.mjs +293 -0
  143. package/fesm2022/acorex-core-translation.mjs.map +1 -0
  144. package/fesm2022/acorex-core-types.mjs +6 -0
  145. package/fesm2022/acorex-core-types.mjs.map +1 -0
  146. package/fesm2022/acorex-core-utils.mjs +247 -0
  147. package/fesm2022/acorex-core-utils.mjs.map +1 -0
  148. package/fesm2022/acorex-core-validation.mjs +488 -0
  149. package/fesm2022/acorex-core-validation.mjs.map +1 -0
  150. package/fesm2022/acorex-core.mjs +2 -2309
  151. package/fesm2022/acorex-core.mjs.map +1 -1
  152. package/file/README.md +3 -0
  153. package/file/index.d.ts +6 -0
  154. package/file/lib/file-download-ref.class.d.ts +6 -0
  155. package/file/lib/file-download-result.class.d.ts +8 -0
  156. package/file/lib/file-size-formatter.d.ts +16 -0
  157. package/file/lib/file-upload-ref.class.d.ts +5 -0
  158. package/file/lib/file.module.d.ts +7 -0
  159. package/file/lib/file.service.d.ts +18 -0
  160. package/format/README.md +3 -0
  161. package/format/index.d.ts +7 -0
  162. package/format/lib/format.config.d.ts +5 -0
  163. package/format/lib/format.module.d.ts +18 -0
  164. package/format/lib/format.pipe.d.ts +12 -0
  165. package/format/lib/format.service.d.ts +43 -0
  166. package/format/lib/format.types.d.ts +4 -0
  167. package/format/lib/formatters/number-formatter.d.ts +23 -0
  168. package/format/lib/formatters/string-formatter.d.ts +14 -0
  169. package/image/README.md +3 -0
  170. package/image/index.d.ts +1 -0
  171. package/image/lib/image.service.d.ts +11 -0
  172. package/index.d.ts +1 -43
  173. package/memorize/README.md +3 -0
  174. package/memorize/index.d.ts +1 -0
  175. package/memorize/lib/memorize.decorator.d.ts +1 -0
  176. package/package.json +98 -5
  177. package/pipes/README.md +3 -0
  178. package/pipes/index.d.ts +1 -0
  179. package/pipes/lib/safe/safe.pipe.d.ts +10 -0
  180. package/platform/README.md +3 -0
  181. package/platform/index.d.ts +1 -0
  182. package/{lib/platform → platform/lib}/platform.service.d.ts +14 -6
  183. package/storage/README.md +3 -0
  184. package/storage/cookie-storage.service.d.ts +104 -0
  185. package/storage/index.d.ts +4 -0
  186. package/storage/local-storage.service.d.ts +16 -0
  187. package/storage/session-storage.service.d.ts +10 -0
  188. package/storage/storage.interface.d.ts +14 -0
  189. package/translation/README.md +3 -0
  190. package/translation/index.d.ts +8 -0
  191. package/translation/lib/translation-scope.resolver.d.ts +2 -0
  192. package/translation/lib/translation.config.d.ts +14 -0
  193. package/translation/lib/translation.loader.d.ts +14 -0
  194. package/translation/lib/translation.module.d.ts +8 -0
  195. package/translation/lib/translation.service.d.ts +31 -0
  196. package/translation/lib/translation.types.d.ts +10 -0
  197. package/translation/lib/translator.directive.d.ts +12 -0
  198. package/translation/lib/translator.pipe.d.ts +12 -0
  199. package/types/README.md +3 -0
  200. package/types/index.d.ts +2 -0
  201. package/utils/README.md +3 -0
  202. package/utils/index.d.ts +5 -0
  203. package/utils/lib/auto-unsubscribe.d.ts +12 -0
  204. package/utils/lib/color-util.d.ts +24 -0
  205. package/utils/lib/drawing-util.d.ts +18 -0
  206. package/utils/lib/html-util.d.ts +5 -0
  207. package/utils/lib/string-util.d.ts +6 -0
  208. package/validation/README.md +3 -0
  209. package/validation/index.d.ts +14 -0
  210. package/validation/lib/rules/between-rule.d.ts +18 -0
  211. package/validation/lib/rules/callback-rule.d.ts +23 -0
  212. package/validation/lib/rules/equal-rule.d.ts +17 -0
  213. package/validation/lib/rules/greater-than.d.ts +17 -0
  214. package/validation/lib/rules/length-rule.d.ts +17 -0
  215. package/validation/lib/rules/less-than-rule.d.ts +17 -0
  216. package/validation/lib/rules/maxlength-rule.d.ts +16 -0
  217. package/validation/lib/rules/minlength-rule.d.ts +16 -0
  218. package/validation/lib/rules/regex-rule.d.ts +17 -0
  219. package/validation/lib/rules/required-rule.d.ts +16 -0
  220. package/validation/lib/validation.config.d.ts +15 -0
  221. package/validation/lib/validation.module.d.ts +17 -0
  222. package/validation/lib/validation.service.d.ts +35 -0
  223. package/validation/lib/validation.types.d.ts +21 -0
  224. package/esm2022/lib/classes/base-page.class.mjs +0 -26
  225. package/esm2022/lib/classes/color.class.mjs +0 -49
  226. package/esm2022/lib/classes/datetime.class.mjs +0 -323
  227. package/esm2022/lib/classes/menu.class.mjs +0 -35
  228. package/esm2022/lib/classes/navigator.class.mjs +0 -2
  229. package/esm2022/lib/classes/popup.class.mjs +0 -2
  230. package/esm2022/lib/classes/promise.class.mjs +0 -21
  231. package/esm2022/lib/classes/sectionlist.class.mjs +0 -2
  232. package/esm2022/lib/classes/select.class.mjs +0 -8
  233. package/esm2022/lib/core.module.mjs +0 -27
  234. package/esm2022/lib/error/error.class.mjs +0 -2
  235. package/esm2022/lib/error/error.module.mjs +0 -19
  236. package/esm2022/lib/error/error.service.mjs +0 -22
  237. package/esm2022/lib/events/keyboard.mjs +0 -2
  238. package/esm2022/lib/http/http-error.class.mjs +0 -2
  239. package/esm2022/lib/http/http-events.interceptor.mjs +0 -3
  240. package/esm2022/lib/http/http-request.class.mjs +0 -2
  241. package/esm2022/lib/http/http-result.class.mjs +0 -25
  242. package/esm2022/lib/http/http.module.mjs +0 -35
  243. package/esm2022/lib/http/http.service.mjs +0 -148
  244. package/esm2022/lib/locale/en.json +0 -255
  245. package/esm2022/lib/locale/fa.json +0 -245
  246. package/esm2022/lib/pipe/datetime.pipe.mjs +0 -25
  247. package/esm2022/lib/pipe/htmlToText.pipe.mjs +0 -25
  248. package/esm2022/lib/platform/index.mjs +0 -2
  249. package/esm2022/lib/platform/platform.service.mjs +0 -152
  250. package/esm2022/lib/services/config.mjs +0 -29
  251. package/esm2022/lib/services/event.service.mjs +0 -34
  252. package/esm2022/lib/services/navigator.service.mjs +0 -10
  253. package/esm2022/lib/services/storage.service.mjs +0 -16
  254. package/esm2022/lib/translator/translator.mjs +0 -26
  255. package/esm2022/lib/translator/translator.module.mjs +0 -25
  256. package/esm2022/lib/translator/translator.pipe.mjs +0 -24
  257. package/esm2022/lib/translator/translator.service.mjs +0 -21
  258. package/esm2022/lib/utils/array/array-util.mjs +0 -133
  259. package/esm2022/lib/utils/html/html-util.mjs +0 -200
  260. package/esm2022/lib/utils/html/html.module.mjs +0 -19
  261. package/esm2022/lib/utils/math/math-util.mjs +0 -6
  262. package/esm2022/lib/utils/object/object-util.mjs +0 -83
  263. package/esm2022/lib/utils/render/on-demand-preload-strategy.service.mjs +0 -21
  264. package/esm2022/lib/utils/render/render.service.mjs +0 -109
  265. package/esm2022/lib/utils/render/rendering.module.mjs +0 -35
  266. package/esm2022/lib/utils/scroll/scroll.directive.mjs +0 -56
  267. package/esm2022/lib/utils/scroll/scroll.module.mjs +0 -19
  268. package/esm2022/lib/utils/separator/separator.module.mjs +0 -19
  269. package/esm2022/lib/utils/separator/separator.pipe.mjs +0 -33
  270. package/lib/classes/base-page.class.d.ts +0 -13
  271. package/lib/classes/color.class.d.ts +0 -17
  272. package/lib/classes/datetime.class.d.ts +0 -63
  273. package/lib/classes/menu.class.d.ts +0 -34
  274. package/lib/classes/navigator.class.d.ts +0 -5
  275. package/lib/classes/popup.class.d.ts +0 -12
  276. package/lib/classes/promise.class.d.ts +0 -7
  277. package/lib/classes/sectionlist.class.d.ts +0 -8
  278. package/lib/classes/select.class.d.ts +0 -7
  279. package/lib/core.module.d.ts +0 -9
  280. package/lib/error/error.class.d.ts +0 -4
  281. package/lib/error/error.module.d.ts +0 -7
  282. package/lib/error/error.service.d.ts +0 -13
  283. package/lib/events/keyboard.d.ts +0 -2
  284. package/lib/http/http-error.class.d.ts +0 -7
  285. package/lib/http/http-events.interceptor.d.ts +0 -10
  286. package/lib/http/http-request.class.d.ts +0 -14
  287. package/lib/http/http-result.class.d.ts +0 -11
  288. package/lib/http/http.module.d.ts +0 -10
  289. package/lib/http/http.service.d.ts +0 -23
  290. package/lib/pipe/datetime.pipe.d.ts +0 -8
  291. package/lib/pipe/htmlToText.pipe.d.ts +0 -7
  292. package/lib/platform/index.d.ts +0 -1
  293. package/lib/services/config.d.ts +0 -9
  294. package/lib/services/navigator.service.d.ts +0 -8
  295. package/lib/services/storage.service.d.ts +0 -7
  296. package/lib/translator/translator.d.ts +0 -9
  297. package/lib/translator/translator.module.d.ts +0 -8
  298. package/lib/translator/translator.pipe.d.ts +0 -8
  299. package/lib/translator/translator.service.d.ts +0 -8
  300. package/lib/utils/array/array-util.d.ts +0 -6
  301. package/lib/utils/html/html-util.d.ts +0 -62
  302. package/lib/utils/html/html.module.d.ts +0 -8
  303. package/lib/utils/math/math-util.d.ts +0 -3
  304. package/lib/utils/object/object-util.d.ts +0 -7
  305. package/lib/utils/render/on-demand-preload-strategy.service.d.ts +0 -10
  306. package/lib/utils/render/render.service.d.ts +0 -18
  307. package/lib/utils/render/rendering.module.d.ts +0 -8
  308. package/lib/utils/scroll/scroll.directive.d.ts +0 -18
  309. package/lib/utils/scroll/scroll.module.d.ts +0 -8
  310. package/lib/utils/separator/separator.module.d.ts +0 -8
  311. package/lib/utils/separator/separator.pipe.d.ts +0 -8
@@ -0,0 +1,17 @@
1
+ import { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';
2
+ import * as i0 from "@angular/core";
3
+ export interface AXEqualValidationRuleOptions extends AXValidationRuleOptions {
4
+ value: any;
5
+ not?: boolean;
6
+ }
7
+ declare module '../validation.types' {
8
+ interface AXValidationRuleOptionsMap {
9
+ equal: AXEqualValidationRuleOptions;
10
+ }
11
+ }
12
+ export declare class AXEqualValidationRule implements AXValidationRule {
13
+ get name(): string;
14
+ validate(value: any, options: AXEqualValidationRuleOptions): Promise<AXValidationRuleResult>;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXEqualValidationRule, never>;
16
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXEqualValidationRule>;
17
+ }
@@ -0,0 +1,17 @@
1
+ import { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';
2
+ import * as i0 from "@angular/core";
3
+ export interface AXGreaterThanValidationRuleOptions extends AXValidationRuleOptions {
4
+ value: number;
5
+ inclusive?: boolean;
6
+ }
7
+ declare module '../validation.types' {
8
+ interface AXValidationRuleOptionsMap {
9
+ greaterThan: AXGreaterThanValidationRuleOptions;
10
+ }
11
+ }
12
+ export declare class AXGreaterThanValidationRule implements AXValidationRule {
13
+ get name(): string;
14
+ validate(value: number, options: AXGreaterThanValidationRuleOptions): Promise<AXValidationRuleResult>;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXGreaterThanValidationRule, never>;
16
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXGreaterThanValidationRule>;
17
+ }
@@ -0,0 +1,17 @@
1
+ import { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';
2
+ import * as i0 from "@angular/core";
3
+ export interface AXLengthValidationRuleOptions extends AXValidationRuleOptions {
4
+ min: number;
5
+ max: number;
6
+ }
7
+ declare module '../validation.types' {
8
+ interface AXValidationRuleOptionsMap {
9
+ length: AXLengthValidationRuleOptions;
10
+ }
11
+ }
12
+ export declare class AXLengthValidationRule implements AXValidationRule {
13
+ get name(): string;
14
+ validate(value: string, options: AXLengthValidationRuleOptions): Promise<AXValidationRuleResult>;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXLengthValidationRule, never>;
16
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXLengthValidationRule>;
17
+ }
@@ -0,0 +1,17 @@
1
+ import { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';
2
+ import * as i0 from "@angular/core";
3
+ export interface AXLessThanValidationRuleOptions extends AXValidationRuleOptions {
4
+ value: number;
5
+ inclusive?: boolean;
6
+ }
7
+ declare module '../validation.types' {
8
+ interface AXValidationRuleOptionsMap {
9
+ lessThan: AXLessThanValidationRuleOptions;
10
+ }
11
+ }
12
+ export declare class AXLessThanValidationRule implements AXValidationRule {
13
+ get name(): string;
14
+ validate(value: number, options: AXLessThanValidationRuleOptions): Promise<AXValidationRuleResult>;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXLessThanValidationRule, never>;
16
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXLessThanValidationRule>;
17
+ }
@@ -0,0 +1,16 @@
1
+ import { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';
2
+ import * as i0 from "@angular/core";
3
+ export interface AXMaxLengthValidationRuleOptions extends AXValidationRuleOptions {
4
+ value: number;
5
+ }
6
+ declare module '../validation.types' {
7
+ interface AXValidationRuleOptionsMap {
8
+ maxLength: AXMaxLengthValidationRuleOptions;
9
+ }
10
+ }
11
+ export declare class AXMaxLengthValidationRule implements AXValidationRule {
12
+ get name(): string;
13
+ validate(value: string, options: AXMaxLengthValidationRuleOptions): Promise<AXValidationRuleResult>;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXMaxLengthValidationRule, never>;
15
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXMaxLengthValidationRule>;
16
+ }
@@ -0,0 +1,16 @@
1
+ import { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';
2
+ import * as i0 from "@angular/core";
3
+ export interface AXMinLengthValidationRuleOptions extends AXValidationRuleOptions {
4
+ value: number;
5
+ }
6
+ declare module '../validation.types' {
7
+ interface AXValidationRuleOptionsMap {
8
+ minLength: AXMinLengthValidationRuleOptions;
9
+ }
10
+ }
11
+ export declare class AXMinLengthValidationRule implements AXValidationRule {
12
+ get name(): string;
13
+ validate(value: string, options: AXMinLengthValidationRuleOptions): Promise<AXValidationRuleResult>;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXMinLengthValidationRule, never>;
15
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXMinLengthValidationRule>;
16
+ }
@@ -0,0 +1,17 @@
1
+ import { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';
2
+ import * as i0 from "@angular/core";
3
+ export interface AXRegexValidationRuleOptions extends AXValidationRuleOptions {
4
+ pattern: string | RegExp;
5
+ }
6
+ declare module '../validation.types' {
7
+ interface AXValidationRuleOptionsMap {
8
+ regex: AXRegexValidationRuleOptions;
9
+ }
10
+ }
11
+ export declare class AXRegexValidationRule implements AXValidationRule {
12
+ private traslationService;
13
+ get name(): string;
14
+ validate(value: string, options: AXRegexValidationRuleOptions): Promise<AXValidationRuleResult>;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXRegexValidationRule, never>;
16
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXRegexValidationRule>;
17
+ }
@@ -0,0 +1,16 @@
1
+ import { AXValidationRule, AXValidationRuleOptions, AXValidationRuleResult } from '../validation.types';
2
+ import * as i0 from "@angular/core";
3
+ export interface AXRequiredValidationRuleOptions extends AXValidationRuleOptions {
4
+ }
5
+ declare module '../validation.types' {
6
+ interface AXValidationRuleOptionsMap {
7
+ required: AXRequiredValidationRuleOptions;
8
+ }
9
+ }
10
+ export declare class AXRequiredValidationRule implements AXValidationRule {
11
+ private traslationService;
12
+ get name(): string;
13
+ validate(value?: unknown, options?: AXRequiredValidationRuleOptions): Promise<AXValidationRuleResult>;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXRequiredValidationRule, never>;
15
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXRequiredValidationRule>;
16
+ }
@@ -0,0 +1,15 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { AXValidationRuleOptions, AXValidationRuleOptionsMap } from './validation.types';
3
+ export type AXValidationConfigRules = {
4
+ [key: string]: {
5
+ rule: keyof AXValidationRuleOptionsMap;
6
+ options: AXValidationRuleOptions;
7
+ };
8
+ };
9
+ export interface AXValidationConfig {
10
+ rules: AXValidationConfigRules;
11
+ }
12
+ export declare const AX_VALIDATION_CONFIG: InjectionToken<AXValidationConfig>;
13
+ export declare const AXValidationDefaultConfig: AXValidationConfig;
14
+ export type AXPartialValidationConfig = Partial<AXValidationConfig>;
15
+ export declare function validationConfig(config?: AXPartialValidationConfig): AXValidationConfig;
@@ -0,0 +1,17 @@
1
+ import { ModuleWithProviders } from '@angular/core';
2
+ import { AXValidationRule } from './validation.types';
3
+ import * as i0 from "@angular/core";
4
+ export interface AXValidationModuleConfigs {
5
+ rules: (new () => AXValidationRule)[];
6
+ }
7
+ export declare class AXValidationModule {
8
+ static forRoot(configs?: AXValidationModuleConfigs): ModuleWithProviders<AXValidationModule>;
9
+ static forChild(configs?: AXValidationModuleConfigs): ModuleWithProviders<AXValidationModule>;
10
+ /**
11
+ * @ignore
12
+ */
13
+ constructor(instances: any[]);
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXValidationModule, never>;
15
+ static ɵmod: i0.ɵɵNgModuleDeclaration<AXValidationModule, never, never, never>;
16
+ static ɵinj: i0.ɵɵInjectorDeclaration<AXValidationModule>;
17
+ }
@@ -0,0 +1,35 @@
1
+ import { Injector } from '@angular/core';
2
+ import { AXValidationRule, AXValidationRuleOptions, AXValidationRuleOptionsMap, AXValidationRuleResult, AXValidationSummary } from './validation.types';
3
+ import { AXValidationConfigRules } from './validation.config';
4
+ import { AXTranslationService } from '@acorex/core/translation';
5
+ import * as i0 from "@angular/core";
6
+ export declare class AXValidationRegistryService {
7
+ private plugins;
8
+ private configs;
9
+ get customRules(): AXValidationConfigRules;
10
+ private injector;
11
+ constructor(injector: Injector);
12
+ register(...plugins: (new () => AXValidationRule)[]): void;
13
+ get(ruleName: string): AXValidationRule | undefined;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXValidationRegistryService, never>;
15
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXValidationRegistryService>;
16
+ }
17
+ export declare class AXValidationService {
18
+ private pluginRegistry;
19
+ private translationService;
20
+ constructor(pluginRegistry: AXValidationRegistryService, translationService: AXTranslationService);
21
+ validate(ruleName: string, value: unknown, options?: AXValidationRuleOptions): Promise<AXValidationRuleResult>;
22
+ ruleFor(value: unknown): AXValidationRuleChain;
23
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXValidationService, never>;
24
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXValidationService>;
25
+ }
26
+ declare class AXValidationRuleChain {
27
+ private validationService;
28
+ private initialValue;
29
+ private rules;
30
+ private validationSummary;
31
+ constructor(validationService: AXValidationService, initialValue: unknown);
32
+ addRule<K extends keyof AXValidationRuleOptionsMap>(name: K, options?: AXValidationRuleOptionsMap[K]): AXValidationRuleChain;
33
+ validate(): Promise<AXValidationSummary>;
34
+ }
35
+ export {};
@@ -0,0 +1,21 @@
1
+ export interface AXValidationRuleOptions {
2
+ message?: string;
3
+ [key: string]: unknown;
4
+ }
5
+ export interface AXValidationRuleOptionsMap {
6
+ }
7
+ export declare abstract class AXValidationRule {
8
+ abstract get name(): string;
9
+ abstract validate(value: unknown, options?: AXValidationRuleOptions): Promise<AXValidationRuleResult>;
10
+ }
11
+ export interface AXValidationRuleResult {
12
+ rule: string;
13
+ value?: unknown;
14
+ message?: string | null;
15
+ result: boolean;
16
+ [key: string]: unknown;
17
+ }
18
+ export interface AXValidationSummary {
19
+ result: boolean;
20
+ rules: AXValidationRuleResult[];
21
+ }
@@ -1,26 +0,0 @@
1
- import { EventEmitter, Injectable } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- /**
4
- * @deprecated Use AXBasePageComponent from @acorex/components
5
- */
6
- // TODO: Add Angular decorator.
7
- export class AXBasePageComponent {
8
- onClosed = new EventEmitter();
9
- close(data) {
10
- this.onClosed.emit({
11
- component: this,
12
- data: data
13
- });
14
- }
15
- onClosing(e) {
16
- }
17
- ngOnDestroy() {
18
- this.onClosed.unsubscribe();
19
- }
20
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AXBasePageComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
21
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AXBasePageComponent });
22
- }
23
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i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3JhdG9yLlxuQEluamVjdGFibGUoKVxuZXhwb3J0IGFic3RyYWN0IGNsYXNzIEFYQmFzZVBhZ2VDb21wb25lbnQge1xuXG4gICAgb25DbG9zZWQ6IEV2ZW50RW1pdHRlcjxhbnk+ID0gbmV3IEV2ZW50RW1pdHRlcjxhbnk+KCk7XG5cbiAgICBjbG9zZShkYXRhPzogYW55KSB7XG4gICAgICAgIHRoaXMub25DbG9zZWQuZW1pdCh7XG4gICAgICAgICAgICBjb21wb25lbnQ6IHRoaXMsXG4gICAgICAgICAgICBkYXRhOiBkYXRhXG4gICAgICAgIH0pO1xuICAgIH1cblxuICAgIG9uQ2xvc2luZyhlOiBhbnkpOiB2b2lkIHwgUHJvbWlzZTx2b2lkPiB7XG4gICAgfVxuXG4gICAgbmdPbkRlc3Ryb3koKSB7XG4gICAgICAgIHRoaXMub25DbG9zZWQudW5zdWJzY3JpYmUoKTtcbiAgICB9XG5cblxufVxuXG5cbiJdfQ==
@@ -1,49 +0,0 @@
1
- export class AXColorUtil {
2
- static hex2Rgb(hexColor) {
3
- const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexColor);
4
- return result ? {
5
- r: parseInt(result[1], 16),
6
- g: parseInt(result[2], 16),
7
- b: parseInt(result[3], 16)
8
- } : null;
9
- }
10
- static rgb2Hex(r, g, b, a = 255) {
11
- let alpha;
12
- let hex = (r | 1 << 8).toString(16).slice(1) +
13
- (g | 1 << 8).toString(16).slice(1) +
14
- (b | 1 << 8).toString(16).slice(1);
15
- if (a !== 255) {
16
- alpha = a;
17
- }
18
- else {
19
- alpha = 1;
20
- }
21
- alpha = Math.round(alpha * 100) / 100;
22
- alpha = Math.round(alpha * 255);
23
- const hexAlpha = (alpha + 0x10000).toString(16).substr(-2).toUpperCase();
24
- return '#' + hex + (alpha == 255 ? '' : hexAlpha);
25
- }
26
- ;
27
- static illuminance(hexColor) {
28
- const rgbColor = AXColorUtil.hex2Rgb(hexColor);
29
- if (!rgbColor) {
30
- return -1;
31
- }
32
- const r = rgbColor.r;
33
- const g = rgbColor.g;
34
- const b = rgbColor.b;
35
- const a = [r, g, b].map(v => {
36
- v /= 255;
37
- return (v <= 0.03928) ?
38
- v / 12.92 :
39
- Math.pow(((v + 0.055) / 1.055), 2.4);
40
- });
41
- return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
42
- }
43
- static contrastToWhite(hexColor) {
44
- const whiteIlluminance = 1;
45
- const illuminance = AXColorUtil.illuminance(hexColor);
46
- return whiteIlluminance / illuminance;
47
- }
48
- }
49
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sb3IuY2xhc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2NvcmUvc3JjL2xpYi9jbGFzc2VzL2NvbG9yLmNsYXNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVFBLE1BQU0sT0FBTyxXQUFXO0lBR3BCLE1BQU0sQ0FBQyxPQUFPLENBQUMsUUFBZ0I7UUFDM0IsTUFBTSxNQUFNLEdBQUcsMkNBQTJDLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxDQUFDO1FBQzFFLE9BQU8sTUFBTSxDQUFDLENBQUMsQ0FBQztZQUNaLENBQUMsRUFBRSxRQUFRLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUUsQ0FBQztZQUMxQixDQUFDLEVBQUUsUUFBUSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsRUFBRSxFQUFFLENBQUM7WUFDMUIsQ0FBQyxFQUFFLFFBQVEsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRSxDQUFDO1NBQzdCLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQztJQUNiLENBQUM7SUFFRCxNQUFNLENBQUMsT0FBTyxDQUFDLENBQVMsR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iAgICAgICAgICAgIChiIHwgMSA8PCA4KS50b1N0cmluZygxNikuc2xpY2UoMSk7XG4gICAgICAgIGlmIChhICE9PSAyNTUpIHtcbiAgICAgICAgICAgIGFscGhhID0gYTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGFscGhhID0gMTtcbiAgICAgICAgfVxuXG4gICAgICAgIGFscGhhID0gTWF0aC5yb3VuZChhbHBoYSAqIDEwMCkgLyAxMDA7XG4gICAgICAgIGFscGhhID0gTWF0aC5yb3VuZChhbHBoYSAqIDI1NSk7XG4gICAgICAgIGNvbnN0IGhleEFscGhhID0gKGFscGhhICsgMHgxMDAwMCkudG9TdHJpbmcoMTYpLnN1YnN0cigtMikudG9VcHBlckNhc2UoKTtcbiAgICAgICAgcmV0dXJuICcjJyArIGhleCArIChhbHBoYSA9PSAyNTUgPyAnJyA6IGhleEFscGhhKTtcbiAgICB9O1xuXG4gICAgc3RhdGljIGlsbHVtaW5hbmNlKGhleENvbG9yOiBzdHJpbmcpIHtcbiAgICAgICAgY29uc3QgcmdiQ29sb3IgPSBBWENvbG9yVXRpbC5oZXgyUmdiKGhleENvbG9yKTtcbiAgICAgICAgaWYgKCFyZ2JDb2xvcikge1xuICAgICAgICAgICAgcmV0dXJuIC0xO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IHIgPSByZ2JDb2xvci5yO1xuICAgICAgICBjb25zdCBnID0gcmdiQ29sb3IuZztcbiAgICAgICAgY29uc3QgYiA9IHJnYkNvbG9yLmI7XG4gICAgICAgIGNvbnN0IGEgPSBbciwgZywgYl0ubWFwKHYgPT4ge1xuICAgICAgICAgICAgdiAvPSAyNTU7XG4gICAgICAgICAgICByZXR1cm4gKHYgPD0gMC4wMzkyOCkgP1xuICAgICAgICAgICAgICAgIHYgLyAxMi45MiA6XG4gICAgICAgICAgICAgICAgTWF0aC5wb3coKCh2ICsgMC4wNTUpIC8gMS4wNTUpLCAyLjQpO1xuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIGFbMF0gKiAwLjIxMjYgKyBhWzFdICogMC43MTUyICsgYVsyXSAqIDAuMDcyMjtcbiAgICB9XG5cbiAgICBzdGF0aWMgY29udHJhc3RUb1doaXRlKGhleENvbG9yOiBzdHJpbmcpIHtcbiAgICAgICAgY29uc3Qgd2hpdGVJbGx1bWluYW5jZSA9IDE7XG4gICAgICAgIGNvbnN0IGlsbHVtaW5hbmNlID0gQVhDb2xvclV0aWwuaWxsdW1pbmFuY2UoaGV4Q29sb3IpO1xuICAgICAgICByZXR1cm4gd2hpdGVJbGx1bWluYW5jZSAvIGlsbHVtaW5hbmNlO1xuICAgIH1cblxufVxuIl19